From: support Date: Wed, 15 Mar 2023 17:12:26 +0000 (+0000) Subject: Built motion from commit f57cc866.|2.6.31 X-Git-Url: http://repos.xcallymotion.com/base//%22angular-material.themes.css/%22?a=commitdiff_plain;h=6b8f670b70c93a2eb7d0063c31a1ba4f9ac9a33d;p=motion2.git Built motion from commit f57cc866.|2.6.31 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index c4317ea..76f5613 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-14T10:45:33.556Z", + "time": "2023-03-15T17:04:45.905Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 0aacbfe..8d569c7 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-14T10:45:33.556Z", + "time": "2023-03-15T17:04:45.905Z", "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 c9c7f39..8b57356 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 _0x5679=['sequelize','exports','getDataValue','action','STRING','contactManager','integration','motionbar','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]'];(function(_0x536bc2,_0x35c4bf){var _0x551b56=function(_0x4637a6){while(--_0x4637a6){_0x536bc2['push'](_0x536bc2['shift']());}};_0x551b56(++_0x35c4bf);}(_0x5679,0x104));var _0x9567=function(_0x1f5100,_0xf6d616){_0x1f5100=_0x1f5100-0x0;var _0x32d9c7=_0x5679[_0x1f5100];return _0x32d9c7;};'use strict';var Sequelize=require(_0x9567('0x0'));module[_0x9567('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1525f4){return this[_0x9567('0x2')](_0x9567('0x3'));}},'action':{'type':Sequelize[_0x9567('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x9567('0x5'),_0x9567('0x6'),_0x9567('0x7'),'jscripty',_0x9567('0x8'),_0x9567('0x9'),_0x9567('0xa'),_0x9567('0xb')]],'msg':_0x9567('0xc')}},'comment':_0x9567('0xc')},'data1':{'type':Sequelize[_0x9567('0x4')](0x1000),'comment':_0x9567('0xd')},'data2':{'type':Sequelize[_0x9567('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[_0x9567('0x4')](0x1000),'comment':_0x9567('0xe')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x9567('0xf')},'data5':{'type':Sequelize[_0x9567('0x4')](0x1000),'comments':_0x9567('0x10')},'data6':{'type':Sequelize[_0x9567('0x4')],'comments':_0x9567('0x11')},'data7':{'type':Sequelize[_0x9567('0x12')],'comments':_0x9567('0x13')}}; \ No newline at end of file +var _0x52a6=['urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','getDataValue','action','contactManager','motionbar','urlForward','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'];(function(_0x434db2,_0x113541){var _0x4e9284=function(_0x5d59b4){while(--_0x5d59b4){_0x434db2['push'](_0x434db2['shift']());}};_0x4e9284(++_0x113541);}(_0x52a6,0x16e));var _0x652a=function(_0x429db2,_0x1fe28d){_0x429db2=_0x429db2-0x0;var _0xa15965=_0x52a6[_0x429db2];return _0xa15965;};'use strict';var Sequelize=require(_0x652a('0x0'));module[_0x652a('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2f6465){return this[_0x652a('0x2')](_0x652a('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x652a('0x4'),'integration',_0x652a('0x5'),'jscripty',_0x652a('0x6'),'browser','bot',_0x652a('0x7')]],'msg':_0x652a('0x8')}},'comment':_0x652a('0x8')},'data1':{'type':Sequelize[_0x652a('0x9')](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[_0x652a('0x9')](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':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x652a('0xa')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x652a('0xb')},'data6':{'type':Sequelize[_0x652a('0x9')],'comments':_0x652a('0xc')},'data7':{'type':Sequelize['TEXT'],'comments':_0x652a('0xd')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 9017fc6..39655d6 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 _0x6ed8=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','name','send','update','body','Action','find','params','catch','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x6ed8,0xa1));var _0x86ed=function(_0x1fda27,_0x2b5c2d){_0x1fda27=_0x1fda27-0x0;var _0x2be4ff=_0x6ed8[_0x1fda27];return _0x2be4ff;};'use strict';var emlformat=require(_0x86ed('0x0'));var rimraf=require(_0x86ed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x86ed('0x2'));var rp=require(_0x86ed('0x3'));var moment=require(_0x86ed('0x4'));var BPromise=require(_0x86ed('0x5'));var Mustache=require(_0x86ed('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x86ed('0x7'));var ejs=require(_0x86ed('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x86ed('0x9'));var squel=require('squel');var crypto=require(_0x86ed('0xa'));var jsforce=require(_0x86ed('0xb'));var deskjs=require(_0x86ed('0xc'));var toCsv=require(_0x86ed('0x7'));var querystring=require(_0x86ed('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86ed('0xe'));var qs=require(_0x86ed('0xf'));var as=require(_0x86ed('0x10'));var hardwareService=require(_0x86ed('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x86ed('0x12'));var config=require(_0x86ed('0x13'));var licenseUtil=require(_0x86ed('0x14'));var db=require(_0x86ed('0x15'))['db'];function respondWithStatusCode(_0x530e7c,_0x4eac50){_0x4eac50=_0x4eac50||0xcc;return function(_0x574ded){if(_0x574ded){return _0x530e7c[_0x86ed('0x16')](_0x4eac50);}return _0x530e7c[_0x86ed('0x17')](_0x4eac50)[_0x86ed('0x18')]();};}function respondWithResult(_0x527ef1,_0x10dc8d){_0x10dc8d=_0x10dc8d||0xc8;return function(_0x45fde2){if(_0x45fde2){return _0x527ef1[_0x86ed('0x17')](_0x10dc8d)[_0x86ed('0x19')](_0x45fde2);}};}function respondWithFilteredResult(_0xbd27f3,_0x1ed9c0){return function(_0x52f7d6){if(_0x52f7d6){var _0x4b7743=typeof _0x1ed9c0[_0x86ed('0x1a')]===_0x86ed('0x1b')&&typeof _0x1ed9c0[_0x86ed('0x1c')]===_0x86ed('0x1b');var _0x162da4=_0x52f7d6[_0x86ed('0x1d')];var _0x4968c8=_0x4b7743?0x0:_0x1ed9c0['offset'];var _0x34039b=_0x4b7743?_0x52f7d6[_0x86ed('0x1d')]:_0x1ed9c0[_0x86ed('0x1a')]+_0x1ed9c0[_0x86ed('0x1c')];var _0x582f99;if(_0x34039b>=_0x162da4){_0x34039b=_0x162da4;_0x582f99=0xc8;}else{_0x582f99=0xce;}_0xbd27f3[_0x86ed('0x17')](_0x582f99);return _0xbd27f3['set'](_0x86ed('0x1e'),_0x4968c8+'-'+_0x34039b+'/'+_0x162da4)[_0x86ed('0x19')](_0x52f7d6);}return null;};}function patchUpdates(_0x3abacb){return function(_0x471267){try{jsonpatch[_0x86ed('0x1f')](_0x471267,_0x3abacb,!![]);}catch(_0x3a2bb6){return BPromise[_0x86ed('0x20')](_0x3a2bb6);}return _0x471267[_0x86ed('0x21')]();};}function saveUpdates(_0x5d0720,_0x146fdc){return function(_0x5ad334){if(_0x5ad334){return _0x5ad334['update'](_0x5d0720)['then'](function(_0x31091d){return _0x31091d;});}return null;};}function removeEntity(_0x3f2ec9,_0x59d2c7){return function(_0x3cfba6){if(_0x3cfba6){return _0x3cfba6['destroy']()[_0x86ed('0x22')](function(){_0x3f2ec9[_0x86ed('0x17')](0xcc)[_0x86ed('0x18')]();});}};}function handleEntityNotFound(_0x4d858e,_0x527122){return function(_0x1acc2d){if(!_0x1acc2d){_0x4d858e[_0x86ed('0x16')](0x194);}return _0x1acc2d;};}function handleError(_0x4cde7c,_0x2dd1bb){_0x2dd1bb=_0x2dd1bb||0x1f4;return function(_0x456c04){logger['error'](_0x456c04['stack']);if(_0x456c04[_0x86ed('0x23')]){delete _0x456c04[_0x86ed('0x23')];}_0x4cde7c[_0x86ed('0x17')](_0x2dd1bb)[_0x86ed('0x24')](_0x456c04);};}exports[_0x86ed('0x25')]=function(_0x4a50ba,_0x47c39f){if(_0x4a50ba['body']['id']){delete _0x4a50ba[_0x86ed('0x26')]['id'];}return db[_0x86ed('0x27')][_0x86ed('0x28')]({'where':{'id':_0x4a50ba[_0x86ed('0x29')]['id']}})[_0x86ed('0x22')](handleEntityNotFound(_0x47c39f,null))[_0x86ed('0x22')](saveUpdates(_0x4a50ba[_0x86ed('0x26')],null))[_0x86ed('0x22')](respondWithResult(_0x47c39f,null))[_0x86ed('0x2a')](handleError(_0x47c39f,null));};exports[_0x86ed('0x2b')]=function(_0x3a7cbc,_0x4af69e){return db[_0x86ed('0x27')]['find']({'where':{'id':_0x3a7cbc[_0x86ed('0x29')]['id']}})['then'](handleEntityNotFound(_0x4af69e,null))[_0x86ed('0x22')](removeEntity(_0x4af69e,null))['catch'](handleError(_0x4af69e,null));}; \ No newline at end of file +var _0x1a62=['Action','find','params','catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','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','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','body'];(function(_0x42752b,_0x1e1cbb){var _0x450eed=function(_0x2091ee){while(--_0x2091ee){_0x42752b['push'](_0x42752b['shift']());}};_0x450eed(++_0x1e1cbb);}(_0x1a62,0xef));var _0x21a6=function(_0x388402,_0x1de21f){_0x388402=_0x388402-0x0;var _0xb1830e=_0x1a62[_0x388402];return _0xb1830e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x21a6('0x0'));var jsonpatch=require(_0x21a6('0x1'));var rp=require(_0x21a6('0x2'));var moment=require(_0x21a6('0x3'));var BPromise=require(_0x21a6('0x4'));var Mustache=require(_0x21a6('0x5'));var util=require(_0x21a6('0x6'));var path=require(_0x21a6('0x7'));var sox=require(_0x21a6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x21a6('0x9'));var _=require('lodash');var squel=require(_0x21a6('0xa'));var crypto=require(_0x21a6('0xb'));var jsforce=require(_0x21a6('0xc'));var deskjs=require(_0x21a6('0xd'));var toCsv=require(_0x21a6('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x21a6('0xf'));var authService=require(_0x21a6('0x10'));var qs=require(_0x21a6('0x11'));var as=require(_0x21a6('0x12'));var hardwareService=require(_0x21a6('0x13'));var logger=require(_0x21a6('0x14'))(_0x21a6('0x15'));var utils=require(_0x21a6('0x16'));var config=require(_0x21a6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x21a6('0x18'))['db'];function respondWithStatusCode(_0x32dcfa,_0x243dfa){_0x243dfa=_0x243dfa||0xcc;return function(_0x4a085b){if(_0x4a085b){return _0x32dcfa[_0x21a6('0x19')](_0x243dfa);}return _0x32dcfa[_0x21a6('0x1a')](_0x243dfa)['end']();};}function respondWithResult(_0x3eeaa7,_0x3c29d8){_0x3c29d8=_0x3c29d8||0xc8;return function(_0x2548f8){if(_0x2548f8){return _0x3eeaa7[_0x21a6('0x1a')](_0x3c29d8)[_0x21a6('0x1b')](_0x2548f8);}};}function respondWithFilteredResult(_0x27960f,_0x5a3e02){return function(_0x116ed4){if(_0x116ed4){var _0x2982f0=typeof _0x5a3e02[_0x21a6('0x1c')]==='undefined'&&typeof _0x5a3e02[_0x21a6('0x1d')]==='undefined';var _0x582243=_0x116ed4[_0x21a6('0x1e')];var _0xfc631b=_0x2982f0?0x0:_0x5a3e02[_0x21a6('0x1c')];var _0x2af5c7=_0x2982f0?_0x116ed4[_0x21a6('0x1e')]:_0x5a3e02['offset']+_0x5a3e02[_0x21a6('0x1d')];var _0x379374;if(_0x2af5c7>=_0x582243){_0x2af5c7=_0x582243;_0x379374=0xc8;}else{_0x379374=0xce;}_0x27960f[_0x21a6('0x1a')](_0x379374);return _0x27960f[_0x21a6('0x1f')](_0x21a6('0x20'),_0xfc631b+'-'+_0x2af5c7+'/'+_0x582243)[_0x21a6('0x1b')](_0x116ed4);}return null;};}function patchUpdates(_0x1d28bf){return function(_0x37b77d){try{jsonpatch[_0x21a6('0x21')](_0x37b77d,_0x1d28bf,!![]);}catch(_0x56394d){return BPromise[_0x21a6('0x22')](_0x56394d);}return _0x37b77d[_0x21a6('0x23')]();};}function saveUpdates(_0x35d39c,_0x1bcb35){return function(_0x10c5fb){if(_0x10c5fb){return _0x10c5fb[_0x21a6('0x24')](_0x35d39c)[_0x21a6('0x25')](function(_0x401a06){return _0x401a06;});}return null;};}function removeEntity(_0x31e166,_0x100ee9){return function(_0x32f33e){if(_0x32f33e){return _0x32f33e[_0x21a6('0x26')]()[_0x21a6('0x25')](function(){_0x31e166[_0x21a6('0x1a')](0xcc)[_0x21a6('0x27')]();});}};}function handleEntityNotFound(_0x3f3de3,_0x45d307){return function(_0x104e4b){if(!_0x104e4b){_0x3f3de3[_0x21a6('0x19')](0x194);}return _0x104e4b;};}function handleError(_0x4fcc96,_0x4455d5){_0x4455d5=_0x4455d5||0x1f4;return function(_0x14f196){logger['error'](_0x14f196[_0x21a6('0x28')]);if(_0x14f196[_0x21a6('0x29')]){delete _0x14f196[_0x21a6('0x29')];}_0x4fcc96[_0x21a6('0x1a')](_0x4455d5)['send'](_0x14f196);};}exports[_0x21a6('0x24')]=function(_0x1af751,_0x2396d2){if(_0x1af751[_0x21a6('0x2a')]['id']){delete _0x1af751['body']['id'];}return db[_0x21a6('0x2b')][_0x21a6('0x2c')]({'where':{'id':_0x1af751[_0x21a6('0x2d')]['id']}})[_0x21a6('0x25')](handleEntityNotFound(_0x2396d2,null))['then'](saveUpdates(_0x1af751[_0x21a6('0x2a')],null))[_0x21a6('0x25')](respondWithResult(_0x2396d2,null))['catch'](handleError(_0x2396d2,null));};exports[_0x21a6('0x26')]=function(_0xcb6af4,_0x5817ca){return db[_0x21a6('0x2b')][_0x21a6('0x2c')]({'where':{'id':_0xcb6af4[_0x21a6('0x2d')]['id']}})[_0x21a6('0x25')](handleEntityNotFound(_0x5817ca,null))[_0x21a6('0x25')](removeEntity(_0x5817ca,null))[_0x21a6('0x2e')](handleError(_0x5817ca,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 503e475..3c46cc9 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 _0x6ecb=['util','../../config/logger','api','moment','bluebird','rimraf','./action.attributes','exports','define','Action','tools_actions','lodash'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x6ecb,0x14f));var _0xb6ec=function(_0x4e4c69,_0x5d7f1c){_0x4e4c69=_0x4e4c69-0x0;var _0x35def9=_0x6ecb[_0x4e4c69];return _0x35def9;};'use strict';var _=require(_0xb6ec('0x0'));var util=require(_0xb6ec('0x1'));var logger=require(_0xb6ec('0x2'))(_0xb6ec('0x3'));var moment=require(_0xb6ec('0x4'));var BPromise=require(_0xb6ec('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb6ec('0x6'));var config=require('../../config/environment');var attributes=require(_0xb6ec('0x7'));module[_0xb6ec('0x8')]=function(_0x5bab6,_0x2e7b4e){return _0x5bab6[_0xb6ec('0x9')](_0xb6ec('0xa'),attributes,{'tableName':_0xb6ec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c07=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','tools_actions','lodash','util','../../config/logger','api'];(function(_0x2d4e13,_0x544831){var _0x487523=function(_0x186095){while(--_0x186095){_0x2d4e13['push'](_0x2d4e13['shift']());}};_0x487523(++_0x544831);}(_0x0c07,0x8b));var _0x70c0=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0x0c07[_0x17bb31];return _0x505c71;};'use strict';var _=require(_0x70c0('0x0'));var util=require(_0x70c0('0x1'));var logger=require(_0x70c0('0x2'))(_0x70c0('0x3'));var moment=require(_0x70c0('0x4'));var BPromise=require(_0x70c0('0x5'));var rp=require(_0x70c0('0x6'));var fs=require('fs');var path=require(_0x70c0('0x7'));var rimraf=require(_0x70c0('0x8'));var config=require(_0x70c0('0x9'));var attributes=require(_0x70c0('0xa'));module[_0x70c0('0xb')]=function(_0x5b920d,_0x379689){return _0x5b920d['define']('Action',attributes,{'tableName':_0x70c0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index fbdda82..2e1db98 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 _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(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x4975,0x86));var _0x5497=function(_0x35c2ea,_0x3bedd8){_0x35c2ea=_0x35c2ea-0x0;var _0x330815=_0x4975[_0x35c2ea];return _0x330815;};'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 +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x38d979,_0x87025f){var _0x2839bd=function(_0x37d603){while(--_0x37d603){_0x38d979['push'](_0x38d979['shift']());}};_0x2839bd(++_0x87025f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index ab48a6f..43c578b 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 _0x2e52=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','update','delete'];(function(_0x52da76,_0x4b4be5){var _0x3ce510=function(_0x2b8acd){while(--_0x2b8acd){_0x52da76['push'](_0x52da76['shift']());}};_0x3ce510(++_0x4b4be5);}(_0x2e52,0xc6));var _0x22e5=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x2e52[_0x13b8f3];return _0x1a6d06;};'use strict';var multer=require('multer');var util=require(_0x22e5('0x0'));var path=require(_0x22e5('0x1'));var timeout=require(_0x22e5('0x2'));var express=require(_0x22e5('0x3'));var router=express[_0x22e5('0x4')]();var fs_extra=require(_0x22e5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x22e5('0x6'));var config=require(_0x22e5('0x7'));var controller=require('./action.controller');router['put'](_0x22e5('0x8'),auth[_0x22e5('0x9')](),controller[_0x22e5('0xa')]);router[_0x22e5('0xb')](_0x22e5('0x8'),auth['isAuthenticated'](),controller[_0x22e5('0xc')]);module[_0x22e5('0xd')]=router; \ No newline at end of file +var _0x1931=['../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x583f82,_0xf23fcd){var _0x710688=function(_0x1b9777){while(--_0x1b9777){_0x583f82['push'](_0x583f82['shift']());}};_0x710688(++_0xf23fcd);}(_0x1931,0xb9));var _0x1193=function(_0x394659,_0x46f5d9){_0x394659=_0x394659-0x0;var _0x63dc75=_0x1931[_0x394659];return _0x63dc75;};'use strict';var multer=require(_0x1193('0x0'));var util=require(_0x1193('0x1'));var path=require('path');var timeout=require(_0x1193('0x2'));var express=require(_0x1193('0x3'));var router=express[_0x1193('0x4')]();var fs_extra=require(_0x1193('0x5'));var auth=require(_0x1193('0x6'));var interaction=require(_0x1193('0x7'));var config=require('../../config/environment');var controller=require(_0x1193('0x8'));router[_0x1193('0x9')](_0x1193('0xa'),auth[_0x1193('0xb')](),controller[_0x1193('0xc')]);router[_0x1193('0xd')](_0x1193('0xa'),auth[_0x1193('0xb')](),controller[_0x1193('0xe')]);module[_0x1193('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 9eebb33..1ae2699 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.attributes.js +++ b/server/api/analyticCustomReport/analyticCustomReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8fb=['TEXT','sequelize','exports','STRING'];(function(_0x58b9ee,_0x1ad7a7){var _0x10b356=function(_0x18d48f){while(--_0x18d48f){_0x58b9ee['push'](_0x58b9ee['shift']());}};_0x10b356(++_0x1ad7a7);}(_0xd8fb,0x99));var _0xbd8f=function(_0x12624f,_0x17bdd6){_0x12624f=_0x12624f-0x0;var _0x83fc5e=_0xd8fb[_0x12624f];return _0x83fc5e;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'name':{'type':Sequelize[_0xbd8f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbd8f('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbd8f('0x3')]}}; \ No newline at end of file +var _0x3f8a=['TEXT','sequelize','exports','STRING'];(function(_0x2203ec,_0x1831e1){var _0x28a943=function(_0x4aee27){while(--_0x4aee27){_0x2203ec['push'](_0x2203ec['shift']());}};_0x28a943(++_0x1831e1);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x2ce261,_0x444d40){_0x2ce261=_0x2ce261-0x0;var _0x4a26a8=_0x3f8a[_0x2ce261];return _0x4a26a8;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'name':{'type':Sequelize[_0xa3f8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa3f8('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xa3f8('0x2')]},'conditions':{'type':Sequelize[_0xa3f8('0x3')]},'joins':{'type':Sequelize[_0xa3f8('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index f42bb0c..7daf767 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 _0x9d62=['Run\x20Query:','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','Please\x20insert\x20at\x20least\x20one\x20field','debug','eml-format','rimraf','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','get','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','Reports','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','AnalyticMetric','select','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','toString','sequelize','QueryTypes','SELECT','GROUP_CONCAT(%s)','DATE(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','value','ValidationErrorItem','keyBy','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate'];(function(_0x131df6,_0x1c9ed0){var _0x44f2e5=function(_0x2bb0de){while(--_0x2bb0de){_0x131df6['push'](_0x131df6['shift']());}};_0x44f2e5(++_0x1c9ed0);}(_0x9d62,0xaf));var _0x29d6=function(_0x4812a9,_0x136b24){_0x4812a9=_0x4812a9-0x0;var _0x8a930f=_0x9d62[_0x4812a9];return _0x8a930f;};'use strict';var emlformat=require(_0x29d6('0x0'));var rimraf=require(_0x29d6('0x1'));var zipdir=require(_0x29d6('0x2'));var jsonpatch=require(_0x29d6('0x3'));var rp=require(_0x29d6('0x4'));var moment=require('moment');var BPromise=require(_0x29d6('0x5'));var Mustache=require(_0x29d6('0x6'));var util=require(_0x29d6('0x7'));var path=require(_0x29d6('0x8'));var sox=require(_0x29d6('0x9'));var csv=require('to-csv');var ejs=require(_0x29d6('0xa'));var fs=require('fs');var fs_extra=require(_0x29d6('0xb'));var _=require(_0x29d6('0xc'));var squel=require(_0x29d6('0xd'));var crypto=require(_0x29d6('0xe'));var jsforce=require(_0x29d6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x29d6('0x10'));var querystring=require(_0x29d6('0x11'));var Papa=require(_0x29d6('0x12'));var Redis=require(_0x29d6('0x13'));var authService=require(_0x29d6('0x14'));var qs=require(_0x29d6('0x15'));var as=require(_0x29d6('0x16'));var hardwareService=require(_0x29d6('0x17'));var logger=require('../../config/logger')(_0x29d6('0x18'));var utils=require(_0x29d6('0x19'));var config=require(_0x29d6('0x1a'));var licenseUtil=require(_0x29d6('0x1b'));var db=require(_0x29d6('0x1c'))['db'];var dbH=require(_0x29d6('0x1c'))[_0x29d6('0x1d')];function respondWithStatusCode(_0x4bb3e2,_0x32d024){_0x32d024=_0x32d024||0xcc;return function(_0x5d7e8a){if(_0x5d7e8a){return _0x4bb3e2[_0x29d6('0x1e')](_0x32d024);}return _0x4bb3e2[_0x29d6('0x1f')](_0x32d024)[_0x29d6('0x20')]();};}function respondWithResult(_0x305a69,_0x5aba64){_0x5aba64=_0x5aba64||0xc8;return function(_0x4b5142){if(_0x4b5142){return _0x305a69['status'](_0x5aba64)[_0x29d6('0x21')](_0x4b5142);}};}function respondWithFilteredResult(_0x30d39f,_0x261225){return function(_0x93bf56){if(_0x93bf56){var _0x40cac1=typeof _0x261225[_0x29d6('0x22')]===_0x29d6('0x23')&&typeof _0x261225['limit']===_0x29d6('0x23');var _0x46307e=_0x93bf56[_0x29d6('0x24')];var _0x50c734=_0x40cac1?0x0:_0x261225[_0x29d6('0x22')];var _0x431496=_0x40cac1?_0x93bf56[_0x29d6('0x24')]:_0x261225[_0x29d6('0x22')]+_0x261225[_0x29d6('0x25')];var _0xc193d;if(_0x431496>=_0x46307e){_0x431496=_0x46307e;_0xc193d=0xc8;}else{_0xc193d=0xce;}_0x30d39f[_0x29d6('0x1f')](_0xc193d);return _0x30d39f[_0x29d6('0x26')]('Content-Range',_0x50c734+'-'+_0x431496+'/'+_0x46307e)[_0x29d6('0x21')](_0x93bf56);}return null;};}function patchUpdates(_0x425263){return function(_0x5c2774){try{jsonpatch[_0x29d6('0x27')](_0x5c2774,_0x425263,!![]);}catch(_0x3f5d3d){return BPromise[_0x29d6('0x28')](_0x3f5d3d);}return _0x5c2774['save']();};}function saveUpdates(_0x53f285,_0x1d8d32){return function(_0x4a7414){if(_0x4a7414){return _0x4a7414[_0x29d6('0x29')](_0x53f285)[_0x29d6('0x2a')](function(_0x51cff7){return _0x51cff7;});}return null;};}function removeEntity(_0x8d91f5,_0x28370b){return function(_0xbb646a){if(_0xbb646a){return _0xbb646a[_0x29d6('0x2b')]()[_0x29d6('0x2a')](function(){var _0x4d0f45=_0xbb646a[_0x29d6('0x2c')]({'plain':!![]});var _0x4c6583='CustomReports';return db['UserProfileResource'][_0x29d6('0x2b')]({'where':{'type':_0x4c6583,'resourceId':_0x4d0f45['id']}})['then'](function(){return _0xbb646a;});})[_0x29d6('0x2a')](function(){_0x8d91f5[_0x29d6('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x210ee1,_0x53830a){return function(_0x469c2f){if(!_0x469c2f){_0x210ee1['sendStatus'](0x194);}return _0x469c2f;};}function handleError(_0x4af26f,_0x110dc5){_0x110dc5=_0x110dc5||0x1f4;return function(_0x20ab9b){logger['error'](_0x20ab9b[_0x29d6('0x2d')]);if(_0x20ab9b[_0x29d6('0x2e')]){delete _0x20ab9b[_0x29d6('0x2e')];}_0x4af26f[_0x29d6('0x1f')](_0x110dc5)['send'](_0x20ab9b);};}exports[_0x29d6('0x2f')]=function(_0x5eb783,_0x49abc9){var _0x47ebba={},_0x420a15={},_0x7665c4={'count':0x0,'rows':[]};var _0x5a7d8d=_[_0x29d6('0x30')](db[_0x29d6('0x31')][_0x29d6('0x32')],function(_0x2c8ef2){return{'name':_0x2c8ef2[_0x29d6('0x33')],'type':_0x2c8ef2['type'][_0x29d6('0x34')]};});_0x420a15[_0x29d6('0x35')]=_[_0x29d6('0x30')](_0x5a7d8d,_0x29d6('0x2e'));_0x420a15['query']=_[_0x29d6('0x36')](_0x5eb783[_0x29d6('0x37')]);_0x420a15[_0x29d6('0x38')]=_[_0x29d6('0x39')](_0x420a15[_0x29d6('0x35')],_0x420a15['query']);_0x47ebba[_0x29d6('0x3a')]=_[_0x29d6('0x39')](_0x420a15[_0x29d6('0x35')],qs[_0x29d6('0x3b')](_0x5eb783[_0x29d6('0x37')][_0x29d6('0x3b')]));_0x47ebba[_0x29d6('0x3a')]=_0x47ebba[_0x29d6('0x3a')][_0x29d6('0x3c')]?_0x47ebba[_0x29d6('0x3a')]:_0x420a15[_0x29d6('0x35')];if(!_0x5eb783[_0x29d6('0x37')]['hasOwnProperty']('nolimit')){_0x47ebba['limit']=qs[_0x29d6('0x25')](_0x5eb783[_0x29d6('0x37')]['limit']);_0x47ebba[_0x29d6('0x22')]=qs[_0x29d6('0x22')](_0x5eb783[_0x29d6('0x37')][_0x29d6('0x22')]);}_0x47ebba[_0x29d6('0x3d')]=qs[_0x29d6('0x3e')](_0x5eb783['query'][_0x29d6('0x3e')]);_0x47ebba[_0x29d6('0x3f')]=qs[_0x29d6('0x38')](_[_0x29d6('0x40')](_0x5eb783[_0x29d6('0x37')],_0x420a15[_0x29d6('0x38')]),_0x5a7d8d);if(_0x5eb783[_0x29d6('0x37')][_0x29d6('0x41')]){_0x47ebba[_0x29d6('0x3f')]=_[_0x29d6('0x42')](_0x47ebba[_0x29d6('0x3f')],{'$or':_[_0x29d6('0x30')](_0x5a7d8d,function(_0xaa6d97){if(_0xaa6d97[_0x29d6('0x43')]!==_0x29d6('0x44')){var _0x23b31f={};_0x23b31f[_0xaa6d97[_0x29d6('0x2e')]]={'$like':'%'+_0x5eb783['query']['filter']+'%'};return _0x23b31f;}})});}_0x47ebba=_[_0x29d6('0x42')]({},_0x47ebba,_0x5eb783[_0x29d6('0x45')]);var _0x281cdc={'where':_0x47ebba[_0x29d6('0x3f')]};return db[_0x29d6('0x31')][_0x29d6('0x24')](_0x281cdc)[_0x29d6('0x2a')](function(_0x2b004e){_0x7665c4['count']=_0x2b004e;if(_0x5eb783[_0x29d6('0x37')][_0x29d6('0x46')]){_0x47ebba[_0x29d6('0x47')]=[{'all':!![]}];}return db[_0x29d6('0x31')][_0x29d6('0x48')](_0x47ebba);})[_0x29d6('0x2a')](function(_0xbbce8b){_0x7665c4[_0x29d6('0x49')]=_0xbbce8b;return _0x7665c4;})['then'](respondWithFilteredResult(_0x49abc9,_0x47ebba))[_0x29d6('0x4a')](handleError(_0x49abc9,null));};exports[_0x29d6('0x4b')]=function(_0x2c3cd5,_0x43042d){var _0x5038ef={'raw':![],'where':{'id':_0x2c3cd5[_0x29d6('0x4c')]['id']}},_0x170acc={};_0x170acc[_0x29d6('0x35')]=_[_0x29d6('0x36')](db[_0x29d6('0x31')][_0x29d6('0x32')]);_0x170acc[_0x29d6('0x37')]=_['keys'](_0x2c3cd5[_0x29d6('0x37')]);_0x170acc[_0x29d6('0x38')]=_[_0x29d6('0x39')](_0x170acc['model'],_0x170acc['query']);_0x5038ef[_0x29d6('0x3a')]=_[_0x29d6('0x39')](_0x170acc[_0x29d6('0x35')],qs[_0x29d6('0x3b')](_0x2c3cd5[_0x29d6('0x37')]['fields']));_0x5038ef[_0x29d6('0x3a')]=_0x5038ef[_0x29d6('0x3a')]['length']?_0x5038ef['attributes']:_0x170acc['model'];if(_0x2c3cd5[_0x29d6('0x37')][_0x29d6('0x46')]){_0x5038ef[_0x29d6('0x47')]=[{'all':!![]}];}_0x5038ef=_[_0x29d6('0x42')]({},_0x5038ef,_0x2c3cd5[_0x29d6('0x45')]);return db[_0x29d6('0x31')][_0x29d6('0x4d')](_0x5038ef)['then'](handleEntityNotFound(_0x43042d,null))[_0x29d6('0x2a')](respondWithResult(_0x43042d,null))[_0x29d6('0x4a')](handleError(_0x43042d,null));};exports[_0x29d6('0x4e')]=function(_0x570a3c,_0x82e621){return db[_0x29d6('0x31')][_0x29d6('0x4e')](_0x570a3c[_0x29d6('0x4f')],{})[_0x29d6('0x2a')](function(_0x3341f2){var _0x2ac52a=_0x570a3c[_0x29d6('0x50')][_0x29d6('0x2c')]({'plain':!![]});if(!_0x2ac52a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ac52a[_0x29d6('0x51')]===_0x29d6('0x50')){var _0x1acbac=_0x3341f2[_0x29d6('0x2c')]({'plain':!![]});var _0x22cfb4=_0x29d6('0x52');return db[_0x29d6('0x53')][_0x29d6('0x4d')]({'where':{'name':_0x22cfb4,'userProfileId':_0x2ac52a['userProfileId']},'raw':!![]})[_0x29d6('0x2a')](function(_0x43dc87){if(_0x43dc87&&_0x43dc87[_0x29d6('0x54')]===0x0){return db['UserProfileResource'][_0x29d6('0x4e')]({'name':_0x1acbac[_0x29d6('0x2e')],'resourceId':_0x1acbac['id'],'type':'CustomReports','sectionId':_0x43dc87['id']},{})[_0x29d6('0x2a')](function(){return _0x3341f2;});}else{return _0x3341f2;}})[_0x29d6('0x4a')](function(_0x2184a4){logger[_0x29d6('0x55')](_0x29d6('0x56'),_0x2184a4);throw _0x2184a4;});}return _0x3341f2;})[_0x29d6('0x2a')](respondWithResult(_0x82e621,0xc9))['catch'](handleError(_0x82e621,null));};exports[_0x29d6('0x29')]=function(_0x59f9ea,_0x49e2fe){if(_0x59f9ea[_0x29d6('0x4f')]['id']){delete _0x59f9ea[_0x29d6('0x4f')]['id'];}return db['AnalyticCustomReport'][_0x29d6('0x4d')]({'where':{'id':_0x59f9ea[_0x29d6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x49e2fe,null))[_0x29d6('0x2a')](saveUpdates(_0x59f9ea[_0x29d6('0x4f')],null))[_0x29d6('0x2a')](respondWithResult(_0x49e2fe,null))[_0x29d6('0x4a')](handleError(_0x49e2fe,null));};exports[_0x29d6('0x2b')]=function(_0x279ec8,_0x36c7ce){return db[_0x29d6('0x31')][_0x29d6('0x4d')]({'where':{'id':_0x279ec8['params']['id']}})[_0x29d6('0x2a')](handleEntityNotFound(_0x36c7ce,null))[_0x29d6('0x2a')](removeEntity(_0x36c7ce,null))['catch'](handleError(_0x36c7ce,null));};exports[_0x29d6('0x57')]=function(_0x52c285,_0x13c26a){var _0x1502f3=0xa;var _0x3a46aa=[_0x29d6('0x58'),_0x29d6('0x59'),_0x29d6('0x5a'),_0x29d6('0x5b')];var _0xbdc27b={'SUM':_0x29d6('0x5c'),'COUNT':_0x29d6('0x5d'),'COUNT DISTINCT':_0x29d6('0x5e'),'MAX':_0x29d6('0x5f'),'MIN':_0x29d6('0x60'),'AVG':_0x29d6('0x61'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x29d6('0x62'),'GROUP_CONCAT DESC':_0x29d6('0x63')};var _0x367a1e={'SEC_TO_TIME':_0x29d6('0x64'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x29d6('0x65'),'UNIX_TIMESTAMP':_0x29d6('0x66')};var _0x42bc78=function(_0x2e6796){return!_[_0x29d6('0x67')]([_0x29d6('0x68'),'IS\x20NOT\x20NULL',_0x29d6('0x69'),'IS\x20NOT\x20EMPTY'],_0x2e6796);};var _0x5d227a=function(_0x37c370){if(!_0x37c370||!_0x37c370[_0x29d6('0x6a')][_0x29d6('0x3c')]){return'';}for(var _0x25123d='(',_0xd6d6de=0x0;_0xd6d6de<_0x37c370['rules'][_0x29d6('0x3c')];_0xd6d6de+=0x1){_0xd6d6de>0x0&&(_0x25123d+='\x20'+_0x37c370[_0x29d6('0x6b')]+'\x20');_0x25123d+=_0x37c370[_0x29d6('0x6a')][_0xd6d6de][_0x29d6('0x6c')]?_0x5d227a(_0x37c370[_0x29d6('0x6a')][_0xd6d6de]['group']):_0x37c370[_0x29d6('0x6a')][_0xd6d6de][_0x29d6('0x6d')]+'\x20'+_0x37c370['rules'][_0xd6d6de][_0x29d6('0x6e')]+(_0x42bc78(_0x37c370[_0x29d6('0x6a')][_0xd6d6de][_0x29d6('0x6e')])?'\x20'+_0x37c370['rules'][_0xd6d6de]['value']:'');}return _0x25123d+')';};var _0x54ab3b={'where':{'id':_0x52c285['params']['id']}},_0x13132e,_0x3800fe,_0x12201b,_0x25a71c,_0x3d4f9e;_0x54ab3b=_[_0x29d6('0x42')]({},_0x54ab3b,_0x52c285['options']);return db[_0x29d6('0x31')]['find'](_0x54ab3b)['then'](function(_0x56049a){if(_0x56049a){_0x13132e=_0x56049a;return _0x56049a[_0x29d6('0x6f')]();}return null;})[_0x29d6('0x2a')](function(_0x4b79af){if(_0x4b79af){if(!_0x4b79af[_0x29d6('0x3c')]){throw new db[(_0x29d6('0x70'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3800fe=_0x4b79af;return db[_0x29d6('0x71')]['findAll']({'raw':!![]});}return null;})[_0x29d6('0x2a')](function(_0x4a12cd){if(_0x4a12cd){_0x12201b=_['keyBy'](_0x4a12cd,'id');var _0x56f05f;var _0x353c4c=squel[_0x29d6('0x72')]();_0x353c4c[_0x29d6('0x73')](_0x13132e[_0x29d6('0x74')]);for(var _0x3765de=0x0;_0x3765de<_0x3800fe[_0x29d6('0x3c')];_0x3765de+=0x1){_0x56f05f=_0x3800fe[_0x3765de][_0x29d6('0x75')]?_0x12201b[_0x3800fe[_0x3765de][_0x29d6('0x75')]][_0x29d6('0x76')]:_0x3800fe[_0x3765de][_0x29d6('0x6d')];_0x56f05f=_0x3800fe[_0x3765de]['function']?_[_0x29d6('0x77')](_0xbdc27b[_0x3800fe[_0x3765de][_0x29d6('0x78')]],'%s',_0x56f05f):_0x56f05f;_0x56f05f=_0x3800fe[_0x3765de]['format']?_['replace'](_0x367a1e[_0x3800fe[_0x3765de][_0x29d6('0x79')]],'%s',_0x56f05f):_0x56f05f;if(_0x3800fe[_0x3765de][_0x29d6('0x7a')]){_0x353c4c[_0x29d6('0x6c')](_0x56f05f);}_0x3800fe[_0x3765de][_0x29d6('0x7b')]&&_0x353c4c[_0x29d6('0x3d')](_0x56f05f,_0x3800fe[_0x3765de][_0x29d6('0x7b')]===_0x29d6('0x7c')?![]:!![]);_0x353c4c[_0x29d6('0x6d')](_0x56f05f,_0x3800fe[_0x3765de][_0x29d6('0x7d')]||_0x56f05f);}if(_0x13132e[_0x29d6('0x7e')]){_0x13132e[_0x29d6('0x7e')]=JSON[_0x29d6('0x7f')](_0x13132e['joins']);for(var _0x4db9b6=0x0;_0x4db9b6<_0x13132e[_0x29d6('0x7e')][_0x29d6('0x3c')];_0x4db9b6+=0x1){if(_0x13132e['joins'][_0x4db9b6][_0x29d6('0x43')]&&_[_0x29d6('0x67')](_0x3a46aa,_0x13132e[_0x29d6('0x7e')][_0x4db9b6][_0x29d6('0x43')])&&_0x13132e[_0x29d6('0x7e')][_0x4db9b6][_0x29d6('0x80')]&&_0x13132e[_0x29d6('0x7e')][_0x4db9b6][_0x29d6('0x81')]&&_0x13132e[_0x29d6('0x7e')][_0x4db9b6][_0x29d6('0x82')]){_0x353c4c[_0x13132e[_0x29d6('0x7e')][_0x4db9b6][_0x29d6('0x43')]](_0x13132e[_0x29d6('0x7e')][_0x4db9b6][_0x29d6('0x81')],null,util[_0x29d6('0x79')]('%s.%s\x20=\x20%s.%s',_0x13132e[_0x29d6('0x74')],_0x13132e[_0x29d6('0x7e')][_0x4db9b6][_0x29d6('0x80')],_0x13132e[_0x29d6('0x7e')][_0x4db9b6][_0x29d6('0x81')],_0x13132e['joins'][_0x4db9b6][_0x29d6('0x82')]));}}}if(_0x13132e[_0x29d6('0x83')]){_0x13132e[_0x29d6('0x83')]=JSON[_0x29d6('0x7f')](_0x13132e[_0x29d6('0x83')]);_0x353c4c[_0x29d6('0x3f')](_0x5d227a(_0x13132e[_0x29d6('0x83')][_0x29d6('0x6c')]));}_0x3d4f9e=_0x353c4c[_0x29d6('0x84')]();_0x353c4c[_0x29d6('0x25')](_0x1502f3);_0x353c4c[_0x29d6('0x22')](0x0);logger['debug']('Limited\x20Query:',_0x353c4c[_0x29d6('0x85')]());return dbH[_0x29d6('0x86')][_0x29d6('0x37')](_0x353c4c['toString'](),{'type':dbH[_0x29d6('0x86')][_0x29d6('0x87')][_0x29d6('0x88')]});}})['then'](respondWithResult(_0x13c26a,null))['catch'](handleError(_0x13c26a,null));};function runReport(_0x2160cb,_0x40e0a4,_0x3bc4b7){var _0x367900=_0x40e0a4[_0x29d6('0x2e')];var _0xaa8c47=0xa;var _0x37523a=[_0x29d6('0x58'),_0x29d6('0x59'),_0x29d6('0x5a'),_0x29d6('0x5b')];var _0x29a070={'SUM':_0x29d6('0x5c'),'COUNT':_0x29d6('0x5d'),'COUNT DISTINCT':_0x29d6('0x5e'),'MAX':_0x29d6('0x5f'),'MIN':_0x29d6('0x60'),'AVG':_0x29d6('0x61'),'GROUP_CONCAT':_0x29d6('0x89'),'GROUP_CONCAT ASC':_0x29d6('0x62'),'GROUP_CONCAT DESC':_0x29d6('0x63')};var _0x18cc18={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x29d6('0x8a'),'HOUR':'HOUR(%s)','ROUND':_0x29d6('0x65'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5c3075=function(_0x2fb57c){return!_['includes']([_0x29d6('0x68'),_0x29d6('0x8b'),_0x29d6('0x69'),_0x29d6('0x8c')],_0x2fb57c);};var _0x392a06=function(_0x39728e){if(!_0x39728e||!_0x39728e[_0x29d6('0x6a')][_0x29d6('0x3c')]){return'';}for(var _0x4d1447='(',_0x4a7e32=0x0;_0x4a7e32<_0x39728e['rules']['length'];_0x4a7e32+=0x1){_0x4a7e32>0x0&&(_0x4d1447+='\x20'+_0x39728e['operator']+'\x20');_0x4d1447+=_0x39728e[_0x29d6('0x6a')][_0x4a7e32][_0x29d6('0x6c')]?_0x392a06(_0x39728e[_0x29d6('0x6a')][_0x4a7e32]['group']):_0x39728e[_0x29d6('0x6a')][_0x4a7e32][_0x29d6('0x6d')]+'\x20'+_0x39728e[_0x29d6('0x6a')][_0x4a7e32][_0x29d6('0x6e')]+(_0x5c3075(_0x39728e[_0x29d6('0x6a')][_0x4a7e32]['condition'])?'\x20'+_0x39728e[_0x29d6('0x6a')][_0x4a7e32][_0x29d6('0x8d')]:'');}return _0x4d1447+')';};var _0x3858c2={'where':{'id':_0x2160cb['id']}},_0x1fa11b,_0x2f2ada,_0x4e4f3b,_0x500540,_0x26bd09;_0x3858c2=_[_0x29d6('0x42')]({},_0x3858c2,_0x3bc4b7);return db[_0x29d6('0x31')][_0x29d6('0x4d')](_0x3858c2)['then'](function(_0x5daea5){if(_0x5daea5){_0x1fa11b=_0x5daea5;return _0x5daea5[_0x29d6('0x6f')]();}return null;})[_0x29d6('0x2a')](function(_0x5dd181){if(_0x5dd181){if(!_0x5dd181['length']){throw new db[(_0x29d6('0x70'))][(_0x29d6('0x8e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2f2ada=_0x5dd181;return db['AnalyticMetric'][_0x29d6('0x48')]({'raw':!![]});}return null;})[_0x29d6('0x2a')](function(_0x14f895){if(_0x14f895){_0x4e4f3b=_[_0x29d6('0x8f')](_0x14f895,'id');var _0x2e02ac;var _0xbf4e80=squel[_0x29d6('0x72')]();_0xbf4e80[_0x29d6('0x73')](_0x1fa11b[_0x29d6('0x74')]);for(var _0x43b3ff=0x0;_0x43b3ff<_0x2f2ada['length'];_0x43b3ff+=0x1){_0x2e02ac=_0x2f2ada[_0x43b3ff]['MetricId']?_0x4e4f3b[_0x2f2ada[_0x43b3ff]['MetricId']][_0x29d6('0x76')]:_0x2f2ada[_0x43b3ff][_0x29d6('0x6d')];_0x2e02ac=_0x2f2ada[_0x43b3ff][_0x29d6('0x78')]?_[_0x29d6('0x77')](_0x29a070[_0x2f2ada[_0x43b3ff][_0x29d6('0x78')]],'%s',_0x2e02ac):_0x2e02ac;_0x2e02ac=_0x2f2ada[_0x43b3ff][_0x29d6('0x79')]?_['replace'](_0x18cc18[_0x2f2ada[_0x43b3ff][_0x29d6('0x79')]],'%s',_0x2e02ac):_0x2e02ac;if(_0x2f2ada[_0x43b3ff][_0x29d6('0x7a')]){_0xbf4e80['group'](_0x2e02ac);}_0x2f2ada[_0x43b3ff][_0x29d6('0x7b')]&&_0xbf4e80[_0x29d6('0x3d')](_0x2e02ac,_0x2f2ada[_0x43b3ff][_0x29d6('0x7b')]===_0x29d6('0x7c')?![]:!![]);_0xbf4e80['field'](_0x2e02ac,_0x2f2ada[_0x43b3ff][_0x29d6('0x7d')]||_0x2e02ac);}if(_0x1fa11b['joins']){_0x1fa11b[_0x29d6('0x7e')]=JSON[_0x29d6('0x7f')](_0x1fa11b['joins']);for(var _0x463528=0x0;_0x463528<_0x1fa11b[_0x29d6('0x7e')][_0x29d6('0x3c')];_0x463528+=0x1){if(_0x1fa11b[_0x29d6('0x7e')][_0x463528][_0x29d6('0x43')]&&_['includes'](_0x37523a,_0x1fa11b[_0x29d6('0x7e')][_0x463528][_0x29d6('0x43')])&&_0x1fa11b[_0x29d6('0x7e')][_0x463528]['parentKey']&&_0x1fa11b[_0x29d6('0x7e')][_0x463528][_0x29d6('0x81')]&&_0x1fa11b[_0x29d6('0x7e')][_0x463528][_0x29d6('0x82')]){_0xbf4e80[_0x1fa11b[_0x29d6('0x7e')][_0x463528][_0x29d6('0x43')]](_0x1fa11b['joins'][_0x463528][_0x29d6('0x81')],null,util[_0x29d6('0x79')](_0x29d6('0x90'),_0x1fa11b[_0x29d6('0x74')],_0x1fa11b[_0x29d6('0x7e')][_0x463528][_0x29d6('0x80')],_0x1fa11b['joins'][_0x463528][_0x29d6('0x81')],_0x1fa11b[_0x29d6('0x7e')][_0x463528][_0x29d6('0x82')]));}}}if(_0x1fa11b[_0x29d6('0x83')]){_0x1fa11b[_0x29d6('0x83')]=JSON[_0x29d6('0x7f')](_0x1fa11b['conditions']);_0xbf4e80[_0x29d6('0x3f')](_0x392a06(_0x1fa11b[_0x29d6('0x83')]['group']));}_0x26bd09=_0xbf4e80[_0x29d6('0x84')]();_0xbf4e80[_0x29d6('0x25')](_0xaa8c47);_0xbf4e80[_0x29d6('0x22')](0x0);return;}})[_0x29d6('0x2a')](function(){if(_0x40e0a4[_0x29d6('0x91')]===_0x29d6('0x92')){return null;}var _0x2d00fb=_[_0x29d6('0x42')](_0x40e0a4,{'name':_0x40e0a4[_0x29d6('0x93')]||_0x40e0a4[_0x29d6('0x2e')]||_0x1fa11b[_0x29d6('0x2e')],'basename':_0x367900,'savename':util[_0x29d6('0x79')](_0x29d6('0x94'),_0x40e0a4[_0x29d6('0x2e')]||_0x1fa11b[_0x29d6('0x2e')],require(_0x29d6('0x95'))[_0x29d6('0x96')](0x4),_0x40e0a4[_0x29d6('0x91')]||_0x29d6('0x97')),'reportId':_0x1fa11b['id'],'reportType':_0x29d6('0x98')});return db[_0x29d6('0x99')][_0x29d6('0x4e')](_0x2d00fb,{'raw':!![]});})['then'](function(_0x2a44b5){if(_0x1fa11b[_0x29d6('0x74')]==='cdr'){_0x26bd09[_0x29d6('0x3f')](_0x1fa11b[_0x29d6('0x74')]+_0x29d6('0x9a'),_0x40e0a4[_0x29d6('0x9b')],_0x40e0a4[_0x29d6('0x9c')]);}else{_0x26bd09[_0x29d6('0x3f')](_0x1fa11b[_0x29d6('0x74')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x40e0a4[_0x29d6('0x9b')],_0x40e0a4[_0x29d6('0x9c')]);}if(_0x2a44b5){logger['info'](_0x29d6('0x9d'),_0x26bd09[_0x29d6('0x85')]());require('child_process')['fork'](path['join'](__dirname,_0x29d6('0x9e'),_0x2a44b5[_0x29d6('0x91')]),[_0x2a44b5['id'],_0x26bd09[_0x29d6('0x85')](),path['join'](__dirname,_0x29d6('0x9f'),_0x2a44b5[_0x29d6('0xa0')]),_0x367900]);return _0x2a44b5;}else{var _0x243e35=squel['select']();_0x243e35['from']('('+_0x26bd09[_0x29d6('0x85')]()+')','countTable');_0x243e35['field'](_0x29d6('0xa1'),_0x29d6('0x24'));_0x26bd09[_0x29d6('0x25')](_0x40e0a4['limit']||_0xaa8c47);_0x26bd09[_0x29d6('0x22')](_0x40e0a4[_0x29d6('0x22')]||0x0);return dbH[_0x29d6('0x86')][_0x29d6('0x37')](_0x243e35[_0x29d6('0x85')](),{'type':dbH['sequelize']['QueryTypes'][_0x29d6('0x88')]})[_0x29d6('0x2a')](function(_0xa59f7){if(!_0xa59f7['length']){_0x500540=0x0;}else{_0x500540=_0xa59f7[0x0][_0x29d6('0x24')]||0x0;}return dbH['sequelize'][_0x29d6('0x37')](_0x26bd09[_0x29d6('0x85')](),{'type':dbH[_0x29d6('0x86')][_0x29d6('0x87')][_0x29d6('0x88')]});})['then'](function(_0x34e975){return{'rows':_0x34e975||[],'count':_0x500540};});}});}exports[_0x29d6('0xa2')]=function(_0x5f2e01,_0x16961c){return runReport(_0x5f2e01['params'],_0x5f2e01['query'],_0x5f2e01[_0x29d6('0x45')])['then'](respondWithResult(_0x16961c,null))[_0x29d6('0x4a')](handleError(_0x16961c,null));};exports[_0x29d6('0xa3')]=runReport;exports[_0x29d6('0x37')]=function(_0x5a7755,_0x2b8865){var _0x36df6a=0xa;var _0x369f77=[_0x29d6('0x58'),_0x29d6('0x59'),_0x29d6('0x5a'),_0x29d6('0x5b')];var _0x1bdf87={'SUM':_0x29d6('0x5c'),'COUNT':_0x29d6('0x5d'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x29d6('0x5f'),'MIN':_0x29d6('0x60'),'AVG':_0x29d6('0x61'),'GROUP_CONCAT':_0x29d6('0x89'),'GROUP_CONCAT ASC':_0x29d6('0x62'),'GROUP_CONCAT DESC':_0x29d6('0x63')};var _0x3e5cec={'SEC_TO_TIME':_0x29d6('0x64'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x29d6('0x65'),'UNIX_TIMESTAMP':_0x29d6('0x66')};var _0x488cc3=function(_0x23bc52){return!_[_0x29d6('0x67')](['IS\x20NULL',_0x29d6('0x8b'),_0x29d6('0x69'),_0x29d6('0x8c')],_0x23bc52);};var _0x59e6de=function(_0x34ef47){if(!_0x34ef47||!_0x34ef47[_0x29d6('0x6a')]['length']){return'';}for(var _0x21502e='(',_0x3af990=0x0;_0x3af990<_0x34ef47[_0x29d6('0x6a')][_0x29d6('0x3c')];_0x3af990+=0x1){_0x3af990>0x0&&(_0x21502e+='\x20'+_0x34ef47[_0x29d6('0x6b')]+'\x20');_0x21502e+=_0x34ef47['rules'][_0x3af990][_0x29d6('0x6c')]?_0x59e6de(_0x34ef47[_0x29d6('0x6a')][_0x3af990][_0x29d6('0x6c')]):_0x34ef47[_0x29d6('0x6a')][_0x3af990][_0x29d6('0x6d')]+'\x20'+_0x34ef47['rules'][_0x3af990][_0x29d6('0x6e')]+(_0x488cc3(_0x34ef47[_0x29d6('0x6a')][_0x3af990][_0x29d6('0x6e')])?'\x20'+_0x34ef47[_0x29d6('0x6a')][_0x3af990][_0x29d6('0x8d')]:'');}return _0x21502e+')';};var _0x11d54c={'where':{'id':_0x5a7755[_0x29d6('0x4c')]['id']}},_0x550551,_0x59ed14,_0x29c97a,_0x20d7d6,_0x149c51;_0x11d54c=_[_0x29d6('0x42')]({},_0x11d54c,_0x5a7755['options']);return db[_0x29d6('0x31')]['find'](_0x11d54c)['then'](function(_0x21a636){if(_0x21a636){_0x550551=_0x21a636;return _0x21a636[_0x29d6('0x6f')]();}return null;})[_0x29d6('0x2a')](function(_0x5a39d5){if(_0x5a39d5){if(!_0x5a39d5[_0x29d6('0x3c')]){throw new db[(_0x29d6('0x70'))]['ValidationErrorItem'](_0x29d6('0xa4'),0x193);}_0x59ed14=_0x5a39d5;return db[_0x29d6('0x71')][_0x29d6('0x48')]({'raw':!![]});}return null;})[_0x29d6('0x2a')](function(_0x4df64b){if(_0x4df64b){_0x29c97a=_[_0x29d6('0x8f')](_0x4df64b,'id');var _0x54095c;var _0x1012fa=squel[_0x29d6('0x72')]();_0x1012fa[_0x29d6('0x73')](_0x550551[_0x29d6('0x74')]);for(var _0x3671ac=0x0;_0x3671ac<_0x59ed14[_0x29d6('0x3c')];_0x3671ac+=0x1){_0x54095c=_0x59ed14[_0x3671ac][_0x29d6('0x75')]?_0x29c97a[_0x59ed14[_0x3671ac]['MetricId']][_0x29d6('0x76')]:_0x59ed14[_0x3671ac][_0x29d6('0x6d')];_0x54095c=_0x59ed14[_0x3671ac][_0x29d6('0x78')]?_['replace'](_0x1bdf87[_0x59ed14[_0x3671ac][_0x29d6('0x78')]],'%s',_0x54095c):_0x54095c;_0x54095c=_0x59ed14[_0x3671ac][_0x29d6('0x79')]?_[_0x29d6('0x77')](_0x3e5cec[_0x59ed14[_0x3671ac][_0x29d6('0x79')]],'%s',_0x54095c):_0x54095c;if(_0x59ed14[_0x3671ac]['groupBy']){_0x1012fa[_0x29d6('0x6c')](_0x54095c);}_0x59ed14[_0x3671ac][_0x29d6('0x7b')]&&_0x1012fa['order'](_0x54095c,_0x59ed14[_0x3671ac][_0x29d6('0x7b')]===_0x29d6('0x7c')?![]:!![]);_0x1012fa[_0x29d6('0x6d')](_0x54095c,_0x59ed14[_0x3671ac][_0x29d6('0x7d')]||_0x54095c);}if(_0x550551[_0x29d6('0x7e')]){_0x550551[_0x29d6('0x7e')]=JSON[_0x29d6('0x7f')](_0x550551[_0x29d6('0x7e')]);for(var _0x24d859=0x0;_0x24d859<_0x550551[_0x29d6('0x7e')]['length'];_0x24d859+=0x1){if(_0x550551[_0x29d6('0x7e')][_0x24d859][_0x29d6('0x43')]&&_[_0x29d6('0x67')](_0x369f77,_0x550551['joins'][_0x24d859][_0x29d6('0x43')])&&_0x550551[_0x29d6('0x7e')][_0x24d859][_0x29d6('0x80')]&&_0x550551[_0x29d6('0x7e')][_0x24d859][_0x29d6('0x81')]&&_0x550551[_0x29d6('0x7e')][_0x24d859][_0x29d6('0x82')]){_0x1012fa[_0x550551['joins'][_0x24d859][_0x29d6('0x43')]](_0x550551[_0x29d6('0x7e')][_0x24d859][_0x29d6('0x81')],null,util[_0x29d6('0x79')](_0x29d6('0x90'),_0x550551['table'],_0x550551[_0x29d6('0x7e')][_0x24d859][_0x29d6('0x80')],_0x550551[_0x29d6('0x7e')][_0x24d859][_0x29d6('0x81')],_0x550551[_0x29d6('0x7e')][_0x24d859][_0x29d6('0x82')]));}}}if(_0x550551[_0x29d6('0x83')]){_0x550551['conditions']=JSON['parse'](_0x550551[_0x29d6('0x83')]);_0x1012fa[_0x29d6('0x3f')](_0x59e6de(_0x550551[_0x29d6('0x83')]['group']));}_0x149c51=_0x1012fa[_0x29d6('0x84')]();_0x1012fa[_0x29d6('0x25')](_0x36df6a);_0x1012fa['offset'](0x0);logger[_0x29d6('0xa5')]('Limited\x20Query:',_0x1012fa[_0x29d6('0x85')]());return dbH['sequelize'][_0x29d6('0x37')](_0x1012fa[_0x29d6('0x85')](),{'type':dbH['sequelize'][_0x29d6('0x87')][_0x29d6('0x88')]});}})[_0x29d6('0x2a')](function(){return{'sql':_0x149c51[_0x29d6('0x85')]()};})[_0x29d6('0x2a')](respondWithResult(_0x2b8865,null))[_0x29d6('0x4a')](handleError(_0x2b8865,null));}; \ No newline at end of file +var _0x0f51=['COUNT(*)','run','runReport','cross_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','debug','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','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','../../mysqldb','dbH','sendStatus','status','end','offset','undefined','limit','count','Content-Range','save','update','then','destroy','get','CustomReports','error','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','autoAssociation','UserProfileResource','left_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','replace','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','right_join','AVG(%s)','getFields','Please\x20insert\x20at\x20least\x20one\x20field','metric','order','%s.%s\x20=\x20%s.%s','output','web','fullPath','randomstring','generate','csv','custom','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','join','../../files/reports','savename','countTable'];(function(_0x47266b,_0x31700c){var _0x231604=function(_0x1af61c){while(--_0x1af61c){_0x47266b['push'](_0x47266b['shift']());}};_0x231604(++_0x31700c);}(_0x0f51,0x1ef));var _0x10f5=function(_0x2fa5a8,_0x3d422e){_0x2fa5a8=_0x2fa5a8-0x0;var _0x1728ad=_0x0f51[_0x2fa5a8];return _0x1728ad;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x10f5('0x0'));var jsonpatch=require(_0x10f5('0x1'));var rp=require(_0x10f5('0x2'));var moment=require(_0x10f5('0x3'));var BPromise=require(_0x10f5('0x4'));var Mustache=require(_0x10f5('0x5'));var util=require('util');var path=require(_0x10f5('0x6'));var sox=require(_0x10f5('0x7'));var csv=require(_0x10f5('0x8'));var ejs=require(_0x10f5('0x9'));var fs=require('fs');var fs_extra=require(_0x10f5('0xa'));var _=require('lodash');var squel=require(_0x10f5('0xb'));var crypto=require('crypto');var jsforce=require(_0x10f5('0xc'));var deskjs=require(_0x10f5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x10f5('0xe'));var Papa=require('papaparse');var Redis=require(_0x10f5('0xf'));var authService=require(_0x10f5('0x10'));var qs=require(_0x10f5('0x11'));var as=require(_0x10f5('0x12'));var hardwareService=require(_0x10f5('0x13'));var logger=require(_0x10f5('0x14'))(_0x10f5('0x15'));var utils=require('../../config/utils');var config=require(_0x10f5('0x16'));var licenseUtil=require(_0x10f5('0x17'));var db=require(_0x10f5('0x18'))['db'];var dbH=require(_0x10f5('0x18'))[_0x10f5('0x19')];function respondWithStatusCode(_0x1d7309,_0x2973c5){_0x2973c5=_0x2973c5||0xcc;return function(_0x38d27d){if(_0x38d27d){return _0x1d7309[_0x10f5('0x1a')](_0x2973c5);}return _0x1d7309[_0x10f5('0x1b')](_0x2973c5)[_0x10f5('0x1c')]();};}function respondWithResult(_0x4b653e,_0x259634){_0x259634=_0x259634||0xc8;return function(_0x22d55b){if(_0x22d55b){return _0x4b653e[_0x10f5('0x1b')](_0x259634)['json'](_0x22d55b);}};}function respondWithFilteredResult(_0x882b5f,_0x3818fd){return function(_0x2a108f){if(_0x2a108f){var _0x14adf1=typeof _0x3818fd[_0x10f5('0x1d')]===_0x10f5('0x1e')&&typeof _0x3818fd[_0x10f5('0x1f')]===_0x10f5('0x1e');var _0x2c31d2=_0x2a108f['count'];var _0x4e325d=_0x14adf1?0x0:_0x3818fd[_0x10f5('0x1d')];var _0x592c08=_0x14adf1?_0x2a108f[_0x10f5('0x20')]:_0x3818fd[_0x10f5('0x1d')]+_0x3818fd[_0x10f5('0x1f')];var _0x1d6a16;if(_0x592c08>=_0x2c31d2){_0x592c08=_0x2c31d2;_0x1d6a16=0xc8;}else{_0x1d6a16=0xce;}_0x882b5f['status'](_0x1d6a16);return _0x882b5f['set'](_0x10f5('0x21'),_0x4e325d+'-'+_0x592c08+'/'+_0x2c31d2)['json'](_0x2a108f);}return null;};}function patchUpdates(_0x28521a){return function(_0x260fd6){try{jsonpatch['apply'](_0x260fd6,_0x28521a,!![]);}catch(_0x37f15d){return BPromise['reject'](_0x37f15d);}return _0x260fd6[_0x10f5('0x22')]();};}function saveUpdates(_0x37f344,_0xf298f6){return function(_0x2e748b){if(_0x2e748b){return _0x2e748b[_0x10f5('0x23')](_0x37f344)[_0x10f5('0x24')](function(_0x4fe426){return _0x4fe426;});}return null;};}function removeEntity(_0x312e61,_0x140646){return function(_0x342c73){if(_0x342c73){return _0x342c73[_0x10f5('0x25')]()[_0x10f5('0x24')](function(){var _0x22c158=_0x342c73[_0x10f5('0x26')]({'plain':!![]});var _0x408fe4=_0x10f5('0x27');return db['UserProfileResource'][_0x10f5('0x25')]({'where':{'type':_0x408fe4,'resourceId':_0x22c158['id']}})[_0x10f5('0x24')](function(){return _0x342c73;});})[_0x10f5('0x24')](function(){_0x312e61[_0x10f5('0x1b')](0xcc)[_0x10f5('0x1c')]();});}};}function handleEntityNotFound(_0x41c653,_0x427ffb){return function(_0x4ed39c){if(!_0x4ed39c){_0x41c653[_0x10f5('0x1a')](0x194);}return _0x4ed39c;};}function handleError(_0x373556,_0x489a96){_0x489a96=_0x489a96||0x1f4;return function(_0x16b9f1){logger[_0x10f5('0x28')](_0x16b9f1['stack']);if(_0x16b9f1[_0x10f5('0x29')]){delete _0x16b9f1[_0x10f5('0x29')];}_0x373556[_0x10f5('0x1b')](_0x489a96)[_0x10f5('0x2a')](_0x16b9f1);};}exports['index']=function(_0x1db91e,_0xc284ef){var _0x103f0d={},_0x439326={},_0x5a408b={'count':0x0,'rows':[]};var _0x269c23=_[_0x10f5('0x2b')](db[_0x10f5('0x2c')][_0x10f5('0x2d')],function(_0x5529f9){return{'name':_0x5529f9[_0x10f5('0x2e')],'type':_0x5529f9[_0x10f5('0x2f')][_0x10f5('0x30')]};});_0x439326[_0x10f5('0x31')]=_[_0x10f5('0x2b')](_0x269c23,_0x10f5('0x29'));_0x439326[_0x10f5('0x32')]=_[_0x10f5('0x33')](_0x1db91e[_0x10f5('0x32')]);_0x439326[_0x10f5('0x34')]=_[_0x10f5('0x35')](_0x439326[_0x10f5('0x31')],_0x439326[_0x10f5('0x32')]);_0x103f0d['attributes']=_[_0x10f5('0x35')](_0x439326[_0x10f5('0x31')],qs['fields'](_0x1db91e[_0x10f5('0x32')][_0x10f5('0x36')]));_0x103f0d[_0x10f5('0x37')]=_0x103f0d[_0x10f5('0x37')]['length']?_0x103f0d[_0x10f5('0x37')]:_0x439326[_0x10f5('0x31')];if(!_0x1db91e[_0x10f5('0x32')]['hasOwnProperty']('nolimit')){_0x103f0d[_0x10f5('0x1f')]=qs[_0x10f5('0x1f')](_0x1db91e[_0x10f5('0x32')][_0x10f5('0x1f')]);_0x103f0d[_0x10f5('0x1d')]=qs[_0x10f5('0x1d')](_0x1db91e[_0x10f5('0x32')][_0x10f5('0x1d')]);}_0x103f0d['order']=qs['sort'](_0x1db91e[_0x10f5('0x32')]['sort']);_0x103f0d[_0x10f5('0x38')]=qs['filters'](_[_0x10f5('0x39')](_0x1db91e[_0x10f5('0x32')],_0x439326[_0x10f5('0x34')]),_0x269c23);if(_0x1db91e[_0x10f5('0x32')][_0x10f5('0x3a')]){_0x103f0d['where']=_[_0x10f5('0x3b')](_0x103f0d[_0x10f5('0x38')],{'$or':_[_0x10f5('0x2b')](_0x269c23,function(_0x58ebb4){if(_0x58ebb4[_0x10f5('0x2f')]!==_0x10f5('0x3c')){var _0x52dd46={};_0x52dd46[_0x58ebb4[_0x10f5('0x29')]]={'$like':'%'+_0x1db91e[_0x10f5('0x32')][_0x10f5('0x3a')]+'%'};return _0x52dd46;}})});}_0x103f0d=_[_0x10f5('0x3b')]({},_0x103f0d,_0x1db91e[_0x10f5('0x3d')]);var _0x7aa794={'where':_0x103f0d[_0x10f5('0x38')]};return db[_0x10f5('0x2c')][_0x10f5('0x20')](_0x7aa794)[_0x10f5('0x24')](function(_0x3aa8d6){_0x5a408b[_0x10f5('0x20')]=_0x3aa8d6;if(_0x1db91e[_0x10f5('0x32')]['includeAll']){_0x103f0d[_0x10f5('0x3e')]=[{'all':!![]}];}return db[_0x10f5('0x2c')][_0x10f5('0x3f')](_0x103f0d);})['then'](function(_0x333b56){_0x5a408b[_0x10f5('0x40')]=_0x333b56;return _0x5a408b;})[_0x10f5('0x24')](respondWithFilteredResult(_0xc284ef,_0x103f0d))[_0x10f5('0x41')](handleError(_0xc284ef,null));};exports[_0x10f5('0x42')]=function(_0x4c74c6,_0xc888ba){var _0x2b5037={'raw':![],'where':{'id':_0x4c74c6[_0x10f5('0x43')]['id']}},_0x2eda34={};_0x2eda34[_0x10f5('0x31')]=_[_0x10f5('0x33')](db[_0x10f5('0x2c')][_0x10f5('0x2d')]);_0x2eda34[_0x10f5('0x32')]=_[_0x10f5('0x33')](_0x4c74c6[_0x10f5('0x32')]);_0x2eda34['filters']=_[_0x10f5('0x35')](_0x2eda34[_0x10f5('0x31')],_0x2eda34['query']);_0x2b5037[_0x10f5('0x37')]=_['intersection'](_0x2eda34[_0x10f5('0x31')],qs[_0x10f5('0x36')](_0x4c74c6[_0x10f5('0x32')][_0x10f5('0x36')]));_0x2b5037['attributes']=_0x2b5037['attributes'][_0x10f5('0x44')]?_0x2b5037[_0x10f5('0x37')]:_0x2eda34[_0x10f5('0x31')];if(_0x4c74c6[_0x10f5('0x32')][_0x10f5('0x45')]){_0x2b5037[_0x10f5('0x3e')]=[{'all':!![]}];}_0x2b5037=_[_0x10f5('0x3b')]({},_0x2b5037,_0x4c74c6[_0x10f5('0x3d')]);return db[_0x10f5('0x2c')]['find'](_0x2b5037)[_0x10f5('0x24')](handleEntityNotFound(_0xc888ba,null))[_0x10f5('0x24')](respondWithResult(_0xc888ba,null))[_0x10f5('0x41')](handleError(_0xc888ba,null));};exports[_0x10f5('0x46')]=function(_0x1429d2,_0x6ce4d4){return db[_0x10f5('0x2c')][_0x10f5('0x46')](_0x1429d2[_0x10f5('0x47')],{})[_0x10f5('0x24')](function(_0x48f760){var _0x21f97e=_0x1429d2[_0x10f5('0x48')][_0x10f5('0x26')]({'plain':!![]});if(!_0x21f97e)throw new Error(_0x10f5('0x49'));if(_0x21f97e[_0x10f5('0x4a')]===_0x10f5('0x48')){var _0xbe46a1=_0x48f760[_0x10f5('0x26')]({'plain':!![]});var _0x5a3208=_0x10f5('0x4b');return db['UserProfileSection'][_0x10f5('0x4c')]({'where':{'name':_0x5a3208,'userProfileId':_0x21f97e[_0x10f5('0x4d')]},'raw':!![]})[_0x10f5('0x24')](function(_0x4e0d52){if(_0x4e0d52&&_0x4e0d52[_0x10f5('0x4e')]===0x0){return db[_0x10f5('0x4f')][_0x10f5('0x46')]({'name':_0xbe46a1['name'],'resourceId':_0xbe46a1['id'],'type':_0x10f5('0x27'),'sectionId':_0x4e0d52['id']},{})[_0x10f5('0x24')](function(){return _0x48f760;});}else{return _0x48f760;}})['catch'](function(_0x117ff7){logger[_0x10f5('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x117ff7);throw _0x117ff7;});}return _0x48f760;})[_0x10f5('0x24')](respondWithResult(_0x6ce4d4,0xc9))['catch'](handleError(_0x6ce4d4,null));};exports[_0x10f5('0x23')]=function(_0x3afca7,_0x1f9738){if(_0x3afca7['body']['id']){delete _0x3afca7[_0x10f5('0x47')]['id'];}return db[_0x10f5('0x2c')]['find']({'where':{'id':_0x3afca7[_0x10f5('0x43')]['id']}})['then'](handleEntityNotFound(_0x1f9738,null))['then'](saveUpdates(_0x3afca7[_0x10f5('0x47')],null))['then'](respondWithResult(_0x1f9738,null))[_0x10f5('0x41')](handleError(_0x1f9738,null));};exports[_0x10f5('0x25')]=function(_0x10d991,_0x1cec3a){return db['AnalyticCustomReport'][_0x10f5('0x4c')]({'where':{'id':_0x10d991[_0x10f5('0x43')]['id']}})[_0x10f5('0x24')](handleEntityNotFound(_0x1cec3a,null))[_0x10f5('0x24')](removeEntity(_0x1cec3a,null))['catch'](handleError(_0x1cec3a,null));};exports['preview']=function(_0x1cce00,_0x392865){var _0x3aed18=0xa;var _0x50282d=['join',_0x10f5('0x50'),'right_join','cross_join'];var _0x412a29={'SUM':_0x10f5('0x51'),'COUNT':_0x10f5('0x52'),'COUNT DISTINCT':_0x10f5('0x53'),'MAX':_0x10f5('0x54'),'MIN':_0x10f5('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x10f5('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x10f5('0x57')};var _0x11ed6e={'SEC_TO_TIME':_0x10f5('0x58'),'DATE':_0x10f5('0x59'),'HOUR':_0x10f5('0x5a'),'ROUND':_0x10f5('0x5b'),'UNIX_TIMESTAMP':_0x10f5('0x5c')};var _0x530222=function(_0x399c51){return!_[_0x10f5('0x5d')]([_0x10f5('0x5e'),_0x10f5('0x5f'),_0x10f5('0x60'),_0x10f5('0x61')],_0x399c51);};var _0x4e377c=function(_0x3b8a08){if(!_0x3b8a08||!_0x3b8a08[_0x10f5('0x62')][_0x10f5('0x44')]){return'';}for(var _0x184a9e='(',_0x844572=0x0;_0x844572<_0x3b8a08[_0x10f5('0x62')]['length'];_0x844572+=0x1){_0x844572>0x0&&(_0x184a9e+='\x20'+_0x3b8a08[_0x10f5('0x63')]+'\x20');_0x184a9e+=_0x3b8a08[_0x10f5('0x62')][_0x844572][_0x10f5('0x64')]?_0x4e377c(_0x3b8a08['rules'][_0x844572]['group']):_0x3b8a08[_0x10f5('0x62')][_0x844572][_0x10f5('0x65')]+'\x20'+_0x3b8a08['rules'][_0x844572]['condition']+(_0x530222(_0x3b8a08[_0x10f5('0x62')][_0x844572][_0x10f5('0x66')])?'\x20'+_0x3b8a08[_0x10f5('0x62')][_0x844572][_0x10f5('0x67')]:'');}return _0x184a9e+')';};var _0x436c26={'where':{'id':_0x1cce00[_0x10f5('0x43')]['id']}},_0x34a6b3,_0x26e1f8,_0x377661,_0x810134,_0x41570f;_0x436c26=_['merge']({},_0x436c26,_0x1cce00[_0x10f5('0x3d')]);return db['AnalyticCustomReport'][_0x10f5('0x4c')](_0x436c26)[_0x10f5('0x24')](function(_0x2dd0ce){if(_0x2dd0ce){_0x34a6b3=_0x2dd0ce;return _0x2dd0ce['getFields']();}return null;})[_0x10f5('0x24')](function(_0x208ae5){if(_0x208ae5){if(!_0x208ae5['length']){throw new db[(_0x10f5('0x68'))][(_0x10f5('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x26e1f8=_0x208ae5;return db[_0x10f5('0x6a')][_0x10f5('0x3f')]({'raw':!![]});}return null;})[_0x10f5('0x24')](function(_0x3dfdf2){if(_0x3dfdf2){_0x377661=_[_0x10f5('0x6b')](_0x3dfdf2,'id');var _0x239320;var _0x190ae7=squel[_0x10f5('0x6c')]();_0x190ae7[_0x10f5('0x6d')](_0x34a6b3[_0x10f5('0x6e')]);for(var _0x10cef3=0x0;_0x10cef3<_0x26e1f8[_0x10f5('0x44')];_0x10cef3+=0x1){_0x239320=_0x26e1f8[_0x10cef3][_0x10f5('0x6f')]?_0x377661[_0x26e1f8[_0x10cef3]['MetricId']]['metric']:_0x26e1f8[_0x10cef3][_0x10f5('0x65')];_0x239320=_0x26e1f8[_0x10cef3]['function']?_[_0x10f5('0x70')](_0x412a29[_0x26e1f8[_0x10cef3][_0x10f5('0x71')]],'%s',_0x239320):_0x239320;_0x239320=_0x26e1f8[_0x10cef3][_0x10f5('0x72')]?_[_0x10f5('0x70')](_0x11ed6e[_0x26e1f8[_0x10cef3][_0x10f5('0x72')]],'%s',_0x239320):_0x239320;if(_0x26e1f8[_0x10cef3][_0x10f5('0x73')]){_0x190ae7[_0x10f5('0x64')](_0x239320);}_0x26e1f8[_0x10cef3][_0x10f5('0x74')]&&_0x190ae7['order'](_0x239320,_0x26e1f8[_0x10cef3][_0x10f5('0x74')]===_0x10f5('0x75')?![]:!![]);_0x190ae7['field'](_0x239320,_0x26e1f8[_0x10cef3][_0x10f5('0x76')]||_0x239320);}if(_0x34a6b3[_0x10f5('0x77')]){_0x34a6b3[_0x10f5('0x77')]=JSON[_0x10f5('0x78')](_0x34a6b3[_0x10f5('0x77')]);for(var _0x45a879=0x0;_0x45a879<_0x34a6b3['joins'][_0x10f5('0x44')];_0x45a879+=0x1){if(_0x34a6b3['joins'][_0x45a879][_0x10f5('0x2f')]&&_[_0x10f5('0x5d')](_0x50282d,_0x34a6b3['joins'][_0x45a879][_0x10f5('0x2f')])&&_0x34a6b3[_0x10f5('0x77')][_0x45a879][_0x10f5('0x79')]&&_0x34a6b3[_0x10f5('0x77')][_0x45a879]['foreignTable']&&_0x34a6b3[_0x10f5('0x77')][_0x45a879]['foreignKey']){_0x190ae7[_0x34a6b3[_0x10f5('0x77')][_0x45a879][_0x10f5('0x2f')]](_0x34a6b3[_0x10f5('0x77')][_0x45a879][_0x10f5('0x7a')],null,util[_0x10f5('0x72')]('%s.%s\x20=\x20%s.%s',_0x34a6b3['table'],_0x34a6b3['joins'][_0x45a879]['parentKey'],_0x34a6b3['joins'][_0x45a879][_0x10f5('0x7a')],_0x34a6b3[_0x10f5('0x77')][_0x45a879][_0x10f5('0x7b')]));}}}if(_0x34a6b3['conditions']){_0x34a6b3[_0x10f5('0x7c')]=JSON[_0x10f5('0x78')](_0x34a6b3[_0x10f5('0x7c')]);_0x190ae7[_0x10f5('0x38')](_0x4e377c(_0x34a6b3['conditions'][_0x10f5('0x64')]));}_0x41570f=_0x190ae7[_0x10f5('0x7d')]();_0x190ae7[_0x10f5('0x1f')](_0x3aed18);_0x190ae7[_0x10f5('0x1d')](0x0);logger['debug'](_0x10f5('0x7e'),_0x190ae7[_0x10f5('0x7f')]());return dbH['sequelize']['query'](_0x190ae7[_0x10f5('0x7f')](),{'type':dbH[_0x10f5('0x80')][_0x10f5('0x81')][_0x10f5('0x82')]});}})[_0x10f5('0x24')](respondWithResult(_0x392865,null))[_0x10f5('0x41')](handleError(_0x392865,null));};function runReport(_0x18a653,_0x405f44,_0x46c3da){var _0x177808=_0x405f44[_0x10f5('0x29')];var _0xce3072=0xa;var _0x4c4f70=['join',_0x10f5('0x50'),_0x10f5('0x83'),'cross_join'];var _0xe38f57={'SUM':_0x10f5('0x51'),'COUNT':_0x10f5('0x52'),'COUNT DISTINCT':_0x10f5('0x53'),'MAX':_0x10f5('0x54'),'MIN':_0x10f5('0x55'),'AVG':_0x10f5('0x84'),'GROUP_CONCAT':_0x10f5('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xea13a7={'SEC_TO_TIME':_0x10f5('0x58'),'DATE':_0x10f5('0x59'),'HOUR':'HOUR(%s)','ROUND':_0x10f5('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2912e7=function(_0x20558d){return!_[_0x10f5('0x5d')]([_0x10f5('0x5e'),_0x10f5('0x5f'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x20558d);};var _0x464237=function(_0x563bd8){if(!_0x563bd8||!_0x563bd8[_0x10f5('0x62')]['length']){return'';}for(var _0x341a23='(',_0x3fd140=0x0;_0x3fd140<_0x563bd8[_0x10f5('0x62')][_0x10f5('0x44')];_0x3fd140+=0x1){_0x3fd140>0x0&&(_0x341a23+='\x20'+_0x563bd8['operator']+'\x20');_0x341a23+=_0x563bd8[_0x10f5('0x62')][_0x3fd140][_0x10f5('0x64')]?_0x464237(_0x563bd8[_0x10f5('0x62')][_0x3fd140]['group']):_0x563bd8[_0x10f5('0x62')][_0x3fd140][_0x10f5('0x65')]+'\x20'+_0x563bd8[_0x10f5('0x62')][_0x3fd140][_0x10f5('0x66')]+(_0x2912e7(_0x563bd8[_0x10f5('0x62')][_0x3fd140][_0x10f5('0x66')])?'\x20'+_0x563bd8[_0x10f5('0x62')][_0x3fd140][_0x10f5('0x67')]:'');}return _0x341a23+')';};var _0x236eb6={'where':{'id':_0x18a653['id']}},_0x3157b6,_0x309d96,_0x29c319,_0x116ebc,_0x15dd1d;_0x236eb6=_[_0x10f5('0x3b')]({},_0x236eb6,_0x46c3da);return db[_0x10f5('0x2c')][_0x10f5('0x4c')](_0x236eb6)[_0x10f5('0x24')](function(_0x21b23b){if(_0x21b23b){_0x3157b6=_0x21b23b;return _0x21b23b[_0x10f5('0x85')]();}return null;})[_0x10f5('0x24')](function(_0x4e2487){if(_0x4e2487){if(!_0x4e2487[_0x10f5('0x44')]){throw new db[(_0x10f5('0x68'))]['ValidationErrorItem'](_0x10f5('0x86'),0x193);}_0x309d96=_0x4e2487;return db[_0x10f5('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x10f5('0x24')](function(_0x153020){if(_0x153020){_0x29c319=_['keyBy'](_0x153020,'id');var _0x2475ce;var _0x350844=squel[_0x10f5('0x6c')]();_0x350844[_0x10f5('0x6d')](_0x3157b6[_0x10f5('0x6e')]);for(var _0x75d897=0x0;_0x75d897<_0x309d96[_0x10f5('0x44')];_0x75d897+=0x1){_0x2475ce=_0x309d96[_0x75d897][_0x10f5('0x6f')]?_0x29c319[_0x309d96[_0x75d897][_0x10f5('0x6f')]][_0x10f5('0x87')]:_0x309d96[_0x75d897][_0x10f5('0x65')];_0x2475ce=_0x309d96[_0x75d897][_0x10f5('0x71')]?_[_0x10f5('0x70')](_0xe38f57[_0x309d96[_0x75d897][_0x10f5('0x71')]],'%s',_0x2475ce):_0x2475ce;_0x2475ce=_0x309d96[_0x75d897][_0x10f5('0x72')]?_[_0x10f5('0x70')](_0xea13a7[_0x309d96[_0x75d897][_0x10f5('0x72')]],'%s',_0x2475ce):_0x2475ce;if(_0x309d96[_0x75d897]['groupBy']){_0x350844['group'](_0x2475ce);}_0x309d96[_0x75d897][_0x10f5('0x74')]&&_0x350844[_0x10f5('0x88')](_0x2475ce,_0x309d96[_0x75d897]['orderBy']===_0x10f5('0x75')?![]:!![]);_0x350844['field'](_0x2475ce,_0x309d96[_0x75d897]['alias']||_0x2475ce);}if(_0x3157b6[_0x10f5('0x77')]){_0x3157b6[_0x10f5('0x77')]=JSON[_0x10f5('0x78')](_0x3157b6[_0x10f5('0x77')]);for(var _0x1702b6=0x0;_0x1702b6<_0x3157b6['joins'][_0x10f5('0x44')];_0x1702b6+=0x1){if(_0x3157b6[_0x10f5('0x77')][_0x1702b6][_0x10f5('0x2f')]&&_['includes'](_0x4c4f70,_0x3157b6[_0x10f5('0x77')][_0x1702b6][_0x10f5('0x2f')])&&_0x3157b6[_0x10f5('0x77')][_0x1702b6][_0x10f5('0x79')]&&_0x3157b6[_0x10f5('0x77')][_0x1702b6][_0x10f5('0x7a')]&&_0x3157b6['joins'][_0x1702b6][_0x10f5('0x7b')]){_0x350844[_0x3157b6['joins'][_0x1702b6][_0x10f5('0x2f')]](_0x3157b6[_0x10f5('0x77')][_0x1702b6][_0x10f5('0x7a')],null,util[_0x10f5('0x72')](_0x10f5('0x89'),_0x3157b6[_0x10f5('0x6e')],_0x3157b6[_0x10f5('0x77')][_0x1702b6][_0x10f5('0x79')],_0x3157b6[_0x10f5('0x77')][_0x1702b6]['foreignTable'],_0x3157b6[_0x10f5('0x77')][_0x1702b6][_0x10f5('0x7b')]));}}}if(_0x3157b6['conditions']){_0x3157b6[_0x10f5('0x7c')]=JSON[_0x10f5('0x78')](_0x3157b6[_0x10f5('0x7c')]);_0x350844[_0x10f5('0x38')](_0x464237(_0x3157b6[_0x10f5('0x7c')][_0x10f5('0x64')]));}_0x15dd1d=_0x350844[_0x10f5('0x7d')]();_0x350844[_0x10f5('0x1f')](_0xce3072);_0x350844[_0x10f5('0x1d')](0x0);return;}})[_0x10f5('0x24')](function(){if(_0x405f44[_0x10f5('0x8a')]===_0x10f5('0x8b')){return null;}var _0x2d1658=_[_0x10f5('0x3b')](_0x405f44,{'name':_0x405f44[_0x10f5('0x8c')]||_0x405f44['name']||_0x3157b6[_0x10f5('0x29')],'basename':_0x177808,'savename':util[_0x10f5('0x72')]('%s-%s.%s',_0x405f44[_0x10f5('0x29')]||_0x3157b6[_0x10f5('0x29')],require(_0x10f5('0x8d'))[_0x10f5('0x8e')](0x4),_0x405f44['output']||_0x10f5('0x8f')),'reportId':_0x3157b6['id'],'reportType':_0x10f5('0x90')});return db['AnalyticExtractedReport'][_0x10f5('0x46')](_0x2d1658,{'raw':!![]});})[_0x10f5('0x24')](function(_0x5e6cb6){if(_0x3157b6[_0x10f5('0x6e')]===_0x10f5('0x91')){_0x15dd1d['where'](_0x3157b6['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x405f44['startDate'],_0x405f44[_0x10f5('0x92')]);}else{_0x15dd1d[_0x10f5('0x38')](_0x3157b6[_0x10f5('0x6e')]+_0x10f5('0x93'),_0x405f44[_0x10f5('0x94')],_0x405f44[_0x10f5('0x92')]);}if(_0x5e6cb6){logger[_0x10f5('0x95')](_0x10f5('0x96'),_0x15dd1d[_0x10f5('0x7f')]());require(_0x10f5('0x97'))[_0x10f5('0x98')](path[_0x10f5('0x99')](__dirname,'../../components/export/',_0x5e6cb6[_0x10f5('0x8a')]),[_0x5e6cb6['id'],_0x15dd1d[_0x10f5('0x7f')](),path['join'](__dirname,_0x10f5('0x9a'),_0x5e6cb6[_0x10f5('0x9b')]),_0x177808]);return _0x5e6cb6;}else{var _0x2d1c85=squel[_0x10f5('0x6c')]();_0x2d1c85[_0x10f5('0x6d')]('('+_0x15dd1d[_0x10f5('0x7f')]()+')',_0x10f5('0x9c'));_0x2d1c85[_0x10f5('0x65')](_0x10f5('0x9d'),_0x10f5('0x20'));_0x15dd1d[_0x10f5('0x1f')](_0x405f44[_0x10f5('0x1f')]||_0xce3072);_0x15dd1d['offset'](_0x405f44['offset']||0x0);return dbH[_0x10f5('0x80')][_0x10f5('0x32')](_0x2d1c85[_0x10f5('0x7f')](),{'type':dbH[_0x10f5('0x80')][_0x10f5('0x81')][_0x10f5('0x82')]})[_0x10f5('0x24')](function(_0x2f5137){if(!_0x2f5137['length']){_0x116ebc=0x0;}else{_0x116ebc=_0x2f5137[0x0]['count']||0x0;}return dbH['sequelize'][_0x10f5('0x32')](_0x15dd1d[_0x10f5('0x7f')](),{'type':dbH[_0x10f5('0x80')][_0x10f5('0x81')][_0x10f5('0x82')]});})[_0x10f5('0x24')](function(_0x1795c5){return{'rows':_0x1795c5||[],'count':_0x116ebc};});}});}exports[_0x10f5('0x9e')]=function(_0x571c0d,_0x1fe4bd){return runReport(_0x571c0d[_0x10f5('0x43')],_0x571c0d[_0x10f5('0x32')],_0x571c0d[_0x10f5('0x3d')])[_0x10f5('0x24')](respondWithResult(_0x1fe4bd,null))[_0x10f5('0x41')](handleError(_0x1fe4bd,null));};exports[_0x10f5('0x9f')]=runReport;exports[_0x10f5('0x32')]=function(_0x22c763,_0x3c7ee7){var _0x1d27d3=0xa;var _0x33f67a=[_0x10f5('0x99'),_0x10f5('0x50'),_0x10f5('0x83'),_0x10f5('0xa0')];var _0xdf05de={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x10f5('0x53'),'MAX':'MAX(%s)','MIN':_0x10f5('0x55'),'AVG':_0x10f5('0x84'),'GROUP_CONCAT':_0x10f5('0x56'),'GROUP_CONCAT ASC':_0x10f5('0xa1'),'GROUP_CONCAT DESC':_0x10f5('0x57')};var _0x2e802a={'SEC_TO_TIME':_0x10f5('0x58'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x10f5('0x5c')};var _0x1ee5b6=function(_0x95d4f){return!_[_0x10f5('0x5d')](['IS\x20NULL',_0x10f5('0x5f'),_0x10f5('0x60'),_0x10f5('0x61')],_0x95d4f);};var _0x45bf70=function(_0x508940){if(!_0x508940||!_0x508940[_0x10f5('0x62')][_0x10f5('0x44')]){return'';}for(var _0x5688ad='(',_0x15e98e=0x0;_0x15e98e<_0x508940[_0x10f5('0x62')][_0x10f5('0x44')];_0x15e98e+=0x1){_0x15e98e>0x0&&(_0x5688ad+='\x20'+_0x508940[_0x10f5('0x63')]+'\x20');_0x5688ad+=_0x508940[_0x10f5('0x62')][_0x15e98e][_0x10f5('0x64')]?_0x45bf70(_0x508940[_0x10f5('0x62')][_0x15e98e][_0x10f5('0x64')]):_0x508940[_0x10f5('0x62')][_0x15e98e][_0x10f5('0x65')]+'\x20'+_0x508940[_0x10f5('0x62')][_0x15e98e][_0x10f5('0x66')]+(_0x1ee5b6(_0x508940[_0x10f5('0x62')][_0x15e98e][_0x10f5('0x66')])?'\x20'+_0x508940[_0x10f5('0x62')][_0x15e98e][_0x10f5('0x67')]:'');}return _0x5688ad+')';};var _0x2b08ea={'where':{'id':_0x22c763[_0x10f5('0x43')]['id']}},_0x1b4872,_0x360d48,_0x27686d,_0x1b41f1,_0x236104;_0x2b08ea=_[_0x10f5('0x3b')]({},_0x2b08ea,_0x22c763[_0x10f5('0x3d')]);return db[_0x10f5('0x2c')]['find'](_0x2b08ea)[_0x10f5('0x24')](function(_0x352e2b){if(_0x352e2b){_0x1b4872=_0x352e2b;return _0x352e2b['getFields']();}return null;})[_0x10f5('0x24')](function(_0x1e80ad){if(_0x1e80ad){if(!_0x1e80ad[_0x10f5('0x44')]){throw new db[(_0x10f5('0x68'))][(_0x10f5('0x69'))](_0x10f5('0x86'),0x193);}_0x360d48=_0x1e80ad;return db['AnalyticMetric'][_0x10f5('0x3f')]({'raw':!![]});}return null;})[_0x10f5('0x24')](function(_0x3701f5){if(_0x3701f5){_0x27686d=_['keyBy'](_0x3701f5,'id');var _0x107583;var _0x395329=squel[_0x10f5('0x6c')]();_0x395329['from'](_0x1b4872[_0x10f5('0x6e')]);for(var _0x157172=0x0;_0x157172<_0x360d48['length'];_0x157172+=0x1){_0x107583=_0x360d48[_0x157172][_0x10f5('0x6f')]?_0x27686d[_0x360d48[_0x157172]['MetricId']][_0x10f5('0x87')]:_0x360d48[_0x157172][_0x10f5('0x65')];_0x107583=_0x360d48[_0x157172][_0x10f5('0x71')]?_[_0x10f5('0x70')](_0xdf05de[_0x360d48[_0x157172][_0x10f5('0x71')]],'%s',_0x107583):_0x107583;_0x107583=_0x360d48[_0x157172]['format']?_[_0x10f5('0x70')](_0x2e802a[_0x360d48[_0x157172][_0x10f5('0x72')]],'%s',_0x107583):_0x107583;if(_0x360d48[_0x157172]['groupBy']){_0x395329[_0x10f5('0x64')](_0x107583);}_0x360d48[_0x157172]['orderBy']&&_0x395329['order'](_0x107583,_0x360d48[_0x157172]['orderBy']===_0x10f5('0x75')?![]:!![]);_0x395329[_0x10f5('0x65')](_0x107583,_0x360d48[_0x157172][_0x10f5('0x76')]||_0x107583);}if(_0x1b4872[_0x10f5('0x77')]){_0x1b4872['joins']=JSON['parse'](_0x1b4872[_0x10f5('0x77')]);for(var _0x3ffb41=0x0;_0x3ffb41<_0x1b4872[_0x10f5('0x77')]['length'];_0x3ffb41+=0x1){if(_0x1b4872[_0x10f5('0x77')][_0x3ffb41][_0x10f5('0x2f')]&&_[_0x10f5('0x5d')](_0x33f67a,_0x1b4872[_0x10f5('0x77')][_0x3ffb41][_0x10f5('0x2f')])&&_0x1b4872[_0x10f5('0x77')][_0x3ffb41][_0x10f5('0x79')]&&_0x1b4872[_0x10f5('0x77')][_0x3ffb41][_0x10f5('0x7a')]&&_0x1b4872['joins'][_0x3ffb41][_0x10f5('0x7b')]){_0x395329[_0x1b4872[_0x10f5('0x77')][_0x3ffb41]['type']](_0x1b4872[_0x10f5('0x77')][_0x3ffb41][_0x10f5('0x7a')],null,util[_0x10f5('0x72')](_0x10f5('0x89'),_0x1b4872[_0x10f5('0x6e')],_0x1b4872[_0x10f5('0x77')][_0x3ffb41][_0x10f5('0x79')],_0x1b4872[_0x10f5('0x77')][_0x3ffb41][_0x10f5('0x7a')],_0x1b4872[_0x10f5('0x77')][_0x3ffb41][_0x10f5('0x7b')]));}}}if(_0x1b4872['conditions']){_0x1b4872['conditions']=JSON[_0x10f5('0x78')](_0x1b4872[_0x10f5('0x7c')]);_0x395329['where'](_0x45bf70(_0x1b4872[_0x10f5('0x7c')][_0x10f5('0x64')]));}_0x236104=_0x395329[_0x10f5('0x7d')]();_0x395329[_0x10f5('0x1f')](_0x1d27d3);_0x395329['offset'](0x0);logger[_0x10f5('0xa2')]('Limited\x20Query:',_0x395329[_0x10f5('0x7f')]());return dbH[_0x10f5('0x80')][_0x10f5('0x32')](_0x395329['toString'](),{'type':dbH[_0x10f5('0x80')][_0x10f5('0x81')][_0x10f5('0x82')]});}})[_0x10f5('0x24')](function(){return{'sql':_0x236104['toString']()};})[_0x10f5('0x24')](respondWithResult(_0x3c7ee7,null))[_0x10f5('0x41')](handleError(_0x3c7ee7,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 7636a69..77cbfc3 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 _0x8eb3=['moment','bluebird','path','rimraf','./analyticCustomReport.attributes','exports','define','analytics_custom_reports','lodash','util','../../config/logger','api'];(function(_0x3fb030,_0x12aebe){var _0xd6899b=function(_0x327646){while(--_0x327646){_0x3fb030['push'](_0x3fb030['shift']());}};_0xd6899b(++_0x12aebe);}(_0x8eb3,0x17c));var _0x38eb=function(_0x4beae1,_0x954ba3){_0x4beae1=_0x4beae1-0x0;var _0x55a1e1=_0x8eb3[_0x4beae1];return _0x55a1e1;};'use strict';var _=require(_0x38eb('0x0'));var util=require(_0x38eb('0x1'));var logger=require(_0x38eb('0x2'))(_0x38eb('0x3'));var moment=require(_0x38eb('0x4'));var BPromise=require(_0x38eb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x38eb('0x6'));var rimraf=require(_0x38eb('0x7'));var config=require('../../config/environment');var attributes=require(_0x38eb('0x8'));module[_0x38eb('0x9')]=function(_0x19aa05,_0x825c1f){return _0x19aa05[_0x38eb('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0x38eb('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85b0=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','define'];(function(_0x11d0f3,_0x2c52c7){var _0x1a0f83=function(_0x25b7f8){while(--_0x25b7f8){_0x11d0f3['push'](_0x11d0f3['shift']());}};_0x1a0f83(++_0x2c52c7);}(_0x85b0,0x171));var _0x085b=function(_0x2bc0f5,_0x44f336){_0x2bc0f5=_0x2bc0f5-0x0;var _0x42c6ac=_0x85b0[_0x2bc0f5];return _0x42c6ac;};'use strict';var _=require('lodash');var util=require(_0x085b('0x0'));var logger=require(_0x085b('0x1'))('api');var moment=require(_0x085b('0x2'));var BPromise=require('bluebird');var rp=require(_0x085b('0x3'));var fs=require('fs');var path=require(_0x085b('0x4'));var rimraf=require(_0x085b('0x5'));var config=require(_0x085b('0x6'));var attributes=require(_0x085b('0x7'));module['exports']=function(_0x5f3cdd,_0x159df5){return _0x5f3cdd[_0x085b('0x8')]('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 9c39abd..b3d1bdf 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 _0xf7d7=['client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x2820c2,_0x350e5d){var _0x495916=function(_0xaa1b98){while(--_0xaa1b98){_0x2820c2['push'](_0x2820c2['shift']());}};_0x495916(++_0x350e5d);}(_0xf7d7,0x160));var _0x7f7d=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xf7d7[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0x7f7d('0x0'));var util=require('util');var moment=require(_0x7f7d('0x1'));var BPromise=require('bluebird');var rs=require(_0x7f7d('0x2'));var fs=require('fs');var Redis=require(_0x7f7d('0x3'));var db=require(_0x7f7d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7f7d('0x5'))(_0x7f7d('0x6'));var config=require(_0x7f7d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7f7d('0x8')][_0x7f7d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x497e75,_0x4d98bf,_0x1a41d3){return new BPromise(function(_0x4257a6,_0x1a9ca7){return client['request'](_0x497e75,_0x1a41d3)[_0x7f7d('0xa')](function(_0x248ec8){logger[_0x7f7d('0xb')](_0x7f7d('0xc'),_0x4d98bf,_0x7f7d('0xd'));logger[_0x7f7d('0xe')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x4d98bf,_0x7f7d('0xd'),JSON[_0x7f7d('0xf')](_0x248ec8));if(_0x248ec8[_0x7f7d('0x10')]){if(_0x248ec8['error']['code']===0x1f4){logger[_0x7f7d('0x10')](_0x7f7d('0xc'),_0x4d98bf,_0x248ec8[_0x7f7d('0x10')]['message']);return _0x1a9ca7(_0x248ec8[_0x7f7d('0x10')]['message']);}logger[_0x7f7d('0x10')](_0x7f7d('0xc'),_0x4d98bf,_0x248ec8[_0x7f7d('0x10')][_0x7f7d('0x11')]);return _0x4257a6(_0x248ec8[_0x7f7d('0x10')][_0x7f7d('0x11')]);}else{logger['info'](_0x7f7d('0xc'),_0x4d98bf,_0x7f7d('0xd'));_0x4257a6(_0x248ec8[_0x7f7d('0x12')][_0x7f7d('0x11')]);}})[_0x7f7d('0x13')](function(_0x5213be){logger[_0x7f7d('0x10')](_0x7f7d('0xc'),_0x4d98bf,_0x5213be);_0x1a9ca7(_0x5213be);});});} \ No newline at end of file +var _0xfc7e=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x40a0a4,_0x5d30d0){var _0x50cc17=function(_0x4ea52d){while(--_0x4ea52d){_0x40a0a4['push'](_0x40a0a4['shift']());}};_0x50cc17(++_0x5d30d0);}(_0xfc7e,0x9c));var _0xefc7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfc7e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xefc7('0x0'));var moment=require(_0xefc7('0x1'));var BPromise=require(_0xefc7('0x2'));var rs=require(_0xefc7('0x3'));var fs=require('fs');var Redis=require(_0xefc7('0x4'));var db=require(_0xefc7('0x5'))['db'];var utils=require(_0xefc7('0x6'));var logger=require(_0xefc7('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xefc7('0x8'));var client=jayson[_0xefc7('0x9')][_0xefc7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cabee,_0x13faf5,_0xff5334){return new BPromise(function(_0x172262,_0x3f9591){return client[_0xefc7('0xb')](_0x3cabee,_0xff5334)[_0xefc7('0xc')](function(_0x5dd50d){logger['info'](_0xefc7('0xd'),_0x13faf5,_0xefc7('0xe'));logger[_0xefc7('0xf')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x13faf5,_0xefc7('0xe'),JSON[_0xefc7('0x10')](_0x5dd50d));if(_0x5dd50d['error']){if(_0x5dd50d[_0xefc7('0x11')][_0xefc7('0x12')]===0x1f4){logger[_0xefc7('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x13faf5,_0x5dd50d[_0xefc7('0x11')][_0xefc7('0x13')]);return _0x3f9591(_0x5dd50d[_0xefc7('0x11')]['message']);}logger['error'](_0xefc7('0xd'),_0x13faf5,_0x5dd50d['error'][_0xefc7('0x13')]);return _0x172262(_0x5dd50d[_0xefc7('0x11')][_0xefc7('0x13')]);}else{logger[_0xefc7('0x14')](_0xefc7('0xd'),_0x13faf5,_0xefc7('0xe'));_0x172262(_0x5dd50d[_0xefc7('0x15')][_0xefc7('0x13')]);}})[_0xefc7('0x16')](function(_0x1ae880){logger['error'](_0xefc7('0xd'),_0x13faf5,_0x1ae880);_0x3f9591(_0x1ae880);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index d384b01..ff15d20 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 _0xd8b1=['/:id/preview','preview','get','/:id/query','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','isAuthenticated','index','/:id','show'];(function(_0x3acd79,_0x302a58){var _0x2ff0d5=function(_0x1459fe){while(--_0x1459fe){_0x3acd79['push'](_0x3acd79['shift']());}};_0x2ff0d5(++_0x302a58);}(_0xd8b1,0x191));var _0x1d8b=function(_0x3f6c66,_0x31e3cd){_0x3f6c66=_0x3f6c66-0x0;var _0x1b541a=_0xd8b1[_0x3f6c66];return _0x1b541a;};'use strict';var multer=require('multer');var util=require(_0x1d8b('0x0'));var path=require(_0x1d8b('0x1'));var timeout=require(_0x1d8b('0x2'));var express=require(_0x1d8b('0x3'));var router=express[_0x1d8b('0x4')]();var fs_extra=require(_0x1d8b('0x5'));var auth=require(_0x1d8b('0x6'));var interaction=require(_0x1d8b('0x7'));var config=require('../../config/environment');var controller=require(_0x1d8b('0x8'));router['get']('/',auth[_0x1d8b('0x9')](),controller[_0x1d8b('0xa')]);router['get'](_0x1d8b('0xb'),auth[_0x1d8b('0x9')](),controller[_0x1d8b('0xc')]);router['get'](_0x1d8b('0xd'),auth[_0x1d8b('0x9')](),controller[_0x1d8b('0xe')]);router[_0x1d8b('0xf')]('/:id/run',auth['isAuthenticated'](),controller['run']);router['get'](_0x1d8b('0x10'),auth[_0x1d8b('0x9')](),controller['query']);router[_0x1d8b('0x11')]('/',auth['isAuthenticated'](),controller[_0x1d8b('0x12')]);router[_0x1d8b('0x13')](_0x1d8b('0xb'),auth[_0x1d8b('0x9')](),controller[_0x1d8b('0x14')]);router[_0x1d8b('0x15')](_0x1d8b('0xb'),auth['isAuthenticated'](),controller[_0x1d8b('0x16')]);module['exports']=router; \ No newline at end of file +var _0xe85f=['delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','run','/:id/query','post','create','put','update'];(function(_0x157bf7,_0x211fb0){var _0x4f08cc=function(_0x3f8844){while(--_0x3f8844){_0x157bf7['push'](_0x157bf7['shift']());}};_0x4f08cc(++_0x211fb0);}(_0xe85f,0xb2));var _0xfe85=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xe85f[_0x556bb1];return _0x45455f;};'use strict';var multer=require(_0xfe85('0x0'));var util=require(_0xfe85('0x1'));var path=require('path');var timeout=require(_0xfe85('0x2'));var express=require('express');var router=express[_0xfe85('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xfe85('0x4'));var interaction=require(_0xfe85('0x5'));var config=require(_0xfe85('0x6'));var controller=require(_0xfe85('0x7'));router[_0xfe85('0x8')]('/',auth[_0xfe85('0x9')](),controller[_0xfe85('0xa')]);router[_0xfe85('0x8')](_0xfe85('0xb'),auth[_0xfe85('0x9')](),controller[_0xfe85('0xc')]);router[_0xfe85('0x8')](_0xfe85('0xd'),auth[_0xfe85('0x9')](),controller['preview']);router['get']('/:id/run',auth[_0xfe85('0x9')](),controller[_0xfe85('0xe')]);router[_0xfe85('0x8')](_0xfe85('0xf'),auth['isAuthenticated'](),controller['query']);router[_0xfe85('0x10')]('/',auth[_0xfe85('0x9')](),controller[_0xfe85('0x11')]);router[_0xfe85('0x12')](_0xfe85('0xb'),auth['isAuthenticated'](),controller[_0xfe85('0x13')]);router[_0xfe85('0x14')](_0xfe85('0xb'),auth[_0xfe85('0x9')](),controller[_0xfe85('0x15')]);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 33650ee..7277328 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 _0x5fab=['exports','STRING','TEXT','sequelize'];(function(_0x1ea053,_0x22aecc){var _0x444b08=function(_0x14576a){while(--_0x14576a){_0x1ea053['push'](_0x1ea053['shift']());}};_0x444b08(++_0x22aecc);}(_0x5fab,0x177));var _0xb5fa=function(_0x581aae,_0x2b18ee){_0x581aae=_0x581aae-0x0;var _0x539df2=_0x5fab[_0x581aae];return _0x539df2;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb5fa('0x2')]},'parent':{'type':Sequelize[_0xb5fa('0x2')]},'table':{'type':Sequelize[_0xb5fa('0x2')]},'conditions':{'type':Sequelize[_0xb5fa('0x3')]},'joins':{'type':Sequelize[_0xb5fa('0x3')]}}; \ No newline at end of file +var _0x2eb2=['TEXT','exports','STRING'];(function(_0x4b6651,_0x40dcb4){var _0x5e8c87=function(_0x5c1238){while(--_0x5c1238){_0x4b6651['push'](_0x4b6651['shift']());}};_0x5e8c87(++_0x40dcb4);}(_0x2eb2,0x19f));var _0x22eb=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x2eb2[_0x334841];return _0x5beb4b;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'name':{'type':Sequelize[_0x22eb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x22eb('0x1')]},'parent':{'type':Sequelize[_0x22eb('0x1')]},'table':{'type':Sequelize[_0x22eb('0x1')]},'conditions':{'type':Sequelize[_0x22eb('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 9d0c002..85c7892 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 _0x5fc3=['QueryTypes','right_join','HOUR(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','dbH','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','destroy','error','stack','name','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','getFields','ValidationErrorItem','fullPath','%s-%s.%s','generate','output','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)'];(function(_0x18a77c,_0x34eeb8){var _0x18fa1f=function(_0xd0778c){while(--_0xd0778c){_0x18a77c['push'](_0x18a77c['shift']());}};_0x18fa1f(++_0x34eeb8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0x5fc3[_0x209fcd];return _0x501d5e;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x35fc('0x17')];function respondWithStatusCode(_0x5d462a,_0x397738){_0x397738=_0x397738||0xcc;return function(_0x22055e){if(_0x22055e){return _0x5d462a[_0x35fc('0x18')](_0x397738);}return _0x5d462a[_0x35fc('0x19')](_0x397738)[_0x35fc('0x1a')]();};}function respondWithResult(_0x5cfe94,_0x59507a){_0x59507a=_0x59507a||0xc8;return function(_0x5eac0f){if(_0x5eac0f){return _0x5cfe94['status'](_0x59507a)[_0x35fc('0x1b')](_0x5eac0f);}};}function respondWithFilteredResult(_0x229d56,_0x53b898){return function(_0x154958){if(_0x154958){var _0x227a49=typeof _0x53b898[_0x35fc('0x1c')]==='undefined'&&typeof _0x53b898[_0x35fc('0x1d')]===_0x35fc('0x1e');var _0x553677=_0x154958[_0x35fc('0x1f')];var _0x363e47=_0x227a49?0x0:_0x53b898[_0x35fc('0x1c')];var _0x5f56c6=_0x227a49?_0x154958[_0x35fc('0x1f')]:_0x53b898[_0x35fc('0x1c')]+_0x53b898[_0x35fc('0x1d')];var _0x488234;if(_0x5f56c6>=_0x553677){_0x5f56c6=_0x553677;_0x488234=0xc8;}else{_0x488234=0xce;}_0x229d56[_0x35fc('0x19')](_0x488234);return _0x229d56[_0x35fc('0x20')](_0x35fc('0x21'),_0x363e47+'-'+_0x5f56c6+'/'+_0x553677)[_0x35fc('0x1b')](_0x154958);}return null;};}function patchUpdates(_0x20ffde){return function(_0x21f1a9){try{jsonpatch[_0x35fc('0x22')](_0x21f1a9,_0x20ffde,!![]);}catch(_0x3b05b0){return BPromise[_0x35fc('0x23')](_0x3b05b0);}return _0x21f1a9[_0x35fc('0x24')]();};}function saveUpdates(_0x5bd2b8,_0x323aee){return function(_0xd5399f){if(_0xd5399f){return _0xd5399f[_0x35fc('0x25')](_0x5bd2b8)[_0x35fc('0x26')](function(_0x3b4743){return _0x3b4743;});}return null;};}function removeEntity(_0x55e9e7,_0x33f5e8){return function(_0x4c587a){if(_0x4c587a){return _0x4c587a['destroy']()[_0x35fc('0x26')](function(){var _0x5a93df=_0x4c587a[_0x35fc('0x27')]({'plain':!![]});var _0x51cfec=_0x35fc('0x28');return db['UserProfileResource'][_0x35fc('0x29')]({'where':{'type':_0x51cfec,'resourceId':_0x5a93df['id']}})[_0x35fc('0x26')](function(){return _0x4c587a;});})['then'](function(){_0x55e9e7['status'](0xcc)[_0x35fc('0x1a')]();});}};}function handleEntityNotFound(_0x58edb6,_0x274208){return function(_0x1a5d92){if(!_0x1a5d92){_0x58edb6['sendStatus'](0x194);}return _0x1a5d92;};}function handleError(_0x26b7cb,_0x645eac){_0x645eac=_0x645eac||0x1f4;return function(_0x383837){logger[_0x35fc('0x2a')](_0x383837[_0x35fc('0x2b')]);if(_0x383837[_0x35fc('0x2c')]){delete _0x383837[_0x35fc('0x2c')];}_0x26b7cb[_0x35fc('0x19')](_0x645eac)['send'](_0x383837);};}exports[_0x35fc('0x2d')]=function(_0x220931,_0x22af18){var _0x52acc5={},_0xe79f52={},_0x16f067={'count':0x0,'rows':[]};var _0x3822a8=_[_0x35fc('0x2e')](db[_0x35fc('0x2f')][_0x35fc('0x30')],function(_0x222ddb){return{'name':_0x222ddb[_0x35fc('0x31')],'type':_0x222ddb[_0x35fc('0x32')][_0x35fc('0x33')]};});_0xe79f52['model']=_['map'](_0x3822a8,_0x35fc('0x2c'));_0xe79f52['query']=_[_0x35fc('0x34')](_0x220931[_0x35fc('0x35')]);_0xe79f52[_0x35fc('0x36')]=_[_0x35fc('0x37')](_0xe79f52[_0x35fc('0x38')],_0xe79f52[_0x35fc('0x35')]);_0x52acc5['attributes']=_[_0x35fc('0x37')](_0xe79f52[_0x35fc('0x38')],qs[_0x35fc('0x39')](_0x220931[_0x35fc('0x35')][_0x35fc('0x39')]));_0x52acc5[_0x35fc('0x3a')]=_0x52acc5['attributes'][_0x35fc('0x3b')]?_0x52acc5[_0x35fc('0x3a')]:_0xe79f52[_0x35fc('0x38')];if(!_0x220931['query'][_0x35fc('0x3c')]('nolimit')){_0x52acc5[_0x35fc('0x1d')]=qs[_0x35fc('0x1d')](_0x220931[_0x35fc('0x35')][_0x35fc('0x1d')]);_0x52acc5['offset']=qs['offset'](_0x220931['query'][_0x35fc('0x1c')]);}_0x52acc5['order']=qs[_0x35fc('0x3d')](_0x220931['query'][_0x35fc('0x3d')]);_0x52acc5[_0x35fc('0x3e')]=qs[_0x35fc('0x36')](_[_0x35fc('0x3f')](_0x220931[_0x35fc('0x35')],_0xe79f52[_0x35fc('0x36')]),_0x3822a8);if(_0x220931[_0x35fc('0x35')]['filter']){_0x52acc5[_0x35fc('0x3e')]=_[_0x35fc('0x40')](_0x52acc5['where'],{'$or':_[_0x35fc('0x2e')](_0x3822a8,function(_0x1ccc41){if(_0x1ccc41[_0x35fc('0x32')]!==_0x35fc('0x41')){var _0x813866={};_0x813866[_0x1ccc41[_0x35fc('0x2c')]]={'$like':'%'+_0x220931['query'][_0x35fc('0x42')]+'%'};return _0x813866;}})});}_0x52acc5=_[_0x35fc('0x40')]({},_0x52acc5,_0x220931[_0x35fc('0x43')]);var _0x52543b={'where':_0x52acc5[_0x35fc('0x3e')]};return db[_0x35fc('0x2f')]['count'](_0x52543b)[_0x35fc('0x26')](function(_0x280af1){_0x16f067[_0x35fc('0x1f')]=_0x280af1;if(_0x220931[_0x35fc('0x35')][_0x35fc('0x44')]){_0x52acc5[_0x35fc('0x45')]=[{'all':!![]}];}return db[_0x35fc('0x2f')][_0x35fc('0x46')](_0x52acc5);})['then'](function(_0x596e83){_0x16f067[_0x35fc('0x47')]=_0x596e83;return _0x16f067;})[_0x35fc('0x26')](respondWithFilteredResult(_0x22af18,_0x52acc5))['catch'](handleError(_0x22af18,null));};exports['show']=function(_0x4ff202,_0x79677d){var _0x10f98b={'raw':!![],'where':{'id':_0x4ff202[_0x35fc('0x48')]['id']}},_0x4e56ed={};_0x4e56ed[_0x35fc('0x38')]=_[_0x35fc('0x34')](db[_0x35fc('0x2f')]['rawAttributes']);_0x4e56ed['query']=_['keys'](_0x4ff202['query']);_0x4e56ed['filters']=_[_0x35fc('0x37')](_0x4e56ed[_0x35fc('0x38')],_0x4e56ed['query']);_0x10f98b[_0x35fc('0x3a')]=_['intersection'](_0x4e56ed[_0x35fc('0x38')],qs[_0x35fc('0x39')](_0x4ff202[_0x35fc('0x35')][_0x35fc('0x39')]));_0x10f98b[_0x35fc('0x3a')]=_0x10f98b['attributes'][_0x35fc('0x3b')]?_0x10f98b[_0x35fc('0x3a')]:_0x4e56ed['model'];if(_0x4ff202[_0x35fc('0x35')][_0x35fc('0x44')]){_0x10f98b[_0x35fc('0x45')]=[{'all':!![]}];}_0x10f98b=_[_0x35fc('0x40')]({},_0x10f98b,_0x4ff202['options']);return db[_0x35fc('0x2f')]['find'](_0x10f98b)['then'](handleEntityNotFound(_0x79677d,null))[_0x35fc('0x26')](respondWithResult(_0x79677d,null))[_0x35fc('0x49')](handleError(_0x79677d,null));};exports[_0x35fc('0x4a')]=function(_0xca8aef,_0xf2ca20){return db[_0x35fc('0x2f')][_0x35fc('0x4a')](_0xca8aef[_0x35fc('0x4b')],{})['then'](function(_0x3e2961){var _0x91d7c0=_0xca8aef[_0x35fc('0x4c')][_0x35fc('0x27')]({'plain':!![]});if(!_0x91d7c0)throw new Error(_0x35fc('0x4d'));if(_0x91d7c0[_0x35fc('0x4e')]===_0x35fc('0x4c')){var _0x347a4a=_0x3e2961[_0x35fc('0x27')]({'plain':!![]});var _0xe6eb6a=_0x35fc('0x4f');return db[_0x35fc('0x50')][_0x35fc('0x51')]({'where':{'name':_0xe6eb6a,'userProfileId':_0x91d7c0[_0x35fc('0x52')]},'raw':!![]})['then'](function(_0x553ed6){if(_0x553ed6&&_0x553ed6[_0x35fc('0x53')]===0x0){return db[_0x35fc('0x54')][_0x35fc('0x4a')]({'name':_0x347a4a[_0x35fc('0x2c')],'resourceId':_0x347a4a['id'],'type':_0x35fc('0x28'),'sectionId':_0x553ed6['id']},{})[_0x35fc('0x26')](function(){return _0x3e2961;});}else{return _0x3e2961;}})['catch'](function(_0x4f024c){logger[_0x35fc('0x2a')](_0x35fc('0x55'),_0x4f024c);throw _0x4f024c;});}return _0x3e2961;})[_0x35fc('0x26')](respondWithResult(_0xf2ca20,0xc9))[_0x35fc('0x49')](handleError(_0xf2ca20,null));};exports['update']=function(_0x467980,_0x13281f){if(_0x467980['body']['id']){delete _0x467980[_0x35fc('0x4b')]['id'];}return db[_0x35fc('0x2f')]['find']({'where':{'id':_0x467980[_0x35fc('0x48')]['id']}})[_0x35fc('0x26')](handleEntityNotFound(_0x13281f,null))[_0x35fc('0x26')](saveUpdates(_0x467980[_0x35fc('0x4b')],null))['then'](respondWithResult(_0x13281f,null))['catch'](handleError(_0x13281f,null));};exports['destroy']=function(_0x240338,_0x2ea8d6){return db['AnalyticDefaultReport'][_0x35fc('0x51')]({'where':{'id':_0x240338[_0x35fc('0x48')]['id']}})[_0x35fc('0x26')](handleEntityNotFound(_0x2ea8d6,null))[_0x35fc('0x26')](removeEntity(_0x2ea8d6,null))[_0x35fc('0x49')](handleError(_0x2ea8d6,null));};exports['preview']=function(_0x2d9d45,_0x757aa6){var _0x39d470=0xa;var _0x509e77=[_0x35fc('0x56'),_0x35fc('0x57'),'right_join',_0x35fc('0x58')];var _0x164c7b={'SUM':_0x35fc('0x59'),'COUNT':_0x35fc('0x5a'),'COUNT DISTINCT':_0x35fc('0x5b'),'MAX':_0x35fc('0x5c'),'MIN':_0x35fc('0x5d'),'AVG':_0x35fc('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':_0x35fc('0x60')};var _0x303927={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x35fc('0x61'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x23b54f=function(_0xb1c68a){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xb1c68a);};var _0x5353ea=function(_0x4faef4){if(!_0x4faef4||!_0x4faef4['rules'][_0x35fc('0x3b')]){return'';}for(var _0x44250b='(',_0xd470e8=0x0;_0xd470e8<_0x4faef4[_0x35fc('0x65')]['length'];_0xd470e8+=0x1){_0xd470e8>0x0&&(_0x44250b+='\x20'+_0x4faef4[_0x35fc('0x66')]+'\x20');_0x44250b+=_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x67')]?_0x5353ea(_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x67')]):_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x68')]+'\x20'+_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x69')]+(_0x23b54f(_0x4faef4['rules'][_0xd470e8][_0x35fc('0x69')])?'\x20'+_0x4faef4['rules'][_0xd470e8][_0x35fc('0x6a')]:'');}return _0x44250b+')';};var _0x9029e3={'where':{'id':_0x2d9d45['params']['id']}},_0x2ac8e1,_0x2bc76c,_0x4bdde7,_0x465c14,_0x4af592;_0x9029e3=_['merge']({},_0x9029e3,_0x2d9d45[_0x35fc('0x43')]);return db['AnalyticDefaultReport'][_0x35fc('0x51')](_0x9029e3)['then'](function(_0x11717){if(_0x11717){_0x2ac8e1=_0x11717;return _0x11717['getFields']();}return null;})[_0x35fc('0x26')](function(_0x455b84){if(_0x455b84){if(!_0x455b84[_0x35fc('0x3b')]){throw new db[(_0x35fc('0x6b'))]['ValidationErrorItem'](_0x35fc('0x6c'),0x193);}_0x2bc76c=_0x455b84;return db[_0x35fc('0x6d')][_0x35fc('0x46')]({'raw':!![]});}return null;})['then'](function(_0x3aa7fa){if(_0x3aa7fa){_0x4bdde7=_[_0x35fc('0x6e')](_0x3aa7fa,'id');var _0x37764b;var _0x3c1b56=squel[_0x35fc('0x6f')]();_0x3c1b56[_0x35fc('0x70')](_0x2ac8e1[_0x35fc('0x71')]);for(var _0x4464d5=0x0;_0x4464d5<_0x2bc76c['length'];_0x4464d5+=0x1){_0x37764b=_0x2bc76c[_0x4464d5][_0x35fc('0x72')]?_0x4bdde7[_0x2bc76c[_0x4464d5][_0x35fc('0x72')]][_0x35fc('0x73')]:_0x2bc76c[_0x4464d5]['field'];_0x37764b=_0x2bc76c[_0x4464d5][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0x164c7b[_0x2bc76c[_0x4464d5]['function']],'%s',_0x37764b):_0x37764b;_0x37764b=_0x2bc76c[_0x4464d5]['format']?_[_0x35fc('0x75')](_0x303927[_0x2bc76c[_0x4464d5]['format']],'%s',_0x37764b):_0x37764b;if(_0x2bc76c[_0x4464d5][_0x35fc('0x76')]){_0x3c1b56[_0x35fc('0x67')](_0x37764b);}_0x2bc76c[_0x4464d5][_0x35fc('0x77')]&&_0x3c1b56[_0x35fc('0x78')](_0x37764b,_0x2bc76c[_0x4464d5][_0x35fc('0x77')]===_0x35fc('0x79')?![]:!![]);_0x3c1b56[_0x35fc('0x68')](_0x37764b,_0x2bc76c[_0x4464d5][_0x35fc('0x7a')]||_0x37764b);}if(_0x2ac8e1[_0x35fc('0x7b')]){_0x2ac8e1[_0x35fc('0x7b')]=JSON[_0x35fc('0x7c')](_0x2ac8e1[_0x35fc('0x7b')]);for(var _0x29f2b9=0x0;_0x29f2b9<_0x2ac8e1[_0x35fc('0x7b')][_0x35fc('0x3b')];_0x29f2b9+=0x1){if(_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')]&&_[_0x35fc('0x62')](_0x509e77,_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')])&&_0x2ac8e1['joins'][_0x29f2b9][_0x35fc('0x7d')]&&_0x2ac8e1['joins'][_0x29f2b9][_0x35fc('0x7e')]&&_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7f')]){_0x3c1b56[_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')]](_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7e')],null,util[_0x35fc('0x80')](_0x35fc('0x81'),_0x2ac8e1[_0x35fc('0x71')],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9]['parentKey'],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7e')],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7f')]));}}}if(_0x2ac8e1[_0x35fc('0x82')]){_0x2ac8e1[_0x35fc('0x82')]=JSON['parse'](_0x2ac8e1[_0x35fc('0x82')]);_0x3c1b56[_0x35fc('0x3e')](_0x5353ea(_0x2ac8e1[_0x35fc('0x82')][_0x35fc('0x67')]));}_0x4af592=_0x3c1b56[_0x35fc('0x83')]();_0x3c1b56[_0x35fc('0x1d')](_0x39d470);_0x3c1b56[_0x35fc('0x1c')](0x0);logger[_0x35fc('0x84')](_0x35fc('0x85'),_0x3c1b56['toString']());return dbH[_0x35fc('0x86')]['query'](_0x3c1b56[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')]['QueryTypes'][_0x35fc('0x88')]});}})[_0x35fc('0x26')](respondWithResult(_0x757aa6,null))[_0x35fc('0x49')](handleError(_0x757aa6,null));};function runReport(_0x4274d6,_0x4026cc,_0x1a765f){var _0x42f87e=_0x4026cc[_0x35fc('0x2c')];var _0x25ee61=0xa;var _0x5806bf=['join','left_join','right_join',_0x35fc('0x58')];var _0x23cf84={'SUM':_0x35fc('0x59'),'COUNT':_0x35fc('0x5a'),'COUNT DISTINCT':_0x35fc('0x5b'),'MAX':'MAX(%s)','MIN':_0x35fc('0x5d'),'AVG':_0x35fc('0x5e'),'GROUP_CONCAT':_0x35fc('0x89'),'GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x15e936={'SEC_TO_TIME':_0x35fc('0x8a'),'DATE':_0x35fc('0x61'),'HOUR':'HOUR(%s)','ROUND':_0x35fc('0x8b'),'UNIX_TIMESTAMP':_0x35fc('0x8c')};var _0x319033=function(_0x9fe765){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),_0x35fc('0x8d'),'IS\x20NOT\x20EMPTY'],_0x9fe765);};var _0x2faff7=function(_0xa2c5f8){if(!_0xa2c5f8||!_0xa2c5f8[_0x35fc('0x65')][_0x35fc('0x3b')]){return'';}for(var _0x221c5b='(',_0x1fcd36=0x0;_0x1fcd36<_0xa2c5f8['rules'][_0x35fc('0x3b')];_0x1fcd36+=0x1){_0x1fcd36>0x0&&(_0x221c5b+='\x20'+_0xa2c5f8['operator']+'\x20');_0x221c5b+=_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x67')]?_0x2faff7(_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x67')]):_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x68')]+'\x20'+_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x69')]+(_0x319033(_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x69')])?'\x20'+_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x6a')]:'');}return _0x221c5b+')';};var _0x5abdf9={'where':{'id':_0x4274d6['id']}},_0x5512f6,_0x487cb5,_0x23b261,_0x4c742c,_0x2fae26;_0x5abdf9=_[_0x35fc('0x40')]({},_0x5abdf9,_0x1a765f);return db[_0x35fc('0x2f')][_0x35fc('0x51')](_0x5abdf9)['then'](function(_0x28e80d){if(_0x28e80d){_0x5512f6=_0x28e80d;return _0x28e80d[_0x35fc('0x8e')]();}return null;})[_0x35fc('0x26')](function(_0x47c507){if(_0x47c507){if(!_0x47c507[_0x35fc('0x3b')]){throw new db[(_0x35fc('0x6b'))][(_0x35fc('0x8f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x487cb5=_0x47c507;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x35fc('0x26')](function(_0x2edb1b){if(_0x2edb1b){_0x23b261=_[_0x35fc('0x6e')](_0x2edb1b,'id');var _0x3858a9;var _0x4859be=squel[_0x35fc('0x6f')]();_0x4859be[_0x35fc('0x70')](_0x5512f6['table']);for(var _0x5849a0=0x0;_0x5849a0<_0x487cb5[_0x35fc('0x3b')];_0x5849a0+=0x1){_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x72')]?_0x23b261[_0x487cb5[_0x5849a0][_0x35fc('0x72')]]['metric']:_0x487cb5[_0x5849a0]['field'];_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0x23cf84[_0x487cb5[_0x5849a0]['function']],'%s',_0x3858a9):_0x3858a9;_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x80')]?_[_0x35fc('0x75')](_0x15e936[_0x487cb5[_0x5849a0][_0x35fc('0x80')]],'%s',_0x3858a9):_0x3858a9;if(_0x487cb5[_0x5849a0]['groupBy']){_0x4859be[_0x35fc('0x67')](_0x3858a9);}_0x487cb5[_0x5849a0][_0x35fc('0x77')]&&_0x4859be[_0x35fc('0x78')](_0x3858a9,_0x487cb5[_0x5849a0][_0x35fc('0x77')]==='DESC'?![]:!![]);_0x4859be[_0x35fc('0x68')](_0x3858a9,_0x487cb5[_0x5849a0][_0x35fc('0x7a')]||_0x3858a9);}if(_0x5512f6[_0x35fc('0x7b')]){_0x5512f6['joins']=JSON[_0x35fc('0x7c')](_0x5512f6[_0x35fc('0x7b')]);for(var _0x425f72=0x0;_0x425f72<_0x5512f6['joins'][_0x35fc('0x3b')];_0x425f72+=0x1){if(_0x5512f6[_0x35fc('0x7b')][_0x425f72]['type']&&_[_0x35fc('0x62')](_0x5806bf,_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x32')])&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7d')]&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')]&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7f')]){_0x4859be[_0x5512f6['joins'][_0x425f72][_0x35fc('0x32')]](_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')],null,util[_0x35fc('0x80')]('%s.%s\x20=\x20%s.%s',_0x5512f6[_0x35fc('0x71')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7d')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7f')]));}}}if(_0x5512f6[_0x35fc('0x82')]){_0x5512f6['conditions']=JSON['parse'](_0x5512f6[_0x35fc('0x82')]);_0x4859be[_0x35fc('0x3e')](_0x2faff7(_0x5512f6[_0x35fc('0x82')]['group']));}_0x2fae26=_0x4859be[_0x35fc('0x83')]();_0x4859be[_0x35fc('0x1d')](_0x25ee61);_0x4859be[_0x35fc('0x1c')](0x0);return;}})[_0x35fc('0x26')](function(){if(_0x4026cc['output']==='web'){return null;}var _0x379650=_['merge'](_0x4026cc,{'name':_0x4026cc[_0x35fc('0x90')]||_0x4026cc[_0x35fc('0x2c')]||_0x5512f6['name'],'basename':_0x42f87e,'savename':util['format'](_0x35fc('0x91'),_0x4026cc[_0x35fc('0x2c')]||_0x5512f6[_0x35fc('0x2c')],require('randomstring')[_0x35fc('0x92')](0x4),_0x4026cc[_0x35fc('0x93')]||_0x35fc('0x94')),'reportId':_0x5512f6['id'],'reportType':'default'});return db[_0x35fc('0x95')][_0x35fc('0x4a')](_0x379650,{'raw':!![]});})[_0x35fc('0x26')](function(_0x328e90){if(_0x5512f6['table']===_0x35fc('0x96')){_0x2fae26[_0x35fc('0x3e')](_0x5512f6[_0x35fc('0x71')]+_0x35fc('0x97'),_0x4026cc[_0x35fc('0x98')],_0x4026cc[_0x35fc('0x99')]);}else{_0x2fae26['where'](_0x5512f6[_0x35fc('0x71')]+_0x35fc('0x9a'),_0x4026cc['startDate'],_0x4026cc[_0x35fc('0x99')]);}if(_0x328e90){logger[_0x35fc('0x9b')]('Run\x20Query:',_0x2fae26[_0x35fc('0x87')]());require(_0x35fc('0x9c'))[_0x35fc('0x9d')](path[_0x35fc('0x56')](__dirname,_0x35fc('0x9e'),_0x328e90['output']),[_0x328e90['id'],_0x2fae26[_0x35fc('0x87')](),path[_0x35fc('0x56')](__dirname,_0x35fc('0x9f'),_0x328e90['savename']),_0x42f87e]);return _0x328e90;}else{var _0x1224cd=squel['select']();_0x1224cd['from']('('+_0x2fae26[_0x35fc('0x87')]()+')',_0x35fc('0xa0'));_0x1224cd[_0x35fc('0x68')](_0x35fc('0xa1'),_0x35fc('0x1f'));_0x2fae26['limit'](_0x4026cc[_0x35fc('0x1d')]||_0x25ee61);_0x2fae26[_0x35fc('0x1c')](_0x4026cc[_0x35fc('0x1c')]||0x0);return dbH['sequelize'][_0x35fc('0x35')](_0x1224cd[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')][_0x35fc('0xa2')][_0x35fc('0x88')]})['then'](function(_0x1a2d73){if(!_0x1a2d73[_0x35fc('0x3b')]){_0x4c742c=0x0;}else{_0x4c742c=_0x1a2d73[0x0]['count']||0x0;}return dbH['sequelize'][_0x35fc('0x35')](_0x2fae26[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')][_0x35fc('0xa2')][_0x35fc('0x88')]});})[_0x35fc('0x26')](function(_0x8c80ca){return{'rows':_0x8c80ca||[],'count':_0x4c742c};});}});}exports['run']=function(_0x5dc286,_0x146ce1){return runReport(_0x5dc286[_0x35fc('0x48')],_0x5dc286[_0x35fc('0x35')],_0x5dc286[_0x35fc('0x43')])[_0x35fc('0x26')](respondWithResult(_0x146ce1,null))['catch'](handleError(_0x146ce1,null));};exports['runReport']=runReport;exports[_0x35fc('0x35')]=function(_0x2451f2,_0x3fff79){var _0x1c6ce9=0xa;var _0x4b2079=['join',_0x35fc('0x57'),_0x35fc('0xa3'),_0x35fc('0x58')];var _0xd46d64={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x35fc('0x5b'),'MAX':_0x35fc('0x5c'),'MIN':'MIN(%s)','AVG':_0x35fc('0x5e'),'GROUP_CONCAT':_0x35fc('0x89'),'GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':_0x35fc('0x60')};var _0x274337={'SEC_TO_TIME':_0x35fc('0x8a'),'DATE':_0x35fc('0x61'),'HOUR':_0x35fc('0xa4'),'ROUND':_0x35fc('0x8b'),'UNIX_TIMESTAMP':_0x35fc('0x8c')};var _0x19ae76=function(_0x366a3b){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),_0x35fc('0x8d'),'IS\x20NOT\x20EMPTY'],_0x366a3b);};var _0x345026=function(_0x553f7d){if(!_0x553f7d||!_0x553f7d[_0x35fc('0x65')]['length']){return'';}for(var _0x5aa072='(',_0x3c96ef=0x0;_0x3c96ef<_0x553f7d[_0x35fc('0x65')][_0x35fc('0x3b')];_0x3c96ef+=0x1){_0x3c96ef>0x0&&(_0x5aa072+='\x20'+_0x553f7d['operator']+'\x20');_0x5aa072+=_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x67')]?_0x345026(_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x67')]):_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x68')]+'\x20'+_0x553f7d['rules'][_0x3c96ef]['condition']+(_0x19ae76(_0x553f7d[_0x35fc('0x65')][_0x3c96ef]['condition'])?'\x20'+_0x553f7d['rules'][_0x3c96ef][_0x35fc('0x6a')]:'');}return _0x5aa072+')';};var _0x48b826={'where':{'id':_0x2451f2[_0x35fc('0x48')]['id']}},_0x556f9a,_0x5ae83f,_0x450769,_0x5d461c,_0x355154;_0x48b826=_[_0x35fc('0x40')]({},_0x48b826,_0x2451f2[_0x35fc('0x43')]);return db[_0x35fc('0x2f')][_0x35fc('0x51')](_0x48b826)['then'](function(_0x522ff2){if(_0x522ff2){_0x556f9a=_0x522ff2;return _0x522ff2[_0x35fc('0x8e')]();}return null;})['then'](function(_0x233c94){if(_0x233c94){if(!_0x233c94[_0x35fc('0x3b')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5ae83f=_0x233c94;return db[_0x35fc('0x6d')][_0x35fc('0x46')]({'raw':!![]});}return null;})[_0x35fc('0x26')](function(_0x135e18){if(_0x135e18){_0x450769=_[_0x35fc('0x6e')](_0x135e18,'id');var _0x28525f;var _0x9116b1=squel[_0x35fc('0x6f')]();_0x9116b1['from'](_0x556f9a['table']);for(var _0x5cefdb=0x0;_0x5cefdb<_0x5ae83f['length'];_0x5cefdb+=0x1){_0x28525f=_0x5ae83f[_0x5cefdb][_0x35fc('0x72')]?_0x450769[_0x5ae83f[_0x5cefdb]['MetricId']][_0x35fc('0x73')]:_0x5ae83f[_0x5cefdb]['field'];_0x28525f=_0x5ae83f[_0x5cefdb][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0xd46d64[_0x5ae83f[_0x5cefdb]['function']],'%s',_0x28525f):_0x28525f;_0x28525f=_0x5ae83f[_0x5cefdb]['format']?_[_0x35fc('0x75')](_0x274337[_0x5ae83f[_0x5cefdb][_0x35fc('0x80')]],'%s',_0x28525f):_0x28525f;if(_0x5ae83f[_0x5cefdb][_0x35fc('0x76')]){_0x9116b1[_0x35fc('0x67')](_0x28525f);}_0x5ae83f[_0x5cefdb][_0x35fc('0x77')]&&_0x9116b1['order'](_0x28525f,_0x5ae83f[_0x5cefdb]['orderBy']===_0x35fc('0x79')?![]:!![]);_0x9116b1['field'](_0x28525f,_0x5ae83f[_0x5cefdb][_0x35fc('0x7a')]||_0x28525f);}if(_0x556f9a['joins']){_0x556f9a[_0x35fc('0x7b')]=JSON[_0x35fc('0x7c')](_0x556f9a[_0x35fc('0x7b')]);for(var _0x10e30e=0x0;_0x10e30e<_0x556f9a['joins'][_0x35fc('0x3b')];_0x10e30e+=0x1){if(_0x556f9a['joins'][_0x10e30e][_0x35fc('0x32')]&&_['includes'](_0x4b2079,_0x556f9a['joins'][_0x10e30e][_0x35fc('0x32')])&&_0x556f9a['joins'][_0x10e30e][_0x35fc('0x7d')]&&_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')]&&_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7f')]){_0x9116b1[_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x32')]](_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')],null,util['format'](_0x35fc('0x81'),_0x556f9a[_0x35fc('0x71')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7d')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7f')]));}}}if(_0x556f9a['conditions']){_0x556f9a['conditions']=JSON['parse'](_0x556f9a['conditions']);_0x9116b1['where'](_0x345026(_0x556f9a[_0x35fc('0x82')][_0x35fc('0x67')]));}_0x355154=_0x9116b1[_0x35fc('0x83')]();_0x9116b1[_0x35fc('0x1d')](_0x1c6ce9);_0x9116b1[_0x35fc('0x1c')](0x0);logger['debug'](_0x35fc('0x85'),_0x9116b1[_0x35fc('0x87')]());return dbH[_0x35fc('0x86')][_0x35fc('0x35')](_0x9116b1[_0x35fc('0x87')](),{'type':dbH['sequelize'][_0x35fc('0xa2')][_0x35fc('0x88')]});}})[_0x35fc('0x26')](function(){return{'sql':_0x355154['toString']()};})[_0x35fc('0x26')](respondWithResult(_0x3fff79,null))[_0x35fc('0x49')](handleError(_0x3fff79,null));}; \ No newline at end of file +var _0x524e=['AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','QueryTypes','SELECT','run','runReport','SUM(%s)','GROUP_CONCAT(%s)','debug','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','end','error','stack','name','send','index','AnalyticDefaultReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','create','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','body','params','preview','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','Limited\x20Query:','sequelize','toString','join','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','getFields','from','clone','output','web','fullPath','generate','csv','default'];(function(_0x12b6d1,_0x3e41cb){var _0x55d498=function(_0x5d3e54){while(--_0x5d3e54){_0x12b6d1['push'](_0x12b6d1['shift']());}};_0x55d498(++_0x3e41cb);}(_0x524e,0x15e));var _0xe524=function(_0x344899,_0x564837){_0x344899=_0x344899-0x0;var _0x290165=_0x524e[_0x344899];return _0x290165;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0xfdc2a5,_0x1541d8){_0x1541d8=_0x1541d8||0xcc;return function(_0x11adbc){if(_0x11adbc){return _0xfdc2a5[_0xe524('0x1c')](_0x1541d8);}return _0xfdc2a5[_0xe524('0x1d')](_0x1541d8)['end']();};}function respondWithResult(_0x12ff75,_0x51e9fe){_0x51e9fe=_0x51e9fe||0xc8;return function(_0x19f013){if(_0x19f013){return _0x12ff75[_0xe524('0x1d')](_0x51e9fe)['json'](_0x19f013);}};}function respondWithFilteredResult(_0x569660,_0x488fce){return function(_0x109795){if(_0x109795){var _0x538754=typeof _0x488fce[_0xe524('0x1e')]==='undefined'&&typeof _0x488fce['limit']==='undefined';var _0x3a4027=_0x109795['count'];var _0x11b2a1=_0x538754?0x0:_0x488fce[_0xe524('0x1e')];var _0x278de9=_0x538754?_0x109795[_0xe524('0x1f')]:_0x488fce['offset']+_0x488fce[_0xe524('0x20')];var _0x3ccb3f;if(_0x278de9>=_0x3a4027){_0x278de9=_0x3a4027;_0x3ccb3f=0xc8;}else{_0x3ccb3f=0xce;}_0x569660['status'](_0x3ccb3f);return _0x569660[_0xe524('0x21')](_0xe524('0x22'),_0x11b2a1+'-'+_0x278de9+'/'+_0x3a4027)[_0xe524('0x23')](_0x109795);}return null;};}function patchUpdates(_0x1dcc0f){return function(_0x1c4194){try{jsonpatch[_0xe524('0x24')](_0x1c4194,_0x1dcc0f,!![]);}catch(_0xbf059b){return BPromise[_0xe524('0x25')](_0xbf059b);}return _0x1c4194[_0xe524('0x26')]();};}function saveUpdates(_0x5c4d21,_0x7d1f92){return function(_0x5bb00b){if(_0x5bb00b){return _0x5bb00b['update'](_0x5c4d21)[_0xe524('0x27')](function(_0x23df5e){return _0x23df5e;});}return null;};}function removeEntity(_0x1ad106,_0x85fc51){return function(_0x599d5d){if(_0x599d5d){return _0x599d5d[_0xe524('0x28')]()['then'](function(){var _0x17e245=_0x599d5d[_0xe524('0x29')]({'plain':!![]});var _0xd62772=_0xe524('0x2a');return db[_0xe524('0x2b')][_0xe524('0x28')]({'where':{'type':_0xd62772,'resourceId':_0x17e245['id']}})[_0xe524('0x27')](function(){return _0x599d5d;});})['then'](function(){_0x1ad106['status'](0xcc)[_0xe524('0x2c')]();});}};}function handleEntityNotFound(_0x45abad,_0x476572){return function(_0x109a96){if(!_0x109a96){_0x45abad[_0xe524('0x1c')](0x194);}return _0x109a96;};}function handleError(_0x5405e4,_0x52f140){_0x52f140=_0x52f140||0x1f4;return function(_0x4b1ff){logger[_0xe524('0x2d')](_0x4b1ff[_0xe524('0x2e')]);if(_0x4b1ff[_0xe524('0x2f')]){delete _0x4b1ff[_0xe524('0x2f')];}_0x5405e4['status'](_0x52f140)[_0xe524('0x30')](_0x4b1ff);};}exports[_0xe524('0x31')]=function(_0x4a4e15,_0x5b7ded){var _0x20688e={},_0x376324={},_0x5b2fc3={'count':0x0,'rows':[]};var _0x31d4a7=_['map'](db[_0xe524('0x32')]['rawAttributes'],function(_0x315e56){return{'name':_0x315e56[_0xe524('0x33')],'type':_0x315e56[_0xe524('0x34')]['key']};});_0x376324[_0xe524('0x35')]=_['map'](_0x31d4a7,_0xe524('0x2f'));_0x376324[_0xe524('0x36')]=_[_0xe524('0x37')](_0x4a4e15['query']);_0x376324[_0xe524('0x38')]=_[_0xe524('0x39')](_0x376324['model'],_0x376324[_0xe524('0x36')]);_0x20688e[_0xe524('0x3a')]=_[_0xe524('0x39')](_0x376324[_0xe524('0x35')],qs['fields'](_0x4a4e15[_0xe524('0x36')][_0xe524('0x3b')]));_0x20688e[_0xe524('0x3a')]=_0x20688e[_0xe524('0x3a')][_0xe524('0x3c')]?_0x20688e[_0xe524('0x3a')]:_0x376324[_0xe524('0x35')];if(!_0x4a4e15[_0xe524('0x36')]['hasOwnProperty'](_0xe524('0x3d'))){_0x20688e['limit']=qs[_0xe524('0x20')](_0x4a4e15[_0xe524('0x36')]['limit']);_0x20688e[_0xe524('0x1e')]=qs['offset'](_0x4a4e15[_0xe524('0x36')][_0xe524('0x1e')]);}_0x20688e[_0xe524('0x3e')]=qs[_0xe524('0x3f')](_0x4a4e15[_0xe524('0x36')][_0xe524('0x3f')]);_0x20688e[_0xe524('0x40')]=qs[_0xe524('0x38')](_['pick'](_0x4a4e15[_0xe524('0x36')],_0x376324[_0xe524('0x38')]),_0x31d4a7);if(_0x4a4e15[_0xe524('0x36')][_0xe524('0x41')]){_0x20688e[_0xe524('0x40')]=_[_0xe524('0x42')](_0x20688e[_0xe524('0x40')],{'$or':_[_0xe524('0x43')](_0x31d4a7,function(_0x5d3ea1){if(_0x5d3ea1[_0xe524('0x34')]!==_0xe524('0x44')){var _0x2e4a13={};_0x2e4a13[_0x5d3ea1['name']]={'$like':'%'+_0x4a4e15[_0xe524('0x36')]['filter']+'%'};return _0x2e4a13;}})});}_0x20688e=_[_0xe524('0x42')]({},_0x20688e,_0x4a4e15[_0xe524('0x45')]);var _0x43c314={'where':_0x20688e[_0xe524('0x40')]};return db[_0xe524('0x32')][_0xe524('0x1f')](_0x43c314)[_0xe524('0x27')](function(_0x52cd0e){_0x5b2fc3[_0xe524('0x1f')]=_0x52cd0e;if(_0x4a4e15[_0xe524('0x36')][_0xe524('0x46')]){_0x20688e[_0xe524('0x47')]=[{'all':!![]}];}return db[_0xe524('0x32')][_0xe524('0x48')](_0x20688e);})['then'](function(_0xb694b9){_0x5b2fc3[_0xe524('0x49')]=_0xb694b9;return _0x5b2fc3;})[_0xe524('0x27')](respondWithFilteredResult(_0x5b7ded,_0x20688e))['catch'](handleError(_0x5b7ded,null));};exports[_0xe524('0x4a')]=function(_0x5209dc,_0x4e5d99){var _0x2b9b3b={'raw':!![],'where':{'id':_0x5209dc['params']['id']}},_0x33906d={};_0x33906d[_0xe524('0x35')]=_[_0xe524('0x37')](db[_0xe524('0x32')][_0xe524('0x4b')]);_0x33906d['query']=_['keys'](_0x5209dc[_0xe524('0x36')]);_0x33906d[_0xe524('0x38')]=_['intersection'](_0x33906d[_0xe524('0x35')],_0x33906d['query']);_0x2b9b3b[_0xe524('0x3a')]=_[_0xe524('0x39')](_0x33906d[_0xe524('0x35')],qs[_0xe524('0x3b')](_0x5209dc[_0xe524('0x36')][_0xe524('0x3b')]));_0x2b9b3b[_0xe524('0x3a')]=_0x2b9b3b[_0xe524('0x3a')][_0xe524('0x3c')]?_0x2b9b3b[_0xe524('0x3a')]:_0x33906d[_0xe524('0x35')];if(_0x5209dc[_0xe524('0x36')][_0xe524('0x46')]){_0x2b9b3b[_0xe524('0x47')]=[{'all':!![]}];}_0x2b9b3b=_[_0xe524('0x42')]({},_0x2b9b3b,_0x5209dc['options']);return db[_0xe524('0x32')]['find'](_0x2b9b3b)['then'](handleEntityNotFound(_0x4e5d99,null))[_0xe524('0x27')](respondWithResult(_0x4e5d99,null))['catch'](handleError(_0x4e5d99,null));};exports[_0xe524('0x4c')]=function(_0x15d7ee,_0x561107){return db[_0xe524('0x32')]['create'](_0x15d7ee['body'],{})[_0xe524('0x27')](function(_0x1e5687){var _0x203e71=_0x15d7ee['user']['get']({'plain':!![]});if(!_0x203e71)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x203e71['role']==='user'){var _0x5477ca=_0x1e5687[_0xe524('0x29')]({'plain':!![]});var _0x2ce5c0='Reports';return db[_0xe524('0x4d')][_0xe524('0x4e')]({'where':{'name':_0x2ce5c0,'userProfileId':_0x203e71[_0xe524('0x4f')]},'raw':!![]})[_0xe524('0x27')](function(_0x2fa143){if(_0x2fa143&&_0x2fa143['autoAssociation']===0x0){return db[_0xe524('0x2b')][_0xe524('0x4c')]({'name':_0x5477ca[_0xe524('0x2f')],'resourceId':_0x5477ca['id'],'type':'DefaultReports','sectionId':_0x2fa143['id']},{})[_0xe524('0x27')](function(){return _0x1e5687;});}else{return _0x1e5687;}})['catch'](function(_0x12e5d0){logger[_0xe524('0x2d')](_0xe524('0x50'),_0x12e5d0);throw _0x12e5d0;});}return _0x1e5687;})[_0xe524('0x27')](respondWithResult(_0x561107,0xc9))[_0xe524('0x51')](handleError(_0x561107,null));};exports[_0xe524('0x52')]=function(_0x1cec31,_0x374450){if(_0x1cec31[_0xe524('0x53')]['id']){delete _0x1cec31[_0xe524('0x53')]['id'];}return db[_0xe524('0x32')][_0xe524('0x4e')]({'where':{'id':_0x1cec31['params']['id']}})['then'](handleEntityNotFound(_0x374450,null))['then'](saveUpdates(_0x1cec31[_0xe524('0x53')],null))[_0xe524('0x27')](respondWithResult(_0x374450,null))[_0xe524('0x51')](handleError(_0x374450,null));};exports[_0xe524('0x28')]=function(_0x45fb0d,_0xef3d2f){return db[_0xe524('0x32')][_0xe524('0x4e')]({'where':{'id':_0x45fb0d[_0xe524('0x54')]['id']}})[_0xe524('0x27')](handleEntityNotFound(_0xef3d2f,null))[_0xe524('0x27')](removeEntity(_0xef3d2f,null))['catch'](handleError(_0xef3d2f,null));};exports[_0xe524('0x55')]=function(_0x1f0567,_0x4a5f4a){var _0x53da86=0xa;var _0x54adbd=['join',_0xe524('0x56'),_0xe524('0x57'),_0xe524('0x58')];var _0x8a2c00={'SUM':'SUM(%s)','COUNT':_0xe524('0x59'),'COUNT DISTINCT':_0xe524('0x5a'),'MAX':_0xe524('0x5b'),'MIN':_0xe524('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xe524('0x5d')};var _0x582fbb={'SEC_TO_TIME':_0xe524('0x5e'),'DATE':_0xe524('0x5f'),'HOUR':_0xe524('0x60'),'ROUND':_0xe524('0x61'),'UNIX_TIMESTAMP':_0xe524('0x62')};var _0x4f58ff=function(_0x5d0507){return!_[_0xe524('0x63')]([_0xe524('0x64'),_0xe524('0x65'),_0xe524('0x66'),_0xe524('0x67')],_0x5d0507);};var _0x474ed4=function(_0x5135f0){if(!_0x5135f0||!_0x5135f0[_0xe524('0x68')][_0xe524('0x3c')]){return'';}for(var _0xc3ccfd='(',_0x5d3b9c=0x0;_0x5d3b9c<_0x5135f0[_0xe524('0x68')][_0xe524('0x3c')];_0x5d3b9c+=0x1){_0x5d3b9c>0x0&&(_0xc3ccfd+='\x20'+_0x5135f0[_0xe524('0x69')]+'\x20');_0xc3ccfd+=_0x5135f0['rules'][_0x5d3b9c]['group']?_0x474ed4(_0x5135f0[_0xe524('0x68')][_0x5d3b9c][_0xe524('0x6a')]):_0x5135f0[_0xe524('0x68')][_0x5d3b9c][_0xe524('0x6b')]+'\x20'+_0x5135f0[_0xe524('0x68')][_0x5d3b9c]['condition']+(_0x4f58ff(_0x5135f0[_0xe524('0x68')][_0x5d3b9c][_0xe524('0x6c')])?'\x20'+_0x5135f0[_0xe524('0x68')][_0x5d3b9c][_0xe524('0x6d')]:'');}return _0xc3ccfd+')';};var _0x3ce098={'where':{'id':_0x1f0567[_0xe524('0x54')]['id']}},_0x22d06a,_0x35e6b2,_0x1e4b32,_0x27c55c,_0x7e5992;_0x3ce098=_['merge']({},_0x3ce098,_0x1f0567[_0xe524('0x45')]);return db[_0xe524('0x32')][_0xe524('0x4e')](_0x3ce098)[_0xe524('0x27')](function(_0xeec885){if(_0xeec885){_0x22d06a=_0xeec885;return _0xeec885['getFields']();}return null;})[_0xe524('0x27')](function(_0x2341cf){if(_0x2341cf){if(!_0x2341cf[_0xe524('0x3c')]){throw new db[(_0xe524('0x6e'))][(_0xe524('0x6f'))](_0xe524('0x70'),0x193);}_0x35e6b2=_0x2341cf;return db[_0xe524('0x71')]['findAll']({'raw':!![]});}return null;})[_0xe524('0x27')](function(_0x245501){if(_0x245501){_0x1e4b32=_[_0xe524('0x72')](_0x245501,'id');var _0xce15f5;var _0x5ec07c=squel[_0xe524('0x73')]();_0x5ec07c['from'](_0x22d06a[_0xe524('0x74')]);for(var _0x2a88e2=0x0;_0x2a88e2<_0x35e6b2[_0xe524('0x3c')];_0x2a88e2+=0x1){_0xce15f5=_0x35e6b2[_0x2a88e2]['MetricId']?_0x1e4b32[_0x35e6b2[_0x2a88e2][_0xe524('0x75')]][_0xe524('0x76')]:_0x35e6b2[_0x2a88e2][_0xe524('0x6b')];_0xce15f5=_0x35e6b2[_0x2a88e2][_0xe524('0x77')]?_[_0xe524('0x78')](_0x8a2c00[_0x35e6b2[_0x2a88e2]['function']],'%s',_0xce15f5):_0xce15f5;_0xce15f5=_0x35e6b2[_0x2a88e2][_0xe524('0x79')]?_[_0xe524('0x78')](_0x582fbb[_0x35e6b2[_0x2a88e2][_0xe524('0x79')]],'%s',_0xce15f5):_0xce15f5;if(_0x35e6b2[_0x2a88e2][_0xe524('0x7a')]){_0x5ec07c[_0xe524('0x6a')](_0xce15f5);}_0x35e6b2[_0x2a88e2]['orderBy']&&_0x5ec07c[_0xe524('0x3e')](_0xce15f5,_0x35e6b2[_0x2a88e2][_0xe524('0x7b')]===_0xe524('0x7c')?![]:!![]);_0x5ec07c[_0xe524('0x6b')](_0xce15f5,_0x35e6b2[_0x2a88e2][_0xe524('0x7d')]||_0xce15f5);}if(_0x22d06a[_0xe524('0x7e')]){_0x22d06a['joins']=JSON[_0xe524('0x7f')](_0x22d06a[_0xe524('0x7e')]);for(var _0x1beaa2=0x0;_0x1beaa2<_0x22d06a['joins'][_0xe524('0x3c')];_0x1beaa2+=0x1){if(_0x22d06a[_0xe524('0x7e')][_0x1beaa2]['type']&&_[_0xe524('0x63')](_0x54adbd,_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x34')])&&_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x80')]&&_0x22d06a[_0xe524('0x7e')][_0x1beaa2]['foreignTable']&&_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x81')]){_0x5ec07c[_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x34')]](_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x82')],null,util[_0xe524('0x79')](_0xe524('0x83'),_0x22d06a[_0xe524('0x74')],_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x80')],_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x82')],_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x81')]));}}}if(_0x22d06a['conditions']){_0x22d06a[_0xe524('0x84')]=JSON[_0xe524('0x7f')](_0x22d06a[_0xe524('0x84')]);_0x5ec07c['where'](_0x474ed4(_0x22d06a[_0xe524('0x84')][_0xe524('0x6a')]));}_0x7e5992=_0x5ec07c['clone']();_0x5ec07c['limit'](_0x53da86);_0x5ec07c[_0xe524('0x1e')](0x0);logger['debug'](_0xe524('0x85'),_0x5ec07c['toString']());return dbH[_0xe524('0x86')][_0xe524('0x36')](_0x5ec07c[_0xe524('0x87')](),{'type':dbH[_0xe524('0x86')]['QueryTypes']['SELECT']});}})[_0xe524('0x27')](respondWithResult(_0x4a5f4a,null))[_0xe524('0x51')](handleError(_0x4a5f4a,null));};function runReport(_0x50eb96,_0x45c287,_0x449842){var _0x1f3ed1=_0x45c287['name'];var _0x19b063=0xa;var _0x140a4e=[_0xe524('0x88'),_0xe524('0x56'),_0xe524('0x57'),_0xe524('0x58')];var _0x54385f={'SUM':'SUM(%s)','COUNT':_0xe524('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe524('0x5b'),'MIN':_0xe524('0x5c'),'AVG':_0xe524('0x89'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xe524('0x8a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1681c5={'SEC_TO_TIME':_0xe524('0x5e'),'DATE':_0xe524('0x5f'),'HOUR':_0xe524('0x60'),'ROUND':_0xe524('0x61'),'UNIX_TIMESTAMP':_0xe524('0x62')};var _0x50f5e3=function(_0x11298c){return!_[_0xe524('0x63')]([_0xe524('0x64'),'IS\x20NOT\x20NULL',_0xe524('0x66'),_0xe524('0x67')],_0x11298c);};var _0x5603d0=function(_0x2712ac){if(!_0x2712ac||!_0x2712ac[_0xe524('0x68')][_0xe524('0x3c')]){return'';}for(var _0x32c9f6='(',_0x58d29e=0x0;_0x58d29e<_0x2712ac[_0xe524('0x68')][_0xe524('0x3c')];_0x58d29e+=0x1){_0x58d29e>0x0&&(_0x32c9f6+='\x20'+_0x2712ac[_0xe524('0x69')]+'\x20');_0x32c9f6+=_0x2712ac['rules'][_0x58d29e][_0xe524('0x6a')]?_0x5603d0(_0x2712ac['rules'][_0x58d29e][_0xe524('0x6a')]):_0x2712ac[_0xe524('0x68')][_0x58d29e][_0xe524('0x6b')]+'\x20'+_0x2712ac['rules'][_0x58d29e][_0xe524('0x6c')]+(_0x50f5e3(_0x2712ac[_0xe524('0x68')][_0x58d29e][_0xe524('0x6c')])?'\x20'+_0x2712ac['rules'][_0x58d29e]['value']:'');}return _0x32c9f6+')';};var _0x334164={'where':{'id':_0x50eb96['id']}},_0x512572,_0x903e24,_0x4964c3,_0x2dc3f5,_0x246c62;_0x334164=_['merge']({},_0x334164,_0x449842);return db[_0xe524('0x32')][_0xe524('0x4e')](_0x334164)['then'](function(_0x482b72){if(_0x482b72){_0x512572=_0x482b72;return _0x482b72[_0xe524('0x8b')]();}return null;})[_0xe524('0x27')](function(_0x1b3e03){if(_0x1b3e03){if(!_0x1b3e03['length']){throw new db[(_0xe524('0x6e'))][(_0xe524('0x6f'))](_0xe524('0x70'),0x193);}_0x903e24=_0x1b3e03;return db[_0xe524('0x71')][_0xe524('0x48')]({'raw':!![]});}return null;})[_0xe524('0x27')](function(_0x57501c){if(_0x57501c){_0x4964c3=_[_0xe524('0x72')](_0x57501c,'id');var _0x3a2834;var _0x4c7f45=squel['select']();_0x4c7f45[_0xe524('0x8c')](_0x512572[_0xe524('0x74')]);for(var _0x41f842=0x0;_0x41f842<_0x903e24[_0xe524('0x3c')];_0x41f842+=0x1){_0x3a2834=_0x903e24[_0x41f842]['MetricId']?_0x4964c3[_0x903e24[_0x41f842][_0xe524('0x75')]][_0xe524('0x76')]:_0x903e24[_0x41f842]['field'];_0x3a2834=_0x903e24[_0x41f842]['function']?_[_0xe524('0x78')](_0x54385f[_0x903e24[_0x41f842][_0xe524('0x77')]],'%s',_0x3a2834):_0x3a2834;_0x3a2834=_0x903e24[_0x41f842][_0xe524('0x79')]?_[_0xe524('0x78')](_0x1681c5[_0x903e24[_0x41f842][_0xe524('0x79')]],'%s',_0x3a2834):_0x3a2834;if(_0x903e24[_0x41f842][_0xe524('0x7a')]){_0x4c7f45['group'](_0x3a2834);}_0x903e24[_0x41f842]['orderBy']&&_0x4c7f45[_0xe524('0x3e')](_0x3a2834,_0x903e24[_0x41f842][_0xe524('0x7b')]==='DESC'?![]:!![]);_0x4c7f45['field'](_0x3a2834,_0x903e24[_0x41f842][_0xe524('0x7d')]||_0x3a2834);}if(_0x512572[_0xe524('0x7e')]){_0x512572[_0xe524('0x7e')]=JSON[_0xe524('0x7f')](_0x512572[_0xe524('0x7e')]);for(var _0xa820a1=0x0;_0xa820a1<_0x512572['joins']['length'];_0xa820a1+=0x1){if(_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x34')]&&_[_0xe524('0x63')](_0x140a4e,_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x34')])&&_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x80')]&&_0x512572[_0xe524('0x7e')][_0xa820a1]['foreignTable']&&_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x81')]){_0x4c7f45[_0x512572[_0xe524('0x7e')][_0xa820a1]['type']](_0x512572['joins'][_0xa820a1][_0xe524('0x82')],null,util[_0xe524('0x79')](_0xe524('0x83'),_0x512572[_0xe524('0x74')],_0x512572['joins'][_0xa820a1][_0xe524('0x80')],_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x82')],_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x81')]));}}}if(_0x512572['conditions']){_0x512572[_0xe524('0x84')]=JSON['parse'](_0x512572[_0xe524('0x84')]);_0x4c7f45[_0xe524('0x40')](_0x5603d0(_0x512572['conditions'][_0xe524('0x6a')]));}_0x246c62=_0x4c7f45[_0xe524('0x8d')]();_0x4c7f45['limit'](_0x19b063);_0x4c7f45[_0xe524('0x1e')](0x0);return;}})['then'](function(){if(_0x45c287[_0xe524('0x8e')]===_0xe524('0x8f')){return null;}var _0x1be681=_[_0xe524('0x42')](_0x45c287,{'name':_0x45c287[_0xe524('0x90')]||_0x45c287[_0xe524('0x2f')]||_0x512572[_0xe524('0x2f')],'basename':_0x1f3ed1,'savename':util[_0xe524('0x79')]('%s-%s.%s',_0x45c287[_0xe524('0x2f')]||_0x512572['name'],require('randomstring')[_0xe524('0x91')](0x4),_0x45c287['output']||_0xe524('0x92')),'reportId':_0x512572['id'],'reportType':_0xe524('0x93')});return db[_0xe524('0x94')][_0xe524('0x4c')](_0x1be681,{'raw':!![]});})[_0xe524('0x27')](function(_0x26c802){if(_0x512572['table']==='cdr'){_0x246c62[_0xe524('0x40')](_0x512572[_0xe524('0x74')]+_0xe524('0x95'),_0x45c287[_0xe524('0x96')],_0x45c287[_0xe524('0x97')]);}else{_0x246c62[_0xe524('0x40')](_0x512572[_0xe524('0x74')]+_0xe524('0x98'),_0x45c287[_0xe524('0x96')],_0x45c287[_0xe524('0x97')]);}if(_0x26c802){logger['info'](_0xe524('0x99'),_0x246c62[_0xe524('0x87')]());require(_0xe524('0x9a'))[_0xe524('0x9b')](path[_0xe524('0x88')](__dirname,_0xe524('0x9c'),_0x26c802['output']),[_0x26c802['id'],_0x246c62[_0xe524('0x87')](),path[_0xe524('0x88')](__dirname,_0xe524('0x9d'),_0x26c802[_0xe524('0x9e')]),_0x1f3ed1]);return _0x26c802;}else{var _0x84bbd7=squel[_0xe524('0x73')]();_0x84bbd7[_0xe524('0x8c')]('('+_0x246c62[_0xe524('0x87')]()+')','countTable');_0x84bbd7['field']('COUNT(*)',_0xe524('0x1f'));_0x246c62[_0xe524('0x20')](_0x45c287['limit']||_0x19b063);_0x246c62[_0xe524('0x1e')](_0x45c287[_0xe524('0x1e')]||0x0);return dbH['sequelize'][_0xe524('0x36')](_0x84bbd7[_0xe524('0x87')](),{'type':dbH['sequelize'][_0xe524('0x9f')][_0xe524('0xa0')]})[_0xe524('0x27')](function(_0x542182){if(!_0x542182[_0xe524('0x3c')]){_0x2dc3f5=0x0;}else{_0x2dc3f5=_0x542182[0x0][_0xe524('0x1f')]||0x0;}return dbH[_0xe524('0x86')]['query'](_0x246c62[_0xe524('0x87')](),{'type':dbH[_0xe524('0x86')][_0xe524('0x9f')][_0xe524('0xa0')]});})['then'](function(_0x5e6a3d){return{'rows':_0x5e6a3d||[],'count':_0x2dc3f5};});}});}exports[_0xe524('0xa1')]=function(_0x33d066,_0x3ea495){return runReport(_0x33d066[_0xe524('0x54')],_0x33d066[_0xe524('0x36')],_0x33d066[_0xe524('0x45')])[_0xe524('0x27')](respondWithResult(_0x3ea495,null))[_0xe524('0x51')](handleError(_0x3ea495,null));};exports[_0xe524('0xa2')]=runReport;exports[_0xe524('0x36')]=function(_0x4505de,_0x292f14){var _0x2d24c1=0xa;var _0x483307=[_0xe524('0x88'),_0xe524('0x56'),_0xe524('0x57'),_0xe524('0x58')];var _0x280022={'SUM':_0xe524('0xa3'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe524('0x5b'),'MIN':'MIN(%s)','AVG':_0xe524('0x89'),'GROUP_CONCAT':_0xe524('0xa4'),'GROUP_CONCAT ASC':_0xe524('0x8a'),'GROUP_CONCAT DESC':_0xe524('0x5d')};var _0x46d6da={'SEC_TO_TIME':_0xe524('0x5e'),'DATE':_0xe524('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0xe524('0x61'),'UNIX_TIMESTAMP':_0xe524('0x62')};var _0x39998a=function(_0x107de8){return!_['includes']([_0xe524('0x64'),_0xe524('0x65'),'IS\x20EMPTY',_0xe524('0x67')],_0x107de8);};var _0x458e14=function(_0x4e0886){if(!_0x4e0886||!_0x4e0886['rules'][_0xe524('0x3c')]){return'';}for(var _0x3639cf='(',_0x575c14=0x0;_0x575c14<_0x4e0886['rules'][_0xe524('0x3c')];_0x575c14+=0x1){_0x575c14>0x0&&(_0x3639cf+='\x20'+_0x4e0886['operator']+'\x20');_0x3639cf+=_0x4e0886['rules'][_0x575c14]['group']?_0x458e14(_0x4e0886[_0xe524('0x68')][_0x575c14][_0xe524('0x6a')]):_0x4e0886[_0xe524('0x68')][_0x575c14][_0xe524('0x6b')]+'\x20'+_0x4e0886['rules'][_0x575c14]['condition']+(_0x39998a(_0x4e0886['rules'][_0x575c14][_0xe524('0x6c')])?'\x20'+_0x4e0886[_0xe524('0x68')][_0x575c14][_0xe524('0x6d')]:'');}return _0x3639cf+')';};var _0x289720={'where':{'id':_0x4505de[_0xe524('0x54')]['id']}},_0x3fb45c,_0x3362fe,_0x119684,_0x19e4fd,_0x4b4349;_0x289720=_[_0xe524('0x42')]({},_0x289720,_0x4505de[_0xe524('0x45')]);return db[_0xe524('0x32')][_0xe524('0x4e')](_0x289720)[_0xe524('0x27')](function(_0x404a49){if(_0x404a49){_0x3fb45c=_0x404a49;return _0x404a49[_0xe524('0x8b')]();}return null;})[_0xe524('0x27')](function(_0x8e8087){if(_0x8e8087){if(!_0x8e8087['length']){throw new db[(_0xe524('0x6e'))][(_0xe524('0x6f'))](_0xe524('0x70'),0x193);}_0x3362fe=_0x8e8087;return db[_0xe524('0x71')][_0xe524('0x48')]({'raw':!![]});}return null;})[_0xe524('0x27')](function(_0x113a54){if(_0x113a54){_0x119684=_[_0xe524('0x72')](_0x113a54,'id');var _0x4ebca4;var _0x40043c=squel[_0xe524('0x73')]();_0x40043c[_0xe524('0x8c')](_0x3fb45c[_0xe524('0x74')]);for(var _0x19a773=0x0;_0x19a773<_0x3362fe[_0xe524('0x3c')];_0x19a773+=0x1){_0x4ebca4=_0x3362fe[_0x19a773][_0xe524('0x75')]?_0x119684[_0x3362fe[_0x19a773][_0xe524('0x75')]][_0xe524('0x76')]:_0x3362fe[_0x19a773][_0xe524('0x6b')];_0x4ebca4=_0x3362fe[_0x19a773][_0xe524('0x77')]?_[_0xe524('0x78')](_0x280022[_0x3362fe[_0x19a773]['function']],'%s',_0x4ebca4):_0x4ebca4;_0x4ebca4=_0x3362fe[_0x19a773][_0xe524('0x79')]?_[_0xe524('0x78')](_0x46d6da[_0x3362fe[_0x19a773][_0xe524('0x79')]],'%s',_0x4ebca4):_0x4ebca4;if(_0x3362fe[_0x19a773]['groupBy']){_0x40043c['group'](_0x4ebca4);}_0x3362fe[_0x19a773][_0xe524('0x7b')]&&_0x40043c[_0xe524('0x3e')](_0x4ebca4,_0x3362fe[_0x19a773][_0xe524('0x7b')]==='DESC'?![]:!![]);_0x40043c[_0xe524('0x6b')](_0x4ebca4,_0x3362fe[_0x19a773][_0xe524('0x7d')]||_0x4ebca4);}if(_0x3fb45c[_0xe524('0x7e')]){_0x3fb45c['joins']=JSON['parse'](_0x3fb45c[_0xe524('0x7e')]);for(var _0x2a85e5=0x0;_0x2a85e5<_0x3fb45c[_0xe524('0x7e')]['length'];_0x2a85e5+=0x1){if(_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x34')]&&_[_0xe524('0x63')](_0x483307,_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x34')])&&_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x80')]&&_0x3fb45c['joins'][_0x2a85e5][_0xe524('0x82')]&&_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x81')]){_0x40043c[_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x34')]](_0x3fb45c['joins'][_0x2a85e5][_0xe524('0x82')],null,util[_0xe524('0x79')]('%s.%s\x20=\x20%s.%s',_0x3fb45c[_0xe524('0x74')],_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x80')],_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x82')],_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x81')]));}}}if(_0x3fb45c[_0xe524('0x84')]){_0x3fb45c[_0xe524('0x84')]=JSON['parse'](_0x3fb45c['conditions']);_0x40043c[_0xe524('0x40')](_0x458e14(_0x3fb45c[_0xe524('0x84')][_0xe524('0x6a')]));}_0x4b4349=_0x40043c[_0xe524('0x8d')]();_0x40043c[_0xe524('0x20')](_0x2d24c1);_0x40043c[_0xe524('0x1e')](0x0);logger[_0xe524('0xa5')]('Limited\x20Query:',_0x40043c['toString']());return dbH[_0xe524('0x86')]['query'](_0x40043c['toString'](),{'type':dbH[_0xe524('0x86')][_0xe524('0x9f')][_0xe524('0xa0')]});}})[_0xe524('0x27')](function(){return{'sql':_0x4b4349[_0xe524('0x87')]()};})[_0xe524('0x27')](respondWithResult(_0x292f14,null))['catch'](handleError(_0x292f14,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 45f3e29..f63f226 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 _0xc452=['rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','api','moment','request-promise'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xc452,0x1b7));var _0x2c45=function(_0x82542b,_0xf0f271){_0x82542b=_0x82542b-0x0;var _0x14528d=_0xc452[_0x82542b];return _0x14528d;};'use strict';var _=require(_0x2c45('0x0'));var util=require(_0x2c45('0x1'));var logger=require('../../config/logger')(_0x2c45('0x2'));var moment=require(_0x2c45('0x3'));var BPromise=require('bluebird');var rp=require(_0x2c45('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c45('0x5'));var config=require(_0x2c45('0x6'));var attributes=require(_0x2c45('0x7'));module[_0x2c45('0x8')]=function(_0xfe7499,_0x4a0323){return _0xfe7499[_0x2c45('0x9')](_0x2c45('0xa'),attributes,{'tableName':_0x2c45('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe344=['rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x30e004,_0x46f8c2){var _0x5ca247=function(_0x20d80f){while(--_0x20d80f){_0x30e004['push'](_0x30e004['shift']());}};_0x5ca247(++_0x46f8c2);}(_0xe344,0x1e9));var _0x4e34=function(_0x13be95,_0x4efb8c){_0x13be95=_0x13be95-0x0;var _0x5e7f93=_0xe344[_0x13be95];return _0x5e7f93;};'use strict';var _=require(_0x4e34('0x0'));var util=require('util');var logger=require(_0x4e34('0x1'))('api');var moment=require(_0x4e34('0x2'));var BPromise=require(_0x4e34('0x3'));var rp=require(_0x4e34('0x4'));var fs=require('fs');var path=require(_0x4e34('0x5'));var rimraf=require(_0x4e34('0x6'));var config=require(_0x4e34('0x7'));var attributes=require(_0x4e34('0x8'));module['exports']=function(_0x43821b,_0x13892a){return _0x43821b[_0x4e34('0x9')](_0x4e34('0xa'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 40180a2..d28b715 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 _0xab96=['info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xab96,0x164));var _0x6ab9=function(_0x3f7ee2,_0x3b4c28){_0x3f7ee2=_0x3f7ee2-0x0;var _0x3ee417=_0xab96[_0x3f7ee2];return _0x3ee417;};'use strict';var _=require(_0x6ab9('0x0'));var util=require(_0x6ab9('0x1'));var moment=require(_0x6ab9('0x2'));var BPromise=require(_0x6ab9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ab9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ab9('0x5'));var logger=require(_0x6ab9('0x6'))('rpc');var config=require(_0x6ab9('0x7'));var jayson=require(_0x6ab9('0x8'));var client=jayson[_0x6ab9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5aa735,_0x2301a9,_0x295488){return new BPromise(function(_0x772d34,_0xb7aa30){return client[_0x6ab9('0xa')](_0x5aa735,_0x295488)[_0x6ab9('0xb')](function(_0x5b104e){logger[_0x6ab9('0xc')](_0x6ab9('0xd'),_0x2301a9,_0x6ab9('0xe'));logger[_0x6ab9('0xf')](_0x6ab9('0x10'),_0x2301a9,_0x6ab9('0xe'),JSON[_0x6ab9('0x11')](_0x5b104e));if(_0x5b104e['error']){if(_0x5b104e[_0x6ab9('0x12')][_0x6ab9('0x13')]===0x1f4){logger[_0x6ab9('0x12')](_0x6ab9('0xd'),_0x2301a9,_0x5b104e[_0x6ab9('0x12')][_0x6ab9('0x14')]);return _0xb7aa30(_0x5b104e['error'][_0x6ab9('0x14')]);}logger[_0x6ab9('0x12')](_0x6ab9('0xd'),_0x2301a9,_0x5b104e[_0x6ab9('0x12')][_0x6ab9('0x14')]);return _0x772d34(_0x5b104e[_0x6ab9('0x12')]['message']);}else{logger[_0x6ab9('0xc')](_0x6ab9('0xd'),_0x2301a9,_0x6ab9('0xe'));_0x772d34(_0x5b104e[_0x6ab9('0x15')][_0x6ab9('0x14')]);}})[_0x6ab9('0x16')](function(_0x33d6cc){logger[_0x6ab9('0x12')](_0x6ab9('0xd'),_0x2301a9,_0x33d6cc);_0xb7aa30(_0x33d6cc);});});} \ No newline at end of file +var _0x14bc=['code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error'];(function(_0xec696,_0x1176b6){var _0x43de02=function(_0xd7f83c){while(--_0xd7f83c){_0xec696['push'](_0xec696['shift']());}};_0x43de02(++_0x1176b6);}(_0x14bc,0xd4));var _0xc14b=function(_0x4934ab,_0xa434e5){_0x4934ab=_0x4934ab-0x0;var _0x49fc8a=_0x14bc[_0x4934ab];return _0x49fc8a;};'use strict';var _=require(_0xc14b('0x0'));var util=require(_0xc14b('0x1'));var moment=require(_0xc14b('0x2'));var BPromise=require(_0xc14b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc14b('0x4'))['db'];var utils=require(_0xc14b('0x5'));var logger=require(_0xc14b('0x6'))(_0xc14b('0x7'));var config=require(_0xc14b('0x8'));var jayson=require(_0xc14b('0x9'));var client=jayson[_0xc14b('0xa')][_0xc14b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45c246,_0x459861,_0x550941){return new BPromise(function(_0x1b9b0c,_0x269140){return client[_0xc14b('0xc')](_0x45c246,_0x550941)[_0xc14b('0xd')](function(_0x304048){logger[_0xc14b('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x459861,_0xc14b('0xf'));logger['debug'](_0xc14b('0x10'),_0x459861,'request\x20sent',JSON['stringify'](_0x304048));if(_0x304048[_0xc14b('0x11')]){if(_0x304048['error'][_0xc14b('0x12')]===0x1f4){logger[_0xc14b('0x11')](_0xc14b('0x13'),_0x459861,_0x304048[_0xc14b('0x11')]['message']);return _0x269140(_0x304048[_0xc14b('0x11')][_0xc14b('0x14')]);}logger[_0xc14b('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x459861,_0x304048[_0xc14b('0x11')][_0xc14b('0x14')]);return _0x1b9b0c(_0x304048[_0xc14b('0x11')][_0xc14b('0x14')]);}else{logger[_0xc14b('0xe')](_0xc14b('0x13'),_0x459861,_0xc14b('0xf'));_0x1b9b0c(_0x304048[_0xc14b('0x15')][_0xc14b('0x14')]);}})[_0xc14b('0x16')](function(_0x4b4b2e){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x459861,_0x4b4b2e);_0x269140(_0x4b4b2e);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 5925072..c999a5a 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 _0x8d8e=['update','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','preview','/:id/run','run','/:id/query','query','post','create','put'];(function(_0x59ef83,_0x1616f4){var _0x404afa=function(_0x576ac9){while(--_0x576ac9){_0x59ef83['push'](_0x59ef83['shift']());}};_0x404afa(++_0x1616f4);}(_0x8d8e,0x15a));var _0xe8d8=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x8d8e[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xe8d8('0x0'));var util=require('util');var path=require(_0xe8d8('0x1'));var timeout=require(_0xe8d8('0x2'));var express=require(_0xe8d8('0x3'));var router=express[_0xe8d8('0x4')]();var fs_extra=require(_0xe8d8('0x5'));var auth=require(_0xe8d8('0x6'));var interaction=require(_0xe8d8('0x7'));var config=require(_0xe8d8('0x8'));var controller=require(_0xe8d8('0x9'));router['get']('/',auth[_0xe8d8('0xa')](),controller[_0xe8d8('0xb')]);router[_0xe8d8('0xc')](_0xe8d8('0xd'),auth[_0xe8d8('0xa')](),controller['show']);router[_0xe8d8('0xc')]('/:id/preview',auth[_0xe8d8('0xa')](),controller[_0xe8d8('0xe')]);router[_0xe8d8('0xc')](_0xe8d8('0xf'),auth[_0xe8d8('0xa')](),controller[_0xe8d8('0x10')]);router[_0xe8d8('0xc')](_0xe8d8('0x11'),auth['isAuthenticated'](),controller[_0xe8d8('0x12')]);router[_0xe8d8('0x13')]('/',auth[_0xe8d8('0xa')](),controller[_0xe8d8('0x14')]);router[_0xe8d8('0x15')]('/:id',auth[_0xe8d8('0xa')](),controller[_0xe8d8('0x16')]);router['delete'](_0xe8d8('0xd'),auth[_0xe8d8('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6888=['/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0x6888,0x146));var _0x8688=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x6888[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0x8688('0x0'));var util=require(_0x8688('0x1'));var path=require(_0x8688('0x2'));var timeout=require(_0x8688('0x3'));var express=require(_0x8688('0x4'));var router=express[_0x8688('0x5')]();var fs_extra=require(_0x8688('0x6'));var auth=require(_0x8688('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8688('0x8'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth[_0x8688('0x9')](),controller[_0x8688('0xa')]);router[_0x8688('0xb')](_0x8688('0xc'),auth[_0x8688('0x9')](),controller[_0x8688('0xd')]);router['get'](_0x8688('0xe'),auth[_0x8688('0x9')](),controller[_0x8688('0xf')]);router[_0x8688('0xb')](_0x8688('0x10'),auth[_0x8688('0x9')](),controller[_0x8688('0x11')]);router['get'](_0x8688('0x12'),auth[_0x8688('0x9')](),controller[_0x8688('0x13')]);router['post']('/',auth[_0x8688('0x9')](),controller[_0x8688('0x14')]);router[_0x8688('0x15')](_0x8688('0xc'),auth['isAuthenticated'](),controller[_0x8688('0x16')]);router[_0x8688('0x17')](_0x8688('0xc'),auth[_0x8688('0x9')](),controller[_0x8688('0x18')]);module[_0x8688('0x19')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 36c50a4..994360e 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 _0x2492=['csv','pdf','xlsx','DATE','Loading','scheduled','manual','INTEGER','moment','exports','STRING','ENUM'];(function(_0x3f9215,_0x4690f2){var _0x5a2a89=function(_0x187021){while(--_0x187021){_0x3f9215['push'](_0x3f9215['shift']());}};_0x5a2a89(++_0x4690f2);}(_0x2492,0x1e8));var _0x2249=function(_0x53439d,_0x556850){_0x53439d=_0x53439d-0x0;var _0xefd77b=_0x2492[_0x53439d];return _0xefd77b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2249('0x0'));module[_0x2249('0x1')]={'name':{'type':Sequelize[_0x2249('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x2249('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x2249('0x3')](_0x2249('0x4'),_0x2249('0x5'),_0x2249('0x6')),'allowNull':![],'defaultValue':_0x2249('0x4')},'savename':{'type':Sequelize[_0x2249('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x2249('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x2249('0x2')],'defaultValue':_0x2249('0x8')},'type':{'type':Sequelize[_0x2249('0x3')]('manual',_0x2249('0x9')),'allowNull':![],'defaultValue':_0x2249('0xa')},'reportId':{'type':Sequelize[_0x2249('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa8a6=['sequelize','moment','STRING','ENUM','csv','pdf','DATE','Loading','manual','scheduled','UNSIGNED'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa8a6,0x1c3));var _0x6a8a=function(_0xdfb99b,_0x11c085){_0xdfb99b=_0xdfb99b-0x0;var _0x67dd87=_0xa8a6[_0xdfb99b];return _0x67dd87;};'use strict';var Sequelize=require(_0x6a8a('0x0'));var moment=require(_0x6a8a('0x1'));module['exports']={'name':{'type':Sequelize[_0x6a8a('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x6a8a('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x6a8a('0x3')](_0x6a8a('0x4'),_0x6a8a('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x6a8a('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x6a8a('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x6a8a('0x2')],'defaultValue':_0x6a8a('0x7')},'type':{'type':Sequelize[_0x6a8a('0x3')](_0x6a8a('0x8'),_0x6a8a('0x9')),'allowNull':![],'defaultValue':_0x6a8a('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x6a8a('0xa')]},'reportType':{'type':Sequelize[_0x6a8a('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 69fafd6..3ffd889 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 _0xf920=['filter','merge','includeAll','include','findAll','catch','show','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','download','basename','savename','output','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick'];(function(_0x22d36b,_0x1a2358){var _0x4e4f7a=function(_0x43dddd){while(--_0x43dddd){_0x22d36b['push'](_0x22d36b['shift']());}};_0x4e4f7a(++_0x1a2358);}(_0xf920,0x125));var _0x0f92=function(_0x3a24b8,_0x1b7651){_0x3a24b8=_0x3a24b8-0x0;var _0x502dd8=_0xf920[_0x3a24b8];return _0x502dd8;};'use strict';var emlformat=require(_0x0f92('0x0'));var rimraf=require(_0x0f92('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0f92('0x2'));var rp=require(_0x0f92('0x3'));var moment=require('moment');var BPromise=require(_0x0f92('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0f92('0x5'));var sox=require(_0x0f92('0x6'));var csv=require('to-csv');var ejs=require(_0x0f92('0x7'));var fs=require('fs');var fs_extra=require(_0x0f92('0x8'));var _=require('lodash');var squel=require(_0x0f92('0x9'));var crypto=require('crypto');var jsforce=require(_0x0f92('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0f92('0xb'));var Papa=require(_0x0f92('0xc'));var Redis=require(_0x0f92('0xd'));var authService=require(_0x0f92('0xe'));var qs=require(_0x0f92('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f92('0x10'));var logger=require(_0x0f92('0x11'))('api');var utils=require(_0x0f92('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0f92('0x13'));var db=require(_0x0f92('0x14'))['db'];function respondWithStatusCode(_0x3b9f17,_0x4b26cc){_0x4b26cc=_0x4b26cc||0xcc;return function(_0x193e6c){if(_0x193e6c){return _0x3b9f17[_0x0f92('0x15')](_0x4b26cc);}return _0x3b9f17[_0x0f92('0x16')](_0x4b26cc)[_0x0f92('0x17')]();};}function respondWithResult(_0x3e4915,_0x736667){_0x736667=_0x736667||0xc8;return function(_0x36563e){if(_0x36563e){return _0x3e4915[_0x0f92('0x16')](_0x736667)[_0x0f92('0x18')](_0x36563e);}};}function respondWithFilteredResult(_0x34b509,_0xd1d248){return function(_0x324c9f){if(_0x324c9f){var _0x51dbbd=typeof _0xd1d248[_0x0f92('0x19')]===_0x0f92('0x1a')&&typeof _0xd1d248[_0x0f92('0x1b')]===_0x0f92('0x1a');var _0x5861af=_0x324c9f['count'];var _0x291252=_0x51dbbd?0x0:_0xd1d248[_0x0f92('0x19')];var _0x3c8158=_0x51dbbd?_0x324c9f[_0x0f92('0x1c')]:_0xd1d248['offset']+_0xd1d248['limit'];var _0x225b68;if(_0x3c8158>=_0x5861af){_0x3c8158=_0x5861af;_0x225b68=0xc8;}else{_0x225b68=0xce;}_0x34b509[_0x0f92('0x16')](_0x225b68);return _0x34b509[_0x0f92('0x1d')]('Content-Range',_0x291252+'-'+_0x3c8158+'/'+_0x5861af)[_0x0f92('0x18')](_0x324c9f);}return null;};}function patchUpdates(_0x5d3c3f){return function(_0x26f37e){try{jsonpatch[_0x0f92('0x1e')](_0x26f37e,_0x5d3c3f,!![]);}catch(_0x28a2e8){return BPromise[_0x0f92('0x1f')](_0x28a2e8);}return _0x26f37e[_0x0f92('0x20')]();};}function saveUpdates(_0x197a2f,_0xa3332){return function(_0x400900){if(_0x400900){return _0x400900[_0x0f92('0x21')](_0x197a2f)[_0x0f92('0x22')](function(_0x28749f){return _0x28749f;});}return null;};}function removeEntity(_0x28bfab,_0x4502cb){return function(_0x469fe1){if(_0x469fe1){return _0x469fe1[_0x0f92('0x23')]()[_0x0f92('0x22')](function(){var _0x14ccd0=_0x469fe1['get']({'plain':!![]});var _0x1e4f1b=_0x0f92('0x24');return db[_0x0f92('0x25')][_0x0f92('0x23')]({'where':{'type':_0x1e4f1b,'resourceId':_0x14ccd0['id']}})[_0x0f92('0x22')](function(){return _0x469fe1;});})['then'](function(){_0x28bfab[_0x0f92('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3551f8,_0x10ad43){return function(_0x235d8c){if(!_0x235d8c){_0x3551f8[_0x0f92('0x15')](0x194);}return _0x235d8c;};}function handleError(_0x18c52f,_0x940d45){_0x940d45=_0x940d45||0x1f4;return function(_0x4c5cf9){logger[_0x0f92('0x26')](_0x4c5cf9[_0x0f92('0x27')]);if(_0x4c5cf9[_0x0f92('0x28')]){delete _0x4c5cf9[_0x0f92('0x28')];}_0x18c52f[_0x0f92('0x16')](_0x940d45)[_0x0f92('0x29')](_0x4c5cf9);};}exports[_0x0f92('0x2a')]=function(_0x597991,_0x3f0032){var _0x311398={},_0x104086={},_0x3e8ea1={'count':0x0,'rows':[]};var _0x20ef55=_[_0x0f92('0x2b')](db[_0x0f92('0x2c')]['rawAttributes'],function(_0x228ce4){return{'name':_0x228ce4[_0x0f92('0x2d')],'type':_0x228ce4['type'][_0x0f92('0x2e')]};});_0x104086[_0x0f92('0x2f')]=_[_0x0f92('0x2b')](_0x20ef55,_0x0f92('0x28'));_0x104086[_0x0f92('0x30')]=_[_0x0f92('0x31')](_0x597991[_0x0f92('0x30')]);_0x104086['filters']=_[_0x0f92('0x32')](_0x104086[_0x0f92('0x2f')],_0x104086[_0x0f92('0x30')]);_0x311398[_0x0f92('0x33')]=_[_0x0f92('0x32')](_0x104086[_0x0f92('0x2f')],qs[_0x0f92('0x34')](_0x597991[_0x0f92('0x30')][_0x0f92('0x34')]));_0x311398['attributes']=_0x311398[_0x0f92('0x33')][_0x0f92('0x35')]?_0x311398[_0x0f92('0x33')]:_0x104086[_0x0f92('0x2f')];if(!_0x597991[_0x0f92('0x30')][_0x0f92('0x36')]('nolimit')){_0x311398[_0x0f92('0x1b')]=qs[_0x0f92('0x1b')](_0x597991[_0x0f92('0x30')][_0x0f92('0x1b')]);_0x311398[_0x0f92('0x19')]=qs[_0x0f92('0x19')](_0x597991[_0x0f92('0x30')][_0x0f92('0x19')]);}_0x311398['order']=qs[_0x0f92('0x37')](_0x597991[_0x0f92('0x30')][_0x0f92('0x37')]);_0x311398[_0x0f92('0x38')]=qs[_0x0f92('0x39')](_[_0x0f92('0x3a')](_0x597991[_0x0f92('0x30')],_0x104086[_0x0f92('0x39')]),_0x20ef55);if(_0x597991[_0x0f92('0x30')][_0x0f92('0x3b')]){_0x311398[_0x0f92('0x38')]=_['merge'](_0x311398[_0x0f92('0x38')],{'$or':_[_0x0f92('0x2b')](_0x20ef55,function(_0x15e329){if(_0x15e329['type']!=='VIRTUAL'){var _0x13f7e2={};_0x13f7e2[_0x15e329[_0x0f92('0x28')]]={'$like':'%'+_0x597991[_0x0f92('0x30')][_0x0f92('0x3b')]+'%'};return _0x13f7e2;}})});}_0x311398=_[_0x0f92('0x3c')]({},_0x311398,_0x597991['options']);var _0x94f560={'where':_0x311398[_0x0f92('0x38')]};return db['AnalyticExtractedReport']['count'](_0x94f560)['then'](function(_0x3835c3){_0x3e8ea1[_0x0f92('0x1c')]=_0x3835c3;if(_0x597991[_0x0f92('0x30')][_0x0f92('0x3d')]){_0x311398[_0x0f92('0x3e')]=[{'all':!![]}];}return db[_0x0f92('0x2c')][_0x0f92('0x3f')](_0x311398);})[_0x0f92('0x22')](function(_0x5c9954){_0x3e8ea1['rows']=_0x5c9954;return _0x3e8ea1;})['then'](respondWithFilteredResult(_0x3f0032,_0x311398))[_0x0f92('0x40')](handleError(_0x3f0032,null));};exports[_0x0f92('0x41')]=function(_0x1f0789,_0x2d0936){var _0x72ecf0={'raw':!![],'where':{'id':_0x1f0789[_0x0f92('0x42')]['id']}},_0x5571c8={};_0x5571c8[_0x0f92('0x2f')]=_['keys'](db['AnalyticExtractedReport']['rawAttributes']);_0x5571c8[_0x0f92('0x30')]=_[_0x0f92('0x31')](_0x1f0789[_0x0f92('0x30')]);_0x5571c8['filters']=_[_0x0f92('0x32')](_0x5571c8[_0x0f92('0x2f')],_0x5571c8[_0x0f92('0x30')]);_0x72ecf0['attributes']=_[_0x0f92('0x32')](_0x5571c8[_0x0f92('0x2f')],qs['fields'](_0x1f0789[_0x0f92('0x30')][_0x0f92('0x34')]));_0x72ecf0[_0x0f92('0x33')]=_0x72ecf0[_0x0f92('0x33')][_0x0f92('0x35')]?_0x72ecf0[_0x0f92('0x33')]:_0x5571c8[_0x0f92('0x2f')];if(_0x1f0789[_0x0f92('0x30')]['includeAll']){_0x72ecf0[_0x0f92('0x3e')]=[{'all':!![]}];}_0x72ecf0=_[_0x0f92('0x3c')]({},_0x72ecf0,_0x1f0789[_0x0f92('0x43')]);return db[_0x0f92('0x2c')][_0x0f92('0x44')](_0x72ecf0)[_0x0f92('0x22')](handleEntityNotFound(_0x2d0936,null))['then'](respondWithResult(_0x2d0936,null))['catch'](handleError(_0x2d0936,null));};exports[_0x0f92('0x45')]=function(_0x4a84ad,_0x27c26e){return db[_0x0f92('0x2c')][_0x0f92('0x45')](_0x4a84ad[_0x0f92('0x46')],{})[_0x0f92('0x22')](function(_0x31905b){var _0x3906eb=_0x4a84ad[_0x0f92('0x47')][_0x0f92('0x48')]({'plain':!![]});if(!_0x3906eb)throw new Error(_0x0f92('0x49'));if(_0x3906eb['role']===_0x0f92('0x47')){var _0x2fdb34=_0x31905b['get']({'plain':!![]});var _0x139fdf='ExtractedReports';return db[_0x0f92('0x4a')][_0x0f92('0x44')]({'where':{'name':_0x139fdf,'userProfileId':_0x3906eb['userProfileId']},'raw':!![]})['then'](function(_0x1f6cfc){if(_0x1f6cfc&&_0x1f6cfc[_0x0f92('0x4b')]===0x0){return db['UserProfileResource'][_0x0f92('0x45')]({'name':_0x2fdb34[_0x0f92('0x28')],'resourceId':_0x2fdb34['id'],'type':_0x1f6cfc[_0x0f92('0x28')],'sectionId':_0x1f6cfc['id']},{})[_0x0f92('0x22')](function(){return _0x31905b;});}else{return _0x31905b;}})[_0x0f92('0x40')](function(_0x2a83f8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a83f8);throw _0x2a83f8;});}return _0x31905b;})[_0x0f92('0x22')](respondWithResult(_0x27c26e,0xc9))[_0x0f92('0x40')](handleError(_0x27c26e,null));};exports['update']=function(_0x1976cf,_0x172f40){if(_0x1976cf[_0x0f92('0x46')]['id']){delete _0x1976cf[_0x0f92('0x46')]['id'];}return db[_0x0f92('0x2c')][_0x0f92('0x44')]({'where':{'id':_0x1976cf[_0x0f92('0x42')]['id']}})[_0x0f92('0x22')](handleEntityNotFound(_0x172f40,null))[_0x0f92('0x22')](saveUpdates(_0x1976cf['body'],null))[_0x0f92('0x22')](respondWithResult(_0x172f40,null))[_0x0f92('0x40')](handleError(_0x172f40,null));};exports[_0x0f92('0x23')]=function(_0x54acbd,_0x29b3fd){return db[_0x0f92('0x2c')][_0x0f92('0x44')]({'where':{'id':_0x54acbd[_0x0f92('0x42')]['id']}})[_0x0f92('0x22')](handleEntityNotFound(_0x29b3fd,null))[_0x0f92('0x22')](removeEntity(_0x29b3fd,null))[_0x0f92('0x40')](handleError(_0x29b3fd,null));};exports[_0x0f92('0x4c')]=function(_0x84fb1c,_0x57013d,_0x5672fd){return db[_0x0f92('0x2c')][_0x0f92('0x44')]({'where':{'id':_0x84fb1c[_0x0f92('0x42')]['id']},'attributes':[_0x0f92('0x28'),_0x0f92('0x4d'),_0x0f92('0x4e'),_0x0f92('0x4f')],'raw':!![]})[_0x0f92('0x22')](handleEntityNotFound(_0x57013d,null))[_0x0f92('0x22')](function(_0x2eda06){if(_0x2eda06){if(!fs['existsSync'](path[_0x0f92('0x50')](config[_0x0f92('0x51')],_0x0f92('0x52'),_0x2eda06[_0x0f92('0x4e')]))){throw new db[(_0x0f92('0x53'))][(_0x0f92('0x54'))](_0x0f92('0x55'));}if(_0x84fb1c[_0x0f92('0x30')][_0x0f92('0x56')]){return _0x57013d['sendStatus'](0xc8);}return _0x57013d['download'](path[_0x0f92('0x50')](config[_0x0f92('0x51')],_0x0f92('0x52'),_0x2eda06[_0x0f92('0x4e')]),util['format'](_0x0f92('0x57'),_0x2eda06['basename']||_0x2eda06['name'],_0x2eda06[_0x0f92('0x4f')]['toLowerCase']()));}})[_0x0f92('0x40')](handleError(_0x57013d,null));}; \ No newline at end of file +var _0xc264=['bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','ExtractedReports','UserProfileResource','name','map','AnalyticExtractedReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','role','user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','basename','savename','output','join','root','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','download','format','%s.%s','toLowerCase','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x336c8b,_0x56b55b){var _0x4dd2f6=function(_0x169a0f){while(--_0x169a0f){_0x336c8b['push'](_0x336c8b['shift']());}};_0x4dd2f6(++_0x56b55b);}(_0xc264,0x16c));var _0x4c26=function(_0x18e52b,_0x1fae35){_0x18e52b=_0x18e52b-0x0;var _0x3d3062=_0xc264[_0x18e52b];return _0x3d3062;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4c26('0x0'));var zipdir=require(_0x4c26('0x1'));var jsonpatch=require(_0x4c26('0x2'));var rp=require(_0x4c26('0x3'));var moment=require('moment');var BPromise=require(_0x4c26('0x4'));var Mustache=require(_0x4c26('0x5'));var util=require(_0x4c26('0x6'));var path=require(_0x4c26('0x7'));var sox=require('sox');var csv=require(_0x4c26('0x8'));var ejs=require(_0x4c26('0x9'));var fs=require('fs');var fs_extra=require(_0x4c26('0xa'));var _=require(_0x4c26('0xb'));var squel=require(_0x4c26('0xc'));var crypto=require(_0x4c26('0xd'));var jsforce=require(_0x4c26('0xe'));var deskjs=require(_0x4c26('0xf'));var toCsv=require(_0x4c26('0x8'));var querystring=require(_0x4c26('0x10'));var Papa=require('papaparse');var Redis=require(_0x4c26('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4c26('0x12'));var hardwareService=require(_0x4c26('0x13'));var logger=require(_0x4c26('0x14'))(_0x4c26('0x15'));var utils=require(_0x4c26('0x16'));var config=require(_0x4c26('0x17'));var licenseUtil=require(_0x4c26('0x18'));var db=require(_0x4c26('0x19'))['db'];function respondWithStatusCode(_0x4f361b,_0xff68e4){_0xff68e4=_0xff68e4||0xcc;return function(_0x112e6d){if(_0x112e6d){return _0x4f361b[_0x4c26('0x1a')](_0xff68e4);}return _0x4f361b[_0x4c26('0x1b')](_0xff68e4)[_0x4c26('0x1c')]();};}function respondWithResult(_0x520096,_0xfa0ab3){_0xfa0ab3=_0xfa0ab3||0xc8;return function(_0x6d5208){if(_0x6d5208){return _0x520096[_0x4c26('0x1b')](_0xfa0ab3)[_0x4c26('0x1d')](_0x6d5208);}};}function respondWithFilteredResult(_0x3c060b,_0x57747b){return function(_0x49183e){if(_0x49183e){var _0x96d797=typeof _0x57747b[_0x4c26('0x1e')]===_0x4c26('0x1f')&&typeof _0x57747b[_0x4c26('0x20')]==='undefined';var _0x147ea3=_0x49183e[_0x4c26('0x21')];var _0x549a8a=_0x96d797?0x0:_0x57747b[_0x4c26('0x1e')];var _0x255c54=_0x96d797?_0x49183e[_0x4c26('0x21')]:_0x57747b[_0x4c26('0x1e')]+_0x57747b[_0x4c26('0x20')];var _0x386722;if(_0x255c54>=_0x147ea3){_0x255c54=_0x147ea3;_0x386722=0xc8;}else{_0x386722=0xce;}_0x3c060b[_0x4c26('0x1b')](_0x386722);return _0x3c060b[_0x4c26('0x22')](_0x4c26('0x23'),_0x549a8a+'-'+_0x255c54+'/'+_0x147ea3)[_0x4c26('0x1d')](_0x49183e);}return null;};}function patchUpdates(_0x4098df){return function(_0x421dec){try{jsonpatch[_0x4c26('0x24')](_0x421dec,_0x4098df,!![]);}catch(_0x1993b6){return BPromise['reject'](_0x1993b6);}return _0x421dec[_0x4c26('0x25')]();};}function saveUpdates(_0x177e65,_0x3e70fa){return function(_0x4df47a){if(_0x4df47a){return _0x4df47a[_0x4c26('0x26')](_0x177e65)[_0x4c26('0x27')](function(_0x443a4f){return _0x443a4f;});}return null;};}function removeEntity(_0x7fc7e1,_0x4ac61f){return function(_0x22c441){if(_0x22c441){return _0x22c441[_0x4c26('0x28')]()['then'](function(){var _0x4282bb=_0x22c441['get']({'plain':!![]});var _0x5519a6=_0x4c26('0x29');return db[_0x4c26('0x2a')]['destroy']({'where':{'type':_0x5519a6,'resourceId':_0x4282bb['id']}})[_0x4c26('0x27')](function(){return _0x22c441;});})[_0x4c26('0x27')](function(){_0x7fc7e1[_0x4c26('0x1b')](0xcc)[_0x4c26('0x1c')]();});}};}function handleEntityNotFound(_0x2c7027,_0x2de833){return function(_0x14016b){if(!_0x14016b){_0x2c7027['sendStatus'](0x194);}return _0x14016b;};}function handleError(_0x5ea9a7,_0x4e453f){_0x4e453f=_0x4e453f||0x1f4;return function(_0x3995e6){logger['error'](_0x3995e6['stack']);if(_0x3995e6[_0x4c26('0x2b')]){delete _0x3995e6['name'];}_0x5ea9a7[_0x4c26('0x1b')](_0x4e453f)['send'](_0x3995e6);};}exports['index']=function(_0x26cbe5,_0x755346){var _0x4f30ec={},_0x180273={},_0x661912={'count':0x0,'rows':[]};var _0x36eada=_[_0x4c26('0x2c')](db[_0x4c26('0x2d')]['rawAttributes'],function(_0x41bb7f){return{'name':_0x41bb7f[_0x4c26('0x2e')],'type':_0x41bb7f[_0x4c26('0x2f')]['key']};});_0x180273[_0x4c26('0x30')]=_[_0x4c26('0x2c')](_0x36eada,_0x4c26('0x2b'));_0x180273[_0x4c26('0x31')]=_[_0x4c26('0x32')](_0x26cbe5[_0x4c26('0x31')]);_0x180273[_0x4c26('0x33')]=_[_0x4c26('0x34')](_0x180273['model'],_0x180273[_0x4c26('0x31')]);_0x4f30ec[_0x4c26('0x35')]=_[_0x4c26('0x34')](_0x180273[_0x4c26('0x30')],qs[_0x4c26('0x36')](_0x26cbe5['query'][_0x4c26('0x36')]));_0x4f30ec['attributes']=_0x4f30ec[_0x4c26('0x35')][_0x4c26('0x37')]?_0x4f30ec['attributes']:_0x180273['model'];if(!_0x26cbe5[_0x4c26('0x31')]['hasOwnProperty'](_0x4c26('0x38'))){_0x4f30ec[_0x4c26('0x20')]=qs[_0x4c26('0x20')](_0x26cbe5['query']['limit']);_0x4f30ec['offset']=qs[_0x4c26('0x1e')](_0x26cbe5[_0x4c26('0x31')][_0x4c26('0x1e')]);}_0x4f30ec[_0x4c26('0x39')]=qs[_0x4c26('0x3a')](_0x26cbe5[_0x4c26('0x31')][_0x4c26('0x3a')]);_0x4f30ec[_0x4c26('0x3b')]=qs[_0x4c26('0x33')](_['pick'](_0x26cbe5['query'],_0x180273[_0x4c26('0x33')]),_0x36eada);if(_0x26cbe5[_0x4c26('0x31')][_0x4c26('0x3c')]){_0x4f30ec['where']=_[_0x4c26('0x3d')](_0x4f30ec['where'],{'$or':_[_0x4c26('0x2c')](_0x36eada,function(_0x4534c6){if(_0x4534c6[_0x4c26('0x2f')]!==_0x4c26('0x3e')){var _0x143fc5={};_0x143fc5[_0x4534c6[_0x4c26('0x2b')]]={'$like':'%'+_0x26cbe5['query'][_0x4c26('0x3c')]+'%'};return _0x143fc5;}})});}_0x4f30ec=_['merge']({},_0x4f30ec,_0x26cbe5['options']);var _0x31a962={'where':_0x4f30ec['where']};return db['AnalyticExtractedReport'][_0x4c26('0x21')](_0x31a962)[_0x4c26('0x27')](function(_0x52ee44){_0x661912[_0x4c26('0x21')]=_0x52ee44;if(_0x26cbe5[_0x4c26('0x31')][_0x4c26('0x3f')]){_0x4f30ec[_0x4c26('0x40')]=[{'all':!![]}];}return db[_0x4c26('0x2d')][_0x4c26('0x41')](_0x4f30ec);})['then'](function(_0x2dfb84){_0x661912[_0x4c26('0x42')]=_0x2dfb84;return _0x661912;})[_0x4c26('0x27')](respondWithFilteredResult(_0x755346,_0x4f30ec))[_0x4c26('0x43')](handleError(_0x755346,null));};exports[_0x4c26('0x44')]=function(_0x70f814,_0x155061){var _0x5ab83d={'raw':!![],'where':{'id':_0x70f814[_0x4c26('0x45')]['id']}},_0x37d666={};_0x37d666[_0x4c26('0x30')]=_['keys'](db[_0x4c26('0x2d')]['rawAttributes']);_0x37d666['query']=_[_0x4c26('0x32')](_0x70f814[_0x4c26('0x31')]);_0x37d666[_0x4c26('0x33')]=_[_0x4c26('0x34')](_0x37d666[_0x4c26('0x30')],_0x37d666[_0x4c26('0x31')]);_0x5ab83d[_0x4c26('0x35')]=_[_0x4c26('0x34')](_0x37d666['model'],qs[_0x4c26('0x36')](_0x70f814[_0x4c26('0x31')][_0x4c26('0x36')]));_0x5ab83d[_0x4c26('0x35')]=_0x5ab83d[_0x4c26('0x35')]['length']?_0x5ab83d['attributes']:_0x37d666[_0x4c26('0x30')];if(_0x70f814['query']['includeAll']){_0x5ab83d[_0x4c26('0x40')]=[{'all':!![]}];}_0x5ab83d=_[_0x4c26('0x3d')]({},_0x5ab83d,_0x70f814[_0x4c26('0x46')]);return db['AnalyticExtractedReport']['find'](_0x5ab83d)['then'](handleEntityNotFound(_0x155061,null))[_0x4c26('0x27')](respondWithResult(_0x155061,null))[_0x4c26('0x43')](handleError(_0x155061,null));};exports[_0x4c26('0x47')]=function(_0x5cbb21,_0xcd6312){return db['AnalyticExtractedReport']['create'](_0x5cbb21[_0x4c26('0x48')],{})[_0x4c26('0x27')](function(_0x49c894){var _0x46ec51=_0x5cbb21['user']['get']({'plain':!![]});if(!_0x46ec51)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46ec51[_0x4c26('0x49')]===_0x4c26('0x4a')){var _0x427145=_0x49c894[_0x4c26('0x4b')]({'plain':!![]});var _0x4c8f71='ExtractedReports';return db['UserProfileSection']['find']({'where':{'name':_0x4c8f71,'userProfileId':_0x46ec51[_0x4c26('0x4c')]},'raw':!![]})[_0x4c26('0x27')](function(_0x155f58){if(_0x155f58&&_0x155f58[_0x4c26('0x4d')]===0x0){return db[_0x4c26('0x2a')]['create']({'name':_0x427145['name'],'resourceId':_0x427145['id'],'type':_0x155f58[_0x4c26('0x2b')],'sectionId':_0x155f58['id']},{})[_0x4c26('0x27')](function(){return _0x49c894;});}else{return _0x49c894;}})[_0x4c26('0x43')](function(_0x4dd310){logger['error'](_0x4c26('0x4e'),_0x4dd310);throw _0x4dd310;});}return _0x49c894;})['then'](respondWithResult(_0xcd6312,0xc9))[_0x4c26('0x43')](handleError(_0xcd6312,null));};exports[_0x4c26('0x26')]=function(_0x151d52,_0x3fdd60){if(_0x151d52[_0x4c26('0x48')]['id']){delete _0x151d52[_0x4c26('0x48')]['id'];}return db[_0x4c26('0x2d')]['find']({'where':{'id':_0x151d52['params']['id']}})['then'](handleEntityNotFound(_0x3fdd60,null))['then'](saveUpdates(_0x151d52['body'],null))[_0x4c26('0x27')](respondWithResult(_0x3fdd60,null))[_0x4c26('0x43')](handleError(_0x3fdd60,null));};exports[_0x4c26('0x28')]=function(_0x25835f,_0x1b0dec){return db[_0x4c26('0x2d')]['find']({'where':{'id':_0x25835f['params']['id']}})[_0x4c26('0x27')](handleEntityNotFound(_0x1b0dec,null))['then'](removeEntity(_0x1b0dec,null))['catch'](handleError(_0x1b0dec,null));};exports['download']=function(_0x54c2d8,_0x91984f,_0x3c01aa){return db['AnalyticExtractedReport'][_0x4c26('0x4f')]({'where':{'id':_0x54c2d8['params']['id']},'attributes':[_0x4c26('0x2b'),_0x4c26('0x50'),_0x4c26('0x51'),_0x4c26('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x91984f,null))['then'](function(_0x50f629){if(_0x50f629){if(!fs['existsSync'](path[_0x4c26('0x53')](config[_0x4c26('0x54')],'server/files/reports',_0x50f629[_0x4c26('0x51')]))){throw new db[(_0x4c26('0x55'))]['ValidationError'](_0x4c26('0x56'));}if(_0x54c2d8[_0x4c26('0x31')][_0x4c26('0x57')]){return _0x91984f[_0x4c26('0x1a')](0xc8);}return _0x91984f[_0x4c26('0x58')](path['join'](config[_0x4c26('0x54')],'server/files/reports',_0x50f629[_0x4c26('0x51')]),util[_0x4c26('0x59')](_0x4c26('0x5a'),_0x50f629[_0x4c26('0x50')]||_0x50f629[_0x4c26('0x2b')],_0x50f629[_0x4c26('0x52')][_0x4c26('0x5b')]()));}})[_0x4c26('0x43')](handleError(_0x91984f,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index c9b7b58..9b7396b 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 _0x6e96=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x4f9939,_0x56fa3b){var _0x5e8326=function(_0x46752d){while(--_0x46752d){_0x4f9939['push'](_0x4f9939['shift']());}};_0x5e8326(++_0x56fa3b);}(_0x6e96,0x15e));var _0x66e9=function(_0x1eca8f,_0x118d68){_0x1eca8f=_0x1eca8f-0x0;var _0x3701ce=_0x6e96[_0x1eca8f];return _0x3701ce;};'use strict';var _=require('lodash');var util=require(_0x66e9('0x0'));var logger=require(_0x66e9('0x1'))(_0x66e9('0x2'));var moment=require(_0x66e9('0x3'));var BPromise=require(_0x66e9('0x4'));var rp=require(_0x66e9('0x5'));var fs=require('fs');var path=require(_0x66e9('0x6'));var rimraf=require(_0x66e9('0x7'));var config=require(_0x66e9('0x8'));var attributes=require(_0x66e9('0x9'));module[_0x66e9('0xa')]=function(_0x16ebfa,_0x4bca55){return _0x16ebfa[_0x66e9('0xb')](_0x66e9('0xc'),attributes,{'tableName':_0x66e9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0833=['path','rimraf','../../config/environment','./analyticExtractedReport.attributes','AnalyticExtractedReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3d829d,_0x324003){var _0x52bfbd=function(_0xcea689){while(--_0xcea689){_0x3d829d['push'](_0x3d829d['shift']());}};_0x52bfbd(++_0x324003);}(_0x0833,0x161));var _0x3083=function(_0x240653,_0x4192c7){_0x240653=_0x240653-0x0;var _0x7e99c2=_0x0833[_0x240653];return _0x7e99c2;};'use strict';var _=require(_0x3083('0x0'));var util=require(_0x3083('0x1'));var logger=require(_0x3083('0x2'))(_0x3083('0x3'));var moment=require(_0x3083('0x4'));var BPromise=require(_0x3083('0x5'));var rp=require(_0x3083('0x6'));var fs=require('fs');var path=require(_0x3083('0x7'));var rimraf=require(_0x3083('0x8'));var config=require(_0x3083('0x9'));var attributes=require(_0x3083('0xa'));module['exports']=function(_0x9cd568,_0x5f3605){return _0x9cd568['define'](_0x3083('0xb'),attributes,{'tableName':'analytics_extracted_reports','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 903b48f..6553aa5 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 _0x0f8e=['info','debug','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then'];(function(_0x131b66,_0x54f2b9){var _0xea6fe4=function(_0x2a020e){while(--_0x2a020e){_0x131b66['push'](_0x131b66['shift']());}};_0xea6fe4(++_0x54f2b9);}(_0x0f8e,0x7a));var _0xe0f8=function(_0x5bcdb9,_0x2bef44){_0x5bcdb9=_0x5bcdb9-0x0;var _0x4f0dda=_0x0f8e[_0x5bcdb9];return _0x4f0dda;};'use strict';var _=require('lodash');var util=require(_0xe0f8('0x0'));var moment=require(_0xe0f8('0x1'));var BPromise=require(_0xe0f8('0x2'));var rs=require(_0xe0f8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe0f8('0x4'))['db'];var utils=require(_0xe0f8('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe0f8('0x6'));var client=jayson[_0xe0f8('0x7')][_0xe0f8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46a28f,_0x560534,_0x13a816){return new BPromise(function(_0x5938b7,_0x6ce02d){return client[_0xe0f8('0x9')](_0x46a28f,_0x13a816)[_0xe0f8('0xa')](function(_0x375013){logger[_0xe0f8('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x560534,'request\x20sent');logger[_0xe0f8('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x560534,'request\x20sent',JSON[_0xe0f8('0xd')](_0x375013));if(_0x375013['error']){if(_0x375013[_0xe0f8('0xe')]['code']===0x1f4){logger['error'](_0xe0f8('0xf'),_0x560534,_0x375013[_0xe0f8('0xe')][_0xe0f8('0x10')]);return _0x6ce02d(_0x375013[_0xe0f8('0xe')][_0xe0f8('0x10')]);}logger[_0xe0f8('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x560534,_0x375013[_0xe0f8('0xe')][_0xe0f8('0x10')]);return _0x5938b7(_0x375013['error'][_0xe0f8('0x10')]);}else{logger[_0xe0f8('0xb')](_0xe0f8('0xf'),_0x560534,'request\x20sent');_0x5938b7(_0x375013[_0xe0f8('0x11')][_0xe0f8('0x10')]);}})[_0xe0f8('0x12')](function(_0xa07f64){logger[_0xe0f8('0xe')](_0xe0f8('0xf'),_0x560534,_0xa07f64);_0x6ce02d(_0xa07f64);});});} \ No newline at end of file +var _0x3e23=['request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request'];(function(_0x1bfb22,_0x11bf71){var _0x52c53c=function(_0x16152e){while(--_0x16152e){_0x1bfb22['push'](_0x1bfb22['shift']());}};_0x52c53c(++_0x11bf71);}(_0x3e23,0x9c));var _0x33e2=function(_0x413727,_0x17adb1){_0x413727=_0x413727-0x0;var _0x5f46d7=_0x3e23[_0x413727];return _0x5f46d7;};'use strict';var _=require(_0x33e2('0x0'));var util=require(_0x33e2('0x1'));var moment=require(_0x33e2('0x2'));var BPromise=require('bluebird');var rs=require(_0x33e2('0x3'));var fs=require('fs');var Redis=require(_0x33e2('0x4'));var db=require(_0x33e2('0x5'))['db'];var utils=require(_0x33e2('0x6'));var logger=require('../../config/logger')(_0x33e2('0x7'));var config=require(_0x33e2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x33e2('0x9')][_0x33e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42e6a0,_0x5da45c,_0x21501f){return new BPromise(function(_0x567392,_0x35ff3a){return client[_0x33e2('0xb')](_0x42e6a0,_0x21501f)['then'](function(_0x58fda9){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x5da45c,_0x33e2('0xc'));logger[_0x33e2('0xd')](_0x33e2('0xe'),_0x5da45c,'request\x20sent',JSON[_0x33e2('0xf')](_0x58fda9));if(_0x58fda9[_0x33e2('0x10')]){if(_0x58fda9[_0x33e2('0x10')]['code']===0x1f4){logger[_0x33e2('0x10')](_0x33e2('0x11'),_0x5da45c,_0x58fda9[_0x33e2('0x10')][_0x33e2('0x12')]);return _0x35ff3a(_0x58fda9[_0x33e2('0x10')][_0x33e2('0x12')]);}logger[_0x33e2('0x10')](_0x33e2('0x11'),_0x5da45c,_0x58fda9[_0x33e2('0x10')][_0x33e2('0x12')]);return _0x567392(_0x58fda9[_0x33e2('0x10')][_0x33e2('0x12')]);}else{logger['info'](_0x33e2('0x11'),_0x5da45c,_0x33e2('0xc'));_0x567392(_0x58fda9[_0x33e2('0x13')][_0x33e2('0x12')]);}})[_0x33e2('0x14')](function(_0x1fa7b5){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x5da45c,_0x1fa7b5);_0x35ff3a(_0x1fa7b5);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index b994581..190290f 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 _0x8665=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id','/:id/download','download','post','create','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x1ee7ef,_0x3a7b95){var _0x3203f1=function(_0x94c74d){while(--_0x94c74d){_0x1ee7ef['push'](_0x1ee7ef['shift']());}};_0x3203f1(++_0x3a7b95);}(_0x8665,0x175));var _0x5866=function(_0x3ce3d0,_0x597f99){_0x3ce3d0=_0x3ce3d0-0x0;var _0x23cbe9=_0x8665[_0x3ce3d0];return _0x23cbe9;};'use strict';var multer=require(_0x5866('0x0'));var util=require(_0x5866('0x1'));var path=require(_0x5866('0x2'));var timeout=require(_0x5866('0x3'));var express=require(_0x5866('0x4'));var router=express[_0x5866('0x5')]();var fs_extra=require(_0x5866('0x6'));var auth=require(_0x5866('0x7'));var interaction=require(_0x5866('0x8'));var config=require(_0x5866('0x9'));var controller=require(_0x5866('0xa'));router[_0x5866('0xb')]('/',auth[_0x5866('0xc')](),controller['index']);router['get'](_0x5866('0xd'),auth[_0x5866('0xc')](),controller['show']);router['get'](_0x5866('0xe'),auth[_0x5866('0xc')](),controller[_0x5866('0xf')]);router[_0x5866('0x10')]('/',auth[_0x5866('0xc')](),controller[_0x5866('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x5866('0x12')]);router[_0x5866('0x13')]('/:id',auth[_0x5866('0xc')](),controller[_0x5866('0x14')]);module['exports']=router; \ No newline at end of file +var _0x15d3=['connect-timeout','Router','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','show','/:id/download','post','create','put','/:id','update','delete','exports','util','path'];(function(_0x5c467f,_0x2f5eba){var _0x431ede=function(_0x16ba14){while(--_0x16ba14){_0x5c467f['push'](_0x5c467f['shift']());}};_0x431ede(++_0x2f5eba);}(_0x15d3,0x130));var _0x315d=function(_0x26a608,_0x5e5693){_0x26a608=_0x26a608-0x0;var _0x4271c5=_0x15d3[_0x26a608];return _0x4271c5;};'use strict';var multer=require('multer');var util=require(_0x315d('0x0'));var path=require(_0x315d('0x1'));var timeout=require(_0x315d('0x2'));var express=require('express');var router=express[_0x315d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x315d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x315d('0x5'));var controller=require(_0x315d('0x6'));router[_0x315d('0x7')]('/',auth[_0x315d('0x8')](),controller['index']);router[_0x315d('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x315d('0x9')]);router[_0x315d('0x7')](_0x315d('0xa'),auth['isAuthenticated'](),controller['download']);router[_0x315d('0xb')]('/',auth[_0x315d('0x8')](),controller[_0x315d('0xc')]);router[_0x315d('0xd')](_0x315d('0xe'),auth[_0x315d('0x8')](),controller[_0x315d('0xf')]);router[_0x315d('0x10')](_0x315d('0xe'),auth[_0x315d('0x8')](),controller['destroy']);module[_0x315d('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 61b9237..6160b22 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 _0x90cd=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x120bc2,_0x57a253){var _0x454a41=function(_0x21adfe){while(--_0x21adfe){_0x120bc2['push'](_0x120bc2['shift']());}};_0x454a41(++_0x57a253);}(_0x90cd,0xfa));var _0xd90c=function(_0x5b22fd,_0x5f706d){_0x5b22fd=_0x5b22fd-0x0;var _0xae3688=_0x90cd[_0x5b22fd];return _0xae3688;};'use strict';var Sequelize=require(_0xd90c('0x0'));module[_0xd90c('0x1')]={'field':{'type':Sequelize[_0xd90c('0x2')]},'alias':{'type':Sequelize[_0xd90c('0x3')]},'function':{'type':Sequelize[_0xd90c('0x3')]},'format':{'type':Sequelize[_0xd90c('0x3')]},'groupBy':{'type':Sequelize[_0xd90c('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xd90c('0x3')]},'custom':{'type':Sequelize[_0xd90c('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x2824=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2824,0x12a));var _0x4282=function(_0x5df1bb,_0x25d79e){_0x5df1bb=_0x5df1bb-0x0;var _0x3a98bf=_0x2824[_0x5df1bb];return _0x3a98bf;};'use strict';var Sequelize=require(_0x4282('0x0'));module['exports']={'field':{'type':Sequelize[_0x4282('0x1')]},'alias':{'type':Sequelize[_0x4282('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x4282('0x2')]},'groupBy':{'type':Sequelize[_0x4282('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x4282('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 0c07012..3b9d563 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 _0xe456=['AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','AnalyticFieldReport','rawAttributes','type','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','length','include','find','create','catch','bulkCreate','body','destroy','ids','addFields'];(function(_0x4f1f67,_0x119f0f){var _0x412cee=function(_0x37dda1){while(--_0x37dda1){_0x4f1f67['push'](_0x4f1f67['shift']());}};_0x412cee(++_0x119f0f);}(_0xe456,0xa3));var _0x6e45=function(_0x1c48cb,_0x533eeb){_0x1c48cb=_0x1c48cb-0x0;var _0x405af7=_0xe456[_0x1c48cb];return _0x405af7;};'use strict';var emlformat=require(_0x6e45('0x0'));var rimraf=require(_0x6e45('0x1'));var zipdir=require(_0x6e45('0x2'));var jsonpatch=require(_0x6e45('0x3'));var rp=require(_0x6e45('0x4'));var moment=require(_0x6e45('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6e45('0x6'));var util=require(_0x6e45('0x7'));var path=require('path');var sox=require(_0x6e45('0x8'));var csv=require(_0x6e45('0x9'));var ejs=require(_0x6e45('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6e45('0xb'));var squel=require('squel');var crypto=require(_0x6e45('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6e45('0x9'));var querystring=require(_0x6e45('0xd'));var Papa=require(_0x6e45('0xe'));var Redis=require(_0x6e45('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6e45('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6e45('0x11'));var utils=require(_0x6e45('0x12'));var config=require(_0x6e45('0x13'));var licenseUtil=require(_0x6e45('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22b34e,_0x130d79){_0x130d79=_0x130d79||0xcc;return function(_0x2640f3){if(_0x2640f3){return _0x22b34e[_0x6e45('0x15')](_0x130d79);}return _0x22b34e['status'](_0x130d79)[_0x6e45('0x16')]();};}function respondWithResult(_0x5795e0,_0x3073e8){_0x3073e8=_0x3073e8||0xc8;return function(_0x3d8434){if(_0x3d8434){return _0x5795e0[_0x6e45('0x17')](_0x3073e8)[_0x6e45('0x18')](_0x3d8434);}};}function respondWithFilteredResult(_0xc8c780,_0x503ba8){return function(_0x2131de){if(_0x2131de){var _0x17daba=typeof _0x503ba8[_0x6e45('0x19')]==='undefined'&&typeof _0x503ba8[_0x6e45('0x1a')]==='undefined';var _0x52401a=_0x2131de[_0x6e45('0x1b')];var _0x17aa9e=_0x17daba?0x0:_0x503ba8[_0x6e45('0x19')];var _0x838790=_0x17daba?_0x2131de['count']:_0x503ba8[_0x6e45('0x19')]+_0x503ba8[_0x6e45('0x1a')];var _0x28276f;if(_0x838790>=_0x52401a){_0x838790=_0x52401a;_0x28276f=0xc8;}else{_0x28276f=0xce;}_0xc8c780[_0x6e45('0x17')](_0x28276f);return _0xc8c780['set'](_0x6e45('0x1c'),_0x17aa9e+'-'+_0x838790+'/'+_0x52401a)[_0x6e45('0x18')](_0x2131de);}return null;};}function patchUpdates(_0x5b85bc){return function(_0x131986){try{jsonpatch[_0x6e45('0x1d')](_0x131986,_0x5b85bc,!![]);}catch(_0x2dc0e4){return BPromise[_0x6e45('0x1e')](_0x2dc0e4);}return _0x131986[_0x6e45('0x1f')]();};}function saveUpdates(_0x408efb,_0x18e2fd){return function(_0x2874b4){if(_0x2874b4){return _0x2874b4[_0x6e45('0x20')](_0x408efb)[_0x6e45('0x21')](function(_0x49ebc1){return _0x49ebc1;});}return null;};}function removeEntity(_0x13d3b9,_0x44d501){return function(_0x3fadee){if(_0x3fadee){return _0x3fadee['destroy']()['then'](function(){_0x13d3b9[_0x6e45('0x17')](0xcc)[_0x6e45('0x16')]();});}};}function handleEntityNotFound(_0x38fb85,_0x31de80){return function(_0x675f16){if(!_0x675f16){_0x38fb85[_0x6e45('0x15')](0x194);}return _0x675f16;};}function handleError(_0x1889c0,_0x4a55a1){_0x4a55a1=_0x4a55a1||0x1f4;return function(_0x5b3e4a){logger[_0x6e45('0x22')](_0x5b3e4a[_0x6e45('0x23')]);if(_0x5b3e4a[_0x6e45('0x24')]){delete _0x5b3e4a[_0x6e45('0x24')];}_0x1889c0[_0x6e45('0x17')](_0x4a55a1)[_0x6e45('0x25')](_0x5b3e4a);};}exports['index']=function(_0xc6b940,_0x475c2b){var _0xa27d31={},_0x550633={},_0x28009b={'count':0x0,'rows':[]};var _0x563224=_[_0x6e45('0x26')](db[_0x6e45('0x27')][_0x6e45('0x28')],function(_0xce0189){return{'name':_0xce0189['fieldName'],'type':_0xce0189[_0x6e45('0x29')]['key']};});_0x550633['model']=_[_0x6e45('0x26')](_0x563224,_0x6e45('0x24'));_0x550633[_0x6e45('0x2a')]=_[_0x6e45('0x2b')](_0xc6b940['query']);_0x550633[_0x6e45('0x2c')]=_[_0x6e45('0x2d')](_0x550633['model'],_0x550633['query']);_0xa27d31[_0x6e45('0x2e')]=_[_0x6e45('0x2d')](_0x550633[_0x6e45('0x2f')],qs['fields'](_0xc6b940[_0x6e45('0x2a')][_0x6e45('0x30')]));_0xa27d31[_0x6e45('0x2e')]=_0xa27d31['attributes']['length']?_0xa27d31[_0x6e45('0x2e')]:_0x550633[_0x6e45('0x2f')];if(!_0xc6b940[_0x6e45('0x2a')][_0x6e45('0x31')](_0x6e45('0x32'))){_0xa27d31[_0x6e45('0x1a')]=qs['limit'](_0xc6b940[_0x6e45('0x2a')][_0x6e45('0x1a')]);_0xa27d31[_0x6e45('0x19')]=qs[_0x6e45('0x19')](_0xc6b940[_0x6e45('0x2a')][_0x6e45('0x19')]);}_0xa27d31[_0x6e45('0x33')]=qs[_0x6e45('0x34')](_0xc6b940[_0x6e45('0x2a')]['sort']);_0xa27d31[_0x6e45('0x35')]=qs[_0x6e45('0x2c')](_[_0x6e45('0x36')](_0xc6b940[_0x6e45('0x2a')],_0x550633[_0x6e45('0x2c')]),_0x563224);if(_0xc6b940['query'][_0x6e45('0x37')]){_0xa27d31[_0x6e45('0x35')]=_[_0x6e45('0x38')](_0xa27d31[_0x6e45('0x35')],{'$or':_['map'](_0x563224,function(_0x2c5a6e){if(_0x2c5a6e[_0x6e45('0x29')]!==_0x6e45('0x39')){var _0x387e3f={};_0x387e3f[_0x2c5a6e[_0x6e45('0x24')]]={'$like':'%'+_0xc6b940['query'][_0x6e45('0x37')]+'%'};return _0x387e3f;}})});}_0xa27d31=_[_0x6e45('0x38')]({},_0xa27d31,_0xc6b940[_0x6e45('0x3a')]);var _0xa081f0={'where':_0xa27d31[_0x6e45('0x35')]};return db['AnalyticFieldReport'][_0x6e45('0x1b')](_0xa081f0)['then'](function(_0x28ad44){_0x28009b[_0x6e45('0x1b')]=_0x28ad44;if(_0xc6b940['query'][_0x6e45('0x3b')]){_0xa27d31['include']=[{'all':!![]}];}return db[_0x6e45('0x27')][_0x6e45('0x3c')](_0xa27d31);})['then'](function(_0x247bad){_0x28009b[_0x6e45('0x3d')]=_0x247bad;return _0x28009b;})[_0x6e45('0x21')](respondWithFilteredResult(_0x475c2b,_0xa27d31))['catch'](handleError(_0x475c2b,null));};exports[_0x6e45('0x3e')]=function(_0x555fcf,_0x5182ac){var _0x581b1b={'raw':![],'where':{'id':_0x555fcf[_0x6e45('0x3f')]['id']}},_0x17e632={};_0x17e632[_0x6e45('0x2f')]=_[_0x6e45('0x2b')](db[_0x6e45('0x27')]['rawAttributes']);_0x17e632[_0x6e45('0x2a')]=_[_0x6e45('0x2b')](_0x555fcf[_0x6e45('0x2a')]);_0x17e632[_0x6e45('0x2c')]=_['intersection'](_0x17e632[_0x6e45('0x2f')],_0x17e632[_0x6e45('0x2a')]);_0x581b1b[_0x6e45('0x2e')]=_[_0x6e45('0x2d')](_0x17e632['model'],qs['fields'](_0x555fcf['query'][_0x6e45('0x30')]));_0x581b1b[_0x6e45('0x2e')]=_0x581b1b[_0x6e45('0x2e')][_0x6e45('0x40')]?_0x581b1b[_0x6e45('0x2e')]:_0x17e632['model'];if(_0x555fcf[_0x6e45('0x2a')][_0x6e45('0x3b')]){_0x581b1b[_0x6e45('0x41')]=[{'all':!![]}];}_0x581b1b=_[_0x6e45('0x38')]({},_0x581b1b,_0x555fcf['options']);return db[_0x6e45('0x27')][_0x6e45('0x42')](_0x581b1b)[_0x6e45('0x21')](handleEntityNotFound(_0x5182ac,null))[_0x6e45('0x21')](respondWithResult(_0x5182ac,null))['catch'](handleError(_0x5182ac,null));};exports[_0x6e45('0x43')]=function(_0x56c88e,_0x48c87b){return db['AnalyticFieldReport'][_0x6e45('0x43')](_0x56c88e['body'],{})[_0x6e45('0x21')](respondWithResult(_0x48c87b,0xc9))[_0x6e45('0x44')](handleError(_0x48c87b,null));};exports[_0x6e45('0x45')]=function(_0x1e59b0,_0x6058eb){return db[_0x6e45('0x27')][_0x6e45('0x45')](_0x1e59b0['body'],{'raw':![],'individualHooks':!![]})[_0x6e45('0x21')](respondWithResult(_0x6058eb,0xc9))[_0x6e45('0x44')](handleError(_0x6058eb,null));};exports[_0x6e45('0x20')]=function(_0x17815a,_0x414a24){if(_0x17815a[_0x6e45('0x46')]['id']){delete _0x17815a[_0x6e45('0x46')]['id'];}return db[_0x6e45('0x27')][_0x6e45('0x42')]({'where':{'id':_0x17815a[_0x6e45('0x3f')]['id']}})[_0x6e45('0x21')](handleEntityNotFound(_0x414a24,null))[_0x6e45('0x21')](saveUpdates(_0x17815a[_0x6e45('0x46')],null))['then'](respondWithResult(_0x414a24,null))[_0x6e45('0x44')](handleError(_0x414a24,null));};exports[_0x6e45('0x47')]=function(_0x185aa6,_0x3053de){return db[_0x6e45('0x27')]['find']({'where':{'id':_0x185aa6[_0x6e45('0x3f')]['id']}})[_0x6e45('0x21')](handleEntityNotFound(_0x3053de,null))[_0x6e45('0x21')](removeEntity(_0x3053de,null))['catch'](handleError(_0x3053de,null));};exports['bulkDestroy']=function(_0x5b5b46,_0x15cdb7){return db[_0x6e45('0x27')]['destroy']({'where':{'id':_0x5b5b46['query'][_0x6e45('0x48')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x15cdb7,0xcc))[_0x6e45('0x44')](handleError(_0x15cdb7,null));};exports[_0x6e45('0x49')]=function(_0x590fdb,_0x11b67b,_0x580ce9){return db[_0x6e45('0x4a')][_0x6e45('0x4b')]({'where':{'id':_0x590fdb[_0x6e45('0x3f')]['id']}})['then'](handleEntityNotFound(_0x11b67b,null))[_0x6e45('0x21')](function(_0x162b6a){if(_0x162b6a){return db[_0x6e45('0x4c')][_0x6e45('0x4d')](function(_0xf23be5){return db[_0x6e45('0x27')][_0x6e45('0x47')]({'where':{'CustomReportId':_0x590fdb[_0x6e45('0x3f')]['id']},'transaction':_0xf23be5})[_0x6e45('0x21')](function(_0x2cbb05){var _0x4d0232=_[_0x6e45('0x26')](_0x590fdb[_0x6e45('0x46')],function(_0x4c8748){delete _0x4c8748['id'];_0x4c8748[_0x6e45('0x4e')]=_0x590fdb[_0x6e45('0x3f')]['id'];return _0x4c8748;});return db[_0x6e45('0x27')][_0x6e45('0x45')](_0x4d0232,{'transaction':_0xf23be5});});})[_0x6e45('0x21')](function(){return db[_0x6e45('0x27')][_0x6e45('0x3c')]({'where':{'CustomReportId':_0x590fdb[_0x6e45('0x3f')]['id']}});});}})['then'](respondWithResult(_0x11b67b,null))[_0x6e45('0x44')](handleError(_0x11b67b,null));}; \ No newline at end of file +var _0xb0be=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','bulkCreate','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3f77d0,_0x403a69){var _0x18e117=function(_0x6d7322){while(--_0x6d7322){_0x3f77d0['push'](_0x3f77d0['shift']());}};_0x18e117(++_0x403a69);}(_0xb0be,0xa8));var _0xeb0b=function(_0x4d216c,_0x363a80){_0x4d216c=_0x4d216c-0x0;var _0x36fe74=_0xb0be[_0x4d216c];return _0x36fe74;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xeb0b('0x0'));var jsonpatch=require(_0xeb0b('0x1'));var rp=require(_0xeb0b('0x2'));var moment=require(_0xeb0b('0x3'));var BPromise=require(_0xeb0b('0x4'));var Mustache=require(_0xeb0b('0x5'));var util=require(_0xeb0b('0x6'));var path=require(_0xeb0b('0x7'));var sox=require(_0xeb0b('0x8'));var csv=require(_0xeb0b('0x9'));var ejs=require(_0xeb0b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb0b('0xb'));var squel=require(_0xeb0b('0xc'));var crypto=require('crypto');var jsforce=require(_0xeb0b('0xd'));var deskjs=require(_0xeb0b('0xe'));var toCsv=require(_0xeb0b('0x9'));var querystring=require(_0xeb0b('0xf'));var Papa=require('papaparse');var Redis=require(_0xeb0b('0x10'));var authService=require(_0xeb0b('0x11'));var qs=require(_0xeb0b('0x12'));var as=require(_0xeb0b('0x13'));var hardwareService=require(_0xeb0b('0x14'));var logger=require(_0xeb0b('0x15'))(_0xeb0b('0x16'));var utils=require(_0xeb0b('0x17'));var config=require(_0xeb0b('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2074c,_0x5888bf){_0x5888bf=_0x5888bf||0xcc;return function(_0x1a70f2){if(_0x1a70f2){return _0x2074c[_0xeb0b('0x19')](_0x5888bf);}return _0x2074c['status'](_0x5888bf)['end']();};}function respondWithResult(_0xd4a139,_0x5be020){_0x5be020=_0x5be020||0xc8;return function(_0x3edeaf){if(_0x3edeaf){return _0xd4a139['status'](_0x5be020)[_0xeb0b('0x1a')](_0x3edeaf);}};}function respondWithFilteredResult(_0xf04b13,_0x40c692){return function(_0x1308ae){if(_0x1308ae){var _0x23cc7d=typeof _0x40c692[_0xeb0b('0x1b')]==='undefined'&&typeof _0x40c692[_0xeb0b('0x1c')]===_0xeb0b('0x1d');var _0x564888=_0x1308ae[_0xeb0b('0x1e')];var _0x44371b=_0x23cc7d?0x0:_0x40c692['offset'];var _0x3992e5=_0x23cc7d?_0x1308ae['count']:_0x40c692[_0xeb0b('0x1b')]+_0x40c692[_0xeb0b('0x1c')];var _0x472ac2;if(_0x3992e5>=_0x564888){_0x3992e5=_0x564888;_0x472ac2=0xc8;}else{_0x472ac2=0xce;}_0xf04b13[_0xeb0b('0x1f')](_0x472ac2);return _0xf04b13[_0xeb0b('0x20')](_0xeb0b('0x21'),_0x44371b+'-'+_0x3992e5+'/'+_0x564888)['json'](_0x1308ae);}return null;};}function patchUpdates(_0x45971c){return function(_0x2ae86b){try{jsonpatch[_0xeb0b('0x22')](_0x2ae86b,_0x45971c,!![]);}catch(_0xbb2d36){return BPromise[_0xeb0b('0x23')](_0xbb2d36);}return _0x2ae86b[_0xeb0b('0x24')]();};}function saveUpdates(_0x5c71bd,_0x481dba){return function(_0x302a49){if(_0x302a49){return _0x302a49[_0xeb0b('0x25')](_0x5c71bd)[_0xeb0b('0x26')](function(_0xe58bec){return _0xe58bec;});}return null;};}function removeEntity(_0xd30d6f,_0x2b33b9){return function(_0x1e59cf){if(_0x1e59cf){return _0x1e59cf['destroy']()[_0xeb0b('0x26')](function(){_0xd30d6f[_0xeb0b('0x1f')](0xcc)[_0xeb0b('0x27')]();});}};}function handleEntityNotFound(_0x452707,_0x2e11cb){return function(_0x5a331a){if(!_0x5a331a){_0x452707[_0xeb0b('0x19')](0x194);}return _0x5a331a;};}function handleError(_0x1a061c,_0x534bca){_0x534bca=_0x534bca||0x1f4;return function(_0x412986){logger[_0xeb0b('0x28')](_0x412986[_0xeb0b('0x29')]);if(_0x412986[_0xeb0b('0x2a')]){delete _0x412986[_0xeb0b('0x2a')];}_0x1a061c['status'](_0x534bca)['send'](_0x412986);};}exports[_0xeb0b('0x2b')]=function(_0x59f2bf,_0x586893){var _0x2763d5={},_0x149072={},_0x1446d3={'count':0x0,'rows':[]};var _0x3d9f49=_[_0xeb0b('0x2c')](db[_0xeb0b('0x2d')][_0xeb0b('0x2e')],function(_0x44f04a){return{'name':_0x44f04a[_0xeb0b('0x2f')],'type':_0x44f04a[_0xeb0b('0x30')]['key']};});_0x149072[_0xeb0b('0x31')]=_[_0xeb0b('0x2c')](_0x3d9f49,_0xeb0b('0x2a'));_0x149072[_0xeb0b('0x32')]=_[_0xeb0b('0x33')](_0x59f2bf[_0xeb0b('0x32')]);_0x149072[_0xeb0b('0x34')]=_[_0xeb0b('0x35')](_0x149072[_0xeb0b('0x31')],_0x149072[_0xeb0b('0x32')]);_0x2763d5['attributes']=_['intersection'](_0x149072[_0xeb0b('0x31')],qs[_0xeb0b('0x36')](_0x59f2bf[_0xeb0b('0x32')]['fields']));_0x2763d5[_0xeb0b('0x37')]=_0x2763d5['attributes'][_0xeb0b('0x38')]?_0x2763d5[_0xeb0b('0x37')]:_0x149072[_0xeb0b('0x31')];if(!_0x59f2bf[_0xeb0b('0x32')][_0xeb0b('0x39')](_0xeb0b('0x3a'))){_0x2763d5[_0xeb0b('0x1c')]=qs[_0xeb0b('0x1c')](_0x59f2bf[_0xeb0b('0x32')][_0xeb0b('0x1c')]);_0x2763d5[_0xeb0b('0x1b')]=qs[_0xeb0b('0x1b')](_0x59f2bf[_0xeb0b('0x32')][_0xeb0b('0x1b')]);}_0x2763d5[_0xeb0b('0x3b')]=qs['sort'](_0x59f2bf[_0xeb0b('0x32')][_0xeb0b('0x3c')]);_0x2763d5[_0xeb0b('0x3d')]=qs[_0xeb0b('0x34')](_[_0xeb0b('0x3e')](_0x59f2bf[_0xeb0b('0x32')],_0x149072['filters']),_0x3d9f49);if(_0x59f2bf[_0xeb0b('0x32')]['filter']){_0x2763d5['where']=_[_0xeb0b('0x3f')](_0x2763d5[_0xeb0b('0x3d')],{'$or':_[_0xeb0b('0x2c')](_0x3d9f49,function(_0x3a699c){if(_0x3a699c[_0xeb0b('0x30')]!==_0xeb0b('0x40')){var _0x14d2ff={};_0x14d2ff[_0x3a699c['name']]={'$like':'%'+_0x59f2bf[_0xeb0b('0x32')][_0xeb0b('0x41')]+'%'};return _0x14d2ff;}})});}_0x2763d5=_['merge']({},_0x2763d5,_0x59f2bf[_0xeb0b('0x42')]);var _0x150ab9={'where':_0x2763d5[_0xeb0b('0x3d')]};return db[_0xeb0b('0x2d')][_0xeb0b('0x1e')](_0x150ab9)[_0xeb0b('0x26')](function(_0x1aca2b){_0x1446d3[_0xeb0b('0x1e')]=_0x1aca2b;if(_0x59f2bf['query'][_0xeb0b('0x43')]){_0x2763d5[_0xeb0b('0x44')]=[{'all':!![]}];}return db[_0xeb0b('0x2d')][_0xeb0b('0x45')](_0x2763d5);})[_0xeb0b('0x26')](function(_0x48c3e9){_0x1446d3[_0xeb0b('0x46')]=_0x48c3e9;return _0x1446d3;})[_0xeb0b('0x26')](respondWithFilteredResult(_0x586893,_0x2763d5))['catch'](handleError(_0x586893,null));};exports[_0xeb0b('0x47')]=function(_0xc593fa,_0x2e2f78){var _0x4f3a7f={'raw':![],'where':{'id':_0xc593fa[_0xeb0b('0x48')]['id']}},_0x268b55={};_0x268b55[_0xeb0b('0x31')]=_[_0xeb0b('0x33')](db[_0xeb0b('0x2d')]['rawAttributes']);_0x268b55[_0xeb0b('0x32')]=_[_0xeb0b('0x33')](_0xc593fa['query']);_0x268b55[_0xeb0b('0x34')]=_[_0xeb0b('0x35')](_0x268b55[_0xeb0b('0x31')],_0x268b55[_0xeb0b('0x32')]);_0x4f3a7f[_0xeb0b('0x37')]=_[_0xeb0b('0x35')](_0x268b55[_0xeb0b('0x31')],qs[_0xeb0b('0x36')](_0xc593fa[_0xeb0b('0x32')][_0xeb0b('0x36')]));_0x4f3a7f[_0xeb0b('0x37')]=_0x4f3a7f[_0xeb0b('0x37')][_0xeb0b('0x38')]?_0x4f3a7f['attributes']:_0x268b55[_0xeb0b('0x31')];if(_0xc593fa[_0xeb0b('0x32')]['includeAll']){_0x4f3a7f[_0xeb0b('0x44')]=[{'all':!![]}];}_0x4f3a7f=_[_0xeb0b('0x3f')]({},_0x4f3a7f,_0xc593fa['options']);return db[_0xeb0b('0x2d')][_0xeb0b('0x49')](_0x4f3a7f)['then'](handleEntityNotFound(_0x2e2f78,null))['then'](respondWithResult(_0x2e2f78,null))['catch'](handleError(_0x2e2f78,null));};exports[_0xeb0b('0x4a')]=function(_0x5efe1c,_0x318ec7){return db[_0xeb0b('0x2d')][_0xeb0b('0x4a')](_0x5efe1c[_0xeb0b('0x4b')],{})[_0xeb0b('0x26')](respondWithResult(_0x318ec7,0xc9))[_0xeb0b('0x4c')](handleError(_0x318ec7,null));};exports['bulkCreate']=function(_0x1db534,_0x270e06){return db['AnalyticFieldReport'][_0xeb0b('0x4d')](_0x1db534[_0xeb0b('0x4b')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x270e06,0xc9))[_0xeb0b('0x4c')](handleError(_0x270e06,null));};exports[_0xeb0b('0x25')]=function(_0x44b995,_0x53ba49){if(_0x44b995[_0xeb0b('0x4b')]['id']){delete _0x44b995[_0xeb0b('0x4b')]['id'];}return db[_0xeb0b('0x2d')][_0xeb0b('0x49')]({'where':{'id':_0x44b995[_0xeb0b('0x48')]['id']}})[_0xeb0b('0x26')](handleEntityNotFound(_0x53ba49,null))[_0xeb0b('0x26')](saveUpdates(_0x44b995[_0xeb0b('0x4b')],null))[_0xeb0b('0x26')](respondWithResult(_0x53ba49,null))[_0xeb0b('0x4c')](handleError(_0x53ba49,null));};exports[_0xeb0b('0x4e')]=function(_0x368475,_0x23d7e8){return db[_0xeb0b('0x2d')][_0xeb0b('0x49')]({'where':{'id':_0x368475[_0xeb0b('0x48')]['id']}})[_0xeb0b('0x26')](handleEntityNotFound(_0x23d7e8,null))[_0xeb0b('0x26')](removeEntity(_0x23d7e8,null))[_0xeb0b('0x4c')](handleError(_0x23d7e8,null));};exports[_0xeb0b('0x4f')]=function(_0x50006b,_0x59b6aa){return db[_0xeb0b('0x2d')]['destroy']({'where':{'id':_0x50006b[_0xeb0b('0x32')][_0xeb0b('0x50')]||[]},'raw':![],'individualHooks':!![]})[_0xeb0b('0x26')](respondWithResult(_0x59b6aa,0xcc))['catch'](handleError(_0x59b6aa,null));};exports[_0xeb0b('0x51')]=function(_0x200d8d,_0x34909c,_0x160076){return db[_0xeb0b('0x52')][_0xeb0b('0x53')]({'where':{'id':_0x200d8d[_0xeb0b('0x48')]['id']}})[_0xeb0b('0x26')](handleEntityNotFound(_0x34909c,null))[_0xeb0b('0x26')](function(_0xd55e62){if(_0xd55e62){return db['sequelize'][_0xeb0b('0x54')](function(_0x35582a){return db[_0xeb0b('0x2d')][_0xeb0b('0x4e')]({'where':{'CustomReportId':_0x200d8d[_0xeb0b('0x48')]['id']},'transaction':_0x35582a})[_0xeb0b('0x26')](function(_0xa10659){var _0x3ad6a7=_[_0xeb0b('0x2c')](_0x200d8d[_0xeb0b('0x4b')],function(_0xb5e40c){delete _0xb5e40c['id'];_0xb5e40c[_0xeb0b('0x55')]=_0x200d8d[_0xeb0b('0x48')]['id'];return _0xb5e40c;});return db[_0xeb0b('0x2d')]['bulkCreate'](_0x3ad6a7,{'transaction':_0x35582a});});})[_0xeb0b('0x26')](function(){return db[_0xeb0b('0x2d')][_0xeb0b('0x45')]({'where':{'CustomReportId':_0x200d8d[_0xeb0b('0x48')]['id']}});});}})['then'](respondWithResult(_0x34909c,null))[_0xeb0b('0x4c')](handleError(_0x34909c,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 45602e4..015fa64 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 _0x6770=['analytics_report_fields','lodash','util','../../config/logger','api','moment','request-promise','path','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport'];(function(_0x207db1,_0x19c38c){var _0x3744e1=function(_0x1cd678){while(--_0x1cd678){_0x207db1['push'](_0x207db1['shift']());}};_0x3744e1(++_0x19c38c);}(_0x6770,0x79));var _0x0677=function(_0x40e674,_0x2db263){_0x40e674=_0x40e674-0x0;var _0x4126fe=_0x6770[_0x40e674];return _0x4126fe;};'use strict';var _=require(_0x0677('0x0'));var util=require(_0x0677('0x1'));var logger=require(_0x0677('0x2'))(_0x0677('0x3'));var moment=require(_0x0677('0x4'));var BPromise=require('bluebird');var rp=require(_0x0677('0x5'));var fs=require('fs');var path=require(_0x0677('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0677('0x7'));module[_0x0677('0x8')]=function(_0x29f24e,_0x5c1025){return _0x29f24e[_0x0677('0x9')](_0x0677('0xa'),attributes,{'tableName':_0x0677('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad16=['rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x46f745,_0x496dfc){var _0x2ae22e=function(_0x505108){while(--_0x505108){_0x46f745['push'](_0x46f745['shift']());}};_0x2ae22e(++_0x496dfc);}(_0xad16,0xf6));var _0x6ad1=function(_0xb0ddc8,_0x372ff9){_0xb0ddc8=_0xb0ddc8-0x0;var _0x58b7f5=_0xad16[_0xb0ddc8];return _0x58b7f5;};'use strict';var _=require(_0x6ad1('0x0'));var util=require(_0x6ad1('0x1'));var logger=require(_0x6ad1('0x2'))(_0x6ad1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6ad1('0x4'));var fs=require('fs');var path=require(_0x6ad1('0x5'));var rimraf=require(_0x6ad1('0x6'));var config=require(_0x6ad1('0x7'));var attributes=require(_0x6ad1('0x8'));module[_0x6ad1('0x9')]=function(_0x52c053,_0x5aeac9){return _0x52c053['define'](_0x6ad1('0xa'),attributes,{'tableName':_0x6ad1('0xb'),'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 2ae3ca6..d793fb8 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 _0x49eb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring'];(function(_0x2a9fb6,_0x2fd7da){var _0x22f071=function(_0x286488){while(--_0x286488){_0x2a9fb6['push'](_0x2a9fb6['shift']());}};_0x22f071(++_0x2fd7da);}(_0x49eb,0x110));var _0xb49e=function(_0x4d9480,_0x2f45ab){_0x4d9480=_0x4d9480-0x0;var _0x2d0eef=_0x49eb[_0x4d9480];return _0x2d0eef;};'use strict';var _=require(_0xb49e('0x0'));var util=require(_0xb49e('0x1'));var moment=require('moment');var BPromise=require(_0xb49e('0x2'));var rs=require(_0xb49e('0x3'));var fs=require('fs');var Redis=require(_0xb49e('0x4'));var db=require(_0xb49e('0x5'))['db'];var utils=require(_0xb49e('0x6'));var logger=require(_0xb49e('0x7'))('rpc');var config=require(_0xb49e('0x8'));var jayson=require(_0xb49e('0x9'));var client=jayson[_0xb49e('0xa')][_0xb49e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16a7d0,_0x51bdea,_0x50cd6c){return new BPromise(function(_0x2b143c,_0x1c20b0){return client[_0xb49e('0xc')](_0x16a7d0,_0x50cd6c)['then'](function(_0x1133c7){logger[_0xb49e('0xd')](_0xb49e('0xe'),_0x51bdea,_0xb49e('0xf'));logger[_0xb49e('0x10')](_0xb49e('0x11'),_0x51bdea,_0xb49e('0xf'),JSON[_0xb49e('0x12')](_0x1133c7));if(_0x1133c7[_0xb49e('0x13')]){if(_0x1133c7[_0xb49e('0x13')][_0xb49e('0x14')]===0x1f4){logger[_0xb49e('0x13')](_0xb49e('0xe'),_0x51bdea,_0x1133c7[_0xb49e('0x13')][_0xb49e('0x15')]);return _0x1c20b0(_0x1133c7[_0xb49e('0x13')][_0xb49e('0x15')]);}logger[_0xb49e('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x51bdea,_0x1133c7['error'][_0xb49e('0x15')]);return _0x2b143c(_0x1133c7['error'][_0xb49e('0x15')]);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x51bdea,_0xb49e('0xf'));_0x2b143c(_0x1133c7['result'][_0xb49e('0x15')]);}})[_0xb49e('0x16')](function(_0x26ea73){logger['error'](_0xb49e('0xe'),_0x51bdea,_0x26ea73);_0x1c20b0(_0x26ea73);});});} \ No newline at end of file +var _0x1d52=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x4a9b68,_0x48e4f3){var _0x4beb40=function(_0x1a018a){while(--_0x1a018a){_0x4a9b68['push'](_0x4a9b68['shift']());}};_0x4beb40(++_0x48e4f3);}(_0x1d52,0x121));var _0x21d5=function(_0x490021,_0x34b606){_0x490021=_0x490021-0x0;var _0x12d809=_0x1d52[_0x490021];return _0x12d809;};'use strict';var _=require(_0x21d5('0x0'));var util=require(_0x21d5('0x1'));var moment=require(_0x21d5('0x2'));var BPromise=require(_0x21d5('0x3'));var rs=require(_0x21d5('0x4'));var fs=require('fs');var Redis=require(_0x21d5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x21d5('0x6'));var logger=require(_0x21d5('0x7'))(_0x21d5('0x8'));var config=require(_0x21d5('0x9'));var jayson=require(_0x21d5('0xa'));var client=jayson[_0x21d5('0xb')][_0x21d5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x90a26d,_0xe02af,_0x47da19){return new BPromise(function(_0x4de3db,_0x276a76){return client['request'](_0x90a26d,_0x47da19)[_0x21d5('0xd')](function(_0x2d97b7){logger['info'](_0x21d5('0xe'),_0xe02af,_0x21d5('0xf'));logger[_0x21d5('0x10')](_0x21d5('0x11'),_0xe02af,_0x21d5('0xf'),JSON[_0x21d5('0x12')](_0x2d97b7));if(_0x2d97b7[_0x21d5('0x13')]){if(_0x2d97b7[_0x21d5('0x13')][_0x21d5('0x14')]===0x1f4){logger[_0x21d5('0x13')](_0x21d5('0xe'),_0xe02af,_0x2d97b7['error']['message']);return _0x276a76(_0x2d97b7[_0x21d5('0x13')][_0x21d5('0x15')]);}logger[_0x21d5('0x13')](_0x21d5('0xe'),_0xe02af,_0x2d97b7[_0x21d5('0x13')][_0x21d5('0x15')]);return _0x4de3db(_0x2d97b7[_0x21d5('0x13')][_0x21d5('0x15')]);}else{logger[_0x21d5('0x16')](_0x21d5('0xe'),_0xe02af,_0x21d5('0xf'));_0x4de3db(_0x2d97b7[_0x21d5('0x17')][_0x21d5('0x15')]);}})['catch'](function(_0x510da0){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0xe02af,_0x510da0);_0x276a76(_0x510da0);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 3438b28..c81adf3 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(_0x354b97,_0x4e7682){var _0x5ee835=function(_0x2e0484){while(--_0x2e0484){_0x354b97['push'](_0x354b97['shift']());}};_0x5ee835(++_0x4e7682);}(_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'));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(_0x7f971b,_0x32f797){var _0x16405f=function(_0x3cf8f1){while(--_0x3cf8f1){_0x7f971b['push'](_0x7f971b['shift']());}};_0x16405f(++_0x32f797);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 5f67386..3cb1ec1 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 _0x45c8=['STRING','name','TEXT','sequelize'];(function(_0x51e834,_0x16c70e){var _0x1f77b6=function(_0x14e429){while(--_0x14e429){_0x51e834['push'](_0x51e834['shift']());}};_0x1f77b6(++_0x16c70e);}(_0x45c8,0xef));var _0x845c=function(_0x1a9115,_0x301b4f){_0x1a9115=_0x1a9115-0x0;var _0x522a32=_0x45c8[_0x1a9115];return _0x522a32;};'use strict';var Sequelize=require(_0x845c('0x0'));module['exports']={'name':{'type':Sequelize[_0x845c('0x1')],'allowNull':![],'unique':_0x845c('0x2')},'table':{'type':Sequelize[_0x845c('0x1')]},'metric':{'type':Sequelize[_0x845c('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x980c=['TEXT','sequelize','exports','STRING','name'];(function(_0x41c7db,_0x2431a0){var _0x50b659=function(_0x317655){while(--_0x317655){_0x41c7db['push'](_0x41c7db['shift']());}};_0x50b659(++_0x2431a0);}(_0x980c,0x100));var _0xc980=function(_0x55c7e2,_0x353939){_0x55c7e2=_0x55c7e2-0x0;var _0x1c100b=_0x980c[_0x55c7e2];return _0x1c100b;};'use strict';var Sequelize=require(_0xc980('0x0'));module[_0xc980('0x1')]={'name':{'type':Sequelize[_0xc980('0x2')],'allowNull':![],'unique':_0xc980('0x3')},'table':{'type':Sequelize[_0xc980('0x2')]},'metric':{'type':Sequelize[_0xc980('0x4')]},'description':{'type':Sequelize[_0xc980('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 110088a..ab6a412 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 _0x7217=['Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x124049,_0xb888a8){var _0x464b44=function(_0x10d80c){while(--_0x10d80c){_0x124049['push'](_0x124049['shift']());}};_0x464b44(++_0xb888a8);}(_0x7217,0x19e));var _0x7721=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x7217[_0x24237f];return _0x48298e;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){var _0x216f20=_0x395b15[_0x7721('0x2b')]({'plain':!![]});var _0x125564=_0x7721('0x2c');return db[_0x7721('0x2d')][_0x7721('0x2a')]({'where':{'type':_0x125564,'resourceId':_0x216f20['id']}})[_0x7721('0x29')](function(){return _0x395b15;});})[_0x7721('0x29')](function(){_0x1caad8[_0x7721('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x258ddf,_0x5b0551){return function(_0x499b87){if(!_0x499b87){_0x258ddf[_0x7721('0x2e')](0x194);}return _0x499b87;};}function handleError(_0x343c19,_0x53c904){_0x53c904=_0x53c904||0x1f4;return function(_0x158d98){logger[_0x7721('0x2f')](_0x158d98[_0x7721('0x30')]);if(_0x158d98[_0x7721('0x31')]){delete _0x158d98[_0x7721('0x31')];}_0x343c19['status'](_0x53c904)[_0x7721('0x32')](_0x158d98);};}exports[_0x7721('0x33')]=function(_0x497f9f,_0x4a25c9){var _0xfde9ec={},_0x220bbf={},_0x48f329={'count':0x0,'rows':[]};var _0x46f772=_[_0x7721('0x34')](db[_0x7721('0x35')]['rawAttributes'],function(_0x3d9a32){return{'name':_0x3d9a32[_0x7721('0x36')],'type':_0x3d9a32[_0x7721('0x37')][_0x7721('0x38')]};});_0x220bbf[_0x7721('0x39')]=_['map'](_0x46f772,_0x7721('0x31'));_0x220bbf[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0x497f9f['query']);_0x220bbf[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x220bbf['model'],_0x220bbf[_0x7721('0x3a')]);_0xfde9ec['attributes']=_[_0x7721('0x3d')](_0x220bbf[_0x7721('0x39')],qs[_0x7721('0x3e')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x3e')]));_0xfde9ec[_0x7721('0x3f')]=_0xfde9ec[_0x7721('0x3f')][_0x7721('0x40')]?_0xfde9ec[_0x7721('0x3f')]:_0x220bbf[_0x7721('0x39')];if(!_0x497f9f[_0x7721('0x3a')]['hasOwnProperty'](_0x7721('0x41'))){_0xfde9ec['limit']=qs[_0x7721('0x21')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x21')]);_0xfde9ec[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x497f9f[_0x7721('0x3a')]['offset']);}_0xfde9ec['order']=qs['sort'](_0x497f9f['query'][_0x7721('0x42')]);_0xfde9ec[_0x7721('0x43')]=qs[_0x7721('0x3c')](_[_0x7721('0x44')](_0x497f9f['query'],_0x220bbf[_0x7721('0x3c')]),_0x46f772);if(_0x497f9f['query'][_0x7721('0x45')]){_0xfde9ec[_0x7721('0x43')]=_['merge'](_0xfde9ec[_0x7721('0x43')],{'$or':_[_0x7721('0x34')](_0x46f772,function(_0x4e77ff){if(_0x4e77ff['type']!==_0x7721('0x46')){var _0xfc4dc4={};_0xfc4dc4[_0x4e77ff[_0x7721('0x31')]]={'$like':'%'+_0x497f9f[_0x7721('0x3a')]['filter']+'%'};return _0xfc4dc4;}})});}_0xfde9ec=_[_0x7721('0x47')]({},_0xfde9ec,_0x497f9f[_0x7721('0x48')]);var _0x40ce8c={'where':_0xfde9ec[_0x7721('0x43')]};return db[_0x7721('0x35')]['count'](_0x40ce8c)[_0x7721('0x29')](function(_0x4a2c28){_0x48f329[_0x7721('0x22')]=_0x4a2c28;if(_0x497f9f['query'][_0x7721('0x49')]){_0xfde9ec[_0x7721('0x4a')]=[{'all':!![]}];}return db[_0x7721('0x35')]['findAll'](_0xfde9ec);})[_0x7721('0x29')](function(_0x11d853){_0x48f329[_0x7721('0x4b')]=_0x11d853;return _0x48f329;})['then'](respondWithFilteredResult(_0x4a25c9,_0xfde9ec))[_0x7721('0x4c')](handleError(_0x4a25c9,null));};exports[_0x7721('0x4d')]=function(_0xdb3033,_0x2d5f35){var _0x135dbc={'raw':!![],'where':{'id':_0xdb3033[_0x7721('0x4e')]['id']}},_0x57d09b={};_0x57d09b['model']=_['keys'](db[_0x7721('0x35')][_0x7721('0x4f')]);_0x57d09b[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0xdb3033[_0x7721('0x3a')]);_0x57d09b[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x57d09b[_0x7721('0x39')],_0x57d09b[_0x7721('0x3a')]);_0x135dbc[_0x7721('0x3f')]=_['intersection'](_0x57d09b['model'],qs[_0x7721('0x3e')](_0xdb3033[_0x7721('0x3a')][_0x7721('0x3e')]));_0x135dbc[_0x7721('0x3f')]=_0x135dbc['attributes'][_0x7721('0x40')]?_0x135dbc[_0x7721('0x3f')]:_0x57d09b['model'];if(_0xdb3033[_0x7721('0x3a')]['includeAll']){_0x135dbc[_0x7721('0x4a')]=[{'all':!![]}];}_0x135dbc=_['merge']({},_0x135dbc,_0xdb3033[_0x7721('0x48')]);return db[_0x7721('0x35')][_0x7721('0x50')](_0x135dbc)['then'](handleEntityNotFound(_0x2d5f35,null))[_0x7721('0x29')](respondWithResult(_0x2d5f35,null))[_0x7721('0x4c')](handleError(_0x2d5f35,null));};exports['create']=function(_0x223d93,_0x1196c2){return db[_0x7721('0x35')]['create'](_0x223d93[_0x7721('0x51')],{})['then'](function(_0xdb1ca8){var _0x310549=_0x223d93[_0x7721('0x52')][_0x7721('0x2b')]({'plain':!![]});if(!_0x310549)throw new Error(_0x7721('0x53'));if(_0x310549[_0x7721('0x54')]===_0x7721('0x52')){var _0x7fbb73=_0xdb1ca8[_0x7721('0x2b')]({'plain':!![]});var _0x3386aa=_0x7721('0x2c');return db[_0x7721('0x55')][_0x7721('0x50')]({'where':{'name':_0x3386aa,'userProfileId':_0x310549[_0x7721('0x56')]},'raw':!![]})[_0x7721('0x29')](function(_0x5b741d){if(_0x5b741d&&_0x5b741d[_0x7721('0x57')]===0x0){return db[_0x7721('0x2d')][_0x7721('0x58')]({'name':_0x7fbb73[_0x7721('0x31')],'resourceId':_0x7fbb73['id'],'type':_0x5b741d[_0x7721('0x31')],'sectionId':_0x5b741d['id']},{})[_0x7721('0x29')](function(){return _0xdb1ca8;});}else{return _0xdb1ca8;}})[_0x7721('0x4c')](function(_0x57484c){logger[_0x7721('0x2f')](_0x7721('0x59'),_0x57484c);throw _0x57484c;});}return _0xdb1ca8;})[_0x7721('0x29')](respondWithResult(_0x1196c2,0xc9))[_0x7721('0x4c')](handleError(_0x1196c2,null));};exports[_0x7721('0x28')]=function(_0x9c0d4,_0x7fbd6c){if(_0x9c0d4[_0x7721('0x51')]['id']){delete _0x9c0d4[_0x7721('0x51')]['id'];}return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x9c0d4['params']['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x7fbd6c,null))[_0x7721('0x29')](saveUpdates(_0x9c0d4[_0x7721('0x51')],null))[_0x7721('0x29')](respondWithResult(_0x7fbd6c,null))[_0x7721('0x4c')](handleError(_0x7fbd6c,null));};exports[_0x7721('0x2a')]=function(_0x41644f,_0x36fe6f){return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x41644f[_0x7721('0x4e')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x36fe6f,null))[_0x7721('0x29')](removeEntity(_0x36fe6f,null))[_0x7721('0x4c')](handleError(_0x36fe6f,null));}; \ No newline at end of file +var _0x6aa7=['json','apply','reject','save','update','then','destroy','get','Metrics','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','show','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','UserProfileResource','catch','error','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range'];(function(_0x536866,_0x54e594){var _0x3f8cee=function(_0x116c1e){while(--_0x116c1e){_0x536866['push'](_0x536866['shift']());}};_0x3f8cee(++_0x54e594);}(_0x6aa7,0x178));var _0x76aa=function(_0x55e99c,_0x260b75){_0x55e99c=_0x55e99c-0x0;var _0x3c1827=_0x6aa7[_0x55e99c];return _0x3c1827;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x112c39,_0x5df49c){_0x5df49c=_0x5df49c||0xcc;return function(_0x226536){if(_0x226536){return _0x112c39[_0x76aa('0x19')](_0x5df49c);}return _0x112c39[_0x76aa('0x1a')](_0x5df49c)[_0x76aa('0x1b')]();};}function respondWithResult(_0x10432c,_0x4e309f){_0x4e309f=_0x4e309f||0xc8;return function(_0x5f5b59){if(_0x5f5b59){return _0x10432c[_0x76aa('0x1a')](_0x4e309f)['json'](_0x5f5b59);}};}function respondWithFilteredResult(_0x180d92,_0x319bf1){return function(_0x5cf594){if(_0x5cf594){var _0x2111c7=typeof _0x319bf1['offset']===_0x76aa('0x1c')&&typeof _0x319bf1['limit']===_0x76aa('0x1c');var _0x413cf6=_0x5cf594[_0x76aa('0x1d')];var _0x21c16d=_0x2111c7?0x0:_0x319bf1[_0x76aa('0x1e')];var _0x3ead3f=_0x2111c7?_0x5cf594['count']:_0x319bf1['offset']+_0x319bf1[_0x76aa('0x1f')];var _0x454dd3;if(_0x3ead3f>=_0x413cf6){_0x3ead3f=_0x413cf6;_0x454dd3=0xc8;}else{_0x454dd3=0xce;}_0x180d92[_0x76aa('0x1a')](_0x454dd3);return _0x180d92[_0x76aa('0x20')](_0x76aa('0x21'),_0x21c16d+'-'+_0x3ead3f+'/'+_0x413cf6)[_0x76aa('0x22')](_0x5cf594);}return null;};}function patchUpdates(_0x19af92){return function(_0x2eaf48){try{jsonpatch[_0x76aa('0x23')](_0x2eaf48,_0x19af92,!![]);}catch(_0x5990c1){return BPromise[_0x76aa('0x24')](_0x5990c1);}return _0x2eaf48[_0x76aa('0x25')]();};}function saveUpdates(_0x338a6b,_0x5b3f55){return function(_0x41463a){if(_0x41463a){return _0x41463a[_0x76aa('0x26')](_0x338a6b)[_0x76aa('0x27')](function(_0x2bd2c6){return _0x2bd2c6;});}return null;};}function removeEntity(_0x29c50c,_0xc1044c){return function(_0x3cd039){if(_0x3cd039){return _0x3cd039[_0x76aa('0x28')]()[_0x76aa('0x27')](function(){var _0x2cba6d=_0x3cd039[_0x76aa('0x29')]({'plain':!![]});var _0x26b75e=_0x76aa('0x2a');return db['UserProfileResource'][_0x76aa('0x28')]({'where':{'type':_0x26b75e,'resourceId':_0x2cba6d['id']}})[_0x76aa('0x27')](function(){return _0x3cd039;});})[_0x76aa('0x27')](function(){_0x29c50c[_0x76aa('0x1a')](0xcc)[_0x76aa('0x1b')]();});}};}function handleEntityNotFound(_0x2f9316,_0x25a803){return function(_0x282d0a){if(!_0x282d0a){_0x2f9316[_0x76aa('0x19')](0x194);}return _0x282d0a;};}function handleError(_0x1bdc3d,_0x545b06){_0x545b06=_0x545b06||0x1f4;return function(_0x3fcb7f){logger['error'](_0x3fcb7f[_0x76aa('0x2b')]);if(_0x3fcb7f[_0x76aa('0x2c')]){delete _0x3fcb7f[_0x76aa('0x2c')];}_0x1bdc3d[_0x76aa('0x1a')](_0x545b06)[_0x76aa('0x2d')](_0x3fcb7f);};}exports[_0x76aa('0x2e')]=function(_0x2ee0f9,_0x3827ec){var _0x19fd4f={},_0x3ea05a={},_0x5edcd8={'count':0x0,'rows':[]};var _0x430ad6=_[_0x76aa('0x2f')](db[_0x76aa('0x30')][_0x76aa('0x31')],function(_0x458ac3){return{'name':_0x458ac3[_0x76aa('0x32')],'type':_0x458ac3[_0x76aa('0x33')]['key']};});_0x3ea05a[_0x76aa('0x34')]=_[_0x76aa('0x2f')](_0x430ad6,'name');_0x3ea05a[_0x76aa('0x35')]=_['keys'](_0x2ee0f9[_0x76aa('0x35')]);_0x3ea05a['filters']=_[_0x76aa('0x36')](_0x3ea05a['model'],_0x3ea05a['query']);_0x19fd4f[_0x76aa('0x37')]=_[_0x76aa('0x36')](_0x3ea05a[_0x76aa('0x34')],qs[_0x76aa('0x38')](_0x2ee0f9['query']['fields']));_0x19fd4f[_0x76aa('0x37')]=_0x19fd4f[_0x76aa('0x37')][_0x76aa('0x39')]?_0x19fd4f[_0x76aa('0x37')]:_0x3ea05a[_0x76aa('0x34')];if(!_0x2ee0f9['query'][_0x76aa('0x3a')]('nolimit')){_0x19fd4f['limit']=qs[_0x76aa('0x1f')](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x1f')]);_0x19fd4f[_0x76aa('0x1e')]=qs['offset'](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x1e')]);}_0x19fd4f[_0x76aa('0x3b')]=qs['sort'](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x3c')]);_0x19fd4f[_0x76aa('0x3d')]=qs[_0x76aa('0x3e')](_[_0x76aa('0x3f')](_0x2ee0f9[_0x76aa('0x35')],_0x3ea05a[_0x76aa('0x3e')]),_0x430ad6);if(_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x40')]){_0x19fd4f['where']=_[_0x76aa('0x41')](_0x19fd4f[_0x76aa('0x3d')],{'$or':_[_0x76aa('0x2f')](_0x430ad6,function(_0xa824e8){if(_0xa824e8[_0x76aa('0x33')]!==_0x76aa('0x42')){var _0x572fdb={};_0x572fdb[_0xa824e8['name']]={'$like':'%'+_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x40')]+'%'};return _0x572fdb;}})});}_0x19fd4f=_[_0x76aa('0x41')]({},_0x19fd4f,_0x2ee0f9[_0x76aa('0x43')]);var _0x50599f={'where':_0x19fd4f[_0x76aa('0x3d')]};return db[_0x76aa('0x30')][_0x76aa('0x1d')](_0x50599f)[_0x76aa('0x27')](function(_0x1138b5){_0x5edcd8['count']=_0x1138b5;if(_0x2ee0f9[_0x76aa('0x35')]['includeAll']){_0x19fd4f[_0x76aa('0x44')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x19fd4f);})['then'](function(_0x144f0a){_0x5edcd8['rows']=_0x144f0a;return _0x5edcd8;})['then'](respondWithFilteredResult(_0x3827ec,_0x19fd4f))['catch'](handleError(_0x3827ec,null));};exports[_0x76aa('0x45')]=function(_0x3fd153,_0x116dc5){var _0x2c0744={'raw':!![],'where':{'id':_0x3fd153['params']['id']}},_0x27a52e={};_0x27a52e[_0x76aa('0x34')]=_[_0x76aa('0x46')](db[_0x76aa('0x30')][_0x76aa('0x31')]);_0x27a52e[_0x76aa('0x35')]=_['keys'](_0x3fd153[_0x76aa('0x35')]);_0x27a52e[_0x76aa('0x3e')]=_['intersection'](_0x27a52e[_0x76aa('0x34')],_0x27a52e['query']);_0x2c0744[_0x76aa('0x37')]=_[_0x76aa('0x36')](_0x27a52e[_0x76aa('0x34')],qs[_0x76aa('0x38')](_0x3fd153[_0x76aa('0x35')][_0x76aa('0x38')]));_0x2c0744[_0x76aa('0x37')]=_0x2c0744[_0x76aa('0x37')][_0x76aa('0x39')]?_0x2c0744[_0x76aa('0x37')]:_0x27a52e['model'];if(_0x3fd153[_0x76aa('0x35')]['includeAll']){_0x2c0744[_0x76aa('0x44')]=[{'all':!![]}];}_0x2c0744=_[_0x76aa('0x41')]({},_0x2c0744,_0x3fd153[_0x76aa('0x43')]);return db[_0x76aa('0x30')]['find'](_0x2c0744)['then'](handleEntityNotFound(_0x116dc5,null))[_0x76aa('0x27')](respondWithResult(_0x116dc5,null))['catch'](handleError(_0x116dc5,null));};exports[_0x76aa('0x47')]=function(_0x302a0c,_0x4315b3){return db[_0x76aa('0x30')][_0x76aa('0x47')](_0x302a0c[_0x76aa('0x48')],{})['then'](function(_0x564546){var _0x2fcf8f=_0x302a0c[_0x76aa('0x49')][_0x76aa('0x29')]({'plain':!![]});if(!_0x2fcf8f)throw new Error(_0x76aa('0x4a'));if(_0x2fcf8f[_0x76aa('0x4b')]===_0x76aa('0x49')){var _0x4c52d5=_0x564546[_0x76aa('0x29')]({'plain':!![]});var _0x2d631e=_0x76aa('0x2a');return db['UserProfileSection'][_0x76aa('0x4c')]({'where':{'name':_0x2d631e,'userProfileId':_0x2fcf8f['userProfileId']},'raw':!![]})[_0x76aa('0x27')](function(_0x5e1d84){if(_0x5e1d84&&_0x5e1d84[_0x76aa('0x4d')]===0x0){return db[_0x76aa('0x4e')][_0x76aa('0x47')]({'name':_0x4c52d5[_0x76aa('0x2c')],'resourceId':_0x4c52d5['id'],'type':_0x5e1d84[_0x76aa('0x2c')],'sectionId':_0x5e1d84['id']},{})[_0x76aa('0x27')](function(){return _0x564546;});}else{return _0x564546;}})[_0x76aa('0x4f')](function(_0x4f2c2b){logger[_0x76aa('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f2c2b);throw _0x4f2c2b;});}return _0x564546;})[_0x76aa('0x27')](respondWithResult(_0x4315b3,0xc9))[_0x76aa('0x4f')](handleError(_0x4315b3,null));};exports[_0x76aa('0x26')]=function(_0x53be10,_0x3fa7ec){if(_0x53be10[_0x76aa('0x48')]['id']){delete _0x53be10[_0x76aa('0x48')]['id'];}return db['AnalyticMetric'][_0x76aa('0x4c')]({'where':{'id':_0x53be10[_0x76aa('0x51')]['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x3fa7ec,null))[_0x76aa('0x27')](saveUpdates(_0x53be10['body'],null))[_0x76aa('0x27')](respondWithResult(_0x3fa7ec,null))[_0x76aa('0x4f')](handleError(_0x3fa7ec,null));};exports[_0x76aa('0x28')]=function(_0x410933,_0x2027f8){return db[_0x76aa('0x30')]['find']({'where':{'id':_0x410933[_0x76aa('0x51')]['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x2027f8,null))[_0x76aa('0x27')](removeEntity(_0x2027f8,null))[_0x76aa('0x4f')](handleError(_0x2027f8,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 14f2bc5..1162c49 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 _0xc9c3=['path','rimraf','../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','../../config/logger','moment','bluebird','request-promise'];(function(_0x1ee0a1,_0x51058e){var _0x1d2d5b=function(_0x35cfb5){while(--_0x35cfb5){_0x1ee0a1['push'](_0x1ee0a1['shift']());}};_0x1d2d5b(++_0x51058e);}(_0xc9c3,0x96));var _0x3c9c=function(_0x35173a,_0x7ab79b){_0x35173a=_0x35173a-0x0;var _0x4cac41=_0xc9c3[_0x35173a];return _0x4cac41;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3c9c('0x0'))('api');var moment=require(_0x3c9c('0x1'));var BPromise=require(_0x3c9c('0x2'));var rp=require(_0x3c9c('0x3'));var fs=require('fs');var path=require(_0x3c9c('0x4'));var rimraf=require(_0x3c9c('0x5'));var config=require(_0x3c9c('0x6'));var attributes=require(_0x3c9c('0x7'));module['exports']=function(_0x48b219,_0x5c86bd){return _0x48b219[_0x3c9c('0x8')](_0x3c9c('0x9'),attributes,{'tableName':_0x3c9c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['define','AnalyticMetric','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x30e0fc,_0x29914d){var _0x5ee926=function(_0x3452c3){while(--_0x3452c3){_0x30e0fc['push'](_0x30e0fc['shift']());}};_0x5ee926(++_0x29914d);}(_0x814b,0x1a2));var _0xb814=function(_0x4907de,_0x5bbdc6){_0x4907de=_0x4907de-0x0;var _0x482054=_0x814b[_0x4907de];return _0x482054;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'analytics_metrics','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 9ad5fbd..1cfe9f6 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 _0xec16=['AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','AnalyticMetric,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','debug'];(function(_0x243101,_0x2bda19){var _0x33570b=function(_0x3bfef3){while(--_0x3bfef3){_0x243101['push'](_0x243101['shift']());}};_0x33570b(++_0x2bda19);}(_0xec16,0x82));var _0x6ec1=function(_0x3ee55a,_0x19aeea){_0x3ee55a=_0x3ee55a-0x0;var _0x581800=_0xec16[_0x3ee55a];return _0x581800;};'use strict';var _=require(_0x6ec1('0x0'));var util=require(_0x6ec1('0x1'));var moment=require(_0x6ec1('0x2'));var BPromise=require(_0x6ec1('0x3'));var rs=require(_0x6ec1('0x4'));var fs=require('fs');var Redis=require(_0x6ec1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ec1('0x6'));var logger=require(_0x6ec1('0x7'))(_0x6ec1('0x8'));var config=require('../../config/environment');var jayson=require(_0x6ec1('0x9'));var client=jayson[_0x6ec1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcd474c,_0x54e5d7,_0x230d78){return new BPromise(function(_0x18c3cb,_0x20240c){return client[_0x6ec1('0xb')](_0xcd474c,_0x230d78)[_0x6ec1('0xc')](function(_0x439e99){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x54e5d7,'request\x20sent');logger[_0x6ec1('0xd')](_0x6ec1('0xe'),_0x54e5d7,_0x6ec1('0xf'),JSON[_0x6ec1('0x10')](_0x439e99));if(_0x439e99['error']){if(_0x439e99['error'][_0x6ec1('0x11')]===0x1f4){logger[_0x6ec1('0x12')](_0x6ec1('0x13'),_0x54e5d7,_0x439e99[_0x6ec1('0x12')][_0x6ec1('0x14')]);return _0x20240c(_0x439e99[_0x6ec1('0x12')][_0x6ec1('0x14')]);}logger[_0x6ec1('0x12')](_0x6ec1('0x13'),_0x54e5d7,_0x439e99[_0x6ec1('0x12')]['message']);return _0x18c3cb(_0x439e99[_0x6ec1('0x12')][_0x6ec1('0x14')]);}else{logger[_0x6ec1('0x15')](_0x6ec1('0x13'),_0x54e5d7,'request\x20sent');_0x18c3cb(_0x439e99[_0x6ec1('0x16')]['message']);}})[_0x6ec1('0x17')](function(_0x4bb886){logger[_0x6ec1('0x12')](_0x6ec1('0x13'),_0x54e5d7,_0x4bb886);_0x20240c(_0x4bb886);});});} \ No newline at end of file +var _0x07a3=['then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x19de42,_0x5326be){var _0x1fb492=function(_0x3714b6){while(--_0x3714b6){_0x19de42['push'](_0x19de42['shift']());}};_0x1fb492(++_0x5326be);}(_0x07a3,0xac));var _0x307a=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x07a3[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x307a('0x0'));var util=require(_0x307a('0x1'));var moment=require(_0x307a('0x2'));var BPromise=require(_0x307a('0x3'));var rs=require(_0x307a('0x4'));var fs=require('fs');var Redis=require(_0x307a('0x5'));var db=require(_0x307a('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x307a('0x7'));var config=require(_0x307a('0x8'));var jayson=require(_0x307a('0x9'));var client=jayson['client'][_0x307a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x362883,_0x4f7631,_0x4aa13a){return new BPromise(function(_0x4a8fec,_0x25dd03){return client[_0x307a('0xb')](_0x362883,_0x4aa13a)[_0x307a('0xc')](function(_0x27c1af){logger[_0x307a('0xd')](_0x307a('0xe'),_0x4f7631,'request\x20sent');logger[_0x307a('0xf')](_0x307a('0x10'),_0x4f7631,_0x307a('0x11'),JSON[_0x307a('0x12')](_0x27c1af));if(_0x27c1af['error']){if(_0x27c1af[_0x307a('0x13')][_0x307a('0x14')]===0x1f4){logger[_0x307a('0x13')](_0x307a('0xe'),_0x4f7631,_0x27c1af[_0x307a('0x13')]['message']);return _0x25dd03(_0x27c1af['error'][_0x307a('0x15')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x4f7631,_0x27c1af[_0x307a('0x13')]['message']);return _0x4a8fec(_0x27c1af[_0x307a('0x13')]['message']);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x4f7631,'request\x20sent');_0x4a8fec(_0x27c1af[_0x307a('0x16')][_0x307a('0x15')]);}})['catch'](function(_0x48f9c5){logger['error'](_0x307a('0xe'),_0x4f7631,_0x48f9c5);_0x25dd03(_0x48f9c5);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index cc4d965..de88492 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 _0x6f47=['show','post','isAuthenticated','create','put','update','delete','destroy','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','/:id'];(function(_0x3ffdbd,_0x49de53){var _0xd3438d=function(_0x3c5382){while(--_0x3c5382){_0x3ffdbd['push'](_0x3ffdbd['shift']());}};_0xd3438d(++_0x49de53);}(_0x6f47,0xc7));var _0x76f4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6f47[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x76f4('0x0'));var path=require(_0x76f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x76f4('0x2'));var router=express['Router']();var fs_extra=require(_0x76f4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var controller=require(_0x76f4('0x6'));router[_0x76f4('0x7')]('/',auth['isAuthenticated'](),controller[_0x76f4('0x8')]);router[_0x76f4('0x7')](_0x76f4('0x9'),auth['isAuthenticated'](),controller[_0x76f4('0xa')]);router[_0x76f4('0xb')]('/',auth[_0x76f4('0xc')](),controller[_0x76f4('0xd')]);router[_0x76f4('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x76f4('0xf')]);router[_0x76f4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x76f4('0x11')]);module[_0x76f4('0x12')]=router; \ No newline at end of file +var _0xae24=['../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','post','put','update','delete','exports','multer','path','express','Router'];(function(_0x440e18,_0xec5859){var _0x184847=function(_0x30ab69){while(--_0x30ab69){_0x440e18['push'](_0x440e18['shift']());}};_0x184847(++_0xec5859);}(_0xae24,0x182));var _0x4ae2=function(_0x523c05,_0x53156c){_0x523c05=_0x523c05-0x0;var _0x44e346=_0xae24[_0x523c05];return _0x44e346;};'use strict';var multer=require(_0x4ae2('0x0'));var util=require('util');var path=require(_0x4ae2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ae2('0x2'));var router=express[_0x4ae2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ae2('0x4'));var config=require('../../config/environment');var controller=require(_0x4ae2('0x5'));router[_0x4ae2('0x6')]('/',auth[_0x4ae2('0x7')](),controller[_0x4ae2('0x8')]);router[_0x4ae2('0x6')](_0x4ae2('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x4ae2('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4ae2('0xb')](_0x4ae2('0x9'),auth['isAuthenticated'](),controller[_0x4ae2('0xc')]);router[_0x4ae2('0xd')](_0x4ae2('0x9'),auth[_0x4ae2('0x7')](),controller['destroy']);module[_0x4ae2('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 727de1e..ab2310e 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 _0x98b7=['sequelize'];(function(_0x84ce83,_0x98461d){var _0x4490be=function(_0x3a9a69){while(--_0x3a9a69){_0x84ce83['push'](_0x84ce83['shift']());}};_0x4490be(++_0x98461d);}(_0x98b7,0xcf));var _0x798b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x98b7[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x798b('0x0'));module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xac75=['sequelize','exports','TEXT'];(function(_0x4bf128,_0x17ba15){var _0x2c21e8=function(_0x1f62ad){while(--_0x1f62ad){_0x4bf128['push'](_0x4bf128['shift']());}};_0x2c21e8(++_0x17ba15);}(_0xac75,0x1b3));var _0x5ac7=function(_0xa2e6f3,_0x1e5734){_0xa2e6f3=_0xa2e6f3-0x0;var _0x4d21cc=_0xac75[_0xa2e6f3];return _0x4d21cc;};'use strict';var Sequelize=require(_0x5ac7('0x0'));module[_0x5ac7('0x1')]={'tree':{'type':Sequelize[_0x5ac7('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 607c9f5..116aac8 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 _0x0f6f=['then','destroy','error','stack','name','send','AnalyticTreeReport','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','catch','show','includeAll','find','create','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update'];(function(_0xa71e17,_0x2a6227){var _0x36c2e5=function(_0xedf8f5){while(--_0xedf8f5){_0xa71e17['push'](_0xa71e17['shift']());}};_0x36c2e5(++_0x2a6227);}(_0x0f6f,0x146));var _0xf0f6=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0x0f6f[_0x1e2080];return _0x260111;};'use strict';var emlformat=require(_0xf0f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0f6('0x1'));var jsonpatch=require(_0xf0f6('0x2'));var rp=require('request-promise');var moment=require(_0xf0f6('0x3'));var BPromise=require(_0xf0f6('0x4'));var Mustache=require(_0xf0f6('0x5'));var util=require('util');var path=require(_0xf0f6('0x6'));var sox=require(_0xf0f6('0x7'));var csv=require(_0xf0f6('0x8'));var ejs=require(_0xf0f6('0x9'));var fs=require('fs');var fs_extra=require(_0xf0f6('0xa'));var _=require('lodash');var squel=require(_0xf0f6('0xb'));var crypto=require(_0xf0f6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf0f6('0xd'));var toCsv=require(_0xf0f6('0x8'));var querystring=require(_0xf0f6('0xe'));var Papa=require(_0xf0f6('0xf'));var Redis=require(_0xf0f6('0x10'));var authService=require(_0xf0f6('0x11'));var qs=require(_0xf0f6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0f6('0x13'));var logger=require(_0xf0f6('0x14'))(_0xf0f6('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cfee9,_0x2ae21d){_0x2ae21d=_0x2ae21d||0xcc;return function(_0x556137){if(_0x556137){return _0x4cfee9[_0xf0f6('0x16')](_0x2ae21d);}return _0x4cfee9[_0xf0f6('0x17')](_0x2ae21d)[_0xf0f6('0x18')]();};}function respondWithResult(_0x5c6061,_0x26f307){_0x26f307=_0x26f307||0xc8;return function(_0x2839ec){if(_0x2839ec){return _0x5c6061[_0xf0f6('0x17')](_0x26f307)[_0xf0f6('0x19')](_0x2839ec);}};}function respondWithFilteredResult(_0x3ac418,_0x29026b){return function(_0x272ed7){if(_0x272ed7){var _0x3f9e90=typeof _0x29026b[_0xf0f6('0x1a')]===_0xf0f6('0x1b')&&typeof _0x29026b[_0xf0f6('0x1c')]===_0xf0f6('0x1b');var _0x1fee45=_0x272ed7['count'];var _0x114afc=_0x3f9e90?0x0:_0x29026b['offset'];var _0x328e29=_0x3f9e90?_0x272ed7[_0xf0f6('0x1d')]:_0x29026b[_0xf0f6('0x1a')]+_0x29026b['limit'];var _0x5ee164;if(_0x328e29>=_0x1fee45){_0x328e29=_0x1fee45;_0x5ee164=0xc8;}else{_0x5ee164=0xce;}_0x3ac418[_0xf0f6('0x17')](_0x5ee164);return _0x3ac418[_0xf0f6('0x1e')](_0xf0f6('0x1f'),_0x114afc+'-'+_0x328e29+'/'+_0x1fee45)[_0xf0f6('0x19')](_0x272ed7);}return null;};}function patchUpdates(_0x575f65){return function(_0x3f137b){try{jsonpatch['apply'](_0x3f137b,_0x575f65,!![]);}catch(_0x52284d){return BPromise['reject'](_0x52284d);}return _0x3f137b[_0xf0f6('0x20')]();};}function saveUpdates(_0x40e460,_0x547a84){return function(_0x16d55b){if(_0x16d55b){return _0x16d55b[_0xf0f6('0x21')](_0x40e460)[_0xf0f6('0x22')](function(_0x210f3d){return _0x210f3d;});}return null;};}function removeEntity(_0xd339d7,_0x27bf58){return function(_0x4e9099){if(_0x4e9099){return _0x4e9099[_0xf0f6('0x23')]()[_0xf0f6('0x22')](function(){_0xd339d7[_0xf0f6('0x17')](0xcc)[_0xf0f6('0x18')]();});}};}function handleEntityNotFound(_0x585ee6,_0x247ff8){return function(_0xac8bfe){if(!_0xac8bfe){_0x585ee6[_0xf0f6('0x16')](0x194);}return _0xac8bfe;};}function handleError(_0x1974f4,_0x142daf){_0x142daf=_0x142daf||0x1f4;return function(_0x4ca0f9){logger[_0xf0f6('0x24')](_0x4ca0f9[_0xf0f6('0x25')]);if(_0x4ca0f9[_0xf0f6('0x26')]){delete _0x4ca0f9['name'];}_0x1974f4[_0xf0f6('0x17')](_0x142daf)[_0xf0f6('0x27')](_0x4ca0f9);};}exports['index']=function(_0x323f11,_0x577705){var _0x4554cd={},_0x3b8c47={},_0x4c9d43={'count':0x0,'rows':[]};var _0x23f745=_['map'](db[_0xf0f6('0x28')][_0xf0f6('0x29')],function(_0x28e8b0){return{'name':_0x28e8b0[_0xf0f6('0x2a')],'type':_0x28e8b0[_0xf0f6('0x2b')]['key']};});_0x3b8c47[_0xf0f6('0x2c')]=_['map'](_0x23f745,_0xf0f6('0x26'));_0x3b8c47['query']=_[_0xf0f6('0x2d')](_0x323f11[_0xf0f6('0x2e')]);_0x3b8c47[_0xf0f6('0x2f')]=_['intersection'](_0x3b8c47[_0xf0f6('0x2c')],_0x3b8c47[_0xf0f6('0x2e')]);_0x4554cd[_0xf0f6('0x30')]=_[_0xf0f6('0x31')](_0x3b8c47[_0xf0f6('0x2c')],qs['fields'](_0x323f11['query'][_0xf0f6('0x32')]));_0x4554cd[_0xf0f6('0x30')]=_0x4554cd['attributes'][_0xf0f6('0x33')]?_0x4554cd['attributes']:_0x3b8c47[_0xf0f6('0x2c')];if(!_0x323f11['query'][_0xf0f6('0x34')](_0xf0f6('0x35'))){_0x4554cd[_0xf0f6('0x1c')]=qs[_0xf0f6('0x1c')](_0x323f11[_0xf0f6('0x2e')][_0xf0f6('0x1c')]);_0x4554cd['offset']=qs[_0xf0f6('0x1a')](_0x323f11[_0xf0f6('0x2e')][_0xf0f6('0x1a')]);}_0x4554cd[_0xf0f6('0x36')]=qs['sort'](_0x323f11[_0xf0f6('0x2e')][_0xf0f6('0x37')]);_0x4554cd[_0xf0f6('0x38')]=qs[_0xf0f6('0x2f')](_[_0xf0f6('0x39')](_0x323f11[_0xf0f6('0x2e')],_0x3b8c47[_0xf0f6('0x2f')]),_0x23f745);if(_0x323f11[_0xf0f6('0x2e')][_0xf0f6('0x3a')]){_0x4554cd['where']=_[_0xf0f6('0x3b')](_0x4554cd[_0xf0f6('0x38')],{'$or':_[_0xf0f6('0x3c')](_0x23f745,function(_0x5ec868){if(_0x5ec868[_0xf0f6('0x2b')]!==_0xf0f6('0x3d')){var _0x1d582f={};_0x1d582f[_0x5ec868[_0xf0f6('0x26')]]={'$like':'%'+_0x323f11[_0xf0f6('0x2e')][_0xf0f6('0x3a')]+'%'};return _0x1d582f;}})});}_0x4554cd=_[_0xf0f6('0x3b')]({},_0x4554cd,_0x323f11[_0xf0f6('0x3e')]);var _0x21af95={'where':_0x4554cd['where']};return db[_0xf0f6('0x28')][_0xf0f6('0x1d')](_0x21af95)['then'](function(_0x28535e){_0x4c9d43[_0xf0f6('0x1d')]=_0x28535e;if(_0x323f11[_0xf0f6('0x2e')]['includeAll']){_0x4554cd[_0xf0f6('0x3f')]=[{'all':!![]}];}return db[_0xf0f6('0x28')][_0xf0f6('0x40')](_0x4554cd);})['then'](function(_0x448757){_0x4c9d43['rows']=_0x448757;return _0x4c9d43;})[_0xf0f6('0x22')](respondWithFilteredResult(_0x577705,_0x4554cd))[_0xf0f6('0x41')](handleError(_0x577705,null));};exports[_0xf0f6('0x42')]=function(_0xfbbbfb,_0xdd8256){var _0x4f10f9={'raw':!![],'where':{'id':_0xfbbbfb['params']['id']}},_0x94fa31={};_0x94fa31[_0xf0f6('0x2c')]=_[_0xf0f6('0x2d')](db[_0xf0f6('0x28')]['rawAttributes']);_0x94fa31[_0xf0f6('0x2e')]=_[_0xf0f6('0x2d')](_0xfbbbfb['query']);_0x94fa31[_0xf0f6('0x2f')]=_['intersection'](_0x94fa31[_0xf0f6('0x2c')],_0x94fa31[_0xf0f6('0x2e')]);_0x4f10f9[_0xf0f6('0x30')]=_['intersection'](_0x94fa31[_0xf0f6('0x2c')],qs['fields'](_0xfbbbfb[_0xf0f6('0x2e')]['fields']));_0x4f10f9['attributes']=_0x4f10f9['attributes'][_0xf0f6('0x33')]?_0x4f10f9[_0xf0f6('0x30')]:_0x94fa31[_0xf0f6('0x2c')];if(_0xfbbbfb[_0xf0f6('0x2e')][_0xf0f6('0x43')]){_0x4f10f9[_0xf0f6('0x3f')]=[{'all':!![]}];}_0x4f10f9=_['merge']({},_0x4f10f9,_0xfbbbfb[_0xf0f6('0x3e')]);return db[_0xf0f6('0x28')][_0xf0f6('0x44')](_0x4f10f9)[_0xf0f6('0x22')](handleEntityNotFound(_0xdd8256,null))[_0xf0f6('0x22')](respondWithResult(_0xdd8256,null))[_0xf0f6('0x41')](handleError(_0xdd8256,null));};exports[_0xf0f6('0x45')]=function(_0x20c60b,_0x50a525){return db[_0xf0f6('0x28')][_0xf0f6('0x45')](_0x20c60b[_0xf0f6('0x46')],{})[_0xf0f6('0x22')](respondWithResult(_0x50a525,0xc9))[_0xf0f6('0x41')](handleError(_0x50a525,null));};exports[_0xf0f6('0x21')]=function(_0x352733,_0x46fbdd){if(_0x352733[_0xf0f6('0x46')]['id']){delete _0x352733['body']['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x352733[_0xf0f6('0x47')]['id']}})[_0xf0f6('0x22')](handleEntityNotFound(_0x46fbdd,null))[_0xf0f6('0x22')](saveUpdates(_0x352733[_0xf0f6('0x46')],null))['then'](respondWithResult(_0x46fbdd,null))[_0xf0f6('0x41')](handleError(_0x46fbdd,null));};exports[_0xf0f6('0x23')]=function(_0xe62319,_0x808352){return db['AnalyticTreeReport'][_0xf0f6('0x44')]({'where':{'id':_0xe62319['params']['id']}})[_0xf0f6('0x22')](handleEntityNotFound(_0x808352,null))[_0xf0f6('0x22')](removeEntity(_0x808352,null))[_0xf0f6('0x41')](handleError(_0x808352,null));}; \ No newline at end of file +var _0x05df=['then','destroy','end','error','stack','name','send','map','AnalyticTreeReport','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','rimraf','fast-json-patch','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update'];(function(_0x391ec5,_0x574eea){var _0x327de5=function(_0x385dcb){while(--_0x385dcb){_0x391ec5['push'](_0x391ec5['shift']());}};_0x327de5(++_0x574eea);}(_0x05df,0x72));var _0xf05d=function(_0x48bebf,_0x3287ab){_0x48bebf=_0x48bebf-0x0;var _0x747e8c=_0x05df[_0x48bebf];return _0x747e8c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf05d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf05d('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf05d('0x2'));var util=require(_0xf05d('0x3'));var path=require(_0xf05d('0x4'));var sox=require('sox');var csv=require(_0xf05d('0x5'));var ejs=require(_0xf05d('0x6'));var fs=require('fs');var fs_extra=require(_0xf05d('0x7'));var _=require(_0xf05d('0x8'));var squel=require(_0xf05d('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf05d('0xa'));var toCsv=require(_0xf05d('0x5'));var querystring=require(_0xf05d('0xb'));var Papa=require(_0xf05d('0xc'));var Redis=require(_0xf05d('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf05d('0xe'));var as=require(_0xf05d('0xf'));var hardwareService=require(_0xf05d('0x10'));var logger=require(_0xf05d('0x11'))('api');var utils=require(_0xf05d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf05d('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4056a9,_0x84ee27){_0x84ee27=_0x84ee27||0xcc;return function(_0x3c65cb){if(_0x3c65cb){return _0x4056a9[_0xf05d('0x14')](_0x84ee27);}return _0x4056a9['status'](_0x84ee27)['end']();};}function respondWithResult(_0xde3fd5,_0x18a61b){_0x18a61b=_0x18a61b||0xc8;return function(_0x17bf2e){if(_0x17bf2e){return _0xde3fd5[_0xf05d('0x15')](_0x18a61b)[_0xf05d('0x16')](_0x17bf2e);}};}function respondWithFilteredResult(_0x533afe,_0x5da83f){return function(_0xe58bb0){if(_0xe58bb0){var _0x4a8693=typeof _0x5da83f[_0xf05d('0x17')]===_0xf05d('0x18')&&typeof _0x5da83f[_0xf05d('0x19')]===_0xf05d('0x18');var _0x23d9e6=_0xe58bb0[_0xf05d('0x1a')];var _0x5da832=_0x4a8693?0x0:_0x5da83f[_0xf05d('0x17')];var _0x4f3e4c=_0x4a8693?_0xe58bb0['count']:_0x5da83f[_0xf05d('0x17')]+_0x5da83f[_0xf05d('0x19')];var _0xd8a4cf;if(_0x4f3e4c>=_0x23d9e6){_0x4f3e4c=_0x23d9e6;_0xd8a4cf=0xc8;}else{_0xd8a4cf=0xce;}_0x533afe['status'](_0xd8a4cf);return _0x533afe[_0xf05d('0x1b')](_0xf05d('0x1c'),_0x5da832+'-'+_0x4f3e4c+'/'+_0x23d9e6)[_0xf05d('0x16')](_0xe58bb0);}return null;};}function patchUpdates(_0x43be25){return function(_0x30588a){try{jsonpatch[_0xf05d('0x1d')](_0x30588a,_0x43be25,!![]);}catch(_0x166533){return BPromise[_0xf05d('0x1e')](_0x166533);}return _0x30588a['save']();};}function saveUpdates(_0xbbc9c9,_0x107a05){return function(_0x5de137){if(_0x5de137){return _0x5de137[_0xf05d('0x1f')](_0xbbc9c9)[_0xf05d('0x20')](function(_0x330184){return _0x330184;});}return null;};}function removeEntity(_0x41dda2,_0x4c19a8){return function(_0x516d29){if(_0x516d29){return _0x516d29[_0xf05d('0x21')]()[_0xf05d('0x20')](function(){_0x41dda2[_0xf05d('0x15')](0xcc)[_0xf05d('0x22')]();});}};}function handleEntityNotFound(_0x174dc9,_0x459ce8){return function(_0x151292){if(!_0x151292){_0x174dc9[_0xf05d('0x14')](0x194);}return _0x151292;};}function handleError(_0x4a7608,_0x1c762b){_0x1c762b=_0x1c762b||0x1f4;return function(_0x2c7b97){logger[_0xf05d('0x23')](_0x2c7b97[_0xf05d('0x24')]);if(_0x2c7b97[_0xf05d('0x25')]){delete _0x2c7b97[_0xf05d('0x25')];}_0x4a7608['status'](_0x1c762b)[_0xf05d('0x26')](_0x2c7b97);};}exports['index']=function(_0x5b6813,_0x2297a6){var _0x3aa60b={},_0x6c6277={},_0xa48c91={'count':0x0,'rows':[]};var _0x20d23a=_[_0xf05d('0x27')](db[_0xf05d('0x28')]['rawAttributes'],function(_0x1a597a){return{'name':_0x1a597a[_0xf05d('0x29')],'type':_0x1a597a[_0xf05d('0x2a')][_0xf05d('0x2b')]};});_0x6c6277['model']=_['map'](_0x20d23a,_0xf05d('0x25'));_0x6c6277[_0xf05d('0x2c')]=_['keys'](_0x5b6813[_0xf05d('0x2c')]);_0x6c6277[_0xf05d('0x2d')]=_['intersection'](_0x6c6277[_0xf05d('0x2e')],_0x6c6277['query']);_0x3aa60b[_0xf05d('0x2f')]=_[_0xf05d('0x30')](_0x6c6277[_0xf05d('0x2e')],qs[_0xf05d('0x31')](_0x5b6813[_0xf05d('0x2c')][_0xf05d('0x31')]));_0x3aa60b[_0xf05d('0x2f')]=_0x3aa60b['attributes'][_0xf05d('0x32')]?_0x3aa60b[_0xf05d('0x2f')]:_0x6c6277['model'];if(!_0x5b6813[_0xf05d('0x2c')][_0xf05d('0x33')](_0xf05d('0x34'))){_0x3aa60b[_0xf05d('0x19')]=qs[_0xf05d('0x19')](_0x5b6813[_0xf05d('0x2c')][_0xf05d('0x19')]);_0x3aa60b['offset']=qs['offset'](_0x5b6813[_0xf05d('0x2c')]['offset']);}_0x3aa60b[_0xf05d('0x35')]=qs[_0xf05d('0x36')](_0x5b6813[_0xf05d('0x2c')][_0xf05d('0x36')]);_0x3aa60b[_0xf05d('0x37')]=qs[_0xf05d('0x2d')](_[_0xf05d('0x38')](_0x5b6813[_0xf05d('0x2c')],_0x6c6277[_0xf05d('0x2d')]),_0x20d23a);if(_0x5b6813['query'][_0xf05d('0x39')]){_0x3aa60b['where']=_[_0xf05d('0x3a')](_0x3aa60b[_0xf05d('0x37')],{'$or':_['map'](_0x20d23a,function(_0xfc011){if(_0xfc011['type']!==_0xf05d('0x3b')){var _0x301fa5={};_0x301fa5[_0xfc011[_0xf05d('0x25')]]={'$like':'%'+_0x5b6813[_0xf05d('0x2c')][_0xf05d('0x39')]+'%'};return _0x301fa5;}})});}_0x3aa60b=_['merge']({},_0x3aa60b,_0x5b6813[_0xf05d('0x3c')]);var _0x612834={'where':_0x3aa60b['where']};return db['AnalyticTreeReport'][_0xf05d('0x1a')](_0x612834)[_0xf05d('0x20')](function(_0xce1562){_0xa48c91[_0xf05d('0x1a')]=_0xce1562;if(_0x5b6813[_0xf05d('0x2c')][_0xf05d('0x3d')]){_0x3aa60b[_0xf05d('0x3e')]=[{'all':!![]}];}return db[_0xf05d('0x28')][_0xf05d('0x3f')](_0x3aa60b);})['then'](function(_0x370ebf){_0xa48c91[_0xf05d('0x40')]=_0x370ebf;return _0xa48c91;})['then'](respondWithFilteredResult(_0x2297a6,_0x3aa60b))[_0xf05d('0x41')](handleError(_0x2297a6,null));};exports[_0xf05d('0x42')]=function(_0x4b2b6b,_0x58ac35){var _0x22de78={'raw':!![],'where':{'id':_0x4b2b6b[_0xf05d('0x43')]['id']}},_0x58f582={};_0x58f582['model']=_[_0xf05d('0x44')](db[_0xf05d('0x28')][_0xf05d('0x45')]);_0x58f582[_0xf05d('0x2c')]=_[_0xf05d('0x44')](_0x4b2b6b[_0xf05d('0x2c')]);_0x58f582[_0xf05d('0x2d')]=_[_0xf05d('0x30')](_0x58f582['model'],_0x58f582['query']);_0x22de78['attributes']=_[_0xf05d('0x30')](_0x58f582[_0xf05d('0x2e')],qs[_0xf05d('0x31')](_0x4b2b6b[_0xf05d('0x2c')][_0xf05d('0x31')]));_0x22de78['attributes']=_0x22de78[_0xf05d('0x2f')][_0xf05d('0x32')]?_0x22de78[_0xf05d('0x2f')]:_0x58f582[_0xf05d('0x2e')];if(_0x4b2b6b['query'][_0xf05d('0x3d')]){_0x22de78[_0xf05d('0x3e')]=[{'all':!![]}];}_0x22de78=_[_0xf05d('0x3a')]({},_0x22de78,_0x4b2b6b[_0xf05d('0x3c')]);return db[_0xf05d('0x28')][_0xf05d('0x46')](_0x22de78)[_0xf05d('0x20')](handleEntityNotFound(_0x58ac35,null))['then'](respondWithResult(_0x58ac35,null))[_0xf05d('0x41')](handleError(_0x58ac35,null));};exports[_0xf05d('0x47')]=function(_0xf5a80b,_0x863161){return db[_0xf05d('0x28')]['create'](_0xf5a80b[_0xf05d('0x48')],{})[_0xf05d('0x20')](respondWithResult(_0x863161,0xc9))[_0xf05d('0x41')](handleError(_0x863161,null));};exports['update']=function(_0x593916,_0x20835f){if(_0x593916[_0xf05d('0x48')]['id']){delete _0x593916[_0xf05d('0x48')]['id'];}return db[_0xf05d('0x28')][_0xf05d('0x46')]({'where':{'id':_0x593916['params']['id']}})[_0xf05d('0x20')](handleEntityNotFound(_0x20835f,null))[_0xf05d('0x20')](saveUpdates(_0x593916['body'],null))[_0xf05d('0x20')](respondWithResult(_0x20835f,null))['catch'](handleError(_0x20835f,null));};exports[_0xf05d('0x21')]=function(_0x40a50a,_0xc7bbe8){return db[_0xf05d('0x28')][_0xf05d('0x46')]({'where':{'id':_0x40a50a[_0xf05d('0x43')]['id']}})[_0xf05d('0x20')](handleEntityNotFound(_0xc7bbe8,null))[_0xf05d('0x20')](removeEntity(_0xc7bbe8,null))[_0xf05d('0x41')](handleError(_0xc7bbe8,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 267b868..ce23968 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 _0x0213=['request-promise','path','rimraf','./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash','util','api','moment','bluebird'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x0213,0x17b));var _0x3021=function(_0xfd9b19,_0x21d75f){_0xfd9b19=_0xfd9b19-0x0;var _0x514918=_0x0213[_0xfd9b19];return _0x514918;};'use strict';var _=require(_0x3021('0x0'));var util=require(_0x3021('0x1'));var logger=require('../../config/logger')(_0x3021('0x2'));var moment=require(_0x3021('0x3'));var BPromise=require(_0x3021('0x4'));var rp=require(_0x3021('0x5'));var fs=require('fs');var path=require(_0x3021('0x6'));var rimraf=require(_0x3021('0x7'));var config=require('../../config/environment');var attributes=require(_0x3021('0x8'));module[_0x3021('0x9')]=function(_0x1693b9,_0x59ef4c){return _0x1693b9[_0x3021('0xa')]('AnalyticTreeReport',attributes,{'tableName':_0x3021('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9778=['bluebird','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','lodash','../../config/logger'];(function(_0xb251f1,_0x51cc0e){var _0x17cb3f=function(_0x4f03e1){while(--_0x4f03e1){_0xb251f1['push'](_0xb251f1['shift']());}};_0x17cb3f(++_0x51cc0e);}(_0x9778,0xcd));var _0x8977=function(_0x44039a,_0x2ac8a8){_0x44039a=_0x44039a-0x0;var _0x525de5=_0x9778[_0x44039a];return _0x525de5;};'use strict';var _=require(_0x8977('0x0'));var util=require('util');var logger=require(_0x8977('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8977('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8977('0x3'));var config=require(_0x8977('0x4'));var attributes=require(_0x8977('0x5'));module[_0x8977('0x6')]=function(_0x559ac6,_0x41882b){return _0x559ac6[_0x8977('0x7')](_0x8977('0x8'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 2ed4557..b5cd0b5 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x13cf69,_0x767b51){var _0x3dd617=function(_0x225252){while(--_0x225252){_0x13cf69['push'](_0x13cf69['shift']());}};_0x3dd617(++_0x767b51);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x5617dd,_0x15ad4f){var _0x92c09f=function(_0x24e678){while(--_0x24e678){_0x5617dd['push'](_0x5617dd['shift']());}};_0x92c09f(++_0x15ad4f);}(_0x1261,0x144));var _0x1126=function(_0x26df48,_0x22aa50){_0x26df48=_0x26df48-0x0;var _0x209047=_0x1261[_0x26df48];return _0x209047;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 3957043..6946dcf 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 _0xe6b0=['/:id','show','post','put','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index'];(function(_0x426783,_0x1e8068){var _0x1be40e=function(_0x3edbd5){while(--_0x3edbd5){_0x426783['push'](_0x426783['shift']());}};_0x1be40e(++_0x1e8068);}(_0xe6b0,0x180));var _0x0e6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe6b0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0e6b('0x0'));var util=require(_0x0e6b('0x1'));var path=require(_0x0e6b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0e6b('0x3')]();var fs_extra=require(_0x0e6b('0x4'));var auth=require(_0x0e6b('0x5'));var interaction=require(_0x0e6b('0x6'));var config=require(_0x0e6b('0x7'));var controller=require(_0x0e6b('0x8'));router[_0x0e6b('0x9')]('/',auth[_0x0e6b('0xa')](),controller[_0x0e6b('0xb')]);router[_0x0e6b('0x9')](_0x0e6b('0xc'),auth[_0x0e6b('0xa')](),controller[_0x0e6b('0xd')]);router[_0x0e6b('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0e6b('0xf')](_0x0e6b('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x0e6b('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x0e6b('0x11')]=router; \ No newline at end of file +var _0xec61=['./analyticTreeReport.controller','isAuthenticated','index','get','/:id','post','create','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x47d21a,_0x2ccfa2){var _0x1de45e=function(_0x5667e1){while(--_0x5667e1){_0x47d21a['push'](_0x47d21a['shift']());}};_0x1de45e(++_0x2ccfa2);}(_0xec61,0x1d6));var _0x1ec6=function(_0x2710f9,_0x590ca1){_0x2710f9=_0x2710f9-0x0;var _0x51d93b=_0xec61[_0x2710f9];return _0x51d93b;};'use strict';var multer=require(_0x1ec6('0x0'));var util=require('util');var path=require(_0x1ec6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1ec6('0x2')]();var fs_extra=require(_0x1ec6('0x3'));var auth=require(_0x1ec6('0x4'));var interaction=require(_0x1ec6('0x5'));var config=require('../../config/environment');var controller=require(_0x1ec6('0x6'));router['get']('/',auth[_0x1ec6('0x7')](),controller[_0x1ec6('0x8')]);router[_0x1ec6('0x9')](_0x1ec6('0xa'),auth[_0x1ec6('0x7')](),controller['show']);router[_0x1ec6('0xb')]('/',auth[_0x1ec6('0x7')](),controller[_0x1ec6('0xc')]);router['put'](_0x1ec6('0xa'),auth['isAuthenticated'](),controller[_0x1ec6('0xd')]);router[_0x1ec6('0xe')]('/:id',auth[_0x1ec6('0x7')](),controller[_0x1ec6('0xf')]);module[_0x1ec6('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 6f635bb..d45ed5b 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 _0x257e=['exports','STRING'];(function(_0x199392,_0x5192e1){var _0xaf70c8=function(_0x1c55c4){while(--_0x1c55c4){_0x199392['push'](_0x199392['shift']());}};_0xaf70c8(++_0x5192e1);}(_0x257e,0x1dc));var _0xe257=function(_0x1e17eb,_0x2e15c5){_0x1e17eb=_0x1e17eb-0x0;var _0x4de4c7=_0x257e[_0x1e17eb];return _0x4de4c7;};'use strict';var Sequelize=require('sequelize');module[_0xe257('0x0')]={'name':{'type':Sequelize[_0xe257('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe257('0x1')]}}; \ No newline at end of file +var _0x2bbb=['STRING','exports'];(function(_0x5c2e65,_0x20e630){var _0x445359=function(_0x2588d4){while(--_0x2588d4){_0x5c2e65['push'](_0x5c2e65['shift']());}};_0x445359(++_0x20e630);}(_0x2bbb,0x85));var _0xb2bb=function(_0x2c73fb,_0xddad1a){_0x2c73fb=_0x2c73fb-0x0;var _0x10e6e9=_0x2bbb[_0x2c73fb];return _0x10e6e9;};'use strict';var Sequelize=require('sequelize');module[_0xb2bb('0x0')]={'name':{'type':Sequelize[_0xb2bb('0x1')]},'basename':{'type':Sequelize[_0xb2bb('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 97a9ad5..57b4901 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 _0x544e=['../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','sendStatus','error','stack','name','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filter','merge','includeAll','findAll','rows','catch','show','params','options','find','clone','include','get','updatedAt','body','omit','createdAt','create','update','destroy','file','originalname','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util'];(function(_0x27bcf5,_0x236765){var _0x4ce4cf=function(_0x4864ea){while(--_0x4864ea){_0x27bcf5['push'](_0x27bcf5['shift']());}};_0x4ce4cf(++_0x236765);}(_0x544e,0x9f));var _0xe544=function(_0x1fc2ff,_0x1b8c1f){_0x1fc2ff=_0x1fc2ff-0x0;var _0x5d7d8a=_0x544e[_0x1fc2ff];return _0x5d7d8a;};'use strict';var emlformat=require(_0xe544('0x0'));var rimraf=require(_0xe544('0x1'));var zipdir=require(_0xe544('0x2'));var jsonpatch=require(_0xe544('0x3'));var rp=require('request-promise');var moment=require(_0xe544('0x4'));var BPromise=require(_0xe544('0x5'));var Mustache=require(_0xe544('0x6'));var util=require(_0xe544('0x7'));var path=require(_0xe544('0x8'));var sox=require(_0xe544('0x9'));var csv=require(_0xe544('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe544('0xb'));var _=require('lodash');var squel=require(_0xe544('0xc'));var crypto=require('crypto');var jsforce=require(_0xe544('0xd'));var deskjs=require(_0xe544('0xe'));var toCsv=require(_0xe544('0xa'));var querystring=require(_0xe544('0xf'));var Papa=require(_0xe544('0x10'));var Redis=require(_0xe544('0x11'));var authService=require(_0xe544('0x12'));var qs=require(_0xe544('0x13'));var as=require(_0xe544('0x14'));var hardwareService=require(_0xe544('0x15'));var logger=require(_0xe544('0x16'))(_0xe544('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe544('0x18'));var db=require(_0xe544('0x19'))['db'];function respondWithStatusCode(_0x502eea,_0x38c565){_0x38c565=_0x38c565||0xcc;return function(_0x23fb27){if(_0x23fb27){return _0x502eea['sendStatus'](_0x38c565);}return _0x502eea[_0xe544('0x1a')](_0x38c565)[_0xe544('0x1b')]();};}function respondWithResult(_0x1c0361,_0x30d35b){_0x30d35b=_0x30d35b||0xc8;return function(_0x29fdfd){if(_0x29fdfd){return _0x1c0361['status'](_0x30d35b)[_0xe544('0x1c')](_0x29fdfd);}};}function respondWithFilteredResult(_0x3a0d97,_0x4dc40d){return function(_0x2545d3){if(_0x2545d3){var _0x1cc87b=typeof _0x4dc40d['offset']===_0xe544('0x1d')&&typeof _0x4dc40d[_0xe544('0x1e')]==='undefined';var _0x22766e=_0x2545d3[_0xe544('0x1f')];var _0x1da09f=_0x1cc87b?0x0:_0x4dc40d[_0xe544('0x20')];var _0x463f8e=_0x1cc87b?_0x2545d3[_0xe544('0x1f')]:_0x4dc40d['offset']+_0x4dc40d[_0xe544('0x1e')];var _0x360580;if(_0x463f8e>=_0x22766e){_0x463f8e=_0x22766e;_0x360580=0xc8;}else{_0x360580=0xce;}_0x3a0d97[_0xe544('0x1a')](_0x360580);return _0x3a0d97[_0xe544('0x21')](_0xe544('0x22'),_0x1da09f+'-'+_0x463f8e+'/'+_0x22766e)[_0xe544('0x1c')](_0x2545d3);}return null;};}function patchUpdates(_0x7abf66){return function(_0xd25bc8){try{jsonpatch[_0xe544('0x23')](_0xd25bc8,_0x7abf66,!![]);}catch(_0x10a379){return BPromise[_0xe544('0x24')](_0x10a379);}return _0xd25bc8['save']();};}function saveUpdates(_0x4c35d5,_0xeb5096){return function(_0x31e23f){if(_0x31e23f){return _0x31e23f['update'](_0x4c35d5)['then'](function(_0x17a2dc){return _0x17a2dc;});}return null;};}function removeEntity(_0x4fcb32,_0x592920){return function(_0x3fe3bd){if(_0x3fe3bd){return _0x3fe3bd['destroy']()[_0xe544('0x25')](function(){_0x4fcb32[_0xe544('0x1a')](0xcc)[_0xe544('0x1b')]();});}};}function handleEntityNotFound(_0x59a668,_0x3dec32){return function(_0x35a74d){if(!_0x35a74d){_0x59a668[_0xe544('0x26')](0x194);}return _0x35a74d;};}function handleError(_0x5b3b6a,_0x394883){_0x394883=_0x394883||0x1f4;return function(_0x1202bc){logger[_0xe544('0x27')](_0x1202bc[_0xe544('0x28')]);if(_0x1202bc['name']){delete _0x1202bc[_0xe544('0x29')];}_0x5b3b6a['status'](_0x394883)['send'](_0x1202bc);};}exports[_0xe544('0x2a')]=function(_0x1e5cca,_0x5e7693){var _0x231edf={},_0x15af7e={},_0x1b4057={'count':0x0,'rows':[]};var _0x4aa598=_[_0xe544('0x2b')](db[_0xe544('0x2c')][_0xe544('0x2d')],function(_0x45450a){return{'name':_0x45450a[_0xe544('0x2e')],'type':_0x45450a[_0xe544('0x2f')][_0xe544('0x30')]};});_0x15af7e[_0xe544('0x31')]=_[_0xe544('0x2b')](_0x4aa598,'name');_0x15af7e[_0xe544('0x32')]=_[_0xe544('0x33')](_0x1e5cca[_0xe544('0x32')]);_0x15af7e[_0xe544('0x34')]=_[_0xe544('0x35')](_0x15af7e['model'],_0x15af7e[_0xe544('0x32')]);_0x231edf[_0xe544('0x36')]=_[_0xe544('0x35')](_0x15af7e[_0xe544('0x31')],qs[_0xe544('0x37')](_0x1e5cca[_0xe544('0x32')][_0xe544('0x37')]));_0x231edf[_0xe544('0x36')]=_0x231edf[_0xe544('0x36')][_0xe544('0x38')]?_0x231edf[_0xe544('0x36')]:_0x15af7e[_0xe544('0x31')];if(!_0x1e5cca[_0xe544('0x32')][_0xe544('0x39')](_0xe544('0x3a'))){_0x231edf[_0xe544('0x1e')]=qs[_0xe544('0x1e')](_0x1e5cca[_0xe544('0x32')][_0xe544('0x1e')]);_0x231edf['offset']=qs[_0xe544('0x20')](_0x1e5cca[_0xe544('0x32')][_0xe544('0x20')]);}_0x231edf['order']=qs['sort'](_0x1e5cca['query']['sort']);_0x231edf[_0xe544('0x3b')]=qs[_0xe544('0x34')](_['pick'](_0x1e5cca[_0xe544('0x32')],_0x15af7e['filters']),_0x4aa598);if(_0x1e5cca[_0xe544('0x32')][_0xe544('0x3c')]){_0x231edf[_0xe544('0x3b')]=_['merge'](_0x231edf['where'],{'$or':_[_0xe544('0x2b')](_0x4aa598,function(_0x1719ed){if(_0x1719ed[_0xe544('0x2f')]!=='VIRTUAL'){var _0x13e944={};_0x13e944[_0x1719ed[_0xe544('0x29')]]={'$like':'%'+_0x1e5cca['query'][_0xe544('0x3c')]+'%'};return _0x13e944;}})});}_0x231edf=_[_0xe544('0x3d')]({},_0x231edf,_0x1e5cca['options']);var _0x5080c={'where':_0x231edf[_0xe544('0x3b')]};return db[_0xe544('0x2c')][_0xe544('0x1f')](_0x5080c)[_0xe544('0x25')](function(_0x1a1036){_0x1b4057[_0xe544('0x1f')]=_0x1a1036;if(_0x1e5cca['query'][_0xe544('0x3e')]){_0x231edf['include']=[{'all':!![]}];}return db[_0xe544('0x2c')][_0xe544('0x3f')](_0x231edf);})[_0xe544('0x25')](function(_0x2f8dc2){_0x1b4057[_0xe544('0x40')]=_0x2f8dc2;return _0x1b4057;})[_0xe544('0x25')](respondWithFilteredResult(_0x5e7693,_0x231edf))[_0xe544('0x41')](handleError(_0x5e7693,null));};exports[_0xe544('0x42')]=function(_0x3b8197,_0x3d6519){var _0x59a9bb={'raw':!![],'where':{'id':_0x3b8197[_0xe544('0x43')]['id']}},_0x5d6ce4={};_0x5d6ce4[_0xe544('0x31')]=_[_0xe544('0x33')](db[_0xe544('0x2c')]['rawAttributes']);_0x5d6ce4[_0xe544('0x32')]=_[_0xe544('0x33')](_0x3b8197[_0xe544('0x32')]);_0x5d6ce4[_0xe544('0x34')]=_['intersection'](_0x5d6ce4['model'],_0x5d6ce4[_0xe544('0x32')]);_0x59a9bb[_0xe544('0x36')]=_['intersection'](_0x5d6ce4['model'],qs[_0xe544('0x37')](_0x3b8197[_0xe544('0x32')][_0xe544('0x37')]));_0x59a9bb['attributes']=_0x59a9bb[_0xe544('0x36')]['length']?_0x59a9bb[_0xe544('0x36')]:_0x5d6ce4[_0xe544('0x31')];if(_0x3b8197[_0xe544('0x32')][_0xe544('0x3e')]){_0x59a9bb['include']=[{'all':!![]}];}_0x59a9bb=_[_0xe544('0x3d')]({},_0x59a9bb,_0x3b8197[_0xe544('0x44')]);return db[_0xe544('0x2c')][_0xe544('0x45')](_0x59a9bb)[_0xe544('0x25')](handleEntityNotFound(_0x3d6519,null))[_0xe544('0x25')](respondWithResult(_0x3d6519,null))[_0xe544('0x41')](handleError(_0x3d6519,null));};exports[_0xe544('0x46')]=function(_0x432c27,_0x57f676){var _0x1c9906={'where':{'id':_0x432c27[_0xe544('0x43')]['id']}},_0x4ae1f1={};_0x4ae1f1[_0xe544('0x31')]=_['keys'](db[_0xe544('0x2c')][_0xe544('0x2d')]);_0x1c9906['attributes']=_['intersection'](_0x4ae1f1[_0xe544('0x31')],qs['fields'](_0x432c27[_0xe544('0x32')][_0xe544('0x37')]));_0x1c9906[_0xe544('0x36')]=_0x1c9906[_0xe544('0x36')]['length']?_0x1c9906[_0xe544('0x36')]:_0x4ae1f1[_0xe544('0x31')];if(_0x432c27[_0xe544('0x32')]['includeAll']){_0x1c9906[_0xe544('0x47')]=[{'all':!![]}];}_0x1c9906=_[_0xe544('0x3d')]({},_0x1c9906,_0x432c27['options']);return db['Attachment']['find'](_0x1c9906)[_0xe544('0x25')](handleEntityNotFound(_0x57f676,null))['then'](function(_0x36d59c){if(_0x36d59c){var _0x6a7c2c=_0x36d59c[_0xe544('0x48')]({'plain':!![]});_0x6a7c2c=qs['omit'](_0x6a7c2c,['id','createdAt',_0xe544('0x49')]);_0x432c27[_0xe544('0x4a')]=_[_0xe544('0x4b')](_0x432c27['body'],['id',_0xe544('0x4c'),_0xe544('0x49')]);return db['Attachment'][_0xe544('0x4d')](_['merge'](_0x6a7c2c,_0x432c27['body']),{'include':_0x432c27[_0xe544('0x32')]['includeAll']?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x57f676,0xc9))[_0xe544('0x41')](handleError(_0x57f676,null));};exports[_0xe544('0x4e')]=function(_0x27f497,_0x23e4e9){if(_0x27f497[_0xe544('0x4a')]['id']){delete _0x27f497[_0xe544('0x4a')]['id'];}return db[_0xe544('0x2c')][_0xe544('0x45')]({'where':{'id':_0x27f497['params']['id']}})[_0xe544('0x25')](handleEntityNotFound(_0x23e4e9,null))[_0xe544('0x25')](saveUpdates(_0x27f497[_0xe544('0x4a')],null))[_0xe544('0x25')](respondWithResult(_0x23e4e9,null))['catch'](handleError(_0x23e4e9,null));};exports[_0xe544('0x4f')]=function(_0x2f59d9,_0x3e83cb){return db[_0xe544('0x2c')][_0xe544('0x45')]({'where':{'id':_0x2f59d9['params']['id']}})[_0xe544('0x25')](handleEntityNotFound(_0x3e83cb,null))[_0xe544('0x25')](removeEntity(_0x3e83cb,null))[_0xe544('0x41')](handleError(_0x3e83cb,null));};exports[_0xe544('0x4d')]=function(_0x496aca,_0x4be5b8,_0x761cac){_0x496aca[_0xe544('0x4a')][_0xe544('0x29')]=_0x496aca[_0xe544('0x50')][_0xe544('0x51')];_0x496aca[_0xe544('0x4a')]['basename']=_0x496aca[_0xe544('0x50')][_0xe544('0x52')];_0x496aca['body'][_0xe544('0x2f')]=_0x496aca['file'][_0xe544('0x53')];return db[_0xe544('0x2c')][_0xe544('0x4d')](_0x496aca[_0xe544('0x4a')])[_0xe544('0x25')](respondWithResult(_0x4be5b8,0xc9))[_0xe544('0x41')](handleError(_0x4be5b8,null));};exports[_0xe544('0x54')]=function(_0x14908b,_0x2e9e9d,_0x8a362c){return db[_0xe544('0x2c')][_0xe544('0x55')]({'where':{'id':_0x14908b['params']['id']},'raw':!![]})[_0xe544('0x25')](handleEntityNotFound(_0x2e9e9d,null))['then'](function(_0x174c15){if(_0x174c15){var _0x13f4a1=_0x174c15[_0xe544('0x56')]!==null;var _0x339ac3=path[_0xe544('0x57')](config[_0xe544('0x58')],_0xe544('0x59'));if(_0x13f4a1){_0x339ac3=path[_0xe544('0x57')](_0x339ac3,_0xe544('0x5a'));}var _0x36cb21=path[_0xe544('0x57')](_0x339ac3,_0x174c15[_0xe544('0x5b')]);return _0x2e9e9d[_0xe544('0x54')](_0x36cb21);}})[_0xe544('0x41')](handleError(_0x2e9e9d,null));}; \ No newline at end of file +var _0x0d36=['reject','save','update','then','error','stack','name','send','index','map','Attachment','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','rawAttributes','omit','createdAt','updatedAt','create','body','destroy','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply'];(function(_0x3a128a,_0x3e9bc2){var _0x59f104=function(_0x931e0d){while(--_0x931e0d){_0x3a128a['push'](_0x3a128a['shift']());}};_0x59f104(++_0x3e9bc2);}(_0x0d36,0x148));var _0x60d3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0d36[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x60d3('0x0'));var rimraf=require(_0x60d3('0x1'));var zipdir=require(_0x60d3('0x2'));var jsonpatch=require(_0x60d3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x60d3('0x4'));var Mustache=require('mustache');var util=require(_0x60d3('0x5'));var path=require(_0x60d3('0x6'));var sox=require(_0x60d3('0x7'));var csv=require(_0x60d3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x60d3('0x9'));var _=require(_0x60d3('0xa'));var squel=require(_0x60d3('0xb'));var crypto=require(_0x60d3('0xc'));var jsforce=require(_0x60d3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x60d3('0x8'));var querystring=require('querystring');var Papa=require(_0x60d3('0xe'));var Redis=require(_0x60d3('0xf'));var authService=require(_0x60d3('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x60d3('0x11'));var logger=require(_0x60d3('0x12'))(_0x60d3('0x13'));var utils=require(_0x60d3('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x60d3('0x15'))['db'];function respondWithStatusCode(_0x243836,_0x538230){_0x538230=_0x538230||0xcc;return function(_0x3d32de){if(_0x3d32de){return _0x243836[_0x60d3('0x16')](_0x538230);}return _0x243836['status'](_0x538230)[_0x60d3('0x17')]();};}function respondWithResult(_0x32be75,_0x37a3d3){_0x37a3d3=_0x37a3d3||0xc8;return function(_0xb00308){if(_0xb00308){return _0x32be75[_0x60d3('0x18')](_0x37a3d3)[_0x60d3('0x19')](_0xb00308);}};}function respondWithFilteredResult(_0x7a2695,_0x1ffe5b){return function(_0xfb086b){if(_0xfb086b){var _0x586e5f=typeof _0x1ffe5b[_0x60d3('0x1a')]==='undefined'&&typeof _0x1ffe5b[_0x60d3('0x1b')]===_0x60d3('0x1c');var _0x116e1f=_0xfb086b[_0x60d3('0x1d')];var _0x223c73=_0x586e5f?0x0:_0x1ffe5b['offset'];var _0x31cd78=_0x586e5f?_0xfb086b[_0x60d3('0x1d')]:_0x1ffe5b['offset']+_0x1ffe5b[_0x60d3('0x1b')];var _0x1d5133;if(_0x31cd78>=_0x116e1f){_0x31cd78=_0x116e1f;_0x1d5133=0xc8;}else{_0x1d5133=0xce;}_0x7a2695['status'](_0x1d5133);return _0x7a2695[_0x60d3('0x1e')]('Content-Range',_0x223c73+'-'+_0x31cd78+'/'+_0x116e1f)['json'](_0xfb086b);}return null;};}function patchUpdates(_0x2707a8){return function(_0x3a2545){try{jsonpatch[_0x60d3('0x1f')](_0x3a2545,_0x2707a8,!![]);}catch(_0x454fd3){return BPromise[_0x60d3('0x20')](_0x454fd3);}return _0x3a2545[_0x60d3('0x21')]();};}function saveUpdates(_0x4b48d3,_0x34d410){return function(_0x67e8cf){if(_0x67e8cf){return _0x67e8cf[_0x60d3('0x22')](_0x4b48d3)[_0x60d3('0x23')](function(_0x50412a){return _0x50412a;});}return null;};}function removeEntity(_0x80c96d,_0x5a2816){return function(_0x40ea3d){if(_0x40ea3d){return _0x40ea3d['destroy']()[_0x60d3('0x23')](function(){_0x80c96d[_0x60d3('0x18')](0xcc)[_0x60d3('0x17')]();});}};}function handleEntityNotFound(_0x232391,_0x14025c){return function(_0x36a6b8){if(!_0x36a6b8){_0x232391[_0x60d3('0x16')](0x194);}return _0x36a6b8;};}function handleError(_0x5cd893,_0x1ec5cd){_0x1ec5cd=_0x1ec5cd||0x1f4;return function(_0x31e98d){logger[_0x60d3('0x24')](_0x31e98d[_0x60d3('0x25')]);if(_0x31e98d['name']){delete _0x31e98d[_0x60d3('0x26')];}_0x5cd893['status'](_0x1ec5cd)[_0x60d3('0x27')](_0x31e98d);};}exports[_0x60d3('0x28')]=function(_0x1bc40a,_0x58b364){var _0x5abdbe={},_0x32398a={},_0xab8eea={'count':0x0,'rows':[]};var _0x27843c=_[_0x60d3('0x29')](db[_0x60d3('0x2a')]['rawAttributes'],function(_0x42123c){return{'name':_0x42123c[_0x60d3('0x2b')],'type':_0x42123c[_0x60d3('0x2c')][_0x60d3('0x2d')]};});_0x32398a['model']=_['map'](_0x27843c,_0x60d3('0x26'));_0x32398a[_0x60d3('0x2e')]=_[_0x60d3('0x2f')](_0x1bc40a['query']);_0x32398a[_0x60d3('0x30')]=_[_0x60d3('0x31')](_0x32398a[_0x60d3('0x32')],_0x32398a[_0x60d3('0x2e')]);_0x5abdbe['attributes']=_[_0x60d3('0x31')](_0x32398a[_0x60d3('0x32')],qs[_0x60d3('0x33')](_0x1bc40a[_0x60d3('0x2e')]['fields']));_0x5abdbe[_0x60d3('0x34')]=_0x5abdbe[_0x60d3('0x34')][_0x60d3('0x35')]?_0x5abdbe['attributes']:_0x32398a['model'];if(!_0x1bc40a['query'][_0x60d3('0x36')](_0x60d3('0x37'))){_0x5abdbe['limit']=qs['limit'](_0x1bc40a['query'][_0x60d3('0x1b')]);_0x5abdbe[_0x60d3('0x1a')]=qs[_0x60d3('0x1a')](_0x1bc40a['query'][_0x60d3('0x1a')]);}_0x5abdbe[_0x60d3('0x38')]=qs[_0x60d3('0x39')](_0x1bc40a[_0x60d3('0x2e')][_0x60d3('0x39')]);_0x5abdbe[_0x60d3('0x3a')]=qs[_0x60d3('0x30')](_[_0x60d3('0x3b')](_0x1bc40a[_0x60d3('0x2e')],_0x32398a['filters']),_0x27843c);if(_0x1bc40a[_0x60d3('0x2e')][_0x60d3('0x3c')]){_0x5abdbe[_0x60d3('0x3a')]=_[_0x60d3('0x3d')](_0x5abdbe[_0x60d3('0x3a')],{'$or':_['map'](_0x27843c,function(_0x26be0e){if(_0x26be0e[_0x60d3('0x2c')]!==_0x60d3('0x3e')){var _0x364c1a={};_0x364c1a[_0x26be0e[_0x60d3('0x26')]]={'$like':'%'+_0x1bc40a['query'][_0x60d3('0x3c')]+'%'};return _0x364c1a;}})});}_0x5abdbe=_['merge']({},_0x5abdbe,_0x1bc40a[_0x60d3('0x3f')]);var _0x1b21af={'where':_0x5abdbe[_0x60d3('0x3a')]};return db[_0x60d3('0x2a')][_0x60d3('0x1d')](_0x1b21af)[_0x60d3('0x23')](function(_0x423277){_0xab8eea[_0x60d3('0x1d')]=_0x423277;if(_0x1bc40a[_0x60d3('0x2e')][_0x60d3('0x40')]){_0x5abdbe[_0x60d3('0x41')]=[{'all':!![]}];}return db[_0x60d3('0x2a')][_0x60d3('0x42')](_0x5abdbe);})['then'](function(_0x34d3b4){_0xab8eea[_0x60d3('0x43')]=_0x34d3b4;return _0xab8eea;})[_0x60d3('0x23')](respondWithFilteredResult(_0x58b364,_0x5abdbe))[_0x60d3('0x44')](handleError(_0x58b364,null));};exports['show']=function(_0x563389,_0x48397f){var _0x2ff1b9={'raw':!![],'where':{'id':_0x563389[_0x60d3('0x45')]['id']}},_0x55b8fe={};_0x55b8fe[_0x60d3('0x32')]=_[_0x60d3('0x2f')](db[_0x60d3('0x2a')]['rawAttributes']);_0x55b8fe[_0x60d3('0x2e')]=_[_0x60d3('0x2f')](_0x563389[_0x60d3('0x2e')]);_0x55b8fe['filters']=_[_0x60d3('0x31')](_0x55b8fe[_0x60d3('0x32')],_0x55b8fe[_0x60d3('0x2e')]);_0x2ff1b9[_0x60d3('0x34')]=_[_0x60d3('0x31')](_0x55b8fe[_0x60d3('0x32')],qs[_0x60d3('0x33')](_0x563389[_0x60d3('0x2e')][_0x60d3('0x33')]));_0x2ff1b9[_0x60d3('0x34')]=_0x2ff1b9[_0x60d3('0x34')][_0x60d3('0x35')]?_0x2ff1b9[_0x60d3('0x34')]:_0x55b8fe[_0x60d3('0x32')];if(_0x563389[_0x60d3('0x2e')][_0x60d3('0x40')]){_0x2ff1b9[_0x60d3('0x41')]=[{'all':!![]}];}_0x2ff1b9=_[_0x60d3('0x3d')]({},_0x2ff1b9,_0x563389[_0x60d3('0x3f')]);return db[_0x60d3('0x2a')][_0x60d3('0x46')](_0x2ff1b9)[_0x60d3('0x23')](handleEntityNotFound(_0x48397f,null))[_0x60d3('0x23')](respondWithResult(_0x48397f,null))['catch'](handleError(_0x48397f,null));};exports['clone']=function(_0x387f46,_0x6f832e){var _0x50fedd={'where':{'id':_0x387f46[_0x60d3('0x45')]['id']}},_0x144041={};_0x144041[_0x60d3('0x32')]=_['keys'](db[_0x60d3('0x2a')][_0x60d3('0x47')]);_0x50fedd[_0x60d3('0x34')]=_[_0x60d3('0x31')](_0x144041[_0x60d3('0x32')],qs[_0x60d3('0x33')](_0x387f46[_0x60d3('0x2e')][_0x60d3('0x33')]));_0x50fedd[_0x60d3('0x34')]=_0x50fedd[_0x60d3('0x34')]['length']?_0x50fedd['attributes']:_0x144041[_0x60d3('0x32')];if(_0x387f46['query']['includeAll']){_0x50fedd['include']=[{'all':!![]}];}_0x50fedd=_[_0x60d3('0x3d')]({},_0x50fedd,_0x387f46['options']);return db[_0x60d3('0x2a')][_0x60d3('0x46')](_0x50fedd)[_0x60d3('0x23')](handleEntityNotFound(_0x6f832e,null))[_0x60d3('0x23')](function(_0x4f959b){if(_0x4f959b){var _0x1a481d=_0x4f959b['get']({'plain':!![]});_0x1a481d=qs[_0x60d3('0x48')](_0x1a481d,['id',_0x60d3('0x49'),_0x60d3('0x4a')]);_0x387f46['body']=_[_0x60d3('0x48')](_0x387f46['body'],['id',_0x60d3('0x49'),_0x60d3('0x4a')]);return db[_0x60d3('0x2a')][_0x60d3('0x4b')](_['merge'](_0x1a481d,_0x387f46[_0x60d3('0x4c')]),{'include':_0x387f46[_0x60d3('0x2e')][_0x60d3('0x40')]?[{'all':!![]}]:undefined});}})[_0x60d3('0x23')](respondWithResult(_0x6f832e,0xc9))[_0x60d3('0x44')](handleError(_0x6f832e,null));};exports[_0x60d3('0x22')]=function(_0x45a130,_0xe77502){if(_0x45a130[_0x60d3('0x4c')]['id']){delete _0x45a130[_0x60d3('0x4c')]['id'];}return db[_0x60d3('0x2a')]['find']({'where':{'id':_0x45a130[_0x60d3('0x45')]['id']}})[_0x60d3('0x23')](handleEntityNotFound(_0xe77502,null))[_0x60d3('0x23')](saveUpdates(_0x45a130[_0x60d3('0x4c')],null))[_0x60d3('0x23')](respondWithResult(_0xe77502,null))[_0x60d3('0x44')](handleError(_0xe77502,null));};exports[_0x60d3('0x4d')]=function(_0x5d77a2,_0x5c9c70){return db[_0x60d3('0x2a')]['find']({'where':{'id':_0x5d77a2[_0x60d3('0x45')]['id']}})[_0x60d3('0x23')](handleEntityNotFound(_0x5c9c70,null))['then'](removeEntity(_0x5c9c70,null))['catch'](handleError(_0x5c9c70,null));};exports['create']=function(_0xda2080,_0x56d0b0,_0x52d029){_0xda2080[_0x60d3('0x4c')][_0x60d3('0x26')]=_0xda2080[_0x60d3('0x4e')][_0x60d3('0x4f')];_0xda2080[_0x60d3('0x4c')][_0x60d3('0x50')]=_0xda2080['file'][_0x60d3('0x51')];_0xda2080[_0x60d3('0x4c')][_0x60d3('0x2c')]=_0xda2080[_0x60d3('0x4e')][_0x60d3('0x52')];return db[_0x60d3('0x2a')][_0x60d3('0x4b')](_0xda2080[_0x60d3('0x4c')])[_0x60d3('0x23')](respondWithResult(_0x56d0b0,0xc9))[_0x60d3('0x44')](handleError(_0x56d0b0,null));};exports[_0x60d3('0x53')]=function(_0x19f07f,_0x5d1be5,_0x23d4b9){return db[_0x60d3('0x2a')][_0x60d3('0x54')]({'where':{'id':_0x19f07f['params']['id']},'raw':!![]})[_0x60d3('0x23')](handleEntityNotFound(_0x5d1be5,null))[_0x60d3('0x23')](function(_0x75ce84){if(_0x75ce84){var _0x3f4fe8=_0x75ce84[_0x60d3('0x55')]!==null;var _0x34d0e6=path[_0x60d3('0x56')](config[_0x60d3('0x57')],_0x60d3('0x58'));if(_0x3f4fe8){_0x34d0e6=path['join'](_0x34d0e6,_0x60d3('0x59'));}var _0x3c061e=path['join'](_0x34d0e6,_0x75ce84[_0x60d3('0x50')]);return _0x5d1be5[_0x60d3('0x53')](_0x3c061e);}})[_0x60d3('0x44')](handleError(_0x5d1be5,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 0332fe2..ce24855 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 _0xa063=['api','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','attachments','util','../../config/logger'];(function(_0x484fc9,_0x4598aa){var _0x89aa01=function(_0x5256e1){while(--_0x5256e1){_0x484fc9['push'](_0x484fc9['shift']());}};_0x89aa01(++_0x4598aa);}(_0xa063,0x166));var _0x3a06=function(_0x505168,_0x46cd26){_0x505168=_0x505168-0x0;var _0x3e73c0=_0xa063[_0x505168];return _0x3e73c0;};'use strict';var _=require('lodash');var util=require(_0x3a06('0x0'));var logger=require(_0x3a06('0x1'))(_0x3a06('0x2'));var moment=require('moment');var BPromise=require(_0x3a06('0x3'));var rp=require(_0x3a06('0x4'));var fs=require('fs');var path=require(_0x3a06('0x5'));var rimraf=require(_0x3a06('0x6'));var config=require(_0x3a06('0x7'));var attributes=require(_0x3a06('0x8'));module[_0x3a06('0x9')]=function(_0x4eb3e3,_0x304da9){return _0x4eb3e3[_0x3a06('0xa')]('Attachment',attributes,{'tableName':_0x3a06('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb90=['bluebird','path','rimraf','../../config/environment','exports','define','util','api'];(function(_0x36a2be,_0x5c1d80){var _0x2cf441=function(_0x2939a6){while(--_0x2939a6){_0x36a2be['push'](_0x36a2be['shift']());}};_0x2cf441(++_0x5c1d80);}(_0xfb90,0xa6));var _0x0fb9=function(_0x15bf58,_0x170ea4){_0x15bf58=_0x15bf58-0x0;var _0x5d6c96=_0xfb90[_0x15bf58];return _0x5d6c96;};'use strict';var _=require('lodash');var util=require(_0x0fb9('0x0'));var logger=require('../../config/logger')(_0x0fb9('0x1'));var moment=require('moment');var BPromise=require(_0x0fb9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0fb9('0x3'));var rimraf=require(_0x0fb9('0x4'));var config=require(_0x0fb9('0x5'));var attributes=require('./attachment.attributes');module[_0x0fb9('0x6')]=function(_0x107141,_0x393a1a){return _0x107141[_0x0fb9('0x7')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index a263d05..e9707ee 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 _0x1782=['code','Attachment,\x20%s,\x20%s','message','catch','CreateAttachment','Attachment','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1310c2,_0x102826){var _0x26aaad=function(_0x2b26d5){while(--_0x2b26d5){_0x1310c2['push'](_0x1310c2['shift']());}};_0x26aaad(++_0x102826);}(_0x1782,0x13e));var _0x2178=function(_0x4633ce,_0x1de251){_0x4633ce=_0x4633ce-0x0;var _0x364042=_0x1782[_0x4633ce];return _0x364042;};'use strict';var _=require(_0x2178('0x0'));var util=require('util');var moment=require(_0x2178('0x1'));var BPromise=require(_0x2178('0x2'));var rs=require(_0x2178('0x3'));var fs=require('fs');var Redis=require(_0x2178('0x4'));var db=require(_0x2178('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2178('0x6'))(_0x2178('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2178('0x8')][_0x2178('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50ad34,_0x53b9f9,_0x4cf22a){return new BPromise(function(_0x3b4115,_0x2b3991){return client[_0x2178('0xa')](_0x50ad34,_0x4cf22a)[_0x2178('0xb')](function(_0x1cb1e6){logger[_0x2178('0xc')]('Attachment,\x20%s,\x20%s',_0x53b9f9,_0x2178('0xd'));logger[_0x2178('0xe')](_0x2178('0xf'),_0x53b9f9,_0x2178('0xd'),JSON[_0x2178('0x10')](_0x1cb1e6));if(_0x1cb1e6[_0x2178('0x11')]){if(_0x1cb1e6[_0x2178('0x11')][_0x2178('0x12')]===0x1f4){logger[_0x2178('0x11')](_0x2178('0x13'),_0x53b9f9,_0x1cb1e6['error'][_0x2178('0x14')]);return _0x2b3991(_0x1cb1e6[_0x2178('0x11')]['message']);}logger[_0x2178('0x11')](_0x2178('0x13'),_0x53b9f9,_0x1cb1e6[_0x2178('0x11')][_0x2178('0x14')]);return _0x3b4115(_0x1cb1e6[_0x2178('0x11')]['message']);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x53b9f9,_0x2178('0xd'));_0x3b4115(_0x1cb1e6['result'][_0x2178('0x14')]);}})[_0x2178('0x15')](function(_0x5edc68){logger['error'](_0x2178('0x13'),_0x53b9f9,_0x5edc68);_0x2b3991(_0x5edc68);});});}exports[_0x2178('0x16')]=function(_0x561990){var _0x3d7e36=this;return new Promise(function(_0x39dd60,_0x1cece2){return db[_0x2178('0x17')][_0x2178('0x18')](_0x561990[_0x2178('0x19')],{'raw':_0x561990[_0x2178('0x1a')]?_0x561990[_0x2178('0x1a')][_0x2178('0x1b')]===undefined?!![]:![]:!![]})[_0x2178('0xb')](function(_0x1d2dd5){logger[_0x2178('0xc')]('CreateAttachment',_0x561990);logger[_0x2178('0xe')](_0x2178('0x16'),_0x561990,JSON[_0x2178('0x10')](_0x1d2dd5));_0x39dd60(_0x1d2dd5);})[_0x2178('0x15')](function(_0x4335f2){logger[_0x2178('0x11')](_0x2178('0x16'),_0x4335f2[_0x2178('0x14')],_0x561990);_0x1cece2(_0x3d7e36[_0x2178('0x11')](0x1f4,_0x4335f2[_0x2178('0x14')]));});});}; \ No newline at end of file +var _0xee11=['options','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Attachment,\x20%s,\x20%s','result','CreateAttachment','Attachment','body'];(function(_0x19e050,_0x316ed0){var _0x4cc2d3=function(_0x560832){while(--_0x560832){_0x19e050['push'](_0x19e050['shift']());}};_0x4cc2d3(++_0x316ed0);}(_0xee11,0x146));var _0x1ee1=function(_0x1683cf,_0x20b3cb){_0x1683cf=_0x1683cf-0x0;var _0x1159ad=_0xee11[_0x1683cf];return _0x1159ad;};'use strict';var _=require(_0x1ee1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1ee1('0x1'));var rs=require(_0x1ee1('0x2'));var fs=require('fs');var Redis=require(_0x1ee1('0x3'));var db=require(_0x1ee1('0x4'))['db'];var utils=require(_0x1ee1('0x5'));var logger=require(_0x1ee1('0x6'))(_0x1ee1('0x7'));var config=require(_0x1ee1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1ee1('0x9')][_0x1ee1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fdb3b,_0x289d4c,_0x356919){return new BPromise(function(_0x47f984,_0x48af4c){return client[_0x1ee1('0xb')](_0x3fdb3b,_0x356919)[_0x1ee1('0xc')](function(_0x5899ca){logger[_0x1ee1('0xd')]('Attachment,\x20%s,\x20%s',_0x289d4c,_0x1ee1('0xe'));logger['debug'](_0x1ee1('0xf'),_0x289d4c,_0x1ee1('0xe'),JSON[_0x1ee1('0x10')](_0x5899ca));if(_0x5899ca[_0x1ee1('0x11')]){if(_0x5899ca['error'][_0x1ee1('0x12')]===0x1f4){logger[_0x1ee1('0x11')]('Attachment,\x20%s,\x20%s',_0x289d4c,_0x5899ca[_0x1ee1('0x11')][_0x1ee1('0x13')]);return _0x48af4c(_0x5899ca[_0x1ee1('0x11')][_0x1ee1('0x13')]);}logger[_0x1ee1('0x11')](_0x1ee1('0x14'),_0x289d4c,_0x5899ca[_0x1ee1('0x11')][_0x1ee1('0x13')]);return _0x47f984(_0x5899ca[_0x1ee1('0x11')][_0x1ee1('0x13')]);}else{logger[_0x1ee1('0xd')](_0x1ee1('0x14'),_0x289d4c,_0x1ee1('0xe'));_0x47f984(_0x5899ca[_0x1ee1('0x15')]['message']);}})['catch'](function(_0x7ff856){logger[_0x1ee1('0x11')](_0x1ee1('0x14'),_0x289d4c,_0x7ff856);_0x48af4c(_0x7ff856);});});}exports[_0x1ee1('0x16')]=function(_0x1e18b9){var _0xff3d76=this;return new Promise(function(_0x55abff,_0x39229e){return db[_0x1ee1('0x17')]['create'](_0x1e18b9[_0x1ee1('0x18')],{'raw':_0x1e18b9[_0x1ee1('0x19')]?_0x1e18b9['options']['raw']===undefined?!![]:![]:!![]})[_0x1ee1('0xc')](function(_0x1b6cdf){logger[_0x1ee1('0xd')](_0x1ee1('0x16'),_0x1e18b9);logger['debug'](_0x1ee1('0x16'),_0x1e18b9,JSON[_0x1ee1('0x10')](_0x1b6cdf));_0x55abff(_0x1b6cdf);})[_0x1ee1('0x1a')](function(_0x5093ff){logger[_0x1ee1('0x11')](_0x1ee1('0x16'),_0x5093ff[_0x1ee1('0x13')],_0x1e18b9);_0x39229e(_0xff3d76[_0x1ee1('0x11')](0x1f4,_0x5093ff[_0x1ee1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 268a987..60cea99 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 _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x4bb145,_0x3e7d33){var _0x4db596=function(_0x144489){while(--_0x144489){_0x4bb145['push'](_0x4bb145['shift']());}};_0x4db596(++_0x3e7d33);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index d328609..997f950 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 _0xec47=['Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','blocked','blockedAt','online','admin','user','agent','add','minutes','clearBlockUser','getLicense','catch','status','send','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','passport','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','activedirectory','undefined','baseDN','url','domain','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xec47,0x170));var _0x7ec4=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xec47[_0x49b207];return _0x2dc8fa;};'use strict';var passport=require(_0x7ec4('0x0'));var LocalStrategy=require('passport-local')['Strategy'];var moment=require(_0x7ec4('0x1'));var ActiveDirectory=require(_0x7ec4('0x2'));var BPromise=require(_0x7ec4('0x3'));var util=require(_0x7ec4('0x4'));var db=require(_0x7ec4('0x5'))['db'];var authService=require(_0x7ec4('0x6'));var utils=require(_0x7ec4('0x7'));var config=require('../../config/environment');var logger=require('../../config/logger')('api');function isActiveDirectoryConfigured(_0x2e9e88){var _0x265d66=![];if(typeof _0x2e9e88[_0x7ec4('0x8')]!==_0x7ec4('0x9')){_0x265d66=_0x2e9e88[_0x7ec4('0x8')][_0x7ec4('0xa')]&&_0x2e9e88[_0x7ec4('0x8')][_0x7ec4('0xb')]&&_0x2e9e88['activedirectory'][_0x7ec4('0xc')];}return _0x265d66;}function adAuthenticate(_0x57ce98,_0x40e2d8,_0x476300){return new BPromise(function(_0x38452d,_0x450b62){try{var _0x4aafdf=new ActiveDirectory(_0x57ce98);_0x4aafdf['authenticate'](_0x40e2d8,_0x476300,function(_0x279425,_0x12eb11){if(_0x279425){logger['error']('Error\x20authenticate\x20%s:\x20%s',_0x40e2d8,util[_0x7ec4('0xd')](_0x279425,{'showHidden':![],'depth':null}));_0x450b62(_0x7ec4('0xe'));}else if(!_0x12eb11){logger[_0x7ec4('0xf')](_0x7ec4('0x10'),_0x40e2d8);_0x450b62(_0x7ec4('0xe'));}else{_0x38452d(_0x12eb11);}});}catch(_0x1e6c99){_0x450b62(_0x1e6c99);}});}function ActiveDirectoryAuthenticate(_0x3a6265,_0x340e4f,_0x19bd89,_0x590db9){var _0x4f78a2,_0x564460;if(!isActiveDirectoryConfigured(config)){logger[_0x7ec4('0xf')](_0x7ec4('0x11'),_0x340e4f);return _0x590db9(null,![],{'message':_0x7ec4('0xe')});}return db[_0x7ec4('0x12')][_0x7ec4('0x13')]({'where':{'id':0x1},'attributes':[_0x7ec4('0x14'),_0x7ec4('0x15')],'raw':!![]})[_0x7ec4('0x16')](function(_0x38d57b){_0x4f78a2=_0x38d57b;if(!_0x4f78a2[_0x7ec4('0x14')]){logger[_0x7ec4('0xf')](_0x7ec4('0x17'),_0x340e4f);throw new Error(_0x7ec4('0xe'));}return _0x3a6265[_0x7ec4('0x13')]({'attributes':['id',_0x7ec4('0x18'),_0x7ec4('0x19'),_0x7ec4('0x1a'),_0x7ec4('0x1b'),'disabled',_0x7ec4('0x1c'),_0x7ec4('0x1d'),_0x7ec4('0x1e')],'where':{'name':_0x340e4f,'role':{'$or':[_0x7ec4('0x1f'),_0x7ec4('0x20'),_0x7ec4('0x21')]},'adSsoEnabled':!![]}});})[_0x7ec4('0x16')](function(_0x25a763){if(!_0x25a763||_0x25a763&&_0x25a763[_0x7ec4('0x18')]!==_0x340e4f){throw new Error(_0x7ec4('0xe'));}_0x564460=_0x25a763;var _0x589964=_0x564460[_0x7ec4('0x18')]+'@'+config[_0x7ec4('0x8')][_0x7ec4('0xc')];return adAuthenticate(config[_0x7ec4('0x8')],_0x589964,_0x19bd89);})['then'](function(_0x1884b9){if(_0x564460['disabled']){throw new Error(_0x7ec4('0xe'));}if(_0x4f78a2['blockDuration']>0x0){if(_0x564460[_0x7ec4('0x1c')]){if(moment(_0x564460[_0x7ec4('0x1d')])[_0x7ec4('0x22')](_0x4f78a2[_0x7ec4('0x15')],_0x7ec4('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x7ec4('0x24')](_0x564460,0x0,![],null)[_0x7ec4('0x16')](function(){return utils[_0x7ec4('0x25')](_0x564460);})['then'](function(){return _0x590db9(null,_0x564460);});}else{return utils['getLicense'](_0x564460)[_0x7ec4('0x16')](function(){return _0x590db9(null,_0x564460);});}}else{return utils[_0x7ec4('0x25')](_0x564460)[_0x7ec4('0x16')](function(){return _0x590db9(null,_0x564460);});}})[_0x7ec4('0x26')](function(_0x51b086){return _0x590db9(null,![],_0x51b086);});}function handleError(_0x763cb4,_0x59c7d6,_0x40ba2c){return _0x763cb4[_0x7ec4('0x27')](_0x59c7d6||0x1f4)[_0x7ec4('0x28')]({'message':_0x40ba2c?_0x40ba2c[_0x7ec4('0x29')]||_0x40ba2c:''});}exports[_0x7ec4('0x2a')]=function(_0x4d805d,_0x196f77,_0x556151){passport[_0x7ec4('0x2b')](_0x7ec4('0x2c'),function(_0x140932,_0x154804,_0x396055){var _0x4295a0=_0x140932||_0x396055;if(_0x4295a0){return handleError(_0x196f77,0x191,_0x4295a0);}if(!_0x154804){return handleError(_0x196f77,0x194,{'message':_0x7ec4('0x2d')});}else{var _0xc50b3a={'payload':{'id':_0x154804['id'],'role':_0x154804[_0x7ec4('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0x7ec4('0x2e')](_0xc50b3a)['then'](function(_0x3c1958){_0x196f77[_0x7ec4('0x2f')]({'id':_0x154804['id'],'token':_0x3c1958,'statusCall':'','isAlreadyLogged':_0x154804[_0x7ec4('0x1e')]});});}})(_0x4d805d,_0x196f77,_0x556151);};passport['use']('ad-login',new LocalStrategy({'usernameField':'name','passwordField':_0x7ec4('0x19')},function(_0xf349ba,_0x44ba80,_0x55a597){return ActiveDirectoryAuthenticate(db['User'],_0xf349ba,_0x44ba80,_0x55a597);})); \ No newline at end of file +var _0xd4e8=['bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','undefined','activedirectory','url','error','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','findOne','adSsoEnabled','then','password','salt','role','disabled','blockedAt','online','admin','agent','name','domain','blockDuration','blocked','minutes','clearBlockUser','getLicense','catch','status','send','message','login','authenticate','ad-login','signToken','json','use','passport','passport-local','Strategy','moment'];(function(_0xf8e7f9,_0x27be3f){var _0x52d44c=function(_0xd0f711){while(--_0xd0f711){_0xf8e7f9['push'](_0xf8e7f9['shift']());}};_0x52d44c(++_0x27be3f);}(_0xd4e8,0xe7));var _0x8d4e=function(_0x52e272,_0x3ee0e3){_0x52e272=_0x52e272-0x0;var _0x34f3a2=_0xd4e8[_0x52e272];return _0x34f3a2;};'use strict';var passport=require(_0x8d4e('0x0'));var LocalStrategy=require(_0x8d4e('0x1'))[_0x8d4e('0x2')];var moment=require(_0x8d4e('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x8d4e('0x4'));var util=require(_0x8d4e('0x5'));var db=require(_0x8d4e('0x6'))['db'];var authService=require(_0x8d4e('0x7'));var utils=require(_0x8d4e('0x8'));var config=require(_0x8d4e('0x9'));var logger=require(_0x8d4e('0xa'))('api');function isActiveDirectoryConfigured(_0x37978b){var _0xfbddd=![];if(typeof _0x37978b['activedirectory']!==_0x8d4e('0xb')){_0xfbddd=_0x37978b[_0x8d4e('0xc')]['baseDN']&&_0x37978b[_0x8d4e('0xc')][_0x8d4e('0xd')]&&_0x37978b['activedirectory']['domain'];}return _0xfbddd;}function adAuthenticate(_0x15d530,_0x2f0aa8,_0x571da0){return new BPromise(function(_0x123cc3,_0x4387b7){try{var _0x3a19bf=new ActiveDirectory(_0x15d530);_0x3a19bf['authenticate'](_0x2f0aa8,_0x571da0,function(_0x1b3b00,_0x5aa0e5){if(_0x1b3b00){logger[_0x8d4e('0xe')]('Error\x20authenticate\x20%s:\x20%s',_0x2f0aa8,util[_0x8d4e('0xf')](_0x1b3b00,{'showHidden':![],'depth':null}));_0x4387b7('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x5aa0e5){logger[_0x8d4e('0xe')](_0x8d4e('0x10'),_0x2f0aa8);_0x4387b7('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x123cc3(_0x5aa0e5);}});}catch(_0x7109d9){_0x4387b7(_0x7109d9);}});}function ActiveDirectoryAuthenticate(_0x2c65c4,_0x7fc547,_0x3f1ee2,_0x42a517){var _0x23cd56,_0x25a6b2;if(!isActiveDirectoryConfigured(config)){logger[_0x8d4e('0xe')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x7fc547);return _0x42a517(null,![],{'message':_0x8d4e('0x11')});}return db[_0x8d4e('0x12')][_0x8d4e('0x13')]({'where':{'id':0x1},'attributes':[_0x8d4e('0x14'),'blockDuration'],'raw':!![]})[_0x8d4e('0x15')](function(_0x581bf9){_0x23cd56=_0x581bf9;if(!_0x23cd56['adSsoEnabled']){logger[_0x8d4e('0xe')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x7fc547);throw new Error(_0x8d4e('0x11'));}return _0x2c65c4[_0x8d4e('0x13')]({'attributes':['id','name',_0x8d4e('0x16'),_0x8d4e('0x17'),_0x8d4e('0x18'),_0x8d4e('0x19'),'blocked',_0x8d4e('0x1a'),_0x8d4e('0x1b')],'where':{'name':_0x7fc547,'role':{'$or':[_0x8d4e('0x1c'),'user',_0x8d4e('0x1d')]},'adSsoEnabled':!![]}});})[_0x8d4e('0x15')](function(_0x421067){if(!_0x421067||_0x421067&&_0x421067['name']!==_0x7fc547){throw new Error(_0x8d4e('0x11'));}_0x25a6b2=_0x421067;var _0x5d7ac2=_0x25a6b2[_0x8d4e('0x1e')]+'@'+config[_0x8d4e('0xc')][_0x8d4e('0x1f')];return adAuthenticate(config['activedirectory'],_0x5d7ac2,_0x3f1ee2);})['then'](function(_0xe09f9e){if(_0x25a6b2[_0x8d4e('0x19')]){throw new Error(_0x8d4e('0x11'));}if(_0x23cd56[_0x8d4e('0x20')]>0x0){if(_0x25a6b2[_0x8d4e('0x21')]){if(moment(_0x25a6b2['blockedAt'])['add'](_0x23cd56[_0x8d4e('0x20')],_0x8d4e('0x22'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x8d4e('0x23')](_0x25a6b2,0x0,![],null)[_0x8d4e('0x15')](function(){return utils[_0x8d4e('0x24')](_0x25a6b2);})[_0x8d4e('0x15')](function(){return _0x42a517(null,_0x25a6b2);});}else{return utils['getLicense'](_0x25a6b2)[_0x8d4e('0x15')](function(){return _0x42a517(null,_0x25a6b2);});}}else{return utils['getLicense'](_0x25a6b2)[_0x8d4e('0x15')](function(){return _0x42a517(null,_0x25a6b2);});}})[_0x8d4e('0x25')](function(_0x5dd1c3){return _0x42a517(null,![],_0x5dd1c3);});}function handleError(_0x414581,_0x17f57a,_0x504073){return _0x414581[_0x8d4e('0x26')](_0x17f57a||0x1f4)[_0x8d4e('0x27')]({'message':_0x504073?_0x504073[_0x8d4e('0x28')]||_0x504073:''});}exports[_0x8d4e('0x29')]=function(_0x36c496,_0x473a05,_0x7e103c){passport[_0x8d4e('0x2a')](_0x8d4e('0x2b'),function(_0x5d89ff,_0x1a1f13,_0x294d1b){var _0x26e072=_0x5d89ff||_0x294d1b;if(_0x26e072){return handleError(_0x473a05,0x191,_0x26e072);}if(!_0x1a1f13){return handleError(_0x473a05,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x1e4e0c={'payload':{'id':_0x1a1f13['id'],'role':_0x1a1f13['role']},'options':{'expiresIn':0x15180}};return authService[_0x8d4e('0x2c')](_0x1e4e0c)[_0x8d4e('0x15')](function(_0x14efda){_0x473a05[_0x8d4e('0x2d')]({'id':_0x1a1f13['id'],'token':_0x14efda,'statusCall':'','isAlreadyLogged':_0x1a1f13[_0x8d4e('0x1b')]});});}})(_0x36c496,_0x473a05,_0x7e103c);};passport[_0x8d4e('0x2e')](_0x8d4e('0x2b'),new LocalStrategy({'usernameField':'name','passwordField':_0x8d4e('0x16')},function(_0x59f65c,_0x2f2a14,_0x5d4503){return ActiveDirectoryAuthenticate(db['User'],_0x59f65c,_0x2f2a14,_0x5d4503);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index b29ee7b..a14c96a 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 _0x48ae=['login','exports','express','Router','./authActiveDirectory.controller','post'];(function(_0x27912e,_0x2bc1c5){var _0x2d2e12=function(_0x17e094){while(--_0x17e094){_0x27912e['push'](_0x27912e['shift']());}};_0x2d2e12(++_0x2bc1c5);}(_0x48ae,0x188));var _0xe48a=function(_0x2a7ec8,_0x5cdb6d){_0x2a7ec8=_0x2a7ec8-0x0;var _0x4cec08=_0x48ae[_0x2a7ec8];return _0x4cec08;};'use strict';var express=require(_0xe48a('0x0'));var router=express[_0xe48a('0x1')]();var controller=require(_0xe48a('0x2'));router[_0xe48a('0x3')]('/',controller[_0xe48a('0x4')]);module[_0xe48a('0x5')]=router; \ No newline at end of file +var _0x7945=['post','login','exports','express','Router','./authActiveDirectory.controller'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0x7945,0xb7));var _0x5794=function(_0xa72a71,_0x52b9dd){_0xa72a71=_0xa72a71-0x0;var _0x4b39d9=_0x7945[_0xa72a71];return _0x4b39d9;};'use strict';var express=require(_0x5794('0x0'));var router=express[_0x5794('0x1')]();var controller=require(_0x5794('0x2'));router[_0x5794('0x3')]('/',controller[_0x5794('0x4')]);module[_0x5794('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 30b77d5..06fc65d 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(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x7a54,0x106));var _0x47a5=function(_0x3f4a5e,_0x119c3f){_0x3f4a5e=_0x3f4a5e-0x0;var _0x161a98=_0x7a54[_0x3f4a5e];return _0x161a98;};'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(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x7a54,0x106));var _0x47a5=function(_0x3ce6d3,_0x59206a){_0x3ce6d3=_0x3ce6d3-0x0;var _0xe1c45a=_0x7a54[_0x3ce6d3];return _0xe1c45a;};'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 084e60f..40f99c6 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 _0x4d29=['/callback','callback','setTokenCookie','exports','express','./authGoogle.controller','get','login'];(function(_0x43566c,_0x4feef2){var _0x54477d=function(_0x71d80f){while(--_0x71d80f){_0x43566c['push'](_0x43566c['shift']());}};_0x54477d(++_0x4feef2);}(_0x4d29,0x13c));var _0x94d2=function(_0x44a863,_0x1bc824){_0x44a863=_0x44a863-0x0;var _0x3c23e7=_0x4d29[_0x44a863];return _0x3c23e7;};'use strict';var express=require(_0x94d2('0x0'));var passport=require('passport');var router=express['Router']();var controller=require(_0x94d2('0x1'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0x94d2('0x2')]('/',controller[_0x94d2('0x3')]);router[_0x94d2('0x2')](_0x94d2('0x4'),controller[_0x94d2('0x5')],authService['isMiddleware'],userController[_0x94d2('0x3')],authService[_0x94d2('0x6')]);module[_0x94d2('0x7')]=router; \ No newline at end of file +var _0xf0e5=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','/callback','callback','isMiddleware','setTokenCookie','exports','Router'];(function(_0x30927f,_0x1a6b55){var _0x4dd593=function(_0x515645){while(--_0x515645){_0x30927f['push'](_0x30927f['shift']());}};_0x4dd593(++_0x1a6b55);}(_0xf0e5,0x1e3));var _0x5f0e=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xf0e5[_0x1a36a5];return _0x746243;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0x5f0e('0x0')]();var controller=require(_0x5f0e('0x1'));var userController=require(_0x5f0e('0x2'));var authService=require(_0x5f0e('0x3'));router['get']('/',controller[_0x5f0e('0x4')]);router[_0x5f0e('0x5')](_0x5f0e('0x6'),controller[_0x5f0e('0x7')],authService[_0x5f0e('0x8')],userController[_0x5f0e('0x4')],authService[_0x5f0e('0x9')]);module[_0x5f0e('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index d1b8556..8effd3d 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 _0x7c11=['stringify','status','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','forgot','body','generate','trim','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','User','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','securePassword','validatePasswordPattern','validatePasswordHistory','previousPasswords','passwordHistoryLimit','resetPasswordToken','resetPasswordExpires','Password\x20reset!','use','local-login','util','passport','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','password','salt','role','disabled','blockedAt','loginAttempts','admin','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','add','minutes','clearBlockUser','getLicense','catch','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','email','user','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message'];(function(_0x5951b9,_0x52b706){var _0x16623b=function(_0x25af2b){while(--_0x25af2b){_0x5951b9['push'](_0x5951b9['shift']());}};_0x16623b(++_0x52b706);}(_0x7c11,0x1b9));var _0x17c1=function(_0x139482,_0x5a2084){_0x139482=_0x139482-0x0;var _0x1bba06=_0x7c11[_0x139482];return _0x1bba06;};'use strict';var util=require(_0x17c1('0x0'));var passport=require(_0x17c1('0x1'));var LocalStrategy=require(_0x17c1('0x2'))['Strategy'];var jayson=require(_0x17c1('0x3'));var _=require(_0x17c1('0x4'));var rs=require(_0x17c1('0x5'));var moment=require(_0x17c1('0x6'));var db=require(_0x17c1('0x7'))['db'];var authService=require(_0x17c1('0x8'));var utils=require(_0x17c1('0x9'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0xa45146,_0x5e1e32,_0x1453e9,_0x5e66b0){var _0x486feb,_0x15a5d8;return db[_0x17c1('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0x17c1('0xb'),_0x17c1('0xc')],'raw':!![]})[_0x17c1('0xd')](function(_0x24b12e){_0x486feb=_0x24b12e;return _0xa45146[_0x17c1('0xe')]({'attributes':['id',_0x17c1('0xf'),_0x17c1('0x10'),_0x17c1('0x11'),_0x17c1('0x12'),_0x17c1('0x13'),'blocked',_0x17c1('0x14'),_0x17c1('0x15')],'where':{'name':_0x5e1e32,'role':{'$or':[_0x17c1('0x16'),'user','agent']}}});})[_0x17c1('0xd')](function(_0x38169c){if(!_0x38169c||_0x38169c&&_0x38169c[_0x17c1('0xf')]!==_0x5e1e32){throw new Error(_0x17c1('0x17'));}else{_0x15a5d8=_0x38169c;return _0x15a5d8;}})[_0x17c1('0xd')](function(){_0x15a5d8[_0x17c1('0x18')](_0x1453e9,function(_0x2e645e,_0x9c41e7){var _0x5f289c=_0x15a5d8['loginAttempts']+0x1;if(_0x2e645e){return _0x5e66b0(_0x2e645e);}else if(!_0x9c41e7){if(_0x15a5d8['disabled']){return _0x5e66b0(null,![],{'message':_0x17c1('0x17')});}else if(_0x486feb[_0x17c1('0xb')]>0x0){if(_0x15a5d8[_0x17c1('0x19')]){if(_0x486feb[_0x17c1('0xc')]>0x0){if(moment(_0x15a5d8[_0x17c1('0x14')])[_0x17c1('0x1a')](_0x486feb[_0x17c1('0xc')],_0x17c1('0x1b'))>moment()){return _0x5e66b0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x15a5d8,_0x5f289c,![],null)['then'](function(){return _0x5e66b0(null,![],{'message':_0x17c1('0x17')});});}}else{return _0x5e66b0(null,![],{'message':_0x17c1('0x17')});}}else{if(_0x5f289c>=_0x486feb[_0x17c1('0xb')]){return utils['clearBlockUser'](_0x15a5d8,0x0,!![],moment())[_0x17c1('0xd')](function(){return _0x5e66b0(null,![],{'message':_0x17c1('0x17')});});}else{return utils[_0x17c1('0x1c')](_0x15a5d8,_0x5f289c,![],null)[_0x17c1('0xd')](function(){return _0x5e66b0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x5e66b0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x15a5d8[_0x17c1('0x13')]){return _0x5e66b0(null,![],{'message':_0x17c1('0x17')});}else if(_0x486feb[_0x17c1('0xb')]>0x0){if(_0x15a5d8[_0x17c1('0x19')]){if(_0x486feb[_0x17c1('0xc')]>0x0){if(moment(_0x15a5d8[_0x17c1('0x14')])[_0x17c1('0x1a')](_0x486feb[_0x17c1('0xc')],_0x17c1('0x1b'))>moment()){return _0x5e66b0(null,![],{'message':_0x17c1('0x17')});}else{return utils[_0x17c1('0x1c')](_0x15a5d8,0x0,![],null)['then'](function(){return utils[_0x17c1('0x1d')](_0x15a5d8);})[_0x17c1('0xd')](function(){return _0x5e66b0(null,_0x15a5d8);});}}else{return _0x5e66b0(null,![],{'message':_0x17c1('0x17')});}}else{return utils[_0x17c1('0x1c')](_0x15a5d8,0x0,![],null)['then'](function(){return utils['getLicense'](_0x15a5d8);})[_0x17c1('0xd')](function(){return _0x5e66b0(null,_0x15a5d8);})[_0x17c1('0x1e')](function(_0x4332ce){return _0x5e66b0(null,![],_0x4332ce);});}}else{if(_0x15a5d8[_0x17c1('0x19')]){return _0x5e66b0(null,![],{'message':_0x17c1('0x17')});}else{return utils[_0x17c1('0x1d')](_0x15a5d8)[_0x17c1('0xd')](function(){return _0x5e66b0(null,_0x15a5d8);});}}}});})[_0x17c1('0x1e')](function(_0x66e045){return _0x5e66b0(null,![],_0x66e045);});}function sendServiceMail(_0x12484d){return db['MailAccount'][_0x17c1('0x1f')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0x17c1('0x20')],'as':_0x17c1('0x21'),'include':[{'model':db['CloudProvider'],'as':_0x17c1('0x22')}]}]})[_0x17c1('0xd')](function(_0x2fe251){if(!_0x2fe251){throw new Error(_0x17c1('0x23'));}var _0x229021=_0x2fe251['getSmtpOptions']();var _0x4e9dd1={'account':_0x229021,'message':_[_0x17c1('0x24')]({'from':util[_0x17c1('0x25')](_0x17c1('0x26'),_0x2fe251[_0x17c1('0xf')],_0x2fe251[_0x17c1('0x27')]||_0x2fe251[_0x17c1('0x21')][_0x17c1('0x28')])},_0x12484d)};return client['request'](_0x17c1('0x29'),_0x4e9dd1);})[_0x17c1('0xd')](function(_0x3b9665){if(_0x3b9665[_0x17c1('0x2a')]){throw new Error(util['format'](_0x17c1('0x2b'),_0x3b9665[_0x17c1('0x2a')][_0x17c1('0x2c')]||JSON[_0x17c1('0x2d')](_0x3b9665[_0x17c1('0x2a')])));}return!![];});}function handleError(_0x558ac6,_0x5ad8e2,_0x573bb4){return _0x558ac6[_0x17c1('0x2e')](_0x5ad8e2||0x1f4)['send']({'message':_0x573bb4?_0x573bb4[_0x17c1('0x2c')]||_0x573bb4:''});}exports[_0x17c1('0x2f')]=function(_0x5bc412,_0x5cd544,_0xbbc0df){passport['authenticate']('local-login',function(_0x549065,_0x3382fd,_0x2cf566){var _0x289fdd=_0x549065||_0x2cf566;if(_0x289fdd){return handleError(_0x5cd544,0x191,_0x289fdd);}if(!_0x3382fd){return handleError(_0x5cd544,0x194,{'message':_0x17c1('0x30')});}else{var _0x4ade3a={'payload':{'id':_0x3382fd['id'],'role':_0x3382fd[_0x17c1('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0x17c1('0x31')](_0x4ade3a)[_0x17c1('0xd')](function(_0x151e6e){_0x5cd544['json']({'id':_0x3382fd['id'],'token':_0x151e6e,'statusCall':'','isAlreadyLogged':_0x3382fd['online']});});}})(_0x5bc412,_0x5cd544,_0xbbc0df);};exports[_0x17c1('0x32')]=function(_0xa0e7f9,_0x144481){if(!_0xa0e7f9[_0x17c1('0x33')][_0x17c1('0x27')]){return handleError(_0x144481,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0xdf0bf0=rs[_0x17c1('0x34')]();_0xa0e7f9['body']['email']=_0xa0e7f9[_0x17c1('0x33')][_0x17c1('0x27')][_0x17c1('0x35')]()['toLowerCase']();var _0x58ddba;return db[_0x17c1('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0x17c1('0xb'),_0x17c1('0xc')],'raw':!![]})[_0x17c1('0xd')](function(_0x251930){_0x58ddba=_0x251930;return db['User']['find']({'where':{'email':_0xa0e7f9[_0x17c1('0x33')][_0x17c1('0x27')]}});})[_0x17c1('0xd')](function(_0x6a31d1){if(!_0x6a31d1){throw new Error(_0x17c1('0x36'));}if(_0x6a31d1[_0x17c1('0x13')]){throw new Error(_0x17c1('0x37'));}if(_0x6a31d1['blocked']){if(moment(_0x6a31d1[_0x17c1('0x14')])['add'](_0x58ddba[_0x17c1('0xc')],'minutes')>moment()){throw new Error(_0x17c1('0x38'));}else{_0x6a31d1['blocked']=![];_0x6a31d1[_0x17c1('0x14')]=null;}}_0x6a31d1['resetPasswordToken']=_0xdf0bf0;_0x6a31d1['resetPasswordExpires']=Date[_0x17c1('0x39')]()+0x36ee80;return _0x6a31d1[_0x17c1('0x3a')]();})[_0x17c1('0xd')](function(){return sendServiceMail({'to':_0xa0e7f9['body']['email'],'subject':_0x17c1('0x3b'),'text':_0x17c1('0x3c')+_0x17c1('0x3d')+_0x17c1('0x3e')+_0xa0e7f9['headers'][_0x17c1('0x3f')]+_0x17c1('0x40')+_0xdf0bf0+'\x0a\x0a'+_0x17c1('0x41')});})[_0x17c1('0xd')](function(){_0x144481[_0x17c1('0x2e')](0xc8)[_0x17c1('0x42')]({'message':'Reset\x20Email\x20sent!'});})[_0x17c1('0x1e')](function(_0x269359){return handleError(_0x144481,0x1f4,_0x269359);});};exports['reset']=function(_0x512ca2,_0x4099ed){return db[_0x17c1('0x43')][_0x17c1('0x1f')]({'where':{'resetPasswordToken':_0x512ca2[_0x17c1('0x44')]['token'],'resetPasswordExpires':{'$gt':Date[_0x17c1('0x39')]()}}})['then'](function(_0x3753f8){if(!_0x3753f8){throw new Error(_0x17c1('0x45'));}return db[_0x17c1('0xa')][_0x17c1('0xe')]({'attributes':['id','securePassword',_0x17c1('0x46'),'passwordHistoryLimit']})[_0x17c1('0xd')](function(_0x574b24){if(_0x574b24[_0x17c1('0x47')])authService[_0x17c1('0x48')](_0x512ca2[_0x17c1('0x33')]['password']);if(!_0x574b24['enforcePasswordHistory']||!_0x3753f8['previousPasswords'])return _0x3753f8;authService[_0x17c1('0x49')](_0x512ca2[_0x17c1('0x33')]['password'],_0x3753f8[_0x17c1('0x4a')],_0x574b24[_0x17c1('0x4b')]);return _0x3753f8;})['then'](function(){_0x3753f8[_0x17c1('0x10')]=_0x512ca2[_0x17c1('0x33')]['password'];_0x3753f8[_0x17c1('0x4c')]=null;_0x3753f8[_0x17c1('0x4d')]=null;return _0x3753f8[_0x17c1('0x3a')]();});})['then'](function(){_0x4099ed[_0x17c1('0x2e')](0xc8)['send']({'message':_0x17c1('0x4e')});})[_0x17c1('0x1e')](function(_0x579501){return handleError(_0x4099ed,0x1f4,_0x579501);});};passport[_0x17c1('0x4f')](_0x17c1('0x50'),new LocalStrategy({'usernameField':_0x17c1('0xf'),'passwordField':_0x17c1('0x10')},function(_0x70c18a,_0x1d44eb,_0x2e3b4e){return localAuthenticate(db[_0x17c1('0x43')],_0x70c18a,_0x1d44eb,_0x2e3b4e);})); \ No newline at end of file +var _0xb790=['This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','catch','reset','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use','local-login','passport-local','Strategy','jayson/promise','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','salt','role','blocked','blockedAt','loginAttempts','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','clearBlockUser','minutes','getLicense','MailAccount','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','Email\x20parameter\x20is\x20missing','body','trim','toLowerCase'];(function(_0x460b72,_0x43f16d){var _0x4c7291=function(_0x2a6097){while(--_0x2a6097){_0x460b72['push'](_0x460b72['shift']());}};_0x4c7291(++_0x43f16d);}(_0xb790,0x1a6));var _0x0b79=function(_0x309991,_0x457e73){_0x309991=_0x309991-0x0;var _0x4ca94d=_0xb790[_0x309991];return _0x4ca94d;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require(_0x0b79('0x0'))[_0x0b79('0x1')];var jayson=require(_0x0b79('0x2'));var _=require('lodash');var rs=require('randomstring');var moment=require(_0x0b79('0x3'));var db=require(_0x0b79('0x4'))['db'];var authService=require(_0x0b79('0x5'));var utils=require(_0x0b79('0x6'));var client=jayson['client'][_0x0b79('0x7')]({'port':0x232b});function localAuthenticate(_0x249f67,_0x5144fe,_0x13fefb,_0x18359c){var _0x32444d,_0x34ac99;return db[_0x0b79('0x8')][_0x0b79('0x9')]({'where':{'id':0x1},'attributes':[_0x0b79('0xa'),_0x0b79('0xb')],'raw':!![]})[_0x0b79('0xc')](function(_0x30a23a){_0x32444d=_0x30a23a;return _0x249f67[_0x0b79('0x9')]({'attributes':['id',_0x0b79('0xd'),'password',_0x0b79('0xe'),_0x0b79('0xf'),'disabled',_0x0b79('0x10'),_0x0b79('0x11'),_0x0b79('0x12')],'where':{'name':_0x5144fe,'role':{'$or':['admin',_0x0b79('0x13'),_0x0b79('0x14')]}}});})[_0x0b79('0xc')](function(_0x2e8a2d){if(!_0x2e8a2d||_0x2e8a2d&&_0x2e8a2d['name']!==_0x5144fe){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x34ac99=_0x2e8a2d;return _0x34ac99;}})[_0x0b79('0xc')](function(){_0x34ac99['authenticate'](_0x13fefb,function(_0x543087,_0x4b2822){var _0x9ddcd5=_0x34ac99[_0x0b79('0x12')]+0x1;if(_0x543087){return _0x18359c(_0x543087);}else if(!_0x4b2822){if(_0x34ac99[_0x0b79('0x15')]){return _0x18359c(null,![],{'message':_0x0b79('0x16')});}else if(_0x32444d[_0x0b79('0xa')]>0x0){if(_0x34ac99[_0x0b79('0x10')]){if(_0x32444d[_0x0b79('0xb')]>0x0){if(moment(_0x34ac99['blockedAt'])[_0x0b79('0x17')](_0x32444d[_0x0b79('0xb')],'minutes')>moment()){return _0x18359c(null,![],{'message':_0x0b79('0x16')});}else{return utils['clearBlockUser'](_0x34ac99,_0x9ddcd5,![],null)[_0x0b79('0xc')](function(){return _0x18359c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x18359c(null,![],{'message':_0x0b79('0x16')});}}else{if(_0x9ddcd5>=_0x32444d[_0x0b79('0xa')]){return utils[_0x0b79('0x18')](_0x34ac99,0x0,!![],moment())['then'](function(){return _0x18359c(null,![],{'message':_0x0b79('0x16')});});}else{return utils[_0x0b79('0x18')](_0x34ac99,_0x9ddcd5,![],null)[_0x0b79('0xc')](function(){return _0x18359c(null,![],{'message':_0x0b79('0x16')});});}}}else{return _0x18359c(null,![],{'message':_0x0b79('0x16')});}}else{if(_0x34ac99[_0x0b79('0x15')]){return _0x18359c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x32444d['allowedLoginAttempts']>0x0){if(_0x34ac99[_0x0b79('0x10')]){if(_0x32444d[_0x0b79('0xb')]>0x0){if(moment(_0x34ac99[_0x0b79('0x11')])['add'](_0x32444d[_0x0b79('0xb')],_0x0b79('0x19'))>moment()){return _0x18359c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x0b79('0x18')](_0x34ac99,0x0,![],null)[_0x0b79('0xc')](function(){return utils[_0x0b79('0x1a')](_0x34ac99);})[_0x0b79('0xc')](function(){return _0x18359c(null,_0x34ac99);});}}else{return _0x18359c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x34ac99,0x0,![],null)[_0x0b79('0xc')](function(){return utils['getLicense'](_0x34ac99);})[_0x0b79('0xc')](function(){return _0x18359c(null,_0x34ac99);})['catch'](function(_0x4615da){return _0x18359c(null,![],_0x4615da);});}}else{if(_0x34ac99[_0x0b79('0x10')]){return _0x18359c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x0b79('0x1a')](_0x34ac99)[_0x0b79('0xc')](function(){return _0x18359c(null,_0x34ac99);});}}}});})['catch'](function(_0x57df4b){return _0x18359c(null,![],_0x57df4b);});}function sendServiceMail(_0x3b0911){return db[_0x0b79('0x1b')][_0x0b79('0x1c')]({'where':{'service':!![]},'attributes':['id',_0x0b79('0xd'),_0x0b79('0x1d')],'include':[{'model':db[_0x0b79('0x1e')],'as':'Smtp','include':[{'model':db[_0x0b79('0x1f')],'as':_0x0b79('0x1f')}]}]})[_0x0b79('0xc')](function(_0x350178){if(!_0x350178){throw new Error(_0x0b79('0x20'));}var _0x110144=_0x350178['getSmtpOptions']();var _0x60af56={'account':_0x110144,'message':_[_0x0b79('0x21')]({'from':util[_0x0b79('0x22')](_0x0b79('0x23'),_0x350178['name'],_0x350178[_0x0b79('0x1d')]||_0x350178['Smtp'][_0x0b79('0x13')])},_0x3b0911)};return client[_0x0b79('0x24')]('SendMail',_0x60af56);})[_0x0b79('0xc')](function(_0x290f2e){if(_0x290f2e[_0x0b79('0x25')]){throw new Error(util[_0x0b79('0x22')](_0x0b79('0x26'),_0x290f2e['error'][_0x0b79('0x27')]||JSON[_0x0b79('0x28')](_0x290f2e[_0x0b79('0x25')])));}return!![];});}function handleError(_0x2b51e1,_0x54e1ee,_0x3906fa){return _0x2b51e1[_0x0b79('0x29')](_0x54e1ee||0x1f4)[_0x0b79('0x2a')]({'message':_0x3906fa?_0x3906fa[_0x0b79('0x27')]||_0x3906fa:''});}exports['login']=function(_0x530876,_0x438591,_0x30af8c){passport[_0x0b79('0x2b')]('local-login',function(_0x39b949,_0x948792,_0x751121){var _0x14f619=_0x39b949||_0x751121;if(_0x14f619){return handleError(_0x438591,0x191,_0x14f619);}if(!_0x948792){return handleError(_0x438591,0x194,{'message':_0x0b79('0x2c')});}else{var _0x53f6cf={'payload':{'id':_0x948792['id'],'role':_0x948792[_0x0b79('0xf')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x53f6cf)[_0x0b79('0xc')](function(_0x89b7ef){_0x438591[_0x0b79('0x2d')]({'id':_0x948792['id'],'token':_0x89b7ef,'statusCall':'','isAlreadyLogged':_0x948792[_0x0b79('0x2e')]});});}})(_0x530876,_0x438591,_0x30af8c);};exports[_0x0b79('0x2f')]=function(_0x523179,_0x5d1c66){if(!_0x523179['body'][_0x0b79('0x1d')]){return handleError(_0x5d1c66,0x1f4,{'message':_0x0b79('0x30')});}var _0x39af12=rs['generate']();_0x523179[_0x0b79('0x31')][_0x0b79('0x1d')]=_0x523179[_0x0b79('0x31')]['email'][_0x0b79('0x32')]()[_0x0b79('0x33')]();var _0xbd8ac2;return db[_0x0b79('0x8')][_0x0b79('0x9')]({'where':{'id':0x1},'attributes':[_0x0b79('0xa'),_0x0b79('0xb')],'raw':!![]})[_0x0b79('0xc')](function(_0x54b2ef){_0xbd8ac2=_0x54b2ef;return db['User']['find']({'where':{'email':_0x523179[_0x0b79('0x31')]['email']}});})[_0x0b79('0xc')](function(_0x1cf4fc){if(!_0x1cf4fc){throw new Error(_0x0b79('0x34'));}if(_0x1cf4fc[_0x0b79('0x15')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x1cf4fc[_0x0b79('0x10')]){if(moment(_0x1cf4fc[_0x0b79('0x11')])['add'](_0xbd8ac2[_0x0b79('0xb')],'minutes')>moment()){throw new Error(_0x0b79('0x35'));}else{_0x1cf4fc[_0x0b79('0x10')]=![];_0x1cf4fc['blockedAt']=null;}}_0x1cf4fc[_0x0b79('0x36')]=_0x39af12;_0x1cf4fc['resetPasswordExpires']=Date[_0x0b79('0x37')]()+0x36ee80;return _0x1cf4fc[_0x0b79('0x38')]();})[_0x0b79('0xc')](function(){return sendServiceMail({'to':_0x523179[_0x0b79('0x31')]['email'],'subject':_0x0b79('0x39'),'text':_0x0b79('0x3a')+_0x0b79('0x3b')+_0x0b79('0x3c')+_0x523179['headers']['host']+_0x0b79('0x3d')+_0x39af12+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x0b79('0xc')](function(){_0x5d1c66[_0x0b79('0x29')](0xc8)[_0x0b79('0x2a')]({'message':'Reset\x20Email\x20sent!'});})[_0x0b79('0x3e')](function(_0x408288){return handleError(_0x5d1c66,0x1f4,_0x408288);});};exports[_0x0b79('0x3f')]=function(_0x31ad55,_0x4a5945){return db[_0x0b79('0x40')][_0x0b79('0x1c')]({'where':{'resetPasswordToken':_0x31ad55[_0x0b79('0x41')][_0x0b79('0x42')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x40e106){if(!_0x40e106){throw new Error(_0x0b79('0x43'));}return db['Setting']['findOne']({'attributes':['id',_0x0b79('0x44'),_0x0b79('0x45'),_0x0b79('0x46')]})[_0x0b79('0xc')](function(_0x2bdfbf){if(_0x2bdfbf['securePassword'])authService[_0x0b79('0x47')](_0x31ad55['body'][_0x0b79('0x48')]);if(!_0x2bdfbf[_0x0b79('0x45')]||!_0x40e106[_0x0b79('0x49')])return _0x40e106;authService[_0x0b79('0x4a')](_0x31ad55['body'][_0x0b79('0x48')],_0x40e106[_0x0b79('0x49')],_0x2bdfbf['passwordHistoryLimit']);return _0x40e106;})['then'](function(){_0x40e106[_0x0b79('0x48')]=_0x31ad55['body']['password'];_0x40e106[_0x0b79('0x36')]=null;_0x40e106[_0x0b79('0x4b')]=null;return _0x40e106[_0x0b79('0x38')]();});})[_0x0b79('0xc')](function(){_0x4a5945['status'](0xc8)[_0x0b79('0x2a')]({'message':_0x0b79('0x4c')});})['catch'](function(_0x32f7a1){return handleError(_0x4a5945,0x1f4,_0x32f7a1);});};passport[_0x0b79('0x4d')](_0x0b79('0x4e'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x232b18,_0xe691ae,_0x31d119){return localAuthenticate(db[_0x0b79('0x40')],_0x232b18,_0xe691ae,_0x31d119);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index d046d0c..7cce2ef 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 _0x6091=['forgot','reset','exports','express','Router','./authLocal.controller','post','login','/forgot'];(function(_0x334280,_0x3a7b8a){var _0x27ea14=function(_0x5f5c1f){while(--_0x5f5c1f){_0x334280['push'](_0x334280['shift']());}};_0x27ea14(++_0x3a7b8a);}(_0x6091,0x135));var _0x1609=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x6091[_0x3f5dca];return _0x5b833a;};'use strict';var express=require(_0x1609('0x0'));var router=express[_0x1609('0x1')]();var controller=require(_0x1609('0x2'));router[_0x1609('0x3')]('/',controller[_0x1609('0x4')]);router[_0x1609('0x3')](_0x1609('0x5'),controller[_0x1609('0x6')]);router['post']('/reset/:token',controller[_0x1609('0x7')]);module[_0x1609('0x8')]=router; \ No newline at end of file +var _0xc408=['./authLocal.controller','post','login','/forgot','/reset/:token','exports','Router'];(function(_0x47c902,_0x220fd2){var _0x1ad6a0=function(_0xf9fdb0){while(--_0xf9fdb0){_0x47c902['push'](_0x47c902['shift']());}};_0x1ad6a0(++_0x220fd2);}(_0xc408,0x164));var _0x8c40=function(_0x9b3e69,_0x3a01d8){_0x9b3e69=_0x9b3e69-0x0;var _0x1bae34=_0xc408[_0x9b3e69];return _0x1bae34;};'use strict';var express=require('express');var router=express[_0x8c40('0x0')]();var controller=require(_0x8c40('0x1'));router[_0x8c40('0x2')]('/',controller[_0x8c40('0x3')]);router[_0x8c40('0x2')](_0x8c40('0x4'),controller['forgot']);router[_0x8c40('0x2')](_0x8c40('0x5'),controller['reset']);module[_0x8c40('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 3b7373f..b15c4db 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 _0xd635=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd635,0xfe));var _0x5d63=function(_0x419560,_0x16a92c){_0x419560=_0x419560-0x0;var _0x52a0a9=_0xd635[_0x419560];return _0x52a0a9;};'use strict';var Sequelize=require(_0x5d63('0x0'));module[_0x5d63('0x1')]={'name':{'type':Sequelize[_0x5d63('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x5d63('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x5d63('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x5d63('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x304a=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x14f326,_0x4760a3){var _0x9e3123=function(_0x28b841){while(--_0x28b841){_0x14f326['push'](_0x14f326['shift']());}};_0x9e3123(++_0x4760a3);}(_0x304a,0x76));var _0xa304=function(_0x29ac67,_0xa35896){_0x29ac67=_0x29ac67-0x0;var _0x282c82=_0x304a[_0x29ac67];return _0x282c82;};'use strict';var Sequelize=require(_0xa304('0x0'));module[_0xa304('0x1')]={'name':{'type':Sequelize[_0xa304('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xa304('0x2')]},'description':{'type':Sequelize[_0xa304('0x2')]},'status':{'type':Sequelize[_0xa304('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xa304('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 7bdd74a..b2f7b86 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 _0xa59a=['Action','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','Automation','include','findAll','rows','catch','show','params','fields','includeAll','find','body','Condition','addConditions','ids','omit','getConditions','order','nolimit','addActions','getActions','findOne'];(function(_0x3aa59a,_0x1efb6){var _0x431c78=function(_0x6b09a5){while(--_0x6b09a5){_0x3aa59a['push'](_0x3aa59a['shift']());}};_0x431c78(++_0x1efb6);}(_0xa59a,0x103));var _0xaa59=function(_0x37fd32,_0x3bc37a){_0x37fd32=_0x37fd32-0x0;var _0x41f971=_0xa59a[_0x37fd32];return _0x41f971;};'use strict';var emlformat=require(_0xaa59('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaa59('0x1'));var jsonpatch=require(_0xaa59('0x2'));var rp=require(_0xaa59('0x3'));var moment=require(_0xaa59('0x4'));var BPromise=require(_0xaa59('0x5'));var Mustache=require(_0xaa59('0x6'));var util=require(_0xaa59('0x7'));var path=require(_0xaa59('0x8'));var sox=require(_0xaa59('0x9'));var csv=require(_0xaa59('0xa'));var ejs=require(_0xaa59('0xb'));var fs=require('fs');var fs_extra=require(_0xaa59('0xc'));var _=require(_0xaa59('0xd'));var squel=require(_0xaa59('0xe'));var crypto=require('crypto');var jsforce=require(_0xaa59('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaa59('0x10'));var Papa=require(_0xaa59('0x11'));var Redis=require(_0xaa59('0x12'));var authService=require(_0xaa59('0x13'));var qs=require(_0xaa59('0x14'));var as=require(_0xaa59('0x15'));var hardwareService=require(_0xaa59('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xaa59('0x17'));var config=require(_0xaa59('0x18'));var licenseUtil=require(_0xaa59('0x19'));var db=require(_0xaa59('0x1a'))['db'];function respondWithStatusCode(_0x2f831d,_0x2fbe67){_0x2fbe67=_0x2fbe67||0xcc;return function(_0x13f5b8){if(_0x13f5b8){return _0x2f831d[_0xaa59('0x1b')](_0x2fbe67);}return _0x2f831d['status'](_0x2fbe67)[_0xaa59('0x1c')]();};}function respondWithResult(_0x2e5303,_0x530235){_0x530235=_0x530235||0xc8;return function(_0x551753){if(_0x551753){return _0x2e5303[_0xaa59('0x1d')](_0x530235)[_0xaa59('0x1e')](_0x551753);}};}function respondWithFilteredResult(_0x5dbc38,_0x2bf80a){return function(_0x554984){if(_0x554984){var _0x481034=typeof _0x2bf80a[_0xaa59('0x1f')]===_0xaa59('0x20')&&typeof _0x2bf80a['limit']==='undefined';var _0x1611f2=_0x554984[_0xaa59('0x21')];var _0x566d4a=_0x481034?0x0:_0x2bf80a['offset'];var _0x39f2d3=_0x481034?_0x554984[_0xaa59('0x21')]:_0x2bf80a[_0xaa59('0x1f')]+_0x2bf80a['limit'];var _0x4d8752;if(_0x39f2d3>=_0x1611f2){_0x39f2d3=_0x1611f2;_0x4d8752=0xc8;}else{_0x4d8752=0xce;}_0x5dbc38['status'](_0x4d8752);return _0x5dbc38['set'](_0xaa59('0x22'),_0x566d4a+'-'+_0x39f2d3+'/'+_0x1611f2)[_0xaa59('0x1e')](_0x554984);}return null;};}function patchUpdates(_0x23c552){return function(_0x571d16){try{jsonpatch[_0xaa59('0x23')](_0x571d16,_0x23c552,!![]);}catch(_0x14a0a4){return BPromise[_0xaa59('0x24')](_0x14a0a4);}return _0x571d16[_0xaa59('0x25')]();};}function saveUpdates(_0x4fa652,_0xcb9b3){return function(_0x192c71){if(_0x192c71){return _0x192c71[_0xaa59('0x26')](_0x4fa652)[_0xaa59('0x27')](function(_0x42e1bb){return _0x42e1bb;});}return null;};}function removeEntity(_0x293950,_0x1a278d){return function(_0xecf09){if(_0xecf09){return _0xecf09[_0xaa59('0x28')]()[_0xaa59('0x27')](function(){_0x293950['status'](0xcc)[_0xaa59('0x1c')]();});}};}function handleEntityNotFound(_0x4c1783,_0x59394b){return function(_0x8c9827){if(!_0x8c9827){_0x4c1783[_0xaa59('0x1b')](0x194);}return _0x8c9827;};}function handleError(_0x3184a9,_0x2c1c35){_0x2c1c35=_0x2c1c35||0x1f4;return function(_0x4f305e){logger['error'](_0x4f305e[_0xaa59('0x29')]);if(_0x4f305e[_0xaa59('0x2a')]){delete _0x4f305e['name'];}_0x3184a9['status'](_0x2c1c35)['send'](_0x4f305e);};}exports['index']=function(_0x2a628c,_0x4e61a9){var _0x446520={},_0x2c64c0={},_0x24d873={'count':0x0,'rows':[]};var _0x133eb5=_['map'](db['Automation'][_0xaa59('0x2b')],function(_0x39910f){return{'name':_0x39910f[_0xaa59('0x2c')],'type':_0x39910f['type'][_0xaa59('0x2d')]};});_0x2c64c0[_0xaa59('0x2e')]=_[_0xaa59('0x2f')](_0x133eb5,_0xaa59('0x2a'));_0x2c64c0[_0xaa59('0x30')]=_[_0xaa59('0x31')](_0x2a628c['query']);_0x2c64c0[_0xaa59('0x32')]=_[_0xaa59('0x33')](_0x2c64c0[_0xaa59('0x2e')],_0x2c64c0['query']);_0x446520[_0xaa59('0x34')]=_['intersection'](_0x2c64c0[_0xaa59('0x2e')],qs['fields'](_0x2a628c[_0xaa59('0x30')]['fields']));_0x446520[_0xaa59('0x34')]=_0x446520[_0xaa59('0x34')][_0xaa59('0x35')]?_0x446520[_0xaa59('0x34')]:_0x2c64c0[_0xaa59('0x2e')];if(!_0x2a628c[_0xaa59('0x30')][_0xaa59('0x36')]('nolimit')){_0x446520[_0xaa59('0x37')]=qs['limit'](_0x2a628c['query'][_0xaa59('0x37')]);_0x446520[_0xaa59('0x1f')]=qs['offset'](_0x2a628c[_0xaa59('0x30')][_0xaa59('0x1f')]);}_0x446520['order']=qs[_0xaa59('0x38')](_0x2a628c[_0xaa59('0x30')][_0xaa59('0x38')]);_0x446520[_0xaa59('0x39')]=qs[_0xaa59('0x32')](_[_0xaa59('0x3a')](_0x2a628c[_0xaa59('0x30')],_0x2c64c0[_0xaa59('0x32')]),_0x133eb5);if(_0x2a628c[_0xaa59('0x30')][_0xaa59('0x3b')]){_0x446520['where']=_[_0xaa59('0x3c')](_0x446520['where'],{'$or':_[_0xaa59('0x2f')](_0x133eb5,function(_0x42e2ad){if(_0x42e2ad[_0xaa59('0x3d')]!==_0xaa59('0x3e')){var _0xf32977={};_0xf32977[_0x42e2ad[_0xaa59('0x2a')]]={'$like':'%'+_0x2a628c[_0xaa59('0x30')][_0xaa59('0x3b')]+'%'};return _0xf32977;}})});}_0x446520=_[_0xaa59('0x3c')]({},_0x446520,_0x2a628c[_0xaa59('0x3f')]);var _0x137820={'where':_0x446520[_0xaa59('0x39')]};return db[_0xaa59('0x40')]['count'](_0x137820)[_0xaa59('0x27')](function(_0x3a1ba5){_0x24d873[_0xaa59('0x21')]=_0x3a1ba5;if(_0x2a628c[_0xaa59('0x30')]['includeAll']){_0x446520[_0xaa59('0x41')]=[{'all':!![]}];}return db['Automation'][_0xaa59('0x42')](_0x446520);})['then'](function(_0x378259){_0x24d873[_0xaa59('0x43')]=_0x378259;return _0x24d873;})[_0xaa59('0x27')](respondWithFilteredResult(_0x4e61a9,_0x446520))[_0xaa59('0x44')](handleError(_0x4e61a9,null));};exports[_0xaa59('0x45')]=function(_0x390ddc,_0x2bae64){var _0x3e6fbf={'raw':![],'where':{'id':_0x390ddc[_0xaa59('0x46')]['id']}},_0x3d6a64={};_0x3d6a64[_0xaa59('0x2e')]=_[_0xaa59('0x31')](db[_0xaa59('0x40')][_0xaa59('0x2b')]);_0x3d6a64[_0xaa59('0x30')]=_[_0xaa59('0x31')](_0x390ddc[_0xaa59('0x30')]);_0x3d6a64[_0xaa59('0x32')]=_['intersection'](_0x3d6a64['model'],_0x3d6a64[_0xaa59('0x30')]);_0x3e6fbf['attributes']=_[_0xaa59('0x33')](_0x3d6a64[_0xaa59('0x2e')],qs[_0xaa59('0x47')](_0x390ddc[_0xaa59('0x30')]['fields']));_0x3e6fbf['attributes']=_0x3e6fbf['attributes']['length']?_0x3e6fbf['attributes']:_0x3d6a64['model'];if(_0x390ddc['query'][_0xaa59('0x48')]){_0x3e6fbf[_0xaa59('0x41')]=[{'all':!![]}];}_0x3e6fbf=_[_0xaa59('0x3c')]({},_0x3e6fbf,_0x390ddc[_0xaa59('0x3f')]);return db[_0xaa59('0x40')][_0xaa59('0x49')](_0x3e6fbf)[_0xaa59('0x27')](handleEntityNotFound(_0x2bae64,null))[_0xaa59('0x27')](respondWithResult(_0x2bae64,null))['catch'](handleError(_0x2bae64,null));};exports['create']=function(_0x4a9491,_0x3182bd){return db[_0xaa59('0x40')]['create'](_0x4a9491[_0xaa59('0x4a')],{})[_0xaa59('0x27')](respondWithResult(_0x3182bd,0xc9))[_0xaa59('0x44')](handleError(_0x3182bd,null));};exports[_0xaa59('0x26')]=function(_0x7d42c0,_0x2bb96c){if(_0x7d42c0['body']['id']){delete _0x7d42c0[_0xaa59('0x4a')]['id'];}return db['Automation'][_0xaa59('0x49')]({'where':{'id':_0x7d42c0[_0xaa59('0x46')]['id']}})[_0xaa59('0x27')](handleEntityNotFound(_0x2bb96c,null))[_0xaa59('0x27')](saveUpdates(_0x7d42c0[_0xaa59('0x4a')],null))['then'](respondWithResult(_0x2bb96c,null))[_0xaa59('0x44')](handleError(_0x2bb96c,null));};exports[_0xaa59('0x28')]=function(_0x1de6e5,_0x5ab558){return db['Automation']['find']({'where':{'id':_0x1de6e5[_0xaa59('0x46')]['id']}})[_0xaa59('0x27')](handleEntityNotFound(_0x5ab558,null))['then'](removeEntity(_0x5ab558,null))['catch'](handleError(_0x5ab558,null));};exports['addConditions']=function(_0x29e3ec,_0x504404,_0x4b75a6){return db[_0xaa59('0x4b')]['find']({'where':{'id':_0x29e3ec[_0xaa59('0x46')]['id']}})['then'](handleEntityNotFound(_0x504404,null))[_0xaa59('0x27')](function(_0x1b3b2a){if(_0x1b3b2a){return _0x1b3b2a[_0xaa59('0x4c')](_0x29e3ec[_0xaa59('0x4a')][_0xaa59('0x4d')],_[_0xaa59('0x4e')](_0x29e3ec['body'],['ids','id'])||{});}})[_0xaa59('0x27')](respondWithResult(_0x504404,null))['catch'](handleError(_0x504404,null));};exports[_0xaa59('0x4f')]=function(_0x512694,_0x341344,_0x537587){var _0x56cee0={};var _0x4c20a7={};var _0xa96d9;var _0x2174d0;return db['Automation']['findOne']({'where':{'id':_0x512694[_0xaa59('0x46')]['id']}})['then'](handleEntityNotFound(_0x341344,null))['then'](function(_0x357c0d){if(_0x357c0d){_0xa96d9=_0x357c0d;_0x4c20a7[_0xaa59('0x2e')]=_[_0xaa59('0x31')](db[_0xaa59('0x4b')]['rawAttributes']);_0x4c20a7[_0xaa59('0x30')]=_[_0xaa59('0x31')](_0x512694[_0xaa59('0x30')]);_0x4c20a7[_0xaa59('0x32')]=_['intersection'](_0x4c20a7[_0xaa59('0x2e')],_0x4c20a7['query']);_0x56cee0[_0xaa59('0x34')]=_[_0xaa59('0x33')](_0x4c20a7['model'],qs['fields'](_0x512694[_0xaa59('0x30')][_0xaa59('0x47')]));_0x56cee0['attributes']=_0x56cee0[_0xaa59('0x34')][_0xaa59('0x35')]?_0x56cee0[_0xaa59('0x34')]:_0x4c20a7[_0xaa59('0x2e')];_0x56cee0[_0xaa59('0x50')]=qs[_0xaa59('0x38')](_0x512694[_0xaa59('0x30')][_0xaa59('0x38')]);_0x56cee0['where']=qs[_0xaa59('0x32')](_['pick'](_0x512694['query'],_0x4c20a7[_0xaa59('0x32')]));if(_0x512694[_0xaa59('0x30')]['filter']){_0x56cee0['where']=_[_0xaa59('0x3c')](_0x56cee0[_0xaa59('0x39')],{'$or':_[_0xaa59('0x2f')](_0x56cee0[_0xaa59('0x34')],function(_0x2d4d63){var _0x1544c8={};_0x1544c8[_0x2d4d63]={'$like':'%'+_0x512694[_0xaa59('0x30')]['filter']+'%'};return _0x1544c8;})});}_0x56cee0=_['merge']({},_0x56cee0,_0x512694[_0xaa59('0x3f')]);return _0xa96d9[_0xaa59('0x4f')](_0x56cee0);}})[_0xaa59('0x27')](function(_0x32bced){if(_0x32bced){_0x2174d0=_0x32bced[_0xaa59('0x35')];if(!_0x512694['query'][_0xaa59('0x36')](_0xaa59('0x51'))){_0x56cee0[_0xaa59('0x37')]=qs[_0xaa59('0x37')](_0x512694['query'][_0xaa59('0x37')]);_0x56cee0['offset']=qs[_0xaa59('0x1f')](_0x512694['query'][_0xaa59('0x1f')]);}return _0xa96d9[_0xaa59('0x4f')](_0x56cee0);}})[_0xaa59('0x27')](function(_0x3cd791){if(_0x3cd791){return _0x3cd791?{'count':_0x2174d0,'rows':_0x3cd791}:null;}})[_0xaa59('0x27')](respondWithResult(_0x341344,null))[_0xaa59('0x44')](handleError(_0x341344,null));};exports[_0xaa59('0x52')]=function(_0x206d54,_0x5949d8,_0x3de698){return db['Action'][_0xaa59('0x49')]({'where':{'id':_0x206d54['params']['id']}})[_0xaa59('0x27')](handleEntityNotFound(_0x5949d8,null))[_0xaa59('0x27')](function(_0x53bdc3){if(_0x53bdc3){return _0x53bdc3[_0xaa59('0x52')](_0x206d54['body'][_0xaa59('0x4d')],_[_0xaa59('0x4e')](_0x206d54[_0xaa59('0x4a')],['ids','id'])||{});}})['then'](respondWithResult(_0x5949d8,null))[_0xaa59('0x44')](handleError(_0x5949d8,null));};exports[_0xaa59('0x53')]=function(_0x523e51,_0x230123,_0x345875){var _0x1f8a4f={};var _0x3e7431={};var _0x5a2551;var _0x7ef6c8;return db[_0xaa59('0x40')][_0xaa59('0x54')]({'where':{'id':_0x523e51[_0xaa59('0x46')]['id']}})[_0xaa59('0x27')](handleEntityNotFound(_0x230123,null))[_0xaa59('0x27')](function(_0x284ce0){if(_0x284ce0){_0x5a2551=_0x284ce0;_0x3e7431['model']=_['keys'](db[_0xaa59('0x55')][_0xaa59('0x2b')]);_0x3e7431['query']=_['keys'](_0x523e51['query']);_0x3e7431[_0xaa59('0x32')]=_[_0xaa59('0x33')](_0x3e7431[_0xaa59('0x2e')],_0x3e7431[_0xaa59('0x30')]);_0x1f8a4f[_0xaa59('0x34')]=_['intersection'](_0x3e7431[_0xaa59('0x2e')],qs[_0xaa59('0x47')](_0x523e51[_0xaa59('0x30')][_0xaa59('0x47')]));_0x1f8a4f[_0xaa59('0x34')]=_0x1f8a4f[_0xaa59('0x34')][_0xaa59('0x35')]?_0x1f8a4f[_0xaa59('0x34')]:_0x3e7431['model'];_0x1f8a4f[_0xaa59('0x50')]=qs[_0xaa59('0x38')](_0x523e51['query']['sort']);_0x1f8a4f[_0xaa59('0x39')]=qs[_0xaa59('0x32')](_[_0xaa59('0x3a')](_0x523e51[_0xaa59('0x30')],_0x3e7431[_0xaa59('0x32')]));if(_0x523e51[_0xaa59('0x30')]['filter']){_0x1f8a4f['where']=_[_0xaa59('0x3c')](_0x1f8a4f[_0xaa59('0x39')],{'$or':_['map'](_0x1f8a4f[_0xaa59('0x34')],function(_0x5d6984){var _0x49644={};_0x49644[_0x5d6984]={'$like':'%'+_0x523e51[_0xaa59('0x30')][_0xaa59('0x3b')]+'%'};return _0x49644;})});}_0x1f8a4f=_[_0xaa59('0x3c')]({},_0x1f8a4f,_0x523e51[_0xaa59('0x3f')]);return _0x5a2551[_0xaa59('0x53')](_0x1f8a4f);}})[_0xaa59('0x27')](function(_0x1a9225){if(_0x1a9225){_0x7ef6c8=_0x1a9225[_0xaa59('0x35')];if(!_0x523e51[_0xaa59('0x30')][_0xaa59('0x36')](_0xaa59('0x51'))){_0x1f8a4f[_0xaa59('0x37')]=qs[_0xaa59('0x37')](_0x523e51[_0xaa59('0x30')][_0xaa59('0x37')]);_0x1f8a4f[_0xaa59('0x1f')]=qs[_0xaa59('0x1f')](_0x523e51[_0xaa59('0x30')][_0xaa59('0x1f')]);}return _0x5a2551[_0xaa59('0x53')](_0x1f8a4f);}})[_0xaa59('0x27')](function(_0x3e6a23){if(_0x3e6a23){return _0x3e6a23?{'count':_0x7ef6c8,'rows':_0x3e6a23}:null;}})[_0xaa59('0x27')](respondWithResult(_0x230123,null))[_0xaa59('0x44')](handleError(_0x230123,null));}; \ No newline at end of file +var _0x9589=['fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','catch','create','body','addConditions','Condition','omit','ids','getConditions','findOne','order','addActions','getActions','Action','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','set','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','Automation'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x9589,0x122));var _0x9958=function(_0xa6876a,_0x5bd2fb){_0xa6876a=_0xa6876a-0x0;var _0x106b65=_0x9589[_0xa6876a];return _0x106b65;};'use strict';var emlformat=require(_0x9958('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9958('0x1'));var jsonpatch=require(_0x9958('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9958('0x3'));var Mustache=require(_0x9958('0x4'));var util=require('util');var path=require(_0x9958('0x5'));var sox=require(_0x9958('0x6'));var csv=require(_0x9958('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9958('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9958('0x9'));var jsforce=require(_0x9958('0xa'));var deskjs=require(_0x9958('0xb'));var toCsv=require(_0x9958('0x7'));var querystring=require(_0x9958('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9958('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x9958('0xe'));var hardwareService=require(_0x9958('0xf'));var logger=require(_0x9958('0x10'))(_0x9958('0x11'));var utils=require(_0x9958('0x12'));var config=require(_0x9958('0x13'));var licenseUtil=require(_0x9958('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18da26,_0x1f9268){_0x1f9268=_0x1f9268||0xcc;return function(_0x1d2153){if(_0x1d2153){return _0x18da26[_0x9958('0x15')](_0x1f9268);}return _0x18da26[_0x9958('0x16')](_0x1f9268)[_0x9958('0x17')]();};}function respondWithResult(_0x3f457d,_0x37aa7b){_0x37aa7b=_0x37aa7b||0xc8;return function(_0x4a18de){if(_0x4a18de){return _0x3f457d[_0x9958('0x16')](_0x37aa7b)['json'](_0x4a18de);}};}function respondWithFilteredResult(_0x2ec24b,_0x17752f){return function(_0x4342bf){if(_0x4342bf){var _0xa78b17=typeof _0x17752f[_0x9958('0x18')]==='undefined'&&typeof _0x17752f[_0x9958('0x19')]==='undefined';var _0x1584b6=_0x4342bf[_0x9958('0x1a')];var _0x3ffaa4=_0xa78b17?0x0:_0x17752f[_0x9958('0x18')];var _0x300724=_0xa78b17?_0x4342bf['count']:_0x17752f[_0x9958('0x18')]+_0x17752f[_0x9958('0x19')];var _0x318767;if(_0x300724>=_0x1584b6){_0x300724=_0x1584b6;_0x318767=0xc8;}else{_0x318767=0xce;}_0x2ec24b['status'](_0x318767);return _0x2ec24b[_0x9958('0x1b')]('Content-Range',_0x3ffaa4+'-'+_0x300724+'/'+_0x1584b6)[_0x9958('0x1c')](_0x4342bf);}return null;};}function patchUpdates(_0xd27bbd){return function(_0x589557){try{jsonpatch[_0x9958('0x1d')](_0x589557,_0xd27bbd,!![]);}catch(_0x392976){return BPromise[_0x9958('0x1e')](_0x392976);}return _0x589557[_0x9958('0x1f')]();};}function saveUpdates(_0x56537d,_0x179169){return function(_0x58551d){if(_0x58551d){return _0x58551d[_0x9958('0x20')](_0x56537d)['then'](function(_0x2c1114){return _0x2c1114;});}return null;};}function removeEntity(_0x30c80f,_0x3a1246){return function(_0x42a452){if(_0x42a452){return _0x42a452[_0x9958('0x21')]()[_0x9958('0x22')](function(){_0x30c80f['status'](0xcc)[_0x9958('0x17')]();});}};}function handleEntityNotFound(_0xc08de9,_0x28a458){return function(_0x17f67b){if(!_0x17f67b){_0xc08de9[_0x9958('0x15')](0x194);}return _0x17f67b;};}function handleError(_0x2e316d,_0x328d1c){_0x328d1c=_0x328d1c||0x1f4;return function(_0x2d2e52){logger[_0x9958('0x23')](_0x2d2e52[_0x9958('0x24')]);if(_0x2d2e52['name']){delete _0x2d2e52[_0x9958('0x25')];}_0x2e316d[_0x9958('0x16')](_0x328d1c)[_0x9958('0x26')](_0x2d2e52);};}exports[_0x9958('0x27')]=function(_0x1a4423,_0x13abf7){var _0x2b77e1={},_0x5d1e9b={},_0x27c123={'count':0x0,'rows':[]};var _0x34544e=_[_0x9958('0x28')](db[_0x9958('0x29')]['rawAttributes'],function(_0x833ded){return{'name':_0x833ded[_0x9958('0x2a')],'type':_0x833ded[_0x9958('0x2b')][_0x9958('0x2c')]};});_0x5d1e9b['model']=_[_0x9958('0x28')](_0x34544e,'name');_0x5d1e9b[_0x9958('0x2d')]=_[_0x9958('0x2e')](_0x1a4423['query']);_0x5d1e9b['filters']=_[_0x9958('0x2f')](_0x5d1e9b[_0x9958('0x30')],_0x5d1e9b[_0x9958('0x2d')]);_0x2b77e1[_0x9958('0x31')]=_[_0x9958('0x2f')](_0x5d1e9b['model'],qs[_0x9958('0x32')](_0x1a4423[_0x9958('0x2d')]['fields']));_0x2b77e1[_0x9958('0x31')]=_0x2b77e1['attributes']['length']?_0x2b77e1['attributes']:_0x5d1e9b[_0x9958('0x30')];if(!_0x1a4423[_0x9958('0x2d')][_0x9958('0x33')](_0x9958('0x34'))){_0x2b77e1['limit']=qs[_0x9958('0x19')](_0x1a4423[_0x9958('0x2d')][_0x9958('0x19')]);_0x2b77e1[_0x9958('0x18')]=qs[_0x9958('0x18')](_0x1a4423['query']['offset']);}_0x2b77e1['order']=qs[_0x9958('0x35')](_0x1a4423[_0x9958('0x2d')][_0x9958('0x35')]);_0x2b77e1[_0x9958('0x36')]=qs[_0x9958('0x37')](_[_0x9958('0x38')](_0x1a4423['query'],_0x5d1e9b['filters']),_0x34544e);if(_0x1a4423[_0x9958('0x2d')][_0x9958('0x39')]){_0x2b77e1[_0x9958('0x36')]=_[_0x9958('0x3a')](_0x2b77e1[_0x9958('0x36')],{'$or':_[_0x9958('0x28')](_0x34544e,function(_0xd71e6f){if(_0xd71e6f[_0x9958('0x2b')]!==_0x9958('0x3b')){var _0x582ee6={};_0x582ee6[_0xd71e6f['name']]={'$like':'%'+_0x1a4423[_0x9958('0x2d')][_0x9958('0x39')]+'%'};return _0x582ee6;}})});}_0x2b77e1=_[_0x9958('0x3a')]({},_0x2b77e1,_0x1a4423[_0x9958('0x3c')]);var _0xbcf443={'where':_0x2b77e1[_0x9958('0x36')]};return db[_0x9958('0x29')][_0x9958('0x1a')](_0xbcf443)[_0x9958('0x22')](function(_0x4962e0){_0x27c123[_0x9958('0x1a')]=_0x4962e0;if(_0x1a4423['query'][_0x9958('0x3d')]){_0x2b77e1[_0x9958('0x3e')]=[{'all':!![]}];}return db[_0x9958('0x29')][_0x9958('0x3f')](_0x2b77e1);})['then'](function(_0x440475){_0x27c123[_0x9958('0x40')]=_0x440475;return _0x27c123;})[_0x9958('0x22')](respondWithFilteredResult(_0x13abf7,_0x2b77e1))['catch'](handleError(_0x13abf7,null));};exports[_0x9958('0x41')]=function(_0x16e371,_0xd76a70){var _0x26b27f={'raw':![],'where':{'id':_0x16e371[_0x9958('0x42')]['id']}},_0x4c7a09={};_0x4c7a09[_0x9958('0x30')]=_[_0x9958('0x2e')](db[_0x9958('0x29')][_0x9958('0x43')]);_0x4c7a09['query']=_['keys'](_0x16e371[_0x9958('0x2d')]);_0x4c7a09[_0x9958('0x37')]=_[_0x9958('0x2f')](_0x4c7a09['model'],_0x4c7a09[_0x9958('0x2d')]);_0x26b27f['attributes']=_[_0x9958('0x2f')](_0x4c7a09[_0x9958('0x30')],qs[_0x9958('0x32')](_0x16e371['query'][_0x9958('0x32')]));_0x26b27f[_0x9958('0x31')]=_0x26b27f['attributes'][_0x9958('0x44')]?_0x26b27f[_0x9958('0x31')]:_0x4c7a09[_0x9958('0x30')];if(_0x16e371[_0x9958('0x2d')][_0x9958('0x3d')]){_0x26b27f['include']=[{'all':!![]}];}_0x26b27f=_[_0x9958('0x3a')]({},_0x26b27f,_0x16e371[_0x9958('0x3c')]);return db[_0x9958('0x29')][_0x9958('0x45')](_0x26b27f)['then'](handleEntityNotFound(_0xd76a70,null))['then'](respondWithResult(_0xd76a70,null))[_0x9958('0x46')](handleError(_0xd76a70,null));};exports[_0x9958('0x47')]=function(_0x4116f0,_0x2847f9){return db[_0x9958('0x29')]['create'](_0x4116f0[_0x9958('0x48')],{})[_0x9958('0x22')](respondWithResult(_0x2847f9,0xc9))[_0x9958('0x46')](handleError(_0x2847f9,null));};exports['update']=function(_0x45b070,_0x2b083c){if(_0x45b070[_0x9958('0x48')]['id']){delete _0x45b070[_0x9958('0x48')]['id'];}return db[_0x9958('0x29')][_0x9958('0x45')]({'where':{'id':_0x45b070['params']['id']}})[_0x9958('0x22')](handleEntityNotFound(_0x2b083c,null))[_0x9958('0x22')](saveUpdates(_0x45b070['body'],null))[_0x9958('0x22')](respondWithResult(_0x2b083c,null))[_0x9958('0x46')](handleError(_0x2b083c,null));};exports['destroy']=function(_0xa48256,_0x387c42){return db[_0x9958('0x29')][_0x9958('0x45')]({'where':{'id':_0xa48256[_0x9958('0x42')]['id']}})['then'](handleEntityNotFound(_0x387c42,null))['then'](removeEntity(_0x387c42,null))[_0x9958('0x46')](handleError(_0x387c42,null));};exports[_0x9958('0x49')]=function(_0x1c9266,_0x20463f,_0x34231d){return db[_0x9958('0x4a')][_0x9958('0x45')]({'where':{'id':_0x1c9266['params']['id']}})[_0x9958('0x22')](handleEntityNotFound(_0x20463f,null))[_0x9958('0x22')](function(_0x38acf7){if(_0x38acf7){return _0x38acf7[_0x9958('0x49')](_0x1c9266[_0x9958('0x48')]['ids'],_[_0x9958('0x4b')](_0x1c9266[_0x9958('0x48')],[_0x9958('0x4c'),'id'])||{});}})[_0x9958('0x22')](respondWithResult(_0x20463f,null))[_0x9958('0x46')](handleError(_0x20463f,null));};exports[_0x9958('0x4d')]=function(_0x15a59b,_0x543644,_0xfee4ab){var _0x584a7f={};var _0x81557a={};var _0x4204b7;var _0x325b94;return db['Automation'][_0x9958('0x4e')]({'where':{'id':_0x15a59b['params']['id']}})[_0x9958('0x22')](handleEntityNotFound(_0x543644,null))[_0x9958('0x22')](function(_0x523df7){if(_0x523df7){_0x4204b7=_0x523df7;_0x81557a[_0x9958('0x30')]=_[_0x9958('0x2e')](db[_0x9958('0x4a')]['rawAttributes']);_0x81557a['query']=_['keys'](_0x15a59b[_0x9958('0x2d')]);_0x81557a['filters']=_[_0x9958('0x2f')](_0x81557a[_0x9958('0x30')],_0x81557a[_0x9958('0x2d')]);_0x584a7f[_0x9958('0x31')]=_[_0x9958('0x2f')](_0x81557a[_0x9958('0x30')],qs['fields'](_0x15a59b[_0x9958('0x2d')][_0x9958('0x32')]));_0x584a7f[_0x9958('0x31')]=_0x584a7f[_0x9958('0x31')][_0x9958('0x44')]?_0x584a7f[_0x9958('0x31')]:_0x81557a[_0x9958('0x30')];_0x584a7f[_0x9958('0x4f')]=qs[_0x9958('0x35')](_0x15a59b[_0x9958('0x2d')][_0x9958('0x35')]);_0x584a7f[_0x9958('0x36')]=qs[_0x9958('0x37')](_['pick'](_0x15a59b[_0x9958('0x2d')],_0x81557a['filters']));if(_0x15a59b['query']['filter']){_0x584a7f[_0x9958('0x36')]=_[_0x9958('0x3a')](_0x584a7f[_0x9958('0x36')],{'$or':_[_0x9958('0x28')](_0x584a7f[_0x9958('0x31')],function(_0x5080d4){var _0x1b0aef={};_0x1b0aef[_0x5080d4]={'$like':'%'+_0x15a59b[_0x9958('0x2d')][_0x9958('0x39')]+'%'};return _0x1b0aef;})});}_0x584a7f=_['merge']({},_0x584a7f,_0x15a59b[_0x9958('0x3c')]);return _0x4204b7[_0x9958('0x4d')](_0x584a7f);}})[_0x9958('0x22')](function(_0x402af0){if(_0x402af0){_0x325b94=_0x402af0[_0x9958('0x44')];if(!_0x15a59b[_0x9958('0x2d')]['hasOwnProperty'](_0x9958('0x34'))){_0x584a7f['limit']=qs['limit'](_0x15a59b[_0x9958('0x2d')][_0x9958('0x19')]);_0x584a7f[_0x9958('0x18')]=qs[_0x9958('0x18')](_0x15a59b['query'][_0x9958('0x18')]);}return _0x4204b7[_0x9958('0x4d')](_0x584a7f);}})[_0x9958('0x22')](function(_0x539003){if(_0x539003){return _0x539003?{'count':_0x325b94,'rows':_0x539003}:null;}})[_0x9958('0x22')](respondWithResult(_0x543644,null))[_0x9958('0x46')](handleError(_0x543644,null));};exports[_0x9958('0x50')]=function(_0x26564d,_0x174010,_0x425b16){return db['Action'][_0x9958('0x45')]({'where':{'id':_0x26564d[_0x9958('0x42')]['id']}})['then'](handleEntityNotFound(_0x174010,null))[_0x9958('0x22')](function(_0x2febe2){if(_0x2febe2){return _0x2febe2[_0x9958('0x50')](_0x26564d[_0x9958('0x48')][_0x9958('0x4c')],_[_0x9958('0x4b')](_0x26564d[_0x9958('0x48')],[_0x9958('0x4c'),'id'])||{});}})['then'](respondWithResult(_0x174010,null))[_0x9958('0x46')](handleError(_0x174010,null));};exports[_0x9958('0x51')]=function(_0x409a27,_0x1f2f29,_0x1b1f8d){var _0xe1bd9f={};var _0x123502={};var _0x3c4a1e;var _0x269cf4;return db[_0x9958('0x29')][_0x9958('0x4e')]({'where':{'id':_0x409a27[_0x9958('0x42')]['id']}})['then'](handleEntityNotFound(_0x1f2f29,null))[_0x9958('0x22')](function(_0x3ad016){if(_0x3ad016){_0x3c4a1e=_0x3ad016;_0x123502[_0x9958('0x30')]=_[_0x9958('0x2e')](db[_0x9958('0x52')]['rawAttributes']);_0x123502[_0x9958('0x2d')]=_['keys'](_0x409a27[_0x9958('0x2d')]);_0x123502[_0x9958('0x37')]=_[_0x9958('0x2f')](_0x123502['model'],_0x123502[_0x9958('0x2d')]);_0xe1bd9f[_0x9958('0x31')]=_[_0x9958('0x2f')](_0x123502[_0x9958('0x30')],qs[_0x9958('0x32')](_0x409a27['query'][_0x9958('0x32')]));_0xe1bd9f[_0x9958('0x31')]=_0xe1bd9f[_0x9958('0x31')][_0x9958('0x44')]?_0xe1bd9f[_0x9958('0x31')]:_0x123502['model'];_0xe1bd9f[_0x9958('0x4f')]=qs['sort'](_0x409a27[_0x9958('0x2d')]['sort']);_0xe1bd9f[_0x9958('0x36')]=qs[_0x9958('0x37')](_[_0x9958('0x38')](_0x409a27[_0x9958('0x2d')],_0x123502[_0x9958('0x37')]));if(_0x409a27[_0x9958('0x2d')][_0x9958('0x39')]){_0xe1bd9f[_0x9958('0x36')]=_['merge'](_0xe1bd9f[_0x9958('0x36')],{'$or':_[_0x9958('0x28')](_0xe1bd9f[_0x9958('0x31')],function(_0x38d943){var _0x4b310c={};_0x4b310c[_0x38d943]={'$like':'%'+_0x409a27[_0x9958('0x2d')][_0x9958('0x39')]+'%'};return _0x4b310c;})});}_0xe1bd9f=_['merge']({},_0xe1bd9f,_0x409a27[_0x9958('0x3c')]);return _0x3c4a1e[_0x9958('0x51')](_0xe1bd9f);}})['then'](function(_0xa5087a){if(_0xa5087a){_0x269cf4=_0xa5087a['length'];if(!_0x409a27[_0x9958('0x2d')][_0x9958('0x33')](_0x9958('0x34'))){_0xe1bd9f['limit']=qs[_0x9958('0x19')](_0x409a27[_0x9958('0x2d')][_0x9958('0x19')]);_0xe1bd9f['offset']=qs[_0x9958('0x18')](_0x409a27[_0x9958('0x2d')][_0x9958('0x18')]);}return _0x3c4a1e['getActions'](_0xe1bd9f);}})[_0x9958('0x22')](function(_0xb041e5){if(_0xb041e5){return _0xb041e5?{'count':_0x269cf4,'rows':_0xb041e5}:null;}})[_0x9958('0x22')](respondWithResult(_0x1f2f29,null))[_0x9958('0x46')](handleError(_0x1f2f29,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index e4d9492..093d414 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 _0x9708=['tools_automations','lodash','util','../../config/logger','api','bluebird','path','./automation.attributes','exports','define','Automation'];(function(_0x5c2b1f,_0x266443){var _0x55d367=function(_0xeb5790){while(--_0xeb5790){_0x5c2b1f['push'](_0x5c2b1f['shift']());}};_0x55d367(++_0x266443);}(_0x9708,0x85));var _0x8970=function(_0x221b8c,_0x2c7afc){_0x221b8c=_0x221b8c-0x0;var _0x3fab9f=_0x9708[_0x221b8c];return _0x3fab9f;};'use strict';var _=require(_0x8970('0x0'));var util=require(_0x8970('0x1'));var logger=require(_0x8970('0x2'))(_0x8970('0x3'));var moment=require('moment');var BPromise=require(_0x8970('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8970('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8970('0x6'));module[_0x8970('0x7')]=function(_0x507dd5,_0x44b40a){return _0x507dd5[_0x8970('0x8')](_0x8970('0x9'),attributes,{'tableName':_0x8970('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2955=['moment','request-promise','../../config/environment','./automation.attributes','Automation','tools_automations','lodash','../../config/logger','api'];(function(_0x3c1dd0,_0x490ac1){var _0x5f3c86=function(_0x389c40){while(--_0x389c40){_0x3c1dd0['push'](_0x3c1dd0['shift']());}};_0x5f3c86(++_0x490ac1);}(_0x2955,0x1ad));var _0x5295=function(_0x39fd87,_0x38899c){_0x39fd87=_0x39fd87-0x0;var _0x36a842=_0x2955[_0x39fd87];return _0x36a842;};'use strict';var _=require(_0x5295('0x0'));var util=require('util');var logger=require(_0x5295('0x1'))(_0x5295('0x2'));var moment=require(_0x5295('0x3'));var BPromise=require('bluebird');var rp=require(_0x5295('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5295('0x5'));var attributes=require(_0x5295('0x6'));module['exports']=function(_0x2b13c2,_0x1a6ddf){return _0x2b13c2['define'](_0x5295('0x7'),attributes,{'tableName':_0x5295('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index b9dbfb8..cfb9219 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 _0x8f4c=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0xc5c9ac,_0x57c492){var _0x3f4606=function(_0x2aa448){while(--_0x2aa448){_0xc5c9ac['push'](_0xc5c9ac['shift']());}};_0x3f4606(++_0x57c492);}(_0x8f4c,0x113));var _0xc8f4=function(_0x560239,_0xc329f6){_0x560239=_0x560239-0x0;var _0x344a6c=_0x8f4c[_0x560239];return _0x344a6c;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});} \ No newline at end of file +var _0x9f37=['lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x281224,_0x1e5fc1){var _0x343216=function(_0x16a98d){while(--_0x16a98d){_0x281224['push'](_0x281224['shift']());}};_0x343216(++_0x1e5fc1);}(_0x9f37,0xd1));var _0x79f3=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x9f37[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var moment=require('moment');var BPromise=require(_0x79f3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x79f3('0x3'))['db'];var utils=require(_0x79f3('0x4'));var logger=require(_0x79f3('0x5'))('rpc');var config=require(_0x79f3('0x6'));var jayson=require(_0x79f3('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x171940,_0x42b440,_0x2ad818){return new BPromise(function(_0xe4ed49,_0x59efc6){return client[_0x79f3('0x8')](_0x171940,_0x2ad818)[_0x79f3('0x9')](function(_0x4b4562){logger[_0x79f3('0xa')](_0x79f3('0xb'),_0x42b440,_0x79f3('0xc'));logger[_0x79f3('0xd')](_0x79f3('0xe'),_0x42b440,'request\x20sent',JSON[_0x79f3('0xf')](_0x4b4562));if(_0x4b4562[_0x79f3('0x10')]){if(_0x4b4562['error']['code']===0x1f4){logger[_0x79f3('0x10')](_0x79f3('0xb'),_0x42b440,_0x4b4562[_0x79f3('0x10')][_0x79f3('0x11')]);return _0x59efc6(_0x4b4562['error'][_0x79f3('0x11')]);}logger[_0x79f3('0x10')](_0x79f3('0xb'),_0x42b440,_0x4b4562[_0x79f3('0x10')][_0x79f3('0x11')]);return _0xe4ed49(_0x4b4562[_0x79f3('0x10')]['message']);}else{logger['info'](_0x79f3('0xb'),_0x42b440,_0x79f3('0xc'));_0xe4ed49(_0x4b4562['result'][_0x79f3('0x11')]);}})[_0x79f3('0x12')](function(_0x23874b){logger[_0x79f3('0x10')]('Automation,\x20%s,\x20%s',_0x42b440,_0x23874b);_0x59efc6(_0x23874b);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index f9a78f5..441cab3 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 _0xc964=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','post','create','/:id/actions','update','destroy','exports'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0xc964,0x7e));var _0x4c96=function(_0x17fc43,_0x4a5a33){_0x17fc43=_0x17fc43-0x0;var _0x2691dc=_0xc964[_0x17fc43];return _0x2691dc;};'use strict';var multer=require(_0x4c96('0x0'));var util=require(_0x4c96('0x1'));var path=require('path');var timeout=require(_0x4c96('0x2'));var express=require(_0x4c96('0x3'));var router=express[_0x4c96('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4c96('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4c96('0x6'));var controller=require(_0x4c96('0x7'));router[_0x4c96('0x8')]('/',auth[_0x4c96('0x9')](),controller[_0x4c96('0xa')]);router[_0x4c96('0x8')](_0x4c96('0xb'),auth['isAuthenticated'](),controller[_0x4c96('0xc')]);router[_0x4c96('0x8')](_0x4c96('0xd'),auth['isAuthenticated'](),controller[_0x4c96('0xe')]);router[_0x4c96('0x8')]('/:id/actions',auth['isAuthenticated'](),controller['getActions']);router[_0x4c96('0xf')]('/',auth[_0x4c96('0x9')](),controller[_0x4c96('0x10')]);router['post'](_0x4c96('0xd'),auth['isAuthenticated'](),controller['addConditions']);router[_0x4c96('0xf')](_0x4c96('0x11'),auth[_0x4c96('0x9')](),controller['addActions']);router['put'](_0x4c96('0xb'),auth[_0x4c96('0x9')](),controller[_0x4c96('0x12')]);router['delete'](_0x4c96('0xb'),auth[_0x4c96('0x9')](),controller[_0x4c96('0x13')]);module[_0x4c96('0x14')]=router; \ No newline at end of file +var _0xf429=['fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','index','get','/:id','isAuthenticated','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','exports','util','path','connect-timeout','Router'];(function(_0xe84805,_0x2702d9){var _0x398efd=function(_0x37cfad){while(--_0x37cfad){_0xe84805['push'](_0xe84805['shift']());}};_0x398efd(++_0x2702d9);}(_0xf429,0xd4));var _0x9f42=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xf429[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require('multer');var util=require(_0x9f42('0x0'));var path=require(_0x9f42('0x1'));var timeout=require(_0x9f42('0x2'));var express=require('express');var router=express[_0x9f42('0x3')]();var fs_extra=require(_0x9f42('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9f42('0x5'));var config=require(_0x9f42('0x6'));var controller=require(_0x9f42('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x9f42('0x8')]);router[_0x9f42('0x9')](_0x9f42('0xa'),auth[_0x9f42('0xb')](),controller['show']);router['get'](_0x9f42('0xc'),auth['isAuthenticated'](),controller[_0x9f42('0xd')]);router['get'](_0x9f42('0xe'),auth[_0x9f42('0xb')](),controller[_0x9f42('0xf')]);router[_0x9f42('0x10')]('/',auth[_0x9f42('0xb')](),controller[_0x9f42('0x11')]);router['post'](_0x9f42('0xc'),auth['isAuthenticated'](),controller[_0x9f42('0x12')]);router[_0x9f42('0x10')](_0x9f42('0xe'),auth[_0x9f42('0xb')](),controller[_0x9f42('0x13')]);router[_0x9f42('0x14')]('/:id',auth[_0x9f42('0xb')](),controller[_0x9f42('0x15')]);router[_0x9f42('0x16')](_0x9f42('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x9f42('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 0e3db79..842b70a 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 _0xf131=['Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','STRING','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','ENUM','always','never','BOOLEAN','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','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)'];(function(_0x4f637c,_0xb5e9de){var _0x307ee7=function(_0x3751d4){while(--_0x3751d4){_0x4f637c['push'](_0x4f637c['shift']());}};_0x307ee7(++_0xb5e9de);}(_0xf131,0x19d));var _0x1f13=function(_0x2f0b2c,_0x69226){_0x2f0b2c=_0x2f0b2c-0x0;var _0x4a4793=_0xf131[_0x2f0b2c];return _0x4a4793;};'use strict';var Sequelize=require(_0x1f13('0x0'));module[_0x1f13('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1f13('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x1f13('0x3')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1f13('0x4')},'limitCalls':{'type':Sequelize[_0x1f13('0x5')](0x4)[_0x1f13('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x1f13('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1f13('0x3')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1f13('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f13('0x7')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1f13('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f13('0x8')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f13('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1f13('0x5')](0x5)[_0x1f13('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f13('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1f13('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x1f13('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f13('0xc')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1f13('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x1f13('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1f13('0x3')],'defaultValue':_0x1f13('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0x1f13('0xe')](_0x1f13('0xf'),_0x1f13('0x10'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x1f13('0x11')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x1f13('0x5')](0x9)[_0x1f13('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1f13('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x1f13('0x5')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1f13('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1f13('0x5')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1f13('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1f13('0x5')](0x9)[_0x1f13('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1f13('0x15')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x1f13('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1f13('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1f13('0x5')](0x9)[_0x1f13('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1f13('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1f13('0x5')](0x9)[_0x1f13('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1f13('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1f13('0x5')](0x5)[_0x1f13('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1f13('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1f13('0x5')](0x9)[_0x1f13('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1f13('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1f13('0xe')]('DESC','ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x1f13('0x3')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1f13('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1f13('0x1b')},'dialCutDigit':{'type':Sequelize[_0x1f13('0x5')](0x3)[_0x1f13('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1f13('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1f13('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f13('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1f13('0x5')](0x5)[_0x1f13('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f13('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x1f13('0x5')](0x5)[_0x1f13('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f13('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f13('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1f13('0x5')](0x5)[_0x1f13('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f13('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x1f13('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f13('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1f13('0x5')](0x5)[_0x1f13('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f13('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1f13('0x5')](0x3)[_0x1f13('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1f13('0x5')](0x5)[_0x1f13('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f13('0x24')}}; \ No newline at end of file +var _0x539d=['#Drop\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#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','DESC','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x167b84,_0x3233e2){var _0x30d147=function(_0xf8f1a6){while(--_0xf8f1a6){_0x167b84['push'](_0x167b84['shift']());}};_0x30d147(++_0x3233e2);}(_0x539d,0xc9));var _0xd539=function(_0x5adb18,_0x222326){_0x5adb18=_0x5adb18-0x0;var _0x420c98=_0x539d[_0x5adb18];return _0x420c98;};'use strict';var Sequelize=require(_0xd539('0x0'));module[_0xd539('0x1')]={'name':{'type':Sequelize[_0xd539('0x2')],'unique':_0xd539('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd539('0x4')](_0xd539('0x5')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xd539('0x2')]},'active':{'type':Sequelize[_0xd539('0x6')],'defaultValue':0x0,'comment':_0xd539('0x7')},'limitCalls':{'type':Sequelize[_0xd539('0x8')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xd539('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xd539('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xd539('0x8')](0x3)[_0xd539('0xa')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd539('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd539('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd539('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xd539('0x8')](0x3)[_0xd539('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd539('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xd539('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd539('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd539('0x8')](0x3)[_0xd539('0xa')],'defaultValue':0x3,'comment':_0xd539('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd539('0x8')](0x5)[_0xd539('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xd539('0x8')](0x3)[_0xd539('0xa')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd539('0x10')},'dialTimezone':{'type':Sequelize[_0xd539('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd539('0x2')],'defaultValue':_0xd539('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0xd539('0x4')](_0xd539('0x12'),'never',_0xd539('0x13')),'defaultValue':_0xd539('0x12')},'dialAMDActive':{'type':Sequelize[_0xd539('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xd539('0x8')](0x9)[_0xd539('0xa')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd539('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xd539('0x8')](0x9)[_0xd539('0xa')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd539('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd539('0x8')](0x9)[_0xd539('0xa')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd539('0x8')](0x9)[_0xd539('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd539('0x16')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xd539('0xa')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd539('0x8')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd539('0x8')](0x9)[_0xd539('0xa')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd539('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd539('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd539('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd539('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd539('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd539('0x4')](_0xd539('0x1a'),_0xd539('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd539('0x8')](0x3)[_0xd539('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xd539('0x8')](0x3)[_0xd539('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd539('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd539('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd539('0x8')](0x5)[_0xd539('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd539('0x1d')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd539('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0xd539('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd539('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd539('0x8')](0x5)[_0xd539('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xd539('0x8')](0x3)[_0xd539('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd539('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0xd539('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd539('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd539('0x20')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index df05761..6dacac9 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 _0x49f8=['count','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','Campaign','fieldName','map','query','keys','intersection','model','attributes','fields','nolimit','order','sort','where','filters','pick','type','VIRTUAL','merge','options','includeAll','include','catch','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','getHoppers','findOne','hasOwnProperty','CampaignId','filter','CmHopper','findAll','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','NOW()','ListId\x20=\x20?','cm_hopper_additional_phones','OrderBy','h.id','ci.item','ci.OrderBY','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','fast-json-patch','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x2dd1a2,_0xeea860){var _0x3f2e18=function(_0x49cd65){while(--_0x49cd65){_0x2dd1a2['push'](_0x2dd1a2['shift']());}};_0x3f2e18(++_0xeea860);}(_0x49f8,0xff));var _0x849f=function(_0x298f26,_0x20cbf2){_0x298f26=_0x298f26-0x0;var _0x4bd7a8=_0x49f8[_0x298f26];return _0x4bd7a8;};'use strict';var emlformat=require(_0x849f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x849f('0x1'));var rp=require(_0x849f('0x2'));var moment=require('moment');var BPromise=require(_0x849f('0x3'));var Mustache=require('mustache');var util=require(_0x849f('0x4'));var path=require('path');var sox=require(_0x849f('0x5'));var csv=require('to-csv');var ejs=require(_0x849f('0x6'));var fs=require('fs');var fs_extra=require(_0x849f('0x7'));var _=require(_0x849f('0x8'));var squel=require(_0x849f('0x9'));var crypto=require(_0x849f('0xa'));var jsforce=require(_0x849f('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x849f('0xc'));var Redis=require(_0x849f('0xd'));var authService=require(_0x849f('0xe'));var qs=require(_0x849f('0xf'));var as=require(_0x849f('0x10'));var hardwareService=require(_0x849f('0x11'));var logger=require(_0x849f('0x12'))('api');var utils=require(_0x849f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x849f('0x14'));var db=require(_0x849f('0x15'))['db'];function respondWithStatusCode(_0x401480,_0x23c0ef){_0x23c0ef=_0x23c0ef||0xcc;return function(_0x58dede){if(_0x58dede){return _0x401480[_0x849f('0x16')](_0x23c0ef);}return _0x401480[_0x849f('0x17')](_0x23c0ef)[_0x849f('0x18')]();};}function respondWithResult(_0x425d0c,_0x176936){_0x176936=_0x176936||0xc8;return function(_0x49901e){if(_0x49901e){return _0x425d0c['status'](_0x176936)[_0x849f('0x19')](_0x49901e);}};}function respondWithFilteredResult(_0x5952d7,_0x26845f){return function(_0x204330){if(_0x204330){var _0x45b940=typeof _0x26845f[_0x849f('0x1a')]===_0x849f('0x1b')&&typeof _0x26845f[_0x849f('0x1c')]===_0x849f('0x1b');var _0x5ed88d=_0x204330[_0x849f('0x1d')];var _0x20bea7=_0x45b940?0x0:_0x26845f[_0x849f('0x1a')];var _0x541cd6=_0x45b940?_0x204330[_0x849f('0x1d')]:_0x26845f[_0x849f('0x1a')]+_0x26845f['limit'];var _0x1ca1d6;if(_0x541cd6>=_0x5ed88d){_0x541cd6=_0x5ed88d;_0x1ca1d6=0xc8;}else{_0x1ca1d6=0xce;}_0x5952d7[_0x849f('0x17')](_0x1ca1d6);return _0x5952d7['set']('Content-Range',_0x20bea7+'-'+_0x541cd6+'/'+_0x5ed88d)[_0x849f('0x19')](_0x204330);}return null;};}function patchUpdates(_0x11d183){return function(_0x1dc579){try{jsonpatch[_0x849f('0x1e')](_0x1dc579,_0x11d183,!![]);}catch(_0x24414f){return BPromise[_0x849f('0x1f')](_0x24414f);}return _0x1dc579[_0x849f('0x20')]();};}function saveUpdates(_0x2af70d,_0x4b29f1){return function(_0x1d0da5){if(_0x1d0da5){return _0x1d0da5[_0x849f('0x21')](_0x2af70d)[_0x849f('0x22')](function(_0x2229c0){return _0x2229c0;});}return null;};}function removeEntity(_0x909e11,_0x4fdf55){return function(_0x3a5724){if(_0x3a5724){return _0x3a5724[_0x849f('0x23')]()[_0x849f('0x22')](function(){var _0xe404c6=_0x3a5724[_0x849f('0x24')]({'plain':!![]});var _0x264e89=_0x849f('0x25');return db[_0x849f('0x26')][_0x849f('0x23')]({'where':{'type':_0x264e89,'resourceId':_0xe404c6['id']}})[_0x849f('0x22')](function(){return _0x3a5724;});})[_0x849f('0x22')](function(){_0x909e11[_0x849f('0x17')](0xcc)[_0x849f('0x18')]();});}};}function handleEntityNotFound(_0x529c3b,_0x3c3f0a){return function(_0x4aadde){if(!_0x4aadde){_0x529c3b[_0x849f('0x16')](0x194);}return _0x4aadde;};}function handleError(_0xf27d76,_0x3afe16){_0x3afe16=_0x3afe16||0x1f4;return function(_0x295008){logger[_0x849f('0x27')](_0x295008[_0x849f('0x28')]);if(_0x295008['name']){delete _0x295008[_0x849f('0x29')];}_0xf27d76[_0x849f('0x17')](_0x3afe16)[_0x849f('0x2a')](_0x295008);};}exports['index']=function(_0x347c93,_0x5b8580){var _0x2398a6={},_0x2ffa0a={},_0x7facd0={'count':0x0,'rows':[]};var _0xb29717=_['map'](db[_0x849f('0x2b')]['rawAttributes'],function(_0x492407){return{'name':_0x492407[_0x849f('0x2c')],'type':_0x492407['type']['key']};});_0x2ffa0a['model']=_[_0x849f('0x2d')](_0xb29717,_0x849f('0x29'));_0x2ffa0a[_0x849f('0x2e')]=_[_0x849f('0x2f')](_0x347c93[_0x849f('0x2e')]);_0x2ffa0a['filters']=_[_0x849f('0x30')](_0x2ffa0a[_0x849f('0x31')],_0x2ffa0a[_0x849f('0x2e')]);_0x2398a6[_0x849f('0x32')]=_[_0x849f('0x30')](_0x2ffa0a[_0x849f('0x31')],qs[_0x849f('0x33')](_0x347c93[_0x849f('0x2e')][_0x849f('0x33')]));_0x2398a6[_0x849f('0x32')]=_0x2398a6['attributes']['length']?_0x2398a6[_0x849f('0x32')]:_0x2ffa0a[_0x849f('0x31')];if(!_0x347c93[_0x849f('0x2e')]['hasOwnProperty'](_0x849f('0x34'))){_0x2398a6[_0x849f('0x1c')]=qs[_0x849f('0x1c')](_0x347c93[_0x849f('0x2e')]['limit']);_0x2398a6[_0x849f('0x1a')]=qs[_0x849f('0x1a')](_0x347c93[_0x849f('0x2e')][_0x849f('0x1a')]);}_0x2398a6[_0x849f('0x35')]=qs[_0x849f('0x36')](_0x347c93[_0x849f('0x2e')]['sort']);_0x2398a6[_0x849f('0x37')]=qs[_0x849f('0x38')](_[_0x849f('0x39')](_0x347c93['query'],_0x2ffa0a['filters']),_0xb29717);if(_0x347c93[_0x849f('0x2e')]['filter']){_0x2398a6[_0x849f('0x37')]=_['merge'](_0x2398a6[_0x849f('0x37')],{'$or':_[_0x849f('0x2d')](_0xb29717,function(_0x5eeb92){if(_0x5eeb92[_0x849f('0x3a')]!==_0x849f('0x3b')){var _0x1a5e28={};_0x1a5e28[_0x5eeb92[_0x849f('0x29')]]={'$like':'%'+_0x347c93['query']['filter']+'%'};return _0x1a5e28;}})});}_0x2398a6=_[_0x849f('0x3c')]({},_0x2398a6,_0x347c93[_0x849f('0x3d')]);var _0x4aa91b={'where':_0x2398a6[_0x849f('0x37')]};return db[_0x849f('0x2b')][_0x849f('0x1d')](_0x4aa91b)['then'](function(_0x29e808){_0x7facd0[_0x849f('0x1d')]=_0x29e808;if(_0x347c93[_0x849f('0x2e')][_0x849f('0x3e')]){_0x2398a6[_0x849f('0x3f')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x2398a6);})[_0x849f('0x22')](function(_0x2a7ed9){_0x7facd0['rows']=_0x2a7ed9;return _0x7facd0;})[_0x849f('0x22')](respondWithFilteredResult(_0x5b8580,_0x2398a6))[_0x849f('0x40')](handleError(_0x5b8580,null));};exports['show']=function(_0x2826f2,_0x138c78){var _0x1d6733={'raw':![],'where':{'id':_0x2826f2[_0x849f('0x41')]['id']}},_0x2276db={};_0x2276db[_0x849f('0x31')]=_[_0x849f('0x2f')](db[_0x849f('0x2b')][_0x849f('0x42')]);_0x2276db[_0x849f('0x2e')]=_[_0x849f('0x2f')](_0x2826f2[_0x849f('0x2e')]);_0x2276db[_0x849f('0x38')]=_[_0x849f('0x30')](_0x2276db['model'],_0x2276db[_0x849f('0x2e')]);_0x1d6733[_0x849f('0x32')]=_[_0x849f('0x30')](_0x2276db[_0x849f('0x31')],qs[_0x849f('0x33')](_0x2826f2[_0x849f('0x2e')]['fields']));_0x1d6733[_0x849f('0x32')]=_0x1d6733[_0x849f('0x32')][_0x849f('0x43')]?_0x1d6733[_0x849f('0x32')]:_0x2276db[_0x849f('0x31')];if(_0x2826f2['query'][_0x849f('0x3e')]){_0x1d6733['include']=[{'all':!![]}];}_0x1d6733=_[_0x849f('0x3c')]({},_0x1d6733,_0x2826f2[_0x849f('0x3d')]);return db[_0x849f('0x2b')][_0x849f('0x44')](_0x1d6733)[_0x849f('0x22')](handleEntityNotFound(_0x138c78,null))[_0x849f('0x22')](respondWithResult(_0x138c78,null))['catch'](handleError(_0x138c78,null));};exports[_0x849f('0x45')]=function(_0x1d7be3,_0x3f63fd){return db[_0x849f('0x2b')][_0x849f('0x45')](_0x1d7be3[_0x849f('0x46')],{})[_0x849f('0x22')](function(_0x3eafbc){var _0x20469e=_0x1d7be3[_0x849f('0x47')][_0x849f('0x24')]({'plain':!![]});if(!_0x20469e)throw new Error(_0x849f('0x48'));if(_0x20469e[_0x849f('0x49')]===_0x849f('0x47')){var _0x36e27c=_0x3eafbc[_0x849f('0x24')]({'plain':!![]});var _0x396abd='IvrCampaigns';return db[_0x849f('0x4a')]['find']({'where':{'name':_0x396abd,'userProfileId':_0x20469e[_0x849f('0x4b')]},'raw':!![]})[_0x849f('0x22')](function(_0x35dafb){if(_0x35dafb&&_0x35dafb[_0x849f('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x36e27c['name'],'resourceId':_0x36e27c['id'],'type':_0x35dafb['name'],'sectionId':_0x35dafb['id']},{})['then'](function(){return _0x3eafbc;});}else{return _0x3eafbc;}})['catch'](function(_0x1f6117){logger[_0x849f('0x27')](_0x849f('0x4d'),_0x1f6117);throw _0x1f6117;});}return _0x3eafbc;})[_0x849f('0x22')](respondWithResult(_0x3f63fd,0xc9))[_0x849f('0x40')](handleError(_0x3f63fd,null));};exports[_0x849f('0x4e')]=function(_0x3f653,_0x53add4){var _0x2ae2bc={'where':{'id':_0x3f653[_0x849f('0x41')]['id']}},_0xa7d9e2={};_0xa7d9e2[_0x849f('0x31')]=_[_0x849f('0x2f')](db[_0x849f('0x2b')][_0x849f('0x42')]);_0x2ae2bc[_0x849f('0x32')]=_['intersection'](_0xa7d9e2['model'],qs[_0x849f('0x33')](_0x3f653[_0x849f('0x2e')][_0x849f('0x33')]));_0x2ae2bc[_0x849f('0x32')]=_0x2ae2bc[_0x849f('0x32')][_0x849f('0x43')]?_0x2ae2bc[_0x849f('0x32')]:_0xa7d9e2[_0x849f('0x31')];if(_0x3f653[_0x849f('0x2e')][_0x849f('0x3e')]){_0x2ae2bc['include']=[{'all':!![]}];}_0x2ae2bc=_['merge']({},_0x2ae2bc,_0x3f653[_0x849f('0x3d')]);return db[_0x849f('0x2b')][_0x849f('0x44')](_0x2ae2bc)[_0x849f('0x22')](handleEntityNotFound(_0x53add4,null))[_0x849f('0x22')](function(_0xaee663){if(_0xaee663){var _0x548052=_0xaee663['get']({'plain':!![]});_0x548052=qs[_0x849f('0x4f')](_0x548052,['id','createdAt',_0x849f('0x50')]);_0x3f653['body']=_[_0x849f('0x4f')](_0x3f653[_0x849f('0x46')],['id',_0x849f('0x51'),_0x849f('0x50')]);return db[_0x849f('0x2b')][_0x849f('0x45')](_[_0x849f('0x3c')](_0x548052,_0x3f653['body']),{'include':_0x3f653[_0x849f('0x2e')][_0x849f('0x3e')]?[{'all':!![]}]:undefined})[_0x849f('0x22')](function(_0x36e35d){var _0x3a03d9=_0x3f653[_0x849f('0x47')][_0x849f('0x24')]({'plain':!![]});if(!_0x3a03d9)throw new Error(_0x849f('0x48'));if(_0x3a03d9[_0x849f('0x49')]==='user'){var _0x224535=_0x36e35d[_0x849f('0x24')]({'plain':!![]});var _0x15bc9a='IvrCampaigns';return db[_0x849f('0x4a')][_0x849f('0x44')]({'where':{'name':_0x15bc9a,'userProfileId':_0x3a03d9[_0x849f('0x4b')]},'raw':!![]})[_0x849f('0x22')](function(_0x236dda){if(_0x236dda&&_0x236dda['autoAssociation']===0x0){return db['UserProfileResource'][_0x849f('0x45')]({'name':_0x224535[_0x849f('0x29')],'resourceId':_0x224535['id'],'type':_0x236dda[_0x849f('0x29')],'sectionId':_0x236dda['id']},{})[_0x849f('0x22')](function(){return _0x36e35d;});}else{return _0x36e35d;}})['catch'](function(_0x1ed924){logger[_0x849f('0x27')](_0x849f('0x4d'),_0x1ed924);throw _0x1ed924;});}return _0x36e35d;});}})[_0x849f('0x22')](respondWithResult(_0x53add4,0xc9))['catch'](handleError(_0x53add4,null));};exports[_0x849f('0x21')]=function(_0x5e69fa,_0x11f379){if(_0x5e69fa[_0x849f('0x46')]['id']){delete _0x5e69fa[_0x849f('0x46')]['id'];}return db['Campaign']['find']({'where':{'id':_0x5e69fa[_0x849f('0x41')]['id']}})[_0x849f('0x22')](handleEntityNotFound(_0x11f379,null))[_0x849f('0x22')](saveUpdates(_0x5e69fa[_0x849f('0x46')],null))[_0x849f('0x22')](respondWithResult(_0x11f379,null))[_0x849f('0x40')](handleError(_0x11f379,null));};exports[_0x849f('0x23')]=function(_0x53a5a9,_0x1c799e){return db[_0x849f('0x2b')][_0x849f('0x44')]({'where':{'id':_0x53a5a9[_0x849f('0x41')]['id']}})[_0x849f('0x22')](handleEntityNotFound(_0x1c799e,null))['then'](removeEntity(_0x1c799e,null))['catch'](handleError(_0x1c799e,null));};exports[_0x849f('0x52')]=function(_0xd2b076,_0x2f8178,_0x28a0d2){var _0x2e9dec={'raw':!![],'where':{}};var _0xb03561={};var _0x2d9494={'count':0x0,'rows':[]};return db[_0x849f('0x2b')][_0x849f('0x53')]({'where':{'id':_0xd2b076[_0x849f('0x41')]['id']}})[_0x849f('0x22')](handleEntityNotFound(_0x2f8178,null))[_0x849f('0x22')](function(_0x5f1192){if(_0x5f1192){_0xb03561['model']=_[_0x849f('0x2f')](db['CmHopper'][_0x849f('0x42')]);_0xb03561[_0x849f('0x2e')]=_[_0x849f('0x2f')](_0xd2b076[_0x849f('0x2e')]);_0xb03561[_0x849f('0x38')]=_[_0x849f('0x30')](_0xb03561[_0x849f('0x31')],_0xb03561[_0x849f('0x2e')]);_0x2e9dec[_0x849f('0x32')]=_[_0x849f('0x30')](_0xb03561[_0x849f('0x31')],qs[_0x849f('0x33')](_0xd2b076['query'][_0x849f('0x33')]));_0x2e9dec['attributes']=_0x2e9dec[_0x849f('0x32')][_0x849f('0x43')]?_0x2e9dec[_0x849f('0x32')]:_0xb03561[_0x849f('0x31')];if(!_0xd2b076[_0x849f('0x2e')][_0x849f('0x54')](_0x849f('0x34'))){_0x2e9dec[_0x849f('0x1c')]=qs[_0x849f('0x1c')](_0xd2b076[_0x849f('0x2e')][_0x849f('0x1c')]);_0x2e9dec[_0x849f('0x1a')]=qs[_0x849f('0x1a')](_0xd2b076[_0x849f('0x2e')][_0x849f('0x1a')]);}_0x2e9dec[_0x849f('0x35')]=qs[_0x849f('0x36')](_0xd2b076['query'][_0x849f('0x36')]);_0x2e9dec['where']=qs[_0x849f('0x38')](_[_0x849f('0x39')](_0xd2b076['query'],_0xb03561[_0x849f('0x38')]));_0x2e9dec['where'][_0x849f('0x55')]=_0x5f1192['id'];if(_0xd2b076[_0x849f('0x2e')][_0x849f('0x56')]){_0x2e9dec[_0x849f('0x37')]=_[_0x849f('0x3c')](_0x2e9dec[_0x849f('0x37')],{'$or':_['map'](_0x2e9dec[_0x849f('0x32')],function(_0x21617b){var _0xd29499={};_0xd29499[_0x21617b]={'$like':'%'+_0xd2b076[_0x849f('0x2e')][_0x849f('0x56')]+'%'};return _0xd29499;})});}_0x2e9dec=_[_0x849f('0x3c')]({},_0x2e9dec,_0xd2b076[_0x849f('0x3d')]);return db[_0x849f('0x57')][_0x849f('0x1d')]({'where':_0x2e9dec[_0x849f('0x37')]})[_0x849f('0x22')](function(_0x14c88f){_0x2d9494[_0x849f('0x1d')]=_0x14c88f;if(_0xd2b076[_0x849f('0x2e')][_0x849f('0x3e')]){_0x2e9dec[_0x849f('0x3f')]=[{'all':!![]}];}return db[_0x849f('0x57')][_0x849f('0x58')](_0x2e9dec);})[_0x849f('0x22')](function(_0x28fe31){_0x2d9494[_0x849f('0x59')]=_0x28fe31;return _0x2d9494;});}})['then'](respondWithFilteredResult(_0x2f8178,_0x2e9dec))[_0x849f('0x40')](handleError(_0x2f8178,null));};exports[_0x849f('0x5a')]=function(_0x2694ab,_0x131e03,_0x411003){var _0x586c3e={'raw':!![],'where':{}};var _0x22ebea={};var _0x2d379b={'count':0x0,'rows':[]};return db[_0x849f('0x2b')][_0x849f('0x53')]({'where':{'id':_0x2694ab[_0x849f('0x41')]['id']}})[_0x849f('0x22')](handleEntityNotFound(_0x131e03,null))['then'](function(_0x3cf132){if(_0x3cf132){_0x22ebea[_0x849f('0x31')]=_[_0x849f('0x2f')](db[_0x849f('0x5b')][_0x849f('0x42')]);_0x22ebea[_0x849f('0x2e')]=_['keys'](_0x2694ab['query']);_0x22ebea['filters']=_['intersection'](_0x22ebea[_0x849f('0x31')],_0x22ebea[_0x849f('0x2e')]);_0x586c3e['attributes']=_['intersection'](_0x22ebea[_0x849f('0x31')],qs[_0x849f('0x33')](_0x2694ab[_0x849f('0x2e')]['fields']));_0x586c3e[_0x849f('0x32')]=_0x586c3e[_0x849f('0x32')][_0x849f('0x43')]?_0x586c3e['attributes']:_0x22ebea[_0x849f('0x31')];if(!_0x2694ab[_0x849f('0x2e')][_0x849f('0x54')](_0x849f('0x34'))){_0x586c3e['limit']=qs['limit'](_0x2694ab['query'][_0x849f('0x1c')]);_0x586c3e[_0x849f('0x1a')]=qs[_0x849f('0x1a')](_0x2694ab[_0x849f('0x2e')]['offset']);}_0x586c3e[_0x849f('0x35')]=qs['sort'](_0x2694ab[_0x849f('0x2e')]['sort']);_0x586c3e['where']=qs[_0x849f('0x38')](_[_0x849f('0x39')](_0x2694ab[_0x849f('0x2e')],_0x22ebea[_0x849f('0x38')]));_0x586c3e[_0x849f('0x37')][_0x849f('0x55')]=_0x3cf132['id'];if(_0x2694ab['query'][_0x849f('0x56')]){_0x586c3e['where']=_[_0x849f('0x3c')](_0x586c3e[_0x849f('0x37')],{'$or':_[_0x849f('0x2d')](_0x586c3e[_0x849f('0x32')],function(_0x508eb4){var _0xe0c1eb={};_0xe0c1eb[_0x508eb4]={'$like':'%'+_0x2694ab[_0x849f('0x2e')][_0x849f('0x56')]+'%'};return _0xe0c1eb;})});}_0x586c3e=_[_0x849f('0x3c')]({},_0x586c3e,_0x2694ab[_0x849f('0x3d')]);return db[_0x849f('0x5b')][_0x849f('0x1d')]({'where':_0x586c3e[_0x849f('0x37')]})[_0x849f('0x22')](function(_0x533d2d){_0x2d379b[_0x849f('0x1d')]=_0x533d2d;if(_0x2694ab[_0x849f('0x2e')]['includeAll']){_0x586c3e[_0x849f('0x3f')]=[{'all':!![]}];}return db[_0x849f('0x5b')][_0x849f('0x58')](_0x586c3e);})[_0x849f('0x22')](function(_0xb03b73){_0x2d379b[_0x849f('0x59')]=_0xb03b73;return _0x2d379b;});}})['then'](respondWithFilteredResult(_0x131e03,_0x586c3e))[_0x849f('0x40')](handleError(_0x131e03,null));};exports[_0x849f('0x5c')]=function(_0x1bebe0,_0x10d225,_0x1a1dd9){var _0x123eb6={'raw':!![],'where':{}};var _0x2009bc={};var _0x2789f0={'count':0x0,'rows':[]};return db[_0x849f('0x2b')][_0x849f('0x53')]({'where':{'id':_0x1bebe0[_0x849f('0x41')]['id']}})[_0x849f('0x22')](handleEntityNotFound(_0x10d225,null))['then'](function(_0x265b2b){if(_0x265b2b){_0x2009bc['model']=_[_0x849f('0x2f')](db[_0x849f('0x5d')][_0x849f('0x42')]);_0x2009bc['query']=_[_0x849f('0x2f')](_0x1bebe0[_0x849f('0x2e')]);_0x2009bc[_0x849f('0x38')]=_[_0x849f('0x30')](_0x2009bc[_0x849f('0x31')],_0x2009bc[_0x849f('0x2e')]);_0x123eb6[_0x849f('0x32')]=_[_0x849f('0x30')](_0x2009bc[_0x849f('0x31')],qs[_0x849f('0x33')](_0x1bebe0[_0x849f('0x2e')][_0x849f('0x33')]));_0x123eb6[_0x849f('0x32')]=_0x123eb6['attributes'][_0x849f('0x43')]?_0x123eb6['attributes']:_0x2009bc[_0x849f('0x31')];if(!_0x1bebe0[_0x849f('0x2e')]['hasOwnProperty'](_0x849f('0x34'))){_0x123eb6[_0x849f('0x1c')]=qs[_0x849f('0x1c')](_0x1bebe0['query'][_0x849f('0x1c')]);_0x123eb6[_0x849f('0x1a')]=qs[_0x849f('0x1a')](_0x1bebe0[_0x849f('0x2e')]['offset']);}_0x123eb6[_0x849f('0x35')]=qs[_0x849f('0x36')](_0x1bebe0[_0x849f('0x2e')][_0x849f('0x36')]);_0x123eb6[_0x849f('0x37')]=qs['filters'](_['pick'](_0x1bebe0[_0x849f('0x2e')],_0x2009bc[_0x849f('0x38')]));_0x123eb6['where']['CampaignId']=_0x265b2b['id'];if(_0x1bebe0[_0x849f('0x2e')][_0x849f('0x56')]){_0x123eb6[_0x849f('0x37')]=_[_0x849f('0x3c')](_0x123eb6['where'],{'$or':_[_0x849f('0x2d')](_0x123eb6[_0x849f('0x32')],function(_0x3b6f6d){var _0x2f2fb1={};_0x2f2fb1[_0x3b6f6d]={'$like':'%'+_0x1bebe0[_0x849f('0x2e')]['filter']+'%'};return _0x2f2fb1;})});}_0x123eb6=_[_0x849f('0x3c')]({},_0x123eb6,_0x1bebe0[_0x849f('0x3d')]);return db[_0x849f('0x5d')]['count']({'where':_0x123eb6[_0x849f('0x37')]})[_0x849f('0x22')](function(_0x319c14){_0x2789f0[_0x849f('0x1d')]=_0x319c14;if(_0x1bebe0[_0x849f('0x2e')][_0x849f('0x3e')]){_0x123eb6[_0x849f('0x3f')]=[{'all':!![]}];}return db[_0x849f('0x5d')][_0x849f('0x58')](_0x123eb6);})[_0x849f('0x22')](function(_0x2b8355){_0x2789f0[_0x849f('0x59')]=_0x2b8355;return _0x2789f0;});}})['then'](respondWithFilteredResult(_0x10d225,_0x123eb6))['catch'](handleError(_0x10d225,null));};exports[_0x849f('0x5e')]=function(_0x3f51ee,_0x1e3461,_0x302364){var _0xe8d97={'raw':!![],'where':{}};var _0x13b92d={};var _0x2b31ed={'count':0x0,'rows':[]};return db['Campaign'][_0x849f('0x53')]({'where':{'id':_0x3f51ee['params']['id']}})['then'](handleEntityNotFound(_0x1e3461,null))[_0x849f('0x22')](function(_0x26fedc){if(_0x26fedc){_0x13b92d[_0x849f('0x31')]=_[_0x849f('0x2f')](db['CmHopperBlack']['rawAttributes']);_0x13b92d[_0x849f('0x2e')]=_['keys'](_0x3f51ee[_0x849f('0x2e')]);_0x13b92d['filters']=_[_0x849f('0x30')](_0x13b92d[_0x849f('0x31')],_0x13b92d['query']);_0xe8d97['attributes']=_[_0x849f('0x30')](_0x13b92d[_0x849f('0x31')],qs[_0x849f('0x33')](_0x3f51ee[_0x849f('0x2e')]['fields']));_0xe8d97[_0x849f('0x32')]=_0xe8d97[_0x849f('0x32')][_0x849f('0x43')]?_0xe8d97[_0x849f('0x32')]:_0x13b92d[_0x849f('0x31')];if(!_0x3f51ee['query'][_0x849f('0x54')](_0x849f('0x34'))){_0xe8d97[_0x849f('0x1c')]=qs['limit'](_0x3f51ee[_0x849f('0x2e')]['limit']);_0xe8d97[_0x849f('0x1a')]=qs[_0x849f('0x1a')](_0x3f51ee[_0x849f('0x2e')]['offset']);}_0xe8d97[_0x849f('0x35')]=qs[_0x849f('0x36')](_0x3f51ee['query'][_0x849f('0x36')]);_0xe8d97[_0x849f('0x37')]=qs['filters'](_[_0x849f('0x39')](_0x3f51ee[_0x849f('0x2e')],_0x13b92d[_0x849f('0x38')]));_0xe8d97[_0x849f('0x37')][_0x849f('0x55')]=_0x26fedc['id'];if(_0x3f51ee[_0x849f('0x2e')][_0x849f('0x56')]){_0xe8d97[_0x849f('0x37')]=_[_0x849f('0x3c')](_0xe8d97[_0x849f('0x37')],{'$or':_['map'](_0xe8d97[_0x849f('0x32')],function(_0x434659){var _0x34f768={};_0x34f768[_0x434659]={'$like':'%'+_0x3f51ee[_0x849f('0x2e')][_0x849f('0x56')]+'%'};return _0x34f768;})});}_0xe8d97=_[_0x849f('0x3c')]({},_0xe8d97,_0x3f51ee[_0x849f('0x3d')]);return db[_0x849f('0x5f')]['count']({'where':_0xe8d97[_0x849f('0x37')]})[_0x849f('0x22')](function(_0x5925d0){_0x2b31ed[_0x849f('0x1d')]=_0x5925d0;if(_0x3f51ee[_0x849f('0x2e')]['includeAll']){_0xe8d97[_0x849f('0x3f')]=[{'all':!![]}];}return db[_0x849f('0x5f')][_0x849f('0x58')](_0xe8d97);})[_0x849f('0x22')](function(_0x4001aa){_0x2b31ed['rows']=_0x4001aa;return _0x2b31ed;});}})['then'](respondWithFilteredResult(_0x1e3461,_0xe8d97))[_0x849f('0x40')](handleError(_0x1e3461,null));};exports[_0x849f('0x60')]=function(_0x1aa094,_0x282b81,_0x34dcb1){var _0x20cb2a={};var _0x4a628f={};var _0x598a69;var _0x38973f;return db['Campaign'][_0x849f('0x53')]({'where':{'id':_0x1aa094[_0x849f('0x41')]['id']}})[_0x849f('0x22')](handleEntityNotFound(_0x282b81,null))[_0x849f('0x22')](function(_0x26de80){if(_0x26de80){_0x598a69=_0x26de80;_0x4a628f[_0x849f('0x31')]=_[_0x849f('0x2f')](db[_0x849f('0x61')][_0x849f('0x42')]);_0x4a628f[_0x849f('0x2e')]=_[_0x849f('0x2f')](_0x1aa094[_0x849f('0x2e')]);_0x4a628f[_0x849f('0x38')]=_['intersection'](_0x4a628f['model'],_0x4a628f[_0x849f('0x2e')]);_0x20cb2a[_0x849f('0x32')]=_[_0x849f('0x30')](_0x4a628f[_0x849f('0x31')],qs['fields'](_0x1aa094[_0x849f('0x2e')][_0x849f('0x33')]));_0x20cb2a[_0x849f('0x32')]=_0x20cb2a[_0x849f('0x32')][_0x849f('0x43')]?_0x20cb2a[_0x849f('0x32')]:_0x4a628f[_0x849f('0x31')];_0x20cb2a[_0x849f('0x35')]=qs[_0x849f('0x36')](_0x1aa094[_0x849f('0x2e')][_0x849f('0x36')]);_0x20cb2a[_0x849f('0x37')]=qs[_0x849f('0x38')](_[_0x849f('0x39')](_0x1aa094[_0x849f('0x2e')],_0x4a628f[_0x849f('0x38')]));if(_0x1aa094[_0x849f('0x2e')][_0x849f('0x56')]){_0x20cb2a[_0x849f('0x37')]=_[_0x849f('0x3c')](_0x20cb2a['where'],{'$or':_[_0x849f('0x2d')](_0x20cb2a[_0x849f('0x32')],function(_0x24215f){var _0x78bd4={};_0x78bd4[_0x24215f]={'$like':'%'+_0x1aa094['query'][_0x849f('0x56')]+'%'};return _0x78bd4;})});}_0x20cb2a=_[_0x849f('0x3c')]({},_0x20cb2a,_0x1aa094[_0x849f('0x3d')]);return _0x598a69['getLists'](_0x20cb2a);}})['then'](function(_0x28d438){if(_0x28d438){_0x38973f=_0x28d438[_0x849f('0x43')];if(!_0x1aa094[_0x849f('0x2e')][_0x849f('0x54')](_0x849f('0x34'))){_0x20cb2a[_0x849f('0x1c')]=qs[_0x849f('0x1c')](_0x1aa094[_0x849f('0x2e')]['limit']);_0x20cb2a[_0x849f('0x1a')]=qs[_0x849f('0x1a')](_0x1aa094[_0x849f('0x2e')][_0x849f('0x1a')]);}return _0x598a69[_0x849f('0x60')](_0x20cb2a);}})[_0x849f('0x22')](function(_0x337688){if(_0x337688){return _0x337688?{'count':_0x38973f,'rows':_0x337688}:null;}})[_0x849f('0x22')](respondWithResult(_0x282b81,null))[_0x849f('0x40')](handleError(_0x282b81,null));};exports[_0x849f('0x62')]=function(_0x3c084f,_0x113a33,_0x2f59eb){var _0x53d35f,_0x18a2a0;var _0x5f4e27=[];var _0x42f1ef=moment()[_0x849f('0x63')](_0x849f('0x64'));return db[_0x849f('0x2b')][_0x849f('0x44')]({'where':{'id':_0x3c084f['params']['id']}})[_0x849f('0x22')](handleEntityNotFound(_0x113a33,null))[_0x849f('0x22')](function(_0x2508a2){if(_0x2508a2){_0x18a2a0=_0x2508a2;return _0x2508a2[_0x849f('0x62')](_0x3c084f[_0x849f('0x46')]['ids'],_['omit'](_0x3c084f[_0x849f('0x46')],[_0x849f('0x65'),'id'])||{});}return null;})[_0x849f('0x66')](function(_0x4e28c6){var _0x1dbb05;var _0x53dc6e;_0x53d35f=_0x4e28c6||[];var _0x5d9784=[];if(_0x4e28c6){for(var _0x58a26d=0x0;_0x58a26d<_0x4e28c6[_0x849f('0x43')];_0x58a26d+=0x1){var _0x2489f0=_0x4e28c6[_0x58a26d][_0x849f('0x24')]({'plain':!![]});_0x18a2a0['dialCheckDuplicateType']=_0x3c084f[_0x849f('0x46')][_0x849f('0x67')]?_0x3c084f[_0x849f('0x46')][_0x849f('0x67')]:_0x18a2a0['dialCheckDuplicateType'];switch(_0x18a2a0[_0x849f('0x67')]){case'always':_0x1dbb05=squel[_0x849f('0x68')]()[_0x849f('0x69')](_0x849f('0x6a'))['fromQuery']([_0x849f('0x6b'),_0x849f('0x6c'),_0x849f('0x6d'),_0x849f('0x6e'),_0x849f('0x55'),'createdAt',_0x849f('0x50')],squel[_0x849f('0x6f')]()[_0x849f('0x70')](_0x849f('0x6b'),_0x849f('0x6b'))[_0x849f('0x70')]('NOW()',_0x849f('0x6c'))[_0x849f('0x70')]('id',_0x849f('0x6d'))[_0x849f('0x70')](_0x2489f0[_0x849f('0x71')]['toString'](),'ListId')['field'](_0x3c084f[_0x849f('0x41')]['id'][_0x849f('0x72')](),_0x849f('0x55'))['field']('\x27'+_0x42f1ef+'\x27',_0x849f('0x51'))[_0x849f('0x70')]('\x27'+_0x42f1ef+'\x27',_0x849f('0x50'))[_0x849f('0x73')](_0x849f('0x74'))[_0x849f('0x37')](_0x849f('0x75'))[_0x849f('0x37')]('ListId\x20=\x20?',_0x2489f0['CmListId']['toString']())[_0x849f('0x37')](_0x849f('0x76'))[_0x849f('0x37')](_0x849f('0x77'),squel[_0x849f('0x6f')]()[_0x849f('0x70')]('COALESCE(calleridnum,\x27\x27)')[_0x849f('0x73')]('cm_hopper_final')[_0x849f('0x37')](_0x849f('0x78'),_0x3c084f[_0x849f('0x41')]['id'][_0x849f('0x72')]()))[_0x849f('0x37')](_0x849f('0x77'),squel[_0x849f('0x6f')]()[_0x849f('0x70')](_0x849f('0x79'))[_0x849f('0x73')](_0x849f('0x6a'))['where'](_0x849f('0x78'),_0x3c084f[_0x849f('0x41')]['id']['toString']())))[_0x849f('0x72')]();break;case _0x849f('0x7a'):_0x1dbb05=squel[_0x849f('0x68')]()[_0x849f('0x69')](_0x849f('0x6a'))[_0x849f('0x7b')]([_0x849f('0x6b'),_0x849f('0x6c'),'ContactId',_0x849f('0x6e'),_0x849f('0x55'),'createdAt',_0x849f('0x50')],squel[_0x849f('0x6f')]()[_0x849f('0x70')]('phone','phone')[_0x849f('0x70')](_0x849f('0x7c'),_0x849f('0x6c'))['field']('id','ContactId')['field'](_0x2489f0[_0x849f('0x71')][_0x849f('0x72')](),_0x849f('0x6e'))[_0x849f('0x70')](_0x3c084f[_0x849f('0x41')]['id'][_0x849f('0x72')](),'CampaignId')[_0x849f('0x70')]('\x27'+_0x42f1ef+'\x27','createdAt')[_0x849f('0x70')]('\x27'+_0x42f1ef+'\x27','updatedAt')['from'](_0x849f('0x74'))[_0x849f('0x37')](_0x849f('0x75'))[_0x849f('0x37')](_0x849f('0x7d'),_0x2489f0[_0x849f('0x71')][_0x849f('0x72')]())[_0x849f('0x37')](_0x849f('0x76'))['where'](_0x849f('0x77'),squel['select']()[_0x849f('0x70')](_0x849f('0x79'))[_0x849f('0x73')]('cm_hopper')[_0x849f('0x37')](_0x849f('0x78'),_0x3c084f['params']['id'][_0x849f('0x72')]())))['toString']();break;default:_0x1dbb05=squel[_0x849f('0x68')]()[_0x849f('0x69')]('cm_hopper')[_0x849f('0x7b')]([_0x849f('0x6b'),_0x849f('0x6c'),_0x849f('0x6d'),'ListId',_0x849f('0x55'),_0x849f('0x51'),'updatedAt'],squel[_0x849f('0x6f')]()[_0x849f('0x70')]('phone','phone')[_0x849f('0x70')]('NOW()',_0x849f('0x6c'))['field']('id',_0x849f('0x6d'))['field'](_0x2489f0['CmListId'][_0x849f('0x72')](),_0x849f('0x6e'))[_0x849f('0x70')](_0x3c084f['params']['id']['toString'](),'CampaignId')[_0x849f('0x70')]('\x27'+_0x42f1ef+'\x27',_0x849f('0x51'))[_0x849f('0x70')]('\x27'+_0x42f1ef+'\x27',_0x849f('0x50'))[_0x849f('0x73')](_0x849f('0x74'))[_0x849f('0x37')](_0x849f('0x75'))[_0x849f('0x37')](_0x849f('0x7d'),_0x2489f0[_0x849f('0x71')]['toString']())[_0x849f('0x37')](_0x849f('0x76')))['toString']();}_0x53dc6e=squel[_0x849f('0x68')]()['into'](_0x849f('0x7e'))[_0x849f('0x7b')](['cmHopperId',_0x849f('0x6c'),_0x849f('0x6b'),_0x849f('0x7f'),_0x849f('0x51'),_0x849f('0x50')],squel[_0x849f('0x6f')]()[_0x849f('0x70')](_0x849f('0x80'),'id')[_0x849f('0x70')](_0x849f('0x7c'),'scheduledAt')[_0x849f('0x70')](_0x849f('0x81'),_0x849f('0x6b'))[_0x849f('0x70')](_0x849f('0x82'),_0x849f('0x7f'))[_0x849f('0x70')]('\x27'+_0x42f1ef+'\x27','createdAt')[_0x849f('0x70')]('\x27'+_0x42f1ef+'\x27',_0x849f('0x50'))[_0x849f('0x73')]('cm_contact_has_items','ci')['join'](_0x849f('0x6a'),'h',_0x849f('0x83'))['where'](_0x849f('0x84'),_0x2489f0['CmListId'][_0x849f('0x72')]())[_0x849f('0x37')](_0x849f('0x85'),_0x3c084f['params']['id'][_0x849f('0x72')]())[_0x849f('0x37')]('h.createdAt\x20=\x20?',_0x42f1ef))['toString']();_0x5d9784[_0x849f('0x86')](db[_0x849f('0x87')][_0x849f('0x2e')](_0x1dbb05));_0x5f4e27[_0x849f('0x86')](db[_0x849f('0x87')][_0x849f('0x2e')](_0x53dc6e));}return BPromise[_0x849f('0x88')](_0x5d9784);}})[_0x849f('0x22')](function(){return BPromise[_0x849f('0x88')](_0x5f4e27);})['then'](function(){return _0x53d35f;})[_0x849f('0x22')](respondWithResult(_0x113a33,null))[_0x849f('0x40')](handleError(_0x113a33,null));};exports[_0x849f('0x89')]=function(_0x3081f3,_0x242eef,_0x20c8ce){return db[_0x849f('0x2b')][_0x849f('0x44')]({'where':{'id':_0x3081f3[_0x849f('0x41')]['id']}})[_0x849f('0x22')](handleEntityNotFound(_0x242eef,null))[_0x849f('0x22')](function(_0x1c8480){if(_0x1c8480){return _0x1c8480[_0x849f('0x89')](_0x3081f3['query'][_0x849f('0x65')]);}})[_0x849f('0x22')](function(_0x4f0a06){if(_0x4f0a06){return db[_0x849f('0x57')][_0x849f('0x23')]({'where':{'ListId':_0x3081f3[_0x849f('0x2e')]['ids'],'CampaignId':_0x3081f3[_0x849f('0x41')]['id']}})['then'](function(){return _0x4f0a06;});}})[_0x849f('0x22')](respondWithStatusCode(_0x242eef,null))['catch'](handleError(_0x242eef,null));};exports[_0x849f('0x8a')]=function(_0x2fcf8b,_0x2b5821,_0xbfb0d4){var _0x4471bf={};var _0x2e28dd={};var _0x466679;var _0x506c61;return db[_0x849f('0x2b')]['findOne']({'where':{'id':_0x2fcf8b[_0x849f('0x41')]['id']}})[_0x849f('0x22')](handleEntityNotFound(_0x2b5821,null))[_0x849f('0x22')](function(_0x4f4408){if(_0x4f4408){_0x466679=_0x4f4408;_0x2e28dd[_0x849f('0x31')]=_['keys'](db['CmList']['rawAttributes']);_0x2e28dd[_0x849f('0x2e')]=_[_0x849f('0x2f')](_0x2fcf8b['query']);_0x2e28dd[_0x849f('0x38')]=_[_0x849f('0x30')](_0x2e28dd['model'],_0x2e28dd[_0x849f('0x2e')]);_0x4471bf[_0x849f('0x32')]=_[_0x849f('0x30')](_0x2e28dd[_0x849f('0x31')],qs[_0x849f('0x33')](_0x2fcf8b['query']['fields']));_0x4471bf['attributes']=_0x4471bf[_0x849f('0x32')][_0x849f('0x43')]?_0x4471bf[_0x849f('0x32')]:_0x2e28dd[_0x849f('0x31')];_0x4471bf['order']=qs[_0x849f('0x36')](_0x2fcf8b[_0x849f('0x2e')][_0x849f('0x36')]);_0x4471bf[_0x849f('0x37')]=qs[_0x849f('0x38')](_[_0x849f('0x39')](_0x2fcf8b['query'],_0x2e28dd[_0x849f('0x38')]));if(_0x2fcf8b[_0x849f('0x2e')]['filter']){_0x4471bf[_0x849f('0x37')]=_[_0x849f('0x3c')](_0x4471bf[_0x849f('0x37')],{'$or':_['map'](_0x4471bf['attributes'],function(_0x1acbb4){var _0x28cd4a={};_0x28cd4a[_0x1acbb4]={'$like':'%'+_0x2fcf8b['query']['filter']+'%'};return _0x28cd4a;})});}_0x4471bf=_[_0x849f('0x3c')]({},_0x4471bf,_0x2fcf8b[_0x849f('0x3d')]);return _0x466679[_0x849f('0x8a')](_0x4471bf);}})[_0x849f('0x22')](function(_0x254a9b){if(_0x254a9b){_0x506c61=_0x254a9b['length'];if(!_0x2fcf8b['query']['hasOwnProperty']('nolimit')){_0x4471bf[_0x849f('0x1c')]=qs[_0x849f('0x1c')](_0x2fcf8b[_0x849f('0x2e')]['limit']);_0x4471bf[_0x849f('0x1a')]=qs['offset'](_0x2fcf8b[_0x849f('0x2e')][_0x849f('0x1a')]);}return _0x466679[_0x849f('0x8a')](_0x4471bf);}})['then'](function(_0x321683){if(_0x321683){return _0x321683?{'count':_0x506c61,'rows':_0x321683}:null;}})[_0x849f('0x22')](respondWithResult(_0x2b5821,null))[_0x849f('0x40')](handleError(_0x2b5821,null));};exports[_0x849f('0x8b')]=function(_0x54be0d,_0xb93b30,_0x1209d2){var _0x11a23f,_0x119a72;var _0x31a157=[];var _0x2afa28=moment()[_0x849f('0x63')](_0x849f('0x64'));return db[_0x849f('0x2b')]['find']({'where':{'id':_0x54be0d['params']['id']}})['then'](handleEntityNotFound(_0xb93b30,null))[_0x849f('0x22')](function(_0x562aab){if(_0x562aab){_0x119a72=_0x562aab;return _0x562aab[_0x849f('0x8b')](_0x54be0d[_0x849f('0x46')][_0x849f('0x65')],_['omit'](_0x54be0d[_0x849f('0x46')],[_0x849f('0x65'),'id'])||{});}return null;})['spread'](function(_0x271ff7){var _0x216297;var _0x269ab4;_0x11a23f=_0x271ff7||[];var _0x1a7b1f=[];if(_0x271ff7){for(var _0x238f17=0x0;_0x238f17<_0x271ff7[_0x849f('0x43')];_0x238f17+=0x1){var _0x15074e=_0x271ff7[_0x238f17][_0x849f('0x24')]({'plain':!![]});_0x216297=squel['insert']()[_0x849f('0x69')](_0x849f('0x8c'))['fromQuery'](['phone',_0x849f('0x6d'),_0x849f('0x6e'),_0x849f('0x55'),_0x849f('0x51'),_0x849f('0x50')],squel['select']()[_0x849f('0x70')]('phone',_0x849f('0x6b'))[_0x849f('0x70')]('id',_0x849f('0x6d'))[_0x849f('0x70')](_0x15074e[_0x849f('0x71')]['toString'](),_0x849f('0x6e'))[_0x849f('0x70')](_0x54be0d['params']['id'][_0x849f('0x72')](),'CampaignId')[_0x849f('0x70')](_0x849f('0x7c'),_0x849f('0x51'))[_0x849f('0x70')](_0x849f('0x7c'),_0x849f('0x50'))['from'](_0x849f('0x74'))['where'](_0x849f('0x75'))['where'](_0x849f('0x7d'),_0x15074e[_0x849f('0x71')]['toString']())[_0x849f('0x37')](_0x849f('0x76')))[_0x849f('0x72')]();_0x1a7b1f['push'](db[_0x849f('0x87')][_0x849f('0x2e')](_0x216297));}return BPromise['all'](_0x1a7b1f);}})[_0x849f('0x22')](function(){return _0x11a23f;})[_0x849f('0x22')](respondWithResult(_0xb93b30,null))['catch'](handleError(_0xb93b30,null));};exports['removeBlackLists']=function(_0x3e6e01,_0x2ec620,_0x15ff5a){return db[_0x849f('0x2b')][_0x849f('0x44')]({'where':{'id':_0x3e6e01['params']['id']}})[_0x849f('0x22')](handleEntityNotFound(_0x2ec620,null))[_0x849f('0x22')](function(_0x170060){if(_0x170060){return _0x170060[_0x849f('0x8d')](_0x3e6e01[_0x849f('0x2e')][_0x849f('0x65')]);}})[_0x849f('0x22')](function(_0x52d594){if(_0x52d594){return db[_0x849f('0x5f')]['destroy']({'where':{'ListId':_0x3e6e01[_0x849f('0x2e')][_0x849f('0x65')],'CampaignId':_0x3e6e01[_0x849f('0x41')]['id']}})[_0x849f('0x22')](function(){return _0x52d594;});}})['then'](respondWithStatusCode(_0x2ec620,null))['catch'](handleError(_0x2ec620,null));}; \ No newline at end of file +var _0x57f8=['destroy','then','get','IvrCampaigns','UserProfileResource','error','name','send','index','map','Campaign','fieldName','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','fields','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','CmHopper','hasOwnProperty','CampaignId','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','from','onlyIfOpen','insert','cm_contacts','cm_hopper_additional_phones','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','format','spread','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update'];(function(_0x2e8328,_0x540028){var _0x3130e7=function(_0xe755d1){while(--_0xe755d1){_0x2e8328['push'](_0x2e8328['shift']());}};_0x3130e7(++_0x540028);}(_0x57f8,0x198));var _0x857f=function(_0x389a03,_0x380e6c){_0x389a03=_0x389a03-0x0;var _0xaf19ea=_0x57f8[_0x389a03];return _0xaf19ea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x857f('0x0'));var zipdir=require(_0x857f('0x1'));var jsonpatch=require(_0x857f('0x2'));var rp=require(_0x857f('0x3'));var moment=require(_0x857f('0x4'));var BPromise=require(_0x857f('0x5'));var Mustache=require(_0x857f('0x6'));var util=require(_0x857f('0x7'));var path=require(_0x857f('0x8'));var sox=require(_0x857f('0x9'));var csv=require(_0x857f('0xa'));var ejs=require(_0x857f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x857f('0xc'));var squel=require(_0x857f('0xd'));var crypto=require(_0x857f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x857f('0xf'));var toCsv=require(_0x857f('0xa'));var querystring=require(_0x857f('0x10'));var Papa=require('papaparse');var Redis=require(_0x857f('0x11'));var authService=require(_0x857f('0x12'));var qs=require(_0x857f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x857f('0x14'));var logger=require(_0x857f('0x15'))(_0x857f('0x16'));var utils=require(_0x857f('0x17'));var config=require(_0x857f('0x18'));var licenseUtil=require(_0x857f('0x19'));var db=require(_0x857f('0x1a'))['db'];function respondWithStatusCode(_0x533631,_0x2e1eda){_0x2e1eda=_0x2e1eda||0xcc;return function(_0x2d5e26){if(_0x2d5e26){return _0x533631[_0x857f('0x1b')](_0x2e1eda);}return _0x533631[_0x857f('0x1c')](_0x2e1eda)[_0x857f('0x1d')]();};}function respondWithResult(_0x4a25ec,_0x4bc590){_0x4bc590=_0x4bc590||0xc8;return function(_0x3b09d9){if(_0x3b09d9){return _0x4a25ec['status'](_0x4bc590)[_0x857f('0x1e')](_0x3b09d9);}};}function respondWithFilteredResult(_0x4ac81f,_0x1d47bf){return function(_0x134a4f){if(_0x134a4f){var _0x5c3a69=typeof _0x1d47bf[_0x857f('0x1f')]===_0x857f('0x20')&&typeof _0x1d47bf[_0x857f('0x21')]===_0x857f('0x20');var _0x279e74=_0x134a4f[_0x857f('0x22')];var _0x1a9ef8=_0x5c3a69?0x0:_0x1d47bf[_0x857f('0x1f')];var _0x1014ca=_0x5c3a69?_0x134a4f[_0x857f('0x22')]:_0x1d47bf[_0x857f('0x1f')]+_0x1d47bf['limit'];var _0x1729d8;if(_0x1014ca>=_0x279e74){_0x1014ca=_0x279e74;_0x1729d8=0xc8;}else{_0x1729d8=0xce;}_0x4ac81f[_0x857f('0x1c')](_0x1729d8);return _0x4ac81f['set'](_0x857f('0x23'),_0x1a9ef8+'-'+_0x1014ca+'/'+_0x279e74)[_0x857f('0x1e')](_0x134a4f);}return null;};}function patchUpdates(_0x377587){return function(_0x484035){try{jsonpatch['apply'](_0x484035,_0x377587,!![]);}catch(_0x12ee77){return BPromise[_0x857f('0x24')](_0x12ee77);}return _0x484035[_0x857f('0x25')]();};}function saveUpdates(_0x4fa031,_0x118237){return function(_0x17a98e){if(_0x17a98e){return _0x17a98e[_0x857f('0x26')](_0x4fa031)['then'](function(_0x1961ea){return _0x1961ea;});}return null;};}function removeEntity(_0x14a8ce,_0x50bfb7){return function(_0x3bc543){if(_0x3bc543){return _0x3bc543[_0x857f('0x27')]()[_0x857f('0x28')](function(){var _0x44ff23=_0x3bc543[_0x857f('0x29')]({'plain':!![]});var _0x3b23a7=_0x857f('0x2a');return db[_0x857f('0x2b')][_0x857f('0x27')]({'where':{'type':_0x3b23a7,'resourceId':_0x44ff23['id']}})[_0x857f('0x28')](function(){return _0x3bc543;});})[_0x857f('0x28')](function(){_0x14a8ce[_0x857f('0x1c')](0xcc)[_0x857f('0x1d')]();});}};}function handleEntityNotFound(_0x46761e,_0x570905){return function(_0x17e415){if(!_0x17e415){_0x46761e[_0x857f('0x1b')](0x194);}return _0x17e415;};}function handleError(_0x23afb8,_0x2c5792){_0x2c5792=_0x2c5792||0x1f4;return function(_0x58c2de){logger[_0x857f('0x2c')](_0x58c2de['stack']);if(_0x58c2de[_0x857f('0x2d')]){delete _0x58c2de[_0x857f('0x2d')];}_0x23afb8[_0x857f('0x1c')](_0x2c5792)[_0x857f('0x2e')](_0x58c2de);};}exports[_0x857f('0x2f')]=function(_0x464e8f,_0x1c4fff){var _0xe79241={},_0x17e7b6={},_0x41f832={'count':0x0,'rows':[]};var _0x24adc2=_[_0x857f('0x30')](db[_0x857f('0x31')]['rawAttributes'],function(_0x3078cf){return{'name':_0x3078cf[_0x857f('0x32')],'type':_0x3078cf['type'][_0x857f('0x33')]};});_0x17e7b6[_0x857f('0x34')]=_['map'](_0x24adc2,_0x857f('0x2d'));_0x17e7b6[_0x857f('0x35')]=_['keys'](_0x464e8f[_0x857f('0x35')]);_0x17e7b6[_0x857f('0x36')]=_[_0x857f('0x37')](_0x17e7b6[_0x857f('0x34')],_0x17e7b6['query']);_0xe79241['attributes']=_[_0x857f('0x37')](_0x17e7b6[_0x857f('0x34')],qs['fields'](_0x464e8f[_0x857f('0x35')]['fields']));_0xe79241[_0x857f('0x38')]=_0xe79241[_0x857f('0x38')][_0x857f('0x39')]?_0xe79241[_0x857f('0x38')]:_0x17e7b6[_0x857f('0x34')];if(!_0x464e8f['query']['hasOwnProperty'](_0x857f('0x3a'))){_0xe79241['limit']=qs[_0x857f('0x21')](_0x464e8f[_0x857f('0x35')][_0x857f('0x21')]);_0xe79241['offset']=qs[_0x857f('0x1f')](_0x464e8f[_0x857f('0x35')][_0x857f('0x1f')]);}_0xe79241[_0x857f('0x3b')]=qs[_0x857f('0x3c')](_0x464e8f[_0x857f('0x35')][_0x857f('0x3c')]);_0xe79241['where']=qs[_0x857f('0x36')](_[_0x857f('0x3d')](_0x464e8f[_0x857f('0x35')],_0x17e7b6[_0x857f('0x36')]),_0x24adc2);if(_0x464e8f[_0x857f('0x35')][_0x857f('0x3e')]){_0xe79241[_0x857f('0x3f')]=_['merge'](_0xe79241[_0x857f('0x3f')],{'$or':_[_0x857f('0x30')](_0x24adc2,function(_0xcd5959){if(_0xcd5959[_0x857f('0x40')]!==_0x857f('0x41')){var _0x1c119f={};_0x1c119f[_0xcd5959['name']]={'$like':'%'+_0x464e8f[_0x857f('0x35')][_0x857f('0x3e')]+'%'};return _0x1c119f;}})});}_0xe79241=_[_0x857f('0x42')]({},_0xe79241,_0x464e8f[_0x857f('0x43')]);var _0x3938ee={'where':_0xe79241[_0x857f('0x3f')]};return db[_0x857f('0x31')][_0x857f('0x22')](_0x3938ee)['then'](function(_0x40fb37){_0x41f832[_0x857f('0x22')]=_0x40fb37;if(_0x464e8f[_0x857f('0x35')][_0x857f('0x44')]){_0xe79241[_0x857f('0x45')]=[{'all':!![]}];}return db[_0x857f('0x31')][_0x857f('0x46')](_0xe79241);})[_0x857f('0x28')](function(_0xb4d7c2){_0x41f832[_0x857f('0x47')]=_0xb4d7c2;return _0x41f832;})[_0x857f('0x28')](respondWithFilteredResult(_0x1c4fff,_0xe79241))[_0x857f('0x48')](handleError(_0x1c4fff,null));};exports[_0x857f('0x49')]=function(_0x376f71,_0x5d4c2a){var _0xe0e078={'raw':![],'where':{'id':_0x376f71[_0x857f('0x4a')]['id']}},_0x5b2baa={};_0x5b2baa[_0x857f('0x34')]=_[_0x857f('0x4b')](db[_0x857f('0x31')][_0x857f('0x4c')]);_0x5b2baa[_0x857f('0x35')]=_[_0x857f('0x4b')](_0x376f71[_0x857f('0x35')]);_0x5b2baa[_0x857f('0x36')]=_[_0x857f('0x37')](_0x5b2baa[_0x857f('0x34')],_0x5b2baa['query']);_0xe0e078['attributes']=_[_0x857f('0x37')](_0x5b2baa['model'],qs[_0x857f('0x4d')](_0x376f71['query'][_0x857f('0x4d')]));_0xe0e078[_0x857f('0x38')]=_0xe0e078[_0x857f('0x38')][_0x857f('0x39')]?_0xe0e078[_0x857f('0x38')]:_0x5b2baa[_0x857f('0x34')];if(_0x376f71[_0x857f('0x35')][_0x857f('0x44')]){_0xe0e078['include']=[{'all':!![]}];}_0xe0e078=_[_0x857f('0x42')]({},_0xe0e078,_0x376f71[_0x857f('0x43')]);return db[_0x857f('0x31')][_0x857f('0x4e')](_0xe0e078)['then'](handleEntityNotFound(_0x5d4c2a,null))[_0x857f('0x28')](respondWithResult(_0x5d4c2a,null))[_0x857f('0x48')](handleError(_0x5d4c2a,null));};exports[_0x857f('0x4f')]=function(_0x736ef6,_0x67563){return db['Campaign'][_0x857f('0x4f')](_0x736ef6[_0x857f('0x50')],{})['then'](function(_0xfd1679){var _0x847879=_0x736ef6['user'][_0x857f('0x29')]({'plain':!![]});if(!_0x847879)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x847879[_0x857f('0x51')]===_0x857f('0x52')){var _0x446fe9=_0xfd1679[_0x857f('0x29')]({'plain':!![]});var _0x58bf27=_0x857f('0x2a');return db[_0x857f('0x53')][_0x857f('0x4e')]({'where':{'name':_0x58bf27,'userProfileId':_0x847879[_0x857f('0x54')]},'raw':!![]})[_0x857f('0x28')](function(_0x4f9d24){if(_0x4f9d24&&_0x4f9d24[_0x857f('0x55')]===0x0){return db[_0x857f('0x2b')][_0x857f('0x4f')]({'name':_0x446fe9[_0x857f('0x2d')],'resourceId':_0x446fe9['id'],'type':_0x4f9d24[_0x857f('0x2d')],'sectionId':_0x4f9d24['id']},{})[_0x857f('0x28')](function(){return _0xfd1679;});}else{return _0xfd1679;}})[_0x857f('0x48')](function(_0x59164a){logger[_0x857f('0x2c')](_0x857f('0x56'),_0x59164a);throw _0x59164a;});}return _0xfd1679;})[_0x857f('0x28')](respondWithResult(_0x67563,0xc9))[_0x857f('0x48')](handleError(_0x67563,null));};exports[_0x857f('0x57')]=function(_0x153e4e,_0x4bb5fc){var _0x2cf62c={'where':{'id':_0x153e4e[_0x857f('0x4a')]['id']}},_0xe7e09b={};_0xe7e09b[_0x857f('0x34')]=_[_0x857f('0x4b')](db[_0x857f('0x31')][_0x857f('0x4c')]);_0x2cf62c[_0x857f('0x38')]=_['intersection'](_0xe7e09b['model'],qs[_0x857f('0x4d')](_0x153e4e[_0x857f('0x35')][_0x857f('0x4d')]));_0x2cf62c[_0x857f('0x38')]=_0x2cf62c[_0x857f('0x38')][_0x857f('0x39')]?_0x2cf62c['attributes']:_0xe7e09b[_0x857f('0x34')];if(_0x153e4e[_0x857f('0x35')]['includeAll']){_0x2cf62c[_0x857f('0x45')]=[{'all':!![]}];}_0x2cf62c=_['merge']({},_0x2cf62c,_0x153e4e[_0x857f('0x43')]);return db[_0x857f('0x31')]['find'](_0x2cf62c)[_0x857f('0x28')](handleEntityNotFound(_0x4bb5fc,null))[_0x857f('0x28')](function(_0x3520d3){if(_0x3520d3){var _0x464208=_0x3520d3[_0x857f('0x29')]({'plain':!![]});_0x464208=qs[_0x857f('0x58')](_0x464208,['id',_0x857f('0x59'),_0x857f('0x5a')]);_0x153e4e['body']=_[_0x857f('0x58')](_0x153e4e[_0x857f('0x50')],['id',_0x857f('0x59'),_0x857f('0x5a')]);return db[_0x857f('0x31')][_0x857f('0x4f')](_[_0x857f('0x42')](_0x464208,_0x153e4e[_0x857f('0x50')]),{'include':_0x153e4e[_0x857f('0x35')][_0x857f('0x44')]?[{'all':!![]}]:undefined})[_0x857f('0x28')](function(_0x5631fb){var _0x390f86=_0x153e4e[_0x857f('0x52')][_0x857f('0x29')]({'plain':!![]});if(!_0x390f86)throw new Error(_0x857f('0x5b'));if(_0x390f86['role']===_0x857f('0x52')){var _0x4b6e13=_0x5631fb[_0x857f('0x29')]({'plain':!![]});var _0x36d746=_0x857f('0x2a');return db[_0x857f('0x53')]['find']({'where':{'name':_0x36d746,'userProfileId':_0x390f86['userProfileId']},'raw':!![]})[_0x857f('0x28')](function(_0x3ee981){if(_0x3ee981&&_0x3ee981[_0x857f('0x55')]===0x0){return db['UserProfileResource'][_0x857f('0x4f')]({'name':_0x4b6e13['name'],'resourceId':_0x4b6e13['id'],'type':_0x3ee981[_0x857f('0x2d')],'sectionId':_0x3ee981['id']},{})[_0x857f('0x28')](function(){return _0x5631fb;});}else{return _0x5631fb;}})[_0x857f('0x48')](function(_0x47fa5a){logger['error'](_0x857f('0x56'),_0x47fa5a);throw _0x47fa5a;});}return _0x5631fb;});}})[_0x857f('0x28')](respondWithResult(_0x4bb5fc,0xc9))[_0x857f('0x48')](handleError(_0x4bb5fc,null));};exports[_0x857f('0x26')]=function(_0x41f9d8,_0x3eecda){if(_0x41f9d8[_0x857f('0x50')]['id']){delete _0x41f9d8[_0x857f('0x50')]['id'];}return db['Campaign']['find']({'where':{'id':_0x41f9d8[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x3eecda,null))[_0x857f('0x28')](saveUpdates(_0x41f9d8[_0x857f('0x50')],null))[_0x857f('0x28')](respondWithResult(_0x3eecda,null))[_0x857f('0x48')](handleError(_0x3eecda,null));};exports['destroy']=function(_0x16cfe0,_0x3ac1de){return db[_0x857f('0x31')][_0x857f('0x4e')]({'where':{'id':_0x16cfe0[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x3ac1de,null))[_0x857f('0x28')](removeEntity(_0x3ac1de,null))[_0x857f('0x48')](handleError(_0x3ac1de,null));};exports[_0x857f('0x5c')]=function(_0x338670,_0x4b1110,_0x1cb405){var _0x4a17ea={'raw':!![],'where':{}};var _0x5ec513={};var _0x35cd3e={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x338670[_0x857f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4b1110,null))[_0x857f('0x28')](function(_0x4da63c){if(_0x4da63c){_0x5ec513[_0x857f('0x34')]=_[_0x857f('0x4b')](db[_0x857f('0x5d')][_0x857f('0x4c')]);_0x5ec513['query']=_[_0x857f('0x4b')](_0x338670[_0x857f('0x35')]);_0x5ec513[_0x857f('0x36')]=_[_0x857f('0x37')](_0x5ec513[_0x857f('0x34')],_0x5ec513[_0x857f('0x35')]);_0x4a17ea[_0x857f('0x38')]=_['intersection'](_0x5ec513['model'],qs[_0x857f('0x4d')](_0x338670[_0x857f('0x35')][_0x857f('0x4d')]));_0x4a17ea[_0x857f('0x38')]=_0x4a17ea[_0x857f('0x38')][_0x857f('0x39')]?_0x4a17ea['attributes']:_0x5ec513[_0x857f('0x34')];if(!_0x338670[_0x857f('0x35')][_0x857f('0x5e')]('nolimit')){_0x4a17ea['limit']=qs[_0x857f('0x21')](_0x338670['query']['limit']);_0x4a17ea[_0x857f('0x1f')]=qs[_0x857f('0x1f')](_0x338670['query'][_0x857f('0x1f')]);}_0x4a17ea[_0x857f('0x3b')]=qs['sort'](_0x338670[_0x857f('0x35')][_0x857f('0x3c')]);_0x4a17ea[_0x857f('0x3f')]=qs[_0x857f('0x36')](_[_0x857f('0x3d')](_0x338670[_0x857f('0x35')],_0x5ec513[_0x857f('0x36')]));_0x4a17ea[_0x857f('0x3f')][_0x857f('0x5f')]=_0x4da63c['id'];if(_0x338670[_0x857f('0x35')][_0x857f('0x3e')]){_0x4a17ea[_0x857f('0x3f')]=_['merge'](_0x4a17ea['where'],{'$or':_['map'](_0x4a17ea[_0x857f('0x38')],function(_0x310b18){var _0x2c2422={};_0x2c2422[_0x310b18]={'$like':'%'+_0x338670[_0x857f('0x35')][_0x857f('0x3e')]+'%'};return _0x2c2422;})});}_0x4a17ea=_[_0x857f('0x42')]({},_0x4a17ea,_0x338670[_0x857f('0x43')]);return db['CmHopper'][_0x857f('0x22')]({'where':_0x4a17ea['where']})[_0x857f('0x28')](function(_0x4d7b27){_0x35cd3e['count']=_0x4d7b27;if(_0x338670[_0x857f('0x35')]['includeAll']){_0x4a17ea[_0x857f('0x45')]=[{'all':!![]}];}return db[_0x857f('0x5d')][_0x857f('0x46')](_0x4a17ea);})['then'](function(_0x45be3d){_0x35cd3e[_0x857f('0x47')]=_0x45be3d;return _0x35cd3e;});}})[_0x857f('0x28')](respondWithFilteredResult(_0x4b1110,_0x4a17ea))[_0x857f('0x48')](handleError(_0x4b1110,null));};exports[_0x857f('0x60')]=function(_0x8a1d41,_0x11b818,_0x3b8093){var _0x3e7cc1={'raw':!![],'where':{}};var _0x53a75d={};var _0x1f29e5={'count':0x0,'rows':[]};return db[_0x857f('0x31')][_0x857f('0x61')]({'where':{'id':_0x8a1d41[_0x857f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x11b818,null))[_0x857f('0x28')](function(_0x59cdfb){if(_0x59cdfb){_0x53a75d[_0x857f('0x34')]=_[_0x857f('0x4b')](db[_0x857f('0x62')][_0x857f('0x4c')]);_0x53a75d['query']=_[_0x857f('0x4b')](_0x8a1d41['query']);_0x53a75d['filters']=_[_0x857f('0x37')](_0x53a75d[_0x857f('0x34')],_0x53a75d['query']);_0x3e7cc1['attributes']=_[_0x857f('0x37')](_0x53a75d[_0x857f('0x34')],qs[_0x857f('0x4d')](_0x8a1d41[_0x857f('0x35')]['fields']));_0x3e7cc1[_0x857f('0x38')]=_0x3e7cc1[_0x857f('0x38')][_0x857f('0x39')]?_0x3e7cc1[_0x857f('0x38')]:_0x53a75d[_0x857f('0x34')];if(!_0x8a1d41['query']['hasOwnProperty'](_0x857f('0x3a'))){_0x3e7cc1['limit']=qs['limit'](_0x8a1d41[_0x857f('0x35')][_0x857f('0x21')]);_0x3e7cc1[_0x857f('0x1f')]=qs[_0x857f('0x1f')](_0x8a1d41[_0x857f('0x35')][_0x857f('0x1f')]);}_0x3e7cc1[_0x857f('0x3b')]=qs[_0x857f('0x3c')](_0x8a1d41[_0x857f('0x35')][_0x857f('0x3c')]);_0x3e7cc1[_0x857f('0x3f')]=qs[_0x857f('0x36')](_[_0x857f('0x3d')](_0x8a1d41[_0x857f('0x35')],_0x53a75d[_0x857f('0x36')]));_0x3e7cc1[_0x857f('0x3f')][_0x857f('0x5f')]=_0x59cdfb['id'];if(_0x8a1d41[_0x857f('0x35')][_0x857f('0x3e')]){_0x3e7cc1[_0x857f('0x3f')]=_[_0x857f('0x42')](_0x3e7cc1[_0x857f('0x3f')],{'$or':_['map'](_0x3e7cc1['attributes'],function(_0x4cbe64){var _0x2c4bf9={};_0x2c4bf9[_0x4cbe64]={'$like':'%'+_0x8a1d41[_0x857f('0x35')]['filter']+'%'};return _0x2c4bf9;})});}_0x3e7cc1=_[_0x857f('0x42')]({},_0x3e7cc1,_0x8a1d41[_0x857f('0x43')]);return db['CmHopperHistory'][_0x857f('0x22')]({'where':_0x3e7cc1['where']})[_0x857f('0x28')](function(_0x522dff){_0x1f29e5[_0x857f('0x22')]=_0x522dff;if(_0x8a1d41[_0x857f('0x35')][_0x857f('0x44')]){_0x3e7cc1[_0x857f('0x45')]=[{'all':!![]}];}return db[_0x857f('0x62')][_0x857f('0x46')](_0x3e7cc1);})[_0x857f('0x28')](function(_0x18a010){_0x1f29e5[_0x857f('0x47')]=_0x18a010;return _0x1f29e5;});}})['then'](respondWithFilteredResult(_0x11b818,_0x3e7cc1))[_0x857f('0x48')](handleError(_0x11b818,null));};exports['getHopperFinals']=function(_0x302ee3,_0x3a2cfe,_0x4ca37f){var _0x48eace={'raw':!![],'where':{}};var _0x4d9c25={};var _0x14ba78={'count':0x0,'rows':[]};return db[_0x857f('0x31')][_0x857f('0x61')]({'where':{'id':_0x302ee3['params']['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x3a2cfe,null))['then'](function(_0x2df9b8){if(_0x2df9b8){_0x4d9c25[_0x857f('0x34')]=_[_0x857f('0x4b')](db[_0x857f('0x63')]['rawAttributes']);_0x4d9c25[_0x857f('0x35')]=_[_0x857f('0x4b')](_0x302ee3['query']);_0x4d9c25[_0x857f('0x36')]=_['intersection'](_0x4d9c25[_0x857f('0x34')],_0x4d9c25[_0x857f('0x35')]);_0x48eace[_0x857f('0x38')]=_[_0x857f('0x37')](_0x4d9c25[_0x857f('0x34')],qs[_0x857f('0x4d')](_0x302ee3[_0x857f('0x35')][_0x857f('0x4d')]));_0x48eace[_0x857f('0x38')]=_0x48eace['attributes'][_0x857f('0x39')]?_0x48eace[_0x857f('0x38')]:_0x4d9c25['model'];if(!_0x302ee3[_0x857f('0x35')]['hasOwnProperty'](_0x857f('0x3a'))){_0x48eace['limit']=qs[_0x857f('0x21')](_0x302ee3['query'][_0x857f('0x21')]);_0x48eace[_0x857f('0x1f')]=qs[_0x857f('0x1f')](_0x302ee3[_0x857f('0x35')][_0x857f('0x1f')]);}_0x48eace[_0x857f('0x3b')]=qs['sort'](_0x302ee3[_0x857f('0x35')]['sort']);_0x48eace[_0x857f('0x3f')]=qs[_0x857f('0x36')](_['pick'](_0x302ee3[_0x857f('0x35')],_0x4d9c25[_0x857f('0x36')]));_0x48eace[_0x857f('0x3f')]['CampaignId']=_0x2df9b8['id'];if(_0x302ee3[_0x857f('0x35')]['filter']){_0x48eace[_0x857f('0x3f')]=_[_0x857f('0x42')](_0x48eace['where'],{'$or':_[_0x857f('0x30')](_0x48eace['attributes'],function(_0x2e349f){var _0x333b8a={};_0x333b8a[_0x2e349f]={'$like':'%'+_0x302ee3['query'][_0x857f('0x3e')]+'%'};return _0x333b8a;})});}_0x48eace=_[_0x857f('0x42')]({},_0x48eace,_0x302ee3[_0x857f('0x43')]);return db['CmHopperFinal'][_0x857f('0x22')]({'where':_0x48eace[_0x857f('0x3f')]})[_0x857f('0x28')](function(_0x1ea073){_0x14ba78['count']=_0x1ea073;if(_0x302ee3[_0x857f('0x35')][_0x857f('0x44')]){_0x48eace[_0x857f('0x45')]=[{'all':!![]}];}return db[_0x857f('0x63')][_0x857f('0x46')](_0x48eace);})['then'](function(_0x5394a9){_0x14ba78[_0x857f('0x47')]=_0x5394a9;return _0x14ba78;});}})[_0x857f('0x28')](respondWithFilteredResult(_0x3a2cfe,_0x48eace))[_0x857f('0x48')](handleError(_0x3a2cfe,null));};exports[_0x857f('0x64')]=function(_0x1ea377,_0x4f9468,_0x4b1406){var _0x3fed74={'raw':!![],'where':{}};var _0x2e43fd={};var _0x6bdaba={'count':0x0,'rows':[]};return db[_0x857f('0x31')][_0x857f('0x61')]({'where':{'id':_0x1ea377[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x4f9468,null))['then'](function(_0x32f05c){if(_0x32f05c){_0x2e43fd[_0x857f('0x34')]=_['keys'](db[_0x857f('0x65')][_0x857f('0x4c')]);_0x2e43fd[_0x857f('0x35')]=_[_0x857f('0x4b')](_0x1ea377['query']);_0x2e43fd[_0x857f('0x36')]=_[_0x857f('0x37')](_0x2e43fd[_0x857f('0x34')],_0x2e43fd[_0x857f('0x35')]);_0x3fed74[_0x857f('0x38')]=_['intersection'](_0x2e43fd[_0x857f('0x34')],qs[_0x857f('0x4d')](_0x1ea377[_0x857f('0x35')]['fields']));_0x3fed74['attributes']=_0x3fed74[_0x857f('0x38')][_0x857f('0x39')]?_0x3fed74[_0x857f('0x38')]:_0x2e43fd[_0x857f('0x34')];if(!_0x1ea377[_0x857f('0x35')][_0x857f('0x5e')]('nolimit')){_0x3fed74['limit']=qs['limit'](_0x1ea377['query'][_0x857f('0x21')]);_0x3fed74[_0x857f('0x1f')]=qs[_0x857f('0x1f')](_0x1ea377[_0x857f('0x35')][_0x857f('0x1f')]);}_0x3fed74[_0x857f('0x3b')]=qs[_0x857f('0x3c')](_0x1ea377['query'][_0x857f('0x3c')]);_0x3fed74[_0x857f('0x3f')]=qs[_0x857f('0x36')](_[_0x857f('0x3d')](_0x1ea377['query'],_0x2e43fd[_0x857f('0x36')]));_0x3fed74[_0x857f('0x3f')][_0x857f('0x5f')]=_0x32f05c['id'];if(_0x1ea377[_0x857f('0x35')][_0x857f('0x3e')]){_0x3fed74[_0x857f('0x3f')]=_[_0x857f('0x42')](_0x3fed74[_0x857f('0x3f')],{'$or':_['map'](_0x3fed74[_0x857f('0x38')],function(_0x1f2333){var _0xda999={};_0xda999[_0x1f2333]={'$like':'%'+_0x1ea377['query'][_0x857f('0x3e')]+'%'};return _0xda999;})});}_0x3fed74=_[_0x857f('0x42')]({},_0x3fed74,_0x1ea377[_0x857f('0x43')]);return db[_0x857f('0x65')][_0x857f('0x22')]({'where':_0x3fed74[_0x857f('0x3f')]})[_0x857f('0x28')](function(_0x2aa819){_0x6bdaba['count']=_0x2aa819;if(_0x1ea377[_0x857f('0x35')][_0x857f('0x44')]){_0x3fed74['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x3fed74);})[_0x857f('0x28')](function(_0x27290d){_0x6bdaba[_0x857f('0x47')]=_0x27290d;return _0x6bdaba;});}})['then'](respondWithFilteredResult(_0x4f9468,_0x3fed74))[_0x857f('0x48')](handleError(_0x4f9468,null));};exports['getLists']=function(_0xe4e5ef,_0x14c3ac,_0x45ce2e){var _0x19d80f={};var _0x9aadf4={};var _0x14a077;var _0x5a63b8;return db[_0x857f('0x31')][_0x857f('0x61')]({'where':{'id':_0xe4e5ef[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x14c3ac,null))[_0x857f('0x28')](function(_0x4f01ee){if(_0x4f01ee){_0x14a077=_0x4f01ee;_0x9aadf4[_0x857f('0x34')]=_['keys'](db[_0x857f('0x66')][_0x857f('0x4c')]);_0x9aadf4[_0x857f('0x35')]=_[_0x857f('0x4b')](_0xe4e5ef[_0x857f('0x35')]);_0x9aadf4[_0x857f('0x36')]=_[_0x857f('0x37')](_0x9aadf4[_0x857f('0x34')],_0x9aadf4[_0x857f('0x35')]);_0x19d80f['attributes']=_[_0x857f('0x37')](_0x9aadf4[_0x857f('0x34')],qs[_0x857f('0x4d')](_0xe4e5ef[_0x857f('0x35')][_0x857f('0x4d')]));_0x19d80f['attributes']=_0x19d80f[_0x857f('0x38')][_0x857f('0x39')]?_0x19d80f[_0x857f('0x38')]:_0x9aadf4[_0x857f('0x34')];_0x19d80f['order']=qs[_0x857f('0x3c')](_0xe4e5ef[_0x857f('0x35')][_0x857f('0x3c')]);_0x19d80f['where']=qs[_0x857f('0x36')](_[_0x857f('0x3d')](_0xe4e5ef[_0x857f('0x35')],_0x9aadf4[_0x857f('0x36')]));if(_0xe4e5ef[_0x857f('0x35')][_0x857f('0x3e')]){_0x19d80f[_0x857f('0x3f')]=_['merge'](_0x19d80f[_0x857f('0x3f')],{'$or':_[_0x857f('0x30')](_0x19d80f[_0x857f('0x38')],function(_0x27908e){var _0x5c9051={};_0x5c9051[_0x27908e]={'$like':'%'+_0xe4e5ef['query'][_0x857f('0x3e')]+'%'};return _0x5c9051;})});}_0x19d80f=_[_0x857f('0x42')]({},_0x19d80f,_0xe4e5ef[_0x857f('0x43')]);return _0x14a077[_0x857f('0x67')](_0x19d80f);}})['then'](function(_0x1606bf){if(_0x1606bf){_0x5a63b8=_0x1606bf[_0x857f('0x39')];if(!_0xe4e5ef[_0x857f('0x35')][_0x857f('0x5e')](_0x857f('0x3a'))){_0x19d80f['limit']=qs['limit'](_0xe4e5ef['query'][_0x857f('0x21')]);_0x19d80f['offset']=qs[_0x857f('0x1f')](_0xe4e5ef['query']['offset']);}return _0x14a077[_0x857f('0x67')](_0x19d80f);}})[_0x857f('0x28')](function(_0x412ab5){if(_0x412ab5){return _0x412ab5?{'count':_0x5a63b8,'rows':_0x412ab5}:null;}})[_0x857f('0x28')](respondWithResult(_0x14c3ac,null))[_0x857f('0x48')](handleError(_0x14c3ac,null));};exports[_0x857f('0x68')]=function(_0x1113bf,_0x28c2db,_0x4e40d7){var _0x6fcc36,_0x39a738;var _0x35e5a2=[];var _0x13e6ec=moment()['format'](_0x857f('0x69'));return db['Campaign'][_0x857f('0x4e')]({'where':{'id':_0x1113bf[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x28c2db,null))[_0x857f('0x28')](function(_0x4787e0){if(_0x4787e0){_0x39a738=_0x4787e0;return _0x4787e0[_0x857f('0x68')](_0x1113bf[_0x857f('0x50')][_0x857f('0x6a')],_[_0x857f('0x58')](_0x1113bf[_0x857f('0x50')],['ids','id'])||{});}return null;})['spread'](function(_0x37f001){var _0x3e146b;var _0x52f1e2;_0x6fcc36=_0x37f001||[];var _0x17a939=[];if(_0x37f001){for(var _0x570ccc=0x0;_0x570ccc<_0x37f001[_0x857f('0x39')];_0x570ccc+=0x1){var _0x41deb9=_0x37f001[_0x570ccc][_0x857f('0x29')]({'plain':!![]});_0x39a738[_0x857f('0x6b')]=_0x1113bf['body']['dialCheckDuplicateType']?_0x1113bf[_0x857f('0x50')]['dialCheckDuplicateType']:_0x39a738['dialCheckDuplicateType'];switch(_0x39a738['dialCheckDuplicateType']){case _0x857f('0x6c'):_0x3e146b=squel['insert']()[_0x857f('0x6d')](_0x857f('0x6e'))[_0x857f('0x6f')]([_0x857f('0x70'),_0x857f('0x71'),_0x857f('0x72'),_0x857f('0x73'),_0x857f('0x5f'),_0x857f('0x59'),'updatedAt'],squel['select']()[_0x857f('0x74')](_0x857f('0x70'),_0x857f('0x70'))[_0x857f('0x74')](_0x857f('0x75'),'scheduledAt')[_0x857f('0x74')]('id',_0x857f('0x72'))['field'](_0x41deb9[_0x857f('0x76')]['toString'](),_0x857f('0x73'))[_0x857f('0x74')](_0x1113bf['params']['id'][_0x857f('0x77')](),_0x857f('0x5f'))['field']('\x27'+_0x13e6ec+'\x27',_0x857f('0x59'))['field']('\x27'+_0x13e6ec+'\x27',_0x857f('0x5a'))['from']('cm_contacts')['where'](_0x857f('0x78'))[_0x857f('0x3f')](_0x857f('0x79'),_0x41deb9[_0x857f('0x76')][_0x857f('0x77')]())[_0x857f('0x3f')](_0x857f('0x7a'))['where'](_0x857f('0x7b'),squel[_0x857f('0x7c')]()[_0x857f('0x74')](_0x857f('0x7d'))['from']('cm_hopper_final')[_0x857f('0x3f')](_0x857f('0x7e'),_0x1113bf[_0x857f('0x4a')]['id'][_0x857f('0x77')]()))[_0x857f('0x3f')](_0x857f('0x7b'),squel[_0x857f('0x7c')]()[_0x857f('0x74')](_0x857f('0x7f'))[_0x857f('0x80')](_0x857f('0x6e'))[_0x857f('0x3f')](_0x857f('0x7e'),_0x1113bf[_0x857f('0x4a')]['id'][_0x857f('0x77')]())))['toString']();break;case _0x857f('0x81'):_0x3e146b=squel[_0x857f('0x82')]()[_0x857f('0x6d')]('cm_hopper')['fromQuery']([_0x857f('0x70'),_0x857f('0x71'),_0x857f('0x72'),'ListId',_0x857f('0x5f'),_0x857f('0x59'),_0x857f('0x5a')],squel[_0x857f('0x7c')]()[_0x857f('0x74')]('phone','phone')[_0x857f('0x74')]('NOW()',_0x857f('0x71'))[_0x857f('0x74')]('id','ContactId')['field'](_0x41deb9[_0x857f('0x76')]['toString'](),_0x857f('0x73'))[_0x857f('0x74')](_0x1113bf[_0x857f('0x4a')]['id'][_0x857f('0x77')](),_0x857f('0x5f'))[_0x857f('0x74')]('\x27'+_0x13e6ec+'\x27',_0x857f('0x59'))['field']('\x27'+_0x13e6ec+'\x27','updatedAt')[_0x857f('0x80')](_0x857f('0x83'))['where'](_0x857f('0x78'))[_0x857f('0x3f')](_0x857f('0x79'),_0x41deb9[_0x857f('0x76')]['toString']())[_0x857f('0x3f')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x857f('0x7b'),squel[_0x857f('0x7c')]()['field'](_0x857f('0x7f'))[_0x857f('0x80')](_0x857f('0x6e'))['where'](_0x857f('0x7e'),_0x1113bf[_0x857f('0x4a')]['id'][_0x857f('0x77')]())))[_0x857f('0x77')]();break;default:_0x3e146b=squel[_0x857f('0x82')]()[_0x857f('0x6d')](_0x857f('0x6e'))[_0x857f('0x6f')]([_0x857f('0x70'),_0x857f('0x71'),'ContactId',_0x857f('0x73'),_0x857f('0x5f'),'createdAt',_0x857f('0x5a')],squel[_0x857f('0x7c')]()[_0x857f('0x74')](_0x857f('0x70'),_0x857f('0x70'))[_0x857f('0x74')](_0x857f('0x75'),_0x857f('0x71'))['field']('id',_0x857f('0x72'))[_0x857f('0x74')](_0x41deb9[_0x857f('0x76')][_0x857f('0x77')](),_0x857f('0x73'))['field'](_0x1113bf[_0x857f('0x4a')]['id'][_0x857f('0x77')](),_0x857f('0x5f'))[_0x857f('0x74')]('\x27'+_0x13e6ec+'\x27',_0x857f('0x59'))[_0x857f('0x74')]('\x27'+_0x13e6ec+'\x27',_0x857f('0x5a'))[_0x857f('0x80')](_0x857f('0x83'))[_0x857f('0x3f')]('deletedAt\x20IS\x20NULL')[_0x857f('0x3f')](_0x857f('0x79'),_0x41deb9[_0x857f('0x76')]['toString']())['where'](_0x857f('0x7a')))[_0x857f('0x77')]();}_0x52f1e2=squel['insert']()['into'](_0x857f('0x84'))['fromQuery'](['cmHopperId',_0x857f('0x71'),_0x857f('0x70'),_0x857f('0x85'),_0x857f('0x59'),_0x857f('0x5a')],squel[_0x857f('0x7c')]()[_0x857f('0x74')]('h.id','id')['field'](_0x857f('0x75'),'scheduledAt')['field']('ci.item',_0x857f('0x70'))[_0x857f('0x74')]('ci.OrderBY',_0x857f('0x85'))['field']('\x27'+_0x13e6ec+'\x27',_0x857f('0x59'))['field']('\x27'+_0x13e6ec+'\x27',_0x857f('0x5a'))[_0x857f('0x80')](_0x857f('0x86'),'ci')[_0x857f('0x87')]('cm_hopper','h',_0x857f('0x88'))[_0x857f('0x3f')]('h.ListId\x20=\x20?',_0x41deb9[_0x857f('0x76')][_0x857f('0x77')]())['where'](_0x857f('0x89'),_0x1113bf['params']['id'][_0x857f('0x77')]())[_0x857f('0x3f')](_0x857f('0x8a'),_0x13e6ec))[_0x857f('0x77')]();_0x17a939['push'](db[_0x857f('0x8b')][_0x857f('0x35')](_0x3e146b));_0x35e5a2[_0x857f('0x8c')](db['sequelize'][_0x857f('0x35')](_0x52f1e2));}return BPromise['all'](_0x17a939);}})[_0x857f('0x28')](function(){return BPromise[_0x857f('0x8d')](_0x35e5a2);})['then'](function(){return _0x6fcc36;})[_0x857f('0x28')](respondWithResult(_0x28c2db,null))[_0x857f('0x48')](handleError(_0x28c2db,null));};exports['removeLists']=function(_0x24b69a,_0x2435ee,_0x59f735){return db[_0x857f('0x31')][_0x857f('0x4e')]({'where':{'id':_0x24b69a['params']['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x2435ee,null))['then'](function(_0x5d2fbf){if(_0x5d2fbf){return _0x5d2fbf[_0x857f('0x8e')](_0x24b69a[_0x857f('0x35')][_0x857f('0x6a')]);}})[_0x857f('0x28')](function(_0x110cbc){if(_0x110cbc){return db[_0x857f('0x5d')][_0x857f('0x27')]({'where':{'ListId':_0x24b69a[_0x857f('0x35')][_0x857f('0x6a')],'CampaignId':_0x24b69a[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](function(){return _0x110cbc;});}})[_0x857f('0x28')](respondWithStatusCode(_0x2435ee,null))[_0x857f('0x48')](handleError(_0x2435ee,null));};exports['getBlackLists']=function(_0x5a7cb2,_0x320036,_0x31d896){var _0x12a0d3={};var _0x1b3bb3={};var _0x3269d0;var _0x4077d7;return db[_0x857f('0x31')]['findOne']({'where':{'id':_0x5a7cb2[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x320036,null))['then'](function(_0xb49bfc){if(_0xb49bfc){_0x3269d0=_0xb49bfc;_0x1b3bb3[_0x857f('0x34')]=_[_0x857f('0x4b')](db[_0x857f('0x66')][_0x857f('0x4c')]);_0x1b3bb3[_0x857f('0x35')]=_[_0x857f('0x4b')](_0x5a7cb2['query']);_0x1b3bb3[_0x857f('0x36')]=_[_0x857f('0x37')](_0x1b3bb3[_0x857f('0x34')],_0x1b3bb3[_0x857f('0x35')]);_0x12a0d3[_0x857f('0x38')]=_[_0x857f('0x37')](_0x1b3bb3['model'],qs[_0x857f('0x4d')](_0x5a7cb2['query'][_0x857f('0x4d')]));_0x12a0d3[_0x857f('0x38')]=_0x12a0d3['attributes'][_0x857f('0x39')]?_0x12a0d3['attributes']:_0x1b3bb3[_0x857f('0x34')];_0x12a0d3[_0x857f('0x3b')]=qs[_0x857f('0x3c')](_0x5a7cb2['query'][_0x857f('0x3c')]);_0x12a0d3[_0x857f('0x3f')]=qs[_0x857f('0x36')](_['pick'](_0x5a7cb2['query'],_0x1b3bb3['filters']));if(_0x5a7cb2[_0x857f('0x35')]['filter']){_0x12a0d3[_0x857f('0x3f')]=_['merge'](_0x12a0d3[_0x857f('0x3f')],{'$or':_['map'](_0x12a0d3[_0x857f('0x38')],function(_0x3c6112){var _0x4bd52a={};_0x4bd52a[_0x3c6112]={'$like':'%'+_0x5a7cb2[_0x857f('0x35')]['filter']+'%'};return _0x4bd52a;})});}_0x12a0d3=_[_0x857f('0x42')]({},_0x12a0d3,_0x5a7cb2[_0x857f('0x43')]);return _0x3269d0[_0x857f('0x8f')](_0x12a0d3);}})[_0x857f('0x28')](function(_0x5488d2){if(_0x5488d2){_0x4077d7=_0x5488d2[_0x857f('0x39')];if(!_0x5a7cb2[_0x857f('0x35')][_0x857f('0x5e')](_0x857f('0x3a'))){_0x12a0d3[_0x857f('0x21')]=qs[_0x857f('0x21')](_0x5a7cb2[_0x857f('0x35')][_0x857f('0x21')]);_0x12a0d3['offset']=qs[_0x857f('0x1f')](_0x5a7cb2[_0x857f('0x35')][_0x857f('0x1f')]);}return _0x3269d0[_0x857f('0x8f')](_0x12a0d3);}})[_0x857f('0x28')](function(_0x336a06){if(_0x336a06){return _0x336a06?{'count':_0x4077d7,'rows':_0x336a06}:null;}})[_0x857f('0x28')](respondWithResult(_0x320036,null))[_0x857f('0x48')](handleError(_0x320036,null));};exports[_0x857f('0x90')]=function(_0x586d6c,_0x24bfe0,_0x3d5215){var _0x8896bd,_0x595b48;var _0x2560d8=[];var _0x38c523=moment()[_0x857f('0x91')](_0x857f('0x69'));return db['Campaign'][_0x857f('0x4e')]({'where':{'id':_0x586d6c[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x24bfe0,null))[_0x857f('0x28')](function(_0x1eeca5){if(_0x1eeca5){_0x595b48=_0x1eeca5;return _0x1eeca5['addBlackLists'](_0x586d6c['body'][_0x857f('0x6a')],_[_0x857f('0x58')](_0x586d6c[_0x857f('0x50')],['ids','id'])||{});}return null;})[_0x857f('0x92')](function(_0x14d2e8){var _0x2d1dc1;var _0x16cbe3;_0x8896bd=_0x14d2e8||[];var _0x41e261=[];if(_0x14d2e8){for(var _0x3282b5=0x0;_0x3282b5<_0x14d2e8[_0x857f('0x39')];_0x3282b5+=0x1){var _0x3e07ad=_0x14d2e8[_0x3282b5]['get']({'plain':!![]});_0x2d1dc1=squel['insert']()['into'](_0x857f('0x93'))[_0x857f('0x6f')]([_0x857f('0x70'),_0x857f('0x72'),_0x857f('0x73'),_0x857f('0x5f'),_0x857f('0x59'),_0x857f('0x5a')],squel[_0x857f('0x7c')]()[_0x857f('0x74')](_0x857f('0x70'),_0x857f('0x70'))[_0x857f('0x74')]('id',_0x857f('0x72'))[_0x857f('0x74')](_0x3e07ad[_0x857f('0x76')][_0x857f('0x77')](),'ListId')['field'](_0x586d6c['params']['id'][_0x857f('0x77')](),'CampaignId')[_0x857f('0x74')](_0x857f('0x75'),_0x857f('0x59'))[_0x857f('0x74')]('NOW()',_0x857f('0x5a'))[_0x857f('0x80')](_0x857f('0x83'))[_0x857f('0x3f')](_0x857f('0x78'))[_0x857f('0x3f')](_0x857f('0x79'),_0x3e07ad['CmListId'][_0x857f('0x77')]())[_0x857f('0x3f')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x41e261[_0x857f('0x8c')](db[_0x857f('0x8b')][_0x857f('0x35')](_0x2d1dc1));}return BPromise[_0x857f('0x8d')](_0x41e261);}})[_0x857f('0x28')](function(){return _0x8896bd;})[_0x857f('0x28')](respondWithResult(_0x24bfe0,null))[_0x857f('0x48')](handleError(_0x24bfe0,null));};exports['removeBlackLists']=function(_0x253a2b,_0x1a17af,_0x349f4f){return db['Campaign'][_0x857f('0x4e')]({'where':{'id':_0x253a2b[_0x857f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1a17af,null))[_0x857f('0x28')](function(_0x52d5bc){if(_0x52d5bc){return _0x52d5bc[_0x857f('0x94')](_0x253a2b[_0x857f('0x35')][_0x857f('0x6a')]);}})['then'](function(_0x56d04f){if(_0x56d04f){return db['CmHopperBlack'][_0x857f('0x27')]({'where':{'ListId':_0x253a2b[_0x857f('0x35')]['ids'],'CampaignId':_0x253a2b[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](function(){return _0x56d04f;});}})['then'](respondWithStatusCode(_0x1a17af,null))[_0x857f('0x48')](handleError(_0x1a17af,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 464609b..0ed7cc1 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_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':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_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 logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 93ddbc5..db1a51c 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 _0x202c=['client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetCampaign','Campaign','options','raw','where','attributes','limit','include','model','map','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4f9bdc,_0x10927b){var _0x146a4d=function(_0x56a392){while(--_0x56a392){_0x4f9bdc['push'](_0x4f9bdc['shift']());}};_0x146a4d(++_0x10927b);}(_0x202c,0x178));var _0xc202=function(_0x3f6dac,_0x2102c7){_0x3f6dac=_0x3f6dac-0x0;var _0x550fd3=_0x202c[_0x3f6dac];return _0x550fd3;};'use strict';var _=require(_0xc202('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc202('0x1'));var rs=require(_0xc202('0x2'));var fs=require('fs');var Redis=require(_0xc202('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc202('0x4'));var logger=require(_0xc202('0x5'))(_0xc202('0x6'));var config=require(_0xc202('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc202('0x8')][_0xc202('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59563a,_0xc2b3eb,_0x574549){return new BPromise(function(_0x872c1a,_0x5978fe){return client[_0xc202('0xa')](_0x59563a,_0x574549)[_0xc202('0xb')](function(_0x36fcb7){logger[_0xc202('0xc')](_0xc202('0xd'),_0xc2b3eb,_0xc202('0xe'));logger[_0xc202('0xf')](_0xc202('0x10'),_0xc2b3eb,_0xc202('0xe'),JSON[_0xc202('0x11')](_0x36fcb7));if(_0x36fcb7[_0xc202('0x12')]){if(_0x36fcb7['error'][_0xc202('0x13')]===0x1f4){logger[_0xc202('0x12')](_0xc202('0xd'),_0xc2b3eb,_0x36fcb7[_0xc202('0x12')][_0xc202('0x14')]);return _0x5978fe(_0x36fcb7[_0xc202('0x12')][_0xc202('0x14')]);}logger['error'](_0xc202('0xd'),_0xc2b3eb,_0x36fcb7[_0xc202('0x12')]['message']);return _0x872c1a(_0x36fcb7['error']['message']);}else{logger[_0xc202('0xc')]('Campaign,\x20%s,\x20%s',_0xc2b3eb,_0xc202('0xe'));_0x872c1a(_0x36fcb7['result'][_0xc202('0x14')]);}})[_0xc202('0x15')](function(_0x3018c8){logger[_0xc202('0x12')](_0xc202('0xd'),_0xc2b3eb,_0x3018c8);_0x5978fe(_0x3018c8);});});}exports[_0xc202('0x16')]=function(_0x9620a0){var _0x591ecc=this;return new Promise(function(_0x16ec7c,_0x2c5557){return db[_0xc202('0x17')]['findAll']({'raw':_0x9620a0['options']?_0x9620a0[_0xc202('0x18')][_0xc202('0x19')]===undefined?!![]:![]:!![],'where':_0x9620a0[_0xc202('0x18')]?_0x9620a0[_0xc202('0x18')][_0xc202('0x1a')]||null:null,'attributes':_0x9620a0['options']?_0x9620a0['options'][_0xc202('0x1b')]||null:null,'limit':_0x9620a0['options']?_0x9620a0[_0xc202('0x18')][_0xc202('0x1c')]||null:null,'include':_0x9620a0['options']?_0x9620a0['options'][_0xc202('0x1d')]?_['map'](_0x9620a0[_0xc202('0x18')][_0xc202('0x1d')],function(_0x27f4cb){return{'model':db[_0x27f4cb[_0xc202('0x1e')]],'as':_0x27f4cb['as'],'attributes':_0x27f4cb[_0xc202('0x1b')],'include':_0x27f4cb['include']?_['map'](_0x27f4cb[_0xc202('0x1d')],function(_0x1076af){return{'model':db[_0x1076af[_0xc202('0x1e')]],'as':_0x1076af['as'],'attributes':_0x1076af['attributes'],'include':_0x1076af[_0xc202('0x1d')]?_[_0xc202('0x1f')](_0x1076af['include'],function(_0x54e0f1){return{'model':db[_0x54e0f1[_0xc202('0x1e')]],'as':_0x54e0f1['as'],'attributes':_0x54e0f1[_0xc202('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc202('0xb')](function(_0x6b291c){logger[_0xc202('0xc')]('GetCampaign',_0x9620a0);logger[_0xc202('0xf')](_0xc202('0x16'),_0x9620a0,JSON['stringify'](_0x6b291c));_0x16ec7c(_0x6b291c);})['catch'](function(_0x25a954){logger[_0xc202('0x12')](_0xc202('0x16'),_0x25a954[_0xc202('0x14')],_0x9620a0);_0x2c5557(_0x591ecc['error'](0x1f4,_0x25a954[_0xc202('0x14')]));});});}; \ No newline at end of file +var _0x76bc=['findAll','options','raw','where','attributes','include','map','model','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','GetCampaign'];(function(_0x49700d,_0x293a09){var _0x164fd8=function(_0x27c85f){while(--_0x27c85f){_0x49700d['push'](_0x49700d['shift']());}};_0x164fd8(++_0x293a09);}(_0x76bc,0x17f));var _0xc76b=function(_0xa9eaa0,_0x4ba2b4){_0xa9eaa0=_0xa9eaa0-0x0;var _0x30897a=_0x76bc[_0xa9eaa0];return _0x30897a;};'use strict';var _=require(_0xc76b('0x0'));var util=require(_0xc76b('0x1'));var moment=require(_0xc76b('0x2'));var BPromise=require(_0xc76b('0x3'));var rs=require(_0xc76b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc76b('0x5'));var logger=require(_0xc76b('0x6'))(_0xc76b('0x7'));var config=require(_0xc76b('0x8'));var jayson=require(_0xc76b('0x9'));var client=jayson[_0xc76b('0xa')][_0xc76b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cbe53,_0x110f3b,_0x1cb174){return new BPromise(function(_0x235ff3,_0xaf195c){return client[_0xc76b('0xc')](_0x2cbe53,_0x1cb174)[_0xc76b('0xd')](function(_0x2803e9){logger[_0xc76b('0xe')]('Campaign,\x20%s,\x20%s',_0x110f3b,_0xc76b('0xf'));logger[_0xc76b('0x10')](_0xc76b('0x11'),_0x110f3b,_0xc76b('0xf'),JSON[_0xc76b('0x12')](_0x2803e9));if(_0x2803e9[_0xc76b('0x13')]){if(_0x2803e9['error'][_0xc76b('0x14')]===0x1f4){logger[_0xc76b('0x13')](_0xc76b('0x15'),_0x110f3b,_0x2803e9[_0xc76b('0x13')][_0xc76b('0x16')]);return _0xaf195c(_0x2803e9[_0xc76b('0x13')][_0xc76b('0x16')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x110f3b,_0x2803e9[_0xc76b('0x13')][_0xc76b('0x16')]);return _0x235ff3(_0x2803e9[_0xc76b('0x13')][_0xc76b('0x16')]);}else{logger[_0xc76b('0xe')]('Campaign,\x20%s,\x20%s',_0x110f3b,_0xc76b('0xf'));_0x235ff3(_0x2803e9[_0xc76b('0x17')][_0xc76b('0x16')]);}})['catch'](function(_0x4e759e){logger[_0xc76b('0x13')](_0xc76b('0x15'),_0x110f3b,_0x4e759e);_0xaf195c(_0x4e759e);});});}exports[_0xc76b('0x18')]=function(_0x3e716e){var _0x20e2a3=this;return new Promise(function(_0x55a61d,_0x48f9c0){return db['Campaign'][_0xc76b('0x19')]({'raw':_0x3e716e[_0xc76b('0x1a')]?_0x3e716e[_0xc76b('0x1a')][_0xc76b('0x1b')]===undefined?!![]:![]:!![],'where':_0x3e716e[_0xc76b('0x1a')]?_0x3e716e[_0xc76b('0x1a')][_0xc76b('0x1c')]||null:null,'attributes':_0x3e716e[_0xc76b('0x1a')]?_0x3e716e[_0xc76b('0x1a')][_0xc76b('0x1d')]||null:null,'limit':_0x3e716e['options']?_0x3e716e[_0xc76b('0x1a')]['limit']||null:null,'include':_0x3e716e[_0xc76b('0x1a')]?_0x3e716e[_0xc76b('0x1a')][_0xc76b('0x1e')]?_[_0xc76b('0x1f')](_0x3e716e[_0xc76b('0x1a')][_0xc76b('0x1e')],function(_0xa6a862){return{'model':db[_0xa6a862[_0xc76b('0x20')]],'as':_0xa6a862['as'],'attributes':_0xa6a862[_0xc76b('0x1d')],'include':_0xa6a862['include']?_[_0xc76b('0x1f')](_0xa6a862[_0xc76b('0x1e')],function(_0x5f0a7b){return{'model':db[_0x5f0a7b[_0xc76b('0x20')]],'as':_0x5f0a7b['as'],'attributes':_0x5f0a7b[_0xc76b('0x1d')],'include':_0x5f0a7b[_0xc76b('0x1e')]?_[_0xc76b('0x1f')](_0x5f0a7b[_0xc76b('0x1e')],function(_0x451ee1){return{'model':db[_0x451ee1['model']],'as':_0x451ee1['as'],'attributes':_0x451ee1['attributes']};}):[]};}):[]};}):[]:[]})[_0xc76b('0xd')](function(_0x35feeb){logger[_0xc76b('0xe')](_0xc76b('0x18'),_0x3e716e);logger['debug'](_0xc76b('0x18'),_0x3e716e,JSON[_0xc76b('0x12')](_0x35feeb));_0x55a61d(_0x35feeb);})[_0xc76b('0x21')](function(_0x4a0918){logger[_0xc76b('0x13')](_0xc76b('0x18'),_0x4a0918[_0xc76b('0x16')],_0x3e716e);_0x48f9c0(_0x20e2a3[_0xc76b('0x13')](0x1f4,_0x4a0918['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 2ef9949..70f08fc 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 _0xeab4=['post','create','/:id/clone','clone','/:id/lists','addLists','/:id/blacklists','put','/:id','delete','removeLists','removeBlackLists','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','getBlackLists'];(function(_0x50309e,_0x5ab9fb){var _0x4080ae=function(_0x4fa78b){while(--_0x4fa78b){_0x50309e['push'](_0x50309e['shift']());}};_0x4080ae(++_0x5ab9fb);}(_0xeab4,0x185));var _0x4eab=function(_0x2fb2f5,_0x4e42ce){_0x2fb2f5=_0x2fb2f5-0x0;var _0x1b1e4e=_0xeab4[_0x2fb2f5];return _0x1b1e4e;};'use strict';var multer=require('multer');var util=require(_0x4eab('0x0'));var path=require('path');var timeout=require(_0x4eab('0x1'));var express=require(_0x4eab('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4eab('0x3'));var interaction=require(_0x4eab('0x4'));var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0x4eab('0x5')]('/',auth[_0x4eab('0x6')](),controller[_0x4eab('0x7')]);router[_0x4eab('0x5')]('/:id',auth[_0x4eab('0x6')](),controller[_0x4eab('0x8')]);router[_0x4eab('0x5')](_0x4eab('0x9'),auth[_0x4eab('0x6')](),controller[_0x4eab('0xa')]);router['get'](_0x4eab('0xb'),auth[_0x4eab('0x6')](),controller[_0x4eab('0xc')]);router[_0x4eab('0x5')](_0x4eab('0xd'),auth[_0x4eab('0x6')](),controller['getHopperFinals']);router[_0x4eab('0x5')](_0x4eab('0xe'),auth[_0x4eab('0x6')](),controller[_0x4eab('0xf')]);router[_0x4eab('0x5')]('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router[_0x4eab('0x5')]('/:id/blacklists',auth[_0x4eab('0x6')](),controller[_0x4eab('0x10')]);router[_0x4eab('0x11')]('/',auth[_0x4eab('0x6')](),controller[_0x4eab('0x12')]);router[_0x4eab('0x11')](_0x4eab('0x13'),auth[_0x4eab('0x6')](),controller[_0x4eab('0x14')]);router[_0x4eab('0x11')](_0x4eab('0x15'),auth['isAuthenticated'](),controller[_0x4eab('0x16')]);router[_0x4eab('0x11')](_0x4eab('0x17'),auth[_0x4eab('0x6')](),controller['addBlackLists']);router[_0x4eab('0x18')](_0x4eab('0x19'),auth[_0x4eab('0x6')](),controller['update']);router[_0x4eab('0x1a')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x4eab('0x1a')](_0x4eab('0x15'),auth[_0x4eab('0x6')](),controller[_0x4eab('0x1b')]);router[_0x4eab('0x1a')](_0x4eab('0x17'),auth['isAuthenticated'](),controller[_0x4eab('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x8e2b=['put','update','destroy','delete','removeLists','removeBlackLists','exports','multer','util','connect-timeout','express','Router','fs-extra','get','index','/:id','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','post','create','/:id/clone','clone','addLists'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x8e2b,0x19a));var _0xb8e2=function(_0xaa345e,_0x49f73b){_0xaa345e=_0xaa345e-0x0;var _0x24cbea=_0x8e2b[_0xaa345e];return _0x24cbea;};'use strict';var multer=require(_0xb8e2('0x0'));var util=require(_0xb8e2('0x1'));var path=require('path');var timeout=require(_0xb8e2('0x2'));var express=require(_0xb8e2('0x3'));var router=express[_0xb8e2('0x4')]();var fs_extra=require(_0xb8e2('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0xb8e2('0x6')]('/',auth['isAuthenticated'](),controller[_0xb8e2('0x7')]);router[_0xb8e2('0x6')](_0xb8e2('0x8'),auth[_0xb8e2('0x9')](),controller['show']);router[_0xb8e2('0x6')]('/:id/hoppers',auth[_0xb8e2('0x9')](),controller[_0xb8e2('0xa')]);router[_0xb8e2('0x6')](_0xb8e2('0xb'),auth[_0xb8e2('0x9')](),controller[_0xb8e2('0xc')]);router['get'](_0xb8e2('0xd'),auth['isAuthenticated'](),controller[_0xb8e2('0xe')]);router[_0xb8e2('0x6')](_0xb8e2('0xf'),auth[_0xb8e2('0x9')](),controller[_0xb8e2('0x10')]);router[_0xb8e2('0x6')](_0xb8e2('0x11'),auth[_0xb8e2('0x9')](),controller['getLists']);router['get'](_0xb8e2('0x12'),auth[_0xb8e2('0x9')](),controller['getBlackLists']);router[_0xb8e2('0x13')]('/',auth[_0xb8e2('0x9')](),controller[_0xb8e2('0x14')]);router[_0xb8e2('0x13')](_0xb8e2('0x15'),auth[_0xb8e2('0x9')](),controller[_0xb8e2('0x16')]);router[_0xb8e2('0x13')](_0xb8e2('0x11'),auth[_0xb8e2('0x9')](),controller[_0xb8e2('0x17')]);router['post'](_0xb8e2('0x12'),auth[_0xb8e2('0x9')](),controller['addBlackLists']);router[_0xb8e2('0x18')](_0xb8e2('0x8'),auth[_0xb8e2('0x9')](),controller[_0xb8e2('0x19')]);router['delete'](_0xb8e2('0x8'),auth[_0xb8e2('0x9')](),controller[_0xb8e2('0x1a')]);router[_0xb8e2('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xb8e2('0x1c')]);router[_0xb8e2('0x1b')](_0xb8e2('0x12'),auth[_0xb8e2('0x9')](),controller[_0xb8e2('0x1d')]);module[_0xb8e2('0x1e')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 674ef0d..08d7ecc 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 _0xfb8f=['VIRTUAL','getDataValue','key','sequelize','exports','STRING','TEXT','medium'];(function(_0x201361,_0x3d6778){var _0x300db2=function(_0x3b3c10){while(--_0x3b3c10){_0x201361['push'](_0x201361['shift']());}};_0x300db2(++_0x3d6778);}(_0xfb8f,0x113));var _0xffb8=function(_0x404f13,_0x4fa35f){_0x404f13=_0x404f13-0x0;var _0x1f9dbb=_0xfb8f[_0x404f13];return _0x1f9dbb;};'use strict';var Sequelize=require(_0xffb8('0x0'));module[_0xffb8('0x1')]={'key':{'type':Sequelize[_0xffb8('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xffb8('0x3')],'length':_0xffb8('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xffb8('0x2')]},'name':{'type':Sequelize[_0xffb8('0x5')],'get':function(){return this[_0xffb8('0x6')](_0xffb8('0x7'));}}}; \ No newline at end of file +var _0x2a8a=['VIRTUAL','getDataValue','key','exports','STRING','medium'];(function(_0x32f145,_0xf6a2ae){var _0xe274ba=function(_0x3c9b72){while(--_0x3c9b72){_0x32f145['push'](_0x32f145['shift']());}};_0xe274ba(++_0xf6a2ae);}(_0x2a8a,0x93));var _0xa2a8=function(_0xbc50d6,_0x275e33){_0xbc50d6=_0xbc50d6-0x0;var _0x30d8a7=_0x2a8a[_0xbc50d6];return _0x30d8a7;};'use strict';var Sequelize=require('sequelize');module[_0xa2a8('0x0')]={'key':{'type':Sequelize[_0xa2a8('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0xa2a8('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xa2a8('0x3')],'get':function(){return this[_0xa2a8('0x4')](_0xa2a8('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index e18ff3b..e36e4a2 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 _0x3079=['CannedAnswers','UserProfileResource','end','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','sort','pick','filter','merge','where','options','CannedAnswer','includeAll','findAll','rows','catch','keys','include','body','find','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get'];(function(_0x3367ee,_0xaea5bd){var _0xc50483=function(_0x40db59){while(--_0x40db59){_0x3367ee['push'](_0x3367ee['shift']());}};_0xc50483(++_0xaea5bd);}(_0x3079,0x190));var _0x9307=function(_0x150d0c,_0x32b918){_0x150d0c=_0x150d0c-0x0;var _0x2448bb=_0x3079[_0x150d0c];return _0x2448bb;};'use strict';var emlformat=require(_0x9307('0x0'));var rimraf=require(_0x9307('0x1'));var zipdir=require(_0x9307('0x2'));var jsonpatch=require(_0x9307('0x3'));var rp=require(_0x9307('0x4'));var moment=require(_0x9307('0x5'));var BPromise=require(_0x9307('0x6'));var Mustache=require(_0x9307('0x7'));var util=require(_0x9307('0x8'));var path=require('path');var sox=require(_0x9307('0x9'));var csv=require('to-csv');var ejs=require(_0x9307('0xa'));var fs=require('fs');var fs_extra=require(_0x9307('0xb'));var _=require('lodash');var squel=require(_0x9307('0xc'));var crypto=require('crypto');var jsforce=require(_0x9307('0xd'));var deskjs=require(_0x9307('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9307('0xf'));var Papa=require(_0x9307('0x10'));var Redis=require(_0x9307('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9307('0x12'));var hardwareService=require(_0x9307('0x13'));var logger=require(_0x9307('0x14'))(_0x9307('0x15'));var utils=require(_0x9307('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9307('0x17'));var db=require(_0x9307('0x18'))['db'];function respondWithStatusCode(_0x193331,_0x2ad580){_0x2ad580=_0x2ad580||0xcc;return function(_0x8c7165){if(_0x8c7165){return _0x193331['sendStatus'](_0x2ad580);}return _0x193331['status'](_0x2ad580)['end']();};}function respondWithResult(_0x12ba60,_0x198d6a){_0x198d6a=_0x198d6a||0xc8;return function(_0x1fc7a2){if(_0x1fc7a2){return _0x12ba60[_0x9307('0x19')](_0x198d6a)[_0x9307('0x1a')](_0x1fc7a2);}};}function respondWithFilteredResult(_0x3caeb5,_0x36f3d0){return function(_0x23f16e){if(_0x23f16e){var _0x16a541=typeof _0x36f3d0[_0x9307('0x1b')]===_0x9307('0x1c')&&typeof _0x36f3d0[_0x9307('0x1d')]===_0x9307('0x1c');var _0x1ca88e=_0x23f16e[_0x9307('0x1e')];var _0x3568e4=_0x16a541?0x0:_0x36f3d0[_0x9307('0x1b')];var _0x5f1e15=_0x16a541?_0x23f16e[_0x9307('0x1e')]:_0x36f3d0[_0x9307('0x1b')]+_0x36f3d0[_0x9307('0x1d')];var _0x376d5a;if(_0x5f1e15>=_0x1ca88e){_0x5f1e15=_0x1ca88e;_0x376d5a=0xc8;}else{_0x376d5a=0xce;}_0x3caeb5[_0x9307('0x19')](_0x376d5a);return _0x3caeb5[_0x9307('0x1f')](_0x9307('0x20'),_0x3568e4+'-'+_0x5f1e15+'/'+_0x1ca88e)[_0x9307('0x1a')](_0x23f16e);}return null;};}function patchUpdates(_0x3466c3){return function(_0x122a7d){try{jsonpatch[_0x9307('0x21')](_0x122a7d,_0x3466c3,!![]);}catch(_0x2f8e77){return BPromise[_0x9307('0x22')](_0x2f8e77);}return _0x122a7d[_0x9307('0x23')]();};}function saveUpdates(_0x55af7b,_0x122632){return function(_0x898c43){if(_0x898c43){return _0x898c43[_0x9307('0x24')](_0x55af7b)[_0x9307('0x25')](function(_0x1a4800){return _0x1a4800;});}return null;};}function removeEntity(_0x1d2ea6,_0x521f22){return function(_0x434643){if(_0x434643){return _0x434643[_0x9307('0x26')]()['then'](function(){var _0x431cd7=_0x434643[_0x9307('0x27')]({'plain':!![]});var _0x3893a9=_0x9307('0x28');return db[_0x9307('0x29')]['destroy']({'where':{'type':_0x3893a9,'resourceId':_0x431cd7['id']}})[_0x9307('0x25')](function(){return _0x434643;});})[_0x9307('0x25')](function(){_0x1d2ea6[_0x9307('0x19')](0xcc)[_0x9307('0x2a')]();});}};}function handleEntityNotFound(_0x1525d2,_0x468f7b){return function(_0x4ec61b){if(!_0x4ec61b){_0x1525d2[_0x9307('0x2b')](0x194);}return _0x4ec61b;};}function handleError(_0x95d06a,_0x27bf6b){_0x27bf6b=_0x27bf6b||0x1f4;return function(_0x34f5c0){logger[_0x9307('0x2c')](_0x34f5c0['stack']);if(_0x34f5c0[_0x9307('0x2d')]){delete _0x34f5c0[_0x9307('0x2d')];}_0x95d06a[_0x9307('0x19')](_0x27bf6b)[_0x9307('0x2e')](_0x34f5c0);};}exports[_0x9307('0x2f')]=function(_0x868159,_0x211eb2){var _0x45abd7={},_0x11e7e8={},_0xf6e1a5={'count':0x0,'rows':[]};var _0x145e56=_[_0x9307('0x30')](db['CannedAnswer'][_0x9307('0x31')],function(_0x966f07){return{'name':_0x966f07[_0x9307('0x32')],'type':_0x966f07[_0x9307('0x33')][_0x9307('0x34')]};});_0x11e7e8[_0x9307('0x35')]=_[_0x9307('0x30')](_0x145e56,_0x9307('0x2d'));_0x11e7e8['query']=_['keys'](_0x868159[_0x9307('0x36')]);_0x11e7e8[_0x9307('0x37')]=_['intersection'](_0x11e7e8[_0x9307('0x35')],_0x11e7e8[_0x9307('0x36')]);_0x45abd7['attributes']=_[_0x9307('0x38')](_0x11e7e8[_0x9307('0x35')],qs[_0x9307('0x39')](_0x868159[_0x9307('0x36')][_0x9307('0x39')]));_0x45abd7['attributes']=_0x45abd7[_0x9307('0x3a')][_0x9307('0x3b')]?_0x45abd7[_0x9307('0x3a')]:_0x11e7e8[_0x9307('0x35')];if(!_0x868159['query']['hasOwnProperty']('nolimit')){_0x45abd7['limit']=qs['limit'](_0x868159[_0x9307('0x36')]['limit']);_0x45abd7[_0x9307('0x1b')]=qs[_0x9307('0x1b')](_0x868159[_0x9307('0x36')]['offset']);}_0x45abd7['order']=qs[_0x9307('0x3c')](_0x868159[_0x9307('0x36')][_0x9307('0x3c')]);_0x45abd7['where']=qs[_0x9307('0x37')](_[_0x9307('0x3d')](_0x868159[_0x9307('0x36')],_0x11e7e8['filters']),_0x145e56);if(_0x868159['query'][_0x9307('0x3e')]){_0x45abd7['where']=_[_0x9307('0x3f')](_0x45abd7[_0x9307('0x40')],{'$or':[{'key':{'$like':'%'+_0x868159[_0x9307('0x36')][_0x9307('0x3e')]+'%'}},{'value':{'$like':'%'+_0x868159[_0x9307('0x36')]['filter']+'%'}}]});}_0x45abd7=_['merge']({},_0x45abd7,_0x868159[_0x9307('0x41')]);var _0x5795da={'where':_0x45abd7['where']};return db[_0x9307('0x42')][_0x9307('0x1e')](_0x5795da)['then'](function(_0x45086a){_0xf6e1a5[_0x9307('0x1e')]=_0x45086a;if(_0x868159[_0x9307('0x36')][_0x9307('0x43')]){_0x45abd7['include']=[{'all':!![]}];}return db[_0x9307('0x42')][_0x9307('0x44')](_0x45abd7);})[_0x9307('0x25')](function(_0x2a6bf0){_0xf6e1a5[_0x9307('0x45')]=_0x2a6bf0;return _0xf6e1a5;})[_0x9307('0x25')](respondWithFilteredResult(_0x211eb2,_0x45abd7))[_0x9307('0x46')](handleError(_0x211eb2,null));};exports['show']=function(_0x496049,_0x1670c6){var _0x7f9b49={'raw':!![],'where':{'id':_0x496049['params']['id']}},_0x138e3a={};_0x138e3a['model']=_[_0x9307('0x47')](db[_0x9307('0x42')][_0x9307('0x31')]);_0x138e3a['query']=_['keys'](_0x496049['query']);_0x138e3a[_0x9307('0x37')]=_[_0x9307('0x38')](_0x138e3a[_0x9307('0x35')],_0x138e3a['query']);_0x7f9b49['attributes']=_['intersection'](_0x138e3a[_0x9307('0x35')],qs[_0x9307('0x39')](_0x496049[_0x9307('0x36')][_0x9307('0x39')]));_0x7f9b49[_0x9307('0x3a')]=_0x7f9b49[_0x9307('0x3a')][_0x9307('0x3b')]?_0x7f9b49[_0x9307('0x3a')]:_0x138e3a[_0x9307('0x35')];if(_0x496049[_0x9307('0x36')]['includeAll']){_0x7f9b49[_0x9307('0x48')]=[{'all':!![]}];}_0x7f9b49=_[_0x9307('0x3f')]({},_0x7f9b49,_0x496049['options']);return db[_0x9307('0x42')]['find'](_0x7f9b49)['then'](handleEntityNotFound(_0x1670c6,null))[_0x9307('0x25')](respondWithResult(_0x1670c6,null))[_0x9307('0x46')](handleError(_0x1670c6,null));};exports['update']=function(_0x17e45b,_0x40cdf1){if(_0x17e45b[_0x9307('0x49')]['id']){delete _0x17e45b[_0x9307('0x49')]['id'];}return db[_0x9307('0x42')][_0x9307('0x4a')]({'where':{'id':_0x17e45b['params']['id']}})['then'](handleEntityNotFound(_0x40cdf1,null))[_0x9307('0x25')](saveUpdates(_0x17e45b['body'],null))['then'](respondWithResult(_0x40cdf1,null))['catch'](handleError(_0x40cdf1,null));};exports[_0x9307('0x26')]=function(_0x2a5a00,_0x3736da){return db[_0x9307('0x42')][_0x9307('0x4a')]({'where':{'id':_0x2a5a00[_0x9307('0x4b')]['id']}})[_0x9307('0x25')](handleEntityNotFound(_0x3736da,null))[_0x9307('0x25')](removeEntity(_0x3736da,null))[_0x9307('0x46')](handleError(_0x3736da,null));};exports[_0x9307('0x4c')]=function(_0x765079,_0x228141){var _0x3bc7a0={'key':_0x765079['body'][_0x9307('0x34')]};if(_0x765079[_0x9307('0x49')]['MailAccountId']){_0x3bc7a0[_0x9307('0x4d')]=_0x765079[_0x9307('0x49')]['MailAccountId'];}else if(_0x765079['body'][_0x9307('0x4e')]){_0x3bc7a0[_0x9307('0x4e')]=_0x765079[_0x9307('0x49')][_0x9307('0x4e')];}else if(_0x765079[_0x9307('0x49')][_0x9307('0x4f')]){_0x3bc7a0[_0x9307('0x4f')]=_0x765079[_0x9307('0x49')][_0x9307('0x4f')];}else if(_0x765079['body'][_0x9307('0x50')]){_0x3bc7a0['ChatWebsiteId']=_0x765079[_0x9307('0x49')]['ChatWebsiteId'];}return db[_0x9307('0x42')][_0x9307('0x4a')]({'where':_0x3bc7a0})[_0x9307('0x25')](function(_0x5abb94){if(_0x5abb94){throw new db[(_0x9307('0x51'))]['ValidationError'](_0x9307('0x52'));}return db['CannedAnswer'][_0x9307('0x4c')](_0x765079[_0x9307('0x49')]);})[_0x9307('0x25')](function(_0x330237){var _0x1c94f8=_0x765079['user'][_0x9307('0x27')]({'plain':!![]});if(!_0x1c94f8)throw new Error(_0x9307('0x53'));if(_0x1c94f8[_0x9307('0x54')]===_0x9307('0x55')){var _0x54da8c=_0x330237['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x9307('0x28'),'userProfileId':_0x1c94f8['userProfileId']},'raw':!![]})[_0x9307('0x25')](function(_0x2b73c3){if(_0x2b73c3&&_0x2b73c3[_0x9307('0x56')]===0x0){return db[_0x9307('0x29')][_0x9307('0x4c')]({'name':_0x54da8c['name'],'resourceId':_0x54da8c['id'],'type':_0x2b73c3['name'],'sectionId':_0x2b73c3['id']},{})['then'](function(){return _0x330237;});}else{return _0x330237;}})[_0x9307('0x46')](function(_0xfb60b0){logger[_0x9307('0x2c')](_0x9307('0x57'),_0xfb60b0);throw _0xfb60b0;});}return _0x330237;})[_0x9307('0x25')](respondWithResult(_0x228141,0xc9))[_0x9307('0x46')](handleError(_0x228141,null));}; \ No newline at end of file +var _0x226b=['status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','filter','options','CannedAnswer','includeAll','findAll','params','rawAttributes','filters','include','body','find','catch','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','eml-format','rimraf','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x18e4ad,_0x4e1684){var _0x4c8d85=function(_0x320ea2){while(--_0x320ea2){_0x18e4ad['push'](_0x18e4ad['shift']());}};_0x4c8d85(++_0x4e1684);}(_0x226b,0x134));var _0xb226=function(_0x5f0f89,_0x1fc5cc){_0x5f0f89=_0x5f0f89-0x0;var _0x541945=_0x226b[_0x5f0f89];return _0x541945;};'use strict';var emlformat=require(_0xb226('0x0'));var rimraf=require(_0xb226('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb226('0x2'));var util=require(_0xb226('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xb226('0x4'));var ejs=require(_0xb226('0x5'));var fs=require('fs');var fs_extra=require(_0xb226('0x6'));var _=require(_0xb226('0x7'));var squel=require(_0xb226('0x8'));var crypto=require(_0xb226('0x9'));var jsforce=require(_0xb226('0xa'));var deskjs=require(_0xb226('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb226('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb226('0xd'));var qs=require(_0xb226('0xe'));var as=require(_0xb226('0xf'));var hardwareService=require(_0xb226('0x10'));var logger=require(_0xb226('0x11'))(_0xb226('0x12'));var utils=require(_0xb226('0x13'));var config=require(_0xb226('0x14'));var licenseUtil=require(_0xb226('0x15'));var db=require(_0xb226('0x16'))['db'];function respondWithStatusCode(_0x1d19cb,_0xc04e32){_0xc04e32=_0xc04e32||0xcc;return function(_0xcb7f29){if(_0xcb7f29){return _0x1d19cb[_0xb226('0x17')](_0xc04e32);}return _0x1d19cb['status'](_0xc04e32)['end']();};}function respondWithResult(_0x19278f,_0x58cdc8){_0x58cdc8=_0x58cdc8||0xc8;return function(_0x17c444){if(_0x17c444){return _0x19278f[_0xb226('0x18')](_0x58cdc8)[_0xb226('0x19')](_0x17c444);}};}function respondWithFilteredResult(_0x57f47a,_0xc96b4d){return function(_0x3a2378){if(_0x3a2378){var _0x4c7075=typeof _0xc96b4d[_0xb226('0x1a')]===_0xb226('0x1b')&&typeof _0xc96b4d[_0xb226('0x1c')]===_0xb226('0x1b');var _0x123db2=_0x3a2378['count'];var _0x491218=_0x4c7075?0x0:_0xc96b4d[_0xb226('0x1a')];var _0x11e60f=_0x4c7075?_0x3a2378[_0xb226('0x1d')]:_0xc96b4d['offset']+_0xc96b4d['limit'];var _0x4d6806;if(_0x11e60f>=_0x123db2){_0x11e60f=_0x123db2;_0x4d6806=0xc8;}else{_0x4d6806=0xce;}_0x57f47a[_0xb226('0x18')](_0x4d6806);return _0x57f47a['set'](_0xb226('0x1e'),_0x491218+'-'+_0x11e60f+'/'+_0x123db2)['json'](_0x3a2378);}return null;};}function patchUpdates(_0x370b3e){return function(_0x42bc00){try{jsonpatch[_0xb226('0x1f')](_0x42bc00,_0x370b3e,!![]);}catch(_0x3b59d9){return BPromise[_0xb226('0x20')](_0x3b59d9);}return _0x42bc00[_0xb226('0x21')]();};}function saveUpdates(_0x2217b1,_0x3a58a0){return function(_0x1e3e2e){if(_0x1e3e2e){return _0x1e3e2e[_0xb226('0x22')](_0x2217b1)[_0xb226('0x23')](function(_0x2e6845){return _0x2e6845;});}return null;};}function removeEntity(_0x25aead,_0x597850){return function(_0x1eda86){if(_0x1eda86){return _0x1eda86[_0xb226('0x24')]()['then'](function(){var _0x627a07=_0x1eda86[_0xb226('0x25')]({'plain':!![]});var _0x47f25f='CannedAnswers';return db[_0xb226('0x26')]['destroy']({'where':{'type':_0x47f25f,'resourceId':_0x627a07['id']}})[_0xb226('0x23')](function(){return _0x1eda86;});})['then'](function(){_0x25aead[_0xb226('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x476d22,_0x122c08){return function(_0x4d43b7){if(!_0x4d43b7){_0x476d22['sendStatus'](0x194);}return _0x4d43b7;};}function handleError(_0x5247f1,_0x27f48b){_0x27f48b=_0x27f48b||0x1f4;return function(_0x24e002){logger['error'](_0x24e002[_0xb226('0x27')]);if(_0x24e002[_0xb226('0x28')]){delete _0x24e002[_0xb226('0x28')];}_0x5247f1['status'](_0x27f48b)[_0xb226('0x29')](_0x24e002);};}exports[_0xb226('0x2a')]=function(_0x2d3d0b,_0x5dae05){var _0x583f07={},_0x478931={},_0x47d492={'count':0x0,'rows':[]};var _0xa30c84=_['map'](db['CannedAnswer']['rawAttributes'],function(_0x1431e1){return{'name':_0x1431e1['fieldName'],'type':_0x1431e1[_0xb226('0x2b')][_0xb226('0x2c')]};});_0x478931[_0xb226('0x2d')]=_[_0xb226('0x2e')](_0xa30c84,_0xb226('0x28'));_0x478931[_0xb226('0x2f')]=_[_0xb226('0x30')](_0x2d3d0b[_0xb226('0x2f')]);_0x478931['filters']=_[_0xb226('0x31')](_0x478931[_0xb226('0x2d')],_0x478931['query']);_0x583f07[_0xb226('0x32')]=_[_0xb226('0x31')](_0x478931[_0xb226('0x2d')],qs[_0xb226('0x33')](_0x2d3d0b[_0xb226('0x2f')][_0xb226('0x33')]));_0x583f07[_0xb226('0x32')]=_0x583f07[_0xb226('0x32')][_0xb226('0x34')]?_0x583f07['attributes']:_0x478931[_0xb226('0x2d')];if(!_0x2d3d0b[_0xb226('0x2f')][_0xb226('0x35')]('nolimit')){_0x583f07[_0xb226('0x1c')]=qs[_0xb226('0x1c')](_0x2d3d0b[_0xb226('0x2f')]['limit']);_0x583f07[_0xb226('0x1a')]=qs[_0xb226('0x1a')](_0x2d3d0b[_0xb226('0x2f')][_0xb226('0x1a')]);}_0x583f07[_0xb226('0x36')]=qs[_0xb226('0x37')](_0x2d3d0b['query'][_0xb226('0x37')]);_0x583f07['where']=qs['filters'](_[_0xb226('0x38')](_0x2d3d0b[_0xb226('0x2f')],_0x478931['filters']),_0xa30c84);if(_0x2d3d0b['query']['filter']){_0x583f07[_0xb226('0x39')]=_[_0xb226('0x3a')](_0x583f07[_0xb226('0x39')],{'$or':[{'key':{'$like':'%'+_0x2d3d0b[_0xb226('0x2f')]['filter']+'%'}},{'value':{'$like':'%'+_0x2d3d0b[_0xb226('0x2f')][_0xb226('0x3b')]+'%'}}]});}_0x583f07=_['merge']({},_0x583f07,_0x2d3d0b[_0xb226('0x3c')]);var _0x1783d5={'where':_0x583f07['where']};return db[_0xb226('0x3d')][_0xb226('0x1d')](_0x1783d5)[_0xb226('0x23')](function(_0x137b43){_0x47d492[_0xb226('0x1d')]=_0x137b43;if(_0x2d3d0b[_0xb226('0x2f')][_0xb226('0x3e')]){_0x583f07['include']=[{'all':!![]}];}return db[_0xb226('0x3d')][_0xb226('0x3f')](_0x583f07);})['then'](function(_0x5c20bd){_0x47d492['rows']=_0x5c20bd;return _0x47d492;})[_0xb226('0x23')](respondWithFilteredResult(_0x5dae05,_0x583f07))['catch'](handleError(_0x5dae05,null));};exports['show']=function(_0x4b9978,_0x427a4a){var _0x70a8dd={'raw':!![],'where':{'id':_0x4b9978[_0xb226('0x40')]['id']}},_0x47f739={};_0x47f739[_0xb226('0x2d')]=_[_0xb226('0x30')](db['CannedAnswer'][_0xb226('0x41')]);_0x47f739[_0xb226('0x2f')]=_[_0xb226('0x30')](_0x4b9978[_0xb226('0x2f')]);_0x47f739[_0xb226('0x42')]=_[_0xb226('0x31')](_0x47f739[_0xb226('0x2d')],_0x47f739[_0xb226('0x2f')]);_0x70a8dd[_0xb226('0x32')]=_['intersection'](_0x47f739['model'],qs['fields'](_0x4b9978[_0xb226('0x2f')][_0xb226('0x33')]));_0x70a8dd[_0xb226('0x32')]=_0x70a8dd[_0xb226('0x32')][_0xb226('0x34')]?_0x70a8dd['attributes']:_0x47f739[_0xb226('0x2d')];if(_0x4b9978[_0xb226('0x2f')][_0xb226('0x3e')]){_0x70a8dd[_0xb226('0x43')]=[{'all':!![]}];}_0x70a8dd=_[_0xb226('0x3a')]({},_0x70a8dd,_0x4b9978[_0xb226('0x3c')]);return db[_0xb226('0x3d')]['find'](_0x70a8dd)[_0xb226('0x23')](handleEntityNotFound(_0x427a4a,null))[_0xb226('0x23')](respondWithResult(_0x427a4a,null))['catch'](handleError(_0x427a4a,null));};exports['update']=function(_0x193823,_0x3c12f5){if(_0x193823[_0xb226('0x44')]['id']){delete _0x193823[_0xb226('0x44')]['id'];}return db[_0xb226('0x3d')][_0xb226('0x45')]({'where':{'id':_0x193823[_0xb226('0x40')]['id']}})[_0xb226('0x23')](handleEntityNotFound(_0x3c12f5,null))['then'](saveUpdates(_0x193823['body'],null))[_0xb226('0x23')](respondWithResult(_0x3c12f5,null))[_0xb226('0x46')](handleError(_0x3c12f5,null));};exports[_0xb226('0x24')]=function(_0x3cb5b4,_0x30e106){return db[_0xb226('0x3d')]['find']({'where':{'id':_0x3cb5b4[_0xb226('0x40')]['id']}})['then'](handleEntityNotFound(_0x30e106,null))[_0xb226('0x23')](removeEntity(_0x30e106,null))[_0xb226('0x46')](handleError(_0x30e106,null));};exports['create']=function(_0x3b9acf,_0x26c293){var _0x3d31dd={'key':_0x3b9acf['body'][_0xb226('0x2c')]};if(_0x3b9acf[_0xb226('0x44')][_0xb226('0x47')]){_0x3d31dd[_0xb226('0x47')]=_0x3b9acf[_0xb226('0x44')]['MailAccountId'];}else if(_0x3b9acf['body'][_0xb226('0x48')]){_0x3d31dd[_0xb226('0x48')]=_0x3b9acf['body'][_0xb226('0x48')];}else if(_0x3b9acf[_0xb226('0x44')][_0xb226('0x49')]){_0x3d31dd[_0xb226('0x49')]=_0x3b9acf[_0xb226('0x44')]['OpenchannelAccountId'];}else if(_0x3b9acf['body'][_0xb226('0x4a')]){_0x3d31dd['ChatWebsiteId']=_0x3b9acf[_0xb226('0x44')]['ChatWebsiteId'];}return db[_0xb226('0x3d')][_0xb226('0x45')]({'where':_0x3d31dd})['then'](function(_0x23aba2){if(_0x23aba2){throw new db[(_0xb226('0x4b'))][(_0xb226('0x4c'))](_0xb226('0x4d'));}return db[_0xb226('0x3d')]['create'](_0x3b9acf[_0xb226('0x44')]);})[_0xb226('0x23')](function(_0x198a5c){var _0x1b8f35=_0x3b9acf[_0xb226('0x4e')][_0xb226('0x25')]({'plain':!![]});if(!_0x1b8f35)throw new Error(_0xb226('0x4f'));if(_0x1b8f35['role']===_0xb226('0x4e')){var _0x15e7fe=_0x198a5c[_0xb226('0x25')]({'plain':!![]});return db[_0xb226('0x50')][_0xb226('0x45')]({'where':{'name':'CannedAnswers','userProfileId':_0x1b8f35[_0xb226('0x51')]},'raw':!![]})[_0xb226('0x23')](function(_0x58e652){if(_0x58e652&&_0x58e652['autoAssociation']===0x0){return db[_0xb226('0x26')]['create']({'name':_0x15e7fe[_0xb226('0x28')],'resourceId':_0x15e7fe['id'],'type':_0x58e652[_0xb226('0x28')],'sectionId':_0x58e652['id']},{})['then'](function(){return _0x198a5c;});}else{return _0x198a5c;}})[_0xb226('0x46')](function(_0x571cac){logger[_0xb226('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x571cac);throw _0x571cac;});}return _0x198a5c;})[_0xb226('0x23')](respondWithResult(_0x26c293,0xc9))[_0xb226('0x46')](handleError(_0x26c293,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 0cf1c3b..8531449 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 _0xa80f=['define','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports'];(function(_0x126f9b,_0x499df7){var _0x5983b7=function(_0x394e5a){while(--_0x394e5a){_0x126f9b['push'](_0x126f9b['shift']());}};_0x5983b7(++_0x499df7);}(_0xa80f,0xdf));var _0xfa80=function(_0x10e956,_0xd5fcf0){_0x10e956=_0x10e956-0x0;var _0x3312a0=_0xa80f[_0x10e956];return _0x3312a0;};'use strict';var _=require(_0xfa80('0x0'));var util=require(_0xfa80('0x1'));var logger=require(_0xfa80('0x2'))(_0xfa80('0x3'));var moment=require(_0xfa80('0x4'));var BPromise=require(_0xfa80('0x5'));var rp=require(_0xfa80('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa80('0x7'));var config=require(_0xfa80('0x8'));var attributes=require(_0xfa80('0x9'));module[_0xfa80('0xa')]=function(_0x5638b8,_0x53d2d0){return _0x5638b8[_0xfa80('0xb')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfa80('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2488=['path','rimraf','./cannedAnswer.attributes','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','api','moment','bluebird','request-promise'];(function(_0x3ad7ad,_0x291a8d){var _0x225a60=function(_0xca7354){while(--_0xca7354){_0x3ad7ad['push'](_0x3ad7ad['shift']());}};_0x225a60(++_0x291a8d);}(_0x2488,0xac));var _0x8248=function(_0x3b06f1,_0x2c2f9a){_0x3b06f1=_0x3b06f1-0x0;var _0x1ab7fd=_0x2488[_0x3b06f1];return _0x1ab7fd;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8248('0x0'));var moment=require(_0x8248('0x1'));var BPromise=require(_0x8248('0x2'));var rp=require(_0x8248('0x3'));var fs=require('fs');var path=require(_0x8248('0x4'));var rimraf=require(_0x8248('0x5'));var config=require('../../config/environment');var attributes=require(_0x8248('0x6'));module['exports']=function(_0x31c9cf,_0x1eab54){return _0x31c9cf[_0x8248('0x7')]('CannedAnswer',attributes,{'tableName':_0x8248('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8248('0x9'),'collate':_0x8248('0xa')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 35a9766..8217294 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(_0x426573,_0x49f680){var _0x58f1c3=function(_0xef4b40){while(--_0xef4b40){_0x426573['push'](_0x426573['shift']());}};_0x58f1c3(++_0x49f680);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0x3c3a49,_0x5b2296){var _0x57a239=function(_0x273e46){while(--_0x273e46){_0x3c3a49['push'](_0x3c3a49['shift']());}};_0x57a239(++_0x5b2296);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 51c2475..5f3028a 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 _0x822c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','exports','multer','util','path'];(function(_0x478501,_0x16bf10){var _0x1675b9=function(_0x22fca){while(--_0x22fca){_0x478501['push'](_0x478501['shift']());}};_0x1675b9(++_0x16bf10);}(_0x822c,0xb1));var _0xc822=function(_0x5816a1,_0x41793f){_0x5816a1=_0x5816a1-0x0;var _0x1ac5c2=_0x822c[_0x5816a1];return _0x1ac5c2;};'use strict';var multer=require(_0xc822('0x0'));var util=require(_0xc822('0x1'));var path=require(_0xc822('0x2'));var timeout=require(_0xc822('0x3'));var express=require(_0xc822('0x4'));var router=express[_0xc822('0x5')]();var fs_extra=require(_0xc822('0x6'));var auth=require(_0xc822('0x7'));var interaction=require(_0xc822('0x8'));var config=require('../../config/environment');var controller=require(_0xc822('0x9'));router[_0xc822('0xa')]('/',auth[_0xc822('0xb')](),controller[_0xc822('0xc')]);router[_0xc822('0xa')]('/:id',auth[_0xc822('0xb')](),controller[_0xc822('0xd')]);router[_0xc822('0xe')]('/',auth[_0xc822('0xb')](),controller[_0xc822('0xf')]);router[_0xc822('0x10')](_0xc822('0x11'),auth['isAuthenticated'](),controller['update']);router[_0xc822('0x12')](_0xc822('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xc822('0x13')]=router; \ No newline at end of file +var _0x7b49=['../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x43e97d,_0x35c7ba){var _0x385d12=function(_0x5182b3){while(--_0x5182b3){_0x43e97d['push'](_0x43e97d['shift']());}};_0x385d12(++_0x35c7ba);}(_0x7b49,0xc7));var _0x97b4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7b49[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x97b4('0x0'));var timeout=require(_0x97b4('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x97b4('0x2'));var auth=require(_0x97b4('0x3'));var interaction=require(_0x97b4('0x4'));var config=require(_0x97b4('0x5'));var controller=require(_0x97b4('0x6'));router[_0x97b4('0x7')]('/',auth[_0x97b4('0x8')](),controller['index']);router[_0x97b4('0x7')](_0x97b4('0x9'),auth['isAuthenticated'](),controller[_0x97b4('0xa')]);router[_0x97b4('0xb')]('/',auth[_0x97b4('0x8')](),controller[_0x97b4('0xc')]);router['put'](_0x97b4('0x9'),auth[_0x97b4('0x8')](),controller[_0x97b4('0xd')]);router[_0x97b4('0xe')](_0x97b4('0x9'),auth[_0x97b4('0x8')](),controller[_0x97b4('0xf')]);module[_0x97b4('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 51f2433..5d1fb86 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 _0xc524=['1970-01-01\x2000:00:01','STRING','INTEGER','DATE'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc524,0x1bf));var _0x4c52=function(_0x16459e,_0x25d909){_0x16459e=_0x16459e-0x0;var _0x263e0d=_0xc524[_0x16459e];return _0x263e0d;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0x4c52('0x0')],'allowNull':![],'defaultValue':_0x4c52('0x1')},'clid':{'type':Sequelize[_0x4c52('0x2')]},'src':{'type':Sequelize[_0x4c52('0x2')]},'dst':{'type':Sequelize[_0x4c52('0x2')]},'dcontext':{'type':Sequelize[_0x4c52('0x2')]},'channel':{'type':Sequelize[_0x4c52('0x2')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x4c52('0x2')]},'duration':{'type':Sequelize[_0x4c52('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x4c52('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4c52('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x4c52('0x2')]},'uniqueid':{'type':Sequelize[_0x4c52('0x2')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x4c52('0x2')]},'peeraccount':{'type':Sequelize[_0x4c52('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x4c52('0x2')]}}; \ No newline at end of file +var _0x264f=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x31a503,_0x17154c){var _0x2188c6=function(_0x5e2f03){while(--_0x5e2f03){_0x31a503['push'](_0x31a503['shift']());}};_0x2188c6(++_0x17154c);}(_0x264f,0x19e));var _0xf264=function(_0x4fd143,_0x1f2dae){_0x4fd143=_0x4fd143-0x0;var _0x41eacf=_0x264f[_0x4fd143];return _0x41eacf;};'use strict';var Sequelize=require(_0xf264('0x0'));module[_0xf264('0x1')]={'calldate':{'type':Sequelize[_0xf264('0x2')],'allowNull':![],'defaultValue':_0xf264('0x3')},'clid':{'type':Sequelize[_0xf264('0x4')]},'src':{'type':Sequelize[_0xf264('0x4')]},'dst':{'type':Sequelize[_0xf264('0x4')]},'dcontext':{'type':Sequelize[_0xf264('0x4')]},'channel':{'type':Sequelize[_0xf264('0x4')]},'dstchannel':{'type':Sequelize[_0xf264('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xf264('0x4')]},'duration':{'type':Sequelize[_0xf264('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xf264('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xf264('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xf264('0x4')]},'userfield':{'type':Sequelize[_0xf264('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xf264('0x4')]},'sequence':{'type':Sequelize[_0xf264('0x4')]},'peeraccount':{'type':Sequelize[_0xf264('0x4')]},'type':{'type':Sequelize[_0xf264('0x4')]},'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 a9fe60d..21869fe 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 _0x7a59=['describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','query','filters','model','intersection','fields','attributes','length','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','Cdr','findAll','show','params','keys','include','find','create','body','catch','update'];(function(_0x56c979,_0x57d83f){var _0x14d94e=function(_0x439708){while(--_0x439708){_0x56c979['push'](_0x56c979['shift']());}};_0x14d94e(++_0x57d83f);}(_0x7a59,0x16e));var _0x97a5=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x7a59[_0x4c445a];return _0x2f611c;};'use strict';var emlformat=require(_0x97a5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x97a5('0x1'));var rp=require(_0x97a5('0x2'));var moment=require(_0x97a5('0x3'));var BPromise=require(_0x97a5('0x4'));var Mustache=require(_0x97a5('0x5'));var util=require('util');var path=require(_0x97a5('0x6'));var sox=require(_0x97a5('0x7'));var csv=require(_0x97a5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97a5('0x9'));var _=require(_0x97a5('0xa'));var squel=require(_0x97a5('0xb'));var crypto=require(_0x97a5('0xc'));var jsforce=require(_0x97a5('0xd'));var deskjs=require(_0x97a5('0xe'));var toCsv=require(_0x97a5('0x8'));var querystring=require('querystring');var Papa=require(_0x97a5('0xf'));var Redis=require(_0x97a5('0x10'));var authService=require(_0x97a5('0x11'));var qs=require(_0x97a5('0x12'));var as=require(_0x97a5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x97a5('0x14'));var utils=require(_0x97a5('0x15'));var config=require(_0x97a5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x97a5('0x17'))['db'];function respondWithStatusCode(_0x350720,_0x55305a){_0x55305a=_0x55305a||0xcc;return function(_0x4f85a0){if(_0x4f85a0){return _0x350720[_0x97a5('0x18')](_0x55305a);}return _0x350720[_0x97a5('0x19')](_0x55305a)['end']();};}function respondWithResult(_0x595437,_0x51d5e2){_0x51d5e2=_0x51d5e2||0xc8;return function(_0x5a4471){if(_0x5a4471){return _0x595437[_0x97a5('0x19')](_0x51d5e2)[_0x97a5('0x1a')](_0x5a4471);}};}function respondWithFilteredResult(_0x3603e4,_0x4d8ba7){return function(_0x1a7a62){if(_0x1a7a62){var _0x3fa986=typeof _0x4d8ba7['offset']===_0x97a5('0x1b')&&typeof _0x4d8ba7['limit']===_0x97a5('0x1b');var _0x55071b=_0x1a7a62['count'];var _0x52ce92=_0x3fa986?0x0:_0x4d8ba7[_0x97a5('0x1c')];var _0x5c5740=_0x3fa986?_0x1a7a62[_0x97a5('0x1d')]:_0x4d8ba7[_0x97a5('0x1c')]+_0x4d8ba7[_0x97a5('0x1e')];var _0x1efe8c;if(_0x5c5740>=_0x55071b){_0x5c5740=_0x55071b;_0x1efe8c=0xc8;}else{_0x1efe8c=0xce;}_0x3603e4['status'](_0x1efe8c);return _0x3603e4['set'](_0x97a5('0x1f'),_0x52ce92+'-'+_0x5c5740+'/'+_0x55071b)[_0x97a5('0x1a')](_0x1a7a62);}return null;};}function patchUpdates(_0x4e3386){return function(_0x51858b){try{jsonpatch[_0x97a5('0x20')](_0x51858b,_0x4e3386,!![]);}catch(_0x3d7dba){return BPromise[_0x97a5('0x21')](_0x3d7dba);}return _0x51858b['save']();};}function saveUpdates(_0x34fb55,_0x3a5849){return function(_0x23f4f8){if(_0x23f4f8){return _0x23f4f8['update'](_0x34fb55)[_0x97a5('0x22')](function(_0x33d6da){return _0x33d6da;});}return null;};}function removeEntity(_0x4e2074,_0x5e731e){return function(_0x469592){if(_0x469592){return _0x469592[_0x97a5('0x23')]()[_0x97a5('0x22')](function(){_0x4e2074[_0x97a5('0x19')](0xcc)[_0x97a5('0x24')]();});}};}function handleEntityNotFound(_0x302d78,_0xf7ad1e){return function(_0x4743e0){if(!_0x4743e0){_0x302d78['sendStatus'](0x194);}return _0x4743e0;};}function handleError(_0x2038dd,_0x46ee45){_0x46ee45=_0x46ee45||0x1f4;return function(_0x2ca97c){logger[_0x97a5('0x25')](_0x2ca97c[_0x97a5('0x26')]);if(_0x2ca97c[_0x97a5('0x27')]){delete _0x2ca97c['name'];}_0x2038dd[_0x97a5('0x19')](_0x46ee45)[_0x97a5('0x28')](_0x2ca97c);};}exports['index']=function(_0x274ccb,_0x52248f){var _0x48f1c1={},_0x1bdb74={},_0x2eaae4={'count':0x0,'rows':[]};var _0x5c1c67=_[_0x97a5('0x29')](db['Cdr'][_0x97a5('0x2a')],function(_0x3c5d02){return{'name':_0x3c5d02[_0x97a5('0x2b')],'type':_0x3c5d02[_0x97a5('0x2c')]['key']};});_0x1bdb74['model']=_[_0x97a5('0x29')](_0x5c1c67,_0x97a5('0x27'));_0x1bdb74[_0x97a5('0x2d')]=_['keys'](_0x274ccb[_0x97a5('0x2d')]);_0x1bdb74[_0x97a5('0x2e')]=_['intersection'](_0x1bdb74[_0x97a5('0x2f')],_0x1bdb74[_0x97a5('0x2d')]);_0x48f1c1['attributes']=_[_0x97a5('0x30')](_0x1bdb74[_0x97a5('0x2f')],qs[_0x97a5('0x31')](_0x274ccb['query'][_0x97a5('0x31')]));_0x48f1c1[_0x97a5('0x32')]=_0x48f1c1[_0x97a5('0x32')][_0x97a5('0x33')]?_0x48f1c1[_0x97a5('0x32')]:_0x1bdb74[_0x97a5('0x2f')];if(!_0x274ccb[_0x97a5('0x2d')]['hasOwnProperty'](_0x97a5('0x34'))){_0x48f1c1[_0x97a5('0x1e')]=qs[_0x97a5('0x1e')](_0x274ccb[_0x97a5('0x2d')][_0x97a5('0x1e')]);_0x48f1c1[_0x97a5('0x1c')]=qs[_0x97a5('0x1c')](_0x274ccb[_0x97a5('0x2d')][_0x97a5('0x1c')]);}_0x48f1c1[_0x97a5('0x35')]=qs[_0x97a5('0x36')](_0x274ccb[_0x97a5('0x2d')][_0x97a5('0x36')]);_0x48f1c1['where']=qs[_0x97a5('0x2e')](_[_0x97a5('0x37')](_0x274ccb[_0x97a5('0x2d')],_0x1bdb74[_0x97a5('0x2e')]),_0x5c1c67);if(_0x274ccb[_0x97a5('0x2d')]['filter']){_0x48f1c1['where']=_[_0x97a5('0x38')](_0x48f1c1[_0x97a5('0x39')],{'$or':_[_0x97a5('0x29')](_0x5c1c67,function(_0x45a548){if(_0x45a548[_0x97a5('0x2c')]!==_0x97a5('0x3a')){var _0x57333b={};_0x57333b[_0x45a548[_0x97a5('0x27')]]={'$like':'%'+_0x274ccb['query'][_0x97a5('0x3b')]+'%'};return _0x57333b;}})});}_0x48f1c1=_[_0x97a5('0x38')]({},_0x48f1c1,_0x274ccb[_0x97a5('0x3c')]);var _0x798318={'where':_0x48f1c1[_0x97a5('0x39')]};return db['Cdr'][_0x97a5('0x1d')](_0x798318)[_0x97a5('0x22')](function(_0x64505){_0x2eaae4[_0x97a5('0x1d')]=_0x64505;if(_0x274ccb[_0x97a5('0x2d')]['includeAll']){_0x48f1c1['include']=[{'all':!![]}];}return db[_0x97a5('0x3d')][_0x97a5('0x3e')](_0x48f1c1);})[_0x97a5('0x22')](function(_0x20dbc6){_0x2eaae4['rows']=_0x20dbc6;return _0x2eaae4;})[_0x97a5('0x22')](respondWithFilteredResult(_0x52248f,_0x48f1c1))['catch'](handleError(_0x52248f,null));};exports[_0x97a5('0x3f')]=function(_0x331108,_0x111e72){var _0x5baf77={'raw':!![],'where':{'id':_0x331108[_0x97a5('0x40')]['id']}},_0xefb019={};_0xefb019['model']=_[_0x97a5('0x41')](db[_0x97a5('0x3d')][_0x97a5('0x2a')]);_0xefb019[_0x97a5('0x2d')]=_[_0x97a5('0x41')](_0x331108[_0x97a5('0x2d')]);_0xefb019[_0x97a5('0x2e')]=_[_0x97a5('0x30')](_0xefb019[_0x97a5('0x2f')],_0xefb019[_0x97a5('0x2d')]);_0x5baf77[_0x97a5('0x32')]=_[_0x97a5('0x30')](_0xefb019['model'],qs[_0x97a5('0x31')](_0x331108[_0x97a5('0x2d')][_0x97a5('0x31')]));_0x5baf77['attributes']=_0x5baf77[_0x97a5('0x32')][_0x97a5('0x33')]?_0x5baf77[_0x97a5('0x32')]:_0xefb019[_0x97a5('0x2f')];if(_0x331108[_0x97a5('0x2d')]['includeAll']){_0x5baf77[_0x97a5('0x42')]=[{'all':!![]}];}_0x5baf77=_[_0x97a5('0x38')]({},_0x5baf77,_0x331108[_0x97a5('0x3c')]);return db[_0x97a5('0x3d')][_0x97a5('0x43')](_0x5baf77)['then'](handleEntityNotFound(_0x111e72,null))[_0x97a5('0x22')](respondWithResult(_0x111e72,null))['catch'](handleError(_0x111e72,null));};exports[_0x97a5('0x44')]=function(_0x235f9d,_0x330f6a){return db['Cdr'][_0x97a5('0x44')](_0x235f9d[_0x97a5('0x45')],{})[_0x97a5('0x22')](respondWithResult(_0x330f6a,0xc9))[_0x97a5('0x46')](handleError(_0x330f6a,null));};exports[_0x97a5('0x47')]=function(_0x42ced6,_0x49b215){if(_0x42ced6[_0x97a5('0x45')]['id']){delete _0x42ced6[_0x97a5('0x45')]['id'];}return db[_0x97a5('0x3d')][_0x97a5('0x43')]({'where':{'id':_0x42ced6['params']['id']}})[_0x97a5('0x22')](handleEntityNotFound(_0x49b215,null))[_0x97a5('0x22')](saveUpdates(_0x42ced6['body'],null))[_0x97a5('0x22')](respondWithResult(_0x49b215,null))[_0x97a5('0x46')](handleError(_0x49b215,null));};exports[_0x97a5('0x23')]=function(_0x56890f,_0x2a6fa0){return db[_0x97a5('0x3d')]['find']({'where':{'id':_0x56890f[_0x97a5('0x40')]['id']}})[_0x97a5('0x22')](handleEntityNotFound(_0x2a6fa0,null))[_0x97a5('0x22')](removeEntity(_0x2a6fa0,null))['catch'](handleError(_0x2a6fa0,null));};exports[_0x97a5('0x48')]=function(_0xc3c9e5,_0x7adad){return db['Cdr']['describe']()[_0x97a5('0x22')](respondWithResult(_0x7adad,null))[_0x97a5('0x46')](handleError(_0x7adad,null));}; \ No newline at end of file +var _0x25fa=['json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','Cdr','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x25fa,0x109));var _0xa25f=function(_0x2538d4,_0x217b3f){_0x2538d4=_0x2538d4-0x0;var _0x26ca9f=_0x25fa[_0x2538d4];return _0x26ca9f;};'use strict';var emlformat=require(_0xa25f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa25f('0x1'));var jsonpatch=require(_0xa25f('0x2'));var rp=require('request-promise');var moment=require(_0xa25f('0x3'));var BPromise=require(_0xa25f('0x4'));var Mustache=require(_0xa25f('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa25f('0x6'));var csv=require('to-csv');var ejs=require(_0xa25f('0x7'));var fs=require('fs');var fs_extra=require(_0xa25f('0x8'));var _=require(_0xa25f('0x9'));var squel=require(_0xa25f('0xa'));var crypto=require(_0xa25f('0xb'));var jsforce=require(_0xa25f('0xc'));var deskjs=require(_0xa25f('0xd'));var toCsv=require(_0xa25f('0xe'));var querystring=require(_0xa25f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa25f('0x10'));var authService=require(_0xa25f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa25f('0x12'));var hardwareService=require(_0xa25f('0x13'));var logger=require(_0xa25f('0x14'))(_0xa25f('0x15'));var utils=require('../../config/utils');var config=require(_0xa25f('0x16'));var licenseUtil=require(_0xa25f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e970c,_0x465e41){_0x465e41=_0x465e41||0xcc;return function(_0x50bb78){if(_0x50bb78){return _0x3e970c[_0xa25f('0x18')](_0x465e41);}return _0x3e970c[_0xa25f('0x19')](_0x465e41)[_0xa25f('0x1a')]();};}function respondWithResult(_0x4b3792,_0x199e18){_0x199e18=_0x199e18||0xc8;return function(_0x2a627f){if(_0x2a627f){return _0x4b3792[_0xa25f('0x19')](_0x199e18)[_0xa25f('0x1b')](_0x2a627f);}};}function respondWithFilteredResult(_0x465809,_0x2d2417){return function(_0x1e5836){if(_0x1e5836){var _0x1859ba=typeof _0x2d2417['offset']===_0xa25f('0x1c')&&typeof _0x2d2417[_0xa25f('0x1d')]===_0xa25f('0x1c');var _0x451a6e=_0x1e5836[_0xa25f('0x1e')];var _0x427105=_0x1859ba?0x0:_0x2d2417['offset'];var _0x292171=_0x1859ba?_0x1e5836['count']:_0x2d2417[_0xa25f('0x1f')]+_0x2d2417['limit'];var _0x559c89;if(_0x292171>=_0x451a6e){_0x292171=_0x451a6e;_0x559c89=0xc8;}else{_0x559c89=0xce;}_0x465809[_0xa25f('0x19')](_0x559c89);return _0x465809['set'](_0xa25f('0x20'),_0x427105+'-'+_0x292171+'/'+_0x451a6e)[_0xa25f('0x1b')](_0x1e5836);}return null;};}function patchUpdates(_0x2aaf3a){return function(_0x3c2665){try{jsonpatch[_0xa25f('0x21')](_0x3c2665,_0x2aaf3a,!![]);}catch(_0x504135){return BPromise[_0xa25f('0x22')](_0x504135);}return _0x3c2665[_0xa25f('0x23')]();};}function saveUpdates(_0x371716,_0x14b7f6){return function(_0x5d2803){if(_0x5d2803){return _0x5d2803[_0xa25f('0x24')](_0x371716)[_0xa25f('0x25')](function(_0x248c0c){return _0x248c0c;});}return null;};}function removeEntity(_0x3675b5,_0x4c6f4d){return function(_0x2b710f){if(_0x2b710f){return _0x2b710f[_0xa25f('0x26')]()[_0xa25f('0x25')](function(){_0x3675b5[_0xa25f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2812d7,_0x898446){return function(_0x53f011){if(!_0x53f011){_0x2812d7[_0xa25f('0x18')](0x194);}return _0x53f011;};}function handleError(_0x51dbf8,_0x2df893){_0x2df893=_0x2df893||0x1f4;return function(_0x4eb7b7){logger[_0xa25f('0x27')](_0x4eb7b7[_0xa25f('0x28')]);if(_0x4eb7b7['name']){delete _0x4eb7b7[_0xa25f('0x29')];}_0x51dbf8[_0xa25f('0x19')](_0x2df893)['send'](_0x4eb7b7);};}exports[_0xa25f('0x2a')]=function(_0x5d39c7,_0x1030c4){var _0x41a847={},_0x472114={},_0x208518={'count':0x0,'rows':[]};var _0x334629=_['map'](db[_0xa25f('0x2b')][_0xa25f('0x2c')],function(_0x119ffc){return{'name':_0x119ffc[_0xa25f('0x2d')],'type':_0x119ffc[_0xa25f('0x2e')]['key']};});_0x472114[_0xa25f('0x2f')]=_[_0xa25f('0x30')](_0x334629,_0xa25f('0x29'));_0x472114[_0xa25f('0x31')]=_[_0xa25f('0x32')](_0x5d39c7[_0xa25f('0x31')]);_0x472114[_0xa25f('0x33')]=_[_0xa25f('0x34')](_0x472114[_0xa25f('0x2f')],_0x472114['query']);_0x41a847['attributes']=_['intersection'](_0x472114[_0xa25f('0x2f')],qs[_0xa25f('0x35')](_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x35')]));_0x41a847[_0xa25f('0x36')]=_0x41a847[_0xa25f('0x36')][_0xa25f('0x37')]?_0x41a847[_0xa25f('0x36')]:_0x472114[_0xa25f('0x2f')];if(!_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x38')]('nolimit')){_0x41a847['limit']=qs[_0xa25f('0x1d')](_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x1d')]);_0x41a847['offset']=qs['offset'](_0x5d39c7['query'][_0xa25f('0x1f')]);}_0x41a847[_0xa25f('0x39')]=qs[_0xa25f('0x3a')](_0x5d39c7['query']['sort']);_0x41a847[_0xa25f('0x3b')]=qs[_0xa25f('0x33')](_['pick'](_0x5d39c7['query'],_0x472114[_0xa25f('0x33')]),_0x334629);if(_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x3c')]){_0x41a847['where']=_[_0xa25f('0x3d')](_0x41a847[_0xa25f('0x3b')],{'$or':_[_0xa25f('0x30')](_0x334629,function(_0x49556e){if(_0x49556e['type']!==_0xa25f('0x3e')){var _0x44c9c8={};_0x44c9c8[_0x49556e[_0xa25f('0x29')]]={'$like':'%'+_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x3c')]+'%'};return _0x44c9c8;}})});}_0x41a847=_[_0xa25f('0x3d')]({},_0x41a847,_0x5d39c7[_0xa25f('0x3f')]);var _0x3382f4={'where':_0x41a847['where']};return db[_0xa25f('0x2b')][_0xa25f('0x1e')](_0x3382f4)[_0xa25f('0x25')](function(_0x2e886f){_0x208518[_0xa25f('0x1e')]=_0x2e886f;if(_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x40')]){_0x41a847[_0xa25f('0x41')]=[{'all':!![]}];}return db[_0xa25f('0x2b')][_0xa25f('0x42')](_0x41a847);})[_0xa25f('0x25')](function(_0x3267a0){_0x208518[_0xa25f('0x43')]=_0x3267a0;return _0x208518;})['then'](respondWithFilteredResult(_0x1030c4,_0x41a847))[_0xa25f('0x44')](handleError(_0x1030c4,null));};exports['show']=function(_0xace015,_0x320119){var _0x36afe4={'raw':!![],'where':{'id':_0xace015[_0xa25f('0x45')]['id']}},_0x559874={};_0x559874[_0xa25f('0x2f')]=_[_0xa25f('0x32')](db[_0xa25f('0x2b')]['rawAttributes']);_0x559874[_0xa25f('0x31')]=_[_0xa25f('0x32')](_0xace015[_0xa25f('0x31')]);_0x559874[_0xa25f('0x33')]=_[_0xa25f('0x34')](_0x559874[_0xa25f('0x2f')],_0x559874['query']);_0x36afe4[_0xa25f('0x36')]=_[_0xa25f('0x34')](_0x559874['model'],qs[_0xa25f('0x35')](_0xace015[_0xa25f('0x31')][_0xa25f('0x35')]));_0x36afe4[_0xa25f('0x36')]=_0x36afe4[_0xa25f('0x36')][_0xa25f('0x37')]?_0x36afe4[_0xa25f('0x36')]:_0x559874[_0xa25f('0x2f')];if(_0xace015[_0xa25f('0x31')][_0xa25f('0x40')]){_0x36afe4[_0xa25f('0x41')]=[{'all':!![]}];}_0x36afe4=_[_0xa25f('0x3d')]({},_0x36afe4,_0xace015[_0xa25f('0x3f')]);return db['Cdr'][_0xa25f('0x46')](_0x36afe4)[_0xa25f('0x25')](handleEntityNotFound(_0x320119,null))[_0xa25f('0x25')](respondWithResult(_0x320119,null))[_0xa25f('0x44')](handleError(_0x320119,null));};exports['create']=function(_0x34717c,_0x43888b){return db[_0xa25f('0x2b')]['create'](_0x34717c[_0xa25f('0x47')],{})[_0xa25f('0x25')](respondWithResult(_0x43888b,0xc9))[_0xa25f('0x44')](handleError(_0x43888b,null));};exports[_0xa25f('0x24')]=function(_0x18c9f2,_0x3b6d34){if(_0x18c9f2[_0xa25f('0x47')]['id']){delete _0x18c9f2[_0xa25f('0x47')]['id'];}return db['Cdr'][_0xa25f('0x46')]({'where':{'id':_0x18c9f2[_0xa25f('0x45')]['id']}})[_0xa25f('0x25')](handleEntityNotFound(_0x3b6d34,null))[_0xa25f('0x25')](saveUpdates(_0x18c9f2[_0xa25f('0x47')],null))[_0xa25f('0x25')](respondWithResult(_0x3b6d34,null))[_0xa25f('0x44')](handleError(_0x3b6d34,null));};exports[_0xa25f('0x26')]=function(_0x26a096,_0xe04d67){return db[_0xa25f('0x2b')][_0xa25f('0x46')]({'where':{'id':_0x26a096[_0xa25f('0x45')]['id']}})[_0xa25f('0x25')](handleEntityNotFound(_0xe04d67,null))[_0xa25f('0x25')](removeEntity(_0xe04d67,null))[_0xa25f('0x44')](handleError(_0xe04d67,null));};exports[_0xa25f('0x48')]=function(_0x2fedba,_0x32f719){return db[_0xa25f('0x2b')][_0xa25f('0x48')]()[_0xa25f('0x25')](respondWithResult(_0x32f719,null))['catch'](handleError(_0x32f719,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index a2df47a..df5242d 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(_0x17c21b,_0x164732){var _0x3611c7=function(_0xdffcb4){while(--_0xdffcb4){_0x17c21b['push'](_0x17c21b['shift']());}};_0x3611c7(++_0x164732);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3c9b67,_0x1b021e){var _0x565d95=function(_0x6e77b1){while(--_0x6e77b1){_0x3c9b67['push'](_0x3c9b67['shift']());}};_0x565d95(++_0x1b021e);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 3814834..a7bfc44 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 _0x6ae9=['message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','error','code','Cdr,\x20%s,\x20%s'];(function(_0x35b8f8,_0x3d269e){var _0x2589ca=function(_0x51906c){while(--_0x51906c){_0x35b8f8['push'](_0x35b8f8['shift']());}};_0x2589ca(++_0x3d269e);}(_0x6ae9,0x76));var _0x96ae=function(_0x39195e,_0x520820){_0x39195e=_0x39195e-0x0;var _0x950e27=_0x6ae9[_0x39195e];return _0x950e27;};'use strict';var _=require(_0x96ae('0x0'));var util=require('util');var moment=require(_0x96ae('0x1'));var BPromise=require(_0x96ae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96ae('0x3'));var db=require(_0x96ae('0x4'))['db'];var utils=require(_0x96ae('0x5'));var logger=require(_0x96ae('0x6'))(_0x96ae('0x7'));var config=require(_0x96ae('0x8'));var jayson=require(_0x96ae('0x9'));var client=jayson[_0x96ae('0xa')][_0x96ae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x115222,_0x2a639d,_0x3a6efe){return new BPromise(function(_0x3bf0fc,_0x4adb7c){return client[_0x96ae('0xc')](_0x115222,_0x3a6efe)[_0x96ae('0xd')](function(_0x40b582){logger[_0x96ae('0xe')]('Cdr,\x20%s,\x20%s',_0x2a639d,_0x96ae('0xf'));logger['debug'](_0x96ae('0x10'),_0x2a639d,_0x96ae('0xf'),JSON['stringify'](_0x40b582));if(_0x40b582[_0x96ae('0x11')]){if(_0x40b582[_0x96ae('0x11')][_0x96ae('0x12')]===0x1f4){logger[_0x96ae('0x11')](_0x96ae('0x13'),_0x2a639d,_0x40b582[_0x96ae('0x11')]['message']);return _0x4adb7c(_0x40b582[_0x96ae('0x11')][_0x96ae('0x14')]);}logger[_0x96ae('0x11')](_0x96ae('0x13'),_0x2a639d,_0x40b582[_0x96ae('0x11')][_0x96ae('0x14')]);return _0x3bf0fc(_0x40b582['error'][_0x96ae('0x14')]);}else{logger[_0x96ae('0xe')](_0x96ae('0x13'),_0x2a639d,_0x96ae('0xf'));_0x3bf0fc(_0x40b582[_0x96ae('0x15')][_0x96ae('0x14')]);}})[_0x96ae('0x16')](function(_0x2a0f52){logger[_0x96ae('0x11')](_0x96ae('0x13'),_0x2a639d,_0x2a0f52);_0x4adb7c(_0x2a0f52);});});} \ No newline at end of file +var _0x6d04=['http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x136dab,_0x398d92){var _0x1271d7=function(_0x4ee375){while(--_0x4ee375){_0x136dab['push'](_0x136dab['shift']());}};_0x1271d7(++_0x398d92);}(_0x6d04,0x138));var _0x46d0=function(_0x214e18,_0x13189b){_0x214e18=_0x214e18-0x0;var _0x323044=_0x6d04[_0x214e18];return _0x323044;};'use strict';var _=require('lodash');var util=require(_0x46d0('0x0'));var moment=require(_0x46d0('0x1'));var BPromise=require(_0x46d0('0x2'));var rs=require(_0x46d0('0x3'));var fs=require('fs');var Redis=require(_0x46d0('0x4'));var db=require(_0x46d0('0x5'))['db'];var utils=require(_0x46d0('0x6'));var logger=require(_0x46d0('0x7'))(_0x46d0('0x8'));var config=require(_0x46d0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x46d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x71d52b,_0x3ad434,_0x2d7101){return new BPromise(function(_0x2c0cee,_0x1e0ae2){return client[_0x46d0('0xb')](_0x71d52b,_0x2d7101)[_0x46d0('0xc')](function(_0x2fd50c){logger[_0x46d0('0xd')](_0x46d0('0xe'),_0x3ad434,_0x46d0('0xf'));logger[_0x46d0('0x10')](_0x46d0('0x11'),_0x3ad434,_0x46d0('0xf'),JSON['stringify'](_0x2fd50c));if(_0x2fd50c['error']){if(_0x2fd50c['error'][_0x46d0('0x12')]===0x1f4){logger[_0x46d0('0x13')](_0x46d0('0xe'),_0x3ad434,_0x2fd50c[_0x46d0('0x13')][_0x46d0('0x14')]);return _0x1e0ae2(_0x2fd50c['error']['message']);}logger[_0x46d0('0x13')]('Cdr,\x20%s,\x20%s',_0x3ad434,_0x2fd50c[_0x46d0('0x13')]['message']);return _0x2c0cee(_0x2fd50c['error'][_0x46d0('0x14')]);}else{logger[_0x46d0('0xd')](_0x46d0('0xe'),_0x3ad434,_0x46d0('0xf'));_0x2c0cee(_0x2fd50c[_0x46d0('0x15')]['message']);}})[_0x46d0('0x16')](function(_0x173467){logger[_0x46d0('0x13')](_0x46d0('0xe'),_0x3ad434,_0x173467);_0x1e0ae2(_0x173467);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 3a2b12a..dd1dc7e 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x331e66,_0x51064f){var _0x48c43f=function(_0x2fce86){while(--_0x2fce86){_0x331e66['push'](_0x331e66['shift']());}};_0x48c43f(++_0x51064f);}(_0xb10b,0x12a));var _0xbb10=function(_0x10bd94,_0x46b509){_0x10bd94=_0x10bd94-0x0;var _0x364677=_0xb10b[_0x10bd94];return _0x364677;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index dc45e48..1542709 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 _0x6493=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x19d920,_0x4300b4){var _0x7ad1d5=function(_0x2f8317){while(--_0x2f8317){_0x19d920['push'](_0x19d920['shift']());}};_0x7ad1d5(++_0x4300b4);}(_0x6493,0x111));var _0x3649=function(_0x256e32,_0x4013bc){_0x256e32=_0x256e32-0x0;var _0x464070=_0x6493[_0x256e32];return _0x464070;};'use strict';var Sequelize=require(_0x3649('0x0'));module[_0x3649('0x1')]={'priority':{'type':Sequelize[_0x3649('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3649('0x3')],'allowNull':![],'defaultValue':_0x3649('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3649('0x3')],'defaultValue':_0x3649('0x5')}}; \ No newline at end of file +var _0x5073=['INTEGER','STRING','noop','*,*,*,*','sequelize','exports'];(function(_0xd578cb,_0x2167a3){var _0x775533=function(_0x1c340d){while(--_0x1c340d){_0xd578cb['push'](_0xd578cb['shift']());}};_0x775533(++_0x2167a3);}(_0x5073,0x70));var _0x3507=function(_0x43ed38,_0x507af1){_0x43ed38=_0x43ed38-0x0;var _0x181497=_0x5073[_0x43ed38];return _0x181497;};'use strict';var Sequelize=require(_0x3507('0x0'));module[_0x3507('0x1')]={'priority':{'type':Sequelize[_0x3507('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3507('0x3')],'allowNull':![],'defaultValue':_0x3507('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x3507('0x3')]},'interval':{'type':Sequelize[_0x3507('0x3')],'defaultValue':_0x3507('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 5560802..62aa8a2 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 _0xb240=['body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','ChatApplication','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find'];(function(_0xffc809,_0x1d0346){var _0x565c72=function(_0x564866){while(--_0x564866){_0xffc809['push'](_0xffc809['shift']());}};_0x565c72(++_0x1d0346);}(_0xb240,0x7e));var _0x0b24=function(_0x449f93,_0x49837b){_0x449f93=_0x449f93-0x0;var _0x1ad49d=_0xb240[_0x449f93];return _0x1ad49d;};'use strict';var emlformat=require(_0x0b24('0x0'));var rimraf=require(_0x0b24('0x1'));var zipdir=require(_0x0b24('0x2'));var jsonpatch=require(_0x0b24('0x3'));var rp=require(_0x0b24('0x4'));var moment=require(_0x0b24('0x5'));var BPromise=require(_0x0b24('0x6'));var Mustache=require(_0x0b24('0x7'));var util=require(_0x0b24('0x8'));var path=require('path');var sox=require(_0x0b24('0x9'));var csv=require(_0x0b24('0xa'));var ejs=require(_0x0b24('0xb'));var fs=require('fs');var fs_extra=require(_0x0b24('0xc'));var _=require(_0x0b24('0xd'));var squel=require('squel');var crypto=require(_0x0b24('0xe'));var jsforce=require(_0x0b24('0xf'));var deskjs=require(_0x0b24('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0b24('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0b24('0x12'));var as=require(_0x0b24('0x13'));var hardwareService=require(_0x0b24('0x14'));var logger=require(_0x0b24('0x15'))(_0x0b24('0x16'));var utils=require(_0x0b24('0x17'));var config=require(_0x0b24('0x18'));var licenseUtil=require(_0x0b24('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46957d,_0x2381a1){_0x2381a1=_0x2381a1||0xcc;return function(_0x4bb796){if(_0x4bb796){return _0x46957d[_0x0b24('0x1a')](_0x2381a1);}return _0x46957d[_0x0b24('0x1b')](_0x2381a1)[_0x0b24('0x1c')]();};}function respondWithResult(_0x452889,_0x5dc21f){_0x5dc21f=_0x5dc21f||0xc8;return function(_0x4b60fc){if(_0x4b60fc){return _0x452889['status'](_0x5dc21f)['json'](_0x4b60fc);}};}function respondWithFilteredResult(_0x2ea61f,_0x1aae67){return function(_0x459bb1){if(_0x459bb1){var _0x5c2ee7=typeof _0x1aae67[_0x0b24('0x1d')]===_0x0b24('0x1e')&&typeof _0x1aae67[_0x0b24('0x1f')]===_0x0b24('0x1e');var _0xa28e7e=_0x459bb1[_0x0b24('0x20')];var _0x5518a5=_0x5c2ee7?0x0:_0x1aae67[_0x0b24('0x1d')];var _0x1d619f=_0x5c2ee7?_0x459bb1['count']:_0x1aae67[_0x0b24('0x1d')]+_0x1aae67['limit'];var _0x5b395f;if(_0x1d619f>=_0xa28e7e){_0x1d619f=_0xa28e7e;_0x5b395f=0xc8;}else{_0x5b395f=0xce;}_0x2ea61f[_0x0b24('0x1b')](_0x5b395f);return _0x2ea61f[_0x0b24('0x21')](_0x0b24('0x22'),_0x5518a5+'-'+_0x1d619f+'/'+_0xa28e7e)['json'](_0x459bb1);}return null;};}function patchUpdates(_0x2fec2b){return function(_0x3c0260){try{jsonpatch['apply'](_0x3c0260,_0x2fec2b,!![]);}catch(_0x20c5d5){return BPromise[_0x0b24('0x23')](_0x20c5d5);}return _0x3c0260[_0x0b24('0x24')]();};}function saveUpdates(_0x1e1746,_0x46124d){return function(_0x3302e4){if(_0x3302e4){return _0x3302e4[_0x0b24('0x25')](_0x1e1746)[_0x0b24('0x26')](function(_0x454500){return _0x454500;});}return null;};}function removeEntity(_0x59483c,_0x55ae1c){return function(_0x1f88cf){if(_0x1f88cf){return _0x1f88cf[_0x0b24('0x27')]()[_0x0b24('0x26')](function(){_0x59483c[_0x0b24('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x294d39,_0x4ef587){return function(_0x1efbfd){if(!_0x1efbfd){_0x294d39[_0x0b24('0x1a')](0x194);}return _0x1efbfd;};}function handleError(_0x2b2053,_0x48a06a){_0x48a06a=_0x48a06a||0x1f4;return function(_0x3cb461){logger[_0x0b24('0x28')](_0x3cb461[_0x0b24('0x29')]);if(_0x3cb461[_0x0b24('0x2a')]){delete _0x3cb461[_0x0b24('0x2a')];}_0x2b2053[_0x0b24('0x1b')](_0x48a06a)[_0x0b24('0x2b')](_0x3cb461);};}exports[_0x0b24('0x2c')]=function(_0xd47f05,_0x408511){var _0xf39f24={'raw':!![],'where':{'id':_0xd47f05[_0x0b24('0x2d')]['id']}},_0x1ab5ee={};_0x1ab5ee[_0x0b24('0x2e')]=_[_0x0b24('0x2f')](db[_0x0b24('0x30')]['rawAttributes']);_0x1ab5ee[_0x0b24('0x31')]=_['keys'](_0xd47f05[_0x0b24('0x31')]);_0x1ab5ee[_0x0b24('0x32')]=_['intersection'](_0x1ab5ee[_0x0b24('0x2e')],_0x1ab5ee[_0x0b24('0x31')]);_0xf39f24[_0x0b24('0x33')]=_[_0x0b24('0x34')](_0x1ab5ee['model'],qs[_0x0b24('0x35')](_0xd47f05[_0x0b24('0x31')]['fields']));_0xf39f24[_0x0b24('0x33')]=_0xf39f24[_0x0b24('0x33')][_0x0b24('0x36')]?_0xf39f24[_0x0b24('0x33')]:_0x1ab5ee[_0x0b24('0x2e')];if(_0xd47f05[_0x0b24('0x31')][_0x0b24('0x37')]){_0xf39f24[_0x0b24('0x38')]=[{'all':!![]}];}_0xf39f24=_[_0x0b24('0x39')]({},_0xf39f24,_0xd47f05[_0x0b24('0x3a')]);return db['ChatApplication'][_0x0b24('0x3b')](_0xf39f24)[_0x0b24('0x26')](handleEntityNotFound(_0x408511,null))[_0x0b24('0x26')](respondWithResult(_0x408511,null))['catch'](handleError(_0x408511,null));};exports[_0x0b24('0x25')]=function(_0x450ea9,_0x6335ff){if(_0x450ea9[_0x0b24('0x3c')]['id']){delete _0x450ea9['body']['id'];}return db[_0x0b24('0x30')][_0x0b24('0x3b')]({'where':{'id':_0x450ea9[_0x0b24('0x2d')]['id']}})[_0x0b24('0x26')](handleEntityNotFound(_0x6335ff,null))[_0x0b24('0x26')](saveUpdates(_0x450ea9[_0x0b24('0x3c')],null))[_0x0b24('0x26')](respondWithResult(_0x6335ff,null))[_0x0b24('0x3d')](handleError(_0x6335ff,null));};exports[_0x0b24('0x27')]=function(_0x248a6e,_0x21e940){return db[_0x0b24('0x30')][_0x0b24('0x3b')]({'where':{'id':_0x248a6e[_0x0b24('0x2d')]['id']}})[_0x0b24('0x26')](handleEntityNotFound(_0x21e940,null))[_0x0b24('0x26')](removeEntity(_0x21e940,null))[_0x0b24('0x3d')](handleError(_0x21e940,null));}; \ No newline at end of file +var _0x2083=['destroy','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','attributes','fields','length','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','update','then'];(function(_0x49ab00,_0x4a6554){var _0x28acb2=function(_0x4e65c6){while(--_0x4e65c6){_0x49ab00['push'](_0x49ab00['shift']());}};_0x28acb2(++_0x4a6554);}(_0x2083,0x137));var _0x3208=function(_0x2036c4,_0x4b19d5){_0x2036c4=_0x2036c4-0x0;var _0x4ca2df=_0x2083[_0x2036c4];return _0x4ca2df;};'use strict';var emlformat=require(_0x3208('0x0'));var rimraf=require(_0x3208('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3208('0x2'));var rp=require(_0x3208('0x3'));var moment=require(_0x3208('0x4'));var BPromise=require(_0x3208('0x5'));var Mustache=require(_0x3208('0x6'));var util=require(_0x3208('0x7'));var path=require(_0x3208('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3208('0x9'));var _=require(_0x3208('0xa'));var squel=require(_0x3208('0xb'));var crypto=require(_0x3208('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3208('0xd'));var toCsv=require(_0x3208('0xe'));var querystring=require(_0x3208('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3208('0x10'));var qs=require(_0x3208('0x11'));var as=require(_0x3208('0x12'));var hardwareService=require(_0x3208('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3208('0x14'));var config=require(_0x3208('0x15'));var licenseUtil=require(_0x3208('0x16'));var db=require(_0x3208('0x17'))['db'];function respondWithStatusCode(_0x174620,_0x394883){_0x394883=_0x394883||0xcc;return function(_0xf232e5){if(_0xf232e5){return _0x174620[_0x3208('0x18')](_0x394883);}return _0x174620[_0x3208('0x19')](_0x394883)[_0x3208('0x1a')]();};}function respondWithResult(_0x3deca8,_0x14c24f){_0x14c24f=_0x14c24f||0xc8;return function(_0xa5067){if(_0xa5067){return _0x3deca8[_0x3208('0x19')](_0x14c24f)['json'](_0xa5067);}};}function respondWithFilteredResult(_0x2f1eaf,_0x153cf8){return function(_0x41cdcf){if(_0x41cdcf){var _0x1ef359=typeof _0x153cf8[_0x3208('0x1b')]==='undefined'&&typeof _0x153cf8[_0x3208('0x1c')]===_0x3208('0x1d');var _0x4c1e4d=_0x41cdcf[_0x3208('0x1e')];var _0x3590c5=_0x1ef359?0x0:_0x153cf8[_0x3208('0x1b')];var _0x28e291=_0x1ef359?_0x41cdcf[_0x3208('0x1e')]:_0x153cf8[_0x3208('0x1b')]+_0x153cf8['limit'];var _0x3d44bd;if(_0x28e291>=_0x4c1e4d){_0x28e291=_0x4c1e4d;_0x3d44bd=0xc8;}else{_0x3d44bd=0xce;}_0x2f1eaf[_0x3208('0x19')](_0x3d44bd);return _0x2f1eaf[_0x3208('0x1f')](_0x3208('0x20'),_0x3590c5+'-'+_0x28e291+'/'+_0x4c1e4d)[_0x3208('0x21')](_0x41cdcf);}return null;};}function patchUpdates(_0x46b227){return function(_0x468cca){try{jsonpatch['apply'](_0x468cca,_0x46b227,!![]);}catch(_0x42d97a){return BPromise[_0x3208('0x22')](_0x42d97a);}return _0x468cca['save']();};}function saveUpdates(_0x28d665,_0x361d1c){return function(_0x3c6e34){if(_0x3c6e34){return _0x3c6e34[_0x3208('0x23')](_0x28d665)[_0x3208('0x24')](function(_0x2ce30e){return _0x2ce30e;});}return null;};}function removeEntity(_0x4673c2,_0x523d75){return function(_0x54aa98){if(_0x54aa98){return _0x54aa98[_0x3208('0x25')]()[_0x3208('0x24')](function(){_0x4673c2[_0x3208('0x19')](0xcc)[_0x3208('0x1a')]();});}};}function handleEntityNotFound(_0x14e491,_0x21dc00){return function(_0x47a021){if(!_0x47a021){_0x14e491[_0x3208('0x18')](0x194);}return _0x47a021;};}function handleError(_0x125ae3,_0x270c69){_0x270c69=_0x270c69||0x1f4;return function(_0x10e471){logger['error'](_0x10e471[_0x3208('0x26')]);if(_0x10e471[_0x3208('0x27')]){delete _0x10e471[_0x3208('0x27')];}_0x125ae3['status'](_0x270c69)[_0x3208('0x28')](_0x10e471);};}exports[_0x3208('0x29')]=function(_0xf9e10c,_0x22b561){var _0x283193={'raw':!![],'where':{'id':_0xf9e10c[_0x3208('0x2a')]['id']}},_0x2b153f={};_0x2b153f[_0x3208('0x2b')]=_[_0x3208('0x2c')](db[_0x3208('0x2d')][_0x3208('0x2e')]);_0x2b153f[_0x3208('0x2f')]=_[_0x3208('0x2c')](_0xf9e10c[_0x3208('0x2f')]);_0x2b153f['filters']=_['intersection'](_0x2b153f[_0x3208('0x2b')],_0x2b153f[_0x3208('0x2f')]);_0x283193[_0x3208('0x30')]=_['intersection'](_0x2b153f[_0x3208('0x2b')],qs[_0x3208('0x31')](_0xf9e10c['query'][_0x3208('0x31')]));_0x283193[_0x3208('0x30')]=_0x283193[_0x3208('0x30')][_0x3208('0x32')]?_0x283193[_0x3208('0x30')]:_0x2b153f[_0x3208('0x2b')];if(_0xf9e10c[_0x3208('0x2f')][_0x3208('0x33')]){_0x283193[_0x3208('0x34')]=[{'all':!![]}];}_0x283193=_[_0x3208('0x35')]({},_0x283193,_0xf9e10c[_0x3208('0x36')]);return db[_0x3208('0x2d')][_0x3208('0x37')](_0x283193)['then'](handleEntityNotFound(_0x22b561,null))[_0x3208('0x24')](respondWithResult(_0x22b561,null))[_0x3208('0x38')](handleError(_0x22b561,null));};exports['update']=function(_0x93b8cd,_0x17f0f6){if(_0x93b8cd[_0x3208('0x39')]['id']){delete _0x93b8cd[_0x3208('0x39')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x93b8cd[_0x3208('0x2a')]['id']}})['then'](handleEntityNotFound(_0x17f0f6,null))[_0x3208('0x24')](saveUpdates(_0x93b8cd[_0x3208('0x39')],null))[_0x3208('0x24')](respondWithResult(_0x17f0f6,null))[_0x3208('0x38')](handleError(_0x17f0f6,null));};exports[_0x3208('0x25')]=function(_0x1588f4,_0x7544fc){return db[_0x3208('0x2d')][_0x3208('0x37')]({'where':{'id':_0x1588f4['params']['id']}})[_0x3208('0x24')](handleEntityNotFound(_0x7544fc,null))['then'](removeEntity(_0x7544fc,null))[_0x3208('0x38')](handleError(_0x7544fc,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 58b73eb..1e9a4bf 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 _0xb5fc=['chat_applications','utf8mb4','utf8mb4_unicode_ci','moment','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define'];(function(_0x5c4f6b,_0x2cdfce){var _0x104c4e=function(_0x31171b){while(--_0x31171b){_0x5c4f6b['push'](_0x5c4f6b['shift']());}};_0x104c4e(++_0x2cdfce);}(_0xb5fc,0x71));var _0xcb5f=function(_0x50b745,_0x21d186){_0x50b745=_0x50b745-0x0;var _0x5610b0=_0xb5fc[_0x50b745];return _0x5610b0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcb5f('0x0'));var BPromise=require('bluebird');var rp=require(_0xcb5f('0x1'));var fs=require('fs');var path=require(_0xcb5f('0x2'));var rimraf=require(_0xcb5f('0x3'));var config=require(_0xcb5f('0x4'));var attributes=require(_0xcb5f('0x5'));module[_0xcb5f('0x6')]=function(_0x11dbbd,_0x490028){return _0x11dbbd[_0xcb5f('0x7')]('ChatApplication',attributes,{'tableName':_0xcb5f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcb5f('0x9'),'collate':_0xcb5f('0xa')});}; \ No newline at end of file +var _0xae99=['bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x38d5a2,_0xb0c589){var _0xba6e14=function(_0x4ae367){while(--_0x4ae367){_0x38d5a2['push'](_0x38d5a2['shift']());}};_0xba6e14(++_0xb0c589);}(_0xae99,0x172));var _0x9ae9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xae99[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x9ae9('0x0'));var util=require(_0x9ae9('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9ae9('0x2'));var rp=require(_0x9ae9('0x3'));var fs=require('fs');var path=require(_0x9ae9('0x4'));var rimraf=require(_0x9ae9('0x5'));var config=require(_0x9ae9('0x6'));var attributes=require(_0x9ae9('0x7'));module[_0x9ae9('0x8')]=function(_0x49066e,_0x5a1ba5){return _0x49066e['define'](_0x9ae9('0x9'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9ae9('0xa'),'collate':_0x9ae9('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index f88bf66..47df089 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 _0x3cf9=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','ChatApplication,\x20%s,\x20%s','info','result'];(function(_0x42cc87,_0x563421){var _0x30d03e=function(_0x5c7f4d){while(--_0x5c7f4d){_0x42cc87['push'](_0x42cc87['shift']());}};_0x30d03e(++_0x563421);}(_0x3cf9,0xb9));var _0x93cf=function(_0x504838,_0x20bd24){_0x504838=_0x504838-0x0;var _0x2eb0a2=_0x3cf9[_0x504838];return _0x2eb0a2;};'use strict';var _=require(_0x93cf('0x0'));var util=require(_0x93cf('0x1'));var moment=require('moment');var BPromise=require(_0x93cf('0x2'));var rs=require(_0x93cf('0x3'));var fs=require('fs');var Redis=require(_0x93cf('0x4'));var db=require(_0x93cf('0x5'))['db'];var utils=require(_0x93cf('0x6'));var logger=require(_0x93cf('0x7'))(_0x93cf('0x8'));var config=require('../../config/environment');var jayson=require(_0x93cf('0x9'));var client=jayson[_0x93cf('0xa')][_0x93cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ee7ca,_0x432b5c,_0x5729b4){return new BPromise(function(_0x37cfaa,_0x3c3757){return client[_0x93cf('0xc')](_0x4ee7ca,_0x5729b4)['then'](function(_0x3ae37a){logger['info']('ChatApplication,\x20%s,\x20%s',_0x432b5c,_0x93cf('0xd'));logger[_0x93cf('0xe')](_0x93cf('0xf'),_0x432b5c,'request\x20sent',JSON['stringify'](_0x3ae37a));if(_0x3ae37a[_0x93cf('0x10')]){if(_0x3ae37a['error'][_0x93cf('0x11')]===0x1f4){logger[_0x93cf('0x10')]('ChatApplication,\x20%s,\x20%s',_0x432b5c,_0x3ae37a[_0x93cf('0x10')][_0x93cf('0x12')]);return _0x3c3757(_0x3ae37a[_0x93cf('0x10')][_0x93cf('0x12')]);}logger[_0x93cf('0x10')](_0x93cf('0x13'),_0x432b5c,_0x3ae37a[_0x93cf('0x10')][_0x93cf('0x12')]);return _0x37cfaa(_0x3ae37a[_0x93cf('0x10')][_0x93cf('0x12')]);}else{logger[_0x93cf('0x14')](_0x93cf('0x13'),_0x432b5c,_0x93cf('0xd'));_0x37cfaa(_0x3ae37a[_0x93cf('0x15')]['message']);}})[_0x93cf('0x16')](function(_0x3b9a5d){logger[_0x93cf('0x10')](_0x93cf('0x13'),_0x432b5c,_0x3b9a5d);_0x3c3757(_0x3b9a5d);});});} \ No newline at end of file +var _0x1145=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','ChatApplication,\x20%s,\x20%s','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x43444b,_0x8cf95b){var _0x392fe5=function(_0x7a1a82){while(--_0x7a1a82){_0x43444b['push'](_0x43444b['shift']());}};_0x392fe5(++_0x8cf95b);}(_0x1145,0xb7));var _0x5114=function(_0x509079,_0x5df8e4){_0x509079=_0x509079-0x0;var _0x3d2112=_0x1145[_0x509079];return _0x3d2112;};'use strict';var _=require(_0x5114('0x0'));var util=require('util');var moment=require(_0x5114('0x1'));var BPromise=require(_0x5114('0x2'));var rs=require(_0x5114('0x3'));var fs=require('fs');var Redis=require(_0x5114('0x4'));var db=require(_0x5114('0x5'))['db'];var utils=require(_0x5114('0x6'));var logger=require(_0x5114('0x7'))(_0x5114('0x8'));var config=require('../../config/environment');var jayson=require(_0x5114('0x9'));var client=jayson[_0x5114('0xa')][_0x5114('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a5b2f,_0x2ed2ba,_0x52f7f2){return new BPromise(function(_0x52d11d,_0x1d0670){return client['request'](_0x3a5b2f,_0x52f7f2)['then'](function(_0x24c868){logger[_0x5114('0xc')](_0x5114('0xd'),_0x2ed2ba,'request\x20sent');logger['debug'](_0x5114('0xe'),_0x2ed2ba,_0x5114('0xf'),JSON[_0x5114('0x10')](_0x24c868));if(_0x24c868[_0x5114('0x11')]){if(_0x24c868[_0x5114('0x11')][_0x5114('0x12')]===0x1f4){logger[_0x5114('0x11')]('ChatApplication,\x20%s,\x20%s',_0x2ed2ba,_0x24c868[_0x5114('0x11')]['message']);return _0x1d0670(_0x24c868[_0x5114('0x11')][_0x5114('0x13')]);}logger[_0x5114('0x11')](_0x5114('0xd'),_0x2ed2ba,_0x24c868[_0x5114('0x11')][_0x5114('0x13')]);return _0x52d11d(_0x24c868[_0x5114('0x11')][_0x5114('0x13')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x2ed2ba,_0x5114('0xf'));_0x52d11d(_0x24c868['result'][_0x5114('0x13')]);}})[_0x5114('0x14')](function(_0x47e4da){logger['error']('ChatApplication,\x20%s,\x20%s',_0x2ed2ba,_0x47e4da);_0x1d0670(_0x47e4da);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 7512d2b..5ed4777 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 _0x5ab4=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','delete'];(function(_0x375bfd,_0x7c9e97){var _0x5ae9af=function(_0x1b8e61){while(--_0x1b8e61){_0x375bfd['push'](_0x375bfd['shift']());}};_0x5ae9af(++_0x7c9e97);}(_0x5ab4,0x79));var _0x45ab=function(_0x31c212,_0x23883f){_0x31c212=_0x31c212-0x0;var _0x12a69c=_0x5ab4[_0x31c212];return _0x12a69c;};'use strict';var multer=require(_0x45ab('0x0'));var util=require(_0x45ab('0x1'));var path=require(_0x45ab('0x2'));var timeout=require(_0x45ab('0x3'));var express=require('express');var router=express[_0x45ab('0x4')]();var fs_extra=require(_0x45ab('0x5'));var auth=require(_0x45ab('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x45ab('0x7'));router[_0x45ab('0x8')](_0x45ab('0x9'),auth[_0x45ab('0xa')](),controller[_0x45ab('0xb')]);router[_0x45ab('0xc')](_0x45ab('0x9'),auth[_0x45ab('0xa')](),controller['update']);router[_0x45ab('0xd')](_0x45ab('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x45ab('0xe')]=router; \ No newline at end of file +var _0xbae6=['update','delete','destroy','exports','util','path','express','Router','fs-extra','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put'];(function(_0x4287cc,_0x56dffe){var _0x2979ac=function(_0x10cdca){while(--_0x10cdca){_0x4287cc['push'](_0x4287cc['shift']());}};_0x2979ac(++_0x56dffe);}(_0xbae6,0xe4));var _0x6bae=function(_0x222be1,_0x317d8a){_0x222be1=_0x222be1-0x0;var _0x2b1d5d=_0xbae6[_0x222be1];return _0x2b1d5d;};'use strict';var multer=require('multer');var util=require(_0x6bae('0x0'));var path=require(_0x6bae('0x1'));var timeout=require('connect-timeout');var express=require(_0x6bae('0x2'));var router=express[_0x6bae('0x3')]();var fs_extra=require(_0x6bae('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6bae('0x5'));var controller=require(_0x6bae('0x6'));router[_0x6bae('0x7')](_0x6bae('0x8'),auth[_0x6bae('0x9')](),controller[_0x6bae('0xa')]);router[_0x6bae('0xb')]('/:id',auth[_0x6bae('0x9')](),controller[_0x6bae('0xc')]);router[_0x6bae('0xd')](_0x6bae('0x8'),auth['isAuthenticated'](),controller[_0x6bae('0xe')]);module[_0x6bae('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 1e078a5..82117b6 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 _0x6657=['STRING','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6657,0x17f));var _0x7665=function(_0x536696,_0x5e2859){_0x536696=_0x536696-0x0;var _0x2c3bea=_0x6657[_0x536696];return _0x2c3bea;};'use strict';var Sequelize=require(_0x7665('0x0'));module['exports']={'name':{'type':Sequelize[_0x7665('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7665('0x1')]},'write':{'type':Sequelize[_0x7665('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xab00=['BOOLEAN','sequelize','exports','STRING'];(function(_0x5dad79,_0x1432bd){var _0x5551d6=function(_0x37df52){while(--_0x37df52){_0x5dad79['push'](_0x5dad79['shift']());}};_0x5551d6(++_0x1432bd);}(_0xab00,0x1b9));var _0x0ab0=function(_0x3a9566,_0x1fb2d5){_0x3a9566=_0x3a9566-0x0;var _0x14c055=_0xab00[_0x3a9566];return _0x14c055;};'use strict';var Sequelize=require(_0x0ab0('0x0'));module[_0x0ab0('0x1')]={'name':{'type':Sequelize[_0x0ab0('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x0ab0('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index ef1df9a..150ae77 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 _0x063c=['create','body','find','params','destroy','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','ChatGroupId','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','ChatGroup','catch','show','length'];(function(_0x2ef207,_0x3c1578){var _0x2c3da9=function(_0x2d51a4){while(--_0x2d51a4){_0x2ef207['push'](_0x2ef207['shift']());}};_0x2c3da9(++_0x3c1578);}(_0x063c,0x1e5));var _0xc063=function(_0x4cc6d6,_0xf3974c){_0x4cc6d6=_0x4cc6d6-0x0;var _0x2b2342=_0x063c[_0x4cc6d6];return _0x2b2342;};'use strict';var emlformat=require(_0xc063('0x0'));var rimraf=require(_0xc063('0x1'));var zipdir=require(_0xc063('0x2'));var jsonpatch=require(_0xc063('0x3'));var rp=require('request-promise');var moment=require(_0xc063('0x4'));var BPromise=require(_0xc063('0x5'));var Mustache=require('mustache');var util=require(_0xc063('0x6'));var path=require(_0xc063('0x7'));var sox=require(_0xc063('0x8'));var csv=require(_0xc063('0x9'));var ejs=require(_0xc063('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc063('0xb'));var toCsv=require(_0xc063('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc063('0xc'));var qs=require(_0xc063('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc063('0xe'));var logger=require(_0xc063('0xf'))(_0xc063('0x10'));var utils=require(_0xc063('0x11'));var config=require(_0xc063('0x12'));var licenseUtil=require(_0xc063('0x13'));var db=require(_0xc063('0x14'))['db'];config[_0xc063('0x15')]=_[_0xc063('0x16')](config['redis'],{'host':_0xc063('0x17'),'port':0x18eb});var socket=require(_0xc063('0x18'))(new Redis(config[_0xc063('0x15')]));require(_0xc063('0x19'))[_0xc063('0x1a')](socket);function respondWithStatusCode(_0xcddc54,_0x55c0bc){_0x55c0bc=_0x55c0bc||0xcc;return function(_0x3e995b){if(_0x3e995b){return _0xcddc54[_0xc063('0x1b')](_0x55c0bc);}return _0xcddc54['status'](_0x55c0bc)[_0xc063('0x1c')]();};}function respondWithResult(_0xb0752a,_0x129ccc){_0x129ccc=_0x129ccc||0xc8;return function(_0x2b19b0){if(_0x2b19b0){return _0xb0752a['status'](_0x129ccc)['json'](_0x2b19b0);}};}function respondWithFilteredResult(_0x320d19,_0x4d0a47){return function(_0x1f147e){if(_0x1f147e){var _0x4c3810=typeof _0x4d0a47[_0xc063('0x1d')]===_0xc063('0x1e')&&typeof _0x4d0a47[_0xc063('0x1f')]===_0xc063('0x1e');var _0x14d9c7=_0x1f147e[_0xc063('0x20')];var _0x53b107=_0x4c3810?0x0:_0x4d0a47[_0xc063('0x1d')];var _0x4fc921=_0x4c3810?_0x1f147e['count']:_0x4d0a47[_0xc063('0x1d')]+_0x4d0a47[_0xc063('0x1f')];var _0x175553;if(_0x4fc921>=_0x14d9c7){_0x4fc921=_0x14d9c7;_0x175553=0xc8;}else{_0x175553=0xce;}_0x320d19[_0xc063('0x21')](_0x175553);return _0x320d19[_0xc063('0x22')](_0xc063('0x23'),_0x53b107+'-'+_0x4fc921+'/'+_0x14d9c7)[_0xc063('0x24')](_0x1f147e);}return null;};}function patchUpdates(_0x2aacef){return function(_0x5c9613){try{jsonpatch['apply'](_0x5c9613,_0x2aacef,!![]);}catch(_0x28973a){return BPromise[_0xc063('0x25')](_0x28973a);}return _0x5c9613[_0xc063('0x26')]();};}function saveUpdates(_0xdad7a2,_0x5dcba5){return function(_0x261d56){if(_0x261d56){return _0x261d56[_0xc063('0x27')](_0xdad7a2)[_0xc063('0x28')](function(_0x426a42){return _0x426a42;});}return null;};}function removeEntity(_0x339b0b,_0xb64b58){return function(_0x534431){if(_0x534431){return _0x534431['destroy']()[_0xc063('0x28')](function(){_0x339b0b['status'](0xcc)[_0xc063('0x1c')]();});}};}function handleEntityNotFound(_0x5796b3,_0x2918eb){return function(_0x5cfe6a){if(!_0x5cfe6a){_0x5796b3[_0xc063('0x1b')](0x194);}return _0x5cfe6a;};}function handleError(_0x3d9da,_0x168fff){_0x168fff=_0x168fff||0x1f4;return function(_0x497d6a){logger[_0xc063('0x29')](_0x497d6a[_0xc063('0x2a')]);if(_0x497d6a[_0xc063('0x2b')]){delete _0x497d6a['name'];}_0x3d9da[_0xc063('0x21')](_0x168fff)[_0xc063('0x2c')](_0x497d6a);};}exports[_0xc063('0x2d')]=function(_0x3a8f90,_0x333de1){var _0x1edb26={},_0x34f05c={},_0x4c7308={'count':0x0,'rows':[]};var _0x526104=_[_0xc063('0x2e')](db['ChatGroup'][_0xc063('0x2f')],function(_0x16259c){return{'name':_0x16259c[_0xc063('0x30')],'type':_0x16259c[_0xc063('0x31')]['key']};});_0x34f05c['model']=_[_0xc063('0x2e')](_0x526104,_0xc063('0x2b'));_0x34f05c[_0xc063('0x32')]=_[_0xc063('0x33')](_0x3a8f90[_0xc063('0x32')]);_0x34f05c[_0xc063('0x34')]=_[_0xc063('0x35')](_0x34f05c[_0xc063('0x36')],_0x34f05c[_0xc063('0x32')]);_0x1edb26[_0xc063('0x37')]=_[_0xc063('0x35')](_0x34f05c[_0xc063('0x36')],qs[_0xc063('0x38')](_0x3a8f90[_0xc063('0x32')][_0xc063('0x38')]));_0x1edb26[_0xc063('0x37')]=_0x1edb26[_0xc063('0x37')]['length']?_0x1edb26[_0xc063('0x37')]:_0x34f05c[_0xc063('0x36')];if(!_0x3a8f90[_0xc063('0x32')][_0xc063('0x39')](_0xc063('0x3a'))){_0x1edb26[_0xc063('0x1f')]=qs[_0xc063('0x1f')](_0x3a8f90[_0xc063('0x32')][_0xc063('0x1f')]);_0x1edb26[_0xc063('0x1d')]=qs[_0xc063('0x1d')](_0x3a8f90[_0xc063('0x32')][_0xc063('0x1d')]);}_0x1edb26[_0xc063('0x3b')]=qs['sort'](_0x3a8f90[_0xc063('0x32')][_0xc063('0x3c')]);_0x1edb26[_0xc063('0x3d')]=qs['filters'](_[_0xc063('0x3e')](_0x3a8f90[_0xc063('0x32')],_0x34f05c[_0xc063('0x34')]),_0x526104);if(_0x3a8f90[_0xc063('0x32')]['filter']){_0x1edb26[_0xc063('0x3d')]=_['merge'](_0x1edb26['where'],{'$or':_[_0xc063('0x2e')](_0x526104,function(_0x2d756a){if(_0x2d756a[_0xc063('0x31')]!==_0xc063('0x3f')){var _0x4d3c12={};_0x4d3c12[_0x2d756a['name']]={'$like':'%'+_0x3a8f90['query'][_0xc063('0x40')]+'%'};return _0x4d3c12;}})});}_0x1edb26=_[_0xc063('0x41')]({},_0x1edb26,_0x3a8f90[_0xc063('0x42')]);var _0x331905={'where':_0x1edb26['where']};return db['ChatGroup']['count'](_0x331905)[_0xc063('0x28')](function(_0x4f781d){_0x4c7308[_0xc063('0x20')]=_0x4f781d;if(_0x3a8f90[_0xc063('0x32')][_0xc063('0x43')]){_0x1edb26[_0xc063('0x44')]=[{'all':!![]}];}return db[_0xc063('0x45')]['findAll'](_0x1edb26);})[_0xc063('0x28')](function(_0x2a8619){_0x4c7308['rows']=_0x2a8619;return _0x4c7308;})[_0xc063('0x28')](respondWithFilteredResult(_0x333de1,_0x1edb26))[_0xc063('0x46')](handleError(_0x333de1,null));};exports[_0xc063('0x47')]=function(_0x566252,_0x7b90a5){var _0x225347={'raw':!![],'where':{'id':_0x566252['params']['id']}},_0x121bda={};_0x121bda['model']=_[_0xc063('0x33')](db[_0xc063('0x45')][_0xc063('0x2f')]);_0x121bda[_0xc063('0x32')]=_[_0xc063('0x33')](_0x566252[_0xc063('0x32')]);_0x121bda[_0xc063('0x34')]=_[_0xc063('0x35')](_0x121bda[_0xc063('0x36')],_0x121bda[_0xc063('0x32')]);_0x225347[_0xc063('0x37')]=_['intersection'](_0x121bda[_0xc063('0x36')],qs[_0xc063('0x38')](_0x566252[_0xc063('0x32')][_0xc063('0x38')]));_0x225347[_0xc063('0x37')]=_0x225347[_0xc063('0x37')][_0xc063('0x48')]?_0x225347[_0xc063('0x37')]:_0x121bda[_0xc063('0x36')];if(_0x566252['query'][_0xc063('0x43')]){_0x225347[_0xc063('0x44')]=[{'all':!![]}];}_0x225347=_['merge']({},_0x225347,_0x566252[_0xc063('0x42')]);return db['ChatGroup']['find'](_0x225347)[_0xc063('0x28')](handleEntityNotFound(_0x7b90a5,null))[_0xc063('0x28')](respondWithResult(_0x7b90a5,null))[_0xc063('0x46')](handleError(_0x7b90a5,null));};exports[_0xc063('0x49')]=function(_0x5cd135,_0x24af35){return db[_0xc063('0x45')][_0xc063('0x49')](_0x5cd135[_0xc063('0x4a')],{})[_0xc063('0x28')](respondWithResult(_0x24af35,0xc9))[_0xc063('0x46')](handleError(_0x24af35,null));};exports[_0xc063('0x27')]=function(_0x120228,_0x4c0f54){if(_0x120228['body']['id']){delete _0x120228['body']['id'];}return db[_0xc063('0x45')][_0xc063('0x4b')]({'where':{'id':_0x120228[_0xc063('0x4c')]['id']}})[_0xc063('0x28')](handleEntityNotFound(_0x4c0f54,null))[_0xc063('0x28')](saveUpdates(_0x120228['body'],null))[_0xc063('0x28')](respondWithResult(_0x4c0f54,null))[_0xc063('0x46')](handleError(_0x4c0f54,null));};exports[_0xc063('0x4d')]=function(_0x15278b,_0x48aae1){return db['ChatGroup']['find']({'where':{'id':_0x15278b[_0xc063('0x4c')]['id']}})[_0xc063('0x28')](handleEntityNotFound(_0x48aae1,null))[_0xc063('0x28')](removeEntity(_0x48aae1,null))['catch'](handleError(_0x48aae1,null));};exports['describe']=function(_0x396a2c,_0x32f05a){return db['ChatGroup'][_0xc063('0x4e')]()['then'](respondWithResult(_0x32f05a,null))[_0xc063('0x46')](handleError(_0x32f05a,null));};exports[_0xc063('0x4f')]=function(_0x7c0e82,_0x42626d,_0x4f3c10){return db[_0xc063('0x50')][_0xc063('0x20')]({'where':{'ChatGroupId':_0x7c0e82['params']['id'],'ToId':_0x7c0e82['user']['id'],'read':![]}})['then'](function(_0x167570){return{'id':_[_0xc063('0x51')](_0x7c0e82[_0xc063('0x4c')]['id']),'count':_0x167570};})[_0xc063('0x28')](respondWithResult(_0x42626d,null))['catch'](handleError(_0x42626d,null));};exports[_0xc063('0x52')]=function(_0x2c71ab,_0x2852ee,_0x5b392c){return db['ChatGroup'][_0xc063('0x4b')]({'where':{'id':_0x2c71ab[_0xc063('0x4c')]['id']}})[_0xc063('0x28')](handleEntityNotFound(_0x2852ee,null))[_0xc063('0x28')](function(_0x789ec8){if(_0x789ec8){return _0x789ec8[_0xc063('0x52')](_0x2c71ab[_0xc063('0x4a')][_0xc063('0x53')],_[_0xc063('0x54')](_0x2c71ab[_0xc063('0x4a')],[_0xc063('0x53'),'id'])||{});}})['then'](respondWithResult(_0x2852ee,null))[_0xc063('0x46')](handleError(_0x2852ee,null));};exports[_0xc063('0x55')]=function(_0x35c458,_0x50dd29,_0x1140f3){var _0x4c93bd={};var _0x48eb48={};var _0x1e341e;var _0x4b7470;return db[_0xc063('0x45')][_0xc063('0x56')]({'where':{'id':_0x35c458[_0xc063('0x4c')]['id']}})['then'](handleEntityNotFound(_0x50dd29,null))[_0xc063('0x28')](function(_0x3031a7){if(_0x3031a7){_0x1e341e=_0x3031a7;_0x48eb48[_0xc063('0x36')]=_['keys'](db[_0xc063('0x57')]['rawAttributes']);_0x48eb48[_0xc063('0x32')]=_[_0xc063('0x33')](_0x35c458[_0xc063('0x32')]);_0x48eb48['filters']=_[_0xc063('0x35')](_0x48eb48[_0xc063('0x36')],_0x48eb48[_0xc063('0x32')]);_0x4c93bd['attributes']=_['intersection'](_0x48eb48['model'],qs['fields'](_0x35c458['query'][_0xc063('0x38')]));_0x4c93bd['attributes']=_0x4c93bd[_0xc063('0x37')][_0xc063('0x48')]?_0x4c93bd['attributes']:_0x48eb48['model'];_0x4c93bd[_0xc063('0x3b')]=qs[_0xc063('0x3c')](_0x35c458[_0xc063('0x32')][_0xc063('0x3c')]);_0x4c93bd[_0xc063('0x3d')]=qs[_0xc063('0x34')](_['pick'](_0x35c458[_0xc063('0x32')],_0x48eb48[_0xc063('0x34')]));if(_0x35c458[_0xc063('0x32')]['filter']){_0x4c93bd[_0xc063('0x3d')]=_[_0xc063('0x41')](_0x4c93bd[_0xc063('0x3d')],{'$or':_[_0xc063('0x2e')](_0x4c93bd[_0xc063('0x37')],function(_0x22ffe0){var _0x42e244={};_0x42e244[_0x22ffe0]={'$like':'%'+_0x35c458[_0xc063('0x32')][_0xc063('0x40')]+'%'};return _0x42e244;})});}_0x4c93bd=_[_0xc063('0x41')]({},_0x4c93bd,_0x35c458[_0xc063('0x42')]);return _0x1e341e[_0xc063('0x55')](_0x4c93bd);}})['then'](function(_0x451497){if(_0x451497){_0x4b7470=_0x451497['length'];if(!_0x35c458['query'][_0xc063('0x39')](_0xc063('0x3a'))){_0x4c93bd[_0xc063('0x1f')]=qs['limit'](_0x35c458[_0xc063('0x32')][_0xc063('0x1f')]);_0x4c93bd[_0xc063('0x1d')]=qs['offset'](_0x35c458[_0xc063('0x32')][_0xc063('0x1d')]);}return _0x1e341e['getMembers'](_0x4c93bd);}})['then'](function(_0xd2ff78){if(_0xd2ff78){return _0xd2ff78?{'count':_0x4b7470,'rows':_0xd2ff78}:null;}})[_0xc063('0x28')](respondWithResult(_0x50dd29,null))[_0xc063('0x46')](handleError(_0x50dd29,null));};exports[_0xc063('0x58')]=function(_0xeb6b2a,_0x951f7,_0x5b9cff){return db[_0xc063('0x45')][_0xc063('0x4b')]({'where':{'id':_0xeb6b2a[_0xc063('0x4c')]['id']}})['then'](handleEntityNotFound(_0x951f7,null))[_0xc063('0x28')](function(_0x464abd){if(_0x464abd){return _0x464abd[_0xc063('0x58')](_0xeb6b2a['query'][_0xc063('0x53')]);}})['then'](respondWithStatusCode(_0x951f7,null))[_0xc063('0x46')](handleError(_0x951f7,null));};exports['addMessage']=function(_0xa3f57c,_0x2be3ed,_0x16a04b){if(_0xa3f57c[_0xc063('0x4a')]['id']){delete _0xa3f57c[_0xc063('0x4a')]['id'];}return db[_0xc063('0x45')][_0xc063('0x4b')]({'where':{'id':_0xa3f57c[_0xc063('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2be3ed,null))[_0xc063('0x28')](function(_0x4fdb02){if(_0x4fdb02){_0xa3f57c[_0xc063('0x4a')][_0xc063('0x59')]=_0x4fdb02['id'];return db[_0xc063('0x50')][_0xc063('0x49')](_0xa3f57c['body']);}})['then'](respondWithResult(_0x2be3ed,null))[_0xc063('0x46')](handleError(_0x2be3ed,null));};exports[_0xc063('0x5a')]=function(_0x37d8d1,_0x522273,_0x1ae03c){var _0x381662={};var _0x215491={};var _0x3acfbc;var _0x431f81;return db[_0xc063('0x45')][_0xc063('0x56')]({'where':{'id':_0x37d8d1['params']['id']}})[_0xc063('0x28')](handleEntityNotFound(_0x522273,null))[_0xc063('0x28')](function(_0x4c363c){if(_0x4c363c){_0x3acfbc=_0x4c363c;_0x215491['model']=_['keys'](db['ChatInternalMessage']['rawAttributes']);_0x215491[_0xc063('0x32')]=_[_0xc063('0x33')](_0x37d8d1[_0xc063('0x32')]);_0x215491[_0xc063('0x34')]=_[_0xc063('0x35')](_0x215491[_0xc063('0x36')],_0x215491[_0xc063('0x32')]);_0x381662[_0xc063('0x37')]=_[_0xc063('0x35')](_0x215491[_0xc063('0x36')],qs['fields'](_0x37d8d1[_0xc063('0x32')][_0xc063('0x38')]));_0x381662[_0xc063('0x37')]=_0x381662['attributes'][_0xc063('0x48')]?_0x381662[_0xc063('0x37')]:_0x215491[_0xc063('0x36')];_0x381662[_0xc063('0x3b')]=qs['sort'](_0x37d8d1[_0xc063('0x32')][_0xc063('0x3c')]);_0x381662[_0xc063('0x3d')]=qs[_0xc063('0x34')](_[_0xc063('0x3e')](_0x37d8d1['query'],_0x215491[_0xc063('0x34')]));if(_0x37d8d1['query'][_0xc063('0x40')]){_0x381662[_0xc063('0x3d')]=_['merge'](_0x381662[_0xc063('0x3d')],{'$or':_['map'](_0x381662[_0xc063('0x37')],function(_0x29d5b1){var _0x300459={};_0x300459[_0x29d5b1]={'$like':'%'+_0x37d8d1[_0xc063('0x32')][_0xc063('0x40')]+'%'};return _0x300459;})});}if(_0x37d8d1[_0xc063('0x32')][_0xc063('0x5b')]){var _0x5d34e9=_0x37d8d1['query'][_0xc063('0x5b')]['split'](',');var _0x4d6dd3={};_0x4d6dd3[_0x5d34e9[0x0]]={'$gte':moment(_0x5d34e9[0x1])['format'](_0xc063('0x5c'))};_0x381662[_0xc063('0x3d')]=_[_0xc063('0x41')](_0x381662[_0xc063('0x3d')],_0x4d6dd3);}_0x381662=_[_0xc063('0x41')]({},_0x381662,_0x37d8d1[_0xc063('0x42')]);return _0x3acfbc[_0xc063('0x5a')](_0x381662);}})[_0xc063('0x28')](function(_0x2a76fe){if(_0x2a76fe){_0x431f81=_0x2a76fe['length'];if(!_0x37d8d1[_0xc063('0x32')][_0xc063('0x39')](_0xc063('0x3a'))){_0x381662[_0xc063('0x1f')]=qs['limit'](_0x37d8d1[_0xc063('0x32')][_0xc063('0x1f')]);_0x381662['offset']=qs[_0xc063('0x1d')](_0x37d8d1[_0xc063('0x32')]['offset']);}return _0x3acfbc[_0xc063('0x5a')](_0x381662);}})[_0xc063('0x28')](function(_0x4988f3){if(_0x4988f3){return _0x4988f3?{'count':_0x431f81,'rows':_0x4988f3}:null;}})[_0xc063('0x28')](respondWithResult(_0x522273,null))[_0xc063('0x46')](handleError(_0x522273,null));}; \ No newline at end of file +var _0x0ab2=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','then','destroy','error','stack','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','name','includeAll','include','findAll','catch','params','keys','options','create','body','update','find','describe','toInteger','addMembers','ids','omit','getMembers','findOne','User','pick','nolimit','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','zip-dir','fast-json-patch','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3b62d5,_0x4fa047){var _0x17f072=function(_0x3fc89b){while(--_0x3fc89b){_0x3b62d5['push'](_0x3b62d5['shift']());}};_0x17f072(++_0x4fa047);}(_0x0ab2,0x172));var _0x20ab=function(_0x176ce9,_0x99961b){_0x176ce9=_0x176ce9-0x0;var _0x5e8203=_0x0ab2[_0x176ce9];return _0x5e8203;};'use strict';var emlformat=require(_0x20ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x20ab('0x1'));var jsonpatch=require(_0x20ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x20ab('0x3'));var util=require('util');var path=require(_0x20ab('0x4'));var sox=require('sox');var csv=require(_0x20ab('0x5'));var ejs=require(_0x20ab('0x6'));var fs=require('fs');var fs_extra=require(_0x20ab('0x7'));var _=require(_0x20ab('0x8'));var squel=require(_0x20ab('0x9'));var crypto=require(_0x20ab('0xa'));var jsforce=require(_0x20ab('0xb'));var deskjs=require(_0x20ab('0xc'));var toCsv=require('to-csv');var querystring=require(_0x20ab('0xd'));var Papa=require(_0x20ab('0xe'));var Redis=require(_0x20ab('0xf'));var authService=require(_0x20ab('0x10'));var qs=require(_0x20ab('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20ab('0x12'));var logger=require(_0x20ab('0x13'))(_0x20ab('0x14'));var utils=require(_0x20ab('0x15'));var config=require(_0x20ab('0x16'));var licenseUtil=require(_0x20ab('0x17'));var db=require(_0x20ab('0x18'))['db'];config[_0x20ab('0x19')]=_['defaults'](config[_0x20ab('0x19')],{'host':_0x20ab('0x1a'),'port':0x18eb});var socket=require(_0x20ab('0x1b'))(new Redis(config[_0x20ab('0x19')]));require(_0x20ab('0x1c'))[_0x20ab('0x1d')](socket);function respondWithStatusCode(_0x15efb7,_0x3866f8){_0x3866f8=_0x3866f8||0xcc;return function(_0x48c558){if(_0x48c558){return _0x15efb7[_0x20ab('0x1e')](_0x3866f8);}return _0x15efb7[_0x20ab('0x1f')](_0x3866f8)[_0x20ab('0x20')]();};}function respondWithResult(_0x40df52,_0x456afd){_0x456afd=_0x456afd||0xc8;return function(_0x3245e5){if(_0x3245e5){return _0x40df52[_0x20ab('0x1f')](_0x456afd)[_0x20ab('0x21')](_0x3245e5);}};}function respondWithFilteredResult(_0x5e5586,_0x3a221b){return function(_0x1881a0){if(_0x1881a0){var _0x39b036=typeof _0x3a221b[_0x20ab('0x22')]===_0x20ab('0x23')&&typeof _0x3a221b['limit']==='undefined';var _0x4f2ed3=_0x1881a0['count'];var _0x4ca819=_0x39b036?0x0:_0x3a221b[_0x20ab('0x22')];var _0x20b5c2=_0x39b036?_0x1881a0[_0x20ab('0x24')]:_0x3a221b[_0x20ab('0x22')]+_0x3a221b[_0x20ab('0x25')];var _0x69fba9;if(_0x20b5c2>=_0x4f2ed3){_0x20b5c2=_0x4f2ed3;_0x69fba9=0xc8;}else{_0x69fba9=0xce;}_0x5e5586[_0x20ab('0x1f')](_0x69fba9);return _0x5e5586[_0x20ab('0x26')]('Content-Range',_0x4ca819+'-'+_0x20b5c2+'/'+_0x4f2ed3)[_0x20ab('0x21')](_0x1881a0);}return null;};}function patchUpdates(_0x2e75b4){return function(_0x47d4e1){try{jsonpatch[_0x20ab('0x27')](_0x47d4e1,_0x2e75b4,!![]);}catch(_0x57222d){return BPromise['reject'](_0x57222d);}return _0x47d4e1[_0x20ab('0x28')]();};}function saveUpdates(_0x819d5c,_0x585586){return function(_0x4dc459){if(_0x4dc459){return _0x4dc459['update'](_0x819d5c)[_0x20ab('0x29')](function(_0x3dfa23){return _0x3dfa23;});}return null;};}function removeEntity(_0x1eebe9,_0x2f4449){return function(_0x5ccc7a){if(_0x5ccc7a){return _0x5ccc7a[_0x20ab('0x2a')]()[_0x20ab('0x29')](function(){_0x1eebe9[_0x20ab('0x1f')](0xcc)[_0x20ab('0x20')]();});}};}function handleEntityNotFound(_0x531dd3,_0x31fa4f){return function(_0x3af20a){if(!_0x3af20a){_0x531dd3[_0x20ab('0x1e')](0x194);}return _0x3af20a;};}function handleError(_0xa27cf6,_0x2f20b0){_0x2f20b0=_0x2f20b0||0x1f4;return function(_0x292272){logger[_0x20ab('0x2b')](_0x292272[_0x20ab('0x2c')]);if(_0x292272['name']){delete _0x292272['name'];}_0xa27cf6[_0x20ab('0x1f')](_0x2f20b0)['send'](_0x292272);};}exports[_0x20ab('0x2d')]=function(_0x154187,_0x49c996){var _0xa2b6e9={},_0x277f92={},_0x14c429={'count':0x0,'rows':[]};var _0x503801=_[_0x20ab('0x2e')](db[_0x20ab('0x2f')][_0x20ab('0x30')],function(_0x1d7082){return{'name':_0x1d7082[_0x20ab('0x31')],'type':_0x1d7082[_0x20ab('0x32')][_0x20ab('0x33')]};});_0x277f92[_0x20ab('0x34')]=_[_0x20ab('0x2e')](_0x503801,'name');_0x277f92[_0x20ab('0x35')]=_['keys'](_0x154187[_0x20ab('0x35')]);_0x277f92['filters']=_['intersection'](_0x277f92[_0x20ab('0x34')],_0x277f92[_0x20ab('0x35')]);_0xa2b6e9[_0x20ab('0x36')]=_[_0x20ab('0x37')](_0x277f92[_0x20ab('0x34')],qs[_0x20ab('0x38')](_0x154187['query'][_0x20ab('0x38')]));_0xa2b6e9[_0x20ab('0x36')]=_0xa2b6e9['attributes'][_0x20ab('0x39')]?_0xa2b6e9[_0x20ab('0x36')]:_0x277f92[_0x20ab('0x34')];if(!_0x154187['query'][_0x20ab('0x3a')]('nolimit')){_0xa2b6e9[_0x20ab('0x25')]=qs[_0x20ab('0x25')](_0x154187['query']['limit']);_0xa2b6e9[_0x20ab('0x22')]=qs[_0x20ab('0x22')](_0x154187['query']['offset']);}_0xa2b6e9[_0x20ab('0x3b')]=qs[_0x20ab('0x3c')](_0x154187[_0x20ab('0x35')][_0x20ab('0x3c')]);_0xa2b6e9['where']=qs[_0x20ab('0x3d')](_['pick'](_0x154187[_0x20ab('0x35')],_0x277f92['filters']),_0x503801);if(_0x154187[_0x20ab('0x35')][_0x20ab('0x3e')]){_0xa2b6e9[_0x20ab('0x3f')]=_[_0x20ab('0x40')](_0xa2b6e9[_0x20ab('0x3f')],{'$or':_['map'](_0x503801,function(_0x2ce300){if(_0x2ce300[_0x20ab('0x32')]!==_0x20ab('0x41')){var _0x3f36fb={};_0x3f36fb[_0x2ce300[_0x20ab('0x42')]]={'$like':'%'+_0x154187[_0x20ab('0x35')][_0x20ab('0x3e')]+'%'};return _0x3f36fb;}})});}_0xa2b6e9=_['merge']({},_0xa2b6e9,_0x154187['options']);var _0x4c87d2={'where':_0xa2b6e9['where']};return db[_0x20ab('0x2f')]['count'](_0x4c87d2)[_0x20ab('0x29')](function(_0x3a7ab3){_0x14c429[_0x20ab('0x24')]=_0x3a7ab3;if(_0x154187[_0x20ab('0x35')][_0x20ab('0x43')]){_0xa2b6e9[_0x20ab('0x44')]=[{'all':!![]}];}return db['ChatGroup'][_0x20ab('0x45')](_0xa2b6e9);})[_0x20ab('0x29')](function(_0x321b5b){_0x14c429['rows']=_0x321b5b;return _0x14c429;})['then'](respondWithFilteredResult(_0x49c996,_0xa2b6e9))[_0x20ab('0x46')](handleError(_0x49c996,null));};exports['show']=function(_0x1c1e6c,_0x4f38c2){var _0x2647a8={'raw':!![],'where':{'id':_0x1c1e6c[_0x20ab('0x47')]['id']}},_0x2bd3a6={};_0x2bd3a6[_0x20ab('0x34')]=_['keys'](db['ChatGroup'][_0x20ab('0x30')]);_0x2bd3a6['query']=_[_0x20ab('0x48')](_0x1c1e6c[_0x20ab('0x35')]);_0x2bd3a6[_0x20ab('0x3d')]=_[_0x20ab('0x37')](_0x2bd3a6[_0x20ab('0x34')],_0x2bd3a6[_0x20ab('0x35')]);_0x2647a8[_0x20ab('0x36')]=_['intersection'](_0x2bd3a6['model'],qs[_0x20ab('0x38')](_0x1c1e6c[_0x20ab('0x35')][_0x20ab('0x38')]));_0x2647a8[_0x20ab('0x36')]=_0x2647a8['attributes'][_0x20ab('0x39')]?_0x2647a8['attributes']:_0x2bd3a6['model'];if(_0x1c1e6c[_0x20ab('0x35')][_0x20ab('0x43')]){_0x2647a8['include']=[{'all':!![]}];}_0x2647a8=_[_0x20ab('0x40')]({},_0x2647a8,_0x1c1e6c[_0x20ab('0x49')]);return db['ChatGroup']['find'](_0x2647a8)[_0x20ab('0x29')](handleEntityNotFound(_0x4f38c2,null))['then'](respondWithResult(_0x4f38c2,null))[_0x20ab('0x46')](handleError(_0x4f38c2,null));};exports[_0x20ab('0x4a')]=function(_0x557557,_0x24254f){return db[_0x20ab('0x2f')][_0x20ab('0x4a')](_0x557557[_0x20ab('0x4b')],{})['then'](respondWithResult(_0x24254f,0xc9))['catch'](handleError(_0x24254f,null));};exports[_0x20ab('0x4c')]=function(_0x5384ea,_0x125c67){if(_0x5384ea[_0x20ab('0x4b')]['id']){delete _0x5384ea[_0x20ab('0x4b')]['id'];}return db[_0x20ab('0x2f')][_0x20ab('0x4d')]({'where':{'id':_0x5384ea[_0x20ab('0x47')]['id']}})[_0x20ab('0x29')](handleEntityNotFound(_0x125c67,null))[_0x20ab('0x29')](saveUpdates(_0x5384ea[_0x20ab('0x4b')],null))[_0x20ab('0x29')](respondWithResult(_0x125c67,null))[_0x20ab('0x46')](handleError(_0x125c67,null));};exports[_0x20ab('0x2a')]=function(_0x18953f,_0x2a6b78){return db['ChatGroup']['find']({'where':{'id':_0x18953f[_0x20ab('0x47')]['id']}})[_0x20ab('0x29')](handleEntityNotFound(_0x2a6b78,null))['then'](removeEntity(_0x2a6b78,null))[_0x20ab('0x46')](handleError(_0x2a6b78,null));};exports[_0x20ab('0x4e')]=function(_0x371a78,_0x1da55b){return db[_0x20ab('0x2f')]['describe']()[_0x20ab('0x29')](respondWithResult(_0x1da55b,null))[_0x20ab('0x46')](handleError(_0x1da55b,null));};exports['getUnread']=function(_0x2ba77f,_0x49ee74,_0x437b77){return db['ChatInternalMessage'][_0x20ab('0x24')]({'where':{'ChatGroupId':_0x2ba77f[_0x20ab('0x47')]['id'],'ToId':_0x2ba77f['user']['id'],'read':![]}})[_0x20ab('0x29')](function(_0x5e9c0d){return{'id':_[_0x20ab('0x4f')](_0x2ba77f[_0x20ab('0x47')]['id']),'count':_0x5e9c0d};})[_0x20ab('0x29')](respondWithResult(_0x49ee74,null))[_0x20ab('0x46')](handleError(_0x49ee74,null));};exports['addMembers']=function(_0x25c85e,_0x40ba29,_0x2bb91c){return db[_0x20ab('0x2f')]['find']({'where':{'id':_0x25c85e[_0x20ab('0x47')]['id']}})[_0x20ab('0x29')](handleEntityNotFound(_0x40ba29,null))[_0x20ab('0x29')](function(_0x33ff97){if(_0x33ff97){return _0x33ff97[_0x20ab('0x50')](_0x25c85e[_0x20ab('0x4b')][_0x20ab('0x51')],_[_0x20ab('0x52')](_0x25c85e[_0x20ab('0x4b')],[_0x20ab('0x51'),'id'])||{});}})['then'](respondWithResult(_0x40ba29,null))['catch'](handleError(_0x40ba29,null));};exports[_0x20ab('0x53')]=function(_0x5b59b7,_0x20974a,_0x2f198b){var _0x428df3={};var _0x458c49={};var _0x2df496;var _0x2ae071;return db[_0x20ab('0x2f')][_0x20ab('0x54')]({'where':{'id':_0x5b59b7[_0x20ab('0x47')]['id']}})[_0x20ab('0x29')](handleEntityNotFound(_0x20974a,null))[_0x20ab('0x29')](function(_0x37df08){if(_0x37df08){_0x2df496=_0x37df08;_0x458c49['model']=_[_0x20ab('0x48')](db[_0x20ab('0x55')]['rawAttributes']);_0x458c49[_0x20ab('0x35')]=_[_0x20ab('0x48')](_0x5b59b7[_0x20ab('0x35')]);_0x458c49[_0x20ab('0x3d')]=_[_0x20ab('0x37')](_0x458c49['model'],_0x458c49[_0x20ab('0x35')]);_0x428df3['attributes']=_[_0x20ab('0x37')](_0x458c49[_0x20ab('0x34')],qs[_0x20ab('0x38')](_0x5b59b7['query'][_0x20ab('0x38')]));_0x428df3[_0x20ab('0x36')]=_0x428df3[_0x20ab('0x36')][_0x20ab('0x39')]?_0x428df3[_0x20ab('0x36')]:_0x458c49[_0x20ab('0x34')];_0x428df3[_0x20ab('0x3b')]=qs['sort'](_0x5b59b7[_0x20ab('0x35')][_0x20ab('0x3c')]);_0x428df3['where']=qs[_0x20ab('0x3d')](_[_0x20ab('0x56')](_0x5b59b7['query'],_0x458c49[_0x20ab('0x3d')]));if(_0x5b59b7['query'][_0x20ab('0x3e')]){_0x428df3['where']=_['merge'](_0x428df3[_0x20ab('0x3f')],{'$or':_[_0x20ab('0x2e')](_0x428df3[_0x20ab('0x36')],function(_0x5b1515){var _0x5717e3={};_0x5717e3[_0x5b1515]={'$like':'%'+_0x5b59b7['query']['filter']+'%'};return _0x5717e3;})});}_0x428df3=_[_0x20ab('0x40')]({},_0x428df3,_0x5b59b7['options']);return _0x2df496[_0x20ab('0x53')](_0x428df3);}})['then'](function(_0x4710c3){if(_0x4710c3){_0x2ae071=_0x4710c3['length'];if(!_0x5b59b7[_0x20ab('0x35')]['hasOwnProperty'](_0x20ab('0x57'))){_0x428df3[_0x20ab('0x25')]=qs[_0x20ab('0x25')](_0x5b59b7[_0x20ab('0x35')][_0x20ab('0x25')]);_0x428df3['offset']=qs[_0x20ab('0x22')](_0x5b59b7[_0x20ab('0x35')][_0x20ab('0x22')]);}return _0x2df496[_0x20ab('0x53')](_0x428df3);}})[_0x20ab('0x29')](function(_0x123a0b){if(_0x123a0b){return _0x123a0b?{'count':_0x2ae071,'rows':_0x123a0b}:null;}})[_0x20ab('0x29')](respondWithResult(_0x20974a,null))[_0x20ab('0x46')](handleError(_0x20974a,null));};exports[_0x20ab('0x58')]=function(_0x45f3ec,_0x3d864d,_0xe7e1b1){return db[_0x20ab('0x2f')]['find']({'where':{'id':_0x45f3ec[_0x20ab('0x47')]['id']}})[_0x20ab('0x29')](handleEntityNotFound(_0x3d864d,null))[_0x20ab('0x29')](function(_0x26bd0d){if(_0x26bd0d){return _0x26bd0d[_0x20ab('0x58')](_0x45f3ec[_0x20ab('0x35')][_0x20ab('0x51')]);}})[_0x20ab('0x29')](respondWithStatusCode(_0x3d864d,null))[_0x20ab('0x46')](handleError(_0x3d864d,null));};exports[_0x20ab('0x59')]=function(_0xda1b13,_0x226c4f,_0x4deff1){if(_0xda1b13[_0x20ab('0x4b')]['id']){delete _0xda1b13['body']['id'];}return db[_0x20ab('0x2f')][_0x20ab('0x4d')]({'where':{'id':_0xda1b13['params']['id']}})[_0x20ab('0x29')](handleEntityNotFound(_0x226c4f,null))['then'](function(_0x5ea258){if(_0x5ea258){_0xda1b13[_0x20ab('0x4b')][_0x20ab('0x5a')]=_0x5ea258['id'];return db['ChatInternalMessage'][_0x20ab('0x4a')](_0xda1b13[_0x20ab('0x4b')]);}})['then'](respondWithResult(_0x226c4f,null))[_0x20ab('0x46')](handleError(_0x226c4f,null));};exports['getMessages']=function(_0x353d01,_0x187516,_0x64bdcc){var _0x5d9c19={};var _0x17caba={};var _0x247ccf;var _0x5957c1;return db[_0x20ab('0x2f')][_0x20ab('0x54')]({'where':{'id':_0x353d01['params']['id']}})[_0x20ab('0x29')](handleEntityNotFound(_0x187516,null))[_0x20ab('0x29')](function(_0x4e5057){if(_0x4e5057){_0x247ccf=_0x4e5057;_0x17caba[_0x20ab('0x34')]=_[_0x20ab('0x48')](db[_0x20ab('0x5b')]['rawAttributes']);_0x17caba[_0x20ab('0x35')]=_[_0x20ab('0x48')](_0x353d01['query']);_0x17caba[_0x20ab('0x3d')]=_[_0x20ab('0x37')](_0x17caba[_0x20ab('0x34')],_0x17caba[_0x20ab('0x35')]);_0x5d9c19['attributes']=_[_0x20ab('0x37')](_0x17caba[_0x20ab('0x34')],qs['fields'](_0x353d01[_0x20ab('0x35')][_0x20ab('0x38')]));_0x5d9c19[_0x20ab('0x36')]=_0x5d9c19[_0x20ab('0x36')][_0x20ab('0x39')]?_0x5d9c19[_0x20ab('0x36')]:_0x17caba[_0x20ab('0x34')];_0x5d9c19[_0x20ab('0x3b')]=qs[_0x20ab('0x3c')](_0x353d01[_0x20ab('0x35')]['sort']);_0x5d9c19[_0x20ab('0x3f')]=qs['filters'](_[_0x20ab('0x56')](_0x353d01[_0x20ab('0x35')],_0x17caba[_0x20ab('0x3d')]));if(_0x353d01[_0x20ab('0x35')][_0x20ab('0x3e')]){_0x5d9c19[_0x20ab('0x3f')]=_[_0x20ab('0x40')](_0x5d9c19[_0x20ab('0x3f')],{'$or':_[_0x20ab('0x2e')](_0x5d9c19['attributes'],function(_0x236d62){var _0x3ca6bc={};_0x3ca6bc[_0x236d62]={'$like':'%'+_0x353d01[_0x20ab('0x35')][_0x20ab('0x3e')]+'%'};return _0x3ca6bc;})});}if(_0x353d01[_0x20ab('0x35')][_0x20ab('0x5c')]){var _0x434eda=_0x353d01['query'][_0x20ab('0x5c')]['split'](',');var _0x18103e={};_0x18103e[_0x434eda[0x0]]={'$gte':moment(_0x434eda[0x1])[_0x20ab('0x5d')](_0x20ab('0x5e'))};_0x5d9c19[_0x20ab('0x3f')]=_[_0x20ab('0x40')](_0x5d9c19[_0x20ab('0x3f')],_0x18103e);}_0x5d9c19=_[_0x20ab('0x40')]({},_0x5d9c19,_0x353d01[_0x20ab('0x49')]);return _0x247ccf[_0x20ab('0x5f')](_0x5d9c19);}})[_0x20ab('0x29')](function(_0xb2f8c4){if(_0xb2f8c4){_0x5957c1=_0xb2f8c4['length'];if(!_0x353d01[_0x20ab('0x35')][_0x20ab('0x3a')]('nolimit')){_0x5d9c19['limit']=qs[_0x20ab('0x25')](_0x353d01[_0x20ab('0x35')][_0x20ab('0x25')]);_0x5d9c19[_0x20ab('0x22')]=qs[_0x20ab('0x22')](_0x353d01[_0x20ab('0x35')][_0x20ab('0x22')]);}return _0x247ccf[_0x20ab('0x5f')](_0x5d9c19);}})[_0x20ab('0x29')](function(_0x448755){if(_0x448755){return _0x448755?{'count':_0x5957c1,'rows':_0x448755}:null;}})[_0x20ab('0x29')](respondWithResult(_0x187516,null))['catch'](handleError(_0x187516,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 38ddca7..901b110 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 _0x0e26=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatGroup','save'];(function(_0x3f2fea,_0x3c4ea8){var _0x69a4d5=function(_0x223109){while(--_0x223109){_0x3f2fea['push'](_0x3f2fea['shift']());}};_0x69a4d5(++_0x3c4ea8);}(_0x0e26,0x19b));var _0x60e2=function(_0x539957,_0x107c59){_0x539957=_0x539957-0x0;var _0x417ecb=_0x0e26[_0x539957];return _0x417ecb;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x60e2('0x0'))['db'][_0x60e2('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x60e2('0x2'),'afterUpdate':_0x60e2('0x3'),'afterDestroy':_0x60e2('0x4')};function emitEvent(_0xa4456c){return function(_0x431bba,_0x2c63c0,_0x432250){ChatGroupEvents['emit'](_0xa4456c+':'+_0x431bba['id'],_0x431bba);ChatGroupEvents[_0x60e2('0x5')](_0xa4456c,_0x431bba);_0x432250(null);};}for(var e in events){if(events[_0x60e2('0x6')](e)){var event=events[e];ChatGroup[_0x60e2('0x7')](e,emitEvent(event));}}module[_0x60e2('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0xffaf=['exports','ChatGroup','setMaxListeners','remove','emit','hook'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xffaf,0x1c3));var _0xfffa=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0xffaf[_0x295314];return _0x584b0c;};'use strict';var EventEmitter=require('events');var ChatGroup=require('../../mysqldb')['db'][_0xfffa('0x0')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xfffa('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfffa('0x2')};function emitEvent(_0x2ab24d){return function(_0x46fadf,_0x576b08,_0x5dc4be){ChatGroupEvents[_0xfffa('0x3')](_0x2ab24d+':'+_0x46fadf['id'],_0x46fadf);ChatGroupEvents['emit'](_0x2ab24d,_0x46fadf);_0x5dc4be(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xfffa('0x4')](e,emitEvent(event));}}module[_0xfffa('0x5')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 09333d9..8fe502d 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 _0xb798=['moment','bluebird','request-promise','path','../../config/environment','exports','define','chat_groups','lodash','../../config/logger','api'];(function(_0x42cf36,_0x39aeac){var _0x2d75ba=function(_0x4ad868){while(--_0x4ad868){_0x42cf36['push'](_0x42cf36['shift']());}};_0x2d75ba(++_0x39aeac);}(_0xb798,0x1c0));var _0x8b79=function(_0x3a7910,_0x32e161){_0x3a7910=_0x3a7910-0x0;var _0x256e6e=_0xb798[_0x3a7910];return _0x256e6e;};'use strict';var _=require(_0x8b79('0x0'));var util=require('util');var logger=require(_0x8b79('0x1'))(_0x8b79('0x2'));var moment=require(_0x8b79('0x3'));var BPromise=require(_0x8b79('0x4'));var rp=require(_0x8b79('0x5'));var fs=require('fs');var path=require(_0x8b79('0x6'));var rimraf=require('rimraf');var config=require(_0x8b79('0x7'));var attributes=require('./chatGroup.attributes');module[_0x8b79('0x8')]=function(_0x55440d,_0x30c404){return _0x55440d[_0x8b79('0x9')]('ChatGroup',attributes,{'tableName':_0x8b79('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x988a=['lodash','util','../../config/logger','api','request-promise','path','rimraf','./chatGroup.attributes','exports','define','chat_groups'];(function(_0x5a89ea,_0x436388){var _0x21193d=function(_0x1a9118){while(--_0x1a9118){_0x5a89ea['push'](_0x5a89ea['shift']());}};_0x21193d(++_0x436388);}(_0x988a,0x1ef));var _0xa988=function(_0x4d800c,_0x256169){_0x4d800c=_0x4d800c-0x0;var _0x4cd0fd=_0x988a[_0x4d800c];return _0x4cd0fd;};'use strict';var _=require(_0xa988('0x0'));var util=require(_0xa988('0x1'));var logger=require(_0xa988('0x2'))(_0xa988('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa988('0x4'));var fs=require('fs');var path=require(_0xa988('0x5'));var rimraf=require(_0xa988('0x6'));var config=require('../../config/environment');var attributes=require(_0xa988('0x7'));module[_0xa988('0x8')]=function(_0x3ed90d,_0x16bf4a){return _0x3ed90d[_0xa988('0x9')]('ChatGroup',attributes,{'tableName':_0xa988('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index e53dfd9..6a92ca8 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 _0x3edc=['info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x3edc,0x1ae));var _0xc3ed=function(_0x3f2a44,_0xf70f4b){_0x3f2a44=_0x3f2a44-0x0;var _0x50d3cb=_0x3edc[_0x3f2a44];return _0x50d3cb;};'use strict';var _=require(_0xc3ed('0x0'));var util=require(_0xc3ed('0x1'));var moment=require(_0xc3ed('0x2'));var BPromise=require(_0xc3ed('0x3'));var rs=require(_0xc3ed('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc3ed('0x6'))(_0xc3ed('0x7'));var config=require(_0xc3ed('0x8'));var jayson=require(_0xc3ed('0x9'));var client=jayson[_0xc3ed('0xa')]['http']({'port':0x232a});config[_0xc3ed('0xb')]=_[_0xc3ed('0xc')](config[_0xc3ed('0xb')],{'host':_0xc3ed('0xd'),'port':0x18eb});var socket=require(_0xc3ed('0xe'))(new Redis(config[_0xc3ed('0xb')]));require('./chatGroup.socket')[_0xc3ed('0xf')](socket);function respondWithRpcPromise(_0x32e102,_0x37c1fc,_0x51c2c4){return new BPromise(function(_0x57e75f,_0x5517a3){return client[_0xc3ed('0x10')](_0x32e102,_0x51c2c4)[_0xc3ed('0x11')](function(_0x1eb94b){logger[_0xc3ed('0x12')](_0xc3ed('0x13'),_0x37c1fc,_0xc3ed('0x14'));logger[_0xc3ed('0x15')](_0xc3ed('0x16'),_0x37c1fc,_0xc3ed('0x14'),JSON[_0xc3ed('0x17')](_0x1eb94b));if(_0x1eb94b['error']){if(_0x1eb94b[_0xc3ed('0x18')][_0xc3ed('0x19')]===0x1f4){logger[_0xc3ed('0x18')](_0xc3ed('0x13'),_0x37c1fc,_0x1eb94b['error']['message']);return _0x5517a3(_0x1eb94b['error']['message']);}logger[_0xc3ed('0x18')](_0xc3ed('0x13'),_0x37c1fc,_0x1eb94b['error'][_0xc3ed('0x1a')]);return _0x57e75f(_0x1eb94b[_0xc3ed('0x18')]['message']);}else{logger['info'](_0xc3ed('0x13'),_0x37c1fc,_0xc3ed('0x14'));_0x57e75f(_0x1eb94b['result'][_0xc3ed('0x1a')]);}})[_0xc3ed('0x1b')](function(_0x1db6e2){logger[_0xc3ed('0x18')](_0xc3ed('0x13'),_0x37c1fc,_0x1db6e2);_0x5517a3(_0x1db6e2);});});} \ No newline at end of file +var _0x946e=['request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatGroup.socket','request','then','ChatGroup,\x20%s,\x20%s'];(function(_0x6fc282,_0xed83a0){var _0x11d36e=function(_0x28c536){while(--_0x28c536){_0x6fc282['push'](_0x6fc282['shift']());}};_0x11d36e(++_0xed83a0);}(_0x946e,0x1d0));var _0xe946=function(_0x138e27,_0x1eaf5f){_0x138e27=_0x138e27-0x0;var _0x3e1de7=_0x946e[_0x138e27];return _0x3e1de7;};'use strict';var _=require(_0xe946('0x0'));var util=require('util');var moment=require(_0xe946('0x1'));var BPromise=require('bluebird');var rs=require(_0xe946('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe946('0x3'));var logger=require(_0xe946('0x4'))(_0xe946('0x5'));var config=require(_0xe946('0x6'));var jayson=require(_0xe946('0x7'));var client=jayson['client'][_0xe946('0x8')]({'port':0x232a});config[_0xe946('0x9')]=_[_0xe946('0xa')](config['redis'],{'host':_0xe946('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe946('0x9')]));require(_0xe946('0xc'))['register'](socket);function respondWithRpcPromise(_0x47e7a1,_0x49e9fc,_0x286140){return new BPromise(function(_0x49b412,_0x5679f6){return client[_0xe946('0xd')](_0x47e7a1,_0x286140)[_0xe946('0xe')](function(_0x56d82e){logger['info'](_0xe946('0xf'),_0x49e9fc,_0xe946('0x10'));logger['debug'](_0xe946('0x11'),_0x49e9fc,_0xe946('0x10'),JSON[_0xe946('0x12')](_0x56d82e));if(_0x56d82e[_0xe946('0x13')]){if(_0x56d82e[_0xe946('0x13')][_0xe946('0x14')]===0x1f4){logger[_0xe946('0x13')]('ChatGroup,\x20%s,\x20%s',_0x49e9fc,_0x56d82e['error'][_0xe946('0x15')]);return _0x5679f6(_0x56d82e[_0xe946('0x13')][_0xe946('0x15')]);}logger['error'](_0xe946('0xf'),_0x49e9fc,_0x56d82e[_0xe946('0x13')][_0xe946('0x15')]);return _0x49b412(_0x56d82e['error'][_0xe946('0x15')]);}else{logger[_0xe946('0x16')](_0xe946('0xf'),_0x49e9fc,'request\x20sent');_0x49b412(_0x56d82e[_0xe946('0x17')][_0xe946('0x15')]);}})['catch'](function(_0x2b2b66){logger['error'](_0xe946('0xf'),_0x49e9fc,_0x2b2b66);_0x5679f6(_0x2b2b66);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 19ab4c6..6293613 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 _0xa3bf=['chatGroup:','./chatGroup.events','remove','update','emit','removeListener','register','length'];(function(_0x211bf0,_0x1abfac){var _0x3b6cf2=function(_0xc6ccaf){while(--_0xc6ccaf){_0x211bf0['push'](_0x211bf0['shift']());}};_0x3b6cf2(++_0x1abfac);}(_0xa3bf,0xd1));var _0xfa3b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xa3bf[_0x167cc1];return _0x10bc4b;};'use strict';var ChatGroupEvents=require(_0xfa3b('0x0'));var events=['save',_0xfa3b('0x1'),_0xfa3b('0x2')];function createListener(_0x1749c7,_0x20e268){return function(_0x1a3cd3){_0x20e268[_0xfa3b('0x3')](_0x1749c7,_0x1a3cd3);};}function removeListener(_0x22403e,_0x2d3c5a){return function(){ChatGroupEvents[_0xfa3b('0x4')](_0x22403e,_0x2d3c5a);};}exports[_0xfa3b('0x5')]=function(_0xef54ff){for(var _0x4fccf7=0x0,_0x4de812=events[_0xfa3b('0x6')];_0x4fccf7<_0x4de812;_0x4fccf7++){var _0x860979=events[_0x4fccf7];var _0x145d25=createListener(_0xfa3b('0x7')+_0x860979,_0xef54ff);ChatGroupEvents['on'](_0x860979,_0x145d25);}}; \ No newline at end of file +var _0xa396=['register','length','./chatGroup.events','save','remove'];(function(_0x549278,_0x450754){var _0x1ea9a1=function(_0x2e559d){while(--_0x2e559d){_0x549278['push'](_0x549278['shift']());}};_0x1ea9a1(++_0x450754);}(_0xa396,0x1ba));var _0x6a39=function(_0xf8f29f,_0x487c16){_0xf8f29f=_0xf8f29f-0x0;var _0x5e99a6=_0xa396[_0xf8f29f];return _0x5e99a6;};'use strict';var ChatGroupEvents=require(_0x6a39('0x0'));var events=[_0x6a39('0x1'),_0x6a39('0x2'),'update'];function createListener(_0x2c0fb2,_0x54aa37){return function(_0x9fc397){_0x54aa37['emit'](_0x2c0fb2,_0x9fc397);};}function removeListener(_0x47cbf3,_0xdda14b){return function(){ChatGroupEvents['removeListener'](_0x47cbf3,_0xdda14b);};}exports[_0x6a39('0x3')]=function(_0x4729ac){for(var _0x19979c=0x0,_0x35ea39=events[_0x6a39('0x4')];_0x19979c<_0x35ea39;_0x19979c++){var _0x56fc41=events[_0x19979c];var _0xbe97fc=createListener('chatGroup:'+_0x56fc41,_0x4729ac);ChatGroupEvents['on'](_0x56fc41,_0xbe97fc);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 6d81c73..28460ed 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 _0x5de5=['get','/:id/unread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage','put','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x39a578,_0x3b7263){var _0x1c12ca=function(_0x15882e){while(--_0x15882e){_0x39a578['push'](_0x39a578['shift']());}};_0x1c12ca(++_0x3b7263);}(_0x5de5,0x11e));var _0x55de=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5de5[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x55de('0x0'));var util=require('util');var path=require(_0x55de('0x1'));var timeout=require(_0x55de('0x2'));var express=require(_0x55de('0x3'));var router=express[_0x55de('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x55de('0x5'));var interaction=require(_0x55de('0x6'));var config=require(_0x55de('0x7'));var controller=require('./chatGroup.controller');router['get']('/',auth[_0x55de('0x8')](),controller[_0x55de('0x9')]);router['get'](_0x55de('0xa'),auth['isAuthenticated'](),controller[_0x55de('0xb')]);router['get'](_0x55de('0xc'),auth[_0x55de('0x8')](),controller[_0x55de('0xd')]);router[_0x55de('0xe')](_0x55de('0xf'),auth[_0x55de('0x8')](),controller['getUnread']);router[_0x55de('0xe')](_0x55de('0x10'),auth[_0x55de('0x8')](),controller[_0x55de('0x11')]);router[_0x55de('0xe')](_0x55de('0x12'),auth['isAuthenticated'](),controller['getMessages']);router[_0x55de('0x13')]('/',auth[_0x55de('0x8')](),controller[_0x55de('0x14')]);router['post'](_0x55de('0x10'),auth[_0x55de('0x8')](),controller[_0x55de('0x15')]);router[_0x55de('0x13')](_0x55de('0x12'),auth[_0x55de('0x8')](),controller[_0x55de('0x16')]);router[_0x55de('0x17')](_0x55de('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x55de('0x18')]('/:id',auth[_0x55de('0x8')](),controller['destroy']);router[_0x55de('0x18')](_0x55de('0x10'),auth['isAuthenticated'](),controller['removeMembers']);module['exports']=router; \ No newline at end of file +var _0x1707=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/describe','show','getUnread','/:id/members','getMembers','/:id/messages','create','post','addMembers','addMessage','put','/:id','update','delete','destroy','removeMembers','exports','multer','path'];(function(_0x1759de,_0x270d4c){var _0x3e7d6b=function(_0x6a73ad){while(--_0x6a73ad){_0x1759de['push'](_0x1759de['shift']());}};_0x3e7d6b(++_0x270d4c);}(_0x1707,0xd6));var _0x7170=function(_0x587fa0,_0x232d71){_0x587fa0=_0x587fa0-0x0;var _0x52ee53=_0x1707[_0x587fa0];return _0x52ee53;};'use strict';var multer=require(_0x7170('0x0'));var util=require('util');var path=require(_0x7170('0x1'));var timeout=require(_0x7170('0x2'));var express=require(_0x7170('0x3'));var router=express[_0x7170('0x4')]();var fs_extra=require(_0x7170('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7170('0x6'));var config=require('../../config/environment');var controller=require('./chatGroup.controller');router['get']('/',auth[_0x7170('0x7')](),controller[_0x7170('0x8')]);router[_0x7170('0x9')](_0x7170('0xa'),auth[_0x7170('0x7')](),controller['describe']);router[_0x7170('0x9')]('/:id',auth[_0x7170('0x7')](),controller[_0x7170('0xb')]);router[_0x7170('0x9')]('/:id/unread',auth[_0x7170('0x7')](),controller[_0x7170('0xc')]);router[_0x7170('0x9')](_0x7170('0xd'),auth[_0x7170('0x7')](),controller[_0x7170('0xe')]);router['get'](_0x7170('0xf'),auth[_0x7170('0x7')](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller[_0x7170('0x10')]);router[_0x7170('0x11')](_0x7170('0xd'),auth[_0x7170('0x7')](),controller[_0x7170('0x12')]);router[_0x7170('0x11')](_0x7170('0xf'),auth[_0x7170('0x7')](),controller[_0x7170('0x13')]);router[_0x7170('0x14')](_0x7170('0x15'),auth[_0x7170('0x7')](),controller[_0x7170('0x16')]);router[_0x7170('0x17')](_0x7170('0x15'),auth['isAuthenticated'](),controller[_0x7170('0x18')]);router[_0x7170('0x17')](_0x7170('0xd'),auth[_0x7170('0x7')](),controller[_0x7170('0x19')]);module[_0x7170('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 180c398..edf45dd 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 _0xeb96=['STRING','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','DATE'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xeb96,0x183));var _0x6eb9=function(_0x38290d,_0x2ec9e7){_0x38290d=_0x38290d-0x0;var _0x8adfac=_0xeb96[_0x38290d];return _0x8adfac;};'use strict';var Sequelize=require(_0x6eb9('0x0'));module[_0x6eb9('0x1')]={'closed':{'type':Sequelize[_0x6eb9('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x6eb9('0x3')]},'ratingType':{'type':Sequelize[_0x6eb9('0x4')](_0x6eb9('0x5'),_0x6eb9('0x6')),'defaultValue':_0x6eb9('0x5')},'ratingMessage':{'type':Sequelize[_0x6eb9('0x7')]},'pathTranscript':{'type':Sequelize[_0x6eb9('0x7')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6eb9('0x8')]},'disposition':{'type':Sequelize[_0x6eb9('0x9')]},'secondDisposition':{'type':Sequelize[_0x6eb9('0x9')]},'thirdDisposition':{'type':Sequelize[_0x6eb9('0x9')]},'note':{'type':Sequelize[_0x6eb9('0x9')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x6eb9('0x9')]},'osName':{'type':Sequelize[_0x6eb9('0x9')]},'osVersion':{'type':Sequelize[_0x6eb9('0x9')]},'deviceModel':{'type':Sequelize[_0x6eb9('0x9')]},'deviceVendor':{'type':Sequelize[_0x6eb9('0x9')]},'deviceType':{'type':Sequelize[_0x6eb9('0x9')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x6eb9('0x9')]},'formData':{'type':Sequelize[_0x6eb9('0x7')]('long')},'read1stAt':{'type':Sequelize[_0x6eb9('0x8')]},'lastMsgAt':{'type':Sequelize[_0x6eb9('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x6eb9('0x4')]('in',_0x6eb9('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6eb9('0x9')]},'customerPort':{'type':Sequelize[_0x6eb9('0x9')]},'vidaooSessionId':{'type':Sequelize[_0x6eb9('0x7')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6eb9('0x3')]}}; \ No newline at end of file +var _0x5db5=['STRING','DATE','long','ENUM','out','BOOLEAN','INTEGER','sequelize','exports','star','thumb','TEXT'];(function(_0x4b6804,_0x301b24){var _0x11b4f1=function(_0x31e66c){while(--_0x31e66c){_0x4b6804['push'](_0x4b6804['shift']());}};_0x11b4f1(++_0x301b24);}(_0x5db5,0x1e7));var _0x55db=function(_0x49f173,_0x3a479d){_0x49f173=_0x49f173-0x0;var _0x373943=_0x5db5[_0x49f173];return _0x373943;};'use strict';var Sequelize=require(_0x55db('0x0'));module[_0x55db('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x55db('0x2'),_0x55db('0x3')),'defaultValue':_0x55db('0x2')},'ratingMessage':{'type':Sequelize[_0x55db('0x4')]},'pathTranscript':{'type':Sequelize[_0x55db('0x4')]},'mailTranscript':{'type':Sequelize[_0x55db('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x55db('0x6')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x55db('0x5')]},'thirdDisposition':{'type':Sequelize[_0x55db('0x5')]},'note':{'type':Sequelize[_0x55db('0x5')]},'browserName':{'type':Sequelize[_0x55db('0x5')]},'browserVersion':{'type':Sequelize[_0x55db('0x5')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x55db('0x5')]},'deviceModel':{'type':Sequelize[_0x55db('0x5')]},'deviceVendor':{'type':Sequelize[_0x55db('0x5')]},'deviceType':{'type':Sequelize[_0x55db('0x5')]},'referer':{'type':Sequelize[_0x55db('0x4')]},'customerIp':{'type':Sequelize[_0x55db('0x5')]},'formData':{'type':Sequelize[_0x55db('0x4')](_0x55db('0x7'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x55db('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x55db('0x8')]('in',_0x55db('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x55db('0x5')]},'customerPort':{'type':Sequelize[_0x55db('0x5')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x55db('0xa')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x55db('0xb')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 7a709d1..cb52d06 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 _0xa4ce=['code','ChatInteraction,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','undefined','limit','count','set','update','destroy','end','stack','name','send','render','body','contact','agent','interaction','account','map','ChatInteraction','rawAttributes','fieldName','key','getOptions','findAll','chat','query','user','catch','params','model','keys','filters','intersection','attributes','fields','includeAll','include','create','find','describe','createVidaooSession','ChatWebsite','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','fullname','POST','isNull','vidaooNote','follow','parse','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','updateAttributes','CmContact','Contact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','originalname','filename','type','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','download','close','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','ChatMessage','User','ContactId','Messages','UserId','format','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Smtp','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','length','nolimit','sort','where','pick','ChatInteractionId','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','getMyMessages','hasOwnProperty','order','includeAgent','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','push','firstName','read','Account','Owner','get','mkdirSync','Chat','N.A.','toString','referer','customerIp','tail','existsSync','createReadStream','pipe','createWriteStream','lastName','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache','path','ejs','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','error'];(function(_0x4a944a,_0x28e33a){var _0x381e4b=function(_0x2d7883){while(--_0x2d7883){_0x4a944a['push'](_0x4a944a['shift']());}};_0x381e4b(++_0x28e33a);}(_0xa4ce,0xbb));var _0xea4c=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa4ce[_0x47a7d0];return _0xb9bd08;};'use strict';var rimraf=require(_0xea4c('0x0'));var zipdir=require(_0xea4c('0x1'));var rp=require(_0xea4c('0x2'));var moment=require(_0xea4c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xea4c('0x4'));var util=require('util');var path=require(_0xea4c('0x5'));var ejs=require(_0xea4c('0x6'));var fs=require('fs');var _=require(_0xea4c('0x7'));var Redis=require(_0xea4c('0x8'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0xea4c('0x9'))(_0xea4c('0xa'));var config=require(_0xea4c('0xb'));var db=require(_0xea4c('0xc'))['db'];config[_0xea4c('0xd')]=_[_0xea4c('0xe')](config['redis'],{'host':_0xea4c('0xf'),'port':0x18eb});var socket=require(_0xea4c('0x10'))(new Redis(config[_0xea4c('0xd')]));require(_0xea4c('0x11'))[_0xea4c('0x12')](socket);var jayson=require(_0xea4c('0x13'));var client=jayson[_0xea4c('0x14')][_0xea4c('0x15')]({'port':0x232b});var client9004=jayson['client'][_0xea4c('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x4d5504,_0x378570,_0x51419c,_0x3d3b08){return new BPromise(function(_0x32f227,_0x4e9b05){var _0x1215b8=_0x3d3b08||client;return _0x1215b8[_0xea4c('0x16')](_0x4d5504,_0x51419c)[_0xea4c('0x17')](function(_0x5db049){logger[_0xea4c('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x378570,_0xea4c('0x19'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x378570,_0xea4c('0x19'),JSON['stringify'](_0x5db049));if(_0x5db049['error']){if(_0x5db049[_0xea4c('0x1a')][_0xea4c('0x1b')]===0x1f4){logger['error'](_0xea4c('0x1c'),_0x378570,_0x5db049[_0xea4c('0x1a')][_0xea4c('0x1d')]);return _0x4e9b05(_0x5db049[_0xea4c('0x1a')][_0xea4c('0x1d')]);}logger[_0xea4c('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x378570,_0x5db049['error'][_0xea4c('0x1d')]);return _0x32f227(_0x5db049['error'][_0xea4c('0x1d')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x378570,_0xea4c('0x19'));_0x32f227(_0x5db049[_0xea4c('0x1e')]['message']);}})['catch'](function(_0x218aa4){logger['error'](_0xea4c('0x1c'),_0x378570,_0x218aa4);_0x4e9b05(_0x218aa4);});});}function respondWithStatusCode(_0x95d601,_0x20d0d0){_0x20d0d0=_0x20d0d0||0xcc;return function(_0x112738){if(_0x112738){return _0x95d601[_0xea4c('0x1f')](_0x20d0d0);}return _0x95d601[_0xea4c('0x20')](_0x20d0d0)['end']();};}function respondWithResult(_0x259125,_0x6d0a1d){_0x6d0a1d=_0x6d0a1d||0xc8;return function(_0x40213b){if(_0x40213b){return _0x259125[_0xea4c('0x20')](_0x6d0a1d)[_0xea4c('0x21')](_0x40213b);}};}function respondWithFilteredResult(_0x15feb8,_0x10364e){return function(_0x6dfb39){if(_0x6dfb39){var _0x2ab9db=typeof _0x10364e[_0xea4c('0x22')]===_0xea4c('0x23')&&typeof _0x10364e[_0xea4c('0x24')]===_0xea4c('0x23');var _0x855803=_0x6dfb39[_0xea4c('0x25')];var _0x3a795f=_0x2ab9db?0x0:_0x10364e[_0xea4c('0x22')];var _0x1e3e6e=_0x2ab9db?_0x6dfb39[_0xea4c('0x25')]:_0x10364e['offset']+_0x10364e[_0xea4c('0x24')];var _0x26b9f7;if(_0x1e3e6e>=_0x855803){_0x1e3e6e=_0x855803;_0x26b9f7=0xc8;}else{_0x26b9f7=0xce;}_0x15feb8['status'](_0x26b9f7);return _0x15feb8[_0xea4c('0x26')]('Content-Range',_0x3a795f+'-'+_0x1e3e6e+'/'+_0x855803)['json'](_0x6dfb39);}return null;};}function saveUpdates(_0x24a089){return function(_0x3f2d7c){if(_0x3f2d7c){return _0x3f2d7c[_0xea4c('0x27')](_0x24a089)[_0xea4c('0x17')](function(_0x1ab91){return _0x1ab91;});}return null;};}function removeEntity(_0x5e86f8){return function(_0x1188d4){if(_0x1188d4){return _0x1188d4[_0xea4c('0x28')]()[_0xea4c('0x17')](function(){_0x5e86f8['status'](0xcc)[_0xea4c('0x29')]();});}};}function handleEntityNotFound(_0x520e7d){return function(_0x279142){if(!_0x279142){_0x520e7d['sendStatus'](0x194);}return _0x279142;};}function handleError(_0x2df837,_0x287a67){_0x287a67=_0x287a67||0x1f4;return function(_0x322b8b){logger[_0xea4c('0x1a')](_0x322b8b[_0xea4c('0x2a')]);if(_0x322b8b[_0xea4c('0x2b')]){delete _0x322b8b[_0xea4c('0x2b')];}_0x2df837[_0xea4c('0x20')](_0x287a67)[_0xea4c('0x2c')](_0x322b8b);};}function getMustacheRender(_0x4fa8c1,_0x5e1c9d){return Mustache[_0xea4c('0x2d')](_0x4fa8c1,_['merge'](_0x5e1c9d[_0xea4c('0x2e')],{'contact':_0x5e1c9d[_0xea4c('0x2f')],'message':_0x5e1c9d[_0xea4c('0x1d')],'agent':_0x5e1c9d[_0xea4c('0x30')],'interaction':_0x5e1c9d[_0xea4c('0x31')],'account':_0x5e1c9d[_0xea4c('0x32')]}))||'';}exports['index']=function(_0x565689,_0x2bf186){var _0x62163={};var _0x13bfa5=_[_0xea4c('0x33')](db[_0xea4c('0x34')][_0xea4c('0x35')],function(_0x5bbbf8){return{'name':_0x5bbbf8[_0xea4c('0x36')],'type':_0x5bbbf8['type'][_0xea4c('0x37')]};});_0x62163=qs[_0xea4c('0x38')](_0x13bfa5,_0x565689);return interaction[_0xea4c('0x39')](_0xea4c('0x3a'),_0x565689[_0xea4c('0x3b')],_0x565689[_0xea4c('0x3c')],_0x62163,_0x13bfa5)[_0xea4c('0x17')](respondWithFilteredResult(_0x2bf186,_0x62163))[_0xea4c('0x3d')](handleError(_0x2bf186,null));};exports['show']=function(_0x52c452,_0x36bcd2){var _0x119a74={'raw':![],'where':{'id':_0x52c452[_0xea4c('0x3e')]['id']}},_0x3a027d={};_0x3a027d[_0xea4c('0x3f')]=_[_0xea4c('0x40')](db[_0xea4c('0x34')][_0xea4c('0x35')]);_0x3a027d['query']=_[_0xea4c('0x40')](_0x52c452[_0xea4c('0x3b')]);_0x3a027d[_0xea4c('0x41')]=_[_0xea4c('0x42')](_0x3a027d['model'],_0x3a027d[_0xea4c('0x3b')]);_0x119a74[_0xea4c('0x43')]=_[_0xea4c('0x42')](_0x3a027d[_0xea4c('0x3f')],qs[_0xea4c('0x44')](_0x52c452[_0xea4c('0x3b')]['fields']));_0x119a74[_0xea4c('0x43')]=_0x119a74[_0xea4c('0x43')]['length']?_0x119a74[_0xea4c('0x43')]:_0x3a027d[_0xea4c('0x3f')];if(_0x52c452[_0xea4c('0x3b')][_0xea4c('0x45')]){_0x119a74[_0xea4c('0x46')]=[{'all':!![]}];}_0x119a74=_['merge']({},_0x119a74,_0x52c452['options']);return db[_0xea4c('0x34')]['find'](_0x119a74)[_0xea4c('0x17')](handleEntityNotFound(_0x36bcd2,null))[_0xea4c('0x17')](respondWithResult(_0x36bcd2,null))[_0xea4c('0x3d')](handleError(_0x36bcd2,null));};exports[_0xea4c('0x47')]=function(_0x294bdc,_0x6d1513){return db[_0xea4c('0x34')][_0xea4c('0x47')](_0x294bdc[_0xea4c('0x2e')],{})['then'](respondWithResult(_0x6d1513,0xc9))['catch'](handleError(_0x6d1513,null));};exports[_0xea4c('0x27')]=function(_0x21ae57,_0x26be68){if(_0x21ae57['body']['id']){delete _0x21ae57[_0xea4c('0x2e')]['id'];}return db['ChatInteraction'][_0xea4c('0x48')]({'where':{'id':_0x21ae57[_0xea4c('0x3e')]['id']}})[_0xea4c('0x17')](handleEntityNotFound(_0x26be68,null))[_0xea4c('0x17')](saveUpdates(_0x21ae57['body'],null))[_0xea4c('0x17')](respondWithResult(_0x26be68,null))[_0xea4c('0x3d')](handleError(_0x26be68,null));};exports[_0xea4c('0x28')]=function(_0x56e7f3,_0x491b3a){return db['ChatInteraction'][_0xea4c('0x48')]({'where':{'id':_0x56e7f3[_0xea4c('0x3e')]['id']}})[_0xea4c('0x17')](handleEntityNotFound(_0x491b3a,null))[_0xea4c('0x17')](removeEntity(_0x491b3a,null))[_0xea4c('0x3d')](handleError(_0x491b3a,null));};exports[_0xea4c('0x49')]=function(_0x4bfe0c,_0x4490ab){return db[_0xea4c('0x34')][_0xea4c('0x49')]()[_0xea4c('0x17')](respondWithResult(_0x4490ab,null))[_0xea4c('0x3d')](handleError(_0x4490ab,null));};exports[_0xea4c('0x4a')]=function(_0x3e0007,_0x5bf8cb){var _0x516cfc=_0x3e0007[_0xea4c('0x3e')]['id'];var _0x19bf4e;var _0x3ee677;var _0x2844d9;return db[_0xea4c('0x34')]['findOne']({'where':{'id':_0x516cfc}})['then'](function(_0x57b3ab){_0x19bf4e=_0x57b3ab;return db[_0xea4c('0x4b')][_0xea4c('0x4c')]({'where':{'id':_0x57b3ab[_0xea4c('0x4d')]},'attributes':['id',_0xea4c('0x4e'),_0xea4c('0x4f'),_0xea4c('0x50'),'vidaooNote',_0xea4c('0x51')],'raw':!![]});})[_0xea4c('0x17')](function(_0x495f15){if(_0x495f15&&_0x495f15[_0xea4c('0x4e')]&&_0x495f15[_0xea4c('0x4f')]){_0x3ee677=_0x495f15;var _0x2a982b={'interaction':{'id':_0x516cfc},'agent':{'id':_0x3e0007[_0xea4c('0x3c')]['id'],'name':_0x3e0007[_0xea4c('0x3c')]['name'],'fullname':_0x3e0007[_0xea4c('0x3c')][_0xea4c('0x52')],'email':_0x3e0007[_0xea4c('0x3c')]['email']},'contact':_0x3e0007[_0xea4c('0x2e')]['contact'],'account':_0x3e0007[_0xea4c('0x2e')]['account']};var _0x4af5e6={'rejectUnauthorized':![],'method':_0xea4c('0x53'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x495f15[_0xea4c('0x4e')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3e0007['user']['email']],'buttons':null,'topic':_0x3ee677['vidaooTopic'],'note':_[_0xea4c('0x54')](_0x3ee677[_0xea4c('0x55')])?null:getMustacheRender(_0x3ee677[_0xea4c('0x55')],_0x2a982b),'metadata':null},'redirect':_0xea4c('0x56'),'json':!![]};try{if(!_[_0xea4c('0x54')](_0x3ee677[_0xea4c('0x51')])){var _0x57bed4=getMustacheRender(_0x3ee677[_0xea4c('0x51')],_0x2a982b);var _0x196140=JSON[_0xea4c('0x57')](_0x57bed4);_0x4af5e6[_0xea4c('0x2e')]['metadata']=_0x196140;}}catch(_0xfaf936){throw new db[(_0xea4c('0x58'))]['ValidationError'](_0xea4c('0x59'));}return rp(_0x4af5e6);}else{throw new db['Sequelize'][(_0xea4c('0x5a'))](_0xea4c('0x5b'));}})[_0xea4c('0x17')](function(_0x4afb1f){_0x2844d9=_0x4afb1f;if(_0x2844d9['id']){var _0x25b273={'body':_0x2844d9[_0xea4c('0x5c')],'ChatWebsiteId':_0x3ee677['id'],'ChatInteractionId':_0x19bf4e['id'],'direction':_0xea4c('0x5d'),'UserId':_0x3e0007[_0xea4c('0x3c')]['id']};return db['ChatMessage'][_0xea4c('0x47')](_0x25b273,{});}else{throw new db[(_0xea4c('0x58'))]['ValidationError']('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x19bf4e[_0xea4c('0x5e')]({'vidaooSessionId':_0x2844d9['id']});})[_0xea4c('0x17')](respondWithResult(_0x5bf8cb,null))[_0xea4c('0x3d')](handleError(_0x5bf8cb,null));};exports['customUpdate']=function(_0x58b211,_0x2ead01){if(_0x58b211['body']['id']){delete _0x58b211[_0xea4c('0x2e')]['id'];}return db['ChatInteraction'][_0xea4c('0x48')]({'where':{'id':_0x58b211[_0xea4c('0x3e')]['id']},'include':[{'model':db[_0xea4c('0x5f')],'as':_0xea4c('0x60')}]})[_0xea4c('0x17')](handleEntityNotFound(_0x2ead01,null))[_0xea4c('0x17')](saveUpdates(_0x58b211[_0xea4c('0x2e')],null))[_0xea4c('0x17')](respondWithResult(_0x2ead01,null))[_0xea4c('0x3d')](handleError(_0x2ead01,null));};exports[_0xea4c('0x61')]=function(_0x3b39f2,_0x4fac11){if(_0x3b39f2[_0xea4c('0x2e')]['id']){delete _0x3b39f2['body']['id'];}return db[_0xea4c('0x34')][_0xea4c('0x48')]({'where':{'id':_0x3b39f2['params']['id']}})[_0xea4c('0x17')](function(_0x25bd8f){if(!_0x25bd8f){logger[_0xea4c('0x1a')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0xea4c('0x62'));_0x4fac11[_0xea4c('0x1f')](0x194);}else{if(_0x25bd8f['UserId']){throw new db[(_0xea4c('0x58'))][(_0xea4c('0x5a'))](_0xea4c('0x63'));}}return _0x25bd8f;})['then'](function(_0x438db8){if(_0x438db8){return _0x438db8[_0xea4c('0x27')]({'closed':_0x3b39f2[_0xea4c('0x2e')][_0xea4c('0x64')],'disposition':_0x3b39f2[_0xea4c('0x2e')][_0xea4c('0x65')]})[_0xea4c('0x17')](function(_0x4a734c){return _0x4a734c;});}})[_0xea4c('0x17')](function(){return respondWithRpcPromise('AbandonInteraction',_0xea4c('0x61'),_0x3b39f2[_0xea4c('0x2e')],client9004);})[_0xea4c('0x17')](respondWithResult(_0x4fac11,null))[_0xea4c('0x3d')](handleError(_0x4fac11,null));};exports[_0xea4c('0x66')]=function(_0x152a44,_0x3bdedb){_0x152a44[_0xea4c('0x2e')][_0xea4c('0x2b')]=_0x152a44[_0xea4c('0x67')][_0xea4c('0x68')];_0x152a44[_0xea4c('0x2e')]['basename']=_0x152a44[_0xea4c('0x67')][_0xea4c('0x69')];_0x152a44[_0xea4c('0x2e')][_0xea4c('0x6a')]=_0x152a44[_0xea4c('0x67')]['mimetype'];return db[_0xea4c('0x6b')][_0xea4c('0x47')](_0x152a44[_0xea4c('0x2e')])['then'](respondWithResult(_0x3bdedb,0xc9))[_0xea4c('0x3d')](handleError(_0x3bdedb,null));};exports[_0xea4c('0x6c')]=function(_0x4f72b2,_0x4f5704){return db[_0xea4c('0x34')][_0xea4c('0x4c')]({'where':{'id':_0x4f72b2[_0xea4c('0x3e')]['id']},'raw':!![]})[_0xea4c('0x17')](handleEntityNotFound(_0x4f5704,null))[_0xea4c('0x17')](function(_0x58f4b1){if(_0x58f4b1){if(_0x58f4b1[_0xea4c('0x64')]){return _0x4f5704['status'](0x193)[_0xea4c('0x21')]({'status':0x193,'message':_0xea4c('0x6d')});}return db['Attachment'][_0xea4c('0x4c')]({'where':{'id':_0x4f72b2[_0xea4c('0x3b')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x4f5704,null));}})[_0xea4c('0x17')](function(_0x18b5c7){if(_0x18b5c7){var _0x4e7f01=_0x18b5c7[_0xea4c('0x6e')]!==null;var _0x1d7115=path[_0xea4c('0x6f')](config[_0xea4c('0x70')],_0xea4c('0x71'));if(_0x4e7f01){_0x1d7115=path[_0xea4c('0x6f')](_0x1d7115,_0xea4c('0x72'));}var _0x42e395=path[_0xea4c('0x6f')](_0x1d7115,_0x18b5c7[_0xea4c('0x73')]);return _0x4f5704[_0xea4c('0x74')](_0x42e395);}})[_0xea4c('0x3d')](handleError(_0x4f5704,null));};exports[_0xea4c('0x75')]=function(_0x43df6d,_0x2bd05b){var _0x510245=null;var _0x12e8b4=null;var _0x32b07a=null;if(_0x43df6d[_0xea4c('0x2e')]['id']){delete _0x43df6d[_0xea4c('0x2e')]['id'];}if(_0x43df6d[_0xea4c('0x2e')]['mailTranscript']){_0x32b07a=path['join'](config['root'],_0xea4c('0x76'),util['format'](_0xea4c('0x77'),Date[_0xea4c('0x78')]()));_0x43df6d[_0xea4c('0x2e')][_0xea4c('0x79')]=_0x32b07a;}return db[_0xea4c('0x34')][_0xea4c('0x48')]({'where':{'id':_0x43df6d[_0xea4c('0x3e')]['id']},'include':[{'model':db[_0xea4c('0x7a')],'as':'Messages','include':[{'model':db[_0xea4c('0x7b')],'as':_0xea4c('0x7b')}]}]})[_0xea4c('0x17')](handleEntityNotFound(_0x2bd05b,null))[_0xea4c('0x17')](saveUpdates(_0x43df6d[_0xea4c('0x2e')],null))['then'](function(_0x491446){if(_0x491446){_0x510245=_0x491446;return db[_0xea4c('0x4b')][_0xea4c('0x48')]({'where':{'id':_0x510245['ChatWebsiteId']}});}})[_0xea4c('0x17')](function(_0x7b2b33){if(_0x7b2b33){_0x12e8b4=_0x7b2b33;return db['CmContact']['find']({'where':{'id':_0x510245[_0xea4c('0x7c')]}});}})['then'](function(_0x376414){if(_0x376414){if(_0x32b07a){var _0x12e6db=null;for(var _0x508840=0x1;_0x508840<_0x510245[_0xea4c('0x7d')]['length'];++_0x508840){_0x12e6db=_0x510245[_0xea4c('0x7d')][_0x508840];var _0x452aba=_0x12e6db[_0xea4c('0x7e')]?util[_0xea4c('0x7f')](_0xea4c('0x80'),_0x12e8b4[_0xea4c('0x81')],_0x12e6db[_0xea4c('0x7e')]):_0xea4c('0x82');var _0x5c48aa=_0x43df6d[_0xea4c('0x2e')][_0xea4c('0x83')]||util[_0xea4c('0x7f')](_0xea4c('0x80'),_0xea4c('0x84'),_0x12e6db[_0xea4c('0x7c')]);switch(_0x12e8b4[_0xea4c('0x85')]){case _0xea4c('0x86'):_0x452aba=_0x12e6db[_0xea4c('0x7e')]?util[_0xea4c('0x7f')](_0xea4c('0x80'),_0x12e8b4[_0xea4c('0x81')],_0x12e6db[_0xea4c('0x7e')]):_0xea4c('0x82');break;case _0xea4c('0x87'):_0x452aba=_0x12e6db[_0xea4c('0x7e')]?_0x12e6db[_0xea4c('0x7b')][_0xea4c('0x88')]||_0x12e6db[_0xea4c('0x7b')][_0xea4c('0x52')]:_0xea4c('0x82');break;case _0xea4c('0x89'):_0x452aba=_0x12e6db['UserId']?_0x12e6db[_0xea4c('0x7b')][_0xea4c('0x52')]:_0xea4c('0x82');break;default:_0x452aba=_0x12e6db[_0xea4c('0x7e')]?util[_0xea4c('0x7f')]('%s%d',_0x12e8b4[_0xea4c('0x81')],_0x12e6db[_0xea4c('0x7e')]):_0xea4c('0x82');}var _0x4f6ed2=util['format'](_0xea4c('0x8a'),moment(_0x12e6db[_0xea4c('0x8b')])['format'](_0xea4c('0x8c')),_0x12e6db[_0xea4c('0x8d')]==='in'?_0x5c48aa:_0x452aba,_0x12e6db[_0xea4c('0x2e')]);if(!_0x12e6db[_0xea4c('0x8e')]){fs[_0xea4c('0x8f')](_0x32b07a,_0x4f6ed2);}}return db[_0xea4c('0x90')][_0xea4c('0x4c')]({'where':{'service':!![]},'include':[{'model':db[_0xea4c('0x91')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xea4c('0x92')],'as':_0xea4c('0x92'),'raw':!![]}]}]});}}})[_0xea4c('0x17')](function(_0x31ae01){if(!_0x31ae01||!_0x31ae01['Smtp']||!_0x43df6d[_0xea4c('0x2e')])return _0x510245;var _0x2ed113=_0x31ae01[_0xea4c('0x93')]();return respondWithRpcPromise(_0xea4c('0x94'),_0xea4c('0x95'),{'account':_0x2ed113,'message':{'from':util[_0xea4c('0x7f')](_0xea4c('0x96'),_0x31ae01[_0xea4c('0x2b')],_0x31ae01[_0xea4c('0x97')]||_0x31ae01[_0xea4c('0x98')][_0xea4c('0x3c')]),'to':_0x43df6d['body'][_0xea4c('0x99')],'subject':_0xea4c('0x9a'),'text':util[_0xea4c('0x7f')](_0xea4c('0x9b'),_0x43df6d['body']['mailTranscript']),'attachments':[{'path':_0x32b07a}]}})[_0xea4c('0x17')](function(){return _0x510245;})['catch'](function(_0x408ff0){logger[_0xea4c('0x1a')](_0x408ff0);});})['then'](respondWithStatusCode(_0x2bd05b,0xc8))[_0xea4c('0x3d')](handleError(_0x2bd05b,null));};exports['addMessage']=function(_0x63cc90,_0x3cd27a){return db[_0xea4c('0x7a')]['find']({'where':{'id':_0x63cc90[_0xea4c('0x3e')]['id']}})[_0xea4c('0x17')](handleEntityNotFound(_0x3cd27a,null))[_0xea4c('0x17')](function(_0x48ff7d){if(_0x48ff7d){return _0x48ff7d[_0xea4c('0x9c')](_0x63cc90[_0xea4c('0x2e')]['ids'],_[_0xea4c('0x9d')](_0x63cc90[_0xea4c('0x2e')],[_0xea4c('0x9e'),'id'])||{});}})[_0xea4c('0x17')](respondWithResult(_0x3cd27a,null))['catch'](handleError(_0x3cd27a,null));};exports[_0xea4c('0x9f')]=function(_0x473b85,_0x346bee){var _0x42c666={'raw':![],'where':{}};var _0x53e233={};var _0x5d13e4={'count':0x0,'rows':[]};return db[_0xea4c('0x34')][_0xea4c('0x4c')]({'where':{'id':_0x473b85[_0xea4c('0x3e')]['id']}})[_0xea4c('0x17')](handleEntityNotFound(_0x346bee,null))[_0xea4c('0x17')](function(_0x38175f){if(_0x38175f){_0x53e233['model']=_[_0xea4c('0x40')](db['ChatMessage'][_0xea4c('0x35')]);_0x53e233[_0xea4c('0x3b')]=_[_0xea4c('0x40')](_0x473b85[_0xea4c('0x3b')]);_0x53e233[_0xea4c('0x41')]=_['intersection'](_0x53e233[_0xea4c('0x3f')],_0x53e233['query']);_0x42c666[_0xea4c('0x43')]=_[_0xea4c('0x42')](_0x53e233[_0xea4c('0x3f')],qs['fields'](_0x473b85[_0xea4c('0x3b')][_0xea4c('0x44')]));_0x42c666[_0xea4c('0x43')]=_0x42c666['attributes'][_0xea4c('0xa0')]?_0x42c666['attributes']:_0x53e233[_0xea4c('0x3f')];if(!_0x473b85[_0xea4c('0x3b')]['hasOwnProperty'](_0xea4c('0xa1'))){_0x42c666['limit']=qs[_0xea4c('0x24')](_0x473b85[_0xea4c('0x3b')][_0xea4c('0x24')]);_0x42c666[_0xea4c('0x22')]=qs[_0xea4c('0x22')](_0x473b85[_0xea4c('0x3b')][_0xea4c('0x22')]);}_0x42c666['order']=qs[_0xea4c('0xa2')](_0x473b85[_0xea4c('0x3b')][_0xea4c('0xa2')]);_0x42c666[_0xea4c('0xa3')]=qs[_0xea4c('0x41')](_[_0xea4c('0xa4')](_0x473b85[_0xea4c('0x3b')],_0x53e233['filters']));_0x42c666[_0xea4c('0xa3')][_0xea4c('0xa5')]=_0x38175f['id'];if(_0x473b85['query'][_0xea4c('0xa6')]){_0x42c666['where']=_[_0xea4c('0xa7')](_0x42c666[_0xea4c('0xa3')],{'$or':_['map'](_0x42c666[_0xea4c('0x43')],function(_0x270cc9){var _0x437f82={};_0x437f82[_0x270cc9]={'$like':'%'+_0x473b85['query'][_0xea4c('0xa6')]+'%'};return _0x437f82;})});}if(_0x473b85[_0xea4c('0x3b')][_0xea4c('0xa8')]){var _0x2276ab=_0x473b85[_0xea4c('0x3b')][_0xea4c('0xa8')][_0xea4c('0xa9')](',');var _0x59b76c={};_0x59b76c[_0x2276ab[0x0]]={'$gte':moment(_0x2276ab[0x1])[_0xea4c('0x7f')](_0xea4c('0xaa'))};_0x42c666[_0xea4c('0xa3')]=_[_0xea4c('0xa7')](_0x42c666[_0xea4c('0xa3')],_0x59b76c);}_0x42c666=_[_0xea4c('0xa7')]({},_0x42c666,_0x473b85[_0xea4c('0xab')]);return db[_0xea4c('0x7a')]['count']({'where':_0x42c666[_0xea4c('0xa3')]})[_0xea4c('0x17')](function(_0x101e16){_0x5d13e4[_0xea4c('0x25')]=_0x101e16;if(_0x473b85['query'][_0xea4c('0x45')]){_0x42c666[_0xea4c('0x46')]=[{'all':!![]}];}return db[_0xea4c('0x7a')][_0xea4c('0x39')](_0x42c666);})[_0xea4c('0x17')](function(_0x4d2877){_0x5d13e4[_0xea4c('0xac')]=_0x4d2877;return _0x5d13e4;});}})[_0xea4c('0x17')](respondWithFilteredResult(_0x346bee,_0x42c666))[_0xea4c('0x3d')](handleError(_0x346bee,null));};exports[_0xea4c('0xad')]=function(_0x496af2,_0x498b93){var _0x171b7c={'where':{}},_0x2d57b7={},_0x44bb9d={'count':0x0,'rows':[]};return db[_0xea4c('0x34')][_0xea4c('0x4c')]({'where':{'id':_0x496af2[_0xea4c('0x3e')]['id']}})[_0xea4c('0x17')](handleEntityNotFound(_0x498b93,null))[_0xea4c('0x17')](function(_0x1706e5){if(_0x1706e5){_0x2d57b7['model']=_[_0xea4c('0x40')](db['ChatMessage'][_0xea4c('0x35')]);_0x2d57b7[_0xea4c('0x3b')]=_[_0xea4c('0x40')](_0x496af2[_0xea4c('0x3b')]);_0x2d57b7[_0xea4c('0x41')]=_[_0xea4c('0x42')](_0x2d57b7[_0xea4c('0x3f')],_0x2d57b7[_0xea4c('0x3b')]);_0x171b7c[_0xea4c('0x43')]=_['intersection'](_0x2d57b7[_0xea4c('0x3f')],qs[_0xea4c('0x44')](_0x496af2[_0xea4c('0x3b')][_0xea4c('0x44')]));_0x171b7c[_0xea4c('0x43')]=_0x171b7c[_0xea4c('0x43')][_0xea4c('0xa0')]?_0x171b7c[_0xea4c('0x43')]:_0x2d57b7['model'];if(!_0x496af2[_0xea4c('0x3b')][_0xea4c('0xae')](_0xea4c('0xa1'))){_0x171b7c[_0xea4c('0x24')]=qs[_0xea4c('0x24')](_0x496af2[_0xea4c('0x3b')][_0xea4c('0x24')]);_0x171b7c[_0xea4c('0x22')]=qs['offset'](_0x496af2[_0xea4c('0x3b')][_0xea4c('0x22')]);}_0x171b7c[_0xea4c('0xaf')]=qs[_0xea4c('0xa2')](_0x496af2[_0xea4c('0x3b')][_0xea4c('0xa2')]);_0x171b7c[_0xea4c('0xa3')]=qs[_0xea4c('0x41')](_[_0xea4c('0xa4')](_0x496af2[_0xea4c('0x3b')],_0x2d57b7[_0xea4c('0x41')]));_0x171b7c[_0xea4c('0xa3')][_0xea4c('0xa5')]=_0x1706e5['id'];if(_0x496af2['query'][_0xea4c('0xa6')]){_0x171b7c[_0xea4c('0xa3')]=_[_0xea4c('0xa7')](_0x171b7c['where'],{'$or':_['map'](_0x171b7c[_0xea4c('0x43')],function(_0x254cfe){var _0x345d97={};_0x345d97[_0x254cfe]={'$like':'%'+_0x496af2['query'][_0xea4c('0xa6')]+'%'};return _0x345d97;})});}_0x171b7c[_0xea4c('0xa3')][_0xea4c('0x8e')]=![];if(_0x496af2['query']['id']){_0x171b7c['where']['id']={'$gt':_0x496af2[_0xea4c('0x3b')]['id']};}_0x171b7c=_[_0xea4c('0xa7')]({},_0x171b7c,_0x496af2[_0xea4c('0xab')]);return db['ChatMessage'][_0xea4c('0x25')]({'where':_0x171b7c['where']})[_0xea4c('0x17')](function(_0x3d366e){_0x44bb9d['count']=_0x3d366e;_0x171b7c[_0xea4c('0x46')]=[];if(_0x496af2[_0xea4c('0x3b')][_0xea4c('0xb0')]){_0x171b7c['include']['push']({'model':db[_0xea4c('0x7b')],'as':_0xea4c('0x7b'),'attributes':['id',_0xea4c('0x52'),'alias']});}if(_0x496af2[_0xea4c('0x3b')][_0xea4c('0x45')]){_0x171b7c[_0xea4c('0x46')]=[{'all':!![]}];}return db[_0xea4c('0x7a')][_0xea4c('0x39')](_0x171b7c);})[_0xea4c('0x17')](function(_0x37eaa9){_0x44bb9d[_0xea4c('0xac')]=_0x37eaa9;return _0x44bb9d;});}})[_0xea4c('0x17')](respondWithFilteredResult(_0x498b93,_0x171b7c))['catch'](handleError(_0x498b93,null));};exports[_0xea4c('0xb1')]=function(_0x17d5d5,_0x293916){return db[_0xea4c('0x34')][_0xea4c('0x48')]({'where':{'id':_0x17d5d5[_0xea4c('0x3e')]['id']}})[_0xea4c('0x17')](handleEntityNotFound(_0x293916,null))['then'](function(_0x3d1f16){if(_0x3d1f16){return _0x3d1f16[_0xea4c('0xb2')](_0x17d5d5[_0xea4c('0x2e')]['ids'],_['omit'](_0x17d5d5['body'],[_0xea4c('0x9e'),'id'])||{})[_0xea4c('0xb3')](function(){return db[_0xea4c('0xb4')][_0xea4c('0x39')]({'attributes':['id',_0xea4c('0x2b'),_0xea4c('0xb5')],'where':{'id':_0x17d5d5[_0xea4c('0x2e')][_0xea4c('0x9e')]}});})['then'](function(_0x1884c4){socket[_0xea4c('0xb6')](_0xea4c('0xb7'),{'id':Number(_0x17d5d5[_0xea4c('0x3e')]['id']),'tags':_0x1884c4||[]});return{'id':Number(_0x17d5d5[_0xea4c('0x3e')]['id']),'tags':_0x1884c4||[]};});}})[_0xea4c('0x17')](respondWithResult(_0x293916,null))[_0xea4c('0x3d')](handleError(_0x293916,null));};exports[_0xea4c('0xb8')]=function(_0x397799,_0x34590d){return db[_0xea4c('0x34')][_0xea4c('0x48')]({'where':{'id':_0x397799[_0xea4c('0x3e')]['id']}})[_0xea4c('0x17')](handleEntityNotFound(_0x34590d,null))[_0xea4c('0x17')](function(_0x5d3cd2){if(_0x5d3cd2){return _0x5d3cd2[_0xea4c('0xb8')](_0x397799[_0xea4c('0x3b')]['ids']);}})[_0xea4c('0x17')](respondWithStatusCode(_0x34590d,null))[_0xea4c('0x3d')](handleError(_0x34590d,null));};exports[_0xea4c('0x74')]=function(_0xd1e55b,_0xefc6ed){var _0x47075e=moment()[_0xea4c('0xb9')]()['toString']();var _0x57440f=path[_0xea4c('0x6f')](config[_0xea4c('0x70')],_0xea4c('0xba'),_0xea4c('0xbb'),_0xea4c('0xbc'));var _0x2f39bb=path[_0xea4c('0x6f')](config[_0xea4c('0x70')],_0xea4c('0xba'),_0xea4c('0xbb'),_0xea4c('0xbd'));var _0x5bf231=path[_0xea4c('0x6f')](_0x57440f,_0x47075e);var _0x1329ae=util[_0xea4c('0x7f')]('transcript-%d-%s.zip',_0xd1e55b[_0xea4c('0x3e')]['id'],_0x47075e);var _0x278138=path[_0xea4c('0x6f')](_0x57440f,_0x1329ae);var _0x3452fc=[];_0x3452fc[_0xea4c('0xbe')]({'model':db[_0xea4c('0x7b')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3452fc[_0xea4c('0xbe')]({'model':db['CmContact'],'as':_0xea4c('0x60'),'attributes':['id',_0xea4c('0xbf'),'lastName'],'raw':!![]});if(_0xd1e55b[_0xea4c('0x3b')][_0xea4c('0xbd')]){_0x3452fc[_0xea4c('0xbe')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x596ba4=[{'model':db[_0xea4c('0x7a')],'as':_0xea4c('0x7d'),'attributes':['id',_0xea4c('0x2e'),_0xea4c('0x8b'),_0xea4c('0x8d'),_0xea4c('0x8e'),_0xea4c('0xc0')],'include':_0x3452fc}];_0x596ba4[_0xea4c('0xbe')]({'model':db['ChatWebsite'],'as':_0xea4c('0xc1'),'attributes':['id','name']});_0x596ba4['push']({'model':db[_0xea4c('0x7b')],'as':_0xea4c('0xc2'),'attributes':['id',_0xea4c('0x52')]});return db[_0xea4c('0x34')]['find']({'where':{'id':_0xd1e55b[_0xea4c('0x3e')]['id']},'include':_0x596ba4})[_0xea4c('0x17')](handleEntityNotFound(_0xefc6ed,null))[_0xea4c('0x17')](function(_0xa365f6){if(_0xa365f6){var _0xbed595=_0xa365f6[_0xea4c('0xc3')]({'plain':!![]});fs[_0xea4c('0xc4')](_0x5bf231);var _0x27a32e={'channel':_0xea4c('0xc5'),'account':_0xbed595[_0xea4c('0xc1')]['name'],'agent':_0xbed595[_0xea4c('0xc2')]?_0xbed595['Owner'][_0xea4c('0x52')]:_0xea4c('0xc6'),'createdAt':moment(_0xbed595['createdAt'])[_0xea4c('0x7f')](_0xea4c('0xaa'))[_0xea4c('0xc7')](),'closedAt':_0xbed595[_0xea4c('0x64')]?moment(_0xbed595['closedAt'])[_0xea4c('0x7f')](_0xea4c('0xaa'))[_0xea4c('0xc7')]():'','disposition':_0xbed595['disposition'],'chatInfo':{'browser':_0xbed595['browserName'],'os':_0xbed595['osName'],'referer':_0xbed595[_0xea4c('0xc8')],'customerIp':_0xbed595[_0xea4c('0xc9')],'customerPort':_0xbed595['customerPort']?_0xbed595['customerPort']:'N.A.'},'messages':_(_0xbed595['Messages'])[_0xea4c('0xca')]()[_0xea4c('0xa6')]({'secret':![]})[_0xea4c('0x33')](function(_0xf606da){if(_0xf606da['Attachment']){var _0x285e26=path[_0xea4c('0x6f')](_0x2f39bb,_0xf606da[_0xea4c('0x6b')][_0xea4c('0x73')]);if(fs[_0xea4c('0xcb')](_0x285e26)){fs[_0xea4c('0xcc')](_0x285e26)[_0xea4c('0xcd')](fs[_0xea4c('0xce')](path['join'](_0x5bf231,_0xf606da['Attachment']['basename'])));}}return{'date':moment(_0xf606da[_0xea4c('0x8b')])['format'](_0xea4c('0xaa'))[_0xea4c('0xc7')](),'sender':_0xf606da[_0xea4c('0x8d')]===_0xea4c('0x5d')?_0xf606da[_0xea4c('0x7b')]?_0xf606da[_0xea4c('0x7b')][_0xea4c('0x52')]:'System':_0xf606da[_0xea4c('0x60')]['firstName']+(_0xf606da[_0xea4c('0x60')][_0xea4c('0xcf')]?'\x20'+_0xf606da[_0xea4c('0x60')][_0xea4c('0xcf')]:''),'body':_0xf606da[_0xea4c('0x6b')]?_0xf606da[_0xea4c('0x6b')][_0xea4c('0x73')]:_0xf606da[_0xea4c('0x2e')],'direction':_0xf606da[_0xea4c('0x8d')]===_0xea4c('0x5d')?'A':'C','secret':_0xf606da[_0xea4c('0x8e')],'read':_0xf606da['read'],'attachment':_0xf606da[_0xea4c('0x6b')]};})['value']()};return ejs[_0xea4c('0xd0')](path['join'](config['root'],'server','views',_0xea4c('0xd1')),{'interaction':_0x27a32e})[_0xea4c('0x17')](function(_0x325b40){var _0xa138f2=path[_0xea4c('0x6f')](_0x5bf231,_0xea4c('0xd2')+_0xbed595['id']+'-'+_0x47075e+_0xea4c('0xd3'));var _0x3077bd={'path':_0xa138f2,'channel':'Chat','interactionId':_0xbed595['id']};return pdf[_0xea4c('0xd4')](_0x325b40,_0x3077bd);})[_0xea4c('0x17')](function(){return new Promise(function(_0x16bde9,_0x2fbc40){zipdir(_0x5bf231,{'saveTo':_0x278138},function(_0x451b69,_0x2b23eb){if(_0x451b69)return _0x2fbc40(_0x451b69);return _0x16bde9(_0x2b23eb);});})['then'](function(){return new BPromise(function(_0x5d1b8f,_0x1bb394){rimraf(_0x5bf231,function(_0x8812e5){if(_0x8812e5)_0x1bb394(_0x8812e5);return _0x5d1b8f();});});})[_0xea4c('0x17')](function(){return _0xefc6ed[_0xea4c('0x74')](_0x278138,_0x1329ae,function(_0x5aa74f){if(_0x5aa74f){logger[_0xea4c('0x1a')]('err',_0x5aa74f);}else{fs[_0xea4c('0xd5')](_0x278138);}});});});}else{return _0xefc6ed[_0xea4c('0x1f')](0xc8);}})['catch'](handleError(_0xefc6ed,null));}; \ No newline at end of file +var _0xc673=['vidaooTopic','vidaooNote','vidaooMetadata','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','updateAttributes','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','sendStatus','UserId','disposition','attachmentUpload','file','originalname','filename','mimetype','attachmentDownload','closed','Unauthorized','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','close','mailTranscript','transcript-%s.txt','pathTranscript','User','ContactId','length','format','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ChatMessage','ids','omit','getMessages','keys','hasOwnProperty','nolimit','limit','order','sort','pick','where','filter','$gte','split','options','rows','getMyMessages','includeAgent','alias','addTags','setTags','spread','color','emit','removeTags','download','unix','toString','server','files','attachments','transcript-%d-%s.zip','push','lastName','Messages','read','ChatWebsite','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','YYYY-MM-DD\x20HH:mm:ss','osName','referer','customerIp','customerPort','tail','Attachment','pipe','firstName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','request-promise','mustache','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','register','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','status','json','undefined','count','offset','set','Content-Range','destroy','name','render','merge','body','agent','interaction','account','map','ChatInteraction','fieldName','type','findAll','chat','query','user','show','params','model','rawAttributes','filters','intersection','attributes','fields','includeAll','include','find','create','update','describe','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation'];(function(_0x1ba857,_0xd9b7d9){var _0x255072=function(_0xddb0ce){while(--_0xddb0ce){_0x1ba857['push'](_0x1ba857['shift']());}};_0x255072(++_0xd9b7d9);}(_0xc673,0x159));var _0x3c67=function(_0x2467c3,_0x29d8fb){_0x2467c3=_0x2467c3-0x0;var _0x19b262=_0xc673[_0x2467c3];return _0x19b262;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x3c67('0x0'));var rp=require(_0x3c67('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3c67('0x2'));var util=require(_0x3c67('0x3'));var path=require(_0x3c67('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3c67('0x5'));var Redis=require('ioredis');var interaction=require(_0x3c67('0x6'));var qs=require(_0x3c67('0x7'));var pdf=require(_0x3c67('0x8'));var logger=require(_0x3c67('0x9'))(_0x3c67('0xa'));var config=require(_0x3c67('0xb'));var db=require(_0x3c67('0xc'))['db'];config['redis']=_[_0x3c67('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3c67('0xe'))(new Redis(config[_0x3c67('0xf')]));require('./chatInteraction.socket')[_0x3c67('0x10')](socket);var jayson=require(_0x3c67('0x11'));var client=jayson[_0x3c67('0x12')]['http']({'port':0x232b});var client9004=jayson[_0x3c67('0x12')][_0x3c67('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x1cd4dd,_0x2ffc18,_0x4d9f6a,_0x3ff34a){return new BPromise(function(_0x43ef2b,_0x3d6c3d){var _0x477ad9=_0x3ff34a||client;return _0x477ad9[_0x3c67('0x14')](_0x1cd4dd,_0x4d9f6a)[_0x3c67('0x15')](function(_0x25a9b2){logger['info'](_0x3c67('0x16'),_0x2ffc18,_0x3c67('0x17'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2ffc18,_0x3c67('0x17'),JSON['stringify'](_0x25a9b2));if(_0x25a9b2[_0x3c67('0x18')]){if(_0x25a9b2[_0x3c67('0x18')][_0x3c67('0x19')]===0x1f4){logger['error'](_0x3c67('0x16'),_0x2ffc18,_0x25a9b2[_0x3c67('0x18')]['message']);return _0x3d6c3d(_0x25a9b2['error'][_0x3c67('0x1a')]);}logger[_0x3c67('0x18')](_0x3c67('0x16'),_0x2ffc18,_0x25a9b2[_0x3c67('0x18')][_0x3c67('0x1a')]);return _0x43ef2b(_0x25a9b2[_0x3c67('0x18')][_0x3c67('0x1a')]);}else{logger[_0x3c67('0x1b')](_0x3c67('0x16'),_0x2ffc18,'request\x20sent');_0x43ef2b(_0x25a9b2[_0x3c67('0x1c')][_0x3c67('0x1a')]);}})[_0x3c67('0x1d')](function(_0x52bc48){logger[_0x3c67('0x18')](_0x3c67('0x16'),_0x2ffc18,_0x52bc48);_0x3d6c3d(_0x52bc48);});});}function respondWithStatusCode(_0x1cbc54,_0x604ad0){_0x604ad0=_0x604ad0||0xcc;return function(_0x5dc4b2){if(_0x5dc4b2){return _0x1cbc54['sendStatus'](_0x604ad0);}return _0x1cbc54[_0x3c67('0x1e')](_0x604ad0)['end']();};}function respondWithResult(_0x1dc63c,_0x1c1e92){_0x1c1e92=_0x1c1e92||0xc8;return function(_0x17fa56){if(_0x17fa56){return _0x1dc63c[_0x3c67('0x1e')](_0x1c1e92)[_0x3c67('0x1f')](_0x17fa56);}};}function respondWithFilteredResult(_0x41feb6,_0x1d70fd){return function(_0x342b79){if(_0x342b79){var _0x105218=typeof _0x1d70fd['offset']==='undefined'&&typeof _0x1d70fd['limit']===_0x3c67('0x20');var _0xe562d6=_0x342b79[_0x3c67('0x21')];var _0x3b75dc=_0x105218?0x0:_0x1d70fd[_0x3c67('0x22')];var _0x213a5c=_0x105218?_0x342b79[_0x3c67('0x21')]:_0x1d70fd[_0x3c67('0x22')]+_0x1d70fd['limit'];var _0x349d8e;if(_0x213a5c>=_0xe562d6){_0x213a5c=_0xe562d6;_0x349d8e=0xc8;}else{_0x349d8e=0xce;}_0x41feb6[_0x3c67('0x1e')](_0x349d8e);return _0x41feb6[_0x3c67('0x23')](_0x3c67('0x24'),_0x3b75dc+'-'+_0x213a5c+'/'+_0xe562d6)[_0x3c67('0x1f')](_0x342b79);}return null;};}function saveUpdates(_0x374055){return function(_0xe5d52f){if(_0xe5d52f){return _0xe5d52f['update'](_0x374055)[_0x3c67('0x15')](function(_0xa8c9a4){return _0xa8c9a4;});}return null;};}function removeEntity(_0x48626d){return function(_0xdf54f2){if(_0xdf54f2){return _0xdf54f2[_0x3c67('0x25')]()[_0x3c67('0x15')](function(){_0x48626d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269133){return function(_0x105271){if(!_0x105271){_0x269133['sendStatus'](0x194);}return _0x105271;};}function handleError(_0x5e4730,_0x192c36){_0x192c36=_0x192c36||0x1f4;return function(_0x34ea66){logger['error'](_0x34ea66['stack']);if(_0x34ea66[_0x3c67('0x26')]){delete _0x34ea66[_0x3c67('0x26')];}_0x5e4730['status'](_0x192c36)['send'](_0x34ea66);};}function getMustacheRender(_0x319bf4,_0x1d5a35){return Mustache[_0x3c67('0x27')](_0x319bf4,_[_0x3c67('0x28')](_0x1d5a35[_0x3c67('0x29')],{'contact':_0x1d5a35['contact'],'message':_0x1d5a35[_0x3c67('0x1a')],'agent':_0x1d5a35[_0x3c67('0x2a')],'interaction':_0x1d5a35[_0x3c67('0x2b')],'account':_0x1d5a35[_0x3c67('0x2c')]}))||'';}exports['index']=function(_0x159b69,_0x306002){var _0xcb862={};var _0x410349=_[_0x3c67('0x2d')](db[_0x3c67('0x2e')]['rawAttributes'],function(_0x5274e5){return{'name':_0x5274e5[_0x3c67('0x2f')],'type':_0x5274e5[_0x3c67('0x30')]['key']};});_0xcb862=qs['getOptions'](_0x410349,_0x159b69);return interaction[_0x3c67('0x31')](_0x3c67('0x32'),_0x159b69[_0x3c67('0x33')],_0x159b69[_0x3c67('0x34')],_0xcb862,_0x410349)[_0x3c67('0x15')](respondWithFilteredResult(_0x306002,_0xcb862))[_0x3c67('0x1d')](handleError(_0x306002,null));};exports[_0x3c67('0x35')]=function(_0x4ab912,_0x3fa80c){var _0x361395={'raw':![],'where':{'id':_0x4ab912[_0x3c67('0x36')]['id']}},_0x5b6f53={};_0x5b6f53[_0x3c67('0x37')]=_['keys'](db[_0x3c67('0x2e')][_0x3c67('0x38')]);_0x5b6f53[_0x3c67('0x33')]=_['keys'](_0x4ab912[_0x3c67('0x33')]);_0x5b6f53[_0x3c67('0x39')]=_[_0x3c67('0x3a')](_0x5b6f53[_0x3c67('0x37')],_0x5b6f53[_0x3c67('0x33')]);_0x361395[_0x3c67('0x3b')]=_['intersection'](_0x5b6f53[_0x3c67('0x37')],qs[_0x3c67('0x3c')](_0x4ab912['query'][_0x3c67('0x3c')]));_0x361395[_0x3c67('0x3b')]=_0x361395[_0x3c67('0x3b')]['length']?_0x361395[_0x3c67('0x3b')]:_0x5b6f53[_0x3c67('0x37')];if(_0x4ab912[_0x3c67('0x33')][_0x3c67('0x3d')]){_0x361395[_0x3c67('0x3e')]=[{'all':!![]}];}_0x361395=_[_0x3c67('0x28')]({},_0x361395,_0x4ab912['options']);return db[_0x3c67('0x2e')][_0x3c67('0x3f')](_0x361395)[_0x3c67('0x15')](handleEntityNotFound(_0x3fa80c,null))[_0x3c67('0x15')](respondWithResult(_0x3fa80c,null))[_0x3c67('0x1d')](handleError(_0x3fa80c,null));};exports[_0x3c67('0x40')]=function(_0x177e20,_0x42c05e){return db['ChatInteraction'][_0x3c67('0x40')](_0x177e20[_0x3c67('0x29')],{})[_0x3c67('0x15')](respondWithResult(_0x42c05e,0xc9))[_0x3c67('0x1d')](handleError(_0x42c05e,null));};exports[_0x3c67('0x41')]=function(_0x53902a,_0x1d05a2){if(_0x53902a[_0x3c67('0x29')]['id']){delete _0x53902a[_0x3c67('0x29')]['id'];}return db[_0x3c67('0x2e')][_0x3c67('0x3f')]({'where':{'id':_0x53902a[_0x3c67('0x36')]['id']}})[_0x3c67('0x15')](handleEntityNotFound(_0x1d05a2,null))['then'](saveUpdates(_0x53902a['body'],null))['then'](respondWithResult(_0x1d05a2,null))[_0x3c67('0x1d')](handleError(_0x1d05a2,null));};exports[_0x3c67('0x25')]=function(_0x285046,_0x231f34){return db[_0x3c67('0x2e')][_0x3c67('0x3f')]({'where':{'id':_0x285046['params']['id']}})['then'](handleEntityNotFound(_0x231f34,null))[_0x3c67('0x15')](removeEntity(_0x231f34,null))['catch'](handleError(_0x231f34,null));};exports[_0x3c67('0x42')]=function(_0x510910,_0x150e73){return db['ChatInteraction'][_0x3c67('0x42')]()['then'](respondWithResult(_0x150e73,null))['catch'](handleError(_0x150e73,null));};exports['createVidaooSession']=function(_0x5903dc,_0x4bf3e1){var _0x113ddb=_0x5903dc[_0x3c67('0x36')]['id'];var _0x51aa77;var _0x2350d;var _0x3055f9;return db[_0x3c67('0x2e')]['findOne']({'where':{'id':_0x113ddb}})[_0x3c67('0x15')](function(_0x1d8a74){_0x51aa77=_0x1d8a74;return db['ChatWebsite'][_0x3c67('0x43')]({'where':{'id':_0x1d8a74[_0x3c67('0x44')]},'attributes':['id',_0x3c67('0x45'),_0x3c67('0x46'),_0x3c67('0x47'),_0x3c67('0x48'),_0x3c67('0x49')],'raw':!![]});})[_0x3c67('0x15')](function(_0x224d7f){if(_0x224d7f&&_0x224d7f[_0x3c67('0x45')]&&_0x224d7f['vidaooEscalation']){_0x2350d=_0x224d7f;var _0x1d18aa={'interaction':{'id':_0x113ddb},'agent':{'id':_0x5903dc[_0x3c67('0x34')]['id'],'name':_0x5903dc[_0x3c67('0x34')]['name'],'fullname':_0x5903dc[_0x3c67('0x34')]['fullname'],'email':_0x5903dc[_0x3c67('0x34')][_0x3c67('0x4a')]},'contact':_0x5903dc['body'][_0x3c67('0x4b')],'account':_0x5903dc[_0x3c67('0x29')][_0x3c67('0x2c')]};var _0x58c177={'rejectUnauthorized':![],'method':_0x3c67('0x4c'),'url':_0x3c67('0x4d'),'headers':{'X-APIKEY':_0x224d7f[_0x3c67('0x45')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5903dc['user'][_0x3c67('0x4a')]],'buttons':null,'topic':_0x2350d[_0x3c67('0x47')],'note':_[_0x3c67('0x4e')](_0x2350d['vidaooNote'])?null:getMustacheRender(_0x2350d[_0x3c67('0x48')],_0x1d18aa),'metadata':null},'redirect':_0x3c67('0x4f'),'json':!![]};try{if(!_[_0x3c67('0x4e')](_0x2350d[_0x3c67('0x49')])){var _0x280f93=getMustacheRender(_0x2350d['vidaooMetadata'],_0x1d18aa);var _0x25430d=JSON[_0x3c67('0x50')](_0x280f93);_0x58c177[_0x3c67('0x29')][_0x3c67('0x51')]=_0x25430d;}}catch(_0x5cb44c){throw new db[(_0x3c67('0x52'))][(_0x3c67('0x53'))](_0x3c67('0x54'));}return rp(_0x58c177);}else{throw new db[(_0x3c67('0x52'))][(_0x3c67('0x53'))](_0x3c67('0x55'));}})[_0x3c67('0x15')](function(_0x8f4f42){_0x3055f9=_0x8f4f42;if(_0x3055f9['id']){var _0x33bf86={'body':_0x3055f9[_0x3c67('0x56')],'ChatWebsiteId':_0x2350d['id'],'ChatInteractionId':_0x51aa77['id'],'direction':_0x3c67('0x57'),'UserId':_0x5903dc[_0x3c67('0x34')]['id']};return db['ChatMessage'][_0x3c67('0x40')](_0x33bf86,{});}else{throw new db[(_0x3c67('0x52'))][(_0x3c67('0x53'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x3c67('0x15')](function(){return _0x51aa77[_0x3c67('0x58')]({'vidaooSessionId':_0x3055f9['id']});})[_0x3c67('0x15')](respondWithResult(_0x4bf3e1,null))[_0x3c67('0x1d')](handleError(_0x4bf3e1,null));};exports[_0x3c67('0x59')]=function(_0x16d735,_0x4d79bc){if(_0x16d735[_0x3c67('0x29')]['id']){delete _0x16d735['body']['id'];}return db[_0x3c67('0x2e')][_0x3c67('0x3f')]({'where':{'id':_0x16d735['params']['id']},'include':[{'model':db[_0x3c67('0x5a')],'as':_0x3c67('0x5b')}]})[_0x3c67('0x15')](handleEntityNotFound(_0x4d79bc,null))[_0x3c67('0x15')](saveUpdates(_0x16d735[_0x3c67('0x29')],null))[_0x3c67('0x15')](respondWithResult(_0x4d79bc,null))[_0x3c67('0x1d')](handleError(_0x4d79bc,null));};exports['abandon']=function(_0x29eb2e,_0xf862d1){if(_0x29eb2e[_0x3c67('0x29')]['id']){delete _0x29eb2e[_0x3c67('0x29')]['id'];}return db[_0x3c67('0x2e')][_0x3c67('0x3f')]({'where':{'id':_0x29eb2e[_0x3c67('0x36')]['id']}})['then'](function(_0xa552cc){if(!_0xa552cc){logger['error'](_0x3c67('0x5c'),_0x3c67('0x5d'),0x194,_0x3c67('0x5e'));_0xf862d1[_0x3c67('0x5f')](0x194);}else{if(_0xa552cc[_0x3c67('0x60')]){throw new db[(_0x3c67('0x52'))][(_0x3c67('0x53'))]('Interaction\x20already\x20assigned');}}return _0xa552cc;})[_0x3c67('0x15')](function(_0xd6aa93){if(_0xd6aa93){return _0xd6aa93[_0x3c67('0x41')]({'closed':_0x29eb2e[_0x3c67('0x29')]['closed'],'disposition':_0x29eb2e['body'][_0x3c67('0x61')]})[_0x3c67('0x15')](function(_0x477f1c){return _0x477f1c;});}})[_0x3c67('0x15')](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0x29eb2e[_0x3c67('0x29')],client9004);})[_0x3c67('0x15')](respondWithResult(_0xf862d1,null))[_0x3c67('0x1d')](handleError(_0xf862d1,null));};exports[_0x3c67('0x62')]=function(_0x1152ab,_0x2593d2){_0x1152ab[_0x3c67('0x29')][_0x3c67('0x26')]=_0x1152ab[_0x3c67('0x63')][_0x3c67('0x64')];_0x1152ab[_0x3c67('0x29')]['basename']=_0x1152ab[_0x3c67('0x63')][_0x3c67('0x65')];_0x1152ab['body'][_0x3c67('0x30')]=_0x1152ab[_0x3c67('0x63')][_0x3c67('0x66')];return db['Attachment']['create'](_0x1152ab['body'])[_0x3c67('0x15')](respondWithResult(_0x2593d2,0xc9))[_0x3c67('0x1d')](handleError(_0x2593d2,null));};exports[_0x3c67('0x67')]=function(_0x42d2b3,_0x11ee72){return db['ChatInteraction'][_0x3c67('0x43')]({'where':{'id':_0x42d2b3[_0x3c67('0x36')]['id']},'raw':!![]})[_0x3c67('0x15')](handleEntityNotFound(_0x11ee72,null))[_0x3c67('0x15')](function(_0x16f3bf){if(_0x16f3bf){if(_0x16f3bf[_0x3c67('0x68')]){return _0x11ee72[_0x3c67('0x1e')](0x193)[_0x3c67('0x1f')]({'status':0x193,'message':_0x3c67('0x69')});}return db['Attachment'][_0x3c67('0x43')]({'where':{'id':_0x42d2b3['query']['attachId']},'raw':!![]})[_0x3c67('0x15')](handleEntityNotFound(_0x11ee72,null));}})[_0x3c67('0x15')](function(_0x4d76f1){if(_0x4d76f1){var _0x4e4e6e=_0x4d76f1[_0x3c67('0x6a')]!==null;var _0x417635=path[_0x3c67('0x6b')](config[_0x3c67('0x6c')],_0x3c67('0x6d'));if(_0x4e4e6e){_0x417635=path[_0x3c67('0x6b')](_0x417635,_0x3c67('0x6e'));}var _0x528e4b=path[_0x3c67('0x6b')](_0x417635,_0x4d76f1[_0x3c67('0x6f')]);return _0x11ee72['download'](_0x528e4b);}})['catch'](handleError(_0x11ee72,null));};exports[_0x3c67('0x70')]=function(_0xdffbfb,_0x327e1c){var _0x3485c4=null;var _0x5fbe9d=null;var _0x1579fc=null;if(_0xdffbfb[_0x3c67('0x29')]['id']){delete _0xdffbfb[_0x3c67('0x29')]['id'];}if(_0xdffbfb[_0x3c67('0x29')][_0x3c67('0x71')]){_0x1579fc=path[_0x3c67('0x6b')](config[_0x3c67('0x6c')],'server/files/chat/upload/',util['format'](_0x3c67('0x72'),Date['now']()));_0xdffbfb[_0x3c67('0x29')][_0x3c67('0x73')]=_0x1579fc;}return db[_0x3c67('0x2e')][_0x3c67('0x3f')]({'where':{'id':_0xdffbfb['params']['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db['User'],'as':_0x3c67('0x74')}]}]})[_0x3c67('0x15')](handleEntityNotFound(_0x327e1c,null))[_0x3c67('0x15')](saveUpdates(_0xdffbfb[_0x3c67('0x29')],null))[_0x3c67('0x15')](function(_0x3d1df7){if(_0x3d1df7){_0x3485c4=_0x3d1df7;return db['ChatWebsite']['find']({'where':{'id':_0x3485c4[_0x3c67('0x44')]}});}})[_0x3c67('0x15')](function(_0x397d48){if(_0x397d48){_0x5fbe9d=_0x397d48;return db[_0x3c67('0x5a')][_0x3c67('0x3f')]({'where':{'id':_0x3485c4[_0x3c67('0x75')]}});}})[_0x3c67('0x15')](function(_0x520ca4){if(_0x520ca4){if(_0x1579fc){var _0x51ee4c=null;for(var _0x6be2f9=0x1;_0x6be2f9<_0x3485c4['Messages'][_0x3c67('0x76')];++_0x6be2f9){_0x51ee4c=_0x3485c4['Messages'][_0x6be2f9];var _0x2482b2=_0x51ee4c[_0x3c67('0x60')]?util[_0x3c67('0x77')](_0x3c67('0x78'),_0x5fbe9d['agentAlias'],_0x51ee4c[_0x3c67('0x60')]):_0x3c67('0x79');var _0x13e12b=_0xdffbfb[_0x3c67('0x29')][_0x3c67('0x7a')]||util[_0x3c67('0x77')](_0x3c67('0x78'),_0x3c67('0x7b'),_0x51ee4c[_0x3c67('0x75')]);switch(_0x5fbe9d[_0x3c67('0x7c')]){case _0x3c67('0x7d'):_0x2482b2=_0x51ee4c[_0x3c67('0x60')]?util[_0x3c67('0x77')]('%s%d',_0x5fbe9d[_0x3c67('0x7e')],_0x51ee4c[_0x3c67('0x60')]):_0x3c67('0x79');break;case _0x3c67('0x7f'):_0x2482b2=_0x51ee4c[_0x3c67('0x60')]?_0x51ee4c[_0x3c67('0x74')]['alias']||_0x51ee4c[_0x3c67('0x74')][_0x3c67('0x80')]:_0x3c67('0x79');break;case _0x3c67('0x81'):_0x2482b2=_0x51ee4c[_0x3c67('0x60')]?_0x51ee4c[_0x3c67('0x74')][_0x3c67('0x80')]:_0x3c67('0x79');break;default:_0x2482b2=_0x51ee4c[_0x3c67('0x60')]?util[_0x3c67('0x77')]('%s%d',_0x5fbe9d[_0x3c67('0x7e')],_0x51ee4c[_0x3c67('0x60')]):_0x3c67('0x79');}var _0x427f90=util['format'](_0x3c67('0x82'),moment(_0x51ee4c[_0x3c67('0x83')])[_0x3c67('0x77')](_0x3c67('0x84')),_0x51ee4c[_0x3c67('0x85')]==='in'?_0x13e12b:_0x2482b2,_0x51ee4c[_0x3c67('0x29')]);if(!_0x51ee4c[_0x3c67('0x86')]){fs[_0x3c67('0x87')](_0x1579fc,_0x427f90);}}return db[_0x3c67('0x88')][_0x3c67('0x43')]({'where':{'service':!![]},'include':[{'model':db[_0x3c67('0x89')],'as':_0x3c67('0x8a'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x3c67('0x15')](function(_0x1761e4){if(!_0x1761e4||!_0x1761e4[_0x3c67('0x8a')]||!_0xdffbfb[_0x3c67('0x29')])return _0x3485c4;var _0x196790=_0x1761e4[_0x3c67('0x8b')]();return respondWithRpcPromise(_0x3c67('0x8c'),_0x3c67('0x8d'),{'account':_0x196790,'message':{'from':util[_0x3c67('0x77')](_0x3c67('0x8e'),_0x1761e4[_0x3c67('0x26')],_0x1761e4[_0x3c67('0x4a')]||_0x1761e4[_0x3c67('0x8a')][_0x3c67('0x34')]),'to':_0xdffbfb[_0x3c67('0x29')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util['format'](_0x3c67('0x8f'),_0xdffbfb[_0x3c67('0x29')][_0x3c67('0x71')]),'attachments':[{'path':_0x1579fc}]}})['then'](function(){return _0x3485c4;})[_0x3c67('0x1d')](function(_0x4352e6){logger[_0x3c67('0x18')](_0x4352e6);});})[_0x3c67('0x15')](respondWithStatusCode(_0x327e1c,0xc8))['catch'](handleError(_0x327e1c,null));};exports[_0x3c67('0x90')]=function(_0x539d54,_0x39b5ec){return db[_0x3c67('0x91')][_0x3c67('0x3f')]({'where':{'id':_0x539d54['params']['id']}})[_0x3c67('0x15')](handleEntityNotFound(_0x39b5ec,null))[_0x3c67('0x15')](function(_0x432faf){if(_0x432faf){return _0x432faf[_0x3c67('0x90')](_0x539d54[_0x3c67('0x29')][_0x3c67('0x92')],_[_0x3c67('0x93')](_0x539d54[_0x3c67('0x29')],[_0x3c67('0x92'),'id'])||{});}})[_0x3c67('0x15')](respondWithResult(_0x39b5ec,null))['catch'](handleError(_0x39b5ec,null));};exports[_0x3c67('0x94')]=function(_0x3e3507,_0x30347d){var _0x33d902={'raw':![],'where':{}};var _0xcd4720={};var _0x2e25dc={'count':0x0,'rows':[]};return db[_0x3c67('0x2e')][_0x3c67('0x43')]({'where':{'id':_0x3e3507[_0x3c67('0x36')]['id']}})[_0x3c67('0x15')](handleEntityNotFound(_0x30347d,null))['then'](function(_0x2404dc){if(_0x2404dc){_0xcd4720[_0x3c67('0x37')]=_[_0x3c67('0x95')](db[_0x3c67('0x91')][_0x3c67('0x38')]);_0xcd4720[_0x3c67('0x33')]=_['keys'](_0x3e3507['query']);_0xcd4720['filters']=_[_0x3c67('0x3a')](_0xcd4720[_0x3c67('0x37')],_0xcd4720[_0x3c67('0x33')]);_0x33d902[_0x3c67('0x3b')]=_['intersection'](_0xcd4720[_0x3c67('0x37')],qs['fields'](_0x3e3507[_0x3c67('0x33')][_0x3c67('0x3c')]));_0x33d902[_0x3c67('0x3b')]=_0x33d902['attributes'][_0x3c67('0x76')]?_0x33d902['attributes']:_0xcd4720['model'];if(!_0x3e3507[_0x3c67('0x33')][_0x3c67('0x96')](_0x3c67('0x97'))){_0x33d902['limit']=qs[_0x3c67('0x98')](_0x3e3507['query']['limit']);_0x33d902[_0x3c67('0x22')]=qs[_0x3c67('0x22')](_0x3e3507[_0x3c67('0x33')][_0x3c67('0x22')]);}_0x33d902[_0x3c67('0x99')]=qs[_0x3c67('0x9a')](_0x3e3507[_0x3c67('0x33')][_0x3c67('0x9a')]);_0x33d902['where']=qs['filters'](_[_0x3c67('0x9b')](_0x3e3507[_0x3c67('0x33')],_0xcd4720[_0x3c67('0x39')]));_0x33d902[_0x3c67('0x9c')]['ChatInteractionId']=_0x2404dc['id'];if(_0x3e3507[_0x3c67('0x33')]['filter']){_0x33d902['where']=_[_0x3c67('0x28')](_0x33d902[_0x3c67('0x9c')],{'$or':_[_0x3c67('0x2d')](_0x33d902[_0x3c67('0x3b')],function(_0x3fadfa){var _0x258f8d={};_0x258f8d[_0x3fadfa]={'$like':'%'+_0x3e3507['query'][_0x3c67('0x9d')]+'%'};return _0x258f8d;})});}if(_0x3e3507['query'][_0x3c67('0x9e')]){var _0x454a60=_0x3e3507[_0x3c67('0x33')][_0x3c67('0x9e')][_0x3c67('0x9f')](',');var _0x7ec8e6={};_0x7ec8e6[_0x454a60[0x0]]={'$gte':moment(_0x454a60[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x33d902['where']=_[_0x3c67('0x28')](_0x33d902[_0x3c67('0x9c')],_0x7ec8e6);}_0x33d902=_['merge']({},_0x33d902,_0x3e3507[_0x3c67('0xa0')]);return db['ChatMessage'][_0x3c67('0x21')]({'where':_0x33d902[_0x3c67('0x9c')]})['then'](function(_0x567f0b){_0x2e25dc['count']=_0x567f0b;if(_0x3e3507[_0x3c67('0x33')][_0x3c67('0x3d')]){_0x33d902[_0x3c67('0x3e')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x33d902);})['then'](function(_0x5568e1){_0x2e25dc[_0x3c67('0xa1')]=_0x5568e1;return _0x2e25dc;});}})[_0x3c67('0x15')](respondWithFilteredResult(_0x30347d,_0x33d902))[_0x3c67('0x1d')](handleError(_0x30347d,null));};exports[_0x3c67('0xa2')]=function(_0x2dc92f,_0x49b8ed){var _0xe3b037={'where':{}},_0xe32a8a={},_0x518169={'count':0x0,'rows':[]};return db[_0x3c67('0x2e')][_0x3c67('0x43')]({'where':{'id':_0x2dc92f[_0x3c67('0x36')]['id']}})['then'](handleEntityNotFound(_0x49b8ed,null))[_0x3c67('0x15')](function(_0x3b8c5f){if(_0x3b8c5f){_0xe32a8a[_0x3c67('0x37')]=_[_0x3c67('0x95')](db['ChatMessage']['rawAttributes']);_0xe32a8a[_0x3c67('0x33')]=_[_0x3c67('0x95')](_0x2dc92f['query']);_0xe32a8a[_0x3c67('0x39')]=_[_0x3c67('0x3a')](_0xe32a8a[_0x3c67('0x37')],_0xe32a8a[_0x3c67('0x33')]);_0xe3b037[_0x3c67('0x3b')]=_[_0x3c67('0x3a')](_0xe32a8a['model'],qs[_0x3c67('0x3c')](_0x2dc92f['query'][_0x3c67('0x3c')]));_0xe3b037[_0x3c67('0x3b')]=_0xe3b037[_0x3c67('0x3b')][_0x3c67('0x76')]?_0xe3b037[_0x3c67('0x3b')]:_0xe32a8a[_0x3c67('0x37')];if(!_0x2dc92f[_0x3c67('0x33')][_0x3c67('0x96')](_0x3c67('0x97'))){_0xe3b037[_0x3c67('0x98')]=qs[_0x3c67('0x98')](_0x2dc92f['query'][_0x3c67('0x98')]);_0xe3b037['offset']=qs[_0x3c67('0x22')](_0x2dc92f[_0x3c67('0x33')][_0x3c67('0x22')]);}_0xe3b037[_0x3c67('0x99')]=qs[_0x3c67('0x9a')](_0x2dc92f[_0x3c67('0x33')]['sort']);_0xe3b037['where']=qs[_0x3c67('0x39')](_[_0x3c67('0x9b')](_0x2dc92f[_0x3c67('0x33')],_0xe32a8a['filters']));_0xe3b037['where']['ChatInteractionId']=_0x3b8c5f['id'];if(_0x2dc92f[_0x3c67('0x33')]['filter']){_0xe3b037[_0x3c67('0x9c')]=_[_0x3c67('0x28')](_0xe3b037[_0x3c67('0x9c')],{'$or':_['map'](_0xe3b037[_0x3c67('0x3b')],function(_0x6e1939){var _0x3eac02={};_0x3eac02[_0x6e1939]={'$like':'%'+_0x2dc92f['query']['filter']+'%'};return _0x3eac02;})});}_0xe3b037['where']['secret']=![];if(_0x2dc92f[_0x3c67('0x33')]['id']){_0xe3b037[_0x3c67('0x9c')]['id']={'$gt':_0x2dc92f[_0x3c67('0x33')]['id']};}_0xe3b037=_['merge']({},_0xe3b037,_0x2dc92f[_0x3c67('0xa0')]);return db['ChatMessage']['count']({'where':_0xe3b037['where']})[_0x3c67('0x15')](function(_0x3baa9c){_0x518169[_0x3c67('0x21')]=_0x3baa9c;_0xe3b037[_0x3c67('0x3e')]=[];if(_0x2dc92f[_0x3c67('0x33')][_0x3c67('0xa3')]){_0xe3b037[_0x3c67('0x3e')]['push']({'model':db[_0x3c67('0x74')],'as':'User','attributes':['id','fullname',_0x3c67('0xa4')]});}if(_0x2dc92f[_0x3c67('0x33')][_0x3c67('0x3d')]){_0xe3b037[_0x3c67('0x3e')]=[{'all':!![]}];}return db['ChatMessage'][_0x3c67('0x31')](_0xe3b037);})[_0x3c67('0x15')](function(_0x5bc87d){_0x518169[_0x3c67('0xa1')]=_0x5bc87d;return _0x518169;});}})[_0x3c67('0x15')](respondWithFilteredResult(_0x49b8ed,_0xe3b037))['catch'](handleError(_0x49b8ed,null));};exports[_0x3c67('0xa5')]=function(_0x3ebd3a,_0x5bf022){return db[_0x3c67('0x2e')][_0x3c67('0x3f')]({'where':{'id':_0x3ebd3a[_0x3c67('0x36')]['id']}})[_0x3c67('0x15')](handleEntityNotFound(_0x5bf022,null))[_0x3c67('0x15')](function(_0x77eec2){if(_0x77eec2){return _0x77eec2[_0x3c67('0xa6')](_0x3ebd3a[_0x3c67('0x29')][_0x3c67('0x92')],_[_0x3c67('0x93')](_0x3ebd3a[_0x3c67('0x29')],[_0x3c67('0x92'),'id'])||{})[_0x3c67('0xa7')](function(){return db['Tag'][_0x3c67('0x31')]({'attributes':['id',_0x3c67('0x26'),_0x3c67('0xa8')],'where':{'id':_0x3ebd3a['body'][_0x3c67('0x92')]}});})[_0x3c67('0x15')](function(_0x11c35c){socket[_0x3c67('0xa9')]('chatInteractionTags:save',{'id':Number(_0x3ebd3a['params']['id']),'tags':_0x11c35c||[]});return{'id':Number(_0x3ebd3a[_0x3c67('0x36')]['id']),'tags':_0x11c35c||[]};});}})['then'](respondWithResult(_0x5bf022,null))['catch'](handleError(_0x5bf022,null));};exports[_0x3c67('0xaa')]=function(_0xe144f9,_0x587bef){return db[_0x3c67('0x2e')][_0x3c67('0x3f')]({'where':{'id':_0xe144f9[_0x3c67('0x36')]['id']}})[_0x3c67('0x15')](handleEntityNotFound(_0x587bef,null))['then'](function(_0x9304cd){if(_0x9304cd){return _0x9304cd['removeTags'](_0xe144f9[_0x3c67('0x33')][_0x3c67('0x92')]);}})[_0x3c67('0x15')](respondWithStatusCode(_0x587bef,null))['catch'](handleError(_0x587bef,null));};exports[_0x3c67('0xab')]=function(_0x252f9d,_0x5be9e7){var _0x83a96d=moment()[_0x3c67('0xac')]()[_0x3c67('0xad')]();var _0x5827fe=path[_0x3c67('0x6b')](config[_0x3c67('0x6c')],_0x3c67('0xae'),_0x3c67('0xaf'),'tmp');var _0x1eb719=path['join'](config[_0x3c67('0x6c')],_0x3c67('0xae'),_0x3c67('0xaf'),_0x3c67('0xb0'));var _0x1b16dc=path[_0x3c67('0x6b')](_0x5827fe,_0x83a96d);var _0xdee6fa=util[_0x3c67('0x77')](_0x3c67('0xb1'),_0x252f9d[_0x3c67('0x36')]['id'],_0x83a96d);var _0x4ab6b1=path[_0x3c67('0x6b')](_0x5827fe,_0xdee6fa);var _0x396aff=[];_0x396aff['push']({'model':db[_0x3c67('0x74')],'as':'User','attributes':['id',_0x3c67('0x80')],'raw':!![]});_0x396aff[_0x3c67('0xb2')]({'model':db[_0x3c67('0x5a')],'as':_0x3c67('0x5b'),'attributes':['id','firstName',_0x3c67('0xb3')],'raw':!![]});if(_0x252f9d[_0x3c67('0x33')]['attachments']){_0x396aff[_0x3c67('0xb2')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x49ef57=[{'model':db[_0x3c67('0x91')],'as':_0x3c67('0xb4'),'attributes':['id','body',_0x3c67('0x83'),'direction','secret',_0x3c67('0xb5')],'include':_0x396aff}];_0x49ef57[_0x3c67('0xb2')]({'model':db[_0x3c67('0xb6')],'as':_0x3c67('0xb7'),'attributes':['id',_0x3c67('0x26')]});_0x49ef57[_0x3c67('0xb2')]({'model':db[_0x3c67('0x74')],'as':_0x3c67('0xb8'),'attributes':['id',_0x3c67('0x80')]});return db[_0x3c67('0x2e')][_0x3c67('0x3f')]({'where':{'id':_0x252f9d[_0x3c67('0x36')]['id']},'include':_0x49ef57})[_0x3c67('0x15')](handleEntityNotFound(_0x5be9e7,null))[_0x3c67('0x15')](function(_0x286b02){if(_0x286b02){var _0x3e8580=_0x286b02[_0x3c67('0xb9')]({'plain':!![]});fs[_0x3c67('0xba')](_0x1b16dc);var _0x2058f4={'channel':_0x3c67('0xbb'),'account':_0x3e8580[_0x3c67('0xb7')][_0x3c67('0x26')],'agent':_0x3e8580[_0x3c67('0xb8')]?_0x3e8580['Owner']['fullname']:_0x3c67('0xbc'),'createdAt':moment(_0x3e8580[_0x3c67('0x83')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x3c67('0xad')](),'closedAt':_0x3e8580[_0x3c67('0x68')]?moment(_0x3e8580[_0x3c67('0xbd')])[_0x3c67('0x77')](_0x3c67('0xbe'))[_0x3c67('0xad')]():'','disposition':_0x3e8580[_0x3c67('0x61')],'chatInfo':{'browser':_0x3e8580['browserName'],'os':_0x3e8580[_0x3c67('0xbf')],'referer':_0x3e8580[_0x3c67('0xc0')],'customerIp':_0x3e8580[_0x3c67('0xc1')],'customerPort':_0x3e8580[_0x3c67('0xc2')]?_0x3e8580[_0x3c67('0xc2')]:_0x3c67('0xbc')},'messages':_(_0x3e8580['Messages'])[_0x3c67('0xc3')]()[_0x3c67('0x9d')]({'secret':![]})[_0x3c67('0x2d')](function(_0x292b39){if(_0x292b39['Attachment']){var _0x55a9a7=path[_0x3c67('0x6b')](_0x1eb719,_0x292b39[_0x3c67('0xc4')][_0x3c67('0x6f')]);if(fs['existsSync'](_0x55a9a7)){fs['createReadStream'](_0x55a9a7)[_0x3c67('0xc5')](fs['createWriteStream'](path[_0x3c67('0x6b')](_0x1b16dc,_0x292b39[_0x3c67('0xc4')][_0x3c67('0x6f')])));}}return{'date':moment(_0x292b39[_0x3c67('0x83')])['format'](_0x3c67('0xbe'))[_0x3c67('0xad')](),'sender':_0x292b39[_0x3c67('0x85')]==='out'?_0x292b39[_0x3c67('0x74')]?_0x292b39[_0x3c67('0x74')]['fullname']:_0x3c67('0x79'):_0x292b39[_0x3c67('0x5b')][_0x3c67('0xc6')]+(_0x292b39[_0x3c67('0x5b')][_0x3c67('0xb3')]?'\x20'+_0x292b39[_0x3c67('0x5b')]['lastName']:''),'body':_0x292b39[_0x3c67('0xc4')]?_0x292b39[_0x3c67('0xc4')][_0x3c67('0x6f')]:_0x292b39[_0x3c67('0x29')],'direction':_0x292b39[_0x3c67('0x85')]===_0x3c67('0x57')?'A':'C','secret':_0x292b39[_0x3c67('0x86')],'read':_0x292b39[_0x3c67('0xb5')],'attachment':_0x292b39['Attachment']};})[_0x3c67('0xc7')]()};return ejs[_0x3c67('0xc8')](path[_0x3c67('0x6b')](config['root'],_0x3c67('0xae'),_0x3c67('0xc9'),_0x3c67('0xca')),{'interaction':_0x2058f4})[_0x3c67('0x15')](function(_0x43e6b6){var _0x40a2a4=path['join'](_0x1b16dc,_0x3c67('0xcb')+_0x3e8580['id']+'-'+_0x83a96d+_0x3c67('0xcc'));var _0x270c94={'path':_0x40a2a4,'channel':_0x3c67('0xbb'),'interactionId':_0x3e8580['id']};return pdf[_0x3c67('0xcd')](_0x43e6b6,_0x270c94);})[_0x3c67('0x15')](function(){return new Promise(function(_0x1f404e,_0x1021f9){zipdir(_0x1b16dc,{'saveTo':_0x4ab6b1},function(_0x41ec16,_0x2cdb11){if(_0x41ec16)return _0x1021f9(_0x41ec16);return _0x1f404e(_0x2cdb11);});})[_0x3c67('0x15')](function(){return new BPromise(function(_0x1bd55b,_0x165301){rimraf(_0x1b16dc,function(_0x8c630){if(_0x8c630)_0x165301(_0x8c630);return _0x1bd55b();});});})[_0x3c67('0x15')](function(){return _0x5be9e7[_0x3c67('0xab')](_0x4ab6b1,_0xdee6fa,function(_0x2e21e6){if(_0x2e21e6){logger[_0x3c67('0x18')](_0x3c67('0xce'),_0x2e21e6);}else{fs[_0x3c67('0xcf')](_0x4ab6b1);}});});});}else{return _0x5be9e7[_0x3c67('0x5f')](0xc8);}})['catch'](handleError(_0x5be9e7,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index fd890f7..9902ee2 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 _0x6a14=['events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hook'];(function(_0x469760,_0x30d72b){var _0x4e23fb=function(_0x3dccdb){while(--_0x3dccdb){_0x469760['push'](_0x469760['shift']());}};_0x4e23fb(++_0x30d72b);}(_0x6a14,0x130));var _0x46a1=function(_0x27dcb2,_0xc726a1){_0x27dcb2=_0x27dcb2-0x0;var _0x4bf6e4=_0x6a14[_0x27dcb2];return _0x4bf6e4;};'use strict';var EventEmitter=require(_0x46a1('0x0'));var ChatInteraction=require(_0x46a1('0x1'))['db'][_0x46a1('0x2')];var ChatMessage=require(_0x46a1('0x1'))['db'][_0x46a1('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x46a1('0x4')](0x0);var events={'afterCreate':_0x46a1('0x5'),'afterUpdate':_0x46a1('0x6'),'afterDestroy':_0x46a1('0x7')};function emitEvent(_0x16ca90){return function(_0x27fa19,_0x58baa9,_0x577a5e){_0x27fa19[_0x46a1('0x8')]({'attributes':['id'],'raw':!![]})[_0x46a1('0x9')](function(_0x25ba94){_0x27fa19['setDataValue'](_0x46a1('0xa'),_0x25ba94[_0x46a1('0xb')](function(_0x48f4db){return{'id':_0x48f4db['id']};}));return ChatMessage[_0x46a1('0xc')]({'where':{'ChatInteractionId':_0x27fa19['id'],'direction':'in','read':![]},'raw':!![]});})[_0x46a1('0x9')](function(_0x4bf137){_0x27fa19[_0x46a1('0xd')](_0x46a1('0xe'),_0x4bf137[_0x46a1('0xf')]);ChatInteractionEvents[_0x46a1('0x10')](_0x16ca90+':'+_0x27fa19['id'],_0x27fa19);ChatInteractionEvents[_0x46a1('0x10')](_0x16ca90,_0x27fa19);_0x577a5e(null);})[_0x46a1('0x11')](_0x577a5e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x46a1('0x12')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x333e=['events','../../mysqldb','ChatInteraction','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports'];(function(_0x4f2a6e,_0xd0be01){var _0x49ebfe=function(_0x3fdb9c){while(--_0x3fdb9c){_0x4f2a6e['push'](_0x4f2a6e['shift']());}};_0x49ebfe(++_0xd0be01);}(_0x333e,0xb0));var _0xe333=function(_0x2331f8,_0x446a3a){_0x2331f8=_0x2331f8-0x0;var _0x244773=_0x333e[_0x2331f8];return _0x244773;};'use strict';var EventEmitter=require(_0xe333('0x0'));var ChatInteraction=require(_0xe333('0x1'))['db'][_0xe333('0x2')];var ChatMessage=require(_0xe333('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe333('0x3'),'afterDestroy':_0xe333('0x4')};function emitEvent(_0x18eb3c){return function(_0x43f99b,_0x5934db,_0x10bce5){_0x43f99b[_0xe333('0x5')]({'attributes':['id'],'raw':!![]})[_0xe333('0x6')](function(_0x5f4413){_0x43f99b[_0xe333('0x7')]('Users',_0x5f4413[_0xe333('0x8')](function(_0x368536){return{'id':_0x368536['id']};}));return ChatMessage[_0xe333('0x9')]({'where':{'ChatInteractionId':_0x43f99b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe333('0x6')](function(_0x4908fb){_0x43f99b[_0xe333('0x7')](_0xe333('0xa'),_0x4908fb['length']);ChatInteractionEvents[_0xe333('0xb')](_0x18eb3c+':'+_0x43f99b['id'],_0x43f99b);ChatInteractionEvents[_0xe333('0xb')](_0x18eb3c,_0x43f99b);_0x10bce5(null);})[_0xe333('0xc')](_0x10bce5(null));};}for(var e in events){if(events[_0xe333('0xd')](e)){var event=events[e];ChatInteraction[_0xe333('0xe')](e,emitEvent(event));}}module[_0xe333('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index a3ec8b7..a68ac50 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 _0x59d0=['bluebird','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','changed','closed','closedAt','utf8mb4','lodash','util','api','moment'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x59d0,0xce));var _0x059d=function(_0x3f9415,_0x998a93){_0x3f9415=_0x3f9415-0x0;var _0x5dbdf6=_0x59d0[_0x3f9415];return _0x5dbdf6;};'use strict';var _=require(_0x059d('0x0'));var util=require(_0x059d('0x1'));var logger=require('../../config/logger')(_0x059d('0x2'));var moment=require(_0x059d('0x3'));var BPromise=require(_0x059d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x059d('0x5'));var config=require(_0x059d('0x6'));var attributes=require(_0x059d('0x7'));module['exports']=function(_0x4b93d2,_0x3abc28){return _0x4b93d2[_0x059d('0x8')](_0x059d('0x9'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xece9aa,_0x51faf2,_0x17fa36){if(_0xece9aa[_0x059d('0xa')](_0x059d('0xb'))){_0xece9aa[_0x059d('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x17fa36(null,_0xece9aa);}},'charset':_0x059d('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xeef6=['closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed'];(function(_0x10dc60,_0x2fcce1){var _0x47dec5=function(_0x24b5e4){while(--_0x24b5e4){_0x10dc60['push'](_0x10dc60['shift']());}};_0x47dec5(++_0x2fcce1);}(_0xeef6,0xc3));var _0x6eef=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xeef6[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x6eef('0x0'));var logger=require('../../config/logger')(_0x6eef('0x1'));var moment=require(_0x6eef('0x2'));var BPromise=require(_0x6eef('0x3'));var rp=require(_0x6eef('0x4'));var fs=require('fs');var path=require(_0x6eef('0x5'));var rimraf=require(_0x6eef('0x6'));var config=require(_0x6eef('0x7'));var attributes=require(_0x6eef('0x8'));module[_0x6eef('0x9')]=function(_0x23dc2e,_0x23becb){return _0x23dc2e[_0x6eef('0xa')](_0x6eef('0xb'),attributes,{'tableName':_0x6eef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4dab95,_0x1b0926,_0x32015e){if(_0x4dab95[_0x6eef('0xd')](_0x6eef('0xe'))){_0x4dab95['closedAt']=moment()[_0x6eef('0xf')](_0x6eef('0x10'));}_0x32015e(null,_0x4dab95);}},'charset':_0x6eef('0x11'),'collate':_0x6eef('0x12')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index e6347bc..5b1a0d2 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 _0x377e=['message','result','catch','UpdateChatInteraction','update','body','options','raw','where','limit','AddTagsToChatInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x22ccd2,_0x32d6fc){var _0x128adc=function(_0x934036){while(--_0x934036){_0x22ccd2['push'](_0x22ccd2['shift']());}};_0x128adc(++_0x32d6fc);}(_0x377e,0x1aa));var _0xe377=function(_0x34421e,_0xf309a2){_0x34421e=_0x34421e-0x0;var _0x5725d7=_0x377e[_0x34421e];return _0x5725d7;};'use strict';var _=require(_0xe377('0x0'));var util=require(_0xe377('0x1'));var moment=require(_0xe377('0x2'));var BPromise=require(_0xe377('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe377('0x4'));var db=require(_0xe377('0x5'))['db'];var utils=require(_0xe377('0x6'));var logger=require(_0xe377('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe377('0x8'));var client=jayson[_0xe377('0x9')][_0xe377('0xa')]({'port':0x232a});config[_0xe377('0xb')]=_[_0xe377('0xc')](config[_0xe377('0xb')],{'host':_0xe377('0xd'),'port':0x18eb});var socket=require(_0xe377('0xe'))(new Redis(config[_0xe377('0xb')]));require(_0xe377('0xf'))['register'](socket);function respondWithRpcPromise(_0x218ccb,_0x163914,_0x1e6bd1){return new BPromise(function(_0x2fb5af,_0x369cff){return client[_0xe377('0x10')](_0x218ccb,_0x1e6bd1)[_0xe377('0x11')](function(_0x42c5c0){logger[_0xe377('0x12')](_0xe377('0x13'),_0x163914,_0xe377('0x14'));logger[_0xe377('0x15')](_0xe377('0x16'),_0x163914,_0xe377('0x14'),JSON[_0xe377('0x17')](_0x42c5c0));if(_0x42c5c0[_0xe377('0x18')]){if(_0x42c5c0[_0xe377('0x18')]['code']===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x163914,_0x42c5c0[_0xe377('0x18')]['message']);return _0x369cff(_0x42c5c0[_0xe377('0x18')]['message']);}logger[_0xe377('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x163914,_0x42c5c0[_0xe377('0x18')][_0xe377('0x19')]);return _0x2fb5af(_0x42c5c0[_0xe377('0x18')][_0xe377('0x19')]);}else{logger[_0xe377('0x12')](_0xe377('0x13'),_0x163914,'request\x20sent');_0x2fb5af(_0x42c5c0[_0xe377('0x1a')][_0xe377('0x19')]);}})[_0xe377('0x1b')](function(_0x259b60){logger[_0xe377('0x18')](_0xe377('0x13'),_0x163914,_0x259b60);_0x369cff(_0x259b60);});});}exports[_0xe377('0x1c')]=function(_0x261abe){var _0x501b2a=this;return new Promise(function(_0x20db33,_0x564152){return db['ChatInteraction'][_0xe377('0x1d')](_0x261abe[_0xe377('0x1e')],{'raw':_0x261abe[_0xe377('0x1f')]?_0x261abe[_0xe377('0x1f')][_0xe377('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x261abe[_0xe377('0x1f')]?_0x261abe[_0xe377('0x1f')][_0xe377('0x21')]||null:null,'attributes':_0x261abe[_0xe377('0x1f')]?_0x261abe['options']['attributes']||null:null,'limit':_0x261abe['options']?_0x261abe[_0xe377('0x1f')][_0xe377('0x22')]||null:null})['then'](function(_0x4e10d1){logger[_0xe377('0x12')](_0xe377('0x1c'),_0x261abe);logger[_0xe377('0x15')](_0xe377('0x1c'),_0x261abe,JSON['stringify'](_0x4e10d1));_0x20db33(_0x4e10d1);})[_0xe377('0x1b')](function(_0x146a9e){logger[_0xe377('0x18')](_0xe377('0x1c'),_0x146a9e[_0xe377('0x19')],_0x261abe);_0x564152(_0x501b2a['error'](0x1f4,_0x146a9e[_0xe377('0x19')]));});});};exports[_0xe377('0x23')]=function(_0x4cc39f){return new Promise(function(_0x3a7396,_0x45bd06){return db['ChatInteraction'][_0xe377('0x24')]({'where':_0x4cc39f[_0xe377('0x1f')]?_0x4cc39f[_0xe377('0x1f')][_0xe377('0x21')]||null:null})[_0xe377('0x11')](function(_0x4fef91){if(_0x4fef91){return _0x4fef91[_0xe377('0x25')](_0x4cc39f[_0xe377('0x1e')][_0xe377('0x26')],_[_0xe377('0x27')](_0x4cc39f[_0xe377('0x1e')],['ids','id'])||{});}})['spread'](function(_0x44e030){logger[_0xe377('0x12')](_0xe377('0x28'),_0x4cc39f);logger['debug'](_0xe377('0x28'),_0x4cc39f,JSON['stringify'](_0x44e030));_0x3a7396(_0x44e030);})['catch'](function(_0x42deff){logger[_0xe377('0x18')](_0xe377('0x28'),_0x42deff[_0xe377('0x19')],_0x4cc39f);_0x45bd06(_this[_0xe377('0x18')](0x1f4,_0x42deff['message']));});});}; \ No newline at end of file +var _0x02e6=['code','ChatInteraction,\x20%s,\x20%s','message','catch','ChatInteraction','body','options','limit','then','UpdateChatInteraction','AddTagsToChatInteraction','find','where','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x8e4e90,_0x6d7185){var _0x1d9d2b=function(_0x3a63e7){while(--_0x3a63e7){_0x8e4e90['push'](_0x8e4e90['shift']());}};_0x1d9d2b(++_0x6d7185);}(_0x02e6,0x137));var _0x602e=function(_0x1e7a4d,_0x519ca0){_0x1e7a4d=_0x1e7a4d-0x0;var _0x27b907=_0x02e6[_0x1e7a4d];return _0x27b907;};'use strict';var _=require(_0x602e('0x0'));var util=require(_0x602e('0x1'));var moment=require(_0x602e('0x2'));var BPromise=require(_0x602e('0x3'));var rs=require(_0x602e('0x4'));var fs=require('fs');var Redis=require(_0x602e('0x5'));var db=require(_0x602e('0x6'))['db'];var utils=require(_0x602e('0x7'));var logger=require(_0x602e('0x8'))(_0x602e('0x9'));var config=require(_0x602e('0xa'));var jayson=require(_0x602e('0xb'));var client=jayson[_0x602e('0xc')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x602e('0xd')],{'host':_0x602e('0xe'),'port':0x18eb});var socket=require(_0x602e('0xf'))(new Redis(config[_0x602e('0xd')]));require(_0x602e('0x10'))[_0x602e('0x11')](socket);function respondWithRpcPromise(_0x3b878a,_0x598aa5,_0x3c1a24){return new BPromise(function(_0x414e4e,_0x317ed0){return client[_0x602e('0x12')](_0x3b878a,_0x3c1a24)['then'](function(_0x384cdf){logger[_0x602e('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x598aa5,'request\x20sent');logger[_0x602e('0x14')](_0x602e('0x15'),_0x598aa5,_0x602e('0x16'),JSON[_0x602e('0x17')](_0x384cdf));if(_0x384cdf['error']){if(_0x384cdf[_0x602e('0x18')][_0x602e('0x19')]===0x1f4){logger['error'](_0x602e('0x1a'),_0x598aa5,_0x384cdf['error']['message']);return _0x317ed0(_0x384cdf['error'][_0x602e('0x1b')]);}logger[_0x602e('0x18')](_0x602e('0x1a'),_0x598aa5,_0x384cdf['error'][_0x602e('0x1b')]);return _0x414e4e(_0x384cdf[_0x602e('0x18')][_0x602e('0x1b')]);}else{logger[_0x602e('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x598aa5,'request\x20sent');_0x414e4e(_0x384cdf['result']['message']);}})[_0x602e('0x1c')](function(_0x29d05e){logger['error'](_0x602e('0x1a'),_0x598aa5,_0x29d05e);_0x317ed0(_0x29d05e);});});}exports['UpdateChatInteraction']=function(_0xf1cce6){var _0x2172b6=this;return new Promise(function(_0x16e831,_0x444621){return db[_0x602e('0x1d')]['update'](_0xf1cce6[_0x602e('0x1e')],{'raw':_0xf1cce6[_0x602e('0x1f')]?_0xf1cce6[_0x602e('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf1cce6[_0x602e('0x1f')]?_0xf1cce6[_0x602e('0x1f')]['where']||null:null,'attributes':_0xf1cce6[_0x602e('0x1f')]?_0xf1cce6['options']['attributes']||null:null,'limit':_0xf1cce6['options']?_0xf1cce6[_0x602e('0x1f')][_0x602e('0x20')]||null:null})[_0x602e('0x21')](function(_0x581de1){logger[_0x602e('0x13')](_0x602e('0x22'),_0xf1cce6);logger[_0x602e('0x14')](_0x602e('0x22'),_0xf1cce6,JSON[_0x602e('0x17')](_0x581de1));_0x16e831(_0x581de1);})[_0x602e('0x1c')](function(_0x38112e){logger[_0x602e('0x18')](_0x602e('0x22'),_0x38112e[_0x602e('0x1b')],_0xf1cce6);_0x444621(_0x2172b6[_0x602e('0x18')](0x1f4,_0x38112e[_0x602e('0x1b')]));});});};exports[_0x602e('0x23')]=function(_0x3a21e1){return new Promise(function(_0x1f6888,_0xb1797c){return db[_0x602e('0x1d')][_0x602e('0x24')]({'where':_0x3a21e1[_0x602e('0x1f')]?_0x3a21e1['options'][_0x602e('0x25')]||null:null})['then'](function(_0x3c2b06){if(_0x3c2b06){return _0x3c2b06['addTags'](_0x3a21e1[_0x602e('0x1e')][_0x602e('0x26')],_[_0x602e('0x27')](_0x3a21e1[_0x602e('0x1e')],[_0x602e('0x26'),'id'])||{});}})[_0x602e('0x28')](function(_0x25e84d){logger[_0x602e('0x13')](_0x602e('0x29'),_0x3a21e1);logger['debug'](_0x602e('0x29'),_0x3a21e1,JSON[_0x602e('0x17')](_0x25e84d));_0x1f6888(_0x25e84d);})[_0x602e('0x1c')](function(_0x198c82){logger['error'](_0x602e('0x29'),_0x198c82[_0x602e('0x1b')],_0x3a21e1);_0xb1797c(_this[_0x602e('0x18')](0x1f4,_0x198c82[_0x602e('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index b20c00c..0d2376a 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 _0x4b74=['chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener','length'];(function(_0x26e0c5,_0xb24454){var _0x4877e7=function(_0x1ebbef){while(--_0x1ebbef){_0x26e0c5['push'](_0x26e0c5['shift']());}};_0x4877e7(++_0xb24454);}(_0x4b74,0x111));var _0x44b7=function(_0x239c90,_0x169b07){_0x239c90=_0x239c90-0x0;var _0x11cc75=_0x4b74[_0x239c90];return _0x11cc75;};'use strict';var ChatInteractionEvents=require(_0x44b7('0x0'));var events=[_0x44b7('0x1'),_0x44b7('0x2'),_0x44b7('0x3')];function createListener(_0x2f3a50,_0x127a66){return function(_0x3c8eea){_0x127a66[_0x44b7('0x4')](_0x2f3a50,_0x3c8eea);};}function removeListener(_0x290aa9,_0x441b7b){return function(){ChatInteractionEvents[_0x44b7('0x5')](_0x290aa9,_0x441b7b);};}exports['register']=function(_0x497f3b){for(var _0x38aab5=0x0,_0x4d411=events[_0x44b7('0x6')];_0x38aab5<_0x4d411;_0x38aab5++){var _0x3e819b=events[_0x38aab5];var _0x9fc4f0=createListener(_0x44b7('0x7')+_0x3e819b,_0x497f3b);ChatInteractionEvents['on'](_0x3e819b,_0x9fc4f0);}}; \ No newline at end of file +var _0x04a1=['register','length','remove','emit'];(function(_0x5951b9,_0x52b706){var _0x16623b=function(_0x25af2b){while(--_0x25af2b){_0x5951b9['push'](_0x5951b9['shift']());}};_0x16623b(++_0x52b706);}(_0x04a1,0x126));var _0x104a=function(_0xe228c4,_0x32140a){_0xe228c4=_0xe228c4-0x0;var _0x1730cb=_0x04a1[_0xe228c4];return _0x1730cb;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x104a('0x0'),'update'];function createListener(_0x26a953,_0x2cea38){return function(_0x309b67){_0x2cea38[_0x104a('0x1')](_0x26a953,_0x309b67);};}function removeListener(_0x29585e,_0x5c9514){return function(){ChatInteractionEvents['removeListener'](_0x29585e,_0x5c9514);};}exports[_0x104a('0x2')]=function(_0x3bca10){for(var _0x50707a=0x0,_0x40cd1d=events[_0x104a('0x3')];_0x50707a<_0x40cd1d;_0x50707a++){var _0x315abc=events[_0x50707a];var _0x559357=createListener('chatInteraction:'+_0x315abc,_0x3bca10);ChatInteractionEvents['on'](_0x315abc,_0x559357);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index b32aa54..83b2c0c 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 _0x6514=['exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','create','diskStorage','join','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','tracked','chatinteraction:addtags','addTags','put','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags'];(function(_0xf867e9,_0x2e9cbd){var _0xc3d01f=function(_0x89e49e){while(--_0x89e49e){_0xf867e9['push'](_0xf867e9['shift']());}};_0xc3d01f(++_0x2e9cbd);}(_0x6514,0x166));var _0x4651=function(_0x1d5cda,_0x4eda97){_0x1d5cda=_0x1d5cda-0x0;var _0x5cb86b=_0x6514[_0x1d5cda];return _0x5cb86b;};'use strict';var multer=require(_0x4651('0x0'));var util=require('util');var path=require(_0x4651('0x1'));var timeout=require(_0x4651('0x2'));var express=require(_0x4651('0x3'));var router=express[_0x4651('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4651('0x5'));var config=require(_0x4651('0x6'));var controller=require(_0x4651('0x7'));router[_0x4651('0x8')]('/',auth[_0x4651('0x9')](),controller['index']);router[_0x4651('0x8')]('/describe',auth[_0x4651('0x9')](),controller[_0x4651('0xa')]);router[_0x4651('0x8')](_0x4651('0xb'),auth[_0x4651('0xc')](),controller[_0x4651('0xd')]);router[_0x4651('0x8')](_0x4651('0xe'),auth[_0x4651('0xc')](),controller['attachmentDownload']);router[_0x4651('0x8')](_0x4651('0xf'),auth['isAuthenticated'](),controller[_0x4651('0x10')]);router[_0x4651('0x8')](_0x4651('0x11'),auth[_0x4651('0xc')](),controller[_0x4651('0x12')]);router[_0x4651('0x8')]('/:id/download',auth[_0x4651('0x9')](),controller[_0x4651('0x13')]);router[_0x4651('0x14')]('/',auth[_0x4651('0x9')](),controller[_0x4651('0x15')]);router[_0x4651('0x14')]('/:id/vidaoo',auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x4651('0x16')]({'destination':function(_0x474413,_0x3ba15e,_0x2fed77){_0x2fed77(null,path[_0x4651('0x17')](config['root'],_0x4651('0x18')));},'filename':function(_0x40dde3,_0xca7103,_0x3120f8){_0x3120f8(null,util[_0x4651('0x19')](_0x4651('0x1a'),Date[_0x4651('0x1b')](),_0xca7103['originalname'][_0x4651('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x4651('0x1d'),upload[_0x4651('0x1e')](_0x4651('0x1f')),controller[_0x4651('0x20')]);router[_0x4651('0x14')](_0x4651('0xf'),auth[_0x4651('0xc')](),controller[_0x4651('0x21')]);router['post']('/:id/tags',auth[_0x4651('0x9')](),interaction[_0x4651('0x22')]('chat',_0x4651('0x23')),controller[_0x4651('0x24')]);router[_0x4651('0x25')]('/:id',auth[_0x4651('0x9')](),interaction['tracked'](_0x4651('0x26'),_0x4651('0x27')),controller[_0x4651('0x28')]);router['put'](_0x4651('0x29'),controller[_0x4651('0x2a')]);router[_0x4651('0x25')]('/:id/abandon',auth[_0x4651('0xc')](),controller['abandon']);router[_0x4651('0x25')](_0x4651('0x2b'),controller[_0x4651('0x2c')]);router[_0x4651('0x2d')]('/:id',auth[_0x4651('0x9')](),interaction['tracked'](_0x4651('0x26'),_0x4651('0x2e')),controller[_0x4651('0x2f')]);router[_0x4651('0x2d')](_0x4651('0x30'),auth['isAuthenticated'](),controller[_0x4651('0x31')]);module[_0x4651('0x32')]=router; \ No newline at end of file +var _0x23a9=['removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','download','post','create','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','%s-%s','now','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','destroy','delete'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0x23a9,0x1cd));var _0x923a=function(_0x3ec3a6,_0x10cb7f){_0x3ec3a6=_0x3ec3a6-0x0;var _0x4ce546=_0x23a9[_0x3ec3a6];return _0x4ce546;};'use strict';var multer=require(_0x923a('0x0'));var util=require(_0x923a('0x1'));var path=require(_0x923a('0x2'));var timeout=require(_0x923a('0x3'));var express=require('express');var router=express[_0x923a('0x4')]();var fs_extra=require(_0x923a('0x5'));var auth=require(_0x923a('0x6'));var interaction=require(_0x923a('0x7'));var config=require(_0x923a('0x8'));var controller=require(_0x923a('0x9'));router[_0x923a('0xa')]('/',auth[_0x923a('0xb')](),controller['index']);router[_0x923a('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x923a('0xc')]);router[_0x923a('0xa')](_0x923a('0xd'),auth[_0x923a('0xe')](),controller[_0x923a('0xf')]);router['get'](_0x923a('0x10'),auth[_0x923a('0xe')](),controller[_0x923a('0x11')]);router[_0x923a('0xa')](_0x923a('0x12'),auth[_0x923a('0xb')](),controller['getMessages']);router[_0x923a('0xa')]('/:id/my_messages',auth[_0x923a('0xe')](),controller['getMyMessages']);router['get']('/:id/download',auth[_0x923a('0xb')](),controller[_0x923a('0x13')]);router[_0x923a('0x14')]('/',auth['isAuthenticated'](),controller[_0x923a('0x15')]);router[_0x923a('0x14')](_0x923a('0x16'),auth[_0x923a('0xb')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x923a('0x17')]({'destination':function(_0x9fbd35,_0x5f44e2,_0x3dc505){_0x3dc505(null,path[_0x923a('0x18')](config[_0x923a('0x19')],_0x923a('0x1a')));},'filename':function(_0x1b27c4,_0x236a1b,_0xb53525){_0xb53525(null,util['format'](_0x923a('0x1b'),Date[_0x923a('0x1c')](),_0x236a1b['originalname'][_0x923a('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x923a('0x14')](_0x923a('0x1e'),upload[_0x923a('0x1f')](_0x923a('0x20')),controller[_0x923a('0x21')]);router[_0x923a('0x14')](_0x923a('0x12'),auth[_0x923a('0xe')](),controller[_0x923a('0x22')]);router[_0x923a('0x14')](_0x923a('0x23'),auth[_0x923a('0xb')](),interaction[_0x923a('0x24')](_0x923a('0x25'),_0x923a('0x26')),controller[_0x923a('0x27')]);router[_0x923a('0x28')](_0x923a('0xd'),auth[_0x923a('0xb')](),interaction[_0x923a('0x24')](_0x923a('0x25'),'chatinteraction:update'),controller[_0x923a('0x29')]);router['put'](_0x923a('0x2a'),controller[_0x923a('0x2b')]);router[_0x923a('0x28')](_0x923a('0x2c'),auth[_0x923a('0xe')](),controller[_0x923a('0x2d')]);router[_0x923a('0x28')]('/:id/close',controller[_0x923a('0x2e')]);router['delete'](_0x923a('0xd'),auth[_0x923a('0xb')](),interaction['tracked'](_0x923a('0x25'),'chatinteraction:destroy'),controller[_0x923a('0x2f')]);router[_0x923a('0x30')](_0x923a('0x23'),auth[_0x923a('0xb')](),controller[_0x923a('0x31')]);module[_0x923a('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 063bcb7..8281631 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 _0x1f70=['sequelize','TEXT'];(function(_0x5c44b6,_0x5f04da){var _0x318163=function(_0x2a3745){while(--_0x2a3745){_0x5c44b6['push'](_0x5c44b6['shift']());}};_0x318163(++_0x5f04da);}(_0x1f70,0x13e));var _0x01f7=function(_0x48cfbe,_0x4fc6eb){_0x48cfbe=_0x48cfbe-0x0;var _0x1f0ffc=_0x1f70[_0x48cfbe];return _0x1f0ffc;};'use strict';var Sequelize=require(_0x01f7('0x0'));module['exports']={'body':{'type':Sequelize[_0x01f7('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x449c=['sequelize','exports','TEXT','medium'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x449c,0x88));var _0xc449=function(_0x1e96d8,_0x2a4400){_0x1e96d8=_0x1e96d8-0x0;var _0x4139e9=_0x449c[_0x1e96d8];return _0x4139e9;};'use strict';var Sequelize=require(_0xc449('0x0'));module[_0xc449('0x1')]={'body':{'type':Sequelize[_0xc449('0x2')](_0xc449('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index c7c1272..508aed9 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 _0x7be3=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','agent','push','FromId','ToId','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./chatInternalMessage.socket','register','status','offset','undefined','limit','set','Content-Range','json','apply','reject','save','destroy','then','end','error','stack','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','map','keys','filters','intersection','model','fields','attributes','hasOwnProperty','query','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','rows','catch','show','length','find','create','update','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','getUsers','User','findAll','admin','fullname','role','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user'];(function(_0x14ad4a,_0x4f35cc){var _0x348e81=function(_0x2d103f){while(--_0x2d103f){_0x14ad4a['push'](_0x14ad4a['shift']());}};_0x348e81(++_0x4f35cc);}(_0x7be3,0x75));var _0x37be=function(_0x22aabe,_0x1667d4){_0x22aabe=_0x22aabe-0x0;var _0x7ae05=_0x7be3[_0x22aabe];return _0x7ae05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x37be('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x37be('0x1'));var moment=require('moment');var BPromise=require(_0x37be('0x2'));var Mustache=require('mustache');var util=require(_0x37be('0x3'));var path=require(_0x37be('0x4'));var sox=require(_0x37be('0x5'));var csv=require(_0x37be('0x6'));var ejs=require(_0x37be('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x37be('0x8'));var squel=require(_0x37be('0x9'));var crypto=require(_0x37be('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x37be('0xb'));var toCsv=require(_0x37be('0x6'));var querystring=require(_0x37be('0xc'));var Papa=require(_0x37be('0xd'));var Redis=require(_0x37be('0xe'));var authService=require(_0x37be('0xf'));var qs=require(_0x37be('0x10'));var as=require(_0x37be('0x11'));var hardwareService=require(_0x37be('0x12'));var logger=require('../../config/logger')(_0x37be('0x13'));var utils=require(_0x37be('0x14'));var config=require(_0x37be('0x15'));var licenseUtil=require(_0x37be('0x16'));var db=require(_0x37be('0x17'))['db'];config['redis']=_[_0x37be('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x37be('0x19')]));require(_0x37be('0x1a'))[_0x37be('0x1b')](socket);function respondWithStatusCode(_0x5ac5f7,_0x2fd3f5){_0x2fd3f5=_0x2fd3f5||0xcc;return function(_0x213976){if(_0x213976){return _0x5ac5f7['sendStatus'](_0x2fd3f5);}return _0x5ac5f7[_0x37be('0x1c')](_0x2fd3f5)['end']();};}function respondWithResult(_0x3d687b,_0x368764){_0x368764=_0x368764||0xc8;return function(_0x15bd37){if(_0x15bd37){return _0x3d687b[_0x37be('0x1c')](_0x368764)['json'](_0x15bd37);}};}function respondWithFilteredResult(_0x5d2b7f,_0x26483b){return function(_0xdc37a2){if(_0xdc37a2){var _0x53c692=typeof _0x26483b[_0x37be('0x1d')]===_0x37be('0x1e')&&typeof _0x26483b[_0x37be('0x1f')]==='undefined';var _0x3b5f49=_0xdc37a2['count'];var _0x11aa17=_0x53c692?0x0:_0x26483b[_0x37be('0x1d')];var _0x55f580=_0x53c692?_0xdc37a2['count']:_0x26483b[_0x37be('0x1d')]+_0x26483b['limit'];var _0x56a579;if(_0x55f580>=_0x3b5f49){_0x55f580=_0x3b5f49;_0x56a579=0xc8;}else{_0x56a579=0xce;}_0x5d2b7f[_0x37be('0x1c')](_0x56a579);return _0x5d2b7f[_0x37be('0x20')](_0x37be('0x21'),_0x11aa17+'-'+_0x55f580+'/'+_0x3b5f49)[_0x37be('0x22')](_0xdc37a2);}return null;};}function patchUpdates(_0x2eaa7a){return function(_0x4047ed){try{jsonpatch[_0x37be('0x23')](_0x4047ed,_0x2eaa7a,!![]);}catch(_0x45c756){return BPromise[_0x37be('0x24')](_0x45c756);}return _0x4047ed[_0x37be('0x25')]();};}function saveUpdates(_0x59d9af,_0x55a8ee){return function(_0x4dc257){if(_0x4dc257){return _0x4dc257['update'](_0x59d9af)['then'](function(_0x4fcf79){return _0x4fcf79;});}return null;};}function removeEntity(_0x279138,_0x1427e8){return function(_0x42e6de){if(_0x42e6de){return _0x42e6de[_0x37be('0x26')]()[_0x37be('0x27')](function(){_0x279138[_0x37be('0x1c')](0xcc)[_0x37be('0x28')]();});}};}function handleEntityNotFound(_0x325b94,_0x5e6255){return function(_0x164d98){if(!_0x164d98){_0x325b94['sendStatus'](0x194);}return _0x164d98;};}function handleError(_0x30960a,_0x5970ae){_0x5970ae=_0x5970ae||0x1f4;return function(_0x3d4596){logger[_0x37be('0x29')](_0x3d4596[_0x37be('0x2a')]);if(_0x3d4596[_0x37be('0x2b')]){delete _0x3d4596['name'];}_0x30960a[_0x37be('0x1c')](_0x5970ae)[_0x37be('0x2c')](_0x3d4596);};}exports[_0x37be('0x2d')]=function(_0x28e12c,_0x126973){var _0x33e685={},_0x1e7e14={},_0x2f8919={'count':0x0,'rows':[]};var _0x553746=_['map'](db[_0x37be('0x2e')][_0x37be('0x2f')],function(_0x1b9539){return{'name':_0x1b9539[_0x37be('0x30')],'type':_0x1b9539[_0x37be('0x31')]['key']};});_0x1e7e14['model']=_[_0x37be('0x32')](_0x553746,'name');_0x1e7e14['query']=_[_0x37be('0x33')](_0x28e12c['query']);_0x1e7e14[_0x37be('0x34')]=_[_0x37be('0x35')](_0x1e7e14[_0x37be('0x36')],_0x1e7e14['query']);_0x33e685['attributes']=_[_0x37be('0x35')](_0x1e7e14[_0x37be('0x36')],qs[_0x37be('0x37')](_0x28e12c['query']['fields']));_0x33e685[_0x37be('0x38')]=_0x33e685['attributes']['length']?_0x33e685[_0x37be('0x38')]:_0x1e7e14[_0x37be('0x36')];if(!_0x28e12c['query'][_0x37be('0x39')]('nolimit')){_0x33e685[_0x37be('0x1f')]=qs[_0x37be('0x1f')](_0x28e12c[_0x37be('0x3a')][_0x37be('0x1f')]);_0x33e685[_0x37be('0x1d')]=qs[_0x37be('0x1d')](_0x28e12c[_0x37be('0x3a')][_0x37be('0x1d')]);}_0x33e685['order']=qs[_0x37be('0x3b')](_0x28e12c[_0x37be('0x3a')][_0x37be('0x3b')]);_0x33e685[_0x37be('0x3c')]=qs[_0x37be('0x34')](_[_0x37be('0x3d')](_0x28e12c[_0x37be('0x3a')],_0x1e7e14['filters']),_0x553746);if(_0x28e12c['query']['filter']){_0x33e685[_0x37be('0x3c')]=_[_0x37be('0x3e')](_0x33e685['where'],{'$or':_[_0x37be('0x32')](_0x553746,function(_0x4cab45){if(_0x4cab45[_0x37be('0x31')]!==_0x37be('0x3f')){var _0x25ceb9={};_0x25ceb9[_0x4cab45['name']]={'$like':'%'+_0x28e12c['query'][_0x37be('0x40')]+'%'};return _0x25ceb9;}})});}_0x33e685=_[_0x37be('0x3e')]({},_0x33e685,_0x28e12c[_0x37be('0x41')]);var _0x4f5be2={'where':_0x33e685[_0x37be('0x3c')]};return db[_0x37be('0x2e')]['count'](_0x4f5be2)[_0x37be('0x27')](function(_0x12081b){_0x2f8919[_0x37be('0x42')]=_0x12081b;if(_0x28e12c['query'][_0x37be('0x43')]){_0x33e685[_0x37be('0x44')]=[{'all':!![]}];}return db[_0x37be('0x2e')]['findAll'](_0x33e685);})[_0x37be('0x27')](function(_0x529edf){_0x2f8919[_0x37be('0x45')]=_0x529edf;return _0x2f8919;})[_0x37be('0x27')](respondWithFilteredResult(_0x126973,_0x33e685))[_0x37be('0x46')](handleError(_0x126973,null));};exports[_0x37be('0x47')]=function(_0xb2b4bd,_0x12de65){var _0x55df10={'raw':!![],'where':{'id':_0xb2b4bd['params']['id']}},_0x55b347={};_0x55b347[_0x37be('0x36')]=_[_0x37be('0x33')](db[_0x37be('0x2e')][_0x37be('0x2f')]);_0x55b347[_0x37be('0x3a')]=_['keys'](_0xb2b4bd[_0x37be('0x3a')]);_0x55b347['filters']=_['intersection'](_0x55b347['model'],_0x55b347[_0x37be('0x3a')]);_0x55df10[_0x37be('0x38')]=_[_0x37be('0x35')](_0x55b347[_0x37be('0x36')],qs[_0x37be('0x37')](_0xb2b4bd[_0x37be('0x3a')][_0x37be('0x37')]));_0x55df10[_0x37be('0x38')]=_0x55df10['attributes'][_0x37be('0x48')]?_0x55df10['attributes']:_0x55b347[_0x37be('0x36')];if(_0xb2b4bd['query'][_0x37be('0x43')]){_0x55df10[_0x37be('0x44')]=[{'all':!![]}];}_0x55df10=_[_0x37be('0x3e')]({},_0x55df10,_0xb2b4bd[_0x37be('0x41')]);return db['ChatInternalMessage'][_0x37be('0x49')](_0x55df10)[_0x37be('0x27')](handleEntityNotFound(_0x12de65,null))[_0x37be('0x27')](respondWithResult(_0x12de65,null))[_0x37be('0x46')](handleError(_0x12de65,null));};exports[_0x37be('0x4a')]=function(_0x19fb1b,_0x2b1fbc){return db[_0x37be('0x2e')][_0x37be('0x4a')](_0x19fb1b['body'],{})[_0x37be('0x27')](respondWithResult(_0x2b1fbc,0xc9))[_0x37be('0x46')](handleError(_0x2b1fbc,null));};exports[_0x37be('0x4b')]=function(_0x45a4d8,_0x19fb23){if(_0x45a4d8[_0x37be('0x4c')]['id']){delete _0x45a4d8['body']['id'];}return db['ChatInternalMessage'][_0x37be('0x49')]({'where':{'id':_0x45a4d8['params']['id']}})['then'](handleEntityNotFound(_0x19fb23,null))['then'](saveUpdates(_0x45a4d8[_0x37be('0x4c')],null))['then'](respondWithResult(_0x19fb23,null))[_0x37be('0x46')](handleError(_0x19fb23,null));};exports[_0x37be('0x26')]=function(_0x2a0533,_0x413aca){return db[_0x37be('0x2e')]['find']({'where':{'id':_0x2a0533['params']['id']}})[_0x37be('0x27')](handleEntityNotFound(_0x413aca,null))[_0x37be('0x27')](removeEntity(_0x413aca,null))[_0x37be('0x46')](handleError(_0x413aca,null));};exports[_0x37be('0x4d')]=function(_0x469260,_0x228ff3){return db[_0x37be('0x2e')][_0x37be('0x4d')]()[_0x37be('0x27')](respondWithResult(_0x228ff3,null))['catch'](handleError(_0x228ff3,null));};function wrapUser(_0x3f3045){return function(_0x3413dd){var _0x55b49a=_0x3f3045[_0x37be('0x4e')]({'plain':!![]});_0x55b49a[_0x37be('0x4f')]=[];if(_0x3413dd){_0x55b49a[_0x37be('0x50')]=_0x3413dd[_0x37be('0x51')];_0x55b49a[_0x37be('0x52')]=_0x3413dd;}else{_0x55b49a[_0x37be('0x50')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x55b49a[_0x37be('0x52')]={};}return _0x55b49a;};}exports[_0x37be('0x53')]=function(_0x5a907b,_0x577da2,_0x14bdd2){var _0x4c5296=[];return db[_0x37be('0x54')][_0x37be('0x55')]({'where':{'role':['agent',_0x37be('0x56'),'user']},'attributes':['id',_0x37be('0x57'),_0x37be('0x2b'),_0x37be('0x58'),'userpic','internal',_0x37be('0x59'),_0x37be('0x5a'),_0x37be('0x5b'),_0x37be('0x5c')],'order':qs[_0x37be('0x3b')](_0x37be('0x5d')),'include':[{'model':db[_0x37be('0x5e')],'as':_0x37be('0x5f'),'attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0x37be('0x27')](function(_0x19c040){if(_0x19c040){var _0x73bcaf=_0x5a907b[_0x37be('0x60')][_0x37be('0x4e')]({'plain':!![]});if(!_0x73bcaf)throw new Error(_0x37be('0x61'));if(_0x73bcaf[_0x37be('0x58')]===_0x37be('0x60')){return db[_0x37be('0x62')][_0x37be('0x49')]({'where':{'name':_0x37be('0x63'),'userProfileId':_0x73bcaf[_0x37be('0x64')]},'raw':!![]})[_0x37be('0x27')](function(_0x4d78b2){if(_0x4d78b2){if(_0x4d78b2['autoAssociation']===0x0){return db[_0x37be('0x65')]['findAll']({'where':{'sectionId':_0x4d78b2['id']},'raw':!![]})[_0x37be('0x27')](function(_0x310753){var _0x3b4a8d=[];if(_[_0x37be('0x66')](_0x310753)){_0x3b4a8d=_[_0x37be('0x40')](_0x19c040,function(_0x190dc7){if(_0x190dc7[_0x37be('0x58')]!=='agent'){return _0x190dc7;}});return _0x3b4a8d;}else{for(var _0x35bfa2=0x0;_0x35bfa2<_0x19c040[_0x37be('0x48')];_0x35bfa2++){var _0x1bda24=_0x19c040[_0x35bfa2];if(_0x1bda24[_0x37be('0x58')]===_0x37be('0x67')){var _0x48c4e1=_[_0x37be('0x49')](_0x310753,function(_0x70e15f){return _0x70e15f['resourceId']===_0x1bda24['id'];});if(_0x48c4e1)_0x3b4a8d[_0x37be('0x68')](_0x1bda24);}else{_0x3b4a8d['push'](_0x1bda24);}}return _0x3b4a8d;}});}else{return _0x19c040;}}else{var _0x5241c0=_[_0x37be('0x40')](_0x19c040,function(_0x38bd10){if(_0x38bd10[_0x37be('0x58')]!=='agent'){return _0x38bd10;}});return _0x5241c0;}});}else{return _0x19c040;}}})[_0x37be('0x27')](function(_0x2eb36a){var _0xcaefb1=[];if(_0x2eb36a){_0x4c5296=_0x2eb36a;for(var _0x523300=0x0;_0x523300<_0x2eb36a[_0x37be('0x48')];_0x523300+=0x1){_0x4c5296[_0x523300][_0x37be('0x4f')]=[];_0xcaefb1[_0x37be('0x68')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x5a907b[_0x37be('0x60')]['id'],_0x2eb36a[_0x523300]['id']],'ToId':[_0x5a907b[_0x37be('0x60')]['id'],_0x2eb36a[_0x523300]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x37be('0x69'),_0x37be('0x6a'),'read','body'],'order':qs[_0x37be('0x3b')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x37be('0x27')](wrapUser(_0x2eb36a[_0x523300])));}return BPromise['all'](_0xcaefb1);}return[];})[_0x37be('0x27')](function(_0xccf0b5){return{'rows':_0xccf0b5,'count':_0xccf0b5[_0x37be('0x48')]};})[_0x37be('0x27')](respondWithResult(_0x577da2,null))[_0x37be('0x46')](handleError(_0x577da2,null));}; \ No newline at end of file +var _0x612a=['type','VIRTUAL','filter','options','includeAll','include','ChatInternalMessage','rows','catch','params','length','create','body','find','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','admin','user','fullname','userpic','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','agent','createdAt','FromId','ToId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','end','limit','undefined','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge'];(function(_0x36ab88,_0x23f292){var _0x685d83=function(_0x73c21e){while(--_0x73c21e){_0x36ab88['push'](_0x36ab88['shift']());}};_0x685d83(++_0x23f292);}(_0x612a,0x11c));var _0xa612=function(_0x9307ea,_0x38968a){_0x9307ea=_0x9307ea-0x0;var _0x295554=_0x612a[_0x9307ea];return _0x295554;};'use strict';var emlformat=require(_0xa612('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa612('0x1'));var jsonpatch=require(_0xa612('0x2'));var rp=require(_0xa612('0x3'));var moment=require('moment');var BPromise=require(_0xa612('0x4'));var Mustache=require('mustache');var util=require(_0xa612('0x5'));var path=require(_0xa612('0x6'));var sox=require(_0xa612('0x7'));var csv=require(_0xa612('0x8'));var ejs=require(_0xa612('0x9'));var fs=require('fs');var fs_extra=require(_0xa612('0xa'));var _=require(_0xa612('0xb'));var squel=require(_0xa612('0xc'));var crypto=require(_0xa612('0xd'));var jsforce=require(_0xa612('0xe'));var deskjs=require(_0xa612('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa612('0x10'));var Papa=require(_0xa612('0x11'));var Redis=require(_0xa612('0x12'));var authService=require(_0xa612('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa612('0x14'));var hardwareService=require(_0xa612('0x15'));var logger=require(_0xa612('0x16'))(_0xa612('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa612('0x18'));var db=require(_0xa612('0x19'))['db'];config['redis']=_[_0xa612('0x1a')](config[_0xa612('0x1b')],{'host':_0xa612('0x1c'),'port':0x18eb});var socket=require(_0xa612('0x1d'))(new Redis(config[_0xa612('0x1b')]));require(_0xa612('0x1e'))[_0xa612('0x1f')](socket);function respondWithStatusCode(_0x28eadb,_0x5d8859){_0x5d8859=_0x5d8859||0xcc;return function(_0x19ba6b){if(_0x19ba6b){return _0x28eadb['sendStatus'](_0x5d8859);}return _0x28eadb[_0xa612('0x20')](_0x5d8859)[_0xa612('0x21')]();};}function respondWithResult(_0x2f9c8d,_0x199947){_0x199947=_0x199947||0xc8;return function(_0x223b21){if(_0x223b21){return _0x2f9c8d['status'](_0x199947)['json'](_0x223b21);}};}function respondWithFilteredResult(_0x5f0542,_0xcd7c89){return function(_0x25ac5d){if(_0x25ac5d){var _0x58cabc=typeof _0xcd7c89['offset']==='undefined'&&typeof _0xcd7c89[_0xa612('0x22')]===_0xa612('0x23');var _0x1e26de=_0x25ac5d['count'];var _0x4913bf=_0x58cabc?0x0:_0xcd7c89[_0xa612('0x24')];var _0x50ce78=_0x58cabc?_0x25ac5d[_0xa612('0x25')]:_0xcd7c89[_0xa612('0x24')]+_0xcd7c89[_0xa612('0x22')];var _0x506860;if(_0x50ce78>=_0x1e26de){_0x50ce78=_0x1e26de;_0x506860=0xc8;}else{_0x506860=0xce;}_0x5f0542[_0xa612('0x20')](_0x506860);return _0x5f0542[_0xa612('0x26')](_0xa612('0x27'),_0x4913bf+'-'+_0x50ce78+'/'+_0x1e26de)[_0xa612('0x28')](_0x25ac5d);}return null;};}function patchUpdates(_0xc25e94){return function(_0x23afbc){try{jsonpatch[_0xa612('0x29')](_0x23afbc,_0xc25e94,!![]);}catch(_0x4cdc05){return BPromise[_0xa612('0x2a')](_0x4cdc05);}return _0x23afbc[_0xa612('0x2b')]();};}function saveUpdates(_0x50c61d,_0x1a1fdb){return function(_0x31dad5){if(_0x31dad5){return _0x31dad5[_0xa612('0x2c')](_0x50c61d)[_0xa612('0x2d')](function(_0x507fce){return _0x507fce;});}return null;};}function removeEntity(_0x3f824f,_0x3e5b2e){return function(_0x33561c){if(_0x33561c){return _0x33561c[_0xa612('0x2e')]()[_0xa612('0x2d')](function(){_0x3f824f[_0xa612('0x20')](0xcc)[_0xa612('0x21')]();});}};}function handleEntityNotFound(_0x331724,_0x390de5){return function(_0x331491){if(!_0x331491){_0x331724['sendStatus'](0x194);}return _0x331491;};}function handleError(_0x24f274,_0x55dc2a){_0x55dc2a=_0x55dc2a||0x1f4;return function(_0x1754e3){logger['error'](_0x1754e3['stack']);if(_0x1754e3[_0xa612('0x2f')]){delete _0x1754e3[_0xa612('0x2f')];}_0x24f274[_0xa612('0x20')](_0x55dc2a)[_0xa612('0x30')](_0x1754e3);};}exports[_0xa612('0x31')]=function(_0x1e5cea,_0x53f230){var _0x3c9d2c={},_0x2c6afa={},_0x41e8fc={'count':0x0,'rows':[]};var _0x317738=_[_0xa612('0x32')](db['ChatInternalMessage'][_0xa612('0x33')],function(_0x1f5ae3){return{'name':_0x1f5ae3[_0xa612('0x34')],'type':_0x1f5ae3['type'][_0xa612('0x35')]};});_0x2c6afa[_0xa612('0x36')]=_['map'](_0x317738,'name');_0x2c6afa[_0xa612('0x37')]=_[_0xa612('0x38')](_0x1e5cea['query']);_0x2c6afa[_0xa612('0x39')]=_[_0xa612('0x3a')](_0x2c6afa['model'],_0x2c6afa[_0xa612('0x37')]);_0x3c9d2c[_0xa612('0x3b')]=_[_0xa612('0x3a')](_0x2c6afa[_0xa612('0x36')],qs[_0xa612('0x3c')](_0x1e5cea[_0xa612('0x37')][_0xa612('0x3c')]));_0x3c9d2c[_0xa612('0x3b')]=_0x3c9d2c['attributes']['length']?_0x3c9d2c[_0xa612('0x3b')]:_0x2c6afa[_0xa612('0x36')];if(!_0x1e5cea['query'][_0xa612('0x3d')](_0xa612('0x3e'))){_0x3c9d2c[_0xa612('0x22')]=qs[_0xa612('0x22')](_0x1e5cea[_0xa612('0x37')][_0xa612('0x22')]);_0x3c9d2c[_0xa612('0x24')]=qs[_0xa612('0x24')](_0x1e5cea['query'][_0xa612('0x24')]);}_0x3c9d2c['order']=qs['sort'](_0x1e5cea[_0xa612('0x37')][_0xa612('0x3f')]);_0x3c9d2c[_0xa612('0x40')]=qs['filters'](_[_0xa612('0x41')](_0x1e5cea['query'],_0x2c6afa[_0xa612('0x39')]),_0x317738);if(_0x1e5cea[_0xa612('0x37')]['filter']){_0x3c9d2c[_0xa612('0x40')]=_[_0xa612('0x42')](_0x3c9d2c[_0xa612('0x40')],{'$or':_['map'](_0x317738,function(_0x4c6620){if(_0x4c6620[_0xa612('0x43')]!==_0xa612('0x44')){var _0x1902ad={};_0x1902ad[_0x4c6620[_0xa612('0x2f')]]={'$like':'%'+_0x1e5cea[_0xa612('0x37')][_0xa612('0x45')]+'%'};return _0x1902ad;}})});}_0x3c9d2c=_[_0xa612('0x42')]({},_0x3c9d2c,_0x1e5cea[_0xa612('0x46')]);var _0x57c967={'where':_0x3c9d2c[_0xa612('0x40')]};return db['ChatInternalMessage'][_0xa612('0x25')](_0x57c967)[_0xa612('0x2d')](function(_0xffd025){_0x41e8fc[_0xa612('0x25')]=_0xffd025;if(_0x1e5cea['query'][_0xa612('0x47')]){_0x3c9d2c[_0xa612('0x48')]=[{'all':!![]}];}return db[_0xa612('0x49')]['findAll'](_0x3c9d2c);})[_0xa612('0x2d')](function(_0x476911){_0x41e8fc[_0xa612('0x4a')]=_0x476911;return _0x41e8fc;})[_0xa612('0x2d')](respondWithFilteredResult(_0x53f230,_0x3c9d2c))[_0xa612('0x4b')](handleError(_0x53f230,null));};exports['show']=function(_0x4fc70a,_0x1bd653){var _0x43d587={'raw':!![],'where':{'id':_0x4fc70a[_0xa612('0x4c')]['id']}},_0x4a7867={};_0x4a7867[_0xa612('0x36')]=_[_0xa612('0x38')](db[_0xa612('0x49')][_0xa612('0x33')]);_0x4a7867[_0xa612('0x37')]=_[_0xa612('0x38')](_0x4fc70a[_0xa612('0x37')]);_0x4a7867[_0xa612('0x39')]=_[_0xa612('0x3a')](_0x4a7867[_0xa612('0x36')],_0x4a7867[_0xa612('0x37')]);_0x43d587[_0xa612('0x3b')]=_[_0xa612('0x3a')](_0x4a7867['model'],qs['fields'](_0x4fc70a[_0xa612('0x37')][_0xa612('0x3c')]));_0x43d587[_0xa612('0x3b')]=_0x43d587[_0xa612('0x3b')][_0xa612('0x4d')]?_0x43d587[_0xa612('0x3b')]:_0x4a7867[_0xa612('0x36')];if(_0x4fc70a[_0xa612('0x37')]['includeAll']){_0x43d587[_0xa612('0x48')]=[{'all':!![]}];}_0x43d587=_[_0xa612('0x42')]({},_0x43d587,_0x4fc70a[_0xa612('0x46')]);return db[_0xa612('0x49')]['find'](_0x43d587)[_0xa612('0x2d')](handleEntityNotFound(_0x1bd653,null))[_0xa612('0x2d')](respondWithResult(_0x1bd653,null))['catch'](handleError(_0x1bd653,null));};exports[_0xa612('0x4e')]=function(_0x519ec8,_0x5a53ae){return db[_0xa612('0x49')][_0xa612('0x4e')](_0x519ec8[_0xa612('0x4f')],{})[_0xa612('0x2d')](respondWithResult(_0x5a53ae,0xc9))[_0xa612('0x4b')](handleError(_0x5a53ae,null));};exports[_0xa612('0x2c')]=function(_0x3eeea6,_0xb1b2e7){if(_0x3eeea6[_0xa612('0x4f')]['id']){delete _0x3eeea6['body']['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x3eeea6[_0xa612('0x4c')]['id']}})[_0xa612('0x2d')](handleEntityNotFound(_0xb1b2e7,null))[_0xa612('0x2d')](saveUpdates(_0x3eeea6[_0xa612('0x4f')],null))['then'](respondWithResult(_0xb1b2e7,null))['catch'](handleError(_0xb1b2e7,null));};exports[_0xa612('0x2e')]=function(_0x54cdb4,_0x19a37c){return db[_0xa612('0x49')][_0xa612('0x50')]({'where':{'id':_0x54cdb4[_0xa612('0x4c')]['id']}})[_0xa612('0x2d')](handleEntityNotFound(_0x19a37c,null))[_0xa612('0x2d')](removeEntity(_0x19a37c,null))[_0xa612('0x4b')](handleError(_0x19a37c,null));};exports['describe']=function(_0x7552c4,_0x4c3bec){return db[_0xa612('0x49')][_0xa612('0x51')]()[_0xa612('0x2d')](respondWithResult(_0x4c3bec,null))['catch'](handleError(_0x4c3bec,null));};function wrapUser(_0x507834){return function(_0x4255a8){var _0x238365=_0x507834[_0xa612('0x52')]({'plain':!![]});_0x238365[_0xa612('0x53')]=[];if(_0x4255a8){_0x238365[_0xa612('0x54')]=_0x4255a8['createdAt'];_0x238365[_0xa612('0x55')]=_0x4255a8;}else{_0x238365['lastMessageAt']=moment(0x0)[_0xa612('0x56')](_0xa612('0x57'));_0x238365['lastMessage']={};}return _0x238365;};}exports[_0xa612('0x58')]=function(_0x5e0430,_0x7b1055,_0x1f81b0){var _0xfb591a=[];return db[_0xa612('0x59')][_0xa612('0x5a')]({'where':{'role':['agent',_0xa612('0x5b'),_0xa612('0x5c')]},'attributes':['id',_0xa612('0x5d'),_0xa612('0x2f'),'role',_0xa612('0x5e'),'internal',_0xa612('0x5f'),_0xa612('0x60'),_0xa612('0x61'),_0xa612('0x62')],'order':qs[_0xa612('0x3f')]('-online'),'include':[{'model':db[_0xa612('0x63')],'as':'VoiceQueues','attributes':['id',_0xa612('0x2f'),'type'],'through':{'attributes':[]}}]})[_0xa612('0x2d')](function(_0xf5705e){if(_0xf5705e){var _0x35100d=_0x5e0430[_0xa612('0x5c')][_0xa612('0x52')]({'plain':!![]});if(!_0x35100d)throw new Error(_0xa612('0x64'));if(_0x35100d[_0xa612('0x65')]===_0xa612('0x5c')){return db[_0xa612('0x66')][_0xa612('0x50')]({'where':{'name':_0xa612('0x67'),'userProfileId':_0x35100d[_0xa612('0x68')]},'raw':!![]})[_0xa612('0x2d')](function(_0x26ff84){if(_0x26ff84){if(_0x26ff84[_0xa612('0x69')]===0x0){return db[_0xa612('0x6a')][_0xa612('0x5a')]({'where':{'sectionId':_0x26ff84['id']},'raw':!![]})[_0xa612('0x2d')](function(_0x43599f){var _0x72e52=[];if(_[_0xa612('0x6b')](_0x43599f)){_0x72e52=_[_0xa612('0x45')](_0xf5705e,function(_0x33eb44){if(_0x33eb44[_0xa612('0x65')]!=='agent'){return _0x33eb44;}});return _0x72e52;}else{for(var _0xcbfbab=0x0;_0xcbfbab<_0xf5705e['length'];_0xcbfbab++){var _0x3f62f0=_0xf5705e[_0xcbfbab];if(_0x3f62f0[_0xa612('0x65')]==='agent'){var _0x37c4b0=_[_0xa612('0x50')](_0x43599f,function(_0x9bd43d){return _0x9bd43d[_0xa612('0x6c')]===_0x3f62f0['id'];});if(_0x37c4b0)_0x72e52['push'](_0x3f62f0);}else{_0x72e52[_0xa612('0x6d')](_0x3f62f0);}}return _0x72e52;}});}else{return _0xf5705e;}}else{var _0xc83078=_[_0xa612('0x45')](_0xf5705e,function(_0x379866){if(_0x379866[_0xa612('0x65')]!==_0xa612('0x6e')){return _0x379866;}});return _0xc83078;}});}else{return _0xf5705e;}}})[_0xa612('0x2d')](function(_0x71346e){var _0x10cf1d=[];if(_0x71346e){_0xfb591a=_0x71346e;for(var _0x4b9d3a=0x0;_0x4b9d3a<_0x71346e[_0xa612('0x4d')];_0x4b9d3a+=0x1){_0xfb591a[_0x4b9d3a][_0xa612('0x53')]=[];_0x10cf1d[_0xa612('0x6d')](db[_0xa612('0x49')]['find']({'where':{'FromId':[_0x5e0430[_0xa612('0x5c')]['id'],_0x71346e[_0x4b9d3a]['id']],'ToId':[_0x5e0430[_0xa612('0x5c')]['id'],_0x71346e[_0x4b9d3a]['id']],'ChatGroupId':null},'attributes':['id',_0xa612('0x6f'),_0xa612('0x70'),_0xa612('0x71'),_0xa612('0x72'),'body'],'order':qs[_0xa612('0x3f')](_0xa612('0x73')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xa612('0x2d')](wrapUser(_0x71346e[_0x4b9d3a])));}return BPromise[_0xa612('0x74')](_0x10cf1d);}return[];})[_0xa612('0x2d')](function(_0x31425e){return{'rows':_0x31425e,'count':_0x31425e[_0xa612('0x4d')]};})['then'](respondWithResult(_0x7b1055,null))['catch'](handleError(_0x7b1055,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index ebb6ff3..7be417f 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 _0x011c=['hasOwnProperty','hook','../../mysqldb','ChatInternalMessage','remove','emit'];(function(_0x56ab92,_0x481307){var _0x4dcc9c=function(_0xee27d4){while(--_0xee27d4){_0x56ab92['push'](_0x56ab92['shift']());}};_0x4dcc9c(++_0x481307);}(_0x011c,0xf2));var _0xc011=function(_0x3541a6,_0x5b6604){_0x3541a6=_0x3541a6-0x0;var _0x3569c7=_0x011c[_0x3541a6];return _0x3569c7;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xc011('0x0'))['db'][_0xc011('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc011('0x2')};function emitEvent(_0x2914cc){return function(_0x72f7c3,_0x5a9135,_0x168eea){ChatInternalMessageEvents['emit'](_0x2914cc+':'+_0x72f7c3['id'],_0x72f7c3);ChatInternalMessageEvents[_0xc011('0x3')](_0x2914cc,_0x72f7c3);_0x168eea(null);};}for(var e in events){if(events[_0xc011('0x4')](e)){var event=events[e];ChatInternalMessage[_0xc011('0x5')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x9806=['hasOwnProperty','hook','events','ChatInternalMessage','setMaxListeners','save','update','emit'];(function(_0x783e4b,_0x193ea8){var _0x3696d1=function(_0x57fc78){while(--_0x57fc78){_0x783e4b['push'](_0x783e4b['shift']());}};_0x3696d1(++_0x193ea8);}(_0x9806,0x12a));var _0x6980=function(_0x487c1d,_0x187a29){_0x487c1d=_0x487c1d-0x0;var _0x528d47=_0x9806[_0x487c1d];return _0x528d47;};'use strict';var EventEmitter=require(_0x6980('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x6980('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6980('0x2')](0x0);var events={'afterCreate':_0x6980('0x3'),'afterUpdate':_0x6980('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2a0e21){return function(_0x4f78d4,_0x1d7110,_0x26b3ea){ChatInternalMessageEvents[_0x6980('0x5')](_0x2a0e21+':'+_0x4f78d4['id'],_0x4f78d4);ChatInternalMessageEvents[_0x6980('0x5')](_0x2a0e21,_0x4f78d4);_0x26b3ea(null);};}for(var e in events){if(events[_0x6980('0x6')](e)){var event=events[e];ChatInternalMessage[_0x6980('0x7')](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 0a454fc..f315090 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 _0xe660=['exports','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','path','rimraf','./chatInternalMessage.attributes'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xe660,0xe0));var _0x0e66=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0xe660[_0x257495];return _0x3849aa;};'use strict';var _=require('lodash');var util=require(_0x0e66('0x0'));var logger=require(_0x0e66('0x1'))(_0x0e66('0x2'));var moment=require('moment');var BPromise=require(_0x0e66('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e66('0x4'));var rimraf=require(_0x0e66('0x5'));var config=require('../../config/environment');var attributes=require(_0x0e66('0x6'));module[_0x0e66('0x7')]=function(_0x173f7a,_0x127c69){return _0x173f7a['define'](_0x0e66('0x8'),attributes,{'tableName':_0x0e66('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0e66('0xa')});}; \ No newline at end of file +var _0x7ab8=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x7ab8,0x133));var _0x87ab=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x7ab8[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x87ab('0x0'));var util=require(_0x87ab('0x1'));var logger=require(_0x87ab('0x2'))(_0x87ab('0x3'));var moment=require(_0x87ab('0x4'));var BPromise=require('bluebird');var rp=require(_0x87ab('0x5'));var fs=require('fs');var path=require(_0x87ab('0x6'));var rimraf=require(_0x87ab('0x7'));var config=require(_0x87ab('0x8'));var attributes=require(_0x87ab('0x9'));module[_0x87ab('0xa')]=function(_0x3b7f2d,_0x3a6027){return _0x3b7f2d['define'](_0x87ab('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x87ab('0xc'),'collate':_0x87ab('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 4cb4ee6..fefd822 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 _0xc923=['redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1bfda4,_0x4a1d18){var _0x2a3741=function(_0x1db468){while(--_0x1db468){_0x1bfda4['push'](_0x1bfda4['shift']());}};_0x2a3741(++_0x4a1d18);}(_0xc923,0x1ef));var _0x3c92=function(_0x3ba646,_0x3c1666){_0x3ba646=_0x3ba646-0x0;var _0x3d05a1=_0xc923[_0x3ba646];return _0x3d05a1;};'use strict';var _=require(_0x3c92('0x0'));var util=require(_0x3c92('0x1'));var moment=require(_0x3c92('0x2'));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(_0x3c92('0x3'))(_0x3c92('0x4'));var config=require(_0x3c92('0x5'));var jayson=require(_0x3c92('0x6'));var client=jayson[_0x3c92('0x7')][_0x3c92('0x8')]({'port':0x232a});config[_0x3c92('0x9')]=_[_0x3c92('0xa')](config[_0x3c92('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3c92('0xb'))(new Redis(config[_0x3c92('0x9')]));require(_0x3c92('0xc'))[_0x3c92('0xd')](socket);function respondWithRpcPromise(_0x5dcd73,_0x2e1eeb,_0x59300c){return new BPromise(function(_0x31addc,_0x4c3628){return client[_0x3c92('0xe')](_0x5dcd73,_0x59300c)[_0x3c92('0xf')](function(_0x1be3a3){logger[_0x3c92('0x10')](_0x3c92('0x11'),_0x2e1eeb,_0x3c92('0x12'));logger['debug'](_0x3c92('0x13'),_0x2e1eeb,_0x3c92('0x12'),JSON['stringify'](_0x1be3a3));if(_0x1be3a3[_0x3c92('0x14')]){if(_0x1be3a3[_0x3c92('0x14')]['code']===0x1f4){logger['error'](_0x3c92('0x11'),_0x2e1eeb,_0x1be3a3[_0x3c92('0x14')][_0x3c92('0x15')]);return _0x4c3628(_0x1be3a3[_0x3c92('0x14')][_0x3c92('0x15')]);}logger[_0x3c92('0x14')](_0x3c92('0x11'),_0x2e1eeb,_0x1be3a3['error'][_0x3c92('0x15')]);return _0x31addc(_0x1be3a3[_0x3c92('0x14')]['message']);}else{logger[_0x3c92('0x10')](_0x3c92('0x11'),_0x2e1eeb,_0x3c92('0x12'));_0x31addc(_0x1be3a3[_0x3c92('0x16')]['message']);}})[_0x3c92('0x17')](function(_0x6a6264){logger['error'](_0x3c92('0x11'),_0x2e1eeb,_0x6a6264);_0x4c3628(_0x6a6264);});});} \ No newline at end of file +var _0x16c6=['error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x16c6,0x18d));var _0x616c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x16c6[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x616c('0x0'));var util=require('util');var moment=require(_0x616c('0x1'));var BPromise=require(_0x616c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x616c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x616c('0x4'));var logger=require(_0x616c('0x5'))(_0x616c('0x6'));var config=require(_0x616c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x616c('0x8')]({'port':0x232a});config[_0x616c('0x9')]=_[_0x616c('0xa')](config[_0x616c('0x9')],{'host':_0x616c('0xb'),'port':0x18eb});var socket=require(_0x616c('0xc'))(new Redis(config['redis']));require(_0x616c('0xd'))[_0x616c('0xe')](socket);function respondWithRpcPromise(_0x39a811,_0x5c7484,_0x3edcfa){return new BPromise(function(_0x257bce,_0x1404c2){return client[_0x616c('0xf')](_0x39a811,_0x3edcfa)[_0x616c('0x10')](function(_0x3d88e6){logger[_0x616c('0x11')](_0x616c('0x12'),_0x5c7484,'request\x20sent');logger[_0x616c('0x13')](_0x616c('0x14'),_0x5c7484,_0x616c('0x15'),JSON[_0x616c('0x16')](_0x3d88e6));if(_0x3d88e6[_0x616c('0x17')]){if(_0x3d88e6[_0x616c('0x17')][_0x616c('0x18')]===0x1f4){logger['error'](_0x616c('0x12'),_0x5c7484,_0x3d88e6['error']['message']);return _0x1404c2(_0x3d88e6['error'][_0x616c('0x19')]);}logger[_0x616c('0x17')](_0x616c('0x12'),_0x5c7484,_0x3d88e6[_0x616c('0x17')][_0x616c('0x19')]);return _0x257bce(_0x3d88e6['error'][_0x616c('0x19')]);}else{logger['info'](_0x616c('0x12'),_0x5c7484,'request\x20sent');_0x257bce(_0x3d88e6[_0x616c('0x1a')][_0x616c('0x19')]);}})[_0x616c('0x1b')](function(_0x2d38f8){logger[_0x616c('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x5c7484,_0x2d38f8);_0x1404c2(_0x2d38f8);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 7f416f3..64105d5 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 _0x9059=['remove','update','emit','register','length','./chatInternalMessage.events','save'];(function(_0x3c35a4,_0x355c06){var _0x7231c0=function(_0x3be986){while(--_0x3be986){_0x3c35a4['push'](_0x3c35a4['shift']());}};_0x7231c0(++_0x355c06);}(_0x9059,0x163));var _0x9905=function(_0xdcf359,_0x4cd24c){_0xdcf359=_0xdcf359-0x0;var _0x46af1c=_0x9059[_0xdcf359];return _0x46af1c;};'use strict';var ChatInternalMessageEvents=require(_0x9905('0x0'));var events=[_0x9905('0x1'),_0x9905('0x2'),_0x9905('0x3')];function createListener(_0x168c0a,_0x1ad9cf){return function(_0x4d785d){_0x1ad9cf[_0x9905('0x4')](_0x168c0a,_0x4d785d);};}function removeListener(_0x4354ed,_0x4c9c8a){return function(){ChatInternalMessageEvents['removeListener'](_0x4354ed,_0x4c9c8a);};}exports[_0x9905('0x5')]=function(_0x54773b){for(var _0x1bc098=0x0,_0x3626d9=events[_0x9905('0x6')];_0x1bc098<_0x3626d9;_0x1bc098++){var _0x50521c=events[_0x1bc098];var _0x2a278a=createListener('chatInternalMessage:'+_0x50521c,_0x54773b);ChatInternalMessageEvents['on'](_0x50521c,_0x2a278a);}}; \ No newline at end of file +var _0x8806=['remove','update','register','length','./chatInternalMessage.events','save'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8806,0xfa));var _0x6880=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x8806[_0x3fba9f];return _0x192cf1;};'use strict';var ChatInternalMessageEvents=require(_0x6880('0x0'));var events=[_0x6880('0x1'),_0x6880('0x2'),_0x6880('0x3')];function createListener(_0x50330a,_0x45c659){return function(_0x28f95e){_0x45c659['emit'](_0x50330a,_0x28f95e);};}function removeListener(_0x2109f4,_0x431dcf){return function(){ChatInternalMessageEvents['removeListener'](_0x2109f4,_0x431dcf);};}exports[_0x6880('0x4')]=function(_0x2e122b){for(var _0x201960=0x0,_0x9e28d4=events[_0x6880('0x5')];_0x201960<_0x9e28d4;_0x201960++){var _0x53fb3b=events[_0x201960];var _0x7ec92=createListener('chatInternalMessage:'+_0x53fb3b,_0x2e122b);ChatInternalMessageEvents['on'](_0x53fb3b,_0x7ec92);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index b7c8d4d..c5fc059 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 _0x47d9=['show','post','put','update','delete','exports','multer','util','express','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id'];(function(_0x2dea58,_0x59d6f0){var _0x2b23c2=function(_0x3e5c44){while(--_0x3e5c44){_0x2dea58['push'](_0x2dea58['shift']());}};_0x2b23c2(++_0x59d6f0);}(_0x47d9,0x195));var _0x947d=function(_0x25b620,_0x35b70e){_0x25b620=_0x25b620-0x0;var _0x4a0254=_0x47d9[_0x25b620];return _0x4a0254;};'use strict';var multer=require(_0x947d('0x0'));var util=require(_0x947d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x947d('0x2'));var router=express['Router']();var fs_extra=require(_0x947d('0x3'));var auth=require(_0x947d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x947d('0x5'));var controller=require(_0x947d('0x6'));router[_0x947d('0x7')]('/',auth[_0x947d('0x8')](),controller[_0x947d('0x9')]);router[_0x947d('0x7')](_0x947d('0xa'),auth[_0x947d('0x8')](),controller[_0x947d('0xb')]);router[_0x947d('0x7')](_0x947d('0xc'),auth[_0x947d('0x8')](),controller[_0x947d('0xd')]);router[_0x947d('0x7')](_0x947d('0xe'),auth[_0x947d('0x8')](),controller[_0x947d('0xf')]);router[_0x947d('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x947d('0x11')](_0x947d('0xe'),controller[_0x947d('0x12')]);router[_0x947d('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x947d('0x14')]=router; \ No newline at end of file +var _0x55df=['../../config/environment','./chatInternalMessage.controller','index','get','isAuthenticated','describe','show','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x55df,0x1c6));var _0xf55d=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x55df[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require('multer');var util=require(_0xf55d('0x0'));var path=require(_0xf55d('0x1'));var timeout=require(_0xf55d('0x2'));var express=require(_0xf55d('0x3'));var router=express[_0xf55d('0x4')]();var fs_extra=require(_0xf55d('0x5'));var auth=require(_0xf55d('0x6'));var interaction=require(_0xf55d('0x7'));var config=require(_0xf55d('0x8'));var controller=require(_0xf55d('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf55d('0xa')]);router[_0xf55d('0xb')]('/describe',auth[_0xf55d('0xc')](),controller[_0xf55d('0xd')]);router[_0xf55d('0xb')]('/users',auth['isAuthenticated'](),controller['getUsers']);router['get']('/:id',auth[_0xf55d('0xc')](),controller[_0xf55d('0xe')]);router['post']('/',auth[_0xf55d('0xc')](),controller[_0xf55d('0xf')]);router[_0xf55d('0x10')](_0xf55d('0x11'),controller[_0xf55d('0x12')]);router[_0xf55d('0x13')](_0xf55d('0x11'),auth[_0xf55d('0xc')](),controller[_0xf55d('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index c69f5ba..b07791d 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 _0xd070=['medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize','TEXT'];(function(_0xc0213d,_0x4a3b1d){var _0x1a93c4=function(_0xc683f3){while(--_0xc683f3){_0xc0213d['push'](_0xc0213d['shift']());}};_0x1a93c4(++_0x4a3b1d);}(_0xd070,0x8e));var _0x0d07=function(_0x202e27,_0x300fbc){_0x202e27=_0x202e27-0x0;var _0x333bd4=_0xd070[_0x202e27];return _0x333bd4;};'use strict';var Sequelize=require(_0x0d07('0x0'));module['exports']={'body':{'type':Sequelize[_0x0d07('0x1')](_0x0d07('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0d07('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x0d07('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0d07('0x4')]('in',_0x0d07('0x5')),'defaultValue':_0x0d07('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x0d07('0x6')]},'providerName':{'type':Sequelize[_0x0d07('0x7')]},'providerResponse':{'type':Sequelize[_0x0d07('0x1')]}}; \ No newline at end of file +var _0x39c4=['exports','BOOLEAN','out','DATE','STRING','TEXT'];(function(_0x483315,_0x4b34d1){var _0xb6652d=function(_0x5d7fa0){while(--_0x5d7fa0){_0x483315['push'](_0x483315['shift']());}};_0xb6652d(++_0x4b34d1);}(_0x39c4,0x174));var _0x439c=function(_0x4d68bc,_0x24d31f){_0x4d68bc=_0x4d68bc-0x0;var _0x40571a=_0x39c4[_0x4d68bc];return _0x40571a;};'use strict';var Sequelize=require('sequelize');module[_0x439c('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x439c('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x439c('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x439c('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0x439c('0x3')]},'providerName':{'type':Sequelize[_0x439c('0x4')]},'providerResponse':{'type':Sequelize[_0x439c('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 8fa14cd..c53fc3a 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 _0x3165=['chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','QueryTypes','formData','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','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','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','destroy','end','stack','send','map','ChatMessage','fieldName','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','describe','chat-interactions','read','readAt','user','agent','UserId','get','ChatInteraction','ChatInteractionId','update','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE: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','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','parse','reject'];(function(_0x32a122,_0x4e1fbf){var _0x3b814c=function(_0x1a190e){while(--_0x1a190e){_0x32a122['push'](_0x32a122['shift']());}};_0x3b814c(++_0x4e1fbf);}(_0x3165,0x91));var _0x5316=function(_0x339972,_0x484ac8){_0x339972=_0x339972-0x0;var _0x1acb17=_0x3165[_0x339972];return _0x1acb17;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5316('0x0'));var zipdir=require(_0x5316('0x1'));var jsonpatch=require(_0x5316('0x2'));var rp=require(_0x5316('0x3'));var moment=require('moment');var BPromise=require(_0x5316('0x4'));var Mustache=require(_0x5316('0x5'));var util=require(_0x5316('0x6'));var path=require(_0x5316('0x7'));var sox=require('sox');var csv=require(_0x5316('0x8'));var ejs=require(_0x5316('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5316('0xa'));var jsforce=require(_0x5316('0xb'));var deskjs=require(_0x5316('0xc'));var toCsv=require(_0x5316('0x8'));var querystring=require(_0x5316('0xd'));var Papa=require(_0x5316('0xe'));var Redis=require(_0x5316('0xf'));var authService=require(_0x5316('0x10'));var qs=require(_0x5316('0x11'));var as=require(_0x5316('0x12'));var hardwareService=require(_0x5316('0x13'));var logger=require(_0x5316('0x14'))('api');var utils=require(_0x5316('0x15'));var config=require(_0x5316('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5316('0x17'))['db'];config['redis']=_['defaults'](config[_0x5316('0x18')],{'host':_0x5316('0x19'),'port':0x18eb});var socket=require(_0x5316('0x1a'))(new Redis(config[_0x5316('0x18')]));require(_0x5316('0x1b'))[_0x5316('0x1c')](socket);var jayson=require(_0x5316('0x1d'));var client=jayson[_0x5316('0x1e')][_0x5316('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x5316('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1c4d54,_0x18c999,_0x2eace7,_0x46bc78){return new BPromise(function(_0x465ec8,_0x527bb8){var _0x1f83b0=_0x46bc78||client;return _0x1f83b0[_0x5316('0x20')](_0x1c4d54,_0x2eace7)[_0x5316('0x21')](function(_0x1a4bf6){logger[_0x5316('0x22')]('ChatMessage,\x20%s,\x20%s',_0x18c999,_0x5316('0x23'));logger[_0x5316('0x24')](_0x5316('0x25'),_0x18c999,_0x5316('0x23'),JSON[_0x5316('0x26')](_0x1a4bf6));if(_0x1a4bf6['error']){if(_0x1a4bf6[_0x5316('0x27')][_0x5316('0x28')]===0x1f4){logger['error'](_0x5316('0x29'),_0x18c999,_0x1a4bf6[_0x5316('0x27')][_0x5316('0x2a')]);return _0x527bb8(_0x1a4bf6[_0x5316('0x27')]['message']);}logger[_0x5316('0x27')](_0x5316('0x29'),_0x18c999,_0x1a4bf6[_0x5316('0x27')][_0x5316('0x2a')]);return _0x465ec8(_0x1a4bf6['error']['message']);}else{logger[_0x5316('0x22')](_0x5316('0x29'),_0x18c999,_0x5316('0x23'));_0x465ec8(_0x1a4bf6[_0x5316('0x2b')][_0x5316('0x2a')]);}})[_0x5316('0x2c')](function(_0x3c6689){logger[_0x5316('0x27')]('ChatMessage,\x20%s,\x20%s',_0x18c999,_0x3c6689);_0x527bb8(_0x3c6689);});});}function respondWithStatusCode(_0x1532bc,_0x19a519){_0x19a519=_0x19a519||0xcc;return function(_0x1362f8){if(_0x1362f8){return _0x1532bc[_0x5316('0x2d')](_0x19a519);}return _0x1532bc[_0x5316('0x2e')](_0x19a519)['end']();};}function respondWithResult(_0x1b2e39,_0xd895a8){_0xd895a8=_0xd895a8||0xc8;return function(_0x16b47f){if(_0x16b47f){return _0x1b2e39[_0x5316('0x2e')](_0xd895a8)[_0x5316('0x2f')](_0x16b47f);}};}function respondWithFilteredResult(_0x1f1fb0,_0x240eee){return function(_0x227d1d){if(_0x227d1d){var _0x49a2f2=typeof _0x240eee['offset']===_0x5316('0x30')&&typeof _0x240eee[_0x5316('0x31')]===_0x5316('0x30');var _0x340a86=_0x227d1d[_0x5316('0x32')];var _0x10456d=_0x49a2f2?0x0:_0x240eee[_0x5316('0x33')];var _0x447c52=_0x49a2f2?_0x227d1d[_0x5316('0x32')]:_0x240eee[_0x5316('0x33')]+_0x240eee[_0x5316('0x31')];var _0x526ce8;if(_0x447c52>=_0x340a86){_0x447c52=_0x340a86;_0x526ce8=0xc8;}else{_0x526ce8=0xce;}_0x1f1fb0[_0x5316('0x2e')](_0x526ce8);return _0x1f1fb0[_0x5316('0x34')](_0x5316('0x35'),_0x10456d+'-'+_0x447c52+'/'+_0x340a86)['json'](_0x227d1d);}return null;};}function patchUpdates(_0x3266a6){return function(_0xab6148){try{jsonpatch[_0x5316('0x36')](_0xab6148,_0x3266a6,!![]);}catch(_0x4c430c){return BPromise['reject'](_0x4c430c);}return _0xab6148[_0x5316('0x37')]();};}function saveUpdates(_0x5ccbd7,_0x1736f4){return function(_0x120e2b){if(_0x120e2b){return _0x120e2b['update'](_0x5ccbd7)[_0x5316('0x21')](function(_0x3e4716){return _0x3e4716;});}return null;};}function removeEntity(_0x3d3717,_0x37c750){return function(_0x1c1b44){if(_0x1c1b44){return _0x1c1b44[_0x5316('0x38')]()[_0x5316('0x21')](function(){_0x3d3717['status'](0xcc)[_0x5316('0x39')]();});}};}function handleEntityNotFound(_0x2eea4c,_0x1514ca){return function(_0x1400bf){if(!_0x1400bf){_0x2eea4c['sendStatus'](0x194);}return _0x1400bf;};}function handleError(_0xfd90b3,_0x4a888b){_0x4a888b=_0x4a888b||0x1f4;return function(_0x5aba20){logger[_0x5316('0x27')](_0x5aba20[_0x5316('0x3a')]);if(_0x5aba20['name']){delete _0x5aba20['name'];}_0xfd90b3[_0x5316('0x2e')](_0x4a888b)[_0x5316('0x3b')](_0x5aba20);};}exports['index']=function(_0x170468,_0x34b253){var _0xa5240c={},_0x20addc={},_0x1adabf={'count':0x0,'rows':[]};var _0x594111=_[_0x5316('0x3c')](db[_0x5316('0x3d')]['rawAttributes'],function(_0x4cc90b){return{'name':_0x4cc90b[_0x5316('0x3e')],'type':_0x4cc90b['type'][_0x5316('0x3f')]};});_0x20addc[_0x5316('0x40')]=_[_0x5316('0x3c')](_0x594111,_0x5316('0x41'));_0x20addc[_0x5316('0x42')]=_['keys'](_0x170468[_0x5316('0x42')]);_0x20addc[_0x5316('0x43')]=_['intersection'](_0x20addc['model'],_0x20addc[_0x5316('0x42')]);_0xa5240c['attributes']=_[_0x5316('0x44')](_0x20addc['model'],qs['fields'](_0x170468[_0x5316('0x42')][_0x5316('0x45')]));_0xa5240c[_0x5316('0x46')]=_0xa5240c[_0x5316('0x46')][_0x5316('0x47')]?_0xa5240c[_0x5316('0x46')]:_0x20addc[_0x5316('0x40')];if(!_0x170468[_0x5316('0x42')][_0x5316('0x48')]('nolimit')){_0xa5240c[_0x5316('0x31')]=qs[_0x5316('0x31')](_0x170468['query']['limit']);_0xa5240c['offset']=qs[_0x5316('0x33')](_0x170468[_0x5316('0x42')][_0x5316('0x33')]);}_0xa5240c[_0x5316('0x49')]=qs[_0x5316('0x4a')](_0x170468[_0x5316('0x42')][_0x5316('0x4a')]);_0xa5240c[_0x5316('0x4b')]=qs[_0x5316('0x43')](_[_0x5316('0x4c')](_0x170468[_0x5316('0x42')],_0x20addc[_0x5316('0x43')]),_0x594111);if(_0x170468['query'][_0x5316('0x4d')]){_0xa5240c[_0x5316('0x4b')]=_[_0x5316('0x4e')](_0xa5240c[_0x5316('0x4b')],{'$or':_[_0x5316('0x3c')](_0x594111,function(_0xc24c74){if(_0xc24c74[_0x5316('0x4f')]!=='VIRTUAL'){var _0x593c9f={};_0x593c9f[_0xc24c74[_0x5316('0x41')]]={'$like':'%'+_0x170468[_0x5316('0x42')][_0x5316('0x4d')]+'%'};return _0x593c9f;}})});}_0xa5240c=_[_0x5316('0x4e')]({},_0xa5240c,_0x170468['options']);var _0x3dfb4e={'where':_0xa5240c[_0x5316('0x4b')]};return db[_0x5316('0x3d')]['count'](_0x3dfb4e)[_0x5316('0x21')](function(_0x41ddc9){_0x1adabf[_0x5316('0x32')]=_0x41ddc9;if(_0x170468[_0x5316('0x42')][_0x5316('0x50')]){_0xa5240c[_0x5316('0x51')]=[{'all':!![]}];}return db['ChatMessage'][_0x5316('0x52')](_0xa5240c);})[_0x5316('0x21')](function(_0x2e628e){_0x1adabf[_0x5316('0x53')]=_0x2e628e;return _0x1adabf;})[_0x5316('0x21')](respondWithFilteredResult(_0x34b253,_0xa5240c))[_0x5316('0x2c')](handleError(_0x34b253,null));};exports[_0x5316('0x54')]=function(_0x3f378a,_0x5296a1){var _0x1e9d54={'raw':!![],'where':{'id':_0x3f378a[_0x5316('0x55')]['id']}},_0x4a5a89={};_0x4a5a89[_0x5316('0x40')]=_[_0x5316('0x56')](db[_0x5316('0x3d')]['rawAttributes']);_0x4a5a89[_0x5316('0x42')]=_[_0x5316('0x56')](_0x3f378a['query']);_0x4a5a89['filters']=_['intersection'](_0x4a5a89[_0x5316('0x40')],_0x4a5a89[_0x5316('0x42')]);_0x1e9d54[_0x5316('0x46')]=_['intersection'](_0x4a5a89['model'],qs[_0x5316('0x45')](_0x3f378a[_0x5316('0x42')][_0x5316('0x45')]));_0x1e9d54[_0x5316('0x46')]=_0x1e9d54['attributes'][_0x5316('0x47')]?_0x1e9d54[_0x5316('0x46')]:_0x4a5a89[_0x5316('0x40')];if(_0x3f378a['query'][_0x5316('0x50')]){_0x1e9d54[_0x5316('0x51')]=[{'all':!![]}];}_0x1e9d54=_[_0x5316('0x4e')]({},_0x1e9d54,_0x3f378a[_0x5316('0x57')]);return db[_0x5316('0x3d')][_0x5316('0x58')](_0x1e9d54)['then'](handleEntityNotFound(_0x5296a1,null))['then'](respondWithResult(_0x5296a1,null))[_0x5316('0x2c')](handleError(_0x5296a1,null));};exports[_0x5316('0x59')]=function(_0x1deebc,_0x4415c9){return db[_0x5316('0x3d')][_0x5316('0x59')](_0x1deebc[_0x5316('0x5a')],{})[_0x5316('0x21')](respondWithResult(_0x4415c9,0xc9))[_0x5316('0x2c')](handleError(_0x4415c9,null));};exports['update']=function(_0x160a52,_0x356777){if(_0x160a52[_0x5316('0x5a')]['id']){delete _0x160a52['body']['id'];}return db['ChatMessage'][_0x5316('0x58')]({'where':{'id':_0x160a52['params']['id']}})[_0x5316('0x21')](handleEntityNotFound(_0x356777,null))[_0x5316('0x21')](saveUpdates(_0x160a52[_0x5316('0x5a')],null))[_0x5316('0x21')](respondWithResult(_0x356777,null))[_0x5316('0x2c')](handleError(_0x356777,null));};exports[_0x5316('0x38')]=function(_0x53ee01,_0x565abb){return db['ChatMessage']['find']({'where':{'id':_0x53ee01[_0x5316('0x55')]['id']}})['then'](handleEntityNotFound(_0x565abb,null))[_0x5316('0x21')](removeEntity(_0x565abb,null))[_0x5316('0x2c')](handleError(_0x565abb,null));};exports[_0x5316('0x5b')]=function(_0x2bcb32,_0x4ab2f9){return db[_0x5316('0x3d')][_0x5316('0x5b')]()[_0x5316('0x21')](respondWithResult(_0x4ab2f9,null))[_0x5316('0x2c')](handleError(_0x4ab2f9,null));};var interaction_log=require(_0x5316('0x14'))(_0x5316('0x5c'));exports['accept']=function(_0x2d6578,_0x24f01a,_0x450255){var _0x5a5327={'agent':{},'channel':'chat'};if(_0x2d6578[_0x5316('0x5a')]['id']){delete _0x2d6578[_0x5316('0x5a')]['id'];}_0x2d6578[_0x5316('0x5a')][_0x5316('0x5d')]=!![];_0x2d6578[_0x5316('0x5a')][_0x5316('0x5e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2d6578[_0x5316('0x5a')]['UserId']=_0x2d6578[_0x5316('0x5a')]['UserId']||_0x2d6578[_0x5316('0x5f')]['id'];_0x5a5327[_0x5316('0x60')]['id']=_0x2d6578[_0x5316('0x5a')][_0x5316('0x61')];return db[_0x5316('0x3d')][_0x5316('0x58')]({'where':{'id':_0x2d6578[_0x5316('0x55')]['id'],'UserId':null}})[_0x5316('0x21')](handleEntityNotFound(_0x24f01a,null))[_0x5316('0x21')](saveUpdates(_0x2d6578['body'],null))['then'](function(_0x4709a3){if(_0x4709a3){_0x5a5327[_0x5316('0x2a')]=_0x4709a3[_0x5316('0x62')]({'plain':!![]});return db[_0x5316('0x63')][_0x5316('0x58')]({'where':{'id':_0x4709a3[_0x5316('0x64')]}});}return null;})[_0x5316('0x21')](handleEntityNotFound(_0x24f01a,null))[_0x5316('0x21')](function(_0x3f01c9){if(_0x3f01c9){return _0x3f01c9[_0x5316('0x65')]({'UserId':_0x2d6578[_0x5316('0x5a')][_0x5316('0x61')],'read1stAt':_[_0x5316('0x66')](_0x3f01c9[_0x5316('0x67')])?moment()[_0x5316('0x68')](_0x5316('0x69')):undefined});}return null;})[_0x5316('0x21')](function(_0x4c1a34){if(_0x4c1a34){_0x5a5327[_0x5316('0x6a')]=_0x4c1a34['get']({'plain':!![]});interaction_log[_0x5316('0x22')](_0x5316('0x6b'),_0x2d6578[_0x5316('0x5f')]['id'],_0x2d6578[_0x5316('0x5f')][_0x5316('0x41')],_0x2d6578[_0x5316('0x5f')]['role'],_0x5a5327[_0x5316('0x6a')]['id'],_0x2d6578[_0x5316('0x5a')]?JSON['stringify'](_0x2d6578[_0x5316('0x5a')]):'null');return respondWithRpcPromise(_0x5316('0x6c'),_0x5316('0x6d'),_0x5a5327);}return null;})[_0x5316('0x21')](function(_0x4fa13b){var _0xad8b6e=_0x5316('0x6e')+_0x4fa13b[_0x5316('0x2a')][_0x5316('0x6f')];return db[_0x5316('0x70')][_0x5316('0x42')](_0xad8b6e,{'type':db[_0x5316('0x71')]['QueryTypes'][_0x5316('0x72')],'raw':!![]})[_0x5316('0x21')](function(_0x1efda8){return _0x1efda8;});})[_0x5316('0x21')](function(_0x595b47){if(_0x595b47){_0x5a5327['message'][_0x5316('0x73')]=_0x595b47[0x0];if(!_0x2d6578[_0x5316('0x5a')][_0x5316('0x61')])return;return db[_0x5316('0x74')][_0x5316('0x58')]({'where':{'id':_0x2d6578[_0x5316('0x5a')]['UserId'],'role':'agent'},'attributes':['id','name',_0x5316('0x75'),_0x5316('0x76'),_0x5316('0x77')],'raw':!![]});}return null;})[_0x5316('0x21')](function(_0x24f663){if(!_0x24f663)return null;_0x5a5327[_0x5316('0x2a')][_0x5316('0x60')]=_0x24f663;return _0x5a5327;})[_0x5316('0x21')](function(_0x30f5c5){if(_0x30f5c5){if(_0x2d6578[_0x5316('0x5a')][_0x5316('0x78')]){_0x5a5327[_0x5316('0x2a')][_0x5316('0x79')]=util[_0x5316('0x68')](_0x5316('0x7a'),_0x2d6578['user'][_0x5316('0x41')]);_0x5a5327[_0x5316('0x2a')][_0x5316('0x7b')]=_0x5a5327['channel'];_0x5a5327[_0x5316('0x2a')][_0x5316('0x7c')]=_0x5a5327['channel'];_0x5a5327[_0x5316('0x2a')][_0x5316('0x7d')]=_0x5316('0x7e');return respondWithRpcPromise(_0x5316('0x7f'),_0x5316('0x7f'),{'event':_0x5316('0x80'),'message':_['merge'](_0x5a5327['message'],JSON[_0x5316('0x81')](_0x5a5327[_0x5316('0x6a')]['formData']))},client9002)[_0x5316('0x21')](function(){return _0x5a5327;});}return _0x5a5327;}return null;})['then'](respondWithResult(_0x24f01a,null))['catch'](handleError(_0x24f01a,null));};var interaction_log=require('../../config/logger')(_0x5316('0x5c'));exports[_0x5316('0x82')]=function(_0x3ec5e4,_0x5e7f02,_0x1ec637){var _0x5b8857={'agent':{},'channel':_0x5316('0x83')};if(_0x3ec5e4['body']['id']){delete _0x3ec5e4[_0x5316('0x5a')]['id'];}_0x3ec5e4[_0x5316('0x5a')][_0x5316('0x61')]=_0x3ec5e4[_0x5316('0x5a')][_0x5316('0x61')]||_0x3ec5e4[_0x5316('0x5f')]['id'];_0x5b8857[_0x5316('0x60')]['id']=_0x3ec5e4[_0x5316('0x5a')][_0x5316('0x61')];return db[_0x5316('0x3d')][_0x5316('0x58')]({'where':{'id':_0x3ec5e4[_0x5316('0x55')]['id'],'UserId':null}})[_0x5316('0x21')](handleEntityNotFound(_0x5e7f02,null))[_0x5316('0x21')](function(_0x1219c7){if(_0x1219c7){_0x5b8857[_0x5316('0x2a')]=_0x1219c7['get']({'plain':!![]});return db[_0x5316('0x63')][_0x5316('0x58')]({'where':{'id':_0x1219c7[_0x5316('0x64')]}});}return null;})[_0x5316('0x21')](handleEntityNotFound(_0x5e7f02,null))['then'](function(_0x126ae5){if(_0x126ae5){_0x5b8857[_0x5316('0x6a')]=_0x126ae5[_0x5316('0x62')]({'plain':!![]});interaction_log[_0x5316('0x22')](_0x5316('0x84'),_0x3ec5e4[_0x5316('0x5f')]['id'],_0x3ec5e4['user'][_0x5316('0x41')],_0x3ec5e4['user'][_0x5316('0x85')],_0x5b8857[_0x5316('0x6a')]['id'],_0x3ec5e4[_0x5316('0x5a')]?JSON[_0x5316('0x26')](_0x3ec5e4['body']):_0x5316('0x86'));return respondWithRpcPromise('RejectMessage',_0x5316('0x87'),_0x5b8857);}return null;})[_0x5316('0x21')](function(_0x2dfef0){var _0x24e3c3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2dfef0['message'][_0x5316('0x6f')];return db[_0x5316('0x70')][_0x5316('0x42')](_0x24e3c3,{'type':db[_0x5316('0x71')][_0x5316('0x88')][_0x5316('0x72')],'raw':!![]})[_0x5316('0x21')](function(_0x43e710){return _0x43e710;});})['then'](function(_0x1e812f){if(_0x1e812f){_0x5b8857[_0x5316('0x2a')][_0x5316('0x73')]=_0x1e812f[0x0];if(!_0x3ec5e4[_0x5316('0x5a')][_0x5316('0x61')])return;return db[_0x5316('0x74')][_0x5316('0x58')]({'where':{'id':_0x3ec5e4[_0x5316('0x5a')]['UserId'],'role':_0x5316('0x60')},'attributes':['id',_0x5316('0x41'),'fullname',_0x5316('0x76'),_0x5316('0x77')],'raw':!![]});}return null;})[_0x5316('0x21')](function(_0x40ad73){if(!_0x40ad73)return null;_0x5b8857[_0x5316('0x2a')]['agent']=_0x40ad73;return _0x5b8857;})[_0x5316('0x21')](function(_0x24990f){if(_0x24990f){_0x24990f[_0x5316('0x2a')]['interface']=util[_0x5316('0x68')]('SIP/%s',_0x3ec5e4[_0x5316('0x5f')]['name']);_0x24990f['message'][_0x5316('0x7b')]=_0x5b8857[_0x5316('0x7b')];_0x24990f[_0x5316('0x2a')][_0x5316('0x7c')]=_0x5b8857[_0x5316('0x7b')];_0x24990f['message'][_0x5316('0x7d')]=_0x5316('0x82');respondWithRpcPromise('EventManager',_0x5316('0x7f'),{'event':'rejectmessage','message':_[_0x5316('0x4e')](_0x5b8857[_0x5316('0x2a')],JSON[_0x5316('0x81')](_0x5b8857[_0x5316('0x6a')][_0x5316('0x89')]))},client9002);return _0x5b8857;}return null;})[_0x5316('0x21')](respondWithResult(_0x5e7f02,null))[_0x5316('0x2c')](handleError(_0x5e7f02,null));}; \ No newline at end of file +var _0x7fd1=['describe','accept','acceptMessage','reject','chat','UserId','agent','get','ChatInteractionId','interaction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','fullname','email','format','SIP/%s','channel','event','rejectmessage','parse','formData','util','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./chatMessage.socket','register','jayson/promise','http','chat-interactions','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','stack','name','index','map','ChatMessage','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','rows','catch','show','rawAttributes','include','options','find','create','body'];(function(_0x4360c4,_0x2f8209){var _0x3168c8=function(_0x309523){while(--_0x309523){_0x4360c4['push'](_0x4360c4['shift']());}};_0x3168c8(++_0x2f8209);}(_0x7fd1,0x80));var _0x17fd=function(_0x247002,_0x5b873e){_0x247002=_0x247002-0x0;var _0x1bc7f5=_0x7fd1[_0x247002];return _0x1bc7f5;};'use strict';var util=require(_0x17fd('0x0'));var _=require('lodash');var Redis=require(_0x17fd('0x1'));var interactionService=require(_0x17fd('0x2'));var qs=require(_0x17fd('0x3'));var logger=require(_0x17fd('0x4'))(_0x17fd('0x5'));var config=require(_0x17fd('0x6'));var db=require(_0x17fd('0x7'))['db'];config['redis']=_[_0x17fd('0x8')](config[_0x17fd('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x17fd('0xa'))(new Redis(config[_0x17fd('0x9')]));require(_0x17fd('0xb'))[_0x17fd('0xc')](socket);var jayson=require(_0x17fd('0xd'));var client=jayson['client'][_0x17fd('0xe')]({'port':0x232c});var client9002=jayson['client'][_0x17fd('0xe')]({'port':0x232a});var interaction_log=require(_0x17fd('0x4'))(_0x17fd('0xf'));function respondWithRpcPromise(_0x453b31,_0x19d743,_0x345e77,_0x258fbe){return new Promise(function(_0x106bcc,_0x3594d6){var _0x1f2c29=_0x258fbe||client;return _0x1f2c29[_0x17fd('0x10')](_0x453b31,_0x345e77)['then'](function(_0x234d6f){logger[_0x17fd('0x11')](_0x17fd('0x12'),_0x19d743,_0x17fd('0x13'));logger['debug'](_0x17fd('0x14'),_0x19d743,_0x17fd('0x13'),JSON[_0x17fd('0x15')](_0x234d6f));if(_0x234d6f[_0x17fd('0x16')]){if(_0x234d6f[_0x17fd('0x16')][_0x17fd('0x17')]===0x1f4){logger[_0x17fd('0x16')](_0x17fd('0x12'),_0x19d743,_0x234d6f[_0x17fd('0x16')][_0x17fd('0x18')]);return _0x3594d6(_0x234d6f[_0x17fd('0x16')][_0x17fd('0x18')]);}logger[_0x17fd('0x16')](_0x17fd('0x12'),_0x19d743,_0x234d6f[_0x17fd('0x16')][_0x17fd('0x18')]);return _0x106bcc(_0x234d6f[_0x17fd('0x16')][_0x17fd('0x18')]);}else{logger[_0x17fd('0x11')](_0x17fd('0x12'),_0x19d743,_0x17fd('0x13'));_0x106bcc(_0x234d6f['result'][_0x17fd('0x18')]);}})['catch'](function(_0x5dc16a){logger[_0x17fd('0x16')](_0x17fd('0x12'),_0x19d743,_0x5dc16a);_0x3594d6(_0x5dc16a);});});}function respondWithResult(_0x2a6476,_0x270cb0){_0x270cb0=_0x270cb0||0xc8;return function(_0x3b4458){if(_0x3b4458){return _0x2a6476[_0x17fd('0x19')](_0x270cb0)[_0x17fd('0x1a')](_0x3b4458);}};}function respondWithFilteredResult(_0x35a823,_0x502f96){return function(_0x3625e6){if(_0x3625e6){var _0x2c0ea0=typeof _0x502f96[_0x17fd('0x1b')]===_0x17fd('0x1c')&&typeof _0x502f96[_0x17fd('0x1d')]===_0x17fd('0x1c');var _0x46692b=_0x3625e6['count'];var _0x1b5d67=_0x2c0ea0?0x0:_0x502f96[_0x17fd('0x1b')];var _0x119c62=_0x2c0ea0?_0x3625e6[_0x17fd('0x1e')]:_0x502f96[_0x17fd('0x1b')]+_0x502f96[_0x17fd('0x1d')];var _0x11a76c;if(_0x119c62>=_0x46692b){_0x119c62=_0x46692b;_0x11a76c=0xc8;}else{_0x11a76c=0xce;}_0x35a823['status'](_0x11a76c);return _0x35a823[_0x17fd('0x1f')](_0x17fd('0x20'),_0x1b5d67+'-'+_0x119c62+'/'+_0x46692b)['json'](_0x3625e6);}return null;};}function saveUpdates(_0x33545c){return function(_0x5a8dff){if(_0x5a8dff){return _0x5a8dff[_0x17fd('0x21')](_0x33545c)[_0x17fd('0x22')](function(_0xaba446){return _0xaba446;});}return null;};}function removeEntity(_0x26c378){return function(_0xebe920){if(_0xebe920){return _0xebe920[_0x17fd('0x23')]()[_0x17fd('0x22')](function(){_0x26c378['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1737e7){return function(_0x46b886){if(!_0x46b886){_0x1737e7[_0x17fd('0x24')](0x194);}return _0x46b886;};}function handleError(_0x1b82ad,_0xcc30f8){_0xcc30f8=_0xcc30f8||0x1f4;return function(_0x3a08d8){logger[_0x17fd('0x16')](_0x3a08d8[_0x17fd('0x25')]);if(_0x3a08d8['name']){delete _0x3a08d8[_0x17fd('0x26')];}_0x1b82ad[_0x17fd('0x19')](_0xcc30f8)['send'](_0x3a08d8);};}exports[_0x17fd('0x27')]=function(_0x5d6a4b,_0x4ed749){var _0x439591={},_0x240a1a={},_0x2b8693={'count':0x0,'rows':[]};var _0x33e59f=_[_0x17fd('0x28')](db[_0x17fd('0x29')]['rawAttributes'],function(_0x3bac69){return{'name':_0x3bac69['fieldName'],'type':_0x3bac69[_0x17fd('0x2a')][_0x17fd('0x2b')]};});_0x240a1a[_0x17fd('0x2c')]=_['map'](_0x33e59f,_0x17fd('0x26'));_0x240a1a[_0x17fd('0x2d')]=_[_0x17fd('0x2e')](_0x5d6a4b['query']);_0x240a1a['filters']=_[_0x17fd('0x2f')](_0x240a1a[_0x17fd('0x2c')],_0x240a1a[_0x17fd('0x2d')]);_0x439591[_0x17fd('0x30')]=_[_0x17fd('0x2f')](_0x240a1a[_0x17fd('0x2c')],qs[_0x17fd('0x31')](_0x5d6a4b[_0x17fd('0x2d')][_0x17fd('0x31')]));_0x439591['attributes']=_0x439591[_0x17fd('0x30')]['length']?_0x439591[_0x17fd('0x30')]:_0x240a1a[_0x17fd('0x2c')];if(!_0x5d6a4b[_0x17fd('0x2d')][_0x17fd('0x32')](_0x17fd('0x33'))){_0x439591[_0x17fd('0x1d')]=qs['limit'](_0x5d6a4b[_0x17fd('0x2d')][_0x17fd('0x1d')]);_0x439591[_0x17fd('0x1b')]=qs[_0x17fd('0x1b')](_0x5d6a4b['query'][_0x17fd('0x1b')]);}_0x439591[_0x17fd('0x34')]=qs[_0x17fd('0x35')](_0x5d6a4b['query']['sort']);_0x439591[_0x17fd('0x36')]=qs[_0x17fd('0x37')](_[_0x17fd('0x38')](_0x5d6a4b['query'],_0x240a1a[_0x17fd('0x37')]),_0x33e59f);if(_0x5d6a4b[_0x17fd('0x2d')][_0x17fd('0x39')]){_0x439591[_0x17fd('0x36')]=_['merge'](_0x439591[_0x17fd('0x36')],{'$or':_[_0x17fd('0x28')](_0x33e59f,function(_0x3bb54b){if(_0x3bb54b[_0x17fd('0x2a')]!==_0x17fd('0x3a')){var _0x5d3491={};_0x5d3491[_0x3bb54b['name']]={'$like':'%'+_0x5d6a4b[_0x17fd('0x2d')][_0x17fd('0x39')]+'%'};return _0x5d3491;}})});}_0x439591=_[_0x17fd('0x3b')]({},_0x439591,_0x5d6a4b['options']);var _0x1e6e24={'where':_0x439591['where']};return db[_0x17fd('0x29')]['count'](_0x1e6e24)[_0x17fd('0x22')](function(_0xee0c27){_0x2b8693['count']=_0xee0c27;if(_0x5d6a4b[_0x17fd('0x2d')][_0x17fd('0x3c')]){_0x439591['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x439591);})[_0x17fd('0x22')](function(_0x4fc953){_0x2b8693[_0x17fd('0x3d')]=_0x4fc953;return _0x2b8693;})[_0x17fd('0x22')](respondWithFilteredResult(_0x4ed749,_0x439591))[_0x17fd('0x3e')](handleError(_0x4ed749,null));};exports[_0x17fd('0x3f')]=function(_0x144d4f,_0x5bd79f){var _0x199d2d={'raw':!![],'where':{'id':_0x144d4f['params']['id']}},_0x3b4102={};_0x3b4102[_0x17fd('0x2c')]=_[_0x17fd('0x2e')](db[_0x17fd('0x29')][_0x17fd('0x40')]);_0x3b4102[_0x17fd('0x2d')]=_[_0x17fd('0x2e')](_0x144d4f[_0x17fd('0x2d')]);_0x3b4102[_0x17fd('0x37')]=_[_0x17fd('0x2f')](_0x3b4102[_0x17fd('0x2c')],_0x3b4102['query']);_0x199d2d[_0x17fd('0x30')]=_[_0x17fd('0x2f')](_0x3b4102['model'],qs[_0x17fd('0x31')](_0x144d4f[_0x17fd('0x2d')][_0x17fd('0x31')]));_0x199d2d[_0x17fd('0x30')]=_0x199d2d[_0x17fd('0x30')]['length']?_0x199d2d[_0x17fd('0x30')]:_0x3b4102[_0x17fd('0x2c')];if(_0x144d4f['query'][_0x17fd('0x3c')]){_0x199d2d[_0x17fd('0x41')]=[{'all':!![]}];}_0x199d2d=_['merge']({},_0x199d2d,_0x144d4f[_0x17fd('0x42')]);return db[_0x17fd('0x29')][_0x17fd('0x43')](_0x199d2d)[_0x17fd('0x22')](handleEntityNotFound(_0x5bd79f,null))[_0x17fd('0x22')](respondWithResult(_0x5bd79f,null))[_0x17fd('0x3e')](handleError(_0x5bd79f,null));};exports[_0x17fd('0x44')]=function(_0x2663d2,_0x4cc307){return db[_0x17fd('0x29')][_0x17fd('0x44')](_0x2663d2[_0x17fd('0x45')],{})[_0x17fd('0x22')](respondWithResult(_0x4cc307,0xc9))['catch'](handleError(_0x4cc307,null));};exports[_0x17fd('0x21')]=function(_0x397086,_0x4dfb8f){if(_0x397086[_0x17fd('0x45')]['id']){delete _0x397086['body']['id'];}return db[_0x17fd('0x29')][_0x17fd('0x43')]({'where':{'id':_0x397086['params']['id']}})[_0x17fd('0x22')](handleEntityNotFound(_0x4dfb8f,null))[_0x17fd('0x22')](saveUpdates(_0x397086[_0x17fd('0x45')],null))[_0x17fd('0x22')](respondWithResult(_0x4dfb8f,null))[_0x17fd('0x3e')](handleError(_0x4dfb8f,null));};exports[_0x17fd('0x23')]=function(_0x438c8c,_0x4465ba){return db[_0x17fd('0x29')][_0x17fd('0x43')]({'where':{'id':_0x438c8c['params']['id']}})[_0x17fd('0x22')](handleEntityNotFound(_0x4465ba,null))['then'](removeEntity(_0x4465ba,null))[_0x17fd('0x3e')](handleError(_0x4465ba,null));};exports[_0x17fd('0x46')]=function(_0x4e4879,_0x3a9920){return db[_0x17fd('0x29')][_0x17fd('0x46')]()[_0x17fd('0x22')](respondWithResult(_0x3a9920,null))[_0x17fd('0x3e')](handleError(_0x3a9920,null));};exports[_0x17fd('0x47')]=function(_0x1aa8a9,_0x240c56){var _0x5e5f88='chat';return interactionService[_0x17fd('0x48')](_0x1aa8a9,_0x5e5f88)[_0x17fd('0x22')](respondWithResult(_0x240c56,null))[_0x17fd('0x3e')](handleError(_0x240c56,null));};exports[_0x17fd('0x49')]=function(_0x4973bd,_0x4ad3a7){var _0x567e95={'agent':{},'channel':_0x17fd('0x4a')};if(_0x4973bd[_0x17fd('0x45')]['id']){delete _0x4973bd[_0x17fd('0x45')]['id'];}_0x4973bd[_0x17fd('0x45')][_0x17fd('0x4b')]=_0x4973bd[_0x17fd('0x45')][_0x17fd('0x4b')]||_0x4973bd['user']['id'];_0x567e95[_0x17fd('0x4c')]['id']=_0x4973bd[_0x17fd('0x45')][_0x17fd('0x4b')];return db[_0x17fd('0x29')][_0x17fd('0x43')]({'where':{'id':_0x4973bd['params']['id'],'UserId':null}})[_0x17fd('0x22')](handleEntityNotFound(_0x4ad3a7,null))['then'](function(_0x105ac7){if(_0x105ac7){_0x567e95['message']=_0x105ac7[_0x17fd('0x4d')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x105ac7[_0x17fd('0x4e')]}});}return null;})[_0x17fd('0x22')](handleEntityNotFound(_0x4ad3a7,null))[_0x17fd('0x22')](function(_0x4a409d){if(_0x4a409d){_0x567e95[_0x17fd('0x4f')]=_0x4a409d[_0x17fd('0x4d')]({'plain':!![]});interaction_log['info'](_0x17fd('0x50'),_0x4973bd[_0x17fd('0x51')]['id'],_0x4973bd[_0x17fd('0x51')][_0x17fd('0x26')],_0x4973bd['user'][_0x17fd('0x52')],_0x567e95[_0x17fd('0x4f')]['id'],_0x4973bd[_0x17fd('0x45')]?JSON['stringify'](_0x4973bd[_0x17fd('0x45')]):'null');return respondWithRpcPromise(_0x17fd('0x53'),_0x17fd('0x54'),_0x567e95);}return null;})[_0x17fd('0x22')](function(_0x5b236e){var _0x1d6377=_0x17fd('0x55')+_0x5b236e[_0x17fd('0x18')]['ContactId'];return db['sequelize'][_0x17fd('0x2d')](_0x1d6377,{'type':db[_0x17fd('0x56')][_0x17fd('0x57')][_0x17fd('0x58')],'raw':!![]})[_0x17fd('0x22')](function(_0x2ee264){return _0x2ee264;});})[_0x17fd('0x22')](function(_0x4aa200){if(_0x4aa200){_0x567e95['message'][_0x17fd('0x59')]=_0x4aa200[0x0];if(!_0x4973bd['body'][_0x17fd('0x4b')])return;return db['User'][_0x17fd('0x43')]({'where':{'id':_0x4973bd['body'][_0x17fd('0x4b')],'role':_0x17fd('0x4c')},'attributes':['id','name',_0x17fd('0x5a'),_0x17fd('0x5b'),'internal'],'raw':!![]});}return null;})[_0x17fd('0x22')](function(_0x4075aa){if(!_0x4075aa)return null;_0x567e95[_0x17fd('0x18')][_0x17fd('0x4c')]=_0x4075aa;return _0x567e95;})[_0x17fd('0x22')](function(_0x49c0d4){if(_0x49c0d4){_0x49c0d4[_0x17fd('0x18')]['interface']=util[_0x17fd('0x5c')](_0x17fd('0x5d'),_0x4973bd[_0x17fd('0x51')][_0x17fd('0x26')]);_0x49c0d4[_0x17fd('0x18')][_0x17fd('0x5e')]=_0x567e95[_0x17fd('0x5e')];_0x49c0d4['message']['motionChannel']=_0x567e95[_0x17fd('0x5e')];_0x49c0d4[_0x17fd('0x18')][_0x17fd('0x5f')]=_0x17fd('0x49');respondWithRpcPromise('EventManager','EventManager',{'event':_0x17fd('0x60'),'message':_[_0x17fd('0x3b')](_0x567e95[_0x17fd('0x18')],JSON[_0x17fd('0x61')](_0x567e95[_0x17fd('0x4f')][_0x17fd('0x62')]))},client9002);return _0x567e95;}return null;})['then'](respondWithResult(_0x4ad3a7,null))['catch'](handleError(_0x4ad3a7,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index b45e778..eeffc36 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 _0xf006=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x43bfc3,_0x5dc8b8){var _0x3b6850=function(_0x203871){while(--_0x203871){_0x43bfc3['push'](_0x43bfc3['shift']());}};_0x3b6850(++_0x5dc8b8);}(_0xf006,0x1e4));var _0x6f00=function(_0x43551c,_0x4cf871){_0x43551c=_0x43551c-0x0;var _0x37594e=_0xf006[_0x43551c];return _0x37594e;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x6f00('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6f00('0x1')](0x0);var events={'afterCreate':_0x6f00('0x2'),'afterUpdate':_0x6f00('0x3'),'afterDestroy':'remove'};function emitEvent(_0x12b842){return function(_0xd00ceb,_0x3d6548,_0x2d80fa){ChatMessageEvents[_0x6f00('0x4')](_0x12b842+':'+_0xd00ceb['id'],_0xd00ceb);ChatMessageEvents['emit'](_0x12b842,_0xd00ceb);_0x2d80fa(null);};}for(var e in events){if(events[_0x6f00('0x5')](e)){var event=events[e];ChatMessage[_0x6f00('0x6')](e,emitEvent(event));}}module[_0x6f00('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x6b5a=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x4ef8c2,_0x5a4399){var _0x84f62=function(_0x5aa0df){while(--_0x5aa0df){_0x4ef8c2['push'](_0x4ef8c2['shift']());}};_0x84f62(++_0x5a4399);}(_0x6b5a,0x1d5));var _0xa6b5=function(_0x5d0a61,_0x3e866d){_0x5d0a61=_0x5d0a61-0x0;var _0x3a526f=_0x6b5a[_0x5d0a61];return _0x3a526f;};'use strict';var EventEmitter=require(_0xa6b5('0x0'));var ChatMessage=require(_0xa6b5('0x1'))['db'][_0xa6b5('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa6b5('0x3')](0x0);var events={'afterCreate':_0xa6b5('0x4'),'afterUpdate':_0xa6b5('0x5'),'afterDestroy':_0xa6b5('0x6')};function emitEvent(_0x4f4dce){return function(_0xd069c0,_0xc342fb,_0x27620c){ChatMessageEvents[_0xa6b5('0x7')](_0x4f4dce+':'+_0xd069c0['id'],_0xd069c0);ChatMessageEvents[_0xa6b5('0x7')](_0x4f4dce,_0xd069c0);_0x27620c(null);};}for(var e in events){if(events[_0xa6b5('0x8')](e)){var event=events[e];ChatMessage[_0xa6b5('0x9')](e,emitEvent(event));}}module[_0xa6b5('0xa')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 5c47fce..b20f246 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 _0x958f=['secret','UserId','findOne','ChatInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out'];(function(_0xc61db9,_0xe9447){var _0x1c6397=function(_0x107352){while(--_0x107352){_0xc61db9['push'](_0xc61db9['shift']());}};_0x1c6397(++_0xe9447);}(_0x958f,0x19f));var _0xf958=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x958f[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xf958('0x0'));var util=require('util');var logger=require(_0xf958('0x1'))('api');var moment=require(_0xf958('0x2'));var BPromise=require(_0xf958('0x3'));var rp=require(_0xf958('0x4'));var fs=require('fs');var path=require(_0xf958('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf958('0x6'));module[_0xf958('0x7')]=function(_0x1898d5,_0x399273){return _0x1898d5['define'](_0xf958('0x8'),attributes,{'tableName':_0xf958('0x9'),'paranoid':![],'indexes':[{'name':_0xf958('0xa'),'fields':[_0xf958('0xb')],'type':_0xf958('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57a600,_0x12aea1,_0x6b44f9){var _0x4e47fb=_0x1898d5[_0xf958('0xd')];var _0x39dda9=_0x57a600['get']({'plain':!![]});if(_0x39dda9[_0xf958('0xe')][_0xf958('0xf')]()==='in'||_0x39dda9[_0xf958('0xe')][_0xf958('0xf')]()===_0xf958('0x10')&&!_0x39dda9[_0xf958('0x11')]&&!_['isNil'](_0x39dda9[_0xf958('0x12')])){_0x4e47fb['ChatInteraction'][_0xf958('0x13')]({'where':{'id':_0x39dda9[_0xf958('0x14')]}})['then'](function(_0x3433f4){if(_0x3433f4){_0x3433f4[_0xf958('0x15')]({'lastMsgAt':_0x39dda9[_0xf958('0x16')],'lastMsgDirection':_0x39dda9[_0xf958('0xe')]['toLowerCase']()});}})[_0xf958('0x17')](function(_0x2e62f9){console[_0xf958('0x18')](_0x2e62f9);});}_0x6b44f9();}},'charset':_0xf958('0x19'),'collate':_0xf958('0x1a')});}; \ No newline at end of file +var _0x6688=['../../config/logger','moment','request-promise','../../config/environment','exports','define','ChatMessage','fti_chat_messages','body','FULLTEXT','models','get','direction','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','toLowerCase','catch','error','utf8mb4','lodash','util'];(function(_0xcfe8cc,_0xb83aeb){var _0x55ac53=function(_0x4067d4){while(--_0x4067d4){_0xcfe8cc['push'](_0xcfe8cc['shift']());}};_0x55ac53(++_0xb83aeb);}(_0x6688,0x15d));var _0x8668=function(_0x42b691,_0x528f98){_0x42b691=_0x42b691-0x0;var _0x3e4b20=_0x6688[_0x42b691];return _0x3e4b20;};'use strict';var _=require(_0x8668('0x0'));var util=require(_0x8668('0x1'));var logger=require(_0x8668('0x2'))('api');var moment=require(_0x8668('0x3'));var BPromise=require('bluebird');var rp=require(_0x8668('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8668('0x5'));var attributes=require('./chatMessage.attributes');module[_0x8668('0x6')]=function(_0x564391,_0x1dc92c){return _0x564391[_0x8668('0x7')](_0x8668('0x8'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x8668('0x9'),'fields':[_0x8668('0xa')],'type':_0x8668('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4241d4,_0x48ea44,_0x697997){var _0x1b3b9e=_0x564391[_0x8668('0xc')];var _0x402998=_0x4241d4[_0x8668('0xd')]({'plain':!![]});if(_0x402998['direction']['toLowerCase']()==='in'||_0x402998[_0x8668('0xe')]['toLowerCase']()==='out'&&!_0x402998[_0x8668('0xf')]&&!_[_0x8668('0x10')](_0x402998[_0x8668('0x11')])){_0x1b3b9e[_0x8668('0x12')]['findOne']({'where':{'id':_0x402998[_0x8668('0x13')]}})[_0x8668('0x14')](function(_0x139cde){if(_0x139cde){_0x139cde[_0x8668('0x15')]({'lastMsgAt':_0x402998[_0x8668('0x16')],'lastMsgDirection':_0x402998[_0x8668('0xe')][_0x8668('0x17')]()});}})[_0x8668('0x18')](function(_0x3b1ffe){console[_0x8668('0x19')](_0x3b1ffe);});}_0x697997();}},'charset':_0x8668('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 8a713cf..4e143a3 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 _0xa768=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ChatMessage','create','body','options','then','info','CreateChatMessage','stringify','util'];(function(_0xe959f3,_0x27c959){var _0xd2ee62=function(_0x2884ac){while(--_0x2884ac){_0xe959f3['push'](_0xe959f3['shift']());}};_0xd2ee62(++_0x27c959);}(_0xa768,0x1bb));var _0x8a76=function(_0x15efa6,_0xbd64f2){_0x15efa6=_0x15efa6-0x0;var _0x2b3752=_0xa768[_0x15efa6];return _0x2b3752;};'use strict';var _=require('lodash');var util=require(_0x8a76('0x0'));var moment=require(_0x8a76('0x1'));var BPromise=require(_0x8a76('0x2'));var rs=require(_0x8a76('0x3'));var fs=require('fs');var Redis=require(_0x8a76('0x4'));var db=require(_0x8a76('0x5'))['db'];var utils=require(_0x8a76('0x6'));var logger=require(_0x8a76('0x7'))(_0x8a76('0x8'));var config=require(_0x8a76('0x9'));var jayson=require(_0x8a76('0xa'));var client=jayson[_0x8a76('0xb')][_0x8a76('0xc')]({'port':0x232a});config[_0x8a76('0xd')]=_[_0x8a76('0xe')](config[_0x8a76('0xd')],{'host':_0x8a76('0xf'),'port':0x18eb});var socket=require(_0x8a76('0x10'))(new Redis(config[_0x8a76('0xd')]));require(_0x8a76('0x11'))[_0x8a76('0x12')](socket);function respondWithRpcPromise(_0x55178c,_0x427673,_0xe4b9f5){return new BPromise(function(_0x2ecabc,_0x59dace){return client[_0x8a76('0x13')](_0x55178c,_0xe4b9f5)['then'](function(_0x24ff78){logger['info'](_0x8a76('0x14'),_0x427673,_0x8a76('0x15'));logger[_0x8a76('0x16')](_0x8a76('0x17'),_0x427673,_0x8a76('0x15'),JSON['stringify'](_0x24ff78));if(_0x24ff78[_0x8a76('0x18')]){if(_0x24ff78[_0x8a76('0x18')][_0x8a76('0x19')]===0x1f4){logger[_0x8a76('0x18')](_0x8a76('0x14'),_0x427673,_0x24ff78[_0x8a76('0x18')]['message']);return _0x59dace(_0x24ff78[_0x8a76('0x18')][_0x8a76('0x1a')]);}logger['error'](_0x8a76('0x14'),_0x427673,_0x24ff78['error'][_0x8a76('0x1a')]);return _0x2ecabc(_0x24ff78[_0x8a76('0x18')][_0x8a76('0x1a')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x427673,_0x8a76('0x15'));_0x2ecabc(_0x24ff78[_0x8a76('0x1b')][_0x8a76('0x1a')]);}})[_0x8a76('0x1c')](function(_0x768043){logger['error']('ChatMessage,\x20%s,\x20%s',_0x427673,_0x768043);_0x59dace(_0x768043);});});}exports['CreateChatMessage']=function(_0xff238d){var _0x12802e=this;return new Promise(function(_0x43a0ef,_0x1725a4){return db[_0x8a76('0x1d')][_0x8a76('0x1e')](_0xff238d[_0x8a76('0x1f')],{'raw':_0xff238d[_0x8a76('0x20')]?_0xff238d[_0x8a76('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x8a76('0x21')](function(_0x20f6de){logger[_0x8a76('0x22')]('CreateChatMessage',_0xff238d);logger[_0x8a76('0x16')](_0x8a76('0x23'),_0xff238d,JSON[_0x8a76('0x24')](_0x20f6de));_0x43a0ef(_0x20f6de);})[_0x8a76('0x1c')](function(_0x5bc43a){logger['error'](_0x8a76('0x23'),_0x5bc43a[_0x8a76('0x1a')],_0xff238d);_0x1725a4(_0x12802e[_0x8a76('0x18')](0x1f4,_0x5bc43a['message']));});});}; \ No newline at end of file +var _0x6066=['ChatMessage,\x20%s,\x20%s,\x20%s','error','ChatMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateChatMessage','ChatMessage','body','options','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','debug'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x6066,0x1c6));var _0x6606=function(_0x2bd88d,_0x2d5dc3){_0x2bd88d=_0x2bd88d-0x0;var _0x5516d4=_0x6066[_0x2bd88d];return _0x5516d4;};'use strict';var _=require(_0x6606('0x0'));var util=require('util');var moment=require(_0x6606('0x1'));var BPromise=require(_0x6606('0x2'));var rs=require(_0x6606('0x3'));var fs=require('fs');var Redis=require(_0x6606('0x4'));var db=require(_0x6606('0x5'))['db'];var utils=require(_0x6606('0x6'));var logger=require(_0x6606('0x7'))(_0x6606('0x8'));var config=require(_0x6606('0x9'));var jayson=require(_0x6606('0xa'));var client=jayson['client'][_0x6606('0xb')]({'port':0x232a});config[_0x6606('0xc')]=_[_0x6606('0xd')](config[_0x6606('0xc')],{'host':_0x6606('0xe'),'port':0x18eb});var socket=require(_0x6606('0xf'))(new Redis(config[_0x6606('0xc')]));require(_0x6606('0x10'))[_0x6606('0x11')](socket);function respondWithRpcPromise(_0x4cda3b,_0x32e6cb,_0x172c04){return new BPromise(function(_0x1786fe,_0x10e024){return client[_0x6606('0x12')](_0x4cda3b,_0x172c04)[_0x6606('0x13')](function(_0x359ce8){logger[_0x6606('0x14')]('ChatMessage,\x20%s,\x20%s',_0x32e6cb,'request\x20sent');logger[_0x6606('0x15')](_0x6606('0x16'),_0x32e6cb,'request\x20sent',JSON['stringify'](_0x359ce8));if(_0x359ce8[_0x6606('0x17')]){if(_0x359ce8['error']['code']===0x1f4){logger[_0x6606('0x17')](_0x6606('0x18'),_0x32e6cb,_0x359ce8[_0x6606('0x17')][_0x6606('0x19')]);return _0x10e024(_0x359ce8['error'][_0x6606('0x19')]);}logger[_0x6606('0x17')](_0x6606('0x18'),_0x32e6cb,_0x359ce8[_0x6606('0x17')]['message']);return _0x1786fe(_0x359ce8[_0x6606('0x17')][_0x6606('0x19')]);}else{logger[_0x6606('0x14')]('ChatMessage,\x20%s,\x20%s',_0x32e6cb,_0x6606('0x1a'));_0x1786fe(_0x359ce8[_0x6606('0x1b')][_0x6606('0x19')]);}})[_0x6606('0x1c')](function(_0xdeba1a){logger[_0x6606('0x17')](_0x6606('0x18'),_0x32e6cb,_0xdeba1a);_0x10e024(_0xdeba1a);});});}exports[_0x6606('0x1d')]=function(_0x22bb78){var _0x201e26=this;return new Promise(function(_0x575267,_0x314c9b){return db[_0x6606('0x1e')]['create'](_0x22bb78[_0x6606('0x1f')],{'raw':_0x22bb78[_0x6606('0x20')]?_0x22bb78[_0x6606('0x20')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5c5046){logger[_0x6606('0x14')](_0x6606('0x1d'),_0x22bb78);logger[_0x6606('0x15')](_0x6606('0x1d'),_0x22bb78,JSON[_0x6606('0x21')](_0x5c5046));_0x575267(_0x5c5046);})[_0x6606('0x1c')](function(_0x5ce07c){logger['error'](_0x6606('0x1d'),_0x5ce07c[_0x6606('0x19')],_0x22bb78);_0x314c9b(_0x201e26[_0x6606('0x17')](0x1f4,_0x5ce07c[_0x6606('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index d2c1657..6f1db66 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 _0xe0c3=['removeListener','length','chatMessage:','./chatMessage.events','remove','update','emit'];(function(_0x489c95,_0x53159c){var _0x10e7a7=function(_0xcb4342){while(--_0xcb4342){_0x489c95['push'](_0x489c95['shift']());}};_0x10e7a7(++_0x53159c);}(_0xe0c3,0xea));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var ChatMessageEvents=require(_0x3e0c('0x0'));var events=['save',_0x3e0c('0x1'),_0x3e0c('0x2')];function createListener(_0x3bb243,_0x41c0bf){return function(_0x27e01a){_0x41c0bf[_0x3e0c('0x3')](_0x3bb243,_0x27e01a);};}function removeListener(_0x31851c,_0x26c964){return function(){ChatMessageEvents[_0x3e0c('0x4')](_0x31851c,_0x26c964);};}exports['register']=function(_0x530ebf){for(var _0x163adf=0x0,_0x1e339a=events[_0x3e0c('0x5')];_0x163adf<_0x1e339a;_0x163adf++){var _0x243b5b=events[_0x163adf];var _0x29673d=createListener(_0x3e0c('0x6')+_0x243b5b,_0x530ebf);ChatMessageEvents['on'](_0x243b5b,_0x29673d);}}; \ No newline at end of file +var _0xa63f=['./chatMessage.events','save','remove','update','emit','length'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xa63f,0x1b6));var _0xfa63=function(_0x574d9b,_0x2063da){_0x574d9b=_0x574d9b-0x0;var _0x31d2a5=_0xa63f[_0x574d9b];return _0x31d2a5;};'use strict';var ChatMessageEvents=require(_0xfa63('0x0'));var events=[_0xfa63('0x1'),_0xfa63('0x2'),_0xfa63('0x3')];function createListener(_0x3103ba,_0x2bbc5a){return function(_0x401dbf){_0x2bbc5a[_0xfa63('0x4')](_0x3103ba,_0x401dbf);};}function removeListener(_0x37e644,_0x138518){return function(){ChatMessageEvents['removeListener'](_0x37e644,_0x138518);};}exports['register']=function(_0x20d4f6){for(var _0x41efce=0x0,_0xb35bc5=events[_0xfa63('0x5')];_0x41efce<_0xb35bc5;_0x41efce++){var _0x486050=events[_0x41efce];var _0x505e1a=createListener('chatMessage:'+_0x486050,_0x20d4f6);ChatMessageEvents['on'](_0x486050,_0x505e1a);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 63e0d70..d84e9b7 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 _0x7445=['accept','/:id/reject','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','chat','put','update','/:id/accept'];(function(_0x7d2629,_0x4f5a68){var _0x4fe320=function(_0x3151ae){while(--_0x3151ae){_0x7d2629['push'](_0x7d2629['shift']());}};_0x4fe320(++_0x4f5a68);}(_0x7445,0x76));var _0x5744=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0x7445[_0x23b655];return _0x364b32;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5744('0x0'));var timeout=require(_0x5744('0x1'));var express=require(_0x5744('0x2'));var router=express[_0x5744('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5744('0x4'));var interaction=require(_0x5744('0x5'));var config=require(_0x5744('0x6'));var controller=require(_0x5744('0x7'));router[_0x5744('0x8')]('/',auth[_0x5744('0x9')](),controller[_0x5744('0xa')]);router[_0x5744('0x8')](_0x5744('0xb'),auth[_0x5744('0x9')](),controller['describe']);router['get'](_0x5744('0xc'),auth[_0x5744('0x9')](),controller[_0x5744('0xd')]);router[_0x5744('0xe')]('/',auth[_0x5744('0x9')](),interaction[_0x5744('0xf')](_0x5744('0x10'),'chatmessage:create'),controller['create']);router[_0x5744('0x11')](_0x5744('0xc'),controller[_0x5744('0x12')]);router[_0x5744('0x11')](_0x5744('0x13'),auth[_0x5744('0x9')](),controller[_0x5744('0x14')]);router[_0x5744('0x11')](_0x5744('0x15'),auth[_0x5744('0x9')](),controller['reject']);router['delete'](_0x5744('0xc'),auth[_0x5744('0x9')](),controller[_0x5744('0x16')]);module['exports']=router; \ No newline at end of file +var _0xa703=['/:id','show','post','chat','create','put','update','/:id/reject','reject','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./chatMessage.controller','isAuthenticated','get','/describe'];(function(_0x5f484c,_0x7172c2){var _0xd0f884=function(_0x182b02){while(--_0x182b02){_0x5f484c['push'](_0x5f484c['shift']());}};_0xd0f884(++_0x7172c2);}(_0xa703,0x9d));var _0x3a70=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xa703[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0x3a70('0x0'));var util=require(_0x3a70('0x1'));var path=require('path');var timeout=require(_0x3a70('0x2'));var express=require(_0x3a70('0x3'));var router=express[_0x3a70('0x4')]();var fs_extra=require(_0x3a70('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3a70('0x6'));var controller=require(_0x3a70('0x7'));router['get']('/',auth[_0x3a70('0x8')](),controller['index']);router[_0x3a70('0x9')](_0x3a70('0xa'),auth[_0x3a70('0x8')](),controller['describe']);router[_0x3a70('0x9')](_0x3a70('0xb'),auth['isAuthenticated'](),controller[_0x3a70('0xc')]);router[_0x3a70('0xd')]('/',auth[_0x3a70('0x8')](),interaction['tracked'](_0x3a70('0xe'),'chatmessage:create'),controller[_0x3a70('0xf')]);router[_0x3a70('0x10')](_0x3a70('0xb'),controller[_0x3a70('0x11')]);router[_0x3a70('0x10')]('/:id/accept',auth[_0x3a70('0x8')](),controller['accept']);router[_0x3a70('0x10')](_0x3a70('0x12'),auth['isAuthenticated'](),controller[_0x3a70('0x13')]);router['delete'](_0x3a70('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x3a70('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 4755806..b4c0baa 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0xc590cd,_0x384edb){var _0x5e553c=function(_0x1bfdb2){while(--_0x1bfdb2){_0xc590cd['push'](_0xc590cd['shift']());}};_0x5e553c(++_0x384edb);}(_0xdb28,0x106));var _0x8db2=function(_0x2cdbcc,_0x2cea2b){_0x2cdbcc=_0x2cdbcc-0x0;var _0x412c6b=_0xdb28[_0x2cdbcc];return _0x412c6b;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x46534b,_0x3f6396){var _0x3237e1=function(_0x5b7012){while(--_0x5b7012){_0x46534b['push'](_0x46534b['shift']());}};_0x3237e1(++_0x3f6396);}(_0x5f2f,0x73));var _0xf5f2=function(_0x240f11,_0x1e5f12){_0x240f11=_0x240f11-0x0;var _0x1495e1=_0x5f2f[_0x240f11];return _0x1495e1;};'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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 2f4aa3b..803b701 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(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x7a54,0x106));var _0x47a5=function(_0x2d18af,_0x2303e3){_0x2d18af=_0x2d18af-0x0;var _0x2f6355=_0x7a54[_0x2d18af];return _0x2f6355;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x1a4f19,_0x21f778){var _0x34ee21=function(_0x5b9b7e){while(--_0x5b9b7e){_0x1a4f19['push'](_0x1a4f19['shift']());}};_0x34ee21(++_0x21f778);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 904fad7..cf6bc04 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 _0x06f8=['update','remove','emit','hasOwnProperty','hook','exports','events','ChatOfflineMessage','setMaxListeners','save'];(function(_0x48aeec,_0xb2caca){var _0x581d1b=function(_0x31c8b2){while(--_0x31c8b2){_0x48aeec['push'](_0x48aeec['shift']());}};_0x581d1b(++_0xb2caca);}(_0x06f8,0x178));var _0x806f=function(_0x2035ef,_0x3f7d39){_0x2035ef=_0x2035ef-0x0;var _0x86c909=_0x06f8[_0x2035ef];return _0x86c909;};'use strict';var EventEmitter=require(_0x806f('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x806f('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x806f('0x2')](0x0);var events={'afterCreate':_0x806f('0x3'),'afterUpdate':_0x806f('0x4'),'afterDestroy':_0x806f('0x5')};function emitEvent(_0x44ed56){return function(_0x16d618,_0x40e69f,_0x29f185){ChatOfflineMessageEvents[_0x806f('0x6')](_0x44ed56+':'+_0x16d618['id'],_0x16d618);ChatOfflineMessageEvents[_0x806f('0x6')](_0x44ed56,_0x16d618);_0x29f185(null);};}for(var e in events){if(events[_0x806f('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x806f('0x8')](e,emitEvent(event));}}module[_0x806f('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xcb41=['../../mysqldb','ChatOfflineMessage','setMaxListeners','update','emit','hasOwnProperty','hook','events'];(function(_0x4b241f,_0x1dbb4d){var _0x7fe129=function(_0x2e4dfe){while(--_0x2e4dfe){_0x4b241f['push'](_0x4b241f['shift']());}};_0x7fe129(++_0x1dbb4d);}(_0xcb41,0x1df));var _0x1cb4=function(_0x42f6f8,_0x2bb249){_0x42f6f8=_0x42f6f8-0x0;var _0x1ee088=_0xcb41[_0x42f6f8];return _0x1ee088;};'use strict';var EventEmitter=require(_0x1cb4('0x0'));var ChatOfflineMessage=require(_0x1cb4('0x1'))['db'][_0x1cb4('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x1cb4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1cb4('0x4'),'afterDestroy':'remove'};function emitEvent(_0xb12e88){return function(_0x31d7b5,_0x19b235,_0x6ef253){ChatOfflineMessageEvents[_0x1cb4('0x5')](_0xb12e88+':'+_0x31d7b5['id'],_0x31d7b5);ChatOfflineMessageEvents[_0x1cb4('0x5')](_0xb12e88,_0x31d7b5);_0x6ef253(null);};}for(var e in events){if(events[_0x1cb4('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x1cb4('0x7')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 674859a..c9b78ba 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 _0xdb3c=['utf8mb4_unicode_ci','exports','define','chat_offline_messages','utf8mb4'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0xdb3c,0x1d7));var _0xcdb3=function(_0x3dd3bc,_0x32950b){_0x3dd3bc=_0x3dd3bc-0x0;var _0x172373=_0xdb3c[_0x3dd3bc];return _0x172373;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xcdb3('0x0')]=function(_0x4a6bd8){return _0x4a6bd8[_0xcdb3('0x1')]('ChatOfflineMessage',attributes,{'tableName':_0xcdb3('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcdb3('0x3'),'collate':_0xcdb3('0x4')});}; \ No newline at end of file +var _0x2d38=['utf8mb4_unicode_ci','define','ChatOfflineMessage','utf8mb4'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x2d38,0x1b1));var _0x82d3=function(_0x169432,_0x130a1b){_0x169432=_0x169432-0x0;var _0x3bf91c=_0x2d38[_0x169432];return _0x3bf91c;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x82bc74){return _0x82bc74[_0x82d3('0x0')](_0x82d3('0x1'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x82d3('0x2'),'collate':_0x82d3('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 0ef07c6..ee58c89 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 _0xb905=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x34bf0e,_0x1485c9){var _0x54ee7b=function(_0x212d55){while(--_0x212d55){_0x34bf0e['push'](_0x34bf0e['shift']());}};_0x54ee7b(++_0x1485c9);}(_0xb905,0xa7));var _0x5b90=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xb905[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x5b90('0x0'));var util=require('util');var moment=require(_0x5b90('0x1'));var BPromise=require('bluebird');var rs=require(_0x5b90('0x2'));var fs=require('fs');var Redis=require(_0x5b90('0x3'));var db=require(_0x5b90('0x4'))['db'];var utils=require(_0x5b90('0x5'));var logger=require(_0x5b90('0x6'))(_0x5b90('0x7'));var config=require(_0x5b90('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5b90('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x296cd0,_0x362fbb,_0x55f7cc){return new BPromise(function(_0xfe8529,_0x428eb9){return client['request'](_0x296cd0,_0x55f7cc)['then'](function(_0x3cff73){logger[_0x5b90('0xa')](_0x5b90('0xb'),_0x362fbb,_0x5b90('0xc'));logger[_0x5b90('0xd')](_0x5b90('0xe'),_0x362fbb,_0x5b90('0xc'),JSON[_0x5b90('0xf')](_0x3cff73));if(_0x3cff73[_0x5b90('0x10')]){if(_0x3cff73[_0x5b90('0x10')][_0x5b90('0x11')]===0x1f4){logger[_0x5b90('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x362fbb,_0x3cff73[_0x5b90('0x10')][_0x5b90('0x12')]);return _0x428eb9(_0x3cff73[_0x5b90('0x10')][_0x5b90('0x12')]);}logger['error'](_0x5b90('0xb'),_0x362fbb,_0x3cff73[_0x5b90('0x10')][_0x5b90('0x12')]);return _0xfe8529(_0x3cff73[_0x5b90('0x10')][_0x5b90('0x12')]);}else{logger[_0x5b90('0xa')](_0x5b90('0xb'),_0x362fbb,_0x5b90('0xc'));_0xfe8529(_0x3cff73[_0x5b90('0x13')][_0x5b90('0x12')]);}})[_0x5b90('0x14')](function(_0x14e829){logger[_0x5b90('0x10')](_0x5b90('0xb'),_0x362fbb,_0x14e829);_0x428eb9(_0x14e829);});});} \ No newline at end of file +var _0x943c=['stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug'];(function(_0x4f0ddb,_0x37c169){var _0x31c5c4=function(_0x3b06f3){while(--_0x3b06f3){_0x4f0ddb['push'](_0x4f0ddb['shift']());}};_0x31c5c4(++_0x37c169);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc943('0x0'));var util=require(_0xc943('0x1'));var moment=require(_0xc943('0x2'));var BPromise=require(_0xc943('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc943('0x4'))['db'];var utils=require(_0xc943('0x5'));var logger=require(_0xc943('0x6'))('rpc');var config=require(_0xc943('0x7'));var jayson=require(_0xc943('0x8'));var client=jayson[_0xc943('0x9')][_0xc943('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b73ad,_0x4091fd,_0x3f718f){return new BPromise(function(_0x56e665,_0x3ec7da){return client[_0xc943('0xb')](_0x1b73ad,_0x3f718f)[_0xc943('0xc')](function(_0x455eed){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x4091fd,_0xc943('0xd'));logger[_0xc943('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x4091fd,'request\x20sent',JSON[_0xc943('0xf')](_0x455eed));if(_0x455eed[_0xc943('0x10')]){if(_0x455eed[_0xc943('0x10')][_0xc943('0x11')]===0x1f4){logger[_0xc943('0x10')](_0xc943('0x12'),_0x4091fd,_0x455eed['error'][_0xc943('0x13')]);return _0x3ec7da(_0x455eed[_0xc943('0x10')]['message']);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x4091fd,_0x455eed[_0xc943('0x10')][_0xc943('0x13')]);return _0x56e665(_0x455eed['error'][_0xc943('0x13')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x4091fd,_0xc943('0xd'));_0x56e665(_0x455eed['result'][_0xc943('0x13')]);}})[_0xc943('0x14')](function(_0x1eb50a){logger[_0xc943('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4091fd,_0x1eb50a);_0x3ec7da(_0x1eb50a);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 6900f37..f094aa0 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 _0xaa0a=['../../components/auth/service','./chatOfflineMessage.controller','isAuthenticated','describe','get','post','create','put','/:id','update','delete','util','path','connect-timeout','express','fs-extra'];(function(_0x122290,_0x31c429){var _0x4be8a3=function(_0x4f0de5){while(--_0x4f0de5){_0x122290['push'](_0x122290['shift']());}};_0x4be8a3(++_0x31c429);}(_0xaa0a,0xeb));var _0xaaa0=function(_0x36f903,_0x98ddd8){_0x36f903=_0x36f903-0x0;var _0x5cbc0b=_0xaa0a[_0x36f903];return _0x5cbc0b;};'use strict';var multer=require('multer');var util=require(_0xaaa0('0x0'));var path=require(_0xaaa0('0x1'));var timeout=require(_0xaaa0('0x2'));var express=require(_0xaaa0('0x3'));var router=express['Router']();var fs_extra=require(_0xaaa0('0x4'));var auth=require(_0xaaa0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xaaa0('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xaaa0('0x7')](),controller[_0xaaa0('0x8')]);router[_0xaaa0('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xaaa0('0xa')]('/',auth[_0xaaa0('0x7')](),controller[_0xaaa0('0xb')]);router[_0xaaa0('0xc')](_0xaaa0('0xd'),auth['isAuthenticated'](),controller[_0xaaa0('0xe')]);router[_0xaaa0('0xf')](_0xaaa0('0xd'),auth[_0xaaa0('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7637=['post','create','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','./chatOfflineMessage.controller','isAuthenticated','index','get','describe','show'];(function(_0x151800,_0x7ab410){var _0x2ff45f=function(_0x124613){while(--_0x124613){_0x151800['push'](_0x151800['shift']());}};_0x2ff45f(++_0x7ab410);}(_0x7637,0x1c0));var _0x7763=function(_0x15efa6,_0xbd64f2){_0x15efa6=_0x15efa6-0x0;var _0x2b3752=_0x7637[_0x15efa6];return _0x2b3752;};'use strict';var multer=require(_0x7763('0x0'));var util=require(_0x7763('0x1'));var path=require('path');var timeout=require(_0x7763('0x2'));var express=require(_0x7763('0x3'));var router=express['Router']();var fs_extra=require(_0x7763('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7763('0x5'));var config=require('../../config/environment');var controller=require(_0x7763('0x6'));router['get']('/',auth[_0x7763('0x7')](),controller[_0x7763('0x8')]);router[_0x7763('0x9')]('/describe',auth[_0x7763('0x7')](),controller[_0x7763('0xa')]);router[_0x7763('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x7763('0xb')]);router[_0x7763('0xc')]('/',auth[_0x7763('0x7')](),controller[_0x7763('0xd')]);router[_0x7763('0xe')]('/:id',auth[_0x7763('0x7')](),controller[_0x7763('0xf')]);router[_0x7763('0x10')](_0x7763('0x11'),auth[_0x7763('0x7')](),controller[_0x7763('0x12')]);module[_0x7763('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 71ad370..f749cdd 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 _0x7cee=['exports','STRING','ENUM','mouseOver','timeout','sequelize'];(function(_0x4a04de,_0x2e342c){var _0xbbe018=function(_0x39639c){while(--_0x39639c){_0x4a04de['push'](_0x4a04de['shift']());}};_0xbbe018(++_0x2e342c);}(_0x7cee,0x179));var _0xe7ce=function(_0x39d39d,_0x5586bd){_0x39d39d=_0x39d39d-0x0;var _0x577ac3=_0x7cee[_0x39d39d];return _0x577ac3;};'use strict';var Sequelize=require(_0xe7ce('0x0'));module[_0xe7ce('0x1')]={'name':{'type':Sequelize[_0xe7ce('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe7ce('0x3')](_0xe7ce('0x4'),_0xe7ce('0x5')),'defaultValue':_0xe7ce('0x4')},'selector':{'type':Sequelize[_0xe7ce('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x0269=['mouseOver','timeout','sequelize','ENUM'];(function(_0xe6830f,_0x420fff){var _0x57ad21=function(_0x38211c){while(--_0x38211c){_0xe6830f['push'](_0xe6830f['shift']());}};_0x57ad21(++_0x420fff);}(_0x0269,0x196));var _0x9026=function(_0x1f79e1,_0x240c24){_0x1f79e1=_0x1f79e1-0x0;var _0x5c60dd=_0x0269[_0x1f79e1];return _0x5c60dd;};'use strict';var Sequelize=require(_0x9026('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x9026('0x1')](_0x9026('0x2'),_0x9026('0x3')),'defaultValue':'mouseOver'},'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 161a670..8333c71 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 _0xbc17=['includeAll','merge','find','catch','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','save','update','then','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','length'];(function(_0x7714df,_0xf9787d){var _0x1e21a5=function(_0x49bf5c){while(--_0x49bf5c){_0x7714df['push'](_0x7714df['shift']());}};_0x1e21a5(++_0xf9787d);}(_0xbc17,0x1ab));var _0x7bc1=function(_0x5b21eb,_0x540b6d){_0x5b21eb=_0x5b21eb-0x0;var _0x279c63=_0xbc17[_0x5b21eb];return _0x279c63;};'use strict';var emlformat=require(_0x7bc1('0x0'));var rimraf=require(_0x7bc1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7bc1('0x2'));var rp=require(_0x7bc1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7bc1('0x4'));var util=require(_0x7bc1('0x5'));var path=require('path');var sox=require(_0x7bc1('0x6'));var csv=require('to-csv');var ejs=require(_0x7bc1('0x7'));var fs=require('fs');var fs_extra=require(_0x7bc1('0x8'));var _=require(_0x7bc1('0x9'));var squel=require(_0x7bc1('0xa'));var crypto=require(_0x7bc1('0xb'));var jsforce=require(_0x7bc1('0xc'));var deskjs=require(_0x7bc1('0xd'));var toCsv=require(_0x7bc1('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7bc1('0xf'));var authService=require(_0x7bc1('0x10'));var qs=require(_0x7bc1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bc1('0x12'));var logger=require(_0x7bc1('0x13'))(_0x7bc1('0x14'));var utils=require(_0x7bc1('0x15'));var config=require(_0x7bc1('0x16'));var licenseUtil=require(_0x7bc1('0x17'));var db=require(_0x7bc1('0x18'))['db'];function respondWithStatusCode(_0xb00dbd,_0x604f31){_0x604f31=_0x604f31||0xcc;return function(_0x54db30){if(_0x54db30){return _0xb00dbd[_0x7bc1('0x19')](_0x604f31);}return _0xb00dbd[_0x7bc1('0x1a')](_0x604f31)['end']();};}function respondWithResult(_0x34d427,_0x370c8b){_0x370c8b=_0x370c8b||0xc8;return function(_0x4bb73b){if(_0x4bb73b){return _0x34d427[_0x7bc1('0x1a')](_0x370c8b)[_0x7bc1('0x1b')](_0x4bb73b);}};}function respondWithFilteredResult(_0x48d35a,_0x10f5a9){return function(_0x26c89e){if(_0x26c89e){var _0x1eaf32=typeof _0x10f5a9[_0x7bc1('0x1c')]===_0x7bc1('0x1d')&&typeof _0x10f5a9['limit']===_0x7bc1('0x1d');var _0x47ab39=_0x26c89e[_0x7bc1('0x1e')];var _0x901465=_0x1eaf32?0x0:_0x10f5a9[_0x7bc1('0x1c')];var _0x22e6fd=_0x1eaf32?_0x26c89e[_0x7bc1('0x1e')]:_0x10f5a9[_0x7bc1('0x1c')]+_0x10f5a9[_0x7bc1('0x1f')];var _0x135025;if(_0x22e6fd>=_0x47ab39){_0x22e6fd=_0x47ab39;_0x135025=0xc8;}else{_0x135025=0xce;}_0x48d35a['status'](_0x135025);return _0x48d35a[_0x7bc1('0x20')](_0x7bc1('0x21'),_0x901465+'-'+_0x22e6fd+'/'+_0x47ab39)[_0x7bc1('0x1b')](_0x26c89e);}return null;};}function patchUpdates(_0x1ed10b){return function(_0x1d6674){try{jsonpatch['apply'](_0x1d6674,_0x1ed10b,!![]);}catch(_0x29276f){return BPromise['reject'](_0x29276f);}return _0x1d6674[_0x7bc1('0x22')]();};}function saveUpdates(_0x2e66c6,_0x3136aa){return function(_0x162efe){if(_0x162efe){return _0x162efe[_0x7bc1('0x23')](_0x2e66c6)['then'](function(_0x4b4a05){return _0x4b4a05;});}return null;};}function removeEntity(_0xb8a427,_0x306db7){return function(_0x48b09e){if(_0x48b09e){return _0x48b09e['destroy']()[_0x7bc1('0x24')](function(){_0xb8a427[_0x7bc1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e9b8a,_0x12ec4b){return function(_0x1e68c3){if(!_0x1e68c3){_0x1e9b8a[_0x7bc1('0x19')](0x194);}return _0x1e68c3;};}function handleError(_0x18e6ff,_0x2c8a0d){_0x2c8a0d=_0x2c8a0d||0x1f4;return function(_0x25d3a9){logger[_0x7bc1('0x25')](_0x25d3a9[_0x7bc1('0x26')]);if(_0x25d3a9[_0x7bc1('0x27')]){delete _0x25d3a9[_0x7bc1('0x27')];}_0x18e6ff[_0x7bc1('0x1a')](_0x2c8a0d)[_0x7bc1('0x28')](_0x25d3a9);};}exports[_0x7bc1('0x29')]=function(_0x58d79c,_0x1927ce){var _0xc2cd8b={'raw':!![],'where':{'id':_0x58d79c[_0x7bc1('0x2a')]['id']}},_0x26bf05={};_0x26bf05[_0x7bc1('0x2b')]=_[_0x7bc1('0x2c')](db[_0x7bc1('0x2d')][_0x7bc1('0x2e')]);_0x26bf05[_0x7bc1('0x2f')]=_[_0x7bc1('0x2c')](_0x58d79c[_0x7bc1('0x2f')]);_0x26bf05[_0x7bc1('0x30')]=_['intersection'](_0x26bf05[_0x7bc1('0x2b')],_0x26bf05[_0x7bc1('0x2f')]);_0xc2cd8b[_0x7bc1('0x31')]=_[_0x7bc1('0x32')](_0x26bf05[_0x7bc1('0x2b')],qs[_0x7bc1('0x33')](_0x58d79c[_0x7bc1('0x2f')]['fields']));_0xc2cd8b[_0x7bc1('0x31')]=_0xc2cd8b[_0x7bc1('0x31')][_0x7bc1('0x34')]?_0xc2cd8b[_0x7bc1('0x31')]:_0x26bf05['model'];if(_0x58d79c[_0x7bc1('0x2f')][_0x7bc1('0x35')]){_0xc2cd8b['include']=[{'all':!![]}];}_0xc2cd8b=_[_0x7bc1('0x36')]({},_0xc2cd8b,_0x58d79c['options']);return db['ChatProactiveAction'][_0x7bc1('0x37')](_0xc2cd8b)[_0x7bc1('0x24')](handleEntityNotFound(_0x1927ce,null))[_0x7bc1('0x24')](respondWithResult(_0x1927ce,null))[_0x7bc1('0x38')](handleError(_0x1927ce,null));};exports[_0x7bc1('0x39')]=function(_0x510bdb,_0x33c862){return db[_0x7bc1('0x2d')]['create'](_0x510bdb['body'],{})[_0x7bc1('0x24')](respondWithResult(_0x33c862,0xc9))['catch'](handleError(_0x33c862,null));};exports[_0x7bc1('0x23')]=function(_0x2e2cae,_0x3c1b53){if(_0x2e2cae[_0x7bc1('0x3a')]['id']){delete _0x2e2cae[_0x7bc1('0x3a')]['id'];}return db[_0x7bc1('0x2d')][_0x7bc1('0x37')]({'where':{'id':_0x2e2cae[_0x7bc1('0x2a')]['id']}})[_0x7bc1('0x24')](handleEntityNotFound(_0x3c1b53,null))[_0x7bc1('0x24')](saveUpdates(_0x2e2cae[_0x7bc1('0x3a')],null))[_0x7bc1('0x24')](respondWithResult(_0x3c1b53,null))[_0x7bc1('0x38')](handleError(_0x3c1b53,null));};exports[_0x7bc1('0x3b')]=function(_0x3e4344,_0x445f6c){return db[_0x7bc1('0x2d')][_0x7bc1('0x37')]({'where':{'id':_0x3e4344[_0x7bc1('0x2a')]['id']}})['then'](handleEntityNotFound(_0x445f6c,null))[_0x7bc1('0x24')](removeEntity(_0x445f6c,null))[_0x7bc1('0x38')](handleError(_0x445f6c,null));}; \ No newline at end of file +var _0xa9b1=['count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','show','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','fields','includeAll','merge','create','body','catch','find','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1a9b('0x0'));var jsonpatch=require(_0x1a9b('0x1'));var rp=require(_0x1a9b('0x2'));var moment=require(_0x1a9b('0x3'));var BPromise=require(_0x1a9b('0x4'));var Mustache=require(_0x1a9b('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1a9b('0x6'));var ejs=require(_0x1a9b('0x7'));var fs=require('fs');var fs_extra=require(_0x1a9b('0x8'));var _=require(_0x1a9b('0x9'));var squel=require(_0x1a9b('0xa'));var crypto=require(_0x1a9b('0xb'));var jsforce=require(_0x1a9b('0xc'));var deskjs=require(_0x1a9b('0xd'));var toCsv=require(_0x1a9b('0x6'));var querystring=require(_0x1a9b('0xe'));var Papa=require(_0x1a9b('0xf'));var Redis=require(_0x1a9b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1a9b('0x11'));var hardwareService=require(_0x1a9b('0x12'));var logger=require(_0x1a9b('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1a9b('0x14'));var db=require(_0x1a9b('0x15'))['db'];function respondWithStatusCode(_0x2c75cf,_0x11bf7e){_0x11bf7e=_0x11bf7e||0xcc;return function(_0x2c3170){if(_0x2c3170){return _0x2c75cf[_0x1a9b('0x16')](_0x11bf7e);}return _0x2c75cf['status'](_0x11bf7e)[_0x1a9b('0x17')]();};}function respondWithResult(_0x34f082,_0x245883){_0x245883=_0x245883||0xc8;return function(_0x53c725){if(_0x53c725){return _0x34f082[_0x1a9b('0x18')](_0x245883)[_0x1a9b('0x19')](_0x53c725);}};}function respondWithFilteredResult(_0x55a00d,_0x2a7d72){return function(_0x57ca87){if(_0x57ca87){var _0x439acd=typeof _0x2a7d72[_0x1a9b('0x1a')]===_0x1a9b('0x1b')&&typeof _0x2a7d72[_0x1a9b('0x1c')]===_0x1a9b('0x1b');var _0x20b8dc=_0x57ca87[_0x1a9b('0x1d')];var _0x205a0d=_0x439acd?0x0:_0x2a7d72[_0x1a9b('0x1a')];var _0x1281c2=_0x439acd?_0x57ca87['count']:_0x2a7d72[_0x1a9b('0x1a')]+_0x2a7d72[_0x1a9b('0x1c')];var _0x3df7d2;if(_0x1281c2>=_0x20b8dc){_0x1281c2=_0x20b8dc;_0x3df7d2=0xc8;}else{_0x3df7d2=0xce;}_0x55a00d[_0x1a9b('0x18')](_0x3df7d2);return _0x55a00d['set'](_0x1a9b('0x1e'),_0x205a0d+'-'+_0x1281c2+'/'+_0x20b8dc)[_0x1a9b('0x19')](_0x57ca87);}return null;};}function patchUpdates(_0x4b3cd3){return function(_0x23e327){try{jsonpatch[_0x1a9b('0x1f')](_0x23e327,_0x4b3cd3,!![]);}catch(_0x44cebf){return BPromise[_0x1a9b('0x20')](_0x44cebf);}return _0x23e327[_0x1a9b('0x21')]();};}function saveUpdates(_0x590568,_0x189e78){return function(_0x17b1dd){if(_0x17b1dd){return _0x17b1dd[_0x1a9b('0x22')](_0x590568)[_0x1a9b('0x23')](function(_0x36391a){return _0x36391a;});}return null;};}function removeEntity(_0x2e42f1,_0x28f937){return function(_0x488a33){if(_0x488a33){return _0x488a33[_0x1a9b('0x24')]()['then'](function(){_0x2e42f1[_0x1a9b('0x18')](0xcc)[_0x1a9b('0x17')]();});}};}function handleEntityNotFound(_0xad6541,_0x4e7234){return function(_0x213841){if(!_0x213841){_0xad6541[_0x1a9b('0x16')](0x194);}return _0x213841;};}function handleError(_0x1521f4,_0x181331){_0x181331=_0x181331||0x1f4;return function(_0x18c9dd){logger[_0x1a9b('0x25')](_0x18c9dd['stack']);if(_0x18c9dd[_0x1a9b('0x26')]){delete _0x18c9dd[_0x1a9b('0x26')];}_0x1521f4['status'](_0x181331)[_0x1a9b('0x27')](_0x18c9dd);};}exports[_0x1a9b('0x28')]=function(_0x5d70dc,_0x5d7e8c){var _0x3f8e98={'raw':!![],'where':{'id':_0x5d70dc['params']['id']}},_0x1d981e={};_0x1d981e[_0x1a9b('0x29')]=_[_0x1a9b('0x2a')](db[_0x1a9b('0x2b')][_0x1a9b('0x2c')]);_0x1d981e[_0x1a9b('0x2d')]=_[_0x1a9b('0x2a')](_0x5d70dc[_0x1a9b('0x2d')]);_0x1d981e['filters']=_[_0x1a9b('0x2e')](_0x1d981e[_0x1a9b('0x29')],_0x1d981e[_0x1a9b('0x2d')]);_0x3f8e98[_0x1a9b('0x2f')]=_[_0x1a9b('0x2e')](_0x1d981e[_0x1a9b('0x29')],qs[_0x1a9b('0x30')](_0x5d70dc[_0x1a9b('0x2d')][_0x1a9b('0x30')]));_0x3f8e98[_0x1a9b('0x2f')]=_0x3f8e98[_0x1a9b('0x2f')]['length']?_0x3f8e98['attributes']:_0x1d981e[_0x1a9b('0x29')];if(_0x5d70dc[_0x1a9b('0x2d')][_0x1a9b('0x31')]){_0x3f8e98['include']=[{'all':!![]}];}_0x3f8e98=_[_0x1a9b('0x32')]({},_0x3f8e98,_0x5d70dc['options']);return db[_0x1a9b('0x2b')]['find'](_0x3f8e98)[_0x1a9b('0x23')](handleEntityNotFound(_0x5d7e8c,null))[_0x1a9b('0x23')](respondWithResult(_0x5d7e8c,null))['catch'](handleError(_0x5d7e8c,null));};exports[_0x1a9b('0x33')]=function(_0x5f17e4,_0x917311){return db[_0x1a9b('0x2b')][_0x1a9b('0x33')](_0x5f17e4[_0x1a9b('0x34')],{})['then'](respondWithResult(_0x917311,0xc9))[_0x1a9b('0x35')](handleError(_0x917311,null));};exports[_0x1a9b('0x22')]=function(_0x26bcb6,_0x5ceda8){if(_0x26bcb6[_0x1a9b('0x34')]['id']){delete _0x26bcb6['body']['id'];}return db['ChatProactiveAction'][_0x1a9b('0x36')]({'where':{'id':_0x26bcb6[_0x1a9b('0x37')]['id']}})[_0x1a9b('0x23')](handleEntityNotFound(_0x5ceda8,null))[_0x1a9b('0x23')](saveUpdates(_0x26bcb6[_0x1a9b('0x34')],null))[_0x1a9b('0x23')](respondWithResult(_0x5ceda8,null))[_0x1a9b('0x35')](handleError(_0x5ceda8,null));};exports['destroy']=function(_0x46f624,_0x230fc6){return db[_0x1a9b('0x2b')]['find']({'where':{'id':_0x46f624[_0x1a9b('0x37')]['id']}})[_0x1a9b('0x23')](handleEntityNotFound(_0x230fc6,null))[_0x1a9b('0x23')](removeEntity(_0x230fc6,null))[_0x1a9b('0x35')](handleError(_0x230fc6,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 9342501..17335ef 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 _0x066b=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','util'];(function(_0x546946,_0x31f1b9){var _0x5db2eb=function(_0x44fd3e){while(--_0x44fd3e){_0x546946['push'](_0x546946['shift']());}};_0x5db2eb(++_0x31f1b9);}(_0x066b,0x137));var _0xb066=function(_0x25e35c,_0x2f09b8){_0x25e35c=_0x25e35c-0x0;var _0x27dcc4=_0x066b[_0x25e35c];return _0x27dcc4;};'use strict';var _=require('lodash');var util=require(_0xb066('0x0'));var logger=require(_0xb066('0x1'))(_0xb066('0x2'));var moment=require('moment');var BPromise=require(_0xb066('0x3'));var rp=require(_0xb066('0x4'));var fs=require('fs');var path=require(_0xb066('0x5'));var rimraf=require(_0xb066('0x6'));var config=require(_0xb066('0x7'));var attributes=require(_0xb066('0x8'));module[_0xb066('0x9')]=function(_0x47123a,_0x21147d){return _0x47123a[_0xb066('0xa')](_0xb066('0xb'),attributes,{'tableName':_0xb066('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3422=['rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4e85be,_0x1193a9){var _0x22eb71=function(_0x31cde9){while(--_0x31cde9){_0x4e85be['push'](_0x4e85be['shift']());}};_0x22eb71(++_0x1193a9);}(_0x3422,0x117));var _0x2342=function(_0x37ee12,_0x47fbdf){_0x37ee12=_0x37ee12-0x0;var _0x4ad135=_0x3422[_0x37ee12];return _0x4ad135;};'use strict';var _=require(_0x2342('0x0'));var util=require(_0x2342('0x1'));var logger=require(_0x2342('0x2'))(_0x2342('0x3'));var moment=require(_0x2342('0x4'));var BPromise=require(_0x2342('0x5'));var rp=require(_0x2342('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2342('0x7'));var config=require(_0x2342('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0x2342('0x9')]=function(_0x1bb84e,_0x4b03ad){return _0x1bb84e[_0x2342('0xa')](_0x2342('0xb'),attributes,{'tableName':_0x2342('0xc'),'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 f7339a4..50bcba2 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 _0x3470=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2406b4,_0x2f9771){var _0x7f3752=function(_0x583971){while(--_0x583971){_0x2406b4['push'](_0x2406b4['shift']());}};_0x7f3752(++_0x2f9771);}(_0x3470,0xda));var _0x0347=function(_0x51a84b,_0x50a646){_0x51a84b=_0x51a84b-0x0;var _0xda27f0=_0x3470[_0x51a84b];return _0xda27f0;};'use strict';var _=require(_0x0347('0x0'));var util=require(_0x0347('0x1'));var moment=require(_0x0347('0x2'));var BPromise=require(_0x0347('0x3'));var rs=require(_0x0347('0x4'));var fs=require('fs');var Redis=require(_0x0347('0x5'));var db=require(_0x0347('0x6'))['db'];var utils=require(_0x0347('0x7'));var logger=require(_0x0347('0x8'))('rpc');var config=require(_0x0347('0x9'));var jayson=require(_0x0347('0xa'));var client=jayson[_0x0347('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x519776,_0x597103,_0x64a33e){return new BPromise(function(_0x183586,_0xec3bac){return client[_0x0347('0xc')](_0x519776,_0x64a33e)[_0x0347('0xd')](function(_0x44e447){logger[_0x0347('0xe')](_0x0347('0xf'),_0x597103,_0x0347('0x10'));logger[_0x0347('0x11')](_0x0347('0x12'),_0x597103,_0x0347('0x10'),JSON[_0x0347('0x13')](_0x44e447));if(_0x44e447[_0x0347('0x14')]){if(_0x44e447[_0x0347('0x14')][_0x0347('0x15')]===0x1f4){logger['error'](_0x0347('0xf'),_0x597103,_0x44e447[_0x0347('0x14')]['message']);return _0xec3bac(_0x44e447[_0x0347('0x14')][_0x0347('0x16')]);}logger[_0x0347('0x14')](_0x0347('0xf'),_0x597103,_0x44e447[_0x0347('0x14')]['message']);return _0x183586(_0x44e447[_0x0347('0x14')][_0x0347('0x16')]);}else{logger[_0x0347('0xe')](_0x0347('0xf'),_0x597103,_0x0347('0x10'));_0x183586(_0x44e447[_0x0347('0x17')]['message']);}})['catch'](function(_0x12955b){logger['error'](_0x0347('0xf'),_0x597103,_0x12955b);_0xec3bac(_0x12955b);});});} \ No newline at end of file +var _0xd5b4=['info','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x3601c6,_0x2fa72a){var _0xc1458f=function(_0x719435){while(--_0x719435){_0x3601c6['push'](_0x3601c6['shift']());}};_0xc1458f(++_0x2fa72a);}(_0xd5b4,0x13f));var _0x4d5b=function(_0x4c82e1,_0xbd65db){_0x4c82e1=_0x4c82e1-0x0;var _0x233e9a=_0xd5b4[_0x4c82e1];return _0x233e9a;};'use strict';var _=require('lodash');var util=require(_0x4d5b('0x0'));var moment=require(_0x4d5b('0x1'));var BPromise=require(_0x4d5b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d5b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4d5b('0x4'))(_0x4d5b('0x5'));var config=require(_0x4d5b('0x6'));var jayson=require(_0x4d5b('0x7'));var client=jayson[_0x4d5b('0x8')][_0x4d5b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xfa1f6b,_0x44bba5,_0x422073){return new BPromise(function(_0x46e642,_0x3449cc){return client['request'](_0xfa1f6b,_0x422073)[_0x4d5b('0xa')](function(_0x784db4){logger[_0x4d5b('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x44bba5,'request\x20sent');logger[_0x4d5b('0xc')](_0x4d5b('0xd'),_0x44bba5,_0x4d5b('0xe'),JSON[_0x4d5b('0xf')](_0x784db4));if(_0x784db4['error']){if(_0x784db4[_0x4d5b('0x10')][_0x4d5b('0x11')]===0x1f4){logger[_0x4d5b('0x10')](_0x4d5b('0x12'),_0x44bba5,_0x784db4[_0x4d5b('0x10')][_0x4d5b('0x13')]);return _0x3449cc(_0x784db4[_0x4d5b('0x10')]['message']);}logger[_0x4d5b('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x44bba5,_0x784db4[_0x4d5b('0x10')][_0x4d5b('0x13')]);return _0x46e642(_0x784db4['error'][_0x4d5b('0x13')]);}else{logger[_0x4d5b('0xb')](_0x4d5b('0x12'),_0x44bba5,'request\x20sent');_0x46e642(_0x784db4[_0x4d5b('0x14')][_0x4d5b('0x13')]);}})[_0x4d5b('0x15')](function(_0x3dd9cb){logger[_0x4d5b('0x10')](_0x4d5b('0x12'),_0x44bba5,_0x3dd9cb);_0x3449cc(_0x3dd9cb);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index ed4459b..73a358c 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 _0xd8fb=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','isAuthenticated','post','create','put','update','delete','/:id','destroy','exports'];(function(_0x3f316f,_0x59ac33){var _0x24b6b8=function(_0x100547){while(--_0x100547){_0x3f316f['push'](_0x3f316f['shift']());}};_0x24b6b8(++_0x59ac33);}(_0xd8fb,0x99));var _0xbd8f=function(_0x10b83f,_0x4d32d6){_0x10b83f=_0x10b83f-0x0;var _0x4b1ee3=_0xd8fb[_0x10b83f];return _0x4b1ee3;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd8f('0x4'));var interaction=require(_0xbd8f('0x5'));var config=require('../../config/environment');var controller=require(_0xbd8f('0x6'));router[_0xbd8f('0x7')]('/:id',auth[_0xbd8f('0x8')](),controller['show']);router[_0xbd8f('0x9')]('/',auth['isAuthenticated'](),controller[_0xbd8f('0xa')]);router[_0xbd8f('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xbd8f('0xc')]);router[_0xbd8f('0xd')](_0xbd8f('0xe'),auth['isAuthenticated'](),controller[_0xbd8f('0xf')]);module[_0xbd8f('0x10')]=router; \ No newline at end of file +var _0x6aa7=['/:id','show','post','isAuthenticated','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4239a6,_0x157e19){var _0x59728f=function(_0xc34db8){while(--_0xc34db8){_0x4239a6['push'](_0x4239a6['shift']());}};_0x59728f(++_0x157e19);}(_0x6aa7,0x178));var _0x76aa=function(_0x594508,_0x4e384d){_0x594508=_0x594508-0x0;var _0x37d50d=_0x6aa7[_0x594508];return _0x37d50d;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0x76aa('0x8'),auth['isAuthenticated'](),controller[_0x76aa('0x9')]);router[_0x76aa('0xa')]('/',auth[_0x76aa('0xb')](),controller['create']);router[_0x76aa('0xc')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller['update']);router[_0x76aa('0xd')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller[_0x76aa('0xe')]);module[_0x76aa('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index a1adc38..92ce3c8 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 _0xc214=['INTEGER','rrmemory','beepall','roundrobin','sequelize','STRING','name'];(function(_0x484ad6,_0x4efaee){var _0x4950d0=function(_0x11afec){while(--_0x11afec){_0x484ad6['push'](_0x484ad6['shift']());}};_0x4950d0(++_0x4efaee);}(_0xc214,0x74));var _0x4c21=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xc214[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require(_0x4c21('0x0'));module['exports']={'name':{'type':Sequelize[_0x4c21('0x1')],'unique':_0x4c21('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x4c21('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4c21('0x4'),_0x4c21('0x5'),_0x4c21('0x6'))}}; \ No newline at end of file +var _0xdd6b=['STRING','name','rrmemory','sequelize','exports'];(function(_0x1cdcab,_0x17a516){var _0x4393d0=function(_0x53b841){while(--_0x53b841){_0x1cdcab['push'](_0x1cdcab['shift']());}};_0x4393d0(++_0x17a516);}(_0xdd6b,0x198));var _0xbdd6=function(_0x5c16ae,_0x2c0bbf){_0x5c16ae=_0x5c16ae-0x0;var _0x207a29=_0xdd6b[_0x5c16ae];return _0x207a29;};'use strict';var Sequelize=require(_0xbdd6('0x0'));module[_0xbdd6('0x1')]={'name':{'type':Sequelize[_0xbdd6('0x2')],'unique':_0xbdd6('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xbdd6('0x4'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 192d999..1429f15 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 _0xa697=['spread','isArray','userChatQueue:remove','getAgents','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','socket.io-emitter','register','status','end','json','offset','limit','undefined','count','set','Content-Range','then','destroy','UserProfileResource','sendStatus','name','send','index','ChatQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','rows','catch','params','keys','filters','intersection','model','attributes','fields','length','merge','options','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','find','userProfileId','autoAssociation','error','body','describe','getMembers','findOne','UserChatQueue','nolimit','order','sort','pick','filter','map','findAll','User','findAndCountAll','chatPause','format','SIP','createdAt','updatedAt','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','addAgents','omit'];(function(_0x2dd635,_0x4fa9ab){var _0x570d9a=function(_0x304cf7){while(--_0x304cf7){_0x2dd635['push'](_0x2dd635['shift']());}};_0x570d9a(++_0x4fa9ab);}(_0xa697,0x169));var _0x7a69=function(_0x37e168,_0x3ba12e){_0x37e168=_0x37e168-0x0;var _0x549896=_0xa697[_0x37e168];return _0x549896;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require(_0x7a69('0x0'));var qs=require(_0x7a69('0x1'));var logger=require(_0x7a69('0x2'))(_0x7a69('0x3'));var config=require(_0x7a69('0x4'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x7a69('0x5')](config[_0x7a69('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x7a69('0x7'))(new Redis(config[_0x7a69('0x6')]));require('./chatQueue.socket')[_0x7a69('0x8')](socket);function respondWithStatusCode(_0x45bedc,_0x1bc569){_0x1bc569=_0x1bc569||0xcc;return function(_0x5c1bd3){if(_0x5c1bd3){return _0x45bedc['sendStatus'](_0x1bc569);}return _0x45bedc[_0x7a69('0x9')](_0x1bc569)[_0x7a69('0xa')]();};}function respondWithResult(_0x48f1b2,_0x3ab5d5){_0x3ab5d5=_0x3ab5d5||0xc8;return function(_0x464b2e){if(_0x464b2e){return _0x48f1b2[_0x7a69('0x9')](_0x3ab5d5)[_0x7a69('0xb')](_0x464b2e);}};}function respondWithFilteredResult(_0x456c35,_0x3c4215){return function(_0x55e115){if(_0x55e115){var _0x3afa29=typeof _0x3c4215[_0x7a69('0xc')]==='undefined'&&typeof _0x3c4215[_0x7a69('0xd')]===_0x7a69('0xe');var _0x58e29b=_0x55e115[_0x7a69('0xf')];var _0x2695a0=_0x3afa29?0x0:_0x3c4215[_0x7a69('0xc')];var _0x52fbaa=_0x3afa29?_0x55e115['count']:_0x3c4215['offset']+_0x3c4215[_0x7a69('0xd')];var _0x4016a2;if(_0x52fbaa>=_0x58e29b){_0x52fbaa=_0x58e29b;_0x4016a2=0xc8;}else{_0x4016a2=0xce;}_0x456c35['status'](_0x4016a2);return _0x456c35[_0x7a69('0x10')](_0x7a69('0x11'),_0x2695a0+'-'+_0x52fbaa+'/'+_0x58e29b)[_0x7a69('0xb')](_0x55e115);}return null;};}function saveUpdates(_0x2a8f18){return function(_0x22dc2a){if(_0x22dc2a){return _0x22dc2a['update'](_0x2a8f18)[_0x7a69('0x12')](function(_0x48e8d9){return _0x48e8d9;});}return null;};}function removeEntity(_0x39d9f3){return function(_0x39374f){if(_0x39374f){return _0x39374f[_0x7a69('0x13')]()['then'](function(){var _0x25e77f=_0x39374f['get']({'plain':!![]});var _0x3c8552='ChatQueues';return db[_0x7a69('0x14')][_0x7a69('0x13')]({'where':{'type':_0x3c8552,'resourceId':_0x25e77f['id']}})[_0x7a69('0x12')](function(){return _0x39374f;});})[_0x7a69('0x12')](function(){_0x39d9f3[_0x7a69('0x9')](0xcc)[_0x7a69('0xa')]();});}};}function handleEntityNotFound(_0xcb4fd3){return function(_0x2f88c8){if(!_0x2f88c8){_0xcb4fd3[_0x7a69('0x15')](0x194);}return _0x2f88c8;};}function handleError(_0x5773db,_0x21b857){_0x21b857=_0x21b857||0x1f4;return function(_0x3a4e9f){logger['error'](_0x3a4e9f['stack']);if(_0x3a4e9f[_0x7a69('0x16')]){delete _0x3a4e9f[_0x7a69('0x16')];}_0x5773db['status'](_0x21b857)[_0x7a69('0x17')](_0x3a4e9f);};}exports[_0x7a69('0x18')]=function(_0x88aff,_0x455b20){var _0x39023e={};var _0x555793={'count':0x0,'rows':[]};var _0x3d1e87=_['map'](db[_0x7a69('0x19')][_0x7a69('0x1a')],function(_0x599157){return{'name':_0x599157[_0x7a69('0x1b')],'type':_0x599157[_0x7a69('0x1c')][_0x7a69('0x1d')]};});_0x39023e=qs[_0x7a69('0x1e')](_0x3d1e87,_0x88aff);var _0x438b6f={'where':_0x39023e[_0x7a69('0x1f')]};return db['ChatQueue']['count'](_0x438b6f)['then'](function(_0x22b512){_0x555793['count']=_0x22b512;_0x39023e['include']=qs[_0x7a69('0x20')](_0x88aff[_0x7a69('0x21')]);return db[_0x7a69('0x19')]['findAll'](_0x39023e);})[_0x7a69('0x12')](function(_0x4878f2){_0x555793[_0x7a69('0x22')]=_0x4878f2;return _0x555793;})[_0x7a69('0x12')](respondWithFilteredResult(_0x455b20,_0x39023e))[_0x7a69('0x23')](handleError(_0x455b20,null));};exports['show']=function(_0x27d56f,_0x107100){var _0x57e403={'raw':!![],'where':{'id':_0x27d56f[_0x7a69('0x24')]['id']}},_0x33c209={};_0x33c209['model']=_[_0x7a69('0x25')](db[_0x7a69('0x19')][_0x7a69('0x1a')]);_0x33c209[_0x7a69('0x21')]=_['keys'](_0x27d56f[_0x7a69('0x21')]);_0x33c209[_0x7a69('0x26')]=_[_0x7a69('0x27')](_0x33c209[_0x7a69('0x28')],_0x33c209['query']);_0x57e403[_0x7a69('0x29')]=_[_0x7a69('0x27')](_0x33c209[_0x7a69('0x28')],qs[_0x7a69('0x2a')](_0x27d56f[_0x7a69('0x21')][_0x7a69('0x2a')]));_0x57e403[_0x7a69('0x29')]=_0x57e403[_0x7a69('0x29')][_0x7a69('0x2b')]?_0x57e403['attributes']:_0x33c209[_0x7a69('0x28')];if(_0x27d56f[_0x7a69('0x21')]['includeAll']){_0x57e403[_0x7a69('0x20')]=[{'all':!![]}];}_0x57e403=_[_0x7a69('0x2c')]({},_0x57e403,_0x27d56f[_0x7a69('0x2d')]);return db[_0x7a69('0x19')]['find'](_0x57e403)[_0x7a69('0x12')](handleEntityNotFound(_0x107100,null))[_0x7a69('0x12')](respondWithResult(_0x107100,null))['catch'](handleError(_0x107100,null));};exports[_0x7a69('0x2e')]=function(_0x413bf3,_0x20b243){return db[_0x7a69('0x19')]['create'](_0x413bf3['body'],{})[_0x7a69('0x12')](function(_0x41a675){var _0x2a852a=_0x413bf3[_0x7a69('0x2f')][_0x7a69('0x30')]({'plain':!![]});if(!_0x2a852a)throw new Error(_0x7a69('0x31'));if(_0x2a852a[_0x7a69('0x32')]===_0x7a69('0x2f')){var _0x2189b2=_0x41a675['get']({'plain':!![]});var _0x2cd1f5=_0x7a69('0x33');return db[_0x7a69('0x34')][_0x7a69('0x35')]({'where':{'name':_0x2cd1f5,'userProfileId':_0x2a852a[_0x7a69('0x36')]},'raw':!![]})[_0x7a69('0x12')](function(_0x1c4ded){if(_0x1c4ded&&_0x1c4ded[_0x7a69('0x37')]===0x0){return db[_0x7a69('0x14')][_0x7a69('0x2e')]({'name':_0x2189b2['name'],'resourceId':_0x2189b2['id'],'type':_0x1c4ded[_0x7a69('0x16')],'sectionId':_0x1c4ded['id']},{})[_0x7a69('0x12')](function(){return _0x41a675;});}else{return _0x41a675;}})[_0x7a69('0x23')](function(_0x539279){logger[_0x7a69('0x38')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x539279);throw _0x539279;});}return _0x41a675;})[_0x7a69('0x12')](respondWithResult(_0x20b243,0xc9))[_0x7a69('0x23')](handleError(_0x20b243,null));};exports['update']=function(_0xb70aea,_0x5f243b){if(_0xb70aea[_0x7a69('0x39')]['id']){delete _0xb70aea[_0x7a69('0x39')]['id'];}return db['ChatQueue'][_0x7a69('0x35')]({'where':{'id':_0xb70aea[_0x7a69('0x24')]['id']}})[_0x7a69('0x12')](handleEntityNotFound(_0x5f243b,null))[_0x7a69('0x12')](saveUpdates(_0xb70aea[_0x7a69('0x39')],null))[_0x7a69('0x12')](respondWithResult(_0x5f243b,null))['catch'](handleError(_0x5f243b,null));};exports[_0x7a69('0x13')]=function(_0x5f23a3,_0x3aef1b){return db[_0x7a69('0x19')][_0x7a69('0x35')]({'where':{'id':_0x5f23a3[_0x7a69('0x24')]['id']}})[_0x7a69('0x12')](handleEntityNotFound(_0x3aef1b,null))[_0x7a69('0x12')](removeEntity(_0x3aef1b,null))[_0x7a69('0x23')](handleError(_0x3aef1b,null));};exports[_0x7a69('0x3a')]=function(_0x26d387,_0x46c6c8){return db[_0x7a69('0x19')][_0x7a69('0x3a')]()[_0x7a69('0x12')](respondWithResult(_0x46c6c8,null))[_0x7a69('0x23')](handleError(_0x46c6c8,null));};exports[_0x7a69('0x3b')]=function(_0x43e425,_0x79c538){var _0x247fd4={'raw':!![],'where':{}},_0xe9d845={},_0x3c8d29;return db[_0x7a69('0x19')][_0x7a69('0x3c')]({'where':{'id':_0x43e425['params']['id']}})['then'](handleEntityNotFound(_0x79c538,null))[_0x7a69('0x12')](function(_0x414c86){if(_0x414c86){_0x3c8d29=_0x414c86[_0x7a69('0x30')]({'plain':!![]});_0xe9d845[_0x7a69('0x28')]=_['keys'](db[_0x7a69('0x3d')][_0x7a69('0x1a')]);_0xe9d845[_0x7a69('0x21')]=_['keys'](_0x43e425[_0x7a69('0x21')]);_0xe9d845['filters']=_['intersection'](_0xe9d845[_0x7a69('0x28')],_0xe9d845[_0x7a69('0x21')]);_0x247fd4[_0x7a69('0x29')]=_[_0x7a69('0x27')](_0xe9d845[_0x7a69('0x28')],qs['fields'](_0x43e425[_0x7a69('0x21')][_0x7a69('0x2a')]));_0x247fd4[_0x7a69('0x29')]=_0x247fd4['attributes'][_0x7a69('0x2b')]?_0x247fd4['attributes']:_0xe9d845[_0x7a69('0x28')];if(!_0x43e425[_0x7a69('0x21')]['hasOwnProperty'](_0x7a69('0x3e'))){_0x247fd4['limit']=qs[_0x7a69('0xd')](_0x43e425[_0x7a69('0x21')]['limit']);_0x247fd4[_0x7a69('0xc')]=qs[_0x7a69('0xc')](_0x43e425[_0x7a69('0x21')]['offset']);}_0x247fd4[_0x7a69('0x3f')]=qs[_0x7a69('0x40')](_0x43e425['query'][_0x7a69('0x40')]);_0x247fd4[_0x7a69('0x1f')]=qs[_0x7a69('0x26')](_[_0x7a69('0x41')](_0x43e425[_0x7a69('0x21')],_0xe9d845[_0x7a69('0x26')]));_0x247fd4[_0x7a69('0x1f')]['ChatQueueId']=_0x414c86['id'];if(_0x43e425[_0x7a69('0x21')][_0x7a69('0x42')]){_0x247fd4[_0x7a69('0x1f')]=_[_0x7a69('0x2c')](_0x247fd4[_0x7a69('0x1f')],{'$or':_[_0x7a69('0x43')](_0x247fd4[_0x7a69('0x29')],function(_0x24183e){var _0x1fa9fb={};_0x1fa9fb[_0x24183e]={'$like':'%'+_0x43e425[_0x7a69('0x21')][_0x7a69('0x42')]+'%'};return _0x1fa9fb;})});}_0x247fd4=_[_0x7a69('0x2c')]({},_0x247fd4,_0x43e425['options']);return db['UserChatQueue'][_0x7a69('0x44')](_0x247fd4);}})[_0x7a69('0x12')](function(_0x305d1e){if(_0x305d1e){return db[_0x7a69('0x45')][_0x7a69('0x46')]({'where':{'id':_[_0x7a69('0x43')](_0x305d1e,'UserId'),'role':'agent'},'attributes':['id',_0x7a69('0x16'),_0x7a69('0x47'),'updatedAt','createdAt']});}})[_0x7a69('0x12')](function(_0x407629){if(_0x407629){return{'count':_0x407629['count'],'rows':_[_0x7a69('0x43')](_0x407629['rows'],function(_0x144802){return{'membername':_0x144802[_0x7a69('0x16')],'UserId':_0x144802['id'],'queue_name':_0x3c8d29[_0x7a69('0x16')],'ChatQueueId':_0x3c8d29['id'],'interface':util[_0x7a69('0x48')]('%s/%s',_0x7a69('0x49'),_0x144802['name']),'penalty':0x0,'paused':_0x144802[_0x7a69('0x47')],'createdAt':_0x144802[_0x7a69('0x4a')],'updatedAt':_0x144802[_0x7a69('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x79c538,_0x247fd4))[_0x7a69('0x23')](handleError(_0x79c538,null));};exports[_0x7a69('0x4c')]=function(_0x296bd3,_0x4c6c82){var _0x381400={};var _0x2bbff9={};var _0x157a3e;var _0x3361d2;return db[_0x7a69('0x19')][_0x7a69('0x3c')]({'where':{'id':_0x296bd3['params']['id']}})[_0x7a69('0x12')](handleEntityNotFound(_0x4c6c82,null))['then'](function(_0x404a55){if(_0x404a55){_0x157a3e=_0x404a55;_0x2bbff9[_0x7a69('0x28')]=_['keys'](db[_0x7a69('0x4d')][_0x7a69('0x1a')]);_0x2bbff9[_0x7a69('0x21')]=_['keys'](_0x296bd3[_0x7a69('0x21')]);_0x2bbff9['filters']=_[_0x7a69('0x27')](_0x2bbff9['model'],_0x2bbff9['query']);_0x381400['attributes']=_[_0x7a69('0x27')](_0x2bbff9[_0x7a69('0x28')],qs[_0x7a69('0x2a')](_0x296bd3['query']['fields']));_0x381400[_0x7a69('0x29')]=_0x381400[_0x7a69('0x29')][_0x7a69('0x2b')]?_0x381400[_0x7a69('0x29')]:_0x2bbff9[_0x7a69('0x28')];_0x381400[_0x7a69('0x3f')]=qs[_0x7a69('0x40')](_0x296bd3[_0x7a69('0x21')][_0x7a69('0x40')]);_0x381400[_0x7a69('0x1f')]=qs[_0x7a69('0x26')](_['pick'](_0x296bd3[_0x7a69('0x21')],_0x2bbff9[_0x7a69('0x26')]));if(_0x296bd3[_0x7a69('0x21')][_0x7a69('0x42')]){_0x381400[_0x7a69('0x1f')]=_[_0x7a69('0x2c')](_0x381400[_0x7a69('0x1f')],{'$or':_['map'](_0x381400[_0x7a69('0x29')],function(_0x35e5b8){var _0xaa5ec1={};_0xaa5ec1[_0x35e5b8]={'$like':'%'+_0x296bd3[_0x7a69('0x21')][_0x7a69('0x42')]+'%'};return _0xaa5ec1;})});}_0x381400=_[_0x7a69('0x2c')]({},_0x381400,_0x296bd3[_0x7a69('0x2d')]);return _0x157a3e[_0x7a69('0x4c')](_0x381400);}})[_0x7a69('0x12')](function(_0x5a812a){if(_0x5a812a){_0x3361d2=_0x5a812a[_0x7a69('0x2b')];if(!_0x296bd3[_0x7a69('0x21')]['hasOwnProperty'](_0x7a69('0x3e'))){_0x381400[_0x7a69('0xd')]=qs[_0x7a69('0xd')](_0x296bd3[_0x7a69('0x21')][_0x7a69('0xd')]);_0x381400[_0x7a69('0xc')]=qs['offset'](_0x296bd3[_0x7a69('0x21')]['offset']);}return _0x157a3e[_0x7a69('0x4c')](_0x381400);}})['then'](function(_0x37bb38){if(_0x37bb38){return _0x37bb38?{'count':_0x3361d2,'rows':_0x37bb38}:null;}})[_0x7a69('0x12')](respondWithResult(_0x4c6c82,null))[_0x7a69('0x23')](handleError(_0x4c6c82,null));};exports[_0x7a69('0x4e')]=function(_0x38d54b,_0x20b82b){var _0x2da226=_0x38d54b['body'][_0x7a69('0x4f')];return db[_0x7a69('0x4d')]['findAll']({'where':{'id':_0x2da226},'attributes':['id'],'include':[{'model':db[_0x7a69('0x45')],'as':_0x7a69('0x50'),'attributes':['id',_0x7a69('0x16'),'online',_0x7a69('0x51'),_0x7a69('0x52')],'raw':!![]}]})['then'](function(_0x3a6af8){if(_0x3a6af8){var _0x2144a1=_[_0x7a69('0x53')](_0x3a6af8,function(_0x38798f){var _0x2757c6=_0x38798f[_0x7a69('0x30')]({'plain':!![]});return _0x2757c6[_0x7a69('0x50')];});return db[_0x7a69('0x19')][_0x7a69('0x35')]({'where':{'id':_0x38d54b[_0x7a69('0x24')]['id']}})[_0x7a69('0x12')](function(_0x3e1fb3){return db[_0x7a69('0x54')][_0x7a69('0x55')](function(_0x30178a){return _0x3e1fb3[_0x7a69('0x4e')](_0x2da226,{'transaction':_0x30178a})[_0x7a69('0x12')](function(){return BPromise['each'](_0x2144a1,function(_0x2e7118){return db[_0x7a69('0x3d')][_0x7a69('0x56')]({'where':{'UserId':_0x2e7118['id'],'ChatQueueId':_0x38d54b['params']['id']},'transaction':_0x30178a});});})[_0x7a69('0x12')](function(){_0x2144a1['forEach'](function(_0xfa17b4){socket[_0x7a69('0x57')](_0x7a69('0x58'),{'UserId':_0xfa17b4['id'],'ChatQueueId':_0x3e1fb3['id']});});});});});}})[_0x7a69('0x12')](respondWithStatusCode(_0x20b82b,null))[_0x7a69('0x23')](handleError(_0x20b82b,null));};exports[_0x7a69('0x59')]=function(_0x2fc0e8,_0x561913){return db[_0x7a69('0x4d')][_0x7a69('0x44')]({'where':{'id':_0x2fc0e8['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7a69('0x50'),'attributes':['id'],'raw':!![]}]})[_0x7a69('0x12')](handleEntityNotFound(_0x561913,null))[_0x7a69('0x12')](function(_0x416cf9){var _0x46f985=_[_0x7a69('0x43')](_0x416cf9,'id');var _0x11a4b6=[];var _0x3d0d1b=[];var _0x48948c=squel[_0x7a69('0x5a')]();_0x48948c[_0x7a69('0x5b')](_0x7a69('0x5c'))[_0x7a69('0x5d')](_0x7a69('0x5e'),'tq')[_0x7a69('0x5f')](_0x7a69('0x60'),'ut',_0x7a69('0x61'))[_0x7a69('0x1f')](_0x7a69('0x62'),_0x2fc0e8[_0x7a69('0x24')]['id']);for(var _0x368657=0x0;_0x368657<_0x416cf9[_0x7a69('0x2b')];_0x368657+=0x1){let _0x183dcf=_0x416cf9[_0x368657];for(var _0x22fc2d=0x0;_0x22fc2d<_0x183dcf[_0x7a69('0x50')][_0x7a69('0x2b')];_0x22fc2d+=0x1){let _0x36c11b=_0x183dcf[_0x7a69('0x50')][_0x22fc2d];var _0x1dffb5=_0x48948c[_0x7a69('0x63')]();_0x1dffb5['where'](_0x7a69('0x64'),_0x36c11b['id']);_0x3d0d1b[_0x7a69('0x65')](db[_0x7a69('0x54')]['query'](_0x1dffb5['toString'](),{'type':db[_0x7a69('0x54')][_0x7a69('0x66')]['SELECT']})[_0x7a69('0x12')](function(_0x52280f){if(_0x52280f[_0x7a69('0x2b')]===0x1){return _0x36c11b['id'];}else{var _0x485675=_[_0x7a69('0x67')](_[_0x7a69('0x43')](_0x52280f,_0x7a69('0x68')),function(_0x307784){return _[_0x7a69('0x69')](_0x46f985,_0x307784);});if(_0x485675){return _0x36c11b['id'];}}}));}}return BPromise[_0x7a69('0x6a')](_0x3d0d1b)[_0x7a69('0x12')](function(_0x46c3f5){_0x11a4b6=_(_0x11a4b6)[_0x7a69('0x6b')](_0x46c3f5)[_0x7a69('0x6c')]()[_0x7a69('0x6d')]();return db[_0x7a69('0x19')][_0x7a69('0x35')]({'where':{'id':_0x2fc0e8['params']['id']}})[_0x7a69('0x12')](function(_0x549e44){return db['sequelize'][_0x7a69('0x55')](function(_0xf80626){return _0x549e44[_0x7a69('0x59')](_0x2fc0e8['query']['ids'],{'transaction':_0xf80626})['then'](function(){if(!_[_0x7a69('0x6e')](_0x11a4b6)){return _0x549e44[_0x7a69('0x6f')](_0x11a4b6,{'transaction':_0xf80626});}})[_0x7a69('0x12')](function(){_0x11a4b6[_0x7a69('0x70')](function(_0x50659d){socket[_0x7a69('0x57')]('userChatQueue:remove',{'UserId':_0x50659d,'ChatQueueId':_0x549e44['id']});});});});});});})[_0x7a69('0x12')](respondWithStatusCode(_0x561913,null))[_0x7a69('0x23')](handleError(_0x561913,null));};exports[_0x7a69('0x71')]=function(_0xf07bc0,_0x5be8cb){return db[_0x7a69('0x19')]['find']({'where':{'id':_0xf07bc0[_0x7a69('0x24')]['id']}})[_0x7a69('0x12')](handleEntityNotFound(_0x5be8cb,null))[_0x7a69('0x12')](function(_0x5eb5fe){if(_0x5eb5fe){return _0x5eb5fe['addAgents'](_0xf07bc0[_0x7a69('0x39')][_0x7a69('0x4f')],_[_0x7a69('0x72')](_0xf07bc0[_0x7a69('0x39')],[_0x7a69('0x4f'),'id'])||{})[_0x7a69('0x73')](function(_0x193648){for(var _0x5a9528=0x0;_0x5a9528<_0xf07bc0['body'][_0x7a69('0x4f')][_0x7a69('0x2b')];_0x5a9528+=0x1){socket[_0x7a69('0x57')](_0x7a69('0x58'),{'UserId':Number(_0xf07bc0[_0x7a69('0x39')][_0x7a69('0x4f')][_0x5a9528]),'ChatQueueId':Number(_0xf07bc0[_0x7a69('0x24')]['id'])});}return _0x193648;});}})[_0x7a69('0x12')](respondWithResult(_0x5be8cb,null))['catch'](handleError(_0x5be8cb,null));};exports['removeAgents']=function(_0xa2f86f,_0x27e7db){return db['ChatQueue'][_0x7a69('0x35')]({'where':{'id':_0xa2f86f[_0x7a69('0x24')]['id']}})[_0x7a69('0x12')](handleEntityNotFound(_0x27e7db,null))[_0x7a69('0x12')](function(_0x11ebc7){if(_0x11ebc7){return _0x11ebc7[_0x7a69('0x6f')](_0xa2f86f[_0x7a69('0x21')][_0x7a69('0x4f')])[_0x7a69('0x12')](function(){if(_[_0x7a69('0x74')](_0xa2f86f[_0x7a69('0x21')][_0x7a69('0x4f')])){for(var _0x39716f=0x0;_0x39716f<_0xa2f86f[_0x7a69('0x21')][_0x7a69('0x4f')][_0x7a69('0x2b')];_0x39716f+=0x1){socket[_0x7a69('0x57')](_0x7a69('0x75'),{'UserId':Number(_0xa2f86f[_0x7a69('0x21')]['ids'][_0x39716f]),'ChatQueueId':Number(_0xa2f86f['params']['id'])});}}else{socket[_0x7a69('0x57')](_0x7a69('0x75'),{'UserId':Number(_0xa2f86f[_0x7a69('0x21')][_0x7a69('0x4f')]),'ChatQueueId':Number(_0xa2f86f[_0x7a69('0x24')]['id'])});}});}})['then'](respondWithStatusCode(_0x27e7db,null))[_0x7a69('0x23')](handleError(_0x27e7db,null));};exports[_0x7a69('0x76')]=function(_0x109026,_0x5b7699){var _0x45d3ae={};var _0x6fb546={};var _0x2925f8;var _0x4061d9;return db[_0x7a69('0x19')][_0x7a69('0x3c')]({'where':{'id':_0x109026[_0x7a69('0x24')]['id']}})['then'](handleEntityNotFound(_0x5b7699,null))['then'](function(_0x4d7d57){if(_0x4d7d57){_0x2925f8=_0x4d7d57;_0x6fb546['model']=_['keys'](db['User'][_0x7a69('0x1a')]);_0x6fb546[_0x7a69('0x21')]=_[_0x7a69('0x25')](_0x109026[_0x7a69('0x21')]);_0x6fb546['filters']=_['intersection'](_0x6fb546[_0x7a69('0x28')],_0x6fb546['query']);_0x45d3ae[_0x7a69('0x29')]=_[_0x7a69('0x27')](_0x6fb546[_0x7a69('0x28')],qs['fields'](_0x109026[_0x7a69('0x21')]['fields']));_0x45d3ae['attributes']=_0x45d3ae[_0x7a69('0x29')][_0x7a69('0x2b')]?_0x45d3ae[_0x7a69('0x29')]:_0x6fb546[_0x7a69('0x28')];_0x45d3ae[_0x7a69('0x3f')]=qs['sort'](_0x109026[_0x7a69('0x21')][_0x7a69('0x40')]);_0x45d3ae['where']=qs['filters'](_[_0x7a69('0x41')](_0x109026[_0x7a69('0x21')],_0x6fb546[_0x7a69('0x26')]));if(_0x109026[_0x7a69('0x21')]['filter']){_0x45d3ae[_0x7a69('0x1f')]=_[_0x7a69('0x2c')](_0x45d3ae[_0x7a69('0x1f')],{'$or':_[_0x7a69('0x43')](_0x45d3ae[_0x7a69('0x29')],function(_0x13bbfa){var _0x2d0420={};_0x2d0420[_0x13bbfa]={'$like':'%'+_0x109026[_0x7a69('0x21')][_0x7a69('0x42')]+'%'};return _0x2d0420;})});}_0x45d3ae=_[_0x7a69('0x2c')]({},_0x45d3ae,_0x109026['options']);return _0x2925f8[_0x7a69('0x76')](_0x45d3ae);}})[_0x7a69('0x12')](function(_0x53be30){if(_0x53be30){_0x4061d9=_0x53be30['length'];if(!_0x109026[_0x7a69('0x21')]['hasOwnProperty'](_0x7a69('0x3e'))){_0x45d3ae[_0x7a69('0xd')]=qs['limit'](_0x109026['query'][_0x7a69('0xd')]);_0x45d3ae[_0x7a69('0xc')]=qs['offset'](_0x109026[_0x7a69('0x21')]['offset']);}return _0x2925f8[_0x7a69('0x76')](_0x45d3ae);}})['then'](function(_0x33e449){if(_0x33e449){return _0x33e449?{'count':_0x4061d9,'rows':_0x33e449}:null;}})[_0x7a69('0x12')](respondWithResult(_0x5b7699,null))[_0x7a69('0x23')](handleError(_0x5b7699,null));}; \ No newline at end of file +var _0xdb35=['set','Content-Range','update','then','destroy','get','error','index','map','ChatQueue','rawAttributes','where','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatQueues','UserProfileSection','userProfileId','autoAssociation','name','describe','getMembers','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','filter','merge','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','getTeams','addTeams','ids','Agents','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','userChatQueue:save','select','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','json','undefined','limit','offset','count'];(function(_0xf9f76c,_0x82a886){var _0x19a4d3=function(_0x1e8eff){while(--_0x1e8eff){_0xf9f76c['push'](_0xf9f76c['shift']());}};_0x19a4d3(++_0x82a886);}(_0xdb35,0x15e));var _0x5db3=function(_0xfc959c,_0x4660c){_0xfc959c=_0xfc959c-0x0;var _0xa12959=_0xdb35[_0xfc959c];return _0xa12959;};'use strict';var BPromise=require(_0x5db3('0x0'));var util=require(_0x5db3('0x1'));var _=require('lodash');var squel=require(_0x5db3('0x2'));var Redis=require(_0x5db3('0x3'));var qs=require(_0x5db3('0x4'));var logger=require(_0x5db3('0x5'))(_0x5db3('0x6'));var config=require(_0x5db3('0x7'));var db=require(_0x5db3('0x8'))['db'];config[_0x5db3('0x9')]=_[_0x5db3('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5db3('0xb'))(new Redis(config[_0x5db3('0x9')]));require(_0x5db3('0xc'))[_0x5db3('0xd')](socket);function respondWithStatusCode(_0x4f1c17,_0x470c51){_0x470c51=_0x470c51||0xcc;return function(_0x354b45){if(_0x354b45){return _0x4f1c17[_0x5db3('0xe')](_0x470c51);}return _0x4f1c17[_0x5db3('0xf')](_0x470c51)[_0x5db3('0x10')]();};}function respondWithResult(_0xf205f3,_0x24fcf6){_0x24fcf6=_0x24fcf6||0xc8;return function(_0x314333){if(_0x314333){return _0xf205f3[_0x5db3('0xf')](_0x24fcf6)[_0x5db3('0x11')](_0x314333);}};}function respondWithFilteredResult(_0x4cba84,_0x1b7448){return function(_0x153aaf){if(_0x153aaf){var _0x4e902b=typeof _0x1b7448['offset']===_0x5db3('0x12')&&typeof _0x1b7448[_0x5db3('0x13')]===_0x5db3('0x12');var _0x27d4e0=_0x153aaf['count'];var _0x35ae6a=_0x4e902b?0x0:_0x1b7448[_0x5db3('0x14')];var _0x15e6ff=_0x4e902b?_0x153aaf[_0x5db3('0x15')]:_0x1b7448[_0x5db3('0x14')]+_0x1b7448[_0x5db3('0x13')];var _0x3b874a;if(_0x15e6ff>=_0x27d4e0){_0x15e6ff=_0x27d4e0;_0x3b874a=0xc8;}else{_0x3b874a=0xce;}_0x4cba84[_0x5db3('0xf')](_0x3b874a);return _0x4cba84[_0x5db3('0x16')](_0x5db3('0x17'),_0x35ae6a+'-'+_0x15e6ff+'/'+_0x27d4e0)[_0x5db3('0x11')](_0x153aaf);}return null;};}function saveUpdates(_0x28fc9f){return function(_0xa30c81){if(_0xa30c81){return _0xa30c81[_0x5db3('0x18')](_0x28fc9f)[_0x5db3('0x19')](function(_0xa87fee){return _0xa87fee;});}return null;};}function removeEntity(_0x37ed4b){return function(_0x404304){if(_0x404304){return _0x404304[_0x5db3('0x1a')]()[_0x5db3('0x19')](function(){var _0x50d501=_0x404304[_0x5db3('0x1b')]({'plain':!![]});var _0x19e47f='ChatQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x19e47f,'resourceId':_0x50d501['id']}})[_0x5db3('0x19')](function(){return _0x404304;});})['then'](function(){_0x37ed4b[_0x5db3('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ed3db){return function(_0x20fa51){if(!_0x20fa51){_0x1ed3db[_0x5db3('0xe')](0x194);}return _0x20fa51;};}function handleError(_0x423291,_0x10a45f){_0x10a45f=_0x10a45f||0x1f4;return function(_0x4a1663){logger[_0x5db3('0x1c')](_0x4a1663['stack']);if(_0x4a1663['name']){delete _0x4a1663['name'];}_0x423291[_0x5db3('0xf')](_0x10a45f)['send'](_0x4a1663);};}exports[_0x5db3('0x1d')]=function(_0x4f1f63,_0x30252d){var _0x1b15bf={};var _0x48c49f={'count':0x0,'rows':[]};var _0xb053b0=_[_0x5db3('0x1e')](db[_0x5db3('0x1f')][_0x5db3('0x20')],function(_0x466302){return{'name':_0x466302['fieldName'],'type':_0x466302['type']['key']};});_0x1b15bf=qs['getOptions'](_0xb053b0,_0x4f1f63);var _0x53f440={'where':_0x1b15bf[_0x5db3('0x21')]};return db[_0x5db3('0x1f')]['count'](_0x53f440)[_0x5db3('0x19')](function(_0x227ffa){_0x48c49f[_0x5db3('0x15')]=_0x227ffa;_0x1b15bf['include']=qs[_0x5db3('0x22')](_0x4f1f63[_0x5db3('0x23')]);return db[_0x5db3('0x1f')][_0x5db3('0x24')](_0x1b15bf);})[_0x5db3('0x19')](function(_0x2c5ded){_0x48c49f[_0x5db3('0x25')]=_0x2c5ded;return _0x48c49f;})[_0x5db3('0x19')](respondWithFilteredResult(_0x30252d,_0x1b15bf))[_0x5db3('0x26')](handleError(_0x30252d,null));};exports[_0x5db3('0x27')]=function(_0x43b0fa,_0x48d749){var _0xd6bbc0={'raw':!![],'where':{'id':_0x43b0fa[_0x5db3('0x28')]['id']}},_0x494900={};_0x494900[_0x5db3('0x29')]=_['keys'](db[_0x5db3('0x1f')][_0x5db3('0x20')]);_0x494900[_0x5db3('0x23')]=_[_0x5db3('0x2a')](_0x43b0fa['query']);_0x494900[_0x5db3('0x2b')]=_[_0x5db3('0x2c')](_0x494900[_0x5db3('0x29')],_0x494900['query']);_0xd6bbc0[_0x5db3('0x2d')]=_[_0x5db3('0x2c')](_0x494900['model'],qs['fields'](_0x43b0fa[_0x5db3('0x23')][_0x5db3('0x2e')]));_0xd6bbc0[_0x5db3('0x2d')]=_0xd6bbc0[_0x5db3('0x2d')][_0x5db3('0x2f')]?_0xd6bbc0['attributes']:_0x494900[_0x5db3('0x29')];if(_0x43b0fa[_0x5db3('0x23')][_0x5db3('0x30')]){_0xd6bbc0[_0x5db3('0x22')]=[{'all':!![]}];}_0xd6bbc0=_['merge']({},_0xd6bbc0,_0x43b0fa[_0x5db3('0x31')]);return db[_0x5db3('0x1f')][_0x5db3('0x32')](_0xd6bbc0)[_0x5db3('0x19')](handleEntityNotFound(_0x48d749,null))['then'](respondWithResult(_0x48d749,null))[_0x5db3('0x26')](handleError(_0x48d749,null));};exports[_0x5db3('0x33')]=function(_0x30782c,_0x38e7fe){return db[_0x5db3('0x1f')][_0x5db3('0x33')](_0x30782c[_0x5db3('0x34')],{})['then'](function(_0x5c9d04){var _0x3354eb=_0x30782c['user'][_0x5db3('0x1b')]({'plain':!![]});if(!_0x3354eb)throw new Error(_0x5db3('0x35'));if(_0x3354eb[_0x5db3('0x36')]===_0x5db3('0x37')){var _0xd8ac58=_0x5c9d04[_0x5db3('0x1b')]({'plain':!![]});var _0x1f0eff=_0x5db3('0x38');return db[_0x5db3('0x39')]['find']({'where':{'name':_0x1f0eff,'userProfileId':_0x3354eb[_0x5db3('0x3a')]},'raw':!![]})[_0x5db3('0x19')](function(_0x396159){if(_0x396159&&_0x396159[_0x5db3('0x3b')]===0x0){return db['UserProfileResource']['create']({'name':_0xd8ac58[_0x5db3('0x3c')],'resourceId':_0xd8ac58['id'],'type':_0x396159[_0x5db3('0x3c')],'sectionId':_0x396159['id']},{})[_0x5db3('0x19')](function(){return _0x5c9d04;});}else{return _0x5c9d04;}})['catch'](function(_0x2856c8){logger[_0x5db3('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2856c8);throw _0x2856c8;});}return _0x5c9d04;})['then'](respondWithResult(_0x38e7fe,0xc9))[_0x5db3('0x26')](handleError(_0x38e7fe,null));};exports[_0x5db3('0x18')]=function(_0x575dc0,_0x383c3e){if(_0x575dc0[_0x5db3('0x34')]['id']){delete _0x575dc0['body']['id'];}return db[_0x5db3('0x1f')][_0x5db3('0x32')]({'where':{'id':_0x575dc0[_0x5db3('0x28')]['id']}})[_0x5db3('0x19')](handleEntityNotFound(_0x383c3e,null))[_0x5db3('0x19')](saveUpdates(_0x575dc0['body'],null))[_0x5db3('0x19')](respondWithResult(_0x383c3e,null))[_0x5db3('0x26')](handleError(_0x383c3e,null));};exports[_0x5db3('0x1a')]=function(_0xa2814d,_0x92d399){return db[_0x5db3('0x1f')]['find']({'where':{'id':_0xa2814d[_0x5db3('0x28')]['id']}})['then'](handleEntityNotFound(_0x92d399,null))['then'](removeEntity(_0x92d399,null))[_0x5db3('0x26')](handleError(_0x92d399,null));};exports['describe']=function(_0x179d3f,_0x1b31ca){return db[_0x5db3('0x1f')][_0x5db3('0x3d')]()[_0x5db3('0x19')](respondWithResult(_0x1b31ca,null))[_0x5db3('0x26')](handleError(_0x1b31ca,null));};exports[_0x5db3('0x3e')]=function(_0x130f03,_0x529a8b){var _0x4c246c={'raw':!![],'where':{}},_0x2f7d1c={},_0x6f467e;return db[_0x5db3('0x1f')]['findOne']({'where':{'id':_0x130f03[_0x5db3('0x28')]['id']}})[_0x5db3('0x19')](handleEntityNotFound(_0x529a8b,null))[_0x5db3('0x19')](function(_0x2296dd){if(_0x2296dd){_0x6f467e=_0x2296dd[_0x5db3('0x1b')]({'plain':!![]});_0x2f7d1c[_0x5db3('0x29')]=_[_0x5db3('0x2a')](db['UserChatQueue'][_0x5db3('0x20')]);_0x2f7d1c[_0x5db3('0x23')]=_[_0x5db3('0x2a')](_0x130f03[_0x5db3('0x23')]);_0x2f7d1c[_0x5db3('0x2b')]=_[_0x5db3('0x2c')](_0x2f7d1c[_0x5db3('0x29')],_0x2f7d1c[_0x5db3('0x23')]);_0x4c246c[_0x5db3('0x2d')]=_[_0x5db3('0x2c')](_0x2f7d1c[_0x5db3('0x29')],qs[_0x5db3('0x2e')](_0x130f03['query'][_0x5db3('0x2e')]));_0x4c246c[_0x5db3('0x2d')]=_0x4c246c['attributes']['length']?_0x4c246c[_0x5db3('0x2d')]:_0x2f7d1c[_0x5db3('0x29')];if(!_0x130f03[_0x5db3('0x23')][_0x5db3('0x3f')](_0x5db3('0x40'))){_0x4c246c[_0x5db3('0x13')]=qs[_0x5db3('0x13')](_0x130f03[_0x5db3('0x23')][_0x5db3('0x13')]);_0x4c246c[_0x5db3('0x14')]=qs[_0x5db3('0x14')](_0x130f03[_0x5db3('0x23')][_0x5db3('0x14')]);}_0x4c246c[_0x5db3('0x41')]=qs[_0x5db3('0x42')](_0x130f03[_0x5db3('0x23')][_0x5db3('0x42')]);_0x4c246c[_0x5db3('0x21')]=qs['filters'](_[_0x5db3('0x43')](_0x130f03[_0x5db3('0x23')],_0x2f7d1c[_0x5db3('0x2b')]));_0x4c246c[_0x5db3('0x21')][_0x5db3('0x44')]=_0x2296dd['id'];if(_0x130f03['query'][_0x5db3('0x45')]){_0x4c246c[_0x5db3('0x21')]=_[_0x5db3('0x46')](_0x4c246c[_0x5db3('0x21')],{'$or':_[_0x5db3('0x1e')](_0x4c246c[_0x5db3('0x2d')],function(_0x4c57b1){var _0x32dd9f={};_0x32dd9f[_0x4c57b1]={'$like':'%'+_0x130f03[_0x5db3('0x23')]['filter']+'%'};return _0x32dd9f;})});}_0x4c246c=_[_0x5db3('0x46')]({},_0x4c246c,_0x130f03[_0x5db3('0x31')]);return db[_0x5db3('0x47')]['findAll'](_0x4c246c);}})['then'](function(_0x2dbc37){if(_0x2dbc37){return db[_0x5db3('0x48')][_0x5db3('0x49')]({'where':{'id':_[_0x5db3('0x1e')](_0x2dbc37,_0x5db3('0x4a')),'role':_0x5db3('0x4b')},'attributes':['id',_0x5db3('0x3c'),_0x5db3('0x4c'),_0x5db3('0x4d'),_0x5db3('0x4e')]});}})[_0x5db3('0x19')](function(_0x321880){if(_0x321880){return{'count':_0x321880['count'],'rows':_[_0x5db3('0x1e')](_0x321880[_0x5db3('0x25')],function(_0x525dcc){return{'membername':_0x525dcc[_0x5db3('0x3c')],'UserId':_0x525dcc['id'],'queue_name':_0x6f467e[_0x5db3('0x3c')],'ChatQueueId':_0x6f467e['id'],'interface':util['format'](_0x5db3('0x4f'),_0x5db3('0x50'),_0x525dcc[_0x5db3('0x3c')]),'penalty':0x0,'paused':_0x525dcc[_0x5db3('0x4c')],'createdAt':_0x525dcc[_0x5db3('0x4e')],'updatedAt':_0x525dcc[_0x5db3('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5db3('0x19')](respondWithFilteredResult(_0x529a8b,_0x4c246c))[_0x5db3('0x26')](handleError(_0x529a8b,null));};exports['getTeams']=function(_0x14aa59,_0x3b27a0){var _0x2b5b2e={};var _0x1f1dde={};var _0xbe21c6;var _0x4c9185;return db[_0x5db3('0x1f')][_0x5db3('0x51')]({'where':{'id':_0x14aa59[_0x5db3('0x28')]['id']}})['then'](handleEntityNotFound(_0x3b27a0,null))[_0x5db3('0x19')](function(_0xc7aace){if(_0xc7aace){_0xbe21c6=_0xc7aace;_0x1f1dde[_0x5db3('0x29')]=_[_0x5db3('0x2a')](db[_0x5db3('0x52')][_0x5db3('0x20')]);_0x1f1dde[_0x5db3('0x23')]=_[_0x5db3('0x2a')](_0x14aa59[_0x5db3('0x23')]);_0x1f1dde[_0x5db3('0x2b')]=_['intersection'](_0x1f1dde['model'],_0x1f1dde[_0x5db3('0x23')]);_0x2b5b2e['attributes']=_['intersection'](_0x1f1dde[_0x5db3('0x29')],qs[_0x5db3('0x2e')](_0x14aa59['query'][_0x5db3('0x2e')]));_0x2b5b2e[_0x5db3('0x2d')]=_0x2b5b2e['attributes']['length']?_0x2b5b2e['attributes']:_0x1f1dde[_0x5db3('0x29')];_0x2b5b2e[_0x5db3('0x41')]=qs[_0x5db3('0x42')](_0x14aa59[_0x5db3('0x23')][_0x5db3('0x42')]);_0x2b5b2e[_0x5db3('0x21')]=qs[_0x5db3('0x2b')](_[_0x5db3('0x43')](_0x14aa59['query'],_0x1f1dde[_0x5db3('0x2b')]));if(_0x14aa59[_0x5db3('0x23')][_0x5db3('0x45')]){_0x2b5b2e[_0x5db3('0x21')]=_[_0x5db3('0x46')](_0x2b5b2e[_0x5db3('0x21')],{'$or':_[_0x5db3('0x1e')](_0x2b5b2e[_0x5db3('0x2d')],function(_0x39c144){var _0x1e2d11={};_0x1e2d11[_0x39c144]={'$like':'%'+_0x14aa59[_0x5db3('0x23')][_0x5db3('0x45')]+'%'};return _0x1e2d11;})});}_0x2b5b2e=_[_0x5db3('0x46')]({},_0x2b5b2e,_0x14aa59[_0x5db3('0x31')]);return _0xbe21c6[_0x5db3('0x53')](_0x2b5b2e);}})[_0x5db3('0x19')](function(_0x31c7d0){if(_0x31c7d0){_0x4c9185=_0x31c7d0[_0x5db3('0x2f')];if(!_0x14aa59[_0x5db3('0x23')][_0x5db3('0x3f')](_0x5db3('0x40'))){_0x2b5b2e['limit']=qs[_0x5db3('0x13')](_0x14aa59['query']['limit']);_0x2b5b2e[_0x5db3('0x14')]=qs[_0x5db3('0x14')](_0x14aa59[_0x5db3('0x23')][_0x5db3('0x14')]);}return _0xbe21c6[_0x5db3('0x53')](_0x2b5b2e);}})[_0x5db3('0x19')](function(_0x2e706f){if(_0x2e706f){return _0x2e706f?{'count':_0x4c9185,'rows':_0x2e706f}:null;}})[_0x5db3('0x19')](respondWithResult(_0x3b27a0,null))['catch'](handleError(_0x3b27a0,null));};exports[_0x5db3('0x54')]=function(_0x12a129,_0x2a6ce3){var _0x489177=_0x12a129['body'][_0x5db3('0x55')];return db[_0x5db3('0x52')][_0x5db3('0x24')]({'where':{'id':_0x489177},'attributes':['id'],'include':[{'model':db[_0x5db3('0x48')],'as':_0x5db3('0x56'),'attributes':['id',_0x5db3('0x3c'),'online',_0x5db3('0x57'),_0x5db3('0x58')],'raw':!![]}]})[_0x5db3('0x19')](function(_0x1ce2db){if(_0x1ce2db){var _0xa4a2e7=_[_0x5db3('0x59')](_0x1ce2db,function(_0x454209){var _0x379c0f=_0x454209[_0x5db3('0x1b')]({'plain':!![]});return _0x379c0f['Agents'];});return db[_0x5db3('0x1f')][_0x5db3('0x32')]({'where':{'id':_0x12a129['params']['id']}})[_0x5db3('0x19')](function(_0x1675d1){return db['sequelize'][_0x5db3('0x5a')](function(_0x1a837b){return _0x1675d1[_0x5db3('0x54')](_0x489177,{'transaction':_0x1a837b})['then'](function(){return BPromise[_0x5db3('0x5b')](_0xa4a2e7,function(_0xd60b84){return db[_0x5db3('0x47')][_0x5db3('0x5c')]({'where':{'UserId':_0xd60b84['id'],'ChatQueueId':_0x12a129[_0x5db3('0x28')]['id']},'transaction':_0x1a837b});});})[_0x5db3('0x19')](function(){_0xa4a2e7[_0x5db3('0x5d')](function(_0x130024){socket['emit'](_0x5db3('0x5e'),{'UserId':_0x130024['id'],'ChatQueueId':_0x1675d1['id']});});});});});}})['then'](respondWithStatusCode(_0x2a6ce3,null))[_0x5db3('0x26')](handleError(_0x2a6ce3,null));};exports['removeTeams']=function(_0xbeedc,_0x38a133){return db[_0x5db3('0x52')][_0x5db3('0x24')]({'where':{'id':_0xbeedc[_0x5db3('0x23')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5db3('0x19')](handleEntityNotFound(_0x38a133,null))[_0x5db3('0x19')](function(_0x329dc9){var _0x3a5faf=_[_0x5db3('0x1e')](_0x329dc9,'id');var _0x1898c4=[];var _0x264ed7=[];var _0x391ad9=squel[_0x5db3('0x5f')]();_0x391ad9['field']('tq.TeamId')[_0x5db3('0x60')]('team_has_chat_queues','tq')[_0x5db3('0x61')](_0x5db3('0x62'),'ut',_0x5db3('0x63'))[_0x5db3('0x21')](_0x5db3('0x64'),_0xbeedc['params']['id']);for(var _0x537d10=0x0;_0x537d10<_0x329dc9[_0x5db3('0x2f')];_0x537d10+=0x1){let _0x5039ee=_0x329dc9[_0x537d10];for(var _0x5bf544=0x0;_0x5bf544<_0x5039ee[_0x5db3('0x56')][_0x5db3('0x2f')];_0x5bf544+=0x1){let _0x21a2ec=_0x5039ee[_0x5db3('0x56')][_0x5bf544];var _0x121f82=_0x391ad9['clone']();_0x121f82[_0x5db3('0x21')](_0x5db3('0x65'),_0x21a2ec['id']);_0x264ed7[_0x5db3('0x66')](db[_0x5db3('0x67')]['query'](_0x121f82[_0x5db3('0x68')](),{'type':db[_0x5db3('0x67')][_0x5db3('0x69')][_0x5db3('0x6a')]})[_0x5db3('0x19')](function(_0x532e25){if(_0x532e25['length']===0x1){return _0x21a2ec['id'];}else{var _0x113a49=_[_0x5db3('0x6b')](_[_0x5db3('0x1e')](_0x532e25,_0x5db3('0x6c')),function(_0x20a8dd){return _[_0x5db3('0x6d')](_0x3a5faf,_0x20a8dd);});if(_0x113a49){return _0x21a2ec['id'];}}}));}}return BPromise[_0x5db3('0x6e')](_0x264ed7)[_0x5db3('0x19')](function(_0x14751e){_0x1898c4=_(_0x1898c4)[_0x5db3('0x6f')](_0x14751e)[_0x5db3('0x70')]()[_0x5db3('0x71')]();return db[_0x5db3('0x1f')]['find']({'where':{'id':_0xbeedc[_0x5db3('0x28')]['id']}})[_0x5db3('0x19')](function(_0x127da1){return db[_0x5db3('0x67')][_0x5db3('0x5a')](function(_0x23d606){return _0x127da1[_0x5db3('0x72')](_0xbeedc[_0x5db3('0x23')]['ids'],{'transaction':_0x23d606})['then'](function(){if(!_[_0x5db3('0x73')](_0x1898c4)){return _0x127da1[_0x5db3('0x74')](_0x1898c4,{'transaction':_0x23d606});}})[_0x5db3('0x19')](function(){_0x1898c4[_0x5db3('0x5d')](function(_0x508d97){socket[_0x5db3('0x75')](_0x5db3('0x76'),{'UserId':_0x508d97,'ChatQueueId':_0x127da1['id']});});});});});});})[_0x5db3('0x19')](respondWithStatusCode(_0x38a133,null))[_0x5db3('0x26')](handleError(_0x38a133,null));};exports[_0x5db3('0x77')]=function(_0x1f37c5,_0x250b63){return db['ChatQueue'][_0x5db3('0x32')]({'where':{'id':_0x1f37c5[_0x5db3('0x28')]['id']}})['then'](handleEntityNotFound(_0x250b63,null))[_0x5db3('0x19')](function(_0x58dfa4){if(_0x58dfa4){return _0x58dfa4[_0x5db3('0x77')](_0x1f37c5[_0x5db3('0x34')][_0x5db3('0x55')],_[_0x5db3('0x78')](_0x1f37c5[_0x5db3('0x34')],['ids','id'])||{})[_0x5db3('0x79')](function(_0xca9143){for(var _0x3f7ff=0x0;_0x3f7ff<_0x1f37c5[_0x5db3('0x34')][_0x5db3('0x55')][_0x5db3('0x2f')];_0x3f7ff+=0x1){socket[_0x5db3('0x75')](_0x5db3('0x5e'),{'UserId':Number(_0x1f37c5[_0x5db3('0x34')]['ids'][_0x3f7ff]),'ChatQueueId':Number(_0x1f37c5[_0x5db3('0x28')]['id'])});}return _0xca9143;});}})['then'](respondWithResult(_0x250b63,null))[_0x5db3('0x26')](handleError(_0x250b63,null));};exports[_0x5db3('0x74')]=function(_0x5acf9a,_0x2dea47){return db['ChatQueue']['find']({'where':{'id':_0x5acf9a[_0x5db3('0x28')]['id']}})[_0x5db3('0x19')](handleEntityNotFound(_0x2dea47,null))[_0x5db3('0x19')](function(_0x12a7cb){if(_0x12a7cb){return _0x12a7cb['removeAgents'](_0x5acf9a[_0x5db3('0x23')]['ids'])['then'](function(){if(_[_0x5db3('0x7a')](_0x5acf9a['query'][_0x5db3('0x55')])){for(var _0x1d78f2=0x0;_0x1d78f2<_0x5acf9a[_0x5db3('0x23')]['ids'][_0x5db3('0x2f')];_0x1d78f2+=0x1){socket[_0x5db3('0x75')](_0x5db3('0x76'),{'UserId':Number(_0x5acf9a[_0x5db3('0x23')]['ids'][_0x1d78f2]),'ChatQueueId':Number(_0x5acf9a['params']['id'])});}}else{socket[_0x5db3('0x75')](_0x5db3('0x76'),{'UserId':Number(_0x5acf9a[_0x5db3('0x23')][_0x5db3('0x55')]),'ChatQueueId':Number(_0x5acf9a[_0x5db3('0x28')]['id'])});}});}})[_0x5db3('0x19')](respondWithStatusCode(_0x2dea47,null))[_0x5db3('0x26')](handleError(_0x2dea47,null));};exports[_0x5db3('0x7b')]=function(_0x3ca517,_0x189aa0){var _0x1d5ea9={};var _0x43e6b3={};var _0x55290c;var _0x14976b;return db[_0x5db3('0x1f')]['findOne']({'where':{'id':_0x3ca517['params']['id']}})[_0x5db3('0x19')](handleEntityNotFound(_0x189aa0,null))[_0x5db3('0x19')](function(_0x449ece){if(_0x449ece){_0x55290c=_0x449ece;_0x43e6b3['model']=_[_0x5db3('0x2a')](db[_0x5db3('0x48')][_0x5db3('0x20')]);_0x43e6b3['query']=_[_0x5db3('0x2a')](_0x3ca517[_0x5db3('0x23')]);_0x43e6b3['filters']=_[_0x5db3('0x2c')](_0x43e6b3['model'],_0x43e6b3[_0x5db3('0x23')]);_0x1d5ea9[_0x5db3('0x2d')]=_[_0x5db3('0x2c')](_0x43e6b3[_0x5db3('0x29')],qs[_0x5db3('0x2e')](_0x3ca517[_0x5db3('0x23')]['fields']));_0x1d5ea9[_0x5db3('0x2d')]=_0x1d5ea9['attributes'][_0x5db3('0x2f')]?_0x1d5ea9['attributes']:_0x43e6b3[_0x5db3('0x29')];_0x1d5ea9['order']=qs[_0x5db3('0x42')](_0x3ca517['query'][_0x5db3('0x42')]);_0x1d5ea9[_0x5db3('0x21')]=qs[_0x5db3('0x2b')](_[_0x5db3('0x43')](_0x3ca517[_0x5db3('0x23')],_0x43e6b3[_0x5db3('0x2b')]));if(_0x3ca517['query'][_0x5db3('0x45')]){_0x1d5ea9['where']=_['merge'](_0x1d5ea9[_0x5db3('0x21')],{'$or':_[_0x5db3('0x1e')](_0x1d5ea9[_0x5db3('0x2d')],function(_0x5e4823){var _0x3a53fb={};_0x3a53fb[_0x5e4823]={'$like':'%'+_0x3ca517[_0x5db3('0x23')][_0x5db3('0x45')]+'%'};return _0x3a53fb;})});}_0x1d5ea9=_[_0x5db3('0x46')]({},_0x1d5ea9,_0x3ca517[_0x5db3('0x31')]);return _0x55290c['getAgents'](_0x1d5ea9);}})[_0x5db3('0x19')](function(_0x5b986a){if(_0x5b986a){_0x14976b=_0x5b986a[_0x5db3('0x2f')];if(!_0x3ca517['query']['hasOwnProperty'](_0x5db3('0x40'))){_0x1d5ea9[_0x5db3('0x13')]=qs[_0x5db3('0x13')](_0x3ca517['query'][_0x5db3('0x13')]);_0x1d5ea9['offset']=qs[_0x5db3('0x14')](_0x3ca517['query'][_0x5db3('0x14')]);}return _0x55290c[_0x5db3('0x7b')](_0x1d5ea9);}})[_0x5db3('0x19')](function(_0x2e1c12){if(_0x2e1c12){return _0x2e1c12?{'count':_0x14976b,'rows':_0x2e1c12}:null;}})[_0x5db3('0x19')](respondWithResult(_0x189aa0,null))['catch'](handleError(_0x189aa0,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index d045937..6960a2d 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 _0x07d5=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','ChatQueue'];(function(_0x8b4b73,_0x52d63b){var _0x488f96=function(_0x27a6cb){while(--_0x27a6cb){_0x8b4b73['push'](_0x8b4b73['shift']());}};_0x488f96(++_0x52d63b);}(_0x07d5,0x15c));var _0x507d=function(_0x318b5d,_0xaf3b7a){_0x318b5d=_0x318b5d-0x0;var _0x577ab8=_0x07d5[_0x318b5d];return _0x577ab8;};'use strict';var EventEmitter=require(_0x507d('0x0'));var ChatQueue=require(_0x507d('0x1'))['db'][_0x507d('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x507d('0x3')](0x0);var events={'afterCreate':_0x507d('0x4'),'afterUpdate':_0x507d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2e732b){return function(_0x491d29,_0x23c1e2,_0x4560f6){ChatQueueEvents[_0x507d('0x6')](_0x2e732b+':'+_0x491d29['id'],_0x491d29);ChatQueueEvents[_0x507d('0x6')](_0x2e732b,_0x491d29);_0x4560f6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x507d('0x7')](e,emitEvent(event));}}module[_0x507d('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x9eca=['emit','hook','exports','events','ChatQueue','setMaxListeners','save','update','remove'];(function(_0x4e66dc,_0x304b2b){var _0x50126c=function(_0x4de7f4){while(--_0x4de7f4){_0x4e66dc['push'](_0x4e66dc['shift']());}};_0x50126c(++_0x304b2b);}(_0x9eca,0xd2));var _0xa9ec=function(_0x150a49,_0x47b070){_0x150a49=_0x150a49-0x0;var _0xe8c345=_0x9eca[_0x150a49];return _0xe8c345;};'use strict';var EventEmitter=require(_0xa9ec('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xa9ec('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xa9ec('0x2')](0x0);var events={'afterCreate':_0xa9ec('0x3'),'afterUpdate':_0xa9ec('0x4'),'afterDestroy':_0xa9ec('0x5')};function emitEvent(_0x520561){return function(_0x331d90,_0x49e2ae,_0x493bcc){ChatQueueEvents[_0xa9ec('0x6')](_0x520561+':'+_0x331d90['id'],_0x331d90);ChatQueueEvents['emit'](_0x520561,_0x331d90);_0x493bcc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xa9ec('0x7')](e,emitEvent(event));}}module[_0xa9ec('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 5aa9bd2..17e2d6d 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 _0x59ed=['bluebird','path','rimraf','../../config/environment','exports','define','ChatQueue','lodash','util','../../config/logger','api','moment'];(function(_0x4e8656,_0x1f2774){var _0x299fa2=function(_0x25c2d4){while(--_0x25c2d4){_0x4e8656['push'](_0x4e8656['shift']());}};_0x299fa2(++_0x1f2774);}(_0x59ed,0x16f));var _0xd59e=function(_0x15fe68,_0xddc145){_0x15fe68=_0x15fe68-0x0;var _0x1d144c=_0x59ed[_0x15fe68];return _0x1d144c;};'use strict';var _=require(_0xd59e('0x0'));var util=require(_0xd59e('0x1'));var logger=require(_0xd59e('0x2'))(_0xd59e('0x3'));var moment=require(_0xd59e('0x4'));var BPromise=require(_0xd59e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd59e('0x6'));var rimraf=require(_0xd59e('0x7'));var config=require(_0xd59e('0x8'));var attributes=require('./chatQueue.attributes');module[_0xd59e('0x9')]=function(_0x4a686e,_0x25ff51){return _0x4a686e[_0xd59e('0xa')](_0xd59e('0xb'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd40c=['exports','define','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatQueue.attributes'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xd40c,0xfa));var _0xcd40=function(_0x331e4d,_0x57f3fa){_0x331e4d=_0x331e4d-0x0;var _0x2cf19d=_0xd40c[_0x331e4d];return _0x2cf19d;};'use strict';var _=require(_0xcd40('0x0'));var util=require(_0xcd40('0x1'));var logger=require(_0xcd40('0x2'))(_0xcd40('0x3'));var moment=require(_0xcd40('0x4'));var BPromise=require(_0xcd40('0x5'));var rp=require(_0xcd40('0x6'));var fs=require('fs');var path=require(_0xcd40('0x7'));var rimraf=require('rimraf');var config=require(_0xcd40('0x8'));var attributes=require(_0xcd40('0x9'));module[_0xcd40('0xa')]=function(_0x4770ed,_0x373c57){return _0x4770ed[_0xcd40('0xb')]('ChatQueue',attributes,{'tableName':_0xcd40('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index a853b03..4fece70 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 _0xc264=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetChatQueue','findAll','raw','options','where','limit','include','map','model','attributes','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2fc4ee,_0x2e5b4b){var _0x15958a=function(_0x2945ea){while(--_0x2945ea){_0x2fc4ee['push'](_0x2fc4ee['shift']());}};_0x15958a(++_0x2e5b4b);}(_0xc264,0x1a6));var _0x4c26=function(_0x44feb5,_0x3f7964){_0x44feb5=_0x44feb5-0x0;var _0x45e3b8=_0xc264[_0x44feb5];return _0x45e3b8;};'use strict';var _=require(_0x4c26('0x0'));var util=require(_0x4c26('0x1'));var moment=require(_0x4c26('0x2'));var BPromise=require(_0x4c26('0x3'));var rs=require(_0x4c26('0x4'));var fs=require('fs');var Redis=require(_0x4c26('0x5'));var db=require(_0x4c26('0x6'))['db'];var utils=require(_0x4c26('0x7'));var logger=require(_0x4c26('0x8'))('rpc');var config=require(_0x4c26('0x9'));var jayson=require(_0x4c26('0xa'));var client=jayson[_0x4c26('0xb')][_0x4c26('0xc')]({'port':0x232a});config[_0x4c26('0xd')]=_['defaults'](config[_0x4c26('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x4c26('0xe'))(new Redis(config[_0x4c26('0xd')]));require(_0x4c26('0xf'))[_0x4c26('0x10')](socket);function respondWithRpcPromise(_0x16cbaa,_0x36ee28,_0x5c9b4c){return new BPromise(function(_0x2fe8c3,_0x535543){return client['request'](_0x16cbaa,_0x5c9b4c)[_0x4c26('0x11')](function(_0xdd5ab5){logger[_0x4c26('0x12')](_0x4c26('0x13'),_0x36ee28,_0x4c26('0x14'));logger[_0x4c26('0x15')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x36ee28,_0x4c26('0x14'),JSON[_0x4c26('0x16')](_0xdd5ab5));if(_0xdd5ab5[_0x4c26('0x17')]){if(_0xdd5ab5[_0x4c26('0x17')][_0x4c26('0x18')]===0x1f4){logger[_0x4c26('0x17')](_0x4c26('0x13'),_0x36ee28,_0xdd5ab5['error'][_0x4c26('0x19')]);return _0x535543(_0xdd5ab5['error'][_0x4c26('0x19')]);}logger['error'](_0x4c26('0x13'),_0x36ee28,_0xdd5ab5[_0x4c26('0x17')][_0x4c26('0x19')]);return _0x2fe8c3(_0xdd5ab5[_0x4c26('0x17')][_0x4c26('0x19')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x36ee28,'request\x20sent');_0x2fe8c3(_0xdd5ab5['result'][_0x4c26('0x19')]);}})[_0x4c26('0x1a')](function(_0xca475a){logger[_0x4c26('0x17')](_0x4c26('0x13'),_0x36ee28,_0xca475a);_0x535543(_0xca475a);});});}exports[_0x4c26('0x1b')]=function(_0xe4f0e1){var _0x561b61=this;return new Promise(function(_0x442fc9,_0x2fca53){return db['ChatQueue'][_0x4c26('0x1c')]({'raw':_0xe4f0e1['options']?_0xe4f0e1['options'][_0x4c26('0x1d')]===undefined?!![]:![]:!![],'where':_0xe4f0e1[_0x4c26('0x1e')]?_0xe4f0e1[_0x4c26('0x1e')][_0x4c26('0x1f')]||null:null,'attributes':_0xe4f0e1[_0x4c26('0x1e')]?_0xe4f0e1[_0x4c26('0x1e')]['attributes']||null:null,'limit':_0xe4f0e1[_0x4c26('0x1e')]?_0xe4f0e1[_0x4c26('0x1e')][_0x4c26('0x20')]||null:null,'include':_0xe4f0e1[_0x4c26('0x1e')]?_0xe4f0e1[_0x4c26('0x1e')][_0x4c26('0x21')]?_[_0x4c26('0x22')](_0xe4f0e1[_0x4c26('0x1e')][_0x4c26('0x21')],function(_0x394676){return{'model':db[_0x394676[_0x4c26('0x23')]],'as':_0x394676['as'],'attributes':_0x394676[_0x4c26('0x24')],'include':_0x394676['include']?_[_0x4c26('0x22')](_0x394676[_0x4c26('0x21')],function(_0x42d357){return{'model':db[_0x42d357[_0x4c26('0x23')]],'as':_0x42d357['as'],'attributes':_0x42d357['attributes'],'include':_0x42d357[_0x4c26('0x21')]?_[_0x4c26('0x22')](_0x42d357['include'],function(_0x580ef7){return{'model':db[_0x580ef7[_0x4c26('0x23')]],'as':_0x580ef7['as'],'attributes':_0x580ef7[_0x4c26('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4812fe){logger[_0x4c26('0x12')](_0x4c26('0x1b'),_0xe4f0e1);logger[_0x4c26('0x15')]('GetChatQueue',_0xe4f0e1,JSON[_0x4c26('0x16')](_0x4812fe));_0x442fc9(_0x4812fe);})[_0x4c26('0x1a')](function(_0x6ebe28){logger['error']('GetChatQueue',_0x6ebe28[_0x4c26('0x19')],_0xe4f0e1);_0x2fca53(_0x561b61['error'](0x1f4,_0x6ebe28[_0x4c26('0x19')]));});});};exports[_0x4c26('0x25')]=function(_0x3f5ef3){var _0xf8a60f=this;return new Promise(function(_0x36c2fd,_0x3e3c57){return db['ChatQueue'][_0x4c26('0x26')]({'raw':_0x3f5ef3[_0x4c26('0x1e')]?_0x3f5ef3[_0x4c26('0x1e')][_0x4c26('0x1d')]===undefined?!![]:![]:!![],'where':_0x3f5ef3['options']?_0x3f5ef3[_0x4c26('0x1e')][_0x4c26('0x1f')]||null:null,'attributes':_0x3f5ef3['options']?_0x3f5ef3['options'][_0x4c26('0x24')]||null:null,'include':_0x3f5ef3[_0x4c26('0x1e')]?_0x3f5ef3[_0x4c26('0x1e')]['include']?_[_0x4c26('0x22')](_0x3f5ef3[_0x4c26('0x1e')]['include'],function(_0x34a1af){return{'model':db[_0x34a1af[_0x4c26('0x23')]],'as':_0x34a1af['as'],'attributes':_0x34a1af[_0x4c26('0x24')],'include':_0x34a1af['include']?_[_0x4c26('0x22')](_0x34a1af[_0x4c26('0x21')],function(_0x39209a){return{'model':db[_0x39209a[_0x4c26('0x23')]],'as':_0x39209a['as'],'attributes':_0x39209a[_0x4c26('0x24')],'include':_0x39209a[_0x4c26('0x21')]?_[_0x4c26('0x22')](_0x39209a[_0x4c26('0x21')],function(_0x3b4ecd){return{'model':db[_0x3b4ecd['model']],'as':_0x3b4ecd['as'],'attributes':_0x3b4ecd[_0x4c26('0x24')]};}):[]};}):[]};}):[]:[]})[_0x4c26('0x11')](function(_0x23b3c1){logger[_0x4c26('0x12')](_0x4c26('0x25'),_0x3f5ef3);logger[_0x4c26('0x15')](_0x4c26('0x25'),_0x3f5ef3,JSON[_0x4c26('0x16')](_0x23b3c1));_0x36c2fd(_0x23b3c1);})[_0x4c26('0x1a')](function(_0x1cceb0){logger[_0x4c26('0x17')](_0x4c26('0x25'),_0x1cceb0[_0x4c26('0x19')],_0x3f5ef3);_0x3e3c57(_0xf8a60f[_0x4c26('0x17')](0x1f4,_0x1cceb0['message']));});});}; \ No newline at end of file +var _0xa63a=['defaults','localhost','socket.io-emitter','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','limit','include','map','attributes','model','ShowChatQueue','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0xa63a,0x154));var _0xaa63=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xa63a[_0x26f702];return _0x11417d;};'use strict';var _=require('lodash');var util=require(_0xaa63('0x0'));var moment=require(_0xaa63('0x1'));var BPromise=require(_0xaa63('0x2'));var rs=require(_0xaa63('0x3'));var fs=require('fs');var Redis=require(_0xaa63('0x4'));var db=require(_0xaa63('0x5'))['db'];var utils=require(_0xaa63('0x6'));var logger=require(_0xaa63('0x7'))(_0xaa63('0x8'));var config=require(_0xaa63('0x9'));var jayson=require(_0xaa63('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xaa63('0xb')](config['redis'],{'host':_0xaa63('0xc'),'port':0x18eb});var socket=require(_0xaa63('0xd'))(new Redis(config['redis']));require(_0xaa63('0xe'))[_0xaa63('0xf')](socket);function respondWithRpcPromise(_0x1ac54f,_0x2e0dcf,_0x7d1c77){return new BPromise(function(_0x12de55,_0xc170dd){return client['request'](_0x1ac54f,_0x7d1c77)[_0xaa63('0x10')](function(_0xddfb8b){logger[_0xaa63('0x11')](_0xaa63('0x12'),_0x2e0dcf,_0xaa63('0x13'));logger[_0xaa63('0x14')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2e0dcf,'request\x20sent',JSON['stringify'](_0xddfb8b));if(_0xddfb8b['error']){if(_0xddfb8b[_0xaa63('0x15')][_0xaa63('0x16')]===0x1f4){logger[_0xaa63('0x15')](_0xaa63('0x12'),_0x2e0dcf,_0xddfb8b[_0xaa63('0x15')][_0xaa63('0x17')]);return _0xc170dd(_0xddfb8b[_0xaa63('0x15')][_0xaa63('0x17')]);}logger['error'](_0xaa63('0x12'),_0x2e0dcf,_0xddfb8b[_0xaa63('0x15')][_0xaa63('0x17')]);return _0x12de55(_0xddfb8b[_0xaa63('0x15')][_0xaa63('0x17')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x2e0dcf,_0xaa63('0x13'));_0x12de55(_0xddfb8b[_0xaa63('0x18')][_0xaa63('0x17')]);}})[_0xaa63('0x19')](function(_0x222d44){logger[_0xaa63('0x15')](_0xaa63('0x12'),_0x2e0dcf,_0x222d44);_0xc170dd(_0x222d44);});});}exports[_0xaa63('0x1a')]=function(_0x1d7691){var _0x560527=this;return new Promise(function(_0x2778d0,_0x4bb43e){return db[_0xaa63('0x1b')][_0xaa63('0x1c')]({'raw':_0x1d7691[_0xaa63('0x1d')]?_0x1d7691[_0xaa63('0x1d')][_0xaa63('0x1e')]===undefined?!![]:![]:!![],'where':_0x1d7691[_0xaa63('0x1d')]?_0x1d7691[_0xaa63('0x1d')][_0xaa63('0x1f')]||null:null,'attributes':_0x1d7691[_0xaa63('0x1d')]?_0x1d7691[_0xaa63('0x1d')]['attributes']||null:null,'limit':_0x1d7691[_0xaa63('0x1d')]?_0x1d7691[_0xaa63('0x1d')][_0xaa63('0x20')]||null:null,'include':_0x1d7691[_0xaa63('0x1d')]?_0x1d7691['options'][_0xaa63('0x21')]?_[_0xaa63('0x22')](_0x1d7691[_0xaa63('0x1d')][_0xaa63('0x21')],function(_0xf4abb4){return{'model':db[_0xf4abb4['model']],'as':_0xf4abb4['as'],'attributes':_0xf4abb4[_0xaa63('0x23')],'include':_0xf4abb4[_0xaa63('0x21')]?_[_0xaa63('0x22')](_0xf4abb4[_0xaa63('0x21')],function(_0x2dcaac){return{'model':db[_0x2dcaac[_0xaa63('0x24')]],'as':_0x2dcaac['as'],'attributes':_0x2dcaac['attributes'],'include':_0x2dcaac[_0xaa63('0x21')]?_[_0xaa63('0x22')](_0x2dcaac['include'],function(_0x134d17){return{'model':db[_0x134d17[_0xaa63('0x24')]],'as':_0x134d17['as'],'attributes':_0x134d17[_0xaa63('0x23')]};}):[]};}):[]};}):[]:[]})[_0xaa63('0x10')](function(_0xa3ff02){logger[_0xaa63('0x11')](_0xaa63('0x1a'),_0x1d7691);logger['debug'](_0xaa63('0x1a'),_0x1d7691,JSON['stringify'](_0xa3ff02));_0x2778d0(_0xa3ff02);})[_0xaa63('0x19')](function(_0x1ce261){logger[_0xaa63('0x15')]('GetChatQueue',_0x1ce261[_0xaa63('0x17')],_0x1d7691);_0x4bb43e(_0x560527[_0xaa63('0x15')](0x1f4,_0x1ce261[_0xaa63('0x17')]));});});};exports[_0xaa63('0x25')]=function(_0x1908ae){var _0x26d2a3=this;return new Promise(function(_0xa7bb44,_0x5497d8){return db['ChatQueue']['find']({'raw':_0x1908ae[_0xaa63('0x1d')]?_0x1908ae[_0xaa63('0x1d')][_0xaa63('0x1e')]===undefined?!![]:![]:!![],'where':_0x1908ae[_0xaa63('0x1d')]?_0x1908ae[_0xaa63('0x1d')][_0xaa63('0x1f')]||null:null,'attributes':_0x1908ae['options']?_0x1908ae['options'][_0xaa63('0x23')]||null:null,'include':_0x1908ae[_0xaa63('0x1d')]?_0x1908ae['options'][_0xaa63('0x21')]?_[_0xaa63('0x22')](_0x1908ae[_0xaa63('0x1d')][_0xaa63('0x21')],function(_0x1d7974){return{'model':db[_0x1d7974[_0xaa63('0x24')]],'as':_0x1d7974['as'],'attributes':_0x1d7974[_0xaa63('0x23')],'include':_0x1d7974['include']?_['map'](_0x1d7974[_0xaa63('0x21')],function(_0x4f4c3a){return{'model':db[_0x4f4c3a[_0xaa63('0x24')]],'as':_0x4f4c3a['as'],'attributes':_0x4f4c3a[_0xaa63('0x23')],'include':_0x4f4c3a[_0xaa63('0x21')]?_[_0xaa63('0x22')](_0x4f4c3a['include'],function(_0x260371){return{'model':db[_0x260371[_0xaa63('0x24')]],'as':_0x260371['as'],'attributes':_0x260371[_0xaa63('0x23')]};}):[]};}):[]};}):[]:[]})[_0xaa63('0x10')](function(_0x491a6b){logger[_0xaa63('0x11')](_0xaa63('0x25'),_0x1908ae);logger[_0xaa63('0x14')](_0xaa63('0x25'),_0x1908ae,JSON[_0xaa63('0x26')](_0x491a6b));_0xa7bb44(_0x491a6b);})[_0xaa63('0x19')](function(_0x3dece5){logger[_0xaa63('0x15')]('ShowChatQueue',_0x3dece5['message'],_0x1908ae);_0x5497d8(_0x26d2a3[_0xaa63('0x15')](0x1f4,_0x3dece5[_0xaa63('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 34d24d3..c0e9e3a 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 _0xb903=['update','emit','removeListener','register','chatQueue:','./chatQueue.events','save','remove'];(function(_0x51cc1d,_0xaa88ae){var _0x2eb9f2=function(_0x1ca525){while(--_0x1ca525){_0x51cc1d['push'](_0x51cc1d['shift']());}};_0x2eb9f2(++_0xaa88ae);}(_0xb903,0x185));var _0x3b90=function(_0xbefdda,_0xbef687){_0xbefdda=_0xbefdda-0x0;var _0x3fe607=_0xb903[_0xbefdda];return _0x3fe607;};'use strict';var ChatQueueEvents=require(_0x3b90('0x0'));var events=[_0x3b90('0x1'),_0x3b90('0x2'),_0x3b90('0x3')];function createListener(_0x5191d8,_0x3312ca){return function(_0xf414f4){_0x3312ca[_0x3b90('0x4')](_0x5191d8,_0xf414f4);};}function removeListener(_0x1cd5d8,_0x30d8db){return function(){ChatQueueEvents[_0x3b90('0x5')](_0x1cd5d8,_0x30d8db);};}exports[_0x3b90('0x6')]=function(_0x5acd76){for(var _0x15b68f=0x0,_0x5e845a=events['length'];_0x15b68f<_0x5e845a;_0x15b68f++){var _0x153283=events[_0x15b68f];var _0x2e4c06=createListener(_0x3b90('0x7')+_0x153283,_0x5acd76);ChatQueueEvents['on'](_0x153283,_0x2e4c06);}}; \ No newline at end of file +var _0x9c44=['emit','removeListener','length','chatQueue:','remove','update'];(function(_0x2d0f87,_0x23395a){var _0x47bea0=function(_0x55e3eb){while(--_0x55e3eb){_0x2d0f87['push'](_0x2d0f87['shift']());}};_0x47bea0(++_0x23395a);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=['save',_0x49c4('0x0'),_0x49c4('0x1')];function createListener(_0x26844b,_0x1ba0bb){return function(_0x455700){_0x1ba0bb[_0x49c4('0x2')](_0x26844b,_0x455700);};}function removeListener(_0x4e0313,_0x4941f1){return function(){ChatQueueEvents[_0x49c4('0x3')](_0x4e0313,_0x4941f1);};}exports['register']=function(_0xc1278f){for(var _0x6030ae=0x0,_0x69bc41=events[_0x49c4('0x4')];_0x6030ae<_0x69bc41;_0x6030ae++){var _0x436234=events[_0x6030ae];var _0x511d53=createListener(_0x49c4('0x5')+_0x436234,_0xc1278f);ChatQueueEvents['on'](_0x436234,_0x511d53);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 53e44ed..2ee2103 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 _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x4628bc,_0x211dcc){var _0x3b5fd9=function(_0x360870){while(--_0x360870){_0x4628bc['push'](_0x4628bc['shift']());}};_0x3b5fd9(++_0x211dcc);}(_0x814b,0x1a2));var _0xb814=function(_0x39f375,_0x3aa8ec){_0x39f375=_0x39f375-0x0;var _0x463f93=_0x814b[_0x39f375];return _0x463f93;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x52d59e,_0x3c546d){var _0x364739=function(_0x3cd5aa){while(--_0x3cd5aa){_0x52d59e['push'](_0x52d59e['shift']());}};_0x364739(++_0x3c546d);}(_0x814b,0x1a2));var _0xb814=function(_0x3a73bc,_0x550aef){_0x3a73bc=_0x3a73bc-0x0;var _0x32891b=_0x814b[_0x3a73bc];return _0x32891b;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 7e36097..cd5426c 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 _0x472c=['STRING','DATE','sequelize'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x472c,0x1a9));var _0xc472=function(_0x446aaa,_0x4db59a){_0x446aaa=_0x446aaa-0x0;var _0x4a5009=_0x472c[_0x446aaa];return _0x4a5009;};'use strict';var moment=require('moment');var Sequelize=require(_0xc472('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xc472('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc472('0x2')]},'leaveAt':{'type':Sequelize[_0xc472('0x2')]},'acceptAt':{'type':Sequelize[_0xc472('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xc472('0x1')]}}; \ No newline at end of file +var _0xdc6c=['exports','STRING','DATE','sequelize'];(function(_0x31a81b,_0x5649eb){var _0x13b57b=function(_0x1c7d33){while(--_0x1c7d33){_0x31a81b['push'](_0x31a81b['shift']());}};_0x13b57b(++_0x5649eb);}(_0xdc6c,0x157));var _0xcdc6=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0xdc6c[_0xf79bae];return _0x5d2cb7;};'use strict';var moment=require('moment');var Sequelize=require(_0xcdc6('0x0'));module[_0xcdc6('0x1')]={'uniqueid':{'type':Sequelize[_0xcdc6('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xcdc6('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xcdc6('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xcdc6('0x3')]},'reason':{'type':Sequelize[_0xcdc6('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index f15eb06..3cb22f6 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 _0x27eb=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','create','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x27eb,0xd0));var _0xb27e=function(_0x4c0b4b,_0x8ceef){_0x4c0b4b=_0x4c0b4b-0x0;var _0x5e56a3=_0x27eb[_0x4c0b4b];return _0x5e56a3;};'use strict';var emlformat=require(_0xb27e('0x0'));var rimraf=require(_0xb27e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb27e('0x2'));var moment=require(_0xb27e('0x3'));var BPromise=require(_0xb27e('0x4'));var Mustache=require('mustache');var util=require(_0xb27e('0x5'));var path=require(_0xb27e('0x6'));var sox=require(_0xb27e('0x7'));var csv=require(_0xb27e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb27e('0x9'));var _=require(_0xb27e('0xa'));var squel=require(_0xb27e('0xb'));var crypto=require(_0xb27e('0xc'));var jsforce=require(_0xb27e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb27e('0x8'));var querystring=require(_0xb27e('0xe'));var Papa=require(_0xb27e('0xf'));var Redis=require(_0xb27e('0x10'));var authService=require(_0xb27e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb27e('0x12'));var hardwareService=require(_0xb27e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb27e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb27e('0x15'));var db=require(_0xb27e('0x16'))['db'];function respondWithStatusCode(_0x4d0b5d,_0x58b37f){_0x58b37f=_0x58b37f||0xcc;return function(_0x48c914){if(_0x48c914){return _0x4d0b5d[_0xb27e('0x17')](_0x58b37f);}return _0x4d0b5d['status'](_0x58b37f)[_0xb27e('0x18')]();};}function respondWithResult(_0x54657b,_0x1b55e2){_0x1b55e2=_0x1b55e2||0xc8;return function(_0x5aa86f){if(_0x5aa86f){return _0x54657b[_0xb27e('0x19')](_0x1b55e2)[_0xb27e('0x1a')](_0x5aa86f);}};}function respondWithFilteredResult(_0x28cc6d,_0x522bbf){return function(_0x26ec32){if(_0x26ec32){var _0x1d14bb=typeof _0x522bbf[_0xb27e('0x1b')]===_0xb27e('0x1c')&&typeof _0x522bbf[_0xb27e('0x1d')]===_0xb27e('0x1c');var _0x25ce70=_0x26ec32[_0xb27e('0x1e')];var _0x317f4e=_0x1d14bb?0x0:_0x522bbf['offset'];var _0x8be243=_0x1d14bb?_0x26ec32[_0xb27e('0x1e')]:_0x522bbf[_0xb27e('0x1b')]+_0x522bbf['limit'];var _0x352856;if(_0x8be243>=_0x25ce70){_0x8be243=_0x25ce70;_0x352856=0xc8;}else{_0x352856=0xce;}_0x28cc6d['status'](_0x352856);return _0x28cc6d['set'](_0xb27e('0x1f'),_0x317f4e+'-'+_0x8be243+'/'+_0x25ce70)[_0xb27e('0x1a')](_0x26ec32);}return null;};}function patchUpdates(_0x4ec66c){return function(_0x2a78c0){try{jsonpatch[_0xb27e('0x20')](_0x2a78c0,_0x4ec66c,!![]);}catch(_0x16c950){return BPromise[_0xb27e('0x21')](_0x16c950);}return _0x2a78c0['save']();};}function saveUpdates(_0x3c9e21,_0x5a3cdf){return function(_0x19c0f2){if(_0x19c0f2){return _0x19c0f2[_0xb27e('0x22')](_0x3c9e21)['then'](function(_0x58fc84){return _0x58fc84;});}return null;};}function removeEntity(_0x2146c0,_0xfbc258){return function(_0x3703ab){if(_0x3703ab){return _0x3703ab[_0xb27e('0x23')]()[_0xb27e('0x24')](function(){_0x2146c0['status'](0xcc)[_0xb27e('0x18')]();});}};}function handleEntityNotFound(_0x4cba0b,_0x3972bc){return function(_0x1ac460){if(!_0x1ac460){_0x4cba0b[_0xb27e('0x17')](0x194);}return _0x1ac460;};}function handleError(_0x3fbc78,_0x3254fb){_0x3254fb=_0x3254fb||0x1f4;return function(_0x4dab95){logger[_0xb27e('0x25')](_0x4dab95['stack']);if(_0x4dab95[_0xb27e('0x26')]){delete _0x4dab95[_0xb27e('0x26')];}_0x3fbc78[_0xb27e('0x19')](_0x3254fb)[_0xb27e('0x27')](_0x4dab95);};}exports[_0xb27e('0x28')]=function(_0x35169a,_0xd27061){var _0x125c0b={},_0x42c5de={},_0x4ef0e6={'count':0x0,'rows':[]};var _0x377d79=_[_0xb27e('0x29')](db[_0xb27e('0x2a')][_0xb27e('0x2b')],function(_0x58a1a9){return{'name':_0x58a1a9[_0xb27e('0x2c')],'type':_0x58a1a9[_0xb27e('0x2d')][_0xb27e('0x2e')]};});_0x42c5de[_0xb27e('0x2f')]=_[_0xb27e('0x29')](_0x377d79,_0xb27e('0x26'));_0x42c5de[_0xb27e('0x30')]=_['keys'](_0x35169a['query']);_0x42c5de[_0xb27e('0x31')]=_['intersection'](_0x42c5de[_0xb27e('0x2f')],_0x42c5de['query']);_0x125c0b[_0xb27e('0x32')]=_[_0xb27e('0x33')](_0x42c5de[_0xb27e('0x2f')],qs[_0xb27e('0x34')](_0x35169a[_0xb27e('0x30')][_0xb27e('0x34')]));_0x125c0b['attributes']=_0x125c0b[_0xb27e('0x32')]['length']?_0x125c0b[_0xb27e('0x32')]:_0x42c5de['model'];if(!_0x35169a[_0xb27e('0x30')]['hasOwnProperty'](_0xb27e('0x35'))){_0x125c0b[_0xb27e('0x1d')]=qs['limit'](_0x35169a['query'][_0xb27e('0x1d')]);_0x125c0b['offset']=qs['offset'](_0x35169a['query'][_0xb27e('0x1b')]);}_0x125c0b[_0xb27e('0x36')]=qs['sort'](_0x35169a[_0xb27e('0x30')][_0xb27e('0x37')]);_0x125c0b['where']=qs['filters'](_[_0xb27e('0x38')](_0x35169a['query'],_0x42c5de[_0xb27e('0x31')]),_0x377d79);if(_0x35169a['query'][_0xb27e('0x39')]){_0x125c0b[_0xb27e('0x3a')]=_[_0xb27e('0x3b')](_0x125c0b[_0xb27e('0x3a')],{'$or':_[_0xb27e('0x29')](_0x377d79,function(_0x1239d4){if(_0x1239d4[_0xb27e('0x2d')]!==_0xb27e('0x3c')){var _0x533343={};_0x533343[_0x1239d4[_0xb27e('0x26')]]={'$like':'%'+_0x35169a[_0xb27e('0x30')][_0xb27e('0x39')]+'%'};return _0x533343;}})});}_0x125c0b=_[_0xb27e('0x3b')]({},_0x125c0b,_0x35169a[_0xb27e('0x3d')]);var _0x564699={'where':_0x125c0b['where']};return db[_0xb27e('0x2a')][_0xb27e('0x1e')](_0x564699)[_0xb27e('0x24')](function(_0x5c7742){_0x4ef0e6[_0xb27e('0x1e')]=_0x5c7742;if(_0x35169a[_0xb27e('0x30')][_0xb27e('0x3e')]){_0x125c0b[_0xb27e('0x3f')]=[{'all':!![]}];}return db[_0xb27e('0x2a')][_0xb27e('0x40')](_0x125c0b);})[_0xb27e('0x24')](function(_0x4d90bf){_0x4ef0e6['rows']=_0x4d90bf;return _0x4ef0e6;})[_0xb27e('0x24')](respondWithFilteredResult(_0xd27061,_0x125c0b))[_0xb27e('0x41')](handleError(_0xd27061,null));};exports[_0xb27e('0x42')]=function(_0x3272ba,_0x11fafd){var _0x42f5e3={'raw':!![],'where':{'id':_0x3272ba[_0xb27e('0x43')]['id']}},_0x2959f5={};_0x2959f5['model']=_[_0xb27e('0x44')](db[_0xb27e('0x2a')][_0xb27e('0x2b')]);_0x2959f5[_0xb27e('0x30')]=_['keys'](_0x3272ba[_0xb27e('0x30')]);_0x2959f5['filters']=_['intersection'](_0x2959f5[_0xb27e('0x2f')],_0x2959f5[_0xb27e('0x30')]);_0x42f5e3['attributes']=_[_0xb27e('0x33')](_0x2959f5[_0xb27e('0x2f')],qs[_0xb27e('0x34')](_0x3272ba[_0xb27e('0x30')][_0xb27e('0x34')]));_0x42f5e3[_0xb27e('0x32')]=_0x42f5e3[_0xb27e('0x32')]['length']?_0x42f5e3[_0xb27e('0x32')]:_0x2959f5['model'];if(_0x3272ba[_0xb27e('0x30')][_0xb27e('0x3e')]){_0x42f5e3[_0xb27e('0x3f')]=[{'all':!![]}];}_0x42f5e3=_[_0xb27e('0x3b')]({},_0x42f5e3,_0x3272ba[_0xb27e('0x3d')]);return db[_0xb27e('0x2a')]['find'](_0x42f5e3)['then'](handleEntityNotFound(_0x11fafd,null))[_0xb27e('0x24')](respondWithResult(_0x11fafd,null))[_0xb27e('0x41')](handleError(_0x11fafd,null));};exports[_0xb27e('0x45')]=function(_0x15b5cb,_0x238bb9){return db['ChatQueueReport'][_0xb27e('0x45')](_0x15b5cb[_0xb27e('0x46')],{})[_0xb27e('0x24')](respondWithResult(_0x238bb9,0xc9))[_0xb27e('0x41')](handleError(_0x238bb9,null));};exports[_0xb27e('0x22')]=function(_0x16a71b,_0x320b9c){if(_0x16a71b[_0xb27e('0x46')]['id']){delete _0x16a71b[_0xb27e('0x46')]['id'];}return db[_0xb27e('0x2a')][_0xb27e('0x47')]({'where':{'id':_0x16a71b['params']['id']}})[_0xb27e('0x24')](handleEntityNotFound(_0x320b9c,null))['then'](saveUpdates(_0x16a71b[_0xb27e('0x46')],null))[_0xb27e('0x24')](respondWithResult(_0x320b9c,null))[_0xb27e('0x41')](handleError(_0x320b9c,null));};exports[_0xb27e('0x23')]=function(_0x91095,_0x1af27d){return db[_0xb27e('0x2a')][_0xb27e('0x47')]({'where':{'id':_0x91095['params']['id']}})['then'](handleEntityNotFound(_0x1af27d,null))[_0xb27e('0x24')](removeEntity(_0x1af27d,null))[_0xb27e('0x41')](handleError(_0x1af27d,null));};exports[_0xb27e('0x48')]=function(_0x583293,_0x1c4846){return db['ChatQueueReport'][_0xb27e('0x48')]()[_0xb27e('0x24')](respondWithResult(_0x1c4846,null))[_0xb27e('0x41')](handleError(_0x1c4846,null));}; \ No newline at end of file +var _0x1c63=['merge','options','ChatQueueReport','findAll','rows','keys','includeAll','include','find','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','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','undefined','count','offset','set','Content-Range','reject','update','then','destroy','map','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter'];(function(_0x55415b,_0x5349ab){var _0x231dc9=function(_0x4a4d3b){while(--_0x4a4d3b){_0x55415b['push'](_0x55415b['shift']());}};_0x231dc9(++_0x5349ab);}(_0x1c63,0xdc));var _0x31c6=function(_0x4f0c2b,_0x2c9d14){_0x4f0c2b=_0x4f0c2b-0x0;var _0x526436=_0x1c63[_0x4f0c2b];return _0x526436;};'use strict';var emlformat=require(_0x31c6('0x0'));var rimraf=require(_0x31c6('0x1'));var zipdir=require(_0x31c6('0x2'));var jsonpatch=require(_0x31c6('0x3'));var rp=require('request-promise');var moment=require(_0x31c6('0x4'));var BPromise=require(_0x31c6('0x5'));var Mustache=require(_0x31c6('0x6'));var util=require('util');var path=require(_0x31c6('0x7'));var sox=require(_0x31c6('0x8'));var csv=require(_0x31c6('0x9'));var ejs=require(_0x31c6('0xa'));var fs=require('fs');var fs_extra=require(_0x31c6('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x31c6('0xc'));var jsforce=require(_0x31c6('0xd'));var deskjs=require(_0x31c6('0xe'));var toCsv=require(_0x31c6('0x9'));var querystring=require(_0x31c6('0xf'));var Papa=require('papaparse');var Redis=require(_0x31c6('0x10'));var authService=require(_0x31c6('0x11'));var qs=require(_0x31c6('0x12'));var as=require(_0x31c6('0x13'));var hardwareService=require(_0x31c6('0x14'));var logger=require('../../config/logger')(_0x31c6('0x15'));var utils=require('../../config/utils');var config=require(_0x31c6('0x16'));var licenseUtil=require(_0x31c6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53c23d,_0x3424f0){_0x3424f0=_0x3424f0||0xcc;return function(_0x12f99c){if(_0x12f99c){return _0x53c23d[_0x31c6('0x18')](_0x3424f0);}return _0x53c23d[_0x31c6('0x19')](_0x3424f0)[_0x31c6('0x1a')]();};}function respondWithResult(_0x4d1710,_0x11e6a4){_0x11e6a4=_0x11e6a4||0xc8;return function(_0x3995cc){if(_0x3995cc){return _0x4d1710[_0x31c6('0x19')](_0x11e6a4)[_0x31c6('0x1b')](_0x3995cc);}};}function respondWithFilteredResult(_0x7a8c46,_0x5f1d49){return function(_0x5f2c85){if(_0x5f2c85){var _0x497264=typeof _0x5f1d49['offset']===_0x31c6('0x1c')&&typeof _0x5f1d49['limit']===_0x31c6('0x1c');var _0x2a4780=_0x5f2c85[_0x31c6('0x1d')];var _0xf352af=_0x497264?0x0:_0x5f1d49[_0x31c6('0x1e')];var _0x4c7f34=_0x497264?_0x5f2c85[_0x31c6('0x1d')]:_0x5f1d49[_0x31c6('0x1e')]+_0x5f1d49['limit'];var _0x593d2b;if(_0x4c7f34>=_0x2a4780){_0x4c7f34=_0x2a4780;_0x593d2b=0xc8;}else{_0x593d2b=0xce;}_0x7a8c46['status'](_0x593d2b);return _0x7a8c46[_0x31c6('0x1f')](_0x31c6('0x20'),_0xf352af+'-'+_0x4c7f34+'/'+_0x2a4780)[_0x31c6('0x1b')](_0x5f2c85);}return null;};}function patchUpdates(_0x24602f){return function(_0x4f17e5){try{jsonpatch['apply'](_0x4f17e5,_0x24602f,!![]);}catch(_0x4070f6){return BPromise[_0x31c6('0x21')](_0x4070f6);}return _0x4f17e5['save']();};}function saveUpdates(_0x339588,_0x1c6fda){return function(_0x392723){if(_0x392723){return _0x392723[_0x31c6('0x22')](_0x339588)[_0x31c6('0x23')](function(_0x509bed){return _0x509bed;});}return null;};}function removeEntity(_0x287c59,_0x536e57){return function(_0x8773d4){if(_0x8773d4){return _0x8773d4[_0x31c6('0x24')]()['then'](function(){_0x287c59['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x412a8a,_0x250ab1){return function(_0x551291){if(!_0x551291){_0x412a8a[_0x31c6('0x18')](0x194);}return _0x551291;};}function handleError(_0x44bf50,_0x2c9d78){_0x2c9d78=_0x2c9d78||0x1f4;return function(_0x2fb5f3){logger['error'](_0x2fb5f3['stack']);if(_0x2fb5f3['name']){delete _0x2fb5f3['name'];}_0x44bf50[_0x31c6('0x19')](_0x2c9d78)['send'](_0x2fb5f3);};}exports['index']=function(_0x1e24fa,_0x2034cc){var _0x5e3ed0={},_0x41100c={},_0x47a0cd={'count':0x0,'rows':[]};var _0x1d5ab5=_[_0x31c6('0x25')](db['ChatQueueReport'][_0x31c6('0x26')],function(_0x3840de){return{'name':_0x3840de[_0x31c6('0x27')],'type':_0x3840de[_0x31c6('0x28')][_0x31c6('0x29')]};});_0x41100c[_0x31c6('0x2a')]=_['map'](_0x1d5ab5,_0x31c6('0x2b'));_0x41100c[_0x31c6('0x2c')]=_['keys'](_0x1e24fa[_0x31c6('0x2c')]);_0x41100c[_0x31c6('0x2d')]=_['intersection'](_0x41100c['model'],_0x41100c['query']);_0x5e3ed0[_0x31c6('0x2e')]=_[_0x31c6('0x2f')](_0x41100c['model'],qs[_0x31c6('0x30')](_0x1e24fa[_0x31c6('0x2c')][_0x31c6('0x30')]));_0x5e3ed0[_0x31c6('0x2e')]=_0x5e3ed0[_0x31c6('0x2e')]['length']?_0x5e3ed0[_0x31c6('0x2e')]:_0x41100c[_0x31c6('0x2a')];if(!_0x1e24fa[_0x31c6('0x2c')][_0x31c6('0x31')](_0x31c6('0x32'))){_0x5e3ed0[_0x31c6('0x33')]=qs[_0x31c6('0x33')](_0x1e24fa[_0x31c6('0x2c')][_0x31c6('0x33')]);_0x5e3ed0['offset']=qs[_0x31c6('0x1e')](_0x1e24fa[_0x31c6('0x2c')]['offset']);}_0x5e3ed0[_0x31c6('0x34')]=qs[_0x31c6('0x35')](_0x1e24fa['query'][_0x31c6('0x35')]);_0x5e3ed0[_0x31c6('0x36')]=qs[_0x31c6('0x2d')](_['pick'](_0x1e24fa[_0x31c6('0x2c')],_0x41100c['filters']),_0x1d5ab5);if(_0x1e24fa[_0x31c6('0x2c')][_0x31c6('0x37')]){_0x5e3ed0[_0x31c6('0x36')]=_['merge'](_0x5e3ed0[_0x31c6('0x36')],{'$or':_[_0x31c6('0x25')](_0x1d5ab5,function(_0xdf5348){if(_0xdf5348[_0x31c6('0x28')]!=='VIRTUAL'){var _0x506491={};_0x506491[_0xdf5348[_0x31c6('0x2b')]]={'$like':'%'+_0x1e24fa[_0x31c6('0x2c')][_0x31c6('0x37')]+'%'};return _0x506491;}})});}_0x5e3ed0=_[_0x31c6('0x38')]({},_0x5e3ed0,_0x1e24fa[_0x31c6('0x39')]);var _0xeed7d7={'where':_0x5e3ed0[_0x31c6('0x36')]};return db[_0x31c6('0x3a')][_0x31c6('0x1d')](_0xeed7d7)[_0x31c6('0x23')](function(_0x4dba99){_0x47a0cd[_0x31c6('0x1d')]=_0x4dba99;if(_0x1e24fa[_0x31c6('0x2c')]['includeAll']){_0x5e3ed0['include']=[{'all':!![]}];}return db[_0x31c6('0x3a')][_0x31c6('0x3b')](_0x5e3ed0);})[_0x31c6('0x23')](function(_0xd85393){_0x47a0cd[_0x31c6('0x3c')]=_0xd85393;return _0x47a0cd;})[_0x31c6('0x23')](respondWithFilteredResult(_0x2034cc,_0x5e3ed0))['catch'](handleError(_0x2034cc,null));};exports['show']=function(_0x31c919,_0x5195b0){var _0x2c2129={'raw':!![],'where':{'id':_0x31c919['params']['id']}},_0x1f0b73={};_0x1f0b73[_0x31c6('0x2a')]=_[_0x31c6('0x3d')](db[_0x31c6('0x3a')][_0x31c6('0x26')]);_0x1f0b73[_0x31c6('0x2c')]=_[_0x31c6('0x3d')](_0x31c919['query']);_0x1f0b73[_0x31c6('0x2d')]=_[_0x31c6('0x2f')](_0x1f0b73[_0x31c6('0x2a')],_0x1f0b73[_0x31c6('0x2c')]);_0x2c2129[_0x31c6('0x2e')]=_['intersection'](_0x1f0b73[_0x31c6('0x2a')],qs[_0x31c6('0x30')](_0x31c919[_0x31c6('0x2c')][_0x31c6('0x30')]));_0x2c2129['attributes']=_0x2c2129[_0x31c6('0x2e')]['length']?_0x2c2129[_0x31c6('0x2e')]:_0x1f0b73[_0x31c6('0x2a')];if(_0x31c919[_0x31c6('0x2c')][_0x31c6('0x3e')]){_0x2c2129[_0x31c6('0x3f')]=[{'all':!![]}];}_0x2c2129=_['merge']({},_0x2c2129,_0x31c919[_0x31c6('0x39')]);return db[_0x31c6('0x3a')][_0x31c6('0x40')](_0x2c2129)[_0x31c6('0x23')](handleEntityNotFound(_0x5195b0,null))[_0x31c6('0x23')](respondWithResult(_0x5195b0,null))[_0x31c6('0x41')](handleError(_0x5195b0,null));};exports['create']=function(_0x36fc66,_0x52d06d){return db[_0x31c6('0x3a')]['create'](_0x36fc66['body'],{})[_0x31c6('0x23')](respondWithResult(_0x52d06d,0xc9))[_0x31c6('0x41')](handleError(_0x52d06d,null));};exports['update']=function(_0xf33b6c,_0x129197){if(_0xf33b6c[_0x31c6('0x42')]['id']){delete _0xf33b6c['body']['id'];}return db['ChatQueueReport'][_0x31c6('0x40')]({'where':{'id':_0xf33b6c[_0x31c6('0x43')]['id']}})[_0x31c6('0x23')](handleEntityNotFound(_0x129197,null))[_0x31c6('0x23')](saveUpdates(_0xf33b6c[_0x31c6('0x42')],null))[_0x31c6('0x23')](respondWithResult(_0x129197,null))[_0x31c6('0x41')](handleError(_0x129197,null));};exports[_0x31c6('0x24')]=function(_0x21ead7,_0x10f5b1){return db[_0x31c6('0x3a')][_0x31c6('0x40')]({'where':{'id':_0x21ead7['params']['id']}})['then'](handleEntityNotFound(_0x10f5b1,null))['then'](removeEntity(_0x10f5b1,null))[_0x31c6('0x41')](handleError(_0x10f5b1,null));};exports[_0x31c6('0x44')]=function(_0x1b0999,_0x433a63){return db[_0x31c6('0x3a')][_0x31c6('0x44')]()[_0x31c6('0x23')](respondWithResult(_0x433a63,null))['catch'](handleError(_0x433a63,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 2776eb7..b23d3f0 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x47bc58,_0x1e1998){var _0x4a0860=function(_0x2a5b23){while(--_0x2a5b23){_0x47bc58['push'](_0x47bc58['shift']());}};_0x4a0860(++_0x1e1998);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x47f79b,_0x7ec50e){var _0x105e91=function(_0x35eb7b){while(--_0x35eb7b){_0x47f79b['push'](_0x47f79b['shift']());}};_0x105e91(++_0x7ec50e);}(_0x757a,0xde));var _0xa757=function(_0x4752da,_0x16f8e5){_0x4752da=_0x4752da-0x0;var _0x45099f=_0x757a[_0x4752da];return _0x45099f;};'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 9e91023..68d893a 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 _0x6d73=['raw','stringify','update','where','attributes','UpdateChatQueueReport','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','body','options'];(function(_0x174d4d,_0x2c3337){var _0x5f0635=function(_0x33be5a){while(--_0x33be5a){_0x174d4d['push'](_0x174d4d['shift']());}};_0x5f0635(++_0x2c3337);}(_0x6d73,0x132));var _0x36d7=function(_0x2536ee,_0x38153b){_0x2536ee=_0x2536ee-0x0;var _0x318b70=_0x6d73[_0x2536ee];return _0x318b70;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x36d7('0x0'));var BPromise=require(_0x36d7('0x1'));var rs=require(_0x36d7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x36d7('0x3'))['db'];var utils=require(_0x36d7('0x4'));var logger=require(_0x36d7('0x5'))('rpc');var config=require(_0x36d7('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x36d7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x583a46,_0x5b7cb2,_0x1052c8){return new BPromise(function(_0x4954fe,_0x3e80ae){return client[_0x36d7('0x8')](_0x583a46,_0x1052c8)[_0x36d7('0x9')](function(_0x5d1d01){logger[_0x36d7('0xa')](_0x36d7('0xb'),_0x5b7cb2,_0x36d7('0xc'));logger[_0x36d7('0xd')](_0x36d7('0xe'),_0x5b7cb2,_0x36d7('0xc'),JSON['stringify'](_0x5d1d01));if(_0x5d1d01[_0x36d7('0xf')]){if(_0x5d1d01[_0x36d7('0xf')][_0x36d7('0x10')]===0x1f4){logger[_0x36d7('0xf')](_0x36d7('0xb'),_0x5b7cb2,_0x5d1d01['error'][_0x36d7('0x11')]);return _0x3e80ae(_0x5d1d01['error']['message']);}logger[_0x36d7('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x5b7cb2,_0x5d1d01[_0x36d7('0xf')][_0x36d7('0x11')]);return _0x4954fe(_0x5d1d01['error'][_0x36d7('0x11')]);}else{logger[_0x36d7('0xa')](_0x36d7('0xb'),_0x5b7cb2,_0x36d7('0xc'));_0x4954fe(_0x5d1d01[_0x36d7('0x12')][_0x36d7('0x11')]);}})[_0x36d7('0x13')](function(_0x22e606){logger[_0x36d7('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x5b7cb2,_0x22e606);_0x3e80ae(_0x22e606);});});}exports[_0x36d7('0x14')]=function(_0x1562d8){var _0x2b55fb=this;return new Promise(function(_0x49b9bc,_0x5d5d80){return db[_0x36d7('0x15')]['create'](_0x1562d8[_0x36d7('0x16')],{'raw':_0x1562d8[_0x36d7('0x17')]?_0x1562d8[_0x36d7('0x17')][_0x36d7('0x18')]===undefined?!![]:![]:!![]})[_0x36d7('0x9')](function(_0x38a4c4){logger['info'](_0x36d7('0x14'),_0x1562d8);logger[_0x36d7('0xd')](_0x36d7('0x14'),_0x1562d8,JSON[_0x36d7('0x19')](_0x38a4c4));_0x49b9bc(_0x38a4c4);})['catch'](function(_0x46764f){logger[_0x36d7('0xf')](_0x36d7('0x14'),_0x46764f[_0x36d7('0x11')],_0x1562d8);_0x5d5d80(_0x2b55fb[_0x36d7('0xf')](0x1f4,_0x46764f['message']));});});};exports['UpdateChatQueueReport']=function(_0x375c30){var _0x17c045=this;return new Promise(function(_0x3ab567,_0x10e020){return db[_0x36d7('0x15')][_0x36d7('0x1a')](_0x375c30[_0x36d7('0x16')],{'raw':_0x375c30[_0x36d7('0x17')]?_0x375c30['options'][_0x36d7('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x375c30[_0x36d7('0x17')]?_0x375c30[_0x36d7('0x17')][_0x36d7('0x1b')]||null:null,'attributes':_0x375c30[_0x36d7('0x17')]?_0x375c30['options'][_0x36d7('0x1c')]||null:null,'limit':_0x375c30[_0x36d7('0x17')]?_0x375c30[_0x36d7('0x17')]['limit']||null:null})['then'](function(_0x153501){logger[_0x36d7('0xa')]('UpdateChatQueueReport',_0x375c30);logger[_0x36d7('0xd')](_0x36d7('0x1d'),_0x375c30,JSON['stringify'](_0x153501));_0x3ab567(_0x153501);})[_0x36d7('0x13')](function(_0x55daa7){logger['error']('UpdateChatQueueReport',_0x55daa7[_0x36d7('0x11')],_0x375c30);_0x10e020(_0x17c045[_0x36d7('0xf')](0x1f4,_0x55daa7[_0x36d7('0x11')]));});});}; \ No newline at end of file +var _0x89d9=['error','code','message','catch','CreateChatQueueReport','ChatQueueReport','create','body','raw','UpdateChatQueueReport','options','attributes','stringify','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14a6cb,_0x541724){var _0xcb4b15=function(_0x7c169){while(--_0x7c169){_0x14a6cb['push'](_0x14a6cb['shift']());}};_0xcb4b15(++_0x541724);}(_0x89d9,0x1c0));var _0x989d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x89d9[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x989d('0x0'));var util=require(_0x989d('0x1'));var moment=require('moment');var BPromise=require(_0x989d('0x2'));var rs=require(_0x989d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x989d('0x4'));var logger=require(_0x989d('0x5'))(_0x989d('0x6'));var config=require(_0x989d('0x7'));var jayson=require(_0x989d('0x8'));var client=jayson[_0x989d('0x9')][_0x989d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x70ccd4,_0xa17c24,_0x21e60f){return new BPromise(function(_0x2e1327,_0x400580){return client['request'](_0x70ccd4,_0x21e60f)[_0x989d('0xb')](function(_0x3eef17){logger[_0x989d('0xc')](_0x989d('0xd'),_0xa17c24,_0x989d('0xe'));logger[_0x989d('0xf')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0xa17c24,_0x989d('0xe'),JSON['stringify'](_0x3eef17));if(_0x3eef17['error']){if(_0x3eef17[_0x989d('0x10')][_0x989d('0x11')]===0x1f4){logger[_0x989d('0x10')](_0x989d('0xd'),_0xa17c24,_0x3eef17[_0x989d('0x10')][_0x989d('0x12')]);return _0x400580(_0x3eef17['error'][_0x989d('0x12')]);}logger[_0x989d('0x10')](_0x989d('0xd'),_0xa17c24,_0x3eef17[_0x989d('0x10')][_0x989d('0x12')]);return _0x2e1327(_0x3eef17[_0x989d('0x10')][_0x989d('0x12')]);}else{logger['info'](_0x989d('0xd'),_0xa17c24,_0x989d('0xe'));_0x2e1327(_0x3eef17['result']['message']);}})[_0x989d('0x13')](function(_0xb71b5d){logger['error'](_0x989d('0xd'),_0xa17c24,_0xb71b5d);_0x400580(_0xb71b5d);});});}exports[_0x989d('0x14')]=function(_0x46ee00){var _0x552205=this;return new Promise(function(_0xbc698a,_0x3ef7aa){return db[_0x989d('0x15')][_0x989d('0x16')](_0x46ee00[_0x989d('0x17')],{'raw':_0x46ee00['options']?_0x46ee00['options'][_0x989d('0x18')]===undefined?!![]:![]:!![]})[_0x989d('0xb')](function(_0x5c0fcd){logger[_0x989d('0xc')](_0x989d('0x14'),_0x46ee00);logger[_0x989d('0xf')](_0x989d('0x14'),_0x46ee00,JSON['stringify'](_0x5c0fcd));_0xbc698a(_0x5c0fcd);})[_0x989d('0x13')](function(_0x355822){logger['error'](_0x989d('0x14'),_0x355822['message'],_0x46ee00);_0x3ef7aa(_0x552205['error'](0x1f4,_0x355822[_0x989d('0x12')]));});});};exports[_0x989d('0x19')]=function(_0x4c67f8){var _0x22f28e=this;return new Promise(function(_0x23da76,_0x5218ab){return db[_0x989d('0x15')]['update'](_0x4c67f8[_0x989d('0x17')],{'raw':_0x4c67f8['options']?_0x4c67f8[_0x989d('0x1a')][_0x989d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c67f8[_0x989d('0x1a')]?_0x4c67f8[_0x989d('0x1a')]['where']||null:null,'attributes':_0x4c67f8[_0x989d('0x1a')]?_0x4c67f8[_0x989d('0x1a')][_0x989d('0x1b')]||null:null,'limit':_0x4c67f8['options']?_0x4c67f8['options']['limit']||null:null})[_0x989d('0xb')](function(_0x4647f){logger['info'](_0x989d('0x19'),_0x4c67f8);logger[_0x989d('0xf')](_0x989d('0x19'),_0x4c67f8,JSON[_0x989d('0x1c')](_0x4647f));_0x23da76(_0x4647f);})['catch'](function(_0x52e605){logger[_0x989d('0x10')](_0x989d('0x19'),_0x52e605[_0x989d('0x12')],_0x4c67f8);_0x5218ab(_0x22f28e[_0x989d('0x10')](0x1f4,_0x52e605[_0x989d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 3e5dc06..f870a52 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 _0x8ea5=['../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','exports','connect-timeout','Router','../../components/auth/service'];(function(_0x4ea599,_0x489c25){var _0x563cb8=function(_0x117757){while(--_0x117757){_0x4ea599['push'](_0x4ea599['shift']());}};_0x563cb8(++_0x489c25);}(_0x8ea5,0xe7));var _0x58ea=function(_0x5e3aa6,_0x14eb73){_0x5e3aa6=_0x5e3aa6-0x0;var _0x57f589=_0x8ea5[_0x5e3aa6];return _0x57f589;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x58ea('0x0'));var express=require('express');var router=express[_0x58ea('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x58ea('0x2'));var interaction=require(_0x58ea('0x3'));var config=require(_0x58ea('0x4'));var controller=require(_0x58ea('0x5'));router[_0x58ea('0x6')]('/',auth[_0x58ea('0x7')](),controller[_0x58ea('0x8')]);router[_0x58ea('0x6')](_0x58ea('0x9'),auth[_0x58ea('0x7')](),controller[_0x58ea('0xa')]);router[_0x58ea('0x6')](_0x58ea('0xb'),auth['isAuthenticated'](),controller[_0x58ea('0xc')]);router[_0x58ea('0xd')]('/',auth[_0x58ea('0x7')](),controller['create']);router['put'](_0x58ea('0xb'),auth['isAuthenticated'](),controller[_0x58ea('0xe')]);router[_0x58ea('0xf')](_0x58ea('0xb'),auth[_0x58ea('0x7')](),controller[_0x58ea('0x10')]);module[_0x58ea('0x11')]=router; \ No newline at end of file +var _0x8919=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','update','delete','destroy'];(function(_0x15ee80,_0x317bc4){var _0x4809ed=function(_0x1a6516){while(--_0x1a6516){_0x15ee80['push'](_0x15ee80['shift']());}};_0x4809ed(++_0x317bc4);}(_0x8919,0x10b));var _0x9891=function(_0xca4cf,_0x27f020){_0xca4cf=_0xca4cf-0x0;var _0x1152ac=_0x8919[_0xca4cf];return _0x1152ac;};'use strict';var multer=require(_0x9891('0x0'));var util=require(_0x9891('0x1'));var path=require(_0x9891('0x2'));var timeout=require(_0x9891('0x3'));var express=require(_0x9891('0x4'));var router=express[_0x9891('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9891('0x6'));var config=require('../../config/environment');var controller=require(_0x9891('0x7'));router[_0x9891('0x8')]('/',auth[_0x9891('0x9')](),controller['index']);router[_0x9891('0x8')](_0x9891('0xa'),auth[_0x9891('0x9')](),controller[_0x9891('0xb')]);router[_0x9891('0x8')](_0x9891('0xc'),auth[_0x9891('0x9')](),controller[_0x9891('0xd')]);router[_0x9891('0xe')]('/',auth[_0x9891('0x9')](),controller['create']);router['put'](_0x9891('0xc'),auth[_0x9891('0x9')](),controller[_0x9891('0xf')]);router[_0x9891('0x10')]('/:id',auth[_0x9891('0x9')](),controller[_0x9891('0x11')]);module[_0x9891('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 51547c7..649ec6f 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x1df9c4,_0x31ed6d){var _0x54a9fe=function(_0x540de8){while(--_0x540de8){_0x1df9c4['push'](_0x1df9c4['shift']());}};_0x54a9fe(++_0x31ed6d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x493a51,_0x45128c){var _0xc85756=function(_0x2c39a8){while(--_0x2c39a8){_0x493a51['push'](_0x493a51['shift']());}};_0xc85756(++_0x45128c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x562a00,_0x30239f){_0x562a00=_0x562a00-0x0;var _0x529272=_0x9bde[_0x562a00];return _0x529272;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 5c0ba12..476357f 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 _0x13d6=['status','end','json','undefined','limit','count','offset','reject','save','then','destroy','error','name','index','map','ChatTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','VIRTUAL','filter','merge','includeAll','include','rows','catch','show','params','rawAttributes','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x17ef11,_0x41e000){var _0x2e5fee=function(_0x3adcbe){while(--_0x3adcbe){_0x17ef11['push'](_0x17ef11['shift']());}};_0x2e5fee(++_0x41e000);}(_0x13d6,0x196));var _0x613d=function(_0x21b359,_0x4dc80e){_0x21b359=_0x21b359-0x0;var _0x57b8e7=_0x13d6[_0x21b359];return _0x57b8e7;};'use strict';var emlformat=require(_0x613d('0x0'));var rimraf=require(_0x613d('0x1'));var zipdir=require(_0x613d('0x2'));var jsonpatch=require(_0x613d('0x3'));var rp=require(_0x613d('0x4'));var moment=require(_0x613d('0x5'));var BPromise=require(_0x613d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x613d('0x7'));var sox=require(_0x613d('0x8'));var csv=require(_0x613d('0x9'));var ejs=require(_0x613d('0xa'));var fs=require('fs');var fs_extra=require(_0x613d('0xb'));var _=require(_0x613d('0xc'));var squel=require(_0x613d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x613d('0xe'));var toCsv=require(_0x613d('0x9'));var querystring=require(_0x613d('0xf'));var Papa=require(_0x613d('0x10'));var Redis=require('ioredis');var authService=require(_0x613d('0x11'));var qs=require(_0x613d('0x12'));var as=require(_0x613d('0x13'));var hardwareService=require(_0x613d('0x14'));var logger=require('../../config/logger')(_0x613d('0x15'));var utils=require(_0x613d('0x16'));var config=require(_0x613d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x613d('0x18'))['db'];function respondWithStatusCode(_0x44d823,_0x3f6008){_0x3f6008=_0x3f6008||0xcc;return function(_0x5887fa){if(_0x5887fa){return _0x44d823[_0x613d('0x19')](_0x3f6008);}return _0x44d823[_0x613d('0x1a')](_0x3f6008)[_0x613d('0x1b')]();};}function respondWithResult(_0x15b989,_0x28dc5d){_0x28dc5d=_0x28dc5d||0xc8;return function(_0x566583){if(_0x566583){return _0x15b989[_0x613d('0x1a')](_0x28dc5d)[_0x613d('0x1c')](_0x566583);}};}function respondWithFilteredResult(_0x532465,_0x2f2683){return function(_0x404d4c){if(_0x404d4c){var _0x5bb993=typeof _0x2f2683['offset']===_0x613d('0x1d')&&typeof _0x2f2683[_0x613d('0x1e')]===_0x613d('0x1d');var _0x3571b7=_0x404d4c[_0x613d('0x1f')];var _0x3a4c6e=_0x5bb993?0x0:_0x2f2683[_0x613d('0x20')];var _0x4017a8=_0x5bb993?_0x404d4c[_0x613d('0x1f')]:_0x2f2683['offset']+_0x2f2683['limit'];var _0x16d5d2;if(_0x4017a8>=_0x3571b7){_0x4017a8=_0x3571b7;_0x16d5d2=0xc8;}else{_0x16d5d2=0xce;}_0x532465[_0x613d('0x1a')](_0x16d5d2);return _0x532465['set']('Content-Range',_0x3a4c6e+'-'+_0x4017a8+'/'+_0x3571b7)['json'](_0x404d4c);}return null;};}function patchUpdates(_0x34191e){return function(_0xf2fecc){try{jsonpatch['apply'](_0xf2fecc,_0x34191e,!![]);}catch(_0x1f67e4){return BPromise[_0x613d('0x21')](_0x1f67e4);}return _0xf2fecc[_0x613d('0x22')]();};}function saveUpdates(_0x3c44cb,_0x1cf186){return function(_0x37fd5a){if(_0x37fd5a){return _0x37fd5a['update'](_0x3c44cb)[_0x613d('0x23')](function(_0x8cc199){return _0x8cc199;});}return null;};}function removeEntity(_0x51b8a8,_0x1c85a9){return function(_0x199a0f){if(_0x199a0f){return _0x199a0f[_0x613d('0x24')]()['then'](function(){_0x51b8a8['status'](0xcc)[_0x613d('0x1b')]();});}};}function handleEntityNotFound(_0x5d6b80,_0x436de4){return function(_0x4dd122){if(!_0x4dd122){_0x5d6b80[_0x613d('0x19')](0x194);}return _0x4dd122;};}function handleError(_0x585ddc,_0x41d3cf){_0x41d3cf=_0x41d3cf||0x1f4;return function(_0x35faf5){logger[_0x613d('0x25')](_0x35faf5['stack']);if(_0x35faf5['name']){delete _0x35faf5[_0x613d('0x26')];}_0x585ddc[_0x613d('0x1a')](_0x41d3cf)['send'](_0x35faf5);};}exports[_0x613d('0x27')]=function(_0xc06fad,_0x3fb0fd){var _0x5ccac3={},_0x204212={},_0x35b1dc={'count':0x0,'rows':[]};var _0x422fc2=_[_0x613d('0x28')](db[_0x613d('0x29')]['rawAttributes'],function(_0x5c0b88){return{'name':_0x5c0b88[_0x613d('0x2a')],'type':_0x5c0b88[_0x613d('0x2b')][_0x613d('0x2c')]};});_0x204212[_0x613d('0x2d')]=_[_0x613d('0x28')](_0x422fc2,_0x613d('0x26'));_0x204212[_0x613d('0x2e')]=_[_0x613d('0x2f')](_0xc06fad[_0x613d('0x2e')]);_0x204212[_0x613d('0x30')]=_[_0x613d('0x31')](_0x204212[_0x613d('0x2d')],_0x204212[_0x613d('0x2e')]);_0x5ccac3[_0x613d('0x32')]=_[_0x613d('0x31')](_0x204212['model'],qs[_0x613d('0x33')](_0xc06fad['query'][_0x613d('0x33')]));_0x5ccac3[_0x613d('0x32')]=_0x5ccac3['attributes'][_0x613d('0x34')]?_0x5ccac3[_0x613d('0x32')]:_0x204212[_0x613d('0x2d')];if(!_0xc06fad[_0x613d('0x2e')]['hasOwnProperty'](_0x613d('0x35'))){_0x5ccac3[_0x613d('0x1e')]=qs[_0x613d('0x1e')](_0xc06fad[_0x613d('0x2e')][_0x613d('0x1e')]);_0x5ccac3[_0x613d('0x20')]=qs['offset'](_0xc06fad['query'][_0x613d('0x20')]);}_0x5ccac3[_0x613d('0x36')]=qs[_0x613d('0x37')](_0xc06fad['query'][_0x613d('0x37')]);_0x5ccac3['where']=qs[_0x613d('0x30')](_['pick'](_0xc06fad['query'],_0x204212[_0x613d('0x30')]),_0x422fc2);if(_0xc06fad['query']['filter']){_0x5ccac3[_0x613d('0x38')]=_['merge'](_0x5ccac3[_0x613d('0x38')],{'$or':_[_0x613d('0x28')](_0x422fc2,function(_0x1579df){if(_0x1579df[_0x613d('0x2b')]!==_0x613d('0x39')){var _0x402a55={};_0x402a55[_0x1579df['name']]={'$like':'%'+_0xc06fad[_0x613d('0x2e')][_0x613d('0x3a')]+'%'};return _0x402a55;}})});}_0x5ccac3=_[_0x613d('0x3b')]({},_0x5ccac3,_0xc06fad['options']);var _0x12b315={'where':_0x5ccac3[_0x613d('0x38')]};return db[_0x613d('0x29')]['count'](_0x12b315)[_0x613d('0x23')](function(_0x5af1c0){_0x35b1dc['count']=_0x5af1c0;if(_0xc06fad['query'][_0x613d('0x3c')]){_0x5ccac3[_0x613d('0x3d')]=[{'all':!![]}];}return db[_0x613d('0x29')]['findAll'](_0x5ccac3);})[_0x613d('0x23')](function(_0x3d8fc4){_0x35b1dc[_0x613d('0x3e')]=_0x3d8fc4;return _0x35b1dc;})[_0x613d('0x23')](respondWithFilteredResult(_0x3fb0fd,_0x5ccac3))[_0x613d('0x3f')](handleError(_0x3fb0fd,null));};exports[_0x613d('0x40')]=function(_0x569720,_0x143758){var _0x5e9e26={'raw':!![],'where':{'id':_0x569720[_0x613d('0x41')]['id']}},_0x142fcf={};_0x142fcf[_0x613d('0x2d')]=_[_0x613d('0x2f')](db[_0x613d('0x29')][_0x613d('0x42')]);_0x142fcf[_0x613d('0x2e')]=_['keys'](_0x569720[_0x613d('0x2e')]);_0x142fcf[_0x613d('0x30')]=_['intersection'](_0x142fcf[_0x613d('0x2d')],_0x142fcf[_0x613d('0x2e')]);_0x5e9e26['attributes']=_[_0x613d('0x31')](_0x142fcf[_0x613d('0x2d')],qs[_0x613d('0x33')](_0x569720['query'][_0x613d('0x33')]));_0x5e9e26[_0x613d('0x32')]=_0x5e9e26[_0x613d('0x32')][_0x613d('0x34')]?_0x5e9e26[_0x613d('0x32')]:_0x142fcf['model'];if(_0x569720[_0x613d('0x2e')][_0x613d('0x3c')]){_0x5e9e26[_0x613d('0x3d')]=[{'all':!![]}];}_0x5e9e26=_['merge']({},_0x5e9e26,_0x569720['options']);return db[_0x613d('0x29')]['find'](_0x5e9e26)[_0x613d('0x23')](handleEntityNotFound(_0x143758,null))[_0x613d('0x23')](respondWithResult(_0x143758,null))[_0x613d('0x3f')](handleError(_0x143758,null));};exports[_0x613d('0x43')]=function(_0xbbee16,_0x4cdd02){return db[_0x613d('0x29')]['create'](_0xbbee16[_0x613d('0x44')],{})[_0x613d('0x23')](respondWithResult(_0x4cdd02,0xc9))['catch'](handleError(_0x4cdd02,null));};exports[_0x613d('0x45')]=function(_0x1982cc,_0x1b2a2f){if(_0x1982cc[_0x613d('0x44')]['id']){delete _0x1982cc[_0x613d('0x44')]['id'];}return db[_0x613d('0x29')][_0x613d('0x46')]({'where':{'id':_0x1982cc[_0x613d('0x41')]['id']}})[_0x613d('0x23')](handleEntityNotFound(_0x1b2a2f,null))['then'](saveUpdates(_0x1982cc[_0x613d('0x44')],null))[_0x613d('0x23')](respondWithResult(_0x1b2a2f,null))[_0x613d('0x3f')](handleError(_0x1b2a2f,null));};exports[_0x613d('0x24')]=function(_0x95cfe7,_0x718d90){return db[_0x613d('0x29')][_0x613d('0x46')]({'where':{'id':_0x95cfe7['params']['id']}})[_0x613d('0x23')](handleEntityNotFound(_0x718d90,null))[_0x613d('0x23')](removeEntity(_0x718d90,null))[_0x613d('0x3f')](handleError(_0x718d90,null));};exports[_0x613d('0x47')]=function(_0x5b209f,_0x577acd){return db['ChatTransferReport'][_0x613d('0x47')]()[_0x613d('0x23')](respondWithResult(_0x577acd,null))[_0x613d('0x3f')](handleError(_0x577acd,null));}; \ No newline at end of file +var _0x3948=['type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','ChatTransferReport','rawAttributes','fieldName'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3948,0x6c));var _0x8394=function(_0x2db9e8,_0x535e57){_0x2db9e8=_0x2db9e8-0x0;var _0x4640cd=_0x3948[_0x2db9e8];return _0x4640cd;};'use strict';var emlformat=require(_0x8394('0x0'));var rimraf=require(_0x8394('0x1'));var zipdir=require(_0x8394('0x2'));var jsonpatch=require(_0x8394('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8394('0x4'));var Mustache=require(_0x8394('0x5'));var util=require(_0x8394('0x6'));var path=require(_0x8394('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8394('0x8'));var fs=require('fs');var fs_extra=require(_0x8394('0x9'));var _=require('lodash');var squel=require(_0x8394('0xa'));var crypto=require(_0x8394('0xb'));var jsforce=require(_0x8394('0xc'));var deskjs=require(_0x8394('0xd'));var toCsv=require(_0x8394('0xe'));var querystring=require(_0x8394('0xf'));var Papa=require(_0x8394('0x10'));var Redis=require(_0x8394('0x11'));var authService=require(_0x8394('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8394('0x13'));var logger=require('../../config/logger')(_0x8394('0x14'));var utils=require(_0x8394('0x15'));var config=require(_0x8394('0x16'));var licenseUtil=require(_0x8394('0x17'));var db=require(_0x8394('0x18'))['db'];function respondWithStatusCode(_0x546445,_0x4e9258){_0x4e9258=_0x4e9258||0xcc;return function(_0x2dbde0){if(_0x2dbde0){return _0x546445[_0x8394('0x19')](_0x4e9258);}return _0x546445[_0x8394('0x1a')](_0x4e9258)['end']();};}function respondWithResult(_0x58ceb,_0x43fef6){_0x43fef6=_0x43fef6||0xc8;return function(_0x548751){if(_0x548751){return _0x58ceb['status'](_0x43fef6)[_0x8394('0x1b')](_0x548751);}};}function respondWithFilteredResult(_0x1e75a1,_0xf29e01){return function(_0x4133d6){if(_0x4133d6){var _0x481735=typeof _0xf29e01[_0x8394('0x1c')]===_0x8394('0x1d')&&typeof _0xf29e01['limit']===_0x8394('0x1d');var _0x2f185e=_0x4133d6[_0x8394('0x1e')];var _0x58f537=_0x481735?0x0:_0xf29e01['offset'];var _0x22af45=_0x481735?_0x4133d6[_0x8394('0x1e')]:_0xf29e01[_0x8394('0x1c')]+_0xf29e01[_0x8394('0x1f')];var _0x37257f;if(_0x22af45>=_0x2f185e){_0x22af45=_0x2f185e;_0x37257f=0xc8;}else{_0x37257f=0xce;}_0x1e75a1[_0x8394('0x1a')](_0x37257f);return _0x1e75a1[_0x8394('0x20')](_0x8394('0x21'),_0x58f537+'-'+_0x22af45+'/'+_0x2f185e)[_0x8394('0x1b')](_0x4133d6);}return null;};}function patchUpdates(_0x4007a6){return function(_0x3d41cf){try{jsonpatch[_0x8394('0x22')](_0x3d41cf,_0x4007a6,!![]);}catch(_0x2907e1){return BPromise[_0x8394('0x23')](_0x2907e1);}return _0x3d41cf[_0x8394('0x24')]();};}function saveUpdates(_0x321215,_0x364cfd){return function(_0x4c7f1b){if(_0x4c7f1b){return _0x4c7f1b[_0x8394('0x25')](_0x321215)[_0x8394('0x26')](function(_0x1bac9d){return _0x1bac9d;});}return null;};}function removeEntity(_0x5d09f4,_0x219c2b){return function(_0x4cf8b9){if(_0x4cf8b9){return _0x4cf8b9['destroy']()[_0x8394('0x26')](function(){_0x5d09f4[_0x8394('0x1a')](0xcc)[_0x8394('0x27')]();});}};}function handleEntityNotFound(_0x3aabfc,_0x27d153){return function(_0x31b866){if(!_0x31b866){_0x3aabfc[_0x8394('0x19')](0x194);}return _0x31b866;};}function handleError(_0x1cb67f,_0x4e9eaf){_0x4e9eaf=_0x4e9eaf||0x1f4;return function(_0x125d89){logger[_0x8394('0x28')](_0x125d89[_0x8394('0x29')]);if(_0x125d89[_0x8394('0x2a')]){delete _0x125d89[_0x8394('0x2a')];}_0x1cb67f[_0x8394('0x1a')](_0x4e9eaf)[_0x8394('0x2b')](_0x125d89);};}exports[_0x8394('0x2c')]=function(_0x15a289,_0x25d2e2){var _0x3c9125={},_0x48d766={},_0x23ed92={'count':0x0,'rows':[]};var _0xbe8f99=_['map'](db[_0x8394('0x2d')][_0x8394('0x2e')],function(_0xf6a5f7){return{'name':_0xf6a5f7[_0x8394('0x2f')],'type':_0xf6a5f7[_0x8394('0x30')]['key']};});_0x48d766[_0x8394('0x31')]=_[_0x8394('0x32')](_0xbe8f99,_0x8394('0x2a'));_0x48d766[_0x8394('0x33')]=_[_0x8394('0x34')](_0x15a289[_0x8394('0x33')]);_0x48d766[_0x8394('0x35')]=_[_0x8394('0x36')](_0x48d766[_0x8394('0x31')],_0x48d766[_0x8394('0x33')]);_0x3c9125['attributes']=_[_0x8394('0x36')](_0x48d766[_0x8394('0x31')],qs['fields'](_0x15a289[_0x8394('0x33')][_0x8394('0x37')]));_0x3c9125[_0x8394('0x38')]=_0x3c9125['attributes'][_0x8394('0x39')]?_0x3c9125[_0x8394('0x38')]:_0x48d766[_0x8394('0x31')];if(!_0x15a289['query'][_0x8394('0x3a')](_0x8394('0x3b'))){_0x3c9125[_0x8394('0x1f')]=qs[_0x8394('0x1f')](_0x15a289[_0x8394('0x33')][_0x8394('0x1f')]);_0x3c9125['offset']=qs[_0x8394('0x1c')](_0x15a289[_0x8394('0x33')][_0x8394('0x1c')]);}_0x3c9125[_0x8394('0x3c')]=qs[_0x8394('0x3d')](_0x15a289[_0x8394('0x33')]['sort']);_0x3c9125[_0x8394('0x3e')]=qs[_0x8394('0x35')](_[_0x8394('0x3f')](_0x15a289[_0x8394('0x33')],_0x48d766[_0x8394('0x35')]),_0xbe8f99);if(_0x15a289[_0x8394('0x33')]['filter']){_0x3c9125[_0x8394('0x3e')]=_[_0x8394('0x40')](_0x3c9125[_0x8394('0x3e')],{'$or':_[_0x8394('0x32')](_0xbe8f99,function(_0x1c5145){if(_0x1c5145[_0x8394('0x30')]!==_0x8394('0x41')){var _0x45dfcc={};_0x45dfcc[_0x1c5145[_0x8394('0x2a')]]={'$like':'%'+_0x15a289[_0x8394('0x33')]['filter']+'%'};return _0x45dfcc;}})});}_0x3c9125=_[_0x8394('0x40')]({},_0x3c9125,_0x15a289[_0x8394('0x42')]);var _0x5dcc09={'where':_0x3c9125['where']};return db[_0x8394('0x2d')][_0x8394('0x1e')](_0x5dcc09)[_0x8394('0x26')](function(_0x15e38b){_0x23ed92[_0x8394('0x1e')]=_0x15e38b;if(_0x15a289[_0x8394('0x33')]['includeAll']){_0x3c9125[_0x8394('0x43')]=[{'all':!![]}];}return db[_0x8394('0x2d')][_0x8394('0x44')](_0x3c9125);})[_0x8394('0x26')](function(_0xceb943){_0x23ed92['rows']=_0xceb943;return _0x23ed92;})[_0x8394('0x26')](respondWithFilteredResult(_0x25d2e2,_0x3c9125))[_0x8394('0x45')](handleError(_0x25d2e2,null));};exports[_0x8394('0x46')]=function(_0x4e7a8b,_0x14191d){var _0x429b41={'raw':!![],'where':{'id':_0x4e7a8b[_0x8394('0x47')]['id']}},_0x5f58fb={};_0x5f58fb[_0x8394('0x31')]=_['keys'](db['ChatTransferReport'][_0x8394('0x2e')]);_0x5f58fb[_0x8394('0x33')]=_['keys'](_0x4e7a8b[_0x8394('0x33')]);_0x5f58fb['filters']=_[_0x8394('0x36')](_0x5f58fb[_0x8394('0x31')],_0x5f58fb['query']);_0x429b41[_0x8394('0x38')]=_[_0x8394('0x36')](_0x5f58fb[_0x8394('0x31')],qs[_0x8394('0x37')](_0x4e7a8b['query'][_0x8394('0x37')]));_0x429b41[_0x8394('0x38')]=_0x429b41['attributes'][_0x8394('0x39')]?_0x429b41[_0x8394('0x38')]:_0x5f58fb[_0x8394('0x31')];if(_0x4e7a8b['query'][_0x8394('0x48')]){_0x429b41[_0x8394('0x43')]=[{'all':!![]}];}_0x429b41=_[_0x8394('0x40')]({},_0x429b41,_0x4e7a8b[_0x8394('0x42')]);return db[_0x8394('0x2d')]['find'](_0x429b41)['then'](handleEntityNotFound(_0x14191d,null))['then'](respondWithResult(_0x14191d,null))[_0x8394('0x45')](handleError(_0x14191d,null));};exports[_0x8394('0x49')]=function(_0x43f922,_0x1e52b2){return db['ChatTransferReport']['create'](_0x43f922[_0x8394('0x4a')],{})[_0x8394('0x26')](respondWithResult(_0x1e52b2,0xc9))[_0x8394('0x45')](handleError(_0x1e52b2,null));};exports[_0x8394('0x25')]=function(_0x4c9f88,_0x13c0de){if(_0x4c9f88['body']['id']){delete _0x4c9f88[_0x8394('0x4a')]['id'];}return db[_0x8394('0x2d')][_0x8394('0x4b')]({'where':{'id':_0x4c9f88[_0x8394('0x47')]['id']}})[_0x8394('0x26')](handleEntityNotFound(_0x13c0de,null))[_0x8394('0x26')](saveUpdates(_0x4c9f88['body'],null))[_0x8394('0x26')](respondWithResult(_0x13c0de,null))[_0x8394('0x45')](handleError(_0x13c0de,null));};exports[_0x8394('0x4c')]=function(_0x420147,_0x962672){return db[_0x8394('0x2d')][_0x8394('0x4b')]({'where':{'id':_0x420147['params']['id']}})[_0x8394('0x26')](handleEntityNotFound(_0x962672,null))[_0x8394('0x26')](removeEntity(_0x962672,null))[_0x8394('0x45')](handleError(_0x962672,null));};exports[_0x8394('0x4d')]=function(_0x33d157,_0x3f636e){return db[_0x8394('0x2d')][_0x8394('0x4d')]()[_0x8394('0x26')](respondWithResult(_0x3f636e,null))[_0x8394('0x45')](handleError(_0x3f636e,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 694cca9..a18f69b 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 _0xd6e2=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','util','../../config/logger','api'];(function(_0x3627cb,_0x5a9d03){var _0xd3adf3=function(_0x5cd5bc){while(--_0x5cd5bc){_0x3627cb['push'](_0x3627cb['shift']());}};_0xd3adf3(++_0x5a9d03);}(_0xd6e2,0x1a1));var _0x2d6e=function(_0xc066a,_0x3b09bd){_0xc066a=_0xc066a-0x0;var _0x6b065b=_0xd6e2[_0xc066a];return _0x6b065b;};'use strict';var _=require('lodash');var util=require(_0x2d6e('0x0'));var logger=require(_0x2d6e('0x1'))(_0x2d6e('0x2'));var moment=require(_0x2d6e('0x3'));var BPromise=require(_0x2d6e('0x4'));var rp=require(_0x2d6e('0x5'));var fs=require('fs');var path=require(_0x2d6e('0x6'));var rimraf=require(_0x2d6e('0x7'));var config=require(_0x2d6e('0x8'));var attributes=require('./chatTransferReport.attributes');module[_0x2d6e('0x9')]=function(_0x1859c3,_0x36e0da){return _0x1859c3[_0x2d6e('0xa')](_0x2d6e('0xb'),attributes,{'tableName':_0x2d6e('0xc'),'paranoid':![],'indexes':[{'name':_0x2d6e('0xd'),'fields':[_0x2d6e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc178=['bluebird','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','../../config/logger','moment'];(function(_0x2b6b92,_0x57303d){var _0x2233dc=function(_0x310e88){while(--_0x310e88){_0x2b6b92['push'](_0x2b6b92['shift']());}};_0x2233dc(++_0x57303d);}(_0xc178,0x1a1));var _0x8c17=function(_0x402015,_0x178bb7){_0x402015=_0x402015-0x0;var _0x16a7b7=_0xc178[_0x402015];return _0x16a7b7;};'use strict';var _=require(_0x8c17('0x0'));var util=require('util');var logger=require(_0x8c17('0x1'))('api');var moment=require(_0x8c17('0x2'));var BPromise=require(_0x8c17('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c17('0x4'));var rimraf=require(_0x8c17('0x5'));var config=require(_0x8c17('0x6'));var attributes=require(_0x8c17('0x7'));module[_0x8c17('0x8')]=function(_0x4964db,_0x3c1f75){return _0x4964db['define'](_0x8c17('0x9'),attributes,{'tableName':_0x8c17('0xa'),'paranoid':![],'indexes':[{'name':_0x8c17('0xb'),'fields':[_0x8c17('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 43d6bd2..9c52d3f 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 _0x5c9a=['catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x3bc190,_0x2eea47){var _0x5773d3=function(_0x31a8e5){while(--_0x31a8e5){_0x3bc190['push'](_0x3bc190['shift']());}};_0x5773d3(++_0x2eea47);}(_0x5c9a,0x13c));var _0xa5c9=function(_0x358fb5,_0x4407b8){_0x358fb5=_0x358fb5-0x0;var _0x4abfeb=_0x5c9a[_0x358fb5];return _0x4abfeb;};'use strict';var _=require('lodash');var util=require(_0xa5c9('0x0'));var moment=require(_0xa5c9('0x1'));var BPromise=require(_0xa5c9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5c9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa5c9('0x4'));var logger=require(_0xa5c9('0x5'))(_0xa5c9('0x6'));var config=require(_0xa5c9('0x7'));var jayson=require(_0xa5c9('0x8'));var client=jayson[_0xa5c9('0x9')][_0xa5c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x234ec0,_0xb5f8a0,_0x5061ea){return new BPromise(function(_0x46f21e,_0x52e0fe){return client[_0xa5c9('0xb')](_0x234ec0,_0x5061ea)['then'](function(_0x2c5f7){logger['info'](_0xa5c9('0xc'),_0xb5f8a0,_0xa5c9('0xd'));logger[_0xa5c9('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0xb5f8a0,_0xa5c9('0xd'),JSON[_0xa5c9('0xf')](_0x2c5f7));if(_0x2c5f7[_0xa5c9('0x10')]){if(_0x2c5f7[_0xa5c9('0x10')][_0xa5c9('0x11')]===0x1f4){logger[_0xa5c9('0x10')](_0xa5c9('0xc'),_0xb5f8a0,_0x2c5f7[_0xa5c9('0x10')]['message']);return _0x52e0fe(_0x2c5f7[_0xa5c9('0x10')]['message']);}logger['error'](_0xa5c9('0xc'),_0xb5f8a0,_0x2c5f7[_0xa5c9('0x10')][_0xa5c9('0x12')]);return _0x46f21e(_0x2c5f7[_0xa5c9('0x10')]['message']);}else{logger['info'](_0xa5c9('0xc'),_0xb5f8a0,'request\x20sent');_0x46f21e(_0x2c5f7[_0xa5c9('0x13')]['message']);}})[_0xa5c9('0x14')](function(_0x39ea49){logger[_0xa5c9('0x10')](_0xa5c9('0xc'),_0xb5f8a0,_0x39ea49);_0x52e0fe(_0x39ea49);});});} \ No newline at end of file +var _0xf1e4=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info'];(function(_0x3a3fff,_0x3e7a6b){var _0x25ddff=function(_0x20b901){while(--_0x20b901){_0x3a3fff['push'](_0x3a3fff['shift']());}};_0x25ddff(++_0x3e7a6b);}(_0xf1e4,0x92));var _0x4f1e=function(_0xe9d59f,_0x3f603e){_0xe9d59f=_0xe9d59f-0x0;var _0x972885=_0xf1e4[_0xe9d59f];return _0x972885;};'use strict';var _=require(_0x4f1e('0x0'));var util=require(_0x4f1e('0x1'));var moment=require(_0x4f1e('0x2'));var BPromise=require(_0x4f1e('0x3'));var rs=require(_0x4f1e('0x4'));var fs=require('fs');var Redis=require(_0x4f1e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f1e('0x6'));var logger=require(_0x4f1e('0x7'))(_0x4f1e('0x8'));var config=require(_0x4f1e('0x9'));var jayson=require(_0x4f1e('0xa'));var client=jayson[_0x4f1e('0xb')][_0x4f1e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18b848,_0x4a53cf,_0x2b3465){return new BPromise(function(_0x87b2d,_0x39b17b){return client[_0x4f1e('0xd')](_0x18b848,_0x2b3465)[_0x4f1e('0xe')](function(_0x5e673d){logger['info'](_0x4f1e('0xf'),_0x4a53cf,'request\x20sent');logger[_0x4f1e('0x10')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x4a53cf,_0x4f1e('0x11'),JSON['stringify'](_0x5e673d));if(_0x5e673d[_0x4f1e('0x12')]){if(_0x5e673d[_0x4f1e('0x12')][_0x4f1e('0x13')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x4a53cf,_0x5e673d[_0x4f1e('0x12')][_0x4f1e('0x14')]);return _0x39b17b(_0x5e673d['error'][_0x4f1e('0x14')]);}logger[_0x4f1e('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x4a53cf,_0x5e673d['error']['message']);return _0x87b2d(_0x5e673d[_0x4f1e('0x12')][_0x4f1e('0x14')]);}else{logger[_0x4f1e('0x15')](_0x4f1e('0xf'),_0x4a53cf,'request\x20sent');_0x87b2d(_0x5e673d[_0x4f1e('0x16')][_0x4f1e('0x14')]);}})[_0x4f1e('0x17')](function(_0x3ddeac){logger[_0x4f1e('0x12')](_0x4f1e('0xf'),_0x4a53cf,_0x3ddeac);_0x39b17b(_0x3ddeac);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 48b6e81..880a523 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 _0xeb58=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xeb58,0x1a2));var _0x8eb5=function(_0x3b91ad,_0x4feee7){_0x3b91ad=_0x3b91ad-0x0;var _0x36f0cc=_0xeb58[_0x3b91ad];return _0x36f0cc;};'use strict';var multer=require(_0x8eb5('0x0'));var util=require(_0x8eb5('0x1'));var path=require(_0x8eb5('0x2'));var timeout=require(_0x8eb5('0x3'));var express=require(_0x8eb5('0x4'));var router=express[_0x8eb5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8eb5('0x6'));var interaction=require(_0x8eb5('0x7'));var config=require(_0x8eb5('0x8'));var controller=require(_0x8eb5('0x9'));router[_0x8eb5('0xa')]('/',auth[_0x8eb5('0xb')](),controller['index']);router['get'](_0x8eb5('0xc'),auth[_0x8eb5('0xb')](),controller[_0x8eb5('0xd')]);router[_0x8eb5('0xa')](_0x8eb5('0xe'),auth[_0x8eb5('0xb')](),controller[_0x8eb5('0xf')]);router[_0x8eb5('0x10')]('/',auth[_0x8eb5('0xb')](),controller['create']);router[_0x8eb5('0x11')](_0x8eb5('0xe'),auth[_0x8eb5('0xb')](),controller[_0x8eb5('0x12')]);router[_0x8eb5('0x13')]('/:id',auth[_0x8eb5('0xb')](),controller[_0x8eb5('0x14')]);module[_0x8eb5('0x15')]=router; \ No newline at end of file +var _0x6a18=['./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x6a18,0xb8));var _0x86a1=function(_0x1c8e04,_0x6fb850){_0x1c8e04=_0x1c8e04-0x0;var _0x474bd5=_0x6a18[_0x1c8e04];return _0x474bd5;};'use strict';var multer=require(_0x86a1('0x0'));var util=require('util');var path=require(_0x86a1('0x1'));var timeout=require('connect-timeout');var express=require(_0x86a1('0x2'));var router=express[_0x86a1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x86a1('0x4'));var interaction=require(_0x86a1('0x5'));var config=require('../../config/environment');var controller=require(_0x86a1('0x6'));router[_0x86a1('0x7')]('/',auth[_0x86a1('0x8')](),controller[_0x86a1('0x9')]);router[_0x86a1('0x7')](_0x86a1('0xa'),auth['isAuthenticated'](),controller[_0x86a1('0xb')]);router[_0x86a1('0x7')](_0x86a1('0xc'),auth[_0x86a1('0x8')](),controller[_0x86a1('0xd')]);router[_0x86a1('0xe')]('/',auth[_0x86a1('0x8')](),controller['create']);router['put'](_0x86a1('0xc'),auth['isAuthenticated'](),controller[_0x86a1('0xf')]);router[_0x86a1('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x86a1('0x11')]);module[_0x86a1('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 57259aa..13807c6 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 _0x51d5=['ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Skip','Feedback','star','thumb','input','name','text','getDataValue','onlineForm','parse','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN'];(function(_0x3901eb,_0x43d721){var _0x5595be=function(_0x1ae975){while(--_0x1ae975){_0x3901eb['push'](_0x3901eb['shift']());}};_0x5595be(++_0x43d721);}(_0x51d5,0x122));var _0x551d=function(_0x53732a,_0x4d7d50){_0x53732a=_0x53732a-0x0;var _0x4abe36=_0x51d5[_0x53732a];return _0x4abe36;};'use strict';var Sequelize=require(_0x551d('0x0'));var rs=require(_0x551d('0x1'));module[_0x551d('0x2')]={'name':{'type':Sequelize[_0x551d('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x551d('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x551d('0x3')]},'mapKey':{'type':Sequelize[_0x551d('0x3')],'defaultValue':_0x551d('0x4')},'mapKeyOffline':{'type':Sequelize[_0x551d('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x551d('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x551d('0x3')],'defaultValue':_0x551d('0x5')},'customerAlias':{'type':Sequelize[_0x551d('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x551d('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x551d('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x551d('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x551d('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x551d('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x551d('0x3')]},'animation':{'type':Sequelize[_0x551d('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x551d('0xa')](_0x551d('0xb'),_0x551d('0xc')),'defaultValue':_0x551d('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x551d('0xd')},'start_chat_button':{'type':Sequelize[_0x551d('0x3')],'defaultValue':_0x551d('0xe')},'offline_chat_button':{'type':Sequelize[_0x551d('0x3')],'defaultValue':_0x551d('0xf')},'header_offline':{'type':Sequelize[_0x551d('0x3')],'defaultValue':_0x551d('0x10')},'download_transcript':{'type':Sequelize[_0x551d('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x551d('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x551d('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x551d('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x551d('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x551d('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x551d('0x3')],'defaultValue':_0x551d('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x551d('0x3')],'defaultValue':_0x551d('0x14')},'noteTitle':{'type':Sequelize[_0x551d('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x551d('0x3')],'defaultValue':_0x551d('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x551d('0x3')],'defaultValue':_0x551d('0x16')},'conditionAgreement':{'type':Sequelize[_0x551d('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x551d('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x551d('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x551d('0x3')],'defaultValue':_0x551d('0x17')},'ratingType':{'type':Sequelize[_0x551d('0xa')](_0x551d('0x18'),_0x551d('0x19')),'defaultValue':_0x551d('0x18')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x551d('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x551d('0x1a'),'variable':null,'config':{'placeholder':_0x551d('0x1b'),'type':_0x551d('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x551d('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x551d('0x4'),'type':_0x551d('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x551d('0x1d')](_0x551d('0x1e'))?JSON[_0x551d('0x1f')](this['getDataValue'](_0x551d('0x1e'))):{};},'set':function(_0x68ffd1){return this[_0x551d('0x20')]('onlineForm',JSON[_0x551d('0x21')](_0x68ffd1));}},'offlineForm':{'type':Sequelize[_0x551d('0x11')],'defaultValue':function(){return JSON[_0x551d('0x21')]({'items':[{'type':_0x551d('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x551d('0x4'),'type':'email'},'variable':null},{'type':_0x551d('0x22'),'config':{'placeholder':_0x551d('0x23')},'props':{'title':_0x551d('0x23'),'helpText':_0x551d('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x551d('0x1d')]('offlineForm')?JSON['parse'](this[_0x551d('0x1d')]('offlineForm')):{};},'set':function(_0x136d05){return this['setDataValue'](_0x551d('0x25'),JSON['stringify'](_0x136d05));}},'token':{'type':Sequelize[_0x551d('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x551d('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x551d('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x551d('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x551d('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x551d('0x3')]},'waitingTitle':{'type':Sequelize[_0x551d('0x3')],'defaultValue':_0x551d('0x26')},'waitingMessage':{'type':Sequelize[_0x551d('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x551d('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x551d('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x551d('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x551d('0x3')],'defaultValue':_0x551d('0x27')},'skipUnmanaged':{'type':Sequelize[_0x551d('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x551d('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0x551d('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x551d('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x551d('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x551d('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x551d('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x551d('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x551d('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x551d('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x551d('0x3')],'defaultValue':_0x551d('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x551d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x551d('0x3')],'defaultValue':_0x551d('0x29')},'verticalAlignment':{'type':Sequelize[_0x551d('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x551d('0x3')],'defaultValue':_0x551d('0x2a')},'messagesAlignment':{'type':Sequelize[_0x551d('0x3')],'defaultValue':_0x551d('0x2b')},'defaultTitle':{'type':Sequelize[_0x551d('0x3')]},'customerAvatar':{'type':Sequelize[_0x551d('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x551d('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x551d('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x551d('0x3')],'allowNull':![],'defaultValue':_0x551d('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x551d('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x551d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x551d('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x551d('0x2d')},'systemAvatar':{'type':Sequelize[_0x551d('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x551d('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x551d('0x9')],'defaultValue':![],'comment':_0x551d('0x2f'),'set':function(_0x3547aa){if(!_0x3547aa)this[_0x551d('0x20')]('mandatoryDispositionPauseId',null);this[_0x551d('0x20')](_0x551d('0x30'),_0x3547aa);}},'vidaooEscalation':{'type':Sequelize[_0x551d('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x551d('0x3')]},'vidaooTopic':{'type':Sequelize[_0x551d('0x3')],'allowNull':![],'defaultValue':_0x551d('0x31')},'vidaooNote':{'type':Sequelize[_0x551d('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x551d('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x551d('0x11')]}}; \ No newline at end of file +var _0x9fde=['We\x20are\x20here!','Chat','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','INTEGER','stringify','name','getDataValue','onlineForm','setDataValue','input','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','address','email','#011F6A','#ffffff','ENUM','rounded','squared'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x9fde,0x1d2));var _0xe9fd=function(_0x550e29,_0x4047f){_0x550e29=_0x550e29-0x0;var _0x3515b6=_0x9fde[_0x550e29];return _0x3515b6;};'use strict';var Sequelize=require(_0xe9fd('0x0'));var rs=require(_0xe9fd('0x1'));module[_0xe9fd('0x2')]={'name':{'type':Sequelize[_0xe9fd('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe9fd('0x4')},'description':{'type':Sequelize[_0xe9fd('0x3')]},'mapKey':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':_0xe9fd('0x5')},'mapKeyOffline':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0xe9fd('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xe9fd('0x3')],'allowNull':![],'defaultValue':_0xe9fd('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xe9fd('0x3')],'allowNull':![],'defaultValue':_0xe9fd('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xe9fd('0x3')],'allowNull':![],'defaultValue':_0xe9fd('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xe9fd('0x8')](_0xe9fd('0x9'),_0xe9fd('0xa')),'defaultValue':_0xe9fd('0x9')},'header_online':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':_0xe9fd('0xb')},'start_chat_button':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':_0xe9fd('0xc')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':_0xe9fd('0xd')},'download_transcript':{'type':Sequelize[_0xe9fd('0xe')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':_0xe9fd('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xe9fd('0xe')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xe9fd('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':_0xe9fd('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':_0xe9fd('0x12')},'noteTitle':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':_0xe9fd('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xe9fd('0x14')},'closingMessage':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':_0xe9fd('0x15')},'closingMessageButton':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':_0xe9fd('0x16')},'skipMessageButton':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':_0xe9fd('0x17')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xe9fd('0xe')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xe9fd('0xe')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xe9fd('0xe')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':_0xe9fd('0x18')},'ratingType':{'type':Sequelize[_0xe9fd('0x8')](_0xe9fd('0x19'),_0xe9fd('0x1a')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xe9fd('0x1b')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xe9fd('0x10')],'defaultValue':function(){return JSON[_0xe9fd('0x1c')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xe9fd('0x1d'),'type':'text','required':!![]},'props':{'title':_0xe9fd('0x1d'),'helpText':''}},{'type':'input','props':{'title':_0xe9fd('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xe9fd('0x5'),'type':_0xe9fd('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xe9fd('0x1e')]('onlineForm')?JSON['parse'](this[_0xe9fd('0x1e')](_0xe9fd('0x1f'))):{};},'set':function(_0x2654e5){return this[_0xe9fd('0x20')]('onlineForm',JSON[_0xe9fd('0x1c')](_0x2654e5));}},'offlineForm':{'type':Sequelize[_0xe9fd('0x10')],'defaultValue':function(){return JSON[_0xe9fd('0x1c')]({'items':[{'type':_0xe9fd('0x21'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xe9fd('0x5'),'type':'email'},'variable':null},{'type':_0xe9fd('0x22'),'config':{'placeholder':_0xe9fd('0x23')},'props':{'title':_0xe9fd('0x23'),'helpText':_0xe9fd('0x24')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xe9fd('0x25'))?JSON[_0xe9fd('0x26')](this[_0xe9fd('0x1e')](_0xe9fd('0x25'))):{};},'set':function(_0x12c35d){return this[_0xe9fd('0x20')](_0xe9fd('0x25'),JSON[_0xe9fd('0x1c')](_0x12c35d));}},'token':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':function(){return rs[_0xe9fd('0x27')]();}},'autoclose':{'type':Sequelize[_0xe9fd('0xe')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xe9fd('0xe')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xe9fd('0xe')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xe9fd('0x3')]},'forwardOffline':{'type':Sequelize[_0xe9fd('0xe')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xe9fd('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xe9fd('0x28')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xe9fd('0x29')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xe9fd('0x2a')},'offlineMessageBody':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':_0xe9fd('0x2b')},'enableUnmanagedNote':{'type':Sequelize[_0xe9fd('0xe')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':_0xe9fd('0x2c')},'skipUnmanaged':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':_0xe9fd('0x17')},'sendUnmanaged':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':_0xe9fd('0x16')},'enableCustomerAttachment':{'type':Sequelize[_0xe9fd('0xe')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xe9fd('0xe')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xe9fd('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xe9fd('0xe')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xe9fd('0x3')]},'notificationTemplate':{'type':Sequelize[_0xe9fd('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xe9fd('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe9fd('0xe')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xe9fd('0xe')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':_0xe9fd('0x2d')},'waitForTheAssignedAgent':{'type':Sequelize[_0xe9fd('0x1b')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe9fd('0x1b')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xe9fd('0x1b')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xe9fd('0x3')]},'customerAvatar':{'type':Sequelize[_0xe9fd('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0xe9fd('0xe')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xe9fd('0x1b')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe9fd('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe9fd('0x1b')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe9fd('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':_0xe9fd('0x2f')},'systemAvatar':{'type':Sequelize[_0xe9fd('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe9fd('0x1b')],'comment':_0xe9fd('0x30')},'mandatoryDisposition':{'type':Sequelize[_0xe9fd('0xe')],'defaultValue':![],'comment':_0xe9fd('0x31'),'set':function(_0x3214f6){if(!_0x3214f6)this[_0xe9fd('0x20')](_0xe9fd('0x32'),null);this[_0xe9fd('0x20')](_0xe9fd('0x33'),_0x3214f6);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xe9fd('0x3')],'allowNull':![],'defaultValue':_0xe9fd('0x34')},'vidaooNote':{'type':Sequelize[_0xe9fd('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xe9fd('0xe')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xe9fd('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index d770ce4..3152954 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 _0x98a8=['emit','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../errors/api','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','url','URL','redis','socket.io-emitter','./chatWebsite.socket','client','http','request','info','ChatWebsite,\x20%s,\x20%s','debug','stringify','error','message','result','catch','end','status','json','limit','undefined','count','offset','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','then','sendStatus','name','user-agent-parser','setUA','customerIp','x-forwarded-for','first','split','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','model','type','index','mandatoryDispositionPause','map','ChatWebsite','fieldName','key','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','params','Pause','rawAttributes','includeAll','find','create','body','forEach','trim','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','address','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','describe','addDisposition','ChatWebsiteId','findOne','Disposition','hasOwnProperty','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','existsSync','root','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','timezone','ifTime','notify','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','referer','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','Contacts','ChatApplication','interval','account','applications','orderBy','Applications','priority','asc','list','List','defaults','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','contact','messageId','created','autoclose','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','files','Sequelize','no\x20available\x20attributes','difference','ValidationError','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','render','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','email','firstName','Chat','NotifyMailAccount','notifyMail','remove','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','getSnippet','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','utf8','3.13.0','headers','origin','http://localhost:9000','x-real-ip','verticalAlignment','textButtonColor','color_button','backgroundColor','IntervalId','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','addProactiveActions','chatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x98a8,0x12c));var _0x898a=function(_0x1940a7,_0x517fbf){_0x1940a7=_0x1940a7-0x0;var _0x11afb8=_0x98a8[_0x1940a7];return _0x11afb8;};'use strict';var Mustache=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var ejs=require(_0x898a('0x3'));var fs=require('fs');var fs_extra=require(_0x898a('0x4'));var _=require(_0x898a('0x5'));var querystring=require(_0x898a('0x6'));var htmlToText=require('html-to-text');var Redis=require(_0x898a('0x7'));var jayson=require(_0x898a('0x8'));var qs=require(_0x898a('0x9'));var logger=require(_0x898a('0xa'))(_0x898a('0xb'));var config=require('../../config/environment');var APIBadRequestError=require(_0x898a('0xc'))['APIBadRequestError'];var APINotFoundError=require(_0x898a('0xc'))['APINotFoundError'];var APIOutOfIntervalError=require(_0x898a('0xc'))[_0x898a('0xd')];var APIHandleError=require(_0x898a('0xc'))[_0x898a('0xe')];var APIConflictError=require(_0x898a('0xc'))[_0x898a('0xf')];var wildcardUtils=require(_0x898a('0x10'));var URL=require(_0x898a('0x11'))[_0x898a('0x12')];var db=require('../../mysqldb')['db'];config[_0x898a('0x13')]=_['defaults'](config[_0x898a('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x898a('0x14'))(new Redis(config[_0x898a('0x13')]));require(_0x898a('0x15'))['register'](socket);var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x898a('0x16')][_0x898a('0x17')]({'port':0x232a});var client9003=jayson[_0x898a('0x16')][_0x898a('0x17')]({'port':0x232b});var client9001=jayson[_0x898a('0x16')][_0x898a('0x17')]({'port':0x2329});function respondWithRpcPromise(_0x506023,_0x47033c,_0x53a4b8,_0x3fec7a){return new Promise(function(_0x5c96a6,_0x303321){var _0x4fb05b=_0x3fec7a||client;return _0x4fb05b[_0x898a('0x18')](_0x506023,_0x53a4b8)['then'](function(_0xee4408){logger[_0x898a('0x19')](_0x898a('0x1a'),_0x47033c,'request\x20sent');logger[_0x898a('0x1b')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x47033c,'request\x20sent',JSON[_0x898a('0x1c')](_0xee4408));if(_0xee4408[_0x898a('0x1d')]){if(_0xee4408['error']['code']===0x1f4){logger[_0x898a('0x1d')](_0x898a('0x1a'),_0x47033c,_0xee4408[_0x898a('0x1d')][_0x898a('0x1e')]);return _0x303321(_0xee4408[_0x898a('0x1d')][_0x898a('0x1e')]);}logger[_0x898a('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x47033c,_0xee4408[_0x898a('0x1d')][_0x898a('0x1e')]);return _0x5c96a6(_0xee4408[_0x898a('0x1d')][_0x898a('0x1e')]);}else{logger[_0x898a('0x19')](_0x898a('0x1a'),_0x47033c,'request\x20sent');_0x5c96a6(_0xee4408[_0x898a('0x1f')][_0x898a('0x1e')]);}})[_0x898a('0x20')](function(_0x32eca5){logger[_0x898a('0x1d')](_0x898a('0x1a'),_0x47033c,_0x32eca5);_0x303321(_0x32eca5);});});}function respondWithStatusCode(_0x5b7719,_0x20bde0){_0x20bde0=_0x20bde0||0xcc;return function(_0x51d501){if(_0x51d501){return _0x5b7719['sendStatus'](_0x20bde0);}return _0x5b7719['status'](_0x20bde0)[_0x898a('0x21')]();};}function respondWithResult(_0x1f4d86,_0x420b25){_0x420b25=_0x420b25||0xc8;return function(_0x40b3db){if(_0x40b3db){return _0x1f4d86[_0x898a('0x22')](_0x420b25)[_0x898a('0x23')](_0x40b3db);}};}function respondWithFilteredResult(_0x398e98,_0xac1fc4){return function(_0xd31922){if(_0xd31922){var _0x58149d=typeof _0xac1fc4['offset']==='undefined'&&typeof _0xac1fc4[_0x898a('0x24')]===_0x898a('0x25');var _0x3b7704=_0xd31922[_0x898a('0x26')];var _0x34f447=_0x58149d?0x0:_0xac1fc4[_0x898a('0x27')];var _0xe3c983=_0x58149d?_0xd31922[_0x898a('0x26')]:_0xac1fc4[_0x898a('0x27')]+_0xac1fc4[_0x898a('0x24')];var _0x44c5d2;if(_0xe3c983>=_0x3b7704){_0xe3c983=_0x3b7704;_0x44c5d2=0xc8;}else{_0x44c5d2=0xce;}_0x398e98[_0x898a('0x22')](_0x44c5d2);return _0x398e98['set'](_0x898a('0x28'),_0x34f447+'-'+_0xe3c983+'/'+_0x3b7704)[_0x898a('0x23')](_0xd31922);}return null;};}function saveUpdates(_0x26eead){return function(_0x17a980){if(_0x17a980){return _0x17a980[_0x898a('0x29')](_0x26eead)['then'](function(_0x48cefb){return _0x48cefb;});}return null;};}function removeEntity(_0x20a3fe){return function(_0x1e2fd4){if(_0x1e2fd4){return _0x1e2fd4[_0x898a('0x2a')]()['then'](function(){var _0x105477=_0x1e2fd4[_0x898a('0x2b')]({'plain':!![]});var _0x5eafc7=_0x898a('0x2c');return db[_0x898a('0x2d')][_0x898a('0x2a')]({'where':{'type':_0x5eafc7,'resourceId':_0x105477['id']}})[_0x898a('0x2e')](function(){return _0x1e2fd4;});})[_0x898a('0x2e')](function(){_0x20a3fe['status'](0xcc)[_0x898a('0x21')]();});}};}function handleEntityNotFound(_0x5baf5b){return function(_0x573eb3){if(!_0x573eb3){_0x5baf5b[_0x898a('0x2f')](0x194);}return _0x573eb3;};}function handleError(_0x58d997,_0x3c9588){_0x3c9588=_0x3c9588||0x1f4;return function(_0x4b3aac){logger[_0x898a('0x1d')](_0x4b3aac['stack']);if(_0x4b3aac[_0x898a('0x30')]){delete _0x4b3aac[_0x898a('0x30')];}_0x58d997[_0x898a('0x22')](_0x3c9588)['send'](_0x4b3aac);};}function createInteractionObject(_0x554897,_0x47966e,_0x1575d2,_0x429c32){var _0x5a228f=require(_0x898a('0x31'));var _0x3d3463=new _0x5a228f();var _0xe84f7e=_0x3d3463[_0x898a('0x32')](_0x1575d2['user-agent'])['getResult']();var _0x3aed01=_0x47966e[_0x898a('0x33')];if(_0x1575d2['cf-connecting-ip']){_0x3aed01=_0x1575d2['cf-connecting-ip'];}else if(_0x1575d2[_0x898a('0x34')]){_0x3aed01=_[_0x898a('0x35')](_0x1575d2[_0x898a('0x34')][_0x898a('0x36')](','));}return{'ContactId':_0x429c32['id'],'ChatWebsiteId':_0x554897,'from':(_0x429c32['firstName']||'')+'\x20'+(_0x429c32[_0x898a('0x37')]||''),'customerIp':_0x3aed01,'customerPort':_0x1575d2[_0x898a('0x38')]?_0x1575d2['x-real-port']:null,'referer':_0x47966e['referer'],'browserName':_0xe84f7e['browser'][_0x898a('0x30')]&&_0xe84f7e[_0x898a('0x39')][_0x898a('0x3a')]?util[_0x898a('0x3b')](_0x898a('0x3c'),_0xe84f7e[_0x898a('0x39')][_0x898a('0x30')],_0xe84f7e[_0x898a('0x39')][_0x898a('0x3a')]):_0x898a('0x3d'),'browserVersion':_0xe84f7e[_0x898a('0x39')][_0x898a('0x3a')]||_0x898a('0x3d'),'osName':util[_0x898a('0x3b')](_0x898a('0x3c'),_0xe84f7e['os']['name'],_0xe84f7e['os'][_0x898a('0x3a')]),'osVersion':_0xe84f7e['os'][_0x898a('0x3a')],'deviceModel':_0xe84f7e[_0x898a('0x3e')]['model']&&_0xe84f7e[_0x898a('0x3e')][_0x898a('0x3f')]?util[_0x898a('0x3b')](_0x898a('0x40'),_0xe84f7e[_0x898a('0x3e')][_0x898a('0x41')],_0xe84f7e[_0x898a('0x3e')][_0x898a('0x3f')],_0xe84f7e['device'][_0x898a('0x42')]):null,'deviceVendor':_0xe84f7e[_0x898a('0x3e')][_0x898a('0x3f')],'deviceType':_0xe84f7e[_0x898a('0x3e')]['type'],'formData':JSON[_0x898a('0x1c')](_0x47966e)};}exports[_0x898a('0x43')]=function(_0x5964df,_0x241677){var _0x4ce00e={'include':[{'model':db['Pause'],'as':_0x898a('0x44')}]},_0x56a40c={},_0x5137c4={'count':0x0,'rows':[]};var _0x49e603=_[_0x898a('0x45')](db[_0x898a('0x46')]['rawAttributes'],function(_0x247347){return{'name':_0x247347[_0x898a('0x47')],'type':_0x247347['type'][_0x898a('0x48')]};});_0x56a40c[_0x898a('0x41')]=_[_0x898a('0x45')](_0x49e603,_0x898a('0x30'));_0x56a40c['query']=_[_0x898a('0x49')](_0x5964df[_0x898a('0x4a')]);_0x56a40c['filters']=_[_0x898a('0x4b')](_0x56a40c[_0x898a('0x41')],_0x56a40c['query']);_0x4ce00e[_0x898a('0x4c')]=_['intersection'](_0x56a40c[_0x898a('0x41')],qs[_0x898a('0x4d')](_0x5964df[_0x898a('0x4a')]['fields']));_0x4ce00e[_0x898a('0x4c')]=_0x4ce00e[_0x898a('0x4c')][_0x898a('0x4e')]?_0x4ce00e[_0x898a('0x4c')]:_0x56a40c['model'];if(!_0x5964df[_0x898a('0x4a')]['hasOwnProperty'](_0x898a('0x4f'))){_0x4ce00e[_0x898a('0x24')]=qs[_0x898a('0x24')](_0x5964df['query'][_0x898a('0x24')]);_0x4ce00e[_0x898a('0x27')]=qs[_0x898a('0x27')](_0x5964df['query']['offset']);}_0x4ce00e[_0x898a('0x50')]=qs[_0x898a('0x51')](_0x5964df[_0x898a('0x4a')][_0x898a('0x51')]);_0x4ce00e[_0x898a('0x52')]=qs[_0x898a('0x53')](_[_0x898a('0x54')](_0x5964df[_0x898a('0x4a')],_0x56a40c[_0x898a('0x53')]),_0x49e603);if(_0x5964df[_0x898a('0x4a')][_0x898a('0x55')]){_0x4ce00e['where']=_[_0x898a('0x56')](_0x4ce00e[_0x898a('0x52')],{'$or':_['map'](_0x49e603,function(_0x36d7aa){if(_0x36d7aa['type']!=='VIRTUAL'){var _0x15f11e={};_0x15f11e[_0x36d7aa[_0x898a('0x30')]]={'$like':'%'+_0x5964df[_0x898a('0x4a')]['filter']+'%'};return _0x15f11e;}})});}_0x4ce00e=_['merge']({},_0x4ce00e,_0x5964df[_0x898a('0x57')]);var _0x1f5e4b={'where':_0x4ce00e['where']};return db[_0x898a('0x46')][_0x898a('0x26')](_0x1f5e4b)['then'](function(_0x299a6d){_0x5137c4[_0x898a('0x26')]=_0x299a6d;if(_0x5964df[_0x898a('0x4a')]['includeAll']){_0x4ce00e[_0x898a('0x58')]=[{'all':!![]}];}return db[_0x898a('0x46')][_0x898a('0x59')](_0x4ce00e);})[_0x898a('0x2e')](function(_0xd37f94){_0x5137c4[_0x898a('0x5a')]=_0xd37f94;return _0x5137c4;})['then'](respondWithFilteredResult(_0x241677,_0x4ce00e))[_0x898a('0x20')](handleError(_0x241677,null));};exports['show']=function(_0x253f51,_0x1dc177){var _0x15b203={'raw':![],'where':{'id':_0x253f51[_0x898a('0x5b')]['id']},'include':[{'model':db[_0x898a('0x5c')],'as':_0x898a('0x44')}]},_0x43780e={};_0x43780e[_0x898a('0x41')]=_[_0x898a('0x49')](db['ChatWebsite'][_0x898a('0x5d')]);_0x43780e[_0x898a('0x4a')]=_[_0x898a('0x49')](_0x253f51[_0x898a('0x4a')]);_0x43780e[_0x898a('0x53')]=_[_0x898a('0x4b')](_0x43780e[_0x898a('0x41')],_0x43780e[_0x898a('0x4a')]);_0x15b203[_0x898a('0x4c')]=_[_0x898a('0x4b')](_0x43780e[_0x898a('0x41')],qs[_0x898a('0x4d')](_0x253f51[_0x898a('0x4a')][_0x898a('0x4d')]));_0x15b203[_0x898a('0x4c')]=_0x15b203['attributes'][_0x898a('0x4e')]?_0x15b203[_0x898a('0x4c')]:_0x43780e['model'];if(_0x253f51[_0x898a('0x4a')][_0x898a('0x5e')]){_0x15b203['include']=[{'all':!![]}];}_0x15b203=_[_0x898a('0x56')]({},_0x15b203,_0x253f51[_0x898a('0x57')]);return db[_0x898a('0x46')][_0x898a('0x5f')](_0x15b203)['then'](handleEntityNotFound(_0x1dc177,null))[_0x898a('0x2e')](respondWithResult(_0x1dc177,null))[_0x898a('0x20')](handleError(_0x1dc177,null));};exports[_0x898a('0x60')]=function(_0xf86633,_0x5b4e60){var _0x285ec9=null;_0xf86633[_0x898a('0x61')]['address'][_0x898a('0x36')](',')[_0x898a('0x62')](_0x5b7019=>{if(_0x5b7019[_0x898a('0x63')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x5b7019[_0x898a('0x63')]())){_0x285ec9=new APIBadRequestError('\x22'+_0x5b7019['trim']()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x285ec9){return handleError(_0x5b4e60,null)(_0x285ec9);}return db['ChatWebsite'][_0x898a('0x60')](_0xf86633[_0x898a('0x61')],{})[_0x898a('0x2e')](function(_0x37c6f6){var _0x5e0535=_0xf86633['user'][_0x898a('0x2b')]({'plain':!![]});if(!_0x5e0535)throw new Error(_0x898a('0x64'));if(_0x5e0535[_0x898a('0x65')]===_0x898a('0x66')){var _0x3d9966=_0x37c6f6[_0x898a('0x2b')]({'plain':!![]});var _0x30051d=_0x898a('0x2c');return db['UserProfileSection'][_0x898a('0x5f')]({'where':{'name':_0x30051d,'userProfileId':_0x5e0535[_0x898a('0x67')]},'raw':!![]})['then'](function(_0x42fda8){if(_0x42fda8&&_0x42fda8[_0x898a('0x68')]===0x0){return db[_0x898a('0x2d')][_0x898a('0x60')]({'name':_0x3d9966[_0x898a('0x30')],'resourceId':_0x3d9966['id'],'type':_0x42fda8[_0x898a('0x30')],'sectionId':_0x42fda8['id']},{})[_0x898a('0x2e')](function(){return _0x37c6f6;});}else{return _0x37c6f6;}})[_0x898a('0x20')](function(_0x16c48d){logger[_0x898a('0x1d')](_0x898a('0x69'),_0x16c48d);throw _0x16c48d;});}return _0x37c6f6;})[_0x898a('0x2e')](respondWithResult(_0x5b4e60,0xc9))[_0x898a('0x20')](handleError(_0x5b4e60,null));};exports['update']=function(_0x2d9a9c,_0x554cb7){var _0x2be3a8=null;_0x2d9a9c[_0x898a('0x61')][_0x898a('0x6a')]['split'](',')[_0x898a('0x62')](_0x3f0d9f=>{if(_0x3f0d9f[_0x898a('0x63')]()!==''&&!wildcardUtils[_0x898a('0x6b')](_0x3f0d9f[_0x898a('0x63')]())){_0x2be3a8=new APIBadRequestError('\x22'+_0x3f0d9f['trim']()+_0x898a('0x6c'));}});if(_0x2be3a8){return handleError(_0x554cb7,null)(_0x2be3a8);}if(_0x2d9a9c[_0x898a('0x61')]['id']){delete _0x2d9a9c[_0x898a('0x61')]['id'];}return db[_0x898a('0x46')][_0x898a('0x5f')]({'where':{'id':_0x2d9a9c['params']['id']},'include':[{'model':db[_0x898a('0x5c')],'as':_0x898a('0x44')}]})[_0x898a('0x2e')](handleEntityNotFound(_0x554cb7,null))[_0x898a('0x2e')](saveUpdates(_0x2d9a9c[_0x898a('0x61')],null))[_0x898a('0x2e')](respondWithResult(_0x554cb7,null))[_0x898a('0x20')](handleError(_0x554cb7,null));};exports[_0x898a('0x2a')]=function(_0x51836c,_0x32a207){return db[_0x898a('0x46')]['find']({'where':{'id':_0x51836c[_0x898a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x32a207,null))[_0x898a('0x2e')](removeEntity(_0x32a207,null))['catch'](handleError(_0x32a207,null));};exports[_0x898a('0x6d')]=function(_0x387f2c,_0x3b07dc){return db[_0x898a('0x46')][_0x898a('0x6d')]()[_0x898a('0x2e')](respondWithResult(_0x3b07dc,null))[_0x898a('0x20')](handleError(_0x3b07dc,null));};exports[_0x898a('0x6e')]=function(_0x1f46b5,_0x59073f){if(_0x1f46b5[_0x898a('0x61')]['id']){delete _0x1f46b5[_0x898a('0x61')]['id'];}return db[_0x898a('0x46')][_0x898a('0x5f')]({'where':{'id':_0x1f46b5[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x59073f,null))[_0x898a('0x2e')](function(_0x4bcf85){if(_0x4bcf85){_0x1f46b5[_0x898a('0x61')][_0x898a('0x6f')]=_0x4bcf85['id'];return db['Disposition']['create'](_0x1f46b5[_0x898a('0x61')]);}})[_0x898a('0x2e')](respondWithResult(_0x59073f,null))['catch'](handleError(_0x59073f,null));};exports['getDispositions']=function(_0x34e1f2,_0x4a79a4){var _0x2fdeb5={'raw':![],'where':{}};var _0x41077f={};var _0x5dbe6c={'count':0x0,'rows':[]};return db[_0x898a('0x46')][_0x898a('0x70')]({'where':{'id':_0x34e1f2[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x4a79a4,null))[_0x898a('0x2e')](function(_0x2d047a){if(_0x2d047a){_0x41077f[_0x898a('0x41')]=_['keys'](db[_0x898a('0x71')][_0x898a('0x5d')]);_0x41077f[_0x898a('0x4a')]=_['keys'](_0x34e1f2[_0x898a('0x4a')]);_0x41077f[_0x898a('0x53')]=_['intersection'](_0x41077f[_0x898a('0x41')],_0x41077f['query']);_0x2fdeb5['attributes']=_['intersection'](_0x41077f[_0x898a('0x41')],qs[_0x898a('0x4d')](_0x34e1f2[_0x898a('0x4a')][_0x898a('0x4d')]));_0x2fdeb5[_0x898a('0x4c')]=_0x2fdeb5[_0x898a('0x4c')][_0x898a('0x4e')]?_0x2fdeb5['attributes']:_0x41077f[_0x898a('0x41')];if(!_0x34e1f2['query'][_0x898a('0x72')](_0x898a('0x4f'))){_0x2fdeb5['limit']=qs[_0x898a('0x24')](_0x34e1f2[_0x898a('0x4a')][_0x898a('0x24')]);_0x2fdeb5[_0x898a('0x27')]=qs[_0x898a('0x27')](_0x34e1f2['query']['offset']);}_0x2fdeb5['order']=qs[_0x898a('0x51')](_0x34e1f2[_0x898a('0x4a')][_0x898a('0x51')]);_0x2fdeb5['where']=qs[_0x898a('0x53')](_['pick'](_0x34e1f2['query'],_0x41077f[_0x898a('0x53')]));_0x2fdeb5[_0x898a('0x52')][_0x898a('0x6f')]=_0x2d047a['id'];if(_0x34e1f2[_0x898a('0x4a')][_0x898a('0x55')]){_0x2fdeb5[_0x898a('0x52')]=_[_0x898a('0x56')](_0x2fdeb5[_0x898a('0x52')],{'$or':_[_0x898a('0x45')](_0x2fdeb5[_0x898a('0x4c')],function(_0x5ce499){var _0x122682={};_0x122682[_0x5ce499]={'$like':'%'+_0x34e1f2[_0x898a('0x4a')][_0x898a('0x55')]+'%'};return _0x122682;})});}_0x2fdeb5=_[_0x898a('0x56')]({},_0x2fdeb5,_0x34e1f2[_0x898a('0x57')]);return db['Disposition'][_0x898a('0x26')]({'where':_0x2fdeb5[_0x898a('0x52')]})[_0x898a('0x2e')](function(_0xc187e7){_0x5dbe6c[_0x898a('0x26')]=_0xc187e7;if(_0x34e1f2[_0x898a('0x4a')][_0x898a('0x5e')]){_0x2fdeb5[_0x898a('0x58')]=[{'all':!![]}];}return db[_0x898a('0x71')][_0x898a('0x59')](_0x2fdeb5);})[_0x898a('0x2e')](function(_0x381071){_0x5dbe6c['rows']=_0x381071;return _0x5dbe6c;});}})[_0x898a('0x2e')](respondWithFilteredResult(_0x4a79a4,_0x2fdeb5))['catch'](handleError(_0x4a79a4,null));};exports[_0x898a('0x73')]=function(_0x34e463,_0xc510c0){return db['ChatWebsite'][_0x898a('0x5f')]({'where':{'id':_0x34e463[_0x898a('0x5b')]['id']}})['then'](handleEntityNotFound(_0xc510c0,null))[_0x898a('0x2e')](function(_0x3ebb81){if(_0x3ebb81){return _0x3ebb81[_0x898a('0x73')](_0x34e463[_0x898a('0x4a')][_0x898a('0x74')]);}})[_0x898a('0x2e')](respondWithStatusCode(_0xc510c0,null))['catch'](handleError(_0xc510c0,null));};exports['addAnswer']=function(_0x19b6f4,_0x4b7334){if(_0x19b6f4[_0x898a('0x61')]['id']){delete _0x19b6f4[_0x898a('0x61')]['id'];}return db[_0x898a('0x46')][_0x898a('0x5f')]({'where':{'id':_0x19b6f4[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x4b7334,null))['then'](function(_0x4d7431){if(_0x4d7431){_0x19b6f4[_0x898a('0x61')]['ChatWebsiteId']=_0x4d7431['id'];return db[_0x898a('0x75')][_0x898a('0x60')](_0x19b6f4['body']);}})[_0x898a('0x2e')](respondWithResult(_0x4b7334,null))['catch'](handleError(_0x4b7334,null));};exports[_0x898a('0x76')]=function(_0xc8763f,_0xed8829){var _0x5ef14d={'raw':![],'where':{}};var _0x546c80={};var _0x541241={'count':0x0,'rows':[]};return db[_0x898a('0x46')][_0x898a('0x70')]({'where':{'id':_0xc8763f[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0xed8829,null))[_0x898a('0x2e')](function(_0x1c989f){if(_0x1c989f){_0x546c80['model']=_[_0x898a('0x49')](db[_0x898a('0x75')]['rawAttributes']);_0x546c80['query']=_[_0x898a('0x49')](_0xc8763f[_0x898a('0x4a')]);_0x546c80['filters']=_[_0x898a('0x4b')](_0x546c80['model'],_0x546c80[_0x898a('0x4a')]);_0x5ef14d[_0x898a('0x4c')]=_[_0x898a('0x4b')](_0x546c80[_0x898a('0x41')],qs[_0x898a('0x4d')](_0xc8763f[_0x898a('0x4a')][_0x898a('0x4d')]));_0x5ef14d[_0x898a('0x4c')]=_0x5ef14d[_0x898a('0x4c')][_0x898a('0x4e')]?_0x5ef14d[_0x898a('0x4c')]:_0x546c80[_0x898a('0x41')];if(!_0xc8763f[_0x898a('0x4a')][_0x898a('0x72')](_0x898a('0x4f'))){_0x5ef14d['limit']=qs['limit'](_0xc8763f['query'][_0x898a('0x24')]);_0x5ef14d['offset']=qs[_0x898a('0x27')](_0xc8763f[_0x898a('0x4a')][_0x898a('0x27')]);}_0x5ef14d[_0x898a('0x50')]=qs[_0x898a('0x51')](_0xc8763f[_0x898a('0x4a')][_0x898a('0x51')]);_0x5ef14d[_0x898a('0x52')]=qs['filters'](_[_0x898a('0x54')](_0xc8763f['query'],_0x546c80['filters']));_0x5ef14d['where'][_0x898a('0x6f')]=_0x1c989f['id'];if(_0xc8763f['query'][_0x898a('0x55')]){_0x5ef14d[_0x898a('0x52')]=_[_0x898a('0x56')](_0x5ef14d['where'],{'$or':_['map'](_0x5ef14d[_0x898a('0x4c')],function(_0x2f3d65){var _0x3a1bc5={};_0x3a1bc5[_0x2f3d65]={'$like':'%'+_0xc8763f[_0x898a('0x4a')][_0x898a('0x55')]+'%'};return _0x3a1bc5;})});}_0x5ef14d=_[_0x898a('0x56')]({},_0x5ef14d,_0xc8763f[_0x898a('0x57')]);return db[_0x898a('0x75')][_0x898a('0x26')]({'where':_0x5ef14d['where']})[_0x898a('0x2e')](function(_0x21a4f6){_0x541241['count']=_0x21a4f6;if(_0xc8763f[_0x898a('0x4a')][_0x898a('0x5e')]){_0x5ef14d[_0x898a('0x58')]=[{'all':!![]}];}return db[_0x898a('0x75')][_0x898a('0x59')](_0x5ef14d);})['then'](function(_0xe3fea){_0x541241[_0x898a('0x5a')]=_0xe3fea;return _0x541241;});}})[_0x898a('0x2e')](respondWithFilteredResult(_0xed8829,_0x5ef14d))[_0x898a('0x20')](handleError(_0xed8829,null));};exports['removeAnswers']=function(_0x58f08e,_0x2724e1){return db['ChatWebsite'][_0x898a('0x5f')]({'where':{'id':_0x58f08e[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x2724e1,null))[_0x898a('0x2e')](function(_0x32cbfa){if(_0x32cbfa){return _0x32cbfa[_0x898a('0x77')](_0x58f08e[_0x898a('0x4a')]['ids']);}})[_0x898a('0x2e')](respondWithStatusCode(_0x2724e1,null))['catch'](handleError(_0x2724e1,null));};exports[_0x898a('0x78')]=function(_0x110a2d,_0x5b8504){_0x110a2d[_0x898a('0x61')][_0x898a('0x79')]=_0x110a2d[_0x898a('0x7a')][_0x898a('0x7b')];return db[_0x898a('0x46')][_0x898a('0x5f')]({'where':{'id':_0x110a2d[_0x898a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5b8504,null))[_0x898a('0x2e')](saveUpdates(_0x110a2d[_0x898a('0x61')],null))[_0x898a('0x2e')](respondWithResult(_0x5b8504,null))[_0x898a('0x20')](handleError(_0x5b8504,null));};exports[_0x898a('0x7c')]=function(_0x171691,_0x1259f0){_0x171691['body'][_0x898a('0x7d')]=_0x171691[_0x898a('0x7a')]['filename'];return db['ChatWebsite'][_0x898a('0x5f')]({'where':{'id':_0x171691['params']['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x1259f0,null))[_0x898a('0x2e')](saveUpdates(_0x171691[_0x898a('0x61')],null))['then'](respondWithResult(_0x1259f0,null))[_0x898a('0x20')](handleError(_0x1259f0,null));};exports[_0x898a('0x7e')]=function(_0xdef811,_0x1777a9){_0xdef811[_0x898a('0x61')][_0x898a('0x7f')]=_0xdef811[_0x898a('0x7a')][_0x898a('0x7b')];return db[_0x898a('0x46')][_0x898a('0x5f')]({'where':{'id':_0xdef811['params']['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x1777a9,null))[_0x898a('0x2e')](saveUpdates(_0xdef811[_0x898a('0x61')],null))[_0x898a('0x2e')](respondWithResult(_0x1777a9,null))[_0x898a('0x20')](handleError(_0x1777a9,null));};exports[_0x898a('0x80')]=function(_0x31b0d8,_0x4863aa){_0x31b0d8['body'][_0x898a('0x81')]=_0x31b0d8[_0x898a('0x7a')]['filename'];return db[_0x898a('0x46')]['find']({'where':{'id':_0x31b0d8[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x4863aa,null))['then'](saveUpdates(_0x31b0d8[_0x898a('0x61')],null))[_0x898a('0x2e')](respondWithResult(_0x4863aa,null))[_0x898a('0x20')](handleError(_0x4863aa,null));};exports['getLogo']=function(_0x5b7790,_0x5a0689){var _0x1cabde=path[_0x898a('0x82')](config['root'],_0x898a('0x83'));var _0x4a9c3b={'where':{'id':_0x5b7790[_0x898a('0x5b')]['id']},'attributes':['id',_0x898a('0x79')],'raw':!![]};var _0x210ce7=![];return require(_0x898a('0x84'))[_0x898a('0x85')]()[_0x898a('0x2e')](function(_0x389fda){if(_0x389fda){_0x210ce7=_0x389fda[_0x898a('0x86')];}})[_0x898a('0x2e')](function(){return db[_0x898a('0x46')][_0x898a('0x5f')](_0x4a9c3b);})[_0x898a('0x2e')](handleEntityNotFound(_0x5a0689,null))[_0x898a('0x2e')](function(_0x5e76f2){if(_0x5e76f2){if(!_['isNil'](_0x5e76f2[_0x898a('0x79')])){if(fs[_0x898a('0x87')](path[_0x898a('0x82')](config[_0x898a('0x88')],_0x898a('0x89'),_0x5e76f2[_0x898a('0x79')]))&&_0x210ce7){_0x1cabde=path[_0x898a('0x82')](config['root'],_0x898a('0x89'),_0x5e76f2[_0x898a('0x79')]);}}return _0x5a0689[_0x898a('0x8a')](_0x1cabde);}})[_0x898a('0x20')](handleError(_0x5a0689,null));};exports['getAvatar']=function(_0x41b9e1,_0x1cbc52){var _0xbadb62=path[_0x898a('0x82')](config['root'],_0x898a('0x8b'));var _0xba9062={'where':{'id':_0x41b9e1[_0x898a('0x5b')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0xba9062)[_0x898a('0x2e')](handleEntityNotFound(_0x1cbc52,null))['then'](function(_0x40b532){if(_0x40b532){if(!_[_0x898a('0x8c')](_0x40b532[_0x898a('0x7d')])){if(fs[_0x898a('0x87')](path[_0x898a('0x82')](config['root'],_0x898a('0x8d'),_0x40b532[_0x898a('0x7d')]))){_0xbadb62=path[_0x898a('0x82')](config[_0x898a('0x88')],_0x898a('0x8d'),_0x40b532[_0x898a('0x7d')]);}}return _0x1cbc52[_0x898a('0x8a')](_0xbadb62);}})[_0x898a('0x20')](handleError(_0x1cbc52,null));};exports['getCustomerAvatar']=function(_0x2f1a65,_0x167a4d){var _0x2614e7=path[_0x898a('0x82')](config[_0x898a('0x88')],_0x898a('0x8e'));var _0x1779db={'where':{'id':_0x2f1a65[_0x898a('0x5b')]['id']},'attributes':['id',_0x898a('0x7f'),_0x898a('0x8f')],'raw':!![]};return db['ChatWebsite']['find'](_0x1779db)['then'](handleEntityNotFound(_0x167a4d,null))[_0x898a('0x2e')](function(_0x380ae7){if(_0x380ae7){if(!_[_0x898a('0x8c')](_0x380ae7[_0x898a('0x7f')])){if(fs[_0x898a('0x87')](path['join'](config[_0x898a('0x88')],_0x898a('0x8d'),_0x380ae7[_0x898a('0x7f')]))&&_0x380ae7[_0x898a('0x8f')]){_0x2614e7=path['join'](config[_0x898a('0x88')],_0x898a('0x8d'),_0x380ae7[_0x898a('0x7f')]);}}return _0x167a4d[_0x898a('0x8a')](_0x2614e7);}})[_0x898a('0x20')](handleError(_0x167a4d,null));};exports['getSystemAvatar']=function(_0x199a17,_0x4a862e){var _0x5367d5=path[_0x898a('0x82')](config['root'],_0x898a('0x90'));var _0x3359c1={'where':{'id':_0x199a17[_0x898a('0x5b')]['id']},'attributes':['id',_0x898a('0x81')],'raw':!![]};return db[_0x898a('0x46')][_0x898a('0x5f')](_0x3359c1)[_0x898a('0x2e')](handleEntityNotFound(_0x4a862e,null))[_0x898a('0x2e')](function(_0xa1c4a2){if(_0xa1c4a2){if(!_[_0x898a('0x8c')](_0xa1c4a2[_0x898a('0x81')])){if(fs[_0x898a('0x87')](path[_0x898a('0x82')](config['root'],_0x898a('0x8d'),_0xa1c4a2['systemAvatar']))){_0x5367d5=path[_0x898a('0x82')](config[_0x898a('0x88')],'server/files/images/avatars/',_0xa1c4a2[_0x898a('0x81')]);}}return _0x4a862e['download'](_0x5367d5);}})[_0x898a('0x20')](handleError(_0x4a862e,null));};function checkWebsiteInterval(_0x8054b){var _0x5aa358=_0x8054b[_0x898a('0x91')];if(!_0x5aa358){return Promise[_0x898a('0x92')](_0x8054b);}var _0x877820=_0x8054b[_0x898a('0x93')]||undefined;return _0x5aa358[_0x898a('0x94')](_0x877820)['then'](function(_0x285f0e){if(!_0x285f0e){throw new APIOutOfIntervalError();}return _0x8054b;});}exports[_0x898a('0x95')]=function(_0x4e759e,_0x4f1ff1){var _0xb64850={'body':_0x4e759e[_0x898a('0x61')],'channel':'chat'};var _0x51c0c2=[];var _0x1bfbc3=[];var _0x4de42c={};var _0xb1d9c4=![];if(_0x4e759e['body']['id']){delete _0x4e759e[_0x898a('0x61')]['id'];}if(_['isNil'](_0x4e759e['body'][_0x898a('0x96')])){throw new APIBadRequestError(_0x898a('0x97'));}if(_[_0x898a('0x8c')](_0x4e759e[_0x898a('0x61')][_0x898a('0x98')])){throw new APIBadRequestError(_0x898a('0x99'));}if(_[_0x898a('0x9a')](_0x4e759e[_0x898a('0x61')][_0x898a('0x61')])){throw new APIBadRequestError(_0x898a('0x9b'));}var _0x2dd49c=_0x4e759e['body'][_0x898a('0x33')]&&_0x4e759e[_0x898a('0x61')][_0x898a('0x9c')];return db[_0x898a('0x9d')]['describe']()['then'](function(_0x3522d2){if(!_0x3522d2){throw new Error(_0x898a('0x9e'));}_0x51c0c2=Object[_0x898a('0x49')](_0x3522d2)['filter'](function(_0x3f622a){return![_0x898a('0x9f'),_0x898a('0xa0')][_0x898a('0xa1')](_0x3f622a);});_0x1bfbc3=Object[_0x898a('0x49')](_0x3522d2)[_0x898a('0x55')](function(_0x54de91){return![_0x898a('0x9f'),_0x898a('0xa0'),_0x898a('0xa2'),_0x898a('0xa3')][_0x898a('0xa1')](_0x54de91);});if(!_[_0x898a('0xa1')](_0x1bfbc3,_0x4e759e['body'][_0x898a('0x98')])){throw new APIBadRequestError(_0x898a('0xa4')+_0x1bfbc3[_0x898a('0x82')](',\x20'));}_0x4de42c[_0x4e759e[_0x898a('0x61')]['mapKey']]=_0x4e759e[_0x898a('0x61')][_0x898a('0x96')];})[_0x898a('0x2e')](function(){return db[_0x898a('0x46')][_0x898a('0x5f')]({'where':{'id':_0x4e759e['params']['id']},'include':[{'model':db[_0x898a('0xa5')],'as':'List','include':[{'model':db[_0x898a('0x9d')],'as':_0x898a('0xa6'),'where':_0x4de42c,'limit':0x1,'order':[[_0x898a('0xa0'),'DESC']]}]},{'model':db[_0x898a('0xa7')],'as':'Applications'},{'model':db[_0x898a('0x91')],'as':_0x898a('0x91'),'include':[{'model':db[_0x898a('0x91')],'as':'Intervals','attributes':['id',_0x898a('0xa8')],'raw':!![]}]}]});})[_0x898a('0x2e')](function(_0x5a5762){if(!_0x5a5762){throw new APINotFoundError(util['format']('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x4e759e[_0x898a('0x5b')]['id']));}if(_0x2dd49c){return checkWebsiteInterval(_0x5a5762);}return _0x5a5762;})[_0x898a('0x2e')](function(_0x4e5adf){_0xb64850[_0x898a('0xa9')]=_0x4e5adf;_0xb64850[_0x898a('0xaa')]=_[_0x898a('0xab')](_0x4e5adf[_0x898a('0xac')],[_0x898a('0xad')],[_0x898a('0xae')]);if(_0xb64850['account']['Applications']){delete _0xb64850[_0x898a('0xa9')][_0x898a('0xac')];}_0xb64850[_0x898a('0xaf')]=_0x4e5adf[_0x898a('0xb0')]||{'id':_0x4e5adf[_0x898a('0xa3')]};if(_0xb64850[_0x898a('0xaf')]&&_0xb64850[_0x898a('0xaf')][_0x898a('0xa6')][_0x898a('0x4e')]){return _0xb64850[_0x898a('0xaf')][_0x898a('0xa6')][0x0];}var _0x271a04=_[_0x898a('0xb1')](_0x4e759e['body'],{'firstName':_0x4e759e[_0x898a('0x61')]['from'],'ListId':_0x4e5adf[_0x898a('0xa3')]});_0x271a04[_0x4e759e[_0x898a('0x61')]['mapKey']]=_0x4e759e[_0x898a('0x61')][_0x898a('0x96')];return db['CmContact']['create'](_0x271a04,{'fields':_0x51c0c2,'raw':!![]});})[_0x898a('0x2e')](function(_0x4a791f){_0xb64850['contact']=_0x4a791f;var _0x2e0593=createInteractionObject(_0x4e759e[_0x898a('0x5b')]['id'],_0x4e759e[_0x898a('0x61')],_0x4e759e['headers'],_0x4a791f);var _0x2f675e={'ChatWebsiteId':_0x4e759e[_0x898a('0x5b')]['id']};if(_0x4e759e[_0x898a('0x61')][_0x898a('0xb2')]){_0x2f675e[_0x898a('0xb2')]=_0x4e759e['body'][_0x898a('0xb2')];_0x2f675e[_0x898a('0xb3')]=![];return db[_0x898a('0xb4')][_0x898a('0x5f')]({'where':_0x2f675e})[_0x898a('0x2e')](function(_0x539518){var _0x3bd71e=_0x4e759e[_0x898a('0x61')][_0x898a('0x33')]&&_0x4e759e[_0x898a('0x61')][_0x898a('0x9c')];if(_0x539518){_0xb1d9c4=!![];return _0x539518;}else if(!_0x3bd71e&&_0x539518&&_0x539518[_0x898a('0xb3')]){throw new APIConflictError(_0x898a('0xb5'));}_0x2e0593[_0x898a('0xb2')]=_0x4e759e[_0x898a('0x61')][_0x898a('0xb2')];_0x2e0593[_0x898a('0xb6')]=_0x4e759e['body'][_0x898a('0xb6')];return db[_0x898a('0xb4')][_0x898a('0x60')](_0x2e0593);});}_0x2f675e[_0x898a('0xb7')]=_0x4a791f['id'];if(_0x4e759e[_0x898a('0x61')][_0x898a('0xb8')]&&_0x4e759e[_0x898a('0x61')]['interaction']['id']){_0x2f675e['id']=_0x4e759e[_0x898a('0x61')]['interaction']['id'];return db[_0x898a('0xb4')][_0x898a('0x5f')]({'where':_0x2f675e})[_0x898a('0x2e')](function(_0x5acc72){var _0x55b9ca=_0x4e759e[_0x898a('0x61')][_0x898a('0x33')]&&_0x4e759e[_0x898a('0x61')][_0x898a('0x9c')];if(!_0x55b9ca&&_0x5acc72&&_0x5acc72[_0x898a('0xb3')]){throw new APIConflictError(_0x898a('0xb5'));}else if(_0x5acc72){_0xb1d9c4=!![];return _0x5acc72;}else{return db[_0x898a('0xb4')][_0x898a('0x60')](_0x2e0593);}});}return db['ChatInteraction'][_0x898a('0x60')](_0x2e0593);})[_0x898a('0x2e')](function(_0x390503){if(!_0xb1d9c4){return _0x390503;}var _0x237a1c={'from':(_0xb64850['contact']['firstName']||'')+'\x20'+(_0xb64850[_0x898a('0xb9')][_0x898a('0x37')]||'')};if(_0x4e759e[_0x898a('0x61')]['threadId']&&_0x4e759e[_0x898a('0x61')]['messageId']&&_0x4e759e[_0x898a('0x61')][_0x898a('0xb2')]!=_0x4e759e[_0x898a('0x61')][_0x898a('0xba')]){_0x237a1c[_0x898a('0xb2')]=_0x4e759e[_0x898a('0x61')]['messageId'];}return _0x390503[_0x898a('0x29')](_0x237a1c);})[_0x898a('0x2e')](function(_0x1d6dff){_0xb64850['interaction']=_0x1d6dff['get']({'plain':!![]});_0xb64850[_0x898a('0xb8')]['created']=!_0xb1d9c4;if(_0xb64850[_0x898a('0xb8')][_0x898a('0xbb')]){if(_0xb64850[_0x898a('0xa9')][_0x898a('0xbc')]){_0xb64850[_0x898a('0xaa')]['push']({'id':0x0,'priority':_0xb64850[_0x898a('0xaa')][_0x898a('0x4e')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x898a('0xbd')});}}return db[_0x898a('0xbe')][_0x898a('0x60')]({'body':_0x4e759e[_0x898a('0x61')][_0x898a('0x61')],'ChatWebsiteId':_0x4e759e['params']['id'],'ChatInteractionId':_0x1d6dff['id'],'direction':'in','ContactId':_0xb64850[_0x898a('0xb9')]['id'],'AttachmentId':_0x4e759e[_0x898a('0x61')][_0x898a('0xbf')]});})[_0x898a('0x2e')](function(_0x4b0c1b){_0xb64850[_0x898a('0x1e')]=_0x4b0c1b;if(!_0xb64850[_0x898a('0xb8')][_0x898a('0xc0')]){return;}return db[_0x898a('0xc1')][_0x898a('0x5f')]({'attributes':['id','name'],'where':{'id':_0xb64850['interaction'][_0x898a('0xc0')]}});})[_0x898a('0x2e')](function(_0x24366d){if(_0x24366d){_0xb64850[_0x898a('0xaa')][_0x898a('0xc2')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x24366d[_0x898a('0x30')]+','+(_0xb64850[_0x898a('0xa9')][_0x898a('0xc3')]||0xa),'interval':_0x898a('0xbd')});_0xb64850[_0x898a('0xc4')]=!![];}if(!_0xb64850[_0x898a('0xb8')][_0x898a('0xc5')]){return;}return db[_0x898a('0xc6')][_0x898a('0x5f')]({'attributes':['id',_0x898a('0x30')],'where':{'id':_0xb64850[_0x898a('0xb8')][_0x898a('0xc5')]}});})[_0x898a('0x2e')](function(_0x46f2c5){if(_0x46f2c5){_0xb64850['applications'][_0x898a('0xc2')]({'id':0x0,'priority':0x1,'app':_0x898a('0xc7'),'appdata':_0x46f2c5[_0x898a('0x30')]+','+(_0xb64850[_0x898a('0xa9')][_0x898a('0xc8')]||0x12c),'interval':_0x898a('0xbd')});}return respondWithRpcPromise(_0x898a('0xc9'),_0x898a('0xca'),_0xb64850);})['then'](function(_0x2ca7ee){respondWithRpcPromise(_0x898a('0xcb'),_0x898a('0xcb'),{'event':'notify','message':_0x2ca7ee},client9002);return _0x2ca7ee;})[_0x898a('0x2e')](respondWithResult(_0x4f1ff1,null))[_0x898a('0x20')](APIHandleError(_0x4f1ff1));};exports['offline']=function(_0xf8a823,_0x3dc746){var _0x3ed2bf,_0x1def1b,_0x2ffba3;var _0x12ff13=[];var _0x2314a2={};var _0x2c5037=_0xf8a823[_0x898a('0xcc')]||[];var _0x57f3e1=[];var _0x230030;return db[_0x898a('0x9d')][_0x898a('0x6d')]()[_0x898a('0x2e')](function(_0x9a3e8c){if(!_0x9a3e8c){throw new db[(_0x898a('0xcd'))]['ValidationError'](_0x898a('0xce'));}_0x12ff13=_[_0x898a('0xcf')](_[_0x898a('0x49')](_0x9a3e8c),[_0x898a('0x9f'),_0x898a('0xa0'),_0x898a('0xa2'),'ListId']);if(_0xf8a823[_0x898a('0x61')]['id']){delete _0xf8a823[_0x898a('0x61')]['id'];}if(_[_0x898a('0x8c')](_0xf8a823[_0x898a('0x61')][_0x898a('0x96')])){throw _0x3dc746['status'](0x1f4)['send'](new db['Sequelize'][(_0x898a('0xd0'))]('from\x20is\x20mandatory'));}if(_[_0x898a('0x8c')](_0xf8a823[_0x898a('0x61')][_0x898a('0x61')])||_0xf8a823[_0x898a('0x61')][_0x898a('0x61')]===''){throw _0x3dc746[_0x898a('0x22')](0x1f4)[_0x898a('0xd1')](new db[(_0x898a('0xcd'))][(_0x898a('0xd0'))](_0x898a('0xd2')));}if(_[_0x898a('0x8c')](_0xf8a823[_0x898a('0x61')][_0x898a('0xd3')])){throw _0x3dc746['status'](0x1f4)[_0x898a('0xd1')](new db[(_0x898a('0xcd'))]['ValidationError'](_0x898a('0xd4')+_0x12ff13));}if(!_[_0x898a('0xa1')](_0x12ff13,_0xf8a823[_0x898a('0x61')][_0x898a('0xd3')])){throw _0x3dc746[_0x898a('0x22')](0x1f4)[_0x898a('0xd1')](new db[(_0x898a('0xcd'))][(_0x898a('0xd0'))](_0x898a('0xd5')+_0x12ff13));}_0x2314a2[_0xf8a823['body'][_0x898a('0xd3')]]=_0xf8a823[_0x898a('0x61')][_0x898a('0x96')];})[_0x898a('0x2e')](function(){return db[_0x898a('0x46')][_0x898a('0x5f')]({'where':{'id':_0xf8a823[_0x898a('0x5b')]['id']},'include':[{'model':db[_0x898a('0xa5')],'as':_0x898a('0xb0')},{'model':db[_0x898a('0xd6')],'as':_0x898a('0xd6')}]});})[_0x898a('0x2e')](handleEntityNotFound(_0x3dc746,null))[_0x898a('0x2e')](function(_0x3549f6){if(_0x3549f6&&_0x3549f6[_0x898a('0xb0')]){_0x1def1b=_0x3549f6;var _0x95287e=_[_0x898a('0xb1')](_0xf8a823['body'],{'firstName':_0xf8a823['body']['from'],'phone':_0xf8a823[_0x898a('0x61')][_0x898a('0x96')],'ListId':_0x3549f6[_0x898a('0xa3')]});_0x95287e[_0xf8a823[_0x898a('0x61')]['mapKeyOffline']]=_0xf8a823['body'][_0x898a('0x96')];return db[_0x898a('0x9d')][_0x898a('0xd7')]({'where':_0x2314a2,'defaults':_0x95287e});}})[_0x898a('0xd8')](function(_0xaa3b87){if(_0xaa3b87){_0x2ffba3=_0xaa3b87;var _0x1b4b54=fs['readFileSync'](path[_0x898a('0x82')](config['root'],_0x898a('0xd9')),'utf8');var _0x4d1b8b=ejs[_0x898a('0xda')](_0x1b4b54,{'body':_['toPairs'](_0xf8a823[_0x898a('0x61')][_0x898a('0x61')]),'bodyTitle':_0x1def1b[_0x898a('0xdb')]});return db[_0x898a('0xdc')][_0x898a('0x60')]({'body':_0x4d1b8b,'plainBody':htmlToText[_0x898a('0xdd')](_0x4d1b8b),'ContactId':_0xaa3b87['id'],'ChatWebsiteId':_0x1def1b['id']});}})[_0x898a('0x2e')](function(_0x3da4a5){_0x230030=_0x3da4a5;if(_0x2c5037['length']){var _0x194181=_0x2c5037['map'](function(_0x15663d){return{'name':_0x15663d[_0x898a('0xde')],'basename':_0x15663d[_0x898a('0x7b')],'type':_0x15663d[_0x898a('0xdf')],'ChatOfflineMessageId':_0x3da4a5['id']};});_0x57f3e1=_0x194181[_0x898a('0x45')](_0x4da5c9=>{var _0x2ae8b6={'filename':_0x4da5c9[_0x898a('0x30')],'path':path[_0x898a('0x82')](config[_0x898a('0x88')],_0x898a('0xe0'),'files',_0x898a('0xe1'),'offline-chat',_0x4da5c9['basename'])};return _0x2ae8b6;});if(!_0x1def1b[_0x898a('0xe2')]){return db[_0x898a('0xe3')][_0x898a('0xe4')](function(_0x3ab9b6){return db[_0x898a('0xe5')][_0x898a('0xe6')](_0x194181,{'transaction':_0x3ab9b6});});}}})[_0x898a('0x2e')](function(){if(_0x230030){_0x3ed2bf=_0x230030;return db[_0x898a('0xd6')][_0x898a('0x70')]({'where':{'service':!![]},'include':[{'model':db[_0x898a('0xe7')],'as':_0x898a('0xe8'),'raw':!![],'include':[{'model':db[_0x898a('0xe9')],'as':_0x898a('0xe9'),'raw':!![]}]}]});}})['then'](function(_0x4b2f30){if(_0x4b2f30&&_0x4b2f30[_0x898a('0xe8')]&&_0x1def1b['forwardOffline']&&_0x1def1b[_0x898a('0xea')]){var _0x216e76=_0x4b2f30['getSmtpOptions']();return respondWithRpcPromise(_0x898a('0xeb'),_0x898a('0xec'),{'account':_0x216e76,'message':{'from':util[_0x898a('0x3b')](_0x898a('0xed'),_0x4b2f30[_0x898a('0x30')],_0x4b2f30['email']||_0x4b2f30[_0x898a('0xe8')][_0x898a('0x66')]),'to':_0x1def1b[_0x898a('0xea')],'subject':_0x1def1b[_0x898a('0xee')],'html':_0x3ed2bf[_0x898a('0x61')],'attachments':_0x57f3e1}},client9003)[_0x898a('0x2e')](function(){return _0x3ed2bf;})[_0x898a('0x20')](function(_0x179513){logger[_0x898a('0x1d')](_0x179513);});}})[_0x898a('0x2e')](function(){if(_0x1def1b&&_0x1def1b[_0x898a('0xe2')]&&_0x1def1b[_0x898a('0xef')]){var _0x3d85b2=[];if(_0x2c5037[_0x898a('0x4e')]){_0x3d85b2=_0x2c5037[_0x898a('0x45')](function(_0x3065a2){return{'name':_0x3065a2[_0x898a('0xde')],'basename':_0x3065a2[_0x898a('0x7b')],'type':_0x3065a2['mimetype'],'ChatOfflineMessageId':_0x230030['id']};});}var _0x4dd1aa;if(!_[_0x898a('0x8c')](_0x1def1b['subjectOffline'])){var _0x46696c=_[_0x898a('0x45')](_0xf8a823[_0x898a('0x61')],function(_0x1fefd0){return _0x1fefd0;});var _0x244b0e=_['toPairsIn'](_0x46696c)[0x0];var _0x2ba5f8=_['mapValues'](_0x244b0e,function(_0x3c46d2){return _0x3c46d2;});_0x4dd1aa=_0x2ba5f8[0x1][_0x1def1b['subjectOffline']];}var _0x44f4c3={'from':_0x2ffba3[_0x898a('0xf0')],'firstName':_0x2ffba3[_0x898a('0xf1')],'lastName':_0x2ffba3[_0x898a('0x37')],'mapKey':_0x898a('0xf0'),'message':{'from':_0x2ffba3[_0x898a('0xf0')],'to':_0x1def1b['MailAccount'][_0x898a('0xf0')],'cc':'','subject':_['isNil'](_0x4dd1aa)?_0x1def1b['offlineMessageSubject']:_0x4dd1aa,'messageId':'','sentAt':new Date(),'attach':_0x3d85b2[_0x898a('0x4e')],'attachments':_0x3d85b2,'originChannel':_0x898a('0xf2'),'ChatWebsiteId':_0x1def1b['id'],'ChatOfflineMessageId':_0x3ed2bf['id'],'originTo':_0x1def1b['MailAccount'][_0x898a('0xf0')]},'body':_0x3ed2bf[_0x898a('0x61')]};var _0x4663fe={'account':{'id':_0x1def1b[_0x898a('0xef')]},'body':_0x44f4c3,'log':_0x898a('0xf3')};return respondWithRpcPromise('NotifyMailAccount',_0x898a('0xf4'),_0x4663fe,client9001)[_0x898a('0x2e')](function(){return _0x3ed2bf;})[_0x898a('0x20')](function(_0x456365){logger['error'](_0x456365);});}return;})[_0x898a('0x2e')](function(){if(_0x3ed2bf){return _0x3ed2bf;}})['then'](respondWithResult(_0x3dc746,null))[_0x898a('0x20')](function(){for(var _0x3712b0 of _0x2c5037){var _0x51f314=path['join'](config[_0x898a('0x88')],_0x898a('0xe0'),'files',_0x898a('0xe1'),'offline-chat',_0x3712b0[_0x898a('0x7b')]);fs_extra[_0x898a('0xf5')](_0x51f314)[_0x898a('0x20')](function(_0x4fc478){logger[_0x898a('0x1d')]('Could\x20not\x20remove\x20attachment\x20file',_0x51f314,_0x4fc478);});}});};exports[_0x898a('0xf6')]=function(_0x351def,_0x51ede4){return db[_0x898a('0xb4')]['find']({'where':{'id':_0x351def[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x51ede4,null))[_0x898a('0x2e')](function(_0x2e6706){if(_0x2e6706){return _0x2e6706['addInteraction'](_0x351def[_0x898a('0x61')][_0x898a('0x74')],_[_0x898a('0xf7')](_0x351def[_0x898a('0x61')],[_0x898a('0x74'),'id'])||{});}})[_0x898a('0x2e')](respondWithResult(_0x51ede4,null))[_0x898a('0x20')](handleError(_0x51ede4,null));};exports[_0x898a('0xf8')]=function(_0x19e347,_0x19c8ca){var _0x47a5bf={'raw':![],'where':{}};var _0xcc083a={};var _0x1370aa={'count':0x0,'rows':[]};return db[_0x898a('0x46')]['findOne']({'where':{'id':_0x19e347['params']['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x19c8ca,null))[_0x898a('0x2e')](function(_0x349289){if(_0x349289){_0xcc083a[_0x898a('0x41')]=_['keys'](db['ChatInteraction'][_0x898a('0x5d')]);_0xcc083a[_0x898a('0x4a')]=_[_0x898a('0x49')](_0x19e347[_0x898a('0x4a')]);_0xcc083a['filters']=_[_0x898a('0x4b')](_0xcc083a[_0x898a('0x41')],_0xcc083a[_0x898a('0x4a')]);_0x47a5bf[_0x898a('0x4c')]=_[_0x898a('0x4b')](_0xcc083a['model'],qs[_0x898a('0x4d')](_0x19e347[_0x898a('0x4a')][_0x898a('0x4d')]));_0x47a5bf[_0x898a('0x4c')]=_0x47a5bf[_0x898a('0x4c')]['length']?_0x47a5bf[_0x898a('0x4c')]:_0xcc083a['model'];if(!_0x19e347['query'][_0x898a('0x72')](_0x898a('0x4f'))){_0x47a5bf[_0x898a('0x24')]=qs['limit'](_0x19e347['query'][_0x898a('0x24')]);_0x47a5bf[_0x898a('0x27')]=qs['offset'](_0x19e347[_0x898a('0x4a')][_0x898a('0x27')]);}_0x47a5bf[_0x898a('0x50')]=qs['sort'](_0x19e347[_0x898a('0x4a')][_0x898a('0x51')]);_0x47a5bf[_0x898a('0x52')]=qs['filters'](_[_0x898a('0x54')](_0x19e347[_0x898a('0x4a')],_0xcc083a[_0x898a('0x53')]));_0x47a5bf[_0x898a('0x52')]['ChatWebsiteId']=_0x349289['id'];if(_0x19e347[_0x898a('0x4a')][_0x898a('0x55')]){_0x47a5bf[_0x898a('0x52')]=_['merge'](_0x47a5bf[_0x898a('0x52')],{'$or':_[_0x898a('0x45')](_0x47a5bf[_0x898a('0x4c')],function(_0x9ddbdd){var _0x2f3fba={};_0x2f3fba[_0x9ddbdd]={'$like':'%'+_0x19e347[_0x898a('0x4a')][_0x898a('0x55')]+'%'};return _0x2f3fba;})});}_0x47a5bf=_[_0x898a('0x56')]({},_0x47a5bf,_0x19e347['options']);return db['ChatInteraction']['count']({'where':_0x47a5bf[_0x898a('0x52')]})[_0x898a('0x2e')](function(_0x77571d){_0x1370aa[_0x898a('0x26')]=_0x77571d;if(_0x19e347[_0x898a('0x4a')][_0x898a('0x5e')]){_0x47a5bf[_0x898a('0x58')]=[{'model':db[_0x898a('0x9d')],'as':_0x898a('0xf9'),'required':![]},{'model':db[_0x898a('0xc1')],'as':_0x898a('0xfa'),'attributes':[_0x898a('0x30'),_0x898a('0xfb'),_0x898a('0xfc')],'required':![]},{'model':db[_0x898a('0xfd')],'as':'Tags','attributes':['id',_0x898a('0x30'),_0x898a('0xfe')],'where':_0x19e347[_0x898a('0x4a')][_0x898a('0xff')]?{'id':_0x19e347[_0x898a('0x4a')][_0x898a('0xff')]}:undefined,'required':_0x19e347[_0x898a('0x4a')][_0x898a('0xff')]?!![]:![]}];}return db[_0x898a('0xb4')]['findAll'](_0x47a5bf);})[_0x898a('0x2e')](function(_0x33cf8c){_0x1370aa[_0x898a('0x5a')]=_0x33cf8c;return _0x1370aa;});}})[_0x898a('0x2e')](respondWithFilteredResult(_0x19c8ca,_0x47a5bf))[_0x898a('0x20')](handleError(_0x19c8ca,null));};exports[_0x898a('0x100')]=function(_0x3bdd73,_0x51691a){var _0x4fede7=0x0;var _0x2ee5e0=0x0;var _0x47dece=![];var _0x33ab74;var _0xfc0299;return db[_0x898a('0x46')][_0x898a('0x5f')]({'where':{'id':_0x3bdd73[_0x898a('0x5b')]['id']},'include':[{'model':db[_0x898a('0x91')],'as':_0x898a('0x91'),'include':[{'model':db[_0x898a('0x91')],'as':_0x898a('0x101'),'attributes':['id',_0x898a('0xa8')]}]}]})['then'](handleEntityNotFound(_0x51691a,null))['then'](function(_0x284113){if(_0x284113){_0x33ab74=_0x284113;return _0x284113[_0x898a('0x102')]({'raw':!![]});}})[_0x898a('0x2e')](function(_0x16e208){if(_0x33ab74){if(_0x16e208){_0xfc0299=_0x16e208;}}return require(_0x898a('0x84'))['getLicense']();})[_0x898a('0x2e')](function(_0x18ac46){if(_0x18ac46){_0x2ee5e0=_0x18ac46[_0x898a('0x103')];_0x47dece=_0x18ac46[_0x898a('0x86')];}})['then'](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0x898a('0x2e')](function(_0x481584){_0x4fede7=_0x481584;if(_0x2ee5e0&&_0x481584>_0x2ee5e0){return db[_0x898a('0x104')][_0x898a('0x70')]({'where':{'id':0x1}})[_0x898a('0x2e')](function(_0x228aa0){if(_0x228aa0){_0x228aa0[_0x898a('0x105')](_0x898a('0x106'));}});}})['then'](function(){var _0x43ff97=_0x33ab74[_0x898a('0x91')];var _0x1bdfd2=_0x33ab74[_0x898a('0x93')]||undefined;return _0x43ff97?_0x43ff97[_0x898a('0x94')](_0x1bdfd2):!![];})[_0x898a('0x2e')](function(_0x41d16d){var _0x275c04=fs['readFileSync'](path[_0x898a('0x82')](config[_0x898a('0x88')],'server/files/chat/iframe.ejs'),_0x898a('0x107'));var _0x22ebe9=_0x898a('0x108');var _0x355f0c=![];var _0x2b10c4,_0x3d1004;if(_0x3bdd73[_0x898a('0x109')][_0x898a('0x9c')]){_0x2b10c4=new URL(_0x3bdd73['headers'][_0x898a('0x9c')])['origin'];}else if(_0x3bdd73[_0x898a('0x109')][_0x898a('0x10a')]){_0x2b10c4=new URL(_0x3bdd73['headers'][_0x898a('0x10a')])[_0x898a('0x10a')];}else{_0x2b10c4=_0x898a('0x10b');}_0x3d1004=typeof _0x33ab74[_0x898a('0x6a')][_0x898a('0x36')](',')[_0x898a('0x5f')](function(_0x4bbe0d){return wildcardUtils['testWebsiteWithWildcard'](_0x4bbe0d,_0x2b10c4);})!==_0x898a('0x25');var _0x575c4c={'chatVersion':_0x22ebe9,'chatWebsiteAddressOrigin':_0x3d1004?_0x2b10c4:_0x33ab74['address'],'remote':_0x33ab74['remote'],'query':querystring[_0x898a('0x1c')](_[_0x898a('0x56')](_0x33ab74[_0x898a('0x2b')]({'plain':!![]}),{'customerIp':_0x3bdd73[_0x898a('0x109')][_0x898a('0x34')]||_0x3bdd73['headers'][_0x898a('0x10c')]||_0x3bdd73['connection']['remoteAddress']||_0x3bdd73['ip'],'referer':_0x3bdd73[_0x898a('0x109')][_0x898a('0x9c')],'openedInteractions':_0x4fede7,'maxInteractions':_0x2ee5e0,'virtual':_0x47dece['virtual'],'online':_0x41d16d,'custom':_0x47dece,'address':_0x3d1004?_0x2b10c4:null}))['replace'](/'/g,'\x5c\x27')};_0x51691a[_0x898a('0xd1')](ejs[_0x898a('0xda')](Mustache['render'](_0x275c04,_0x575c4c),{'proactiveActions':_0xfc0299,'alignment':_0x33ab74['alignment'],'verticalAlignment':_0x33ab74[_0x898a('0x10d')],'div_color':_0x33ab74['color'],'labelText':_0x33ab74['labelText'],'text_color':_0x33ab74['textColor'],'text_button_color':_0x33ab74[_0x898a('0x10e')],'button_color':_0x33ab74[_0x898a('0x10f')],'background_color':_0x33ab74[_0x898a('0x110')],'hideWhenOffline':_0x33ab74['hideWhenOffline'],'intervalId':_0x33ab74[_0x898a('0x111')],'isDevelopment':_0x355f0c,'chatVersion':_0x22ebe9}));})[_0x898a('0x20')](handleError(_0x51691a,null));};exports['addApplications']=function(_0x4dbc0e,_0x2d4890){var _0x1f1d55=_0x4dbc0e[_0x898a('0x5b')]['id'];var _0x1d1f9c=_0x4dbc0e[_0x898a('0x61')];var _0x358118=0xc8;var _0xd58e7d=null;return db[_0x898a('0xe3')][_0x898a('0xe4')]({'isolationLevel':db[_0x898a('0xe3')]['Transaction'][_0x898a('0x112')][_0x898a('0x113')]},function(_0x4a0e51){return db[_0x898a('0x46')][_0x898a('0x70')]({'where':{'id':_0x1f1d55},'transaction':_0x4a0e51})[_0x898a('0x2e')](function(_0x725e3f){if(_0x725e3f){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x1f1d55},'transaction':_0x4a0e51})['then'](function(){var _0x347450=_[_0x898a('0x45')](_0x1d1f9c,function(_0x343bf3){_0x343bf3[_0x898a('0x6f')]=_0x1f1d55;return _0x343bf3;});return db['ChatApplication']['bulkCreate'](_0x347450,{'transaction':_0x4a0e51});});}else{_0x358118=0x194;_0xd58e7d=[];}});})[_0x898a('0x2e')](function(){if(_0x358118!==0x194){return db[_0x898a('0xa7')][_0x898a('0x114')]({'where':{'ChatWebsiteId':_0x1f1d55},'order':'priority'})['then'](function(_0x8b63e0){_0xd58e7d=_0x8b63e0;});}})[_0x898a('0x20')](function(_0x21a249){_0x358118=0x1f4;logger[_0x898a('0x1d')](_0x21a249[_0x898a('0x115')]);if(_0x21a249[_0x898a('0x30')]){delete _0x21a249[_0x898a('0x30')];}_0xd58e7d=_0x21a249;})[_0x898a('0x116')](function(){if(_0xd58e7d===null){_0x2d4890[_0x898a('0x2f')](_0x358118);}else{if(_0x358118===0x1f4){_0x2d4890[_0x898a('0x22')](_0x358118)['send'](_0xd58e7d);}else{_0x2d4890[_0x898a('0x22')](_0x358118)[_0x898a('0x23')](_0xd58e7d);}}});};exports[_0x898a('0x117')]=function(_0x26bc49,_0x1ed373){var _0x59200f={};var _0x3b84bb={};var _0x1b5e6a;var _0x210f31;return db[_0x898a('0x46')][_0x898a('0x70')]({'where':{'id':_0x26bc49['params']['id']}})['then'](handleEntityNotFound(_0x1ed373,null))[_0x898a('0x2e')](function(_0x1e57a2){if(_0x1e57a2){_0x1b5e6a=_0x1e57a2;_0x3b84bb['model']=_[_0x898a('0x49')](db['ChatApplication'][_0x898a('0x5d')]);_0x3b84bb[_0x898a('0x4a')]=_[_0x898a('0x49')](_0x26bc49['query']);_0x3b84bb[_0x898a('0x53')]=_[_0x898a('0x4b')](_0x3b84bb[_0x898a('0x41')],_0x3b84bb['query']);_0x59200f[_0x898a('0x4c')]=_[_0x898a('0x4b')](_0x3b84bb[_0x898a('0x41')],qs[_0x898a('0x4d')](_0x26bc49[_0x898a('0x4a')][_0x898a('0x4d')]));_0x59200f[_0x898a('0x4c')]=_0x59200f[_0x898a('0x4c')][_0x898a('0x4e')]?_0x59200f[_0x898a('0x4c')]:_0x3b84bb[_0x898a('0x41')];_0x59200f[_0x898a('0x50')]=qs['sort'](_0x26bc49[_0x898a('0x4a')]['sort']);_0x59200f[_0x898a('0x52')]=qs['filters'](_[_0x898a('0x54')](_0x26bc49[_0x898a('0x4a')],_0x3b84bb[_0x898a('0x53')]));if(_0x26bc49['query'][_0x898a('0x55')]){_0x59200f[_0x898a('0x52')]=_[_0x898a('0x56')](_0x59200f[_0x898a('0x52')],{'$or':_[_0x898a('0x45')](_0x59200f[_0x898a('0x4c')],function(_0x5db4ae){var _0xa752f6={};_0xa752f6[_0x5db4ae]={'$like':'%'+_0x26bc49[_0x898a('0x4a')][_0x898a('0x55')]+'%'};return _0xa752f6;})});}_0x59200f=_[_0x898a('0x56')]({},_0x59200f,_0x26bc49[_0x898a('0x57')]);return _0x1b5e6a[_0x898a('0x117')](_0x59200f);}})[_0x898a('0x2e')](function(_0x2caedd){if(_0x2caedd){_0x210f31=_0x2caedd[_0x898a('0x4e')];if(!_0x26bc49['query']['hasOwnProperty']('nolimit')){_0x59200f[_0x898a('0x24')]=qs[_0x898a('0x24')](_0x26bc49[_0x898a('0x4a')][_0x898a('0x24')]);_0x59200f[_0x898a('0x27')]=qs[_0x898a('0x27')](_0x26bc49['query']['offset']);}return _0x1b5e6a['getApplications'](_0x59200f);}})[_0x898a('0x2e')](function(_0x514f08){if(_0x514f08){return _0x514f08?{'count':_0x210f31,'rows':_0x514f08}:null;}})[_0x898a('0x2e')](respondWithResult(_0x1ed373,null))[_0x898a('0x20')](handleError(_0x1ed373,null));};exports[_0x898a('0x118')]=function(_0x3930bd,_0xaa6842){return db[_0x898a('0x119')][_0x898a('0x5f')]({'where':{'id':_0x3930bd[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0xaa6842,null))[_0x898a('0x2e')](function(_0x162efb){if(_0x162efb){return _0x162efb[_0x898a('0x118')](_0x3930bd[_0x898a('0x61')][_0x898a('0x74')],_['omit'](_0x3930bd[_0x898a('0x61')],['ids','id'])||{});}})[_0x898a('0x2e')](respondWithResult(_0xaa6842,null))[_0x898a('0x20')](handleError(_0xaa6842,null));};exports[_0x898a('0x102')]=function(_0x5710fc,_0x3347f0){var _0x4fe5a6={};var _0xf18619={};var _0x59e163;var _0x2c56ff;return db[_0x898a('0x46')]['findOne']({'where':{'id':_0x5710fc[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x3347f0,null))[_0x898a('0x2e')](function(_0x1e2d7a){if(_0x1e2d7a){_0x59e163=_0x1e2d7a;_0xf18619['model']=_['keys'](db['ChatProactiveAction'][_0x898a('0x5d')]);_0xf18619[_0x898a('0x4a')]=_[_0x898a('0x49')](_0x5710fc[_0x898a('0x4a')]);_0xf18619[_0x898a('0x53')]=_[_0x898a('0x4b')](_0xf18619[_0x898a('0x41')],_0xf18619[_0x898a('0x4a')]);_0x4fe5a6[_0x898a('0x4c')]=_[_0x898a('0x4b')](_0xf18619['model'],qs[_0x898a('0x4d')](_0x5710fc['query'][_0x898a('0x4d')]));_0x4fe5a6[_0x898a('0x4c')]=_0x4fe5a6[_0x898a('0x4c')][_0x898a('0x4e')]?_0x4fe5a6[_0x898a('0x4c')]:_0xf18619[_0x898a('0x41')];_0x4fe5a6[_0x898a('0x50')]=qs[_0x898a('0x51')](_0x5710fc[_0x898a('0x4a')][_0x898a('0x51')]);_0x4fe5a6[_0x898a('0x52')]=qs['filters'](_['pick'](_0x5710fc[_0x898a('0x4a')],_0xf18619['filters']));if(_0x5710fc[_0x898a('0x4a')][_0x898a('0x55')]){_0x4fe5a6[_0x898a('0x52')]=_[_0x898a('0x56')](_0x4fe5a6[_0x898a('0x52')],{'$or':_[_0x898a('0x45')](_0x4fe5a6['attributes'],function(_0x360da6){var _0x24bec4={};_0x24bec4[_0x360da6]={'$like':'%'+_0x5710fc[_0x898a('0x4a')]['filter']+'%'};return _0x24bec4;})});}_0x4fe5a6=_[_0x898a('0x56')]({},_0x4fe5a6,_0x5710fc[_0x898a('0x57')]);return _0x59e163[_0x898a('0x102')](_0x4fe5a6);}})[_0x898a('0x2e')](function(_0x26afad){if(_0x26afad){_0x2c56ff=_0x26afad[_0x898a('0x4e')];if(!_0x5710fc[_0x898a('0x4a')][_0x898a('0x72')](_0x898a('0x4f'))){_0x4fe5a6['limit']=qs[_0x898a('0x24')](_0x5710fc[_0x898a('0x4a')]['limit']);_0x4fe5a6[_0x898a('0x27')]=qs['offset'](_0x5710fc[_0x898a('0x4a')][_0x898a('0x27')]);}return _0x59e163['getProactiveActions'](_0x4fe5a6);}})[_0x898a('0x2e')](function(_0x2213f4){if(_0x2213f4){return _0x2213f4?{'count':_0x2c56ff,'rows':_0x2213f4}:null;}})[_0x898a('0x2e')](respondWithResult(_0x3347f0,null))[_0x898a('0x20')](handleError(_0x3347f0,null));};exports[_0x898a('0x11a')]=function(_0x526133,_0x555cae){var _0x361eba=_0x526133['query'][_0x898a('0x11b')]==='false'?_0x898a('0x11c'):_0x898a('0x11d');return db[_0x898a('0x46')]['find']({'attributes':['id',_0x361eba],'where':{'id':_0x526133['params']['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x555cae,null))[_0x898a('0x2e')](function(_0x1d430e){if(_0x1d430e){var _0x18c54f=_0x1d430e[_0x361eba];var _0x14c03e=_0x18c54f&&_0x18c54f[_0x898a('0x11e')]?_0x18c54f[_0x898a('0x11e')]:[];_0x555cae[_0x898a('0xd1')]({'fromKey':_[_0x898a('0x8c')](_0x18c54f['fromKey'])?undefined:_0x18c54f[_0x898a('0x11f')],'count':_0x14c03e['length'],'rows':_0x14c03e});}})[_0x898a('0x20')](handleError(_0x555cae,null));};exports[_0x898a('0x120')]=function(_0x545403,_0x546610){var _0x1e4625={'raw':![],'where':{}};var _0x405be4={};var _0x1b1e9a={'count':0x0,'rows':[]};return db[_0x898a('0x46')][_0x898a('0x70')]({'where':{'id':_0x545403[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x546610,null))[_0x898a('0x2e')](function(_0x521d01){if(_0x521d01){_0x405be4[_0x898a('0x41')]=_[_0x898a('0x49')](db[_0x898a('0xdc')]['rawAttributes']);_0x405be4[_0x898a('0x4a')]=_['keys'](_0x545403[_0x898a('0x4a')]);_0x405be4[_0x898a('0x53')]=_[_0x898a('0x4b')](_0x405be4[_0x898a('0x41')],_0x405be4[_0x898a('0x4a')]);_0x1e4625[_0x898a('0x4c')]=_[_0x898a('0x4b')](_0x405be4['model'],qs[_0x898a('0x4d')](_0x545403[_0x898a('0x4a')][_0x898a('0x4d')]));_0x1e4625[_0x898a('0x4c')]=_0x1e4625[_0x898a('0x4c')][_0x898a('0x4e')]?_0x1e4625[_0x898a('0x4c')]:_0x405be4[_0x898a('0x41')];if(!_0x545403['query'][_0x898a('0x72')]('nolimit')){_0x1e4625['limit']=qs['limit'](_0x545403[_0x898a('0x4a')][_0x898a('0x24')]);_0x1e4625[_0x898a('0x27')]=qs[_0x898a('0x27')](_0x545403[_0x898a('0x4a')][_0x898a('0x27')]);}_0x1e4625[_0x898a('0x50')]=qs[_0x898a('0x51')](_0x545403['query'][_0x898a('0x51')]);_0x1e4625[_0x898a('0x52')]=qs['filters'](_[_0x898a('0x54')](_0x545403[_0x898a('0x4a')],_0x405be4['filters']));_0x1e4625[_0x898a('0x52')]['ChatWebsiteId']=_0x521d01['id'];if(_0x545403[_0x898a('0x4a')][_0x898a('0x55')]){_0x1e4625[_0x898a('0x52')]=_[_0x898a('0x56')](_0x1e4625['where'],{'$or':_[_0x898a('0x45')](_0x1e4625[_0x898a('0x4c')],function(_0x525d61){var _0x844e5e={};_0x844e5e[_0x525d61]={'$like':'%'+_0x545403[_0x898a('0x4a')][_0x898a('0x55')]+'%'};return _0x844e5e;})});}_0x1e4625=_[_0x898a('0x56')]({},_0x1e4625,_0x545403[_0x898a('0x57')]);return db[_0x898a('0xdc')][_0x898a('0x26')]({'where':_0x1e4625[_0x898a('0x52')]})[_0x898a('0x2e')](function(_0x10be38){_0x1b1e9a[_0x898a('0x26')]=_0x10be38;if(_0x545403[_0x898a('0x4a')][_0x898a('0x5e')]){_0x1e4625['include']=[{'all':!![]}];}else{_0x1e4625[_0x898a('0x58')]=[{'model':db[_0x898a('0x9d')],'as':_0x898a('0xf9'),'required':![]},{'model':db['Attachment'],'as':_0x898a('0x121'),'required':![]}];}return db[_0x898a('0xdc')][_0x898a('0x59')](_0x1e4625);})['then'](function(_0x199be5){_0x1b1e9a[_0x898a('0x5a')]=_0x199be5;return _0x1b1e9a;});}})['then'](respondWithFilteredResult(_0x546610,_0x1e4625))[_0x898a('0x20')](handleError(_0x546610,null));};exports[_0x898a('0x122')]=function(_0x13d875,_0x448fd7){return db[_0x898a('0x46')][_0x898a('0x5f')]({'where':{'id':_0x13d875['params']['id']}})['then'](handleEntityNotFound(_0x448fd7,null))['then'](function(_0x85aa2d){if(_0x85aa2d){return _0x85aa2d['addAgents'](_0x13d875[_0x898a('0x61')]['ids'],_[_0x898a('0xf7')](_0x13d875[_0x898a('0x61')],[_0x898a('0x74'),'id'])||{})['spread'](function(_0x3d092e){for(var _0x4f4e79=0x0;_0x4f4e79<_0x13d875['body']['ids'][_0x898a('0x4e')];_0x4f4e79+=0x1){socket['emit'](_0x898a('0x123'),{'UserId':Number(_0x13d875[_0x898a('0x61')][_0x898a('0x74')][_0x4f4e79]),'ChatWebsiteId':Number(_0x13d875[_0x898a('0x5b')]['id'])});}return _0x3d092e;});}})[_0x898a('0x2e')](respondWithResult(_0x448fd7,null))['catch'](handleError(_0x448fd7,null));};exports[_0x898a('0x124')]=function(_0x27e060,_0x2eff5c){return db[_0x898a('0x46')][_0x898a('0x5f')]({'where':{'id':_0x27e060[_0x898a('0x5b')]['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x2eff5c,null))[_0x898a('0x2e')](function(_0x31e8fa){if(_0x31e8fa){return _0x31e8fa['removeAgents'](_0x27e060[_0x898a('0x4a')][_0x898a('0x74')])['then'](function(){if(_[_0x898a('0x125')](_0x27e060[_0x898a('0x4a')][_0x898a('0x74')])){for(var _0x224868=0x0;_0x224868<_0x27e060[_0x898a('0x4a')][_0x898a('0x74')]['length'];_0x224868+=0x1){socket[_0x898a('0x126')](_0x898a('0x127'),{'UserId':Number(_0x27e060['query'][_0x898a('0x74')][_0x224868]),'ChatWebsiteId':Number(_0x27e060[_0x898a('0x5b')]['id'])});}}else{socket[_0x898a('0x126')](_0x898a('0x127'),{'UserId':Number(_0x27e060[_0x898a('0x4a')][_0x898a('0x74')]),'ChatWebsiteId':Number(_0x27e060['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2eff5c,null))[_0x898a('0x20')](handleError(_0x2eff5c,null));};exports[_0x898a('0x128')]=function(_0x227787,_0x3acb2f){var _0x35737f={};var _0x21c989={};var _0x1c02c5;var _0x1e93fa;return db[_0x898a('0x46')]['findOne']({'where':{'id':_0x227787['params']['id']}})[_0x898a('0x2e')](handleEntityNotFound(_0x3acb2f,null))[_0x898a('0x2e')](function(_0x255766){if(_0x255766){_0x1c02c5=_0x255766;_0x21c989[_0x898a('0x41')]=_[_0x898a('0x49')](db[_0x898a('0xc1')][_0x898a('0x5d')]);_0x21c989[_0x898a('0x4a')]=_[_0x898a('0x49')](_0x227787[_0x898a('0x4a')]);_0x21c989['filters']=_['intersection'](_0x21c989[_0x898a('0x41')],_0x21c989['query']);_0x35737f[_0x898a('0x4c')]=_[_0x898a('0x4b')](_0x21c989[_0x898a('0x41')],qs[_0x898a('0x4d')](_0x227787['query'][_0x898a('0x4d')]));_0x35737f[_0x898a('0x4c')]=_0x35737f[_0x898a('0x4c')]['length']?_0x35737f[_0x898a('0x4c')]:_0x21c989[_0x898a('0x41')];_0x35737f['order']=qs[_0x898a('0x51')](_0x227787[_0x898a('0x4a')][_0x898a('0x51')]);_0x35737f[_0x898a('0x52')]=qs[_0x898a('0x53')](_['pick'](_0x227787[_0x898a('0x4a')],_0x21c989['filters']));if(_0x227787['query']['filter']){_0x35737f[_0x898a('0x52')]=_[_0x898a('0x56')](_0x35737f[_0x898a('0x52')],{'$or':_[_0x898a('0x45')](_0x35737f[_0x898a('0x4c')],function(_0x3c57ac){var _0x54d0b2={};_0x54d0b2[_0x3c57ac]={'$like':'%'+_0x227787[_0x898a('0x4a')][_0x898a('0x55')]+'%'};return _0x54d0b2;})});}_0x35737f=_[_0x898a('0x56')]({},_0x35737f,_0x227787[_0x898a('0x57')]);return _0x1c02c5['getAgents'](_0x35737f);}})[_0x898a('0x2e')](function(_0x413331){if(_0x413331){_0x1e93fa=_0x413331[_0x898a('0x4e')];if(!_0x227787[_0x898a('0x4a')][_0x898a('0x72')](_0x898a('0x4f'))){_0x35737f[_0x898a('0x24')]=qs[_0x898a('0x24')](_0x227787['query'][_0x898a('0x24')]);_0x35737f[_0x898a('0x27')]=qs['offset'](_0x227787[_0x898a('0x4a')][_0x898a('0x27')]);}return _0x1c02c5[_0x898a('0x128')](_0x35737f);}})[_0x898a('0x2e')](function(_0x183ff5){if(_0x183ff5){return _0x183ff5?{'count':_0x1e93fa,'rows':_0x183ff5}:null;}})[_0x898a('0x2e')](respondWithResult(_0x3acb2f,null))[_0x898a('0x20')](handleError(_0x3acb2f,null));}; \ No newline at end of file +var _0x8ef6=['model','vendor','type','index','Pause','ChatWebsite','rawAttributes','fieldName','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','show','params','mandatoryDispositionPause','include','options','find','create','body','split','trim','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','role','get','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','address','forEach','testWildcardValidity','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','sitepic','file','agentAvatar','addCustomerAvatar','customerAvatar','filename','systemAvatar','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','existsSync','join','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','Interval','timezone','notify','chat','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','referer','CmContact','describe','createdAt','updatedAt','includes','ListId','from','CmList','List','Contacts','DESC','ChatApplication','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','orderBy','priority','asc','list','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','autoclose','applications','close','unmanaged','ChatMessage','AttachmentId','User','UserId','unshift','agent','forcedOwnership','queueId','queue','waitForTheAssignedQueue','*,*,*,*','Start','startRouting','EventManager','ValidationError','CompanyId','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','files','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','mimetype','toPairsIn','subjectOffline','Chat','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','fullname','internal','Tag','color','tag','getSnippet','getProactiveActions','getLicense','virtual','License','increment','chatLicenseExceeded','ifTime','server/files/chat/iframe.ejs','utf8','3.13.0','origin','http://localhost:9000','remote','x-real-ip','connection','remoteAddress','replace','render','alignment','labelText','color_button','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','../../errors/api','APIBadRequestError','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','end','offset','undefined','limit','count','Content-Range','json','update','then','destroy','ChatWebsites','stack','name','status','send','setUA','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device'];(function(_0x493552,_0x2cd527){var _0x243ea8=function(_0x531f6e){while(--_0x531f6e){_0x493552['push'](_0x493552['shift']());}};_0x243ea8(++_0x2cd527);}(_0x8ef6,0xf2));var _0x68ef=function(_0x50c8dd,_0x21cbfe){_0x50c8dd=_0x50c8dd-0x0;var _0x50e4c5=_0x8ef6[_0x50c8dd];return _0x50e4c5;};'use strict';var Mustache=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var ejs=require(_0x68ef('0x3'));var fs=require('fs');var fs_extra=require(_0x68ef('0x4'));var _=require(_0x68ef('0x5'));var querystring=require(_0x68ef('0x6'));var htmlToText=require('html-to-text');var Redis=require(_0x68ef('0x7'));var jayson=require(_0x68ef('0x8'));var qs=require(_0x68ef('0x9'));var logger=require(_0x68ef('0xa'))('api');var config=require('../../config/environment');var APIBadRequestError=require(_0x68ef('0xb'))[_0x68ef('0xc')];var APINotFoundError=require(_0x68ef('0xb'))['APINotFoundError'];var APIOutOfIntervalError=require(_0x68ef('0xb'))[_0x68ef('0xd')];var APIHandleError=require(_0x68ef('0xb'))[_0x68ef('0xe')];var APIConflictError=require(_0x68ef('0xb'))[_0x68ef('0xf')];var wildcardUtils=require(_0x68ef('0x10'));var URL=require(_0x68ef('0x11'))[_0x68ef('0x12')];var db=require(_0x68ef('0x13'))['db'];config[_0x68ef('0x14')]=_[_0x68ef('0x15')](config['redis'],{'host':_0x68ef('0x16'),'port':0x18eb});var socket=require(_0x68ef('0x17'))(new Redis(config[_0x68ef('0x14')]));require(_0x68ef('0x18'))[_0x68ef('0x19')](socket);var client=jayson[_0x68ef('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0x68ef('0x1a')][_0x68ef('0x1b')]({'port':0x232a});var client9003=jayson[_0x68ef('0x1a')]['http']({'port':0x232b});var client9001=jayson[_0x68ef('0x1a')][_0x68ef('0x1b')]({'port':0x2329});function respondWithRpcPromise(_0x24682d,_0x5005ba,_0x35493d,_0x37c4cc){return new Promise(function(_0x3d1e90,_0x3780a4){var _0x5c4456=_0x37c4cc||client;return _0x5c4456[_0x68ef('0x1c')](_0x24682d,_0x35493d)['then'](function(_0x5cbb78){logger[_0x68ef('0x1d')](_0x68ef('0x1e'),_0x5005ba,'request\x20sent');logger['debug'](_0x68ef('0x1f'),_0x5005ba,_0x68ef('0x20'),JSON[_0x68ef('0x21')](_0x5cbb78));if(_0x5cbb78['error']){if(_0x5cbb78[_0x68ef('0x22')][_0x68ef('0x23')]===0x1f4){logger[_0x68ef('0x22')]('ChatWebsite,\x20%s,\x20%s',_0x5005ba,_0x5cbb78[_0x68ef('0x22')][_0x68ef('0x24')]);return _0x3780a4(_0x5cbb78['error'][_0x68ef('0x24')]);}logger[_0x68ef('0x22')](_0x68ef('0x1e'),_0x5005ba,_0x5cbb78['error']['message']);return _0x3d1e90(_0x5cbb78['error'][_0x68ef('0x24')]);}else{logger[_0x68ef('0x1d')](_0x68ef('0x1e'),_0x5005ba,_0x68ef('0x20'));_0x3d1e90(_0x5cbb78[_0x68ef('0x25')][_0x68ef('0x24')]);}})[_0x68ef('0x26')](function(_0x49374f){logger[_0x68ef('0x22')](_0x68ef('0x1e'),_0x5005ba,_0x49374f);_0x3780a4(_0x49374f);});});}function respondWithStatusCode(_0x5e4dbe,_0x178460){_0x178460=_0x178460||0xcc;return function(_0x57f9ee){if(_0x57f9ee){return _0x5e4dbe['sendStatus'](_0x178460);}return _0x5e4dbe['status'](_0x178460)[_0x68ef('0x27')]();};}function respondWithResult(_0x268f32,_0x123041){_0x123041=_0x123041||0xc8;return function(_0x29518e){if(_0x29518e){return _0x268f32['status'](_0x123041)['json'](_0x29518e);}};}function respondWithFilteredResult(_0x1cbe4f,_0x28907a){return function(_0x7bf96){if(_0x7bf96){var _0x263b30=typeof _0x28907a[_0x68ef('0x28')]===_0x68ef('0x29')&&typeof _0x28907a[_0x68ef('0x2a')]===_0x68ef('0x29');var _0x5a6dfd=_0x7bf96[_0x68ef('0x2b')];var _0x4314bd=_0x263b30?0x0:_0x28907a[_0x68ef('0x28')];var _0x4c25aa=_0x263b30?_0x7bf96[_0x68ef('0x2b')]:_0x28907a['offset']+_0x28907a[_0x68ef('0x2a')];var _0x17588a;if(_0x4c25aa>=_0x5a6dfd){_0x4c25aa=_0x5a6dfd;_0x17588a=0xc8;}else{_0x17588a=0xce;}_0x1cbe4f['status'](_0x17588a);return _0x1cbe4f['set'](_0x68ef('0x2c'),_0x4314bd+'-'+_0x4c25aa+'/'+_0x5a6dfd)[_0x68ef('0x2d')](_0x7bf96);}return null;};}function saveUpdates(_0x4b8fc8){return function(_0xf58fa1){if(_0xf58fa1){return _0xf58fa1[_0x68ef('0x2e')](_0x4b8fc8)[_0x68ef('0x2f')](function(_0x2d1e9f){return _0x2d1e9f;});}return null;};}function removeEntity(_0x59e9fb){return function(_0x2c8bd0){if(_0x2c8bd0){return _0x2c8bd0[_0x68ef('0x30')]()['then'](function(){var _0x2f8de2=_0x2c8bd0['get']({'plain':!![]});var _0x14581d=_0x68ef('0x31');return db['UserProfileResource'][_0x68ef('0x30')]({'where':{'type':_0x14581d,'resourceId':_0x2f8de2['id']}})['then'](function(){return _0x2c8bd0;});})[_0x68ef('0x2f')](function(){_0x59e9fb['status'](0xcc)[_0x68ef('0x27')]();});}};}function handleEntityNotFound(_0x1444e0){return function(_0x798276){if(!_0x798276){_0x1444e0['sendStatus'](0x194);}return _0x798276;};}function handleError(_0x1f91c7,_0x485dc3){_0x485dc3=_0x485dc3||0x1f4;return function(_0x476938){logger['error'](_0x476938[_0x68ef('0x32')]);if(_0x476938[_0x68ef('0x33')]){delete _0x476938[_0x68ef('0x33')];}_0x1f91c7[_0x68ef('0x34')](_0x485dc3)[_0x68ef('0x35')](_0x476938);};}function createInteractionObject(_0xefd1d,_0x51ba3d,_0x294fba,_0x15a6ab){var _0x32074a=require('user-agent-parser');var _0x32eddd=new _0x32074a();var _0x3c5de6=_0x32eddd[_0x68ef('0x36')](_0x294fba['user-agent'])['getResult']();var _0x14f0fc=_0x51ba3d[_0x68ef('0x37')];if(_0x294fba[_0x68ef('0x38')]){_0x14f0fc=_0x294fba[_0x68ef('0x38')];}else if(_0x294fba[_0x68ef('0x39')]){_0x14f0fc=_[_0x68ef('0x3a')](_0x294fba[_0x68ef('0x39')]['split'](','));}return{'ContactId':_0x15a6ab['id'],'ChatWebsiteId':_0xefd1d,'from':(_0x15a6ab[_0x68ef('0x3b')]||'')+'\x20'+(_0x15a6ab[_0x68ef('0x3c')]||''),'customerIp':_0x14f0fc,'customerPort':_0x294fba[_0x68ef('0x3d')]?_0x294fba[_0x68ef('0x3d')]:null,'referer':_0x51ba3d['referer'],'browserName':_0x3c5de6[_0x68ef('0x3e')][_0x68ef('0x33')]&&_0x3c5de6[_0x68ef('0x3e')][_0x68ef('0x3f')]?util[_0x68ef('0x40')](_0x68ef('0x41'),_0x3c5de6['browser'][_0x68ef('0x33')],_0x3c5de6[_0x68ef('0x3e')][_0x68ef('0x3f')]):_0x68ef('0x42'),'browserVersion':_0x3c5de6[_0x68ef('0x3e')][_0x68ef('0x3f')]||_0x68ef('0x42'),'osName':util[_0x68ef('0x40')](_0x68ef('0x41'),_0x3c5de6['os']['name'],_0x3c5de6['os'][_0x68ef('0x3f')]),'osVersion':_0x3c5de6['os'][_0x68ef('0x3f')],'deviceModel':_0x3c5de6[_0x68ef('0x43')][_0x68ef('0x44')]&&_0x3c5de6[_0x68ef('0x43')][_0x68ef('0x45')]?util[_0x68ef('0x40')]('%s\x20%s\x20%s',_0x3c5de6[_0x68ef('0x43')]['model'],_0x3c5de6[_0x68ef('0x43')][_0x68ef('0x45')],_0x3c5de6[_0x68ef('0x43')][_0x68ef('0x46')]):null,'deviceVendor':_0x3c5de6['device'][_0x68ef('0x45')],'deviceType':_0x3c5de6['device'][_0x68ef('0x46')],'formData':JSON['stringify'](_0x51ba3d)};}exports[_0x68ef('0x47')]=function(_0xa2358b,_0x105e8c){var _0x5c4a66={'include':[{'model':db[_0x68ef('0x48')],'as':'mandatoryDispositionPause'}]},_0x59b148={},_0x4044d5={'count':0x0,'rows':[]};var _0x589688=_['map'](db[_0x68ef('0x49')][_0x68ef('0x4a')],function(_0x173fb7){return{'name':_0x173fb7[_0x68ef('0x4b')],'type':_0x173fb7[_0x68ef('0x46')]['key']};});_0x59b148['model']=_[_0x68ef('0x4c')](_0x589688,_0x68ef('0x33'));_0x59b148[_0x68ef('0x4d')]=_[_0x68ef('0x4e')](_0xa2358b['query']);_0x59b148[_0x68ef('0x4f')]=_[_0x68ef('0x50')](_0x59b148[_0x68ef('0x44')],_0x59b148[_0x68ef('0x4d')]);_0x5c4a66['attributes']=_['intersection'](_0x59b148[_0x68ef('0x44')],qs[_0x68ef('0x51')](_0xa2358b['query'][_0x68ef('0x51')]));_0x5c4a66[_0x68ef('0x52')]=_0x5c4a66[_0x68ef('0x52')][_0x68ef('0x53')]?_0x5c4a66[_0x68ef('0x52')]:_0x59b148['model'];if(!_0xa2358b[_0x68ef('0x4d')][_0x68ef('0x54')](_0x68ef('0x55'))){_0x5c4a66['limit']=qs[_0x68ef('0x2a')](_0xa2358b[_0x68ef('0x4d')][_0x68ef('0x2a')]);_0x5c4a66['offset']=qs[_0x68ef('0x28')](_0xa2358b['query']['offset']);}_0x5c4a66[_0x68ef('0x56')]=qs['sort'](_0xa2358b[_0x68ef('0x4d')][_0x68ef('0x57')]);_0x5c4a66[_0x68ef('0x58')]=qs[_0x68ef('0x4f')](_[_0x68ef('0x59')](_0xa2358b[_0x68ef('0x4d')],_0x59b148[_0x68ef('0x4f')]),_0x589688);if(_0xa2358b[_0x68ef('0x4d')][_0x68ef('0x5a')]){_0x5c4a66[_0x68ef('0x58')]=_['merge'](_0x5c4a66['where'],{'$or':_[_0x68ef('0x4c')](_0x589688,function(_0x27a449){if(_0x27a449[_0x68ef('0x46')]!==_0x68ef('0x5b')){var _0x82df12={};_0x82df12[_0x27a449[_0x68ef('0x33')]]={'$like':'%'+_0xa2358b[_0x68ef('0x4d')][_0x68ef('0x5a')]+'%'};return _0x82df12;}})});}_0x5c4a66=_[_0x68ef('0x5c')]({},_0x5c4a66,_0xa2358b['options']);var _0x5685bb={'where':_0x5c4a66[_0x68ef('0x58')]};return db['ChatWebsite'][_0x68ef('0x2b')](_0x5685bb)['then'](function(_0x1b2436){_0x4044d5[_0x68ef('0x2b')]=_0x1b2436;if(_0xa2358b['query'][_0x68ef('0x5d')]){_0x5c4a66['include']=[{'all':!![]}];}return db[_0x68ef('0x49')][_0x68ef('0x5e')](_0x5c4a66);})[_0x68ef('0x2f')](function(_0x304434){_0x4044d5[_0x68ef('0x5f')]=_0x304434;return _0x4044d5;})[_0x68ef('0x2f')](respondWithFilteredResult(_0x105e8c,_0x5c4a66))['catch'](handleError(_0x105e8c,null));};exports[_0x68ef('0x60')]=function(_0x1f770f,_0x3cfd89){var _0x20dc7f={'raw':![],'where':{'id':_0x1f770f[_0x68ef('0x61')]['id']},'include':[{'model':db['Pause'],'as':_0x68ef('0x62')}]},_0x4107d3={};_0x4107d3[_0x68ef('0x44')]=_['keys'](db[_0x68ef('0x49')][_0x68ef('0x4a')]);_0x4107d3[_0x68ef('0x4d')]=_['keys'](_0x1f770f[_0x68ef('0x4d')]);_0x4107d3['filters']=_['intersection'](_0x4107d3[_0x68ef('0x44')],_0x4107d3['query']);_0x20dc7f[_0x68ef('0x52')]=_['intersection'](_0x4107d3[_0x68ef('0x44')],qs[_0x68ef('0x51')](_0x1f770f[_0x68ef('0x4d')][_0x68ef('0x51')]));_0x20dc7f[_0x68ef('0x52')]=_0x20dc7f[_0x68ef('0x52')]['length']?_0x20dc7f[_0x68ef('0x52')]:_0x4107d3['model'];if(_0x1f770f[_0x68ef('0x4d')]['includeAll']){_0x20dc7f[_0x68ef('0x63')]=[{'all':!![]}];}_0x20dc7f=_[_0x68ef('0x5c')]({},_0x20dc7f,_0x1f770f[_0x68ef('0x64')]);return db[_0x68ef('0x49')][_0x68ef('0x65')](_0x20dc7f)[_0x68ef('0x2f')](handleEntityNotFound(_0x3cfd89,null))[_0x68ef('0x2f')](respondWithResult(_0x3cfd89,null))['catch'](handleError(_0x3cfd89,null));};exports[_0x68ef('0x66')]=function(_0x11bab3,_0x43eba8){var _0x450f98=null;_0x11bab3[_0x68ef('0x67')]['address'][_0x68ef('0x68')](',')['forEach'](_0x1ed172=>{if(_0x1ed172['trim']()!==''&&!wildcardUtils['testWildcardValidity'](_0x1ed172[_0x68ef('0x69')]())){_0x450f98=new APIBadRequestError('\x22'+_0x1ed172[_0x68ef('0x69')]()+_0x68ef('0x6a'));}});if(_0x450f98){return handleError(_0x43eba8,null)(_0x450f98);}return db[_0x68ef('0x49')]['create'](_0x11bab3[_0x68ef('0x67')],{})['then'](function(_0x2460d8){var _0x2d916e=_0x11bab3[_0x68ef('0x6b')]['get']({'plain':!![]});if(!_0x2d916e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d916e[_0x68ef('0x6c')]===_0x68ef('0x6b')){var _0x24d7f7=_0x2460d8[_0x68ef('0x6d')]({'plain':!![]});var _0x5b41e1=_0x68ef('0x31');return db[_0x68ef('0x6e')][_0x68ef('0x65')]({'where':{'name':_0x5b41e1,'userProfileId':_0x2d916e[_0x68ef('0x6f')]},'raw':!![]})['then'](function(_0x3f56a7){if(_0x3f56a7&&_0x3f56a7['autoAssociation']===0x0){return db[_0x68ef('0x70')][_0x68ef('0x66')]({'name':_0x24d7f7[_0x68ef('0x33')],'resourceId':_0x24d7f7['id'],'type':_0x3f56a7[_0x68ef('0x33')],'sectionId':_0x3f56a7['id']},{})[_0x68ef('0x2f')](function(){return _0x2460d8;});}else{return _0x2460d8;}})['catch'](function(_0x24285){logger[_0x68ef('0x22')](_0x68ef('0x71'),_0x24285);throw _0x24285;});}return _0x2460d8;})['then'](respondWithResult(_0x43eba8,0xc9))[_0x68ef('0x26')](handleError(_0x43eba8,null));};exports['update']=function(_0x69b1c,_0x535f65){var _0x4c70c0=null;_0x69b1c[_0x68ef('0x67')][_0x68ef('0x72')][_0x68ef('0x68')](',')[_0x68ef('0x73')](_0x501004=>{if(_0x501004[_0x68ef('0x69')]()!==''&&!wildcardUtils[_0x68ef('0x74')](_0x501004[_0x68ef('0x69')]())){_0x4c70c0=new APIBadRequestError('\x22'+_0x501004['trim']()+_0x68ef('0x6a'));}});if(_0x4c70c0){return handleError(_0x535f65,null)(_0x4c70c0);}if(_0x69b1c[_0x68ef('0x67')]['id']){delete _0x69b1c[_0x68ef('0x67')]['id'];}return db[_0x68ef('0x49')][_0x68ef('0x65')]({'where':{'id':_0x69b1c[_0x68ef('0x61')]['id']},'include':[{'model':db[_0x68ef('0x48')],'as':_0x68ef('0x62')}]})[_0x68ef('0x2f')](handleEntityNotFound(_0x535f65,null))[_0x68ef('0x2f')](saveUpdates(_0x69b1c[_0x68ef('0x67')],null))[_0x68ef('0x2f')](respondWithResult(_0x535f65,null))['catch'](handleError(_0x535f65,null));};exports[_0x68ef('0x30')]=function(_0x391a81,_0x5db443){return db['ChatWebsite'][_0x68ef('0x65')]({'where':{'id':_0x391a81['params']['id']}})[_0x68ef('0x2f')](handleEntityNotFound(_0x5db443,null))[_0x68ef('0x2f')](removeEntity(_0x5db443,null))['catch'](handleError(_0x5db443,null));};exports['describe']=function(_0x31a336,_0x5c500c){return db[_0x68ef('0x49')]['describe']()[_0x68ef('0x2f')](respondWithResult(_0x5c500c,null))['catch'](handleError(_0x5c500c,null));};exports[_0x68ef('0x75')]=function(_0x428c13,_0x57e811){if(_0x428c13[_0x68ef('0x67')]['id']){delete _0x428c13[_0x68ef('0x67')]['id'];}return db[_0x68ef('0x49')][_0x68ef('0x65')]({'where':{'id':_0x428c13['params']['id']}})[_0x68ef('0x2f')](handleEntityNotFound(_0x57e811,null))[_0x68ef('0x2f')](function(_0x5b2e89){if(_0x5b2e89){_0x428c13[_0x68ef('0x67')][_0x68ef('0x76')]=_0x5b2e89['id'];return db[_0x68ef('0x77')]['create'](_0x428c13[_0x68ef('0x67')]);}})['then'](respondWithResult(_0x57e811,null))[_0x68ef('0x26')](handleError(_0x57e811,null));};exports[_0x68ef('0x78')]=function(_0x4f1a65,_0x4b0fb4){var _0x51101a={'raw':![],'where':{}};var _0x564ef7={};var _0x4370b1={'count':0x0,'rows':[]};return db[_0x68ef('0x49')][_0x68ef('0x79')]({'where':{'id':_0x4f1a65[_0x68ef('0x61')]['id']}})[_0x68ef('0x2f')](handleEntityNotFound(_0x4b0fb4,null))[_0x68ef('0x2f')](function(_0x842cfe){if(_0x842cfe){_0x564ef7[_0x68ef('0x44')]=_[_0x68ef('0x4e')](db[_0x68ef('0x77')][_0x68ef('0x4a')]);_0x564ef7[_0x68ef('0x4d')]=_[_0x68ef('0x4e')](_0x4f1a65['query']);_0x564ef7[_0x68ef('0x4f')]=_['intersection'](_0x564ef7[_0x68ef('0x44')],_0x564ef7['query']);_0x51101a['attributes']=_[_0x68ef('0x50')](_0x564ef7[_0x68ef('0x44')],qs[_0x68ef('0x51')](_0x4f1a65[_0x68ef('0x4d')]['fields']));_0x51101a['attributes']=_0x51101a[_0x68ef('0x52')][_0x68ef('0x53')]?_0x51101a[_0x68ef('0x52')]:_0x564ef7['model'];if(!_0x4f1a65[_0x68ef('0x4d')][_0x68ef('0x54')](_0x68ef('0x55'))){_0x51101a[_0x68ef('0x2a')]=qs['limit'](_0x4f1a65[_0x68ef('0x4d')][_0x68ef('0x2a')]);_0x51101a[_0x68ef('0x28')]=qs[_0x68ef('0x28')](_0x4f1a65[_0x68ef('0x4d')][_0x68ef('0x28')]);}_0x51101a['order']=qs[_0x68ef('0x57')](_0x4f1a65['query'][_0x68ef('0x57')]);_0x51101a[_0x68ef('0x58')]=qs[_0x68ef('0x4f')](_[_0x68ef('0x59')](_0x4f1a65['query'],_0x564ef7[_0x68ef('0x4f')]));_0x51101a['where'][_0x68ef('0x76')]=_0x842cfe['id'];if(_0x4f1a65[_0x68ef('0x4d')]['filter']){_0x51101a['where']=_[_0x68ef('0x5c')](_0x51101a['where'],{'$or':_[_0x68ef('0x4c')](_0x51101a['attributes'],function(_0x34d825){var _0x3eafd2={};_0x3eafd2[_0x34d825]={'$like':'%'+_0x4f1a65[_0x68ef('0x4d')][_0x68ef('0x5a')]+'%'};return _0x3eafd2;})});}_0x51101a=_[_0x68ef('0x5c')]({},_0x51101a,_0x4f1a65[_0x68ef('0x64')]);return db['Disposition'][_0x68ef('0x2b')]({'where':_0x51101a[_0x68ef('0x58')]})[_0x68ef('0x2f')](function(_0x380437){_0x4370b1[_0x68ef('0x2b')]=_0x380437;if(_0x4f1a65[_0x68ef('0x4d')][_0x68ef('0x5d')]){_0x51101a['include']=[{'all':!![]}];}return db[_0x68ef('0x77')][_0x68ef('0x5e')](_0x51101a);})[_0x68ef('0x2f')](function(_0x2e20aa){_0x4370b1[_0x68ef('0x5f')]=_0x2e20aa;return _0x4370b1;});}})[_0x68ef('0x2f')](respondWithFilteredResult(_0x4b0fb4,_0x51101a))[_0x68ef('0x26')](handleError(_0x4b0fb4,null));};exports[_0x68ef('0x7a')]=function(_0x1bcbbb,_0x580fe0){return db[_0x68ef('0x49')]['find']({'where':{'id':_0x1bcbbb['params']['id']}})['then'](handleEntityNotFound(_0x580fe0,null))[_0x68ef('0x2f')](function(_0x2ef857){if(_0x2ef857){return _0x2ef857[_0x68ef('0x7a')](_0x1bcbbb['query']['ids']);}})['then'](respondWithStatusCode(_0x580fe0,null))[_0x68ef('0x26')](handleError(_0x580fe0,null));};exports[_0x68ef('0x7b')]=function(_0x239d05,_0x40996e){if(_0x239d05[_0x68ef('0x67')]['id']){delete _0x239d05[_0x68ef('0x67')]['id'];}return db['ChatWebsite'][_0x68ef('0x65')]({'where':{'id':_0x239d05[_0x68ef('0x61')]['id']}})[_0x68ef('0x2f')](handleEntityNotFound(_0x40996e,null))[_0x68ef('0x2f')](function(_0x598c45){if(_0x598c45){_0x239d05[_0x68ef('0x67')][_0x68ef('0x76')]=_0x598c45['id'];return db[_0x68ef('0x7c')][_0x68ef('0x66')](_0x239d05[_0x68ef('0x67')]);}})[_0x68ef('0x2f')](respondWithResult(_0x40996e,null))[_0x68ef('0x26')](handleError(_0x40996e,null));};exports[_0x68ef('0x7d')]=function(_0x4cdc78,_0x16dbaf){var _0x210ba6={'raw':![],'where':{}};var _0x4d54df={};var _0xdaed94={'count':0x0,'rows':[]};return db[_0x68ef('0x49')][_0x68ef('0x79')]({'where':{'id':_0x4cdc78[_0x68ef('0x61')]['id']}})[_0x68ef('0x2f')](handleEntityNotFound(_0x16dbaf,null))[_0x68ef('0x2f')](function(_0x189909){if(_0x189909){_0x4d54df[_0x68ef('0x44')]=_[_0x68ef('0x4e')](db[_0x68ef('0x7c')][_0x68ef('0x4a')]);_0x4d54df[_0x68ef('0x4d')]=_[_0x68ef('0x4e')](_0x4cdc78[_0x68ef('0x4d')]);_0x4d54df[_0x68ef('0x4f')]=_[_0x68ef('0x50')](_0x4d54df[_0x68ef('0x44')],_0x4d54df[_0x68ef('0x4d')]);_0x210ba6['attributes']=_[_0x68ef('0x50')](_0x4d54df[_0x68ef('0x44')],qs[_0x68ef('0x51')](_0x4cdc78[_0x68ef('0x4d')][_0x68ef('0x51')]));_0x210ba6['attributes']=_0x210ba6[_0x68ef('0x52')][_0x68ef('0x53')]?_0x210ba6['attributes']:_0x4d54df[_0x68ef('0x44')];if(!_0x4cdc78['query']['hasOwnProperty']('nolimit')){_0x210ba6['limit']=qs[_0x68ef('0x2a')](_0x4cdc78['query'][_0x68ef('0x2a')]);_0x210ba6['offset']=qs['offset'](_0x4cdc78['query'][_0x68ef('0x28')]);}_0x210ba6[_0x68ef('0x56')]=qs[_0x68ef('0x57')](_0x4cdc78[_0x68ef('0x4d')][_0x68ef('0x57')]);_0x210ba6['where']=qs[_0x68ef('0x4f')](_[_0x68ef('0x59')](_0x4cdc78[_0x68ef('0x4d')],_0x4d54df[_0x68ef('0x4f')]));_0x210ba6['where'][_0x68ef('0x76')]=_0x189909['id'];if(_0x4cdc78['query']['filter']){_0x210ba6['where']=_[_0x68ef('0x5c')](_0x210ba6[_0x68ef('0x58')],{'$or':_[_0x68ef('0x4c')](_0x210ba6[_0x68ef('0x52')],function(_0x38bad5){var _0x167812={};_0x167812[_0x38bad5]={'$like':'%'+_0x4cdc78[_0x68ef('0x4d')][_0x68ef('0x5a')]+'%'};return _0x167812;})});}_0x210ba6=_[_0x68ef('0x5c')]({},_0x210ba6,_0x4cdc78[_0x68ef('0x64')]);return db[_0x68ef('0x7c')][_0x68ef('0x2b')]({'where':_0x210ba6['where']})['then'](function(_0x481bec){_0xdaed94[_0x68ef('0x2b')]=_0x481bec;if(_0x4cdc78[_0x68ef('0x4d')][_0x68ef('0x5d')]){_0x210ba6['include']=[{'all':!![]}];}return db[_0x68ef('0x7c')]['findAll'](_0x210ba6);})[_0x68ef('0x2f')](function(_0xc07b77){_0xdaed94[_0x68ef('0x5f')]=_0xc07b77;return _0xdaed94;});}})['then'](respondWithFilteredResult(_0x16dbaf,_0x210ba6))[_0x68ef('0x26')](handleError(_0x16dbaf,null));};exports[_0x68ef('0x7e')]=function(_0x546b0d,_0x3f0d93){return db[_0x68ef('0x49')][_0x68ef('0x65')]({'where':{'id':_0x546b0d[_0x68ef('0x61')]['id']}})[_0x68ef('0x2f')](handleEntityNotFound(_0x3f0d93,null))[_0x68ef('0x2f')](function(_0x4381ee){if(_0x4381ee){return _0x4381ee['removeAnswers'](_0x546b0d[_0x68ef('0x4d')][_0x68ef('0x7f')]);}})[_0x68ef('0x2f')](respondWithStatusCode(_0x3f0d93,null))[_0x68ef('0x26')](handleError(_0x3f0d93,null));};exports[_0x68ef('0x80')]=function(_0x46c87e,_0x20a131){_0x46c87e[_0x68ef('0x67')][_0x68ef('0x81')]=_0x46c87e[_0x68ef('0x82')]['filename'];return db['ChatWebsite'][_0x68ef('0x65')]({'where':{'id':_0x46c87e['params']['id']}})[_0x68ef('0x2f')](handleEntityNotFound(_0x20a131,null))[_0x68ef('0x2f')](saveUpdates(_0x46c87e[_0x68ef('0x67')],null))[_0x68ef('0x2f')](respondWithResult(_0x20a131,null))[_0x68ef('0x26')](handleError(_0x20a131,null));};exports['addAvatar']=function(_0x80fa59,_0x1c3449){_0x80fa59[_0x68ef('0x67')][_0x68ef('0x83')]=_0x80fa59['file']['filename'];return db[_0x68ef('0x49')][_0x68ef('0x65')]({'where':{'id':_0x80fa59[_0x68ef('0x61')]['id']}})[_0x68ef('0x2f')](handleEntityNotFound(_0x1c3449,null))[_0x68ef('0x2f')](saveUpdates(_0x80fa59[_0x68ef('0x67')],null))[_0x68ef('0x2f')](respondWithResult(_0x1c3449,null))[_0x68ef('0x26')](handleError(_0x1c3449,null));};exports[_0x68ef('0x84')]=function(_0x2a0f59,_0x1d437e){_0x2a0f59['body'][_0x68ef('0x85')]=_0x2a0f59[_0x68ef('0x82')][_0x68ef('0x86')];return db[_0x68ef('0x49')][_0x68ef('0x65')]({'where':{'id':_0x2a0f59[_0x68ef('0x61')]['id']}})[_0x68ef('0x2f')](handleEntityNotFound(_0x1d437e,null))[_0x68ef('0x2f')](saveUpdates(_0x2a0f59[_0x68ef('0x67')],null))[_0x68ef('0x2f')](respondWithResult(_0x1d437e,null))['catch'](handleError(_0x1d437e,null));};exports['addSystemAvatar']=function(_0x34465c,_0x3ddfe0){_0x34465c[_0x68ef('0x67')][_0x68ef('0x87')]=_0x34465c[_0x68ef('0x82')][_0x68ef('0x86')];return db[_0x68ef('0x49')]['find']({'where':{'id':_0x34465c[_0x68ef('0x61')]['id']}})[_0x68ef('0x2f')](handleEntityNotFound(_0x3ddfe0,null))[_0x68ef('0x2f')](saveUpdates(_0x34465c[_0x68ef('0x67')],null))['then'](respondWithResult(_0x3ddfe0,null))[_0x68ef('0x26')](handleError(_0x3ddfe0,null));};exports['getLogo']=function(_0x4704dc,_0x322733){var _0x3d3a70=path['join'](config['root'],_0x68ef('0x88'));var _0x5ed1de={'where':{'id':_0x4704dc[_0x68ef('0x61')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x476202=![];return require(_0x68ef('0x89'))['getLicense']()['then'](function(_0x3604b1){if(_0x3604b1){_0x476202=_0x3604b1[_0x68ef('0x8a')];}})['then'](function(){return db[_0x68ef('0x49')][_0x68ef('0x65')](_0x5ed1de);})[_0x68ef('0x2f')](handleEntityNotFound(_0x322733,null))['then'](function(_0x4d483d){if(_0x4d483d){if(!_[_0x68ef('0x8b')](_0x4d483d['sitepic'])){if(fs[_0x68ef('0x8c')](path[_0x68ef('0x8d')](config[_0x68ef('0x8e')],_0x68ef('0x8f'),_0x4d483d[_0x68ef('0x81')]))&&_0x476202){_0x3d3a70=path[_0x68ef('0x8d')](config['root'],'server/files/images/logos/',_0x4d483d[_0x68ef('0x81')]);}}return _0x322733[_0x68ef('0x90')](_0x3d3a70);}})[_0x68ef('0x26')](handleError(_0x322733,null));};exports[_0x68ef('0x91')]=function(_0x2d97db,_0x4929ee){var _0x3e77b3=path[_0x68ef('0x8d')](config[_0x68ef('0x8e')],_0x68ef('0x92'));var _0x11c872={'where':{'id':_0x2d97db[_0x68ef('0x61')]['id']},'attributes':['id',_0x68ef('0x83')],'raw':!![]};return db[_0x68ef('0x49')]['find'](_0x11c872)[_0x68ef('0x2f')](handleEntityNotFound(_0x4929ee,null))[_0x68ef('0x2f')](function(_0x23317f){if(_0x23317f){if(!_[_0x68ef('0x8b')](_0x23317f[_0x68ef('0x83')])){if(fs[_0x68ef('0x8c')](path['join'](config[_0x68ef('0x8e')],_0x68ef('0x93'),_0x23317f[_0x68ef('0x83')]))){_0x3e77b3=path[_0x68ef('0x8d')](config[_0x68ef('0x8e')],'server/files/images/avatars/',_0x23317f[_0x68ef('0x83')]);}}return _0x4929ee[_0x68ef('0x90')](_0x3e77b3);}})['catch'](handleError(_0x4929ee,null));};exports['getCustomerAvatar']=function(_0x222b76,_0x43cf36){var _0x35999a=path['join'](config['root'],_0x68ef('0x94'));var _0x10a3f9={'where':{'id':_0x222b76[_0x68ef('0x61')]['id']},'attributes':['id',_0x68ef('0x85'),_0x68ef('0x95')],'raw':!![]};return db[_0x68ef('0x49')][_0x68ef('0x65')](_0x10a3f9)[_0x68ef('0x2f')](handleEntityNotFound(_0x43cf36,null))[_0x68ef('0x2f')](function(_0x156d3a){if(_0x156d3a){if(!_[_0x68ef('0x8b')](_0x156d3a[_0x68ef('0x85')])){if(fs[_0x68ef('0x8c')](path[_0x68ef('0x8d')](config['root'],'server/files/images/avatars/',_0x156d3a[_0x68ef('0x85')]))&&_0x156d3a[_0x68ef('0x95')]){_0x35999a=path[_0x68ef('0x8d')](config[_0x68ef('0x8e')],'server/files/images/avatars/',_0x156d3a[_0x68ef('0x85')]);}}return _0x43cf36[_0x68ef('0x90')](_0x35999a);}})['catch'](handleError(_0x43cf36,null));};exports['getSystemAvatar']=function(_0x30b77e,_0x33aae0){var _0xc3617b=path['join'](config[_0x68ef('0x8e')],_0x68ef('0x96'));var _0x3fb16d={'where':{'id':_0x30b77e['params']['id']},'attributes':['id',_0x68ef('0x87')],'raw':!![]};return db['ChatWebsite'][_0x68ef('0x65')](_0x3fb16d)[_0x68ef('0x2f')](handleEntityNotFound(_0x33aae0,null))['then'](function(_0x686e5b){if(_0x686e5b){if(!_[_0x68ef('0x8b')](_0x686e5b[_0x68ef('0x87')])){if(fs[_0x68ef('0x8c')](path[_0x68ef('0x8d')](config[_0x68ef('0x8e')],_0x68ef('0x93'),_0x686e5b[_0x68ef('0x87')]))){_0xc3617b=path[_0x68ef('0x8d')](config['root'],_0x68ef('0x93'),_0x686e5b[_0x68ef('0x87')]);}}return _0x33aae0[_0x68ef('0x90')](_0xc3617b);}})[_0x68ef('0x26')](handleError(_0x33aae0,null));};function checkWebsiteInterval(_0x3e3775){var _0x89d119=_0x3e3775[_0x68ef('0x97')];if(!_0x89d119){return Promise['resolve'](_0x3e3775);}var _0x509593=_0x3e3775[_0x68ef('0x98')]||undefined;return _0x89d119['ifTime'](_0x509593)[_0x68ef('0x2f')](function(_0x158e68){if(!_0x158e68){throw new APIOutOfIntervalError();}return _0x3e3775;});}exports[_0x68ef('0x99')]=function(_0x4762db,_0x52d821){var _0x728df1={'body':_0x4762db[_0x68ef('0x67')],'channel':_0x68ef('0x9a')};var _0x5df9bb=[];var _0xe18083=[];var _0xe82f3a={};var _0x4af131=![];if(_0x4762db[_0x68ef('0x67')]['id']){delete _0x4762db[_0x68ef('0x67')]['id'];}if(_['isNil'](_0x4762db['body']['from'])){throw new APIBadRequestError(_0x68ef('0x9b'));}if(_[_0x68ef('0x8b')](_0x4762db[_0x68ef('0x67')][_0x68ef('0x9c')])){throw new APIBadRequestError(_0x68ef('0x9d'));}if(_[_0x68ef('0x9e')](_0x4762db[_0x68ef('0x67')][_0x68ef('0x67')])){throw new APIBadRequestError(_0x68ef('0x9f'));}var _0x4b393e=_0x4762db[_0x68ef('0x67')][_0x68ef('0x37')]&&_0x4762db['body'][_0x68ef('0xa0')];return db[_0x68ef('0xa1')][_0x68ef('0xa2')]()['then'](function(_0x19e0fe){if(!_0x19e0fe){throw new Error('No\x20available\x20attributes');}_0x5df9bb=Object[_0x68ef('0x4e')](_0x19e0fe)[_0x68ef('0x5a')](function(_0x324f33){return![_0x68ef('0xa3'),_0x68ef('0xa4')][_0x68ef('0xa5')](_0x324f33);});_0xe18083=Object[_0x68ef('0x4e')](_0x19e0fe)[_0x68ef('0x5a')](function(_0x491464){return![_0x68ef('0xa3'),_0x68ef('0xa4'),'CompanyId',_0x68ef('0xa6')][_0x68ef('0xa5')](_0x491464);});if(!_[_0x68ef('0xa5')](_0xe18083,_0x4762db[_0x68ef('0x67')][_0x68ef('0x9c')])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0xe18083[_0x68ef('0x8d')](',\x20'));}_0xe82f3a[_0x4762db[_0x68ef('0x67')][_0x68ef('0x9c')]]=_0x4762db[_0x68ef('0x67')][_0x68ef('0xa7')];})['then'](function(){return db[_0x68ef('0x49')]['find']({'where':{'id':_0x4762db['params']['id']},'include':[{'model':db[_0x68ef('0xa8')],'as':_0x68ef('0xa9'),'include':[{'model':db[_0x68ef('0xa1')],'as':_0x68ef('0xaa'),'where':_0xe82f3a,'limit':0x1,'order':[[_0x68ef('0xa4'),_0x68ef('0xab')]]}]},{'model':db[_0x68ef('0xac')],'as':_0x68ef('0xad')},{'model':db['Interval'],'as':_0x68ef('0x97'),'include':[{'model':db[_0x68ef('0x97')],'as':_0x68ef('0xae'),'attributes':['id',_0x68ef('0xaf')],'raw':!![]}]}]});})[_0x68ef('0x2f')](function(_0xc9fb85){if(!_0xc9fb85){throw new APINotFoundError(util[_0x68ef('0x40')](_0x68ef('0xb0'),_0x4762db[_0x68ef('0x61')]['id']));}if(_0x4b393e){return checkWebsiteInterval(_0xc9fb85);}return _0xc9fb85;})[_0x68ef('0x2f')](function(_0x2eb015){_0x728df1[_0x68ef('0xb1')]=_0x2eb015;_0x728df1['applications']=_[_0x68ef('0xb2')](_0x2eb015[_0x68ef('0xad')],[_0x68ef('0xb3')],[_0x68ef('0xb4')]);if(_0x728df1['account'][_0x68ef('0xad')]){delete _0x728df1[_0x68ef('0xb1')][_0x68ef('0xad')];}_0x728df1['list']=_0x2eb015[_0x68ef('0xa9')]||{'id':_0x2eb015['ListId']};if(_0x728df1[_0x68ef('0xb5')]&&_0x728df1[_0x68ef('0xb5')][_0x68ef('0xaa')][_0x68ef('0x53')]){return _0x728df1[_0x68ef('0xb5')]['Contacts'][0x0];}var _0x5c5770=_['defaults'](_0x4762db[_0x68ef('0x67')],{'firstName':_0x4762db[_0x68ef('0x67')]['from'],'ListId':_0x2eb015[_0x68ef('0xa6')]});_0x5c5770[_0x4762db[_0x68ef('0x67')][_0x68ef('0x9c')]]=_0x4762db[_0x68ef('0x67')][_0x68ef('0xa7')];return db[_0x68ef('0xa1')][_0x68ef('0x66')](_0x5c5770,{'fields':_0x5df9bb,'raw':!![]});})[_0x68ef('0x2f')](function(_0x328f87){_0x728df1[_0x68ef('0xb6')]=_0x328f87;var _0x2cb454=createInteractionObject(_0x4762db[_0x68ef('0x61')]['id'],_0x4762db[_0x68ef('0x67')],_0x4762db[_0x68ef('0xb7')],_0x328f87);var _0x3702bf={'ChatWebsiteId':_0x4762db[_0x68ef('0x61')]['id']};if(_0x4762db['body'][_0x68ef('0xb8')]){_0x3702bf[_0x68ef('0xb8')]=_0x4762db['body'][_0x68ef('0xb8')];_0x3702bf[_0x68ef('0xb9')]=![];return db[_0x68ef('0xba')][_0x68ef('0x65')]({'where':_0x3702bf})[_0x68ef('0x2f')](function(_0x42db9a){var _0x3459c1=_0x4762db['body']['customerIp']&&_0x4762db[_0x68ef('0x67')][_0x68ef('0xa0')];if(_0x42db9a){_0x4af131=!![];return _0x42db9a;}else if(!_0x3459c1&&_0x42db9a&&_0x42db9a['closed']){throw new APIConflictError(_0x68ef('0xbb'));}_0x2cb454['threadId']=_0x4762db[_0x68ef('0x67')]['threadId'];_0x2cb454[_0x68ef('0xbc')]=_0x4762db[_0x68ef('0x67')][_0x68ef('0xbc')];return db[_0x68ef('0xba')][_0x68ef('0x66')](_0x2cb454);});}_0x3702bf[_0x68ef('0xbd')]=_0x328f87['id'];if(_0x4762db[_0x68ef('0x67')][_0x68ef('0xbe')]&&_0x4762db['body'][_0x68ef('0xbe')]['id']){_0x3702bf['id']=_0x4762db[_0x68ef('0x67')][_0x68ef('0xbe')]['id'];return db[_0x68ef('0xba')][_0x68ef('0x65')]({'where':_0x3702bf})[_0x68ef('0x2f')](function(_0x3a6e25){var _0x1a0eb0=_0x4762db[_0x68ef('0x67')]['customerIp']&&_0x4762db[_0x68ef('0x67')][_0x68ef('0xa0')];if(!_0x1a0eb0&&_0x3a6e25&&_0x3a6e25[_0x68ef('0xb9')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x3a6e25){_0x4af131=!![];return _0x3a6e25;}else{return db[_0x68ef('0xba')][_0x68ef('0x66')](_0x2cb454);}});}return db[_0x68ef('0xba')][_0x68ef('0x66')](_0x2cb454);})[_0x68ef('0x2f')](function(_0x868549){if(!_0x4af131){return _0x868549;}var _0x3768ff={'from':(_0x728df1[_0x68ef('0xb6')][_0x68ef('0x3b')]||'')+'\x20'+(_0x728df1[_0x68ef('0xb6')][_0x68ef('0x3c')]||'')};if(_0x4762db[_0x68ef('0x67')][_0x68ef('0xb8')]&&_0x4762db[_0x68ef('0x67')][_0x68ef('0xbf')]&&_0x4762db['body'][_0x68ef('0xb8')]!=_0x4762db[_0x68ef('0x67')]['messageId']){_0x3768ff[_0x68ef('0xb8')]=_0x4762db['body'][_0x68ef('0xbf')];}return _0x868549[_0x68ef('0x2e')](_0x3768ff);})[_0x68ef('0x2f')](function(_0x85a62d){_0x728df1[_0x68ef('0xbe')]=_0x85a62d[_0x68ef('0x6d')]({'plain':!![]});_0x728df1[_0x68ef('0xbe')][_0x68ef('0xc0')]=!_0x4af131;if(_0x728df1[_0x68ef('0xbe')][_0x68ef('0xc0')]){if(_0x728df1[_0x68ef('0xb1')][_0x68ef('0xc1')]){_0x728df1[_0x68ef('0xc2')]['push']({'id':0x0,'priority':_0x728df1[_0x68ef('0xc2')][_0x68ef('0x53')]+0x1,'app':_0x68ef('0xc3'),'appdata':_0x68ef('0xc4'),'interval':'*,*,*,*'});}}return db[_0x68ef('0xc5')][_0x68ef('0x66')]({'body':_0x4762db[_0x68ef('0x67')]['body'],'ChatWebsiteId':_0x4762db[_0x68ef('0x61')]['id'],'ChatInteractionId':_0x85a62d['id'],'direction':'in','ContactId':_0x728df1[_0x68ef('0xb6')]['id'],'AttachmentId':_0x4762db[_0x68ef('0x67')][_0x68ef('0xc6')]});})[_0x68ef('0x2f')](function(_0x2a5f7e){_0x728df1[_0x68ef('0x24')]=_0x2a5f7e;if(!_0x728df1['interaction']['UserId']){return;}return db[_0x68ef('0xc7')][_0x68ef('0x65')]({'attributes':['id','name'],'where':{'id':_0x728df1['interaction'][_0x68ef('0xc8')]}});})[_0x68ef('0x2f')](function(_0x26e952){if(_0x26e952){_0x728df1[_0x68ef('0xc2')][_0x68ef('0xc9')]({'id':0x0,'priority':0x0,'app':_0x68ef('0xca'),'appdata':_0x26e952[_0x68ef('0x33')]+','+(_0x728df1[_0x68ef('0xb1')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x728df1[_0x68ef('0xcb')]=!![];}if(!_0x728df1[_0x68ef('0xbe')][_0x68ef('0xcc')]){return;}return db['ChatQueue'][_0x68ef('0x65')]({'attributes':['id',_0x68ef('0x33')],'where':{'id':_0x728df1[_0x68ef('0xbe')][_0x68ef('0xcc')]}});})['then'](function(_0x4a4947){if(_0x4a4947){_0x728df1[_0x68ef('0xc2')][_0x68ef('0xc9')]({'id':0x0,'priority':0x1,'app':_0x68ef('0xcd'),'appdata':_0x4a4947['name']+','+(_0x728df1[_0x68ef('0xb1')][_0x68ef('0xce')]||0x12c),'interval':_0x68ef('0xcf')});}return respondWithRpcPromise(_0x68ef('0xd0'),_0x68ef('0xd1'),_0x728df1);})[_0x68ef('0x2f')](function(_0x381b19){respondWithRpcPromise(_0x68ef('0xd2'),_0x68ef('0xd2'),{'event':'notify','message':_0x381b19},client9002);return _0x381b19;})[_0x68ef('0x2f')](respondWithResult(_0x52d821,null))[_0x68ef('0x26')](APIHandleError(_0x52d821));};exports['offline']=function(_0x3671bb,_0xd81e7a){var _0x44195b,_0x15c109,_0x48e9ff;var _0x28ea44=[];var _0x21f7d3={};var _0x24870b=_0x3671bb['files']||[];var _0x1fdc6a=[];var _0x57cf19;return db['CmContact']['describe']()[_0x68ef('0x2f')](function(_0xe0a8a6){if(!_0xe0a8a6){throw new db['Sequelize'][(_0x68ef('0xd3'))]('no\x20available\x20attributes');}_0x28ea44=_['difference'](_[_0x68ef('0x4e')](_0xe0a8a6),[_0x68ef('0xa3'),_0x68ef('0xa4'),_0x68ef('0xd4'),_0x68ef('0xa6')]);if(_0x3671bb[_0x68ef('0x67')]['id']){delete _0x3671bb[_0x68ef('0x67')]['id'];}if(_[_0x68ef('0x8b')](_0x3671bb[_0x68ef('0x67')][_0x68ef('0xa7')])){throw _0xd81e7a[_0x68ef('0x34')](0x1f4)['send'](new db[(_0x68ef('0xd5'))][(_0x68ef('0xd3'))]('from\x20is\x20mandatory'));}if(_[_0x68ef('0x8b')](_0x3671bb['body'][_0x68ef('0x67')])||_0x3671bb[_0x68ef('0x67')][_0x68ef('0x67')]===''){throw _0xd81e7a['status'](0x1f4)[_0x68ef('0x35')](new db[(_0x68ef('0xd5'))][(_0x68ef('0xd3'))](_0x68ef('0xd6')));}if(_[_0x68ef('0x8b')](_0x3671bb[_0x68ef('0x67')]['mapKeyOffline'])){throw _0xd81e7a['status'](0x1f4)[_0x68ef('0x35')](new db['Sequelize'][(_0x68ef('0xd3'))](_0x68ef('0xd7')+_0x28ea44));}if(!_[_0x68ef('0xa5')](_0x28ea44,_0x3671bb[_0x68ef('0x67')][_0x68ef('0xd8')])){throw _0xd81e7a[_0x68ef('0x34')](0x1f4)[_0x68ef('0x35')](new db[(_0x68ef('0xd5'))]['ValidationError'](_0x68ef('0xd9')+_0x28ea44));}_0x21f7d3[_0x3671bb[_0x68ef('0x67')][_0x68ef('0xd8')]]=_0x3671bb['body'][_0x68ef('0xa7')];})[_0x68ef('0x2f')](function(){return db[_0x68ef('0x49')][_0x68ef('0x65')]({'where':{'id':_0x3671bb[_0x68ef('0x61')]['id']},'include':[{'model':db[_0x68ef('0xa8')],'as':_0x68ef('0xa9')},{'model':db[_0x68ef('0xda')],'as':_0x68ef('0xda')}]});})['then'](handleEntityNotFound(_0xd81e7a,null))['then'](function(_0x307741){if(_0x307741&&_0x307741[_0x68ef('0xa9')]){_0x15c109=_0x307741;var _0x532d04=_[_0x68ef('0x15')](_0x3671bb[_0x68ef('0x67')],{'firstName':_0x3671bb['body']['from'],'phone':_0x3671bb['body']['from'],'ListId':_0x307741[_0x68ef('0xa6')]});_0x532d04[_0x3671bb['body'][_0x68ef('0xd8')]]=_0x3671bb['body'][_0x68ef('0xa7')];return db[_0x68ef('0xa1')]['findOrCreate']({'where':_0x21f7d3,'defaults':_0x532d04});}})['spread'](function(_0x55591c){if(_0x55591c){_0x48e9ff=_0x55591c;var _0x3c3ad4=fs[_0x68ef('0xdb')](path[_0x68ef('0x8d')](config['root'],_0x68ef('0xdc')),'utf8');var _0x22a810=ejs['render'](_0x3c3ad4,{'body':_[_0x68ef('0xdd')](_0x3671bb[_0x68ef('0x67')][_0x68ef('0x67')]),'bodyTitle':_0x15c109[_0x68ef('0xde')]});return db[_0x68ef('0xdf')][_0x68ef('0x66')]({'body':_0x22a810,'plainBody':htmlToText[_0x68ef('0xe0')](_0x22a810),'ContactId':_0x55591c['id'],'ChatWebsiteId':_0x15c109['id']});}})['then'](function(_0x274a7a){_0x57cf19=_0x274a7a;if(_0x24870b[_0x68ef('0x53')]){var _0x362a87=_0x24870b[_0x68ef('0x4c')](function(_0x3e5e1e){return{'name':_0x3e5e1e[_0x68ef('0xe1')],'basename':_0x3e5e1e[_0x68ef('0x86')],'type':_0x3e5e1e['mimetype'],'ChatOfflineMessageId':_0x274a7a['id']};});_0x1fdc6a=_0x362a87[_0x68ef('0x4c')](_0x382fcf=>{var _0x455770={'filename':_0x382fcf[_0x68ef('0x33')],'path':path[_0x68ef('0x8d')](config[_0x68ef('0x8e')],_0x68ef('0xe2'),_0x68ef('0xe3'),_0x68ef('0xe4'),_0x68ef('0xe5'),_0x382fcf[_0x68ef('0xe6')])};return _0x455770;});if(!_0x15c109[_0x68ef('0xe7')]){return db['sequelize'][_0x68ef('0xe8')](function(_0x14b845){return db[_0x68ef('0xe9')][_0x68ef('0xea')](_0x362a87,{'transaction':_0x14b845});});}}})['then'](function(){if(_0x57cf19){_0x44195b=_0x57cf19;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x68ef('0xeb')],'as':_0x68ef('0xec'),'raw':!![],'include':[{'model':db[_0x68ef('0xed')],'as':_0x68ef('0xed'),'raw':!![]}]}]});}})['then'](function(_0x4987c7){if(_0x4987c7&&_0x4987c7['Smtp']&&_0x15c109[_0x68ef('0xee')]&&_0x15c109[_0x68ef('0xef')]){var _0x547e6d=_0x4987c7['getSmtpOptions']();return respondWithRpcPromise(_0x68ef('0xf0'),_0x68ef('0xf1'),{'account':_0x547e6d,'message':{'from':util[_0x68ef('0x40')](_0x68ef('0xf2'),_0x4987c7[_0x68ef('0x33')],_0x4987c7[_0x68ef('0xf3')]||_0x4987c7[_0x68ef('0xec')]['user']),'to':_0x15c109[_0x68ef('0xef')],'subject':_0x15c109[_0x68ef('0xf4')],'html':_0x44195b[_0x68ef('0x67')],'attachments':_0x1fdc6a}},client9003)[_0x68ef('0x2f')](function(){return _0x44195b;})[_0x68ef('0x26')](function(_0x585daf){logger[_0x68ef('0x22')](_0x585daf);});}})[_0x68ef('0x2f')](function(){if(_0x15c109&&_0x15c109['openNewInteraction']&&_0x15c109[_0x68ef('0xf5')]){var _0x356b49=[];if(_0x24870b[_0x68ef('0x53')]){_0x356b49=_0x24870b[_0x68ef('0x4c')](function(_0x572f56){return{'name':_0x572f56[_0x68ef('0xe1')],'basename':_0x572f56['filename'],'type':_0x572f56[_0x68ef('0xf6')],'ChatOfflineMessageId':_0x57cf19['id']};});}var _0x7a3535;if(!_[_0x68ef('0x8b')](_0x15c109['subjectOffline'])){var _0x345431=_[_0x68ef('0x4c')](_0x3671bb['body'],function(_0x4d3b93){return _0x4d3b93;});var _0x392c0=_[_0x68ef('0xf7')](_0x345431)[0x0];var _0x5785e4=_['mapValues'](_0x392c0,function(_0x3394c5){return _0x3394c5;});_0x7a3535=_0x5785e4[0x1][_0x15c109[_0x68ef('0xf8')]];}var _0x25affd={'from':_0x48e9ff[_0x68ef('0xf3')],'firstName':_0x48e9ff[_0x68ef('0x3b')],'lastName':_0x48e9ff[_0x68ef('0x3c')],'mapKey':_0x68ef('0xf3'),'message':{'from':_0x48e9ff['email'],'to':_0x15c109[_0x68ef('0xda')][_0x68ef('0xf3')],'cc':'','subject':_[_0x68ef('0x8b')](_0x7a3535)?_0x15c109[_0x68ef('0xf4')]:_0x7a3535,'messageId':'','sentAt':new Date(),'attach':_0x356b49[_0x68ef('0x53')],'attachments':_0x356b49,'originChannel':_0x68ef('0xf9'),'ChatWebsiteId':_0x15c109['id'],'ChatOfflineMessageId':_0x44195b['id'],'originTo':_0x15c109[_0x68ef('0xda')][_0x68ef('0xf3')]},'body':_0x44195b[_0x68ef('0x67')]};var _0x1c83dc={'account':{'id':_0x15c109[_0x68ef('0xf5')]},'body':_0x25affd,'log':_0x68ef('0xfa')};return respondWithRpcPromise(_0x68ef('0xfa'),_0x68ef('0xfb'),_0x1c83dc,client9001)[_0x68ef('0x2f')](function(){return _0x44195b;})['catch'](function(_0x5cb37d){logger[_0x68ef('0x22')](_0x5cb37d);});}return;})[_0x68ef('0x2f')](function(){if(_0x44195b){return _0x44195b;}})[_0x68ef('0x2f')](respondWithResult(_0xd81e7a,null))[_0x68ef('0x26')](function(){for(var _0x492f6a of _0x24870b){var _0x42ad5b=path[_0x68ef('0x8d')](config['root'],'server','files',_0x68ef('0xe4'),_0x68ef('0xe5'),_0x492f6a[_0x68ef('0x86')]);fs_extra['remove'](_0x42ad5b)[_0x68ef('0x26')](function(_0x4bd7ab){logger[_0x68ef('0x22')](_0x68ef('0xfc'),_0x42ad5b,_0x4bd7ab);});}});};exports[_0x68ef('0xfd')]=function(_0x26539a,_0x5c48fb){return db[_0x68ef('0xba')][_0x68ef('0x65')]({'where':{'id':_0x26539a[_0x68ef('0x61')]['id']}})[_0x68ef('0x2f')](handleEntityNotFound(_0x5c48fb,null))[_0x68ef('0x2f')](function(_0xbf4eee){if(_0xbf4eee){return _0xbf4eee[_0x68ef('0xfd')](_0x26539a['body'][_0x68ef('0x7f')],_[_0x68ef('0xfe')](_0x26539a[_0x68ef('0x67')],[_0x68ef('0x7f'),'id'])||{});}})[_0x68ef('0x2f')](respondWithResult(_0x5c48fb,null))[_0x68ef('0x26')](handleError(_0x5c48fb,null));};exports['getInteractions']=function(_0x29a5ab,_0x26b50b){var _0x5925cd={'raw':![],'where':{}};var _0x40aa5c={};var _0x50ad60={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x68ef('0x79')]({'where':{'id':_0x29a5ab['params']['id']}})[_0x68ef('0x2f')](handleEntityNotFound(_0x26b50b,null))[_0x68ef('0x2f')](function(_0x11a6c3){if(_0x11a6c3){_0x40aa5c[_0x68ef('0x44')]=_[_0x68ef('0x4e')](db[_0x68ef('0xba')][_0x68ef('0x4a')]);_0x40aa5c[_0x68ef('0x4d')]=_[_0x68ef('0x4e')](_0x29a5ab[_0x68ef('0x4d')]);_0x40aa5c[_0x68ef('0x4f')]=_[_0x68ef('0x50')](_0x40aa5c[_0x68ef('0x44')],_0x40aa5c[_0x68ef('0x4d')]);_0x5925cd[_0x68ef('0x52')]=_[_0x68ef('0x50')](_0x40aa5c[_0x68ef('0x44')],qs[_0x68ef('0x51')](_0x29a5ab[_0x68ef('0x4d')]['fields']));_0x5925cd['attributes']=_0x5925cd[_0x68ef('0x52')][_0x68ef('0x53')]?_0x5925cd[_0x68ef('0x52')]:_0x40aa5c[_0x68ef('0x44')];if(!_0x29a5ab[_0x68ef('0x4d')][_0x68ef('0x54')]('nolimit')){_0x5925cd[_0x68ef('0x2a')]=qs[_0x68ef('0x2a')](_0x29a5ab[_0x68ef('0x4d')][_0x68ef('0x2a')]);_0x5925cd[_0x68ef('0x28')]=qs['offset'](_0x29a5ab['query'][_0x68ef('0x28')]);}_0x5925cd[_0x68ef('0x56')]=qs[_0x68ef('0x57')](_0x29a5ab[_0x68ef('0x4d')][_0x68ef('0x57')]);_0x5925cd[_0x68ef('0x58')]=qs[_0x68ef('0x4f')](_['pick'](_0x29a5ab['query'],_0x40aa5c[_0x68ef('0x4f')]));_0x5925cd[_0x68ef('0x58')][_0x68ef('0x76')]=_0x11a6c3['id'];if(_0x29a5ab['query'][_0x68ef('0x5a')]){_0x5925cd[_0x68ef('0x58')]=_[_0x68ef('0x5c')](_0x5925cd[_0x68ef('0x58')],{'$or':_[_0x68ef('0x4c')](_0x5925cd[_0x68ef('0x52')],function(_0x16e114){var _0x279761={};_0x279761[_0x16e114]={'$like':'%'+_0x29a5ab['query'][_0x68ef('0x5a')]+'%'};return _0x279761;})});}_0x5925cd=_['merge']({},_0x5925cd,_0x29a5ab[_0x68ef('0x64')]);return db[_0x68ef('0xba')][_0x68ef('0x2b')]({'where':_0x5925cd['where']})[_0x68ef('0x2f')](function(_0x1b57f7){_0x50ad60[_0x68ef('0x2b')]=_0x1b57f7;if(_0x29a5ab[_0x68ef('0x4d')][_0x68ef('0x5d')]){_0x5925cd[_0x68ef('0x63')]=[{'model':db[_0x68ef('0xa1')],'as':_0x68ef('0xff'),'required':![]},{'model':db[_0x68ef('0xc7')],'as':'Owner','attributes':['name',_0x68ef('0x100'),_0x68ef('0x101')],'required':![]},{'model':db[_0x68ef('0x102')],'as':'Tags','attributes':['id',_0x68ef('0x33'),_0x68ef('0x103')],'where':_0x29a5ab[_0x68ef('0x4d')]['tag']?{'id':_0x29a5ab['query'][_0x68ef('0x104')]}:undefined,'required':_0x29a5ab[_0x68ef('0x4d')][_0x68ef('0x104')]?!![]:![]}];}return db[_0x68ef('0xba')][_0x68ef('0x5e')](_0x5925cd);})[_0x68ef('0x2f')](function(_0x51bd64){_0x50ad60['rows']=_0x51bd64;return _0x50ad60;});}})[_0x68ef('0x2f')](respondWithFilteredResult(_0x26b50b,_0x5925cd))[_0x68ef('0x26')](handleError(_0x26b50b,null));};exports[_0x68ef('0x105')]=function(_0x5b5bd6,_0x3407f7){var _0x148e0c=0x0;var _0x5c7004=0x0;var _0x45c033=![];var _0x13bd14;var _0x48ae28;return db[_0x68ef('0x49')][_0x68ef('0x65')]({'where':{'id':_0x5b5bd6[_0x68ef('0x61')]['id']},'include':[{'model':db['Interval'],'as':_0x68ef('0x97'),'include':[{'model':db[_0x68ef('0x97')],'as':_0x68ef('0xae'),'attributes':['id',_0x68ef('0xaf')]}]}]})[_0x68ef('0x2f')](handleEntityNotFound(_0x3407f7,null))[_0x68ef('0x2f')](function(_0x3b8f19){if(_0x3b8f19){_0x13bd14=_0x3b8f19;return _0x3b8f19[_0x68ef('0x106')]({'raw':!![]});}})['then'](function(_0x1873b5){if(_0x13bd14){if(_0x1873b5){_0x48ae28=_0x1873b5;}}return require(_0x68ef('0x89'))[_0x68ef('0x107')]();})[_0x68ef('0x2f')](function(_0x58ed21){if(_0x58ed21){_0x5c7004=_0x58ed21[_0x68ef('0x108')];_0x45c033=_0x58ed21[_0x68ef('0x8a')];}})[_0x68ef('0x2f')](function(){return db[_0x68ef('0xba')][_0x68ef('0x2b')]({'where':{'closed':![]}});})['then'](function(_0x5b41f0){_0x148e0c=_0x5b41f0;if(_0x5c7004&&_0x5b41f0>_0x5c7004){return db[_0x68ef('0x109')]['findOne']({'where':{'id':0x1}})['then'](function(_0x14b359){if(_0x14b359){_0x14b359[_0x68ef('0x10a')](_0x68ef('0x10b'));}});}})[_0x68ef('0x2f')](function(){var _0x176f93=_0x13bd14[_0x68ef('0x97')];var _0x3ee069=_0x13bd14['timezone']||undefined;return _0x176f93?_0x176f93[_0x68ef('0x10c')](_0x3ee069):!![];})[_0x68ef('0x2f')](function(_0x794d1e){var _0x266f6c=fs[_0x68ef('0xdb')](path['join'](config[_0x68ef('0x8e')],_0x68ef('0x10d')),_0x68ef('0x10e'));var _0x2b5994=_0x68ef('0x10f');var _0x23a982=![];var _0x36ae4e,_0x4356f3;if(_0x5b5bd6['headers'][_0x68ef('0xa0')]){_0x36ae4e=new URL(_0x5b5bd6[_0x68ef('0xb7')][_0x68ef('0xa0')])[_0x68ef('0x110')];}else if(_0x5b5bd6[_0x68ef('0xb7')][_0x68ef('0x110')]){_0x36ae4e=new URL(_0x5b5bd6[_0x68ef('0xb7')][_0x68ef('0x110')])['origin'];}else{_0x36ae4e=_0x68ef('0x111');}_0x4356f3=typeof _0x13bd14[_0x68ef('0x72')][_0x68ef('0x68')](',')[_0x68ef('0x65')](function(_0x12fed3){return wildcardUtils['testWebsiteWithWildcard'](_0x12fed3,_0x36ae4e);})!==_0x68ef('0x29');var _0x3dbdeb={'chatVersion':_0x2b5994,'chatWebsiteAddressOrigin':_0x4356f3?_0x36ae4e:_0x13bd14[_0x68ef('0x72')],'remote':_0x13bd14[_0x68ef('0x112')],'query':querystring[_0x68ef('0x21')](_[_0x68ef('0x5c')](_0x13bd14[_0x68ef('0x6d')]({'plain':!![]}),{'customerIp':_0x5b5bd6[_0x68ef('0xb7')][_0x68ef('0x39')]||_0x5b5bd6[_0x68ef('0xb7')][_0x68ef('0x113')]||_0x5b5bd6[_0x68ef('0x114')][_0x68ef('0x115')]||_0x5b5bd6['ip'],'referer':_0x5b5bd6['headers'][_0x68ef('0xa0')],'openedInteractions':_0x148e0c,'maxInteractions':_0x5c7004,'virtual':_0x45c033[_0x68ef('0x108')],'online':_0x794d1e,'custom':_0x45c033,'address':_0x4356f3?_0x36ae4e:null}))[_0x68ef('0x116')](/'/g,'\x5c\x27')};_0x3407f7[_0x68ef('0x35')](ejs[_0x68ef('0x117')](Mustache['render'](_0x266f6c,_0x3dbdeb),{'proactiveActions':_0x48ae28,'alignment':_0x13bd14[_0x68ef('0x118')],'verticalAlignment':_0x13bd14['verticalAlignment'],'div_color':_0x13bd14['color'],'labelText':_0x13bd14[_0x68ef('0x119')],'text_color':_0x13bd14['textColor'],'text_button_color':_0x13bd14['textButtonColor'],'button_color':_0x13bd14[_0x68ef('0x11a')],'background_color':_0x13bd14['backgroundColor'],'hideWhenOffline':_0x13bd14[_0x68ef('0x11b')],'intervalId':_0x13bd14[_0x68ef('0x11c')],'isDevelopment':_0x23a982,'chatVersion':_0x2b5994}));})[_0x68ef('0x26')](handleError(_0x3407f7,null));};exports[_0x68ef('0x11d')]=function(_0x1dd466,_0x190290){var _0x432e84=_0x1dd466[_0x68ef('0x61')]['id'];var _0x5af158=_0x1dd466['body'];var _0x11245b=0xc8;var _0x477f02=null;return db[_0x68ef('0x11e')][_0x68ef('0xe8')]({'isolationLevel':db[_0x68ef('0x11e')][_0x68ef('0x11f')][_0x68ef('0x120')][_0x68ef('0x121')]},function(_0x29662c){return db[_0x68ef('0x49')][_0x68ef('0x79')]({'where':{'id':_0x432e84},'transaction':_0x29662c})[_0x68ef('0x2f')](function(_0x53612f){if(_0x53612f){return db[_0x68ef('0xac')]['destroy']({'where':{'ChatWebsiteId':_0x432e84},'transaction':_0x29662c})[_0x68ef('0x2f')](function(){var _0x2bc0c=_[_0x68ef('0x4c')](_0x5af158,function(_0x398b25){_0x398b25['ChatWebsiteId']=_0x432e84;return _0x398b25;});return db[_0x68ef('0xac')][_0x68ef('0xea')](_0x2bc0c,{'transaction':_0x29662c});});}else{_0x11245b=0x194;_0x477f02=[];}});})[_0x68ef('0x2f')](function(){if(_0x11245b!==0x194){return db[_0x68ef('0xac')][_0x68ef('0x122')]({'where':{'ChatWebsiteId':_0x432e84},'order':_0x68ef('0xb3')})['then'](function(_0x433cf3){_0x477f02=_0x433cf3;});}})['catch'](function(_0x30709a){_0x11245b=0x1f4;logger[_0x68ef('0x22')](_0x30709a[_0x68ef('0x32')]);if(_0x30709a[_0x68ef('0x33')]){delete _0x30709a[_0x68ef('0x33')];}_0x477f02=_0x30709a;})[_0x68ef('0x123')](function(){if(_0x477f02===null){_0x190290['sendStatus'](_0x11245b);}else{if(_0x11245b===0x1f4){_0x190290['status'](_0x11245b)['send'](_0x477f02);}else{_0x190290[_0x68ef('0x34')](_0x11245b)[_0x68ef('0x2d')](_0x477f02);}}});};exports['getApplications']=function(_0x973845,_0x3ad9d8){var _0x3d7d2b={};var _0x119b22={};var _0x49f352;var _0xc997d5;return db[_0x68ef('0x49')][_0x68ef('0x79')]({'where':{'id':_0x973845[_0x68ef('0x61')]['id']}})[_0x68ef('0x2f')](handleEntityNotFound(_0x3ad9d8,null))[_0x68ef('0x2f')](function(_0x2ec497){if(_0x2ec497){_0x49f352=_0x2ec497;_0x119b22[_0x68ef('0x44')]=_[_0x68ef('0x4e')](db[_0x68ef('0xac')]['rawAttributes']);_0x119b22[_0x68ef('0x4d')]=_[_0x68ef('0x4e')](_0x973845[_0x68ef('0x4d')]);_0x119b22[_0x68ef('0x4f')]=_['intersection'](_0x119b22[_0x68ef('0x44')],_0x119b22[_0x68ef('0x4d')]);_0x3d7d2b[_0x68ef('0x52')]=_[_0x68ef('0x50')](_0x119b22['model'],qs[_0x68ef('0x51')](_0x973845[_0x68ef('0x4d')][_0x68ef('0x51')]));_0x3d7d2b['attributes']=_0x3d7d2b['attributes']['length']?_0x3d7d2b[_0x68ef('0x52')]:_0x119b22['model'];_0x3d7d2b['order']=qs[_0x68ef('0x57')](_0x973845['query'][_0x68ef('0x57')]);_0x3d7d2b[_0x68ef('0x58')]=qs[_0x68ef('0x4f')](_[_0x68ef('0x59')](_0x973845['query'],_0x119b22[_0x68ef('0x4f')]));if(_0x973845[_0x68ef('0x4d')][_0x68ef('0x5a')]){_0x3d7d2b['where']=_[_0x68ef('0x5c')](_0x3d7d2b[_0x68ef('0x58')],{'$or':_[_0x68ef('0x4c')](_0x3d7d2b['attributes'],function(_0x4c6756){var _0x476b42={};_0x476b42[_0x4c6756]={'$like':'%'+_0x973845['query'][_0x68ef('0x5a')]+'%'};return _0x476b42;})});}_0x3d7d2b=_['merge']({},_0x3d7d2b,_0x973845['options']);return _0x49f352['getApplications'](_0x3d7d2b);}})[_0x68ef('0x2f')](function(_0xc001){if(_0xc001){_0xc997d5=_0xc001[_0x68ef('0x53')];if(!_0x973845[_0x68ef('0x4d')][_0x68ef('0x54')]('nolimit')){_0x3d7d2b[_0x68ef('0x2a')]=qs[_0x68ef('0x2a')](_0x973845[_0x68ef('0x4d')]['limit']);_0x3d7d2b[_0x68ef('0x28')]=qs[_0x68ef('0x28')](_0x973845[_0x68ef('0x4d')][_0x68ef('0x28')]);}return _0x49f352[_0x68ef('0x124')](_0x3d7d2b);}})[_0x68ef('0x2f')](function(_0x5bf525){if(_0x5bf525){return _0x5bf525?{'count':_0xc997d5,'rows':_0x5bf525}:null;}})[_0x68ef('0x2f')](respondWithResult(_0x3ad9d8,null))[_0x68ef('0x26')](handleError(_0x3ad9d8,null));};exports[_0x68ef('0x125')]=function(_0x2e7038,_0x48b20b){return db[_0x68ef('0x126')][_0x68ef('0x65')]({'where':{'id':_0x2e7038[_0x68ef('0x61')]['id']}})[_0x68ef('0x2f')](handleEntityNotFound(_0x48b20b,null))[_0x68ef('0x2f')](function(_0x2b37a8){if(_0x2b37a8){return _0x2b37a8[_0x68ef('0x125')](_0x2e7038[_0x68ef('0x67')][_0x68ef('0x7f')],_[_0x68ef('0xfe')](_0x2e7038[_0x68ef('0x67')],[_0x68ef('0x7f'),'id'])||{});}})['then'](respondWithResult(_0x48b20b,null))[_0x68ef('0x26')](handleError(_0x48b20b,null));};exports['getProactiveActions']=function(_0x56492c,_0x2ee1d9){var _0x57f491={};var _0x8c89f={};var _0x347c54;var _0x4a3e5f;return db[_0x68ef('0x49')][_0x68ef('0x79')]({'where':{'id':_0x56492c['params']['id']}})[_0x68ef('0x2f')](handleEntityNotFound(_0x2ee1d9,null))[_0x68ef('0x2f')](function(_0x44f2e4){if(_0x44f2e4){_0x347c54=_0x44f2e4;_0x8c89f[_0x68ef('0x44')]=_[_0x68ef('0x4e')](db[_0x68ef('0x127')][_0x68ef('0x4a')]);_0x8c89f[_0x68ef('0x4d')]=_['keys'](_0x56492c[_0x68ef('0x4d')]);_0x8c89f['filters']=_['intersection'](_0x8c89f[_0x68ef('0x44')],_0x8c89f[_0x68ef('0x4d')]);_0x57f491['attributes']=_['intersection'](_0x8c89f['model'],qs[_0x68ef('0x51')](_0x56492c['query'][_0x68ef('0x51')]));_0x57f491[_0x68ef('0x52')]=_0x57f491[_0x68ef('0x52')][_0x68ef('0x53')]?_0x57f491[_0x68ef('0x52')]:_0x8c89f[_0x68ef('0x44')];_0x57f491['order']=qs['sort'](_0x56492c[_0x68ef('0x4d')]['sort']);_0x57f491[_0x68ef('0x58')]=qs[_0x68ef('0x4f')](_[_0x68ef('0x59')](_0x56492c[_0x68ef('0x4d')],_0x8c89f['filters']));if(_0x56492c[_0x68ef('0x4d')]['filter']){_0x57f491[_0x68ef('0x58')]=_[_0x68ef('0x5c')](_0x57f491[_0x68ef('0x58')],{'$or':_[_0x68ef('0x4c')](_0x57f491[_0x68ef('0x52')],function(_0x50e707){var _0x5254db={};_0x5254db[_0x50e707]={'$like':'%'+_0x56492c[_0x68ef('0x4d')][_0x68ef('0x5a')]+'%'};return _0x5254db;})});}_0x57f491=_['merge']({},_0x57f491,_0x56492c[_0x68ef('0x64')]);return _0x347c54[_0x68ef('0x106')](_0x57f491);}})[_0x68ef('0x2f')](function(_0x169281){if(_0x169281){_0x4a3e5f=_0x169281[_0x68ef('0x53')];if(!_0x56492c['query']['hasOwnProperty'](_0x68ef('0x55'))){_0x57f491[_0x68ef('0x2a')]=qs[_0x68ef('0x2a')](_0x56492c[_0x68ef('0x4d')][_0x68ef('0x2a')]);_0x57f491[_0x68ef('0x28')]=qs[_0x68ef('0x28')](_0x56492c[_0x68ef('0x4d')][_0x68ef('0x28')]);}return _0x347c54[_0x68ef('0x106')](_0x57f491);}})['then'](function(_0x5dd039){if(_0x5dd039){return _0x5dd039?{'count':_0x4a3e5f,'rows':_0x5dd039}:null;}})[_0x68ef('0x2f')](respondWithResult(_0x2ee1d9,null))[_0x68ef('0x26')](handleError(_0x2ee1d9,null));};exports[_0x68ef('0x128')]=function(_0x2b8ec2,_0x30ea3c){var _0x4ef81e=_0x2b8ec2[_0x68ef('0x4d')]['online']===_0x68ef('0x129')?_0x68ef('0x12a'):_0x68ef('0x12b');return db[_0x68ef('0x49')][_0x68ef('0x65')]({'attributes':['id',_0x4ef81e],'where':{'id':_0x2b8ec2['params']['id']}})[_0x68ef('0x2f')](handleEntityNotFound(_0x30ea3c,null))[_0x68ef('0x2f')](function(_0xc66418){if(_0xc66418){var _0x28addd=_0xc66418[_0x4ef81e];var _0x2ded22=_0x28addd&&_0x28addd['items']?_0x28addd[_0x68ef('0x12c')]:[];_0x30ea3c[_0x68ef('0x35')]({'fromKey':_[_0x68ef('0x8b')](_0x28addd[_0x68ef('0x12d')])?undefined:_0x28addd[_0x68ef('0x12d')],'count':_0x2ded22[_0x68ef('0x53')],'rows':_0x2ded22});}})['catch'](handleError(_0x30ea3c,null));};exports[_0x68ef('0x12e')]=function(_0x236a7d,_0x2998ed){var _0x5149b2={'raw':![],'where':{}};var _0x3f6f27={};var _0x3a78a2={'count':0x0,'rows':[]};return db[_0x68ef('0x49')][_0x68ef('0x79')]({'where':{'id':_0x236a7d['params']['id']}})[_0x68ef('0x2f')](handleEntityNotFound(_0x2998ed,null))[_0x68ef('0x2f')](function(_0x31a3ab){if(_0x31a3ab){_0x3f6f27[_0x68ef('0x44')]=_['keys'](db[_0x68ef('0xdf')][_0x68ef('0x4a')]);_0x3f6f27[_0x68ef('0x4d')]=_[_0x68ef('0x4e')](_0x236a7d[_0x68ef('0x4d')]);_0x3f6f27['filters']=_['intersection'](_0x3f6f27['model'],_0x3f6f27['query']);_0x5149b2[_0x68ef('0x52')]=_['intersection'](_0x3f6f27[_0x68ef('0x44')],qs[_0x68ef('0x51')](_0x236a7d['query'][_0x68ef('0x51')]));_0x5149b2[_0x68ef('0x52')]=_0x5149b2[_0x68ef('0x52')][_0x68ef('0x53')]?_0x5149b2['attributes']:_0x3f6f27[_0x68ef('0x44')];if(!_0x236a7d[_0x68ef('0x4d')]['hasOwnProperty'](_0x68ef('0x55'))){_0x5149b2[_0x68ef('0x2a')]=qs[_0x68ef('0x2a')](_0x236a7d['query']['limit']);_0x5149b2[_0x68ef('0x28')]=qs[_0x68ef('0x28')](_0x236a7d['query'][_0x68ef('0x28')]);}_0x5149b2[_0x68ef('0x56')]=qs[_0x68ef('0x57')](_0x236a7d[_0x68ef('0x4d')][_0x68ef('0x57')]);_0x5149b2[_0x68ef('0x58')]=qs[_0x68ef('0x4f')](_['pick'](_0x236a7d['query'],_0x3f6f27['filters']));_0x5149b2['where'][_0x68ef('0x76')]=_0x31a3ab['id'];if(_0x236a7d[_0x68ef('0x4d')][_0x68ef('0x5a')]){_0x5149b2['where']=_[_0x68ef('0x5c')](_0x5149b2[_0x68ef('0x58')],{'$or':_[_0x68ef('0x4c')](_0x5149b2[_0x68ef('0x52')],function(_0x316d61){var _0x239d0d={};_0x239d0d[_0x316d61]={'$like':'%'+_0x236a7d['query'][_0x68ef('0x5a')]+'%'};return _0x239d0d;})});}_0x5149b2=_[_0x68ef('0x5c')]({},_0x5149b2,_0x236a7d[_0x68ef('0x64')]);return db['ChatOfflineMessage'][_0x68ef('0x2b')]({'where':_0x5149b2[_0x68ef('0x58')]})[_0x68ef('0x2f')](function(_0x674f00){_0x3a78a2['count']=_0x674f00;if(_0x236a7d[_0x68ef('0x4d')][_0x68ef('0x5d')]){_0x5149b2[_0x68ef('0x63')]=[{'all':!![]}];}else{_0x5149b2[_0x68ef('0x63')]=[{'model':db[_0x68ef('0xa1')],'as':_0x68ef('0xff'),'required':![]},{'model':db[_0x68ef('0xe9')],'as':_0x68ef('0x12f'),'required':![]}];}return db[_0x68ef('0xdf')][_0x68ef('0x5e')](_0x5149b2);})[_0x68ef('0x2f')](function(_0x297f8f){_0x3a78a2['rows']=_0x297f8f;return _0x3a78a2;});}})[_0x68ef('0x2f')](respondWithFilteredResult(_0x2998ed,_0x5149b2))[_0x68ef('0x26')](handleError(_0x2998ed,null));};exports[_0x68ef('0x130')]=function(_0x5bacf5,_0x5aa7c2){return db[_0x68ef('0x49')]['find']({'where':{'id':_0x5bacf5[_0x68ef('0x61')]['id']}})[_0x68ef('0x2f')](handleEntityNotFound(_0x5aa7c2,null))[_0x68ef('0x2f')](function(_0x5b912c){if(_0x5b912c){return _0x5b912c[_0x68ef('0x130')](_0x5bacf5[_0x68ef('0x67')]['ids'],_[_0x68ef('0xfe')](_0x5bacf5['body'],['ids','id'])||{})['spread'](function(_0x53f901){for(var _0x630c64=0x0;_0x630c64<_0x5bacf5[_0x68ef('0x67')][_0x68ef('0x7f')][_0x68ef('0x53')];_0x630c64+=0x1){socket[_0x68ef('0x131')]('userChatWebsite:save',{'UserId':Number(_0x5bacf5[_0x68ef('0x67')][_0x68ef('0x7f')][_0x630c64]),'ChatWebsiteId':Number(_0x5bacf5['params']['id'])});}return _0x53f901;});}})[_0x68ef('0x2f')](respondWithResult(_0x5aa7c2,null))[_0x68ef('0x26')](handleError(_0x5aa7c2,null));};exports[_0x68ef('0x132')]=function(_0xbd336f,_0xd5bac2){return db[_0x68ef('0x49')]['find']({'where':{'id':_0xbd336f[_0x68ef('0x61')]['id']}})[_0x68ef('0x2f')](handleEntityNotFound(_0xd5bac2,null))['then'](function(_0x2db182){if(_0x2db182){return _0x2db182['removeAgents'](_0xbd336f[_0x68ef('0x4d')]['ids'])[_0x68ef('0x2f')](function(){if(_[_0x68ef('0x133')](_0xbd336f['query'][_0x68ef('0x7f')])){for(var _0x51d8e8=0x0;_0x51d8e8<_0xbd336f[_0x68ef('0x4d')][_0x68ef('0x7f')][_0x68ef('0x53')];_0x51d8e8+=0x1){socket[_0x68ef('0x131')]('userChatWebsite:remove',{'UserId':Number(_0xbd336f[_0x68ef('0x4d')][_0x68ef('0x7f')][_0x51d8e8]),'ChatWebsiteId':Number(_0xbd336f['params']['id'])});}}else{socket[_0x68ef('0x131')](_0x68ef('0x134'),{'UserId':Number(_0xbd336f['query'][_0x68ef('0x7f')]),'ChatWebsiteId':Number(_0xbd336f[_0x68ef('0x61')]['id'])});}});}})[_0x68ef('0x2f')](respondWithStatusCode(_0xd5bac2,null))['catch'](handleError(_0xd5bac2,null));};exports[_0x68ef('0x135')]=function(_0x454d6d,_0x599cb1){var _0x261f4c={};var _0x5dc4ec={};var _0x2bc808;var _0x283b1e;return db['ChatWebsite'][_0x68ef('0x79')]({'where':{'id':_0x454d6d[_0x68ef('0x61')]['id']}})[_0x68ef('0x2f')](handleEntityNotFound(_0x599cb1,null))[_0x68ef('0x2f')](function(_0x15db92){if(_0x15db92){_0x2bc808=_0x15db92;_0x5dc4ec['model']=_[_0x68ef('0x4e')](db['User'][_0x68ef('0x4a')]);_0x5dc4ec[_0x68ef('0x4d')]=_[_0x68ef('0x4e')](_0x454d6d['query']);_0x5dc4ec['filters']=_[_0x68ef('0x50')](_0x5dc4ec[_0x68ef('0x44')],_0x5dc4ec[_0x68ef('0x4d')]);_0x261f4c[_0x68ef('0x52')]=_[_0x68ef('0x50')](_0x5dc4ec[_0x68ef('0x44')],qs[_0x68ef('0x51')](_0x454d6d[_0x68ef('0x4d')][_0x68ef('0x51')]));_0x261f4c['attributes']=_0x261f4c[_0x68ef('0x52')][_0x68ef('0x53')]?_0x261f4c[_0x68ef('0x52')]:_0x5dc4ec[_0x68ef('0x44')];_0x261f4c['order']=qs[_0x68ef('0x57')](_0x454d6d[_0x68ef('0x4d')]['sort']);_0x261f4c[_0x68ef('0x58')]=qs[_0x68ef('0x4f')](_[_0x68ef('0x59')](_0x454d6d[_0x68ef('0x4d')],_0x5dc4ec[_0x68ef('0x4f')]));if(_0x454d6d[_0x68ef('0x4d')]['filter']){_0x261f4c[_0x68ef('0x58')]=_[_0x68ef('0x5c')](_0x261f4c['where'],{'$or':_['map'](_0x261f4c[_0x68ef('0x52')],function(_0xb93145){var _0x4fd0f2={};_0x4fd0f2[_0xb93145]={'$like':'%'+_0x454d6d[_0x68ef('0x4d')][_0x68ef('0x5a')]+'%'};return _0x4fd0f2;})});}_0x261f4c=_[_0x68ef('0x5c')]({},_0x261f4c,_0x454d6d[_0x68ef('0x64')]);return _0x2bc808['getAgents'](_0x261f4c);}})['then'](function(_0x4726d0){if(_0x4726d0){_0x283b1e=_0x4726d0[_0x68ef('0x53')];if(!_0x454d6d[_0x68ef('0x4d')][_0x68ef('0x54')]('nolimit')){_0x261f4c['limit']=qs['limit'](_0x454d6d[_0x68ef('0x4d')][_0x68ef('0x2a')]);_0x261f4c[_0x68ef('0x28')]=qs[_0x68ef('0x28')](_0x454d6d['query'][_0x68ef('0x28')]);}return _0x2bc808['getAgents'](_0x261f4c);}})[_0x68ef('0x2f')](function(_0x44e981){if(_0x44e981){return _0x44e981?{'count':_0x283b1e,'rows':_0x44e981}:null;}})[_0x68ef('0x2f')](respondWithResult(_0x599cb1,null))[_0x68ef('0x26')](handleError(_0x599cb1,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index e4dbc1c..0519f7b 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 _0x8c32=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x559cc4,_0x44ce57){var _0x138971=function(_0x7a9eda){while(--_0x7a9eda){_0x559cc4['push'](_0x559cc4['shift']());}};_0x138971(++_0x44ce57);}(_0x8c32,0x130));var _0x28c3=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x8c32[_0x4ae6ef];return _0x3cbb4e;};'use strict';var EventEmitter=require(_0x28c3('0x0'));var ChatWebsite=require(_0x28c3('0x1'))['db'][_0x28c3('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x28c3('0x3')](0x0);var events={'afterCreate':_0x28c3('0x4'),'afterUpdate':_0x28c3('0x5'),'afterDestroy':_0x28c3('0x6')};function emitEvent(_0x14a446){return function(_0x2f94e0,_0x40df22,_0x21259c){ChatWebsiteEvents[_0x28c3('0x7')](_0x14a446+':'+_0x2f94e0['id'],_0x2f94e0);ChatWebsiteEvents['emit'](_0x14a446,_0x2f94e0);_0x21259c(null);};}for(var e in events){if(events[_0x28c3('0x8')](e)){var event=events[e];ChatWebsite[_0x28c3('0x9')](e,emitEvent(event));}}module[_0x28c3('0xa')]=ChatWebsiteEvents; \ No newline at end of file +var _0x2494=['remove','emit','hasOwnProperty','hook','events','ChatWebsite','setMaxListeners','save','update'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0x2494,0x82));var _0x4249=function(_0x2d7a65,_0x446492){_0x2d7a65=_0x2d7a65-0x0;var _0x5b12dc=_0x2494[_0x2d7a65];return _0x5b12dc;};'use strict';var EventEmitter=require(_0x4249('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x4249('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x4249('0x2')](0x0);var events={'afterCreate':_0x4249('0x3'),'afterUpdate':_0x4249('0x4'),'afterDestroy':_0x4249('0x5')};function emitEvent(_0x3fbecf){return function(_0x5decbd,_0x4fdc12,_0x3d42fb){ChatWebsiteEvents['emit'](_0x3fbecf+':'+_0x5decbd['id'],_0x5decbd);ChatWebsiteEvents[_0x4249('0x6')](_0x3fbecf,_0x5decbd);_0x3d42fb(null);};}for(var e in events){if(events[_0x4249('0x7')](e)){var event=events[e];ChatWebsite[_0x4249('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 2c1bd8f..2a264ca 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 _0xade3=['bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util','../../config/logger','moment'];(function(_0x17930e,_0x186d6d){var _0xd60cfa=function(_0xeb0cbe){while(--_0xeb0cbe){_0x17930e['push'](_0x17930e['shift']());}};_0xd60cfa(++_0x186d6d);}(_0xade3,0xe6));var _0x3ade=function(_0x1dddca,_0x22ce3e){_0x1dddca=_0x1dddca-0x0;var _0x4cc028=_0xade3[_0x1dddca];return _0x4cc028;};'use strict';var _=require(_0x3ade('0x0'));var util=require(_0x3ade('0x1'));var logger=require(_0x3ade('0x2'))('api');var moment=require(_0x3ade('0x3'));var BPromise=require(_0x3ade('0x4'));var rp=require(_0x3ade('0x5'));var fs=require('fs');var path=require(_0x3ade('0x6'));var rimraf=require(_0x3ade('0x7'));var config=require(_0x3ade('0x8'));var attributes=require(_0x3ade('0x9'));module[_0x3ade('0xa')]=function(_0x156f40,_0x42da16){return _0x156f40['define'](_0x3ade('0xb'),attributes,{'tableName':_0x3ade('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeff2=['chat_websites','util','../../config/logger','api','moment','bluebird','request-promise','exports','define','ChatWebsite'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeff2,0xe7));var _0x2eff=function(_0x4ccbe5,_0x297c05){_0x4ccbe5=_0x4ccbe5-0x0;var _0x2fcd09=_0xeff2[_0x4ccbe5];return _0x2fcd09;};'use strict';var _=require('lodash');var util=require(_0x2eff('0x0'));var logger=require(_0x2eff('0x1'))(_0x2eff('0x2'));var moment=require(_0x2eff('0x3'));var BPromise=require(_0x2eff('0x4'));var rp=require(_0x2eff('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module[_0x2eff('0x6')]=function(_0x2cc58c,_0x5add65){return _0x2cc58c[_0x2eff('0x7')](_0x2eff('0x8'),attributes,{'tableName':_0x2eff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 94e8d48..e08bb45 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 _0x8756=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','./chatWebsite.socket','register','request','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x4a8e2d,_0x3705c4){var _0x55e2b6=function(_0x295ab8){while(--_0x295ab8){_0x4a8e2d['push'](_0x4a8e2d['shift']());}};_0x55e2b6(++_0x3705c4);}(_0x8756,0x88));var _0x6875=function(_0x2d0d4f,_0x85a80c){_0x2d0d4f=_0x2d0d4f-0x0;var _0x5a0406=_0x8756[_0x2d0d4f];return _0x5a0406;};'use strict';var _=require(_0x6875('0x0'));var util=require(_0x6875('0x1'));var moment=require(_0x6875('0x2'));var BPromise=require(_0x6875('0x3'));var rs=require(_0x6875('0x4'));var fs=require('fs');var Redis=require(_0x6875('0x5'));var db=require(_0x6875('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6875('0x7'));var config=require(_0x6875('0x8'));var jayson=require(_0x6875('0x9'));var client=jayson[_0x6875('0xa')][_0x6875('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x6875('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6875('0xc')]));require(_0x6875('0xd'))[_0x6875('0xe')](socket);function respondWithRpcPromise(_0x481460,_0x455eca,_0x3f4f7e){return new BPromise(function(_0x4c661b,_0x598243){return client[_0x6875('0xf')](_0x481460,_0x3f4f7e)['then'](function(_0x262fb8){logger['info'](_0x6875('0x10'),_0x455eca,_0x6875('0x11'));logger[_0x6875('0x12')](_0x6875('0x13'),_0x455eca,_0x6875('0x11'),JSON[_0x6875('0x14')](_0x262fb8));if(_0x262fb8['error']){if(_0x262fb8[_0x6875('0x15')][_0x6875('0x16')]===0x1f4){logger[_0x6875('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x455eca,_0x262fb8[_0x6875('0x15')]['message']);return _0x598243(_0x262fb8[_0x6875('0x15')][_0x6875('0x17')]);}logger[_0x6875('0x15')](_0x6875('0x10'),_0x455eca,_0x262fb8[_0x6875('0x15')][_0x6875('0x17')]);return _0x4c661b(_0x262fb8[_0x6875('0x15')][_0x6875('0x17')]);}else{logger[_0x6875('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x455eca,'request\x20sent');_0x4c661b(_0x262fb8[_0x6875('0x19')][_0x6875('0x17')]);}})[_0x6875('0x1a')](function(_0x10779e){logger[_0x6875('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x455eca,_0x10779e);_0x598243(_0x10779e);});});} \ No newline at end of file +var _0x397a=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x357444,_0x3af105){var _0x816800=function(_0x20052f){while(--_0x20052f){_0x357444['push'](_0x357444['shift']());}};_0x816800(++_0x3af105);}(_0x397a,0xf4));var _0xa397=function(_0x8dc74d,_0x3fdf7e){_0x8dc74d=_0x8dc74d-0x0;var _0x25b623=_0x397a[_0x8dc74d];return _0x25b623;};'use strict';var _=require(_0xa397('0x0'));var util=require(_0xa397('0x1'));var moment=require(_0xa397('0x2'));var BPromise=require(_0xa397('0x3'));var rs=require(_0xa397('0x4'));var fs=require('fs');var Redis=require(_0xa397('0x5'));var db=require(_0xa397('0x6'))['db'];var utils=require(_0xa397('0x7'));var logger=require(_0xa397('0x8'))(_0xa397('0x9'));var config=require('../../config/environment');var jayson=require(_0xa397('0xa'));var client=jayson[_0xa397('0xb')][_0xa397('0xc')]({'port':0x232a});config['redis']=_[_0xa397('0xd')](config[_0xa397('0xe')],{'host':_0xa397('0xf'),'port':0x18eb});var socket=require(_0xa397('0x10'))(new Redis(config['redis']));require(_0xa397('0x11'))[_0xa397('0x12')](socket);function respondWithRpcPromise(_0x17b564,_0x1a020d,_0xb11379){return new BPromise(function(_0x930de2,_0x22efb6){return client[_0xa397('0x13')](_0x17b564,_0xb11379)[_0xa397('0x14')](function(_0xa77a62){logger[_0xa397('0x15')](_0xa397('0x16'),_0x1a020d,_0xa397('0x17'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1a020d,_0xa397('0x17'),JSON[_0xa397('0x18')](_0xa77a62));if(_0xa77a62[_0xa397('0x19')]){if(_0xa77a62[_0xa397('0x19')][_0xa397('0x1a')]===0x1f4){logger[_0xa397('0x19')](_0xa397('0x16'),_0x1a020d,_0xa77a62[_0xa397('0x19')]['message']);return _0x22efb6(_0xa77a62['error'][_0xa397('0x1b')]);}logger['error'](_0xa397('0x16'),_0x1a020d,_0xa77a62['error'][_0xa397('0x1b')]);return _0x930de2(_0xa77a62[_0xa397('0x19')][_0xa397('0x1b')]);}else{logger[_0xa397('0x15')](_0xa397('0x16'),_0x1a020d,'request\x20sent');_0x930de2(_0xa77a62[_0xa397('0x1c')][_0xa397('0x1b')]);}})[_0xa397('0x1d')](function(_0x3a2b2e){logger[_0xa397('0x19')](_0xa397('0x16'),_0x1a020d,_0x3a2b2e);_0x22efb6(_0x3a2b2e);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index e6876bc..a1c3e17 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 _0xfc28=['chatWebsite:','./chatWebsite.events','remove','update','emit','register'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0xfc28,0x1d5));var _0x8fc2=function(_0x455bd2,_0x249b94){_0x455bd2=_0x455bd2-0x0;var _0x1839c7=_0xfc28[_0x455bd2];return _0x1839c7;};'use strict';var ChatWebsiteEvents=require(_0x8fc2('0x0'));var events=['save',_0x8fc2('0x1'),_0x8fc2('0x2')];function createListener(_0x4aeb02,_0x1044bd){return function(_0x5b7388){_0x1044bd[_0x8fc2('0x3')](_0x4aeb02,_0x5b7388);};}function removeListener(_0x20f574,_0x2e7255){return function(){ChatWebsiteEvents['removeListener'](_0x20f574,_0x2e7255);};}exports[_0x8fc2('0x4')]=function(_0x39e5a8){for(var _0x5bc922=0x0,_0x116b7a=events['length'];_0x5bc922<_0x116b7a;_0x5bc922++){var _0x4cf732=events[_0x5bc922];var _0x553d34=createListener(_0x8fc2('0x5')+_0x4cf732,_0x39e5a8);ChatWebsiteEvents['on'](_0x4cf732,_0x553d34);}}; \ No newline at end of file +var _0xd1b3=['removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove','update','emit'];(function(_0x2d7306,_0xc2b92c){var _0x4f1dbe=function(_0x2008ea){while(--_0x2008ea){_0x2d7306['push'](_0x2d7306['shift']());}};_0x4f1dbe(++_0xc2b92c);}(_0xd1b3,0x1ea));var _0x3d1b=function(_0x2b18d8,_0x21778e){_0x2b18d8=_0x2b18d8-0x0;var _0x2bcce2=_0xd1b3[_0x2b18d8];return _0x2bcce2;};'use strict';var ChatWebsiteEvents=require(_0x3d1b('0x0'));var events=[_0x3d1b('0x1'),_0x3d1b('0x2'),_0x3d1b('0x3')];function createListener(_0xd45ef4,_0x129e70){return function(_0x16231f){_0x129e70[_0x3d1b('0x4')](_0xd45ef4,_0x16231f);};}function removeListener(_0x491626,_0x16b8ee){return function(){ChatWebsiteEvents[_0x3d1b('0x5')](_0x491626,_0x16b8ee);};}exports[_0x3d1b('0x6')]=function(_0x4e378c){for(var _0x50fb00=0x0,_0x4f9e6c=events[_0x3d1b('0x7')];_0x50fb00<_0x4f9e6c;_0x50fb00++){var _0xf1aad1=events[_0x50fb00];var _0x21be12=createListener(_0x3d1b('0x8')+_0xf1aad1,_0x4e378c);ChatWebsiteEvents['on'](_0xf1aad1,_0x21be12);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index 3e49202..e120c4d 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80c4=['exports','../../../utils/misc','url','URL','replace','localhost','test','trim','([\x5cw]+)'];(function(_0x117bdd,_0x29a86e){var _0x93ed36=function(_0x473358){while(--_0x473358){_0x117bdd['push'](_0x117bdd['shift']());}};_0x93ed36(++_0x29a86e);}(_0x80c4,0xa3));var _0x480c=function(_0x58fb5a,_0x265e47){_0x58fb5a=_0x58fb5a-0x0;var _0x4a453a=_0x80c4[_0x58fb5a];return _0x4a453a;};var escapeRegExp=require(_0x480c('0x0'))['escapeRegExp'];var URL=require(_0x480c('0x1'))[_0x480c('0x2')];function testWildcardValidity(_0x33fc1a){var _0x44e9d7=!![];try{new URL(_0x33fc1a[_0x480c('0x3')]('*',_0x480c('0x4')));}catch(_0x58d24d){_0x44e9d7=![];}return _0x44e9d7&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x480c('0x5')](_0x33fc1a);}function testWebsiteWithWildcard(_0x3d0f2d,_0x20daac){var _0x1813b6;var _0x9805b5=escapeRegExp(_0x3d0f2d[_0x480c('0x6')]()[_0x480c('0x3')](/\/$/,''))[_0x480c('0x3')]('\x5c*',_0x480c('0x7'));try{new URL(_0x3d0f2d['replace']('\x5c*',_0x480c('0x4')));_0x1813b6=new RegExp(_0x9805b5)[_0x480c('0x5')](_0x20daac);}catch(_0x292aca){_0x1813b6=![];}return _0x1813b6;}module[_0x480c('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x556a=['../../../utils/misc','escapeRegExp','url','URL','replace','localhost','trim','([\x5cw]+)','exports'];(function(_0x58b115,_0x4312f2){var _0x36f6cd=function(_0x1fc4f7){while(--_0x1fc4f7){_0x58b115['push'](_0x58b115['shift']());}};_0x36f6cd(++_0x4312f2);}(_0x556a,0x1dd));var _0xa556=function(_0x1d59da,_0x367d95){_0x1d59da=_0x1d59da-0x0;var _0x4b9200=_0x556a[_0x1d59da];return _0x4b9200;};var escapeRegExp=require(_0xa556('0x0'))[_0xa556('0x1')];var URL=require(_0xa556('0x2'))[_0xa556('0x3')];function testWildcardValidity(_0x30a5ab){var _0x46087f=!![];try{new URL(_0x30a5ab[_0xa556('0x4')]('*',_0xa556('0x5')));}catch(_0x425bc3){_0x46087f=![];}return _0x46087f&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x30a5ab);}function testWebsiteWithWildcard(_0x1f302d,_0x42c7a2){var _0x3339aa;var _0x3095b0=escapeRegExp(_0x1f302d[_0xa556('0x6')]()['replace'](/\/$/,''))[_0xa556('0x4')]('\x5c*',_0xa556('0x7'));try{new URL(_0x1f302d[_0xa556('0x4')]('\x5c*',_0xa556('0x5')));_0x3339aa=new RegExp(_0x3095b0)['test'](_0x42c7a2);}catch(_0x44ea8e){_0x3339aa=![];}return _0x3339aa;}module[_0xa556('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 27d7da3..c500dd2 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 _0x6a3c=['removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','post','create','join','root','server/files/images/logos/','format','now','originalname','single','file','diskStorage','server/files/images/avatars/','%s-%s','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','offline','/:id/interactions','addApplications','addProactiveActions','addAgents','put','update','delete','removeDispositions'];(function(_0x227ff2,_0x5bf697){var _0x297aff=function(_0x348ff8){while(--_0x348ff8){_0x227ff2['push'](_0x227ff2['shift']());}};_0x297aff(++_0x5bf697);}(_0x6a3c,0x133));var _0xc6a3=function(_0x43a862,_0x54e67d){_0x43a862=_0x43a862-0x0;var _0x44d8d6=_0x6a3c[_0x43a862];return _0x44d8d6;};'use strict';var multer=require(_0xc6a3('0x0'));var util=require(_0xc6a3('0x1'));var path=require(_0xc6a3('0x2'));var timeout=require(_0xc6a3('0x3'));var express=require(_0xc6a3('0x4'));var router=express[_0xc6a3('0x5')]();var fs_extra=require(_0xc6a3('0x6'));var auth=require(_0xc6a3('0x7'));var interaction=require(_0xc6a3('0x8'));var config=require(_0xc6a3('0x9'));var controller=require(_0xc6a3('0xa'));router[_0xc6a3('0xb')]('/',auth[_0xc6a3('0xc')](),controller[_0xc6a3('0xd')]);router[_0xc6a3('0xb')](_0xc6a3('0xe'),auth[_0xc6a3('0xc')](),controller[_0xc6a3('0xf')]);router[_0xc6a3('0xb')](_0xc6a3('0x10'),auth[_0xc6a3('0xc')](),controller[_0xc6a3('0x11')]);router[_0xc6a3('0xb')](_0xc6a3('0x12'),auth[_0xc6a3('0xc')](),controller[_0xc6a3('0x13')]);router[_0xc6a3('0xb')](_0xc6a3('0x14'),auth[_0xc6a3('0xc')](),controller['getAnswers']);router[_0xc6a3('0xb')](_0xc6a3('0x15'),controller['getLogo']);router[_0xc6a3('0xb')](_0xc6a3('0x16'),controller[_0xc6a3('0x17')]);router[_0xc6a3('0xb')](_0xc6a3('0x18'),controller[_0xc6a3('0x19')]);router[_0xc6a3('0xb')](_0xc6a3('0x1a'),controller[_0xc6a3('0x1b')]);router[_0xc6a3('0xb')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xc6a3('0x1c')]);router[_0xc6a3('0xb')]('/:id/snippet',controller[_0xc6a3('0x1d')]);router[_0xc6a3('0xb')](_0xc6a3('0x1e'),auth[_0xc6a3('0xc')](),controller[_0xc6a3('0x1f')]);router[_0xc6a3('0xb')](_0xc6a3('0x20'),auth[_0xc6a3('0xc')](),controller[_0xc6a3('0x21')]);router[_0xc6a3('0xb')](_0xc6a3('0x22'),controller[_0xc6a3('0x23')]);router[_0xc6a3('0xb')]('/:id/offline_messages',auth[_0xc6a3('0xc')](),controller[_0xc6a3('0x24')]);router['get'](_0xc6a3('0x25'),auth['isAuthenticated'](),controller[_0xc6a3('0x26')]);router[_0xc6a3('0x27')]('/',auth[_0xc6a3('0xc')](),controller[_0xc6a3('0x28')]);router[_0xc6a3('0x27')](_0xc6a3('0x12'),auth[_0xc6a3('0xc')](),controller['addDisposition']);router[_0xc6a3('0x27')](_0xc6a3('0x14'),auth[_0xc6a3('0xc')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x298fec,_0x2087b9,_0x3a5535){_0x3a5535(null,path[_0xc6a3('0x29')](config[_0xc6a3('0x2a')],_0xc6a3('0x2b')));},'filename':function(_0x5232f3,_0x18ed7f,_0x97f669){_0x97f669(null,util[_0xc6a3('0x2c')]('%s-%s',Date[_0xc6a3('0x2d')](),_0x18ed7f[_0xc6a3('0x2e')]));}})});router['post'](_0xc6a3('0x15'),upload[_0xc6a3('0x2f')](_0xc6a3('0x30')),controller['addLogo']);var upload=multer({'storage':multer[_0xc6a3('0x31')]({'destination':function(_0x3ea88a,_0x5923a6,_0x5bce9f){_0x5bce9f(null,path['join'](config['root'],_0xc6a3('0x32')));},'filename':function(_0x39a0f2,_0x2ecf19,_0x587097){_0x587097(null,util[_0xc6a3('0x2c')](_0xc6a3('0x33'),Date[_0xc6a3('0x2d')](),_0x2ecf19[_0xc6a3('0x2e')]));}})});router[_0xc6a3('0x27')](_0xc6a3('0x16'),upload[_0xc6a3('0x2f')](_0xc6a3('0x30')),controller[_0xc6a3('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4e652a,_0x2aa313,_0x268cdc){_0x268cdc(null,path[_0xc6a3('0x29')](config[_0xc6a3('0x2a')],_0xc6a3('0x32')));},'filename':function(_0x3ddbd9,_0x9a5507,_0x1327e6){_0x1327e6(null,util[_0xc6a3('0x2c')]('%s-%s',Date[_0xc6a3('0x2d')](),_0x9a5507[_0xc6a3('0x2e')]));}})});router[_0xc6a3('0x27')](_0xc6a3('0x18'),upload[_0xc6a3('0x2f')](_0xc6a3('0x30')),controller[_0xc6a3('0x35')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x237876,_0x5c20a1,_0x2ac5e7){_0x2ac5e7(null,path[_0xc6a3('0x29')](config[_0xc6a3('0x2a')],'server/files/images/avatars/'));},'filename':function(_0x56630e,_0x164397,_0x47de69){_0x47de69(null,util['format'](_0xc6a3('0x33'),Date[_0xc6a3('0x2d')](),_0x164397['originalname']));}})});router[_0xc6a3('0x27')]('/:id/system_avatar',upload['single'](_0xc6a3('0x30')),controller[_0xc6a3('0x36')]);router[_0xc6a3('0x27')](_0xc6a3('0x37'),controller[_0xc6a3('0x38')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x3aff0f,_0x513198,_0x238a62){const _0x487c71=path[_0xc6a3('0x29')](config[_0xc6a3('0x2a')],_0xc6a3('0x39'),_0xc6a3('0x3a'),_0xc6a3('0x3b'));fs_extra[_0xc6a3('0x3c')](_0x487c71,function(){_0x238a62(null,_0x487c71);});},'filename':function(_0x15c93f,_0x36106e,_0x598591){const _0x12a6c4=_0x36106e['originalname'][_0xc6a3('0x3d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x217c9b=path[_0xc6a3('0x3e')](_0x12a6c4);const _0x556ad3=Date[_0xc6a3('0x2d')]()+'-'+_0x12a6c4[_0xc6a3('0x3d')](_0x217c9b,'')+_0x217c9b;_0x598591(null,_0x556ad3);}})});router[_0xc6a3('0x27')](_0xc6a3('0x3f'),offlineUploadMulter['any'](),controller[_0xc6a3('0x40')]);router['post'](_0xc6a3('0x41'),auth[_0xc6a3('0xc')](),controller['addInteraction']);router[_0xc6a3('0x27')](_0xc6a3('0x1e'),auth[_0xc6a3('0xc')](),controller[_0xc6a3('0x42')]);router[_0xc6a3('0x27')](_0xc6a3('0x20'),auth['isAuthenticated'](),controller[_0xc6a3('0x43')]);router['post'](_0xc6a3('0x25'),auth['isAuthenticated'](),controller[_0xc6a3('0x44')]);router[_0xc6a3('0x45')](_0xc6a3('0x10'),auth[_0xc6a3('0xc')](),controller[_0xc6a3('0x46')]);router[_0xc6a3('0x47')](_0xc6a3('0x10'),auth[_0xc6a3('0xc')](),controller['destroy']);router[_0xc6a3('0x47')](_0xc6a3('0x12'),auth[_0xc6a3('0xc')](),controller[_0xc6a3('0x48')]);router[_0xc6a3('0x47')](_0xc6a3('0x14'),auth['isAuthenticated'](),controller[_0xc6a3('0x49')]);router['delete'](_0xc6a3('0x25'),auth[_0xc6a3('0xc')](),controller[_0xc6a3('0x4a')]);module[_0xc6a3('0x4b')]=router; \ No newline at end of file +var _0x5f0c=['get','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getApplications','/:id/proactive_actions','getProactiveActions','getOfflineMessages','getAgents','create','post','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','format','%s-%s','now','single','file','addLogo','root','originalname','addAvatar','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','ensureDir','replace','/:id/offline','offline','addInteraction','/:id/applications','addApplications','addProactiveActions','/:id/users','addAgents','put','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller'];(function(_0x43f489,_0x2b4fea){var _0x4134b4=function(_0x4365f6){while(--_0x4365f6){_0x43f489['push'](_0x43f489['shift']());}};_0x4134b4(++_0x2b4fea);}(_0x5f0c,0x85));var _0xc5f0=function(_0xfef90f,_0xc09e7e){_0xfef90f=_0xfef90f-0x0;var _0x483587=_0x5f0c[_0xfef90f];return _0x483587;};'use strict';var multer=require(_0xc5f0('0x0'));var util=require(_0xc5f0('0x1'));var path=require(_0xc5f0('0x2'));var timeout=require(_0xc5f0('0x3'));var express=require(_0xc5f0('0x4'));var router=express[_0xc5f0('0x5')]();var fs_extra=require(_0xc5f0('0x6'));var auth=require(_0xc5f0('0x7'));var interaction=require(_0xc5f0('0x8'));var config=require(_0xc5f0('0x9'));var controller=require(_0xc5f0('0xa'));router[_0xc5f0('0xb')]('/',auth[_0xc5f0('0xc')](),controller['index']);router['get']('/describe',auth[_0xc5f0('0xc')](),controller[_0xc5f0('0xd')]);router[_0xc5f0('0xb')](_0xc5f0('0xe'),auth['isAuthenticated'](),controller[_0xc5f0('0xf')]);router[_0xc5f0('0xb')](_0xc5f0('0x10'),auth[_0xc5f0('0xc')](),controller[_0xc5f0('0x11')]);router[_0xc5f0('0xb')](_0xc5f0('0x12'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xc5f0('0xb')](_0xc5f0('0x13'),controller[_0xc5f0('0x14')]);router['get'](_0xc5f0('0x15'),controller['getAvatar']);router[_0xc5f0('0xb')](_0xc5f0('0x16'),controller['getCustomerAvatar']);router[_0xc5f0('0xb')](_0xc5f0('0x17'),controller[_0xc5f0('0x18')]);router['get'](_0xc5f0('0x19'),auth[_0xc5f0('0xc')](),controller[_0xc5f0('0x1a')]);router[_0xc5f0('0xb')](_0xc5f0('0x1b'),controller['getSnippet']);router[_0xc5f0('0xb')]('/:id/applications',auth[_0xc5f0('0xc')](),controller[_0xc5f0('0x1c')]);router[_0xc5f0('0xb')](_0xc5f0('0x1d'),auth[_0xc5f0('0xc')](),controller[_0xc5f0('0x1e')]);router['get']('/:id/fields',controller['getFields']);router[_0xc5f0('0xb')]('/:id/offline_messages',auth[_0xc5f0('0xc')](),controller[_0xc5f0('0x1f')]);router[_0xc5f0('0xb')]('/:id/users',auth[_0xc5f0('0xc')](),controller[_0xc5f0('0x20')]);router['post']('/',auth[_0xc5f0('0xc')](),controller[_0xc5f0('0x21')]);router[_0xc5f0('0x22')](_0xc5f0('0x10'),auth[_0xc5f0('0xc')](),controller[_0xc5f0('0x23')]);router[_0xc5f0('0x22')](_0xc5f0('0x12'),auth[_0xc5f0('0xc')](),controller[_0xc5f0('0x24')]);var upload=multer({'storage':multer[_0xc5f0('0x25')]({'destination':function(_0x4830b2,_0x207edf,_0x10cc43){_0x10cc43(null,path[_0xc5f0('0x26')](config['root'],_0xc5f0('0x27')));},'filename':function(_0x615fc3,_0xa59cb3,_0x10811e){_0x10811e(null,util[_0xc5f0('0x28')](_0xc5f0('0x29'),Date[_0xc5f0('0x2a')](),_0xa59cb3['originalname']));}})});router['post']('/:id/logo',upload[_0xc5f0('0x2b')](_0xc5f0('0x2c')),controller[_0xc5f0('0x2d')]);var upload=multer({'storage':multer[_0xc5f0('0x25')]({'destination':function(_0x777467,_0x1cfb51,_0x2dd9ab){_0x2dd9ab(null,path[_0xc5f0('0x26')](config[_0xc5f0('0x2e')],'server/files/images/avatars/'));},'filename':function(_0x3fa9dd,_0x42d118,_0x53fafc){_0x53fafc(null,util['format'](_0xc5f0('0x29'),Date['now'](),_0x42d118[_0xc5f0('0x2f')]));}})});router[_0xc5f0('0x22')](_0xc5f0('0x15'),upload[_0xc5f0('0x2b')](_0xc5f0('0x2c')),controller[_0xc5f0('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x35249f,_0x1d9b99,_0x179337){_0x179337(null,path['join'](config[_0xc5f0('0x2e')],_0xc5f0('0x31')));},'filename':function(_0x5a3810,_0x57ae87,_0x98c50a){_0x98c50a(null,util[_0xc5f0('0x28')](_0xc5f0('0x29'),Date['now'](),_0x57ae87[_0xc5f0('0x2f')]));}})});router[_0xc5f0('0x22')](_0xc5f0('0x16'),upload[_0xc5f0('0x2b')](_0xc5f0('0x2c')),controller[_0xc5f0('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x56964e,_0x32e752,_0x4d811d){_0x4d811d(null,path[_0xc5f0('0x26')](config['root'],_0xc5f0('0x31')));},'filename':function(_0xad4282,_0x476319,_0x3a757b){_0x3a757b(null,util[_0xc5f0('0x28')](_0xc5f0('0x29'),Date[_0xc5f0('0x2a')](),_0x476319['originalname']));}})});router[_0xc5f0('0x22')](_0xc5f0('0x17'),upload[_0xc5f0('0x2b')]('file'),controller[_0xc5f0('0x33')]);router['post'](_0xc5f0('0x34'),controller[_0xc5f0('0x35')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x447556,_0x306b5b,_0x3c89d7){const _0x11aee3=path[_0xc5f0('0x26')](config[_0xc5f0('0x2e')],_0xc5f0('0x36'),'attachments','offline-chat');fs_extra[_0xc5f0('0x37')](_0x11aee3,function(){_0x3c89d7(null,_0x11aee3);});},'filename':function(_0x2b0cca,_0x15fe36,_0x570cc1){const _0x35b8f7=_0x15fe36[_0xc5f0('0x2f')][_0xc5f0('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x364da2=path['extname'](_0x35b8f7);const _0x495082=Date[_0xc5f0('0x2a')]()+'-'+_0x35b8f7[_0xc5f0('0x38')](_0x364da2,'')+_0x364da2;_0x570cc1(null,_0x495082);}})});router[_0xc5f0('0x22')](_0xc5f0('0x39'),offlineUploadMulter['any'](),controller[_0xc5f0('0x3a')]);router['post'](_0xc5f0('0x19'),auth['isAuthenticated'](),controller[_0xc5f0('0x3b')]);router[_0xc5f0('0x22')](_0xc5f0('0x3c'),auth[_0xc5f0('0xc')](),controller[_0xc5f0('0x3d')]);router[_0xc5f0('0x22')](_0xc5f0('0x1d'),auth[_0xc5f0('0xc')](),controller[_0xc5f0('0x3e')]);router['post'](_0xc5f0('0x3f'),auth['isAuthenticated'](),controller[_0xc5f0('0x40')]);router[_0xc5f0('0x41')](_0xc5f0('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc5f0('0xe'),auth[_0xc5f0('0xc')](),controller[_0xc5f0('0x42')]);router[_0xc5f0('0x43')]('/:id/dispositions',auth[_0xc5f0('0xc')](),controller[_0xc5f0('0x44')]);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xc5f0('0x45')]);router[_0xc5f0('0x43')](_0xc5f0('0x3f'),auth[_0xc5f0('0xc')](),controller[_0xc5f0('0x46')]);module[_0xc5f0('0x47')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index c4bf09b..a897161 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 _0x2c1b=['app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','../components/auth/service','../config/environment','env','production'];(function(_0x3e34bb,_0x6a2abb){var _0x4b8268=function(_0xe4092b){while(--_0xe4092b){_0x3e34bb['push'](_0x3e34bb['shift']());}};_0x4b8268(++_0x6a2abb);}(_0x2c1b,0x95));var _0xb2c1=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x2c1b[_0x2adbeb];return _0x5e18a6;};var beaverLogger=require(_0xb2c1('0x0'));var express=require('express');var auth=require(_0xb2c1('0x1'));var config=require(_0xb2c1('0x2'));var router=express['Router']();var isProduction=config[_0xb2c1('0x3')]===_0xb2c1('0x4')||![];function clientSideLogs(_0x595eef,_0x4d5be8,_0x7b7b3){var _0x334308=_0x595eef[_0xb2c1('0x5')][_0xb2c1('0x6')](_0xb2c1('0x7'));if(!_0x334308){throw new Error(_0xb2c1('0x8'));}return beaverLogger[_0xb2c1('0x9')]({'uri':_0xb2c1('0xa'),'logger':_0x334308,'enableCors':!isProduction})(_0x595eef,_0x4d5be8,_0x7b7b3);}router[_0xb2c1('0xb')](auth[_0xb2c1('0xc')](),clientSideLogs);module[_0xb2c1('0xd')]=router; \ No newline at end of file +var _0x8212=['/client-logs','isAuthenticated','exports','express','../config/environment','env','production','app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint'];(function(_0x56bf30,_0x284c8b){var _0xaea08b=function(_0xf9d135){while(--_0xf9d135){_0x56bf30['push'](_0x56bf30['shift']());}};_0xaea08b(++_0x284c8b);}(_0x8212,0xdf));var _0x2821=function(_0x3578e4,_0x35a5e4){_0x3578e4=_0x3578e4-0x0;var _0xbee4f2=_0x8212[_0x3578e4];return _0xbee4f2;};var beaverLogger=require('beaver-logger/server');var express=require(_0x2821('0x0'));var auth=require('../components/auth/service');var config=require(_0x2821('0x1'));var router=express['Router']();var isProduction=config[_0x2821('0x2')]===_0x2821('0x3')||![];function clientSideLogs(_0x28071b,_0x4e9365,_0x5e6bf4){var _0x1da0e0=_0x28071b[_0x2821('0x4')]['get'](_0x2821('0x5'));if(!_0x1da0e0){throw new Error(_0x2821('0x6'));}return beaverLogger[_0x2821('0x7')]({'uri':_0x2821('0x8'),'logger':_0x1da0e0,'enableCors':!isProduction})(_0x28071b,_0x4e9365,_0x5e6bf4);}router['use'](auth[_0x2821('0x9')](),clientSideLogs);module[_0x2821('0xa')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 0436db3..61200ed 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 _0x3e10=['Google','MicrosoftAzure','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','ENUM','AmazonAWS'];(function(_0x4d122f,_0x5302bd){var _0x1ecec3=function(_0x13a1d7){while(--_0x13a1d7){_0x4d122f['push'](_0x4d122f['shift']());}};_0x1ecec3(++_0x5302bd);}(_0x3e10,0x1b7));var _0x03e1=function(_0x5cedd2,_0x152f4a){_0x5cedd2=_0x5cedd2-0x0;var _0x6ccb5d=_0x3e10[_0x5cedd2];return _0x6ccb5d;};'use strict';var Sequelize=require('sequelize');module[_0x03e1('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x03e1('0x1')](_0x03e1('0x2'),_0x03e1('0x3'),_0x03e1('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('Outlook365',_0x03e1('0x5'))},'data1':{'type':Sequelize[_0x03e1('0x6')],'comment':_0x03e1('0x7')},'data2':{'type':Sequelize[_0x03e1('0x6')],'comment':_0x03e1('0x8')},'data3':{'type':Sequelize['STRING'],'comment':_0x03e1('0x9')},'data4':{'type':Sequelize[_0x03e1('0x6')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x03e1('0xa')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x03e1('0xa')],'comment':_0x03e1('0xb')},'data7':{'type':Sequelize[_0x03e1('0xa')],'comment':_0x03e1('0xc')}}; \ No newline at end of file +var _0x1980=['Google','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM'];(function(_0x265f04,_0x164309){var _0x262570=function(_0x144e77){while(--_0x144e77){_0x265f04['push'](_0x265f04['shift']());}};_0x262570(++_0x164309);}(_0x1980,0x146));var _0x0198=function(_0x3b40d1,_0x5e37a2){_0x3b40d1=_0x3b40d1-0x0;var _0x1c5019=_0x1980[_0x3b40d1];return _0x1c5019;};'use strict';var Sequelize=require(_0x0198('0x0'));module[_0x0198('0x1')]={'name':{'type':Sequelize[_0x0198('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x0198('0x3')]('AmazonAWS',_0x0198('0x4'),_0x0198('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('Outlook365',_0x0198('0x6'))},'data1':{'type':Sequelize[_0x0198('0x2')],'comment':_0x0198('0x7')},'data2':{'type':Sequelize[_0x0198('0x2')],'comment':_0x0198('0x8')},'data3':{'type':Sequelize[_0x0198('0x2')],'comment':_0x0198('0x9')},'data4':{'type':Sequelize[_0x0198('0x2')],'comment':_0x0198('0xa')},'data5':{'type':Sequelize['TEXT'],'comment':_0x0198('0xb')},'data6':{'type':Sequelize['TEXT'],'comment':_0x0198('0xc')},'data7':{'type':Sequelize[_0x0198('0xd')],'comment':_0x0198('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index b3773eb..788c1ac 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 _0x87a2=['index','map','CloudProvider','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','name','filter','options','includeAll','findAll','rows','service','MicrosoftAzure','data3','catch','show','params','include','decryptString','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','find','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','error','get','state','Invalid\x20state\x20parameter','parse','base64','toString','ascii','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','data5','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','stack','padEnd','slice'];(function(_0x20e295,_0x308599){var _0x33ffbe=function(_0x2eeb46){while(--_0x2eeb46){_0x20e295['push'](_0x20e295['shift']());}};_0x33ffbe(++_0x308599);}(_0x87a2,0x110));var _0x287a=function(_0x2b6600,_0x24c497){_0x2b6600=_0x2b6600-0x0;var _0x912ee2=_0x87a2[_0x2b6600];return _0x912ee2;};'use strict';var _=require(_0x287a('0x0'));var Redis=require(_0x287a('0x1'));var qs=require(_0x287a('0x2'));var encryptor=require(_0x287a('0x3'));var config=require('../../config/environment');var logger=require(_0x287a('0x4'))(_0x287a('0x5'));var db=require(_0x287a('0x6'))['db'];var oauth=require(_0x287a('0x7'));config[_0x287a('0x8')]=_['defaults'](config[_0x287a('0x8')],{'host':_0x287a('0x9'),'port':0x18eb});var socket=require(_0x287a('0xa'))(new Redis(config[_0x287a('0x8')]));var redis=new Redis(config[_0x287a('0x8')]);function respondWithStatusCode(_0x48cec3,_0x51fa76){_0x51fa76=_0x51fa76||0xcc;return function(_0x2dbb9){if(_0x2dbb9){return _0x48cec3[_0x287a('0xb')](_0x51fa76);}return _0x48cec3[_0x287a('0xc')](_0x51fa76)[_0x287a('0xd')]();};}function respondWithResult(_0x4bb1ae,_0x43d861){_0x43d861=_0x43d861||0xc8;return function(_0xe41806){if(_0xe41806){return _0x4bb1ae['status'](_0x43d861)[_0x287a('0xe')](_0xe41806);}};}function respondWithFilteredResult(_0x26db0e,_0x1d2ec5){return function(_0x4fcca0){if(_0x4fcca0){var _0x365e79=typeof _0x1d2ec5[_0x287a('0xf')]===_0x287a('0x10')&&typeof _0x1d2ec5[_0x287a('0x11')]===_0x287a('0x10');var _0x1bd54e=_0x4fcca0[_0x287a('0x12')];var _0x1ae2c5=_0x365e79?0x0:_0x1d2ec5[_0x287a('0xf')];var _0x55488b=_0x365e79?_0x4fcca0['count']:_0x1d2ec5[_0x287a('0xf')]+_0x1d2ec5[_0x287a('0x11')];var _0x24f0dd;if(_0x55488b>=_0x1bd54e){_0x55488b=_0x1bd54e;_0x24f0dd=0xc8;}else{_0x24f0dd=0xce;}_0x26db0e[_0x287a('0xc')](_0x24f0dd);return _0x26db0e[_0x287a('0x13')](_0x287a('0x14'),_0x1ae2c5+'-'+_0x55488b+'/'+_0x1bd54e)[_0x287a('0xe')](_0x4fcca0);}return null;};}function saveUpdates(_0xcd3842){return function(_0x149d89){if(_0x149d89){return _0x149d89['update'](_0xcd3842)[_0x287a('0x15')](function(_0xd2ace1){return _0xd2ace1;});}return null;};}function removeEntity(_0x4d923d){return function(_0x293ac5){if(_0x293ac5){return _0x293ac5['destroy']()[_0x287a('0x15')](function(){_0x4d923d['status'](0xcc)[_0x287a('0xd')]();});}};}function handleEntityNotFound(_0x3c2952){return function(_0x4a53fc){if(!_0x4a53fc){_0x3c2952[_0x287a('0xb')](0x194);}return _0x4a53fc;};}function handleError(_0x412476,_0x3350ec){_0x3350ec=_0x3350ec||0x1f4;return function(_0x10a4b6){logger['error'](_0x10a4b6[_0x287a('0x16')]);if(_0x10a4b6['name']){delete _0x10a4b6['name'];}_0x412476[_0x287a('0xc')](_0x3350ec)['send'](_0x10a4b6);};}function maskClientSecret(_0x445b9d){return _[_0x287a('0x17')](_0x445b9d[_0x287a('0x18')](0x0,0x3),0x14,'*');}exports[_0x287a('0x19')]=function(_0x2ac2fe,_0x1611f9){var _0x27562e={},_0x5957a4={},_0x52e8cf={'count':0x0,'rows':[]};var _0x1a4f05=_[_0x287a('0x1a')](db[_0x287a('0x1b')][_0x287a('0x1c')],function(_0x5e1a1e){return{'name':_0x5e1a1e[_0x287a('0x1d')],'type':_0x5e1a1e[_0x287a('0x1e')]['key']};});_0x5957a4[_0x287a('0x1f')]=_[_0x287a('0x1a')](_0x1a4f05,'name');_0x5957a4[_0x287a('0x20')]=_[_0x287a('0x21')](_0x2ac2fe[_0x287a('0x20')]);_0x5957a4[_0x287a('0x22')]=_['intersection'](_0x5957a4['model'],_0x5957a4[_0x287a('0x20')]);_0x27562e['attributes']=_[_0x287a('0x23')](_0x5957a4['model'],qs['fields'](_0x2ac2fe['query'][_0x287a('0x24')]));_0x27562e[_0x287a('0x25')]=_0x27562e[_0x287a('0x25')][_0x287a('0x26')]?_0x27562e[_0x287a('0x25')]:_0x5957a4[_0x287a('0x1f')];if(!_0x2ac2fe['query'][_0x287a('0x27')]('nolimit')){_0x27562e['limit']=qs[_0x287a('0x11')](_0x2ac2fe[_0x287a('0x20')]['limit']);_0x27562e[_0x287a('0xf')]=qs[_0x287a('0xf')](_0x2ac2fe[_0x287a('0x20')][_0x287a('0xf')]);}_0x27562e[_0x287a('0x28')]=qs['sort'](_0x2ac2fe[_0x287a('0x20')][_0x287a('0x29')]);_0x27562e[_0x287a('0x2a')]=qs[_0x287a('0x22')](_[_0x287a('0x2b')](_0x2ac2fe[_0x287a('0x20')],_0x5957a4[_0x287a('0x22')]),_0x1a4f05);if(_0x2ac2fe[_0x287a('0x20')]['filter']){_0x27562e[_0x287a('0x2a')]=_[_0x287a('0x2c')](_0x27562e[_0x287a('0x2a')],{'$or':_[_0x287a('0x1a')](_0x1a4f05,function(_0xedac8f){if(_0xedac8f['type']!==_0x287a('0x2d')){var _0x521064={};_0x521064[_0xedac8f[_0x287a('0x2e')]]={'$like':'%'+_0x2ac2fe[_0x287a('0x20')][_0x287a('0x2f')]+'%'};return _0x521064;}})});}_0x27562e=_[_0x287a('0x2c')]({},_0x27562e,_0x2ac2fe[_0x287a('0x30')]);var _0x4a321c={'where':_0x27562e[_0x287a('0x2a')]};return db[_0x287a('0x1b')]['count'](_0x4a321c)[_0x287a('0x15')](function(_0x2ec924){_0x52e8cf[_0x287a('0x12')]=_0x2ec924;if(_0x2ac2fe[_0x287a('0x20')][_0x287a('0x31')]){_0x27562e['include']=[{'all':!![]}];}return db[_0x287a('0x1b')][_0x287a('0x32')](_0x27562e);})[_0x287a('0x15')](function(_0x249e13){_0x52e8cf[_0x287a('0x33')]=_[_0x287a('0x1a')](_0x249e13,function(_0x261204){if(_0x261204[_0x287a('0x34')]===_0x287a('0x35')){var _0x439243=encryptor['decryptString'](_0x261204['data3']);_0x261204[_0x287a('0x36')]=maskClientSecret(_0x439243);}return _0x261204;});return _0x52e8cf;})[_0x287a('0x15')](respondWithFilteredResult(_0x1611f9,_0x27562e))[_0x287a('0x37')](handleError(_0x1611f9,null));};exports[_0x287a('0x38')]=function(_0x1d8d68,_0x3c3197){var _0x292553={'raw':!![],'where':{'id':_0x1d8d68[_0x287a('0x39')]['id']}},_0x421623={};_0x421623['model']=_[_0x287a('0x21')](db[_0x287a('0x1b')]['rawAttributes']);_0x421623[_0x287a('0x20')]=_[_0x287a('0x21')](_0x1d8d68[_0x287a('0x20')]);_0x421623['filters']=_[_0x287a('0x23')](_0x421623[_0x287a('0x1f')],_0x421623[_0x287a('0x20')]);_0x292553[_0x287a('0x25')]=_[_0x287a('0x23')](_0x421623[_0x287a('0x1f')],qs[_0x287a('0x24')](_0x1d8d68[_0x287a('0x20')][_0x287a('0x24')]));_0x292553[_0x287a('0x25')]=_0x292553[_0x287a('0x25')][_0x287a('0x26')]?_0x292553['attributes']:_0x421623[_0x287a('0x1f')];if(_0x1d8d68[_0x287a('0x20')][_0x287a('0x31')]){_0x292553[_0x287a('0x3a')]=[{'all':!![]}];}_0x292553=_[_0x287a('0x2c')]({},_0x292553,_0x1d8d68[_0x287a('0x30')]);return db[_0x287a('0x1b')]['find'](_0x292553)[_0x287a('0x15')](handleEntityNotFound(_0x3c3197,null))[_0x287a('0x15')](function(_0x52426e){if(_0x52426e[_0x287a('0x34')]===_0x287a('0x35')){var _0x429d53=encryptor[_0x287a('0x3b')](_0x52426e[_0x287a('0x36')]);_0x52426e[_0x287a('0x36')]=maskClientSecret(_0x429d53);}return _0x52426e;})[_0x287a('0x15')](respondWithResult(_0x3c3197,null))['catch'](handleError(_0x3c3197,null));};exports[_0x287a('0x3c')]=function(_0x514df3,_0x2dda82){if(!_0x514df3[_0x287a('0x3d')]['name'])throw new Error(_0x287a('0x3e'));if(!_0x514df3[_0x287a('0x3d')][_0x287a('0x34')])throw new Error(_0x287a('0x3f'));var _0x53bdeb=db[_0x287a('0x1b')][_0x287a('0x1c')]['service'][_0x287a('0x40')];if(!_0x53bdeb['includes'](_0x514df3[_0x287a('0x3d')][_0x287a('0x34')]))throw new Error(_0x287a('0x41')+_0x53bdeb[_0x287a('0x42')](',\x20'));if(_0x514df3['body']['service']===_0x287a('0x35')&&_0x514df3[_0x287a('0x3d')][_0x287a('0x36')]){_0x514df3[_0x287a('0x3d')]['data3']=encryptor['encryptString'](_0x514df3[_0x287a('0x3d')]['data3']);}return db[_0x287a('0x1b')][_0x287a('0x3c')](_0x514df3[_0x287a('0x3d')],{})[_0x287a('0x15')](respondWithResult(_0x2dda82,0xc9))[_0x287a('0x37')](handleError(_0x2dda82,null));};exports['update']=function(_0x1a5dd1,_0x5590a2){if(_0x1a5dd1[_0x287a('0x3d')]['id']){delete _0x1a5dd1[_0x287a('0x3d')]['id'];}return db['CloudProvider'][_0x287a('0x43')]({'where':{'id':_0x1a5dd1[_0x287a('0x39')]['id']}})[_0x287a('0x15')](handleEntityNotFound(_0x5590a2,null))['then'](function(_0x38012c){if(_0x38012c['service']===_0x287a('0x35')&&_0x1a5dd1[_0x287a('0x3d')][_0x287a('0x36')]){_0x1a5dd1[_0x287a('0x3d')][_0x287a('0x36')]=encryptor[_0x287a('0x44')](_0x1a5dd1[_0x287a('0x3d')][_0x287a('0x36')]);}return _0x38012c;})[_0x287a('0x15')](saveUpdates(_0x1a5dd1[_0x287a('0x3d')],null))['then'](respondWithResult(_0x5590a2,null))['catch'](handleError(_0x5590a2,null));};exports[_0x287a('0x45')]=function(_0x335396,_0x117e79){return db['CloudProvider'][_0x287a('0x43')]({'where':{'id':_0x335396[_0x287a('0x39')]['id']}})[_0x287a('0x15')](handleEntityNotFound(_0x117e79,null))[_0x287a('0x15')](removeEntity(_0x117e79,null))['catch'](handleError(_0x117e79,null));};exports[_0x287a('0x46')]=function(_0x4dbf51,_0x40684c){return db['CloudProvider'][_0x287a('0x47')]({'where':{'id':_0x4dbf51['params']['id']},'raw':!![]})[_0x287a('0x15')](function(_0x3af4e9){if(!_0x3af4e9)return _0x40684c[_0x287a('0xb')](0x194);return{'url':oauth[_0x287a('0x48')](_0x3af4e9,_0x4dbf51['user']['id'])};})[_0x287a('0x15')](respondWithResult(_0x40684c,null))[_0x287a('0x37')](handleError(_0x40684c,null));};exports[_0x287a('0x49')]=function(_0x4af96c,_0x4e54fb){var _0x2f8a78=_0x4af96c[_0x287a('0x3d')];var _0x1cc546;var _0x167449;if(_0x2f8a78[_0x287a('0x4a')])throw _0x2f8a78;redis[_0x287a('0x4b')](_0x2f8a78[_0x287a('0x4c')])[_0x287a('0x15')](function(_0x1d0389){if(!_0x1d0389)throw new Error(_0x287a('0x4d'));_0x1cc546=JSON[_0x287a('0x4e')](_0x1d0389);var _0x161c36=Buffer['from'](_0x2f8a78[_0x287a('0x4c')],_0x287a('0x4f'))[_0x287a('0x50')](_0x287a('0x51'));_0x167449=JSON[_0x287a('0x4e')](_0x161c36);if(!oauth[_0x287a('0x52')](_0x2f8a78['id_token'],_0x1cc546[_0x287a('0x53')]))throw new Error(_0x287a('0x54'));redis[_0x287a('0x55')](_0x2f8a78[_0x287a('0x4c')]);return oauth[_0x287a('0x56')](_0x2f8a78[_0x287a('0x57')],_0x1cc546);})[_0x287a('0x15')](function(_0xa4a4f0){_0x1cc546['data5']=_0xa4a4f0[_0x287a('0x58')];_0x1cc546[_0x287a('0x59')]=_0xa4a4f0[_0x287a('0x5a')];return db[_0x287a('0x1b')]['update']({'data5':_0x1cc546[_0x287a('0x5b')],'data6':_0x1cc546[_0x287a('0x59')]},{'where':{'id':_0x1cc546['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x1cc546);socket[_0x287a('0x5c')](_0x287a('0x5d'),{'id':_0x167449['id']});return;})[_0x287a('0x15')](respondWithStatusCode(_0x4e54fb,null))['catch'](function(_0x5aac8b){if(_0x167449){socket[_0x287a('0x5c')]('microsoftAuthorization:error',{'id':_0x167449['id']});}if(!_0x1cc546){logger[_0x287a('0x4a')](_0x287a('0x5e'),_0x5aac8b);return _0x4e54fb[_0x287a('0xc')](0x1f4)[_0x287a('0x5f')](_0x5aac8b[_0x287a('0x60')]);}logger[_0x287a('0x4a')](_0x287a('0x61'),_0x1cc546['id'],JSON[_0x287a('0x62')](_0x5aac8b));});}; \ No newline at end of file +var _0x59f9=['data3','catch','show','params','include','find','body','Service\x20parameter\x20not\x20specified','rawAttributes','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','sendStatus','generateMicrosoftAuthorizationUrl','user','parse','from','state','base64','ascii','isValidIdToken','id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','refresh_token','data6','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','redis','defaults','socket.io-emitter','status','end','offset','undefined','count','limit','set','update','destroy','error','stack','name','padEnd','index','map','CloudProvider','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','then','rows','service','MicrosoftAzure','decryptString'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x59f9,0xd9));var _0x959f=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x59f9[_0x220f3f];return _0x1f170e;};'use strict';var _=require(_0x959f('0x0'));var Redis=require(_0x959f('0x1'));var qs=require(_0x959f('0x2'));var encryptor=require(_0x959f('0x3'));var config=require(_0x959f('0x4'));var logger=require(_0x959f('0x5'))('api');var db=require('../../mysqldb')['db'];var oauth=require('./cloudProvider.oauth');config[_0x959f('0x6')]=_[_0x959f('0x7')](config[_0x959f('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x959f('0x8'))(new Redis(config['redis']));var redis=new Redis(config[_0x959f('0x6')]);function respondWithStatusCode(_0x43ed4c,_0x3ef5df){_0x3ef5df=_0x3ef5df||0xcc;return function(_0x374a95){if(_0x374a95){return _0x43ed4c['sendStatus'](_0x3ef5df);}return _0x43ed4c[_0x959f('0x9')](_0x3ef5df)[_0x959f('0xa')]();};}function respondWithResult(_0x4c213f,_0x563e48){_0x563e48=_0x563e48||0xc8;return function(_0x1eff06){if(_0x1eff06){return _0x4c213f[_0x959f('0x9')](_0x563e48)['json'](_0x1eff06);}};}function respondWithFilteredResult(_0x11ef6c,_0xe7e7c9){return function(_0x1886ba){if(_0x1886ba){var _0x275794=typeof _0xe7e7c9[_0x959f('0xb')]===_0x959f('0xc')&&typeof _0xe7e7c9['limit']===_0x959f('0xc');var _0x5a6ee7=_0x1886ba[_0x959f('0xd')];var _0x57ebba=_0x275794?0x0:_0xe7e7c9[_0x959f('0xb')];var _0x2a8175=_0x275794?_0x1886ba[_0x959f('0xd')]:_0xe7e7c9['offset']+_0xe7e7c9[_0x959f('0xe')];var _0x385a54;if(_0x2a8175>=_0x5a6ee7){_0x2a8175=_0x5a6ee7;_0x385a54=0xc8;}else{_0x385a54=0xce;}_0x11ef6c['status'](_0x385a54);return _0x11ef6c[_0x959f('0xf')]('Content-Range',_0x57ebba+'-'+_0x2a8175+'/'+_0x5a6ee7)['json'](_0x1886ba);}return null;};}function saveUpdates(_0xc5fcd1){return function(_0x2d6be8){if(_0x2d6be8){return _0x2d6be8[_0x959f('0x10')](_0xc5fcd1)['then'](function(_0x114b80){return _0x114b80;});}return null;};}function removeEntity(_0x12e2b0){return function(_0x5a56dc){if(_0x5a56dc){return _0x5a56dc[_0x959f('0x11')]()['then'](function(){_0x12e2b0['status'](0xcc)[_0x959f('0xa')]();});}};}function handleEntityNotFound(_0x137d90){return function(_0x2e2a92){if(!_0x2e2a92){_0x137d90['sendStatus'](0x194);}return _0x2e2a92;};}function handleError(_0xc8d30c,_0x10f162){_0x10f162=_0x10f162||0x1f4;return function(_0x4463d5){logger[_0x959f('0x12')](_0x4463d5[_0x959f('0x13')]);if(_0x4463d5[_0x959f('0x14')]){delete _0x4463d5[_0x959f('0x14')];}_0xc8d30c[_0x959f('0x9')](_0x10f162)['send'](_0x4463d5);};}function maskClientSecret(_0x2d381b){return _[_0x959f('0x15')](_0x2d381b['slice'](0x0,0x3),0x14,'*');}exports[_0x959f('0x16')]=function(_0x19e8cb,_0x512352){var _0xdf30f={},_0x3f9f6b={},_0x3b302c={'count':0x0,'rows':[]};var _0x2204f1=_[_0x959f('0x17')](db[_0x959f('0x18')]['rawAttributes'],function(_0x8840e0){return{'name':_0x8840e0['fieldName'],'type':_0x8840e0['type']['key']};});_0x3f9f6b[_0x959f('0x19')]=_[_0x959f('0x17')](_0x2204f1,_0x959f('0x14'));_0x3f9f6b['query']=_[_0x959f('0x1a')](_0x19e8cb[_0x959f('0x1b')]);_0x3f9f6b[_0x959f('0x1c')]=_[_0x959f('0x1d')](_0x3f9f6b[_0x959f('0x19')],_0x3f9f6b[_0x959f('0x1b')]);_0xdf30f[_0x959f('0x1e')]=_['intersection'](_0x3f9f6b[_0x959f('0x19')],qs['fields'](_0x19e8cb['query'][_0x959f('0x1f')]));_0xdf30f[_0x959f('0x1e')]=_0xdf30f[_0x959f('0x1e')][_0x959f('0x20')]?_0xdf30f[_0x959f('0x1e')]:_0x3f9f6b[_0x959f('0x19')];if(!_0x19e8cb[_0x959f('0x1b')][_0x959f('0x21')](_0x959f('0x22'))){_0xdf30f[_0x959f('0xe')]=qs[_0x959f('0xe')](_0x19e8cb[_0x959f('0x1b')][_0x959f('0xe')]);_0xdf30f[_0x959f('0xb')]=qs['offset'](_0x19e8cb['query']['offset']);}_0xdf30f[_0x959f('0x23')]=qs['sort'](_0x19e8cb[_0x959f('0x1b')][_0x959f('0x24')]);_0xdf30f['where']=qs[_0x959f('0x1c')](_[_0x959f('0x25')](_0x19e8cb[_0x959f('0x1b')],_0x3f9f6b[_0x959f('0x1c')]),_0x2204f1);if(_0x19e8cb['query'][_0x959f('0x26')]){_0xdf30f[_0x959f('0x27')]=_[_0x959f('0x28')](_0xdf30f[_0x959f('0x27')],{'$or':_[_0x959f('0x17')](_0x2204f1,function(_0x1d9f8e){if(_0x1d9f8e[_0x959f('0x29')]!==_0x959f('0x2a')){var _0x6275bf={};_0x6275bf[_0x1d9f8e[_0x959f('0x14')]]={'$like':'%'+_0x19e8cb[_0x959f('0x1b')][_0x959f('0x26')]+'%'};return _0x6275bf;}})});}_0xdf30f=_[_0x959f('0x28')]({},_0xdf30f,_0x19e8cb[_0x959f('0x2b')]);var _0x5c4dd6={'where':_0xdf30f['where']};return db[_0x959f('0x18')]['count'](_0x5c4dd6)['then'](function(_0x139d95){_0x3b302c[_0x959f('0xd')]=_0x139d95;if(_0x19e8cb[_0x959f('0x1b')][_0x959f('0x2c')]){_0xdf30f['include']=[{'all':!![]}];}return db[_0x959f('0x18')]['findAll'](_0xdf30f);})[_0x959f('0x2d')](function(_0x51e9a8){_0x3b302c[_0x959f('0x2e')]=_[_0x959f('0x17')](_0x51e9a8,function(_0x2bc46e){if(_0x2bc46e[_0x959f('0x2f')]===_0x959f('0x30')){var _0x2ff336=encryptor[_0x959f('0x31')](_0x2bc46e[_0x959f('0x32')]);_0x2bc46e[_0x959f('0x32')]=maskClientSecret(_0x2ff336);}return _0x2bc46e;});return _0x3b302c;})[_0x959f('0x2d')](respondWithFilteredResult(_0x512352,_0xdf30f))[_0x959f('0x33')](handleError(_0x512352,null));};exports[_0x959f('0x34')]=function(_0x19affa,_0xf8317f){var _0xd711f7={'raw':!![],'where':{'id':_0x19affa[_0x959f('0x35')]['id']}},_0x381939={};_0x381939[_0x959f('0x19')]=_['keys'](db[_0x959f('0x18')]['rawAttributes']);_0x381939[_0x959f('0x1b')]=_[_0x959f('0x1a')](_0x19affa[_0x959f('0x1b')]);_0x381939[_0x959f('0x1c')]=_[_0x959f('0x1d')](_0x381939[_0x959f('0x19')],_0x381939[_0x959f('0x1b')]);_0xd711f7[_0x959f('0x1e')]=_[_0x959f('0x1d')](_0x381939[_0x959f('0x19')],qs[_0x959f('0x1f')](_0x19affa[_0x959f('0x1b')][_0x959f('0x1f')]));_0xd711f7[_0x959f('0x1e')]=_0xd711f7[_0x959f('0x1e')]['length']?_0xd711f7[_0x959f('0x1e')]:_0x381939[_0x959f('0x19')];if(_0x19affa[_0x959f('0x1b')][_0x959f('0x2c')]){_0xd711f7[_0x959f('0x36')]=[{'all':!![]}];}_0xd711f7=_[_0x959f('0x28')]({},_0xd711f7,_0x19affa[_0x959f('0x2b')]);return db['CloudProvider'][_0x959f('0x37')](_0xd711f7)[_0x959f('0x2d')](handleEntityNotFound(_0xf8317f,null))[_0x959f('0x2d')](function(_0x3c04c7){if(_0x3c04c7[_0x959f('0x2f')]===_0x959f('0x30')){var _0x2731c6=encryptor[_0x959f('0x31')](_0x3c04c7[_0x959f('0x32')]);_0x3c04c7[_0x959f('0x32')]=maskClientSecret(_0x2731c6);}return _0x3c04c7;})[_0x959f('0x2d')](respondWithResult(_0xf8317f,null))[_0x959f('0x33')](handleError(_0xf8317f,null));};exports['create']=function(_0x438c3b,_0x3b85cc){if(!_0x438c3b[_0x959f('0x38')][_0x959f('0x14')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x438c3b[_0x959f('0x38')][_0x959f('0x2f')])throw new Error(_0x959f('0x39'));var _0x4dfaaa=db['CloudProvider'][_0x959f('0x3a')][_0x959f('0x2f')][_0x959f('0x3b')];if(!_0x4dfaaa[_0x959f('0x3c')](_0x438c3b[_0x959f('0x38')][_0x959f('0x2f')]))throw new Error(_0x959f('0x3d')+_0x4dfaaa[_0x959f('0x3e')](',\x20'));if(_0x438c3b[_0x959f('0x38')][_0x959f('0x2f')]===_0x959f('0x30')&&_0x438c3b[_0x959f('0x38')][_0x959f('0x32')]){_0x438c3b['body'][_0x959f('0x32')]=encryptor[_0x959f('0x3f')](_0x438c3b[_0x959f('0x38')][_0x959f('0x32')]);}return db['CloudProvider']['create'](_0x438c3b[_0x959f('0x38')],{})[_0x959f('0x2d')](respondWithResult(_0x3b85cc,0xc9))['catch'](handleError(_0x3b85cc,null));};exports['update']=function(_0xd1f14a,_0x411e8){if(_0xd1f14a[_0x959f('0x38')]['id']){delete _0xd1f14a[_0x959f('0x38')]['id'];}return db[_0x959f('0x18')][_0x959f('0x37')]({'where':{'id':_0xd1f14a[_0x959f('0x35')]['id']}})['then'](handleEntityNotFound(_0x411e8,null))[_0x959f('0x2d')](function(_0x54373d){if(_0x54373d[_0x959f('0x2f')]===_0x959f('0x30')&&_0xd1f14a[_0x959f('0x38')]['data3']){_0xd1f14a['body'][_0x959f('0x32')]=encryptor[_0x959f('0x3f')](_0xd1f14a[_0x959f('0x38')][_0x959f('0x32')]);}return _0x54373d;})[_0x959f('0x2d')](saveUpdates(_0xd1f14a[_0x959f('0x38')],null))[_0x959f('0x2d')](respondWithResult(_0x411e8,null))[_0x959f('0x33')](handleError(_0x411e8,null));};exports['destroy']=function(_0x4be77f,_0x10e163){return db[_0x959f('0x18')][_0x959f('0x37')]({'where':{'id':_0x4be77f['params']['id']}})['then'](handleEntityNotFound(_0x10e163,null))['then'](removeEntity(_0x10e163,null))[_0x959f('0x33')](handleError(_0x10e163,null));};exports[_0x959f('0x40')]=function(_0x26b72a,_0x37420e){return db[_0x959f('0x18')]['findOne']({'where':{'id':_0x26b72a[_0x959f('0x35')]['id']},'raw':!![]})[_0x959f('0x2d')](function(_0x36dd7a){if(!_0x36dd7a)return _0x37420e[_0x959f('0x41')](0x194);return{'url':oauth[_0x959f('0x42')](_0x36dd7a,_0x26b72a[_0x959f('0x43')]['id'])};})['then'](respondWithResult(_0x37420e,null))['catch'](handleError(_0x37420e,null));};exports['oauth2MicrosoftCallback']=function(_0x283ebc,_0x122d88){var _0x26c8ed=_0x283ebc[_0x959f('0x38')];var _0x4d8e33;var _0x236d64;if(_0x26c8ed[_0x959f('0x12')])throw _0x26c8ed;redis['get'](_0x26c8ed['state'])[_0x959f('0x2d')](function(_0xb1c872){if(!_0xb1c872)throw new Error('Invalid\x20state\x20parameter');_0x4d8e33=JSON[_0x959f('0x44')](_0xb1c872);var _0x25ebbd=Buffer[_0x959f('0x45')](_0x26c8ed[_0x959f('0x46')],_0x959f('0x47'))['toString'](_0x959f('0x48'));_0x236d64=JSON[_0x959f('0x44')](_0x25ebbd);if(!oauth[_0x959f('0x49')](_0x26c8ed[_0x959f('0x4a')],_0x4d8e33['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x959f('0x4b')](_0x26c8ed[_0x959f('0x46')]);return oauth[_0x959f('0x4c')](_0x26c8ed[_0x959f('0x4d')],_0x4d8e33);})['then'](function(_0x3b9237){_0x4d8e33[_0x959f('0x4e')]=_0x3b9237[_0x959f('0x4f')];_0x4d8e33['data6']=_0x3b9237[_0x959f('0x50')];return db['CloudProvider'][_0x959f('0x10')]({'data5':_0x4d8e33['data5'],'data6':_0x4d8e33[_0x959f('0x51')]},{'where':{'id':_0x4d8e33['id']}});})[_0x959f('0x2d')](function(){oauth['startRefreshInterval'](_0x4d8e33);socket[_0x959f('0x52')](_0x959f('0x53'),{'id':_0x236d64['id']});return;})[_0x959f('0x2d')](respondWithStatusCode(_0x122d88,null))[_0x959f('0x33')](function(_0x164bb3){if(_0x236d64){socket[_0x959f('0x52')](_0x959f('0x54'),{'id':_0x236d64['id']});}if(!_0x4d8e33){logger[_0x959f('0x12')](_0x959f('0x55'),_0x164bb3);return _0x122d88[_0x959f('0x9')](0x1f4)['send'](_0x164bb3[_0x959f('0x56')]);}logger[_0x959f('0x12')](_0x959f('0x57'),_0x4d8e33['id'],JSON[_0x959f('0x58')](_0x164bb3));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 9ceec58..7e2e72e 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 _0x94e8=['CloudProvider','cloud_providers','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x3ba13d,_0x4a0ae3){var _0x5bc83b=function(_0x439703){while(--_0x439703){_0x3ba13d['push'](_0x3ba13d['shift']());}};_0x5bc83b(++_0x4a0ae3);}(_0x94e8,0x9c));var _0x894e=function(_0x308a1d,_0x3d379d){_0x308a1d=_0x308a1d-0x0;var _0x5eb875=_0x94e8[_0x308a1d];return _0x5eb875;};'use strict';var _=require(_0x894e('0x0'));var util=require('util');var logger=require(_0x894e('0x1'))(_0x894e('0x2'));var moment=require('moment');var BPromise=require(_0x894e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x894e('0x4'));var rimraf=require(_0x894e('0x5'));var config=require(_0x894e('0x6'));var attributes=require('./cloudProvider.attributes');module[_0x894e('0x7')]=function(_0x118c35,_0x17176d){return _0x118c35[_0x894e('0x8')](_0x894e('0x9'),attributes,{'tableName':_0x894e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e65=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api'];(function(_0xdeac17,_0x19ad66){var _0x33aabd=function(_0x558a9e){while(--_0x558a9e){_0xdeac17['push'](_0xdeac17['shift']());}};_0x33aabd(++_0x19ad66);}(_0x7e65,0x10a));var _0x57e6=function(_0xddaaaa,_0x4fe73d){_0xddaaaa=_0xddaaaa-0x0;var _0x3c4cc5=_0x7e65[_0xddaaaa];return _0x3c4cc5;};'use strict';var _=require(_0x57e6('0x0'));var util=require(_0x57e6('0x1'));var logger=require(_0x57e6('0x2'))(_0x57e6('0x3'));var moment=require(_0x57e6('0x4'));var BPromise=require(_0x57e6('0x5'));var rp=require(_0x57e6('0x6'));var fs=require('fs');var path=require(_0x57e6('0x7'));var rimraf=require(_0x57e6('0x8'));var config=require(_0x57e6('0x9'));var attributes=require(_0x57e6('0xa'));module[_0x57e6('0xb')]=function(_0x47db6a,_0x5ea0f9){return _0x47db6a[_0x57e6('0xc')](_0x57e6('0xd'),attributes,{'tableName':_0x57e6('0xe'),'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 77da751..c19d75f 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 _0x13e2=['audience','isAfter','exp','resolve','data3','CloudProvider','findOne','then','refresh_token','data6','decryptString','POST','{TENANT_ID}','data5','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','util','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','Dynamics365','push','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','data7','replace','data2','code','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','login','map','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','aud'];(function(_0xc7bd0f,_0x357ced){var _0x565704=function(_0x3e6c44){while(--_0x3e6c44){_0xc7bd0f['push'](_0xc7bd0f['shift']());}};_0x565704(++_0x357ced);}(_0x13e2,0x68));var _0x213e=function(_0x5ef739,_0x402957){_0x5ef739=_0x5ef739-0x0;var _0x2c6865=_0x13e2[_0x5ef739];return _0x2c6865;};'use strict';var _=require(_0x213e('0x0'));var crypto=require(_0x213e('0x1'));var jwt=require('jsonwebtoken');var moment=require('moment');var Redis=require('ioredis');var rp=require('request-promise');var util=require(_0x213e('0x2'));var encryptor=require(_0x213e('0x3'));var config=require('../../config/environment');var logger=require(_0x213e('0x4'))(_0x213e('0x5'));var schedule=require(_0x213e('0x6'));var db=require(_0x213e('0x7'))['db'];config[_0x213e('0x8')]=_[_0x213e('0x9')](config[_0x213e('0x8')],{'host':_0x213e('0xa'),'port':0x18eb});var redis=new Redis(config[_0x213e('0x8')]);var MICROSOFT_AUTH_URL=_0x213e('0xb');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x213e('0xc'),'email',_0x213e('0xd'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x213e('0xe'),_0x213e('0xf')],'Dynamics365':['openid',_0x213e('0xd')]};var MICROSOFT_AUTH_ENDPOINT=_0x213e('0x10');var MICROSOFT_TOKEN_ENDPOINT=_0x213e('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x53815e){var _0x4c5219=_['map'](AZURE_AUTH_SCOPES[_0x53815e[_0x213e('0x12')]]);if(_0x53815e['type']===_0x213e('0x13'))_0x4c5219[_0x213e('0x14')](_0x53815e['data7']+_0x213e('0x15'));return _0x4c5219[_0x213e('0x16')]('\x20');}function getAccessTokenScope(_0x35007e){if(_0x35007e[_0x213e('0x12')]===_0x213e('0x17'))return _0x213e('0x18');if(_0x35007e[_0x213e('0x12')]===_0x213e('0x13'))return _0x35007e[_0x213e('0x19')]+_0x213e('0x15');}function generateMicrosoftAuthorizationUrl(_0x50c68d,_0x28aefa){var _0x35c64e=MICROSOFT_AUTH_URL[_0x213e('0x1a')]('{TENANT_ID}',_0x50c68d[_0x213e('0x1b')]);var _0x15c5ac=[_0x213e('0x1c'),_0x213e('0x1d')];var _0x3c5433=Buffer[_0x213e('0x1e')](JSON[_0x213e('0x1f')]({'id':_0x28aefa}))[_0x213e('0x20')](_0x213e('0x21'));var _0x47eeb2=crypto[_0x213e('0x22')](0x10)[_0x213e('0x20')](_0x213e('0x23'));var _0x5c851d=getAuthorizationScopes(_0x50c68d);var _0x2ae2a9=[{'key':_0x213e('0x24'),'value':_0x50c68d[_0x213e('0x25')]},{'key':_0x213e('0x26'),'value':encodeURIComponent(_0x15c5ac['join']('\x20'))},{'key':_0x213e('0x27'),'value':_0x50c68d[_0x213e('0x28')]},{'key':_0x213e('0x29'),'value':_0x213e('0x2a')},{'key':_0x213e('0x2b'),'value':encodeURIComponent(_0x5c851d)},{'key':_0x213e('0x2c'),'value':_0x3c5433},{'key':_0x213e('0x2d'),'value':_0x47eeb2},{'key':'prompt','value':_0x213e('0x2e')}];var _0x52a612=_0x35c64e+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x213e('0x2f')](_0x2ae2a9,function(_0x3e82e0){return _0x3e82e0['key']+'='+_0x3e82e0['value'];})[_0x213e('0x16')]('&');_0x50c68d[_0x213e('0x30')]={'issuer':_0x35c64e['replace'](_0x213e('0x31'),''),'audience':_0x50c68d[_0x213e('0x25')],'state':_0x3c5433,'nonce':_0x47eeb2};redis[_0x213e('0x32')](_0x3c5433,JSON[_0x213e('0x1f')](_0x50c68d));return _0x52a612;}function isValidIdToken(_0x1b30f3,_0x4f6e40){try{var _0x3348cd=jwt[_0x213e('0x33')](_0x1b30f3,{'complete':!![]});var _0x53cc43=_0x3348cd[_0x213e('0x34')];if(_0x53cc43[_0x213e('0x35')]!==_0x4f6e40[_0x213e('0x36')])return![];if(_0x53cc43[_0x213e('0x37')]!==_0x4f6e40[_0x213e('0x38')])return![];if(_0x53cc43[_0x213e('0x2d')]!==_0x4f6e40[_0x213e('0x2d')])return![];if(moment()[_0x213e('0x39')](moment['unix'](_0x53cc43[_0x213e('0x3a')])))return![];return!![];}catch(_0xc5b48a){throw _0xc5b48a;}}function refreshOauth2MicrosoftAccessToken(_0x362bcc){return Promise[_0x213e('0x3b')]()['then'](function(){if(_0x362bcc[_0x213e('0x3c')])return _0x362bcc;return db[_0x213e('0x3d')][_0x213e('0x3e')]({'where':{'id':_0x362bcc['id']},'raw':!![]});})[_0x213e('0x3f')](function(_0x36bdc0){var _0x28c3e7={'grant_type':_0x213e('0x40'),'refresh_token':_0x36bdc0[_0x213e('0x41')],'scope':getAccessTokenScope(_0x36bdc0),'redirect_uri':_0x36bdc0[_0x213e('0x28')],'client_id':_0x36bdc0[_0x213e('0x25')],'client_secret':encryptor[_0x213e('0x42')](_0x36bdc0['data3'])};var _0x3b675f={'method':_0x213e('0x43'),'uri':MICROSOFT_AUTH_URL[_0x213e('0x1a')](_0x213e('0x44'),_0x36bdc0['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x28c3e7,'json':!![]};return rp(_0x3b675f);})[_0x213e('0x3f')](function(_0x5a6691){_0x362bcc[_0x213e('0x45')]=_0x5a6691['access_token'];_0x362bcc[_0x213e('0x41')]=_0x5a6691['refresh_token'];return db['CloudProvider'][_0x213e('0x46')]({'data5':_0x362bcc[_0x213e('0x45')],'data6':_0x362bcc[_0x213e('0x41')]},{'where':{'id':_0x362bcc['id']}});})[_0x213e('0x3f')](function(){return _0x362bcc;})[_0x213e('0x47')](function(_0x29f808){logger[_0x213e('0x48')](_0x213e('0x49'),_0x362bcc['id'],_0x29f808);});}function getOauth2MicrosoftAccessToken(_0x263607,_0x5b79da){var _0x65ed32={'grant_type':'authorization_code','code':_0x263607,'scope':getAccessTokenScope(_0x5b79da),'redirect_uri':_0x5b79da['data4'],'client_id':_0x5b79da[_0x213e('0x25')],'client_secret':encryptor[_0x213e('0x42')](_0x5b79da[_0x213e('0x3c')])};var _0x3a1cf7={'method':_0x213e('0x43'),'uri':MICROSOFT_AUTH_URL[_0x213e('0x1a')](_0x213e('0x44'),_0x5b79da['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x65ed32,'json':!![]};return rp(_0x3a1cf7);}function startRefreshInterval(_0x4a931f){var _0x2da907=schedule[_0x213e('0x4a')];if(_0x2da907[_0x4a931f['id']])clearInterval(_0x2da907[_0x4a931f['id']]);_0x2da907[_0x4a931f['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x213e('0x4b')](this,{'id':_0x4a931f['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x213e('0x4a')]=_0x2da907;}function startAllRefreshIntervals(){return db[_0x213e('0x3d')][_0x213e('0x4c')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x213e('0x3f')](function(_0x2f7ad7){var _0x10d596=_0x2f7ad7[_0x213e('0x2f')](function(_0x4b32dd){return refreshOauth2MicrosoftAccessToken(_0x4b32dd)[_0x213e('0x3f')](function(_0x8db1){startRefreshInterval(_0x8db1);});});return Promise[_0x213e('0x4d')](_0x10d596);})[_0x213e('0x47')](function(_0x474eeb){var _0x11d914=_0x474eeb?util[_0x213e('0x4e')](_0x474eeb,{'showHidden':![],'depth':null}):'';logger['error'](_0x213e('0x4f'),_0x11d914);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xa90c=['data3','CloudProvider','findOne','refresh_token','data4','data1','POST','data5','access_token','data6','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','openid','/authorize','map','type','Dynamics365','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','id_token','from','stringify','toString','randomBytes','hex','client_id','response_type','redirect_uri','form_post','scope','nonce','prompt','login','key','value','oauth2Claims','oauth2/','set','decode','payload','issuer','aud','isAfter','unix','exp','then'];(function(_0x2f6722,_0x121e8c){var _0xb6ebd5=function(_0x59fb51){while(--_0x59fb51){_0x2f6722['push'](_0x2f6722['shift']());}};_0xb6ebd5(++_0x121e8c);}(_0xa90c,0xb5));var _0xca90=function(_0x578f88,_0x5492ae){_0x578f88=_0x578f88-0x0;var _0x29df13=_0xa90c[_0x578f88];return _0x29df13;};'use strict';var _=require(_0xca90('0x0'));var crypto=require(_0xca90('0x1'));var jwt=require(_0xca90('0x2'));var moment=require(_0xca90('0x3'));var Redis=require('ioredis');var rp=require(_0xca90('0x4'));var util=require(_0xca90('0x5'));var encryptor=require(_0xca90('0x6'));var config=require(_0xca90('0x7'));var logger=require(_0xca90('0x8'))(_0xca90('0x9'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0xca90('0xa'))['db'];config['redis']=_[_0xca90('0xb')](config[_0xca90('0xc')],{'host':_0xca90('0xd'),'port':0x18eb});var redis=new Redis(config[_0xca90('0xc')]);var MICROSOFT_AUTH_URL=_0xca90('0xe');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xca90('0xf'),_0xca90('0x10'),_0xca90('0x11'),_0xca90('0x12'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xca90('0x13'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xca90('0x14');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x25f10a){var _0x500205=_[_0xca90('0x15')](AZURE_AUTH_SCOPES[_0x25f10a[_0xca90('0x16')]]);if(_0x25f10a[_0xca90('0x16')]===_0xca90('0x17'))_0x500205['push'](_0x25f10a[_0xca90('0x18')]+_0xca90('0x19'));return _0x500205[_0xca90('0x1a')]('\x20');}function getAccessTokenScope(_0x2866a4){if(_0x2866a4[_0xca90('0x16')]===_0xca90('0x1b'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x2866a4['type']===_0xca90('0x17'))return _0x2866a4[_0xca90('0x18')]+_0xca90('0x19');}function generateMicrosoftAuthorizationUrl(_0x44fbab,_0x4c53ee){var _0x13a82a=MICROSOFT_AUTH_URL[_0xca90('0x1c')](_0xca90('0x1d'),_0x44fbab[_0xca90('0x1e')]);var _0x55e3c8=[_0xca90('0x1f'),_0xca90('0x20')];var _0x3b85bc=Buffer[_0xca90('0x21')](JSON[_0xca90('0x22')]({'id':_0x4c53ee}))[_0xca90('0x23')]('base64');var _0x131b6b=crypto[_0xca90('0x24')](0x10)['toString'](_0xca90('0x25'));var _0x445015=getAuthorizationScopes(_0x44fbab);var _0x3402a8=[{'key':_0xca90('0x26'),'value':_0x44fbab['data1']},{'key':_0xca90('0x27'),'value':encodeURIComponent(_0x55e3c8[_0xca90('0x1a')]('\x20'))},{'key':_0xca90('0x28'),'value':_0x44fbab['data4']},{'key':'response_mode','value':_0xca90('0x29')},{'key':_0xca90('0x2a'),'value':encodeURIComponent(_0x445015)},{'key':'state','value':_0x3b85bc},{'key':_0xca90('0x2b'),'value':_0x131b6b},{'key':_0xca90('0x2c'),'value':_0xca90('0x2d')}];var _0x106e0d=_0x13a82a+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xca90('0x15')](_0x3402a8,function(_0x485503){return _0x485503[_0xca90('0x2e')]+'='+_0x485503[_0xca90('0x2f')];})[_0xca90('0x1a')]('&');_0x44fbab[_0xca90('0x30')]={'issuer':_0x13a82a[_0xca90('0x1c')](_0xca90('0x31'),''),'audience':_0x44fbab['data1'],'state':_0x3b85bc,'nonce':_0x131b6b};redis[_0xca90('0x32')](_0x3b85bc,JSON[_0xca90('0x22')](_0x44fbab));return _0x106e0d;}function isValidIdToken(_0x34cce8,_0x160882){try{var _0x272397=jwt[_0xca90('0x33')](_0x34cce8,{'complete':!![]});var _0x2707ca=_0x272397[_0xca90('0x34')];if(_0x2707ca['iss']!==_0x160882[_0xca90('0x35')])return![];if(_0x2707ca[_0xca90('0x36')]!==_0x160882['audience'])return![];if(_0x2707ca['nonce']!==_0x160882[_0xca90('0x2b')])return![];if(moment()[_0xca90('0x37')](moment[_0xca90('0x38')](_0x2707ca[_0xca90('0x39')])))return![];return!![];}catch(_0xe4d0e8){throw _0xe4d0e8;}}function refreshOauth2MicrosoftAccessToken(_0x50daf6){return Promise['resolve']()[_0xca90('0x3a')](function(){if(_0x50daf6[_0xca90('0x3b')])return _0x50daf6;return db[_0xca90('0x3c')][_0xca90('0x3d')]({'where':{'id':_0x50daf6['id']},'raw':!![]});})[_0xca90('0x3a')](function(_0xb26a28){var _0x54299b={'grant_type':_0xca90('0x3e'),'refresh_token':_0xb26a28['data6'],'scope':getAccessTokenScope(_0xb26a28),'redirect_uri':_0xb26a28[_0xca90('0x3f')],'client_id':_0xb26a28[_0xca90('0x40')],'client_secret':encryptor['decryptString'](_0xb26a28['data3'])};var _0x26edce={'method':_0xca90('0x41'),'uri':MICROSOFT_AUTH_URL[_0xca90('0x1c')](_0xca90('0x1d'),_0xb26a28[_0xca90('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x54299b,'json':!![]};return rp(_0x26edce);})[_0xca90('0x3a')](function(_0x1add64){_0x50daf6[_0xca90('0x42')]=_0x1add64[_0xca90('0x43')];_0x50daf6[_0xca90('0x44')]=_0x1add64[_0xca90('0x3e')];return db['CloudProvider'][_0xca90('0x45')]({'data5':_0x50daf6['data5'],'data6':_0x50daf6[_0xca90('0x44')]},{'where':{'id':_0x50daf6['id']}});})[_0xca90('0x3a')](function(){return _0x50daf6;})[_0xca90('0x46')](function(_0x322146){logger[_0xca90('0x47')](_0xca90('0x48'),_0x50daf6['id'],_0x322146);});}function getOauth2MicrosoftAccessToken(_0xbf078a,_0x29000c){var _0x39b221={'grant_type':_0xca90('0x49'),'code':_0xbf078a,'scope':getAccessTokenScope(_0x29000c),'redirect_uri':_0x29000c['data4'],'client_id':_0x29000c['data1'],'client_secret':encryptor['decryptString'](_0x29000c[_0xca90('0x3b')])};var _0x3a7ace={'method':_0xca90('0x41'),'uri':MICROSOFT_AUTH_URL[_0xca90('0x1c')]('{TENANT_ID}',_0x29000c[_0xca90('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x39b221,'json':!![]};return rp(_0x3a7ace);}function startRefreshInterval(_0x496b92){var _0x525c25=schedule[_0xca90('0x4a')];if(_0x525c25[_0x496b92['id']])clearInterval(_0x525c25[_0x496b92['id']]);_0x525c25[_0x496b92['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xca90('0x4b')](this,{'id':_0x496b92['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xca90('0x4a')]=_0x525c25;}function startAllRefreshIntervals(){return db[_0xca90('0x3c')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xca90('0x3a')](function(_0x59b84d){var _0x3d6909=_0x59b84d[_0xca90('0x15')](function(_0xee72e4){return refreshOauth2MicrosoftAccessToken(_0xee72e4)[_0xca90('0x3a')](function(_0x1ba200){startRefreshInterval(_0x1ba200);});});return Promise[_0xca90('0x4c')](_0x3d6909);})[_0xca90('0x46')](function(_0x5a2601){var _0x23a6d8=_0x5a2601?util[_0xca90('0x4d')](_0x5a2601,{'showHidden':![],'depth':null}):'';logger[_0xca90('0x47')](_0xca90('0x4e'),_0x23a6d8);});}module[_0xca90('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 3e7fd2e..07ac9d0 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 _0x578c=['stringify','error','code','message','info','CloudProvider,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s'];(function(_0x1c69b4,_0x306679){var _0x35bb79=function(_0x541c93){while(--_0x541c93){_0x1c69b4['push'](_0x1c69b4['shift']());}};_0x35bb79(++_0x306679);}(_0x578c,0x158));var _0xc578=function(_0x1e62e9,_0x53d12a){_0x1e62e9=_0x1e62e9-0x0;var _0x1b3e6f=_0x578c[_0x1e62e9];return _0x1b3e6f;};'use strict';var _=require(_0xc578('0x0'));var util=require(_0xc578('0x1'));var moment=require(_0xc578('0x2'));var BPromise=require('bluebird');var rs=require(_0xc578('0x3'));var fs=require('fs');var Redis=require(_0xc578('0x4'));var db=require(_0xc578('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc578('0x6'))(_0xc578('0x7'));var config=require(_0xc578('0x8'));var jayson=require(_0xc578('0x9'));var client=jayson[_0xc578('0xa')][_0xc578('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e619d,_0x703919,_0x198c3d){return new BPromise(function(_0x258f93,_0x1b6291){return client[_0xc578('0xc')](_0x3e619d,_0x198c3d)[_0xc578('0xd')](function(_0xaa68b3){logger['info']('CloudProvider,\x20%s,\x20%s',_0x703919,_0xc578('0xe'));logger['debug'](_0xc578('0xf'),_0x703919,_0xc578('0xe'),JSON[_0xc578('0x10')](_0xaa68b3));if(_0xaa68b3['error']){if(_0xaa68b3[_0xc578('0x11')][_0xc578('0x12')]===0x1f4){logger[_0xc578('0x11')]('CloudProvider,\x20%s,\x20%s',_0x703919,_0xaa68b3[_0xc578('0x11')][_0xc578('0x13')]);return _0x1b6291(_0xaa68b3[_0xc578('0x11')][_0xc578('0x13')]);}logger[_0xc578('0x11')]('CloudProvider,\x20%s,\x20%s',_0x703919,_0xaa68b3[_0xc578('0x11')][_0xc578('0x13')]);return _0x258f93(_0xaa68b3[_0xc578('0x11')][_0xc578('0x13')]);}else{logger[_0xc578('0x14')](_0xc578('0x15'),_0x703919,_0xc578('0xe'));_0x258f93(_0xaa68b3[_0xc578('0x16')][_0xc578('0x13')]);}})[_0xc578('0x17')](function(_0x2b76bc){logger[_0xc578('0x11')](_0xc578('0x15'),_0x703919,_0x2b76bc);_0x1b6291(_0x2b76bc);});});} \ No newline at end of file +var _0xb366=['code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','CloudProvider,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x9d14e3,_0x5a6072){var _0x19bf32=function(_0x19da07){while(--_0x19da07){_0x9d14e3['push'](_0x9d14e3['shift']());}};_0x19bf32(++_0x5a6072);}(_0xb366,0xa4));var _0x6b36=function(_0x342fb8,_0x54a8cd){_0x342fb8=_0x342fb8-0x0;var _0x188abb=_0xb366[_0x342fb8];return _0x188abb;};'use strict';var _=require(_0x6b36('0x0'));var util=require('util');var moment=require(_0x6b36('0x1'));var BPromise=require(_0x6b36('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b36('0x3'));var db=require(_0x6b36('0x4'))['db'];var utils=require(_0x6b36('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6b36('0x6'));var client=jayson[_0x6b36('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3997c0,_0x4fe38c,_0x4c6f4c){return new BPromise(function(_0x301a30,_0xee898a){return client[_0x6b36('0x8')](_0x3997c0,_0x4c6f4c)[_0x6b36('0x9')](function(_0x49c125){logger[_0x6b36('0xa')](_0x6b36('0xb'),_0x4fe38c,'request\x20sent');logger[_0x6b36('0xc')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x4fe38c,_0x6b36('0xd'),JSON[_0x6b36('0xe')](_0x49c125));if(_0x49c125[_0x6b36('0xf')]){if(_0x49c125[_0x6b36('0xf')][_0x6b36('0x10')]===0x1f4){logger[_0x6b36('0xf')]('CloudProvider,\x20%s,\x20%s',_0x4fe38c,_0x49c125[_0x6b36('0xf')][_0x6b36('0x11')]);return _0xee898a(_0x49c125['error'][_0x6b36('0x11')]);}logger['error'](_0x6b36('0xb'),_0x4fe38c,_0x49c125['error']['message']);return _0x301a30(_0x49c125['error'][_0x6b36('0x11')]);}else{logger[_0x6b36('0xa')](_0x6b36('0xb'),_0x4fe38c,'request\x20sent');_0x301a30(_0x49c125[_0x6b36('0x12')]['message']);}})[_0x6b36('0x13')](function(_0xf7b45a){logger[_0x6b36('0xf')]('CloudProvider,\x20%s,\x20%s',_0x4fe38c,_0xf7b45a);_0xee898a(_0xf7b45a);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 5a02057..993aa9d 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 _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x27d1ad,_0x5bc39a){var _0x3ca40d=function(_0x9bdfab){while(--_0x9bdfab){_0x27d1ad['push'](_0x27d1ad['shift']());}};_0x3ca40d(++_0x5bc39a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xc4aa[_0x342baa];return _0x1208f3;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file +var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x2ccbbe,_0x4ddab9){var _0x736bff=function(_0x2631c3){while(--_0x2631c3){_0x2ccbbe['push'](_0x2ccbbe['shift']());}};_0x736bff(++_0x4ddab9);}(_0xdb28,0x106));var _0x8db2=function(_0x2c79f8,_0x40b2b2){_0x2c79f8=_0x2c79f8-0x0;var _0x475248=_0xdb28[_0x2c79f8];return _0x475248;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 9663239..145fe52 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 _0xac2c=['name','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac2c,0x195));var _0xcac2=function(_0x2e1207,_0x2620c8){_0x2e1207=_0x2e1207-0x0;var _0x164111=_0xac2c[_0x2e1207];return _0x164111;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcac2('0x0')],'unique':_0xcac2('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xcac2('0x0')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xcac2('0x0')]},'phone':{'type':Sequelize[_0xcac2('0x0')]},'fax':{'type':Sequelize[_0xcac2('0x0')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xcac2('0x0')]},'postalCode':{'type':Sequelize[_0xcac2('0x0')]},'city':{'type':Sequelize[_0xcac2('0x0')]},'country':{'type':Sequelize[_0xcac2('0x0')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xcac2('0x0')]},'sPostalCode':{'type':Sequelize[_0xcac2('0x0')]},'sCity':{'type':Sequelize[_0xcac2('0x0')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcac2('0x0')]}}; \ No newline at end of file +var _0x9e0b=['STRING','sequelize'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0x9e0b,0xc1));var _0xb9e0=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x9e0b[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0xb9e0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb9e0('0x1')]},'companyId':{'type':Sequelize[_0xb9e0('0x1')]},'website':{'type':Sequelize[_0xb9e0('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xb9e0('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xb9e0('0x1')]},'postalCode':{'type':Sequelize[_0xb9e0('0x1')]},'city':{'type':Sequelize[_0xb9e0('0x1')]},'country':{'type':Sequelize[_0xb9e0('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xb9e0('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xb9e0('0x1')]},'sCity':{'type':Sequelize[_0xb9e0('0x1')]},'sCountry':{'type':Sequelize[_0xb9e0('0x1')]},'description':{'type':Sequelize[_0xb9e0('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index d6e8940..d4cede7 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 _0x7246=['CmContact','addContacts','ids','omit','findOne','filter','getContacts','zip-dir','request-promise','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Companies','UserProfileResource','end','name','index','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','options','CmCompany','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe'];(function(_0x4877c1,_0x559891){var _0x114801=function(_0xb85fc7){while(--_0xb85fc7){_0x4877c1['push'](_0x4877c1['shift']());}};_0x114801(++_0x559891);}(_0x7246,0x1a6));var _0x6724=function(_0x4dc7d4,_0x21a542){_0x4dc7d4=_0x4dc7d4-0x0;var _0x109248=_0x7246[_0x4dc7d4];return _0x109248;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6724('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6724('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6724('0x2'));var path=require(_0x6724('0x3'));var sox=require(_0x6724('0x4'));var csv=require('to-csv');var ejs=require(_0x6724('0x5'));var fs=require('fs');var fs_extra=require(_0x6724('0x6'));var _=require(_0x6724('0x7'));var squel=require(_0x6724('0x8'));var crypto=require(_0x6724('0x9'));var jsforce=require(_0x6724('0xa'));var deskjs=require(_0x6724('0xb'));var toCsv=require(_0x6724('0xc'));var querystring=require(_0x6724('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6724('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6724('0xf'));var logger=require(_0x6724('0x10'))(_0x6724('0x11'));var utils=require('../../config/utils');var config=require(_0x6724('0x12'));var licenseUtil=require(_0x6724('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15fe87,_0x211c77){_0x211c77=_0x211c77||0xcc;return function(_0x4bc223){if(_0x4bc223){return _0x15fe87[_0x6724('0x14')](_0x211c77);}return _0x15fe87[_0x6724('0x15')](_0x211c77)['end']();};}function respondWithResult(_0x3fdc0a,_0x4ae76b){_0x4ae76b=_0x4ae76b||0xc8;return function(_0x213090){if(_0x213090){return _0x3fdc0a[_0x6724('0x15')](_0x4ae76b)[_0x6724('0x16')](_0x213090);}};}function respondWithFilteredResult(_0x42d17b,_0x451b9f){return function(_0x5b7359){if(_0x5b7359){var _0x200dee=typeof _0x451b9f['offset']===_0x6724('0x17')&&typeof _0x451b9f['limit']===_0x6724('0x17');var _0x930324=_0x5b7359[_0x6724('0x18')];var _0x3bb08a=_0x200dee?0x0:_0x451b9f[_0x6724('0x19')];var _0x403a5a=_0x200dee?_0x5b7359[_0x6724('0x18')]:_0x451b9f[_0x6724('0x19')]+_0x451b9f[_0x6724('0x1a')];var _0xf29b81;if(_0x403a5a>=_0x930324){_0x403a5a=_0x930324;_0xf29b81=0xc8;}else{_0xf29b81=0xce;}_0x42d17b[_0x6724('0x15')](_0xf29b81);return _0x42d17b[_0x6724('0x1b')](_0x6724('0x1c'),_0x3bb08a+'-'+_0x403a5a+'/'+_0x930324)['json'](_0x5b7359);}return null;};}function patchUpdates(_0x50db06){return function(_0x19cf8b){try{jsonpatch[_0x6724('0x1d')](_0x19cf8b,_0x50db06,!![]);}catch(_0x17b0cf){return BPromise['reject'](_0x17b0cf);}return _0x19cf8b[_0x6724('0x1e')]();};}function saveUpdates(_0x2164fd,_0x43cdf6){return function(_0x2b9aec){if(_0x2b9aec){return _0x2b9aec[_0x6724('0x1f')](_0x2164fd)[_0x6724('0x20')](function(_0x16d7fd){return _0x16d7fd;});}return null;};}function removeEntity(_0x59604a,_0x1607db){return function(_0x56d19a){if(_0x56d19a){return _0x56d19a[_0x6724('0x21')]()[_0x6724('0x20')](function(){var _0x41e606=_0x56d19a[_0x6724('0x22')]({'plain':!![]});var _0x5b7857=_0x6724('0x23');return db[_0x6724('0x24')]['destroy']({'where':{'type':_0x5b7857,'resourceId':_0x41e606['id']}})['then'](function(){return _0x56d19a;});})['then'](function(){_0x59604a['status'](0xcc)[_0x6724('0x25')]();});}};}function handleEntityNotFound(_0x3850ef,_0x35333c){return function(_0x3c0da4){if(!_0x3c0da4){_0x3850ef[_0x6724('0x14')](0x194);}return _0x3c0da4;};}function handleError(_0x788182,_0x8f610d){_0x8f610d=_0x8f610d||0x1f4;return function(_0x105201){logger['error'](_0x105201['stack']);if(_0x105201[_0x6724('0x26')]){delete _0x105201['name'];}_0x788182['status'](_0x8f610d)['send'](_0x105201);};}exports[_0x6724('0x27')]=function(_0xf9d05c,_0x4ac163){var _0x2873ab={},_0x271411={},_0x327ebd={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0x6724('0x20')](function(_0xfb8933){_0x271411['model']=_['keys'](_0xfb8933);_0x271411[_0x6724('0x28')]=_[_0x6724('0x29')](_0xf9d05c[_0x6724('0x28')]);_0x271411[_0x6724('0x2a')]=_[_0x6724('0x2b')](_0x271411[_0x6724('0x2c')],_0x271411[_0x6724('0x28')]);_0x2873ab[_0x6724('0x2d')]=_[_0x6724('0x2b')](_0x271411[_0x6724('0x2c')],qs[_0x6724('0x2e')](_0xf9d05c[_0x6724('0x28')][_0x6724('0x2e')]));_0x2873ab[_0x6724('0x2d')]=_0x2873ab[_0x6724('0x2d')][_0x6724('0x2f')]?_0x2873ab[_0x6724('0x2d')]:_0x271411[_0x6724('0x2c')];if(!_0xf9d05c[_0x6724('0x28')][_0x6724('0x30')](_0x6724('0x31'))){_0x2873ab['limit']=qs['limit'](_0xf9d05c[_0x6724('0x28')][_0x6724('0x1a')]);_0x2873ab[_0x6724('0x19')]=qs[_0x6724('0x19')](_0xf9d05c[_0x6724('0x28')][_0x6724('0x19')]);}_0x2873ab[_0x6724('0x32')]=qs[_0x6724('0x33')](_0xf9d05c[_0x6724('0x28')][_0x6724('0x33')]);_0x2873ab[_0x6724('0x34')]=qs[_0x6724('0x2a')](_[_0x6724('0x35')](_0xf9d05c['query'],_0x271411[_0x6724('0x2a')]),_0xfb8933);if(_0xf9d05c['query']['filter']){_0x2873ab[_0x6724('0x34')]=_[_0x6724('0x36')](_0x2873ab[_0x6724('0x34')],{'$or':_[_0x6724('0x37')](_0x2873ab['attributes'],function(_0x4516a1){var _0x228f78={};_0x228f78[_0x4516a1]={'$like':'%'+_0xf9d05c[_0x6724('0x28')]['filter']+'%'};return _0x228f78;})});}_0x2873ab=_[_0x6724('0x36')]({},_0x2873ab,_0xf9d05c[_0x6724('0x38')]);var _0x50f783={'where':_0x2873ab[_0x6724('0x34')]};return db[_0x6724('0x39')][_0x6724('0x18')](_0x50f783)[_0x6724('0x20')](function(_0x285be1){_0x327ebd[_0x6724('0x18')]=_0x285be1;if(_0xf9d05c[_0x6724('0x28')][_0x6724('0x3a')]){_0x2873ab[_0x6724('0x3b')]=[{'all':!![]}];}return db['CmCompany'][_0x6724('0x3c')](_0x2873ab);})[_0x6724('0x20')](function(_0x496662){_0x327ebd['rows']=_0x496662;return _0x327ebd;})[_0x6724('0x20')](respondWithFilteredResult(_0x4ac163,_0x2873ab))[_0x6724('0x3d')](handleError(_0x4ac163,null));})['catch'](handleError(_0x4ac163,null));};exports[_0x6724('0x3e')]=function(_0x4e47e3,_0x354f62){var _0x1bb2a6={'raw':![],'where':{'id':_0x4e47e3[_0x6724('0x3f')]['id']}},_0x350570={};_0x350570[_0x6724('0x2c')]=_['keys'](db[_0x6724('0x39')][_0x6724('0x40')]);_0x350570[_0x6724('0x28')]=_['keys'](_0x4e47e3[_0x6724('0x28')]);_0x350570[_0x6724('0x2a')]=_[_0x6724('0x2b')](_0x350570[_0x6724('0x2c')],_0x350570[_0x6724('0x28')]);_0x1bb2a6[_0x6724('0x2d')]=_[_0x6724('0x2b')](_0x350570[_0x6724('0x2c')],qs['fields'](_0x4e47e3[_0x6724('0x28')][_0x6724('0x2e')]));_0x1bb2a6[_0x6724('0x2d')]=_0x1bb2a6['attributes']['length']?_0x1bb2a6[_0x6724('0x2d')]:_0x350570['model'];if(_0x4e47e3['query']['includeAll']){_0x1bb2a6['include']=[{'all':!![]}];}_0x1bb2a6=_['merge']({},_0x1bb2a6,_0x4e47e3['options']);return db[_0x6724('0x39')][_0x6724('0x41')](_0x1bb2a6)[_0x6724('0x20')](handleEntityNotFound(_0x354f62,null))[_0x6724('0x20')](respondWithResult(_0x354f62,null))['catch'](handleError(_0x354f62,null));};exports[_0x6724('0x42')]=function(_0x476777,_0x43586a){return db[_0x6724('0x39')]['create'](_0x476777[_0x6724('0x43')],{})[_0x6724('0x20')](function(_0x2c1576){var _0x5b279a=_0x476777[_0x6724('0x44')][_0x6724('0x22')]({'plain':!![]});if(!_0x5b279a)throw new Error(_0x6724('0x45'));if(_0x5b279a[_0x6724('0x46')]===_0x6724('0x44')){var _0x10249a=_0x2c1576[_0x6724('0x22')]({'plain':!![]});var _0x49e791='Companies';return db[_0x6724('0x47')]['find']({'where':{'name':_0x49e791,'userProfileId':_0x5b279a[_0x6724('0x48')]},'raw':!![]})['then'](function(_0x1f48e8){if(_0x1f48e8&&_0x1f48e8[_0x6724('0x49')]===0x0){return db[_0x6724('0x24')][_0x6724('0x42')]({'name':_0x10249a[_0x6724('0x26')],'resourceId':_0x10249a['id'],'type':_0x1f48e8['name'],'sectionId':_0x1f48e8['id']},{})['then'](function(){return _0x2c1576;});}else{return _0x2c1576;}})[_0x6724('0x3d')](function(_0x5bada7){logger['error'](_0x6724('0x4a'),_0x5bada7);throw _0x5bada7;});}return _0x2c1576;})[_0x6724('0x20')](respondWithResult(_0x43586a,0xc9))[_0x6724('0x3d')](handleError(_0x43586a,null));};exports[_0x6724('0x1f')]=function(_0x522ed2,_0x74dbdf){if(_0x522ed2[_0x6724('0x43')]['id']){delete _0x522ed2[_0x6724('0x43')]['id'];}return db[_0x6724('0x39')][_0x6724('0x41')]({'where':{'id':_0x522ed2[_0x6724('0x3f')]['id']}})[_0x6724('0x20')](handleEntityNotFound(_0x74dbdf,null))[_0x6724('0x20')](saveUpdates(_0x522ed2[_0x6724('0x43')],null))[_0x6724('0x20')](respondWithResult(_0x74dbdf,null))[_0x6724('0x3d')](handleError(_0x74dbdf,null));};exports['destroy']=function(_0x1e7c7d,_0x13f290){return db[_0x6724('0x39')]['find']({'where':{'id':_0x1e7c7d[_0x6724('0x3f')]['id']}})[_0x6724('0x20')](handleEntityNotFound(_0x13f290,null))[_0x6724('0x20')](removeEntity(_0x13f290,null))[_0x6724('0x3d')](handleError(_0x13f290,null));};exports[_0x6724('0x4b')]=function(_0x4f200c,_0x35fe52){return db['CmCompany'][_0x6724('0x4b')]()[_0x6724('0x20')](respondWithResult(_0x35fe52,null))[_0x6724('0x3d')](handleError(_0x35fe52,null));};exports['addContacts']=function(_0x34aea1,_0x4b4a26,_0x234957){return db[_0x6724('0x4c')][_0x6724('0x41')]({'where':{'id':_0x34aea1[_0x6724('0x3f')]['id']}})[_0x6724('0x20')](handleEntityNotFound(_0x4b4a26,null))[_0x6724('0x20')](function(_0x265aff){if(_0x265aff){return _0x265aff[_0x6724('0x4d')](_0x34aea1[_0x6724('0x43')][_0x6724('0x4e')],_[_0x6724('0x4f')](_0x34aea1[_0x6724('0x43')],[_0x6724('0x4e'),'id'])||{});}})[_0x6724('0x20')](respondWithResult(_0x4b4a26,null))[_0x6724('0x3d')](handleError(_0x4b4a26,null));};exports['getContacts']=function(_0x11ceca,_0x498249,_0x55c50f){var _0x35330a={};var _0x96be16={};var _0x25e006;var _0x18710f;return db['CmCompany'][_0x6724('0x50')]({'where':{'id':_0x11ceca[_0x6724('0x3f')]['id']}})['then'](handleEntityNotFound(_0x498249,null))[_0x6724('0x20')](function(_0x3dfbe5){if(_0x3dfbe5){_0x25e006=_0x3dfbe5;_0x96be16['model']=_[_0x6724('0x29')](db[_0x6724('0x4c')][_0x6724('0x40')]);_0x96be16['query']=_[_0x6724('0x29')](_0x11ceca[_0x6724('0x28')]);_0x96be16[_0x6724('0x2a')]=_[_0x6724('0x2b')](_0x96be16['model'],_0x96be16[_0x6724('0x28')]);_0x35330a['attributes']=_[_0x6724('0x2b')](_0x96be16[_0x6724('0x2c')],qs[_0x6724('0x2e')](_0x11ceca[_0x6724('0x28')][_0x6724('0x2e')]));_0x35330a[_0x6724('0x2d')]=_0x35330a[_0x6724('0x2d')][_0x6724('0x2f')]?_0x35330a[_0x6724('0x2d')]:_0x96be16[_0x6724('0x2c')];_0x35330a['order']=qs[_0x6724('0x33')](_0x11ceca['query'][_0x6724('0x33')]);_0x35330a['where']=qs['filters'](_['pick'](_0x11ceca[_0x6724('0x28')],_0x96be16['filters']));if(_0x11ceca[_0x6724('0x28')][_0x6724('0x51')]){_0x35330a['where']=_[_0x6724('0x36')](_0x35330a[_0x6724('0x34')],{'$or':_['map'](_0x35330a[_0x6724('0x2d')],function(_0x1b5379){var _0x219a8b={};_0x219a8b[_0x1b5379]={'$like':'%'+_0x11ceca[_0x6724('0x28')][_0x6724('0x51')]+'%'};return _0x219a8b;})});}_0x35330a=_[_0x6724('0x36')]({},_0x35330a,_0x11ceca[_0x6724('0x38')]);return _0x25e006[_0x6724('0x52')](_0x35330a);}})[_0x6724('0x20')](function(_0x382b45){if(_0x382b45){_0x18710f=_0x382b45[_0x6724('0x2f')];if(!_0x11ceca[_0x6724('0x28')][_0x6724('0x30')](_0x6724('0x31'))){_0x35330a[_0x6724('0x1a')]=qs[_0x6724('0x1a')](_0x11ceca[_0x6724('0x28')][_0x6724('0x1a')]);_0x35330a[_0x6724('0x19')]=qs['offset'](_0x11ceca[_0x6724('0x28')][_0x6724('0x19')]);}return _0x25e006[_0x6724('0x52')](_0x35330a);}})[_0x6724('0x20')](function(_0x4cf764){if(_0x4cf764){return _0x4cf764?{'count':_0x18710f,'rows':_0x4cf764}:null;}})['then'](respondWithResult(_0x498249,null))['catch'](handleError(_0x498249,null));}; \ No newline at end of file +var _0xd696=['crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','apply','update','then','destroy','Companies','UserProfileResource','sendStatus','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','CmContact','ids','getContacts','pick','map','rimraf','zip-dir','request-promise','moment','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x5c693e,_0x5dc5a7){var _0x457ffe=function(_0x8fa6b6){while(--_0x8fa6b6){_0x5c693e['push'](_0x5c693e['shift']());}};_0x457ffe(++_0x5dc5a7);}(_0xd696,0x186));var _0x6d69=function(_0x35c718,_0x33a696){_0x35c718=_0x35c718-0x0;var _0x5c3099=_0xd696[_0x35c718];return _0x5c3099;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6d69('0x0'));var zipdir=require(_0x6d69('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d69('0x2'));var moment=require(_0x6d69('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x6d69('0x4'));var sox=require('sox');var csv=require(_0x6d69('0x5'));var ejs=require(_0x6d69('0x6'));var fs=require('fs');var fs_extra=require(_0x6d69('0x7'));var _=require(_0x6d69('0x8'));var squel=require(_0x6d69('0x9'));var crypto=require(_0x6d69('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6d69('0x5'));var querystring=require('querystring');var Papa=require(_0x6d69('0xb'));var Redis=require('ioredis');var authService=require(_0x6d69('0xc'));var qs=require(_0x6d69('0xd'));var as=require(_0x6d69('0xe'));var hardwareService=require(_0x6d69('0xf'));var logger=require(_0x6d69('0x10'))('api');var utils=require(_0x6d69('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x6d69('0x12'));var db=require(_0x6d69('0x13'))['db'];function respondWithStatusCode(_0x392f35,_0x5bd9db){_0x5bd9db=_0x5bd9db||0xcc;return function(_0x3a9e8e){if(_0x3a9e8e){return _0x392f35['sendStatus'](_0x5bd9db);}return _0x392f35[_0x6d69('0x14')](_0x5bd9db)[_0x6d69('0x15')]();};}function respondWithResult(_0xece7fd,_0x1ad4b8){_0x1ad4b8=_0x1ad4b8||0xc8;return function(_0xbc1d37){if(_0xbc1d37){return _0xece7fd['status'](_0x1ad4b8)[_0x6d69('0x16')](_0xbc1d37);}};}function respondWithFilteredResult(_0xe74c08,_0x3df42c){return function(_0xc6cd18){if(_0xc6cd18){var _0x1df788=typeof _0x3df42c[_0x6d69('0x17')]===_0x6d69('0x18')&&typeof _0x3df42c['limit']===_0x6d69('0x18');var _0x48737a=_0xc6cd18[_0x6d69('0x19')];var _0x2ccd81=_0x1df788?0x0:_0x3df42c[_0x6d69('0x17')];var _0x117232=_0x1df788?_0xc6cd18[_0x6d69('0x19')]:_0x3df42c[_0x6d69('0x17')]+_0x3df42c[_0x6d69('0x1a')];var _0x5343e6;if(_0x117232>=_0x48737a){_0x117232=_0x48737a;_0x5343e6=0xc8;}else{_0x5343e6=0xce;}_0xe74c08['status'](_0x5343e6);return _0xe74c08['set']('Content-Range',_0x2ccd81+'-'+_0x117232+'/'+_0x48737a)[_0x6d69('0x16')](_0xc6cd18);}return null;};}function patchUpdates(_0x5a040b){return function(_0x42dad5){try{jsonpatch[_0x6d69('0x1b')](_0x42dad5,_0x5a040b,!![]);}catch(_0x26737d){return BPromise['reject'](_0x26737d);}return _0x42dad5['save']();};}function saveUpdates(_0x28e6b2,_0xc6269a){return function(_0x5c0310){if(_0x5c0310){return _0x5c0310[_0x6d69('0x1c')](_0x28e6b2)[_0x6d69('0x1d')](function(_0x5a4ed0){return _0x5a4ed0;});}return null;};}function removeEntity(_0x248f94,_0x21a666){return function(_0x3e40df){if(_0x3e40df){return _0x3e40df[_0x6d69('0x1e')]()[_0x6d69('0x1d')](function(){var _0x51bc3e=_0x3e40df['get']({'plain':!![]});var _0x3a9260=_0x6d69('0x1f');return db[_0x6d69('0x20')][_0x6d69('0x1e')]({'where':{'type':_0x3a9260,'resourceId':_0x51bc3e['id']}})['then'](function(){return _0x3e40df;});})[_0x6d69('0x1d')](function(){_0x248f94['status'](0xcc)[_0x6d69('0x15')]();});}};}function handleEntityNotFound(_0x148a7b,_0x27d99b){return function(_0x33fc1a){if(!_0x33fc1a){_0x148a7b[_0x6d69('0x21')](0x194);}return _0x33fc1a;};}function handleError(_0x1b1d20,_0x16dc76){_0x16dc76=_0x16dc76||0x1f4;return function(_0x26b50b){logger[_0x6d69('0x22')](_0x26b50b[_0x6d69('0x23')]);if(_0x26b50b[_0x6d69('0x24')]){delete _0x26b50b[_0x6d69('0x24')];}_0x1b1d20['status'](_0x16dc76)[_0x6d69('0x25')](_0x26b50b);};}exports[_0x6d69('0x26')]=function(_0x2d61e3,_0x3e57d9){var _0x5e8549={},_0x22ab05={},_0x4cecff={'count':0x0,'rows':[]};return db[_0x6d69('0x27')][_0x6d69('0x28')]()[_0x6d69('0x1d')](function(_0xa5a289){_0x22ab05[_0x6d69('0x29')]=_[_0x6d69('0x2a')](_0xa5a289);_0x22ab05[_0x6d69('0x2b')]=_[_0x6d69('0x2a')](_0x2d61e3[_0x6d69('0x2b')]);_0x22ab05[_0x6d69('0x2c')]=_[_0x6d69('0x2d')](_0x22ab05[_0x6d69('0x29')],_0x22ab05['query']);_0x5e8549[_0x6d69('0x2e')]=_[_0x6d69('0x2d')](_0x22ab05[_0x6d69('0x29')],qs['fields'](_0x2d61e3[_0x6d69('0x2b')][_0x6d69('0x2f')]));_0x5e8549[_0x6d69('0x2e')]=_0x5e8549[_0x6d69('0x2e')]['length']?_0x5e8549[_0x6d69('0x2e')]:_0x22ab05[_0x6d69('0x29')];if(!_0x2d61e3[_0x6d69('0x2b')][_0x6d69('0x30')](_0x6d69('0x31'))){_0x5e8549[_0x6d69('0x1a')]=qs[_0x6d69('0x1a')](_0x2d61e3['query'][_0x6d69('0x1a')]);_0x5e8549[_0x6d69('0x17')]=qs[_0x6d69('0x17')](_0x2d61e3[_0x6d69('0x2b')]['offset']);}_0x5e8549[_0x6d69('0x32')]=qs[_0x6d69('0x33')](_0x2d61e3['query']['sort']);_0x5e8549[_0x6d69('0x34')]=qs['filters'](_['pick'](_0x2d61e3[_0x6d69('0x2b')],_0x22ab05[_0x6d69('0x2c')]),_0xa5a289);if(_0x2d61e3[_0x6d69('0x2b')][_0x6d69('0x35')]){_0x5e8549[_0x6d69('0x34')]=_[_0x6d69('0x36')](_0x5e8549[_0x6d69('0x34')],{'$or':_['map'](_0x5e8549[_0x6d69('0x2e')],function(_0x6929f1){var _0x1b4a42={};_0x1b4a42[_0x6929f1]={'$like':'%'+_0x2d61e3[_0x6d69('0x2b')][_0x6d69('0x35')]+'%'};return _0x1b4a42;})});}_0x5e8549=_[_0x6d69('0x36')]({},_0x5e8549,_0x2d61e3[_0x6d69('0x37')]);var _0x2d3db0={'where':_0x5e8549['where']};return db['CmCompany'][_0x6d69('0x19')](_0x2d3db0)[_0x6d69('0x1d')](function(_0xf63aba){_0x4cecff['count']=_0xf63aba;if(_0x2d61e3['query'][_0x6d69('0x38')]){_0x5e8549[_0x6d69('0x39')]=[{'all':!![]}];}return db[_0x6d69('0x27')]['findAll'](_0x5e8549);})[_0x6d69('0x1d')](function(_0x1cd8f1){_0x4cecff[_0x6d69('0x3a')]=_0x1cd8f1;return _0x4cecff;})[_0x6d69('0x1d')](respondWithFilteredResult(_0x3e57d9,_0x5e8549))[_0x6d69('0x3b')](handleError(_0x3e57d9,null));})[_0x6d69('0x3b')](handleError(_0x3e57d9,null));};exports[_0x6d69('0x3c')]=function(_0x1bfd37,_0x3b3d48){var _0x5ab4a9={'raw':![],'where':{'id':_0x1bfd37[_0x6d69('0x3d')]['id']}},_0x5b977e={};_0x5b977e['model']=_[_0x6d69('0x2a')](db['CmCompany'][_0x6d69('0x3e')]);_0x5b977e[_0x6d69('0x2b')]=_['keys'](_0x1bfd37['query']);_0x5b977e[_0x6d69('0x2c')]=_['intersection'](_0x5b977e[_0x6d69('0x29')],_0x5b977e['query']);_0x5ab4a9[_0x6d69('0x2e')]=_[_0x6d69('0x2d')](_0x5b977e[_0x6d69('0x29')],qs[_0x6d69('0x2f')](_0x1bfd37['query'][_0x6d69('0x2f')]));_0x5ab4a9['attributes']=_0x5ab4a9['attributes'][_0x6d69('0x3f')]?_0x5ab4a9['attributes']:_0x5b977e['model'];if(_0x1bfd37[_0x6d69('0x2b')][_0x6d69('0x38')]){_0x5ab4a9['include']=[{'all':!![]}];}_0x5ab4a9=_[_0x6d69('0x36')]({},_0x5ab4a9,_0x1bfd37['options']);return db[_0x6d69('0x27')][_0x6d69('0x40')](_0x5ab4a9)[_0x6d69('0x1d')](handleEntityNotFound(_0x3b3d48,null))[_0x6d69('0x1d')](respondWithResult(_0x3b3d48,null))[_0x6d69('0x3b')](handleError(_0x3b3d48,null));};exports[_0x6d69('0x41')]=function(_0xaca25b,_0x52313a){return db[_0x6d69('0x27')]['create'](_0xaca25b['body'],{})[_0x6d69('0x1d')](function(_0x383a4b){var _0x9faba3=_0xaca25b[_0x6d69('0x42')][_0x6d69('0x43')]({'plain':!![]});if(!_0x9faba3)throw new Error(_0x6d69('0x44'));if(_0x9faba3[_0x6d69('0x45')]===_0x6d69('0x42')){var _0x4f8583=_0x383a4b[_0x6d69('0x43')]({'plain':!![]});var _0x345209=_0x6d69('0x1f');return db['UserProfileSection'][_0x6d69('0x40')]({'where':{'name':_0x345209,'userProfileId':_0x9faba3[_0x6d69('0x46')]},'raw':!![]})[_0x6d69('0x1d')](function(_0x3046b2){if(_0x3046b2&&_0x3046b2[_0x6d69('0x47')]===0x0){return db[_0x6d69('0x20')]['create']({'name':_0x4f8583['name'],'resourceId':_0x4f8583['id'],'type':_0x3046b2[_0x6d69('0x24')],'sectionId':_0x3046b2['id']},{})[_0x6d69('0x1d')](function(){return _0x383a4b;});}else{return _0x383a4b;}})['catch'](function(_0x3b4efe){logger[_0x6d69('0x22')](_0x6d69('0x48'),_0x3b4efe);throw _0x3b4efe;});}return _0x383a4b;})['then'](respondWithResult(_0x52313a,0xc9))['catch'](handleError(_0x52313a,null));};exports[_0x6d69('0x1c')]=function(_0x34ad17,_0x57edd7){if(_0x34ad17[_0x6d69('0x49')]['id']){delete _0x34ad17[_0x6d69('0x49')]['id'];}return db[_0x6d69('0x27')][_0x6d69('0x40')]({'where':{'id':_0x34ad17[_0x6d69('0x3d')]['id']}})[_0x6d69('0x1d')](handleEntityNotFound(_0x57edd7,null))[_0x6d69('0x1d')](saveUpdates(_0x34ad17[_0x6d69('0x49')],null))['then'](respondWithResult(_0x57edd7,null))[_0x6d69('0x3b')](handleError(_0x57edd7,null));};exports[_0x6d69('0x1e')]=function(_0x3e7999,_0x52fb18){return db[_0x6d69('0x27')]['find']({'where':{'id':_0x3e7999[_0x6d69('0x3d')]['id']}})[_0x6d69('0x1d')](handleEntityNotFound(_0x52fb18,null))[_0x6d69('0x1d')](removeEntity(_0x52fb18,null))[_0x6d69('0x3b')](handleError(_0x52fb18,null));};exports[_0x6d69('0x28')]=function(_0x530334,_0x158b89){return db[_0x6d69('0x27')][_0x6d69('0x28')]()[_0x6d69('0x1d')](respondWithResult(_0x158b89,null))[_0x6d69('0x3b')](handleError(_0x158b89,null));};exports[_0x6d69('0x4a')]=function(_0x2514e4,_0xcc064,_0x151d3a){return db[_0x6d69('0x4b')]['find']({'where':{'id':_0x2514e4[_0x6d69('0x3d')]['id']}})[_0x6d69('0x1d')](handleEntityNotFound(_0xcc064,null))['then'](function(_0x2bc09d){if(_0x2bc09d){return _0x2bc09d[_0x6d69('0x4a')](_0x2514e4[_0x6d69('0x49')]['ids'],_['omit'](_0x2514e4[_0x6d69('0x49')],[_0x6d69('0x4c'),'id'])||{});}})[_0x6d69('0x1d')](respondWithResult(_0xcc064,null))['catch'](handleError(_0xcc064,null));};exports[_0x6d69('0x4d')]=function(_0x399ea4,_0x1d264f,_0xf7ba7d){var _0x4706e4={};var _0xf1df6f={};var _0x430606;var _0xc6aa5e;return db[_0x6d69('0x27')]['findOne']({'where':{'id':_0x399ea4[_0x6d69('0x3d')]['id']}})[_0x6d69('0x1d')](handleEntityNotFound(_0x1d264f,null))['then'](function(_0x301531){if(_0x301531){_0x430606=_0x301531;_0xf1df6f[_0x6d69('0x29')]=_[_0x6d69('0x2a')](db[_0x6d69('0x4b')][_0x6d69('0x3e')]);_0xf1df6f[_0x6d69('0x2b')]=_['keys'](_0x399ea4[_0x6d69('0x2b')]);_0xf1df6f[_0x6d69('0x2c')]=_[_0x6d69('0x2d')](_0xf1df6f['model'],_0xf1df6f[_0x6d69('0x2b')]);_0x4706e4[_0x6d69('0x2e')]=_[_0x6d69('0x2d')](_0xf1df6f[_0x6d69('0x29')],qs[_0x6d69('0x2f')](_0x399ea4['query']['fields']));_0x4706e4[_0x6d69('0x2e')]=_0x4706e4[_0x6d69('0x2e')][_0x6d69('0x3f')]?_0x4706e4[_0x6d69('0x2e')]:_0xf1df6f['model'];_0x4706e4[_0x6d69('0x32')]=qs[_0x6d69('0x33')](_0x399ea4[_0x6d69('0x2b')]['sort']);_0x4706e4[_0x6d69('0x34')]=qs['filters'](_[_0x6d69('0x4e')](_0x399ea4[_0x6d69('0x2b')],_0xf1df6f['filters']));if(_0x399ea4[_0x6d69('0x2b')][_0x6d69('0x35')]){_0x4706e4[_0x6d69('0x34')]=_[_0x6d69('0x36')](_0x4706e4[_0x6d69('0x34')],{'$or':_[_0x6d69('0x4f')](_0x4706e4[_0x6d69('0x2e')],function(_0x141dda){var _0x27b4e8={};_0x27b4e8[_0x141dda]={'$like':'%'+_0x399ea4['query'][_0x6d69('0x35')]+'%'};return _0x27b4e8;})});}_0x4706e4=_[_0x6d69('0x36')]({},_0x4706e4,_0x399ea4[_0x6d69('0x37')]);return _0x430606[_0x6d69('0x4d')](_0x4706e4);}})[_0x6d69('0x1d')](function(_0x578504){if(_0x578504){_0xc6aa5e=_0x578504[_0x6d69('0x3f')];if(!_0x399ea4[_0x6d69('0x2b')][_0x6d69('0x30')](_0x6d69('0x31'))){_0x4706e4['limit']=qs[_0x6d69('0x1a')](_0x399ea4['query'][_0x6d69('0x1a')]);_0x4706e4[_0x6d69('0x17')]=qs[_0x6d69('0x17')](_0x399ea4[_0x6d69('0x2b')][_0x6d69('0x17')]);}return _0x430606[_0x6d69('0x4d')](_0x4706e4);}})[_0x6d69('0x1d')](function(_0x5ed1a5){if(_0x5ed1a5){return _0x5ed1a5?{'count':_0xc6aa5e,'rows':_0x5ed1a5}:null;}})[_0x6d69('0x1d')](respondWithResult(_0x1d264f,null))[_0x6d69('0x3b')](handleError(_0x1d264f,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 770c07a..e022062 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 _0x0f11=['./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','path','../../config/environment'];(function(_0x52b7b9,_0x43ed4b){var _0x5b5d30=function(_0x4a5b9c){while(--_0x4a5b9c){_0x52b7b9['push'](_0x52b7b9['shift']());}};_0x5b5d30(++_0x43ed4b);}(_0x0f11,0xd1));var _0x10f1=function(_0x2e8e60,_0x2f4b7c){_0x2e8e60=_0x2e8e60-0x0;var _0x660c09=_0x0f11[_0x2e8e60];return _0x660c09;};'use strict';var _=require(_0x10f1('0x0'));var util=require(_0x10f1('0x1'));var logger=require(_0x10f1('0x2'))(_0x10f1('0x3'));var moment=require(_0x10f1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x10f1('0x5'));var rimraf=require('rimraf');var config=require(_0x10f1('0x6'));var attributes=require(_0x10f1('0x7'));module[_0x10f1('0x8')]=function(_0x14a004,_0x321459){return _0x14a004[_0x10f1('0x9')](_0x10f1('0xa'),attributes,{'tableName':_0x10f1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc93c=['request-promise','path','../../config/environment','exports','define','CmCompany','cm_companies','lodash','../../config/logger','bluebird'];(function(_0x5010c2,_0x5cdf1b){var _0xc37993=function(_0x5f4405){while(--_0x5f4405){_0x5010c2['push'](_0x5010c2['shift']());}};_0xc37993(++_0x5cdf1b);}(_0xc93c,0xbb));var _0xcc93=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc93c[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xcc93('0x0'));var util=require('util');var logger=require(_0xcc93('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcc93('0x2'));var rp=require(_0xcc93('0x3'));var fs=require('fs');var path=require(_0xcc93('0x4'));var rimraf=require('rimraf');var config=require(_0xcc93('0x5'));var attributes=require('./cmCompany.attributes');module[_0xcc93('0x6')]=function(_0x3357d0,_0x487486){return _0x3357d0[_0xcc93('0x7')](_0xcc93('0x8'),attributes,{'tableName':_0xcc93('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index bebd69c..5adc395 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 _0x543d=['CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x543d,0x159));var _0xd543=function(_0xdf5462,_0x66522a){_0xdf5462=_0xdf5462-0x0;var _0x12bcb0=_0x543d[_0xdf5462];return _0x12bcb0;};'use strict';var _=require(_0xd543('0x0'));var util=require(_0xd543('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd543('0x2'));var fs=require('fs');var Redis=require(_0xd543('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd543('0x4'))(_0xd543('0x5'));var config=require(_0xd543('0x6'));var jayson=require(_0xd543('0x7'));var client=jayson['client'][_0xd543('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4fe03f,_0x16aa31,_0x50c672){return new BPromise(function(_0xeaaf6d,_0x33f750){return client[_0xd543('0x9')](_0x4fe03f,_0x50c672)[_0xd543('0xa')](function(_0x4d50b6){logger[_0xd543('0xb')](_0xd543('0xc'),_0x16aa31,'request\x20sent');logger[_0xd543('0xd')](_0xd543('0xe'),_0x16aa31,_0xd543('0xf'),JSON['stringify'](_0x4d50b6));if(_0x4d50b6[_0xd543('0x10')]){if(_0x4d50b6[_0xd543('0x10')][_0xd543('0x11')]===0x1f4){logger[_0xd543('0x10')](_0xd543('0xc'),_0x16aa31,_0x4d50b6[_0xd543('0x10')][_0xd543('0x12')]);return _0x33f750(_0x4d50b6[_0xd543('0x10')][_0xd543('0x12')]);}logger[_0xd543('0x10')](_0xd543('0xc'),_0x16aa31,_0x4d50b6[_0xd543('0x10')][_0xd543('0x12')]);return _0xeaaf6d(_0x4d50b6['error'][_0xd543('0x12')]);}else{logger[_0xd543('0xb')]('CmCompany,\x20%s,\x20%s',_0x16aa31,'request\x20sent');_0xeaaf6d(_0x4d50b6[_0xd543('0x13')][_0xd543('0x12')]);}})[_0xd543('0x14')](function(_0x434619){logger[_0xd543('0x10')](_0xd543('0xc'),_0x16aa31,_0x434619);_0x33f750(_0x434619);});});} \ No newline at end of file +var _0xde42=['stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s'];(function(_0x146dcd,_0x1b6e84){var _0x2ccc6c=function(_0x56e401){while(--_0x56e401){_0x146dcd['push'](_0x146dcd['shift']());}};_0x2ccc6c(++_0x1b6e84);}(_0xde42,0x1ea));var _0x2de4=function(_0x1d98da,_0x532964){_0x1d98da=_0x1d98da-0x0;var _0x2a56f2=_0xde42[_0x1d98da];return _0x2a56f2;};'use strict';var _=require('lodash');var util=require(_0x2de4('0x0'));var moment=require(_0x2de4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2de4('0x2'))['db'];var utils=require(_0x2de4('0x3'));var logger=require(_0x2de4('0x4'))(_0x2de4('0x5'));var config=require(_0x2de4('0x6'));var jayson=require(_0x2de4('0x7'));var client=jayson[_0x2de4('0x8')][_0x2de4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e39e9,_0x2c690c,_0x4b6a08){return new BPromise(function(_0x50c525,_0x4a9414){return client[_0x2de4('0xa')](_0x1e39e9,_0x4b6a08)['then'](function(_0x3f652a){logger[_0x2de4('0xb')](_0x2de4('0xc'),_0x2c690c,_0x2de4('0xd'));logger[_0x2de4('0xe')](_0x2de4('0xf'),_0x2c690c,_0x2de4('0xd'),JSON[_0x2de4('0x10')](_0x3f652a));if(_0x3f652a['error']){if(_0x3f652a[_0x2de4('0x11')][_0x2de4('0x12')]===0x1f4){logger[_0x2de4('0x11')](_0x2de4('0xc'),_0x2c690c,_0x3f652a[_0x2de4('0x11')]['message']);return _0x4a9414(_0x3f652a[_0x2de4('0x11')][_0x2de4('0x13')]);}logger[_0x2de4('0x11')](_0x2de4('0xc'),_0x2c690c,_0x3f652a['error'][_0x2de4('0x13')]);return _0x50c525(_0x3f652a[_0x2de4('0x11')][_0x2de4('0x13')]);}else{logger[_0x2de4('0xb')](_0x2de4('0xc'),_0x2c690c,_0x2de4('0xd'));_0x50c525(_0x3f652a[_0x2de4('0x14')][_0x2de4('0x13')]);}})[_0x2de4('0x15')](function(_0x5a2554){logger[_0x2de4('0x11')](_0x2de4('0xc'),_0x2c690c,_0x5a2554);_0x4a9414(_0x5a2554);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index ac8f0fb..2b31e89 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 _0x5232=['/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0xb165dd,_0x34087b){var _0x3c6f73=function(_0x57b889){while(--_0x57b889){_0xb165dd['push'](_0xb165dd['shift']());}};_0x3c6f73(++_0x34087b);}(_0x5232,0xc0));var _0x2523=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0x5232[_0x209fcd];return _0x501d5e;};'use strict';var multer=require(_0x2523('0x0'));var util=require(_0x2523('0x1'));var path=require(_0x2523('0x2'));var timeout=require(_0x2523('0x3'));var express=require(_0x2523('0x4'));var router=express[_0x2523('0x5')]();var fs_extra=require(_0x2523('0x6'));var auth=require(_0x2523('0x7'));var interaction=require(_0x2523('0x8'));var config=require('../../config/environment');var controller=require(_0x2523('0x9'));router[_0x2523('0xa')]('/',auth[_0x2523('0xb')](),controller[_0x2523('0xc')]);router['get'](_0x2523('0xd'),auth['isAuthenticated'](),controller[_0x2523('0xe')]);router['get'](_0x2523('0xf'),auth[_0x2523('0xb')](),controller['show']);router[_0x2523('0xa')](_0x2523('0x10'),auth[_0x2523('0xb')](),controller[_0x2523('0x11')]);router[_0x2523('0x12')]('/',auth[_0x2523('0xb')](),controller[_0x2523('0x13')]);router[_0x2523('0x12')]('/:id/contacts',auth[_0x2523('0xb')](),controller[_0x2523('0x14')]);router[_0x2523('0x15')](_0x2523('0xf'),auth['isAuthenticated'](),controller[_0x2523('0x16')]);router[_0x2523('0x17')](_0x2523('0xf'),auth[_0x2523('0xb')](),controller[_0x2523('0x18')]);module[_0x2523('0x19')]=router; \ No newline at end of file +var _0x9ea6=['post','create','addContacts','delete','/:id','destroy','exports','multer','util','Router','fs-extra','./cmCompany.controller','index','/describe','describe','get','isAuthenticated','show','/:id/contacts','getContacts'];(function(_0x3fbdf0,_0x420bca){var _0x22501b=function(_0x40b327){while(--_0x40b327){_0x3fbdf0['push'](_0x3fbdf0['shift']());}};_0x22501b(++_0x420bca);}(_0x9ea6,0x15b));var _0x69ea=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9ea6[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0x69ea('0x0'));var util=require(_0x69ea('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x69ea('0x2')]();var fs_extra=require(_0x69ea('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x69ea('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x69ea('0x5')]);router['get'](_0x69ea('0x6'),auth['isAuthenticated'](),controller[_0x69ea('0x7')]);router[_0x69ea('0x8')]('/:id',auth[_0x69ea('0x9')](),controller[_0x69ea('0xa')]);router[_0x69ea('0x8')](_0x69ea('0xb'),auth[_0x69ea('0x9')](),controller[_0x69ea('0xc')]);router[_0x69ea('0xd')]('/',auth['isAuthenticated'](),controller[_0x69ea('0xe')]);router[_0x69ea('0xd')]('/:id/contacts',auth[_0x69ea('0x9')](),controller[_0x69ea('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x69ea('0x10')](_0x69ea('0x11'),auth[_0x69ea('0x9')](),controller[_0x69ea('0x12')]);module[_0x69ea('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 01d2cc0..56aa848 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 _0x8d90=['TEXT','INTEGER','UNSIGNED','lodash','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8d90,0x141));var _0x08d9=function(_0x208e36,_0x21ef62){_0x208e36=_0x208e36-0x0;var _0x102757=_0x8d90[_0x208e36];return _0x102757;};'use strict';var _=require(_0x08d9('0x0'));var Sequelize=require('sequelize');module[_0x08d9('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x08d9('0x2')]},'street':{'type':Sequelize[_0x08d9('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x08d9('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x08d9('0x3')]},'phone':{'type':Sequelize[_0x08d9('0x2')]},'mobile':{'type':Sequelize[_0x08d9('0x2')]},'fax':{'type':Sequelize[_0x08d9('0x2')]},'email':{'type':Sequelize[_0x08d9('0x2')]},'url':{'type':Sequelize[_0x08d9('0x2')]},'facebook':{'type':Sequelize[_0x08d9('0x2')]},'fb_data':{'type':Sequelize[_0x08d9('0x2')]},'twitter':{'type':Sequelize[_0x08d9('0x2')]},'skype':{'type':Sequelize[_0x08d9('0x2')]},'teams':{'type':Sequelize[_0x08d9('0x2')]},'viber':{'type':Sequelize[_0x08d9('0x2')]},'line':{'type':Sequelize[_0x08d9('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x08d9('0x2')]},'UserId':{'type':Sequelize[_0x08d9('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x08d9('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x08d9('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x08d9('0x2')]},'utcOffset':{'type':Sequelize[_0x08d9('0x4')]}}; \ No newline at end of file +var _0x536d=['UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0x536d,0x111));var _0xd536=function(_0x2aa4b2,_0x569a93){_0x2aa4b2=_0x2aa4b2-0x0;var _0x5301ae=_0x536d[_0x2aa4b2];return _0x5301ae;};'use strict';var _=require(_0xd536('0x0'));var Sequelize=require(_0xd536('0x1'));module[_0xd536('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xd536('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xd536('0x3')]},'city':{'type':Sequelize[_0xd536('0x3')]},'country':{'type':Sequelize[_0xd536('0x3')]},'dateOfBirth':{'type':Sequelize[_0xd536('0x3')]},'description':{'type':Sequelize[_0xd536('0x4')]},'phone':{'type':Sequelize[_0xd536('0x3')]},'mobile':{'type':Sequelize[_0xd536('0x3')]},'fax':{'type':Sequelize[_0xd536('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xd536('0x3')]},'facebook':{'type':Sequelize[_0xd536('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xd536('0x3')]},'skype':{'type':Sequelize[_0xd536('0x3')]},'teams':{'type':Sequelize[_0xd536('0x3')]},'viber':{'type':Sequelize[_0xd536('0x3')]},'line':{'type':Sequelize[_0xd536('0x3')]},'wechat':{'type':Sequelize[_0xd536('0x3')]},'telegram':{'type':Sequelize[_0xd536('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xd536('0x3')]},'priority':{'type':Sequelize[_0xd536('0x5')](0x2)[_0xd536('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xd536('0x7')],'defaultValue':Sequelize[_0xd536('0x8')]},'dialTimezone':{'type':Sequelize['STRING']},'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 c97eee8..aa3296e 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 _0x8ca9=['MailInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','dialTimezone','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','hasOwnProperty','contact','all','Tag','Tags','color','tag','Phones','ContactItemType','sequelize','literal','$and','omit','map','format','isNil','timezones','pickBy','cf_%d','isEmpty','table','cm_contacts','setFields','toParam','text','phone','getTags','findOne','rawAttributes','filters','intersection','model','attributes','order','sort','pick','filter','options','nolimit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','item','ItemType','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','`ItemType`.OrderBy','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','fields','ContactId','includeAll','include','rows','getHopperHistories','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','filename','chmodSync','0777','child_process','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','upload','parse','meta','User','agent','binding','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','../../components/import/cm/csvUpdates','getJourney','mail','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','Invalid\x20channel','range','uniqueid','type','source','destination','callerid','starttime','note','createdAt','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','VoiceCallReport','findAndCountAll','startCase','chat','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','browserName','customerIp','osName','ratingMessage','ratingType','ratingValue','referer','subject','externalUrl','Interaction','Owner','sortBy','reverse','slice','moment','util','path','squel','papaparse','ioredis','../../components/contacts','api','../../config/environment/shared','defaults','socket.io-emitter','redis','./cmContact.socket','status','offset','undefined','limit','count','Content-Range','json','update','then','destroy','error','stack','name','send','index','describe','findAll','query','user','CmContact','find','params','catch','keys','length','startsWith','cf_','columnName','CmCustomField','alias','custom','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','merge','body','from','get','mergeWith','isArray','tags','join','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage'];(function(_0x1feb2d,_0x3cdb25){var _0x3d27b7=function(_0xf37cd1){while(--_0xf37cd1){_0x1feb2d['push'](_0x1feb2d['shift']());}};_0x3d27b7(++_0x3cdb25);}(_0x8ca9,0x1a1));var _0x98ca=function(_0x24b948,_0x1b2ddc){_0x24b948=_0x24b948-0x0;var _0x2d38ec=_0x8ca9[_0x24b948];return _0x2d38ec;};'use strict';var moment=require(_0x98ca('0x0'));var BPromise=require('bluebird');var util=require(_0x98ca('0x1'));var path=require(_0x98ca('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x98ca('0x3'));var Papa=require(_0x98ca('0x4'));var Redis=require(_0x98ca('0x5'));var contacts=require(_0x98ca('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x98ca('0x7'));var config=require('../../config/environment');var shared=require(_0x98ca('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x98ca('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x98ca('0xa'))(new Redis(config[_0x98ca('0xb')]));require(_0x98ca('0xc'))['register'](socket);function respondWithResult(_0x499956,_0x43f7c0){_0x43f7c0=_0x43f7c0||0xc8;return function(_0x493431){if(_0x493431){return _0x499956[_0x98ca('0xd')](_0x43f7c0)['json'](_0x493431);}};}function respondWithFilteredResult(_0x5172a0,_0x2fb0ea){return function(_0x1f4df3){if(_0x1f4df3){var _0x45d6cb=typeof _0x2fb0ea[_0x98ca('0xe')]===_0x98ca('0xf')&&typeof _0x2fb0ea[_0x98ca('0x10')]===_0x98ca('0xf');var _0x39eff1=_0x1f4df3[_0x98ca('0x11')];var _0x3014c6=_0x45d6cb?0x0:_0x2fb0ea[_0x98ca('0xe')];var _0xc2bc01=_0x45d6cb?_0x1f4df3['count']:_0x2fb0ea[_0x98ca('0xe')]+_0x2fb0ea['limit'];var _0x149e9e;if(_0xc2bc01>=_0x39eff1){_0xc2bc01=_0x39eff1;_0x149e9e=0xc8;}else{_0x149e9e=0xce;}_0x5172a0[_0x98ca('0xd')](_0x149e9e);return _0x5172a0['set'](_0x98ca('0x12'),_0x3014c6+'-'+_0xc2bc01+'/'+_0x39eff1)[_0x98ca('0x13')](_0x1f4df3);}return null;};}function saveUpdates(_0xa92d5){return function(_0x1b43cc){if(_0x1b43cc){return _0x1b43cc[_0x98ca('0x14')](_0xa92d5)[_0x98ca('0x15')](function(_0x1a23db){return _0x1a23db;});}return null;};}function removeEntity(_0xa1a3eb){return function(_0x4d31db){if(_0x4d31db){return _0x4d31db[_0x98ca('0x16')]()[_0x98ca('0x15')](function(){_0xa1a3eb[_0x98ca('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ae4f9){return function(_0x49ec61){if(!_0x49ec61){_0x3ae4f9['sendStatus'](0x194);}return _0x49ec61;};}function handleError(_0x290ade,_0x305548){_0x305548=_0x305548||0x1f4;return function(_0x22c6c0){logger[_0x98ca('0x17')](_0x22c6c0[_0x98ca('0x18')]);if(_0x22c6c0[_0x98ca('0x19')]){delete _0x22c6c0['name'];}_0x290ade[_0x98ca('0xd')](_0x305548)[_0x98ca('0x1a')](_0x22c6c0);};}exports[_0x98ca('0x1b')]=function(_0x4bac1c,_0x4d60fc){var _0x218ae5={};return contacts[_0x98ca('0x1c')]()['then'](function(_0x13157c){_0x218ae5=qs['getOptions'](_0x13157c,_0x4bac1c);return contacts[_0x98ca('0x1d')](_0x4bac1c[_0x98ca('0x1e')],_0x4bac1c[_0x98ca('0x1f')],_0x218ae5,_0x13157c);})[_0x98ca('0x15')](respondWithFilteredResult(_0x4d60fc,_0x218ae5))['catch'](handleError(_0x4d60fc,null));};exports[_0x98ca('0x16')]=function(_0x54645e,_0x496773){return db[_0x98ca('0x20')][_0x98ca('0x21')]({'where':{'id':_0x54645e[_0x98ca('0x22')]['id']}})['then'](handleEntityNotFound(_0x496773,null))[_0x98ca('0x15')](removeEntity(_0x496773,null))[_0x98ca('0x23')](handleError(_0x496773,null));};exports[_0x98ca('0x1c')]=function(_0x19cad1,_0x3d6da9){return db[_0x98ca('0x20')]['describe']()['then'](function(_0x28041e){delete _0x28041e['tags'];for(var _0x2634db=0x0;_0x2634db0x0){return new Promise(function(_0x74c324){var _0x3a3071=[];for(var _0xf7bba9=0x0;_0xf7bba9<_0x551b29[_0x98ca('0x25')];_0xf7bba9++){_0x3a3071[_0x98ca('0x54')](insertAdditionalPhones(_0x551b29[_0xf7bba9][_0x98ca('0x59')],_0x551b29[_0xf7bba9]['additionalPhones']));}Promise[_0x98ca('0x5a')](_0x3a3071)[_0x98ca('0x15')](function(){_0x74c324(0x1);});})['then'](function(){return{'success':_0x11b5d0,'failure':_0x1c069b,'duplicates':_0x18fca2};});}else{return{'success':_0x11b5d0,'failure':_0x1c069b,'duplicates':_0x18fca2};}}})[_0x98ca('0x15')](respondWithResult(_0x12da28,0xc9))[_0x98ca('0x23')](handleError(_0x12da28,null));};exports['show']=function(_0x1ea24a,_0x3ca003){var _0x1cc627;return db[_0x98ca('0x20')][_0x98ca('0x1c')]()[_0x98ca('0x15')](function(_0x27bf2c){return db[_0x98ca('0x20')]['find']({'where':{'id':_0x1ea24a[_0x98ca('0x22')]['id']},'include':[{'model':db[_0x98ca('0x5b')],'as':_0x98ca('0x5c'),'attributes':['id',_0x98ca('0x19'),_0x98ca('0x5d')],'required':_0x1ea24a[_0x98ca('0x1e')][_0x98ca('0x5e')]?!![]:![]},{'model':db[_0x98ca('0x43')],'as':_0x98ca('0x5f'),'where':{'CmContactId':_0x1ea24a[_0x98ca('0x22')]['id']},'required':![],'include':[{'model':db[_0x98ca('0x60')],'as':'ItemType'}]}],'order':[db[_0x98ca('0x61')][_0x98ca('0x62')]('Phones.OrderBy')],'attributes':_[_0x98ca('0x24')](_0x27bf2c)});})[_0x98ca('0x15')](function(_0x55563b){if(!_['isNil'](_0x55563b)){_0x1cc627=_0x55563b[_0x98ca('0x33')]({'plain':!![]});var _0x28fc8f={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x55563b&&_0x55563b[_0x98ca('0x55')]){if(_0x55563b[_0x98ca('0x55')]){_0x28fc8f[_0x98ca('0x52')][_0x98ca('0x63')][_0x98ca('0x54')]({'ListId':{'$ne':_0x55563b[_0x98ca('0x55')]}});}}return db[_0x98ca('0x29')][_0x98ca('0x1d')](_0x28fc8f);}})[_0x98ca('0x15')](function(_0xd755df){if(!_['isNil'](_0xd755df)){return _[_0x98ca('0x64')](_0x1cc627,_[_0x98ca('0x65')](_0xd755df,function(_0x126fa4){return util[_0x98ca('0x66')]('cf_%d',_0x126fa4['id']);}));}})[_0x98ca('0x15')](handleEntityNotFound(_0x3ca003,null))[_0x98ca('0x15')](respondWithResult(_0x3ca003,null))['catch'](handleError(_0x3ca003,null));};exports[_0x98ca('0x14')]=function(_0x14c945,_0x32c75f){var _0x4398f1;if(_0x14c945['body']['id']){delete _0x14c945[_0x98ca('0x31')]['id'];}if(!_[_0x98ca('0x67')](_0x14c945[_0x98ca('0x31')][_0x98ca('0x4d')])){var _0x4c2308=_0x14c945[_0x98ca('0x31')]['dialTimezone'];if(!_['isNil'](shared['timezones'][_0x4c2308]))_0x14c945[_0x98ca('0x31')]['utcOffset']=shared[_0x98ca('0x68')][_0x4c2308][_0x98ca('0x4e')];}return db[_0x98ca('0x20')][_0x98ca('0x21')]({'where':{'id':_0x14c945[_0x98ca('0x22')]['id']}})[_0x98ca('0x15')](handleEntityNotFound(_0x32c75f,null))[_0x98ca('0x15')](saveUpdates(_0x14c945['body'],null))[_0x98ca('0x15')](function(_0x1a2f4f){_0x4398f1=_0x1a2f4f;var _0x25db60={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1a2f4f&&_0x1a2f4f[_0x98ca('0x55')]){if(_0x1a2f4f[_0x98ca('0x55')]){_0x25db60[_0x98ca('0x52')][_0x98ca('0x63')][_0x98ca('0x54')]({'ListId':{'$ne':_0x1a2f4f[_0x98ca('0x55')]}});}}return db[_0x98ca('0x29')][_0x98ca('0x1d')](_0x25db60);})[_0x98ca('0x15')](function(_0x2af521){if(_0x2af521){return _['omit'](_[_0x98ca('0x69')](_0x14c945[_0x98ca('0x31')],function(_0x558177,_0x47b6e3){return _[_0x98ca('0x26')](_0x47b6e3,_0x98ca('0x27'));}),_[_0x98ca('0x65')](_0x2af521,function(_0x248e81){return util[_0x98ca('0x66')](_0x98ca('0x6a'),_0x248e81['id']);}));}})[_0x98ca('0x15')](function(_0x46cd47){if(_0x46cd47&&!_[_0x98ca('0x6b')](_0x46cd47)){var _0x248d16=squel[_0x98ca('0x14')]()[_0x98ca('0x6c')](_0x98ca('0x6d'))[_0x98ca('0x6e')](_0x46cd47)[_0x98ca('0x52')]('id\x20=\x20?',_0x14c945['params']['id'])[_0x98ca('0x6f')]();return db['sequelize'][_0x98ca('0x1e')](_0x248d16[_0x98ca('0x70')],{'replacements':_0x248d16[_0x98ca('0x2c')]});}})['then'](function(){if(_0x14c945[_0x98ca('0x31')][_0x98ca('0x71')]&&_0x4398f1){return db['CmHopper'][_0x98ca('0x14')]({'phone':_0x14c945['body'][_0x98ca('0x71')],'OrderBy':0x0},{'where':{'ContactId':_0x4398f1['id']}});}})['then'](function(){return _0x4398f1;})[_0x98ca('0x15')](respondWithResult(_0x32c75f,null))[_0x98ca('0x23')](handleError(_0x32c75f,null));};exports[_0x98ca('0x72')]=function(_0x187b70,_0x54b554){var _0x1b7c61={};var _0x4b2509={};var _0x65ebfe;var _0x22cf70;return db[_0x98ca('0x20')][_0x98ca('0x73')]({'where':{'id':_0x187b70['params']['id']}})[_0x98ca('0x15')](handleEntityNotFound(_0x54b554,null))[_0x98ca('0x15')](function(_0x6138bc){if(_0x6138bc){_0x65ebfe=_0x6138bc;_0x4b2509['model']=_['keys'](db['Tag'][_0x98ca('0x74')]);_0x4b2509[_0x98ca('0x1e')]=_[_0x98ca('0x24')](_0x187b70['query']);_0x4b2509[_0x98ca('0x75')]=_[_0x98ca('0x76')](_0x4b2509[_0x98ca('0x77')],_0x4b2509[_0x98ca('0x1e')]);_0x1b7c61[_0x98ca('0x78')]=_[_0x98ca('0x76')](_0x4b2509[_0x98ca('0x77')],qs['fields'](_0x187b70['query']['fields']));_0x1b7c61[_0x98ca('0x78')]=_0x1b7c61[_0x98ca('0x78')][_0x98ca('0x25')]?_0x1b7c61['attributes']:_0x4b2509['model'];_0x1b7c61[_0x98ca('0x79')]=qs['sort'](_0x187b70[_0x98ca('0x1e')][_0x98ca('0x7a')]);_0x1b7c61[_0x98ca('0x52')]=qs['filters'](_[_0x98ca('0x7b')](_0x187b70['query'],_0x4b2509[_0x98ca('0x75')]));if(_0x187b70[_0x98ca('0x1e')][_0x98ca('0x7c')]){_0x1b7c61[_0x98ca('0x52')]=_[_0x98ca('0x30')](_0x1b7c61[_0x98ca('0x52')],{'$or':_[_0x98ca('0x65')](_0x1b7c61[_0x98ca('0x78')],function(_0x5dff70){var _0x251f3e={};_0x251f3e[_0x5dff70]={'$like':'%'+_0x187b70[_0x98ca('0x1e')][_0x98ca('0x7c')]+'%'};return _0x251f3e;})});}_0x1b7c61=_[_0x98ca('0x30')]({},_0x1b7c61,_0x187b70[_0x98ca('0x7d')]);return _0x65ebfe[_0x98ca('0x72')](_0x1b7c61);}})[_0x98ca('0x15')](function(_0x1e1684){if(_0x1e1684){_0x22cf70=_0x1e1684['length'];if(!_0x187b70[_0x98ca('0x1e')]['hasOwnProperty'](_0x98ca('0x7e'))){_0x1b7c61[_0x98ca('0x10')]=qs['limit'](_0x187b70[_0x98ca('0x1e')][_0x98ca('0x10')]);_0x1b7c61[_0x98ca('0xe')]=qs[_0x98ca('0xe')](_0x187b70[_0x98ca('0x1e')][_0x98ca('0xe')]);}return _0x65ebfe[_0x98ca('0x72')](_0x1b7c61);}})[_0x98ca('0x15')](function(_0x509991){if(_0x509991){return _0x509991?{'count':_0x22cf70,'rows':_0x509991}:null;}})[_0x98ca('0x15')](respondWithResult(_0x54b554,null))[_0x98ca('0x23')](handleError(_0x54b554,null));};exports[_0x98ca('0x7f')]=function(_0x533c3b,_0x13bd96){if(_0x533c3b[_0x98ca('0x31')]['id']){delete _0x533c3b[_0x98ca('0x31')]['id'];}return db['CmContact'][_0x98ca('0x73')]({'where':{'id':_0x533c3b[_0x98ca('0x22')]['id']}})['then'](handleEntityNotFound(_0x13bd96,null))[_0x98ca('0x15')](function(_0x4f3fb4){if(_0x4f3fb4){return _0x4f3fb4[_0x98ca('0x7f')](_0x533c3b[_0x98ca('0x31')][_0x98ca('0x80')]||[]);}return null;})[_0x98ca('0x15')](respondWithResult(_0x13bd96,null))[_0x98ca('0x23')](handleError(_0x13bd96,null));};exports[_0x98ca('0x81')]=function(_0x18b292,_0x3f6553){var _0x2c54b0=[];_0x2c54b0['push'](addAdditionalPhones(_0x18b292[_0x98ca('0x31')]));Promise[_0x98ca('0x5a')](_0x2c54b0)[_0x98ca('0x15')](function(){_0x2c54b0=[];_0x2c54b0[_0x98ca('0x54')](deleteCmHopperPhones(_0x18b292[_0x98ca('0x31')]['id']));_0x2c54b0[_0x98ca('0x54')](addCmHopperPhones(_0x18b292['body']['id']));Promise[_0x98ca('0x5a')](_0x2c54b0)[_0x98ca('0x15')](function(){return[0x1];})[_0x98ca('0x15')](respondWithResult(_0x3f6553,null));});};function addAdditionalPhones(_0x379b11){var _0x4d7d13;return new Promise(function(_0x4b64e7){return db[_0x98ca('0x43')][_0x98ca('0x16')]({'where':{'CmContactId':_0x379b11['id']}})[_0x98ca('0x15')](function(){db['ContactItemType'][_0x98ca('0x1d')]({'raw':!![],'attributes':['id',_0x98ca('0x82')]})[_0x98ca('0x15')](function(_0xb0ec41){var _0x5649d1=[];for(var _0x1946d3=0x0;_0x1946d3<_0x379b11[_0x98ca('0x83')][_0x98ca('0x25')];_0x1946d3++){var _0x5322f1=_0x379b11[_0x98ca('0x84')]?_[_0x98ca('0x67')](_0x379b11[_0x98ca('0x84')][_0x1946d3])?'':_0x379b11[_0x98ca('0x84')][_0x1946d3]:_0x379b11[_0x98ca('0x83')][_0x1946d3]['ItemTypeId']?_0x379b11['items'][_0x1946d3][_0x98ca('0x85')]:'';var _0x2a856c=_[_0x98ca('0x67')](_0x379b11[_0x98ca('0x83')][_0x1946d3][_0x98ca('0x86')])?'':_0x379b11[_0x98ca('0x83')][_0x1946d3][_0x98ca('0x86')];var _0x508453=_0x5322f1+':'+_0x379b11['items'][_0x1946d3][_0x98ca('0x71')]+'§'+_0x2a856c;if(_[_0x98ca('0x67')](_0x4d7d13))_0x4d7d13=_0x508453;else _0x4d7d13+=';'+_0x508453;var _0x216700=null;var _0x199479=null;if(_0x379b11['item_types']){if(!_[_0x98ca('0x67')](_0x379b11[_0x98ca('0x84')][_0x1946d3])){_0x199479=_['find'](_0xb0ec41,function(_0x22b3b9){return _0x22b3b9['id']===_0x379b11[_0x98ca('0x84')][_0x1946d3];});if(!_[_0x98ca('0x67')](_0x199479)){_0x216700=_0x199479[_0x98ca('0x82')];}}}else{if(!_[_0x98ca('0x67')](_0x379b11['items'][_0x1946d3])){_0x199479=_[_0x98ca('0x21')](_0xb0ec41,function(_0x357aa2){return _0x357aa2['id']===_0x379b11['items'][_0x1946d3][_0x98ca('0x85')];});if(!_[_0x98ca('0x67')](_0x199479)){_0x216700=_0x1946d3;}}}if(_[_0x98ca('0x67')](_0x216700)){_0x216700=0x64;}_0x5649d1[_0x98ca('0x54')](addAdditionalPhone(_0x379b11['id'],_0x379b11[_0x98ca('0x83')][_0x1946d3][_0x98ca('0x71')],_0x379b11[_0x98ca('0x84')]?_[_0x98ca('0x67')](_0x379b11[_0x98ca('0x84')][_0x1946d3])?null:_0x379b11['item_types'][_0x1946d3]:_0x379b11[_0x98ca('0x83')][_0x1946d3][_0x98ca('0x85')]?_0x379b11[_0x98ca('0x83')][_0x1946d3]['ItemTypeId']:null,_0x216700,_0x2a856c));}Promise[_0x98ca('0x5a')](_0x5649d1)[_0x98ca('0x15')](function(){db[_0x98ca('0x20')][_0x98ca('0x14')]({'AdditionalPhones':_0x4d7d13},{'where':{'id':_0x379b11['id']}})[_0x98ca('0x15')](function(){_0x4b64e7(0x1);});});});});});}function addAdditionalPhone(_0xa6f080,_0x95dace,_0x5c5609,_0x2346e8,_0x2c8dca){return db[_0x98ca('0x43')][_0x98ca('0x21')]({'where':{'CmContactId':_0xa6f080,'item':_0x95dace}})['then'](function(_0x26ba23){if(_0x26ba23)logger[_0x98ca('0x2d')](_0x98ca('0x87'),_0x26ba23);else{db['CmContactHasItem'][_0x98ca('0x3a')]({'CmContactId':_0xa6f080,'item':_0x95dace,'ItemTypeId':_0x5c5609,'OrderBy':_0x2346e8,'ItemClass':_0x98ca('0x88'),'description':_0x2c8dca});}});}function deleteCmHopperPhones(_0x6ca2b8){return new Promise(function(_0x23f50b){return db[_0x98ca('0x38')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x6ca2b8}})[_0x98ca('0x15')](function(_0x3c4174){db['CmHopperAdditionalPhone'][_0x98ca('0x16')]({'where':{'CmHopperId':{'$in':_[_0x98ca('0x65')](_0x3c4174,'id')}}});})[_0x98ca('0x15')](function(){_0x23f50b(0x1);});});}function addCmHopperPhones(_0x2b7e48){return new Promise(function(_0x92ffd){return db[_0x98ca('0x38')][_0x98ca('0x1d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2b7e48}})['then'](function(_0x5284e3){var _0x3fa93c=[];_[_0x98ca('0x65')](_0x5284e3,function(_0x441eb4){_0x3fa93c[_0x98ca('0x54')](createCmHopperPhone(_0x2b7e48,_0x441eb4['id']));});Promise[_0x98ca('0x5a')](_0x3fa93c)['then'](function(){_0x92ffd(0x1);});});});}function createCmHopperPhone(_0x1f905c,_0x62288){return new Promise(function(_0x295579){db['CmContactHasItem'][_0x98ca('0x1d')]({'raw':!![],'attributes':[_0x98ca('0x89'),_0x98ca('0x82')],'where':{'CmContactId':_0x1f905c,'ItemClass':_0x98ca('0x88')},'include':[{'model':db['ContactItemType'],'attributes':[_0x98ca('0x82')],'as':_0x98ca('0x8a')}],'order':[_0x98ca('0x82'),db[_0x98ca('0x61')]['literal']('`ItemType`.OrderBy')]})[_0x98ca('0x15')](function(_0x50699b){var _0x5e5cd2=0x1;var _0x54f70b=_['map'](_0x50699b,function(_0x2b04c8){_0x2b04c8[_0x98ca('0x8b')]=_0x62288;_0x2b04c8[_0x98ca('0x71')]=_0x2b04c8[_0x98ca('0x89')];_0x2b04c8[_0x98ca('0x82')]=_0x5e5cd2;delete _0x2b04c8[_0x98ca('0x8c')];_0x5e5cd2=_0x5e5cd2+0x1;return _0x2b04c8;});return db[_0x98ca('0x8d')]['bulkCreate'](_0x54f70b,{});})[_0x98ca('0x15')](function(){_0x295579(0x1);});});}function insertAdditionalPhones(_0x1a6bdd,_0xdb5df8){return new Promise(function(_0x491793){var _0x25ef92=[];for(var _0x7cf6e5=0x0;_0x7cf6e5<_0xdb5df8[_0x98ca('0x25')];_0x7cf6e5++){var _0xf3bd5=_0xdb5df8[_0x7cf6e5];_0x25ef92[_0x98ca('0x54')](parseContactItemType(_0xf3bd5));}Promise[_0x98ca('0x5a')](_0x25ef92)['then'](function(){var _0x3c5b5d={'id':_0x1a6bdd['id'],'items':_0xdb5df8};return addAdditionalPhones(_0x3c5b5d)['then'](function(){return addCmHopperPhones(_0x1a6bdd['id']);});})[_0x98ca('0x15')](function(){_0x491793(_0x1a6bdd);});});}function parseContactItemType(_0x18d8e5){return new Promise(function(_0x2c1794){if(_0x18d8e5[_0x98ca('0x58')](_0x98ca('0x85'))){_0x2c1794(_0x18d8e5);}else{return db[_0x98ca('0x60')]['find']({'where':{'name':_0x18d8e5['ItemType']}})[_0x98ca('0x15')](function(_0x56f3d1){if(_[_0x98ca('0x67')](_0x56f3d1))_0x18d8e5[_0x98ca('0x85')]=null;else _0x18d8e5['ItemTypeId']=_0x56f3d1['id'];_0x2c1794(_0x18d8e5);});}});}exports['getAdditionalPhones']=function(_0x5b4f0b,_0x1835a9){return db[_0x98ca('0x43')]['findAll']({'raw':!![],'where':{'CmContactId':_0x5b4f0b[_0x98ca('0x22')]['id'],'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'as':'ItemType'}],'order':[[_0x98ca('0x82')],[db[_0x98ca('0x61')][_0x98ca('0x62')](_0x98ca('0x8e'))]]})['then'](function(_0x4cbeff){return _0x4cbeff;})['then'](respondWithResult(_0x1835a9,null))[_0x98ca('0x23')](handleError(_0x1835a9,null));};exports[_0x98ca('0x8f')]=function(_0x3e172d,_0xc19867){return db[_0x98ca('0x43')][_0x98ca('0x1d')]({'raw':!![],'where':{'CmContactId':_0x3e172d[_0x98ca('0x31')]['fromContactId']}})[_0x98ca('0x15')](function(_0x7bfa69){var _0x1f7997=_[_0x98ca('0x65')](_0x7bfa69,function(_0xc0a3f8){_0xc0a3f8[_0x98ca('0x90')]=_0x3e172d[_0x98ca('0x31')][_0x98ca('0x91')];return _0xc0a3f8;});return db[_0x98ca('0x43')][_0x98ca('0x50')](_0x1f7997,{});})['then'](function(){return addCmHopperPhones(_0x3e172d[_0x98ca('0x31')][_0x98ca('0x91')]);})['then'](function(){return['ok'];})['then'](respondWithResult(_0xc19867,null))['catch'](handleError(_0xc19867,null));};exports[_0x98ca('0x92')]=function(_0x4a66e8,_0x238111){var _0x2dfbf8=[];_0x2dfbf8['push'](createCmHopperPhone(_0x4a66e8[_0x98ca('0x31')]['id'],_0x4a66e8[_0x98ca('0x31')][_0x98ca('0x93')]));Promise[_0x98ca('0x5a')](_0x2dfbf8)['then'](function(){return[0x1];})[_0x98ca('0x15')](respondWithResult(_0x238111,null));};exports[_0x98ca('0x94')]=function(_0x1d1595,_0x330e39){var _0x3b43dc={'raw':![],'where':{}};var _0x4005d7={};var _0x532678={'count':0x0,'rows':[]};return db[_0x98ca('0x20')][_0x98ca('0x73')]({'where':{'id':_0x1d1595[_0x98ca('0x22')]['id']}})[_0x98ca('0x15')](handleEntityNotFound(_0x330e39,null))[_0x98ca('0x15')](function(_0x549228){if(_0x549228){_0x4005d7[_0x98ca('0x77')]=_[_0x98ca('0x24')](db['CmHopper'][_0x98ca('0x74')]);_0x4005d7[_0x98ca('0x1e')]=_[_0x98ca('0x24')](_0x1d1595[_0x98ca('0x1e')]);_0x4005d7[_0x98ca('0x75')]=_[_0x98ca('0x76')](_0x4005d7[_0x98ca('0x77')],_0x4005d7[_0x98ca('0x1e')]);_0x3b43dc[_0x98ca('0x78')]=_[_0x98ca('0x76')](_0x4005d7[_0x98ca('0x77')],qs[_0x98ca('0x95')](_0x1d1595[_0x98ca('0x1e')]['fields']));_0x3b43dc[_0x98ca('0x78')]=_0x3b43dc[_0x98ca('0x78')][_0x98ca('0x25')]?_0x3b43dc['attributes']:_0x4005d7[_0x98ca('0x77')];if(!_0x1d1595[_0x98ca('0x1e')]['hasOwnProperty']('nolimit')){_0x3b43dc[_0x98ca('0x10')]=qs[_0x98ca('0x10')](_0x1d1595[_0x98ca('0x1e')]['limit']);_0x3b43dc[_0x98ca('0xe')]=qs[_0x98ca('0xe')](_0x1d1595['query'][_0x98ca('0xe')]);}_0x3b43dc['order']=qs[_0x98ca('0x7a')](_0x1d1595[_0x98ca('0x1e')]['sort']);_0x3b43dc['where']=qs['filters'](_[_0x98ca('0x7b')](_0x1d1595['query'],_0x4005d7['filters']));_0x3b43dc[_0x98ca('0x52')][_0x98ca('0x96')]=_0x549228['id'];if(_0x1d1595[_0x98ca('0x1e')][_0x98ca('0x7c')]){_0x3b43dc[_0x98ca('0x52')]=_['merge'](_0x3b43dc[_0x98ca('0x52')],{'$or':_[_0x98ca('0x65')](_0x3b43dc[_0x98ca('0x78')],function(_0x5bfae3){var _0x2bb518={};_0x2bb518[_0x5bfae3]={'$like':'%'+_0x1d1595[_0x98ca('0x1e')][_0x98ca('0x7c')]+'%'};return _0x2bb518;})});}_0x3b43dc=_[_0x98ca('0x30')]({},_0x3b43dc,_0x1d1595[_0x98ca('0x7d')]);return db[_0x98ca('0x38')][_0x98ca('0x11')]({'where':_0x3b43dc[_0x98ca('0x52')]})[_0x98ca('0x15')](function(_0x21a442){_0x532678['count']=_0x21a442;if(_0x1d1595[_0x98ca('0x1e')][_0x98ca('0x97')]){_0x3b43dc[_0x98ca('0x98')]=[{'all':!![]}];}return db[_0x98ca('0x38')][_0x98ca('0x1d')](_0x3b43dc);})[_0x98ca('0x15')](function(_0x505248){_0x532678[_0x98ca('0x99')]=_0x505248;return _0x532678;});}})[_0x98ca('0x15')](respondWithFilteredResult(_0x330e39,_0x3b43dc))[_0x98ca('0x23')](handleError(_0x330e39,null));};exports[_0x98ca('0x9a')]=function(_0x41232b,_0x3256ba){var _0x439a54={'raw':!![],'where':{}};var _0x107eb5={};var _0x3886ca={'count':0x0,'rows':[]};return db[_0x98ca('0x20')][_0x98ca('0x73')]({'where':{'id':_0x41232b[_0x98ca('0x22')]['id']}})[_0x98ca('0x15')](handleEntityNotFound(_0x3256ba,null))[_0x98ca('0x15')](function(_0x4eda69){if(_0x4eda69){_0x107eb5['model']=_[_0x98ca('0x24')](db['CmHopperHistory'][_0x98ca('0x74')]);_0x107eb5[_0x98ca('0x1e')]=_[_0x98ca('0x24')](_0x41232b['query']);_0x107eb5[_0x98ca('0x75')]=_[_0x98ca('0x76')](_0x107eb5['model'],_0x107eb5[_0x98ca('0x1e')]);_0x439a54[_0x98ca('0x78')]=_['intersection'](_0x107eb5[_0x98ca('0x77')],qs[_0x98ca('0x95')](_0x41232b['query'][_0x98ca('0x95')]));_0x439a54[_0x98ca('0x78')]=_0x439a54[_0x98ca('0x78')][_0x98ca('0x25')]?_0x439a54[_0x98ca('0x78')]:_0x107eb5[_0x98ca('0x77')];if(!_0x41232b[_0x98ca('0x1e')]['hasOwnProperty'](_0x98ca('0x7e'))){_0x439a54[_0x98ca('0x10')]=qs[_0x98ca('0x10')](_0x41232b[_0x98ca('0x1e')][_0x98ca('0x10')]);_0x439a54[_0x98ca('0xe')]=qs['offset'](_0x41232b[_0x98ca('0x1e')][_0x98ca('0xe')]);}_0x439a54[_0x98ca('0x79')]=qs['sort'](_0x41232b['query'][_0x98ca('0x7a')]);_0x439a54[_0x98ca('0x52')]=qs[_0x98ca('0x75')](_[_0x98ca('0x7b')](_0x41232b['query'],_0x107eb5[_0x98ca('0x75')]));_0x439a54[_0x98ca('0x52')][_0x98ca('0x96')]=_0x4eda69['id'];if(_0x41232b['query'][_0x98ca('0x7c')]){_0x439a54['where']=_[_0x98ca('0x30')](_0x439a54['where'],{'$or':_[_0x98ca('0x65')](_0x439a54[_0x98ca('0x78')],function(_0x5befb3){var _0x459749={};_0x459749[_0x5befb3]={'$like':'%'+_0x41232b[_0x98ca('0x1e')][_0x98ca('0x7c')]+'%'};return _0x459749;})});}_0x439a54=_['merge']({},_0x439a54,_0x41232b[_0x98ca('0x7d')]);return db[_0x98ca('0x45')][_0x98ca('0x11')]({'where':_0x439a54[_0x98ca('0x52')]})[_0x98ca('0x15')](function(_0x15e881){_0x3886ca[_0x98ca('0x11')]=_0x15e881;if(_0x41232b[_0x98ca('0x1e')][_0x98ca('0x97')]){_0x439a54['include']=[{'all':!![]}];}return db[_0x98ca('0x45')][_0x98ca('0x1d')](_0x439a54);})[_0x98ca('0x15')](function(_0x2b8e95){_0x3886ca[_0x98ca('0x99')]=_0x2b8e95;return _0x3886ca;});}})['then'](respondWithFilteredResult(_0x3256ba,_0x439a54))[_0x98ca('0x23')](handleError(_0x3256ba,null));};exports['getHopperFinals']=function(_0x554c8c,_0x2e3a3e){var _0x5c076d={'raw':!![],'where':{}};var _0x91c856={};var _0x491089={'count':0x0,'rows':[]};return db[_0x98ca('0x20')][_0x98ca('0x73')]({'where':{'id':_0x554c8c['params']['id']}})[_0x98ca('0x15')](handleEntityNotFound(_0x2e3a3e,null))['then'](function(_0x36e306){if(_0x36e306){_0x91c856['model']=_[_0x98ca('0x24')](db[_0x98ca('0x44')][_0x98ca('0x74')]);_0x91c856['query']=_[_0x98ca('0x24')](_0x554c8c[_0x98ca('0x1e')]);_0x91c856[_0x98ca('0x75')]=_[_0x98ca('0x76')](_0x91c856[_0x98ca('0x77')],_0x91c856['query']);_0x5c076d[_0x98ca('0x78')]=_['intersection'](_0x91c856[_0x98ca('0x77')],qs['fields'](_0x554c8c['query'][_0x98ca('0x95')]));_0x5c076d[_0x98ca('0x78')]=_0x5c076d['attributes'][_0x98ca('0x25')]?_0x5c076d[_0x98ca('0x78')]:_0x91c856[_0x98ca('0x77')];if(!_0x554c8c[_0x98ca('0x1e')]['hasOwnProperty'](_0x98ca('0x7e'))){_0x5c076d[_0x98ca('0x10')]=qs[_0x98ca('0x10')](_0x554c8c[_0x98ca('0x1e')]['limit']);_0x5c076d[_0x98ca('0xe')]=qs['offset'](_0x554c8c[_0x98ca('0x1e')][_0x98ca('0xe')]);}_0x5c076d[_0x98ca('0x79')]=qs[_0x98ca('0x7a')](_0x554c8c[_0x98ca('0x1e')]['sort']);_0x5c076d[_0x98ca('0x52')]=qs[_0x98ca('0x75')](_[_0x98ca('0x7b')](_0x554c8c['query'],_0x91c856[_0x98ca('0x75')]));_0x5c076d[_0x98ca('0x52')][_0x98ca('0x96')]=_0x36e306['id'];if(_0x554c8c[_0x98ca('0x1e')]['filter']){_0x5c076d[_0x98ca('0x52')]=_[_0x98ca('0x30')](_0x5c076d[_0x98ca('0x52')],{'$or':_[_0x98ca('0x65')](_0x5c076d[_0x98ca('0x78')],function(_0x2090e7){var _0x20cd11={};_0x20cd11[_0x2090e7]={'$like':'%'+_0x554c8c[_0x98ca('0x1e')][_0x98ca('0x7c')]+'%'};return _0x20cd11;})});}_0x5c076d=_['merge']({},_0x5c076d,_0x554c8c['options']);return db[_0x98ca('0x44')][_0x98ca('0x11')]({'where':_0x5c076d[_0x98ca('0x52')]})[_0x98ca('0x15')](function(_0x351d74){_0x491089[_0x98ca('0x11')]=_0x351d74;if(_0x554c8c['query'][_0x98ca('0x97')]){_0x5c076d['include']=[{'all':!![]}];}return db[_0x98ca('0x44')][_0x98ca('0x1d')](_0x5c076d);})['then'](function(_0x4fc60){_0x491089[_0x98ca('0x99')]=_0x4fc60;return _0x491089;});}})[_0x98ca('0x15')](respondWithFilteredResult(_0x2e3a3e,_0x5c076d))[_0x98ca('0x23')](handleError(_0x2e3a3e,null));};exports['getJscriptySessions']=function(_0x1d5e2f,_0xce250a){var _0x136b8b={'raw':!![],'where':{}};var _0x520a5b={};var _0x28d826={'count':0x0,'rows':[]};return db[_0x98ca('0x20')][_0x98ca('0x73')]({'where':{'id':_0x1d5e2f[_0x98ca('0x22')]['id']}})[_0x98ca('0x15')](handleEntityNotFound(_0xce250a,null))[_0x98ca('0x15')](function(_0x22f645){if(_0x22f645){_0x520a5b['model']=_[_0x98ca('0x24')](db[_0x98ca('0x4a')][_0x98ca('0x74')]);_0x520a5b[_0x98ca('0x1e')]=_[_0x98ca('0x24')](_0x1d5e2f['query']);_0x520a5b[_0x98ca('0x75')]=_[_0x98ca('0x76')](_0x520a5b[_0x98ca('0x77')],_0x520a5b[_0x98ca('0x1e')]);_0x136b8b[_0x98ca('0x78')]=_[_0x98ca('0x76')](_0x520a5b[_0x98ca('0x77')],qs['fields'](_0x1d5e2f[_0x98ca('0x1e')]['fields']));_0x136b8b[_0x98ca('0x78')]=_0x136b8b[_0x98ca('0x78')]['length']?_0x136b8b[_0x98ca('0x78')]:_0x520a5b['model'];if(!_0x1d5e2f['query']['hasOwnProperty']('nolimit')){_0x136b8b[_0x98ca('0x10')]=qs[_0x98ca('0x10')](_0x1d5e2f[_0x98ca('0x1e')][_0x98ca('0x10')]);_0x136b8b[_0x98ca('0xe')]=qs[_0x98ca('0xe')](_0x1d5e2f[_0x98ca('0x1e')]['offset']);}_0x136b8b['order']=qs[_0x98ca('0x7a')](_0x1d5e2f['query'][_0x98ca('0x7a')]);_0x136b8b['where']=qs[_0x98ca('0x75')](_['pick'](_0x1d5e2f[_0x98ca('0x1e')],_0x520a5b[_0x98ca('0x75')]));_0x136b8b['where'][_0x98ca('0x96')]=_0x22f645['id'];if(_0x1d5e2f[_0x98ca('0x1e')][_0x98ca('0x7c')]){_0x136b8b['where']=_[_0x98ca('0x30')](_0x136b8b[_0x98ca('0x52')],{'$or':_[_0x98ca('0x65')](_0x136b8b['attributes'],function(_0x42116a){var _0x4bb35c={};_0x4bb35c[_0x42116a]={'$like':'%'+_0x1d5e2f[_0x98ca('0x1e')][_0x98ca('0x7c')]+'%'};return _0x4bb35c;})});}_0x136b8b=_['merge']({},_0x136b8b,_0x1d5e2f[_0x98ca('0x7d')]);return db[_0x98ca('0x4a')]['count']({'where':_0x136b8b[_0x98ca('0x52')]})['then'](function(_0x345d6e){_0x28d826[_0x98ca('0x11')]=_0x345d6e;if(_0x1d5e2f['query'][_0x98ca('0x97')]){_0x136b8b[_0x98ca('0x98')]=[{'all':!![]}];}return db[_0x98ca('0x4a')][_0x98ca('0x1d')](_0x136b8b);})['then'](function(_0x2ecc39){_0x28d826[_0x98ca('0x99')]=_0x2ecc39;return _0x28d826;});}})['then'](respondWithFilteredResult(_0xce250a,_0x136b8b))[_0x98ca('0x23')](handleError(_0xce250a,null));};exports[_0x98ca('0x9b')]=function(_0x46821f,_0x431203){try{if(!_0x46821f[_0x98ca('0x31')][_0x98ca('0x55')]){throw new Error(_0x98ca('0x9c'));}if(!_0x46821f[_0x98ca('0x31')]['binding_keys']){throw new Error(_0x98ca('0x9d'));}if(!_0x46821f[_0x98ca('0x31')]['binding_values']){throw new Error(_0x98ca('0x9e'));}if(!_0x46821f[_0x98ca('0x31')][_0x98ca('0x9f')]){throw new Error(_0x98ca('0xa0'));}var _0x3872b8=_0x46821f[_0x98ca('0x31')][_0x98ca('0xa1')][_0x98ca('0xa2')](',');var _0x2a08cd=_0x46821f['body'][_0x98ca('0xa3')][_0x98ca('0xa2')](',');if(!_0x3872b8[_0x98ca('0x25')]||!_0x2a08cd['length']||_0x3872b8[_0x98ca('0x25')]!==_0x2a08cd[_0x98ca('0x25')]){throw new Error(_0x98ca('0xa4'));}_0x46821f['body']['fields']=_[_0x98ca('0xa5')](_0x3872b8,_0x2a08cd);if(!_0x46821f[_0x98ca('0x31')]['fields']['phone']){throw new Error(_0x98ca('0xa6'));}if(!_0x46821f['body'][_0x98ca('0x95')][_0x98ca('0xa7')]){throw new Error(_0x98ca('0xa8'));}var _0x19b06e=path[_0x98ca('0x37')](config[_0x98ca('0xa9')],'server/files/tmp',_0x46821f[_0x98ca('0xaa')][_0x98ca('0xab')]);fs[_0x98ca('0xac')](_0x19b06e,parseInt(_0x98ca('0xad'),0x8));var _0x1db8d8=require(_0x98ca('0xae'))['fork'](path['join'](__dirname,_0x98ca('0xaf')),[_0x19b06e,_0x46821f[_0x98ca('0x31')][_0x98ca('0xa1')],_0x46821f['body']['binding_values'],_0x46821f[_0x98ca('0x31')]['ListId'],_0x46821f['body']['CompanyId'],_0x46821f['body']['duplicates'],_0x46821f['body'][_0x98ca('0x9f')]]);return _0x431203[_0x98ca('0xd')](0xc8)[_0x98ca('0x13')]({'message':_0x98ca('0xb0'),'pid':_0x1db8d8[_0x98ca('0xb1')]});}catch(_0x2fcac4){return _0x431203['status'](0x1f4)['send'](_0x2fcac4);}};exports[_0x98ca('0xb2')]=function(_0x327bb3,_0x541143){var _0x1848d8=fs['createReadStream'](_0x327bb3['file'][_0x98ca('0x2')]);Papa[_0x98ca('0xb3')](_0x1848d8,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x539ee1){return _0x541143[_0x98ca('0xd')](0xc8)[_0x98ca('0x13')]({'file':_0x327bb3['file'],'fields':_0x539ee1[_0x98ca('0xb4')][_0x98ca('0x95')]});}});};exports['import']=function(_0x390c39,_0x2597d2){return db[_0x98ca('0xb5')][_0x98ca('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x98ca('0xb6')}})[_0x98ca('0x15')](function(_0x1a3a13){var _0x2a8fcd=![];if(!_0x390c39[_0x98ca('0x31')]['ListId']){throw new Error(_0x98ca('0x9c'));}if(!_0x390c39['body']['binding']['phone']){throw new Error(_0x98ca('0xa6'));}if(!_0x390c39['body'][_0x98ca('0xb7')][_0x98ca('0xa7')]){throw new Error(_0x98ca('0xa8'));}if(!_0x390c39[_0x98ca('0x31')][_0x98ca('0x9f')]){throw new Error(_0x98ca('0xa0'));}var _0x49bc5e=require(_0x98ca('0xae'))['fork'](path[_0x98ca('0x37')](__dirname,'../../components/import/cm/csv2'),[_0x390c39['params']['id'],JSON['stringify'](_0x390c39[_0x98ca('0x31')]),JSON[_0x98ca('0xb8')](_0x1a3a13)]);_0x49bc5e['on']('message',function(){_0x2a8fcd=!![];return _0x2597d2[_0x98ca('0xd')](0xc8)[_0x98ca('0x13')]({'message':_0x98ca('0xb9'),'pid':_0x49bc5e[_0x98ca('0xb1')]});});_0x49bc5e['on'](_0x98ca('0xba'),function(_0x457e75){if(_0x457e75&&!_0x2a8fcd){return _0x2597d2[_0x98ca('0xd')](0x1f4)[_0x98ca('0x13')]({'message':_0x98ca('0xbb'),'pid':_0x49bc5e[_0x98ca('0xb1')]});}});})[_0x98ca('0x23')](handleError(_0x2597d2,null));};exports['importUpdates']=function(_0x2b0d58,_0x6d2881){return db[_0x98ca('0xb5')][_0x98ca('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x98ca('0xb6')}})[_0x98ca('0x15')](function(_0x437577){var _0xabd2dc=![];if(!_0x2b0d58[_0x98ca('0x31')][_0x98ca('0x55')]){throw new Error(_0x98ca('0x9c'));}if(!_0x2b0d58['body'][_0x98ca('0xb7')][_0x98ca('0x71')]){throw new Error(_0x98ca('0xa6'));}if(!_0x2b0d58['body']['binding']['firstName']){throw new Error(_0x98ca('0xa8'));}if(!_0x2b0d58[_0x98ca('0x31')]['socket_timestamp']){throw new Error(_0x98ca('0xa0'));}var _0x2db84b=require('child_process')['fork'](path['join'](__dirname,_0x98ca('0xbc')),[_0x2b0d58[_0x98ca('0x22')]['id'],JSON[_0x98ca('0xb8')](_0x2b0d58['body']),JSON[_0x98ca('0xb8')](_0x437577)]);_0x2db84b['on']('message',function(){_0xabd2dc=!![];return _0x6d2881[_0x98ca('0xd')](0xc8)[_0x98ca('0x13')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x2db84b[_0x98ca('0xb1')]});});_0x2db84b['on'](_0x98ca('0xba'),function(_0x1344d4){if(_0x1344d4&&!_0xabd2dc){return _0x6d2881[_0x98ca('0xd')](0x1f4)[_0x98ca('0x13')]({'message':_0x98ca('0xbb'),'pid':_0x2db84b[_0x98ca('0xb1')]});}});})[_0x98ca('0x23')](handleError(_0x6d2881,null));};exports[_0x98ca('0xbd')]=function(_0x2abfc0,_0x305c94){var _0x59597f=[_0x98ca('0xbe'),'chat',_0x98ca('0xbf'),_0x98ca('0xc0'),_0x98ca('0xc1'),_0x98ca('0xc2'),_0x98ca('0xc3')];var _0x374efa={'offset':0x0,'order':qs['sort'](_0x98ca('0xc4'))},_0x4e3adb={'count':0x0,'rows':[]};Promise[_0x98ca('0xc5')]()['then'](function(){if(_0x2abfc0['query'][_0x98ca('0xc6')]){if(!_['includes'](_0x59597f,_0x2abfc0[_0x98ca('0x1e')][_0x98ca('0xc6')]['toLowerCase']())){throw new Error(_0x98ca('0xc7'));}_0x59597f=[_0x2abfc0[_0x98ca('0x1e')][_0x98ca('0xc6')]['toLowerCase']()];}if(_0x2abfc0[_0x98ca('0x1e')][_0x98ca('0xc8')]){try{var _0x4da871=JSON[_0x98ca('0xb3')](_0x2abfc0[_0x98ca('0x1e')][_0x98ca('0xc8')]);if(!moment(_0x4da871['from'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x4da871['to'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x30d316){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x2abfc0[_0x98ca('0x1e')][_0x98ca('0x58')](_0x98ca('0x7e'))){_0x374efa[_0x98ca('0x10')]=qs['limit'](_0x2abfc0[_0x98ca('0x1e')]['limit']||0xa);_0x374efa['offset']=qs[_0x98ca('0xe')](_0x2abfc0[_0x98ca('0x1e')]['offset']);}var _0x1e37fd=_0x59597f[_0x98ca('0x65')](function(_0x4fff23){if(_0x4fff23===_0x98ca('0xc3')){var _0x52034d={'attributes':['id',_0x98ca('0xc9'),_0x98ca('0xca'),_0x98ca('0xcb'),_0x98ca('0xcc'),_0x98ca('0xcd'),_0x98ca('0xce'),'endtime','duration',_0x98ca('0xcf'),_0x98ca('0xd0'),'userDisposition',_0x98ca('0xd1'),_0x98ca('0xd2'),_0x98ca('0xd3')],'where':{'ContactId':_0x2abfc0[_0x98ca('0x22')]['id']},'include':[{'model':db['User'],'as':_0x98ca('0xb5'),'attributes':['id',_0x98ca('0x19'),_0x98ca('0xd4'),_0x98ca('0x2a')]}],'order':[['createdAt',_0x98ca('0xd5')]]};if(_0x2abfc0[_0x98ca('0x1e')][_0x98ca('0xc8')]){_0x52034d[_0x98ca('0x52')]['createdAt']={'$gte':_0x4da871[_0x98ca('0x32')],'$lte':_0x4da871['to']};}return db[_0x98ca('0xd6')][_0x98ca('0xd7')](_0x52034d)[_0x98ca('0x15')](function(_0x371fc5){_0x4e3adb[_0x98ca('0x11')]+=_0x371fc5[_0x98ca('0x11')];return _['map'](_0x371fc5['rows'],function(_0x41ae0){var _0x56c960=_0x41ae0[_0x98ca('0x33')]({'plain':!![]});_0x56c960[_0x98ca('0xc6')]=_0x4fff23;if(_0x56c960['User']){_0x56c960['User']={'id':_0x56c960[_0x98ca('0xb5')]['id'],'name':_0x56c960[_0x98ca('0xb5')][_0x98ca('0x19')],'fullname':_0x56c960[_0x98ca('0xb5')]['fullname'],'alias':_0x56c960[_0x98ca('0xb5')][_0x98ca('0x2a')]};}return _0x56c960;});});}else{var _0x34e740=_[_0x98ca('0xd8')](_0x4fff23)+(_0x4fff23===_0x98ca('0xd9')?_0x98ca('0xda'):_0x98ca('0xdb'));var _0x28dc5f={'attributes':['id',_0x98ca('0xdc'),_0x98ca('0xdd'),_0x98ca('0xd0'),'note',_0x98ca('0xde'),_0x98ca('0xdf'),_0x98ca('0xe0'),'UserId',_0x34e740+'Id'],'where':{'ContactId':_0x2abfc0[_0x98ca('0x22')]['id']},'include':[{'model':db[_0x34e740],'as':'Account','attributes':['id','name',_0x98ca('0xe1')]},{'model':db[_0x98ca('0xb5')],'as':'Owner','attributes':['id',_0x98ca('0x19'),_0x98ca('0xd4')]},{'model':db[_0x98ca('0x5b')],'as':_0x98ca('0x5c'),'attributes':['id','name',_0x98ca('0x5d')],'through':{'attributes':[]}}],'order':[[_0x98ca('0xd0'),_0x98ca('0xd5')]]};if(_0x2abfc0[_0x98ca('0x1e')][_0x98ca('0xc8')]){_0x28dc5f['where'][_0x98ca('0xd0')]={'$gte':_0x4da871[_0x98ca('0x32')],'$lte':_0x4da871['to']};}switch(_0x4fff23){case'chat':_0x28dc5f[_0x98ca('0x78')]['push'](_0x98ca('0xe2'),_0x98ca('0xe3'),'customerPort','deviceModel',_0x98ca('0xe4'),_0x98ca('0xe5'),_0x98ca('0xe6'),_0x98ca('0xe7'),_0x98ca('0xe8'));break;case'mail':_0x28dc5f[_0x98ca('0x78')]['push'](_0x98ca('0xe9'),'substatus');break;case'openchannel':_0x28dc5f[_0x98ca('0x78')][_0x98ca('0x54')](_0x98ca('0xea'),'threadId');break;}return db[_[_0x98ca('0xd8')](_0x4fff23)+_0x98ca('0xeb')][_0x98ca('0xd7')](_0x28dc5f)[_0x98ca('0x15')](function(_0x4b35b7){_0x4e3adb[_0x98ca('0x11')]+=_0x4b35b7[_0x98ca('0x11')];return _[_0x98ca('0x65')](_0x4b35b7[_0x98ca('0x99')],function(_0x213db3){var _0x443fa1=_0x213db3[_0x98ca('0x33')]({'plain':!![]});_0x443fa1[_0x98ca('0xc6')]=_0x4fff23;if(_0x443fa1[_0x98ca('0xec')]){_0x443fa1[_0x98ca('0xec')]={'id':_0x443fa1['Owner']['id'],'name':_0x443fa1['Owner'][_0x98ca('0x19')],'fullname':_0x443fa1[_0x98ca('0xec')][_0x98ca('0xd4')]};}return _0x443fa1;});});}});return Promise['all'](_0x1e37fd);})[_0x98ca('0x15')](function(_0x12ef53){return _(_0x12ef53)['flatten']()[_0x98ca('0xed')](_0x98ca('0xd0'))[_0x98ca('0xee')]()['value']();})[_0x98ca('0x15')](function(_0x12a616){_0x4e3adb[_0x98ca('0x99')]=_0x374efa['limit']?_0x12a616[_0x98ca('0xef')](_0x374efa[_0x98ca('0xe')],_0x374efa[_0x98ca('0xe')]+_0x374efa[_0x98ca('0x10')]):_0x12a616;return _0x4e3adb;})['then'](respondWithFilteredResult(_0x305c94,_0x374efa))[_0x98ca('0x23')](handleError(_0x305c94,null));}; \ No newline at end of file +var _0x3b82=['disposition','thirdDisposition','Owner','Tags','customerIp','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','flatten','sortBy','reverse','value','bluebird','path','lodash','squel','papaparse','../../components/parsers/qs','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','json','limit','undefined','offset','count','status','set','Content-Range','update','then','destroy','error','name','send','index','describe','getOptions','findAll','query','catch','CmContact','find','params','tags','keys','length','startsWith','cf_','columnName','analytics','CmCustomField','displayName','alias','custom','type','values','info','merge','body','from','get','isArray','join','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmContactHasItem','CmHopperHistory','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappQueueReport','dialTimezone','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','spread','contact','all','Tag','color','tag','Phones','ContactItemType','sequelize','Phones.OrderBy','isNil','map','format','cf_%d','timezones','$and','omit','table','setFields','toParam','text','phone','getTags','findOne','rawAttributes','filters','intersection','model','attributes','fields','order','sort','pick','filter','options','hasOwnProperty','nolimit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','ItemType','`ItemType`.OrderBy','ItemType.OrderBy','getAdditionalPhones','literal','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','includeAll','include','ContactId','getHopperFinals','CmHopperFinal','rows','getJscriptySessions','No\x20ListId\x20specified','binding_keys','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','child_process','fork','CompanyId','createReadStream','meta','import','User','stringify','pid','importUpdates','agent','binding','../../components/import/cm/csvUpdates','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20createdAt\x20filter','source','destination','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','DESC','findAndCountAll','fullname','startCase','Website','Account','closedAt'];(function(_0xbd7936,_0x3985b6){var _0xd8f0f2=function(_0x44e8a4){while(--_0x44e8a4){_0xbd7936['push'](_0xbd7936['shift']());}};_0xd8f0f2(++_0x3985b6);}(_0x3b82,0x1ef));var _0x23b8=function(_0x16b1a5,_0x318267){_0x16b1a5=_0x16b1a5-0x0;var _0x475e25=_0x3b82[_0x16b1a5];return _0x475e25;};'use strict';var moment=require('moment');var BPromise=require(_0x23b8('0x0'));var util=require('util');var path=require(_0x23b8('0x1'));var fs=require('fs');var _=require(_0x23b8('0x2'));var squel=require(_0x23b8('0x3'));var Papa=require(_0x23b8('0x4'));var Redis=require('ioredis');var contacts=require('../../components/contacts');var qs=require(_0x23b8('0x5'));var logger=require('../../config/logger')(_0x23b8('0x6'));var config=require(_0x23b8('0x7'));var shared=require(_0x23b8('0x8'));var db=require(_0x23b8('0x9'))['db'];config['redis']=_['defaults'](config[_0x23b8('0xa')],{'host':_0x23b8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x23b8('0xa')]));require(_0x23b8('0xc'))[_0x23b8('0xd')](socket);function respondWithResult(_0x273862,_0x32ac15){_0x32ac15=_0x32ac15||0xc8;return function(_0xb7ba85){if(_0xb7ba85){return _0x273862['status'](_0x32ac15)[_0x23b8('0xe')](_0xb7ba85);}};}function respondWithFilteredResult(_0x15f9ac,_0x38c661){return function(_0x343ef4){if(_0x343ef4){var _0x2ff28e=typeof _0x38c661['offset']==='undefined'&&typeof _0x38c661[_0x23b8('0xf')]===_0x23b8('0x10');var _0x56f7b6=_0x343ef4['count'];var _0x957569=_0x2ff28e?0x0:_0x38c661[_0x23b8('0x11')];var _0x344b0e=_0x2ff28e?_0x343ef4[_0x23b8('0x12')]:_0x38c661['offset']+_0x38c661[_0x23b8('0xf')];var _0x396435;if(_0x344b0e>=_0x56f7b6){_0x344b0e=_0x56f7b6;_0x396435=0xc8;}else{_0x396435=0xce;}_0x15f9ac[_0x23b8('0x13')](_0x396435);return _0x15f9ac[_0x23b8('0x14')](_0x23b8('0x15'),_0x957569+'-'+_0x344b0e+'/'+_0x56f7b6)[_0x23b8('0xe')](_0x343ef4);}return null;};}function saveUpdates(_0x292b6a){return function(_0x4baf2a){if(_0x4baf2a){return _0x4baf2a[_0x23b8('0x16')](_0x292b6a)[_0x23b8('0x17')](function(_0x35b593){return _0x35b593;});}return null;};}function removeEntity(_0x5755f2){return function(_0x19d4e4){if(_0x19d4e4){return _0x19d4e4[_0x23b8('0x18')]()[_0x23b8('0x17')](function(){_0x5755f2[_0x23b8('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30ca28){return function(_0x491cf3){if(!_0x491cf3){_0x30ca28['sendStatus'](0x194);}return _0x491cf3;};}function handleError(_0x364cc2,_0x5d8e66){_0x5d8e66=_0x5d8e66||0x1f4;return function(_0x29ff6e){logger[_0x23b8('0x19')](_0x29ff6e['stack']);if(_0x29ff6e[_0x23b8('0x1a')]){delete _0x29ff6e[_0x23b8('0x1a')];}_0x364cc2['status'](_0x5d8e66)[_0x23b8('0x1b')](_0x29ff6e);};}exports[_0x23b8('0x1c')]=function(_0x7c0d71,_0x4e98ba){var _0x2ef0d7={};return contacts[_0x23b8('0x1d')]()[_0x23b8('0x17')](function(_0x2c45b8){_0x2ef0d7=qs[_0x23b8('0x1e')](_0x2c45b8,_0x7c0d71);return contacts[_0x23b8('0x1f')](_0x7c0d71[_0x23b8('0x20')],_0x7c0d71['user'],_0x2ef0d7,_0x2c45b8);})['then'](respondWithFilteredResult(_0x4e98ba,_0x2ef0d7))[_0x23b8('0x21')](handleError(_0x4e98ba,null));};exports[_0x23b8('0x18')]=function(_0x1e4f4d,_0x40f6a6){return db[_0x23b8('0x22')][_0x23b8('0x23')]({'where':{'id':_0x1e4f4d[_0x23b8('0x24')]['id']}})['then'](handleEntityNotFound(_0x40f6a6,null))['then'](removeEntity(_0x40f6a6,null))['catch'](handleError(_0x40f6a6,null));};exports['describe']=function(_0x55e51d,_0x31f063){return db[_0x23b8('0x22')][_0x23b8('0x1d')]()[_0x23b8('0x17')](function(_0x1e844e){delete _0x1e844e[_0x23b8('0x25')];for(var _0x43ddc5=0x0;_0x43ddc50x0){return new Promise(function(_0x4752b8){var _0x334143=[];for(var _0x4450d5=0x0;_0x4450d5<_0x4d4907[_0x23b8('0x27')];_0x4450d5++){_0x334143[_0x23b8('0x59')](insertAdditionalPhones(_0x4d4907[_0x4450d5][_0x23b8('0x5c')],_0x4d4907[_0x4450d5][_0x23b8('0x53')]));}Promise[_0x23b8('0x5d')](_0x334143)[_0x23b8('0x17')](function(){_0x4752b8(0x1);});})[_0x23b8('0x17')](function(){return{'success':_0x5d8ddd,'failure':_0x1be7fc,'duplicates':_0xbf1ae3};});}else{return{'success':_0x5d8ddd,'failure':_0x1be7fc,'duplicates':_0xbf1ae3};}}})[_0x23b8('0x17')](respondWithResult(_0x59765e,0xc9))[_0x23b8('0x21')](handleError(_0x59765e,null));};exports['show']=function(_0x2f66eb,_0x352576){var _0x36014f;return db['CmContact'][_0x23b8('0x1d')]()[_0x23b8('0x17')](function(_0x1675cb){return db['CmContact'][_0x23b8('0x23')]({'where':{'id':_0x2f66eb[_0x23b8('0x24')]['id']},'include':[{'model':db[_0x23b8('0x5e')],'as':'Tags','attributes':['id',_0x23b8('0x1a'),_0x23b8('0x5f')],'required':_0x2f66eb['query'][_0x23b8('0x60')]?!![]:![]},{'model':db[_0x23b8('0x47')],'as':_0x23b8('0x61'),'where':{'CmContactId':_0x2f66eb[_0x23b8('0x24')]['id']},'required':![],'include':[{'model':db[_0x23b8('0x62')],'as':'ItemType'}]}],'order':[db[_0x23b8('0x63')]['literal'](_0x23b8('0x64'))],'attributes':_[_0x23b8('0x26')](_0x1675cb)});})[_0x23b8('0x17')](function(_0x5c3e38){if(!_[_0x23b8('0x65')](_0x5c3e38)){_0x36014f=_0x5c3e38[_0x23b8('0x36')]({'plain':!![]});var _0x401162={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5c3e38&&_0x5c3e38[_0x23b8('0x5a')]){if(_0x5c3e38[_0x23b8('0x5a')]){_0x401162['where']['$and'][_0x23b8('0x59')]({'ListId':{'$ne':_0x5c3e38[_0x23b8('0x5a')]}});}}return db['CmCustomField'][_0x23b8('0x1f')](_0x401162);}})[_0x23b8('0x17')](function(_0x12a57f){if(!_[_0x23b8('0x65')](_0x12a57f)){return _['omit'](_0x36014f,_[_0x23b8('0x66')](_0x12a57f,function(_0x5dfd33){return util[_0x23b8('0x67')](_0x23b8('0x68'),_0x5dfd33['id']);}));}})[_0x23b8('0x17')](handleEntityNotFound(_0x352576,null))[_0x23b8('0x17')](respondWithResult(_0x352576,null))[_0x23b8('0x21')](handleError(_0x352576,null));};exports[_0x23b8('0x16')]=function(_0x9d6833,_0x3f548b){var _0x43db4b;if(_0x9d6833[_0x23b8('0x34')]['id']){delete _0x9d6833[_0x23b8('0x34')]['id'];}if(!_['isNil'](_0x9d6833[_0x23b8('0x34')][_0x23b8('0x51')])){var _0x2ccd1f=_0x9d6833[_0x23b8('0x34')][_0x23b8('0x51')];if(!_[_0x23b8('0x65')](shared[_0x23b8('0x69')][_0x2ccd1f]))_0x9d6833[_0x23b8('0x34')][_0x23b8('0x52')]=shared['timezones'][_0x2ccd1f][_0x23b8('0x52')];}return db[_0x23b8('0x22')]['find']({'where':{'id':_0x9d6833[_0x23b8('0x24')]['id']}})[_0x23b8('0x17')](handleEntityNotFound(_0x3f548b,null))[_0x23b8('0x17')](saveUpdates(_0x9d6833[_0x23b8('0x34')],null))['then'](function(_0x5c4cc6){_0x43db4b=_0x5c4cc6;var _0x20da3b={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5c4cc6&&_0x5c4cc6['ListId']){if(_0x5c4cc6[_0x23b8('0x5a')]){_0x20da3b['where'][_0x23b8('0x6a')]['push']({'ListId':{'$ne':_0x5c4cc6[_0x23b8('0x5a')]}});}}return db[_0x23b8('0x2c')][_0x23b8('0x1f')](_0x20da3b);})[_0x23b8('0x17')](function(_0xfa6ed8){if(_0xfa6ed8){return _[_0x23b8('0x6b')](_['pickBy'](_0x9d6833['body'],function(_0x3c8a4f,_0x523744){return _[_0x23b8('0x28')](_0x523744,_0x23b8('0x29'));}),_['map'](_0xfa6ed8,function(_0x5b5288){return util['format'](_0x23b8('0x68'),_0x5b5288['id']);}));}})[_0x23b8('0x17')](function(_0x12768b){if(_0x12768b&&!_['isEmpty'](_0x12768b)){var _0x28b8a8=squel[_0x23b8('0x16')]()[_0x23b8('0x6c')]('cm_contacts')[_0x23b8('0x6d')](_0x12768b)[_0x23b8('0x57')]('id\x20=\x20?',_0x9d6833['params']['id'])[_0x23b8('0x6e')]();return db['sequelize'][_0x23b8('0x20')](_0x28b8a8[_0x23b8('0x6f')],{'replacements':_0x28b8a8[_0x23b8('0x31')]});}})[_0x23b8('0x17')](function(){if(_0x9d6833['body'][_0x23b8('0x70')]&&_0x43db4b){return db[_0x23b8('0x39')][_0x23b8('0x16')]({'phone':_0x9d6833[_0x23b8('0x34')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x43db4b['id']}});}})['then'](function(){return _0x43db4b;})['then'](respondWithResult(_0x3f548b,null))[_0x23b8('0x21')](handleError(_0x3f548b,null));};exports[_0x23b8('0x71')]=function(_0x5e8497,_0x6e3eea){var _0x1d1f37={};var _0x335286={};var _0x5adab2;var _0x53879b;return db['CmContact'][_0x23b8('0x72')]({'where':{'id':_0x5e8497[_0x23b8('0x24')]['id']}})[_0x23b8('0x17')](handleEntityNotFound(_0x6e3eea,null))[_0x23b8('0x17')](function(_0x59b71c){if(_0x59b71c){_0x5adab2=_0x59b71c;_0x335286['model']=_['keys'](db[_0x23b8('0x5e')][_0x23b8('0x73')]);_0x335286[_0x23b8('0x20')]=_['keys'](_0x5e8497[_0x23b8('0x20')]);_0x335286[_0x23b8('0x74')]=_[_0x23b8('0x75')](_0x335286[_0x23b8('0x76')],_0x335286['query']);_0x1d1f37[_0x23b8('0x77')]=_[_0x23b8('0x75')](_0x335286['model'],qs[_0x23b8('0x78')](_0x5e8497[_0x23b8('0x20')][_0x23b8('0x78')]));_0x1d1f37['attributes']=_0x1d1f37[_0x23b8('0x77')][_0x23b8('0x27')]?_0x1d1f37[_0x23b8('0x77')]:_0x335286[_0x23b8('0x76')];_0x1d1f37[_0x23b8('0x79')]=qs[_0x23b8('0x7a')](_0x5e8497[_0x23b8('0x20')][_0x23b8('0x7a')]);_0x1d1f37[_0x23b8('0x57')]=qs[_0x23b8('0x74')](_[_0x23b8('0x7b')](_0x5e8497['query'],_0x335286[_0x23b8('0x74')]));if(_0x5e8497['query'][_0x23b8('0x7c')]){_0x1d1f37['where']=_['merge'](_0x1d1f37[_0x23b8('0x57')],{'$or':_['map'](_0x1d1f37[_0x23b8('0x77')],function(_0x386d00){var _0x4e1b69={};_0x4e1b69[_0x386d00]={'$like':'%'+_0x5e8497[_0x23b8('0x20')]['filter']+'%'};return _0x4e1b69;})});}_0x1d1f37=_[_0x23b8('0x33')]({},_0x1d1f37,_0x5e8497[_0x23b8('0x7d')]);return _0x5adab2[_0x23b8('0x71')](_0x1d1f37);}})[_0x23b8('0x17')](function(_0x5c4eb2){if(_0x5c4eb2){_0x53879b=_0x5c4eb2[_0x23b8('0x27')];if(!_0x5e8497[_0x23b8('0x20')][_0x23b8('0x7e')](_0x23b8('0x7f'))){_0x1d1f37[_0x23b8('0xf')]=qs['limit'](_0x5e8497[_0x23b8('0x20')][_0x23b8('0xf')]);_0x1d1f37['offset']=qs['offset'](_0x5e8497['query'][_0x23b8('0x11')]);}return _0x5adab2['getTags'](_0x1d1f37);}})[_0x23b8('0x17')](function(_0x3d8d90){if(_0x3d8d90){return _0x3d8d90?{'count':_0x53879b,'rows':_0x3d8d90}:null;}})[_0x23b8('0x17')](respondWithResult(_0x6e3eea,null))[_0x23b8('0x21')](handleError(_0x6e3eea,null));};exports[_0x23b8('0x80')]=function(_0x354629,_0x385c87){if(_0x354629[_0x23b8('0x34')]['id']){delete _0x354629[_0x23b8('0x34')]['id'];}return db[_0x23b8('0x22')][_0x23b8('0x72')]({'where':{'id':_0x354629[_0x23b8('0x24')]['id']}})[_0x23b8('0x17')](handleEntityNotFound(_0x385c87,null))['then'](function(_0xdb16e3){if(_0xdb16e3){return _0xdb16e3[_0x23b8('0x80')](_0x354629[_0x23b8('0x34')][_0x23b8('0x81')]||[]);}return null;})[_0x23b8('0x17')](respondWithResult(_0x385c87,null))[_0x23b8('0x21')](handleError(_0x385c87,null));};exports[_0x23b8('0x82')]=function(_0x9a2398,_0x26fe89){var _0x139d25=[];_0x139d25[_0x23b8('0x59')](addAdditionalPhones(_0x9a2398[_0x23b8('0x34')]));Promise[_0x23b8('0x5d')](_0x139d25)[_0x23b8('0x17')](function(){_0x139d25=[];_0x139d25[_0x23b8('0x59')](deleteCmHopperPhones(_0x9a2398['body']['id']));_0x139d25[_0x23b8('0x59')](addCmHopperPhones(_0x9a2398[_0x23b8('0x34')]['id']));Promise[_0x23b8('0x5d')](_0x139d25)[_0x23b8('0x17')](function(){return[0x1];})[_0x23b8('0x17')](respondWithResult(_0x26fe89,null));});};function addAdditionalPhones(_0x5e0ab1){var _0x52fd5a;return new Promise(function(_0x1a78dc){return db[_0x23b8('0x47')][_0x23b8('0x18')]({'where':{'CmContactId':_0x5e0ab1['id']}})[_0x23b8('0x17')](function(){db[_0x23b8('0x62')][_0x23b8('0x1f')]({'raw':!![],'attributes':['id',_0x23b8('0x83')]})[_0x23b8('0x17')](function(_0x81d062){var _0x5086f4=[];for(var _0x50e705=0x0;_0x50e705<_0x5e0ab1[_0x23b8('0x84')][_0x23b8('0x27')];_0x50e705++){var _0x1dfda1=_0x5e0ab1[_0x23b8('0x85')]?_[_0x23b8('0x65')](_0x5e0ab1['item_types'][_0x50e705])?'':_0x5e0ab1['item_types'][_0x50e705]:_0x5e0ab1[_0x23b8('0x84')][_0x50e705][_0x23b8('0x86')]?_0x5e0ab1[_0x23b8('0x84')][_0x50e705][_0x23b8('0x86')]:'';var _0x258dca=_[_0x23b8('0x65')](_0x5e0ab1[_0x23b8('0x84')][_0x50e705]['description'])?'':_0x5e0ab1[_0x23b8('0x84')][_0x50e705][_0x23b8('0x87')];var _0x2143dd=_0x1dfda1+':'+_0x5e0ab1[_0x23b8('0x84')][_0x50e705]['phone']+'§'+_0x258dca;if(_[_0x23b8('0x65')](_0x52fd5a))_0x52fd5a=_0x2143dd;else _0x52fd5a+=';'+_0x2143dd;var _0x4ca3b6=null;var _0x45fb03=null;if(_0x5e0ab1[_0x23b8('0x85')]){if(!_['isNil'](_0x5e0ab1['item_types'][_0x50e705])){_0x45fb03=_[_0x23b8('0x23')](_0x81d062,function(_0x4aa8db){return _0x4aa8db['id']===_0x5e0ab1[_0x23b8('0x85')][_0x50e705];});if(!_[_0x23b8('0x65')](_0x45fb03)){_0x4ca3b6=_0x45fb03['OrderBy'];}}}else{if(!_[_0x23b8('0x65')](_0x5e0ab1['items'][_0x50e705])){_0x45fb03=_[_0x23b8('0x23')](_0x81d062,function(_0x1a4d09){return _0x1a4d09['id']===_0x5e0ab1[_0x23b8('0x84')][_0x50e705]['ItemTypeId'];});if(!_[_0x23b8('0x65')](_0x45fb03)){_0x4ca3b6=_0x50e705;}}}if(_[_0x23b8('0x65')](_0x4ca3b6)){_0x4ca3b6=0x64;}_0x5086f4['push'](addAdditionalPhone(_0x5e0ab1['id'],_0x5e0ab1['items'][_0x50e705][_0x23b8('0x70')],_0x5e0ab1['item_types']?_['isNil'](_0x5e0ab1[_0x23b8('0x85')][_0x50e705])?null:_0x5e0ab1['item_types'][_0x50e705]:_0x5e0ab1[_0x23b8('0x84')][_0x50e705][_0x23b8('0x86')]?_0x5e0ab1[_0x23b8('0x84')][_0x50e705]['ItemTypeId']:null,_0x4ca3b6,_0x258dca));}Promise[_0x23b8('0x5d')](_0x5086f4)['then'](function(){db['CmContact'][_0x23b8('0x16')]({'AdditionalPhones':_0x52fd5a},{'where':{'id':_0x5e0ab1['id']}})[_0x23b8('0x17')](function(){_0x1a78dc(0x1);});});});});});}function addAdditionalPhone(_0x1d177d,_0x3132d9,_0x1b02e2,_0x46f3ce,_0x407405){return db[_0x23b8('0x47')]['find']({'where':{'CmContactId':_0x1d177d,'item':_0x3132d9}})[_0x23b8('0x17')](function(_0x2e7af0){if(_0x2e7af0)logger[_0x23b8('0x32')](_0x23b8('0x88'),_0x2e7af0);else{db[_0x23b8('0x47')][_0x23b8('0x3c')]({'CmContactId':_0x1d177d,'item':_0x3132d9,'ItemTypeId':_0x1b02e2,'OrderBy':_0x46f3ce,'ItemClass':_0x23b8('0x89'),'description':_0x407405});}});}function deleteCmHopperPhones(_0x41d910){return new Promise(function(_0x3b6585){return db['CmHopper'][_0x23b8('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x41d910}})['then'](function(_0x1895aa){db[_0x23b8('0x8a')][_0x23b8('0x18')]({'where':{'CmHopperId':{'$in':_[_0x23b8('0x66')](_0x1895aa,'id')}}});})[_0x23b8('0x17')](function(){_0x3b6585(0x1);});});}function addCmHopperPhones(_0x3c378e){return new Promise(function(_0x51f81d){return db[_0x23b8('0x39')][_0x23b8('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3c378e}})['then'](function(_0x4e8cfb){var _0x5ead40=[];_[_0x23b8('0x66')](_0x4e8cfb,function(_0x4fc680){_0x5ead40[_0x23b8('0x59')](createCmHopperPhone(_0x3c378e,_0x4fc680['id']));});Promise[_0x23b8('0x5d')](_0x5ead40)[_0x23b8('0x17')](function(){_0x51f81d(0x1);});});});}function createCmHopperPhone(_0x41eaa5,_0x5ef3fd){return new Promise(function(_0x83da82){db[_0x23b8('0x47')][_0x23b8('0x1f')]({'raw':!![],'attributes':[_0x23b8('0x8b'),_0x23b8('0x83')],'where':{'CmContactId':_0x41eaa5,'ItemClass':_0x23b8('0x89')},'include':[{'model':db['ContactItemType'],'attributes':[_0x23b8('0x83')],'as':_0x23b8('0x8c')}],'order':[_0x23b8('0x83'),db['sequelize']['literal'](_0x23b8('0x8d'))]})[_0x23b8('0x17')](function(_0x44e2ac){var _0x57b0b9=0x1;var _0x2d2702=_['map'](_0x44e2ac,function(_0x260719){_0x260719['CmHopperId']=_0x5ef3fd;_0x260719['phone']=_0x260719['item'];_0x260719[_0x23b8('0x83')]=_0x57b0b9;delete _0x260719[_0x23b8('0x8e')];_0x57b0b9=_0x57b0b9+0x1;return _0x260719;});return db[_0x23b8('0x8a')][_0x23b8('0x54')](_0x2d2702,{});})[_0x23b8('0x17')](function(){_0x83da82(0x1);});});}function insertAdditionalPhones(_0x7bd9ad,_0x13171b){return new Promise(function(_0x581e86){var _0x1e0186=[];for(var _0x5369a3=0x0;_0x5369a3<_0x13171b['length'];_0x5369a3++){var _0x1065d1=_0x13171b[_0x5369a3];_0x1e0186[_0x23b8('0x59')](parseContactItemType(_0x1065d1));}Promise[_0x23b8('0x5d')](_0x1e0186)[_0x23b8('0x17')](function(){var _0x3e7a93={'id':_0x7bd9ad['id'],'items':_0x13171b};return addAdditionalPhones(_0x3e7a93)[_0x23b8('0x17')](function(){return addCmHopperPhones(_0x7bd9ad['id']);});})[_0x23b8('0x17')](function(){_0x581e86(_0x7bd9ad);});});}function parseContactItemType(_0x39847c){return new Promise(function(_0x15ad3e){if(_0x39847c[_0x23b8('0x7e')]('ItemTypeId')){_0x15ad3e(_0x39847c);}else{return db[_0x23b8('0x62')]['find']({'where':{'name':_0x39847c['ItemType']}})[_0x23b8('0x17')](function(_0x41c180){if(_[_0x23b8('0x65')](_0x41c180))_0x39847c[_0x23b8('0x86')]=null;else _0x39847c[_0x23b8('0x86')]=_0x41c180['id'];_0x15ad3e(_0x39847c);});}});}exports[_0x23b8('0x8f')]=function(_0x3d7d42,_0x9710a0){return db[_0x23b8('0x47')][_0x23b8('0x1f')]({'raw':!![],'where':{'CmContactId':_0x3d7d42[_0x23b8('0x24')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x23b8('0x62')],'as':_0x23b8('0x8c')}],'order':[[_0x23b8('0x83')],[db[_0x23b8('0x63')][_0x23b8('0x90')](_0x23b8('0x8d'))]]})[_0x23b8('0x17')](function(_0x5d6a17){return _0x5d6a17;})[_0x23b8('0x17')](respondWithResult(_0x9710a0,null))['catch'](handleError(_0x9710a0,null));};exports['duplicateAdditionalPhones']=function(_0xfc9cf5,_0x336566){return db[_0x23b8('0x47')]['findAll']({'raw':!![],'where':{'CmContactId':_0xfc9cf5[_0x23b8('0x34')]['fromContactId']}})[_0x23b8('0x17')](function(_0x855d08){var _0x10fb27=_[_0x23b8('0x66')](_0x855d08,function(_0x274f3c){_0x274f3c[_0x23b8('0x91')]=_0xfc9cf5[_0x23b8('0x34')][_0x23b8('0x92')];return _0x274f3c;});return db[_0x23b8('0x47')][_0x23b8('0x54')](_0x10fb27,{});})['then'](function(){return addCmHopperPhones(_0xfc9cf5[_0x23b8('0x34')][_0x23b8('0x92')]);})['then'](function(){return['ok'];})[_0x23b8('0x17')](respondWithResult(_0x336566,null))['catch'](handleError(_0x336566,null));};exports[_0x23b8('0x93')]=function(_0x465834,_0x588d36){var _0x4bbdc6=[];_0x4bbdc6['push'](createCmHopperPhone(_0x465834['body']['id'],_0x465834[_0x23b8('0x34')][_0x23b8('0x94')]));Promise[_0x23b8('0x5d')](_0x4bbdc6)[_0x23b8('0x17')](function(){return[0x1];})[_0x23b8('0x17')](respondWithResult(_0x588d36,null));};exports[_0x23b8('0x95')]=function(_0x17904e,_0x28ee3f){var _0x49530f={'raw':![],'where':{}};var _0x280593={};var _0x117950={'count':0x0,'rows':[]};return db[_0x23b8('0x22')]['findOne']({'where':{'id':_0x17904e[_0x23b8('0x24')]['id']}})[_0x23b8('0x17')](handleEntityNotFound(_0x28ee3f,null))['then'](function(_0xca4184){if(_0xca4184){_0x280593[_0x23b8('0x76')]=_[_0x23b8('0x26')](db[_0x23b8('0x39')][_0x23b8('0x73')]);_0x280593[_0x23b8('0x20')]=_['keys'](_0x17904e[_0x23b8('0x20')]);_0x280593[_0x23b8('0x74')]=_[_0x23b8('0x75')](_0x280593[_0x23b8('0x76')],_0x280593['query']);_0x49530f[_0x23b8('0x77')]=_[_0x23b8('0x75')](_0x280593['model'],qs[_0x23b8('0x78')](_0x17904e[_0x23b8('0x20')]['fields']));_0x49530f[_0x23b8('0x77')]=_0x49530f[_0x23b8('0x77')][_0x23b8('0x27')]?_0x49530f['attributes']:_0x280593[_0x23b8('0x76')];if(!_0x17904e['query']['hasOwnProperty'](_0x23b8('0x7f'))){_0x49530f[_0x23b8('0xf')]=qs[_0x23b8('0xf')](_0x17904e['query'][_0x23b8('0xf')]);_0x49530f[_0x23b8('0x11')]=qs['offset'](_0x17904e[_0x23b8('0x20')][_0x23b8('0x11')]);}_0x49530f[_0x23b8('0x79')]=qs['sort'](_0x17904e[_0x23b8('0x20')][_0x23b8('0x7a')]);_0x49530f[_0x23b8('0x57')]=qs[_0x23b8('0x74')](_[_0x23b8('0x7b')](_0x17904e[_0x23b8('0x20')],_0x280593[_0x23b8('0x74')]));_0x49530f[_0x23b8('0x57')]['ContactId']=_0xca4184['id'];if(_0x17904e[_0x23b8('0x20')][_0x23b8('0x7c')]){_0x49530f[_0x23b8('0x57')]=_['merge'](_0x49530f[_0x23b8('0x57')],{'$or':_[_0x23b8('0x66')](_0x49530f['attributes'],function(_0xf7c2de){var _0x4f9bb7={};_0x4f9bb7[_0xf7c2de]={'$like':'%'+_0x17904e[_0x23b8('0x20')]['filter']+'%'};return _0x4f9bb7;})});}_0x49530f=_[_0x23b8('0x33')]({},_0x49530f,_0x17904e[_0x23b8('0x7d')]);return db[_0x23b8('0x39')][_0x23b8('0x12')]({'where':_0x49530f[_0x23b8('0x57')]})[_0x23b8('0x17')](function(_0x387f69){_0x117950['count']=_0x387f69;if(_0x17904e[_0x23b8('0x20')][_0x23b8('0x96')]){_0x49530f[_0x23b8('0x97')]=[{'all':!![]}];}return db[_0x23b8('0x39')]['findAll'](_0x49530f);})[_0x23b8('0x17')](function(_0x57c527){_0x117950['rows']=_0x57c527;return _0x117950;});}})[_0x23b8('0x17')](respondWithFilteredResult(_0x28ee3f,_0x49530f))['catch'](handleError(_0x28ee3f,null));};exports['getHopperHistories']=function(_0x20eee6,_0x2bdf0b){var _0x390c87={'raw':!![],'where':{}};var _0x423779={};var _0x399d72={'count':0x0,'rows':[]};return db[_0x23b8('0x22')][_0x23b8('0x72')]({'where':{'id':_0x20eee6[_0x23b8('0x24')]['id']}})[_0x23b8('0x17')](handleEntityNotFound(_0x2bdf0b,null))[_0x23b8('0x17')](function(_0x36160b){if(_0x36160b){_0x423779['model']=_[_0x23b8('0x26')](db[_0x23b8('0x48')][_0x23b8('0x73')]);_0x423779[_0x23b8('0x20')]=_['keys'](_0x20eee6[_0x23b8('0x20')]);_0x423779[_0x23b8('0x74')]=_[_0x23b8('0x75')](_0x423779[_0x23b8('0x76')],_0x423779[_0x23b8('0x20')]);_0x390c87[_0x23b8('0x77')]=_[_0x23b8('0x75')](_0x423779['model'],qs[_0x23b8('0x78')](_0x20eee6['query'][_0x23b8('0x78')]));_0x390c87['attributes']=_0x390c87[_0x23b8('0x77')][_0x23b8('0x27')]?_0x390c87[_0x23b8('0x77')]:_0x423779['model'];if(!_0x20eee6['query'][_0x23b8('0x7e')](_0x23b8('0x7f'))){_0x390c87[_0x23b8('0xf')]=qs[_0x23b8('0xf')](_0x20eee6[_0x23b8('0x20')][_0x23b8('0xf')]);_0x390c87[_0x23b8('0x11')]=qs[_0x23b8('0x11')](_0x20eee6[_0x23b8('0x20')][_0x23b8('0x11')]);}_0x390c87[_0x23b8('0x79')]=qs[_0x23b8('0x7a')](_0x20eee6[_0x23b8('0x20')][_0x23b8('0x7a')]);_0x390c87[_0x23b8('0x57')]=qs['filters'](_[_0x23b8('0x7b')](_0x20eee6[_0x23b8('0x20')],_0x423779[_0x23b8('0x74')]));_0x390c87[_0x23b8('0x57')][_0x23b8('0x98')]=_0x36160b['id'];if(_0x20eee6['query'][_0x23b8('0x7c')]){_0x390c87[_0x23b8('0x57')]=_[_0x23b8('0x33')](_0x390c87[_0x23b8('0x57')],{'$or':_[_0x23b8('0x66')](_0x390c87['attributes'],function(_0x1b32ac){var _0x18a2c4={};_0x18a2c4[_0x1b32ac]={'$like':'%'+_0x20eee6[_0x23b8('0x20')][_0x23b8('0x7c')]+'%'};return _0x18a2c4;})});}_0x390c87=_[_0x23b8('0x33')]({},_0x390c87,_0x20eee6[_0x23b8('0x7d')]);return db[_0x23b8('0x48')][_0x23b8('0x12')]({'where':_0x390c87[_0x23b8('0x57')]})['then'](function(_0xb926e9){_0x399d72[_0x23b8('0x12')]=_0xb926e9;if(_0x20eee6['query'][_0x23b8('0x96')]){_0x390c87[_0x23b8('0x97')]=[{'all':!![]}];}return db[_0x23b8('0x48')][_0x23b8('0x1f')](_0x390c87);})['then'](function(_0x267ff1){_0x399d72['rows']=_0x267ff1;return _0x399d72;});}})[_0x23b8('0x17')](respondWithFilteredResult(_0x2bdf0b,_0x390c87))[_0x23b8('0x21')](handleError(_0x2bdf0b,null));};exports[_0x23b8('0x99')]=function(_0x330637,_0x51fb46){var _0x51241f={'raw':!![],'where':{}};var _0x4f3794={};var _0x143ba4={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x330637[_0x23b8('0x24')]['id']}})[_0x23b8('0x17')](handleEntityNotFound(_0x51fb46,null))['then'](function(_0x3215f5){if(_0x3215f5){_0x4f3794[_0x23b8('0x76')]=_[_0x23b8('0x26')](db[_0x23b8('0x9a')][_0x23b8('0x73')]);_0x4f3794[_0x23b8('0x20')]=_['keys'](_0x330637[_0x23b8('0x20')]);_0x4f3794['filters']=_[_0x23b8('0x75')](_0x4f3794[_0x23b8('0x76')],_0x4f3794[_0x23b8('0x20')]);_0x51241f[_0x23b8('0x77')]=_[_0x23b8('0x75')](_0x4f3794[_0x23b8('0x76')],qs[_0x23b8('0x78')](_0x330637[_0x23b8('0x20')][_0x23b8('0x78')]));_0x51241f[_0x23b8('0x77')]=_0x51241f[_0x23b8('0x77')][_0x23b8('0x27')]?_0x51241f['attributes']:_0x4f3794['model'];if(!_0x330637[_0x23b8('0x20')][_0x23b8('0x7e')](_0x23b8('0x7f'))){_0x51241f['limit']=qs[_0x23b8('0xf')](_0x330637[_0x23b8('0x20')][_0x23b8('0xf')]);_0x51241f['offset']=qs[_0x23b8('0x11')](_0x330637[_0x23b8('0x20')][_0x23b8('0x11')]);}_0x51241f[_0x23b8('0x79')]=qs['sort'](_0x330637[_0x23b8('0x20')][_0x23b8('0x7a')]);_0x51241f[_0x23b8('0x57')]=qs[_0x23b8('0x74')](_[_0x23b8('0x7b')](_0x330637[_0x23b8('0x20')],_0x4f3794[_0x23b8('0x74')]));_0x51241f[_0x23b8('0x57')]['ContactId']=_0x3215f5['id'];if(_0x330637[_0x23b8('0x20')]['filter']){_0x51241f[_0x23b8('0x57')]=_[_0x23b8('0x33')](_0x51241f[_0x23b8('0x57')],{'$or':_['map'](_0x51241f['attributes'],function(_0x4d25e7){var _0x1856c2={};_0x1856c2[_0x4d25e7]={'$like':'%'+_0x330637[_0x23b8('0x20')][_0x23b8('0x7c')]+'%'};return _0x1856c2;})});}_0x51241f=_['merge']({},_0x51241f,_0x330637[_0x23b8('0x7d')]);return db['CmHopperFinal']['count']({'where':_0x51241f[_0x23b8('0x57')]})['then'](function(_0x1eca5f){_0x143ba4['count']=_0x1eca5f;if(_0x330637['query'][_0x23b8('0x96')]){_0x51241f[_0x23b8('0x97')]=[{'all':!![]}];}return db[_0x23b8('0x9a')][_0x23b8('0x1f')](_0x51241f);})[_0x23b8('0x17')](function(_0x1ccadf){_0x143ba4[_0x23b8('0x9b')]=_0x1ccadf;return _0x143ba4;});}})['then'](respondWithFilteredResult(_0x51fb46,_0x51241f))['catch'](handleError(_0x51fb46,null));};exports[_0x23b8('0x9c')]=function(_0x463f0e,_0x3a0ee9){var _0x1a4967={'raw':!![],'where':{}};var _0x5a46c1={};var _0x3141b1={'count':0x0,'rows':[]};return db[_0x23b8('0x22')][_0x23b8('0x72')]({'where':{'id':_0x463f0e[_0x23b8('0x24')]['id']}})['then'](handleEntityNotFound(_0x3a0ee9,null))[_0x23b8('0x17')](function(_0x274754){if(_0x274754){_0x5a46c1['model']=_['keys'](db['JscriptySessionReport'][_0x23b8('0x73')]);_0x5a46c1[_0x23b8('0x20')]=_[_0x23b8('0x26')](_0x463f0e[_0x23b8('0x20')]);_0x5a46c1['filters']=_[_0x23b8('0x75')](_0x5a46c1[_0x23b8('0x76')],_0x5a46c1[_0x23b8('0x20')]);_0x1a4967[_0x23b8('0x77')]=_[_0x23b8('0x75')](_0x5a46c1[_0x23b8('0x76')],qs[_0x23b8('0x78')](_0x463f0e[_0x23b8('0x20')][_0x23b8('0x78')]));_0x1a4967['attributes']=_0x1a4967[_0x23b8('0x77')]['length']?_0x1a4967['attributes']:_0x5a46c1['model'];if(!_0x463f0e['query'][_0x23b8('0x7e')](_0x23b8('0x7f'))){_0x1a4967[_0x23b8('0xf')]=qs[_0x23b8('0xf')](_0x463f0e[_0x23b8('0x20')][_0x23b8('0xf')]);_0x1a4967[_0x23b8('0x11')]=qs[_0x23b8('0x11')](_0x463f0e[_0x23b8('0x20')][_0x23b8('0x11')]);}_0x1a4967[_0x23b8('0x79')]=qs[_0x23b8('0x7a')](_0x463f0e[_0x23b8('0x20')][_0x23b8('0x7a')]);_0x1a4967['where']=qs[_0x23b8('0x74')](_[_0x23b8('0x7b')](_0x463f0e[_0x23b8('0x20')],_0x5a46c1[_0x23b8('0x74')]));_0x1a4967[_0x23b8('0x57')][_0x23b8('0x98')]=_0x274754['id'];if(_0x463f0e[_0x23b8('0x20')]['filter']){_0x1a4967['where']=_[_0x23b8('0x33')](_0x1a4967[_0x23b8('0x57')],{'$or':_[_0x23b8('0x66')](_0x1a4967['attributes'],function(_0xae0d1a){var _0x319668={};_0x319668[_0xae0d1a]={'$like':'%'+_0x463f0e[_0x23b8('0x20')][_0x23b8('0x7c')]+'%'};return _0x319668;})});}_0x1a4967=_[_0x23b8('0x33')]({},_0x1a4967,_0x463f0e[_0x23b8('0x7d')]);return db[_0x23b8('0x4e')]['count']({'where':_0x1a4967[_0x23b8('0x57')]})[_0x23b8('0x17')](function(_0x15d180){_0x3141b1[_0x23b8('0x12')]=_0x15d180;if(_0x463f0e[_0x23b8('0x20')][_0x23b8('0x96')]){_0x1a4967[_0x23b8('0x97')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x1a4967);})[_0x23b8('0x17')](function(_0x1e72de){_0x3141b1['rows']=_0x1e72de;return _0x3141b1;});}})['then'](respondWithFilteredResult(_0x3a0ee9,_0x1a4967))[_0x23b8('0x21')](handleError(_0x3a0ee9,null));};exports['uploadCsv']=function(_0x4d1543,_0x1429f3){try{if(!_0x4d1543[_0x23b8('0x34')][_0x23b8('0x5a')]){throw new Error(_0x23b8('0x9d'));}if(!_0x4d1543[_0x23b8('0x34')][_0x23b8('0x9e')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x4d1543[_0x23b8('0x34')]['binding_values']){throw new Error(_0x23b8('0x9f'));}if(!_0x4d1543[_0x23b8('0x34')][_0x23b8('0xa0')]){throw new Error(_0x23b8('0xa1'));}var _0x45a5be=_0x4d1543[_0x23b8('0x34')][_0x23b8('0x9e')][_0x23b8('0xa2')](',');var _0x24f190=_0x4d1543[_0x23b8('0x34')][_0x23b8('0xa3')]['split'](',');if(!_0x45a5be[_0x23b8('0x27')]||!_0x24f190[_0x23b8('0x27')]||_0x45a5be['length']!==_0x24f190[_0x23b8('0x27')]){throw new Error(_0x23b8('0xa4'));}_0x4d1543['body'][_0x23b8('0x78')]=_['zipObject'](_0x45a5be,_0x24f190);if(!_0x4d1543[_0x23b8('0x34')][_0x23b8('0x78')][_0x23b8('0x70')]){throw new Error(_0x23b8('0xa5'));}if(!_0x4d1543[_0x23b8('0x34')][_0x23b8('0x78')][_0x23b8('0xa6')]){throw new Error(_0x23b8('0xa7'));}var _0xfeaf2d=path[_0x23b8('0x38')](config[_0x23b8('0xa8')],_0x23b8('0xa9'),_0x4d1543[_0x23b8('0xaa')][_0x23b8('0xab')]);fs['chmodSync'](_0xfeaf2d,parseInt('0777',0x8));var _0xbf26ec=require(_0x23b8('0xac'))[_0x23b8('0xad')](path[_0x23b8('0x38')](__dirname,'../../components/import/cm/csv'),[_0xfeaf2d,_0x4d1543[_0x23b8('0x34')][_0x23b8('0x9e')],_0x4d1543['body']['binding_values'],_0x4d1543['body']['ListId'],_0x4d1543[_0x23b8('0x34')][_0x23b8('0xae')],_0x4d1543['body'][_0x23b8('0x56')],_0x4d1543[_0x23b8('0x34')]['socket_timestamp']]);return _0x1429f3['status'](0xc8)[_0x23b8('0xe')]({'message':'File\x20uploaded\x20correctly!','pid':_0xbf26ec['pid']});}catch(_0x424d9f){return _0x1429f3['status'](0x1f4)[_0x23b8('0x1b')](_0x424d9f);}};exports['upload']=function(_0x4f821a,_0x5894e3){var _0x2e4514=fs[_0x23b8('0xaf')](_0x4f821a[_0x23b8('0xaa')][_0x23b8('0x1')]);Papa['parse'](_0x2e4514,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x581ae2){return _0x5894e3['status'](0xc8)[_0x23b8('0xe')]({'file':_0x4f821a['file'],'fields':_0x581ae2[_0x23b8('0xb0')][_0x23b8('0x78')]});}});};exports[_0x23b8('0xb1')]=function(_0x425eaf,_0x552149){return db[_0x23b8('0xb2')][_0x23b8('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})['then'](function(_0x3d61c0){var _0x4690bc=![];if(!_0x425eaf[_0x23b8('0x34')][_0x23b8('0x5a')]){throw new Error('No\x20ListId\x20specified');}if(!_0x425eaf[_0x23b8('0x34')]['binding'][_0x23b8('0x70')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x425eaf[_0x23b8('0x34')]['binding']['firstName']){throw new Error(_0x23b8('0xa7'));}if(!_0x425eaf['body'][_0x23b8('0xa0')]){throw new Error(_0x23b8('0xa1'));}var _0x1973e7=require(_0x23b8('0xac'))['fork'](path[_0x23b8('0x38')](__dirname,'../../components/import/cm/csv2'),[_0x425eaf[_0x23b8('0x24')]['id'],JSON['stringify'](_0x425eaf[_0x23b8('0x34')]),JSON[_0x23b8('0xb3')](_0x3d61c0)]);_0x1973e7['on']('message',function(){_0x4690bc=!![];return _0x552149[_0x23b8('0x13')](0xc8)[_0x23b8('0xe')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x1973e7[_0x23b8('0xb4')]});});_0x1973e7['on']('exit',function(_0x98dad){if(_0x98dad&&!_0x4690bc){return _0x552149[_0x23b8('0x13')](0x1f4)[_0x23b8('0xe')]({'message':'error\x20child\x20process','pid':_0x1973e7['pid']});}});})[_0x23b8('0x21')](handleError(_0x552149,null));};exports[_0x23b8('0xb5')]=function(_0x8c2e20,_0x12adb1){return db[_0x23b8('0xb2')][_0x23b8('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':_0x23b8('0xb6')}})[_0x23b8('0x17')](function(_0x3d5eb4){var _0x468146=![];if(!_0x8c2e20[_0x23b8('0x34')][_0x23b8('0x5a')]){throw new Error(_0x23b8('0x9d'));}if(!_0x8c2e20[_0x23b8('0x34')]['binding'][_0x23b8('0x70')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x8c2e20[_0x23b8('0x34')][_0x23b8('0xb7')]['firstName']){throw new Error(_0x23b8('0xa7'));}if(!_0x8c2e20[_0x23b8('0x34')][_0x23b8('0xa0')]){throw new Error(_0x23b8('0xa1'));}var _0x339601=require(_0x23b8('0xac'))[_0x23b8('0xad')](path[_0x23b8('0x38')](__dirname,_0x23b8('0xb8')),[_0x8c2e20[_0x23b8('0x24')]['id'],JSON['stringify'](_0x8c2e20[_0x23b8('0x34')]),JSON[_0x23b8('0xb3')](_0x3d5eb4)]);_0x339601['on'](_0x23b8('0xb9'),function(){_0x468146=!![];return _0x12adb1[_0x23b8('0x13')](0xc8)[_0x23b8('0xe')]({'message':_0x23b8('0xba'),'pid':_0x339601[_0x23b8('0xb4')]});});_0x339601['on'](_0x23b8('0xbb'),function(_0x6ef58a){if(_0x6ef58a&&!_0x468146){return _0x12adb1[_0x23b8('0x13')](0x1f4)[_0x23b8('0xe')]({'message':_0x23b8('0xbc'),'pid':_0x339601[_0x23b8('0xb4')]});}});})[_0x23b8('0x21')](handleError(_0x12adb1,null));};exports[_0x23b8('0xbd')]=function(_0x477e88,_0x1ae9a3){var _0x11f060=[_0x23b8('0xbe'),_0x23b8('0xbf'),_0x23b8('0xc0'),_0x23b8('0xc1'),_0x23b8('0xc2'),_0x23b8('0xc3'),_0x23b8('0xc4')];var _0x2a19f3={'offset':0x0,'order':qs[_0x23b8('0x7a')](_0x23b8('0xc5'))},_0x1fecc5={'count':0x0,'rows':[]};Promise[_0x23b8('0xc6')]()['then'](function(){if(_0x477e88[_0x23b8('0x20')][_0x23b8('0xc7')]){if(!_[_0x23b8('0xc8')](_0x11f060,_0x477e88['query'][_0x23b8('0xc7')][_0x23b8('0xc9')]())){throw new Error(_0x23b8('0xca'));}_0x11f060=[_0x477e88[_0x23b8('0x20')][_0x23b8('0xc7')][_0x23b8('0xc9')]()];}if(_0x477e88[_0x23b8('0x20')][_0x23b8('0xcb')]){try{var _0x43a44=JSON[_0x23b8('0xcc')](_0x477e88[_0x23b8('0x20')][_0x23b8('0xcb')]);if(!moment(_0x43a44['from'])[_0x23b8('0xcd')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x43a44['to'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x58c127){throw new Error(_0x23b8('0xce'));}}if(!_0x477e88[_0x23b8('0x20')][_0x23b8('0x7e')](_0x23b8('0x7f'))){_0x2a19f3[_0x23b8('0xf')]=qs[_0x23b8('0xf')](_0x477e88[_0x23b8('0x20')][_0x23b8('0xf')]||0xa);_0x2a19f3[_0x23b8('0x11')]=qs[_0x23b8('0x11')](_0x477e88[_0x23b8('0x20')][_0x23b8('0x11')]);}var _0x44b79b=_0x11f060[_0x23b8('0x66')](function(_0x4bb0b8){if(_0x4bb0b8===_0x23b8('0xc4')){var _0x454daa={'attributes':['id','uniqueid',_0x23b8('0x30'),_0x23b8('0xcf'),_0x23b8('0xd0'),'callerid','starttime','endtime','duration',_0x23b8('0xd1'),_0x23b8('0xd2'),_0x23b8('0xd3'),_0x23b8('0xd4'),_0x23b8('0xd5'),_0x23b8('0xd6')],'where':{'ContactId':_0x477e88['params']['id']},'include':[{'model':db['User'],'as':'User','attributes':['id',_0x23b8('0x1a'),'fullname',_0x23b8('0x2e')]}],'order':[[_0x23b8('0xd2'),_0x23b8('0xd7')]]};if(_0x477e88[_0x23b8('0x20')][_0x23b8('0xcb')]){_0x454daa['where'][_0x23b8('0xd2')]={'$gte':_0x43a44[_0x23b8('0x35')],'$lte':_0x43a44['to']};}return db['VoiceCallReport'][_0x23b8('0xd8')](_0x454daa)[_0x23b8('0x17')](function(_0x133cc6){_0x1fecc5[_0x23b8('0x12')]+=_0x133cc6[_0x23b8('0x12')];return _[_0x23b8('0x66')](_0x133cc6[_0x23b8('0x9b')],function(_0xcbfe1d){var _0x514bfd=_0xcbfe1d['get']({'plain':!![]});_0x514bfd[_0x23b8('0xc7')]=_0x4bb0b8;if(_0x514bfd[_0x23b8('0xb2')]){_0x514bfd[_0x23b8('0xb2')]={'id':_0x514bfd[_0x23b8('0xb2')]['id'],'name':_0x514bfd['User']['name'],'fullname':_0x514bfd['User'][_0x23b8('0xd9')],'alias':_0x514bfd[_0x23b8('0xb2')][_0x23b8('0x2e')]};}return _0x514bfd;});});}else{var _0x147846=_[_0x23b8('0xda')](_0x4bb0b8)+(_0x4bb0b8==='chat'?_0x23b8('0xdb'):_0x23b8('0xdc'));var _0x1a081f={'attributes':['id','closed',_0x23b8('0xdd'),_0x23b8('0xd2'),_0x23b8('0xd1'),_0x23b8('0xde'),'secondDisposition',_0x23b8('0xdf'),_0x23b8('0xd6'),_0x147846+'Id'],'where':{'ContactId':_0x477e88['params']['id']},'include':[{'model':db[_0x147846],'as':'Account','attributes':['id',_0x23b8('0x1a'),'key']},{'model':db[_0x23b8('0xb2')],'as':_0x23b8('0xe0'),'attributes':['id',_0x23b8('0x1a'),'fullname']},{'model':db[_0x23b8('0x5e')],'as':_0x23b8('0xe1'),'attributes':['id',_0x23b8('0x1a'),_0x23b8('0x5f')],'through':{'attributes':[]}}],'order':[[_0x23b8('0xd2'),_0x23b8('0xd7')]]};if(_0x477e88[_0x23b8('0x20')][_0x23b8('0xcb')]){_0x1a081f[_0x23b8('0x57')][_0x23b8('0xd2')]={'$gte':_0x43a44[_0x23b8('0x35')],'$lte':_0x43a44['to']};}switch(_0x4bb0b8){case _0x23b8('0xbf'):_0x1a081f[_0x23b8('0x77')]['push']('browserName',_0x23b8('0xe2'),'customerPort',_0x23b8('0xe3'),_0x23b8('0xe4'),_0x23b8('0xe5'),_0x23b8('0xe6'),_0x23b8('0xe7'),_0x23b8('0xe8'));break;case _0x23b8('0xbe'):_0x1a081f[_0x23b8('0x77')][_0x23b8('0x59')](_0x23b8('0xe9'),_0x23b8('0xea'));break;case _0x23b8('0xc1'):_0x1a081f['attributes'][_0x23b8('0x59')]('externalUrl','threadId');break;}return db[_[_0x23b8('0xda')](_0x4bb0b8)+'Interaction'][_0x23b8('0xd8')](_0x1a081f)[_0x23b8('0x17')](function(_0x3c1d89){_0x1fecc5[_0x23b8('0x12')]+=_0x3c1d89['count'];return _[_0x23b8('0x66')](_0x3c1d89[_0x23b8('0x9b')],function(_0x42da13){var _0x528f7a=_0x42da13[_0x23b8('0x36')]({'plain':!![]});_0x528f7a[_0x23b8('0xc7')]=_0x4bb0b8;if(_0x528f7a[_0x23b8('0xe0')]){_0x528f7a[_0x23b8('0xe0')]={'id':_0x528f7a[_0x23b8('0xe0')]['id'],'name':_0x528f7a[_0x23b8('0xe0')][_0x23b8('0x1a')],'fullname':_0x528f7a['Owner']['fullname']};}return _0x528f7a;});});}});return Promise[_0x23b8('0x5d')](_0x44b79b);})[_0x23b8('0x17')](function(_0x1c9bac){return _(_0x1c9bac)[_0x23b8('0xeb')]()[_0x23b8('0xec')](_0x23b8('0xd2'))[_0x23b8('0xed')]()[_0x23b8('0xee')]();})[_0x23b8('0x17')](function(_0x22a299){_0x1fecc5[_0x23b8('0x9b')]=_0x2a19f3['limit']?_0x22a299['slice'](_0x2a19f3[_0x23b8('0x11')],_0x2a19f3[_0x23b8('0x11')]+_0x2a19f3[_0x23b8('0xf')]):_0x22a299;return _0x1fecc5;})['then'](respondWithFilteredResult(_0x1ae9a3,_0x2a19f3))['catch'](handleError(_0x1ae9a3,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 94ee2fb..5127c5f 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 _0xda3b=['hasOwnProperty','hook','exports','CmContact','setMaxListeners','save','update','emit'];(function(_0x29a82,_0x54a407){var _0x5814d4=function(_0x373aec){while(--_0x373aec){_0x29a82['push'](_0x29a82['shift']());}};_0x5814d4(++_0x54a407);}(_0xda3b,0x16b));var _0xbda3=function(_0x3da241,_0xeba26a){_0x3da241=_0x3da241-0x0;var _0x43e156=_0xda3b[_0x3da241];return _0x43e156;};'use strict';var EventEmitter=require('events');var CmContact=require('../../mysqldb')['db'][_0xbda3('0x0')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xbda3('0x1')](0x0);var events={'afterCreate':_0xbda3('0x2'),'afterUpdate':_0xbda3('0x3'),'afterDestroy':'remove'};function emitEvent(_0x423c35){return function(_0x433383,_0x52820a,_0x4a1e15){CmContactEvents[_0xbda3('0x4')](_0x423c35+':'+_0x433383['id'],_0x433383);CmContactEvents[_0xbda3('0x4')](_0x423c35,_0x433383);_0x4a1e15(null);};}for(var e in events){if(events[_0xbda3('0x5')](e)){var event=events[e];CmContact[_0xbda3('0x6')](e,emitEvent(event));}}module[_0xbda3('0x7')]=CmContactEvents; \ No newline at end of file +var _0x357a=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','CmContact'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x357a,0x1b5));var _0xa357=function(_0x4ae12d,_0x238ec8){_0x4ae12d=_0x4ae12d-0x0;var _0x1a852d=_0x357a[_0x4ae12d];return _0x1a852d;};'use strict';var EventEmitter=require(_0xa357('0x0'));var CmContact=require(_0xa357('0x1'))['db'][_0xa357('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xa357('0x3')](0x0);var events={'afterCreate':_0xa357('0x4'),'afterUpdate':_0xa357('0x5'),'afterDestroy':_0xa357('0x6')};function emitEvent(_0x460cf2){return function(_0x2951f9,_0x366f4c,_0x4b682a){CmContactEvents[_0xa357('0x7')](_0x460cf2+':'+_0x2951f9['id'],_0x2951f9);CmContactEvents['emit'](_0x460cf2,_0x2951f9);_0x4b682a(null);};}for(var e in events){if(events[_0xa357('0x8')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xa357('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index c529467..9a88bf6 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 _0xb596=['[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','message','models','get','isEmpty','length','destroy','ContactId','CampaignId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','inspect','api','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','dialTimezone','resolve','then','isNil','timezones','utcOffset','add','ListId','YYYY-MM-DD\x20HH:mm:ss','priority','callbackUniqueid','phone','assign','CmHopper','findOne','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','create','always','onlyIfOpen','outbound','CmList','map','findAll','dialCheckDuplicateType','Lists','BlackLists','CmHopperBlack','all','define','cm_contacts','fti_cm_contacts','firstName','lastName','email','FULLTEXT','error'];(function(_0x5ff464,_0x5038d7){var _0x347182=function(_0xeef52c){while(--_0xeef52c){_0x5ff464['push'](_0x5ff464['shift']());}};_0x347182(++_0x5038d7);}(_0xb596,0xd0));var _0x6b59=function(_0x201d57,_0x2b714c){_0x201d57=_0x201d57-0x0;var _0x5dfec3=_0xb596[_0x201d57];return _0x5dfec3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6b59('0x0'));var moment=require('moment');var shared=require(_0x6b59('0x1'));var attributes=require(_0x6b59('0x2'));function getTimezoneCallbackAt(_0x3d239b,_0x531ff5,_0x84861,_0x17fc17){var _0x59866d=_0x17fc17?_0x6b59('0x3'):_0x6b59('0x4');var _0x516edb=_0x84861[_0x6b59('0x5')]?_0x84861[_0x6b59('0x5')]:moment()[_0x6b59('0x6')]('YYYY-MM-DD\x20HH:mm:ss');if(_['isNil'](_0x84861[_0x6b59('0x7')])){return Promise[_0x6b59('0x8')](_0x516edb);}return _0x3d239b[_0x59866d]['findOne']({'where':{'id':_0x531ff5}})[_0x6b59('0x9')](function(_0x359c16){if(_[_0x6b59('0xa')](_0x359c16)||_[_0x6b59('0xa')](_0x359c16[_0x6b59('0x7')])){return Promise[_0x6b59('0x8')](_0x516edb);}var _0x199c3e=shared[_0x6b59('0xb')];var _0x5c2657=_0x199c3e[_0x359c16['dialTimezone']];var _0x8558f2=_0x199c3e[_0x84861[_0x6b59('0x7')]];if(_[_0x6b59('0xa')](_0x5c2657)&&_[_0x6b59('0xa')](_0x8558f2)){return Promise[_0x6b59('0x8')](_0x516edb);}var _0x1e71cf=_0x5c2657[_0x6b59('0xc')]-_0x8558f2[_0x6b59('0xc')];var _0x561881=_0x84861['scheduledat']?_0x84861['scheduledat']:moment();_0x516edb=moment(_0x561881)[_0x6b59('0xd')](_0x1e71cf,'minutes')[_0x6b59('0x6')]('YYYY-MM-DD\x20HH:mm:ss');return Promise[_0x6b59('0x8')](_0x516edb);});}function getNewHopperPayload(_0x163cbf){return{'phone':_0x163cbf['phone'],'ContactId':_0x163cbf['id'],'ListId':_0x163cbf[_0x6b59('0xe')],'scheduledat':_0x163cbf[_0x6b59('0x5')]?_0x163cbf[_0x6b59('0x5')]:moment()[_0x6b59('0x6')](_0x6b59('0xf')),'priority':_0x163cbf[_0x6b59('0x10')]?_0x163cbf[_0x6b59('0x10')]:0x2,'callback':_0x163cbf[_0x6b59('0x11')]?!![]:![],'callbackuniqueid':_0x163cbf['callbackUniqueid']?_0x163cbf['callbackUniqueid']:undefined,'callbackat':_0x163cbf[_0x6b59('0x11')]?moment()[_0x6b59('0x6')](_0x6b59('0xf')):undefined};}function handleAlwaysCheckDuplicate(_0xe543f7,_0xd8f9ad,_0x235909,_0x188a66){var _0x350b7b={'phone':_0x235909['phone']};var _0x22f5f0={'calleridnum':_0x235909[_0x6b59('0x12')]};if(_0x188a66){Object['assign'](_0x350b7b,{'CampaignId':_0xd8f9ad['id']});Object[_0x6b59('0x13')](_0x22f5f0,{'CampaignId':_0xd8f9ad['id']});}else{Object['assign'](_0x350b7b,{'VoiceQueueId':_0xd8f9ad['id']});Object[_0x6b59('0x13')](_0x22f5f0,{'VoiceQueueId':_0xd8f9ad['id']});}return _0xe543f7[_0x6b59('0x14')][_0x6b59('0x15')]({'where':_0x350b7b})['then'](function(_0x559fd1){if(_0x559fd1){throw new Error(_0x6b59('0x16')+_0x235909['phone']+_0x6b59('0x17')+_0xd8f9ad['id']);}return _0xe543f7[_0x6b59('0x18')][_0x6b59('0x15')]({'where':_0x22f5f0});})['then'](function(_0x4e47e4){if(_0x4e47e4){throw new Error(_0x6b59('0x19')+_0x235909[_0x6b59('0x12')]+_0x6b59('0x17')+_0xd8f9ad['id']);}var _0x508e8b=getNewHopperPayload(_0x235909);if(_0x188a66){_0x508e8b['CampaignId']=_0xd8f9ad['id'];}else{_0x508e8b[_0x6b59('0x1a')]=_0xd8f9ad['id'];}return _0xe543f7['CmHopper']['create'](_0x508e8b);});}function handleOnlyIfOpenCheckDuplicate(_0x2f74dc,_0x489b2c,_0x247265,_0x9b2b4){var _0xb061ad={'phone':_0x247265[_0x6b59('0x12')]};if(_0x9b2b4){Object['assign'](_0xb061ad,{'CampaignId':_0x489b2c['id']});}else{Object['assign'](_0xb061ad,{'VoiceQueueId':_0x489b2c['id']});}return _0x2f74dc[_0x6b59('0x14')][_0x6b59('0x15')]({'where':_0xb061ad})[_0x6b59('0x9')](function(_0x30b434){if(_0x30b434){throw new Error(_0x6b59('0x1b')+_0x247265['phone']+'\x20in\x20Campaign\x20with\x20id\x20'+_0x489b2c['id']);}var _0x47771b=getNewHopperPayload(_0x247265);if(_0x9b2b4){_0x47771b['CampaignId']=_0x489b2c['id'];}else{_0x47771b['VoiceQueueId']=_0x489b2c['id'];}return _0x2f74dc[_0x6b59('0x14')][_0x6b59('0x1c')](_0x47771b);});}function handleNeverCheckDuplicate(_0x16d4db,_0x2cbe8b,_0x2d0fbd){var _0x33c10e=getNewHopperPayload(_0x2d0fbd);_0x33c10e[_0x6b59('0x1a')]=_0x2cbe8b['id'];return _0x16d4db[_0x6b59('0x14')][_0x6b59('0x1c')](_0x33c10e);}function handleCheckDuplicate(_0x59f5d0,_0x2dc475,_0x44e98a,_0x237eed){return getTimezoneCallbackAt(_0x59f5d0,_0x2dc475,_0x44e98a,_0x237eed)['then'](function(_0x4f1e21){_0x44e98a['scheduledat']=_0x4f1e21;switch(_0x2dc475['dialCheckDuplicateType']){case _0x6b59('0x1d'):return handleAlwaysCheckDuplicate(_0x59f5d0,_0x2dc475,_0x44e98a,_0x237eed);case _0x6b59('0x1e'):return handleOnlyIfOpenCheckDuplicate(_0x59f5d0,_0x2dc475,_0x44e98a,_0x237eed);default:return handleNeverCheckDuplicate(_0x59f5d0,_0x2dc475,_0x44e98a);}});}function createHopperForVoiceQueues(_0x1d8bef,_0x524632){return _0x1d8bef['VoiceQueue']['findAll']({'where':{'type':_0x6b59('0x1f')},'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x1d8bef[_0x6b59('0x20')],'as':'Lists','where':{'id':_0x524632[_0x6b59('0xe')]}}],'raw':!![]})[_0x6b59('0x9')](function(_0x512f1e){var _0x13aa66=_0x512f1e[_0x6b59('0x21')](function(_0x16dc25){return handleCheckDuplicate(_0x1d8bef,_0x16dc25,_0x524632,![]);});return Promise['all'](_0x13aa66);});}function createHopperForCampaigns(_0xcca898,_0x5690c9){return _0xcca898[_0x6b59('0x3')][_0x6b59('0x22')]({'attributes':['id',_0x6b59('0x23'),_0x6b59('0x7')],'include':[{'model':_0xcca898[_0x6b59('0x20')],'as':_0x6b59('0x24'),'where':{'id':_0x5690c9[_0x6b59('0xe')]}}],'raw':!![]})[_0x6b59('0x9')](function(_0x28d2a1){var _0x2e536c=_0x28d2a1[_0x6b59('0x21')](function(_0x2b1ddf){return handleCheckDuplicate(_0xcca898,_0x2b1ddf,_0x5690c9,!![]);});return Promise['all'](_0x2e536c);});}function createHopperBlackForVoiceQueues(_0x44c164,_0x454356){return _0x44c164[_0x6b59('0x4')][_0x6b59('0x22')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x44c164[_0x6b59('0x20')],'as':_0x6b59('0x25'),'where':{'id':_0x454356[_0x6b59('0xe')]}}],'raw':!![]})[_0x6b59('0x9')](function(_0x42c137){var _0x49bdad=_0x42c137['map'](function(_0x2a8489){return _0x44c164[_0x6b59('0x26')]['create']({'phone':_0x454356[_0x6b59('0x12')],'ContactId':_0x454356['id'],'ListId':_0x454356[_0x6b59('0xe')],'VoiceQueueId':_0x2a8489['id']});});return Promise[_0x6b59('0x27')](_0x49bdad);});}function createHopperBlackForCampaigns(_0x5dea3c,_0xd2fc10){return _0x5dea3c['Campaign'][_0x6b59('0x22')]({'attributes':['id'],'include':[{'model':_0x5dea3c[_0x6b59('0x20')],'as':_0x6b59('0x25'),'where':{'id':_0xd2fc10[_0x6b59('0xe')]}}],'raw':!![]})['then'](function(_0x1ce94a){var _0x5157f4=_0x1ce94a[_0x6b59('0x21')](function(_0x1a2392){return _0x5dea3c['CmHopperBlack'][_0x6b59('0x1c')]({'phone':_0xd2fc10['phone'],'ContactId':_0xd2fc10['id'],'ListId':_0xd2fc10[_0x6b59('0xe')],'CampaignId':_0x1a2392['id']});});return Promise['all'](_0x5157f4);});}module['exports']=function(_0x41bb3e){return _0x41bb3e[_0x6b59('0x28')]('CmContact',attributes,{'tableName':_0x6b59('0x29'),'paranoid':!![],'indexes':[{'name':_0x6b59('0x12'),'fields':['phone']},{'name':_0x6b59('0x2a'),'fields':[_0x6b59('0x2b'),_0x6b59('0x2c'),_0x6b59('0x12'),'mobile','fax',_0x6b59('0x2d')],'type':_0x6b59('0x2e')}],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x59ad47,_0x5f2a4a,_0x26a06f){var _0x56e7ae=_0x41bb3e['models'];var _0x22cbef=_0x59ad47['get']({'plain':!![]});if(!_0x22cbef[_0x6b59('0xe')]){logger[_0x6b59('0x2f')](_0x6b59('0x30')+_0x22cbef['id']);return _0x26a06f();}if(!_0x22cbef[_0x6b59('0x12')]){return _0x26a06f();}return createHopperForVoiceQueues(_0x56e7ae,_0x22cbef)['then'](function(){return createHopperBlackForVoiceQueues(_0x56e7ae,_0x22cbef);})['then'](function(){return createHopperForCampaigns(_0x56e7ae,_0x22cbef);})[_0x6b59('0x9')](function(){return createHopperBlackForCampaigns(_0x56e7ae,_0x22cbef);})[_0x6b59('0x9')](function(){return _0x26a06f();})[_0x6b59('0x31')](function(_0x547e6d){logger[_0x6b59('0x2f')](_0x6b59('0x32'),_0x547e6d[_0x6b59('0x33')]);_0x26a06f();});},'afterDestroy':function(_0x1cb887,_0x1e4814,_0x4156f3){var _0x24c57e=_0x41bb3e[_0x6b59('0x34')];var _0x22cbe8=_0x1cb887[_0x6b59('0x35')]({'plain':!![]});return _0x24c57e[_0x6b59('0x14')][_0x6b59('0x22')]({'raw':!![],'where':{'ListId':_0x22cbe8[_0x6b59('0xe')],'ContactId':_0x22cbe8['id']}})['then'](function(_0x599f0f){if(!_[_0x6b59('0x36')](_0x599f0f)){var _0x2e8869=[];for(var _0x4bd0b7=0x0;_0x4bd0b7<_0x599f0f[_0x6b59('0x37')];_0x4bd0b7+=0x1){var _0x3db20e=_0x24c57e['CmHopper'][_0x6b59('0x38')]({'where':{'ListId':_0x599f0f[_0x4bd0b7]['ListId'],'ContactId':_0x599f0f[_0x4bd0b7][_0x6b59('0x39')],'VoiceQueueId':_0x599f0f[_0x4bd0b7][_0x6b59('0x1a')],'CampaignId':_0x599f0f[_0x4bd0b7][_0x6b59('0x3a')]}});_0x2e8869[_0x6b59('0x3b')](_0x3db20e);}return Promise[_0x6b59('0x27')](_0x2e8869);}})['then'](function(_0x10c3cc){logger[_0x6b59('0x3c')](_0x6b59('0x3d'),util['inspect'](_0x10c3cc,{'showHidden':![],'depth':null}));_0x4156f3();})[_0x6b59('0x31')](function(_0x2cf358){logger['error'](_0x6b59('0x3e'),util[_0x6b59('0x3f')](_0x2cf358,{'showHidden':![],'depth':null}));_0x4156f3(_0x2cf358);});}}});}; \ No newline at end of file +var _0xc060=['lodash','util','../../config/logger','moment','./cmContact.attributes','Campaign','VoiceQueue','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','resolve','findOne','then','isNil','timezones','utcOffset','scheduledat','minutes','phone','ListId','priority','callbackUniqueid','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CmHopperFinal','\x20in\x20Campaign\x20with\x20id\x20','CampaignId','VoiceQueueId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','dialCheckDuplicateType','onlyIfOpen','Lists','all','map','findAll','outbound','BlackLists','CmHopperBlack','exports','define','cm_contacts','fti_cm_contacts','firstName','lastName','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','message','isEmpty','ContactId','push','info','[CmContact][afterDestroy][Succesfull]','inspect'];(function(_0x36c87d,_0x2ab247){var _0x54dc55=function(_0x2b4112){while(--_0x2b4112){_0x36c87d['push'](_0x36c87d['shift']());}};_0x54dc55(++_0x2ab247);}(_0xc060,0xb7));var _0x0c06=function(_0x25f9ae,_0x18ed85){_0x25f9ae=_0x25f9ae-0x0;var _0x3f2ab0=_0xc060[_0x25f9ae];return _0x3f2ab0;};'use strict';var _=require(_0x0c06('0x0'));var util=require(_0x0c06('0x1'));var logger=require(_0x0c06('0x2'))('api');var moment=require(_0x0c06('0x3'));var shared=require('../../config/environment/shared');var attributes=require(_0x0c06('0x4'));function getTimezoneCallbackAt(_0x58bc4c,_0x1b2f85,_0x4ece1f,_0x1d6791){var _0x3af9c2=_0x1d6791?_0x0c06('0x5'):_0x0c06('0x6');var _0x429605=_0x4ece1f['scheduledat']?_0x4ece1f['scheduledat']:moment()[_0x0c06('0x7')](_0x0c06('0x8'));if(_['isNil'](_0x4ece1f[_0x0c06('0x9')])){return Promise[_0x0c06('0xa')](_0x429605);}return _0x58bc4c[_0x3af9c2][_0x0c06('0xb')]({'where':{'id':_0x1b2f85}})[_0x0c06('0xc')](function(_0x2a4585){if(_[_0x0c06('0xd')](_0x2a4585)||_[_0x0c06('0xd')](_0x2a4585['dialTimezone'])){return Promise[_0x0c06('0xa')](_0x429605);}var _0x1c582a=shared[_0x0c06('0xe')];var _0x24afaa=_0x1c582a[_0x2a4585[_0x0c06('0x9')]];var _0x477bca=_0x1c582a[_0x4ece1f['dialTimezone']];if(_['isNil'](_0x24afaa)&&_['isNil'](_0x477bca)){return Promise[_0x0c06('0xa')](_0x429605);}var _0xae1c21=_0x24afaa[_0x0c06('0xf')]-_0x477bca[_0x0c06('0xf')];var _0x9853a1=_0x4ece1f[_0x0c06('0x10')]?_0x4ece1f[_0x0c06('0x10')]:moment();_0x429605=moment(_0x9853a1)['add'](_0xae1c21,_0x0c06('0x11'))['format'](_0x0c06('0x8'));return Promise['resolve'](_0x429605);});}function getNewHopperPayload(_0x29a2e8){return{'phone':_0x29a2e8[_0x0c06('0x12')],'ContactId':_0x29a2e8['id'],'ListId':_0x29a2e8[_0x0c06('0x13')],'scheduledat':_0x29a2e8[_0x0c06('0x10')]?_0x29a2e8['scheduledat']:moment()['format'](_0x0c06('0x8')),'priority':_0x29a2e8['priority']?_0x29a2e8[_0x0c06('0x14')]:0x2,'callback':_0x29a2e8[_0x0c06('0x15')]?!![]:![],'callbackuniqueid':_0x29a2e8[_0x0c06('0x15')]?_0x29a2e8[_0x0c06('0x15')]:undefined,'callbackat':_0x29a2e8[_0x0c06('0x15')]?moment()[_0x0c06('0x7')](_0x0c06('0x8')):undefined};}function handleAlwaysCheckDuplicate(_0x2d7902,_0x49b5a7,_0x2742d8,_0x208932){var _0x419605={'phone':_0x2742d8[_0x0c06('0x12')]};var _0x226d76={'calleridnum':_0x2742d8[_0x0c06('0x12')]};if(_0x208932){Object[_0x0c06('0x16')](_0x419605,{'CampaignId':_0x49b5a7['id']});Object['assign'](_0x226d76,{'CampaignId':_0x49b5a7['id']});}else{Object['assign'](_0x419605,{'VoiceQueueId':_0x49b5a7['id']});Object['assign'](_0x226d76,{'VoiceQueueId':_0x49b5a7['id']});}return _0x2d7902[_0x0c06('0x17')][_0x0c06('0xb')]({'where':_0x419605})['then'](function(_0x2b400f){if(_0x2b400f){throw new Error(_0x0c06('0x18')+_0x2742d8[_0x0c06('0x12')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x49b5a7['id']);}return _0x2d7902[_0x0c06('0x19')]['findOne']({'where':_0x226d76});})[_0x0c06('0xc')](function(_0x388da3){if(_0x388da3){throw new Error('[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x2742d8[_0x0c06('0x12')]+_0x0c06('0x1a')+_0x49b5a7['id']);}var _0x1e16ef=getNewHopperPayload(_0x2742d8);if(_0x208932){_0x1e16ef[_0x0c06('0x1b')]=_0x49b5a7['id'];}else{_0x1e16ef[_0x0c06('0x1c')]=_0x49b5a7['id'];}return _0x2d7902[_0x0c06('0x17')][_0x0c06('0x1d')](_0x1e16ef);});}function handleOnlyIfOpenCheckDuplicate(_0x3833a7,_0x8f6117,_0x26d402,_0xe87645){var _0x659f57={'phone':_0x26d402[_0x0c06('0x12')]};if(_0xe87645){Object['assign'](_0x659f57,{'CampaignId':_0x8f6117['id']});}else{Object[_0x0c06('0x16')](_0x659f57,{'VoiceQueueId':_0x8f6117['id']});}return _0x3833a7[_0x0c06('0x17')][_0x0c06('0xb')]({'where':_0x659f57})[_0x0c06('0xc')](function(_0x2f2642){if(_0x2f2642){throw new Error(_0x0c06('0x1e')+_0x26d402[_0x0c06('0x12')]+_0x0c06('0x1a')+_0x8f6117['id']);}var _0xe08b06=getNewHopperPayload(_0x26d402);if(_0xe87645){_0xe08b06[_0x0c06('0x1b')]=_0x8f6117['id'];}else{_0xe08b06[_0x0c06('0x1c')]=_0x8f6117['id'];}return _0x3833a7[_0x0c06('0x17')]['create'](_0xe08b06);});}function handleNeverCheckDuplicate(_0x26fbcf,_0x3377cd,_0x38eeae){var _0x2b7d67=getNewHopperPayload(_0x38eeae);_0x2b7d67[_0x0c06('0x1c')]=_0x3377cd['id'];return _0x26fbcf['CmHopper']['create'](_0x2b7d67);}function handleCheckDuplicate(_0x4c72e1,_0x48d86e,_0x59e9c7,_0x43c58d){return getTimezoneCallbackAt(_0x4c72e1,_0x48d86e,_0x59e9c7,_0x43c58d)[_0x0c06('0xc')](function(_0x5af022){_0x59e9c7[_0x0c06('0x10')]=_0x5af022;switch(_0x48d86e[_0x0c06('0x1f')]){case'always':return handleAlwaysCheckDuplicate(_0x4c72e1,_0x48d86e,_0x59e9c7,_0x43c58d);case _0x0c06('0x20'):return handleOnlyIfOpenCheckDuplicate(_0x4c72e1,_0x48d86e,_0x59e9c7,_0x43c58d);default:return handleNeverCheckDuplicate(_0x4c72e1,_0x48d86e,_0x59e9c7);}});}function createHopperForVoiceQueues(_0x13923a,_0x3da3e2){return _0x13923a[_0x0c06('0x6')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x0c06('0x1f'),'dialTimezone'],'include':[{'model':_0x13923a['CmList'],'as':_0x0c06('0x21'),'where':{'id':_0x3da3e2[_0x0c06('0x13')]}}],'raw':!![]})[_0x0c06('0xc')](function(_0x41483c){var _0x35f68a=_0x41483c['map'](function(_0x4952d3){return handleCheckDuplicate(_0x13923a,_0x4952d3,_0x3da3e2,![]);});return Promise[_0x0c06('0x22')](_0x35f68a);});}function createHopperForCampaigns(_0x3fa366,_0x2adb97){return _0x3fa366[_0x0c06('0x5')]['findAll']({'attributes':['id',_0x0c06('0x1f'),_0x0c06('0x9')],'include':[{'model':_0x3fa366['CmList'],'as':_0x0c06('0x21'),'where':{'id':_0x2adb97[_0x0c06('0x13')]}}],'raw':!![]})[_0x0c06('0xc')](function(_0x392d94){var _0x5b7d56=_0x392d94[_0x0c06('0x23')](function(_0x1fa27b){return handleCheckDuplicate(_0x3fa366,_0x1fa27b,_0x2adb97,!![]);});return Promise[_0x0c06('0x22')](_0x5b7d56);});}function createHopperBlackForVoiceQueues(_0x1d27c0,_0x1eae89){return _0x1d27c0[_0x0c06('0x6')][_0x0c06('0x24')]({'where':{'type':_0x0c06('0x25')},'attributes':['id'],'include':[{'model':_0x1d27c0['CmList'],'as':_0x0c06('0x26'),'where':{'id':_0x1eae89[_0x0c06('0x13')]}}],'raw':!![]})[_0x0c06('0xc')](function(_0x2db3a7){var _0x2b4b10=_0x2db3a7[_0x0c06('0x23')](function(_0x2941f1){return _0x1d27c0[_0x0c06('0x27')][_0x0c06('0x1d')]({'phone':_0x1eae89[_0x0c06('0x12')],'ContactId':_0x1eae89['id'],'ListId':_0x1eae89[_0x0c06('0x13')],'VoiceQueueId':_0x2941f1['id']});});return Promise[_0x0c06('0x22')](_0x2b4b10);});}function createHopperBlackForCampaigns(_0x3aec9d,_0x3f52ca){return _0x3aec9d['Campaign']['findAll']({'attributes':['id'],'include':[{'model':_0x3aec9d['CmList'],'as':_0x0c06('0x26'),'where':{'id':_0x3f52ca[_0x0c06('0x13')]}}],'raw':!![]})[_0x0c06('0xc')](function(_0x2b7a16){var _0x3aebd2=_0x2b7a16[_0x0c06('0x23')](function(_0x313344){return _0x3aec9d['CmHopperBlack'][_0x0c06('0x1d')]({'phone':_0x3f52ca['phone'],'ContactId':_0x3f52ca['id'],'ListId':_0x3f52ca['ListId'],'CampaignId':_0x313344['id']});});return Promise[_0x0c06('0x22')](_0x3aebd2);});}module[_0x0c06('0x28')]=function(_0x480eb1){return _0x480eb1[_0x0c06('0x29')]('CmContact',attributes,{'tableName':_0x0c06('0x2a'),'paranoid':!![],'indexes':[{'name':_0x0c06('0x12'),'fields':[_0x0c06('0x12')]},{'name':_0x0c06('0x2b'),'fields':[_0x0c06('0x2c'),_0x0c06('0x2d'),_0x0c06('0x12'),'mobile',_0x0c06('0x2e'),_0x0c06('0x2f')],'type':_0x0c06('0x30')}],'timestamps':!![],'charset':_0x0c06('0x31'),'collate':_0x0c06('0x32'),'hooks':{'afterCreate':function(_0x1674b1,_0x381256,_0x23ac41){var _0x3a9489=_0x480eb1[_0x0c06('0x33')];var _0x19bb36=_0x1674b1['get']({'plain':!![]});if(!_0x19bb36[_0x0c06('0x13')]){logger[_0x0c06('0x34')](_0x0c06('0x35')+_0x19bb36['id']);return _0x23ac41();}if(!_0x19bb36[_0x0c06('0x12')]){return _0x23ac41();}return createHopperForVoiceQueues(_0x3a9489,_0x19bb36)[_0x0c06('0xc')](function(){return createHopperBlackForVoiceQueues(_0x3a9489,_0x19bb36);})[_0x0c06('0xc')](function(){return createHopperForCampaigns(_0x3a9489,_0x19bb36);})[_0x0c06('0xc')](function(){return createHopperBlackForCampaigns(_0x3a9489,_0x19bb36);})[_0x0c06('0xc')](function(){return _0x23ac41();})['catch'](function(_0x21b6e6){logger[_0x0c06('0x34')]('[cmContact][afterCreate]',_0x21b6e6[_0x0c06('0x36')]);_0x23ac41();});},'afterDestroy':function(_0x2f5ae9,_0x2aa451,_0x1fc753){var _0x83a334=_0x480eb1[_0x0c06('0x33')];var _0x3a15e1=_0x2f5ae9['get']({'plain':!![]});return _0x83a334['CmHopper'][_0x0c06('0x24')]({'raw':!![],'where':{'ListId':_0x3a15e1[_0x0c06('0x13')],'ContactId':_0x3a15e1['id']}})[_0x0c06('0xc')](function(_0x5346bc){if(!_[_0x0c06('0x37')](_0x5346bc)){var _0x25ea01=[];for(var _0x3ab31c=0x0;_0x3ab31c<_0x5346bc['length'];_0x3ab31c+=0x1){var _0xecd756=_0x83a334['CmHopper']['destroy']({'where':{'ListId':_0x5346bc[_0x3ab31c]['ListId'],'ContactId':_0x5346bc[_0x3ab31c][_0x0c06('0x38')],'VoiceQueueId':_0x5346bc[_0x3ab31c][_0x0c06('0x1c')],'CampaignId':_0x5346bc[_0x3ab31c][_0x0c06('0x1b')]}});_0x25ea01[_0x0c06('0x39')](_0xecd756);}return Promise['all'](_0x25ea01);}})[_0x0c06('0xc')](function(_0x2dd8fd){logger[_0x0c06('0x3a')](_0x0c06('0x3b'),util[_0x0c06('0x3c')](_0x2dd8fd,{'showHidden':![],'depth':null}));_0x1fc753();})['catch'](function(_0x480849){logger['error']('[CmContact][afterDestroy][Error]',util[_0x0c06('0x3c')](_0x480849,{'showHidden':![],'depth':null}));_0x1fc753(_0x480849);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index b81c0a2..9d5be0b 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(_0x3ec637,_0x36115d){var _0x2da084=function(_0x582d0f){while(--_0x582d0f){_0x3ec637['push'](_0x3ec637['shift']());}};_0x2da084(++_0x36115d);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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(_0x2228e6,_0x4b66ae){var _0xb09aae=function(_0x545eb5){while(--_0x545eb5){_0x2228e6['push'](_0x2228e6['shift']());}};_0xb09aae(++_0x4b66ae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 07adc64..119d1a9 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 _0xb2b3=['INTEGER','STRING','PHONE','sequelize','exports'];(function(_0x5b937e,_0x72a23){var _0x46ee99=function(_0x2d3753){while(--_0x2d3753){_0x5b937e['push'](_0x5b937e['shift']());}};_0x46ee99(++_0x72a23);}(_0xb2b3,0x71));var _0x3b2b=function(_0x3a319a,_0x3d9bb6){_0x3a319a=_0x3a319a-0x0;var _0x199bee=_0xb2b3[_0x3a319a];return _0x199bee;};'use strict';var Sequelize=require(_0x3b2b('0x0'));module[_0x3b2b('0x1')]={'CmContactId':{'type':Sequelize[_0x3b2b('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x3b2b('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x3b2b('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x3b2b('0x3')],'defaultValue':_0x3b2b('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x3b2b('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0xe186=['PHONE','sequelize','exports','STRING','INTEGER'];(function(_0x4e43bc,_0x7e35c){var _0x508820=function(_0xf9384d){while(--_0xf9384d){_0x4e43bc['push'](_0x4e43bc['shift']());}};_0x508820(++_0x7e35c);}(_0xe186,0x146));var _0x6e18=function(_0x1e2e92,_0x42d27c){_0x1e2e92=_0x1e2e92-0x0;var _0x5737af=_0xe186[_0x1e2e92];return _0x5737af;};'use strict';var Sequelize=require(_0x6e18('0x0'));module[_0x6e18('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x6e18('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x6e18('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x6e18('0x2')],'defaultValue':_0x6e18('0x4')},'OrderBy':{'type':Sequelize[_0x6e18('0x3')],'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 f896d02..7b00871 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 _0xe82c=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','get','CmContactHasItems','UserProfileResource','destroy','error','name','send','index','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','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','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3fb18b,_0x4b6e5e){var _0x5f0cf9=function(_0x12b5d3){while(--_0x12b5d3){_0x3fb18b['push'](_0x3fb18b['shift']());}};_0x5f0cf9(++_0x4b6e5e);}(_0xe82c,0x92));var _0xce82=function(_0x44f947,_0x59cbbd){_0x44f947=_0x44f947-0x0;var _0x44eaa9=_0xe82c[_0x44f947];return _0x44eaa9;};'use strict';var emlformat=require(_0xce82('0x0'));var rimraf=require(_0xce82('0x1'));var zipdir=require(_0xce82('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xce82('0x3'));var BPromise=require(_0xce82('0x4'));var Mustache=require(_0xce82('0x5'));var util=require(_0xce82('0x6'));var path=require(_0xce82('0x7'));var sox=require(_0xce82('0x8'));var csv=require('to-csv');var ejs=require(_0xce82('0x9'));var fs=require('fs');var fs_extra=require(_0xce82('0xa'));var _=require(_0xce82('0xb'));var squel=require(_0xce82('0xc'));var crypto=require(_0xce82('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xce82('0xe'));var toCsv=require('to-csv');var querystring=require(_0xce82('0xf'));var Papa=require(_0xce82('0x10'));var Redis=require(_0xce82('0x11'));var authService=require(_0xce82('0x12'));var qs=require(_0xce82('0x13'));var as=require(_0xce82('0x14'));var hardwareService=require(_0xce82('0x15'));var logger=require(_0xce82('0x16'))(_0xce82('0x17'));var utils=require(_0xce82('0x18'));var config=require(_0xce82('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xce82('0x1a'))['db'];function respondWithStatusCode(_0x31ec26,_0x774338){_0x774338=_0x774338||0xcc;return function(_0x292d8f){if(_0x292d8f){return _0x31ec26[_0xce82('0x1b')](_0x774338);}return _0x31ec26[_0xce82('0x1c')](_0x774338)[_0xce82('0x1d')]();};}function respondWithResult(_0x2ac386,_0x391cbc){_0x391cbc=_0x391cbc||0xc8;return function(_0x131238){if(_0x131238){return _0x2ac386[_0xce82('0x1c')](_0x391cbc)[_0xce82('0x1e')](_0x131238);}};}function respondWithFilteredResult(_0x59f3be,_0x2b1adb){return function(_0x1249dd){if(_0x1249dd){var _0x29dab9=typeof _0x2b1adb[_0xce82('0x1f')]===_0xce82('0x20')&&typeof _0x2b1adb[_0xce82('0x21')]===_0xce82('0x20');var _0x293164=_0x1249dd['count'];var _0x351a40=_0x29dab9?0x0:_0x2b1adb[_0xce82('0x1f')];var _0x384703=_0x29dab9?_0x1249dd[_0xce82('0x22')]:_0x2b1adb[_0xce82('0x1f')]+_0x2b1adb['limit'];var _0x2d3c7c;if(_0x384703>=_0x293164){_0x384703=_0x293164;_0x2d3c7c=0xc8;}else{_0x2d3c7c=0xce;}_0x59f3be[_0xce82('0x1c')](_0x2d3c7c);return _0x59f3be[_0xce82('0x23')](_0xce82('0x24'),_0x351a40+'-'+_0x384703+'/'+_0x293164)[_0xce82('0x1e')](_0x1249dd);}return null;};}function patchUpdates(_0x280699){return function(_0xe0d4c0){try{jsonpatch[_0xce82('0x25')](_0xe0d4c0,_0x280699,!![]);}catch(_0x17c628){return BPromise['reject'](_0x17c628);}return _0xe0d4c0['save']();};}function saveUpdates(_0x10b6be,_0xbbb667){return function(_0x49a7b5){if(_0x49a7b5){return _0x49a7b5[_0xce82('0x26')](_0x10b6be)['then'](function(_0xc6ba36){return _0xc6ba36;});}return null;};}function removeEntity(_0x13f901,_0xca0571){return function(_0x5967fa){if(_0x5967fa){return _0x5967fa['destroy']()[_0xce82('0x27')](function(){var _0x359430=_0x5967fa[_0xce82('0x28')]({'plain':!![]});var _0xfa44fc=_0xce82('0x29');return db[_0xce82('0x2a')][_0xce82('0x2b')]({'where':{'type':_0xfa44fc,'resourceId':_0x359430['id']}})[_0xce82('0x27')](function(){return _0x5967fa;});})[_0xce82('0x27')](function(){_0x13f901[_0xce82('0x1c')](0xcc)[_0xce82('0x1d')]();});}};}function handleEntityNotFound(_0x4fdfe3,_0x1057fa){return function(_0x449187){if(!_0x449187){_0x4fdfe3[_0xce82('0x1b')](0x194);}return _0x449187;};}function handleError(_0x2b3400,_0x2b2fb6){_0x2b2fb6=_0x2b2fb6||0x1f4;return function(_0x4a4ff5){logger[_0xce82('0x2c')](_0x4a4ff5['stack']);if(_0x4a4ff5[_0xce82('0x2d')]){delete _0x4a4ff5[_0xce82('0x2d')];}_0x2b3400[_0xce82('0x1c')](_0x2b2fb6)[_0xce82('0x2e')](_0x4a4ff5);};}exports[_0xce82('0x2f')]=function(_0x125337,_0xb2a7ba){var _0x1382c1={},_0x4c7539={},_0x3953d4={'count':0x0,'rows':[]};var _0x5502ca=_['map'](db[_0xce82('0x30')][_0xce82('0x31')],function(_0x39a24){return{'name':_0x39a24[_0xce82('0x32')],'type':_0x39a24[_0xce82('0x33')][_0xce82('0x34')]};});_0x4c7539[_0xce82('0x35')]=_['map'](_0x5502ca,_0xce82('0x2d'));_0x4c7539[_0xce82('0x36')]=_[_0xce82('0x37')](_0x125337['query']);_0x4c7539[_0xce82('0x38')]=_[_0xce82('0x39')](_0x4c7539['model'],_0x4c7539[_0xce82('0x36')]);_0x1382c1['attributes']=_[_0xce82('0x39')](_0x4c7539['model'],qs[_0xce82('0x3a')](_0x125337[_0xce82('0x36')][_0xce82('0x3a')]));_0x1382c1[_0xce82('0x3b')]=_0x1382c1[_0xce82('0x3b')][_0xce82('0x3c')]?_0x1382c1[_0xce82('0x3b')]:_0x4c7539[_0xce82('0x35')];if(!_0x125337[_0xce82('0x36')][_0xce82('0x3d')](_0xce82('0x3e'))){_0x1382c1[_0xce82('0x21')]=qs[_0xce82('0x21')](_0x125337[_0xce82('0x36')][_0xce82('0x21')]);_0x1382c1[_0xce82('0x1f')]=qs[_0xce82('0x1f')](_0x125337[_0xce82('0x36')][_0xce82('0x1f')]);}_0x1382c1[_0xce82('0x3f')]=qs[_0xce82('0x40')](_0x125337[_0xce82('0x36')]['sort']);_0x1382c1[_0xce82('0x41')]=qs[_0xce82('0x38')](_[_0xce82('0x42')](_0x125337[_0xce82('0x36')],_0x4c7539['filters']),_0x5502ca);if(_0x125337['query']['filter']){_0x1382c1[_0xce82('0x41')]=_['merge'](_0x1382c1[_0xce82('0x41')],{'$or':_['map'](_0x5502ca,function(_0xa0ae51){if(_0xa0ae51[_0xce82('0x33')]!=='VIRTUAL'){var _0x1b7ec8={};_0x1b7ec8[_0xa0ae51['name']]={'$like':'%'+_0x125337[_0xce82('0x36')][_0xce82('0x43')]+'%'};return _0x1b7ec8;}})});}_0x1382c1=_[_0xce82('0x44')]({},_0x1382c1,_0x125337[_0xce82('0x45')]);var _0x24ea29={'where':_0x1382c1[_0xce82('0x41')]};return db[_0xce82('0x30')]['count'](_0x24ea29)['then'](function(_0x32e90d){_0x3953d4[_0xce82('0x22')]=_0x32e90d;if(_0x125337[_0xce82('0x36')][_0xce82('0x46')]){_0x1382c1['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0xce82('0x47')](_0x1382c1);})[_0xce82('0x27')](function(_0x1929e2){_0x3953d4[_0xce82('0x48')]=_0x1929e2;return _0x3953d4;})['then'](respondWithFilteredResult(_0xb2a7ba,_0x1382c1))[_0xce82('0x49')](handleError(_0xb2a7ba,null));};exports[_0xce82('0x4a')]=function(_0x942e87,_0x54c280){var _0x21901f={'raw':!![],'where':{'id':_0x942e87[_0xce82('0x4b')]['id']}},_0x4e4d8c={};_0x4e4d8c['model']=_[_0xce82('0x37')](db[_0xce82('0x30')]['rawAttributes']);_0x4e4d8c[_0xce82('0x36')]=_['keys'](_0x942e87[_0xce82('0x36')]);_0x4e4d8c['filters']=_[_0xce82('0x39')](_0x4e4d8c[_0xce82('0x35')],_0x4e4d8c[_0xce82('0x36')]);_0x21901f[_0xce82('0x3b')]=_[_0xce82('0x39')](_0x4e4d8c[_0xce82('0x35')],qs[_0xce82('0x3a')](_0x942e87[_0xce82('0x36')][_0xce82('0x3a')]));_0x21901f[_0xce82('0x3b')]=_0x21901f['attributes'][_0xce82('0x3c')]?_0x21901f[_0xce82('0x3b')]:_0x4e4d8c['model'];if(_0x942e87[_0xce82('0x36')]['includeAll']){_0x21901f[_0xce82('0x4c')]=[{'all':!![]}];}_0x21901f=_['merge']({},_0x21901f,_0x942e87[_0xce82('0x45')]);return db[_0xce82('0x30')][_0xce82('0x4d')](_0x21901f)['then'](handleEntityNotFound(_0x54c280,null))[_0xce82('0x27')](respondWithResult(_0x54c280,null))[_0xce82('0x49')](handleError(_0x54c280,null));};exports[_0xce82('0x4e')]=function(_0x1df801,_0x3334ea){return db[_0xce82('0x30')][_0xce82('0x4e')](_0x1df801[_0xce82('0x4f')],{})['then'](function(_0x50e0de){var _0x4cb24d=_0x1df801[_0xce82('0x50')][_0xce82('0x28')]({'plain':!![]});if(!_0x4cb24d)throw new Error(_0xce82('0x51'));if(_0x4cb24d[_0xce82('0x52')]===_0xce82('0x50')){var _0x4af075=_0x50e0de[_0xce82('0x28')]({'plain':!![]});var _0x1cd60f=_0xce82('0x29');return db[_0xce82('0x53')]['find']({'where':{'name':_0x1cd60f,'userProfileId':_0x4cb24d['userProfileId']},'raw':!![]})[_0xce82('0x27')](function(_0x68406c){if(_0x68406c&&_0x68406c[_0xce82('0x54')]===0x0){return db[_0xce82('0x2a')][_0xce82('0x4e')]({'name':_0x4af075[_0xce82('0x2d')],'resourceId':_0x4af075['id'],'type':_0x68406c[_0xce82('0x2d')],'sectionId':_0x68406c['id']},{})['then'](function(){return _0x50e0de;});}else{return _0x50e0de;}})[_0xce82('0x49')](function(_0x5d33d0){logger['error'](_0xce82('0x55'),_0x5d33d0);throw _0x5d33d0;});}return _0x50e0de;})[_0xce82('0x27')](respondWithResult(_0x3334ea,0xc9))[_0xce82('0x49')](handleError(_0x3334ea,null));};exports[_0xce82('0x26')]=function(_0xc2357,_0x27c79b){if(_0xc2357[_0xce82('0x4f')]['id']){delete _0xc2357[_0xce82('0x4f')]['id'];}return db['CmContactHasItem'][_0xce82('0x4d')]({'where':{'id':_0xc2357[_0xce82('0x4b')]['id']}})[_0xce82('0x27')](handleEntityNotFound(_0x27c79b,null))[_0xce82('0x27')](saveUpdates(_0xc2357[_0xce82('0x4f')],null))[_0xce82('0x27')](respondWithResult(_0x27c79b,null))[_0xce82('0x49')](handleError(_0x27c79b,null));};exports['destroy']=function(_0x3418ca,_0x347618){return db[_0xce82('0x30')][_0xce82('0x4d')]({'where':{'id':_0x3418ca[_0xce82('0x4b')]['id']}})[_0xce82('0x27')](handleEntityNotFound(_0x347618,null))[_0xce82('0x27')](removeEntity(_0x347618,null))[_0xce82('0x49')](handleError(_0x347618,null));}; \ No newline at end of file +var _0xf806=['undefined','limit','count','status','set','apply','save','destroy','then','get','CmContactHasItems','error','stack','name','send','map','CmContactHasItem','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','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/environment','../../mysqldb','sendStatus','end','json','offset'];(function(_0x553612,_0xbba591){var _0x13b597=function(_0x340cf7){while(--_0x340cf7){_0x553612['push'](_0x553612['shift']());}};_0x13b597(++_0xbba591);}(_0xf806,0x85));var _0x6f80=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf806[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6f80('0x0'));var rimraf=require(_0x6f80('0x1'));var zipdir=require(_0x6f80('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f80('0x3'));var moment=require(_0x6f80('0x4'));var BPromise=require(_0x6f80('0x5'));var Mustache=require(_0x6f80('0x6'));var util=require(_0x6f80('0x7'));var path=require(_0x6f80('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6f80('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f80('0xa'));var squel=require(_0x6f80('0xb'));var crypto=require(_0x6f80('0xc'));var jsforce=require(_0x6f80('0xd'));var deskjs=require(_0x6f80('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6f80('0xf'));var Papa=require(_0x6f80('0x10'));var Redis=require(_0x6f80('0x11'));var authService=require(_0x6f80('0x12'));var qs=require(_0x6f80('0x13'));var as=require(_0x6f80('0x14'));var hardwareService=require(_0x6f80('0x15'));var logger=require(_0x6f80('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x6f80('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f80('0x18'))['db'];function respondWithStatusCode(_0x363fa4,_0xbb6263){_0xbb6263=_0xbb6263||0xcc;return function(_0x420935){if(_0x420935){return _0x363fa4[_0x6f80('0x19')](_0xbb6263);}return _0x363fa4['status'](_0xbb6263)[_0x6f80('0x1a')]();};}function respondWithResult(_0x21f11a,_0x1bb84d){_0x1bb84d=_0x1bb84d||0xc8;return function(_0x34dd3b){if(_0x34dd3b){return _0x21f11a['status'](_0x1bb84d)[_0x6f80('0x1b')](_0x34dd3b);}};}function respondWithFilteredResult(_0x28357d,_0x21da22){return function(_0x4e4269){if(_0x4e4269){var _0x5439c2=typeof _0x21da22[_0x6f80('0x1c')]===_0x6f80('0x1d')&&typeof _0x21da22[_0x6f80('0x1e')]===_0x6f80('0x1d');var _0x55df4b=_0x4e4269['count'];var _0x43cfb1=_0x5439c2?0x0:_0x21da22[_0x6f80('0x1c')];var _0x223677=_0x5439c2?_0x4e4269[_0x6f80('0x1f')]:_0x21da22[_0x6f80('0x1c')]+_0x21da22['limit'];var _0x4bb78d;if(_0x223677>=_0x55df4b){_0x223677=_0x55df4b;_0x4bb78d=0xc8;}else{_0x4bb78d=0xce;}_0x28357d[_0x6f80('0x20')](_0x4bb78d);return _0x28357d[_0x6f80('0x21')]('Content-Range',_0x43cfb1+'-'+_0x223677+'/'+_0x55df4b)[_0x6f80('0x1b')](_0x4e4269);}return null;};}function patchUpdates(_0x51974d){return function(_0x10cf0b){try{jsonpatch[_0x6f80('0x22')](_0x10cf0b,_0x51974d,!![]);}catch(_0x4bb72c){return BPromise['reject'](_0x4bb72c);}return _0x10cf0b[_0x6f80('0x23')]();};}function saveUpdates(_0x3b102b,_0x3543eb){return function(_0x5b74b3){if(_0x5b74b3){return _0x5b74b3['update'](_0x3b102b)['then'](function(_0x3f77f6){return _0x3f77f6;});}return null;};}function removeEntity(_0xf26d1f,_0x3a7318){return function(_0x1162dd){if(_0x1162dd){return _0x1162dd[_0x6f80('0x24')]()[_0x6f80('0x25')](function(){var _0x54e542=_0x1162dd[_0x6f80('0x26')]({'plain':!![]});var _0x148ca9=_0x6f80('0x27');return db['UserProfileResource'][_0x6f80('0x24')]({'where':{'type':_0x148ca9,'resourceId':_0x54e542['id']}})[_0x6f80('0x25')](function(){return _0x1162dd;});})[_0x6f80('0x25')](function(){_0xf26d1f[_0x6f80('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48ea35,_0xa79c1f){return function(_0x8439f6){if(!_0x8439f6){_0x48ea35[_0x6f80('0x19')](0x194);}return _0x8439f6;};}function handleError(_0x850b7b,_0x1f5140){_0x1f5140=_0x1f5140||0x1f4;return function(_0x29b45e){logger[_0x6f80('0x28')](_0x29b45e[_0x6f80('0x29')]);if(_0x29b45e[_0x6f80('0x2a')]){delete _0x29b45e[_0x6f80('0x2a')];}_0x850b7b[_0x6f80('0x20')](_0x1f5140)[_0x6f80('0x2b')](_0x29b45e);};}exports['index']=function(_0x1dc1a1,_0x3f23fa){var _0x1be326={},_0x38b6b3={},_0x2dae5c={'count':0x0,'rows':[]};var _0x5cdd4c=_[_0x6f80('0x2c')](db[_0x6f80('0x2d')]['rawAttributes'],function(_0x145979){return{'name':_0x145979[_0x6f80('0x2e')],'type':_0x145979['type'][_0x6f80('0x2f')]};});_0x38b6b3[_0x6f80('0x30')]=_[_0x6f80('0x2c')](_0x5cdd4c,_0x6f80('0x2a'));_0x38b6b3[_0x6f80('0x31')]=_['keys'](_0x1dc1a1[_0x6f80('0x31')]);_0x38b6b3[_0x6f80('0x32')]=_[_0x6f80('0x33')](_0x38b6b3['model'],_0x38b6b3[_0x6f80('0x31')]);_0x1be326[_0x6f80('0x34')]=_[_0x6f80('0x33')](_0x38b6b3['model'],qs[_0x6f80('0x35')](_0x1dc1a1[_0x6f80('0x31')][_0x6f80('0x35')]));_0x1be326[_0x6f80('0x34')]=_0x1be326[_0x6f80('0x34')]['length']?_0x1be326[_0x6f80('0x34')]:_0x38b6b3[_0x6f80('0x30')];if(!_0x1dc1a1['query']['hasOwnProperty'](_0x6f80('0x36'))){_0x1be326[_0x6f80('0x1e')]=qs[_0x6f80('0x1e')](_0x1dc1a1[_0x6f80('0x31')]['limit']);_0x1be326[_0x6f80('0x1c')]=qs[_0x6f80('0x1c')](_0x1dc1a1[_0x6f80('0x31')]['offset']);}_0x1be326[_0x6f80('0x37')]=qs[_0x6f80('0x38')](_0x1dc1a1['query']['sort']);_0x1be326[_0x6f80('0x39')]=qs[_0x6f80('0x32')](_['pick'](_0x1dc1a1[_0x6f80('0x31')],_0x38b6b3['filters']),_0x5cdd4c);if(_0x1dc1a1[_0x6f80('0x31')]['filter']){_0x1be326[_0x6f80('0x39')]=_[_0x6f80('0x3a')](_0x1be326[_0x6f80('0x39')],{'$or':_[_0x6f80('0x2c')](_0x5cdd4c,function(_0x5d218c){if(_0x5d218c['type']!==_0x6f80('0x3b')){var _0x572e03={};_0x572e03[_0x5d218c['name']]={'$like':'%'+_0x1dc1a1[_0x6f80('0x31')]['filter']+'%'};return _0x572e03;}})});}_0x1be326=_['merge']({},_0x1be326,_0x1dc1a1[_0x6f80('0x3c')]);var _0x417bf4={'where':_0x1be326[_0x6f80('0x39')]};return db['CmContactHasItem'][_0x6f80('0x1f')](_0x417bf4)['then'](function(_0x2cfb65){_0x2dae5c[_0x6f80('0x1f')]=_0x2cfb65;if(_0x1dc1a1[_0x6f80('0x31')]['includeAll']){_0x1be326[_0x6f80('0x3d')]=[{'all':!![]}];}return db[_0x6f80('0x2d')][_0x6f80('0x3e')](_0x1be326);})['then'](function(_0x3a1855){_0x2dae5c[_0x6f80('0x3f')]=_0x3a1855;return _0x2dae5c;})['then'](respondWithFilteredResult(_0x3f23fa,_0x1be326))[_0x6f80('0x40')](handleError(_0x3f23fa,null));};exports[_0x6f80('0x41')]=function(_0x3f4e11,_0x45b59b){var _0x4b0dcd={'raw':!![],'where':{'id':_0x3f4e11[_0x6f80('0x42')]['id']}},_0xf31b39={};_0xf31b39[_0x6f80('0x30')]=_['keys'](db['CmContactHasItem'][_0x6f80('0x43')]);_0xf31b39[_0x6f80('0x31')]=_[_0x6f80('0x44')](_0x3f4e11['query']);_0xf31b39[_0x6f80('0x32')]=_[_0x6f80('0x33')](_0xf31b39[_0x6f80('0x30')],_0xf31b39[_0x6f80('0x31')]);_0x4b0dcd[_0x6f80('0x34')]=_[_0x6f80('0x33')](_0xf31b39[_0x6f80('0x30')],qs[_0x6f80('0x35')](_0x3f4e11[_0x6f80('0x31')]['fields']));_0x4b0dcd['attributes']=_0x4b0dcd[_0x6f80('0x34')]['length']?_0x4b0dcd[_0x6f80('0x34')]:_0xf31b39[_0x6f80('0x30')];if(_0x3f4e11['query'][_0x6f80('0x45')]){_0x4b0dcd[_0x6f80('0x3d')]=[{'all':!![]}];}_0x4b0dcd=_[_0x6f80('0x3a')]({},_0x4b0dcd,_0x3f4e11[_0x6f80('0x3c')]);return db[_0x6f80('0x2d')][_0x6f80('0x46')](_0x4b0dcd)[_0x6f80('0x25')](handleEntityNotFound(_0x45b59b,null))[_0x6f80('0x25')](respondWithResult(_0x45b59b,null))[_0x6f80('0x40')](handleError(_0x45b59b,null));};exports[_0x6f80('0x47')]=function(_0x3cbc47,_0x3022b3){return db[_0x6f80('0x2d')][_0x6f80('0x47')](_0x3cbc47[_0x6f80('0x48')],{})['then'](function(_0x3f9a36){var _0xdb42b9=_0x3cbc47['user'][_0x6f80('0x26')]({'plain':!![]});if(!_0xdb42b9)throw new Error(_0x6f80('0x49'));if(_0xdb42b9['role']===_0x6f80('0x4a')){var _0x95c69b=_0x3f9a36[_0x6f80('0x26')]({'plain':!![]});var _0xaf91fc=_0x6f80('0x27');return db[_0x6f80('0x4b')][_0x6f80('0x46')]({'where':{'name':_0xaf91fc,'userProfileId':_0xdb42b9[_0x6f80('0x4c')]},'raw':!![]})['then'](function(_0x2d9704){if(_0x2d9704&&_0x2d9704[_0x6f80('0x4d')]===0x0){return db[_0x6f80('0x4e')][_0x6f80('0x47')]({'name':_0x95c69b[_0x6f80('0x2a')],'resourceId':_0x95c69b['id'],'type':_0x2d9704['name'],'sectionId':_0x2d9704['id']},{})[_0x6f80('0x25')](function(){return _0x3f9a36;});}else{return _0x3f9a36;}})[_0x6f80('0x40')](function(_0x3a2f05){logger['error'](_0x6f80('0x4f'),_0x3a2f05);throw _0x3a2f05;});}return _0x3f9a36;})[_0x6f80('0x25')](respondWithResult(_0x3022b3,0xc9))['catch'](handleError(_0x3022b3,null));};exports[_0x6f80('0x50')]=function(_0x126f47,_0x4f7bc7){if(_0x126f47[_0x6f80('0x48')]['id']){delete _0x126f47['body']['id'];}return db[_0x6f80('0x2d')]['find']({'where':{'id':_0x126f47[_0x6f80('0x42')]['id']}})['then'](handleEntityNotFound(_0x4f7bc7,null))[_0x6f80('0x25')](saveUpdates(_0x126f47['body'],null))[_0x6f80('0x25')](respondWithResult(_0x4f7bc7,null))['catch'](handleError(_0x4f7bc7,null));};exports[_0x6f80('0x24')]=function(_0x215027,_0x14722f){return db[_0x6f80('0x2d')][_0x6f80('0x46')]({'where':{'id':_0x215027[_0x6f80('0x42')]['id']}})[_0x6f80('0x25')](handleEntityNotFound(_0x14722f,null))['then'](removeEntity(_0x14722f,null))['catch'](handleError(_0x14722f,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index a45e75a..e0020bc 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 _0xdca4=['path','./cmContactHasItem.attributes','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2304e5,_0x19dd84){var _0x18de2c=function(_0x4f227c){while(--_0x4f227c){_0x2304e5['push'](_0x2304e5['shift']());}};_0x18de2c(++_0x19dd84);}(_0xdca4,0xf7));var _0x4dca=function(_0x4a9ffb,_0x27dad6){_0x4a9ffb=_0x4a9ffb-0x0;var _0x1f64cc=_0xdca4[_0x4a9ffb];return _0x1f64cc;};'use strict';var _=require(_0x4dca('0x0'));var util=require(_0x4dca('0x1'));var logger=require(_0x4dca('0x2'))(_0x4dca('0x3'));var moment=require('moment');var BPromise=require(_0x4dca('0x4'));var rp=require(_0x4dca('0x5'));var fs=require('fs');var path=require(_0x4dca('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4dca('0x7'));module['exports']=function(_0x911adf,_0x42ab62){return _0x911adf[_0x4dca('0x8')](_0x4dca('0x9'),attributes,{'tableName':_0x4dca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb433=['path','rimraf','../../config/environment','exports','define','cm_contact_has_items','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xb433,0xba));var _0x3b43=function(_0x2715cf,_0x517bb2){_0x2715cf=_0x2715cf-0x0;var _0x1bdcb8=_0xb433[_0x2715cf];return _0x1bdcb8;};'use strict';var _=require(_0x3b43('0x0'));var util=require(_0x3b43('0x1'));var logger=require(_0x3b43('0x2'))('api');var moment=require(_0x3b43('0x3'));var BPromise=require(_0x3b43('0x4'));var rp=require(_0x3b43('0x5'));var fs=require('fs');var path=require(_0x3b43('0x6'));var rimraf=require(_0x3b43('0x7'));var config=require(_0x3b43('0x8'));var attributes=require('./cmContactHasItem.attributes');module[_0x3b43('0x9')]=function(_0xbe5bae,_0x309d4c){return _0xbe5bae[_0x3b43('0xa')]('CmContactHasItem',attributes,{'tableName':_0x3b43('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 fc000f0..d42b200 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 _0x5b90=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0xc7dbad,_0x304af9){var _0x2b81af=function(_0xf5f34f){while(--_0xf5f34f){_0xc7dbad['push'](_0xc7dbad['shift']());}};_0x2b81af(++_0x304af9);}(_0x5b90,0x1c9));var _0x05b9=function(_0x507d63,_0x375424){_0x507d63=_0x507d63-0x0;var _0x4f7124=_0x5b90[_0x507d63];return _0x4f7124;};'use strict';var _=require(_0x05b9('0x0'));var util=require(_0x05b9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x05b9('0x2'));var fs=require('fs');var Redis=require(_0x05b9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x05b9('0x4'));var logger=require(_0x05b9('0x5'))(_0x05b9('0x6'));var config=require(_0x05b9('0x7'));var jayson=require(_0x05b9('0x8'));var client=jayson[_0x05b9('0x9')][_0x05b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x389b23,_0x2cea4a,_0x451a23){return new BPromise(function(_0x51f33e,_0x1a1a85){return client[_0x05b9('0xb')](_0x389b23,_0x451a23)[_0x05b9('0xc')](function(_0x2df4e5){logger[_0x05b9('0xd')](_0x05b9('0xe'),_0x2cea4a,'request\x20sent');logger[_0x05b9('0xf')](_0x05b9('0x10'),_0x2cea4a,_0x05b9('0x11'),JSON[_0x05b9('0x12')](_0x2df4e5));if(_0x2df4e5[_0x05b9('0x13')]){if(_0x2df4e5['error']['code']===0x1f4){logger[_0x05b9('0x13')](_0x05b9('0xe'),_0x2cea4a,_0x2df4e5[_0x05b9('0x13')][_0x05b9('0x14')]);return _0x1a1a85(_0x2df4e5['error'][_0x05b9('0x14')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x2cea4a,_0x2df4e5['error'][_0x05b9('0x14')]);return _0x51f33e(_0x2df4e5['error'][_0x05b9('0x14')]);}else{logger[_0x05b9('0xd')]('CmContactHasItem,\x20%s,\x20%s',_0x2cea4a,'request\x20sent');_0x51f33e(_0x2df4e5[_0x05b9('0x15')][_0x05b9('0x14')]);}})['catch'](function(_0x1a48f5){logger['error'](_0x05b9('0xe'),_0x2cea4a,_0x1a48f5);_0x1a1a85(_0x1a48f5);});});} \ No newline at end of file +var _0x73a8=['rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','stringify','error','code','message','CmContactHasItem,\x20%s,\x20%s','result','catch','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x5acd34,_0xf6209f){var _0x5fd28a=function(_0xc03b7c){while(--_0xc03b7c){_0x5acd34['push'](_0x5acd34['shift']());}};_0x5fd28a(++_0xf6209f);}(_0x73a8,0x68));var _0x873a=function(_0x440d0a,_0x3f1594){_0x440d0a=_0x440d0a-0x0;var _0x1626d3=_0x73a8[_0x440d0a];return _0x1626d3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x873a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x873a('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x873a('0x2'));var logger=require(_0x873a('0x3'))(_0x873a('0x4'));var config=require(_0x873a('0x5'));var jayson=require(_0x873a('0x6'));var client=jayson[_0x873a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50f24a,_0x3bddea,_0xf730c3){return new BPromise(function(_0x35f7f9,_0x3f570e){return client[_0x873a('0x8')](_0x50f24a,_0xf730c3)['then'](function(_0x2f5c16){logger[_0x873a('0x9')]('CmContactHasItem,\x20%s,\x20%s',_0x3bddea,'request\x20sent');logger['debug']('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x3bddea,_0x873a('0xa'),JSON[_0x873a('0xb')](_0x2f5c16));if(_0x2f5c16[_0x873a('0xc')]){if(_0x2f5c16['error'][_0x873a('0xd')]===0x1f4){logger[_0x873a('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x3bddea,_0x2f5c16['error'][_0x873a('0xe')]);return _0x3f570e(_0x2f5c16[_0x873a('0xc')][_0x873a('0xe')]);}logger['error'](_0x873a('0xf'),_0x3bddea,_0x2f5c16[_0x873a('0xc')]['message']);return _0x35f7f9(_0x2f5c16['error'][_0x873a('0xe')]);}else{logger[_0x873a('0x9')](_0x873a('0xf'),_0x3bddea,_0x873a('0xa'));_0x35f7f9(_0x2f5c16[_0x873a('0x10')][_0x873a('0xe')]);}})[_0x873a('0x11')](function(_0x1d3022){logger[_0x873a('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x3bddea,_0x1d3022);_0x3f570e(_0x1d3022);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 7192b86..965deb9 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 _0xd408=['create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','show','post'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd408,0x1e7));var _0x8d40=function(_0x22f8c3,_0x3d9fc9){_0x22f8c3=_0x22f8c3-0x0;var _0x22770d=_0xd408[_0x22f8c3];return _0x22770d;};'use strict';var multer=require(_0x8d40('0x0'));var util=require(_0x8d40('0x1'));var path=require(_0x8d40('0x2'));var timeout=require(_0x8d40('0x3'));var express=require(_0x8d40('0x4'));var router=express['Router']();var fs_extra=require(_0x8d40('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8d40('0x6'));var config=require(_0x8d40('0x7'));var controller=require(_0x8d40('0x8'));router[_0x8d40('0x9')]('/',auth[_0x8d40('0xa')](),controller['index']);router['get']('/:id',auth[_0x8d40('0xa')](),controller[_0x8d40('0xb')]);router[_0x8d40('0xc')]('/',auth[_0x8d40('0xa')](),controller[_0x8d40('0xd')]);router[_0x8d40('0xe')](_0x8d40('0xf'),auth['isAuthenticated'](),controller[_0x8d40('0x10')]);router[_0x8d40('0x11')](_0x8d40('0xf'),auth[_0x8d40('0xa')](),controller[_0x8d40('0x12')]);module[_0x8d40('0x13')]=router; \ No newline at end of file +var _0x0e30=['post','create','put','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','/:id'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0e30,0x1d5));var _0x00e3=function(_0x4e8ea2,_0x322cc1){_0x4e8ea2=_0x4e8ea2-0x0;var _0x18698d=_0x0e30[_0x4e8ea2];return _0x18698d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x00e3('0x0'));var timeout=require('connect-timeout');var express=require(_0x00e3('0x1'));var router=express[_0x00e3('0x2')]();var fs_extra=require(_0x00e3('0x3'));var auth=require(_0x00e3('0x4'));var interaction=require(_0x00e3('0x5'));var config=require(_0x00e3('0x6'));var controller=require(_0x00e3('0x7'));router[_0x00e3('0x8')]('/',auth[_0x00e3('0x9')](),controller['index']);router[_0x00e3('0x8')](_0x00e3('0xa'),auth[_0x00e3('0x9')](),controller['show']);router[_0x00e3('0xb')]('/',auth['isAuthenticated'](),controller[_0x00e3('0xc')]);router[_0x00e3('0xd')]('/:id',auth[_0x00e3('0x9')](),controller['update']);router['delete'](_0x00e3('0xa'),auth[_0x00e3('0x9')](),controller[_0x00e3('0xe')]);module[_0x00e3('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index e0c2052..f116858 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 _0xe963=['TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','sequelize','lodash','exports','getDataValue','alias','setDataValue','STRING'];(function(_0x2be63a,_0x44d8b5){var _0x2bd7c2=function(_0x130e8a){while(--_0x130e8a){_0x2be63a['push'](_0x2be63a['shift']());}};_0x2bd7c2(++_0x44d8b5);}(_0xe963,0x179));var _0x3e96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe963[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3e96('0x0'));var _=require(_0x3e96('0x1'));module[_0x3e96('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xd22268){return this[_0x3e96('0x3')](_0x3e96('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3c020d){this[_0x3e96('0x5')](_0x3e96('0x4'),_0x3c020d?_0x3c020d:this[_0x3e96('0x3')]('name'));}},'type':{'type':Sequelize[_0x3e96('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x3e96('0x7')](_0x3e96('0x8')),'get':function(){if(this[_0x3e96('0x3')](_0x3e96('0x9'))===_0x3e96('0xa')){return JSON[_0x3e96('0xb')](this['getDataValue'](_0x3e96('0xc')));}else{return this[_0x3e96('0x3')](_0x3e96('0xc'));}},'set':function(_0x69f4ac){if(Array[_0x3e96('0xd')](_0x69f4ac)){this[_0x3e96('0x5')](_0x3e96('0xc'),JSON[_0x3e96('0xe')](_0x69f4ac));}else{this[_0x3e96('0x5')](_0x3e96('0xc'),_0x69f4ac);}}},'required':{'type':Sequelize[_0x3e96('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x3e96('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file +var _0x274e=['parse','values','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','STRING','setDataValue','alias','name','TEXT','long','type','select'];(function(_0x2791d6,_0x561c62){var _0x4e5dec=function(_0x3bb4e6){while(--_0x3bb4e6){_0x2791d6['push'](_0x2791d6['shift']());}};_0x4e5dec(++_0x561c62);}(_0x274e,0x113));var _0xe274=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x274e[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0xe274('0x0'));var _=require(_0xe274('0x1'));module[_0xe274('0x2')]={'name':{'type':Sequelize[_0xe274('0x3')],'get':function(_0x1896fb){return this[_0xe274('0x4')]('alias');}},'alias':{'type':Sequelize[_0xe274('0x5')],'allowNull':![],'set':function(_0x187cc1){this[_0xe274('0x6')](_0xe274('0x7'),_0x187cc1?_0x187cc1:this[_0xe274('0x4')](_0xe274('0x8')));}},'type':{'type':Sequelize[_0xe274('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xe274('0x9')](_0xe274('0xa')),'get':function(){if(this[_0xe274('0x4')](_0xe274('0xb'))===_0xe274('0xc')){return JSON[_0xe274('0xd')](this[_0xe274('0x4')]('values'));}else{return this[_0xe274('0x4')](_0xe274('0xe'));}},'set':function(_0x1f574e){if(Array['isArray'](_0x1f574e)){this['setDataValue'](_0xe274('0xe'),JSON['stringify'](_0x1f574e));}else{this[_0xe274('0x6')]('values',_0x1f574e);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xe274('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index d746b31..63a1151 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 _0xfd37=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','CmCustomField','includeAll','include','findAll','catch','show','params','rawAttributes','find','body','create','sequelize','transaction','Sequelize','TEXT','number','queryInterface','addColumn','cm_contacts','format','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x1c746a,_0x308ef9){var _0x985ad3=function(_0x44bf39){while(--_0x44bf39){_0x1c746a['push'](_0x1c746a['shift']());}};_0x985ad3(++_0x308ef9);}(_0xfd37,0xf6));var _0x7fd3=function(_0x38d3aa,_0x1d6269){_0x38d3aa=_0x38d3aa-0x0;var _0x45335d=_0xfd37[_0x38d3aa];return _0x45335d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7fd3('0x0'));var moment=require(_0x7fd3('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7fd3('0x2'));var path=require(_0x7fd3('0x3'));var sox=require(_0x7fd3('0x4'));var csv=require('to-csv');var ejs=require(_0x7fd3('0x5'));var fs=require('fs');var fs_extra=require(_0x7fd3('0x6'));var _=require(_0x7fd3('0x7'));var squel=require(_0x7fd3('0x8'));var crypto=require(_0x7fd3('0x9'));var jsforce=require(_0x7fd3('0xa'));var deskjs=require(_0x7fd3('0xb'));var toCsv=require(_0x7fd3('0xc'));var querystring=require(_0x7fd3('0xd'));var Papa=require(_0x7fd3('0xe'));var Redis=require(_0x7fd3('0xf'));var authService=require(_0x7fd3('0x10'));var qs=require(_0x7fd3('0x11'));var as=require(_0x7fd3('0x12'));var hardwareService=require(_0x7fd3('0x13'));var logger=require(_0x7fd3('0x14'))(_0x7fd3('0x15'));var utils=require(_0x7fd3('0x16'));var config=require(_0x7fd3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7fd3('0x18'))['db'];function respondWithStatusCode(_0x28e191,_0xb011dd){_0xb011dd=_0xb011dd||0xcc;return function(_0x5f1255){if(_0x5f1255){return _0x28e191[_0x7fd3('0x19')](_0xb011dd);}return _0x28e191['status'](_0xb011dd)[_0x7fd3('0x1a')]();};}function respondWithResult(_0x5ebe7a,_0x43d335){_0x43d335=_0x43d335||0xc8;return function(_0xae67ca){if(_0xae67ca){return _0x5ebe7a[_0x7fd3('0x1b')](_0x43d335)[_0x7fd3('0x1c')](_0xae67ca);}};}function respondWithFilteredResult(_0x26ba23,_0x11ee52){return function(_0x3d4073){if(_0x3d4073){var _0x38e101=typeof _0x11ee52[_0x7fd3('0x1d')]===_0x7fd3('0x1e')&&typeof _0x11ee52[_0x7fd3('0x1f')]===_0x7fd3('0x1e');var _0x480d6c=_0x3d4073[_0x7fd3('0x20')];var _0x3b0322=_0x38e101?0x0:_0x11ee52[_0x7fd3('0x1d')];var _0x4bebe0=_0x38e101?_0x3d4073[_0x7fd3('0x20')]:_0x11ee52[_0x7fd3('0x1d')]+_0x11ee52[_0x7fd3('0x1f')];var _0x7026b7;if(_0x4bebe0>=_0x480d6c){_0x4bebe0=_0x480d6c;_0x7026b7=0xc8;}else{_0x7026b7=0xce;}_0x26ba23[_0x7fd3('0x1b')](_0x7026b7);return _0x26ba23[_0x7fd3('0x21')](_0x7fd3('0x22'),_0x3b0322+'-'+_0x4bebe0+'/'+_0x480d6c)[_0x7fd3('0x1c')](_0x3d4073);}return null;};}function patchUpdates(_0x50a5cb){return function(_0x4009e7){try{jsonpatch[_0x7fd3('0x23')](_0x4009e7,_0x50a5cb,!![]);}catch(_0x237475){return BPromise[_0x7fd3('0x24')](_0x237475);}return _0x4009e7[_0x7fd3('0x25')]();};}function saveUpdates(_0x3f8c73,_0x5c33fb){return function(_0x3487c7){if(_0x3487c7){return _0x3487c7[_0x7fd3('0x26')](_0x3f8c73)[_0x7fd3('0x27')](function(_0x1d279b){return _0x1d279b;});}return null;};}function removeEntity(_0x497014,_0x15417a){return function(_0x2d58c8){if(_0x2d58c8){return _0x2d58c8[_0x7fd3('0x28')]()[_0x7fd3('0x27')](function(){_0x497014['status'](0xcc)[_0x7fd3('0x1a')]();});}};}function handleEntityNotFound(_0x4bf618,_0x4ceec5){return function(_0x1711cb){if(!_0x1711cb){_0x4bf618[_0x7fd3('0x19')](0x194);}return _0x1711cb;};}function handleError(_0x58ea36,_0x4c3ce8){_0x4c3ce8=_0x4c3ce8||0x1f4;return function(_0x247866){logger['error'](_0x247866[_0x7fd3('0x29')]);if(_0x247866[_0x7fd3('0x2a')]){delete _0x247866[_0x7fd3('0x2a')];}_0x58ea36[_0x7fd3('0x1b')](_0x4c3ce8)[_0x7fd3('0x2b')](_0x247866);};}exports[_0x7fd3('0x2c')]=function(_0x2217e3,_0x39295d){var _0x3ce93f={},_0x4960de={},_0x346993={'count':0x0,'rows':[]};var _0x193d39=_[_0x7fd3('0x2d')](db['CmCustomField']['rawAttributes'],function(_0x2464f5){return{'name':_0x2464f5[_0x7fd3('0x2e')],'type':_0x2464f5[_0x7fd3('0x2f')][_0x7fd3('0x30')]};});_0x4960de[_0x7fd3('0x31')]=_['differenceBy'](_['map'](_0x193d39,_0x7fd3('0x2a')),['name']);_0x4960de['query']=_[_0x7fd3('0x32')](_0x2217e3['query']);_0x4960de['filters']=_[_0x7fd3('0x33')](_0x4960de[_0x7fd3('0x31')],_0x4960de[_0x7fd3('0x34')]);_0x3ce93f[_0x7fd3('0x35')]=_[_0x7fd3('0x33')](_0x4960de['model'],qs[_0x7fd3('0x36')](_0x2217e3[_0x7fd3('0x34')][_0x7fd3('0x36')]));_0x3ce93f[_0x7fd3('0x35')]=_0x3ce93f[_0x7fd3('0x35')][_0x7fd3('0x37')]?_0x3ce93f[_0x7fd3('0x35')]:_0x4960de['model'];if(!_0x2217e3['query'][_0x7fd3('0x38')](_0x7fd3('0x39'))){_0x3ce93f[_0x7fd3('0x1f')]=qs['limit'](_0x2217e3[_0x7fd3('0x34')][_0x7fd3('0x1f')]);_0x3ce93f['offset']=qs[_0x7fd3('0x1d')](_0x2217e3[_0x7fd3('0x34')][_0x7fd3('0x1d')]);}_0x3ce93f[_0x7fd3('0x3a')]=qs[_0x7fd3('0x3b')](_0x2217e3['query']['sort']);_0x3ce93f[_0x7fd3('0x3c')]=qs[_0x7fd3('0x3d')](_[_0x7fd3('0x3e')](_0x2217e3[_0x7fd3('0x34')],_0x4960de['filters']),_0x193d39);if(_0x2217e3['query'][_0x7fd3('0x3f')]){_0x3ce93f['where']=_[_0x7fd3('0x40')](_0x3ce93f[_0x7fd3('0x3c')],{'$or':_['map'](_0x193d39,function(_0x36f9f7){if(_0x36f9f7[_0x7fd3('0x2f')]!==_0x7fd3('0x41')){var _0x402fab={};_0x402fab[_0x36f9f7[_0x7fd3('0x2a')]]={'$like':'%'+_0x2217e3[_0x7fd3('0x34')][_0x7fd3('0x3f')]+'%'};return _0x402fab;}})});}_0x3ce93f=_['merge']({},_0x3ce93f,_0x2217e3[_0x7fd3('0x42')]);var _0x11df2d={'where':_0x3ce93f['where']};return db[_0x7fd3('0x43')][_0x7fd3('0x20')](_0x11df2d)['then'](function(_0x4cdacc){_0x346993[_0x7fd3('0x20')]=_0x4cdacc;if(_0x2217e3['query'][_0x7fd3('0x44')]){_0x3ce93f[_0x7fd3('0x45')]=[{'all':!![]}];}return db[_0x7fd3('0x43')][_0x7fd3('0x46')](_0x3ce93f);})[_0x7fd3('0x27')](function(_0x722afe){_0x346993['rows']=_0x722afe;return _0x346993;})[_0x7fd3('0x27')](respondWithFilteredResult(_0x39295d,_0x3ce93f))[_0x7fd3('0x47')](handleError(_0x39295d,null));};exports[_0x7fd3('0x48')]=function(_0x47c362,_0xf6daee){var _0xa78144={'raw':!![],'where':{'id':_0x47c362[_0x7fd3('0x49')]['id']}},_0x2bfbee={};_0x2bfbee['model']=_[_0x7fd3('0x32')](db[_0x7fd3('0x43')][_0x7fd3('0x4a')]);_0x2bfbee[_0x7fd3('0x34')]=_[_0x7fd3('0x32')](_0x47c362[_0x7fd3('0x34')]);_0x2bfbee[_0x7fd3('0x3d')]=_['intersection'](_0x2bfbee[_0x7fd3('0x31')],_0x2bfbee[_0x7fd3('0x34')]);_0xa78144[_0x7fd3('0x35')]=_[_0x7fd3('0x33')](_0x2bfbee[_0x7fd3('0x31')],qs[_0x7fd3('0x36')](_0x47c362['query']['fields']));_0xa78144[_0x7fd3('0x35')]=_0xa78144['attributes'][_0x7fd3('0x37')]?_0xa78144[_0x7fd3('0x35')]:_0x2bfbee[_0x7fd3('0x31')];if(_0x47c362[_0x7fd3('0x34')]['includeAll']){_0xa78144[_0x7fd3('0x45')]=[{'all':!![]}];}_0xa78144=_[_0x7fd3('0x40')]({},_0xa78144,_0x47c362[_0x7fd3('0x42')]);return db[_0x7fd3('0x43')][_0x7fd3('0x4b')](_0xa78144)[_0x7fd3('0x27')](handleEntityNotFound(_0xf6daee,null))[_0x7fd3('0x27')](respondWithResult(_0xf6daee,null))['catch'](handleError(_0xf6daee,null));};exports[_0x7fd3('0x26')]=function(_0xf2926c,_0x25a946){if(_0xf2926c[_0x7fd3('0x4c')]['id']){delete _0xf2926c[_0x7fd3('0x4c')]['id'];}return db['CmCustomField'][_0x7fd3('0x4b')]({'where':{'id':_0xf2926c[_0x7fd3('0x49')]['id']}})[_0x7fd3('0x27')](handleEntityNotFound(_0x25a946,null))['then'](saveUpdates(_0xf2926c[_0x7fd3('0x4c')],null))[_0x7fd3('0x27')](respondWithResult(_0x25a946,null))[_0x7fd3('0x47')](handleError(_0x25a946,null));};exports['destroy']=function(_0x579562,_0x183fc4){return db[_0x7fd3('0x43')][_0x7fd3('0x4b')]({'where':{'id':_0x579562[_0x7fd3('0x49')]['id']}})[_0x7fd3('0x27')](handleEntityNotFound(_0x183fc4,null))[_0x7fd3('0x27')](removeEntity(_0x183fc4,null))[_0x7fd3('0x47')](handleError(_0x183fc4,null));};exports[_0x7fd3('0x4d')]=function(_0x32c893,_0x2fecbc){var _0x47b2a0;return db[_0x7fd3('0x4e')][_0x7fd3('0x4f')](function(_0x3f1db1){return db[_0x7fd3('0x43')][_0x7fd3('0x4d')](_0x32c893[_0x7fd3('0x4c')],{'transaction':_0x3f1db1})[_0x7fd3('0x27')](function(_0x311bc2){_0x47b2a0=_0x311bc2;var _0x4ce571={'type':db[_0x7fd3('0x50')][_0x7fd3('0x51')],'transaction':_0x3f1db1};switch(_0x32c893[_0x7fd3('0x4c')][_0x7fd3('0x2f')]){case'text':_0x4ce571[_0x7fd3('0x2f')]=db[_0x7fd3('0x50')][_0x7fd3('0x51')];break;case _0x7fd3('0x52'):_0x4ce571[_0x7fd3('0x2f')]=db[_0x7fd3('0x50')]['INTEGER'];break;case'switch':_0x4ce571[_0x7fd3('0x2f')]=db[_0x7fd3('0x50')]['BOOLEAN'];_0x4ce571['defaultValue']=![];break;default:}return db[_0x7fd3('0x4e')][_0x7fd3('0x53')][_0x7fd3('0x54')](_0x7fd3('0x55'),util[_0x7fd3('0x56')]('cf_%d',_0x47b2a0['id']),_0x4ce571);})['then'](function(){return _0x47b2a0;});})[_0x7fd3('0x27')](respondWithResult(_0x2fecbc,0xc9))[_0x7fd3('0x47')](handleError(_0x2fecbc,null));}; \ No newline at end of file +var _0x6206=['BOOLEAN','queryInterface','addColumn','cm_contacts','format','cf_%d','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','differenceBy','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','merge','CmCustomField','includeAll','include','findAll','rows','show','find','params','body','catch','create','sequelize','transaction','type','text','Sequelize','number','switch'];(function(_0xebbc39,_0x427a35){var _0x5892df=function(_0xdbc14a){while(--_0xdbc14a){_0xebbc39['push'](_0xebbc39['shift']());}};_0x5892df(++_0x427a35);}(_0x6206,0x1b4));var _0x6620=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x6206[_0x4e7d25];return _0x526fe6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6620('0x0'));var jsonpatch=require(_0x6620('0x1'));var rp=require(_0x6620('0x2'));var moment=require(_0x6620('0x3'));var BPromise=require(_0x6620('0x4'));var Mustache=require('mustache');var util=require(_0x6620('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x6620('0x6'));var ejs=require(_0x6620('0x7'));var fs=require('fs');var fs_extra=require(_0x6620('0x8'));var _=require(_0x6620('0x9'));var squel=require(_0x6620('0xa'));var crypto=require(_0x6620('0xb'));var jsforce=require(_0x6620('0xc'));var deskjs=require(_0x6620('0xd'));var toCsv=require(_0x6620('0x6'));var querystring=require(_0x6620('0xe'));var Papa=require(_0x6620('0xf'));var Redis=require(_0x6620('0x10'));var authService=require(_0x6620('0x11'));var qs=require(_0x6620('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6620('0x13'));var logger=require('../../config/logger')(_0x6620('0x14'));var utils=require('../../config/utils');var config=require(_0x6620('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6620('0x16'))['db'];function respondWithStatusCode(_0x36b771,_0x33062e){_0x33062e=_0x33062e||0xcc;return function(_0x552208){if(_0x552208){return _0x36b771[_0x6620('0x17')](_0x33062e);}return _0x36b771['status'](_0x33062e)[_0x6620('0x18')]();};}function respondWithResult(_0x3399f4,_0x912ba7){_0x912ba7=_0x912ba7||0xc8;return function(_0x308079){if(_0x308079){return _0x3399f4[_0x6620('0x19')](_0x912ba7)[_0x6620('0x1a')](_0x308079);}};}function respondWithFilteredResult(_0x29fa55,_0x396198){return function(_0x52332f){if(_0x52332f){var _0x156a4=typeof _0x396198[_0x6620('0x1b')]===_0x6620('0x1c')&&typeof _0x396198[_0x6620('0x1d')]===_0x6620('0x1c');var _0x37b650=_0x52332f[_0x6620('0x1e')];var _0x33874d=_0x156a4?0x0:_0x396198[_0x6620('0x1b')];var _0x180e16=_0x156a4?_0x52332f['count']:_0x396198[_0x6620('0x1b')]+_0x396198[_0x6620('0x1d')];var _0x4c1f00;if(_0x180e16>=_0x37b650){_0x180e16=_0x37b650;_0x4c1f00=0xc8;}else{_0x4c1f00=0xce;}_0x29fa55[_0x6620('0x19')](_0x4c1f00);return _0x29fa55['set']('Content-Range',_0x33874d+'-'+_0x180e16+'/'+_0x37b650)[_0x6620('0x1a')](_0x52332f);}return null;};}function patchUpdates(_0x2341c5){return function(_0x5020f4){try{jsonpatch[_0x6620('0x1f')](_0x5020f4,_0x2341c5,!![]);}catch(_0x5b3812){return BPromise[_0x6620('0x20')](_0x5b3812);}return _0x5020f4[_0x6620('0x21')]();};}function saveUpdates(_0x2f6ed1,_0x410008){return function(_0x20ff3e){if(_0x20ff3e){return _0x20ff3e[_0x6620('0x22')](_0x2f6ed1)[_0x6620('0x23')](function(_0x29afa4){return _0x29afa4;});}return null;};}function removeEntity(_0x45b8ac,_0x44e5d0){return function(_0x48ee6d){if(_0x48ee6d){return _0x48ee6d[_0x6620('0x24')]()[_0x6620('0x23')](function(){_0x45b8ac[_0x6620('0x19')](0xcc)[_0x6620('0x18')]();});}};}function handleEntityNotFound(_0x300353,_0x209a8c){return function(_0x2e12e3){if(!_0x2e12e3){_0x300353[_0x6620('0x17')](0x194);}return _0x2e12e3;};}function handleError(_0x47cb44,_0x22a7ec){_0x22a7ec=_0x22a7ec||0x1f4;return function(_0x3e8757){logger[_0x6620('0x25')](_0x3e8757[_0x6620('0x26')]);if(_0x3e8757[_0x6620('0x27')]){delete _0x3e8757[_0x6620('0x27')];}_0x47cb44[_0x6620('0x19')](_0x22a7ec)[_0x6620('0x28')](_0x3e8757);};}exports[_0x6620('0x29')]=function(_0x44b295,_0x548046){var _0xd22541={},_0x1b5a3f={},_0x5d4181={'count':0x0,'rows':[]};var _0x366165=_[_0x6620('0x2a')](db['CmCustomField'][_0x6620('0x2b')],function(_0x56ebaf){return{'name':_0x56ebaf[_0x6620('0x2c')],'type':_0x56ebaf['type'][_0x6620('0x2d')]};});_0x1b5a3f['model']=_[_0x6620('0x2e')](_[_0x6620('0x2a')](_0x366165,'name'),['name']);_0x1b5a3f[_0x6620('0x2f')]=_[_0x6620('0x30')](_0x44b295[_0x6620('0x2f')]);_0x1b5a3f[_0x6620('0x31')]=_[_0x6620('0x32')](_0x1b5a3f['model'],_0x1b5a3f[_0x6620('0x2f')]);_0xd22541['attributes']=_['intersection'](_0x1b5a3f[_0x6620('0x33')],qs[_0x6620('0x34')](_0x44b295[_0x6620('0x2f')]['fields']));_0xd22541[_0x6620('0x35')]=_0xd22541[_0x6620('0x35')][_0x6620('0x36')]?_0xd22541[_0x6620('0x35')]:_0x1b5a3f[_0x6620('0x33')];if(!_0x44b295[_0x6620('0x2f')]['hasOwnProperty']('nolimit')){_0xd22541[_0x6620('0x1d')]=qs[_0x6620('0x1d')](_0x44b295[_0x6620('0x2f')][_0x6620('0x1d')]);_0xd22541['offset']=qs['offset'](_0x44b295[_0x6620('0x2f')]['offset']);}_0xd22541[_0x6620('0x37')]=qs[_0x6620('0x38')](_0x44b295[_0x6620('0x2f')][_0x6620('0x38')]);_0xd22541[_0x6620('0x39')]=qs[_0x6620('0x31')](_[_0x6620('0x3a')](_0x44b295[_0x6620('0x2f')],_0x1b5a3f['filters']),_0x366165);if(_0x44b295[_0x6620('0x2f')][_0x6620('0x3b')]){_0xd22541[_0x6620('0x39')]=_['merge'](_0xd22541['where'],{'$or':_[_0x6620('0x2a')](_0x366165,function(_0x11da2d){if(_0x11da2d['type']!==_0x6620('0x3c')){var _0x5838d0={};_0x5838d0[_0x11da2d[_0x6620('0x27')]]={'$like':'%'+_0x44b295[_0x6620('0x2f')][_0x6620('0x3b')]+'%'};return _0x5838d0;}})});}_0xd22541=_[_0x6620('0x3d')]({},_0xd22541,_0x44b295['options']);var _0x2f0130={'where':_0xd22541['where']};return db[_0x6620('0x3e')]['count'](_0x2f0130)[_0x6620('0x23')](function(_0x1300e4){_0x5d4181['count']=_0x1300e4;if(_0x44b295[_0x6620('0x2f')][_0x6620('0x3f')]){_0xd22541[_0x6620('0x40')]=[{'all':!![]}];}return db[_0x6620('0x3e')][_0x6620('0x41')](_0xd22541);})[_0x6620('0x23')](function(_0x554449){_0x5d4181[_0x6620('0x42')]=_0x554449;return _0x5d4181;})[_0x6620('0x23')](respondWithFilteredResult(_0x548046,_0xd22541))['catch'](handleError(_0x548046,null));};exports[_0x6620('0x43')]=function(_0x102619,_0x32841a){var _0x353c3a={'raw':!![],'where':{'id':_0x102619['params']['id']}},_0x84a6ab={};_0x84a6ab[_0x6620('0x33')]=_[_0x6620('0x30')](db['CmCustomField'][_0x6620('0x2b')]);_0x84a6ab['query']=_[_0x6620('0x30')](_0x102619[_0x6620('0x2f')]);_0x84a6ab[_0x6620('0x31')]=_[_0x6620('0x32')](_0x84a6ab[_0x6620('0x33')],_0x84a6ab[_0x6620('0x2f')]);_0x353c3a[_0x6620('0x35')]=_['intersection'](_0x84a6ab[_0x6620('0x33')],qs[_0x6620('0x34')](_0x102619[_0x6620('0x2f')][_0x6620('0x34')]));_0x353c3a[_0x6620('0x35')]=_0x353c3a['attributes'][_0x6620('0x36')]?_0x353c3a[_0x6620('0x35')]:_0x84a6ab['model'];if(_0x102619[_0x6620('0x2f')][_0x6620('0x3f')]){_0x353c3a['include']=[{'all':!![]}];}_0x353c3a=_[_0x6620('0x3d')]({},_0x353c3a,_0x102619['options']);return db[_0x6620('0x3e')]['find'](_0x353c3a)[_0x6620('0x23')](handleEntityNotFound(_0x32841a,null))['then'](respondWithResult(_0x32841a,null))['catch'](handleError(_0x32841a,null));};exports[_0x6620('0x22')]=function(_0x4556d7,_0x53df33){if(_0x4556d7['body']['id']){delete _0x4556d7['body']['id'];}return db[_0x6620('0x3e')][_0x6620('0x44')]({'where':{'id':_0x4556d7[_0x6620('0x45')]['id']}})['then'](handleEntityNotFound(_0x53df33,null))['then'](saveUpdates(_0x4556d7[_0x6620('0x46')],null))[_0x6620('0x23')](respondWithResult(_0x53df33,null))[_0x6620('0x47')](handleError(_0x53df33,null));};exports['destroy']=function(_0x359c9d,_0x5bcf92){return db[_0x6620('0x3e')][_0x6620('0x44')]({'where':{'id':_0x359c9d['params']['id']}})['then'](handleEntityNotFound(_0x5bcf92,null))[_0x6620('0x23')](removeEntity(_0x5bcf92,null))['catch'](handleError(_0x5bcf92,null));};exports[_0x6620('0x48')]=function(_0x5d4e9a,_0x22635a){var _0x3ad88b;return db[_0x6620('0x49')][_0x6620('0x4a')](function(_0x6656d){return db[_0x6620('0x3e')][_0x6620('0x48')](_0x5d4e9a['body'],{'transaction':_0x6656d})[_0x6620('0x23')](function(_0x489b4d){_0x3ad88b=_0x489b4d;var _0x1b8b7f={'type':db['Sequelize']['TEXT'],'transaction':_0x6656d};switch(_0x5d4e9a[_0x6620('0x46')][_0x6620('0x4b')]){case _0x6620('0x4c'):_0x1b8b7f[_0x6620('0x4b')]=db[_0x6620('0x4d')]['TEXT'];break;case _0x6620('0x4e'):_0x1b8b7f['type']=db[_0x6620('0x4d')]['INTEGER'];break;case _0x6620('0x4f'):_0x1b8b7f[_0x6620('0x4b')]=db['Sequelize'][_0x6620('0x50')];_0x1b8b7f['defaultValue']=![];break;default:}return db[_0x6620('0x49')][_0x6620('0x51')][_0x6620('0x52')](_0x6620('0x53'),util[_0x6620('0x54')](_0x6620('0x55'),_0x3ad88b['id']),_0x1b8b7f);})[_0x6620('0x23')](function(){return _0x3ad88b;});})['then'](respondWithResult(_0x22635a,0xc9))[_0x6620('0x47')](handleError(_0x22635a,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index ea41393..1eb5cb9 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 _0x81bf=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','cm_custom_fields','util','api'];(function(_0x35fdb9,_0x338196){var _0x25f78b=function(_0x317a8e){while(--_0x317a8e){_0x35fdb9['push'](_0x35fdb9['shift']());}};_0x25f78b(++_0x338196);}(_0x81bf,0x1b6));var _0xf81b=function(_0x3c8d82,_0xab4911){_0x3c8d82=_0x3c8d82-0x0;var _0x446e55=_0x81bf[_0x3c8d82];return _0x446e55;};'use strict';var _=require('lodash');var util=require(_0xf81b('0x0'));var logger=require('../../config/logger')(_0xf81b('0x1'));var moment=require(_0xf81b('0x2'));var BPromise=require(_0xf81b('0x3'));var rp=require(_0xf81b('0x4'));var fs=require('fs');var path=require(_0xf81b('0x5'));var rimraf=require(_0xf81b('0x6'));var config=require(_0xf81b('0x7'));var attributes=require(_0xf81b('0x8'));module[_0xf81b('0x9')]=function(_0x3a14e9,_0x5a186b){return _0x3a14e9['define']('CmCustomField',attributes,{'tableName':_0xf81b('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc5e=['../../config/logger','request-promise','rimraf','exports','define','CmCustomField','cm_custom_fields','lodash'];(function(_0x526fe0,_0x2a0f85){var _0x3ff794=function(_0x5198be){while(--_0x5198be){_0x526fe0['push'](_0x526fe0['shift']());}};_0x3ff794(++_0x2a0f85);}(_0xdc5e,0x1df));var _0xedc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc5e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xedc5('0x0'));var util=require('util');var logger=require(_0xedc5('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xedc5('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xedc5('0x3'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0xedc5('0x4')]=function(_0x3b330b,_0xae9e76){return _0x3b330b[_0xedc5('0x5')](_0xedc5('0x6'),attributes,{'tableName':_0xedc5('0x7'),'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 94e5f81..b924450 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 _0x29f5=['bluebird','ioredis','../../config/logger','rpc','../../config/environment','request','then','info','debug','request\x20sent','error','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x50a081,_0x5cdeac){var _0xd3be01=function(_0x240c75){while(--_0x240c75){_0x50a081['push'](_0x50a081['shift']());}};_0xd3be01(++_0x5cdeac);}(_0x29f5,0x12f));var _0x529f=function(_0x4a5a72,_0x528456){_0x4a5a72=_0x4a5a72-0x0;var _0x4363e2=_0x29f5[_0x4a5a72];return _0x4363e2;};'use strict';var _=require(_0x529f('0x0'));var util=require(_0x529f('0x1'));var moment=require(_0x529f('0x2'));var BPromise=require(_0x529f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x529f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x529f('0x5'))(_0x529f('0x6'));var config=require(_0x529f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x205f83,_0x2342e7,_0x411469){return new BPromise(function(_0x432df3,_0x11b961){return client[_0x529f('0x8')](_0x205f83,_0x411469)[_0x529f('0x9')](function(_0x58b578){logger[_0x529f('0xa')]('CmCustomField,\x20%s,\x20%s',_0x2342e7,'request\x20sent');logger[_0x529f('0xb')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x2342e7,_0x529f('0xc'),JSON['stringify'](_0x58b578));if(_0x58b578[_0x529f('0xd')]){if(_0x58b578[_0x529f('0xd')]['code']===0x1f4){logger['error'](_0x529f('0xe'),_0x2342e7,_0x58b578[_0x529f('0xd')][_0x529f('0xf')]);return _0x11b961(_0x58b578['error']['message']);}logger['error'](_0x529f('0xe'),_0x2342e7,_0x58b578[_0x529f('0xd')][_0x529f('0xf')]);return _0x432df3(_0x58b578['error'][_0x529f('0xf')]);}else{logger['info'](_0x529f('0xe'),_0x2342e7,_0x529f('0xc'));_0x432df3(_0x58b578[_0x529f('0x10')][_0x529f('0xf')]);}})[_0x529f('0x11')](function(_0x1b4880){logger[_0x529f('0xd')](_0x529f('0xe'),_0x2342e7,_0x1b4880);_0x11b961(_0x1b4880);});});} \ No newline at end of file +var _0xb02a=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2ecc65,_0xd75c48){var _0x103cc3=function(_0x3f856b){while(--_0x3f856b){_0x2ecc65['push'](_0x2ecc65['shift']());}};_0x103cc3(++_0xd75c48);}(_0xb02a,0xba));var _0xab02=function(_0x40cf0d,_0x2badd5){_0x40cf0d=_0x40cf0d-0x0;var _0x26a9d8=_0xb02a[_0x40cf0d];return _0x26a9d8;};'use strict';var _=require(_0xab02('0x0'));var util=require(_0xab02('0x1'));var moment=require(_0xab02('0x2'));var BPromise=require('bluebird');var rs=require(_0xab02('0x3'));var fs=require('fs');var Redis=require(_0xab02('0x4'));var db=require(_0xab02('0x5'))['db'];var utils=require(_0xab02('0x6'));var logger=require('../../config/logger')(_0xab02('0x7'));var config=require(_0xab02('0x8'));var jayson=require(_0xab02('0x9'));var client=jayson[_0xab02('0xa')][_0xab02('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xeb8541,_0x3fbf56,_0x1aff0e){return new BPromise(function(_0x590ef1,_0x3198db){return client[_0xab02('0xc')](_0xeb8541,_0x1aff0e)[_0xab02('0xd')](function(_0x1a84a9){logger['info'](_0xab02('0xe'),_0x3fbf56,_0xab02('0xf'));logger[_0xab02('0x10')](_0xab02('0x11'),_0x3fbf56,_0xab02('0xf'),JSON[_0xab02('0x12')](_0x1a84a9));if(_0x1a84a9[_0xab02('0x13')]){if(_0x1a84a9['error'][_0xab02('0x14')]===0x1f4){logger[_0xab02('0x13')](_0xab02('0xe'),_0x3fbf56,_0x1a84a9['error'][_0xab02('0x15')]);return _0x3198db(_0x1a84a9[_0xab02('0x13')][_0xab02('0x15')]);}logger[_0xab02('0x13')](_0xab02('0xe'),_0x3fbf56,_0x1a84a9[_0xab02('0x13')][_0xab02('0x15')]);return _0x590ef1(_0x1a84a9[_0xab02('0x13')][_0xab02('0x15')]);}else{logger['info'](_0xab02('0xe'),_0x3fbf56,_0xab02('0xf'));_0x590ef1(_0x1a84a9[_0xab02('0x16')][_0xab02('0x15')]);}})[_0xab02('0x17')](function(_0x13a5e8){logger['error'](_0xab02('0xe'),_0x3fbf56,_0x13a5e8);_0x3198db(_0x13a5e8);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 32510da..966f05b 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 _0x52ad=['index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated'];(function(_0xd9b85e,_0x548328){var _0x126967=function(_0x1a74d2){while(--_0x1a74d2){_0xd9b85e['push'](_0xd9b85e['shift']());}};_0x126967(++_0x548328);}(_0x52ad,0x1d8));var _0xd52a=function(_0x82d134,_0x2ad5ad){_0x82d134=_0x82d134-0x0;var _0x17e63c=_0x52ad[_0x82d134];return _0x17e63c;};'use strict';var multer=require(_0xd52a('0x0'));var util=require(_0xd52a('0x1'));var path=require(_0xd52a('0x2'));var timeout=require(_0xd52a('0x3'));var express=require('express');var router=express[_0xd52a('0x4')]();var fs_extra=require(_0xd52a('0x5'));var auth=require(_0xd52a('0x6'));var interaction=require(_0xd52a('0x7'));var config=require(_0xd52a('0x8'));var controller=require(_0xd52a('0x9'));router[_0xd52a('0xa')]('/',auth[_0xd52a('0xb')](),controller[_0xd52a('0xc')]);router['get'](_0xd52a('0xd'),auth[_0xd52a('0xb')](),controller[_0xd52a('0xe')]);router[_0xd52a('0xf')]('/',auth['isAuthenticated'](),controller[_0xd52a('0x10')]);router[_0xd52a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd52a('0x12')]);router[_0xd52a('0x13')](_0xd52a('0xd'),auth[_0xd52a('0xb')](),controller[_0xd52a('0x14')]);module[_0xd52a('0x15')]=router; \ No newline at end of file +var _0x158f=['show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x40b24f,_0x5e1cc9){var _0xc8ecbb=function(_0x4f0ad4){while(--_0x4f0ad4){_0x40b24f['push'](_0x40b24f['shift']());}};_0xc8ecbb(++_0x5e1cc9);}(_0x158f,0x137));var _0xf158=function(_0x54a28a,_0x1ba1fe){_0x54a28a=_0x54a28a-0x0;var _0x3da1f1=_0x158f[_0x54a28a];return _0x3da1f1;};'use strict';var multer=require('multer');var util=require(_0xf158('0x0'));var path=require(_0xf158('0x1'));var timeout=require(_0xf158('0x2'));var express=require(_0xf158('0x3'));var router=express[_0xf158('0x4')]();var fs_extra=require(_0xf158('0x5'));var auth=require(_0xf158('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf158('0x7'));var controller=require('./cmCustomField.controller');router[_0xf158('0x8')]('/',auth[_0xf158('0x9')](),controller[_0xf158('0xa')]);router[_0xf158('0x8')](_0xf158('0xb'),auth[_0xf158('0x9')](),controller[_0xf158('0xc')]);router[_0xf158('0xd')]('/',auth[_0xf158('0x9')](),controller[_0xf158('0xe')]);router[_0xf158('0xf')](_0xf158('0xb'),auth['isAuthenticated'](),controller[_0xf158('0x10')]);router[_0xf158('0x11')](_0xf158('0xb'),auth[_0xf158('0x9')](),controller['destroy']);module[_0xf158('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 11711af..77b8604 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 _0xfa9c=['DATE','format','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN'];(function(_0x228de9,_0x45b425){var _0x383908=function(_0x565cda){while(--_0x565cda){_0x228de9['push'](_0x228de9['shift']());}};_0x383908(++_0x45b425);}(_0xfa9c,0x11d));var _0xcfa9=function(_0x321603,_0xb0468c){_0x321603=_0x321603-0x0;var _0x568ae1=_0xfa9c[_0x321603];return _0x568ae1;};'use strict';var moment=require(_0xcfa9('0x0'));var Sequelize=require(_0xcfa9('0x1'));module[_0xcfa9('0x2')]={'phone':{'type':Sequelize[_0xcfa9('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xcfa9('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xcfa9('0x5')],'defaultValue':moment()[_0xcfa9('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xcfa9('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcfa9('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcfa9('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcfa9('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xcfa9('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xcfa9('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xcfa9('0x7')],'unique':_0xcfa9('0x9')},'ListId':{'type':Sequelize[_0xcfa9('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xcfa9('0x7')],'unique':_0xcfa9('0x9')},'CampaignId':{'type':Sequelize[_0xcfa9('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcfa9('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcfa9('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcfa9('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcfa9('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xcfa9('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xcfa9('0x3')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xf0b5=['INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0xf0b5,0x142));var _0x5f0b=function(_0x157b51,_0x24dfd7){_0x157b51=_0x157b51-0x0;var _0xc7539=_0xf0b5[_0x157b51];return _0xc7539;};'use strict';var moment=require(_0x5f0b('0x0'));var Sequelize=require(_0x5f0b('0x1'));module[_0x5f0b('0x2')]={'phone':{'type':Sequelize[_0x5f0b('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x5f0b('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x5f0b('0x5')],'defaultValue':moment()[_0x5f0b('0x6')](_0x5f0b('0x7'))},'countbusyretry':{'type':Sequelize[_0x5f0b('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5f0b('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5f0b('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x5f0b('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x5f0b('0x8')](0x2)[_0x5f0b('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x5f0b('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x5f0b('0x8')],'unique':_0x5f0b('0xa')},'ListId':{'type':Sequelize[_0x5f0b('0x8')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x5f0b('0x8')]},'VoiceQueueId':{'type':Sequelize[_0x5f0b('0x8')],'unique':_0x5f0b('0xa')},'CampaignId':{'type':Sequelize[_0x5f0b('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0x5f0b('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5f0b('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5f0b('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5f0b('0x8')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x5f0b('0x8')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5f0b('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x5f0b('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 138fbef..01f2de1 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 _0xfd87=['count','set','Content-Range','update','then','sendStatus','error','stack','name','map','CmHopper','rawAttributes','fieldName','key','model','query','keys','filters','intersection','concat','$and','$or','$gt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','rows','catch','show','create','body','find','params','describe','destroy','CampaignId','VoiceQueue','Campaign','VoiceQueueId','dataValues','createdAt','updatedAt','state','statedesc','membername','user','UserId','deleted','deletedat','calleridnum','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','format','YYYY-MM-DD\x20HH:mm:ss','value','direction','prev','hopperIds','priority','ASC','DESC','isEmpty','scheduledAt','scheduledat','phone','recallme','UPDATE','Contact','CmCompany','Company','List','Queue','dialActive','getPreviewRecall','LOCK','CmList','getOpenContacts','isNumber','json','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','undefined','limit'];(function(_0x5d6e35,_0x4d1ac0){var _0x5d7ada=function(_0x2f7dd3){while(--_0x2f7dd3){_0x5d6e35['push'](_0x5d6e35['shift']());}};_0x5d7ada(++_0x4d1ac0);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x7fd8('0x0'));var _=require(_0x7fd8('0x1'));var qs=require(_0x7fd8('0x2'));var logger=require(_0x7fd8('0x3'))(_0x7fd8('0x4'));var shared=require(_0x7fd8('0x5'));var db=require(_0x7fd8('0x6'))['db'];function respondWithResult(_0x42b06c,_0x4429f2){_0x4429f2=_0x4429f2||0xc8;return function(_0x43b442){if(_0x43b442){return _0x42b06c[_0x7fd8('0x7')](_0x4429f2)['json'](_0x43b442);}};}function respondWithFilteredResult(_0x1395b6,_0x10a778){return function(_0x55681d){if(_0x55681d){var _0x378037=typeof _0x10a778[_0x7fd8('0x8')]===_0x7fd8('0x9')&&typeof _0x10a778[_0x7fd8('0xa')]===_0x7fd8('0x9');var _0x515439=_0x55681d[_0x7fd8('0xb')];var _0x18e3ea=_0x378037?0x0:_0x10a778[_0x7fd8('0x8')];var _0x596d03=_0x378037?_0x55681d['count']:_0x10a778['offset']+_0x10a778[_0x7fd8('0xa')];var _0x4e6096;if(_0x596d03>=_0x515439){_0x596d03=_0x515439;_0x4e6096=0xc8;}else{_0x4e6096=0xce;}_0x1395b6[_0x7fd8('0x7')](_0x4e6096);return _0x1395b6[_0x7fd8('0xc')](_0x7fd8('0xd'),_0x18e3ea+'-'+_0x596d03+'/'+_0x515439)['json'](_0x55681d);}return null;};}function saveUpdates(_0x136770,_0x2cccdb){return function(_0xe84aa7){if(_0xe84aa7){return _0xe84aa7[_0x7fd8('0xe')](_0x136770)[_0x7fd8('0xf')](function(_0x5b7061){return _0x5b7061;});}return null;};}function handleEntityNotFound(_0x1af365,_0x17a3a1){return function(_0x1d481a){if(!_0x1d481a){_0x1af365[_0x7fd8('0x10')](0x194);}return _0x1d481a;};}function handleError(_0x250a02,_0x38d45a){_0x38d45a=_0x38d45a||0x1f4;return function(_0x1a4a52){logger[_0x7fd8('0x11')](_0x1a4a52[_0x7fd8('0x12')]);if(_0x1a4a52[_0x7fd8('0x13')]){delete _0x1a4a52[_0x7fd8('0x13')];}_0x250a02['status'](_0x38d45a)['send'](_0x1a4a52);};}exports['index']=function(_0xab57f7,_0xce23dc){var _0x48734c={},_0x39e301={},_0xb6f53b={'count':0x0,'rows':[]};var _0x40b134=_[_0x7fd8('0x14')](db[_0x7fd8('0x15')][_0x7fd8('0x16')],function(_0x2edf31){return{'name':_0x2edf31[_0x7fd8('0x17')],'type':_0x2edf31['type'][_0x7fd8('0x18')]};});_0x39e301[_0x7fd8('0x19')]=_[_0x7fd8('0x14')](_0x40b134,_0x7fd8('0x13'));_0x39e301[_0x7fd8('0x1a')]=_[_0x7fd8('0x1b')](_0xab57f7['query']);_0x39e301[_0x7fd8('0x1c')]=_[_0x7fd8('0x1d')](_0x39e301[_0x7fd8('0x19')],_0x39e301[_0x7fd8('0x1a')]);_0x39e301['filters']=_[_0x7fd8('0x1e')](_0x39e301[_0x7fd8('0x1c')],[_0x7fd8('0x1f'),_0x7fd8('0x20'),_0x7fd8('0x21'),'$gte','$lt',_0x7fd8('0x22'),_0x7fd8('0x23'),_0x7fd8('0x24'),_0x7fd8('0x25'),_0x7fd8('0x26'),'$notBetween',_0x7fd8('0x27'),_0x7fd8('0x28'),_0x7fd8('0x29'),_0x7fd8('0x2a'),_0x7fd8('0x2b'),'$notILike','$like',_0x7fd8('0x2c'),_0x7fd8('0x2d'),_0x7fd8('0x2e'),_0x7fd8('0x2f')]);_0x48734c['attributes']=_['intersection'](_0x39e301[_0x7fd8('0x19')],qs['fields'](_0xab57f7[_0x7fd8('0x1a')][_0x7fd8('0x30')]));_0x48734c[_0x7fd8('0x31')]=_0x48734c['attributes'][_0x7fd8('0x32')]?_0x48734c['attributes']:_0x39e301[_0x7fd8('0x19')];if(!_0xab57f7[_0x7fd8('0x1a')][_0x7fd8('0x33')](_0x7fd8('0x34'))){_0x48734c[_0x7fd8('0xa')]=qs[_0x7fd8('0xa')](_0xab57f7[_0x7fd8('0x1a')]['limit']);_0x48734c[_0x7fd8('0x8')]=qs[_0x7fd8('0x8')](_0xab57f7[_0x7fd8('0x1a')][_0x7fd8('0x8')]);}_0x48734c[_0x7fd8('0x35')]=qs[_0x7fd8('0x36')](_0xab57f7[_0x7fd8('0x1a')][_0x7fd8('0x36')]);_0x48734c['where']=qs['filters'](_[_0x7fd8('0x37')](_0xab57f7[_0x7fd8('0x1a')],_0x39e301[_0x7fd8('0x1c')]),_0x40b134);if(_0xab57f7['query'][_0x7fd8('0x38')]){_0x48734c['where']=_['merge'](_0x48734c[_0x7fd8('0x39')],{'$or':_[_0x7fd8('0x14')](_0x40b134,function(_0x298dd6){if(_0x298dd6[_0x7fd8('0x3a')]!==_0x7fd8('0x3b')){var _0x3a889e={};_0x3a889e[_0x298dd6[_0x7fd8('0x13')]]={'$like':'%'+_0xab57f7[_0x7fd8('0x1a')]['filter']+'%'};return _0x3a889e;}})});}_0x48734c=_[_0x7fd8('0x3c')]({},_0x48734c,_0xab57f7['options']);var _0x5e6231={'where':_0x48734c[_0x7fd8('0x39')]};return db['CmHopper']['count'](_0x5e6231)['then'](function(_0x6c5e52){_0xb6f53b[_0x7fd8('0xb')]=_0x6c5e52;if(_0xab57f7['query'][_0x7fd8('0x3d')]){_0x48734c[_0x7fd8('0x3e')]=[{'all':!![]}];}return db[_0x7fd8('0x15')]['findAll'](_0x48734c);})['then'](function(_0x4ec65a){_0xb6f53b[_0x7fd8('0x3f')]=_0x4ec65a;return _0xb6f53b;})[_0x7fd8('0xf')](respondWithFilteredResult(_0xce23dc,_0x48734c))[_0x7fd8('0x40')](handleError(_0xce23dc,null));};exports[_0x7fd8('0x41')]=function(_0x1d2eca,_0x1b8737){var _0x2b5abb={'raw':!![],'where':{'id':_0x1d2eca['params']['id']}},_0x501f59={};_0x501f59['model']=_[_0x7fd8('0x1b')](db[_0x7fd8('0x15')][_0x7fd8('0x16')]);_0x501f59['query']=_[_0x7fd8('0x1b')](_0x1d2eca[_0x7fd8('0x1a')]);_0x501f59[_0x7fd8('0x1c')]=_[_0x7fd8('0x1d')](_0x501f59['model'],_0x501f59[_0x7fd8('0x1a')]);_0x2b5abb[_0x7fd8('0x31')]=_['intersection'](_0x501f59[_0x7fd8('0x19')],qs['fields'](_0x1d2eca[_0x7fd8('0x1a')][_0x7fd8('0x30')]));_0x2b5abb[_0x7fd8('0x31')]=_0x2b5abb[_0x7fd8('0x31')]['length']?_0x2b5abb[_0x7fd8('0x31')]:_0x501f59[_0x7fd8('0x19')];if(_0x1d2eca[_0x7fd8('0x1a')][_0x7fd8('0x3d')]){_0x2b5abb[_0x7fd8('0x3e')]=[{'all':!![]}];}_0x2b5abb=_[_0x7fd8('0x3c')]({},_0x2b5abb,_0x1d2eca['options']);return db['CmHopper']['find'](_0x2b5abb)[_0x7fd8('0xf')](handleEntityNotFound(_0x1b8737,null))[_0x7fd8('0xf')](respondWithResult(_0x1b8737,null))['catch'](handleError(_0x1b8737,null));};exports['create']=function(_0x328e81,_0x371a02){return db['CmHopper'][_0x7fd8('0x42')](_0x328e81[_0x7fd8('0x43')],{})[_0x7fd8('0xf')](respondWithResult(_0x371a02,0xc9))['catch'](handleError(_0x371a02,null));};exports[_0x7fd8('0xe')]=function(_0x47462e,_0x4f6a65){if(_0x47462e[_0x7fd8('0x43')]['id']){delete _0x47462e['body']['id'];}return db[_0x7fd8('0x15')][_0x7fd8('0x44')]({'where':{'id':_0x47462e[_0x7fd8('0x45')]['id']}})[_0x7fd8('0xf')](handleEntityNotFound(_0x4f6a65,null))[_0x7fd8('0xf')](saveUpdates(_0x47462e[_0x7fd8('0x43')],null))[_0x7fd8('0xf')](respondWithResult(_0x4f6a65,null))[_0x7fd8('0x40')](handleError(_0x4f6a65,null));};exports['describe']=function(_0x1666e7,_0x5ca89e){return db[_0x7fd8('0x15')][_0x7fd8('0x46')]()['then'](respondWithResult(_0x5ca89e,null))[_0x7fd8('0x40')](handleError(_0x5ca89e,null));};exports[_0x7fd8('0x47')]=function(_0x5cbc91,_0x5e3a45){var _0x59dc51;var _0xcfb3a8=_0x5cbc91['params']['id'];return db[_0x7fd8('0x15')][_0x7fd8('0x44')]({'where':{'id':_0x5cbc91[_0x7fd8('0x45')]['id']}})[_0x7fd8('0xf')](handleEntityNotFound(_0x5e3a45,null))[_0x7fd8('0xf')](function(_0x4bbd34){if(_0x4bbd34){return _0x4bbd34['destroy']()[_0x7fd8('0xf')](function(_0x46c230){return _0x46c230;});}})[_0x7fd8('0xf')](function(_0x169317){_0x59dc51=_0x169317;if(_0x169317){if(_0x169317['VoiceQueueId']||_0x169317[_0x7fd8('0x48')]){return db[_0x169317['VoiceQueueId']?_0x7fd8('0x49'):_0x7fd8('0x4a')][_0x7fd8('0x44')]({'where':{'id':_0x169317[_0x7fd8('0x4b')]?_0x169317[_0x7fd8('0x4b')]:_0x169317[_0x7fd8('0x48')]},'attributes':['id',_0x7fd8('0x13')],'raw':!![]});}}})[_0x7fd8('0xf')](function(_0x369e11){var _0x20f460={};if(_0x369e11){_[_0x7fd8('0x3c')](_0x20f460,_['omit'](_0x59dc51[_0x7fd8('0x4c')],[_0x7fd8('0x4d'),_0x7fd8('0x4e'),'id']));_0x20f460[_0x7fd8('0x4f')]=0x15;_0x20f460[_0x7fd8('0x50')]='deleted';_0x20f460['campaign']=_0x369e11['name'];_0x20f460[_0x7fd8('0x51')]=_0x5cbc91[_0x7fd8('0x52')][_0x7fd8('0x13')];_0x20f460[_0x7fd8('0x53')]=_0x5cbc91[_0x7fd8('0x52')]['id'];_0x20f460[_0x7fd8('0x54')]=!![];_0x20f460[_0x7fd8('0x55')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x20f460[_0x7fd8('0x56')]=_0x59dc51['phone'];_0x20f460[_0x7fd8('0x57')]=_0x59dc51[_0x7fd8('0x4b')]?'queue':_0x7fd8('0x58');return db[_0x7fd8('0x59')]['find']({'where':{'id':_0x20f460[_0x7fd8('0x5a')]},'attributes':[_0x7fd8('0x5b'),_0x7fd8('0x5c')]})[_0x7fd8('0xf')](function(_0x47013a){if(!_[_0x7fd8('0x5d')](_0x5e3a45)&&!_[_0x7fd8('0x5d')](_0x47013a['firstName'])){_0x20f460[_0x7fd8('0x5e')]=_0x47013a[_0x7fd8('0x5b')];if(!_[_0x7fd8('0x5d')](_0x47013a[_0x7fd8('0x5c')])){_0x20f460[_0x7fd8('0x5e')]+='\x20'+_0x47013a['lastName'];}}})[_0x7fd8('0x5f')](function(){return db[_0x7fd8('0x60')][_0x7fd8('0x42')](_0x20f460);});}})['then'](function(_0x5e7495){return db[_0x7fd8('0x61')][_0x7fd8('0x47')]({'where':{'CmHopperId':_0xcfb3a8}});})[_0x7fd8('0xf')](function(){return _0x5e3a45[_0x7fd8('0x7')](0xcc)[_0x7fd8('0x62')]();})[_0x7fd8('0x40')](handleError(_0x5e3a45,null));};exports['getPreview']=function(_0x24756f,_0x1cb6e4){var _0xa04550=[];return db[_0x7fd8('0x59')]['describe']()[_0x7fd8('0xf')](function(_0x6118d7){_0xa04550=_[_0x7fd8('0x1b')](_0x6118d7);return _0x24756f[_0x7fd8('0x52')][_0x7fd8('0x63')]({'where':{'type':_0x7fd8('0x64'),'dialActive':!![],'dialMethod':_0x7fd8('0x65')},'attributes':['id',_0x7fd8('0x66'),_0x7fd8('0x67')],'raw':!![]});})[_0x7fd8('0xf')](function(_0x3fc049){if(_0x3fc049&&_0x3fc049[_0x7fd8('0x32')]){return db[_0x7fd8('0x68')][_0x7fd8('0x69')](function(_0x5cb9a0){var _0x48e1cc={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7fd8('0x6a')](_0x7fd8('0x6b'))},'VoiceQueueId':{'$in':_[_0x7fd8('0x14')](_0x3fc049,'id')},'$or':[{'UserId':null},{'UserId':_0x24756f[_0x7fd8('0x52')]['id']}]};var _0xd62b0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3fc049)['filter'](['dialPreviewAutoRecallMe',0x0])[_0x7fd8('0x14')]('id')[_0x7fd8('0x6c')]()},'$or':[{'UserId':null},{'UserId':_0x24756f['user']['id']}]};var _0x4c04b3={'$or':[_0x48e1cc,_0xd62b0]};var _0x489bf3=[];if(_0x24756f[_0x7fd8('0x43')][_0x7fd8('0x6d')]&&_0x24756f[_0x7fd8('0x43')][_0x7fd8('0x6d')]===_0x7fd8('0x6e')){if(!_['isEmpty'](_0x24756f['body'][_0x7fd8('0x6f')])){_0x4c04b3['id']={'$in':_0x24756f[_0x7fd8('0x43')]['hopperIds']};}_0x489bf3=[[_0x7fd8('0x70'),_0x7fd8('0x71')],['scheduledAt',_0x3fc049[0x0][_0x7fd8('0x66')]==='ASC'?_0x7fd8('0x72'):'ASC'],db[_0x7fd8('0x68')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x7fd8('0x72')]];}else{if(!_[_0x7fd8('0x73')](_0x24756f['body'][_0x7fd8('0x6f')])){_0x4c04b3['id']={'$notIn':_0x24756f['body'][_0x7fd8('0x6f')]};}_0x489bf3=[[_0x7fd8('0x70'),_0x7fd8('0x72')],[_0x7fd8('0x74'),_0x3fc049[0x0][_0x7fd8('0x66')]],db[_0x7fd8('0x68')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x7fd8('0x71')]];}return db['CmHopper']['findOne']({'attributes':['id',_0x7fd8('0x75'),_0x7fd8('0x76'),_0x7fd8('0x77')],'where':_0x4c04b3,'order':_0x489bf3,'transaction':_0x5cb9a0,'lock':_0x5cb9a0['LOCK'][_0x7fd8('0x78')],'include':[{'model':db[_0x7fd8('0x59')],'as':_0x7fd8('0x79'),'attributes':_0xa04550,'include':[{'model':db[_0x7fd8('0x7a')],'as':_0x7fd8('0x7b'),'attributes':['id',_0x7fd8('0x13')]}]},{'model':db['CmList'],'as':_0x7fd8('0x7c'),'attributes':['id',_0x7fd8('0x13')]},{'model':db[_0x7fd8('0x49')],'as':_0x7fd8('0x7d'),'attributes':['id',_0x7fd8('0x13'),_0x7fd8('0x7e')]}]})[_0x7fd8('0xf')](function(_0x1c46eb){if(_0x1c46eb){return _0x1c46eb['update']({'UserId':_0x24756f[_0x7fd8('0x52')]['id']},{'transaction':_0x5cb9a0});}});});}})[_0x7fd8('0xf')](handleEntityNotFound(_0x1cb6e4,null))[_0x7fd8('0xf')](respondWithResult(_0x1cb6e4,null))['catch'](handleError(_0x1cb6e4,null));};exports[_0x7fd8('0x7f')]=function(_0x4394f3,_0x1fd9bc,_0x4426cb){var _0x43fef0=[];var _0xafff06=_0x4394f3['params']['id'];var _0x335333=_0x4394f3[_0x7fd8('0x52')]['id'];return db[_0x7fd8('0x59')][_0x7fd8('0x46')]()['then'](function(_0x72429a){_0x43fef0=_[_0x7fd8('0x1b')](_0x72429a);return db[_0x7fd8('0x68')][_0x7fd8('0x69')](function(_0x42e7ae){const _0x296119={'id':_0xafff06};return db['CmHopper']['findOne']({'attributes':['id','scheduledat',_0x7fd8('0x77')],'where':_0x296119,'transaction':_0x42e7ae,'lock':_0x42e7ae[_0x7fd8('0x80')]['UPDATE'],'include':[{'model':db[_0x7fd8('0x59')],'as':'Contact','attributes':_0x43fef0,'include':[{'model':db[_0x7fd8('0x7a')],'as':_0x7fd8('0x7b'),'attributes':['id',_0x7fd8('0x13')]}]},{'model':db[_0x7fd8('0x81')],'as':_0x7fd8('0x7c'),'attributes':['id',_0x7fd8('0x13')]},{'model':db[_0x7fd8('0x49')],'as':_0x7fd8('0x7d'),'attributes':['id',_0x7fd8('0x13'),_0x7fd8('0x7e')]}]})[_0x7fd8('0xf')](function(_0x446b01){if(_0x446b01){return _0x446b01[_0x7fd8('0xe')]({'UserId':_0x335333},{'transaction':_0x42e7ae});}});});})['then'](handleEntityNotFound(_0x1fd9bc,null))[_0x7fd8('0xf')](respondWithResult(_0x1fd9bc,null))[_0x7fd8('0x40')](handleError(_0x1fd9bc,null));};exports[_0x7fd8('0x82')]=function(_0x3c353c,_0x68df89){return _0x3c353c['user'][_0x7fd8('0x63')]({'where':{'type':_0x7fd8('0x64'),'dialActive':!![],'dialMethod':_0x7fd8('0x65')},'attributes':['id'],'raw':!![]})[_0x7fd8('0xf')](function(_0x58f956){if(_0x58f956&&_0x58f956[_0x7fd8('0x32')]){return db[_0x7fd8('0x15')][_0x7fd8('0xb')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7fd8('0x6a')](_0x7fd8('0x6b'))},'VoiceQueueId':{'$in':_['map'](_0x58f956,'id')},'$or':[{'UserId':null},{'UserId':_0x3c353c[_0x7fd8('0x52')]['id']}]}});}return 0x0;})['then'](function(_0x111114){if(!_[_0x7fd8('0x5d')](_0x111114)&&_[_0x7fd8('0x83')](_0x111114)){return _0x68df89['status'](0xc8)[_0x7fd8('0x84')]({'contacts':_0x111114});}else{logger[_0x7fd8('0x11')](_0x7fd8('0x85'),_0x7fd8('0x82'),0x194,'entity\x20not\x20found');_0x68df89[_0x7fd8('0x10')](0x194);}})[_0x7fd8('0x40')](handleError(_0x68df89,null));};exports[_0x7fd8('0x86')]=function(_0x4cfe36,_0x408a07){var _0x148843=shared[_0x7fd8('0x87')];var _0xb66bee=[];_[_0x7fd8('0x14')](_0x148843,function(_0x147343){_0xb66bee[_0x7fd8('0x88')]({'id':_0x147343[_0x7fd8('0x13')],'name':_0x147343[_0x7fd8('0x13')],'utcOffset':_0x147343[_0x7fd8('0x89')]});});return _0x408a07['status'](0xc8)[_0x7fd8('0x84')]({'tz':_0xb66bee});};exports[_0x7fd8('0x8a')]=function(_0x2affd1,_0x15025d){var _0x56aff8=shared[_0x7fd8('0x87')];var _0x5f28fa={};if(!_['isNil'](_0x56aff8[_0x2affd1[_0x7fd8('0x43')]['id']]))_0x5f28fa=_0x56aff8[_0x2affd1['body']['id']];return _0x15025d[_0x7fd8('0x7')](0xc8)[_0x7fd8('0x84')](_0x5f28fa);}; \ No newline at end of file +var _0x06f4=['CmHopperFinal','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','length','sequelize','transaction','direction','prev','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','Contact','Company','CmList','List','VoiceQueue','Queue','dialActive','LOCK','CmCompany','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','timezones','push','utcOffset','getTimezone','moment','lodash','../../config/logger','api','status','json','offset','undefined','limit','count','set','update','then','sendStatus','error','name','index','map','CmHopper','fieldName','key','query','intersection','model','concat','$and','$or','$gt','$gte','$lt','$eq','$between','$notBetween','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','include','findAll','rows','catch','show','params','keys','includeAll','options','create','body','find','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally'];(function(_0x48f04e,_0x3707c6){var _0x56cd4c=function(_0x409a88){while(--_0x409a88){_0x48f04e['push'](_0x48f04e['shift']());}};_0x56cd4c(++_0x3707c6);}(_0x06f4,0x136));var _0x406f=function(_0x2132d8,_0x12b333){_0x2132d8=_0x2132d8-0x0;var _0x2aa746=_0x06f4[_0x2132d8];return _0x2aa746;};'use strict';var moment=require(_0x406f('0x0'));var _=require(_0x406f('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x406f('0x2'))(_0x406f('0x3'));var shared=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithResult(_0x3a4ff0,_0x5ed32f){_0x5ed32f=_0x5ed32f||0xc8;return function(_0x32abfd){if(_0x32abfd){return _0x3a4ff0[_0x406f('0x4')](_0x5ed32f)[_0x406f('0x5')](_0x32abfd);}};}function respondWithFilteredResult(_0x32b2bd,_0x59821c){return function(_0x1d2886){if(_0x1d2886){var _0x5bec4f=typeof _0x59821c[_0x406f('0x6')]===_0x406f('0x7')&&typeof _0x59821c[_0x406f('0x8')]==='undefined';var _0x407936=_0x1d2886['count'];var _0x5b46bf=_0x5bec4f?0x0:_0x59821c[_0x406f('0x6')];var _0x56edc2=_0x5bec4f?_0x1d2886[_0x406f('0x9')]:_0x59821c['offset']+_0x59821c[_0x406f('0x8')];var _0x5af7cd;if(_0x56edc2>=_0x407936){_0x56edc2=_0x407936;_0x5af7cd=0xc8;}else{_0x5af7cd=0xce;}_0x32b2bd[_0x406f('0x4')](_0x5af7cd);return _0x32b2bd[_0x406f('0xa')]('Content-Range',_0x5b46bf+'-'+_0x56edc2+'/'+_0x407936)[_0x406f('0x5')](_0x1d2886);}return null;};}function saveUpdates(_0x380382,_0x451592){return function(_0x163de4){if(_0x163de4){return _0x163de4[_0x406f('0xb')](_0x380382)[_0x406f('0xc')](function(_0x29aef9){return _0x29aef9;});}return null;};}function handleEntityNotFound(_0xcc1d6,_0x4522b2){return function(_0x5045e8){if(!_0x5045e8){_0xcc1d6[_0x406f('0xd')](0x194);}return _0x5045e8;};}function handleError(_0x489445,_0x1bf795){_0x1bf795=_0x1bf795||0x1f4;return function(_0x28fda6){logger[_0x406f('0xe')](_0x28fda6['stack']);if(_0x28fda6[_0x406f('0xf')]){delete _0x28fda6[_0x406f('0xf')];}_0x489445['status'](_0x1bf795)['send'](_0x28fda6);};}exports[_0x406f('0x10')]=function(_0x4357e3,_0x509bae){var _0x2e4409={},_0x57d93a={},_0xe186fb={'count':0x0,'rows':[]};var _0x3ad3fe=_[_0x406f('0x11')](db[_0x406f('0x12')]['rawAttributes'],function(_0x492c68){return{'name':_0x492c68[_0x406f('0x13')],'type':_0x492c68['type'][_0x406f('0x14')]};});_0x57d93a['model']=_[_0x406f('0x11')](_0x3ad3fe,_0x406f('0xf'));_0x57d93a[_0x406f('0x15')]=_['keys'](_0x4357e3['query']);_0x57d93a['filters']=_[_0x406f('0x16')](_0x57d93a[_0x406f('0x17')],_0x57d93a[_0x406f('0x15')]);_0x57d93a['filters']=_[_0x406f('0x18')](_0x57d93a['filters'],[_0x406f('0x19'),_0x406f('0x1a'),_0x406f('0x1b'),_0x406f('0x1c'),_0x406f('0x1d'),'$lte','$ne',_0x406f('0x1e'),'$not',_0x406f('0x1f'),_0x406f('0x20'),'$in','$notIn',_0x406f('0x21'),'$notLike',_0x406f('0x22'),_0x406f('0x23'),_0x406f('0x21'),_0x406f('0x24'),_0x406f('0x25'),_0x406f('0x26'),_0x406f('0x27')]);_0x2e4409[_0x406f('0x28')]=_['intersection'](_0x57d93a['model'],qs[_0x406f('0x29')](_0x4357e3[_0x406f('0x15')][_0x406f('0x29')]));_0x2e4409[_0x406f('0x28')]=_0x2e4409['attributes']['length']?_0x2e4409[_0x406f('0x28')]:_0x57d93a[_0x406f('0x17')];if(!_0x4357e3['query']['hasOwnProperty'](_0x406f('0x2a'))){_0x2e4409[_0x406f('0x8')]=qs[_0x406f('0x8')](_0x4357e3[_0x406f('0x15')][_0x406f('0x8')]);_0x2e4409[_0x406f('0x6')]=qs[_0x406f('0x6')](_0x4357e3[_0x406f('0x15')][_0x406f('0x6')]);}_0x2e4409[_0x406f('0x2b')]=qs[_0x406f('0x2c')](_0x4357e3[_0x406f('0x15')][_0x406f('0x2c')]);_0x2e4409['where']=qs[_0x406f('0x2d')](_[_0x406f('0x2e')](_0x4357e3[_0x406f('0x15')],_0x57d93a[_0x406f('0x2d')]),_0x3ad3fe);if(_0x4357e3[_0x406f('0x15')][_0x406f('0x2f')]){_0x2e4409[_0x406f('0x30')]=_[_0x406f('0x31')](_0x2e4409[_0x406f('0x30')],{'$or':_[_0x406f('0x11')](_0x3ad3fe,function(_0x52b465){if(_0x52b465[_0x406f('0x32')]!==_0x406f('0x33')){var _0x36a17a={};_0x36a17a[_0x52b465[_0x406f('0xf')]]={'$like':'%'+_0x4357e3[_0x406f('0x15')][_0x406f('0x2f')]+'%'};return _0x36a17a;}})});}_0x2e4409=_['merge']({},_0x2e4409,_0x4357e3['options']);var _0x44c63a={'where':_0x2e4409[_0x406f('0x30')]};return db['CmHopper'][_0x406f('0x9')](_0x44c63a)['then'](function(_0x43fb4f){_0xe186fb[_0x406f('0x9')]=_0x43fb4f;if(_0x4357e3[_0x406f('0x15')]['includeAll']){_0x2e4409[_0x406f('0x34')]=[{'all':!![]}];}return db[_0x406f('0x12')][_0x406f('0x35')](_0x2e4409);})[_0x406f('0xc')](function(_0x224e9d){_0xe186fb[_0x406f('0x36')]=_0x224e9d;return _0xe186fb;})[_0x406f('0xc')](respondWithFilteredResult(_0x509bae,_0x2e4409))[_0x406f('0x37')](handleError(_0x509bae,null));};exports[_0x406f('0x38')]=function(_0x14c27f,_0x17f217){var _0x37c4d2={'raw':!![],'where':{'id':_0x14c27f[_0x406f('0x39')]['id']}},_0x279e9e={};_0x279e9e[_0x406f('0x17')]=_['keys'](db['CmHopper']['rawAttributes']);_0x279e9e[_0x406f('0x15')]=_[_0x406f('0x3a')](_0x14c27f[_0x406f('0x15')]);_0x279e9e['filters']=_[_0x406f('0x16')](_0x279e9e[_0x406f('0x17')],_0x279e9e[_0x406f('0x15')]);_0x37c4d2[_0x406f('0x28')]=_[_0x406f('0x16')](_0x279e9e[_0x406f('0x17')],qs['fields'](_0x14c27f[_0x406f('0x15')][_0x406f('0x29')]));_0x37c4d2['attributes']=_0x37c4d2[_0x406f('0x28')]['length']?_0x37c4d2['attributes']:_0x279e9e[_0x406f('0x17')];if(_0x14c27f[_0x406f('0x15')][_0x406f('0x3b')]){_0x37c4d2[_0x406f('0x34')]=[{'all':!![]}];}_0x37c4d2=_[_0x406f('0x31')]({},_0x37c4d2,_0x14c27f[_0x406f('0x3c')]);return db['CmHopper']['find'](_0x37c4d2)[_0x406f('0xc')](handleEntityNotFound(_0x17f217,null))[_0x406f('0xc')](respondWithResult(_0x17f217,null))[_0x406f('0x37')](handleError(_0x17f217,null));};exports[_0x406f('0x3d')]=function(_0x453289,_0x2b226e){return db[_0x406f('0x12')]['create'](_0x453289[_0x406f('0x3e')],{})[_0x406f('0xc')](respondWithResult(_0x2b226e,0xc9))[_0x406f('0x37')](handleError(_0x2b226e,null));};exports[_0x406f('0xb')]=function(_0x792ac9,_0x17c499){if(_0x792ac9[_0x406f('0x3e')]['id']){delete _0x792ac9[_0x406f('0x3e')]['id'];}return db[_0x406f('0x12')][_0x406f('0x3f')]({'where':{'id':_0x792ac9[_0x406f('0x39')]['id']}})['then'](handleEntityNotFound(_0x17c499,null))[_0x406f('0xc')](saveUpdates(_0x792ac9[_0x406f('0x3e')],null))['then'](respondWithResult(_0x17c499,null))['catch'](handleError(_0x17c499,null));};exports[_0x406f('0x40')]=function(_0x3eb55b,_0x2a13c3){return db[_0x406f('0x12')]['describe']()[_0x406f('0xc')](respondWithResult(_0x2a13c3,null))['catch'](handleError(_0x2a13c3,null));};exports[_0x406f('0x41')]=function(_0x351d2f,_0x5b1143){var _0x5a91dd;var _0x1bdb59=_0x351d2f[_0x406f('0x39')]['id'];return db[_0x406f('0x12')][_0x406f('0x3f')]({'where':{'id':_0x351d2f['params']['id']}})[_0x406f('0xc')](handleEntityNotFound(_0x5b1143,null))[_0x406f('0xc')](function(_0x8ef14b){if(_0x8ef14b){return _0x8ef14b[_0x406f('0x41')]()['then'](function(_0x5d4041){return _0x5d4041;});}})[_0x406f('0xc')](function(_0x244fcf){_0x5a91dd=_0x244fcf;if(_0x244fcf){if(_0x244fcf[_0x406f('0x42')]||_0x244fcf[_0x406f('0x43')]){return db[_0x244fcf[_0x406f('0x42')]?'VoiceQueue':_0x406f('0x44')][_0x406f('0x3f')]({'where':{'id':_0x244fcf['VoiceQueueId']?_0x244fcf['VoiceQueueId']:_0x244fcf[_0x406f('0x43')]},'attributes':['id',_0x406f('0xf')],'raw':!![]});}}})[_0x406f('0xc')](function(_0x4b0b19){var _0x1a99b9={};if(_0x4b0b19){_[_0x406f('0x31')](_0x1a99b9,_[_0x406f('0x45')](_0x5a91dd[_0x406f('0x46')],[_0x406f('0x47'),_0x406f('0x48'),'id']));_0x1a99b9[_0x406f('0x49')]=0x15;_0x1a99b9[_0x406f('0x4a')]=_0x406f('0x4b');_0x1a99b9['campaign']=_0x4b0b19['name'];_0x1a99b9[_0x406f('0x4c')]=_0x351d2f[_0x406f('0x4d')][_0x406f('0xf')];_0x1a99b9[_0x406f('0x4e')]=_0x351d2f[_0x406f('0x4d')]['id'];_0x1a99b9[_0x406f('0x4b')]=!![];_0x1a99b9[_0x406f('0x4f')]=moment()[_0x406f('0x50')](_0x406f('0x51'));_0x1a99b9[_0x406f('0x52')]=_0x5a91dd['phone'];_0x1a99b9['campaigntype']=_0x5a91dd[_0x406f('0x42')]?_0x406f('0x53'):_0x406f('0x54');return db[_0x406f('0x55')][_0x406f('0x3f')]({'where':{'id':_0x1a99b9[_0x406f('0x56')]},'attributes':['firstName',_0x406f('0x57')]})[_0x406f('0xc')](function(_0x39f7f6){if(!_[_0x406f('0x58')](_0x5b1143)&&!_[_0x406f('0x58')](_0x39f7f6[_0x406f('0x59')])){_0x1a99b9[_0x406f('0x5a')]=_0x39f7f6[_0x406f('0x59')];if(!_[_0x406f('0x58')](_0x39f7f6[_0x406f('0x57')])){_0x1a99b9['calleridname']+='\x20'+_0x39f7f6[_0x406f('0x57')];}}})[_0x406f('0x5b')](function(){return db[_0x406f('0x5c')]['create'](_0x1a99b9);});}})[_0x406f('0xc')](function(_0x538517){return db['CmHopperAdditionalPhone'][_0x406f('0x41')]({'where':{'CmHopperId':_0x1bdb59}});})[_0x406f('0xc')](function(){return _0x5b1143['status'](0xcc)[_0x406f('0x5d')]();})['catch'](handleError(_0x5b1143,null));};exports[_0x406f('0x5e')]=function(_0x4a4bf8,_0x2c3881){var _0x48bca4=[];return db[_0x406f('0x55')][_0x406f('0x40')]()['then'](function(_0x5dd1e8){_0x48bca4=_[_0x406f('0x3a')](_0x5dd1e8);return _0x4a4bf8[_0x406f('0x4d')][_0x406f('0x5f')]({'where':{'type':_0x406f('0x60'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x406f('0x61'),_0x406f('0x62')],'raw':!![]});})[_0x406f('0xc')](function(_0x41839a){if(_0x41839a&&_0x41839a[_0x406f('0x63')]){return db[_0x406f('0x64')][_0x406f('0x65')](function(_0x5c1a91){var _0x44297b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x406f('0x51'))},'VoiceQueueId':{'$in':_[_0x406f('0x11')](_0x41839a,'id')},'$or':[{'UserId':null},{'UserId':_0x4a4bf8[_0x406f('0x4d')]['id']}]};var _0x55cac0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x41839a)[_0x406f('0x2f')]([_0x406f('0x62'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x4a4bf8[_0x406f('0x4d')]['id']}]};var _0x468e2b={'$or':[_0x44297b,_0x55cac0]};var _0x4a150b=[];if(_0x4a4bf8['body']['direction']&&_0x4a4bf8[_0x406f('0x3e')][_0x406f('0x66')]===_0x406f('0x67')){if(!_['isEmpty'](_0x4a4bf8['body'][_0x406f('0x68')])){_0x468e2b['id']={'$in':_0x4a4bf8[_0x406f('0x3e')][_0x406f('0x68')]};}_0x4a150b=[[_0x406f('0x69'),_0x406f('0x6a')],['scheduledAt',_0x41839a[0x0][_0x406f('0x61')]===_0x406f('0x6a')?_0x406f('0x6b'):_0x406f('0x6a')],db[_0x406f('0x64')][_0x406f('0x6c')](_0x406f('0x6d')),['id',_0x406f('0x6b')]];}else{if(!_[_0x406f('0x6e')](_0x4a4bf8[_0x406f('0x3e')][_0x406f('0x68')])){_0x468e2b['id']={'$notIn':_0x4a4bf8[_0x406f('0x3e')][_0x406f('0x68')]};}_0x4a150b=[[_0x406f('0x69'),_0x406f('0x6b')],[_0x406f('0x6f'),_0x41839a[0x0][_0x406f('0x61')]],db['sequelize'][_0x406f('0x6c')](_0x406f('0x70')),['id',_0x406f('0x6a')]];}return db['CmHopper'][_0x406f('0x71')]({'attributes':['id',_0x406f('0x72'),'phone',_0x406f('0x73')],'where':_0x468e2b,'order':_0x4a150b,'transaction':_0x5c1a91,'lock':_0x5c1a91['LOCK']['UPDATE'],'include':[{'model':db[_0x406f('0x55')],'as':_0x406f('0x74'),'attributes':_0x48bca4,'include':[{'model':db['CmCompany'],'as':_0x406f('0x75'),'attributes':['id','name']}]},{'model':db[_0x406f('0x76')],'as':_0x406f('0x77'),'attributes':['id',_0x406f('0xf')]},{'model':db[_0x406f('0x78')],'as':_0x406f('0x79'),'attributes':['id',_0x406f('0xf'),_0x406f('0x7a')]}]})[_0x406f('0xc')](function(_0x3e9e31){if(_0x3e9e31){return _0x3e9e31['update']({'UserId':_0x4a4bf8[_0x406f('0x4d')]['id']},{'transaction':_0x5c1a91});}});});}})['then'](handleEntityNotFound(_0x2c3881,null))[_0x406f('0xc')](respondWithResult(_0x2c3881,null))['catch'](handleError(_0x2c3881,null));};exports['getPreviewRecall']=function(_0x519cd9,_0x14ce45,_0x3f0e29){var _0x2bb105=[];var _0x156fa5=_0x519cd9[_0x406f('0x39')]['id'];var _0x552db1=_0x519cd9['user']['id'];return db['CmContact'][_0x406f('0x40')]()['then'](function(_0x31212a){_0x2bb105=_[_0x406f('0x3a')](_0x31212a);return db[_0x406f('0x64')][_0x406f('0x65')](function(_0x238912){const _0x1b2e3c={'id':_0x156fa5};return db['CmHopper']['findOne']({'attributes':['id',_0x406f('0x72'),_0x406f('0x73')],'where':_0x1b2e3c,'transaction':_0x238912,'lock':_0x238912[_0x406f('0x7b')]['UPDATE'],'include':[{'model':db[_0x406f('0x55')],'as':_0x406f('0x74'),'attributes':_0x2bb105,'include':[{'model':db[_0x406f('0x7c')],'as':_0x406f('0x75'),'attributes':['id',_0x406f('0xf')]}]},{'model':db['CmList'],'as':_0x406f('0x77'),'attributes':['id',_0x406f('0xf')]},{'model':db[_0x406f('0x78')],'as':_0x406f('0x79'),'attributes':['id',_0x406f('0xf'),_0x406f('0x7a')]}]})[_0x406f('0xc')](function(_0x23ae6b){if(_0x23ae6b){return _0x23ae6b['update']({'UserId':_0x552db1},{'transaction':_0x238912});}});});})['then'](handleEntityNotFound(_0x14ce45,null))['then'](respondWithResult(_0x14ce45,null))[_0x406f('0x37')](handleError(_0x14ce45,null));};exports['getOpenContacts']=function(_0x5ec137,_0x2c032b){return _0x5ec137[_0x406f('0x4d')][_0x406f('0x5f')]({'where':{'type':_0x406f('0x60'),'dialActive':!![],'dialMethod':_0x406f('0x7d')},'attributes':['id'],'raw':!![]})['then'](function(_0x58206a){if(_0x58206a&&_0x58206a[_0x406f('0x63')]){return db[_0x406f('0x12')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x406f('0x50')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x406f('0x11')](_0x58206a,'id')},'$or':[{'UserId':null},{'UserId':_0x5ec137[_0x406f('0x4d')]['id']}]}});}return 0x0;})['then'](function(_0x110072){if(!_[_0x406f('0x58')](_0x110072)&&_[_0x406f('0x7e')](_0x110072)){return _0x2c032b[_0x406f('0x4')](0xc8)[_0x406f('0x5')]({'contacts':_0x110072});}else{logger[_0x406f('0xe')](_0x406f('0x7f'),_0x406f('0x80'),0x194,_0x406f('0x81'));_0x2c032b[_0x406f('0xd')](0x194);}})[_0x406f('0x37')](handleError(_0x2c032b,null));};exports['getTimezones']=function(_0x35968c,_0x16791a){var _0x169662=shared[_0x406f('0x82')];var _0x2bf211=[];_[_0x406f('0x11')](_0x169662,function(_0x115736){_0x2bf211[_0x406f('0x83')]({'id':_0x115736[_0x406f('0xf')],'name':_0x115736['name'],'utcOffset':_0x115736[_0x406f('0x84')]});});return _0x16791a[_0x406f('0x4')](0xc8)['json']({'tz':_0x2bf211});};exports[_0x406f('0x85')]=function(_0x2213b4,_0x39fe38){var _0x42a297=shared[_0x406f('0x82')];var _0x2178ac={};if(!_['isNil'](_0x42a297[_0x2213b4[_0x406f('0x3e')]['id']]))_0x2178ac=_0x42a297[_0x2213b4[_0x406f('0x3e')]['id']];return _0x39fe38['status'](0xc8)[_0x406f('0x5')](_0x2178ac);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 50707c3..84adebc 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 _0x5fc3=['scheduledat','phone','priority','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopper.attributes','exports','define','cm_hopper'];(function(_0x24fb96,_0x4d1674){var _0x584c04=function(_0x5141f8){while(--_0x5141f8){_0x24fb96['push'](_0x24fb96['shift']());}};_0x584c04(++_0x4d1674);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2984d0,_0x1a7211){_0x2984d0=_0x2984d0-0x0;var _0x2885f2=_0x5fc3[_0x2984d0];return _0x2885f2;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('CmHopper',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]},{'name':_0x35fc('0xd'),'fields':[_0x35fc('0xd')]},{'name':_0x35fc('0xe'),'fields':[_0x35fc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeff8=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone'];(function(_0x174ea9,_0x3b457c){var _0x51fbb8=function(_0x45fb23){while(--_0x45fb23){_0x174ea9['push'](_0x174ea9['shift']());}};_0x51fbb8(++_0x3b457c);}(_0xeff8,0x186));var _0x8eff=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xeff8[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));module['exports']=function(_0x469641,_0xb54063){return _0x469641[_0x8eff('0x9')](_0x8eff('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x8eff('0xb'),'fields':[_0x8eff('0xb')]},{'name':_0x8eff('0xc'),'fields':[_0x8eff('0xc')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 71e96c9..2b9423a 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 _0xe96f=['\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','describe','keys','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','User','CmList','List','NOW()','CmHopperHandlePreviewRecallNotifications','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','info','debug','error','message','ShowCmHopper','find','stringify','create','then','CreateCmHopper','catch','UpdateCmHopper','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','DestroyCmHopper','GetContactDialer','transaction','order','LOCK','UPDATE','CmContact','Contact','Agent','name','voicePause','length','UserId','push','update','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','COUNT','literal','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x36f694,_0xc561d0){var _0x49350a=function(_0x108c83){while(--_0x108c83){_0x36f694['push'](_0x36f694['shift']());}};_0x49350a(++_0xc561d0);}(_0xe96f,0x158));var _0xfe96=function(_0x156d6d,_0x39b433){_0x156d6d=_0x156d6d-0x0;var _0x4ac49e=_0xe96f[_0x156d6d];return _0x4ac49e;};'use strict';var _=require(_0xfe96('0x0'));var util=require(_0xfe96('0x1'));var moment=require(_0xfe96('0x2'));var BPromise=require(_0xfe96('0x3'));var db=require(_0xfe96('0x4'))['db'];var logger=require(_0xfe96('0x5'))('rpc');exports[_0xfe96('0x6')]=function(_0x2f8f61){var _0x4a804a=this;return new Promise(function(_0x21bf87,_0x764b08){return db[_0xfe96('0x7')][_0xfe96('0x8')]({'raw':_0x2f8f61[_0xfe96('0x9')]?_0x2f8f61[_0xfe96('0x9')][_0xfe96('0xa')]===undefined?!![]:![]:!![],'where':_0x2f8f61['options']?_0x2f8f61['options'][_0xfe96('0xb')]||null:null,'attributes':_0x2f8f61[_0xfe96('0x9')]?_0x2f8f61['options'][_0xfe96('0xc')]||null:null,'limit':_0x2f8f61[_0xfe96('0x9')]?_0x2f8f61['options'][_0xfe96('0xd')]||null:null,'include':_0x2f8f61[_0xfe96('0x9')]?_0x2f8f61[_0xfe96('0x9')][_0xfe96('0xe')]?_[_0xfe96('0xf')](_0x2f8f61['options']['include'],function(_0x13cad3){return{'model':db[_0x13cad3[_0xfe96('0x10')]],'as':_0x13cad3['as'],'attributes':_0x13cad3[_0xfe96('0xc')],'include':_0x13cad3[_0xfe96('0xe')]?_[_0xfe96('0xf')](_0x13cad3['include'],function(_0x2c3034){return{'model':db[_0x2c3034['model']],'as':_0x2c3034['as'],'attributes':_0x2c3034[_0xfe96('0xc')],'include':_0x2c3034['include']?_[_0xfe96('0xf')](_0x2c3034[_0xfe96('0xe')],function(_0x4b8690){return{'model':db[_0x4b8690['model']],'as':_0x4b8690['as'],'attributes':_0x4b8690[_0xfe96('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b9e05){logger[_0xfe96('0x11')]('GetCmHopper',_0x2f8f61);logger[_0xfe96('0x12')](_0xfe96('0x6'),_0x2f8f61,JSON['stringify'](_0x1b9e05));_0x21bf87(_0x1b9e05);})['catch'](function(_0x25676e){logger[_0xfe96('0x13')]('GetCmHopper',_0x25676e[_0xfe96('0x14')],_0x2f8f61);_0x764b08(_0x4a804a[_0xfe96('0x13')](0x1f4,_0x25676e['message']));});});};exports[_0xfe96('0x15')]=function(_0x27780a){var _0x801af1=this;return new Promise(function(_0x52e617,_0x91a050){return db[_0xfe96('0x7')][_0xfe96('0x16')]({'raw':_0x27780a['options']?_0x27780a[_0xfe96('0x9')][_0xfe96('0xa')]===undefined?!![]:![]:!![],'where':_0x27780a[_0xfe96('0x9')]?_0x27780a['options']['where']||null:null,'attributes':_0x27780a['options']?_0x27780a[_0xfe96('0x9')][_0xfe96('0xc')]||null:null,'include':_0x27780a[_0xfe96('0x9')]?_0x27780a[_0xfe96('0x9')][_0xfe96('0xe')]?_[_0xfe96('0xf')](_0x27780a[_0xfe96('0x9')][_0xfe96('0xe')],function(_0xcfe1f9){return{'model':db[_0xcfe1f9['model']],'as':_0xcfe1f9['as'],'attributes':_0xcfe1f9[_0xfe96('0xc')],'include':_0xcfe1f9[_0xfe96('0xe')]?_[_0xfe96('0xf')](_0xcfe1f9[_0xfe96('0xe')],function(_0x190211){return{'model':db[_0x190211[_0xfe96('0x10')]],'as':_0x190211['as'],'attributes':_0x190211[_0xfe96('0xc')],'include':_0x190211[_0xfe96('0xe')]?_[_0xfe96('0xf')](_0x190211[_0xfe96('0xe')],function(_0x2921c1){return{'model':db[_0x2921c1['model']],'as':_0x2921c1['as'],'attributes':_0x2921c1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x43a821){logger[_0xfe96('0x11')]('ShowCmHopper',_0x27780a);logger['debug'](_0xfe96('0x15'),_0x27780a,JSON[_0xfe96('0x17')](_0x43a821));_0x52e617(_0x43a821);})['catch'](function(_0x2c3ebc){logger[_0xfe96('0x13')]('ShowCmHopper',_0x2c3ebc[_0xfe96('0x14')],_0x27780a);_0x91a050(_0x801af1['error'](0x1f4,_0x2c3ebc[_0xfe96('0x14')]));});});};exports['CreateCmHopper']=function(_0x5505c0){var _0x46da71=this;return new Promise(function(_0x1fef17,_0x105648){return db[_0xfe96('0x7')][_0xfe96('0x18')](_0x5505c0['body'],{'raw':_0x5505c0['options']?_0x5505c0[_0xfe96('0x9')]['raw']===undefined?!![]:![]:!![]})[_0xfe96('0x19')](function(_0x3c871b){logger[_0xfe96('0x11')](_0xfe96('0x1a'),_0x5505c0);logger[_0xfe96('0x12')]('CreateCmHopper',_0x5505c0,JSON[_0xfe96('0x17')](_0x3c871b));_0x1fef17(_0x3c871b);})[_0xfe96('0x1b')](function(_0x2be833){logger['error'](_0xfe96('0x1a'),_0x2be833['message'],_0x5505c0);_0x105648(_0x46da71[_0xfe96('0x13')](0x1f4,_0x2be833[_0xfe96('0x14')]));});});};exports[_0xfe96('0x1c')]=function(_0x1f1123){var _0x4e411d=this;return new Promise(function(_0x165644,_0x2228b0){return db[_0xfe96('0x7')]['update'](_0x1f1123[_0xfe96('0x1d')],{'raw':_0x1f1123['options']?_0x1f1123[_0xfe96('0x9')][_0xfe96('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f1123[_0xfe96('0x9')]?_0x1f1123['options'][_0xfe96('0xb')]||null:null,'attributes':_0x1f1123[_0xfe96('0x9')]?_0x1f1123['options'][_0xfe96('0xc')]||null:null,'limit':_0x1f1123[_0xfe96('0x9')]?_0x1f1123[_0xfe96('0x9')]['limit']||null:null})[_0xfe96('0x19')](function(_0xfab568){logger[_0xfe96('0x11')](_0xfe96('0x1c'),_0x1f1123);logger[_0xfe96('0x11')](_0xfe96('0x1e'),JSON['stringify'](_0x1f1123[_0xfe96('0x9')][_0xfe96('0xb')]),_0x1f1123[_0xfe96('0x1d')][_0xfe96('0x1f')]);logger[_0xfe96('0x12')](_0xfe96('0x1c'),_0x1f1123,JSON[_0xfe96('0x17')](_0xfab568));_0x165644(_0xfab568);})[_0xfe96('0x1b')](function(_0x4eaa2b){logger[_0xfe96('0x13')](_0xfe96('0x1c'),_0x4eaa2b[_0xfe96('0x14')],_0x1f1123);_0x2228b0(_0x4e411d[_0xfe96('0x13')](0x1f4,_0x4eaa2b[_0xfe96('0x14')]));});});};exports['DestroyCmHopper']=function(_0x1d0584){var _0x1ad85b=this;return new Promise(function(_0x379663,_0x5428e1){return db[_0xfe96('0x7')][_0xfe96('0x20')]({'where':_0x1d0584[_0xfe96('0x9')]?_0x1d0584[_0xfe96('0x9')]['where']||null:null})[_0xfe96('0x19')](function(_0x408873){logger[_0xfe96('0x11')](_0xfe96('0x21'),_0x1d0584);logger[_0xfe96('0x12')](_0xfe96('0x21'),_0x1d0584,JSON[_0xfe96('0x17')](_0x408873));_0x379663(_0x408873);})[_0xfe96('0x1b')](function(_0x16a421){logger['error'](_0xfe96('0x21'),_0x16a421['message'],_0x1d0584);_0x5428e1(_0x1ad85b[_0xfe96('0x13')](0x1f4,_0x16a421[_0xfe96('0x14')]));});});};exports[_0xfe96('0x22')]=function(_0x2841e7){var _0x2284cf=this;return new Promise(function(_0x468dc9,_0x583ca3){return db['CmContact']['describe']()[_0xfe96('0x19')](function(_0x2d4fd2){return db['sequelize'][_0xfe96('0x23')](function(_0x4aad89){return db['CmHopper'][_0xfe96('0x8')]({'where':_0x2841e7[_0xfe96('0x9')]?_0x2841e7['options'][_0xfe96('0xb')]||null:null,'attributes':_0x2841e7[_0xfe96('0x9')]?_0x2841e7[_0xfe96('0x9')][_0xfe96('0xc')]||null:null,'limit':_0x2841e7[_0xfe96('0x9')]?_0x2841e7[_0xfe96('0x9')][_0xfe96('0xd')]||null:null,'order':_0x2841e7[_0xfe96('0x9')]?_0x2841e7['options'][_0xfe96('0x24')]||null:null,'transaction':_0x4aad89,'lock':_0x4aad89[_0xfe96('0x25')][_0xfe96('0x26')],'include':[{'model':db[_0xfe96('0x27')],'as':_0xfe96('0x28'),'attributes':_['keys'](_0x2d4fd2)},{'model':db['User'],'as':_0xfe96('0x29'),'attributes':['id',_0xfe96('0x2a'),_0xfe96('0x2b')]}]})[_0xfe96('0x19')](function(_0x571a49){var _0x13859e=[];var _0x522c75=[];for(var _0x186d8b=0x0;_0x186d8b<_0x571a49[_0xfe96('0x2c')];_0x186d8b+=0x1){var _0x5ad466=_0x571a49[_0x186d8b][_0xfe96('0x2d')];if(_0x5ad466===null){_0x13859e[_0xfe96('0x2e')](_0x571a49[_0x186d8b][_0xfe96('0x2f')](_0x2841e7[_0xfe96('0x1d')],{'transaction':_0x4aad89}));}else if(!_0x522c75['includes'](_0x5ad466)){_0x522c75['push'](_0x5ad466);_0x13859e[_0xfe96('0x2e')](_0x571a49[_0x186d8b]['update'](_0x2841e7[_0xfe96('0x1d')],{'transaction':_0x4aad89}));}}return BPromise[_0xfe96('0x30')](_0x13859e);});})[_0xfe96('0x19')](function(_0x42c257){logger['info'](_0xfe96('0x22'),_0x2841e7);if(_0x42c257['length']>0x0){logger[_0xfe96('0x11')](_0xfe96('0x31'),_0x42c257[0x0][_0xfe96('0x32')]['id'],_0x42c257[0x0][_0xfe96('0x32')][_0xfe96('0x33')],_0x42c257[0x0]['dataValues'][_0xfe96('0x1f')]);}logger[_0xfe96('0x12')]('GetContactDialer',_0x2841e7,JSON['stringify'](_0x42c257));_0x468dc9(_0x42c257);})[_0xfe96('0x1b')](function(_0x488883){logger['error'](_0xfe96('0x22'),_0x488883[_0xfe96('0x14')],_0x2841e7);_0x583ca3(_0x2284cf[_0xfe96('0x13')](0x1f4,_0x488883[_0xfe96('0x14')]));});});});};exports[_0xfe96('0x34')]=function(_0xc51170){var _0x47638d=this;return new Promise(function(_0x2fef8e,_0x178815){return db[_0xfe96('0x35')][_0xfe96('0x23')](function(_0x5ea26e){return db[_0xfe96('0x36')][_0xfe96('0x18')](_0xc51170['body'],{'raw':_0xc51170[_0xfe96('0x9')]?_0xc51170[_0xfe96('0x9')][_0xfe96('0xa')]===undefined?!![]:![]:!![],'transaction':_0x5ea26e})[_0xfe96('0x19')](function(){logger['info'](_0xfe96('0x37'),JSON['stringify'](_0xc51170[_0xfe96('0x9')][_0xfe96('0xb')]),_0xc51170[_0xfe96('0x9')][_0xfe96('0xb')][_0xfe96('0x1f')]);return db[_0xfe96('0x7')]['destroy']({'where':_0xc51170[_0xfe96('0x9')]?_0xc51170[_0xfe96('0x9')][_0xfe96('0xb')]||null:null,'transaction':_0x5ea26e});});})['then'](function(_0x3dfcde){logger['info'](_0xfe96('0x34'),_0xc51170);logger['debug'](_0xfe96('0x34'),_0xc51170,JSON[_0xfe96('0x17')](_0x3dfcde));_0x2fef8e(_0x3dfcde);})[_0xfe96('0x1b')](function(_0x5453ce){logger['error'](_0xfe96('0x34'),_0x5453ce[_0xfe96('0x14')],_0xc51170);_0x178815(_0x47638d['error'](0x1f4,_0x5453ce['message']));});});};exports['CountReScheduled']=function(_0x392a55){var _0x12555a=this;return new Promise(function(_0x3f7330,_0x57a788){return db['CmHopper']['findAll']({'raw':_0x392a55[_0xfe96('0x9')]?_0x392a55[_0xfe96('0x9')][_0xfe96('0xa')]===undefined?!![]:![]:!![],'where':_0x392a55['options']?_0x392a55['options'][_0xfe96('0xb')]||null:null,'attributes':[[db[_0xfe96('0x35')]['fn'](_0xfe96('0x38'),db[_0xfe96('0x35')]['fn']('IF',db[_0xfe96('0x35')][_0xfe96('0x39')]('`scheduledat`\x20>=\x20'+util['format'](_0xfe96('0x3a'),moment()[_0xfe96('0x3b')](_0xfe96('0x3c')))+_0xfe96('0x3d')))),_0xfe96('0x3e')]]})[_0xfe96('0x19')](function(_0x5b16a7){logger[_0xfe96('0x11')](_0xfe96('0x3f'),_0x392a55);logger['debug']('CountReScheduled',_0x392a55,JSON[_0xfe96('0x17')](_0x5b16a7));_0x3f7330(_0x5b16a7);})['catch'](function(_0x287749){logger[_0xfe96('0x13')](_0xfe96('0x3f'),_0x287749[_0xfe96('0x14')],_0x392a55);_0x57a788(_0x12555a[_0xfe96('0x13')](0x1f4,_0x287749[_0xfe96('0x14')]));});});};exports[_0xfe96('0x40')]=function(_0xcd1c2a){var _0x42516c=this;return new Promise(function(_0x4369dd,_0xac09cb){return db[_0xfe96('0x27')][_0xfe96('0x41')]()[_0xfe96('0x19')](function(){return db[_0xfe96('0x35')][_0xfe96('0x23')](function(_0x52cc2c){return db[_0xfe96('0x7')][_0xfe96('0x8')]({'where':_0xcd1c2a[_0xfe96('0x9')]?_0xcd1c2a[_0xfe96('0x9')][_0xfe96('0xb')]||null:null,'attributes':_0xcd1c2a[_0xfe96('0x9')]?_0xcd1c2a['options']['attributes']||null:null,'limit':0x1,'order':_0xcd1c2a[_0xfe96('0x9')]?_0xcd1c2a[_0xfe96('0x9')]['order']||null:null,'group':db[_0xfe96('0x7')][_0xfe96('0x2d')],'transaction':_0x52cc2c,'lock':_0x52cc2c[_0xfe96('0x25')][_0xfe96('0x26')],'include':_0xcd1c2a['options']?_0xcd1c2a[_0xfe96('0x9')][_0xfe96('0xe')]?_['map'](_0xcd1c2a[_0xfe96('0x9')][_0xfe96('0xe')],function(_0x504fc4){return{'model':db[_0x504fc4[_0xfe96('0x10')]],'as':_0x504fc4['as'],'attributes':_0x504fc4[_0xfe96('0xc')],'include':_0x504fc4[_0xfe96('0xe')]?_[_0xfe96('0xf')](_0x504fc4[_0xfe96('0xe')],function(_0x1b590b){return{'model':db[_0x1b590b[_0xfe96('0x10')]],'as':_0x1b590b['as'],'attributes':_0x1b590b[_0xfe96('0xc')],'include':_0x1b590b['include']?_[_0xfe96('0xf')](_0x1b590b['include'],function(_0x93d59a){return{'model':db[_0x93d59a[_0xfe96('0x10')]],'as':_0x93d59a['as'],'attributes':_0x93d59a[_0xfe96('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x90fdfe){var _0x206f47=[];for(var _0x566d60=0x0;_0x566d60<_0x90fdfe[_0xfe96('0x2c')];_0x566d60+=0x1){_0x206f47[_0xfe96('0x2e')](_0x90fdfe[_0x566d60]['update'](_0xcd1c2a[_0xfe96('0x1d')],{'transaction':_0x52cc2c}));}return BPromise[_0xfe96('0x30')](_0x206f47);});})[_0xfe96('0x19')](function(_0x4de405){logger[_0xfe96('0x11')](_0xfe96('0x40'),_0xcd1c2a);logger[_0xfe96('0x12')](_0xfe96('0x40'),_0xcd1c2a,JSON[_0xfe96('0x17')](_0x4de405));_0x4369dd(_0x4de405);})[_0xfe96('0x1b')](function(_0x3358be){logger[_0xfe96('0x13')](_0xfe96('0x40'),_0x3358be[_0xfe96('0x14')],_0xcd1c2a);_0xac09cb(_0x42516c[_0xfe96('0x13')](0x1f4,_0x3358be[_0xfe96('0x14')]));});});});};exports['GetCmHopperPreview']=function(_0x6b7e01){var _0x545e03=this;return new Promise(function(_0x2100de,_0x454eef){db[_0xfe96('0x27')][_0xfe96('0x41')]()[_0xfe96('0x19')](function(_0x37bc06){return db[_0xfe96('0x7')][_0xfe96('0x8')]({'raw':_0x6b7e01['options']?_0x6b7e01[_0xfe96('0x9')][_0xfe96('0xa')]===undefined?!![]:![]:!![],'where':_0x6b7e01[_0xfe96('0x9')]?_0x6b7e01[_0xfe96('0x9')]['where']||null:null,'attributes':_0x6b7e01['options']?_0x6b7e01[_0xfe96('0x9')][_0xfe96('0xc')]||null:null,'limit':_0x6b7e01[_0xfe96('0x9')]?_0x6b7e01[_0xfe96('0x9')][_0xfe96('0xd')]||null:null,'include':_0x6b7e01['options']?_0x6b7e01[_0xfe96('0x9')][_0xfe96('0xe')]?_['map'](_0x6b7e01['options'][_0xfe96('0xe')],function(_0x4d08be){return{'model':db[_0x4d08be[_0xfe96('0x10')]],'as':_0x4d08be['as'],'attributes':_0x4d08be['as']===_0xfe96('0x28')?_[_0xfe96('0x42')](_0x37bc06):_0x4d08be[_0xfe96('0xc')],'include':_0x4d08be[_0xfe96('0xe')]?_[_0xfe96('0xf')](_0x4d08be['include'],function(_0x4b6319){return{'model':db[_0x4b6319[_0xfe96('0x10')]],'as':_0x4b6319['as'],'attributes':_0x4b6319[_0xfe96('0xc')],'include':_0x4b6319[_0xfe96('0xe')]?_['map'](_0x4b6319[_0xfe96('0xe')],function(_0x575462){return{'model':db[_0x575462[_0xfe96('0x10')]],'as':_0x575462['as'],'attributes':_0x575462[_0xfe96('0xc')]};}):[]};}):[]};}):[]:[]})[_0xfe96('0x19')](function(_0x33f693){logger[_0xfe96('0x11')](_0xfe96('0x6'),_0x6b7e01);logger[_0xfe96('0x12')]('GetCmHopper',_0x6b7e01,JSON['stringify'](_0x33f693));_0x2100de(_0x33f693);})[_0xfe96('0x1b')](function(_0x19093b){logger[_0xfe96('0x13')](_0xfe96('0x6'),_0x19093b[_0xfe96('0x14')],_0x6b7e01);_0x454eef(_0x545e03[_0xfe96('0x13')](0x1f4,_0x19093b[_0xfe96('0x14')]));});});});};exports['GetContactByPhone']=function(_0xc52e1a){var _0x6842b7=this;return new Promise(function(_0xb13593,_0x160e86){return db[_0xfe96('0x27')][_0xfe96('0x43')]({'raw':!![],'where':{'phone':_0xc52e1a[_0xfe96('0x9')][_0xfe96('0xb')][_0xfe96('0x44')]},'attributes':['id','dialTimezone'],'order':[['id',_0xfe96('0x45')]]})['then'](function(_0x474447){logger['info'](_0xfe96('0x46'),_0xc52e1a);logger[_0xfe96('0x12')](_0xfe96('0x46'),_0xc52e1a,JSON[_0xfe96('0x17')](_0x474447));_0xb13593(_0x474447);})[_0xfe96('0x1b')](function(_0x4ba5a0){logger['error'](_0xfe96('0x46'),_0x4ba5a0['message'],_0xc52e1a);_0x160e86(_0x6842b7['error'](0x1f4,_0x4ba5a0[_0xfe96('0x14')]));});});};exports[_0xfe96('0x47')]=function(_0x3f54f1){var _0x5f3fb1=this;return new Promise(function(_0xa551ac,_0x312c06){return db['sequelize'][_0xfe96('0x23')](function(_0x2bf3ac){var _0xd1806a=_0x3f54f1[_0xfe96('0x9')]&&_0x3f54f1['options'][_0xfe96('0xb')]?_0x3f54f1[_0xfe96('0x9')][_0xfe96('0xb')]:{};return db[_0xfe96('0x7')][_0xfe96('0x2f')](_0x3f54f1[_0xfe96('0x1d')],{'where':_0xd1806a,'transaction':_0x2bf3ac})['then'](function(_0x1e8abf){logger[_0xfe96('0x11')]('ResetActiveCalls',_0x3f54f1);logger['debug']('ResetActiveCalls',_0x3f54f1,JSON[_0xfe96('0x17')](_0x1e8abf));_0xa551ac(_0x1e8abf);})[_0xfe96('0x1b')](function(_0x39c6e3){logger[_0xfe96('0x13')](_0xfe96('0x47'),_0x39c6e3[_0xfe96('0x14')],_0x3f54f1);_0x312c06(_0x5f3fb1['error'](0x1f4,_0x39c6e3[_0xfe96('0x14')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x4aa5e3){var _0x58cd8e=this;var _0x4f2b69=_0x4aa5e3[_0xfe96('0x1d')][_0xfe96('0xb')][_0xfe96('0x48')];var _0x21c393=_0x4aa5e3[_0xfe96('0x1d')][_0xfe96('0xb')][_0xfe96('0x49')];var _0x4671aa=_0x4aa5e3[_0xfe96('0x1d')]['where']['availableAgentsIds'];return new Promise(function(_0x4beaca,_0x2cd398){return db[_0xfe96('0x7')][_0xfe96('0x8')]({'where':{'voiceQueueId':{'$in':_0x4f2b69},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xfe96('0x35')][_0xfe96('0x39')](_0xfe96('0x4a')+_0x21c393+_0xfe96('0x4b')),'$gt':db['sequelize'][_0xfe96('0x39')]('NOW()')}},'UserId':{'$in':_0x4671aa}},'include':[{'model':db[_0xfe96('0x27')],'as':_0xfe96('0x28')},{'model':db[_0xfe96('0x4c')],'as':'Agent','attributes':['id',_0xfe96('0x2a'),'voicePause']},{'model':db[_0xfe96('0x4d')],'as':_0xfe96('0x4e')}]})[_0xfe96('0x19')](function(_0x76b2d9){if(_0x76b2d9[_0xfe96('0x2c')]>0x0){return db['sequelize']['transaction'](function(_0x297e82){return db[_0xfe96('0x7')][_0xfe96('0x2f')]({'recallmeNotifiedDate':db['sequelize'][_0xfe96('0x39')](_0xfe96('0x4f'))},{'where':{'id':{'$in':_[_0xfe96('0xf')](_0x76b2d9,'id')}},'transaction':_0x297e82})['then'](function(){_0x4beaca(_0x76b2d9);})[_0xfe96('0x1b')](function(_0x3ca862){logger[_0xfe96('0x13')](_0xfe96('0x50'),_0x3ca862[_0xfe96('0x14')],_0x4aa5e3);_0x2cd398(_0x58cd8e[_0xfe96('0x13')](0x1f4,_0x3ca862[_0xfe96('0x14')]));});})[_0xfe96('0x1b')](function(_0x40adf4){logger[_0xfe96('0x13')](_0xfe96('0x50'),_0x40adf4[_0xfe96('0x14')],_0x4aa5e3);_0x2cd398(_0x58cd8e[_0xfe96('0x13')](0x1f4,_0x40adf4[_0xfe96('0x14')]));});}else{_0x4beaca(_0x76b2d9);}});});}; \ No newline at end of file +var _0x2de3=['LOCK','UPDATE','Contact','keys','length','UserId','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','order','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()','User','voicePause','CmList','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','options','attributes','include','map','model','then','info','debug','stringify','error','ShowCmHopper','CmHopper','find','raw','where','catch','message','CreateCmHopper','create','body','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','findAll'];(function(_0x38784d,_0x12c025){var _0x20533f=function(_0x2a2cbc){while(--_0x2a2cbc){_0x38784d['push'](_0x38784d['shift']());}};_0x20533f(++_0x12c025);}(_0x2de3,0x150));var _0x32de=function(_0x46c129,_0x5a4c20){_0x46c129=_0x46c129-0x0;var _0xccd5a5=_0x2de3[_0x46c129];return _0xccd5a5;};'use strict';var _=require('lodash');var util=require(_0x32de('0x0'));var moment=require(_0x32de('0x1'));var BPromise=require(_0x32de('0x2'));var db=require(_0x32de('0x3'))['db'];var logger=require(_0x32de('0x4'))(_0x32de('0x5'));exports[_0x32de('0x6')]=function(_0x5f1686){var _0x10b28b=this;return new Promise(function(_0x24928b,_0x1b3a06){return db['CmHopper']['findAll']({'raw':_0x5f1686[_0x32de('0x7')]?_0x5f1686[_0x32de('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x5f1686['options']?_0x5f1686[_0x32de('0x7')]['where']||null:null,'attributes':_0x5f1686[_0x32de('0x7')]?_0x5f1686['options'][_0x32de('0x8')]||null:null,'limit':_0x5f1686[_0x32de('0x7')]?_0x5f1686[_0x32de('0x7')]['limit']||null:null,'include':_0x5f1686['options']?_0x5f1686[_0x32de('0x7')][_0x32de('0x9')]?_[_0x32de('0xa')](_0x5f1686[_0x32de('0x7')][_0x32de('0x9')],function(_0x5bcc61){return{'model':db[_0x5bcc61[_0x32de('0xb')]],'as':_0x5bcc61['as'],'attributes':_0x5bcc61[_0x32de('0x8')],'include':_0x5bcc61[_0x32de('0x9')]?_[_0x32de('0xa')](_0x5bcc61['include'],function(_0x4a380b){return{'model':db[_0x4a380b['model']],'as':_0x4a380b['as'],'attributes':_0x4a380b[_0x32de('0x8')],'include':_0x4a380b[_0x32de('0x9')]?_[_0x32de('0xa')](_0x4a380b[_0x32de('0x9')],function(_0x31e0de){return{'model':db[_0x31e0de['model']],'as':_0x31e0de['as'],'attributes':_0x31e0de[_0x32de('0x8')]};}):[]};}):[]};}):[]:[]})[_0x32de('0xc')](function(_0x566973){logger[_0x32de('0xd')](_0x32de('0x6'),_0x5f1686);logger[_0x32de('0xe')]('GetCmHopper',_0x5f1686,JSON[_0x32de('0xf')](_0x566973));_0x24928b(_0x566973);})['catch'](function(_0x266729){logger['error']('GetCmHopper',_0x266729['message'],_0x5f1686);_0x1b3a06(_0x10b28b[_0x32de('0x10')](0x1f4,_0x266729['message']));});});};exports[_0x32de('0x11')]=function(_0x369084){var _0x461f25=this;return new Promise(function(_0x1a38ba,_0x2a8a9e){return db[_0x32de('0x12')][_0x32de('0x13')]({'raw':_0x369084['options']?_0x369084['options'][_0x32de('0x14')]===undefined?!![]:![]:!![],'where':_0x369084[_0x32de('0x7')]?_0x369084[_0x32de('0x7')][_0x32de('0x15')]||null:null,'attributes':_0x369084[_0x32de('0x7')]?_0x369084[_0x32de('0x7')][_0x32de('0x8')]||null:null,'include':_0x369084['options']?_0x369084['options']['include']?_[_0x32de('0xa')](_0x369084[_0x32de('0x7')][_0x32de('0x9')],function(_0x10b7e2){return{'model':db[_0x10b7e2[_0x32de('0xb')]],'as':_0x10b7e2['as'],'attributes':_0x10b7e2[_0x32de('0x8')],'include':_0x10b7e2[_0x32de('0x9')]?_['map'](_0x10b7e2[_0x32de('0x9')],function(_0x3116a8){return{'model':db[_0x3116a8[_0x32de('0xb')]],'as':_0x3116a8['as'],'attributes':_0x3116a8[_0x32de('0x8')],'include':_0x3116a8['include']?_[_0x32de('0xa')](_0x3116a8[_0x32de('0x9')],function(_0x1cdc08){return{'model':db[_0x1cdc08['model']],'as':_0x1cdc08['as'],'attributes':_0x1cdc08[_0x32de('0x8')]};}):[]};}):[]};}):[]:[]})[_0x32de('0xc')](function(_0x8e1f84){logger['info'](_0x32de('0x11'),_0x369084);logger[_0x32de('0xe')]('ShowCmHopper',_0x369084,JSON[_0x32de('0xf')](_0x8e1f84));_0x1a38ba(_0x8e1f84);})[_0x32de('0x16')](function(_0x217ef2){logger['error'](_0x32de('0x11'),_0x217ef2[_0x32de('0x17')],_0x369084);_0x2a8a9e(_0x461f25[_0x32de('0x10')](0x1f4,_0x217ef2[_0x32de('0x17')]));});});};exports[_0x32de('0x18')]=function(_0x2f5059){var _0xba5801=this;return new Promise(function(_0x2cd2b6,_0x5ce87a){return db['CmHopper'][_0x32de('0x19')](_0x2f5059[_0x32de('0x1a')],{'raw':_0x2f5059[_0x32de('0x7')]?_0x2f5059[_0x32de('0x7')]['raw']===undefined?!![]:![]:!![]})[_0x32de('0xc')](function(_0x3b090c){logger[_0x32de('0xd')]('CreateCmHopper',_0x2f5059);logger['debug'](_0x32de('0x18'),_0x2f5059,JSON[_0x32de('0xf')](_0x3b090c));_0x2cd2b6(_0x3b090c);})[_0x32de('0x16')](function(_0xf6cf5c){logger[_0x32de('0x10')]('CreateCmHopper',_0xf6cf5c[_0x32de('0x17')],_0x2f5059);_0x5ce87a(_0xba5801[_0x32de('0x10')](0x1f4,_0xf6cf5c[_0x32de('0x17')]));});});};exports[_0x32de('0x1b')]=function(_0x392ff3){var _0x13e6bd=this;return new Promise(function(_0x1ec465,_0x30ff9c){return db[_0x32de('0x12')][_0x32de('0x1c')](_0x392ff3[_0x32de('0x1a')],{'raw':_0x392ff3[_0x32de('0x7')]?_0x392ff3[_0x32de('0x7')][_0x32de('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x392ff3[_0x32de('0x7')]?_0x392ff3['options'][_0x32de('0x15')]||null:null,'attributes':_0x392ff3[_0x32de('0x7')]?_0x392ff3['options'][_0x32de('0x8')]||null:null,'limit':_0x392ff3[_0x32de('0x7')]?_0x392ff3['options'][_0x32de('0x1d')]||null:null})['then'](function(_0x3f3093){logger[_0x32de('0xd')](_0x32de('0x1b'),_0x392ff3);logger[_0x32de('0xd')](_0x32de('0x1e'),JSON[_0x32de('0xf')](_0x392ff3['options'][_0x32de('0x15')]),_0x392ff3[_0x32de('0x1a')][_0x32de('0x1f')]);logger[_0x32de('0xe')](_0x32de('0x1b'),_0x392ff3,JSON[_0x32de('0xf')](_0x3f3093));_0x1ec465(_0x3f3093);})[_0x32de('0x16')](function(_0x4173d8){logger[_0x32de('0x10')](_0x32de('0x1b'),_0x4173d8[_0x32de('0x17')],_0x392ff3);_0x30ff9c(_0x13e6bd[_0x32de('0x10')](0x1f4,_0x4173d8[_0x32de('0x17')]));});});};exports[_0x32de('0x20')]=function(_0x1aa4ef){var _0x36d0e2=this;return new Promise(function(_0x432e56,_0x77f7a0){return db[_0x32de('0x12')]['destroy']({'where':_0x1aa4ef[_0x32de('0x7')]?_0x1aa4ef[_0x32de('0x7')][_0x32de('0x15')]||null:null})[_0x32de('0xc')](function(_0x363cca){logger[_0x32de('0xd')](_0x32de('0x20'),_0x1aa4ef);logger['debug'](_0x32de('0x20'),_0x1aa4ef,JSON[_0x32de('0xf')](_0x363cca));_0x432e56(_0x363cca);})['catch'](function(_0x52ce7d){logger[_0x32de('0x10')](_0x32de('0x20'),_0x52ce7d['message'],_0x1aa4ef);_0x77f7a0(_0x36d0e2[_0x32de('0x10')](0x1f4,_0x52ce7d[_0x32de('0x17')]));});});};exports[_0x32de('0x21')]=function(_0x276644){var _0x29cc16=this;return new Promise(function(_0x27bc46,_0x4c4d99){return db[_0x32de('0x22')][_0x32de('0x23')]()[_0x32de('0xc')](function(_0x4aaa2e){return db[_0x32de('0x24')][_0x32de('0x25')](function(_0x14435b){return db[_0x32de('0x12')][_0x32de('0x26')]({'where':_0x276644[_0x32de('0x7')]?_0x276644['options'][_0x32de('0x15')]||null:null,'attributes':_0x276644[_0x32de('0x7')]?_0x276644[_0x32de('0x7')]['attributes']||null:null,'limit':_0x276644['options']?_0x276644['options'][_0x32de('0x1d')]||null:null,'order':_0x276644['options']?_0x276644['options']['order']||null:null,'transaction':_0x14435b,'lock':_0x14435b[_0x32de('0x27')][_0x32de('0x28')],'include':[{'model':db[_0x32de('0x22')],'as':_0x32de('0x29'),'attributes':_[_0x32de('0x2a')](_0x4aaa2e)},{'model':db['User'],'as':'Agent','attributes':['id','name','voicePause']}]})[_0x32de('0xc')](function(_0x279c6c){var _0x2bde07=[];var _0x585580=[];for(var _0x4d08c8=0x0;_0x4d08c8<_0x279c6c[_0x32de('0x2b')];_0x4d08c8+=0x1){var _0x3bb42b=_0x279c6c[_0x4d08c8][_0x32de('0x2c')];if(_0x3bb42b===null){_0x2bde07['push'](_0x279c6c[_0x4d08c8][_0x32de('0x1c')](_0x276644[_0x32de('0x1a')],{'transaction':_0x14435b}));}else if(!_0x585580['includes'](_0x3bb42b)){_0x585580[_0x32de('0x2d')](_0x3bb42b);_0x2bde07[_0x32de('0x2d')](_0x279c6c[_0x4d08c8][_0x32de('0x1c')](_0x276644[_0x32de('0x1a')],{'transaction':_0x14435b}));}}return BPromise[_0x32de('0x2e')](_0x2bde07);});})[_0x32de('0xc')](function(_0x4b2df4){logger['info'](_0x32de('0x21'),_0x276644);if(_0x4b2df4[_0x32de('0x2b')]>0x0){logger[_0x32de('0xd')](_0x32de('0x2f'),_0x4b2df4[0x0][_0x32de('0x30')]['id'],_0x4b2df4[0x0][_0x32de('0x30')]['ContactId'],_0x4b2df4[0x0][_0x32de('0x30')][_0x32de('0x1f')]);}logger[_0x32de('0xe')]('GetContactDialer',_0x276644,JSON['stringify'](_0x4b2df4));_0x27bc46(_0x4b2df4);})['catch'](function(_0x148a82){logger[_0x32de('0x10')](_0x32de('0x21'),_0x148a82[_0x32de('0x17')],_0x276644);_0x4c4d99(_0x29cc16['error'](0x1f4,_0x148a82[_0x32de('0x17')]));});});});};exports['MoveContactManagedDialer']=function(_0x45269f){var _0x2daa38=this;return new Promise(function(_0x2bab8e,_0xdc98c4){return db[_0x32de('0x24')][_0x32de('0x25')](function(_0x2418e4){return db[_0x32de('0x31')]['create'](_0x45269f[_0x32de('0x1a')],{'raw':_0x45269f[_0x32de('0x7')]?_0x45269f[_0x32de('0x7')]['raw']===undefined?!![]:![]:!![],'transaction':_0x2418e4})[_0x32de('0xc')](function(){logger[_0x32de('0xd')](_0x32de('0x32'),JSON['stringify'](_0x45269f[_0x32de('0x7')][_0x32de('0x15')]),_0x45269f['options']['where'][_0x32de('0x1f')]);return db[_0x32de('0x12')][_0x32de('0x33')]({'where':_0x45269f['options']?_0x45269f[_0x32de('0x7')]['where']||null:null,'transaction':_0x2418e4});});})[_0x32de('0xc')](function(_0x1551a2){logger[_0x32de('0xd')]('MoveContactManagedDialer',_0x45269f);logger['debug'](_0x32de('0x34'),_0x45269f,JSON[_0x32de('0xf')](_0x1551a2));_0x2bab8e(_0x1551a2);})[_0x32de('0x16')](function(_0x1fe656){logger['error']('MoveContactManagedDialer',_0x1fe656[_0x32de('0x17')],_0x45269f);_0xdc98c4(_0x2daa38['error'](0x1f4,_0x1fe656[_0x32de('0x17')]));});});};exports[_0x32de('0x35')]=function(_0x4dc1f6){var _0x59ba71=this;return new Promise(function(_0x2af55f,_0x2f063b){return db[_0x32de('0x12')][_0x32de('0x26')]({'raw':_0x4dc1f6['options']?_0x4dc1f6['options'][_0x32de('0x14')]===undefined?!![]:![]:!![],'where':_0x4dc1f6[_0x32de('0x7')]?_0x4dc1f6[_0x32de('0x7')][_0x32de('0x15')]||null:null,'attributes':[[db[_0x32de('0x24')]['fn'](_0x32de('0x36'),db[_0x32de('0x24')]['fn']('IF',db['sequelize'][_0x32de('0x37')](_0x32de('0x38')+util[_0x32de('0x39')](_0x32de('0x3a'),moment()[_0x32de('0x39')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x32de('0x3b')))),'contactsRescheduled']]})['then'](function(_0x3008a0){logger[_0x32de('0xd')](_0x32de('0x35'),_0x4dc1f6);logger[_0x32de('0xe')](_0x32de('0x35'),_0x4dc1f6,JSON['stringify'](_0x3008a0));_0x2af55f(_0x3008a0);})[_0x32de('0x16')](function(_0x1e11c7){logger[_0x32de('0x10')](_0x32de('0x35'),_0x1e11c7['message'],_0x4dc1f6);_0x2f063b(_0x59ba71['error'](0x1f4,_0x1e11c7[_0x32de('0x17')]));});});};exports['GetContactRecallMe']=function(_0x56fb8e){var _0x166989=this;return new Promise(function(_0x26585b,_0x3e09ed){return db[_0x32de('0x22')]['describe']()[_0x32de('0xc')](function(){return db[_0x32de('0x24')]['transaction'](function(_0x583d67){return db['CmHopper'][_0x32de('0x26')]({'where':_0x56fb8e['options']?_0x56fb8e[_0x32de('0x7')][_0x32de('0x15')]||null:null,'attributes':_0x56fb8e['options']?_0x56fb8e['options'][_0x32de('0x8')]||null:null,'limit':0x1,'order':_0x56fb8e[_0x32de('0x7')]?_0x56fb8e[_0x32de('0x7')][_0x32de('0x3c')]||null:null,'group':db[_0x32de('0x12')]['UserId'],'transaction':_0x583d67,'lock':_0x583d67[_0x32de('0x27')][_0x32de('0x28')],'include':_0x56fb8e['options']?_0x56fb8e[_0x32de('0x7')][_0x32de('0x9')]?_['map'](_0x56fb8e['options'][_0x32de('0x9')],function(_0x3fe4e1){return{'model':db[_0x3fe4e1['model']],'as':_0x3fe4e1['as'],'attributes':_0x3fe4e1['attributes'],'include':_0x3fe4e1['include']?_['map'](_0x3fe4e1[_0x32de('0x9')],function(_0x1c5488){return{'model':db[_0x1c5488[_0x32de('0xb')]],'as':_0x1c5488['as'],'attributes':_0x1c5488['attributes'],'include':_0x1c5488[_0x32de('0x9')]?_[_0x32de('0xa')](_0x1c5488[_0x32de('0x9')],function(_0x48827b){return{'model':db[_0x48827b['model']],'as':_0x48827b['as'],'attributes':_0x48827b[_0x32de('0x8')]};}):[]};}):[]};}):[]:[]})[_0x32de('0xc')](function(_0xaa7827){var _0x113066=[];for(var _0x15600e=0x0;_0x15600e<_0xaa7827[_0x32de('0x2b')];_0x15600e+=0x1){_0x113066[_0x32de('0x2d')](_0xaa7827[_0x15600e]['update'](_0x56fb8e[_0x32de('0x1a')],{'transaction':_0x583d67}));}return BPromise[_0x32de('0x2e')](_0x113066);});})[_0x32de('0xc')](function(_0x409f1b){logger[_0x32de('0xd')]('GetContactRecallMe',_0x56fb8e);logger['debug'](_0x32de('0x3d'),_0x56fb8e,JSON[_0x32de('0xf')](_0x409f1b));_0x26585b(_0x409f1b);})[_0x32de('0x16')](function(_0x26f9af){logger['error']('GetContactRecallMe',_0x26f9af[_0x32de('0x17')],_0x56fb8e);_0x3e09ed(_0x166989[_0x32de('0x10')](0x1f4,_0x26f9af[_0x32de('0x17')]));});});});};exports[_0x32de('0x3e')]=function(_0xa4f2dc){var _0x21551c=this;return new Promise(function(_0x393ef2,_0x4756be){db['CmContact'][_0x32de('0x23')]()['then'](function(_0x585b70){return db[_0x32de('0x12')][_0x32de('0x26')]({'raw':_0xa4f2dc[_0x32de('0x7')]?_0xa4f2dc[_0x32de('0x7')][_0x32de('0x14')]===undefined?!![]:![]:!![],'where':_0xa4f2dc[_0x32de('0x7')]?_0xa4f2dc[_0x32de('0x7')][_0x32de('0x15')]||null:null,'attributes':_0xa4f2dc[_0x32de('0x7')]?_0xa4f2dc[_0x32de('0x7')][_0x32de('0x8')]||null:null,'limit':_0xa4f2dc[_0x32de('0x7')]?_0xa4f2dc[_0x32de('0x7')][_0x32de('0x1d')]||null:null,'include':_0xa4f2dc[_0x32de('0x7')]?_0xa4f2dc[_0x32de('0x7')][_0x32de('0x9')]?_[_0x32de('0xa')](_0xa4f2dc[_0x32de('0x7')][_0x32de('0x9')],function(_0x5e5404){return{'model':db[_0x5e5404[_0x32de('0xb')]],'as':_0x5e5404['as'],'attributes':_0x5e5404['as']===_0x32de('0x29')?_[_0x32de('0x2a')](_0x585b70):_0x5e5404[_0x32de('0x8')],'include':_0x5e5404[_0x32de('0x9')]?_[_0x32de('0xa')](_0x5e5404[_0x32de('0x9')],function(_0x4be377){return{'model':db[_0x4be377[_0x32de('0xb')]],'as':_0x4be377['as'],'attributes':_0x4be377[_0x32de('0x8')],'include':_0x4be377[_0x32de('0x9')]?_[_0x32de('0xa')](_0x4be377['include'],function(_0x3c40e4){return{'model':db[_0x3c40e4['model']],'as':_0x3c40e4['as'],'attributes':_0x3c40e4[_0x32de('0x8')]};}):[]};}):[]};}):[]:[]})[_0x32de('0xc')](function(_0x54a924){logger[_0x32de('0xd')]('GetCmHopper',_0xa4f2dc);logger[_0x32de('0xe')](_0x32de('0x6'),_0xa4f2dc,JSON['stringify'](_0x54a924));_0x393ef2(_0x54a924);})[_0x32de('0x16')](function(_0x2e8eb0){logger[_0x32de('0x10')](_0x32de('0x6'),_0x2e8eb0[_0x32de('0x17')],_0xa4f2dc);_0x4756be(_0x21551c[_0x32de('0x10')](0x1f4,_0x2e8eb0['message']));});});});};exports[_0x32de('0x3f')]=function(_0x3a9a87){var _0x33034a=this;return new Promise(function(_0x23af73,_0x32736a){return db[_0x32de('0x22')][_0x32de('0x40')]({'raw':!![],'where':{'phone':_0x3a9a87[_0x32de('0x7')][_0x32de('0x15')]['phone']},'attributes':['id',_0x32de('0x41')],'order':[['id','DESC']]})[_0x32de('0xc')](function(_0x505032){logger[_0x32de('0xd')](_0x32de('0x42'),_0x3a9a87);logger[_0x32de('0xe')](_0x32de('0x42'),_0x3a9a87,JSON[_0x32de('0xf')](_0x505032));_0x23af73(_0x505032);})['catch'](function(_0x5b1cae){logger[_0x32de('0x10')](_0x32de('0x42'),_0x5b1cae[_0x32de('0x17')],_0x3a9a87);_0x32736a(_0x33034a[_0x32de('0x10')](0x1f4,_0x5b1cae[_0x32de('0x17')]));});});};exports[_0x32de('0x43')]=function(_0x5d4e05){var _0x54ec89=this;return new Promise(function(_0x3a057d,_0x5445fb){return db['sequelize'][_0x32de('0x25')](function(_0x38c9ff){var _0x2bdcc4=_0x5d4e05[_0x32de('0x7')]&&_0x5d4e05[_0x32de('0x7')][_0x32de('0x15')]?_0x5d4e05['options']['where']:{};return db['CmHopper']['update'](_0x5d4e05['body'],{'where':_0x2bdcc4,'transaction':_0x38c9ff})['then'](function(_0x86850a){logger[_0x32de('0xd')]('ResetActiveCalls',_0x5d4e05);logger[_0x32de('0xe')](_0x32de('0x43'),_0x5d4e05,JSON[_0x32de('0xf')](_0x86850a));_0x3a057d(_0x86850a);})[_0x32de('0x16')](function(_0x12fabd){logger['error']('ResetActiveCalls',_0x12fabd[_0x32de('0x17')],_0x5d4e05);_0x5445fb(_0x54ec89[_0x32de('0x10')](0x1f4,_0x12fabd[_0x32de('0x17')]));});});});};exports[_0x32de('0x44')]=function(_0x188ffd){var _0x1964fa=this;var _0x427afe=_0x188ffd['body']['where']['voiceQueueIds'];var _0x468412=_0x188ffd[_0x32de('0x1a')][_0x32de('0x15')][_0x32de('0x45')];var _0x2341ba=_0x188ffd[_0x32de('0x1a')][_0x32de('0x15')][_0x32de('0x46')];return new Promise(function(_0x38fc90,_0xb841d3){return db[_0x32de('0x12')]['findAll']({'where':{'voiceQueueId':{'$in':_0x427afe},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x32de('0x24')][_0x32de('0x37')]('NOW()\x20+\x20INTERVAL\x20'+_0x468412+'\x20MINUTE'),'$gt':db[_0x32de('0x24')][_0x32de('0x37')](_0x32de('0x47'))}},'UserId':{'$in':_0x2341ba}},'include':[{'model':db[_0x32de('0x22')],'as':'Contact'},{'model':db[_0x32de('0x48')],'as':'Agent','attributes':['id','name',_0x32de('0x49')]},{'model':db[_0x32de('0x4a')],'as':'List'}]})[_0x32de('0xc')](function(_0x576378){if(_0x576378[_0x32de('0x2b')]>0x0){return db[_0x32de('0x24')]['transaction'](function(_0x1bf619){return db[_0x32de('0x12')][_0x32de('0x1c')]({'recallmeNotifiedDate':db[_0x32de('0x24')][_0x32de('0x37')](_0x32de('0x47'))},{'where':{'id':{'$in':_['map'](_0x576378,'id')}},'transaction':_0x1bf619})['then'](function(){_0x38fc90(_0x576378);})[_0x32de('0x16')](function(_0x3f5c71){logger[_0x32de('0x10')](_0x32de('0x44'),_0x3f5c71[_0x32de('0x17')],_0x188ffd);_0xb841d3(_0x1964fa[_0x32de('0x10')](0x1f4,_0x3f5c71[_0x32de('0x17')]));});})[_0x32de('0x16')](function(_0x4d5ca3){logger[_0x32de('0x10')](_0x32de('0x44'),_0x4d5ca3['message'],_0x188ffd);_0xb841d3(_0x1964fa[_0x32de('0x10')](0x1f4,_0x4d5ca3[_0x32de('0x17')]));});}else{_0x38fc90(_0x576378);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index dd3ffb2..650ec59 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 _0x53dd=['getTimezone','put','/:id','update','destroy','./cmHopper.controller','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','/timezones','show','/:id/previewrecall','post','/preview','getPreview','/timezone'];(function(_0x4af1f1,_0x57a391){var _0x2e05f8=function(_0xade870){while(--_0xade870){_0x4af1f1['push'](_0x4af1f1['shift']());}};_0x2e05f8(++_0x57a391);}(_0x53dd,0x10f));var _0xd53d=function(_0x54c3c1,_0x42a27a){_0x54c3c1=_0x54c3c1-0x0;var _0x24428d=_0x53dd[_0x54c3c1];return _0x24428d;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xd53d('0x0'));router[_0xd53d('0x1')]('/',auth[_0xd53d('0x2')](),controller[_0xd53d('0x3')]);router[_0xd53d('0x1')](_0xd53d('0x4'),auth[_0xd53d('0x2')](),controller['describe']);router[_0xd53d('0x1')](_0xd53d('0x5'),auth[_0xd53d('0x2')](),controller[_0xd53d('0x6')]);router[_0xd53d('0x1')](_0xd53d('0x7'),auth['isAuthenticated'](),controller['getTimezones']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd53d('0x8')]);router['get'](_0xd53d('0x9'),auth['isAuthenticated'](),controller['getPreviewRecall']);router[_0xd53d('0xa')]('/',auth[_0xd53d('0x2')](),controller['create']);router[_0xd53d('0xa')](_0xd53d('0xb'),auth['isAuthenticated'](),controller[_0xd53d('0xc')]);router['post'](_0xd53d('0xd'),auth[_0xd53d('0x2')](),controller[_0xd53d('0xe')]);router[_0xd53d('0xf')](_0xd53d('0x10'),auth['isAuthenticated'](),controller[_0xd53d('0x11')]);router['delete'](_0xd53d('0x10'),auth['isAuthenticated'](),controller[_0xd53d('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3ab0=['/timezones','/:id/previewrecall','getPreviewRecall','/preview','getPreview','post','/timezone','put','/:id','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','/describe','describe','getOpenContacts'];(function(_0x3ce16d,_0x521f10){var _0x22df0b=function(_0x56a66a){while(--_0x56a66a){_0x3ce16d['push'](_0x3ce16d['shift']());}};_0x22df0b(++_0x521f10);}(_0x3ab0,0x12b));var _0x03ab=function(_0x2a1274,_0x132e2b){_0x2a1274=_0x2a1274-0x0;var _0x40ba1e=_0x3ab0[_0x2a1274];return _0x40ba1e;};'use strict';var express=require(_0x03ab('0x0'));var router=express[_0x03ab('0x1')]();var auth=require(_0x03ab('0x2'));var controller=require(_0x03ab('0x3'));router[_0x03ab('0x4')]('/',auth[_0x03ab('0x5')](),controller['index']);router[_0x03ab('0x4')](_0x03ab('0x6'),auth[_0x03ab('0x5')](),controller[_0x03ab('0x7')]);router[_0x03ab('0x4')]('/opencontacts',auth[_0x03ab('0x5')](),controller[_0x03ab('0x8')]);router[_0x03ab('0x4')](_0x03ab('0x9'),auth['isAuthenticated'](),controller['getTimezones']);router[_0x03ab('0x4')]('/:id',auth[_0x03ab('0x5')](),controller['show']);router[_0x03ab('0x4')](_0x03ab('0xa'),auth[_0x03ab('0x5')](),controller[_0x03ab('0xb')]);router['post']('/',auth[_0x03ab('0x5')](),controller['create']);router['post'](_0x03ab('0xc'),auth['isAuthenticated'](),controller[_0x03ab('0xd')]);router[_0x03ab('0xe')](_0x03ab('0xf'),auth[_0x03ab('0x5')](),controller['getTimezone']);router[_0x03ab('0x10')](_0x03ab('0x11'),auth[_0x03ab('0x5')](),controller[_0x03ab('0x12')]);router[_0x03ab('0x13')](_0x03ab('0x11'),auth[_0x03ab('0x5')](),controller[_0x03ab('0x14')]);module[_0x03ab('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index bf9f822..709f25a 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 _0x8630=['STRING','DATE','format','moment','sequelize','exports','INTEGER'];(function(_0x1dac7a,_0x1828ce){var _0x4cb363=function(_0x80f6de){while(--_0x80f6de){_0x1dac7a['push'](_0x1dac7a['shift']());}};_0x4cb363(++_0x1828ce);}(_0x8630,0x130));var _0x0863=function(_0xe5d82b,_0x46f6cf){_0xe5d82b=_0xe5d82b-0x0;var _0x1a8ae9=_0x8630[_0xe5d82b];return _0x1a8ae9;};'use strict';var moment=require(_0x0863('0x0'));var Sequelize=require(_0x0863('0x1'));module[_0x0863('0x2')]={'CmHopperId':{'type':Sequelize[_0x0863('0x3')]},'phone':{'type':Sequelize[_0x0863('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x0863('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x0863('0x5')],'defaultValue':moment()[_0x0863('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x0863('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0863('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0863('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x0863('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0863('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0863('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0863('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2b37=['STRING','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2b37,0x88));var _0x72b3=function(_0x135b81,_0x39db4b){_0x135b81=_0x135b81-0x0;var _0x5d8a8e=_0x2b37[_0x135b81];return _0x5d8a8e;};'use strict';var moment=require(_0x72b3('0x0'));var Sequelize=require(_0x72b3('0x1'));module[_0x72b3('0x2')]={'CmHopperId':{'type':Sequelize[_0x72b3('0x3')]},'phone':{'type':Sequelize[_0x72b3('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x72b3('0x5')](_0x72b3('0x6'))},'countbusyretry':{'type':Sequelize[_0x72b3('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x72b3('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x72b3('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x72b3('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x72b3('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x72b3('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x72b3('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x72b3('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 18a5f99..30ddeb3 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 _0xbe63=['attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','includeAll','catch','show','params','include','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','save','destroy','then','CmHopperAdditionalPhones','error','stack','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','map','name','query','filters','intersection'];(function(_0x5c5eb0,_0x550970){var _0x46ab0b=function(_0x432b2d){while(--_0x432b2d){_0x5c5eb0['push'](_0x5c5eb0['shift']());}};_0x46ab0b(++_0x550970);}(_0xbe63,0x154));var _0x3be6=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xbe63[_0xbd08b4];return _0x314f1e;};'use strict';var emlformat=require(_0x3be6('0x0'));var rimraf=require(_0x3be6('0x1'));var zipdir=require(_0x3be6('0x2'));var jsonpatch=require(_0x3be6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3be6('0x4'));var Mustache=require('mustache');var util=require(_0x3be6('0x5'));var path=require(_0x3be6('0x6'));var sox=require(_0x3be6('0x7'));var csv=require(_0x3be6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3be6('0x9'));var _=require(_0x3be6('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3be6('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3be6('0xc'));var Papa=require(_0x3be6('0xd'));var Redis=require('ioredis');var authService=require(_0x3be6('0xe'));var qs=require(_0x3be6('0xf'));var as=require(_0x3be6('0x10'));var hardwareService=require(_0x3be6('0x11'));var logger=require(_0x3be6('0x12'))(_0x3be6('0x13'));var utils=require('../../config/utils');var config=require(_0x3be6('0x14'));var licenseUtil=require(_0x3be6('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35fe6a,_0x1c0b5a){_0x1c0b5a=_0x1c0b5a||0xcc;return function(_0x26e486){if(_0x26e486){return _0x35fe6a[_0x3be6('0x16')](_0x1c0b5a);}return _0x35fe6a[_0x3be6('0x17')](_0x1c0b5a)[_0x3be6('0x18')]();};}function respondWithResult(_0x3a0b88,_0x16fca2){_0x16fca2=_0x16fca2||0xc8;return function(_0xcde510){if(_0xcde510){return _0x3a0b88[_0x3be6('0x17')](_0x16fca2)[_0x3be6('0x19')](_0xcde510);}};}function respondWithFilteredResult(_0x5f1571,_0x5c2bd0){return function(_0x18f44a){if(_0x18f44a){var _0x38d374=typeof _0x5c2bd0['offset']==='undefined'&&typeof _0x5c2bd0[_0x3be6('0x1a')]===_0x3be6('0x1b');var _0x1a6277=_0x18f44a[_0x3be6('0x1c')];var _0x2039f7=_0x38d374?0x0:_0x5c2bd0[_0x3be6('0x1d')];var _0xef85e9=_0x38d374?_0x18f44a[_0x3be6('0x1c')]:_0x5c2bd0['offset']+_0x5c2bd0[_0x3be6('0x1a')];var _0x4b7c22;if(_0xef85e9>=_0x1a6277){_0xef85e9=_0x1a6277;_0x4b7c22=0xc8;}else{_0x4b7c22=0xce;}_0x5f1571['status'](_0x4b7c22);return _0x5f1571['set'](_0x3be6('0x1e'),_0x2039f7+'-'+_0xef85e9+'/'+_0x1a6277)[_0x3be6('0x19')](_0x18f44a);}return null;};}function patchUpdates(_0xc4d596){return function(_0x11452a){try{jsonpatch[_0x3be6('0x1f')](_0x11452a,_0xc4d596,!![]);}catch(_0x1914c6){return BPromise['reject'](_0x1914c6);}return _0x11452a[_0x3be6('0x20')]();};}function saveUpdates(_0x598656,_0x4e5622){return function(_0x5dbf8d){if(_0x5dbf8d){return _0x5dbf8d['update'](_0x598656)['then'](function(_0x546f67){return _0x546f67;});}return null;};}function removeEntity(_0x4e59df,_0x209b4c){return function(_0x5d7222){if(_0x5d7222){return _0x5d7222[_0x3be6('0x21')]()[_0x3be6('0x22')](function(){var _0x2e0974=_0x5d7222['get']({'plain':!![]});var _0x5ea173=_0x3be6('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x5ea173,'resourceId':_0x2e0974['id']}})[_0x3be6('0x22')](function(){return _0x5d7222;});})[_0x3be6('0x22')](function(){_0x4e59df['status'](0xcc)[_0x3be6('0x18')]();});}};}function handleEntityNotFound(_0x4e8f3f,_0x2bd756){return function(_0x2a35be){if(!_0x2a35be){_0x4e8f3f[_0x3be6('0x16')](0x194);}return _0x2a35be;};}function handleError(_0x3ecb5b,_0x44fd59){_0x44fd59=_0x44fd59||0x1f4;return function(_0x4c778e){logger[_0x3be6('0x24')](_0x4c778e[_0x3be6('0x25')]);if(_0x4c778e['name']){delete _0x4c778e['name'];}_0x3ecb5b[_0x3be6('0x17')](_0x44fd59)[_0x3be6('0x26')](_0x4c778e);};}exports[_0x3be6('0x27')]=function(_0x406b37,_0xf1eb41){var _0x1416fe={},_0x2852f4={},_0x360bcd={'count':0x0,'rows':[]};var _0x30ff95=_['map'](db[_0x3be6('0x28')][_0x3be6('0x29')],function(_0x1ced83){return{'name':_0x1ced83[_0x3be6('0x2a')],'type':_0x1ced83[_0x3be6('0x2b')]['key']};});_0x2852f4[_0x3be6('0x2c')]=_[_0x3be6('0x2d')](_0x30ff95,_0x3be6('0x2e'));_0x2852f4[_0x3be6('0x2f')]=_['keys'](_0x406b37[_0x3be6('0x2f')]);_0x2852f4[_0x3be6('0x30')]=_[_0x3be6('0x31')](_0x2852f4[_0x3be6('0x2c')],_0x2852f4[_0x3be6('0x2f')]);_0x1416fe[_0x3be6('0x32')]=_['intersection'](_0x2852f4['model'],qs[_0x3be6('0x33')](_0x406b37['query'][_0x3be6('0x33')]));_0x1416fe[_0x3be6('0x32')]=_0x1416fe[_0x3be6('0x32')][_0x3be6('0x34')]?_0x1416fe[_0x3be6('0x32')]:_0x2852f4['model'];if(!_0x406b37['query'][_0x3be6('0x35')]('nolimit')){_0x1416fe[_0x3be6('0x1a')]=qs[_0x3be6('0x1a')](_0x406b37[_0x3be6('0x2f')][_0x3be6('0x1a')]);_0x1416fe['offset']=qs[_0x3be6('0x1d')](_0x406b37[_0x3be6('0x2f')][_0x3be6('0x1d')]);}_0x1416fe[_0x3be6('0x36')]=qs[_0x3be6('0x37')](_0x406b37[_0x3be6('0x2f')][_0x3be6('0x37')]);_0x1416fe[_0x3be6('0x38')]=qs[_0x3be6('0x30')](_[_0x3be6('0x39')](_0x406b37[_0x3be6('0x2f')],_0x2852f4['filters']),_0x30ff95);if(_0x406b37[_0x3be6('0x2f')][_0x3be6('0x3a')]){_0x1416fe[_0x3be6('0x38')]=_['merge'](_0x1416fe[_0x3be6('0x38')],{'$or':_[_0x3be6('0x2d')](_0x30ff95,function(_0x5c4f32){if(_0x5c4f32['type']!==_0x3be6('0x3b')){var _0x2a32b0={};_0x2a32b0[_0x5c4f32['name']]={'$like':'%'+_0x406b37[_0x3be6('0x2f')][_0x3be6('0x3a')]+'%'};return _0x2a32b0;}})});}_0x1416fe=_['merge']({},_0x1416fe,_0x406b37['options']);var _0x8d66c={'where':_0x1416fe[_0x3be6('0x38')]};return db[_0x3be6('0x28')]['count'](_0x8d66c)[_0x3be6('0x22')](function(_0x50363c){_0x360bcd[_0x3be6('0x1c')]=_0x50363c;if(_0x406b37[_0x3be6('0x2f')][_0x3be6('0x3c')]){_0x1416fe['include']=[{'all':!![]}];}return db[_0x3be6('0x28')]['findAll'](_0x1416fe);})[_0x3be6('0x22')](function(_0x38569b){_0x360bcd['rows']=_0x38569b;return _0x360bcd;})['then'](respondWithFilteredResult(_0xf1eb41,_0x1416fe))[_0x3be6('0x3d')](handleError(_0xf1eb41,null));};exports[_0x3be6('0x3e')]=function(_0x226e5e,_0x532319){var _0x465710={'raw':!![],'where':{'id':_0x226e5e[_0x3be6('0x3f')]['id']}},_0x153e49={};_0x153e49[_0x3be6('0x2c')]=_['keys'](db[_0x3be6('0x28')][_0x3be6('0x29')]);_0x153e49[_0x3be6('0x2f')]=_['keys'](_0x226e5e[_0x3be6('0x2f')]);_0x153e49[_0x3be6('0x30')]=_[_0x3be6('0x31')](_0x153e49[_0x3be6('0x2c')],_0x153e49['query']);_0x465710[_0x3be6('0x32')]=_[_0x3be6('0x31')](_0x153e49[_0x3be6('0x2c')],qs[_0x3be6('0x33')](_0x226e5e[_0x3be6('0x2f')][_0x3be6('0x33')]));_0x465710[_0x3be6('0x32')]=_0x465710[_0x3be6('0x32')][_0x3be6('0x34')]?_0x465710[_0x3be6('0x32')]:_0x153e49['model'];if(_0x226e5e[_0x3be6('0x2f')][_0x3be6('0x3c')]){_0x465710[_0x3be6('0x40')]=[{'all':!![]}];}_0x465710=_[_0x3be6('0x41')]({},_0x465710,_0x226e5e['options']);return db[_0x3be6('0x28')][_0x3be6('0x42')](_0x465710)[_0x3be6('0x22')](handleEntityNotFound(_0x532319,null))['then'](respondWithResult(_0x532319,null))[_0x3be6('0x3d')](handleError(_0x532319,null));};exports[_0x3be6('0x43')]=function(_0x5bc837,_0x4003ed){return db[_0x3be6('0x28')]['create'](_0x5bc837[_0x3be6('0x44')],{})[_0x3be6('0x22')](function(_0x303d6f){var _0x2bf08e=_0x5bc837[_0x3be6('0x45')][_0x3be6('0x46')]({'plain':!![]});if(!_0x2bf08e)throw new Error(_0x3be6('0x47'));if(_0x2bf08e[_0x3be6('0x48')]===_0x3be6('0x45')){var _0x4b8cc7=_0x303d6f[_0x3be6('0x46')]({'plain':!![]});var _0x2a89e9=_0x3be6('0x23');return db['UserProfileSection'][_0x3be6('0x42')]({'where':{'name':_0x2a89e9,'userProfileId':_0x2bf08e[_0x3be6('0x49')]},'raw':!![]})[_0x3be6('0x22')](function(_0x26a734){if(_0x26a734&&_0x26a734[_0x3be6('0x4a')]===0x0){return db[_0x3be6('0x4b')][_0x3be6('0x43')]({'name':_0x4b8cc7[_0x3be6('0x2e')],'resourceId':_0x4b8cc7['id'],'type':_0x26a734['name'],'sectionId':_0x26a734['id']},{})[_0x3be6('0x22')](function(){return _0x303d6f;});}else{return _0x303d6f;}})[_0x3be6('0x3d')](function(_0x4dda9d){logger[_0x3be6('0x24')](_0x3be6('0x4c'),_0x4dda9d);throw _0x4dda9d;});}return _0x303d6f;})[_0x3be6('0x22')](respondWithResult(_0x4003ed,0xc9))[_0x3be6('0x3d')](handleError(_0x4003ed,null));};exports[_0x3be6('0x4d')]=function(_0x5696ed,_0x3057f5){if(_0x5696ed['body']['id']){delete _0x5696ed[_0x3be6('0x44')]['id'];}return db[_0x3be6('0x28')][_0x3be6('0x42')]({'where':{'id':_0x5696ed['params']['id']}})[_0x3be6('0x22')](handleEntityNotFound(_0x3057f5,null))[_0x3be6('0x22')](saveUpdates(_0x5696ed[_0x3be6('0x44')],null))[_0x3be6('0x22')](respondWithResult(_0x3057f5,null))[_0x3be6('0x3d')](handleError(_0x3057f5,null));};exports[_0x3be6('0x21')]=function(_0x2e1cd5,_0x202522){return db[_0x3be6('0x28')][_0x3be6('0x42')]({'where':{'id':_0x2e1cd5[_0x3be6('0x3f')]['id']}})[_0x3be6('0x22')](handleEntityNotFound(_0x202522,null))[_0x3be6('0x22')](removeEntity(_0x202522,null))[_0x3be6('0x3d')](handleError(_0x202522,null));}; \ No newline at end of file +var _0x9564=['findAll','rows','catch','show','rawAttributes','fields','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','zip-dir','fast-json-patch','request-promise','path','to-csv','ejs','squel','jsforce','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','sendStatus','error','name','send','index','CmHopperAdditionalPhone','fieldName','type','key','map','keys','filters','intersection','attributes','model','query','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include'];(function(_0x4e6782,_0x4a4809){var _0x155920=function(_0x475a25){while(--_0x475a25){_0x4e6782['push'](_0x4e6782['shift']());}};_0x155920(++_0x4a4809);}(_0x9564,0x12e));var _0x4956=function(_0x4a5f95,_0x1553d3){_0x4a5f95=_0x4a5f95-0x0;var _0x4dcfa5=_0x9564[_0x4a5f95];return _0x4dcfa5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4956('0x0'));var jsonpatch=require(_0x4956('0x1'));var rp=require(_0x4956('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4956('0x3'));var sox=require('sox');var csv=require(_0x4956('0x4'));var ejs=require(_0x4956('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4956('0x6'));var crypto=require('crypto');var jsforce=require(_0x4956('0x7'));var deskjs=require('desk.js');var toCsv=require(_0x4956('0x4'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4956('0x8'));var authService=require('../../components/auth/service');var qs=require(_0x4956('0x9'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4956('0xa'));var logger=require('../../config/logger')(_0x4956('0xb'));var utils=require(_0x4956('0xc'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4956('0xd'))['db'];function respondWithStatusCode(_0x28e93f,_0x2e06dd){_0x2e06dd=_0x2e06dd||0xcc;return function(_0x2e7a60){if(_0x2e7a60){return _0x28e93f['sendStatus'](_0x2e06dd);}return _0x28e93f['status'](_0x2e06dd)[_0x4956('0xe')]();};}function respondWithResult(_0x418e71,_0x281d9f){_0x281d9f=_0x281d9f||0xc8;return function(_0x1e0db2){if(_0x1e0db2){return _0x418e71[_0x4956('0xf')](_0x281d9f)[_0x4956('0x10')](_0x1e0db2);}};}function respondWithFilteredResult(_0x4ed320,_0x2b4a42){return function(_0x430e99){if(_0x430e99){var _0x36903d=typeof _0x2b4a42[_0x4956('0x11')]==='undefined'&&typeof _0x2b4a42[_0x4956('0x12')]===_0x4956('0x13');var _0x55fbf9=_0x430e99['count'];var _0x519306=_0x36903d?0x0:_0x2b4a42['offset'];var _0x32f63d=_0x36903d?_0x430e99[_0x4956('0x14')]:_0x2b4a42[_0x4956('0x11')]+_0x2b4a42[_0x4956('0x12')];var _0x19e289;if(_0x32f63d>=_0x55fbf9){_0x32f63d=_0x55fbf9;_0x19e289=0xc8;}else{_0x19e289=0xce;}_0x4ed320['status'](_0x19e289);return _0x4ed320[_0x4956('0x15')](_0x4956('0x16'),_0x519306+'-'+_0x32f63d+'/'+_0x55fbf9)['json'](_0x430e99);}return null;};}function patchUpdates(_0x82d118){return function(_0x2da4f8){try{jsonpatch['apply'](_0x2da4f8,_0x82d118,!![]);}catch(_0x759f76){return BPromise['reject'](_0x759f76);}return _0x2da4f8['save']();};}function saveUpdates(_0x4b4dcf,_0x5d1cfb){return function(_0x139c13){if(_0x139c13){return _0x139c13['update'](_0x4b4dcf)['then'](function(_0x26f3e7){return _0x26f3e7;});}return null;};}function removeEntity(_0x2975f8,_0x761e4b){return function(_0x299dd4){if(_0x299dd4){return _0x299dd4[_0x4956('0x17')]()[_0x4956('0x18')](function(){var _0x5d76be=_0x299dd4[_0x4956('0x19')]({'plain':!![]});var _0x5714ca=_0x4956('0x1a');return db[_0x4956('0x1b')][_0x4956('0x17')]({'where':{'type':_0x5714ca,'resourceId':_0x5d76be['id']}})['then'](function(){return _0x299dd4;});})['then'](function(){_0x2975f8[_0x4956('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ac31f,_0x316621){return function(_0x3749ec){if(!_0x3749ec){_0x5ac31f[_0x4956('0x1c')](0x194);}return _0x3749ec;};}function handleError(_0x5a069b,_0x33738d){_0x33738d=_0x33738d||0x1f4;return function(_0x452844){logger[_0x4956('0x1d')](_0x452844['stack']);if(_0x452844[_0x4956('0x1e')]){delete _0x452844[_0x4956('0x1e')];}_0x5a069b[_0x4956('0xf')](_0x33738d)[_0x4956('0x1f')](_0x452844);};}exports[_0x4956('0x20')]=function(_0x53a664,_0xef1795){var _0x5b390c={},_0x45e79c={},_0x463340={'count':0x0,'rows':[]};var _0x488492=_['map'](db[_0x4956('0x21')]['rawAttributes'],function(_0xa13bfe){return{'name':_0xa13bfe[_0x4956('0x22')],'type':_0xa13bfe[_0x4956('0x23')][_0x4956('0x24')]};});_0x45e79c['model']=_[_0x4956('0x25')](_0x488492,_0x4956('0x1e'));_0x45e79c['query']=_[_0x4956('0x26')](_0x53a664['query']);_0x45e79c[_0x4956('0x27')]=_[_0x4956('0x28')](_0x45e79c['model'],_0x45e79c['query']);_0x5b390c[_0x4956('0x29')]=_[_0x4956('0x28')](_0x45e79c[_0x4956('0x2a')],qs['fields'](_0x53a664[_0x4956('0x2b')]['fields']));_0x5b390c[_0x4956('0x29')]=_0x5b390c['attributes']['length']?_0x5b390c[_0x4956('0x29')]:_0x45e79c[_0x4956('0x2a')];if(!_0x53a664[_0x4956('0x2b')]['hasOwnProperty']('nolimit')){_0x5b390c['limit']=qs[_0x4956('0x12')](_0x53a664[_0x4956('0x2b')][_0x4956('0x12')]);_0x5b390c[_0x4956('0x11')]=qs['offset'](_0x53a664[_0x4956('0x2b')]['offset']);}_0x5b390c[_0x4956('0x2c')]=qs[_0x4956('0x2d')](_0x53a664[_0x4956('0x2b')][_0x4956('0x2d')]);_0x5b390c[_0x4956('0x2e')]=qs['filters'](_[_0x4956('0x2f')](_0x53a664[_0x4956('0x2b')],_0x45e79c[_0x4956('0x27')]),_0x488492);if(_0x53a664[_0x4956('0x2b')]['filter']){_0x5b390c[_0x4956('0x2e')]=_['merge'](_0x5b390c[_0x4956('0x2e')],{'$or':_[_0x4956('0x25')](_0x488492,function(_0x40740e){if(_0x40740e[_0x4956('0x23')]!==_0x4956('0x30')){var _0x3a1e5f={};_0x3a1e5f[_0x40740e[_0x4956('0x1e')]]={'$like':'%'+_0x53a664['query']['filter']+'%'};return _0x3a1e5f;}})});}_0x5b390c=_[_0x4956('0x31')]({},_0x5b390c,_0x53a664[_0x4956('0x32')]);var _0x29b165={'where':_0x5b390c[_0x4956('0x2e')]};return db[_0x4956('0x21')][_0x4956('0x14')](_0x29b165)[_0x4956('0x18')](function(_0x249611){_0x463340[_0x4956('0x14')]=_0x249611;if(_0x53a664[_0x4956('0x2b')][_0x4956('0x33')]){_0x5b390c[_0x4956('0x34')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x4956('0x35')](_0x5b390c);})[_0x4956('0x18')](function(_0x2f10eb){_0x463340[_0x4956('0x36')]=_0x2f10eb;return _0x463340;})[_0x4956('0x18')](respondWithFilteredResult(_0xef1795,_0x5b390c))[_0x4956('0x37')](handleError(_0xef1795,null));};exports[_0x4956('0x38')]=function(_0x340294,_0x1c090a){var _0x7d0280={'raw':!![],'where':{'id':_0x340294['params']['id']}},_0x42ed3e={};_0x42ed3e[_0x4956('0x2a')]=_['keys'](db[_0x4956('0x21')][_0x4956('0x39')]);_0x42ed3e[_0x4956('0x2b')]=_[_0x4956('0x26')](_0x340294[_0x4956('0x2b')]);_0x42ed3e[_0x4956('0x27')]=_[_0x4956('0x28')](_0x42ed3e[_0x4956('0x2a')],_0x42ed3e[_0x4956('0x2b')]);_0x7d0280['attributes']=_['intersection'](_0x42ed3e[_0x4956('0x2a')],qs[_0x4956('0x3a')](_0x340294['query'][_0x4956('0x3a')]));_0x7d0280[_0x4956('0x29')]=_0x7d0280[_0x4956('0x29')][_0x4956('0x3b')]?_0x7d0280[_0x4956('0x29')]:_0x42ed3e[_0x4956('0x2a')];if(_0x340294[_0x4956('0x2b')]['includeAll']){_0x7d0280['include']=[{'all':!![]}];}_0x7d0280=_[_0x4956('0x31')]({},_0x7d0280,_0x340294[_0x4956('0x32')]);return db[_0x4956('0x21')][_0x4956('0x3c')](_0x7d0280)[_0x4956('0x18')](handleEntityNotFound(_0x1c090a,null))[_0x4956('0x18')](respondWithResult(_0x1c090a,null))[_0x4956('0x37')](handleError(_0x1c090a,null));};exports[_0x4956('0x3d')]=function(_0x2472f3,_0x25d251){return db[_0x4956('0x21')][_0x4956('0x3d')](_0x2472f3[_0x4956('0x3e')],{})['then'](function(_0x12f3c2){var _0x3dd69f=_0x2472f3[_0x4956('0x3f')]['get']({'plain':!![]});if(!_0x3dd69f)throw new Error(_0x4956('0x40'));if(_0x3dd69f['role']===_0x4956('0x3f')){var _0xe2d1b6=_0x12f3c2['get']({'plain':!![]});var _0x5aab0c=_0x4956('0x1a');return db[_0x4956('0x41')][_0x4956('0x3c')]({'where':{'name':_0x5aab0c,'userProfileId':_0x3dd69f[_0x4956('0x42')]},'raw':!![]})[_0x4956('0x18')](function(_0x14d575){if(_0x14d575&&_0x14d575[_0x4956('0x43')]===0x0){return db[_0x4956('0x1b')]['create']({'name':_0xe2d1b6['name'],'resourceId':_0xe2d1b6['id'],'type':_0x14d575[_0x4956('0x1e')],'sectionId':_0x14d575['id']},{})[_0x4956('0x18')](function(){return _0x12f3c2;});}else{return _0x12f3c2;}})['catch'](function(_0x25de9b){logger[_0x4956('0x1d')](_0x4956('0x44'),_0x25de9b);throw _0x25de9b;});}return _0x12f3c2;})[_0x4956('0x18')](respondWithResult(_0x25d251,0xc9))[_0x4956('0x37')](handleError(_0x25d251,null));};exports[_0x4956('0x45')]=function(_0x2f17cc,_0x273b4a){if(_0x2f17cc[_0x4956('0x3e')]['id']){delete _0x2f17cc['body']['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x2f17cc[_0x4956('0x46')]['id']}})[_0x4956('0x18')](handleEntityNotFound(_0x273b4a,null))[_0x4956('0x18')](saveUpdates(_0x2f17cc[_0x4956('0x3e')],null))[_0x4956('0x18')](respondWithResult(_0x273b4a,null))[_0x4956('0x37')](handleError(_0x273b4a,null));};exports[_0x4956('0x17')]=function(_0x363233,_0x4e844f){return db[_0x4956('0x21')][_0x4956('0x3c')]({'where':{'id':_0x363233[_0x4956('0x46')]['id']}})[_0x4956('0x18')](handleEntityNotFound(_0x4e844f,null))[_0x4956('0x18')](removeEntity(_0x4e844f,null))[_0x4956('0x37')](handleError(_0x4e844f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index f684148..8009467 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 _0xd9db=['request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','lodash','api','bluebird'];(function(_0x947c3b,_0x5c4837){var _0x5acd54=function(_0x1ef8d3){while(--_0x1ef8d3){_0x947c3b['push'](_0x947c3b['shift']());}};_0x5acd54(++_0x5c4837);}(_0xd9db,0x1ec));var _0xbd9d=function(_0xe1b6ac,_0x4b2589){_0xe1b6ac=_0xe1b6ac-0x0;var _0x5adfdb=_0xd9db[_0xe1b6ac];return _0x5adfdb;};'use strict';var _=require(_0xbd9d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbd9d('0x1'));var moment=require('moment');var BPromise=require(_0xbd9d('0x2'));var rp=require(_0xbd9d('0x3'));var fs=require('fs');var path=require(_0xbd9d('0x4'));var rimraf=require('rimraf');var config=require(_0xbd9d('0x5'));var attributes=require(_0xbd9d('0x6'));module[_0xbd9d('0x7')]=function(_0x148919,_0x350665){return _0x148919[_0xbd9d('0x8')]('CmHopperAdditionalPhone',attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde2f=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xde2f,0x8e));var _0xfde2=function(_0x1c7f02,_0x17c55f){_0x1c7f02=_0x1c7f02-0x0;var _0x54a60b=_0xde2f[_0x1c7f02];return _0x54a60b;};'use strict';var _=require(_0xfde2('0x0'));var util=require(_0xfde2('0x1'));var logger=require('../../config/logger')(_0xfde2('0x2'));var moment=require(_0xfde2('0x3'));var BPromise=require(_0xfde2('0x4'));var rp=require(_0xfde2('0x5'));var fs=require('fs');var path=require(_0xfde2('0x6'));var rimraf=require(_0xfde2('0x7'));var config=require(_0xfde2('0x8'));var attributes=require(_0xfde2('0x9'));module[_0xfde2('0xa')]=function(_0x3e8e83,_0x3bea4b){return _0x3e8e83[_0xfde2('0xb')](_0xfde2('0xc'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 54919c1..d703eca 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 _0x664d=['countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countcongestionretry','SwapAdditionalPhones','CmHopper','ContactId','ListId','CmHopperAdditionalPhone','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VerifyAdditionalPhones','findOne','body','VoiceQueueId','CampaignId','then','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x664d,0x1f2));var _0xd664=function(_0x1190c2,_0x2c078b){_0x1190c2=_0x1190c2-0x0;var _0x6ec988=_0x664d[_0x1190c2];return _0x6ec988;};'use strict';var _=require(_0xd664('0x0'));var util=require(_0xd664('0x1'));var moment=require(_0xd664('0x2'));var BPromise=require(_0xd664('0x3'));var rs=require(_0xd664('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd664('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd664('0x6'))(_0xd664('0x7'));var config=require(_0xd664('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd664('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x114486,_0x2d63bf,_0x112d79){return new BPromise(function(_0x33b238,_0x4db7df){return client['request'](_0x114486,_0x112d79)['then'](function(_0x270c17){logger[_0xd664('0xa')](_0xd664('0xb'),_0x2d63bf,'request\x20sent');logger[_0xd664('0xc')](_0xd664('0xd'),_0x2d63bf,_0xd664('0xe'),JSON[_0xd664('0xf')](_0x270c17));if(_0x270c17['error']){if(_0x270c17[_0xd664('0x10')][_0xd664('0x11')]===0x1f4){logger[_0xd664('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2d63bf,_0x270c17[_0xd664('0x10')][_0xd664('0x12')]);return _0x4db7df(_0x270c17[_0xd664('0x10')][_0xd664('0x12')]);}logger[_0xd664('0x10')](_0xd664('0xb'),_0x2d63bf,_0x270c17[_0xd664('0x10')][_0xd664('0x12')]);return _0x33b238(_0x270c17[_0xd664('0x10')][_0xd664('0x12')]);}else{logger[_0xd664('0xa')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2d63bf,_0xd664('0xe'));_0x33b238(_0x270c17[_0xd664('0x13')]['message']);}})[_0xd664('0x14')](function(_0xe56b40){logger[_0xd664('0x10')](_0xd664('0xb'),_0x2d63bf,_0xe56b40);_0x4db7df(_0xe56b40);});});}exports[_0xd664('0x15')]=function(_0x2d8727){var _0x5c77f4=this;return new Promise(function(_0x60ca09,_0x1b393a){return db['CmHopper'][_0xd664('0x16')]({'raw':!![],'where':{'ContactId':_0x2d8727[_0xd664('0x17')]['ContactId'],'ListId':_0x2d8727[_0xd664('0x17')]['ListId'],'VoiceQueueId':_0x2d8727['body'][_0xd664('0x18')]===undefined?null:_0x2d8727['body'][_0xd664('0x18')],'CampaignId':_0x2d8727[_0xd664('0x17')][_0xd664('0x19')]===undefined?null:_0x2d8727[_0xd664('0x17')][_0xd664('0x19')]}})[_0xd664('0x1a')](function(_0x1e3d17){if(_0x1e3d17!=null){return db['CmHopperAdditionalPhone'][_0xd664('0x16')]({'raw':!![],'where':{'CmHopperId':_0x1e3d17['id'],'OrderBy':{'$gt':_0x1e3d17['OrderBy']}},'order':[[_0xd664('0x1b'),_0xd664('0x1c')]]})[_0xd664('0x1a')](function(_0x1cd29e){var _0x4a1c04=0x0;if(_0x1cd29e){if(_0x1cd29e[_0xd664('0x1d')]+_0x1cd29e['countcongestionretry']+_0x1cd29e[_0xd664('0x1e')]+_0x1cd29e[_0xd664('0x1f')]+_0x1cd29e[_0xd664('0x20')]+_0x1cd29e[_0xd664('0x21')]+_0x1cd29e[_0xd664('0x22')]+_0x1cd29e[_0xd664('0x23')]<_0x2d8727[_0xd664('0x24')][_0xd664('0x25')])_0x4a1c04=0x1;_0x60ca09({'additional':_0x4a1c04});}else{return db['CmHopperAdditionalPhone'][_0xd664('0x16')]({'raw':!![],'where':{'CmHopperId':_0x1e3d17['id']},'order':[[_0xd664('0x1b'),_0xd664('0x1c')]]})['then'](function(_0x1bb911){var _0x14510e=0x0;if(_0x1bb911){if(_0x1bb911[_0xd664('0x1d')]+_0x1bb911[_0xd664('0x26')]+_0x1bb911['countnoanswerretry']+_0x1bb911[_0xd664('0x1f')]+_0x1bb911[_0xd664('0x20')]+_0x1bb911[_0xd664('0x21')]+_0x1bb911[_0xd664('0x22')]+_0x1bb911[_0xd664('0x23')]<_0x2d8727[_0xd664('0x24')][_0xd664('0x25')])_0x14510e=0x1;_0x60ca09({'additional':_0x14510e});}else{_0x60ca09({'additional':0x0});}})[_0xd664('0x14')](function(_0x1d9e09){logger['error'](_0xd664('0x15'),_0x1d9e09['message']);_0x1b393a(_0x5c77f4['error'](0x1f4,_0x1d9e09[_0xd664('0x12')]));});}})[_0xd664('0x14')](function(_0x1fb8be){logger[_0xd664('0x10')](_0xd664('0x15'),_0x1fb8be[_0xd664('0x12')]);_0x1b393a(_0x5c77f4['error'](0x1f4,_0x1fb8be[_0xd664('0x12')]));});}else _0x60ca09({'additional':0x0});});});};exports[_0xd664('0x27')]=function(_0x3bc5d1){var _0xcc5496=this;return new Promise(function(_0x379ebb,_0x395274){return db[_0xd664('0x28')]['findOne']({'raw':!![],'where':{'ContactId':_0x3bc5d1[_0xd664('0x17')][_0xd664('0x29')],'ListId':_0x3bc5d1[_0xd664('0x17')][_0xd664('0x2a')],'VoiceQueueId':_0x3bc5d1[_0xd664('0x17')][_0xd664('0x18')]===undefined?null:_0x3bc5d1[_0xd664('0x17')][_0xd664('0x18')],'CampaignId':_0x3bc5d1['body']['CampaignId']===undefined?null:_0x3bc5d1['body'][_0xd664('0x19')]}})[_0xd664('0x1a')](function(_0x297231){if(_0x297231!=null){return db[_0xd664('0x2b')][_0xd664('0x16')]({'raw':!![],'where':{'CmHopperId':_0x297231['id'],'OrderBy':{'$gte':_0x297231[_0xd664('0x1b')]}},'order':[[_0xd664('0x1b'),'ASC']]})[_0xd664('0x1a')](function(_0x128bc4){if(_0x128bc4)return activateAdditionalPhone(_0x297231,_0x3bc5d1[_0xd664('0x17')],_0x128bc4,_0x3bc5d1[_0xd664('0x2c')],_0x3bc5d1['waitTime'])[_0xd664('0x1a')](function(_0x30ff58){_0x379ebb(_0x30ff58);});else{return db[_0xd664('0x2b')][_0xd664('0x16')]({'raw':!![],'where':{'CmHopperId':_0x297231['id']},'order':[['OrderBy',_0xd664('0x1c')]]})[_0xd664('0x1a')](function(_0x332f41){if(_0x332f41)return activateAdditionalPhone(_0x297231,_0x3bc5d1[_0xd664('0x17')],_0x332f41,_0x3bc5d1[_0xd664('0x2c')],_0x3bc5d1[_0xd664('0x2d')])[_0xd664('0x1a')](function(_0x16fef5){_0x379ebb(_0x16fef5);});else{_0x379ebb({'id':_0x297231['id'],'phone':''});}})['catch'](function(_0x12abd7){logger[_0xd664('0x10')](_0xd664('0x15'),_0x12abd7[_0xd664('0x12')]);_0x395274(_0xcc5496[_0xd664('0x10')](0x1f4,_0x12abd7['message']));});}})[_0xd664('0x14')](function(_0x3f02c5){logger[_0xd664('0x10')](_0xd664('0x15'),_0x3f02c5[_0xd664('0x12')]);_0x395274(_0xcc5496[_0xd664('0x10')](0x1f4,_0x3f02c5[_0xd664('0x12')]));});}else _0x379ebb(0x1);});});};function activateAdditionalPhone(_0x50006e,_0x4efd17,_0x4b7502,_0x11efa8,_0x3d6a05){return new Promise(function(_0x22d0b3,_0x6a67db){var _0x38a550;if(_[_0xd664('0x2e')](_0x4b7502['scheduledat'])){_0x4b7502[_0xd664('0x2f')]=moment();}if(moment()>moment(_0x4b7502[_0xd664('0x2f')])){_0x38a550=moment()[_0xd664('0x30')](_0x3d6a05||0x3,_0xd664('0x31'));}else{if(_0x4b7502[_0xd664('0x1b')]==0x0){_0x38a550=moment(_0x4b7502[_0xd664('0x2f')]);}else{_0x38a550=moment()[_0xd664('0x30')](_0x3d6a05||0x3,'minutes');}}if(_[_0xd664('0x2e')](_0x38a550)){_0x38a550=moment()[_0xd664('0x30')](_0x3d6a05||0x3,'minutes');}var _0x536e04={'phone':_0x50006e[_0xd664('0x32')],'active':0x0,'OrderBy':_[_0xd664('0x2e')](_0x50006e[_0xd664('0x1b')])?0x0:_0x50006e[_0xd664('0x1b')],'scheduledat':moment()[_0xd664('0x30')](_0x11efa8||0x1,_0xd664('0x31')),'countbusyretry':_0x4efd17[_0xd664('0x1d')],'countcongestionretry':_0x4efd17[_0xd664('0x26')],'countnoanswerretry':_0x4efd17[_0xd664('0x1e')],'countnosuchnumberretry':_0x4efd17[_0xd664('0x1f')],'countdropretry':_0x4efd17[_0xd664('0x20')],'countabandonedretry':_0x4efd17['countabandonedretry'],'countmachineretry':_0x4efd17[_0xd664('0x22')],'countagentrejectretry':_0x4efd17[_0xd664('0x23')],'createdAt':_0x4efd17['createdAt'],'updatedAt':_0x4efd17['updatedAt']};var _0x36ee77={'CmHopperId':_0x50006e['id'],'phone':_0x4b7502[_0xd664('0x32')],'active':0x0,'OrderBy':_['isNil'](_0x4b7502[_0xd664('0x1b')])?0x0:_0x4b7502['OrderBy'],'scheduledat':_0x38a550,'countbusyretry':_0x4b7502['countbusyretry'],'countcongestionretry':_0x4b7502[_0xd664('0x26')],'countnoanswerretry':_0x4b7502[_0xd664('0x1e')],'countnosuchnumberretry':_0x4b7502['countnosuchnumberretry'],'countdropretry':_0x4b7502[_0xd664('0x20')],'countabandonedretry':_0x4b7502[_0xd664('0x21')],'countmachineretry':_0x4b7502[_0xd664('0x22')],'countagentrejectretry':_0x4b7502[_0xd664('0x23')],'createdAt':_0x4b7502[_0xd664('0x33')],'updatedAt':_0x4b7502[_0xd664('0x34')]};return db[_0xd664('0x35')][_0xd664('0x36')](function(_0xf95c1f){return db[_0xd664('0x2b')][_0xd664('0x37')](_0x536e04,{'where':{'id':_0x4b7502['id']}},{'transaction':_0xf95c1f})[_0xd664('0x1a')](function(){return db[_0xd664('0x28')][_0xd664('0x37')](_0x36ee77,{'where':{'id':_0x50006e['id']}},{'transaction':_0xf95c1f});});})[_0xd664('0x1a')](function(_0x19e403){_0x22d0b3({'id':_0x50006e['id'],'phone':_0x4b7502[_0xd664('0x32')]});})[_0xd664('0x14')](function(_0x45796d){logger[_0xd664('0x10')](_0xd664('0x38'),_0x45796d[_0xd664('0x12')]);_0x6a67db({'error':_0x45796d[_0xd664('0x12')]});});});}exports['IncrementPreviewCounters']=function(_0x89248){var _0x12754c=this;return new Promise(function(_0x5b512b,_0x4a446a){return db[_0xd664('0x28')]['update'](_0x89248[_0xd664('0x17')][_0xd664('0x39')],{'where':{'id':_0x89248[_0xd664('0x17')]['id']}})[_0xd664('0x1a')](function(_0x325de4){_0x5b512b(_0x325de4);})[_0xd664('0x14')](function(_0x1d3d28){logger[_0xd664('0x10')](_0xd664('0x3a'),_0x1d3d28['message']);_0x4a446a(_0x12754c[_0xd664('0x10')](0x1f4,_0x1d3d28['message']));});});}; \ No newline at end of file +var _0x13cb=['duration','scheduledat','minutes','add','isNil','phone','updatedAt','createdAt','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','VerifyAdditionalPhones','CmHopper','findOne','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','then','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countbusyretry','countcongestionretry','countabandonedretry','catch','SwapAdditionalPhones','ListId','waitTime'];(function(_0x4faa24,_0x4a2cf7){var _0xa991a5=function(_0x38802e){while(--_0x38802e){_0x4faa24['push'](_0x4faa24['shift']());}};_0xa991a5(++_0x4a2cf7);}(_0x13cb,0x19c));var _0xb13c=function(_0x7ee493,_0x2cc2cb){_0x7ee493=_0x7ee493-0x0;var _0x1f2c25=_0x13cb[_0x7ee493];return _0x1f2c25;};'use strict';var _=require(_0xb13c('0x0'));var util=require(_0xb13c('0x1'));var moment=require(_0xb13c('0x2'));var BPromise=require(_0xb13c('0x3'));var rs=require(_0xb13c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb13c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb13c('0x6'))(_0xb13c('0x7'));var config=require(_0xb13c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb13c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xad7b36,_0x3c05e7,_0x3a55e3){return new BPromise(function(_0x3cd9a8,_0x55bc75){return client[_0xb13c('0xa')](_0xad7b36,_0x3a55e3)['then'](function(_0x24aa56){logger[_0xb13c('0xb')](_0xb13c('0xc'),_0x3c05e7,_0xb13c('0xd'));logger[_0xb13c('0xe')](_0xb13c('0xf'),_0x3c05e7,_0xb13c('0xd'),JSON['stringify'](_0x24aa56));if(_0x24aa56[_0xb13c('0x10')]){if(_0x24aa56[_0xb13c('0x10')][_0xb13c('0x11')]===0x1f4){logger[_0xb13c('0x10')](_0xb13c('0xc'),_0x3c05e7,_0x24aa56[_0xb13c('0x10')][_0xb13c('0x12')]);return _0x55bc75(_0x24aa56[_0xb13c('0x10')]['message']);}logger[_0xb13c('0x10')](_0xb13c('0xc'),_0x3c05e7,_0x24aa56[_0xb13c('0x10')][_0xb13c('0x12')]);return _0x3cd9a8(_0x24aa56[_0xb13c('0x10')]['message']);}else{logger[_0xb13c('0xb')](_0xb13c('0xc'),_0x3c05e7,_0xb13c('0xd'));_0x3cd9a8(_0x24aa56[_0xb13c('0x13')][_0xb13c('0x12')]);}})['catch'](function(_0x2d4d53){logger[_0xb13c('0x10')](_0xb13c('0xc'),_0x3c05e7,_0x2d4d53);_0x55bc75(_0x2d4d53);});});}exports[_0xb13c('0x14')]=function(_0x2ebd45){var _0x2304ed=this;return new Promise(function(_0x228852,_0x5aab7a){return db[_0xb13c('0x15')][_0xb13c('0x16')]({'raw':!![],'where':{'ContactId':_0x2ebd45[_0xb13c('0x17')]['ContactId'],'ListId':_0x2ebd45[_0xb13c('0x17')]['ListId'],'VoiceQueueId':_0x2ebd45[_0xb13c('0x17')][_0xb13c('0x18')]===undefined?null:_0x2ebd45[_0xb13c('0x17')][_0xb13c('0x18')],'CampaignId':_0x2ebd45[_0xb13c('0x17')]['CampaignId']===undefined?null:_0x2ebd45[_0xb13c('0x17')][_0xb13c('0x19')]}})['then'](function(_0xf23c22){if(_0xf23c22!=null){return db[_0xb13c('0x1a')][_0xb13c('0x16')]({'raw':!![],'where':{'CmHopperId':_0xf23c22['id'],'OrderBy':{'$gt':_0xf23c22[_0xb13c('0x1b')]}},'order':[[_0xb13c('0x1b'),_0xb13c('0x1c')]]})[_0xb13c('0x1d')](function(_0x254da3){var _0x4c3ffc=0x0;if(_0x254da3){if(_0x254da3['countbusyretry']+_0x254da3['countcongestionretry']+_0x254da3[_0xb13c('0x1e')]+_0x254da3[_0xb13c('0x1f')]+_0x254da3[_0xb13c('0x20')]+_0x254da3['countabandonedretry']+_0x254da3[_0xb13c('0x21')]+_0x254da3[_0xb13c('0x22')]<_0x2ebd45[_0xb13c('0x23')][_0xb13c('0x24')])_0x4c3ffc=0x1;_0x228852({'additional':_0x4c3ffc});}else{return db[_0xb13c('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0xf23c22['id']},'order':[[_0xb13c('0x1b'),_0xb13c('0x1c')]]})['then'](function(_0x2cc6f7){var _0x521f0d=0x0;if(_0x2cc6f7){if(_0x2cc6f7[_0xb13c('0x25')]+_0x2cc6f7[_0xb13c('0x26')]+_0x2cc6f7[_0xb13c('0x1e')]+_0x2cc6f7['countnosuchnumberretry']+_0x2cc6f7[_0xb13c('0x20')]+_0x2cc6f7[_0xb13c('0x27')]+_0x2cc6f7[_0xb13c('0x21')]+_0x2cc6f7[_0xb13c('0x22')]<_0x2ebd45[_0xb13c('0x23')][_0xb13c('0x24')])_0x521f0d=0x1;_0x228852({'additional':_0x521f0d});}else{_0x228852({'additional':0x0});}})[_0xb13c('0x28')](function(_0x4a0d42){logger[_0xb13c('0x10')](_0xb13c('0x14'),_0x4a0d42['message']);_0x5aab7a(_0x2304ed[_0xb13c('0x10')](0x1f4,_0x4a0d42[_0xb13c('0x12')]));});}})[_0xb13c('0x28')](function(_0x286f18){logger[_0xb13c('0x10')](_0xb13c('0x14'),_0x286f18[_0xb13c('0x12')]);_0x5aab7a(_0x2304ed[_0xb13c('0x10')](0x1f4,_0x286f18[_0xb13c('0x12')]));});}else _0x228852({'additional':0x0});});});};exports[_0xb13c('0x29')]=function(_0x16ac97){var _0x39ab6b=this;return new Promise(function(_0x17ed2c,_0x37e187){return db[_0xb13c('0x15')][_0xb13c('0x16')]({'raw':!![],'where':{'ContactId':_0x16ac97[_0xb13c('0x17')]['ContactId'],'ListId':_0x16ac97[_0xb13c('0x17')][_0xb13c('0x2a')],'VoiceQueueId':_0x16ac97[_0xb13c('0x17')][_0xb13c('0x18')]===undefined?null:_0x16ac97[_0xb13c('0x17')][_0xb13c('0x18')],'CampaignId':_0x16ac97[_0xb13c('0x17')][_0xb13c('0x19')]===undefined?null:_0x16ac97[_0xb13c('0x17')][_0xb13c('0x19')]}})['then'](function(_0x153924){if(_0x153924!=null){return db[_0xb13c('0x1a')][_0xb13c('0x16')]({'raw':!![],'where':{'CmHopperId':_0x153924['id'],'OrderBy':{'$gte':_0x153924['OrderBy']}},'order':[[_0xb13c('0x1b'),'ASC']]})[_0xb13c('0x1d')](function(_0x5e470a){if(_0x5e470a)return activateAdditionalPhone(_0x153924,_0x16ac97['body'],_0x5e470a,_0x16ac97['duration'],_0x16ac97[_0xb13c('0x2b')])[_0xb13c('0x1d')](function(_0x1c05b3){_0x17ed2c(_0x1c05b3);});else{return db[_0xb13c('0x1a')][_0xb13c('0x16')]({'raw':!![],'where':{'CmHopperId':_0x153924['id']},'order':[[_0xb13c('0x1b'),_0xb13c('0x1c')]]})['then'](function(_0x1ebf36){if(_0x1ebf36)return activateAdditionalPhone(_0x153924,_0x16ac97[_0xb13c('0x17')],_0x1ebf36,_0x16ac97[_0xb13c('0x2c')],_0x16ac97[_0xb13c('0x2b')])[_0xb13c('0x1d')](function(_0x462188){_0x17ed2c(_0x462188);});else{_0x17ed2c({'id':_0x153924['id'],'phone':''});}})[_0xb13c('0x28')](function(_0x25f972){logger[_0xb13c('0x10')](_0xb13c('0x14'),_0x25f972[_0xb13c('0x12')]);_0x37e187(_0x39ab6b[_0xb13c('0x10')](0x1f4,_0x25f972[_0xb13c('0x12')]));});}})[_0xb13c('0x28')](function(_0x1e8dff){logger['error'](_0xb13c('0x14'),_0x1e8dff[_0xb13c('0x12')]);_0x37e187(_0x39ab6b['error'](0x1f4,_0x1e8dff[_0xb13c('0x12')]));});}else _0x17ed2c(0x1);});});};function activateAdditionalPhone(_0x56332f,_0x21a071,_0x4f2c3e,_0x15a74b,_0x437831){return new Promise(function(_0x270d85,_0x55ea55){var _0x357b1c;if(_['isNil'](_0x4f2c3e['scheduledat'])){_0x4f2c3e['scheduledat']=moment();}if(moment()>moment(_0x4f2c3e[_0xb13c('0x2d')])){_0x357b1c=moment()['add'](_0x437831||0x3,_0xb13c('0x2e'));}else{if(_0x4f2c3e['OrderBy']==0x0){_0x357b1c=moment(_0x4f2c3e['scheduledat']);}else{_0x357b1c=moment()[_0xb13c('0x2f')](_0x437831||0x3,_0xb13c('0x2e'));}}if(_[_0xb13c('0x30')](_0x357b1c)){_0x357b1c=moment()[_0xb13c('0x2f')](_0x437831||0x3,_0xb13c('0x2e'));}var _0x4b967d={'phone':_0x56332f[_0xb13c('0x31')],'active':0x0,'OrderBy':_[_0xb13c('0x30')](_0x56332f[_0xb13c('0x1b')])?0x0:_0x56332f[_0xb13c('0x1b')],'scheduledat':moment()['add'](_0x15a74b||0x1,_0xb13c('0x2e')),'countbusyretry':_0x21a071['countbusyretry'],'countcongestionretry':_0x21a071[_0xb13c('0x26')],'countnoanswerretry':_0x21a071[_0xb13c('0x1e')],'countnosuchnumberretry':_0x21a071[_0xb13c('0x1f')],'countdropretry':_0x21a071[_0xb13c('0x20')],'countabandonedretry':_0x21a071[_0xb13c('0x27')],'countmachineretry':_0x21a071['countmachineretry'],'countagentrejectretry':_0x21a071[_0xb13c('0x22')],'createdAt':_0x21a071['createdAt'],'updatedAt':_0x21a071[_0xb13c('0x32')]};var _0x24bc3e={'CmHopperId':_0x56332f['id'],'phone':_0x4f2c3e[_0xb13c('0x31')],'active':0x0,'OrderBy':_[_0xb13c('0x30')](_0x4f2c3e[_0xb13c('0x1b')])?0x0:_0x4f2c3e[_0xb13c('0x1b')],'scheduledat':_0x357b1c,'countbusyretry':_0x4f2c3e[_0xb13c('0x25')],'countcongestionretry':_0x4f2c3e['countcongestionretry'],'countnoanswerretry':_0x4f2c3e[_0xb13c('0x1e')],'countnosuchnumberretry':_0x4f2c3e['countnosuchnumberretry'],'countdropretry':_0x4f2c3e[_0xb13c('0x20')],'countabandonedretry':_0x4f2c3e[_0xb13c('0x27')],'countmachineretry':_0x4f2c3e[_0xb13c('0x21')],'countagentrejectretry':_0x4f2c3e[_0xb13c('0x22')],'createdAt':_0x4f2c3e[_0xb13c('0x33')],'updatedAt':_0x4f2c3e[_0xb13c('0x32')]};return db['sequelize'][_0xb13c('0x34')](function(_0xda2c7d){return db[_0xb13c('0x1a')][_0xb13c('0x35')](_0x4b967d,{'where':{'id':_0x4f2c3e['id']}},{'transaction':_0xda2c7d})[_0xb13c('0x1d')](function(){return db[_0xb13c('0x15')][_0xb13c('0x35')](_0x24bc3e,{'where':{'id':_0x56332f['id']}},{'transaction':_0xda2c7d});});})[_0xb13c('0x1d')](function(_0x16275b){_0x270d85({'id':_0x56332f['id'],'phone':_0x4f2c3e[_0xb13c('0x31')]});})['catch'](function(_0x37e99a){logger[_0xb13c('0x10')](_0xb13c('0x36'),_0x37e99a[_0xb13c('0x12')]);_0x55ea55({'error':_0x37e99a[_0xb13c('0x12')]});});});}exports[_0xb13c('0x37')]=function(_0x4c3eca){var _0x532374=this;return new Promise(function(_0x156f73,_0x359103){return db[_0xb13c('0x15')][_0xb13c('0x35')](_0x4c3eca[_0xb13c('0x17')][_0xb13c('0x38')],{'where':{'id':_0x4c3eca[_0xb13c('0x17')]['id']}})[_0xb13c('0x1d')](function(_0x30f9f6){_0x156f73(_0x30f9f6);})[_0xb13c('0x28')](function(_0x13bcc0){logger[_0xb13c('0x10')]('IncrementPreviewCounters',_0x13bcc0['message']);_0x359103(_0x532374['error'](0x1f4,_0x13bcc0[_0xb13c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index bca471a..5263181 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 _0xc03c=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','index','isAuthenticated','show','post','create','put','/:id','delete'];(function(_0x1b6b66,_0x508246){var _0x5455e5=function(_0x479554){while(--_0x479554){_0x1b6b66['push'](_0x1b6b66['shift']());}};_0x5455e5(++_0x508246);}(_0xc03c,0x1a4));var _0xcc03=function(_0x37c8ef,_0x334449){_0x37c8ef=_0x37c8ef-0x0;var _0x5eaee9=_0xc03c[_0x37c8ef];return _0x5eaee9;};'use strict';var multer=require(_0xcc03('0x0'));var util=require(_0xcc03('0x1'));var path=require('path');var timeout=require(_0xcc03('0x2'));var express=require(_0xcc03('0x3'));var router=express[_0xcc03('0x4')]();var fs_extra=require(_0xcc03('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcc03('0x6'));var config=require('../../config/environment');var controller=require(_0xcc03('0x7'));router[_0xcc03('0x8')]('/',auth['isAuthenticated'](),controller[_0xcc03('0x9')]);router['get']('/:id',auth[_0xcc03('0xa')](),controller[_0xcc03('0xb')]);router[_0xcc03('0xc')]('/',auth[_0xcc03('0xa')](),controller[_0xcc03('0xd')]);router[_0xcc03('0xe')](_0xcc03('0xf'),auth[_0xcc03('0xa')](),controller['update']);router[_0xcc03('0x10')](_0xcc03('0xf'),auth['isAuthenticated'](),controller[_0xcc03('0x11')]);module[_0xcc03('0x12')]=router; \ No newline at end of file +var _0xfc72=['post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','show'];(function(_0x13d43a,_0xbe5066){var _0x420675=function(_0x416229){while(--_0x416229){_0x13d43a['push'](_0x13d43a['shift']());}};_0x420675(++_0xbe5066);}(_0xfc72,0xc4));var _0x2fc7=function(_0x31df6f,_0x380e73){_0x31df6f=_0x31df6f-0x0;var _0x31e353=_0xfc72[_0x31df6f];return _0x31e353;};'use strict';var multer=require(_0x2fc7('0x0'));var util=require(_0x2fc7('0x1'));var path=require(_0x2fc7('0x2'));var timeout=require(_0x2fc7('0x3'));var express=require(_0x2fc7('0x4'));var router=express[_0x2fc7('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2fc7('0x6'));var config=require(_0x2fc7('0x7'));var controller=require(_0x2fc7('0x8'));router[_0x2fc7('0x9')]('/',auth[_0x2fc7('0xa')](),controller[_0x2fc7('0xb')]);router[_0x2fc7('0x9')]('/:id',auth[_0x2fc7('0xa')](),controller[_0x2fc7('0xc')]);router[_0x2fc7('0xd')]('/',auth[_0x2fc7('0xa')](),controller[_0x2fc7('0xe')]);router[_0x2fc7('0xf')](_0x2fc7('0x10'),auth[_0x2fc7('0xa')](),controller['update']);router['delete'](_0x2fc7('0x10'),auth[_0x2fc7('0xa')](),controller[_0x2fc7('0x11')]);module[_0x2fc7('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index f4acb72..e1da157 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 _0x96fd=['contactListQueue','sequelize','STRING','INTEGER'];(function(_0x65fc91,_0x5c4bc3){var _0x27e56f=function(_0x51b781){while(--_0x51b781){_0x65fc91['push'](_0x65fc91['shift']());}};_0x27e56f(++_0x5c4bc3);}(_0x96fd,0x1e9));var _0xd96f=function(_0x66e5e6,_0x15b972){_0x66e5e6=_0x66e5e6-0x0;var _0x368fc5=_0x96fd[_0x66e5e6];return _0x368fc5;};'use strict';var moment=require('moment');var Sequelize=require(_0xd96f('0x0'));module['exports']={'phone':{'type':Sequelize[_0xd96f('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xd96f('0x2')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xd96f('0x2')],'unique':_0xd96f('0x3')},'VoiceQueueId':{'type':Sequelize[_0xd96f('0x2')],'unique':_0xd96f('0x3')}}; \ No newline at end of file +var _0xce68=['STRING','INTEGER','contactListQueue','moment','exports'];(function(_0x249c0e,_0x289f55){var _0x4c03f9=function(_0x220651){while(--_0x220651){_0x249c0e['push'](_0x249c0e['shift']());}};_0x4c03f9(++_0x289f55);}(_0xce68,0x10c));var _0x8ce6=function(_0x1e96ce,_0x289135){_0x1e96ce=_0x1e96ce-0x0;var _0x239bae=_0xce68[_0x1e96ce];return _0x239bae;};'use strict';var moment=require(_0x8ce6('0x0'));var Sequelize=require('sequelize');module[_0x8ce6('0x1')]={'phone':{'type':Sequelize[_0x8ce6('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x8ce6('0x3')],'unique':_0x8ce6('0x4')},'ListId':{'type':Sequelize[_0x8ce6('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x8ce6('0x3')],'unique':_0x8ce6('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 40409c4..1d5c6cc 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 _0xa46e=['rawAttributes','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','set','Content-Range','reject','update','then','destroy','stack','name','send','index','map','CmHopperBlack','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params'];(function(_0x553b3f,_0x40e135){var _0x44bdba=function(_0xa4db0){while(--_0xa4db0){_0x553b3f['push'](_0x553b3f['shift']());}};_0x44bdba(++_0x40e135);}(_0xa46e,0x8a));var _0xea46=function(_0x13137e,_0x29c0f3){_0x13137e=_0x13137e-0x0;var _0x346261=_0xa46e[_0x13137e];return _0x346261;};'use strict';var emlformat=require(_0xea46('0x0'));var rimraf=require(_0xea46('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea46('0x2'));var rp=require(_0xea46('0x3'));var moment=require(_0xea46('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xea46('0x5'));var util=require('util');var path=require(_0xea46('0x6'));var sox=require('sox');var csv=require(_0xea46('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea46('0x8'));var _=require(_0xea46('0x9'));var squel=require('squel');var crypto=require(_0xea46('0xa'));var jsforce=require(_0xea46('0xb'));var deskjs=require(_0xea46('0xc'));var toCsv=require(_0xea46('0x7'));var querystring=require(_0xea46('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xea46('0xe'));var as=require(_0xea46('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea46('0x10'))(_0xea46('0x11'));var utils=require(_0xea46('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xea46('0x13'));var db=require(_0xea46('0x14'))['db'];function respondWithStatusCode(_0x4e10f3,_0x13390c){_0x13390c=_0x13390c||0xcc;return function(_0x1a4fe2){if(_0x1a4fe2){return _0x4e10f3['sendStatus'](_0x13390c);}return _0x4e10f3[_0xea46('0x15')](_0x13390c)['end']();};}function respondWithResult(_0x3024af,_0x42c328){_0x42c328=_0x42c328||0xc8;return function(_0x6c4bc4){if(_0x6c4bc4){return _0x3024af[_0xea46('0x15')](_0x42c328)[_0xea46('0x16')](_0x6c4bc4);}};}function respondWithFilteredResult(_0x2ef436,_0x81ee45){return function(_0x20a79c){if(_0x20a79c){var _0x176ad2=typeof _0x81ee45['offset']===_0xea46('0x17')&&typeof _0x81ee45[_0xea46('0x18')]===_0xea46('0x17');var _0x59f28e=_0x20a79c['count'];var _0x19d5c1=_0x176ad2?0x0:_0x81ee45[_0xea46('0x19')];var _0x5cf5dd=_0x176ad2?_0x20a79c['count']:_0x81ee45[_0xea46('0x19')]+_0x81ee45[_0xea46('0x18')];var _0x4ff93d;if(_0x5cf5dd>=_0x59f28e){_0x5cf5dd=_0x59f28e;_0x4ff93d=0xc8;}else{_0x4ff93d=0xce;}_0x2ef436[_0xea46('0x15')](_0x4ff93d);return _0x2ef436[_0xea46('0x1a')](_0xea46('0x1b'),_0x19d5c1+'-'+_0x5cf5dd+'/'+_0x59f28e)[_0xea46('0x16')](_0x20a79c);}return null;};}function patchUpdates(_0x53b8db){return function(_0x2b6491){try{jsonpatch['apply'](_0x2b6491,_0x53b8db,!![]);}catch(_0x515e32){return BPromise[_0xea46('0x1c')](_0x515e32);}return _0x2b6491['save']();};}function saveUpdates(_0x4cc673,_0x5064d8){return function(_0x3b25fe){if(_0x3b25fe){return _0x3b25fe[_0xea46('0x1d')](_0x4cc673)[_0xea46('0x1e')](function(_0x5beb44){return _0x5beb44;});}return null;};}function removeEntity(_0x16f8fa,_0x59b10d){return function(_0x12e688){if(_0x12e688){return _0x12e688[_0xea46('0x1f')]()['then'](function(){_0x16f8fa[_0xea46('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b3a8f,_0x114bf9){return function(_0xd4cf78){if(!_0xd4cf78){_0x2b3a8f['sendStatus'](0x194);}return _0xd4cf78;};}function handleError(_0x5d2de1,_0x44e797){_0x44e797=_0x44e797||0x1f4;return function(_0x38ac07){logger['error'](_0x38ac07[_0xea46('0x20')]);if(_0x38ac07['name']){delete _0x38ac07[_0xea46('0x21')];}_0x5d2de1['status'](_0x44e797)[_0xea46('0x22')](_0x38ac07);};}exports[_0xea46('0x23')]=function(_0x6710ae,_0x44517d){var _0x146995={},_0x174345={},_0x4a5149={'count':0x0,'rows':[]};var _0x382bbc=_[_0xea46('0x24')](db[_0xea46('0x25')]['rawAttributes'],function(_0x3e7856){return{'name':_0x3e7856[_0xea46('0x26')],'type':_0x3e7856[_0xea46('0x27')]['key']};});_0x174345['model']=_['map'](_0x382bbc,_0xea46('0x21'));_0x174345[_0xea46('0x28')]=_[_0xea46('0x29')](_0x6710ae[_0xea46('0x28')]);_0x174345[_0xea46('0x2a')]=_[_0xea46('0x2b')](_0x174345[_0xea46('0x2c')],_0x174345[_0xea46('0x28')]);_0x146995[_0xea46('0x2d')]=_[_0xea46('0x2b')](_0x174345[_0xea46('0x2c')],qs['fields'](_0x6710ae[_0xea46('0x28')][_0xea46('0x2e')]));_0x146995[_0xea46('0x2d')]=_0x146995[_0xea46('0x2d')][_0xea46('0x2f')]?_0x146995[_0xea46('0x2d')]:_0x174345[_0xea46('0x2c')];if(!_0x6710ae['query'][_0xea46('0x30')](_0xea46('0x31'))){_0x146995[_0xea46('0x18')]=qs[_0xea46('0x18')](_0x6710ae[_0xea46('0x28')]['limit']);_0x146995['offset']=qs[_0xea46('0x19')](_0x6710ae[_0xea46('0x28')]['offset']);}_0x146995[_0xea46('0x32')]=qs[_0xea46('0x33')](_0x6710ae[_0xea46('0x28')][_0xea46('0x33')]);_0x146995['where']=qs['filters'](_[_0xea46('0x34')](_0x6710ae['query'],_0x174345[_0xea46('0x2a')]),_0x382bbc);if(_0x6710ae[_0xea46('0x28')]['filter']){_0x146995[_0xea46('0x35')]=_[_0xea46('0x36')](_0x146995['where'],{'$or':_[_0xea46('0x24')](_0x382bbc,function(_0xefad3e){if(_0xefad3e['type']!==_0xea46('0x37')){var _0x41e9e8={};_0x41e9e8[_0xefad3e[_0xea46('0x21')]]={'$like':'%'+_0x6710ae[_0xea46('0x28')]['filter']+'%'};return _0x41e9e8;}})});}_0x146995=_[_0xea46('0x36')]({},_0x146995,_0x6710ae[_0xea46('0x38')]);var _0x338c2d={'where':_0x146995[_0xea46('0x35')]};return db[_0xea46('0x25')]['count'](_0x338c2d)[_0xea46('0x1e')](function(_0xdb2e11){_0x4a5149['count']=_0xdb2e11;if(_0x6710ae[_0xea46('0x28')][_0xea46('0x39')]){_0x146995[_0xea46('0x3a')]=[{'all':!![]}];}return db[_0xea46('0x25')]['findAll'](_0x146995);})[_0xea46('0x1e')](function(_0x1cc8f8){_0x4a5149[_0xea46('0x3b')]=_0x1cc8f8;return _0x4a5149;})['then'](respondWithFilteredResult(_0x44517d,_0x146995))[_0xea46('0x3c')](handleError(_0x44517d,null));};exports[_0xea46('0x3d')]=function(_0x2c9491,_0x32c81c){var _0x3164c5={'raw':!![],'where':{'id':_0x2c9491[_0xea46('0x3e')]['id']}},_0xc45d74={};_0xc45d74[_0xea46('0x2c')]=_[_0xea46('0x29')](db[_0xea46('0x25')][_0xea46('0x3f')]);_0xc45d74[_0xea46('0x28')]=_[_0xea46('0x29')](_0x2c9491[_0xea46('0x28')]);_0xc45d74[_0xea46('0x2a')]=_['intersection'](_0xc45d74['model'],_0xc45d74[_0xea46('0x28')]);_0x3164c5[_0xea46('0x2d')]=_[_0xea46('0x2b')](_0xc45d74[_0xea46('0x2c')],qs['fields'](_0x2c9491['query']['fields']));_0x3164c5[_0xea46('0x2d')]=_0x3164c5[_0xea46('0x2d')]['length']?_0x3164c5[_0xea46('0x2d')]:_0xc45d74[_0xea46('0x2c')];if(_0x2c9491[_0xea46('0x28')][_0xea46('0x39')]){_0x3164c5[_0xea46('0x3a')]=[{'all':!![]}];}_0x3164c5=_['merge']({},_0x3164c5,_0x2c9491[_0xea46('0x38')]);return db['CmHopperBlack'][_0xea46('0x40')](_0x3164c5)[_0xea46('0x1e')](handleEntityNotFound(_0x32c81c,null))[_0xea46('0x1e')](respondWithResult(_0x32c81c,null))[_0xea46('0x3c')](handleError(_0x32c81c,null));};exports[_0xea46('0x1d')]=function(_0x1260d1,_0x36f697){if(_0x1260d1['body']['id']){delete _0x1260d1[_0xea46('0x41')]['id'];}return db[_0xea46('0x25')]['find']({'where':{'id':_0x1260d1[_0xea46('0x3e')]['id']}})[_0xea46('0x1e')](handleEntityNotFound(_0x36f697,null))[_0xea46('0x1e')](saveUpdates(_0x1260d1['body'],null))['then'](respondWithResult(_0x36f697,null))[_0xea46('0x3c')](handleError(_0x36f697,null));};exports[_0xea46('0x1f')]=function(_0x3c5a9f,_0x1a4e64){return db[_0xea46('0x25')][_0xea46('0x40')]({'where':{'id':_0x3c5a9f[_0xea46('0x3e')]['id']}})[_0xea46('0x1e')](handleEntityNotFound(_0x1a4e64,null))[_0xea46('0x1e')](removeEntity(_0x1a4e64,null))[_0xea46('0x3c')](handleError(_0x1a4e64,null));};exports['describe']=function(_0x2144a0,_0x5c8cc3){return db[_0xea46('0x25')][_0xea46('0x42')]()[_0xea46('0x1e')](respondWithResult(_0x5c8cc3,null))['catch'](handleError(_0x5c8cc3,null));}; \ No newline at end of file +var _0xce8c=['sox','ejs','fs-extra','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','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','CmHopperBlack','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','catch','show','rawAttributes','length','includeAll','find','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x227c42,_0x23cf23){var _0x1ea246=function(_0x21214c){while(--_0x21214c){_0x227c42['push'](_0x227c42['shift']());}};_0x1ea246(++_0x23cf23);}(_0xce8c,0xe1));var _0xcce8=function(_0x3aafd7,_0x398b24){_0x3aafd7=_0x3aafd7-0x0;var _0x352319=_0xce8c[_0x3aafd7];return _0x352319;};'use strict';var emlformat=require(_0xcce8('0x0'));var rimraf=require(_0xcce8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcce8('0x2'));var rp=require(_0xcce8('0x3'));var moment=require(_0xcce8('0x4'));var BPromise=require(_0xcce8('0x5'));var Mustache=require(_0xcce8('0x6'));var util=require(_0xcce8('0x7'));var path=require(_0xcce8('0x8'));var sox=require(_0xcce8('0x9'));var csv=require('to-csv');var ejs=require(_0xcce8('0xa'));var fs=require('fs');var fs_extra=require(_0xcce8('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcce8('0xc'));var jsforce=require(_0xcce8('0xd'));var deskjs=require(_0xcce8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcce8('0xf'));var Papa=require(_0xcce8('0x10'));var Redis=require(_0xcce8('0x11'));var authService=require(_0xcce8('0x12'));var qs=require(_0xcce8('0x13'));var as=require(_0xcce8('0x14'));var hardwareService=require(_0xcce8('0x15'));var logger=require('../../config/logger')(_0xcce8('0x16'));var utils=require(_0xcce8('0x17'));var config=require(_0xcce8('0x18'));var licenseUtil=require(_0xcce8('0x19'));var db=require(_0xcce8('0x1a'))['db'];function respondWithStatusCode(_0xcf0055,_0x442b79){_0x442b79=_0x442b79||0xcc;return function(_0x259b16){if(_0x259b16){return _0xcf0055[_0xcce8('0x1b')](_0x442b79);}return _0xcf0055[_0xcce8('0x1c')](_0x442b79)['end']();};}function respondWithResult(_0x38efe9,_0x1e67e4){_0x1e67e4=_0x1e67e4||0xc8;return function(_0x125dac){if(_0x125dac){return _0x38efe9[_0xcce8('0x1c')](_0x1e67e4)['json'](_0x125dac);}};}function respondWithFilteredResult(_0x41f334,_0x172594){return function(_0x202d59){if(_0x202d59){var _0x3ac641=typeof _0x172594['offset']===_0xcce8('0x1d')&&typeof _0x172594[_0xcce8('0x1e')]===_0xcce8('0x1d');var _0x583510=_0x202d59['count'];var _0x200346=_0x3ac641?0x0:_0x172594[_0xcce8('0x1f')];var _0xc47de8=_0x3ac641?_0x202d59[_0xcce8('0x20')]:_0x172594['offset']+_0x172594[_0xcce8('0x1e')];var _0x8434bd;if(_0xc47de8>=_0x583510){_0xc47de8=_0x583510;_0x8434bd=0xc8;}else{_0x8434bd=0xce;}_0x41f334[_0xcce8('0x1c')](_0x8434bd);return _0x41f334[_0xcce8('0x21')](_0xcce8('0x22'),_0x200346+'-'+_0xc47de8+'/'+_0x583510)[_0xcce8('0x23')](_0x202d59);}return null;};}function patchUpdates(_0x95a33){return function(_0x1c1507){try{jsonpatch[_0xcce8('0x24')](_0x1c1507,_0x95a33,!![]);}catch(_0x36bb93){return BPromise[_0xcce8('0x25')](_0x36bb93);}return _0x1c1507[_0xcce8('0x26')]();};}function saveUpdates(_0x10e0b4,_0x498072){return function(_0x2692cc){if(_0x2692cc){return _0x2692cc[_0xcce8('0x27')](_0x10e0b4)[_0xcce8('0x28')](function(_0x1187fa){return _0x1187fa;});}return null;};}function removeEntity(_0x1f94d8,_0x34e85b){return function(_0x44df11){if(_0x44df11){return _0x44df11[_0xcce8('0x29')]()['then'](function(){_0x1f94d8[_0xcce8('0x1c')](0xcc)[_0xcce8('0x2a')]();});}};}function handleEntityNotFound(_0x23023a,_0x16f630){return function(_0x4c9712){if(!_0x4c9712){_0x23023a[_0xcce8('0x1b')](0x194);}return _0x4c9712;};}function handleError(_0x54bb50,_0x2c7e58){_0x2c7e58=_0x2c7e58||0x1f4;return function(_0x4b335d){logger['error'](_0x4b335d[_0xcce8('0x2b')]);if(_0x4b335d[_0xcce8('0x2c')]){delete _0x4b335d[_0xcce8('0x2c')];}_0x54bb50[_0xcce8('0x1c')](_0x2c7e58)[_0xcce8('0x2d')](_0x4b335d);};}exports[_0xcce8('0x2e')]=function(_0x4b1174,_0x8d1ec6){var _0xef2128={},_0x33f3d5={},_0x51db65={'count':0x0,'rows':[]};var _0x419828=_[_0xcce8('0x2f')](db[_0xcce8('0x30')]['rawAttributes'],function(_0x2021cd){return{'name':_0x2021cd[_0xcce8('0x31')],'type':_0x2021cd['type'][_0xcce8('0x32')]};});_0x33f3d5[_0xcce8('0x33')]=_['map'](_0x419828,'name');_0x33f3d5[_0xcce8('0x34')]=_[_0xcce8('0x35')](_0x4b1174[_0xcce8('0x34')]);_0x33f3d5[_0xcce8('0x36')]=_[_0xcce8('0x37')](_0x33f3d5[_0xcce8('0x33')],_0x33f3d5[_0xcce8('0x34')]);_0xef2128[_0xcce8('0x38')]=_[_0xcce8('0x37')](_0x33f3d5[_0xcce8('0x33')],qs[_0xcce8('0x39')](_0x4b1174[_0xcce8('0x34')][_0xcce8('0x39')]));_0xef2128[_0xcce8('0x38')]=_0xef2128[_0xcce8('0x38')]['length']?_0xef2128[_0xcce8('0x38')]:_0x33f3d5[_0xcce8('0x33')];if(!_0x4b1174[_0xcce8('0x34')][_0xcce8('0x3a')](_0xcce8('0x3b'))){_0xef2128[_0xcce8('0x1e')]=qs[_0xcce8('0x1e')](_0x4b1174[_0xcce8('0x34')]['limit']);_0xef2128[_0xcce8('0x1f')]=qs[_0xcce8('0x1f')](_0x4b1174[_0xcce8('0x34')][_0xcce8('0x1f')]);}_0xef2128[_0xcce8('0x3c')]=qs[_0xcce8('0x3d')](_0x4b1174[_0xcce8('0x34')]['sort']);_0xef2128[_0xcce8('0x3e')]=qs[_0xcce8('0x36')](_[_0xcce8('0x3f')](_0x4b1174[_0xcce8('0x34')],_0x33f3d5[_0xcce8('0x36')]),_0x419828);if(_0x4b1174[_0xcce8('0x34')]['filter']){_0xef2128[_0xcce8('0x3e')]=_[_0xcce8('0x40')](_0xef2128['where'],{'$or':_[_0xcce8('0x2f')](_0x419828,function(_0x165191){if(_0x165191['type']!==_0xcce8('0x41')){var _0x595850={};_0x595850[_0x165191['name']]={'$like':'%'+_0x4b1174[_0xcce8('0x34')]['filter']+'%'};return _0x595850;}})});}_0xef2128=_[_0xcce8('0x40')]({},_0xef2128,_0x4b1174[_0xcce8('0x42')]);var _0x4d108f={'where':_0xef2128['where']};return db[_0xcce8('0x30')][_0xcce8('0x20')](_0x4d108f)['then'](function(_0x14fee9){_0x51db65[_0xcce8('0x20')]=_0x14fee9;if(_0x4b1174['query']['includeAll']){_0xef2128[_0xcce8('0x43')]=[{'all':!![]}];}return db[_0xcce8('0x30')][_0xcce8('0x44')](_0xef2128);})[_0xcce8('0x28')](function(_0x560117){_0x51db65['rows']=_0x560117;return _0x51db65;})['then'](respondWithFilteredResult(_0x8d1ec6,_0xef2128))[_0xcce8('0x45')](handleError(_0x8d1ec6,null));};exports[_0xcce8('0x46')]=function(_0x5869ac,_0x4446b1){var _0xad65f3={'raw':!![],'where':{'id':_0x5869ac['params']['id']}},_0x492a12={};_0x492a12[_0xcce8('0x33')]=_[_0xcce8('0x35')](db[_0xcce8('0x30')][_0xcce8('0x47')]);_0x492a12[_0xcce8('0x34')]=_[_0xcce8('0x35')](_0x5869ac['query']);_0x492a12[_0xcce8('0x36')]=_['intersection'](_0x492a12['model'],_0x492a12[_0xcce8('0x34')]);_0xad65f3[_0xcce8('0x38')]=_[_0xcce8('0x37')](_0x492a12[_0xcce8('0x33')],qs[_0xcce8('0x39')](_0x5869ac[_0xcce8('0x34')]['fields']));_0xad65f3[_0xcce8('0x38')]=_0xad65f3[_0xcce8('0x38')][_0xcce8('0x48')]?_0xad65f3['attributes']:_0x492a12[_0xcce8('0x33')];if(_0x5869ac[_0xcce8('0x34')][_0xcce8('0x49')]){_0xad65f3[_0xcce8('0x43')]=[{'all':!![]}];}_0xad65f3=_[_0xcce8('0x40')]({},_0xad65f3,_0x5869ac[_0xcce8('0x42')]);return db['CmHopperBlack'][_0xcce8('0x4a')](_0xad65f3)[_0xcce8('0x28')](handleEntityNotFound(_0x4446b1,null))['then'](respondWithResult(_0x4446b1,null))[_0xcce8('0x45')](handleError(_0x4446b1,null));};exports['update']=function(_0x4e1e8c,_0x174ad6){if(_0x4e1e8c[_0xcce8('0x4b')]['id']){delete _0x4e1e8c[_0xcce8('0x4b')]['id'];}return db['CmHopperBlack'][_0xcce8('0x4a')]({'where':{'id':_0x4e1e8c[_0xcce8('0x4c')]['id']}})['then'](handleEntityNotFound(_0x174ad6,null))[_0xcce8('0x28')](saveUpdates(_0x4e1e8c[_0xcce8('0x4b')],null))[_0xcce8('0x28')](respondWithResult(_0x174ad6,null))[_0xcce8('0x45')](handleError(_0x174ad6,null));};exports[_0xcce8('0x29')]=function(_0x4edda4,_0x355c89){return db[_0xcce8('0x30')][_0xcce8('0x4a')]({'where':{'id':_0x4edda4[_0xcce8('0x4c')]['id']}})['then'](handleEntityNotFound(_0x355c89,null))['then'](removeEntity(_0x355c89,null))['catch'](handleError(_0x355c89,null));};exports[_0xcce8('0x4d')]=function(_0x3349df,_0x2a8a9f){return db[_0xcce8('0x30')][_0xcce8('0x4d')]()[_0xcce8('0x28')](respondWithResult(_0x2a8a9f,null))[_0xcce8('0x45')](handleError(_0x2a8a9f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 5bbf64a..f9bf74a 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 _0x7007=['./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','lodash','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x3f59b1,_0x17b9ad){var _0x23f9f2=function(_0x40eaaa){while(--_0x40eaaa){_0x3f59b1['push'](_0x3f59b1['shift']());}};_0x23f9f2(++_0x17b9ad);}(_0x7007,0x11c));var _0x7700=function(_0x3ab684,_0x4c2c16){_0x3ab684=_0x3ab684-0x0;var _0x57c6e0=_0x7007[_0x3ab684];return _0x57c6e0;};'use strict';var _=require(_0x7700('0x0'));var util=require('util');var logger=require(_0x7700('0x1'))('api');var moment=require(_0x7700('0x2'));var BPromise=require(_0x7700('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7700('0x4'));var rimraf=require('rimraf');var config=require(_0x7700('0x5'));var attributes=require(_0x7700('0x6'));module['exports']=function(_0x1360c6,_0x278520){return _0x1360c6[_0x7700('0x7')](_0x7700('0x8'),attributes,{'tableName':_0x7700('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ce3=['cm_hopper_black','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack'];(function(_0x4ed32d,_0x327695){var _0xf624df=function(_0x29518c){while(--_0x29518c){_0x4ed32d['push'](_0x4ed32d['shift']());}};_0xf624df(++_0x327695);}(_0x8ce3,0x71));var _0x38ce=function(_0x32fc16,_0x26b884){_0x32fc16=_0x32fc16-0x0;var _0x262a81=_0x8ce3[_0x32fc16];return _0x262a81;};'use strict';var _=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var logger=require(_0x38ce('0x2'))(_0x38ce('0x3'));var moment=require('moment');var BPromise=require(_0x38ce('0x4'));var rp=require(_0x38ce('0x5'));var fs=require('fs');var path=require(_0x38ce('0x6'));var rimraf=require(_0x38ce('0x7'));var config=require(_0x38ce('0x8'));var attributes=require(_0x38ce('0x9'));module[_0x38ce('0xa')]=function(_0x2d7a11,_0x3308b6){return _0x2d7a11[_0x38ce('0xb')](_0x38ce('0xc'),attributes,{'tableName':_0x38ce('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 f56fad6..a85cb5e 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 _0xf100=['catch','UpdateCmHopperBlack','CmHopperBlack','update','body','raw','stringify','DestroyCmHopperBlack','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','result','GetCmHopperBlack','findAll','options','where','attributes','include','map','model','then','debug'];(function(_0x5ea82f,_0x41ef96){var _0x2f38b6=function(_0x5b084e){while(--_0x5b084e){_0x5ea82f['push'](_0x5ea82f['shift']());}};_0x2f38b6(++_0x41ef96);}(_0xf100,0xf2));var _0x0f10=function(_0x507074,_0x21f900){_0x507074=_0x507074-0x0;var _0x1e987e=_0xf100[_0x507074];return _0x1e987e;};'use strict';var _=require(_0x0f10('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0f10('0x1'));var rs=require(_0x0f10('0x2'));var fs=require('fs');var Redis=require(_0x0f10('0x3'));var db=require(_0x0f10('0x4'))['db'];var utils=require(_0x0f10('0x5'));var logger=require(_0x0f10('0x6'))(_0x0f10('0x7'));var config=require(_0x0f10('0x8'));var jayson=require(_0x0f10('0x9'));var client=jayson[_0x0f10('0xa')][_0x0f10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16957a,_0x96a851,_0x2d0393){return new BPromise(function(_0x3de1af,_0x1c6695){return client[_0x0f10('0xc')](_0x16957a,_0x2d0393)['then'](function(_0x3d0253){logger[_0x0f10('0xd')](_0x0f10('0xe'),_0x96a851,_0x0f10('0xf'));logger['debug'](_0x0f10('0x10'),_0x96a851,'request\x20sent',JSON['stringify'](_0x3d0253));if(_0x3d0253[_0x0f10('0x11')]){if(_0x3d0253[_0x0f10('0x11')][_0x0f10('0x12')]===0x1f4){logger[_0x0f10('0x11')](_0x0f10('0xe'),_0x96a851,_0x3d0253[_0x0f10('0x11')][_0x0f10('0x13')]);return _0x1c6695(_0x3d0253[_0x0f10('0x11')][_0x0f10('0x13')]);}logger[_0x0f10('0x11')](_0x0f10('0xe'),_0x96a851,_0x3d0253['error'][_0x0f10('0x13')]);return _0x3de1af(_0x3d0253[_0x0f10('0x11')]['message']);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x96a851,_0x0f10('0xf'));_0x3de1af(_0x3d0253[_0x0f10('0x14')][_0x0f10('0x13')]);}})['catch'](function(_0x4fa1d6){logger['error'](_0x0f10('0xe'),_0x96a851,_0x4fa1d6);_0x1c6695(_0x4fa1d6);});});}exports[_0x0f10('0x15')]=function(_0x4730ca){var _0xc1aff9=this;return new Promise(function(_0x55ff0c,_0x2eb0c2){return db['CmHopperBlack'][_0x0f10('0x16')]({'raw':_0x4730ca[_0x0f10('0x17')]?_0x4730ca['options']['raw']===undefined?!![]:![]:!![],'where':_0x4730ca['options']?_0x4730ca['options'][_0x0f10('0x18')]||null:null,'attributes':_0x4730ca['options']?_0x4730ca[_0x0f10('0x17')][_0x0f10('0x19')]||null:null,'limit':_0x4730ca[_0x0f10('0x17')]?_0x4730ca[_0x0f10('0x17')]['limit']||null:null,'include':_0x4730ca[_0x0f10('0x17')]?_0x4730ca[_0x0f10('0x17')][_0x0f10('0x1a')]?_[_0x0f10('0x1b')](_0x4730ca[_0x0f10('0x17')]['include'],function(_0x4ca15c){return{'model':db[_0x4ca15c[_0x0f10('0x1c')]],'as':_0x4ca15c['as'],'attributes':_0x4ca15c[_0x0f10('0x19')],'include':_0x4ca15c[_0x0f10('0x1a')]?_[_0x0f10('0x1b')](_0x4ca15c['include'],function(_0x343db1){return{'model':db[_0x343db1[_0x0f10('0x1c')]],'as':_0x343db1['as'],'attributes':_0x343db1[_0x0f10('0x19')],'include':_0x343db1['include']?_['map'](_0x343db1['include'],function(_0x501033){return{'model':db[_0x501033[_0x0f10('0x1c')]],'as':_0x501033['as'],'attributes':_0x501033[_0x0f10('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0f10('0x1d')](function(_0x4ebb73){logger[_0x0f10('0xd')]('GetCmHopperBlack',_0x4730ca);logger[_0x0f10('0x1e')](_0x0f10('0x15'),_0x4730ca,JSON['stringify'](_0x4ebb73));_0x55ff0c(_0x4ebb73);})[_0x0f10('0x1f')](function(_0x5cb02){logger['error'](_0x0f10('0x15'),_0x5cb02[_0x0f10('0x13')],_0x4730ca);_0x2eb0c2(_0xc1aff9['error'](0x1f4,_0x5cb02[_0x0f10('0x13')]));});});};exports[_0x0f10('0x20')]=function(_0x58a540){var _0x57ab4b=this;return new Promise(function(_0x23aa5e,_0x479cff){return db[_0x0f10('0x21')][_0x0f10('0x22')](_0x58a540[_0x0f10('0x23')],{'raw':_0x58a540[_0x0f10('0x17')]?_0x58a540[_0x0f10('0x17')][_0x0f10('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58a540[_0x0f10('0x17')]?_0x58a540[_0x0f10('0x17')][_0x0f10('0x18')]||null:null,'attributes':_0x58a540[_0x0f10('0x17')]?_0x58a540[_0x0f10('0x17')][_0x0f10('0x19')]||null:null,'limit':_0x58a540['options']?_0x58a540[_0x0f10('0x17')]['limit']||null:null})[_0x0f10('0x1d')](function(_0x11e818){logger['info']('UpdateCmHopperBlack',_0x58a540);logger[_0x0f10('0x1e')](_0x0f10('0x20'),_0x58a540,JSON[_0x0f10('0x25')](_0x11e818));_0x23aa5e(_0x11e818);})[_0x0f10('0x1f')](function(_0x568390){logger[_0x0f10('0x11')](_0x0f10('0x20'),_0x568390[_0x0f10('0x13')],_0x58a540);_0x479cff(_0x57ab4b[_0x0f10('0x11')](0x1f4,_0x568390['message']));});});};exports['DestroyCmHopperBlack']=function(_0x14fb90){var _0x58df18=this;return new Promise(function(_0x489d66,_0xcf7234){return db[_0x0f10('0x21')]['destroy']({'where':_0x14fb90[_0x0f10('0x17')]?_0x14fb90['options']['where']||null:null})['then'](function(_0x553174){logger[_0x0f10('0xd')](_0x0f10('0x26'),_0x14fb90);logger[_0x0f10('0x1e')](_0x0f10('0x26'),_0x14fb90,JSON[_0x0f10('0x25')](_0x553174));_0x489d66(_0x553174);})[_0x0f10('0x1f')](function(_0x2ba4b1){logger[_0x0f10('0x11')](_0x0f10('0x26'),_0x2ba4b1['message'],_0x14fb90);_0xcf7234(_0x58df18['error'](0x1f4,_0x2ba4b1[_0x0f10('0x13')]));});});}; \ No newline at end of file +var _0x1ed9=['stringify','error','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','update','DestroyCmHopperBlack','destroy','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5902a5,_0x210aef){var _0x1f3354=function(_0x48b470){while(--_0x48b470){_0x5902a5['push'](_0x5902a5['shift']());}};_0x1f3354(++_0x210aef);}(_0x1ed9,0x117));var _0x91ed=function(_0x30b1bc,_0x3c2337){_0x30b1bc=_0x30b1bc-0x0;var _0x3e4cb3=_0x1ed9[_0x30b1bc];return _0x3e4cb3;};'use strict';var _=require('lodash');var util=require(_0x91ed('0x0'));var moment=require('moment');var BPromise=require(_0x91ed('0x1'));var rs=require(_0x91ed('0x2'));var fs=require('fs');var Redis=require(_0x91ed('0x3'));var db=require(_0x91ed('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x91ed('0x5'))(_0x91ed('0x6'));var config=require(_0x91ed('0x7'));var jayson=require(_0x91ed('0x8'));var client=jayson[_0x91ed('0x9')][_0x91ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x474641,_0x303ee7,_0x3a661d){return new BPromise(function(_0x193170,_0x52c4ff){return client[_0x91ed('0xb')](_0x474641,_0x3a661d)[_0x91ed('0xc')](function(_0x43f22c){logger[_0x91ed('0xd')](_0x91ed('0xe'),_0x303ee7,_0x91ed('0xf'));logger[_0x91ed('0x10')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x303ee7,_0x91ed('0xf'),JSON[_0x91ed('0x11')](_0x43f22c));if(_0x43f22c[_0x91ed('0x12')]){if(_0x43f22c[_0x91ed('0x12')]['code']===0x1f4){logger['error'](_0x91ed('0xe'),_0x303ee7,_0x43f22c[_0x91ed('0x12')]['message']);return _0x52c4ff(_0x43f22c[_0x91ed('0x12')]['message']);}logger['error'](_0x91ed('0xe'),_0x303ee7,_0x43f22c['error'][_0x91ed('0x13')]);return _0x193170(_0x43f22c['error'][_0x91ed('0x13')]);}else{logger[_0x91ed('0xd')](_0x91ed('0xe'),_0x303ee7,_0x91ed('0xf'));_0x193170(_0x43f22c[_0x91ed('0x14')][_0x91ed('0x13')]);}})[_0x91ed('0x15')](function(_0x10e8f3){logger[_0x91ed('0x12')](_0x91ed('0xe'),_0x303ee7,_0x10e8f3);_0x52c4ff(_0x10e8f3);});});}exports[_0x91ed('0x16')]=function(_0x37dd30){var _0x3ed43e=this;return new Promise(function(_0x59fc88,_0x596c4c){return db[_0x91ed('0x17')][_0x91ed('0x18')]({'raw':_0x37dd30['options']?_0x37dd30[_0x91ed('0x19')][_0x91ed('0x1a')]===undefined?!![]:![]:!![],'where':_0x37dd30[_0x91ed('0x19')]?_0x37dd30['options'][_0x91ed('0x1b')]||null:null,'attributes':_0x37dd30['options']?_0x37dd30['options'][_0x91ed('0x1c')]||null:null,'limit':_0x37dd30['options']?_0x37dd30['options'][_0x91ed('0x1d')]||null:null,'include':_0x37dd30[_0x91ed('0x19')]?_0x37dd30[_0x91ed('0x19')][_0x91ed('0x1e')]?_[_0x91ed('0x1f')](_0x37dd30[_0x91ed('0x19')][_0x91ed('0x1e')],function(_0x281929){return{'model':db[_0x281929[_0x91ed('0x20')]],'as':_0x281929['as'],'attributes':_0x281929[_0x91ed('0x1c')],'include':_0x281929[_0x91ed('0x1e')]?_['map'](_0x281929['include'],function(_0x3cd571){return{'model':db[_0x3cd571[_0x91ed('0x20')]],'as':_0x3cd571['as'],'attributes':_0x3cd571[_0x91ed('0x1c')],'include':_0x3cd571[_0x91ed('0x1e')]?_[_0x91ed('0x1f')](_0x3cd571[_0x91ed('0x1e')],function(_0x12e805){return{'model':db[_0x12e805[_0x91ed('0x20')]],'as':_0x12e805['as'],'attributes':_0x12e805[_0x91ed('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a65a2){logger[_0x91ed('0xd')](_0x91ed('0x16'),_0x37dd30);logger['debug'](_0x91ed('0x16'),_0x37dd30,JSON[_0x91ed('0x11')](_0x3a65a2));_0x59fc88(_0x3a65a2);})[_0x91ed('0x15')](function(_0x2640a1){logger['error'](_0x91ed('0x16'),_0x2640a1['message'],_0x37dd30);_0x596c4c(_0x3ed43e[_0x91ed('0x12')](0x1f4,_0x2640a1[_0x91ed('0x13')]));});});};exports[_0x91ed('0x21')]=function(_0x32863a){var _0xc8ff16=this;return new Promise(function(_0x10019c,_0x57cbd2){return db[_0x91ed('0x17')][_0x91ed('0x22')](_0x32863a['body'],{'raw':_0x32863a['options']?_0x32863a[_0x91ed('0x19')][_0x91ed('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32863a[_0x91ed('0x19')]?_0x32863a['options']['where']||null:null,'attributes':_0x32863a['options']?_0x32863a['options']['attributes']||null:null,'limit':_0x32863a[_0x91ed('0x19')]?_0x32863a[_0x91ed('0x19')][_0x91ed('0x1d')]||null:null})[_0x91ed('0xc')](function(_0x26c7ac){logger[_0x91ed('0xd')](_0x91ed('0x21'),_0x32863a);logger[_0x91ed('0x10')](_0x91ed('0x21'),_0x32863a,JSON[_0x91ed('0x11')](_0x26c7ac));_0x10019c(_0x26c7ac);})['catch'](function(_0x5e7d6f){logger[_0x91ed('0x12')](_0x91ed('0x21'),_0x5e7d6f[_0x91ed('0x13')],_0x32863a);_0x57cbd2(_0xc8ff16[_0x91ed('0x12')](0x1f4,_0x5e7d6f[_0x91ed('0x13')]));});});};exports[_0x91ed('0x23')]=function(_0x40a9a0){var _0x3a043d=this;return new Promise(function(_0x44f50a,_0x53bdfd){return db[_0x91ed('0x17')][_0x91ed('0x24')]({'where':_0x40a9a0['options']?_0x40a9a0[_0x91ed('0x19')]['where']||null:null})['then'](function(_0x25e50a){logger[_0x91ed('0xd')](_0x91ed('0x23'),_0x40a9a0);logger[_0x91ed('0x10')](_0x91ed('0x23'),_0x40a9a0,JSON[_0x91ed('0x11')](_0x25e50a));_0x44f50a(_0x25e50a);})[_0x91ed('0x15')](function(_0x4007a9){logger[_0x91ed('0x12')](_0x91ed('0x23'),_0x4007a9['message'],_0x40a9a0);_0x53bdfd(_0x3a043d['error'](0x1f4,_0x4007a9['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 8c715cc..37d7ccf 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 _0x32f4=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','show','put','/:id','delete','exports'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x32f4,0x154));var _0x432f=function(_0x23b80e,_0x1ee9c4){_0x23b80e=_0x23b80e-0x0;var _0x47eb03=_0x32f4[_0x23b80e];return _0x47eb03;};'use strict';var multer=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var path=require(_0x432f('0x2'));var timeout=require(_0x432f('0x3'));var express=require('express');var router=express[_0x432f('0x4')]();var fs_extra=require(_0x432f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var controller=require(_0x432f('0x8'));router[_0x432f('0x9')]('/',auth[_0x432f('0xa')](),controller['index']);router['get'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['describe']);router[_0x432f('0x9')]('/:id',auth[_0x432f('0xa')](),controller[_0x432f('0xc')]);router[_0x432f('0xd')](_0x432f('0xe'),auth[_0x432f('0xa')](),controller['update']);router[_0x432f('0xf')]('/:id',auth[_0x432f('0xa')](),controller['destroy']);module[_0x432f('0x10')]=router; \ No newline at end of file +var _0xbd51=['/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','put'];(function(_0x4d180c,_0x45c68e){var _0x49b57e=function(_0x264741){while(--_0x264741){_0x4d180c['push'](_0x4d180c['shift']());}};_0x49b57e(++_0x45c68e);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x1cf99a,_0x374baf){_0x1cf99a=_0x1cf99a-0x0;var _0x11c6e5=_0xbd51[_0x1cf99a];return _0x11c6e5;};'use strict';var multer=require(_0x1bd5('0x0'));var util=require('util');var path=require(_0x1bd5('0x1'));var timeout=require(_0x1bd5('0x2'));var express=require(_0x1bd5('0x3'));var router=express[_0x1bd5('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(_0x1bd5('0x5'));router[_0x1bd5('0x6')]('/',auth[_0x1bd5('0x7')](),controller['index']);router[_0x1bd5('0x6')](_0x1bd5('0x8'),auth[_0x1bd5('0x7')](),controller[_0x1bd5('0x9')]);router[_0x1bd5('0x6')]('/:id',auth[_0x1bd5('0x7')](),controller['show']);router[_0x1bd5('0xa')](_0x1bd5('0xb'),auth[_0x1bd5('0x7')](),controller[_0x1bd5('0xc')]);router[_0x1bd5('0xd')](_0x1bd5('0xb'),auth['isAuthenticated'](),controller[_0x1bd5('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index a98029d..1676cfe 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 _0x0fc2=['endtime','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','STRING','INTEGER','DATE','getDataValue'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x0fc2,0xa1));var _0x20fc=function(_0x3171fa,_0x2e87c2){_0x3171fa=_0x3171fa-0x0;var _0x536589=_0x0fc2[_0x3171fa];return _0x536589;};'use strict';var Sequelize=require(_0x20fc('0x0'));var moment=require(_0x20fc('0x1'));module[_0x20fc('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x20fc('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x20fc('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x20fc('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x20fc('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x20fc('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x20fc('0x3')]},'originatecalleridname':{'type':Sequelize[_0x20fc('0x3')]},'calleridnum':{'type':Sequelize[_0x20fc('0x3')]},'calleridname':{'type':Sequelize[_0x20fc('0x3')]},'starttime':{'type':Sequelize[_0x20fc('0x5')]},'responsetime':{'type':Sequelize[_0x20fc('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x20fc('0x5')]},'ringtime':{'type':Sequelize[_0x20fc('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x20fc('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x20fc('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x20fc('0x3')]},'membername':{'type':Sequelize[_0x20fc('0x3')]},'reason':{'type':Sequelize[_0x20fc('0x3')]},'disposition':{'type':Sequelize[_0x20fc('0x3')]},'secondDisposition':{'type':Sequelize[_0x20fc('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x20fc('0x5')],'set':function(_0x32d12e){var _0x3c01f9=this[_0x20fc('0x6')](_0x20fc('0x7'));if(_0x3c01f9&&_0x32d12e){this['setDataValue'](_0x20fc('0x8'),moment(_0x32d12e)[_0x20fc('0x9')](moment(_0x3c01f9),_0x20fc('0xa')));}}},'amd':{'type':Sequelize[_0x20fc('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x20fc('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x20fc('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x20fc('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x20fc('0x5')]},'callback':{'type':Sequelize[_0x20fc('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x20fc('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x20fc('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x20fc('0x5')]},'recallme':{'type':Sequelize[_0x20fc('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x20fc('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x20fc('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x20fc('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x20fc('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x20fc('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1fd1=['seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue'];(function(_0x2db3aa,_0x35e716){var _0x137b1e=function(_0x16ac07){while(--_0x16ac07){_0x2db3aa['push'](_0x2db3aa['shift']());}};_0x137b1e(++_0x35e716);}(_0x1fd1,0xe9));var _0x11fd=function(_0x24c032,_0x39e6e5){_0x24c032=_0x24c032-0x0;var _0x29b3df=_0x1fd1[_0x24c032];return _0x29b3df;};'use strict';var Sequelize=require(_0x11fd('0x0'));var moment=require(_0x11fd('0x1'));module[_0x11fd('0x2')]={'state':{'type':Sequelize[_0x11fd('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x11fd('0x4')]},'scheduledat':{'type':Sequelize[_0x11fd('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x11fd('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x11fd('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x11fd('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x11fd('0x4')]},'originatecalleridname':{'type':Sequelize[_0x11fd('0x4')]},'calleridnum':{'type':Sequelize[_0x11fd('0x4')]},'calleridname':{'type':Sequelize[_0x11fd('0x4')]},'starttime':{'type':Sequelize[_0x11fd('0x5')]},'responsetime':{'type':Sequelize[_0x11fd('0x5')]},'answertime':{'type':Sequelize[_0x11fd('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x11fd('0x5')]},'ringtime':{'type':Sequelize[_0x11fd('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x11fd('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x11fd('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x11fd('0x4')]},'campaign':{'type':Sequelize[_0x11fd('0x4')]},'campaigntype':{'type':Sequelize[_0x11fd('0x4')]},'membername':{'type':Sequelize[_0x11fd('0x4')]},'reason':{'type':Sequelize[_0x11fd('0x4')]},'disposition':{'type':Sequelize[_0x11fd('0x4')]},'secondDisposition':{'type':Sequelize[_0x11fd('0x4')]},'thirdDisposition':{'type':Sequelize[_0x11fd('0x4')]},'dispositionat':{'type':Sequelize[_0x11fd('0x5')],'set':function(_0x16a748){var _0x5181af=this[_0x11fd('0x6')](_0x11fd('0x7'));if(_0x5181af&&_0x16a748){this[_0x11fd('0x8')]('followuptime',moment(_0x16a748)['diff'](moment(_0x5181af),_0x11fd('0x9')));}}},'amd':{'type':Sequelize[_0x11fd('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x11fd('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x11fd('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x11fd('0x5')]},'callback':{'type':Sequelize[_0x11fd('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x11fd('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x11fd('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x11fd('0x5')]},'recallme':{'type':Sequelize[_0x11fd('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x11fd('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x11fd('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x11fd('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x11fd('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x11fd('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x11fd('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 5d46544..00bb646 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 _0x33af=['end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','length','include','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','noAnswerContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','createdAt','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','fromQuery','CampaignId','ANY_VALUE(ListId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x83bc56,_0x4f4d32){var _0x253b33=function(_0x3aadbf){while(--_0x3aadbf){_0x83bc56['push'](_0x83bc56['shift']());}};_0x253b33(++_0x4f4d32);}(_0x33af,0xec));var _0xf33a=function(_0x5d245c,_0x858414){_0x5d245c=_0x5d245c-0x0;var _0x2cfacd=_0x33af[_0x5d245c];return _0x2cfacd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf33a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf33a('0x1'));var rp=require(_0xf33a('0x2'));var moment=require(_0xf33a('0x3'));var BPromise=require(_0xf33a('0x4'));var Mustache=require(_0xf33a('0x5'));var util=require(_0xf33a('0x6'));var path=require('path');var sox=require(_0xf33a('0x7'));var csv=require(_0xf33a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf33a('0x9'));var _=require(_0xf33a('0xa'));var squel=require(_0xf33a('0xb'));var crypto=require(_0xf33a('0xc'));var jsforce=require(_0xf33a('0xd'));var deskjs=require(_0xf33a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf33a('0xf'));var Papa=require(_0xf33a('0x10'));var Redis=require(_0xf33a('0x11'));var authService=require(_0xf33a('0x12'));var qs=require(_0xf33a('0x13'));var as=require(_0xf33a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf33a('0x15'));var utils=require(_0xf33a('0x16'));var config=require(_0xf33a('0x17'));var licenseUtil=require(_0xf33a('0x18'));var db=require(_0xf33a('0x19'))['db'];function respondWithStatusCode(_0x5959c9,_0x9f87bc){_0x9f87bc=_0x9f87bc||0xcc;return function(_0x21b80e){if(_0x21b80e){return _0x5959c9['sendStatus'](_0x9f87bc);}return _0x5959c9['status'](_0x9f87bc)[_0xf33a('0x1a')]();};}function respondWithResult(_0x1b3bf0,_0x17043){_0x17043=_0x17043||0xc8;return function(_0x153bda){if(_0x153bda){return _0x1b3bf0[_0xf33a('0x1b')](_0x17043)[_0xf33a('0x1c')](_0x153bda);}};}function respondWithFilteredResult(_0x45e311,_0x1f2b1b){return function(_0x507cb9){if(_0x507cb9){var _0x441f59=typeof _0x1f2b1b['offset']===_0xf33a('0x1d')&&typeof _0x1f2b1b[_0xf33a('0x1e')]==='undefined';var _0x37e76c=_0x507cb9[_0xf33a('0x1f')];var _0x524109=_0x441f59?0x0:_0x1f2b1b[_0xf33a('0x20')];var _0x23d9e2=_0x441f59?_0x507cb9[_0xf33a('0x1f')]:_0x1f2b1b[_0xf33a('0x20')]+_0x1f2b1b['limit'];var _0x11efa0;if(_0x23d9e2>=_0x37e76c){_0x23d9e2=_0x37e76c;_0x11efa0=0xc8;}else{_0x11efa0=0xce;}_0x45e311[_0xf33a('0x1b')](_0x11efa0);return _0x45e311[_0xf33a('0x21')](_0xf33a('0x22'),_0x524109+'-'+_0x23d9e2+'/'+_0x37e76c)[_0xf33a('0x1c')](_0x507cb9);}return null;};}function patchUpdates(_0x6cdf7b){return function(_0x19986f){try{jsonpatch[_0xf33a('0x23')](_0x19986f,_0x6cdf7b,!![]);}catch(_0x19055e){return BPromise[_0xf33a('0x24')](_0x19055e);}return _0x19986f['save']();};}function saveUpdates(_0x3854b4,_0x272e60){return function(_0x1bf9bc){if(_0x1bf9bc){return _0x1bf9bc[_0xf33a('0x25')](_0x3854b4)[_0xf33a('0x26')](function(_0x51d3fd){return _0x51d3fd;});}return null;};}function removeEntity(_0x44654c,_0x5882ba){return function(_0x492986){if(_0x492986){return _0x492986[_0xf33a('0x27')]()[_0xf33a('0x26')](function(){_0x44654c[_0xf33a('0x1b')](0xcc)[_0xf33a('0x1a')]();});}};}function handleEntityNotFound(_0x4b9801,_0x57cb1d){return function(_0x393005){if(!_0x393005){_0x4b9801['sendStatus'](0x194);}return _0x393005;};}function handleError(_0x4af24a,_0x16ef31){_0x16ef31=_0x16ef31||0x1f4;return function(_0x5f0a53){logger['error'](_0x5f0a53[_0xf33a('0x28')]);if(_0x5f0a53['name']){delete _0x5f0a53[_0xf33a('0x29')];}_0x4af24a['status'](_0x16ef31)[_0xf33a('0x2a')](_0x5f0a53);};}exports[_0xf33a('0x2b')]=function(_0x469741,_0x729fca){var _0x4552c9={},_0x3068a9={},_0x1d19ee={'count':0x0,'rows':[]};var _0x1246ff=_[_0xf33a('0x2c')](db[_0xf33a('0x2d')][_0xf33a('0x2e')],function(_0x8f8ddc){return{'name':_0x8f8ddc[_0xf33a('0x2f')],'type':_0x8f8ddc[_0xf33a('0x30')][_0xf33a('0x31')]};});_0x3068a9['model']=_[_0xf33a('0x2c')](_0x1246ff,_0xf33a('0x29'));_0x3068a9[_0xf33a('0x32')]=_[_0xf33a('0x33')](_0x469741['query']);_0x3068a9[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x3068a9[_0xf33a('0x36')],_0x3068a9[_0xf33a('0x32')]);_0x4552c9[_0xf33a('0x37')]=_[_0xf33a('0x35')](_0x3068a9['model'],qs[_0xf33a('0x38')](_0x469741[_0xf33a('0x32')][_0xf33a('0x38')]));_0x4552c9[_0xf33a('0x37')]=_0x4552c9[_0xf33a('0x37')]['length']?_0x4552c9['attributes']:_0x3068a9[_0xf33a('0x36')];if(!_0x469741['query']['hasOwnProperty']('nolimit')){_0x4552c9[_0xf33a('0x1e')]=qs[_0xf33a('0x1e')](_0x469741['query'][_0xf33a('0x1e')]);_0x4552c9['offset']=qs[_0xf33a('0x20')](_0x469741[_0xf33a('0x32')][_0xf33a('0x20')]);}_0x4552c9[_0xf33a('0x39')]=qs[_0xf33a('0x3a')](_0x469741[_0xf33a('0x32')]['sort']);_0x4552c9[_0xf33a('0x3b')]=qs[_0xf33a('0x34')](_['pick'](_0x469741[_0xf33a('0x32')],_0x3068a9[_0xf33a('0x34')]),_0x1246ff);if(_0x469741[_0xf33a('0x32')]['filter']){_0x4552c9[_0xf33a('0x3b')]=_[_0xf33a('0x3c')](_0x4552c9[_0xf33a('0x3b')],{'$or':_[_0xf33a('0x2c')](_0x1246ff,function(_0x3ec562){if(_0x3ec562[_0xf33a('0x30')]!==_0xf33a('0x3d')){var _0x128baf={};_0x128baf[_0x3ec562[_0xf33a('0x29')]]={'$like':'%'+_0x469741['query'][_0xf33a('0x3e')]+'%'};return _0x128baf;}})});}_0x4552c9=_[_0xf33a('0x3c')]({},_0x4552c9,_0x469741['options']);var _0x1e8800={'where':_0x4552c9['where']};return db['CmHopperFinal'][_0xf33a('0x1f')](_0x1e8800)[_0xf33a('0x26')](function(_0x4dada1){_0x1d19ee[_0xf33a('0x1f')]=_0x4dada1;if(_0x469741[_0xf33a('0x32')][_0xf33a('0x3f')]){_0x4552c9['include']=[{'all':!![]}];}return db[_0xf33a('0x2d')][_0xf33a('0x40')](_0x4552c9);})['then'](function(_0x1e9748){_0x1d19ee[_0xf33a('0x41')]=_0x1e9748;return _0x1d19ee;})[_0xf33a('0x26')](respondWithFilteredResult(_0x729fca,_0x4552c9))[_0xf33a('0x42')](handleError(_0x729fca,null));};exports[_0xf33a('0x43')]=function(_0x5044f9,_0x45ae15){var _0x1722e5={'raw':!![],'where':{'id':_0x5044f9[_0xf33a('0x44')]['id']}},_0x2325eb={};_0x2325eb[_0xf33a('0x36')]=_['keys'](db[_0xf33a('0x2d')][_0xf33a('0x2e')]);_0x2325eb[_0xf33a('0x32')]=_['keys'](_0x5044f9[_0xf33a('0x32')]);_0x2325eb[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x2325eb[_0xf33a('0x36')],_0x2325eb[_0xf33a('0x32')]);_0x1722e5[_0xf33a('0x37')]=_['intersection'](_0x2325eb[_0xf33a('0x36')],qs[_0xf33a('0x38')](_0x5044f9[_0xf33a('0x32')][_0xf33a('0x38')]));_0x1722e5[_0xf33a('0x37')]=_0x1722e5['attributes'][_0xf33a('0x45')]?_0x1722e5[_0xf33a('0x37')]:_0x2325eb[_0xf33a('0x36')];if(_0x5044f9['query'][_0xf33a('0x3f')]){_0x1722e5[_0xf33a('0x46')]=[{'all':!![]}];}_0x1722e5=_['merge']({},_0x1722e5,_0x5044f9['options']);return db[_0xf33a('0x2d')]['find'](_0x1722e5)[_0xf33a('0x26')](handleEntityNotFound(_0x45ae15,null))[_0xf33a('0x26')](respondWithResult(_0x45ae15,null))[_0xf33a('0x42')](handleError(_0x45ae15,null));};exports[_0xf33a('0x47')]=function(_0xecc82f,_0x1a98f9){return db[_0xf33a('0x2d')][_0xf33a('0x47')]()[_0xf33a('0x26')](respondWithResult(_0x1a98f9,null))[_0xf33a('0x42')](handleError(_0x1a98f9,null));};exports[_0xf33a('0x25')]=function(_0x4107b1,_0x190a2b){if(_0x4107b1[_0xf33a('0x48')][_0xf33a('0x49')]){delete _0x4107b1[_0xf33a('0x48')][_0xf33a('0x49')];}return db[_0xf33a('0x2d')][_0xf33a('0x4a')]({'where':{'uniqueid':_0x4107b1[_0xf33a('0x44')]['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x190a2b,null))[_0xf33a('0x26')](saveUpdates(_0x4107b1[_0xf33a('0x48')],null))[_0xf33a('0x26')](respondWithResult(_0x190a2b,null))[_0xf33a('0x42')](handleError(_0x190a2b,null));};exports[_0xf33a('0x4b')]=function(_0x3bab07,_0x1f7d8c,_0x57815c){return db['CmHopperFinal'][_0xf33a('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x3bab07[_0xf33a('0x44')]['id']},'attributes':[[db['sequelize']['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')]['literal'](_0xf33a('0x4e')))),_0xf33a('0x4f')],[db[_0xf33a('0x4d')]['fn']('COUNT',db[_0xf33a('0x4d')]['fn']('IF',db['sequelize'][_0xf33a('0x50')](_0xf33a('0x51')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')]['literal'](_0xf33a('0x52')))),_0xf33a('0x53')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0xf33a('0x54')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x55')))),'dropContacts'],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x56')))),_0xf33a('0x57')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x58')))),'answeringMachine']]})[_0xf33a('0x26')](handleEntityNotFound(_0x1f7d8c,null))[_0xf33a('0x26')](respondWithResult(_0x1f7d8c,null))[_0xf33a('0x42')](handleError(_0x1f7d8c,null));};exports[_0xf33a('0x59')]=function(_0x2f1fef,_0x129229,_0x473484){return db[_0xf33a('0x2d')][_0xf33a('0x40')]({'raw':![],'where':{'CampaignId':_0x2f1fef[_0xf33a('0x44')]['id']},'attributes':[[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xf33a('0x4f')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x51')))),_0xf33a('0x5a')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db['sequelize'][_0xf33a('0x50')](_0xf33a('0x52')))),_0xf33a('0x53')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x5b')))),'congestionContacts'],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x55')))),_0xf33a('0x5c')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x5d')))),_0xf33a('0x5e')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db['sequelize'][_0xf33a('0x50')](_0xf33a('0x56')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x58')))),_0xf33a('0x5f')]]})[_0xf33a('0x26')](handleEntityNotFound(_0x129229,null))[_0xf33a('0x26')](respondWithResult(_0x129229,null))[_0xf33a('0x42')](handleError(_0x129229,null));};exports[_0xf33a('0x60')]=function(_0x3bebca,_0x40bb02,_0x10a271){return db['VoiceQueue'][_0xf33a('0x4a')]({'where':{'id':_0x3bebca['params']['id']}})['then'](handleEntityNotFound(_0x40bb02,null))[_0xf33a('0x26')](function(_0x25cc49){var _0x132764;if(_0x25cc49){_0x132764=squel['insert']()['into'](_0xf33a('0x61'))['fromQuery']([_0xf33a('0x62'),_0xf33a('0x63'),_0xf33a('0x64'),_0xf33a('0x65'),_0xf33a('0x66'),'createdAt','updatedAt'],squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x69'),_0xf33a('0x62'))['field'](_0xf33a('0x6a'),_0xf33a('0x63'))['field'](_0xf33a('0x6b'),_0xf33a('0x64'))[_0xf33a('0x68')]('ANY_VALUE(ListId)',_0xf33a('0x65'))[_0xf33a('0x68')](_0xf33a('0x6c'),_0xf33a('0x66'))['field'](_0xf33a('0x6a'),_0xf33a('0x6d'))[_0xf33a('0x68')]('NOW()',_0xf33a('0x6e'))[_0xf33a('0x6f')](_0xf33a('0x70'))[_0xf33a('0x3b')](_0xf33a('0x71'),_0x3bebca[_0xf33a('0x44')]['id'][_0xf33a('0x72')]())[_0xf33a('0x3b')](_0xf33a('0x73'),_0x3bebca[_0xf33a('0x48')][_0xf33a('0x74')][_0xf33a('0x72')]())[_0xf33a('0x3b')](_0xf33a('0x75'))[_0xf33a('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x62'))[_0xf33a('0x6f')](_0xf33a('0x61'))[_0xf33a('0x3b')](_0xf33a('0x71'),_0x3bebca[_0xf33a('0x44')]['id'][_0xf33a('0x72')]()))[_0xf33a('0x3b')](_0xf33a('0x76'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x77'))['from'](_0xf33a('0x70'))[_0xf33a('0x3b')](_0xf33a('0x71'),_0x3bebca[_0xf33a('0x44')]['id']['toString']())[_0xf33a('0x3b')](_0xf33a('0x78')))[_0xf33a('0x79')](_0xf33a('0x64')))[_0xf33a('0x72')]();return db[_0xf33a('0x4d')][_0xf33a('0x32')](_0x132764);}return[];})[_0xf33a('0x26')](respondWithResult(_0x40bb02,null))['catch'](handleError(_0x40bb02,null));};exports[_0xf33a('0x7a')]=function(_0x1dfb59,_0x9c0b99,_0x17b2fa){return db['Campaign']['find']({'where':{'id':_0x1dfb59[_0xf33a('0x44')]['id']}})['then'](handleEntityNotFound(_0x9c0b99,null))[_0xf33a('0x26')](function(_0x1595b7){var _0x3d8dbe;if(_0x1595b7){_0x3d8dbe=squel[_0xf33a('0x7b')]()['into']('cm_hopper')[_0xf33a('0x7c')](['phone',_0xf33a('0x63'),_0xf33a('0x64'),_0xf33a('0x65'),_0xf33a('0x7d'),_0xf33a('0x6d'),_0xf33a('0x6e')],squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x69'),_0xf33a('0x62'))[_0xf33a('0x68')](_0xf33a('0x6a'),_0xf33a('0x63'))[_0xf33a('0x68')](_0xf33a('0x6b'),_0xf33a('0x64'))['field'](_0xf33a('0x7e'),'ListId')[_0xf33a('0x68')]('ANY_VALUE(CampaignId)','CampaignId')['field'](_0xf33a('0x6a'),_0xf33a('0x6d'))['field'](_0xf33a('0x6a'),_0xf33a('0x6e'))[_0xf33a('0x6f')](_0xf33a('0x70'))[_0xf33a('0x3b')](_0xf33a('0x7f'),_0x1dfb59['params']['id'][_0xf33a('0x72')]())[_0xf33a('0x3b')]('state\x20=\x20?',_0x1dfb59[_0xf33a('0x48')][_0xf33a('0x74')][_0xf33a('0x72')]())['where'](_0xf33a('0x75'))[_0xf33a('0x3b')](_0xf33a('0x76'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')]('phone')[_0xf33a('0x6f')](_0xf33a('0x61'))[_0xf33a('0x3b')](_0xf33a('0x7f'),_0x1dfb59[_0xf33a('0x44')]['id']['toString']()))[_0xf33a('0x3b')](_0xf33a('0x76'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x77'))['from'](_0xf33a('0x70'))['where']('CampaignId\x20=\x20?',_0x1dfb59[_0xf33a('0x44')]['id']['toString']())[_0xf33a('0x3b')](_0xf33a('0x78')))['group'](_0xf33a('0x64')))[_0xf33a('0x72')]();return db[_0xf33a('0x4d')][_0xf33a('0x32')](_0x3d8dbe);}return[];})[_0xf33a('0x26')](respondWithResult(_0x9c0b99,null))[_0xf33a('0x42')](handleError(_0x9c0b99,null));};exports[_0xf33a('0x80')]=function(_0x4abd84,_0x1205d1,_0x1d83a0){return db[_0xf33a('0x81')][_0xf33a('0x82')]({'where':{'VoiceQueueId':_0x4abd84['body'][_0xf33a('0x66')],'CampaignId':_0x4abd84['body'][_0xf33a('0x7d')],'ContactId':_0x4abd84[_0xf33a('0x48')][_0xf33a('0x64')]}})[_0xf33a('0x26')](handleEntityNotFound(_0x1205d1,null))[_0xf33a('0x26')](function(_0x49c40a){if(_0x49c40a){return _0x49c40a;}return null;})[_0xf33a('0x26')](respondWithResult(_0x1205d1,null))[_0xf33a('0x42')](handleError(_0x1205d1,null));}; \ No newline at end of file +var _0x4819=['send','map','CmHopperFinal','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','catch','show','keys','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','params','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name'];(function(_0x1d1fdf,_0x33ba5a){var _0x3521d6=function(_0x53281c){while(--_0x53281c){_0x1d1fdf['push'](_0x1d1fdf['shift']());}};_0x3521d6(++_0x33ba5a);}(_0x4819,0xcd));var _0x9481=function(_0x8be9fb,_0x2f90d9){_0x8be9fb=_0x8be9fb-0x0;var _0x3b41ac=_0x4819[_0x8be9fb];return _0x3b41ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];function respondWithStatusCode(_0xed8e9,_0x499b87){_0x499b87=_0x499b87||0xcc;return function(_0x5aac02){if(_0x5aac02){return _0xed8e9[_0x9481('0x1a')](_0x499b87);}return _0xed8e9[_0x9481('0x1b')](_0x499b87)[_0x9481('0x1c')]();};}function respondWithResult(_0x28fcb6,_0x3d23c2){_0x3d23c2=_0x3d23c2||0xc8;return function(_0xc7a0b5){if(_0xc7a0b5){return _0x28fcb6[_0x9481('0x1b')](_0x3d23c2)['json'](_0xc7a0b5);}};}function respondWithFilteredResult(_0x4220f1,_0x7a7ee){return function(_0x5b1fe6){if(_0x5b1fe6){var _0x2266d5=typeof _0x7a7ee['offset']===_0x9481('0x1d')&&typeof _0x7a7ee[_0x9481('0x1e')]===_0x9481('0x1d');var _0x2bb2a4=_0x5b1fe6['count'];var _0x5eda66=_0x2266d5?0x0:_0x7a7ee[_0x9481('0x1f')];var _0x50a559=_0x2266d5?_0x5b1fe6['count']:_0x7a7ee[_0x9481('0x1f')]+_0x7a7ee[_0x9481('0x1e')];var _0x18c6f5;if(_0x50a559>=_0x2bb2a4){_0x50a559=_0x2bb2a4;_0x18c6f5=0xc8;}else{_0x18c6f5=0xce;}_0x4220f1[_0x9481('0x1b')](_0x18c6f5);return _0x4220f1[_0x9481('0x20')](_0x9481('0x21'),_0x5eda66+'-'+_0x50a559+'/'+_0x2bb2a4)['json'](_0x5b1fe6);}return null;};}function patchUpdates(_0x2cf1aa){return function(_0x272a84){try{jsonpatch[_0x9481('0x22')](_0x272a84,_0x2cf1aa,!![]);}catch(_0x615e02){return BPromise[_0x9481('0x23')](_0x615e02);}return _0x272a84['save']();};}function saveUpdates(_0x215dd7,_0x294908){return function(_0x572599){if(_0x572599){return _0x572599[_0x9481('0x24')](_0x215dd7)[_0x9481('0x25')](function(_0x352b3a){return _0x352b3a;});}return null;};}function removeEntity(_0x1809d2,_0x2dc02e){return function(_0x49ecfa){if(_0x49ecfa){return _0x49ecfa[_0x9481('0x26')]()[_0x9481('0x25')](function(){_0x1809d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b0c3,_0x299e28){return function(_0x550fce){if(!_0x550fce){_0x12b0c3[_0x9481('0x1a')](0x194);}return _0x550fce;};}function handleError(_0x20ff9a,_0xeff0a5){_0xeff0a5=_0xeff0a5||0x1f4;return function(_0x28ae1b){logger['error'](_0x28ae1b[_0x9481('0x27')]);if(_0x28ae1b[_0x9481('0x28')]){delete _0x28ae1b[_0x9481('0x28')];}_0x20ff9a['status'](_0xeff0a5)[_0x9481('0x29')](_0x28ae1b);};}exports['index']=function(_0x2e1eff,_0xe153ab){var _0x22ab26={},_0x13ef93={},_0x2e5e63={'count':0x0,'rows':[]};var _0x53560d=_[_0x9481('0x2a')](db[_0x9481('0x2b')][_0x9481('0x2c')],function(_0x4895a0){return{'name':_0x4895a0['fieldName'],'type':_0x4895a0[_0x9481('0x2d')][_0x9481('0x2e')]};});_0x13ef93[_0x9481('0x2f')]=_[_0x9481('0x2a')](_0x53560d,'name');_0x13ef93['query']=_['keys'](_0x2e1eff[_0x9481('0x30')]);_0x13ef93['filters']=_[_0x9481('0x31')](_0x13ef93['model'],_0x13ef93[_0x9481('0x30')]);_0x22ab26[_0x9481('0x32')]=_[_0x9481('0x31')](_0x13ef93[_0x9481('0x2f')],qs[_0x9481('0x33')](_0x2e1eff['query'][_0x9481('0x33')]));_0x22ab26[_0x9481('0x32')]=_0x22ab26[_0x9481('0x32')]['length']?_0x22ab26[_0x9481('0x32')]:_0x13ef93[_0x9481('0x2f')];if(!_0x2e1eff[_0x9481('0x30')][_0x9481('0x34')](_0x9481('0x35'))){_0x22ab26[_0x9481('0x1e')]=qs['limit'](_0x2e1eff[_0x9481('0x30')]['limit']);_0x22ab26[_0x9481('0x1f')]=qs[_0x9481('0x1f')](_0x2e1eff[_0x9481('0x30')][_0x9481('0x1f')]);}_0x22ab26[_0x9481('0x36')]=qs[_0x9481('0x37')](_0x2e1eff['query'][_0x9481('0x37')]);_0x22ab26[_0x9481('0x38')]=qs['filters'](_['pick'](_0x2e1eff[_0x9481('0x30')],_0x13ef93['filters']),_0x53560d);if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]){_0x22ab26[_0x9481('0x38')]=_[_0x9481('0x3a')](_0x22ab26['where'],{'$or':_[_0x9481('0x2a')](_0x53560d,function(_0x590d50){if(_0x590d50[_0x9481('0x2d')]!=='VIRTUAL'){var _0x2ce972={};_0x2ce972[_0x590d50['name']]={'$like':'%'+_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]+'%'};return _0x2ce972;}})});}_0x22ab26=_[_0x9481('0x3a')]({},_0x22ab26,_0x2e1eff[_0x9481('0x3b')]);var _0x97dc3e={'where':_0x22ab26[_0x9481('0x38')]};return db[_0x9481('0x2b')]['count'](_0x97dc3e)[_0x9481('0x25')](function(_0x3857e8){_0x2e5e63[_0x9481('0x3c')]=_0x3857e8;if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x3d')]){_0x22ab26[_0x9481('0x3e')]=[{'all':!![]}];}return db[_0x9481('0x2b')]['findAll'](_0x22ab26);})[_0x9481('0x25')](function(_0x1872ff){_0x2e5e63['rows']=_0x1872ff;return _0x2e5e63;})[_0x9481('0x25')](respondWithFilteredResult(_0xe153ab,_0x22ab26))[_0x9481('0x3f')](handleError(_0xe153ab,null));};exports[_0x9481('0x40')]=function(_0x3eb9ee,_0x29a8e9){var _0x5a8ffd={'raw':!![],'where':{'id':_0x3eb9ee['params']['id']}},_0x304791={};_0x304791[_0x9481('0x2f')]=_[_0x9481('0x41')](db['CmHopperFinal']['rawAttributes']);_0x304791[_0x9481('0x30')]=_[_0x9481('0x41')](_0x3eb9ee[_0x9481('0x30')]);_0x304791['filters']=_[_0x9481('0x31')](_0x304791[_0x9481('0x2f')],_0x304791['query']);_0x5a8ffd['attributes']=_[_0x9481('0x31')](_0x304791['model'],qs[_0x9481('0x33')](_0x3eb9ee[_0x9481('0x30')][_0x9481('0x33')]));_0x5a8ffd[_0x9481('0x32')]=_0x5a8ffd[_0x9481('0x32')]['length']?_0x5a8ffd[_0x9481('0x32')]:_0x304791[_0x9481('0x2f')];if(_0x3eb9ee['query'][_0x9481('0x3d')]){_0x5a8ffd[_0x9481('0x3e')]=[{'all':!![]}];}_0x5a8ffd=_[_0x9481('0x3a')]({},_0x5a8ffd,_0x3eb9ee[_0x9481('0x3b')]);return db[_0x9481('0x2b')][_0x9481('0x42')](_0x5a8ffd)[_0x9481('0x25')](handleEntityNotFound(_0x29a8e9,null))[_0x9481('0x25')](respondWithResult(_0x29a8e9,null))[_0x9481('0x3f')](handleError(_0x29a8e9,null));};exports['describe']=function(_0xd36133,_0x5d3a06){return db['CmHopperFinal'][_0x9481('0x43')]()['then'](respondWithResult(_0x5d3a06,null))[_0x9481('0x3f')](handleError(_0x5d3a06,null));};exports[_0x9481('0x24')]=function(_0x47f8b2,_0x277e2a){if(_0x47f8b2[_0x9481('0x44')][_0x9481('0x45')]){delete _0x47f8b2[_0x9481('0x44')][_0x9481('0x45')];}return db[_0x9481('0x2b')]['find']({'where':{'uniqueid':_0x47f8b2['params']['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x277e2a,null))[_0x9481('0x25')](saveUpdates(_0x47f8b2[_0x9481('0x44')],null))[_0x9481('0x25')](respondWithResult(_0x277e2a,null))[_0x9481('0x3f')](handleError(_0x277e2a,null));};exports[_0x9481('0x46')]=function(_0x1c070c,_0x3d2250,_0x580273){return db[_0x9481('0x2b')][_0x9481('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x1c070c[_0x9481('0x48')]['id']},'attributes':[[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x9481('0x4b')](_0x9481('0x4c')))),_0x9481('0x4d')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')]['literal'](_0x9481('0x4e')))),_0x9481('0x4f')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x9481('0x50')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x51')))),_0x9481('0x52')],[db['sequelize']['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x53')))),_0x9481('0x54')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x9481('0x55')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x56')))),_0x9481('0x57')]]})[_0x9481('0x25')](handleEntityNotFound(_0x3d2250,null))['then'](respondWithResult(_0x3d2250,null))['catch'](handleError(_0x3d2250,null));};exports[_0x9481('0x58')]=function(_0x3cbab5,_0xb58b67,_0xe008db){return db[_0x9481('0x2b')][_0x9481('0x47')]({'raw':![],'where':{'CampaignId':_0x3cbab5['params']['id']},'attributes':[[db['sequelize']['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')]['literal'](_0x9481('0x4c')))),_0x9481('0x4d')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db['sequelize']['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x4e')))),'busyContacts'],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x9481('0x50')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x51')))),_0x9481('0x52')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x53')))),_0x9481('0x54')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),_0x9481('0x55')],[db['sequelize']['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x9481('0x57')]]})[_0x9481('0x25')](handleEntityNotFound(_0xb58b67,null))[_0x9481('0x25')](respondWithResult(_0xb58b67,null))[_0x9481('0x3f')](handleError(_0xb58b67,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0xa83176,_0x265f1c,_0x2a053a){return db[_0x9481('0x59')]['find']({'where':{'id':_0xa83176['params']['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x265f1c,null))[_0x9481('0x25')](function(_0x193992){var _0x380f2a;if(_0x193992){_0x380f2a=squel[_0x9481('0x5a')]()['into'](_0x9481('0x5b'))[_0x9481('0x5c')]([_0x9481('0x5d'),_0x9481('0x5e'),_0x9481('0x5f'),_0x9481('0x60'),_0x9481('0x61'),_0x9481('0x62'),_0x9481('0x63')],squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x66'),_0x9481('0x5d'))[_0x9481('0x65')](_0x9481('0x67'),'scheduledAt')[_0x9481('0x65')](_0x9481('0x68'),_0x9481('0x5f'))[_0x9481('0x65')](_0x9481('0x69'),_0x9481('0x60'))[_0x9481('0x65')]('ANY_VALUE(VoiceQueueId)',_0x9481('0x61'))[_0x9481('0x65')]('NOW()','createdAt')[_0x9481('0x65')]('NOW()','updatedAt')[_0x9481('0x6a')]('cm_hopper_final')[_0x9481('0x38')](_0x9481('0x6b'),_0xa83176[_0x9481('0x48')]['id'][_0x9481('0x6c')]())['where'](_0x9481('0x6d'),_0xa83176['body'][_0x9481('0x6e')][_0x9481('0x6c')]())[_0x9481('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9481('0x64')]()['field']('phone')[_0x9481('0x6a')](_0x9481('0x5b'))[_0x9481('0x38')]('VoiceQueueId\x20=\x20?',_0xa83176[_0x9481('0x48')]['id'][_0x9481('0x6c')]()))['where'](_0x9481('0x6f'),squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x70'))['from'](_0x9481('0x71'))['where'](_0x9481('0x6b'),_0xa83176[_0x9481('0x48')]['id']['toString']())[_0x9481('0x38')](_0x9481('0x72')))[_0x9481('0x73')]('ContactId'))['toString']();return db[_0x9481('0x49')]['query'](_0x380f2a);}return[];})[_0x9481('0x25')](respondWithResult(_0x265f1c,null))[_0x9481('0x3f')](handleError(_0x265f1c,null));};exports[_0x9481('0x74')]=function(_0x55b428,_0x3f74f1,_0x287d06){return db[_0x9481('0x75')]['find']({'where':{'id':_0x55b428[_0x9481('0x48')]['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x3f74f1,null))[_0x9481('0x25')](function(_0x32b30f){var _0x347da1;if(_0x32b30f){_0x347da1=squel[_0x9481('0x5a')]()[_0x9481('0x76')](_0x9481('0x5b'))[_0x9481('0x5c')]([_0x9481('0x5d'),'scheduledAt',_0x9481('0x5f'),'ListId','CampaignId','createdAt',_0x9481('0x63')],squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x66'),_0x9481('0x5d'))['field'](_0x9481('0x67'),_0x9481('0x5e'))[_0x9481('0x65')](_0x9481('0x68'),_0x9481('0x5f'))[_0x9481('0x65')](_0x9481('0x69'),_0x9481('0x60'))[_0x9481('0x65')](_0x9481('0x77'),'CampaignId')[_0x9481('0x65')](_0x9481('0x67'),_0x9481('0x62'))[_0x9481('0x65')](_0x9481('0x67'),_0x9481('0x63'))[_0x9481('0x6a')](_0x9481('0x71'))[_0x9481('0x38')](_0x9481('0x78'),_0x55b428['params']['id'][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x6d'),_0x55b428[_0x9481('0x44')][_0x9481('0x6e')][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x79'))[_0x9481('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9481('0x64')]()['field']('phone')[_0x9481('0x6a')](_0x9481('0x5b'))[_0x9481('0x38')](_0x9481('0x78'),_0x55b428[_0x9481('0x48')]['id'][_0x9481('0x6c')]()))['where'](_0x9481('0x6f'),squel['select']()[_0x9481('0x65')](_0x9481('0x70'))[_0x9481('0x6a')]('cm_hopper_final')['where'](_0x9481('0x78'),_0x55b428[_0x9481('0x48')]['id'][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x72')))[_0x9481('0x73')](_0x9481('0x5f')))[_0x9481('0x6c')]();return db[_0x9481('0x49')]['query'](_0x347da1);}return[];})[_0x9481('0x25')](respondWithResult(_0x3f74f1,null))[_0x9481('0x3f')](handleError(_0x3f74f1,null));};exports['checkContactHopper']=function(_0x2c53df,_0x534979,_0x616b77){return db[_0x9481('0x7a')]['findOne']({'where':{'VoiceQueueId':_0x2c53df[_0x9481('0x44')][_0x9481('0x61')],'CampaignId':_0x2c53df[_0x9481('0x44')]['CampaignId'],'ContactId':_0x2c53df[_0x9481('0x44')][_0x9481('0x5f')]}})['then'](handleEntityNotFound(_0x534979,null))[_0x9481('0x25')](function(_0x5c7602){if(_0x5c7602){return _0x5c7602;}return null;})[_0x9481('0x25')](respondWithResult(_0x534979,null))[_0x9481('0x3f')](handleError(_0x534979,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 5b9ba17..bca1ae5 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 _0x9a36=['path','rimraf','./cmHopperFinal.attributes','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x9a36,0x72));var _0x69a3=function(_0x1d4d2e,_0x2b8145){_0x1d4d2e=_0x1d4d2e-0x0;var _0x54f8fd=_0x9a36[_0x1d4d2e];return _0x54f8fd;};'use strict';var _=require(_0x69a3('0x0'));var util=require(_0x69a3('0x1'));var logger=require(_0x69a3('0x2'))(_0x69a3('0x3'));var moment=require('moment');var BPromise=require(_0x69a3('0x4'));var rp=require(_0x69a3('0x5'));var fs=require('fs');var path=require(_0x69a3('0x6'));var rimraf=require(_0x69a3('0x7'));var config=require('../../config/environment');var attributes=require(_0x69a3('0x8'));module['exports']=function(_0x44039c,_0x46a071){return _0x44039c['define']('CmHopperFinal',attributes,{'tableName':_0x69a3('0x9'),'paranoid':![],'indexes':[{'name':_0x69a3('0xa'),'fields':[_0x69a3('0xa')]},{'name':_0x69a3('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf8b5=['request-promise','path','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1c0c04,_0xd7dd47){var _0x1d149f=function(_0x1db2e2){while(--_0x1db2e2){_0x1c0c04['push'](_0x1c0c04['shift']());}};_0x1d149f(++_0xd7dd47);}(_0xf8b5,0x108));var _0x5f8b=function(_0x57d867,_0x2ee50b){_0x57d867=_0x57d867-0x0;var _0x33d270=_0xf8b5[_0x57d867];return _0x33d270;};'use strict';var _=require(_0x5f8b('0x0'));var util=require(_0x5f8b('0x1'));var logger=require(_0x5f8b('0x2'))(_0x5f8b('0x3'));var moment=require(_0x5f8b('0x4'));var BPromise=require(_0x5f8b('0x5'));var rp=require(_0x5f8b('0x6'));var fs=require('fs');var path=require(_0x5f8b('0x7'));var rimraf=require('rimraf');var config=require(_0x5f8b('0x8'));var attributes=require(_0x5f8b('0x9'));module[_0x5f8b('0xa')]=function(_0x1634dd,_0x1e7126){return _0x1634dd[_0x5f8b('0xb')]('CmHopperFinal',attributes,{'tableName':_0x5f8b('0xc'),'paranoid':![],'indexes':[{'name':_0x5f8b('0xd'),'fields':[_0x5f8b('0xd')]},{'name':_0x5f8b('0xe'),'fields':[_0x5f8b('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 35dbd44..23cd8ee 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(_0x27ee1c,_0x222593){var _0x322117=function(_0x2de54f){while(--_0x2de54f){_0x27ee1c['push'](_0x27ee1c['shift']());}};_0x322117(++_0x222593);}(_0xb10b,0x12a));var _0xbb10=function(_0x26742c,_0xe241ee){_0x26742c=_0x26742c-0x0;var _0x4d9df4=_0xb10b[_0x26742c];return _0x4d9df4;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x9a3ebc,_0x4acf66){var _0x29e784=function(_0x21bc7d){while(--_0x21bc7d){_0x9a3ebc['push'](_0x9a3ebc['shift']());}};_0x29e784(++_0x4acf66);}(_0xb10b,0x12a));var _0xbb10=function(_0x496688,_0x2236bf){_0x496688=_0x496688-0x0;var _0x3caf1d=_0xb10b[_0x496688];return _0x3caf1d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 610ea1e..c400920 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 _0x0298=['Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x438912,_0x3f7f74){var _0x18112f=function(_0x1b8ac9){while(--_0x1b8ac9){_0x438912['push'](_0x438912['shift']());}};_0x18112f(++_0x3f7f74);}(_0x0298,0x1bb));var _0x8029=function(_0xa6a23e,_0x8b657a){_0xa6a23e=_0xa6a23e-0x0;var _0x210e65=_0x0298[_0xa6a23e];return _0x210e65;};'use strict';var multer=require(_0x8029('0x0'));var util=require(_0x8029('0x1'));var path=require(_0x8029('0x2'));var timeout=require(_0x8029('0x3'));var express=require(_0x8029('0x4'));var router=express[_0x8029('0x5')]();var fs_extra=require(_0x8029('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8029('0x7'));var config=require(_0x8029('0x8'));var controller=require(_0x8029('0x9'));router[_0x8029('0xa')]('/',auth[_0x8029('0xb')](),controller[_0x8029('0xc')]);router[_0x8029('0xa')](_0x8029('0xd'),auth['isAuthenticated'](),controller[_0x8029('0xe')]);router[_0x8029('0xa')](_0x8029('0xf'),auth[_0x8029('0xb')](),controller['show']);router['get'](_0x8029('0x10'),auth[_0x8029('0xb')](),controller[_0x8029('0x11')]);router['get'](_0x8029('0x12'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0x8029('0x13')](_0x8029('0x14'),auth[_0x8029('0xb')](),controller[_0x8029('0x15')]);router[_0x8029('0x13')]('/voice/campaign/moveContacts/:id',auth[_0x8029('0xb')](),controller[_0x8029('0x16')]);router[_0x8029('0x13')](_0x8029('0x17'),auth['isAuthenticated'](),controller[_0x8029('0x18')]);router[_0x8029('0x19')](_0x8029('0xf'),auth[_0x8029('0xb')](),controller[_0x8029('0x1a')]);module[_0x8029('0x1b')]=router; \ No newline at end of file +var _0xb1dc=['countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id'];(function(_0x86d1e7,_0x35c144){var _0xc46aa1=function(_0x6ed192){while(--_0x6ed192){_0x86d1e7['push'](_0x86d1e7['shift']());}};_0xc46aa1(++_0x35c144);}(_0xb1dc,0xb7));var _0xcb1d=function(_0x5a7dd3,_0x26b7cf){_0x5a7dd3=_0x5a7dd3-0x0;var _0x2f4d07=_0xb1dc[_0x5a7dd3];return _0x2f4d07;};'use strict';var multer=require(_0xcb1d('0x0'));var util=require(_0xcb1d('0x1'));var path=require(_0xcb1d('0x2'));var timeout=require(_0xcb1d('0x3'));var express=require(_0xcb1d('0x4'));var router=express[_0xcb1d('0x5')]();var fs_extra=require(_0xcb1d('0x6'));var auth=require(_0xcb1d('0x7'));var interaction=require(_0xcb1d('0x8'));var config=require(_0xcb1d('0x9'));var controller=require(_0xcb1d('0xa'));router[_0xcb1d('0xb')]('/',auth[_0xcb1d('0xc')](),controller[_0xcb1d('0xd')]);router[_0xcb1d('0xb')](_0xcb1d('0xe'),auth[_0xcb1d('0xc')](),controller['describe']);router[_0xcb1d('0xb')](_0xcb1d('0xf'),auth[_0xcb1d('0xc')](),controller[_0xcb1d('0x10')]);router[_0xcb1d('0xb')](_0xcb1d('0x11'),auth['isAuthenticated'](),controller[_0xcb1d('0x12')]);router[_0xcb1d('0xb')](_0xcb1d('0x13'),auth['isAuthenticated'](),controller[_0xcb1d('0x14')]);router[_0xcb1d('0x15')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0xcb1d('0x16')]);router[_0xcb1d('0x15')](_0xcb1d('0x17'),auth[_0xcb1d('0xc')](),controller[_0xcb1d('0x18')]);router[_0xcb1d('0x15')](_0xcb1d('0x19'),auth[_0xcb1d('0xc')](),controller[_0xcb1d('0x1a')]);router[_0xcb1d('0x1b')](_0xcb1d('0xf'),auth[_0xcb1d('0xc')](),controller['update']);module[_0xcb1d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 829c762..07d0411 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 _0xbb36=['DATE','STRING','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x3f1c67,_0x5271a6){var _0x556de7=function(_0x4fa3f6){while(--_0x4fa3f6){_0x3f1c67['push'](_0x3f1c67['shift']());}};_0x556de7(++_0x5271a6);}(_0xbb36,0x105));var _0x6bb3=function(_0x433cf6,_0x1aaf4e){_0x433cf6=_0x433cf6-0x0;var _0x1fcfe4=_0xbb36[_0x433cf6];return _0x1fcfe4;};'use strict';var Sequelize=require(_0x6bb3('0x0'));module[_0x6bb3('0x1')]={'state':{'type':Sequelize[_0x6bb3('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x6bb3('0x3')]},'countbusyretry':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6bb3('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x6bb3('0x4')]},'originatecalleridname':{'type':Sequelize[_0x6bb3('0x4')]},'calleridnum':{'type':Sequelize[_0x6bb3('0x4')]},'calleridname':{'type':Sequelize[_0x6bb3('0x4')]},'starttime':{'type':Sequelize[_0x6bb3('0x3')]},'responsetime':{'type':Sequelize[_0x6bb3('0x3')]},'answertime':{'type':Sequelize[_0x6bb3('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x6bb3('0x3')]},'ringtime':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6bb3('0x4')]},'campaign':{'type':Sequelize[_0x6bb3('0x4')]},'campaigntype':{'type':Sequelize[_0x6bb3('0x4')]},'membername':{'type':Sequelize[_0x6bb3('0x4')]},'reason':{'type':Sequelize[_0x6bb3('0x4')]},'amd':{'type':Sequelize[_0x6bb3('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6bb3('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x6bb3('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6bb3('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6bb3('0x3')]},'recallme':{'type':Sequelize[_0x6bb3('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x6bb3('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6bb3('0x4')]}}; \ No newline at end of file +var _0x2645=['BOOLEAN','sequelize','INTEGER','DATE','STRING'];(function(_0x544f8a,_0x40485c){var _0x4af711=function(_0x3f34de){while(--_0x3f34de){_0x544f8a['push'](_0x544f8a['shift']());}};_0x4af711(++_0x40485c);}(_0x2645,0xb0));var _0x5264=function(_0x3fbf39,_0x14c2f0){_0x3fbf39=_0x3fbf39-0x0;var _0x33eff3=_0x2645[_0x3fbf39];return _0x33eff3;};'use strict';var Sequelize=require(_0x5264('0x0'));module['exports']={'state':{'type':Sequelize[_0x5264('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x5264('0x2')]},'countbusyretry':{'type':Sequelize[_0x5264('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5264('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5264('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5264('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5264('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x5264('0x3')]},'originatecalleridname':{'type':Sequelize[_0x5264('0x3')]},'calleridnum':{'type':Sequelize[_0x5264('0x3')]},'calleridname':{'type':Sequelize[_0x5264('0x3')]},'starttime':{'type':Sequelize[_0x5264('0x2')]},'responsetime':{'type':Sequelize[_0x5264('0x2')]},'answertime':{'type':Sequelize[_0x5264('0x2')]},'droptime':{'type':Sequelize[_0x5264('0x2')]},'endtime':{'type':Sequelize[_0x5264('0x2')]},'ringtime':{'type':Sequelize[_0x5264('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5264('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5264('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5264('0x3')]},'campaign':{'type':Sequelize[_0x5264('0x3')]},'campaigntype':{'type':Sequelize[_0x5264('0x3')]},'membername':{'type':Sequelize[_0x5264('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x5264('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x5264('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5264('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5264('0x2')]},'recallme':{'type':Sequelize[_0x5264('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5264('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x5264('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5264('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5264('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5264('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 26cb27e..8196c5a 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 _0x6494=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','order','where','pick','filter','merge','options','CmHopperHistory','includeAll','rows','catch','params','keys','find','create','body','describe','uniqueid','eml-format','rimraf'];(function(_0x58c8fd,_0x2d395e){var _0x548eef=function(_0x2b1129){while(--_0x2b1129){_0x58c8fd['push'](_0x58c8fd['shift']());}};_0x548eef(++_0x2d395e);}(_0x6494,0x1da));var _0x4649=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6494[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x4649('0x0'));var rimraf=require(_0x4649('0x1'));var zipdir=require(_0x4649('0x2'));var jsonpatch=require(_0x4649('0x3'));var rp=require(_0x4649('0x4'));var moment=require('moment');var BPromise=require(_0x4649('0x5'));var Mustache=require(_0x4649('0x6'));var util=require(_0x4649('0x7'));var path=require(_0x4649('0x8'));var sox=require(_0x4649('0x9'));var csv=require(_0x4649('0xa'));var ejs=require(_0x4649('0xb'));var fs=require('fs');var fs_extra=require(_0x4649('0xc'));var _=require(_0x4649('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4649('0xa'));var querystring=require(_0x4649('0xe'));var Papa=require(_0x4649('0xf'));var Redis=require('ioredis');var authService=require(_0x4649('0x10'));var qs=require(_0x4649('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4649('0x12'));var logger=require(_0x4649('0x13'))(_0x4649('0x14'));var utils=require('../../config/utils');var config=require(_0x4649('0x15'));var licenseUtil=require(_0x4649('0x16'));var db=require(_0x4649('0x17'))['db'];function respondWithStatusCode(_0x1183e4,_0x4da185){_0x4da185=_0x4da185||0xcc;return function(_0xfe4e){if(_0xfe4e){return _0x1183e4[_0x4649('0x18')](_0x4da185);}return _0x1183e4[_0x4649('0x19')](_0x4da185)['end']();};}function respondWithResult(_0x47588a,_0x292c8f){_0x292c8f=_0x292c8f||0xc8;return function(_0x1a8231){if(_0x1a8231){return _0x47588a[_0x4649('0x19')](_0x292c8f)[_0x4649('0x1a')](_0x1a8231);}};}function respondWithFilteredResult(_0x44730c,_0x3abe75){return function(_0x5e5e1a){if(_0x5e5e1a){var _0x1d3692=typeof _0x3abe75[_0x4649('0x1b')]===_0x4649('0x1c')&&typeof _0x3abe75[_0x4649('0x1d')]==='undefined';var _0x4f94a4=_0x5e5e1a['count'];var _0x1d1adf=_0x1d3692?0x0:_0x3abe75[_0x4649('0x1b')];var _0x30c4c5=_0x1d3692?_0x5e5e1a[_0x4649('0x1e')]:_0x3abe75[_0x4649('0x1b')]+_0x3abe75[_0x4649('0x1d')];var _0x275dfa;if(_0x30c4c5>=_0x4f94a4){_0x30c4c5=_0x4f94a4;_0x275dfa=0xc8;}else{_0x275dfa=0xce;}_0x44730c['status'](_0x275dfa);return _0x44730c['set']('Content-Range',_0x1d1adf+'-'+_0x30c4c5+'/'+_0x4f94a4)[_0x4649('0x1a')](_0x5e5e1a);}return null;};}function patchUpdates(_0x5ad506){return function(_0x55d610){try{jsonpatch[_0x4649('0x1f')](_0x55d610,_0x5ad506,!![]);}catch(_0x49c814){return BPromise[_0x4649('0x20')](_0x49c814);}return _0x55d610[_0x4649('0x21')]();};}function saveUpdates(_0x2da558,_0x17f11d){return function(_0x1d7fa9){if(_0x1d7fa9){return _0x1d7fa9[_0x4649('0x22')](_0x2da558)[_0x4649('0x23')](function(_0x3d15ed){return _0x3d15ed;});}return null;};}function removeEntity(_0x224628,_0x346010){return function(_0x4407fb){if(_0x4407fb){return _0x4407fb[_0x4649('0x24')]()[_0x4649('0x23')](function(){_0x224628[_0x4649('0x19')](0xcc)[_0x4649('0x25')]();});}};}function handleEntityNotFound(_0x1e2a54,_0x44145e){return function(_0x3bf73a){if(!_0x3bf73a){_0x1e2a54['sendStatus'](0x194);}return _0x3bf73a;};}function handleError(_0x687c1c,_0x46e739){_0x46e739=_0x46e739||0x1f4;return function(_0x344466){logger[_0x4649('0x26')](_0x344466[_0x4649('0x27')]);if(_0x344466[_0x4649('0x28')]){delete _0x344466['name'];}_0x687c1c[_0x4649('0x19')](_0x46e739)[_0x4649('0x29')](_0x344466);};}exports['index']=function(_0x2e8601,_0x3d20a0){var _0xc57900={},_0x31cb60={},_0x45f730={'count':0x0,'rows':[]};var _0x3a34dc=_[_0x4649('0x2a')](db['CmHopperHistory'][_0x4649('0x2b')],function(_0x21912e){return{'name':_0x21912e[_0x4649('0x2c')],'type':_0x21912e['type']['key']};});_0x31cb60[_0x4649('0x2d')]=_[_0x4649('0x2a')](_0x3a34dc,_0x4649('0x28'));_0x31cb60[_0x4649('0x2e')]=_['keys'](_0x2e8601[_0x4649('0x2e')]);_0x31cb60[_0x4649('0x2f')]=_[_0x4649('0x30')](_0x31cb60[_0x4649('0x2d')],_0x31cb60[_0x4649('0x2e')]);_0xc57900[_0x4649('0x31')]=_['intersection'](_0x31cb60['model'],qs['fields'](_0x2e8601[_0x4649('0x2e')][_0x4649('0x32')]));_0xc57900[_0x4649('0x31')]=_0xc57900[_0x4649('0x31')]['length']?_0xc57900['attributes']:_0x31cb60[_0x4649('0x2d')];if(!_0x2e8601[_0x4649('0x2e')]['hasOwnProperty']('nolimit')){_0xc57900[_0x4649('0x1d')]=qs[_0x4649('0x1d')](_0x2e8601['query'][_0x4649('0x1d')]);_0xc57900[_0x4649('0x1b')]=qs['offset'](_0x2e8601[_0x4649('0x2e')][_0x4649('0x1b')]);}_0xc57900[_0x4649('0x33')]=qs['sort'](_0x2e8601[_0x4649('0x2e')]['sort']);_0xc57900[_0x4649('0x34')]=qs[_0x4649('0x2f')](_[_0x4649('0x35')](_0x2e8601[_0x4649('0x2e')],_0x31cb60[_0x4649('0x2f')]),_0x3a34dc);if(_0x2e8601[_0x4649('0x2e')][_0x4649('0x36')]){_0xc57900[_0x4649('0x34')]=_[_0x4649('0x37')](_0xc57900['where'],{'$or':_[_0x4649('0x2a')](_0x3a34dc,function(_0x3601a3){if(_0x3601a3['type']!=='VIRTUAL'){var _0x7a4a68={};_0x7a4a68[_0x3601a3['name']]={'$like':'%'+_0x2e8601['query'][_0x4649('0x36')]+'%'};return _0x7a4a68;}})});}_0xc57900=_['merge']({},_0xc57900,_0x2e8601[_0x4649('0x38')]);var _0xc81589={'where':_0xc57900['where']};return db[_0x4649('0x39')][_0x4649('0x1e')](_0xc81589)[_0x4649('0x23')](function(_0x4c6796){_0x45f730[_0x4649('0x1e')]=_0x4c6796;if(_0x2e8601[_0x4649('0x2e')][_0x4649('0x3a')]){_0xc57900['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0xc57900);})[_0x4649('0x23')](function(_0x45c95d){_0x45f730[_0x4649('0x3b')]=_0x45c95d;return _0x45f730;})[_0x4649('0x23')](respondWithFilteredResult(_0x3d20a0,_0xc57900))[_0x4649('0x3c')](handleError(_0x3d20a0,null));};exports['show']=function(_0x1248a1,_0x7e4a46){var _0x4ff7af={'raw':!![],'where':{'id':_0x1248a1[_0x4649('0x3d')]['id']}},_0x25c6ac={};_0x25c6ac[_0x4649('0x2d')]=_[_0x4649('0x3e')](db['CmHopperHistory'][_0x4649('0x2b')]);_0x25c6ac[_0x4649('0x2e')]=_[_0x4649('0x3e')](_0x1248a1[_0x4649('0x2e')]);_0x25c6ac[_0x4649('0x2f')]=_[_0x4649('0x30')](_0x25c6ac[_0x4649('0x2d')],_0x25c6ac['query']);_0x4ff7af[_0x4649('0x31')]=_['intersection'](_0x25c6ac[_0x4649('0x2d')],qs[_0x4649('0x32')](_0x1248a1['query'][_0x4649('0x32')]));_0x4ff7af[_0x4649('0x31')]=_0x4ff7af['attributes']['length']?_0x4ff7af['attributes']:_0x25c6ac['model'];if(_0x1248a1[_0x4649('0x2e')][_0x4649('0x3a')]){_0x4ff7af['include']=[{'all':!![]}];}_0x4ff7af=_['merge']({},_0x4ff7af,_0x1248a1[_0x4649('0x38')]);return db[_0x4649('0x39')][_0x4649('0x3f')](_0x4ff7af)['then'](handleEntityNotFound(_0x7e4a46,null))[_0x4649('0x23')](respondWithResult(_0x7e4a46,null))['catch'](handleError(_0x7e4a46,null));};exports[_0x4649('0x40')]=function(_0x5c7efb,_0x419c97){return db['CmHopperHistory'][_0x4649('0x40')](_0x5c7efb[_0x4649('0x41')],{})['then'](respondWithResult(_0x419c97,0xc9))['catch'](handleError(_0x419c97,null));};exports[_0x4649('0x42')]=function(_0x54af58,_0x222da4){return db['CmHopperHistory'][_0x4649('0x42')]()['then'](respondWithResult(_0x222da4,null))['catch'](handleError(_0x222da4,null));};exports[_0x4649('0x22')]=function(_0x3846a7,_0x5c389a){if(_0x3846a7[_0x4649('0x41')][_0x4649('0x43')]){delete _0x3846a7[_0x4649('0x41')][_0x4649('0x43')];}return db[_0x4649('0x39')][_0x4649('0x3f')]({'where':{'uniqueid':_0x3846a7[_0x4649('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5c389a,null))[_0x4649('0x23')](saveUpdates(_0x3846a7[_0x4649('0x41')],null))['then'](respondWithResult(_0x5c389a,null))[_0x4649('0x3c')](handleError(_0x5c389a,null));}; \ No newline at end of file +var _0x6b68=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','create','body','describe','uniqueid','find','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse'];(function(_0x58f44d,_0x491289){var _0x18216a=function(_0x3e7566){while(--_0x3e7566){_0x58f44d['push'](_0x58f44d['shift']());}};_0x18216a(++_0x491289);}(_0x6b68,0x90));var _0x86b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b68[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x86b6('0x0'));var rimraf=require(_0x86b6('0x1'));var zipdir=require(_0x86b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x86b6('0x3'));var moment=require('moment');var BPromise=require(_0x86b6('0x4'));var Mustache=require('mustache');var util=require(_0x86b6('0x5'));var path=require(_0x86b6('0x6'));var sox=require(_0x86b6('0x7'));var csv=require(_0x86b6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x86b6('0x9'));var _=require(_0x86b6('0xa'));var squel=require(_0x86b6('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x86b6('0x8'));var querystring=require(_0x86b6('0xc'));var Papa=require(_0x86b6('0xd'));var Redis=require(_0x86b6('0xe'));var authService=require(_0x86b6('0xf'));var qs=require(_0x86b6('0x10'));var as=require(_0x86b6('0x11'));var hardwareService=require(_0x86b6('0x12'));var logger=require(_0x86b6('0x13'))(_0x86b6('0x14'));var utils=require(_0x86b6('0x15'));var config=require(_0x86b6('0x16'));var licenseUtil=require(_0x86b6('0x17'));var db=require(_0x86b6('0x18'))['db'];function respondWithStatusCode(_0x4c2d38,_0x222f9b){_0x222f9b=_0x222f9b||0xcc;return function(_0x221c70){if(_0x221c70){return _0x4c2d38[_0x86b6('0x19')](_0x222f9b);}return _0x4c2d38[_0x86b6('0x1a')](_0x222f9b)[_0x86b6('0x1b')]();};}function respondWithResult(_0x4efb69,_0x28b39a){_0x28b39a=_0x28b39a||0xc8;return function(_0x2b96ed){if(_0x2b96ed){return _0x4efb69[_0x86b6('0x1a')](_0x28b39a)[_0x86b6('0x1c')](_0x2b96ed);}};}function respondWithFilteredResult(_0xe2296b,_0x1cc5d3){return function(_0x319588){if(_0x319588){var _0x2c910a=typeof _0x1cc5d3['offset']===_0x86b6('0x1d')&&typeof _0x1cc5d3[_0x86b6('0x1e')]===_0x86b6('0x1d');var _0x5087f6=_0x319588[_0x86b6('0x1f')];var _0x4d0fcc=_0x2c910a?0x0:_0x1cc5d3['offset'];var _0x345ebc=_0x2c910a?_0x319588[_0x86b6('0x1f')]:_0x1cc5d3[_0x86b6('0x20')]+_0x1cc5d3[_0x86b6('0x1e')];var _0x1646d6;if(_0x345ebc>=_0x5087f6){_0x345ebc=_0x5087f6;_0x1646d6=0xc8;}else{_0x1646d6=0xce;}_0xe2296b[_0x86b6('0x1a')](_0x1646d6);return _0xe2296b[_0x86b6('0x21')](_0x86b6('0x22'),_0x4d0fcc+'-'+_0x345ebc+'/'+_0x5087f6)[_0x86b6('0x1c')](_0x319588);}return null;};}function patchUpdates(_0x5c205f){return function(_0x25858e){try{jsonpatch[_0x86b6('0x23')](_0x25858e,_0x5c205f,!![]);}catch(_0x559037){return BPromise['reject'](_0x559037);}return _0x25858e['save']();};}function saveUpdates(_0x1a1f58,_0x5248d4){return function(_0x4f0690){if(_0x4f0690){return _0x4f0690[_0x86b6('0x24')](_0x1a1f58)[_0x86b6('0x25')](function(_0x4c0fe6){return _0x4c0fe6;});}return null;};}function removeEntity(_0x448721,_0x3b0c5d){return function(_0x6fa34a){if(_0x6fa34a){return _0x6fa34a[_0x86b6('0x26')]()[_0x86b6('0x25')](function(){_0x448721[_0x86b6('0x1a')](0xcc)[_0x86b6('0x1b')]();});}};}function handleEntityNotFound(_0xe92fbf,_0x54dc0e){return function(_0x480d26){if(!_0x480d26){_0xe92fbf[_0x86b6('0x19')](0x194);}return _0x480d26;};}function handleError(_0x465626,_0xb4c926){_0xb4c926=_0xb4c926||0x1f4;return function(_0x5d5d3e){logger[_0x86b6('0x27')](_0x5d5d3e[_0x86b6('0x28')]);if(_0x5d5d3e[_0x86b6('0x29')]){delete _0x5d5d3e['name'];}_0x465626[_0x86b6('0x1a')](_0xb4c926)[_0x86b6('0x2a')](_0x5d5d3e);};}exports[_0x86b6('0x2b')]=function(_0x16396b,_0x3f5bb5){var _0x3fedbd={},_0x3b4b1d={},_0x10480f={'count':0x0,'rows':[]};var _0x454795=_[_0x86b6('0x2c')](db[_0x86b6('0x2d')][_0x86b6('0x2e')],function(_0x2cbb5f){return{'name':_0x2cbb5f[_0x86b6('0x2f')],'type':_0x2cbb5f['type'][_0x86b6('0x30')]};});_0x3b4b1d[_0x86b6('0x31')]=_[_0x86b6('0x2c')](_0x454795,_0x86b6('0x29'));_0x3b4b1d['query']=_[_0x86b6('0x32')](_0x16396b[_0x86b6('0x33')]);_0x3b4b1d['filters']=_[_0x86b6('0x34')](_0x3b4b1d['model'],_0x3b4b1d[_0x86b6('0x33')]);_0x3fedbd['attributes']=_[_0x86b6('0x34')](_0x3b4b1d[_0x86b6('0x31')],qs[_0x86b6('0x35')](_0x16396b['query'][_0x86b6('0x35')]));_0x3fedbd['attributes']=_0x3fedbd[_0x86b6('0x36')][_0x86b6('0x37')]?_0x3fedbd[_0x86b6('0x36')]:_0x3b4b1d['model'];if(!_0x16396b[_0x86b6('0x33')][_0x86b6('0x38')](_0x86b6('0x39'))){_0x3fedbd[_0x86b6('0x1e')]=qs[_0x86b6('0x1e')](_0x16396b[_0x86b6('0x33')]['limit']);_0x3fedbd[_0x86b6('0x20')]=qs['offset'](_0x16396b['query'][_0x86b6('0x20')]);}_0x3fedbd[_0x86b6('0x3a')]=qs[_0x86b6('0x3b')](_0x16396b[_0x86b6('0x33')]['sort']);_0x3fedbd['where']=qs[_0x86b6('0x3c')](_[_0x86b6('0x3d')](_0x16396b[_0x86b6('0x33')],_0x3b4b1d[_0x86b6('0x3c')]),_0x454795);if(_0x16396b[_0x86b6('0x33')]['filter']){_0x3fedbd[_0x86b6('0x3e')]=_['merge'](_0x3fedbd[_0x86b6('0x3e')],{'$or':_[_0x86b6('0x2c')](_0x454795,function(_0x79f9d6){if(_0x79f9d6[_0x86b6('0x3f')]!==_0x86b6('0x40')){var _0x1517a8={};_0x1517a8[_0x79f9d6[_0x86b6('0x29')]]={'$like':'%'+_0x16396b['query']['filter']+'%'};return _0x1517a8;}})});}_0x3fedbd=_[_0x86b6('0x41')]({},_0x3fedbd,_0x16396b['options']);var _0x3dc958={'where':_0x3fedbd[_0x86b6('0x3e')]};return db[_0x86b6('0x2d')]['count'](_0x3dc958)[_0x86b6('0x25')](function(_0x573fc7){_0x10480f[_0x86b6('0x1f')]=_0x573fc7;if(_0x16396b['query'][_0x86b6('0x42')]){_0x3fedbd[_0x86b6('0x43')]=[{'all':!![]}];}return db[_0x86b6('0x2d')][_0x86b6('0x44')](_0x3fedbd);})[_0x86b6('0x25')](function(_0x273ca5){_0x10480f[_0x86b6('0x45')]=_0x273ca5;return _0x10480f;})[_0x86b6('0x25')](respondWithFilteredResult(_0x3f5bb5,_0x3fedbd))[_0x86b6('0x46')](handleError(_0x3f5bb5,null));};exports[_0x86b6('0x47')]=function(_0x88fcbf,_0x3d6f94){var _0x50dae9={'raw':!![],'where':{'id':_0x88fcbf[_0x86b6('0x48')]['id']}},_0xeaabdf={};_0xeaabdf[_0x86b6('0x31')]=_[_0x86b6('0x32')](db[_0x86b6('0x2d')][_0x86b6('0x2e')]);_0xeaabdf[_0x86b6('0x33')]=_[_0x86b6('0x32')](_0x88fcbf[_0x86b6('0x33')]);_0xeaabdf[_0x86b6('0x3c')]=_[_0x86b6('0x34')](_0xeaabdf['model'],_0xeaabdf[_0x86b6('0x33')]);_0x50dae9[_0x86b6('0x36')]=_[_0x86b6('0x34')](_0xeaabdf[_0x86b6('0x31')],qs[_0x86b6('0x35')](_0x88fcbf[_0x86b6('0x33')][_0x86b6('0x35')]));_0x50dae9['attributes']=_0x50dae9[_0x86b6('0x36')][_0x86b6('0x37')]?_0x50dae9[_0x86b6('0x36')]:_0xeaabdf['model'];if(_0x88fcbf[_0x86b6('0x33')]['includeAll']){_0x50dae9['include']=[{'all':!![]}];}_0x50dae9=_[_0x86b6('0x41')]({},_0x50dae9,_0x88fcbf[_0x86b6('0x49')]);return db[_0x86b6('0x2d')]['find'](_0x50dae9)[_0x86b6('0x25')](handleEntityNotFound(_0x3d6f94,null))[_0x86b6('0x25')](respondWithResult(_0x3d6f94,null))[_0x86b6('0x46')](handleError(_0x3d6f94,null));};exports['create']=function(_0x175f91,_0x2339e4){return db['CmHopperHistory'][_0x86b6('0x4a')](_0x175f91[_0x86b6('0x4b')],{})[_0x86b6('0x25')](respondWithResult(_0x2339e4,0xc9))[_0x86b6('0x46')](handleError(_0x2339e4,null));};exports[_0x86b6('0x4c')]=function(_0x529849,_0x336237){return db[_0x86b6('0x2d')][_0x86b6('0x4c')]()[_0x86b6('0x25')](respondWithResult(_0x336237,null))[_0x86b6('0x46')](handleError(_0x336237,null));};exports[_0x86b6('0x24')]=function(_0x2d459d,_0x22ccda){if(_0x2d459d['body']['uniqueid']){delete _0x2d459d[_0x86b6('0x4b')][_0x86b6('0x4d')];}return db[_0x86b6('0x2d')][_0x86b6('0x4e')]({'where':{'uniqueid':_0x2d459d[_0x86b6('0x48')]['id']}})['then'](handleEntityNotFound(_0x22ccda,null))['then'](saveUpdates(_0x2d459d[_0x86b6('0x4b')],null))[_0x86b6('0x25')](respondWithResult(_0x22ccda,null))[_0x86b6('0x46')](handleError(_0x22ccda,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 1e90f4e..c25208b 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 _0xa064=['path','../../config/environment','./cmHopperHistory.attributes','CmHopperHistory','cm_hopper_history','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x12c006,_0x14cd5b){var _0x19508f=function(_0x39dbb9){while(--_0x39dbb9){_0x12c006['push'](_0x12c006['shift']());}};_0x19508f(++_0x14cd5b);}(_0xa064,0x192));var _0x4a06=function(_0x37dfdb,_0x51140f){_0x37dfdb=_0x37dfdb-0x0;var _0x1f1715=_0xa064[_0x37dfdb];return _0x1f1715;};'use strict';var _=require(_0x4a06('0x0'));var util=require(_0x4a06('0x1'));var logger=require(_0x4a06('0x2'))(_0x4a06('0x3'));var moment=require(_0x4a06('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a06('0x5'));var rimraf=require('rimraf');var config=require(_0x4a06('0x6'));var attributes=require(_0x4a06('0x7'));module['exports']=function(_0x3f2099,_0x54c9ed){return _0x3f2099['define'](_0x4a06('0x8'),attributes,{'tableName':_0x4a06('0x9'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0x4a06('0xa'),'fields':[_0x4a06('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x508a=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','define','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x508a,0x1aa));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa508('0x0'));var util=require('util');var logger=require(_0xa508('0x1'))(_0xa508('0x2'));var moment=require(_0xa508('0x3'));var BPromise=require(_0xa508('0x4'));var rp=require(_0xa508('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa508('0x6'));var config=require(_0xa508('0x7'));var attributes=require(_0xa508('0x8'));module['exports']=function(_0x89d08e,_0x11c154){return _0x89d08e[_0xa508('0x9')]('CmHopperHistory',attributes,{'tableName':_0xa508('0xa'),'paranoid':![],'indexes':[{'name':_0xa508('0xb'),'fields':['endtime']},{'name':_0xa508('0xc'),'fields':[_0xa508('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 8332e98..b889d01 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 _0xe235=['`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','debug','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xe235,0xe4));var _0x5e23=function(_0x442f02,_0x47d845){_0x442f02=_0x442f02-0x0;var _0xab6ef1=_0xe235[_0x442f02];return _0xab6ef1;};'use strict';var _=require(_0x5e23('0x0'));var util=require(_0x5e23('0x1'));var moment=require(_0x5e23('0x2'));var BPromise=require(_0x5e23('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e23('0x4'))['db'];var utils=require(_0x5e23('0x5'));var logger=require(_0x5e23('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5e23('0x7'));var client=jayson[_0x5e23('0x8')][_0x5e23('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c9b2b,_0x16454c,_0xd7f262){return new BPromise(function(_0x1f0008,_0x92ae38){return client[_0x5e23('0xa')](_0x1c9b2b,_0xd7f262)[_0x5e23('0xb')](function(_0x3bd7d5){logger[_0x5e23('0xc')](_0x5e23('0xd'),_0x16454c,_0x5e23('0xe'));logger['debug'](_0x5e23('0xf'),_0x16454c,_0x5e23('0xe'),JSON[_0x5e23('0x10')](_0x3bd7d5));if(_0x3bd7d5['error']){if(_0x3bd7d5[_0x5e23('0x11')]['code']===0x1f4){logger[_0x5e23('0x11')](_0x5e23('0xd'),_0x16454c,_0x3bd7d5['error'][_0x5e23('0x12')]);return _0x92ae38(_0x3bd7d5[_0x5e23('0x11')][_0x5e23('0x12')]);}logger[_0x5e23('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x16454c,_0x3bd7d5['error'][_0x5e23('0x12')]);return _0x1f0008(_0x3bd7d5[_0x5e23('0x11')][_0x5e23('0x12')]);}else{logger[_0x5e23('0xc')](_0x5e23('0xd'),_0x16454c,_0x5e23('0xe'));_0x1f0008(_0x3bd7d5[_0x5e23('0x13')][_0x5e23('0x12')]);}})[_0x5e23('0x14')](function(_0x149a3f){logger[_0x5e23('0x11')](_0x5e23('0xd'),_0x16454c,_0x149a3f);_0x92ae38(_0x149a3f);});});}exports[_0x5e23('0x15')]=function(_0x1fb1fc){var _0x5c9d00=this;return new Promise(function(_0x25cd9e,_0x412725){return db[_0x5e23('0x16')]['create'](_0x1fb1fc[_0x5e23('0x17')],{'raw':_0x1fb1fc[_0x5e23('0x18')]?_0x1fb1fc[_0x5e23('0x18')][_0x5e23('0x19')]===undefined?!![]:![]:!![]})[_0x5e23('0xb')](function(_0x1d0ce0){logger['info'](_0x5e23('0x15'),_0x1fb1fc);logger[_0x5e23('0x1a')]('CreateCmHopperHistory',_0x1fb1fc,JSON[_0x5e23('0x10')](_0x1d0ce0));_0x25cd9e(_0x1d0ce0);})[_0x5e23('0x14')](function(_0x4312de){logger['error'](_0x5e23('0x15'),_0x4312de[_0x5e23('0x12')],_0x1fb1fc);_0x412725(_0x5c9d00['error'](0x1f4,_0x4312de['message']));});});};exports[_0x5e23('0x1b')]=function(_0x2b7cc8){var _0x408619=this;return new Promise(function(_0x53dd05,_0x2351d6){return db['CmHopperHistory'][_0x5e23('0x1c')]({'raw':_0x2b7cc8[_0x5e23('0x18')]?_0x2b7cc8[_0x5e23('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2b7cc8[_0x5e23('0x18')]?_0x2b7cc8['options'][_0x5e23('0x1d')]||null:null,'attributes':[[db[_0x5e23('0x1e')]['fn'](_0x5e23('0x1f'),db[_0x5e23('0x1e')][_0x5e23('0x20')]('id')),_0x5e23('0x21')],[db['sequelize']['fn'](_0x5e23('0x1f'),db[_0x5e23('0x1e')]['fn']('IF',db[_0x5e23('0x1e')][_0x5e23('0x22')](_0x5e23('0x23')))),_0x5e23('0x24')],[db['sequelize']['fn'](_0x5e23('0x1f'),db[_0x5e23('0x1e')]['fn']('IF',db[_0x5e23('0x1e')][_0x5e23('0x22')](_0x5e23('0x25')))),_0x5e23('0x26')],[db['sequelize']['fn'](_0x5e23('0x1f'),db[_0x5e23('0x1e')]['fn']('IF',db[_0x5e23('0x1e')][_0x5e23('0x22')](_0x5e23('0x27')))),_0x5e23('0x28')],[db[_0x5e23('0x1e')]['fn'](_0x5e23('0x29'),db[_0x5e23('0x1e')]['fn']('IF',db[_0x5e23('0x1e')][_0x5e23('0x22')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x5e23('0x2a')],[db[_0x5e23('0x1e')]['fn'](_0x5e23('0x29'),db[_0x5e23('0x1e')]['fn']('IF',db[_0x5e23('0x1e')][_0x5e23('0x22')](_0x5e23('0x2b')))),_0x5e23('0x2c')]]})[_0x5e23('0xb')](function(_0x3cf236){logger[_0x5e23('0xc')](_0x5e23('0x1b'),_0x2b7cc8);logger[_0x5e23('0x1a')]('AvgHandleTime',_0x2b7cc8,JSON['stringify'](_0x3cf236));_0x53dd05(_0x3cf236);})[_0x5e23('0x14')](function(_0x50647e){logger['error'](_0x5e23('0x1b'),_0x50647e[_0x5e23('0x12')],_0x2b7cc8);_0x2351d6(_0x408619[_0x5e23('0x11')](0x1f4,_0x50647e['message']));});});};exports[_0x5e23('0x2d')]=function(_0x4dbcbd){var _0x18c06f=this;return new Promise(function(_0x4645bc,_0x43fe17){return db['CmHopperHistory']['findAll']({'raw':_0x4dbcbd[_0x5e23('0x18')]?_0x4dbcbd['options'][_0x5e23('0x19')]===undefined?!![]:![]:!![],'where':_0x4dbcbd[_0x5e23('0x18')]?_0x4dbcbd[_0x5e23('0x18')][_0x5e23('0x1d')]||null:null,'attributes':[[_0x5e23('0x2e'),_0x5e23('0x2f')],[db[_0x5e23('0x1e')]['fn'](_0x5e23('0x1f'),db['sequelize']['fn']('IF',db[_0x5e23('0x1e')][_0x5e23('0x22')](_0x5e23('0x30')))),_0x5e23('0x31')],[db[_0x5e23('0x1e')]['fn'](_0x5e23('0x1f'),db['sequelize']['fn']('IF',db[_0x5e23('0x1e')][_0x5e23('0x22')](_0x5e23('0x32')))),_0x5e23('0x33')],[db[_0x5e23('0x1e')]['fn'](_0x5e23('0x1f'),db[_0x5e23('0x1e')]['fn']('IF',db[_0x5e23('0x1e')][_0x5e23('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x5e23('0x34')],[db[_0x5e23('0x1e')]['fn']('COUNT',db[_0x5e23('0x1e')]['fn']('IF',db[_0x5e23('0x1e')][_0x5e23('0x22')]('`state`\x20=\x205,\x201,\x20null'))),_0x5e23('0x35')],[db['sequelize']['fn']('COUNT',db[_0x5e23('0x1e')]['fn']('IF',db['sequelize'][_0x5e23('0x22')](_0x5e23('0x36')))),_0x5e23('0x37')],[db[_0x5e23('0x1e')]['fn'](_0x5e23('0x1f'),db[_0x5e23('0x1e')]['fn']('IF',db[_0x5e23('0x1e')][_0x5e23('0x22')](_0x5e23('0x38')))),_0x5e23('0x39')],[db[_0x5e23('0x1e')]['fn'](_0x5e23('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x5e23('0x22')](_0x5e23('0x3a')))),_0x5e23('0x3b')],[db[_0x5e23('0x1e')]['fn'](_0x5e23('0x1f'),db[_0x5e23('0x1e')]['fn']('IF',db[_0x5e23('0x1e')]['literal']('`state`\x20=\x2012,\x201,\x20null'))),_0x5e23('0x3c')],[db[_0x5e23('0x1e')]['fn'](_0x5e23('0x1f'),db[_0x5e23('0x1e')]['fn']('IF',db[_0x5e23('0x1e')][_0x5e23('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0x5e23('0x3d')],[db[_0x5e23('0x1e')]['fn'](_0x5e23('0x1f'),db['sequelize']['fn']('IF',db[_0x5e23('0x1e')][_0x5e23('0x22')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0x5e23('0x1e')]['fn']('COUNT',db[_0x5e23('0x1e')]['fn']('IF',db[_0x5e23('0x1e')][_0x5e23('0x22')](_0x5e23('0x3e')))),'outboundRejectCallsDay'],[db[_0x5e23('0x1e')]['fn'](_0x5e23('0x1f'),db[_0x5e23('0x1e')]['fn']('IF',db[_0x5e23('0x1e')][_0x5e23('0x22')](_0x5e23('0x3f')))),_0x5e23('0x40')],[db[_0x5e23('0x1e')]['fn'](_0x5e23('0x1f'),db[_0x5e23('0x1e')]['fn']('IF',db[_0x5e23('0x1e')][_0x5e23('0x22')](_0x5e23('0x41')))),'outboundRejectCallsDay'],[db[_0x5e23('0x1e')]['fn'](_0x5e23('0x1f'),db[_0x5e23('0x1e')]['fn']('IF',db['sequelize'][_0x5e23('0x22')](_0x5e23('0x42')))),_0x5e23('0x43')]],'group':[_0x5e23('0x2e')]})[_0x5e23('0xb')](function(_0x338234){logger[_0x5e23('0xc')](_0x5e23('0x2d'),_0x4dbcbd);logger[_0x5e23('0x1a')]('GetVoiceQueueHopperHistory',_0x4dbcbd,JSON[_0x5e23('0x10')](_0x338234));_0x4645bc(_0x338234);})['catch'](function(_0x12b772){logger[_0x5e23('0x11')](_0x5e23('0x2d'),_0x12b772[_0x5e23('0x12')],_0x4dbcbd);_0x43fe17(_0x18c06f['error'](0x1f4,_0x12b772[_0x5e23('0x12')]));});});};exports[_0x5e23('0x44')]=function(_0xc23b7b){var _0x10f231=this;return new Promise(function(_0x5d9fb9,_0x525b40){return db[_0x5e23('0x16')]['findAll']({'raw':_0xc23b7b[_0x5e23('0x18')]?_0xc23b7b['options'][_0x5e23('0x19')]===undefined?!![]:![]:!![],'where':_0xc23b7b[_0x5e23('0x18')]?_0xc23b7b[_0x5e23('0x18')][_0x5e23('0x1d')]||null:null,'attributes':[['campaign',_0x5e23('0x2f')],[db[_0x5e23('0x1e')]['fn'](_0x5e23('0x1f'),db[_0x5e23('0x1e')][_0x5e23('0x20')]('id')),_0x5e23('0x45')],[db[_0x5e23('0x1e')]['fn'](_0x5e23('0x1f'),db[_0x5e23('0x1e')]['fn']('IF',db[_0x5e23('0x1e')][_0x5e23('0x22')](_0x5e23('0x23')))),_0x5e23('0x46')]],'group':['campaign']})[_0x5e23('0xb')](function(_0x1c494d){logger[_0x5e23('0xc')](_0x5e23('0x44'),_0xc23b7b);logger['debug']('GetCampaignHopperHistory',_0xc23b7b,JSON[_0x5e23('0x10')](_0x1c494d));_0x5d9fb9(_0x1c494d);})[_0x5e23('0x14')](function(_0xf62092){logger[_0x5e23('0x11')](_0x5e23('0x44'),_0xf62092['message'],_0xc23b7b);_0x525b40(_0x10f231['error'](0x1f4,_0xf62092[_0x5e23('0x12')]));});});}; \ No newline at end of file +var _0x1c19=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','debug','findAll','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','col','ivrTotalCallsDays','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x550341,_0x3da5cc){var _0x51a0c4=function(_0x1a3d06){while(--_0x1a3d06){_0x550341['push'](_0x550341['shift']());}};_0x51a0c4(++_0x3da5cc);}(_0x1c19,0x1f2));var _0x91c1=function(_0x5bc4ca,_0x21f738){_0x5bc4ca=_0x5bc4ca-0x0;var _0x12bf3b=_0x1c19[_0x5bc4ca];return _0x12bf3b;};'use strict';var _=require(_0x91c1('0x0'));var util=require(_0x91c1('0x1'));var moment=require(_0x91c1('0x2'));var BPromise=require('bluebird');var rs=require(_0x91c1('0x3'));var fs=require('fs');var Redis=require(_0x91c1('0x4'));var db=require(_0x91c1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x91c1('0x6'))('rpc');var config=require(_0x91c1('0x7'));var jayson=require(_0x91c1('0x8'));var client=jayson[_0x91c1('0x9')][_0x91c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a2ff5,_0x2cc656,_0x2a60b1){return new BPromise(function(_0x5ca804,_0x5da20c){return client[_0x91c1('0xb')](_0x1a2ff5,_0x2a60b1)[_0x91c1('0xc')](function(_0x21483a){logger[_0x91c1('0xd')](_0x91c1('0xe'),_0x2cc656,'request\x20sent');logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x2cc656,'request\x20sent',JSON[_0x91c1('0xf')](_0x21483a));if(_0x21483a[_0x91c1('0x10')]){if(_0x21483a[_0x91c1('0x10')][_0x91c1('0x11')]===0x1f4){logger[_0x91c1('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x2cc656,_0x21483a['error']['message']);return _0x5da20c(_0x21483a[_0x91c1('0x10')][_0x91c1('0x12')]);}logger[_0x91c1('0x10')](_0x91c1('0xe'),_0x2cc656,_0x21483a[_0x91c1('0x10')][_0x91c1('0x12')]);return _0x5ca804(_0x21483a[_0x91c1('0x10')]['message']);}else{logger[_0x91c1('0xd')](_0x91c1('0xe'),_0x2cc656,'request\x20sent');_0x5ca804(_0x21483a[_0x91c1('0x13')][_0x91c1('0x12')]);}})[_0x91c1('0x14')](function(_0x248a4a){logger['error'](_0x91c1('0xe'),_0x2cc656,_0x248a4a);_0x5da20c(_0x248a4a);});});}exports[_0x91c1('0x15')]=function(_0x46c2c8){var _0x2d50fe=this;return new Promise(function(_0x2837a4,_0x1386ed){return db[_0x91c1('0x16')][_0x91c1('0x17')](_0x46c2c8[_0x91c1('0x18')],{'raw':_0x46c2c8[_0x91c1('0x19')]?_0x46c2c8[_0x91c1('0x19')][_0x91c1('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x362de8){logger[_0x91c1('0xd')](_0x91c1('0x15'),_0x46c2c8);logger[_0x91c1('0x1b')]('CreateCmHopperHistory',_0x46c2c8,JSON[_0x91c1('0xf')](_0x362de8));_0x2837a4(_0x362de8);})[_0x91c1('0x14')](function(_0x3c4318){logger['error']('CreateCmHopperHistory',_0x3c4318['message'],_0x46c2c8);_0x1386ed(_0x2d50fe['error'](0x1f4,_0x3c4318[_0x91c1('0x12')]));});});};exports['AvgHandleTime']=function(_0x2c8246){var _0x348a6d=this;return new Promise(function(_0x3be536,_0x1b8def){return db[_0x91c1('0x16')][_0x91c1('0x1c')]({'raw':_0x2c8246[_0x91c1('0x19')]?_0x2c8246[_0x91c1('0x19')][_0x91c1('0x1a')]===undefined?!![]:![]:!![],'where':_0x2c8246[_0x91c1('0x19')]?_0x2c8246[_0x91c1('0x19')]['where']||null:null,'attributes':[[db[_0x91c1('0x1d')]['fn'](_0x91c1('0x1e'),db[_0x91c1('0x1d')]['col']('id')),_0x91c1('0x1f')],[db[_0x91c1('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x91c1('0x1d')][_0x91c1('0x20')](_0x91c1('0x21')))),_0x91c1('0x22')],[db[_0x91c1('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x91c1('0x1d')]['literal'](_0x91c1('0x23')))),_0x91c1('0x24')],[db['sequelize']['fn'](_0x91c1('0x1e'),db[_0x91c1('0x1d')]['fn']('IF',db[_0x91c1('0x1d')][_0x91c1('0x20')](_0x91c1('0x25')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x91c1('0x1d')]['fn']('AVG',db[_0x91c1('0x1d')]['fn']('IF',db['sequelize'][_0x91c1('0x20')](_0x91c1('0x26')))),_0x91c1('0x27')],[db[_0x91c1('0x1d')]['fn'](_0x91c1('0x28'),db[_0x91c1('0x1d')]['fn']('IF',db['sequelize'][_0x91c1('0x20')](_0x91c1('0x29')))),_0x91c1('0x2a')]]})[_0x91c1('0xc')](function(_0x19a089){logger[_0x91c1('0xd')](_0x91c1('0x2b'),_0x2c8246);logger[_0x91c1('0x1b')](_0x91c1('0x2b'),_0x2c8246,JSON[_0x91c1('0xf')](_0x19a089));_0x3be536(_0x19a089);})[_0x91c1('0x14')](function(_0x1df721){logger[_0x91c1('0x10')]('AvgHandleTime',_0x1df721['message'],_0x2c8246);_0x1b8def(_0x348a6d[_0x91c1('0x10')](0x1f4,_0x1df721[_0x91c1('0x12')]));});});};exports[_0x91c1('0x2c')]=function(_0x1af47e){var _0x1a5454=this;return new Promise(function(_0x224278,_0x53ba8c){return db[_0x91c1('0x16')][_0x91c1('0x1c')]({'raw':_0x1af47e[_0x91c1('0x19')]?_0x1af47e[_0x91c1('0x19')][_0x91c1('0x1a')]===undefined?!![]:![]:!![],'where':_0x1af47e[_0x91c1('0x19')]?_0x1af47e[_0x91c1('0x19')][_0x91c1('0x2d')]||null:null,'attributes':[[_0x91c1('0x2e'),_0x91c1('0x2f')],[db['sequelize']['fn'](_0x91c1('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x91c1('0x20')](_0x91c1('0x30')))),_0x91c1('0x31')],[db[_0x91c1('0x1d')]['fn'](_0x91c1('0x1e'),db[_0x91c1('0x1d')]['fn']('IF',db[_0x91c1('0x1d')]['literal'](_0x91c1('0x32')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x91c1('0x1d')]['fn']('IF',db[_0x91c1('0x1d')][_0x91c1('0x20')](_0x91c1('0x21')))),_0x91c1('0x33')],[db[_0x91c1('0x1d')]['fn']('COUNT',db[_0x91c1('0x1d')]['fn']('IF',db[_0x91c1('0x1d')]['literal'](_0x91c1('0x34')))),_0x91c1('0x35')],[db[_0x91c1('0x1d')]['fn'](_0x91c1('0x1e'),db[_0x91c1('0x1d')]['fn']('IF',db[_0x91c1('0x1d')][_0x91c1('0x20')](_0x91c1('0x36')))),_0x91c1('0x37')],[db[_0x91c1('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x91c1('0x38')))),_0x91c1('0x39')],[db[_0x91c1('0x1d')]['fn']('COUNT',db[_0x91c1('0x1d')]['fn']('IF',db[_0x91c1('0x1d')][_0x91c1('0x20')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x91c1('0x3a')],[db[_0x91c1('0x1d')]['fn'](_0x91c1('0x1e'),db[_0x91c1('0x1d')]['fn']('IF',db['sequelize'][_0x91c1('0x20')](_0x91c1('0x3b')))),_0x91c1('0x3c')],[db['sequelize']['fn'](_0x91c1('0x1e'),db[_0x91c1('0x1d')]['fn']('IF',db['sequelize'][_0x91c1('0x20')]('`state`\x20=\x2013,\x201,\x20null'))),_0x91c1('0x3d')],[db[_0x91c1('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x91c1('0x20')](_0x91c1('0x3e')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0x91c1('0x1e'),db[_0x91c1('0x1d')]['fn']('IF',db[_0x91c1('0x1d')][_0x91c1('0x20')](_0x91c1('0x3f')))),_0x91c1('0x40')],[db[_0x91c1('0x1d')]['fn'](_0x91c1('0x1e'),db[_0x91c1('0x1d')]['fn']('IF',db[_0x91c1('0x1d')][_0x91c1('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),_0x91c1('0x41')],[db[_0x91c1('0x1d')]['fn']('COUNT',db[_0x91c1('0x1d')]['fn']('IF',db[_0x91c1('0x1d')][_0x91c1('0x20')](_0x91c1('0x42')))),_0x91c1('0x40')],[db[_0x91c1('0x1d')]['fn'](_0x91c1('0x1e'),db[_0x91c1('0x1d')]['fn']('IF',db[_0x91c1('0x1d')][_0x91c1('0x20')](_0x91c1('0x43')))),_0x91c1('0x44')]],'group':[_0x91c1('0x2e')]})[_0x91c1('0xc')](function(_0x56113e){logger[_0x91c1('0xd')]('GetVoiceQueueHopperHistory',_0x1af47e);logger[_0x91c1('0x1b')](_0x91c1('0x2c'),_0x1af47e,JSON[_0x91c1('0xf')](_0x56113e));_0x224278(_0x56113e);})[_0x91c1('0x14')](function(_0x34191a){logger[_0x91c1('0x10')](_0x91c1('0x2c'),_0x34191a[_0x91c1('0x12')],_0x1af47e);_0x53ba8c(_0x1a5454[_0x91c1('0x10')](0x1f4,_0x34191a[_0x91c1('0x12')]));});});};exports[_0x91c1('0x45')]=function(_0x470aaf){var _0x208612=this;return new Promise(function(_0x482425,_0x4d0cfb){return db[_0x91c1('0x16')][_0x91c1('0x1c')]({'raw':_0x470aaf[_0x91c1('0x19')]?_0x470aaf[_0x91c1('0x19')][_0x91c1('0x1a')]===undefined?!![]:![]:!![],'where':_0x470aaf[_0x91c1('0x19')]?_0x470aaf[_0x91c1('0x19')][_0x91c1('0x2d')]||null:null,'attributes':[[_0x91c1('0x2e'),_0x91c1('0x2f')],[db['sequelize']['fn'](_0x91c1('0x1e'),db[_0x91c1('0x1d')][_0x91c1('0x46')]('id')),_0x91c1('0x47')],[db[_0x91c1('0x1d')]['fn'](_0x91c1('0x1e'),db['sequelize']['fn']('IF',db[_0x91c1('0x1d')][_0x91c1('0x20')](_0x91c1('0x21')))),'ivrAnswerCallsDay']],'group':[_0x91c1('0x2e')]})[_0x91c1('0xc')](function(_0x54c987){logger[_0x91c1('0xd')](_0x91c1('0x45'),_0x470aaf);logger[_0x91c1('0x1b')](_0x91c1('0x45'),_0x470aaf,JSON[_0x91c1('0xf')](_0x54c987));_0x482425(_0x54c987);})[_0x91c1('0x14')](function(_0x14a772){logger[_0x91c1('0x10')](_0x91c1('0x45'),_0x14a772['message'],_0x470aaf);_0x4d0cfb(_0x208612[_0x91c1('0x10')](0x1f4,_0x14a772['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index cccc183..40bf1e1 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 _0x71aa=['get','post','create','put','/:id','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe'];(function(_0x19a4b3,_0x466f62){var _0x49bfe7=function(_0x41107b){while(--_0x41107b){_0x19a4b3['push'](_0x19a4b3['shift']());}};_0x49bfe7(++_0x466f62);}(_0x71aa,0x11f));var _0xa71a=function(_0x51eb91,_0x4799d5){_0x51eb91=_0x51eb91-0x0;var _0x1c4fc4=_0x71aa[_0x51eb91];return _0x1c4fc4;};'use strict';var multer=require(_0xa71a('0x0'));var util=require(_0xa71a('0x1'));var path=require(_0xa71a('0x2'));var timeout=require(_0xa71a('0x3'));var express=require(_0xa71a('0x4'));var router=express['Router']();var fs_extra=require(_0xa71a('0x5'));var auth=require(_0xa71a('0x6'));var interaction=require(_0xa71a('0x7'));var config=require(_0xa71a('0x8'));var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0xa71a('0x9')](),controller[_0xa71a('0xa')]);router['get'](_0xa71a('0xb'),auth[_0xa71a('0x9')](),controller[_0xa71a('0xc')]);router[_0xa71a('0xd')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa71a('0xe')]('/',auth[_0xa71a('0x9')](),controller[_0xa71a('0xf')]);router[_0xa71a('0x10')](_0xa71a('0x11'),auth[_0xa71a('0x9')](),controller[_0xa71a('0x12')]);module[_0xa71a('0x13')]=router; \ No newline at end of file +var _0xdb01=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','post','put','/:id','update','exports','util','path'];(function(_0x4349f1,_0x42b5c1){var _0x57f9bd=function(_0x294b55){while(--_0x294b55){_0x4349f1['push'](_0x4349f1['shift']());}};_0x57f9bd(++_0x42b5c1);}(_0xdb01,0xa0));var _0x1db0=function(_0x14102c,_0x1cb214){_0x14102c=_0x14102c-0x0;var _0x13297b=_0xdb01[_0x14102c];return _0x13297b;};'use strict';var multer=require('multer');var util=require(_0x1db0('0x0'));var path=require(_0x1db0('0x1'));var timeout=require(_0x1db0('0x2'));var express=require(_0x1db0('0x3'));var router=express[_0x1db0('0x4')]();var fs_extra=require(_0x1db0('0x5'));var auth=require(_0x1db0('0x6'));var interaction=require(_0x1db0('0x7'));var config=require(_0x1db0('0x8'));var controller=require('./cmHopperHistory.controller');router[_0x1db0('0x9')]('/',auth[_0x1db0('0xa')](),controller[_0x1db0('0xb')]);router[_0x1db0('0x9')](_0x1db0('0xc'),auth[_0x1db0('0xa')](),controller['describe']);router['get']('/:id',auth[_0x1db0('0xa')](),controller['show']);router[_0x1db0('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1db0('0xe')](_0x1db0('0xf'),auth[_0x1db0('0xa')](),controller[_0x1db0('0x10')]);module[_0x1db0('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 595ed30..4073370 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 _0xecd5=['STRING','name','exports'];(function(_0x4725cf,_0x43d9c0){var _0x53415d=function(_0x174bd9){while(--_0x174bd9){_0x4725cf['push'](_0x4725cf['shift']());}};_0x53415d(++_0x43d9c0);}(_0xecd5,0x110));var _0x5ecd=function(_0x57e981,_0x301655){_0x57e981=_0x57e981-0x0;var _0x18a83c=_0xecd5[_0x57e981];return _0x18a83c;};'use strict';var Sequelize=require('sequelize');module[_0x5ecd('0x0')]={'name':{'type':Sequelize[_0x5ecd('0x1')],'unique':_0x5ecd('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x5ecd('0x1')]}}; \ No newline at end of file +var _0x4f99=['exports','name','STRING','sequelize'];(function(_0x31a7c7,_0x5136b2){var _0x9092a7=function(_0x33052c){while(--_0x33052c){_0x31a7c7['push'](_0x31a7c7['shift']());}};_0x9092a7(++_0x5136b2);}(_0x4f99,0x157));var _0x94f9=function(_0x3b3dcb,_0x6ff907){_0x3b3dcb=_0x3b3dcb-0x0;var _0x3d43cc=_0x4f99[_0x3b3dcb];return _0x3d43cc;};'use strict';var Sequelize=require(_0x94f9('0x0'));module[_0x94f9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x94f9('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x94f9('0x3')]},'dialPrefix':{'type':Sequelize[_0x94f9('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 58bc27b..2b1883b 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 _0xe42a=['sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','name','send','index','map','CmList','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','findOne','Disposition','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','each','omit','success','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','cf_%d','getContactsCsv','ContactItemType','OrderBy','alias','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','c.cf_','customField_','field','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','addCustomField','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','addColumn','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','message','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register'];(function(_0xe99253,_0x3a3b1e){var _0x2b5bd7=function(_0x1151b2){while(--_0x1151b2){_0xe99253['push'](_0xe99253['shift']());}};_0x2b5bd7(++_0x3a3b1e);}(_0xe42a,0x131));var _0xae42=function(_0x411502,_0x239229){_0x411502=_0x411502-0x0;var _0xad2f4e=_0xe42a[_0x411502];return _0xad2f4e;};'use strict';var emlformat=require(_0xae42('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xae42('0x1'));var jsonpatch=require(_0xae42('0x2'));var rp=require(_0xae42('0x3'));var moment=require(_0xae42('0x4'));var BPromise=require(_0xae42('0x5'));var Mustache=require(_0xae42('0x6'));var util=require(_0xae42('0x7'));var path=require(_0xae42('0x8'));var sox=require(_0xae42('0x9'));var csv=require(_0xae42('0xa'));var ejs=require(_0xae42('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae42('0xc'));var squel=require('squel');var crypto=require(_0xae42('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xae42('0xe'));var toCsv=require(_0xae42('0xa'));var querystring=require('querystring');var Papa=require(_0xae42('0xf'));var Redis=require(_0xae42('0x10'));var authService=require(_0xae42('0x11'));var qs=require(_0xae42('0x12'));var as=require(_0xae42('0x13'));var hardwareService=require(_0xae42('0x14'));var logger=require(_0xae42('0x15'))('api');var utils=require(_0xae42('0x16'));var config=require(_0xae42('0x17'));var licenseUtil=require(_0xae42('0x18'));var db=require(_0xae42('0x19'))['db'];var csv_results;config[_0xae42('0x1a')]=_[_0xae42('0x1b')](config[_0xae42('0x1a')],{'host':_0xae42('0x1c'),'port':0x18eb});var socket=require(_0xae42('0x1d'))(new Redis(config[_0xae42('0x1a')]));require('./cmList.socket')[_0xae42('0x1e')](socket);function respondWithStatusCode(_0x10867a,_0x47a0bf){_0x47a0bf=_0x47a0bf||0xcc;return function(_0x14bc35){if(_0x14bc35){return _0x10867a[_0xae42('0x1f')](_0x47a0bf);}return _0x10867a[_0xae42('0x20')](_0x47a0bf)[_0xae42('0x21')]();};}function respondWithResult(_0xfb032d,_0x587cde){_0x587cde=_0x587cde||0xc8;return function(_0x86556f){if(_0x86556f){return _0xfb032d['status'](_0x587cde)[_0xae42('0x22')](_0x86556f);}};}function respondWithFilteredResult(_0x3a2204,_0x1a8983){return function(_0x2d3973){if(_0x2d3973){var _0x541541=typeof _0x1a8983['offset']===_0xae42('0x23')&&typeof _0x1a8983['limit']===_0xae42('0x23');var _0x4deec8=_0x2d3973[_0xae42('0x24')];var _0x4f6800=_0x541541?0x0:_0x1a8983[_0xae42('0x25')];var _0x17793d=_0x541541?_0x2d3973[_0xae42('0x24')]:_0x1a8983[_0xae42('0x25')]+_0x1a8983[_0xae42('0x26')];var _0x355714;if(_0x17793d>=_0x4deec8){_0x17793d=_0x4deec8;_0x355714=0xc8;}else{_0x355714=0xce;}_0x3a2204[_0xae42('0x20')](_0x355714);return _0x3a2204['set'](_0xae42('0x27'),_0x4f6800+'-'+_0x17793d+'/'+_0x4deec8)['json'](_0x2d3973);}return null;};}function patchUpdates(_0x17334a){return function(_0x50a8d0){try{jsonpatch['apply'](_0x50a8d0,_0x17334a,!![]);}catch(_0x4b8794){return BPromise[_0xae42('0x28')](_0x4b8794);}return _0x50a8d0[_0xae42('0x29')]();};}function saveUpdates(_0xc2d7c1,_0x284c2d){return function(_0xfba59){if(_0xfba59){return _0xfba59[_0xae42('0x2a')](_0xc2d7c1)[_0xae42('0x2b')](function(_0xe5379b){return _0xe5379b;});}return null;};}function removeEntity(_0x42ab91,_0x4ef58e){return function(_0x42fc11){if(_0x42fc11){return _0x42fc11[_0xae42('0x2c')]()[_0xae42('0x2b')](function(){var _0x248a1f=_0x42fc11[_0xae42('0x2d')]({'plain':!![]});var _0x168733=_0xae42('0x2e');return db[_0xae42('0x2f')][_0xae42('0x2c')]({'where':{'type':_0x168733,'resourceId':_0x248a1f['id']}})[_0xae42('0x2b')](function(){return _0x42fc11;});})[_0xae42('0x2b')](function(){_0x42ab91[_0xae42('0x20')](0xcc)[_0xae42('0x21')]();});}};}function handleEntityNotFound(_0x5e28ab,_0x2a49d4){return function(_0x470f51){if(!_0x470f51){_0x5e28ab[_0xae42('0x1f')](0x194);}return _0x470f51;};}function handleError(_0x3e1e39,_0x494e66){_0x494e66=_0x494e66||0x1f4;return function(_0x4381b2){logger[_0xae42('0x30')](_0x4381b2['stack']);if(_0x4381b2[_0xae42('0x31')]){delete _0x4381b2[_0xae42('0x31')];}_0x3e1e39[_0xae42('0x20')](_0x494e66)[_0xae42('0x32')](_0x4381b2);};}exports[_0xae42('0x33')]=function(_0x5db227,_0x25ffc9){var _0x7b094={},_0x5b15a6={},_0x5b5547={'count':0x0,'rows':[]};var _0x371c38=_[_0xae42('0x34')](db[_0xae42('0x35')][_0xae42('0x36')],function(_0x562022){return{'name':_0x562022[_0xae42('0x37')],'type':_0x562022[_0xae42('0x38')][_0xae42('0x39')]};});_0x5b15a6['model']=_[_0xae42('0x34')](_0x371c38,'name');_0x5b15a6[_0xae42('0x3a')]=_[_0xae42('0x3b')](_0x5db227[_0xae42('0x3a')]);_0x5b15a6[_0xae42('0x3c')]=_[_0xae42('0x3d')](_0x5b15a6['model'],_0x5b15a6[_0xae42('0x3a')]);_0x7b094[_0xae42('0x3e')]=_[_0xae42('0x3d')](_0x5b15a6[_0xae42('0x3f')],qs[_0xae42('0x40')](_0x5db227[_0xae42('0x3a')][_0xae42('0x40')]));_0x7b094['attributes']=_0x7b094[_0xae42('0x3e')][_0xae42('0x41')]?_0x7b094['attributes']:_0x5b15a6['model'];if(!_0x5db227[_0xae42('0x3a')][_0xae42('0x42')](_0xae42('0x43'))){_0x7b094[_0xae42('0x26')]=qs[_0xae42('0x26')](_0x5db227['query'][_0xae42('0x26')]);_0x7b094[_0xae42('0x25')]=qs[_0xae42('0x25')](_0x5db227[_0xae42('0x3a')][_0xae42('0x25')]);}_0x7b094[_0xae42('0x44')]=qs[_0xae42('0x45')](_0x5db227[_0xae42('0x3a')][_0xae42('0x45')]);_0x7b094[_0xae42('0x46')]=qs[_0xae42('0x3c')](_[_0xae42('0x47')](_0x5db227['query'],_0x5b15a6['filters']),_0x371c38);if(_0x5db227['query']['filter']){_0x7b094['where']=_['merge'](_0x7b094[_0xae42('0x46')],{'$or':_[_0xae42('0x34')](_0x371c38,function(_0x1f4de8){if(_0x1f4de8[_0xae42('0x38')]!=='VIRTUAL'){var _0x2a22b9={};_0x2a22b9[_0x1f4de8['name']]={'$like':'%'+_0x5db227[_0xae42('0x3a')][_0xae42('0x48')]+'%'};return _0x2a22b9;}})});}_0x7b094=_[_0xae42('0x49')]({},_0x7b094,_0x5db227[_0xae42('0x4a')]);var _0x2d185d={'where':_0x7b094[_0xae42('0x46')]};return db[_0xae42('0x35')][_0xae42('0x24')](_0x2d185d)[_0xae42('0x2b')](function(_0x58795d){_0x5b5547[_0xae42('0x24')]=_0x58795d;if(_0x5db227['query'][_0xae42('0x4b')]){_0x7b094[_0xae42('0x4c')]=[{'all':!![]}];}return db[_0xae42('0x35')][_0xae42('0x4d')](_0x7b094);})[_0xae42('0x2b')](function(_0x4498f7){_0x5b5547[_0xae42('0x4e')]=_0x4498f7;return _0x5b5547;})[_0xae42('0x2b')](respondWithFilteredResult(_0x25ffc9,_0x7b094))['catch'](handleError(_0x25ffc9,null));};exports[_0xae42('0x4f')]=function(_0x20d42f,_0xa0707){var _0x4a4ccf={'raw':![],'where':{'id':_0x20d42f[_0xae42('0x50')]['id']}},_0xdc5cdf={};_0xdc5cdf[_0xae42('0x3f')]=_['keys'](db['CmList']['rawAttributes']);_0xdc5cdf[_0xae42('0x3a')]=_[_0xae42('0x3b')](_0x20d42f['query']);_0xdc5cdf[_0xae42('0x3c')]=_[_0xae42('0x3d')](_0xdc5cdf[_0xae42('0x3f')],_0xdc5cdf[_0xae42('0x3a')]);_0x4a4ccf['attributes']=_[_0xae42('0x3d')](_0xdc5cdf[_0xae42('0x3f')],qs[_0xae42('0x40')](_0x20d42f['query'][_0xae42('0x40')]));_0x4a4ccf[_0xae42('0x3e')]=_0x4a4ccf[_0xae42('0x3e')][_0xae42('0x41')]?_0x4a4ccf['attributes']:_0xdc5cdf[_0xae42('0x3f')];if(_0x20d42f['query'][_0xae42('0x4b')]){_0x4a4ccf[_0xae42('0x4c')]=[{'all':!![]}];}_0x4a4ccf=_[_0xae42('0x49')]({},_0x4a4ccf,_0x20d42f['options']);return db[_0xae42('0x35')]['find'](_0x4a4ccf)[_0xae42('0x2b')](handleEntityNotFound(_0xa0707,null))[_0xae42('0x2b')](respondWithResult(_0xa0707,null))[_0xae42('0x51')](handleError(_0xa0707,null));};exports['create']=function(_0xa5dece,_0xaba34c){return db[_0xae42('0x35')]['create'](_0xa5dece[_0xae42('0x52')],{})[_0xae42('0x2b')](function(_0x50b0ef){var _0x1b611b=_0xa5dece['user'][_0xae42('0x2d')]({'plain':!![]});if(!_0x1b611b)throw new Error(_0xae42('0x53'));if(_0x1b611b[_0xae42('0x54')]==='user'){var _0x5af0f9=_0x50b0ef[_0xae42('0x2d')]({'plain':!![]});var _0x5cd704=_0xae42('0x2e');return db[_0xae42('0x55')][_0xae42('0x56')]({'where':{'name':_0x5cd704,'userProfileId':_0x1b611b[_0xae42('0x57')]},'raw':!![]})[_0xae42('0x2b')](function(_0x201121){if(_0x201121&&_0x201121[_0xae42('0x58')]===0x0){return db[_0xae42('0x2f')][_0xae42('0x59')]({'name':_0x5af0f9[_0xae42('0x31')],'resourceId':_0x5af0f9['id'],'type':_0x201121['name'],'sectionId':_0x201121['id']},{})[_0xae42('0x2b')](function(){return _0x50b0ef;});}else{return _0x50b0ef;}})[_0xae42('0x51')](function(_0x2467d2){logger[_0xae42('0x30')](_0xae42('0x5a'),_0x2467d2);throw _0x2467d2;});}return _0x50b0ef;})[_0xae42('0x2b')](respondWithResult(_0xaba34c,0xc9))[_0xae42('0x51')](handleError(_0xaba34c,null));};exports[_0xae42('0x2a')]=function(_0x305c54,_0x268b59){if(_0x305c54[_0xae42('0x52')]['id']){delete _0x305c54[_0xae42('0x52')]['id'];}return db[_0xae42('0x35')][_0xae42('0x56')]({'where':{'id':_0x305c54[_0xae42('0x50')]['id']}})[_0xae42('0x2b')](handleEntityNotFound(_0x268b59,null))[_0xae42('0x2b')](saveUpdates(_0x305c54[_0xae42('0x52')],null))[_0xae42('0x2b')](respondWithResult(_0x268b59,null))[_0xae42('0x51')](handleError(_0x268b59,null));};exports[_0xae42('0x2c')]=function(_0x457a0a,_0x1d0c65){return db[_0xae42('0x35')]['find']({'where':{'id':_0x457a0a[_0xae42('0x50')]['id']}})[_0xae42('0x2b')](handleEntityNotFound(_0x1d0c65,null))['then'](removeEntity(_0x1d0c65,null))[_0xae42('0x51')](handleError(_0x1d0c65,null));};exports[_0xae42('0x5b')]=function(_0x2658b5,_0x6656a7){return db[_0xae42('0x35')][_0xae42('0x5b')]()[_0xae42('0x2b')](respondWithResult(_0x6656a7,null))['catch'](handleError(_0x6656a7,null));};exports[_0xae42('0x5c')]=function(_0x58baee,_0x54a2d4,_0x507bc5){if(_0x58baee['body']['id']){delete _0x58baee['body']['id'];}return db[_0xae42('0x35')][_0xae42('0x56')]({'where':{'id':_0x58baee['params']['id']}})[_0xae42('0x2b')](handleEntityNotFound(_0x54a2d4,null))[_0xae42('0x2b')](function(_0x394651){if(_0x394651){_0x58baee['body'][_0xae42('0x5d')]=_0x394651['id'];return db['Disposition'][_0xae42('0x59')](_0x58baee['body']);}})[_0xae42('0x2b')](respondWithResult(_0x54a2d4,null))[_0xae42('0x51')](handleError(_0x54a2d4,null));};exports['getDispositions']=function(_0x43cdc7,_0x5a867a,_0x55fd39){var _0x333ebd={'raw':![],'where':{}};var _0x31b960={};var _0x3e883f={'count':0x0,'rows':[]};return db[_0xae42('0x35')][_0xae42('0x5e')]({'where':{'id':_0x43cdc7[_0xae42('0x50')]['id']}})[_0xae42('0x2b')](handleEntityNotFound(_0x5a867a,null))[_0xae42('0x2b')](function(_0x1cfc66){if(_0x1cfc66){_0x31b960[_0xae42('0x3f')]=_['keys'](db[_0xae42('0x5f')][_0xae42('0x36')]);_0x31b960['query']=_['keys'](_0x43cdc7[_0xae42('0x3a')]);_0x31b960[_0xae42('0x3c')]=_['intersection'](_0x31b960['model'],_0x31b960[_0xae42('0x3a')]);_0x333ebd[_0xae42('0x3e')]=_['intersection'](_0x31b960[_0xae42('0x3f')],qs[_0xae42('0x40')](_0x43cdc7['query'][_0xae42('0x40')]));_0x333ebd[_0xae42('0x3e')]=_0x333ebd[_0xae42('0x3e')][_0xae42('0x41')]?_0x333ebd[_0xae42('0x3e')]:_0x31b960[_0xae42('0x3f')];if(!_0x43cdc7['query']['hasOwnProperty'](_0xae42('0x43'))){_0x333ebd[_0xae42('0x26')]=qs[_0xae42('0x26')](_0x43cdc7[_0xae42('0x3a')][_0xae42('0x26')]);_0x333ebd[_0xae42('0x25')]=qs[_0xae42('0x25')](_0x43cdc7[_0xae42('0x3a')][_0xae42('0x25')]);}_0x333ebd[_0xae42('0x44')]=qs['sort'](_0x43cdc7[_0xae42('0x3a')][_0xae42('0x45')]);_0x333ebd['where']=qs[_0xae42('0x3c')](_['pick'](_0x43cdc7[_0xae42('0x3a')],_0x31b960['filters']));_0x333ebd[_0xae42('0x46')][_0xae42('0x5d')]=_0x1cfc66['id'];if(_0x43cdc7[_0xae42('0x3a')]['filter']){_0x333ebd[_0xae42('0x46')]=_['merge'](_0x333ebd[_0xae42('0x46')],{'$or':_[_0xae42('0x34')](_0x333ebd[_0xae42('0x3e')],function(_0x2fd28e){var _0x37c460={};_0x37c460[_0x2fd28e]={'$like':'%'+_0x43cdc7[_0xae42('0x3a')]['filter']+'%'};return _0x37c460;})});}_0x333ebd=_['merge']({},_0x333ebd,_0x43cdc7[_0xae42('0x4a')]);return db[_0xae42('0x5f')][_0xae42('0x24')]({'where':_0x333ebd[_0xae42('0x46')]})['then'](function(_0x58c629){_0x3e883f['count']=_0x58c629;if(_0x43cdc7[_0xae42('0x3a')][_0xae42('0x4b')]){_0x333ebd[_0xae42('0x4c')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x333ebd);})[_0xae42('0x2b')](function(_0x3ca918){_0x3e883f[_0xae42('0x4e')]=_0x3ca918;return _0x3e883f;});}})[_0xae42('0x2b')](respondWithFilteredResult(_0x5a867a,_0x333ebd))[_0xae42('0x51')](handleError(_0x5a867a,null));};exports[_0xae42('0x60')]=function(_0x4ff9de,_0x2db1c0,_0x3c3a2d){return db[_0xae42('0x35')][_0xae42('0x56')]({'where':{'id':_0x4ff9de[_0xae42('0x50')]['id']}})[_0xae42('0x2b')](handleEntityNotFound(_0x2db1c0,null))[_0xae42('0x2b')](function(_0x3747fe){if(_0x3747fe){return _0x3747fe[_0xae42('0x60')](_0x4ff9de[_0xae42('0x3a')][_0xae42('0x61')]);}})[_0xae42('0x2b')](respondWithStatusCode(_0x2db1c0,null))['catch'](handleError(_0x2db1c0,null));};exports[_0xae42('0x62')]=function(_0x1f3413,_0x4c6bbf,_0x188791){return db['CmList'][_0xae42('0x56')]({'where':{'id':_0x1f3413[_0xae42('0x50')]['id']}})[_0xae42('0x2b')](handleEntityNotFound(_0x4c6bbf,null))[_0xae42('0x2b')](function(_0x5bbe31){if(_0x5bbe31){var _0xfed015=[];var _0xdb8ebf={'success':[],'errors':[]};return db[_0xae42('0x63')]['describe']()[_0xae42('0x2b')](function(_0x1545a5){if(_0x1f3413[_0xae42('0x52')][_0xae42('0x64')]&&_['isArray'](_0x1f3413[_0xae42('0x52')]['tags'])){if(_0x1f3413[_0xae42('0x52')][_0xae42('0x64')][_0xae42('0x41')]){_0x1f3413[_0xae42('0x52')][_0xae42('0x64')]=_0x1f3413[_0xae42('0x52')][_0xae42('0x64')][_0xae42('0x65')](';')+';';}else{_0x1f3413[_0xae42('0x52')][_0xae42('0x64')]=null;}}else{_0x1f3413[_0xae42('0x52')]['tags']=null;}if(_0x1f3413[_0xae42('0x52')]&&_[_0xae42('0x66')](_0x1f3413[_0xae42('0x52')])){for(var _0x2b8c75=0x0;_0x2b8c75<_0x1f3413[_0xae42('0x52')][_0xae42('0x41')];_0x2b8c75+=0x1){_0x1f3413[_0xae42('0x52')][_0x2b8c75][_0xae42('0x5d')]=_0x1f3413[_0xae42('0x50')]['id'];_0xfed015[_0xae42('0x67')](_0x1f3413['body'][_0x2b8c75]);}return BPromise[_0xae42('0x68')](_0xfed015,function(_0x1d0afc){return db[_0xae42('0x63')][_0xae42('0x59')](_[_0xae42('0x69')](_0x1d0afc,['ids','id'])||{},{'fields':_[_0xae42('0x3b')](_0x1545a5),'raw':!![]})[_0xae42('0x2b')](function(_0x2b8e1f){_0xdb8ebf[_0xae42('0x6a')][_0xae42('0x67')](_0x2b8e1f['dataValues']);})[_0xae42('0x51')](function(_0x253c01){_0xdb8ebf[_0xae42('0x6b')][_0xae42('0x67')]({'data':_0x1d0afc,'error':_0x253c01['message']});});})[_0xae42('0x2b')](function(_0x32e6c3){return _0xdb8ebf;})[_0xae42('0x51')](function(_0x955092){return _0x955092;});}else{_0x4c6bbf[_0xae42('0x20')](0x190)[_0xae42('0x22')]({'message':_0xae42('0x6c')});}});}})[_0xae42('0x2b')](respondWithResult(_0x4c6bbf,null))[_0xae42('0x51')](handleError(_0x4c6bbf,null));};exports[_0xae42('0x6d')]=function(_0x4a105c,_0x416554,_0x18ed88){var _0x54910a;return db['CmList'][_0xae42('0x56')]({'where':{'id':_0x4a105c[_0xae42('0x50')]['id']},'include':[{'model':db[_0xae42('0x6e')],'as':'CustomFields'}]})[_0xae42('0x2b')](handleEntityNotFound(_0x416554,null))[_0xae42('0x2b')](function(_0x4f366b){if(_0x4f366b){_0x54910a=_0x4f366b;return db[_0xae42('0x63')]['rawAttributes'];}})[_0xae42('0x2b')](function(_0x51c067){if(_0x51c067){var _0x1c9bd7={};var _0x26d680={};_0x26d680[_0xae42('0x3f')]=_[_0xae42('0x6f')](_[_0xae42('0x3b')](_0x51c067),_[_0xae42('0x34')](_0x54910a[_0xae42('0x70')],function(_0x345836){return util['format'](_0xae42('0x71'),_0x345836['id']);}));_0x26d680['query']=_[_0xae42('0x3b')](_0x4a105c[_0xae42('0x3a')]);_0x26d680['filters']=_[_0xae42('0x3d')](_0x26d680[_0xae42('0x3f')],_0x26d680[_0xae42('0x3a')]);_0x1c9bd7[_0xae42('0x3e')]=_[_0xae42('0x3d')](_0x26d680['model'],qs[_0xae42('0x40')](_0x4a105c[_0xae42('0x3a')][_0xae42('0x40')]));_0x1c9bd7[_0xae42('0x3e')]=_0x1c9bd7[_0xae42('0x3e')][_0xae42('0x41')]?_0x1c9bd7['attributes']:_0x26d680[_0xae42('0x3f')];if(!_0x4a105c['query'][_0xae42('0x42')](_0xae42('0x43'))){_0x1c9bd7[_0xae42('0x26')]=qs[_0xae42('0x26')](_0x4a105c[_0xae42('0x3a')][_0xae42('0x26')]);_0x1c9bd7['offset']=qs['offset'](_0x4a105c['query'][_0xae42('0x25')]);}_0x1c9bd7[_0xae42('0x44')]=qs['sort'](_0x4a105c[_0xae42('0x3a')][_0xae42('0x45')]);_0x1c9bd7[_0xae42('0x46')]=qs[_0xae42('0x3c')](_[_0xae42('0x47')](_0x4a105c[_0xae42('0x3a')],_0x26d680[_0xae42('0x3c')]));_0x1c9bd7['raw']=!![];if(_0x4a105c[_0xae42('0x3a')][_0xae42('0x48')]){_0x1c9bd7[_0xae42('0x46')]=_['merge'](_0x1c9bd7[_0xae42('0x46')],{'$or':_['map'](_0x1c9bd7['attributes'],function(_0x426fb8){var _0x2822f2={};_0x2822f2[_0x426fb8]={'$like':'%'+_0x4a105c[_0xae42('0x3a')][_0xae42('0x48')]+'%'};return _0x2822f2;})});}_0x1c9bd7=_[_0xae42('0x49')]({},_0x1c9bd7,_0x4a105c[_0xae42('0x4a')]);return _0x54910a[_0xae42('0x6d')](_0x1c9bd7);}})['then'](respondWithResult(_0x416554,null))[_0xae42('0x51')](handleError(_0x416554,null));};exports[_0xae42('0x72')]=function(_0x1ace46,_0x15c6c0,_0x491fb8){var _0x1824f7;var _0x3ddfa6;var _0x568977;var _0x4b3628=_0x1ace46[_0xae42('0x50')]['id'];csv_results=[];return db[_0xae42('0x73')]['findAll']({'attributes':['id',_0xae42('0x31')],'raw':!![],'order':[_0xae42('0x74')]})[_0xae42('0x2b')](function(_0x4e027d){_0x1824f7=_0x4e027d;var _0x23b127=_[_0xae42('0x3b')](db[_0xae42('0x63')][_0xae42('0x36')]);return db[_0xae42('0x6e')]['findAll']({'raw':!![],'attributes':['id',_0xae42('0x75')]})[_0xae42('0x2b')](function(_0x6c698b){_0x3ddfa6=_0x6c698b;var _0x3d754b=squel[_0xae42('0x76')]()[_0xae42('0x40')](_0x23b127)['from'](_0xae42('0x77'),'c')[_0xae42('0x46')](_0xae42('0x78'),_0x4b3628)[_0xae42('0x46')](_0xae42('0x79'))[_0xae42('0x7a')]();for(var _0x6a8400=0x0;_0x6a8400<_0x3ddfa6[_0xae42('0x41')];_0x6a8400++){_0x3d754b['field'](_0xae42('0x7b')+_0x3ddfa6[_0x6a8400]['id'],_0xae42('0x7c')+_0x3ddfa6[_0x6a8400][_0xae42('0x75')]);}for(var _0x6a8400=0x0;_0x6a8400<_0x1824f7['length'];_0x6a8400++){_0x3d754b[_0xae42('0x7d')](squel['select']()[_0xae42('0x7d')](_0xae42('0x7e'))['from'](_0xae42('0x7f'))[_0xae42('0x46')](_0xae42('0x80'),_0x1824f7[_0x6a8400]['id'])[_0xae42('0x46')](_0xae42('0x81')),_0xae42('0x82')+_0x1824f7[_0x6a8400][_0xae42('0x31')]);_0x3d754b[_0xae42('0x7d')](squel[_0xae42('0x76')]()['field'](_0xae42('0x83'))['from'](_0xae42('0x7f'))[_0xae42('0x46')](_0xae42('0x80'),_0x1824f7[_0x6a8400]['id'])[_0xae42('0x46')](_0xae42('0x81')),_0xae42('0x84')+_0x1824f7[_0x6a8400]['name']);}var _0x4d2a84=[];_0x4d2a84['push'](_0x3d754b[_0xae42('0x85')]());BPromise[_0xae42('0x68')](_0x4d2a84,handleQuery)['then'](function(_0xa878de){handleQuery(_0x3d754b[_0xae42('0x85')]());var _0xc83db4=csv_results[0x0];if(!_[_0xae42('0x86')](_0xc83db4)){var _0x3a0c53=toCsv(_0xc83db4);var _0x56384b=Date[_0xae42('0x87')]();fs[_0xae42('0x88')](util[_0xae42('0x89')](_0xae42('0x8a'),_0x4b3628,_0x56384b),_0x3a0c53);_0x15c6c0[_0xae42('0x8b')](_0xae42('0x8c'),_0xae42('0x8d')+util[_0xae42('0x89')](_0xae42('0x8e'),_0x4b3628,_0x56384b));_0x15c6c0[_0xae42('0x8b')]('Content-type',_0xae42('0x8f'));return _0x15c6c0['download'](util[_0xae42('0x89')](_0xae42('0x8a'),_0x4b3628,_0x56384b));}else{return _0x15c6c0[_0xae42('0x1f')](0xcc);}});});});};exports[_0xae42('0x90')]=function(_0x3cc248,_0x5db80f,_0xa22fc0){var _0xc64982;delete _0x3cc248[_0xae42('0x52')]['id'];return db[_0xae42('0x35')][_0xae42('0x5e')]({'where':{'id':_0x3cc248[_0xae42('0x50')]['id']}})[_0xae42('0x2b')](handleEntityNotFound(_0x5db80f,null))['then'](function(_0x2e61b0){if(_0x2e61b0){return db[_0xae42('0x91')][_0xae42('0x92')](function(_0x3d0777){return db[_0xae42('0x6e')]['create'](_0x3cc248['body'],{'transaction':_0x3d0777})[_0xae42('0x2b')](function(_0x4ed741){_0xc64982=_0x4ed741;return _0x2e61b0['addCustomFields'](_0x4ed741,{'transaction':_0x3d0777});})[_0xae42('0x2b')](function(){var _0x4186fb={'type':db[_0xae42('0x93')][_0xae42('0x94')],'transaction':_0x3d0777};switch(_0x3cc248[_0xae42('0x52')][_0xae42('0x38')]){case _0xae42('0x95'):_0x4186fb[_0xae42('0x38')]=db[_0xae42('0x93')][_0xae42('0x94')];break;case _0xae42('0x96'):_0x4186fb[_0xae42('0x38')]=db[_0xae42('0x93')][_0xae42('0x97')];break;case _0xae42('0x98'):_0x4186fb[_0xae42('0x38')]=db[_0xae42('0x93')]['BOOLEAN'];_0x4186fb[_0xae42('0x99')]=![];break;default:}return db[_0xae42('0x91')][_0xae42('0x9a')][_0xae42('0x9b')](_0xae42('0x77'),util['format']('cf_%s',_0xc64982['id']),_0x4186fb);})[_0xae42('0x2b')](function(){return _0xc64982;});});}})[_0xae42('0x2b')](respondWithResult(_0x5db80f,null))[_0xae42('0x51')](handleError(_0x5db80f,null));};exports[_0xae42('0x9c')]=function(_0x7ee767,_0x42f1eb,_0x168792){var _0x36be09={};var _0x304a84={};var _0x4c5e4a;var _0x2ea6bf;return db['CmList'][_0xae42('0x5e')]({'where':{'id':_0x7ee767[_0xae42('0x50')]['id']}})[_0xae42('0x2b')](handleEntityNotFound(_0x42f1eb,null))[_0xae42('0x2b')](function(_0x40bae0){if(_0x40bae0){_0x4c5e4a=_0x40bae0;_0x304a84['model']=_['keys'](db['CmCustomField'][_0xae42('0x36')]);_0x304a84[_0xae42('0x3a')]=_[_0xae42('0x3b')](_0x7ee767[_0xae42('0x3a')]);_0x304a84[_0xae42('0x3c')]=_['intersection'](_0x304a84[_0xae42('0x3f')],_0x304a84[_0xae42('0x3a')]);_0x36be09[_0xae42('0x3e')]=_[_0xae42('0x3d')](_0x304a84[_0xae42('0x3f')],qs[_0xae42('0x40')](_0x7ee767[_0xae42('0x3a')]['fields']));_0x36be09[_0xae42('0x3e')]=_0x36be09[_0xae42('0x3e')][_0xae42('0x41')]?_0x36be09['attributes']:_0x304a84[_0xae42('0x3f')];_0x36be09[_0xae42('0x44')]=qs[_0xae42('0x45')](_0x7ee767['query'][_0xae42('0x45')]);_0x36be09[_0xae42('0x46')]=qs[_0xae42('0x3c')](_['pick'](_0x7ee767[_0xae42('0x3a')],_0x304a84['filters']));_0x36be09[_0xae42('0x46')]=_[_0xae42('0x49')](_0x36be09[_0xae42('0x46')],{'$or':[{'ListId':_0x40bae0['id']},{'ListId':null}]});if(_0x7ee767[_0xae42('0x3a')][_0xae42('0x48')]){_0x36be09[_0xae42('0x46')]=_['merge'](_0x36be09[_0xae42('0x46')],{'$or':_[_0xae42('0x34')](_0x36be09['attributes'],function(_0x4af7bd){var _0x4c82e0={};_0x4c82e0[_0x4af7bd]={'$like':'%'+_0x7ee767[_0xae42('0x3a')][_0xae42('0x48')]+'%'};return _0x4c82e0;})});}_0x36be09=_[_0xae42('0x49')]({},_0x36be09,_0x7ee767[_0xae42('0x4a')]);return db['CmCustomField'][_0xae42('0x9d')](_0x36be09);}})[_0xae42('0x2b')](respondWithResult(_0x42f1eb,null))[_0xae42('0x51')](handleError(_0x42f1eb,null));};exports[_0xae42('0x9e')]=function(_0x516c91,_0x487a81){return db[_0xae42('0x6e')][_0xae42('0x9d')]({'where':{'ListId':null}})[_0xae42('0x2b')](handleEntityNotFound(_0x487a81,null))['then'](function(_0x26953a){return _0x26953a;})['then'](respondWithResult(_0x487a81,null))[_0xae42('0x51')](handleError(_0x487a81,null));};exports[_0xae42('0x9f')]=function(_0x13af73,_0x1a720b,_0x178dd6){return db['CmList'][_0xae42('0x56')]({'where':{'id':_0x13af73[_0xae42('0x50')]['id']}})[_0xae42('0x2b')](handleEntityNotFound(_0x1a720b,null))['then'](function(_0x48efbb){if(_0x48efbb){return _0x48efbb[_0xae42('0x9f')](_0x13af73['body']['ids'],_[_0xae42('0x69')](_0x13af73[_0xae42('0x52')],[_0xae42('0x61'),'id'])||{})[_0xae42('0xa0')](function(_0x2dfb26){for(var _0x12adb7=0x0;_0x12adb7<_0x13af73['body'][_0xae42('0x61')][_0xae42('0x41')];_0x12adb7+=0x1){socket[_0xae42('0xa1')](_0xae42('0xa2'),{'UserId':Number(_0x13af73[_0xae42('0x52')][_0xae42('0x61')][_0x12adb7]),'CmListId':Number(_0x13af73[_0xae42('0x50')]['id'])});}return _0x2dfb26;});}})[_0xae42('0x2b')](respondWithResult(_0x1a720b,null))['catch'](handleError(_0x1a720b,null));};exports[_0xae42('0xa3')]=function(_0x270810,_0x5bf9d8,_0x1cbda8){return db[_0xae42('0x35')][_0xae42('0x56')]({'where':{'id':_0x270810[_0xae42('0x50')]['id']}})['then'](handleEntityNotFound(_0x5bf9d8,null))[_0xae42('0x2b')](function(_0x159993){if(_0x159993){return _0x159993['removeAgents'](_0x270810[_0xae42('0x3a')][_0xae42('0x61')])[_0xae42('0x2b')](function(){if(_[_0xae42('0x66')](_0x270810[_0xae42('0x3a')][_0xae42('0x61')])){for(var _0x415b4a=0x0;_0x415b4a<_0x270810[_0xae42('0x3a')][_0xae42('0x61')][_0xae42('0x41')];_0x415b4a+=0x1){socket['emit'](_0xae42('0xa4'),{'UserId':Number(_0x270810[_0xae42('0x3a')][_0xae42('0x61')][_0x415b4a]),'CmListId':Number(_0x270810['params']['id'])});}}else{socket[_0xae42('0xa1')](_0xae42('0xa4'),{'UserId':Number(_0x270810['query'][_0xae42('0x61')]),'CmListId':Number(_0x270810[_0xae42('0x50')]['id'])});}});}})[_0xae42('0x2b')](respondWithStatusCode(_0x5bf9d8,null))[_0xae42('0x51')](handleError(_0x5bf9d8,null));};exports[_0xae42('0xa5')]=function(_0x5c0115,_0x23df89,_0x2e5989){var _0x179ebf={};var _0x548800={};var _0x28a0e7;var _0x313915;return db[_0xae42('0x35')][_0xae42('0x5e')]({'where':{'id':_0x5c0115['params']['id']}})[_0xae42('0x2b')](handleEntityNotFound(_0x23df89,null))[_0xae42('0x2b')](function(_0x528f19){if(_0x528f19){_0x28a0e7=_0x528f19;_0x548800[_0xae42('0x3f')]=_['keys'](db['User'][_0xae42('0x36')]);_0x548800[_0xae42('0x3a')]=_['keys'](_0x5c0115[_0xae42('0x3a')]);_0x548800[_0xae42('0x3c')]=_['intersection'](_0x548800[_0xae42('0x3f')],_0x548800[_0xae42('0x3a')]);_0x179ebf[_0xae42('0x3e')]=_[_0xae42('0x3d')](_0x548800[_0xae42('0x3f')],qs[_0xae42('0x40')](_0x5c0115['query']['fields']));_0x179ebf['attributes']=_0x179ebf['attributes'][_0xae42('0x41')]?_0x179ebf[_0xae42('0x3e')]:_0x548800[_0xae42('0x3f')];_0x179ebf[_0xae42('0x44')]=qs['sort'](_0x5c0115[_0xae42('0x3a')]['sort']);_0x179ebf[_0xae42('0x46')]=qs[_0xae42('0x3c')](_[_0xae42('0x47')](_0x5c0115[_0xae42('0x3a')],_0x548800['filters']));if(_0x5c0115['query'][_0xae42('0x48')]){_0x179ebf[_0xae42('0x46')]=_[_0xae42('0x49')](_0x179ebf[_0xae42('0x46')],{'$or':_[_0xae42('0x34')](_0x179ebf[_0xae42('0x3e')],function(_0x1dd64c){var _0x29bc1f={};_0x29bc1f[_0x1dd64c]={'$like':'%'+_0x5c0115[_0xae42('0x3a')]['filter']+'%'};return _0x29bc1f;})});}_0x179ebf=_[_0xae42('0x49')]({},_0x179ebf,_0x5c0115['options']);return _0x28a0e7[_0xae42('0xa5')](_0x179ebf);}})[_0xae42('0x2b')](function(_0x5ee7ba){if(_0x5ee7ba){_0x313915=_0x5ee7ba[_0xae42('0x41')];if(!_0x5c0115['query'][_0xae42('0x42')](_0xae42('0x43'))){_0x179ebf[_0xae42('0x26')]=qs[_0xae42('0x26')](_0x5c0115[_0xae42('0x3a')]['limit']);_0x179ebf[_0xae42('0x25')]=qs[_0xae42('0x25')](_0x5c0115[_0xae42('0x3a')][_0xae42('0x25')]);}return _0x28a0e7[_0xae42('0xa5')](_0x179ebf);}})[_0xae42('0x2b')](function(_0x4e64f9){if(_0x4e64f9){return _0x4e64f9?{'count':_0x313915,'rows':_0x4e64f9}:null;}})['then'](respondWithResult(_0x23df89,null))[_0xae42('0x51')](handleError(_0x23df89,null));};function handleQuery(_0x5888cf){logger[_0xae42('0xa6')](_0x5888cf);return db[_0xae42('0x91')][_0xae42('0x3a')](_0x5888cf)[_0xae42('0xa0')](function(_0x1e0dd7){csv_results[_0xae42('0x67')](_0x1e0dd7);})[_0xae42('0x51')](function(_0x5dd1f2){logger['error'](_0x5dd1f2[_0xae42('0xa7')]);});} \ No newline at end of file +var _0xcabf=['limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','length','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','removeDispositions','tags','isArray','push','CmContact','create','omit','ids','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','nolimit','raw','getContactsCsv','OrderBy','alias','select','from','cm_contacts','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_','description','toString','each','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','text/csv','download','addCustomField','sequelize','transaction','Sequelize','TEXT','text','number','switch','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:remove','User','getAgents','message','eml-format','rimraf','moment','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Lists','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xcabf,0x102));var _0xfcab=function(_0x6e835b,_0xe977e1){_0x6e835b=_0x6e835b-0x0;var _0x1f6231=_0xcabf[_0x6e835b];return _0x1f6231;};'use strict';var emlformat=require(_0xfcab('0x0'));var rimraf=require(_0xfcab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfcab('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfcab('0x3'));var sox=require('sox');var csv=require(_0xfcab('0x4'));var ejs=require(_0xfcab('0x5'));var fs=require('fs');var fs_extra=require(_0xfcab('0x6'));var _=require('lodash');var squel=require(_0xfcab('0x7'));var crypto=require(_0xfcab('0x8'));var jsforce=require(_0xfcab('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xfcab('0x4'));var querystring=require(_0xfcab('0xa'));var Papa=require(_0xfcab('0xb'));var Redis=require(_0xfcab('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xfcab('0xd'));var as=require(_0xfcab('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfcab('0xf'))('api');var utils=require(_0xfcab('0x10'));var config=require(_0xfcab('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xfcab('0x12'))['db'];var csv_results;config[_0xfcab('0x13')]=_['defaults'](config['redis'],{'host':_0xfcab('0x14'),'port':0x18eb});var socket=require(_0xfcab('0x15'))(new Redis(config[_0xfcab('0x13')]));require(_0xfcab('0x16'))['register'](socket);function respondWithStatusCode(_0x5006b0,_0x45fda7){_0x45fda7=_0x45fda7||0xcc;return function(_0x1a88dd){if(_0x1a88dd){return _0x5006b0[_0xfcab('0x17')](_0x45fda7);}return _0x5006b0[_0xfcab('0x18')](_0x45fda7)[_0xfcab('0x19')]();};}function respondWithResult(_0x5057e5,_0x198fce){_0x198fce=_0x198fce||0xc8;return function(_0x3cd1d4){if(_0x3cd1d4){return _0x5057e5[_0xfcab('0x18')](_0x198fce)[_0xfcab('0x1a')](_0x3cd1d4);}};}function respondWithFilteredResult(_0x12bd97,_0x50ebd6){return function(_0x32da6e){if(_0x32da6e){var _0x340011=typeof _0x50ebd6[_0xfcab('0x1b')]===_0xfcab('0x1c')&&typeof _0x50ebd6['limit']===_0xfcab('0x1c');var _0x562f98=_0x32da6e['count'];var _0x485ff5=_0x340011?0x0:_0x50ebd6[_0xfcab('0x1b')];var _0x5cb321=_0x340011?_0x32da6e[_0xfcab('0x1d')]:_0x50ebd6['offset']+_0x50ebd6['limit'];var _0x303f06;if(_0x5cb321>=_0x562f98){_0x5cb321=_0x562f98;_0x303f06=0xc8;}else{_0x303f06=0xce;}_0x12bd97[_0xfcab('0x18')](_0x303f06);return _0x12bd97[_0xfcab('0x1e')](_0xfcab('0x1f'),_0x485ff5+'-'+_0x5cb321+'/'+_0x562f98)[_0xfcab('0x1a')](_0x32da6e);}return null;};}function patchUpdates(_0x50cb53){return function(_0x261bd5){try{jsonpatch[_0xfcab('0x20')](_0x261bd5,_0x50cb53,!![]);}catch(_0x4ce1c9){return BPromise[_0xfcab('0x21')](_0x4ce1c9);}return _0x261bd5[_0xfcab('0x22')]();};}function saveUpdates(_0x351fe8,_0x415d9e){return function(_0x2e7021){if(_0x2e7021){return _0x2e7021[_0xfcab('0x23')](_0x351fe8)[_0xfcab('0x24')](function(_0x21adb0){return _0x21adb0;});}return null;};}function removeEntity(_0x5ce6e3,_0x3f553a){return function(_0x479df4){if(_0x479df4){return _0x479df4[_0xfcab('0x25')]()[_0xfcab('0x24')](function(){var _0x1eb7e6=_0x479df4[_0xfcab('0x26')]({'plain':!![]});var _0x5c949e=_0xfcab('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x5c949e,'resourceId':_0x1eb7e6['id']}})['then'](function(){return _0x479df4;});})[_0xfcab('0x24')](function(){_0x5ce6e3[_0xfcab('0x18')](0xcc)[_0xfcab('0x19')]();});}};}function handleEntityNotFound(_0x4e282d,_0x25982c){return function(_0x96bcf0){if(!_0x96bcf0){_0x4e282d[_0xfcab('0x17')](0x194);}return _0x96bcf0;};}function handleError(_0x214d2a,_0x450d2e){_0x450d2e=_0x450d2e||0x1f4;return function(_0xd75c3b){logger[_0xfcab('0x28')](_0xd75c3b[_0xfcab('0x29')]);if(_0xd75c3b['name']){delete _0xd75c3b[_0xfcab('0x2a')];}_0x214d2a['status'](_0x450d2e)[_0xfcab('0x2b')](_0xd75c3b);};}exports[_0xfcab('0x2c')]=function(_0x536923,_0x336680){var _0x521cbe={},_0x5dd68c={},_0x1e2e1e={'count':0x0,'rows':[]};var _0x450e76=_[_0xfcab('0x2d')](db[_0xfcab('0x2e')][_0xfcab('0x2f')],function(_0x509c9d){return{'name':_0x509c9d[_0xfcab('0x30')],'type':_0x509c9d[_0xfcab('0x31')][_0xfcab('0x32')]};});_0x5dd68c[_0xfcab('0x33')]=_['map'](_0x450e76,_0xfcab('0x2a'));_0x5dd68c[_0xfcab('0x34')]=_[_0xfcab('0x35')](_0x536923[_0xfcab('0x34')]);_0x5dd68c['filters']=_[_0xfcab('0x36')](_0x5dd68c[_0xfcab('0x33')],_0x5dd68c[_0xfcab('0x34')]);_0x521cbe[_0xfcab('0x37')]=_['intersection'](_0x5dd68c[_0xfcab('0x33')],qs['fields'](_0x536923[_0xfcab('0x34')][_0xfcab('0x38')]));_0x521cbe[_0xfcab('0x37')]=_0x521cbe['attributes']['length']?_0x521cbe[_0xfcab('0x37')]:_0x5dd68c['model'];if(!_0x536923[_0xfcab('0x34')][_0xfcab('0x39')]('nolimit')){_0x521cbe[_0xfcab('0x3a')]=qs[_0xfcab('0x3a')](_0x536923[_0xfcab('0x34')][_0xfcab('0x3a')]);_0x521cbe[_0xfcab('0x1b')]=qs['offset'](_0x536923[_0xfcab('0x34')][_0xfcab('0x1b')]);}_0x521cbe[_0xfcab('0x3b')]=qs[_0xfcab('0x3c')](_0x536923['query'][_0xfcab('0x3c')]);_0x521cbe[_0xfcab('0x3d')]=qs[_0xfcab('0x3e')](_[_0xfcab('0x3f')](_0x536923[_0xfcab('0x34')],_0x5dd68c[_0xfcab('0x3e')]),_0x450e76);if(_0x536923[_0xfcab('0x34')][_0xfcab('0x40')]){_0x521cbe[_0xfcab('0x3d')]=_[_0xfcab('0x41')](_0x521cbe['where'],{'$or':_[_0xfcab('0x2d')](_0x450e76,function(_0x43f77f){if(_0x43f77f['type']!==_0xfcab('0x42')){var _0x3cf991={};_0x3cf991[_0x43f77f['name']]={'$like':'%'+_0x536923[_0xfcab('0x34')][_0xfcab('0x40')]+'%'};return _0x3cf991;}})});}_0x521cbe=_['merge']({},_0x521cbe,_0x536923[_0xfcab('0x43')]);var _0x5a81c7={'where':_0x521cbe[_0xfcab('0x3d')]};return db[_0xfcab('0x2e')][_0xfcab('0x1d')](_0x5a81c7)[_0xfcab('0x24')](function(_0x13c434){_0x1e2e1e[_0xfcab('0x1d')]=_0x13c434;if(_0x536923['query'][_0xfcab('0x44')]){_0x521cbe[_0xfcab('0x45')]=[{'all':!![]}];}return db[_0xfcab('0x2e')][_0xfcab('0x46')](_0x521cbe);})['then'](function(_0x434b01){_0x1e2e1e[_0xfcab('0x47')]=_0x434b01;return _0x1e2e1e;})[_0xfcab('0x24')](respondWithFilteredResult(_0x336680,_0x521cbe))[_0xfcab('0x48')](handleError(_0x336680,null));};exports['show']=function(_0x39e098,_0x2ad1e3){var _0x2bdb79={'raw':![],'where':{'id':_0x39e098['params']['id']}},_0x51bf34={};_0x51bf34[_0xfcab('0x33')]=_[_0xfcab('0x35')](db[_0xfcab('0x2e')][_0xfcab('0x2f')]);_0x51bf34['query']=_[_0xfcab('0x35')](_0x39e098[_0xfcab('0x34')]);_0x51bf34[_0xfcab('0x3e')]=_[_0xfcab('0x36')](_0x51bf34[_0xfcab('0x33')],_0x51bf34[_0xfcab('0x34')]);_0x2bdb79[_0xfcab('0x37')]=_[_0xfcab('0x36')](_0x51bf34[_0xfcab('0x33')],qs['fields'](_0x39e098[_0xfcab('0x34')]['fields']));_0x2bdb79['attributes']=_0x2bdb79['attributes'][_0xfcab('0x49')]?_0x2bdb79[_0xfcab('0x37')]:_0x51bf34[_0xfcab('0x33')];if(_0x39e098[_0xfcab('0x34')][_0xfcab('0x44')]){_0x2bdb79['include']=[{'all':!![]}];}_0x2bdb79=_[_0xfcab('0x41')]({},_0x2bdb79,_0x39e098[_0xfcab('0x43')]);return db['CmList']['find'](_0x2bdb79)[_0xfcab('0x24')](handleEntityNotFound(_0x2ad1e3,null))['then'](respondWithResult(_0x2ad1e3,null))['catch'](handleError(_0x2ad1e3,null));};exports['create']=function(_0x2d8178,_0xc77eed){return db['CmList']['create'](_0x2d8178[_0xfcab('0x4a')],{})[_0xfcab('0x24')](function(_0x26ecc7){var _0x503cd0=_0x2d8178['user'][_0xfcab('0x26')]({'plain':!![]});if(!_0x503cd0)throw new Error(_0xfcab('0x4b'));if(_0x503cd0['role']===_0xfcab('0x4c')){var _0x3ac6ba=_0x26ecc7['get']({'plain':!![]});var _0x374a1e=_0xfcab('0x27');return db[_0xfcab('0x4d')][_0xfcab('0x4e')]({'where':{'name':_0x374a1e,'userProfileId':_0x503cd0[_0xfcab('0x4f')]},'raw':!![]})[_0xfcab('0x24')](function(_0x33d0d3){if(_0x33d0d3&&_0x33d0d3[_0xfcab('0x50')]===0x0){return db[_0xfcab('0x51')]['create']({'name':_0x3ac6ba[_0xfcab('0x2a')],'resourceId':_0x3ac6ba['id'],'type':_0x33d0d3[_0xfcab('0x2a')],'sectionId':_0x33d0d3['id']},{})[_0xfcab('0x24')](function(){return _0x26ecc7;});}else{return _0x26ecc7;}})[_0xfcab('0x48')](function(_0xa6a631){logger[_0xfcab('0x28')](_0xfcab('0x52'),_0xa6a631);throw _0xa6a631;});}return _0x26ecc7;})['then'](respondWithResult(_0xc77eed,0xc9))['catch'](handleError(_0xc77eed,null));};exports[_0xfcab('0x23')]=function(_0x495dbc,_0xa5cbc){if(_0x495dbc[_0xfcab('0x4a')]['id']){delete _0x495dbc['body']['id'];}return db[_0xfcab('0x2e')]['find']({'where':{'id':_0x495dbc[_0xfcab('0x53')]['id']}})[_0xfcab('0x24')](handleEntityNotFound(_0xa5cbc,null))[_0xfcab('0x24')](saveUpdates(_0x495dbc[_0xfcab('0x4a')],null))['then'](respondWithResult(_0xa5cbc,null))[_0xfcab('0x48')](handleError(_0xa5cbc,null));};exports[_0xfcab('0x25')]=function(_0x1dae0f,_0x31656a){return db['CmList'][_0xfcab('0x4e')]({'where':{'id':_0x1dae0f[_0xfcab('0x53')]['id']}})['then'](handleEntityNotFound(_0x31656a,null))[_0xfcab('0x24')](removeEntity(_0x31656a,null))[_0xfcab('0x48')](handleError(_0x31656a,null));};exports[_0xfcab('0x54')]=function(_0x106d4e,_0x27fb9c){return db[_0xfcab('0x2e')][_0xfcab('0x54')]()[_0xfcab('0x24')](respondWithResult(_0x27fb9c,null))[_0xfcab('0x48')](handleError(_0x27fb9c,null));};exports[_0xfcab('0x55')]=function(_0x3eae9d,_0x58f5f4,_0x2a47a7){if(_0x3eae9d['body']['id']){delete _0x3eae9d['body']['id'];}return db[_0xfcab('0x2e')]['find']({'where':{'id':_0x3eae9d[_0xfcab('0x53')]['id']}})['then'](handleEntityNotFound(_0x58f5f4,null))[_0xfcab('0x24')](function(_0x31472b){if(_0x31472b){_0x3eae9d[_0xfcab('0x4a')][_0xfcab('0x56')]=_0x31472b['id'];return db[_0xfcab('0x57')]['create'](_0x3eae9d[_0xfcab('0x4a')]);}})['then'](respondWithResult(_0x58f5f4,null))[_0xfcab('0x48')](handleError(_0x58f5f4,null));};exports[_0xfcab('0x58')]=function(_0x1250f1,_0x44b522,_0x1fa65a){var _0x126e5a={'raw':![],'where':{}};var _0x49384d={};var _0xc024eb={'count':0x0,'rows':[]};return db[_0xfcab('0x2e')][_0xfcab('0x59')]({'where':{'id':_0x1250f1[_0xfcab('0x53')]['id']}})[_0xfcab('0x24')](handleEntityNotFound(_0x44b522,null))['then'](function(_0x32fb42){if(_0x32fb42){_0x49384d['model']=_[_0xfcab('0x35')](db['Disposition'][_0xfcab('0x2f')]);_0x49384d[_0xfcab('0x34')]=_['keys'](_0x1250f1['query']);_0x49384d['filters']=_['intersection'](_0x49384d['model'],_0x49384d[_0xfcab('0x34')]);_0x126e5a[_0xfcab('0x37')]=_[_0xfcab('0x36')](_0x49384d['model'],qs[_0xfcab('0x38')](_0x1250f1[_0xfcab('0x34')]['fields']));_0x126e5a[_0xfcab('0x37')]=_0x126e5a[_0xfcab('0x37')][_0xfcab('0x49')]?_0x126e5a['attributes']:_0x49384d[_0xfcab('0x33')];if(!_0x1250f1[_0xfcab('0x34')][_0xfcab('0x39')]('nolimit')){_0x126e5a[_0xfcab('0x3a')]=qs[_0xfcab('0x3a')](_0x1250f1[_0xfcab('0x34')][_0xfcab('0x3a')]);_0x126e5a[_0xfcab('0x1b')]=qs['offset'](_0x1250f1[_0xfcab('0x34')][_0xfcab('0x1b')]);}_0x126e5a[_0xfcab('0x3b')]=qs[_0xfcab('0x3c')](_0x1250f1[_0xfcab('0x34')]['sort']);_0x126e5a[_0xfcab('0x3d')]=qs['filters'](_[_0xfcab('0x3f')](_0x1250f1[_0xfcab('0x34')],_0x49384d[_0xfcab('0x3e')]));_0x126e5a[_0xfcab('0x3d')][_0xfcab('0x56')]=_0x32fb42['id'];if(_0x1250f1[_0xfcab('0x34')][_0xfcab('0x40')]){_0x126e5a[_0xfcab('0x3d')]=_[_0xfcab('0x41')](_0x126e5a[_0xfcab('0x3d')],{'$or':_[_0xfcab('0x2d')](_0x126e5a['attributes'],function(_0x99364f){var _0x4e3393={};_0x4e3393[_0x99364f]={'$like':'%'+_0x1250f1[_0xfcab('0x34')][_0xfcab('0x40')]+'%'};return _0x4e3393;})});}_0x126e5a=_[_0xfcab('0x41')]({},_0x126e5a,_0x1250f1[_0xfcab('0x43')]);return db['Disposition']['count']({'where':_0x126e5a['where']})[_0xfcab('0x24')](function(_0x1d32cb){_0xc024eb[_0xfcab('0x1d')]=_0x1d32cb;if(_0x1250f1['query']['includeAll']){_0x126e5a[_0xfcab('0x45')]=[{'all':!![]}];}return db[_0xfcab('0x57')][_0xfcab('0x46')](_0x126e5a);})['then'](function(_0x13bb88){_0xc024eb[_0xfcab('0x47')]=_0x13bb88;return _0xc024eb;});}})[_0xfcab('0x24')](respondWithFilteredResult(_0x44b522,_0x126e5a))['catch'](handleError(_0x44b522,null));};exports[_0xfcab('0x5a')]=function(_0x648684,_0x4147ef,_0x1e4406){return db[_0xfcab('0x2e')][_0xfcab('0x4e')]({'where':{'id':_0x648684[_0xfcab('0x53')]['id']}})[_0xfcab('0x24')](handleEntityNotFound(_0x4147ef,null))[_0xfcab('0x24')](function(_0x24c45d){if(_0x24c45d){return _0x24c45d[_0xfcab('0x5a')](_0x648684[_0xfcab('0x34')]['ids']);}})[_0xfcab('0x24')](respondWithStatusCode(_0x4147ef,null))[_0xfcab('0x48')](handleError(_0x4147ef,null));};exports['addContacts']=function(_0x1fe27e,_0x57f4e5,_0x221cc6){return db[_0xfcab('0x2e')][_0xfcab('0x4e')]({'where':{'id':_0x1fe27e[_0xfcab('0x53')]['id']}})['then'](handleEntityNotFound(_0x57f4e5,null))[_0xfcab('0x24')](function(_0x14e871){if(_0x14e871){var _0x38d45d=[];var _0x44e2b2={'success':[],'errors':[]};return db['CmContact'][_0xfcab('0x54')]()[_0xfcab('0x24')](function(_0x1df91d){if(_0x1fe27e[_0xfcab('0x4a')][_0xfcab('0x5b')]&&_[_0xfcab('0x5c')](_0x1fe27e[_0xfcab('0x4a')][_0xfcab('0x5b')])){if(_0x1fe27e[_0xfcab('0x4a')][_0xfcab('0x5b')][_0xfcab('0x49')]){_0x1fe27e['body'][_0xfcab('0x5b')]=_0x1fe27e[_0xfcab('0x4a')][_0xfcab('0x5b')]['join'](';')+';';}else{_0x1fe27e[_0xfcab('0x4a')][_0xfcab('0x5b')]=null;}}else{_0x1fe27e[_0xfcab('0x4a')][_0xfcab('0x5b')]=null;}if(_0x1fe27e[_0xfcab('0x4a')]&&_[_0xfcab('0x5c')](_0x1fe27e[_0xfcab('0x4a')])){for(var _0x24ed16=0x0;_0x24ed16<_0x1fe27e[_0xfcab('0x4a')][_0xfcab('0x49')];_0x24ed16+=0x1){_0x1fe27e[_0xfcab('0x4a')][_0x24ed16][_0xfcab('0x56')]=_0x1fe27e['params']['id'];_0x38d45d[_0xfcab('0x5d')](_0x1fe27e[_0xfcab('0x4a')][_0x24ed16]);}return BPromise['each'](_0x38d45d,function(_0x5a7afb){return db[_0xfcab('0x5e')][_0xfcab('0x5f')](_[_0xfcab('0x60')](_0x5a7afb,[_0xfcab('0x61'),'id'])||{},{'fields':_[_0xfcab('0x35')](_0x1df91d),'raw':!![]})[_0xfcab('0x24')](function(_0x53c3bb){_0x44e2b2[_0xfcab('0x62')][_0xfcab('0x5d')](_0x53c3bb[_0xfcab('0x63')]);})[_0xfcab('0x48')](function(_0x45aaeb){_0x44e2b2[_0xfcab('0x64')]['push']({'data':_0x5a7afb,'error':_0x45aaeb['message']});});})[_0xfcab('0x24')](function(_0x4ede1c){return _0x44e2b2;})['catch'](function(_0x29ea3f){return _0x29ea3f;});}else{_0x57f4e5[_0xfcab('0x18')](0x190)['json']({'message':_0xfcab('0x65')});}});}})['then'](respondWithResult(_0x57f4e5,null))['catch'](handleError(_0x57f4e5,null));};exports[_0xfcab('0x66')]=function(_0x184639,_0x24e74d,_0x440600){var _0x189df7;return db[_0xfcab('0x2e')][_0xfcab('0x4e')]({'where':{'id':_0x184639[_0xfcab('0x53')]['id']},'include':[{'model':db[_0xfcab('0x67')],'as':'CustomFields'}]})[_0xfcab('0x24')](handleEntityNotFound(_0x24e74d,null))[_0xfcab('0x24')](function(_0x339838){if(_0x339838){_0x189df7=_0x339838;return db[_0xfcab('0x5e')][_0xfcab('0x2f')];}})[_0xfcab('0x24')](function(_0x4bc11e){if(_0x4bc11e){var _0x3bd0f3={};var _0x255d44={};_0x255d44[_0xfcab('0x33')]=_['concat'](_[_0xfcab('0x35')](_0x4bc11e),_[_0xfcab('0x2d')](_0x189df7[_0xfcab('0x68')],function(_0x5c333c){return util[_0xfcab('0x69')](_0xfcab('0x6a'),_0x5c333c['id']);}));_0x255d44['query']=_[_0xfcab('0x35')](_0x184639[_0xfcab('0x34')]);_0x255d44[_0xfcab('0x3e')]=_[_0xfcab('0x36')](_0x255d44[_0xfcab('0x33')],_0x255d44[_0xfcab('0x34')]);_0x3bd0f3[_0xfcab('0x37')]=_['intersection'](_0x255d44[_0xfcab('0x33')],qs[_0xfcab('0x38')](_0x184639[_0xfcab('0x34')][_0xfcab('0x38')]));_0x3bd0f3['attributes']=_0x3bd0f3[_0xfcab('0x37')][_0xfcab('0x49')]?_0x3bd0f3[_0xfcab('0x37')]:_0x255d44[_0xfcab('0x33')];if(!_0x184639['query'][_0xfcab('0x39')](_0xfcab('0x6b'))){_0x3bd0f3['limit']=qs[_0xfcab('0x3a')](_0x184639['query'][_0xfcab('0x3a')]);_0x3bd0f3['offset']=qs[_0xfcab('0x1b')](_0x184639[_0xfcab('0x34')][_0xfcab('0x1b')]);}_0x3bd0f3[_0xfcab('0x3b')]=qs[_0xfcab('0x3c')](_0x184639[_0xfcab('0x34')][_0xfcab('0x3c')]);_0x3bd0f3[_0xfcab('0x3d')]=qs[_0xfcab('0x3e')](_['pick'](_0x184639[_0xfcab('0x34')],_0x255d44['filters']));_0x3bd0f3[_0xfcab('0x6c')]=!![];if(_0x184639[_0xfcab('0x34')][_0xfcab('0x40')]){_0x3bd0f3[_0xfcab('0x3d')]=_['merge'](_0x3bd0f3[_0xfcab('0x3d')],{'$or':_[_0xfcab('0x2d')](_0x3bd0f3[_0xfcab('0x37')],function(_0x360b79){var _0x23e498={};_0x23e498[_0x360b79]={'$like':'%'+_0x184639[_0xfcab('0x34')][_0xfcab('0x40')]+'%'};return _0x23e498;})});}_0x3bd0f3=_['merge']({},_0x3bd0f3,_0x184639['options']);return _0x189df7['getContacts'](_0x3bd0f3);}})[_0xfcab('0x24')](respondWithResult(_0x24e74d,null))[_0xfcab('0x48')](handleError(_0x24e74d,null));};exports[_0xfcab('0x6d')]=function(_0x4e5bff,_0x5806b4,_0x3b7d7a){var _0x14fdac;var _0x2bee12;var _0x294b9b;var _0x275b30=_0x4e5bff[_0xfcab('0x53')]['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id',_0xfcab('0x2a')],'raw':!![],'order':[_0xfcab('0x6e')]})[_0xfcab('0x24')](function(_0x8e9f9b){_0x14fdac=_0x8e9f9b;var _0x1bb069=_['keys'](db['CmContact'][_0xfcab('0x2f')]);return db[_0xfcab('0x67')]['findAll']({'raw':!![],'attributes':['id',_0xfcab('0x6f')]})[_0xfcab('0x24')](function(_0x4a59f1){_0x2bee12=_0x4a59f1;var _0x3548a4=squel[_0xfcab('0x70')]()[_0xfcab('0x38')](_0x1bb069)[_0xfcab('0x71')](_0xfcab('0x72'),'c')['where'](_0xfcab('0x73'),_0x275b30)[_0xfcab('0x3d')](_0xfcab('0x74'))[_0xfcab('0x75')]();for(var _0xbfe378=0x0;_0xbfe378<_0x2bee12[_0xfcab('0x49')];_0xbfe378++){_0x3548a4[_0xfcab('0x76')](_0xfcab('0x77')+_0x2bee12[_0xbfe378]['id'],_0xfcab('0x78')+_0x2bee12[_0xbfe378][_0xfcab('0x6f')]);}for(var _0xbfe378=0x0;_0xbfe378<_0x14fdac[_0xfcab('0x49')];_0xbfe378++){_0x3548a4[_0xfcab('0x76')](squel[_0xfcab('0x70')]()[_0xfcab('0x76')](_0xfcab('0x79'))[_0xfcab('0x71')](_0xfcab('0x7a'))[_0xfcab('0x3d')](_0xfcab('0x7b'),_0x14fdac[_0xbfe378]['id'])[_0xfcab('0x3d')](_0xfcab('0x7c')),_0xfcab('0x7d')+_0x14fdac[_0xbfe378]['name']);_0x3548a4[_0xfcab('0x76')](squel['select']()['field'](_0xfcab('0x7e'))['from'](_0xfcab('0x7a'))['where'](_0xfcab('0x7b'),_0x14fdac[_0xbfe378]['id'])[_0xfcab('0x3d')](_0xfcab('0x7c')),'description_additionalPhone_'+_0x14fdac[_0xbfe378][_0xfcab('0x2a')]);}var _0x38811e=[];_0x38811e['push'](_0x3548a4[_0xfcab('0x7f')]());BPromise[_0xfcab('0x80')](_0x38811e,handleQuery)['then'](function(_0x2eca9e){handleQuery(_0x3548a4[_0xfcab('0x7f')]());var _0x3b8d01=csv_results[0x0];if(!_['isEmpty'](_0x3b8d01)){var _0x5de3ab=toCsv(_0x3b8d01);var _0x2ca9c9=Date[_0xfcab('0x81')]();fs[_0xfcab('0x82')](util[_0xfcab('0x69')](_0xfcab('0x83'),_0x275b30,_0x2ca9c9),_0x5de3ab);_0x5806b4[_0xfcab('0x84')](_0xfcab('0x85'),'attachment;\x20filename='+util[_0xfcab('0x69')](_0xfcab('0x86'),_0x275b30,_0x2ca9c9));_0x5806b4[_0xfcab('0x84')]('Content-type',_0xfcab('0x87'));return _0x5806b4[_0xfcab('0x88')](util[_0xfcab('0x69')]('/tmp/list_%d_%s.csv',_0x275b30,_0x2ca9c9));}else{return _0x5806b4[_0xfcab('0x17')](0xcc);}});});});};exports[_0xfcab('0x89')]=function(_0x8fadf4,_0x83544c,_0x16c03f){var _0x1b2f5c;delete _0x8fadf4[_0xfcab('0x4a')]['id'];return db[_0xfcab('0x2e')][_0xfcab('0x59')]({'where':{'id':_0x8fadf4['params']['id']}})[_0xfcab('0x24')](handleEntityNotFound(_0x83544c,null))[_0xfcab('0x24')](function(_0x14cb46){if(_0x14cb46){return db[_0xfcab('0x8a')][_0xfcab('0x8b')](function(_0x4f27f3){return db[_0xfcab('0x67')][_0xfcab('0x5f')](_0x8fadf4[_0xfcab('0x4a')],{'transaction':_0x4f27f3})[_0xfcab('0x24')](function(_0x223339){_0x1b2f5c=_0x223339;return _0x14cb46['addCustomFields'](_0x223339,{'transaction':_0x4f27f3});})['then'](function(){var _0x4c746e={'type':db[_0xfcab('0x8c')][_0xfcab('0x8d')],'transaction':_0x4f27f3};switch(_0x8fadf4[_0xfcab('0x4a')][_0xfcab('0x31')]){case _0xfcab('0x8e'):_0x4c746e[_0xfcab('0x31')]=db['Sequelize']['TEXT'];break;case _0xfcab('0x8f'):_0x4c746e[_0xfcab('0x31')]=db[_0xfcab('0x8c')]['INTEGER'];break;case _0xfcab('0x90'):_0x4c746e['type']=db[_0xfcab('0x8c')]['BOOLEAN'];_0x4c746e['defaultValue']=![];break;default:}return db[_0xfcab('0x8a')][_0xfcab('0x91')][_0xfcab('0x92')]('cm_contacts',util[_0xfcab('0x69')](_0xfcab('0x93'),_0x1b2f5c['id']),_0x4c746e);})[_0xfcab('0x24')](function(){return _0x1b2f5c;});});}})[_0xfcab('0x24')](respondWithResult(_0x83544c,null))[_0xfcab('0x48')](handleError(_0x83544c,null));};exports[_0xfcab('0x94')]=function(_0x1cf7fc,_0x115c23,_0x2dc11a){var _0x16cc14={};var _0x5a9dc6={};var _0x6ed34;var _0x801d52;return db[_0xfcab('0x2e')][_0xfcab('0x59')]({'where':{'id':_0x1cf7fc[_0xfcab('0x53')]['id']}})[_0xfcab('0x24')](handleEntityNotFound(_0x115c23,null))['then'](function(_0x53e084){if(_0x53e084){_0x6ed34=_0x53e084;_0x5a9dc6[_0xfcab('0x33')]=_['keys'](db['CmCustomField'][_0xfcab('0x2f')]);_0x5a9dc6['query']=_['keys'](_0x1cf7fc[_0xfcab('0x34')]);_0x5a9dc6[_0xfcab('0x3e')]=_[_0xfcab('0x36')](_0x5a9dc6['model'],_0x5a9dc6[_0xfcab('0x34')]);_0x16cc14['attributes']=_[_0xfcab('0x36')](_0x5a9dc6[_0xfcab('0x33')],qs[_0xfcab('0x38')](_0x1cf7fc['query']['fields']));_0x16cc14[_0xfcab('0x37')]=_0x16cc14[_0xfcab('0x37')][_0xfcab('0x49')]?_0x16cc14[_0xfcab('0x37')]:_0x5a9dc6[_0xfcab('0x33')];_0x16cc14['order']=qs[_0xfcab('0x3c')](_0x1cf7fc['query'][_0xfcab('0x3c')]);_0x16cc14['where']=qs['filters'](_[_0xfcab('0x3f')](_0x1cf7fc['query'],_0x5a9dc6['filters']));_0x16cc14['where']=_['merge'](_0x16cc14[_0xfcab('0x3d')],{'$or':[{'ListId':_0x53e084['id']},{'ListId':null}]});if(_0x1cf7fc[_0xfcab('0x34')][_0xfcab('0x40')]){_0x16cc14[_0xfcab('0x3d')]=_[_0xfcab('0x41')](_0x16cc14['where'],{'$or':_[_0xfcab('0x2d')](_0x16cc14[_0xfcab('0x37')],function(_0x203368){var _0x1bf0da={};_0x1bf0da[_0x203368]={'$like':'%'+_0x1cf7fc[_0xfcab('0x34')][_0xfcab('0x40')]+'%'};return _0x1bf0da;})});}_0x16cc14=_[_0xfcab('0x41')]({},_0x16cc14,_0x1cf7fc[_0xfcab('0x43')]);return db[_0xfcab('0x67')][_0xfcab('0x95')](_0x16cc14);}})[_0xfcab('0x24')](respondWithResult(_0x115c23,null))[_0xfcab('0x48')](handleError(_0x115c23,null));};exports[_0xfcab('0x96')]=function(_0x5e5c89,_0x322106){return db[_0xfcab('0x67')][_0xfcab('0x95')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x322106,null))[_0xfcab('0x24')](function(_0x1465c9){return _0x1465c9;})[_0xfcab('0x24')](respondWithResult(_0x322106,null))[_0xfcab('0x48')](handleError(_0x322106,null));};exports['addAgents']=function(_0xcc06fc,_0x311a03,_0x3af649){return db[_0xfcab('0x2e')]['find']({'where':{'id':_0xcc06fc[_0xfcab('0x53')]['id']}})['then'](handleEntityNotFound(_0x311a03,null))[_0xfcab('0x24')](function(_0x39e7ed){if(_0x39e7ed){return _0x39e7ed[_0xfcab('0x97')](_0xcc06fc['body'][_0xfcab('0x61')],_[_0xfcab('0x60')](_0xcc06fc[_0xfcab('0x4a')],[_0xfcab('0x61'),'id'])||{})[_0xfcab('0x98')](function(_0x312525){for(var _0x97ca11=0x0;_0x97ca11<_0xcc06fc['body'][_0xfcab('0x61')][_0xfcab('0x49')];_0x97ca11+=0x1){socket[_0xfcab('0x99')]('userCmList:save',{'UserId':Number(_0xcc06fc[_0xfcab('0x4a')]['ids'][_0x97ca11]),'CmListId':Number(_0xcc06fc[_0xfcab('0x53')]['id'])});}return _0x312525;});}})['then'](respondWithResult(_0x311a03,null))[_0xfcab('0x48')](handleError(_0x311a03,null));};exports['removeAgents']=function(_0x596a9c,_0x34f653,_0x2d1b0f){return db['CmList'][_0xfcab('0x4e')]({'where':{'id':_0x596a9c[_0xfcab('0x53')]['id']}})[_0xfcab('0x24')](handleEntityNotFound(_0x34f653,null))[_0xfcab('0x24')](function(_0x2dd939){if(_0x2dd939){return _0x2dd939['removeAgents'](_0x596a9c[_0xfcab('0x34')]['ids'])[_0xfcab('0x24')](function(){if(_[_0xfcab('0x5c')](_0x596a9c[_0xfcab('0x34')][_0xfcab('0x61')])){for(var _0xb901a8=0x0;_0xb901a8<_0x596a9c[_0xfcab('0x34')]['ids'][_0xfcab('0x49')];_0xb901a8+=0x1){socket[_0xfcab('0x99')](_0xfcab('0x9a'),{'UserId':Number(_0x596a9c['query'][_0xfcab('0x61')][_0xb901a8]),'CmListId':Number(_0x596a9c[_0xfcab('0x53')]['id'])});}}else{socket[_0xfcab('0x99')](_0xfcab('0x9a'),{'UserId':Number(_0x596a9c[_0xfcab('0x34')]['ids']),'CmListId':Number(_0x596a9c[_0xfcab('0x53')]['id'])});}});}})[_0xfcab('0x24')](respondWithStatusCode(_0x34f653,null))[_0xfcab('0x48')](handleError(_0x34f653,null));};exports['getAgents']=function(_0x325f53,_0x1c185e,_0x2a0d3b){var _0x2092ef={};var _0x1b3d0d={};var _0x4dd51e;var _0x5ca75a;return db[_0xfcab('0x2e')]['findOne']({'where':{'id':_0x325f53[_0xfcab('0x53')]['id']}})[_0xfcab('0x24')](handleEntityNotFound(_0x1c185e,null))['then'](function(_0x5df71c){if(_0x5df71c){_0x4dd51e=_0x5df71c;_0x1b3d0d['model']=_[_0xfcab('0x35')](db[_0xfcab('0x9b')][_0xfcab('0x2f')]);_0x1b3d0d[_0xfcab('0x34')]=_[_0xfcab('0x35')](_0x325f53[_0xfcab('0x34')]);_0x1b3d0d[_0xfcab('0x3e')]=_[_0xfcab('0x36')](_0x1b3d0d['model'],_0x1b3d0d['query']);_0x2092ef['attributes']=_[_0xfcab('0x36')](_0x1b3d0d[_0xfcab('0x33')],qs['fields'](_0x325f53[_0xfcab('0x34')][_0xfcab('0x38')]));_0x2092ef[_0xfcab('0x37')]=_0x2092ef[_0xfcab('0x37')]['length']?_0x2092ef[_0xfcab('0x37')]:_0x1b3d0d[_0xfcab('0x33')];_0x2092ef[_0xfcab('0x3b')]=qs[_0xfcab('0x3c')](_0x325f53[_0xfcab('0x34')]['sort']);_0x2092ef[_0xfcab('0x3d')]=qs[_0xfcab('0x3e')](_[_0xfcab('0x3f')](_0x325f53[_0xfcab('0x34')],_0x1b3d0d['filters']));if(_0x325f53['query']['filter']){_0x2092ef[_0xfcab('0x3d')]=_[_0xfcab('0x41')](_0x2092ef[_0xfcab('0x3d')],{'$or':_[_0xfcab('0x2d')](_0x2092ef['attributes'],function(_0x16a5a4){var _0x20563c={};_0x20563c[_0x16a5a4]={'$like':'%'+_0x325f53['query']['filter']+'%'};return _0x20563c;})});}_0x2092ef=_[_0xfcab('0x41')]({},_0x2092ef,_0x325f53[_0xfcab('0x43')]);return _0x4dd51e[_0xfcab('0x9c')](_0x2092ef);}})[_0xfcab('0x24')](function(_0x28d9a8){if(_0x28d9a8){_0x5ca75a=_0x28d9a8[_0xfcab('0x49')];if(!_0x325f53[_0xfcab('0x34')][_0xfcab('0x39')](_0xfcab('0x6b'))){_0x2092ef['limit']=qs[_0xfcab('0x3a')](_0x325f53['query'][_0xfcab('0x3a')]);_0x2092ef['offset']=qs[_0xfcab('0x1b')](_0x325f53[_0xfcab('0x34')][_0xfcab('0x1b')]);}return _0x4dd51e[_0xfcab('0x9c')](_0x2092ef);}})[_0xfcab('0x24')](function(_0x11f83d){if(_0x11f83d){return _0x11f83d?{'count':_0x5ca75a,'rows':_0x11f83d}:null;}})[_0xfcab('0x24')](respondWithResult(_0x1c185e,null))[_0xfcab('0x48')](handleError(_0x1c185e,null));};function handleQuery(_0x44babb){logger['info'](_0x44babb);return db[_0xfcab('0x8a')][_0xfcab('0x34')](_0x44babb)[_0xfcab('0x98')](function(_0x398502){csv_results[_0xfcab('0x5d')](_0x398502);})[_0xfcab('0x48')](function(_0x3b0dde){logger[_0xfcab('0x28')](_0x3b0dde[_0xfcab('0x9d')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 92c913f..7f90aae 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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x280429,_0x55b86f){var _0x219e8c=function(_0x5b3ed7){while(--_0x5b3ed7){_0x280429['push'](_0x280429['shift']());}};_0x219e8c(++_0x55b86f);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x5fc3,0xa8));var _0x35fc=function(_0xcda377,_0x1e2678){_0xcda377=_0xcda377-0x0;var _0x1c024f=_0x5fc3[_0xcda377];return _0x1c024f;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index dc3f52a..f1df0c2 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(_0x15eb63,_0xd3f629){_0x15eb63=_0x15eb63-0x0;var _0x19fc81=_0xbdb7[_0x15eb63];return _0x19fc81;};'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 _0xe5b5=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash'];(function(_0x46d4f6,_0x1247b2){var _0x1900b5=function(_0x1c7808){while(--_0x1c7808){_0x46d4f6['push'](_0x46d4f6['shift']());}};_0x1900b5(++_0x1247b2);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x4df85c,_0x248dfb){_0x4df85c=_0x4df85c-0x0;var _0x4e2a61=_0xe5b5[_0x4df85c];return _0x4e2a61;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var logger=require(_0x5e5b('0x2'))(_0x5e5b('0x3'));var moment=require(_0x5e5b('0x4'));var BPromise=require(_0x5e5b('0x5'));var rp=require(_0x5e5b('0x6'));var fs=require('fs');var path=require(_0x5e5b('0x7'));var rimraf=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var attributes=require(_0x5e5b('0xa'));module[_0x5e5b('0xb')]=function(_0xf1fbe2,_0x11e0e0){return _0xf1fbe2[_0x5e5b('0xc')](_0x5e5b('0xd'),attributes,{'tableName':_0x5e5b('0xe'),'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 dfd5e49..749c500 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 _0x0051=['error','code','CmList,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./cmList.socket','register','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x360f55,_0x140d22){var _0x575901=function(_0x15691a){while(--_0x15691a){_0x360f55['push'](_0x360f55['shift']());}};_0x575901(++_0x140d22);}(_0x0051,0xdd));var _0x1005=function(_0x331c72,_0x5a6428){_0x331c72=_0x331c72-0x0;var _0x2fe82b=_0x0051[_0x331c72];return _0x2fe82b;};'use strict';var _=require('lodash');var util=require(_0x1005('0x0'));var moment=require(_0x1005('0x1'));var BPromise=require(_0x1005('0x2'));var rs=require(_0x1005('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1005('0x4'))['db'];var utils=require(_0x1005('0x5'));var logger=require(_0x1005('0x6'))(_0x1005('0x7'));var config=require(_0x1005('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1005('0x9')][_0x1005('0xa')]({'port':0x232a});config[_0x1005('0xb')]=_[_0x1005('0xc')](config[_0x1005('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1005('0xd'))(new Redis(config[_0x1005('0xb')]));require(_0x1005('0xe'))[_0x1005('0xf')](socket);function respondWithRpcPromise(_0x20eb47,_0x2b2f98,_0x5c86f6){return new BPromise(function(_0x125e12,_0x4a8209){return client['request'](_0x20eb47,_0x5c86f6)[_0x1005('0x10')](function(_0x40170e){logger[_0x1005('0x11')]('CmList,\x20%s,\x20%s',_0x2b2f98,_0x1005('0x12'));logger[_0x1005('0x13')](_0x1005('0x14'),_0x2b2f98,_0x1005('0x12'),JSON[_0x1005('0x15')](_0x40170e));if(_0x40170e[_0x1005('0x16')]){if(_0x40170e['error'][_0x1005('0x17')]===0x1f4){logger[_0x1005('0x16')](_0x1005('0x18'),_0x2b2f98,_0x40170e[_0x1005('0x16')][_0x1005('0x19')]);return _0x4a8209(_0x40170e[_0x1005('0x16')][_0x1005('0x19')]);}logger['error'](_0x1005('0x18'),_0x2b2f98,_0x40170e['error'][_0x1005('0x19')]);return _0x125e12(_0x40170e[_0x1005('0x16')]['message']);}else{logger[_0x1005('0x11')](_0x1005('0x18'),_0x2b2f98,_0x1005('0x12'));_0x125e12(_0x40170e['result'][_0x1005('0x19')]);}})[_0x1005('0x1a')](function(_0x4a02c5){logger[_0x1005('0x16')](_0x1005('0x18'),_0x2b2f98,_0x4a02c5);_0x4a8209(_0x4a02c5);});});} \ No newline at end of file +var _0x5641=['CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','redis','register','request','then','info'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x5641,0x131));var _0x1564=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x5641[_0x125ff8];return _0x2d9ef;};'use strict';var _=require('lodash');var util=require(_0x1564('0x0'));var moment=require(_0x1564('0x1'));var BPromise=require(_0x1564('0x2'));var rs=require(_0x1564('0x3'));var fs=require('fs');var Redis=require(_0x1564('0x4'));var db=require(_0x1564('0x5'))['db'];var utils=require(_0x1564('0x6'));var logger=require(_0x1564('0x7'))(_0x1564('0x8'));var config=require(_0x1564('0x9'));var jayson=require(_0x1564('0xa'));var client=jayson[_0x1564('0xb')][_0x1564('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1564('0xd'))(new Redis(config[_0x1564('0xe')]));require('./cmList.socket')[_0x1564('0xf')](socket);function respondWithRpcPromise(_0x32b31a,_0x5a7530,_0xe81cda){return new BPromise(function(_0x27dbf7,_0x27a29e){return client[_0x1564('0x10')](_0x32b31a,_0xe81cda)[_0x1564('0x11')](function(_0x23e216){logger[_0x1564('0x12')](_0x1564('0x13'),_0x5a7530,'request\x20sent');logger[_0x1564('0x14')](_0x1564('0x15'),_0x5a7530,'request\x20sent',JSON['stringify'](_0x23e216));if(_0x23e216['error']){if(_0x23e216[_0x1564('0x16')][_0x1564('0x17')]===0x1f4){logger[_0x1564('0x16')]('CmList,\x20%s,\x20%s',_0x5a7530,_0x23e216['error'][_0x1564('0x18')]);return _0x27a29e(_0x23e216[_0x1564('0x16')][_0x1564('0x18')]);}logger[_0x1564('0x16')](_0x1564('0x13'),_0x5a7530,_0x23e216['error'][_0x1564('0x18')]);return _0x27dbf7(_0x23e216[_0x1564('0x16')][_0x1564('0x18')]);}else{logger[_0x1564('0x12')](_0x1564('0x13'),_0x5a7530,_0x1564('0x19'));_0x27dbf7(_0x23e216[_0x1564('0x1a')][_0x1564('0x18')]);}})['catch'](function(_0x1f8bbc){logger[_0x1564('0x16')](_0x1564('0x13'),_0x5a7530,_0x1f8bbc);_0x27a29e(_0x1f8bbc);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index e4c7898..8bf8185 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 _0x2cdb=['length','./cmList.events','save','remove','removeListener','register'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2cdb,0xe5));var _0xb2cd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2cdb[_0x122ef9];return _0x42fba0;};'use strict';var CmListEvents=require(_0xb2cd('0x0'));var events=[_0xb2cd('0x1'),_0xb2cd('0x2'),'update'];function createListener(_0x2f1db6,_0x9eb4c8){return function(_0x331c7c){_0x9eb4c8['emit'](_0x2f1db6,_0x331c7c);};}function removeListener(_0x10d1d3,_0x12e882){return function(){CmListEvents[_0xb2cd('0x3')](_0x10d1d3,_0x12e882);};}exports[_0xb2cd('0x4')]=function(_0x4fd09d){for(var _0xa7409d=0x0,_0x3643a1=events[_0xb2cd('0x5')];_0xa7409d<_0x3643a1;_0xa7409d++){var _0x29badd=events[_0xa7409d];var _0x39c5b0=createListener('cmList:'+_0x29badd,_0x4fd09d);CmListEvents['on'](_0x29badd,_0x39c5b0);}}; \ No newline at end of file +var _0x9d7b=['save','remove','update','emit','removeListener','register','length','cmList:','./cmList.events'];(function(_0x24fa1a,_0x16d9c2){var _0xc5621f=function(_0x5616ac){while(--_0x5616ac){_0x24fa1a['push'](_0x24fa1a['shift']());}};_0xc5621f(++_0x16d9c2);}(_0x9d7b,0x167));var _0xb9d7=function(_0x5c48a4,_0xde3033){_0x5c48a4=_0x5c48a4-0x0;var _0x57a4bd=_0x9d7b[_0x5c48a4];return _0x57a4bd;};'use strict';var CmListEvents=require(_0xb9d7('0x0'));var events=[_0xb9d7('0x1'),_0xb9d7('0x2'),_0xb9d7('0x3')];function createListener(_0x3619d7,_0x30fbf5){return function(_0x55562e){_0x30fbf5[_0xb9d7('0x4')](_0x3619d7,_0x55562e);};}function removeListener(_0x34fa1d,_0x418bab){return function(){CmListEvents[_0xb9d7('0x5')](_0x34fa1d,_0x418bab);};}exports[_0xb9d7('0x6')]=function(_0x28195e){for(var _0x4d461d=0x0,_0x299121=events[_0xb9d7('0x7')];_0x4d461d<_0x299121;_0x4d461d++){var _0x52cc68=events[_0x4d461d];var _0x2ab378=createListener(_0xb9d7('0x8')+_0x52cc68,_0x28195e);CmListEvents['on'](_0x52cc68,_0x2ab378);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 23b3728..fc49264 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 _0x2d19=['getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','post','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','put','/:id','update','delete','destroy','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','get','index','/describe','isAuthenticated','describe','/global_fields','getGlobalCustomFields','show','getDispositions','/:id/contacts','getContacts'];(function(_0x1f6919,_0x163692){var _0x57a08d=function(_0x4705d8){while(--_0x4705d8){_0x1f6919['push'](_0x1f6919['shift']());}};_0x57a08d(++_0x163692);}(_0x2d19,0x1b5));var _0x92d1=function(_0x1e9e56,_0x34a74a){_0x1e9e56=_0x1e9e56-0x0;var _0x5d5e2e=_0x2d19[_0x1e9e56];return _0x5d5e2e;};'use strict';var multer=require(_0x92d1('0x0'));var util=require('util');var path=require(_0x92d1('0x1'));var timeout=require(_0x92d1('0x2'));var express=require(_0x92d1('0x3'));var router=express['Router']();var fs_extra=require(_0x92d1('0x4'));var auth=require(_0x92d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x92d1('0x6'));var controller=require(_0x92d1('0x7'));router[_0x92d1('0x8')]('/',auth['isAuthenticated'](),controller[_0x92d1('0x9')]);router[_0x92d1('0x8')](_0x92d1('0xa'),auth[_0x92d1('0xb')](),controller[_0x92d1('0xc')]);router[_0x92d1('0x8')](_0x92d1('0xd'),auth[_0x92d1('0xb')](),controller[_0x92d1('0xe')]);router[_0x92d1('0x8')]('/:id',auth[_0x92d1('0xb')](),controller[_0x92d1('0xf')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x92d1('0x10')]);router[_0x92d1('0x8')](_0x92d1('0x11'),auth[_0x92d1('0xb')](),controller[_0x92d1('0x12')]);router[_0x92d1('0x8')]('/:id/contacts/csv',auth[_0x92d1('0xb')](),controller[_0x92d1('0x13')]);router[_0x92d1('0x8')](_0x92d1('0x14'),auth[_0x92d1('0xb')](),controller[_0x92d1('0x15')]);router[_0x92d1('0x8')](_0x92d1('0x16'),auth[_0x92d1('0xb')](),controller[_0x92d1('0x17')]);router['post']('/',auth[_0x92d1('0xb')](),controller[_0x92d1('0x18')]);router[_0x92d1('0x19')](_0x92d1('0x1a'),auth[_0x92d1('0xb')](),controller[_0x92d1('0x1b')]);router[_0x92d1('0x19')](_0x92d1('0x11'),auth[_0x92d1('0xb')](),controller[_0x92d1('0x1c')]);router[_0x92d1('0x19')](_0x92d1('0x14'),auth['isAuthenticated'](),controller[_0x92d1('0x1d')]);router[_0x92d1('0x19')](_0x92d1('0x16'),auth[_0x92d1('0xb')](),controller[_0x92d1('0x1e')]);router[_0x92d1('0x1f')](_0x92d1('0x20'),auth['isAuthenticated'](),controller[_0x92d1('0x21')]);router[_0x92d1('0x22')]('/:id',auth[_0x92d1('0xb')](),controller[_0x92d1('0x23')]);router[_0x92d1('0x22')](_0x92d1('0x1a'),auth[_0x92d1('0xb')](),controller['removeDispositions']);router[_0x92d1('0x22')](_0x92d1('0x16'),auth[_0x92d1('0xb')](),controller[_0x92d1('0x24')]);module[_0x92d1('0x25')]=router; \ No newline at end of file +var _0x8796=['/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','post','addDisposition','/:id/contacts','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','isAuthenticated','describe','/global_fields','getGlobalCustomFields','/:id','show'];(function(_0x1f294e,_0x35c154){var _0x5abc15=function(_0x302d1e){while(--_0x302d1e){_0x1f294e['push'](_0x1f294e['shift']());}};_0x5abc15(++_0x35c154);}(_0x8796,0xcd));var _0x6879=function(_0x74fbe4,_0x479246){_0x74fbe4=_0x74fbe4-0x0;var _0x31f4ce=_0x8796[_0x74fbe4];return _0x31f4ce;};'use strict';var multer=require(_0x6879('0x0'));var util=require(_0x6879('0x1'));var path=require(_0x6879('0x2'));var timeout=require(_0x6879('0x3'));var express=require('express');var router=express[_0x6879('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6879('0x5'));var config=require(_0x6879('0x6'));var controller=require(_0x6879('0x7'));router[_0x6879('0x8')]('/',auth['isAuthenticated'](),controller[_0x6879('0x9')]);router[_0x6879('0x8')](_0x6879('0xa'),auth[_0x6879('0xb')](),controller[_0x6879('0xc')]);router[_0x6879('0x8')](_0x6879('0xd'),auth[_0x6879('0xb')](),controller[_0x6879('0xe')]);router[_0x6879('0x8')](_0x6879('0xf'),auth[_0x6879('0xb')](),controller[_0x6879('0x10')]);router['get'](_0x6879('0x11'),auth[_0x6879('0xb')](),controller[_0x6879('0x12')]);router[_0x6879('0x8')]('/:id/contacts',auth[_0x6879('0xb')](),controller[_0x6879('0x13')]);router[_0x6879('0x8')](_0x6879('0x14'),auth[_0x6879('0xb')](),controller[_0x6879('0x15')]);router[_0x6879('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x6879('0x16')]);router[_0x6879('0x8')](_0x6879('0x17'),auth[_0x6879('0xb')](),controller[_0x6879('0x18')]);router[_0x6879('0x19')]('/',auth[_0x6879('0xb')](),controller['create']);router[_0x6879('0x19')](_0x6879('0x11'),auth['isAuthenticated'](),controller[_0x6879('0x1a')]);router[_0x6879('0x19')](_0x6879('0x1b'),auth[_0x6879('0xb')](),controller[_0x6879('0x1c')]);router[_0x6879('0x19')]('/:id/fields',auth[_0x6879('0xb')](),controller[_0x6879('0x1d')]);router[_0x6879('0x19')](_0x6879('0x17'),auth[_0x6879('0xb')](),controller[_0x6879('0x1e')]);router[_0x6879('0x1f')](_0x6879('0xf'),auth[_0x6879('0xb')](),controller[_0x6879('0x20')]);router[_0x6879('0x21')](_0x6879('0xf'),auth[_0x6879('0xb')](),controller[_0x6879('0x22')]);router[_0x6879('0x21')]('/:id/dispositions',auth[_0x6879('0xb')](),controller['removeDispositions']);router['delete'](_0x6879('0x17'),auth[_0x6879('0xb')](),controller[_0x6879('0x23')]);module[_0x6879('0x24')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index a6058f7..e83f93d 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 _0x6b41=['VIRTUAL','STRING'];(function(_0x25cf75,_0x549314){var _0x26c9f0=function(_0x1465c6){while(--_0x1465c6){_0x25cf75['push'](_0x25cf75['shift']());}};_0x26c9f0(++_0x549314);}(_0x6b41,0x1c0));var _0x16b4=function(_0x1cbcc0,_0x3375cd){_0x1cbcc0=_0x1cbcc0-0x0;var _0x52f87a=_0x6b41[_0x1cbcc0];return _0x52f87a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x16b4('0x0')],'get':function(_0x58d462){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0x16b4('0x1')],'allowNull':![]},'operator':{'type':Sequelize[_0x16b4('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x16b4('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd398=['field','STRING','sequelize','exports'];(function(_0x14025,_0x41f1d5){var _0xbc99a0=function(_0x5819f9){while(--_0x5819f9){_0x14025['push'](_0x14025['shift']());}};_0xbc99a0(++_0x41f1d5);}(_0xd398,0x156));var _0x8d39=function(_0x18d2e9,_0x18d6a2){_0x18d2e9=_0x18d2e9-0x0;var _0x52028e=_0xd398[_0x18d2e9];return _0x52028e;};'use strict';var Sequelize=require(_0x8d39('0x0'));module[_0x8d39('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x334536){return this['getDataValue'](_0x8d39('0x2'));}},'field':{'type':Sequelize[_0x8d39('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x8d39('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x8d39('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index b61d3ba..392c9a8 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(_0xb0dd71,_0x215e55){var _0x2555af=function(_0x381184){while(--_0x381184){_0xb0dd71['push'](_0xb0dd71['shift']());}};_0x2555af(++_0x215e55);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x5d4541,_0x3674a2){var _0x398ada=function(_0x5446f9){while(--_0x5446f9){_0x5d4541['push'](_0x5d4541['shift']());}};_0x398ada(++_0x3674a2);}(_0x7a54,0x106));var _0x47a5=function(_0xf457e3,_0x2de6cc){_0xf457e3=_0xf457e3-0x0;var _0x20df98=_0x7a54[_0xf457e3];return _0x20df98;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index a7a6445..41b7a38 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 _0x2ebb=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','../../config/logger'];(function(_0x478ed1,_0x343f87){var _0x246b6b=function(_0x2b389a){while(--_0x2b389a){_0x478ed1['push'](_0x478ed1['shift']());}};_0x246b6b(++_0x343f87);}(_0x2ebb,0x1dd));var _0xb2eb=function(_0x14c0fc,_0x45946b){_0x14c0fc=_0x14c0fc-0x0;var _0x2ddd14=_0x2ebb[_0x14c0fc];return _0x2ddd14;};'use strict';var _=require(_0xb2eb('0x0'));var util=require(_0xb2eb('0x1'));var logger=require(_0xb2eb('0x2'))(_0xb2eb('0x3'));var moment=require(_0xb2eb('0x4'));var BPromise=require(_0xb2eb('0x5'));var rp=require(_0xb2eb('0x6'));var fs=require('fs');var path=require(_0xb2eb('0x7'));var rimraf=require(_0xb2eb('0x8'));var config=require(_0xb2eb('0x9'));var attributes=require(_0xb2eb('0xa'));module[_0xb2eb('0xb')]=function(_0x42a662,_0x346a96){return _0x42a662[_0xb2eb('0xc')](_0xb2eb('0xd'),attributes,{'tableName':_0xb2eb('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31c0=['define','Condition','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./condition.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x31c0,0xac));var _0x031c=function(_0x39bfb5,_0x10aaa2){_0x39bfb5=_0x39bfb5-0x0;var _0x232b9c=_0x31c0[_0x39bfb5];return _0x232b9c;};'use strict';var _=require(_0x031c('0x0'));var util=require('util');var logger=require(_0x031c('0x1'))(_0x031c('0x2'));var moment=require('moment');var BPromise=require(_0x031c('0x3'));var rp=require(_0x031c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x031c('0x5'));var attributes=require(_0x031c('0x6'));module[_0x031c('0x7')]=function(_0x2884f7,_0x1763a1){return _0x2884f7[_0x031c('0x8')](_0x031c('0x9'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index dbee002..1141351 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 _0x85db=['request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x55c8d7,_0x2a4369){var _0x523dce=function(_0x1879e2){while(--_0x1879e2){_0x55c8d7['push'](_0x55c8d7['shift']());}};_0x523dce(++_0x2a4369);}(_0x85db,0x132));var _0xb85d=function(_0x391c55,_0x168617){_0x391c55=_0x391c55-0x0;var _0xa434e0=_0x85db[_0x391c55];return _0xa434e0;};'use strict';var _=require('lodash');var util=require(_0xb85d('0x0'));var moment=require('moment');var BPromise=require(_0xb85d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb85d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb85d('0x3'));var logger=require(_0xb85d('0x4'))(_0xb85d('0x5'));var config=require(_0xb85d('0x6'));var jayson=require(_0xb85d('0x7'));var client=jayson['client'][_0xb85d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24a5f6,_0x4c6c1e,_0x5426c2){return new BPromise(function(_0x14d611,_0x2edb9c){return client[_0xb85d('0x9')](_0x24a5f6,_0x5426c2)['then'](function(_0x4c817b){logger[_0xb85d('0xa')](_0xb85d('0xb'),_0x4c6c1e,_0xb85d('0xc'));logger[_0xb85d('0xd')](_0xb85d('0xe'),_0x4c6c1e,_0xb85d('0xc'),JSON[_0xb85d('0xf')](_0x4c817b));if(_0x4c817b[_0xb85d('0x10')]){if(_0x4c817b[_0xb85d('0x10')][_0xb85d('0x11')]===0x1f4){logger[_0xb85d('0x10')](_0xb85d('0xb'),_0x4c6c1e,_0x4c817b['error'][_0xb85d('0x12')]);return _0x2edb9c(_0x4c817b[_0xb85d('0x10')][_0xb85d('0x12')]);}logger[_0xb85d('0x10')]('Condition,\x20%s,\x20%s',_0x4c6c1e,_0x4c817b[_0xb85d('0x10')][_0xb85d('0x12')]);return _0x14d611(_0x4c817b['error']['message']);}else{logger['info'](_0xb85d('0xb'),_0x4c6c1e,_0xb85d('0xc'));_0x14d611(_0x4c817b[_0xb85d('0x13')][_0xb85d('0x12')]);}})[_0xb85d('0x14')](function(_0x393f38){logger[_0xb85d('0x10')](_0xb85d('0xb'),_0x4c6c1e,_0x393f38);_0x2edb9c(_0x393f38);});});} \ No newline at end of file +var _0x8387=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x8387,0x6a));var _0x7838=function(_0x4e78c3,_0x5d30aa){_0x4e78c3=_0x4e78c3-0x0;var _0x17d5a3=_0x8387[_0x4e78c3];return _0x17d5a3;};'use strict';var _=require(_0x7838('0x0'));var util=require(_0x7838('0x1'));var moment=require(_0x7838('0x2'));var BPromise=require(_0x7838('0x3'));var rs=require(_0x7838('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7838('0x5'))['db'];var utils=require(_0x7838('0x6'));var logger=require(_0x7838('0x7'))(_0x7838('0x8'));var config=require(_0x7838('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7838('0xa')][_0x7838('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53e7a6,_0x564208,_0x4a1091){return new BPromise(function(_0xaf7cb6,_0x89eae4){return client['request'](_0x53e7a6,_0x4a1091)[_0x7838('0xc')](function(_0xcf4e39){logger[_0x7838('0xd')](_0x7838('0xe'),_0x564208,_0x7838('0xf'));logger['debug'](_0x7838('0x10'),_0x564208,_0x7838('0xf'),JSON['stringify'](_0xcf4e39));if(_0xcf4e39[_0x7838('0x11')]){if(_0xcf4e39['error'][_0x7838('0x12')]===0x1f4){logger[_0x7838('0x11')]('Condition,\x20%s,\x20%s',_0x564208,_0xcf4e39[_0x7838('0x11')]['message']);return _0x89eae4(_0xcf4e39[_0x7838('0x11')][_0x7838('0x13')]);}logger[_0x7838('0x11')]('Condition,\x20%s,\x20%s',_0x564208,_0xcf4e39[_0x7838('0x11')]['message']);return _0xaf7cb6(_0xcf4e39[_0x7838('0x11')][_0x7838('0x13')]);}else{logger['info'](_0x7838('0xe'),_0x564208,_0x7838('0xf'));_0xaf7cb6(_0xcf4e39[_0x7838('0x14')][_0x7838('0x13')]);}})[_0x7838('0x15')](function(_0x1a0177){logger[_0x7838('0x11')]('Condition,\x20%s,\x20%s',_0x564208,_0x1a0177);_0x89eae4(_0x1a0177);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index b0b046b..c9da48a 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 _0x0aa1=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','update','delete','/:id','isAuthenticated','destroy','exports','multer','path','express'];(function(_0x38192c,_0x231e41){var _0x31d64e=function(_0x579a6e){while(--_0x579a6e){_0x38192c['push'](_0x38192c['shift']());}};_0x31d64e(++_0x231e41);}(_0x0aa1,0x129));var _0x10aa=function(_0x1a3471,_0x27437b){_0x1a3471=_0x1a3471-0x0;var _0x19cea4=_0x0aa1[_0x1a3471];return _0x19cea4;};'use strict';var multer=require(_0x10aa('0x0'));var util=require('util');var path=require(_0x10aa('0x1'));var timeout=require('connect-timeout');var express=require(_0x10aa('0x2'));var router=express[_0x10aa('0x3')]();var fs_extra=require(_0x10aa('0x4'));var auth=require(_0x10aa('0x5'));var interaction=require(_0x10aa('0x6'));var config=require('../../config/environment');var controller=require(_0x10aa('0x7'));router[_0x10aa('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x10aa('0x9')]);router[_0x10aa('0xa')](_0x10aa('0xb'),auth[_0x10aa('0xc')](),controller[_0x10aa('0xd')]);module[_0x10aa('0xe')]=router; \ No newline at end of file +var _0x1a7f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x3f1500,_0x403186){var _0xff46f9=function(_0x2257d0){while(--_0x2257d0){_0x3f1500['push'](_0x3f1500['shift']());}};_0xff46f9(++_0x403186);}(_0x1a7f,0xb1));var _0xf1a7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1a7f[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xf1a7('0x0'));var util=require('util');var path=require(_0xf1a7('0x1'));var timeout=require(_0xf1a7('0x2'));var express=require(_0xf1a7('0x3'));var router=express[_0xf1a7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf1a7('0x5'));var interaction=require(_0xf1a7('0x6'));var config=require(_0xf1a7('0x7'));var controller=require(_0xf1a7('0x8'));router[_0xf1a7('0x9')](_0xf1a7('0xa'),auth[_0xf1a7('0xb')](),controller['update']);router['delete'](_0xf1a7('0xa'),auth[_0xf1a7('0xb')](),controller[_0xf1a7('0xc')]);module[_0xf1a7('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 63d8b56..6d54bca 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 _0x559a=['exports','name','INTEGER','STRING','sequelize'];(function(_0x3c64ca,_0x5cbabc){var _0x5e6554=function(_0x5346fc){while(--_0x5346fc){_0x3c64ca['push'](_0x3c64ca['shift']());}};_0x5e6554(++_0x5cbabc);}(_0x559a,0xb3));var _0xa559=function(_0x39c968,_0x5126a5){_0x39c968=_0x39c968-0x0;var _0x170b78=_0x559a[_0x39c968];return _0x170b78;};'use strict';var Sequelize=require(_0xa559('0x0'));module[_0xa559('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa559('0x2')},'OrderBy':{'type':Sequelize[_0xa559('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xa559('0x4')],'allowNull':!![]}}; \ No newline at end of file +var _0x6379=['exports','STRING','name','INTEGER','sequelize'];(function(_0x504297,_0xe4ef87){var _0x1e043f=function(_0x4ef7cb){while(--_0x4ef7cb){_0x504297['push'](_0x504297['shift']());}};_0x1e043f(++_0xe4ef87);}(_0x6379,0xc7));var _0x9637=function(_0x24abae,_0x5c34d8){_0x24abae=_0x24abae-0x0;var _0x8365ac=_0x6379[_0x24abae];return _0x8365ac;};'use strict';var Sequelize=require(_0x9637('0x0'));module[_0x9637('0x1')]={'name':{'type':Sequelize[_0x9637('0x2')],'allowNull':![],'unique':_0x9637('0x3')},'OrderBy':{'type':Sequelize[_0x9637('0x4')],'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 df4938d..8671192 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 _0x5f2f=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','options','ContactItemType','includeAll','catch','show','params','length','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','ContactItemTypes','UserProfileResource','destroy','stack','name','index','map'];(function(_0x386b03,_0x5d0000){var _0xd3d524=function(_0x474754){while(--_0x474754){_0x386b03['push'](_0x386b03['shift']());}};_0xd3d524(++_0x5d0000);}(_0x5f2f,0x73));var _0xf5f2=function(_0x37bf8d,_0x43bce8){_0x37bf8d=_0x37bf8d-0x0;var _0x580ada=_0x5f2f[_0x37bf8d];return _0x580ada;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){var _0x5f1124=_0x287ad5[_0xf5f2('0x25')]({'plain':!![]});var _0x13da6f=_0xf5f2('0x26');return db[_0xf5f2('0x27')][_0xf5f2('0x28')]({'where':{'type':_0x13da6f,'resourceId':_0x5f1124['id']}})[_0xf5f2('0x24')](function(){return _0x287ad5;});})[_0xf5f2('0x24')](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaa2602,_0x102449){return function(_0x375ca8){if(!_0x375ca8){_0xaa2602[_0xf5f2('0x18')](0x194);}return _0x375ca8;};}function handleError(_0x198c73,_0x477604){_0x477604=_0x477604||0x1f4;return function(_0x5b6672){logger['error'](_0x5b6672[_0xf5f2('0x29')]);if(_0x5b6672[_0xf5f2('0x2a')]){delete _0x5b6672[_0xf5f2('0x2a')];}_0x198c73['status'](_0x477604)['send'](_0x5b6672);};}exports[_0xf5f2('0x2b')]=function(_0x50b8a2,_0x17394a){var _0x153924={},_0x1b381e={},_0x54c0c8={'count':0x0,'rows':[]};var _0x52e959=_[_0xf5f2('0x2c')](db['ContactItemType'][_0xf5f2('0x2d')],function(_0x58a4df){return{'name':_0x58a4df[_0xf5f2('0x2e')],'type':_0x58a4df[_0xf5f2('0x2f')][_0xf5f2('0x30')]};});_0x1b381e[_0xf5f2('0x31')]=_[_0xf5f2('0x2c')](_0x52e959,_0xf5f2('0x2a'));_0x1b381e[_0xf5f2('0x32')]=_[_0xf5f2('0x33')](_0x50b8a2['query']);_0x1b381e[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x1b381e[_0xf5f2('0x31')],_0x1b381e[_0xf5f2('0x32')]);_0x153924[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x1b381e[_0xf5f2('0x31')],qs['fields'](_0x50b8a2[_0xf5f2('0x32')][_0xf5f2('0x37')]));_0x153924['attributes']=_0x153924[_0xf5f2('0x36')]['length']?_0x153924[_0xf5f2('0x36')]:_0x1b381e[_0xf5f2('0x31')];if(!_0x50b8a2[_0xf5f2('0x32')][_0xf5f2('0x38')]('nolimit')){_0x153924['limit']=qs[_0xf5f2('0x1d')](_0x50b8a2[_0xf5f2('0x32')][_0xf5f2('0x1d')]);_0x153924['offset']=qs[_0xf5f2('0x1b')](_0x50b8a2['query'][_0xf5f2('0x1b')]);}_0x153924['order']=qs[_0xf5f2('0x39')](_0x50b8a2[_0xf5f2('0x32')]['sort']);_0x153924[_0xf5f2('0x3a')]=qs[_0xf5f2('0x34')](_[_0xf5f2('0x3b')](_0x50b8a2[_0xf5f2('0x32')],_0x1b381e['filters']),_0x52e959);if(_0x50b8a2['query'][_0xf5f2('0x3c')]){_0x153924[_0xf5f2('0x3a')]=_[_0xf5f2('0x3d')](_0x153924[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2c')](_0x52e959,function(_0xe62b57){if(_0xe62b57[_0xf5f2('0x2f')]!=='VIRTUAL'){var _0x110fe5={};_0x110fe5[_0xe62b57[_0xf5f2('0x2a')]]={'$like':'%'+_0x50b8a2['query'][_0xf5f2('0x3c')]+'%'};return _0x110fe5;}})});}_0x153924=_[_0xf5f2('0x3d')]({},_0x153924,_0x50b8a2[_0xf5f2('0x3e')]);var _0x85b6d0={'where':_0x153924[_0xf5f2('0x3a')]};return db[_0xf5f2('0x3f')][_0xf5f2('0x1e')](_0x85b6d0)[_0xf5f2('0x24')](function(_0x574f24){_0x54c0c8[_0xf5f2('0x1e')]=_0x574f24;if(_0x50b8a2[_0xf5f2('0x32')][_0xf5f2('0x40')]){_0x153924['include']=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x153924);})[_0xf5f2('0x24')](function(_0x2ad13c){_0x54c0c8['rows']=_0x2ad13c;return _0x54c0c8;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x17394a,_0x153924))[_0xf5f2('0x41')](handleError(_0x17394a,null));};exports[_0xf5f2('0x42')]=function(_0x31f86c,_0x354c34){var _0x2b3b1c={'raw':!![],'where':{'id':_0x31f86c[_0xf5f2('0x43')]['id']}},_0x1a6ec1={};_0x1a6ec1[_0xf5f2('0x31')]=_[_0xf5f2('0x33')](db[_0xf5f2('0x3f')][_0xf5f2('0x2d')]);_0x1a6ec1[_0xf5f2('0x32')]=_[_0xf5f2('0x33')](_0x31f86c['query']);_0x1a6ec1[_0xf5f2('0x34')]=_['intersection'](_0x1a6ec1[_0xf5f2('0x31')],_0x1a6ec1[_0xf5f2('0x32')]);_0x2b3b1c[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x1a6ec1[_0xf5f2('0x31')],qs[_0xf5f2('0x37')](_0x31f86c['query'][_0xf5f2('0x37')]));_0x2b3b1c[_0xf5f2('0x36')]=_0x2b3b1c[_0xf5f2('0x36')][_0xf5f2('0x44')]?_0x2b3b1c[_0xf5f2('0x36')]:_0x1a6ec1[_0xf5f2('0x31')];if(_0x31f86c[_0xf5f2('0x32')][_0xf5f2('0x40')]){_0x2b3b1c['include']=[{'all':!![]}];}_0x2b3b1c=_[_0xf5f2('0x3d')]({},_0x2b3b1c,_0x31f86c[_0xf5f2('0x3e')]);return db[_0xf5f2('0x3f')]['find'](_0x2b3b1c)[_0xf5f2('0x24')](handleEntityNotFound(_0x354c34,null))[_0xf5f2('0x24')](respondWithResult(_0x354c34,null))[_0xf5f2('0x41')](handleError(_0x354c34,null));};exports['create']=function(_0x57a7cb,_0x7bb942){return db[_0xf5f2('0x3f')]['create'](_0x57a7cb[_0xf5f2('0x45')],{})['then'](function(_0x740321){var _0x497eb8=_0x57a7cb[_0xf5f2('0x46')]['get']({'plain':!![]});if(!_0x497eb8)throw new Error(_0xf5f2('0x47'));if(_0x497eb8[_0xf5f2('0x48')]===_0xf5f2('0x46')){var _0x11a083=_0x740321['get']({'plain':!![]});var _0x3154c1=_0xf5f2('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x3154c1,'userProfileId':_0x497eb8[_0xf5f2('0x49')]},'raw':!![]})[_0xf5f2('0x24')](function(_0x57782c){if(_0x57782c&&_0x57782c[_0xf5f2('0x4a')]===0x0){return db[_0xf5f2('0x27')][_0xf5f2('0x4b')]({'name':_0x11a083[_0xf5f2('0x2a')],'resourceId':_0x11a083['id'],'type':_0x57782c['name'],'sectionId':_0x57782c['id']},{})['then'](function(){return _0x740321;});}else{return _0x740321;}})[_0xf5f2('0x41')](function(_0xa3cc67){logger['error'](_0xf5f2('0x4c'),_0xa3cc67);throw _0xa3cc67;});}return _0x740321;})[_0xf5f2('0x24')](respondWithResult(_0x7bb942,0xc9))[_0xf5f2('0x41')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x4d')]=function(_0x2b038e,_0x73c9f1){if(_0x2b038e[_0xf5f2('0x45')]['id']){delete _0x2b038e['body']['id'];}return db['ContactItemType'][_0xf5f2('0x4e')]({'where':{'id':_0x2b038e[_0xf5f2('0x43')]['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x73c9f1,null))[_0xf5f2('0x24')](saveUpdates(_0x2b038e[_0xf5f2('0x45')],null))['then'](respondWithResult(_0x73c9f1,null))[_0xf5f2('0x41')](handleError(_0x73c9f1,null));};exports[_0xf5f2('0x28')]=function(_0x18b124,_0x519c24){return db[_0xf5f2('0x3f')]['find']({'where':{'id':_0x18b124[_0xf5f2('0x43')]['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x519c24,null))[_0xf5f2('0x24')](db[_0xf5f2('0x4f')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x18b124['params']['id']}}))[_0xf5f2('0x24')](removeEntity(_0x519c24,null))['catch'](handleError(_0x519c24,null));}; \ No newline at end of file +var _0xd7d1=['autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','end','error','stack','name','index','map','ContactItemType','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','catch','params','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ContactItemTypes','UserProfileSection','userProfileId'];(function(_0x84492e,_0x1cad19){var _0x565e71=function(_0x179a99){while(--_0x179a99){_0x84492e['push'](_0x84492e['shift']());}};_0x565e71(++_0x1cad19);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x457dab,_0x4e5f31){_0x457dab=_0x457dab-0x0;var _0x423f15=_0xd7d1[_0x457dab];return _0x423f15;};'use strict';var emlformat=require(_0x1d7d('0x0'));var rimraf=require(_0x1d7d('0x1'));var zipdir=require(_0x1d7d('0x2'));var jsonpatch=require(_0x1d7d('0x3'));var rp=require(_0x1d7d('0x4'));var moment=require(_0x1d7d('0x5'));var BPromise=require(_0x1d7d('0x6'));var Mustache=require(_0x1d7d('0x7'));var util=require(_0x1d7d('0x8'));var path=require(_0x1d7d('0x9'));var sox=require(_0x1d7d('0xa'));var csv=require(_0x1d7d('0xb'));var ejs=require(_0x1d7d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d7d('0xd'));var squel=require(_0x1d7d('0xe'));var crypto=require(_0x1d7d('0xf'));var jsforce=require(_0x1d7d('0x10'));var deskjs=require(_0x1d7d('0x11'));var toCsv=require(_0x1d7d('0xb'));var querystring=require(_0x1d7d('0x12'));var Papa=require(_0x1d7d('0x13'));var Redis=require(_0x1d7d('0x14'));var authService=require(_0x1d7d('0x15'));var qs=require(_0x1d7d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d7d('0x17'));var logger=require('../../config/logger')(_0x1d7d('0x18'));var utils=require(_0x1d7d('0x19'));var config=require(_0x1d7d('0x1a'));var licenseUtil=require(_0x1d7d('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11b83f,_0x5ae1c9){_0x5ae1c9=_0x5ae1c9||0xcc;return function(_0x577e07){if(_0x577e07){return _0x11b83f[_0x1d7d('0x1c')](_0x5ae1c9);}return _0x11b83f[_0x1d7d('0x1d')](_0x5ae1c9)['end']();};}function respondWithResult(_0x55dba7,_0x1d3822){_0x1d3822=_0x1d3822||0xc8;return function(_0x334e78){if(_0x334e78){return _0x55dba7[_0x1d7d('0x1d')](_0x1d3822)[_0x1d7d('0x1e')](_0x334e78);}};}function respondWithFilteredResult(_0xeb05b3,_0x53423f){return function(_0x28adf3){if(_0x28adf3){var _0x1de6cc=typeof _0x53423f['offset']===_0x1d7d('0x1f')&&typeof _0x53423f[_0x1d7d('0x20')]===_0x1d7d('0x1f');var _0x47826a=_0x28adf3[_0x1d7d('0x21')];var _0x4db4f2=_0x1de6cc?0x0:_0x53423f[_0x1d7d('0x22')];var _0x191024=_0x1de6cc?_0x28adf3['count']:_0x53423f['offset']+_0x53423f[_0x1d7d('0x20')];var _0x1a5101;if(_0x191024>=_0x47826a){_0x191024=_0x47826a;_0x1a5101=0xc8;}else{_0x1a5101=0xce;}_0xeb05b3[_0x1d7d('0x1d')](_0x1a5101);return _0xeb05b3[_0x1d7d('0x23')](_0x1d7d('0x24'),_0x4db4f2+'-'+_0x191024+'/'+_0x47826a)[_0x1d7d('0x1e')](_0x28adf3);}return null;};}function patchUpdates(_0x54d401){return function(_0x225f85){try{jsonpatch[_0x1d7d('0x25')](_0x225f85,_0x54d401,!![]);}catch(_0x3a93d0){return BPromise['reject'](_0x3a93d0);}return _0x225f85[_0x1d7d('0x26')]();};}function saveUpdates(_0x12c54b,_0x4a1cdc){return function(_0x5950bd){if(_0x5950bd){return _0x5950bd[_0x1d7d('0x27')](_0x12c54b)[_0x1d7d('0x28')](function(_0x3d631f){return _0x3d631f;});}return null;};}function removeEntity(_0x5097b8,_0x377653){return function(_0x106376){if(_0x106376){return _0x106376[_0x1d7d('0x29')]()[_0x1d7d('0x28')](function(){var _0x4fa346=_0x106376[_0x1d7d('0x2a')]({'plain':!![]});var _0x151198='ContactItemTypes';return db['UserProfileResource'][_0x1d7d('0x29')]({'where':{'type':_0x151198,'resourceId':_0x4fa346['id']}})['then'](function(){return _0x106376;});})[_0x1d7d('0x28')](function(){_0x5097b8[_0x1d7d('0x1d')](0xcc)[_0x1d7d('0x2b')]();});}};}function handleEntityNotFound(_0x22c40d,_0x465938){return function(_0x59f827){if(!_0x59f827){_0x22c40d[_0x1d7d('0x1c')](0x194);}return _0x59f827;};}function handleError(_0x98c1ad,_0x352d5a){_0x352d5a=_0x352d5a||0x1f4;return function(_0x58672c){logger[_0x1d7d('0x2c')](_0x58672c[_0x1d7d('0x2d')]);if(_0x58672c[_0x1d7d('0x2e')]){delete _0x58672c['name'];}_0x98c1ad['status'](_0x352d5a)['send'](_0x58672c);};}exports[_0x1d7d('0x2f')]=function(_0x329f56,_0x559f19){var _0x1ebcbc={},_0x3e4136={},_0x16a81d={'count':0x0,'rows':[]};var _0x3336ab=_[_0x1d7d('0x30')](db[_0x1d7d('0x31')][_0x1d7d('0x32')],function(_0x803dc9){return{'name':_0x803dc9[_0x1d7d('0x33')],'type':_0x803dc9[_0x1d7d('0x34')]['key']};});_0x3e4136['model']=_[_0x1d7d('0x30')](_0x3336ab,_0x1d7d('0x2e'));_0x3e4136[_0x1d7d('0x35')]=_[_0x1d7d('0x36')](_0x329f56[_0x1d7d('0x35')]);_0x3e4136[_0x1d7d('0x37')]=_[_0x1d7d('0x38')](_0x3e4136[_0x1d7d('0x39')],_0x3e4136[_0x1d7d('0x35')]);_0x1ebcbc['attributes']=_[_0x1d7d('0x38')](_0x3e4136[_0x1d7d('0x39')],qs[_0x1d7d('0x3a')](_0x329f56[_0x1d7d('0x35')]['fields']));_0x1ebcbc['attributes']=_0x1ebcbc[_0x1d7d('0x3b')][_0x1d7d('0x3c')]?_0x1ebcbc['attributes']:_0x3e4136[_0x1d7d('0x39')];if(!_0x329f56[_0x1d7d('0x35')]['hasOwnProperty']('nolimit')){_0x1ebcbc[_0x1d7d('0x20')]=qs[_0x1d7d('0x20')](_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x20')]);_0x1ebcbc[_0x1d7d('0x22')]=qs[_0x1d7d('0x22')](_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x22')]);}_0x1ebcbc[_0x1d7d('0x3d')]=qs[_0x1d7d('0x3e')](_0x329f56['query']['sort']);_0x1ebcbc['where']=qs['filters'](_[_0x1d7d('0x3f')](_0x329f56['query'],_0x3e4136[_0x1d7d('0x37')]),_0x3336ab);if(_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x40')]){_0x1ebcbc['where']=_[_0x1d7d('0x41')](_0x1ebcbc[_0x1d7d('0x42')],{'$or':_[_0x1d7d('0x30')](_0x3336ab,function(_0x5b7e01){if(_0x5b7e01[_0x1d7d('0x34')]!==_0x1d7d('0x43')){var _0xfb9845={};_0xfb9845[_0x5b7e01[_0x1d7d('0x2e')]]={'$like':'%'+_0x329f56['query'][_0x1d7d('0x40')]+'%'};return _0xfb9845;}})});}_0x1ebcbc=_[_0x1d7d('0x41')]({},_0x1ebcbc,_0x329f56[_0x1d7d('0x44')]);var _0x456d51={'where':_0x1ebcbc['where']};return db[_0x1d7d('0x31')]['count'](_0x456d51)[_0x1d7d('0x28')](function(_0x31b850){_0x16a81d[_0x1d7d('0x21')]=_0x31b850;if(_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x45')]){_0x1ebcbc['include']=[{'all':!![]}];}return db['ContactItemType'][_0x1d7d('0x46')](_0x1ebcbc);})[_0x1d7d('0x28')](function(_0x1637fc){_0x16a81d['rows']=_0x1637fc;return _0x16a81d;})['then'](respondWithFilteredResult(_0x559f19,_0x1ebcbc))[_0x1d7d('0x47')](handleError(_0x559f19,null));};exports['show']=function(_0x86e7bc,_0x379e75){var _0x1d1064={'raw':!![],'where':{'id':_0x86e7bc[_0x1d7d('0x48')]['id']}},_0x21394c={};_0x21394c[_0x1d7d('0x39')]=_[_0x1d7d('0x36')](db['ContactItemType'][_0x1d7d('0x32')]);_0x21394c[_0x1d7d('0x35')]=_['keys'](_0x86e7bc[_0x1d7d('0x35')]);_0x21394c[_0x1d7d('0x37')]=_[_0x1d7d('0x38')](_0x21394c[_0x1d7d('0x39')],_0x21394c[_0x1d7d('0x35')]);_0x1d1064[_0x1d7d('0x3b')]=_[_0x1d7d('0x38')](_0x21394c[_0x1d7d('0x39')],qs[_0x1d7d('0x3a')](_0x86e7bc[_0x1d7d('0x35')][_0x1d7d('0x3a')]));_0x1d1064[_0x1d7d('0x3b')]=_0x1d1064['attributes'][_0x1d7d('0x3c')]?_0x1d1064['attributes']:_0x21394c[_0x1d7d('0x39')];if(_0x86e7bc['query'][_0x1d7d('0x45')]){_0x1d1064[_0x1d7d('0x49')]=[{'all':!![]}];}_0x1d1064=_[_0x1d7d('0x41')]({},_0x1d1064,_0x86e7bc[_0x1d7d('0x44')]);return db['ContactItemType'][_0x1d7d('0x4a')](_0x1d1064)['then'](handleEntityNotFound(_0x379e75,null))['then'](respondWithResult(_0x379e75,null))[_0x1d7d('0x47')](handleError(_0x379e75,null));};exports['create']=function(_0x57e416,_0x3727be){return db[_0x1d7d('0x31')]['create'](_0x57e416[_0x1d7d('0x4b')],{})[_0x1d7d('0x28')](function(_0x527711){var _0x1f3a63=_0x57e416[_0x1d7d('0x4c')][_0x1d7d('0x2a')]({'plain':!![]});if(!_0x1f3a63)throw new Error(_0x1d7d('0x4d'));if(_0x1f3a63['role']==='user'){var _0x3f73eb=_0x527711[_0x1d7d('0x2a')]({'plain':!![]});var _0x35ff5d=_0x1d7d('0x4e');return db[_0x1d7d('0x4f')]['find']({'where':{'name':_0x35ff5d,'userProfileId':_0x1f3a63[_0x1d7d('0x50')]},'raw':!![]})[_0x1d7d('0x28')](function(_0x344b66){if(_0x344b66&&_0x344b66[_0x1d7d('0x51')]===0x0){return db[_0x1d7d('0x52')][_0x1d7d('0x53')]({'name':_0x3f73eb[_0x1d7d('0x2e')],'resourceId':_0x3f73eb['id'],'type':_0x344b66[_0x1d7d('0x2e')],'sectionId':_0x344b66['id']},{})[_0x1d7d('0x28')](function(){return _0x527711;});}else{return _0x527711;}})['catch'](function(_0x3e7c4c){logger[_0x1d7d('0x2c')](_0x1d7d('0x54'),_0x3e7c4c);throw _0x3e7c4c;});}return _0x527711;})['then'](respondWithResult(_0x3727be,0xc9))['catch'](handleError(_0x3727be,null));};exports[_0x1d7d('0x27')]=function(_0x2d4cc3,_0x3f5434){if(_0x2d4cc3['body']['id']){delete _0x2d4cc3[_0x1d7d('0x4b')]['id'];}return db[_0x1d7d('0x31')]['find']({'where':{'id':_0x2d4cc3[_0x1d7d('0x48')]['id']}})[_0x1d7d('0x28')](handleEntityNotFound(_0x3f5434,null))[_0x1d7d('0x28')](saveUpdates(_0x2d4cc3[_0x1d7d('0x4b')],null))['then'](respondWithResult(_0x3f5434,null))[_0x1d7d('0x47')](handleError(_0x3f5434,null));};exports[_0x1d7d('0x29')]=function(_0x4ba6ec,_0x4d4c34){return db[_0x1d7d('0x31')][_0x1d7d('0x4a')]({'where':{'id':_0x4ba6ec['params']['id']}})['then'](handleEntityNotFound(_0x4d4c34,null))[_0x1d7d('0x28')](db[_0x1d7d('0x55')][_0x1d7d('0x27')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4ba6ec[_0x1d7d('0x48')]['id']}}))['then'](removeEntity(_0x4d4c34,null))[_0x1d7d('0x47')](handleError(_0x4d4c34,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 4099f46..76fd014 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 _0x9c44=['request-promise','path','./contactItemType.attributes','define','ContactItemType','tools_contact_item_types','../../config/logger','api','moment','bluebird'];(function(_0x25e9d4,_0x22be89){var _0x43b0d7=function(_0x4ea600){while(--_0x4ea600){_0x25e9d4['push'](_0x25e9d4['shift']());}};_0x43b0d7(++_0x22be89);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4aa7=['define','tools_contact_item_types','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./contactItemType.attributes','exports'];(function(_0x115d41,_0x44266a){var _0x248902=function(_0x5e8f2c){while(--_0x5e8f2c){_0x115d41['push'](_0x115d41['shift']());}};_0x248902(++_0x44266a);}(_0x4aa7,0x15e));var _0x74aa=function(_0x4c0979,_0x2e1b25){_0x4c0979=_0x4c0979-0x0;var _0x509b09=_0x4aa7[_0x4c0979];return _0x509b09;};'use strict';var _=require(_0x74aa('0x0'));var util=require(_0x74aa('0x1'));var logger=require(_0x74aa('0x2'))(_0x74aa('0x3'));var moment=require(_0x74aa('0x4'));var BPromise=require('bluebird');var rp=require(_0x74aa('0x5'));var fs=require('fs');var path=require(_0x74aa('0x6'));var rimraf=require('rimraf');var config=require(_0x74aa('0x7'));var attributes=require(_0x74aa('0x8'));module[_0x74aa('0x9')]=function(_0x5dde63,_0x31a29f){return _0x5dde63[_0x74aa('0xa')]('ContactItemType',attributes,{'tableName':_0x74aa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index c575af0..7834359 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 _0x0bea=['moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util'];(function(_0x4ed955,_0x5b2b35){var _0x24bd1b=function(_0x93d4b6){while(--_0x93d4b6){_0x4ed955['push'](_0x4ed955['shift']());}};_0x24bd1b(++_0x5b2b35);}(_0x0bea,0xee));var _0xa0be=function(_0x3cba80,_0x3024e7){_0x3cba80=_0x3cba80-0x0;var _0x11cb67=_0x0bea[_0x3cba80];return _0x11cb67;};'use strict';var _=require(_0xa0be('0x0'));var util=require(_0xa0be('0x1'));var moment=require(_0xa0be('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa0be('0x3'));var db=require(_0xa0be('0x4'))['db'];var utils=require(_0xa0be('0x5'));var logger=require('../../config/logger')(_0xa0be('0x6'));var config=require(_0xa0be('0x7'));var jayson=require(_0xa0be('0x8'));var client=jayson[_0xa0be('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d2aa8,_0x3cfb56,_0x58a562){return new BPromise(function(_0x4b5a2c,_0x29250a){return client[_0xa0be('0xa')](_0x2d2aa8,_0x58a562)['then'](function(_0x1ebf5a){logger[_0xa0be('0xb')](_0xa0be('0xc'),_0x3cfb56,_0xa0be('0xd'));logger[_0xa0be('0xe')](_0xa0be('0xf'),_0x3cfb56,_0xa0be('0xd'),JSON[_0xa0be('0x10')](_0x1ebf5a));if(_0x1ebf5a[_0xa0be('0x11')]){if(_0x1ebf5a[_0xa0be('0x11')][_0xa0be('0x12')]===0x1f4){logger[_0xa0be('0x11')]('ContactItemType,\x20%s,\x20%s',_0x3cfb56,_0x1ebf5a[_0xa0be('0x11')][_0xa0be('0x13')]);return _0x29250a(_0x1ebf5a[_0xa0be('0x11')][_0xa0be('0x13')]);}logger[_0xa0be('0x11')](_0xa0be('0xc'),_0x3cfb56,_0x1ebf5a['error'][_0xa0be('0x13')]);return _0x4b5a2c(_0x1ebf5a[_0xa0be('0x11')]['message']);}else{logger[_0xa0be('0xb')]('ContactItemType,\x20%s,\x20%s',_0x3cfb56,_0xa0be('0xd'));_0x4b5a2c(_0x1ebf5a['result'][_0xa0be('0x13')]);}})['catch'](function(_0xa1f040){logger[_0xa0be('0x11')](_0xa0be('0xc'),_0x3cfb56,_0xa1f040);_0x29250a(_0xa1f040);});});} \ No newline at end of file +var _0xccd7=['../../config/utils','../../config/logger','rpc','client','request','info','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','message','ContactItemType,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x503877,_0x5b3484){var _0x5c9b14=function(_0x12b6b9){while(--_0x12b6b9){_0x503877['push'](_0x503877['shift']());}};_0x5c9b14(++_0x5b3484);}(_0xccd7,0x185));var _0x7ccd=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xccd7[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x7ccd('0x0'));var util=require(_0x7ccd('0x1'));var moment=require(_0x7ccd('0x2'));var BPromise=require(_0x7ccd('0x3'));var rs=require(_0x7ccd('0x4'));var fs=require('fs');var Redis=require(_0x7ccd('0x5'));var db=require(_0x7ccd('0x6'))['db'];var utils=require(_0x7ccd('0x7'));var logger=require(_0x7ccd('0x8'))(_0x7ccd('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7ccd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34ea24,_0x57516c,_0x22fad7){return new BPromise(function(_0x4ac450,_0x53c0a5){return client[_0x7ccd('0xb')](_0x34ea24,_0x22fad7)['then'](function(_0x304666){logger[_0x7ccd('0xc')]('ContactItemType,\x20%s,\x20%s',_0x57516c,_0x7ccd('0xd'));logger[_0x7ccd('0xe')](_0x7ccd('0xf'),_0x57516c,'request\x20sent',JSON['stringify'](_0x304666));if(_0x304666[_0x7ccd('0x10')]){if(_0x304666['error'][_0x7ccd('0x11')]===0x1f4){logger[_0x7ccd('0x10')]('ContactItemType,\x20%s,\x20%s',_0x57516c,_0x304666[_0x7ccd('0x10')]['message']);return _0x53c0a5(_0x304666[_0x7ccd('0x10')][_0x7ccd('0x12')]);}logger[_0x7ccd('0x10')](_0x7ccd('0x13'),_0x57516c,_0x304666[_0x7ccd('0x10')][_0x7ccd('0x12')]);return _0x4ac450(_0x304666['error'][_0x7ccd('0x12')]);}else{logger[_0x7ccd('0xc')](_0x7ccd('0x13'),_0x57516c,_0x7ccd('0xd'));_0x4ac450(_0x304666[_0x7ccd('0x14')][_0x7ccd('0x12')]);}})[_0x7ccd('0x15')](function(_0x3f4584){logger[_0x7ccd('0x10')](_0x7ccd('0x13'),_0x57516c,_0x3f4584);_0x53c0a5(_0x3f4584);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index dce0785..158fb20 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 _0x4763=['/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index'];(function(_0x268bc2,_0x4b6170){var _0x31c724=function(_0x55e7ad){while(--_0x55e7ad){_0x268bc2['push'](_0x268bc2['shift']());}};_0x31c724(++_0x4b6170);}(_0x4763,0x9f));var _0x3476=function(_0x21f237,_0x568a78){_0x21f237=_0x21f237-0x0;var _0x2197b6=_0x4763[_0x21f237];return _0x2197b6;};'use strict';var multer=require(_0x3476('0x0'));var util=require(_0x3476('0x1'));var path=require(_0x3476('0x2'));var timeout=require(_0x3476('0x3'));var express=require('express');var router=express[_0x3476('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3476('0x5'));var interaction=require(_0x3476('0x6'));var config=require(_0x3476('0x7'));var controller=require(_0x3476('0x8'));router[_0x3476('0x9')]('/',auth[_0x3476('0xa')](),controller[_0x3476('0xb')]);router['get'](_0x3476('0xc'),auth[_0x3476('0xa')](),controller[_0x3476('0xd')]);router[_0x3476('0xe')]('/',auth[_0x3476('0xa')](),controller[_0x3476('0xf')]);router[_0x3476('0x10')]('/:id',auth[_0x3476('0xa')](),controller[_0x3476('0x11')]);router['delete'](_0x3476('0xc'),auth[_0x3476('0xa')](),controller[_0x3476('0x12')]);module['exports']=router; \ No newline at end of file +var _0xdea8=['./contactItemType.controller','get','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xb8b522,_0x725ad4){var _0x4bf5ca=function(_0x26aa1b){while(--_0x26aa1b){_0xb8b522['push'](_0xb8b522['shift']());}};_0x4bf5ca(++_0x725ad4);}(_0xdea8,0x1af));var _0x8dea=function(_0x4a450a,_0x54d42f){_0x4a450a=_0x4a450a-0x0;var _0x28baf9=_0xdea8[_0x4a450a];return _0x28baf9;};'use strict';var multer=require(_0x8dea('0x0'));var util=require(_0x8dea('0x1'));var path=require(_0x8dea('0x2'));var timeout=require(_0x8dea('0x3'));var express=require(_0x8dea('0x4'));var router=express[_0x8dea('0x5')]();var fs_extra=require(_0x8dea('0x6'));var auth=require(_0x8dea('0x7'));var interaction=require(_0x8dea('0x8'));var config=require(_0x8dea('0x9'));var controller=require(_0x8dea('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8dea('0xb')](_0x8dea('0xc'),auth['isAuthenticated'](),controller[_0x8dea('0xd')]);router['post']('/',auth[_0x8dea('0xe')](),controller[_0x8dea('0xf')]);router[_0x8dea('0x10')](_0x8dea('0xc'),auth[_0x8dea('0xe')](),controller[_0x8dea('0x11')]);router[_0x8dea('0x12')](_0x8dea('0xc'),auth[_0x8dea('0xe')](),controller[_0x8dea('0x13')]);module[_0x8dea('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index cf25bf5..bdc3200 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['name','exports','STRING'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x58547b,_0x4b89c2){var _0x1d3fd2=function(_0x4ac500){while(--_0x4ac500){_0x58547b['push'](_0x58547b['shift']());}};_0x1d3fd2(++_0x4b89c2);}(_0xb7e7,0x121));var _0x7b7e=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xb7e7[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index cf47e57..80403f1 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 _0x241c=['update','then','get','end','stack','name','map','Dashboard','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','userProfileId','UserProfileResource','error','destroy','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardItem','getItems','findOne','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/license/util','defaults','redis','socket.io-emitter','./dashboard.socket','register','status','json','offset','limit','count','set','Content-Range','save'];(function(_0x16c42c,_0x17a056){var _0x42618e=function(_0x564309){while(--_0x564309){_0x16c42c['push'](_0x16c42c['shift']());}};_0x42618e(++_0x17a056);}(_0x241c,0x14d));var _0xc241=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x241c[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc241('0x0'));var zipdir=require(_0xc241('0x1'));var jsonpatch=require(_0xc241('0x2'));var rp=require(_0xc241('0x3'));var moment=require(_0xc241('0x4'));var BPromise=require(_0xc241('0x5'));var Mustache=require(_0xc241('0x6'));var util=require(_0xc241('0x7'));var path=require(_0xc241('0x8'));var sox=require(_0xc241('0x9'));var csv=require(_0xc241('0xa'));var ejs=require(_0xc241('0xb'));var fs=require('fs');var fs_extra=require(_0xc241('0xc'));var _=require(_0xc241('0xd'));var squel=require('squel');var crypto=require(_0xc241('0xe'));var jsforce=require(_0xc241('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc241('0xa'));var querystring=require(_0xc241('0x10'));var Papa=require(_0xc241('0x11'));var Redis=require(_0xc241('0x12'));var authService=require(_0xc241('0x13'));var qs=require(_0xc241('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc241('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc241('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc241('0x17')](config[_0xc241('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xc241('0x19'))(new Redis(config[_0xc241('0x18')]));require(_0xc241('0x1a'))[_0xc241('0x1b')](socket);function respondWithStatusCode(_0x40cf54,_0x1d5db5){_0x1d5db5=_0x1d5db5||0xcc;return function(_0x26d7f9){if(_0x26d7f9){return _0x40cf54['sendStatus'](_0x1d5db5);}return _0x40cf54[_0xc241('0x1c')](_0x1d5db5)['end']();};}function respondWithResult(_0xd0b9fb,_0x17ce7e){_0x17ce7e=_0x17ce7e||0xc8;return function(_0x5446d7){if(_0x5446d7){return _0xd0b9fb['status'](_0x17ce7e)[_0xc241('0x1d')](_0x5446d7);}};}function respondWithFilteredResult(_0x4fed67,_0x262a98){return function(_0x4cb4f6){if(_0x4cb4f6){var _0x4e62b5=typeof _0x262a98[_0xc241('0x1e')]==='undefined'&&typeof _0x262a98[_0xc241('0x1f')]==='undefined';var _0x16d2a7=_0x4cb4f6[_0xc241('0x20')];var _0x5730fe=_0x4e62b5?0x0:_0x262a98[_0xc241('0x1e')];var _0x468757=_0x4e62b5?_0x4cb4f6['count']:_0x262a98['offset']+_0x262a98[_0xc241('0x1f')];var _0x50d317;if(_0x468757>=_0x16d2a7){_0x468757=_0x16d2a7;_0x50d317=0xc8;}else{_0x50d317=0xce;}_0x4fed67[_0xc241('0x1c')](_0x50d317);return _0x4fed67[_0xc241('0x21')](_0xc241('0x22'),_0x5730fe+'-'+_0x468757+'/'+_0x16d2a7)[_0xc241('0x1d')](_0x4cb4f6);}return null;};}function patchUpdates(_0x174158){return function(_0x184f4d){try{jsonpatch['apply'](_0x184f4d,_0x174158,!![]);}catch(_0x30b2bc){return BPromise['reject'](_0x30b2bc);}return _0x184f4d[_0xc241('0x23')]();};}function saveUpdates(_0xfe54d2,_0x18bf1d){return function(_0x34248f){if(_0x34248f){return _0x34248f[_0xc241('0x24')](_0xfe54d2)[_0xc241('0x25')](function(_0x2b9063){return _0x2b9063;});}return null;};}function removeEntity(_0xffc885,_0x445e65){return function(_0x202bd0){if(_0x202bd0){return _0x202bd0['destroy']()[_0xc241('0x25')](function(){var _0x26fa3d=_0x202bd0[_0xc241('0x26')]({'plain':!![]});var _0xd9ccdd='CustomDashboards';return db['UserProfileResource']['destroy']({'where':{'type':_0xd9ccdd,'resourceId':_0x26fa3d['id']}})[_0xc241('0x25')](function(){return _0x202bd0;});})[_0xc241('0x25')](function(){_0xffc885[_0xc241('0x1c')](0xcc)[_0xc241('0x27')]();});}};}function handleEntityNotFound(_0x8f489,_0x1740a7){return function(_0x5a5415){if(!_0x5a5415){_0x8f489['sendStatus'](0x194);}return _0x5a5415;};}function handleError(_0x306e6a,_0x58db11){_0x58db11=_0x58db11||0x1f4;return function(_0x2d5977){logger['error'](_0x2d5977[_0xc241('0x28')]);if(_0x2d5977[_0xc241('0x29')]){delete _0x2d5977['name'];}_0x306e6a[_0xc241('0x1c')](_0x58db11)['send'](_0x2d5977);};}exports['index']=function(_0x29578c,_0x572c77){var _0x3a3482={},_0x41089e={},_0x53c4eb={'count':0x0,'rows':[]};var _0x235bb4=_[_0xc241('0x2a')](db[_0xc241('0x2b')][_0xc241('0x2c')],function(_0x270313){return{'name':_0x270313['fieldName'],'type':_0x270313[_0xc241('0x2d')]['key']};});_0x41089e[_0xc241('0x2e')]=_[_0xc241('0x2a')](_0x235bb4,_0xc241('0x29'));_0x41089e[_0xc241('0x2f')]=_[_0xc241('0x30')](_0x29578c[_0xc241('0x2f')]);_0x41089e[_0xc241('0x31')]=_['intersection'](_0x41089e[_0xc241('0x2e')],_0x41089e[_0xc241('0x2f')]);_0x3a3482[_0xc241('0x32')]=_[_0xc241('0x33')](_0x41089e[_0xc241('0x2e')],qs[_0xc241('0x34')](_0x29578c['query'][_0xc241('0x34')]));_0x3a3482[_0xc241('0x32')]=_0x3a3482['attributes'][_0xc241('0x35')]?_0x3a3482[_0xc241('0x32')]:_0x41089e[_0xc241('0x2e')];if(!_0x29578c[_0xc241('0x2f')][_0xc241('0x36')]('nolimit')){_0x3a3482[_0xc241('0x1f')]=qs['limit'](_0x29578c[_0xc241('0x2f')][_0xc241('0x1f')]);_0x3a3482['offset']=qs[_0xc241('0x1e')](_0x29578c[_0xc241('0x2f')][_0xc241('0x1e')]);}_0x3a3482[_0xc241('0x37')]=qs[_0xc241('0x38')](_0x29578c['query']['sort']);_0x3a3482[_0xc241('0x39')]=qs['filters'](_[_0xc241('0x3a')](_0x29578c[_0xc241('0x2f')],_0x41089e[_0xc241('0x31')]),_0x235bb4);if(_0x29578c[_0xc241('0x2f')][_0xc241('0x3b')]){_0x3a3482['where']=_[_0xc241('0x3c')](_0x3a3482[_0xc241('0x39')],{'$or':_[_0xc241('0x2a')](_0x235bb4,function(_0x3abf22){if(_0x3abf22[_0xc241('0x2d')]!=='VIRTUAL'){var _0x1c934c={};_0x1c934c[_0x3abf22['name']]={'$like':'%'+_0x29578c['query']['filter']+'%'};return _0x1c934c;}})});}_0x3a3482=_[_0xc241('0x3c')]({},_0x3a3482,_0x29578c[_0xc241('0x3d')]);var _0x5c4287={'where':_0x3a3482[_0xc241('0x39')]};return db[_0xc241('0x2b')]['count'](_0x5c4287)['then'](function(_0x15b975){_0x53c4eb[_0xc241('0x20')]=_0x15b975;if(_0x29578c[_0xc241('0x2f')][_0xc241('0x3e')]){_0x3a3482[_0xc241('0x3f')]=[{'all':!![]}];}return db[_0xc241('0x2b')]['findAll'](_0x3a3482);})[_0xc241('0x25')](function(_0x5cc0a2){_0x53c4eb[_0xc241('0x40')]=_0x5cc0a2;return _0x53c4eb;})[_0xc241('0x25')](respondWithFilteredResult(_0x572c77,_0x3a3482))[_0xc241('0x41')](handleError(_0x572c77,null));};exports['show']=function(_0xd9ff88,_0x2ae243){var _0x525280={'raw':![],'where':{'id':_0xd9ff88[_0xc241('0x42')]['id']}},_0x107eaa={};_0x107eaa[_0xc241('0x2e')]=_['keys'](db['Dashboard'][_0xc241('0x2c')]);_0x107eaa['query']=_['keys'](_0xd9ff88[_0xc241('0x2f')]);_0x107eaa[_0xc241('0x31')]=_[_0xc241('0x33')](_0x107eaa[_0xc241('0x2e')],_0x107eaa[_0xc241('0x2f')]);_0x525280['attributes']=_[_0xc241('0x33')](_0x107eaa['model'],qs[_0xc241('0x34')](_0xd9ff88[_0xc241('0x2f')][_0xc241('0x34')]));_0x525280[_0xc241('0x32')]=_0x525280['attributes']['length']?_0x525280['attributes']:_0x107eaa[_0xc241('0x2e')];if(_0xd9ff88['query'][_0xc241('0x3e')]){_0x525280[_0xc241('0x3f')]=[{'all':!![]}];}_0x525280=_[_0xc241('0x3c')]({},_0x525280,_0xd9ff88['options']);return db[_0xc241('0x2b')][_0xc241('0x43')](_0x525280)[_0xc241('0x25')](handleEntityNotFound(_0x2ae243,null))[_0xc241('0x25')](respondWithResult(_0x2ae243,null))[_0xc241('0x41')](handleError(_0x2ae243,null));};exports[_0xc241('0x44')]=function(_0x12de83,_0x3253fc){return db['Dashboard'][_0xc241('0x44')](_0x12de83[_0xc241('0x45')],{})[_0xc241('0x25')](function(_0x453628){var _0x3f1eed=_0x12de83[_0xc241('0x46')][_0xc241('0x26')]({'plain':!![]});if(!_0x3f1eed)throw new Error(_0xc241('0x47'));if(_0x3f1eed[_0xc241('0x48')]===_0xc241('0x46')){var _0xbeafe5=_0x453628[_0xc241('0x26')]({'plain':!![]});var _0x4c238a=_0xc241('0x49');return db[_0xc241('0x4a')]['find']({'where':{'name':_0x4c238a,'userProfileId':_0x3f1eed['userProfileId']},'raw':!![]})[_0xc241('0x25')](function(_0x2d61a3){if(_0x2d61a3&&_0x2d61a3[_0xc241('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0xbeafe5[_0xc241('0x29')],'resourceId':_0xbeafe5['id'],'type':_0x2d61a3[_0xc241('0x29')],'sectionId':_0x2d61a3['id']},{})[_0xc241('0x25')](function(){return _0x453628;});}else{return _0x453628;}})['catch'](function(_0x8fa89){logger['error'](_0xc241('0x4c'),_0x8fa89);throw _0x8fa89;});}return _0x453628;})[_0xc241('0x25')](respondWithResult(_0x3253fc,0xc9))[_0xc241('0x41')](handleError(_0x3253fc,null));};exports['clone']=function(_0x5cdb34,_0x48954b){var _0x16838b={'where':{'id':_0x5cdb34[_0xc241('0x42')]['id']}},_0x26576e={};_0x26576e[_0xc241('0x2e')]=_[_0xc241('0x30')](db[_0xc241('0x2b')][_0xc241('0x2c')]);_0x16838b[_0xc241('0x32')]=_['intersection'](_0x26576e[_0xc241('0x2e')],qs['fields'](_0x5cdb34[_0xc241('0x2f')][_0xc241('0x34')]));_0x16838b[_0xc241('0x32')]=_0x16838b['attributes']['length']?_0x16838b[_0xc241('0x32')]:_0x26576e[_0xc241('0x2e')];if(_0x5cdb34[_0xc241('0x2f')]['includeAll']){_0x16838b[_0xc241('0x3f')]=[{'all':!![]}];}_0x16838b=_[_0xc241('0x3c')]({},_0x16838b,_0x5cdb34[_0xc241('0x3d')]);return db[_0xc241('0x2b')]['find'](_0x16838b)[_0xc241('0x25')](handleEntityNotFound(_0x48954b,null))['then'](function(_0x3ef51e){if(_0x3ef51e){var _0x1387eb=_0x3ef51e['get']({'plain':!![]});_0x1387eb=qs[_0xc241('0x4d')](_0x1387eb,['id','createdAt',_0xc241('0x4e')]);_0x5cdb34[_0xc241('0x45')]=_[_0xc241('0x4d')](_0x5cdb34[_0xc241('0x45')],['id',_0xc241('0x4f'),'updatedAt']);return db[_0xc241('0x2b')][_0xc241('0x44')](_[_0xc241('0x3c')](_0x1387eb,_0x5cdb34['body']),{'include':_0x5cdb34['query'][_0xc241('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x1c0d37){var _0x4be38b=_0x5cdb34[_0xc241('0x46')][_0xc241('0x26')]({'plain':!![]});if(!_0x4be38b)throw new Error(_0xc241('0x47'));if(_0x4be38b[_0xc241('0x48')]===_0xc241('0x46')){var _0x12f8da=_0x1c0d37[_0xc241('0x26')]({'plain':!![]});var _0x4db103=_0xc241('0x49');return db[_0xc241('0x4a')][_0xc241('0x43')]({'where':{'name':_0x4db103,'userProfileId':_0x4be38b[_0xc241('0x50')]},'raw':!![]})[_0xc241('0x25')](function(_0x5561e3){if(_0x5561e3&&_0x5561e3['autoAssociation']===0x0){return db[_0xc241('0x51')][_0xc241('0x44')]({'name':_0x12f8da[_0xc241('0x29')],'resourceId':_0x12f8da['id'],'type':_0x5561e3[_0xc241('0x29')],'sectionId':_0x5561e3['id']},{})[_0xc241('0x25')](function(){return _0x1c0d37;});}else{return _0x1c0d37;}})[_0xc241('0x41')](function(_0x4eb7ab){logger[_0xc241('0x52')](_0xc241('0x4c'),_0x4eb7ab);throw _0x4eb7ab;});}return _0x1c0d37;});}})[_0xc241('0x25')](respondWithResult(_0x48954b,0xc9))[_0xc241('0x41')](handleError(_0x48954b,null));};exports[_0xc241('0x24')]=function(_0x303ebe,_0x449699){if(_0x303ebe[_0xc241('0x45')]['id']){delete _0x303ebe[_0xc241('0x45')]['id'];}return db[_0xc241('0x2b')]['find']({'where':{'id':_0x303ebe[_0xc241('0x42')]['id']}})['then'](handleEntityNotFound(_0x449699,null))[_0xc241('0x25')](saveUpdates(_0x303ebe['body'],null))[_0xc241('0x25')](respondWithResult(_0x449699,null))[_0xc241('0x41')](handleError(_0x449699,null));};exports[_0xc241('0x53')]=function(_0x2b86d8,_0x4750d8){return db[_0xc241('0x2b')]['find']({'where':{'id':_0x2b86d8[_0xc241('0x42')]['id']}})['then'](handleEntityNotFound(_0x4750d8,null))[_0xc241('0x25')](removeEntity(_0x4750d8,null))[_0xc241('0x41')](handleError(_0x4750d8,null));};function widgetAttributes(_0x14a9bf){try{switch(_0x14a9bf[_0xc241('0x2d')]){case _0xc241('0x54'):return[{'name':_0xc241('0x55'),'value':_0x14a9bf['attrUrl']||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf['attrs'][0x0]?_0x14a9bf['attrs'][0x0]['value']:undefined)||_0xc241('0x57')}];case _0xc241('0x58'):return[{'name':_0xc241('0x59'),'value':_0x14a9bf['attrPath']||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf[_0xc241('0x56')][0x0]?_0x14a9bf[_0xc241('0x56')][0x0][_0xc241('0x5a')]:undefined)||''}];case _0xc241('0x5b'):return[{'name':_0xc241('0x5c'),'value':_0x14a9bf['attrHourFormat']||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf['attrs'][0x0]?_0x14a9bf[_0xc241('0x56')][0x0]['value']:undefined)||_0xc241('0x5d')},{'name':'attrTimezone','value':_0x14a9bf[_0xc241('0x5e')]||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf[_0xc241('0x56')][0x1]?_0x14a9bf['attrs'][0x1][_0xc241('0x5a')]:undefined)||_0xc241('0x5f')},{'name':_0xc241('0x60'),'value':_0x14a9bf[_0xc241('0x60')]||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf['attrs'][0x2]?_0x14a9bf[_0xc241('0x56')][0x2]['value']:undefined)||0xc}];case _0xc241('0x61'):return[{'name':'attrMetric','value':_0x14a9bf[_0xc241('0x62')]||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf[_0xc241('0x56')][0x0]?_0x14a9bf[_0xc241('0x56')][0x0]['value']:undefined)||_0xc241('0x63')},{'name':_0xc241('0x64'),'value':_0x14a9bf[_0xc241('0x64')]||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf[_0xc241('0x56')][0x1]?_0x14a9bf[_0xc241('0x56')][0x1]['value']:undefined)||[]},{'name':_0xc241('0x60'),'value':_0x14a9bf[_0xc241('0x60')]||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf['attrs'][0x2]?_0x14a9bf[_0xc241('0x56')][0x2][_0xc241('0x5a')]:undefined)||0x14},{'name':_0xc241('0x65'),'value':_0x14a9bf['attrChannel']||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf[_0xc241('0x56')][0x3]?_0x14a9bf['attrs'][0x3][_0xc241('0x5a')]:undefined)||_0xc241('0x66')},{'name':_0xc241('0x67'),'value':_0x14a9bf[_0xc241('0x67')]||(_0x14a9bf['attrs']&&_0x14a9bf[_0xc241('0x56')][0x4]?_0x14a9bf[_0xc241('0x56')][0x4]['value']:undefined)||''},{'name':_0xc241('0x68'),'value':_0x14a9bf[_0xc241('0x68')]||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf[_0xc241('0x56')][0x5]?_0x14a9bf[_0xc241('0x56')][0x5][_0xc241('0x5a')]:undefined)||''},{'name':_0xc241('0x69'),'value':_0x14a9bf[_0xc241('0x69')]||(_0x14a9bf['attrs']&&_0x14a9bf[_0xc241('0x56')][0x6]?_0x14a9bf[_0xc241('0x56')][0x6][_0xc241('0x5a')]:undefined)||''},{'name':_0xc241('0x6a'),'value':_0x14a9bf[_0xc241('0x6a')]||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf['attrs'][0x7]?_0x14a9bf[_0xc241('0x56')][0x7][_0xc241('0x5a')]:undefined)||''},{'name':_0xc241('0x6b'),'value':_0x14a9bf['attrWhatsappAccounts']||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf['attrs'][0x8]?_0x14a9bf[_0xc241('0x56')][0x8][_0xc241('0x5a')]:undefined)||''},{'name':_0xc241('0x6c'),'value':_0x14a9bf[_0xc241('0x6c')]||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf[_0xc241('0x56')][0x9]?_0x14a9bf[_0xc241('0x56')][0x9]['value']:undefined)||''}];case'multibar-chart':case _0xc241('0x6d'):return[{'name':_0xc241('0x6e'),'value':_0x14a9bf[_0xc241('0x6e')]||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf[_0xc241('0x56')][0x0]?_0x14a9bf['attrs'][0x0][_0xc241('0x5a')]:undefined)||'total'},{'name':_0xc241('0x6f'),'value':_0x14a9bf['attrSerie2']||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf[_0xc241('0x56')][0x1]?_0x14a9bf[_0xc241('0x56')][0x1][_0xc241('0x5a')]:undefined)||null},{'name':_0xc241('0x70'),'value':_0x14a9bf[_0xc241('0x70')]||(_0x14a9bf['attrs']&&_0x14a9bf['attrs'][0x2]?_0x14a9bf[_0xc241('0x56')][0x2][_0xc241('0x5a')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x14a9bf[_0xc241('0x64')]||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf[_0xc241('0x56')][0x3]?_0x14a9bf[_0xc241('0x56')][0x3][_0xc241('0x5a')]:undefined)||[]},{'name':'attrChannel','value':_0x14a9bf[_0xc241('0x65')]||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf[_0xc241('0x56')][0x4]?_0x14a9bf[_0xc241('0x56')][0x4][_0xc241('0x5a')]:undefined)||_0xc241('0x66')},{'name':'attrEmailAccounts','value':_0x14a9bf['attrEmailAccounts']||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf[_0xc241('0x56')][0x5]?_0x14a9bf[_0xc241('0x56')][0x5]['value']:undefined)||''},{'name':_0xc241('0x68'),'value':_0x14a9bf[_0xc241('0x68')]||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf['attrs'][0x6]?_0x14a9bf[_0xc241('0x56')][0x6][_0xc241('0x5a')]:undefined)||''},{'name':_0xc241('0x69'),'value':_0x14a9bf['attrSmsAccounts']||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf[_0xc241('0x56')][0x7]?_0x14a9bf['attrs'][0x7]['value']:undefined)||''},{'name':_0xc241('0x6a'),'value':_0x14a9bf['attrOpenchannelAccounts']||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf[_0xc241('0x56')][0x8]?_0x14a9bf[_0xc241('0x56')][0x8][_0xc241('0x5a')]:undefined)||''},{'name':_0xc241('0x6b'),'value':_0x14a9bf['attrWhatsappAccounts']||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf[_0xc241('0x56')][0x9]?_0x14a9bf['attrs'][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x14a9bf[_0xc241('0x6c')]||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf[_0xc241('0x56')][0xa]?_0x14a9bf[_0xc241('0x56')][0xa]['value']:undefined)||''}];case _0xc241('0x71'):return[{'name':_0xc241('0x72'),'type':_0x14a9bf[_0xc241('0x73')]||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf[_0xc241('0x56')][0x0]?_0x14a9bf[_0xc241('0x56')][0x0][_0xc241('0x2d')]:undefined)||null,'value':_0x14a9bf[_0xc241('0x72')]||(_0x14a9bf[_0xc241('0x56')]&&_0x14a9bf['attrs'][0x0]?_0x14a9bf[_0xc241('0x56')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x14a9bf[_0xc241('0x74')]||(_0x14a9bf['attrs']&&_0x14a9bf[_0xc241('0x56')][0x1]?_0x14a9bf['attrs'][0x1][_0xc241('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0xb3e7e2){logger[_0xc241('0x52')](_0xc241('0x75'),JSON[_0xc241('0x76')](_0xb3e7e2));return[];}}exports['addItem']=function(_0x4f01a9,_0x8700f9,_0x3cbf14){if(_0x4f01a9[_0xc241('0x45')]['id']){delete _0x4f01a9[_0xc241('0x45')]['id'];}return db[_0xc241('0x2b')][_0xc241('0x43')]({'where':{'id':_0x4f01a9['params']['id']}})['then'](handleEntityNotFound(_0x8700f9,null))[_0xc241('0x25')](function(_0x97ce7){if(_0x97ce7){_0x4f01a9[_0xc241('0x45')]['DashboardId']=_0x97ce7['id'];_0x4f01a9[_0xc241('0x45')][_0xc241('0x56')]=widgetAttributes(_0x4f01a9[_0xc241('0x45')]);return db[_0xc241('0x77')]['create'](_0x4f01a9[_0xc241('0x45')]);}})[_0xc241('0x25')](respondWithResult(_0x8700f9,null))[_0xc241('0x41')](handleError(_0x8700f9,null));};exports[_0xc241('0x78')]=function(_0x211abf,_0x307ad6,_0x51b60b){var _0x44af63={};var _0x53ea14={};var _0x4b4727;var _0x5f3358;return db[_0xc241('0x2b')][_0xc241('0x79')]({'where':{'id':_0x211abf[_0xc241('0x42')]['id']}})['then'](handleEntityNotFound(_0x307ad6,null))['then'](function(_0x3e8466){if(_0x3e8466){_0x4b4727=_0x3e8466;_0x53ea14[_0xc241('0x2e')]=_['keys'](db[_0xc241('0x77')][_0xc241('0x2c')]);_0x53ea14[_0xc241('0x2f')]=_[_0xc241('0x30')](_0x211abf[_0xc241('0x2f')]);_0x53ea14[_0xc241('0x31')]=_[_0xc241('0x33')](_0x53ea14[_0xc241('0x2e')],_0x53ea14[_0xc241('0x2f')]);_0x44af63[_0xc241('0x32')]=_[_0xc241('0x33')](_0x53ea14[_0xc241('0x2e')],qs[_0xc241('0x34')](_0x211abf[_0xc241('0x2f')]['fields']));_0x44af63[_0xc241('0x32')]=_0x44af63['attributes'][_0xc241('0x35')]?_0x44af63['attributes']:_0x53ea14['model'];_0x44af63[_0xc241('0x37')]=qs[_0xc241('0x38')](_0x211abf['query'][_0xc241('0x38')]);_0x44af63['where']=qs[_0xc241('0x31')](_['pick'](_0x211abf[_0xc241('0x2f')],_0x53ea14[_0xc241('0x31')]));if(_0x211abf[_0xc241('0x2f')][_0xc241('0x3b')]){_0x44af63[_0xc241('0x39')]=_['merge'](_0x44af63[_0xc241('0x39')],{'$or':_[_0xc241('0x2a')](_0x44af63[_0xc241('0x32')],function(_0x35a7e7){var _0x153765={};_0x153765[_0x35a7e7]={'$like':'%'+_0x211abf['query'][_0xc241('0x3b')]+'%'};return _0x153765;})});}_0x44af63=_[_0xc241('0x3c')]({},_0x44af63,_0x211abf[_0xc241('0x3d')]);return _0x4b4727[_0xc241('0x78')](_0x44af63);}})['then'](function(_0x1ff815){if(_0x1ff815){_0x5f3358=_0x1ff815[_0xc241('0x35')];if(!_0x211abf[_0xc241('0x2f')][_0xc241('0x36')](_0xc241('0x7a'))){_0x44af63[_0xc241('0x1f')]=qs['limit'](_0x211abf[_0xc241('0x2f')][_0xc241('0x1f')]);_0x44af63[_0xc241('0x1e')]=qs[_0xc241('0x1e')](_0x211abf[_0xc241('0x2f')][_0xc241('0x1e')]);}return _0x4b4727['getItems'](_0x44af63);}})[_0xc241('0x25')](function(_0x68619c){if(_0x68619c){return _0x68619c?{'count':_0x5f3358,'rows':_0x68619c}:null;}})['then'](respondWithResult(_0x307ad6,null))[_0xc241('0x41')](handleError(_0x307ad6,null));}; \ No newline at end of file +var _0x6db7=['sort','where','filters','pick','filter','merge','type','options','Dashboard','include','findAll','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','find','createdAt','updatedAt','omit','UserProfileResource','attrUrl','attrs','https://','custom','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','findOne','getItems','nolimit','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','CustomDashboards','error','name','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x3582e8,_0x525f55){var _0x2d433d=function(_0x167f85){while(--_0x167f85){_0x3582e8['push'](_0x3582e8['shift']());}};_0x2d433d(++_0x525f55);}(_0x6db7,0x13e));var _0x76db=function(_0x55af86,_0x5c8ff6){_0x55af86=_0x55af86-0x0;var _0x58df3b=_0x6db7[_0x55af86];return _0x58df3b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x76db('0x0'));var jsonpatch=require(_0x76db('0x1'));var rp=require('request-promise');var moment=require(_0x76db('0x2'));var BPromise=require(_0x76db('0x3'));var Mustache=require(_0x76db('0x4'));var util=require(_0x76db('0x5'));var path=require(_0x76db('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76db('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76db('0x8'));var squel=require(_0x76db('0x9'));var crypto=require(_0x76db('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x76db('0xb'));var toCsv=require(_0x76db('0xc'));var querystring=require(_0x76db('0xd'));var Papa=require('papaparse');var Redis=require(_0x76db('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x76db('0xf'));var as=require(_0x76db('0x10'));var hardwareService=require(_0x76db('0x11'));var logger=require('../../config/logger')(_0x76db('0x12'));var utils=require(_0x76db('0x13'));var config=require(_0x76db('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x76db('0x15'))['db'];config[_0x76db('0x16')]=_[_0x76db('0x17')](config[_0x76db('0x16')],{'host':_0x76db('0x18'),'port':0x18eb});var socket=require(_0x76db('0x19'))(new Redis(config[_0x76db('0x16')]));require('./dashboard.socket')[_0x76db('0x1a')](socket);function respondWithStatusCode(_0x8b47d7,_0x52734e){_0x52734e=_0x52734e||0xcc;return function(_0x200e6e){if(_0x200e6e){return _0x8b47d7[_0x76db('0x1b')](_0x52734e);}return _0x8b47d7[_0x76db('0x1c')](_0x52734e)[_0x76db('0x1d')]();};}function respondWithResult(_0x16af2f,_0x5ef0e6){_0x5ef0e6=_0x5ef0e6||0xc8;return function(_0x69d8e0){if(_0x69d8e0){return _0x16af2f[_0x76db('0x1c')](_0x5ef0e6)['json'](_0x69d8e0);}};}function respondWithFilteredResult(_0x315a5d,_0x1696e3){return function(_0x1d6c26){if(_0x1d6c26){var _0x18caec=typeof _0x1696e3['offset']===_0x76db('0x1e')&&typeof _0x1696e3[_0x76db('0x1f')]===_0x76db('0x1e');var _0x40d56c=_0x1d6c26['count'];var _0x44a9ac=_0x18caec?0x0:_0x1696e3[_0x76db('0x20')];var _0x2c1b84=_0x18caec?_0x1d6c26[_0x76db('0x21')]:_0x1696e3[_0x76db('0x20')]+_0x1696e3['limit'];var _0x5edfc3;if(_0x2c1b84>=_0x40d56c){_0x2c1b84=_0x40d56c;_0x5edfc3=0xc8;}else{_0x5edfc3=0xce;}_0x315a5d[_0x76db('0x1c')](_0x5edfc3);return _0x315a5d[_0x76db('0x22')](_0x76db('0x23'),_0x44a9ac+'-'+_0x2c1b84+'/'+_0x40d56c)[_0x76db('0x24')](_0x1d6c26);}return null;};}function patchUpdates(_0xecbe0){return function(_0xa44b80){try{jsonpatch[_0x76db('0x25')](_0xa44b80,_0xecbe0,!![]);}catch(_0x11168c){return BPromise[_0x76db('0x26')](_0x11168c);}return _0xa44b80[_0x76db('0x27')]();};}function saveUpdates(_0x4f4772,_0x141e4d){return function(_0x2e731e){if(_0x2e731e){return _0x2e731e[_0x76db('0x28')](_0x4f4772)['then'](function(_0x20f961){return _0x20f961;});}return null;};}function removeEntity(_0x1d7ae7,_0x5e7458){return function(_0x1e9cb2){if(_0x1e9cb2){return _0x1e9cb2[_0x76db('0x29')]()[_0x76db('0x2a')](function(){var _0x4c8bdf=_0x1e9cb2[_0x76db('0x2b')]({'plain':!![]});var _0x47bb3=_0x76db('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x47bb3,'resourceId':_0x4c8bdf['id']}})[_0x76db('0x2a')](function(){return _0x1e9cb2;});})[_0x76db('0x2a')](function(){_0x1d7ae7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e7e00,_0x17c1c1){return function(_0x556c54){if(!_0x556c54){_0x5e7e00[_0x76db('0x1b')](0x194);}return _0x556c54;};}function handleError(_0x39b58e,_0x393fd8){_0x393fd8=_0x393fd8||0x1f4;return function(_0x345500){logger[_0x76db('0x2d')](_0x345500['stack']);if(_0x345500['name']){delete _0x345500[_0x76db('0x2e')];}_0x39b58e[_0x76db('0x1c')](_0x393fd8)['send'](_0x345500);};}exports['index']=function(_0xd2991f,_0x2a8dba){var _0xa7b766={},_0x1796c6={},_0x4e1b3c={'count':0x0,'rows':[]};var _0x494ace=_['map'](db['Dashboard'][_0x76db('0x2f')],function(_0x4e8d4a){return{'name':_0x4e8d4a[_0x76db('0x30')],'type':_0x4e8d4a['type'][_0x76db('0x31')]};});_0x1796c6[_0x76db('0x32')]=_[_0x76db('0x33')](_0x494ace,_0x76db('0x2e'));_0x1796c6[_0x76db('0x34')]=_[_0x76db('0x35')](_0xd2991f[_0x76db('0x34')]);_0x1796c6['filters']=_[_0x76db('0x36')](_0x1796c6['model'],_0x1796c6['query']);_0xa7b766[_0x76db('0x37')]=_[_0x76db('0x36')](_0x1796c6['model'],qs[_0x76db('0x38')](_0xd2991f[_0x76db('0x34')]['fields']));_0xa7b766['attributes']=_0xa7b766[_0x76db('0x37')][_0x76db('0x39')]?_0xa7b766[_0x76db('0x37')]:_0x1796c6['model'];if(!_0xd2991f[_0x76db('0x34')][_0x76db('0x3a')]('nolimit')){_0xa7b766[_0x76db('0x1f')]=qs[_0x76db('0x1f')](_0xd2991f[_0x76db('0x34')][_0x76db('0x1f')]);_0xa7b766[_0x76db('0x20')]=qs[_0x76db('0x20')](_0xd2991f[_0x76db('0x34')][_0x76db('0x20')]);}_0xa7b766[_0x76db('0x3b')]=qs[_0x76db('0x3c')](_0xd2991f[_0x76db('0x34')][_0x76db('0x3c')]);_0xa7b766[_0x76db('0x3d')]=qs[_0x76db('0x3e')](_[_0x76db('0x3f')](_0xd2991f['query'],_0x1796c6[_0x76db('0x3e')]),_0x494ace);if(_0xd2991f['query'][_0x76db('0x40')]){_0xa7b766[_0x76db('0x3d')]=_[_0x76db('0x41')](_0xa7b766['where'],{'$or':_[_0x76db('0x33')](_0x494ace,function(_0x3cc5b8){if(_0x3cc5b8[_0x76db('0x42')]!=='VIRTUAL'){var _0x377aa1={};_0x377aa1[_0x3cc5b8['name']]={'$like':'%'+_0xd2991f['query']['filter']+'%'};return _0x377aa1;}})});}_0xa7b766=_[_0x76db('0x41')]({},_0xa7b766,_0xd2991f[_0x76db('0x43')]);var _0x5b0aba={'where':_0xa7b766[_0x76db('0x3d')]};return db[_0x76db('0x44')][_0x76db('0x21')](_0x5b0aba)[_0x76db('0x2a')](function(_0xc90198){_0x4e1b3c['count']=_0xc90198;if(_0xd2991f[_0x76db('0x34')]['includeAll']){_0xa7b766[_0x76db('0x45')]=[{'all':!![]}];}return db[_0x76db('0x44')][_0x76db('0x46')](_0xa7b766);})[_0x76db('0x2a')](function(_0x42d1b0){_0x4e1b3c['rows']=_0x42d1b0;return _0x4e1b3c;})[_0x76db('0x2a')](respondWithFilteredResult(_0x2a8dba,_0xa7b766))['catch'](handleError(_0x2a8dba,null));};exports['show']=function(_0x1713a1,_0x5a2e18){var _0x389f50={'raw':![],'where':{'id':_0x1713a1[_0x76db('0x47')]['id']}},_0x35822e={};_0x35822e['model']=_[_0x76db('0x35')](db[_0x76db('0x44')][_0x76db('0x2f')]);_0x35822e[_0x76db('0x34')]=_[_0x76db('0x35')](_0x1713a1[_0x76db('0x34')]);_0x35822e[_0x76db('0x3e')]=_[_0x76db('0x36')](_0x35822e[_0x76db('0x32')],_0x35822e[_0x76db('0x34')]);_0x389f50[_0x76db('0x37')]=_['intersection'](_0x35822e['model'],qs[_0x76db('0x38')](_0x1713a1[_0x76db('0x34')][_0x76db('0x38')]));_0x389f50[_0x76db('0x37')]=_0x389f50[_0x76db('0x37')][_0x76db('0x39')]?_0x389f50[_0x76db('0x37')]:_0x35822e[_0x76db('0x32')];if(_0x1713a1['query']['includeAll']){_0x389f50[_0x76db('0x45')]=[{'all':!![]}];}_0x389f50=_[_0x76db('0x41')]({},_0x389f50,_0x1713a1[_0x76db('0x43')]);return db[_0x76db('0x44')]['find'](_0x389f50)['then'](handleEntityNotFound(_0x5a2e18,null))[_0x76db('0x2a')](respondWithResult(_0x5a2e18,null))[_0x76db('0x48')](handleError(_0x5a2e18,null));};exports['create']=function(_0xc0b5d8,_0x100c16){return db[_0x76db('0x44')][_0x76db('0x49')](_0xc0b5d8[_0x76db('0x4a')],{})['then'](function(_0x219446){var _0x1d65fe=_0xc0b5d8[_0x76db('0x4b')][_0x76db('0x2b')]({'plain':!![]});if(!_0x1d65fe)throw new Error(_0x76db('0x4c'));if(_0x1d65fe[_0x76db('0x4d')]===_0x76db('0x4b')){var _0x331ce7=_0x219446['get']({'plain':!![]});var _0x2be133=_0x76db('0x2c');return db[_0x76db('0x4e')]['find']({'where':{'name':_0x2be133,'userProfileId':_0x1d65fe[_0x76db('0x4f')]},'raw':!![]})[_0x76db('0x2a')](function(_0x4229c1){if(_0x4229c1&&_0x4229c1[_0x76db('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x331ce7[_0x76db('0x2e')],'resourceId':_0x331ce7['id'],'type':_0x4229c1['name'],'sectionId':_0x4229c1['id']},{})[_0x76db('0x2a')](function(){return _0x219446;});}else{return _0x219446;}})[_0x76db('0x48')](function(_0x320254){logger[_0x76db('0x2d')](_0x76db('0x51'),_0x320254);throw _0x320254;});}return _0x219446;})[_0x76db('0x2a')](respondWithResult(_0x100c16,0xc9))[_0x76db('0x48')](handleError(_0x100c16,null));};exports[_0x76db('0x52')]=function(_0x45d08b,_0x2bd58d){var _0x573c84={'where':{'id':_0x45d08b[_0x76db('0x47')]['id']}},_0x36962e={};_0x36962e['model']=_['keys'](db[_0x76db('0x44')][_0x76db('0x2f')]);_0x573c84['attributes']=_[_0x76db('0x36')](_0x36962e[_0x76db('0x32')],qs[_0x76db('0x38')](_0x45d08b[_0x76db('0x34')]['fields']));_0x573c84[_0x76db('0x37')]=_0x573c84[_0x76db('0x37')]['length']?_0x573c84[_0x76db('0x37')]:_0x36962e[_0x76db('0x32')];if(_0x45d08b[_0x76db('0x34')][_0x76db('0x53')]){_0x573c84['include']=[{'all':!![]}];}_0x573c84=_['merge']({},_0x573c84,_0x45d08b[_0x76db('0x43')]);return db[_0x76db('0x44')][_0x76db('0x54')](_0x573c84)['then'](handleEntityNotFound(_0x2bd58d,null))['then'](function(_0x5450c4){if(_0x5450c4){var _0x5ac024=_0x5450c4[_0x76db('0x2b')]({'plain':!![]});_0x5ac024=qs['omit'](_0x5ac024,['id',_0x76db('0x55'),_0x76db('0x56')]);_0x45d08b['body']=_[_0x76db('0x57')](_0x45d08b[_0x76db('0x4a')],['id',_0x76db('0x55'),_0x76db('0x56')]);return db[_0x76db('0x44')]['create'](_[_0x76db('0x41')](_0x5ac024,_0x45d08b[_0x76db('0x4a')]),{'include':_0x45d08b[_0x76db('0x34')][_0x76db('0x53')]?[{'all':!![]}]:undefined})['then'](function(_0x48c521){var _0x54ff5e=_0x45d08b['user'][_0x76db('0x2b')]({'plain':!![]});if(!_0x54ff5e)throw new Error(_0x76db('0x4c'));if(_0x54ff5e[_0x76db('0x4d')]===_0x76db('0x4b')){var _0x5cb934=_0x48c521[_0x76db('0x2b')]({'plain':!![]});var _0x54ca16=_0x76db('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x54ca16,'userProfileId':_0x54ff5e[_0x76db('0x4f')]},'raw':!![]})[_0x76db('0x2a')](function(_0x51f661){if(_0x51f661&&_0x51f661[_0x76db('0x50')]===0x0){return db[_0x76db('0x58')][_0x76db('0x49')]({'name':_0x5cb934[_0x76db('0x2e')],'resourceId':_0x5cb934['id'],'type':_0x51f661[_0x76db('0x2e')],'sectionId':_0x51f661['id']},{})[_0x76db('0x2a')](function(){return _0x48c521;});}else{return _0x48c521;}})[_0x76db('0x48')](function(_0x48019e){logger[_0x76db('0x2d')](_0x76db('0x51'),_0x48019e);throw _0x48019e;});}return _0x48c521;});}})['then'](respondWithResult(_0x2bd58d,0xc9))[_0x76db('0x48')](handleError(_0x2bd58d,null));};exports[_0x76db('0x28')]=function(_0x119f75,_0x23e651){if(_0x119f75[_0x76db('0x4a')]['id']){delete _0x119f75[_0x76db('0x4a')]['id'];}return db[_0x76db('0x44')][_0x76db('0x54')]({'where':{'id':_0x119f75[_0x76db('0x47')]['id']}})[_0x76db('0x2a')](handleEntityNotFound(_0x23e651,null))[_0x76db('0x2a')](saveUpdates(_0x119f75['body'],null))['then'](respondWithResult(_0x23e651,null))[_0x76db('0x48')](handleError(_0x23e651,null));};exports[_0x76db('0x29')]=function(_0x21e062,_0x3384a6){return db[_0x76db('0x44')]['find']({'where':{'id':_0x21e062[_0x76db('0x47')]['id']}})['then'](handleEntityNotFound(_0x3384a6,null))[_0x76db('0x2a')](removeEntity(_0x3384a6,null))[_0x76db('0x48')](handleError(_0x3384a6,null));};function widgetAttributes(_0x43837d){try{switch(_0x43837d['type']){case'iframe':return[{'name':_0x76db('0x59'),'value':_0x43837d[_0x76db('0x59')]||(_0x43837d[_0x76db('0x5a')]&&_0x43837d[_0x76db('0x5a')][0x0]?_0x43837d[_0x76db('0x5a')][0x0]['value']:undefined)||_0x76db('0x5b')}];case _0x76db('0x5c'):return[{'name':'attrPath','value':_0x43837d[_0x76db('0x5d')]||(_0x43837d[_0x76db('0x5a')]&&_0x43837d[_0x76db('0x5a')][0x0]?_0x43837d['attrs'][0x0]['value']:undefined)||''}];case _0x76db('0x5e'):return[{'name':'attrHourFormat','value':_0x43837d[_0x76db('0x5f')]||(_0x43837d[_0x76db('0x5a')]&&_0x43837d[_0x76db('0x5a')][0x0]?_0x43837d[_0x76db('0x5a')][0x0][_0x76db('0x60')]:undefined)||_0x76db('0x61')},{'name':_0x76db('0x62'),'value':_0x43837d[_0x76db('0x62')]||(_0x43837d[_0x76db('0x5a')]&&_0x43837d[_0x76db('0x5a')][0x1]?_0x43837d['attrs'][0x1][_0x76db('0x60')]:undefined)||_0x76db('0x63')},{'name':_0x76db('0x64'),'value':_0x43837d[_0x76db('0x64')]||(_0x43837d['attrs']&&_0x43837d[_0x76db('0x5a')][0x2]?_0x43837d[_0x76db('0x5a')][0x2][_0x76db('0x60')]:undefined)||0xc}];case'counter':return[{'name':_0x76db('0x65'),'value':_0x43837d[_0x76db('0x65')]||(_0x43837d[_0x76db('0x5a')]&&_0x43837d[_0x76db('0x5a')][0x0]?_0x43837d[_0x76db('0x5a')][0x0][_0x76db('0x60')]:undefined)||'total'},{'name':_0x76db('0x66'),'value':_0x43837d[_0x76db('0x66')]||(_0x43837d[_0x76db('0x5a')]&&_0x43837d[_0x76db('0x5a')][0x1]?_0x43837d[_0x76db('0x5a')][0x1][_0x76db('0x60')]:undefined)||[]},{'name':_0x76db('0x64'),'value':_0x43837d[_0x76db('0x64')]||(_0x43837d['attrs']&&_0x43837d[_0x76db('0x5a')][0x2]?_0x43837d[_0x76db('0x5a')][0x2]['value']:undefined)||0x14},{'name':_0x76db('0x67'),'value':_0x43837d[_0x76db('0x67')]||(_0x43837d['attrs']&&_0x43837d[_0x76db('0x5a')][0x3]?_0x43837d['attrs'][0x3][_0x76db('0x60')]:undefined)||_0x76db('0x68')},{'name':_0x76db('0x69'),'value':_0x43837d[_0x76db('0x69')]||(_0x43837d[_0x76db('0x5a')]&&_0x43837d[_0x76db('0x5a')][0x4]?_0x43837d[_0x76db('0x5a')][0x4][_0x76db('0x60')]:undefined)||''},{'name':_0x76db('0x6a'),'value':_0x43837d[_0x76db('0x6a')]||(_0x43837d['attrs']&&_0x43837d[_0x76db('0x5a')][0x5]?_0x43837d[_0x76db('0x5a')][0x5][_0x76db('0x60')]:undefined)||''},{'name':_0x76db('0x6b'),'value':_0x43837d[_0x76db('0x6b')]||(_0x43837d[_0x76db('0x5a')]&&_0x43837d['attrs'][0x6]?_0x43837d['attrs'][0x6][_0x76db('0x60')]:undefined)||''},{'name':_0x76db('0x6c'),'value':_0x43837d[_0x76db('0x6c')]||(_0x43837d[_0x76db('0x5a')]&&_0x43837d[_0x76db('0x5a')][0x7]?_0x43837d[_0x76db('0x5a')][0x7][_0x76db('0x60')]:undefined)||''},{'name':_0x76db('0x6d'),'value':_0x43837d['attrWhatsappAccounts']||(_0x43837d['attrs']&&_0x43837d[_0x76db('0x5a')][0x8]?_0x43837d['attrs'][0x8][_0x76db('0x60')]:undefined)||''},{'name':'attrChatWebsites','value':_0x43837d[_0x76db('0x6e')]||(_0x43837d['attrs']&&_0x43837d[_0x76db('0x5a')][0x9]?_0x43837d[_0x76db('0x5a')][0x9]['value']:undefined)||''}];case'multibar-chart':case _0x76db('0x6f'):return[{'name':_0x76db('0x70'),'value':_0x43837d[_0x76db('0x70')]||(_0x43837d[_0x76db('0x5a')]&&_0x43837d['attrs'][0x0]?_0x43837d['attrs'][0x0][_0x76db('0x60')]:undefined)||_0x76db('0x71')},{'name':_0x76db('0x72'),'value':_0x43837d[_0x76db('0x72')]||(_0x43837d[_0x76db('0x5a')]&&_0x43837d[_0x76db('0x5a')][0x1]?_0x43837d[_0x76db('0x5a')][0x1][_0x76db('0x60')]:undefined)||null},{'name':_0x76db('0x73'),'value':_0x43837d[_0x76db('0x73')]||(_0x43837d[_0x76db('0x5a')]&&_0x43837d['attrs'][0x2]?_0x43837d['attrs'][0x2][_0x76db('0x60')]:undefined)||null},{'name':_0x76db('0x66'),'value':_0x43837d[_0x76db('0x66')]||(_0x43837d[_0x76db('0x5a')]&&_0x43837d[_0x76db('0x5a')][0x3]?_0x43837d['attrs'][0x3][_0x76db('0x60')]:undefined)||[]},{'name':_0x76db('0x67'),'value':_0x43837d['attrChannel']||(_0x43837d['attrs']&&_0x43837d[_0x76db('0x5a')][0x4]?_0x43837d[_0x76db('0x5a')][0x4]['value']:undefined)||_0x76db('0x68')},{'name':_0x76db('0x69'),'value':_0x43837d[_0x76db('0x69')]||(_0x43837d[_0x76db('0x5a')]&&_0x43837d['attrs'][0x5]?_0x43837d[_0x76db('0x5a')][0x5][_0x76db('0x60')]:undefined)||''},{'name':_0x76db('0x6a'),'value':_0x43837d[_0x76db('0x6a')]||(_0x43837d[_0x76db('0x5a')]&&_0x43837d[_0x76db('0x5a')][0x6]?_0x43837d[_0x76db('0x5a')][0x6][_0x76db('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x43837d[_0x76db('0x6b')]||(_0x43837d['attrs']&&_0x43837d['attrs'][0x7]?_0x43837d[_0x76db('0x5a')][0x7]['value']:undefined)||''},{'name':_0x76db('0x6c'),'value':_0x43837d[_0x76db('0x6c')]||(_0x43837d[_0x76db('0x5a')]&&_0x43837d['attrs'][0x8]?_0x43837d['attrs'][0x8][_0x76db('0x60')]:undefined)||''},{'name':_0x76db('0x6d'),'value':_0x43837d['attrWhatsappAccounts']||(_0x43837d[_0x76db('0x5a')]&&_0x43837d[_0x76db('0x5a')][0x9]?_0x43837d[_0x76db('0x5a')][0x9]['value']:undefined)||''},{'name':_0x76db('0x6e'),'value':_0x43837d[_0x76db('0x6e')]||(_0x43837d[_0x76db('0x5a')]&&_0x43837d[_0x76db('0x5a')][0xa]?_0x43837d[_0x76db('0x5a')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x76db('0x74'),'type':_0x43837d[_0x76db('0x75')]||(_0x43837d[_0x76db('0x5a')]&&_0x43837d[_0x76db('0x5a')][0x0]?_0x43837d[_0x76db('0x5a')][0x0][_0x76db('0x42')]:undefined)||null,'value':_0x43837d['attrReport']||(_0x43837d[_0x76db('0x5a')]&&_0x43837d[_0x76db('0x5a')][0x0]?_0x43837d['attrs'][0x0][_0x76db('0x60')]:undefined)||null},{'name':_0x76db('0x76'),'value':_0x43837d[_0x76db('0x76')]||(_0x43837d[_0x76db('0x5a')]&&_0x43837d[_0x76db('0x5a')][0x1]?_0x43837d[_0x76db('0x5a')][0x1][_0x76db('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x79dd0d){logger[_0x76db('0x2d')](_0x76db('0x77'),JSON['stringify'](_0x79dd0d));return[];}}exports[_0x76db('0x78')]=function(_0x23aff2,_0x553b7a,_0x1db43d){if(_0x23aff2[_0x76db('0x4a')]['id']){delete _0x23aff2[_0x76db('0x4a')]['id'];}return db['Dashboard'][_0x76db('0x54')]({'where':{'id':_0x23aff2[_0x76db('0x47')]['id']}})['then'](handleEntityNotFound(_0x553b7a,null))[_0x76db('0x2a')](function(_0x13bf40){if(_0x13bf40){_0x23aff2[_0x76db('0x4a')][_0x76db('0x79')]=_0x13bf40['id'];_0x23aff2[_0x76db('0x4a')][_0x76db('0x5a')]=widgetAttributes(_0x23aff2[_0x76db('0x4a')]);return db[_0x76db('0x7a')][_0x76db('0x49')](_0x23aff2[_0x76db('0x4a')]);}})[_0x76db('0x2a')](respondWithResult(_0x553b7a,null))[_0x76db('0x48')](handleError(_0x553b7a,null));};exports['getItems']=function(_0x23e76a,_0x3536b6,_0x8ed3c2){var _0x1e4c63={};var _0x324eea={};var _0x4b75c6;var _0x4dce35;return db['Dashboard'][_0x76db('0x7b')]({'where':{'id':_0x23e76a[_0x76db('0x47')]['id']}})[_0x76db('0x2a')](handleEntityNotFound(_0x3536b6,null))[_0x76db('0x2a')](function(_0x1887c3){if(_0x1887c3){_0x4b75c6=_0x1887c3;_0x324eea[_0x76db('0x32')]=_['keys'](db[_0x76db('0x7a')][_0x76db('0x2f')]);_0x324eea['query']=_[_0x76db('0x35')](_0x23e76a[_0x76db('0x34')]);_0x324eea['filters']=_[_0x76db('0x36')](_0x324eea[_0x76db('0x32')],_0x324eea[_0x76db('0x34')]);_0x1e4c63['attributes']=_[_0x76db('0x36')](_0x324eea[_0x76db('0x32')],qs[_0x76db('0x38')](_0x23e76a[_0x76db('0x34')][_0x76db('0x38')]));_0x1e4c63[_0x76db('0x37')]=_0x1e4c63['attributes'][_0x76db('0x39')]?_0x1e4c63[_0x76db('0x37')]:_0x324eea[_0x76db('0x32')];_0x1e4c63[_0x76db('0x3b')]=qs[_0x76db('0x3c')](_0x23e76a[_0x76db('0x34')][_0x76db('0x3c')]);_0x1e4c63[_0x76db('0x3d')]=qs[_0x76db('0x3e')](_[_0x76db('0x3f')](_0x23e76a['query'],_0x324eea['filters']));if(_0x23e76a[_0x76db('0x34')][_0x76db('0x40')]){_0x1e4c63[_0x76db('0x3d')]=_[_0x76db('0x41')](_0x1e4c63[_0x76db('0x3d')],{'$or':_[_0x76db('0x33')](_0x1e4c63[_0x76db('0x37')],function(_0x531082){var _0x3fc0a2={};_0x3fc0a2[_0x531082]={'$like':'%'+_0x23e76a[_0x76db('0x34')]['filter']+'%'};return _0x3fc0a2;})});}_0x1e4c63=_[_0x76db('0x41')]({},_0x1e4c63,_0x23e76a[_0x76db('0x43')]);return _0x4b75c6[_0x76db('0x7c')](_0x1e4c63);}})[_0x76db('0x2a')](function(_0x380d23){if(_0x380d23){_0x4dce35=_0x380d23[_0x76db('0x39')];if(!_0x23e76a['query'][_0x76db('0x3a')](_0x76db('0x7d'))){_0x1e4c63[_0x76db('0x1f')]=qs['limit'](_0x23e76a[_0x76db('0x34')][_0x76db('0x1f')]);_0x1e4c63[_0x76db('0x20')]=qs['offset'](_0x23e76a['query']['offset']);}return _0x4b75c6[_0x76db('0x7c')](_0x1e4c63);}})[_0x76db('0x2a')](function(_0x2a406c){if(_0x2a406c){return _0x2a406c?{'count':_0x4dce35,'rows':_0x2a406c}:null;}})[_0x76db('0x2a')](respondWithResult(_0x3536b6,null))[_0x76db('0x48')](handleError(_0x3536b6,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index ecc626c..12eff30 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 _0xc075=['save','update','remove','emit','hook','exports','events','setMaxListeners'];(function(_0x4d8eef,_0x127638){var _0xf1dd6=function(_0x80d0dd){while(--_0x80d0dd){_0x4d8eef['push'](_0x4d8eef['shift']());}};_0xf1dd6(++_0x127638);}(_0xc075,0x1a6));var _0x5c07=function(_0x4bdf02,_0x3211c3){_0x4bdf02=_0x4bdf02-0x0;var _0x4dd9ed=_0xc075[_0x4bdf02];return _0x4dd9ed;};'use strict';var EventEmitter=require(_0x5c07('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5c07('0x1')](0x0);var events={'afterCreate':_0x5c07('0x2'),'afterUpdate':_0x5c07('0x3'),'afterDestroy':_0x5c07('0x4')};function emitEvent(_0x2e0e13){return function(_0x32ff87,_0x5a179c,_0x2d72d4){DashboardEvents[_0x5c07('0x5')](_0x2e0e13+':'+_0x32ff87['id'],_0x32ff87);DashboardEvents[_0x5c07('0x5')](_0x2e0e13,_0x32ff87);_0x2d72d4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x5c07('0x6')](e,emitEvent(event));}}module[_0x5c07('0x7')]=DashboardEvents; \ No newline at end of file +var _0x85a6=['update','remove','emit','hook','exports','Dashboard'];(function(_0x8e9ca3,_0xfda28a){var _0x346f2b=function(_0x4a2d79){while(--_0x4a2d79){_0x8e9ca3['push'](_0x8e9ca3['shift']());}};_0x346f2b(++_0xfda28a);}(_0x85a6,0x1cd));var _0x685a=function(_0x2f0f44,_0xa18e97){_0x2f0f44=_0x2f0f44-0x0;var _0x20aea5=_0x85a6[_0x2f0f44];return _0x20aea5;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db'][_0x685a('0x0')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x685a('0x1'),'afterDestroy':_0x685a('0x2')};function emitEvent(_0x3ffbb7){return function(_0x2a66f6,_0x344a01,_0x3a9fc0){DashboardEvents[_0x685a('0x3')](_0x3ffbb7+':'+_0x2a66f6['id'],_0x2a66f6);DashboardEvents[_0x685a('0x3')](_0x3ffbb7,_0x2a66f6);_0x3a9fc0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x685a('0x4')](e,emitEvent(event));}}module[_0x685a('0x5')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 93140af..b960080 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 _0x2bc5=['exports','define','api','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes'];(function(_0x1905ec,_0x22dee1){var _0x4fded3=function(_0x1fd5c){while(--_0x1fd5c){_0x1905ec['push'](_0x1905ec['shift']());}};_0x4fded3(++_0x22dee1);}(_0x2bc5,0x1bb));var _0x52bc=function(_0x316c23,_0x468378){_0x316c23=_0x316c23-0x0;var _0x470fee=_0x2bc5[_0x316c23];return _0x470fee;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x52bc('0x0'));var moment=require(_0x52bc('0x1'));var BPromise=require(_0x52bc('0x2'));var rp=require(_0x52bc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x52bc('0x4'));var config=require(_0x52bc('0x5'));var attributes=require(_0x52bc('0x6'));module[_0x52bc('0x7')]=function(_0x25e067,_0xfe74af){return _0x25e067[_0x52bc('0x8')]('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5baa=['./dashboard.attributes','exports','Dashboard','dashboards','util','api','moment','bluebird','path'];(function(_0x11ef8f,_0x145b8f){var _0x423826=function(_0x3e7898){while(--_0x3e7898){_0x11ef8f['push'](_0x11ef8f['shift']());}};_0x423826(++_0x145b8f);}(_0x5baa,0xca));var _0xa5ba=function(_0x5b7060,_0x348018){_0x5b7060=_0x5b7060-0x0;var _0x430190=_0x5baa[_0x5b7060];return _0x430190;};'use strict';var _=require('lodash');var util=require(_0xa5ba('0x0'));var logger=require('../../config/logger')(_0xa5ba('0x1'));var moment=require(_0xa5ba('0x2'));var BPromise=require(_0xa5ba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5ba('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa5ba('0x5'));module[_0xa5ba('0x6')]=function(_0x2e67a6,_0x2bfa37){return _0x2e67a6['define'](_0xa5ba('0x7'),attributes,{'tableName':_0xa5ba('0x8'),'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 987ab4c..bde4e69 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 _0x451f=['../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x503181,_0x356f4e){var _0x1391d2=function(_0x2edb10){while(--_0x2edb10){_0x503181['push'](_0x503181['shift']());}};_0x1391d2(++_0x356f4e);}(_0x451f,0xc9));var _0xf451=function(_0x5be5f0,_0xa87393){_0x5be5f0=_0x5be5f0-0x0;var _0x4e2bb0=_0x451f[_0x5be5f0];return _0x4e2bb0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf451('0x0'));var rs=require(_0xf451('0x1'));var fs=require('fs');var Redis=require(_0xf451('0x2'));var db=require(_0xf451('0x3'))['db'];var utils=require(_0xf451('0x4'));var logger=require(_0xf451('0x5'))(_0xf451('0x6'));var config=require(_0xf451('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf451('0x8')]['http']({'port':0x232a});config[_0xf451('0x9')]=_[_0xf451('0xa')](config[_0xf451('0x9')],{'host':_0xf451('0xb'),'port':0x18eb});var socket=require(_0xf451('0xc'))(new Redis(config['redis']));require(_0xf451('0xd'))[_0xf451('0xe')](socket);function respondWithRpcPromise(_0x4ff255,_0x254b86,_0x382439){return new BPromise(function(_0x722d01,_0x58e116){return client[_0xf451('0xf')](_0x4ff255,_0x382439)[_0xf451('0x10')](function(_0x270bff){logger['info'](_0xf451('0x11'),_0x254b86,_0xf451('0x12'));logger[_0xf451('0x13')](_0xf451('0x14'),_0x254b86,_0xf451('0x12'),JSON['stringify'](_0x270bff));if(_0x270bff[_0xf451('0x15')]){if(_0x270bff[_0xf451('0x15')]['code']===0x1f4){logger[_0xf451('0x15')](_0xf451('0x11'),_0x254b86,_0x270bff[_0xf451('0x15')][_0xf451('0x16')]);return _0x58e116(_0x270bff['error']['message']);}logger[_0xf451('0x15')](_0xf451('0x11'),_0x254b86,_0x270bff[_0xf451('0x15')][_0xf451('0x16')]);return _0x722d01(_0x270bff[_0xf451('0x15')][_0xf451('0x16')]);}else{logger[_0xf451('0x17')](_0xf451('0x11'),_0x254b86,_0xf451('0x12'));_0x722d01(_0x270bff[_0xf451('0x18')]['message']);}})[_0xf451('0x19')](function(_0x1b7e9b){logger[_0xf451('0x15')](_0xf451('0x11'),_0x254b86,_0x1b7e9b);_0x58e116(_0x1b7e9b);});});} \ No newline at end of file +var _0x0043=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','stringify','code','error','Dashboard,\x20%s,\x20%s','message','info'];(function(_0x8f3c09,_0x411e61){var _0x91e775=function(_0x36446a){while(--_0x36446a){_0x8f3c09['push'](_0x8f3c09['shift']());}};_0x91e775(++_0x411e61);}(_0x0043,0xe7));var _0x3004=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x0043[_0xd09668];return _0x68726;};'use strict';var _=require(_0x3004('0x0'));var util=require(_0x3004('0x1'));var moment=require(_0x3004('0x2'));var BPromise=require(_0x3004('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3004('0x4'));var db=require(_0x3004('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3004('0x6'))(_0x3004('0x7'));var config=require('../../config/environment');var jayson=require(_0x3004('0x8'));var client=jayson[_0x3004('0x9')][_0x3004('0xa')]({'port':0x232a});config[_0x3004('0xb')]=_['defaults'](config[_0x3004('0xb')],{'host':_0x3004('0xc'),'port':0x18eb});var socket=require(_0x3004('0xd'))(new Redis(config[_0x3004('0xb')]));require('./dashboard.socket')[_0x3004('0xe')](socket);function respondWithRpcPromise(_0x21cf9d,_0x1aacf0,_0x458135){return new BPromise(function(_0x25a5ce,_0x2a4890){return client['request'](_0x21cf9d,_0x458135)[_0x3004('0xf')](function(_0x36c583){logger['info']('Dashboard,\x20%s,\x20%s',_0x1aacf0,'request\x20sent');logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x1aacf0,'request\x20sent',JSON[_0x3004('0x10')](_0x36c583));if(_0x36c583['error']){if(_0x36c583['error'][_0x3004('0x11')]===0x1f4){logger[_0x3004('0x12')](_0x3004('0x13'),_0x1aacf0,_0x36c583[_0x3004('0x12')][_0x3004('0x14')]);return _0x2a4890(_0x36c583[_0x3004('0x12')][_0x3004('0x14')]);}logger[_0x3004('0x12')](_0x3004('0x13'),_0x1aacf0,_0x36c583['error']['message']);return _0x25a5ce(_0x36c583[_0x3004('0x12')]['message']);}else{logger[_0x3004('0x15')]('Dashboard,\x20%s,\x20%s',_0x1aacf0,'request\x20sent');_0x25a5ce(_0x36c583['result'][_0x3004('0x14')]);}})[_0x3004('0x16')](function(_0x3f8eb2){logger[_0x3004('0x12')](_0x3004('0x13'),_0x1aacf0,_0x3f8eb2);_0x2a4890(_0x3f8eb2);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 2532616..f77c712 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 _0x25b8=['dashboard:','./dashboard.events','removeListener','length'];(function(_0xc5a279,_0x155360){var _0xc755d3=function(_0x15051c){while(--_0x15051c){_0xc5a279['push'](_0xc5a279['shift']());}};_0xc755d3(++_0x155360);}(_0x25b8,0x12d));var _0x825b=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x25b8[_0x173d7e];return _0x2220d6;};'use strict';var DashboardEvents=require(_0x825b('0x0'));var events=['save','remove','update'];function createListener(_0x544e93,_0x12c4df){return function(_0x3c6251){_0x12c4df['emit'](_0x544e93,_0x3c6251);};}function removeListener(_0xdd23fb,_0x4be1e4){return function(){DashboardEvents[_0x825b('0x1')](_0xdd23fb,_0x4be1e4);};}exports['register']=function(_0x14aa1a){for(var _0x1fb775=0x0,_0x38ba9c=events[_0x825b('0x2')];_0x1fb775<_0x38ba9c;_0x1fb775++){var _0x246e11=events[_0x1fb775];var _0x45b289=createListener(_0x825b('0x3')+_0x246e11,_0x14aa1a);DashboardEvents['on'](_0x246e11,_0x45b289);}}; \ No newline at end of file +var _0x51dc=['length','./dashboard.events','save','remove','emit','removeListener'];(function(_0x2b81be,_0x544bdf){var _0x8ed4a7=function(_0x4a7bf4){while(--_0x4a7bf4){_0x2b81be['push'](_0x2b81be['shift']());}};_0x8ed4a7(++_0x544bdf);}(_0x51dc,0x175));var _0xc51d=function(_0x43bcc1,_0x12a8be){_0x43bcc1=_0x43bcc1-0x0;var _0x543f0c=_0x51dc[_0x43bcc1];return _0x543f0c;};'use strict';var DashboardEvents=require(_0xc51d('0x0'));var events=[_0xc51d('0x1'),_0xc51d('0x2'),'update'];function createListener(_0x5400b5,_0x5c1962){return function(_0x44350e){_0x5c1962[_0xc51d('0x3')](_0x5400b5,_0x44350e);};}function removeListener(_0x54d472,_0x324ca6){return function(){DashboardEvents[_0xc51d('0x4')](_0x54d472,_0x324ca6);};}exports['register']=function(_0x29d4eb){for(var _0x312726=0x0,_0xb24e80=events[_0xc51d('0x5')];_0x312726<_0xb24e80;_0x312726++){var _0x217945=events[_0x312726];var _0x25e862=createListener('dashboard:'+_0x217945,_0x29d4eb);DashboardEvents['on'](_0x217945,_0x25e862);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 381e96d..ed1a35d 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 _0x7932=['/:id','show','/:id/items','getItems','post','/:id/clone','clone','addItem','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0xb858be,_0x586c6a){var _0x3c0c13=function(_0x24af35){while(--_0x24af35){_0xb858be['push'](_0xb858be['shift']());}};_0x3c0c13(++_0x586c6a);}(_0x7932,0x6d));var _0x2793=function(_0x59d582,_0x163bd){_0x59d582=_0x59d582-0x0;var _0x4be167=_0x7932[_0x59d582];return _0x4be167;};'use strict';var multer=require(_0x2793('0x0'));var util=require(_0x2793('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2793('0x2'));var router=express[_0x2793('0x3')]();var fs_extra=require(_0x2793('0x4'));var auth=require(_0x2793('0x5'));var interaction=require(_0x2793('0x6'));var config=require(_0x2793('0x7'));var controller=require('./dashboard.controller');router['get']('/',auth[_0x2793('0x8')](),controller[_0x2793('0x9')]);router[_0x2793('0xa')](_0x2793('0xb'),auth['isAuthenticated'](),controller[_0x2793('0xc')]);router[_0x2793('0xa')](_0x2793('0xd'),auth[_0x2793('0x8')](),controller[_0x2793('0xe')]);router[_0x2793('0xf')]('/',auth[_0x2793('0x8')](),controller['create']);router[_0x2793('0xf')](_0x2793('0x10'),auth[_0x2793('0x8')](),controller[_0x2793('0x11')]);router[_0x2793('0xf')](_0x2793('0xd'),auth['isAuthenticated'](),controller[_0x2793('0x12')]);router[_0x2793('0x13')]('/:id',auth[_0x2793('0x8')](),controller[_0x2793('0x14')]);router[_0x2793('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x2793('0x16')]);module[_0x2793('0x17')]=router; \ No newline at end of file +var _0xa1dc=['./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5ddec9,_0x209a36){var _0x5abb94=function(_0x5816db){while(--_0x5816db){_0x5ddec9['push'](_0x5ddec9['shift']());}};_0x5abb94(++_0x209a36);}(_0xa1dc,0xce));var _0xca1d=function(_0x403ce9,_0x36f469){_0x403ce9=_0x403ce9-0x0;var _0x59fd4a=_0xa1dc[_0x403ce9];return _0x59fd4a;};'use strict';var multer=require(_0xca1d('0x0'));var util=require(_0xca1d('0x1'));var path=require(_0xca1d('0x2'));var timeout=require(_0xca1d('0x3'));var express=require(_0xca1d('0x4'));var router=express[_0xca1d('0x5')]();var fs_extra=require(_0xca1d('0x6'));var auth=require(_0xca1d('0x7'));var interaction=require(_0xca1d('0x8'));var config=require(_0xca1d('0x9'));var controller=require(_0xca1d('0xa'));router[_0xca1d('0xb')]('/',auth[_0xca1d('0xc')](),controller[_0xca1d('0xd')]);router[_0xca1d('0xb')](_0xca1d('0xe'),auth[_0xca1d('0xc')](),controller[_0xca1d('0xf')]);router[_0xca1d('0xb')](_0xca1d('0x10'),auth['isAuthenticated'](),controller[_0xca1d('0x11')]);router[_0xca1d('0x12')]('/',auth[_0xca1d('0xc')](),controller[_0xca1d('0x13')]);router[_0xca1d('0x12')](_0xca1d('0x14'),auth[_0xca1d('0xc')](),controller[_0xca1d('0x15')]);router[_0xca1d('0x12')](_0xca1d('0x10'),auth[_0xca1d('0xc')](),controller[_0xca1d('0x16')]);router[_0xca1d('0x17')](_0xca1d('0xe'),auth['isAuthenticated'](),controller[_0xca1d('0x18')]);router[_0xca1d('0x19')]('/:id',auth[_0xca1d('0xc')](),controller[_0xca1d('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index bc4324c..4fb6059 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 _0xda19=['TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','squel','lodash','STRING'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0xda19,0xd5));var _0x9da1=function(_0x5e7c69,_0x54c283){_0x5e7c69=_0x5e7c69-0x0;var _0x56652d=_0xda19[_0x5e7c69];return _0x56652d;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x9da1('0x0'));var _=require(_0x9da1('0x1'));module['exports']={'title':{'type':Sequelize[_0x9da1('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x9da1('0x3')]('long'),'get':function(){try{return JSON[_0x9da1('0x4')](this[_0x9da1('0x5')](_0x9da1('0x6')));}catch(_0x470043){return[];}},'set':function(_0x156faf){try{this[_0x9da1('0x7')](_0x9da1('0x6'),JSON[_0x9da1('0x8')](_0x156faf));}catch(_0x1c24e6){this[_0x9da1('0x7')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x9da1('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x9da1('0x9')]},'background':{'type':Sequelize[_0x9da1('0x2')],'allowNull':![],'defaultValue':_0x9da1('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x9da1('0x2')],'allowNull':![],'defaultValue':_0x9da1('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x9da1('0x2')]},'titleFontSize':{'type':Sequelize[_0x9da1('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0xafc4=['TEXT','long','setDataValue','attrs','stringify','INTEGER','sequelize','lodash','STRING'];(function(_0x4f4e04,_0x2684d5){var _0x22ab57=function(_0x373e5d){while(--_0x373e5d){_0x4f4e04['push'](_0x4f4e04['shift']());}};_0x22ab57(++_0x2684d5);}(_0xafc4,0x69));var _0x4afc=function(_0x49f47c,_0x21a087){_0x49f47c=_0x49f47c-0x0;var _0x3b4635=_0xafc4[_0x49f47c];return _0x3b4635;};'use strict';var Sequelize=require(_0x4afc('0x0'));var squel=require('squel');var _=require(_0x4afc('0x1'));module['exports']={'title':{'type':Sequelize[_0x4afc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4afc('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4afc('0x3')](_0x4afc('0x4')),'get':function(){try{return JSON['parse'](this['getDataValue']('attrs'));}catch(_0x36cb50){return[];}},'set':function(_0x471d45){try{this[_0x4afc('0x5')](_0x4afc('0x6'),JSON[_0x4afc('0x7')](_0x471d45));}catch(_0xaf053d){this['setDataValue'](_0x4afc('0x6'),JSON[_0x4afc('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x4afc('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x4afc('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4afc('0x8')]},'col':{'type':Sequelize[_0x4afc('0x8')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4afc('0x2')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x4afc('0x2')]},'titleFontSize':{'type':Sequelize[_0x4afc('0x8')],'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 8638557..6d9a436 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 _0xefce=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','include','merge','options','DashboardItem','catch','find','type','iframe','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','error','widgetAttributes:\x20%s','create','body','rimraf','request-promise'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xefce,0x1e8));var _0xeefc=function(_0x3df822,_0x299495){_0x3df822=_0x3df822-0x0;var _0x4e457d=_0xefce[_0x3df822];return _0x4e457d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeefc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeefc('0x1'));var moment=require(_0xeefc('0x2'));var BPromise=require(_0xeefc('0x3'));var Mustache=require(_0xeefc('0x4'));var util=require(_0xeefc('0x5'));var path=require(_0xeefc('0x6'));var sox=require(_0xeefc('0x7'));var csv=require(_0xeefc('0x8'));var ejs=require(_0xeefc('0x9'));var fs=require('fs');var fs_extra=require(_0xeefc('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xeefc('0xb'));var jsforce=require(_0xeefc('0xc'));var deskjs=require(_0xeefc('0xd'));var toCsv=require(_0xeefc('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeefc('0xe'));var authService=require(_0xeefc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xeefc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeefc('0x11'))(_0xeefc('0x12'));var utils=require('../../config/utils');var config=require(_0xeefc('0x13'));var licenseUtil=require(_0xeefc('0x14'));var db=require(_0xeefc('0x15'))['db'];config['redis']=_[_0xeefc('0x16')](config[_0xeefc('0x17')],{'host':_0xeefc('0x18'),'port':0x18eb});var socket=require(_0xeefc('0x19'))(new Redis(config[_0xeefc('0x17')]));require(_0xeefc('0x1a'))[_0xeefc('0x1b')](socket);function respondWithStatusCode(_0x4537e2,_0x2d5fc1){_0x2d5fc1=_0x2d5fc1||0xcc;return function(_0x3ac92a){if(_0x3ac92a){return _0x4537e2[_0xeefc('0x1c')](_0x2d5fc1);}return _0x4537e2['status'](_0x2d5fc1)[_0xeefc('0x1d')]();};}function respondWithResult(_0x5c447b,_0x2ce41b){_0x2ce41b=_0x2ce41b||0xc8;return function(_0x2fe7c2){if(_0x2fe7c2){return _0x5c447b[_0xeefc('0x1e')](_0x2ce41b)[_0xeefc('0x1f')](_0x2fe7c2);}};}function respondWithFilteredResult(_0x15baaa,_0x49cfe2){return function(_0x1c247e){if(_0x1c247e){var _0x1ea90e=typeof _0x49cfe2['offset']===_0xeefc('0x20')&&typeof _0x49cfe2[_0xeefc('0x21')]===_0xeefc('0x20');var _0x4ba684=_0x1c247e[_0xeefc('0x22')];var _0x1f2825=_0x1ea90e?0x0:_0x49cfe2['offset'];var _0x25ca4d=_0x1ea90e?_0x1c247e['count']:_0x49cfe2[_0xeefc('0x23')]+_0x49cfe2[_0xeefc('0x21')];var _0x3cebaa;if(_0x25ca4d>=_0x4ba684){_0x25ca4d=_0x4ba684;_0x3cebaa=0xc8;}else{_0x3cebaa=0xce;}_0x15baaa[_0xeefc('0x1e')](_0x3cebaa);return _0x15baaa[_0xeefc('0x24')](_0xeefc('0x25'),_0x1f2825+'-'+_0x25ca4d+'/'+_0x4ba684)[_0xeefc('0x1f')](_0x1c247e);}return null;};}function patchUpdates(_0x4ec1c9){return function(_0x168700){try{jsonpatch[_0xeefc('0x26')](_0x168700,_0x4ec1c9,!![]);}catch(_0x6e690b){return BPromise[_0xeefc('0x27')](_0x6e690b);}return _0x168700['save']();};}function saveUpdates(_0x48246d,_0x1a8b12){return function(_0x1f2d59){if(_0x1f2d59){return _0x1f2d59[_0xeefc('0x28')](_0x48246d)[_0xeefc('0x29')](function(_0x4aeaa7){return _0x4aeaa7;});}return null;};}function removeEntity(_0x16e60e,_0x3ea299){return function(_0xceece3){if(_0xceece3){return _0xceece3[_0xeefc('0x2a')]()['then'](function(){_0x16e60e['status'](0xcc)[_0xeefc('0x1d')]();});}};}function handleEntityNotFound(_0x5b7d0d,_0x27f8cd){return function(_0x2d13b6){if(!_0x2d13b6){_0x5b7d0d['sendStatus'](0x194);}return _0x2d13b6;};}function handleError(_0x52dab1,_0x167fe8){_0x167fe8=_0x167fe8||0x1f4;return function(_0x56ea84){logger['error'](_0x56ea84[_0xeefc('0x2b')]);if(_0x56ea84[_0xeefc('0x2c')]){delete _0x56ea84['name'];}_0x52dab1['status'](_0x167fe8)[_0xeefc('0x2d')](_0x56ea84);};}exports[_0xeefc('0x2e')]=function(_0x4369c9,_0x13a33e){var _0x29fc6b={'raw':![],'where':{'id':_0x4369c9[_0xeefc('0x2f')]['id']}},_0x325578={};_0x325578[_0xeefc('0x30')]=_[_0xeefc('0x31')](db['DashboardItem'][_0xeefc('0x32')]);_0x325578[_0xeefc('0x33')]=_[_0xeefc('0x31')](_0x4369c9[_0xeefc('0x33')]);_0x325578[_0xeefc('0x34')]=_[_0xeefc('0x35')](_0x325578[_0xeefc('0x30')],_0x325578[_0xeefc('0x33')]);_0x29fc6b[_0xeefc('0x36')]=_[_0xeefc('0x35')](_0x325578[_0xeefc('0x30')],qs[_0xeefc('0x37')](_0x4369c9[_0xeefc('0x33')]['fields']));_0x29fc6b[_0xeefc('0x36')]=_0x29fc6b[_0xeefc('0x36')]['length']?_0x29fc6b[_0xeefc('0x36')]:_0x325578[_0xeefc('0x30')];if(_0x4369c9['query']['includeAll']){_0x29fc6b[_0xeefc('0x38')]=[{'all':!![]}];}_0x29fc6b=_[_0xeefc('0x39')]({},_0x29fc6b,_0x4369c9[_0xeefc('0x3a')]);return db[_0xeefc('0x3b')]['find'](_0x29fc6b)[_0xeefc('0x29')](handleEntityNotFound(_0x13a33e,null))['then'](respondWithResult(_0x13a33e,null))[_0xeefc('0x3c')](handleError(_0x13a33e,null));};exports[_0xeefc('0x2a')]=function(_0x52b74a,_0x38d4c2){return db[_0xeefc('0x3b')][_0xeefc('0x3d')]({'where':{'id':_0x52b74a[_0xeefc('0x2f')]['id']}})[_0xeefc('0x29')](handleEntityNotFound(_0x38d4c2,null))[_0xeefc('0x29')](removeEntity(_0x38d4c2,null))[_0xeefc('0x3c')](handleError(_0x38d4c2,null));};function widgetAttributes(_0x11186c){try{switch(_0x11186c[_0xeefc('0x3e')]){case _0xeefc('0x3f'):return[{'name':'attrUrl','value':_0x11186c['attrUrl']||(_0x11186c['attrs']&&_0x11186c[_0xeefc('0x40')][0x0]?_0x11186c[_0xeefc('0x40')][0x0][_0xeefc('0x41')]:undefined)||_0xeefc('0x42')}];case'custom':return[{'name':_0xeefc('0x43'),'value':_0x11186c[_0xeefc('0x43')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x0]?_0x11186c['attrs'][0x0][_0xeefc('0x41')]:undefined)||''}];case _0xeefc('0x44'):return[{'name':_0xeefc('0x45'),'value':_0x11186c[_0xeefc('0x45')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x0]?_0x11186c[_0xeefc('0x40')][0x0][_0xeefc('0x41')]:undefined)||_0xeefc('0x46')},{'name':_0xeefc('0x47'),'value':_0x11186c['attrTimezone']||(_0x11186c['attrs']&&_0x11186c[_0xeefc('0x40')][0x1]?_0x11186c[_0xeefc('0x40')][0x1][_0xeefc('0x41')]:undefined)||_0xeefc('0x48')},{'name':_0xeefc('0x49'),'value':_0x11186c[_0xeefc('0x49')]||(_0x11186c['attrs']&&_0x11186c['attrs'][0x2]?_0x11186c[_0xeefc('0x40')][0x2][_0xeefc('0x41')]:undefined)||0xc}];case _0xeefc('0x4a'):return[{'name':_0xeefc('0x4b'),'value':_0x11186c[_0xeefc('0x4b')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x0]?_0x11186c[_0xeefc('0x40')][0x0][_0xeefc('0x41')]:undefined)||'total'},{'name':_0xeefc('0x4c'),'value':_0x11186c[_0xeefc('0x4c')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x1]?_0x11186c[_0xeefc('0x40')][0x1][_0xeefc('0x41')]:undefined)||[]},{'name':_0xeefc('0x49'),'value':_0x11186c[_0xeefc('0x49')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x2]?_0x11186c[_0xeefc('0x40')][0x2][_0xeefc('0x41')]:undefined)||0x14},{'name':_0xeefc('0x4d'),'value':_0x11186c[_0xeefc('0x4d')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c['attrs'][0x3]?_0x11186c[_0xeefc('0x40')][0x3][_0xeefc('0x41')]:undefined)||_0xeefc('0x4e')},{'name':_0xeefc('0x4f'),'value':_0x11186c[_0xeefc('0x4f')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x4]?_0x11186c[_0xeefc('0x40')][0x4][_0xeefc('0x41')]:undefined)||''},{'name':_0xeefc('0x50'),'value':_0x11186c[_0xeefc('0x50')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x5]?_0x11186c[_0xeefc('0x40')][0x5]['value']:undefined)||''},{'name':_0xeefc('0x51'),'value':_0x11186c[_0xeefc('0x51')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x6]?_0x11186c['attrs'][0x6]['value']:undefined)||''},{'name':_0xeefc('0x52'),'value':_0x11186c[_0xeefc('0x52')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x7]?_0x11186c[_0xeefc('0x40')][0x7][_0xeefc('0x41')]:undefined)||''},{'name':_0xeefc('0x53'),'value':_0x11186c[_0xeefc('0x53')]||(_0x11186c['attrs']&&_0x11186c['attrs'][0x8]?_0x11186c[_0xeefc('0x40')][0x8][_0xeefc('0x41')]:undefined)||''},{'name':_0xeefc('0x54'),'value':_0x11186c['attrChatWebsites']||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x9]?_0x11186c[_0xeefc('0x40')][0x9]['value']:undefined)||''}];case _0xeefc('0x55'):case _0xeefc('0x56'):return[{'name':_0xeefc('0x57'),'value':_0x11186c[_0xeefc('0x57')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x0]?_0x11186c['attrs'][0x0]['value']:undefined)||_0xeefc('0x58')},{'name':_0xeefc('0x59'),'value':_0x11186c[_0xeefc('0x59')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x1]?_0x11186c['attrs'][0x1][_0xeefc('0x41')]:undefined)||null},{'name':_0xeefc('0x5a'),'value':_0x11186c[_0xeefc('0x5a')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x2]?_0x11186c[_0xeefc('0x40')][0x2]['value']:undefined)||null},{'name':_0xeefc('0x4c'),'value':_0x11186c[_0xeefc('0x4c')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c['attrs'][0x3]?_0x11186c['attrs'][0x3][_0xeefc('0x41')]:undefined)||[]},{'name':_0xeefc('0x4d'),'value':_0x11186c['attrChannel']||(_0x11186c[_0xeefc('0x40')]&&_0x11186c['attrs'][0x4]?_0x11186c[_0xeefc('0x40')][0x4][_0xeefc('0x41')]:undefined)||_0xeefc('0x4e')},{'name':_0xeefc('0x4f'),'value':_0x11186c['attrEmailAccounts']||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x5]?_0x11186c[_0xeefc('0x40')][0x5][_0xeefc('0x41')]:undefined)||''},{'name':_0xeefc('0x50'),'value':_0x11186c[_0xeefc('0x50')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x6]?_0x11186c[_0xeefc('0x40')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x11186c[_0xeefc('0x51')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x7]?_0x11186c[_0xeefc('0x40')][0x7][_0xeefc('0x41')]:undefined)||''},{'name':_0xeefc('0x52'),'value':_0x11186c[_0xeefc('0x52')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x8]?_0x11186c['attrs'][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x11186c[_0xeefc('0x53')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c['attrs'][0x9]?_0x11186c[_0xeefc('0x40')][0x9][_0xeefc('0x41')]:undefined)||''},{'name':_0xeefc('0x54'),'value':_0x11186c[_0xeefc('0x54')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0xa]?_0x11186c[_0xeefc('0x40')][0xa][_0xeefc('0x41')]:undefined)||''}];case _0xeefc('0x5b'):return[{'name':_0xeefc('0x5c'),'type':_0x11186c['reportType']||(_0x11186c[_0xeefc('0x40')]&&_0x11186c['attrs'][0x0]?_0x11186c['attrs'][0x0]['type']:undefined)||null,'value':_0x11186c[_0xeefc('0x5c')]||(_0x11186c['attrs']&&_0x11186c[_0xeefc('0x40')][0x0]?_0x11186c[_0xeefc('0x40')][0x0]['value']:undefined)||null},{'name':_0xeefc('0x5d'),'value':_0x11186c[_0xeefc('0x5d')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x1]?_0x11186c[_0xeefc('0x40')][0x1][_0xeefc('0x41')]:undefined)||0x0}];default:return[];}}catch(_0xa1c28f){logger[_0xeefc('0x5e')](_0xeefc('0x5f'),JSON['stringify'](_0xa1c28f));return[];}}exports[_0xeefc('0x60')]=function(_0x232c64,_0x5c5ec2){if(_0x232c64[_0xeefc('0x61')]){_0x232c64[_0xeefc('0x61')][_0xeefc('0x40')]=widgetAttributes(_0x232c64['body']);}return db['DashboardItem'][_0xeefc('0x60')](_0x232c64[_0xeefc('0x61')],{})[_0xeefc('0x29')](respondWithResult(_0x5c5ec2,0xc9))[_0xeefc('0x3c')](handleError(_0x5c5ec2,null));};exports[_0xeefc('0x28')]=function(_0x34a816,_0x1f5e28){if(_0x34a816['body']['id']){delete _0x34a816[_0xeefc('0x61')]['id'];}_0x34a816['body'][_0xeefc('0x40')]=widgetAttributes(_0x34a816[_0xeefc('0x61')]);return db[_0xeefc('0x3b')]['find']({'where':{'id':_0x34a816[_0xeefc('0x2f')]['id']}})['then'](handleEntityNotFound(_0x1f5e28,null))[_0xeefc('0x29')](saveUpdates(_0x34a816['body'],null))[_0xeefc('0x29')](respondWithResult(_0x1f5e28,null))[_0xeefc('0x3c')](handleError(_0x1f5e28,null));}; \ No newline at end of file +var _0xdcfa=['end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','sendStatus','error','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','attributes','intersection','fields','length','include','merge','options','catch','destroy','find','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','status'];(function(_0x2146dc,_0x5736a0){var _0x958647=function(_0xca09d){while(--_0xca09d){_0x2146dc['push'](_0x2146dc['shift']());}};_0x958647(++_0x5736a0);}(_0xdcfa,0xad));var _0xadcf=function(_0x49d7c8,_0x52d9a3){_0x49d7c8=_0x49d7c8-0x0;var _0x450089=_0xdcfa[_0x49d7c8];return _0x450089;};'use strict';var emlformat=require(_0xadcf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xadcf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xadcf('0x2'));var moment=require(_0xadcf('0x3'));var BPromise=require(_0xadcf('0x4'));var Mustache=require(_0xadcf('0x5'));var util=require(_0xadcf('0x6'));var path=require(_0xadcf('0x7'));var sox=require(_0xadcf('0x8'));var csv=require(_0xadcf('0x9'));var ejs=require(_0xadcf('0xa'));var fs=require('fs');var fs_extra=require(_0xadcf('0xb'));var _=require(_0xadcf('0xc'));var squel=require(_0xadcf('0xd'));var crypto=require('crypto');var jsforce=require(_0xadcf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xadcf('0x9'));var querystring=require(_0xadcf('0xf'));var Papa=require('papaparse');var Redis=require(_0xadcf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xadcf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xadcf('0x12'));var logger=require(_0xadcf('0x13'))('api');var utils=require(_0xadcf('0x14'));var config=require(_0xadcf('0x15'));var licenseUtil=require(_0xadcf('0x16'));var db=require(_0xadcf('0x17'))['db'];config[_0xadcf('0x18')]=_[_0xadcf('0x19')](config['redis'],{'host':_0xadcf('0x1a'),'port':0x18eb});var socket=require(_0xadcf('0x1b'))(new Redis(config[_0xadcf('0x18')]));require(_0xadcf('0x1c'))[_0xadcf('0x1d')](socket);function respondWithStatusCode(_0x4e60d7,_0x2c8b73){_0x2c8b73=_0x2c8b73||0xcc;return function(_0x1e279c){if(_0x1e279c){return _0x4e60d7['sendStatus'](_0x2c8b73);}return _0x4e60d7[_0xadcf('0x1e')](_0x2c8b73)[_0xadcf('0x1f')]();};}function respondWithResult(_0xd879e8,_0x432201){_0x432201=_0x432201||0xc8;return function(_0x1a058b){if(_0x1a058b){return _0xd879e8['status'](_0x432201)[_0xadcf('0x20')](_0x1a058b);}};}function respondWithFilteredResult(_0x58975b,_0x2b97ae){return function(_0x1bf6fc){if(_0x1bf6fc){var _0x577885=typeof _0x2b97ae[_0xadcf('0x21')]==='undefined'&&typeof _0x2b97ae[_0xadcf('0x22')]===_0xadcf('0x23');var _0x44a51a=_0x1bf6fc[_0xadcf('0x24')];var _0x283588=_0x577885?0x0:_0x2b97ae['offset'];var _0x222cfd=_0x577885?_0x1bf6fc[_0xadcf('0x24')]:_0x2b97ae[_0xadcf('0x21')]+_0x2b97ae[_0xadcf('0x22')];var _0x6ee8b9;if(_0x222cfd>=_0x44a51a){_0x222cfd=_0x44a51a;_0x6ee8b9=0xc8;}else{_0x6ee8b9=0xce;}_0x58975b[_0xadcf('0x1e')](_0x6ee8b9);return _0x58975b[_0xadcf('0x25')](_0xadcf('0x26'),_0x283588+'-'+_0x222cfd+'/'+_0x44a51a)[_0xadcf('0x20')](_0x1bf6fc);}return null;};}function patchUpdates(_0x4b29b5){return function(_0x1d370b){try{jsonpatch[_0xadcf('0x27')](_0x1d370b,_0x4b29b5,!![]);}catch(_0x1d9b10){return BPromise['reject'](_0x1d9b10);}return _0x1d370b[_0xadcf('0x28')]();};}function saveUpdates(_0x2b5012,_0x32e320){return function(_0x2f1450){if(_0x2f1450){return _0x2f1450['update'](_0x2b5012)[_0xadcf('0x29')](function(_0x455dd7){return _0x455dd7;});}return null;};}function removeEntity(_0x12a415,_0xf85a4a){return function(_0x4dcb3c){if(_0x4dcb3c){return _0x4dcb3c['destroy']()[_0xadcf('0x29')](function(){_0x12a415[_0xadcf('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6a9a57,_0x3b7498){return function(_0x52936f){if(!_0x52936f){_0x6a9a57[_0xadcf('0x2a')](0x194);}return _0x52936f;};}function handleError(_0x5ac066,_0x563ddd){_0x563ddd=_0x563ddd||0x1f4;return function(_0x5578dd){logger[_0xadcf('0x2b')](_0x5578dd['stack']);if(_0x5578dd[_0xadcf('0x2c')]){delete _0x5578dd[_0xadcf('0x2c')];}_0x5ac066['status'](_0x563ddd)[_0xadcf('0x2d')](_0x5578dd);};}exports[_0xadcf('0x2e')]=function(_0x3e0552,_0x5ff7b8){var _0xf50eaa={'raw':![],'where':{'id':_0x3e0552[_0xadcf('0x2f')]['id']}},_0x4c31bd={};_0x4c31bd[_0xadcf('0x30')]=_[_0xadcf('0x31')](db[_0xadcf('0x32')][_0xadcf('0x33')]);_0x4c31bd[_0xadcf('0x34')]=_['keys'](_0x3e0552[_0xadcf('0x34')]);_0x4c31bd[_0xadcf('0x35')]=_['intersection'](_0x4c31bd[_0xadcf('0x30')],_0x4c31bd[_0xadcf('0x34')]);_0xf50eaa[_0xadcf('0x36')]=_[_0xadcf('0x37')](_0x4c31bd[_0xadcf('0x30')],qs[_0xadcf('0x38')](_0x3e0552[_0xadcf('0x34')][_0xadcf('0x38')]));_0xf50eaa[_0xadcf('0x36')]=_0xf50eaa['attributes'][_0xadcf('0x39')]?_0xf50eaa[_0xadcf('0x36')]:_0x4c31bd[_0xadcf('0x30')];if(_0x3e0552[_0xadcf('0x34')]['includeAll']){_0xf50eaa[_0xadcf('0x3a')]=[{'all':!![]}];}_0xf50eaa=_[_0xadcf('0x3b')]({},_0xf50eaa,_0x3e0552[_0xadcf('0x3c')]);return db[_0xadcf('0x32')]['find'](_0xf50eaa)[_0xadcf('0x29')](handleEntityNotFound(_0x5ff7b8,null))[_0xadcf('0x29')](respondWithResult(_0x5ff7b8,null))[_0xadcf('0x3d')](handleError(_0x5ff7b8,null));};exports[_0xadcf('0x3e')]=function(_0x4d2a4e,_0x12d46d){return db[_0xadcf('0x32')][_0xadcf('0x3f')]({'where':{'id':_0x4d2a4e[_0xadcf('0x2f')]['id']}})[_0xadcf('0x29')](handleEntityNotFound(_0x12d46d,null))[_0xadcf('0x29')](removeEntity(_0x12d46d,null))[_0xadcf('0x3d')](handleError(_0x12d46d,null));};function widgetAttributes(_0x43afbe){try{switch(_0x43afbe[_0xadcf('0x40')]){case _0xadcf('0x41'):return[{'name':_0xadcf('0x42'),'value':_0x43afbe['attrUrl']||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x0]?_0x43afbe[_0xadcf('0x43')][0x0][_0xadcf('0x44')]:undefined)||_0xadcf('0x45')}];case _0xadcf('0x46'):return[{'name':_0xadcf('0x47'),'value':_0x43afbe['attrPath']||(_0x43afbe['attrs']&&_0x43afbe['attrs'][0x0]?_0x43afbe[_0xadcf('0x43')][0x0][_0xadcf('0x44')]:undefined)||''}];case _0xadcf('0x48'):return[{'name':_0xadcf('0x49'),'value':_0x43afbe[_0xadcf('0x49')]||(_0x43afbe['attrs']&&_0x43afbe[_0xadcf('0x43')][0x0]?_0x43afbe[_0xadcf('0x43')][0x0][_0xadcf('0x44')]:undefined)||_0xadcf('0x4a')},{'name':_0xadcf('0x4b'),'value':_0x43afbe['attrTimezone']||(_0x43afbe['attrs']&&_0x43afbe[_0xadcf('0x43')][0x1]?_0x43afbe['attrs'][0x1]['value']:undefined)||_0xadcf('0x4c')},{'name':_0xadcf('0x4d'),'value':_0x43afbe[_0xadcf('0x4d')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x2]?_0x43afbe[_0xadcf('0x43')][0x2][_0xadcf('0x44')]:undefined)||0xc}];case _0xadcf('0x4e'):return[{'name':_0xadcf('0x4f'),'value':_0x43afbe[_0xadcf('0x4f')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x0]?_0x43afbe[_0xadcf('0x43')][0x0][_0xadcf('0x44')]:undefined)||_0xadcf('0x50')},{'name':_0xadcf('0x51'),'value':_0x43afbe[_0xadcf('0x51')]||(_0x43afbe['attrs']&&_0x43afbe['attrs'][0x1]?_0x43afbe[_0xadcf('0x43')][0x1]['value']:undefined)||[]},{'name':_0xadcf('0x4d'),'value':_0x43afbe[_0xadcf('0x4d')]||(_0x43afbe['attrs']&&_0x43afbe[_0xadcf('0x43')][0x2]?_0x43afbe['attrs'][0x2][_0xadcf('0x44')]:undefined)||0x14},{'name':_0xadcf('0x52'),'value':_0x43afbe['attrChannel']||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x3]?_0x43afbe[_0xadcf('0x43')][0x3]['value']:undefined)||_0xadcf('0x53')},{'name':'attrEmailAccounts','value':_0x43afbe[_0xadcf('0x54')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x4]?_0x43afbe[_0xadcf('0x43')][0x4][_0xadcf('0x44')]:undefined)||''},{'name':_0xadcf('0x55'),'value':_0x43afbe['attrFaxAccounts']||(_0x43afbe['attrs']&&_0x43afbe['attrs'][0x5]?_0x43afbe[_0xadcf('0x43')][0x5][_0xadcf('0x44')]:undefined)||''},{'name':_0xadcf('0x56'),'value':_0x43afbe[_0xadcf('0x56')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe['attrs'][0x6]?_0x43afbe[_0xadcf('0x43')][0x6][_0xadcf('0x44')]:undefined)||''},{'name':_0xadcf('0x57'),'value':_0x43afbe[_0xadcf('0x57')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x7]?_0x43afbe['attrs'][0x7]['value']:undefined)||''},{'name':_0xadcf('0x58'),'value':_0x43afbe[_0xadcf('0x58')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe['attrs'][0x8]?_0x43afbe['attrs'][0x8]['value']:undefined)||''},{'name':_0xadcf('0x59'),'value':_0x43afbe['attrChatWebsites']||(_0x43afbe['attrs']&&_0x43afbe[_0xadcf('0x43')][0x9]?_0x43afbe[_0xadcf('0x43')][0x9][_0xadcf('0x44')]:undefined)||''}];case'multibar-chart':case _0xadcf('0x5a'):return[{'name':_0xadcf('0x5b'),'value':_0x43afbe[_0xadcf('0x5b')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x0]?_0x43afbe['attrs'][0x0][_0xadcf('0x44')]:undefined)||'total'},{'name':_0xadcf('0x5c'),'value':_0x43afbe['attrSerie2']||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x1]?_0x43afbe['attrs'][0x1][_0xadcf('0x44')]:undefined)||null},{'name':_0xadcf('0x5d'),'value':_0x43afbe[_0xadcf('0x5d')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x2]?_0x43afbe[_0xadcf('0x43')][0x2][_0xadcf('0x44')]:undefined)||null},{'name':_0xadcf('0x51'),'value':_0x43afbe[_0xadcf('0x51')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe['attrs'][0x3]?_0x43afbe[_0xadcf('0x43')][0x3][_0xadcf('0x44')]:undefined)||[]},{'name':_0xadcf('0x52'),'value':_0x43afbe[_0xadcf('0x52')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe['attrs'][0x4]?_0x43afbe[_0xadcf('0x43')][0x4][_0xadcf('0x44')]:undefined)||_0xadcf('0x53')},{'name':_0xadcf('0x54'),'value':_0x43afbe[_0xadcf('0x54')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe['attrs'][0x5]?_0x43afbe[_0xadcf('0x43')][0x5][_0xadcf('0x44')]:undefined)||''},{'name':_0xadcf('0x55'),'value':_0x43afbe[_0xadcf('0x55')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x6]?_0x43afbe[_0xadcf('0x43')][0x6]['value']:undefined)||''},{'name':_0xadcf('0x56'),'value':_0x43afbe[_0xadcf('0x56')]||(_0x43afbe['attrs']&&_0x43afbe[_0xadcf('0x43')][0x7]?_0x43afbe[_0xadcf('0x43')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x43afbe[_0xadcf('0x57')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x8]?_0x43afbe['attrs'][0x8][_0xadcf('0x44')]:undefined)||''},{'name':_0xadcf('0x58'),'value':_0x43afbe[_0xadcf('0x58')]||(_0x43afbe['attrs']&&_0x43afbe[_0xadcf('0x43')][0x9]?_0x43afbe[_0xadcf('0x43')][0x9][_0xadcf('0x44')]:undefined)||''},{'name':_0xadcf('0x59'),'value':_0x43afbe[_0xadcf('0x59')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0xa]?_0x43afbe[_0xadcf('0x43')][0xa][_0xadcf('0x44')]:undefined)||''}];case'web-report':return[{'name':_0xadcf('0x5e'),'type':_0x43afbe[_0xadcf('0x5f')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x0]?_0x43afbe[_0xadcf('0x43')][0x0][_0xadcf('0x40')]:undefined)||null,'value':_0x43afbe[_0xadcf('0x5e')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x0]?_0x43afbe[_0xadcf('0x43')][0x0]['value']:undefined)||null},{'name':_0xadcf('0x60'),'value':_0x43afbe[_0xadcf('0x60')]||(_0x43afbe[_0xadcf('0x43')]&&_0x43afbe[_0xadcf('0x43')][0x1]?_0x43afbe[_0xadcf('0x43')][0x1][_0xadcf('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x1ea974){logger[_0xadcf('0x2b')](_0xadcf('0x61'),JSON[_0xadcf('0x62')](_0x1ea974));return[];}}exports[_0xadcf('0x63')]=function(_0x3399ad,_0x12e663){if(_0x3399ad[_0xadcf('0x64')]){_0x3399ad[_0xadcf('0x64')][_0xadcf('0x43')]=widgetAttributes(_0x3399ad[_0xadcf('0x64')]);}return db[_0xadcf('0x32')][_0xadcf('0x63')](_0x3399ad[_0xadcf('0x64')],{})[_0xadcf('0x29')](respondWithResult(_0x12e663,0xc9))['catch'](handleError(_0x12e663,null));};exports[_0xadcf('0x65')]=function(_0xd05df9,_0x407430){if(_0xd05df9[_0xadcf('0x64')]['id']){delete _0xd05df9[_0xadcf('0x64')]['id'];}_0xd05df9[_0xadcf('0x64')][_0xadcf('0x43')]=widgetAttributes(_0xd05df9[_0xadcf('0x64')]);return db['DashboardItem'][_0xadcf('0x3f')]({'where':{'id':_0xd05df9[_0xadcf('0x2f')]['id']}})[_0xadcf('0x29')](handleEntityNotFound(_0x407430,null))[_0xadcf('0x29')](saveUpdates(_0xd05df9['body'],null))[_0xadcf('0x29')](respondWithResult(_0x407430,null))['catch'](handleError(_0x407430,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 117290d..869d0c1 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 _0x4668=['setMaxListeners','update','emit','hasOwnProperty','hook','events','DashboardItem'];(function(_0x462d41,_0x58b0cd){var _0x68d469=function(_0x3a7b76){while(--_0x3a7b76){_0x462d41['push'](_0x462d41['shift']());}};_0x68d469(++_0x58b0cd);}(_0x4668,0x101));var _0x8466=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4668[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x8466('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x8466('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x8466('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8466('0x3'),'afterDestroy':'remove'};function emitEvent(_0x42537a){return function(_0x17a455,_0x531c2a,_0x4b702a){DashboardItemEvents[_0x8466('0x4')](_0x42537a+':'+_0x17a455['id'],_0x17a455);DashboardItemEvents[_0x8466('0x4')](_0x42537a,_0x17a455);_0x4b702a(null);};}for(var e in events){if(events[_0x8466('0x5')](e)){var event=events[e];DashboardItem[_0x8466('0x6')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x161f=['../../mysqldb','DashboardItem','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x3ed25d,_0x6c37b2){var _0x5e0998=function(_0x3e53a4){while(--_0x3e53a4){_0x3ed25d['push'](_0x3ed25d['shift']());}};_0x5e0998(++_0x6c37b2);}(_0x161f,0x188));var _0xf161=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x161f[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xf161('0x0'))['db'][_0xf161('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xf161('0x2')](0x0);var events={'afterCreate':_0xf161('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x37a1d4){return function(_0x284bf6,_0x1fd297,_0x1b276e){DashboardItemEvents[_0xf161('0x4')](_0x37a1d4+':'+_0x284bf6['id'],_0x284bf6);DashboardItemEvents['emit'](_0x37a1d4,_0x284bf6);_0x1b276e(null);};}for(var e in events){if(events[_0xf161('0x5')](e)){var event=events[e];DashboardItem[_0xf161('0x6')](e,emitEvent(event));}}module[_0xf161('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 0c2f51c..f71dc32 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 _0x241d=['bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','dashboard_items','lodash','../../config/logger','api','moment'];(function(_0x111777,_0x43e893){var _0x18b652=function(_0x24a8fa){while(--_0x24a8fa){_0x111777['push'](_0x111777['shift']());}};_0x18b652(++_0x43e893);}(_0x241d,0x64));var _0xd241=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x241d[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xd241('0x0'));var util=require('util');var logger=require(_0xd241('0x1'))(_0xd241('0x2'));var moment=require(_0xd241('0x3'));var BPromise=require(_0xd241('0x4'));var rp=require(_0xd241('0x5'));var fs=require('fs');var path=require(_0xd241('0x6'));var rimraf=require(_0xd241('0x7'));var config=require(_0xd241('0x8'));var attributes=require(_0xd241('0x9'));module[_0xd241('0xa')]=function(_0x2eb97f,_0x4e6ad3){return _0x2eb97f[_0xd241('0xb')]('DashboardItem',attributes,{'tableName':_0xd241('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x782b=['lodash','util','api','moment','request-promise','path','../../config/environment','exports','define','DashboardItem','dashboard_items'];(function(_0x585d09,_0x1274bc){var _0x7d9a14=function(_0x343d4e){while(--_0x343d4e){_0x585d09['push'](_0x585d09['shift']());}};_0x7d9a14(++_0x1274bc);}(_0x782b,0xd1));var _0xb782=function(_0x3a9094,_0x12e3aa){_0x3a9094=_0x3a9094-0x0;var _0x4d5793=_0x782b[_0x3a9094];return _0x4d5793;};'use strict';var _=require(_0xb782('0x0'));var util=require(_0xb782('0x1'));var logger=require('../../config/logger')(_0xb782('0x2'));var moment=require(_0xb782('0x3'));var BPromise=require('bluebird');var rp=require(_0xb782('0x4'));var fs=require('fs');var path=require(_0xb782('0x5'));var rimraf=require('rimraf');var config=require(_0xb782('0x6'));var attributes=require('./dashboardItem.attributes');module[_0xb782('0x7')]=function(_0x40a340,_0x447c3c){return _0x40a340[_0xb782('0x8')](_0xb782('0x9'),attributes,{'tableName':_0xb782('0xa'),'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 ca8e4b8..624b71c 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 _0x65a3=['request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register'];(function(_0x18e03b,_0x43b539){var _0x3f9521=function(_0xf2071){while(--_0xf2071){_0x18e03b['push'](_0x18e03b['shift']());}};_0x3f9521(++_0x43b539);}(_0x65a3,0x85));var _0x365a=function(_0x147ddb,_0xfd6813){_0x147ddb=_0x147ddb-0x0;var _0x15a3cb=_0x65a3[_0x147ddb];return _0x15a3cb;};'use strict';var _=require(_0x365a('0x0'));var util=require(_0x365a('0x1'));var moment=require(_0x365a('0x2'));var BPromise=require(_0x365a('0x3'));var rs=require(_0x365a('0x4'));var fs=require('fs');var Redis=require(_0x365a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x365a('0x6'))(_0x365a('0x7'));var config=require(_0x365a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x365a('0x9')][_0x365a('0xa')]({'port':0x232a});config[_0x365a('0xb')]=_[_0x365a('0xc')](config[_0x365a('0xb')],{'host':_0x365a('0xd'),'port':0x18eb});var socket=require(_0x365a('0xe'))(new Redis(config[_0x365a('0xb')]));require(_0x365a('0xf'))[_0x365a('0x10')](socket);function respondWithRpcPromise(_0x4ee301,_0x11766a,_0x85c3b7){return new BPromise(function(_0x414889,_0x5ac6ce){return client[_0x365a('0x11')](_0x4ee301,_0x85c3b7)[_0x365a('0x12')](function(_0x27e614){logger['info'](_0x365a('0x13'),_0x11766a,_0x365a('0x14'));logger[_0x365a('0x15')](_0x365a('0x16'),_0x11766a,'request\x20sent',JSON[_0x365a('0x17')](_0x27e614));if(_0x27e614[_0x365a('0x18')]){if(_0x27e614[_0x365a('0x18')][_0x365a('0x19')]===0x1f4){logger[_0x365a('0x18')](_0x365a('0x13'),_0x11766a,_0x27e614[_0x365a('0x18')][_0x365a('0x1a')]);return _0x5ac6ce(_0x27e614['error'][_0x365a('0x1a')]);}logger[_0x365a('0x18')](_0x365a('0x13'),_0x11766a,_0x27e614[_0x365a('0x18')][_0x365a('0x1a')]);return _0x414889(_0x27e614['error'][_0x365a('0x1a')]);}else{logger[_0x365a('0x1b')]('DashboardItem,\x20%s,\x20%s',_0x11766a,_0x365a('0x14'));_0x414889(_0x27e614[_0x365a('0x1c')]['message']);}})[_0x365a('0x1d')](function(_0x6f35b){logger['error'](_0x365a('0x13'),_0x11766a,_0x6f35b);_0x5ac6ce(_0x6f35b);});});} \ No newline at end of file +var _0x53df=['debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','DashboardItem,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','then','request\x20sent'];(function(_0x36958,_0x28eaa6){var _0x401eec=function(_0x42e71e){while(--_0x42e71e){_0x36958['push'](_0x36958['shift']());}};_0x401eec(++_0x28eaa6);}(_0x53df,0x1a8));var _0xf53d=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x53df[_0x381589];return _0x2a075d;};'use strict';var _=require(_0xf53d('0x0'));var util=require('util');var moment=require(_0xf53d('0x1'));var BPromise=require(_0xf53d('0x2'));var rs=require(_0xf53d('0x3'));var fs=require('fs');var Redis=require(_0xf53d('0x4'));var db=require(_0xf53d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf53d('0x6'));var config=require(_0xf53d('0x7'));var jayson=require(_0xf53d('0x8'));var client=jayson[_0xf53d('0x9')][_0xf53d('0xa')]({'port':0x232a});config[_0xf53d('0xb')]=_[_0xf53d('0xc')](config[_0xf53d('0xb')],{'host':_0xf53d('0xd'),'port':0x18eb});var socket=require(_0xf53d('0xe'))(new Redis(config[_0xf53d('0xb')]));require(_0xf53d('0xf'))['register'](socket);function respondWithRpcPromise(_0x38b788,_0x306a63,_0x21a914){return new BPromise(function(_0x495fdf,_0x58a683){return client['request'](_0x38b788,_0x21a914)[_0xf53d('0x10')](function(_0x132053){logger['info']('DashboardItem,\x20%s,\x20%s',_0x306a63,_0xf53d('0x11'));logger[_0xf53d('0x12')](_0xf53d('0x13'),_0x306a63,_0xf53d('0x11'),JSON[_0xf53d('0x14')](_0x132053));if(_0x132053[_0xf53d('0x15')]){if(_0x132053[_0xf53d('0x15')]['code']===0x1f4){logger[_0xf53d('0x15')](_0xf53d('0x16'),_0x306a63,_0x132053[_0xf53d('0x15')][_0xf53d('0x17')]);return _0x58a683(_0x132053[_0xf53d('0x15')][_0xf53d('0x17')]);}logger[_0xf53d('0x15')](_0xf53d('0x16'),_0x306a63,_0x132053['error']['message']);return _0x495fdf(_0x132053[_0xf53d('0x15')][_0xf53d('0x17')]);}else{logger[_0xf53d('0x18')](_0xf53d('0x16'),_0x306a63,_0xf53d('0x11'));_0x495fdf(_0x132053['result'][_0xf53d('0x17')]);}})[_0xf53d('0x19')](function(_0x4a86ed){logger['error']('DashboardItem,\x20%s,\x20%s',_0x306a63,_0x4a86ed);_0x58a683(_0x4a86ed);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index c6c8d55..5fd9886 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 _0x43f0=['remove','update','emit','removeListener','register','length','dashboardItem:','save'];(function(_0x527cf3,_0x56cf89){var _0x4059a0=function(_0x5a913a){while(--_0x5a913a){_0x527cf3['push'](_0x527cf3['shift']());}};_0x4059a0(++_0x56cf89);}(_0x43f0,0xf7));var _0x043f=function(_0x59cfd8,_0x550912){_0x59cfd8=_0x59cfd8-0x0;var _0x4190a0=_0x43f0[_0x59cfd8];return _0x4190a0;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x043f('0x0'),_0x043f('0x1'),_0x043f('0x2')];function createListener(_0x557ed4,_0x550c1c){return function(_0x4b6443){_0x550c1c[_0x043f('0x3')](_0x557ed4,_0x4b6443);};}function removeListener(_0x5da9f7,_0x28cc21){return function(){DashboardItemEvents[_0x043f('0x4')](_0x5da9f7,_0x28cc21);};}exports[_0x043f('0x5')]=function(_0xbbe6dd){for(var _0x5a80db=0x0,_0x3c96d8=events[_0x043f('0x6')];_0x5a80db<_0x3c96d8;_0x5a80db++){var _0x5ab643=events[_0x5a80db];var _0x4a3763=createListener(_0x043f('0x7')+_0x5ab643,_0xbbe6dd);DashboardItemEvents['on'](_0x5ab643,_0x4a3763);}}; \ No newline at end of file +var _0xeaf2=['save','remove','emit','removeListener','./dashboardItem.events'];(function(_0xffe640,_0x47812b){var _0xe13d57=function(_0x15e58d){while(--_0x15e58d){_0xffe640['push'](_0xffe640['shift']());}};_0xe13d57(++_0x47812b);}(_0xeaf2,0xe5));var _0x2eaf=function(_0x1e91eb,_0x5829a3){_0x1e91eb=_0x1e91eb-0x0;var _0x2af75a=_0xeaf2[_0x1e91eb];return _0x2af75a;};'use strict';var DashboardItemEvents=require(_0x2eaf('0x0'));var events=[_0x2eaf('0x1'),_0x2eaf('0x2'),'update'];function createListener(_0x415618,_0x363d04){return function(_0x36aeb7){_0x363d04[_0x2eaf('0x3')](_0x415618,_0x36aeb7);};}function removeListener(_0x8942b1,_0x5d5c25){return function(){DashboardItemEvents[_0x2eaf('0x4')](_0x8942b1,_0x5d5c25);};}exports['register']=function(_0x173c35){for(var _0x239294=0x0,_0x14f980=events['length'];_0x239294<_0x14f980;_0x239294++){var _0x339352=events[_0x239294];var _0x3b624e=createListener('dashboardItem:'+_0x339352,_0x173c35);DashboardItemEvents['on'](_0x339352,_0x3b624e);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 0e4d9e0..e6fc71e 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 _0x4054=['Router','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x57c3e7,_0x319d74){var _0x23e615=function(_0x585548){while(--_0x585548){_0x57c3e7['push'](_0x57c3e7['shift']());}};_0x23e615(++_0x319d74);}(_0x4054,0xfc));var _0x4405=function(_0x48be16,_0x5e50ad){_0x48be16=_0x48be16-0x0;var _0x2a5868=_0x4054[_0x48be16];return _0x2a5868;};'use strict';var multer=require(_0x4405('0x0'));var util=require(_0x4405('0x1'));var path=require(_0x4405('0x2'));var timeout=require(_0x4405('0x3'));var express=require('express');var router=express[_0x4405('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4405('0x5'));var config=require(_0x4405('0x6'));var controller=require(_0x4405('0x7'));router[_0x4405('0x8')]('/:id',auth[_0x4405('0x9')](),controller['show']);router['post']('/',auth[_0x4405('0x9')](),controller[_0x4405('0xa')]);router[_0x4405('0xb')](_0x4405('0xc'),auth[_0x4405('0x9')](),controller['update']);router[_0x4405('0xd')]('/:id',auth[_0x4405('0x9')](),controller[_0x4405('0xe')]);module[_0x4405('0xf')]=router; \ No newline at end of file +var _0x27a7=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','show','post','create','put','update','delete','isAuthenticated','destroy','util','connect-timeout'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x27a7,0x18d));var _0x727a=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x27a7[_0x1cc8fe];return _0x230054;};'use strict';var multer=require('multer');var util=require(_0x727a('0x0'));var path=require('path');var timeout=require(_0x727a('0x1'));var express=require(_0x727a('0x2'));var router=express[_0x727a('0x3')]();var fs_extra=require(_0x727a('0x4'));var auth=require(_0x727a('0x5'));var interaction=require(_0x727a('0x6'));var config=require(_0x727a('0x7'));var controller=require(_0x727a('0x8'));router[_0x727a('0x9')](_0x727a('0xa'),auth['isAuthenticated'](),controller[_0x727a('0xb')]);router[_0x727a('0xc')]('/',auth['isAuthenticated'](),controller[_0x727a('0xd')]);router[_0x727a('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x727a('0xf')]);router[_0x727a('0x10')]('/:id',auth[_0x727a('0x11')](),controller[_0x727a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 3909996..5b2c485 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 _0xacad=['STRING','sequelize','exports','ENUM','first','second','third'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xacad,0x8d));var _0xdaca=function(_0x543f8b,_0x3dad19){_0x543f8b=_0x543f8b-0x0;var _0x47005d=_0xacad[_0x543f8b];return _0x47005d;};'use strict';var Sequelize=require(_0xdaca('0x0'));module[_0xdaca('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xdaca('0x2')](_0xdaca('0x3'),_0xdaca('0x4'),_0xdaca('0x5')),'allowNull':![],'defaultValue':_0xdaca('0x3')},'description':{'type':Sequelize[_0xdaca('0x6')]}}; \ No newline at end of file +var _0xfb3c=['second','sequelize','exports','STRING','first'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb3c,0x7e));var _0xcfb3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xfb3c[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xcfb3('0x0'));module[_0xcfb3('0x1')]={'name':{'type':Sequelize[_0xcfb3('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xcfb3('0x3'),_0xcfb3('0x4'),'third'),'allowNull':![],'defaultValue':_0xcfb3('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 7ecbb09..ee45a06 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 _0x1d7b=['sort','where','filters','pick','filter','map','VIRTUAL','merge','options','includeAll','include','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','Dispositions','destroy','stack','name','send','index','Disposition','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x1d7b,0xb9));var _0xb1d7=function(_0x131bb6,_0xd382a5){_0x131bb6=_0x131bb6-0x0;var _0x5c7e4e=_0x1d7b[_0x131bb6];return _0x5c7e4e;};'use strict';var emlformat=require(_0xb1d7('0x0'));var rimraf=require(_0xb1d7('0x1'));var zipdir=require(_0xb1d7('0x2'));var jsonpatch=require(_0xb1d7('0x3'));var rp=require(_0xb1d7('0x4'));var moment=require(_0xb1d7('0x5'));var BPromise=require(_0xb1d7('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb1d7('0x7'));var sox=require(_0xb1d7('0x8'));var csv=require(_0xb1d7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb1d7('0xa'));var squel=require('squel');var crypto=require(_0xb1d7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb1d7('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb1d7('0xd'));var qs=require(_0xb1d7('0xe'));var as=require(_0xb1d7('0xf'));var hardwareService=require(_0xb1d7('0x10'));var logger=require(_0xb1d7('0x11'))(_0xb1d7('0x12'));var utils=require('../../config/utils');var config=require(_0xb1d7('0x13'));var licenseUtil=require(_0xb1d7('0x14'));var db=require(_0xb1d7('0x15'))['db'];function respondWithStatusCode(_0x1381ce,_0x3fb4d9){_0x3fb4d9=_0x3fb4d9||0xcc;return function(_0x39fff1){if(_0x39fff1){return _0x1381ce[_0xb1d7('0x16')](_0x3fb4d9);}return _0x1381ce[_0xb1d7('0x17')](_0x3fb4d9)['end']();};}function respondWithResult(_0x2b1643,_0x7e372d){_0x7e372d=_0x7e372d||0xc8;return function(_0x3602fd){if(_0x3602fd){return _0x2b1643[_0xb1d7('0x17')](_0x7e372d)[_0xb1d7('0x18')](_0x3602fd);}};}function respondWithFilteredResult(_0x40bd2d,_0x5e792f){return function(_0x458350){if(_0x458350){var _0x2e2bdc=typeof _0x5e792f[_0xb1d7('0x19')]===_0xb1d7('0x1a')&&typeof _0x5e792f[_0xb1d7('0x1b')]===_0xb1d7('0x1a');var _0x354440=_0x458350[_0xb1d7('0x1c')];var _0x560b9d=_0x2e2bdc?0x0:_0x5e792f[_0xb1d7('0x19')];var _0x59318d=_0x2e2bdc?_0x458350[_0xb1d7('0x1c')]:_0x5e792f[_0xb1d7('0x19')]+_0x5e792f[_0xb1d7('0x1b')];var _0x952c77;if(_0x59318d>=_0x354440){_0x59318d=_0x354440;_0x952c77=0xc8;}else{_0x952c77=0xce;}_0x40bd2d['status'](_0x952c77);return _0x40bd2d[_0xb1d7('0x1d')](_0xb1d7('0x1e'),_0x560b9d+'-'+_0x59318d+'/'+_0x354440)[_0xb1d7('0x18')](_0x458350);}return null;};}function patchUpdates(_0x349409){return function(_0x342d08){try{jsonpatch[_0xb1d7('0x1f')](_0x342d08,_0x349409,!![]);}catch(_0x186527){return BPromise[_0xb1d7('0x20')](_0x186527);}return _0x342d08[_0xb1d7('0x21')]();};}function saveUpdates(_0x57f848,_0x194511){return function(_0x4e959c){if(_0x4e959c){return _0x4e959c[_0xb1d7('0x22')](_0x57f848)[_0xb1d7('0x23')](function(_0x456130){return _0x456130;});}return null;};}function removeEntity(_0x284d79,_0x1c61cc){return function(_0x5e5a0b){if(_0x5e5a0b){return _0x5e5a0b['destroy']()['then'](function(){var _0x3811f7=_0x5e5a0b['get']({'plain':!![]});var _0x2689f4=_0xb1d7('0x24');return db['UserProfileResource'][_0xb1d7('0x25')]({'where':{'type':_0x2689f4,'resourceId':_0x3811f7['id']}})['then'](function(){return _0x5e5a0b;});})[_0xb1d7('0x23')](function(){_0x284d79['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x65fbb7,_0x11dc04){return function(_0x145dd7){if(!_0x145dd7){_0x65fbb7['sendStatus'](0x194);}return _0x145dd7;};}function handleError(_0x75a532,_0x28d3ed){_0x28d3ed=_0x28d3ed||0x1f4;return function(_0x9b9d7){logger['error'](_0x9b9d7[_0xb1d7('0x26')]);if(_0x9b9d7[_0xb1d7('0x27')]){delete _0x9b9d7[_0xb1d7('0x27')];}_0x75a532[_0xb1d7('0x17')](_0x28d3ed)[_0xb1d7('0x28')](_0x9b9d7);};}exports[_0xb1d7('0x29')]=function(_0x4454b1,_0x183bf2){var _0xd9d951={},_0x2c651e={},_0x5077dd={'count':0x0,'rows':[]};var _0x137834=_['map'](db[_0xb1d7('0x2a')][_0xb1d7('0x2b')],function(_0x3701c1){return{'name':_0x3701c1['fieldName'],'type':_0x3701c1[_0xb1d7('0x2c')][_0xb1d7('0x2d')]};});_0x2c651e[_0xb1d7('0x2e')]=_['map'](_0x137834,_0xb1d7('0x27'));_0x2c651e[_0xb1d7('0x2f')]=_[_0xb1d7('0x30')](_0x4454b1['query']);_0x2c651e['filters']=_['intersection'](_0x2c651e[_0xb1d7('0x2e')],_0x2c651e[_0xb1d7('0x2f')]);_0xd9d951['attributes']=_[_0xb1d7('0x31')](_0x2c651e[_0xb1d7('0x2e')],qs['fields'](_0x4454b1[_0xb1d7('0x2f')][_0xb1d7('0x32')]));_0xd9d951[_0xb1d7('0x33')]=_0xd9d951[_0xb1d7('0x33')][_0xb1d7('0x34')]?_0xd9d951['attributes']:_0x2c651e[_0xb1d7('0x2e')];if(!_0x4454b1[_0xb1d7('0x2f')]['hasOwnProperty'](_0xb1d7('0x35'))){_0xd9d951['limit']=qs[_0xb1d7('0x1b')](_0x4454b1['query'][_0xb1d7('0x1b')]);_0xd9d951['offset']=qs['offset'](_0x4454b1[_0xb1d7('0x2f')][_0xb1d7('0x19')]);}_0xd9d951[_0xb1d7('0x36')]=qs[_0xb1d7('0x37')](_0x4454b1['query'][_0xb1d7('0x37')]);_0xd9d951[_0xb1d7('0x38')]=qs[_0xb1d7('0x39')](_[_0xb1d7('0x3a')](_0x4454b1[_0xb1d7('0x2f')],_0x2c651e[_0xb1d7('0x39')]),_0x137834);if(_0x4454b1[_0xb1d7('0x2f')][_0xb1d7('0x3b')]){_0xd9d951[_0xb1d7('0x38')]=_['merge'](_0xd9d951[_0xb1d7('0x38')],{'$or':_[_0xb1d7('0x3c')](_0x137834,function(_0x3eb769){if(_0x3eb769[_0xb1d7('0x2c')]!==_0xb1d7('0x3d')){var _0x414820={};_0x414820[_0x3eb769[_0xb1d7('0x27')]]={'$like':'%'+_0x4454b1['query'][_0xb1d7('0x3b')]+'%'};return _0x414820;}})});}_0xd9d951=_[_0xb1d7('0x3e')]({},_0xd9d951,_0x4454b1[_0xb1d7('0x3f')]);var _0x137ed1={'where':_0xd9d951[_0xb1d7('0x38')]};return db[_0xb1d7('0x2a')]['count'](_0x137ed1)[_0xb1d7('0x23')](function(_0x3481b){_0x5077dd[_0xb1d7('0x1c')]=_0x3481b;if(_0x4454b1[_0xb1d7('0x2f')][_0xb1d7('0x40')]){_0xd9d951[_0xb1d7('0x41')]=[{'all':!![]}];}return db[_0xb1d7('0x2a')]['findAll'](_0xd9d951);})[_0xb1d7('0x23')](function(_0x331abe){_0x5077dd[_0xb1d7('0x42')]=_0x331abe;return _0x5077dd;})['then'](respondWithFilteredResult(_0x183bf2,_0xd9d951))[_0xb1d7('0x43')](handleError(_0x183bf2,null));};exports[_0xb1d7('0x44')]=function(_0x3d8d88,_0x463219){var _0x1db0f2={'raw':!![],'where':{'id':_0x3d8d88['params']['id']}},_0x96bf2f={};_0x96bf2f[_0xb1d7('0x2e')]=_[_0xb1d7('0x30')](db[_0xb1d7('0x2a')][_0xb1d7('0x2b')]);_0x96bf2f[_0xb1d7('0x2f')]=_[_0xb1d7('0x30')](_0x3d8d88[_0xb1d7('0x2f')]);_0x96bf2f[_0xb1d7('0x39')]=_[_0xb1d7('0x31')](_0x96bf2f['model'],_0x96bf2f[_0xb1d7('0x2f')]);_0x1db0f2[_0xb1d7('0x33')]=_[_0xb1d7('0x31')](_0x96bf2f[_0xb1d7('0x2e')],qs[_0xb1d7('0x32')](_0x3d8d88[_0xb1d7('0x2f')][_0xb1d7('0x32')]));_0x1db0f2[_0xb1d7('0x33')]=_0x1db0f2[_0xb1d7('0x33')]['length']?_0x1db0f2[_0xb1d7('0x33')]:_0x96bf2f[_0xb1d7('0x2e')];if(_0x3d8d88[_0xb1d7('0x2f')]['includeAll']){_0x1db0f2['include']=[{'all':!![]}];}_0x1db0f2=_['merge']({},_0x1db0f2,_0x3d8d88['options']);return db[_0xb1d7('0x2a')][_0xb1d7('0x45')](_0x1db0f2)[_0xb1d7('0x23')](handleEntityNotFound(_0x463219,null))[_0xb1d7('0x23')](respondWithResult(_0x463219,null))[_0xb1d7('0x43')](handleError(_0x463219,null));};exports['create']=function(_0x16414b,_0x67090e){return db[_0xb1d7('0x2a')][_0xb1d7('0x46')](_0x16414b[_0xb1d7('0x47')],{})[_0xb1d7('0x23')](function(_0xec64de){var _0x569710=_0x16414b[_0xb1d7('0x48')][_0xb1d7('0x49')]({'plain':!![]});if(!_0x569710)throw new Error(_0xb1d7('0x4a'));if(_0x569710[_0xb1d7('0x4b')]===_0xb1d7('0x48')){var _0x2ed495=_0xec64de['get']({'plain':!![]});var _0x586814='Dispositions';return db[_0xb1d7('0x4c')][_0xb1d7('0x45')]({'where':{'name':_0x586814,'userProfileId':_0x569710['userProfileId']},'raw':!![]})[_0xb1d7('0x23')](function(_0x36fa35){if(_0x36fa35&&_0x36fa35[_0xb1d7('0x4d')]===0x0){return db[_0xb1d7('0x4e')][_0xb1d7('0x46')]({'name':_0x2ed495['name'],'resourceId':_0x2ed495['id'],'type':_0x36fa35['name'],'sectionId':_0x36fa35['id']},{})[_0xb1d7('0x23')](function(){return _0xec64de;});}else{return _0xec64de;}})[_0xb1d7('0x43')](function(_0xa7b668){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa7b668);throw _0xa7b668;});}return _0xec64de;})[_0xb1d7('0x23')](respondWithResult(_0x67090e,0xc9))[_0xb1d7('0x43')](handleError(_0x67090e,null));};exports[_0xb1d7('0x22')]=function(_0x57f12e,_0x6f5aaf){if(_0x57f12e[_0xb1d7('0x47')]['id']){delete _0x57f12e['body']['id'];}return db[_0xb1d7('0x2a')][_0xb1d7('0x45')]({'where':{'id':_0x57f12e[_0xb1d7('0x4f')]['id']}})['then'](handleEntityNotFound(_0x6f5aaf,null))[_0xb1d7('0x23')](saveUpdates(_0x57f12e[_0xb1d7('0x47')],null))['then'](respondWithResult(_0x6f5aaf,null))['catch'](handleError(_0x6f5aaf,null));};exports[_0xb1d7('0x25')]=function(_0xc348b1,_0x38f673){return db[_0xb1d7('0x2a')]['find']({'where':{'id':_0xc348b1['params']['id']}})[_0xb1d7('0x23')](handleEntityNotFound(_0x38f673,null))[_0xb1d7('0x23')](removeEntity(_0x38f673,null))['catch'](handleError(_0x38f673,null));}; \ No newline at end of file +var _0xcbd7=['options','where','Disposition','includeAll','findAll','rows','catch','show','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','apply','reject','save','update','then','destroy','get','Dispositions','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','pick','filter','merge','VIRTUAL'];(function(_0x14abd7,_0x517ee4){var _0x5b72cd=function(_0x38a6cc){while(--_0x38a6cc){_0x14abd7['push'](_0x14abd7['shift']());}};_0x5b72cd(++_0x517ee4);}(_0xcbd7,0x197));var _0x7cbd=function(_0x8b89b9,_0x451005){_0x8b89b9=_0x8b89b9-0x0;var _0x112b6b=_0xcbd7[_0x8b89b9];return _0x112b6b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7cbd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7cbd('0x1'));var rp=require('request-promise');var moment=require(_0x7cbd('0x2'));var BPromise=require(_0x7cbd('0x3'));var Mustache=require(_0x7cbd('0x4'));var util=require('util');var path=require(_0x7cbd('0x5'));var sox=require(_0x7cbd('0x6'));var csv=require(_0x7cbd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7cbd('0x8'));var _=require(_0x7cbd('0x9'));var squel=require(_0x7cbd('0xa'));var crypto=require(_0x7cbd('0xb'));var jsforce=require(_0x7cbd('0xc'));var deskjs=require(_0x7cbd('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7cbd('0xe'));var authService=require(_0x7cbd('0xf'));var qs=require(_0x7cbd('0x10'));var as=require(_0x7cbd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cbd('0x12'))(_0x7cbd('0x13'));var utils=require('../../config/utils');var config=require(_0x7cbd('0x14'));var licenseUtil=require(_0x7cbd('0x15'));var db=require(_0x7cbd('0x16'))['db'];function respondWithStatusCode(_0xb38787,_0x3c1a22){_0x3c1a22=_0x3c1a22||0xcc;return function(_0x2e58c0){if(_0x2e58c0){return _0xb38787[_0x7cbd('0x17')](_0x3c1a22);}return _0xb38787[_0x7cbd('0x18')](_0x3c1a22)[_0x7cbd('0x19')]();};}function respondWithResult(_0x1283d8,_0x3ba897){_0x3ba897=_0x3ba897||0xc8;return function(_0x4788c9){if(_0x4788c9){return _0x1283d8[_0x7cbd('0x18')](_0x3ba897)['json'](_0x4788c9);}};}function respondWithFilteredResult(_0x244ec4,_0x5ef06b){return function(_0x3c603){if(_0x3c603){var _0x3fdd89=typeof _0x5ef06b[_0x7cbd('0x1a')]===_0x7cbd('0x1b')&&typeof _0x5ef06b['limit']===_0x7cbd('0x1b');var _0x2013e1=_0x3c603[_0x7cbd('0x1c')];var _0x221866=_0x3fdd89?0x0:_0x5ef06b[_0x7cbd('0x1a')];var _0x1a0277=_0x3fdd89?_0x3c603[_0x7cbd('0x1c')]:_0x5ef06b['offset']+_0x5ef06b['limit'];var _0x515a73;if(_0x1a0277>=_0x2013e1){_0x1a0277=_0x2013e1;_0x515a73=0xc8;}else{_0x515a73=0xce;}_0x244ec4['status'](_0x515a73);return _0x244ec4['set']('Content-Range',_0x221866+'-'+_0x1a0277+'/'+_0x2013e1)['json'](_0x3c603);}return null;};}function patchUpdates(_0x226a4f){return function(_0x21a3a5){try{jsonpatch[_0x7cbd('0x1d')](_0x21a3a5,_0x226a4f,!![]);}catch(_0x285e32){return BPromise[_0x7cbd('0x1e')](_0x285e32);}return _0x21a3a5[_0x7cbd('0x1f')]();};}function saveUpdates(_0x3c16cd,_0x5a244a){return function(_0x12072f){if(_0x12072f){return _0x12072f[_0x7cbd('0x20')](_0x3c16cd)[_0x7cbd('0x21')](function(_0x41193a){return _0x41193a;});}return null;};}function removeEntity(_0x366eb6,_0x4494a4){return function(_0x3f55b7){if(_0x3f55b7){return _0x3f55b7[_0x7cbd('0x22')]()[_0x7cbd('0x21')](function(){var _0x92c84=_0x3f55b7[_0x7cbd('0x23')]({'plain':!![]});var _0xce7b35=_0x7cbd('0x24');return db['UserProfileResource'][_0x7cbd('0x22')]({'where':{'type':_0xce7b35,'resourceId':_0x92c84['id']}})['then'](function(){return _0x3f55b7;});})['then'](function(){_0x366eb6['status'](0xcc)[_0x7cbd('0x19')]();});}};}function handleEntityNotFound(_0xddebd0,_0x5c4a50){return function(_0x379ed1){if(!_0x379ed1){_0xddebd0[_0x7cbd('0x17')](0x194);}return _0x379ed1;};}function handleError(_0x339291,_0x594462){_0x594462=_0x594462||0x1f4;return function(_0x4c293b){logger[_0x7cbd('0x25')](_0x4c293b[_0x7cbd('0x26')]);if(_0x4c293b[_0x7cbd('0x27')]){delete _0x4c293b[_0x7cbd('0x27')];}_0x339291[_0x7cbd('0x18')](_0x594462)[_0x7cbd('0x28')](_0x4c293b);};}exports['index']=function(_0x2332e5,_0x529cd2){var _0x4b0a2d={},_0x329045={},_0x175473={'count':0x0,'rows':[]};var _0x1a10a8=_[_0x7cbd('0x29')](db['Disposition'][_0x7cbd('0x2a')],function(_0x2e914a){return{'name':_0x2e914a[_0x7cbd('0x2b')],'type':_0x2e914a[_0x7cbd('0x2c')][_0x7cbd('0x2d')]};});_0x329045[_0x7cbd('0x2e')]=_[_0x7cbd('0x29')](_0x1a10a8,_0x7cbd('0x27'));_0x329045[_0x7cbd('0x2f')]=_[_0x7cbd('0x30')](_0x2332e5[_0x7cbd('0x2f')]);_0x329045[_0x7cbd('0x31')]=_[_0x7cbd('0x32')](_0x329045[_0x7cbd('0x2e')],_0x329045[_0x7cbd('0x2f')]);_0x4b0a2d[_0x7cbd('0x33')]=_['intersection'](_0x329045[_0x7cbd('0x2e')],qs[_0x7cbd('0x34')](_0x2332e5['query'][_0x7cbd('0x34')]));_0x4b0a2d[_0x7cbd('0x33')]=_0x4b0a2d[_0x7cbd('0x33')]['length']?_0x4b0a2d[_0x7cbd('0x33')]:_0x329045[_0x7cbd('0x2e')];if(!_0x2332e5[_0x7cbd('0x2f')]['hasOwnProperty'](_0x7cbd('0x35'))){_0x4b0a2d['limit']=qs[_0x7cbd('0x36')](_0x2332e5[_0x7cbd('0x2f')]['limit']);_0x4b0a2d[_0x7cbd('0x1a')]=qs['offset'](_0x2332e5[_0x7cbd('0x2f')][_0x7cbd('0x1a')]);}_0x4b0a2d[_0x7cbd('0x37')]=qs[_0x7cbd('0x38')](_0x2332e5['query'][_0x7cbd('0x38')]);_0x4b0a2d['where']=qs[_0x7cbd('0x31')](_[_0x7cbd('0x39')](_0x2332e5[_0x7cbd('0x2f')],_0x329045[_0x7cbd('0x31')]),_0x1a10a8);if(_0x2332e5['query'][_0x7cbd('0x3a')]){_0x4b0a2d['where']=_[_0x7cbd('0x3b')](_0x4b0a2d['where'],{'$or':_[_0x7cbd('0x29')](_0x1a10a8,function(_0x2bd2ae){if(_0x2bd2ae[_0x7cbd('0x2c')]!==_0x7cbd('0x3c')){var _0x4bbaec={};_0x4bbaec[_0x2bd2ae['name']]={'$like':'%'+_0x2332e5[_0x7cbd('0x2f')]['filter']+'%'};return _0x4bbaec;}})});}_0x4b0a2d=_[_0x7cbd('0x3b')]({},_0x4b0a2d,_0x2332e5[_0x7cbd('0x3d')]);var _0x313628={'where':_0x4b0a2d[_0x7cbd('0x3e')]};return db[_0x7cbd('0x3f')][_0x7cbd('0x1c')](_0x313628)[_0x7cbd('0x21')](function(_0x22e9ce){_0x175473[_0x7cbd('0x1c')]=_0x22e9ce;if(_0x2332e5[_0x7cbd('0x2f')][_0x7cbd('0x40')]){_0x4b0a2d['include']=[{'all':!![]}];}return db['Disposition'][_0x7cbd('0x41')](_0x4b0a2d);})[_0x7cbd('0x21')](function(_0x3dd6da){_0x175473[_0x7cbd('0x42')]=_0x3dd6da;return _0x175473;})[_0x7cbd('0x21')](respondWithFilteredResult(_0x529cd2,_0x4b0a2d))[_0x7cbd('0x43')](handleError(_0x529cd2,null));};exports[_0x7cbd('0x44')]=function(_0x193fc2,_0x597a7e){var _0x1b68a0={'raw':!![],'where':{'id':_0x193fc2[_0x7cbd('0x45')]['id']}},_0x21881a={};_0x21881a['model']=_[_0x7cbd('0x30')](db[_0x7cbd('0x3f')][_0x7cbd('0x2a')]);_0x21881a[_0x7cbd('0x2f')]=_['keys'](_0x193fc2['query']);_0x21881a['filters']=_[_0x7cbd('0x32')](_0x21881a[_0x7cbd('0x2e')],_0x21881a[_0x7cbd('0x2f')]);_0x1b68a0['attributes']=_['intersection'](_0x21881a['model'],qs['fields'](_0x193fc2[_0x7cbd('0x2f')]['fields']));_0x1b68a0[_0x7cbd('0x33')]=_0x1b68a0[_0x7cbd('0x33')]['length']?_0x1b68a0[_0x7cbd('0x33')]:_0x21881a[_0x7cbd('0x2e')];if(_0x193fc2[_0x7cbd('0x2f')][_0x7cbd('0x40')]){_0x1b68a0[_0x7cbd('0x46')]=[{'all':!![]}];}_0x1b68a0=_[_0x7cbd('0x3b')]({},_0x1b68a0,_0x193fc2[_0x7cbd('0x3d')]);return db[_0x7cbd('0x3f')][_0x7cbd('0x47')](_0x1b68a0)[_0x7cbd('0x21')](handleEntityNotFound(_0x597a7e,null))[_0x7cbd('0x21')](respondWithResult(_0x597a7e,null))[_0x7cbd('0x43')](handleError(_0x597a7e,null));};exports[_0x7cbd('0x48')]=function(_0x25386b,_0x40be42){return db[_0x7cbd('0x3f')]['create'](_0x25386b[_0x7cbd('0x49')],{})[_0x7cbd('0x21')](function(_0x267a97){var _0xe9341d=_0x25386b['user'][_0x7cbd('0x23')]({'plain':!![]});if(!_0xe9341d)throw new Error(_0x7cbd('0x4a'));if(_0xe9341d['role']==='user'){var _0x2dde6c=_0x267a97[_0x7cbd('0x23')]({'plain':!![]});var _0x2a64fc=_0x7cbd('0x24');return db['UserProfileSection'][_0x7cbd('0x47')]({'where':{'name':_0x2a64fc,'userProfileId':_0xe9341d[_0x7cbd('0x4b')]},'raw':!![]})['then'](function(_0x3c0b55){if(_0x3c0b55&&_0x3c0b55[_0x7cbd('0x4c')]===0x0){return db['UserProfileResource'][_0x7cbd('0x48')]({'name':_0x2dde6c[_0x7cbd('0x27')],'resourceId':_0x2dde6c['id'],'type':_0x3c0b55[_0x7cbd('0x27')],'sectionId':_0x3c0b55['id']},{})[_0x7cbd('0x21')](function(){return _0x267a97;});}else{return _0x267a97;}})[_0x7cbd('0x43')](function(_0xc81274){logger['error'](_0x7cbd('0x4d'),_0xc81274);throw _0xc81274;});}return _0x267a97;})[_0x7cbd('0x21')](respondWithResult(_0x40be42,0xc9))[_0x7cbd('0x43')](handleError(_0x40be42,null));};exports['update']=function(_0x703987,_0x26f1bd){if(_0x703987['body']['id']){delete _0x703987['body']['id'];}return db['Disposition']['find']({'where':{'id':_0x703987['params']['id']}})[_0x7cbd('0x21')](handleEntityNotFound(_0x26f1bd,null))[_0x7cbd('0x21')](saveUpdates(_0x703987[_0x7cbd('0x49')],null))[_0x7cbd('0x21')](respondWithResult(_0x26f1bd,null))['catch'](handleError(_0x26f1bd,null));};exports[_0x7cbd('0x22')]=function(_0x5b27fe,_0x4c5742){return db[_0x7cbd('0x3f')][_0x7cbd('0x47')]({'where':{'id':_0x5b27fe['params']['id']}})[_0x7cbd('0x21')](handleEntityNotFound(_0x4c5742,null))[_0x7cbd('0x21')](removeEntity(_0x4c5742,null))[_0x7cbd('0x43')](handleError(_0x4c5742,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 81a88f9..ab51cc2 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 _0xe5ab=['SmsAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','define','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms'];(function(_0x16fc2e,_0x12e1c5){var _0x415142=function(_0x49882e){while(--_0x49882e){_0x16fc2e['push'](_0x16fc2e['shift']());}};_0x415142(++_0x12e1c5);}(_0xe5ab,0xff));var _0xbe5a=function(_0x35b610,_0x1876d9){_0x35b610=_0x35b610-0x0;var _0x5b619a=_0xe5ab[_0x35b610];return _0x5b619a;};'use strict';var _=require(_0xbe5a('0x0'));var util=require(_0xbe5a('0x1'));var logger=require(_0xbe5a('0x2'))(_0xbe5a('0x3'));var moment=require(_0xbe5a('0x4'));var BPromise=require(_0xbe5a('0x5'));var rp=require(_0xbe5a('0x6'));var fs=require('fs');var path=require(_0xbe5a('0x7'));var rimraf=require(_0xbe5a('0x8'));var config=require(_0xbe5a('0x9'));var attributes=require(_0xbe5a('0xa'));module['exports']=function(_0x28a05e,_0x594bd1){return _0x28a05e[_0xbe5a('0xb')]('Disposition',attributes,{'tableName':_0xbe5a('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xbe5a('0xd'),_0xbe5a('0xe')]},{'unique':!![],'name':_0xbe5a('0xf'),'fields':[_0xbe5a('0xd'),_0xbe5a('0x10')]},{'unique':!![],'name':_0xbe5a('0x11'),'fields':[_0xbe5a('0xd'),_0xbe5a('0x12')]},{'unique':!![],'name':_0xbe5a('0x13'),'fields':[_0xbe5a('0xd'),_0xbe5a('0x14')]},{'unique':!![],'name':'name_fax','fields':['name','FaxAccountId']},{'unique':!![],'name':_0xbe5a('0x15'),'fields':[_0xbe5a('0xd'),_0xbe5a('0x16')]},{'unique':!![],'name':_0xbe5a('0x17'),'fields':[_0xbe5a('0xd'),_0xbe5a('0x18')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf9d9=['name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','../../config/logger','api','request-promise','path','rimraf','exports','Disposition','tools_dispositions','name','ChatWebsiteId','name_mail','MailAccountId','name_sms'];(function(_0x43e6a,_0x2c721e){var _0x28b724=function(_0x2ff81e){while(--_0x2ff81e){_0x43e6a['push'](_0x43e6a['shift']());}};_0x28b724(++_0x2c721e);}(_0xf9d9,0x182));var _0x9f9d=function(_0x24d92a,_0x5dcc4d){_0x24d92a=_0x24d92a-0x0;var _0x2d5aed=_0xf9d9[_0x24d92a];return _0x2d5aed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9f9d('0x0'))(_0x9f9d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f9d('0x2'));var fs=require('fs');var path=require(_0x9f9d('0x3'));var rimraf=require(_0x9f9d('0x4'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0x9f9d('0x5')]=function(_0x34e5be,_0x2bccae){return _0x34e5be['define'](_0x9f9d('0x6'),attributes,{'tableName':_0x9f9d('0x7'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x9f9d('0x8'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0x9f9d('0x8'),_0x9f9d('0x9')]},{'unique':!![],'name':_0x9f9d('0xa'),'fields':[_0x9f9d('0x8'),_0x9f9d('0xb')]},{'unique':!![],'name':_0x9f9d('0xc'),'fields':[_0x9f9d('0x8'),'SmsAccountId']},{'unique':!![],'name':_0x9f9d('0xd'),'fields':['name',_0x9f9d('0xe')]},{'unique':!![],'name':_0x9f9d('0xf'),'fields':[_0x9f9d('0x8'),_0x9f9d('0x10')]},{'unique':!![],'name':_0x9f9d('0x11'),'fields':['name',_0x9f9d('0x12')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index e5f85ab..d61f8e3 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(_0x1f2183,_0x3a1492){var _0x3df858=function(_0x5c9933){while(--_0x5c9933){_0x1f2183['push'](_0x1f2183['shift']());}};_0x3df858(++_0x3a1492);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x5a0f46,_0x1cfe52){var _0x5b7032=function(_0x5ed493){while(--_0x5ed493){_0x5a0f46['push'](_0x5a0f46['shift']());}};_0x5b7032(++_0x1cfe52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 1a3e703..5221966 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 _0x2790=['create','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post'];(function(_0x239030,_0x12c69){var _0x51de42=function(_0x2c8fba){while(--_0x2c8fba){_0x239030['push'](_0x239030['shift']());}};_0x51de42(++_0x12c69);}(_0x2790,0x113));var _0x0279=function(_0x5c3ea5,_0xa9ed0c){_0x5c3ea5=_0x5c3ea5-0x0;var _0x102b61=_0x2790[_0x5c3ea5];return _0x102b61;};'use strict';var multer=require(_0x0279('0x0'));var util=require(_0x0279('0x1'));var path=require('path');var timeout=require(_0x0279('0x2'));var express=require(_0x0279('0x3'));var router=express[_0x0279('0x4')]();var fs_extra=require(_0x0279('0x5'));var auth=require(_0x0279('0x6'));var interaction=require(_0x0279('0x7'));var config=require(_0x0279('0x8'));var controller=require('./disposition.controller');router[_0x0279('0x9')]('/',auth[_0x0279('0xa')](),controller['index']);router['get'](_0x0279('0xb'),auth[_0x0279('0xa')](),controller[_0x0279('0xc')]);router[_0x0279('0xd')]('/',auth[_0x0279('0xa')](),controller[_0x0279('0xe')]);router['put']('/:id',auth[_0x0279('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0279('0xf')]);module[_0x0279('0x10')]=router; \ No newline at end of file +var _0x3bd8=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','exports'];(function(_0x412342,_0x180734){var _0x3e62cb=function(_0x501fc6){while(--_0x501fc6){_0x412342['push'](_0x412342['shift']());}};_0x3e62cb(++_0x180734);}(_0x3bd8,0x1d4));var _0x83bd=function(_0x264d4d,_0x118fb5){_0x264d4d=_0x264d4d-0x0;var _0xc917e2=_0x3bd8[_0x264d4d];return _0xc917e2;};'use strict';var multer=require(_0x83bd('0x0'));var util=require(_0x83bd('0x1'));var path=require('path');var timeout=require(_0x83bd('0x2'));var express=require(_0x83bd('0x3'));var router=express[_0x83bd('0x4')]();var fs_extra=require(_0x83bd('0x5'));var auth=require(_0x83bd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x83bd('0x7'));var controller=require('./disposition.controller');router[_0x83bd('0x8')]('/',auth[_0x83bd('0x9')](),controller[_0x83bd('0xa')]);router[_0x83bd('0x8')](_0x83bd('0xb'),auth[_0x83bd('0x9')](),controller['show']);router[_0x83bd('0xc')]('/',auth[_0x83bd('0x9')](),controller[_0x83bd('0xd')]);router[_0x83bd('0xe')](_0x83bd('0xb'),auth[_0x83bd('0x9')](),controller['update']);router[_0x83bd('0xf')](_0x83bd('0xb'),auth[_0x83bd('0x9')](),controller[_0x83bd('0x10')]);module[_0x83bd('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index c8a4494..2eaa670 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 _0x038b=['exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','7200','9600','12000','2400','14400','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','mandatoryDisposition'];(function(_0x47be48,_0x1fbf23){var _0x518d1f=function(_0x413ac8){while(--_0x413ac8){_0x47be48['push'](_0x47be48['shift']());}};_0x518d1f(++_0x1fbf23);}(_0x038b,0x114));var _0xb038=function(_0x418ef1,_0x430b3c){_0x418ef1=_0x418ef1-0x0;var _0x13cadf=_0x038b[_0x418ef1];return _0x13cadf;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'name':{'type':Sequelize[_0xb038('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb038('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0xb038('0x2'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xb038('0x1')],'defaultValue':_0xb038('0x3')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xb038('0x4')},'minrate':{'type':Sequelize[_0xb038('0x5')]('2400','4800',_0xb038('0x6'),_0xb038('0x7'),_0xb038('0x8'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xb038('0x5')](_0xb038('0x9'),'4800','7200',_0xb038('0x7'),_0xb038('0x8'),'14400'),'defaultValue':_0xb038('0xa')},'modem':{'type':Sequelize[_0xb038('0x1')],'defaultValue':_0xb038('0xb')},'gateway':{'type':Sequelize[_0xb038('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xb038('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xb038('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xb038('0x5')](_0xb038('0xd'),_0xb038('0xe'),_0xb038('0xf'),_0xb038('0x10')),'defaultValue':_0xb038('0xd')},'key':{'type':Sequelize[_0xb038('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb038('0x11')],'defaultValue':function(){return _0xb038('0x12');}},'notificationSound':{'type':Sequelize[_0xb038('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb038('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb038('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb038('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb038('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb038('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb038('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb038('0xc')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xb038('0x13')],'defaultValue':![],'comment':_0xb038('0x14'),'set':function(_0xd1fae0){if(!_0xd1fae0)this[_0xb038('0x15')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xb038('0x16'),_0xd1fae0);}}}; \ No newline at end of file +var _0x6ec2=['sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','12000','14400','2400','7200','9600','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue'];(function(_0x2c9f85,_0x23135d){var _0x249860=function(_0x48aad6){while(--_0x48aad6){_0x2c9f85['push'](_0x2c9f85['shift']());}};_0x249860(++_0x23135d);}(_0x6ec2,0x78));var _0x26ec=function(_0x4a1e26,_0x59b14c){_0x4a1e26=_0x4a1e26-0x0;var _0xb705dc=_0x6ec2[_0x4a1e26];return _0xb705dc;};'use strict';var Sequelize=require(_0x26ec('0x0'));module[_0x26ec('0x1')]={'name':{'type':Sequelize[_0x26ec('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x26ec('0x2')]},'ecm':{'type':Sequelize[_0x26ec('0x3')](_0x26ec('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x26ec('0x2')],'defaultValue':_0x26ec('0x5')},'localstationid':{'type':Sequelize[_0x26ec('0x2')],'unique':_0x26ec('0x6')},'minrate':{'type':Sequelize[_0x26ec('0x3')]('2400',_0x26ec('0x7'),'7200','9600',_0x26ec('0x8'),_0x26ec('0x9')),'defaultValue':_0x26ec('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0x26ec('0xa'),'4800',_0x26ec('0xb'),_0x26ec('0xc'),_0x26ec('0x8'),_0x26ec('0x9')),'defaultValue':_0x26ec('0x9')},'modem':{'type':Sequelize[_0x26ec('0x2')],'defaultValue':_0x26ec('0xd')},'gateway':{'type':Sequelize[_0x26ec('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x26ec('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x26ec('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP',_0x26ec('0xf'),_0x26ec('0x10'),_0x26ec('0x11')),'defaultValue':_0x26ec('0x12')},'key':{'type':Sequelize[_0x26ec('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x26ec('0x13')],'defaultValue':function(){return _0x26ec('0x14');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x26ec('0x15')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x26ec('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x26ec('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x26ec('0x15')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x26ec('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x26ec('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x26ec('0x16')},'mandatoryDisposition':{'type':Sequelize[_0x26ec('0x15')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x17282d){if(!_0x17282d)this[_0x26ec('0x17')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x17282d);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index cd8857f..85ccdf0 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 _0xf66a=['end','json','offset','undefined','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','name','send','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','fullname','tag','transaction','sequelize','ISOLATION_LEVELS','FaxApplication','findAndCountAll','priority','stack','finally','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','push','CDR(type)=inbound-fax','Set','gateway','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','bulkCreate','updateAccountApplications','key','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','path','from','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status'];(function(_0x5bef15,_0x4d76c1){var _0x378532=function(_0x6ecaf3){while(--_0x6ecaf3){_0x5bef15['push'](_0x5bef15['shift']());}};_0x378532(++_0x4d76c1);}(_0xf66a,0x15a));var _0xaf66=function(_0x417b1e,_0x4cc0e5){_0x417b1e=_0x417b1e-0x0;var _0x5d1816=_0xf66a[_0x417b1e];return _0x5d1816;};'use strict';var emlformat=require(_0xaf66('0x0'));var rimraf=require(_0xaf66('0x1'));var zipdir=require(_0xaf66('0x2'));var jsonpatch=require(_0xaf66('0x3'));var rp=require(_0xaf66('0x4'));var moment=require(_0xaf66('0x5'));var BPromise=require(_0xaf66('0x6'));var Mustache=require(_0xaf66('0x7'));var util=require(_0xaf66('0x8'));var path=require('path');var sox=require(_0xaf66('0x9'));var csv=require(_0xaf66('0xa'));var ejs=require(_0xaf66('0xb'));var fs=require('fs');var fs_extra=require(_0xaf66('0xc'));var _=require(_0xaf66('0xd'));var squel=require(_0xaf66('0xe'));var crypto=require(_0xaf66('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xaf66('0x10'));var toCsv=require(_0xaf66('0xa'));var querystring=require(_0xaf66('0x11'));var Papa=require(_0xaf66('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaf66('0x13'));var as=require(_0xaf66('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf66('0x15'))(_0xaf66('0x16'));var utils=require(_0xaf66('0x17'));var config=require(_0xaf66('0x18'));var licenseUtil=require(_0xaf66('0x19'));var db=require(_0xaf66('0x1a'))['db'];config['redis']=_[_0xaf66('0x1b')](config[_0xaf66('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xaf66('0x1d'))(new Redis(config['redis']));require(_0xaf66('0x1e'))[_0xaf66('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0xaf66('0x20')][_0xaf66('0x21')]({'port':0x232c});var client9002=jayson[_0xaf66('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fb384,_0x34b18f,_0xd0ecc9,_0x548bcc){return new BPromise(function(_0x180b72,_0x2dbe3d){var _0x9a14d3=_0x548bcc||client;return _0x9a14d3[_0xaf66('0x22')](_0x4fb384,_0xd0ecc9)[_0xaf66('0x23')](function(_0x5a15a8){logger['info'](_0xaf66('0x24'),_0x34b18f,'request\x20sent');logger[_0xaf66('0x25')](_0xaf66('0x26'),_0x34b18f,_0xaf66('0x27'),JSON[_0xaf66('0x28')](_0x5a15a8));if(_0x5a15a8[_0xaf66('0x29')]){if(_0x5a15a8[_0xaf66('0x29')][_0xaf66('0x2a')]===0x1f4){logger[_0xaf66('0x29')](_0xaf66('0x24'),_0x34b18f,_0x5a15a8[_0xaf66('0x29')]['message']);return _0x2dbe3d(_0x5a15a8[_0xaf66('0x29')][_0xaf66('0x2b')]);}logger[_0xaf66('0x29')]('FaxAccount,\x20%s,\x20%s',_0x34b18f,_0x5a15a8['error'][_0xaf66('0x2b')]);return _0x180b72(_0x5a15a8[_0xaf66('0x29')][_0xaf66('0x2b')]);}else{logger[_0xaf66('0x2c')](_0xaf66('0x24'),_0x34b18f,_0xaf66('0x27'));_0x180b72(_0x5a15a8[_0xaf66('0x2d')][_0xaf66('0x2b')]);}})['catch'](function(_0x59adac){logger[_0xaf66('0x29')]('FaxAccount,\x20%s,\x20%s',_0x34b18f,_0x59adac);_0x2dbe3d(_0x59adac);});});}function respondWithStatusCode(_0x234e8b,_0x42527b){_0x42527b=_0x42527b||0xcc;return function(_0x3d58b4){if(_0x3d58b4){return _0x234e8b[_0xaf66('0x2e')](_0x42527b);}return _0x234e8b[_0xaf66('0x2f')](_0x42527b)[_0xaf66('0x30')]();};}function respondWithResult(_0x381845,_0x4f6b0d){_0x4f6b0d=_0x4f6b0d||0xc8;return function(_0x102d2f){if(_0x102d2f){return _0x381845[_0xaf66('0x2f')](_0x4f6b0d)[_0xaf66('0x31')](_0x102d2f);}};}function respondWithFilteredResult(_0x223175,_0x22b84f){return function(_0xd76718){if(_0xd76718){var _0x503bf8=typeof _0x22b84f[_0xaf66('0x32')]===_0xaf66('0x33')&&typeof _0x22b84f['limit']===_0xaf66('0x33');var _0x1634e2=_0xd76718['count'];var _0x4701ca=_0x503bf8?0x0:_0x22b84f[_0xaf66('0x32')];var _0x158911=_0x503bf8?_0xd76718['count']:_0x22b84f['offset']+_0x22b84f['limit'];var _0x39fa99;if(_0x158911>=_0x1634e2){_0x158911=_0x1634e2;_0x39fa99=0xc8;}else{_0x39fa99=0xce;}_0x223175['status'](_0x39fa99);return _0x223175[_0xaf66('0x34')](_0xaf66('0x35'),_0x4701ca+'-'+_0x158911+'/'+_0x1634e2)[_0xaf66('0x31')](_0xd76718);}return null;};}function patchUpdates(_0x2dbefb){return function(_0x219b1c){try{jsonpatch[_0xaf66('0x36')](_0x219b1c,_0x2dbefb,!![]);}catch(_0x1760fc){return BPromise[_0xaf66('0x37')](_0x1760fc);}return _0x219b1c[_0xaf66('0x38')]();};}function saveUpdates(_0xb0e96d,_0x1812a5){return function(_0x1e560c){if(_0x1e560c){return _0x1e560c[_0xaf66('0x39')](_0xb0e96d)['then'](function(_0x323c0c){return _0x323c0c;});}return null;};}function removeEntity(_0x3b3e89,_0x1b0a31){return function(_0x564902){if(_0x564902){return _0x564902[_0xaf66('0x3a')]()[_0xaf66('0x23')](function(){var _0x15bbdb=_0x564902[_0xaf66('0x3b')]({'plain':!![]});var _0x2bd512=_0xaf66('0x3c');return db[_0xaf66('0x3d')][_0xaf66('0x3a')]({'where':{'type':_0x2bd512,'resourceId':_0x15bbdb['id']}})[_0xaf66('0x23')](function(){return _0x564902;});})[_0xaf66('0x23')](function(){_0x3b3e89[_0xaf66('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e42a4,_0x4c3a08){return function(_0x1b2974){if(!_0x1b2974){_0x3e42a4['sendStatus'](0x194);}return _0x1b2974;};}function handleError(_0x16d407,_0x535d66){_0x535d66=_0x535d66||0x1f4;return function(_0x311afe){logger[_0xaf66('0x29')](_0x311afe['stack']);if(_0x311afe[_0xaf66('0x3e')]){delete _0x311afe[_0xaf66('0x3e')];}_0x16d407['status'](_0x535d66)[_0xaf66('0x3f')](_0x311afe);};}exports['index']=function(_0xbebf33,_0x4ca05d){var _0x53be86={'include':[{'model':db[_0xaf66('0x40')],'as':_0xaf66('0x41')}]},_0x410a9a={},_0x5afd22={'count':0x0,'rows':[]};var _0x4247bf=_['map'](db[_0xaf66('0x42')][_0xaf66('0x43')],function(_0x3b5336){return{'name':_0x3b5336[_0xaf66('0x44')],'type':_0x3b5336['type']['key']};});_0x410a9a[_0xaf66('0x45')]=_[_0xaf66('0x46')](_0x4247bf,_0xaf66('0x3e'));_0x410a9a[_0xaf66('0x47')]=_[_0xaf66('0x48')](_0xbebf33[_0xaf66('0x47')]);_0x410a9a[_0xaf66('0x49')]=_[_0xaf66('0x4a')](_0x410a9a[_0xaf66('0x45')],_0x410a9a['query']);_0x53be86[_0xaf66('0x4b')]=_[_0xaf66('0x4a')](_0x410a9a[_0xaf66('0x45')],qs[_0xaf66('0x4c')](_0xbebf33['query'][_0xaf66('0x4c')]));_0x53be86['attributes']=_0x53be86[_0xaf66('0x4b')][_0xaf66('0x4d')]?_0x53be86['attributes']:_0x410a9a[_0xaf66('0x45')];if(!_0xbebf33[_0xaf66('0x47')][_0xaf66('0x4e')]('nolimit')){_0x53be86['limit']=qs[_0xaf66('0x4f')](_0xbebf33[_0xaf66('0x47')][_0xaf66('0x4f')]);_0x53be86[_0xaf66('0x32')]=qs[_0xaf66('0x32')](_0xbebf33[_0xaf66('0x47')][_0xaf66('0x32')]);}_0x53be86['order']=qs[_0xaf66('0x50')](_0xbebf33['query'][_0xaf66('0x50')]);_0x53be86[_0xaf66('0x51')]=qs[_0xaf66('0x49')](_[_0xaf66('0x52')](_0xbebf33[_0xaf66('0x47')],_0x410a9a[_0xaf66('0x49')]),_0x4247bf);if(_0xbebf33[_0xaf66('0x47')][_0xaf66('0x53')]){_0x53be86[_0xaf66('0x51')]=_[_0xaf66('0x54')](_0x53be86[_0xaf66('0x51')],{'$or':_['map'](_0x4247bf,function(_0x11dd4a){if(_0x11dd4a[_0xaf66('0x55')]!==_0xaf66('0x56')){var _0x1959cc={};_0x1959cc[_0x11dd4a[_0xaf66('0x3e')]]={'$like':'%'+_0xbebf33[_0xaf66('0x47')][_0xaf66('0x53')]+'%'};return _0x1959cc;}})});}_0x53be86=_[_0xaf66('0x54')]({},_0x53be86,_0xbebf33[_0xaf66('0x57')]);var _0x1da81f={'where':_0x53be86[_0xaf66('0x51')]};return db['FaxAccount'][_0xaf66('0x58')](_0x1da81f)[_0xaf66('0x23')](function(_0x430256){_0x5afd22[_0xaf66('0x58')]=_0x430256;if(_0xbebf33['query'][_0xaf66('0x59')]){_0x53be86[_0xaf66('0x5a')]=[{'all':!![]}];}return db[_0xaf66('0x42')][_0xaf66('0x5b')](_0x53be86);})[_0xaf66('0x23')](function(_0x153de8){_0x5afd22[_0xaf66('0x5c')]=_0x153de8;return _0x5afd22;})[_0xaf66('0x23')](respondWithFilteredResult(_0x4ca05d,_0x53be86))[_0xaf66('0x5d')](handleError(_0x4ca05d,null));};exports[_0xaf66('0x5e')]=function(_0x337466,_0xa497e0){var _0x3ec274={'raw':![],'where':{'id':_0x337466[_0xaf66('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0xaf66('0x41')}]},_0x4b2ce5={};_0x4b2ce5[_0xaf66('0x45')]=_[_0xaf66('0x48')](db[_0xaf66('0x42')][_0xaf66('0x43')]);_0x4b2ce5[_0xaf66('0x47')]=_['keys'](_0x337466[_0xaf66('0x47')]);_0x4b2ce5['filters']=_[_0xaf66('0x4a')](_0x4b2ce5['model'],_0x4b2ce5[_0xaf66('0x47')]);_0x3ec274['attributes']=_[_0xaf66('0x4a')](_0x4b2ce5[_0xaf66('0x45')],qs[_0xaf66('0x4c')](_0x337466[_0xaf66('0x47')][_0xaf66('0x4c')]));_0x3ec274[_0xaf66('0x4b')]=_0x3ec274['attributes']['length']?_0x3ec274[_0xaf66('0x4b')]:_0x4b2ce5[_0xaf66('0x45')];if(_0x337466['query'][_0xaf66('0x59')]){_0x3ec274[_0xaf66('0x5a')]=[{'all':!![]}];}_0x3ec274=_[_0xaf66('0x54')]({},_0x3ec274,_0x337466[_0xaf66('0x57')]);return db[_0xaf66('0x42')]['find'](_0x3ec274)[_0xaf66('0x23')](handleEntityNotFound(_0xa497e0,null))[_0xaf66('0x23')](respondWithResult(_0xa497e0,null))[_0xaf66('0x5d')](handleError(_0xa497e0,null));};exports[_0xaf66('0x60')]=function(_0x5789f7,_0x71fb0d){return db[_0xaf66('0x42')][_0xaf66('0x60')](_0x5789f7[_0xaf66('0x61')],{})['then'](function(_0x3da5f0){var _0x584480=_0x5789f7[_0xaf66('0x62')][_0xaf66('0x3b')]({'plain':!![]});if(!_0x584480)throw new Error(_0xaf66('0x63'));if(_0x584480[_0xaf66('0x64')]===_0xaf66('0x62')){var _0x5df744=_0x3da5f0['get']({'plain':!![]});var _0x5a5d4d='FaxAccounts';return db['UserProfileSection'][_0xaf66('0x65')]({'where':{'name':_0x5a5d4d,'userProfileId':_0x584480[_0xaf66('0x66')]},'raw':!![]})[_0xaf66('0x23')](function(_0x291b4c){if(_0x291b4c&&_0x291b4c[_0xaf66('0x67')]===0x0){return db['UserProfileResource'][_0xaf66('0x60')]({'name':_0x5df744['name'],'resourceId':_0x5df744['id'],'type':_0x291b4c['name'],'sectionId':_0x291b4c['id']},{})['then'](function(){return _0x3da5f0;});}else{return _0x3da5f0;}})[_0xaf66('0x5d')](function(_0xf1e9fc){logger[_0xaf66('0x29')](_0xaf66('0x68'),_0xf1e9fc);throw _0xf1e9fc;});}return _0x3da5f0;})[_0xaf66('0x23')](respondWithResult(_0x71fb0d,0xc9))['catch'](handleError(_0x71fb0d,null));};exports[_0xaf66('0x39')]=function(_0x10b8bb,_0x3e2281){if(_0x10b8bb[_0xaf66('0x61')]['id']){delete _0x10b8bb['body']['id'];}return db[_0xaf66('0x42')]['find']({'where':{'id':_0x10b8bb['params']['id']},'include':[{'model':db[_0xaf66('0x40')],'as':_0xaf66('0x41')}]})[_0xaf66('0x23')](handleEntityNotFound(_0x3e2281,null))[_0xaf66('0x23')](saveUpdates(_0x10b8bb[_0xaf66('0x61')],null))[_0xaf66('0x23')](respondWithResult(_0x3e2281,null))[_0xaf66('0x5d')](handleError(_0x3e2281,null));};exports[_0xaf66('0x3a')]=function(_0xaf1381,_0x5a4cfc){return db[_0xaf66('0x42')][_0xaf66('0x65')]({'where':{'id':_0xaf1381[_0xaf66('0x5f')]['id']}})[_0xaf66('0x23')](handleEntityNotFound(_0x5a4cfc,null))[_0xaf66('0x23')](removeEntity(_0x5a4cfc,null))['catch'](handleError(_0x5a4cfc,null));};exports['describe']=function(_0x2b16aa,_0x27be1f){return db['FaxAccount'][_0xaf66('0x69')]()['then'](respondWithResult(_0x27be1f,null))[_0xaf66('0x5d')](handleError(_0x27be1f,null));};exports[_0xaf66('0x6a')]=function(_0x346cc3,_0x14bd0b,_0x4685ed){if(_0x346cc3[_0xaf66('0x61')]['id']){delete _0x346cc3[_0xaf66('0x61')]['id'];}return db[_0xaf66('0x42')][_0xaf66('0x65')]({'where':{'id':_0x346cc3[_0xaf66('0x5f')]['id']}})[_0xaf66('0x23')](handleEntityNotFound(_0x14bd0b,null))['then'](function(_0x603e67){if(_0x603e67){_0x346cc3[_0xaf66('0x61')][_0xaf66('0x6b')]=_0x603e67['id'];return db[_0xaf66('0x6c')][_0xaf66('0x60')](_0x346cc3[_0xaf66('0x61')]);}})[_0xaf66('0x23')](respondWithResult(_0x14bd0b,null))['catch'](handleError(_0x14bd0b,null));};exports[_0xaf66('0x6d')]=function(_0x48a2e7,_0x2d7874,_0x184a38){var _0x2481eb={'raw':![],'where':{}};var _0x589202={};var _0x495e76={'count':0x0,'rows':[]};return db[_0xaf66('0x42')][_0xaf66('0x6e')]({'where':{'id':_0x48a2e7['params']['id']}})['then'](handleEntityNotFound(_0x2d7874,null))[_0xaf66('0x23')](function(_0x3666fe){if(_0x3666fe){_0x589202[_0xaf66('0x45')]=_['keys'](db['Disposition']['rawAttributes']);_0x589202[_0xaf66('0x47')]=_[_0xaf66('0x48')](_0x48a2e7[_0xaf66('0x47')]);_0x589202[_0xaf66('0x49')]=_['intersection'](_0x589202[_0xaf66('0x45')],_0x589202[_0xaf66('0x47')]);_0x2481eb[_0xaf66('0x4b')]=_[_0xaf66('0x4a')](_0x589202[_0xaf66('0x45')],qs[_0xaf66('0x4c')](_0x48a2e7[_0xaf66('0x47')][_0xaf66('0x4c')]));_0x2481eb[_0xaf66('0x4b')]=_0x2481eb['attributes'][_0xaf66('0x4d')]?_0x2481eb[_0xaf66('0x4b')]:_0x589202[_0xaf66('0x45')];if(!_0x48a2e7[_0xaf66('0x47')][_0xaf66('0x4e')](_0xaf66('0x6f'))){_0x2481eb[_0xaf66('0x4f')]=qs[_0xaf66('0x4f')](_0x48a2e7['query']['limit']);_0x2481eb[_0xaf66('0x32')]=qs[_0xaf66('0x32')](_0x48a2e7[_0xaf66('0x47')]['offset']);}_0x2481eb['order']=qs['sort'](_0x48a2e7[_0xaf66('0x47')][_0xaf66('0x50')]);_0x2481eb['where']=qs[_0xaf66('0x49')](_['pick'](_0x48a2e7[_0xaf66('0x47')],_0x589202[_0xaf66('0x49')]));_0x2481eb[_0xaf66('0x51')][_0xaf66('0x6b')]=_0x3666fe['id'];if(_0x48a2e7[_0xaf66('0x47')][_0xaf66('0x53')]){_0x2481eb[_0xaf66('0x51')]=_[_0xaf66('0x54')](_0x2481eb[_0xaf66('0x51')],{'$or':_['map'](_0x2481eb[_0xaf66('0x4b')],function(_0x5d933f){var _0x3f9712={};_0x3f9712[_0x5d933f]={'$like':'%'+_0x48a2e7[_0xaf66('0x47')]['filter']+'%'};return _0x3f9712;})});}_0x2481eb=_[_0xaf66('0x54')]({},_0x2481eb,_0x48a2e7[_0xaf66('0x57')]);return db[_0xaf66('0x6c')][_0xaf66('0x58')]({'where':_0x2481eb[_0xaf66('0x51')]})[_0xaf66('0x23')](function(_0x175c3b){_0x495e76['count']=_0x175c3b;if(_0x48a2e7[_0xaf66('0x47')][_0xaf66('0x59')]){_0x2481eb[_0xaf66('0x5a')]=[{'all':!![]}];}return db['Disposition'][_0xaf66('0x5b')](_0x2481eb);})[_0xaf66('0x23')](function(_0x5e9419){_0x495e76[_0xaf66('0x5c')]=_0x5e9419;return _0x495e76;});}})[_0xaf66('0x23')](respondWithFilteredResult(_0x2d7874,_0x2481eb))['catch'](handleError(_0x2d7874,null));};exports[_0xaf66('0x70')]=function(_0x3d9d7a,_0x15b85d,_0x2e2b27){return db[_0xaf66('0x42')][_0xaf66('0x65')]({'where':{'id':_0x3d9d7a[_0xaf66('0x5f')]['id']}})['then'](handleEntityNotFound(_0x15b85d,null))[_0xaf66('0x23')](function(_0x5d91dc){if(_0x5d91dc){return _0x5d91dc['removeDispositions'](_0x3d9d7a[_0xaf66('0x47')][_0xaf66('0x71')]);}})[_0xaf66('0x23')](respondWithStatusCode(_0x15b85d,null))[_0xaf66('0x5d')](handleError(_0x15b85d,null));};exports[_0xaf66('0x72')]=function(_0x391918,_0x1fe428,_0x2a6b1a){if(_0x391918['body']['id']){delete _0x391918['body']['id'];}return db[_0xaf66('0x42')][_0xaf66('0x65')]({'where':{'id':_0x391918[_0xaf66('0x5f')]['id']}})[_0xaf66('0x23')](handleEntityNotFound(_0x1fe428,null))['then'](function(_0x45e6a9){if(_0x45e6a9){_0x391918[_0xaf66('0x61')][_0xaf66('0x6b')]=_0x45e6a9['id'];return db[_0xaf66('0x73')]['create'](_0x391918[_0xaf66('0x61')]);}})[_0xaf66('0x23')](respondWithResult(_0x1fe428,null))[_0xaf66('0x5d')](handleError(_0x1fe428,null));};exports[_0xaf66('0x74')]=function(_0x5239c6,_0x4c3196,_0x58e8cd){var _0x55a184={'raw':![],'where':{}};var _0x121b9d={};var _0x347ace={'count':0x0,'rows':[]};return db[_0xaf66('0x42')]['findOne']({'where':{'id':_0x5239c6[_0xaf66('0x5f')]['id']}})[_0xaf66('0x23')](handleEntityNotFound(_0x4c3196,null))[_0xaf66('0x23')](function(_0x4bb059){if(_0x4bb059){_0x121b9d[_0xaf66('0x45')]=_[_0xaf66('0x48')](db['CannedAnswer'][_0xaf66('0x43')]);_0x121b9d[_0xaf66('0x47')]=_[_0xaf66('0x48')](_0x5239c6[_0xaf66('0x47')]);_0x121b9d[_0xaf66('0x49')]=_[_0xaf66('0x4a')](_0x121b9d[_0xaf66('0x45')],_0x121b9d[_0xaf66('0x47')]);_0x55a184[_0xaf66('0x4b')]=_[_0xaf66('0x4a')](_0x121b9d[_0xaf66('0x45')],qs[_0xaf66('0x4c')](_0x5239c6['query'][_0xaf66('0x4c')]));_0x55a184[_0xaf66('0x4b')]=_0x55a184[_0xaf66('0x4b')][_0xaf66('0x4d')]?_0x55a184['attributes']:_0x121b9d[_0xaf66('0x45')];if(!_0x5239c6['query'][_0xaf66('0x4e')](_0xaf66('0x6f'))){_0x55a184[_0xaf66('0x4f')]=qs['limit'](_0x5239c6[_0xaf66('0x47')][_0xaf66('0x4f')]);_0x55a184[_0xaf66('0x32')]=qs[_0xaf66('0x32')](_0x5239c6[_0xaf66('0x47')]['offset']);}_0x55a184[_0xaf66('0x75')]=qs['sort'](_0x5239c6[_0xaf66('0x47')][_0xaf66('0x50')]);_0x55a184[_0xaf66('0x51')]=qs[_0xaf66('0x49')](_[_0xaf66('0x52')](_0x5239c6[_0xaf66('0x47')],_0x121b9d[_0xaf66('0x49')]));_0x55a184['where'][_0xaf66('0x6b')]=_0x4bb059['id'];if(_0x5239c6[_0xaf66('0x47')][_0xaf66('0x53')]){_0x55a184[_0xaf66('0x51')]=_[_0xaf66('0x54')](_0x55a184[_0xaf66('0x51')],{'$or':_[_0xaf66('0x46')](_0x55a184[_0xaf66('0x4b')],function(_0xae877e){var _0x3c1da3={};_0x3c1da3[_0xae877e]={'$like':'%'+_0x5239c6[_0xaf66('0x47')][_0xaf66('0x53')]+'%'};return _0x3c1da3;})});}_0x55a184=_['merge']({},_0x55a184,_0x5239c6['options']);return db[_0xaf66('0x73')][_0xaf66('0x58')]({'where':_0x55a184[_0xaf66('0x51')]})['then'](function(_0x114cbf){_0x347ace['count']=_0x114cbf;if(_0x5239c6[_0xaf66('0x47')][_0xaf66('0x59')]){_0x55a184[_0xaf66('0x5a')]=[{'all':!![]}];}return db[_0xaf66('0x73')]['findAll'](_0x55a184);})[_0xaf66('0x23')](function(_0xee5458){_0x347ace[_0xaf66('0x5c')]=_0xee5458;return _0x347ace;});}})[_0xaf66('0x23')](respondWithFilteredResult(_0x4c3196,_0x55a184))[_0xaf66('0x5d')](handleError(_0x4c3196,null));};exports['removeAnswers']=function(_0x13176f,_0xa07348,_0x270983){return db['FaxAccount'][_0xaf66('0x65')]({'where':{'id':_0x13176f['params']['id']}})[_0xaf66('0x23')](handleEntityNotFound(_0xa07348,null))['then'](function(_0x759927){if(_0x759927){return _0x759927[_0xaf66('0x76')](_0x13176f['query'][_0xaf66('0x71')]);}})['then'](respondWithStatusCode(_0xa07348,null))[_0xaf66('0x5d')](handleError(_0xa07348,null));};exports[_0xaf66('0x77')]=function(_0x3f0102,_0x2202ff,_0x9918a1){return db[_0xaf66('0x78')]['find']({'where':{'id':_0x3f0102['params']['id']}})[_0xaf66('0x23')](handleEntityNotFound(_0x2202ff,null))[_0xaf66('0x23')](function(_0x4d2a15){if(_0x4d2a15){return _0x4d2a15['addInteraction'](_0x3f0102[_0xaf66('0x61')]['ids'],_[_0xaf66('0x79')](_0x3f0102[_0xaf66('0x61')],[_0xaf66('0x71'),'id'])||{});}})[_0xaf66('0x23')](respondWithResult(_0x2202ff,null))[_0xaf66('0x5d')](handleError(_0x2202ff,null));};exports['getInteractions']=function(_0x1d1999,_0x74ae,_0x5820c6){var _0x10c537={'raw':![],'where':{}};var _0x2eed11={};var _0x39d63a={'count':0x0,'rows':[]};return db[_0xaf66('0x42')]['findOne']({'where':{'id':_0x1d1999['params']['id']}})[_0xaf66('0x23')](handleEntityNotFound(_0x74ae,null))[_0xaf66('0x23')](function(_0x76edbf){if(_0x76edbf){_0x2eed11['model']=_['keys'](db['FaxInteraction']['rawAttributes']);_0x2eed11[_0xaf66('0x47')]=_[_0xaf66('0x48')](_0x1d1999['query']);_0x2eed11[_0xaf66('0x49')]=_[_0xaf66('0x4a')](_0x2eed11['model'],_0x2eed11['query']);_0x10c537[_0xaf66('0x4b')]=_[_0xaf66('0x4a')](_0x2eed11[_0xaf66('0x45')],qs[_0xaf66('0x4c')](_0x1d1999['query'][_0xaf66('0x4c')]));_0x10c537[_0xaf66('0x4b')]=_0x10c537['attributes'][_0xaf66('0x4d')]?_0x10c537[_0xaf66('0x4b')]:_0x2eed11[_0xaf66('0x45')];if(!_0x1d1999[_0xaf66('0x47')]['hasOwnProperty'](_0xaf66('0x6f'))){_0x10c537['limit']=qs[_0xaf66('0x4f')](_0x1d1999[_0xaf66('0x47')][_0xaf66('0x4f')]);_0x10c537[_0xaf66('0x32')]=qs['offset'](_0x1d1999['query'][_0xaf66('0x32')]);}_0x10c537[_0xaf66('0x75')]=qs[_0xaf66('0x50')](_0x1d1999['query'][_0xaf66('0x50')]);_0x10c537['where']=qs[_0xaf66('0x49')](_[_0xaf66('0x52')](_0x1d1999['query'],_0x2eed11[_0xaf66('0x49')]));_0x10c537[_0xaf66('0x51')][_0xaf66('0x6b')]=_0x76edbf['id'];if(_0x1d1999[_0xaf66('0x47')][_0xaf66('0x53')]){_0x10c537[_0xaf66('0x51')]=_[_0xaf66('0x54')](_0x10c537[_0xaf66('0x51')],{'$or':_[_0xaf66('0x46')](_0x10c537['attributes'],function(_0x1ae683){var _0x5941e3={};_0x5941e3[_0x1ae683]={'$like':'%'+_0x1d1999['query']['filter']+'%'};return _0x5941e3;})});}_0x10c537=_[_0xaf66('0x54')]({},_0x10c537,_0x1d1999['options']);return db['FaxInteraction'][_0xaf66('0x58')]({'where':_0x10c537[_0xaf66('0x51')]})[_0xaf66('0x23')](function(_0x4fcf6f){_0x39d63a['count']=_0x4fcf6f;if(_0x1d1999[_0xaf66('0x47')][_0xaf66('0x59')]){_0x10c537[_0xaf66('0x5a')]=[{'model':db[_0xaf66('0x7a')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xaf66('0x3e'),_0xaf66('0x7b'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xaf66('0x3e'),'color'],'where':_0x1d1999[_0xaf66('0x47')][_0xaf66('0x7c')]?{'id':_0x1d1999[_0xaf66('0x47')][_0xaf66('0x7c')]}:undefined,'required':_0x1d1999['query']['tag']?!![]:![]}];}return db[_0xaf66('0x78')]['findAll'](_0x10c537);})[_0xaf66('0x23')](function(_0x274267){_0x39d63a[_0xaf66('0x5c')]=_0x274267;return _0x39d63a;});}})[_0xaf66('0x23')](respondWithFilteredResult(_0x74ae,_0x10c537))['catch'](handleError(_0x74ae,null));};exports['addApplications']=function(_0x44010f,_0x1c2203){var _0xce2431=_0x44010f[_0xaf66('0x5f')]['id'];var _0x5384e0=_0x44010f[_0xaf66('0x61')];var _0x175fa1=0xc8;var _0x3709cb=null;return db['sequelize'][_0xaf66('0x7d')]({'isolationLevel':db[_0xaf66('0x7e')]['Transaction'][_0xaf66('0x7f')]['READ_COMMITTED']},function(_0xca647e){return db['FaxAccount'][_0xaf66('0x6e')]({'where':{'id':_0xce2431},'transaction':_0xca647e})[_0xaf66('0x23')](function(_0x17a4a3){if(_0x17a4a3){return db[_0xaf66('0x80')][_0xaf66('0x3a')]({'where':{'FaxAccountId':_0xce2431},'transaction':_0xca647e})[_0xaf66('0x23')](function(){var _0x3e0aa3=_['map'](_0x5384e0,function(_0x29363a){_0x29363a[_0xaf66('0x6b')]=_0xce2431;return _0x29363a;});return db[_0xaf66('0x80')]['bulkCreate'](_0x3e0aa3,{'transaction':_0xca647e});});}else{_0x175fa1=0x194;_0x3709cb=[];}});})[_0xaf66('0x23')](function(){if(_0x175fa1!==0x194){return db[_0xaf66('0x80')][_0xaf66('0x81')]({'where':{'FaxAccountId':_0xce2431},'order':_0xaf66('0x82')})[_0xaf66('0x23')](function(_0x5c96b1){_0x3709cb=_0x5c96b1;});}})[_0xaf66('0x5d')](function(_0x143958){_0x175fa1=0x1f4;logger['error'](_0x143958[_0xaf66('0x83')]);if(_0x143958[_0xaf66('0x3e')]){delete _0x143958[_0xaf66('0x3e')];}_0x3709cb=_0x143958;})[_0xaf66('0x84')](function(){if(_0x3709cb===null){_0x1c2203[_0xaf66('0x2e')](_0x175fa1);}else{if(_0x175fa1===0x1f4){_0x1c2203[_0xaf66('0x2f')](_0x175fa1)['send'](_0x3709cb);}else{_0x1c2203['status'](_0x175fa1)[_0xaf66('0x31')](_0x3709cb);}}});};exports[_0xaf66('0x85')]=function(_0x1b5166,_0x44749d,_0x58d82c){var _0x5cc6be={};var _0x1e6c87={};var _0x526faf;var _0x192f9a;return db[_0xaf66('0x42')][_0xaf66('0x6e')]({'where':{'id':_0x1b5166[_0xaf66('0x5f')]['id']}})['then'](handleEntityNotFound(_0x44749d,null))[_0xaf66('0x23')](function(_0xf27103){if(_0xf27103){_0x526faf=_0xf27103;_0x1e6c87[_0xaf66('0x45')]=_[_0xaf66('0x48')](db['FaxApplication'][_0xaf66('0x43')]);_0x1e6c87[_0xaf66('0x47')]=_[_0xaf66('0x48')](_0x1b5166[_0xaf66('0x47')]);_0x1e6c87[_0xaf66('0x49')]=_['intersection'](_0x1e6c87[_0xaf66('0x45')],_0x1e6c87[_0xaf66('0x47')]);_0x5cc6be[_0xaf66('0x4b')]=_[_0xaf66('0x4a')](_0x1e6c87[_0xaf66('0x45')],qs[_0xaf66('0x4c')](_0x1b5166['query'][_0xaf66('0x4c')]));_0x5cc6be[_0xaf66('0x4b')]=_0x5cc6be[_0xaf66('0x4b')]['length']?_0x5cc6be[_0xaf66('0x4b')]:_0x1e6c87[_0xaf66('0x45')];_0x5cc6be[_0xaf66('0x75')]=qs['sort'](_0x1b5166[_0xaf66('0x47')][_0xaf66('0x50')]);_0x5cc6be[_0xaf66('0x51')]=qs[_0xaf66('0x49')](_['pick'](_0x1b5166[_0xaf66('0x47')],_0x1e6c87[_0xaf66('0x49')]));if(_0x1b5166['query'][_0xaf66('0x53')]){_0x5cc6be[_0xaf66('0x51')]=_[_0xaf66('0x54')](_0x5cc6be['where'],{'$or':_[_0xaf66('0x46')](_0x5cc6be[_0xaf66('0x4b')],function(_0x4717e0){var _0x503f9f={};_0x503f9f[_0x4717e0]={'$like':'%'+_0x1b5166[_0xaf66('0x47')]['filter']+'%'};return _0x503f9f;})});}_0x5cc6be=_[_0xaf66('0x54')]({},_0x5cc6be,_0x1b5166[_0xaf66('0x57')]);return _0x526faf['getApplications'](_0x5cc6be);}})['then'](function(_0x22b3a8){if(_0x22b3a8){_0x192f9a=_0x22b3a8['length'];if(!_0x1b5166['query'][_0xaf66('0x4e')](_0xaf66('0x6f'))){_0x5cc6be[_0xaf66('0x4f')]=qs[_0xaf66('0x4f')](_0x1b5166['query'][_0xaf66('0x4f')]);_0x5cc6be['offset']=qs[_0xaf66('0x32')](_0x1b5166[_0xaf66('0x47')]['offset']);}return _0x526faf[_0xaf66('0x85')](_0x5cc6be);}})['then'](function(_0x2c6231){if(_0x2c6231){return _0x2c6231?{'count':_0x192f9a,'rows':_0x2c6231}:null;}})[_0xaf66('0x23')](respondWithResult(_0x44749d,null))[_0xaf66('0x5d')](handleError(_0x44749d,null));};function Extension(_0x1f3e46,_0x156f5b,_0x69336b,_0x3e52a7){this[_0xaf66('0x86')]=_0xaf66('0x87');this[_0xaf66('0x88')]=_0x1f3e46[_0xaf66('0x89')];this['app']=_0x3e52a7;this['type']=_0xaf66('0x8a');this[_0xaf66('0x8b')]=_0xaf66('0x8c');this[_0xaf66('0x6b')]=_0x1f3e46['id'];this['priority']=_0x156f5b;this['appdata']=_0x69336b;}function createExtensionsReciveFax(_0xbaa0c8){var _0x49b200=0x1;var _0x48256e=[];_0x48256e[_0xaf66('0x8d')](new Extension(_0xbaa0c8,_0x49b200,'','Answer'));_0x49b200+=0x1;_0x48256e['push'](new Extension(_0xbaa0c8,_0x49b200,_0xaf66('0x8e'),_0xaf66('0x8f')));_0x49b200+=0x1;for(var _0x568a62 in _0xbaa0c8){if(_0xbaa0c8[_0xaf66('0x4e')](_0x568a62)&&(_0x568a62==='ecm'||_0x568a62==='localstationid'||_0x568a62===_0xaf66('0x90')||_0x568a62==='faxdetect'||_0x568a62==='headerinfo'||_0x568a62==='maxrate'||_0x568a62===_0xaf66('0x91')||_0x568a62===_0xaf66('0x92')||_0x568a62===_0xaf66('0x93'))){_0x48256e[_0xaf66('0x8d')](new Extension(_0xbaa0c8,_0x49b200,_0xaf66('0x94')+_0x568a62+')='+_0xbaa0c8[_0x568a62],_0xaf66('0x8f')));_0x49b200+=0x1;}}_0x48256e['push'](new Extension(_0xbaa0c8,_0x49b200,'6',_0xaf66('0x95')));_0x49b200+=0x1;_0x48256e[_0xaf66('0x8d')](new Extension(_0xbaa0c8,_0x49b200,_0xaf66('0x96'),_0xaf66('0x97')));_0x49b200=0x0;return _0x48256e;}exports['addAccountApplications']=function(_0x1c48b9,_0x2e0551,_0x50cb18){var _0x727b7a;return db[_0xaf66('0x7e')][_0xaf66('0x7d')](function(_0x56cae7){return db[_0xaf66('0x42')][_0xaf66('0x60')](_0x1c48b9[_0xaf66('0x61')],{'transaction':_0x56cae7})['then'](function(_0xa611b9){_0x727b7a=_0xa611b9[_0xaf66('0x3b')]({'plain':!![]});return db[_0xaf66('0x98')][_0xaf66('0x99')](createExtensionsReciveFax(_0x727b7a),{'transaction':_0x56cae7});});})[_0xaf66('0x23')](function(){return _0x727b7a;})['then'](respondWithResult(_0x2e0551,null))[_0xaf66('0x5d')](handleError(_0x2e0551,null));};exports[_0xaf66('0x9a')]=function(_0x229253,_0x3125c3,_0x3dfe28){var _0x2c6836;return db[_0xaf66('0x7e')][_0xaf66('0x7d')](function(_0x5b03ed){return db[_0xaf66('0x42')]['update'](_0x229253[_0xaf66('0x61')],{'where':{'id':_0x229253['body']['id']},'transaction':_0x5b03ed})[_0xaf66('0x23')](function(_0x27aeea){return db[_0xaf66('0x98')][_0xaf66('0x3a')]({'where':{'FaxAccountId':_0x229253[_0xaf66('0x61')]['id']},'transaction':_0x5b03ed})[_0xaf66('0x23')](function(_0x1704c7){return db[_0xaf66('0x98')][_0xaf66('0x99')](createExtensionsReciveFax(_[_0xaf66('0x79')](_0x229253[_0xaf66('0x61')],['tech',_0xaf66('0x9b'),_0xaf66('0x9c'),_0xaf66('0x9d'),_0xaf66('0x9e'),'ListId'])),{'transaction':_0x5b03ed});});});})[_0xaf66('0x23')](function(){return db['FaxAccount'][_0xaf66('0x9f')](_0x229253[_0xaf66('0x61')]['id']);})[_0xaf66('0x23')](respondWithResult(_0x3125c3,null))[_0xaf66('0x5d')](handleError(_0x3125c3,null));};exports[_0xaf66('0xa0')]=function(_0xdc645b,_0x4f6205,_0x55ae2c){var _0x4cefe5={'raw':!![],'where':{}};var _0x42cbcd={};var _0x1d407c={'count':0x0,'rows':[]};return db[_0xaf66('0x42')][_0xaf66('0x6e')]({'where':{'id':_0xdc645b[_0xaf66('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4f6205,null))[_0xaf66('0x23')](function(_0x1ba6b0){if(_0x1ba6b0){_0x42cbcd['model']=_[_0xaf66('0x48')](db[_0xaf66('0xa1')][_0xaf66('0x43')]);_0x42cbcd['query']=_[_0xaf66('0x48')](_0xdc645b[_0xaf66('0x47')]);_0x42cbcd[_0xaf66('0x49')]=_[_0xaf66('0x4a')](_0x42cbcd[_0xaf66('0x45')],_0x42cbcd['query']);_0x4cefe5[_0xaf66('0x4b')]=_[_0xaf66('0x4a')](_0x42cbcd[_0xaf66('0x45')],qs[_0xaf66('0x4c')](_0xdc645b['query'][_0xaf66('0x4c')]));_0x4cefe5[_0xaf66('0x4b')]=_0x4cefe5[_0xaf66('0x4b')]['length']?_0x4cefe5[_0xaf66('0x4b')]:_0x42cbcd[_0xaf66('0x45')];if(!_0xdc645b[_0xaf66('0x47')][_0xaf66('0x4e')](_0xaf66('0x6f'))){_0x4cefe5[_0xaf66('0x4f')]=qs[_0xaf66('0x4f')](_0xdc645b[_0xaf66('0x47')]['limit']);_0x4cefe5['offset']=qs['offset'](_0xdc645b[_0xaf66('0x47')][_0xaf66('0x32')]);}_0x4cefe5['order']=qs['sort'](_0xdc645b[_0xaf66('0x47')][_0xaf66('0x50')]);_0x4cefe5[_0xaf66('0x51')]=qs[_0xaf66('0x49')](_[_0xaf66('0x52')](_0xdc645b['query'],_0x42cbcd[_0xaf66('0x49')]));_0x4cefe5[_0xaf66('0x51')][_0xaf66('0x6b')]=_0x1ba6b0['id'];if(_0xdc645b['query'][_0xaf66('0x53')]){_0x4cefe5[_0xaf66('0x51')]=_[_0xaf66('0x54')](_0x4cefe5[_0xaf66('0x51')],{'$or':_[_0xaf66('0x46')](_0x4cefe5['attributes'],function(_0x277af4){var _0x5efd1e={};_0x5efd1e[_0x277af4]={'$like':'%'+_0xdc645b['query']['filter']+'%'};return _0x5efd1e;})});}if(_0xdc645b[_0xaf66('0x47')]['$gte']){var _0x32673e=_0xdc645b[_0xaf66('0x47')]['$gte']['split'](',');var _0x57291a={};_0x57291a[_0x32673e[0x0]]={'$gte':moment(_0x32673e[0x1])[_0xaf66('0xa2')](_0xaf66('0xa3'))};_0x4cefe5[_0xaf66('0x51')]=_[_0xaf66('0x54')](_0x4cefe5[_0xaf66('0x51')],_0x57291a);}_0x4cefe5=_[_0xaf66('0x54')]({},_0x4cefe5,_0xdc645b[_0xaf66('0x57')]);return db[_0xaf66('0xa1')][_0xaf66('0x58')]({'where':_0x4cefe5[_0xaf66('0x51')]})['then'](function(_0x5cf25f){_0x1d407c['count']=_0x5cf25f;if(_0xdc645b[_0xaf66('0x47')][_0xaf66('0x59')]){_0x4cefe5[_0xaf66('0x5a')]=[{'all':!![]}];}return db[_0xaf66('0xa1')][_0xaf66('0x5b')](_0x4cefe5);})['then'](function(_0x1d834f){_0x1d407c[_0xaf66('0x5c')]=_0x1d834f;return _0x1d407c;});}})[_0xaf66('0x23')](respondWithFilteredResult(_0x4f6205,_0x4cefe5))['catch'](handleError(_0x4f6205,null));};exports[_0xaf66('0x3f')]=function(_0x3328e6,_0x5b3587,_0x229e74){var _0x54f412,_0x1242f0={},_0x412c85;if(_0x3328e6[_0xaf66('0x61')]['to']){_0x412c85=_0x3328e6[_0xaf66('0x61')]['to'][0x0];}return db[_0xaf66('0x42')][_0xaf66('0x65')]({'where':{'id':_0x3328e6['params']['id']},'include':[{'model':db[_0xaf66('0xa4')],'as':_0xaf66('0xa5'),'include':[{'model':db[_0xaf66('0x7a')],'as':_0xaf66('0xa6'),'where':{'fax':_0x412c85},'limit':0x1,'order':[['updatedAt',_0xaf66('0xa7')]]}]}]})[_0xaf66('0x23')](handleEntityNotFound(_0x5b3587,null))[_0xaf66('0x23')](function(_0x430b06){_0x54f412=_0x430b06;if(_0x3328e6[_0xaf66('0x61')][_0xaf66('0xa8')]&&_0x3328e6['body'][_0xaf66('0xa8')][_0xaf66('0x4d')]){for(var _0x4d1ad6=0x0;_0x4d1ad6<_0x3328e6['body'][_0xaf66('0xa8')][_0xaf66('0x4d')];_0x4d1ad6+=0x1){_0x3328e6['body']['attachments'][_0x4d1ad6]={'filename':_0x3328e6[_0xaf66('0x61')][_0xaf66('0xa8')][_0x4d1ad6]['name'],'id':_0x3328e6[_0xaf66('0x61')][_0xaf66('0xa8')][_0x4d1ad6]['id'],'path':path[_0xaf66('0xa9')](config['root'],_0xaf66('0xaa'),_0x3328e6['body'][_0xaf66('0xa8')][_0x4d1ad6][_0xaf66('0xab')])};}}return respondWithRpcPromise(_0xaf66('0xac'),'CheckAfterSend',{'FaxAccountId':_[_0xaf66('0xad')](_0x3328e6[_0xaf66('0x5f')]['id'])?undefined:_0x3328e6['params']['id'],'path':_['isNil'](_0x3328e6['body']['attachments'][0x0][_0xaf66('0xae')])?undefined:_0x3328e6['body']['attachments'][0x0]['path'],'fax':_['isNil'](_0x3328e6[_0xaf66('0x61')]['to'][0x0])?undefined:_0x3328e6[_0xaf66('0x61')]['to'][0x0]},client9002);})['then'](function(){if(_0x54f412){if(_['isNil'](_0x3328e6['body']['from'])){_0x3328e6[_0xaf66('0x61')][_0xaf66('0xaf')]=util[_0xaf66('0xa2')]('\x22%s\x22\x20<%s>',_0x54f412['name'],_0x54f412[_0xaf66('0xb0')]);}if(_0x54f412[_0xaf66('0xa5')]){if(_0x54f412[_0xaf66('0xa5')][_0xaf66('0xa6')]['length']){return _0x54f412['List'][_0xaf66('0xa6')][0x0];}else{return db[_0xaf66('0x7a')][_0xaf66('0x60')](_[_0xaf66('0x1b')](_0x3328e6[_0xaf66('0x61')],{'firstName':_0x3328e6[_0xaf66('0x61')]['to'][0x0],'phone':_0x3328e6['body']['to'][0x0],'fax':_0x3328e6['body']['to'][0x0],'ListId':_0x54f412[_0xaf66('0xb1')]}));}}else{throw new Error(_0xaf66('0xb2'));}}else{throw new Error(_0xaf66('0xb3'));}})['then'](function(_0x4bf4f2){if(_0x4bf4f2){return db[_0xaf66('0x78')]['find']({'where':{'ContactId':_0x4bf4f2['id'],'closed':![],'FaxAccountId':_0x54f412['id']}})[_0xaf66('0x23')](function(_0x561f60){if(_0x561f60){return[_0x561f60,![]];}return db['FaxInteraction'][_0xaf66('0x60')]({'UserId':_0x3328e6[_0xaf66('0x62')]['id'],'ContactId':_0x4bf4f2['id'],'FaxAccountId':_0x54f412['id'],'fax':_0x3328e6[_0xaf66('0x61')]['to'][0x0],'firstMsgDirection':_0xaf66('0xb4'),'Messages':[_[_0xaf66('0x54')](_0x3328e6['body'],{'read':![],'body':_0x3328e6[_0xaf66('0x61')]['attachments'][0x0][_0xaf66('0xb5')],'FaxAccountId':_0x54f412['id'],'UserId':_0x3328e6[_0xaf66('0x62')]['id'],'ContactId':_0x4bf4f2['id'],'AttachmentId':_0x3328e6[_0xaf66('0x61')][_0xaf66('0xa8')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xaf66('0xb6')}]})[_0xaf66('0x23')](function(_0x52369a){return[_0x52369a,!![]];});});}else{throw new Error(_0xaf66('0xb7'));}})[_0xaf66('0xb8')](function(_0x3a7cc6,_0x2067b8){if(_0x2067b8){return _0x3a7cc6;}return db[_0xaf66('0xa1')][_0xaf66('0x60')]({'direction':_0xaf66('0xb4'),'read':![],'body':_0x3328e6['body']['attachments'][0x0][_0xaf66('0xb5')],'FaxAccountId':_0x54f412['id'],'FaxInteractionId':_0x3a7cc6['id'],'UserId':_0x3328e6[_0xaf66('0x62')]['id'],'ContactId':_0x3a7cc6[_0xaf66('0xb9')],'AttachmentId':_0x3328e6[_0xaf66('0x61')][_0xaf66('0xa8')][0x0]['id']})[_0xaf66('0x23')](function(_0x57c33d){_0x3a7cc6[_0xaf66('0xba')][_0xaf66('0xb6')]=[];_0x3a7cc6['dataValues'][_0xaf66('0xb6')][_0xaf66('0x8d')](_0x57c33d['dataValues']);return _0x3a7cc6;});})['then'](function(_0x398762){respondWithRpcPromise(_0xaf66('0xbb'),_0xaf66('0xbb'),{'FaxAccountId':_[_0xaf66('0xad')](_0x3328e6['params']['id'])?undefined:_0x3328e6[_0xaf66('0x5f')]['id'],'path':_[_0xaf66('0xad')](_0x3328e6[_0xaf66('0x61')][_0xaf66('0xa8')][0x0][_0xaf66('0xae')])?undefined:_0x3328e6[_0xaf66('0x61')]['attachments'][0x0][_0xaf66('0xae')],'fax':_[_0xaf66('0xad')](_0x3328e6['body']['to'][0x0])?undefined:_0x3328e6[_0xaf66('0x61')]['to'][0x0],'AttachmentId':_0x3328e6[_0xaf66('0x61')][_0xaf66('0xa8')][0x0]['id']},client9002)[_0xaf66('0x23')](function(_0x1d0656){logger[_0xaf66('0x2c')](_0xaf66('0xbc'),_0x1d0656);})[_0xaf66('0x5d')](function(_0x2b8a8c){logger[_0xaf66('0x2c')]('SendFaxRpc,\x20%s',_0x2b8a8c);});return _0x398762;})[_0xaf66('0x23')](respondWithResult(_0x5b3587,null))['catch'](handleError(_0x5b3587,null));};exports[_0xaf66('0xbd')]=function(_0x398624,_0x1093cd,_0x2ce65e){return db[_0xaf66('0x42')][_0xaf66('0x65')]({'where':{'id':_0x398624[_0xaf66('0x5f')]['id']}})[_0xaf66('0x23')](handleEntityNotFound(_0x1093cd,null))['then'](function(_0x4345ba){if(_0x4345ba){return _0x4345ba[_0xaf66('0xbd')](_0x398624['body'][_0xaf66('0x71')],_['omit'](_0x398624[_0xaf66('0x61')],[_0xaf66('0x71'),'id'])||{})['spread'](function(_0x51f87c){for(var _0x28ce96=0x0;_0x28ce96<_0x398624[_0xaf66('0x61')][_0xaf66('0x71')][_0xaf66('0x4d')];_0x28ce96+=0x1){socket[_0xaf66('0xbe')](_0xaf66('0xbf'),{'UserId':Number(_0x398624[_0xaf66('0x61')]['ids'][_0x28ce96]),'FaxAccountId':Number(_0x398624['params']['id'])});}return _0x51f87c;});}})['then'](respondWithResult(_0x1093cd,null))['catch'](handleError(_0x1093cd,null));};exports[_0xaf66('0xc0')]=function(_0x1a8cde,_0x2a4bb2,_0x4640f3){return db[_0xaf66('0x42')][_0xaf66('0x65')]({'where':{'id':_0x1a8cde[_0xaf66('0x5f')]['id']}})[_0xaf66('0x23')](handleEntityNotFound(_0x2a4bb2,null))[_0xaf66('0x23')](function(_0x3738eb){if(_0x3738eb){return _0x3738eb[_0xaf66('0xc0')](_0x1a8cde['query'][_0xaf66('0x71')])[_0xaf66('0x23')](function(){if(_[_0xaf66('0xc1')](_0x1a8cde[_0xaf66('0x47')]['ids'])){for(var _0x57c0e3=0x0;_0x57c0e3<_0x1a8cde[_0xaf66('0x47')][_0xaf66('0x71')][_0xaf66('0x4d')];_0x57c0e3+=0x1){socket[_0xaf66('0xbe')](_0xaf66('0xc2'),{'UserId':Number(_0x1a8cde['query'][_0xaf66('0x71')][_0x57c0e3]),'FaxAccountId':Number(_0x1a8cde[_0xaf66('0x5f')]['id'])});}}else{socket[_0xaf66('0xbe')](_0xaf66('0xc2'),{'UserId':Number(_0x1a8cde[_0xaf66('0x47')]['ids']),'FaxAccountId':Number(_0x1a8cde[_0xaf66('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a4bb2,null))[_0xaf66('0x5d')](handleError(_0x2a4bb2,null));};exports['getAgents']=function(_0x3d7058,_0x397b88,_0x9c5407){var _0x32d41d={};var _0x455a42={};var _0xb02f8d;var _0x1cd29e;return db['FaxAccount'][_0xaf66('0x6e')]({'where':{'id':_0x3d7058['params']['id']}})[_0xaf66('0x23')](handleEntityNotFound(_0x397b88,null))[_0xaf66('0x23')](function(_0x208015){if(_0x208015){_0xb02f8d=_0x208015;_0x455a42[_0xaf66('0x45')]=_[_0xaf66('0x48')](db[_0xaf66('0xc3')][_0xaf66('0x43')]);_0x455a42[_0xaf66('0x47')]=_[_0xaf66('0x48')](_0x3d7058['query']);_0x455a42[_0xaf66('0x49')]=_[_0xaf66('0x4a')](_0x455a42[_0xaf66('0x45')],_0x455a42[_0xaf66('0x47')]);_0x32d41d[_0xaf66('0x4b')]=_['intersection'](_0x455a42[_0xaf66('0x45')],qs[_0xaf66('0x4c')](_0x3d7058[_0xaf66('0x47')][_0xaf66('0x4c')]));_0x32d41d['attributes']=_0x32d41d[_0xaf66('0x4b')][_0xaf66('0x4d')]?_0x32d41d[_0xaf66('0x4b')]:_0x455a42[_0xaf66('0x45')];_0x32d41d[_0xaf66('0x75')]=qs[_0xaf66('0x50')](_0x3d7058[_0xaf66('0x47')][_0xaf66('0x50')]);_0x32d41d[_0xaf66('0x51')]=qs['filters'](_[_0xaf66('0x52')](_0x3d7058[_0xaf66('0x47')],_0x455a42[_0xaf66('0x49')]));if(_0x3d7058['query'][_0xaf66('0x53')]){_0x32d41d[_0xaf66('0x51')]=_[_0xaf66('0x54')](_0x32d41d[_0xaf66('0x51')],{'$or':_['map'](_0x32d41d[_0xaf66('0x4b')],function(_0x1d66db){var _0x477cee={};_0x477cee[_0x1d66db]={'$like':'%'+_0x3d7058[_0xaf66('0x47')][_0xaf66('0x53')]+'%'};return _0x477cee;})});}_0x32d41d=_[_0xaf66('0x54')]({},_0x32d41d,_0x3d7058['options']);return _0xb02f8d['getAgents'](_0x32d41d);}})[_0xaf66('0x23')](function(_0x2417ef){if(_0x2417ef){_0x1cd29e=_0x2417ef[_0xaf66('0x4d')];if(!_0x3d7058['query']['hasOwnProperty']('nolimit')){_0x32d41d[_0xaf66('0x4f')]=qs['limit'](_0x3d7058['query']['limit']);_0x32d41d[_0xaf66('0x32')]=qs[_0xaf66('0x32')](_0x3d7058[_0xaf66('0x47')][_0xaf66('0x32')]);}return _0xb02f8d[_0xaf66('0xc4')](_0x32d41d);}})[_0xaf66('0x23')](function(_0x3e0124){if(_0x3e0124){return _0x3e0124?{'count':_0x1cd29e,'rows':_0x3e0124}:null;}})['then'](respondWithResult(_0x397b88,null))[_0xaf66('0x5d')](handleError(_0x397b88,null));}; \ No newline at end of file +var _0x3f6a=['ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','context','from-voip-provider','localstationid','app','system','description','Fax\x20Extension','Answer','ecm','gateway','faxdetect','headerinfo','minrate','modem','t38timeout','FAXOPT(','Set','push','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','updateAccountApplications','tech','key','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','CmList','List','Contacts','updatedAt','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','defaults','List\x20not\x20found','out','filename','Messages','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','get','FaxAccounts','destroy','end','name','send','index','Pause','map','FaxAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','Disposition','getDispositions','findOne','FaxAccountId','include','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0x3f6a,0x1d2));var _0xa3f6=function(_0x1657b6,_0x5b8def){_0x1657b6=_0x1657b6-0x0;var _0x2fdb3c=_0x3f6a[_0x1657b6];return _0x2fdb3c;};'use strict';var emlformat=require(_0xa3f6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa3f6('0x1'));var rp=require('request-promise');var moment=require(_0xa3f6('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa3f6('0x3'));var util=require(_0xa3f6('0x4'));var path=require(_0xa3f6('0x5'));var sox=require('sox');var csv=require(_0xa3f6('0x6'));var ejs=require(_0xa3f6('0x7'));var fs=require('fs');var fs_extra=require(_0xa3f6('0x8'));var _=require(_0xa3f6('0x9'));var squel=require('squel');var crypto=require(_0xa3f6('0xa'));var jsforce=require(_0xa3f6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa3f6('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa3f6('0xc'));var authService=require(_0xa3f6('0xd'));var qs=require(_0xa3f6('0xe'));var as=require(_0xa3f6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3f6('0x10'))(_0xa3f6('0x11'));var utils=require(_0xa3f6('0x12'));var config=require(_0xa3f6('0x13'));var licenseUtil=require(_0xa3f6('0x14'));var db=require(_0xa3f6('0x15'))['db'];config[_0xa3f6('0x16')]=_['defaults'](config[_0xa3f6('0x16')],{'host':_0xa3f6('0x17'),'port':0x18eb});var socket=require(_0xa3f6('0x18'))(new Redis(config[_0xa3f6('0x16')]));require(_0xa3f6('0x19'))['register'](socket);var jayson=require(_0xa3f6('0x1a'));var client=jayson[_0xa3f6('0x1b')][_0xa3f6('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xa3f6('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2ffc3f,_0x50949d,_0xbc7305,_0x4a086a){return new BPromise(function(_0x4bc90c,_0x2e4f29){var _0x173532=_0x4a086a||client;return _0x173532['request'](_0x2ffc3f,_0xbc7305)[_0xa3f6('0x1d')](function(_0x5826a7){logger[_0xa3f6('0x1e')]('FaxAccount,\x20%s,\x20%s',_0x50949d,'request\x20sent');logger[_0xa3f6('0x1f')](_0xa3f6('0x20'),_0x50949d,_0xa3f6('0x21'),JSON[_0xa3f6('0x22')](_0x5826a7));if(_0x5826a7[_0xa3f6('0x23')]){if(_0x5826a7['error']['code']===0x1f4){logger[_0xa3f6('0x23')](_0xa3f6('0x24'),_0x50949d,_0x5826a7[_0xa3f6('0x23')][_0xa3f6('0x25')]);return _0x2e4f29(_0x5826a7[_0xa3f6('0x23')]['message']);}logger['error'](_0xa3f6('0x24'),_0x50949d,_0x5826a7[_0xa3f6('0x23')][_0xa3f6('0x25')]);return _0x4bc90c(_0x5826a7[_0xa3f6('0x23')][_0xa3f6('0x25')]);}else{logger[_0xa3f6('0x1e')](_0xa3f6('0x24'),_0x50949d,'request\x20sent');_0x4bc90c(_0x5826a7[_0xa3f6('0x26')][_0xa3f6('0x25')]);}})[_0xa3f6('0x27')](function(_0x20beca){logger[_0xa3f6('0x23')]('FaxAccount,\x20%s,\x20%s',_0x50949d,_0x20beca);_0x2e4f29(_0x20beca);});});}function respondWithStatusCode(_0x576554,_0x228867){_0x228867=_0x228867||0xcc;return function(_0x4b950b){if(_0x4b950b){return _0x576554[_0xa3f6('0x28')](_0x228867);}return _0x576554[_0xa3f6('0x29')](_0x228867)['end']();};}function respondWithResult(_0xa72792,_0xdc8951){_0xdc8951=_0xdc8951||0xc8;return function(_0x19871b){if(_0x19871b){return _0xa72792[_0xa3f6('0x29')](_0xdc8951)[_0xa3f6('0x2a')](_0x19871b);}};}function respondWithFilteredResult(_0x5d45d0,_0x45edbc){return function(_0x467605){if(_0x467605){var _0x244a3e=typeof _0x45edbc[_0xa3f6('0x2b')]==='undefined'&&typeof _0x45edbc[_0xa3f6('0x2c')]===_0xa3f6('0x2d');var _0x4957b4=_0x467605['count'];var _0x4a2c61=_0x244a3e?0x0:_0x45edbc[_0xa3f6('0x2b')];var _0x2ffd66=_0x244a3e?_0x467605[_0xa3f6('0x2e')]:_0x45edbc[_0xa3f6('0x2b')]+_0x45edbc['limit'];var _0x264f53;if(_0x2ffd66>=_0x4957b4){_0x2ffd66=_0x4957b4;_0x264f53=0xc8;}else{_0x264f53=0xce;}_0x5d45d0[_0xa3f6('0x29')](_0x264f53);return _0x5d45d0[_0xa3f6('0x2f')](_0xa3f6('0x30'),_0x4a2c61+'-'+_0x2ffd66+'/'+_0x4957b4)['json'](_0x467605);}return null;};}function patchUpdates(_0x5a4b28){return function(_0x32c00f){try{jsonpatch[_0xa3f6('0x31')](_0x32c00f,_0x5a4b28,!![]);}catch(_0x7c8749){return BPromise[_0xa3f6('0x32')](_0x7c8749);}return _0x32c00f[_0xa3f6('0x33')]();};}function saveUpdates(_0x304051,_0x2cee77){return function(_0x431ec4){if(_0x431ec4){return _0x431ec4[_0xa3f6('0x34')](_0x304051)['then'](function(_0x1a6834){return _0x1a6834;});}return null;};}function removeEntity(_0x25b605,_0x30c0ea){return function(_0x58a026){if(_0x58a026){return _0x58a026['destroy']()[_0xa3f6('0x1d')](function(){var _0x24553a=_0x58a026[_0xa3f6('0x35')]({'plain':!![]});var _0x599cc8=_0xa3f6('0x36');return db['UserProfileResource'][_0xa3f6('0x37')]({'where':{'type':_0x599cc8,'resourceId':_0x24553a['id']}})[_0xa3f6('0x1d')](function(){return _0x58a026;});})['then'](function(){_0x25b605['status'](0xcc)[_0xa3f6('0x38')]();});}};}function handleEntityNotFound(_0x484aa1,_0x2a9398){return function(_0xb16970){if(!_0xb16970){_0x484aa1[_0xa3f6('0x28')](0x194);}return _0xb16970;};}function handleError(_0x2685d9,_0x10dca4){_0x10dca4=_0x10dca4||0x1f4;return function(_0x34671b){logger[_0xa3f6('0x23')](_0x34671b['stack']);if(_0x34671b[_0xa3f6('0x39')]){delete _0x34671b[_0xa3f6('0x39')];}_0x2685d9[_0xa3f6('0x29')](_0x10dca4)[_0xa3f6('0x3a')](_0x34671b);};}exports[_0xa3f6('0x3b')]=function(_0x1733d9,_0x233137){var _0x192104={'include':[{'model':db[_0xa3f6('0x3c')],'as':'mandatoryDispositionPause'}]},_0x1654f8={},_0x59219b={'count':0x0,'rows':[]};var _0x1e92d8=_[_0xa3f6('0x3d')](db[_0xa3f6('0x3e')]['rawAttributes'],function(_0x327d99){return{'name':_0x327d99[_0xa3f6('0x3f')],'type':_0x327d99[_0xa3f6('0x40')]['key']};});_0x1654f8[_0xa3f6('0x41')]=_[_0xa3f6('0x3d')](_0x1e92d8,_0xa3f6('0x39'));_0x1654f8[_0xa3f6('0x42')]=_[_0xa3f6('0x43')](_0x1733d9['query']);_0x1654f8[_0xa3f6('0x44')]=_[_0xa3f6('0x45')](_0x1654f8[_0xa3f6('0x41')],_0x1654f8['query']);_0x192104[_0xa3f6('0x46')]=_[_0xa3f6('0x45')](_0x1654f8[_0xa3f6('0x41')],qs[_0xa3f6('0x47')](_0x1733d9[_0xa3f6('0x42')][_0xa3f6('0x47')]));_0x192104['attributes']=_0x192104[_0xa3f6('0x46')][_0xa3f6('0x48')]?_0x192104[_0xa3f6('0x46')]:_0x1654f8['model'];if(!_0x1733d9[_0xa3f6('0x42')][_0xa3f6('0x49')](_0xa3f6('0x4a'))){_0x192104['limit']=qs[_0xa3f6('0x2c')](_0x1733d9['query'][_0xa3f6('0x2c')]);_0x192104[_0xa3f6('0x2b')]=qs[_0xa3f6('0x2b')](_0x1733d9['query'][_0xa3f6('0x2b')]);}_0x192104[_0xa3f6('0x4b')]=qs[_0xa3f6('0x4c')](_0x1733d9[_0xa3f6('0x42')]['sort']);_0x192104[_0xa3f6('0x4d')]=qs[_0xa3f6('0x44')](_[_0xa3f6('0x4e')](_0x1733d9[_0xa3f6('0x42')],_0x1654f8[_0xa3f6('0x44')]),_0x1e92d8);if(_0x1733d9[_0xa3f6('0x42')][_0xa3f6('0x4f')]){_0x192104[_0xa3f6('0x4d')]=_[_0xa3f6('0x50')](_0x192104[_0xa3f6('0x4d')],{'$or':_[_0xa3f6('0x3d')](_0x1e92d8,function(_0x159400){if(_0x159400['type']!==_0xa3f6('0x51')){var _0x41be16={};_0x41be16[_0x159400['name']]={'$like':'%'+_0x1733d9[_0xa3f6('0x42')][_0xa3f6('0x4f')]+'%'};return _0x41be16;}})});}_0x192104=_[_0xa3f6('0x50')]({},_0x192104,_0x1733d9[_0xa3f6('0x52')]);var _0x4a9992={'where':_0x192104[_0xa3f6('0x4d')]};return db[_0xa3f6('0x3e')][_0xa3f6('0x2e')](_0x4a9992)[_0xa3f6('0x1d')](function(_0x51c110){_0x59219b[_0xa3f6('0x2e')]=_0x51c110;if(_0x1733d9[_0xa3f6('0x42')][_0xa3f6('0x53')]){_0x192104['include']=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x192104);})[_0xa3f6('0x1d')](function(_0x5e1406){_0x59219b[_0xa3f6('0x54')]=_0x5e1406;return _0x59219b;})[_0xa3f6('0x1d')](respondWithFilteredResult(_0x233137,_0x192104))[_0xa3f6('0x27')](handleError(_0x233137,null));};exports[_0xa3f6('0x55')]=function(_0x3fca32,_0x406db2){var _0x3b590b={'raw':![],'where':{'id':_0x3fca32['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x176fa3={};_0x176fa3[_0xa3f6('0x41')]=_[_0xa3f6('0x43')](db['FaxAccount'][_0xa3f6('0x56')]);_0x176fa3['query']=_[_0xa3f6('0x43')](_0x3fca32[_0xa3f6('0x42')]);_0x176fa3[_0xa3f6('0x44')]=_[_0xa3f6('0x45')](_0x176fa3[_0xa3f6('0x41')],_0x176fa3[_0xa3f6('0x42')]);_0x3b590b[_0xa3f6('0x46')]=_['intersection'](_0x176fa3[_0xa3f6('0x41')],qs[_0xa3f6('0x47')](_0x3fca32['query'][_0xa3f6('0x47')]));_0x3b590b[_0xa3f6('0x46')]=_0x3b590b['attributes'][_0xa3f6('0x48')]?_0x3b590b[_0xa3f6('0x46')]:_0x176fa3[_0xa3f6('0x41')];if(_0x3fca32['query'][_0xa3f6('0x53')]){_0x3b590b['include']=[{'all':!![]}];}_0x3b590b=_[_0xa3f6('0x50')]({},_0x3b590b,_0x3fca32[_0xa3f6('0x52')]);return db['FaxAccount'][_0xa3f6('0x57')](_0x3b590b)[_0xa3f6('0x1d')](handleEntityNotFound(_0x406db2,null))['then'](respondWithResult(_0x406db2,null))[_0xa3f6('0x27')](handleError(_0x406db2,null));};exports[_0xa3f6('0x58')]=function(_0x4fb1c3,_0x2559a2){return db[_0xa3f6('0x3e')]['create'](_0x4fb1c3[_0xa3f6('0x59')],{})[_0xa3f6('0x1d')](function(_0x3e5a57){var _0x138038=_0x4fb1c3[_0xa3f6('0x5a')][_0xa3f6('0x35')]({'plain':!![]});if(!_0x138038)throw new Error(_0xa3f6('0x5b'));if(_0x138038[_0xa3f6('0x5c')]==='user'){var _0x132a2a=_0x3e5a57[_0xa3f6('0x35')]({'plain':!![]});var _0x3ba4b3='FaxAccounts';return db['UserProfileSection'][_0xa3f6('0x57')]({'where':{'name':_0x3ba4b3,'userProfileId':_0x138038['userProfileId']},'raw':!![]})[_0xa3f6('0x1d')](function(_0x2255f1){if(_0x2255f1&&_0x2255f1[_0xa3f6('0x5d')]===0x0){return db['UserProfileResource'][_0xa3f6('0x58')]({'name':_0x132a2a[_0xa3f6('0x39')],'resourceId':_0x132a2a['id'],'type':_0x2255f1[_0xa3f6('0x39')],'sectionId':_0x2255f1['id']},{})[_0xa3f6('0x1d')](function(){return _0x3e5a57;});}else{return _0x3e5a57;}})['catch'](function(_0x33237a){logger[_0xa3f6('0x23')](_0xa3f6('0x5e'),_0x33237a);throw _0x33237a;});}return _0x3e5a57;})[_0xa3f6('0x1d')](respondWithResult(_0x2559a2,0xc9))[_0xa3f6('0x27')](handleError(_0x2559a2,null));};exports[_0xa3f6('0x34')]=function(_0x109a27,_0x4cd592){if(_0x109a27[_0xa3f6('0x59')]['id']){delete _0x109a27['body']['id'];}return db[_0xa3f6('0x3e')][_0xa3f6('0x57')]({'where':{'id':_0x109a27[_0xa3f6('0x5f')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xa3f6('0x1d')](handleEntityNotFound(_0x4cd592,null))[_0xa3f6('0x1d')](saveUpdates(_0x109a27[_0xa3f6('0x59')],null))[_0xa3f6('0x1d')](respondWithResult(_0x4cd592,null))[_0xa3f6('0x27')](handleError(_0x4cd592,null));};exports[_0xa3f6('0x37')]=function(_0x388cd7,_0x38c1da){return db[_0xa3f6('0x3e')][_0xa3f6('0x57')]({'where':{'id':_0x388cd7[_0xa3f6('0x5f')]['id']}})[_0xa3f6('0x1d')](handleEntityNotFound(_0x38c1da,null))[_0xa3f6('0x1d')](removeEntity(_0x38c1da,null))['catch'](handleError(_0x38c1da,null));};exports[_0xa3f6('0x60')]=function(_0x311922,_0x5b467e){return db[_0xa3f6('0x3e')]['describe']()[_0xa3f6('0x1d')](respondWithResult(_0x5b467e,null))['catch'](handleError(_0x5b467e,null));};exports['addDisposition']=function(_0x52df17,_0x4d9410,_0x2e8a9c){if(_0x52df17[_0xa3f6('0x59')]['id']){delete _0x52df17[_0xa3f6('0x59')]['id'];}return db[_0xa3f6('0x3e')][_0xa3f6('0x57')]({'where':{'id':_0x52df17[_0xa3f6('0x5f')]['id']}})[_0xa3f6('0x1d')](handleEntityNotFound(_0x4d9410,null))[_0xa3f6('0x1d')](function(_0x294c58){if(_0x294c58){_0x52df17[_0xa3f6('0x59')]['FaxAccountId']=_0x294c58['id'];return db[_0xa3f6('0x61')][_0xa3f6('0x58')](_0x52df17['body']);}})[_0xa3f6('0x1d')](respondWithResult(_0x4d9410,null))['catch'](handleError(_0x4d9410,null));};exports[_0xa3f6('0x62')]=function(_0x5a5919,_0x2a1e5a,_0xc6a11d){var _0x46528f={'raw':![],'where':{}};var _0x206e4b={};var _0x3ea3ca={'count':0x0,'rows':[]};return db[_0xa3f6('0x3e')][_0xa3f6('0x63')]({'where':{'id':_0x5a5919[_0xa3f6('0x5f')]['id']}})[_0xa3f6('0x1d')](handleEntityNotFound(_0x2a1e5a,null))[_0xa3f6('0x1d')](function(_0x2250a3){if(_0x2250a3){_0x206e4b['model']=_[_0xa3f6('0x43')](db['Disposition']['rawAttributes']);_0x206e4b['query']=_[_0xa3f6('0x43')](_0x5a5919[_0xa3f6('0x42')]);_0x206e4b[_0xa3f6('0x44')]=_['intersection'](_0x206e4b[_0xa3f6('0x41')],_0x206e4b[_0xa3f6('0x42')]);_0x46528f['attributes']=_[_0xa3f6('0x45')](_0x206e4b[_0xa3f6('0x41')],qs[_0xa3f6('0x47')](_0x5a5919[_0xa3f6('0x42')][_0xa3f6('0x47')]));_0x46528f[_0xa3f6('0x46')]=_0x46528f['attributes'][_0xa3f6('0x48')]?_0x46528f['attributes']:_0x206e4b['model'];if(!_0x5a5919[_0xa3f6('0x42')][_0xa3f6('0x49')](_0xa3f6('0x4a'))){_0x46528f[_0xa3f6('0x2c')]=qs[_0xa3f6('0x2c')](_0x5a5919[_0xa3f6('0x42')]['limit']);_0x46528f[_0xa3f6('0x2b')]=qs[_0xa3f6('0x2b')](_0x5a5919[_0xa3f6('0x42')][_0xa3f6('0x2b')]);}_0x46528f[_0xa3f6('0x4b')]=qs[_0xa3f6('0x4c')](_0x5a5919[_0xa3f6('0x42')][_0xa3f6('0x4c')]);_0x46528f['where']=qs[_0xa3f6('0x44')](_[_0xa3f6('0x4e')](_0x5a5919['query'],_0x206e4b['filters']));_0x46528f[_0xa3f6('0x4d')][_0xa3f6('0x64')]=_0x2250a3['id'];if(_0x5a5919[_0xa3f6('0x42')][_0xa3f6('0x4f')]){_0x46528f[_0xa3f6('0x4d')]=_[_0xa3f6('0x50')](_0x46528f['where'],{'$or':_['map'](_0x46528f[_0xa3f6('0x46')],function(_0x58b270){var _0x38a822={};_0x38a822[_0x58b270]={'$like':'%'+_0x5a5919[_0xa3f6('0x42')][_0xa3f6('0x4f')]+'%'};return _0x38a822;})});}_0x46528f=_['merge']({},_0x46528f,_0x5a5919[_0xa3f6('0x52')]);return db[_0xa3f6('0x61')][_0xa3f6('0x2e')]({'where':_0x46528f[_0xa3f6('0x4d')]})[_0xa3f6('0x1d')](function(_0x1f7599){_0x3ea3ca[_0xa3f6('0x2e')]=_0x1f7599;if(_0x5a5919['query'][_0xa3f6('0x53')]){_0x46528f[_0xa3f6('0x65')]=[{'all':!![]}];}return db[_0xa3f6('0x61')][_0xa3f6('0x66')](_0x46528f);})[_0xa3f6('0x1d')](function(_0x5891fe){_0x3ea3ca[_0xa3f6('0x54')]=_0x5891fe;return _0x3ea3ca;});}})[_0xa3f6('0x1d')](respondWithFilteredResult(_0x2a1e5a,_0x46528f))['catch'](handleError(_0x2a1e5a,null));};exports[_0xa3f6('0x67')]=function(_0x48587e,_0x1c7cc9,_0x403557){return db['FaxAccount'][_0xa3f6('0x57')]({'where':{'id':_0x48587e['params']['id']}})['then'](handleEntityNotFound(_0x1c7cc9,null))[_0xa3f6('0x1d')](function(_0x1554bd){if(_0x1554bd){return _0x1554bd['removeDispositions'](_0x48587e[_0xa3f6('0x42')][_0xa3f6('0x68')]);}})['then'](respondWithStatusCode(_0x1c7cc9,null))['catch'](handleError(_0x1c7cc9,null));};exports[_0xa3f6('0x69')]=function(_0x9ce079,_0x5cc8eb,_0x1faf92){if(_0x9ce079[_0xa3f6('0x59')]['id']){delete _0x9ce079[_0xa3f6('0x59')]['id'];}return db['FaxAccount'][_0xa3f6('0x57')]({'where':{'id':_0x9ce079[_0xa3f6('0x5f')]['id']}})[_0xa3f6('0x1d')](handleEntityNotFound(_0x5cc8eb,null))[_0xa3f6('0x1d')](function(_0x175811){if(_0x175811){_0x9ce079['body'][_0xa3f6('0x64')]=_0x175811['id'];return db['CannedAnswer'][_0xa3f6('0x58')](_0x9ce079[_0xa3f6('0x59')]);}})[_0xa3f6('0x1d')](respondWithResult(_0x5cc8eb,null))[_0xa3f6('0x27')](handleError(_0x5cc8eb,null));};exports[_0xa3f6('0x6a')]=function(_0x8e8d7a,_0x5f3d4f,_0x2344b4){var _0x5c9d3e={'raw':![],'where':{}};var _0x441606={};var _0x2b2260={'count':0x0,'rows':[]};return db[_0xa3f6('0x3e')][_0xa3f6('0x63')]({'where':{'id':_0x8e8d7a[_0xa3f6('0x5f')]['id']}})[_0xa3f6('0x1d')](handleEntityNotFound(_0x5f3d4f,null))['then'](function(_0x2b2dbd){if(_0x2b2dbd){_0x441606['model']=_[_0xa3f6('0x43')](db[_0xa3f6('0x6b')][_0xa3f6('0x56')]);_0x441606[_0xa3f6('0x42')]=_['keys'](_0x8e8d7a[_0xa3f6('0x42')]);_0x441606[_0xa3f6('0x44')]=_[_0xa3f6('0x45')](_0x441606['model'],_0x441606[_0xa3f6('0x42')]);_0x5c9d3e[_0xa3f6('0x46')]=_[_0xa3f6('0x45')](_0x441606['model'],qs[_0xa3f6('0x47')](_0x8e8d7a[_0xa3f6('0x42')][_0xa3f6('0x47')]));_0x5c9d3e[_0xa3f6('0x46')]=_0x5c9d3e[_0xa3f6('0x46')][_0xa3f6('0x48')]?_0x5c9d3e[_0xa3f6('0x46')]:_0x441606[_0xa3f6('0x41')];if(!_0x8e8d7a['query'][_0xa3f6('0x49')](_0xa3f6('0x4a'))){_0x5c9d3e['limit']=qs[_0xa3f6('0x2c')](_0x8e8d7a[_0xa3f6('0x42')][_0xa3f6('0x2c')]);_0x5c9d3e[_0xa3f6('0x2b')]=qs[_0xa3f6('0x2b')](_0x8e8d7a['query'][_0xa3f6('0x2b')]);}_0x5c9d3e['order']=qs['sort'](_0x8e8d7a[_0xa3f6('0x42')][_0xa3f6('0x4c')]);_0x5c9d3e[_0xa3f6('0x4d')]=qs[_0xa3f6('0x44')](_[_0xa3f6('0x4e')](_0x8e8d7a[_0xa3f6('0x42')],_0x441606[_0xa3f6('0x44')]));_0x5c9d3e[_0xa3f6('0x4d')]['FaxAccountId']=_0x2b2dbd['id'];if(_0x8e8d7a['query'][_0xa3f6('0x4f')]){_0x5c9d3e['where']=_['merge'](_0x5c9d3e[_0xa3f6('0x4d')],{'$or':_[_0xa3f6('0x3d')](_0x5c9d3e['attributes'],function(_0x209efa){var _0x40abe3={};_0x40abe3[_0x209efa]={'$like':'%'+_0x8e8d7a[_0xa3f6('0x42')][_0xa3f6('0x4f')]+'%'};return _0x40abe3;})});}_0x5c9d3e=_[_0xa3f6('0x50')]({},_0x5c9d3e,_0x8e8d7a[_0xa3f6('0x52')]);return db[_0xa3f6('0x6b')]['count']({'where':_0x5c9d3e[_0xa3f6('0x4d')]})[_0xa3f6('0x1d')](function(_0x5060f6){_0x2b2260[_0xa3f6('0x2e')]=_0x5060f6;if(_0x8e8d7a[_0xa3f6('0x42')][_0xa3f6('0x53')]){_0x5c9d3e['include']=[{'all':!![]}];}return db[_0xa3f6('0x6b')]['findAll'](_0x5c9d3e);})[_0xa3f6('0x1d')](function(_0x988ac9){_0x2b2260['rows']=_0x988ac9;return _0x2b2260;});}})['then'](respondWithFilteredResult(_0x5f3d4f,_0x5c9d3e))[_0xa3f6('0x27')](handleError(_0x5f3d4f,null));};exports[_0xa3f6('0x6c')]=function(_0x48bc09,_0xd0c3ba,_0x4b44b3){return db['FaxAccount'][_0xa3f6('0x57')]({'where':{'id':_0x48bc09[_0xa3f6('0x5f')]['id']}})[_0xa3f6('0x1d')](handleEntityNotFound(_0xd0c3ba,null))[_0xa3f6('0x1d')](function(_0x1b25e3){if(_0x1b25e3){return _0x1b25e3['removeAnswers'](_0x48bc09[_0xa3f6('0x42')][_0xa3f6('0x68')]);}})[_0xa3f6('0x1d')](respondWithStatusCode(_0xd0c3ba,null))[_0xa3f6('0x27')](handleError(_0xd0c3ba,null));};exports[_0xa3f6('0x6d')]=function(_0x2ae118,_0x523318,_0x4b9af9){return db[_0xa3f6('0x6e')]['find']({'where':{'id':_0x2ae118['params']['id']}})[_0xa3f6('0x1d')](handleEntityNotFound(_0x523318,null))['then'](function(_0x29f27b){if(_0x29f27b){return _0x29f27b[_0xa3f6('0x6d')](_0x2ae118[_0xa3f6('0x59')][_0xa3f6('0x68')],_[_0xa3f6('0x6f')](_0x2ae118[_0xa3f6('0x59')],['ids','id'])||{});}})['then'](respondWithResult(_0x523318,null))['catch'](handleError(_0x523318,null));};exports['getInteractions']=function(_0x5c4c9b,_0x3a5798,_0x5d52df){var _0x3e9a4f={'raw':![],'where':{}};var _0xb8ed34={};var _0x162af4={'count':0x0,'rows':[]};return db[_0xa3f6('0x3e')][_0xa3f6('0x63')]({'where':{'id':_0x5c4c9b[_0xa3f6('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3a5798,null))[_0xa3f6('0x1d')](function(_0x209957){if(_0x209957){_0xb8ed34['model']=_[_0xa3f6('0x43')](db[_0xa3f6('0x6e')][_0xa3f6('0x56')]);_0xb8ed34[_0xa3f6('0x42')]=_[_0xa3f6('0x43')](_0x5c4c9b[_0xa3f6('0x42')]);_0xb8ed34[_0xa3f6('0x44')]=_['intersection'](_0xb8ed34[_0xa3f6('0x41')],_0xb8ed34[_0xa3f6('0x42')]);_0x3e9a4f['attributes']=_[_0xa3f6('0x45')](_0xb8ed34['model'],qs[_0xa3f6('0x47')](_0x5c4c9b[_0xa3f6('0x42')][_0xa3f6('0x47')]));_0x3e9a4f[_0xa3f6('0x46')]=_0x3e9a4f[_0xa3f6('0x46')]['length']?_0x3e9a4f[_0xa3f6('0x46')]:_0xb8ed34['model'];if(!_0x5c4c9b[_0xa3f6('0x42')]['hasOwnProperty'](_0xa3f6('0x4a'))){_0x3e9a4f['limit']=qs['limit'](_0x5c4c9b[_0xa3f6('0x42')][_0xa3f6('0x2c')]);_0x3e9a4f['offset']=qs[_0xa3f6('0x2b')](_0x5c4c9b[_0xa3f6('0x42')]['offset']);}_0x3e9a4f['order']=qs[_0xa3f6('0x4c')](_0x5c4c9b[_0xa3f6('0x42')][_0xa3f6('0x4c')]);_0x3e9a4f[_0xa3f6('0x4d')]=qs[_0xa3f6('0x44')](_[_0xa3f6('0x4e')](_0x5c4c9b[_0xa3f6('0x42')],_0xb8ed34[_0xa3f6('0x44')]));_0x3e9a4f[_0xa3f6('0x4d')]['FaxAccountId']=_0x209957['id'];if(_0x5c4c9b['query']['filter']){_0x3e9a4f[_0xa3f6('0x4d')]=_[_0xa3f6('0x50')](_0x3e9a4f[_0xa3f6('0x4d')],{'$or':_[_0xa3f6('0x3d')](_0x3e9a4f[_0xa3f6('0x46')],function(_0x3d5a3d){var _0x144c87={};_0x144c87[_0x3d5a3d]={'$like':'%'+_0x5c4c9b[_0xa3f6('0x42')]['filter']+'%'};return _0x144c87;})});}_0x3e9a4f=_[_0xa3f6('0x50')]({},_0x3e9a4f,_0x5c4c9b['options']);return db[_0xa3f6('0x6e')][_0xa3f6('0x2e')]({'where':_0x3e9a4f[_0xa3f6('0x4d')]})['then'](function(_0x3e5d51){_0x162af4['count']=_0x3e5d51;if(_0x5c4c9b[_0xa3f6('0x42')][_0xa3f6('0x53')]){_0x3e9a4f[_0xa3f6('0x65')]=[{'model':db[_0xa3f6('0x70')],'as':_0xa3f6('0x71'),'required':![]},{'model':db[_0xa3f6('0x72')],'as':_0xa3f6('0x73'),'attributes':[_0xa3f6('0x39'),_0xa3f6('0x74'),_0xa3f6('0x75')],'required':![]},{'model':db[_0xa3f6('0x76')],'as':_0xa3f6('0x77'),'attributes':['id',_0xa3f6('0x39'),_0xa3f6('0x78')],'where':_0x5c4c9b['query'][_0xa3f6('0x79')]?{'id':_0x5c4c9b[_0xa3f6('0x42')][_0xa3f6('0x79')]}:undefined,'required':_0x5c4c9b[_0xa3f6('0x42')][_0xa3f6('0x79')]?!![]:![]}];}return db[_0xa3f6('0x6e')][_0xa3f6('0x66')](_0x3e9a4f);})[_0xa3f6('0x1d')](function(_0x51b2fd){_0x162af4[_0xa3f6('0x54')]=_0x51b2fd;return _0x162af4;});}})[_0xa3f6('0x1d')](respondWithFilteredResult(_0x3a5798,_0x3e9a4f))[_0xa3f6('0x27')](handleError(_0x3a5798,null));};exports[_0xa3f6('0x7a')]=function(_0x5d7c08,_0xc411eb){var _0x35df35=_0x5d7c08[_0xa3f6('0x5f')]['id'];var _0x1431ee=_0x5d7c08[_0xa3f6('0x59')];var _0x154211=0xc8;var _0x55c496=null;return db[_0xa3f6('0x7b')][_0xa3f6('0x7c')]({'isolationLevel':db[_0xa3f6('0x7b')]['Transaction'][_0xa3f6('0x7d')][_0xa3f6('0x7e')]},function(_0x54bb33){return db[_0xa3f6('0x3e')]['findOne']({'where':{'id':_0x35df35},'transaction':_0x54bb33})[_0xa3f6('0x1d')](function(_0x2f4476){if(_0x2f4476){return db['FaxApplication'][_0xa3f6('0x37')]({'where':{'FaxAccountId':_0x35df35},'transaction':_0x54bb33})['then'](function(){var _0x2d2881=_[_0xa3f6('0x3d')](_0x1431ee,function(_0x1f7ca0){_0x1f7ca0[_0xa3f6('0x64')]=_0x35df35;return _0x1f7ca0;});return db[_0xa3f6('0x7f')][_0xa3f6('0x80')](_0x2d2881,{'transaction':_0x54bb33});});}else{_0x154211=0x194;_0x55c496=[];}});})[_0xa3f6('0x1d')](function(){if(_0x154211!==0x194){return db['FaxApplication'][_0xa3f6('0x81')]({'where':{'FaxAccountId':_0x35df35},'order':_0xa3f6('0x82')})[_0xa3f6('0x1d')](function(_0x338feb){_0x55c496=_0x338feb;});}})[_0xa3f6('0x27')](function(_0x16a48c){_0x154211=0x1f4;logger['error'](_0x16a48c[_0xa3f6('0x83')]);if(_0x16a48c[_0xa3f6('0x39')]){delete _0x16a48c[_0xa3f6('0x39')];}_0x55c496=_0x16a48c;})[_0xa3f6('0x84')](function(){if(_0x55c496===null){_0xc411eb[_0xa3f6('0x28')](_0x154211);}else{if(_0x154211===0x1f4){_0xc411eb[_0xa3f6('0x29')](_0x154211)[_0xa3f6('0x3a')](_0x55c496);}else{_0xc411eb[_0xa3f6('0x29')](_0x154211)['json'](_0x55c496);}}});};exports[_0xa3f6('0x85')]=function(_0x323ded,_0x4865c0,_0x36f992){var _0x46a40f={};var _0x5f2a97={};var _0x54fdb9;var _0x41259e;return db['FaxAccount'][_0xa3f6('0x63')]({'where':{'id':_0x323ded[_0xa3f6('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4865c0,null))['then'](function(_0x1caf77){if(_0x1caf77){_0x54fdb9=_0x1caf77;_0x5f2a97[_0xa3f6('0x41')]=_['keys'](db[_0xa3f6('0x7f')]['rawAttributes']);_0x5f2a97[_0xa3f6('0x42')]=_[_0xa3f6('0x43')](_0x323ded[_0xa3f6('0x42')]);_0x5f2a97[_0xa3f6('0x44')]=_['intersection'](_0x5f2a97[_0xa3f6('0x41')],_0x5f2a97[_0xa3f6('0x42')]);_0x46a40f[_0xa3f6('0x46')]=_[_0xa3f6('0x45')](_0x5f2a97[_0xa3f6('0x41')],qs[_0xa3f6('0x47')](_0x323ded[_0xa3f6('0x42')]['fields']));_0x46a40f[_0xa3f6('0x46')]=_0x46a40f[_0xa3f6('0x46')][_0xa3f6('0x48')]?_0x46a40f[_0xa3f6('0x46')]:_0x5f2a97['model'];_0x46a40f[_0xa3f6('0x4b')]=qs[_0xa3f6('0x4c')](_0x323ded[_0xa3f6('0x42')][_0xa3f6('0x4c')]);_0x46a40f[_0xa3f6('0x4d')]=qs[_0xa3f6('0x44')](_[_0xa3f6('0x4e')](_0x323ded[_0xa3f6('0x42')],_0x5f2a97[_0xa3f6('0x44')]));if(_0x323ded[_0xa3f6('0x42')][_0xa3f6('0x4f')]){_0x46a40f[_0xa3f6('0x4d')]=_[_0xa3f6('0x50')](_0x46a40f[_0xa3f6('0x4d')],{'$or':_[_0xa3f6('0x3d')](_0x46a40f[_0xa3f6('0x46')],function(_0x10815d){var _0x163b0f={};_0x163b0f[_0x10815d]={'$like':'%'+_0x323ded['query']['filter']+'%'};return _0x163b0f;})});}_0x46a40f=_[_0xa3f6('0x50')]({},_0x46a40f,_0x323ded['options']);return _0x54fdb9['getApplications'](_0x46a40f);}})[_0xa3f6('0x1d')](function(_0x321ced){if(_0x321ced){_0x41259e=_0x321ced['length'];if(!_0x323ded[_0xa3f6('0x42')]['hasOwnProperty'](_0xa3f6('0x4a'))){_0x46a40f[_0xa3f6('0x2c')]=qs['limit'](_0x323ded[_0xa3f6('0x42')][_0xa3f6('0x2c')]);_0x46a40f[_0xa3f6('0x2b')]=qs[_0xa3f6('0x2b')](_0x323ded[_0xa3f6('0x42')][_0xa3f6('0x2b')]);}return _0x54fdb9[_0xa3f6('0x85')](_0x46a40f);}})[_0xa3f6('0x1d')](function(_0x3f8d10){if(_0x3f8d10){return _0x3f8d10?{'count':_0x41259e,'rows':_0x3f8d10}:null;}})[_0xa3f6('0x1d')](respondWithResult(_0x4865c0,null))[_0xa3f6('0x27')](handleError(_0x4865c0,null));};function Extension(_0x41fe47,_0x1bb8b1,_0x331f29,_0x30e36c){this[_0xa3f6('0x86')]=_0xa3f6('0x87');this['exten']=_0x41fe47[_0xa3f6('0x88')];this[_0xa3f6('0x89')]=_0x30e36c;this['type']=_0xa3f6('0x8a');this[_0xa3f6('0x8b')]=_0xa3f6('0x8c');this[_0xa3f6('0x64')]=_0x41fe47['id'];this[_0xa3f6('0x82')]=_0x1bb8b1;this['appdata']=_0x331f29;}function createExtensionsReciveFax(_0x335871){var _0x1c454f=0x1;var _0xd35343=[];_0xd35343['push'](new Extension(_0x335871,_0x1c454f,'',_0xa3f6('0x8d')));_0x1c454f+=0x1;_0xd35343['push'](new Extension(_0x335871,_0x1c454f,'CDR(type)=inbound-fax','Set'));_0x1c454f+=0x1;for(var _0x4183db in _0x335871){if(_0x335871[_0xa3f6('0x49')](_0x4183db)&&(_0x4183db===_0xa3f6('0x8e')||_0x4183db===_0xa3f6('0x88')||_0x4183db===_0xa3f6('0x8f')||_0x4183db===_0xa3f6('0x90')||_0x4183db===_0xa3f6('0x91')||_0x4183db==='maxrate'||_0x4183db===_0xa3f6('0x92')||_0x4183db===_0xa3f6('0x93')||_0x4183db===_0xa3f6('0x94'))){_0xd35343['push'](new Extension(_0x335871,_0x1c454f,_0xa3f6('0x95')+_0x4183db+')='+_0x335871[_0x4183db],_0xa3f6('0x96')));_0x1c454f+=0x1;}}_0xd35343[_0xa3f6('0x97')](new Extension(_0x335871,_0x1c454f,'6',_0xa3f6('0x98')));_0x1c454f+=0x1;_0xd35343[_0xa3f6('0x97')](new Extension(_0x335871,_0x1c454f,_0xa3f6('0x99'),_0xa3f6('0x9a')));_0x1c454f=0x0;return _0xd35343;}exports['addAccountApplications']=function(_0x20f8b8,_0x3cf936,_0x335974){var _0x2b237f;return db['sequelize']['transaction'](function(_0x165974){return db[_0xa3f6('0x3e')][_0xa3f6('0x58')](_0x20f8b8[_0xa3f6('0x59')],{'transaction':_0x165974})[_0xa3f6('0x1d')](function(_0x3ba80d){_0x2b237f=_0x3ba80d[_0xa3f6('0x35')]({'plain':!![]});return db[_0xa3f6('0x9b')][_0xa3f6('0x80')](createExtensionsReciveFax(_0x2b237f),{'transaction':_0x165974});});})[_0xa3f6('0x1d')](function(){return _0x2b237f;})['then'](respondWithResult(_0x3cf936,null))[_0xa3f6('0x27')](handleError(_0x3cf936,null));};exports[_0xa3f6('0x9c')]=function(_0x499d0d,_0x457183,_0x2a289b){var _0x406d2a;return db['sequelize'][_0xa3f6('0x7c')](function(_0x4c8df0){return db[_0xa3f6('0x3e')][_0xa3f6('0x34')](_0x499d0d[_0xa3f6('0x59')],{'where':{'id':_0x499d0d[_0xa3f6('0x59')]['id']},'transaction':_0x4c8df0})[_0xa3f6('0x1d')](function(_0x11a3a8){return db[_0xa3f6('0x9b')]['destroy']({'where':{'FaxAccountId':_0x499d0d[_0xa3f6('0x59')]['id']},'transaction':_0x4c8df0})[_0xa3f6('0x1d')](function(_0x7e9f92){return db[_0xa3f6('0x9b')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x499d0d[_0xa3f6('0x59')],[_0xa3f6('0x9d'),_0xa3f6('0x9e'),'createdAt','updatedAt',_0xa3f6('0x9f'),_0xa3f6('0xa0')])),{'transaction':_0x4c8df0});});});})[_0xa3f6('0x1d')](function(){return db[_0xa3f6('0x3e')][_0xa3f6('0xa1')](_0x499d0d[_0xa3f6('0x59')]['id']);})['then'](respondWithResult(_0x457183,null))[_0xa3f6('0x27')](handleError(_0x457183,null));};exports[_0xa3f6('0xa2')]=function(_0x348995,_0x352d1e,_0x42b1e0){var _0x38ebe4={'raw':!![],'where':{}};var _0x23d3e7={};var _0x44c04e={'count':0x0,'rows':[]};return db[_0xa3f6('0x3e')][_0xa3f6('0x63')]({'where':{'id':_0x348995[_0xa3f6('0x5f')]['id']}})[_0xa3f6('0x1d')](handleEntityNotFound(_0x352d1e,null))[_0xa3f6('0x1d')](function(_0x4bcc91){if(_0x4bcc91){_0x23d3e7[_0xa3f6('0x41')]=_['keys'](db[_0xa3f6('0xa3')][_0xa3f6('0x56')]);_0x23d3e7['query']=_[_0xa3f6('0x43')](_0x348995['query']);_0x23d3e7[_0xa3f6('0x44')]=_[_0xa3f6('0x45')](_0x23d3e7[_0xa3f6('0x41')],_0x23d3e7[_0xa3f6('0x42')]);_0x38ebe4['attributes']=_['intersection'](_0x23d3e7[_0xa3f6('0x41')],qs[_0xa3f6('0x47')](_0x348995[_0xa3f6('0x42')][_0xa3f6('0x47')]));_0x38ebe4['attributes']=_0x38ebe4[_0xa3f6('0x46')]['length']?_0x38ebe4[_0xa3f6('0x46')]:_0x23d3e7[_0xa3f6('0x41')];if(!_0x348995['query'][_0xa3f6('0x49')](_0xa3f6('0x4a'))){_0x38ebe4['limit']=qs[_0xa3f6('0x2c')](_0x348995['query'][_0xa3f6('0x2c')]);_0x38ebe4[_0xa3f6('0x2b')]=qs[_0xa3f6('0x2b')](_0x348995[_0xa3f6('0x42')][_0xa3f6('0x2b')]);}_0x38ebe4[_0xa3f6('0x4b')]=qs[_0xa3f6('0x4c')](_0x348995[_0xa3f6('0x42')][_0xa3f6('0x4c')]);_0x38ebe4[_0xa3f6('0x4d')]=qs[_0xa3f6('0x44')](_['pick'](_0x348995['query'],_0x23d3e7[_0xa3f6('0x44')]));_0x38ebe4[_0xa3f6('0x4d')]['FaxAccountId']=_0x4bcc91['id'];if(_0x348995[_0xa3f6('0x42')]['filter']){_0x38ebe4[_0xa3f6('0x4d')]=_['merge'](_0x38ebe4[_0xa3f6('0x4d')],{'$or':_['map'](_0x38ebe4[_0xa3f6('0x46')],function(_0xfec94f){var _0x56a723={};_0x56a723[_0xfec94f]={'$like':'%'+_0x348995[_0xa3f6('0x42')][_0xa3f6('0x4f')]+'%'};return _0x56a723;})});}if(_0x348995['query'][_0xa3f6('0xa4')]){var _0xd90dc2=_0x348995[_0xa3f6('0x42')][_0xa3f6('0xa4')][_0xa3f6('0xa5')](',');var _0x17e733={};_0x17e733[_0xd90dc2[0x0]]={'$gte':moment(_0xd90dc2[0x1])[_0xa3f6('0xa6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x38ebe4[_0xa3f6('0x4d')]=_[_0xa3f6('0x50')](_0x38ebe4[_0xa3f6('0x4d')],_0x17e733);}_0x38ebe4=_[_0xa3f6('0x50')]({},_0x38ebe4,_0x348995[_0xa3f6('0x52')]);return db[_0xa3f6('0xa3')][_0xa3f6('0x2e')]({'where':_0x38ebe4[_0xa3f6('0x4d')]})[_0xa3f6('0x1d')](function(_0x32f24a){_0x44c04e['count']=_0x32f24a;if(_0x348995[_0xa3f6('0x42')][_0xa3f6('0x53')]){_0x38ebe4[_0xa3f6('0x65')]=[{'all':!![]}];}return db[_0xa3f6('0xa3')]['findAll'](_0x38ebe4);})[_0xa3f6('0x1d')](function(_0x3ec48b){_0x44c04e[_0xa3f6('0x54')]=_0x3ec48b;return _0x44c04e;});}})['then'](respondWithFilteredResult(_0x352d1e,_0x38ebe4))['catch'](handleError(_0x352d1e,null));};exports['send']=function(_0x176e4c,_0x1155ff,_0x4587d4){var _0x327da6,_0x1b22ec={},_0xc1427b;if(_0x176e4c[_0xa3f6('0x59')]['to']){_0xc1427b=_0x176e4c[_0xa3f6('0x59')]['to'][0x0];}return db[_0xa3f6('0x3e')]['find']({'where':{'id':_0x176e4c[_0xa3f6('0x5f')]['id']},'include':[{'model':db[_0xa3f6('0xa7')],'as':_0xa3f6('0xa8'),'include':[{'model':db[_0xa3f6('0x70')],'as':_0xa3f6('0xa9'),'where':{'fax':_0xc1427b},'limit':0x1,'order':[[_0xa3f6('0xaa'),'DESC']]}]}]})[_0xa3f6('0x1d')](handleEntityNotFound(_0x1155ff,null))[_0xa3f6('0x1d')](function(_0x2a4b6c){_0x327da6=_0x2a4b6c;if(_0x176e4c[_0xa3f6('0x59')][_0xa3f6('0xab')]&&_0x176e4c[_0xa3f6('0x59')][_0xa3f6('0xab')]['length']){for(var _0x9eebf9=0x0;_0x9eebf9<_0x176e4c[_0xa3f6('0x59')][_0xa3f6('0xab')]['length'];_0x9eebf9+=0x1){_0x176e4c[_0xa3f6('0x59')][_0xa3f6('0xab')][_0x9eebf9]={'filename':_0x176e4c['body'][_0xa3f6('0xab')][_0x9eebf9]['name'],'id':_0x176e4c[_0xa3f6('0x59')][_0xa3f6('0xab')][_0x9eebf9]['id'],'path':path['join'](config[_0xa3f6('0xac')],_0xa3f6('0xad'),_0x176e4c['body'][_0xa3f6('0xab')][_0x9eebf9][_0xa3f6('0xae')])};}}return respondWithRpcPromise(_0xa3f6('0xaf'),_0xa3f6('0xaf'),{'FaxAccountId':_[_0xa3f6('0xb0')](_0x176e4c['params']['id'])?undefined:_0x176e4c[_0xa3f6('0x5f')]['id'],'path':_[_0xa3f6('0xb0')](_0x176e4c[_0xa3f6('0x59')][_0xa3f6('0xab')][0x0][_0xa3f6('0x5')])?undefined:_0x176e4c['body']['attachments'][0x0][_0xa3f6('0x5')],'fax':_[_0xa3f6('0xb0')](_0x176e4c[_0xa3f6('0x59')]['to'][0x0])?undefined:_0x176e4c[_0xa3f6('0x59')]['to'][0x0]},client9002);})[_0xa3f6('0x1d')](function(){if(_0x327da6){if(_[_0xa3f6('0xb0')](_0x176e4c[_0xa3f6('0x59')][_0xa3f6('0xb1')])){_0x176e4c[_0xa3f6('0x59')][_0xa3f6('0xb1')]=util[_0xa3f6('0xa6')](_0xa3f6('0xb2'),_0x327da6['name'],_0x327da6[_0xa3f6('0xb3')]);}if(_0x327da6[_0xa3f6('0xa8')]){if(_0x327da6['List'][_0xa3f6('0xa9')][_0xa3f6('0x48')]){return _0x327da6[_0xa3f6('0xa8')]['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0xa3f6('0xb4')](_0x176e4c[_0xa3f6('0x59')],{'firstName':_0x176e4c['body']['to'][0x0],'phone':_0x176e4c[_0xa3f6('0x59')]['to'][0x0],'fax':_0x176e4c[_0xa3f6('0x59')]['to'][0x0],'ListId':_0x327da6[_0xa3f6('0xa0')]}));}}else{throw new Error(_0xa3f6('0xb5'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xa3f6('0x1d')](function(_0x4f8ac1){if(_0x4f8ac1){return db[_0xa3f6('0x6e')]['find']({'where':{'ContactId':_0x4f8ac1['id'],'closed':![],'FaxAccountId':_0x327da6['id']}})[_0xa3f6('0x1d')](function(_0x21df6f){if(_0x21df6f){return[_0x21df6f,![]];}return db[_0xa3f6('0x6e')][_0xa3f6('0x58')]({'UserId':_0x176e4c[_0xa3f6('0x5a')]['id'],'ContactId':_0x4f8ac1['id'],'FaxAccountId':_0x327da6['id'],'fax':_0x176e4c['body']['to'][0x0],'firstMsgDirection':_0xa3f6('0xb6'),'Messages':[_[_0xa3f6('0x50')](_0x176e4c['body'],{'read':![],'body':_0x176e4c[_0xa3f6('0x59')][_0xa3f6('0xab')][0x0][_0xa3f6('0xb7')],'FaxAccountId':_0x327da6['id'],'UserId':_0x176e4c['user']['id'],'ContactId':_0x4f8ac1['id'],'AttachmentId':_0x176e4c['body'][_0xa3f6('0xab')][0x0]['id']})]},{'include':[{'model':db[_0xa3f6('0xa3')],'as':_0xa3f6('0xb8')}]})[_0xa3f6('0x1d')](function(_0x42cf28){return[_0x42cf28,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xa3f6('0xb9')](function(_0x429ddd,_0x2300b2){if(_0x2300b2){return _0x429ddd;}return db[_0xa3f6('0xa3')][_0xa3f6('0x58')]({'direction':_0xa3f6('0xb6'),'read':![],'body':_0x176e4c[_0xa3f6('0x59')][_0xa3f6('0xab')][0x0][_0xa3f6('0xb7')],'FaxAccountId':_0x327da6['id'],'FaxInteractionId':_0x429ddd['id'],'UserId':_0x176e4c['user']['id'],'ContactId':_0x429ddd[_0xa3f6('0xba')],'AttachmentId':_0x176e4c[_0xa3f6('0x59')]['attachments'][0x0]['id']})[_0xa3f6('0x1d')](function(_0x4c4e01){_0x429ddd['dataValues'][_0xa3f6('0xb8')]=[];_0x429ddd[_0xa3f6('0xbb')]['Messages']['push'](_0x4c4e01[_0xa3f6('0xbb')]);return _0x429ddd;});})[_0xa3f6('0x1d')](function(_0x367e02){respondWithRpcPromise(_0xa3f6('0xbc'),_0xa3f6('0xbc'),{'FaxAccountId':_['isNil'](_0x176e4c[_0xa3f6('0x5f')]['id'])?undefined:_0x176e4c[_0xa3f6('0x5f')]['id'],'path':_[_0xa3f6('0xb0')](_0x176e4c[_0xa3f6('0x59')]['attachments'][0x0][_0xa3f6('0x5')])?undefined:_0x176e4c['body'][_0xa3f6('0xab')][0x0][_0xa3f6('0x5')],'fax':_['isNil'](_0x176e4c[_0xa3f6('0x59')]['to'][0x0])?undefined:_0x176e4c[_0xa3f6('0x59')]['to'][0x0],'AttachmentId':_0x176e4c['body'][_0xa3f6('0xab')][0x0]['id']},client9002)['then'](function(_0x44acdf){logger[_0xa3f6('0x1e')](_0xa3f6('0xbd'),_0x44acdf);})[_0xa3f6('0x27')](function(_0x133d1c){logger[_0xa3f6('0x1e')](_0xa3f6('0xbd'),_0x133d1c);});return _0x367e02;})['then'](respondWithResult(_0x1155ff,null))['catch'](handleError(_0x1155ff,null));};exports[_0xa3f6('0xbe')]=function(_0x2bf7bc,_0x2e853a,_0x281149){return db['FaxAccount'][_0xa3f6('0x57')]({'where':{'id':_0x2bf7bc[_0xa3f6('0x5f')]['id']}})[_0xa3f6('0x1d')](handleEntityNotFound(_0x2e853a,null))[_0xa3f6('0x1d')](function(_0x3aa096){if(_0x3aa096){return _0x3aa096[_0xa3f6('0xbe')](_0x2bf7bc[_0xa3f6('0x59')]['ids'],_[_0xa3f6('0x6f')](_0x2bf7bc['body'],[_0xa3f6('0x68'),'id'])||{})['spread'](function(_0x29cbf2){for(var _0xbdd3=0x0;_0xbdd3<_0x2bf7bc['body'][_0xa3f6('0x68')][_0xa3f6('0x48')];_0xbdd3+=0x1){socket[_0xa3f6('0xbf')](_0xa3f6('0xc0'),{'UserId':Number(_0x2bf7bc[_0xa3f6('0x59')][_0xa3f6('0x68')][_0xbdd3]),'FaxAccountId':Number(_0x2bf7bc['params']['id'])});}return _0x29cbf2;});}})[_0xa3f6('0x1d')](respondWithResult(_0x2e853a,null))[_0xa3f6('0x27')](handleError(_0x2e853a,null));};exports[_0xa3f6('0xc1')]=function(_0x232543,_0x5cd47b,_0x4645dc){return db[_0xa3f6('0x3e')][_0xa3f6('0x57')]({'where':{'id':_0x232543[_0xa3f6('0x5f')]['id']}})[_0xa3f6('0x1d')](handleEntityNotFound(_0x5cd47b,null))['then'](function(_0x6f317d){if(_0x6f317d){return _0x6f317d[_0xa3f6('0xc1')](_0x232543[_0xa3f6('0x42')]['ids'])['then'](function(){if(_[_0xa3f6('0xc2')](_0x232543[_0xa3f6('0x42')]['ids'])){for(var _0x382f76=0x0;_0x382f76<_0x232543[_0xa3f6('0x42')][_0xa3f6('0x68')]['length'];_0x382f76+=0x1){socket['emit'](_0xa3f6('0xc3'),{'UserId':Number(_0x232543[_0xa3f6('0x42')][_0xa3f6('0x68')][_0x382f76]),'FaxAccountId':Number(_0x232543['params']['id'])});}}else{socket['emit'](_0xa3f6('0xc3'),{'UserId':Number(_0x232543['query'][_0xa3f6('0x68')]),'FaxAccountId':Number(_0x232543[_0xa3f6('0x5f')]['id'])});}});}})[_0xa3f6('0x1d')](respondWithStatusCode(_0x5cd47b,null))['catch'](handleError(_0x5cd47b,null));};exports[_0xa3f6('0xc4')]=function(_0x24aa78,_0x4a2f35,_0x4295cd){var _0x1736c2={};var _0x2c66f9={};var _0x50cfa8;var _0x2781b7;return db[_0xa3f6('0x3e')][_0xa3f6('0x63')]({'where':{'id':_0x24aa78['params']['id']}})[_0xa3f6('0x1d')](handleEntityNotFound(_0x4a2f35,null))['then'](function(_0x18a3d9){if(_0x18a3d9){_0x50cfa8=_0x18a3d9;_0x2c66f9[_0xa3f6('0x41')]=_[_0xa3f6('0x43')](db[_0xa3f6('0x72')]['rawAttributes']);_0x2c66f9[_0xa3f6('0x42')]=_[_0xa3f6('0x43')](_0x24aa78[_0xa3f6('0x42')]);_0x2c66f9['filters']=_['intersection'](_0x2c66f9[_0xa3f6('0x41')],_0x2c66f9['query']);_0x1736c2[_0xa3f6('0x46')]=_[_0xa3f6('0x45')](_0x2c66f9[_0xa3f6('0x41')],qs[_0xa3f6('0x47')](_0x24aa78[_0xa3f6('0x42')]['fields']));_0x1736c2[_0xa3f6('0x46')]=_0x1736c2[_0xa3f6('0x46')]['length']?_0x1736c2['attributes']:_0x2c66f9[_0xa3f6('0x41')];_0x1736c2[_0xa3f6('0x4b')]=qs[_0xa3f6('0x4c')](_0x24aa78[_0xa3f6('0x42')][_0xa3f6('0x4c')]);_0x1736c2[_0xa3f6('0x4d')]=qs['filters'](_[_0xa3f6('0x4e')](_0x24aa78[_0xa3f6('0x42')],_0x2c66f9[_0xa3f6('0x44')]));if(_0x24aa78[_0xa3f6('0x42')][_0xa3f6('0x4f')]){_0x1736c2[_0xa3f6('0x4d')]=_[_0xa3f6('0x50')](_0x1736c2['where'],{'$or':_[_0xa3f6('0x3d')](_0x1736c2[_0xa3f6('0x46')],function(_0x270b55){var _0x2ed4b1={};_0x2ed4b1[_0x270b55]={'$like':'%'+_0x24aa78[_0xa3f6('0x42')][_0xa3f6('0x4f')]+'%'};return _0x2ed4b1;})});}_0x1736c2=_[_0xa3f6('0x50')]({},_0x1736c2,_0x24aa78[_0xa3f6('0x52')]);return _0x50cfa8[_0xa3f6('0xc4')](_0x1736c2);}})['then'](function(_0x352276){if(_0x352276){_0x2781b7=_0x352276['length'];if(!_0x24aa78[_0xa3f6('0x42')][_0xa3f6('0x49')]('nolimit')){_0x1736c2[_0xa3f6('0x2c')]=qs[_0xa3f6('0x2c')](_0x24aa78[_0xa3f6('0x42')]['limit']);_0x1736c2[_0xa3f6('0x2b')]=qs[_0xa3f6('0x2b')](_0x24aa78[_0xa3f6('0x42')][_0xa3f6('0x2b')]);}return _0x50cfa8[_0xa3f6('0xc4')](_0x1736c2);}})[_0xa3f6('0x1d')](function(_0x3dabf0){if(_0x3dabf0){return _0x3dabf0?{'count':_0x2781b7,'rows':_0x3dabf0}:null;}})[_0xa3f6('0x1d')](respondWithResult(_0x4a2f35,null))[_0xa3f6('0x27')](handleError(_0x4a2f35,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index bcd3ed3..f052924 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 _0x76ad=['events','../../mysqldb','FaxAccount','update','emit','hook','exports'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x76ad,0x9a));var _0xd76a=function(_0xea4553,_0x5dca9b){_0xea4553=_0xea4553-0x0;var _0x584cf4=_0x76ad[_0xea4553];return _0x584cf4;};'use strict';var EventEmitter=require(_0xd76a('0x0'));var FaxAccount=require(_0xd76a('0x1'))['db'][_0xd76a('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd76a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3c44fe){return function(_0x284f90,_0x45573c,_0x36d869){FaxAccountEvents[_0xd76a('0x4')](_0x3c44fe+':'+_0x284f90['id'],_0x284f90);FaxAccountEvents['emit'](_0x3c44fe,_0x284f90);_0x36d869(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xd76a('0x5')](e,emitEvent(event));}}module[_0xd76a('0x6')]=FaxAccountEvents; \ No newline at end of file +var _0xc8bd=['save','update','remove','emit','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x5e548b,_0x330927){var _0x4fe8f8=function(_0x10b688){while(--_0x10b688){_0x5e548b['push'](_0x5e548b['shift']());}};_0x4fe8f8(++_0x330927);}(_0xc8bd,0xf6));var _0xdc8b=function(_0x4c3f1c,_0x30d1a5){_0x4c3f1c=_0x4c3f1c-0x0;var _0x2119b4=_0xc8bd[_0x4c3f1c];return _0x2119b4;};'use strict';var EventEmitter=require(_0xdc8b('0x0'));var FaxAccount=require(_0xdc8b('0x1'))['db'][_0xdc8b('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xdc8b('0x3')](0x0);var events={'afterCreate':_0xdc8b('0x4'),'afterUpdate':_0xdc8b('0x5'),'afterDestroy':_0xdc8b('0x6')};function emitEvent(_0x2444dc){return function(_0xc345ab,_0x1148ca,_0x3c1904){FaxAccountEvents[_0xdc8b('0x7')](_0x2444dc+':'+_0xc345ab['id'],_0xc345ab);FaxAccountEvents['emit'](_0x2444dc,_0xc345ab);_0x3c1904(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xdc8b('0x8')](e,emitEvent(event));}}module[_0xdc8b('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 7e6d0a7..69ee610 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 _0x888e=['../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1e9ac0,_0x554574){var _0x40ce36=function(_0x286fcf){while(--_0x286fcf){_0x1e9ac0['push'](_0x1e9ac0['shift']());}};_0x40ce36(++_0x554574);}(_0x888e,0x1f4));var _0xe888=function(_0x27763d,_0x253de){_0x27763d=_0x27763d-0x0;var _0x4dcb39=_0x888e[_0x27763d];return _0x4dcb39;};'use strict';var _=require(_0xe888('0x0'));var util=require('util');var logger=require(_0xe888('0x1'))('api');var moment=require(_0xe888('0x2'));var BPromise=require(_0xe888('0x3'));var rp=require(_0xe888('0x4'));var fs=require('fs');var path=require(_0xe888('0x5'));var rimraf=require(_0xe888('0x6'));var config=require(_0xe888('0x7'));var attributes=require(_0xe888('0x8'));module[_0xe888('0x9')]=function(_0xaec2b5,_0x35fddf){return _0xaec2b5[_0xe888('0xa')](_0xe888('0xb'),attributes,{'tableName':_0xe888('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bfd=['../../config/logger','api','moment','bluebird','path','rimraf','./faxAccount.attributes','exports','define','lodash','util'];(function(_0x216ec1,_0x1065f6){var _0xb09201=function(_0x2fdb7d){while(--_0x2fdb7d){_0x216ec1['push'](_0x216ec1['shift']());}};_0xb09201(++_0x1065f6);}(_0x9bfd,0x132));var _0xd9bf=function(_0x1267c5,_0x443b33){_0x1267c5=_0x1267c5-0x0;var _0x3b6320=_0x9bfd[_0x1267c5];return _0x3b6320;};'use strict';var _=require(_0xd9bf('0x0'));var util=require(_0xd9bf('0x1'));var logger=require(_0xd9bf('0x2'))(_0xd9bf('0x3'));var moment=require(_0xd9bf('0x4'));var BPromise=require(_0xd9bf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd9bf('0x6'));var rimraf=require(_0xd9bf('0x7'));var config=require('../../config/environment');var attributes=require(_0xd9bf('0x8'));module[_0xd9bf('0x9')]=function(_0x1973e2,_0x36ec26){return _0x1973e2[_0xd9bf('0xa')]('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index f31e557..d0de9fd 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 _0x2681=['account','CmList','List','Applications','applications','list','orderBy','priority','asc','Contacts','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','close','unmanaged','created','interaction','FaxMessage','ContactId','UserId','User','name','unshift','waitForTheAssignedAgent','*,*,*,*','queueId','FaxQueue','queue','waitForTheAssignedQueue','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./faxAccount.socket','register','then','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','include','map','model','debug','NotifyFaxAccount','body','fax','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find'];(function(_0xf7e616,_0x1b348d){var _0x5e73fd=function(_0x3444cb){while(--_0x3444cb){_0xf7e616['push'](_0xf7e616['shift']());}};_0x5e73fd(++_0x1b348d);}(_0x2681,0x191));var _0x1268=function(_0x38c4c4,_0x425a68){_0x38c4c4=_0x38c4c4-0x0;var _0x2df555=_0x2681[_0x38c4c4];return _0x2df555;};'use strict';var _=require(_0x1268('0x0'));var util=require(_0x1268('0x1'));var moment=require(_0x1268('0x2'));var BPromise=require(_0x1268('0x3'));var rs=require(_0x1268('0x4'));var fs=require('fs');var Redis=require(_0x1268('0x5'));var db=require(_0x1268('0x6'))['db'];var utils=require(_0x1268('0x7'));var logger=require(_0x1268('0x8'))('rpc');var config=require(_0x1268('0x9'));var jayson=require(_0x1268('0xa'));var client=jayson[_0x1268('0xb')][_0x1268('0xc')]({'port':0x232c});config['redis']=_['defaults'](config[_0x1268('0xd')],{'host':_0x1268('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1268('0xd')]));require(_0x1268('0xf'))[_0x1268('0x10')](socket);function respondWithRpcPromise(_0x492e7a,_0x469ce8,_0x39d493){return new BPromise(function(_0x112dc8,_0x24eb35){return client['request'](_0x492e7a,_0x39d493)[_0x1268('0x11')](function(_0x448a51){logger['info'](_0x1268('0x12'),_0x469ce8,_0x1268('0x13'));logger['debug'](_0x1268('0x14'),_0x469ce8,_0x1268('0x13'),JSON[_0x1268('0x15')](_0x448a51));if(_0x448a51[_0x1268('0x16')]){if(_0x448a51[_0x1268('0x16')][_0x1268('0x17')]===0x1f4){logger[_0x1268('0x16')]('FaxAccount,\x20%s,\x20%s',_0x469ce8,_0x448a51['error'][_0x1268('0x18')]);return _0x24eb35(_0x448a51['error'][_0x1268('0x18')]);}logger[_0x1268('0x16')](_0x1268('0x12'),_0x469ce8,_0x448a51[_0x1268('0x16')][_0x1268('0x18')]);return _0x112dc8(_0x448a51['error'][_0x1268('0x18')]);}else{logger[_0x1268('0x19')](_0x1268('0x12'),_0x469ce8,_0x1268('0x13'));_0x112dc8(_0x448a51[_0x1268('0x1a')]['message']);}})[_0x1268('0x1b')](function(_0x2b70dd){logger[_0x1268('0x16')](_0x1268('0x12'),_0x469ce8,_0x2b70dd);_0x24eb35(_0x2b70dd);});});}exports[_0x1268('0x1c')]=function(_0x4295b1){var _0x3c777a=this;return new Promise(function(_0xd3b0dc,_0x2c35b2){return db[_0x1268('0x1d')][_0x1268('0x1e')]({'raw':_0x4295b1['options']?_0x4295b1['options']['raw']===undefined?!![]:![]:!![],'where':_0x4295b1[_0x1268('0x1f')]?_0x4295b1[_0x1268('0x1f')][_0x1268('0x20')]||null:null,'attributes':_0x4295b1[_0x1268('0x1f')]?_0x4295b1[_0x1268('0x1f')][_0x1268('0x21')]||null:null,'limit':_0x4295b1[_0x1268('0x1f')]?_0x4295b1[_0x1268('0x1f')][_0x1268('0x22')]||null:null,'include':_0x4295b1[_0x1268('0x1f')]?_0x4295b1['options'][_0x1268('0x23')]?_[_0x1268('0x24')](_0x4295b1[_0x1268('0x1f')]['include'],function(_0x41f6e1){return{'model':db[_0x41f6e1['model']],'as':_0x41f6e1['as'],'attributes':_0x41f6e1[_0x1268('0x21')],'include':_0x41f6e1[_0x1268('0x23')]?_['map'](_0x41f6e1[_0x1268('0x23')],function(_0x3d0efc){return{'model':db[_0x3d0efc[_0x1268('0x25')]],'as':_0x3d0efc['as'],'attributes':_0x3d0efc[_0x1268('0x21')],'include':_0x3d0efc['include']?_[_0x1268('0x24')](_0x3d0efc[_0x1268('0x23')],function(_0x16791f){return{'model':db[_0x16791f[_0x1268('0x25')]],'as':_0x16791f['as'],'attributes':_0x16791f['attributes']};}):[]};}):[]};}):[]:[]})[_0x1268('0x11')](function(_0x5aa2c0){logger[_0x1268('0x19')](_0x1268('0x1c'),_0x4295b1);logger[_0x1268('0x26')](_0x1268('0x1c'),_0x4295b1,JSON[_0x1268('0x15')](_0x5aa2c0));_0xd3b0dc(_0x5aa2c0);})[_0x1268('0x1b')](function(_0x3c238c){logger[_0x1268('0x16')]('GetFaxAccount',_0x3c238c['message'],_0x4295b1);_0x2c35b2(_0x3c777a[_0x1268('0x16')](0x1f4,_0x3c238c[_0x1268('0x18')]));});});};exports[_0x1268('0x27')]=function(_0x2c7229,_0x415028,_0x1b3b0e){var _0x2ff99f=this;return new Promise(function(_0x447e4a,_0x30a769){var _0xaee7e3={'body':_0x2c7229[_0x1268('0x28')],'channel':_0x1268('0x29')};var _0x224d54=[];var _0x480673=[];var _0x4b5fa8={};return db[_0x1268('0x2a')]['describe']()['then'](function(_0x1c1ddd){if(!_0x1c1ddd){throw new db[(_0x1268('0x2b'))]['ValidationError'](_0x1268('0x2c'));}_0x224d54=_[_0x1268('0x2d')](_['keys'](_0x1c1ddd),[_0x1268('0x2e'),_0x1268('0x2f')]);_0x480673=_[_0x1268('0x2d')](_['keys'](_0x1c1ddd),[_0x1268('0x2e'),'updatedAt',_0x1268('0x30'),_0x1268('0x31')]);if(_0x2c7229['body']['id']){delete _0x2c7229[_0x1268('0x28')]['id'];}if(_[_0x1268('0x32')](_0x2c7229[_0x1268('0x28')]['from'])){throw new db[(_0x1268('0x2b'))][(_0x1268('0x33'))](_0x1268('0x34'));}if(_[_0x1268('0x32')](_0x2c7229[_0x1268('0x28')][_0x1268('0x28')])||_0x2c7229['body'][_0x1268('0x28')]===''){throw new db[(_0x1268('0x2b'))][(_0x1268('0x33'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2c7229[_0x1268('0x28')][_0x1268('0x35')])){throw new db[(_0x1268('0x2b'))][(_0x1268('0x33'))](_0x1268('0x36')+_0x480673);}if(!_[_0x1268('0x37')](_0x480673,_0x2c7229[_0x1268('0x28')][_0x1268('0x35')])){throw new db[(_0x1268('0x2b'))][(_0x1268('0x33'))](_0x1268('0x38')+_0x480673);}_0x4b5fa8[_0x2c7229[_0x1268('0x28')][_0x1268('0x35')]]=_0x2c7229[_0x1268('0x28')][_0x1268('0x39')];})[_0x1268('0x11')](function(){return db['FaxAccount'][_0x1268('0x3a')]({'where':{'id':_0x2c7229[_0x1268('0x3b')]['id']},'include':[{'model':db[_0x1268('0x3c')],'as':_0x1268('0x3d'),'include':[{'model':db[_0x1268('0x2a')],'as':'Contacts','where':_0x4b5fa8,'limit':0x1,'order':[[_0x1268('0x2f'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0x1268('0x3e')}]});})['then'](function(_0xb5a3ee){if(_0xb5a3ee&&_0xb5a3ee['List']){var _0x22f72e=_0xb5a3ee['get']({'plain':!![]});_0xaee7e3['account']=_0x22f72e;_0xaee7e3[_0x1268('0x3f')]=_0x22f72e[_0x1268('0x3e')];_0xaee7e3[_0x1268('0x40')]=_0x22f72e[_0x1268('0x3d')];_0xaee7e3[_0x1268('0x3f')]=_[_0x1268('0x41')](_0xaee7e3[_0x1268('0x3f')],[_0x1268('0x42')],[_0x1268('0x43')]);if(_0xaee7e3[_0x1268('0x3b')][_0x1268('0x3e')]){delete _0xaee7e3[_0x1268('0x3b')]['Applications'];}if(_0xaee7e3['account']['List']&&_0xaee7e3[_0x1268('0x3b')][_0x1268('0x3d')]['Contacts']['length']){return _0xaee7e3[_0x1268('0x3b')][_0x1268('0x3d')][_0x1268('0x44')][0x0];}var _0x16e081=_[_0x1268('0x45')](_0x2c7229[_0x1268('0x28')],{'firstName':_0x2c7229['body'][_0x1268('0x39')],'ListId':_0x22f72e[_0x1268('0x31')]});_0x16e081[_0x2c7229[_0x1268('0x28')][_0x1268('0x35')]]=_0x2c7229[_0x1268('0x28')][_0x1268('0x39')];return db[_0x1268('0x2a')][_0x1268('0x46')](_0x16e081,{'fields':_0x224d54,'raw':!![]});}})[_0x1268('0x11')](function(_0x1f78f4){_0xaee7e3[_0x1268('0x47')]=_0x1f78f4;if(_0x1f78f4){var _0x131d91={'ContactId':_0x1f78f4['id'],'FaxAccountId':_0x2c7229[_0x1268('0x3b')]['id'],'fax':_0x1f78f4['fax']};return db[_0x1268('0x48')][_0x1268('0x3a')]({'where':{'ContactId':_0x1f78f4['id'],'closed':![],'FaxAccountId':_0x2c7229[_0x1268('0x3b')]['id']}})['then'](function(_0x46bf82){if(_0x46bf82){return[_0x46bf82,![]];}return db[_0x1268('0x48')][_0x1268('0x46')](_0x131d91)[_0x1268('0x11')](function(_0x5c326c){return[_0x5c326c,!![]];});});}else{throw new Error(_0x1268('0x49'));}})['spread'](function(_0x12dd02,_0x58daae){var _0x4ebfdd=_0x12dd02['get']({'plain':!![]});if(_0x58daae){if(_0xaee7e3[_0x1268('0x3b')][_0x1268('0x4a')]){_0xaee7e3[_0x1268('0x3f')]['push']({'id':0x0,'priority':_0xaee7e3[_0x1268('0x3f')]['length']+0x1,'app':_0x1268('0x4b'),'appdata':_0x1268('0x4c'),'interval':'*,*,*,*'});}_0x4ebfdd[_0x1268('0x4d')]=!![];}else{_0x4ebfdd[_0x1268('0x4d')]=![];}_0xaee7e3[_0x1268('0x4e')]=_0x4ebfdd;return db[_0x1268('0x4f')][_0x1268('0x46')]({'body':_0x2c7229[_0x1268('0x28')][_0x1268('0x28')],'FaxAccountId':_0x2c7229['account']['id'],'FaxInteractionId':_0x12dd02['id'],'direction':'in','ContactId':_0x12dd02[_0x1268('0x50')],'AttachmentId':_0x2c7229['body']['AttachmentId']});})[_0x1268('0x11')](function(_0x49c40e){_0xaee7e3[_0x1268('0x18')]=_0x49c40e;if(!_0xaee7e3['interaction'][_0x1268('0x51')])return;return db[_0x1268('0x52')]['find']({'attributes':['id',_0x1268('0x53')],'where':{'id':_0xaee7e3[_0x1268('0x4e')][_0x1268('0x51')]}});})[_0x1268('0x11')](function(_0x4b8f64){if(_0x4b8f64){_0xaee7e3[_0x1268('0x3f')][_0x1268('0x54')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4b8f64[_0x1268('0x53')]+','+(_0xaee7e3[_0x1268('0x3b')][_0x1268('0x55')]||0xa),'interval':_0x1268('0x56')});}if(!_0xaee7e3['interaction'][_0x1268('0x57')])return;return db[_0x1268('0x58')]['find']({'attributes':['id','name'],'where':{'id':_0xaee7e3[_0x1268('0x4e')][_0x1268('0x57')]}});})[_0x1268('0x11')](function(_0x365b44){if(_0x365b44){_0xaee7e3[_0x1268('0x3f')]['unshift']({'id':0x0,'priority':0x1,'app':_0x1268('0x59'),'appdata':_0x365b44[_0x1268('0x53')]+','+(_0xaee7e3[_0x1268('0x3b')][_0x1268('0x5a')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x1268('0x5b'),_0xaee7e3);})[_0x1268('0x11')](function(_0x3f04a0){_0x447e4a(_0x3f04a0);})[_0x1268('0x1b')](function(_0x1ae4e2){_0x30a769(_0x2ff99f[_0x1268('0x16')](0x1f4,_0x1ae4e2[_0x1268('0x18')]));});});}; \ No newline at end of file +var _0x641e=['info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','CompanyId','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','then','find','account','CmList','List','DESC','FaxApplication','get','applications','orderBy','asc','Applications','Contacts','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','UserId','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue','queue','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x641e,0x116));var _0xe641=function(_0x429c0c,_0x560f5b){_0x429c0c=_0x429c0c-0x0;var _0x45c8a5=_0x641e[_0x429c0c];return _0x45c8a5;};'use strict';var _=require(_0xe641('0x0'));var util=require(_0xe641('0x1'));var moment=require(_0xe641('0x2'));var BPromise=require(_0xe641('0x3'));var rs=require(_0xe641('0x4'));var fs=require('fs');var Redis=require(_0xe641('0x5'));var db=require(_0xe641('0x6'))['db'];var utils=require(_0xe641('0x7'));var logger=require(_0xe641('0x8'))(_0xe641('0x9'));var config=require(_0xe641('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe641('0xb')][_0xe641('0xc')]({'port':0x232c});config[_0xe641('0xd')]=_[_0xe641('0xe')](config[_0xe641('0xd')],{'host':_0xe641('0xf'),'port':0x18eb});var socket=require(_0xe641('0x10'))(new Redis(config['redis']));require(_0xe641('0x11'))[_0xe641('0x12')](socket);function respondWithRpcPromise(_0x3b4fd1,_0x2a46f,_0x5cd828){return new BPromise(function(_0x172ef8,_0x406876){return client['request'](_0x3b4fd1,_0x5cd828)['then'](function(_0x133552){logger[_0xe641('0x13')](_0xe641('0x14'),_0x2a46f,_0xe641('0x15'));logger[_0xe641('0x16')](_0xe641('0x17'),_0x2a46f,'request\x20sent',JSON[_0xe641('0x18')](_0x133552));if(_0x133552[_0xe641('0x19')]){if(_0x133552[_0xe641('0x19')][_0xe641('0x1a')]===0x1f4){logger['error'](_0xe641('0x14'),_0x2a46f,_0x133552['error'][_0xe641('0x1b')]);return _0x406876(_0x133552[_0xe641('0x19')]['message']);}logger['error'](_0xe641('0x14'),_0x2a46f,_0x133552[_0xe641('0x19')][_0xe641('0x1b')]);return _0x172ef8(_0x133552[_0xe641('0x19')][_0xe641('0x1b')]);}else{logger[_0xe641('0x13')]('FaxAccount,\x20%s,\x20%s',_0x2a46f,_0xe641('0x15'));_0x172ef8(_0x133552[_0xe641('0x1c')][_0xe641('0x1b')]);}})[_0xe641('0x1d')](function(_0xd68334){logger[_0xe641('0x19')](_0xe641('0x14'),_0x2a46f,_0xd68334);_0x406876(_0xd68334);});});}exports[_0xe641('0x1e')]=function(_0xba2acf){var _0x7c6b17=this;return new Promise(function(_0x2402c6,_0x56c7c7){return db[_0xe641('0x1f')][_0xe641('0x20')]({'raw':_0xba2acf[_0xe641('0x21')]?_0xba2acf[_0xe641('0x21')][_0xe641('0x22')]===undefined?!![]:![]:!![],'where':_0xba2acf[_0xe641('0x21')]?_0xba2acf['options']['where']||null:null,'attributes':_0xba2acf[_0xe641('0x21')]?_0xba2acf['options'][_0xe641('0x23')]||null:null,'limit':_0xba2acf[_0xe641('0x21')]?_0xba2acf[_0xe641('0x21')][_0xe641('0x24')]||null:null,'include':_0xba2acf[_0xe641('0x21')]?_0xba2acf[_0xe641('0x21')][_0xe641('0x25')]?_[_0xe641('0x26')](_0xba2acf[_0xe641('0x21')][_0xe641('0x25')],function(_0x53146){return{'model':db[_0x53146['model']],'as':_0x53146['as'],'attributes':_0x53146[_0xe641('0x23')],'include':_0x53146['include']?_['map'](_0x53146[_0xe641('0x25')],function(_0x5df815){return{'model':db[_0x5df815[_0xe641('0x27')]],'as':_0x5df815['as'],'attributes':_0x5df815[_0xe641('0x23')],'include':_0x5df815[_0xe641('0x25')]?_['map'](_0x5df815[_0xe641('0x25')],function(_0x15fce6){return{'model':db[_0x15fce6[_0xe641('0x27')]],'as':_0x15fce6['as'],'attributes':_0x15fce6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x405aad){logger[_0xe641('0x13')](_0xe641('0x1e'),_0xba2acf);logger['debug'](_0xe641('0x1e'),_0xba2acf,JSON['stringify'](_0x405aad));_0x2402c6(_0x405aad);})[_0xe641('0x1d')](function(_0xfe6fe7){logger['error']('GetFaxAccount',_0xfe6fe7[_0xe641('0x1b')],_0xba2acf);_0x56c7c7(_0x7c6b17[_0xe641('0x19')](0x1f4,_0xfe6fe7[_0xe641('0x1b')]));});});};exports[_0xe641('0x28')]=function(_0x5a10db,_0x187fa7,_0x277300){var _0x36758d=this;return new Promise(function(_0x56fef6,_0x5f13c7){var _0x2984b5={'body':_0x5a10db[_0xe641('0x29')],'channel':'fax'};var _0x57ef25=[];var _0x994ed=[];var _0x3e68a0={};return db[_0xe641('0x2a')][_0xe641('0x2b')]()['then'](function(_0x3c9d9f){if(!_0x3c9d9f){throw new db[(_0xe641('0x2c'))][(_0xe641('0x2d'))](_0xe641('0x2e'));}_0x57ef25=_[_0xe641('0x2f')](_[_0xe641('0x30')](_0x3c9d9f),['createdAt',_0xe641('0x31')]);_0x994ed=_[_0xe641('0x2f')](_['keys'](_0x3c9d9f),[_0xe641('0x32'),_0xe641('0x31'),_0xe641('0x33'),_0xe641('0x34')]);if(_0x5a10db[_0xe641('0x29')]['id']){delete _0x5a10db[_0xe641('0x29')]['id'];}if(_['isNil'](_0x5a10db[_0xe641('0x29')]['from'])){throw new db[(_0xe641('0x2c'))][(_0xe641('0x2d'))](_0xe641('0x35'));}if(_[_0xe641('0x36')](_0x5a10db[_0xe641('0x29')][_0xe641('0x29')])||_0x5a10db[_0xe641('0x29')][_0xe641('0x29')]===''){throw new db['Sequelize'][(_0xe641('0x2d'))](_0xe641('0x37'));}if(_['isNil'](_0x5a10db[_0xe641('0x29')][_0xe641('0x38')])){throw new db[(_0xe641('0x2c'))]['ValidationError'](_0xe641('0x39')+_0x994ed);}if(!_[_0xe641('0x3a')](_0x994ed,_0x5a10db[_0xe641('0x29')]['mapKey'])){throw new db[(_0xe641('0x2c'))]['ValidationError'](_0xe641('0x3b')+_0x994ed);}_0x3e68a0[_0x5a10db[_0xe641('0x29')][_0xe641('0x38')]]=_0x5a10db[_0xe641('0x29')][_0xe641('0x3c')];})[_0xe641('0x3d')](function(){return db[_0xe641('0x1f')][_0xe641('0x3e')]({'where':{'id':_0x5a10db[_0xe641('0x3f')]['id']},'include':[{'model':db[_0xe641('0x40')],'as':_0xe641('0x41'),'include':[{'model':db[_0xe641('0x2a')],'as':'Contacts','where':_0x3e68a0,'limit':0x1,'order':[[_0xe641('0x31'),_0xe641('0x42')]]}]},{'model':db[_0xe641('0x43')],'as':'Applications'}]});})[_0xe641('0x3d')](function(_0x37c6e1){if(_0x37c6e1&&_0x37c6e1[_0xe641('0x41')]){var _0x37f7ac=_0x37c6e1[_0xe641('0x44')]({'plain':!![]});_0x2984b5['account']=_0x37f7ac;_0x2984b5[_0xe641('0x45')]=_0x37f7ac['Applications'];_0x2984b5['list']=_0x37f7ac['List'];_0x2984b5[_0xe641('0x45')]=_[_0xe641('0x46')](_0x2984b5[_0xe641('0x45')],['priority'],[_0xe641('0x47')]);if(_0x2984b5[_0xe641('0x3f')][_0xe641('0x48')]){delete _0x2984b5['account'][_0xe641('0x48')];}if(_0x2984b5[_0xe641('0x3f')][_0xe641('0x41')]&&_0x2984b5[_0xe641('0x3f')][_0xe641('0x41')][_0xe641('0x49')][_0xe641('0x4a')]){return _0x2984b5[_0xe641('0x3f')][_0xe641('0x41')][_0xe641('0x49')][0x0];}var _0x4862af=_['defaults'](_0x5a10db[_0xe641('0x29')],{'firstName':_0x5a10db[_0xe641('0x29')][_0xe641('0x3c')],'ListId':_0x37f7ac[_0xe641('0x34')]});_0x4862af[_0x5a10db[_0xe641('0x29')][_0xe641('0x38')]]=_0x5a10db['body'][_0xe641('0x3c')];return db[_0xe641('0x2a')][_0xe641('0x4b')](_0x4862af,{'fields':_0x57ef25,'raw':!![]});}})[_0xe641('0x3d')](function(_0x246752){_0x2984b5[_0xe641('0x4c')]=_0x246752;if(_0x246752){var _0x3efd8d={'ContactId':_0x246752['id'],'FaxAccountId':_0x5a10db['account']['id'],'fax':_0x246752['fax']};return db['FaxInteraction'][_0xe641('0x3e')]({'where':{'ContactId':_0x246752['id'],'closed':![],'FaxAccountId':_0x5a10db[_0xe641('0x3f')]['id']}})[_0xe641('0x3d')](function(_0x3581b2){if(_0x3581b2){return[_0x3581b2,![]];}return db[_0xe641('0x4d')][_0xe641('0x4b')](_0x3efd8d)['then'](function(_0x34e05e){return[_0x34e05e,!![]];});});}else{throw new Error(_0xe641('0x4e'));}})[_0xe641('0x4f')](function(_0x2967e0,_0x1652d2){var _0x4993b8=_0x2967e0[_0xe641('0x44')]({'plain':!![]});if(_0x1652d2){if(_0x2984b5[_0xe641('0x3f')][_0xe641('0x50')]){_0x2984b5[_0xe641('0x45')][_0xe641('0x51')]({'id':0x0,'priority':_0x2984b5[_0xe641('0x45')][_0xe641('0x4a')]+0x1,'app':'close','appdata':_0xe641('0x52'),'interval':_0xe641('0x53')});}_0x4993b8[_0xe641('0x54')]=!![];}else{_0x4993b8['created']=![];}_0x2984b5[_0xe641('0x55')]=_0x4993b8;return db[_0xe641('0x56')][_0xe641('0x4b')]({'body':_0x5a10db[_0xe641('0x29')][_0xe641('0x29')],'FaxAccountId':_0x5a10db['account']['id'],'FaxInteractionId':_0x2967e0['id'],'direction':'in','ContactId':_0x2967e0[_0xe641('0x57')],'AttachmentId':_0x5a10db[_0xe641('0x29')][_0xe641('0x58')]});})[_0xe641('0x3d')](function(_0x51e7d6){_0x2984b5['message']=_0x51e7d6;if(!_0x2984b5[_0xe641('0x55')]['UserId'])return;return db[_0xe641('0x59')][_0xe641('0x3e')]({'attributes':['id',_0xe641('0x5a')],'where':{'id':_0x2984b5['interaction'][_0xe641('0x5b')]}});})[_0xe641('0x3d')](function(_0x5eeeb1){if(_0x5eeeb1){_0x2984b5[_0xe641('0x45')][_0xe641('0x5c')]({'id':0x0,'priority':0x0,'app':_0xe641('0x5d'),'appdata':_0x5eeeb1[_0xe641('0x5a')]+','+(_0x2984b5[_0xe641('0x3f')][_0xe641('0x5e')]||0xa),'interval':_0xe641('0x53')});}if(!_0x2984b5['interaction'][_0xe641('0x5f')])return;return db[_0xe641('0x60')]['find']({'attributes':['id',_0xe641('0x5a')],'where':{'id':_0x2984b5['interaction'][_0xe641('0x5f')]}});})[_0xe641('0x3d')](function(_0x5c44bf){if(_0x5c44bf){_0x2984b5[_0xe641('0x45')]['unshift']({'id':0x0,'priority':0x1,'app':_0xe641('0x61'),'appdata':_0x5c44bf[_0xe641('0x5a')]+','+(_0x2984b5[_0xe641('0x3f')]['waitForTheAssignedQueue']||0x12c),'interval':_0xe641('0x53')});}return respondWithRpcPromise(_0xe641('0x62'),'startRouting',_0x2984b5);})[_0xe641('0x3d')](function(_0xd6b443){_0x56fef6(_0xd6b443);})[_0xe641('0x1d')](function(_0x549b77){_0x5f13c7(_0x36758d[_0xe641('0x19')](0x1f4,_0x549b77[_0xe641('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 47fb6c4..5c308c4 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 _0x491d=['update','emit','removeListener','register','length','faxAccount:','save','remove'];(function(_0x1a5a6f,_0x22f693){var _0x2f16cb=function(_0x3e1ecf){while(--_0x3e1ecf){_0x1a5a6f['push'](_0x1a5a6f['shift']());}};_0x2f16cb(++_0x22f693);}(_0x491d,0x166));var _0xd491=function(_0x1a3bf0,_0x53a4d6){_0x1a3bf0=_0x1a3bf0-0x0;var _0x5aef6b=_0x491d[_0x1a3bf0];return _0x5aef6b;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xd491('0x0'),_0xd491('0x1'),_0xd491('0x2')];function createListener(_0x161bed,_0x282d7f){return function(_0x2e40b1){_0x282d7f[_0xd491('0x3')](_0x161bed,_0x2e40b1);};}function removeListener(_0x2016e7,_0x57c4bc){return function(){FaxAccountEvents[_0xd491('0x4')](_0x2016e7,_0x57c4bc);};}exports[_0xd491('0x5')]=function(_0x111536){for(var _0x18a8b4=0x0,_0xc81736=events[_0xd491('0x6')];_0x18a8b4<_0xc81736;_0x18a8b4++){var _0x458d1d=events[_0x18a8b4];var _0x5da0ce=createListener(_0xd491('0x7')+_0x458d1d,_0x111536);FaxAccountEvents['on'](_0x458d1d,_0x5da0ce);}}; \ No newline at end of file +var _0xa2d2=['update','emit','removeListener','register','length','faxAccount:','save','remove'];(function(_0x4d5294,_0x5282f8){var _0x29db88=function(_0xc59804){while(--_0xc59804){_0x4d5294['push'](_0x4d5294['shift']());}};_0x29db88(++_0x5282f8);}(_0xa2d2,0x8e));var _0x2a2d=function(_0x3b0b09,_0x2ac0e8){_0x3b0b09=_0x3b0b09-0x0;var _0x2bba6d=_0xa2d2[_0x3b0b09];return _0x2bba6d;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x2a2d('0x0'),_0x2a2d('0x1'),_0x2a2d('0x2')];function createListener(_0x28f655,_0x5c53d6){return function(_0x2cbfbf){_0x5c53d6[_0x2a2d('0x3')](_0x28f655,_0x2cbfbf);};}function removeListener(_0x165b62,_0x1eb74b){return function(){FaxAccountEvents[_0x2a2d('0x4')](_0x165b62,_0x1eb74b);};}exports[_0x2a2d('0x5')]=function(_0xdd1ec2){for(var _0x54ea75=0x0,_0x4f6e31=events[_0x2a2d('0x6')];_0x54ea75<_0x4f6e31;_0x54ea75++){var _0x303c3d=events[_0x54ea75];var _0x45ddce=createListener(_0x2a2d('0x7')+_0x303c3d,_0xdd1ec2);FaxAccountEvents['on'](_0x303c3d,_0x45ddce);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 6d191e3..b384ebf 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 _0x531b=['getAnswers','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','/:id/dispositions','addAnswer','/:id/interactions','addInteraction','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','/:id/send','send','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','describe','/:id','show','getDispositions','/:id/canned_answers'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0x531b,0x1a7));var _0xb531=function(_0x1fa226,_0x575465){_0x1fa226=_0x1fa226-0x0;var _0x3579a6=_0x531b[_0x1fa226];return _0x3579a6;};'use strict';var multer=require(_0xb531('0x0'));var util=require(_0xb531('0x1'));var path=require(_0xb531('0x2'));var timeout=require(_0xb531('0x3'));var express=require(_0xb531('0x4'));var router=express['Router']();var fs_extra=require(_0xb531('0x5'));var auth=require(_0xb531('0x6'));var interaction=require(_0xb531('0x7'));var config=require(_0xb531('0x8'));var controller=require(_0xb531('0x9'));router[_0xb531('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb531('0xa')]('/describe',auth[_0xb531('0xb')](),controller[_0xb531('0xc')]);router[_0xb531('0xa')](_0xb531('0xd'),auth['isAuthenticated'](),controller[_0xb531('0xe')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xb531('0xf')]);router['get'](_0xb531('0x10'),auth[_0xb531('0xb')](),controller[_0xb531('0x11')]);router[_0xb531('0xa')]('/:id/interactions',auth[_0xb531('0xb')](),controller[_0xb531('0x12')]);router[_0xb531('0xa')](_0xb531('0x13'),auth['isAuthenticated'](),controller[_0xb531('0x14')]);router[_0xb531('0xa')](_0xb531('0x15'),auth[_0xb531('0xb')](),controller[_0xb531('0x16')]);router[_0xb531('0xa')](_0xb531('0x17'),auth[_0xb531('0xb')](),controller[_0xb531('0x18')]);router[_0xb531('0x19')]('/',auth[_0xb531('0xb')](),controller[_0xb531('0x1a')]);router[_0xb531('0x19')](_0xb531('0x1b'),auth[_0xb531('0xb')](),controller['addDisposition']);router[_0xb531('0x19')](_0xb531('0x10'),auth[_0xb531('0xb')](),controller[_0xb531('0x1c')]);router[_0xb531('0x19')](_0xb531('0x1d'),auth[_0xb531('0xb')](),controller[_0xb531('0x1e')]);router[_0xb531('0x19')]('/:id/applications',auth[_0xb531('0xb')](),controller[_0xb531('0x1f')]);router[_0xb531('0x19')](_0xb531('0x20'),auth[_0xb531('0xb')](),controller[_0xb531('0x21')]);router[_0xb531('0x19')]('/updateaccountapplications',auth['isAuthenticated'](),controller[_0xb531('0x22')]);router['post'](_0xb531('0x23'),auth['isAuthenticated'](),controller[_0xb531('0x24')]);router['post'](_0xb531('0x17'),auth['isAuthenticated'](),controller[_0xb531('0x25')]);router[_0xb531('0x26')](_0xb531('0xd'),auth[_0xb531('0xb')](),controller[_0xb531('0x27')]);router[_0xb531('0x28')](_0xb531('0xd'),auth['isAuthenticated'](),controller[_0xb531('0x29')]);router['delete'](_0xb531('0x1b'),auth[_0xb531('0xb')](),controller[_0xb531('0x2a')]);router[_0xb531('0x28')](_0xb531('0x10'),auth[_0xb531('0xb')](),controller[_0xb531('0x2b')]);router[_0xb531('0x28')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x9e94=['/:id/messages','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/interactions','addInteraction','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','put','delete','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/canned_answers','getAnswers','getInteractions'];(function(_0x366dc1,_0x7be09b){var _0x315490=function(_0x2fd206){while(--_0x2fd206){_0x366dc1['push'](_0x366dc1['shift']());}};_0x315490(++_0x7be09b);}(_0x9e94,0xe0));var _0x49e9=function(_0xa8f038,_0x4029ba){_0xa8f038=_0xa8f038-0x0;var _0x48ecf5=_0x9e94[_0xa8f038];return _0x48ecf5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49e9('0x0'));var timeout=require('connect-timeout');var express=require(_0x49e9('0x1'));var router=express[_0x49e9('0x2')]();var fs_extra=require(_0x49e9('0x3'));var auth=require(_0x49e9('0x4'));var interaction=require(_0x49e9('0x5'));var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0x49e9('0x6')]('/',auth['isAuthenticated'](),controller[_0x49e9('0x7')]);router[_0x49e9('0x6')](_0x49e9('0x8'),auth[_0x49e9('0x9')](),controller[_0x49e9('0xa')]);router['get'](_0x49e9('0xb'),auth[_0x49e9('0x9')](),controller[_0x49e9('0xc')]);router[_0x49e9('0x6')]('/:id/dispositions',auth[_0x49e9('0x9')](),controller['getDispositions']);router[_0x49e9('0x6')](_0x49e9('0xd'),auth['isAuthenticated'](),controller[_0x49e9('0xe')]);router['get']('/:id/interactions',auth[_0x49e9('0x9')](),controller[_0x49e9('0xf')]);router[_0x49e9('0x6')]('/:id/applications',auth[_0x49e9('0x9')](),controller['getApplications']);router[_0x49e9('0x6')](_0x49e9('0x10'),auth[_0x49e9('0x9')](),controller['getMessages']);router[_0x49e9('0x6')](_0x49e9('0x11'),auth[_0x49e9('0x9')](),controller[_0x49e9('0x12')]);router[_0x49e9('0x13')]('/',auth[_0x49e9('0x9')](),controller[_0x49e9('0x14')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x49e9('0x15')]);router['post'](_0x49e9('0xd'),auth[_0x49e9('0x9')](),controller[_0x49e9('0x16')]);router[_0x49e9('0x13')](_0x49e9('0x17'),auth[_0x49e9('0x9')](),controller[_0x49e9('0x18')]);router['post'](_0x49e9('0x19'),auth['isAuthenticated'](),controller[_0x49e9('0x1a')]);router['post'](_0x49e9('0x1b'),auth['isAuthenticated'](),controller[_0x49e9('0x1c')]);router[_0x49e9('0x13')](_0x49e9('0x1d'),auth[_0x49e9('0x9')](),controller[_0x49e9('0x1e')]);router['post'](_0x49e9('0x1f'),auth['isAuthenticated'](),controller[_0x49e9('0x20')]);router[_0x49e9('0x13')](_0x49e9('0x11'),auth[_0x49e9('0x9')](),controller['addAgents']);router[_0x49e9('0x21')]('/:id',auth[_0x49e9('0x9')](),controller['update']);router[_0x49e9('0x22')](_0x49e9('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x49e9('0x22')](_0x49e9('0x23'),auth[_0x49e9('0x9')](),controller[_0x49e9('0x24')]);router[_0x49e9('0x22')](_0x49e9('0xd'),auth[_0x49e9('0x9')](),controller[_0x49e9('0x25')]);router[_0x49e9('0x22')](_0x49e9('0x11'),auth[_0x49e9('0x9')](),controller[_0x49e9('0x26')]);module[_0x49e9('0x27')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 64bb397..5f4e5b6 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 _0x53a8=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x554b32,_0x577efd){var _0x2d896d=function(_0x2f4a14){while(--_0x2f4a14){_0x554b32['push'](_0x554b32['shift']());}};_0x2d896d(++_0x577efd);}(_0x53a8,0xe3));var _0x853a=function(_0x4af868,_0x4aad24){_0x4af868=_0x4af868-0x0;var _0x330f6b=_0x53a8[_0x4af868];return _0x330f6b;};'use strict';var Sequelize=require(_0x853a('0x0'));module[_0x853a('0x1')]={'priority':{'type':Sequelize[_0x853a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x853a('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x853a('0x4')]()},'description':{'type':Sequelize[_0x853a('0x3')]},'interval':{'type':Sequelize[_0x853a('0x3')],'defaultValue':_0x853a('0x5')}}; \ No newline at end of file +var _0x414a=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x1dc73e,_0x792805){var _0x35274b=function(_0x364508){while(--_0x364508){_0x1dc73e['push'](_0x1dc73e['shift']());}};_0x35274b(++_0x792805);}(_0x414a,0xc0));var _0xa414=function(_0x171831,_0x5cbeaf){_0x171831=_0x171831-0x0;var _0x23a2a5=_0x414a[_0x171831];return _0x23a2a5;};'use strict';var Sequelize=require(_0xa414('0x0'));module[_0xa414('0x1')]={'priority':{'type':Sequelize[_0xa414('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa414('0x3')],'allowNull':![],'defaultValue':_0xa414('0x4')},'appdata':{'type':Sequelize[_0xa414('0x5')]()},'description':{'type':Sequelize[_0xa414('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 909264d..dc666a5 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 _0x3fcd=['key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','FaxApplication','includeAll','findAll','params','include','options','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','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','undefined','limit','count','offset','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes'];(function(_0x2fee96,_0x2f735d){var _0x2e6ad1=function(_0x2c55ad){while(--_0x2c55ad){_0x2fee96['push'](_0x2fee96['shift']());}};_0x2e6ad1(++_0x2f735d);}(_0x3fcd,0x1d8));var _0xd3fc=function(_0x4287f9,_0x221e81){_0x4287f9=_0x4287f9-0x0;var _0x340bf8=_0x3fcd[_0x4287f9];return _0x340bf8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd3fc('0x0'));var zipdir=require(_0xd3fc('0x1'));var jsonpatch=require(_0xd3fc('0x2'));var rp=require(_0xd3fc('0x3'));var moment=require('moment');var BPromise=require(_0xd3fc('0x4'));var Mustache=require(_0xd3fc('0x5'));var util=require('util');var path=require(_0xd3fc('0x6'));var sox=require(_0xd3fc('0x7'));var csv=require(_0xd3fc('0x8'));var ejs=require(_0xd3fc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd3fc('0xa'));var squel=require(_0xd3fc('0xb'));var crypto=require(_0xd3fc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd3fc('0xd'));var toCsv=require(_0xd3fc('0x8'));var querystring=require(_0xd3fc('0xe'));var Papa=require(_0xd3fc('0xf'));var Redis=require(_0xd3fc('0x10'));var authService=require(_0xd3fc('0x11'));var qs=require(_0xd3fc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3fc('0x13'))(_0xd3fc('0x14'));var utils=require(_0xd3fc('0x15'));var config=require(_0xd3fc('0x16'));var licenseUtil=require(_0xd3fc('0x17'));var db=require(_0xd3fc('0x18'))['db'];function respondWithStatusCode(_0x1014b2,_0x535bcb){_0x535bcb=_0x535bcb||0xcc;return function(_0x4ed3fe){if(_0x4ed3fe){return _0x1014b2[_0xd3fc('0x19')](_0x535bcb);}return _0x1014b2[_0xd3fc('0x1a')](_0x535bcb)[_0xd3fc('0x1b')]();};}function respondWithResult(_0xb9d148,_0x57f8b1){_0x57f8b1=_0x57f8b1||0xc8;return function(_0x2c362d){if(_0x2c362d){return _0xb9d148[_0xd3fc('0x1a')](_0x57f8b1)['json'](_0x2c362d);}};}function respondWithFilteredResult(_0xa50909,_0x541ab3){return function(_0x2c1537){if(_0x2c1537){var _0x530304=typeof _0x541ab3['offset']===_0xd3fc('0x1c')&&typeof _0x541ab3[_0xd3fc('0x1d')]===_0xd3fc('0x1c');var _0x333aed=_0x2c1537[_0xd3fc('0x1e')];var _0x47dd3f=_0x530304?0x0:_0x541ab3[_0xd3fc('0x1f')];var _0x682e84=_0x530304?_0x2c1537[_0xd3fc('0x1e')]:_0x541ab3[_0xd3fc('0x1f')]+_0x541ab3['limit'];var _0x523251;if(_0x682e84>=_0x333aed){_0x682e84=_0x333aed;_0x523251=0xc8;}else{_0x523251=0xce;}_0xa50909[_0xd3fc('0x1a')](_0x523251);return _0xa50909['set']('Content-Range',_0x47dd3f+'-'+_0x682e84+'/'+_0x333aed)[_0xd3fc('0x20')](_0x2c1537);}return null;};}function patchUpdates(_0x58cb75){return function(_0x29d3a9){try{jsonpatch[_0xd3fc('0x21')](_0x29d3a9,_0x58cb75,!![]);}catch(_0x5d397e){return BPromise[_0xd3fc('0x22')](_0x5d397e);}return _0x29d3a9[_0xd3fc('0x23')]();};}function saveUpdates(_0x47a037,_0x26d3fd){return function(_0x3ea52e){if(_0x3ea52e){return _0x3ea52e[_0xd3fc('0x24')](_0x47a037)[_0xd3fc('0x25')](function(_0x1e82a2){return _0x1e82a2;});}return null;};}function removeEntity(_0x3ff756,_0xde018){return function(_0xfbc5cb){if(_0xfbc5cb){return _0xfbc5cb[_0xd3fc('0x26')]()[_0xd3fc('0x25')](function(){_0x3ff756['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4abf37,_0x3edc3d){return function(_0x372c4c){if(!_0x372c4c){_0x4abf37[_0xd3fc('0x19')](0x194);}return _0x372c4c;};}function handleError(_0x184d8e,_0x18b39f){_0x18b39f=_0x18b39f||0x1f4;return function(_0x1459c6){logger[_0xd3fc('0x27')](_0x1459c6[_0xd3fc('0x28')]);if(_0x1459c6['name']){delete _0x1459c6[_0xd3fc('0x29')];}_0x184d8e[_0xd3fc('0x1a')](_0x18b39f)[_0xd3fc('0x2a')](_0x1459c6);};}exports[_0xd3fc('0x2b')]=function(_0x56ce53,_0x315aa6){var _0x30e6df={},_0x5bad46={},_0xa809c3={'count':0x0,'rows':[]};var _0x46b1b6=_[_0xd3fc('0x2c')](db['FaxApplication'][_0xd3fc('0x2d')],function(_0x205e7d){return{'name':_0x205e7d['fieldName'],'type':_0x205e7d['type'][_0xd3fc('0x2e')]};});_0x5bad46[_0xd3fc('0x2f')]=_[_0xd3fc('0x2c')](_0x46b1b6,_0xd3fc('0x29'));_0x5bad46['query']=_[_0xd3fc('0x30')](_0x56ce53['query']);_0x5bad46[_0xd3fc('0x31')]=_[_0xd3fc('0x32')](_0x5bad46[_0xd3fc('0x2f')],_0x5bad46[_0xd3fc('0x33')]);_0x30e6df[_0xd3fc('0x34')]=_[_0xd3fc('0x32')](_0x5bad46[_0xd3fc('0x2f')],qs[_0xd3fc('0x35')](_0x56ce53[_0xd3fc('0x33')][_0xd3fc('0x35')]));_0x30e6df[_0xd3fc('0x34')]=_0x30e6df[_0xd3fc('0x34')][_0xd3fc('0x36')]?_0x30e6df[_0xd3fc('0x34')]:_0x5bad46['model'];if(!_0x56ce53[_0xd3fc('0x33')][_0xd3fc('0x37')](_0xd3fc('0x38'))){_0x30e6df[_0xd3fc('0x1d')]=qs[_0xd3fc('0x1d')](_0x56ce53[_0xd3fc('0x33')][_0xd3fc('0x1d')]);_0x30e6df['offset']=qs['offset'](_0x56ce53[_0xd3fc('0x33')]['offset']);}_0x30e6df['order']=qs['sort'](_0x56ce53[_0xd3fc('0x33')][_0xd3fc('0x39')]);_0x30e6df[_0xd3fc('0x3a')]=qs[_0xd3fc('0x31')](_[_0xd3fc('0x3b')](_0x56ce53['query'],_0x5bad46['filters']),_0x46b1b6);if(_0x56ce53[_0xd3fc('0x33')][_0xd3fc('0x3c')]){_0x30e6df['where']=_[_0xd3fc('0x3d')](_0x30e6df[_0xd3fc('0x3a')],{'$or':_[_0xd3fc('0x2c')](_0x46b1b6,function(_0x1dcb00){if(_0x1dcb00[_0xd3fc('0x3e')]!==_0xd3fc('0x3f')){var _0x291c7e={};_0x291c7e[_0x1dcb00[_0xd3fc('0x29')]]={'$like':'%'+_0x56ce53['query'][_0xd3fc('0x3c')]+'%'};return _0x291c7e;}})});}_0x30e6df=_[_0xd3fc('0x3d')]({},_0x30e6df,_0x56ce53['options']);var _0x3e9ea7={'where':_0x30e6df[_0xd3fc('0x3a')]};return db[_0xd3fc('0x40')][_0xd3fc('0x1e')](_0x3e9ea7)[_0xd3fc('0x25')](function(_0x12d7c6){_0xa809c3[_0xd3fc('0x1e')]=_0x12d7c6;if(_0x56ce53[_0xd3fc('0x33')][_0xd3fc('0x41')]){_0x30e6df['include']=[{'all':!![]}];}return db[_0xd3fc('0x40')][_0xd3fc('0x42')](_0x30e6df);})[_0xd3fc('0x25')](function(_0x3d8d6d){_0xa809c3['rows']=_0x3d8d6d;return _0xa809c3;})['then'](respondWithFilteredResult(_0x315aa6,_0x30e6df))['catch'](handleError(_0x315aa6,null));};exports['show']=function(_0x1c052a,_0x3e8df4){var _0x5296bf={'raw':!![],'where':{'id':_0x1c052a[_0xd3fc('0x43')]['id']}},_0x4cbb6f={};_0x4cbb6f[_0xd3fc('0x2f')]=_['keys'](db[_0xd3fc('0x40')][_0xd3fc('0x2d')]);_0x4cbb6f[_0xd3fc('0x33')]=_[_0xd3fc('0x30')](_0x1c052a[_0xd3fc('0x33')]);_0x4cbb6f['filters']=_[_0xd3fc('0x32')](_0x4cbb6f[_0xd3fc('0x2f')],_0x4cbb6f[_0xd3fc('0x33')]);_0x5296bf[_0xd3fc('0x34')]=_[_0xd3fc('0x32')](_0x4cbb6f['model'],qs[_0xd3fc('0x35')](_0x1c052a[_0xd3fc('0x33')][_0xd3fc('0x35')]));_0x5296bf['attributes']=_0x5296bf['attributes'][_0xd3fc('0x36')]?_0x5296bf[_0xd3fc('0x34')]:_0x4cbb6f[_0xd3fc('0x2f')];if(_0x1c052a[_0xd3fc('0x33')][_0xd3fc('0x41')]){_0x5296bf[_0xd3fc('0x44')]=[{'all':!![]}];}_0x5296bf=_[_0xd3fc('0x3d')]({},_0x5296bf,_0x1c052a[_0xd3fc('0x45')]);return db['FaxApplication'][_0xd3fc('0x46')](_0x5296bf)[_0xd3fc('0x25')](handleEntityNotFound(_0x3e8df4,null))['then'](respondWithResult(_0x3e8df4,null))[_0xd3fc('0x47')](handleError(_0x3e8df4,null));};exports['create']=function(_0x19d3a0,_0x1d8aac){return db[_0xd3fc('0x40')][_0xd3fc('0x48')](_0x19d3a0[_0xd3fc('0x49')],{})[_0xd3fc('0x25')](respondWithResult(_0x1d8aac,0xc9))['catch'](handleError(_0x1d8aac,null));};exports[_0xd3fc('0x24')]=function(_0x2c9306,_0x3e5cc4){if(_0x2c9306[_0xd3fc('0x49')]['id']){delete _0x2c9306[_0xd3fc('0x49')]['id'];}return db[_0xd3fc('0x40')][_0xd3fc('0x46')]({'where':{'id':_0x2c9306['params']['id']}})[_0xd3fc('0x25')](handleEntityNotFound(_0x3e5cc4,null))[_0xd3fc('0x25')](saveUpdates(_0x2c9306[_0xd3fc('0x49')],null))[_0xd3fc('0x25')](respondWithResult(_0x3e5cc4,null))['catch'](handleError(_0x3e5cc4,null));};exports[_0xd3fc('0x26')]=function(_0x12ddb9,_0x38b23a){return db[_0xd3fc('0x40')][_0xd3fc('0x46')]({'where':{'id':_0x12ddb9[_0xd3fc('0x43')]['id']}})['then'](handleEntityNotFound(_0x38b23a,null))[_0xd3fc('0x25')](removeEntity(_0x38b23a,null))[_0xd3fc('0x47')](handleError(_0x38b23a,null));}; \ No newline at end of file +var _0xd04e=['catch','show','params','include','create','body','find','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','map','FaxApplication','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','rows'];(function(_0x14820b,_0x320176){var _0x2345d3=function(_0x137f3d){while(--_0x137f3d){_0x14820b['push'](_0x14820b['shift']());}};_0x2345d3(++_0x320176);}(_0xd04e,0x1a5));var _0xed04=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xd04e[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xed04('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed04('0x1'));var moment=require(_0xed04('0x2'));var BPromise=require(_0xed04('0x3'));var Mustache=require(_0xed04('0x4'));var util=require('util');var path=require(_0xed04('0x5'));var sox=require(_0xed04('0x6'));var csv=require(_0xed04('0x7'));var ejs=require(_0xed04('0x8'));var fs=require('fs');var fs_extra=require(_0xed04('0x9'));var _=require(_0xed04('0xa'));var squel=require(_0xed04('0xb'));var crypto=require(_0xed04('0xc'));var jsforce=require(_0xed04('0xd'));var deskjs=require(_0xed04('0xe'));var toCsv=require(_0xed04('0x7'));var querystring=require(_0xed04('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xed04('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xed04('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xed04('0x12'));var config=require(_0xed04('0x13'));var licenseUtil=require(_0xed04('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x238e4e,_0x3f9141){_0x3f9141=_0x3f9141||0xcc;return function(_0x80fbe8){if(_0x80fbe8){return _0x238e4e[_0xed04('0x15')](_0x3f9141);}return _0x238e4e[_0xed04('0x16')](_0x3f9141)[_0xed04('0x17')]();};}function respondWithResult(_0x5f8ffc,_0x54643f){_0x54643f=_0x54643f||0xc8;return function(_0x54592e){if(_0x54592e){return _0x5f8ffc[_0xed04('0x16')](_0x54643f)[_0xed04('0x18')](_0x54592e);}};}function respondWithFilteredResult(_0xd2ce92,_0x3abbc8){return function(_0x3ec7a2){if(_0x3ec7a2){var _0x469068=typeof _0x3abbc8[_0xed04('0x19')]==='undefined'&&typeof _0x3abbc8[_0xed04('0x1a')]==='undefined';var _0xfe717f=_0x3ec7a2[_0xed04('0x1b')];var _0x32710e=_0x469068?0x0:_0x3abbc8[_0xed04('0x19')];var _0x2808a3=_0x469068?_0x3ec7a2['count']:_0x3abbc8[_0xed04('0x19')]+_0x3abbc8[_0xed04('0x1a')];var _0x45a372;if(_0x2808a3>=_0xfe717f){_0x2808a3=_0xfe717f;_0x45a372=0xc8;}else{_0x45a372=0xce;}_0xd2ce92['status'](_0x45a372);return _0xd2ce92[_0xed04('0x1c')](_0xed04('0x1d'),_0x32710e+'-'+_0x2808a3+'/'+_0xfe717f)[_0xed04('0x18')](_0x3ec7a2);}return null;};}function patchUpdates(_0x28a862){return function(_0x583ba4){try{jsonpatch[_0xed04('0x1e')](_0x583ba4,_0x28a862,!![]);}catch(_0x15552d){return BPromise[_0xed04('0x1f')](_0x15552d);}return _0x583ba4['save']();};}function saveUpdates(_0x48fd79,_0x1918f7){return function(_0x48e684){if(_0x48e684){return _0x48e684[_0xed04('0x20')](_0x48fd79)[_0xed04('0x21')](function(_0x1c3d92){return _0x1c3d92;});}return null;};}function removeEntity(_0x40ec62,_0x9ca5cd){return function(_0x1f9cc0){if(_0x1f9cc0){return _0x1f9cc0[_0xed04('0x22')]()[_0xed04('0x21')](function(){_0x40ec62[_0xed04('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b60f4,_0x3aa6a8){return function(_0x2c6945){if(!_0x2c6945){_0x4b60f4['sendStatus'](0x194);}return _0x2c6945;};}function handleError(_0x5b5ddf,_0x4acb50){_0x4acb50=_0x4acb50||0x1f4;return function(_0x4b2bd4){logger[_0xed04('0x23')](_0x4b2bd4[_0xed04('0x24')]);if(_0x4b2bd4[_0xed04('0x25')]){delete _0x4b2bd4[_0xed04('0x25')];}_0x5b5ddf[_0xed04('0x16')](_0x4acb50)['send'](_0x4b2bd4);};}exports['index']=function(_0x577e15,_0x1fadd3){var _0x3ff9af={},_0x3f68f3={},_0x51fa1a={'count':0x0,'rows':[]};var _0x8fb66a=_[_0xed04('0x26')](db[_0xed04('0x27')][_0xed04('0x28')],function(_0x21a92e){return{'name':_0x21a92e[_0xed04('0x29')],'type':_0x21a92e['type']['key']};});_0x3f68f3[_0xed04('0x2a')]=_['map'](_0x8fb66a,_0xed04('0x25'));_0x3f68f3[_0xed04('0x2b')]=_[_0xed04('0x2c')](_0x577e15[_0xed04('0x2b')]);_0x3f68f3[_0xed04('0x2d')]=_['intersection'](_0x3f68f3[_0xed04('0x2a')],_0x3f68f3[_0xed04('0x2b')]);_0x3ff9af[_0xed04('0x2e')]=_[_0xed04('0x2f')](_0x3f68f3['model'],qs['fields'](_0x577e15['query'][_0xed04('0x30')]));_0x3ff9af[_0xed04('0x2e')]=_0x3ff9af[_0xed04('0x2e')][_0xed04('0x31')]?_0x3ff9af['attributes']:_0x3f68f3[_0xed04('0x2a')];if(!_0x577e15['query'][_0xed04('0x32')](_0xed04('0x33'))){_0x3ff9af[_0xed04('0x1a')]=qs[_0xed04('0x1a')](_0x577e15['query'][_0xed04('0x1a')]);_0x3ff9af[_0xed04('0x19')]=qs[_0xed04('0x19')](_0x577e15[_0xed04('0x2b')][_0xed04('0x19')]);}_0x3ff9af[_0xed04('0x34')]=qs[_0xed04('0x35')](_0x577e15[_0xed04('0x2b')][_0xed04('0x35')]);_0x3ff9af[_0xed04('0x36')]=qs[_0xed04('0x2d')](_['pick'](_0x577e15[_0xed04('0x2b')],_0x3f68f3[_0xed04('0x2d')]),_0x8fb66a);if(_0x577e15[_0xed04('0x2b')][_0xed04('0x37')]){_0x3ff9af[_0xed04('0x36')]=_[_0xed04('0x38')](_0x3ff9af[_0xed04('0x36')],{'$or':_[_0xed04('0x26')](_0x8fb66a,function(_0x2aaf29){if(_0x2aaf29[_0xed04('0x39')]!==_0xed04('0x3a')){var _0x1eff6e={};_0x1eff6e[_0x2aaf29[_0xed04('0x25')]]={'$like':'%'+_0x577e15[_0xed04('0x2b')]['filter']+'%'};return _0x1eff6e;}})});}_0x3ff9af=_[_0xed04('0x38')]({},_0x3ff9af,_0x577e15[_0xed04('0x3b')]);var _0x3b584f={'where':_0x3ff9af['where']};return db['FaxApplication'][_0xed04('0x1b')](_0x3b584f)['then'](function(_0x220a66){_0x51fa1a['count']=_0x220a66;if(_0x577e15['query'][_0xed04('0x3c')]){_0x3ff9af['include']=[{'all':!![]}];}return db[_0xed04('0x27')]['findAll'](_0x3ff9af);})[_0xed04('0x21')](function(_0x453b55){_0x51fa1a[_0xed04('0x3d')]=_0x453b55;return _0x51fa1a;})[_0xed04('0x21')](respondWithFilteredResult(_0x1fadd3,_0x3ff9af))[_0xed04('0x3e')](handleError(_0x1fadd3,null));};exports[_0xed04('0x3f')]=function(_0x107b6f,_0x1d093a){var _0x349688={'raw':!![],'where':{'id':_0x107b6f[_0xed04('0x40')]['id']}},_0x271795={};_0x271795[_0xed04('0x2a')]=_['keys'](db[_0xed04('0x27')][_0xed04('0x28')]);_0x271795['query']=_[_0xed04('0x2c')](_0x107b6f['query']);_0x271795['filters']=_[_0xed04('0x2f')](_0x271795[_0xed04('0x2a')],_0x271795[_0xed04('0x2b')]);_0x349688[_0xed04('0x2e')]=_[_0xed04('0x2f')](_0x271795[_0xed04('0x2a')],qs['fields'](_0x107b6f[_0xed04('0x2b')]['fields']));_0x349688['attributes']=_0x349688['attributes'][_0xed04('0x31')]?_0x349688[_0xed04('0x2e')]:_0x271795['model'];if(_0x107b6f['query']['includeAll']){_0x349688[_0xed04('0x41')]=[{'all':!![]}];}_0x349688=_['merge']({},_0x349688,_0x107b6f[_0xed04('0x3b')]);return db[_0xed04('0x27')]['find'](_0x349688)['then'](handleEntityNotFound(_0x1d093a,null))[_0xed04('0x21')](respondWithResult(_0x1d093a,null))[_0xed04('0x3e')](handleError(_0x1d093a,null));};exports[_0xed04('0x42')]=function(_0x1c37e8,_0x317d5f){return db[_0xed04('0x27')][_0xed04('0x42')](_0x1c37e8[_0xed04('0x43')],{})[_0xed04('0x21')](respondWithResult(_0x317d5f,0xc9))[_0xed04('0x3e')](handleError(_0x317d5f,null));};exports[_0xed04('0x20')]=function(_0xf7db0f,_0x12a126){if(_0xf7db0f[_0xed04('0x43')]['id']){delete _0xf7db0f['body']['id'];}return db['FaxApplication']['find']({'where':{'id':_0xf7db0f[_0xed04('0x40')]['id']}})[_0xed04('0x21')](handleEntityNotFound(_0x12a126,null))[_0xed04('0x21')](saveUpdates(_0xf7db0f[_0xed04('0x43')],null))[_0xed04('0x21')](respondWithResult(_0x12a126,null))[_0xed04('0x3e')](handleError(_0x12a126,null));};exports[_0xed04('0x22')]=function(_0x28ae53,_0xecbbc1){return db[_0xed04('0x27')][_0xed04('0x44')]({'where':{'id':_0x28ae53[_0xed04('0x40')]['id']}})[_0xed04('0x21')](handleEntityNotFound(_0xecbbc1,null))['then'](removeEntity(_0xecbbc1,null))[_0xed04('0x3e')](handleError(_0xecbbc1,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 7e52f72..3a20ad3 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 _0x853d=['fax_applications','utf8mb4','lodash','util','api','moment','path','../../config/environment','./faxApplication.attributes','FaxApplication'];(function(_0x10d3e1,_0x1077be){var _0xa57c56=function(_0x469bff){while(--_0x469bff){_0x10d3e1['push'](_0x10d3e1['shift']());}};_0xa57c56(++_0x1077be);}(_0x853d,0x8e));var _0xd853=function(_0x56de16,_0x46a8fe){_0x56de16=_0x56de16-0x0;var _0x3776db=_0x853d[_0x56de16];return _0x3776db;};'use strict';var _=require(_0xd853('0x0'));var util=require(_0xd853('0x1'));var logger=require('../../config/logger')(_0xd853('0x2'));var moment=require(_0xd853('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd853('0x4'));var rimraf=require('rimraf');var config=require(_0xd853('0x5'));var attributes=require(_0xd853('0x6'));module['exports']=function(_0xf70805,_0x190ae2){return _0xf70805['define'](_0xd853('0x7'),attributes,{'tableName':_0xd853('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd853('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x245c=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','exports','define'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x245c,0x80));var _0xc245=function(_0x1e210e,_0x2b5462){_0x1e210e=_0x1e210e-0x0;var _0x54b183=_0x245c[_0x1e210e];return _0x54b183;};'use strict';var _=require(_0xc245('0x0'));var util=require(_0xc245('0x1'));var logger=require(_0xc245('0x2'))(_0xc245('0x3'));var moment=require(_0xc245('0x4'));var BPromise=require(_0xc245('0x5'));var rp=require(_0xc245('0x6'));var fs=require('fs');var path=require(_0xc245('0x7'));var rimraf=require('rimraf');var config=require(_0xc245('0x8'));var attributes=require(_0xc245('0x9'));module[_0xc245('0xa')]=function(_0x155d57,_0x4989f6){return _0x155d57[_0xc245('0xb')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc245('0xc'),'collate':_0xc245('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 65d6293..9e8a5e7 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 _0xb673=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','then','lodash','util','bluebird'];(function(_0x5ceaf5,_0x3ea743){var _0x835d7c=function(_0xc887f9){while(--_0xc887f9){_0x5ceaf5['push'](_0x5ceaf5['shift']());}};_0x835d7c(++_0x3ea743);}(_0xb673,0xa5));var _0x3b67=function(_0x12b3d4,_0x27f5b6){_0x12b3d4=_0x12b3d4-0x0;var _0x321ba4=_0xb673[_0x12b3d4];return _0x321ba4;};'use strict';var _=require(_0x3b67('0x0'));var util=require(_0x3b67('0x1'));var moment=require('moment');var BPromise=require(_0x3b67('0x2'));var rs=require(_0x3b67('0x3'));var fs=require('fs');var Redis=require(_0x3b67('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b67('0x5'));var logger=require(_0x3b67('0x6'))(_0x3b67('0x7'));var config=require('../../config/environment');var jayson=require(_0x3b67('0x8'));var client=jayson['client'][_0x3b67('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c0f30,_0x3e2fd8,_0x329729){return new BPromise(function(_0x5703ee,_0x4c63d3){return client['request'](_0x3c0f30,_0x329729)['then'](function(_0x404edf){logger['info'](_0x3b67('0xa'),_0x3e2fd8,'request\x20sent');logger[_0x3b67('0xb')](_0x3b67('0xc'),_0x3e2fd8,_0x3b67('0xd'),JSON[_0x3b67('0xe')](_0x404edf));if(_0x404edf['error']){if(_0x404edf['error']['code']===0x1f4){logger['error'](_0x3b67('0xa'),_0x3e2fd8,_0x404edf[_0x3b67('0xf')]['message']);return _0x4c63d3(_0x404edf[_0x3b67('0xf')][_0x3b67('0x10')]);}logger['error'](_0x3b67('0xa'),_0x3e2fd8,_0x404edf[_0x3b67('0xf')][_0x3b67('0x10')]);return _0x5703ee(_0x404edf[_0x3b67('0xf')][_0x3b67('0x10')]);}else{logger[_0x3b67('0x11')]('FaxApplication,\x20%s,\x20%s',_0x3e2fd8,'request\x20sent');_0x5703ee(_0x404edf[_0x3b67('0x12')][_0x3b67('0x10')]);}})[_0x3b67('0x13')](function(_0x1557df){logger['error'](_0x3b67('0xa'),_0x3e2fd8,_0x1557df);_0x4c63d3(_0x1557df);});});}exports[_0x3b67('0x14')]=function(_0x5c4e27){var _0x45da53=this;return new Promise(function(_0x607f4d,_0x124b36){return db[_0x3b67('0x15')][_0x3b67('0x16')](_0x5c4e27['body'],{'raw':_0x5c4e27[_0x3b67('0x17')]?_0x5c4e27[_0x3b67('0x17')][_0x3b67('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c4e27[_0x3b67('0x17')]?_0x5c4e27[_0x3b67('0x17')][_0x3b67('0x19')]||null:null,'attributes':_0x5c4e27[_0x3b67('0x17')]?_0x5c4e27['options'][_0x3b67('0x1a')]||null:null,'limit':_0x5c4e27[_0x3b67('0x17')]?_0x5c4e27[_0x3b67('0x17')]['limit']||null:null})[_0x3b67('0x1b')](function(_0x1bdb9e){logger[_0x3b67('0x11')](_0x3b67('0x14'),_0x5c4e27);logger[_0x3b67('0xb')](_0x3b67('0x14'),_0x5c4e27,JSON[_0x3b67('0xe')](_0x1bdb9e));_0x607f4d(_0x1bdb9e);})[_0x3b67('0x13')](function(_0x3b4e7c){logger[_0x3b67('0xf')](_0x3b67('0x14'),_0x3b4e7c[_0x3b67('0x10')],_0x5c4e27);_0x124b36(_0x45da53[_0x3b67('0xf')](0x1f4,_0x3b4e7c[_0x3b67('0x10')]));});});}; \ No newline at end of file +var _0xe752=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','limit','lodash','util','bluebird'];(function(_0x25d854,_0x14d4c3){var _0x3c11f2=function(_0x143e68){while(--_0x143e68){_0x25d854['push'](_0x25d854['shift']());}};_0x3c11f2(++_0x14d4c3);}(_0xe752,0xe5));var _0x2e75=function(_0xc41bc4,_0x394ead){_0xc41bc4=_0xc41bc4-0x0;var _0x44cea4=_0xe752[_0xc41bc4];return _0x44cea4;};'use strict';var _=require(_0x2e75('0x0'));var util=require(_0x2e75('0x1'));var moment=require('moment');var BPromise=require(_0x2e75('0x2'));var rs=require(_0x2e75('0x3'));var fs=require('fs');var Redis=require(_0x2e75('0x4'));var db=require(_0x2e75('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e75('0x6'))(_0x2e75('0x7'));var config=require(_0x2e75('0x8'));var jayson=require(_0x2e75('0x9'));var client=jayson[_0x2e75('0xa')][_0x2e75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31ed65,_0x12b5db,_0x51633e){return new BPromise(function(_0x2384d5,_0x3d408){return client['request'](_0x31ed65,_0x51633e)[_0x2e75('0xc')](function(_0x4909d8){logger[_0x2e75('0xd')](_0x2e75('0xe'),_0x12b5db,_0x2e75('0xf'));logger[_0x2e75('0x10')](_0x2e75('0x11'),_0x12b5db,_0x2e75('0xf'),JSON[_0x2e75('0x12')](_0x4909d8));if(_0x4909d8[_0x2e75('0x13')]){if(_0x4909d8[_0x2e75('0x13')]['code']===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x12b5db,_0x4909d8['error']['message']);return _0x3d408(_0x4909d8[_0x2e75('0x13')][_0x2e75('0x14')]);}logger[_0x2e75('0x13')](_0x2e75('0xe'),_0x12b5db,_0x4909d8[_0x2e75('0x13')][_0x2e75('0x14')]);return _0x2384d5(_0x4909d8[_0x2e75('0x13')][_0x2e75('0x14')]);}else{logger['info'](_0x2e75('0xe'),_0x12b5db,_0x2e75('0xf'));_0x2384d5(_0x4909d8[_0x2e75('0x15')][_0x2e75('0x14')]);}})[_0x2e75('0x16')](function(_0x1e2dc6){logger[_0x2e75('0x13')](_0x2e75('0xe'),_0x12b5db,_0x1e2dc6);_0x3d408(_0x1e2dc6);});});}exports[_0x2e75('0x17')]=function(_0x19a6c1){var _0x5e0006=this;return new Promise(function(_0x39014c,_0x53a766){return db[_0x2e75('0x18')][_0x2e75('0x19')](_0x19a6c1[_0x2e75('0x1a')],{'raw':_0x19a6c1[_0x2e75('0x1b')]?_0x19a6c1['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19a6c1['options']?_0x19a6c1[_0x2e75('0x1b')]['where']||null:null,'attributes':_0x19a6c1[_0x2e75('0x1b')]?_0x19a6c1[_0x2e75('0x1b')]['attributes']||null:null,'limit':_0x19a6c1[_0x2e75('0x1b')]?_0x19a6c1['options'][_0x2e75('0x1c')]||null:null})[_0x2e75('0xc')](function(_0x3f147a){logger['info']('UpdateFaxApplication',_0x19a6c1);logger[_0x2e75('0x10')](_0x2e75('0x17'),_0x19a6c1,JSON[_0x2e75('0x12')](_0x3f147a));_0x39014c(_0x3f147a);})['catch'](function(_0xc39c7c){logger[_0x2e75('0x13')](_0x2e75('0x17'),_0xc39c7c[_0x2e75('0x14')],_0x19a6c1);_0x53a766(_0x5e0006[_0x2e75('0x13')](0x1f4,_0xc39c7c[_0x2e75('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 3dba9ee..f05054a 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 _0x6324=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','exports','multer'];(function(_0x5dfe9a,_0x16652b){var _0x383082=function(_0x47a1e5){while(--_0x47a1e5){_0x5dfe9a['push'](_0x5dfe9a['shift']());}};_0x383082(++_0x16652b);}(_0x6324,0x142));var _0x4632=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x6324[_0x3c4737];return _0x2bb926;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));var controller=require('./faxApplication.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0xb')]('/',auth['isAuthenticated'](),controller[_0x4632('0xc')]);router[_0x4632('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x4632('0xe')]);router[_0x4632('0xf')](_0x4632('0x10'),auth[_0x4632('0x8')](),controller[_0x4632('0x11')]);module[_0x4632('0x12')]=router; \ No newline at end of file +var _0x9354=['Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','util','path','express'];(function(_0x3837a9,_0x7532b6){var _0x57f2c0=function(_0x1408bc){while(--_0x1408bc){_0x3837a9['push'](_0x3837a9['shift']());}};_0x57f2c0(++_0x7532b6);}(_0x9354,0x96));var _0x4935=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x9354[_0xbd08b4];return _0x314f1e;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['post']('/',auth[_0x4935('0x9')](),controller['create']);router[_0x4935('0xd')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xe')]);router[_0x4935('0xf')](_0x4935('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x4935('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 059d15a..caeb495 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 _0x5464=['STRING','DATE','ENUM','out','INTEGER','sequelize','exports','BOOLEAN'];(function(_0x5e01ec,_0x2377fd){var _0x41a55b=function(_0x1e06e2){while(--_0x1e06e2){_0x5e01ec['push'](_0x5e01ec['shift']());}};_0x41a55b(++_0x2377fd);}(_0x5464,0x15d));var _0x4546=function(_0x4e3987,_0x36496b){_0x4e3987=_0x4e3987-0x0;var _0x542e20=_0x5464[_0x4e3987];return _0x542e20;};'use strict';var Sequelize=require(_0x4546('0x0'));module[_0x4546('0x1')]={'closed':{'type':Sequelize[_0x4546('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x4546('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x4546('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x4546('0x4')]},'fax':{'type':Sequelize[_0x4546('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4546('0x5')]('in',_0x4546('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x4546('0x7')]}}; \ No newline at end of file +var _0x958a=['ENUM','INTEGER','sequelize','exports','DATE','STRING','out'];(function(_0x356e8d,_0x24c719){var _0x39e65a=function(_0x27ecc2){while(--_0x27ecc2){_0x356e8d['push'](_0x356e8d['shift']());}};_0x39e65a(++_0x24c719);}(_0x958a,0x128));var _0xa958=function(_0x303f75,_0x1a92f4){_0x303f75=_0x303f75-0x0;var _0x5d00b3=_0x958a[_0x303f75];return _0x5d00b3;};'use strict';var Sequelize=require(_0xa958('0x0'));module[_0xa958('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa958('0x2')]},'disposition':{'type':Sequelize[_0xa958('0x3')]},'secondDisposition':{'type':Sequelize[_0xa958('0x3')]},'thirdDisposition':{'type':Sequelize[_0xa958('0x3')]},'note':{'type':Sequelize[_0xa958('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xa958('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xa958('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa958('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xa958('0x5')]('in',_0xa958('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xa958('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index b14a62b..fd30ddf 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 _0x96f5=['keys','filters','intersection','attributes','fields','length','find','create','body','update','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','options','include','addTags','spread','Tag','emit','faxInteractionTags:save','removeTags','download','unix','join','root','files','server','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createWriteStream','log','err','unlinkSync','rimraf','zip-dir','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','destroy','then','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','findAll','fax','query','user','catch','show','params','model'];(function(_0x1dc6b7,_0x15612a){var _0x386b4c=function(_0x5a5995){while(--_0x5a5995){_0x1dc6b7['push'](_0x1dc6b7['shift']());}};_0x386b4c(++_0x15612a);}(_0x96f5,0x9b));var _0x596f=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0x96f5[_0x506d2f];return _0x101255;};'use strict';var rimraf=require(_0x596f('0x0'));var zipdir=require(_0x596f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x596f('0x2'));var path=require(_0x596f('0x3'));var fs=require('fs');var _=require(_0x596f('0x4'));var Redis=require(_0x596f('0x5'));var interaction=require(_0x596f('0x6'));var qs=require(_0x596f('0x7'));var logger=require(_0x596f('0x8'))(_0x596f('0x9'));var config=require(_0x596f('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x596f('0xb')](config[_0x596f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x596f('0xd'))(new Redis(config[_0x596f('0xc')]));require(_0x596f('0xe'))['register'](socket);function respondWithStatusCode(_0x290f69,_0x45a6e9){_0x45a6e9=_0x45a6e9||0xcc;return function(_0x28b094){if(_0x28b094){return _0x290f69[_0x596f('0xf')](_0x45a6e9);}return _0x290f69[_0x596f('0x10')](_0x45a6e9)[_0x596f('0x11')]();};}function respondWithResult(_0x27beec,_0x215228){_0x215228=_0x215228||0xc8;return function(_0x5ef02d){if(_0x5ef02d){return _0x27beec['status'](_0x215228)[_0x596f('0x12')](_0x5ef02d);}};}function respondWithFilteredResult(_0x5095df,_0x21b6da){return function(_0x311929){if(_0x311929){var _0x3c001e=typeof _0x21b6da[_0x596f('0x13')]===_0x596f('0x14')&&typeof _0x21b6da[_0x596f('0x15')]==='undefined';var _0x1b5524=_0x311929[_0x596f('0x16')];var _0x1aab23=_0x3c001e?0x0:_0x21b6da[_0x596f('0x13')];var _0x545b54=_0x3c001e?_0x311929[_0x596f('0x16')]:_0x21b6da[_0x596f('0x13')]+_0x21b6da[_0x596f('0x15')];var _0x1917ee;if(_0x545b54>=_0x1b5524){_0x545b54=_0x1b5524;_0x1917ee=0xc8;}else{_0x1917ee=0xce;}_0x5095df[_0x596f('0x10')](_0x1917ee);return _0x5095df[_0x596f('0x17')]('Content-Range',_0x1aab23+'-'+_0x545b54+'/'+_0x1b5524)[_0x596f('0x12')](_0x311929);}return null;};}function saveUpdates(_0x50e940){return function(_0x2d8cf6){if(_0x2d8cf6){return _0x2d8cf6['update'](_0x50e940)['then'](function(_0x4f0e85){return _0x4f0e85;});}return null;};}function removeEntity(_0xdd98b4){return function(_0x192f28){if(_0x192f28){return _0x192f28[_0x596f('0x18')]()[_0x596f('0x19')](function(){_0xdd98b4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56ab8){return function(_0x5c9f5f){if(!_0x5c9f5f){_0x56ab8[_0x596f('0xf')](0x194);}return _0x5c9f5f;};}function handleError(_0x29f4e7,_0x4b908f){_0x4b908f=_0x4b908f||0x1f4;return function(_0x4601bf){logger[_0x596f('0x1a')](_0x4601bf[_0x596f('0x1b')]);if(_0x4601bf[_0x596f('0x1c')]){delete _0x4601bf[_0x596f('0x1c')];}_0x29f4e7[_0x596f('0x10')](_0x4b908f)[_0x596f('0x1d')](_0x4601bf);};}exports[_0x596f('0x1e')]=function(_0x19eb60,_0x415d92){var _0x419ef2={};var _0x22d33b=_[_0x596f('0x1f')](db[_0x596f('0x20')][_0x596f('0x21')],function(_0x22128f){return{'name':_0x22128f[_0x596f('0x22')],'type':_0x22128f['type']['key']};});_0x419ef2=qs['getOptions'](_0x22d33b,_0x19eb60);return interaction[_0x596f('0x23')](_0x596f('0x24'),_0x19eb60[_0x596f('0x25')],_0x19eb60[_0x596f('0x26')],_0x419ef2,_0x22d33b)[_0x596f('0x19')](respondWithFilteredResult(_0x415d92,_0x419ef2))[_0x596f('0x27')](handleError(_0x415d92,null));};exports[_0x596f('0x28')]=function(_0x5caeb2,_0x251b1a){var _0x297cf1={'raw':![],'where':{'id':_0x5caeb2[_0x596f('0x29')]['id']}},_0x194304={};_0x194304[_0x596f('0x2a')]=_[_0x596f('0x2b')](db[_0x596f('0x20')][_0x596f('0x21')]);_0x194304['query']=_[_0x596f('0x2b')](_0x5caeb2[_0x596f('0x25')]);_0x194304[_0x596f('0x2c')]=_[_0x596f('0x2d')](_0x194304[_0x596f('0x2a')],_0x194304[_0x596f('0x25')]);_0x297cf1[_0x596f('0x2e')]=_[_0x596f('0x2d')](_0x194304[_0x596f('0x2a')],qs[_0x596f('0x2f')](_0x5caeb2[_0x596f('0x25')][_0x596f('0x2f')]));_0x297cf1['attributes']=_0x297cf1[_0x596f('0x2e')][_0x596f('0x30')]?_0x297cf1[_0x596f('0x2e')]:_0x194304[_0x596f('0x2a')];if(_0x5caeb2[_0x596f('0x25')]['includeAll']){_0x297cf1['include']=[{'all':!![]}];}_0x297cf1=_['merge']({},_0x297cf1,_0x5caeb2['options']);return db['FaxInteraction'][_0x596f('0x31')](_0x297cf1)['then'](handleEntityNotFound(_0x251b1a,null))['then'](respondWithResult(_0x251b1a,null))[_0x596f('0x27')](handleError(_0x251b1a,null));};exports[_0x596f('0x32')]=function(_0x46bd69,_0x580df9){return db[_0x596f('0x20')][_0x596f('0x32')](_0x46bd69[_0x596f('0x33')],{})[_0x596f('0x19')](respondWithResult(_0x580df9,0xc9))['catch'](handleError(_0x580df9,null));};exports[_0x596f('0x34')]=function(_0x2dcb6a,_0x554467){if(_0x2dcb6a[_0x596f('0x33')]['id']){delete _0x2dcb6a[_0x596f('0x33')]['id'];}return db[_0x596f('0x20')]['find']({'where':{'id':_0x2dcb6a['params']['id']}})[_0x596f('0x19')](handleEntityNotFound(_0x554467,null))[_0x596f('0x19')](saveUpdates(_0x2dcb6a[_0x596f('0x33')],null))['then'](respondWithResult(_0x554467,null))[_0x596f('0x27')](handleError(_0x554467,null));};exports[_0x596f('0x18')]=function(_0x3e03bd,_0x229fce){return db[_0x596f('0x20')]['find']({'where':{'id':_0x3e03bd[_0x596f('0x29')]['id']}})[_0x596f('0x19')](handleEntityNotFound(_0x229fce,null))[_0x596f('0x19')](removeEntity(_0x229fce,null))[_0x596f('0x27')](handleError(_0x229fce,null));};exports['describe']=function(_0x44593b,_0x3db746){return db[_0x596f('0x20')]['describe']()[_0x596f('0x19')](respondWithResult(_0x3db746,null))[_0x596f('0x27')](handleError(_0x3db746,null));};exports[_0x596f('0x35')]=function(_0x3da3e6,_0x4024f6){return db[_0x596f('0x36')][_0x596f('0x31')]({'where':{'id':_0x3da3e6['params']['id']}})[_0x596f('0x19')](handleEntityNotFound(_0x4024f6,null))['then'](function(_0x4b0f86){if(_0x4b0f86){return _0x4b0f86[_0x596f('0x35')](_0x3da3e6[_0x596f('0x33')][_0x596f('0x37')],_[_0x596f('0x38')](_0x3da3e6['body'],[_0x596f('0x37'),'id'])||{});}})[_0x596f('0x19')](respondWithResult(_0x4024f6,null))['catch'](handleError(_0x4024f6,null));};exports[_0x596f('0x39')]=function(_0x431f6b,_0x5c1432){var _0x26c962={'raw':![],'where':{}};var _0x35677b={};var _0x1cd665={'count':0x0,'rows':[]};return db[_0x596f('0x20')][_0x596f('0x3a')]({'where':{'id':_0x431f6b['params']['id']}})[_0x596f('0x19')](handleEntityNotFound(_0x5c1432,null))[_0x596f('0x19')](function(_0x46f44d){if(_0x46f44d){_0x35677b[_0x596f('0x2a')]=_[_0x596f('0x2b')](db[_0x596f('0x36')][_0x596f('0x21')]);_0x35677b[_0x596f('0x25')]=_['keys'](_0x431f6b[_0x596f('0x25')]);_0x35677b[_0x596f('0x2c')]=_[_0x596f('0x2d')](_0x35677b['model'],_0x35677b[_0x596f('0x25')]);_0x26c962[_0x596f('0x2e')]=_[_0x596f('0x2d')](_0x35677b['model'],qs['fields'](_0x431f6b['query'][_0x596f('0x2f')]));_0x26c962[_0x596f('0x2e')]=_0x26c962[_0x596f('0x2e')][_0x596f('0x30')]?_0x26c962['attributes']:_0x35677b['model'];if(!_0x431f6b[_0x596f('0x25')][_0x596f('0x3b')](_0x596f('0x3c'))){_0x26c962['limit']=qs[_0x596f('0x15')](_0x431f6b['query'][_0x596f('0x15')]);_0x26c962[_0x596f('0x13')]=qs['offset'](_0x431f6b[_0x596f('0x25')][_0x596f('0x13')]);}_0x26c962[_0x596f('0x3d')]=qs[_0x596f('0x3e')](_0x431f6b[_0x596f('0x25')][_0x596f('0x3e')]);_0x26c962[_0x596f('0x3f')]=qs['filters'](_['pick'](_0x431f6b[_0x596f('0x25')],_0x35677b[_0x596f('0x2c')]));_0x26c962[_0x596f('0x3f')][_0x596f('0x40')]=_0x46f44d['id'];if(_0x431f6b[_0x596f('0x25')]['filter']){_0x26c962[_0x596f('0x3f')]=_['merge'](_0x26c962[_0x596f('0x3f')],{'$or':_['map'](_0x26c962['attributes'],function(_0x93feb0){var _0x3ea6a9={};_0x3ea6a9[_0x93feb0]={'$like':'%'+_0x431f6b[_0x596f('0x25')][_0x596f('0x41')]+'%'};return _0x3ea6a9;})});}if(_0x431f6b['query'][_0x596f('0x42')]){var _0x2a4c7a=_0x431f6b['query'][_0x596f('0x42')][_0x596f('0x43')](',');var _0x52c37c={};_0x52c37c[_0x2a4c7a[0x0]]={'$gte':moment(_0x2a4c7a[0x1])[_0x596f('0x44')](_0x596f('0x45'))};_0x26c962[_0x596f('0x3f')]=_['merge'](_0x26c962[_0x596f('0x3f')],_0x52c37c);}_0x26c962=_[_0x596f('0x46')]({},_0x26c962,_0x431f6b[_0x596f('0x47')]);return db[_0x596f('0x36')][_0x596f('0x16')]({'where':_0x26c962[_0x596f('0x3f')]})['then'](function(_0x27d630){_0x1cd665['count']=_0x27d630;if(_0x431f6b['query']['includeAll']){_0x26c962[_0x596f('0x48')]=[{'all':!![]}];}return db[_0x596f('0x36')]['findAll'](_0x26c962);})['then'](function(_0x8de5a9){_0x1cd665['rows']=_0x8de5a9;return _0x1cd665;});}})[_0x596f('0x19')](respondWithFilteredResult(_0x5c1432,_0x26c962))['catch'](handleError(_0x5c1432,null));};exports[_0x596f('0x49')]=function(_0x1ecab6,_0x2e81d3){return db[_0x596f('0x20')][_0x596f('0x31')]({'where':{'id':_0x1ecab6[_0x596f('0x29')]['id']}})[_0x596f('0x19')](handleEntityNotFound(_0x2e81d3,null))[_0x596f('0x19')](function(_0x242342){if(_0x242342){return _0x242342['setTags'](_0x1ecab6[_0x596f('0x33')][_0x596f('0x37')],_['omit'](_0x1ecab6[_0x596f('0x33')],['ids','id'])||{})[_0x596f('0x4a')](function(){return db[_0x596f('0x4b')][_0x596f('0x23')]({'attributes':['id',_0x596f('0x1c'),'color'],'where':{'id':_0x1ecab6[_0x596f('0x33')][_0x596f('0x37')]}});})[_0x596f('0x19')](function(_0x5e9ddb){socket[_0x596f('0x4c')](_0x596f('0x4d'),{'id':Number(_0x1ecab6[_0x596f('0x29')]['id']),'tags':_0x5e9ddb||[]});return{'id':Number(_0x1ecab6['params']['id']),'tags':_0x5e9ddb||[]};});}})[_0x596f('0x19')](respondWithResult(_0x2e81d3,null))[_0x596f('0x27')](handleError(_0x2e81d3,null));};exports[_0x596f('0x4e')]=function(_0x196ca8,_0x57799b){return db[_0x596f('0x20')][_0x596f('0x31')]({'where':{'id':_0x196ca8[_0x596f('0x29')]['id']}})['then'](handleEntityNotFound(_0x57799b,null))[_0x596f('0x19')](function(_0x304f44){if(_0x304f44){return _0x304f44[_0x596f('0x4e')](_0x196ca8[_0x596f('0x25')][_0x596f('0x37')]);}})[_0x596f('0x19')](respondWithStatusCode(_0x57799b,null))[_0x596f('0x27')](handleError(_0x57799b,null));};exports[_0x596f('0x4f')]=function(_0x1eec81,_0x441d83){var _0x15f852=moment()[_0x596f('0x50')]()['toString']();var _0x1ec9ec=path[_0x596f('0x51')](config[_0x596f('0x52')],'server',_0x596f('0x53'),'tmp');var _0x375352=path['join'](config[_0x596f('0x52')],_0x596f('0x54'),'files',_0x596f('0x55'));var _0x14394b=path[_0x596f('0x51')](_0x1ec9ec,_0x15f852);var _0x4dc7f3=util[_0x596f('0x44')](_0x596f('0x56'),_0x1eec81['params']['id'],_0x15f852);var _0x1495d0=path[_0x596f('0x51')](_0x1ec9ec,_0x4dc7f3);var _0x339d85=[];_0x339d85[_0x596f('0x57')]({'model':db[_0x596f('0x58')],'as':'Attachment','raw':!![]});var _0x10e96d=[{'model':db[_0x596f('0x36')],'as':_0x596f('0x59'),'attributes':['id',_0x596f('0x33'),_0x596f('0x5a')],'include':_0x339d85}];return db[_0x596f('0x20')]['find']({'where':{'id':_0x1eec81[_0x596f('0x29')]['id']},'include':_0x10e96d})[_0x596f('0x19')](handleEntityNotFound(_0x441d83,null))[_0x596f('0x19')](function(_0x30a1d){if(_0x30a1d&&_0x30a1d['Messages']){var _0x229ef5=_0x30a1d[_0x596f('0x5b')]({'plain':!![]});fs[_0x596f('0x5c')](_0x14394b);for(var _0x7a5a02=0x0;_0x7a5a02<_0x229ef5[_0x596f('0x59')][_0x596f('0x30')];_0x7a5a02++){var _0x5cb905=_0x229ef5[_0x596f('0x59')][_0x7a5a02]['Attachment'];if(_0x5cb905){var _0x2c5587=path[_0x596f('0x51')](_0x375352,_0x5cb905[_0x596f('0x5d')]);if(fs[_0x596f('0x5e')](_0x2c5587)){fs['createReadStream'](_0x2c5587)['pipe'](fs[_0x596f('0x5f')](path[_0x596f('0x51')](_0x14394b,_0x5cb905['basename'])));}}}return BPromise['resolve']()[_0x596f('0x19')](function(){return new BPromise(function(_0x2ac51c,_0x5afcf3){zipdir(_0x14394b,{'saveTo':_0x1495d0},function(_0x6fc697,_0x52bdef){if(_0x6fc697)return _0x5afcf3(_0x6fc697);return _0x2ac51c(_0x52bdef);});})[_0x596f('0x19')](function(){return new BPromise(function(_0x2abca7,_0x339eba){rimraf(_0x14394b,function(_0x343bb0){if(_0x343bb0)_0x339eba(_0x343bb0);return _0x2abca7();});});})[_0x596f('0x19')](function(){return _0x441d83[_0x596f('0x4f')](_0x1495d0,_0x4dc7f3,function(_0x3a78cb){if(_0x3a78cb){console[_0x596f('0x60')](_0x596f('0x61'),_0x3a78cb);}else{fs[_0x596f('0x62')](_0x1495d0);}});});});}else{return _0x441d83[_0x596f('0xf')](0xc8);}})['catch'](handleError(_0x441d83,null));}; \ No newline at end of file +var _0xdc51=['FaxInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','setTags','spread','color','faxInteractionTags:save','removeTags','download','unix','join','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','get','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','basename','resolve','unlinkSync','rimraf','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','offset','limit','count','set','Content-Range','json','update','destroy','then','end','error','stack','name','index','FaxInteraction','rawAttributes','fieldName','key','getOptions','findAll','fax','user','catch','show','params','model','query','keys','intersection','fields','attributes','length','includeAll','include','find','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','filters','hasOwnProperty','nolimit','order','where'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xdc51,0x1ba));var _0x1dc5=function(_0x374a3,_0x451296){_0x374a3=_0x374a3-0x0;var _0x38f7ad=_0xdc51[_0x374a3];return _0x38f7ad;};'use strict';var rimraf=require(_0x1dc5('0x0'));var zipdir=require(_0x1dc5('0x1'));var moment=require(_0x1dc5('0x2'));var BPromise=require(_0x1dc5('0x3'));var util=require('util');var path=require(_0x1dc5('0x4'));var fs=require('fs');var _=require(_0x1dc5('0x5'));var Redis=require(_0x1dc5('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x1dc5('0x7'));var logger=require(_0x1dc5('0x8'))(_0x1dc5('0x9'));var config=require(_0x1dc5('0xa'));var db=require(_0x1dc5('0xb'))['db'];config['redis']=_[_0x1dc5('0xc')](config[_0x1dc5('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x1dc5('0xe'))(new Redis(config['redis']));require(_0x1dc5('0xf'))[_0x1dc5('0x10')](socket);function respondWithStatusCode(_0x4948c0,_0x48bbd6){_0x48bbd6=_0x48bbd6||0xcc;return function(_0x3e11e4){if(_0x3e11e4){return _0x4948c0[_0x1dc5('0x11')](_0x48bbd6);}return _0x4948c0[_0x1dc5('0x12')](_0x48bbd6)['end']();};}function respondWithResult(_0x279a7f,_0x31104a){_0x31104a=_0x31104a||0xc8;return function(_0x2304db){if(_0x2304db){return _0x279a7f[_0x1dc5('0x12')](_0x31104a)['json'](_0x2304db);}};}function respondWithFilteredResult(_0x4f573f,_0x409c78){return function(_0x7e4a27){if(_0x7e4a27){var _0x5d87df=typeof _0x409c78[_0x1dc5('0x13')]==='undefined'&&typeof _0x409c78[_0x1dc5('0x14')]==='undefined';var _0x51c2b9=_0x7e4a27[_0x1dc5('0x15')];var _0xbc7664=_0x5d87df?0x0:_0x409c78[_0x1dc5('0x13')];var _0x1dc41e=_0x5d87df?_0x7e4a27[_0x1dc5('0x15')]:_0x409c78[_0x1dc5('0x13')]+_0x409c78[_0x1dc5('0x14')];var _0x584cee;if(_0x1dc41e>=_0x51c2b9){_0x1dc41e=_0x51c2b9;_0x584cee=0xc8;}else{_0x584cee=0xce;}_0x4f573f[_0x1dc5('0x12')](_0x584cee);return _0x4f573f[_0x1dc5('0x16')](_0x1dc5('0x17'),_0xbc7664+'-'+_0x1dc41e+'/'+_0x51c2b9)[_0x1dc5('0x18')](_0x7e4a27);}return null;};}function saveUpdates(_0x3bef94){return function(_0x566f30){if(_0x566f30){return _0x566f30[_0x1dc5('0x19')](_0x3bef94)['then'](function(_0x226600){return _0x226600;});}return null;};}function removeEntity(_0x15aae5){return function(_0x5b48ac){if(_0x5b48ac){return _0x5b48ac[_0x1dc5('0x1a')]()[_0x1dc5('0x1b')](function(){_0x15aae5[_0x1dc5('0x12')](0xcc)[_0x1dc5('0x1c')]();});}};}function handleEntityNotFound(_0x2f11d7){return function(_0xc9315c){if(!_0xc9315c){_0x2f11d7['sendStatus'](0x194);}return _0xc9315c;};}function handleError(_0x37f008,_0x487a26){_0x487a26=_0x487a26||0x1f4;return function(_0x4e4f12){logger[_0x1dc5('0x1d')](_0x4e4f12[_0x1dc5('0x1e')]);if(_0x4e4f12['name']){delete _0x4e4f12[_0x1dc5('0x1f')];}_0x37f008['status'](_0x487a26)['send'](_0x4e4f12);};}exports[_0x1dc5('0x20')]=function(_0x3ad21f,_0x21a292){var _0x5cd9c8={};var _0x1d17cc=_['map'](db[_0x1dc5('0x21')][_0x1dc5('0x22')],function(_0x3bfe37){return{'name':_0x3bfe37[_0x1dc5('0x23')],'type':_0x3bfe37['type'][_0x1dc5('0x24')]};});_0x5cd9c8=qs[_0x1dc5('0x25')](_0x1d17cc,_0x3ad21f);return interaction[_0x1dc5('0x26')](_0x1dc5('0x27'),_0x3ad21f['query'],_0x3ad21f[_0x1dc5('0x28')],_0x5cd9c8,_0x1d17cc)[_0x1dc5('0x1b')](respondWithFilteredResult(_0x21a292,_0x5cd9c8))[_0x1dc5('0x29')](handleError(_0x21a292,null));};exports[_0x1dc5('0x2a')]=function(_0x33ca61,_0x58ecfe){var _0xe4969f={'raw':![],'where':{'id':_0x33ca61[_0x1dc5('0x2b')]['id']}},_0x2acdf1={};_0x2acdf1[_0x1dc5('0x2c')]=_['keys'](db['FaxInteraction']['rawAttributes']);_0x2acdf1[_0x1dc5('0x2d')]=_[_0x1dc5('0x2e')](_0x33ca61[_0x1dc5('0x2d')]);_0x2acdf1['filters']=_['intersection'](_0x2acdf1[_0x1dc5('0x2c')],_0x2acdf1[_0x1dc5('0x2d')]);_0xe4969f['attributes']=_[_0x1dc5('0x2f')](_0x2acdf1[_0x1dc5('0x2c')],qs['fields'](_0x33ca61[_0x1dc5('0x2d')][_0x1dc5('0x30')]));_0xe4969f[_0x1dc5('0x31')]=_0xe4969f['attributes'][_0x1dc5('0x32')]?_0xe4969f[_0x1dc5('0x31')]:_0x2acdf1[_0x1dc5('0x2c')];if(_0x33ca61['query'][_0x1dc5('0x33')]){_0xe4969f[_0x1dc5('0x34')]=[{'all':!![]}];}_0xe4969f=_['merge']({},_0xe4969f,_0x33ca61['options']);return db[_0x1dc5('0x21')][_0x1dc5('0x35')](_0xe4969f)[_0x1dc5('0x1b')](handleEntityNotFound(_0x58ecfe,null))[_0x1dc5('0x1b')](respondWithResult(_0x58ecfe,null))[_0x1dc5('0x29')](handleError(_0x58ecfe,null));};exports[_0x1dc5('0x36')]=function(_0x48a001,_0x400655){return db['FaxInteraction']['create'](_0x48a001[_0x1dc5('0x37')],{})[_0x1dc5('0x1b')](respondWithResult(_0x400655,0xc9))[_0x1dc5('0x29')](handleError(_0x400655,null));};exports[_0x1dc5('0x19')]=function(_0x149e58,_0x1c9c05){if(_0x149e58[_0x1dc5('0x37')]['id']){delete _0x149e58[_0x1dc5('0x37')]['id'];}return db[_0x1dc5('0x21')]['find']({'where':{'id':_0x149e58[_0x1dc5('0x2b')]['id']}})[_0x1dc5('0x1b')](handleEntityNotFound(_0x1c9c05,null))[_0x1dc5('0x1b')](saveUpdates(_0x149e58[_0x1dc5('0x37')],null))['then'](respondWithResult(_0x1c9c05,null))[_0x1dc5('0x29')](handleError(_0x1c9c05,null));};exports[_0x1dc5('0x1a')]=function(_0x157e8d,_0x41b2d2){return db[_0x1dc5('0x21')][_0x1dc5('0x35')]({'where':{'id':_0x157e8d[_0x1dc5('0x2b')]['id']}})[_0x1dc5('0x1b')](handleEntityNotFound(_0x41b2d2,null))[_0x1dc5('0x1b')](removeEntity(_0x41b2d2,null))['catch'](handleError(_0x41b2d2,null));};exports['describe']=function(_0x52ce71,_0x1c2eac){return db[_0x1dc5('0x21')][_0x1dc5('0x38')]()[_0x1dc5('0x1b')](respondWithResult(_0x1c2eac,null))[_0x1dc5('0x29')](handleError(_0x1c2eac,null));};exports[_0x1dc5('0x39')]=function(_0x3d3206,_0x50c10c){return db[_0x1dc5('0x3a')]['find']({'where':{'id':_0x3d3206[_0x1dc5('0x2b')]['id']}})[_0x1dc5('0x1b')](handleEntityNotFound(_0x50c10c,null))['then'](function(_0x2e4cc8){if(_0x2e4cc8){return _0x2e4cc8[_0x1dc5('0x39')](_0x3d3206['body'][_0x1dc5('0x3b')],_[_0x1dc5('0x3c')](_0x3d3206['body'],['ids','id'])||{});}})[_0x1dc5('0x1b')](respondWithResult(_0x50c10c,null))['catch'](handleError(_0x50c10c,null));};exports[_0x1dc5('0x3d')]=function(_0xd7a88a,_0x241a26){var _0x421e61={'raw':![],'where':{}};var _0x1b0af3={};var _0x2c2179={'count':0x0,'rows':[]};return db[_0x1dc5('0x21')][_0x1dc5('0x3e')]({'where':{'id':_0xd7a88a[_0x1dc5('0x2b')]['id']}})['then'](handleEntityNotFound(_0x241a26,null))['then'](function(_0x17f48a){if(_0x17f48a){_0x1b0af3[_0x1dc5('0x2c')]=_['keys'](db[_0x1dc5('0x3a')][_0x1dc5('0x22')]);_0x1b0af3[_0x1dc5('0x2d')]=_[_0x1dc5('0x2e')](_0xd7a88a[_0x1dc5('0x2d')]);_0x1b0af3[_0x1dc5('0x3f')]=_['intersection'](_0x1b0af3[_0x1dc5('0x2c')],_0x1b0af3[_0x1dc5('0x2d')]);_0x421e61['attributes']=_[_0x1dc5('0x2f')](_0x1b0af3[_0x1dc5('0x2c')],qs[_0x1dc5('0x30')](_0xd7a88a['query']['fields']));_0x421e61[_0x1dc5('0x31')]=_0x421e61[_0x1dc5('0x31')][_0x1dc5('0x32')]?_0x421e61[_0x1dc5('0x31')]:_0x1b0af3[_0x1dc5('0x2c')];if(!_0xd7a88a[_0x1dc5('0x2d')][_0x1dc5('0x40')](_0x1dc5('0x41'))){_0x421e61[_0x1dc5('0x14')]=qs['limit'](_0xd7a88a[_0x1dc5('0x2d')][_0x1dc5('0x14')]);_0x421e61[_0x1dc5('0x13')]=qs[_0x1dc5('0x13')](_0xd7a88a[_0x1dc5('0x2d')][_0x1dc5('0x13')]);}_0x421e61[_0x1dc5('0x42')]=qs['sort'](_0xd7a88a[_0x1dc5('0x2d')]['sort']);_0x421e61[_0x1dc5('0x43')]=qs[_0x1dc5('0x3f')](_['pick'](_0xd7a88a['query'],_0x1b0af3['filters']));_0x421e61['where'][_0x1dc5('0x44')]=_0x17f48a['id'];if(_0xd7a88a[_0x1dc5('0x2d')][_0x1dc5('0x45')]){_0x421e61[_0x1dc5('0x43')]=_[_0x1dc5('0x46')](_0x421e61['where'],{'$or':_['map'](_0x421e61[_0x1dc5('0x31')],function(_0x25a14b){var _0x5b9304={};_0x5b9304[_0x25a14b]={'$like':'%'+_0xd7a88a[_0x1dc5('0x2d')][_0x1dc5('0x45')]+'%'};return _0x5b9304;})});}if(_0xd7a88a[_0x1dc5('0x2d')][_0x1dc5('0x47')]){var _0x2363e9=_0xd7a88a[_0x1dc5('0x2d')][_0x1dc5('0x47')][_0x1dc5('0x48')](',');var _0x4b1fdd={};_0x4b1fdd[_0x2363e9[0x0]]={'$gte':moment(_0x2363e9[0x1])[_0x1dc5('0x49')](_0x1dc5('0x4a'))};_0x421e61[_0x1dc5('0x43')]=_[_0x1dc5('0x46')](_0x421e61[_0x1dc5('0x43')],_0x4b1fdd);}_0x421e61=_[_0x1dc5('0x46')]({},_0x421e61,_0xd7a88a[_0x1dc5('0x4b')]);return db[_0x1dc5('0x3a')][_0x1dc5('0x15')]({'where':_0x421e61['where']})['then'](function(_0x550f74){_0x2c2179[_0x1dc5('0x15')]=_0x550f74;if(_0xd7a88a['query']['includeAll']){_0x421e61[_0x1dc5('0x34')]=[{'all':!![]}];}return db[_0x1dc5('0x3a')]['findAll'](_0x421e61);})[_0x1dc5('0x1b')](function(_0x3a5759){_0x2c2179[_0x1dc5('0x4c')]=_0x3a5759;return _0x2c2179;});}})[_0x1dc5('0x1b')](respondWithFilteredResult(_0x241a26,_0x421e61))[_0x1dc5('0x29')](handleError(_0x241a26,null));};exports['addTags']=function(_0x384467,_0x5eb14d){return db['FaxInteraction']['find']({'where':{'id':_0x384467[_0x1dc5('0x2b')]['id']}})[_0x1dc5('0x1b')](handleEntityNotFound(_0x5eb14d,null))[_0x1dc5('0x1b')](function(_0x3062fb){if(_0x3062fb){return _0x3062fb[_0x1dc5('0x4d')](_0x384467[_0x1dc5('0x37')][_0x1dc5('0x3b')],_[_0x1dc5('0x3c')](_0x384467[_0x1dc5('0x37')],[_0x1dc5('0x3b'),'id'])||{})[_0x1dc5('0x4e')](function(){return db['Tag'][_0x1dc5('0x26')]({'attributes':['id',_0x1dc5('0x1f'),_0x1dc5('0x4f')],'where':{'id':_0x384467[_0x1dc5('0x37')]['ids']}});})['then'](function(_0x2655e6){socket['emit'](_0x1dc5('0x50'),{'id':Number(_0x384467[_0x1dc5('0x2b')]['id']),'tags':_0x2655e6||[]});return{'id':Number(_0x384467[_0x1dc5('0x2b')]['id']),'tags':_0x2655e6||[]};});}})[_0x1dc5('0x1b')](respondWithResult(_0x5eb14d,null))[_0x1dc5('0x29')](handleError(_0x5eb14d,null));};exports[_0x1dc5('0x51')]=function(_0x4f2766,_0x1a9c64){return db['FaxInteraction']['find']({'where':{'id':_0x4f2766[_0x1dc5('0x2b')]['id']}})[_0x1dc5('0x1b')](handleEntityNotFound(_0x1a9c64,null))[_0x1dc5('0x1b')](function(_0x46a345){if(_0x46a345){return _0x46a345['removeTags'](_0x4f2766[_0x1dc5('0x2d')][_0x1dc5('0x3b')]);}})[_0x1dc5('0x1b')](respondWithStatusCode(_0x1a9c64,null))[_0x1dc5('0x29')](handleError(_0x1a9c64,null));};exports[_0x1dc5('0x52')]=function(_0x3fe657,_0x454b35){var _0x467408=moment()[_0x1dc5('0x53')]()['toString']();var _0x17cd93=path[_0x1dc5('0x54')](config['root'],_0x1dc5('0x55'),_0x1dc5('0x56'),_0x1dc5('0x57'));var _0x4a9c82=path['join'](config['root'],_0x1dc5('0x55'),_0x1dc5('0x56'),_0x1dc5('0x58'));var _0x5ecb4f=path['join'](_0x17cd93,_0x467408);var _0xbff597=util['format'](_0x1dc5('0x59'),_0x3fe657[_0x1dc5('0x2b')]['id'],_0x467408);var _0x1db70a=path['join'](_0x17cd93,_0xbff597);var _0x243dc8=[];_0x243dc8[_0x1dc5('0x5a')]({'model':db[_0x1dc5('0x5b')],'as':_0x1dc5('0x5b'),'raw':!![]});var _0x5b58b9=[{'model':db[_0x1dc5('0x3a')],'as':_0x1dc5('0x5c'),'attributes':['id',_0x1dc5('0x37'),'createdAt'],'include':_0x243dc8}];return db[_0x1dc5('0x21')][_0x1dc5('0x35')]({'where':{'id':_0x3fe657['params']['id']},'include':_0x5b58b9})[_0x1dc5('0x1b')](handleEntityNotFound(_0x454b35,null))['then'](function(_0x4480d6){if(_0x4480d6&&_0x4480d6[_0x1dc5('0x5c')]){var _0x165727=_0x4480d6[_0x1dc5('0x5d')]({'plain':!![]});fs[_0x1dc5('0x5e')](_0x5ecb4f);for(var _0x3fd8a7=0x0;_0x3fd8a7<_0x165727[_0x1dc5('0x5c')][_0x1dc5('0x32')];_0x3fd8a7++){var _0x27e68c=_0x165727[_0x1dc5('0x5c')][_0x3fd8a7][_0x1dc5('0x5b')];if(_0x27e68c){var _0x3779f4=path['join'](_0x4a9c82,_0x27e68c['basename']);if(fs[_0x1dc5('0x5f')](_0x3779f4)){fs[_0x1dc5('0x60')](_0x3779f4)[_0x1dc5('0x61')](fs[_0x1dc5('0x62')](path['join'](_0x5ecb4f,_0x27e68c[_0x1dc5('0x63')])));}}}return BPromise[_0x1dc5('0x64')]()['then'](function(){return new BPromise(function(_0x5ecb99,_0x4d7353){zipdir(_0x5ecb4f,{'saveTo':_0x1db70a},function(_0x5bcbfc,_0x29ddb){if(_0x5bcbfc)return _0x4d7353(_0x5bcbfc);return _0x5ecb99(_0x29ddb);});})[_0x1dc5('0x1b')](function(){return new BPromise(function(_0x4bd124,_0x33babd){rimraf(_0x5ecb4f,function(_0x29398c){if(_0x29398c)_0x33babd(_0x29398c);return _0x4bd124();});});})[_0x1dc5('0x1b')](function(){return _0x454b35[_0x1dc5('0x52')](_0x1db70a,_0xbff597,function(_0x5c462e){if(_0x5c462e){console['log']('err',_0x5c462e);}else{fs[_0x1dc5('0x65')](_0x1db70a);}});});});}else{return _0x454b35[_0x1dc5('0x11')](0xc8);}})[_0x1dc5('0x29')](handleError(_0x454b35,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 6e3011b..8de3f91 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 _0xa695=['hook','exports','events','../../mysqldb','FaxInteraction','setMaxListeners','save','update','remove','then','setDataValue','Users','findAll','unreadMessages','length','catch','hasOwnProperty'];(function(_0x258b93,_0x188ccc){var _0x35484b=function(_0x2563ea){while(--_0x2563ea){_0x258b93['push'](_0x258b93['shift']());}};_0x35484b(++_0x188ccc);}(_0xa695,0x19a));var _0x5a69=function(_0x29d800,_0x4062d9){_0x29d800=_0x29d800-0x0;var _0x3ad3fd=_0xa695[_0x29d800];return _0x3ad3fd;};'use strict';var EventEmitter=require(_0x5a69('0x0'));var FaxInteraction=require(_0x5a69('0x1'))['db'][_0x5a69('0x2')];var FaxMessage=require(_0x5a69('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x5a69('0x3')](0x0);var events={'afterCreate':_0x5a69('0x4'),'afterUpdate':_0x5a69('0x5'),'afterDestroy':_0x5a69('0x6')};function emitEvent(_0x303c87){return function(_0x43030e,_0x2fe13d,_0x556f19){_0x43030e['getUsers']({'attributes':['id'],'raw':!![]})[_0x5a69('0x7')](function(_0x4d7a65){_0x43030e[_0x5a69('0x8')](_0x5a69('0x9'),_0x4d7a65['map'](function(_0x49c548){return{'id':_0x49c548['id']};}));return FaxMessage[_0x5a69('0xa')]({'where':{'FaxInteractionId':_0x43030e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5a69('0x7')](function(_0x1af72a){_0x43030e[_0x5a69('0x8')](_0x5a69('0xb'),_0x1af72a[_0x5a69('0xc')]);FaxInteractionEvents['emit'](_0x303c87+':'+_0x43030e['id'],_0x43030e);FaxInteractionEvents['emit'](_0x303c87,_0x43030e);_0x556f19(null);})[_0x5a69('0xd')](_0x556f19(null));};}for(var e in events){if(events[_0x5a69('0xe')](e)){var event=events[e];FaxInteraction[_0x5a69('0xf')](e,emitEvent(event));}}module[_0x5a69('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x10fe=['then','setDataValue','Users','findAll','unreadMessages','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','save','update','remove','getUsers'];(function(_0x255ad2,_0x2e46fb){var _0x4aef9b=function(_0x73755d){while(--_0x73755d){_0x255ad2['push'](_0x255ad2['shift']());}};_0x4aef9b(++_0x2e46fb);}(_0x10fe,0x76));var _0xe10f=function(_0x5928a7,_0x5b32c0){_0x5928a7=_0x5928a7-0x0;var _0x584413=_0x10fe[_0x5928a7];return _0x584413;};'use strict';var EventEmitter=require(_0xe10f('0x0'));var FaxInteraction=require(_0xe10f('0x1'))['db'][_0xe10f('0x2')];var FaxMessage=require(_0xe10f('0x1'))['db'][_0xe10f('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe10f('0x4'),'afterUpdate':_0xe10f('0x5'),'afterDestroy':_0xe10f('0x6')};function emitEvent(_0x4a6f05){return function(_0x12cf76,_0x53f904,_0x309fa9){_0x12cf76[_0xe10f('0x7')]({'attributes':['id'],'raw':!![]})[_0xe10f('0x8')](function(_0x1851cd){_0x12cf76[_0xe10f('0x9')](_0xe10f('0xa'),_0x1851cd['map'](function(_0x5f4c5c){return{'id':_0x5f4c5c['id']};}));return FaxMessage[_0xe10f('0xb')]({'where':{'FaxInteractionId':_0x12cf76['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe10f('0x8')](function(_0x31719d){_0x12cf76[_0xe10f('0x9')](_0xe10f('0xc'),_0x31719d[_0xe10f('0xd')]);FaxInteractionEvents['emit'](_0x4a6f05+':'+_0x12cf76['id'],_0x12cf76);FaxInteractionEvents['emit'](_0x4a6f05,_0x12cf76);_0x309fa9(null);})[_0xe10f('0xe')](_0x309fa9(null));};}for(var e in events){if(events[_0xe10f('0xf')](e)){var event=events[e];FaxInteraction[_0xe10f('0x10')](e,emitEvent(event));}}module[_0xe10f('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index e41d29f..3e8afb2 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 _0x0434=['path','rimraf','../../config/environment','./faxInteraction.attributes','exports','fax_interactions','changed','closed','closedAt','format','../../config/logger','api','bluebird','request-promise'];(function(_0x12b1d7,_0x5085de){var _0x27aa10=function(_0x3950b0){while(--_0x3950b0){_0x12b1d7['push'](_0x12b1d7['shift']());}};_0x27aa10(++_0x5085de);}(_0x0434,0xa4));var _0x4043=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x0434[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4043('0x0'))(_0x4043('0x1'));var moment=require('moment');var BPromise=require(_0x4043('0x2'));var rp=require(_0x4043('0x3'));var fs=require('fs');var path=require(_0x4043('0x4'));var rimraf=require(_0x4043('0x5'));var config=require(_0x4043('0x6'));var attributes=require(_0x4043('0x7'));module[_0x4043('0x8')]=function(_0x153c0d,_0x1a0a18){return _0x153c0d['define']('FaxInteraction',attributes,{'tableName':_0x4043('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x265235,_0x3ab457,_0x336173){if(_0x265235[_0x4043('0xa')](_0x4043('0xb'))){_0x265235[_0x4043('0xc')]=moment()[_0x4043('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x336173(null,_0x265235);}}});}; \ No newline at end of file +var _0x079b=['fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','path','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction'];(function(_0x4bcf38,_0x3c12be){var _0x4a89be=function(_0x3215a6){while(--_0x3215a6){_0x4bcf38['push'](_0x4bcf38['shift']());}};_0x4a89be(++_0x3c12be);}(_0x079b,0x165));var _0xb079=function(_0x347862,_0x339566){_0x347862=_0x347862-0x0;var _0x2ec88b=_0x079b[_0x347862];return _0x2ec88b;};'use strict';var _=require(_0xb079('0x0'));var util=require(_0xb079('0x1'));var logger=require(_0xb079('0x2'))(_0xb079('0x3'));var moment=require(_0xb079('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb079('0x5'));var rimraf=require(_0xb079('0x6'));var config=require('../../config/environment');var attributes=require(_0xb079('0x7'));module[_0xb079('0x8')]=function(_0x550064,_0x7f55c3){return _0x550064[_0xb079('0x9')](_0xb079('0xa'),attributes,{'tableName':_0xb079('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2213d2,_0x2323c5,_0x1179ca){if(_0x2213d2[_0xb079('0xc')](_0xb079('0xd'))){_0x2213d2['closedAt']=moment()[_0xb079('0xe')](_0xb079('0xf'));}_0x1179ca(null,_0x2213d2);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index a401a2e..7d32fdd 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 _0x4fe7=['rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','attributes','AddTagsToFaxInteraction','find','addTags','body','ids','omit','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x4fe7,0x96));var _0x74fe=function(_0x30b8b7,_0x47f106){_0x30b8b7=_0x30b8b7-0x0;var _0x1bfe00=_0x4fe7[_0x30b8b7];return _0x1bfe00;};'use strict';var _=require('lodash');var util=require(_0x74fe('0x0'));var moment=require(_0x74fe('0x1'));var BPromise=require(_0x74fe('0x2'));var rs=require(_0x74fe('0x3'));var fs=require('fs');var Redis=require(_0x74fe('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x74fe('0x5'))(_0x74fe('0x6'));var config=require(_0x74fe('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x74fe('0x8')]({'port':0x232a});config[_0x74fe('0x9')]=_[_0x74fe('0xa')](config['redis'],{'host':_0x74fe('0xb'),'port':0x18eb});var socket=require(_0x74fe('0xc'))(new Redis(config[_0x74fe('0x9')]));require(_0x74fe('0xd'))['register'](socket);function respondWithRpcPromise(_0x3c9224,_0x241088,_0x1a7dfc){return new BPromise(function(_0x146856,_0x3c9345){return client[_0x74fe('0xe')](_0x3c9224,_0x1a7dfc)[_0x74fe('0xf')](function(_0x56b7bb){logger[_0x74fe('0x10')](_0x74fe('0x11'),_0x241088,_0x74fe('0x12'));logger[_0x74fe('0x13')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x241088,'request\x20sent',JSON[_0x74fe('0x14')](_0x56b7bb));if(_0x56b7bb[_0x74fe('0x15')]){if(_0x56b7bb[_0x74fe('0x15')]['code']===0x1f4){logger[_0x74fe('0x15')](_0x74fe('0x11'),_0x241088,_0x56b7bb[_0x74fe('0x15')]['message']);return _0x3c9345(_0x56b7bb[_0x74fe('0x15')]['message']);}logger[_0x74fe('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x241088,_0x56b7bb['error'][_0x74fe('0x16')]);return _0x146856(_0x56b7bb['error']['message']);}else{logger[_0x74fe('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x241088,_0x74fe('0x12'));_0x146856(_0x56b7bb[_0x74fe('0x17')]['message']);}})[_0x74fe('0x18')](function(_0x17be4){logger[_0x74fe('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x241088,_0x17be4);_0x3c9345(_0x17be4);});});}exports[_0x74fe('0x19')]=function(_0x2c819a){var _0x5e310e=this;return new Promise(function(_0x1a1a01,_0x515a35){return db[_0x74fe('0x1a')][_0x74fe('0x1b')](_0x2c819a['body'],{'raw':_0x2c819a[_0x74fe('0x1c')]?_0x2c819a[_0x74fe('0x1c')][_0x74fe('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c819a[_0x74fe('0x1c')]?_0x2c819a[_0x74fe('0x1c')][_0x74fe('0x1e')]||null:null,'attributes':_0x2c819a[_0x74fe('0x1c')]?_0x2c819a[_0x74fe('0x1c')][_0x74fe('0x1f')]||null:null,'limit':_0x2c819a[_0x74fe('0x1c')]?_0x2c819a[_0x74fe('0x1c')]['limit']||null:null})[_0x74fe('0xf')](function(_0x3a0a28){logger[_0x74fe('0x10')](_0x74fe('0x19'),_0x2c819a);logger[_0x74fe('0x13')](_0x74fe('0x19'),_0x2c819a,JSON[_0x74fe('0x14')](_0x3a0a28));_0x1a1a01(_0x3a0a28);})[_0x74fe('0x18')](function(_0x13c77c){logger[_0x74fe('0x15')](_0x74fe('0x19'),_0x13c77c[_0x74fe('0x16')],_0x2c819a);_0x515a35(_0x5e310e['error'](0x1f4,_0x13c77c[_0x74fe('0x16')]));});});};exports[_0x74fe('0x20')]=function(_0x35ab7e){return new Promise(function(_0x7ec574,_0xa282cf){return db[_0x74fe('0x1a')][_0x74fe('0x21')]({'where':_0x35ab7e[_0x74fe('0x1c')]?_0x35ab7e[_0x74fe('0x1c')][_0x74fe('0x1e')]||null:null})[_0x74fe('0xf')](function(_0x67f371){if(_0x67f371){return _0x67f371[_0x74fe('0x22')](_0x35ab7e[_0x74fe('0x23')][_0x74fe('0x24')],_[_0x74fe('0x25')](_0x35ab7e[_0x74fe('0x23')],['ids','id'])||{});}})['spread'](function(_0x3a3e7c){logger['info'](_0x74fe('0x26'),_0x35ab7e);logger[_0x74fe('0x13')](_0x74fe('0x26'),_0x35ab7e,JSON[_0x74fe('0x14')](_0x3a3e7c));_0x7ec574(_0x3a3e7c);})[_0x74fe('0x18')](function(_0x2ec560){logger[_0x74fe('0x15')](_0x74fe('0x26'),_0x2ec560[_0x74fe('0x16')],_0x35ab7e);_0xa282cf(_this[_0x74fe('0x15')](0x1f4,_0x2ec560[_0x74fe('0x16')]));});});}; \ No newline at end of file +var _0xb4a5=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','update','body','options','where','attributes','limit','UpdateFaxInteraction','catch','AddTagsToFaxInteraction','addTags','spread','AddTags','debug','util','moment'];(function(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0xb4a5,0x10f));var _0x5b4a=function(_0x489aa6,_0x2db032){_0x489aa6=_0x489aa6-0x0;var _0x598aeb=_0xb4a5[_0x489aa6];return _0x598aeb;};'use strict';var _=require('lodash');var util=require(_0x5b4a('0x0'));var moment=require(_0x5b4a('0x1'));var BPromise=require(_0x5b4a('0x2'));var rs=require(_0x5b4a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b4a('0x4'))['db'];var utils=require(_0x5b4a('0x5'));var logger=require('../../config/logger')(_0x5b4a('0x6'));var config=require(_0x5b4a('0x7'));var jayson=require(_0x5b4a('0x8'));var client=jayson[_0x5b4a('0x9')]['http']({'port':0x232a});config[_0x5b4a('0xa')]=_[_0x5b4a('0xb')](config['redis'],{'host':_0x5b4a('0xc'),'port':0x18eb});var socket=require(_0x5b4a('0xd'))(new Redis(config[_0x5b4a('0xa')]));require(_0x5b4a('0xe'))['register'](socket);function respondWithRpcPromise(_0x32c9ca,_0x1780d3,_0x14fc98){return new BPromise(function(_0x15692b,_0xc59c8c){return client[_0x5b4a('0xf')](_0x32c9ca,_0x14fc98)[_0x5b4a('0x10')](function(_0x33a05c){logger['info'](_0x5b4a('0x11'),_0x1780d3,_0x5b4a('0x12'));logger['debug'](_0x5b4a('0x13'),_0x1780d3,_0x5b4a('0x12'),JSON[_0x5b4a('0x14')](_0x33a05c));if(_0x33a05c['error']){if(_0x33a05c['error'][_0x5b4a('0x15')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x1780d3,_0x33a05c[_0x5b4a('0x16')][_0x5b4a('0x17')]);return _0xc59c8c(_0x33a05c[_0x5b4a('0x16')][_0x5b4a('0x17')]);}logger[_0x5b4a('0x16')](_0x5b4a('0x11'),_0x1780d3,_0x33a05c[_0x5b4a('0x16')][_0x5b4a('0x17')]);return _0x15692b(_0x33a05c['error'][_0x5b4a('0x17')]);}else{logger[_0x5b4a('0x18')](_0x5b4a('0x11'),_0x1780d3,_0x5b4a('0x12'));_0x15692b(_0x33a05c[_0x5b4a('0x19')]['message']);}})['catch'](function(_0x1435b8){logger[_0x5b4a('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x1780d3,_0x1435b8);_0xc59c8c(_0x1435b8);});});}exports['UpdateFaxInteraction']=function(_0x6c4625){var _0x95ef95=this;return new Promise(function(_0x4467dd,_0x1c56fd){return db['FaxInteraction'][_0x5b4a('0x1a')](_0x6c4625[_0x5b4a('0x1b')],{'raw':_0x6c4625['options']?_0x6c4625[_0x5b4a('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6c4625[_0x5b4a('0x1c')]?_0x6c4625[_0x5b4a('0x1c')][_0x5b4a('0x1d')]||null:null,'attributes':_0x6c4625['options']?_0x6c4625[_0x5b4a('0x1c')][_0x5b4a('0x1e')]||null:null,'limit':_0x6c4625['options']?_0x6c4625[_0x5b4a('0x1c')][_0x5b4a('0x1f')]||null:null})[_0x5b4a('0x10')](function(_0x5a0b21){logger[_0x5b4a('0x18')](_0x5b4a('0x20'),_0x6c4625);logger['debug'](_0x5b4a('0x20'),_0x6c4625,JSON['stringify'](_0x5a0b21));_0x4467dd(_0x5a0b21);})[_0x5b4a('0x21')](function(_0x3861f7){logger[_0x5b4a('0x16')]('UpdateFaxInteraction',_0x3861f7[_0x5b4a('0x17')],_0x6c4625);_0x1c56fd(_0x95ef95['error'](0x1f4,_0x3861f7[_0x5b4a('0x17')]));});});};exports[_0x5b4a('0x22')]=function(_0x21374b){return new Promise(function(_0x3f794a,_0x4ed62d){return db['FaxInteraction']['find']({'where':_0x21374b['options']?_0x21374b[_0x5b4a('0x1c')]['where']||null:null})['then'](function(_0x433b16){if(_0x433b16){return _0x433b16[_0x5b4a('0x23')](_0x21374b[_0x5b4a('0x1b')]['ids'],_['omit'](_0x21374b[_0x5b4a('0x1b')],['ids','id'])||{});}})[_0x5b4a('0x24')](function(_0x43c1be){logger[_0x5b4a('0x18')](_0x5b4a('0x25'),_0x21374b);logger[_0x5b4a('0x26')]('AddTags',_0x21374b,JSON['stringify'](_0x43c1be));_0x3f794a(_0x43c1be);})['catch'](function(_0x5003ba){logger[_0x5b4a('0x16')]('AddTags',_0x5003ba[_0x5b4a('0x17')],_0x21374b);_0x4ed62d(_this[_0x5b4a('0x16')](0x1f4,_0x5003ba[_0x5b4a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index c064151..805f25c 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 _0x6a68=['./faxInteraction.events','save','remove','update','emit','removeListener','length','faxInteraction:'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x6a68,0x98));var _0x86a6=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x6a68[_0x9df060];return _0x338dfe;};'use strict';var FaxInteractionEvents=require(_0x86a6('0x0'));var events=[_0x86a6('0x1'),_0x86a6('0x2'),_0x86a6('0x3')];function createListener(_0x49528c,_0x427eb1){return function(_0x145bd8){_0x427eb1[_0x86a6('0x4')](_0x49528c,_0x145bd8);};}function removeListener(_0x45d507,_0x36d7e4){return function(){FaxInteractionEvents[_0x86a6('0x5')](_0x45d507,_0x36d7e4);};}exports['register']=function(_0x32237d){for(var _0x208b46=0x0,_0x4411c3=events[_0x86a6('0x6')];_0x208b46<_0x4411c3;_0x208b46++){var _0x1cd991=events[_0x208b46];var _0x3debc8=createListener(_0x86a6('0x7')+_0x1cd991,_0x32237d);FaxInteractionEvents['on'](_0x1cd991,_0x3debc8);}}; \ No newline at end of file +var _0xc1d6=['length','save','remove','update','removeListener','register'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xc1d6,0x15d));var _0x6c1d=function(_0x14748b,_0x43e493){_0x14748b=_0x14748b-0x0;var _0x105df8=_0xc1d6[_0x14748b];return _0x105df8;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x6c1d('0x0'),_0x6c1d('0x1'),_0x6c1d('0x2')];function createListener(_0x75954e,_0x267734){return function(_0x40c13c){_0x267734['emit'](_0x75954e,_0x40c13c);};}function removeListener(_0x375f80,_0x14b9c9){return function(){FaxInteractionEvents[_0x6c1d('0x3')](_0x375f80,_0x14b9c9);};}exports[_0x6c1d('0x4')]=function(_0x1b5c0d){for(var _0x2fb286=0x0,_0x529d78=events[_0x6c1d('0x5')];_0x2fb286<_0x529d78;_0x2fb286++){var _0x33a969=events[_0x2fb286];var _0xb65201=createListener('faxInteraction:'+_0x33a969,_0x1b5c0d);FaxInteractionEvents['on'](_0x33a969,_0xb65201);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 23a26d8..3c96579 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 _0x2568=['./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','fax','addTags','put','faxinteraction:update','delete','faxinteraction:destroy','/:id/tags','removeTags','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x24ce6a,_0x1ef136){var _0x34952b=function(_0x2aaff7){while(--_0x2aaff7){_0x24ce6a['push'](_0x24ce6a['shift']());}};_0x34952b(++_0x1ef136);}(_0x2568,0x12f));var _0x8256=function(_0x47778f,_0x36a93){_0x47778f=_0x47778f-0x0;var _0xc58b9d=_0x2568[_0x47778f];return _0xc58b9d;};'use strict';var multer=require(_0x8256('0x0'));var util=require('util');var path=require(_0x8256('0x1'));var timeout=require(_0x8256('0x2'));var express=require(_0x8256('0x3'));var router=express[_0x8256('0x4')]();var fs_extra=require(_0x8256('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8256('0x6'));var controller=require(_0x8256('0x7'));router[_0x8256('0x8')]('/',auth[_0x8256('0x9')](),controller[_0x8256('0xa')]);router[_0x8256('0x8')](_0x8256('0xb'),auth['isAuthenticated'](),controller[_0x8256('0xc')]);router[_0x8256('0x8')](_0x8256('0xd'),auth[_0x8256('0x9')](),controller[_0x8256('0xe')]);router[_0x8256('0x8')](_0x8256('0xf'),auth['isAuthenticated'](),controller[_0x8256('0x10')]);router['get'](_0x8256('0x11'),auth[_0x8256('0x9')](),controller[_0x8256('0x12')]);router[_0x8256('0x13')]('/',auth[_0x8256('0x9')](),controller[_0x8256('0x14')]);router['post']('/:id/messages',auth[_0x8256('0x9')](),controller[_0x8256('0x15')]);router[_0x8256('0x13')]('/:id/tags',auth[_0x8256('0x9')](),interaction[_0x8256('0x16')](_0x8256('0x17'),'faxinteraction:addtags'),controller[_0x8256('0x18')]);router[_0x8256('0x19')](_0x8256('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0x8256('0x17'),_0x8256('0x1a')),controller['update']);router[_0x8256('0x1b')]('/:id',auth[_0x8256('0x9')](),interaction['tracked'](_0x8256('0x17'),_0x8256('0x1c')),controller['destroy']);router['delete'](_0x8256('0x1d'),auth[_0x8256('0x9')](),controller[_0x8256('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x6dca=['exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','addTags','fax','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','/:id/tags'];(function(_0x1d49bb,_0x1a2aa6){var _0x1c310d=function(_0x25340c){while(--_0x25340c){_0x1d49bb['push'](_0x1d49bb['shift']());}};_0x1c310d(++_0x1a2aa6);}(_0x6dca,0x8d));var _0xa6dc=function(_0x155133,_0x18d682){_0x155133=_0x155133-0x0;var _0x1feb4e=_0x6dca[_0x155133];return _0x1feb4e;};'use strict';var multer=require(_0xa6dc('0x0'));var util=require(_0xa6dc('0x1'));var path=require('path');var timeout=require(_0xa6dc('0x2'));var express=require(_0xa6dc('0x3'));var router=express[_0xa6dc('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa6dc('0x5'));var config=require(_0xa6dc('0x6'));var controller=require(_0xa6dc('0x7'));router[_0xa6dc('0x8')]('/',auth['isAuthenticated'](),controller[_0xa6dc('0x9')]);router[_0xa6dc('0x8')](_0xa6dc('0xa'),auth[_0xa6dc('0xb')](),controller[_0xa6dc('0xc')]);router[_0xa6dc('0x8')](_0xa6dc('0xd'),auth[_0xa6dc('0xb')](),controller['show']);router[_0xa6dc('0x8')](_0xa6dc('0xe'),auth[_0xa6dc('0xb')](),controller[_0xa6dc('0xf')]);router[_0xa6dc('0x8')](_0xa6dc('0x10'),auth[_0xa6dc('0xb')](),controller[_0xa6dc('0x11')]);router[_0xa6dc('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa6dc('0x12')](_0xa6dc('0xe'),auth[_0xa6dc('0xb')](),controller['addMessage']);router[_0xa6dc('0x12')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked']('fax','faxinteraction:addtags'),controller[_0xa6dc('0x13')]);router['put'](_0xa6dc('0xd'),auth[_0xa6dc('0xb')](),interaction['tracked'](_0xa6dc('0x14'),_0xa6dc('0x15')),controller[_0xa6dc('0x16')]);router[_0xa6dc('0x17')](_0xa6dc('0xd'),auth['isAuthenticated'](),interaction['tracked']('fax',_0xa6dc('0x18')),controller[_0xa6dc('0x19')]);router[_0xa6dc('0x17')](_0xa6dc('0x1a'),auth[_0xa6dc('0xb')](),controller['removeTags']);module[_0xa6dc('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 1b134e6..f832ad3 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 _0x644a=['out','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x2a5c01,_0x1d4a70){var _0xa07bf0=function(_0x518c1d){while(--_0x518c1d){_0x2a5c01['push'](_0x2a5c01['shift']());}};_0xa07bf0(++_0x1d4a70);}(_0x644a,0xfd));var _0xa644=function(_0x7729b1,_0x468322){_0x7729b1=_0x7729b1-0x0;var _0x349504=_0x644a[_0x7729b1];return _0x349504;};'use strict';var Sequelize=require(_0xa644('0x0'));module[_0xa644('0x1')]={'body':{'type':Sequelize[_0xa644('0x2')](_0xa644('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa644('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa644('0x5')),'defaultValue':_0xa644('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x008c=['sequelize','exports','TEXT','medium','BOOLEAN','out','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x008c,0x188));var _0xc008=function(_0x450bf9,_0x1895de){_0x450bf9=_0x450bf9-0x0;var _0x268350=_0x008c[_0x450bf9];return _0x268350;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'body':{'type':Sequelize[_0xc008('0x2')](_0xc008('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc008('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc008('0x5')),'defaultValue':_0xc008('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xc008('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xc008('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 7159701..1aefa5e 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 _0x78cb=['jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','end','status','offset','undefined','limit','count','set','json','reject','save','update','destroy','stack','name','map','FaxMessage','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','body','describe','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','SIP/%s','motionChannel','channel','event','EventManager','acceptmessage','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','sequelize','interface','create','CmContact','findOne','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','root','files','attachments','join','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto'];(function(_0x2116cc,_0x34952a){var _0x2a6ee1=function(_0x4c13e2){while(--_0x4c13e2){_0x2116cc['push'](_0x2116cc['shift']());}};_0x2a6ee1(++_0x34952a);}(_0x78cb,0x82));var _0xb78c=function(_0x5ec0bc,_0x2e38ee){_0x5ec0bc=_0x5ec0bc-0x0;var _0x4d1cf4=_0x78cb[_0x5ec0bc];return _0x4d1cf4;};'use strict';var emlformat=require(_0xb78c('0x0'));var rimraf=require(_0xb78c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb78c('0x2'));var BPromise=require(_0xb78c('0x3'));var Mustache=require(_0xb78c('0x4'));var util=require(_0xb78c('0x5'));var path=require(_0xb78c('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb78c('0x7'));var fs=require('fs');var fs_extra=require(_0xb78c('0x8'));var _=require(_0xb78c('0x9'));var squel=require(_0xb78c('0xa'));var crypto=require(_0xb78c('0xb'));var jsforce=require(_0xb78c('0xc'));var deskjs=require(_0xb78c('0xd'));var toCsv=require(_0xb78c('0xe'));var querystring=require(_0xb78c('0xf'));var Papa=require(_0xb78c('0x10'));var Redis=require('ioredis');var authService=require(_0xb78c('0x11'));var qs=require(_0xb78c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb78c('0x13'))(_0xb78c('0x14'));var utils=require('../../config/utils');var config=require(_0xb78c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb78c('0x16'))['db'];config[_0xb78c('0x17')]=_[_0xb78c('0x18')](config['redis'],{'host':_0xb78c('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb78c('0x17')]));require(_0xb78c('0x1a'))[_0xb78c('0x1b')](socket);var jayson=require(_0xb78c('0x1c'));var client=jayson[_0xb78c('0x1d')][_0xb78c('0x1e')]({'port':0x232c});var client9002=jayson[_0xb78c('0x1d')][_0xb78c('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x24af08,_0xd4b63,_0x4495c0,_0x289a25){return new BPromise(function(_0x2b75e7,_0x1b8cd8){var _0x1fd79e=_0x289a25||client;return _0x1fd79e[_0xb78c('0x1f')](_0x24af08,_0x4495c0)[_0xb78c('0x20')](function(_0x8b6c31){logger[_0xb78c('0x21')](_0xb78c('0x22'),_0xd4b63,_0xb78c('0x23'));logger[_0xb78c('0x24')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0xd4b63,_0xb78c('0x23'),JSON['stringify'](_0x8b6c31));if(_0x8b6c31[_0xb78c('0x25')]){if(_0x8b6c31[_0xb78c('0x25')][_0xb78c('0x26')]===0x1f4){logger[_0xb78c('0x25')](_0xb78c('0x22'),_0xd4b63,_0x8b6c31[_0xb78c('0x25')]['message']);return _0x1b8cd8(_0x8b6c31[_0xb78c('0x25')]['message']);}logger[_0xb78c('0x25')]('FaxMessage,\x20%s,\x20%s',_0xd4b63,_0x8b6c31[_0xb78c('0x25')][_0xb78c('0x27')]);return _0x2b75e7(_0x8b6c31['error'][_0xb78c('0x27')]);}else{logger[_0xb78c('0x21')](_0xb78c('0x22'),_0xd4b63,_0xb78c('0x23'));_0x2b75e7(_0x8b6c31['result']['message']);}})[_0xb78c('0x28')](function(_0x39de29){logger['error']('FaxMessage,\x20%s,\x20%s',_0xd4b63,_0x39de29);_0x1b8cd8(_0x39de29);});});}function respondWithStatusCode(_0x5d3c3e,_0x5f252c){_0x5f252c=_0x5f252c||0xcc;return function(_0x440f01){if(_0x440f01){return _0x5d3c3e[_0xb78c('0x29')](_0x5f252c);}return _0x5d3c3e['status'](_0x5f252c)[_0xb78c('0x2a')]();};}function respondWithResult(_0x2016ce,_0x2270c2){_0x2270c2=_0x2270c2||0xc8;return function(_0xe425f9){if(_0xe425f9){return _0x2016ce[_0xb78c('0x2b')](_0x2270c2)['json'](_0xe425f9);}};}function respondWithFilteredResult(_0x3d15d5,_0x5d3fcd){return function(_0x2deda2){if(_0x2deda2){var _0x2a46bc=typeof _0x5d3fcd[_0xb78c('0x2c')]===_0xb78c('0x2d')&&typeof _0x5d3fcd[_0xb78c('0x2e')]==='undefined';var _0x5e8405=_0x2deda2[_0xb78c('0x2f')];var _0x1d5f1c=_0x2a46bc?0x0:_0x5d3fcd[_0xb78c('0x2c')];var _0x4d1f0f=_0x2a46bc?_0x2deda2[_0xb78c('0x2f')]:_0x5d3fcd[_0xb78c('0x2c')]+_0x5d3fcd[_0xb78c('0x2e')];var _0x5e1b9f;if(_0x4d1f0f>=_0x5e8405){_0x4d1f0f=_0x5e8405;_0x5e1b9f=0xc8;}else{_0x5e1b9f=0xce;}_0x3d15d5['status'](_0x5e1b9f);return _0x3d15d5[_0xb78c('0x30')]('Content-Range',_0x1d5f1c+'-'+_0x4d1f0f+'/'+_0x5e8405)[_0xb78c('0x31')](_0x2deda2);}return null;};}function patchUpdates(_0x5de980){return function(_0x5d9466){try{jsonpatch['apply'](_0x5d9466,_0x5de980,!![]);}catch(_0x5ea994){return BPromise[_0xb78c('0x32')](_0x5ea994);}return _0x5d9466[_0xb78c('0x33')]();};}function saveUpdates(_0x1260f2,_0x5b65a6){return function(_0x14f419){if(_0x14f419){return _0x14f419[_0xb78c('0x34')](_0x1260f2)['then'](function(_0x26e8d1){return _0x26e8d1;});}return null;};}function removeEntity(_0x40033a,_0x109e9d){return function(_0xb312ca){if(_0xb312ca){return _0xb312ca[_0xb78c('0x35')]()[_0xb78c('0x20')](function(){_0x40033a[_0xb78c('0x2b')](0xcc)[_0xb78c('0x2a')]();});}};}function handleEntityNotFound(_0xb46107,_0x423615){return function(_0xb8ce4b){if(!_0xb8ce4b){_0xb46107[_0xb78c('0x29')](0x194);}return _0xb8ce4b;};}function handleError(_0x16d40f,_0x1533ec){_0x1533ec=_0x1533ec||0x1f4;return function(_0x218c93){logger[_0xb78c('0x25')](_0x218c93[_0xb78c('0x36')]);if(_0x218c93[_0xb78c('0x37')]){delete _0x218c93[_0xb78c('0x37')];}_0x16d40f[_0xb78c('0x2b')](_0x1533ec)['send'](_0x218c93);};}exports['index']=function(_0x2fb1f8,_0x170021){var _0x50bee2={},_0x485a43={},_0x508427={'count':0x0,'rows':[]};var _0x38b733=_[_0xb78c('0x38')](db[_0xb78c('0x39')]['rawAttributes'],function(_0x3e417c){return{'name':_0x3e417c[_0xb78c('0x3a')],'type':_0x3e417c[_0xb78c('0x3b')][_0xb78c('0x3c')]};});_0x485a43[_0xb78c('0x3d')]=_[_0xb78c('0x38')](_0x38b733,_0xb78c('0x37'));_0x485a43[_0xb78c('0x3e')]=_['keys'](_0x2fb1f8[_0xb78c('0x3e')]);_0x485a43[_0xb78c('0x3f')]=_[_0xb78c('0x40')](_0x485a43[_0xb78c('0x3d')],_0x485a43[_0xb78c('0x3e')]);_0x50bee2[_0xb78c('0x41')]=_['intersection'](_0x485a43[_0xb78c('0x3d')],qs[_0xb78c('0x42')](_0x2fb1f8[_0xb78c('0x3e')][_0xb78c('0x42')]));_0x50bee2[_0xb78c('0x41')]=_0x50bee2[_0xb78c('0x41')][_0xb78c('0x43')]?_0x50bee2[_0xb78c('0x41')]:_0x485a43[_0xb78c('0x3d')];if(!_0x2fb1f8[_0xb78c('0x3e')][_0xb78c('0x44')](_0xb78c('0x45'))){_0x50bee2['limit']=qs['limit'](_0x2fb1f8[_0xb78c('0x3e')][_0xb78c('0x2e')]);_0x50bee2[_0xb78c('0x2c')]=qs[_0xb78c('0x2c')](_0x2fb1f8[_0xb78c('0x3e')][_0xb78c('0x2c')]);}_0x50bee2['order']=qs[_0xb78c('0x46')](_0x2fb1f8[_0xb78c('0x3e')][_0xb78c('0x46')]);_0x50bee2[_0xb78c('0x47')]=qs[_0xb78c('0x3f')](_[_0xb78c('0x48')](_0x2fb1f8['query'],_0x485a43[_0xb78c('0x3f')]),_0x38b733);if(_0x2fb1f8[_0xb78c('0x3e')]['filter']){_0x50bee2[_0xb78c('0x47')]=_[_0xb78c('0x49')](_0x50bee2[_0xb78c('0x47')],{'$or':_[_0xb78c('0x38')](_0x38b733,function(_0x2325a8){if(_0x2325a8['type']!==_0xb78c('0x4a')){var _0x2583d8={};_0x2583d8[_0x2325a8[_0xb78c('0x37')]]={'$like':'%'+_0x2fb1f8[_0xb78c('0x3e')][_0xb78c('0x4b')]+'%'};return _0x2583d8;}})});}_0x50bee2=_[_0xb78c('0x49')]({},_0x50bee2,_0x2fb1f8[_0xb78c('0x4c')]);var _0x356ac0={'where':_0x50bee2[_0xb78c('0x47')]};return db['FaxMessage'][_0xb78c('0x2f')](_0x356ac0)[_0xb78c('0x20')](function(_0x1b924a){_0x508427[_0xb78c('0x2f')]=_0x1b924a;if(_0x2fb1f8[_0xb78c('0x3e')][_0xb78c('0x4d')]){_0x50bee2[_0xb78c('0x4e')]=[{'all':!![]}];}return db[_0xb78c('0x39')][_0xb78c('0x4f')](_0x50bee2);})[_0xb78c('0x20')](function(_0x5c40f3){_0x508427[_0xb78c('0x50')]=_0x5c40f3;return _0x508427;})['then'](respondWithFilteredResult(_0x170021,_0x50bee2))[_0xb78c('0x28')](handleError(_0x170021,null));};exports[_0xb78c('0x51')]=function(_0x5e5fd1,_0x37cc4b){var _0x5d6532={'raw':!![],'where':{'id':_0x5e5fd1[_0xb78c('0x52')]['id']}},_0x3d8914={};_0x3d8914[_0xb78c('0x3d')]=_[_0xb78c('0x53')](db[_0xb78c('0x39')][_0xb78c('0x54')]);_0x3d8914[_0xb78c('0x3e')]=_[_0xb78c('0x53')](_0x5e5fd1[_0xb78c('0x3e')]);_0x3d8914[_0xb78c('0x3f')]=_[_0xb78c('0x40')](_0x3d8914[_0xb78c('0x3d')],_0x3d8914[_0xb78c('0x3e')]);_0x5d6532[_0xb78c('0x41')]=_['intersection'](_0x3d8914['model'],qs[_0xb78c('0x42')](_0x5e5fd1[_0xb78c('0x3e')]['fields']));_0x5d6532[_0xb78c('0x41')]=_0x5d6532['attributes'][_0xb78c('0x43')]?_0x5d6532['attributes']:_0x3d8914[_0xb78c('0x3d')];if(_0x5e5fd1[_0xb78c('0x3e')][_0xb78c('0x4d')]){_0x5d6532[_0xb78c('0x4e')]=[{'all':!![]}];}_0x5d6532=_['merge']({},_0x5d6532,_0x5e5fd1[_0xb78c('0x4c')]);return db[_0xb78c('0x39')][_0xb78c('0x55')](_0x5d6532)['then'](handleEntityNotFound(_0x37cc4b,null))[_0xb78c('0x20')](respondWithResult(_0x37cc4b,null))[_0xb78c('0x28')](handleError(_0x37cc4b,null));};exports[_0xb78c('0x34')]=function(_0x52174c,_0x4a23dc){if(_0x52174c[_0xb78c('0x56')]['id']){delete _0x52174c[_0xb78c('0x56')]['id'];}return db[_0xb78c('0x39')][_0xb78c('0x55')]({'where':{'id':_0x52174c[_0xb78c('0x52')]['id']}})[_0xb78c('0x20')](handleEntityNotFound(_0x4a23dc,null))[_0xb78c('0x20')](saveUpdates(_0x52174c[_0xb78c('0x56')],null))['then'](respondWithResult(_0x4a23dc,null))[_0xb78c('0x28')](handleError(_0x4a23dc,null));};exports['destroy']=function(_0x5e3e5c,_0x3160e5){return db['FaxMessage'][_0xb78c('0x55')]({'where':{'id':_0x5e3e5c[_0xb78c('0x52')]['id']}})[_0xb78c('0x20')](handleEntityNotFound(_0x3160e5,null))['then'](removeEntity(_0x3160e5,null))[_0xb78c('0x28')](handleError(_0x3160e5,null));};exports[_0xb78c('0x57')]=function(_0x481f20,_0x4dba30){return db[_0xb78c('0x39')][_0xb78c('0x57')]()[_0xb78c('0x20')](respondWithResult(_0x4dba30,null))[_0xb78c('0x28')](handleError(_0x4dba30,null));};var interaction_log=require(_0xb78c('0x13'))(_0xb78c('0x58'));exports[_0xb78c('0x59')]=function(_0x4632f4,_0x1b26e0,_0x20ee49){var _0x533742={'agent':{},'channel':'fax'};if(_0x4632f4[_0xb78c('0x56')]['id']){delete _0x4632f4[_0xb78c('0x56')]['id'];}_0x4632f4[_0xb78c('0x56')][_0xb78c('0x5a')]=!![];_0x4632f4[_0xb78c('0x56')][_0xb78c('0x5b')]=moment()[_0xb78c('0x5c')](_0xb78c('0x5d'));_0x4632f4[_0xb78c('0x56')][_0xb78c('0x5e')]=_0x4632f4[_0xb78c('0x56')]['UserId']||_0x4632f4[_0xb78c('0x5f')]['id'];_0x533742[_0xb78c('0x60')]['id']=_0x4632f4[_0xb78c('0x56')][_0xb78c('0x5e')];return db['FaxMessage']['find']({'where':{'id':_0x4632f4[_0xb78c('0x52')]['id'],'UserId':null}})[_0xb78c('0x20')](handleEntityNotFound(_0x1b26e0,null))[_0xb78c('0x20')](saveUpdates(_0x4632f4[_0xb78c('0x56')],null))[_0xb78c('0x20')](function(_0x5645b8){if(_0x5645b8){_0x533742['message']=_0x5645b8['get']({'plain':!![]});return db[_0xb78c('0x61')][_0xb78c('0x55')]({'where':{'id':_0x5645b8[_0xb78c('0x62')]}});}return null;})[_0xb78c('0x20')](handleEntityNotFound(_0x1b26e0,null))[_0xb78c('0x20')](function(_0x2c5a06){if(_0x2c5a06){return _0x2c5a06[_0xb78c('0x34')]({'UserId':_0x4632f4[_0xb78c('0x56')][_0xb78c('0x5e')],'read1stAt':_[_0xb78c('0x63')](_0x2c5a06[_0xb78c('0x64')])?moment()[_0xb78c('0x5c')](_0xb78c('0x5d')):undefined});}return null;})[_0xb78c('0x20')](function(_0x1a1b61){if(_0x1a1b61){_0x533742[_0xb78c('0x65')]=_0x1a1b61[_0xb78c('0x66')]({'plain':!![]});interaction_log[_0xb78c('0x21')](_0xb78c('0x67'),_0x4632f4[_0xb78c('0x5f')]['id'],_0x4632f4[_0xb78c('0x5f')]['name'],_0x4632f4[_0xb78c('0x5f')][_0xb78c('0x68')],_0x533742['interaction']['id'],_0x4632f4[_0xb78c('0x56')]?JSON[_0xb78c('0x69')](_0x4632f4[_0xb78c('0x56')]):_0xb78c('0x6a'));return respondWithRpcPromise(_0xb78c('0x6b'),_0xb78c('0x6c'),_0x533742);}return null;})['then'](function(_0x36964b){var _0xa8caa7=_0xb78c('0x6d')+_0x36964b[_0xb78c('0x27')][_0xb78c('0x6e')];return db['sequelize'][_0xb78c('0x3e')](_0xa8caa7,{'type':db[_0xb78c('0x6f')][_0xb78c('0x70')][_0xb78c('0x71')],'raw':!![]})[_0xb78c('0x20')](function(_0x2b7fd8){return _0x2b7fd8;});})[_0xb78c('0x20')](function(_0x520294){if(_0x520294){_0x533742[_0xb78c('0x27')][_0xb78c('0x72')]=_0x520294[0x0];if(!_0x4632f4[_0xb78c('0x56')][_0xb78c('0x5e')])return;return db[_0xb78c('0x73')][_0xb78c('0x55')]({'where':{'id':_0x4632f4[_0xb78c('0x56')][_0xb78c('0x5e')],'role':_0xb78c('0x60')},'attributes':['id',_0xb78c('0x37'),'fullname',_0xb78c('0x74'),_0xb78c('0x75')],'raw':!![]});}return null;})[_0xb78c('0x20')](function(_0x1aa20a){if(!_0x1aa20a)return null;_0x533742[_0xb78c('0x27')]['agent']=_0x1aa20a;return _0x533742;})[_0xb78c('0x20')](function(_0x1a835e){if(_0x1a835e){if(_0x4632f4[_0xb78c('0x56')][_0xb78c('0x76')]){_0x533742[_0xb78c('0x27')]['interface']=util['format'](_0xb78c('0x77'),_0x4632f4[_0xb78c('0x5f')][_0xb78c('0x37')]);_0x533742[_0xb78c('0x27')]['channel']=_0x533742['channel'];_0x533742['message'][_0xb78c('0x78')]=_0x533742[_0xb78c('0x79')];_0x533742[_0xb78c('0x27')][_0xb78c('0x7a')]='accept';return respondWithRpcPromise(_0xb78c('0x7b'),_0xb78c('0x7b'),{'event':_0xb78c('0x7c'),'message':_0x533742['message']},client9002)[_0xb78c('0x20')](function(){return _0x533742;});}return _0x533742;}return null;})[_0xb78c('0x20')](respondWithResult(_0x1b26e0,null))['catch'](handleError(_0x1b26e0,null));};var interaction_log=require(_0xb78c('0x13'))(_0xb78c('0x58'));exports[_0xb78c('0x32')]=function(_0x51b4df,_0x5e1077,_0x26344d){var _0x9661b1={'agent':{},'channel':_0xb78c('0x7d')};if(_0x51b4df['body']['id']){delete _0x51b4df['body']['id'];}_0x51b4df[_0xb78c('0x56')]['UserId']=_0x51b4df['body']['UserId']||_0x51b4df['user']['id'];_0x9661b1['agent']['id']=_0x51b4df['body'][_0xb78c('0x5e')];return db[_0xb78c('0x39')][_0xb78c('0x55')]({'where':{'id':_0x51b4df[_0xb78c('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5e1077,null))['then'](function(_0x5ba454){if(_0x5ba454){_0x9661b1['message']=_0x5ba454[_0xb78c('0x66')]({'plain':!![]});return db[_0xb78c('0x61')][_0xb78c('0x55')]({'where':{'id':_0x5ba454[_0xb78c('0x62')]}});}return null;})[_0xb78c('0x20')](handleEntityNotFound(_0x5e1077,null))['then'](function(_0x17228b){if(_0x17228b){_0x9661b1['interaction']=_0x17228b['get']({'plain':!![]});interaction_log['info'](_0xb78c('0x7e'),_0x51b4df[_0xb78c('0x5f')]['id'],_0x51b4df[_0xb78c('0x5f')]['name'],_0x51b4df['user'][_0xb78c('0x68')],_0x9661b1[_0xb78c('0x65')]['id'],_0x51b4df['body']?JSON[_0xb78c('0x69')](_0x51b4df[_0xb78c('0x56')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x9661b1);}return null;})['then'](function(_0x466fa2){var _0x44bf51=_0xb78c('0x6d')+_0x466fa2[_0xb78c('0x27')][_0xb78c('0x6e')];return db[_0xb78c('0x7f')]['query'](_0x44bf51,{'type':db[_0xb78c('0x6f')][_0xb78c('0x70')]['SELECT'],'raw':!![]})[_0xb78c('0x20')](function(_0x185768){return _0x185768;});})[_0xb78c('0x20')](function(_0x1bbfda){if(_0x1bbfda){_0x9661b1[_0xb78c('0x27')][_0xb78c('0x72')]=_0x1bbfda[0x0];if(!_0x51b4df[_0xb78c('0x56')][_0xb78c('0x5e')])return;return db[_0xb78c('0x73')]['find']({'where':{'id':_0x51b4df[_0xb78c('0x56')][_0xb78c('0x5e')],'role':_0xb78c('0x60')},'attributes':['id','name','fullname',_0xb78c('0x74'),_0xb78c('0x75')],'raw':!![]});}return null;})[_0xb78c('0x20')](function(_0x111117){if(!_0x111117)return null;_0x9661b1['message'][_0xb78c('0x60')]=_0x111117;return _0x9661b1;})[_0xb78c('0x20')](function(_0x33a702){if(_0x33a702){_0x33a702['message'][_0xb78c('0x80')]=util[_0xb78c('0x5c')](_0xb78c('0x77'),_0x51b4df[_0xb78c('0x5f')][_0xb78c('0x37')]);_0x33a702[_0xb78c('0x27')][_0xb78c('0x79')]=_0x9661b1[_0xb78c('0x79')];_0x33a702[_0xb78c('0x27')]['motionChannel']=_0x9661b1[_0xb78c('0x79')];_0x33a702['message'][_0xb78c('0x7a')]=_0xb78c('0x32');respondWithRpcPromise(_0xb78c('0x7b'),_0xb78c('0x7b'),{'event':'rejectmessage','message':_0x33a702[_0xb78c('0x27')]},client9002);return _0x9661b1;}return null;})[_0xb78c('0x20')](respondWithResult(_0x5e1077,null))[_0xb78c('0x28')](handleError(_0x5e1077,null));};exports['create']=function(_0x13eeb1,_0x1c08f6){var _0x3fa910;return db[_0xb78c('0x39')][_0xb78c('0x81')](_0x13eeb1[_0xb78c('0x56')],{})[_0xb78c('0x20')](function(_0x53f3d7){_0x3fa910=_0x53f3d7;return db[_0xb78c('0x82')][_0xb78c('0x83')]({'where':{'id':_0x3fa910[_0xb78c('0x6e')]}});})[_0xb78c('0x20')](function(_0x4ac202){if(_[_0xb78c('0x63')](_0x4ac202)){return;}else{_0x3fa910['fax']=_0x4ac202[_0xb78c('0x7d')];return db[_0xb78c('0x84')]['findOne']({'where':{'id':_0x3fa910[_0xb78c('0x85')]}});}})[_0xb78c('0x20')](function(_0x4f40a6){return respondWithRpcPromise(_0xb78c('0x86'),_0xb78c('0x86'),{'FaxAccountId':_[_0xb78c('0x63')](_0x13eeb1[_0xb78c('0x56')])?undefined:_0x13eeb1[_0xb78c('0x56')]['FaxAccountId'],'path':_[_0xb78c('0x63')](_0x4f40a6)?undefined:util['format'](_0xb78c('0x87'),_0x4f40a6[_0xb78c('0x88')]),'fax':_[_0xb78c('0x63')](_0x3fa910[_0xb78c('0x7d')])?undefined:_0x3fa910['fax'],'AttachmentId':_0x3fa910[_0xb78c('0x85')]},client9002);})['then'](respondWithResult(_0x1c08f6,0xc9))['catch'](handleError(_0x1c08f6,null));};exports[_0xb78c('0x89')]=function(_0x56a739,_0x5608c1){var _0x12fc03=path['join'](config[_0xb78c('0x8a')],'server',_0xb78c('0x8b'),_0xb78c('0x8c'));return db[_0xb78c('0x39')][_0xb78c('0x55')]({'where':{'id':_0x56a739['params']['id']},'include':[{'model':db[_0xb78c('0x84')],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x5608c1,null))['then'](function(_0x2699f9){if(_0x2699f9){return _0x5608c1[_0xb78c('0x89')](path[_0xb78c('0x8d')](_0x12fc03,_0x2699f9[_0xb78c('0x84')][_0xb78c('0x88')]));}})[_0xb78c('0x28')](handleError(_0x5608c1,null));}; \ No newline at end of file +var _0xadc5=['download','join','root','files','attachments','path','ioredis','../../components/interaction/service','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','client','fax-interactions','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','undefined','count','offset','set','Content-Range','json','update','destroy','end','sendStatus','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','findAll','rows','show','include','find','body','params','describe','accept','sms','fax','acceptMessage','reject','UserId','agent','get','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','rejectMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','email','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xadc5,0x1d5));var _0x5adc=function(_0x103b05,_0x574615){_0x103b05=_0x103b05-0x0;var _0xe278c5=_0xadc5[_0x103b05];return _0xe278c5;};'use strict';var util=require('util');var path=require(_0x5adc('0x0'));var _=require('lodash');var Redis=require(_0x5adc('0x1'));var interactionService=require(_0x5adc('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x5adc('0x3'))('api');var config=require(_0x5adc('0x4'));var db=require('../../mysqldb')['db'];config[_0x5adc('0x5')]=_[_0x5adc('0x6')](config[_0x5adc('0x5')],{'host':_0x5adc('0x7'),'port':0x18eb});var socket=require(_0x5adc('0x8'))(new Redis(config['redis']));require(_0x5adc('0x9'))[_0x5adc('0xa')](socket);var jayson=require(_0x5adc('0xb'));var client=jayson['client'][_0x5adc('0xc')]({'port':0x232c});var client9002=jayson[_0x5adc('0xd')][_0x5adc('0xc')]({'port':0x232a});var interaction_log=require(_0x5adc('0x3'))(_0x5adc('0xe'));function respondWithRpcPromise(_0x566926,_0xc1d601,_0x2bebb1,_0x4f2bf3){return new Promise(function(_0x5904a9,_0x2269a4){var _0x5665d0=_0x4f2bf3||client;return _0x5665d0[_0x5adc('0xf')](_0x566926,_0x2bebb1)[_0x5adc('0x10')](function(_0x37d8eb){logger[_0x5adc('0x11')](_0x5adc('0x12'),_0xc1d601,'request\x20sent');logger[_0x5adc('0x13')](_0x5adc('0x14'),_0xc1d601,_0x5adc('0x15'),JSON[_0x5adc('0x16')](_0x37d8eb));if(_0x37d8eb[_0x5adc('0x17')]){if(_0x37d8eb[_0x5adc('0x17')][_0x5adc('0x18')]===0x1f4){logger[_0x5adc('0x17')](_0x5adc('0x12'),_0xc1d601,_0x37d8eb[_0x5adc('0x17')]['message']);return _0x2269a4(_0x37d8eb[_0x5adc('0x17')][_0x5adc('0x19')]);}logger[_0x5adc('0x17')](_0x5adc('0x12'),_0xc1d601,_0x37d8eb[_0x5adc('0x17')]['message']);return _0x5904a9(_0x37d8eb['error'][_0x5adc('0x19')]);}else{logger[_0x5adc('0x11')](_0x5adc('0x12'),_0xc1d601,_0x5adc('0x15'));_0x5904a9(_0x37d8eb['result'][_0x5adc('0x19')]);}})[_0x5adc('0x1a')](function(_0x5654e8){logger[_0x5adc('0x17')](_0x5adc('0x12'),_0xc1d601,_0x5654e8);_0x2269a4(_0x5654e8);});});}function respondWithResult(_0x1b01d5,_0x2abc1a){_0x2abc1a=_0x2abc1a||0xc8;return function(_0x23a39b){if(_0x23a39b){return _0x1b01d5[_0x5adc('0x1b')](_0x2abc1a)['json'](_0x23a39b);}};}function respondWithFilteredResult(_0x2bc4b2,_0x45602e){return function(_0x4fa50d){if(_0x4fa50d){var _0x4339e6=typeof _0x45602e['offset']===_0x5adc('0x1c')&&typeof _0x45602e['limit']===_0x5adc('0x1c');var _0x2c12c1=_0x4fa50d[_0x5adc('0x1d')];var _0x4a822c=_0x4339e6?0x0:_0x45602e[_0x5adc('0x1e')];var _0x48f5a8=_0x4339e6?_0x4fa50d['count']:_0x45602e[_0x5adc('0x1e')]+_0x45602e['limit'];var _0x583d4b;if(_0x48f5a8>=_0x2c12c1){_0x48f5a8=_0x2c12c1;_0x583d4b=0xc8;}else{_0x583d4b=0xce;}_0x2bc4b2[_0x5adc('0x1b')](_0x583d4b);return _0x2bc4b2[_0x5adc('0x1f')](_0x5adc('0x20'),_0x4a822c+'-'+_0x48f5a8+'/'+_0x2c12c1)[_0x5adc('0x21')](_0x4fa50d);}return null;};}function saveUpdates(_0x56fa6d){return function(_0x591125){if(_0x591125){return _0x591125[_0x5adc('0x22')](_0x56fa6d)[_0x5adc('0x10')](function(_0x536a34){return _0x536a34;});}return null;};}function removeEntity(_0x13fa3c){return function(_0x13224e){if(_0x13224e){return _0x13224e[_0x5adc('0x23')]()[_0x5adc('0x10')](function(){_0x13fa3c[_0x5adc('0x1b')](0xcc)[_0x5adc('0x24')]();});}};}function handleEntityNotFound(_0x27fa08){return function(_0x31c206){if(!_0x31c206){_0x27fa08[_0x5adc('0x25')](0x194);}return _0x31c206;};}function handleError(_0x553f62,_0x3d2d05){_0x3d2d05=_0x3d2d05||0x1f4;return function(_0x5f054a){logger[_0x5adc('0x17')](_0x5f054a[_0x5adc('0x26')]);if(_0x5f054a[_0x5adc('0x27')]){delete _0x5f054a[_0x5adc('0x27')];}_0x553f62['status'](_0x3d2d05)[_0x5adc('0x28')](_0x5f054a);};}exports[_0x5adc('0x29')]=function(_0x4f4a1a,_0x4bc9a9){var _0x102f49={},_0x33e83c={},_0x534527={'count':0x0,'rows':[]};var _0x8c7c6c=_[_0x5adc('0x2a')](db[_0x5adc('0x2b')][_0x5adc('0x2c')],function(_0x2fb80d){return{'name':_0x2fb80d[_0x5adc('0x2d')],'type':_0x2fb80d[_0x5adc('0x2e')][_0x5adc('0x2f')]};});_0x33e83c[_0x5adc('0x30')]=_[_0x5adc('0x2a')](_0x8c7c6c,'name');_0x33e83c[_0x5adc('0x31')]=_[_0x5adc('0x32')](_0x4f4a1a['query']);_0x33e83c[_0x5adc('0x33')]=_[_0x5adc('0x34')](_0x33e83c['model'],_0x33e83c[_0x5adc('0x31')]);_0x102f49[_0x5adc('0x35')]=_[_0x5adc('0x34')](_0x33e83c[_0x5adc('0x30')],qs[_0x5adc('0x36')](_0x4f4a1a['query'][_0x5adc('0x36')]));_0x102f49[_0x5adc('0x35')]=_0x102f49[_0x5adc('0x35')][_0x5adc('0x37')]?_0x102f49[_0x5adc('0x35')]:_0x33e83c[_0x5adc('0x30')];if(!_0x4f4a1a[_0x5adc('0x31')][_0x5adc('0x38')](_0x5adc('0x39'))){_0x102f49[_0x5adc('0x3a')]=qs[_0x5adc('0x3a')](_0x4f4a1a[_0x5adc('0x31')][_0x5adc('0x3a')]);_0x102f49[_0x5adc('0x1e')]=qs[_0x5adc('0x1e')](_0x4f4a1a[_0x5adc('0x31')]['offset']);}_0x102f49['order']=qs[_0x5adc('0x3b')](_0x4f4a1a[_0x5adc('0x31')][_0x5adc('0x3b')]);_0x102f49[_0x5adc('0x3c')]=qs[_0x5adc('0x33')](_['pick'](_0x4f4a1a[_0x5adc('0x31')],_0x33e83c[_0x5adc('0x33')]),_0x8c7c6c);if(_0x4f4a1a['query'][_0x5adc('0x3d')]){_0x102f49[_0x5adc('0x3c')]=_[_0x5adc('0x3e')](_0x102f49[_0x5adc('0x3c')],{'$or':_['map'](_0x8c7c6c,function(_0x4f8e53){if(_0x4f8e53[_0x5adc('0x2e')]!==_0x5adc('0x3f')){var _0x2365ad={};_0x2365ad[_0x4f8e53[_0x5adc('0x27')]]={'$like':'%'+_0x4f4a1a['query'][_0x5adc('0x3d')]+'%'};return _0x2365ad;}})});}_0x102f49=_[_0x5adc('0x3e')]({},_0x102f49,_0x4f4a1a[_0x5adc('0x40')]);var _0x5375fc={'where':_0x102f49['where']};return db[_0x5adc('0x2b')][_0x5adc('0x1d')](_0x5375fc)['then'](function(_0x4efd99){_0x534527[_0x5adc('0x1d')]=_0x4efd99;if(_0x4f4a1a[_0x5adc('0x31')]['includeAll']){_0x102f49['include']=[{'all':!![]}];}return db[_0x5adc('0x2b')][_0x5adc('0x41')](_0x102f49);})[_0x5adc('0x10')](function(_0x534af2){_0x534527[_0x5adc('0x42')]=_0x534af2;return _0x534527;})['then'](respondWithFilteredResult(_0x4bc9a9,_0x102f49))['catch'](handleError(_0x4bc9a9,null));};exports[_0x5adc('0x43')]=function(_0x116240,_0x428be1){var _0x4eb0a0={'raw':!![],'where':{'id':_0x116240['params']['id']}},_0x4cb0bb={};_0x4cb0bb[_0x5adc('0x30')]=_['keys'](db[_0x5adc('0x2b')][_0x5adc('0x2c')]);_0x4cb0bb[_0x5adc('0x31')]=_[_0x5adc('0x32')](_0x116240[_0x5adc('0x31')]);_0x4cb0bb[_0x5adc('0x33')]=_[_0x5adc('0x34')](_0x4cb0bb[_0x5adc('0x30')],_0x4cb0bb[_0x5adc('0x31')]);_0x4eb0a0[_0x5adc('0x35')]=_[_0x5adc('0x34')](_0x4cb0bb['model'],qs[_0x5adc('0x36')](_0x116240[_0x5adc('0x31')][_0x5adc('0x36')]));_0x4eb0a0[_0x5adc('0x35')]=_0x4eb0a0['attributes'][_0x5adc('0x37')]?_0x4eb0a0[_0x5adc('0x35')]:_0x4cb0bb['model'];if(_0x116240[_0x5adc('0x31')]['includeAll']){_0x4eb0a0[_0x5adc('0x44')]=[{'all':!![]}];}_0x4eb0a0=_['merge']({},_0x4eb0a0,_0x116240[_0x5adc('0x40')]);return db['FaxMessage'][_0x5adc('0x45')](_0x4eb0a0)[_0x5adc('0x10')](handleEntityNotFound(_0x428be1,null))['then'](respondWithResult(_0x428be1,null))[_0x5adc('0x1a')](handleError(_0x428be1,null));};exports['update']=function(_0x1240c1,_0x453640){if(_0x1240c1[_0x5adc('0x46')]['id']){delete _0x1240c1['body']['id'];}return db[_0x5adc('0x2b')][_0x5adc('0x45')]({'where':{'id':_0x1240c1['params']['id']}})[_0x5adc('0x10')](handleEntityNotFound(_0x453640,null))[_0x5adc('0x10')](saveUpdates(_0x1240c1[_0x5adc('0x46')],null))[_0x5adc('0x10')](respondWithResult(_0x453640,null))[_0x5adc('0x1a')](handleError(_0x453640,null));};exports[_0x5adc('0x23')]=function(_0x2f68bf,_0x3e1e53){return db['FaxMessage'][_0x5adc('0x45')]({'where':{'id':_0x2f68bf[_0x5adc('0x47')]['id']}})['then'](handleEntityNotFound(_0x3e1e53,null))['then'](removeEntity(_0x3e1e53,null))[_0x5adc('0x1a')](handleError(_0x3e1e53,null));};exports[_0x5adc('0x48')]=function(_0x411fba,_0x341d7a){return db[_0x5adc('0x2b')][_0x5adc('0x48')]()['then'](respondWithResult(_0x341d7a,null))['catch'](handleError(_0x341d7a,null));};exports[_0x5adc('0x49')]=function(_0xa4d480,_0x39e859){var _0x2e178f=_0x5adc('0x4a');return interactionService['acceptMessage'](_0xa4d480,_0x2e178f)[_0x5adc('0x10')](respondWithResult(_0x39e859,null))[_0x5adc('0x1a')](handleError(_0x39e859,null));};exports[_0x5adc('0x49')]=function(_0x4c3998,_0x223eff){var _0x5b1903=_0x5adc('0x4b');return interactionService[_0x5adc('0x4c')](_0x4c3998,_0x5b1903)[_0x5adc('0x10')](respondWithResult(_0x223eff,null))[_0x5adc('0x1a')](handleError(_0x223eff,null));};exports[_0x5adc('0x4d')]=function(_0x279891,_0x512ec0){var _0x27311e={'agent':{},'channel':_0x5adc('0x4b')};if(_0x279891['body']['id']){delete _0x279891['body']['id'];}_0x279891[_0x5adc('0x46')]['UserId']=_0x279891[_0x5adc('0x46')][_0x5adc('0x4e')]||_0x279891['user']['id'];_0x27311e[_0x5adc('0x4f')]['id']=_0x279891[_0x5adc('0x46')][_0x5adc('0x4e')];return db[_0x5adc('0x2b')]['find']({'where':{'id':_0x279891[_0x5adc('0x47')]['id'],'UserId':null}})[_0x5adc('0x10')](handleEntityNotFound(_0x512ec0,null))['then'](function(_0x58192a){if(_0x58192a){_0x27311e[_0x5adc('0x19')]=_0x58192a[_0x5adc('0x50')]({'plain':!![]});return db[_0x5adc('0x51')][_0x5adc('0x45')]({'where':{'id':_0x58192a[_0x5adc('0x52')]}});}return null;})['then'](handleEntityNotFound(_0x512ec0,null))[_0x5adc('0x10')](function(_0x430261){if(_0x430261){_0x27311e[_0x5adc('0x53')]=_0x430261[_0x5adc('0x50')]({'plain':!![]});interaction_log['info'](_0x5adc('0x54'),_0x279891[_0x5adc('0x55')]['id'],_0x279891[_0x5adc('0x55')][_0x5adc('0x27')],_0x279891[_0x5adc('0x55')][_0x5adc('0x56')],_0x27311e[_0x5adc('0x53')]['id'],_0x279891['body']?JSON[_0x5adc('0x16')](_0x279891['body']):_0x5adc('0x57'));return respondWithRpcPromise('RejectMessage',_0x5adc('0x58'),_0x27311e);}return null;})['then'](function(_0x1403f8){var _0x5685fe='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1403f8[_0x5adc('0x19')][_0x5adc('0x59')];return db[_0x5adc('0x5a')][_0x5adc('0x31')](_0x5685fe,{'type':db[_0x5adc('0x5b')][_0x5adc('0x5c')][_0x5adc('0x5d')],'raw':!![]})[_0x5adc('0x10')](function(_0x5dc558){return _0x5dc558;});})[_0x5adc('0x10')](function(_0x21efdf){if(_0x21efdf){_0x27311e[_0x5adc('0x19')]['contact']=_0x21efdf[0x0];if(!_0x279891[_0x5adc('0x46')]['UserId'])return;return db[_0x5adc('0x5e')][_0x5adc('0x45')]({'where':{'id':_0x279891[_0x5adc('0x46')][_0x5adc('0x4e')],'role':'agent'},'attributes':['id',_0x5adc('0x27'),'fullname',_0x5adc('0x5f'),'internal'],'raw':!![]});}return null;})[_0x5adc('0x10')](function(_0x41a5e7){if(!_0x41a5e7)return null;_0x27311e[_0x5adc('0x19')][_0x5adc('0x4f')]=_0x41a5e7;return _0x27311e;})[_0x5adc('0x10')](function(_0x3c1599){if(_0x3c1599){_0x3c1599['message']['interface']=util['format'](_0x5adc('0x60'),_0x279891[_0x5adc('0x55')]['name']);_0x3c1599[_0x5adc('0x19')][_0x5adc('0x61')]=_0x27311e[_0x5adc('0x61')];_0x3c1599[_0x5adc('0x19')][_0x5adc('0x62')]=_0x27311e[_0x5adc('0x61')];_0x3c1599[_0x5adc('0x19')][_0x5adc('0x63')]=_0x5adc('0x4d');respondWithRpcPromise(_0x5adc('0x64'),'EventManager',{'event':_0x5adc('0x65'),'message':_0x3c1599[_0x5adc('0x19')]},client9002);return _0x27311e;}return null;})['then'](respondWithResult(_0x512ec0,null))['catch'](handleError(_0x512ec0,null));};exports['create']=function(_0x1edb5d,_0x305a21){var _0x2e6cdb;return db[_0x5adc('0x2b')][_0x5adc('0x66')](_0x1edb5d[_0x5adc('0x46')],{})[_0x5adc('0x10')](function(_0x3c1ca6){_0x2e6cdb=_0x3c1ca6;return db[_0x5adc('0x67')][_0x5adc('0x68')]({'where':{'id':_0x2e6cdb[_0x5adc('0x59')]}});})[_0x5adc('0x10')](function(_0x41442b){if(_['isNil'](_0x41442b)){return;}else{_0x2e6cdb['fax']=_0x41442b[_0x5adc('0x4b')];return db[_0x5adc('0x69')]['findOne']({'where':{'id':_0x2e6cdb[_0x5adc('0x6a')]}});}})[_0x5adc('0x10')](function(_0x44303c){return respondWithRpcPromise(_0x5adc('0x6b'),'SendFax',{'FaxAccountId':_['isNil'](_0x1edb5d[_0x5adc('0x46')])?undefined:_0x1edb5d[_0x5adc('0x46')][_0x5adc('0x6c')],'path':_['isNil'](_0x44303c)?undefined:util['format'](_0x5adc('0x6d'),_0x44303c[_0x5adc('0x6e')]),'fax':_['isNil'](_0x2e6cdb[_0x5adc('0x4b')])?undefined:_0x2e6cdb[_0x5adc('0x4b')],'AttachmentId':_0x2e6cdb['AttachmentId']},client9002);})[_0x5adc('0x10')](respondWithResult(_0x305a21,0xc9))[_0x5adc('0x1a')](handleError(_0x305a21,null));};exports[_0x5adc('0x6f')]=function(_0x22542b,_0x1206b6){var _0x2c7f34=path[_0x5adc('0x70')](config[_0x5adc('0x71')],'server',_0x5adc('0x72'),_0x5adc('0x73'));return db[_0x5adc('0x2b')]['find']({'where':{'id':_0x22542b[_0x5adc('0x47')]['id']},'include':[{'model':db[_0x5adc('0x69')],'as':_0x5adc('0x69')}]})[_0x5adc('0x10')](handleEntityNotFound(_0x1206b6,null))[_0x5adc('0x10')](function(_0x384387){if(_0x384387){return _0x1206b6[_0x5adc('0x6f')](path[_0x5adc('0x70')](_0x2c7f34,_0x384387[_0x5adc('0x69')][_0x5adc('0x6e')]));}})[_0x5adc('0x1a')](handleError(_0x1206b6,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index a7a5707..e7a5903 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 _0xf966=['FaxMessage','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xfa730c,_0x5511f0){var _0x3d6b93=function(_0x608382){while(--_0x608382){_0xfa730c['push'](_0xfa730c['shift']());}};_0x3d6b93(++_0x5511f0);}(_0xf966,0x184));var _0x6f96=function(_0xc825ed,_0x3f22e1){_0xc825ed=_0xc825ed-0x0;var _0x380ef3=_0xf966[_0xc825ed];return _0x380ef3;};'use strict';var EventEmitter=require(_0x6f96('0x0'));var FaxMessage=require(_0x6f96('0x1'))['db'][_0x6f96('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6f96('0x3'),'afterUpdate':_0x6f96('0x4'),'afterDestroy':_0x6f96('0x5')};function emitEvent(_0x5500f4){return function(_0x1820d1,_0x33a4e6,_0x23019c){FaxMessageEvents['emit'](_0x5500f4+':'+_0x1820d1['id'],_0x1820d1);FaxMessageEvents[_0x6f96('0x6')](_0x5500f4,_0x1820d1);_0x23019c(null);};}for(var e in events){if(events[_0x6f96('0x7')](e)){var event=events[e];FaxMessage[_0x6f96('0x8')](e,emitEvent(event));}}module[_0x6f96('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x014c=['exports','../../mysqldb','setMaxListeners','save','update','emit','hook'];(function(_0x30ac2d,_0x1d7218){var _0xaa001=function(_0x301f35){while(--_0x301f35){_0x30ac2d['push'](_0x30ac2d['shift']());}};_0xaa001(++_0x1d7218);}(_0x014c,0x17b));var _0xc014=function(_0x28fbe3,_0x4ac6f8){_0x28fbe3=_0x28fbe3-0x0;var _0x45db6a=_0x014c[_0x28fbe3];return _0x45db6a;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xc014('0x0'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc014('0x1')](0x0);var events={'afterCreate':_0xc014('0x2'),'afterUpdate':_0xc014('0x3'),'afterDestroy':'remove'};function emitEvent(_0x583f00){return function(_0x2d449e,_0x3cc3a9,_0x3f1f0c){FaxMessageEvents[_0xc014('0x4')](_0x583f00+':'+_0x2d449e['id'],_0x2d449e);FaxMessageEvents[_0xc014('0x4')](_0x583f00,_0x2d449e);_0x3f1f0c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xc014('0x5')](e,emitEvent(event));}}module[_0xc014('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index b253e9e..c074827 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 _0x7d3c=['moment','../../config/environment','define','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','FaxInteraction','FaxInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x7d3c,0x1ac));var _0xc7d3=function(_0x136f00,_0x2c03ba){_0x136f00=_0x136f00-0x0;var _0x3f4d4c=_0x7d3c[_0x136f00];return _0x3f4d4c;};'use strict';var _=require(_0xc7d3('0x0'));var util=require(_0xc7d3('0x1'));var logger=require(_0xc7d3('0x2'))(_0xc7d3('0x3'));var moment=require(_0xc7d3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc7d3('0x5'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x4d95f1,_0x168a60){return _0x4d95f1[_0xc7d3('0x6')]('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xc7d3('0x7'),'fields':[_0xc7d3('0x8')],'type':_0xc7d3('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x26e50f,_0xda1705,_0x4d7f05){var _0x4a204a=_0x4d95f1[_0xc7d3('0xa')];var _0x402312=_0x26e50f[_0xc7d3('0xb')]({'plain':!![]});if(_0x402312[_0xc7d3('0xc')][_0xc7d3('0xd')]()==='in'||_0x402312[_0xc7d3('0xc')][_0xc7d3('0xd')]()==='out'&&!_0x402312[_0xc7d3('0xe')]&&!_['isNil'](_0x402312[_0xc7d3('0xf')])){_0x4a204a[_0xc7d3('0x10')]['findOne']({'where':{'id':_0x402312[_0xc7d3('0x11')]}})[_0xc7d3('0x12')](function(_0x2de142){if(_0x2de142){_0x2de142['update']({'lastMsgAt':_0x402312[_0xc7d3('0x13')],'lastMsgDirection':_0x402312[_0xc7d3('0xc')][_0xc7d3('0xd')]()});}})[_0xc7d3('0x14')](function(_0x5eddad){console[_0xc7d3('0x15')](_0x5eddad);});}_0x4d7f05();}},'charset':_0xc7d3('0x16'),'collate':_0xc7d3('0x17')});}; \ No newline at end of file +var _0x19f9=['isNil','findOne','FaxInteractionId','then','update','createdAt','catch','utf8mb4_unicode_ci','util','api','moment','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','FULLTEXT','models','direction','toLowerCase','out','secret'];(function(_0x2cd263,_0x452796){var _0x41d7ce=function(_0x24387a){while(--_0x24387a){_0x2cd263['push'](_0x2cd263['shift']());}};_0x41d7ce(++_0x452796);}(_0x19f9,0xc8));var _0x919f=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x19f9[_0x5f0089];return _0x193892;};'use strict';var _=require('lodash');var util=require(_0x919f('0x0'));var logger=require('../../config/logger')(_0x919f('0x1'));var moment=require(_0x919f('0x2'));var BPromise=require('bluebird');var rp=require(_0x919f('0x3'));var fs=require('fs');var path=require(_0x919f('0x4'));var rimraf=require(_0x919f('0x5'));var config=require('../../config/environment');var attributes=require(_0x919f('0x6'));module[_0x919f('0x7')]=function(_0x31f983,_0x5ce0f4){return _0x31f983[_0x919f('0x8')](_0x919f('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0x919f('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b355d,_0x426804,_0x3fcc57){var _0x118a56=_0x31f983[_0x919f('0xb')];var _0x3dec6f=_0x4b355d['get']({'plain':!![]});if(_0x3dec6f[_0x919f('0xc')][_0x919f('0xd')]()==='in'||_0x3dec6f[_0x919f('0xc')]['toLowerCase']()===_0x919f('0xe')&&!_0x3dec6f[_0x919f('0xf')]&&!_[_0x919f('0x10')](_0x3dec6f['UserId'])){_0x118a56['FaxInteraction'][_0x919f('0x11')]({'where':{'id':_0x3dec6f[_0x919f('0x12')]}})[_0x919f('0x13')](function(_0x1fc68d){if(_0x1fc68d){_0x1fc68d[_0x919f('0x14')]({'lastMsgAt':_0x3dec6f[_0x919f('0x15')],'lastMsgDirection':_0x3dec6f[_0x919f('0xc')][_0x919f('0xd')]()});}})[_0x919f('0x16')](function(_0xa86cad){console['error'](_0xa86cad);});}_0x3fcc57();}},'charset':'utf8mb4','collate':_0x919f('0x17')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index e5b8e62..d98c507 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 _0xa8a8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa8a8,0xec));var _0x8a8a=function(_0x34babf,_0x414a6){_0x34babf=_0x34babf-0x0;var _0x389f24=_0xa8a8[_0x34babf];return _0x389f24;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});config[_0x8a8a('0xd')]=_[_0x8a8a('0xe')](config[_0x8a8a('0xd')],{'host':_0x8a8a('0xf'),'port':0x18eb});var socket=require(_0x8a8a('0x10'))(new Redis(config[_0x8a8a('0xd')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x3c01cd,_0x497b8a,_0x11788d){return new BPromise(function(_0x3d3a00,_0x532621){return client[_0x8a8a('0x11')](_0x3c01cd,_0x11788d)[_0x8a8a('0x12')](function(_0xb13fca){logger['info'](_0x8a8a('0x13'),_0x497b8a,_0x8a8a('0x14'));logger[_0x8a8a('0x15')](_0x8a8a('0x16'),_0x497b8a,'request\x20sent',JSON[_0x8a8a('0x17')](_0xb13fca));if(_0xb13fca['error']){if(_0xb13fca[_0x8a8a('0x18')][_0x8a8a('0x19')]===0x1f4){logger[_0x8a8a('0x18')](_0x8a8a('0x13'),_0x497b8a,_0xb13fca[_0x8a8a('0x18')][_0x8a8a('0x1a')]);return _0x532621(_0xb13fca[_0x8a8a('0x18')]['message']);}logger[_0x8a8a('0x18')]('FaxMessage,\x20%s,\x20%s',_0x497b8a,_0xb13fca[_0x8a8a('0x18')][_0x8a8a('0x1a')]);return _0x3d3a00(_0xb13fca[_0x8a8a('0x18')][_0x8a8a('0x1a')]);}else{logger[_0x8a8a('0x1b')]('FaxMessage,\x20%s,\x20%s',_0x497b8a,_0x8a8a('0x14'));_0x3d3a00(_0xb13fca[_0x8a8a('0x1c')][_0x8a8a('0x1a')]);}})[_0x8a8a('0x1d')](function(_0x299827){logger[_0x8a8a('0x18')]('FaxMessage,\x20%s,\x20%s',_0x497b8a,_0x299827);_0x532621(_0x299827);});});}exports['CreateFaxMessage']=function(_0x5181b2){var _0x4e3d0a=this;return new Promise(function(_0x4a6601,_0x3a9b2f){return db[_0x8a8a('0x1e')][_0x8a8a('0x1f')](_0x5181b2[_0x8a8a('0x20')],{'raw':_0x5181b2[_0x8a8a('0x21')]?_0x5181b2[_0x8a8a('0x21')][_0x8a8a('0x22')]===undefined?!![]:![]:!![]})[_0x8a8a('0x12')](function(_0x25d5d4){logger[_0x8a8a('0x1b')](_0x8a8a('0x23'),_0x5181b2);logger[_0x8a8a('0x15')](_0x8a8a('0x23'),_0x5181b2,JSON[_0x8a8a('0x17')](_0x25d5d4));_0x4a6601(_0x25d5d4);})[_0x8a8a('0x1d')](function(_0x545a38){logger[_0x8a8a('0x18')](_0x8a8a('0x23'),_0x545a38[_0x8a8a('0x1a')],_0x5181b2);_0x3a9b2f(_0x4e3d0a[_0x8a8a('0x18')](0x1f4,_0x545a38[_0x8a8a('0x1a')]));});});};exports[_0x8a8a('0x24')]=function(_0x3aa46d){var _0x5f4dcc=this;return new Promise(function(_0x31d21a,_0x38c1e0){return db[_0x8a8a('0x1e')]['update'](_0x3aa46d['body'],{'raw':_0x3aa46d[_0x8a8a('0x21')]?_0x3aa46d[_0x8a8a('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aa46d['options']?_0x3aa46d['options'][_0x8a8a('0x25')]||null:null,'attributes':_0x3aa46d['options']?_0x3aa46d[_0x8a8a('0x21')][_0x8a8a('0x26')]||null:null,'limit':_0x3aa46d['options']?_0x3aa46d[_0x8a8a('0x21')][_0x8a8a('0x27')]||null:null})[_0x8a8a('0x12')](function(_0x8df0cb){logger[_0x8a8a('0x1b')](_0x8a8a('0x24'),_0x3aa46d);logger[_0x8a8a('0x15')](_0x8a8a('0x24'),_0x3aa46d,JSON['stringify'](_0x8df0cb));_0x31d21a(_0x8df0cb);})['catch'](function(_0x56e79e){logger[_0x8a8a('0x18')](_0x8a8a('0x24'),_0x56e79e['message'],_0x3aa46d);_0x38c1e0(_0x5f4dcc[_0x8a8a('0x18')](0x1f4,_0x56e79e[_0x8a8a('0x1a')]));});});}; \ No newline at end of file +var _0xd6d6=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','raw','info','CreateFaxMessage','update','where','limit','UpdateFaxMessage'];(function(_0x13c5e3,_0x134847){var _0x21b171=function(_0x46ec6){while(--_0x46ec6){_0x13c5e3['push'](_0x13c5e3['shift']());}};_0x21b171(++_0x134847);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x585ecf,_0x16b12b){_0x585ecf=_0x585ecf-0x0;var _0x1ad52c=_0xd6d6[_0x585ecf];return _0x1ad52c;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var BPromise=require(_0x6d6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6d('0x4'));var db=require(_0x6d6d('0x5'))['db'];var utils=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var config=require(_0x6d6d('0x9'));var jayson=require(_0x6d6d('0xa'));var client=jayson['client'][_0x6d6d('0xb')]({'port':0x232a});config[_0x6d6d('0xc')]=_[_0x6d6d('0xd')](config[_0x6d6d('0xc')],{'host':_0x6d6d('0xe'),'port':0x18eb});var socket=require(_0x6d6d('0xf'))(new Redis(config[_0x6d6d('0xc')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x404c88,_0x1fa46d,_0x23b18a){return new BPromise(function(_0x290dfb,_0xf84314){return client['request'](_0x404c88,_0x23b18a)[_0x6d6d('0x10')](function(_0x158f82){logger['info']('FaxMessage,\x20%s,\x20%s',_0x1fa46d,_0x6d6d('0x11'));logger[_0x6d6d('0x12')](_0x6d6d('0x13'),_0x1fa46d,_0x6d6d('0x11'),JSON[_0x6d6d('0x14')](_0x158f82));if(_0x158f82[_0x6d6d('0x15')]){if(_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x16')]===0x1f4){logger['error'](_0x6d6d('0x17'),_0x1fa46d,_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x18')]);return _0xf84314(_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x18')]);}logger['error'](_0x6d6d('0x17'),_0x1fa46d,_0x158f82['error'][_0x6d6d('0x18')]);return _0x290dfb(_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x18')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x1fa46d,_0x6d6d('0x11'));_0x290dfb(_0x158f82[_0x6d6d('0x19')][_0x6d6d('0x18')]);}})[_0x6d6d('0x1a')](function(_0x51fff6){logger['error'](_0x6d6d('0x17'),_0x1fa46d,_0x51fff6);_0xf84314(_0x51fff6);});});}exports['CreateFaxMessage']=function(_0x26f631){var _0xb8590d=this;return new Promise(function(_0x30d87d,_0x450352){return db[_0x6d6d('0x1b')][_0x6d6d('0x1c')](_0x26f631[_0x6d6d('0x1d')],{'raw':_0x26f631[_0x6d6d('0x1e')]?_0x26f631[_0x6d6d('0x1e')][_0x6d6d('0x1f')]===undefined?!![]:![]:!![]})[_0x6d6d('0x10')](function(_0x6e58e3){logger[_0x6d6d('0x20')](_0x6d6d('0x21'),_0x26f631);logger[_0x6d6d('0x12')](_0x6d6d('0x21'),_0x26f631,JSON[_0x6d6d('0x14')](_0x6e58e3));_0x30d87d(_0x6e58e3);})['catch'](function(_0x3b73e5){logger[_0x6d6d('0x15')](_0x6d6d('0x21'),_0x3b73e5[_0x6d6d('0x18')],_0x26f631);_0x450352(_0xb8590d[_0x6d6d('0x15')](0x1f4,_0x3b73e5[_0x6d6d('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x2851dd){var _0x2b5e31=this;return new Promise(function(_0x235451,_0x126ac8){return db[_0x6d6d('0x1b')][_0x6d6d('0x22')](_0x2851dd[_0x6d6d('0x1d')],{'raw':_0x2851dd['options']?_0x2851dd[_0x6d6d('0x1e')][_0x6d6d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2851dd['options']?_0x2851dd['options'][_0x6d6d('0x23')]||null:null,'attributes':_0x2851dd[_0x6d6d('0x1e')]?_0x2851dd[_0x6d6d('0x1e')]['attributes']||null:null,'limit':_0x2851dd[_0x6d6d('0x1e')]?_0x2851dd[_0x6d6d('0x1e')][_0x6d6d('0x24')]||null:null})[_0x6d6d('0x10')](function(_0x64d1f7){logger[_0x6d6d('0x20')](_0x6d6d('0x25'),_0x2851dd);logger[_0x6d6d('0x12')](_0x6d6d('0x25'),_0x2851dd,JSON[_0x6d6d('0x14')](_0x64d1f7));_0x235451(_0x64d1f7);})['catch'](function(_0x1f9469){logger['error'](_0x6d6d('0x25'),_0x1f9469[_0x6d6d('0x18')],_0x2851dd);_0x126ac8(_0x2b5e31[_0x6d6d('0x15')](0x1f4,_0x1f9469[_0x6d6d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 5b9c1cf..e97bca1 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 _0x9306=['removeListener','register','length','faxMessage:','save','remove','update','emit'];(function(_0x504a40,_0x2cbb16){var _0xcaf36d=function(_0x221de0){while(--_0x221de0){_0x504a40['push'](_0x504a40['shift']());}};_0xcaf36d(++_0x2cbb16);}(_0x9306,0x64));var _0x6930=function(_0x18da1b,_0x30fe46){_0x18da1b=_0x18da1b-0x0;var _0xe34e86=_0x9306[_0x18da1b];return _0xe34e86;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x6930('0x0'),_0x6930('0x1'),_0x6930('0x2')];function createListener(_0x173800,_0x4195b2){return function(_0x2769df){_0x4195b2[_0x6930('0x3')](_0x173800,_0x2769df);};}function removeListener(_0x2912e0,_0x2786cb){return function(){FaxMessageEvents[_0x6930('0x4')](_0x2912e0,_0x2786cb);};}exports[_0x6930('0x5')]=function(_0x2a3850){for(var _0x29d3b8=0x0,_0x232caa=events[_0x6930('0x6')];_0x29d3b8<_0x232caa;_0x29d3b8++){var _0x26af37=events[_0x29d3b8];var _0x3d59fb=createListener(_0x6930('0x7')+_0x26af37,_0x2a3850);FaxMessageEvents['on'](_0x26af37,_0x3d59fb);}}; \ No newline at end of file +var _0xa880=['register','faxMessage:','./faxMessage.events','save','update','emit','removeListener'];(function(_0x8563f2,_0x469029){var _0x4fa3a=function(_0x4d9816){while(--_0x4d9816){_0x8563f2['push'](_0x8563f2['shift']());}};_0x4fa3a(++_0x469029);}(_0xa880,0x12f));var _0x0a88=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0xa880[_0x352e09];return _0x1b7094;};'use strict';var FaxMessageEvents=require(_0x0a88('0x0'));var events=[_0x0a88('0x1'),'remove',_0x0a88('0x2')];function createListener(_0x2e252d,_0x4738f3){return function(_0x4947a3){_0x4738f3[_0x0a88('0x3')](_0x2e252d,_0x4947a3);};}function removeListener(_0x365a18,_0x510635){return function(){FaxMessageEvents[_0x0a88('0x4')](_0x365a18,_0x510635);};}exports[_0x0a88('0x5')]=function(_0x5035a4){for(var _0x4a5255=0x0,_0x50dc71=events['length'];_0x4a5255<_0x50dc71;_0x4a5255++){var _0x46b802=events[_0x4a5255];var _0x1f79f8=createListener(_0x0a88('0x6')+_0x46b802,_0x5035a4);FaxMessageEvents['on'](_0x46b802,_0x1f79f8);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 0cecc51..680e432 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 _0xeb74=['Router','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','describe','show','/:id/download','download','post','fax','faxmessage:create','create','put','/:id','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x492c74,_0x188d90){var _0x4d4269=function(_0x4402f3){while(--_0x4402f3){_0x492c74['push'](_0x492c74['shift']());}};_0x4d4269(++_0x188d90);}(_0xeb74,0xe3));var _0x4eb7=function(_0x126bc3,_0x1df4c2){_0x126bc3=_0x126bc3-0x0;var _0x529c7d=_0xeb74[_0x126bc3];return _0x529c7d;};'use strict';var multer=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var path=require(_0x4eb7('0x2'));var timeout=require(_0x4eb7('0x3'));var express=require(_0x4eb7('0x4'));var router=express[_0x4eb7('0x5')]();var fs_extra=require(_0x4eb7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4eb7('0x7'));var config=require(_0x4eb7('0x8'));var controller=require(_0x4eb7('0x9'));router[_0x4eb7('0xa')]('/',auth[_0x4eb7('0xb')](),controller['index']);router[_0x4eb7('0xa')]('/describe',auth[_0x4eb7('0xb')](),controller[_0x4eb7('0xc')]);router['get']('/:id',auth[_0x4eb7('0xb')](),controller[_0x4eb7('0xd')]);router['get'](_0x4eb7('0xe'),auth['isAuthenticated'](),controller[_0x4eb7('0xf')]);router[_0x4eb7('0x10')]('/',auth[_0x4eb7('0xb')](),interaction['tracked'](_0x4eb7('0x11'),_0x4eb7('0x12')),controller[_0x4eb7('0x13')]);router[_0x4eb7('0x14')](_0x4eb7('0x15'),auth[_0x4eb7('0xb')](),controller[_0x4eb7('0x16')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x4eb7('0x17')]);router['put'](_0x4eb7('0x18'),auth[_0x4eb7('0xb')](),controller[_0x4eb7('0x19')]);router[_0x4eb7('0x1a')](_0x4eb7('0x15'),auth[_0x4eb7('0xb')](),controller[_0x4eb7('0x1b')]);module[_0x4eb7('0x1c')]=router; \ No newline at end of file +var _0xe205=['../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','tracked','fax','faxmessage:create','create','put','update','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2536ee,_0x38153b){var _0x318b70=function(_0x2be0f4){while(--_0x2be0f4){_0x2536ee['push'](_0x2536ee['shift']());}};_0x318b70(++_0x38153b);}(_0xe205,0xa7));var _0x5e20=function(_0x4fd2f1,_0x5b8838){_0x4fd2f1=_0x4fd2f1-0x0;var _0x43ac9a=_0xe205[_0x4fd2f1];return _0x43ac9a;};'use strict';var multer=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var path=require(_0x5e20('0x2'));var timeout=require(_0x5e20('0x3'));var express=require(_0x5e20('0x4'));var router=express[_0x5e20('0x5')]();var fs_extra=require(_0x5e20('0x6'));var auth=require(_0x5e20('0x7'));var interaction=require(_0x5e20('0x8'));var config=require('../../config/environment');var controller=require(_0x5e20('0x9'));router[_0x5e20('0xa')]('/',auth[_0x5e20('0xb')](),controller[_0x5e20('0xc')]);router['get']('/describe',auth[_0x5e20('0xb')](),controller['describe']);router['get'](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller['show']);router[_0x5e20('0xa')](_0x5e20('0xe'),auth[_0x5e20('0xb')](),controller[_0x5e20('0xf')]);router['post']('/',auth[_0x5e20('0xb')](),interaction[_0x5e20('0x10')](_0x5e20('0x11'),_0x5e20('0x12')),controller[_0x5e20('0x13')]);router[_0x5e20('0x14')]('/:id',auth[_0x5e20('0xb')](),controller[_0x5e20('0x15')]);router[_0x5e20('0x14')]('/:id/accept',auth[_0x5e20('0xb')](),controller['accept']);router[_0x5e20('0x14')]('/:id/reject',auth[_0x5e20('0xb')](),controller[_0x5e20('0x16')]);router[_0x5e20('0x17')](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller['destroy']);module[_0x5e20('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 4c5b362..c699481 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 _0x302e=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x302e,0x1eb));var _0xe302=function(_0x31c9ce,_0x5b8eb0){_0x31c9ce=_0x31c9ce-0x0;var _0x5470eb=_0x302e[_0x31c9ce];return _0x5470eb;};'use strict';var Sequelize=require(_0xe302('0x0'));module[_0xe302('0x1')]={'name':{'type':Sequelize[_0xe302('0x2')],'unique':_0xe302('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xe302('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe302('0x5')](_0xe302('0x6'),'beepall',_0xe302('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xe302('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe432=['beepall','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xe432,0x91));var _0x2e43=function(_0x56aabf,_0x461d46){_0x56aabf=_0x56aabf-0x0;var _0x8b2a1e=_0xe432[_0x56aabf];return _0x8b2a1e;};'use strict';var Sequelize=require(_0x2e43('0x0'));module[_0x2e43('0x1')]={'name':{'type':Sequelize[_0x2e43('0x2')],'unique':_0x2e43('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2e43('0x2')]},'timeout':{'type':Sequelize[_0x2e43('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2e43('0x5')](_0x2e43('0x6'),_0x2e43('0x7'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index edc16e0..cd35eae 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 _0x7da6=['FaxQueueId','UserFaxQueue','User','findAndCountAll','agent','updatedAt','createdAt','format','%s/%s','SIP','faxPause','getTeams','Team','filter','ids','Agents','online','voicePause','interface','transaction','addTeams','each','findOrCreate','emit','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','TeamId','includes','union','compact','value','removeTeams','removeAgents','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','update','then','get','UserProfileResource','error','stack','name','send','index','map','FaxQueue','rawAttributes','type','key','where','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','find','create','body','user','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','hasOwnProperty','nolimit','limit','sort','pick'];(function(_0x35f52b,_0x3ead9b){var _0x3ec184=function(_0x47173e){while(--_0x47173e){_0x35f52b['push'](_0x35f52b['shift']());}};_0x3ec184(++_0x3ead9b);}(_0x7da6,0x124));var _0x67da=function(_0x259e77,_0x52f430){_0x259e77=_0x259e77-0x0;var _0x1f93bd=_0x7da6[_0x259e77];return _0x1f93bd;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x67da('0x0'));var squel=require(_0x67da('0x1'));var Redis=require(_0x67da('0x2'));var qs=require(_0x67da('0x3'));var logger=require('../../config/logger')(_0x67da('0x4'));var config=require(_0x67da('0x5'));var db=require(_0x67da('0x6'))['db'];config[_0x67da('0x7')]=_[_0x67da('0x8')](config[_0x67da('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x67da('0x9'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x67da('0xa')](socket);function respondWithStatusCode(_0x5ac004,_0x3c7119){_0x3c7119=_0x3c7119||0xcc;return function(_0x5f31ff){if(_0x5f31ff){return _0x5ac004[_0x67da('0xb')](_0x3c7119);}return _0x5ac004[_0x67da('0xc')](_0x3c7119)[_0x67da('0xd')]();};}function respondWithResult(_0x2b8f3a,_0x7adba5){_0x7adba5=_0x7adba5||0xc8;return function(_0x26198c){if(_0x26198c){return _0x2b8f3a[_0x67da('0xc')](_0x7adba5)['json'](_0x26198c);}};}function respondWithFilteredResult(_0x5bfa4f,_0x37b9d2){return function(_0x329a9c){if(_0x329a9c){var _0x3e2305=typeof _0x37b9d2[_0x67da('0xe')]===_0x67da('0xf')&&typeof _0x37b9d2['limit']===_0x67da('0xf');var _0x9beca6=_0x329a9c[_0x67da('0x10')];var _0x12d4d1=_0x3e2305?0x0:_0x37b9d2[_0x67da('0xe')];var _0x508b4a=_0x3e2305?_0x329a9c[_0x67da('0x10')]:_0x37b9d2[_0x67da('0xe')]+_0x37b9d2['limit'];var _0x11e151;if(_0x508b4a>=_0x9beca6){_0x508b4a=_0x9beca6;_0x11e151=0xc8;}else{_0x11e151=0xce;}_0x5bfa4f[_0x67da('0xc')](_0x11e151);return _0x5bfa4f[_0x67da('0x11')](_0x67da('0x12'),_0x12d4d1+'-'+_0x508b4a+'/'+_0x9beca6)[_0x67da('0x13')](_0x329a9c);}return null;};}function saveUpdates(_0xb3a67){return function(_0x25c82a){if(_0x25c82a){return _0x25c82a[_0x67da('0x14')](_0xb3a67)['then'](function(_0xaefe69){return _0xaefe69;});}return null;};}function removeEntity(_0x524819){return function(_0x31454f){if(_0x31454f){return _0x31454f['destroy']()[_0x67da('0x15')](function(){var _0xa53a90=_0x31454f[_0x67da('0x16')]({'plain':!![]});var _0x156abf='FaxQueues';return db[_0x67da('0x17')]['destroy']({'where':{'type':_0x156abf,'resourceId':_0xa53a90['id']}})['then'](function(){return _0x31454f;});})[_0x67da('0x15')](function(){_0x524819[_0x67da('0xc')](0xcc)[_0x67da('0xd')]();});}};}function handleEntityNotFound(_0x7ff900){return function(_0x56714d){if(!_0x56714d){_0x7ff900['sendStatus'](0x194);}return _0x56714d;};}function handleError(_0x56aa6a,_0x3f2182){_0x3f2182=_0x3f2182||0x1f4;return function(_0x202f52){logger[_0x67da('0x18')](_0x202f52[_0x67da('0x19')]);if(_0x202f52[_0x67da('0x1a')]){delete _0x202f52[_0x67da('0x1a')];}_0x56aa6a['status'](_0x3f2182)[_0x67da('0x1b')](_0x202f52);};}exports[_0x67da('0x1c')]=function(_0x535b83,_0x35bac5){var _0x599a9d={};var _0x4417e5={'count':0x0,'rows':[]};var _0x15207c=_[_0x67da('0x1d')](db[_0x67da('0x1e')][_0x67da('0x1f')],function(_0x35b1bc){return{'name':_0x35b1bc['fieldName'],'type':_0x35b1bc[_0x67da('0x20')][_0x67da('0x21')]};});_0x599a9d=qs['getOptions'](_0x15207c,_0x535b83);var _0x5afdc4={'where':_0x599a9d[_0x67da('0x22')]};return db[_0x67da('0x1e')][_0x67da('0x10')](_0x5afdc4)[_0x67da('0x15')](function(_0x53f6fa){_0x4417e5[_0x67da('0x10')]=_0x53f6fa;_0x599a9d[_0x67da('0x23')]=qs[_0x67da('0x23')](_0x535b83[_0x67da('0x24')]);return db[_0x67da('0x1e')][_0x67da('0x25')](_0x599a9d);})[_0x67da('0x15')](function(_0x1e2bd0){_0x4417e5[_0x67da('0x26')]=_0x1e2bd0;return _0x4417e5;})[_0x67da('0x15')](respondWithFilteredResult(_0x35bac5,_0x599a9d))[_0x67da('0x27')](handleError(_0x35bac5,null));};exports[_0x67da('0x28')]=function(_0x1316d0,_0x38a502){var _0x48e08a={'raw':!![],'where':{'id':_0x1316d0[_0x67da('0x29')]['id']}},_0x229b6b={};_0x229b6b[_0x67da('0x2a')]=_[_0x67da('0x2b')](db[_0x67da('0x1e')][_0x67da('0x1f')]);_0x229b6b['query']=_[_0x67da('0x2b')](_0x1316d0[_0x67da('0x24')]);_0x229b6b[_0x67da('0x2c')]=_['intersection'](_0x229b6b['model'],_0x229b6b['query']);_0x48e08a['attributes']=_[_0x67da('0x2d')](_0x229b6b['model'],qs[_0x67da('0x2e')](_0x1316d0[_0x67da('0x24')][_0x67da('0x2e')]));_0x48e08a[_0x67da('0x2f')]=_0x48e08a[_0x67da('0x2f')][_0x67da('0x30')]?_0x48e08a[_0x67da('0x2f')]:_0x229b6b[_0x67da('0x2a')];if(_0x1316d0[_0x67da('0x24')][_0x67da('0x31')]){_0x48e08a[_0x67da('0x23')]=[{'all':!![]}];}_0x48e08a=_[_0x67da('0x32')]({},_0x48e08a,_0x1316d0[_0x67da('0x33')]);return db[_0x67da('0x1e')][_0x67da('0x34')](_0x48e08a)[_0x67da('0x15')](handleEntityNotFound(_0x38a502,null))[_0x67da('0x15')](respondWithResult(_0x38a502,null))[_0x67da('0x27')](handleError(_0x38a502,null));};exports[_0x67da('0x35')]=function(_0x2ba807,_0xa96a4e){return db[_0x67da('0x1e')][_0x67da('0x35')](_0x2ba807[_0x67da('0x36')],{})[_0x67da('0x15')](function(_0x476973){var _0x58b234=_0x2ba807[_0x67da('0x37')][_0x67da('0x16')]({'plain':!![]});if(!_0x58b234)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58b234[_0x67da('0x38')]===_0x67da('0x37')){var _0x503188=_0x476973['get']({'plain':!![]});var _0x509024=_0x67da('0x39');return db[_0x67da('0x3a')][_0x67da('0x34')]({'where':{'name':_0x509024,'userProfileId':_0x58b234[_0x67da('0x3b')]},'raw':!![]})[_0x67da('0x15')](function(_0x58c771){if(_0x58c771&&_0x58c771[_0x67da('0x3c')]===0x0){return db['UserProfileResource'][_0x67da('0x35')]({'name':_0x503188[_0x67da('0x1a')],'resourceId':_0x503188['id'],'type':_0x58c771[_0x67da('0x1a')],'sectionId':_0x58c771['id']},{})[_0x67da('0x15')](function(){return _0x476973;});}else{return _0x476973;}})['catch'](function(_0x1081bb){logger['error'](_0x67da('0x3d'),_0x1081bb);throw _0x1081bb;});}return _0x476973;})[_0x67da('0x15')](respondWithResult(_0xa96a4e,0xc9))[_0x67da('0x27')](handleError(_0xa96a4e,null));};exports['update']=function(_0x21ee24,_0x3dab93){if(_0x21ee24[_0x67da('0x36')]['id']){delete _0x21ee24[_0x67da('0x36')]['id'];}return db[_0x67da('0x1e')][_0x67da('0x34')]({'where':{'id':_0x21ee24['params']['id']}})['then'](handleEntityNotFound(_0x3dab93,null))[_0x67da('0x15')](saveUpdates(_0x21ee24[_0x67da('0x36')],null))['then'](respondWithResult(_0x3dab93,null))[_0x67da('0x27')](handleError(_0x3dab93,null));};exports[_0x67da('0x3e')]=function(_0x5dbd8f,_0x52840a){return db[_0x67da('0x1e')][_0x67da('0x34')]({'where':{'id':_0x5dbd8f[_0x67da('0x29')]['id']}})['then'](handleEntityNotFound(_0x52840a,null))[_0x67da('0x15')](removeEntity(_0x52840a,null))['catch'](handleError(_0x52840a,null));};exports[_0x67da('0x3f')]=function(_0x181dd7,_0x28cd1b){return db['FaxQueue'][_0x67da('0x3f')]()['then'](respondWithResult(_0x28cd1b,null))[_0x67da('0x27')](handleError(_0x28cd1b,null));};exports[_0x67da('0x40')]=function(_0x3aa3f6,_0x1222bc){var _0x5e5765={'raw':!![],'where':{}},_0x43c5b5={},_0x56671f;return db[_0x67da('0x1e')][_0x67da('0x41')]({'where':{'id':_0x3aa3f6[_0x67da('0x29')]['id']}})[_0x67da('0x15')](handleEntityNotFound(_0x1222bc,null))[_0x67da('0x15')](function(_0x40420b){if(_0x40420b){_0x56671f=_0x40420b[_0x67da('0x16')]({'plain':!![]});_0x43c5b5[_0x67da('0x2a')]=_[_0x67da('0x2b')](db['UserFaxQueue'][_0x67da('0x1f')]);_0x43c5b5[_0x67da('0x24')]=_[_0x67da('0x2b')](_0x3aa3f6[_0x67da('0x24')]);_0x43c5b5[_0x67da('0x2c')]=_['intersection'](_0x43c5b5[_0x67da('0x2a')],_0x43c5b5[_0x67da('0x24')]);_0x5e5765[_0x67da('0x2f')]=_[_0x67da('0x2d')](_0x43c5b5[_0x67da('0x2a')],qs[_0x67da('0x2e')](_0x3aa3f6[_0x67da('0x24')][_0x67da('0x2e')]));_0x5e5765['attributes']=_0x5e5765[_0x67da('0x2f')][_0x67da('0x30')]?_0x5e5765[_0x67da('0x2f')]:_0x43c5b5['model'];if(!_0x3aa3f6[_0x67da('0x24')][_0x67da('0x42')](_0x67da('0x43'))){_0x5e5765['limit']=qs[_0x67da('0x44')](_0x3aa3f6[_0x67da('0x24')][_0x67da('0x44')]);_0x5e5765[_0x67da('0xe')]=qs[_0x67da('0xe')](_0x3aa3f6[_0x67da('0x24')][_0x67da('0xe')]);}_0x5e5765['order']=qs[_0x67da('0x45')](_0x3aa3f6[_0x67da('0x24')]['sort']);_0x5e5765[_0x67da('0x22')]=qs['filters'](_[_0x67da('0x46')](_0x3aa3f6[_0x67da('0x24')],_0x43c5b5[_0x67da('0x2c')]));_0x5e5765['where'][_0x67da('0x47')]=_0x40420b['id'];if(_0x3aa3f6[_0x67da('0x24')]['filter']){_0x5e5765['where']=_[_0x67da('0x32')](_0x5e5765[_0x67da('0x22')],{'$or':_[_0x67da('0x1d')](_0x5e5765['attributes'],function(_0x3a3a66){var _0x5e5c92={};_0x5e5c92[_0x3a3a66]={'$like':'%'+_0x3aa3f6['query']['filter']+'%'};return _0x5e5c92;})});}_0x5e5765=_[_0x67da('0x32')]({},_0x5e5765,_0x3aa3f6['options']);return db[_0x67da('0x48')][_0x67da('0x25')](_0x5e5765);}})['then'](function(_0x164774){if(_0x164774){return db[_0x67da('0x49')][_0x67da('0x4a')]({'where':{'id':_[_0x67da('0x1d')](_0x164774,'UserId'),'role':_0x67da('0x4b')},'attributes':['id',_0x67da('0x1a'),'faxPause',_0x67da('0x4c'),_0x67da('0x4d')]});}})[_0x67da('0x15')](function(_0xbc383c){if(_0xbc383c){return{'count':_0xbc383c[_0x67da('0x10')],'rows':_[_0x67da('0x1d')](_0xbc383c[_0x67da('0x26')],function(_0x4a4d84){return{'membername':_0x4a4d84[_0x67da('0x1a')],'UserId':_0x4a4d84['id'],'queue_name':_0x56671f['name'],'FaxQueueId':_0x56671f['id'],'interface':util[_0x67da('0x4e')](_0x67da('0x4f'),_0x67da('0x50'),_0x4a4d84['name']),'penalty':0x0,'paused':_0x4a4d84[_0x67da('0x51')],'createdAt':_0x4a4d84[_0x67da('0x4d')],'updatedAt':_0x4a4d84[_0x67da('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x67da('0x15')](respondWithFilteredResult(_0x1222bc,_0x5e5765))[_0x67da('0x27')](handleError(_0x1222bc,null));};exports[_0x67da('0x52')]=function(_0x4f0285,_0x511945){var _0x5b2f89={};var _0x3d9498={};var _0x444f45;var _0x254510;return db[_0x67da('0x1e')]['findOne']({'where':{'id':_0x4f0285['params']['id']}})[_0x67da('0x15')](handleEntityNotFound(_0x511945,null))[_0x67da('0x15')](function(_0x22afe0){if(_0x22afe0){_0x444f45=_0x22afe0;_0x3d9498[_0x67da('0x2a')]=_['keys'](db[_0x67da('0x53')][_0x67da('0x1f')]);_0x3d9498['query']=_[_0x67da('0x2b')](_0x4f0285[_0x67da('0x24')]);_0x3d9498[_0x67da('0x2c')]=_[_0x67da('0x2d')](_0x3d9498[_0x67da('0x2a')],_0x3d9498[_0x67da('0x24')]);_0x5b2f89['attributes']=_[_0x67da('0x2d')](_0x3d9498[_0x67da('0x2a')],qs[_0x67da('0x2e')](_0x4f0285['query'][_0x67da('0x2e')]));_0x5b2f89['attributes']=_0x5b2f89[_0x67da('0x2f')][_0x67da('0x30')]?_0x5b2f89[_0x67da('0x2f')]:_0x3d9498[_0x67da('0x2a')];_0x5b2f89['order']=qs[_0x67da('0x45')](_0x4f0285[_0x67da('0x24')]['sort']);_0x5b2f89['where']=qs[_0x67da('0x2c')](_[_0x67da('0x46')](_0x4f0285[_0x67da('0x24')],_0x3d9498[_0x67da('0x2c')]));if(_0x4f0285[_0x67da('0x24')][_0x67da('0x54')]){_0x5b2f89[_0x67da('0x22')]=_[_0x67da('0x32')](_0x5b2f89['where'],{'$or':_[_0x67da('0x1d')](_0x5b2f89[_0x67da('0x2f')],function(_0x1c216){var _0x511448={};_0x511448[_0x1c216]={'$like':'%'+_0x4f0285[_0x67da('0x24')][_0x67da('0x54')]+'%'};return _0x511448;})});}_0x5b2f89=_[_0x67da('0x32')]({},_0x5b2f89,_0x4f0285[_0x67da('0x33')]);return _0x444f45[_0x67da('0x52')](_0x5b2f89);}})[_0x67da('0x15')](function(_0x2848e6){if(_0x2848e6){_0x254510=_0x2848e6[_0x67da('0x30')];if(!_0x4f0285[_0x67da('0x24')][_0x67da('0x42')](_0x67da('0x43'))){_0x5b2f89[_0x67da('0x44')]=qs[_0x67da('0x44')](_0x4f0285['query'][_0x67da('0x44')]);_0x5b2f89[_0x67da('0xe')]=qs[_0x67da('0xe')](_0x4f0285['query'][_0x67da('0xe')]);}return _0x444f45[_0x67da('0x52')](_0x5b2f89);}})[_0x67da('0x15')](function(_0x1cdf1e){if(_0x1cdf1e){return _0x1cdf1e?{'count':_0x254510,'rows':_0x1cdf1e}:null;}})[_0x67da('0x15')](respondWithResult(_0x511945,null))[_0x67da('0x27')](handleError(_0x511945,null));};exports['addTeams']=function(_0x199a38,_0x379bbb){var _0x27b466=_0x199a38['body'][_0x67da('0x55')];return db[_0x67da('0x53')][_0x67da('0x25')]({'where':{'id':_0x27b466},'attributes':['id'],'include':[{'model':db[_0x67da('0x49')],'as':_0x67da('0x56'),'attributes':['id','name',_0x67da('0x57'),_0x67da('0x58'),_0x67da('0x59')],'raw':!![]}]})['then'](function(_0x445634){if(_0x445634){var _0x30332e=_['flatMap'](_0x445634,function(_0x41f1a2){var _0xa7877=_0x41f1a2[_0x67da('0x16')]({'plain':!![]});return _0xa7877[_0x67da('0x56')];});return db['FaxQueue'][_0x67da('0x34')]({'where':{'id':_0x199a38[_0x67da('0x29')]['id']}})[_0x67da('0x15')](function(_0x21be6a){return db['sequelize'][_0x67da('0x5a')](function(_0x5bf0f7){return _0x21be6a[_0x67da('0x5b')](_0x27b466,{'transaction':_0x5bf0f7})[_0x67da('0x15')](function(){return BPromise[_0x67da('0x5c')](_0x30332e,function(_0xe06a68){return db[_0x67da('0x48')][_0x67da('0x5d')]({'where':{'UserId':_0xe06a68['id'],'FaxQueueId':_0x199a38[_0x67da('0x29')]['id']},'transaction':_0x5bf0f7});});})[_0x67da('0x15')](function(){_0x30332e['forEach'](function(_0x41b2f6){socket[_0x67da('0x5e')]('userFaxQueue:save',{'UserId':_0x41b2f6['id'],'FaxQueueId':_0x21be6a['id']});});});});});}})['then'](respondWithStatusCode(_0x379bbb,null))[_0x67da('0x27')](handleError(_0x379bbb,null));};exports['removeTeams']=function(_0x20d037,_0xd8c49){return db[_0x67da('0x53')][_0x67da('0x25')]({'where':{'id':_0x20d037['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x67da('0x49')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x67da('0x15')](handleEntityNotFound(_0xd8c49,null))[_0x67da('0x15')](function(_0x14a27e){var _0x49c18e=_[_0x67da('0x1d')](_0x14a27e,'id');var _0x1c7df9=[];var _0x3dddbd=[];var _0x316aef=squel['select']();_0x316aef[_0x67da('0x5f')](_0x67da('0x60'))[_0x67da('0x61')](_0x67da('0x62'),'tq')['join'](_0x67da('0x63'),'ut',_0x67da('0x64'))[_0x67da('0x22')]('FaxQueueId\x20=\x20?',_0x20d037['params']['id']);for(var _0x43972b=0x0;_0x43972b<_0x14a27e[_0x67da('0x30')];_0x43972b+=0x1){let _0xfaf2c3=_0x14a27e[_0x43972b];for(var _0x22219b=0x0;_0x22219b<_0xfaf2c3[_0x67da('0x56')][_0x67da('0x30')];_0x22219b+=0x1){let _0x219ddd=_0xfaf2c3['Agents'][_0x22219b];var _0xd1565e=_0x316aef[_0x67da('0x65')]();_0xd1565e[_0x67da('0x22')](_0x67da('0x66'),_0x219ddd['id']);_0x3dddbd[_0x67da('0x67')](db[_0x67da('0x68')]['query'](_0xd1565e[_0x67da('0x69')](),{'type':db['sequelize']['QueryTypes'][_0x67da('0x6a')]})[_0x67da('0x15')](function(_0x725dc7){if(_0x725dc7[_0x67da('0x30')]===0x1){return _0x219ddd['id'];}else{var _0xaf8be1=_['every'](_[_0x67da('0x1d')](_0x725dc7,_0x67da('0x6b')),function(_0x24684a){return _[_0x67da('0x6c')](_0x49c18e,_0x24684a);});if(_0xaf8be1){return _0x219ddd['id'];}}}));}}return BPromise['all'](_0x3dddbd)[_0x67da('0x15')](function(_0x534904){_0x1c7df9=_(_0x1c7df9)[_0x67da('0x6d')](_0x534904)[_0x67da('0x6e')]()[_0x67da('0x6f')]();return db[_0x67da('0x1e')][_0x67da('0x34')]({'where':{'id':_0x20d037[_0x67da('0x29')]['id']}})[_0x67da('0x15')](function(_0x397de6){return db[_0x67da('0x68')][_0x67da('0x5a')](function(_0x237db6){return _0x397de6[_0x67da('0x70')](_0x20d037[_0x67da('0x24')][_0x67da('0x55')],{'transaction':_0x237db6})[_0x67da('0x15')](function(){if(!_['isEmpty'](_0x1c7df9)){return _0x397de6[_0x67da('0x71')](_0x1c7df9,{'transaction':_0x237db6});}})['then'](function(){_0x1c7df9['forEach'](function(_0x531784){socket[_0x67da('0x5e')](_0x67da('0x72'),{'UserId':_0x531784,'FaxQueueId':_0x397de6['id']});});});});});});})[_0x67da('0x15')](respondWithStatusCode(_0xd8c49,null))[_0x67da('0x27')](handleError(_0xd8c49,null));};exports[_0x67da('0x73')]=function(_0x439c5d,_0x339679){return db[_0x67da('0x1e')]['find']({'where':{'id':_0x439c5d[_0x67da('0x29')]['id']}})[_0x67da('0x15')](handleEntityNotFound(_0x339679,null))[_0x67da('0x15')](function(_0x5cf036){if(_0x5cf036){return _0x5cf036[_0x67da('0x73')](_0x439c5d[_0x67da('0x36')][_0x67da('0x55')],_[_0x67da('0x74')](_0x439c5d[_0x67da('0x36')],['ids','id'])||{})[_0x67da('0x75')](function(_0x5c1d3f){for(var _0x2a7b94=0x0;_0x2a7b94<_0x439c5d[_0x67da('0x36')][_0x67da('0x55')][_0x67da('0x30')];_0x2a7b94+=0x1){socket[_0x67da('0x5e')](_0x67da('0x76'),{'UserId':Number(_0x439c5d['body']['ids'][_0x2a7b94]),'FaxQueueId':Number(_0x439c5d[_0x67da('0x29')]['id'])});}return _0x5c1d3f;});}})[_0x67da('0x15')](respondWithResult(_0x339679,null))[_0x67da('0x27')](handleError(_0x339679,null));};exports['removeAgents']=function(_0x196152,_0xeae65f){return db['FaxQueue'][_0x67da('0x34')]({'where':{'id':_0x196152[_0x67da('0x29')]['id']}})['then'](handleEntityNotFound(_0xeae65f,null))[_0x67da('0x15')](function(_0x5e0d7f){if(_0x5e0d7f){return _0x5e0d7f[_0x67da('0x71')](_0x196152['query'][_0x67da('0x55')])[_0x67da('0x15')](function(){if(_[_0x67da('0x77')](_0x196152[_0x67da('0x24')]['ids'])){for(var _0x8306d5=0x0;_0x8306d5<_0x196152[_0x67da('0x24')][_0x67da('0x55')][_0x67da('0x30')];_0x8306d5+=0x1){socket[_0x67da('0x5e')](_0x67da('0x72'),{'UserId':Number(_0x196152[_0x67da('0x24')][_0x67da('0x55')][_0x8306d5]),'FaxQueueId':Number(_0x196152['params']['id'])});}}else{socket[_0x67da('0x5e')]('userFaxQueue:remove',{'UserId':Number(_0x196152[_0x67da('0x24')][_0x67da('0x55')]),'FaxQueueId':Number(_0x196152['params']['id'])});}});}})['then'](respondWithStatusCode(_0xeae65f,null))[_0x67da('0x27')](handleError(_0xeae65f,null));};exports[_0x67da('0x78')]=function(_0x5ad70b,_0x1343ce){var _0x12c6f3={};var _0x57e9f1={};var _0x173166;var _0x4fe7df;return db[_0x67da('0x1e')][_0x67da('0x41')]({'where':{'id':_0x5ad70b[_0x67da('0x29')]['id']}})['then'](handleEntityNotFound(_0x1343ce,null))['then'](function(_0x5a3cdb){if(_0x5a3cdb){_0x173166=_0x5a3cdb;_0x57e9f1[_0x67da('0x2a')]=_[_0x67da('0x2b')](db[_0x67da('0x49')][_0x67da('0x1f')]);_0x57e9f1[_0x67da('0x24')]=_[_0x67da('0x2b')](_0x5ad70b[_0x67da('0x24')]);_0x57e9f1['filters']=_[_0x67da('0x2d')](_0x57e9f1[_0x67da('0x2a')],_0x57e9f1[_0x67da('0x24')]);_0x12c6f3['attributes']=_[_0x67da('0x2d')](_0x57e9f1['model'],qs[_0x67da('0x2e')](_0x5ad70b[_0x67da('0x24')][_0x67da('0x2e')]));_0x12c6f3[_0x67da('0x2f')]=_0x12c6f3[_0x67da('0x2f')]['length']?_0x12c6f3[_0x67da('0x2f')]:_0x57e9f1[_0x67da('0x2a')];_0x12c6f3['order']=qs[_0x67da('0x45')](_0x5ad70b[_0x67da('0x24')][_0x67da('0x45')]);_0x12c6f3[_0x67da('0x22')]=qs[_0x67da('0x2c')](_[_0x67da('0x46')](_0x5ad70b[_0x67da('0x24')],_0x57e9f1[_0x67da('0x2c')]));if(_0x5ad70b[_0x67da('0x24')][_0x67da('0x54')]){_0x12c6f3[_0x67da('0x22')]=_[_0x67da('0x32')](_0x12c6f3['where'],{'$or':_[_0x67da('0x1d')](_0x12c6f3[_0x67da('0x2f')],function(_0x23c0fc){var _0x254c4d={};_0x254c4d[_0x23c0fc]={'$like':'%'+_0x5ad70b[_0x67da('0x24')][_0x67da('0x54')]+'%'};return _0x254c4d;})});}_0x12c6f3=_[_0x67da('0x32')]({},_0x12c6f3,_0x5ad70b['options']);return _0x173166['getAgents'](_0x12c6f3);}})['then'](function(_0x3daf9e){if(_0x3daf9e){_0x4fe7df=_0x3daf9e[_0x67da('0x30')];if(!_0x5ad70b[_0x67da('0x24')][_0x67da('0x42')](_0x67da('0x43'))){_0x12c6f3[_0x67da('0x44')]=qs[_0x67da('0x44')](_0x5ad70b[_0x67da('0x24')][_0x67da('0x44')]);_0x12c6f3[_0x67da('0xe')]=qs['offset'](_0x5ad70b[_0x67da('0x24')][_0x67da('0xe')]);}return _0x173166[_0x67da('0x78')](_0x12c6f3);}})[_0x67da('0x15')](function(_0x2bdad3){if(_0x2bdad3){return _0x2bdad3?{'count':_0x4fe7df,'rows':_0x2bdad3}:null;}})[_0x67da('0x15')](respondWithResult(_0x1343ce,null))[_0x67da('0x27')](handleError(_0x1343ce,null));}; \ No newline at end of file +var _0x8a9a=['emit','removeTeams','select','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','SELECT','TeamId','all','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','spread','isArray','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','register','status','end','json','offset','undefined','limit','count','set','update','then','FaxQueues','UserProfileResource','destroy','sendStatus','error','stack','index','map','FaxQueue','rawAttributes','type','getOptions','where','include','findAll','catch','keys','query','filters','intersection','model','attributes','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','describe','getMembers','findOne','UserFaxQueue','fields','hasOwnProperty','nolimit','order','sort','pick','FaxQueueId','filter','findAndCountAll','UserId','faxPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','User','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach'];(function(_0x1e74d8,_0x4e7c74){var _0x40b555=function(_0x5a8f3f){while(--_0x5a8f3f){_0x1e74d8['push'](_0x1e74d8['shift']());}};_0x40b555(++_0x4e7c74);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x8a9a[_0x273c39];return _0x46d6b5;};'use strict';var BPromise=require('bluebird');var util=require(_0xa8a9('0x0'));var _=require(_0xa8a9('0x1'));var squel=require(_0xa8a9('0x2'));var Redis=require(_0xa8a9('0x3'));var qs=require(_0xa8a9('0x4'));var logger=require(_0xa8a9('0x5'))(_0xa8a9('0x6'));var config=require(_0xa8a9('0x7'));var db=require(_0xa8a9('0x8'))['db'];config[_0xa8a9('0x9')]=_[_0xa8a9('0xa')](config[_0xa8a9('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xa8a9('0xb'))(new Redis(config['redis']));require(_0xa8a9('0xc'))[_0xa8a9('0xd')](socket);function respondWithStatusCode(_0x1477b0,_0x3b1f45){_0x3b1f45=_0x3b1f45||0xcc;return function(_0x219429){if(_0x219429){return _0x1477b0['sendStatus'](_0x3b1f45);}return _0x1477b0[_0xa8a9('0xe')](_0x3b1f45)[_0xa8a9('0xf')]();};}function respondWithResult(_0x58e265,_0x2743ed){_0x2743ed=_0x2743ed||0xc8;return function(_0x4f4af8){if(_0x4f4af8){return _0x58e265[_0xa8a9('0xe')](_0x2743ed)[_0xa8a9('0x10')](_0x4f4af8);}};}function respondWithFilteredResult(_0x5815e4,_0x1bcdbd){return function(_0x218037){if(_0x218037){var _0x4477a5=typeof _0x1bcdbd[_0xa8a9('0x11')]===_0xa8a9('0x12')&&typeof _0x1bcdbd[_0xa8a9('0x13')]==='undefined';var _0x2fd026=_0x218037[_0xa8a9('0x14')];var _0x24abd1=_0x4477a5?0x0:_0x1bcdbd['offset'];var _0x4f35e6=_0x4477a5?_0x218037[_0xa8a9('0x14')]:_0x1bcdbd[_0xa8a9('0x11')]+_0x1bcdbd[_0xa8a9('0x13')];var _0x4ca16f;if(_0x4f35e6>=_0x2fd026){_0x4f35e6=_0x2fd026;_0x4ca16f=0xc8;}else{_0x4ca16f=0xce;}_0x5815e4[_0xa8a9('0xe')](_0x4ca16f);return _0x5815e4[_0xa8a9('0x15')]('Content-Range',_0x24abd1+'-'+_0x4f35e6+'/'+_0x2fd026)['json'](_0x218037);}return null;};}function saveUpdates(_0x1039c9){return function(_0x15d58c){if(_0x15d58c){return _0x15d58c[_0xa8a9('0x16')](_0x1039c9)[_0xa8a9('0x17')](function(_0x46a89d){return _0x46a89d;});}return null;};}function removeEntity(_0x4456aa){return function(_0x5cd106){if(_0x5cd106){return _0x5cd106['destroy']()[_0xa8a9('0x17')](function(){var _0x5ca727=_0x5cd106['get']({'plain':!![]});var _0x133d0e=_0xa8a9('0x18');return db[_0xa8a9('0x19')][_0xa8a9('0x1a')]({'where':{'type':_0x133d0e,'resourceId':_0x5ca727['id']}})[_0xa8a9('0x17')](function(){return _0x5cd106;});})[_0xa8a9('0x17')](function(){_0x4456aa[_0xa8a9('0xe')](0xcc)[_0xa8a9('0xf')]();});}};}function handleEntityNotFound(_0x1ef185){return function(_0x59d315){if(!_0x59d315){_0x1ef185[_0xa8a9('0x1b')](0x194);}return _0x59d315;};}function handleError(_0x481a34,_0x32721b){_0x32721b=_0x32721b||0x1f4;return function(_0x58b2f0){logger[_0xa8a9('0x1c')](_0x58b2f0[_0xa8a9('0x1d')]);if(_0x58b2f0['name']){delete _0x58b2f0['name'];}_0x481a34['status'](_0x32721b)['send'](_0x58b2f0);};}exports[_0xa8a9('0x1e')]=function(_0x4faffe,_0x46d765){var _0x5276bd={};var _0x284b55={'count':0x0,'rows':[]};var _0x16abed=_[_0xa8a9('0x1f')](db[_0xa8a9('0x20')][_0xa8a9('0x21')],function(_0x34d84a){return{'name':_0x34d84a['fieldName'],'type':_0x34d84a[_0xa8a9('0x22')]['key']};});_0x5276bd=qs[_0xa8a9('0x23')](_0x16abed,_0x4faffe);var _0x1f748a={'where':_0x5276bd[_0xa8a9('0x24')]};return db[_0xa8a9('0x20')][_0xa8a9('0x14')](_0x1f748a)[_0xa8a9('0x17')](function(_0x4a468f){_0x284b55[_0xa8a9('0x14')]=_0x4a468f;_0x5276bd[_0xa8a9('0x25')]=qs[_0xa8a9('0x25')](_0x4faffe['query']);return db[_0xa8a9('0x20')][_0xa8a9('0x26')](_0x5276bd);})['then'](function(_0x4d42fc){_0x284b55['rows']=_0x4d42fc;return _0x284b55;})['then'](respondWithFilteredResult(_0x46d765,_0x5276bd))[_0xa8a9('0x27')](handleError(_0x46d765,null));};exports['show']=function(_0x3c9d83,_0x7e036d){var _0x26e330={'raw':!![],'where':{'id':_0x3c9d83['params']['id']}},_0x31ad52={};_0x31ad52['model']=_[_0xa8a9('0x28')](db[_0xa8a9('0x20')][_0xa8a9('0x21')]);_0x31ad52['query']=_[_0xa8a9('0x28')](_0x3c9d83[_0xa8a9('0x29')]);_0x31ad52[_0xa8a9('0x2a')]=_[_0xa8a9('0x2b')](_0x31ad52[_0xa8a9('0x2c')],_0x31ad52['query']);_0x26e330[_0xa8a9('0x2d')]=_[_0xa8a9('0x2b')](_0x31ad52[_0xa8a9('0x2c')],qs['fields'](_0x3c9d83[_0xa8a9('0x29')]['fields']));_0x26e330['attributes']=_0x26e330['attributes'][_0xa8a9('0x2e')]?_0x26e330['attributes']:_0x31ad52[_0xa8a9('0x2c')];if(_0x3c9d83[_0xa8a9('0x29')][_0xa8a9('0x2f')]){_0x26e330['include']=[{'all':!![]}];}_0x26e330=_[_0xa8a9('0x30')]({},_0x26e330,_0x3c9d83[_0xa8a9('0x31')]);return db['FaxQueue']['find'](_0x26e330)[_0xa8a9('0x17')](handleEntityNotFound(_0x7e036d,null))[_0xa8a9('0x17')](respondWithResult(_0x7e036d,null))['catch'](handleError(_0x7e036d,null));};exports[_0xa8a9('0x32')]=function(_0x53a589,_0x598bf8){return db[_0xa8a9('0x20')][_0xa8a9('0x32')](_0x53a589[_0xa8a9('0x33')],{})['then'](function(_0x2e5d57){var _0x1d6869=_0x53a589[_0xa8a9('0x34')]['get']({'plain':!![]});if(!_0x1d6869)throw new Error(_0xa8a9('0x35'));if(_0x1d6869['role']===_0xa8a9('0x34')){var _0x58c0cd=_0x2e5d57[_0xa8a9('0x36')]({'plain':!![]});var _0x579081=_0xa8a9('0x18');return db[_0xa8a9('0x37')]['find']({'where':{'name':_0x579081,'userProfileId':_0x1d6869[_0xa8a9('0x38')]},'raw':!![]})['then'](function(_0x44a9be){if(_0x44a9be&&_0x44a9be[_0xa8a9('0x39')]===0x0){return db[_0xa8a9('0x19')][_0xa8a9('0x32')]({'name':_0x58c0cd[_0xa8a9('0x3a')],'resourceId':_0x58c0cd['id'],'type':_0x44a9be[_0xa8a9('0x3a')],'sectionId':_0x44a9be['id']},{})[_0xa8a9('0x17')](function(){return _0x2e5d57;});}else{return _0x2e5d57;}})['catch'](function(_0x1e05f6){logger[_0xa8a9('0x1c')](_0xa8a9('0x3b'),_0x1e05f6);throw _0x1e05f6;});}return _0x2e5d57;})['then'](respondWithResult(_0x598bf8,0xc9))['catch'](handleError(_0x598bf8,null));};exports['update']=function(_0x38b323,_0x2c55c4){if(_0x38b323[_0xa8a9('0x33')]['id']){delete _0x38b323[_0xa8a9('0x33')]['id'];}return db[_0xa8a9('0x20')][_0xa8a9('0x3c')]({'where':{'id':_0x38b323[_0xa8a9('0x3d')]['id']}})[_0xa8a9('0x17')](handleEntityNotFound(_0x2c55c4,null))['then'](saveUpdates(_0x38b323[_0xa8a9('0x33')],null))[_0xa8a9('0x17')](respondWithResult(_0x2c55c4,null))[_0xa8a9('0x27')](handleError(_0x2c55c4,null));};exports[_0xa8a9('0x1a')]=function(_0x3cccb6,_0x165b52){return db['FaxQueue'][_0xa8a9('0x3c')]({'where':{'id':_0x3cccb6[_0xa8a9('0x3d')]['id']}})[_0xa8a9('0x17')](handleEntityNotFound(_0x165b52,null))['then'](removeEntity(_0x165b52,null))[_0xa8a9('0x27')](handleError(_0x165b52,null));};exports[_0xa8a9('0x3e')]=function(_0x261fce,_0x327009){return db['FaxQueue'][_0xa8a9('0x3e')]()['then'](respondWithResult(_0x327009,null))[_0xa8a9('0x27')](handleError(_0x327009,null));};exports[_0xa8a9('0x3f')]=function(_0x2b7590,_0x350f90){var _0x38b9c0={'raw':!![],'where':{}},_0x21ff9b={},_0x5c48a7;return db[_0xa8a9('0x20')][_0xa8a9('0x40')]({'where':{'id':_0x2b7590['params']['id']}})[_0xa8a9('0x17')](handleEntityNotFound(_0x350f90,null))['then'](function(_0x2fba4a){if(_0x2fba4a){_0x5c48a7=_0x2fba4a['get']({'plain':!![]});_0x21ff9b[_0xa8a9('0x2c')]=_[_0xa8a9('0x28')](db[_0xa8a9('0x41')][_0xa8a9('0x21')]);_0x21ff9b[_0xa8a9('0x29')]=_[_0xa8a9('0x28')](_0x2b7590[_0xa8a9('0x29')]);_0x21ff9b['filters']=_[_0xa8a9('0x2b')](_0x21ff9b[_0xa8a9('0x2c')],_0x21ff9b['query']);_0x38b9c0[_0xa8a9('0x2d')]=_[_0xa8a9('0x2b')](_0x21ff9b['model'],qs[_0xa8a9('0x42')](_0x2b7590[_0xa8a9('0x29')][_0xa8a9('0x42')]));_0x38b9c0[_0xa8a9('0x2d')]=_0x38b9c0[_0xa8a9('0x2d')]['length']?_0x38b9c0[_0xa8a9('0x2d')]:_0x21ff9b[_0xa8a9('0x2c')];if(!_0x2b7590['query'][_0xa8a9('0x43')](_0xa8a9('0x44'))){_0x38b9c0[_0xa8a9('0x13')]=qs[_0xa8a9('0x13')](_0x2b7590[_0xa8a9('0x29')][_0xa8a9('0x13')]);_0x38b9c0[_0xa8a9('0x11')]=qs[_0xa8a9('0x11')](_0x2b7590[_0xa8a9('0x29')]['offset']);}_0x38b9c0[_0xa8a9('0x45')]=qs[_0xa8a9('0x46')](_0x2b7590[_0xa8a9('0x29')][_0xa8a9('0x46')]);_0x38b9c0[_0xa8a9('0x24')]=qs[_0xa8a9('0x2a')](_[_0xa8a9('0x47')](_0x2b7590[_0xa8a9('0x29')],_0x21ff9b['filters']));_0x38b9c0['where'][_0xa8a9('0x48')]=_0x2fba4a['id'];if(_0x2b7590[_0xa8a9('0x29')]['filter']){_0x38b9c0['where']=_[_0xa8a9('0x30')](_0x38b9c0['where'],{'$or':_[_0xa8a9('0x1f')](_0x38b9c0['attributes'],function(_0x35e5ff){var _0x26e7cc={};_0x26e7cc[_0x35e5ff]={'$like':'%'+_0x2b7590[_0xa8a9('0x29')][_0xa8a9('0x49')]+'%'};return _0x26e7cc;})});}_0x38b9c0=_[_0xa8a9('0x30')]({},_0x38b9c0,_0x2b7590['options']);return db[_0xa8a9('0x41')][_0xa8a9('0x26')](_0x38b9c0);}})[_0xa8a9('0x17')](function(_0x538a02){if(_0x538a02){return db['User'][_0xa8a9('0x4a')]({'where':{'id':_[_0xa8a9('0x1f')](_0x538a02,_0xa8a9('0x4b')),'role':'agent'},'attributes':['id',_0xa8a9('0x3a'),_0xa8a9('0x4c'),_0xa8a9('0x4d'),'createdAt']});}})[_0xa8a9('0x17')](function(_0x1f68a6){if(_0x1f68a6){return{'count':_0x1f68a6['count'],'rows':_[_0xa8a9('0x1f')](_0x1f68a6[_0xa8a9('0x4e')],function(_0x18d4f9){return{'membername':_0x18d4f9[_0xa8a9('0x3a')],'UserId':_0x18d4f9['id'],'queue_name':_0x5c48a7[_0xa8a9('0x3a')],'FaxQueueId':_0x5c48a7['id'],'interface':util[_0xa8a9('0x4f')](_0xa8a9('0x50'),_0xa8a9('0x51'),_0x18d4f9[_0xa8a9('0x3a')]),'penalty':0x0,'paused':_0x18d4f9[_0xa8a9('0x4c')],'createdAt':_0x18d4f9[_0xa8a9('0x52')],'updatedAt':_0x18d4f9[_0xa8a9('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa8a9('0x17')](respondWithFilteredResult(_0x350f90,_0x38b9c0))[_0xa8a9('0x27')](handleError(_0x350f90,null));};exports[_0xa8a9('0x53')]=function(_0x1fcbc5,_0x2294c9){var _0x43886a={};var _0x6376c={};var _0x4827d0;var _0x179d93;return db[_0xa8a9('0x20')]['findOne']({'where':{'id':_0x1fcbc5[_0xa8a9('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2294c9,null))[_0xa8a9('0x17')](function(_0x254134){if(_0x254134){_0x4827d0=_0x254134;_0x6376c[_0xa8a9('0x2c')]=_[_0xa8a9('0x28')](db[_0xa8a9('0x54')][_0xa8a9('0x21')]);_0x6376c[_0xa8a9('0x29')]=_[_0xa8a9('0x28')](_0x1fcbc5[_0xa8a9('0x29')]);_0x6376c['filters']=_[_0xa8a9('0x2b')](_0x6376c['model'],_0x6376c[_0xa8a9('0x29')]);_0x43886a['attributes']=_[_0xa8a9('0x2b')](_0x6376c[_0xa8a9('0x2c')],qs[_0xa8a9('0x42')](_0x1fcbc5[_0xa8a9('0x29')]['fields']));_0x43886a[_0xa8a9('0x2d')]=_0x43886a['attributes'][_0xa8a9('0x2e')]?_0x43886a[_0xa8a9('0x2d')]:_0x6376c[_0xa8a9('0x2c')];_0x43886a[_0xa8a9('0x45')]=qs['sort'](_0x1fcbc5[_0xa8a9('0x29')][_0xa8a9('0x46')]);_0x43886a['where']=qs[_0xa8a9('0x2a')](_['pick'](_0x1fcbc5[_0xa8a9('0x29')],_0x6376c[_0xa8a9('0x2a')]));if(_0x1fcbc5[_0xa8a9('0x29')][_0xa8a9('0x49')]){_0x43886a['where']=_[_0xa8a9('0x30')](_0x43886a[_0xa8a9('0x24')],{'$or':_[_0xa8a9('0x1f')](_0x43886a[_0xa8a9('0x2d')],function(_0x37acd4){var _0x3877a2={};_0x3877a2[_0x37acd4]={'$like':'%'+_0x1fcbc5[_0xa8a9('0x29')][_0xa8a9('0x49')]+'%'};return _0x3877a2;})});}_0x43886a=_[_0xa8a9('0x30')]({},_0x43886a,_0x1fcbc5[_0xa8a9('0x31')]);return _0x4827d0[_0xa8a9('0x53')](_0x43886a);}})[_0xa8a9('0x17')](function(_0x291927){if(_0x291927){_0x179d93=_0x291927['length'];if(!_0x1fcbc5[_0xa8a9('0x29')][_0xa8a9('0x43')]('nolimit')){_0x43886a[_0xa8a9('0x13')]=qs[_0xa8a9('0x13')](_0x1fcbc5[_0xa8a9('0x29')]['limit']);_0x43886a['offset']=qs['offset'](_0x1fcbc5[_0xa8a9('0x29')]['offset']);}return _0x4827d0[_0xa8a9('0x53')](_0x43886a);}})[_0xa8a9('0x17')](function(_0x3a7833){if(_0x3a7833){return _0x3a7833?{'count':_0x179d93,'rows':_0x3a7833}:null;}})[_0xa8a9('0x17')](respondWithResult(_0x2294c9,null))['catch'](handleError(_0x2294c9,null));};exports[_0xa8a9('0x55')]=function(_0x1263db,_0x1028bd){var _0x56625c=_0x1263db[_0xa8a9('0x33')][_0xa8a9('0x56')];return db[_0xa8a9('0x54')][_0xa8a9('0x26')]({'where':{'id':_0x56625c},'attributes':['id'],'include':[{'model':db[_0xa8a9('0x57')],'as':_0xa8a9('0x58'),'attributes':['id',_0xa8a9('0x3a'),_0xa8a9('0x59'),'voicePause',_0xa8a9('0x5a')],'raw':!![]}]})[_0xa8a9('0x17')](function(_0x3e129d){if(_0x3e129d){var _0x154724=_[_0xa8a9('0x5b')](_0x3e129d,function(_0x17fad9){var _0x3a1605=_0x17fad9[_0xa8a9('0x36')]({'plain':!![]});return _0x3a1605[_0xa8a9('0x58')];});return db[_0xa8a9('0x20')]['find']({'where':{'id':_0x1263db[_0xa8a9('0x3d')]['id']}})[_0xa8a9('0x17')](function(_0x10aab3){return db[_0xa8a9('0x5c')][_0xa8a9('0x5d')](function(_0x26c4fa){return _0x10aab3[_0xa8a9('0x55')](_0x56625c,{'transaction':_0x26c4fa})[_0xa8a9('0x17')](function(){return BPromise[_0xa8a9('0x5e')](_0x154724,function(_0xcff1c0){return db[_0xa8a9('0x41')][_0xa8a9('0x5f')]({'where':{'UserId':_0xcff1c0['id'],'FaxQueueId':_0x1263db[_0xa8a9('0x3d')]['id']},'transaction':_0x26c4fa});});})[_0xa8a9('0x17')](function(){_0x154724[_0xa8a9('0x60')](function(_0xc5ae56){socket[_0xa8a9('0x61')]('userFaxQueue:save',{'UserId':_0xc5ae56['id'],'FaxQueueId':_0x10aab3['id']});});});});});}})['then'](respondWithStatusCode(_0x1028bd,null))['catch'](handleError(_0x1028bd,null));};exports[_0xa8a9('0x62')]=function(_0xb83990,_0xb12d5e){return db['Team']['findAll']({'where':{'id':_0xb83990['query'][_0xa8a9('0x56')]},'attributes':['id'],'include':[{'model':db[_0xa8a9('0x57')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa8a9('0x17')](handleEntityNotFound(_0xb12d5e,null))[_0xa8a9('0x17')](function(_0x1a718f){var _0x13a754=_[_0xa8a9('0x1f')](_0x1a718f,'id');var _0x418107=[];var _0x30124e=[];var _0x537c4a=squel[_0xa8a9('0x63')]();_0x537c4a['field']('tq.TeamId')['from'](_0xa8a9('0x64'),'tq')[_0xa8a9('0x65')](_0xa8a9('0x66'),'ut',_0xa8a9('0x67'))[_0xa8a9('0x24')](_0xa8a9('0x68'),_0xb83990['params']['id']);for(var _0x23f9f1=0x0;_0x23f9f1<_0x1a718f['length'];_0x23f9f1+=0x1){let _0x1d8b12=_0x1a718f[_0x23f9f1];for(var _0x1baf56=0x0;_0x1baf56<_0x1d8b12[_0xa8a9('0x58')]['length'];_0x1baf56+=0x1){let _0x4cec72=_0x1d8b12['Agents'][_0x1baf56];var _0xcc9c62=_0x537c4a[_0xa8a9('0x69')]();_0xcc9c62[_0xa8a9('0x24')](_0xa8a9('0x6a'),_0x4cec72['id']);_0x30124e['push'](db[_0xa8a9('0x5c')]['query'](_0xcc9c62['toString'](),{'type':db['sequelize']['QueryTypes'][_0xa8a9('0x6b')]})[_0xa8a9('0x17')](function(_0x382303){if(_0x382303[_0xa8a9('0x2e')]===0x1){return _0x4cec72['id'];}else{var _0x341e64=_['every'](_[_0xa8a9('0x1f')](_0x382303,_0xa8a9('0x6c')),function(_0x4a201c){return _['includes'](_0x13a754,_0x4a201c);});if(_0x341e64){return _0x4cec72['id'];}}}));}}return BPromise[_0xa8a9('0x6d')](_0x30124e)[_0xa8a9('0x17')](function(_0x5f9c83){_0x418107=_(_0x418107)[_0xa8a9('0x6e')](_0x5f9c83)[_0xa8a9('0x6f')]()[_0xa8a9('0x70')]();return db[_0xa8a9('0x20')]['find']({'where':{'id':_0xb83990[_0xa8a9('0x3d')]['id']}})[_0xa8a9('0x17')](function(_0x476716){return db[_0xa8a9('0x5c')][_0xa8a9('0x5d')](function(_0x76cc6c){return _0x476716[_0xa8a9('0x62')](_0xb83990[_0xa8a9('0x29')][_0xa8a9('0x56')],{'transaction':_0x76cc6c})[_0xa8a9('0x17')](function(){if(!_[_0xa8a9('0x71')](_0x418107)){return _0x476716[_0xa8a9('0x72')](_0x418107,{'transaction':_0x76cc6c});}})['then'](function(){_0x418107[_0xa8a9('0x60')](function(_0x11eba3){socket[_0xa8a9('0x61')](_0xa8a9('0x73'),{'UserId':_0x11eba3,'FaxQueueId':_0x476716['id']});});});});});});})[_0xa8a9('0x17')](respondWithStatusCode(_0xb12d5e,null))[_0xa8a9('0x27')](handleError(_0xb12d5e,null));};exports[_0xa8a9('0x74')]=function(_0x4a3285,_0x13d629){return db['FaxQueue']['find']({'where':{'id':_0x4a3285[_0xa8a9('0x3d')]['id']}})[_0xa8a9('0x17')](handleEntityNotFound(_0x13d629,null))[_0xa8a9('0x17')](function(_0x46c79b){if(_0x46c79b){return _0x46c79b['addAgents'](_0x4a3285[_0xa8a9('0x33')][_0xa8a9('0x56')],_['omit'](_0x4a3285[_0xa8a9('0x33')],[_0xa8a9('0x56'),'id'])||{})[_0xa8a9('0x75')](function(_0x4b1738){for(var _0x523273=0x0;_0x523273<_0x4a3285[_0xa8a9('0x33')][_0xa8a9('0x56')][_0xa8a9('0x2e')];_0x523273+=0x1){socket[_0xa8a9('0x61')]('userFaxQueue:save',{'UserId':Number(_0x4a3285['body'][_0xa8a9('0x56')][_0x523273]),'FaxQueueId':Number(_0x4a3285['params']['id'])});}return _0x4b1738;});}})['then'](respondWithResult(_0x13d629,null))[_0xa8a9('0x27')](handleError(_0x13d629,null));};exports['removeAgents']=function(_0x275a82,_0x40395f){return db[_0xa8a9('0x20')][_0xa8a9('0x3c')]({'where':{'id':_0x275a82[_0xa8a9('0x3d')]['id']}})[_0xa8a9('0x17')](handleEntityNotFound(_0x40395f,null))[_0xa8a9('0x17')](function(_0x391e30){if(_0x391e30){return _0x391e30[_0xa8a9('0x72')](_0x275a82[_0xa8a9('0x29')]['ids'])[_0xa8a9('0x17')](function(){if(_[_0xa8a9('0x76')](_0x275a82[_0xa8a9('0x29')][_0xa8a9('0x56')])){for(var _0xa14e4d=0x0;_0xa14e4d<_0x275a82[_0xa8a9('0x29')][_0xa8a9('0x56')][_0xa8a9('0x2e')];_0xa14e4d+=0x1){socket[_0xa8a9('0x61')](_0xa8a9('0x73'),{'UserId':Number(_0x275a82[_0xa8a9('0x29')][_0xa8a9('0x56')][_0xa14e4d]),'FaxQueueId':Number(_0x275a82[_0xa8a9('0x3d')]['id'])});}}else{socket[_0xa8a9('0x61')](_0xa8a9('0x73'),{'UserId':Number(_0x275a82['query'][_0xa8a9('0x56')]),'FaxQueueId':Number(_0x275a82[_0xa8a9('0x3d')]['id'])});}});}})[_0xa8a9('0x17')](respondWithStatusCode(_0x40395f,null))['catch'](handleError(_0x40395f,null));};exports[_0xa8a9('0x77')]=function(_0x5ad422,_0x19f2a5){var _0x2b7b7f={};var _0x300141={};var _0x236f62;var _0x3e745b;return db[_0xa8a9('0x20')][_0xa8a9('0x40')]({'where':{'id':_0x5ad422[_0xa8a9('0x3d')]['id']}})[_0xa8a9('0x17')](handleEntityNotFound(_0x19f2a5,null))[_0xa8a9('0x17')](function(_0x5b4568){if(_0x5b4568){_0x236f62=_0x5b4568;_0x300141[_0xa8a9('0x2c')]=_[_0xa8a9('0x28')](db['User'][_0xa8a9('0x21')]);_0x300141[_0xa8a9('0x29')]=_[_0xa8a9('0x28')](_0x5ad422['query']);_0x300141['filters']=_[_0xa8a9('0x2b')](_0x300141['model'],_0x300141[_0xa8a9('0x29')]);_0x2b7b7f['attributes']=_['intersection'](_0x300141[_0xa8a9('0x2c')],qs[_0xa8a9('0x42')](_0x5ad422[_0xa8a9('0x29')]['fields']));_0x2b7b7f[_0xa8a9('0x2d')]=_0x2b7b7f[_0xa8a9('0x2d')][_0xa8a9('0x2e')]?_0x2b7b7f['attributes']:_0x300141[_0xa8a9('0x2c')];_0x2b7b7f[_0xa8a9('0x45')]=qs[_0xa8a9('0x46')](_0x5ad422[_0xa8a9('0x29')][_0xa8a9('0x46')]);_0x2b7b7f[_0xa8a9('0x24')]=qs[_0xa8a9('0x2a')](_['pick'](_0x5ad422[_0xa8a9('0x29')],_0x300141[_0xa8a9('0x2a')]));if(_0x5ad422['query'][_0xa8a9('0x49')]){_0x2b7b7f[_0xa8a9('0x24')]=_['merge'](_0x2b7b7f['where'],{'$or':_[_0xa8a9('0x1f')](_0x2b7b7f[_0xa8a9('0x2d')],function(_0x5ccc69){var _0x100769={};_0x100769[_0x5ccc69]={'$like':'%'+_0x5ad422['query']['filter']+'%'};return _0x100769;})});}_0x2b7b7f=_[_0xa8a9('0x30')]({},_0x2b7b7f,_0x5ad422[_0xa8a9('0x31')]);return _0x236f62['getAgents'](_0x2b7b7f);}})[_0xa8a9('0x17')](function(_0x42ce1b){if(_0x42ce1b){_0x3e745b=_0x42ce1b['length'];if(!_0x5ad422[_0xa8a9('0x29')][_0xa8a9('0x43')](_0xa8a9('0x44'))){_0x2b7b7f['limit']=qs[_0xa8a9('0x13')](_0x5ad422[_0xa8a9('0x29')][_0xa8a9('0x13')]);_0x2b7b7f[_0xa8a9('0x11')]=qs[_0xa8a9('0x11')](_0x5ad422[_0xa8a9('0x29')][_0xa8a9('0x11')]);}return _0x236f62[_0xa8a9('0x77')](_0x2b7b7f);}})['then'](function(_0x5eb93a){if(_0x5eb93a){return _0x5eb93a?{'count':_0x3e745b,'rows':_0x5eb93a}:null;}})['then'](respondWithResult(_0x19f2a5,null))['catch'](handleError(_0x19f2a5,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index f4599da..3844bcb 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 _0x8a8b=['hook','exports','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove'];(function(_0x15b148,_0x240ad4){var _0x220922=function(_0x1f0e4b){while(--_0x1f0e4b){_0x15b148['push'](_0x15b148['shift']());}};_0x220922(++_0x240ad4);}(_0x8a8b,0x182));var _0xb8a8=function(_0x479e59,_0x50296b){_0x479e59=_0x479e59-0x0;var _0x4eb9aa=_0x8a8b[_0x479e59];return _0x4eb9aa;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xb8a8('0x0'))['db'][_0xb8a8('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb8a8('0x2')](0x0);var events={'afterCreate':_0xb8a8('0x3'),'afterUpdate':_0xb8a8('0x4'),'afterDestroy':_0xb8a8('0x5')};function emitEvent(_0x1bf109){return function(_0x48efad,_0x1d8c82,_0x506b22){FaxQueueEvents['emit'](_0x1bf109+':'+_0x48efad['id'],_0x48efad);FaxQueueEvents['emit'](_0x1bf109,_0x48efad);_0x506b22(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xb8a8('0x6')](e,emitEvent(event));}}module[_0xb8a8('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xc7ec=['emit','hasOwnProperty','hook','exports','events','FaxQueue','save','update','remove'];(function(_0x2b5a92,_0x3f25d2){var _0x28544f=function(_0x228210){while(--_0x228210){_0x2b5a92['push'](_0x2b5a92['shift']());}};_0x28544f(++_0x3f25d2);}(_0xc7ec,0xf7));var _0xcc7e=function(_0x1630f1,_0x2eba83){_0x1630f1=_0x1630f1-0x0;var _0x1531e6=_0xc7ec[_0x1630f1];return _0x1531e6;};'use strict';var EventEmitter=require(_0xcc7e('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xcc7e('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcc7e('0x2'),'afterUpdate':_0xcc7e('0x3'),'afterDestroy':_0xcc7e('0x4')};function emitEvent(_0x121085){return function(_0x125a81,_0x405f18,_0x14e6c1){FaxQueueEvents[_0xcc7e('0x5')](_0x121085+':'+_0x125a81['id'],_0x125a81);FaxQueueEvents[_0xcc7e('0x5')](_0x121085,_0x125a81);_0x14e6c1(null);};}for(var e in events){if(events[_0xcc7e('0x6')](e)){var event=events[e];FaxQueue[_0xcc7e('0x7')](e,emitEvent(event));}}module[_0xcc7e('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index fc81257..f221f9a 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 _0x5b88=['./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0xa0cade,_0x5212e7){var _0x52d603=function(_0x231dc2){while(--_0x231dc2){_0xa0cade['push'](_0xa0cade['shift']());}};_0x52d603(++_0x5212e7);}(_0x5b88,0x1bf));var _0x85b8=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x5b88[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0x85b8('0x0'));var util=require(_0x85b8('0x1'));var logger=require(_0x85b8('0x2'))(_0x85b8('0x3'));var moment=require('moment');var BPromise=require(_0x85b8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x85b8('0x5'));var rimraf=require(_0x85b8('0x6'));var config=require(_0x85b8('0x7'));var attributes=require(_0x85b8('0x8'));module[_0x85b8('0x9')]=function(_0x337974,_0x3fc832){return _0x337974[_0x85b8('0xa')](_0x85b8('0xb'),attributes,{'tableName':_0x85b8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fdc=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./faxQueue.attributes','exports','define','fax_queues','lodash','util'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x0fdc,0x6a));var _0xc0fd=function(_0x458f6a,_0x36796f){_0x458f6a=_0x458f6a-0x0;var _0x1b9776=_0x0fdc[_0x458f6a];return _0x1b9776;};'use strict';var _=require(_0xc0fd('0x0'));var util=require(_0xc0fd('0x1'));var logger=require(_0xc0fd('0x2'))(_0xc0fd('0x3'));var moment=require(_0xc0fd('0x4'));var BPromise=require(_0xc0fd('0x5'));var rp=require(_0xc0fd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc0fd('0x7'));var config=require('../../config/environment');var attributes=require(_0xc0fd('0x8'));module[_0xc0fd('0x9')]=function(_0x2dbf11,_0x4cc315){return _0x2dbf11[_0xc0fd('0xa')]('FaxQueue',attributes,{'tableName':_0xc0fd('0xb'),'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 44f4e89..7400551 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 _0x1387=['ShowFaxQueue','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','FaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','GetFaxQueue','catch'];(function(_0x16aeea,_0x241043){var _0x181992=function(_0x335750){while(--_0x335750){_0x16aeea['push'](_0x16aeea['shift']());}};_0x181992(++_0x241043);}(_0x1387,0x7c));var _0x7138=function(_0x3312a7,_0xf96367){_0x3312a7=_0x3312a7-0x0;var _0x582744=_0x1387[_0x3312a7];return _0x582744;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7138('0x0'));var BPromise=require(_0x7138('0x1'));var rs=require(_0x7138('0x2'));var fs=require('fs');var Redis=require(_0x7138('0x3'));var db=require(_0x7138('0x4'))['db'];var utils=require(_0x7138('0x5'));var logger=require(_0x7138('0x6'))(_0x7138('0x7'));var config=require(_0x7138('0x8'));var jayson=require(_0x7138('0x9'));var client=jayson[_0x7138('0xa')][_0x7138('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x7138('0xc')],{'host':_0x7138('0xd'),'port':0x18eb});var socket=require(_0x7138('0xe'))(new Redis(config['redis']));require(_0x7138('0xf'))[_0x7138('0x10')](socket);function respondWithRpcPromise(_0x573628,_0x47f6e2,_0x57f5aa){return new BPromise(function(_0x48dc9a,_0x4162cb){return client['request'](_0x573628,_0x57f5aa)['then'](function(_0x1fb6b6){logger[_0x7138('0x11')](_0x7138('0x12'),_0x47f6e2,'request\x20sent');logger[_0x7138('0x13')](_0x7138('0x14'),_0x47f6e2,_0x7138('0x15'),JSON[_0x7138('0x16')](_0x1fb6b6));if(_0x1fb6b6[_0x7138('0x17')]){if(_0x1fb6b6[_0x7138('0x17')][_0x7138('0x18')]===0x1f4){logger[_0x7138('0x17')](_0x7138('0x12'),_0x47f6e2,_0x1fb6b6['error'][_0x7138('0x19')]);return _0x4162cb(_0x1fb6b6[_0x7138('0x17')][_0x7138('0x19')]);}logger[_0x7138('0x17')](_0x7138('0x12'),_0x47f6e2,_0x1fb6b6[_0x7138('0x17')][_0x7138('0x19')]);return _0x48dc9a(_0x1fb6b6[_0x7138('0x17')]['message']);}else{logger[_0x7138('0x11')](_0x7138('0x12'),_0x47f6e2,_0x7138('0x15'));_0x48dc9a(_0x1fb6b6[_0x7138('0x1a')][_0x7138('0x19')]);}})['catch'](function(_0x2db78f){logger[_0x7138('0x17')](_0x7138('0x12'),_0x47f6e2,_0x2db78f);_0x4162cb(_0x2db78f);});});}exports['GetFaxQueue']=function(_0x38b95b){var _0x416416=this;return new Promise(function(_0x6d7c89,_0x387c53){return db[_0x7138('0x1b')][_0x7138('0x1c')]({'raw':_0x38b95b[_0x7138('0x1d')]?_0x38b95b[_0x7138('0x1d')][_0x7138('0x1e')]===undefined?!![]:![]:!![],'where':_0x38b95b[_0x7138('0x1d')]?_0x38b95b[_0x7138('0x1d')][_0x7138('0x1f')]||null:null,'attributes':_0x38b95b[_0x7138('0x1d')]?_0x38b95b['options'][_0x7138('0x20')]||null:null,'limit':_0x38b95b['options']?_0x38b95b[_0x7138('0x1d')][_0x7138('0x21')]||null:null,'include':_0x38b95b[_0x7138('0x1d')]?_0x38b95b[_0x7138('0x1d')][_0x7138('0x22')]?_['map'](_0x38b95b[_0x7138('0x1d')]['include'],function(_0x56c33b){return{'model':db[_0x56c33b[_0x7138('0x23')]],'as':_0x56c33b['as'],'attributes':_0x56c33b[_0x7138('0x20')],'include':_0x56c33b[_0x7138('0x22')]?_[_0x7138('0x24')](_0x56c33b['include'],function(_0x2f08f7){return{'model':db[_0x2f08f7['model']],'as':_0x2f08f7['as'],'attributes':_0x2f08f7['attributes'],'include':_0x2f08f7[_0x7138('0x22')]?_['map'](_0x2f08f7[_0x7138('0x22')],function(_0x328e18){return{'model':db[_0x328e18[_0x7138('0x23')]],'as':_0x328e18['as'],'attributes':_0x328e18['attributes']};}):[]};}):[]};}):[]:[]})[_0x7138('0x25')](function(_0x249b06){logger[_0x7138('0x11')](_0x7138('0x26'),_0x38b95b);logger[_0x7138('0x13')](_0x7138('0x26'),_0x38b95b,JSON['stringify'](_0x249b06));_0x6d7c89(_0x249b06);})[_0x7138('0x27')](function(_0x26b3d8){logger[_0x7138('0x17')](_0x7138('0x26'),_0x26b3d8[_0x7138('0x19')],_0x38b95b);_0x387c53(_0x416416['error'](0x1f4,_0x26b3d8['message']));});});};exports[_0x7138('0x28')]=function(_0x1063ff){var _0x4c70ee=this;return new Promise(function(_0x39ec95,_0x2877ed){return db[_0x7138('0x1b')]['find']({'raw':_0x1063ff['options']?_0x1063ff[_0x7138('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1063ff[_0x7138('0x1d')]?_0x1063ff[_0x7138('0x1d')]['where']||null:null,'attributes':_0x1063ff['options']?_0x1063ff[_0x7138('0x1d')][_0x7138('0x20')]||null:null,'include':_0x1063ff['options']?_0x1063ff[_0x7138('0x1d')][_0x7138('0x22')]?_[_0x7138('0x24')](_0x1063ff[_0x7138('0x1d')][_0x7138('0x22')],function(_0x554b2d){return{'model':db[_0x554b2d[_0x7138('0x23')]],'as':_0x554b2d['as'],'attributes':_0x554b2d['attributes'],'include':_0x554b2d[_0x7138('0x22')]?_['map'](_0x554b2d[_0x7138('0x22')],function(_0x3ef92f){return{'model':db[_0x3ef92f[_0x7138('0x23')]],'as':_0x3ef92f['as'],'attributes':_0x3ef92f['attributes'],'include':_0x3ef92f[_0x7138('0x22')]?_[_0x7138('0x24')](_0x3ef92f[_0x7138('0x22')],function(_0x247565){return{'model':db[_0x247565[_0x7138('0x23')]],'as':_0x247565['as'],'attributes':_0x247565[_0x7138('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7138('0x25')](function(_0x3a2137){logger[_0x7138('0x11')](_0x7138('0x28'),_0x1063ff);logger[_0x7138('0x13')](_0x7138('0x28'),_0x1063ff,JSON[_0x7138('0x16')](_0x3a2137));_0x39ec95(_0x3a2137);})[_0x7138('0x27')](function(_0x375a69){logger[_0x7138('0x17')](_0x7138('0x28'),_0x375a69[_0x7138('0x19')],_0x1063ff);_0x2877ed(_0x4c70ee[_0x7138('0x17')](0x1f4,_0x375a69['message']));});});}; \ No newline at end of file +var _0x7017=['limit','map','include','model','attributes','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','request','then','info','request\x20sent','debug','stringify','code','error','message','FaxQueue,\x20%s,\x20%s','result','catch','GetFaxQueue','FaxQueue','options','raw','where'];(function(_0x6bd30c,_0xebc878){var _0x2a7aeb=function(_0x54e1e1){while(--_0x54e1e1){_0x6bd30c['push'](_0x6bd30c['shift']());}};_0x2a7aeb(++_0xebc878);}(_0x7017,0xc4));var _0x7701=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x7017[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x7701('0x0'));var util=require(_0x7701('0x1'));var moment=require(_0x7701('0x2'));var BPromise=require(_0x7701('0x3'));var rs=require(_0x7701('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7701('0x5'))['db'];var utils=require(_0x7701('0x6'));var logger=require(_0x7701('0x7'))(_0x7701('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7701('0x9')]({'port':0x232a});config[_0x7701('0xa')]=_[_0x7701('0xb')](config['redis'],{'host':_0x7701('0xc'),'port':0x18eb});var socket=require(_0x7701('0xd'))(new Redis(config[_0x7701('0xa')]));require(_0x7701('0xe'))['register'](socket);function respondWithRpcPromise(_0x53987f,_0x49aa0f,_0x2b3d17){return new BPromise(function(_0x18360b,_0x4f79e4){return client[_0x7701('0xf')](_0x53987f,_0x2b3d17)[_0x7701('0x10')](function(_0x567cfd){logger[_0x7701('0x11')]('FaxQueue,\x20%s,\x20%s',_0x49aa0f,_0x7701('0x12'));logger[_0x7701('0x13')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x49aa0f,'request\x20sent',JSON[_0x7701('0x14')](_0x567cfd));if(_0x567cfd['error']){if(_0x567cfd['error'][_0x7701('0x15')]===0x1f4){logger[_0x7701('0x16')]('FaxQueue,\x20%s,\x20%s',_0x49aa0f,_0x567cfd[_0x7701('0x16')][_0x7701('0x17')]);return _0x4f79e4(_0x567cfd[_0x7701('0x16')][_0x7701('0x17')]);}logger[_0x7701('0x16')]('FaxQueue,\x20%s,\x20%s',_0x49aa0f,_0x567cfd[_0x7701('0x16')]['message']);return _0x18360b(_0x567cfd['error']['message']);}else{logger['info'](_0x7701('0x18'),_0x49aa0f,_0x7701('0x12'));_0x18360b(_0x567cfd[_0x7701('0x19')][_0x7701('0x17')]);}})[_0x7701('0x1a')](function(_0x163601){logger[_0x7701('0x16')](_0x7701('0x18'),_0x49aa0f,_0x163601);_0x4f79e4(_0x163601);});});}exports[_0x7701('0x1b')]=function(_0x150fba){var _0x2559dc=this;return new Promise(function(_0x2f48c,_0x17deb6){return db[_0x7701('0x1c')]['findAll']({'raw':_0x150fba[_0x7701('0x1d')]?_0x150fba[_0x7701('0x1d')][_0x7701('0x1e')]===undefined?!![]:![]:!![],'where':_0x150fba[_0x7701('0x1d')]?_0x150fba['options'][_0x7701('0x1f')]||null:null,'attributes':_0x150fba['options']?_0x150fba[_0x7701('0x1d')]['attributes']||null:null,'limit':_0x150fba[_0x7701('0x1d')]?_0x150fba[_0x7701('0x1d')][_0x7701('0x20')]||null:null,'include':_0x150fba['options']?_0x150fba[_0x7701('0x1d')]['include']?_[_0x7701('0x21')](_0x150fba['options'][_0x7701('0x22')],function(_0x1f77f4){return{'model':db[_0x1f77f4[_0x7701('0x23')]],'as':_0x1f77f4['as'],'attributes':_0x1f77f4[_0x7701('0x24')],'include':_0x1f77f4['include']?_[_0x7701('0x21')](_0x1f77f4[_0x7701('0x22')],function(_0x21d127){return{'model':db[_0x21d127[_0x7701('0x23')]],'as':_0x21d127['as'],'attributes':_0x21d127[_0x7701('0x24')],'include':_0x21d127[_0x7701('0x22')]?_[_0x7701('0x21')](_0x21d127['include'],function(_0x1ea7fa){return{'model':db[_0x1ea7fa[_0x7701('0x23')]],'as':_0x1ea7fa['as'],'attributes':_0x1ea7fa[_0x7701('0x24')]};}):[]};}):[]};}):[]:[]})[_0x7701('0x10')](function(_0x2b67c8){logger['info'](_0x7701('0x1b'),_0x150fba);logger[_0x7701('0x13')]('GetFaxQueue',_0x150fba,JSON[_0x7701('0x14')](_0x2b67c8));_0x2f48c(_0x2b67c8);})[_0x7701('0x1a')](function(_0x58534a){logger[_0x7701('0x16')](_0x7701('0x1b'),_0x58534a['message'],_0x150fba);_0x17deb6(_0x2559dc['error'](0x1f4,_0x58534a[_0x7701('0x17')]));});});};exports[_0x7701('0x25')]=function(_0x5642c5){var _0x37ee38=this;return new Promise(function(_0x153ee9,_0x493efd){return db['FaxQueue']['find']({'raw':_0x5642c5[_0x7701('0x1d')]?_0x5642c5[_0x7701('0x1d')][_0x7701('0x1e')]===undefined?!![]:![]:!![],'where':_0x5642c5[_0x7701('0x1d')]?_0x5642c5['options'][_0x7701('0x1f')]||null:null,'attributes':_0x5642c5['options']?_0x5642c5['options'][_0x7701('0x24')]||null:null,'include':_0x5642c5[_0x7701('0x1d')]?_0x5642c5[_0x7701('0x1d')][_0x7701('0x22')]?_['map'](_0x5642c5[_0x7701('0x1d')][_0x7701('0x22')],function(_0x4cc967){return{'model':db[_0x4cc967[_0x7701('0x23')]],'as':_0x4cc967['as'],'attributes':_0x4cc967[_0x7701('0x24')],'include':_0x4cc967[_0x7701('0x22')]?_[_0x7701('0x21')](_0x4cc967[_0x7701('0x22')],function(_0x205c75){return{'model':db[_0x205c75['model']],'as':_0x205c75['as'],'attributes':_0x205c75[_0x7701('0x24')],'include':_0x205c75[_0x7701('0x22')]?_[_0x7701('0x21')](_0x205c75[_0x7701('0x22')],function(_0x54c7e2){return{'model':db[_0x54c7e2['model']],'as':_0x54c7e2['as'],'attributes':_0x54c7e2[_0x7701('0x24')]};}):[]};}):[]};}):[]:[]})[_0x7701('0x10')](function(_0x144872){logger['info']('ShowFaxQueue',_0x5642c5);logger[_0x7701('0x13')](_0x7701('0x25'),_0x5642c5,JSON['stringify'](_0x144872));_0x153ee9(_0x144872);})[_0x7701('0x1a')](function(_0x271237){logger[_0x7701('0x16')](_0x7701('0x25'),_0x271237[_0x7701('0x17')],_0x5642c5);_0x493efd(_0x37ee38[_0x7701('0x16')](0x1f4,_0x271237['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 00f1c21..2d14c77 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 _0x5781=['faxQueue:','./faxQueue.events','remove','update','emit','removeListener','register','length'];(function(_0x2834da,_0x348b33){var _0x5be499=function(_0x5a5a0d){while(--_0x5a5a0d){_0x2834da['push'](_0x2834da['shift']());}};_0x5be499(++_0x348b33);}(_0x5781,0x179));var _0x1578=function(_0x5f15f7,_0x299299){_0x5f15f7=_0x5f15f7-0x0;var _0x3000f5=_0x5781[_0x5f15f7];return _0x3000f5;};'use strict';var FaxQueueEvents=require(_0x1578('0x0'));var events=['save',_0x1578('0x1'),_0x1578('0x2')];function createListener(_0x5816b4,_0x2dfbfd){return function(_0x1e8971){_0x2dfbfd[_0x1578('0x3')](_0x5816b4,_0x1e8971);};}function removeListener(_0x649e2c,_0x462d00){return function(){FaxQueueEvents[_0x1578('0x4')](_0x649e2c,_0x462d00);};}exports[_0x1578('0x5')]=function(_0x16f0e7){for(var _0x539594=0x0,_0x5acf0e=events[_0x1578('0x6')];_0x539594<_0x5acf0e;_0x539594++){var _0x3b5274=events[_0x539594];var _0x33ff93=createListener(_0x1578('0x7')+_0x3b5274,_0x16f0e7);FaxQueueEvents['on'](_0x3b5274,_0x33ff93);}}; \ No newline at end of file +var _0x09f4=['faxQueue:','save','remove','emit','removeListener','register','length'];(function(_0x25ccbe,_0xc935c0){var _0x289529=function(_0x478776){while(--_0x478776){_0x25ccbe['push'](_0x25ccbe['shift']());}};_0x289529(++_0xc935c0);}(_0x09f4,0x1a5));var _0x409f=function(_0x74952f,_0x55e75d){_0x74952f=_0x74952f-0x0;var _0x51710c=_0x09f4[_0x74952f];return _0x51710c;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x409f('0x0'),_0x409f('0x1'),'update'];function createListener(_0x188057,_0x21e534){return function(_0x55498f){_0x21e534[_0x409f('0x2')](_0x188057,_0x55498f);};}function removeListener(_0x1e52b5,_0x49d0df){return function(){FaxQueueEvents[_0x409f('0x3')](_0x1e52b5,_0x49d0df);};}exports[_0x409f('0x4')]=function(_0x96907f){for(var _0x44d4d1=0x0,_0x41f10a=events[_0x409f('0x5')];_0x44d4d1<_0x41f10a;_0x44d4d1++){var _0x210f96=events[_0x44d4d1];var _0x276232=createListener(_0x409f('0x6')+_0x210f96,_0x96907f);FaxQueueEvents['on'](_0x210f96,_0x276232);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 2d5c451..0b67818 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 _0x2542=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addAgents','put','update','destroy','delete','removeAgents'];(function(_0x460c2e,_0x4ca96d){var _0x72574d=function(_0x576821){while(--_0x576821){_0x460c2e['push'](_0x460c2e['shift']());}};_0x72574d(++_0x4ca96d);}(_0x2542,0x169));var _0x2254=function(_0x15da13,_0x3cf21d){_0x15da13=_0x15da13-0x0;var _0x598283=_0x2542[_0x15da13];return _0x598283;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x9')](_0x2254('0x10'),auth['isAuthenticated'](),controller[_0x2254('0x11')]);router[_0x2254('0x9')](_0x2254('0x12'),auth[_0x2254('0xc')](),controller['getTeams']);router['get'](_0x2254('0x13'),auth[_0x2254('0xc')](),controller[_0x2254('0x14')]);router[_0x2254('0x15')]('/',auth[_0x2254('0xc')](),controller[_0x2254('0x16')]);router['post'](_0x2254('0x12'),auth[_0x2254('0xc')](),controller['addTeams']);router[_0x2254('0x15')](_0x2254('0x13'),auth[_0x2254('0xc')](),controller[_0x2254('0x17')]);router[_0x2254('0x18')](_0x2254('0xe'),auth['isAuthenticated'](),controller[_0x2254('0x19')]);router['delete'](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0x1a')]);router[_0x2254('0x1b')](_0x2254('0x12'),auth[_0x2254('0xc')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x2254('0xc')](),controller[_0x2254('0x1c')]);module[_0x2254('0x1d')]=router; \ No newline at end of file +var _0xd481=['create','addTeams','put','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xd481,0x1e4));var _0x1d48=function(_0x418782,_0x4952ec){_0x418782=_0x418782-0x0;var _0x1019e1=_0xd481[_0x418782];return _0x1019e1;};'use strict';var multer=require(_0x1d48('0x0'));var util=require('util');var path=require(_0x1d48('0x1'));var timeout=require(_0x1d48('0x2'));var express=require('express');var router=express[_0x1d48('0x3')]();var fs_extra=require(_0x1d48('0x4'));var auth=require(_0x1d48('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1d48('0x6'));var controller=require('./faxQueue.controller');router[_0x1d48('0x7')]('/',auth[_0x1d48('0x8')](),controller['index']);router[_0x1d48('0x7')](_0x1d48('0x9'),auth[_0x1d48('0x8')](),controller[_0x1d48('0xa')]);router[_0x1d48('0x7')](_0x1d48('0xb'),auth[_0x1d48('0x8')](),controller[_0x1d48('0xc')]);router[_0x1d48('0x7')](_0x1d48('0xd'),auth[_0x1d48('0x8')](),controller[_0x1d48('0xe')]);router['get'](_0x1d48('0xf'),auth[_0x1d48('0x8')](),controller[_0x1d48('0x10')]);router[_0x1d48('0x7')](_0x1d48('0x11'),auth[_0x1d48('0x8')](),controller[_0x1d48('0x12')]);router[_0x1d48('0x13')]('/',auth[_0x1d48('0x8')](),controller[_0x1d48('0x14')]);router['post'](_0x1d48('0xf'),auth['isAuthenticated'](),controller[_0x1d48('0x15')]);router[_0x1d48('0x13')](_0x1d48('0x11'),auth[_0x1d48('0x8')](),controller['addAgents']);router[_0x1d48('0x16')](_0x1d48('0xb'),auth[_0x1d48('0x8')](),controller['update']);router[_0x1d48('0x17')](_0x1d48('0xb'),auth[_0x1d48('0x8')](),controller[_0x1d48('0x18')]);router[_0x1d48('0x17')](_0x1d48('0xf'),auth[_0x1d48('0x8')](),controller[_0x1d48('0x19')]);router[_0x1d48('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0x1d48('0x1a')]);module[_0x1d48('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index ccd4ce1..4d9785a 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 _0xd65c=['STRING','DATE','moment','sequelize','exports'];(function(_0x484f98,_0x1f6f4a){var _0x4a87cf=function(_0x178a2f){while(--_0x178a2f){_0x484f98['push'](_0x484f98['shift']());}};_0x4a87cf(++_0x1f6f4a);}(_0xd65c,0x6b));var _0xcd65=function(_0x489e2d,_0x359305){_0x489e2d=_0x489e2d-0x0;var _0x113094=_0xd65c[_0x489e2d];return _0x113094;};'use strict';var moment=require(_0xcd65('0x0'));var Sequelize=require(_0xcd65('0x1'));module[_0xcd65('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xcd65('0x3')]},'joinAt':{'type':Sequelize[_0xcd65('0x4')]},'leaveAt':{'type':Sequelize[_0xcd65('0x4')]},'acceptAt':{'type':Sequelize[_0xcd65('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xcd65('0x3')]}}; \ No newline at end of file +var _0x55b5=['sequelize','exports','STRING','DATE','moment'];(function(_0x48c620,_0x368f60){var _0x45ea31=function(_0x2e0266){while(--_0x2e0266){_0x48c620['push'](_0x48c620['shift']());}};_0x45ea31(++_0x368f60);}(_0x55b5,0x18a));var _0x555b=function(_0x47159d,_0x5ba1c1){_0x47159d=_0x47159d-0x0;var _0x1ec89e=_0x55b5[_0x47159d];return _0x1ec89e;};'use strict';var moment=require(_0x555b('0x0'));var Sequelize=require(_0x555b('0x1'));module[_0x555b('0x2')]={'uniqueid':{'type':Sequelize[_0x555b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x555b('0x3')]},'joinAt':{'type':Sequelize[_0x555b('0x4')]},'leaveAt':{'type':Sequelize[_0x555b('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x555b('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 99bf91a..4d6b20f 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 _0x6a24=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','find','catch','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','papaparse','../../components/auth/service'];(function(_0xf27248,_0x1f328d){var _0x4217da=function(_0x20046e){while(--_0x20046e){_0xf27248['push'](_0xf27248['shift']());}};_0x4217da(++_0x1f328d);}(_0x6a24,0xd1));var _0x46a2=function(_0x22cc92,_0x428489){_0x22cc92=_0x22cc92-0x0;var _0x3ec769=_0x6a24[_0x22cc92];return _0x3ec769;};'use strict';var emlformat=require(_0x46a2('0x0'));var rimraf=require(_0x46a2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46a2('0x2'));var rp=require(_0x46a2('0x3'));var moment=require(_0x46a2('0x4'));var BPromise=require(_0x46a2('0x5'));var Mustache=require(_0x46a2('0x6'));var util=require('util');var path=require(_0x46a2('0x7'));var sox=require(_0x46a2('0x8'));var csv=require('to-csv');var ejs=require(_0x46a2('0x9'));var fs=require('fs');var fs_extra=require(_0x46a2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x46a2('0xb'));var jsforce=require(_0x46a2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x46a2('0xd'));var querystring=require('querystring');var Papa=require(_0x46a2('0xe'));var Redis=require('ioredis');var authService=require(_0x46a2('0xf'));var qs=require(_0x46a2('0x10'));var as=require(_0x46a2('0x11'));var hardwareService=require(_0x46a2('0x12'));var logger=require(_0x46a2('0x13'))(_0x46a2('0x14'));var utils=require(_0x46a2('0x15'));var config=require(_0x46a2('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x403282,_0x18e584){_0x18e584=_0x18e584||0xcc;return function(_0x5c5d10){if(_0x5c5d10){return _0x403282[_0x46a2('0x17')](_0x18e584);}return _0x403282[_0x46a2('0x18')](_0x18e584)[_0x46a2('0x19')]();};}function respondWithResult(_0x18a038,_0xddc328){_0xddc328=_0xddc328||0xc8;return function(_0x2fd383){if(_0x2fd383){return _0x18a038[_0x46a2('0x18')](_0xddc328)[_0x46a2('0x1a')](_0x2fd383);}};}function respondWithFilteredResult(_0x577591,_0x4a7e7a){return function(_0x3c81e8){if(_0x3c81e8){var _0x2deb20=typeof _0x4a7e7a['offset']===_0x46a2('0x1b')&&typeof _0x4a7e7a[_0x46a2('0x1c')]==='undefined';var _0xa2eb96=_0x3c81e8[_0x46a2('0x1d')];var _0x577f18=_0x2deb20?0x0:_0x4a7e7a[_0x46a2('0x1e')];var _0x24f75f=_0x2deb20?_0x3c81e8['count']:_0x4a7e7a[_0x46a2('0x1e')]+_0x4a7e7a[_0x46a2('0x1c')];var _0x5144c7;if(_0x24f75f>=_0xa2eb96){_0x24f75f=_0xa2eb96;_0x5144c7=0xc8;}else{_0x5144c7=0xce;}_0x577591[_0x46a2('0x18')](_0x5144c7);return _0x577591[_0x46a2('0x1f')](_0x46a2('0x20'),_0x577f18+'-'+_0x24f75f+'/'+_0xa2eb96)[_0x46a2('0x1a')](_0x3c81e8);}return null;};}function patchUpdates(_0x202294){return function(_0x2d65c2){try{jsonpatch[_0x46a2('0x21')](_0x2d65c2,_0x202294,!![]);}catch(_0x473cfb){return BPromise[_0x46a2('0x22')](_0x473cfb);}return _0x2d65c2[_0x46a2('0x23')]();};}function saveUpdates(_0x5c7586,_0xa37d90){return function(_0x504b9e){if(_0x504b9e){return _0x504b9e[_0x46a2('0x24')](_0x5c7586)[_0x46a2('0x25')](function(_0x511ff6){return _0x511ff6;});}return null;};}function removeEntity(_0x43dc69,_0x15e5bb){return function(_0x233c4e){if(_0x233c4e){return _0x233c4e[_0x46a2('0x26')]()['then'](function(){_0x43dc69[_0x46a2('0x18')](0xcc)[_0x46a2('0x19')]();});}};}function handleEntityNotFound(_0x1e48f5,_0x297158){return function(_0x74bb6a){if(!_0x74bb6a){_0x1e48f5[_0x46a2('0x17')](0x194);}return _0x74bb6a;};}function handleError(_0x3e9554,_0xfa9e13){_0xfa9e13=_0xfa9e13||0x1f4;return function(_0x218f1c){logger[_0x46a2('0x27')](_0x218f1c[_0x46a2('0x28')]);if(_0x218f1c['name']){delete _0x218f1c[_0x46a2('0x29')];}_0x3e9554[_0x46a2('0x18')](_0xfa9e13)[_0x46a2('0x2a')](_0x218f1c);};}exports[_0x46a2('0x2b')]=function(_0x435155,_0x33f42a){var _0x577fd2={},_0x185647={},_0x26856f={'count':0x0,'rows':[]};var _0x2166eb=_[_0x46a2('0x2c')](db[_0x46a2('0x2d')][_0x46a2('0x2e')],function(_0x4024be){return{'name':_0x4024be['fieldName'],'type':_0x4024be[_0x46a2('0x2f')][_0x46a2('0x30')]};});_0x185647[_0x46a2('0x31')]=_[_0x46a2('0x2c')](_0x2166eb,_0x46a2('0x29'));_0x185647[_0x46a2('0x32')]=_[_0x46a2('0x33')](_0x435155[_0x46a2('0x32')]);_0x185647[_0x46a2('0x34')]=_['intersection'](_0x185647[_0x46a2('0x31')],_0x185647[_0x46a2('0x32')]);_0x577fd2[_0x46a2('0x35')]=_[_0x46a2('0x36')](_0x185647[_0x46a2('0x31')],qs['fields'](_0x435155['query'][_0x46a2('0x37')]));_0x577fd2[_0x46a2('0x35')]=_0x577fd2[_0x46a2('0x35')][_0x46a2('0x38')]?_0x577fd2[_0x46a2('0x35')]:_0x185647[_0x46a2('0x31')];if(!_0x435155['query']['hasOwnProperty'](_0x46a2('0x39'))){_0x577fd2['limit']=qs[_0x46a2('0x1c')](_0x435155[_0x46a2('0x32')][_0x46a2('0x1c')]);_0x577fd2[_0x46a2('0x1e')]=qs['offset'](_0x435155[_0x46a2('0x32')][_0x46a2('0x1e')]);}_0x577fd2[_0x46a2('0x3a')]=qs[_0x46a2('0x3b')](_0x435155['query'][_0x46a2('0x3b')]);_0x577fd2[_0x46a2('0x3c')]=qs[_0x46a2('0x34')](_[_0x46a2('0x3d')](_0x435155['query'],_0x185647[_0x46a2('0x34')]),_0x2166eb);if(_0x435155['query'][_0x46a2('0x3e')]){_0x577fd2['where']=_[_0x46a2('0x3f')](_0x577fd2[_0x46a2('0x3c')],{'$or':_['map'](_0x2166eb,function(_0x316b3d){if(_0x316b3d['type']!=='VIRTUAL'){var _0x25aa1d={};_0x25aa1d[_0x316b3d[_0x46a2('0x29')]]={'$like':'%'+_0x435155[_0x46a2('0x32')][_0x46a2('0x3e')]+'%'};return _0x25aa1d;}})});}_0x577fd2=_[_0x46a2('0x3f')]({},_0x577fd2,_0x435155[_0x46a2('0x40')]);var _0x482ed8={'where':_0x577fd2[_0x46a2('0x3c')]};return db[_0x46a2('0x2d')][_0x46a2('0x1d')](_0x482ed8)[_0x46a2('0x25')](function(_0x23cfc9){_0x26856f[_0x46a2('0x1d')]=_0x23cfc9;if(_0x435155[_0x46a2('0x32')][_0x46a2('0x41')]){_0x577fd2[_0x46a2('0x42')]=[{'all':!![]}];}return db[_0x46a2('0x2d')]['findAll'](_0x577fd2);})[_0x46a2('0x25')](function(_0x15ec39){_0x26856f[_0x46a2('0x43')]=_0x15ec39;return _0x26856f;})[_0x46a2('0x25')](respondWithFilteredResult(_0x33f42a,_0x577fd2))['catch'](handleError(_0x33f42a,null));};exports[_0x46a2('0x44')]=function(_0x18845e,_0x153305){var _0x3869d4={'raw':!![],'where':{'id':_0x18845e['params']['id']}},_0x1fcc03={};_0x1fcc03[_0x46a2('0x31')]=_['keys'](db[_0x46a2('0x2d')][_0x46a2('0x2e')]);_0x1fcc03['query']=_[_0x46a2('0x33')](_0x18845e[_0x46a2('0x32')]);_0x1fcc03[_0x46a2('0x34')]=_[_0x46a2('0x36')](_0x1fcc03[_0x46a2('0x31')],_0x1fcc03[_0x46a2('0x32')]);_0x3869d4[_0x46a2('0x35')]=_[_0x46a2('0x36')](_0x1fcc03[_0x46a2('0x31')],qs[_0x46a2('0x37')](_0x18845e['query'][_0x46a2('0x37')]));_0x3869d4[_0x46a2('0x35')]=_0x3869d4[_0x46a2('0x35')][_0x46a2('0x38')]?_0x3869d4[_0x46a2('0x35')]:_0x1fcc03['model'];if(_0x18845e[_0x46a2('0x32')][_0x46a2('0x41')]){_0x3869d4[_0x46a2('0x42')]=[{'all':!![]}];}_0x3869d4=_[_0x46a2('0x3f')]({},_0x3869d4,_0x18845e[_0x46a2('0x40')]);return db['FaxQueueReport'][_0x46a2('0x45')](_0x3869d4)['then'](handleEntityNotFound(_0x153305,null))[_0x46a2('0x25')](respondWithResult(_0x153305,null))[_0x46a2('0x46')](handleError(_0x153305,null));};exports['create']=function(_0x41b4cd,_0x3f8673){return db[_0x46a2('0x2d')][_0x46a2('0x47')](_0x41b4cd[_0x46a2('0x48')],{})[_0x46a2('0x25')](respondWithResult(_0x3f8673,0xc9))[_0x46a2('0x46')](handleError(_0x3f8673,null));};exports['update']=function(_0x369015,_0x1f8640){if(_0x369015[_0x46a2('0x48')]['id']){delete _0x369015[_0x46a2('0x48')]['id'];}return db['FaxQueueReport'][_0x46a2('0x45')]({'where':{'id':_0x369015['params']['id']}})[_0x46a2('0x25')](handleEntityNotFound(_0x1f8640,null))[_0x46a2('0x25')](saveUpdates(_0x369015['body'],null))[_0x46a2('0x25')](respondWithResult(_0x1f8640,null))['catch'](handleError(_0x1f8640,null));};exports[_0x46a2('0x26')]=function(_0x76ccd3,_0x3be2a7){return db[_0x46a2('0x2d')][_0x46a2('0x45')]({'where':{'id':_0x76ccd3[_0x46a2('0x49')]['id']}})['then'](handleEntityNotFound(_0x3be2a7,null))['then'](removeEntity(_0x3be2a7,null))[_0x46a2('0x46')](handleError(_0x3be2a7,null));};exports[_0x46a2('0x4a')]=function(_0x334d0e,_0x545305){return db[_0x46a2('0x2d')][_0x46a2('0x4a')]()[_0x46a2('0x25')](respondWithResult(_0x545305,null))['catch'](handleError(_0x545305,null));}; \ No newline at end of file +var _0x3e5c=['options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','map','VIRTUAL','filter','FaxQueueReport','includeAll','findAll','rows','params','include','merge'];(function(_0x14bf8b,_0x186798){var _0x571eee=function(_0xf53e1f){while(--_0xf53e1f){_0x14bf8b['push'](_0x14bf8b['shift']());}};_0x571eee(++_0x186798);}(_0x3e5c,0x9a));var _0xc3e5=function(_0x2516c6,_0x23f870){_0x2516c6=_0x2516c6-0x0;var _0x354c36=_0x3e5c[_0x2516c6];return _0x354c36;};'use strict';var emlformat=require(_0xc3e5('0x0'));var rimraf=require(_0xc3e5('0x1'));var zipdir=require(_0xc3e5('0x2'));var jsonpatch=require(_0xc3e5('0x3'));var rp=require('request-promise');var moment=require(_0xc3e5('0x4'));var BPromise=require(_0xc3e5('0x5'));var Mustache=require(_0xc3e5('0x6'));var util=require(_0xc3e5('0x7'));var path=require(_0xc3e5('0x8'));var sox=require(_0xc3e5('0x9'));var csv=require('to-csv');var ejs=require(_0xc3e5('0xa'));var fs=require('fs');var fs_extra=require(_0xc3e5('0xb'));var _=require(_0xc3e5('0xc'));var squel=require(_0xc3e5('0xd'));var crypto=require(_0xc3e5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc3e5('0xf'));var toCsv=require(_0xc3e5('0x10'));var querystring=require(_0xc3e5('0x11'));var Papa=require(_0xc3e5('0x12'));var Redis=require(_0xc3e5('0x13'));var authService=require(_0xc3e5('0x14'));var qs=require(_0xc3e5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3e5('0x16'));var logger=require(_0xc3e5('0x17'))(_0xc3e5('0x18'));var utils=require(_0xc3e5('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc3e5('0x1a'));var db=require(_0xc3e5('0x1b'))['db'];function respondWithStatusCode(_0x36193e,_0x3f0395){_0x3f0395=_0x3f0395||0xcc;return function(_0x3b7441){if(_0x3b7441){return _0x36193e[_0xc3e5('0x1c')](_0x3f0395);}return _0x36193e['status'](_0x3f0395)['end']();};}function respondWithResult(_0x52cca7,_0x27c226){_0x27c226=_0x27c226||0xc8;return function(_0x5a52f1){if(_0x5a52f1){return _0x52cca7[_0xc3e5('0x1d')](_0x27c226)[_0xc3e5('0x1e')](_0x5a52f1);}};}function respondWithFilteredResult(_0x4d1ad9,_0x353dc0){return function(_0x3e3eaa){if(_0x3e3eaa){var _0x2cc476=typeof _0x353dc0[_0xc3e5('0x1f')]===_0xc3e5('0x20')&&typeof _0x353dc0['limit']===_0xc3e5('0x20');var _0x277063=_0x3e3eaa[_0xc3e5('0x21')];var _0xa33d84=_0x2cc476?0x0:_0x353dc0[_0xc3e5('0x1f')];var _0x1e1eea=_0x2cc476?_0x3e3eaa['count']:_0x353dc0[_0xc3e5('0x1f')]+_0x353dc0[_0xc3e5('0x22')];var _0x4a1d86;if(_0x1e1eea>=_0x277063){_0x1e1eea=_0x277063;_0x4a1d86=0xc8;}else{_0x4a1d86=0xce;}_0x4d1ad9[_0xc3e5('0x1d')](_0x4a1d86);return _0x4d1ad9['set'](_0xc3e5('0x23'),_0xa33d84+'-'+_0x1e1eea+'/'+_0x277063)[_0xc3e5('0x1e')](_0x3e3eaa);}return null;};}function patchUpdates(_0x2d551b){return function(_0xebf6dc){try{jsonpatch[_0xc3e5('0x24')](_0xebf6dc,_0x2d551b,!![]);}catch(_0x4a7806){return BPromise[_0xc3e5('0x25')](_0x4a7806);}return _0xebf6dc[_0xc3e5('0x26')]();};}function saveUpdates(_0x2d8c6f,_0x3eb513){return function(_0x414ba9){if(_0x414ba9){return _0x414ba9[_0xc3e5('0x27')](_0x2d8c6f)[_0xc3e5('0x28')](function(_0x47f344){return _0x47f344;});}return null;};}function removeEntity(_0x3a2800,_0x430cb4){return function(_0x43d01e){if(_0x43d01e){return _0x43d01e[_0xc3e5('0x29')]()[_0xc3e5('0x28')](function(){_0x3a2800[_0xc3e5('0x1d')](0xcc)[_0xc3e5('0x2a')]();});}};}function handleEntityNotFound(_0x45556e,_0x564748){return function(_0x25d3a3){if(!_0x25d3a3){_0x45556e['sendStatus'](0x194);}return _0x25d3a3;};}function handleError(_0x4c0cf4,_0x8815af){_0x8815af=_0x8815af||0x1f4;return function(_0x12ad6e){logger[_0xc3e5('0x2b')](_0x12ad6e['stack']);if(_0x12ad6e[_0xc3e5('0x2c')]){delete _0x12ad6e[_0xc3e5('0x2c')];}_0x4c0cf4[_0xc3e5('0x1d')](_0x8815af)[_0xc3e5('0x2d')](_0x12ad6e);};}exports['index']=function(_0xa6766d,_0x497ecf){var _0x45ca6d={},_0xc0e6e7={},_0xc58f2b={'count':0x0,'rows':[]};var _0x5a2d41=_['map'](db['FaxQueueReport'][_0xc3e5('0x2e')],function(_0x45cd9c){return{'name':_0x45cd9c[_0xc3e5('0x2f')],'type':_0x45cd9c[_0xc3e5('0x30')][_0xc3e5('0x31')]};});_0xc0e6e7[_0xc3e5('0x32')]=_['map'](_0x5a2d41,_0xc3e5('0x2c'));_0xc0e6e7[_0xc3e5('0x33')]=_[_0xc3e5('0x34')](_0xa6766d[_0xc3e5('0x33')]);_0xc0e6e7[_0xc3e5('0x35')]=_[_0xc3e5('0x36')](_0xc0e6e7[_0xc3e5('0x32')],_0xc0e6e7[_0xc3e5('0x33')]);_0x45ca6d[_0xc3e5('0x37')]=_[_0xc3e5('0x36')](_0xc0e6e7[_0xc3e5('0x32')],qs['fields'](_0xa6766d[_0xc3e5('0x33')]['fields']));_0x45ca6d[_0xc3e5('0x37')]=_0x45ca6d[_0xc3e5('0x37')][_0xc3e5('0x38')]?_0x45ca6d[_0xc3e5('0x37')]:_0xc0e6e7['model'];if(!_0xa6766d[_0xc3e5('0x33')]['hasOwnProperty']('nolimit')){_0x45ca6d[_0xc3e5('0x22')]=qs['limit'](_0xa6766d[_0xc3e5('0x33')][_0xc3e5('0x22')]);_0x45ca6d[_0xc3e5('0x1f')]=qs[_0xc3e5('0x1f')](_0xa6766d[_0xc3e5('0x33')]['offset']);}_0x45ca6d[_0xc3e5('0x39')]=qs[_0xc3e5('0x3a')](_0xa6766d[_0xc3e5('0x33')][_0xc3e5('0x3a')]);_0x45ca6d[_0xc3e5('0x3b')]=qs['filters'](_[_0xc3e5('0x3c')](_0xa6766d['query'],_0xc0e6e7[_0xc3e5('0x35')]),_0x5a2d41);if(_0xa6766d[_0xc3e5('0x33')]['filter']){_0x45ca6d[_0xc3e5('0x3b')]=_['merge'](_0x45ca6d[_0xc3e5('0x3b')],{'$or':_[_0xc3e5('0x3d')](_0x5a2d41,function(_0x3e7333){if(_0x3e7333['type']!==_0xc3e5('0x3e')){var _0x3c496f={};_0x3c496f[_0x3e7333[_0xc3e5('0x2c')]]={'$like':'%'+_0xa6766d[_0xc3e5('0x33')][_0xc3e5('0x3f')]+'%'};return _0x3c496f;}})});}_0x45ca6d=_['merge']({},_0x45ca6d,_0xa6766d['options']);var _0x5ebe00={'where':_0x45ca6d[_0xc3e5('0x3b')]};return db[_0xc3e5('0x40')]['count'](_0x5ebe00)[_0xc3e5('0x28')](function(_0x5b100d){_0xc58f2b[_0xc3e5('0x21')]=_0x5b100d;if(_0xa6766d['query'][_0xc3e5('0x41')]){_0x45ca6d['include']=[{'all':!![]}];}return db[_0xc3e5('0x40')][_0xc3e5('0x42')](_0x45ca6d);})[_0xc3e5('0x28')](function(_0x1c5177){_0xc58f2b[_0xc3e5('0x43')]=_0x1c5177;return _0xc58f2b;})[_0xc3e5('0x28')](respondWithFilteredResult(_0x497ecf,_0x45ca6d))['catch'](handleError(_0x497ecf,null));};exports['show']=function(_0x3213d3,_0x5f4328){var _0x3f0887={'raw':!![],'where':{'id':_0x3213d3[_0xc3e5('0x44')]['id']}},_0x27354c={};_0x27354c[_0xc3e5('0x32')]=_[_0xc3e5('0x34')](db[_0xc3e5('0x40')]['rawAttributes']);_0x27354c[_0xc3e5('0x33')]=_[_0xc3e5('0x34')](_0x3213d3[_0xc3e5('0x33')]);_0x27354c[_0xc3e5('0x35')]=_[_0xc3e5('0x36')](_0x27354c[_0xc3e5('0x32')],_0x27354c[_0xc3e5('0x33')]);_0x3f0887[_0xc3e5('0x37')]=_[_0xc3e5('0x36')](_0x27354c[_0xc3e5('0x32')],qs['fields'](_0x3213d3['query']['fields']));_0x3f0887[_0xc3e5('0x37')]=_0x3f0887['attributes'][_0xc3e5('0x38')]?_0x3f0887[_0xc3e5('0x37')]:_0x27354c[_0xc3e5('0x32')];if(_0x3213d3[_0xc3e5('0x33')]['includeAll']){_0x3f0887[_0xc3e5('0x45')]=[{'all':!![]}];}_0x3f0887=_[_0xc3e5('0x46')]({},_0x3f0887,_0x3213d3[_0xc3e5('0x47')]);return db[_0xc3e5('0x40')]['find'](_0x3f0887)['then'](handleEntityNotFound(_0x5f4328,null))[_0xc3e5('0x28')](respondWithResult(_0x5f4328,null))[_0xc3e5('0x48')](handleError(_0x5f4328,null));};exports['create']=function(_0x12cc80,_0x4c9b0b){return db[_0xc3e5('0x40')]['create'](_0x12cc80[_0xc3e5('0x49')],{})['then'](respondWithResult(_0x4c9b0b,0xc9))['catch'](handleError(_0x4c9b0b,null));};exports['update']=function(_0x87855d,_0x11da7e){if(_0x87855d[_0xc3e5('0x49')]['id']){delete _0x87855d['body']['id'];}return db['FaxQueueReport'][_0xc3e5('0x4a')]({'where':{'id':_0x87855d['params']['id']}})[_0xc3e5('0x28')](handleEntityNotFound(_0x11da7e,null))[_0xc3e5('0x28')](saveUpdates(_0x87855d[_0xc3e5('0x49')],null))[_0xc3e5('0x28')](respondWithResult(_0x11da7e,null))[_0xc3e5('0x48')](handleError(_0x11da7e,null));};exports[_0xc3e5('0x29')]=function(_0x5cd31c,_0x27924f){return db['FaxQueueReport']['find']({'where':{'id':_0x5cd31c[_0xc3e5('0x44')]['id']}})['then'](handleEntityNotFound(_0x27924f,null))[_0xc3e5('0x28')](removeEntity(_0x27924f,null))['catch'](handleError(_0x27924f,null));};exports['describe']=function(_0xe2b621,_0xffeec4){return db['FaxQueueReport']['describe']()[_0xc3e5('0x28')](respondWithResult(_0xffeec4,null))[_0xc3e5('0x48')](handleError(_0xffeec4,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index e749925..44e58f3 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x56093d,_0x475995){var _0x4ef984=function(_0x112af8){while(--_0x112af8){_0x56093d['push'](_0x56093d['shift']());}};_0x4ef984(++_0x475995);}(_0x1261,0x144));var _0x1126=function(_0x1aac60,_0x2e5ce5){_0x1aac60=_0x1aac60-0x0;var _0x186adf=_0x1261[_0x1aac60];return _0x186adf;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash'];(function(_0x36ed97,_0x238477){var _0x28df9b=function(_0x3ebe07){while(--_0x3ebe07){_0x36ed97['push'](_0x36ed97['shift']());}};_0x28df9b(++_0x238477);}(_0x5fc3,0xa8));var _0x35fc=function(_0x289e64,_0x5adb3c){_0x289e64=_0x289e64-0x0;var _0x30246c=_0x5fc3[_0x289e64];return _0x30246c;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('FaxQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('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 25f75dd..fcc499b 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 _0x0a7b=['attributes','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','FaxQueueReport,\x20%s,\x20%s','catch','CreateFaxQueueReport','create','body','options','raw','info','debug','UpdateFaxQueueReport','update'];(function(_0x4d2f00,_0x4e94d5){var _0x2d7b7f=function(_0x18fa08){while(--_0x18fa08){_0x4d2f00['push'](_0x4d2f00['shift']());}};_0x2d7b7f(++_0x4e94d5);}(_0x0a7b,0xdb));var _0xb0a7=function(_0xe73e62,_0x286323){_0xe73e62=_0xe73e62-0x0;var _0x4bdb57=_0x0a7b[_0xe73e62];return _0x4bdb57;};'use strict';var _=require('lodash');var util=require(_0xb0a7('0x0'));var moment=require('moment');var BPromise=require(_0xb0a7('0x1'));var rs=require(_0xb0a7('0x2'));var fs=require('fs');var Redis=require(_0xb0a7('0x3'));var db=require(_0xb0a7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb0a7('0x5'))(_0xb0a7('0x6'));var config=require(_0xb0a7('0x7'));var jayson=require(_0xb0a7('0x8'));var client=jayson[_0xb0a7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b09cd,_0x205364,_0x5736b0){return new BPromise(function(_0x32b8d4,_0x227022){return client[_0xb0a7('0xa')](_0x5b09cd,_0x5736b0)[_0xb0a7('0xb')](function(_0x5396e6){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x205364,_0xb0a7('0xc'));logger['debug'](_0xb0a7('0xd'),_0x205364,_0xb0a7('0xc'),JSON[_0xb0a7('0xe')](_0x5396e6));if(_0x5396e6['error']){if(_0x5396e6['error'][_0xb0a7('0xf')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x205364,_0x5396e6[_0xb0a7('0x10')]['message']);return _0x227022(_0x5396e6['error'][_0xb0a7('0x11')]);}logger[_0xb0a7('0x10')](_0xb0a7('0x12'),_0x205364,_0x5396e6['error'][_0xb0a7('0x11')]);return _0x32b8d4(_0x5396e6[_0xb0a7('0x10')][_0xb0a7('0x11')]);}else{logger['info'](_0xb0a7('0x12'),_0x205364,'request\x20sent');_0x32b8d4(_0x5396e6['result'][_0xb0a7('0x11')]);}})[_0xb0a7('0x13')](function(_0x5e210e){logger['error'](_0xb0a7('0x12'),_0x205364,_0x5e210e);_0x227022(_0x5e210e);});});}exports[_0xb0a7('0x14')]=function(_0x4c5d18){var _0x1147ad=this;return new Promise(function(_0x3a3e9e,_0x3bf78f){return db['FaxQueueReport'][_0xb0a7('0x15')](_0x4c5d18[_0xb0a7('0x16')],{'raw':_0x4c5d18[_0xb0a7('0x17')]?_0x4c5d18[_0xb0a7('0x17')][_0xb0a7('0x18')]===undefined?!![]:![]:!![]})[_0xb0a7('0xb')](function(_0x1a0f98){logger[_0xb0a7('0x19')](_0xb0a7('0x14'),_0x4c5d18);logger[_0xb0a7('0x1a')]('CreateFaxQueueReport',_0x4c5d18,JSON[_0xb0a7('0xe')](_0x1a0f98));_0x3a3e9e(_0x1a0f98);})[_0xb0a7('0x13')](function(_0x35043b){logger[_0xb0a7('0x10')](_0xb0a7('0x14'),_0x35043b[_0xb0a7('0x11')],_0x4c5d18);_0x3bf78f(_0x1147ad[_0xb0a7('0x10')](0x1f4,_0x35043b[_0xb0a7('0x11')]));});});};exports[_0xb0a7('0x1b')]=function(_0x511568){var _0x3de9c7=this;return new Promise(function(_0x42d639,_0x3db8cd){return db['FaxQueueReport'][_0xb0a7('0x1c')](_0x511568[_0xb0a7('0x16')],{'raw':_0x511568[_0xb0a7('0x17')]?_0x511568[_0xb0a7('0x17')][_0xb0a7('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x511568['options']?_0x511568[_0xb0a7('0x17')]['where']||null:null,'attributes':_0x511568['options']?_0x511568[_0xb0a7('0x17')][_0xb0a7('0x1d')]||null:null,'limit':_0x511568[_0xb0a7('0x17')]?_0x511568[_0xb0a7('0x17')][_0xb0a7('0x1e')]||null:null})[_0xb0a7('0xb')](function(_0x35dc13){logger[_0xb0a7('0x19')](_0xb0a7('0x1b'),_0x511568);logger[_0xb0a7('0x1a')](_0xb0a7('0x1b'),_0x511568,JSON[_0xb0a7('0xe')](_0x35dc13));_0x42d639(_0x35dc13);})[_0xb0a7('0x13')](function(_0x5862ba){logger[_0xb0a7('0x10')]('UpdateFaxQueueReport',_0x5862ba[_0xb0a7('0x11')],_0x511568);_0x3db8cd(_0x3de9c7[_0xb0a7('0x10')](0x1f4,_0x5862ba[_0xb0a7('0x11')]));});});}; \ No newline at end of file +var _0x50ed=['client','request','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','FaxQueueReport,\x20%s,\x20%s','message','FaxQueueReport','body','options','raw','then','CreateFaxQueueReport','catch','where','attributes','limit','UpdateFaxQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x296617,_0x3e464d){var _0x42a9a9=function(_0x5cfd36){while(--_0x5cfd36){_0x296617['push'](_0x296617['shift']());}};_0x42a9a9(++_0x3e464d);}(_0x50ed,0x1e4));var _0xd50e=function(_0x209b78,_0x178cf8){_0x209b78=_0x209b78-0x0;var _0x3d47ac=_0x50ed[_0x209b78];return _0x3d47ac;};'use strict';var _=require('lodash');var util=require(_0xd50e('0x0'));var moment=require(_0xd50e('0x1'));var BPromise=require(_0xd50e('0x2'));var rs=require(_0xd50e('0x3'));var fs=require('fs');var Redis=require(_0xd50e('0x4'));var db=require(_0xd50e('0x5'))['db'];var utils=require(_0xd50e('0x6'));var logger=require(_0xd50e('0x7'))('rpc');var config=require(_0xd50e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd50e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x266c09,_0x2ed416,_0x2dbfb0){return new BPromise(function(_0x34a29a,_0x94b94c){return client[_0xd50e('0xa')](_0x266c09,_0x2dbfb0)['then'](function(_0x987ca2){logger[_0xd50e('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x2ed416,_0xd50e('0xc'));logger[_0xd50e('0xd')](_0xd50e('0xe'),_0x2ed416,'request\x20sent',JSON['stringify'](_0x987ca2));if(_0x987ca2[_0xd50e('0xf')]){if(_0x987ca2[_0xd50e('0xf')]['code']===0x1f4){logger[_0xd50e('0xf')](_0xd50e('0x10'),_0x2ed416,_0x987ca2['error']['message']);return _0x94b94c(_0x987ca2[_0xd50e('0xf')][_0xd50e('0x11')]);}logger[_0xd50e('0xf')](_0xd50e('0x10'),_0x2ed416,_0x987ca2[_0xd50e('0xf')][_0xd50e('0x11')]);return _0x34a29a(_0x987ca2[_0xd50e('0xf')]['message']);}else{logger['info'](_0xd50e('0x10'),_0x2ed416,_0xd50e('0xc'));_0x34a29a(_0x987ca2['result'][_0xd50e('0x11')]);}})['catch'](function(_0x275d97){logger[_0xd50e('0xf')](_0xd50e('0x10'),_0x2ed416,_0x275d97);_0x94b94c(_0x275d97);});});}exports['CreateFaxQueueReport']=function(_0x89ba97){var _0x41cea5=this;return new Promise(function(_0x105c20,_0x2b8202){return db[_0xd50e('0x12')]['create'](_0x89ba97[_0xd50e('0x13')],{'raw':_0x89ba97[_0xd50e('0x14')]?_0x89ba97[_0xd50e('0x14')][_0xd50e('0x15')]===undefined?!![]:![]:!![]})[_0xd50e('0x16')](function(_0x22296e){logger[_0xd50e('0xb')](_0xd50e('0x17'),_0x89ba97);logger[_0xd50e('0xd')](_0xd50e('0x17'),_0x89ba97,JSON['stringify'](_0x22296e));_0x105c20(_0x22296e);})[_0xd50e('0x18')](function(_0x34716d){logger['error']('CreateFaxQueueReport',_0x34716d['message'],_0x89ba97);_0x2b8202(_0x41cea5[_0xd50e('0xf')](0x1f4,_0x34716d['message']));});});};exports['UpdateFaxQueueReport']=function(_0x47f64c){var _0x3bd0c0=this;return new Promise(function(_0x355836,_0x146994){return db[_0xd50e('0x12')]['update'](_0x47f64c[_0xd50e('0x13')],{'raw':_0x47f64c['options']?_0x47f64c[_0xd50e('0x14')][_0xd50e('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47f64c['options']?_0x47f64c[_0xd50e('0x14')][_0xd50e('0x19')]||null:null,'attributes':_0x47f64c[_0xd50e('0x14')]?_0x47f64c[_0xd50e('0x14')][_0xd50e('0x1a')]||null:null,'limit':_0x47f64c[_0xd50e('0x14')]?_0x47f64c[_0xd50e('0x14')][_0xd50e('0x1b')]||null:null})[_0xd50e('0x16')](function(_0x587854){logger[_0xd50e('0xb')](_0xd50e('0x1c'),_0x47f64c);logger['debug'](_0xd50e('0x1c'),_0x47f64c,JSON['stringify'](_0x587854));_0x355836(_0x587854);})['catch'](function(_0x2fba90){logger[_0xd50e('0xf')](_0xd50e('0x1c'),_0x2fba90[_0xd50e('0x11')],_0x47f64c);_0x146994(_0x3bd0c0[_0xd50e('0xf')](0x1f4,_0x2fba90['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 6223b09..faf9e70 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 _0x9952=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x1c1509,_0x2dfa81){var _0xf11b7=function(_0x17949e){while(--_0x17949e){_0x1c1509['push'](_0x1c1509['shift']());}};_0xf11b7(++_0x2dfa81);}(_0x9952,0x18c));var _0x2995=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0x9952[_0x1460f6];return _0x46ce94;};'use strict';var multer=require('multer');var util=require(_0x2995('0x0'));var path=require(_0x2995('0x1'));var timeout=require(_0x2995('0x2'));var express=require(_0x2995('0x3'));var router=express[_0x2995('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2995('0x5'));var interaction=require(_0x2995('0x6'));var config=require(_0x2995('0x7'));var controller=require('./faxQueueReport.controller');router[_0x2995('0x8')]('/',auth['isAuthenticated'](),controller[_0x2995('0x9')]);router[_0x2995('0x8')](_0x2995('0xa'),auth[_0x2995('0xb')](),controller[_0x2995('0xc')]);router[_0x2995('0x8')](_0x2995('0xd'),auth[_0x2995('0xb')](),controller[_0x2995('0xe')]);router[_0x2995('0xf')]('/',auth[_0x2995('0xb')](),controller[_0x2995('0x10')]);router[_0x2995('0x11')](_0x2995('0xd'),auth[_0x2995('0xb')](),controller[_0x2995('0x12')]);router[_0x2995('0x13')](_0x2995('0xd'),auth[_0x2995('0xb')](),controller[_0x2995('0x14')]);module[_0x2995('0x15')]=router; \ No newline at end of file +var _0x4b1a=['isAuthenticated','/describe','describe','/:id','show','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x4b1a,0x10e));var _0xa4b1=function(_0x439374,_0xd25aea){_0x439374=_0x439374-0x0;var _0x463626=_0x4b1a[_0x439374];return _0x463626;};'use strict';var multer=require(_0xa4b1('0x0'));var util=require(_0xa4b1('0x1'));var path=require('path');var timeout=require(_0xa4b1('0x2'));var express=require('express');var router=express[_0xa4b1('0x3')]();var fs_extra=require(_0xa4b1('0x4'));var auth=require(_0xa4b1('0x5'));var interaction=require(_0xa4b1('0x6'));var config=require(_0xa4b1('0x7'));var controller=require(_0xa4b1('0x8'));router[_0xa4b1('0x9')]('/',auth[_0xa4b1('0xa')](),controller['index']);router['get'](_0xa4b1('0xb'),auth[_0xa4b1('0xa')](),controller[_0xa4b1('0xc')]);router[_0xa4b1('0x9')](_0xa4b1('0xd'),auth[_0xa4b1('0xa')](),controller[_0xa4b1('0xe')]);router['post']('/',auth[_0xa4b1('0xa')](),controller[_0xa4b1('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa4b1('0x10')]);router[_0xa4b1('0x11')](_0xa4b1('0xd'),auth[_0xa4b1('0xa')](),controller[_0xa4b1('0x12')]);module[_0xa4b1('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index e288c9d..880a0e3 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x28278f,_0x574b0d){var _0x3d9f74=function(_0x306742){while(--_0x306742){_0x28278f['push'](_0x28278f['shift']());}};_0x3d9f74(++_0x574b0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x53400b,_0x37a069){var _0x3b95aa=function(_0x1dedb5){while(--_0x1dedb5){_0x53400b['push'](_0x53400b['shift']());}};_0x3b95aa(++_0x37a069);}(_0xedd9,0xfc));var _0x9edd=function(_0xa9bed,_0x499652){_0xa9bed=_0xa9bed-0x0;var _0x553b9b=_0xedd9[_0xa9bed];return _0x553b9b;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index c275139..8eccb99 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 _0x0a17=['VIRTUAL','includeAll','catch','params','include','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','FaxTransferReport','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x1ea5e2,_0x382cec){var _0x39380c=function(_0x27893b){while(--_0x27893b){_0x1ea5e2['push'](_0x1ea5e2['shift']());}};_0x39380c(++_0x382cec);}(_0x0a17,0xa6));var _0x70a1=function(_0x18be9f,_0xc8fdef){_0x18be9f=_0x18be9f-0x0;var _0x2e1724=_0x0a17[_0x18be9f];return _0x2e1724;};'use strict';var emlformat=require(_0x70a1('0x0'));var rimraf=require(_0x70a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x70a1('0x2'));var rp=require(_0x70a1('0x3'));var moment=require('moment');var BPromise=require(_0x70a1('0x4'));var Mustache=require(_0x70a1('0x5'));var util=require(_0x70a1('0x6'));var path=require(_0x70a1('0x7'));var sox=require(_0x70a1('0x8'));var csv=require(_0x70a1('0x9'));var ejs=require(_0x70a1('0xa'));var fs=require('fs');var fs_extra=require(_0x70a1('0xb'));var _=require(_0x70a1('0xc'));var squel=require('squel');var crypto=require(_0x70a1('0xd'));var jsforce=require(_0x70a1('0xe'));var deskjs=require(_0x70a1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x70a1('0x10'));var Papa=require(_0x70a1('0x11'));var Redis=require(_0x70a1('0x12'));var authService=require(_0x70a1('0x13'));var qs=require(_0x70a1('0x14'));var as=require(_0x70a1('0x15'));var hardwareService=require(_0x70a1('0x16'));var logger=require('../../config/logger')(_0x70a1('0x17'));var utils=require(_0x70a1('0x18'));var config=require(_0x70a1('0x19'));var licenseUtil=require(_0x70a1('0x1a'));var db=require(_0x70a1('0x1b'))['db'];function respondWithStatusCode(_0x549979,_0x12c325){_0x12c325=_0x12c325||0xcc;return function(_0x384b42){if(_0x384b42){return _0x549979[_0x70a1('0x1c')](_0x12c325);}return _0x549979['status'](_0x12c325)['end']();};}function respondWithResult(_0x3861cf,_0x6d3215){_0x6d3215=_0x6d3215||0xc8;return function(_0x5be4a2){if(_0x5be4a2){return _0x3861cf[_0x70a1('0x1d')](_0x6d3215)[_0x70a1('0x1e')](_0x5be4a2);}};}function respondWithFilteredResult(_0x2e805e,_0x249865){return function(_0x454c22){if(_0x454c22){var _0x2b2d56=typeof _0x249865[_0x70a1('0x1f')]===_0x70a1('0x20')&&typeof _0x249865[_0x70a1('0x21')]===_0x70a1('0x20');var _0x556d1e=_0x454c22[_0x70a1('0x22')];var _0x4087fc=_0x2b2d56?0x0:_0x249865[_0x70a1('0x1f')];var _0x25c38e=_0x2b2d56?_0x454c22[_0x70a1('0x22')]:_0x249865[_0x70a1('0x1f')]+_0x249865[_0x70a1('0x21')];var _0x37b024;if(_0x25c38e>=_0x556d1e){_0x25c38e=_0x556d1e;_0x37b024=0xc8;}else{_0x37b024=0xce;}_0x2e805e['status'](_0x37b024);return _0x2e805e[_0x70a1('0x23')](_0x70a1('0x24'),_0x4087fc+'-'+_0x25c38e+'/'+_0x556d1e)[_0x70a1('0x1e')](_0x454c22);}return null;};}function patchUpdates(_0x4566e7){return function(_0x1509f6){try{jsonpatch[_0x70a1('0x25')](_0x1509f6,_0x4566e7,!![]);}catch(_0x3ce8c2){return BPromise[_0x70a1('0x26')](_0x3ce8c2);}return _0x1509f6[_0x70a1('0x27')]();};}function saveUpdates(_0x5f501a,_0x2a9049){return function(_0x1db428){if(_0x1db428){return _0x1db428[_0x70a1('0x28')](_0x5f501a)[_0x70a1('0x29')](function(_0x429a15){return _0x429a15;});}return null;};}function removeEntity(_0x144442,_0x2814ad){return function(_0x5df4ae){if(_0x5df4ae){return _0x5df4ae[_0x70a1('0x2a')]()[_0x70a1('0x29')](function(){_0x144442[_0x70a1('0x1d')](0xcc)[_0x70a1('0x2b')]();});}};}function handleEntityNotFound(_0x333392,_0x5b03a4){return function(_0x11028e){if(!_0x11028e){_0x333392[_0x70a1('0x1c')](0x194);}return _0x11028e;};}function handleError(_0x46cd6f,_0x2a1c98){_0x2a1c98=_0x2a1c98||0x1f4;return function(_0x3d5cda){logger[_0x70a1('0x2c')](_0x3d5cda[_0x70a1('0x2d')]);if(_0x3d5cda[_0x70a1('0x2e')]){delete _0x3d5cda[_0x70a1('0x2e')];}_0x46cd6f[_0x70a1('0x1d')](_0x2a1c98)[_0x70a1('0x2f')](_0x3d5cda);};}exports['index']=function(_0xd2554a,_0x5344d7){var _0x256a27={},_0x328d5e={},_0x500189={'count':0x0,'rows':[]};var _0xb0b11b=_[_0x70a1('0x30')](db[_0x70a1('0x31')]['rawAttributes'],function(_0x49c52f){return{'name':_0x49c52f['fieldName'],'type':_0x49c52f[_0x70a1('0x32')][_0x70a1('0x33')]};});_0x328d5e[_0x70a1('0x34')]=_[_0x70a1('0x30')](_0xb0b11b,_0x70a1('0x2e'));_0x328d5e[_0x70a1('0x35')]=_[_0x70a1('0x36')](_0xd2554a['query']);_0x328d5e[_0x70a1('0x37')]=_[_0x70a1('0x38')](_0x328d5e[_0x70a1('0x34')],_0x328d5e[_0x70a1('0x35')]);_0x256a27['attributes']=_['intersection'](_0x328d5e[_0x70a1('0x34')],qs[_0x70a1('0x39')](_0xd2554a[_0x70a1('0x35')][_0x70a1('0x39')]));_0x256a27[_0x70a1('0x3a')]=_0x256a27[_0x70a1('0x3a')][_0x70a1('0x3b')]?_0x256a27[_0x70a1('0x3a')]:_0x328d5e[_0x70a1('0x34')];if(!_0xd2554a[_0x70a1('0x35')][_0x70a1('0x3c')](_0x70a1('0x3d'))){_0x256a27['limit']=qs[_0x70a1('0x21')](_0xd2554a[_0x70a1('0x35')][_0x70a1('0x21')]);_0x256a27[_0x70a1('0x1f')]=qs['offset'](_0xd2554a[_0x70a1('0x35')][_0x70a1('0x1f')]);}_0x256a27[_0x70a1('0x3e')]=qs['sort'](_0xd2554a[_0x70a1('0x35')][_0x70a1('0x3f')]);_0x256a27[_0x70a1('0x40')]=qs[_0x70a1('0x37')](_[_0x70a1('0x41')](_0xd2554a[_0x70a1('0x35')],_0x328d5e[_0x70a1('0x37')]),_0xb0b11b);if(_0xd2554a[_0x70a1('0x35')][_0x70a1('0x42')]){_0x256a27['where']=_[_0x70a1('0x43')](_0x256a27[_0x70a1('0x40')],{'$or':_[_0x70a1('0x30')](_0xb0b11b,function(_0x45f469){if(_0x45f469[_0x70a1('0x32')]!==_0x70a1('0x44')){var _0x78b01f={};_0x78b01f[_0x45f469[_0x70a1('0x2e')]]={'$like':'%'+_0xd2554a['query'][_0x70a1('0x42')]+'%'};return _0x78b01f;}})});}_0x256a27=_[_0x70a1('0x43')]({},_0x256a27,_0xd2554a['options']);var _0x21805b={'where':_0x256a27[_0x70a1('0x40')]};return db[_0x70a1('0x31')][_0x70a1('0x22')](_0x21805b)[_0x70a1('0x29')](function(_0x3dbb36){_0x500189[_0x70a1('0x22')]=_0x3dbb36;if(_0xd2554a['query'][_0x70a1('0x45')]){_0x256a27['include']=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x256a27);})[_0x70a1('0x29')](function(_0x41ba13){_0x500189['rows']=_0x41ba13;return _0x500189;})[_0x70a1('0x29')](respondWithFilteredResult(_0x5344d7,_0x256a27))[_0x70a1('0x46')](handleError(_0x5344d7,null));};exports['show']=function(_0x5e812f,_0x35787f){var _0x15f37a={'raw':!![],'where':{'id':_0x5e812f[_0x70a1('0x47')]['id']}},_0x1eaada={};_0x1eaada[_0x70a1('0x34')]=_['keys'](db[_0x70a1('0x31')]['rawAttributes']);_0x1eaada[_0x70a1('0x35')]=_[_0x70a1('0x36')](_0x5e812f[_0x70a1('0x35')]);_0x1eaada['filters']=_[_0x70a1('0x38')](_0x1eaada[_0x70a1('0x34')],_0x1eaada[_0x70a1('0x35')]);_0x15f37a[_0x70a1('0x3a')]=_[_0x70a1('0x38')](_0x1eaada[_0x70a1('0x34')],qs[_0x70a1('0x39')](_0x5e812f[_0x70a1('0x35')][_0x70a1('0x39')]));_0x15f37a[_0x70a1('0x3a')]=_0x15f37a[_0x70a1('0x3a')][_0x70a1('0x3b')]?_0x15f37a[_0x70a1('0x3a')]:_0x1eaada['model'];if(_0x5e812f[_0x70a1('0x35')][_0x70a1('0x45')]){_0x15f37a[_0x70a1('0x48')]=[{'all':!![]}];}_0x15f37a=_[_0x70a1('0x43')]({},_0x15f37a,_0x5e812f[_0x70a1('0x49')]);return db[_0x70a1('0x31')][_0x70a1('0x4a')](_0x15f37a)[_0x70a1('0x29')](handleEntityNotFound(_0x35787f,null))[_0x70a1('0x29')](respondWithResult(_0x35787f,null))[_0x70a1('0x46')](handleError(_0x35787f,null));};exports[_0x70a1('0x4b')]=function(_0x4fabd3,_0x55817e){return db[_0x70a1('0x31')][_0x70a1('0x4b')](_0x4fabd3[_0x70a1('0x4c')],{})[_0x70a1('0x29')](respondWithResult(_0x55817e,0xc9))[_0x70a1('0x46')](handleError(_0x55817e,null));};exports[_0x70a1('0x28')]=function(_0x19db63,_0xf59aa){if(_0x19db63['body']['id']){delete _0x19db63[_0x70a1('0x4c')]['id'];}return db[_0x70a1('0x31')][_0x70a1('0x4a')]({'where':{'id':_0x19db63['params']['id']}})[_0x70a1('0x29')](handleEntityNotFound(_0xf59aa,null))['then'](saveUpdates(_0x19db63[_0x70a1('0x4c')],null))[_0x70a1('0x29')](respondWithResult(_0xf59aa,null))['catch'](handleError(_0xf59aa,null));};exports[_0x70a1('0x2a')]=function(_0x33a3e6,_0x3f9014){return db[_0x70a1('0x31')][_0x70a1('0x4a')]({'where':{'id':_0x33a3e6[_0x70a1('0x47')]['id']}})[_0x70a1('0x29')](handleEntityNotFound(_0x3f9014,null))[_0x70a1('0x29')](removeEntity(_0x3f9014,null))['catch'](handleError(_0x3f9014,null));};exports[_0x70a1('0x4d')]=function(_0x3ac09a,_0xcc0fb4){return db[_0x70a1('0x31')]['describe']()[_0x70a1('0x29')](respondWithResult(_0xcc0fb4,null))[_0x70a1('0x46')](handleError(_0xcc0fb4,null));}; \ No newline at end of file +var _0x26dd=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','FaxTransferReport','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','count','includeAll','include','findAll','rows','show','params','merge','options','catch','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x1aed01,_0x3b59f3){var _0x34ccb8=function(_0x1420db){while(--_0x1420db){_0x1aed01['push'](_0x1aed01['shift']());}};_0x34ccb8(++_0x3b59f3);}(_0x26dd,0x87));var _0xd26d=function(_0x17c552,_0xbee1df){_0x17c552=_0x17c552-0x0;var _0x1142ca=_0x26dd[_0x17c552];return _0x1142ca;};'use strict';var emlformat=require(_0xd26d('0x0'));var rimraf=require(_0xd26d('0x1'));var zipdir=require(_0xd26d('0x2'));var jsonpatch=require(_0xd26d('0x3'));var rp=require('request-promise');var moment=require(_0xd26d('0x4'));var BPromise=require(_0xd26d('0x5'));var Mustache=require(_0xd26d('0x6'));var util=require(_0xd26d('0x7'));var path=require('path');var sox=require(_0xd26d('0x8'));var csv=require('to-csv');var ejs=require(_0xd26d('0x9'));var fs=require('fs');var fs_extra=require(_0xd26d('0xa'));var _=require(_0xd26d('0xb'));var squel=require('squel');var crypto=require(_0xd26d('0xc'));var jsforce=require(_0xd26d('0xd'));var deskjs=require(_0xd26d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd26d('0xf'));var Papa=require(_0xd26d('0x10'));var Redis=require('ioredis');var authService=require(_0xd26d('0x11'));var qs=require(_0xd26d('0x12'));var as=require(_0xd26d('0x13'));var hardwareService=require(_0xd26d('0x14'));var logger=require(_0xd26d('0x15'))('api');var utils=require(_0xd26d('0x16'));var config=require(_0xd26d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd26d('0x18'))['db'];function respondWithStatusCode(_0x2f1a54,_0x5161bc){_0x5161bc=_0x5161bc||0xcc;return function(_0x5f1f33){if(_0x5f1f33){return _0x2f1a54[_0xd26d('0x19')](_0x5161bc);}return _0x2f1a54[_0xd26d('0x1a')](_0x5161bc)[_0xd26d('0x1b')]();};}function respondWithResult(_0x3f3780,_0x4afc20){_0x4afc20=_0x4afc20||0xc8;return function(_0x5dcab4){if(_0x5dcab4){return _0x3f3780[_0xd26d('0x1a')](_0x4afc20)[_0xd26d('0x1c')](_0x5dcab4);}};}function respondWithFilteredResult(_0x20092e,_0x3634c5){return function(_0x300995){if(_0x300995){var _0x4d54f0=typeof _0x3634c5[_0xd26d('0x1d')]===_0xd26d('0x1e')&&typeof _0x3634c5[_0xd26d('0x1f')]===_0xd26d('0x1e');var _0x3e9f1a=_0x300995['count'];var _0xd6c35=_0x4d54f0?0x0:_0x3634c5[_0xd26d('0x1d')];var _0x496d7f=_0x4d54f0?_0x300995['count']:_0x3634c5[_0xd26d('0x1d')]+_0x3634c5[_0xd26d('0x1f')];var _0x2a657c;if(_0x496d7f>=_0x3e9f1a){_0x496d7f=_0x3e9f1a;_0x2a657c=0xc8;}else{_0x2a657c=0xce;}_0x20092e[_0xd26d('0x1a')](_0x2a657c);return _0x20092e[_0xd26d('0x20')](_0xd26d('0x21'),_0xd6c35+'-'+_0x496d7f+'/'+_0x3e9f1a)[_0xd26d('0x1c')](_0x300995);}return null;};}function patchUpdates(_0xf37134){return function(_0x33fec4){try{jsonpatch[_0xd26d('0x22')](_0x33fec4,_0xf37134,!![]);}catch(_0xb4326c){return BPromise[_0xd26d('0x23')](_0xb4326c);}return _0x33fec4[_0xd26d('0x24')]();};}function saveUpdates(_0x26c76f,_0xa1096a){return function(_0x13b667){if(_0x13b667){return _0x13b667['update'](_0x26c76f)[_0xd26d('0x25')](function(_0xda2bea){return _0xda2bea;});}return null;};}function removeEntity(_0x2ee970,_0x529af8){return function(_0x4e9df1){if(_0x4e9df1){return _0x4e9df1[_0xd26d('0x26')]()[_0xd26d('0x25')](function(){_0x2ee970[_0xd26d('0x1a')](0xcc)[_0xd26d('0x1b')]();});}};}function handleEntityNotFound(_0x2d6d87,_0x460257){return function(_0x387344){if(!_0x387344){_0x2d6d87[_0xd26d('0x19')](0x194);}return _0x387344;};}function handleError(_0x17afc8,_0x26bd3b){_0x26bd3b=_0x26bd3b||0x1f4;return function(_0x4fad26){logger['error'](_0x4fad26[_0xd26d('0x27')]);if(_0x4fad26[_0xd26d('0x28')]){delete _0x4fad26[_0xd26d('0x28')];}_0x17afc8['status'](_0x26bd3b)[_0xd26d('0x29')](_0x4fad26);};}exports[_0xd26d('0x2a')]=function(_0xa8fb04,_0x3e99e8){var _0x2a4fbd={},_0x3557f9={},_0x50a95b={'count':0x0,'rows':[]};var _0x4fcbe5=_[_0xd26d('0x2b')](db[_0xd26d('0x2c')]['rawAttributes'],function(_0x14bcac){return{'name':_0x14bcac[_0xd26d('0x2d')],'type':_0x14bcac[_0xd26d('0x2e')][_0xd26d('0x2f')]};});_0x3557f9['model']=_['map'](_0x4fcbe5,'name');_0x3557f9[_0xd26d('0x30')]=_[_0xd26d('0x31')](_0xa8fb04['query']);_0x3557f9[_0xd26d('0x32')]=_[_0xd26d('0x33')](_0x3557f9['model'],_0x3557f9[_0xd26d('0x30')]);_0x2a4fbd[_0xd26d('0x34')]=_['intersection'](_0x3557f9[_0xd26d('0x35')],qs['fields'](_0xa8fb04[_0xd26d('0x30')][_0xd26d('0x36')]));_0x2a4fbd[_0xd26d('0x34')]=_0x2a4fbd['attributes'][_0xd26d('0x37')]?_0x2a4fbd[_0xd26d('0x34')]:_0x3557f9[_0xd26d('0x35')];if(!_0xa8fb04[_0xd26d('0x30')][_0xd26d('0x38')](_0xd26d('0x39'))){_0x2a4fbd[_0xd26d('0x1f')]=qs[_0xd26d('0x1f')](_0xa8fb04[_0xd26d('0x30')][_0xd26d('0x1f')]);_0x2a4fbd[_0xd26d('0x1d')]=qs[_0xd26d('0x1d')](_0xa8fb04[_0xd26d('0x30')][_0xd26d('0x1d')]);}_0x2a4fbd['order']=qs[_0xd26d('0x3a')](_0xa8fb04[_0xd26d('0x30')]['sort']);_0x2a4fbd[_0xd26d('0x3b')]=qs[_0xd26d('0x32')](_[_0xd26d('0x3c')](_0xa8fb04[_0xd26d('0x30')],_0x3557f9['filters']),_0x4fcbe5);if(_0xa8fb04[_0xd26d('0x30')][_0xd26d('0x3d')]){_0x2a4fbd['where']=_['merge'](_0x2a4fbd[_0xd26d('0x3b')],{'$or':_[_0xd26d('0x2b')](_0x4fcbe5,function(_0xb6e5ea){if(_0xb6e5ea[_0xd26d('0x2e')]!==_0xd26d('0x3e')){var _0x418f6f={};_0x418f6f[_0xb6e5ea[_0xd26d('0x28')]]={'$like':'%'+_0xa8fb04[_0xd26d('0x30')]['filter']+'%'};return _0x418f6f;}})});}_0x2a4fbd=_['merge']({},_0x2a4fbd,_0xa8fb04['options']);var _0x52cde9={'where':_0x2a4fbd[_0xd26d('0x3b')]};return db[_0xd26d('0x2c')][_0xd26d('0x3f')](_0x52cde9)[_0xd26d('0x25')](function(_0x1ceb3c){_0x50a95b['count']=_0x1ceb3c;if(_0xa8fb04[_0xd26d('0x30')][_0xd26d('0x40')]){_0x2a4fbd[_0xd26d('0x41')]=[{'all':!![]}];}return db[_0xd26d('0x2c')][_0xd26d('0x42')](_0x2a4fbd);})[_0xd26d('0x25')](function(_0x84ff9a){_0x50a95b[_0xd26d('0x43')]=_0x84ff9a;return _0x50a95b;})[_0xd26d('0x25')](respondWithFilteredResult(_0x3e99e8,_0x2a4fbd))['catch'](handleError(_0x3e99e8,null));};exports[_0xd26d('0x44')]=function(_0x2461c4,_0x29d914){var _0x3c9f78={'raw':!![],'where':{'id':_0x2461c4[_0xd26d('0x45')]['id']}},_0x5beda2={};_0x5beda2['model']=_['keys'](db[_0xd26d('0x2c')]['rawAttributes']);_0x5beda2[_0xd26d('0x30')]=_['keys'](_0x2461c4[_0xd26d('0x30')]);_0x5beda2[_0xd26d('0x32')]=_[_0xd26d('0x33')](_0x5beda2['model'],_0x5beda2['query']);_0x3c9f78[_0xd26d('0x34')]=_[_0xd26d('0x33')](_0x5beda2[_0xd26d('0x35')],qs[_0xd26d('0x36')](_0x2461c4[_0xd26d('0x30')][_0xd26d('0x36')]));_0x3c9f78[_0xd26d('0x34')]=_0x3c9f78[_0xd26d('0x34')]['length']?_0x3c9f78[_0xd26d('0x34')]:_0x5beda2[_0xd26d('0x35')];if(_0x2461c4[_0xd26d('0x30')][_0xd26d('0x40')]){_0x3c9f78['include']=[{'all':!![]}];}_0x3c9f78=_[_0xd26d('0x46')]({},_0x3c9f78,_0x2461c4[_0xd26d('0x47')]);return db[_0xd26d('0x2c')]['find'](_0x3c9f78)[_0xd26d('0x25')](handleEntityNotFound(_0x29d914,null))[_0xd26d('0x25')](respondWithResult(_0x29d914,null))[_0xd26d('0x48')](handleError(_0x29d914,null));};exports['create']=function(_0x5cf6ce,_0x3ce2f1){return db['FaxTransferReport']['create'](_0x5cf6ce[_0xd26d('0x49')],{})[_0xd26d('0x25')](respondWithResult(_0x3ce2f1,0xc9))['catch'](handleError(_0x3ce2f1,null));};exports[_0xd26d('0x4a')]=function(_0x4f57bd,_0x46a262){if(_0x4f57bd[_0xd26d('0x49')]['id']){delete _0x4f57bd['body']['id'];}return db[_0xd26d('0x2c')][_0xd26d('0x4b')]({'where':{'id':_0x4f57bd['params']['id']}})[_0xd26d('0x25')](handleEntityNotFound(_0x46a262,null))[_0xd26d('0x25')](saveUpdates(_0x4f57bd[_0xd26d('0x49')],null))[_0xd26d('0x25')](respondWithResult(_0x46a262,null))[_0xd26d('0x48')](handleError(_0x46a262,null));};exports[_0xd26d('0x26')]=function(_0x399d8b,_0x557c49){return db['FaxTransferReport'][_0xd26d('0x4b')]({'where':{'id':_0x399d8b[_0xd26d('0x45')]['id']}})[_0xd26d('0x25')](handleEntityNotFound(_0x557c49,null))[_0xd26d('0x25')](removeEntity(_0x557c49,null))['catch'](handleError(_0x557c49,null));};exports[_0xd26d('0x4c')]=function(_0x1d60d1,_0x200b17){return db[_0xd26d('0x2c')][_0xd26d('0x4c')]()[_0xd26d('0x25')](respondWithResult(_0x200b17,null))[_0xd26d('0x48')](handleError(_0x200b17,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 181eb40..05f6438 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 _0x1775=['request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1775,0x1db));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var logger=require(_0x5177('0x1'))(_0x5177('0x2'));var moment=require(_0x5177('0x3'));var BPromise=require(_0x5177('0x4'));var rp=require(_0x5177('0x5'));var fs=require('fs');var path=require(_0x5177('0x6'));var rimraf=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var attributes=require(_0x5177('0x9'));module[_0x5177('0xa')]=function(_0x2c5c42,_0x153c1a){return _0x2c5c42[_0x5177('0xb')](_0x5177('0xc'),attributes,{'tableName':_0x5177('0xd'),'paranoid':![],'indexes':[{'name':_0x5177('0xe'),'fields':[_0x5177('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7162=['moment','bluebird','rimraf','define','uniqueid','util','../../config/logger','api'];(function(_0x3b98f4,_0x43e094){var _0x4a439f=function(_0x3fd4da){while(--_0x3fd4da){_0x3b98f4['push'](_0x3b98f4['shift']());}};_0x4a439f(++_0x43e094);}(_0x7162,0x11d));var _0x2716=function(_0x1214f8,_0x18b942){_0x1214f8=_0x1214f8-0x0;var _0x3db3f8=_0x7162[_0x1214f8];return _0x3db3f8;};'use strict';var _=require('lodash');var util=require(_0x2716('0x0'));var logger=require(_0x2716('0x1'))(_0x2716('0x2'));var moment=require(_0x2716('0x3'));var BPromise=require(_0x2716('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2716('0x5'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x8894fc,_0x103f72){return _0x8894fc[_0x2716('0x6')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2716('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 0a1a36d..1d6433a 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 _0x6153=['catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','FaxTransferReport,\x20%s,\x20%s','message','result'];(function(_0x5a78a5,_0x288800){var _0x223e33=function(_0x4c57d0){while(--_0x4c57d0){_0x5a78a5['push'](_0x5a78a5['shift']());}};_0x223e33(++_0x288800);}(_0x6153,0x1cf));var _0x3615=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x6153[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x3615('0x0'));var util=require(_0x3615('0x1'));var moment=require(_0x3615('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3615('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3615('0x4'));var logger=require(_0x3615('0x5'))(_0x3615('0x6'));var config=require(_0x3615('0x7'));var jayson=require(_0x3615('0x8'));var client=jayson['client'][_0x3615('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x228e0b,_0x2d34b7,_0x3ee84b){return new BPromise(function(_0x11a971,_0x5aed2a){return client[_0x3615('0xa')](_0x228e0b,_0x3ee84b)[_0x3615('0xb')](function(_0x10c0f6){logger[_0x3615('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x2d34b7,_0x3615('0xd'));logger['debug'](_0x3615('0xe'),_0x2d34b7,'request\x20sent',JSON[_0x3615('0xf')](_0x10c0f6));if(_0x10c0f6['error']){if(_0x10c0f6['error']['code']===0x1f4){logger[_0x3615('0x10')](_0x3615('0x11'),_0x2d34b7,_0x10c0f6['error'][_0x3615('0x12')]);return _0x5aed2a(_0x10c0f6['error'][_0x3615('0x12')]);}logger[_0x3615('0x10')](_0x3615('0x11'),_0x2d34b7,_0x10c0f6[_0x3615('0x10')][_0x3615('0x12')]);return _0x11a971(_0x10c0f6[_0x3615('0x10')]['message']);}else{logger[_0x3615('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x2d34b7,_0x3615('0xd'));_0x11a971(_0x10c0f6[_0x3615('0x13')]['message']);}})[_0x3615('0x14')](function(_0x310b78){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x2d34b7,_0x310b78);_0x5aed2a(_0x310b78);});});} \ No newline at end of file +var _0x9bbd=['util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash'];(function(_0x50bcc7,_0x1e3053){var _0x3cbb5a=function(_0x1b2794){while(--_0x1b2794){_0x50bcc7['push'](_0x50bcc7['shift']());}};_0x3cbb5a(++_0x1e3053);}(_0x9bbd,0x9f));var _0xd9bb=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9bbd[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xd9bb('0x0'));var util=require(_0xd9bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd9bb('0x2'));var fs=require('fs');var Redis=require(_0xd9bb('0x3'));var db=require(_0xd9bb('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd9bb('0x5'));var config=require(_0xd9bb('0x6'));var jayson=require(_0xd9bb('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x40e359,_0x2434d3,_0x57c2d4){return new BPromise(function(_0x1aa3ba,_0x24250b){return client[_0xd9bb('0x8')](_0x40e359,_0x57c2d4)[_0xd9bb('0x9')](function(_0x5d6050){logger[_0xd9bb('0xa')](_0xd9bb('0xb'),_0x2434d3,'request\x20sent');logger[_0xd9bb('0xc')](_0xd9bb('0xd'),_0x2434d3,_0xd9bb('0xe'),JSON['stringify'](_0x5d6050));if(_0x5d6050[_0xd9bb('0xf')]){if(_0x5d6050[_0xd9bb('0xf')][_0xd9bb('0x10')]===0x1f4){logger[_0xd9bb('0xf')](_0xd9bb('0xb'),_0x2434d3,_0x5d6050[_0xd9bb('0xf')][_0xd9bb('0x11')]);return _0x24250b(_0x5d6050[_0xd9bb('0xf')]['message']);}logger[_0xd9bb('0xf')](_0xd9bb('0xb'),_0x2434d3,_0x5d6050[_0xd9bb('0xf')][_0xd9bb('0x11')]);return _0x1aa3ba(_0x5d6050[_0xd9bb('0xf')][_0xd9bb('0x11')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x2434d3,'request\x20sent');_0x1aa3ba(_0x5d6050[_0xd9bb('0x12')][_0xd9bb('0x11')]);}})[_0xd9bb('0x13')](function(_0xc99280){logger[_0xd9bb('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x2434d3,_0xc99280);_0x24250b(_0xc99280);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 50e7af6..53049a9 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 _0x6a94=['index','/describe','describe','show','post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x6a94,0x130));var _0x46a9=function(_0x4dee2e,_0x5e2b65){_0x4dee2e=_0x4dee2e-0x0;var _0x2517f7=_0x6a94[_0x4dee2e];return _0x2517f7;};'use strict';var multer=require(_0x46a9('0x0'));var util=require(_0x46a9('0x1'));var path=require(_0x46a9('0x2'));var timeout=require(_0x46a9('0x3'));var express=require(_0x46a9('0x4'));var router=express[_0x46a9('0x5')]();var fs_extra=require(_0x46a9('0x6'));var auth=require(_0x46a9('0x7'));var interaction=require(_0x46a9('0x8'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0x46a9('0x9')]('/',auth[_0x46a9('0xa')](),controller[_0x46a9('0xb')]);router[_0x46a9('0x9')](_0x46a9('0xc'),auth[_0x46a9('0xa')](),controller[_0x46a9('0xd')]);router[_0x46a9('0x9')]('/:id',auth[_0x46a9('0xa')](),controller[_0x46a9('0xe')]);router[_0x46a9('0xf')]('/',auth[_0x46a9('0xa')](),controller['create']);router['put'](_0x46a9('0x10'),auth[_0x46a9('0xa')](),controller[_0x46a9('0x11')]);router[_0x46a9('0x12')](_0x46a9('0x10'),auth['isAuthenticated'](),controller[_0x46a9('0x13')]);module[_0x46a9('0x14')]=router; \ No newline at end of file +var _0x298a=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe','get','/:id','show','post','put','update','delete','destroy'];(function(_0x2b1d72,_0x151ac9){var _0x47d2b3=function(_0x40fc50){while(--_0x40fc50){_0x2b1d72['push'](_0x2b1d72['shift']());}};_0x47d2b3(++_0x151ac9);}(_0x298a,0xc9));var _0xa298=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x298a[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xa298('0x0'));var util=require(_0xa298('0x1'));var path=require(_0xa298('0x2'));var timeout=require(_0xa298('0x3'));var express=require('express');var router=express[_0xa298('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa298('0x5'));var interaction=require(_0xa298('0x6'));var config=require(_0xa298('0x7'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0xa298('0x8')](),controller['index']);router['get'](_0xa298('0x9'),auth[_0xa298('0x8')](),controller[_0xa298('0xa')]);router[_0xa298('0xb')](_0xa298('0xc'),auth[_0xa298('0x8')](),controller[_0xa298('0xd')]);router[_0xa298('0xe')]('/',auth[_0xa298('0x8')](),controller['create']);router[_0xa298('0xf')]('/:id',auth[_0xa298('0x8')](),controller[_0xa298('0x10')]);router[_0xa298('0x11')]('/:id',auth[_0xa298('0x8')](),controller[_0xa298('0x12')]);module[_0xa298('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 7ee5e55..f5613eb 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 _0x32e0=['isAuthenticated','index','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','/:id','delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get'];(function(_0xe5376a,_0x3ed99e){var _0xa6d1e8=function(_0x481eb2){while(--_0x481eb2){_0xe5376a['push'](_0xe5376a['shift']());}};_0xa6d1e8(++_0x3ed99e);}(_0x32e0,0x15d));var _0x032e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x32e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x032e('0x0'));var util=require('util');var path=require(_0x032e('0x1'));var timeout=require(_0x032e('0x2'));var express=require(_0x032e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x032e('0x4'));var config=require(_0x032e('0x5'));var controller=require(_0x032e('0x6'));router[_0x032e('0x7')]('/',auth[_0x032e('0x8')](),controller[_0x032e('0x9')]);router[_0x032e('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x032e('0xa')]);router['get']('/:id/configurations',auth[_0x032e('0x8')](),controller[_0x032e('0xb')]);router[_0x032e('0x7')]('/:id/fields',auth[_0x032e('0x8')](),controller[_0x032e('0xc')]);router[_0x032e('0xd')]('/',auth['isAuthenticated'](),controller[_0x032e('0xe')]);router[_0x032e('0xd')](_0x032e('0xf'),auth[_0x032e('0x8')](),controller[_0x032e('0x10')]);router['put'](_0x032e('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x032e('0x12')](_0x032e('0x11'),auth[_0x032e('0x8')](),controller[_0x032e('0x13')]);module[_0x032e('0x14')]=router; \ No newline at end of file +var _0x8f43=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x8f43,0x18b));var _0x38f4=function(_0x1e05aa,_0x41b9c1){_0x1e05aa=_0x1e05aa-0x0;var _0x1cfdf1=_0x8f43[_0x1e05aa];return _0x1cfdf1;};'use strict';var multer=require(_0x38f4('0x0'));var util=require(_0x38f4('0x1'));var path=require(_0x38f4('0x2'));var timeout=require(_0x38f4('0x3'));var express=require(_0x38f4('0x4'));var router=express[_0x38f4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x38f4('0x6'));var config=require(_0x38f4('0x7'));var controller=require(_0x38f4('0x8'));router[_0x38f4('0x9')]('/',auth[_0x38f4('0xa')](),controller['index']);router[_0x38f4('0x9')](_0x38f4('0xb'),auth['isAuthenticated'](),controller[_0x38f4('0xc')]);router['get'](_0x38f4('0xd'),auth[_0x38f4('0xa')](),controller[_0x38f4('0xe')]);router[_0x38f4('0x9')]('/:id/fields',auth[_0x38f4('0xa')](),controller[_0x38f4('0xf')]);router[_0x38f4('0x10')]('/',auth['isAuthenticated'](),controller[_0x38f4('0x11')]);router[_0x38f4('0x10')](_0x38f4('0xd'),auth[_0x38f4('0xa')](),controller[_0x38f4('0x12')]);router[_0x38f4('0x13')](_0x38f4('0xb'),auth[_0x38f4('0xa')](),controller['update']);router[_0x38f4('0x14')]('/:id',auth[_0x38f4('0xa')](),controller[_0x38f4('0x15')]);module[_0x38f4('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index ab12fc7..faebc97 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 _0xe1c0=['exports','STRING','ENUM','integrationTab','newTab'];(function(_0x4517c6,_0x5e1e6e){var _0x4caae5=function(_0x1f798c){while(--_0x1f798c){_0x4517c6['push'](_0x4517c6['shift']());}};_0x4caae5(++_0x5e1e6e);}(_0xe1c0,0x1c2));var _0x0e1c=function(_0x30ec34,_0xd1d1e){_0x30ec34=_0x30ec34-0x0;var _0x2db47a=_0xe1c0[_0x30ec34];return _0x2db47a;};'use strict';var Sequelize=require('sequelize');module[_0x0e1c('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0e1c('0x1')]},'username':{'type':Sequelize[_0x0e1c('0x1')]},'remoteUri':{'type':Sequelize[_0x0e1c('0x1')]},'authType':{'type':Sequelize[_0x0e1c('0x2')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize[_0x0e1c('0x1')]},'consumerKey':{'type':Sequelize[_0x0e1c('0x1')]},'consumerSecret':{'type':Sequelize[_0x0e1c('0x1')]},'token':{'type':Sequelize[_0x0e1c('0x1')]},'tokenSecret':{'type':Sequelize[_0x0e1c('0x1')]},'serverUrl':{'type':Sequelize[_0x0e1c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0e1c('0x2')](_0x0e1c('0x3'),_0x0e1c('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x77a8=['newTab','integrationTab','exports','STRING','ENUM','basic'];(function(_0x5d6270,_0x83b57a){var _0x168f26=function(_0x258a27){while(--_0x258a27){_0x5d6270['push'](_0x5d6270['shift']());}};_0x168f26(++_0x83b57a);}(_0x77a8,0x1f4));var _0x877a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77a8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x877a('0x0')]={'name':{'type':Sequelize[_0x877a('0x1')]},'description':{'type':Sequelize[_0x877a('0x1')]},'username':{'type':Sequelize[_0x877a('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x877a('0x2')](_0x877a('0x3')),'defaultValue':_0x877a('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x877a('0x1')]},'token':{'type':Sequelize[_0x877a('0x1')]},'tokenSecret':{'type':Sequelize[_0x877a('0x1')]},'serverUrl':{'type':Sequelize[_0x877a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x877a('0x2')]('integrationTab',_0x877a('0x4')),'defaultValue':_0x877a('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 34ca105..450d224 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 _0xef07=['length','options','find','create','body','getConfigurations','findOne','DeskConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','password','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','basic','headers','Basic\x20%s','%s:%s','username','toString','_embedded','entries','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','error','stack','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params'];(function(_0x56673d,_0x230c82){var _0x4b1566=function(_0x256501){while(--_0x256501){_0x56673d['push'](_0x56673d['shift']());}};_0x4b1566(++_0x230c82);}(_0xef07,0x179));var _0x7ef0=function(_0x2181b1,_0x569637){_0x2181b1=_0x2181b1-0x0;var _0x530548=_0xef07[_0x2181b1];return _0x530548;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ef0('0x0'));var zipdir=require(_0x7ef0('0x1'));var jsonpatch=require(_0x7ef0('0x2'));var rp=require(_0x7ef0('0x3'));var moment=require(_0x7ef0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7ef0('0x5'));var util=require(_0x7ef0('0x6'));var path=require(_0x7ef0('0x7'));var sox=require(_0x7ef0('0x8'));var csv=require(_0x7ef0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7ef0('0xa'));var _=require(_0x7ef0('0xb'));var squel=require(_0x7ef0('0xc'));var crypto=require('crypto');var jsforce=require(_0x7ef0('0xd'));var deskjs=require(_0x7ef0('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7ef0('0xf'));var Redis=require(_0x7ef0('0x10'));var authService=require(_0x7ef0('0x11'));var qs=require(_0x7ef0('0x12'));var as=require(_0x7ef0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7ef0('0x14'))('api');var utils=require(_0x7ef0('0x15'));var config=require(_0x7ef0('0x16'));var licenseUtil=require(_0x7ef0('0x17'));var db=require(_0x7ef0('0x18'))['db'];var integrations=require(_0x7ef0('0x19'));function respondWithStatusCode(_0x408b73,_0x306475){_0x306475=_0x306475||0xcc;return function(_0x3084a5){if(_0x3084a5){return _0x408b73[_0x7ef0('0x1a')](_0x306475);}return _0x408b73['status'](_0x306475)[_0x7ef0('0x1b')]();};}function respondWithResult(_0xfdd8b,_0x4032b2){_0x4032b2=_0x4032b2||0xc8;return function(_0x177753){if(_0x177753){return _0xfdd8b[_0x7ef0('0x1c')](_0x4032b2)[_0x7ef0('0x1d')](_0x177753);}};}function respondWithFilteredResult(_0x21dd01,_0x6990b7){return function(_0x959a96){if(_0x959a96){var _0x1eb513=typeof _0x6990b7[_0x7ef0('0x1e')]===_0x7ef0('0x1f')&&typeof _0x6990b7['limit']==='undefined';var _0x3cef50=_0x959a96['count'];var _0x402c6d=_0x1eb513?0x0:_0x6990b7[_0x7ef0('0x1e')];var _0x33501c=_0x1eb513?_0x959a96[_0x7ef0('0x20')]:_0x6990b7[_0x7ef0('0x1e')]+_0x6990b7[_0x7ef0('0x21')];var _0x187191;if(_0x33501c>=_0x3cef50){_0x33501c=_0x3cef50;_0x187191=0xc8;}else{_0x187191=0xce;}_0x21dd01[_0x7ef0('0x1c')](_0x187191);return _0x21dd01[_0x7ef0('0x22')]('Content-Range',_0x402c6d+'-'+_0x33501c+'/'+_0x3cef50)[_0x7ef0('0x1d')](_0x959a96);}return null;};}function patchUpdates(_0x4a9114){return function(_0x2c6b21){try{jsonpatch['apply'](_0x2c6b21,_0x4a9114,!![]);}catch(_0x2d93d7){return BPromise[_0x7ef0('0x23')](_0x2d93d7);}return _0x2c6b21[_0x7ef0('0x24')]();};}function saveUpdates(_0x2b67d8,_0x4535f2){return function(_0x2da5e5){if(_0x2da5e5){return _0x2da5e5[_0x7ef0('0x25')](_0x2b67d8)[_0x7ef0('0x26')](function(_0x505438){return _0x505438;});}return null;};}function removeEntity(_0x3d62d7,_0x3a7527){return function(_0x389620){if(_0x389620){return _0x389620[_0x7ef0('0x27')]()['then'](function(){_0x3d62d7[_0x7ef0('0x1c')](0xcc)[_0x7ef0('0x1b')]();});}};}function handleEntityNotFound(_0x32d96f,_0x15601f){return function(_0x590209){if(!_0x590209){_0x32d96f[_0x7ef0('0x1a')](0x194);}return _0x590209;};}function handleError(_0x3a9a81,_0x53c772){_0x53c772=_0x53c772||0x1f4;return function(_0x48bb78){logger[_0x7ef0('0x28')](_0x48bb78[_0x7ef0('0x29')]);if(_0x48bb78[_0x7ef0('0x2a')]){delete _0x48bb78[_0x7ef0('0x2a')];}_0x3a9a81[_0x7ef0('0x1c')](_0x53c772)[_0x7ef0('0x2b')](_0x48bb78);};}exports['index']=function(_0x204ddc,_0x5c25c6){var _0x21de18={},_0x55d050={},_0x197382={'count':0x0,'rows':[]};var _0x4ab2de=_[_0x7ef0('0x2c')](db[_0x7ef0('0x2d')][_0x7ef0('0x2e')],function(_0x388fac){return{'name':_0x388fac[_0x7ef0('0x2f')],'type':_0x388fac[_0x7ef0('0x30')][_0x7ef0('0x31')]};});_0x55d050[_0x7ef0('0x32')]=_[_0x7ef0('0x2c')](_0x4ab2de,_0x7ef0('0x2a'));_0x55d050[_0x7ef0('0x33')]=_[_0x7ef0('0x34')](_0x204ddc['query']);_0x55d050[_0x7ef0('0x35')]=_[_0x7ef0('0x36')](_0x55d050['model'],_0x55d050[_0x7ef0('0x33')]);_0x21de18['attributes']=_[_0x7ef0('0x36')](_0x55d050[_0x7ef0('0x32')],qs[_0x7ef0('0x37')](_0x204ddc[_0x7ef0('0x33')][_0x7ef0('0x37')]));_0x21de18[_0x7ef0('0x38')]=_0x21de18[_0x7ef0('0x38')]['length']?_0x21de18[_0x7ef0('0x38')]:_0x55d050[_0x7ef0('0x32')];if(!_0x204ddc[_0x7ef0('0x33')][_0x7ef0('0x39')](_0x7ef0('0x3a'))){_0x21de18[_0x7ef0('0x21')]=qs['limit'](_0x204ddc[_0x7ef0('0x33')][_0x7ef0('0x21')]);_0x21de18[_0x7ef0('0x1e')]=qs[_0x7ef0('0x1e')](_0x204ddc['query'][_0x7ef0('0x1e')]);}_0x21de18[_0x7ef0('0x3b')]=qs[_0x7ef0('0x3c')](_0x204ddc[_0x7ef0('0x33')][_0x7ef0('0x3c')]);_0x21de18[_0x7ef0('0x3d')]=qs[_0x7ef0('0x35')](_[_0x7ef0('0x3e')](_0x204ddc[_0x7ef0('0x33')],_0x55d050[_0x7ef0('0x35')]),_0x4ab2de);if(_0x204ddc[_0x7ef0('0x33')][_0x7ef0('0x3f')]){_0x21de18[_0x7ef0('0x3d')]=_[_0x7ef0('0x40')](_0x21de18[_0x7ef0('0x3d')],{'$or':_['map'](_0x4ab2de,function(_0x1f6f98){if(_0x1f6f98['type']!=='VIRTUAL'){var _0x5d27b8={};_0x5d27b8[_0x1f6f98[_0x7ef0('0x2a')]]={'$like':'%'+_0x204ddc[_0x7ef0('0x33')][_0x7ef0('0x3f')]+'%'};return _0x5d27b8;}})});}_0x21de18=_['merge']({},_0x21de18,_0x204ddc['options']);var _0x42c990={'where':_0x21de18[_0x7ef0('0x3d')]};return db[_0x7ef0('0x2d')][_0x7ef0('0x20')](_0x42c990)[_0x7ef0('0x26')](function(_0x1f74cc){_0x197382[_0x7ef0('0x20')]=_0x1f74cc;if(_0x204ddc[_0x7ef0('0x33')]['includeAll']){_0x21de18[_0x7ef0('0x41')]=[{'all':!![]}];}return db[_0x7ef0('0x2d')][_0x7ef0('0x42')](_0x21de18);})[_0x7ef0('0x26')](function(_0x1d8a62){_0x197382[_0x7ef0('0x43')]=_0x1d8a62;return _0x197382;})['then'](respondWithFilteredResult(_0x5c25c6,_0x21de18))[_0x7ef0('0x44')](handleError(_0x5c25c6,null));};exports[_0x7ef0('0x45')]=function(_0x1d3369,_0xef5c20){var _0x55d468={'raw':![],'where':{'id':_0x1d3369[_0x7ef0('0x46')]['id']}},_0x39c7f9={};_0x39c7f9[_0x7ef0('0x32')]=_[_0x7ef0('0x34')](db[_0x7ef0('0x2d')][_0x7ef0('0x2e')]);_0x39c7f9[_0x7ef0('0x33')]=_[_0x7ef0('0x34')](_0x1d3369[_0x7ef0('0x33')]);_0x39c7f9[_0x7ef0('0x35')]=_[_0x7ef0('0x36')](_0x39c7f9[_0x7ef0('0x32')],_0x39c7f9[_0x7ef0('0x33')]);_0x55d468[_0x7ef0('0x38')]=_[_0x7ef0('0x36')](_0x39c7f9[_0x7ef0('0x32')],qs[_0x7ef0('0x37')](_0x1d3369['query']['fields']));_0x55d468[_0x7ef0('0x38')]=_0x55d468[_0x7ef0('0x38')][_0x7ef0('0x47')]?_0x55d468['attributes']:_0x39c7f9[_0x7ef0('0x32')];if(_0x1d3369[_0x7ef0('0x33')]['includeAll']){_0x55d468[_0x7ef0('0x41')]=[{'all':!![]}];}_0x55d468=_['merge']({},_0x55d468,_0x1d3369[_0x7ef0('0x48')]);return db[_0x7ef0('0x2d')][_0x7ef0('0x49')](_0x55d468)[_0x7ef0('0x26')](handleEntityNotFound(_0xef5c20,null))['then'](respondWithResult(_0xef5c20,null))[_0x7ef0('0x44')](handleError(_0xef5c20,null));};exports['create']=function(_0x3d5aee,_0x1e8ad6){return db['DeskAccount'][_0x7ef0('0x4a')](_0x3d5aee['body'],{})[_0x7ef0('0x26')](respondWithResult(_0x1e8ad6,0xc9))[_0x7ef0('0x44')](handleError(_0x1e8ad6,null));};exports[_0x7ef0('0x25')]=function(_0x150b27,_0x1132a1){if(_0x150b27[_0x7ef0('0x4b')]['id']){delete _0x150b27[_0x7ef0('0x4b')]['id'];}return db['DeskAccount'][_0x7ef0('0x49')]({'where':{'id':_0x150b27[_0x7ef0('0x46')]['id']}})[_0x7ef0('0x26')](handleEntityNotFound(_0x1132a1,null))[_0x7ef0('0x26')](saveUpdates(_0x150b27[_0x7ef0('0x4b')],null))[_0x7ef0('0x26')](respondWithResult(_0x1132a1,null))[_0x7ef0('0x44')](handleError(_0x1132a1,null));};exports[_0x7ef0('0x27')]=function(_0x5d25e4,_0x3aee38){return db[_0x7ef0('0x2d')]['find']({'where':{'id':_0x5d25e4[_0x7ef0('0x46')]['id']}})[_0x7ef0('0x26')](handleEntityNotFound(_0x3aee38,null))[_0x7ef0('0x26')](removeEntity(_0x3aee38,null))['catch'](handleError(_0x3aee38,null));};exports[_0x7ef0('0x4c')]=function(_0xbdc33,_0x4b35ad,_0x5f377c){var _0x1634dc={};var _0x4a2f56={};var _0x3bdb4d;var _0x2ed4b7;return db['DeskAccount'][_0x7ef0('0x4d')]({'where':{'id':_0xbdc33[_0x7ef0('0x46')]['id']}})[_0x7ef0('0x26')](handleEntityNotFound(_0x4b35ad,null))[_0x7ef0('0x26')](function(_0x520992){if(_0x520992){_0x3bdb4d=_0x520992;_0x4a2f56[_0x7ef0('0x32')]=_[_0x7ef0('0x34')](db[_0x7ef0('0x4e')][_0x7ef0('0x2e')]);_0x4a2f56['query']=_[_0x7ef0('0x34')](_0xbdc33[_0x7ef0('0x33')]);_0x4a2f56[_0x7ef0('0x35')]=_[_0x7ef0('0x36')](_0x4a2f56[_0x7ef0('0x32')],_0x4a2f56[_0x7ef0('0x33')]);_0x1634dc[_0x7ef0('0x38')]=_['intersection'](_0x4a2f56[_0x7ef0('0x32')],qs[_0x7ef0('0x37')](_0xbdc33[_0x7ef0('0x33')][_0x7ef0('0x37')]));_0x1634dc[_0x7ef0('0x38')]=_0x1634dc[_0x7ef0('0x38')][_0x7ef0('0x47')]?_0x1634dc[_0x7ef0('0x38')]:_0x4a2f56[_0x7ef0('0x32')];_0x1634dc[_0x7ef0('0x3b')]=qs[_0x7ef0('0x3c')](_0xbdc33[_0x7ef0('0x33')][_0x7ef0('0x3c')]);_0x1634dc[_0x7ef0('0x3d')]=qs[_0x7ef0('0x35')](_[_0x7ef0('0x3e')](_0xbdc33['query'],_0x4a2f56['filters']));if(_0xbdc33[_0x7ef0('0x33')][_0x7ef0('0x3f')]){_0x1634dc[_0x7ef0('0x3d')]=_['merge'](_0x1634dc[_0x7ef0('0x3d')],{'$or':_[_0x7ef0('0x2c')](_0x1634dc['attributes'],function(_0x471b98){var _0x45802e={};_0x45802e[_0x471b98]={'$like':'%'+_0xbdc33[_0x7ef0('0x33')][_0x7ef0('0x3f')]+'%'};return _0x45802e;})});}_0x1634dc=_[_0x7ef0('0x40')]({},_0x1634dc,_0xbdc33[_0x7ef0('0x48')]);return _0x3bdb4d['getConfigurations'](_0x1634dc);}})[_0x7ef0('0x26')](function(_0x24c4c2){if(_0x24c4c2){_0x2ed4b7=_0x24c4c2[_0x7ef0('0x47')];if(!_0xbdc33['query']['hasOwnProperty'](_0x7ef0('0x3a'))){_0x1634dc[_0x7ef0('0x21')]=qs[_0x7ef0('0x21')](_0xbdc33['query'][_0x7ef0('0x21')]);_0x1634dc[_0x7ef0('0x1e')]=qs[_0x7ef0('0x1e')](_0xbdc33[_0x7ef0('0x33')][_0x7ef0('0x1e')]);}return _0x3bdb4d[_0x7ef0('0x4c')](_0x1634dc);}})[_0x7ef0('0x26')](function(_0x376051){if(_0x376051){return _0x376051?{'count':_0x2ed4b7,'rows':_0x376051}:null;}})[_0x7ef0('0x26')](respondWithResult(_0x4b35ad,null))[_0x7ef0('0x44')](handleError(_0x4b35ad,null));};exports['addConfiguration']=function(_0x290b99,_0x2564b6,_0x10c89a){if(_0x290b99[_0x7ef0('0x4b')]['id']){delete _0x290b99[_0x7ef0('0x4b')]['id'];}return db[_0x7ef0('0x2d')][_0x7ef0('0x4d')]({'where':{'id':_0x290b99[_0x7ef0('0x46')]['id']}})[_0x7ef0('0x26')](handleEntityNotFound(_0x2564b6,null))[_0x7ef0('0x26')](function(_0xe96575){if(_0xe96575){_0x290b99['body'][_0x7ef0('0x4f')]=_0xe96575['id'];_0x290b99[_0x7ef0('0x4b')][_0x7ef0('0x50')]=integrations[_0x7ef0('0x51')](_0x290b99['body'][_0x7ef0('0x52')],_0x290b99[_0x7ef0('0x4b')][_0x7ef0('0x30')]);_0x290b99['body'][_0x7ef0('0x53')]=integrations[_0x7ef0('0x54')](_0x290b99['body'][_0x7ef0('0x52')],_0x290b99[_0x7ef0('0x4b')]['type']);return db['DeskConfiguration']['create'](_0x290b99[_0x7ef0('0x4b')],{'include':[{'model':db[_0x7ef0('0x55')],'as':_0x7ef0('0x50')},{'model':db[_0x7ef0('0x55')],'as':_0x7ef0('0x53')}]});}return null;})['then'](respondWithResult(_0x2564b6,null))['catch'](handleError(_0x2564b6,null));};exports[_0x7ef0('0x56')]=function(_0x3ab1b0,_0x3cb491,_0x466a40){var _0x3530a9=[{'name':_0x7ef0('0x57'),'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 _0x3c3b80='';return db[_0x7ef0('0x2d')][_0x7ef0('0x4d')]({'where':{'id':_0x3ab1b0[_0x7ef0('0x46')]['id']},'attributes':['id',_0x7ef0('0x58'),_0x7ef0('0x59'),'username',_0x7ef0('0x5a'),'consumerKey',_0x7ef0('0x5b'),_0x7ef0('0x5c'),_0x7ef0('0x5d')]})[_0x7ef0('0x26')](handleEntityNotFound(_0x3cb491,null))[_0x7ef0('0x26')](function(_0x30bdc9){if(_0x30bdc9){_0x3c3b80=_0x30bdc9[_0x7ef0('0x58')];var _0x5b3d6e=_0x3c3b80[_0x7ef0('0x5e')](-0x1);if(_0x5b3d6e==='/'){_0x3c3b80=_0x3c3b80[_0x7ef0('0x5f')](0x0,_0x3c3b80[_0x7ef0('0x60')](_0x5b3d6e));}var _0x110a84={'method':_0x7ef0('0x61'),'uri':util[_0x7ef0('0x62')](_0x7ef0('0x63'),_0x3c3b80),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x30bdc9['authType']===_0x7ef0('0x64')){_0x110a84[_0x7ef0('0x65')]['Authorization']=util[_0x7ef0('0x62')](_0x7ef0('0x66'),new Buffer(util[_0x7ef0('0x62')](_0x7ef0('0x67'),_0x30bdc9[_0x7ef0('0x68')],_0x30bdc9[_0x7ef0('0x5a')]))[_0x7ef0('0x69')]('base64'));}return rp(_0x110a84)[_0x7ef0('0x26')](function(_0x3d7ff2){return _0x3530a9['concat'](_[_0x7ef0('0x2c')](_0x3d7ff2[_0x7ef0('0x6a')][_0x7ef0('0x6b')],function(_0x4197ad){return{'id':_0x4197ad[_0x7ef0('0x2a')],'name':_0x4197ad[_0x7ef0('0x2a')],'type':_0x4197ad[_0x7ef0('0x30')],'active':_0x4197ad['active'],'label':_0x4197ad['label'],'custom':!![]};}));});}})['then'](function(_0x26e384){return{'count':_0x26e384[_0x7ef0('0x47')],'rows':_0x26e384};})[_0x7ef0('0x26')](respondWithResult(_0x3cb491,null))['catch'](function(_0x308ae3){var _0x34422c=_0x3ab1b0[_0x7ef0('0x33')][_0x7ef0('0x6c')]?0x1f4:_0x308ae3[_0x7ef0('0x6d')]||0x1f4;logger[_0x7ef0('0x28')](_0x7ef0('0x6e'),_0x7ef0('0x56'),_0x34422c,JSON['stringify'](_0x308ae3));delete _0x308ae3[_0x7ef0('0x2a')];if(_0x34422c===0x191){_0x34422c=0x190;}_0x3cb491[_0x7ef0('0x1c')](_0x34422c)['send'](_0x3ab1b0[_0x7ef0('0x33')][_0x7ef0('0x6c')]?{'message':_0x7ef0('0x6f'),'statusCode':_0x308ae3[_0x7ef0('0x6d')]}:_0x308ae3);});}; \ No newline at end of file +var _0xba16=['remoteUri','authType','username','password','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','concat','_embedded','entries','active','label','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','DeskAccount','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','keys','length','options','find','create','body','getConfigurations','DeskConfiguration','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','DeskField','priority'];(function(_0x1b8f86,_0x4e59d8){var _0x1c4fcf=function(_0x431fb0){while(--_0x431fb0){_0x1b8f86['push'](_0x1b8f86['shift']());}};_0x1c4fcf(++_0x4e59d8);}(_0xba16,0x103));var _0x6ba1=function(_0x20ebb9,_0x3535bb){_0x20ebb9=_0x20ebb9-0x0;var _0x1ec31d=_0xba16[_0x20ebb9];return _0x1ec31d;};'use strict';var emlformat=require(_0x6ba1('0x0'));var rimraf=require(_0x6ba1('0x1'));var zipdir=require(_0x6ba1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6ba1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6ba1('0x4'));var util=require(_0x6ba1('0x5'));var path=require(_0x6ba1('0x6'));var sox=require('sox');var csv=require(_0x6ba1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6ba1('0x8'));var _=require(_0x6ba1('0x9'));var squel=require(_0x6ba1('0xa'));var crypto=require('crypto');var jsforce=require(_0x6ba1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6ba1('0x7'));var querystring=require(_0x6ba1('0xc'));var Papa=require(_0x6ba1('0xd'));var Redis=require('ioredis');var authService=require(_0x6ba1('0xe'));var qs=require(_0x6ba1('0xf'));var as=require(_0x6ba1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ba1('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x6ba1('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ba1('0x13'))['db'];var integrations=require(_0x6ba1('0x14'));function respondWithStatusCode(_0x416cef,_0x24bb25){_0x24bb25=_0x24bb25||0xcc;return function(_0x259eda){if(_0x259eda){return _0x416cef[_0x6ba1('0x15')](_0x24bb25);}return _0x416cef[_0x6ba1('0x16')](_0x24bb25)['end']();};}function respondWithResult(_0x555ab4,_0x55b110){_0x55b110=_0x55b110||0xc8;return function(_0x357ea9){if(_0x357ea9){return _0x555ab4['status'](_0x55b110)[_0x6ba1('0x17')](_0x357ea9);}};}function respondWithFilteredResult(_0x258af3,_0x3ad888){return function(_0x1d6389){if(_0x1d6389){var _0x1223bc=typeof _0x3ad888['offset']===_0x6ba1('0x18')&&typeof _0x3ad888['limit']==='undefined';var _0x5725f9=_0x1d6389[_0x6ba1('0x19')];var _0x59f99f=_0x1223bc?0x0:_0x3ad888[_0x6ba1('0x1a')];var _0x1db970=_0x1223bc?_0x1d6389[_0x6ba1('0x19')]:_0x3ad888['offset']+_0x3ad888[_0x6ba1('0x1b')];var _0x1eccd9;if(_0x1db970>=_0x5725f9){_0x1db970=_0x5725f9;_0x1eccd9=0xc8;}else{_0x1eccd9=0xce;}_0x258af3[_0x6ba1('0x16')](_0x1eccd9);return _0x258af3[_0x6ba1('0x1c')](_0x6ba1('0x1d'),_0x59f99f+'-'+_0x1db970+'/'+_0x5725f9)[_0x6ba1('0x17')](_0x1d6389);}return null;};}function patchUpdates(_0x160549){return function(_0x4d6025){try{jsonpatch[_0x6ba1('0x1e')](_0x4d6025,_0x160549,!![]);}catch(_0xed4b26){return BPromise[_0x6ba1('0x1f')](_0xed4b26);}return _0x4d6025[_0x6ba1('0x20')]();};}function saveUpdates(_0x529ed5,_0x564bdb){return function(_0x261b24){if(_0x261b24){return _0x261b24[_0x6ba1('0x21')](_0x529ed5)[_0x6ba1('0x22')](function(_0x53e0ee){return _0x53e0ee;});}return null;};}function removeEntity(_0x13af1e,_0x190a46){return function(_0x39e218){if(_0x39e218){return _0x39e218[_0x6ba1('0x23')]()[_0x6ba1('0x22')](function(){_0x13af1e[_0x6ba1('0x16')](0xcc)[_0x6ba1('0x24')]();});}};}function handleEntityNotFound(_0x398bba,_0x57cfec){return function(_0x4d803e){if(!_0x4d803e){_0x398bba[_0x6ba1('0x15')](0x194);}return _0x4d803e;};}function handleError(_0x11bdfb,_0x1f9b2a){_0x1f9b2a=_0x1f9b2a||0x1f4;return function(_0x569339){logger[_0x6ba1('0x25')](_0x569339[_0x6ba1('0x26')]);if(_0x569339[_0x6ba1('0x27')]){delete _0x569339['name'];}_0x11bdfb[_0x6ba1('0x16')](_0x1f9b2a)['send'](_0x569339);};}exports[_0x6ba1('0x28')]=function(_0x509f18,_0x558644){var _0x38a498={},_0x47ad3c={},_0x31f946={'count':0x0,'rows':[]};var _0x1b5155=_['map'](db[_0x6ba1('0x29')][_0x6ba1('0x2a')],function(_0x30e2cb){return{'name':_0x30e2cb[_0x6ba1('0x2b')],'type':_0x30e2cb[_0x6ba1('0x2c')]['key']};});_0x47ad3c[_0x6ba1('0x2d')]=_['map'](_0x1b5155,_0x6ba1('0x27'));_0x47ad3c['query']=_['keys'](_0x509f18[_0x6ba1('0x2e')]);_0x47ad3c[_0x6ba1('0x2f')]=_[_0x6ba1('0x30')](_0x47ad3c[_0x6ba1('0x2d')],_0x47ad3c[_0x6ba1('0x2e')]);_0x38a498[_0x6ba1('0x31')]=_['intersection'](_0x47ad3c[_0x6ba1('0x2d')],qs['fields'](_0x509f18[_0x6ba1('0x2e')][_0x6ba1('0x32')]));_0x38a498[_0x6ba1('0x31')]=_0x38a498['attributes']['length']?_0x38a498[_0x6ba1('0x31')]:_0x47ad3c['model'];if(!_0x509f18['query'][_0x6ba1('0x33')](_0x6ba1('0x34'))){_0x38a498[_0x6ba1('0x1b')]=qs[_0x6ba1('0x1b')](_0x509f18[_0x6ba1('0x2e')][_0x6ba1('0x1b')]);_0x38a498[_0x6ba1('0x1a')]=qs[_0x6ba1('0x1a')](_0x509f18[_0x6ba1('0x2e')][_0x6ba1('0x1a')]);}_0x38a498[_0x6ba1('0x35')]=qs[_0x6ba1('0x36')](_0x509f18[_0x6ba1('0x2e')][_0x6ba1('0x36')]);_0x38a498[_0x6ba1('0x37')]=qs[_0x6ba1('0x2f')](_[_0x6ba1('0x38')](_0x509f18['query'],_0x47ad3c[_0x6ba1('0x2f')]),_0x1b5155);if(_0x509f18['query'][_0x6ba1('0x39')]){_0x38a498[_0x6ba1('0x37')]=_['merge'](_0x38a498['where'],{'$or':_[_0x6ba1('0x3a')](_0x1b5155,function(_0x2fa580){if(_0x2fa580['type']!==_0x6ba1('0x3b')){var _0x5268fd={};_0x5268fd[_0x2fa580[_0x6ba1('0x27')]]={'$like':'%'+_0x509f18[_0x6ba1('0x2e')][_0x6ba1('0x39')]+'%'};return _0x5268fd;}})});}_0x38a498=_[_0x6ba1('0x3c')]({},_0x38a498,_0x509f18['options']);var _0x2211e4={'where':_0x38a498['where']};return db[_0x6ba1('0x29')][_0x6ba1('0x19')](_0x2211e4)[_0x6ba1('0x22')](function(_0x2113ef){_0x31f946[_0x6ba1('0x19')]=_0x2113ef;if(_0x509f18['query'][_0x6ba1('0x3d')]){_0x38a498[_0x6ba1('0x3e')]=[{'all':!![]}];}return db[_0x6ba1('0x29')][_0x6ba1('0x3f')](_0x38a498);})[_0x6ba1('0x22')](function(_0x4f271f){_0x31f946[_0x6ba1('0x40')]=_0x4f271f;return _0x31f946;})[_0x6ba1('0x22')](respondWithFilteredResult(_0x558644,_0x38a498))[_0x6ba1('0x41')](handleError(_0x558644,null));};exports['show']=function(_0x115a4a,_0x30c968){var _0x56cc58={'raw':![],'where':{'id':_0x115a4a[_0x6ba1('0x42')]['id']}},_0x438cf2={};_0x438cf2[_0x6ba1('0x2d')]=_[_0x6ba1('0x43')](db['DeskAccount'][_0x6ba1('0x2a')]);_0x438cf2[_0x6ba1('0x2e')]=_[_0x6ba1('0x43')](_0x115a4a[_0x6ba1('0x2e')]);_0x438cf2[_0x6ba1('0x2f')]=_[_0x6ba1('0x30')](_0x438cf2[_0x6ba1('0x2d')],_0x438cf2[_0x6ba1('0x2e')]);_0x56cc58[_0x6ba1('0x31')]=_[_0x6ba1('0x30')](_0x438cf2[_0x6ba1('0x2d')],qs[_0x6ba1('0x32')](_0x115a4a[_0x6ba1('0x2e')][_0x6ba1('0x32')]));_0x56cc58[_0x6ba1('0x31')]=_0x56cc58[_0x6ba1('0x31')][_0x6ba1('0x44')]?_0x56cc58[_0x6ba1('0x31')]:_0x438cf2[_0x6ba1('0x2d')];if(_0x115a4a[_0x6ba1('0x2e')][_0x6ba1('0x3d')]){_0x56cc58['include']=[{'all':!![]}];}_0x56cc58=_[_0x6ba1('0x3c')]({},_0x56cc58,_0x115a4a[_0x6ba1('0x45')]);return db[_0x6ba1('0x29')][_0x6ba1('0x46')](_0x56cc58)['then'](handleEntityNotFound(_0x30c968,null))[_0x6ba1('0x22')](respondWithResult(_0x30c968,null))[_0x6ba1('0x41')](handleError(_0x30c968,null));};exports[_0x6ba1('0x47')]=function(_0x5b6e58,_0x14afe8){return db[_0x6ba1('0x29')][_0x6ba1('0x47')](_0x5b6e58['body'],{})[_0x6ba1('0x22')](respondWithResult(_0x14afe8,0xc9))[_0x6ba1('0x41')](handleError(_0x14afe8,null));};exports[_0x6ba1('0x21')]=function(_0x179b9f,_0x3fd0c0){if(_0x179b9f[_0x6ba1('0x48')]['id']){delete _0x179b9f['body']['id'];}return db['DeskAccount']['find']({'where':{'id':_0x179b9f[_0x6ba1('0x42')]['id']}})[_0x6ba1('0x22')](handleEntityNotFound(_0x3fd0c0,null))[_0x6ba1('0x22')](saveUpdates(_0x179b9f[_0x6ba1('0x48')],null))[_0x6ba1('0x22')](respondWithResult(_0x3fd0c0,null))[_0x6ba1('0x41')](handleError(_0x3fd0c0,null));};exports[_0x6ba1('0x23')]=function(_0x329346,_0x52927f){return db[_0x6ba1('0x29')][_0x6ba1('0x46')]({'where':{'id':_0x329346[_0x6ba1('0x42')]['id']}})[_0x6ba1('0x22')](handleEntityNotFound(_0x52927f,null))[_0x6ba1('0x22')](removeEntity(_0x52927f,null))[_0x6ba1('0x41')](handleError(_0x52927f,null));};exports[_0x6ba1('0x49')]=function(_0x18fbbf,_0x2d42f6,_0x1fb127){var _0x5cd07d={};var _0x2da506={};var _0x273c15;var _0x2a3ddb;return db[_0x6ba1('0x29')]['findOne']({'where':{'id':_0x18fbbf[_0x6ba1('0x42')]['id']}})[_0x6ba1('0x22')](handleEntityNotFound(_0x2d42f6,null))[_0x6ba1('0x22')](function(_0x13f20a){if(_0x13f20a){_0x273c15=_0x13f20a;_0x2da506['model']=_['keys'](db[_0x6ba1('0x4a')][_0x6ba1('0x2a')]);_0x2da506[_0x6ba1('0x2e')]=_[_0x6ba1('0x43')](_0x18fbbf[_0x6ba1('0x2e')]);_0x2da506[_0x6ba1('0x2f')]=_[_0x6ba1('0x30')](_0x2da506[_0x6ba1('0x2d')],_0x2da506['query']);_0x5cd07d[_0x6ba1('0x31')]=_[_0x6ba1('0x30')](_0x2da506['model'],qs[_0x6ba1('0x32')](_0x18fbbf[_0x6ba1('0x2e')][_0x6ba1('0x32')]));_0x5cd07d[_0x6ba1('0x31')]=_0x5cd07d[_0x6ba1('0x31')]['length']?_0x5cd07d['attributes']:_0x2da506[_0x6ba1('0x2d')];_0x5cd07d[_0x6ba1('0x35')]=qs[_0x6ba1('0x36')](_0x18fbbf['query'][_0x6ba1('0x36')]);_0x5cd07d[_0x6ba1('0x37')]=qs[_0x6ba1('0x2f')](_[_0x6ba1('0x38')](_0x18fbbf['query'],_0x2da506[_0x6ba1('0x2f')]));if(_0x18fbbf['query'][_0x6ba1('0x39')]){_0x5cd07d[_0x6ba1('0x37')]=_[_0x6ba1('0x3c')](_0x5cd07d[_0x6ba1('0x37')],{'$or':_[_0x6ba1('0x3a')](_0x5cd07d['attributes'],function(_0x79e471){var _0x393746={};_0x393746[_0x79e471]={'$like':'%'+_0x18fbbf[_0x6ba1('0x2e')][_0x6ba1('0x39')]+'%'};return _0x393746;})});}_0x5cd07d=_['merge']({},_0x5cd07d,_0x18fbbf[_0x6ba1('0x45')]);return _0x273c15[_0x6ba1('0x49')](_0x5cd07d);}})[_0x6ba1('0x22')](function(_0x58dd9c){if(_0x58dd9c){_0x2a3ddb=_0x58dd9c['length'];if(!_0x18fbbf[_0x6ba1('0x2e')][_0x6ba1('0x33')](_0x6ba1('0x34'))){_0x5cd07d[_0x6ba1('0x1b')]=qs[_0x6ba1('0x1b')](_0x18fbbf[_0x6ba1('0x2e')]['limit']);_0x5cd07d[_0x6ba1('0x1a')]=qs[_0x6ba1('0x1a')](_0x18fbbf['query'][_0x6ba1('0x1a')]);}return _0x273c15[_0x6ba1('0x49')](_0x5cd07d);}})[_0x6ba1('0x22')](function(_0x368a23){if(_0x368a23){return _0x368a23?{'count':_0x2a3ddb,'rows':_0x368a23}:null;}})['then'](respondWithResult(_0x2d42f6,null))[_0x6ba1('0x41')](handleError(_0x2d42f6,null));};exports[_0x6ba1('0x4b')]=function(_0x21bb86,_0x5c49ee,_0x35823c){if(_0x21bb86[_0x6ba1('0x48')]['id']){delete _0x21bb86[_0x6ba1('0x48')]['id'];}return db[_0x6ba1('0x29')]['findOne']({'where':{'id':_0x21bb86['params']['id']}})[_0x6ba1('0x22')](handleEntityNotFound(_0x5c49ee,null))[_0x6ba1('0x22')](function(_0x22d61d){if(_0x22d61d){_0x21bb86[_0x6ba1('0x48')][_0x6ba1('0x4c')]=_0x22d61d['id'];_0x21bb86['body'][_0x6ba1('0x4d')]=integrations['getSubjects'](_0x21bb86[_0x6ba1('0x48')]['channel'],_0x21bb86[_0x6ba1('0x48')][_0x6ba1('0x2c')]);_0x21bb86[_0x6ba1('0x48')][_0x6ba1('0x4e')]=integrations[_0x6ba1('0x4f')](_0x21bb86[_0x6ba1('0x48')][_0x6ba1('0x50')],_0x21bb86[_0x6ba1('0x48')][_0x6ba1('0x2c')]);return db['DeskConfiguration'][_0x6ba1('0x47')](_0x21bb86['body'],{'include':[{'model':db[_0x6ba1('0x51')],'as':_0x6ba1('0x4d')},{'model':db['DeskField'],'as':_0x6ba1('0x4e')}]});}return null;})[_0x6ba1('0x22')](respondWithResult(_0x5c49ee,null))[_0x6ba1('0x41')](handleError(_0x5c49ee,null));};exports['getFields']=function(_0x3a7e9a,_0x1bde2c,_0x4d445b){var _0x5f3057=[{'name':'priority','label':_0x6ba1('0x52'),'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 _0x4d8d71='';return db[_0x6ba1('0x29')]['findOne']({'where':{'id':_0x3a7e9a['params']['id']},'attributes':['id',_0x6ba1('0x53'),_0x6ba1('0x54'),_0x6ba1('0x55'),_0x6ba1('0x56'),'consumerKey',_0x6ba1('0x57'),_0x6ba1('0x58'),_0x6ba1('0x59')]})['then'](handleEntityNotFound(_0x1bde2c,null))['then'](function(_0x4a3f64){if(_0x4a3f64){_0x4d8d71=_0x4a3f64['remoteUri'];var _0x5868c1=_0x4d8d71[_0x6ba1('0x5a')](-0x1);if(_0x5868c1==='/'){_0x4d8d71=_0x4d8d71[_0x6ba1('0x5b')](0x0,_0x4d8d71[_0x6ba1('0x5c')](_0x5868c1));}var _0x133c1d={'method':_0x6ba1('0x5d'),'uri':util[_0x6ba1('0x5e')](_0x6ba1('0x5f'),_0x4d8d71),'headers':{'Content-Type':'application/json','Accept':_0x6ba1('0x60')},'json':!![]};if(_0x4a3f64[_0x6ba1('0x54')]===_0x6ba1('0x61')){_0x133c1d[_0x6ba1('0x62')][_0x6ba1('0x63')]=util[_0x6ba1('0x5e')](_0x6ba1('0x64'),new Buffer(util[_0x6ba1('0x5e')](_0x6ba1('0x65'),_0x4a3f64['username'],_0x4a3f64[_0x6ba1('0x56')]))[_0x6ba1('0x66')]('base64'));}return rp(_0x133c1d)[_0x6ba1('0x22')](function(_0x253b6b){return _0x5f3057[_0x6ba1('0x67')](_['map'](_0x253b6b[_0x6ba1('0x68')][_0x6ba1('0x69')],function(_0x50766a){return{'id':_0x50766a[_0x6ba1('0x27')],'name':_0x50766a[_0x6ba1('0x27')],'type':_0x50766a[_0x6ba1('0x2c')],'active':_0x50766a[_0x6ba1('0x6a')],'label':_0x50766a[_0x6ba1('0x6b')],'custom':!![]};}));});}})[_0x6ba1('0x22')](function(_0x42512f){return{'count':_0x42512f[_0x6ba1('0x44')],'rows':_0x42512f};})[_0x6ba1('0x22')](respondWithResult(_0x1bde2c,null))[_0x6ba1('0x41')](function(_0x4cb3af){var _0x5878b6=_0x3a7e9a[_0x6ba1('0x2e')][_0x6ba1('0x6c')]?0x1f4:_0x4cb3af['statusCode']||0x1f4;logger[_0x6ba1('0x25')](_0x6ba1('0x6d'),_0x6ba1('0x6e'),_0x5878b6,JSON[_0x6ba1('0x6f')](_0x4cb3af));delete _0x4cb3af[_0x6ba1('0x27')];if(_0x5878b6===0x191){_0x5878b6=0x190;}_0x1bde2c[_0x6ba1('0x16')](_0x5878b6)[_0x6ba1('0x70')](_0x3a7e9a['query'][_0x6ba1('0x6c')]?{'message':_0x6ba1('0x71'),'statusCode':_0x4cb3af['statusCode']}:_0x4cb3af);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 90f44d9..18c6dde 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 _0xe819=['rimraf','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','lodash','../../config/logger','api','moment','bluebird'];(function(_0x298d9d,_0x133bdf){var _0x26fb6e=function(_0x2c69a8){while(--_0x2c69a8){_0x298d9d['push'](_0x298d9d['shift']());}};_0x26fb6e(++_0x133bdf);}(_0xe819,0x95));var _0x9e81=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe819[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x9e81('0x0'));var util=require('util');var logger=require(_0x9e81('0x1'))(_0x9e81('0x2'));var moment=require(_0x9e81('0x3'));var BPromise=require(_0x9e81('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9e81('0x5'));var config=require(_0x9e81('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x9e81('0x7'));module[_0x9e81('0x8')]=function(_0x20a90d,_0x10d982){return _0x20a90d[_0x9e81('0x9')](_0x9e81('0xa'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc86=['request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','exports','define','DeskAccount','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xefbf85,_0x377821){var _0x3a849b=function(_0x58ba38){while(--_0x58ba38){_0xefbf85['push'](_0xefbf85['shift']());}};_0x3a849b(++_0x377821);}(_0xdc86,0xa2));var _0x6dc8=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0xdc86[_0x4b73a2];return _0x383c66;};'use strict';var _=require(_0x6dc8('0x0'));var util=require(_0x6dc8('0x1'));var logger=require(_0x6dc8('0x2'))(_0x6dc8('0x3'));var moment=require(_0x6dc8('0x4'));var BPromise=require(_0x6dc8('0x5'));var rp=require(_0x6dc8('0x6'));var fs=require('fs');var path=require(_0x6dc8('0x7'));var rimraf=require(_0x6dc8('0x8'));var config=require(_0x6dc8('0x9'));var attributes=require(_0x6dc8('0xa'));var integrations=require('../../components/integrations/configuration');module[_0x6dc8('0xb')]=function(_0xcec211,_0x320023){return _0xcec211[_0x6dc8('0xc')](_0x6dc8('0xd'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 9e3a917..47d915b 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 _0x6823=['rpc','client','http','info','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','GetDeskAccount','options','where','attributes','limit','include','map','model','then','ShowDeskAccount','DeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x6823,0x14c));var _0x3682=function(_0x1aee77,_0x5a6167){_0x1aee77=_0x1aee77-0x0;var _0x3129f8=_0x6823[_0x1aee77];return _0x3129f8;};'use strict';var _=require(_0x3682('0x0'));var util=require(_0x3682('0x1'));var moment=require(_0x3682('0x2'));var BPromise=require(_0x3682('0x3'));var rs=require(_0x3682('0x4'));var fs=require('fs');var Redis=require(_0x3682('0x5'));var db=require(_0x3682('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3682('0x7'))(_0x3682('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3682('0x9')][_0x3682('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c7f60,_0x1b6b6f,_0x3f9413){return new BPromise(function(_0x5d957b,_0x16af37){return client['request'](_0x4c7f60,_0x3f9413)['then'](function(_0x2a2045){logger[_0x3682('0xb')]('DeskAccount,\x20%s,\x20%s',_0x1b6b6f,'request\x20sent');logger[_0x3682('0xc')](_0x3682('0xd'),_0x1b6b6f,'request\x20sent',JSON[_0x3682('0xe')](_0x2a2045));if(_0x2a2045[_0x3682('0xf')]){if(_0x2a2045['error'][_0x3682('0x10')]===0x1f4){logger['error'](_0x3682('0x11'),_0x1b6b6f,_0x2a2045[_0x3682('0xf')][_0x3682('0x12')]);return _0x16af37(_0x2a2045[_0x3682('0xf')][_0x3682('0x12')]);}logger[_0x3682('0xf')](_0x3682('0x11'),_0x1b6b6f,_0x2a2045[_0x3682('0xf')][_0x3682('0x12')]);return _0x5d957b(_0x2a2045[_0x3682('0xf')][_0x3682('0x12')]);}else{logger[_0x3682('0xb')]('DeskAccount,\x20%s,\x20%s',_0x1b6b6f,_0x3682('0x13'));_0x5d957b(_0x2a2045[_0x3682('0x14')][_0x3682('0x12')]);}})[_0x3682('0x15')](function(_0x230493){logger[_0x3682('0xf')](_0x3682('0x11'),_0x1b6b6f,_0x230493);_0x16af37(_0x230493);});});}exports[_0x3682('0x16')]=function(_0x1019ab){var _0x1a6d40=this;return new Promise(function(_0x152982,_0x477dc6){return db['DeskAccount']['findAll']({'raw':_0x1019ab[_0x3682('0x17')]?_0x1019ab['options']['raw']===undefined?!![]:![]:!![],'where':_0x1019ab[_0x3682('0x17')]?_0x1019ab[_0x3682('0x17')][_0x3682('0x18')]||null:null,'attributes':_0x1019ab['options']?_0x1019ab[_0x3682('0x17')][_0x3682('0x19')]||null:null,'limit':_0x1019ab[_0x3682('0x17')]?_0x1019ab[_0x3682('0x17')][_0x3682('0x1a')]||null:null,'include':_0x1019ab[_0x3682('0x17')]?_0x1019ab[_0x3682('0x17')][_0x3682('0x1b')]?_[_0x3682('0x1c')](_0x1019ab['options']['include'],function(_0x3029e6){return{'model':db[_0x3029e6['model']],'as':_0x3029e6['as'],'attributes':_0x3029e6[_0x3682('0x19')],'include':_0x3029e6['include']?_[_0x3682('0x1c')](_0x3029e6['include'],function(_0x21e876){return{'model':db[_0x21e876['model']],'as':_0x21e876['as'],'attributes':_0x21e876[_0x3682('0x19')],'include':_0x21e876[_0x3682('0x1b')]?_[_0x3682('0x1c')](_0x21e876[_0x3682('0x1b')],function(_0x5170b4){return{'model':db[_0x5170b4[_0x3682('0x1d')]],'as':_0x5170b4['as'],'attributes':_0x5170b4[_0x3682('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3682('0x1e')](function(_0x97cdb7){logger[_0x3682('0xb')](_0x3682('0x16'),_0x1019ab);logger[_0x3682('0xc')](_0x3682('0x16'),_0x1019ab,JSON[_0x3682('0xe')](_0x97cdb7));_0x152982(_0x97cdb7);})[_0x3682('0x15')](function(_0x118f63){logger[_0x3682('0xf')](_0x3682('0x16'),_0x118f63[_0x3682('0x12')],_0x1019ab);_0x477dc6(_0x1a6d40['error'](0x1f4,_0x118f63[_0x3682('0x12')]));});});};exports[_0x3682('0x1f')]=function(_0x49e8f0){var _0x16ef68=this;return new Promise(function(_0x5a53bc,_0x3e2735){return db[_0x3682('0x20')][_0x3682('0x21')]({'raw':_0x49e8f0['options']?_0x49e8f0[_0x3682('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x49e8f0[_0x3682('0x17')]?_0x49e8f0['options'][_0x3682('0x18')]||null:null,'attributes':_0x49e8f0[_0x3682('0x17')]?_0x49e8f0['options'][_0x3682('0x19')]||null:null,'include':_0x49e8f0['options']?_0x49e8f0[_0x3682('0x17')][_0x3682('0x1b')]?_['map'](_0x49e8f0[_0x3682('0x17')][_0x3682('0x1b')],function(_0x143e2b){return{'model':db[_0x143e2b[_0x3682('0x1d')]],'as':_0x143e2b['as'],'attributes':_0x143e2b['attributes'],'include':_0x143e2b[_0x3682('0x1b')]?_['map'](_0x143e2b[_0x3682('0x1b')],function(_0x283ffd){return{'model':db[_0x283ffd[_0x3682('0x1d')]],'as':_0x283ffd['as'],'attributes':_0x283ffd['attributes'],'include':_0x283ffd['include']?_[_0x3682('0x1c')](_0x283ffd[_0x3682('0x1b')],function(_0x49a9d7){return{'model':db[_0x49a9d7['model']],'as':_0x49a9d7['as'],'attributes':_0x49a9d7[_0x3682('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3682('0x1e')](function(_0x55ef7a){logger[_0x3682('0xb')](_0x3682('0x1f'),_0x49e8f0);logger[_0x3682('0xc')](_0x3682('0x1f'),_0x49e8f0,JSON[_0x3682('0xe')](_0x55ef7a));_0x5a53bc(_0x55ef7a);})[_0x3682('0x15')](function(_0x2092ba){logger['error'](_0x3682('0x1f'),_0x2092ba[_0x3682('0x12')],_0x49e8f0);_0x3e2735(_0x16ef68[_0x3682('0xf')](0x1f4,_0x2092ba[_0x3682('0x12')]));});});}; \ No newline at end of file +var _0x5f47=['client','request','info','request\x20sent','debug','stringify','error','DeskAccount,\x20%s,\x20%s','message','catch','GetDeskAccount','findAll','options','raw','attributes','include','map','model','then','ShowDeskAccount','DeskAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xa7bd2c,_0x49c8db){var _0x49cb8f=function(_0x2a207b){while(--_0x2a207b){_0xa7bd2c['push'](_0xa7bd2c['shift']());}};_0x49cb8f(++_0x49c8db);}(_0x5f47,0x127));var _0x75f4=function(_0x53ca8c,_0x31388c){_0x53ca8c=_0x53ca8c-0x0;var _0x1964b9=_0x5f47[_0x53ca8c];return _0x1964b9;};'use strict';var _=require(_0x75f4('0x0'));var util=require(_0x75f4('0x1'));var moment=require(_0x75f4('0x2'));var BPromise=require(_0x75f4('0x3'));var rs=require(_0x75f4('0x4'));var fs=require('fs');var Redis=require(_0x75f4('0x5'));var db=require(_0x75f4('0x6'))['db'];var utils=require(_0x75f4('0x7'));var logger=require(_0x75f4('0x8'))('rpc');var config=require(_0x75f4('0x9'));var jayson=require(_0x75f4('0xa'));var client=jayson[_0x75f4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ee01b,_0x3018be,_0x467a90){return new BPromise(function(_0x2c2a35,_0x1bf701){return client[_0x75f4('0xc')](_0x2ee01b,_0x467a90)['then'](function(_0xefd38c){logger[_0x75f4('0xd')]('DeskAccount,\x20%s,\x20%s',_0x3018be,_0x75f4('0xe'));logger[_0x75f4('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x3018be,_0x75f4('0xe'),JSON[_0x75f4('0x10')](_0xefd38c));if(_0xefd38c[_0x75f4('0x11')]){if(_0xefd38c['error']['code']===0x1f4){logger[_0x75f4('0x11')](_0x75f4('0x12'),_0x3018be,_0xefd38c[_0x75f4('0x11')]['message']);return _0x1bf701(_0xefd38c[_0x75f4('0x11')][_0x75f4('0x13')]);}logger[_0x75f4('0x11')](_0x75f4('0x12'),_0x3018be,_0xefd38c[_0x75f4('0x11')][_0x75f4('0x13')]);return _0x2c2a35(_0xefd38c['error']['message']);}else{logger[_0x75f4('0xd')]('DeskAccount,\x20%s,\x20%s',_0x3018be,_0x75f4('0xe'));_0x2c2a35(_0xefd38c['result'][_0x75f4('0x13')]);}})[_0x75f4('0x14')](function(_0x3a3666){logger['error']('DeskAccount,\x20%s,\x20%s',_0x3018be,_0x3a3666);_0x1bf701(_0x3a3666);});});}exports[_0x75f4('0x15')]=function(_0x4782e4){var _0x29bc47=this;return new Promise(function(_0x4e63c9,_0x1469ce){return db['DeskAccount'][_0x75f4('0x16')]({'raw':_0x4782e4[_0x75f4('0x17')]?_0x4782e4[_0x75f4('0x17')][_0x75f4('0x18')]===undefined?!![]:![]:!![],'where':_0x4782e4[_0x75f4('0x17')]?_0x4782e4[_0x75f4('0x17')]['where']||null:null,'attributes':_0x4782e4[_0x75f4('0x17')]?_0x4782e4[_0x75f4('0x17')][_0x75f4('0x19')]||null:null,'limit':_0x4782e4[_0x75f4('0x17')]?_0x4782e4[_0x75f4('0x17')]['limit']||null:null,'include':_0x4782e4[_0x75f4('0x17')]?_0x4782e4['options'][_0x75f4('0x1a')]?_[_0x75f4('0x1b')](_0x4782e4['options'][_0x75f4('0x1a')],function(_0x166a7c){return{'model':db[_0x166a7c['model']],'as':_0x166a7c['as'],'attributes':_0x166a7c[_0x75f4('0x19')],'include':_0x166a7c['include']?_[_0x75f4('0x1b')](_0x166a7c[_0x75f4('0x1a')],function(_0x2176d4){return{'model':db[_0x2176d4['model']],'as':_0x2176d4['as'],'attributes':_0x2176d4[_0x75f4('0x19')],'include':_0x2176d4['include']?_[_0x75f4('0x1b')](_0x2176d4[_0x75f4('0x1a')],function(_0x21fc9d){return{'model':db[_0x21fc9d[_0x75f4('0x1c')]],'as':_0x21fc9d['as'],'attributes':_0x21fc9d[_0x75f4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x75f4('0x1d')](function(_0x281da9){logger['info'](_0x75f4('0x15'),_0x4782e4);logger[_0x75f4('0xf')](_0x75f4('0x15'),_0x4782e4,JSON[_0x75f4('0x10')](_0x281da9));_0x4e63c9(_0x281da9);})['catch'](function(_0x3381c2){logger[_0x75f4('0x11')](_0x75f4('0x15'),_0x3381c2[_0x75f4('0x13')],_0x4782e4);_0x1469ce(_0x29bc47[_0x75f4('0x11')](0x1f4,_0x3381c2[_0x75f4('0x13')]));});});};exports[_0x75f4('0x1e')]=function(_0xc5431a){var _0x438e36=this;return new Promise(function(_0x19f54e,_0x18db74){return db[_0x75f4('0x1f')][_0x75f4('0x20')]({'raw':_0xc5431a[_0x75f4('0x17')]?_0xc5431a['options'][_0x75f4('0x18')]===undefined?!![]:![]:!![],'where':_0xc5431a['options']?_0xc5431a['options'][_0x75f4('0x21')]||null:null,'attributes':_0xc5431a['options']?_0xc5431a['options'][_0x75f4('0x19')]||null:null,'include':_0xc5431a[_0x75f4('0x17')]?_0xc5431a[_0x75f4('0x17')][_0x75f4('0x1a')]?_['map'](_0xc5431a[_0x75f4('0x17')]['include'],function(_0x152d91){return{'model':db[_0x152d91[_0x75f4('0x1c')]],'as':_0x152d91['as'],'attributes':_0x152d91[_0x75f4('0x19')],'include':_0x152d91[_0x75f4('0x1a')]?_[_0x75f4('0x1b')](_0x152d91[_0x75f4('0x1a')],function(_0xd77127){return{'model':db[_0xd77127['model']],'as':_0xd77127['as'],'attributes':_0xd77127[_0x75f4('0x19')],'include':_0xd77127[_0x75f4('0x1a')]?_[_0x75f4('0x1b')](_0xd77127[_0x75f4('0x1a')],function(_0x24a6f4){return{'model':db[_0x24a6f4[_0x75f4('0x1c')]],'as':_0x24a6f4['as'],'attributes':_0x24a6f4[_0x75f4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x75f4('0x1d')](function(_0x56bd42){logger['info'](_0x75f4('0x1e'),_0xc5431a);logger[_0x75f4('0xf')](_0x75f4('0x1e'),_0xc5431a,JSON[_0x75f4('0x10')](_0x56bd42));_0x19f54e(_0x56bd42);})[_0x75f4('0x14')](function(_0x5f044a){logger[_0x75f4('0x11')](_0x75f4('0x1e'),_0x5f044a[_0x75f4('0x13')],_0xc5431a);_0x18db74(_0x438e36['error'](0x1f4,_0x5f044a[_0x75f4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 285cccf..79e870d 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 _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x257a28,_0x2cd00d){var _0x13bccc=function(_0x32c46f){while(--_0x32c46f){_0x257a28['push'](_0x257a28['shift']());}};_0x13bccc(++_0x2cd00d);}(_0x55ca,0x126));var _0xa55c=function(_0x3eaea7,_0x9968ff){_0x3eaea7=_0x3eaea7-0x0;var _0xd7cd35=_0x55ca[_0x3eaea7];return _0xd7cd35;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x34a6cf,_0xdc76d7){var _0x35369c=function(_0x3abbf3){while(--_0x3abbf3){_0x34a6cf['push'](_0x34a6cf['shift']());}};_0x35369c(++_0xdc76d7);}(_0x7217,0x19e));var _0x7721=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x7217[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index f2971c1..2a33e47 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 _0x6000=['STRING','exports'];(function(_0x4c825d,_0x10ec2b){var _0x43de87=function(_0xcab4a3){while(--_0xcab4a3){_0x4c825d['push'](_0x4c825d['shift']());}};_0x43de87(++_0x10ec2b);}(_0x6000,0x97));var _0x0600=function(_0x1d0372,_0x1250ac){_0x1d0372=_0x1d0372-0x0;var _0x3662b0=_0x6000[_0x1d0372];return _0x3662b0;};'use strict';var Sequelize=require('sequelize');module[_0x0600('0x0')]={'name':{'type':Sequelize[_0x0600('0x1')]},'description':{'type':Sequelize[_0x0600('0x1')]}}; \ No newline at end of file +var _0xf6af=['STRING','sequelize','exports'];(function(_0x1a0303,_0x6508d3){var _0x4f9bee=function(_0x6d0f04){while(--_0x6d0f04){_0x1a0303['push'](_0x1a0303['shift']());}};_0x4f9bee(++_0x6508d3);}(_0xf6af,0x9a));var _0xff6a=function(_0x411cd5,_0x1719c4){_0x411cd5=_0x411cd5-0x0;var _0x36c697=_0xf6af[_0x411cd5];return _0x36c697;};'use strict';var Sequelize=require(_0xff6a('0x0'));module[_0xff6a('0x1')]={'name':{'type':Sequelize[_0xff6a('0x2')]},'description':{'type':Sequelize[_0xff6a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 361cd1d..1728d1c 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 _0x7f82=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','getFields','DeskField','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x49cea7,_0x7c394b){var _0x18b9e5=function(_0x5f1f2b){while(--_0x5f1f2b){_0x49cea7['push'](_0x49cea7['shift']());}};_0x18b9e5(++_0x7c394b);}(_0x7f82,0xa0));var _0x27f8=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x7f82[_0x1b828b];return _0x98da1a;};'use strict';var emlformat=require(_0x27f8('0x0'));var rimraf=require(_0x27f8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x27f8('0x2'));var rp=require(_0x27f8('0x3'));var moment=require(_0x27f8('0x4'));var BPromise=require(_0x27f8('0x5'));var Mustache=require('mustache');var util=require(_0x27f8('0x6'));var path=require(_0x27f8('0x7'));var sox=require(_0x27f8('0x8'));var csv=require(_0x27f8('0x9'));var ejs=require(_0x27f8('0xa'));var fs=require('fs');var fs_extra=require(_0x27f8('0xb'));var _=require('lodash');var squel=require(_0x27f8('0xc'));var crypto=require(_0x27f8('0xd'));var jsforce=require(_0x27f8('0xe'));var deskjs=require(_0x27f8('0xf'));var toCsv=require(_0x27f8('0x9'));var querystring=require(_0x27f8('0x10'));var Papa=require(_0x27f8('0x11'));var Redis=require(_0x27f8('0x12'));var authService=require(_0x27f8('0x13'));var qs=require(_0x27f8('0x14'));var as=require(_0x27f8('0x15'));var hardwareService=require(_0x27f8('0x16'));var logger=require(_0x27f8('0x17'))(_0x27f8('0x18'));var utils=require(_0x27f8('0x19'));var config=require(_0x27f8('0x1a'));var licenseUtil=require(_0x27f8('0x1b'));var db=require(_0x27f8('0x1c'))['db'];function respondWithStatusCode(_0x456631,_0x41d003){_0x41d003=_0x41d003||0xcc;return function(_0x2b8626){if(_0x2b8626){return _0x456631[_0x27f8('0x1d')](_0x41d003);}return _0x456631[_0x27f8('0x1e')](_0x41d003)[_0x27f8('0x1f')]();};}function respondWithResult(_0x5b9ab9,_0x355054){_0x355054=_0x355054||0xc8;return function(_0x419718){if(_0x419718){return _0x5b9ab9[_0x27f8('0x1e')](_0x355054)[_0x27f8('0x20')](_0x419718);}};}function respondWithFilteredResult(_0x5cce26,_0x327dbb){return function(_0x18f289){if(_0x18f289){var _0x1459e3=typeof _0x327dbb[_0x27f8('0x21')]===_0x27f8('0x22')&&typeof _0x327dbb['limit']===_0x27f8('0x22');var _0x1e1f60=_0x18f289[_0x27f8('0x23')];var _0xe1d26f=_0x1459e3?0x0:_0x327dbb[_0x27f8('0x21')];var _0x978cd7=_0x1459e3?_0x18f289['count']:_0x327dbb['offset']+_0x327dbb[_0x27f8('0x24')];var _0xec6d4b;if(_0x978cd7>=_0x1e1f60){_0x978cd7=_0x1e1f60;_0xec6d4b=0xc8;}else{_0xec6d4b=0xce;}_0x5cce26[_0x27f8('0x1e')](_0xec6d4b);return _0x5cce26[_0x27f8('0x25')](_0x27f8('0x26'),_0xe1d26f+'-'+_0x978cd7+'/'+_0x1e1f60)[_0x27f8('0x20')](_0x18f289);}return null;};}function patchUpdates(_0x1866a4){return function(_0x5ec5c1){try{jsonpatch[_0x27f8('0x27')](_0x5ec5c1,_0x1866a4,!![]);}catch(_0x4179e0){return BPromise[_0x27f8('0x28')](_0x4179e0);}return _0x5ec5c1['save']();};}function saveUpdates(_0x155fda,_0x3f8c03){return function(_0x50ae86){if(_0x50ae86){return _0x50ae86[_0x27f8('0x29')](_0x155fda)[_0x27f8('0x2a')](function(_0x40a6de){return _0x40a6de;});}return null;};}function removeEntity(_0x93449b,_0x4463a6){return function(_0x3de1ce){if(_0x3de1ce){return _0x3de1ce['destroy']()[_0x27f8('0x2a')](function(){_0x93449b[_0x27f8('0x1e')](0xcc)[_0x27f8('0x1f')]();});}};}function handleEntityNotFound(_0x8a6d0e,_0x613daa){return function(_0x50404e){if(!_0x50404e){_0x8a6d0e[_0x27f8('0x1d')](0x194);}return _0x50404e;};}function handleError(_0x13e955,_0x38a1d9){_0x38a1d9=_0x38a1d9||0x1f4;return function(_0xce8b7e){logger[_0x27f8('0x2b')](_0xce8b7e[_0x27f8('0x2c')]);if(_0xce8b7e[_0x27f8('0x2d')]){delete _0xce8b7e[_0x27f8('0x2d')];}_0x13e955['status'](_0x38a1d9)[_0x27f8('0x2e')](_0xce8b7e);};}exports[_0x27f8('0x2f')]=function(_0x1fc9dd,_0x5e3732){var _0x4e9786={},_0x5964e3={},_0x338c5d={'count':0x0,'rows':[]};var _0x479bef=_[_0x27f8('0x30')](db[_0x27f8('0x31')][_0x27f8('0x32')],function(_0x15c271){return{'name':_0x15c271[_0x27f8('0x33')],'type':_0x15c271[_0x27f8('0x34')][_0x27f8('0x35')]};});_0x5964e3[_0x27f8('0x36')]=_['map'](_0x479bef,'name');_0x5964e3['query']=_[_0x27f8('0x37')](_0x1fc9dd[_0x27f8('0x38')]);_0x5964e3[_0x27f8('0x39')]=_['intersection'](_0x5964e3['model'],_0x5964e3['query']);_0x4e9786[_0x27f8('0x3a')]=_[_0x27f8('0x3b')](_0x5964e3[_0x27f8('0x36')],qs[_0x27f8('0x3c')](_0x1fc9dd[_0x27f8('0x38')]['fields']));_0x4e9786['attributes']=_0x4e9786[_0x27f8('0x3a')][_0x27f8('0x3d')]?_0x4e9786[_0x27f8('0x3a')]:_0x5964e3['model'];if(!_0x1fc9dd[_0x27f8('0x38')][_0x27f8('0x3e')](_0x27f8('0x3f'))){_0x4e9786[_0x27f8('0x24')]=qs['limit'](_0x1fc9dd[_0x27f8('0x38')]['limit']);_0x4e9786[_0x27f8('0x21')]=qs[_0x27f8('0x21')](_0x1fc9dd['query'][_0x27f8('0x21')]);}_0x4e9786[_0x27f8('0x40')]=qs[_0x27f8('0x41')](_0x1fc9dd['query'][_0x27f8('0x41')]);_0x4e9786['where']=qs[_0x27f8('0x39')](_[_0x27f8('0x42')](_0x1fc9dd[_0x27f8('0x38')],_0x5964e3[_0x27f8('0x39')]),_0x479bef);if(_0x1fc9dd[_0x27f8('0x38')]['filter']){_0x4e9786[_0x27f8('0x43')]=_[_0x27f8('0x44')](_0x4e9786[_0x27f8('0x43')],{'$or':_[_0x27f8('0x30')](_0x479bef,function(_0x26f665){if(_0x26f665[_0x27f8('0x34')]!==_0x27f8('0x45')){var _0x25638a={};_0x25638a[_0x26f665[_0x27f8('0x2d')]]={'$like':'%'+_0x1fc9dd[_0x27f8('0x38')][_0x27f8('0x46')]+'%'};return _0x25638a;}})});}_0x4e9786=_[_0x27f8('0x44')]({},_0x4e9786,_0x1fc9dd[_0x27f8('0x47')]);var _0x5cdf1a={'where':_0x4e9786['where']};return db[_0x27f8('0x31')]['count'](_0x5cdf1a)[_0x27f8('0x2a')](function(_0x8f999f){_0x338c5d['count']=_0x8f999f;if(_0x1fc9dd[_0x27f8('0x38')][_0x27f8('0x48')]){_0x4e9786[_0x27f8('0x49')]=[{'all':!![]}];}return db[_0x27f8('0x31')][_0x27f8('0x4a')](_0x4e9786);})[_0x27f8('0x2a')](function(_0x40cd7e){_0x338c5d[_0x27f8('0x4b')]=_0x40cd7e;return _0x338c5d;})['then'](respondWithFilteredResult(_0x5e3732,_0x4e9786))[_0x27f8('0x4c')](handleError(_0x5e3732,null));};exports[_0x27f8('0x4d')]=function(_0x195c82,_0xb676eb){var _0xa72328={'raw':![],'where':{'id':_0x195c82['params']['id']}},_0x39126d={};_0x39126d[_0x27f8('0x36')]=_['keys'](db[_0x27f8('0x31')]['rawAttributes']);_0x39126d[_0x27f8('0x38')]=_[_0x27f8('0x37')](_0x195c82['query']);_0x39126d[_0x27f8('0x39')]=_[_0x27f8('0x3b')](_0x39126d[_0x27f8('0x36')],_0x39126d['query']);_0xa72328[_0x27f8('0x3a')]=_[_0x27f8('0x3b')](_0x39126d['model'],qs[_0x27f8('0x3c')](_0x195c82[_0x27f8('0x38')]['fields']));_0xa72328['attributes']=_0xa72328[_0x27f8('0x3a')][_0x27f8('0x3d')]?_0xa72328[_0x27f8('0x3a')]:_0x39126d['model'];if(_0x195c82[_0x27f8('0x38')][_0x27f8('0x48')]){_0xa72328[_0x27f8('0x49')]=[{'all':!![]}];}_0xa72328=_['merge']({},_0xa72328,_0x195c82[_0x27f8('0x47')]);return db['DeskConfiguration'][_0x27f8('0x4e')](_0xa72328)['then'](handleEntityNotFound(_0xb676eb,null))[_0x27f8('0x2a')](respondWithResult(_0xb676eb,null))[_0x27f8('0x4c')](handleError(_0xb676eb,null));};exports[_0x27f8('0x4f')]=function(_0x1cc510,_0x8b7e16){return db[_0x27f8('0x31')][_0x27f8('0x4f')](_0x1cc510[_0x27f8('0x50')],{})[_0x27f8('0x2a')](respondWithResult(_0x8b7e16,0xc9))[_0x27f8('0x4c')](handleError(_0x8b7e16,null));};exports['update']=function(_0x45d1bd,_0x257615){if(_0x45d1bd[_0x27f8('0x50')]['id']){delete _0x45d1bd[_0x27f8('0x50')]['id'];}return db[_0x27f8('0x31')][_0x27f8('0x4e')]({'where':{'id':_0x45d1bd[_0x27f8('0x51')]['id']}})['then'](handleEntityNotFound(_0x257615,null))[_0x27f8('0x2a')](saveUpdates(_0x45d1bd[_0x27f8('0x50')],null))[_0x27f8('0x2a')](respondWithResult(_0x257615,null))[_0x27f8('0x4c')](handleError(_0x257615,null));};exports[_0x27f8('0x52')]=function(_0x226a7f,_0x1888e4){return db[_0x27f8('0x31')]['find']({'where':{'id':_0x226a7f[_0x27f8('0x51')]['id']}})[_0x27f8('0x2a')](handleEntityNotFound(_0x1888e4,null))['then'](removeEntity(_0x1888e4,null))['catch'](handleError(_0x1888e4,null));};exports[_0x27f8('0x53')]=function(_0xc32a2a,_0x45e29b,_0x2fcefb){var _0x5e68ad={};var _0x58224c={};var _0x5573b0;var _0x465eb3;return db[_0x27f8('0x31')]['findOne']({'where':{'id':_0xc32a2a[_0x27f8('0x51')]['id']}})[_0x27f8('0x2a')](handleEntityNotFound(_0x45e29b,null))[_0x27f8('0x2a')](function(_0x59a460){if(_0x59a460){_0x5573b0=_0x59a460;_0x58224c[_0x27f8('0x36')]=_[_0x27f8('0x37')](db[_0x27f8('0x54')][_0x27f8('0x32')]);_0x58224c[_0x27f8('0x38')]=_[_0x27f8('0x37')](_0xc32a2a[_0x27f8('0x38')]);_0x58224c[_0x27f8('0x39')]=_['intersection'](_0x58224c[_0x27f8('0x36')],_0x58224c[_0x27f8('0x38')]);_0x5e68ad['attributes']=_[_0x27f8('0x3b')](_0x58224c[_0x27f8('0x36')],qs['fields'](_0xc32a2a['query'][_0x27f8('0x3c')]));_0x5e68ad[_0x27f8('0x3a')]=_0x5e68ad[_0x27f8('0x3a')]['length']?_0x5e68ad[_0x27f8('0x3a')]:_0x58224c['model'];_0x5e68ad['order']=qs[_0x27f8('0x41')](_0xc32a2a['query'][_0x27f8('0x41')]);_0x5e68ad[_0x27f8('0x43')]=qs[_0x27f8('0x39')](_[_0x27f8('0x42')](_0xc32a2a[_0x27f8('0x38')],_0x58224c['filters']));if(_0xc32a2a['query'][_0x27f8('0x46')]){_0x5e68ad[_0x27f8('0x43')]=_[_0x27f8('0x44')](_0x5e68ad[_0x27f8('0x43')],{'$or':_[_0x27f8('0x30')](_0x5e68ad['attributes'],function(_0x3dac45){var _0x54f5d7={};_0x54f5d7[_0x3dac45]={'$like':'%'+_0xc32a2a[_0x27f8('0x38')]['filter']+'%'};return _0x54f5d7;})});}_0x5e68ad=_[_0x27f8('0x44')]({},_0x5e68ad,_0xc32a2a[_0x27f8('0x47')]);return _0x5573b0[_0x27f8('0x53')](_0x5e68ad);}})[_0x27f8('0x2a')](function(_0x5cf5ac){if(_0x5cf5ac){_0x465eb3=_0x5cf5ac['length'];if(!_0xc32a2a[_0x27f8('0x38')]['hasOwnProperty'](_0x27f8('0x3f'))){_0x5e68ad[_0x27f8('0x24')]=qs[_0x27f8('0x24')](_0xc32a2a['query'][_0x27f8('0x24')]);_0x5e68ad['offset']=qs[_0x27f8('0x21')](_0xc32a2a['query'][_0x27f8('0x21')]);}return _0x5573b0[_0x27f8('0x53')](_0x5e68ad);}})[_0x27f8('0x2a')](function(_0x39857d){if(_0x39857d){return _0x39857d?{'count':_0x465eb3,'rows':_0x39857d}:null;}})[_0x27f8('0x2a')](respondWithResult(_0x45e29b,null))[_0x27f8('0x4c')](handleError(_0x45e29b,null));};exports[_0x27f8('0x55')]=function(_0x393e3b,_0x113649,_0x6b23bb){var _0x5e9e0b={};var _0x3efeb3={};var _0xf28202;var _0x48de8c;return db[_0x27f8('0x31')][_0x27f8('0x56')]({'where':{'id':_0x393e3b[_0x27f8('0x51')]['id']}})[_0x27f8('0x2a')](handleEntityNotFound(_0x113649,null))[_0x27f8('0x2a')](function(_0x5d0369){if(_0x5d0369){_0xf28202=_0x5d0369;_0x3efeb3[_0x27f8('0x36')]=_[_0x27f8('0x37')](db[_0x27f8('0x54')][_0x27f8('0x32')]);_0x3efeb3[_0x27f8('0x38')]=_['keys'](_0x393e3b[_0x27f8('0x38')]);_0x3efeb3[_0x27f8('0x39')]=_[_0x27f8('0x3b')](_0x3efeb3['model'],_0x3efeb3[_0x27f8('0x38')]);_0x5e9e0b[_0x27f8('0x3a')]=_[_0x27f8('0x3b')](_0x3efeb3[_0x27f8('0x36')],qs['fields'](_0x393e3b['query'][_0x27f8('0x3c')]));_0x5e9e0b['attributes']=_0x5e9e0b[_0x27f8('0x3a')][_0x27f8('0x3d')]?_0x5e9e0b['attributes']:_0x3efeb3[_0x27f8('0x36')];_0x5e9e0b[_0x27f8('0x40')]=qs[_0x27f8('0x41')](_0x393e3b[_0x27f8('0x38')]['sort']);_0x5e9e0b[_0x27f8('0x43')]=qs[_0x27f8('0x39')](_[_0x27f8('0x42')](_0x393e3b[_0x27f8('0x38')],_0x3efeb3['filters']));if(_0x393e3b['query'][_0x27f8('0x46')]){_0x5e9e0b[_0x27f8('0x43')]=_[_0x27f8('0x44')](_0x5e9e0b['where'],{'$or':_[_0x27f8('0x30')](_0x5e9e0b[_0x27f8('0x3a')],function(_0x1ad1ed){var _0x26346f={};_0x26346f[_0x1ad1ed]={'$like':'%'+_0x393e3b[_0x27f8('0x38')][_0x27f8('0x46')]+'%'};return _0x26346f;})});}_0x5e9e0b=_[_0x27f8('0x44')]({},_0x5e9e0b,_0x393e3b[_0x27f8('0x47')]);return _0xf28202[_0x27f8('0x55')](_0x5e9e0b);}})[_0x27f8('0x2a')](function(_0x1116b){if(_0x1116b){_0x48de8c=_0x1116b['length'];if(!_0x393e3b[_0x27f8('0x38')][_0x27f8('0x3e')](_0x27f8('0x3f'))){_0x5e9e0b['limit']=qs['limit'](_0x393e3b[_0x27f8('0x38')]['limit']);_0x5e9e0b[_0x27f8('0x21')]=qs[_0x27f8('0x21')](_0x393e3b[_0x27f8('0x38')][_0x27f8('0x21')]);}return _0xf28202['getSubjects'](_0x5e9e0b);}})[_0x27f8('0x2a')](function(_0x2c95b4){if(_0x2c95b4){return _0x2c95b4?{'count':_0x48de8c,'rows':_0x2c95b4}:null;}})[_0x27f8('0x2a')](respondWithResult(_0x113649,null))['catch'](handleError(_0x113649,null));};exports[_0x27f8('0x57')]=function(_0x12f14c,_0x5853eb,_0x3da3fa){var _0x5be59a={};var _0xd88531={};var _0x2f8c33;var _0x169e54;return db['DeskConfiguration']['findOne']({'where':{'id':_0x12f14c[_0x27f8('0x51')]['id']}})[_0x27f8('0x2a')](handleEntityNotFound(_0x5853eb,null))['then'](function(_0x17de04){if(_0x17de04){_0x2f8c33=_0x17de04;_0xd88531[_0x27f8('0x36')]=_[_0x27f8('0x37')](db[_0x27f8('0x54')][_0x27f8('0x32')]);_0xd88531[_0x27f8('0x38')]=_['keys'](_0x12f14c[_0x27f8('0x38')]);_0xd88531[_0x27f8('0x39')]=_['intersection'](_0xd88531[_0x27f8('0x36')],_0xd88531['query']);_0x5be59a[_0x27f8('0x3a')]=_[_0x27f8('0x3b')](_0xd88531[_0x27f8('0x36')],qs[_0x27f8('0x3c')](_0x12f14c[_0x27f8('0x38')]['fields']));_0x5be59a[_0x27f8('0x3a')]=_0x5be59a[_0x27f8('0x3a')][_0x27f8('0x3d')]?_0x5be59a['attributes']:_0xd88531[_0x27f8('0x36')];_0x5be59a[_0x27f8('0x40')]=qs[_0x27f8('0x41')](_0x12f14c[_0x27f8('0x38')][_0x27f8('0x41')]);_0x5be59a['where']=qs[_0x27f8('0x39')](_[_0x27f8('0x42')](_0x12f14c['query'],_0xd88531[_0x27f8('0x39')]));if(_0x12f14c['query'][_0x27f8('0x46')]){_0x5be59a['where']=_[_0x27f8('0x44')](_0x5be59a['where'],{'$or':_[_0x27f8('0x30')](_0x5be59a['attributes'],function(_0x51bf8d){var _0x567ad3={};_0x567ad3[_0x51bf8d]={'$like':'%'+_0x12f14c[_0x27f8('0x38')][_0x27f8('0x46')]+'%'};return _0x567ad3;})});}_0x5be59a=_[_0x27f8('0x44')]({},_0x5be59a,_0x12f14c[_0x27f8('0x47')]);return _0x2f8c33[_0x27f8('0x57')](_0x5be59a);}})[_0x27f8('0x2a')](function(_0x92b323){if(_0x92b323){_0x169e54=_0x92b323[_0x27f8('0x3d')];if(!_0x12f14c[_0x27f8('0x38')]['hasOwnProperty'](_0x27f8('0x3f'))){_0x5be59a[_0x27f8('0x24')]=qs[_0x27f8('0x24')](_0x12f14c[_0x27f8('0x38')]['limit']);_0x5be59a[_0x27f8('0x21')]=qs[_0x27f8('0x21')](_0x12f14c[_0x27f8('0x38')][_0x27f8('0x21')]);}return _0x2f8c33[_0x27f8('0x57')](_0x5be59a);}})[_0x27f8('0x2a')](function(_0x530e23){if(_0x530e23){return _0x530e23?{'count':_0x169e54,'rows':_0x530e23}:null;}})[_0x27f8('0x2a')](respondWithResult(_0x5853eb,null))[_0x27f8('0x4c')](handleError(_0x5853eb,null));};exports[_0x27f8('0x58')]=function(_0x575899,_0x1452f2,_0x1704f1){var _0x5d95e6={};var _0x2b703e={};var _0x25502a;var _0x350d8f;return db['DeskConfiguration'][_0x27f8('0x56')]({'where':{'id':_0x575899['params']['id']}})[_0x27f8('0x2a')](handleEntityNotFound(_0x1452f2,null))[_0x27f8('0x2a')](function(_0x567289){if(_0x567289){_0x25502a=_0x567289;_0x2b703e[_0x27f8('0x36')]=_['keys'](db[_0x27f8('0x59')]['rawAttributes']);_0x2b703e[_0x27f8('0x38')]=_[_0x27f8('0x37')](_0x575899[_0x27f8('0x38')]);_0x2b703e[_0x27f8('0x39')]=_[_0x27f8('0x3b')](_0x2b703e[_0x27f8('0x36')],_0x2b703e['query']);_0x5d95e6[_0x27f8('0x3a')]=_[_0x27f8('0x3b')](_0x2b703e['model'],qs[_0x27f8('0x3c')](_0x575899['query']['fields']));_0x5d95e6['attributes']=_0x5d95e6[_0x27f8('0x3a')]['length']?_0x5d95e6['attributes']:_0x2b703e['model'];_0x5d95e6[_0x27f8('0x40')]=qs[_0x27f8('0x41')](_0x575899[_0x27f8('0x38')]['sort']);_0x5d95e6[_0x27f8('0x43')]=qs[_0x27f8('0x39')](_[_0x27f8('0x42')](_0x575899[_0x27f8('0x38')],_0x2b703e['filters']));if(_0x575899[_0x27f8('0x38')]['filter']){_0x5d95e6[_0x27f8('0x43')]=_['merge'](_0x5d95e6[_0x27f8('0x43')],{'$or':_[_0x27f8('0x30')](_0x5d95e6[_0x27f8('0x3a')],function(_0x4fb9f1){var _0x549794={};_0x549794[_0x4fb9f1]={'$like':'%'+_0x575899[_0x27f8('0x38')][_0x27f8('0x46')]+'%'};return _0x549794;})});}_0x5d95e6=_[_0x27f8('0x44')]({},_0x5d95e6,_0x575899['options']);return _0x25502a['getTags'](_0x5d95e6);}})[_0x27f8('0x2a')](function(_0x19f6c7){if(_0x19f6c7){_0x350d8f=_0x19f6c7[_0x27f8('0x3d')];if(!_0x575899['query'][_0x27f8('0x3e')](_0x27f8('0x3f'))){_0x5d95e6['limit']=qs[_0x27f8('0x24')](_0x575899[_0x27f8('0x38')]['limit']);_0x5d95e6['offset']=qs[_0x27f8('0x21')](_0x575899[_0x27f8('0x38')][_0x27f8('0x21')]);}return _0x25502a[_0x27f8('0x58')](_0x5d95e6);}})[_0x27f8('0x2a')](function(_0x15c6f6){if(_0x15c6f6){return _0x15c6f6?{'count':_0x350d8f,'rows':_0x15c6f6}:null;}})[_0x27f8('0x2a')](respondWithResult(_0x1452f2,null))[_0x27f8('0x4c')](handleError(_0x1452f2,null));};exports[_0x27f8('0x5a')]=function(_0x36109c,_0x92033b,_0x315557){if(_0x36109c[_0x27f8('0x50')]['id']){delete _0x36109c[_0x27f8('0x50')]['id'];}return db['DeskConfiguration'][_0x27f8('0x56')]({'where':{'id':_0x36109c[_0x27f8('0x51')]['id']}})[_0x27f8('0x2a')](handleEntityNotFound(_0x92033b,null))[_0x27f8('0x2a')](function(_0x3e28b4){if(_0x3e28b4){return _0x3e28b4['setTags'](_0x36109c[_0x27f8('0x50')][_0x27f8('0x5b')]||[]);}return null;})[_0x27f8('0x2a')](respondWithResult(_0x92033b,null))['catch'](handleError(_0x92033b,null));}; \ No newline at end of file +var _0x542d=['merge','type','VIRTUAL','include','DeskConfiguration','findAll','catch','params','rawAttributes','includeAll','create','body','find','getFields','findOne','DeskField','sort','options','hasOwnProperty','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','where','pick','filter'];(function(_0x3e7fa2,_0xfb2bc1){var _0x146896=function(_0x2de799){while(--_0x2de799){_0x3e7fa2['push'](_0x3e7fa2['shift']());}};_0x146896(++_0xfb2bc1);}(_0x542d,0x71));var _0xd542=function(_0x4052e4,_0xe88c3b){_0x4052e4=_0x4052e4-0x0;var _0x2bf8c7=_0x542d[_0x4052e4];return _0x2bf8c7;};'use strict';var emlformat=require(_0xd542('0x0'));var rimraf=require(_0xd542('0x1'));var zipdir=require(_0xd542('0x2'));var jsonpatch=require(_0xd542('0x3'));var rp=require(_0xd542('0x4'));var moment=require(_0xd542('0x5'));var BPromise=require(_0xd542('0x6'));var Mustache=require(_0xd542('0x7'));var util=require(_0xd542('0x8'));var path=require('path');var sox=require(_0xd542('0x9'));var csv=require('to-csv');var ejs=require(_0xd542('0xa'));var fs=require('fs');var fs_extra=require(_0xd542('0xb'));var _=require(_0xd542('0xc'));var squel=require(_0xd542('0xd'));var crypto=require(_0xd542('0xe'));var jsforce=require(_0xd542('0xf'));var deskjs=require(_0xd542('0x10'));var toCsv=require(_0xd542('0x11'));var querystring=require(_0xd542('0x12'));var Papa=require('papaparse');var Redis=require(_0xd542('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd542('0x14'));var as=require(_0xd542('0x15'));var hardwareService=require(_0xd542('0x16'));var logger=require(_0xd542('0x17'))(_0xd542('0x18'));var utils=require(_0xd542('0x19'));var config=require(_0xd542('0x1a'));var licenseUtil=require(_0xd542('0x1b'));var db=require(_0xd542('0x1c'))['db'];function respondWithStatusCode(_0x3969c1,_0x16263e){_0x16263e=_0x16263e||0xcc;return function(_0x37ef34){if(_0x37ef34){return _0x3969c1[_0xd542('0x1d')](_0x16263e);}return _0x3969c1[_0xd542('0x1e')](_0x16263e)['end']();};}function respondWithResult(_0x2ee681,_0x3223a6){_0x3223a6=_0x3223a6||0xc8;return function(_0x2e61b6){if(_0x2e61b6){return _0x2ee681[_0xd542('0x1e')](_0x3223a6)[_0xd542('0x1f')](_0x2e61b6);}};}function respondWithFilteredResult(_0x224c60,_0x177cbf){return function(_0x212190){if(_0x212190){var _0x12dd99=typeof _0x177cbf[_0xd542('0x20')]===_0xd542('0x21')&&typeof _0x177cbf[_0xd542('0x22')]===_0xd542('0x21');var _0x213b5c=_0x212190[_0xd542('0x23')];var _0x468861=_0x12dd99?0x0:_0x177cbf['offset'];var _0x338534=_0x12dd99?_0x212190[_0xd542('0x23')]:_0x177cbf[_0xd542('0x20')]+_0x177cbf['limit'];var _0x143dd2;if(_0x338534>=_0x213b5c){_0x338534=_0x213b5c;_0x143dd2=0xc8;}else{_0x143dd2=0xce;}_0x224c60[_0xd542('0x1e')](_0x143dd2);return _0x224c60[_0xd542('0x24')](_0xd542('0x25'),_0x468861+'-'+_0x338534+'/'+_0x213b5c)[_0xd542('0x1f')](_0x212190);}return null;};}function patchUpdates(_0x2f077f){return function(_0x384b02){try{jsonpatch['apply'](_0x384b02,_0x2f077f,!![]);}catch(_0x5d71bb){return BPromise[_0xd542('0x26')](_0x5d71bb);}return _0x384b02[_0xd542('0x27')]();};}function saveUpdates(_0x593a18,_0x3d77aa){return function(_0x302723){if(_0x302723){return _0x302723[_0xd542('0x28')](_0x593a18)[_0xd542('0x29')](function(_0x47a7ed){return _0x47a7ed;});}return null;};}function removeEntity(_0x3f1100,_0x4895c1){return function(_0x4c3339){if(_0x4c3339){return _0x4c3339[_0xd542('0x2a')]()[_0xd542('0x29')](function(){_0x3f1100['status'](0xcc)[_0xd542('0x2b')]();});}};}function handleEntityNotFound(_0x284aab,_0x3bc311){return function(_0x36a826){if(!_0x36a826){_0x284aab[_0xd542('0x1d')](0x194);}return _0x36a826;};}function handleError(_0x38e475,_0x162221){_0x162221=_0x162221||0x1f4;return function(_0xe41d69){logger[_0xd542('0x2c')](_0xe41d69['stack']);if(_0xe41d69[_0xd542('0x2d')]){delete _0xe41d69['name'];}_0x38e475[_0xd542('0x1e')](_0x162221)[_0xd542('0x2e')](_0xe41d69);};}exports[_0xd542('0x2f')]=function(_0x4acfba,_0x29bb91){var _0x5cbadd={},_0x17c35e={},_0x5b5f2c={'count':0x0,'rows':[]};var _0x3097a3=_[_0xd542('0x30')](db['DeskConfiguration']['rawAttributes'],function(_0x7ce335){return{'name':_0x7ce335[_0xd542('0x31')],'type':_0x7ce335['type'][_0xd542('0x32')]};});_0x17c35e[_0xd542('0x33')]=_['map'](_0x3097a3,_0xd542('0x2d'));_0x17c35e[_0xd542('0x34')]=_[_0xd542('0x35')](_0x4acfba[_0xd542('0x34')]);_0x17c35e[_0xd542('0x36')]=_[_0xd542('0x37')](_0x17c35e[_0xd542('0x33')],_0x17c35e[_0xd542('0x34')]);_0x5cbadd[_0xd542('0x38')]=_[_0xd542('0x37')](_0x17c35e['model'],qs[_0xd542('0x39')](_0x4acfba[_0xd542('0x34')][_0xd542('0x39')]));_0x5cbadd['attributes']=_0x5cbadd[_0xd542('0x38')][_0xd542('0x3a')]?_0x5cbadd['attributes']:_0x17c35e[_0xd542('0x33')];if(!_0x4acfba[_0xd542('0x34')]['hasOwnProperty']('nolimit')){_0x5cbadd[_0xd542('0x22')]=qs['limit'](_0x4acfba['query'][_0xd542('0x22')]);_0x5cbadd[_0xd542('0x20')]=qs[_0xd542('0x20')](_0x4acfba[_0xd542('0x34')][_0xd542('0x20')]);}_0x5cbadd[_0xd542('0x3b')]=qs['sort'](_0x4acfba[_0xd542('0x34')]['sort']);_0x5cbadd[_0xd542('0x3c')]=qs[_0xd542('0x36')](_[_0xd542('0x3d')](_0x4acfba['query'],_0x17c35e[_0xd542('0x36')]),_0x3097a3);if(_0x4acfba[_0xd542('0x34')][_0xd542('0x3e')]){_0x5cbadd[_0xd542('0x3c')]=_[_0xd542('0x3f')](_0x5cbadd['where'],{'$or':_[_0xd542('0x30')](_0x3097a3,function(_0x3d8980){if(_0x3d8980[_0xd542('0x40')]!==_0xd542('0x41')){var _0x1ce422={};_0x1ce422[_0x3d8980[_0xd542('0x2d')]]={'$like':'%'+_0x4acfba[_0xd542('0x34')]['filter']+'%'};return _0x1ce422;}})});}_0x5cbadd=_[_0xd542('0x3f')]({},_0x5cbadd,_0x4acfba['options']);var _0x3783e2={'where':_0x5cbadd[_0xd542('0x3c')]};return db['DeskConfiguration'][_0xd542('0x23')](_0x3783e2)[_0xd542('0x29')](function(_0xd0f8){_0x5b5f2c['count']=_0xd0f8;if(_0x4acfba['query']['includeAll']){_0x5cbadd[_0xd542('0x42')]=[{'all':!![]}];}return db[_0xd542('0x43')][_0xd542('0x44')](_0x5cbadd);})['then'](function(_0x4cf08a){_0x5b5f2c['rows']=_0x4cf08a;return _0x5b5f2c;})[_0xd542('0x29')](respondWithFilteredResult(_0x29bb91,_0x5cbadd))[_0xd542('0x45')](handleError(_0x29bb91,null));};exports['show']=function(_0x4818be,_0x5ca3b3){var _0x3c7c74={'raw':![],'where':{'id':_0x4818be[_0xd542('0x46')]['id']}},_0x2232e2={};_0x2232e2['model']=_[_0xd542('0x35')](db['DeskConfiguration'][_0xd542('0x47')]);_0x2232e2[_0xd542('0x34')]=_[_0xd542('0x35')](_0x4818be[_0xd542('0x34')]);_0x2232e2['filters']=_[_0xd542('0x37')](_0x2232e2[_0xd542('0x33')],_0x2232e2[_0xd542('0x34')]);_0x3c7c74[_0xd542('0x38')]=_['intersection'](_0x2232e2['model'],qs['fields'](_0x4818be[_0xd542('0x34')][_0xd542('0x39')]));_0x3c7c74[_0xd542('0x38')]=_0x3c7c74[_0xd542('0x38')][_0xd542('0x3a')]?_0x3c7c74[_0xd542('0x38')]:_0x2232e2[_0xd542('0x33')];if(_0x4818be[_0xd542('0x34')][_0xd542('0x48')]){_0x3c7c74[_0xd542('0x42')]=[{'all':!![]}];}_0x3c7c74=_[_0xd542('0x3f')]({},_0x3c7c74,_0x4818be['options']);return db[_0xd542('0x43')]['find'](_0x3c7c74)[_0xd542('0x29')](handleEntityNotFound(_0x5ca3b3,null))['then'](respondWithResult(_0x5ca3b3,null))[_0xd542('0x45')](handleError(_0x5ca3b3,null));};exports[_0xd542('0x49')]=function(_0x30bd04,_0x17aef3){return db['DeskConfiguration']['create'](_0x30bd04[_0xd542('0x4a')],{})[_0xd542('0x29')](respondWithResult(_0x17aef3,0xc9))['catch'](handleError(_0x17aef3,null));};exports['update']=function(_0x5111ed,_0x14c176){if(_0x5111ed[_0xd542('0x4a')]['id']){delete _0x5111ed[_0xd542('0x4a')]['id'];}return db['DeskConfiguration'][_0xd542('0x4b')]({'where':{'id':_0x5111ed[_0xd542('0x46')]['id']}})['then'](handleEntityNotFound(_0x14c176,null))['then'](saveUpdates(_0x5111ed[_0xd542('0x4a')],null))['then'](respondWithResult(_0x14c176,null))[_0xd542('0x45')](handleError(_0x14c176,null));};exports[_0xd542('0x2a')]=function(_0x33ddad,_0x5059e3){return db['DeskConfiguration']['find']({'where':{'id':_0x33ddad['params']['id']}})['then'](handleEntityNotFound(_0x5059e3,null))[_0xd542('0x29')](removeEntity(_0x5059e3,null))[_0xd542('0x45')](handleError(_0x5059e3,null));};exports[_0xd542('0x4c')]=function(_0x40de4b,_0x46b679,_0x2e20ac){var _0x3cca60={};var _0x360b4c={};var _0x33d887;var _0x2111b0;return db[_0xd542('0x43')][_0xd542('0x4d')]({'where':{'id':_0x40de4b[_0xd542('0x46')]['id']}})[_0xd542('0x29')](handleEntityNotFound(_0x46b679,null))[_0xd542('0x29')](function(_0x4d57f4){if(_0x4d57f4){_0x33d887=_0x4d57f4;_0x360b4c[_0xd542('0x33')]=_[_0xd542('0x35')](db[_0xd542('0x4e')][_0xd542('0x47')]);_0x360b4c[_0xd542('0x34')]=_[_0xd542('0x35')](_0x40de4b[_0xd542('0x34')]);_0x360b4c[_0xd542('0x36')]=_['intersection'](_0x360b4c[_0xd542('0x33')],_0x360b4c[_0xd542('0x34')]);_0x3cca60[_0xd542('0x38')]=_[_0xd542('0x37')](_0x360b4c['model'],qs[_0xd542('0x39')](_0x40de4b[_0xd542('0x34')][_0xd542('0x39')]));_0x3cca60[_0xd542('0x38')]=_0x3cca60['attributes'][_0xd542('0x3a')]?_0x3cca60[_0xd542('0x38')]:_0x360b4c[_0xd542('0x33')];_0x3cca60['order']=qs[_0xd542('0x4f')](_0x40de4b[_0xd542('0x34')][_0xd542('0x4f')]);_0x3cca60['where']=qs[_0xd542('0x36')](_[_0xd542('0x3d')](_0x40de4b[_0xd542('0x34')],_0x360b4c[_0xd542('0x36')]));if(_0x40de4b[_0xd542('0x34')][_0xd542('0x3e')]){_0x3cca60[_0xd542('0x3c')]=_[_0xd542('0x3f')](_0x3cca60[_0xd542('0x3c')],{'$or':_[_0xd542('0x30')](_0x3cca60[_0xd542('0x38')],function(_0x183576){var _0x4c65ec={};_0x4c65ec[_0x183576]={'$like':'%'+_0x40de4b['query']['filter']+'%'};return _0x4c65ec;})});}_0x3cca60=_[_0xd542('0x3f')]({},_0x3cca60,_0x40de4b[_0xd542('0x50')]);return _0x33d887[_0xd542('0x4c')](_0x3cca60);}})[_0xd542('0x29')](function(_0x352116){if(_0x352116){_0x2111b0=_0x352116[_0xd542('0x3a')];if(!_0x40de4b[_0xd542('0x34')][_0xd542('0x51')](_0xd542('0x52'))){_0x3cca60[_0xd542('0x22')]=qs['limit'](_0x40de4b[_0xd542('0x34')]['limit']);_0x3cca60[_0xd542('0x20')]=qs['offset'](_0x40de4b['query'][_0xd542('0x20')]);}return _0x33d887[_0xd542('0x4c')](_0x3cca60);}})['then'](function(_0x276e38){if(_0x276e38){return _0x276e38?{'count':_0x2111b0,'rows':_0x276e38}:null;}})['then'](respondWithResult(_0x46b679,null))[_0xd542('0x45')](handleError(_0x46b679,null));};exports['getSubjects']=function(_0x1ff60a,_0x497847,_0x27cc72){var _0x5a4ff0={};var _0x4ee4a3={};var _0x2edbd3;var _0x452811;return db[_0xd542('0x43')]['findOne']({'where':{'id':_0x1ff60a[_0xd542('0x46')]['id']}})['then'](handleEntityNotFound(_0x497847,null))[_0xd542('0x29')](function(_0x362d4c){if(_0x362d4c){_0x2edbd3=_0x362d4c;_0x4ee4a3[_0xd542('0x33')]=_[_0xd542('0x35')](db[_0xd542('0x4e')][_0xd542('0x47')]);_0x4ee4a3[_0xd542('0x34')]=_[_0xd542('0x35')](_0x1ff60a[_0xd542('0x34')]);_0x4ee4a3[_0xd542('0x36')]=_['intersection'](_0x4ee4a3[_0xd542('0x33')],_0x4ee4a3['query']);_0x5a4ff0[_0xd542('0x38')]=_[_0xd542('0x37')](_0x4ee4a3[_0xd542('0x33')],qs['fields'](_0x1ff60a[_0xd542('0x34')][_0xd542('0x39')]));_0x5a4ff0[_0xd542('0x38')]=_0x5a4ff0[_0xd542('0x38')]['length']?_0x5a4ff0['attributes']:_0x4ee4a3['model'];_0x5a4ff0['order']=qs[_0xd542('0x4f')](_0x1ff60a[_0xd542('0x34')]['sort']);_0x5a4ff0[_0xd542('0x3c')]=qs[_0xd542('0x36')](_['pick'](_0x1ff60a['query'],_0x4ee4a3[_0xd542('0x36')]));if(_0x1ff60a[_0xd542('0x34')]['filter']){_0x5a4ff0[_0xd542('0x3c')]=_[_0xd542('0x3f')](_0x5a4ff0[_0xd542('0x3c')],{'$or':_[_0xd542('0x30')](_0x5a4ff0[_0xd542('0x38')],function(_0xd9123b){var _0x355db0={};_0x355db0[_0xd9123b]={'$like':'%'+_0x1ff60a[_0xd542('0x34')][_0xd542('0x3e')]+'%'};return _0x355db0;})});}_0x5a4ff0=_[_0xd542('0x3f')]({},_0x5a4ff0,_0x1ff60a['options']);return _0x2edbd3[_0xd542('0x53')](_0x5a4ff0);}})[_0xd542('0x29')](function(_0x19e8ee){if(_0x19e8ee){_0x452811=_0x19e8ee[_0xd542('0x3a')];if(!_0x1ff60a['query'][_0xd542('0x51')]('nolimit')){_0x5a4ff0[_0xd542('0x22')]=qs[_0xd542('0x22')](_0x1ff60a[_0xd542('0x34')][_0xd542('0x22')]);_0x5a4ff0[_0xd542('0x20')]=qs[_0xd542('0x20')](_0x1ff60a[_0xd542('0x34')][_0xd542('0x20')]);}return _0x2edbd3[_0xd542('0x53')](_0x5a4ff0);}})['then'](function(_0x438bdd){if(_0x438bdd){return _0x438bdd?{'count':_0x452811,'rows':_0x438bdd}:null;}})[_0xd542('0x29')](respondWithResult(_0x497847,null))[_0xd542('0x45')](handleError(_0x497847,null));};exports[_0xd542('0x54')]=function(_0x2d810a,_0x134c4b,_0x3f30e6){var _0x171b18={};var _0x548e65={};var _0x58ed9c;var _0x38df14;return db[_0xd542('0x43')]['findOne']({'where':{'id':_0x2d810a[_0xd542('0x46')]['id']}})['then'](handleEntityNotFound(_0x134c4b,null))[_0xd542('0x29')](function(_0x2200f7){if(_0x2200f7){_0x58ed9c=_0x2200f7;_0x548e65[_0xd542('0x33')]=_['keys'](db[_0xd542('0x4e')][_0xd542('0x47')]);_0x548e65['query']=_[_0xd542('0x35')](_0x2d810a[_0xd542('0x34')]);_0x548e65[_0xd542('0x36')]=_['intersection'](_0x548e65[_0xd542('0x33')],_0x548e65[_0xd542('0x34')]);_0x171b18['attributes']=_['intersection'](_0x548e65[_0xd542('0x33')],qs[_0xd542('0x39')](_0x2d810a[_0xd542('0x34')]['fields']));_0x171b18[_0xd542('0x38')]=_0x171b18[_0xd542('0x38')][_0xd542('0x3a')]?_0x171b18[_0xd542('0x38')]:_0x548e65[_0xd542('0x33')];_0x171b18[_0xd542('0x3b')]=qs[_0xd542('0x4f')](_0x2d810a[_0xd542('0x34')][_0xd542('0x4f')]);_0x171b18[_0xd542('0x3c')]=qs[_0xd542('0x36')](_['pick'](_0x2d810a[_0xd542('0x34')],_0x548e65[_0xd542('0x36')]));if(_0x2d810a['query']['filter']){_0x171b18[_0xd542('0x3c')]=_['merge'](_0x171b18[_0xd542('0x3c')],{'$or':_[_0xd542('0x30')](_0x171b18[_0xd542('0x38')],function(_0x498bd1){var _0x37c6e0={};_0x37c6e0[_0x498bd1]={'$like':'%'+_0x2d810a['query'][_0xd542('0x3e')]+'%'};return _0x37c6e0;})});}_0x171b18=_[_0xd542('0x3f')]({},_0x171b18,_0x2d810a[_0xd542('0x50')]);return _0x58ed9c[_0xd542('0x54')](_0x171b18);}})[_0xd542('0x29')](function(_0x2f0af1){if(_0x2f0af1){_0x38df14=_0x2f0af1[_0xd542('0x3a')];if(!_0x2d810a[_0xd542('0x34')]['hasOwnProperty'](_0xd542('0x52'))){_0x171b18[_0xd542('0x22')]=qs[_0xd542('0x22')](_0x2d810a[_0xd542('0x34')]['limit']);_0x171b18['offset']=qs['offset'](_0x2d810a['query'][_0xd542('0x20')]);}return _0x58ed9c[_0xd542('0x54')](_0x171b18);}})['then'](function(_0x318724){if(_0x318724){return _0x318724?{'count':_0x38df14,'rows':_0x318724}:null;}})[_0xd542('0x29')](respondWithResult(_0x134c4b,null))[_0xd542('0x45')](handleError(_0x134c4b,null));};exports[_0xd542('0x55')]=function(_0x44e319,_0x1c0a94,_0x4a0cce){var _0x384956={};var _0x4e5db2={};var _0x20cc33;var _0x443ad1;return db[_0xd542('0x43')][_0xd542('0x4d')]({'where':{'id':_0x44e319['params']['id']}})[_0xd542('0x29')](handleEntityNotFound(_0x1c0a94,null))[_0xd542('0x29')](function(_0x2661d4){if(_0x2661d4){_0x20cc33=_0x2661d4;_0x4e5db2['model']=_[_0xd542('0x35')](db[_0xd542('0x56')]['rawAttributes']);_0x4e5db2['query']=_['keys'](_0x44e319['query']);_0x4e5db2['filters']=_['intersection'](_0x4e5db2[_0xd542('0x33')],_0x4e5db2[_0xd542('0x34')]);_0x384956[_0xd542('0x38')]=_[_0xd542('0x37')](_0x4e5db2['model'],qs['fields'](_0x44e319['query'][_0xd542('0x39')]));_0x384956['attributes']=_0x384956[_0xd542('0x38')]['length']?_0x384956[_0xd542('0x38')]:_0x4e5db2[_0xd542('0x33')];_0x384956[_0xd542('0x3b')]=qs[_0xd542('0x4f')](_0x44e319[_0xd542('0x34')][_0xd542('0x4f')]);_0x384956['where']=qs[_0xd542('0x36')](_[_0xd542('0x3d')](_0x44e319[_0xd542('0x34')],_0x4e5db2[_0xd542('0x36')]));if(_0x44e319[_0xd542('0x34')]['filter']){_0x384956['where']=_['merge'](_0x384956['where'],{'$or':_[_0xd542('0x30')](_0x384956[_0xd542('0x38')],function(_0x578a01){var _0x2f2c77={};_0x2f2c77[_0x578a01]={'$like':'%'+_0x44e319['query'][_0xd542('0x3e')]+'%'};return _0x2f2c77;})});}_0x384956=_[_0xd542('0x3f')]({},_0x384956,_0x44e319[_0xd542('0x50')]);return _0x20cc33['getTags'](_0x384956);}})[_0xd542('0x29')](function(_0x4a3898){if(_0x4a3898){_0x443ad1=_0x4a3898[_0xd542('0x3a')];if(!_0x44e319['query'][_0xd542('0x51')](_0xd542('0x52'))){_0x384956['limit']=qs[_0xd542('0x22')](_0x44e319[_0xd542('0x34')][_0xd542('0x22')]);_0x384956[_0xd542('0x20')]=qs['offset'](_0x44e319[_0xd542('0x34')][_0xd542('0x20')]);}return _0x20cc33[_0xd542('0x55')](_0x384956);}})['then'](function(_0x9e1c45){if(_0x9e1c45){return _0x9e1c45?{'count':_0x443ad1,'rows':_0x9e1c45}:null;}})[_0xd542('0x29')](respondWithResult(_0x1c0a94,null))[_0xd542('0x45')](handleError(_0x1c0a94,null));};exports[_0xd542('0x57')]=function(_0x2ce7a4,_0x2cf0cc,_0x54cb00){if(_0x2ce7a4[_0xd542('0x4a')]['id']){delete _0x2ce7a4['body']['id'];}return db[_0xd542('0x43')]['findOne']({'where':{'id':_0x2ce7a4['params']['id']}})[_0xd542('0x29')](handleEntityNotFound(_0x2cf0cc,null))[_0xd542('0x29')](function(_0x1818ad){if(_0x1818ad){return _0x1818ad[_0xd542('0x57')](_0x2ce7a4[_0xd542('0x4a')]['ids']||[]);}return null;})[_0xd542('0x29')](respondWithResult(_0x2cf0cc,null))[_0xd542('0x45')](handleError(_0x2cf0cc,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index fdaf593..a9994db 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 _0x43ca=['exports','define','int_desk_configurations','lodash','util','../../config/logger','api','moment','path','../../config/environment'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0x43ca,0x17f));var _0xa43c=function(_0x102f97,_0x5bda2f){_0x102f97=_0x102f97-0x0;var _0xd22058=_0x43ca[_0x102f97];return _0xd22058;};'use strict';var _=require(_0xa43c('0x0'));var util=require(_0xa43c('0x1'));var logger=require(_0xa43c('0x2'))(_0xa43c('0x3'));var moment=require(_0xa43c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa43c('0x5'));var rimraf=require('rimraf');var config=require(_0xa43c('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0xa43c('0x7')]=function(_0x581262,_0xc69e14){return _0x581262[_0xa43c('0x8')]('DeskConfiguration',attributes,{'tableName':_0xa43c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed21=['int_desk_configurations','lodash','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','DeskConfiguration'];(function(_0x58f245,_0x3e4f31){var _0x1f0cfb=function(_0x515942){while(--_0x515942){_0x58f245['push'](_0x58f245['shift']());}};_0x1f0cfb(++_0x3e4f31);}(_0xed21,0x16c));var _0x1ed2=function(_0x474f2c,_0x5d8ae3){_0x474f2c=_0x474f2c-0x0;var _0x58593a=_0xed21[_0x474f2c];return _0x58593a;};'use strict';var _=require(_0x1ed2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1ed2('0x1'));var moment=require(_0x1ed2('0x2'));var BPromise=require(_0x1ed2('0x3'));var rp=require(_0x1ed2('0x4'));var fs=require('fs');var path=require(_0x1ed2('0x5'));var rimraf=require('rimraf');var config=require(_0x1ed2('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0x1ed2('0x7')]=function(_0x4f5cb5,_0x28db20){return _0x4f5cb5[_0x1ed2('0x8')](_0x1ed2('0x9'),attributes,{'tableName':_0x1ed2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 5cebd19..29a56f6 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 _0x7ae6=['info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x16337a,_0x4789a1){var _0x422365=function(_0x34f039){while(--_0x34f039){_0x16337a['push'](_0x16337a['shift']());}};_0x422365(++_0x4789a1);}(_0x7ae6,0x94));var _0x67ae=function(_0x5befb6,_0x5d410a){_0x5befb6=_0x5befb6-0x0;var _0x571ec9=_0x7ae6[_0x5befb6];return _0x571ec9;};'use strict';var _=require('lodash');var util=require(_0x67ae('0x0'));var moment=require('moment');var BPromise=require(_0x67ae('0x1'));var rs=require(_0x67ae('0x2'));var fs=require('fs');var Redis=require(_0x67ae('0x3'));var db=require(_0x67ae('0x4'))['db'];var utils=require(_0x67ae('0x5'));var logger=require(_0x67ae('0x6'))('rpc');var config=require(_0x67ae('0x7'));var jayson=require(_0x67ae('0x8'));var client=jayson[_0x67ae('0x9')][_0x67ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33bc99,_0x51f7f2,_0x456ca9){return new BPromise(function(_0x460304,_0x2591a1){return client[_0x67ae('0xb')](_0x33bc99,_0x456ca9)[_0x67ae('0xc')](function(_0x11c49a){logger[_0x67ae('0xd')](_0x67ae('0xe'),_0x51f7f2,_0x67ae('0xf'));logger[_0x67ae('0x10')](_0x67ae('0x11'),_0x51f7f2,_0x67ae('0xf'),JSON[_0x67ae('0x12')](_0x11c49a));if(_0x11c49a[_0x67ae('0x13')]){if(_0x11c49a[_0x67ae('0x13')][_0x67ae('0x14')]===0x1f4){logger[_0x67ae('0x13')](_0x67ae('0xe'),_0x51f7f2,_0x11c49a[_0x67ae('0x13')][_0x67ae('0x15')]);return _0x2591a1(_0x11c49a[_0x67ae('0x13')][_0x67ae('0x15')]);}logger[_0x67ae('0x13')](_0x67ae('0xe'),_0x51f7f2,_0x11c49a['error'][_0x67ae('0x15')]);return _0x460304(_0x11c49a[_0x67ae('0x13')][_0x67ae('0x15')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x51f7f2,_0x67ae('0xf'));_0x460304(_0x11c49a['result']['message']);}})[_0x67ae('0x16')](function(_0x2c47f9){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x51f7f2,_0x2c47f9);_0x2591a1(_0x2c47f9);});});} \ No newline at end of file +var _0xc8ac=['result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','stringify','error','code','message'];(function(_0x4be4b0,_0xee7e8c){var _0x4d3e5b=function(_0x4a1eed){while(--_0x4a1eed){_0x4be4b0['push'](_0x4be4b0['shift']());}};_0x4d3e5b(++_0xee7e8c);}(_0xc8ac,0xe9));var _0xcc8a=function(_0x303064,_0x12f0c2){_0x303064=_0x303064-0x0;var _0x5a1d3d=_0xc8ac[_0x303064];return _0x5a1d3d;};'use strict';var _=require(_0xcc8a('0x0'));var util=require(_0xcc8a('0x1'));var moment=require(_0xcc8a('0x2'));var BPromise=require(_0xcc8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc8a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc8a('0x5'));var logger=require(_0xcc8a('0x6'))(_0xcc8a('0x7'));var config=require(_0xcc8a('0x8'));var jayson=require(_0xcc8a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1904fa,_0x40d548,_0x3bd2e3){return new BPromise(function(_0x4e4982,_0x55031d){return client[_0xcc8a('0xa')](_0x1904fa,_0x3bd2e3)[_0xcc8a('0xb')](function(_0x5f3565){logger[_0xcc8a('0xc')](_0xcc8a('0xd'),_0x40d548,'request\x20sent');logger[_0xcc8a('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x40d548,'request\x20sent',JSON[_0xcc8a('0xf')](_0x5f3565));if(_0x5f3565[_0xcc8a('0x10')]){if(_0x5f3565[_0xcc8a('0x10')][_0xcc8a('0x11')]===0x1f4){logger[_0xcc8a('0x10')](_0xcc8a('0xd'),_0x40d548,_0x5f3565[_0xcc8a('0x10')][_0xcc8a('0x12')]);return _0x55031d(_0x5f3565[_0xcc8a('0x10')][_0xcc8a('0x12')]);}logger[_0xcc8a('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x40d548,_0x5f3565[_0xcc8a('0x10')][_0xcc8a('0x12')]);return _0x4e4982(_0x5f3565[_0xcc8a('0x10')][_0xcc8a('0x12')]);}else{logger[_0xcc8a('0xc')](_0xcc8a('0xd'),_0x40d548,'request\x20sent');_0x4e4982(_0x5f3565[_0xcc8a('0x13')][_0xcc8a('0x12')]);}})[_0xcc8a('0x14')](function(_0x2b40c2){logger[_0xcc8a('0x10')](_0xcc8a('0xd'),_0x40d548,_0x2b40c2);_0x55031d(_0x2b40c2);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 0204db4..8e32ec0 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 _0x24f0=['destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x24f0,0x1f0));var _0x024f=function(_0x5659b8,_0x560936){_0x5659b8=_0x5659b8-0x0;var _0x3d0663=_0x24f0[_0x5659b8];return _0x3d0663;};'use strict';var multer=require('multer');var util=require(_0x024f('0x0'));var path=require('path');var timeout=require(_0x024f('0x1'));var express=require('express');var router=express[_0x024f('0x2')]();var fs_extra=require(_0x024f('0x3'));var auth=require(_0x024f('0x4'));var interaction=require(_0x024f('0x5'));var config=require('../../config/environment');var controller=require(_0x024f('0x6'));router[_0x024f('0x7')]('/',auth[_0x024f('0x8')](),controller[_0x024f('0x9')]);router[_0x024f('0x7')](_0x024f('0xa'),auth[_0x024f('0x8')](),controller[_0x024f('0xb')]);router[_0x024f('0xc')]('/',auth['isAuthenticated'](),controller[_0x024f('0xd')]);router[_0x024f('0xe')]('/:id',auth[_0x024f('0x8')](),controller[_0x024f('0xf')]);router[_0x024f('0x10')](_0x024f('0xa'),auth[_0x024f('0x8')](),controller[_0x024f('0x11')]);module[_0x024f('0x12')]=router; \ No newline at end of file +var _0x1337=['/:id','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x425992,_0x409578){var _0x56eae7=function(_0x4911d6){while(--_0x4911d6){_0x425992['push'](_0x425992['shift']());}};_0x56eae7(++_0x409578);}(_0x1337,0x1ce));var _0x7133=function(_0x5d9675,_0xdceabd){_0x5d9675=_0x5d9675-0x0;var _0x1fd2f6=_0x1337[_0x5d9675];return _0x1fd2f6;};'use strict';var multer=require(_0x7133('0x0'));var util=require('util');var path=require(_0x7133('0x1'));var timeout=require(_0x7133('0x2'));var express=require(_0x7133('0x3'));var router=express[_0x7133('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7133('0x5'));var config=require('../../config/environment');var controller=require(_0x7133('0x6'));router[_0x7133('0x7')]('/',auth[_0x7133('0x8')](),controller[_0x7133('0x9')]);router[_0x7133('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7133('0xa')]);router[_0x7133('0xb')]('/',auth['isAuthenticated'](),controller[_0x7133('0xc')]);router[_0x7133('0xd')](_0x7133('0xe'),auth[_0x7133('0x8')](),controller['update']);router['delete']('/:id',auth[_0x7133('0x8')](),controller[_0x7133('0xf')]);module[_0x7133('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index c172fdb..efa9d3c 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 _0x4a9e=['customVariable','keyValue','STRING','ENUM','BOOLEAN','string','variable'];(function(_0x4a96ca,_0x13754e){var _0x2aed48=function(_0x361330){while(--_0x361330){_0x4a96ca['push'](_0x4a96ca['shift']());}};_0x2aed48(++_0x13754e);}(_0x4a9e,0x12b));var _0xe4a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a9e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xe4a9('0x0'),_0xe4a9('0x1'),_0xe4a9('0x2'),_0xe4a9('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xe4a9('0x4')]},'key':{'type':Sequelize[_0xe4a9('0x4')]},'keyType':{'type':Sequelize[_0xe4a9('0x5')](_0xe4a9('0x0'),_0xe4a9('0x1'),_0xe4a9('0x2'))},'keyContent':{'type':Sequelize[_0xe4a9('0x4')]},'idField':{'type':Sequelize[_0xe4a9('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe4a9('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe4a9('0x4')]}}; \ No newline at end of file +var _0x6d88=['exports','string','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize'];(function(_0x2e8fe1,_0xa6bb30){var _0x1d0171=function(_0x2aeff4){while(--_0x2aeff4){_0x2e8fe1['push'](_0x2e8fe1['shift']());}};_0x1d0171(++_0xa6bb30);}(_0x6d88,0x6f));var _0x86d8=function(_0x764f17,_0x1a00d1){_0x764f17=_0x764f17-0x0;var _0x11e3a4=_0x6d88[_0x764f17];return _0x11e3a4;};'use strict';var Sequelize=require(_0x86d8('0x0'));module[_0x86d8('0x1')]={'type':{'type':Sequelize['ENUM'](_0x86d8('0x2'),'variable','customVariable',_0x86d8('0x3'),_0x86d8('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x86d8('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x86d8('0x6')](_0x86d8('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x86d8('0x5')]},'idField':{'type':Sequelize[_0x86d8('0x5')]},'nameField':{'type':Sequelize[_0x86d8('0x5')]},'customField':{'type':Sequelize[_0x86d8('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 0362d41..b7cc7eb 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 _0x34f2=['update','then','destroy','error','stack','name','send','map','DeskField','rawAttributes','type','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','undefined','limit','count','set','Content-Range','json','reject','save'];(function(_0x39a972,_0x4dbefe){var _0x401c50=function(_0x22994d){while(--_0x22994d){_0x39a972['push'](_0x39a972['shift']());}};_0x401c50(++_0x4dbefe);}(_0x34f2,0x15a));var _0x234f=function(_0x2cf334,_0xafc559){_0x2cf334=_0x2cf334-0x0;var _0x55d8ea=_0x34f2[_0x2cf334];return _0x55d8ea;};'use strict';var emlformat=require(_0x234f('0x0'));var rimraf=require(_0x234f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x234f('0x2'));var rp=require(_0x234f('0x3'));var moment=require(_0x234f('0x4'));var BPromise=require(_0x234f('0x5'));var Mustache=require(_0x234f('0x6'));var util=require(_0x234f('0x7'));var path=require(_0x234f('0x8'));var sox=require(_0x234f('0x9'));var csv=require(_0x234f('0xa'));var ejs=require(_0x234f('0xb'));var fs=require('fs');var fs_extra=require(_0x234f('0xc'));var _=require(_0x234f('0xd'));var squel=require(_0x234f('0xe'));var crypto=require(_0x234f('0xf'));var jsforce=require(_0x234f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x234f('0xa'));var querystring=require(_0x234f('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x234f('0x12'));var qs=require(_0x234f('0x13'));var as=require(_0x234f('0x14'));var hardwareService=require(_0x234f('0x15'));var logger=require(_0x234f('0x16'))('api');var utils=require(_0x234f('0x17'));var config=require(_0x234f('0x18'));var licenseUtil=require(_0x234f('0x19'));var db=require(_0x234f('0x1a'))['db'];function respondWithStatusCode(_0x518485,_0x41f471){_0x41f471=_0x41f471||0xcc;return function(_0x4aefa2){if(_0x4aefa2){return _0x518485[_0x234f('0x1b')](_0x41f471);}return _0x518485[_0x234f('0x1c')](_0x41f471)[_0x234f('0x1d')]();};}function respondWithResult(_0x31c3d6,_0x2fea04){_0x2fea04=_0x2fea04||0xc8;return function(_0x10ee30){if(_0x10ee30){return _0x31c3d6[_0x234f('0x1c')](_0x2fea04)['json'](_0x10ee30);}};}function respondWithFilteredResult(_0x5ada71,_0x2d47cf){return function(_0x162275){if(_0x162275){var _0x5f0e9c=typeof _0x2d47cf[_0x234f('0x1e')]===_0x234f('0x1f')&&typeof _0x2d47cf[_0x234f('0x20')]===_0x234f('0x1f');var _0x304c08=_0x162275[_0x234f('0x21')];var _0x144ea0=_0x5f0e9c?0x0:_0x2d47cf[_0x234f('0x1e')];var _0x77399f=_0x5f0e9c?_0x162275['count']:_0x2d47cf[_0x234f('0x1e')]+_0x2d47cf[_0x234f('0x20')];var _0x357ecb;if(_0x77399f>=_0x304c08){_0x77399f=_0x304c08;_0x357ecb=0xc8;}else{_0x357ecb=0xce;}_0x5ada71[_0x234f('0x1c')](_0x357ecb);return _0x5ada71[_0x234f('0x22')](_0x234f('0x23'),_0x144ea0+'-'+_0x77399f+'/'+_0x304c08)[_0x234f('0x24')](_0x162275);}return null;};}function patchUpdates(_0x2f68cf){return function(_0x45b3c0){try{jsonpatch['apply'](_0x45b3c0,_0x2f68cf,!![]);}catch(_0x5e7edd){return BPromise[_0x234f('0x25')](_0x5e7edd);}return _0x45b3c0[_0x234f('0x26')]();};}function saveUpdates(_0x516c6e,_0x2539d9){return function(_0x4ca657){if(_0x4ca657){return _0x4ca657[_0x234f('0x27')](_0x516c6e)[_0x234f('0x28')](function(_0x17a23c){return _0x17a23c;});}return null;};}function removeEntity(_0x2acafc,_0x34cc19){return function(_0x434e9f){if(_0x434e9f){return _0x434e9f[_0x234f('0x29')]()[_0x234f('0x28')](function(){_0x2acafc[_0x234f('0x1c')](0xcc)[_0x234f('0x1d')]();});}};}function handleEntityNotFound(_0x758e8d,_0xd8ffbf){return function(_0x15de29){if(!_0x15de29){_0x758e8d[_0x234f('0x1b')](0x194);}return _0x15de29;};}function handleError(_0x3ce565,_0x371292){_0x371292=_0x371292||0x1f4;return function(_0x2b6641){logger[_0x234f('0x2a')](_0x2b6641[_0x234f('0x2b')]);if(_0x2b6641[_0x234f('0x2c')]){delete _0x2b6641[_0x234f('0x2c')];}_0x3ce565[_0x234f('0x1c')](_0x371292)[_0x234f('0x2d')](_0x2b6641);};}exports['index']=function(_0x1f6032,_0xffda12){var _0x1b3762={},_0x2522b1={},_0x3cfdea={'count':0x0,'rows':[]};var _0x192860=_[_0x234f('0x2e')](db[_0x234f('0x2f')][_0x234f('0x30')],function(_0x19f33b){return{'name':_0x19f33b['fieldName'],'type':_0x19f33b[_0x234f('0x31')]['key']};});_0x2522b1[_0x234f('0x32')]=_[_0x234f('0x2e')](_0x192860,_0x234f('0x2c'));_0x2522b1[_0x234f('0x33')]=_['keys'](_0x1f6032[_0x234f('0x33')]);_0x2522b1[_0x234f('0x34')]=_[_0x234f('0x35')](_0x2522b1['model'],_0x2522b1['query']);_0x1b3762[_0x234f('0x36')]=_[_0x234f('0x35')](_0x2522b1['model'],qs['fields'](_0x1f6032[_0x234f('0x33')]['fields']));_0x1b3762['attributes']=_0x1b3762[_0x234f('0x36')]['length']?_0x1b3762[_0x234f('0x36')]:_0x2522b1[_0x234f('0x32')];if(!_0x1f6032[_0x234f('0x33')][_0x234f('0x37')](_0x234f('0x38'))){_0x1b3762[_0x234f('0x20')]=qs[_0x234f('0x20')](_0x1f6032[_0x234f('0x33')][_0x234f('0x20')]);_0x1b3762['offset']=qs[_0x234f('0x1e')](_0x1f6032[_0x234f('0x33')][_0x234f('0x1e')]);}_0x1b3762[_0x234f('0x39')]=qs[_0x234f('0x3a')](_0x1f6032[_0x234f('0x33')][_0x234f('0x3a')]);_0x1b3762[_0x234f('0x3b')]=qs['filters'](_[_0x234f('0x3c')](_0x1f6032[_0x234f('0x33')],_0x2522b1[_0x234f('0x34')]),_0x192860);if(_0x1f6032[_0x234f('0x33')]['filter']){_0x1b3762['where']=_['merge'](_0x1b3762[_0x234f('0x3b')],{'$or':_['map'](_0x192860,function(_0x41e124){if(_0x41e124[_0x234f('0x31')]!==_0x234f('0x3d')){var _0x3d739e={};_0x3d739e[_0x41e124[_0x234f('0x2c')]]={'$like':'%'+_0x1f6032[_0x234f('0x33')][_0x234f('0x3e')]+'%'};return _0x3d739e;}})});}_0x1b3762=_[_0x234f('0x3f')]({},_0x1b3762,_0x1f6032[_0x234f('0x40')]);var _0x19490d={'where':_0x1b3762[_0x234f('0x3b')]};return db[_0x234f('0x2f')][_0x234f('0x21')](_0x19490d)[_0x234f('0x28')](function(_0x1e9d42){_0x3cfdea[_0x234f('0x21')]=_0x1e9d42;if(_0x1f6032[_0x234f('0x33')][_0x234f('0x41')]){_0x1b3762[_0x234f('0x42')]=[{'all':!![]}];}return db['DeskField'][_0x234f('0x43')](_0x1b3762);})[_0x234f('0x28')](function(_0xa85724){_0x3cfdea[_0x234f('0x44')]=_0xa85724;return _0x3cfdea;})[_0x234f('0x28')](respondWithFilteredResult(_0xffda12,_0x1b3762))[_0x234f('0x45')](handleError(_0xffda12,null));};exports[_0x234f('0x46')]=function(_0x4e4210,_0x5d4b30){var _0x26c116={'raw':!![],'where':{'id':_0x4e4210[_0x234f('0x47')]['id']}},_0x5b2ee9={};_0x5b2ee9[_0x234f('0x32')]=_[_0x234f('0x48')](db['DeskField']['rawAttributes']);_0x5b2ee9[_0x234f('0x33')]=_[_0x234f('0x48')](_0x4e4210[_0x234f('0x33')]);_0x5b2ee9[_0x234f('0x34')]=_[_0x234f('0x35')](_0x5b2ee9[_0x234f('0x32')],_0x5b2ee9[_0x234f('0x33')]);_0x26c116['attributes']=_[_0x234f('0x35')](_0x5b2ee9['model'],qs[_0x234f('0x49')](_0x4e4210[_0x234f('0x33')]['fields']));_0x26c116[_0x234f('0x36')]=_0x26c116[_0x234f('0x36')]['length']?_0x26c116[_0x234f('0x36')]:_0x5b2ee9[_0x234f('0x32')];if(_0x4e4210[_0x234f('0x33')]['includeAll']){_0x26c116[_0x234f('0x42')]=[{'all':!![]}];}_0x26c116=_[_0x234f('0x3f')]({},_0x26c116,_0x4e4210[_0x234f('0x40')]);return db['DeskField'][_0x234f('0x4a')](_0x26c116)[_0x234f('0x28')](handleEntityNotFound(_0x5d4b30,null))['then'](respondWithResult(_0x5d4b30,null))[_0x234f('0x45')](handleError(_0x5d4b30,null));};exports[_0x234f('0x4b')]=function(_0x5291f3,_0x2c51ab){return db[_0x234f('0x2f')][_0x234f('0x4b')](_0x5291f3[_0x234f('0x4c')],{})[_0x234f('0x28')](respondWithResult(_0x2c51ab,0xc9))[_0x234f('0x45')](handleError(_0x2c51ab,null));};exports[_0x234f('0x27')]=function(_0x59b2f9,_0x37dabf){if(_0x59b2f9[_0x234f('0x4c')]['id']){delete _0x59b2f9[_0x234f('0x4c')]['id'];}return db[_0x234f('0x2f')][_0x234f('0x4a')]({'where':{'id':_0x59b2f9['params']['id']}})[_0x234f('0x28')](handleEntityNotFound(_0x37dabf,null))[_0x234f('0x28')](saveUpdates(_0x59b2f9[_0x234f('0x4c')],null))[_0x234f('0x28')](respondWithResult(_0x37dabf,null))[_0x234f('0x45')](handleError(_0x37dabf,null));};exports[_0x234f('0x29')]=function(_0x58fcee,_0xf9b0da){return db[_0x234f('0x2f')][_0x234f('0x4a')]({'where':{'id':_0x58fcee[_0x234f('0x47')]['id']}})['then'](handleEntityNotFound(_0xf9b0da,null))[_0x234f('0x28')](removeEntity(_0xf9b0da,null))[_0x234f('0x45')](handleError(_0xf9b0da,null));}; \ No newline at end of file +var _0x6462=['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','error','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','eml-format'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x6462,0x11f));var _0x2646=function(_0x3f2215,_0x465e9b){_0x3f2215=_0x3f2215-0x0;var _0x5944f4=_0x6462[_0x3f2215];return _0x5944f4;};'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(){_0x1fdb46['status'](0xcc)[_0x2646('0x19')]();});}};}function handleEntityNotFound(_0x3d0ee3,_0x4a0e90){return function(_0x2ff690){if(!_0x2ff690){_0x3d0ee3['sendStatus'](0x194);}return _0x2ff690;};}function handleError(_0x4566d5,_0x46e2a2){_0x46e2a2=_0x46e2a2||0x1f4;return function(_0x34c5c9){logger[_0x2646('0x27')](_0x34c5c9['stack']);if(_0x34c5c9[_0x2646('0x28')]){delete _0x34c5c9[_0x2646('0x28')];}_0x4566d5[_0x2646('0x1a')](_0x46e2a2)[_0x2646('0x29')](_0x34c5c9);};}exports[_0x2646('0x2a')]=function(_0x3e12b9,_0x5b3a9b){var _0x43bb08={},_0x460f34={},_0x3548dd={'count':0x0,'rows':[]};var _0x2e5840=_[_0x2646('0x2b')](db[_0x2646('0x2c')][_0x2646('0x2d')],function(_0x20fb97){return{'name':_0x20fb97[_0x2646('0x2e')],'type':_0x20fb97[_0x2646('0x2f')][_0x2646('0x30')]};});_0x460f34[_0x2646('0x31')]=_[_0x2646('0x2b')](_0x2e5840,'name');_0x460f34[_0x2646('0x32')]=_[_0x2646('0x33')](_0x3e12b9[_0x2646('0x32')]);_0x460f34[_0x2646('0x34')]=_[_0x2646('0x35')](_0x460f34['model'],_0x460f34[_0x2646('0x32')]);_0x43bb08['attributes']=_[_0x2646('0x35')](_0x460f34[_0x2646('0x31')],qs[_0x2646('0x36')](_0x3e12b9[_0x2646('0x32')][_0x2646('0x36')]));_0x43bb08['attributes']=_0x43bb08['attributes']['length']?_0x43bb08[_0x2646('0x37')]:_0x460f34[_0x2646('0x31')];if(!_0x3e12b9[_0x2646('0x32')][_0x2646('0x38')]('nolimit')){_0x43bb08[_0x2646('0x1c')]=qs[_0x2646('0x1c')](_0x3e12b9[_0x2646('0x32')]['limit']);_0x43bb08[_0x2646('0x1e')]=qs[_0x2646('0x1e')](_0x3e12b9[_0x2646('0x32')][_0x2646('0x1e')]);}_0x43bb08['order']=qs[_0x2646('0x39')](_0x3e12b9['query'][_0x2646('0x39')]);_0x43bb08['where']=qs[_0x2646('0x34')](_['pick'](_0x3e12b9[_0x2646('0x32')],_0x460f34[_0x2646('0x34')]),_0x2e5840);if(_0x3e12b9[_0x2646('0x32')]['filter']){_0x43bb08[_0x2646('0x3a')]=_['merge'](_0x43bb08[_0x2646('0x3a')],{'$or':_[_0x2646('0x2b')](_0x2e5840,function(_0x1a3fad){if(_0x1a3fad[_0x2646('0x2f')]!=='VIRTUAL'){var _0x4600a6={};_0x4600a6[_0x1a3fad[_0x2646('0x28')]]={'$like':'%'+_0x3e12b9['query'][_0x2646('0x3b')]+'%'};return _0x4600a6;}})});}_0x43bb08=_[_0x2646('0x3c')]({},_0x43bb08,_0x3e12b9[_0x2646('0x3d')]);var _0x172781={'where':_0x43bb08[_0x2646('0x3a')]};return db['DeskField']['count'](_0x172781)['then'](function(_0x13e1cc){_0x3548dd[_0x2646('0x1d')]=_0x13e1cc;if(_0x3e12b9[_0x2646('0x32')][_0x2646('0x3e')]){_0x43bb08[_0x2646('0x3f')]=[{'all':!![]}];}return db[_0x2646('0x2c')][_0x2646('0x40')](_0x43bb08);})[_0x2646('0x25')](function(_0x128fc4){_0x3548dd[_0x2646('0x41')]=_0x128fc4;return _0x3548dd;})[_0x2646('0x25')](respondWithFilteredResult(_0x5b3a9b,_0x43bb08))[_0x2646('0x42')](handleError(_0x5b3a9b,null));};exports['show']=function(_0x4d77e9,_0x3cd3a6){var _0x589d65={'raw':!![],'where':{'id':_0x4d77e9[_0x2646('0x43')]['id']}},_0x2e9ff2={};_0x2e9ff2[_0x2646('0x31')]=_['keys'](db[_0x2646('0x2c')][_0x2646('0x2d')]);_0x2e9ff2[_0x2646('0x32')]=_[_0x2646('0x33')](_0x4d77e9[_0x2646('0x32')]);_0x2e9ff2[_0x2646('0x34')]=_[_0x2646('0x35')](_0x2e9ff2['model'],_0x2e9ff2['query']);_0x589d65[_0x2646('0x37')]=_[_0x2646('0x35')](_0x2e9ff2[_0x2646('0x31')],qs['fields'](_0x4d77e9[_0x2646('0x32')]['fields']));_0x589d65[_0x2646('0x37')]=_0x589d65[_0x2646('0x37')][_0x2646('0x44')]?_0x589d65['attributes']:_0x2e9ff2[_0x2646('0x31')];if(_0x4d77e9['query'][_0x2646('0x3e')]){_0x589d65[_0x2646('0x3f')]=[{'all':!![]}];}_0x589d65=_['merge']({},_0x589d65,_0x4d77e9[_0x2646('0x3d')]);return db['DeskField'][_0x2646('0x45')](_0x589d65)['then'](handleEntityNotFound(_0x3cd3a6,null))[_0x2646('0x25')](respondWithResult(_0x3cd3a6,null))[_0x2646('0x42')](handleError(_0x3cd3a6,null));};exports[_0x2646('0x46')]=function(_0x28a3e2,_0x42f368){return db[_0x2646('0x2c')]['create'](_0x28a3e2[_0x2646('0x47')],{})['then'](respondWithResult(_0x42f368,0xc9))[_0x2646('0x42')](handleError(_0x42f368,null));};exports[_0x2646('0x24')]=function(_0x462b73,_0x2fe6dc){if(_0x462b73[_0x2646('0x47')]['id']){delete _0x462b73[_0x2646('0x47')]['id'];}return db[_0x2646('0x2c')][_0x2646('0x45')]({'where':{'id':_0x462b73[_0x2646('0x43')]['id']}})[_0x2646('0x25')](handleEntityNotFound(_0x2fe6dc,null))[_0x2646('0x25')](saveUpdates(_0x462b73[_0x2646('0x47')],null))[_0x2646('0x25')](respondWithResult(_0x2fe6dc,null))[_0x2646('0x42')](handleError(_0x2fe6dc,null));};exports[_0x2646('0x26')]=function(_0x1c3987,_0x322d79){return db[_0x2646('0x2c')]['find']({'where':{'id':_0x1c3987[_0x2646('0x43')]['id']}})[_0x2646('0x25')](handleEntityNotFound(_0x322d79,null))['then'](removeEntity(_0x322d79,null))['catch'](handleError(_0x322d79,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 3ca89e6..46ec1da 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 _0x2244=['moment','bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','define','DeskField','int_desk_fields','desk_unique_index','idField','lodash','../../config/logger','api'];(function(_0x2af332,_0x14fa7a){var _0x7a8ccf=function(_0x567d35){while(--_0x567d35){_0x2af332['push'](_0x2af332['shift']());}};_0x7a8ccf(++_0x14fa7a);}(_0x2244,0x185));var _0x4224=function(_0x323658,_0x56e2e1){_0x323658=_0x323658-0x0;var _0x2b44ca=_0x2244[_0x323658];return _0x2b44ca;};'use strict';var _=require(_0x4224('0x0'));var util=require('util');var logger=require(_0x4224('0x1'))(_0x4224('0x2'));var moment=require(_0x4224('0x3'));var BPromise=require(_0x4224('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4224('0x5'));var rimraf=require(_0x4224('0x6'));var config=require(_0x4224('0x7'));var attributes=require(_0x4224('0x8'));module['exports']=function(_0x59cd58,_0x3bd858){return _0x59cd58[_0x4224('0x9')](_0x4224('0xa'),attributes,{'tableName':_0x4224('0xb'),'paranoid':![],'indexes':[{'name':_0x4224('0xc'),'fields':[_0x4224('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa159=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','int_desk_fields','desk_unique_index','idField','FieldId','lodash'];(function(_0x3db81b,_0x44a22d){var _0x55c529=function(_0x2946e5){while(--_0x2946e5){_0x3db81b['push'](_0x3db81b['shift']());}};_0x55c529(++_0x44a22d);}(_0xa159,0x195));var _0x9a15=function(_0xedc002,_0x5243b8){_0xedc002=_0xedc002-0x0;var _0x334754=_0xa159[_0xedc002];return _0x334754;};'use strict';var _=require(_0x9a15('0x0'));var util=require(_0x9a15('0x1'));var logger=require(_0x9a15('0x2'))(_0x9a15('0x3'));var moment=require(_0x9a15('0x4'));var BPromise=require(_0x9a15('0x5'));var rp=require(_0x9a15('0x6'));var fs=require('fs');var path=require(_0x9a15('0x7'));var rimraf=require(_0x9a15('0x8'));var config=require(_0x9a15('0x9'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0x267417,_0x50c912){return _0x267417['define']('DeskField',attributes,{'tableName':_0x9a15('0xa'),'paranoid':![],'indexes':[{'name':_0x9a15('0xb'),'fields':[_0x9a15('0xc'),_0x9a15('0xd')],'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 ac5e1bb..ccf8032 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 _0x464d=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x464d,0x180));var _0xd464=function(_0x25a863,_0x10baaf){_0x25a863=_0x25a863-0x0;var _0xdad8ab=_0x464d[_0x25a863];return _0xdad8ab;};'use strict';var _=require(_0xd464('0x0'));var util=require(_0xd464('0x1'));var moment=require(_0xd464('0x2'));var BPromise=require(_0xd464('0x3'));var rs=require(_0xd464('0x4'));var fs=require('fs');var Redis=require(_0xd464('0x5'));var db=require(_0xd464('0x6'))['db'];var utils=require(_0xd464('0x7'));var logger=require('../../config/logger')(_0xd464('0x8'));var config=require(_0xd464('0x9'));var jayson=require(_0xd464('0xa'));var client=jayson[_0xd464('0xb')][_0xd464('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b79ef,_0x370c3f,_0x56fcb4){return new BPromise(function(_0x55094d,_0x21af4a){return client[_0xd464('0xd')](_0x1b79ef,_0x56fcb4)[_0xd464('0xe')](function(_0x3953b4){logger['info'](_0xd464('0xf'),_0x370c3f,'request\x20sent');logger[_0xd464('0x10')](_0xd464('0x11'),_0x370c3f,_0xd464('0x12'),JSON[_0xd464('0x13')](_0x3953b4));if(_0x3953b4['error']){if(_0x3953b4[_0xd464('0x14')]['code']===0x1f4){logger[_0xd464('0x14')](_0xd464('0xf'),_0x370c3f,_0x3953b4[_0xd464('0x14')][_0xd464('0x15')]);return _0x21af4a(_0x3953b4['error'][_0xd464('0x15')]);}logger['error'](_0xd464('0xf'),_0x370c3f,_0x3953b4['error'][_0xd464('0x15')]);return _0x55094d(_0x3953b4['error']['message']);}else{logger[_0xd464('0x16')]('DeskField,\x20%s,\x20%s',_0x370c3f,_0xd464('0x12'));_0x55094d(_0x3953b4[_0xd464('0x17')][_0xd464('0x15')]);}})['catch'](function(_0x96c7c7){logger[_0xd464('0x14')]('DeskField,\x20%s,\x20%s',_0x370c3f,_0x96c7c7);_0x21af4a(_0x96c7c7);});});} \ No newline at end of file +var _0x5e6c=['request\x20sent','debug','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','DeskField,\x20%s,\x20%s'];(function(_0x409e89,_0x3e6813){var _0x2bd313=function(_0x489b33){while(--_0x489b33){_0x409e89['push'](_0x409e89['shift']());}};_0x2bd313(++_0x3e6813);}(_0x5e6c,0xa8));var _0xc5e6=function(_0x19dbaa,_0x128a9e){_0x19dbaa=_0x19dbaa-0x0;var _0x48e590=_0x5e6c[_0x19dbaa];return _0x48e590;};'use strict';var _=require('lodash');var util=require(_0xc5e6('0x0'));var moment=require(_0xc5e6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc5e6('0x2'))['db'];var utils=require(_0xc5e6('0x3'));var logger=require(_0xc5e6('0x4'))(_0xc5e6('0x5'));var config=require(_0xc5e6('0x6'));var jayson=require(_0xc5e6('0x7'));var client=jayson['client'][_0xc5e6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4dd85e,_0x1e559a,_0x20d771){return new BPromise(function(_0x408151,_0x329ac3){return client['request'](_0x4dd85e,_0x20d771)[_0xc5e6('0x9')](function(_0x3a3816){logger[_0xc5e6('0xa')](_0xc5e6('0xb'),_0x1e559a,_0xc5e6('0xc'));logger[_0xc5e6('0xd')]('DeskField,\x20%s,\x20%s,\x20%s',_0x1e559a,_0xc5e6('0xc'),JSON['stringify'](_0x3a3816));if(_0x3a3816['error']){if(_0x3a3816[_0xc5e6('0xe')]['code']===0x1f4){logger['error'](_0xc5e6('0xb'),_0x1e559a,_0x3a3816[_0xc5e6('0xe')][_0xc5e6('0xf')]);return _0x329ac3(_0x3a3816[_0xc5e6('0xe')][_0xc5e6('0xf')]);}logger[_0xc5e6('0xe')]('DeskField,\x20%s,\x20%s',_0x1e559a,_0x3a3816[_0xc5e6('0xe')]['message']);return _0x408151(_0x3a3816[_0xc5e6('0xe')][_0xc5e6('0xf')]);}else{logger[_0xc5e6('0xa')](_0xc5e6('0xb'),_0x1e559a,_0xc5e6('0xc'));_0x408151(_0x3a3816[_0xc5e6('0x10')]['message']);}})[_0xc5e6('0x11')](function(_0x3fea4f){logger['error']('DeskField,\x20%s,\x20%s',_0x1e559a,_0x3fea4f);_0x329ac3(_0x3fea4f);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index f5db81a..8d6476b 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 _0x413f=['index','get','/:id','isAuthenticated','show','getConfigurations','create','addConfiguration','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller'];(function(_0x4b9b32,_0x4144ba){var _0x55a0f3=function(_0x5845c1){while(--_0x5845c1){_0x4b9b32['push'](_0x4b9b32['shift']());}};_0x55a0f3(++_0x4144ba);}(_0x413f,0x64));var _0xf413=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x413f[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0xf413('0x0'));var path=require('path');var timeout=require(_0xf413('0x1'));var express=require(_0xf413('0x2'));var router=express[_0xf413('0x3')]();var fs_extra=require(_0xf413('0x4'));var auth=require(_0xf413('0x5'));var interaction=require(_0xf413('0x6'));var config=require('../../config/environment');var controller=require(_0xf413('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xf413('0x8')]);router[_0xf413('0x9')](_0xf413('0xa'),auth[_0xf413('0xb')](),controller[_0xf413('0xc')]);router[_0xf413('0x9')]('/:id/configurations',auth[_0xf413('0xb')](),controller[_0xf413('0xd')]);router[_0xf413('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0xf413('0xb')](),controller[_0xf413('0xe')]);router['post']('/:id/configurations',auth[_0xf413('0xb')](),controller[_0xf413('0xf')]);router['put'](_0xf413('0xa'),auth[_0xf413('0xb')](),controller['update']);router[_0xf413('0x10')](_0xf413('0xa'),auth[_0xf413('0xb')](),controller['destroy']);module[_0xf413('0x11')]=router; \ No newline at end of file +var _0xadb8=['/:id/fields','getFields','post','create','addConfiguration','update','delete','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show','get','/:id/configurations','getConfigurations'];(function(_0x33ebf5,_0x55228e){var _0x141dee=function(_0xeedd8f){while(--_0xeedd8f){_0x33ebf5['push'](_0x33ebf5['shift']());}};_0x141dee(++_0x55228e);}(_0xadb8,0xfa));var _0x8adb=function(_0x1ee62e,_0x159bb2){_0x1ee62e=_0x1ee62e-0x0;var _0x27c6c8=_0xadb8[_0x1ee62e];return _0x27c6c8;};'use strict';var multer=require(_0x8adb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8adb('0x1'));var express=require(_0x8adb('0x2'));var router=express['Router']();var fs_extra=require(_0x8adb('0x3'));var auth=require(_0x8adb('0x4'));var interaction=require(_0x8adb('0x5'));var config=require(_0x8adb('0x6'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8adb('0x7')]);router['get'](_0x8adb('0x8'),auth[_0x8adb('0x9')](),controller[_0x8adb('0xa')]);router[_0x8adb('0xb')](_0x8adb('0xc'),auth[_0x8adb('0x9')](),controller[_0x8adb('0xd')]);router[_0x8adb('0xb')](_0x8adb('0xe'),auth[_0x8adb('0x9')](),controller[_0x8adb('0xf')]);router[_0x8adb('0x10')]('/',auth[_0x8adb('0x9')](),controller[_0x8adb('0x11')]);router[_0x8adb('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x8adb('0x12')]);router['put'](_0x8adb('0x8'),auth['isAuthenticated'](),controller[_0x8adb('0x13')]);router[_0x8adb('0x14')](_0x8adb('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x8adb('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 c1b7453..3a5ef81 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 _0xe9e7=['STRING','sequelize','exports'];(function(_0x59c7c2,_0x3c91cb){var _0x425718=function(_0x25a5b9){while(--_0x25a5b9){_0x59c7c2['push'](_0x59c7c2['shift']());}};_0x425718(++_0x3c91cb);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0x1a2a32,_0x2d9edf){_0x1a2a32=_0x1a2a32-0x0;var _0x6c6d8b=_0xe9e7[_0x1a2a32];return _0x6c6d8b;};'use strict';var Sequelize=require(_0x7e9e('0x0'));module[_0x7e9e('0x1')]={'name':{'type':Sequelize[_0x7e9e('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x7e9e('0x2')]},'remoteUri':{'type':Sequelize[_0x7e9e('0x2')]},'tenantId':{'type':Sequelize[_0x7e9e('0x2')]},'clientId':{'type':Sequelize[_0x7e9e('0x2')]},'clientSecret':{'type':Sequelize[_0x7e9e('0x2')]},'serverUrl':{'type':Sequelize[_0x7e9e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7e9e('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xed08=['BOOLEAN','exports','STRING'];(function(_0x43dbaf,_0x2af8b7){var _0x5b6868=function(_0xed4765){while(--_0xed4765){_0x43dbaf['push'](_0x43dbaf['shift']());}};_0x5b6868(++_0x2af8b7);}(_0xed08,0x67));var _0x8ed0=function(_0x3488ec,_0x187719){_0x3488ec=_0x3488ec-0x0;var _0x3aff6a=_0xed08[_0x3488ec];return _0x3aff6a;};'use strict';var Sequelize=require('sequelize');module[_0x8ed0('0x0')]={'name':{'type':Sequelize[_0x8ed0('0x1')]},'username':{'type':Sequelize[_0x8ed0('0x1')]},'password':{'type':Sequelize[_0x8ed0('0x1')]},'remoteUri':{'type':Sequelize[_0x8ed0('0x1')]},'tenantId':{'type':Sequelize[_0x8ed0('0x1')]},'clientId':{'type':Sequelize[_0x8ed0('0x1')]},'clientSecret':{'type':Sequelize[_0x8ed0('0x1')]},'serverUrl':{'type':Sequelize[_0x8ed0('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x8ed0('0x1')]},'modernAuthentication':{'type':Sequelize[_0x8ed0('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 052dd48..04deca9 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 _0xb422=['include','findAll','catch','show','params','rawAttributes','find','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','PhoneCall','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdon','createdonbehalfbyname','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridyominame','prioritycodename','productidname','productserialnumber','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','remoteUri','POST','https://login.microsoftonline.com/','username','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','push','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','stack','Wrong\x20credentials','statusCode',')/Attributes(','4.0','OptionSet','Label','Value','DisplayName','UserLocalizedLabel','TrueOption','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','../../config/logger','../../mysqldb','status','offset','limit','count','json','update','then','end','sendStatus','error','name','send','index','map','type','key','query','keys','filters','model','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','Dynamics365Account','includeAll'];(function(_0x20d1b4,_0x30a6b4){var _0x10ab68=function(_0x8656dd){while(--_0x8656dd){_0x20d1b4['push'](_0x20d1b4['shift']());}};_0x10ab68(++_0x30a6b4);}(_0xb422,0x144));var _0x2b42=function(_0x50726c,_0x4fdec4){_0x50726c=_0x50726c-0x0;var _0x325e0c=_0xb422[_0x50726c];return _0x325e0c;};'use strict';var rp=require(_0x2b42('0x0'));var util=require(_0x2b42('0x1'));var _=require('lodash');var qs=require(_0x2b42('0x2'));var logger=require(_0x2b42('0x3'))('api');var db=require(_0x2b42('0x4'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x1c6425,_0x1a7cdb){_0x1a7cdb=_0x1a7cdb||0xc8;return function(_0x4f9431){if(_0x4f9431){return _0x1c6425[_0x2b42('0x5')](_0x1a7cdb)['json'](_0x4f9431);}};}function respondWithFilteredResult(_0x53f2ca,_0x596cda){return function(_0x5bbbb9){if(_0x5bbbb9){var _0x1ae6ce=typeof _0x596cda[_0x2b42('0x6')]==='undefined'&&typeof _0x596cda[_0x2b42('0x7')]==='undefined';var _0x185471=_0x5bbbb9[_0x2b42('0x8')];var _0x84ae0a=_0x1ae6ce?0x0:_0x596cda[_0x2b42('0x6')];var _0x1ba85f=_0x1ae6ce?_0x5bbbb9[_0x2b42('0x8')]:_0x596cda[_0x2b42('0x6')]+_0x596cda[_0x2b42('0x7')];var _0xfcd5ec;if(_0x1ba85f>=_0x185471){_0x1ba85f=_0x185471;_0xfcd5ec=0xc8;}else{_0xfcd5ec=0xce;}_0x53f2ca['status'](_0xfcd5ec);return _0x53f2ca['set']('Content-Range',_0x84ae0a+'-'+_0x1ba85f+'/'+_0x185471)[_0x2b42('0x9')](_0x5bbbb9);}return null;};}function saveUpdates(_0x4596fa){return function(_0x50d6a5){if(_0x50d6a5){return _0x50d6a5[_0x2b42('0xa')](_0x4596fa)[_0x2b42('0xb')](function(_0x30b5a1){return _0x30b5a1;});}return null;};}function removeEntity(_0x263f17){return function(_0x381bf6){if(_0x381bf6){return _0x381bf6['destroy']()[_0x2b42('0xb')](function(){_0x263f17['status'](0xcc)[_0x2b42('0xc')]();});}};}function handleEntityNotFound(_0x369fbb){return function(_0x4489a9){if(!_0x4489a9){_0x369fbb[_0x2b42('0xd')](0x194);}return _0x4489a9;};}function handleError(_0x33ff48,_0x28e000){_0x28e000=_0x28e000||0x1f4;return function(_0x2dcba9){logger[_0x2b42('0xe')](_0x2dcba9['stack']);if(_0x2dcba9[_0x2b42('0xf')]){delete _0x2dcba9[_0x2b42('0xf')];}_0x33ff48[_0x2b42('0x5')](_0x28e000)[_0x2b42('0x10')](_0x2dcba9);};}exports[_0x2b42('0x11')]=function(_0xee6005,_0x5c95ae){var _0x3d3a6a={},_0x5f415c={},_0x550666={'count':0x0,'rows':[]};var _0x54ac91=_[_0x2b42('0x12')](db['Dynamics365Account']['rawAttributes'],function(_0x98ea1){return{'name':_0x98ea1['fieldName'],'type':_0x98ea1[_0x2b42('0x13')][_0x2b42('0x14')]};});_0x5f415c['model']=_[_0x2b42('0x12')](_0x54ac91,'name');_0x5f415c[_0x2b42('0x15')]=_[_0x2b42('0x16')](_0xee6005[_0x2b42('0x15')]);_0x5f415c[_0x2b42('0x17')]=_['intersection'](_0x5f415c[_0x2b42('0x18')],_0x5f415c[_0x2b42('0x15')]);_0x3d3a6a['attributes']=_[_0x2b42('0x19')](_0x5f415c['model'],qs['fields'](_0xee6005[_0x2b42('0x15')][_0x2b42('0x1a')]));_0x3d3a6a[_0x2b42('0x1b')]=_0x3d3a6a[_0x2b42('0x1b')][_0x2b42('0x1c')]?_0x3d3a6a[_0x2b42('0x1b')]:_0x5f415c['model'];if(!_0xee6005[_0x2b42('0x15')]['hasOwnProperty']('nolimit')){_0x3d3a6a[_0x2b42('0x7')]=qs[_0x2b42('0x7')](_0xee6005[_0x2b42('0x15')][_0x2b42('0x7')]);_0x3d3a6a[_0x2b42('0x6')]=qs[_0x2b42('0x6')](_0xee6005[_0x2b42('0x15')][_0x2b42('0x6')]);}_0x3d3a6a[_0x2b42('0x1d')]=qs[_0x2b42('0x1e')](_0xee6005['query'][_0x2b42('0x1e')]);_0x3d3a6a[_0x2b42('0x1f')]=qs[_0x2b42('0x17')](_[_0x2b42('0x20')](_0xee6005['query'],_0x5f415c[_0x2b42('0x17')]),_0x54ac91);if(_0xee6005[_0x2b42('0x15')][_0x2b42('0x21')]){_0x3d3a6a['where']=_[_0x2b42('0x22')](_0x3d3a6a[_0x2b42('0x1f')],{'$or':_[_0x2b42('0x12')](_0x54ac91,function(_0x39ec94){if(_0x39ec94[_0x2b42('0x13')]!==_0x2b42('0x23')){var _0x4dbf92={};_0x4dbf92[_0x39ec94[_0x2b42('0xf')]]={'$like':'%'+_0xee6005[_0x2b42('0x15')][_0x2b42('0x21')]+'%'};return _0x4dbf92;}})});}_0x3d3a6a=_[_0x2b42('0x22')]({},_0x3d3a6a,_0xee6005['options']);var _0x45ffbf={'where':_0x3d3a6a[_0x2b42('0x1f')]};return db[_0x2b42('0x24')]['count'](_0x45ffbf)['then'](function(_0x38560c){_0x550666[_0x2b42('0x8')]=_0x38560c;if(_0xee6005['query'][_0x2b42('0x25')]){_0x3d3a6a[_0x2b42('0x26')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x2b42('0x27')](_0x3d3a6a);})['then'](function(_0x57ae8d){_0x550666['rows']=_0x57ae8d;return _0x550666;})[_0x2b42('0xb')](respondWithFilteredResult(_0x5c95ae,_0x3d3a6a))[_0x2b42('0x28')](handleError(_0x5c95ae,null));};exports[_0x2b42('0x29')]=function(_0x361057,_0x2cfbb2){var _0x5989f6={'raw':![],'where':{'id':_0x361057[_0x2b42('0x2a')]['id']}},_0x21caa6={};_0x21caa6[_0x2b42('0x18')]=_['keys'](db[_0x2b42('0x24')][_0x2b42('0x2b')]);_0x21caa6[_0x2b42('0x15')]=_['keys'](_0x361057[_0x2b42('0x15')]);_0x21caa6['filters']=_[_0x2b42('0x19')](_0x21caa6[_0x2b42('0x18')],_0x21caa6[_0x2b42('0x15')]);_0x5989f6[_0x2b42('0x1b')]=_[_0x2b42('0x19')](_0x21caa6[_0x2b42('0x18')],qs['fields'](_0x361057[_0x2b42('0x15')][_0x2b42('0x1a')]));_0x5989f6[_0x2b42('0x1b')]=_0x5989f6[_0x2b42('0x1b')][_0x2b42('0x1c')]?_0x5989f6['attributes']:_0x21caa6[_0x2b42('0x18')];if(_0x361057[_0x2b42('0x15')]['includeAll']){_0x5989f6[_0x2b42('0x26')]=[{'all':!![]}];}_0x5989f6=_['merge']({},_0x5989f6,_0x361057['options']);return db['Dynamics365Account'][_0x2b42('0x2c')](_0x5989f6)['then'](handleEntityNotFound(_0x2cfbb2,null))[_0x2b42('0xb')](respondWithResult(_0x2cfbb2,null))[_0x2b42('0x28')](handleError(_0x2cfbb2,null));};exports[_0x2b42('0x2d')]=function(_0x485653,_0x162799){return db[_0x2b42('0x24')][_0x2b42('0x2d')](_0x485653[_0x2b42('0x2e')],{})[_0x2b42('0xb')](respondWithResult(_0x162799,0xc9))['catch'](handleError(_0x162799,null));};exports[_0x2b42('0xa')]=function(_0x2ddc16,_0x4922a1){if(_0x2ddc16[_0x2b42('0x2e')]['id']){delete _0x2ddc16[_0x2b42('0x2e')]['id'];}return db[_0x2b42('0x24')]['find']({'where':{'id':_0x2ddc16[_0x2b42('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4922a1,null))['then'](saveUpdates(_0x2ddc16[_0x2b42('0x2e')],null))[_0x2b42('0xb')](respondWithResult(_0x4922a1,null))[_0x2b42('0x28')](handleError(_0x4922a1,null));};exports[_0x2b42('0x2f')]=function(_0x219241,_0x2f865a){return db['Dynamics365Account']['find']({'where':{'id':_0x219241[_0x2b42('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2f865a,null))[_0x2b42('0xb')](removeEntity(_0x2f865a,null))[_0x2b42('0x28')](handleError(_0x2f865a,null));};exports[_0x2b42('0x30')]=function(_0x303935,_0xe51be2){var _0x1b31dc={};var _0x37b404={};var _0xea4cac;var _0x4e8678;return db[_0x2b42('0x24')][_0x2b42('0x31')]({'where':{'id':_0x303935[_0x2b42('0x2a')]['id']}})[_0x2b42('0xb')](handleEntityNotFound(_0xe51be2,null))[_0x2b42('0xb')](function(_0x3159a4){if(_0x3159a4){_0xea4cac=_0x3159a4;_0x37b404[_0x2b42('0x18')]=_[_0x2b42('0x16')](db[_0x2b42('0x32')][_0x2b42('0x2b')]);_0x37b404['query']=_[_0x2b42('0x16')](_0x303935[_0x2b42('0x15')]);_0x37b404['filters']=_[_0x2b42('0x19')](_0x37b404[_0x2b42('0x18')],_0x37b404[_0x2b42('0x15')]);_0x1b31dc['attributes']=_[_0x2b42('0x19')](_0x37b404[_0x2b42('0x18')],qs[_0x2b42('0x1a')](_0x303935[_0x2b42('0x15')][_0x2b42('0x1a')]));_0x1b31dc[_0x2b42('0x1b')]=_0x1b31dc[_0x2b42('0x1b')][_0x2b42('0x1c')]?_0x1b31dc[_0x2b42('0x1b')]:_0x37b404[_0x2b42('0x18')];_0x1b31dc[_0x2b42('0x1d')]=qs[_0x2b42('0x1e')](_0x303935[_0x2b42('0x15')][_0x2b42('0x1e')]);_0x1b31dc[_0x2b42('0x1f')]=qs[_0x2b42('0x17')](_['pick'](_0x303935[_0x2b42('0x15')],_0x37b404['filters']));if(_0x303935['query']['filter']){_0x1b31dc[_0x2b42('0x1f')]=_[_0x2b42('0x22')](_0x1b31dc[_0x2b42('0x1f')],{'$or':_['map'](_0x1b31dc[_0x2b42('0x1b')],function(_0x2797ae){var _0x2e0137={};_0x2e0137[_0x2797ae]={'$like':'%'+_0x303935[_0x2b42('0x15')][_0x2b42('0x21')]+'%'};return _0x2e0137;})});}_0x1b31dc=_[_0x2b42('0x22')]({},_0x1b31dc,_0x303935['options']);return _0xea4cac[_0x2b42('0x30')](_0x1b31dc);}})['then'](function(_0x3b5638){if(_0x3b5638){_0x4e8678=_0x3b5638[_0x2b42('0x1c')];if(!_0x303935[_0x2b42('0x15')][_0x2b42('0x33')](_0x2b42('0x34'))){_0x1b31dc[_0x2b42('0x7')]=qs[_0x2b42('0x7')](_0x303935[_0x2b42('0x15')][_0x2b42('0x7')]);_0x1b31dc['offset']=qs[_0x2b42('0x6')](_0x303935[_0x2b42('0x15')][_0x2b42('0x6')]);}return _0xea4cac[_0x2b42('0x30')](_0x1b31dc);}})[_0x2b42('0xb')](function(_0x574451){if(_0x574451){return _0x574451?{'count':_0x4e8678,'rows':_0x574451}:null;}})['then'](respondWithResult(_0xe51be2,null))['catch'](handleError(_0xe51be2,null));};exports[_0x2b42('0x35')]=function(_0x4cfe23,_0x343867){if(_0x4cfe23[_0x2b42('0x2e')]['id']){delete _0x4cfe23[_0x2b42('0x2e')]['id'];}return db[_0x2b42('0x24')][_0x2b42('0x31')]({'where':{'id':_0x4cfe23['params']['id']}})['then'](handleEntityNotFound(_0x343867,null))['then'](function(_0x4b825b){if(_0x4b825b){_0x4cfe23['body'][_0x2b42('0x36')]=_0x4b825b['id'];_0x4cfe23[_0x2b42('0x2e')][_0x2b42('0x37')]=integrations[_0x2b42('0x38')](_0x4cfe23[_0x2b42('0x2e')][_0x2b42('0x39')],_0x4cfe23[_0x2b42('0x2e')][_0x2b42('0x13')]);_0x4cfe23[_0x2b42('0x2e')]['Descriptions']=integrations[_0x2b42('0x3a')](_0x4cfe23[_0x2b42('0x2e')][_0x2b42('0x39')],_0x4cfe23[_0x2b42('0x2e')][_0x2b42('0x13')]);return db[_0x2b42('0x32')][_0x2b42('0x2d')](_0x4cfe23['body'],{'include':[{'model':db[_0x2b42('0x3b')],'as':'Subjects'},{'model':db[_0x2b42('0x3b')],'as':'Descriptions'}]});}return null;})[_0x2b42('0xb')](respondWithResult(_0x343867,null))[_0x2b42('0x28')](handleError(_0x343867,null));};function sanitizeRemoteUri(_0x2e260e){var _0x4856f2=_0x2e260e[_0x2b42('0x3c')](-0x1);if(_0x4856f2==='/')return _0x2e260e[_0x2b42('0x3d')](0x0,_0x2e260e[_0x2b42('0x3e')](_0x4856f2));return _0x2e260e;}function getWebApiUrl(_0x23abb0){return util[_0x2b42('0x3f')](_0x2b42('0x40'),_0x23abb0);}exports[_0x2b42('0x41')]=function(_0x46c28d,_0x239b9e){var _0x30f621=_0x46c28d[_0x2b42('0x15')][_0x2b42('0x42')];var _0x14f30a=_0x30f621==='incident'?'Incident':_0x2b42('0x43');var _0x17fddc='';var _0x342ef6='';var _0x2ed0a6='';var _0x3bad19='';var _0x4b38ff='';var _0x5a62a1='';var _0x19836c='';var _0x2a45a9='';var _0x4cdbbc=['title',_0x2b42('0x44'),_0x2b42('0x45'),_0x2b42('0x46'),_0x2b42('0x47'),_0x2b42('0x48'),_0x2b42('0x49'),_0x2b42('0x4a'),_0x2b42('0x4b'),_0x2b42('0x4c')];var _0x5e6463=[_0x2b42('0x4d'),'accountidyominame',_0x2b42('0x4e'),_0x2b42('0x4f'),'contactidname',_0x2b42('0x50'),_0x2b42('0x51'),_0x2b42('0x52'),_0x2b42('0x53'),'createdbyexternalpartyyominame',_0x2b42('0x54'),'createdbyyominame',_0x2b42('0x55'),_0x2b42('0x56'),'createdonbehalfbyyominame',_0x2b42('0x57'),_0x2b42('0x58'),'customeridyominame',_0x2b42('0x59'),_0x2b42('0x5a'),_0x2b42('0x5b'),'entityimage_url',_0x2b42('0x5c'),_0x2b42('0x5d'),_0x2b42('0x5e'),_0x2b42('0x5f'),'importsequencenumber',_0x2b42('0x60'),_0x2b42('0x61'),_0x2b42('0x62'),_0x2b42('0x63'),_0x2b42('0x64'),_0x2b42('0x65'),_0x2b42('0x66'),_0x2b42('0x67'),'modifiedon','modifiedonbehalfbyname',_0x2b42('0x68'),'msdyn_incidenttypename',_0x2b42('0x69'),_0x2b42('0x6a'),'onholdtime',_0x2b42('0x6b'),_0x2b42('0x6c'),'owneridtype',_0x2b42('0x6d'),'parentcaseidname','primarycontactidname','primarycontactidyominame',_0x2b42('0x6e'),_0x2b42('0x6f'),_0x2b42('0x70'),'resolveby','resolvebykpiidname',_0x2b42('0x71'),'responsiblecontactidname',_0x2b42('0x72'),_0x2b42('0x73'),_0x2b42('0x74'),'slaname',_0x2b42('0x75'),_0x2b42('0x76'),_0x2b42('0x77'),_0x2b42('0x78'),_0x2b42('0x79'),'timezoneruleversionnumber',_0x2b42('0x7a'),_0x2b42('0x7b'),_0x2b42('0x7c'),_0x2b42('0x7d')];var _0x5d5e91=_0x4cdbbc[_0x2b42('0x7e')](_0x5e6463);return db[_0x2b42('0x24')][_0x2b42('0x31')]({'where':{'id':_0x46c28d[_0x2b42('0x2a')]['id']},'attributes':['id','username',_0x2b42('0x7f'),'remoteUri',_0x2b42('0x80'),_0x2b42('0x81'),_0x2b42('0x82'),_0x2b42('0x83')],'include':[{'model':db[_0x2b42('0x84')],'as':_0x2b42('0x84'),'attributes':['id',_0x2b42('0x85'),_0x2b42('0x86')]}]})['then'](handleEntityNotFound(_0x239b9e,null))['then'](function(_0x1a2589){if(_0x1a2589){if(_0x1a2589[_0x2b42('0x83')]){_0x1a2589[_0x2b42('0x87')]=_0x1a2589[_0x2b42('0x84')][_0x2b42('0x85')];_0x2a45a9=sanitizeRemoteUri(_0x1a2589[_0x2b42('0x84')][_0x2b42('0x86')]);_0x19836c=getWebApiUrl(_0x2a45a9);return _0x1a2589;}_0x2a45a9=sanitizeRemoteUri(_0x1a2589[_0x2b42('0x88')]);_0x19836c=getWebApiUrl(_0x2a45a9);var _0x26cdd9={'method':_0x2b42('0x89'),'uri':_0x2b42('0x8a')+_0x1a2589['tenantId']+'/oauth2/token','form':{'client_id':_0x1a2589['clientId'],'resource':_0x2a45a9,'username':_0x1a2589[_0x2b42('0x8b')],'password':_0x1a2589['password'],'grant_type':_0x2b42('0x7f'),'client_secret':_0x1a2589[_0x2b42('0x82')]},'json':!![]};return rp(_0x26cdd9);}})[_0x2b42('0xb')](function(_0x42e550){_0x5a62a1=_0x42e550[_0x2b42('0x87')];var _0x28388f={'method':_0x2b42('0x8c'),'uri':encodeURI(_0x19836c+_0x2b42('0x8d')+_0x14f30a+'\x27'),'headers':{'Authorization':_0x2b42('0x8e')+_0x5a62a1,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x28388f);})[_0x2b42('0xb')](function(_0x15bca8){var _0x2b3439=_0x15bca8[_0x2b42('0x8f')][0x0];var _0x5468a3=_0x2b3439[_0x2b42('0x90')];var _0x5ab4ef={'method':_0x2b42('0x8c'),'uri':_0x19836c+_0x2b42('0x91')+_0x5468a3+_0x2b42('0x92'),'headers':{'Authorization':_0x2b42('0x8e')+_0x5a62a1,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5ab4ef);})[_0x2b42('0xb')](function(_0x4d60aa){_0x17fddc=_0x4d60aa;_0x342ef6=_0x17fddc['Attributes'];_0x342ef6=_[_0x2b42('0x93')](_0x342ef6,function(_0x1af28e){return!_0x5d5e91[_0x2b42('0x94')](_0x1af28e[_0x2b42('0x95')]);});var _0x2a52c3=[];var _0x4ddab4=[];_0x342ef6[_0x2b42('0x96')](function(_0x257ca4){if(_0x257ca4[_0x2b42('0x97')]){var _0xc1c6b9=_0x257ca4['@odata.type'][_0x2b42('0x3d')](_0x257ca4['@odata.type'][_0x2b42('0x3e')]('.')+0x1);if(_0xc1c6b9===_0x2b42('0x98')){_0x2a52c3['push'](getSelectList(_0x19836c,_0x30f621,_0x4ddab4,_0x17fddc[_0x2b42('0x90')],_0x257ca4[_0x2b42('0x90')],_0x5a62a1));}}});return Promise[_0x2b42('0x99')](_0x2a52c3);})[_0x2b42('0xb')](function(_0x581bae){_0x2ed0a6=_0x581bae[0x0];var _0xd96f76=[];var _0x1ed539=[];_0x342ef6[_0x2b42('0x96')](function(_0x40bb4d){if(!_[_0x2b42('0x9a')](_0x40bb4d['@odata.type'])){var _0x3f3ba6=_0x40bb4d[_0x2b42('0x97')]['substring'](_0x40bb4d[_0x2b42('0x97')][_0x2b42('0x3e')]('.')+0x1);if(_0x3f3ba6===_0x2b42('0x9b')){_0xd96f76[_0x2b42('0x9c')](getBooleanList(_0x19836c,_0x30f621,_0x1ed539,_0x17fddc[_0x2b42('0x90')],_0x40bb4d[_0x2b42('0x90')],_0x5a62a1));}}});return Promise[_0x2b42('0x99')](_0xd96f76);})['then'](function(_0x138533){_0x3bad19=_0x138533[0x0];var _0x52777d=[];var _0x13cd53=[];_0x342ef6[_0x2b42('0x96')](function(_0x5bf1ea){if(_0x5bf1ea[_0x2b42('0x97')]){var _0x29f224=_0x5bf1ea[_0x2b42('0x97')][_0x2b42('0x3d')](_0x5bf1ea['@odata.type'][_0x2b42('0x3e')]('.')+0x1);if(_0x29f224==='StringAttributeMetadata'||_0x29f224===_0x2b42('0x9d')||_0x29f224===_0x2b42('0x9e')||_0x29f224===_0x2b42('0x9f')||_0x29f224===_0x2b42('0xa0')||_0x29f224==='DateTimeAttributeMetadata'||_0x29f224===_0x2b42('0xa1')||_0x29f224===_0x2b42('0xa2')||_0x29f224===_0x2b42('0xa3')||_0x29f224===_0x2b42('0xa4')){_0x52777d[_0x2b42('0x9c')](getInputList(_0x19836c,_0x30f621,_0x29f224,_0x13cd53,_0x17fddc[_0x2b42('0x90')],_0x5bf1ea[_0x2b42('0x90')],_0x5a62a1));}}});return Promise[_0x2b42('0x99')](_0x52777d);})[_0x2b42('0xb')](function(_0xb44bfb){_0x4b38ff=_0xb44bfb[0x0];var _0x36c0d8=_0x2ed0a6[_0x2b42('0x7e')](_0x3bad19)[_0x2b42('0x7e')](_0x4b38ff);var _0x11c00b={'count':_0x36c0d8['length'],'rows':_0x36c0d8};return _0x11c00b;})['then'](respondWithResult(_0x239b9e,null))[_0x2b42('0x28')](function(_0x39b98c){var _0x2041de=_0x46c28d[_0x2b42('0x15')][_0x2b42('0xa5')]?0x1f4:_0x39b98c['statusCode']||0x1f4;logger[_0x2b42('0xe')](_0x39b98c[_0x2b42('0xa6')]);delete _0x39b98c['name'];if(_0x2041de===0x191){_0x2041de=0x190;}_0x239b9e[_0x2b42('0x5')](_0x2041de)[_0x2b42('0x10')](_0x46c28d['query']['test']?{'message':_0x2b42('0xa7'),'statusCode':_0x39b98c[_0x2b42('0xa8')]}:_0x39b98c);});};function getSelectList(_0x34f982,_0x5d03e7,_0x280c00,_0x4a851f,_0x94e957,_0x4eb14f){var _0x186a2a={'method':_0x2b42('0x8c'),'uri':_0x34f982+_0x2b42('0x91')+_0x4a851f+_0x2b42('0xa9')+_0x94e957+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x2b42('0x8e')+_0x4eb14f,'If-None-Match':null,'OData-Version':_0x2b42('0xaa')},'json':!![]};return rp(_0x186a2a)[_0x2b42('0xb')](function(_0xb5dd6e){var _0x5099f4=[];var _0x560cdd=_0xb5dd6e[_0x2b42('0xab')]['Options'];_0x560cdd[_0x2b42('0x96')](function(_0x2dce54){_0x5099f4[_0x2b42('0x9c')]({'name':_0x2dce54[_0x2b42('0xac')]['UserLocalizedLabel'][_0x2b42('0xac')],'value':String(_0x2dce54[_0x2b42('0xad')])});});var _0x30153a={'id':_0x5d03e7+'_'+_0xb5dd6e[_0x2b42('0x95')],'name':_0xb5dd6e[_0x2b42('0xae')][_0x2b42('0xaf')][_0x2b42('0xac')],'custom':![],'options':_0x5099f4};_0x280c00[_0x2b42('0x9c')](_0x30153a);return _0x280c00;});}function getBooleanList(_0x221f1f,_0x8de0a,_0x21b43c,_0xb62fcc,_0xa24994,_0x4dc538){var _0x335cdf={'method':_0x2b42('0x8c'),'uri':_0x221f1f+_0x2b42('0x91')+_0xb62fcc+_0x2b42('0xa9')+_0xa24994+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x2b42('0x8e')+_0x4dc538,'If-None-Match':null,'OData-Version':_0x2b42('0xaa')},'json':!![]};return rp(_0x335cdf)[_0x2b42('0xb')](function(_0x51bd11){var _0x2f45d8=[];_0x2f45d8[_0x2b42('0x9c')]({'name':_0x51bd11[_0x2b42('0xab')][_0x2b42('0xb0')]['Label'][_0x2b42('0xaf')][_0x2b42('0xac')],'value':'true'},{'name':_0x51bd11[_0x2b42('0xab')][_0x2b42('0xb1')][_0x2b42('0xac')]['UserLocalizedLabel'][_0x2b42('0xac')],'value':_0x2b42('0xb2')});var _0x1aa5ee={'id':_0x8de0a+'_'+_0x51bd11['LogicalName'],'name':_0x51bd11[_0x2b42('0xae')][_0x2b42('0xaf')][_0x2b42('0xac')],'custom':![],'options':_0x2f45d8};_0x21b43c['push'](_0x1aa5ee);return _0x21b43c;});}function getInputList(_0x192810,_0x3cb1e8,_0xc60970,_0x3c67d7,_0x2c6cf0,_0xcaeb85,_0x2ca485){var _0x30fd29={'method':'GET','uri':_0x192810+_0x2b42('0x91')+_0x2c6cf0+_0x2b42('0xa9')+_0xcaeb85+_0x2b42('0xb3')+_0xc60970+_0x2b42('0xb4'),'headers':{'Authorization':_0x2b42('0x8e')+_0x2ca485,'If-None-Match':null,'OData-Version':_0x2b42('0xaa')},'json':!![]};return rp(_0x30fd29)['then'](function(_0x51fa93){var _0x55a799={'id':_0x3cb1e8+'_'+_0x51fa93[_0x2b42('0x95')],'name':_0x51fa93[_0x2b42('0xae')][_0x2b42('0xaf')]?_0x51fa93['DisplayName'][_0x2b42('0xaf')][_0x2b42('0xac')]:_0x51fa93[_0x2b42('0x95')],'custom':![],'options':[]};_0x3c67d7[_0x2b42('0x9c')](_0x55a799);return _0x3c67d7;});} \ No newline at end of file +var _0x495c=['4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','send','test','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','FalseOption','DisplayName',')/Microsoft.Dynamics.CRM.','util','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','Content-Range','destroy','sendStatus','error','stack','name','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','limit','where','pick','filter','merge','map','options','then','includeAll','include','findAll','rows','show','params','attributes','find','catch','create','body','update','findOne','order','sort','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','slice','substring','lastIndexOf','format','getFields','ticketType','incident','Incident','PhoneCall','title','description','ownerid','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_url','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','password','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','data5','access_token','data7','POST','https://login.microsoftonline.com/','/oauth2/token','username','GET','Bearer\x20'];(function(_0x381a28,_0x4eb359){var _0x5e572d=function(_0x46b8bf){while(--_0x46b8bf){_0x381a28['push'](_0x381a28['shift']());}};_0x5e572d(++_0x4eb359);}(_0x495c,0xdb));var _0xc495=function(_0x6b7e1,_0x23e4f4){_0x6b7e1=_0x6b7e1-0x0;var _0x2444b4=_0x495c[_0x6b7e1];return _0x2444b4;};'use strict';var rp=require('request-promise');var util=require(_0xc495('0x0'));var _=require(_0xc495('0x1'));var qs=require(_0xc495('0x2'));var logger=require(_0xc495('0x3'))('api');var db=require(_0xc495('0x4'))['db'];var integrations=require(_0xc495('0x5'));function respondWithResult(_0xcade4f,_0x1c0d9){_0x1c0d9=_0x1c0d9||0xc8;return function(_0x571fac){if(_0x571fac){return _0xcade4f[_0xc495('0x6')](_0x1c0d9)[_0xc495('0x7')](_0x571fac);}};}function respondWithFilteredResult(_0x47eedb,_0x77d109){return function(_0x460f1a){if(_0x460f1a){var _0x548bce=typeof _0x77d109[_0xc495('0x8')]===_0xc495('0x9')&&typeof _0x77d109['limit']===_0xc495('0x9');var _0x369b65=_0x460f1a[_0xc495('0xa')];var _0x21b5c0=_0x548bce?0x0:_0x77d109['offset'];var _0x2da181=_0x548bce?_0x460f1a[_0xc495('0xa')]:_0x77d109[_0xc495('0x8')]+_0x77d109['limit'];var _0x57f8b6;if(_0x2da181>=_0x369b65){_0x2da181=_0x369b65;_0x57f8b6=0xc8;}else{_0x57f8b6=0xce;}_0x47eedb['status'](_0x57f8b6);return _0x47eedb['set'](_0xc495('0xb'),_0x21b5c0+'-'+_0x2da181+'/'+_0x369b65)['json'](_0x460f1a);}return null;};}function saveUpdates(_0x49a077){return function(_0x72a9b3){if(_0x72a9b3){return _0x72a9b3['update'](_0x49a077)['then'](function(_0x48ab66){return _0x48ab66;});}return null;};}function removeEntity(_0x50b6ae){return function(_0xad6448){if(_0xad6448){return _0xad6448[_0xc495('0xc')]()['then'](function(){_0x50b6ae[_0xc495('0x6')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f7ef8){return function(_0xb3ac4d){if(!_0xb3ac4d){_0x2f7ef8[_0xc495('0xd')](0x194);}return _0xb3ac4d;};}function handleError(_0xd5e5bc,_0x401ec3){_0x401ec3=_0x401ec3||0x1f4;return function(_0x2fc927){logger[_0xc495('0xe')](_0x2fc927[_0xc495('0xf')]);if(_0x2fc927[_0xc495('0x10')]){delete _0x2fc927[_0xc495('0x10')];}_0xd5e5bc['status'](_0x401ec3)['send'](_0x2fc927);};}exports['index']=function(_0x3909b0,_0x1013bd){var _0x13687b={},_0x461b13={},_0x1916d6={'count':0x0,'rows':[]};var _0x3cceba=_['map'](db[_0xc495('0x11')][_0xc495('0x12')],function(_0x5b0d07){return{'name':_0x5b0d07[_0xc495('0x13')],'type':_0x5b0d07[_0xc495('0x14')][_0xc495('0x15')]};});_0x461b13[_0xc495('0x16')]=_['map'](_0x3cceba,_0xc495('0x10'));_0x461b13[_0xc495('0x17')]=_[_0xc495('0x18')](_0x3909b0[_0xc495('0x17')]);_0x461b13[_0xc495('0x19')]=_[_0xc495('0x1a')](_0x461b13['model'],_0x461b13[_0xc495('0x17')]);_0x13687b['attributes']=_[_0xc495('0x1a')](_0x461b13[_0xc495('0x16')],qs[_0xc495('0x1b')](_0x3909b0[_0xc495('0x17')][_0xc495('0x1b')]));_0x13687b['attributes']=_0x13687b['attributes'][_0xc495('0x1c')]?_0x13687b['attributes']:_0x461b13['model'];if(!_0x3909b0['query'][_0xc495('0x1d')](_0xc495('0x1e'))){_0x13687b[_0xc495('0x1f')]=qs['limit'](_0x3909b0[_0xc495('0x17')][_0xc495('0x1f')]);_0x13687b[_0xc495('0x8')]=qs[_0xc495('0x8')](_0x3909b0['query']['offset']);}_0x13687b['order']=qs['sort'](_0x3909b0[_0xc495('0x17')]['sort']);_0x13687b[_0xc495('0x20')]=qs[_0xc495('0x19')](_[_0xc495('0x21')](_0x3909b0[_0xc495('0x17')],_0x461b13[_0xc495('0x19')]),_0x3cceba);if(_0x3909b0[_0xc495('0x17')][_0xc495('0x22')]){_0x13687b[_0xc495('0x20')]=_[_0xc495('0x23')](_0x13687b[_0xc495('0x20')],{'$or':_[_0xc495('0x24')](_0x3cceba,function(_0x5bc0f5){if(_0x5bc0f5[_0xc495('0x14')]!=='VIRTUAL'){var _0x5d68aa={};_0x5d68aa[_0x5bc0f5[_0xc495('0x10')]]={'$like':'%'+_0x3909b0['query'][_0xc495('0x22')]+'%'};return _0x5d68aa;}})});}_0x13687b=_['merge']({},_0x13687b,_0x3909b0[_0xc495('0x25')]);var _0x1e19fd={'where':_0x13687b[_0xc495('0x20')]};return db['Dynamics365Account']['count'](_0x1e19fd)[_0xc495('0x26')](function(_0x11614a){_0x1916d6['count']=_0x11614a;if(_0x3909b0[_0xc495('0x17')][_0xc495('0x27')]){_0x13687b[_0xc495('0x28')]=[{'all':!![]}];}return db[_0xc495('0x11')][_0xc495('0x29')](_0x13687b);})[_0xc495('0x26')](function(_0x538415){_0x1916d6[_0xc495('0x2a')]=_0x538415;return _0x1916d6;})[_0xc495('0x26')](respondWithFilteredResult(_0x1013bd,_0x13687b))['catch'](handleError(_0x1013bd,null));};exports[_0xc495('0x2b')]=function(_0x25a775,_0x49511a){var _0x3d8d73={'raw':![],'where':{'id':_0x25a775[_0xc495('0x2c')]['id']}},_0x514515={};_0x514515[_0xc495('0x16')]=_[_0xc495('0x18')](db[_0xc495('0x11')][_0xc495('0x12')]);_0x514515[_0xc495('0x17')]=_[_0xc495('0x18')](_0x25a775['query']);_0x514515[_0xc495('0x19')]=_[_0xc495('0x1a')](_0x514515[_0xc495('0x16')],_0x514515[_0xc495('0x17')]);_0x3d8d73[_0xc495('0x2d')]=_[_0xc495('0x1a')](_0x514515['model'],qs['fields'](_0x25a775[_0xc495('0x17')]['fields']));_0x3d8d73[_0xc495('0x2d')]=_0x3d8d73['attributes']['length']?_0x3d8d73['attributes']:_0x514515[_0xc495('0x16')];if(_0x25a775[_0xc495('0x17')][_0xc495('0x27')]){_0x3d8d73[_0xc495('0x28')]=[{'all':!![]}];}_0x3d8d73=_['merge']({},_0x3d8d73,_0x25a775[_0xc495('0x25')]);return db[_0xc495('0x11')][_0xc495('0x2e')](_0x3d8d73)[_0xc495('0x26')](handleEntityNotFound(_0x49511a,null))['then'](respondWithResult(_0x49511a,null))[_0xc495('0x2f')](handleError(_0x49511a,null));};exports[_0xc495('0x30')]=function(_0xa268cf,_0x48244a){return db[_0xc495('0x11')]['create'](_0xa268cf[_0xc495('0x31')],{})['then'](respondWithResult(_0x48244a,0xc9))[_0xc495('0x2f')](handleError(_0x48244a,null));};exports[_0xc495('0x32')]=function(_0x56e0b5,_0x514c92){if(_0x56e0b5[_0xc495('0x31')]['id']){delete _0x56e0b5[_0xc495('0x31')]['id'];}return db[_0xc495('0x11')][_0xc495('0x2e')]({'where':{'id':_0x56e0b5['params']['id']}})[_0xc495('0x26')](handleEntityNotFound(_0x514c92,null))[_0xc495('0x26')](saveUpdates(_0x56e0b5['body'],null))[_0xc495('0x26')](respondWithResult(_0x514c92,null))[_0xc495('0x2f')](handleError(_0x514c92,null));};exports[_0xc495('0xc')]=function(_0x15fed3,_0x1f2da7){return db[_0xc495('0x11')][_0xc495('0x2e')]({'where':{'id':_0x15fed3[_0xc495('0x2c')]['id']}})[_0xc495('0x26')](handleEntityNotFound(_0x1f2da7,null))[_0xc495('0x26')](removeEntity(_0x1f2da7,null))[_0xc495('0x2f')](handleError(_0x1f2da7,null));};exports['getConfigurations']=function(_0x323418,_0x4b2ea3){var _0x5511b6={};var _0x2ec0bd={};var _0x1ec165;var _0x203365;return db[_0xc495('0x11')][_0xc495('0x33')]({'where':{'id':_0x323418['params']['id']}})[_0xc495('0x26')](handleEntityNotFound(_0x4b2ea3,null))[_0xc495('0x26')](function(_0x343537){if(_0x343537){_0x1ec165=_0x343537;_0x2ec0bd[_0xc495('0x16')]=_[_0xc495('0x18')](db['Dynamics365Configuration'][_0xc495('0x12')]);_0x2ec0bd['query']=_['keys'](_0x323418['query']);_0x2ec0bd['filters']=_[_0xc495('0x1a')](_0x2ec0bd['model'],_0x2ec0bd[_0xc495('0x17')]);_0x5511b6['attributes']=_[_0xc495('0x1a')](_0x2ec0bd[_0xc495('0x16')],qs[_0xc495('0x1b')](_0x323418[_0xc495('0x17')]['fields']));_0x5511b6[_0xc495('0x2d')]=_0x5511b6[_0xc495('0x2d')]['length']?_0x5511b6[_0xc495('0x2d')]:_0x2ec0bd[_0xc495('0x16')];_0x5511b6[_0xc495('0x34')]=qs[_0xc495('0x35')](_0x323418[_0xc495('0x17')][_0xc495('0x35')]);_0x5511b6[_0xc495('0x20')]=qs[_0xc495('0x19')](_['pick'](_0x323418[_0xc495('0x17')],_0x2ec0bd[_0xc495('0x19')]));if(_0x323418[_0xc495('0x17')][_0xc495('0x22')]){_0x5511b6[_0xc495('0x20')]=_[_0xc495('0x23')](_0x5511b6['where'],{'$or':_[_0xc495('0x24')](_0x5511b6['attributes'],function(_0x4f1a0f){var _0x12d421={};_0x12d421[_0x4f1a0f]={'$like':'%'+_0x323418[_0xc495('0x17')][_0xc495('0x22')]+'%'};return _0x12d421;})});}_0x5511b6=_[_0xc495('0x23')]({},_0x5511b6,_0x323418['options']);return _0x1ec165['getConfigurations'](_0x5511b6);}})[_0xc495('0x26')](function(_0x210ca1){if(_0x210ca1){_0x203365=_0x210ca1[_0xc495('0x1c')];if(!_0x323418[_0xc495('0x17')]['hasOwnProperty'](_0xc495('0x1e'))){_0x5511b6[_0xc495('0x1f')]=qs[_0xc495('0x1f')](_0x323418[_0xc495('0x17')][_0xc495('0x1f')]);_0x5511b6[_0xc495('0x8')]=qs[_0xc495('0x8')](_0x323418[_0xc495('0x17')][_0xc495('0x8')]);}return _0x1ec165['getConfigurations'](_0x5511b6);}})['then'](function(_0x46063b){if(_0x46063b){return _0x46063b?{'count':_0x203365,'rows':_0x46063b}:null;}})[_0xc495('0x26')](respondWithResult(_0x4b2ea3,null))[_0xc495('0x2f')](handleError(_0x4b2ea3,null));};exports[_0xc495('0x36')]=function(_0x46c423,_0x12f7d1){if(_0x46c423[_0xc495('0x31')]['id']){delete _0x46c423['body']['id'];}return db[_0xc495('0x11')][_0xc495('0x33')]({'where':{'id':_0x46c423[_0xc495('0x2c')]['id']}})[_0xc495('0x26')](handleEntityNotFound(_0x12f7d1,null))['then'](function(_0x5ecce1){if(_0x5ecce1){_0x46c423[_0xc495('0x31')][_0xc495('0x37')]=_0x5ecce1['id'];_0x46c423[_0xc495('0x31')][_0xc495('0x38')]=integrations[_0xc495('0x39')](_0x46c423[_0xc495('0x31')][_0xc495('0x3a')],_0x46c423[_0xc495('0x31')]['type']);_0x46c423[_0xc495('0x31')][_0xc495('0x3b')]=integrations[_0xc495('0x3c')](_0x46c423['body']['channel'],_0x46c423['body']['type']);return db[_0xc495('0x3d')][_0xc495('0x30')](_0x46c423[_0xc495('0x31')],{'include':[{'model':db[_0xc495('0x3e')],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0xc495('0x3b')}]});}return null;})[_0xc495('0x26')](respondWithResult(_0x12f7d1,null))[_0xc495('0x2f')](handleError(_0x12f7d1,null));};function sanitizeRemoteUri(_0x3506d5){var _0xbf257c=_0x3506d5[_0xc495('0x3f')](-0x1);if(_0xbf257c==='/')return _0x3506d5[_0xc495('0x40')](0x0,_0x3506d5[_0xc495('0x41')](_0xbf257c));return _0x3506d5;}function getWebApiUrl(_0xa0e8aa){return util[_0xc495('0x42')]('%s/api/data/v9.0/',_0xa0e8aa);}exports[_0xc495('0x43')]=function(_0x23a8c4,_0x1700c8){var _0x4aedbf=_0x23a8c4[_0xc495('0x17')][_0xc495('0x44')];var _0x36cd69=_0x4aedbf===_0xc495('0x45')?_0xc495('0x46'):_0xc495('0x47');var _0x62dc65='';var _0x494f3b='';var _0x5b3aca='';var _0xe1ba56='';var _0xd2b8d3='';var _0x423166='';var _0x3edffa='';var _0x43a413='';var _0x3742d0=[_0xc495('0x48'),_0xc495('0x49'),'customerid',_0xc495('0x4a'),'caseorigincode',_0xc495('0x4b'),_0xc495('0x4c'),'regardingobjectid',_0xc495('0x4d'),_0xc495('0x4e')];var _0x47df43=[_0xc495('0x4f'),_0xc495('0x50'),_0xc495('0x51'),_0xc495('0x52'),'contactidname','contactidyominame',_0xc495('0x53'),_0xc495('0x54'),_0xc495('0x55'),_0xc495('0x56'),'createdbyname',_0xc495('0x57'),_0xc495('0x58'),_0xc495('0x59'),_0xc495('0x5a'),_0xc495('0x5b'),_0xc495('0x5c'),_0xc495('0x5d'),_0xc495('0x5e'),'entitlementidname','entityimage_timestamp',_0xc495('0x5f'),'escalatedon','exchangerate',_0xc495('0x60'),_0xc495('0x61'),_0xc495('0x62'),_0xc495('0x63'),_0xc495('0x64'),_0xc495('0x65'),_0xc495('0x66'),_0xc495('0x67'),'modifiedbyexternalpartyyominame',_0xc495('0x68'),'modifiedbyyominame','modifiedon',_0xc495('0x69'),_0xc495('0x6a'),'msdyn_incidenttypename',_0xc495('0x6b'),_0xc495('0x6c'),_0xc495('0x6d'),_0xc495('0x6e'),_0xc495('0x6f'),_0xc495('0x70'),_0xc495('0x71'),'parentcaseidname','primarycontactidname',_0xc495('0x72'),_0xc495('0x73'),'productidname',_0xc495('0x74'),_0xc495('0x75'),_0xc495('0x76'),'responseby',_0xc495('0x77'),_0xc495('0x78'),_0xc495('0x79'),'slainvokedidname',_0xc495('0x7a'),_0xc495('0x7b'),_0xc495('0x7c'),'statuscode',_0xc495('0x7d'),_0xc495('0x7e'),_0xc495('0x7f'),_0xc495('0x80'),_0xc495('0x81'),'utcconversiontimezonecode','versionnumber'];var _0x44184d=_0x3742d0['concat'](_0x47df43);return db['Dynamics365Account']['findOne']({'where':{'id':_0x23a8c4[_0xc495('0x2c')]['id']},'attributes':['id','username',_0xc495('0x82'),_0xc495('0x83'),_0xc495('0x84'),_0xc495('0x85'),'clientSecret',_0xc495('0x86')],'include':[{'model':db[_0xc495('0x87')],'as':_0xc495('0x87'),'attributes':['id',_0xc495('0x88'),'data7']}]})[_0xc495('0x26')](handleEntityNotFound(_0x1700c8,null))['then'](function(_0x3c22da){if(_0x3c22da){if(_0x3c22da['modernAuthentication']){_0x3c22da[_0xc495('0x89')]=_0x3c22da[_0xc495('0x87')][_0xc495('0x88')];_0x43a413=sanitizeRemoteUri(_0x3c22da[_0xc495('0x87')][_0xc495('0x8a')]);_0x3edffa=getWebApiUrl(_0x43a413);return _0x3c22da;}_0x43a413=sanitizeRemoteUri(_0x3c22da['remoteUri']);_0x3edffa=getWebApiUrl(_0x43a413);var _0xbaad47={'method':_0xc495('0x8b'),'uri':_0xc495('0x8c')+_0x3c22da[_0xc495('0x84')]+_0xc495('0x8d'),'form':{'client_id':_0x3c22da[_0xc495('0x85')],'resource':_0x43a413,'username':_0x3c22da[_0xc495('0x8e')],'password':_0x3c22da[_0xc495('0x82')],'grant_type':_0xc495('0x82'),'client_secret':_0x3c22da['clientSecret']},'json':!![]};return rp(_0xbaad47);}})[_0xc495('0x26')](function(_0xec97e0){_0x423166=_0xec97e0[_0xc495('0x89')];var _0x574665={'method':_0xc495('0x8f'),'uri':encodeURI(_0x3edffa+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x36cd69+'\x27'),'headers':{'Authorization':_0xc495('0x90')+_0x423166,'If-None-Match':null,'OData-Version':_0xc495('0x91')},'json':!![]};return rp(_0x574665);})['then'](function(_0x25b2f2){var _0x1eab0b=_0x25b2f2[_0xc495('0x92')][0x0];var _0x560d1a=_0x1eab0b[_0xc495('0x93')];var _0x796d72={'method':'GET','uri':_0x3edffa+_0xc495('0x94')+_0x560d1a+_0xc495('0x95'),'headers':{'Authorization':_0xc495('0x90')+_0x423166,'If-None-Match':null,'OData-Version':_0xc495('0x91')},'json':!![]};return rp(_0x796d72);})[_0xc495('0x26')](function(_0x2926d8){_0x62dc65=_0x2926d8;_0x494f3b=_0x62dc65[_0xc495('0x96')];_0x494f3b=_['remove'](_0x494f3b,function(_0x28ba65){return!_0x44184d[_0xc495('0x97')](_0x28ba65[_0xc495('0x98')]);});var _0x3bb732=[];var _0x18825b=[];_0x494f3b[_0xc495('0x99')](function(_0x1f7d5f){if(_0x1f7d5f[_0xc495('0x9a')]){var _0x2429fa=_0x1f7d5f[_0xc495('0x9a')][_0xc495('0x40')](_0x1f7d5f[_0xc495('0x9a')][_0xc495('0x41')]('.')+0x1);if(_0x2429fa===_0xc495('0x9b')){_0x3bb732[_0xc495('0x9c')](getSelectList(_0x3edffa,_0x4aedbf,_0x18825b,_0x62dc65[_0xc495('0x93')],_0x1f7d5f['MetadataId'],_0x423166));}}});return Promise[_0xc495('0x9d')](_0x3bb732);})[_0xc495('0x26')](function(_0x42de0d){_0x5b3aca=_0x42de0d[0x0];var _0x10e301=[];var _0x49c476=[];_0x494f3b['forEach'](function(_0x3904a9){if(!_[_0xc495('0x9e')](_0x3904a9[_0xc495('0x9a')])){var _0x5adf54=_0x3904a9[_0xc495('0x9a')][_0xc495('0x40')](_0x3904a9[_0xc495('0x9a')]['lastIndexOf']('.')+0x1);if(_0x5adf54===_0xc495('0x9f')){_0x10e301[_0xc495('0x9c')](getBooleanList(_0x3edffa,_0x4aedbf,_0x49c476,_0x62dc65['MetadataId'],_0x3904a9[_0xc495('0x93')],_0x423166));}}});return Promise[_0xc495('0x9d')](_0x10e301);})[_0xc495('0x26')](function(_0xcda5ac){_0xe1ba56=_0xcda5ac[0x0];var _0x5ecc2f=[];var _0x2f637a=[];_0x494f3b['forEach'](function(_0x22814b){if(_0x22814b[_0xc495('0x9a')]){var _0x3932d5=_0x22814b[_0xc495('0x9a')][_0xc495('0x40')](_0x22814b['@odata.type'][_0xc495('0x41')]('.')+0x1);if(_0x3932d5==='StringAttributeMetadata'||_0x3932d5===_0xc495('0xa0')||_0x3932d5===_0xc495('0xa1')||_0x3932d5===_0xc495('0xa2')||_0x3932d5===_0xc495('0xa3')||_0x3932d5==='DateTimeAttributeMetadata'||_0x3932d5===_0xc495('0xa4')||_0x3932d5===_0xc495('0xa5')||_0x3932d5==='StateAttributeMetadata'||_0x3932d5===_0xc495('0xa6')){_0x5ecc2f[_0xc495('0x9c')](getInputList(_0x3edffa,_0x4aedbf,_0x3932d5,_0x2f637a,_0x62dc65[_0xc495('0x93')],_0x22814b[_0xc495('0x93')],_0x423166));}}});return Promise[_0xc495('0x9d')](_0x5ecc2f);})[_0xc495('0x26')](function(_0xa16b8c){_0xd2b8d3=_0xa16b8c[0x0];var _0x449e5d=_0x5b3aca['concat'](_0xe1ba56)[_0xc495('0xa7')](_0xd2b8d3);var _0x1d699b={'count':_0x449e5d[_0xc495('0x1c')],'rows':_0x449e5d};return _0x1d699b;})[_0xc495('0x26')](respondWithResult(_0x1700c8,null))[_0xc495('0x2f')](function(_0xcd843f){var _0x5c6a76=_0x23a8c4[_0xc495('0x17')]['test']?0x1f4:_0xcd843f[_0xc495('0xa8')]||0x1f4;logger[_0xc495('0xe')](_0xcd843f[_0xc495('0xf')]);delete _0xcd843f['name'];if(_0x5c6a76===0x191){_0x5c6a76=0x190;}_0x1700c8[_0xc495('0x6')](_0x5c6a76)[_0xc495('0xa9')](_0x23a8c4[_0xc495('0x17')][_0xc495('0xaa')]?{'message':_0xc495('0xab'),'statusCode':_0xcd843f[_0xc495('0xa8')]}:_0xcd843f);});};function getSelectList(_0x5d9c61,_0x3aa608,_0x5714c8,_0x4e4ade,_0x219810,_0x1cc181){var _0x26149d={'method':_0xc495('0x8f'),'uri':_0x5d9c61+'EntityDefinitions('+_0x4e4ade+_0xc495('0xac')+_0x219810+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xc495('0xad'),'headers':{'Authorization':_0xc495('0x90')+_0x1cc181,'If-None-Match':null,'OData-Version':_0xc495('0x91')},'json':!![]};return rp(_0x26149d)[_0xc495('0x26')](function(_0x311b1f){var _0x55e627=[];var _0x21ced0=_0x311b1f[_0xc495('0xae')][_0xc495('0xaf')];_0x21ced0['forEach'](function(_0x633d76){_0x55e627['push']({'name':_0x633d76[_0xc495('0xb0')][_0xc495('0xb1')]['Label'],'value':String(_0x633d76[_0xc495('0xb2')])});});var _0x1593bf={'id':_0x3aa608+'_'+_0x311b1f[_0xc495('0x98')],'name':_0x311b1f['DisplayName']['UserLocalizedLabel'][_0xc495('0xb0')],'custom':![],'options':_0x55e627};_0x5714c8[_0xc495('0x9c')](_0x1593bf);return _0x5714c8;});}function getBooleanList(_0x451e90,_0x10187a,_0x4202d2,_0x33bff5,_0x1840bf,_0x36129e){var _0x580afb={'method':'GET','uri':_0x451e90+'EntityDefinitions('+_0x33bff5+_0xc495('0xac')+_0x1840bf+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xc495('0x90')+_0x36129e,'If-None-Match':null,'OData-Version':_0xc495('0x91')},'json':!![]};return rp(_0x580afb)[_0xc495('0x26')](function(_0x481b31){var _0x284fca=[];_0x284fca['push']({'name':_0x481b31['OptionSet']['TrueOption'][_0xc495('0xb0')]['UserLocalizedLabel'][_0xc495('0xb0')],'value':'true'},{'name':_0x481b31[_0xc495('0xae')][_0xc495('0xb3')][_0xc495('0xb0')][_0xc495('0xb1')][_0xc495('0xb0')],'value':'false'});var _0x30aa51={'id':_0x10187a+'_'+_0x481b31['LogicalName'],'name':_0x481b31[_0xc495('0xb4')][_0xc495('0xb1')][_0xc495('0xb0')],'custom':![],'options':_0x284fca};_0x4202d2[_0xc495('0x9c')](_0x30aa51);return _0x4202d2;});}function getInputList(_0x171427,_0x5285a7,_0x1d2244,_0x223d8b,_0xb5bd6f,_0xb5439d,_0x57e242){var _0x5d93bd={'method':_0xc495('0x8f'),'uri':_0x171427+_0xc495('0x94')+_0xb5bd6f+')/Attributes('+_0xb5439d+_0xc495('0xb5')+_0x1d2244+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x57e242,'If-None-Match':null,'OData-Version':_0xc495('0x91')},'json':!![]};return rp(_0x5d93bd)[_0xc495('0x26')](function(_0x378f98){var _0x5440e0={'id':_0x5285a7+'_'+_0x378f98[_0xc495('0x98')],'name':_0x378f98[_0xc495('0xb4')]['UserLocalizedLabel']?_0x378f98[_0xc495('0xb4')]['UserLocalizedLabel'][_0xc495('0xb0')]:_0x378f98[_0xc495('0x98')],'custom':![],'options':[]};_0x223d8b['push'](_0x5440e0);return _0x223d8b;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 7da5194..ef09415 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x952438,_0x58621b){var _0x155072=function(_0x344cbd){while(--_0x344cbd){_0x952438['push'](_0x952438['shift']());}};_0x155072(++_0x58621b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x28c7a6,_0x398411){var _0x197e06=function(_0x21f550){while(--_0x21f550){_0x28c7a6['push'](_0x28c7a6['shift']());}};_0x197e06(++_0x398411);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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 7c769aa..cf85ec4 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 _0xaecd=['ShowDynamics365Account','Dynamics365Account','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetDynamics365Account','findAll','options','raw','where','attributes','include','map','model'];(function(_0x25c42b,_0x1fd043){var _0x66057c=function(_0x2a4616){while(--_0x2a4616){_0x25c42b['push'](_0x25c42b['shift']());}};_0x66057c(++_0x1fd043);}(_0xaecd,0xfa));var _0xdaec=function(_0x452a65,_0x33a8a9){_0x452a65=_0x452a65-0x0;var _0x56e138=_0xaecd[_0x452a65];return _0x56e138;};'use strict';var _=require('lodash');var util=require(_0xdaec('0x0'));var moment=require(_0xdaec('0x1'));var BPromise=require(_0xdaec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdaec('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaec('0x4'))('rpc');var config=require(_0xdaec('0x5'));var jayson=require(_0xdaec('0x6'));var client=jayson[_0xdaec('0x7')][_0xdaec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x224e49,_0x1463f2,_0x5ef12e){return new BPromise(function(_0x589d81,_0x2f3c41){return client[_0xdaec('0x9')](_0x224e49,_0x5ef12e)[_0xdaec('0xa')](function(_0x5c76e6){logger['info'](_0xdaec('0xb'),_0x1463f2,_0xdaec('0xc'));logger[_0xdaec('0xd')](_0xdaec('0xe'),_0x1463f2,_0xdaec('0xc'),JSON[_0xdaec('0xf')](_0x5c76e6));if(_0x5c76e6[_0xdaec('0x10')]){if(_0x5c76e6[_0xdaec('0x10')]['code']===0x1f4){logger[_0xdaec('0x10')](_0xdaec('0xb'),_0x1463f2,_0x5c76e6[_0xdaec('0x10')][_0xdaec('0x11')]);return _0x2f3c41(_0x5c76e6[_0xdaec('0x10')][_0xdaec('0x11')]);}logger[_0xdaec('0x10')](_0xdaec('0xb'),_0x1463f2,_0x5c76e6[_0xdaec('0x10')][_0xdaec('0x11')]);return _0x589d81(_0x5c76e6['error']['message']);}else{logger[_0xdaec('0x12')](_0xdaec('0xb'),_0x1463f2,_0xdaec('0xc'));_0x589d81(_0x5c76e6['result'][_0xdaec('0x11')]);}})[_0xdaec('0x13')](function(_0x19ba0a){logger[_0xdaec('0x10')](_0xdaec('0xb'),_0x1463f2,_0x19ba0a);_0x2f3c41(_0x19ba0a);});});}exports[_0xdaec('0x14')]=function(_0x5f01e6){var _0xa233bb=this;return new Promise(function(_0x5e6920,_0xf38df5){return db['Dynamics365Account'][_0xdaec('0x15')]({'raw':_0x5f01e6[_0xdaec('0x16')]?_0x5f01e6[_0xdaec('0x16')][_0xdaec('0x17')]===undefined?!![]:![]:!![],'where':_0x5f01e6[_0xdaec('0x16')]?_0x5f01e6[_0xdaec('0x16')][_0xdaec('0x18')]||null:null,'attributes':_0x5f01e6[_0xdaec('0x16')]?_0x5f01e6[_0xdaec('0x16')][_0xdaec('0x19')]||null:null,'limit':_0x5f01e6[_0xdaec('0x16')]?_0x5f01e6[_0xdaec('0x16')]['limit']||null:null,'include':_0x5f01e6['options']?_0x5f01e6[_0xdaec('0x16')][_0xdaec('0x1a')]?_[_0xdaec('0x1b')](_0x5f01e6[_0xdaec('0x16')][_0xdaec('0x1a')],function(_0x4637c5){return{'model':db[_0x4637c5[_0xdaec('0x1c')]],'as':_0x4637c5['as'],'attributes':_0x4637c5[_0xdaec('0x19')],'include':_0x4637c5[_0xdaec('0x1a')]?_[_0xdaec('0x1b')](_0x4637c5['include'],function(_0x15fb20){return{'model':db[_0x15fb20[_0xdaec('0x1c')]],'as':_0x15fb20['as'],'attributes':_0x15fb20['attributes'],'include':_0x15fb20[_0xdaec('0x1a')]?_[_0xdaec('0x1b')](_0x15fb20[_0xdaec('0x1a')],function(_0x1b0d3e){return{'model':db[_0x1b0d3e[_0xdaec('0x1c')]],'as':_0x1b0d3e['as'],'attributes':_0x1b0d3e['attributes']};}):[]};}):[]};}):[]:[]})[_0xdaec('0xa')](function(_0x2f2872){logger[_0xdaec('0x12')](_0xdaec('0x14'),_0x5f01e6);logger[_0xdaec('0xd')](_0xdaec('0x14'),_0x5f01e6,JSON[_0xdaec('0xf')](_0x2f2872));_0x5e6920(_0x2f2872);})[_0xdaec('0x13')](function(_0x28bb4a){logger['error']('GetDynamics365Account',_0x28bb4a[_0xdaec('0x11')],_0x5f01e6);_0xf38df5(_0xa233bb[_0xdaec('0x10')](0x1f4,_0x28bb4a['message']));});});};exports[_0xdaec('0x1d')]=function(_0x445802){var _0x3daa27=this;return new Promise(function(_0x3165f5,_0x1cefb2){return db[_0xdaec('0x1e')]['find']({'raw':_0x445802[_0xdaec('0x16')]?_0x445802[_0xdaec('0x16')][_0xdaec('0x17')]===undefined?!![]:![]:!![],'where':_0x445802[_0xdaec('0x16')]?_0x445802[_0xdaec('0x16')]['where']||null:null,'attributes':_0x445802[_0xdaec('0x16')]?_0x445802[_0xdaec('0x16')][_0xdaec('0x19')]||null:null,'include':_0x445802['options']?_0x445802[_0xdaec('0x16')][_0xdaec('0x1a')]?_[_0xdaec('0x1b')](_0x445802[_0xdaec('0x16')][_0xdaec('0x1a')],function(_0x3f41f8){return{'model':db[_0x3f41f8['model']],'as':_0x3f41f8['as'],'attributes':_0x3f41f8['attributes'],'include':_0x3f41f8[_0xdaec('0x1a')]?_['map'](_0x3f41f8['include'],function(_0x301f14){return{'model':db[_0x301f14[_0xdaec('0x1c')]],'as':_0x301f14['as'],'attributes':_0x301f14[_0xdaec('0x19')],'include':_0x301f14[_0xdaec('0x1a')]?_[_0xdaec('0x1b')](_0x301f14[_0xdaec('0x1a')],function(_0x8bd5a5){return{'model':db[_0x8bd5a5[_0xdaec('0x1c')]],'as':_0x8bd5a5['as'],'attributes':_0x8bd5a5[_0xdaec('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdaec('0xa')](function(_0x3bcb1c){logger[_0xdaec('0x12')](_0xdaec('0x1d'),_0x445802);logger[_0xdaec('0xd')](_0xdaec('0x1d'),_0x445802,JSON[_0xdaec('0xf')](_0x3bcb1c));_0x3165f5(_0x3bcb1c);})[_0xdaec('0x13')](function(_0x23db49){logger[_0xdaec('0x10')]('ShowDynamics365Account',_0x23db49[_0xdaec('0x11')],_0x445802);_0x1cefb2(_0x3daa27[_0xdaec('0x10')](0x1f4,_0x23db49[_0xdaec('0x11')]));});});}; \ No newline at end of file +var _0x3bd7=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','GetDynamics365Account','options','raw','where','attributes','limit','include','map','model','catch','ShowDynamics365Account','Dynamics365Account','lodash'];(function(_0x3d7365,_0x5b62c9){var _0x163b51=function(_0x45020a){while(--_0x45020a){_0x3d7365['push'](_0x3d7365['shift']());}};_0x163b51(++_0x5b62c9);}(_0x3bd7,0x167));var _0x73bd=function(_0x4d05a0,_0x53aa7e){_0x4d05a0=_0x4d05a0-0x0;var _0x4c999c=_0x3bd7[_0x4d05a0];return _0x4c999c;};'use strict';var _=require(_0x73bd('0x0'));var util=require(_0x73bd('0x1'));var moment=require(_0x73bd('0x2'));var BPromise=require('bluebird');var rs=require(_0x73bd('0x3'));var fs=require('fs');var Redis=require(_0x73bd('0x4'));var db=require(_0x73bd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x73bd('0x6'))(_0x73bd('0x7'));var config=require(_0x73bd('0x8'));var jayson=require(_0x73bd('0x9'));var client=jayson[_0x73bd('0xa')][_0x73bd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5051a9,_0x25d5f0,_0xca398e){return new BPromise(function(_0x52f078,_0x2dca6b){return client[_0x73bd('0xc')](_0x5051a9,_0xca398e)[_0x73bd('0xd')](function(_0x1304f0){logger[_0x73bd('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x25d5f0,_0x73bd('0xf'));logger[_0x73bd('0x10')](_0x73bd('0x11'),_0x25d5f0,_0x73bd('0xf'),JSON[_0x73bd('0x12')](_0x1304f0));if(_0x1304f0[_0x73bd('0x13')]){if(_0x1304f0['error'][_0x73bd('0x14')]===0x1f4){logger['error'](_0x73bd('0x15'),_0x25d5f0,_0x1304f0[_0x73bd('0x13')][_0x73bd('0x16')]);return _0x2dca6b(_0x1304f0[_0x73bd('0x13')][_0x73bd('0x16')]);}logger['error'](_0x73bd('0x15'),_0x25d5f0,_0x1304f0[_0x73bd('0x13')][_0x73bd('0x16')]);return _0x52f078(_0x1304f0['error']['message']);}else{logger[_0x73bd('0xe')](_0x73bd('0x15'),_0x25d5f0,_0x73bd('0xf'));_0x52f078(_0x1304f0[_0x73bd('0x17')][_0x73bd('0x16')]);}})['catch'](function(_0x2515c1){logger[_0x73bd('0x13')](_0x73bd('0x15'),_0x25d5f0,_0x2515c1);_0x2dca6b(_0x2515c1);});});}exports[_0x73bd('0x18')]=function(_0x190c5b){var _0x23970a=this;return new Promise(function(_0x1f0cd3,_0x13ee3c){return db['Dynamics365Account']['findAll']({'raw':_0x190c5b[_0x73bd('0x19')]?_0x190c5b[_0x73bd('0x19')][_0x73bd('0x1a')]===undefined?!![]:![]:!![],'where':_0x190c5b[_0x73bd('0x19')]?_0x190c5b[_0x73bd('0x19')][_0x73bd('0x1b')]||null:null,'attributes':_0x190c5b[_0x73bd('0x19')]?_0x190c5b[_0x73bd('0x19')][_0x73bd('0x1c')]||null:null,'limit':_0x190c5b[_0x73bd('0x19')]?_0x190c5b['options'][_0x73bd('0x1d')]||null:null,'include':_0x190c5b['options']?_0x190c5b[_0x73bd('0x19')][_0x73bd('0x1e')]?_[_0x73bd('0x1f')](_0x190c5b['options'][_0x73bd('0x1e')],function(_0x2dfb10){return{'model':db[_0x2dfb10[_0x73bd('0x20')]],'as':_0x2dfb10['as'],'attributes':_0x2dfb10[_0x73bd('0x1c')],'include':_0x2dfb10[_0x73bd('0x1e')]?_[_0x73bd('0x1f')](_0x2dfb10['include'],function(_0x7a73db){return{'model':db[_0x7a73db[_0x73bd('0x20')]],'as':_0x7a73db['as'],'attributes':_0x7a73db[_0x73bd('0x1c')],'include':_0x7a73db[_0x73bd('0x1e')]?_[_0x73bd('0x1f')](_0x7a73db[_0x73bd('0x1e')],function(_0x59c2cd){return{'model':db[_0x59c2cd[_0x73bd('0x20')]],'as':_0x59c2cd['as'],'attributes':_0x59c2cd['attributes']};}):[]};}):[]};}):[]:[]})[_0x73bd('0xd')](function(_0x11aab0){logger[_0x73bd('0xe')](_0x73bd('0x18'),_0x190c5b);logger[_0x73bd('0x10')](_0x73bd('0x18'),_0x190c5b,JSON['stringify'](_0x11aab0));_0x1f0cd3(_0x11aab0);})[_0x73bd('0x21')](function(_0x538e3f){logger['error']('GetDynamics365Account',_0x538e3f[_0x73bd('0x16')],_0x190c5b);_0x13ee3c(_0x23970a[_0x73bd('0x13')](0x1f4,_0x538e3f[_0x73bd('0x16')]));});});};exports[_0x73bd('0x22')]=function(_0x34a099){var _0x1ffc19=this;return new Promise(function(_0x3ea7fa,_0xc3c9df){return db[_0x73bd('0x23')]['find']({'raw':_0x34a099['options']?_0x34a099[_0x73bd('0x19')][_0x73bd('0x1a')]===undefined?!![]:![]:!![],'where':_0x34a099[_0x73bd('0x19')]?_0x34a099[_0x73bd('0x19')]['where']||null:null,'attributes':_0x34a099[_0x73bd('0x19')]?_0x34a099[_0x73bd('0x19')][_0x73bd('0x1c')]||null:null,'include':_0x34a099[_0x73bd('0x19')]?_0x34a099[_0x73bd('0x19')]['include']?_[_0x73bd('0x1f')](_0x34a099[_0x73bd('0x19')][_0x73bd('0x1e')],function(_0x4e6e3d){return{'model':db[_0x4e6e3d[_0x73bd('0x20')]],'as':_0x4e6e3d['as'],'attributes':_0x4e6e3d['attributes'],'include':_0x4e6e3d[_0x73bd('0x1e')]?_[_0x73bd('0x1f')](_0x4e6e3d[_0x73bd('0x1e')],function(_0x2292f4){return{'model':db[_0x2292f4['model']],'as':_0x2292f4['as'],'attributes':_0x2292f4[_0x73bd('0x1c')],'include':_0x2292f4[_0x73bd('0x1e')]?_[_0x73bd('0x1f')](_0x2292f4[_0x73bd('0x1e')],function(_0x516c8f){return{'model':db[_0x516c8f['model']],'as':_0x516c8f['as'],'attributes':_0x516c8f[_0x73bd('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34a7a4){logger['info'](_0x73bd('0x22'),_0x34a099);logger[_0x73bd('0x10')]('ShowDynamics365Account',_0x34a099,JSON[_0x73bd('0x12')](_0x34a7a4));_0x3ea7fa(_0x34a7a4);})[_0x73bd('0x21')](function(_0x374ac2){logger[_0x73bd('0x13')](_0x73bd('0x22'),_0x374ac2[_0x73bd('0x16')],_0x34a099);_0xc3c9df(_0x1ffc19[_0x73bd('0x13')](0x1f4,_0x374ac2['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 6567d19..90b9733 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 _0xdbfd=['../../config/environment','isAuthenticated','index','/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put','update','delete','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x283ed2,_0x5336e2){var _0x328aa3=function(_0x314edb){while(--_0x314edb){_0x283ed2['push'](_0x283ed2['shift']());}};_0x328aa3(++_0x5336e2);}(_0xdbfd,0x18b));var _0xddbf=function(_0x35e3de,_0x2c9644){_0x35e3de=_0x35e3de-0x0;var _0x412a6b=_0xdbfd[_0x35e3de];return _0x412a6b;};'use strict';var multer=require(_0xddbf('0x0'));var util=require(_0xddbf('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xddbf('0x2')]();var fs_extra=require(_0xddbf('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xddbf('0x4'));var config=require(_0xddbf('0x5'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0xddbf('0x6')](),controller[_0xddbf('0x7')]);router['get'](_0xddbf('0x8'),auth[_0xddbf('0x6')](),controller[_0xddbf('0x9')]);router[_0xddbf('0xa')](_0xddbf('0xb'),auth['isAuthenticated'](),controller[_0xddbf('0xc')]);router['get'](_0xddbf('0xd'),auth['isAuthenticated'](),controller[_0xddbf('0xe')]);router['get'](_0xddbf('0xf'),auth[_0xddbf('0x6')](),controller['getDescriptions']);router['post']('/',auth[_0xddbf('0x6')](),controller[_0xddbf('0x10')]);router[_0xddbf('0x11')](_0xddbf('0x8'),auth[_0xddbf('0x6')](),controller[_0xddbf('0x12')]);router[_0xddbf('0x13')](_0xddbf('0x8'),auth[_0xddbf('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x73a1=['get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','put','update','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1253bd,_0x544768){var _0x365b70=function(_0x3fef19){while(--_0x3fef19){_0x1253bd['push'](_0x1253bd['shift']());}};_0x365b70(++_0x544768);}(_0x73a1,0x161));var _0x173a=function(_0x2ba740,_0x62a305){_0x2ba740=_0x2ba740-0x0;var _0x358bda=_0x73a1[_0x2ba740];return _0x358bda;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x173a('0x0'));var timeout=require(_0x173a('0x1'));var express=require('express');var router=express[_0x173a('0x2')]();var fs_extra=require(_0x173a('0x3'));var auth=require(_0x173a('0x4'));var interaction=require(_0x173a('0x5'));var config=require(_0x173a('0x6'));var controller=require('./intDynamics365Configuration.controller');router[_0x173a('0x7')]('/',auth[_0x173a('0x8')](),controller[_0x173a('0x9')]);router[_0x173a('0x7')](_0x173a('0xa'),auth[_0x173a('0x8')](),controller[_0x173a('0xb')]);router[_0x173a('0x7')](_0x173a('0xc'),auth[_0x173a('0x8')](),controller[_0x173a('0xd')]);router[_0x173a('0x7')]('/:id/subjects',auth[_0x173a('0x8')](),controller['getSubjects']);router[_0x173a('0x7')](_0x173a('0xe'),auth[_0x173a('0x8')](),controller[_0x173a('0xf')]);router['post']('/',auth[_0x173a('0x8')](),controller['create']);router[_0x173a('0x10')]('/:id',auth[_0x173a('0x8')](),controller[_0x173a('0x11')]);router['delete'](_0x173a('0xa'),auth[_0x173a('0x8')](),controller[_0x173a('0x12')]);module[_0x173a('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 41c5a1f..efd5bfa 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 _0xb9dc=['STRING','ENUM','phonecall','incident','contact','nothing','exports'];(function(_0x1e8eb4,_0x53a726){var _0x3e3e6e=function(_0x29dbf3){while(--_0x29dbf3){_0x1e8eb4['push'](_0x1e8eb4['shift']());}};_0x3e3e6e(++_0x53a726);}(_0xb9dc,0x12c));var _0xcb9d=function(_0x49bafe,_0x90d918){_0x49bafe=_0x49bafe-0x0;var _0x1d3d31=_0xb9dc[_0x49bafe];return _0x1d3d31;};'use strict';var Sequelize=require('sequelize');module[_0xcb9d('0x0')]={'name':{'type':Sequelize[_0xcb9d('0x1')]},'description':{'type':Sequelize[_0xcb9d('0x1')]},'ticketType':{'type':Sequelize[_0xcb9d('0x2')]('incident',_0xcb9d('0x3')),'defaultValue':_0xcb9d('0x4')},'moduleCreate':{'type':Sequelize[_0xcb9d('0x2')](_0xcb9d('0x5'),_0xcb9d('0x6')),'defaultValue':_0xcb9d('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xae06=['sequelize','STRING','ENUM','incident','nothing','BOOLEAN'];(function(_0x2ee69d,_0x308214){var _0x3abd2a=function(_0x37f5d4){while(--_0x37f5d4){_0x2ee69d['push'](_0x2ee69d['shift']());}};_0x3abd2a(++_0x308214);}(_0xae06,0xd2));var _0x6ae0=function(_0x5f4d99,_0x1a92df){_0x5f4d99=_0x5f4d99-0x0;var _0x4c63b7=_0xae06[_0x5f4d99];return _0x4c63b7;};'use strict';var Sequelize=require(_0x6ae0('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6ae0('0x1')]},'ticketType':{'type':Sequelize[_0x6ae0('0x2')](_0x6ae0('0x3'),'phonecall'),'defaultValue':_0x6ae0('0x3')},'moduleCreate':{'type':Sequelize[_0x6ae0('0x2')]('contact',_0x6ae0('0x4')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x6ae0('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x6ae0('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 61414c0..d5b9485 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 _0x2dc7=['set','reject','save','update','then','destroy','end','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../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'];(function(_0x4e6e13,_0x5b3b89){var _0x38c66e=function(_0x260047){while(--_0x260047){_0x4e6e13['push'](_0x4e6e13['shift']());}};_0x38c66e(++_0x5b3b89);}(_0x2dc7,0xcf));var _0x72dc=function(_0x34c027,_0x123688){_0x34c027=_0x34c027-0x0;var _0x47bff0=_0x2dc7[_0x34c027];return _0x47bff0;};'use strict';var emlformat=require(_0x72dc('0x0'));var rimraf=require(_0x72dc('0x1'));var zipdir=require(_0x72dc('0x2'));var jsonpatch=require(_0x72dc('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x72dc('0x4'));var Mustache=require('mustache');var util=require(_0x72dc('0x5'));var path=require(_0x72dc('0x6'));var sox=require(_0x72dc('0x7'));var csv=require(_0x72dc('0x8'));var ejs=require(_0x72dc('0x9'));var fs=require('fs');var fs_extra=require(_0x72dc('0xa'));var _=require(_0x72dc('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x72dc('0xc'));var deskjs=require(_0x72dc('0xd'));var toCsv=require(_0x72dc('0x8'));var querystring=require('querystring');var Papa=require(_0x72dc('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x72dc('0xf'));var as=require(_0x72dc('0x10'));var hardwareService=require(_0x72dc('0x11'));var logger=require(_0x72dc('0x12'))(_0x72dc('0x13'));var utils=require(_0x72dc('0x14'));var config=require(_0x72dc('0x15'));var licenseUtil=require(_0x72dc('0x16'));var db=require(_0x72dc('0x17'))['db'];function respondWithStatusCode(_0x1dc02d,_0x1d6114){_0x1d6114=_0x1d6114||0xcc;return function(_0x23516a){if(_0x23516a){return _0x1dc02d[_0x72dc('0x18')](_0x1d6114);}return _0x1dc02d['status'](_0x1d6114)['end']();};}function respondWithResult(_0x184aa3,_0x3b45cc){_0x3b45cc=_0x3b45cc||0xc8;return function(_0x59ce8f){if(_0x59ce8f){return _0x184aa3[_0x72dc('0x19')](_0x3b45cc)[_0x72dc('0x1a')](_0x59ce8f);}};}function respondWithFilteredResult(_0xa8d9e3,_0x4c00e3){return function(_0x37a3f8){if(_0x37a3f8){var _0x1e0375=typeof _0x4c00e3[_0x72dc('0x1b')]===_0x72dc('0x1c')&&typeof _0x4c00e3['limit']===_0x72dc('0x1c');var _0x42b4e2=_0x37a3f8[_0x72dc('0x1d')];var _0x5abe5b=_0x1e0375?0x0:_0x4c00e3[_0x72dc('0x1b')];var _0x450cac=_0x1e0375?_0x37a3f8[_0x72dc('0x1d')]:_0x4c00e3[_0x72dc('0x1b')]+_0x4c00e3['limit'];var _0x3e2dd4;if(_0x450cac>=_0x42b4e2){_0x450cac=_0x42b4e2;_0x3e2dd4=0xc8;}else{_0x3e2dd4=0xce;}_0xa8d9e3['status'](_0x3e2dd4);return _0xa8d9e3[_0x72dc('0x1e')]('Content-Range',_0x5abe5b+'-'+_0x450cac+'/'+_0x42b4e2)['json'](_0x37a3f8);}return null;};}function patchUpdates(_0x29d333){return function(_0x5b8515){try{jsonpatch['apply'](_0x5b8515,_0x29d333,!![]);}catch(_0x137a7a){return BPromise[_0x72dc('0x1f')](_0x137a7a);}return _0x5b8515[_0x72dc('0x20')]();};}function saveUpdates(_0x106dd4,_0x1ad794){return function(_0x5d2f62){if(_0x5d2f62){return _0x5d2f62[_0x72dc('0x21')](_0x106dd4)[_0x72dc('0x22')](function(_0x199918){return _0x199918;});}return null;};}function removeEntity(_0x20e36d,_0x3d208f){return function(_0x2b1a7a){if(_0x2b1a7a){return _0x2b1a7a[_0x72dc('0x23')]()['then'](function(){_0x20e36d[_0x72dc('0x19')](0xcc)[_0x72dc('0x24')]();});}};}function handleEntityNotFound(_0x22df41,_0x9d133){return function(_0x5a6523){if(!_0x5a6523){_0x22df41[_0x72dc('0x18')](0x194);}return _0x5a6523;};}function handleError(_0x4078b1,_0x5ce5db){_0x5ce5db=_0x5ce5db||0x1f4;return function(_0x2d6bee){logger[_0x72dc('0x25')](_0x2d6bee[_0x72dc('0x26')]);if(_0x2d6bee['name']){delete _0x2d6bee[_0x72dc('0x27')];}_0x4078b1['status'](_0x5ce5db)[_0x72dc('0x28')](_0x2d6bee);};}exports[_0x72dc('0x29')]=function(_0x3ebb27,_0x4b8809){var _0xc718e8={},_0xcb64d3={},_0xe1662a={'count':0x0,'rows':[]};var _0x3419b6=_[_0x72dc('0x2a')](db[_0x72dc('0x2b')][_0x72dc('0x2c')],function(_0x48c5b5){return{'name':_0x48c5b5['fieldName'],'type':_0x48c5b5['type'][_0x72dc('0x2d')]};});_0xcb64d3['model']=_[_0x72dc('0x2a')](_0x3419b6,_0x72dc('0x27'));_0xcb64d3[_0x72dc('0x2e')]=_[_0x72dc('0x2f')](_0x3ebb27[_0x72dc('0x2e')]);_0xcb64d3['filters']=_[_0x72dc('0x30')](_0xcb64d3[_0x72dc('0x31')],_0xcb64d3[_0x72dc('0x2e')]);_0xc718e8['attributes']=_[_0x72dc('0x30')](_0xcb64d3[_0x72dc('0x31')],qs[_0x72dc('0x32')](_0x3ebb27['query'][_0x72dc('0x32')]));_0xc718e8[_0x72dc('0x33')]=_0xc718e8[_0x72dc('0x33')][_0x72dc('0x34')]?_0xc718e8[_0x72dc('0x33')]:_0xcb64d3['model'];if(!_0x3ebb27[_0x72dc('0x2e')][_0x72dc('0x35')](_0x72dc('0x36'))){_0xc718e8['limit']=qs[_0x72dc('0x37')](_0x3ebb27[_0x72dc('0x2e')][_0x72dc('0x37')]);_0xc718e8['offset']=qs[_0x72dc('0x1b')](_0x3ebb27[_0x72dc('0x2e')][_0x72dc('0x1b')]);}_0xc718e8[_0x72dc('0x38')]=qs[_0x72dc('0x39')](_0x3ebb27['query'][_0x72dc('0x39')]);_0xc718e8[_0x72dc('0x3a')]=qs[_0x72dc('0x3b')](_['pick'](_0x3ebb27[_0x72dc('0x2e')],_0xcb64d3[_0x72dc('0x3b')]),_0x3419b6);if(_0x3ebb27['query'][_0x72dc('0x3c')]){_0xc718e8['where']=_[_0x72dc('0x3d')](_0xc718e8['where'],{'$or':_[_0x72dc('0x2a')](_0x3419b6,function(_0x56a27c){if(_0x56a27c[_0x72dc('0x3e')]!==_0x72dc('0x3f')){var _0x39f8b1={};_0x39f8b1[_0x56a27c[_0x72dc('0x27')]]={'$like':'%'+_0x3ebb27[_0x72dc('0x2e')][_0x72dc('0x3c')]+'%'};return _0x39f8b1;}})});}_0xc718e8=_[_0x72dc('0x3d')]({},_0xc718e8,_0x3ebb27[_0x72dc('0x40')]);var _0x59dd14={'where':_0xc718e8['where']};return db['Dynamics365Configuration']['count'](_0x59dd14)['then'](function(_0x75d749){_0xe1662a['count']=_0x75d749;if(_0x3ebb27[_0x72dc('0x2e')][_0x72dc('0x41')]){_0xc718e8[_0x72dc('0x42')]=[{'all':!![]}];}return db[_0x72dc('0x2b')]['findAll'](_0xc718e8);})[_0x72dc('0x22')](function(_0x4def84){_0xe1662a[_0x72dc('0x43')]=_0x4def84;return _0xe1662a;})[_0x72dc('0x22')](respondWithFilteredResult(_0x4b8809,_0xc718e8))[_0x72dc('0x44')](handleError(_0x4b8809,null));};exports['show']=function(_0x24154f,_0x10f897){var _0x1fa10d={'raw':![],'where':{'id':_0x24154f[_0x72dc('0x45')]['id']}},_0x4f5b5e={};_0x4f5b5e[_0x72dc('0x31')]=_[_0x72dc('0x2f')](db[_0x72dc('0x2b')]['rawAttributes']);_0x4f5b5e[_0x72dc('0x2e')]=_[_0x72dc('0x2f')](_0x24154f['query']);_0x4f5b5e[_0x72dc('0x3b')]=_[_0x72dc('0x30')](_0x4f5b5e['model'],_0x4f5b5e['query']);_0x1fa10d[_0x72dc('0x33')]=_[_0x72dc('0x30')](_0x4f5b5e[_0x72dc('0x31')],qs[_0x72dc('0x32')](_0x24154f[_0x72dc('0x2e')][_0x72dc('0x32')]));_0x1fa10d[_0x72dc('0x33')]=_0x1fa10d['attributes'][_0x72dc('0x34')]?_0x1fa10d['attributes']:_0x4f5b5e[_0x72dc('0x31')];if(_0x24154f[_0x72dc('0x2e')][_0x72dc('0x41')]){_0x1fa10d['include']=[{'all':!![]}];}_0x1fa10d=_[_0x72dc('0x3d')]({},_0x1fa10d,_0x24154f[_0x72dc('0x40')]);return db[_0x72dc('0x2b')][_0x72dc('0x46')](_0x1fa10d)['then'](handleEntityNotFound(_0x10f897,null))['then'](respondWithResult(_0x10f897,null))[_0x72dc('0x44')](handleError(_0x10f897,null));};exports[_0x72dc('0x47')]=function(_0xdcc3a8,_0xe38ec5){return db[_0x72dc('0x2b')][_0x72dc('0x47')](_0xdcc3a8[_0x72dc('0x48')],{})[_0x72dc('0x22')](respondWithResult(_0xe38ec5,0xc9))[_0x72dc('0x44')](handleError(_0xe38ec5,null));};exports[_0x72dc('0x21')]=function(_0x62ecf6,_0x254ede){if(_0x62ecf6['body']['id']){delete _0x62ecf6[_0x72dc('0x48')]['id'];}return db['Dynamics365Configuration'][_0x72dc('0x46')]({'where':{'id':_0x62ecf6[_0x72dc('0x45')]['id']}})[_0x72dc('0x22')](handleEntityNotFound(_0x254ede,null))[_0x72dc('0x22')](saveUpdates(_0x62ecf6[_0x72dc('0x48')],null))[_0x72dc('0x22')](respondWithResult(_0x254ede,null))['catch'](handleError(_0x254ede,null));};exports[_0x72dc('0x23')]=function(_0x11073c,_0x4f9a14){return db[_0x72dc('0x2b')][_0x72dc('0x46')]({'where':{'id':_0x11073c[_0x72dc('0x45')]['id']}})[_0x72dc('0x22')](handleEntityNotFound(_0x4f9a14,null))[_0x72dc('0x22')](removeEntity(_0x4f9a14,null))[_0x72dc('0x44')](handleError(_0x4f9a14,null));};exports[_0x72dc('0x49')]=function(_0x32699b,_0x515ec4,_0x2b6c5a){var _0x49b268={};var _0x52e1a5={};var _0x4ab45a;var _0x42df75;return db[_0x72dc('0x2b')][_0x72dc('0x4a')]({'where':{'id':_0x32699b[_0x72dc('0x45')]['id']}})[_0x72dc('0x22')](handleEntityNotFound(_0x515ec4,null))[_0x72dc('0x22')](function(_0x348273){if(_0x348273){_0x4ab45a=_0x348273;_0x52e1a5[_0x72dc('0x31')]=_[_0x72dc('0x2f')](db[_0x72dc('0x4b')][_0x72dc('0x2c')]);_0x52e1a5['query']=_['keys'](_0x32699b[_0x72dc('0x2e')]);_0x52e1a5['filters']=_[_0x72dc('0x30')](_0x52e1a5['model'],_0x52e1a5[_0x72dc('0x2e')]);_0x49b268[_0x72dc('0x33')]=_['intersection'](_0x52e1a5['model'],qs[_0x72dc('0x32')](_0x32699b[_0x72dc('0x2e')][_0x72dc('0x32')]));_0x49b268[_0x72dc('0x33')]=_0x49b268[_0x72dc('0x33')]['length']?_0x49b268[_0x72dc('0x33')]:_0x52e1a5[_0x72dc('0x31')];_0x49b268[_0x72dc('0x38')]=qs[_0x72dc('0x39')](_0x32699b[_0x72dc('0x2e')]['sort']);_0x49b268['where']=qs[_0x72dc('0x3b')](_['pick'](_0x32699b[_0x72dc('0x2e')],_0x52e1a5[_0x72dc('0x3b')]));if(_0x32699b[_0x72dc('0x2e')]['filter']){_0x49b268['where']=_[_0x72dc('0x3d')](_0x49b268['where'],{'$or':_[_0x72dc('0x2a')](_0x49b268[_0x72dc('0x33')],function(_0x1eccc9){var _0x1ad635={};_0x1ad635[_0x1eccc9]={'$like':'%'+_0x32699b[_0x72dc('0x2e')][_0x72dc('0x3c')]+'%'};return _0x1ad635;})});}_0x49b268=_[_0x72dc('0x3d')]({},_0x49b268,_0x32699b[_0x72dc('0x40')]);return _0x4ab45a['getFields'](_0x49b268);}})['then'](function(_0x100ab6){if(_0x100ab6){_0x42df75=_0x100ab6[_0x72dc('0x34')];if(!_0x32699b[_0x72dc('0x2e')][_0x72dc('0x35')](_0x72dc('0x36'))){_0x49b268[_0x72dc('0x37')]=qs[_0x72dc('0x37')](_0x32699b[_0x72dc('0x2e')]['limit']);_0x49b268['offset']=qs[_0x72dc('0x1b')](_0x32699b[_0x72dc('0x2e')][_0x72dc('0x1b')]);}return _0x4ab45a[_0x72dc('0x49')](_0x49b268);}})[_0x72dc('0x22')](function(_0x25278a){if(_0x25278a){return _0x25278a?{'count':_0x42df75,'rows':_0x25278a}:null;}})['then'](respondWithResult(_0x515ec4,null))[_0x72dc('0x44')](handleError(_0x515ec4,null));};exports[_0x72dc('0x4c')]=function(_0x38a0c8,_0x4b560a,_0x221b1c){var _0x2b648d={};var _0x597118={};var _0x4a3a1b;var _0x508c38;return db[_0x72dc('0x2b')][_0x72dc('0x4a')]({'where':{'id':_0x38a0c8[_0x72dc('0x45')]['id']}})[_0x72dc('0x22')](handleEntityNotFound(_0x4b560a,null))[_0x72dc('0x22')](function(_0x44a012){if(_0x44a012){_0x4a3a1b=_0x44a012;_0x597118[_0x72dc('0x31')]=_['keys'](db[_0x72dc('0x4b')]['rawAttributes']);_0x597118[_0x72dc('0x2e')]=_[_0x72dc('0x2f')](_0x38a0c8[_0x72dc('0x2e')]);_0x597118[_0x72dc('0x3b')]=_[_0x72dc('0x30')](_0x597118['model'],_0x597118[_0x72dc('0x2e')]);_0x2b648d['attributes']=_[_0x72dc('0x30')](_0x597118[_0x72dc('0x31')],qs[_0x72dc('0x32')](_0x38a0c8[_0x72dc('0x2e')][_0x72dc('0x32')]));_0x2b648d['attributes']=_0x2b648d[_0x72dc('0x33')][_0x72dc('0x34')]?_0x2b648d['attributes']:_0x597118[_0x72dc('0x31')];_0x2b648d['order']=qs[_0x72dc('0x39')](_0x38a0c8['query'][_0x72dc('0x39')]);_0x2b648d['where']=qs[_0x72dc('0x3b')](_[_0x72dc('0x4d')](_0x38a0c8[_0x72dc('0x2e')],_0x597118[_0x72dc('0x3b')]));if(_0x38a0c8[_0x72dc('0x2e')][_0x72dc('0x3c')]){_0x2b648d['where']=_[_0x72dc('0x3d')](_0x2b648d[_0x72dc('0x3a')],{'$or':_[_0x72dc('0x2a')](_0x2b648d[_0x72dc('0x33')],function(_0x2a83c4){var _0x787714={};_0x787714[_0x2a83c4]={'$like':'%'+_0x38a0c8[_0x72dc('0x2e')][_0x72dc('0x3c')]+'%'};return _0x787714;})});}_0x2b648d=_[_0x72dc('0x3d')]({},_0x2b648d,_0x38a0c8[_0x72dc('0x40')]);return _0x4a3a1b[_0x72dc('0x4c')](_0x2b648d);}})[_0x72dc('0x22')](function(_0x394f55){if(_0x394f55){_0x508c38=_0x394f55[_0x72dc('0x34')];if(!_0x38a0c8[_0x72dc('0x2e')][_0x72dc('0x35')](_0x72dc('0x36'))){_0x2b648d[_0x72dc('0x37')]=qs[_0x72dc('0x37')](_0x38a0c8['query'][_0x72dc('0x37')]);_0x2b648d[_0x72dc('0x1b')]=qs[_0x72dc('0x1b')](_0x38a0c8[_0x72dc('0x2e')][_0x72dc('0x1b')]);}return _0x4a3a1b[_0x72dc('0x4c')](_0x2b648d);}})[_0x72dc('0x22')](function(_0x277418){if(_0x277418){return _0x277418?{'count':_0x508c38,'rows':_0x277418}:null;}})['then'](respondWithResult(_0x4b560a,null))['catch'](handleError(_0x4b560a,null));};exports['getDescriptions']=function(_0xad0c74,_0x383bb4,_0x5f20f4){var _0x354458={};var _0x468359={};var _0x265ad0;var _0x3af0d1;return db[_0x72dc('0x2b')][_0x72dc('0x4a')]({'where':{'id':_0xad0c74[_0x72dc('0x45')]['id']}})['then'](handleEntityNotFound(_0x383bb4,null))[_0x72dc('0x22')](function(_0x6c92e4){if(_0x6c92e4){_0x265ad0=_0x6c92e4;_0x468359[_0x72dc('0x31')]=_[_0x72dc('0x2f')](db[_0x72dc('0x4b')]['rawAttributes']);_0x468359[_0x72dc('0x2e')]=_['keys'](_0xad0c74['query']);_0x468359[_0x72dc('0x3b')]=_[_0x72dc('0x30')](_0x468359['model'],_0x468359[_0x72dc('0x2e')]);_0x354458[_0x72dc('0x33')]=_[_0x72dc('0x30')](_0x468359['model'],qs[_0x72dc('0x32')](_0xad0c74[_0x72dc('0x2e')][_0x72dc('0x32')]));_0x354458[_0x72dc('0x33')]=_0x354458[_0x72dc('0x33')][_0x72dc('0x34')]?_0x354458['attributes']:_0x468359['model'];_0x354458[_0x72dc('0x38')]=qs['sort'](_0xad0c74[_0x72dc('0x2e')][_0x72dc('0x39')]);_0x354458[_0x72dc('0x3a')]=qs[_0x72dc('0x3b')](_['pick'](_0xad0c74['query'],_0x468359[_0x72dc('0x3b')]));if(_0xad0c74[_0x72dc('0x2e')][_0x72dc('0x3c')]){_0x354458[_0x72dc('0x3a')]=_['merge'](_0x354458[_0x72dc('0x3a')],{'$or':_[_0x72dc('0x2a')](_0x354458['attributes'],function(_0x55d21e){var _0x19a917={};_0x19a917[_0x55d21e]={'$like':'%'+_0xad0c74[_0x72dc('0x2e')]['filter']+'%'};return _0x19a917;})});}_0x354458=_[_0x72dc('0x3d')]({},_0x354458,_0xad0c74[_0x72dc('0x40')]);return _0x265ad0[_0x72dc('0x4e')](_0x354458);}})[_0x72dc('0x22')](function(_0x4e3c57){if(_0x4e3c57){_0x3af0d1=_0x4e3c57[_0x72dc('0x34')];if(!_0xad0c74[_0x72dc('0x2e')][_0x72dc('0x35')](_0x72dc('0x36'))){_0x354458[_0x72dc('0x37')]=qs[_0x72dc('0x37')](_0xad0c74[_0x72dc('0x2e')][_0x72dc('0x37')]);_0x354458[_0x72dc('0x1b')]=qs['offset'](_0xad0c74[_0x72dc('0x2e')]['offset']);}return _0x265ad0[_0x72dc('0x4e')](_0x354458);}})[_0x72dc('0x22')](function(_0x1a2972){if(_0x1a2972){return _0x1a2972?{'count':_0x3af0d1,'rows':_0x1a2972}:null;}})[_0x72dc('0x22')](respondWithResult(_0x383bb4,null))['catch'](handleError(_0x383bb4,null));}; \ No newline at end of file +var _0x1ba0=['fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','end','error','stack','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','create','body','find','getFields','findOne','nolimit','getSubjects','Dynamics365Field','getDescriptions','rimraf'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1ba0,0x99));var _0x01ba=function(_0x34a830,_0x49cf81){_0x34a830=_0x34a830-0x0;var _0x511238=_0x1ba0[_0x34a830];return _0x511238;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01ba('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x01ba('0x1'));var rp=require(_0x01ba('0x2'));var moment=require('moment');var BPromise=require(_0x01ba('0x3'));var Mustache=require(_0x01ba('0x4'));var util=require('util');var path=require(_0x01ba('0x5'));var sox=require(_0x01ba('0x6'));var csv=require('to-csv');var ejs=require(_0x01ba('0x7'));var fs=require('fs');var fs_extra=require(_0x01ba('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x01ba('0x9'));var deskjs=require(_0x01ba('0xa'));var toCsv=require(_0x01ba('0xb'));var querystring=require(_0x01ba('0xc'));var Papa=require('papaparse');var Redis=require(_0x01ba('0xd'));var authService=require(_0x01ba('0xe'));var qs=require(_0x01ba('0xf'));var as=require(_0x01ba('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x01ba('0x11'))(_0x01ba('0x12'));var utils=require(_0x01ba('0x13'));var config=require(_0x01ba('0x14'));var licenseUtil=require(_0x01ba('0x15'));var db=require(_0x01ba('0x16'))['db'];function respondWithStatusCode(_0x1efb08,_0x1bf2b9){_0x1bf2b9=_0x1bf2b9||0xcc;return function(_0x50eece){if(_0x50eece){return _0x1efb08[_0x01ba('0x17')](_0x1bf2b9);}return _0x1efb08[_0x01ba('0x18')](_0x1bf2b9)['end']();};}function respondWithResult(_0x566138,_0x38c64b){_0x38c64b=_0x38c64b||0xc8;return function(_0x3aaca0){if(_0x3aaca0){return _0x566138['status'](_0x38c64b)['json'](_0x3aaca0);}};}function respondWithFilteredResult(_0xa66a05,_0x1bebf9){return function(_0x24b880){if(_0x24b880){var _0x2f38d6=typeof _0x1bebf9[_0x01ba('0x19')]===_0x01ba('0x1a')&&typeof _0x1bebf9[_0x01ba('0x1b')]===_0x01ba('0x1a');var _0x1d0d72=_0x24b880[_0x01ba('0x1c')];var _0x3070b6=_0x2f38d6?0x0:_0x1bebf9[_0x01ba('0x19')];var _0xd1434b=_0x2f38d6?_0x24b880[_0x01ba('0x1c')]:_0x1bebf9[_0x01ba('0x19')]+_0x1bebf9['limit'];var _0x5ab290;if(_0xd1434b>=_0x1d0d72){_0xd1434b=_0x1d0d72;_0x5ab290=0xc8;}else{_0x5ab290=0xce;}_0xa66a05[_0x01ba('0x18')](_0x5ab290);return _0xa66a05[_0x01ba('0x1d')](_0x01ba('0x1e'),_0x3070b6+'-'+_0xd1434b+'/'+_0x1d0d72)[_0x01ba('0x1f')](_0x24b880);}return null;};}function patchUpdates(_0x470ca6){return function(_0x45efb4){try{jsonpatch['apply'](_0x45efb4,_0x470ca6,!![]);}catch(_0x2f29fd){return BPromise[_0x01ba('0x20')](_0x2f29fd);}return _0x45efb4['save']();};}function saveUpdates(_0x86b291,_0x51fd53){return function(_0x24297c){if(_0x24297c){return _0x24297c[_0x01ba('0x21')](_0x86b291)[_0x01ba('0x22')](function(_0x4a93ab){return _0x4a93ab;});}return null;};}function removeEntity(_0x4077f6,_0x12bb0e){return function(_0x1a1174){if(_0x1a1174){return _0x1a1174[_0x01ba('0x23')]()['then'](function(){_0x4077f6[_0x01ba('0x18')](0xcc)[_0x01ba('0x24')]();});}};}function handleEntityNotFound(_0x456fab,_0x4bce34){return function(_0x4fb238){if(!_0x4fb238){_0x456fab['sendStatus'](0x194);}return _0x4fb238;};}function handleError(_0x226f17,_0x326e92){_0x326e92=_0x326e92||0x1f4;return function(_0x5b1790){logger[_0x01ba('0x25')](_0x5b1790[_0x01ba('0x26')]);if(_0x5b1790[_0x01ba('0x27')]){delete _0x5b1790[_0x01ba('0x27')];}_0x226f17[_0x01ba('0x18')](_0x326e92)['send'](_0x5b1790);};}exports[_0x01ba('0x28')]=function(_0xaad4da,_0x599553){var _0x3f5d5c={},_0x390cee={},_0x15bd6c={'count':0x0,'rows':[]};var _0x179072=_[_0x01ba('0x29')](db[_0x01ba('0x2a')][_0x01ba('0x2b')],function(_0x246930){return{'name':_0x246930[_0x01ba('0x2c')],'type':_0x246930[_0x01ba('0x2d')]['key']};});_0x390cee[_0x01ba('0x2e')]=_[_0x01ba('0x29')](_0x179072,_0x01ba('0x27'));_0x390cee[_0x01ba('0x2f')]=_['keys'](_0xaad4da[_0x01ba('0x2f')]);_0x390cee[_0x01ba('0x30')]=_[_0x01ba('0x31')](_0x390cee['model'],_0x390cee[_0x01ba('0x2f')]);_0x3f5d5c[_0x01ba('0x32')]=_['intersection'](_0x390cee[_0x01ba('0x2e')],qs[_0x01ba('0x33')](_0xaad4da[_0x01ba('0x2f')][_0x01ba('0x33')]));_0x3f5d5c[_0x01ba('0x32')]=_0x3f5d5c['attributes'][_0x01ba('0x34')]?_0x3f5d5c['attributes']:_0x390cee[_0x01ba('0x2e')];if(!_0xaad4da[_0x01ba('0x2f')][_0x01ba('0x35')]('nolimit')){_0x3f5d5c[_0x01ba('0x1b')]=qs['limit'](_0xaad4da['query'][_0x01ba('0x1b')]);_0x3f5d5c['offset']=qs[_0x01ba('0x19')](_0xaad4da[_0x01ba('0x2f')][_0x01ba('0x19')]);}_0x3f5d5c[_0x01ba('0x36')]=qs['sort'](_0xaad4da[_0x01ba('0x2f')][_0x01ba('0x37')]);_0x3f5d5c[_0x01ba('0x38')]=qs['filters'](_[_0x01ba('0x39')](_0xaad4da[_0x01ba('0x2f')],_0x390cee[_0x01ba('0x30')]),_0x179072);if(_0xaad4da[_0x01ba('0x2f')][_0x01ba('0x3a')]){_0x3f5d5c['where']=_[_0x01ba('0x3b')](_0x3f5d5c[_0x01ba('0x38')],{'$or':_[_0x01ba('0x29')](_0x179072,function(_0x5ba90e){if(_0x5ba90e['type']!=='VIRTUAL'){var _0x2cdc29={};_0x2cdc29[_0x5ba90e[_0x01ba('0x27')]]={'$like':'%'+_0xaad4da[_0x01ba('0x2f')]['filter']+'%'};return _0x2cdc29;}})});}_0x3f5d5c=_[_0x01ba('0x3b')]({},_0x3f5d5c,_0xaad4da[_0x01ba('0x3c')]);var _0x2355c2={'where':_0x3f5d5c[_0x01ba('0x38')]};return db[_0x01ba('0x2a')][_0x01ba('0x1c')](_0x2355c2)[_0x01ba('0x22')](function(_0x353b48){_0x15bd6c[_0x01ba('0x1c')]=_0x353b48;if(_0xaad4da[_0x01ba('0x2f')][_0x01ba('0x3d')]){_0x3f5d5c[_0x01ba('0x3e')]=[{'all':!![]}];}return db[_0x01ba('0x2a')][_0x01ba('0x3f')](_0x3f5d5c);})[_0x01ba('0x22')](function(_0x59c45a){_0x15bd6c['rows']=_0x59c45a;return _0x15bd6c;})[_0x01ba('0x22')](respondWithFilteredResult(_0x599553,_0x3f5d5c))[_0x01ba('0x40')](handleError(_0x599553,null));};exports[_0x01ba('0x41')]=function(_0x1fe0ce,_0x542393){var _0x35331d={'raw':![],'where':{'id':_0x1fe0ce[_0x01ba('0x42')]['id']}},_0x408eb6={};_0x408eb6[_0x01ba('0x2e')]=_[_0x01ba('0x43')](db[_0x01ba('0x2a')]['rawAttributes']);_0x408eb6['query']=_['keys'](_0x1fe0ce['query']);_0x408eb6[_0x01ba('0x30')]=_[_0x01ba('0x31')](_0x408eb6[_0x01ba('0x2e')],_0x408eb6[_0x01ba('0x2f')]);_0x35331d[_0x01ba('0x32')]=_[_0x01ba('0x31')](_0x408eb6['model'],qs['fields'](_0x1fe0ce[_0x01ba('0x2f')][_0x01ba('0x33')]));_0x35331d[_0x01ba('0x32')]=_0x35331d['attributes'][_0x01ba('0x34')]?_0x35331d[_0x01ba('0x32')]:_0x408eb6['model'];if(_0x1fe0ce[_0x01ba('0x2f')][_0x01ba('0x3d')]){_0x35331d['include']=[{'all':!![]}];}_0x35331d=_[_0x01ba('0x3b')]({},_0x35331d,_0x1fe0ce['options']);return db[_0x01ba('0x2a')]['find'](_0x35331d)['then'](handleEntityNotFound(_0x542393,null))[_0x01ba('0x22')](respondWithResult(_0x542393,null))[_0x01ba('0x40')](handleError(_0x542393,null));};exports[_0x01ba('0x44')]=function(_0x369e77,_0xa450ed){return db[_0x01ba('0x2a')]['create'](_0x369e77[_0x01ba('0x45')],{})[_0x01ba('0x22')](respondWithResult(_0xa450ed,0xc9))[_0x01ba('0x40')](handleError(_0xa450ed,null));};exports[_0x01ba('0x21')]=function(_0x21eec4,_0xb9224b){if(_0x21eec4[_0x01ba('0x45')]['id']){delete _0x21eec4['body']['id'];}return db[_0x01ba('0x2a')][_0x01ba('0x46')]({'where':{'id':_0x21eec4[_0x01ba('0x42')]['id']}})[_0x01ba('0x22')](handleEntityNotFound(_0xb9224b,null))[_0x01ba('0x22')](saveUpdates(_0x21eec4[_0x01ba('0x45')],null))[_0x01ba('0x22')](respondWithResult(_0xb9224b,null))[_0x01ba('0x40')](handleError(_0xb9224b,null));};exports[_0x01ba('0x23')]=function(_0x9051c8,_0x5b3ef3){return db[_0x01ba('0x2a')]['find']({'where':{'id':_0x9051c8[_0x01ba('0x42')]['id']}})[_0x01ba('0x22')](handleEntityNotFound(_0x5b3ef3,null))[_0x01ba('0x22')](removeEntity(_0x5b3ef3,null))[_0x01ba('0x40')](handleError(_0x5b3ef3,null));};exports[_0x01ba('0x47')]=function(_0xcc97d5,_0x10ffe1,_0x11a18d){var _0x295822={};var _0x2bd2ec={};var _0x3487db;var _0x3f8e64;return db[_0x01ba('0x2a')][_0x01ba('0x48')]({'where':{'id':_0xcc97d5[_0x01ba('0x42')]['id']}})[_0x01ba('0x22')](handleEntityNotFound(_0x10ffe1,null))[_0x01ba('0x22')](function(_0xfdf0d1){if(_0xfdf0d1){_0x3487db=_0xfdf0d1;_0x2bd2ec[_0x01ba('0x2e')]=_[_0x01ba('0x43')](db['Dynamics365Field']['rawAttributes']);_0x2bd2ec[_0x01ba('0x2f')]=_['keys'](_0xcc97d5[_0x01ba('0x2f')]);_0x2bd2ec[_0x01ba('0x30')]=_[_0x01ba('0x31')](_0x2bd2ec[_0x01ba('0x2e')],_0x2bd2ec[_0x01ba('0x2f')]);_0x295822[_0x01ba('0x32')]=_['intersection'](_0x2bd2ec[_0x01ba('0x2e')],qs[_0x01ba('0x33')](_0xcc97d5[_0x01ba('0x2f')][_0x01ba('0x33')]));_0x295822['attributes']=_0x295822[_0x01ba('0x32')]['length']?_0x295822['attributes']:_0x2bd2ec[_0x01ba('0x2e')];_0x295822['order']=qs[_0x01ba('0x37')](_0xcc97d5[_0x01ba('0x2f')]['sort']);_0x295822[_0x01ba('0x38')]=qs['filters'](_[_0x01ba('0x39')](_0xcc97d5[_0x01ba('0x2f')],_0x2bd2ec[_0x01ba('0x30')]));if(_0xcc97d5['query'][_0x01ba('0x3a')]){_0x295822[_0x01ba('0x38')]=_[_0x01ba('0x3b')](_0x295822['where'],{'$or':_[_0x01ba('0x29')](_0x295822[_0x01ba('0x32')],function(_0x302d25){var _0x206aec={};_0x206aec[_0x302d25]={'$like':'%'+_0xcc97d5[_0x01ba('0x2f')][_0x01ba('0x3a')]+'%'};return _0x206aec;})});}_0x295822=_['merge']({},_0x295822,_0xcc97d5[_0x01ba('0x3c')]);return _0x3487db['getFields'](_0x295822);}})[_0x01ba('0x22')](function(_0x450a9e){if(_0x450a9e){_0x3f8e64=_0x450a9e[_0x01ba('0x34')];if(!_0xcc97d5[_0x01ba('0x2f')]['hasOwnProperty'](_0x01ba('0x49'))){_0x295822[_0x01ba('0x1b')]=qs['limit'](_0xcc97d5[_0x01ba('0x2f')][_0x01ba('0x1b')]);_0x295822[_0x01ba('0x19')]=qs[_0x01ba('0x19')](_0xcc97d5[_0x01ba('0x2f')][_0x01ba('0x19')]);}return _0x3487db[_0x01ba('0x47')](_0x295822);}})['then'](function(_0x587b3c){if(_0x587b3c){return _0x587b3c?{'count':_0x3f8e64,'rows':_0x587b3c}:null;}})[_0x01ba('0x22')](respondWithResult(_0x10ffe1,null))[_0x01ba('0x40')](handleError(_0x10ffe1,null));};exports[_0x01ba('0x4a')]=function(_0xc1eaee,_0x183e02,_0x1e2452){var _0x36ff03={};var _0xb0195d={};var _0x379d6e;var _0x1a7828;return db[_0x01ba('0x2a')]['findOne']({'where':{'id':_0xc1eaee[_0x01ba('0x42')]['id']}})[_0x01ba('0x22')](handleEntityNotFound(_0x183e02,null))[_0x01ba('0x22')](function(_0x39073a){if(_0x39073a){_0x379d6e=_0x39073a;_0xb0195d[_0x01ba('0x2e')]=_[_0x01ba('0x43')](db[_0x01ba('0x4b')]['rawAttributes']);_0xb0195d[_0x01ba('0x2f')]=_[_0x01ba('0x43')](_0xc1eaee[_0x01ba('0x2f')]);_0xb0195d[_0x01ba('0x30')]=_[_0x01ba('0x31')](_0xb0195d['model'],_0xb0195d[_0x01ba('0x2f')]);_0x36ff03[_0x01ba('0x32')]=_[_0x01ba('0x31')](_0xb0195d[_0x01ba('0x2e')],qs[_0x01ba('0x33')](_0xc1eaee[_0x01ba('0x2f')][_0x01ba('0x33')]));_0x36ff03[_0x01ba('0x32')]=_0x36ff03['attributes'][_0x01ba('0x34')]?_0x36ff03[_0x01ba('0x32')]:_0xb0195d[_0x01ba('0x2e')];_0x36ff03[_0x01ba('0x36')]=qs[_0x01ba('0x37')](_0xc1eaee[_0x01ba('0x2f')][_0x01ba('0x37')]);_0x36ff03[_0x01ba('0x38')]=qs[_0x01ba('0x30')](_[_0x01ba('0x39')](_0xc1eaee[_0x01ba('0x2f')],_0xb0195d[_0x01ba('0x30')]));if(_0xc1eaee[_0x01ba('0x2f')][_0x01ba('0x3a')]){_0x36ff03[_0x01ba('0x38')]=_[_0x01ba('0x3b')](_0x36ff03['where'],{'$or':_['map'](_0x36ff03[_0x01ba('0x32')],function(_0x3bc47f){var _0xe24d66={};_0xe24d66[_0x3bc47f]={'$like':'%'+_0xc1eaee[_0x01ba('0x2f')][_0x01ba('0x3a')]+'%'};return _0xe24d66;})});}_0x36ff03=_[_0x01ba('0x3b')]({},_0x36ff03,_0xc1eaee[_0x01ba('0x3c')]);return _0x379d6e['getSubjects'](_0x36ff03);}})[_0x01ba('0x22')](function(_0x33377f){if(_0x33377f){_0x1a7828=_0x33377f[_0x01ba('0x34')];if(!_0xc1eaee[_0x01ba('0x2f')][_0x01ba('0x35')]('nolimit')){_0x36ff03[_0x01ba('0x1b')]=qs[_0x01ba('0x1b')](_0xc1eaee['query'][_0x01ba('0x1b')]);_0x36ff03[_0x01ba('0x19')]=qs[_0x01ba('0x19')](_0xc1eaee['query'][_0x01ba('0x19')]);}return _0x379d6e[_0x01ba('0x4a')](_0x36ff03);}})[_0x01ba('0x22')](function(_0x59c41f){if(_0x59c41f){return _0x59c41f?{'count':_0x1a7828,'rows':_0x59c41f}:null;}})[_0x01ba('0x22')](respondWithResult(_0x183e02,null))['catch'](handleError(_0x183e02,null));};exports['getDescriptions']=function(_0x232a43,_0x34fa1e,_0x36b754){var _0x233e5a={};var _0x3422bc={};var _0x184445;var _0x163577;return db[_0x01ba('0x2a')][_0x01ba('0x48')]({'where':{'id':_0x232a43[_0x01ba('0x42')]['id']}})[_0x01ba('0x22')](handleEntityNotFound(_0x34fa1e,null))[_0x01ba('0x22')](function(_0x1ec0fa){if(_0x1ec0fa){_0x184445=_0x1ec0fa;_0x3422bc['model']=_[_0x01ba('0x43')](db[_0x01ba('0x4b')]['rawAttributes']);_0x3422bc[_0x01ba('0x2f')]=_[_0x01ba('0x43')](_0x232a43[_0x01ba('0x2f')]);_0x3422bc[_0x01ba('0x30')]=_[_0x01ba('0x31')](_0x3422bc[_0x01ba('0x2e')],_0x3422bc[_0x01ba('0x2f')]);_0x233e5a['attributes']=_['intersection'](_0x3422bc['model'],qs['fields'](_0x232a43[_0x01ba('0x2f')][_0x01ba('0x33')]));_0x233e5a[_0x01ba('0x32')]=_0x233e5a[_0x01ba('0x32')][_0x01ba('0x34')]?_0x233e5a[_0x01ba('0x32')]:_0x3422bc[_0x01ba('0x2e')];_0x233e5a['order']=qs['sort'](_0x232a43['query'][_0x01ba('0x37')]);_0x233e5a[_0x01ba('0x38')]=qs[_0x01ba('0x30')](_[_0x01ba('0x39')](_0x232a43[_0x01ba('0x2f')],_0x3422bc[_0x01ba('0x30')]));if(_0x232a43[_0x01ba('0x2f')][_0x01ba('0x3a')]){_0x233e5a['where']=_[_0x01ba('0x3b')](_0x233e5a['where'],{'$or':_['map'](_0x233e5a['attributes'],function(_0x2b064c){var _0x47d16b={};_0x47d16b[_0x2b064c]={'$like':'%'+_0x232a43[_0x01ba('0x2f')]['filter']+'%'};return _0x47d16b;})});}_0x233e5a=_[_0x01ba('0x3b')]({},_0x233e5a,_0x232a43[_0x01ba('0x3c')]);return _0x184445[_0x01ba('0x4c')](_0x233e5a);}})['then'](function(_0x193a6c){if(_0x193a6c){_0x163577=_0x193a6c[_0x01ba('0x34')];if(!_0x232a43[_0x01ba('0x2f')]['hasOwnProperty'](_0x01ba('0x49'))){_0x233e5a[_0x01ba('0x1b')]=qs[_0x01ba('0x1b')](_0x232a43['query'][_0x01ba('0x1b')]);_0x233e5a[_0x01ba('0x19')]=qs[_0x01ba('0x19')](_0x232a43['query'][_0x01ba('0x19')]);}return _0x184445[_0x01ba('0x4c')](_0x233e5a);}})[_0x01ba('0x22')](function(_0x286e11){if(_0x286e11){return _0x286e11?{'count':_0x163577,'rows':_0x286e11}:null;}})['then'](respondWithResult(_0x34fa1e,null))['catch'](handleError(_0x34fa1e,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 3672f27..b8e3ae8 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 _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','lodash','util'];(function(_0x3e1293,_0x3e4691){var _0xf80d8d=function(_0x2893a8){while(--_0x2893a8){_0x3e1293['push'](_0x3e1293['shift']());}};_0xf80d8d(++_0x3e4691);}(_0x54ef,0x112));var _0xf54e=function(_0xd3b9cc,_0xcf272c){_0xd3b9cc=_0xd3b9cc-0x0;var _0x18e91a=_0x54ef[_0xd3b9cc];return _0x18e91a;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb43b=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird','path'];(function(_0x24ce15,_0x4daf17){var _0x31c534=function(_0x3b994d){while(--_0x3b994d){_0x24ce15['push'](_0x24ce15['shift']());}};_0x31c534(++_0x4daf17);}(_0xb43b,0x1b2));var _0xbb43=function(_0xb2b331,_0x363e6b){_0xb2b331=_0xb2b331-0x0;var _0x56a58c=_0xb43b[_0xb2b331];return _0x56a58c;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index b51a864..973095d 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 _0xd18c=['request','then','info','request\x20sent','error','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1703e2,_0x4f91b9){var _0x22e735=function(_0x279359){while(--_0x279359){_0x1703e2['push'](_0x1703e2['shift']());}};_0x22e735(++_0x4f91b9);}(_0xd18c,0xd1));var _0xcd18=function(_0x21bfce,_0x4c2c80){_0x21bfce=_0x21bfce-0x0;var _0x1cd9e0=_0xd18c[_0x21bfce];return _0x1cd9e0;};'use strict';var _=require(_0xcd18('0x0'));var util=require('util');var moment=require(_0xcd18('0x1'));var BPromise=require('bluebird');var rs=require(_0xcd18('0x2'));var fs=require('fs');var Redis=require(_0xcd18('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcd18('0x4'));var logger=require(_0xcd18('0x5'))(_0xcd18('0x6'));var config=require(_0xcd18('0x7'));var jayson=require(_0xcd18('0x8'));var client=jayson[_0xcd18('0x9')][_0xcd18('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34c77d,_0x5b2eb3,_0x4aadaf){return new BPromise(function(_0x48e34e,_0x4bb164){return client[_0xcd18('0xb')](_0x34c77d,_0x4aadaf)[_0xcd18('0xc')](function(_0x3bce7e){logger[_0xcd18('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5b2eb3,_0xcd18('0xe'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x5b2eb3,_0xcd18('0xe'),JSON['stringify'](_0x3bce7e));if(_0x3bce7e['error']){if(_0x3bce7e[_0xcd18('0xf')]['code']===0x1f4){logger[_0xcd18('0xf')](_0xcd18('0x10'),_0x5b2eb3,_0x3bce7e[_0xcd18('0xf')][_0xcd18('0x11')]);return _0x4bb164(_0x3bce7e[_0xcd18('0xf')][_0xcd18('0x11')]);}logger[_0xcd18('0xf')](_0xcd18('0x10'),_0x5b2eb3,_0x3bce7e[_0xcd18('0xf')][_0xcd18('0x11')]);return _0x48e34e(_0x3bce7e[_0xcd18('0xf')][_0xcd18('0x11')]);}else{logger[_0xcd18('0xd')](_0xcd18('0x10'),_0x5b2eb3,_0xcd18('0xe'));_0x48e34e(_0x3bce7e[_0xcd18('0x12')][_0xcd18('0x11')]);}})[_0xcd18('0x13')](function(_0x3827dd){logger[_0xcd18('0xf')](_0xcd18('0x10'),_0x5b2eb3,_0x3827dd);_0x4bb164(_0x3827dd);});});} \ No newline at end of file +var _0xc946=['info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x541329,_0x337d56){var _0x5b2c1c=function(_0x1ec5d9){while(--_0x1ec5d9){_0x541329['push'](_0x541329['shift']());}};_0x5b2c1c(++_0x337d56);}(_0xc946,0x1e6));var _0x6c94=function(_0x13beef,_0x1a9832){_0x13beef=_0x13beef-0x0;var _0x3bba9b=_0xc946[_0x13beef];return _0x3bba9b;};'use strict';var _=require(_0x6c94('0x0'));var util=require(_0x6c94('0x1'));var moment=require(_0x6c94('0x2'));var BPromise=require(_0x6c94('0x3'));var rs=require(_0x6c94('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c94('0x5'))['db'];var utils=require(_0x6c94('0x6'));var logger=require(_0x6c94('0x7'))('rpc');var config=require(_0x6c94('0x8'));var jayson=require(_0x6c94('0x9'));var client=jayson[_0x6c94('0xa')][_0x6c94('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbb8d98,_0x500c35,_0x15dde2){return new BPromise(function(_0x35d6e4,_0x3357b2){return client[_0x6c94('0xc')](_0xbb8d98,_0x15dde2)[_0x6c94('0xd')](function(_0xd66361){logger[_0x6c94('0xe')](_0x6c94('0xf'),_0x500c35,'request\x20sent');logger[_0x6c94('0x10')](_0x6c94('0x11'),_0x500c35,_0x6c94('0x12'),JSON[_0x6c94('0x13')](_0xd66361));if(_0xd66361['error']){if(_0xd66361[_0x6c94('0x14')][_0x6c94('0x15')]===0x1f4){logger[_0x6c94('0x14')](_0x6c94('0xf'),_0x500c35,_0xd66361[_0x6c94('0x14')][_0x6c94('0x16')]);return _0x3357b2(_0xd66361[_0x6c94('0x14')][_0x6c94('0x16')]);}logger['error'](_0x6c94('0xf'),_0x500c35,_0xd66361[_0x6c94('0x14')][_0x6c94('0x16')]);return _0x35d6e4(_0xd66361['error'][_0x6c94('0x16')]);}else{logger[_0x6c94('0xe')](_0x6c94('0xf'),_0x500c35,'request\x20sent');_0x35d6e4(_0xd66361[_0x6c94('0x17')][_0x6c94('0x16')]);}})[_0x6c94('0x18')](function(_0x41dba2){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x500c35,_0x41dba2);_0x3357b2(_0x41dba2);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 7e070be..89921b3 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 _0x7a8d=['util','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x209cc0,_0x59bb37){var _0x3c5029=function(_0x39c02f){while(--_0x39c02f){_0x209cc0['push'](_0x209cc0['shift']());}};_0x3c5029(++_0x59bb37);}(_0x7a8d,0xdc));var _0xd7a8=function(_0x1816f7,_0x5e1b2c){_0x1816f7=_0x1816f7-0x0;var _0x5508d2=_0x7a8d[_0x1816f7];return _0x5508d2;};'use strict';var multer=require(_0xd7a8('0x0'));var util=require(_0xd7a8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd7a8('0x2'));var router=express[_0xd7a8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd7a8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd7a8('0x5'));var controller=require(_0xd7a8('0x6'));router[_0xd7a8('0x7')]('/',auth[_0xd7a8('0x8')](),controller['index']);router[_0xd7a8('0x7')](_0xd7a8('0x9'),auth[_0xd7a8('0x8')](),controller[_0xd7a8('0xa')]);router[_0xd7a8('0xb')]('/',auth[_0xd7a8('0x8')](),controller[_0xd7a8('0xc')]);router[_0xd7a8('0xd')](_0xd7a8('0x9'),auth['isAuthenticated'](),controller[_0xd7a8('0xe')]);router[_0xd7a8('0xf')](_0xd7a8('0x9'),auth[_0xd7a8('0x8')](),controller[_0xd7a8('0x10')]);module['exports']=router; \ No newline at end of file +var _0x77a6=['update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x77a6,0x10b));var _0x677a=function(_0x1229c8,_0x390372){_0x1229c8=_0x1229c8-0x0;var _0x2c338e=_0x77a6[_0x1229c8];return _0x2c338e;};'use strict';var multer=require(_0x677a('0x0'));var util=require(_0x677a('0x1'));var path=require(_0x677a('0x2'));var timeout=require(_0x677a('0x3'));var express=require(_0x677a('0x4'));var router=express[_0x677a('0x5')]();var fs_extra=require(_0x677a('0x6'));var auth=require(_0x677a('0x7'));var interaction=require(_0x677a('0x8'));var config=require(_0x677a('0x9'));var controller=require(_0x677a('0xa'));router['get']('/',auth[_0x677a('0xb')](),controller[_0x677a('0xc')]);router[_0x677a('0xd')](_0x677a('0xe'),auth[_0x677a('0xb')](),controller[_0x677a('0xf')]);router[_0x677a('0x10')]('/',auth[_0x677a('0xb')](),controller[_0x677a('0x11')]);router[_0x677a('0x12')](_0x677a('0xe'),auth[_0x677a('0xb')](),controller[_0x677a('0x13')]);router[_0x677a('0x14')](_0x677a('0xe'),auth[_0x677a('0xb')](),controller['destroy']);module[_0x677a('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index bbf9168..d320137 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 _0x1afa=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x3c4a6c,_0x3bf5ce){var _0x482e45=function(_0xb07b5d){while(--_0xb07b5d){_0x3c4a6c['push'](_0x3c4a6c['shift']());}};_0x482e45(++_0x3bf5ce);}(_0x1afa,0xb3));var _0xa1af=function(_0x43c324,_0x33077f){_0x43c324=_0x43c324-0x0;var _0x135832=_0x1afa[_0x43c324];return _0x135832;};'use strict';var Sequelize=require(_0xa1af('0x0'));module['exports']={'type':{'type':Sequelize[_0xa1af('0x1')](_0xa1af('0x2'),_0xa1af('0x3'),_0xa1af('0x4'),_0xa1af('0x5'),_0xa1af('0x6')),'defaultValue':_0xa1af('0x2')},'content':{'type':Sequelize[_0xa1af('0x7')]},'key':{'type':Sequelize[_0xa1af('0x7')]},'keyType':{'type':Sequelize[_0xa1af('0x1')](_0xa1af('0x2'),_0xa1af('0x3'),_0xa1af('0x4'))},'keyContent':{'type':Sequelize[_0xa1af('0x7')]},'idField':{'type':Sequelize[_0xa1af('0x7')]},'nameField':{'type':Sequelize[_0xa1af('0x7')]},'customField':{'type':Sequelize[_0xa1af('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa1af('0x7')]}}; \ No newline at end of file +var _0x86b9=['BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x86b9,0x15f));var _0x986b=function(_0x522a20,_0x443a8d){_0x522a20=_0x522a20-0x0;var _0x1e1f6a=_0x86b9[_0x522a20];return _0x1e1f6a;};'use strict';var Sequelize=require(_0x986b('0x0'));module[_0x986b('0x1')]={'type':{'type':Sequelize[_0x986b('0x2')](_0x986b('0x3'),_0x986b('0x4'),'customVariable',_0x986b('0x5'),_0x986b('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x986b('0x7')]},'keyType':{'type':Sequelize[_0x986b('0x2')](_0x986b('0x3'),_0x986b('0x4'),_0x986b('0x8'))},'keyContent':{'type':Sequelize[_0x986b('0x7')]},'idField':{'type':Sequelize[_0x986b('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x986b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x986b('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index a8eb6c7..7c6160f 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 _0xbd7e=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','save','then','error','name','send','index','map','type','key','model','keys','intersection','query','fields','attributes','length','nolimit','pick','filters','filter','where','merge','VIRTUAL','options','Dynamics365Field','include','catch','show','includeAll','find','create','update','body','params','destroy','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox'];(function(_0xa77c5d,_0x16545c){var _0x152cc6=function(_0x341621){while(--_0x341621){_0xa77c5d['push'](_0xa77c5d['shift']());}};_0x152cc6(++_0x16545c);}(_0xbd7e,0x191));var _0xebd7=function(_0x28b9dd,_0x2f2c7e){_0x28b9dd=_0x28b9dd-0x0;var _0x3c56ee=_0xbd7e[_0x28b9dd];return _0x3c56ee;};'use strict';var emlformat=require(_0xebd7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xebd7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xebd7('0x2'));var moment=require('moment');var BPromise=require(_0xebd7('0x3'));var Mustache=require(_0xebd7('0x4'));var util=require('util');var path=require(_0xebd7('0x5'));var sox=require(_0xebd7('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xebd7('0x7'));var squel=require(_0xebd7('0x8'));var crypto=require(_0xebd7('0x9'));var jsforce=require(_0xebd7('0xa'));var deskjs=require(_0xebd7('0xb'));var toCsv=require('to-csv');var querystring=require(_0xebd7('0xc'));var Papa=require(_0xebd7('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xebd7('0xe'));var as=require(_0xebd7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xebd7('0x10'))(_0xebd7('0x11'));var utils=require(_0xebd7('0x12'));var config=require(_0xebd7('0x13'));var licenseUtil=require(_0xebd7('0x14'));var db=require(_0xebd7('0x15'))['db'];function respondWithStatusCode(_0x2b268e,_0x251349){_0x251349=_0x251349||0xcc;return function(_0x392344){if(_0x392344){return _0x2b268e[_0xebd7('0x16')](_0x251349);}return _0x2b268e[_0xebd7('0x17')](_0x251349)[_0xebd7('0x18')]();};}function respondWithResult(_0x1a1669,_0x31170b){_0x31170b=_0x31170b||0xc8;return function(_0x32f9e5){if(_0x32f9e5){return _0x1a1669[_0xebd7('0x17')](_0x31170b)['json'](_0x32f9e5);}};}function respondWithFilteredResult(_0x3847d9,_0x4bb18e){return function(_0x5a62fa){if(_0x5a62fa){var _0x36f8e6=typeof _0x4bb18e['offset']===_0xebd7('0x19')&&typeof _0x4bb18e[_0xebd7('0x1a')]===_0xebd7('0x19');var _0x480d99=_0x5a62fa['count'];var _0x44a431=_0x36f8e6?0x0:_0x4bb18e[_0xebd7('0x1b')];var _0xd04fdd=_0x36f8e6?_0x5a62fa[_0xebd7('0x1c')]:_0x4bb18e[_0xebd7('0x1b')]+_0x4bb18e[_0xebd7('0x1a')];var _0x594973;if(_0xd04fdd>=_0x480d99){_0xd04fdd=_0x480d99;_0x594973=0xc8;}else{_0x594973=0xce;}_0x3847d9['status'](_0x594973);return _0x3847d9['set'](_0xebd7('0x1d'),_0x44a431+'-'+_0xd04fdd+'/'+_0x480d99)[_0xebd7('0x1e')](_0x5a62fa);}return null;};}function patchUpdates(_0x1b57ef){return function(_0xe5ad09){try{jsonpatch[_0xebd7('0x1f')](_0xe5ad09,_0x1b57ef,!![]);}catch(_0x58729b){return BPromise[_0xebd7('0x20')](_0x58729b);}return _0xe5ad09[_0xebd7('0x21')]();};}function saveUpdates(_0x162d5b,_0x42acd3){return function(_0x41cc41){if(_0x41cc41){return _0x41cc41['update'](_0x162d5b)[_0xebd7('0x22')](function(_0x42c528){return _0x42c528;});}return null;};}function removeEntity(_0x108201,_0x2a0375){return function(_0x5de76d){if(_0x5de76d){return _0x5de76d['destroy']()['then'](function(){_0x108201[_0xebd7('0x17')](0xcc)[_0xebd7('0x18')]();});}};}function handleEntityNotFound(_0x4bbec2,_0x300dfe){return function(_0x31bff1){if(!_0x31bff1){_0x4bbec2[_0xebd7('0x16')](0x194);}return _0x31bff1;};}function handleError(_0x2a3146,_0x4860a5){_0x4860a5=_0x4860a5||0x1f4;return function(_0x3a4a65){logger[_0xebd7('0x23')](_0x3a4a65['stack']);if(_0x3a4a65[_0xebd7('0x24')]){delete _0x3a4a65[_0xebd7('0x24')];}_0x2a3146[_0xebd7('0x17')](_0x4860a5)[_0xebd7('0x25')](_0x3a4a65);};}exports[_0xebd7('0x26')]=function(_0x3d18dc,_0x3682e7){var _0x52f57c={},_0x20cef6={},_0x1f560f={'count':0x0,'rows':[]};var _0x1435dd=_[_0xebd7('0x27')](db['Dynamics365Field']['rawAttributes'],function(_0x52302b){return{'name':_0x52302b['fieldName'],'type':_0x52302b[_0xebd7('0x28')][_0xebd7('0x29')]};});_0x20cef6[_0xebd7('0x2a')]=_[_0xebd7('0x27')](_0x1435dd,_0xebd7('0x24'));_0x20cef6['query']=_[_0xebd7('0x2b')](_0x3d18dc['query']);_0x20cef6['filters']=_[_0xebd7('0x2c')](_0x20cef6['model'],_0x20cef6[_0xebd7('0x2d')]);_0x52f57c['attributes']=_['intersection'](_0x20cef6[_0xebd7('0x2a')],qs[_0xebd7('0x2e')](_0x3d18dc[_0xebd7('0x2d')][_0xebd7('0x2e')]));_0x52f57c['attributes']=_0x52f57c[_0xebd7('0x2f')][_0xebd7('0x30')]?_0x52f57c[_0xebd7('0x2f')]:_0x20cef6['model'];if(!_0x3d18dc[_0xebd7('0x2d')]['hasOwnProperty'](_0xebd7('0x31'))){_0x52f57c[_0xebd7('0x1a')]=qs['limit'](_0x3d18dc['query'][_0xebd7('0x1a')]);_0x52f57c[_0xebd7('0x1b')]=qs[_0xebd7('0x1b')](_0x3d18dc[_0xebd7('0x2d')][_0xebd7('0x1b')]);}_0x52f57c['order']=qs['sort'](_0x3d18dc[_0xebd7('0x2d')]['sort']);_0x52f57c['where']=qs['filters'](_[_0xebd7('0x32')](_0x3d18dc[_0xebd7('0x2d')],_0x20cef6[_0xebd7('0x33')]),_0x1435dd);if(_0x3d18dc[_0xebd7('0x2d')][_0xebd7('0x34')]){_0x52f57c[_0xebd7('0x35')]=_[_0xebd7('0x36')](_0x52f57c[_0xebd7('0x35')],{'$or':_[_0xebd7('0x27')](_0x1435dd,function(_0x158865){if(_0x158865[_0xebd7('0x28')]!==_0xebd7('0x37')){var _0x1b163a={};_0x1b163a[_0x158865[_0xebd7('0x24')]]={'$like':'%'+_0x3d18dc['query'][_0xebd7('0x34')]+'%'};return _0x1b163a;}})});}_0x52f57c=_[_0xebd7('0x36')]({},_0x52f57c,_0x3d18dc[_0xebd7('0x38')]);var _0x2dd986={'where':_0x52f57c['where']};return db[_0xebd7('0x39')][_0xebd7('0x1c')](_0x2dd986)['then'](function(_0x4c4150){_0x1f560f[_0xebd7('0x1c')]=_0x4c4150;if(_0x3d18dc[_0xebd7('0x2d')]['includeAll']){_0x52f57c[_0xebd7('0x3a')]=[{'all':!![]}];}return db[_0xebd7('0x39')]['findAll'](_0x52f57c);})['then'](function(_0x167f58){_0x1f560f['rows']=_0x167f58;return _0x1f560f;})['then'](respondWithFilteredResult(_0x3682e7,_0x52f57c))[_0xebd7('0x3b')](handleError(_0x3682e7,null));};exports[_0xebd7('0x3c')]=function(_0x5a414e,_0x3fd4bd){var _0x3e13ce={'raw':!![],'where':{'id':_0x5a414e['params']['id']}},_0x28ae64={};_0x28ae64['model']=_['keys'](db[_0xebd7('0x39')]['rawAttributes']);_0x28ae64[_0xebd7('0x2d')]=_['keys'](_0x5a414e[_0xebd7('0x2d')]);_0x28ae64[_0xebd7('0x33')]=_[_0xebd7('0x2c')](_0x28ae64[_0xebd7('0x2a')],_0x28ae64[_0xebd7('0x2d')]);_0x3e13ce[_0xebd7('0x2f')]=_[_0xebd7('0x2c')](_0x28ae64[_0xebd7('0x2a')],qs[_0xebd7('0x2e')](_0x5a414e[_0xebd7('0x2d')]['fields']));_0x3e13ce[_0xebd7('0x2f')]=_0x3e13ce[_0xebd7('0x2f')][_0xebd7('0x30')]?_0x3e13ce['attributes']:_0x28ae64[_0xebd7('0x2a')];if(_0x5a414e['query'][_0xebd7('0x3d')]){_0x3e13ce[_0xebd7('0x3a')]=[{'all':!![]}];}_0x3e13ce=_[_0xebd7('0x36')]({},_0x3e13ce,_0x5a414e[_0xebd7('0x38')]);return db['Dynamics365Field'][_0xebd7('0x3e')](_0x3e13ce)[_0xebd7('0x22')](handleEntityNotFound(_0x3fd4bd,null))[_0xebd7('0x22')](respondWithResult(_0x3fd4bd,null))[_0xebd7('0x3b')](handleError(_0x3fd4bd,null));};exports[_0xebd7('0x3f')]=function(_0x52b484,_0x5d94df){return db[_0xebd7('0x39')][_0xebd7('0x3f')](_0x52b484['body'],{})[_0xebd7('0x22')](respondWithResult(_0x5d94df,0xc9))[_0xebd7('0x3b')](handleError(_0x5d94df,null));};exports[_0xebd7('0x40')]=function(_0x2e9c38,_0x5a2642){if(_0x2e9c38[_0xebd7('0x41')]['id']){delete _0x2e9c38[_0xebd7('0x41')]['id'];}return db[_0xebd7('0x39')][_0xebd7('0x3e')]({'where':{'id':_0x2e9c38[_0xebd7('0x42')]['id']}})['then'](handleEntityNotFound(_0x5a2642,null))['then'](saveUpdates(_0x2e9c38['body'],null))[_0xebd7('0x22')](respondWithResult(_0x5a2642,null))[_0xebd7('0x3b')](handleError(_0x5a2642,null));};exports[_0xebd7('0x43')]=function(_0x203974,_0x566999){return db['Dynamics365Field'][_0xebd7('0x3e')]({'where':{'id':_0x203974[_0xebd7('0x42')]['id']}})[_0xebd7('0x22')](handleEntityNotFound(_0x566999,null))[_0xebd7('0x22')](removeEntity(_0x566999,null))[_0xebd7('0x3b')](handleError(_0x566999,null));}; \ No newline at end of file +var _0xb4f7=['bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','type','VIRTUAL','filter','options','includeAll','include','Dynamics365Field','findAll','rows','show','params','length','merge','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x13fe42,_0x439472){var _0x486df1=function(_0x1b0a49){while(--_0x1b0a49){_0x13fe42['push'](_0x13fe42['shift']());}};_0x486df1(++_0x439472);}(_0xb4f7,0xd3));var _0x7b4f=function(_0x3e380a,_0x5a2e11){_0x3e380a=_0x3e380a-0x0;var _0x2e8b05=_0xb4f7[_0x3e380a];return _0x2e8b05;};'use strict';var emlformat=require(_0x7b4f('0x0'));var rimraf=require(_0x7b4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b4f('0x2'));var rp=require(_0x7b4f('0x3'));var moment=require(_0x7b4f('0x4'));var BPromise=require(_0x7b4f('0x5'));var Mustache=require(_0x7b4f('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7b4f('0x7'));var csv=require(_0x7b4f('0x8'));var ejs=require(_0x7b4f('0x9'));var fs=require('fs');var fs_extra=require(_0x7b4f('0xa'));var _=require(_0x7b4f('0xb'));var squel=require('squel');var crypto=require(_0x7b4f('0xc'));var jsforce=require(_0x7b4f('0xd'));var deskjs=require(_0x7b4f('0xe'));var toCsv=require(_0x7b4f('0x8'));var querystring=require(_0x7b4f('0xf'));var Papa=require(_0x7b4f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7b4f('0x11'));var as=require(_0x7b4f('0x12'));var hardwareService=require(_0x7b4f('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x7b4f('0x14'));var licenseUtil=require(_0x7b4f('0x15'));var db=require(_0x7b4f('0x16'))['db'];function respondWithStatusCode(_0x478720,_0x57bf93){_0x57bf93=_0x57bf93||0xcc;return function(_0x24123d){if(_0x24123d){return _0x478720[_0x7b4f('0x17')](_0x57bf93);}return _0x478720['status'](_0x57bf93)[_0x7b4f('0x18')]();};}function respondWithResult(_0x51ac4d,_0x5a4ccf){_0x5a4ccf=_0x5a4ccf||0xc8;return function(_0x3e26fd){if(_0x3e26fd){return _0x51ac4d['status'](_0x5a4ccf)['json'](_0x3e26fd);}};}function respondWithFilteredResult(_0x1039cd,_0x3c9fc3){return function(_0x53170f){if(_0x53170f){var _0x53c388=typeof _0x3c9fc3[_0x7b4f('0x19')]===_0x7b4f('0x1a')&&typeof _0x3c9fc3[_0x7b4f('0x1b')]===_0x7b4f('0x1a');var _0x3b7f10=_0x53170f[_0x7b4f('0x1c')];var _0x143205=_0x53c388?0x0:_0x3c9fc3[_0x7b4f('0x19')];var _0x5ec0c0=_0x53c388?_0x53170f[_0x7b4f('0x1c')]:_0x3c9fc3[_0x7b4f('0x19')]+_0x3c9fc3[_0x7b4f('0x1b')];var _0x1e8610;if(_0x5ec0c0>=_0x3b7f10){_0x5ec0c0=_0x3b7f10;_0x1e8610=0xc8;}else{_0x1e8610=0xce;}_0x1039cd[_0x7b4f('0x1d')](_0x1e8610);return _0x1039cd[_0x7b4f('0x1e')](_0x7b4f('0x1f'),_0x143205+'-'+_0x5ec0c0+'/'+_0x3b7f10)['json'](_0x53170f);}return null;};}function patchUpdates(_0x32b2c1){return function(_0x4c3f44){try{jsonpatch['apply'](_0x4c3f44,_0x32b2c1,!![]);}catch(_0x912b13){return BPromise[_0x7b4f('0x20')](_0x912b13);}return _0x4c3f44['save']();};}function saveUpdates(_0x5ed1b2,_0x3884e4){return function(_0x2fa51e){if(_0x2fa51e){return _0x2fa51e[_0x7b4f('0x21')](_0x5ed1b2)[_0x7b4f('0x22')](function(_0x54dbf8){return _0x54dbf8;});}return null;};}function removeEntity(_0x23705d,_0x21f8c3){return function(_0x48c774){if(_0x48c774){return _0x48c774[_0x7b4f('0x23')]()['then'](function(){_0x23705d[_0x7b4f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x186873,_0x879b0c){return function(_0x4e2d5a){if(!_0x4e2d5a){_0x186873[_0x7b4f('0x17')](0x194);}return _0x4e2d5a;};}function handleError(_0x20d213,_0x3f7a8c){_0x3f7a8c=_0x3f7a8c||0x1f4;return function(_0x3d398e){logger[_0x7b4f('0x24')](_0x3d398e[_0x7b4f('0x25')]);if(_0x3d398e['name']){delete _0x3d398e[_0x7b4f('0x26')];}_0x20d213[_0x7b4f('0x1d')](_0x3f7a8c)[_0x7b4f('0x27')](_0x3d398e);};}exports[_0x7b4f('0x28')]=function(_0x352ea2,_0x3040c0){var _0xc0e8c2={},_0x430648={},_0x484466={'count':0x0,'rows':[]};var _0x1b2aff=_[_0x7b4f('0x29')](db['Dynamics365Field'][_0x7b4f('0x2a')],function(_0x3f4eee){return{'name':_0x3f4eee['fieldName'],'type':_0x3f4eee['type']['key']};});_0x430648[_0x7b4f('0x2b')]=_[_0x7b4f('0x29')](_0x1b2aff,'name');_0x430648['query']=_[_0x7b4f('0x2c')](_0x352ea2[_0x7b4f('0x2d')]);_0x430648['filters']=_[_0x7b4f('0x2e')](_0x430648[_0x7b4f('0x2b')],_0x430648[_0x7b4f('0x2d')]);_0xc0e8c2['attributes']=_[_0x7b4f('0x2e')](_0x430648[_0x7b4f('0x2b')],qs[_0x7b4f('0x2f')](_0x352ea2[_0x7b4f('0x2d')][_0x7b4f('0x2f')]));_0xc0e8c2[_0x7b4f('0x30')]=_0xc0e8c2[_0x7b4f('0x30')]['length']?_0xc0e8c2[_0x7b4f('0x30')]:_0x430648[_0x7b4f('0x2b')];if(!_0x352ea2[_0x7b4f('0x2d')][_0x7b4f('0x31')](_0x7b4f('0x32'))){_0xc0e8c2[_0x7b4f('0x1b')]=qs[_0x7b4f('0x1b')](_0x352ea2[_0x7b4f('0x2d')][_0x7b4f('0x1b')]);_0xc0e8c2[_0x7b4f('0x19')]=qs[_0x7b4f('0x19')](_0x352ea2['query'][_0x7b4f('0x19')]);}_0xc0e8c2[_0x7b4f('0x33')]=qs[_0x7b4f('0x34')](_0x352ea2[_0x7b4f('0x2d')]['sort']);_0xc0e8c2[_0x7b4f('0x35')]=qs[_0x7b4f('0x36')](_['pick'](_0x352ea2[_0x7b4f('0x2d')],_0x430648[_0x7b4f('0x36')]),_0x1b2aff);if(_0x352ea2[_0x7b4f('0x2d')]['filter']){_0xc0e8c2[_0x7b4f('0x35')]=_['merge'](_0xc0e8c2[_0x7b4f('0x35')],{'$or':_[_0x7b4f('0x29')](_0x1b2aff,function(_0x3454ea){if(_0x3454ea[_0x7b4f('0x37')]!==_0x7b4f('0x38')){var _0x49af0b={};_0x49af0b[_0x3454ea[_0x7b4f('0x26')]]={'$like':'%'+_0x352ea2['query'][_0x7b4f('0x39')]+'%'};return _0x49af0b;}})});}_0xc0e8c2=_['merge']({},_0xc0e8c2,_0x352ea2[_0x7b4f('0x3a')]);var _0x421585={'where':_0xc0e8c2[_0x7b4f('0x35')]};return db['Dynamics365Field'][_0x7b4f('0x1c')](_0x421585)[_0x7b4f('0x22')](function(_0x53f2cc){_0x484466['count']=_0x53f2cc;if(_0x352ea2[_0x7b4f('0x2d')][_0x7b4f('0x3b')]){_0xc0e8c2[_0x7b4f('0x3c')]=[{'all':!![]}];}return db[_0x7b4f('0x3d')][_0x7b4f('0x3e')](_0xc0e8c2);})[_0x7b4f('0x22')](function(_0x4446c1){_0x484466[_0x7b4f('0x3f')]=_0x4446c1;return _0x484466;})[_0x7b4f('0x22')](respondWithFilteredResult(_0x3040c0,_0xc0e8c2))['catch'](handleError(_0x3040c0,null));};exports[_0x7b4f('0x40')]=function(_0x456e94,_0x54aeb1){var _0x25823c={'raw':!![],'where':{'id':_0x456e94[_0x7b4f('0x41')]['id']}},_0x2ff34c={};_0x2ff34c[_0x7b4f('0x2b')]=_[_0x7b4f('0x2c')](db[_0x7b4f('0x3d')][_0x7b4f('0x2a')]);_0x2ff34c['query']=_[_0x7b4f('0x2c')](_0x456e94['query']);_0x2ff34c[_0x7b4f('0x36')]=_[_0x7b4f('0x2e')](_0x2ff34c[_0x7b4f('0x2b')],_0x2ff34c[_0x7b4f('0x2d')]);_0x25823c[_0x7b4f('0x30')]=_['intersection'](_0x2ff34c['model'],qs[_0x7b4f('0x2f')](_0x456e94[_0x7b4f('0x2d')][_0x7b4f('0x2f')]));_0x25823c['attributes']=_0x25823c[_0x7b4f('0x30')][_0x7b4f('0x42')]?_0x25823c['attributes']:_0x2ff34c['model'];if(_0x456e94['query']['includeAll']){_0x25823c['include']=[{'all':!![]}];}_0x25823c=_[_0x7b4f('0x43')]({},_0x25823c,_0x456e94[_0x7b4f('0x3a')]);return db['Dynamics365Field'][_0x7b4f('0x44')](_0x25823c)[_0x7b4f('0x22')](handleEntityNotFound(_0x54aeb1,null))['then'](respondWithResult(_0x54aeb1,null))[_0x7b4f('0x45')](handleError(_0x54aeb1,null));};exports['create']=function(_0x4e919,_0x5a3577){return db[_0x7b4f('0x3d')][_0x7b4f('0x46')](_0x4e919['body'],{})[_0x7b4f('0x22')](respondWithResult(_0x5a3577,0xc9))['catch'](handleError(_0x5a3577,null));};exports[_0x7b4f('0x21')]=function(_0x5ba7cd,_0x5cd10d){if(_0x5ba7cd[_0x7b4f('0x47')]['id']){delete _0x5ba7cd[_0x7b4f('0x47')]['id'];}return db[_0x7b4f('0x3d')][_0x7b4f('0x44')]({'where':{'id':_0x5ba7cd[_0x7b4f('0x41')]['id']}})[_0x7b4f('0x22')](handleEntityNotFound(_0x5cd10d,null))['then'](saveUpdates(_0x5ba7cd[_0x7b4f('0x47')],null))[_0x7b4f('0x22')](respondWithResult(_0x5cd10d,null))[_0x7b4f('0x45')](handleError(_0x5cd10d,null));};exports['destroy']=function(_0x56e7ea,_0xee4983){return db[_0x7b4f('0x3d')][_0x7b4f('0x44')]({'where':{'id':_0x56e7ea[_0x7b4f('0x41')]['id']}})[_0x7b4f('0x22')](handleEntityNotFound(_0xee4983,null))[_0x7b4f('0x22')](removeEntity(_0xee4983,null))[_0x7b4f('0x45')](handleError(_0xee4983,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index e141c35..3e0e8f9 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 _0x4fa4=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','define','int_dynamics365_fields','idField','FieldId'];(function(_0x5e2074,_0x3dba34){var _0x2582f1=function(_0x26119b){while(--_0x26119b){_0x5e2074['push'](_0x5e2074['shift']());}};_0x2582f1(++_0x3dba34);}(_0x4fa4,0x82));var _0x44fa=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x4fa4[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x44fa('0x0'));var util=require(_0x44fa('0x1'));var logger=require('../../config/logger')(_0x44fa('0x2'));var moment=require(_0x44fa('0x3'));var BPromise=require(_0x44fa('0x4'));var rp=require(_0x44fa('0x5'));var fs=require('fs');var path=require(_0x44fa('0x6'));var rimraf=require(_0x44fa('0x7'));var config=require('../../config/environment');var attributes=require(_0x44fa('0x8'));module['exports']=function(_0x4561f2,_0x4fe9e1){return _0x4561f2[_0x44fa('0x9')]('Dynamics365Field',attributes,{'tableName':_0x44fa('0xa'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x44fa('0xb'),_0x44fa('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7943=['moment','request-promise','../../config/environment','exports','define','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','../../config/logger','api'];(function(_0x3147ad,_0xf3f715){var _0x3f05c7=function(_0xb1f093){while(--_0xb1f093){_0x3147ad['push'](_0x3147ad['shift']());}};_0x3f05c7(++_0xf3f715);}(_0x7943,0x141));var _0x3794=function(_0x14c7a4,_0x3ccea5){_0x14c7a4=_0x14c7a4-0x0;var _0x557573=_0x7943[_0x14c7a4];return _0x557573;};'use strict';var _=require(_0x3794('0x0'));var util=require('util');var logger=require(_0x3794('0x1'))(_0x3794('0x2'));var moment=require(_0x3794('0x3'));var BPromise=require('bluebird');var rp=require(_0x3794('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3794('0x5'));var attributes=require('./intDynamics365Field.attributes');module[_0x3794('0x6')]=function(_0x3c96be,_0x91993b){return _0x3c96be[_0x3794('0x7')](_0x3794('0x8'),attributes,{'tableName':_0x3794('0x9'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x3794('0xa'),_0x3794('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 605aa99..3b21d06 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 _0xb18e=['request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Field,\x20%s,\x20%s'];(function(_0x5ef29d,_0x413b10){var _0x5195d8=function(_0x3843d9){while(--_0x3843d9){_0x5ef29d['push'](_0x5ef29d['shift']());}};_0x5195d8(++_0x413b10);}(_0xb18e,0x1bf));var _0xeb18=function(_0xcaf223,_0xd39f07){_0xcaf223=_0xcaf223-0x0;var _0x17e00d=_0xb18e[_0xcaf223];return _0x17e00d;};'use strict';var _=require(_0xeb18('0x0'));var util=require(_0xeb18('0x1'));var moment=require(_0xeb18('0x2'));var BPromise=require(_0xeb18('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb18('0x4'));var db=require(_0xeb18('0x5'))['db'];var utils=require(_0xeb18('0x6'));var logger=require(_0xeb18('0x7'))('rpc');var config=require(_0xeb18('0x8'));var jayson=require(_0xeb18('0x9'));var client=jayson[_0xeb18('0xa')][_0xeb18('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51d0c0,_0xad3ff,_0x4dc205){return new BPromise(function(_0x52cacc,_0x194d95){return client[_0xeb18('0xc')](_0x51d0c0,_0x4dc205)['then'](function(_0x101f0a){logger[_0xeb18('0xd')](_0xeb18('0xe'),_0xad3ff,_0xeb18('0xf'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0xad3ff,_0xeb18('0xf'),JSON[_0xeb18('0x10')](_0x101f0a));if(_0x101f0a['error']){if(_0x101f0a[_0xeb18('0x11')][_0xeb18('0x12')]===0x1f4){logger[_0xeb18('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0xad3ff,_0x101f0a[_0xeb18('0x11')][_0xeb18('0x13')]);return _0x194d95(_0x101f0a[_0xeb18('0x11')][_0xeb18('0x13')]);}logger[_0xeb18('0x11')](_0xeb18('0xe'),_0xad3ff,_0x101f0a[_0xeb18('0x11')][_0xeb18('0x13')]);return _0x52cacc(_0x101f0a[_0xeb18('0x11')]['message']);}else{logger[_0xeb18('0xd')](_0xeb18('0xe'),_0xad3ff,_0xeb18('0xf'));_0x52cacc(_0x101f0a['result'][_0xeb18('0x13')]);}})[_0xeb18('0x14')](function(_0x2910fb){logger['error'](_0xeb18('0xe'),_0xad3ff,_0x2910fb);_0x194d95(_0x2910fb);});});} \ No newline at end of file +var _0xc7f5=['Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4c4d01,_0x375273){var _0x13cd8d=function(_0x263f64){while(--_0x263f64){_0x4c4d01['push'](_0x4c4d01['shift']());}};_0x13cd8d(++_0x375273);}(_0xc7f5,0xa8));var _0x5c7f=function(_0x281cbf,_0x21d4f7){_0x281cbf=_0x281cbf-0x0;var _0x24470e=_0xc7f5[_0x281cbf];return _0x24470e;};'use strict';var _=require(_0x5c7f('0x0'));var util=require(_0x5c7f('0x1'));var moment=require(_0x5c7f('0x2'));var BPromise=require(_0x5c7f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c7f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5c7f('0x5'));var logger=require(_0x5c7f('0x6'))(_0x5c7f('0x7'));var config=require(_0x5c7f('0x8'));var jayson=require(_0x5c7f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f7bba,_0x40df5f,_0x2eca62){return new BPromise(function(_0x33b2a0,_0x405e5b){return client[_0x5c7f('0xa')](_0x1f7bba,_0x2eca62)[_0x5c7f('0xb')](function(_0x20e238){logger[_0x5c7f('0xc')](_0x5c7f('0xd'),_0x40df5f,_0x5c7f('0xe'));logger[_0x5c7f('0xf')](_0x5c7f('0x10'),_0x40df5f,'request\x20sent',JSON[_0x5c7f('0x11')](_0x20e238));if(_0x20e238['error']){if(_0x20e238['error'][_0x5c7f('0x12')]===0x1f4){logger[_0x5c7f('0x13')](_0x5c7f('0xd'),_0x40df5f,_0x20e238[_0x5c7f('0x13')][_0x5c7f('0x14')]);return _0x405e5b(_0x20e238[_0x5c7f('0x13')][_0x5c7f('0x14')]);}logger['error'](_0x5c7f('0xd'),_0x40df5f,_0x20e238[_0x5c7f('0x13')][_0x5c7f('0x14')]);return _0x33b2a0(_0x20e238['error'][_0x5c7f('0x14')]);}else{logger[_0x5c7f('0xc')](_0x5c7f('0xd'),_0x40df5f,'request\x20sent');_0x33b2a0(_0x20e238[_0x5c7f('0x15')][_0x5c7f('0x14')]);}})[_0x5c7f('0x16')](function(_0x248485){logger[_0x5c7f('0x13')](_0x5c7f('0xd'),_0x40df5f,_0x248485);_0x405e5b(_0x248485);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 0e60629..7ccc163 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 _0x28dd=['addConfiguration','put','update','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x2d3577,_0x1cb7e9){var _0x1e77f8=function(_0x9e44b3){while(--_0x9e44b3){_0x2d3577['push'](_0x2d3577['shift']());}};_0x1e77f8(++_0x1cb7e9);}(_0x28dd,0x10d));var _0xd28d=function(_0xa81926,_0x38e368){_0xa81926=_0xa81926-0x0;var _0x8177ef=_0x28dd[_0xa81926];return _0x8177ef;};'use strict';var multer=require('multer');var util=require(_0xd28d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd28d('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xd28d('0x2'));var interaction=require(_0xd28d('0x3'));var config=require(_0xd28d('0x4'));var controller=require(_0xd28d('0x5'));router['get']('/',auth[_0xd28d('0x6')](),controller[_0xd28d('0x7')]);router[_0xd28d('0x8')](_0xd28d('0x9'),auth[_0xd28d('0x6')](),controller[_0xd28d('0xa')]);router[_0xd28d('0x8')](_0xd28d('0xb'),auth['isAuthenticated'](),controller[_0xd28d('0xc')]);router['get'](_0xd28d('0xd'),auth[_0xd28d('0x6')](),controller[_0xd28d('0xe')]);router[_0xd28d('0xf')]('/',auth['isAuthenticated'](),controller[_0xd28d('0x10')]);router[_0xd28d('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xd28d('0x11')]);router[_0xd28d('0x12')](_0xd28d('0x9'),auth[_0xd28d('0x6')](),controller[_0xd28d('0x13')]);router['delete'](_0xd28d('0x9'),auth['isAuthenticated'](),controller[_0xd28d('0x14')]);module[_0xd28d('0x15')]=router; \ No newline at end of file +var _0xe73b=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated'];(function(_0xa3b67b,_0x336854){var _0x28c31b=function(_0x47810b){while(--_0x47810b){_0xa3b67b['push'](_0xa3b67b['shift']());}};_0x28c31b(++_0x336854);}(_0xe73b,0x16b));var _0xbe73=function(_0x1809c5,_0x46cabc){_0x1809c5=_0x1809c5-0x0;var _0x5254a4=_0xe73b[_0x1809c5];return _0x5254a4;};'use strict';var multer=require(_0xbe73('0x0'));var util=require(_0xbe73('0x1'));var path=require(_0xbe73('0x2'));var timeout=require(_0xbe73('0x3'));var express=require(_0xbe73('0x4'));var router=express[_0xbe73('0x5')]();var fs_extra=require(_0xbe73('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbe73('0x7'));var controller=require(_0xbe73('0x8'));router[_0xbe73('0x9')]('/',auth[_0xbe73('0xa')](),controller['index']);router['get'](_0xbe73('0xb'),auth['isAuthenticated'](),controller[_0xbe73('0xc')]);router[_0xbe73('0x9')](_0xbe73('0xd'),auth['isAuthenticated'](),controller[_0xbe73('0xe')]);router['get'](_0xbe73('0xf'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0xbe73('0xa')](),controller['create']);router[_0xbe73('0x10')](_0xbe73('0xd'),auth['isAuthenticated'](),controller[_0xbe73('0x11')]);router[_0xbe73('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xbe73('0x13')]);router[_0xbe73('0x14')](_0xbe73('0xb'),auth[_0xbe73('0xa')](),controller['destroy']);module[_0xbe73('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 6dbc2cd..854833a 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 _0x33af=['exports','STRING','username','remoteUri'];(function(_0x27a7a9,_0x2fd92a){var _0x1c2889=function(_0x3a79fb){while(--_0x3a79fb){_0x27a7a9['push'](_0x27a7a9['shift']());}};_0x1c2889(++_0x2fd92a);}(_0x33af,0xec));var _0xf33a=function(_0x27f9be,_0x268da6){_0x27f9be=_0x27f9be-0x0;var _0x3783a6=_0x33af[_0x27f9be];return _0x3783a6;};'use strict';var Sequelize=require('sequelize');module[_0xf33a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf33a('0x1')]},'username':{'type':Sequelize[_0xf33a('0x1')],'unique':_0xf33a('0x2')},'apiKey':{'type':Sequelize[_0xf33a('0x1')]},'remoteUri':{'type':Sequelize[_0xf33a('0x1')],'unique':_0xf33a('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x7916=['sequelize','STRING','username','remoteUri'];(function(_0x33dea9,_0x2a4a75){var _0x359aad=function(_0x76a9f0){while(--_0x76a9f0){_0x33dea9['push'](_0x33dea9['shift']());}};_0x359aad(++_0x2a4a75);}(_0x7916,0x128));var _0x6791=function(_0x4d417e,_0x3f0f60){_0x4d417e=_0x4d417e-0x0;var _0x34fb1d=_0x7916[_0x4d417e];return _0x34fb1d;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'name':{'type':Sequelize[_0x6791('0x1')]},'description':{'type':Sequelize[_0x6791('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6791('0x2')},'apiKey':{'type':Sequelize[_0x6791('0x1')]},'remoteUri':{'type':Sequelize[_0x6791('0x1')],'unique':_0x6791('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 717ffc7..f786570 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 _0x0269=['name','send','index','map','FreshdeskAccount','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','rawAttributes','include','create','update','body','find','params','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','channel','Descriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','subject','agent','description','priority','group','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','set','apply','reject','save','then','destroy','end','sendStatus','error','stack'];(function(_0x59cf53,_0x43f870){var _0x54ccbb=function(_0x2a60bc){while(--_0x2a60bc){_0x59cf53['push'](_0x59cf53['shift']());}};_0x54ccbb(++_0x43f870);}(_0x0269,0x135));var _0x9026=function(_0xe70d73,_0x34fa3b){_0xe70d73=_0xe70d73-0x0;var _0xd60fa1=_0x0269[_0xe70d73];return _0xd60fa1;};'use strict';var emlformat=require(_0x9026('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9026('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9026('0x2'));var moment=require('moment');var BPromise=require(_0x9026('0x3'));var Mustache=require(_0x9026('0x4'));var util=require(_0x9026('0x5'));var path=require(_0x9026('0x6'));var sox=require('sox');var csv=require(_0x9026('0x7'));var ejs=require(_0x9026('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9026('0x9'));var crypto=require(_0x9026('0xa'));var jsforce=require(_0x9026('0xb'));var deskjs=require(_0x9026('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9026('0xd'));var Papa=require(_0x9026('0xe'));var Redis=require(_0x9026('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9026('0x10'));var as=require(_0x9026('0x11'));var hardwareService=require(_0x9026('0x12'));var logger=require('../../config/logger')(_0x9026('0x13'));var utils=require('../../config/utils');var config=require(_0x9026('0x14'));var licenseUtil=require(_0x9026('0x15'));var db=require(_0x9026('0x16'))['db'];var integrations=require(_0x9026('0x17'));function respondWithStatusCode(_0x40f526,_0x40b5dd){_0x40b5dd=_0x40b5dd||0xcc;return function(_0x363892){if(_0x363892){return _0x40f526['sendStatus'](_0x40b5dd);}return _0x40f526[_0x9026('0x18')](_0x40b5dd)['end']();};}function respondWithResult(_0x385afc,_0x2612cd){_0x2612cd=_0x2612cd||0xc8;return function(_0xd2473f){if(_0xd2473f){return _0x385afc[_0x9026('0x18')](_0x2612cd)[_0x9026('0x19')](_0xd2473f);}};}function respondWithFilteredResult(_0x421ee2,_0x142465){return function(_0x1eb679){if(_0x1eb679){var _0x5d5053=typeof _0x142465[_0x9026('0x1a')]===_0x9026('0x1b')&&typeof _0x142465['limit']===_0x9026('0x1b');var _0x118ac9=_0x1eb679[_0x9026('0x1c')];var _0x4e37d0=_0x5d5053?0x0:_0x142465[_0x9026('0x1a')];var _0x3e57f7=_0x5d5053?_0x1eb679[_0x9026('0x1c')]:_0x142465[_0x9026('0x1a')]+_0x142465['limit'];var _0x7985;if(_0x3e57f7>=_0x118ac9){_0x3e57f7=_0x118ac9;_0x7985=0xc8;}else{_0x7985=0xce;}_0x421ee2['status'](_0x7985);return _0x421ee2[_0x9026('0x1d')]('Content-Range',_0x4e37d0+'-'+_0x3e57f7+'/'+_0x118ac9)[_0x9026('0x19')](_0x1eb679);}return null;};}function patchUpdates(_0x1b03af){return function(_0x2d782f){try{jsonpatch[_0x9026('0x1e')](_0x2d782f,_0x1b03af,!![]);}catch(_0xdce1d6){return BPromise[_0x9026('0x1f')](_0xdce1d6);}return _0x2d782f[_0x9026('0x20')]();};}function saveUpdates(_0x39f515,_0x12e0b3){return function(_0x4d01d4){if(_0x4d01d4){return _0x4d01d4['update'](_0x39f515)[_0x9026('0x21')](function(_0x134221){return _0x134221;});}return null;};}function removeEntity(_0x2968fb,_0x82a8e0){return function(_0x18279b){if(_0x18279b){return _0x18279b[_0x9026('0x22')]()[_0x9026('0x21')](function(){_0x2968fb[_0x9026('0x18')](0xcc)[_0x9026('0x23')]();});}};}function handleEntityNotFound(_0x4293df,_0xde5c83){return function(_0x106de3){if(!_0x106de3){_0x4293df[_0x9026('0x24')](0x194);}return _0x106de3;};}function handleError(_0x2ace13,_0x28dba4){_0x28dba4=_0x28dba4||0x1f4;return function(_0x56c5ca){logger[_0x9026('0x25')](_0x56c5ca[_0x9026('0x26')]);if(_0x56c5ca[_0x9026('0x27')]){delete _0x56c5ca['name'];}_0x2ace13[_0x9026('0x18')](_0x28dba4)[_0x9026('0x28')](_0x56c5ca);};}exports[_0x9026('0x29')]=function(_0x103ce7,_0x17dc25){var _0x3cead8={},_0x23cf05={},_0xedb8bb={'count':0x0,'rows':[]};var _0x2b2f4c=_[_0x9026('0x2a')](db[_0x9026('0x2b')]['rawAttributes'],function(_0x1cf21f){return{'name':_0x1cf21f[_0x9026('0x2c')],'type':_0x1cf21f[_0x9026('0x2d')][_0x9026('0x2e')]};});_0x23cf05[_0x9026('0x2f')]=_[_0x9026('0x2a')](_0x2b2f4c,_0x9026('0x27'));_0x23cf05['query']=_[_0x9026('0x30')](_0x103ce7['query']);_0x23cf05[_0x9026('0x31')]=_[_0x9026('0x32')](_0x23cf05[_0x9026('0x2f')],_0x23cf05[_0x9026('0x33')]);_0x3cead8[_0x9026('0x34')]=_[_0x9026('0x32')](_0x23cf05['model'],qs[_0x9026('0x35')](_0x103ce7[_0x9026('0x33')][_0x9026('0x35')]));_0x3cead8[_0x9026('0x34')]=_0x3cead8['attributes'][_0x9026('0x36')]?_0x3cead8[_0x9026('0x34')]:_0x23cf05['model'];if(!_0x103ce7[_0x9026('0x33')][_0x9026('0x37')](_0x9026('0x38'))){_0x3cead8[_0x9026('0x39')]=qs[_0x9026('0x39')](_0x103ce7[_0x9026('0x33')][_0x9026('0x39')]);_0x3cead8[_0x9026('0x1a')]=qs['offset'](_0x103ce7[_0x9026('0x33')][_0x9026('0x1a')]);}_0x3cead8['order']=qs[_0x9026('0x3a')](_0x103ce7[_0x9026('0x33')][_0x9026('0x3a')]);_0x3cead8[_0x9026('0x3b')]=qs[_0x9026('0x31')](_[_0x9026('0x3c')](_0x103ce7[_0x9026('0x33')],_0x23cf05[_0x9026('0x31')]),_0x2b2f4c);if(_0x103ce7['query'][_0x9026('0x3d')]){_0x3cead8[_0x9026('0x3b')]=_[_0x9026('0x3e')](_0x3cead8[_0x9026('0x3b')],{'$or':_[_0x9026('0x2a')](_0x2b2f4c,function(_0x1c2e08){if(_0x1c2e08[_0x9026('0x2d')]!=='VIRTUAL'){var _0x20d1fe={};_0x20d1fe[_0x1c2e08['name']]={'$like':'%'+_0x103ce7[_0x9026('0x33')][_0x9026('0x3d')]+'%'};return _0x20d1fe;}})});}_0x3cead8=_[_0x9026('0x3e')]({},_0x3cead8,_0x103ce7[_0x9026('0x3f')]);var _0x51d7f5={'where':_0x3cead8['where']};return db[_0x9026('0x2b')][_0x9026('0x1c')](_0x51d7f5)['then'](function(_0x5a66c5){_0xedb8bb['count']=_0x5a66c5;if(_0x103ce7[_0x9026('0x33')][_0x9026('0x40')]){_0x3cead8['include']=[{'all':!![]}];}return db[_0x9026('0x2b')][_0x9026('0x41')](_0x3cead8);})[_0x9026('0x21')](function(_0x475c22){_0xedb8bb[_0x9026('0x42')]=_0x475c22;return _0xedb8bb;})[_0x9026('0x21')](respondWithFilteredResult(_0x17dc25,_0x3cead8))[_0x9026('0x43')](handleError(_0x17dc25,null));};exports[_0x9026('0x44')]=function(_0x5e18cf,_0x2d6801){var _0x2ece36={'raw':![],'where':{'id':_0x5e18cf['params']['id']}},_0x559732={};_0x559732['model']=_[_0x9026('0x30')](db[_0x9026('0x2b')][_0x9026('0x45')]);_0x559732[_0x9026('0x33')]=_[_0x9026('0x30')](_0x5e18cf['query']);_0x559732[_0x9026('0x31')]=_['intersection'](_0x559732[_0x9026('0x2f')],_0x559732[_0x9026('0x33')]);_0x2ece36[_0x9026('0x34')]=_[_0x9026('0x32')](_0x559732['model'],qs['fields'](_0x5e18cf[_0x9026('0x33')][_0x9026('0x35')]));_0x2ece36[_0x9026('0x34')]=_0x2ece36[_0x9026('0x34')][_0x9026('0x36')]?_0x2ece36[_0x9026('0x34')]:_0x559732['model'];if(_0x5e18cf[_0x9026('0x33')]['includeAll']){_0x2ece36[_0x9026('0x46')]=[{'all':!![]}];}_0x2ece36=_[_0x9026('0x3e')]({},_0x2ece36,_0x5e18cf['options']);return db[_0x9026('0x2b')]['find'](_0x2ece36)[_0x9026('0x21')](handleEntityNotFound(_0x2d6801,null))['then'](respondWithResult(_0x2d6801,null))[_0x9026('0x43')](handleError(_0x2d6801,null));};exports['create']=function(_0x530244,_0x2e988d){return db[_0x9026('0x2b')][_0x9026('0x47')](_0x530244['body'],{})[_0x9026('0x21')](respondWithResult(_0x2e988d,0xc9))[_0x9026('0x43')](handleError(_0x2e988d,null));};exports[_0x9026('0x48')]=function(_0x442e5a,_0x3636c7){if(_0x442e5a['body']['id']){delete _0x442e5a[_0x9026('0x49')]['id'];}return db[_0x9026('0x2b')][_0x9026('0x4a')]({'where':{'id':_0x442e5a[_0x9026('0x4b')]['id']}})[_0x9026('0x21')](handleEntityNotFound(_0x3636c7,null))[_0x9026('0x21')](saveUpdates(_0x442e5a['body'],null))[_0x9026('0x21')](respondWithResult(_0x3636c7,null))['catch'](handleError(_0x3636c7,null));};exports[_0x9026('0x22')]=function(_0xf0a02e,_0x50d424){return db[_0x9026('0x2b')][_0x9026('0x4a')]({'where':{'id':_0xf0a02e[_0x9026('0x4b')]['id']}})[_0x9026('0x21')](handleEntityNotFound(_0x50d424,null))[_0x9026('0x21')](removeEntity(_0x50d424,null))[_0x9026('0x43')](handleError(_0x50d424,null));};exports[_0x9026('0x4c')]=function(_0x3c338e,_0x140925,_0x3d5add){var _0x5af878={};var _0x207ab6={};var _0x24aa21;var _0x4ad73e;return db[_0x9026('0x2b')][_0x9026('0x4d')]({'where':{'id':_0x3c338e[_0x9026('0x4b')]['id']}})[_0x9026('0x21')](handleEntityNotFound(_0x140925,null))[_0x9026('0x21')](function(_0x30591f){if(_0x30591f){_0x24aa21=_0x30591f;_0x207ab6['model']=_[_0x9026('0x30')](db['FreshdeskConfiguration'][_0x9026('0x45')]);_0x207ab6[_0x9026('0x33')]=_[_0x9026('0x30')](_0x3c338e['query']);_0x207ab6['filters']=_[_0x9026('0x32')](_0x207ab6[_0x9026('0x2f')],_0x207ab6[_0x9026('0x33')]);_0x5af878[_0x9026('0x34')]=_[_0x9026('0x32')](_0x207ab6[_0x9026('0x2f')],qs[_0x9026('0x35')](_0x3c338e[_0x9026('0x33')][_0x9026('0x35')]));_0x5af878[_0x9026('0x34')]=_0x5af878['attributes']['length']?_0x5af878[_0x9026('0x34')]:_0x207ab6[_0x9026('0x2f')];_0x5af878[_0x9026('0x4e')]=qs[_0x9026('0x3a')](_0x3c338e[_0x9026('0x33')][_0x9026('0x3a')]);_0x5af878[_0x9026('0x3b')]=qs['filters'](_[_0x9026('0x3c')](_0x3c338e['query'],_0x207ab6[_0x9026('0x31')]));if(_0x3c338e[_0x9026('0x33')]['filter']){_0x5af878[_0x9026('0x3b')]=_[_0x9026('0x3e')](_0x5af878[_0x9026('0x3b')],{'$or':_[_0x9026('0x2a')](_0x5af878['attributes'],function(_0x3a1b5e){var _0x1cffb4={};_0x1cffb4[_0x3a1b5e]={'$like':'%'+_0x3c338e['query']['filter']+'%'};return _0x1cffb4;})});}_0x5af878=_[_0x9026('0x3e')]({},_0x5af878,_0x3c338e['options']);return _0x24aa21[_0x9026('0x4c')](_0x5af878);}})[_0x9026('0x21')](function(_0x496301){if(_0x496301){_0x4ad73e=_0x496301[_0x9026('0x36')];if(!_0x3c338e[_0x9026('0x33')][_0x9026('0x37')](_0x9026('0x38'))){_0x5af878[_0x9026('0x39')]=qs[_0x9026('0x39')](_0x3c338e[_0x9026('0x33')][_0x9026('0x39')]);_0x5af878['offset']=qs[_0x9026('0x1a')](_0x3c338e[_0x9026('0x33')][_0x9026('0x1a')]);}return _0x24aa21[_0x9026('0x4c')](_0x5af878);}})[_0x9026('0x21')](function(_0x46cab9){if(_0x46cab9){return _0x46cab9?{'count':_0x4ad73e,'rows':_0x46cab9}:null;}})[_0x9026('0x21')](respondWithResult(_0x140925,null))[_0x9026('0x43')](handleError(_0x140925,null));};exports[_0x9026('0x4f')]=function(_0x31f06f,_0x4bbe90,_0x23c380){if(_0x31f06f['body']['id']){delete _0x31f06f['body']['id'];}return db[_0x9026('0x2b')][_0x9026('0x4d')]({'where':{'id':_0x31f06f[_0x9026('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4bbe90,null))[_0x9026('0x21')](function(_0x56837e){if(_0x56837e){_0x31f06f[_0x9026('0x49')][_0x9026('0x50')]=_0x56837e['id'];_0x31f06f['body'][_0x9026('0x51')]=integrations['getSubjects'](_0x31f06f[_0x9026('0x49')][_0x9026('0x52')],_0x31f06f[_0x9026('0x49')][_0x9026('0x2d')]);_0x31f06f[_0x9026('0x49')][_0x9026('0x53')]=integrations['getDescriptions'](_0x31f06f['body'][_0x9026('0x52')],_0x31f06f[_0x9026('0x49')][_0x9026('0x2d')]);return db[_0x9026('0x54')][_0x9026('0x47')](_0x31f06f[_0x9026('0x49')],{'include':[{'model':db['FreshdeskField'],'as':_0x9026('0x51')},{'model':db[_0x9026('0x55')],'as':_0x9026('0x53')}]});}return null;})['then'](respondWithResult(_0x4bbe90,null))[_0x9026('0x43')](handleError(_0x4bbe90,null));};exports[_0x9026('0x56')]=function(_0x288140,_0x2e1e72,_0x19de68){var _0x208753='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x288140[_0x9026('0x4b')]['id']},'attributes':['id',_0x9026('0x57'),_0x9026('0x58')]})['then'](handleEntityNotFound(_0x2e1e72,null))[_0x9026('0x21')](function(_0x4d4e41){if(_0x4d4e41){_0x208753=_0x4d4e41[_0x9026('0x57')];var _0x12fac5=_0x208753[_0x9026('0x59')](-0x1);if(_0x12fac5==='/'){_0x208753=_0x208753[_0x9026('0x5a')](0x0,_0x208753[_0x9026('0x5b')](_0x12fac5));}return rp({'method':'GET','uri':util[_0x9026('0x5c')](_0x9026('0x5d'),_0x208753,_0x9026('0x5e')),'headers':{'Authorization':util[_0x9026('0x5c')](_0x9026('0x5f'),new Buffer(util['format'](_0x9026('0x60'),_0x4d4e41['apiKey']))[_0x9026('0x61')]('base64'))},'json':!![]});}})['then'](function(_0x1b97a0){if(_0x1b97a0){var _0x4b3e0e=[_0x9026('0x62'),_0x9026('0x63'),_0x9026('0x64'),_0x9026('0x65'),_0x9026('0x18'),_0x9026('0x66'),_0x9026('0x67'),'source','ticket_type',_0x9026('0x67'),_0x9026('0x68')];_[_0x9026('0x69')](_0x1b97a0,function(_0x53c535){return _0x4b3e0e[_0x9026('0x6a')](_0x53c535[_0x9026('0x27')])||!_0x53c535[_0x9026('0x6b')]&&_0x53c535['type']!==_0x9026('0x6c')&&_0x53c535[_0x9026('0x2d')]!==_0x9026('0x6d');});return{'count':_0x1b97a0[_0x9026('0x36')],'rows':_[_0x9026('0x2a')](_0x1b97a0,function(_0x18813e){return{'id':_0x18813e['name'],'name':_0x18813e[_0x9026('0x6e')],'custom':!_0x18813e['default'],'options':_0x18813e[_0x9026('0x6f')]?_['map'](_0x18813e[_0x9026('0x6f')],function(_0x374e53){return{'name':_[_0x9026('0x70')](_0x374e53),'value':_0x374e53};}):[]};})};}})[_0x9026('0x21')](respondWithResult(_0x2e1e72,null))[_0x9026('0x43')](function(_0xe448d8){var _0x1db48f=_0x288140[_0x9026('0x33')][_0x9026('0x71')]?0x1f4:_0xe448d8[_0x9026('0x72')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1db48f,JSON['stringify'](_0xe448d8));delete _0xe448d8['name'];if(_0x1db48f===0x191){_0x1db48f=0x190;}_0x2e1e72[_0x9026('0x18')](_0x1db48f)[_0x9026('0x28')](_0x288140[_0x9026('0x33')][_0x9026('0x71')]?{'message':_0x9026('0x73'),'statusCode':_0xe448d8['statusCode']}:_0xe448d8);});}; \ No newline at end of file +var _0xc17f=['save','update','destroy','then','sendStatus','error','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','options','find','create','body','FreshdeskConfiguration','nolimit','getConfigurations','findOne','Subjects','getSubjects','Descriptions','getDescriptions','getFields','apiKey','remoteUri','substring','lastIndexOf','GET','format','api/v2/ticket_fields','%s:X','toString','base64','description','source','ticket_type','group','company','includes','custom_dropdown','label','default','choices','capitalize','statusCode','stringify','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x13c5e6,_0x53520a){var _0x17fce7=function(_0x398e5a){while(--_0x398e5a){_0x13c5e6['push'](_0x13c5e6['shift']());}};_0x17fce7(++_0x53520a);}(_0xc17f,0xb8));var _0xfc17=function(_0x14c39f,_0x47f7b4){_0x14c39f=_0x14c39f-0x0;var _0x2c4bfd=_0xc17f[_0x14c39f];return _0x2c4bfd;};'use strict';var emlformat=require(_0xfc17('0x0'));var rimraf=require(_0xfc17('0x1'));var zipdir=require(_0xfc17('0x2'));var jsonpatch=require(_0xfc17('0x3'));var rp=require(_0xfc17('0x4'));var moment=require(_0xfc17('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfc17('0x6'));var util=require(_0xfc17('0x7'));var path=require(_0xfc17('0x8'));var sox=require(_0xfc17('0x9'));var csv=require('to-csv');var ejs=require(_0xfc17('0xa'));var fs=require('fs');var fs_extra=require(_0xfc17('0xb'));var _=require(_0xfc17('0xc'));var squel=require(_0xfc17('0xd'));var crypto=require(_0xfc17('0xe'));var jsforce=require(_0xfc17('0xf'));var deskjs=require(_0xfc17('0x10'));var toCsv=require(_0xfc17('0x11'));var querystring=require('querystring');var Papa=require(_0xfc17('0x12'));var Redis=require(_0xfc17('0x13'));var authService=require(_0xfc17('0x14'));var qs=require(_0xfc17('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc17('0x16'))(_0xfc17('0x17'));var utils=require(_0xfc17('0x18'));var config=require(_0xfc17('0x19'));var licenseUtil=require(_0xfc17('0x1a'));var db=require(_0xfc17('0x1b'))['db'];var integrations=require(_0xfc17('0x1c'));function respondWithStatusCode(_0x133c4c,_0x115411){_0x115411=_0x115411||0xcc;return function(_0x1f0c64){if(_0x1f0c64){return _0x133c4c['sendStatus'](_0x115411);}return _0x133c4c[_0xfc17('0x1d')](_0x115411)[_0xfc17('0x1e')]();};}function respondWithResult(_0x29c8e9,_0x47e84a){_0x47e84a=_0x47e84a||0xc8;return function(_0x16e49b){if(_0x16e49b){return _0x29c8e9[_0xfc17('0x1d')](_0x47e84a)[_0xfc17('0x1f')](_0x16e49b);}};}function respondWithFilteredResult(_0x25d5fe,_0x313d98){return function(_0x11c259){if(_0x11c259){var _0x773e25=typeof _0x313d98[_0xfc17('0x20')]===_0xfc17('0x21')&&typeof _0x313d98[_0xfc17('0x22')]===_0xfc17('0x21');var _0x4168ab=_0x11c259[_0xfc17('0x23')];var _0x5b2c7c=_0x773e25?0x0:_0x313d98['offset'];var _0x2aa3a2=_0x773e25?_0x11c259[_0xfc17('0x23')]:_0x313d98[_0xfc17('0x20')]+_0x313d98[_0xfc17('0x22')];var _0x5b23e8;if(_0x2aa3a2>=_0x4168ab){_0x2aa3a2=_0x4168ab;_0x5b23e8=0xc8;}else{_0x5b23e8=0xce;}_0x25d5fe[_0xfc17('0x1d')](_0x5b23e8);return _0x25d5fe[_0xfc17('0x24')](_0xfc17('0x25'),_0x5b2c7c+'-'+_0x2aa3a2+'/'+_0x4168ab)['json'](_0x11c259);}return null;};}function patchUpdates(_0x2614de){return function(_0x1010af){try{jsonpatch[_0xfc17('0x26')](_0x1010af,_0x2614de,!![]);}catch(_0x2364f8){return BPromise[_0xfc17('0x27')](_0x2364f8);}return _0x1010af[_0xfc17('0x28')]();};}function saveUpdates(_0x223fab,_0x4593d0){return function(_0x3f91a5){if(_0x3f91a5){return _0x3f91a5[_0xfc17('0x29')](_0x223fab)['then'](function(_0x37c847){return _0x37c847;});}return null;};}function removeEntity(_0x2285df,_0x10a81f){return function(_0x163c3b){if(_0x163c3b){return _0x163c3b[_0xfc17('0x2a')]()[_0xfc17('0x2b')](function(){_0x2285df['status'](0xcc)[_0xfc17('0x1e')]();});}};}function handleEntityNotFound(_0x2cfd87,_0x480bdd){return function(_0x358f48){if(!_0x358f48){_0x2cfd87[_0xfc17('0x2c')](0x194);}return _0x358f48;};}function handleError(_0x4b1038,_0x4e4cf5){_0x4e4cf5=_0x4e4cf5||0x1f4;return function(_0xd0144c){logger[_0xfc17('0x2d')](_0xd0144c['stack']);if(_0xd0144c[_0xfc17('0x2e')]){delete _0xd0144c[_0xfc17('0x2e')];}_0x4b1038['status'](_0x4e4cf5)[_0xfc17('0x2f')](_0xd0144c);};}exports[_0xfc17('0x30')]=function(_0x5ce54b,_0x28f08a){var _0xfbd493={},_0x534c6c={},_0x4f8a87={'count':0x0,'rows':[]};var _0x970783=_[_0xfc17('0x31')](db[_0xfc17('0x32')][_0xfc17('0x33')],function(_0x3e5da3){return{'name':_0x3e5da3[_0xfc17('0x34')],'type':_0x3e5da3[_0xfc17('0x35')][_0xfc17('0x36')]};});_0x534c6c[_0xfc17('0x37')]=_['map'](_0x970783,_0xfc17('0x2e'));_0x534c6c[_0xfc17('0x38')]=_[_0xfc17('0x39')](_0x5ce54b['query']);_0x534c6c[_0xfc17('0x3a')]=_['intersection'](_0x534c6c[_0xfc17('0x37')],_0x534c6c[_0xfc17('0x38')]);_0xfbd493[_0xfc17('0x3b')]=_[_0xfc17('0x3c')](_0x534c6c['model'],qs[_0xfc17('0x3d')](_0x5ce54b[_0xfc17('0x38')]['fields']));_0xfbd493['attributes']=_0xfbd493['attributes'][_0xfc17('0x3e')]?_0xfbd493[_0xfc17('0x3b')]:_0x534c6c[_0xfc17('0x37')];if(!_0x5ce54b[_0xfc17('0x38')][_0xfc17('0x3f')]('nolimit')){_0xfbd493[_0xfc17('0x22')]=qs[_0xfc17('0x22')](_0x5ce54b['query'][_0xfc17('0x22')]);_0xfbd493[_0xfc17('0x20')]=qs['offset'](_0x5ce54b['query'][_0xfc17('0x20')]);}_0xfbd493['order']=qs[_0xfc17('0x40')](_0x5ce54b['query']['sort']);_0xfbd493[_0xfc17('0x41')]=qs[_0xfc17('0x3a')](_[_0xfc17('0x42')](_0x5ce54b[_0xfc17('0x38')],_0x534c6c[_0xfc17('0x3a')]),_0x970783);if(_0x5ce54b[_0xfc17('0x38')][_0xfc17('0x43')]){_0xfbd493['where']=_[_0xfc17('0x44')](_0xfbd493[_0xfc17('0x41')],{'$or':_[_0xfc17('0x31')](_0x970783,function(_0x41718a){if(_0x41718a['type']!=='VIRTUAL'){var _0x390916={};_0x390916[_0x41718a[_0xfc17('0x2e')]]={'$like':'%'+_0x5ce54b[_0xfc17('0x38')][_0xfc17('0x43')]+'%'};return _0x390916;}})});}_0xfbd493=_[_0xfc17('0x44')]({},_0xfbd493,_0x5ce54b['options']);var _0x31e8bd={'where':_0xfbd493['where']};return db[_0xfc17('0x32')]['count'](_0x31e8bd)[_0xfc17('0x2b')](function(_0x512a22){_0x4f8a87[_0xfc17('0x23')]=_0x512a22;if(_0x5ce54b[_0xfc17('0x38')][_0xfc17('0x45')]){_0xfbd493[_0xfc17('0x46')]=[{'all':!![]}];}return db[_0xfc17('0x32')][_0xfc17('0x47')](_0xfbd493);})['then'](function(_0x3e1c80){_0x4f8a87[_0xfc17('0x48')]=_0x3e1c80;return _0x4f8a87;})[_0xfc17('0x2b')](respondWithFilteredResult(_0x28f08a,_0xfbd493))[_0xfc17('0x49')](handleError(_0x28f08a,null));};exports['show']=function(_0x339e7d,_0x4f1d67){var _0x449e9e={'raw':![],'where':{'id':_0x339e7d[_0xfc17('0x4a')]['id']}},_0x5c0671={};_0x5c0671[_0xfc17('0x37')]=_['keys'](db[_0xfc17('0x32')][_0xfc17('0x33')]);_0x5c0671[_0xfc17('0x38')]=_['keys'](_0x339e7d[_0xfc17('0x38')]);_0x5c0671['filters']=_[_0xfc17('0x3c')](_0x5c0671[_0xfc17('0x37')],_0x5c0671[_0xfc17('0x38')]);_0x449e9e[_0xfc17('0x3b')]=_['intersection'](_0x5c0671[_0xfc17('0x37')],qs[_0xfc17('0x3d')](_0x339e7d['query'][_0xfc17('0x3d')]));_0x449e9e['attributes']=_0x449e9e[_0xfc17('0x3b')][_0xfc17('0x3e')]?_0x449e9e['attributes']:_0x5c0671[_0xfc17('0x37')];if(_0x339e7d['query'][_0xfc17('0x45')]){_0x449e9e[_0xfc17('0x46')]=[{'all':!![]}];}_0x449e9e=_[_0xfc17('0x44')]({},_0x449e9e,_0x339e7d[_0xfc17('0x4b')]);return db[_0xfc17('0x32')][_0xfc17('0x4c')](_0x449e9e)['then'](handleEntityNotFound(_0x4f1d67,null))[_0xfc17('0x2b')](respondWithResult(_0x4f1d67,null))['catch'](handleError(_0x4f1d67,null));};exports[_0xfc17('0x4d')]=function(_0xde4b54,_0x13bea3){return db[_0xfc17('0x32')][_0xfc17('0x4d')](_0xde4b54[_0xfc17('0x4e')],{})[_0xfc17('0x2b')](respondWithResult(_0x13bea3,0xc9))[_0xfc17('0x49')](handleError(_0x13bea3,null));};exports[_0xfc17('0x29')]=function(_0x5055ce,_0x2a8c62){if(_0x5055ce['body']['id']){delete _0x5055ce['body']['id'];}return db[_0xfc17('0x32')][_0xfc17('0x4c')]({'where':{'id':_0x5055ce[_0xfc17('0x4a')]['id']}})[_0xfc17('0x2b')](handleEntityNotFound(_0x2a8c62,null))['then'](saveUpdates(_0x5055ce['body'],null))['then'](respondWithResult(_0x2a8c62,null))['catch'](handleError(_0x2a8c62,null));};exports[_0xfc17('0x2a')]=function(_0x4c96c5,_0x2480da){return db['FreshdeskAccount'][_0xfc17('0x4c')]({'where':{'id':_0x4c96c5[_0xfc17('0x4a')]['id']}})[_0xfc17('0x2b')](handleEntityNotFound(_0x2480da,null))[_0xfc17('0x2b')](removeEntity(_0x2480da,null))[_0xfc17('0x49')](handleError(_0x2480da,null));};exports['getConfigurations']=function(_0x47d35c,_0x4a1172,_0x30b780){var _0x57f45e={};var _0x2b1160={};var _0x11b28c;var _0x4a7146;return db[_0xfc17('0x32')]['findOne']({'where':{'id':_0x47d35c['params']['id']}})[_0xfc17('0x2b')](handleEntityNotFound(_0x4a1172,null))[_0xfc17('0x2b')](function(_0x13b3d0){if(_0x13b3d0){_0x11b28c=_0x13b3d0;_0x2b1160[_0xfc17('0x37')]=_['keys'](db[_0xfc17('0x4f')]['rawAttributes']);_0x2b1160['query']=_['keys'](_0x47d35c['query']);_0x2b1160[_0xfc17('0x3a')]=_['intersection'](_0x2b1160['model'],_0x2b1160[_0xfc17('0x38')]);_0x57f45e[_0xfc17('0x3b')]=_[_0xfc17('0x3c')](_0x2b1160[_0xfc17('0x37')],qs[_0xfc17('0x3d')](_0x47d35c['query'][_0xfc17('0x3d')]));_0x57f45e[_0xfc17('0x3b')]=_0x57f45e[_0xfc17('0x3b')][_0xfc17('0x3e')]?_0x57f45e['attributes']:_0x2b1160['model'];_0x57f45e['order']=qs[_0xfc17('0x40')](_0x47d35c[_0xfc17('0x38')][_0xfc17('0x40')]);_0x57f45e[_0xfc17('0x41')]=qs[_0xfc17('0x3a')](_[_0xfc17('0x42')](_0x47d35c[_0xfc17('0x38')],_0x2b1160['filters']));if(_0x47d35c[_0xfc17('0x38')][_0xfc17('0x43')]){_0x57f45e['where']=_[_0xfc17('0x44')](_0x57f45e[_0xfc17('0x41')],{'$or':_[_0xfc17('0x31')](_0x57f45e[_0xfc17('0x3b')],function(_0x186405){var _0x54d828={};_0x54d828[_0x186405]={'$like':'%'+_0x47d35c[_0xfc17('0x38')][_0xfc17('0x43')]+'%'};return _0x54d828;})});}_0x57f45e=_[_0xfc17('0x44')]({},_0x57f45e,_0x47d35c[_0xfc17('0x4b')]);return _0x11b28c['getConfigurations'](_0x57f45e);}})[_0xfc17('0x2b')](function(_0x3d2061){if(_0x3d2061){_0x4a7146=_0x3d2061[_0xfc17('0x3e')];if(!_0x47d35c[_0xfc17('0x38')][_0xfc17('0x3f')](_0xfc17('0x50'))){_0x57f45e[_0xfc17('0x22')]=qs[_0xfc17('0x22')](_0x47d35c[_0xfc17('0x38')][_0xfc17('0x22')]);_0x57f45e[_0xfc17('0x20')]=qs['offset'](_0x47d35c[_0xfc17('0x38')][_0xfc17('0x20')]);}return _0x11b28c[_0xfc17('0x51')](_0x57f45e);}})[_0xfc17('0x2b')](function(_0xb0f9cd){if(_0xb0f9cd){return _0xb0f9cd?{'count':_0x4a7146,'rows':_0xb0f9cd}:null;}})[_0xfc17('0x2b')](respondWithResult(_0x4a1172,null))[_0xfc17('0x49')](handleError(_0x4a1172,null));};exports['addConfiguration']=function(_0x5583da,_0x240e1d,_0x2442fe){if(_0x5583da['body']['id']){delete _0x5583da[_0xfc17('0x4e')]['id'];}return db[_0xfc17('0x32')][_0xfc17('0x52')]({'where':{'id':_0x5583da['params']['id']}})[_0xfc17('0x2b')](handleEntityNotFound(_0x240e1d,null))[_0xfc17('0x2b')](function(_0x11a628){if(_0x11a628){_0x5583da[_0xfc17('0x4e')]['AccountId']=_0x11a628['id'];_0x5583da[_0xfc17('0x4e')][_0xfc17('0x53')]=integrations[_0xfc17('0x54')](_0x5583da[_0xfc17('0x4e')]['channel'],_0x5583da[_0xfc17('0x4e')][_0xfc17('0x35')]);_0x5583da[_0xfc17('0x4e')][_0xfc17('0x55')]=integrations[_0xfc17('0x56')](_0x5583da[_0xfc17('0x4e')]['channel'],_0x5583da['body']['type']);return db['FreshdeskConfiguration'][_0xfc17('0x4d')](_0x5583da[_0xfc17('0x4e')],{'include':[{'model':db['FreshdeskField'],'as':_0xfc17('0x53')},{'model':db['FreshdeskField'],'as':_0xfc17('0x55')}]});}return null;})['then'](respondWithResult(_0x240e1d,null))[_0xfc17('0x49')](handleError(_0x240e1d,null));};exports[_0xfc17('0x57')]=function(_0x3040f3,_0x5501d7,_0xf6f8fc){var _0x415d12='';return db[_0xfc17('0x32')][_0xfc17('0x52')]({'where':{'id':_0x3040f3[_0xfc17('0x4a')]['id']},'attributes':['id','remoteUri',_0xfc17('0x58')]})[_0xfc17('0x2b')](handleEntityNotFound(_0x5501d7,null))['then'](function(_0x4c8e5a){if(_0x4c8e5a){_0x415d12=_0x4c8e5a[_0xfc17('0x59')];var _0xdcbedf=_0x415d12['slice'](-0x1);if(_0xdcbedf==='/'){_0x415d12=_0x415d12[_0xfc17('0x5a')](0x0,_0x415d12[_0xfc17('0x5b')](_0xdcbedf));}return rp({'method':_0xfc17('0x5c'),'uri':util[_0xfc17('0x5d')]('%s/%s',_0x415d12,_0xfc17('0x5e')),'headers':{'Authorization':util[_0xfc17('0x5d')]('Basic\x20%s',new Buffer(util[_0xfc17('0x5d')](_0xfc17('0x5f'),_0x4c8e5a[_0xfc17('0x58')]))[_0xfc17('0x60')](_0xfc17('0x61')))},'json':!![]});}})[_0xfc17('0x2b')](function(_0x27d01b){if(_0x27d01b){var _0x3daf1d=['requester','subject','agent',_0xfc17('0x62'),_0xfc17('0x1d'),'priority','group',_0xfc17('0x63'),_0xfc17('0x64'),_0xfc17('0x65'),_0xfc17('0x66')];_['remove'](_0x27d01b,function(_0x427c48){return _0x3daf1d[_0xfc17('0x67')](_0x427c48[_0xfc17('0x2e')])||!_0x427c48['default']&&_0x427c48[_0xfc17('0x35')]!=='custom_text'&&_0x427c48[_0xfc17('0x35')]!==_0xfc17('0x68');});return{'count':_0x27d01b['length'],'rows':_[_0xfc17('0x31')](_0x27d01b,function(_0x4f6830){return{'id':_0x4f6830[_0xfc17('0x2e')],'name':_0x4f6830[_0xfc17('0x69')],'custom':!_0x4f6830[_0xfc17('0x6a')],'options':_0x4f6830[_0xfc17('0x6b')]?_[_0xfc17('0x31')](_0x4f6830['choices'],function(_0x228616){return{'name':_[_0xfc17('0x6c')](_0x228616),'value':_0x228616};}):[]};})};}})[_0xfc17('0x2b')](respondWithResult(_0x5501d7,null))['catch'](function(_0x5d96c1){var _0x1d6ad4=_0x3040f3[_0xfc17('0x38')]['test']?0x1f4:_0x5d96c1[_0xfc17('0x6d')]||0x1f4;logger[_0xfc17('0x2d')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1d6ad4,JSON[_0xfc17('0x6e')](_0x5d96c1));delete _0x5d96c1[_0xfc17('0x2e')];if(_0x1d6ad4===0x191){_0x1d6ad4=0x190;}_0x5501d7[_0xfc17('0x1d')](_0x1d6ad4)[_0xfc17('0x2f')](_0x3040f3[_0xfc17('0x38')][_0xfc17('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x5d96c1[_0xfc17('0x6d')]}:_0x5d96c1);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index af508f3..942eb06 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 _0x98d6=['exports','define','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x596dfa,_0x14ee79){var _0x1e7085=function(_0x50be3b){while(--_0x50be3b){_0x596dfa['push'](_0x596dfa['shift']());}};_0x1e7085(++_0x14ee79);}(_0x98d6,0x170));var _0x698d=function(_0x1db269,_0x770edc){_0x1db269=_0x1db269-0x0;var _0x429b18=_0x98d6[_0x1db269];return _0x429b18;};'use strict';var _=require('lodash');var util=require(_0x698d('0x0'));var logger=require(_0x698d('0x1'))(_0x698d('0x2'));var moment=require(_0x698d('0x3'));var BPromise=require(_0x698d('0x4'));var rp=require(_0x698d('0x5'));var fs=require('fs');var path=require(_0x698d('0x6'));var rimraf=require(_0x698d('0x7'));var config=require('../../config/environment');var attributes=require(_0x698d('0x8'));var integrations=require(_0x698d('0x9'));module[_0x698d('0xa')]=function(_0x24ad84,_0x125901){return _0x24ad84[_0x698d('0xb')](_0x698d('0xc'),attributes,{'tableName':_0x698d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fa4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FreshdeskAccount','lodash','../../config/logger','api'];(function(_0x37bcb8,_0x52c1ac){var _0x46d08a=function(_0x627886){while(--_0x627886){_0x37bcb8['push'](_0x37bcb8['shift']());}};_0x46d08a(++_0x52c1ac);}(_0x7fa4,0x81));var _0x47fa=function(_0x4bfaf3,_0x237aa3){_0x4bfaf3=_0x4bfaf3-0x0;var _0xee2e51=_0x7fa4[_0x4bfaf3];return _0xee2e51;};'use strict';var _=require(_0x47fa('0x0'));var util=require('util');var logger=require(_0x47fa('0x1'))(_0x47fa('0x2'));var moment=require(_0x47fa('0x3'));var BPromise=require(_0x47fa('0x4'));var rp=require(_0x47fa('0x5'));var fs=require('fs');var path=require(_0x47fa('0x6'));var rimraf=require(_0x47fa('0x7'));var config=require(_0x47fa('0x8'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x42925e,_0x3c7a23){return _0x42925e[_0x47fa('0x9')](_0x47fa('0xa'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 654b9c0..34e8437 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 _0x0c2b=['error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','map','include','model','ShowFreshdeskAccount','raw','debug','lodash','util','moment','randomstring','ioredis','jayson/promise','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2bb9b3,_0x1d2c25){var _0x601b6=function(_0x4f8d09){while(--_0x4f8d09){_0x2bb9b3['push'](_0x2bb9b3['shift']());}};_0x601b6(++_0x1d2c25);}(_0x0c2b,0x80));var _0xb0c2=function(_0x1d449e,_0xb2de10){_0x1d449e=_0x1d449e-0x0;var _0x3cd3db=_0x0c2b[_0x1d449e];return _0x3cd3db;};'use strict';var _=require(_0xb0c2('0x0'));var util=require(_0xb0c2('0x1'));var moment=require(_0xb0c2('0x2'));var BPromise=require('bluebird');var rs=require(_0xb0c2('0x3'));var fs=require('fs');var Redis=require(_0xb0c2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb0c2('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43f3c2,_0x5e9a65,_0x29bb10){return new BPromise(function(_0x769f86,_0x4e016e){return client[_0xb0c2('0x6')](_0x43f3c2,_0x29bb10)[_0xb0c2('0x7')](function(_0x4241f1){logger[_0xb0c2('0x8')](_0xb0c2('0x9'),_0x5e9a65,_0xb0c2('0xa'));logger['debug'](_0xb0c2('0xb'),_0x5e9a65,_0xb0c2('0xa'),JSON['stringify'](_0x4241f1));if(_0x4241f1[_0xb0c2('0xc')]){if(_0x4241f1[_0xb0c2('0xc')]['code']===0x1f4){logger[_0xb0c2('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x5e9a65,_0x4241f1[_0xb0c2('0xc')]['message']);return _0x4e016e(_0x4241f1['error'][_0xb0c2('0xd')]);}logger[_0xb0c2('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x5e9a65,_0x4241f1['error']['message']);return _0x769f86(_0x4241f1[_0xb0c2('0xc')]['message']);}else{logger[_0xb0c2('0x8')](_0xb0c2('0x9'),_0x5e9a65,_0xb0c2('0xa'));_0x769f86(_0x4241f1[_0xb0c2('0xe')][_0xb0c2('0xd')]);}})[_0xb0c2('0xf')](function(_0x2f3d9d){logger[_0xb0c2('0xc')](_0xb0c2('0x9'),_0x5e9a65,_0x2f3d9d);_0x4e016e(_0x2f3d9d);});});}exports[_0xb0c2('0x10')]=function(_0x241846){var _0x1d3b45=this;return new Promise(function(_0x4d8785,_0x59dadf){return db[_0xb0c2('0x11')][_0xb0c2('0x12')]({'raw':_0x241846[_0xb0c2('0x13')]?_0x241846[_0xb0c2('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x241846[_0xb0c2('0x13')]?_0x241846[_0xb0c2('0x13')][_0xb0c2('0x14')]||null:null,'attributes':_0x241846[_0xb0c2('0x13')]?_0x241846['options'][_0xb0c2('0x15')]||null:null,'limit':_0x241846[_0xb0c2('0x13')]?_0x241846[_0xb0c2('0x13')]['limit']||null:null,'include':_0x241846[_0xb0c2('0x13')]?_0x241846[_0xb0c2('0x13')]['include']?_[_0xb0c2('0x16')](_0x241846[_0xb0c2('0x13')][_0xb0c2('0x17')],function(_0x925196){return{'model':db[_0x925196[_0xb0c2('0x18')]],'as':_0x925196['as'],'attributes':_0x925196[_0xb0c2('0x15')],'include':_0x925196[_0xb0c2('0x17')]?_[_0xb0c2('0x16')](_0x925196['include'],function(_0x35e456){return{'model':db[_0x35e456[_0xb0c2('0x18')]],'as':_0x35e456['as'],'attributes':_0x35e456[_0xb0c2('0x15')],'include':_0x35e456[_0xb0c2('0x17')]?_['map'](_0x35e456[_0xb0c2('0x17')],function(_0x175f3f){return{'model':db[_0x175f3f[_0xb0c2('0x18')]],'as':_0x175f3f['as'],'attributes':_0x175f3f[_0xb0c2('0x15')]};}):[]};}):[]};}):[]:[]})[_0xb0c2('0x7')](function(_0x36624d){logger['info'](_0xb0c2('0x10'),_0x241846);logger['debug'](_0xb0c2('0x10'),_0x241846,JSON['stringify'](_0x36624d));_0x4d8785(_0x36624d);})[_0xb0c2('0xf')](function(_0x57e92b){logger[_0xb0c2('0xc')](_0xb0c2('0x10'),_0x57e92b[_0xb0c2('0xd')],_0x241846);_0x59dadf(_0x1d3b45[_0xb0c2('0xc')](0x1f4,_0x57e92b['message']));});});};exports[_0xb0c2('0x19')]=function(_0x1a7f32){var _0x3031b9=this;return new Promise(function(_0x345ff5,_0x30b7dd){return db['FreshdeskAccount']['find']({'raw':_0x1a7f32[_0xb0c2('0x13')]?_0x1a7f32[_0xb0c2('0x13')][_0xb0c2('0x1a')]===undefined?!![]:![]:!![],'where':_0x1a7f32[_0xb0c2('0x13')]?_0x1a7f32[_0xb0c2('0x13')][_0xb0c2('0x14')]||null:null,'attributes':_0x1a7f32['options']?_0x1a7f32[_0xb0c2('0x13')][_0xb0c2('0x15')]||null:null,'include':_0x1a7f32[_0xb0c2('0x13')]?_0x1a7f32['options'][_0xb0c2('0x17')]?_[_0xb0c2('0x16')](_0x1a7f32[_0xb0c2('0x13')]['include'],function(_0x5008d8){return{'model':db[_0x5008d8[_0xb0c2('0x18')]],'as':_0x5008d8['as'],'attributes':_0x5008d8[_0xb0c2('0x15')],'include':_0x5008d8[_0xb0c2('0x17')]?_['map'](_0x5008d8['include'],function(_0x2b59cf){return{'model':db[_0x2b59cf[_0xb0c2('0x18')]],'as':_0x2b59cf['as'],'attributes':_0x2b59cf['attributes'],'include':_0x2b59cf[_0xb0c2('0x17')]?_['map'](_0x2b59cf['include'],function(_0x191491){return{'model':db[_0x191491[_0xb0c2('0x18')]],'as':_0x191491['as'],'attributes':_0x191491[_0xb0c2('0x15')]};}):[]};}):[]};}):[]:[]})[_0xb0c2('0x7')](function(_0x338274){logger[_0xb0c2('0x8')](_0xb0c2('0x19'),_0x1a7f32);logger[_0xb0c2('0x1b')](_0xb0c2('0x19'),_0x1a7f32,JSON['stringify'](_0x338274));_0x345ff5(_0x338274);})[_0xb0c2('0xf')](function(_0x12af5c){logger[_0xb0c2('0xc')]('ShowFreshdeskAccount',_0x12af5c[_0xb0c2('0xd')],_0x1a7f32);_0x30b7dd(_0x3031b9['error'](0x1f4,_0x12af5c[_0xb0c2('0xd')]));});});}; \ No newline at end of file +var _0x1fd6=['include','model','map','ShowFreshdeskAccount','find','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','where','attributes','limit'];(function(_0xee98d8,_0x3d79a4){var _0x533f9c=function(_0x2ea7bf){while(--_0x2ea7bf){_0xee98d8['push'](_0xee98d8['shift']());}};_0x533f9c(++_0x3d79a4);}(_0x1fd6,0x6f));var _0x61fd=function(_0xf0032,_0x17c33d){_0xf0032=_0xf0032-0x0;var _0x4ffb3e=_0x1fd6[_0xf0032];return _0x4ffb3e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x61fd('0x0'));var BPromise=require(_0x61fd('0x1'));var rs=require(_0x61fd('0x2'));var fs=require('fs');var Redis=require(_0x61fd('0x3'));var db=require(_0x61fd('0x4'))['db'];var utils=require(_0x61fd('0x5'));var logger=require(_0x61fd('0x6'))(_0x61fd('0x7'));var config=require('../../config/environment');var jayson=require(_0x61fd('0x8'));var client=jayson[_0x61fd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1784dc,_0x300798,_0x47f2af){return new BPromise(function(_0x2f36d8,_0x46c8ba){return client[_0x61fd('0xa')](_0x1784dc,_0x47f2af)[_0x61fd('0xb')](function(_0xe477ad){logger['info'](_0x61fd('0xc'),_0x300798,_0x61fd('0xd'));logger[_0x61fd('0xe')](_0x61fd('0xf'),_0x300798,_0x61fd('0xd'),JSON[_0x61fd('0x10')](_0xe477ad));if(_0xe477ad[_0x61fd('0x11')]){if(_0xe477ad[_0x61fd('0x11')][_0x61fd('0x12')]===0x1f4){logger[_0x61fd('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x300798,_0xe477ad[_0x61fd('0x11')][_0x61fd('0x13')]);return _0x46c8ba(_0xe477ad['error'][_0x61fd('0x13')]);}logger[_0x61fd('0x11')](_0x61fd('0xc'),_0x300798,_0xe477ad['error'][_0x61fd('0x13')]);return _0x2f36d8(_0xe477ad[_0x61fd('0x11')]['message']);}else{logger[_0x61fd('0x14')](_0x61fd('0xc'),_0x300798,_0x61fd('0xd'));_0x2f36d8(_0xe477ad[_0x61fd('0x15')][_0x61fd('0x13')]);}})[_0x61fd('0x16')](function(_0x33fa12){logger[_0x61fd('0x11')](_0x61fd('0xc'),_0x300798,_0x33fa12);_0x46c8ba(_0x33fa12);});});}exports[_0x61fd('0x17')]=function(_0x61653){var _0x46b978=this;return new Promise(function(_0x185609,_0x21687c){return db[_0x61fd('0x18')]['findAll']({'raw':_0x61653[_0x61fd('0x19')]?_0x61653[_0x61fd('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x61653['options']?_0x61653[_0x61fd('0x19')][_0x61fd('0x1a')]||null:null,'attributes':_0x61653[_0x61fd('0x19')]?_0x61653[_0x61fd('0x19')][_0x61fd('0x1b')]||null:null,'limit':_0x61653[_0x61fd('0x19')]?_0x61653['options'][_0x61fd('0x1c')]||null:null,'include':_0x61653['options']?_0x61653[_0x61fd('0x19')]['include']?_['map'](_0x61653['options'][_0x61fd('0x1d')],function(_0x5437af){return{'model':db[_0x5437af[_0x61fd('0x1e')]],'as':_0x5437af['as'],'attributes':_0x5437af['attributes'],'include':_0x5437af[_0x61fd('0x1d')]?_[_0x61fd('0x1f')](_0x5437af[_0x61fd('0x1d')],function(_0x3b3bfd){return{'model':db[_0x3b3bfd[_0x61fd('0x1e')]],'as':_0x3b3bfd['as'],'attributes':_0x3b3bfd['attributes'],'include':_0x3b3bfd['include']?_[_0x61fd('0x1f')](_0x3b3bfd[_0x61fd('0x1d')],function(_0x58d163){return{'model':db[_0x58d163['model']],'as':_0x58d163['as'],'attributes':_0x58d163[_0x61fd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x61fd('0xb')](function(_0x591ce9){logger['info'](_0x61fd('0x17'),_0x61653);logger[_0x61fd('0xe')](_0x61fd('0x17'),_0x61653,JSON[_0x61fd('0x10')](_0x591ce9));_0x185609(_0x591ce9);})[_0x61fd('0x16')](function(_0x3a18fc){logger['error']('GetFreshdeskAccount',_0x3a18fc[_0x61fd('0x13')],_0x61653);_0x21687c(_0x46b978[_0x61fd('0x11')](0x1f4,_0x3a18fc[_0x61fd('0x13')]));});});};exports[_0x61fd('0x20')]=function(_0x589952){var _0x2a4962=this;return new Promise(function(_0x1ffe68,_0x3e9a32){return db[_0x61fd('0x18')][_0x61fd('0x21')]({'raw':_0x589952[_0x61fd('0x19')]?_0x589952['options'][_0x61fd('0x22')]===undefined?!![]:![]:!![],'where':_0x589952[_0x61fd('0x19')]?_0x589952[_0x61fd('0x19')][_0x61fd('0x1a')]||null:null,'attributes':_0x589952[_0x61fd('0x19')]?_0x589952[_0x61fd('0x19')]['attributes']||null:null,'include':_0x589952[_0x61fd('0x19')]?_0x589952[_0x61fd('0x19')][_0x61fd('0x1d')]?_[_0x61fd('0x1f')](_0x589952[_0x61fd('0x19')][_0x61fd('0x1d')],function(_0x3e62f3){return{'model':db[_0x3e62f3[_0x61fd('0x1e')]],'as':_0x3e62f3['as'],'attributes':_0x3e62f3[_0x61fd('0x1b')],'include':_0x3e62f3[_0x61fd('0x1d')]?_[_0x61fd('0x1f')](_0x3e62f3[_0x61fd('0x1d')],function(_0x45a65d){return{'model':db[_0x45a65d['model']],'as':_0x45a65d['as'],'attributes':_0x45a65d[_0x61fd('0x1b')],'include':_0x45a65d['include']?_['map'](_0x45a65d[_0x61fd('0x1d')],function(_0x43ab26){return{'model':db[_0x43ab26[_0x61fd('0x1e')]],'as':_0x43ab26['as'],'attributes':_0x43ab26[_0x61fd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x61fd('0xb')](function(_0x1e3002){logger['info'](_0x61fd('0x20'),_0x589952);logger['debug']('ShowFreshdeskAccount',_0x589952,JSON[_0x61fd('0x10')](_0x1e3002));_0x1ffe68(_0x1e3002);})[_0x61fd('0x16')](function(_0x18b907){logger[_0x61fd('0x11')](_0x61fd('0x20'),_0x18b907[_0x61fd('0x13')],_0x589952);_0x3e9a32(_0x2a4962[_0x61fd('0x11')](0x1f4,_0x18b907[_0x61fd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 3a9815f..5751c83 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 _0xb7a0=['create','setTags','put','/:id','update','delete','destroy','util','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post'];(function(_0x9035a1,_0x57c0b3){var _0x924dce=function(_0xba850e){while(--_0xba850e){_0x9035a1['push'](_0x9035a1['shift']());}};_0x924dce(++_0x57c0b3);}(_0xb7a0,0x17e));var _0x0b7a=function(_0x55063f,_0xad73cb){_0x55063f=_0x55063f-0x0;var _0x3118a9=_0xb7a0[_0x55063f];return _0x3118a9;};'use strict';var multer=require('multer');var util=require(_0x0b7a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0b7a('0x1'));var router=express['Router']();var fs_extra=require(_0x0b7a('0x2'));var auth=require(_0x0b7a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0b7a('0x4'));var controller=require(_0x0b7a('0x5'));router[_0x0b7a('0x6')]('/',auth['isAuthenticated'](),controller[_0x0b7a('0x7')]);router['get']('/:id',auth[_0x0b7a('0x8')](),controller[_0x0b7a('0x9')]);router[_0x0b7a('0x6')](_0x0b7a('0xa'),auth[_0x0b7a('0x8')](),controller[_0x0b7a('0xb')]);router[_0x0b7a('0x6')](_0x0b7a('0xc'),auth[_0x0b7a('0x8')](),controller[_0x0b7a('0xd')]);router[_0x0b7a('0x6')](_0x0b7a('0xe'),auth[_0x0b7a('0x8')](),controller[_0x0b7a('0xf')]);router[_0x0b7a('0x6')](_0x0b7a('0x10'),auth['isAuthenticated'](),controller['getTags']);router[_0x0b7a('0x11')]('/',auth[_0x0b7a('0x8')](),controller[_0x0b7a('0x12')]);router[_0x0b7a('0x11')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0b7a('0x13')]);router[_0x0b7a('0x14')](_0x0b7a('0x15'),auth[_0x0b7a('0x8')](),controller[_0x0b7a('0x16')]);router[_0x0b7a('0x17')](_0x0b7a('0x15'),auth[_0x0b7a('0x8')](),controller[_0x0b7a('0x18')]);module['exports']=router; \ No newline at end of file +var _0xe92c=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe92c,0x196));var _0xce92=function(_0x488444,_0x4995e8){_0x488444=_0x488444-0x0;var _0x15da9e=_0xe92c[_0x488444];return _0x15da9e;};'use strict';var multer=require(_0xce92('0x0'));var util=require(_0xce92('0x1'));var path=require(_0xce92('0x2'));var timeout=require(_0xce92('0x3'));var express=require('express');var router=express[_0xce92('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xce92('0x5'));var interaction=require(_0xce92('0x6'));var config=require(_0xce92('0x7'));var controller=require(_0xce92('0x8'));router[_0xce92('0x9')]('/',auth[_0xce92('0xa')](),controller[_0xce92('0xb')]);router[_0xce92('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xce92('0xc')]);router[_0xce92('0x9')]('/:id/fields',auth[_0xce92('0xa')](),controller['getFields']);router[_0xce92('0x9')](_0xce92('0xd'),auth[_0xce92('0xa')](),controller[_0xce92('0xe')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0xce92('0xf')]);router[_0xce92('0x9')](_0xce92('0x10'),auth[_0xce92('0xa')](),controller[_0xce92('0x11')]);router[_0xce92('0x12')]('/',auth[_0xce92('0xa')](),controller['create']);router[_0xce92('0x12')](_0xce92('0x10'),auth[_0xce92('0xa')](),controller['setTags']);router[_0xce92('0x13')](_0xce92('0x14'),auth[_0xce92('0xa')](),controller[_0xce92('0x15')]);router[_0xce92('0x16')](_0xce92('0x14'),auth['isAuthenticated'](),controller[_0xce92('0x17')]);module[_0xce92('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 7b1933e..d47501b 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 _0xd418=['STRING','exports'];(function(_0xaadc70,_0x2c050d){var _0x3ac647=function(_0x57f7d8){while(--_0x57f7d8){_0xaadc70['push'](_0xaadc70['shift']());}};_0x3ac647(++_0x2c050d);}(_0xd418,0x143));var _0x8d41=function(_0x5321d4,_0x13b311){_0x5321d4=_0x5321d4-0x0;var _0x449264=_0xd418[_0x5321d4];return _0x449264;};'use strict';var Sequelize=require('sequelize');module[_0x8d41('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8d41('0x1')]}}; \ No newline at end of file +var _0xd963=['sequelize','STRING'];(function(_0x1bab40,_0x5520ff){var _0x21a8ca=function(_0x2015b6){while(--_0x2015b6){_0x1bab40['push'](_0x1bab40['shift']());}};_0x21a8ca(++_0x5520ff);}(_0xd963,0x16c));var _0x3d96=function(_0x592ca0,_0x30d956){_0x592ca0=_0x592ca0-0x0;var _0x2c2e71=_0xd963[_0x592ca0];return _0x2c2e71;};'use strict';var Sequelize=require(_0x3d96('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d96('0x1')]},'description':{'type':Sequelize[_0x3d96('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 9b31893..d0cc2a0 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 _0xda27=['query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','VIRTUAL','options','where','includeAll','rows','show','params','keys','include','find','catch','create','body','destroy','getFields','findOne','FreshdeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type'];(function(_0x42dc6e,_0xb7b9aa){var _0x3164fd=function(_0x582e85){while(--_0x582e85){_0x42dc6e['push'](_0x42dc6e['shift']());}};_0x3164fd(++_0xb7b9aa);}(_0xda27,0x74));var _0x7da2=function(_0x3c9c4d,_0x1a2ef0){_0x3c9c4d=_0x3c9c4d-0x0;var _0x189ec2=_0xda27[_0x3c9c4d];return _0x189ec2;};'use strict';var emlformat=require(_0x7da2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7da2('0x1'));var jsonpatch=require(_0x7da2('0x2'));var rp=require(_0x7da2('0x3'));var moment=require('moment');var BPromise=require(_0x7da2('0x4'));var Mustache=require('mustache');var util=require(_0x7da2('0x5'));var path=require(_0x7da2('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7da2('0x7'));var _=require('lodash');var squel=require(_0x7da2('0x8'));var crypto=require(_0x7da2('0x9'));var jsforce=require(_0x7da2('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7da2('0xb'));var querystring=require(_0x7da2('0xc'));var Papa=require('papaparse');var Redis=require(_0x7da2('0xd'));var authService=require(_0x7da2('0xe'));var qs=require(_0x7da2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7da2('0x10'));var logger=require('../../config/logger')(_0x7da2('0x11'));var utils=require('../../config/utils');var config=require(_0x7da2('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x7da2('0x13'))['db'];function respondWithStatusCode(_0x2bbd47,_0x7ee960){_0x7ee960=_0x7ee960||0xcc;return function(_0x13f859){if(_0x13f859){return _0x2bbd47['sendStatus'](_0x7ee960);}return _0x2bbd47[_0x7da2('0x14')](_0x7ee960)[_0x7da2('0x15')]();};}function respondWithResult(_0x41e7bf,_0x31ea7a){_0x31ea7a=_0x31ea7a||0xc8;return function(_0x28d369){if(_0x28d369){return _0x41e7bf[_0x7da2('0x14')](_0x31ea7a)[_0x7da2('0x16')](_0x28d369);}};}function respondWithFilteredResult(_0x4e86e0,_0x5359cf){return function(_0x46ec5f){if(_0x46ec5f){var _0x380e5c=typeof _0x5359cf[_0x7da2('0x17')]===_0x7da2('0x18')&&typeof _0x5359cf['limit']===_0x7da2('0x18');var _0x5f33c9=_0x46ec5f[_0x7da2('0x19')];var _0x3d572a=_0x380e5c?0x0:_0x5359cf['offset'];var _0x5c2c58=_0x380e5c?_0x46ec5f[_0x7da2('0x19')]:_0x5359cf[_0x7da2('0x17')]+_0x5359cf[_0x7da2('0x1a')];var _0xa8969c;if(_0x5c2c58>=_0x5f33c9){_0x5c2c58=_0x5f33c9;_0xa8969c=0xc8;}else{_0xa8969c=0xce;}_0x4e86e0[_0x7da2('0x14')](_0xa8969c);return _0x4e86e0[_0x7da2('0x1b')](_0x7da2('0x1c'),_0x3d572a+'-'+_0x5c2c58+'/'+_0x5f33c9)[_0x7da2('0x16')](_0x46ec5f);}return null;};}function patchUpdates(_0x3c310d){return function(_0x7e5ea6){try{jsonpatch[_0x7da2('0x1d')](_0x7e5ea6,_0x3c310d,!![]);}catch(_0x714f82){return BPromise[_0x7da2('0x1e')](_0x714f82);}return _0x7e5ea6[_0x7da2('0x1f')]();};}function saveUpdates(_0x56d502,_0x1208bf){return function(_0x588482){if(_0x588482){return _0x588482[_0x7da2('0x20')](_0x56d502)[_0x7da2('0x21')](function(_0xc7f72){return _0xc7f72;});}return null;};}function removeEntity(_0x5ea396,_0x184522){return function(_0x5e57e3){if(_0x5e57e3){return _0x5e57e3['destroy']()[_0x7da2('0x21')](function(){_0x5ea396[_0x7da2('0x14')](0xcc)[_0x7da2('0x15')]();});}};}function handleEntityNotFound(_0x12c5f0,_0x5e25bd){return function(_0x2e4e2f){if(!_0x2e4e2f){_0x12c5f0[_0x7da2('0x22')](0x194);}return _0x2e4e2f;};}function handleError(_0x1367a1,_0x195be2){_0x195be2=_0x195be2||0x1f4;return function(_0x49d726){logger[_0x7da2('0x23')](_0x49d726['stack']);if(_0x49d726[_0x7da2('0x24')]){delete _0x49d726[_0x7da2('0x24')];}_0x1367a1['status'](_0x195be2)[_0x7da2('0x25')](_0x49d726);};}exports[_0x7da2('0x26')]=function(_0x189514,_0x3ddf1d){var _0x38e57d={},_0x133922={},_0xf3425a={'count':0x0,'rows':[]};var _0x46490e=_[_0x7da2('0x27')](db[_0x7da2('0x28')][_0x7da2('0x29')],function(_0x1fe7e9){return{'name':_0x1fe7e9[_0x7da2('0x2a')],'type':_0x1fe7e9[_0x7da2('0x2b')]['key']};});_0x133922['model']=_[_0x7da2('0x27')](_0x46490e,_0x7da2('0x24'));_0x133922[_0x7da2('0x2c')]=_['keys'](_0x189514[_0x7da2('0x2c')]);_0x133922[_0x7da2('0x2d')]=_[_0x7da2('0x2e')](_0x133922[_0x7da2('0x2f')],_0x133922[_0x7da2('0x2c')]);_0x38e57d[_0x7da2('0x30')]=_[_0x7da2('0x2e')](_0x133922['model'],qs[_0x7da2('0x31')](_0x189514[_0x7da2('0x2c')][_0x7da2('0x31')]));_0x38e57d[_0x7da2('0x30')]=_0x38e57d[_0x7da2('0x30')][_0x7da2('0x32')]?_0x38e57d[_0x7da2('0x30')]:_0x133922['model'];if(!_0x189514[_0x7da2('0x2c')][_0x7da2('0x33')](_0x7da2('0x34'))){_0x38e57d[_0x7da2('0x1a')]=qs[_0x7da2('0x1a')](_0x189514[_0x7da2('0x2c')]['limit']);_0x38e57d['offset']=qs[_0x7da2('0x17')](_0x189514[_0x7da2('0x2c')]['offset']);}_0x38e57d[_0x7da2('0x35')]=qs[_0x7da2('0x36')](_0x189514[_0x7da2('0x2c')][_0x7da2('0x36')]);_0x38e57d['where']=qs[_0x7da2('0x2d')](_['pick'](_0x189514[_0x7da2('0x2c')],_0x133922[_0x7da2('0x2d')]),_0x46490e);if(_0x189514[_0x7da2('0x2c')][_0x7da2('0x37')]){_0x38e57d['where']=_[_0x7da2('0x38')](_0x38e57d['where'],{'$or':_[_0x7da2('0x27')](_0x46490e,function(_0x8f35d8){if(_0x8f35d8[_0x7da2('0x2b')]!==_0x7da2('0x39')){var _0x5720d0={};_0x5720d0[_0x8f35d8['name']]={'$like':'%'+_0x189514['query'][_0x7da2('0x37')]+'%'};return _0x5720d0;}})});}_0x38e57d=_[_0x7da2('0x38')]({},_0x38e57d,_0x189514[_0x7da2('0x3a')]);var _0x394cdc={'where':_0x38e57d[_0x7da2('0x3b')]};return db['FreshdeskConfiguration'][_0x7da2('0x19')](_0x394cdc)[_0x7da2('0x21')](function(_0x19261f){_0xf3425a['count']=_0x19261f;if(_0x189514[_0x7da2('0x2c')][_0x7da2('0x3c')]){_0x38e57d['include']=[{'all':!![]}];}return db[_0x7da2('0x28')]['findAll'](_0x38e57d);})['then'](function(_0x42fadc){_0xf3425a[_0x7da2('0x3d')]=_0x42fadc;return _0xf3425a;})[_0x7da2('0x21')](respondWithFilteredResult(_0x3ddf1d,_0x38e57d))['catch'](handleError(_0x3ddf1d,null));};exports[_0x7da2('0x3e')]=function(_0x400535,_0x2e9ab5){var _0x495b78={'raw':![],'where':{'id':_0x400535[_0x7da2('0x3f')]['id']}},_0x466f32={};_0x466f32[_0x7da2('0x2f')]=_['keys'](db[_0x7da2('0x28')]['rawAttributes']);_0x466f32[_0x7da2('0x2c')]=_[_0x7da2('0x40')](_0x400535[_0x7da2('0x2c')]);_0x466f32[_0x7da2('0x2d')]=_[_0x7da2('0x2e')](_0x466f32[_0x7da2('0x2f')],_0x466f32[_0x7da2('0x2c')]);_0x495b78[_0x7da2('0x30')]=_['intersection'](_0x466f32['model'],qs['fields'](_0x400535['query'][_0x7da2('0x31')]));_0x495b78['attributes']=_0x495b78['attributes'][_0x7da2('0x32')]?_0x495b78[_0x7da2('0x30')]:_0x466f32[_0x7da2('0x2f')];if(_0x400535[_0x7da2('0x2c')][_0x7da2('0x3c')]){_0x495b78[_0x7da2('0x41')]=[{'all':!![]}];}_0x495b78=_[_0x7da2('0x38')]({},_0x495b78,_0x400535[_0x7da2('0x3a')]);return db[_0x7da2('0x28')][_0x7da2('0x42')](_0x495b78)[_0x7da2('0x21')](handleEntityNotFound(_0x2e9ab5,null))['then'](respondWithResult(_0x2e9ab5,null))[_0x7da2('0x43')](handleError(_0x2e9ab5,null));};exports[_0x7da2('0x44')]=function(_0x31821f,_0x50d5dc){return db['FreshdeskConfiguration'][_0x7da2('0x44')](_0x31821f[_0x7da2('0x45')],{})[_0x7da2('0x21')](respondWithResult(_0x50d5dc,0xc9))[_0x7da2('0x43')](handleError(_0x50d5dc,null));};exports[_0x7da2('0x20')]=function(_0x4c51e7,_0x21140d){if(_0x4c51e7[_0x7da2('0x45')]['id']){delete _0x4c51e7[_0x7da2('0x45')]['id'];}return db[_0x7da2('0x28')]['find']({'where':{'id':_0x4c51e7[_0x7da2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x21140d,null))[_0x7da2('0x21')](saveUpdates(_0x4c51e7[_0x7da2('0x45')],null))[_0x7da2('0x21')](respondWithResult(_0x21140d,null))[_0x7da2('0x43')](handleError(_0x21140d,null));};exports[_0x7da2('0x46')]=function(_0xe60096,_0x246894){return db[_0x7da2('0x28')][_0x7da2('0x42')]({'where':{'id':_0xe60096[_0x7da2('0x3f')]['id']}})[_0x7da2('0x21')](handleEntityNotFound(_0x246894,null))[_0x7da2('0x21')](removeEntity(_0x246894,null))['catch'](handleError(_0x246894,null));};exports[_0x7da2('0x47')]=function(_0x132e28,_0x1f7697,_0x26130f){var _0x3420ea={};var _0x306e23={};var _0x465c85;var _0x5af9fb;return db[_0x7da2('0x28')][_0x7da2('0x48')]({'where':{'id':_0x132e28[_0x7da2('0x3f')]['id']}})[_0x7da2('0x21')](handleEntityNotFound(_0x1f7697,null))[_0x7da2('0x21')](function(_0x1e4cb5){if(_0x1e4cb5){_0x465c85=_0x1e4cb5;_0x306e23[_0x7da2('0x2f')]=_[_0x7da2('0x40')](db[_0x7da2('0x49')]['rawAttributes']);_0x306e23['query']=_['keys'](_0x132e28['query']);_0x306e23[_0x7da2('0x2d')]=_['intersection'](_0x306e23[_0x7da2('0x2f')],_0x306e23['query']);_0x3420ea[_0x7da2('0x30')]=_[_0x7da2('0x2e')](_0x306e23['model'],qs[_0x7da2('0x31')](_0x132e28['query'][_0x7da2('0x31')]));_0x3420ea[_0x7da2('0x30')]=_0x3420ea[_0x7da2('0x30')][_0x7da2('0x32')]?_0x3420ea['attributes']:_0x306e23[_0x7da2('0x2f')];_0x3420ea[_0x7da2('0x35')]=qs[_0x7da2('0x36')](_0x132e28[_0x7da2('0x2c')][_0x7da2('0x36')]);_0x3420ea['where']=qs['filters'](_[_0x7da2('0x4a')](_0x132e28[_0x7da2('0x2c')],_0x306e23[_0x7da2('0x2d')]));if(_0x132e28['query']['filter']){_0x3420ea[_0x7da2('0x3b')]=_[_0x7da2('0x38')](_0x3420ea['where'],{'$or':_[_0x7da2('0x27')](_0x3420ea['attributes'],function(_0x28d08a){var _0xc40157={};_0xc40157[_0x28d08a]={'$like':'%'+_0x132e28[_0x7da2('0x2c')][_0x7da2('0x37')]+'%'};return _0xc40157;})});}_0x3420ea=_[_0x7da2('0x38')]({},_0x3420ea,_0x132e28[_0x7da2('0x3a')]);return _0x465c85['getFields'](_0x3420ea);}})[_0x7da2('0x21')](function(_0x3cf3c1){if(_0x3cf3c1){_0x5af9fb=_0x3cf3c1[_0x7da2('0x32')];if(!_0x132e28[_0x7da2('0x2c')][_0x7da2('0x33')](_0x7da2('0x34'))){_0x3420ea[_0x7da2('0x1a')]=qs[_0x7da2('0x1a')](_0x132e28['query'][_0x7da2('0x1a')]);_0x3420ea[_0x7da2('0x17')]=qs[_0x7da2('0x17')](_0x132e28[_0x7da2('0x2c')][_0x7da2('0x17')]);}return _0x465c85[_0x7da2('0x47')](_0x3420ea);}})['then'](function(_0x32c01f){if(_0x32c01f){return _0x32c01f?{'count':_0x5af9fb,'rows':_0x32c01f}:null;}})[_0x7da2('0x21')](respondWithResult(_0x1f7697,null))['catch'](handleError(_0x1f7697,null));};exports[_0x7da2('0x4b')]=function(_0x591153,_0x100406,_0x33a78a){var _0x4323ed={};var _0x498b31={};var _0x11fc25;var _0x5964d3;return db['FreshdeskConfiguration'][_0x7da2('0x48')]({'where':{'id':_0x591153['params']['id']}})[_0x7da2('0x21')](handleEntityNotFound(_0x100406,null))['then'](function(_0xe51701){if(_0xe51701){_0x11fc25=_0xe51701;_0x498b31[_0x7da2('0x2f')]=_[_0x7da2('0x40')](db[_0x7da2('0x49')][_0x7da2('0x29')]);_0x498b31[_0x7da2('0x2c')]=_[_0x7da2('0x40')](_0x591153[_0x7da2('0x2c')]);_0x498b31[_0x7da2('0x2d')]=_[_0x7da2('0x2e')](_0x498b31[_0x7da2('0x2f')],_0x498b31[_0x7da2('0x2c')]);_0x4323ed[_0x7da2('0x30')]=_['intersection'](_0x498b31[_0x7da2('0x2f')],qs[_0x7da2('0x31')](_0x591153[_0x7da2('0x2c')]['fields']));_0x4323ed[_0x7da2('0x30')]=_0x4323ed['attributes'][_0x7da2('0x32')]?_0x4323ed[_0x7da2('0x30')]:_0x498b31[_0x7da2('0x2f')];_0x4323ed[_0x7da2('0x35')]=qs['sort'](_0x591153[_0x7da2('0x2c')][_0x7da2('0x36')]);_0x4323ed[_0x7da2('0x3b')]=qs[_0x7da2('0x2d')](_[_0x7da2('0x4a')](_0x591153[_0x7da2('0x2c')],_0x498b31[_0x7da2('0x2d')]));if(_0x591153[_0x7da2('0x2c')][_0x7da2('0x37')]){_0x4323ed['where']=_[_0x7da2('0x38')](_0x4323ed[_0x7da2('0x3b')],{'$or':_[_0x7da2('0x27')](_0x4323ed[_0x7da2('0x30')],function(_0x4c313d){var _0x24513f={};_0x24513f[_0x4c313d]={'$like':'%'+_0x591153[_0x7da2('0x2c')][_0x7da2('0x37')]+'%'};return _0x24513f;})});}_0x4323ed=_['merge']({},_0x4323ed,_0x591153[_0x7da2('0x3a')]);return _0x11fc25[_0x7da2('0x4b')](_0x4323ed);}})[_0x7da2('0x21')](function(_0x503ba2){if(_0x503ba2){_0x5964d3=_0x503ba2[_0x7da2('0x32')];if(!_0x591153[_0x7da2('0x2c')][_0x7da2('0x33')](_0x7da2('0x34'))){_0x4323ed[_0x7da2('0x1a')]=qs[_0x7da2('0x1a')](_0x591153['query'][_0x7da2('0x1a')]);_0x4323ed['offset']=qs[_0x7da2('0x17')](_0x591153['query'][_0x7da2('0x17')]);}return _0x11fc25[_0x7da2('0x4b')](_0x4323ed);}})[_0x7da2('0x21')](function(_0x5413fc){if(_0x5413fc){return _0x5413fc?{'count':_0x5964d3,'rows':_0x5413fc}:null;}})[_0x7da2('0x21')](respondWithResult(_0x100406,null))[_0x7da2('0x43')](handleError(_0x100406,null));};exports[_0x7da2('0x4c')]=function(_0x497e62,_0x2bf3bd,_0x20975a){var _0x281f96={};var _0x5a3fef={};var _0x440d32;var _0x443a9d;return db[_0x7da2('0x28')][_0x7da2('0x48')]({'where':{'id':_0x497e62[_0x7da2('0x3f')]['id']}})[_0x7da2('0x21')](handleEntityNotFound(_0x2bf3bd,null))[_0x7da2('0x21')](function(_0x8355de){if(_0x8355de){_0x440d32=_0x8355de;_0x5a3fef['model']=_[_0x7da2('0x40')](db[_0x7da2('0x49')]['rawAttributes']);_0x5a3fef[_0x7da2('0x2c')]=_['keys'](_0x497e62['query']);_0x5a3fef[_0x7da2('0x2d')]=_[_0x7da2('0x2e')](_0x5a3fef['model'],_0x5a3fef[_0x7da2('0x2c')]);_0x281f96['attributes']=_['intersection'](_0x5a3fef[_0x7da2('0x2f')],qs['fields'](_0x497e62['query']['fields']));_0x281f96[_0x7da2('0x30')]=_0x281f96[_0x7da2('0x30')][_0x7da2('0x32')]?_0x281f96[_0x7da2('0x30')]:_0x5a3fef['model'];_0x281f96[_0x7da2('0x35')]=qs[_0x7da2('0x36')](_0x497e62[_0x7da2('0x2c')][_0x7da2('0x36')]);_0x281f96['where']=qs['filters'](_[_0x7da2('0x4a')](_0x497e62[_0x7da2('0x2c')],_0x5a3fef[_0x7da2('0x2d')]));if(_0x497e62[_0x7da2('0x2c')]['filter']){_0x281f96[_0x7da2('0x3b')]=_['merge'](_0x281f96[_0x7da2('0x3b')],{'$or':_[_0x7da2('0x27')](_0x281f96[_0x7da2('0x30')],function(_0x55d65a){var _0x29fa14={};_0x29fa14[_0x55d65a]={'$like':'%'+_0x497e62['query']['filter']+'%'};return _0x29fa14;})});}_0x281f96=_[_0x7da2('0x38')]({},_0x281f96,_0x497e62['options']);return _0x440d32['getDescriptions'](_0x281f96);}})[_0x7da2('0x21')](function(_0x40c0ff){if(_0x40c0ff){_0x443a9d=_0x40c0ff['length'];if(!_0x497e62['query'][_0x7da2('0x33')](_0x7da2('0x34'))){_0x281f96[_0x7da2('0x1a')]=qs[_0x7da2('0x1a')](_0x497e62['query'][_0x7da2('0x1a')]);_0x281f96[_0x7da2('0x17')]=qs[_0x7da2('0x17')](_0x497e62[_0x7da2('0x2c')]['offset']);}return _0x440d32['getDescriptions'](_0x281f96);}})[_0x7da2('0x21')](function(_0x1854c3){if(_0x1854c3){return _0x1854c3?{'count':_0x443a9d,'rows':_0x1854c3}:null;}})['then'](respondWithResult(_0x2bf3bd,null))[_0x7da2('0x43')](handleError(_0x2bf3bd,null));};exports[_0x7da2('0x4d')]=function(_0x57ff1a,_0x18f321,_0x3864c1){var _0x43d03e={};var _0x5e8924={};var _0x4811b2;var _0x1b255b;return db[_0x7da2('0x28')][_0x7da2('0x48')]({'where':{'id':_0x57ff1a['params']['id']}})['then'](handleEntityNotFound(_0x18f321,null))['then'](function(_0x2c702c){if(_0x2c702c){_0x4811b2=_0x2c702c;_0x5e8924[_0x7da2('0x2f')]=_[_0x7da2('0x40')](db[_0x7da2('0x4e')]['rawAttributes']);_0x5e8924[_0x7da2('0x2c')]=_[_0x7da2('0x40')](_0x57ff1a[_0x7da2('0x2c')]);_0x5e8924[_0x7da2('0x2d')]=_[_0x7da2('0x2e')](_0x5e8924[_0x7da2('0x2f')],_0x5e8924['query']);_0x43d03e['attributes']=_[_0x7da2('0x2e')](_0x5e8924[_0x7da2('0x2f')],qs[_0x7da2('0x31')](_0x57ff1a[_0x7da2('0x2c')][_0x7da2('0x31')]));_0x43d03e['attributes']=_0x43d03e[_0x7da2('0x30')]['length']?_0x43d03e['attributes']:_0x5e8924[_0x7da2('0x2f')];_0x43d03e[_0x7da2('0x35')]=qs[_0x7da2('0x36')](_0x57ff1a['query'][_0x7da2('0x36')]);_0x43d03e[_0x7da2('0x3b')]=qs['filters'](_['pick'](_0x57ff1a[_0x7da2('0x2c')],_0x5e8924[_0x7da2('0x2d')]));if(_0x57ff1a[_0x7da2('0x2c')]['filter']){_0x43d03e[_0x7da2('0x3b')]=_[_0x7da2('0x38')](_0x43d03e[_0x7da2('0x3b')],{'$or':_[_0x7da2('0x27')](_0x43d03e[_0x7da2('0x30')],function(_0x22a686){var _0x553e62={};_0x553e62[_0x22a686]={'$like':'%'+_0x57ff1a['query'][_0x7da2('0x37')]+'%'};return _0x553e62;})});}_0x43d03e=_['merge']({},_0x43d03e,_0x57ff1a[_0x7da2('0x3a')]);return _0x4811b2[_0x7da2('0x4d')](_0x43d03e);}})[_0x7da2('0x21')](function(_0x3bb629){if(_0x3bb629){_0x1b255b=_0x3bb629[_0x7da2('0x32')];if(!_0x57ff1a[_0x7da2('0x2c')][_0x7da2('0x33')](_0x7da2('0x34'))){_0x43d03e[_0x7da2('0x1a')]=qs['limit'](_0x57ff1a[_0x7da2('0x2c')][_0x7da2('0x1a')]);_0x43d03e[_0x7da2('0x17')]=qs['offset'](_0x57ff1a['query']['offset']);}return _0x4811b2['getTags'](_0x43d03e);}})['then'](function(_0xf777c1){if(_0xf777c1){return _0xf777c1?{'count':_0x1b255b,'rows':_0xf777c1}:null;}})[_0x7da2('0x21')](respondWithResult(_0x18f321,null))[_0x7da2('0x43')](handleError(_0x18f321,null));};exports[_0x7da2('0x4f')]=function(_0xfb10eb,_0x49a5f4,_0x249b6d){if(_0xfb10eb[_0x7da2('0x45')]['id']){delete _0xfb10eb[_0x7da2('0x45')]['id'];}return db[_0x7da2('0x28')][_0x7da2('0x48')]({'where':{'id':_0xfb10eb[_0x7da2('0x3f')]['id']}})[_0x7da2('0x21')](handleEntityNotFound(_0x49a5f4,null))[_0x7da2('0x21')](function(_0x33ac94){if(_0x33ac94){return _0x33ac94['setTags'](_0xfb10eb[_0x7da2('0x45')]['ids']||[]);}return null;})['then'](respondWithResult(_0x49a5f4,null))['catch'](handleError(_0x49a5f4,null));}; \ No newline at end of file +var _0x83a8=['includeAll','include','findAll','rows','show','params','find','catch','create','update','body','getFields','findOne','FreshdeskField','getSubjects','nolimit','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','map','FreshdeskConfiguration','rawAttributes','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options'];(function(_0x590766,_0x26a057){var _0x4e2f10=function(_0x5d96a4){while(--_0x5d96a4){_0x590766['push'](_0x590766['shift']());}};_0x4e2f10(++_0x26a057);}(_0x83a8,0xb7));var _0x883a=function(_0x21f8e9,_0x3d6e03){_0x21f8e9=_0x21f8e9-0x0;var _0x42a2db=_0x83a8[_0x21f8e9];return _0x42a2db;};'use strict';var emlformat=require(_0x883a('0x0'));var rimraf=require(_0x883a('0x1'));var zipdir=require(_0x883a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x883a('0x3'));var moment=require('moment');var BPromise=require(_0x883a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x883a('0x5'));var sox=require('sox');var csv=require(_0x883a('0x6'));var ejs=require(_0x883a('0x7'));var fs=require('fs');var fs_extra=require(_0x883a('0x8'));var _=require('lodash');var squel=require(_0x883a('0x9'));var crypto=require(_0x883a('0xa'));var jsforce=require(_0x883a('0xb'));var deskjs=require(_0x883a('0xc'));var toCsv=require(_0x883a('0x6'));var querystring=require(_0x883a('0xd'));var Papa=require(_0x883a('0xe'));var Redis=require(_0x883a('0xf'));var authService=require(_0x883a('0x10'));var qs=require(_0x883a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x883a('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x883a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x883a('0x14'))['db'];function respondWithStatusCode(_0x1b6260,_0x15fa4b){_0x15fa4b=_0x15fa4b||0xcc;return function(_0x3e0da5){if(_0x3e0da5){return _0x1b6260[_0x883a('0x15')](_0x15fa4b);}return _0x1b6260[_0x883a('0x16')](_0x15fa4b)[_0x883a('0x17')]();};}function respondWithResult(_0x69df14,_0x2295dc){_0x2295dc=_0x2295dc||0xc8;return function(_0x4fb229){if(_0x4fb229){return _0x69df14[_0x883a('0x16')](_0x2295dc)[_0x883a('0x18')](_0x4fb229);}};}function respondWithFilteredResult(_0x46b870,_0x31f646){return function(_0xe878a1){if(_0xe878a1){var _0x40e203=typeof _0x31f646[_0x883a('0x19')]==='undefined'&&typeof _0x31f646[_0x883a('0x1a')]===_0x883a('0x1b');var _0x4ce29c=_0xe878a1[_0x883a('0x1c')];var _0x56d6da=_0x40e203?0x0:_0x31f646[_0x883a('0x19')];var _0x433151=_0x40e203?_0xe878a1['count']:_0x31f646['offset']+_0x31f646[_0x883a('0x1a')];var _0x37da79;if(_0x433151>=_0x4ce29c){_0x433151=_0x4ce29c;_0x37da79=0xc8;}else{_0x37da79=0xce;}_0x46b870['status'](_0x37da79);return _0x46b870[_0x883a('0x1d')](_0x883a('0x1e'),_0x56d6da+'-'+_0x433151+'/'+_0x4ce29c)[_0x883a('0x18')](_0xe878a1);}return null;};}function patchUpdates(_0x14ed0e){return function(_0xc46454){try{jsonpatch[_0x883a('0x1f')](_0xc46454,_0x14ed0e,!![]);}catch(_0x1ce3ee){return BPromise[_0x883a('0x20')](_0x1ce3ee);}return _0xc46454[_0x883a('0x21')]();};}function saveUpdates(_0x52c760,_0x6f9040){return function(_0x15e963){if(_0x15e963){return _0x15e963['update'](_0x52c760)[_0x883a('0x22')](function(_0x4dce71){return _0x4dce71;});}return null;};}function removeEntity(_0x4e13a5,_0x2e97da){return function(_0x5c34b7){if(_0x5c34b7){return _0x5c34b7[_0x883a('0x23')]()[_0x883a('0x22')](function(){_0x4e13a5[_0x883a('0x16')](0xcc)[_0x883a('0x17')]();});}};}function handleEntityNotFound(_0x12103f,_0xacd66e){return function(_0x51c614){if(!_0x51c614){_0x12103f['sendStatus'](0x194);}return _0x51c614;};}function handleError(_0x13ffa4,_0x337b4c){_0x337b4c=_0x337b4c||0x1f4;return function(_0x173111){logger[_0x883a('0x24')](_0x173111[_0x883a('0x25')]);if(_0x173111[_0x883a('0x26')]){delete _0x173111[_0x883a('0x26')];}_0x13ffa4['status'](_0x337b4c)['send'](_0x173111);};}exports['index']=function(_0x2fd2b2,_0x2878e0){var _0xc5fcf={},_0x222ece={},_0x518ba0={'count':0x0,'rows':[]};var _0x2c6e4a=_[_0x883a('0x27')](db[_0x883a('0x28')][_0x883a('0x29')],function(_0x5eaf8f){return{'name':_0x5eaf8f['fieldName'],'type':_0x5eaf8f[_0x883a('0x2a')]['key']};});_0x222ece[_0x883a('0x2b')]=_[_0x883a('0x27')](_0x2c6e4a,'name');_0x222ece[_0x883a('0x2c')]=_[_0x883a('0x2d')](_0x2fd2b2[_0x883a('0x2c')]);_0x222ece['filters']=_['intersection'](_0x222ece['model'],_0x222ece[_0x883a('0x2c')]);_0xc5fcf[_0x883a('0x2e')]=_[_0x883a('0x2f')](_0x222ece[_0x883a('0x2b')],qs[_0x883a('0x30')](_0x2fd2b2['query']['fields']));_0xc5fcf[_0x883a('0x2e')]=_0xc5fcf['attributes'][_0x883a('0x31')]?_0xc5fcf['attributes']:_0x222ece['model'];if(!_0x2fd2b2[_0x883a('0x2c')][_0x883a('0x32')]('nolimit')){_0xc5fcf[_0x883a('0x1a')]=qs[_0x883a('0x1a')](_0x2fd2b2['query'][_0x883a('0x1a')]);_0xc5fcf[_0x883a('0x19')]=qs[_0x883a('0x19')](_0x2fd2b2[_0x883a('0x2c')]['offset']);}_0xc5fcf[_0x883a('0x33')]=qs['sort'](_0x2fd2b2[_0x883a('0x2c')][_0x883a('0x34')]);_0xc5fcf[_0x883a('0x35')]=qs[_0x883a('0x36')](_[_0x883a('0x37')](_0x2fd2b2[_0x883a('0x2c')],_0x222ece[_0x883a('0x36')]),_0x2c6e4a);if(_0x2fd2b2[_0x883a('0x2c')][_0x883a('0x38')]){_0xc5fcf[_0x883a('0x35')]=_[_0x883a('0x39')](_0xc5fcf[_0x883a('0x35')],{'$or':_[_0x883a('0x27')](_0x2c6e4a,function(_0x23d3be){if(_0x23d3be[_0x883a('0x2a')]!==_0x883a('0x3a')){var _0x27b88a={};_0x27b88a[_0x23d3be[_0x883a('0x26')]]={'$like':'%'+_0x2fd2b2[_0x883a('0x2c')][_0x883a('0x38')]+'%'};return _0x27b88a;}})});}_0xc5fcf=_[_0x883a('0x39')]({},_0xc5fcf,_0x2fd2b2[_0x883a('0x3b')]);var _0x2f5c71={'where':_0xc5fcf['where']};return db[_0x883a('0x28')][_0x883a('0x1c')](_0x2f5c71)[_0x883a('0x22')](function(_0x52a59c){_0x518ba0[_0x883a('0x1c')]=_0x52a59c;if(_0x2fd2b2[_0x883a('0x2c')][_0x883a('0x3c')]){_0xc5fcf[_0x883a('0x3d')]=[{'all':!![]}];}return db[_0x883a('0x28')][_0x883a('0x3e')](_0xc5fcf);})[_0x883a('0x22')](function(_0x511f7b){_0x518ba0[_0x883a('0x3f')]=_0x511f7b;return _0x518ba0;})[_0x883a('0x22')](respondWithFilteredResult(_0x2878e0,_0xc5fcf))['catch'](handleError(_0x2878e0,null));};exports[_0x883a('0x40')]=function(_0x4ed2f7,_0x126b33){var _0x5aeee2={'raw':![],'where':{'id':_0x4ed2f7[_0x883a('0x41')]['id']}},_0x1b6989={};_0x1b6989['model']=_[_0x883a('0x2d')](db[_0x883a('0x28')][_0x883a('0x29')]);_0x1b6989[_0x883a('0x2c')]=_['keys'](_0x4ed2f7[_0x883a('0x2c')]);_0x1b6989[_0x883a('0x36')]=_[_0x883a('0x2f')](_0x1b6989[_0x883a('0x2b')],_0x1b6989[_0x883a('0x2c')]);_0x5aeee2[_0x883a('0x2e')]=_[_0x883a('0x2f')](_0x1b6989[_0x883a('0x2b')],qs[_0x883a('0x30')](_0x4ed2f7['query'][_0x883a('0x30')]));_0x5aeee2[_0x883a('0x2e')]=_0x5aeee2[_0x883a('0x2e')]['length']?_0x5aeee2[_0x883a('0x2e')]:_0x1b6989[_0x883a('0x2b')];if(_0x4ed2f7[_0x883a('0x2c')][_0x883a('0x3c')]){_0x5aeee2[_0x883a('0x3d')]=[{'all':!![]}];}_0x5aeee2=_[_0x883a('0x39')]({},_0x5aeee2,_0x4ed2f7[_0x883a('0x3b')]);return db[_0x883a('0x28')][_0x883a('0x42')](_0x5aeee2)[_0x883a('0x22')](handleEntityNotFound(_0x126b33,null))[_0x883a('0x22')](respondWithResult(_0x126b33,null))[_0x883a('0x43')](handleError(_0x126b33,null));};exports['create']=function(_0x4419c1,_0x3e1b29){return db['FreshdeskConfiguration'][_0x883a('0x44')](_0x4419c1['body'],{})[_0x883a('0x22')](respondWithResult(_0x3e1b29,0xc9))[_0x883a('0x43')](handleError(_0x3e1b29,null));};exports[_0x883a('0x45')]=function(_0x2cf239,_0xa31114){if(_0x2cf239[_0x883a('0x46')]['id']){delete _0x2cf239[_0x883a('0x46')]['id'];}return db[_0x883a('0x28')][_0x883a('0x42')]({'where':{'id':_0x2cf239[_0x883a('0x41')]['id']}})[_0x883a('0x22')](handleEntityNotFound(_0xa31114,null))[_0x883a('0x22')](saveUpdates(_0x2cf239[_0x883a('0x46')],null))['then'](respondWithResult(_0xa31114,null))[_0x883a('0x43')](handleError(_0xa31114,null));};exports[_0x883a('0x23')]=function(_0x30bfeb,_0xe5bee1){return db['FreshdeskConfiguration'][_0x883a('0x42')]({'where':{'id':_0x30bfeb[_0x883a('0x41')]['id']}})[_0x883a('0x22')](handleEntityNotFound(_0xe5bee1,null))[_0x883a('0x22')](removeEntity(_0xe5bee1,null))['catch'](handleError(_0xe5bee1,null));};exports[_0x883a('0x47')]=function(_0x475ea0,_0x174d34,_0x22adb4){var _0x1ad496={};var _0x561068={};var _0x35986e;var _0x17b057;return db[_0x883a('0x28')][_0x883a('0x48')]({'where':{'id':_0x475ea0['params']['id']}})[_0x883a('0x22')](handleEntityNotFound(_0x174d34,null))[_0x883a('0x22')](function(_0x5c65f8){if(_0x5c65f8){_0x35986e=_0x5c65f8;_0x561068['model']=_[_0x883a('0x2d')](db[_0x883a('0x49')][_0x883a('0x29')]);_0x561068[_0x883a('0x2c')]=_[_0x883a('0x2d')](_0x475ea0[_0x883a('0x2c')]);_0x561068['filters']=_[_0x883a('0x2f')](_0x561068['model'],_0x561068[_0x883a('0x2c')]);_0x1ad496[_0x883a('0x2e')]=_['intersection'](_0x561068['model'],qs[_0x883a('0x30')](_0x475ea0[_0x883a('0x2c')]['fields']));_0x1ad496[_0x883a('0x2e')]=_0x1ad496[_0x883a('0x2e')][_0x883a('0x31')]?_0x1ad496[_0x883a('0x2e')]:_0x561068[_0x883a('0x2b')];_0x1ad496[_0x883a('0x33')]=qs[_0x883a('0x34')](_0x475ea0[_0x883a('0x2c')][_0x883a('0x34')]);_0x1ad496[_0x883a('0x35')]=qs[_0x883a('0x36')](_['pick'](_0x475ea0[_0x883a('0x2c')],_0x561068['filters']));if(_0x475ea0[_0x883a('0x2c')][_0x883a('0x38')]){_0x1ad496[_0x883a('0x35')]=_[_0x883a('0x39')](_0x1ad496[_0x883a('0x35')],{'$or':_['map'](_0x1ad496['attributes'],function(_0x4cf9a5){var _0x57149c={};_0x57149c[_0x4cf9a5]={'$like':'%'+_0x475ea0[_0x883a('0x2c')][_0x883a('0x38')]+'%'};return _0x57149c;})});}_0x1ad496=_['merge']({},_0x1ad496,_0x475ea0[_0x883a('0x3b')]);return _0x35986e[_0x883a('0x47')](_0x1ad496);}})[_0x883a('0x22')](function(_0x471191){if(_0x471191){_0x17b057=_0x471191[_0x883a('0x31')];if(!_0x475ea0[_0x883a('0x2c')][_0x883a('0x32')]('nolimit')){_0x1ad496[_0x883a('0x1a')]=qs[_0x883a('0x1a')](_0x475ea0[_0x883a('0x2c')]['limit']);_0x1ad496['offset']=qs['offset'](_0x475ea0[_0x883a('0x2c')][_0x883a('0x19')]);}return _0x35986e[_0x883a('0x47')](_0x1ad496);}})[_0x883a('0x22')](function(_0x324e54){if(_0x324e54){return _0x324e54?{'count':_0x17b057,'rows':_0x324e54}:null;}})['then'](respondWithResult(_0x174d34,null))[_0x883a('0x43')](handleError(_0x174d34,null));};exports[_0x883a('0x4a')]=function(_0x32d5da,_0x4f164e,_0xceb29a){var _0x49e925={};var _0x1f359f={};var _0x11e0b6;var _0x26d199;return db[_0x883a('0x28')][_0x883a('0x48')]({'where':{'id':_0x32d5da[_0x883a('0x41')]['id']}})[_0x883a('0x22')](handleEntityNotFound(_0x4f164e,null))[_0x883a('0x22')](function(_0x1b2026){if(_0x1b2026){_0x11e0b6=_0x1b2026;_0x1f359f[_0x883a('0x2b')]=_['keys'](db['FreshdeskField'][_0x883a('0x29')]);_0x1f359f[_0x883a('0x2c')]=_[_0x883a('0x2d')](_0x32d5da[_0x883a('0x2c')]);_0x1f359f[_0x883a('0x36')]=_[_0x883a('0x2f')](_0x1f359f[_0x883a('0x2b')],_0x1f359f[_0x883a('0x2c')]);_0x49e925[_0x883a('0x2e')]=_[_0x883a('0x2f')](_0x1f359f[_0x883a('0x2b')],qs[_0x883a('0x30')](_0x32d5da['query'][_0x883a('0x30')]));_0x49e925['attributes']=_0x49e925[_0x883a('0x2e')][_0x883a('0x31')]?_0x49e925['attributes']:_0x1f359f[_0x883a('0x2b')];_0x49e925[_0x883a('0x33')]=qs['sort'](_0x32d5da[_0x883a('0x2c')][_0x883a('0x34')]);_0x49e925[_0x883a('0x35')]=qs['filters'](_[_0x883a('0x37')](_0x32d5da[_0x883a('0x2c')],_0x1f359f[_0x883a('0x36')]));if(_0x32d5da[_0x883a('0x2c')][_0x883a('0x38')]){_0x49e925[_0x883a('0x35')]=_[_0x883a('0x39')](_0x49e925[_0x883a('0x35')],{'$or':_['map'](_0x49e925['attributes'],function(_0x675954){var _0x3a302c={};_0x3a302c[_0x675954]={'$like':'%'+_0x32d5da[_0x883a('0x2c')][_0x883a('0x38')]+'%'};return _0x3a302c;})});}_0x49e925=_[_0x883a('0x39')]({},_0x49e925,_0x32d5da['options']);return _0x11e0b6['getSubjects'](_0x49e925);}})[_0x883a('0x22')](function(_0x1bfc7d){if(_0x1bfc7d){_0x26d199=_0x1bfc7d[_0x883a('0x31')];if(!_0x32d5da[_0x883a('0x2c')][_0x883a('0x32')](_0x883a('0x4b'))){_0x49e925[_0x883a('0x1a')]=qs[_0x883a('0x1a')](_0x32d5da[_0x883a('0x2c')][_0x883a('0x1a')]);_0x49e925[_0x883a('0x19')]=qs[_0x883a('0x19')](_0x32d5da['query'][_0x883a('0x19')]);}return _0x11e0b6['getSubjects'](_0x49e925);}})[_0x883a('0x22')](function(_0x34a451){if(_0x34a451){return _0x34a451?{'count':_0x26d199,'rows':_0x34a451}:null;}})[_0x883a('0x22')](respondWithResult(_0x4f164e,null))['catch'](handleError(_0x4f164e,null));};exports[_0x883a('0x4c')]=function(_0x7843aa,_0x417751,_0x150f8b){var _0x463072={};var _0x5c0225={};var _0x451f68;var _0x1b2259;return db[_0x883a('0x28')][_0x883a('0x48')]({'where':{'id':_0x7843aa['params']['id']}})[_0x883a('0x22')](handleEntityNotFound(_0x417751,null))['then'](function(_0x1f7d7d){if(_0x1f7d7d){_0x451f68=_0x1f7d7d;_0x5c0225[_0x883a('0x2b')]=_[_0x883a('0x2d')](db['FreshdeskField'][_0x883a('0x29')]);_0x5c0225[_0x883a('0x2c')]=_[_0x883a('0x2d')](_0x7843aa[_0x883a('0x2c')]);_0x5c0225[_0x883a('0x36')]=_[_0x883a('0x2f')](_0x5c0225[_0x883a('0x2b')],_0x5c0225['query']);_0x463072[_0x883a('0x2e')]=_[_0x883a('0x2f')](_0x5c0225['model'],qs[_0x883a('0x30')](_0x7843aa[_0x883a('0x2c')][_0x883a('0x30')]));_0x463072[_0x883a('0x2e')]=_0x463072[_0x883a('0x2e')][_0x883a('0x31')]?_0x463072[_0x883a('0x2e')]:_0x5c0225[_0x883a('0x2b')];_0x463072[_0x883a('0x33')]=qs['sort'](_0x7843aa[_0x883a('0x2c')][_0x883a('0x34')]);_0x463072[_0x883a('0x35')]=qs[_0x883a('0x36')](_['pick'](_0x7843aa['query'],_0x5c0225['filters']));if(_0x7843aa[_0x883a('0x2c')][_0x883a('0x38')]){_0x463072['where']=_[_0x883a('0x39')](_0x463072[_0x883a('0x35')],{'$or':_[_0x883a('0x27')](_0x463072['attributes'],function(_0x49bd9f){var _0x25e2d7={};_0x25e2d7[_0x49bd9f]={'$like':'%'+_0x7843aa[_0x883a('0x2c')][_0x883a('0x38')]+'%'};return _0x25e2d7;})});}_0x463072=_['merge']({},_0x463072,_0x7843aa[_0x883a('0x3b')]);return _0x451f68[_0x883a('0x4c')](_0x463072);}})[_0x883a('0x22')](function(_0x382209){if(_0x382209){_0x1b2259=_0x382209['length'];if(!_0x7843aa['query'][_0x883a('0x32')](_0x883a('0x4b'))){_0x463072[_0x883a('0x1a')]=qs['limit'](_0x7843aa[_0x883a('0x2c')][_0x883a('0x1a')]);_0x463072[_0x883a('0x19')]=qs[_0x883a('0x19')](_0x7843aa[_0x883a('0x2c')]['offset']);}return _0x451f68[_0x883a('0x4c')](_0x463072);}})[_0x883a('0x22')](function(_0x5c310a){if(_0x5c310a){return _0x5c310a?{'count':_0x1b2259,'rows':_0x5c310a}:null;}})[_0x883a('0x22')](respondWithResult(_0x417751,null))[_0x883a('0x43')](handleError(_0x417751,null));};exports[_0x883a('0x4d')]=function(_0x374f9a,_0xb4398b,_0x42f160){var _0x2de5ec={};var _0x1b0ee9={};var _0x24163f;var _0x2d2666;return db[_0x883a('0x28')]['findOne']({'where':{'id':_0x374f9a['params']['id']}})[_0x883a('0x22')](handleEntityNotFound(_0xb4398b,null))['then'](function(_0x52f5dc){if(_0x52f5dc){_0x24163f=_0x52f5dc;_0x1b0ee9[_0x883a('0x2b')]=_[_0x883a('0x2d')](db[_0x883a('0x4e')][_0x883a('0x29')]);_0x1b0ee9['query']=_[_0x883a('0x2d')](_0x374f9a['query']);_0x1b0ee9[_0x883a('0x36')]=_['intersection'](_0x1b0ee9[_0x883a('0x2b')],_0x1b0ee9[_0x883a('0x2c')]);_0x2de5ec['attributes']=_[_0x883a('0x2f')](_0x1b0ee9[_0x883a('0x2b')],qs[_0x883a('0x30')](_0x374f9a['query'][_0x883a('0x30')]));_0x2de5ec[_0x883a('0x2e')]=_0x2de5ec[_0x883a('0x2e')][_0x883a('0x31')]?_0x2de5ec[_0x883a('0x2e')]:_0x1b0ee9[_0x883a('0x2b')];_0x2de5ec['order']=qs[_0x883a('0x34')](_0x374f9a[_0x883a('0x2c')]['sort']);_0x2de5ec[_0x883a('0x35')]=qs[_0x883a('0x36')](_[_0x883a('0x37')](_0x374f9a[_0x883a('0x2c')],_0x1b0ee9[_0x883a('0x36')]));if(_0x374f9a['query']['filter']){_0x2de5ec['where']=_[_0x883a('0x39')](_0x2de5ec[_0x883a('0x35')],{'$or':_[_0x883a('0x27')](_0x2de5ec[_0x883a('0x2e')],function(_0x8a4caf){var _0x84756f={};_0x84756f[_0x8a4caf]={'$like':'%'+_0x374f9a[_0x883a('0x2c')][_0x883a('0x38')]+'%'};return _0x84756f;})});}_0x2de5ec=_[_0x883a('0x39')]({},_0x2de5ec,_0x374f9a[_0x883a('0x3b')]);return _0x24163f['getTags'](_0x2de5ec);}})[_0x883a('0x22')](function(_0x37de5c){if(_0x37de5c){_0x2d2666=_0x37de5c['length'];if(!_0x374f9a[_0x883a('0x2c')]['hasOwnProperty'](_0x883a('0x4b'))){_0x2de5ec[_0x883a('0x1a')]=qs[_0x883a('0x1a')](_0x374f9a['query']['limit']);_0x2de5ec['offset']=qs[_0x883a('0x19')](_0x374f9a[_0x883a('0x2c')][_0x883a('0x19')]);}return _0x24163f[_0x883a('0x4d')](_0x2de5ec);}})[_0x883a('0x22')](function(_0x4576c2){if(_0x4576c2){return _0x4576c2?{'count':_0x2d2666,'rows':_0x4576c2}:null;}})[_0x883a('0x22')](respondWithResult(_0xb4398b,null))[_0x883a('0x43')](handleError(_0xb4398b,null));};exports['setTags']=function(_0x5a898d,_0x212fd7,_0x3531e0){if(_0x5a898d[_0x883a('0x46')]['id']){delete _0x5a898d['body']['id'];}return db[_0x883a('0x28')][_0x883a('0x48')]({'where':{'id':_0x5a898d['params']['id']}})['then'](handleEntityNotFound(_0x212fd7,null))[_0x883a('0x22')](function(_0x510229){if(_0x510229){return _0x510229[_0x883a('0x4f')](_0x5a898d[_0x883a('0x46')][_0x883a('0x50')]||[]);}return null;})[_0x883a('0x22')](respondWithResult(_0x212fd7,null))['catch'](handleError(_0x212fd7,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 3d35804..aa522e9 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 _0xe8e0=['../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','../../config/logger','api','moment','path','rimraf'];(function(_0xc891f5,_0x121631){var _0xc66bfd=function(_0x305ace){while(--_0x305ace){_0xc891f5['push'](_0xc891f5['shift']());}};_0xc66bfd(++_0x121631);}(_0xe8e0,0x8b));var _0x0e8e=function(_0x29dc39,_0x1b286f){_0x29dc39=_0x29dc39-0x0;var _0x2a1e0c=_0xe8e0[_0x29dc39];return _0x2a1e0c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0e8e('0x0'))(_0x0e8e('0x1'));var moment=require(_0x0e8e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e8e('0x3'));var rimraf=require(_0x0e8e('0x4'));var config=require(_0x0e8e('0x5'));var attributes=require(_0x0e8e('0x6'));module['exports']=function(_0x395bbe,_0x52b57d){return _0x395bbe[_0x0e8e('0x7')](_0x0e8e('0x8'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03fe=['exports','define','FreshdeskConfiguration','util','bluebird','path','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x4508d4,_0x2f0c03){var _0x7e5c89=function(_0x199e43){while(--_0x199e43){_0x4508d4['push'](_0x4508d4['shift']());}};_0x7e5c89(++_0x2f0c03);}(_0x03fe,0x14b));var _0xe03f=function(_0x2d1067,_0x84fa8c){_0x2d1067=_0x2d1067-0x0;var _0x4ca52f=_0x03fe[_0x2d1067];return _0x4ca52f;};'use strict';var _=require('lodash');var util=require(_0xe03f('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe03f('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe03f('0x2'));var rimraf=require('rimraf');var config=require(_0xe03f('0x3'));var attributes=require(_0xe03f('0x4'));module[_0xe03f('0x5')]=function(_0x4df81f,_0x5e570d){return _0x4df81f[_0xe03f('0x6')](_0xe03f('0x7'),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 f4444ec..1c8eb55 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 _0x6cf8=['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','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','then'];(function(_0x571d29,_0x3563ec){var _0x369217=function(_0x5cb831){while(--_0x5cb831){_0x571d29['push'](_0x571d29['shift']());}};_0x369217(++_0x3563ec);}(_0x6cf8,0x1ae));var _0x86cf=function(_0x4379ce,_0x122084){_0x4379ce=_0x4379ce-0x0;var _0x204067=_0x6cf8[_0x4379ce];return _0x204067;};'use strict';var _=require(_0x86cf('0x0'));var util=require(_0x86cf('0x1'));var moment=require(_0x86cf('0x2'));var BPromise=require(_0x86cf('0x3'));var rs=require(_0x86cf('0x4'));var fs=require('fs');var Redis=require(_0x86cf('0x5'));var db=require(_0x86cf('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x86cf('0x7'));var config=require('../../config/environment');var jayson=require(_0x86cf('0x8'));var client=jayson[_0x86cf('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d7f7b,_0x352841,_0x33d42a){return new BPromise(function(_0x133ac7,_0x3fda42){return client['request'](_0x2d7f7b,_0x33d42a)[_0x86cf('0xa')](function(_0x35bff3){logger[_0x86cf('0xb')](_0x86cf('0xc'),_0x352841,_0x86cf('0xd'));logger['debug'](_0x86cf('0xe'),_0x352841,_0x86cf('0xd'),JSON[_0x86cf('0xf')](_0x35bff3));if(_0x35bff3[_0x86cf('0x10')]){if(_0x35bff3[_0x86cf('0x10')][_0x86cf('0x11')]===0x1f4){logger[_0x86cf('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x352841,_0x35bff3[_0x86cf('0x10')][_0x86cf('0x12')]);return _0x3fda42(_0x35bff3[_0x86cf('0x10')][_0x86cf('0x12')]);}logger[_0x86cf('0x10')](_0x86cf('0xc'),_0x352841,_0x35bff3[_0x86cf('0x10')][_0x86cf('0x12')]);return _0x133ac7(_0x35bff3[_0x86cf('0x10')][_0x86cf('0x12')]);}else{logger[_0x86cf('0xb')](_0x86cf('0xc'),_0x352841,'request\x20sent');_0x133ac7(_0x35bff3[_0x86cf('0x13')][_0x86cf('0x12')]);}})[_0x86cf('0x14')](function(_0x2d4dae){logger[_0x86cf('0x10')](_0x86cf('0xc'),_0x352841,_0x2d4dae);_0x3fda42(_0x2d4dae);});});} \ No newline at end of file +var _0x87a9=['jayson/promise','client','http','then','request\x20sent','debug','stringify','code','error','message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x45fde6,_0x38b32a){var _0x15d807=function(_0x2eeb1b){while(--_0x2eeb1b){_0x45fde6['push'](_0x45fde6['shift']());}};_0x15d807(++_0x38b32a);}(_0x87a9,0x133));var _0x987a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x87a9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x987a('0x0'));var moment=require('moment');var BPromise=require(_0x987a('0x1'));var rs=require(_0x987a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x987a('0x3'))['db'];var utils=require(_0x987a('0x4'));var logger=require(_0x987a('0x5'))(_0x987a('0x6'));var config=require(_0x987a('0x7'));var jayson=require(_0x987a('0x8'));var client=jayson[_0x987a('0x9')][_0x987a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x216b14,_0x3cabe6,_0x2b6795){return new BPromise(function(_0x26df63,_0x108ff8){return client['request'](_0x216b14,_0x2b6795)[_0x987a('0xb')](function(_0xf295a9){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3cabe6,_0x987a('0xc'));logger[_0x987a('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3cabe6,_0x987a('0xc'),JSON[_0x987a('0xe')](_0xf295a9));if(_0xf295a9['error']){if(_0xf295a9['error'][_0x987a('0xf')]===0x1f4){logger[_0x987a('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3cabe6,_0xf295a9[_0x987a('0x10')]['message']);return _0x108ff8(_0xf295a9[_0x987a('0x10')]['message']);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3cabe6,_0xf295a9['error'][_0x987a('0x11')]);return _0x26df63(_0xf295a9['error'][_0x987a('0x11')]);}else{logger['info'](_0x987a('0x12'),_0x3cabe6,_0x987a('0xc'));_0x26df63(_0xf295a9[_0x987a('0x13')][_0x987a('0x11')]);}})[_0x987a('0x14')](function(_0x55046b){logger[_0x987a('0x10')](_0x987a('0x12'),_0x3cabe6,_0x55046b);_0x108ff8(_0x55046b);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 5f67155..c0201ed 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 _0x92ae=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','post','put','update','destroy','exports','multer','util'];(function(_0x19acdb,_0x545136){var _0x1b4b4d=function(_0x584f35){while(--_0x584f35){_0x19acdb['push'](_0x19acdb['shift']());}};_0x1b4b4d(++_0x545136);}(_0x92ae,0xb9));var _0xe92a=function(_0x56fb68,_0x2f1677){_0x56fb68=_0x56fb68-0x0;var _0x516712=_0x92ae[_0x56fb68];return _0x516712;};'use strict';var multer=require(_0xe92a('0x0'));var util=require(_0xe92a('0x1'));var path=require(_0xe92a('0x2'));var timeout=require('connect-timeout');var express=require(_0xe92a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe92a('0x4'));var interaction=require(_0xe92a('0x5'));var config=require(_0xe92a('0x6'));var controller=require(_0xe92a('0x7'));router[_0xe92a('0x8')]('/',auth[_0xe92a('0x9')](),controller[_0xe92a('0xa')]);router[_0xe92a('0x8')](_0xe92a('0xb'),auth[_0xe92a('0x9')](),controller['show']);router[_0xe92a('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe92a('0xd')]('/:id',auth[_0xe92a('0x9')](),controller[_0xe92a('0xe')]);router['delete'](_0xe92a('0xb'),auth[_0xe92a('0x9')](),controller[_0xe92a('0xf')]);module[_0xe92a('0x10')]=router; \ No newline at end of file +var _0x89e6=['../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x89e6,0x6c));var _0x689e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x89e6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x689e('0x0'));var path=require(_0x689e('0x1'));var timeout=require(_0x689e('0x2'));var express=require(_0x689e('0x3'));var router=express[_0x689e('0x4')]();var fs_extra=require(_0x689e('0x5'));var auth=require(_0x689e('0x6'));var interaction=require(_0x689e('0x7'));var config=require('../../config/environment');var controller=require(_0x689e('0x8'));router[_0x689e('0x9')]('/',auth[_0x689e('0xa')](),controller[_0x689e('0xb')]);router[_0x689e('0x9')](_0x689e('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x689e('0xd')]('/',auth[_0x689e('0xa')](),controller[_0x689e('0xe')]);router[_0x689e('0xf')](_0x689e('0xc'),auth[_0x689e('0xa')](),controller[_0x689e('0x10')]);router['delete'](_0x689e('0xc'),auth[_0x689e('0xa')](),controller[_0x689e('0x11')]);module[_0x689e('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 042c8ed..0f91cef 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 _0xafdf=['customVariable','keyValue','picklist','STRING','string','sequelize','exports','variable'];(function(_0x50f6fc,_0x13e677){var _0x12d956=function(_0x4b743a){while(--_0x4b743a){_0x50f6fc['push'](_0x50f6fc['shift']());}};_0x12d956(++_0x13e677);}(_0xafdf,0x6d));var _0xfafd=function(_0x550dfb,_0x1e09ce){_0x550dfb=_0x550dfb-0x0;var _0x25a268=_0xafdf[_0x550dfb];return _0x25a268;};'use strict';var Sequelize=require(_0xfafd('0x0'));module[_0xfafd('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xfafd('0x2'),_0xfafd('0x3'),_0xfafd('0x4'),_0xfafd('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfafd('0x6')]},'key':{'type':Sequelize[_0xfafd('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xfafd('0x7'),_0xfafd('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xfafd('0x6')]},'nameField':{'type':Sequelize[_0xfafd('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfafd('0x6')]}}; \ No newline at end of file +var _0x7c0f=['string','keyValue','picklist','STRING','ENUM','variable','BOOLEAN','sequelize','exports'];(function(_0x595bd1,_0xb1e7a){var _0xd0344f=function(_0x5eb2fd){while(--_0x5eb2fd){_0x595bd1['push'](_0x595bd1['shift']());}};_0xd0344f(++_0xb1e7a);}(_0x7c0f,0x130));var _0xf7c0=function(_0x360896,_0x594187){_0x360896=_0x360896-0x0;var _0x43515c=_0x7c0f[_0x360896];return _0x43515c;};'use strict';var Sequelize=require(_0xf7c0('0x0'));module[_0xf7c0('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf7c0('0x2'),'variable','customVariable',_0xf7c0('0x3'),_0xf7c0('0x4')),'defaultValue':_0xf7c0('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf7c0('0x5')]},'keyType':{'type':Sequelize[_0xf7c0('0x6')](_0xf7c0('0x2'),_0xf7c0('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xf7c0('0x5')]},'idField':{'type':Sequelize[_0xf7c0('0x5')]},'nameField':{'type':Sequelize[_0xf7c0('0x5')]},'customField':{'type':Sequelize[_0xf7c0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf7c0('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 365e0f9..405331b 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 _0xa588=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','FreshdeskField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x134a53,_0x233471){var _0x30d377=function(_0x981d0f){while(--_0x981d0f){_0x134a53['push'](_0x134a53['shift']());}};_0x30d377(++_0x233471);}(_0xa588,0xe1));var _0x8a58=function(_0x1d9591,_0x1963cf){_0x1d9591=_0x1d9591-0x0;var _0xdae86a=_0xa588[_0x1d9591];return _0xdae86a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a58('0x0'));var zipdir=require(_0x8a58('0x1'));var jsonpatch=require(_0x8a58('0x2'));var rp=require(_0x8a58('0x3'));var moment=require(_0x8a58('0x4'));var BPromise=require(_0x8a58('0x5'));var Mustache=require(_0x8a58('0x6'));var util=require(_0x8a58('0x7'));var path=require(_0x8a58('0x8'));var sox=require('sox');var csv=require(_0x8a58('0x9'));var ejs=require(_0x8a58('0xa'));var fs=require('fs');var fs_extra=require(_0x8a58('0xb'));var _=require(_0x8a58('0xc'));var squel=require(_0x8a58('0xd'));var crypto=require(_0x8a58('0xe'));var jsforce=require(_0x8a58('0xf'));var deskjs=require(_0x8a58('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8a58('0x11'));var Papa=require(_0x8a58('0x12'));var Redis=require(_0x8a58('0x13'));var authService=require(_0x8a58('0x14'));var qs=require(_0x8a58('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a58('0x16'));var logger=require(_0x8a58('0x17'))(_0x8a58('0x18'));var utils=require(_0x8a58('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8a58('0x1a'))['db'];function respondWithStatusCode(_0x5ec103,_0x21208d){_0x21208d=_0x21208d||0xcc;return function(_0xc5d2fa){if(_0xc5d2fa){return _0x5ec103['sendStatus'](_0x21208d);}return _0x5ec103[_0x8a58('0x1b')](_0x21208d)[_0x8a58('0x1c')]();};}function respondWithResult(_0x56a61d,_0x3d40a5){_0x3d40a5=_0x3d40a5||0xc8;return function(_0x268506){if(_0x268506){return _0x56a61d['status'](_0x3d40a5)[_0x8a58('0x1d')](_0x268506);}};}function respondWithFilteredResult(_0x18a33c,_0x3010ae){return function(_0x3ff39e){if(_0x3ff39e){var _0x26e3a8=typeof _0x3010ae[_0x8a58('0x1e')]===_0x8a58('0x1f')&&typeof _0x3010ae['limit']==='undefined';var _0x31de8d=_0x3ff39e[_0x8a58('0x20')];var _0x18a14d=_0x26e3a8?0x0:_0x3010ae['offset'];var _0x282f2d=_0x26e3a8?_0x3ff39e[_0x8a58('0x20')]:_0x3010ae['offset']+_0x3010ae[_0x8a58('0x21')];var _0x15b527;if(_0x282f2d>=_0x31de8d){_0x282f2d=_0x31de8d;_0x15b527=0xc8;}else{_0x15b527=0xce;}_0x18a33c[_0x8a58('0x1b')](_0x15b527);return _0x18a33c[_0x8a58('0x22')](_0x8a58('0x23'),_0x18a14d+'-'+_0x282f2d+'/'+_0x31de8d)[_0x8a58('0x1d')](_0x3ff39e);}return null;};}function patchUpdates(_0x284bb8){return function(_0x115e19){try{jsonpatch[_0x8a58('0x24')](_0x115e19,_0x284bb8,!![]);}catch(_0xbf556a){return BPromise[_0x8a58('0x25')](_0xbf556a);}return _0x115e19[_0x8a58('0x26')]();};}function saveUpdates(_0x3758fa,_0x34adb8){return function(_0x561a9a){if(_0x561a9a){return _0x561a9a[_0x8a58('0x27')](_0x3758fa)[_0x8a58('0x28')](function(_0x20a6c5){return _0x20a6c5;});}return null;};}function removeEntity(_0x3f07ab,_0x22c898){return function(_0x415946){if(_0x415946){return _0x415946[_0x8a58('0x29')]()['then'](function(){_0x3f07ab[_0x8a58('0x1b')](0xcc)[_0x8a58('0x1c')]();});}};}function handleEntityNotFound(_0x30c96b,_0x24e780){return function(_0x4fb0fb){if(!_0x4fb0fb){_0x30c96b[_0x8a58('0x2a')](0x194);}return _0x4fb0fb;};}function handleError(_0x6b5cbf,_0x231dae){_0x231dae=_0x231dae||0x1f4;return function(_0x4d4835){logger[_0x8a58('0x2b')](_0x4d4835[_0x8a58('0x2c')]);if(_0x4d4835[_0x8a58('0x2d')]){delete _0x4d4835[_0x8a58('0x2d')];}_0x6b5cbf[_0x8a58('0x1b')](_0x231dae)[_0x8a58('0x2e')](_0x4d4835);};}exports[_0x8a58('0x2f')]=function(_0x4d5041,_0x433060){var _0x4ef1eb={},_0x501aa1={},_0x5e7265={'count':0x0,'rows':[]};var _0x4cfc96=_['map'](db[_0x8a58('0x30')][_0x8a58('0x31')],function(_0x1b2d9e){return{'name':_0x1b2d9e[_0x8a58('0x32')],'type':_0x1b2d9e[_0x8a58('0x33')][_0x8a58('0x34')]};});_0x501aa1[_0x8a58('0x35')]=_[_0x8a58('0x36')](_0x4cfc96,_0x8a58('0x2d'));_0x501aa1[_0x8a58('0x37')]=_[_0x8a58('0x38')](_0x4d5041[_0x8a58('0x37')]);_0x501aa1[_0x8a58('0x39')]=_['intersection'](_0x501aa1[_0x8a58('0x35')],_0x501aa1[_0x8a58('0x37')]);_0x4ef1eb[_0x8a58('0x3a')]=_[_0x8a58('0x3b')](_0x501aa1[_0x8a58('0x35')],qs[_0x8a58('0x3c')](_0x4d5041['query'][_0x8a58('0x3c')]));_0x4ef1eb[_0x8a58('0x3a')]=_0x4ef1eb[_0x8a58('0x3a')][_0x8a58('0x3d')]?_0x4ef1eb[_0x8a58('0x3a')]:_0x501aa1[_0x8a58('0x35')];if(!_0x4d5041[_0x8a58('0x37')]['hasOwnProperty'](_0x8a58('0x3e'))){_0x4ef1eb[_0x8a58('0x21')]=qs[_0x8a58('0x21')](_0x4d5041['query']['limit']);_0x4ef1eb['offset']=qs[_0x8a58('0x1e')](_0x4d5041[_0x8a58('0x37')][_0x8a58('0x1e')]);}_0x4ef1eb[_0x8a58('0x3f')]=qs['sort'](_0x4d5041[_0x8a58('0x37')][_0x8a58('0x40')]);_0x4ef1eb[_0x8a58('0x41')]=qs[_0x8a58('0x39')](_['pick'](_0x4d5041[_0x8a58('0x37')],_0x501aa1[_0x8a58('0x39')]),_0x4cfc96);if(_0x4d5041['query'][_0x8a58('0x42')]){_0x4ef1eb[_0x8a58('0x41')]=_[_0x8a58('0x43')](_0x4ef1eb[_0x8a58('0x41')],{'$or':_[_0x8a58('0x36')](_0x4cfc96,function(_0x122e0f){if(_0x122e0f['type']!=='VIRTUAL'){var _0x3afb2b={};_0x3afb2b[_0x122e0f[_0x8a58('0x2d')]]={'$like':'%'+_0x4d5041['query'][_0x8a58('0x42')]+'%'};return _0x3afb2b;}})});}_0x4ef1eb=_[_0x8a58('0x43')]({},_0x4ef1eb,_0x4d5041[_0x8a58('0x44')]);var _0x3dfd34={'where':_0x4ef1eb[_0x8a58('0x41')]};return db['FreshdeskField'][_0x8a58('0x20')](_0x3dfd34)['then'](function(_0x2ad76a){_0x5e7265[_0x8a58('0x20')]=_0x2ad76a;if(_0x4d5041[_0x8a58('0x37')][_0x8a58('0x45')]){_0x4ef1eb[_0x8a58('0x46')]=[{'all':!![]}];}return db[_0x8a58('0x30')][_0x8a58('0x47')](_0x4ef1eb);})['then'](function(_0x5cd9d8){_0x5e7265[_0x8a58('0x48')]=_0x5cd9d8;return _0x5e7265;})['then'](respondWithFilteredResult(_0x433060,_0x4ef1eb))['catch'](handleError(_0x433060,null));};exports[_0x8a58('0x49')]=function(_0x8a79f2,_0x299806){var _0x573cd3={'raw':!![],'where':{'id':_0x8a79f2[_0x8a58('0x4a')]['id']}},_0x56a410={};_0x56a410['model']=_[_0x8a58('0x38')](db[_0x8a58('0x30')][_0x8a58('0x31')]);_0x56a410[_0x8a58('0x37')]=_['keys'](_0x8a79f2[_0x8a58('0x37')]);_0x56a410[_0x8a58('0x39')]=_['intersection'](_0x56a410[_0x8a58('0x35')],_0x56a410[_0x8a58('0x37')]);_0x573cd3[_0x8a58('0x3a')]=_[_0x8a58('0x3b')](_0x56a410['model'],qs[_0x8a58('0x3c')](_0x8a79f2['query'][_0x8a58('0x3c')]));_0x573cd3[_0x8a58('0x3a')]=_0x573cd3['attributes'][_0x8a58('0x3d')]?_0x573cd3['attributes']:_0x56a410['model'];if(_0x8a79f2[_0x8a58('0x37')][_0x8a58('0x45')]){_0x573cd3[_0x8a58('0x46')]=[{'all':!![]}];}_0x573cd3=_[_0x8a58('0x43')]({},_0x573cd3,_0x8a79f2[_0x8a58('0x44')]);return db[_0x8a58('0x30')]['find'](_0x573cd3)['then'](handleEntityNotFound(_0x299806,null))[_0x8a58('0x28')](respondWithResult(_0x299806,null))[_0x8a58('0x4b')](handleError(_0x299806,null));};exports[_0x8a58('0x4c')]=function(_0x19682c,_0x1ec51b){return db[_0x8a58('0x30')][_0x8a58('0x4c')](_0x19682c[_0x8a58('0x4d')],{})[_0x8a58('0x28')](respondWithResult(_0x1ec51b,0xc9))[_0x8a58('0x4b')](handleError(_0x1ec51b,null));};exports[_0x8a58('0x27')]=function(_0x392c32,_0x1ea824){if(_0x392c32[_0x8a58('0x4d')]['id']){delete _0x392c32['body']['id'];}return db[_0x8a58('0x30')][_0x8a58('0x4e')]({'where':{'id':_0x392c32[_0x8a58('0x4a')]['id']}})[_0x8a58('0x28')](handleEntityNotFound(_0x1ea824,null))[_0x8a58('0x28')](saveUpdates(_0x392c32[_0x8a58('0x4d')],null))[_0x8a58('0x28')](respondWithResult(_0x1ea824,null))['catch'](handleError(_0x1ea824,null));};exports['destroy']=function(_0x5ab682,_0x31e12a){return db[_0x8a58('0x30')][_0x8a58('0x4e')]({'where':{'id':_0x5ab682['params']['id']}})[_0x8a58('0x28')](handleEntityNotFound(_0x31e12a,null))[_0x8a58('0x28')](removeEntity(_0x31e12a,null))[_0x8a58('0x4b')](handleError(_0x31e12a,null));}; \ No newline at end of file +var _0x55ea=['sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','index','FreshdeskField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','params','keys','length','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x55ea,0xc9));var _0xa55e=function(_0x13f3bb,_0xdde46e){_0x13f3bb=_0x13f3bb-0x0;var _0xf21025=_0x55ea[_0x13f3bb];return _0xf21025;};'use strict';var emlformat=require(_0xa55e('0x0'));var rimraf=require(_0xa55e('0x1'));var zipdir=require(_0xa55e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa55e('0x3'));var moment=require(_0xa55e('0x4'));var BPromise=require(_0xa55e('0x5'));var Mustache=require(_0xa55e('0x6'));var util=require(_0xa55e('0x7'));var path=require('path');var sox=require(_0xa55e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa55e('0x9'));var crypto=require(_0xa55e('0xa'));var jsforce=require(_0xa55e('0xb'));var deskjs=require(_0xa55e('0xc'));var toCsv=require(_0xa55e('0xd'));var querystring=require(_0xa55e('0xe'));var Papa=require(_0xa55e('0xf'));var Redis=require(_0xa55e('0x10'));var authService=require(_0xa55e('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa55e('0x12'));var logger=require(_0xa55e('0x13'))(_0xa55e('0x14'));var utils=require(_0xa55e('0x15'));var config=require(_0xa55e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa55e('0x17'))['db'];function respondWithStatusCode(_0x5b69cc,_0x3f5178){_0x3f5178=_0x3f5178||0xcc;return function(_0x1d45c1){if(_0x1d45c1){return _0x5b69cc[_0xa55e('0x18')](_0x3f5178);}return _0x5b69cc[_0xa55e('0x19')](_0x3f5178)[_0xa55e('0x1a')]();};}function respondWithResult(_0x20e138,_0x15a283){_0x15a283=_0x15a283||0xc8;return function(_0x27746c){if(_0x27746c){return _0x20e138[_0xa55e('0x19')](_0x15a283)['json'](_0x27746c);}};}function respondWithFilteredResult(_0x1fcee6,_0x30738d){return function(_0x25fa30){if(_0x25fa30){var _0x12895e=typeof _0x30738d[_0xa55e('0x1b')]===_0xa55e('0x1c')&&typeof _0x30738d['limit']===_0xa55e('0x1c');var _0x5dbfe6=_0x25fa30['count'];var _0x4599b9=_0x12895e?0x0:_0x30738d[_0xa55e('0x1b')];var _0x30854e=_0x12895e?_0x25fa30[_0xa55e('0x1d')]:_0x30738d[_0xa55e('0x1b')]+_0x30738d['limit'];var _0x42d2d0;if(_0x30854e>=_0x5dbfe6){_0x30854e=_0x5dbfe6;_0x42d2d0=0xc8;}else{_0x42d2d0=0xce;}_0x1fcee6['status'](_0x42d2d0);return _0x1fcee6['set'](_0xa55e('0x1e'),_0x4599b9+'-'+_0x30854e+'/'+_0x5dbfe6)[_0xa55e('0x1f')](_0x25fa30);}return null;};}function patchUpdates(_0x262f6c){return function(_0x1033c0){try{jsonpatch[_0xa55e('0x20')](_0x1033c0,_0x262f6c,!![]);}catch(_0x438707){return BPromise[_0xa55e('0x21')](_0x438707);}return _0x1033c0[_0xa55e('0x22')]();};}function saveUpdates(_0x9594a3,_0x5b0e74){return function(_0x53a2f9){if(_0x53a2f9){return _0x53a2f9[_0xa55e('0x23')](_0x9594a3)['then'](function(_0xaaf2f1){return _0xaaf2f1;});}return null;};}function removeEntity(_0x31c4ac,_0x801fec){return function(_0x2842a6){if(_0x2842a6){return _0x2842a6[_0xa55e('0x24')]()[_0xa55e('0x25')](function(){_0x31c4ac[_0xa55e('0x19')](0xcc)[_0xa55e('0x1a')]();});}};}function handleEntityNotFound(_0x231333,_0x3627e8){return function(_0x3c519d){if(!_0x3c519d){_0x231333[_0xa55e('0x18')](0x194);}return _0x3c519d;};}function handleError(_0xa05c41,_0x25142c){_0x25142c=_0x25142c||0x1f4;return function(_0xa57293){logger[_0xa55e('0x26')](_0xa57293[_0xa55e('0x27')]);if(_0xa57293[_0xa55e('0x28')]){delete _0xa57293[_0xa55e('0x28')];}_0xa05c41['status'](_0x25142c)['send'](_0xa57293);};}exports[_0xa55e('0x29')]=function(_0x4ebcbd,_0x286f95){var _0x58fc30={},_0x2fe4e9={},_0x4d9634={'count':0x0,'rows':[]};var _0x2758ca=_['map'](db[_0xa55e('0x2a')][_0xa55e('0x2b')],function(_0x4a03ef){return{'name':_0x4a03ef[_0xa55e('0x2c')],'type':_0x4a03ef[_0xa55e('0x2d')][_0xa55e('0x2e')]};});_0x2fe4e9[_0xa55e('0x2f')]=_['map'](_0x2758ca,_0xa55e('0x28'));_0x2fe4e9[_0xa55e('0x30')]=_['keys'](_0x4ebcbd[_0xa55e('0x30')]);_0x2fe4e9[_0xa55e('0x31')]=_[_0xa55e('0x32')](_0x2fe4e9[_0xa55e('0x2f')],_0x2fe4e9['query']);_0x58fc30[_0xa55e('0x33')]=_['intersection'](_0x2fe4e9[_0xa55e('0x2f')],qs['fields'](_0x4ebcbd[_0xa55e('0x30')][_0xa55e('0x34')]));_0x58fc30[_0xa55e('0x33')]=_0x58fc30[_0xa55e('0x33')]['length']?_0x58fc30[_0xa55e('0x33')]:_0x2fe4e9['model'];if(!_0x4ebcbd[_0xa55e('0x30')][_0xa55e('0x35')](_0xa55e('0x36'))){_0x58fc30['limit']=qs[_0xa55e('0x37')](_0x4ebcbd[_0xa55e('0x30')][_0xa55e('0x37')]);_0x58fc30[_0xa55e('0x1b')]=qs[_0xa55e('0x1b')](_0x4ebcbd[_0xa55e('0x30')]['offset']);}_0x58fc30['order']=qs[_0xa55e('0x38')](_0x4ebcbd[_0xa55e('0x30')][_0xa55e('0x38')]);_0x58fc30[_0xa55e('0x39')]=qs[_0xa55e('0x31')](_[_0xa55e('0x3a')](_0x4ebcbd[_0xa55e('0x30')],_0x2fe4e9['filters']),_0x2758ca);if(_0x4ebcbd['query'][_0xa55e('0x3b')]){_0x58fc30[_0xa55e('0x39')]=_[_0xa55e('0x3c')](_0x58fc30[_0xa55e('0x39')],{'$or':_[_0xa55e('0x3d')](_0x2758ca,function(_0x41444d){if(_0x41444d[_0xa55e('0x2d')]!==_0xa55e('0x3e')){var _0x29e0c2={};_0x29e0c2[_0x41444d[_0xa55e('0x28')]]={'$like':'%'+_0x4ebcbd[_0xa55e('0x30')]['filter']+'%'};return _0x29e0c2;}})});}_0x58fc30=_[_0xa55e('0x3c')]({},_0x58fc30,_0x4ebcbd[_0xa55e('0x3f')]);var _0x2982db={'where':_0x58fc30['where']};return db[_0xa55e('0x2a')]['count'](_0x2982db)[_0xa55e('0x25')](function(_0x4e97de){_0x4d9634[_0xa55e('0x1d')]=_0x4e97de;if(_0x4ebcbd[_0xa55e('0x30')][_0xa55e('0x40')]){_0x58fc30[_0xa55e('0x41')]=[{'all':!![]}];}return db[_0xa55e('0x2a')]['findAll'](_0x58fc30);})['then'](function(_0x3d9fe9){_0x4d9634[_0xa55e('0x42')]=_0x3d9fe9;return _0x4d9634;})[_0xa55e('0x25')](respondWithFilteredResult(_0x286f95,_0x58fc30))['catch'](handleError(_0x286f95,null));};exports[_0xa55e('0x43')]=function(_0x2d4d27,_0x1c7d18){var _0xb43d62={'raw':!![],'where':{'id':_0x2d4d27[_0xa55e('0x44')]['id']}},_0x43c887={};_0x43c887[_0xa55e('0x2f')]=_[_0xa55e('0x45')](db['FreshdeskField']['rawAttributes']);_0x43c887[_0xa55e('0x30')]=_[_0xa55e('0x45')](_0x2d4d27[_0xa55e('0x30')]);_0x43c887[_0xa55e('0x31')]=_[_0xa55e('0x32')](_0x43c887[_0xa55e('0x2f')],_0x43c887[_0xa55e('0x30')]);_0xb43d62[_0xa55e('0x33')]=_['intersection'](_0x43c887['model'],qs[_0xa55e('0x34')](_0x2d4d27['query'][_0xa55e('0x34')]));_0xb43d62['attributes']=_0xb43d62['attributes'][_0xa55e('0x46')]?_0xb43d62[_0xa55e('0x33')]:_0x43c887['model'];if(_0x2d4d27['query'][_0xa55e('0x40')]){_0xb43d62[_0xa55e('0x41')]=[{'all':!![]}];}_0xb43d62=_[_0xa55e('0x3c')]({},_0xb43d62,_0x2d4d27[_0xa55e('0x3f')]);return db[_0xa55e('0x2a')][_0xa55e('0x47')](_0xb43d62)['then'](handleEntityNotFound(_0x1c7d18,null))['then'](respondWithResult(_0x1c7d18,null))[_0xa55e('0x48')](handleError(_0x1c7d18,null));};exports[_0xa55e('0x49')]=function(_0x31458d,_0x259cb3){return db[_0xa55e('0x2a')][_0xa55e('0x49')](_0x31458d['body'],{})[_0xa55e('0x25')](respondWithResult(_0x259cb3,0xc9))[_0xa55e('0x48')](handleError(_0x259cb3,null));};exports[_0xa55e('0x23')]=function(_0x1de3a8,_0x338018){if(_0x1de3a8[_0xa55e('0x4a')]['id']){delete _0x1de3a8['body']['id'];}return db['FreshdeskField'][_0xa55e('0x47')]({'where':{'id':_0x1de3a8['params']['id']}})[_0xa55e('0x25')](handleEntityNotFound(_0x338018,null))['then'](saveUpdates(_0x1de3a8[_0xa55e('0x4a')],null))[_0xa55e('0x25')](respondWithResult(_0x338018,null))[_0xa55e('0x48')](handleError(_0x338018,null));};exports[_0xa55e('0x24')]=function(_0x2c35a8,_0x63aa32){return db[_0xa55e('0x2a')][_0xa55e('0x47')]({'where':{'id':_0x2c35a8['params']['id']}})[_0xa55e('0x25')](handleEntityNotFound(_0x63aa32,null))[_0xa55e('0x25')](removeEntity(_0x63aa32,null))[_0xa55e('0x48')](handleError(_0x63aa32,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 545a1ab..80fe826 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 _0xb721=['request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','idField','FieldId','api','moment','bluebird'];(function(_0x206856,_0xcc7da4){var _0x490ef6=function(_0xeba08c){while(--_0xeba08c){_0x206856['push'](_0x206856['shift']());}};_0x490ef6(++_0xcc7da4);}(_0xb721,0x169));var _0x1b72=function(_0x4001ad,_0x1e22dd){_0x4001ad=_0x4001ad-0x0;var _0x4c7ec2=_0xb721[_0x4001ad];return _0x4c7ec2;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1b72('0x0'));var moment=require(_0x1b72('0x1'));var BPromise=require(_0x1b72('0x2'));var rp=require(_0x1b72('0x3'));var fs=require('fs');var path=require(_0x1b72('0x4'));var rimraf=require(_0x1b72('0x5'));var config=require(_0x1b72('0x6'));var attributes=require(_0x1b72('0x7'));module[_0x1b72('0x8')]=function(_0x2b3f8e,_0x48204d){return _0x2b3f8e['define'](_0x1b72('0x9'),attributes,{'tableName':_0x1b72('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x1b72('0xb'),_0x1b72('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x83b2=['util','../../config/logger','api','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash'];(function(_0x3e1e97,_0x3385d8){var _0x3c63ff=function(_0x34f46a){while(--_0x34f46a){_0x3e1e97['push'](_0x3e1e97['shift']());}};_0x3c63ff(++_0x3385d8);}(_0x83b2,0x110));var _0x283b=function(_0x25b380,_0x470194){_0x25b380=_0x25b380-0x0;var _0x343d82=_0x83b2[_0x25b380];return _0x343d82;};'use strict';var _=require(_0x283b('0x0'));var util=require(_0x283b('0x1'));var logger=require(_0x283b('0x2'))(_0x283b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x283b('0x4'));var rimraf=require(_0x283b('0x5'));var config=require(_0x283b('0x6'));var attributes=require(_0x283b('0x7'));module[_0x283b('0x8')]=function(_0x5ae354,_0x14944c){return _0x5ae354[_0x283b('0x9')]('FreshdeskField',attributes,{'tableName':_0x283b('0xa'),'paranoid':![],'indexes':[{'name':_0x283b('0xb'),'fields':['idField',_0x283b('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 8cd29f0..a2f2f84 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 _0x4fd4=['FreshdeskField,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4fd4,0x183));var _0x44fd=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4fd4[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x44fd('0x0'));var util=require('util');var moment=require(_0x44fd('0x1'));var BPromise=require(_0x44fd('0x2'));var rs=require(_0x44fd('0x3'));var fs=require('fs');var Redis=require(_0x44fd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x44fd('0x5'));var logger=require(_0x44fd('0x6'))(_0x44fd('0x7'));var config=require('../../config/environment');var jayson=require(_0x44fd('0x8'));var client=jayson[_0x44fd('0x9')][_0x44fd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44c5bc,_0x4d7d67,_0x15731b){return new BPromise(function(_0xac66f1,_0x3604f6){return client['request'](_0x44c5bc,_0x15731b)['then'](function(_0x495d92){logger[_0x44fd('0xb')](_0x44fd('0xc'),_0x4d7d67,'request\x20sent');logger['debug']('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x4d7d67,_0x44fd('0xd'),JSON[_0x44fd('0xe')](_0x495d92));if(_0x495d92['error']){if(_0x495d92[_0x44fd('0xf')]['code']===0x1f4){logger[_0x44fd('0xf')](_0x44fd('0xc'),_0x4d7d67,_0x495d92[_0x44fd('0xf')][_0x44fd('0x10')]);return _0x3604f6(_0x495d92[_0x44fd('0xf')][_0x44fd('0x10')]);}logger[_0x44fd('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x4d7d67,_0x495d92[_0x44fd('0xf')][_0x44fd('0x10')]);return _0xac66f1(_0x495d92[_0x44fd('0xf')][_0x44fd('0x10')]);}else{logger['info'](_0x44fd('0xc'),_0x4d7d67,_0x44fd('0xd'));_0xac66f1(_0x495d92[_0x44fd('0x11')][_0x44fd('0x10')]);}})[_0x44fd('0x12')](function(_0x5c6edb){logger['error'](_0x44fd('0xc'),_0x4d7d67,_0x5c6edb);_0x3604f6(_0x5c6edb);});});} \ No newline at end of file +var _0x959a=['FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x11f0e1,_0x520662){var _0x383b23=function(_0x397ed4){while(--_0x397ed4){_0x11f0e1['push'](_0x11f0e1['shift']());}};_0x383b23(++_0x520662);}(_0x959a,0x133));var _0xa959=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x959a[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xa959('0x0'));var util=require(_0xa959('0x1'));var moment=require(_0xa959('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa959('0x3'));var db=require(_0xa959('0x4'))['db'];var utils=require(_0xa959('0x5'));var logger=require(_0xa959('0x6'))(_0xa959('0x7'));var config=require(_0xa959('0x8'));var jayson=require(_0xa959('0x9'));var client=jayson[_0xa959('0xa')][_0xa959('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb53746,_0x5a5177,_0x4d6c3b){return new BPromise(function(_0x1db248,_0x3fd74c){return client[_0xa959('0xc')](_0xb53746,_0x4d6c3b)[_0xa959('0xd')](function(_0x54d6ec){logger[_0xa959('0xe')](_0xa959('0xf'),_0x5a5177,'request\x20sent');logger['debug'](_0xa959('0x10'),_0x5a5177,_0xa959('0x11'),JSON[_0xa959('0x12')](_0x54d6ec));if(_0x54d6ec[_0xa959('0x13')]){if(_0x54d6ec[_0xa959('0x13')]['code']===0x1f4){logger[_0xa959('0x13')](_0xa959('0xf'),_0x5a5177,_0x54d6ec[_0xa959('0x13')][_0xa959('0x14')]);return _0x3fd74c(_0x54d6ec[_0xa959('0x13')][_0xa959('0x14')]);}logger['error'](_0xa959('0xf'),_0x5a5177,_0x54d6ec[_0xa959('0x13')]['message']);return _0x1db248(_0x54d6ec['error']['message']);}else{logger[_0xa959('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x5a5177,'request\x20sent');_0x1db248(_0x54d6ec[_0xa959('0x15')][_0xa959('0x14')]);}})[_0xa959('0x16')](function(_0x37d68d){logger[_0xa959('0x13')](_0xa959('0xf'),_0x5a5177,_0x37d68d);_0x3fd74c(_0x37d68d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index d6ec5f1..ba2d209 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 _0xde2c=['getFields','post','/:id/configurations','addConfiguration','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields'];(function(_0x4f4512,_0x2e7ae2){var _0x54aec2=function(_0x11ca21){while(--_0x11ca21){_0x4f4512['push'](_0x4f4512['shift']());}};_0x54aec2(++_0x2e7ae2);}(_0xde2c,0x7f));var _0xcde2=function(_0x423097,_0x8a09f4){_0x423097=_0x423097-0x0;var _0x3a73f1=_0xde2c[_0x423097];return _0x3a73f1;};'use strict';var multer=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var path=require(_0xcde2('0x2'));var timeout=require(_0xcde2('0x3'));var express=require(_0xcde2('0x4'));var router=express[_0xcde2('0x5')]();var fs_extra=require(_0xcde2('0x6'));var auth=require(_0xcde2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcde2('0x8'));var controller=require(_0xcde2('0x9'));router[_0xcde2('0xa')]('/',auth[_0xcde2('0xb')](),controller[_0xcde2('0xc')]);router['get'](_0xcde2('0xd'),auth[_0xcde2('0xb')](),controller[_0xcde2('0xe')]);router['get']('/:id/configurations',auth[_0xcde2('0xb')](),controller[_0xcde2('0xf')]);router['get'](_0xcde2('0x10'),auth[_0xcde2('0xb')](),controller[_0xcde2('0x11')]);router[_0xcde2('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcde2('0x12')](_0xcde2('0x13'),auth[_0xcde2('0xb')](),controller[_0xcde2('0x14')]);router[_0xcde2('0x15')](_0xcde2('0xd'),auth['isAuthenticated'](),controller[_0xcde2('0x16')]);router['delete'](_0xcde2('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xcde2('0x17')]=router; \ No newline at end of file +var _0x1be1=['getFields','post','create','addConfiguration','/:id','delete','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','show','/:id/configurations','/:id/fields'];(function(_0x1bc05b,_0x4b416a){var _0x2e2f65=function(_0x2f066d){while(--_0x2f066d){_0x1bc05b['push'](_0x1bc05b['shift']());}};_0x2e2f65(++_0x4b416a);}(_0x1be1,0x192));var _0x11be=function(_0x3cf0c5,_0x30aeb8){_0x3cf0c5=_0x3cf0c5-0x0;var _0x3a56bb=_0x1be1[_0x3cf0c5];return _0x3a56bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require('../../config/environment');var controller=require(_0x11be('0x6'));router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller['index']);router[_0x11be('0x7')]('/:id',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller['getConfigurations']);router[_0x11be('0x7')](_0x11be('0xb'),auth['isAuthenticated'](),controller[_0x11be('0xc')]);router[_0x11be('0xd')]('/',auth[_0x11be('0x8')](),controller[_0x11be('0xe')]);router['post'](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xf')]);router['put'](_0x11be('0x10'),auth[_0x11be('0x8')](),controller['update']);router[_0x11be('0x11')]('/:id',auth['isAuthenticated'](),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 69ae605..c49c9fb 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 _0x32b6=['remoteUri','sequelize','exports','STRING'];(function(_0x13137e,_0x29c0f3){var _0x346261=function(_0x8c7d4f){while(--_0x8c7d4f){_0x13137e['push'](_0x13137e['shift']());}};_0x346261(++_0x29c0f3);}(_0x32b6,0x1d1));var _0x632b=function(_0x2ad593,_0x2fa057){_0x2ad593=_0x2ad593-0x0;var _0x10201a=_0x32b6[_0x2ad593];return _0x10201a;};'use strict';var Sequelize=require(_0x632b('0x0'));module[_0x632b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x632b('0x2')]},'username':{'type':Sequelize[_0x632b('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x632b('0x2')],'unique':_0x632b('0x3')},'serverUrl':{'type':Sequelize[_0x632b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x958a=['sequelize','exports','STRING','username'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x958a,0x128));var _0xa958=function(_0x1d0e9d,_0x2473e7){_0x1d0e9d=_0x1d0e9d-0x0;var _0x398054=_0x958a[_0x1d0e9d];return _0x398054;};'use strict';var Sequelize=require(_0xa958('0x0'));module[_0xa958('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa958('0x2')]},'username':{'type':Sequelize[_0xa958('0x2')],'unique':_0xa958('0x3')},'apiKey':{'type':Sequelize[_0xa958('0x2')]},'remoteUri':{'type':Sequelize[_0xa958('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xa958('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 0e05277..cd17672 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 _0x5588=['../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','offset','count','set','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','FreshsalesAccount','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','include','show','params','rawAttributes','create','catch','body','find','getConfigurations','findOne','FreshsalesConfiguration','sort','Subjects','channel','getDescriptions','FreshsalesField','Descriptions','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5588,0x1da));var _0x8558=function(_0x1cb553,_0x47d254){_0x1cb553=_0x1cb553-0x0;var _0x11057a=_0x5588[_0x1cb553];return _0x11057a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8558('0x0'));var zipdir=require(_0x8558('0x1'));var jsonpatch=require(_0x8558('0x2'));var rp=require(_0x8558('0x3'));var moment=require(_0x8558('0x4'));var BPromise=require(_0x8558('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8558('0x6'));var sox=require(_0x8558('0x7'));var csv=require(_0x8558('0x8'));var ejs=require(_0x8558('0x9'));var fs=require('fs');var fs_extra=require(_0x8558('0xa'));var _=require(_0x8558('0xb'));var squel=require(_0x8558('0xc'));var crypto=require(_0x8558('0xd'));var jsforce=require(_0x8558('0xe'));var deskjs=require(_0x8558('0xf'));var toCsv=require(_0x8558('0x8'));var querystring=require(_0x8558('0x10'));var Papa=require(_0x8558('0x11'));var Redis=require(_0x8558('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8558('0x13'));var as=require(_0x8558('0x14'));var hardwareService=require(_0x8558('0x15'));var logger=require(_0x8558('0x16'))(_0x8558('0x17'));var utils=require(_0x8558('0x18'));var config=require(_0x8558('0x19'));var licenseUtil=require(_0x8558('0x1a'));var db=require(_0x8558('0x1b'))['db'];var integrations=require(_0x8558('0x1c'));function respondWithStatusCode(_0x86b478,_0x4a4238){_0x4a4238=_0x4a4238||0xcc;return function(_0x4c4e94){if(_0x4c4e94){return _0x86b478['sendStatus'](_0x4a4238);}return _0x86b478[_0x8558('0x1d')](_0x4a4238)['end']();};}function respondWithResult(_0x12a4e4,_0x5da520){_0x5da520=_0x5da520||0xc8;return function(_0x5d25f3){if(_0x5d25f3){return _0x12a4e4[_0x8558('0x1d')](_0x5da520)[_0x8558('0x1e')](_0x5d25f3);}};}function respondWithFilteredResult(_0x9731a1,_0x2171c8){return function(_0x447172){if(_0x447172){var _0x27e6ab=typeof _0x2171c8['offset']===_0x8558('0x1f')&&typeof _0x2171c8[_0x8558('0x20')]===_0x8558('0x1f');var _0x4a05f2=_0x447172['count'];var _0x5a7478=_0x27e6ab?0x0:_0x2171c8[_0x8558('0x21')];var _0x53640e=_0x27e6ab?_0x447172[_0x8558('0x22')]:_0x2171c8['offset']+_0x2171c8['limit'];var _0x416591;if(_0x53640e>=_0x4a05f2){_0x53640e=_0x4a05f2;_0x416591=0xc8;}else{_0x416591=0xce;}_0x9731a1[_0x8558('0x1d')](_0x416591);return _0x9731a1[_0x8558('0x23')]('Content-Range',_0x5a7478+'-'+_0x53640e+'/'+_0x4a05f2)[_0x8558('0x1e')](_0x447172);}return null;};}function patchUpdates(_0x4aed9d){return function(_0x39e129){try{jsonpatch['apply'](_0x39e129,_0x4aed9d,!![]);}catch(_0x54f5bc){return BPromise[_0x8558('0x24')](_0x54f5bc);}return _0x39e129[_0x8558('0x25')]();};}function saveUpdates(_0x151e6e,_0x2a6670){return function(_0x4a53f5){if(_0x4a53f5){return _0x4a53f5[_0x8558('0x26')](_0x151e6e)[_0x8558('0x27')](function(_0xd5af5e){return _0xd5af5e;});}return null;};}function removeEntity(_0x385d61,_0x520db1){return function(_0x3dbb08){if(_0x3dbb08){return _0x3dbb08[_0x8558('0x28')]()[_0x8558('0x27')](function(){_0x385d61[_0x8558('0x1d')](0xcc)[_0x8558('0x29')]();});}};}function handleEntityNotFound(_0x60d710,_0x27f7c8){return function(_0x519f0e){if(!_0x519f0e){_0x60d710[_0x8558('0x2a')](0x194);}return _0x519f0e;};}function handleError(_0x5814fe,_0x5af9c2){_0x5af9c2=_0x5af9c2||0x1f4;return function(_0x543af8){logger[_0x8558('0x2b')](_0x543af8[_0x8558('0x2c')]);if(_0x543af8[_0x8558('0x2d')]){delete _0x543af8[_0x8558('0x2d')];}_0x5814fe[_0x8558('0x1d')](_0x5af9c2)[_0x8558('0x2e')](_0x543af8);};}exports[_0x8558('0x2f')]=function(_0x13c261,_0x2a70e3){var _0x238ea6={},_0x4fcb25={},_0x205121={'count':0x0,'rows':[]};var _0x3cf1b5=_[_0x8558('0x30')](db[_0x8558('0x31')]['rawAttributes'],function(_0x2c4323){return{'name':_0x2c4323[_0x8558('0x32')],'type':_0x2c4323['type'][_0x8558('0x33')]};});_0x4fcb25[_0x8558('0x34')]=_['map'](_0x3cf1b5,_0x8558('0x2d'));_0x4fcb25[_0x8558('0x35')]=_[_0x8558('0x36')](_0x13c261[_0x8558('0x35')]);_0x4fcb25[_0x8558('0x37')]=_['intersection'](_0x4fcb25[_0x8558('0x34')],_0x4fcb25['query']);_0x238ea6[_0x8558('0x38')]=_[_0x8558('0x39')](_0x4fcb25[_0x8558('0x34')],qs[_0x8558('0x3a')](_0x13c261[_0x8558('0x35')][_0x8558('0x3a')]));_0x238ea6[_0x8558('0x38')]=_0x238ea6[_0x8558('0x38')][_0x8558('0x3b')]?_0x238ea6['attributes']:_0x4fcb25[_0x8558('0x34')];if(!_0x13c261[_0x8558('0x35')]['hasOwnProperty'](_0x8558('0x3c'))){_0x238ea6['limit']=qs[_0x8558('0x20')](_0x13c261[_0x8558('0x35')][_0x8558('0x20')]);_0x238ea6[_0x8558('0x21')]=qs[_0x8558('0x21')](_0x13c261[_0x8558('0x35')][_0x8558('0x21')]);}_0x238ea6[_0x8558('0x3d')]=qs['sort'](_0x13c261[_0x8558('0x35')]['sort']);_0x238ea6[_0x8558('0x3e')]=qs[_0x8558('0x37')](_[_0x8558('0x3f')](_0x13c261['query'],_0x4fcb25['filters']),_0x3cf1b5);if(_0x13c261['query'][_0x8558('0x40')]){_0x238ea6[_0x8558('0x3e')]=_[_0x8558('0x41')](_0x238ea6['where'],{'$or':_[_0x8558('0x30')](_0x3cf1b5,function(_0x5f252b){if(_0x5f252b[_0x8558('0x42')]!==_0x8558('0x43')){var _0x4796cd={};_0x4796cd[_0x5f252b[_0x8558('0x2d')]]={'$like':'%'+_0x13c261[_0x8558('0x35')][_0x8558('0x40')]+'%'};return _0x4796cd;}})});}_0x238ea6=_[_0x8558('0x41')]({},_0x238ea6,_0x13c261[_0x8558('0x44')]);var _0x41811d={'where':_0x238ea6['where']};return db[_0x8558('0x31')][_0x8558('0x22')](_0x41811d)[_0x8558('0x27')](function(_0x3f19c8){_0x205121[_0x8558('0x22')]=_0x3f19c8;if(_0x13c261[_0x8558('0x35')]['includeAll']){_0x238ea6[_0x8558('0x45')]=[{'all':!![]}];}return db[_0x8558('0x31')]['findAll'](_0x238ea6);})[_0x8558('0x27')](function(_0x5300e0){_0x205121['rows']=_0x5300e0;return _0x205121;})[_0x8558('0x27')](respondWithFilteredResult(_0x2a70e3,_0x238ea6))['catch'](handleError(_0x2a70e3,null));};exports[_0x8558('0x46')]=function(_0x18d15c,_0x7879c1){var _0x1f7f93={'raw':![],'where':{'id':_0x18d15c[_0x8558('0x47')]['id']}},_0x3a6d49={};_0x3a6d49['model']=_[_0x8558('0x36')](db[_0x8558('0x31')][_0x8558('0x48')]);_0x3a6d49['query']=_[_0x8558('0x36')](_0x18d15c['query']);_0x3a6d49[_0x8558('0x37')]=_['intersection'](_0x3a6d49[_0x8558('0x34')],_0x3a6d49[_0x8558('0x35')]);_0x1f7f93[_0x8558('0x38')]=_[_0x8558('0x39')](_0x3a6d49[_0x8558('0x34')],qs['fields'](_0x18d15c['query'][_0x8558('0x3a')]));_0x1f7f93['attributes']=_0x1f7f93['attributes'][_0x8558('0x3b')]?_0x1f7f93[_0x8558('0x38')]:_0x3a6d49[_0x8558('0x34')];if(_0x18d15c[_0x8558('0x35')]['includeAll']){_0x1f7f93[_0x8558('0x45')]=[{'all':!![]}];}_0x1f7f93=_[_0x8558('0x41')]({},_0x1f7f93,_0x18d15c[_0x8558('0x44')]);return db[_0x8558('0x31')]['find'](_0x1f7f93)['then'](handleEntityNotFound(_0x7879c1,null))['then'](respondWithResult(_0x7879c1,null))['catch'](handleError(_0x7879c1,null));};exports[_0x8558('0x49')]=function(_0x3cfb33,_0x34d8dc){return db[_0x8558('0x31')][_0x8558('0x49')](_0x3cfb33['body'],{})[_0x8558('0x27')](respondWithResult(_0x34d8dc,0xc9))[_0x8558('0x4a')](handleError(_0x34d8dc,null));};exports['update']=function(_0x442372,_0x3fec74){if(_0x442372[_0x8558('0x4b')]['id']){delete _0x442372['body']['id'];}return db[_0x8558('0x31')][_0x8558('0x4c')]({'where':{'id':_0x442372[_0x8558('0x47')]['id']}})[_0x8558('0x27')](handleEntityNotFound(_0x3fec74,null))[_0x8558('0x27')](saveUpdates(_0x442372['body'],null))[_0x8558('0x27')](respondWithResult(_0x3fec74,null))[_0x8558('0x4a')](handleError(_0x3fec74,null));};exports[_0x8558('0x28')]=function(_0x375030,_0x171d91){return db[_0x8558('0x31')][_0x8558('0x4c')]({'where':{'id':_0x375030[_0x8558('0x47')]['id']}})[_0x8558('0x27')](handleEntityNotFound(_0x171d91,null))[_0x8558('0x27')](removeEntity(_0x171d91,null))[_0x8558('0x4a')](handleError(_0x171d91,null));};exports[_0x8558('0x4d')]=function(_0x11a479,_0x390489,_0x305ee1){var _0xa3b143={};var _0x36b43a={};var _0x330e96;var _0x2dcc7d;return db[_0x8558('0x31')][_0x8558('0x4e')]({'where':{'id':_0x11a479[_0x8558('0x47')]['id']}})[_0x8558('0x27')](handleEntityNotFound(_0x390489,null))[_0x8558('0x27')](function(_0x4f8183){if(_0x4f8183){_0x330e96=_0x4f8183;_0x36b43a[_0x8558('0x34')]=_[_0x8558('0x36')](db[_0x8558('0x4f')][_0x8558('0x48')]);_0x36b43a['query']=_['keys'](_0x11a479[_0x8558('0x35')]);_0x36b43a[_0x8558('0x37')]=_[_0x8558('0x39')](_0x36b43a[_0x8558('0x34')],_0x36b43a[_0x8558('0x35')]);_0xa3b143[_0x8558('0x38')]=_[_0x8558('0x39')](_0x36b43a['model'],qs[_0x8558('0x3a')](_0x11a479['query'][_0x8558('0x3a')]));_0xa3b143[_0x8558('0x38')]=_0xa3b143[_0x8558('0x38')][_0x8558('0x3b')]?_0xa3b143[_0x8558('0x38')]:_0x36b43a[_0x8558('0x34')];_0xa3b143[_0x8558('0x3d')]=qs[_0x8558('0x50')](_0x11a479[_0x8558('0x35')][_0x8558('0x50')]);_0xa3b143[_0x8558('0x3e')]=qs['filters'](_[_0x8558('0x3f')](_0x11a479['query'],_0x36b43a['filters']));if(_0x11a479[_0x8558('0x35')][_0x8558('0x40')]){_0xa3b143[_0x8558('0x3e')]=_['merge'](_0xa3b143[_0x8558('0x3e')],{'$or':_[_0x8558('0x30')](_0xa3b143[_0x8558('0x38')],function(_0x2f4bc3){var _0x19a1c1={};_0x19a1c1[_0x2f4bc3]={'$like':'%'+_0x11a479[_0x8558('0x35')]['filter']+'%'};return _0x19a1c1;})});}_0xa3b143=_[_0x8558('0x41')]({},_0xa3b143,_0x11a479[_0x8558('0x44')]);return _0x330e96[_0x8558('0x4d')](_0xa3b143);}})['then'](function(_0x3ab0e2){if(_0x3ab0e2){_0x2dcc7d=_0x3ab0e2[_0x8558('0x3b')];if(!_0x11a479[_0x8558('0x35')]['hasOwnProperty'](_0x8558('0x3c'))){_0xa3b143['limit']=qs['limit'](_0x11a479['query'][_0x8558('0x20')]);_0xa3b143['offset']=qs[_0x8558('0x21')](_0x11a479[_0x8558('0x35')]['offset']);}return _0x330e96['getConfigurations'](_0xa3b143);}})[_0x8558('0x27')](function(_0x2802ff){if(_0x2802ff){return _0x2802ff?{'count':_0x2dcc7d,'rows':_0x2802ff}:null;}})[_0x8558('0x27')](respondWithResult(_0x390489,null))[_0x8558('0x4a')](handleError(_0x390489,null));};exports['addConfiguration']=function(_0x1f6bf3,_0x113227,_0x22b476){if(_0x1f6bf3[_0x8558('0x4b')]['id']){delete _0x1f6bf3['body']['id'];}return db[_0x8558('0x31')]['findOne']({'where':{'id':_0x1f6bf3['params']['id']}})[_0x8558('0x27')](handleEntityNotFound(_0x113227,null))[_0x8558('0x27')](function(_0x226cc2){if(_0x226cc2){_0x1f6bf3[_0x8558('0x4b')]['AccountId']=_0x226cc2['id'];_0x1f6bf3[_0x8558('0x4b')][_0x8558('0x51')]=integrations['getSubjects'](_0x1f6bf3[_0x8558('0x4b')][_0x8558('0x52')],_0x1f6bf3[_0x8558('0x4b')][_0x8558('0x42')]);_0x1f6bf3[_0x8558('0x4b')]['Descriptions']=integrations[_0x8558('0x53')](_0x1f6bf3['body'][_0x8558('0x52')],_0x1f6bf3[_0x8558('0x4b')]['type']);return db[_0x8558('0x4f')][_0x8558('0x49')](_0x1f6bf3['body'],{'include':[{'model':db[_0x8558('0x54')],'as':'Subjects'},{'model':db[_0x8558('0x54')],'as':_0x8558('0x55')}]});}return null;})[_0x8558('0x27')](respondWithResult(_0x113227,null))[_0x8558('0x4a')](handleError(_0x113227,null));};exports[_0x8558('0x56')]=function(_0x2e1d7b,_0x27b87a,_0x4abb56){var _0xe7a63c='';var _0x29156e='';return db[_0x8558('0x31')][_0x8558('0x4e')]({'where':{'id':_0x2e1d7b[_0x8558('0x47')]['id']},'attributes':['id',_0x8558('0x57'),_0x8558('0x58'),_0x8558('0x59')]})[_0x8558('0x27')](handleEntityNotFound(_0x27b87a,null))[_0x8558('0x27')](function(_0x34f77d){if(_0x34f77d){_0x29156e=_0x34f77d[_0x8558('0x57')];_0xe7a63c=_0x34f77d[_0x8558('0x58')];var _0x289591=_0x34f77d[_0x8558('0x58')][_0x8558('0x5a')](-0x1);if(_0x289591==='/'){_0xe7a63c=_0xe7a63c[_0x8558('0x5b')](0x0,_0xe7a63c[_0x8558('0x5c')](_0x289591));}return rp({'method':_0x8558('0x5d'),'uri':util[_0x8558('0x5e')]('%s%s',_0xe7a63c,_0x8558('0x5f')),'headers':{'Authorization':'Token\x20token='+_0x34f77d['apiKey']},'json':!![]});}})['then'](function(_0x184164){if(_0x184164){var _0x18fa4f=_0x184164[_0x8558('0x60')];var _0x53a926=![];var _0x4638f2=null;for(_0x4638f2=0x0;_0x4638f2<_0x18fa4f[_0x8558('0x3b')];_0x4638f2++){if(_0x18fa4f[_0x4638f2][_0x8558('0x61')]===_0x29156e){_0x53a926=!![];}}if(_0x53a926){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x8558('0x62')});}}})['then'](respondWithResult(_0x27b87a,null))[_0x8558('0x4a')](function(_0x319a24){var _0x1e7be8=_0x2e1d7b[_0x8558('0x35')]['test']?0x1f4:_0x319a24[_0x8558('0x63')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1e7be8,JSON['stringify'](_0x319a24));delete _0x319a24[_0x8558('0x2d')];if(_0x1e7be8===0x191){_0x1e7be8=0x190;}_0x27b87a[_0x8558('0x1d')](_0x1e7be8)[_0x8558('0x2e')](_0x2e1d7b[_0x8558('0x35')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x319a24['statusCode']}:_0x319a24);});}; \ No newline at end of file +var _0x4891=['filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','findOne','FreshsalesConfiguration','order','getConfigurations','addConfiguration','Subjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','end','status','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick'];(function(_0x1e00be,_0x3b755b){var _0x5d388d=function(_0x1d8a86){while(--_0x1d8a86){_0x1e00be['push'](_0x1e00be['shift']());}};_0x5d388d(++_0x3b755b);}(_0x4891,0xef));var _0x1489=function(_0x493b82,_0x34ea29){_0x493b82=_0x493b82-0x0;var _0x15c02b=_0x4891[_0x493b82];return _0x15c02b;};'use strict';var emlformat=require(_0x1489('0x0'));var rimraf=require(_0x1489('0x1'));var zipdir=require(_0x1489('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1489('0x3'));var moment=require(_0x1489('0x4'));var BPromise=require(_0x1489('0x5'));var Mustache=require(_0x1489('0x6'));var util=require('util');var path=require(_0x1489('0x7'));var sox=require(_0x1489('0x8'));var csv=require(_0x1489('0x9'));var ejs=require(_0x1489('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(_0x1489('0xb'));var deskjs=require(_0x1489('0xc'));var toCsv=require(_0x1489('0x9'));var querystring=require(_0x1489('0xd'));var Papa=require(_0x1489('0xe'));var Redis=require(_0x1489('0xf'));var authService=require(_0x1489('0x10'));var qs=require(_0x1489('0x11'));var as=require(_0x1489('0x12'));var hardwareService=require(_0x1489('0x13'));var logger=require(_0x1489('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x1489('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1489('0x16'))['db'];var integrations=require(_0x1489('0x17'));function respondWithStatusCode(_0x859e50,_0x3430bf){_0x3430bf=_0x3430bf||0xcc;return function(_0x365692){if(_0x365692){return _0x859e50['sendStatus'](_0x3430bf);}return _0x859e50['status'](_0x3430bf)[_0x1489('0x18')]();};}function respondWithResult(_0x3d849c,_0x42309b){_0x42309b=_0x42309b||0xc8;return function(_0xb42c7c){if(_0xb42c7c){return _0x3d849c[_0x1489('0x19')](_0x42309b)['json'](_0xb42c7c);}};}function respondWithFilteredResult(_0x3a51b8,_0x24192f){return function(_0x567172){if(_0x567172){var _0x3e317b=typeof _0x24192f[_0x1489('0x1a')]===_0x1489('0x1b')&&typeof _0x24192f[_0x1489('0x1c')]===_0x1489('0x1b');var _0x58e7eb=_0x567172['count'];var _0x2dec66=_0x3e317b?0x0:_0x24192f['offset'];var _0x1a61ab=_0x3e317b?_0x567172[_0x1489('0x1d')]:_0x24192f[_0x1489('0x1a')]+_0x24192f[_0x1489('0x1c')];var _0x565f41;if(_0x1a61ab>=_0x58e7eb){_0x1a61ab=_0x58e7eb;_0x565f41=0xc8;}else{_0x565f41=0xce;}_0x3a51b8[_0x1489('0x19')](_0x565f41);return _0x3a51b8[_0x1489('0x1e')]('Content-Range',_0x2dec66+'-'+_0x1a61ab+'/'+_0x58e7eb)[_0x1489('0x1f')](_0x567172);}return null;};}function patchUpdates(_0x22d5bf){return function(_0x1f5149){try{jsonpatch[_0x1489('0x20')](_0x1f5149,_0x22d5bf,!![]);}catch(_0x5d013a){return BPromise[_0x1489('0x21')](_0x5d013a);}return _0x1f5149['save']();};}function saveUpdates(_0x545bef,_0xc8c188){return function(_0x4f1c73){if(_0x4f1c73){return _0x4f1c73[_0x1489('0x22')](_0x545bef)[_0x1489('0x23')](function(_0x1194d8){return _0x1194d8;});}return null;};}function removeEntity(_0x45e0a5,_0x2aed6c){return function(_0x31f578){if(_0x31f578){return _0x31f578[_0x1489('0x24')]()[_0x1489('0x23')](function(){_0x45e0a5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46f3d8,_0x455476){return function(_0x1e5941){if(!_0x1e5941){_0x46f3d8['sendStatus'](0x194);}return _0x1e5941;};}function handleError(_0x1a2729,_0x1d5bc2){_0x1d5bc2=_0x1d5bc2||0x1f4;return function(_0x380e20){logger['error'](_0x380e20[_0x1489('0x25')]);if(_0x380e20[_0x1489('0x26')]){delete _0x380e20[_0x1489('0x26')];}_0x1a2729[_0x1489('0x19')](_0x1d5bc2)[_0x1489('0x27')](_0x380e20);};}exports['index']=function(_0x5dbc8b,_0x3a62ac){var _0x9b52c4={},_0x5b62c6={},_0x3e437b={'count':0x0,'rows':[]};var _0x41b796=_[_0x1489('0x28')](db[_0x1489('0x29')][_0x1489('0x2a')],function(_0x40ec3a){return{'name':_0x40ec3a[_0x1489('0x2b')],'type':_0x40ec3a[_0x1489('0x2c')][_0x1489('0x2d')]};});_0x5b62c6['model']=_[_0x1489('0x28')](_0x41b796,_0x1489('0x26'));_0x5b62c6['query']=_[_0x1489('0x2e')](_0x5dbc8b[_0x1489('0x2f')]);_0x5b62c6[_0x1489('0x30')]=_[_0x1489('0x31')](_0x5b62c6[_0x1489('0x32')],_0x5b62c6[_0x1489('0x2f')]);_0x9b52c4[_0x1489('0x33')]=_[_0x1489('0x31')](_0x5b62c6[_0x1489('0x32')],qs[_0x1489('0x34')](_0x5dbc8b[_0x1489('0x2f')][_0x1489('0x34')]));_0x9b52c4['attributes']=_0x9b52c4[_0x1489('0x33')][_0x1489('0x35')]?_0x9b52c4[_0x1489('0x33')]:_0x5b62c6['model'];if(!_0x5dbc8b[_0x1489('0x2f')][_0x1489('0x36')]('nolimit')){_0x9b52c4[_0x1489('0x1c')]=qs['limit'](_0x5dbc8b['query'][_0x1489('0x1c')]);_0x9b52c4['offset']=qs['offset'](_0x5dbc8b[_0x1489('0x2f')][_0x1489('0x1a')]);}_0x9b52c4['order']=qs['sort'](_0x5dbc8b[_0x1489('0x2f')][_0x1489('0x37')]);_0x9b52c4[_0x1489('0x38')]=qs[_0x1489('0x30')](_[_0x1489('0x39')](_0x5dbc8b[_0x1489('0x2f')],_0x5b62c6[_0x1489('0x30')]),_0x41b796);if(_0x5dbc8b['query'][_0x1489('0x3a')]){_0x9b52c4[_0x1489('0x38')]=_[_0x1489('0x3b')](_0x9b52c4[_0x1489('0x38')],{'$or':_['map'](_0x41b796,function(_0x1aec3b){if(_0x1aec3b['type']!=='VIRTUAL'){var _0x5c6864={};_0x5c6864[_0x1aec3b['name']]={'$like':'%'+_0x5dbc8b[_0x1489('0x2f')][_0x1489('0x3a')]+'%'};return _0x5c6864;}})});}_0x9b52c4=_[_0x1489('0x3b')]({},_0x9b52c4,_0x5dbc8b[_0x1489('0x3c')]);var _0x2ebf0e={'where':_0x9b52c4[_0x1489('0x38')]};return db[_0x1489('0x29')][_0x1489('0x1d')](_0x2ebf0e)[_0x1489('0x23')](function(_0x168ae4){_0x3e437b[_0x1489('0x1d')]=_0x168ae4;if(_0x5dbc8b[_0x1489('0x2f')][_0x1489('0x3d')]){_0x9b52c4[_0x1489('0x3e')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x1489('0x3f')](_0x9b52c4);})[_0x1489('0x23')](function(_0x363208){_0x3e437b[_0x1489('0x40')]=_0x363208;return _0x3e437b;})[_0x1489('0x23')](respondWithFilteredResult(_0x3a62ac,_0x9b52c4))[_0x1489('0x41')](handleError(_0x3a62ac,null));};exports[_0x1489('0x42')]=function(_0x2c9bb0,_0x3d79b8){var _0x106cd4={'raw':![],'where':{'id':_0x2c9bb0['params']['id']}},_0x4533db={};_0x4533db[_0x1489('0x32')]=_[_0x1489('0x2e')](db['FreshsalesAccount'][_0x1489('0x2a')]);_0x4533db[_0x1489('0x2f')]=_[_0x1489('0x2e')](_0x2c9bb0[_0x1489('0x2f')]);_0x4533db[_0x1489('0x30')]=_[_0x1489('0x31')](_0x4533db['model'],_0x4533db['query']);_0x106cd4[_0x1489('0x33')]=_['intersection'](_0x4533db[_0x1489('0x32')],qs[_0x1489('0x34')](_0x2c9bb0[_0x1489('0x2f')][_0x1489('0x34')]));_0x106cd4['attributes']=_0x106cd4['attributes'][_0x1489('0x35')]?_0x106cd4[_0x1489('0x33')]:_0x4533db[_0x1489('0x32')];if(_0x2c9bb0[_0x1489('0x2f')]['includeAll']){_0x106cd4[_0x1489('0x3e')]=[{'all':!![]}];}_0x106cd4=_[_0x1489('0x3b')]({},_0x106cd4,_0x2c9bb0[_0x1489('0x3c')]);return db[_0x1489('0x29')][_0x1489('0x43')](_0x106cd4)[_0x1489('0x23')](handleEntityNotFound(_0x3d79b8,null))[_0x1489('0x23')](respondWithResult(_0x3d79b8,null))[_0x1489('0x41')](handleError(_0x3d79b8,null));};exports['create']=function(_0x337895,_0x23bed5){return db[_0x1489('0x29')][_0x1489('0x44')](_0x337895[_0x1489('0x45')],{})[_0x1489('0x23')](respondWithResult(_0x23bed5,0xc9))[_0x1489('0x41')](handleError(_0x23bed5,null));};exports[_0x1489('0x22')]=function(_0x1640ac,_0x52f043){if(_0x1640ac['body']['id']){delete _0x1640ac[_0x1489('0x45')]['id'];}return db['FreshsalesAccount'][_0x1489('0x43')]({'where':{'id':_0x1640ac[_0x1489('0x46')]['id']}})['then'](handleEntityNotFound(_0x52f043,null))['then'](saveUpdates(_0x1640ac[_0x1489('0x45')],null))[_0x1489('0x23')](respondWithResult(_0x52f043,null))[_0x1489('0x41')](handleError(_0x52f043,null));};exports[_0x1489('0x24')]=function(_0x61d919,_0x88c216){return db['FreshsalesAccount']['find']({'where':{'id':_0x61d919[_0x1489('0x46')]['id']}})[_0x1489('0x23')](handleEntityNotFound(_0x88c216,null))[_0x1489('0x23')](removeEntity(_0x88c216,null))[_0x1489('0x41')](handleError(_0x88c216,null));};exports['getConfigurations']=function(_0x542084,_0x14bcc8,_0x17705f){var _0x2668b2={};var _0x546daf={};var _0x3e7bf3;var _0x563e64;return db[_0x1489('0x29')][_0x1489('0x47')]({'where':{'id':_0x542084[_0x1489('0x46')]['id']}})[_0x1489('0x23')](handleEntityNotFound(_0x14bcc8,null))['then'](function(_0x3daea7){if(_0x3daea7){_0x3e7bf3=_0x3daea7;_0x546daf[_0x1489('0x32')]=_[_0x1489('0x2e')](db[_0x1489('0x48')][_0x1489('0x2a')]);_0x546daf[_0x1489('0x2f')]=_['keys'](_0x542084[_0x1489('0x2f')]);_0x546daf['filters']=_[_0x1489('0x31')](_0x546daf['model'],_0x546daf['query']);_0x2668b2[_0x1489('0x33')]=_[_0x1489('0x31')](_0x546daf[_0x1489('0x32')],qs['fields'](_0x542084['query'][_0x1489('0x34')]));_0x2668b2[_0x1489('0x33')]=_0x2668b2[_0x1489('0x33')]['length']?_0x2668b2[_0x1489('0x33')]:_0x546daf[_0x1489('0x32')];_0x2668b2[_0x1489('0x49')]=qs[_0x1489('0x37')](_0x542084[_0x1489('0x2f')]['sort']);_0x2668b2[_0x1489('0x38')]=qs['filters'](_[_0x1489('0x39')](_0x542084[_0x1489('0x2f')],_0x546daf[_0x1489('0x30')]));if(_0x542084[_0x1489('0x2f')][_0x1489('0x3a')]){_0x2668b2['where']=_['merge'](_0x2668b2[_0x1489('0x38')],{'$or':_['map'](_0x2668b2[_0x1489('0x33')],function(_0x13d5ce){var _0x39a6e5={};_0x39a6e5[_0x13d5ce]={'$like':'%'+_0x542084[_0x1489('0x2f')][_0x1489('0x3a')]+'%'};return _0x39a6e5;})});}_0x2668b2=_[_0x1489('0x3b')]({},_0x2668b2,_0x542084[_0x1489('0x3c')]);return _0x3e7bf3[_0x1489('0x4a')](_0x2668b2);}})['then'](function(_0x100292){if(_0x100292){_0x563e64=_0x100292[_0x1489('0x35')];if(!_0x542084[_0x1489('0x2f')][_0x1489('0x36')]('nolimit')){_0x2668b2['limit']=qs[_0x1489('0x1c')](_0x542084[_0x1489('0x2f')][_0x1489('0x1c')]);_0x2668b2['offset']=qs['offset'](_0x542084[_0x1489('0x2f')][_0x1489('0x1a')]);}return _0x3e7bf3['getConfigurations'](_0x2668b2);}})['then'](function(_0x3f91d0){if(_0x3f91d0){return _0x3f91d0?{'count':_0x563e64,'rows':_0x3f91d0}:null;}})[_0x1489('0x23')](respondWithResult(_0x14bcc8,null))[_0x1489('0x41')](handleError(_0x14bcc8,null));};exports[_0x1489('0x4b')]=function(_0x68f72e,_0x2b350d,_0x3c3849){if(_0x68f72e['body']['id']){delete _0x68f72e['body']['id'];}return db[_0x1489('0x29')][_0x1489('0x47')]({'where':{'id':_0x68f72e[_0x1489('0x46')]['id']}})['then'](handleEntityNotFound(_0x2b350d,null))[_0x1489('0x23')](function(_0x1048b7){if(_0x1048b7){_0x68f72e[_0x1489('0x45')]['AccountId']=_0x1048b7['id'];_0x68f72e[_0x1489('0x45')][_0x1489('0x4c')]=integrations['getSubjects'](_0x68f72e[_0x1489('0x45')][_0x1489('0x4d')],_0x68f72e[_0x1489('0x45')][_0x1489('0x2c')]);_0x68f72e['body'][_0x1489('0x4e')]=integrations['getDescriptions'](_0x68f72e[_0x1489('0x45')][_0x1489('0x4d')],_0x68f72e[_0x1489('0x45')]['type']);return db[_0x1489('0x48')][_0x1489('0x44')](_0x68f72e[_0x1489('0x45')],{'include':[{'model':db['FreshsalesField'],'as':_0x1489('0x4c')},{'model':db[_0x1489('0x4f')],'as':_0x1489('0x4e')}]});}return null;})[_0x1489('0x23')](respondWithResult(_0x2b350d,null))[_0x1489('0x41')](handleError(_0x2b350d,null));};exports[_0x1489('0x50')]=function(_0x4f014f,_0x26e7ec,_0x853675){var _0x310b3b='';var _0x166bc7='';return db[_0x1489('0x29')][_0x1489('0x47')]({'where':{'id':_0x4f014f[_0x1489('0x46')]['id']},'attributes':['id',_0x1489('0x51'),_0x1489('0x52'),_0x1489('0x53')]})[_0x1489('0x23')](handleEntityNotFound(_0x26e7ec,null))[_0x1489('0x23')](function(_0x25e10d){if(_0x25e10d){_0x166bc7=_0x25e10d['username'];_0x310b3b=_0x25e10d[_0x1489('0x52')];var _0x2cc0a9=_0x25e10d[_0x1489('0x52')][_0x1489('0x54')](-0x1);if(_0x2cc0a9==='/'){_0x310b3b=_0x310b3b[_0x1489('0x55')](0x0,_0x310b3b[_0x1489('0x56')](_0x2cc0a9));}return rp({'method':_0x1489('0x57'),'uri':util[_0x1489('0x58')](_0x1489('0x59'),_0x310b3b,_0x1489('0x5a')),'headers':{'Authorization':'Token\x20token='+_0x25e10d['apiKey']},'json':!![]});}})[_0x1489('0x23')](function(_0x28c28f){if(_0x28c28f){var _0x57f7cd=_0x28c28f[_0x1489('0x5b')];var _0x498b49=![];var _0x1b47d8=null;for(_0x1b47d8=0x0;_0x1b47d8<_0x57f7cd[_0x1489('0x35')];_0x1b47d8++){if(_0x57f7cd[_0x1b47d8][_0x1489('0x5c')]===_0x166bc7){_0x498b49=!![];}}if(_0x498b49){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x1489('0x5d')});}}})[_0x1489('0x23')](respondWithResult(_0x26e7ec,null))[_0x1489('0x41')](function(_0x213297){var _0x3d4cb8=_0x4f014f[_0x1489('0x2f')][_0x1489('0x5e')]?0x1f4:_0x213297[_0x1489('0x5f')]||0x1f4;logger[_0x1489('0x60')]('getFields,\x20%s,\x20%s,\x20%s',_0x1489('0x50'),_0x3d4cb8,JSON[_0x1489('0x61')](_0x213297));delete _0x213297[_0x1489('0x26')];if(_0x3d4cb8===0x191){_0x3d4cb8=0x190;}_0x26e7ec[_0x1489('0x19')](_0x3d4cb8)[_0x1489('0x27')](_0x4f014f[_0x1489('0x2f')][_0x1489('0x5e')]?{'message':_0x1489('0x62'),'statusCode':_0x213297['statusCode']}:_0x213297);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 79f9294..67ee780 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 _0xb145=['request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x20c37b,_0x1fe09d){var _0x735bb5=function(_0x308d23){while(--_0x308d23){_0x20c37b['push'](_0x20c37b['shift']());}};_0x735bb5(++_0x1fe09d);}(_0xb145,0xa3));var _0x5b14=function(_0x161795,_0x478c0b){_0x161795=_0x161795-0x0;var _0x186ab2=_0xb145[_0x161795];return _0x186ab2;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var logger=require(_0x5b14('0x1'))(_0x5b14('0x2'));var moment=require(_0x5b14('0x3'));var BPromise=require(_0x5b14('0x4'));var rp=require(_0x5b14('0x5'));var fs=require('fs');var path=require(_0x5b14('0x6'));var rimraf=require(_0x5b14('0x7'));var config=require('../../config/environment');var attributes=require(_0x5b14('0x8'));var integrations=require(_0x5b14('0x9'));module[_0x5b14('0xa')]=function(_0x4d82ad,_0x50fd91){return _0x4d82ad[_0x5b14('0xb')](_0x5b14('0xc'),attributes,{'tableName':_0x5b14('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d72=['exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x1196b0,_0x36c47a){var _0x111c52=function(_0x5604c7){while(--_0x5604c7){_0x1196b0['push'](_0x1196b0['shift']());}};_0x111c52(++_0x36c47a);}(_0x2d72,0xa8));var _0x22d7=function(_0x3c8870,_0xe5c793){_0x3c8870=_0x3c8870-0x0;var _0x290359=_0x2d72[_0x3c8870];return _0x290359;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var logger=require(_0x22d7('0x2'))(_0x22d7('0x3'));var moment=require(_0x22d7('0x4'));var BPromise=require(_0x22d7('0x5'));var rp=require(_0x22d7('0x6'));var fs=require('fs');var path=require(_0x22d7('0x7'));var rimraf=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var attributes=require(_0x22d7('0xa'));var integrations=require(_0x22d7('0xb'));module[_0x22d7('0xc')]=function(_0x100426,_0x52a3e3){return _0x100426[_0x22d7('0xd')](_0x22d7('0xe'),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 98c53ba..31b542b 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x583c=['raw','where','attributes','limit','map','include','model','debug','stringify','catch','ShowFreshsalesAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetFreshsalesAccount','FreshsalesAccount','options'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0x583c,0x12b));var _0xc583=function(_0x51bb38,_0x4e57a0){_0x51bb38=_0x51bb38-0x0;var _0x51c09b=_0x583c[_0x51bb38];return _0x51c09b;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var moment=require(_0xc583('0x2'));var BPromise=require(_0xc583('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc583('0x4'));var db=require(_0xc583('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc583('0x6'));var config=require(_0xc583('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc583('0x8')][_0xc583('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2719df,_0x1dd37c,_0x48a8d4){return new BPromise(function(_0x21ed88,_0x26cec0){return client['request'](_0x2719df,_0x48a8d4)[_0xc583('0xa')](function(_0x24ab4f){logger[_0xc583('0xb')](_0xc583('0xc'),_0x1dd37c,_0xc583('0xd'));logger['debug'](_0xc583('0xe'),_0x1dd37c,_0xc583('0xd'),JSON['stringify'](_0x24ab4f));if(_0x24ab4f[_0xc583('0xf')]){if(_0x24ab4f[_0xc583('0xf')]['code']===0x1f4){logger[_0xc583('0xf')](_0xc583('0xc'),_0x1dd37c,_0x24ab4f[_0xc583('0xf')][_0xc583('0x10')]);return _0x26cec0(_0x24ab4f[_0xc583('0xf')][_0xc583('0x10')]);}logger[_0xc583('0xf')](_0xc583('0xc'),_0x1dd37c,_0x24ab4f[_0xc583('0xf')]['message']);return _0x21ed88(_0x24ab4f[_0xc583('0xf')]['message']);}else{logger[_0xc583('0xb')](_0xc583('0xc'),_0x1dd37c,'request\x20sent');_0x21ed88(_0x24ab4f[_0xc583('0x11')][_0xc583('0x10')]);}})['catch'](function(_0x7d1690){logger[_0xc583('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x1dd37c,_0x7d1690);_0x26cec0(_0x7d1690);});});}exports[_0xc583('0x12')]=function(_0x8a2d84){var _0x12aac2=this;return new Promise(function(_0x36e0fd,_0x5433ec){return db[_0xc583('0x13')]['findAll']({'raw':_0x8a2d84[_0xc583('0x14')]?_0x8a2d84[_0xc583('0x14')][_0xc583('0x15')]===undefined?!![]:![]:!![],'where':_0x8a2d84[_0xc583('0x14')]?_0x8a2d84[_0xc583('0x14')][_0xc583('0x16')]||null:null,'attributes':_0x8a2d84[_0xc583('0x14')]?_0x8a2d84[_0xc583('0x14')][_0xc583('0x17')]||null:null,'limit':_0x8a2d84[_0xc583('0x14')]?_0x8a2d84[_0xc583('0x14')][_0xc583('0x18')]||null:null,'include':_0x8a2d84[_0xc583('0x14')]?_0x8a2d84['options']['include']?_[_0xc583('0x19')](_0x8a2d84[_0xc583('0x14')][_0xc583('0x1a')],function(_0x5ceef1){return{'model':db[_0x5ceef1[_0xc583('0x1b')]],'as':_0x5ceef1['as'],'attributes':_0x5ceef1[_0xc583('0x17')],'include':_0x5ceef1[_0xc583('0x1a')]?_[_0xc583('0x19')](_0x5ceef1[_0xc583('0x1a')],function(_0x48c95e){return{'model':db[_0x48c95e['model']],'as':_0x48c95e['as'],'attributes':_0x48c95e[_0xc583('0x17')],'include':_0x48c95e['include']?_[_0xc583('0x19')](_0x48c95e[_0xc583('0x1a')],function(_0xbabf24){return{'model':db[_0xbabf24[_0xc583('0x1b')]],'as':_0xbabf24['as'],'attributes':_0xbabf24[_0xc583('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2dafb4){logger[_0xc583('0xb')]('GetFreshsalesAccount',_0x8a2d84);logger[_0xc583('0x1c')]('GetFreshsalesAccount',_0x8a2d84,JSON[_0xc583('0x1d')](_0x2dafb4));_0x36e0fd(_0x2dafb4);})[_0xc583('0x1e')](function(_0x1c80b1){logger[_0xc583('0xf')](_0xc583('0x12'),_0x1c80b1[_0xc583('0x10')],_0x8a2d84);_0x5433ec(_0x12aac2[_0xc583('0xf')](0x1f4,_0x1c80b1['message']));});});};exports[_0xc583('0x1f')]=function(_0x390bc3){var _0x23f3a4=this;return new Promise(function(_0xcbf1f1,_0x1dd665){return db[_0xc583('0x13')]['find']({'raw':_0x390bc3[_0xc583('0x14')]?_0x390bc3['options']['raw']===undefined?!![]:![]:!![],'where':_0x390bc3[_0xc583('0x14')]?_0x390bc3[_0xc583('0x14')][_0xc583('0x16')]||null:null,'attributes':_0x390bc3[_0xc583('0x14')]?_0x390bc3[_0xc583('0x14')]['attributes']||null:null,'include':_0x390bc3[_0xc583('0x14')]?_0x390bc3[_0xc583('0x14')][_0xc583('0x1a')]?_['map'](_0x390bc3[_0xc583('0x14')]['include'],function(_0x1aa62a){return{'model':db[_0x1aa62a[_0xc583('0x1b')]],'as':_0x1aa62a['as'],'attributes':_0x1aa62a[_0xc583('0x17')],'include':_0x1aa62a[_0xc583('0x1a')]?_[_0xc583('0x19')](_0x1aa62a['include'],function(_0x242728){return{'model':db[_0x242728['model']],'as':_0x242728['as'],'attributes':_0x242728[_0xc583('0x17')],'include':_0x242728['include']?_[_0xc583('0x19')](_0x242728[_0xc583('0x1a')],function(_0x7d89d0){return{'model':db[_0x7d89d0[_0xc583('0x1b')]],'as':_0x7d89d0['as'],'attributes':_0x7d89d0[_0xc583('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc583('0xa')](function(_0x54200c){logger['info'](_0xc583('0x1f'),_0x390bc3);logger[_0xc583('0x1c')]('ShowFreshsalesAccount',_0x390bc3,JSON[_0xc583('0x1d')](_0x54200c));_0xcbf1f1(_0x54200c);})[_0xc583('0x1e')](function(_0x22de5a){logger[_0xc583('0xf')](_0xc583('0x1f'),_0x22de5a[_0xc583('0x10')],_0x390bc3);_0x1dd665(_0x23f3a4['error'](0x1f4,_0x22de5a[_0xc583('0x10')]));});});}; \ No newline at end of file +var _0x4975=['jayson/promise','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','GetFreshsalesAccount','ShowFreshsalesAccount','find','then','lodash','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);}(_0x4975,0x86));var _0x5497=function(_0x1e3dae,_0x32c54b){_0x1e3dae=_0x1e3dae-0x0;var _0x45ae45=_0x4975[_0x1e3dae];return _0x45ae45;};'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')]('FreshsalesAccount,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});}exports['GetFreshsalesAccount']=function(_0x3f4d20){var _0x1bf442=this;return new Promise(function(_0x3a47fd,_0x5d9e24){return db[_0x5497('0x17')][_0x5497('0x18')]({'raw':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1b')]||null:null,'attributes':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1c')]||null:null,'limit':_0x3f4d20['options']?_0x3f4d20[_0x5497('0x19')]['limit']||null:null,'include':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x3f4d20[_0x5497('0x19')][_0x5497('0x1d')],function(_0x5018fa){return{'model':db[_0x5018fa['model']],'as':_0x5018fa['as'],'attributes':_0x5018fa[_0x5497('0x1c')],'include':_0x5018fa[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x5018fa[_0x5497('0x1d')],function(_0x5223b5){return{'model':db[_0x5223b5[_0x5497('0x1f')]],'as':_0x5223b5['as'],'attributes':_0x5223b5['attributes'],'include':_0x5223b5[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x5223b5[_0x5497('0x1d')],function(_0x34a1a5){return{'model':db[_0x34a1a5[_0x5497('0x1f')]],'as':_0x34a1a5['as'],'attributes':_0x34a1a5[_0x5497('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4af5f4){logger['info']('GetFreshsalesAccount',_0x3f4d20);logger['debug'](_0x5497('0x20'),_0x3f4d20,JSON['stringify'](_0x4af5f4));_0x3a47fd(_0x4af5f4);})['catch'](function(_0xc3465){logger[_0x5497('0x13')](_0x5497('0x20'),_0xc3465['message'],_0x3f4d20);_0x5d9e24(_0x1bf442['error'](0x1f4,_0xc3465['message']));});});};exports[_0x5497('0x21')]=function(_0x471e0b){var _0xf4c117=this;return new Promise(function(_0x5b8f79,_0x489f71){return db['FreshsalesAccount'][_0x5497('0x22')]({'raw':_0x471e0b['options']?_0x471e0b[_0x5497('0x19')][_0x5497('0x1a')]===undefined?!![]:![]:!![],'where':_0x471e0b[_0x5497('0x19')]?_0x471e0b['options'][_0x5497('0x1b')]||null:null,'attributes':_0x471e0b[_0x5497('0x19')]?_0x471e0b['options'][_0x5497('0x1c')]||null:null,'include':_0x471e0b[_0x5497('0x19')]?_0x471e0b[_0x5497('0x19')]['include']?_[_0x5497('0x1e')](_0x471e0b[_0x5497('0x19')][_0x5497('0x1d')],function(_0x362b96){return{'model':db[_0x362b96[_0x5497('0x1f')]],'as':_0x362b96['as'],'attributes':_0x362b96['attributes'],'include':_0x362b96[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x362b96['include'],function(_0x1ffc9b){return{'model':db[_0x1ffc9b[_0x5497('0x1f')]],'as':_0x1ffc9b['as'],'attributes':_0x1ffc9b[_0x5497('0x1c')],'include':_0x1ffc9b[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x1ffc9b[_0x5497('0x1d')],function(_0x580e86){return{'model':db[_0x580e86[_0x5497('0x1f')]],'as':_0x580e86['as'],'attributes':_0x580e86['attributes']};}):[]};}):[]};}):[]:[]})[_0x5497('0x23')](function(_0x212199){logger[_0x5497('0xd')]('ShowFreshsalesAccount',_0x471e0b);logger['debug'](_0x5497('0x21'),_0x471e0b,JSON[_0x5497('0x12')](_0x212199));_0x5b8f79(_0x212199);})[_0x5497('0x16')](function(_0x429cbf){logger[_0x5497('0x13')](_0x5497('0x21'),_0x429cbf['message'],_0x471e0b);_0x489f71(_0xf4c117[_0x5497('0x13')](0x1f4,_0x429cbf[_0x5497('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 7edf7ed..051313b 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 _0xfa5c=['./intFreshsalesConfiguration.controller','index','get','/:id','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getFields','post','create','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x56d3cf,_0x20787b){var _0x5881e6=function(_0x2bd2cc){while(--_0x2bd2cc){_0x56d3cf['push'](_0x56d3cf['shift']());}};_0x5881e6(++_0x20787b);}(_0xfa5c,0x1d9));var _0xcfa5=function(_0x4d920b,_0x30f1c4){_0x4d920b=_0x4d920b-0x0;var _0x1a6220=_0xfa5c[_0x4d920b];return _0x1a6220;};'use strict';var multer=require(_0xcfa5('0x0'));var util=require(_0xcfa5('0x1'));var path=require(_0xcfa5('0x2'));var timeout=require(_0xcfa5('0x3'));var express=require(_0xcfa5('0x4'));var router=express[_0xcfa5('0x5')]();var fs_extra=require(_0xcfa5('0x6'));var auth=require(_0xcfa5('0x7'));var interaction=require(_0xcfa5('0x8'));var config=require(_0xcfa5('0x9'));var controller=require(_0xcfa5('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xcfa5('0xb')]);router[_0xcfa5('0xc')](_0xcfa5('0xd'),auth[_0xcfa5('0xe')](),controller['show']);router['get'](_0xcfa5('0xf'),auth['isAuthenticated'](),controller[_0xcfa5('0x10')]);router[_0xcfa5('0xc')](_0xcfa5('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router['get']('/:id/fields',auth[_0xcfa5('0xe')](),controller[_0xcfa5('0x12')]);router[_0xcfa5('0x13')]('/',auth[_0xcfa5('0xe')](),controller[_0xcfa5('0x14')]);router['put'](_0xcfa5('0xd'),auth['isAuthenticated'](),controller[_0xcfa5('0x15')]);router[_0xcfa5('0x16')](_0xcfa5('0xd'),auth[_0xcfa5('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1aa9=['fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getFields','post','put','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x3c4d4a,_0x3973b4){var _0x2475a2=function(_0x4b0cfe){while(--_0x4b0cfe){_0x3c4d4a['push'](_0x3c4d4a['shift']());}};_0x2475a2(++_0x3973b4);}(_0x1aa9,0xbb));var _0x91aa=function(_0x60b4aa,_0x51d5ab){_0x60b4aa=_0x60b4aa-0x0;var _0x4dc3a3=_0x1aa9[_0x60b4aa];return _0x4dc3a3;};'use strict';var multer=require(_0x91aa('0x0'));var util=require('util');var path=require(_0x91aa('0x1'));var timeout=require(_0x91aa('0x2'));var express=require(_0x91aa('0x3'));var router=express[_0x91aa('0x4')]();var fs_extra=require(_0x91aa('0x5'));var auth=require(_0x91aa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x91aa('0x7'));var controller=require(_0x91aa('0x8'));router[_0x91aa('0x9')]('/',auth[_0x91aa('0xa')](),controller[_0x91aa('0xb')]);router['get'](_0x91aa('0xc'),auth[_0x91aa('0xa')](),controller[_0x91aa('0xd')]);router[_0x91aa('0x9')](_0x91aa('0xe'),auth['isAuthenticated'](),controller[_0x91aa('0xf')]);router[_0x91aa('0x9')](_0x91aa('0x10'),auth[_0x91aa('0xa')](),controller[_0x91aa('0x11')]);router[_0x91aa('0x9')]('/:id/fields',auth[_0x91aa('0xa')](),controller[_0x91aa('0x12')]);router[_0x91aa('0x13')]('/',auth[_0x91aa('0xa')](),controller['create']);router[_0x91aa('0x14')](_0x91aa('0xc'),auth[_0x91aa('0xa')](),controller['update']);router[_0x91aa('0x15')](_0x91aa('0xc'),auth[_0x91aa('0xa')](),controller[_0x91aa('0x16')]);module[_0x91aa('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 2176e77..87a3e99 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 _0x3b1a=['STRING','sequelize','exports'];(function(_0x41f491,_0x11a4e6){var _0x48f776=function(_0x3843e5){while(--_0x3843e5){_0x41f491['push'](_0x41f491['shift']());}};_0x48f776(++_0x11a4e6);}(_0x3b1a,0x10f));var _0xa3b1=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x3b1a[_0x4de586];return _0x46baf5;};'use strict';var Sequelize=require(_0xa3b1('0x0'));module[_0xa3b1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa3b1('0x2')]}}; \ No newline at end of file +var _0x71a2=['STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x71a2,0x1c5));var _0x271a=function(_0x57b0b6,_0x321f11){_0x57b0b6=_0x57b0b6-0x0;var _0x40e196=_0x71a2[_0x57b0b6];return _0x40e196;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x271a('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 0bad678..44dd2ef 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 _0xb247=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','destroy','findOne','FreshsalesField','getSubjects','getDescriptions','nolimit','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs'];(function(_0x58ea9f,_0x3b4f60){var _0x4e34da=function(_0x1a55bb){while(--_0x1a55bb){_0x58ea9f['push'](_0x58ea9f['shift']());}};_0x4e34da(++_0x3b4f60);}(_0xb247,0x98));var _0x7b24=function(_0x5e2f7b,_0x226498){_0x5e2f7b=_0x5e2f7b-0x0;var _0x3c386e=_0xb247[_0x5e2f7b];return _0x3c386e;};'use strict';var emlformat=require(_0x7b24('0x0'));var rimraf=require(_0x7b24('0x1'));var zipdir=require(_0x7b24('0x2'));var jsonpatch=require(_0x7b24('0x3'));var rp=require(_0x7b24('0x4'));var moment=require(_0x7b24('0x5'));var BPromise=require(_0x7b24('0x6'));var Mustache=require('mustache');var util=require(_0x7b24('0x7'));var path=require(_0x7b24('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b24('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b24('0xa'));var squel=require(_0x7b24('0xb'));var crypto=require(_0x7b24('0xc'));var jsforce=require(_0x7b24('0xd'));var deskjs=require(_0x7b24('0xe'));var toCsv=require(_0x7b24('0xf'));var querystring=require(_0x7b24('0x10'));var Papa=require(_0x7b24('0x11'));var Redis=require('ioredis');var authService=require(_0x7b24('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7b24('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b24('0x14'))(_0x7b24('0x15'));var utils=require(_0x7b24('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7b24('0x17'));var db=require(_0x7b24('0x18'))['db'];function respondWithStatusCode(_0xd57276,_0x317272){_0x317272=_0x317272||0xcc;return function(_0x5607c4){if(_0x5607c4){return _0xd57276[_0x7b24('0x19')](_0x317272);}return _0xd57276['status'](_0x317272)[_0x7b24('0x1a')]();};}function respondWithResult(_0x19181a,_0x19b0ba){_0x19b0ba=_0x19b0ba||0xc8;return function(_0x2a461c){if(_0x2a461c){return _0x19181a[_0x7b24('0x1b')](_0x19b0ba)[_0x7b24('0x1c')](_0x2a461c);}};}function respondWithFilteredResult(_0xc27f40,_0x169ff6){return function(_0x1e6578){if(_0x1e6578){var _0x2ef096=typeof _0x169ff6[_0x7b24('0x1d')]===_0x7b24('0x1e')&&typeof _0x169ff6[_0x7b24('0x1f')]===_0x7b24('0x1e');var _0x3c76a8=_0x1e6578['count'];var _0x3baf6f=_0x2ef096?0x0:_0x169ff6[_0x7b24('0x1d')];var _0x207b1e=_0x2ef096?_0x1e6578[_0x7b24('0x20')]:_0x169ff6[_0x7b24('0x1d')]+_0x169ff6[_0x7b24('0x1f')];var _0x417672;if(_0x207b1e>=_0x3c76a8){_0x207b1e=_0x3c76a8;_0x417672=0xc8;}else{_0x417672=0xce;}_0xc27f40[_0x7b24('0x1b')](_0x417672);return _0xc27f40[_0x7b24('0x21')](_0x7b24('0x22'),_0x3baf6f+'-'+_0x207b1e+'/'+_0x3c76a8)['json'](_0x1e6578);}return null;};}function patchUpdates(_0x11abb8){return function(_0x477514){try{jsonpatch['apply'](_0x477514,_0x11abb8,!![]);}catch(_0x5dcec2){return BPromise[_0x7b24('0x23')](_0x5dcec2);}return _0x477514[_0x7b24('0x24')]();};}function saveUpdates(_0x2d19ec,_0x4dd9de){return function(_0x58a91b){if(_0x58a91b){return _0x58a91b[_0x7b24('0x25')](_0x2d19ec)[_0x7b24('0x26')](function(_0x1d7a7f){return _0x1d7a7f;});}return null;};}function removeEntity(_0x3f85e9,_0x5d5b92){return function(_0x39e7e6){if(_0x39e7e6){return _0x39e7e6['destroy']()[_0x7b24('0x26')](function(){_0x3f85e9[_0x7b24('0x1b')](0xcc)[_0x7b24('0x1a')]();});}};}function handleEntityNotFound(_0x556bd7,_0x2dfb1f){return function(_0x3025aa){if(!_0x3025aa){_0x556bd7['sendStatus'](0x194);}return _0x3025aa;};}function handleError(_0x4f8f1e,_0x1d77d1){_0x1d77d1=_0x1d77d1||0x1f4;return function(_0xd42dc0){logger['error'](_0xd42dc0['stack']);if(_0xd42dc0[_0x7b24('0x27')]){delete _0xd42dc0[_0x7b24('0x27')];}_0x4f8f1e[_0x7b24('0x1b')](_0x1d77d1)[_0x7b24('0x28')](_0xd42dc0);};}exports['index']=function(_0x1630e1,_0x42e18e){var _0x35a1cd={},_0x40ab52={},_0x2b3325={'count':0x0,'rows':[]};var _0x48424c=_[_0x7b24('0x29')](db[_0x7b24('0x2a')][_0x7b24('0x2b')],function(_0x512d49){return{'name':_0x512d49[_0x7b24('0x2c')],'type':_0x512d49['type'][_0x7b24('0x2d')]};});_0x40ab52[_0x7b24('0x2e')]=_['map'](_0x48424c,_0x7b24('0x27'));_0x40ab52[_0x7b24('0x2f')]=_['keys'](_0x1630e1[_0x7b24('0x2f')]);_0x40ab52['filters']=_[_0x7b24('0x30')](_0x40ab52['model'],_0x40ab52['query']);_0x35a1cd[_0x7b24('0x31')]=_['intersection'](_0x40ab52[_0x7b24('0x2e')],qs[_0x7b24('0x32')](_0x1630e1[_0x7b24('0x2f')]['fields']));_0x35a1cd['attributes']=_0x35a1cd[_0x7b24('0x31')][_0x7b24('0x33')]?_0x35a1cd[_0x7b24('0x31')]:_0x40ab52[_0x7b24('0x2e')];if(!_0x1630e1[_0x7b24('0x2f')][_0x7b24('0x34')]('nolimit')){_0x35a1cd[_0x7b24('0x1f')]=qs[_0x7b24('0x1f')](_0x1630e1[_0x7b24('0x2f')][_0x7b24('0x1f')]);_0x35a1cd['offset']=qs['offset'](_0x1630e1[_0x7b24('0x2f')][_0x7b24('0x1d')]);}_0x35a1cd[_0x7b24('0x35')]=qs[_0x7b24('0x36')](_0x1630e1[_0x7b24('0x2f')]['sort']);_0x35a1cd[_0x7b24('0x37')]=qs[_0x7b24('0x38')](_[_0x7b24('0x39')](_0x1630e1[_0x7b24('0x2f')],_0x40ab52[_0x7b24('0x38')]),_0x48424c);if(_0x1630e1['query']['filter']){_0x35a1cd[_0x7b24('0x37')]=_['merge'](_0x35a1cd[_0x7b24('0x37')],{'$or':_[_0x7b24('0x29')](_0x48424c,function(_0x38ec82){if(_0x38ec82[_0x7b24('0x3a')]!==_0x7b24('0x3b')){var _0x143b12={};_0x143b12[_0x38ec82[_0x7b24('0x27')]]={'$like':'%'+_0x1630e1[_0x7b24('0x2f')][_0x7b24('0x3c')]+'%'};return _0x143b12;}})});}_0x35a1cd=_[_0x7b24('0x3d')]({},_0x35a1cd,_0x1630e1['options']);var _0x439a09={'where':_0x35a1cd['where']};return db['FreshsalesConfiguration'][_0x7b24('0x20')](_0x439a09)[_0x7b24('0x26')](function(_0x2b8e11){_0x2b3325[_0x7b24('0x20')]=_0x2b8e11;if(_0x1630e1[_0x7b24('0x2f')][_0x7b24('0x3e')]){_0x35a1cd[_0x7b24('0x3f')]=[{'all':!![]}];}return db[_0x7b24('0x2a')][_0x7b24('0x40')](_0x35a1cd);})[_0x7b24('0x26')](function(_0x20ad96){_0x2b3325[_0x7b24('0x41')]=_0x20ad96;return _0x2b3325;})[_0x7b24('0x26')](respondWithFilteredResult(_0x42e18e,_0x35a1cd))[_0x7b24('0x42')](handleError(_0x42e18e,null));};exports[_0x7b24('0x43')]=function(_0x5ce9f2,_0x7bcf7c){var _0x1843a7={'raw':![],'where':{'id':_0x5ce9f2[_0x7b24('0x44')]['id']}},_0x126d4a={};_0x126d4a[_0x7b24('0x2e')]=_[_0x7b24('0x45')](db[_0x7b24('0x2a')][_0x7b24('0x2b')]);_0x126d4a[_0x7b24('0x2f')]=_[_0x7b24('0x45')](_0x5ce9f2['query']);_0x126d4a['filters']=_[_0x7b24('0x30')](_0x126d4a[_0x7b24('0x2e')],_0x126d4a[_0x7b24('0x2f')]);_0x1843a7[_0x7b24('0x31')]=_[_0x7b24('0x30')](_0x126d4a['model'],qs[_0x7b24('0x32')](_0x5ce9f2[_0x7b24('0x2f')]['fields']));_0x1843a7[_0x7b24('0x31')]=_0x1843a7[_0x7b24('0x31')][_0x7b24('0x33')]?_0x1843a7[_0x7b24('0x31')]:_0x126d4a[_0x7b24('0x2e')];if(_0x5ce9f2[_0x7b24('0x2f')][_0x7b24('0x3e')]){_0x1843a7[_0x7b24('0x3f')]=[{'all':!![]}];}_0x1843a7=_[_0x7b24('0x3d')]({},_0x1843a7,_0x5ce9f2[_0x7b24('0x46')]);return db[_0x7b24('0x2a')][_0x7b24('0x47')](_0x1843a7)[_0x7b24('0x26')](handleEntityNotFound(_0x7bcf7c,null))[_0x7b24('0x26')](respondWithResult(_0x7bcf7c,null))[_0x7b24('0x42')](handleError(_0x7bcf7c,null));};exports[_0x7b24('0x48')]=function(_0x477203,_0x1f70f8){return db[_0x7b24('0x2a')][_0x7b24('0x48')](_0x477203['body'],{})['then'](respondWithResult(_0x1f70f8,0xc9))[_0x7b24('0x42')](handleError(_0x1f70f8,null));};exports[_0x7b24('0x25')]=function(_0x43f7df,_0x33109f){if(_0x43f7df['body']['id']){delete _0x43f7df[_0x7b24('0x49')]['id'];}return db[_0x7b24('0x2a')]['find']({'where':{'id':_0x43f7df[_0x7b24('0x44')]['id']}})['then'](handleEntityNotFound(_0x33109f,null))[_0x7b24('0x26')](saveUpdates(_0x43f7df[_0x7b24('0x49')],null))[_0x7b24('0x26')](respondWithResult(_0x33109f,null))[_0x7b24('0x42')](handleError(_0x33109f,null));};exports[_0x7b24('0x4a')]=function(_0xa6dc0a,_0x24e485){return db['FreshsalesConfiguration']['find']({'where':{'id':_0xa6dc0a[_0x7b24('0x44')]['id']}})[_0x7b24('0x26')](handleEntityNotFound(_0x24e485,null))[_0x7b24('0x26')](removeEntity(_0x24e485,null))[_0x7b24('0x42')](handleError(_0x24e485,null));};exports['getSubjects']=function(_0x4cc987,_0x26cd66,_0x423eb6){var _0x479273={};var _0x28cacd={};var _0x2113d5;var _0x4528e9;return db[_0x7b24('0x2a')][_0x7b24('0x4b')]({'where':{'id':_0x4cc987[_0x7b24('0x44')]['id']}})[_0x7b24('0x26')](handleEntityNotFound(_0x26cd66,null))['then'](function(_0x23ea20){if(_0x23ea20){_0x2113d5=_0x23ea20;_0x28cacd[_0x7b24('0x2e')]=_[_0x7b24('0x45')](db[_0x7b24('0x4c')]['rawAttributes']);_0x28cacd[_0x7b24('0x2f')]=_[_0x7b24('0x45')](_0x4cc987[_0x7b24('0x2f')]);_0x28cacd[_0x7b24('0x38')]=_['intersection'](_0x28cacd[_0x7b24('0x2e')],_0x28cacd[_0x7b24('0x2f')]);_0x479273[_0x7b24('0x31')]=_[_0x7b24('0x30')](_0x28cacd[_0x7b24('0x2e')],qs[_0x7b24('0x32')](_0x4cc987[_0x7b24('0x2f')]['fields']));_0x479273[_0x7b24('0x31')]=_0x479273[_0x7b24('0x31')][_0x7b24('0x33')]?_0x479273[_0x7b24('0x31')]:_0x28cacd[_0x7b24('0x2e')];_0x479273[_0x7b24('0x35')]=qs[_0x7b24('0x36')](_0x4cc987[_0x7b24('0x2f')]['sort']);_0x479273[_0x7b24('0x37')]=qs['filters'](_['pick'](_0x4cc987[_0x7b24('0x2f')],_0x28cacd[_0x7b24('0x38')]));if(_0x4cc987[_0x7b24('0x2f')]['filter']){_0x479273[_0x7b24('0x37')]=_[_0x7b24('0x3d')](_0x479273[_0x7b24('0x37')],{'$or':_[_0x7b24('0x29')](_0x479273['attributes'],function(_0x1754d6){var _0x342e04={};_0x342e04[_0x1754d6]={'$like':'%'+_0x4cc987['query'][_0x7b24('0x3c')]+'%'};return _0x342e04;})});}_0x479273=_[_0x7b24('0x3d')]({},_0x479273,_0x4cc987[_0x7b24('0x46')]);return _0x2113d5[_0x7b24('0x4d')](_0x479273);}})[_0x7b24('0x26')](function(_0x10b8f0){if(_0x10b8f0){_0x4528e9=_0x10b8f0[_0x7b24('0x33')];if(!_0x4cc987[_0x7b24('0x2f')][_0x7b24('0x34')]('nolimit')){_0x479273[_0x7b24('0x1f')]=qs['limit'](_0x4cc987['query'][_0x7b24('0x1f')]);_0x479273[_0x7b24('0x1d')]=qs[_0x7b24('0x1d')](_0x4cc987['query'][_0x7b24('0x1d')]);}return _0x2113d5[_0x7b24('0x4d')](_0x479273);}})[_0x7b24('0x26')](function(_0x55e8ae){if(_0x55e8ae){return _0x55e8ae?{'count':_0x4528e9,'rows':_0x55e8ae}:null;}})[_0x7b24('0x26')](respondWithResult(_0x26cd66,null))['catch'](handleError(_0x26cd66,null));};exports[_0x7b24('0x4e')]=function(_0x238367,_0xcf3319,_0x480f4d){var _0x47a84d={};var _0x2e0017={};var _0x5b1d2f;var _0x580500;return db[_0x7b24('0x2a')][_0x7b24('0x4b')]({'where':{'id':_0x238367[_0x7b24('0x44')]['id']}})[_0x7b24('0x26')](handleEntityNotFound(_0xcf3319,null))[_0x7b24('0x26')](function(_0x1bd3fc){if(_0x1bd3fc){_0x5b1d2f=_0x1bd3fc;_0x2e0017[_0x7b24('0x2e')]=_[_0x7b24('0x45')](db[_0x7b24('0x4c')]['rawAttributes']);_0x2e0017[_0x7b24('0x2f')]=_['keys'](_0x238367[_0x7b24('0x2f')]);_0x2e0017['filters']=_[_0x7b24('0x30')](_0x2e0017[_0x7b24('0x2e')],_0x2e0017[_0x7b24('0x2f')]);_0x47a84d['attributes']=_['intersection'](_0x2e0017[_0x7b24('0x2e')],qs['fields'](_0x238367['query'][_0x7b24('0x32')]));_0x47a84d['attributes']=_0x47a84d[_0x7b24('0x31')][_0x7b24('0x33')]?_0x47a84d[_0x7b24('0x31')]:_0x2e0017['model'];_0x47a84d[_0x7b24('0x35')]=qs[_0x7b24('0x36')](_0x238367[_0x7b24('0x2f')]['sort']);_0x47a84d[_0x7b24('0x37')]=qs[_0x7b24('0x38')](_['pick'](_0x238367[_0x7b24('0x2f')],_0x2e0017[_0x7b24('0x38')]));if(_0x238367[_0x7b24('0x2f')]['filter']){_0x47a84d[_0x7b24('0x37')]=_[_0x7b24('0x3d')](_0x47a84d[_0x7b24('0x37')],{'$or':_['map'](_0x47a84d['attributes'],function(_0x230426){var _0x43634c={};_0x43634c[_0x230426]={'$like':'%'+_0x238367[_0x7b24('0x2f')][_0x7b24('0x3c')]+'%'};return _0x43634c;})});}_0x47a84d=_[_0x7b24('0x3d')]({},_0x47a84d,_0x238367[_0x7b24('0x46')]);return _0x5b1d2f['getDescriptions'](_0x47a84d);}})[_0x7b24('0x26')](function(_0x210f0e){if(_0x210f0e){_0x580500=_0x210f0e[_0x7b24('0x33')];if(!_0x238367[_0x7b24('0x2f')][_0x7b24('0x34')](_0x7b24('0x4f'))){_0x47a84d[_0x7b24('0x1f')]=qs['limit'](_0x238367['query'][_0x7b24('0x1f')]);_0x47a84d[_0x7b24('0x1d')]=qs[_0x7b24('0x1d')](_0x238367[_0x7b24('0x2f')]['offset']);}return _0x5b1d2f[_0x7b24('0x4e')](_0x47a84d);}})['then'](function(_0x56fef0){if(_0x56fef0){return _0x56fef0?{'count':_0x580500,'rows':_0x56fef0}:null;}})[_0x7b24('0x26')](respondWithResult(_0xcf3319,null))[_0x7b24('0x42')](handleError(_0xcf3319,null));};exports[_0x7b24('0x50')]=function(_0x46ca68,_0x2e6972,_0x5d90da){var _0x5d3941={};var _0x2adf66={};var _0x1a6f5c;var _0x26b19d;return db[_0x7b24('0x2a')][_0x7b24('0x4b')]({'where':{'id':_0x46ca68[_0x7b24('0x44')]['id']}})['then'](handleEntityNotFound(_0x2e6972,null))[_0x7b24('0x26')](function(_0x561014){if(_0x561014){_0x1a6f5c=_0x561014;_0x2adf66[_0x7b24('0x2e')]=_[_0x7b24('0x45')](db[_0x7b24('0x4c')]['rawAttributes']);_0x2adf66[_0x7b24('0x2f')]=_['keys'](_0x46ca68[_0x7b24('0x2f')]);_0x2adf66['filters']=_[_0x7b24('0x30')](_0x2adf66[_0x7b24('0x2e')],_0x2adf66[_0x7b24('0x2f')]);_0x5d3941[_0x7b24('0x31')]=_['intersection'](_0x2adf66['model'],qs[_0x7b24('0x32')](_0x46ca68[_0x7b24('0x2f')][_0x7b24('0x32')]));_0x5d3941['attributes']=_0x5d3941[_0x7b24('0x31')][_0x7b24('0x33')]?_0x5d3941[_0x7b24('0x31')]:_0x2adf66[_0x7b24('0x2e')];_0x5d3941[_0x7b24('0x35')]=qs[_0x7b24('0x36')](_0x46ca68['query'][_0x7b24('0x36')]);_0x5d3941[_0x7b24('0x37')]=qs[_0x7b24('0x38')](_[_0x7b24('0x39')](_0x46ca68[_0x7b24('0x2f')],_0x2adf66[_0x7b24('0x38')]));if(_0x46ca68[_0x7b24('0x2f')][_0x7b24('0x3c')]){_0x5d3941[_0x7b24('0x37')]=_['merge'](_0x5d3941[_0x7b24('0x37')],{'$or':_[_0x7b24('0x29')](_0x5d3941['attributes'],function(_0x4ff6c){var _0x433231={};_0x433231[_0x4ff6c]={'$like':'%'+_0x46ca68[_0x7b24('0x2f')][_0x7b24('0x3c')]+'%'};return _0x433231;})});}_0x5d3941=_['merge']({},_0x5d3941,_0x46ca68['options']);return _0x1a6f5c['getFields'](_0x5d3941);}})[_0x7b24('0x26')](function(_0x22e4bd){if(_0x22e4bd){_0x26b19d=_0x22e4bd['length'];if(!_0x46ca68[_0x7b24('0x2f')][_0x7b24('0x34')](_0x7b24('0x4f'))){_0x5d3941[_0x7b24('0x1f')]=qs[_0x7b24('0x1f')](_0x46ca68['query']['limit']);_0x5d3941['offset']=qs[_0x7b24('0x1d')](_0x46ca68[_0x7b24('0x2f')]['offset']);}return _0x1a6f5c[_0x7b24('0x50')](_0x5d3941);}})[_0x7b24('0x26')](function(_0x2974bc){if(_0x2974bc){return _0x2974bc?{'count':_0x26b19d,'rows':_0x2974bc}:null;}})[_0x7b24('0x26')](respondWithResult(_0x2e6972,null))[_0x7b24('0x42')](handleError(_0x2e6972,null));}; \ No newline at end of file +var _0x1df4=['util','path','sox','to-csv','lodash','squel','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','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','FreshsalesConfiguration','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','intersection','create','body','find','getSubjects','findOne','nolimit','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x393d69,_0x3a8c83){var _0x3cee37=function(_0x462682){while(--_0x462682){_0x393d69['push'](_0x393d69['shift']());}};_0x3cee37(++_0x3a8c83);}(_0x1df4,0x1e0));var _0x41df=function(_0x4744a8,_0xbac36f){_0x4744a8=_0x4744a8-0x0;var _0x13175e=_0x1df4[_0x4744a8];return _0x13175e;};'use strict';var emlformat=require(_0x41df('0x0'));var rimraf=require(_0x41df('0x1'));var zipdir=require(_0x41df('0x2'));var jsonpatch=require(_0x41df('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x41df('0x4'));var Mustache=require(_0x41df('0x5'));var util=require(_0x41df('0x6'));var path=require(_0x41df('0x7'));var sox=require(_0x41df('0x8'));var csv=require(_0x41df('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x41df('0xa'));var squel=require(_0x41df('0xb'));var crypto=require('crypto');var jsforce=require(_0x41df('0xc'));var deskjs=require(_0x41df('0xd'));var toCsv=require(_0x41df('0x9'));var querystring=require(_0x41df('0xe'));var Papa=require(_0x41df('0xf'));var Redis=require('ioredis');var authService=require(_0x41df('0x10'));var qs=require(_0x41df('0x11'));var as=require(_0x41df('0x12'));var hardwareService=require(_0x41df('0x13'));var logger=require('../../config/logger')(_0x41df('0x14'));var utils=require(_0x41df('0x15'));var config=require(_0x41df('0x16'));var licenseUtil=require(_0x41df('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x453f2a,_0x27e2d3){_0x27e2d3=_0x27e2d3||0xcc;return function(_0x5122d9){if(_0x5122d9){return _0x453f2a[_0x41df('0x18')](_0x27e2d3);}return _0x453f2a[_0x41df('0x19')](_0x27e2d3)[_0x41df('0x1a')]();};}function respondWithResult(_0x3910c1,_0xc8742c){_0xc8742c=_0xc8742c||0xc8;return function(_0x1420ca){if(_0x1420ca){return _0x3910c1[_0x41df('0x19')](_0xc8742c)[_0x41df('0x1b')](_0x1420ca);}};}function respondWithFilteredResult(_0x259ae7,_0xdeef5f){return function(_0x2052ba){if(_0x2052ba){var _0x58abce=typeof _0xdeef5f['offset']==='undefined'&&typeof _0xdeef5f[_0x41df('0x1c')]==='undefined';var _0x36ba18=_0x2052ba[_0x41df('0x1d')];var _0x29e5db=_0x58abce?0x0:_0xdeef5f[_0x41df('0x1e')];var _0xebae62=_0x58abce?_0x2052ba[_0x41df('0x1d')]:_0xdeef5f[_0x41df('0x1e')]+_0xdeef5f[_0x41df('0x1c')];var _0x138a6;if(_0xebae62>=_0x36ba18){_0xebae62=_0x36ba18;_0x138a6=0xc8;}else{_0x138a6=0xce;}_0x259ae7[_0x41df('0x19')](_0x138a6);return _0x259ae7[_0x41df('0x1f')](_0x41df('0x20'),_0x29e5db+'-'+_0xebae62+'/'+_0x36ba18)[_0x41df('0x1b')](_0x2052ba);}return null;};}function patchUpdates(_0x53a1e5){return function(_0x256343){try{jsonpatch[_0x41df('0x21')](_0x256343,_0x53a1e5,!![]);}catch(_0x417265){return BPromise[_0x41df('0x22')](_0x417265);}return _0x256343[_0x41df('0x23')]();};}function saveUpdates(_0x39163c,_0x50e86c){return function(_0x1bbfda){if(_0x1bbfda){return _0x1bbfda[_0x41df('0x24')](_0x39163c)[_0x41df('0x25')](function(_0x1e00d2){return _0x1e00d2;});}return null;};}function removeEntity(_0x19729f,_0x694f9f){return function(_0x4a9107){if(_0x4a9107){return _0x4a9107[_0x41df('0x26')]()['then'](function(){_0x19729f[_0x41df('0x19')](0xcc)[_0x41df('0x1a')]();});}};}function handleEntityNotFound(_0x3635f1,_0xc49f98){return function(_0x3929fe){if(!_0x3929fe){_0x3635f1['sendStatus'](0x194);}return _0x3929fe;};}function handleError(_0x58d28d,_0x50f46d){_0x50f46d=_0x50f46d||0x1f4;return function(_0x43efc2){logger['error'](_0x43efc2[_0x41df('0x27')]);if(_0x43efc2[_0x41df('0x28')]){delete _0x43efc2[_0x41df('0x28')];}_0x58d28d[_0x41df('0x19')](_0x50f46d)[_0x41df('0x29')](_0x43efc2);};}exports[_0x41df('0x2a')]=function(_0x5aeeab,_0x5b2340){var _0x257f51={},_0x3e8c0a={},_0x39b2fc={'count':0x0,'rows':[]};var _0x108658=_[_0x41df('0x2b')](db[_0x41df('0x2c')]['rawAttributes'],function(_0x1c7b66){return{'name':_0x1c7b66[_0x41df('0x2d')],'type':_0x1c7b66[_0x41df('0x2e')][_0x41df('0x2f')]};});_0x3e8c0a[_0x41df('0x30')]=_[_0x41df('0x2b')](_0x108658,_0x41df('0x28'));_0x3e8c0a[_0x41df('0x31')]=_['keys'](_0x5aeeab['query']);_0x3e8c0a[_0x41df('0x32')]=_['intersection'](_0x3e8c0a[_0x41df('0x30')],_0x3e8c0a[_0x41df('0x31')]);_0x257f51[_0x41df('0x33')]=_['intersection'](_0x3e8c0a[_0x41df('0x30')],qs[_0x41df('0x34')](_0x5aeeab[_0x41df('0x31')][_0x41df('0x34')]));_0x257f51['attributes']=_0x257f51[_0x41df('0x33')][_0x41df('0x35')]?_0x257f51[_0x41df('0x33')]:_0x3e8c0a[_0x41df('0x30')];if(!_0x5aeeab[_0x41df('0x31')][_0x41df('0x36')]('nolimit')){_0x257f51[_0x41df('0x1c')]=qs[_0x41df('0x1c')](_0x5aeeab[_0x41df('0x31')][_0x41df('0x1c')]);_0x257f51['offset']=qs[_0x41df('0x1e')](_0x5aeeab['query'][_0x41df('0x1e')]);}_0x257f51[_0x41df('0x37')]=qs['sort'](_0x5aeeab[_0x41df('0x31')][_0x41df('0x38')]);_0x257f51[_0x41df('0x39')]=qs['filters'](_[_0x41df('0x3a')](_0x5aeeab[_0x41df('0x31')],_0x3e8c0a[_0x41df('0x32')]),_0x108658);if(_0x5aeeab[_0x41df('0x31')][_0x41df('0x3b')]){_0x257f51[_0x41df('0x39')]=_[_0x41df('0x3c')](_0x257f51[_0x41df('0x39')],{'$or':_[_0x41df('0x2b')](_0x108658,function(_0x52b59e){if(_0x52b59e[_0x41df('0x2e')]!==_0x41df('0x3d')){var _0xc36f4d={};_0xc36f4d[_0x52b59e[_0x41df('0x28')]]={'$like':'%'+_0x5aeeab[_0x41df('0x31')][_0x41df('0x3b')]+'%'};return _0xc36f4d;}})});}_0x257f51=_['merge']({},_0x257f51,_0x5aeeab[_0x41df('0x3e')]);var _0x51d21e={'where':_0x257f51[_0x41df('0x39')]};return db['FreshsalesConfiguration']['count'](_0x51d21e)[_0x41df('0x25')](function(_0x446319){_0x39b2fc[_0x41df('0x1d')]=_0x446319;if(_0x5aeeab[_0x41df('0x31')][_0x41df('0x3f')]){_0x257f51[_0x41df('0x40')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x41df('0x41')](_0x257f51);})['then'](function(_0x3ffff7){_0x39b2fc[_0x41df('0x42')]=_0x3ffff7;return _0x39b2fc;})['then'](respondWithFilteredResult(_0x5b2340,_0x257f51))[_0x41df('0x43')](handleError(_0x5b2340,null));};exports['show']=function(_0xa8dd2c,_0x418ab7){var _0x4a3d0f={'raw':![],'where':{'id':_0xa8dd2c[_0x41df('0x44')]['id']}},_0x23e4dc={};_0x23e4dc['model']=_[_0x41df('0x45')](db[_0x41df('0x2c')][_0x41df('0x46')]);_0x23e4dc[_0x41df('0x31')]=_[_0x41df('0x45')](_0xa8dd2c[_0x41df('0x31')]);_0x23e4dc['filters']=_[_0x41df('0x47')](_0x23e4dc[_0x41df('0x30')],_0x23e4dc['query']);_0x4a3d0f[_0x41df('0x33')]=_['intersection'](_0x23e4dc[_0x41df('0x30')],qs['fields'](_0xa8dd2c['query'][_0x41df('0x34')]));_0x4a3d0f[_0x41df('0x33')]=_0x4a3d0f[_0x41df('0x33')][_0x41df('0x35')]?_0x4a3d0f['attributes']:_0x23e4dc[_0x41df('0x30')];if(_0xa8dd2c['query'][_0x41df('0x3f')]){_0x4a3d0f[_0x41df('0x40')]=[{'all':!![]}];}_0x4a3d0f=_['merge']({},_0x4a3d0f,_0xa8dd2c[_0x41df('0x3e')]);return db[_0x41df('0x2c')]['find'](_0x4a3d0f)[_0x41df('0x25')](handleEntityNotFound(_0x418ab7,null))[_0x41df('0x25')](respondWithResult(_0x418ab7,null))[_0x41df('0x43')](handleError(_0x418ab7,null));};exports['create']=function(_0x4b37e8,_0x1f382c){return db['FreshsalesConfiguration'][_0x41df('0x48')](_0x4b37e8[_0x41df('0x49')],{})[_0x41df('0x25')](respondWithResult(_0x1f382c,0xc9))[_0x41df('0x43')](handleError(_0x1f382c,null));};exports[_0x41df('0x24')]=function(_0x1bf563,_0x1f9575){if(_0x1bf563[_0x41df('0x49')]['id']){delete _0x1bf563[_0x41df('0x49')]['id'];}return db[_0x41df('0x2c')][_0x41df('0x4a')]({'where':{'id':_0x1bf563['params']['id']}})[_0x41df('0x25')](handleEntityNotFound(_0x1f9575,null))[_0x41df('0x25')](saveUpdates(_0x1bf563[_0x41df('0x49')],null))[_0x41df('0x25')](respondWithResult(_0x1f9575,null))[_0x41df('0x43')](handleError(_0x1f9575,null));};exports['destroy']=function(_0x5bde49,_0x1da318){return db['FreshsalesConfiguration'][_0x41df('0x4a')]({'where':{'id':_0x5bde49[_0x41df('0x44')]['id']}})[_0x41df('0x25')](handleEntityNotFound(_0x1da318,null))[_0x41df('0x25')](removeEntity(_0x1da318,null))[_0x41df('0x43')](handleError(_0x1da318,null));};exports[_0x41df('0x4b')]=function(_0x1cadcc,_0x2fdf17,_0x40c834){var _0x95a65={};var _0x4370ab={};var _0x335d32;var _0x3d2d1f;return db['FreshsalesConfiguration'][_0x41df('0x4c')]({'where':{'id':_0x1cadcc[_0x41df('0x44')]['id']}})[_0x41df('0x25')](handleEntityNotFound(_0x2fdf17,null))[_0x41df('0x25')](function(_0x6640e9){if(_0x6640e9){_0x335d32=_0x6640e9;_0x4370ab['model']=_[_0x41df('0x45')](db['FreshsalesField'][_0x41df('0x46')]);_0x4370ab[_0x41df('0x31')]=_[_0x41df('0x45')](_0x1cadcc['query']);_0x4370ab[_0x41df('0x32')]=_['intersection'](_0x4370ab[_0x41df('0x30')],_0x4370ab[_0x41df('0x31')]);_0x95a65[_0x41df('0x33')]=_['intersection'](_0x4370ab[_0x41df('0x30')],qs[_0x41df('0x34')](_0x1cadcc[_0x41df('0x31')][_0x41df('0x34')]));_0x95a65[_0x41df('0x33')]=_0x95a65['attributes']['length']?_0x95a65[_0x41df('0x33')]:_0x4370ab[_0x41df('0x30')];_0x95a65[_0x41df('0x37')]=qs[_0x41df('0x38')](_0x1cadcc['query']['sort']);_0x95a65[_0x41df('0x39')]=qs[_0x41df('0x32')](_[_0x41df('0x3a')](_0x1cadcc[_0x41df('0x31')],_0x4370ab[_0x41df('0x32')]));if(_0x1cadcc[_0x41df('0x31')][_0x41df('0x3b')]){_0x95a65[_0x41df('0x39')]=_[_0x41df('0x3c')](_0x95a65[_0x41df('0x39')],{'$or':_[_0x41df('0x2b')](_0x95a65['attributes'],function(_0x526028){var _0x3307da={};_0x3307da[_0x526028]={'$like':'%'+_0x1cadcc[_0x41df('0x31')]['filter']+'%'};return _0x3307da;})});}_0x95a65=_[_0x41df('0x3c')]({},_0x95a65,_0x1cadcc[_0x41df('0x3e')]);return _0x335d32['getSubjects'](_0x95a65);}})[_0x41df('0x25')](function(_0xc2deaa){if(_0xc2deaa){_0x3d2d1f=_0xc2deaa[_0x41df('0x35')];if(!_0x1cadcc[_0x41df('0x31')][_0x41df('0x36')](_0x41df('0x4d'))){_0x95a65[_0x41df('0x1c')]=qs['limit'](_0x1cadcc[_0x41df('0x31')][_0x41df('0x1c')]);_0x95a65[_0x41df('0x1e')]=qs[_0x41df('0x1e')](_0x1cadcc[_0x41df('0x31')][_0x41df('0x1e')]);}return _0x335d32['getSubjects'](_0x95a65);}})[_0x41df('0x25')](function(_0x368911){if(_0x368911){return _0x368911?{'count':_0x3d2d1f,'rows':_0x368911}:null;}})[_0x41df('0x25')](respondWithResult(_0x2fdf17,null))[_0x41df('0x43')](handleError(_0x2fdf17,null));};exports['getDescriptions']=function(_0x432438,_0x5e0df2,_0x4bdd7f){var _0x533b38={};var _0x2d2113={};var _0x30e2f;var _0xfec39;return db['FreshsalesConfiguration'][_0x41df('0x4c')]({'where':{'id':_0x432438['params']['id']}})['then'](handleEntityNotFound(_0x5e0df2,null))[_0x41df('0x25')](function(_0x1e4782){if(_0x1e4782){_0x30e2f=_0x1e4782;_0x2d2113[_0x41df('0x30')]=_[_0x41df('0x45')](db[_0x41df('0x4e')]['rawAttributes']);_0x2d2113[_0x41df('0x31')]=_[_0x41df('0x45')](_0x432438[_0x41df('0x31')]);_0x2d2113[_0x41df('0x32')]=_[_0x41df('0x47')](_0x2d2113['model'],_0x2d2113[_0x41df('0x31')]);_0x533b38[_0x41df('0x33')]=_[_0x41df('0x47')](_0x2d2113[_0x41df('0x30')],qs[_0x41df('0x34')](_0x432438[_0x41df('0x31')][_0x41df('0x34')]));_0x533b38[_0x41df('0x33')]=_0x533b38['attributes']['length']?_0x533b38['attributes']:_0x2d2113[_0x41df('0x30')];_0x533b38[_0x41df('0x37')]=qs[_0x41df('0x38')](_0x432438[_0x41df('0x31')][_0x41df('0x38')]);_0x533b38[_0x41df('0x39')]=qs[_0x41df('0x32')](_[_0x41df('0x3a')](_0x432438[_0x41df('0x31')],_0x2d2113['filters']));if(_0x432438['query'][_0x41df('0x3b')]){_0x533b38[_0x41df('0x39')]=_[_0x41df('0x3c')](_0x533b38[_0x41df('0x39')],{'$or':_['map'](_0x533b38[_0x41df('0x33')],function(_0x279640){var _0x23e484={};_0x23e484[_0x279640]={'$like':'%'+_0x432438[_0x41df('0x31')][_0x41df('0x3b')]+'%'};return _0x23e484;})});}_0x533b38=_['merge']({},_0x533b38,_0x432438[_0x41df('0x3e')]);return _0x30e2f[_0x41df('0x4f')](_0x533b38);}})[_0x41df('0x25')](function(_0x300d63){if(_0x300d63){_0xfec39=_0x300d63['length'];if(!_0x432438['query'][_0x41df('0x36')](_0x41df('0x4d'))){_0x533b38[_0x41df('0x1c')]=qs[_0x41df('0x1c')](_0x432438['query'][_0x41df('0x1c')]);_0x533b38[_0x41df('0x1e')]=qs[_0x41df('0x1e')](_0x432438[_0x41df('0x31')][_0x41df('0x1e')]);}return _0x30e2f[_0x41df('0x4f')](_0x533b38);}})['then'](function(_0x4a435f){if(_0x4a435f){return _0x4a435f?{'count':_0xfec39,'rows':_0x4a435f}:null;}})[_0x41df('0x25')](respondWithResult(_0x5e0df2,null))[_0x41df('0x43')](handleError(_0x5e0df2,null));};exports[_0x41df('0x50')]=function(_0x20ca61,_0x4487f6,_0xe4c218){var _0x1d8dfd={};var _0x255b5d={};var _0x1de98d;var _0x51ebb9;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x20ca61[_0x41df('0x44')]['id']}})[_0x41df('0x25')](handleEntityNotFound(_0x4487f6,null))[_0x41df('0x25')](function(_0x3402df){if(_0x3402df){_0x1de98d=_0x3402df;_0x255b5d[_0x41df('0x30')]=_['keys'](db[_0x41df('0x4e')][_0x41df('0x46')]);_0x255b5d[_0x41df('0x31')]=_[_0x41df('0x45')](_0x20ca61[_0x41df('0x31')]);_0x255b5d[_0x41df('0x32')]=_[_0x41df('0x47')](_0x255b5d[_0x41df('0x30')],_0x255b5d[_0x41df('0x31')]);_0x1d8dfd[_0x41df('0x33')]=_[_0x41df('0x47')](_0x255b5d[_0x41df('0x30')],qs[_0x41df('0x34')](_0x20ca61['query'][_0x41df('0x34')]));_0x1d8dfd[_0x41df('0x33')]=_0x1d8dfd[_0x41df('0x33')][_0x41df('0x35')]?_0x1d8dfd['attributes']:_0x255b5d[_0x41df('0x30')];_0x1d8dfd['order']=qs[_0x41df('0x38')](_0x20ca61['query'][_0x41df('0x38')]);_0x1d8dfd[_0x41df('0x39')]=qs[_0x41df('0x32')](_[_0x41df('0x3a')](_0x20ca61[_0x41df('0x31')],_0x255b5d[_0x41df('0x32')]));if(_0x20ca61[_0x41df('0x31')][_0x41df('0x3b')]){_0x1d8dfd['where']=_[_0x41df('0x3c')](_0x1d8dfd['where'],{'$or':_[_0x41df('0x2b')](_0x1d8dfd['attributes'],function(_0x56bd75){var _0x3a24a4={};_0x3a24a4[_0x56bd75]={'$like':'%'+_0x20ca61[_0x41df('0x31')][_0x41df('0x3b')]+'%'};return _0x3a24a4;})});}_0x1d8dfd=_[_0x41df('0x3c')]({},_0x1d8dfd,_0x20ca61['options']);return _0x1de98d[_0x41df('0x50')](_0x1d8dfd);}})[_0x41df('0x25')](function(_0x3cb7d7){if(_0x3cb7d7){_0x51ebb9=_0x3cb7d7[_0x41df('0x35')];if(!_0x20ca61[_0x41df('0x31')]['hasOwnProperty'](_0x41df('0x4d'))){_0x1d8dfd['limit']=qs[_0x41df('0x1c')](_0x20ca61['query'][_0x41df('0x1c')]);_0x1d8dfd[_0x41df('0x1e')]=qs[_0x41df('0x1e')](_0x20ca61[_0x41df('0x31')][_0x41df('0x1e')]);}return _0x1de98d['getFields'](_0x1d8dfd);}})[_0x41df('0x25')](function(_0x5e6b54){if(_0x5e6b54){return _0x5e6b54?{'count':_0x51ebb9,'rows':_0x5e6b54}:null;}})[_0x41df('0x25')](respondWithResult(_0x4487f6,null))[_0x41df('0x43')](handleError(_0x4487f6,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index e79f9f2..3f504ac 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 _0x3689=['bluebird','request-promise','../../config/environment','./intFreshsalesConfiguration.attributes','define','int_freshsales_configurations','util','../../config/logger','api','moment'];(function(_0x31b75e,_0x289145){var _0x17023a=function(_0x3242d0){while(--_0x3242d0){_0x31b75e['push'](_0x31b75e['shift']());}};_0x17023a(++_0x289145);}(_0x3689,0x150));var _0x9368=function(_0x538126,_0x32161c){_0x538126=_0x538126-0x0;var _0x4320e9=_0x3689[_0x538126];return _0x4320e9;};'use strict';var _=require('lodash');var util=require(_0x9368('0x0'));var logger=require(_0x9368('0x1'))(_0x9368('0x2'));var moment=require(_0x9368('0x3'));var BPromise=require(_0x9368('0x4'));var rp=require(_0x9368('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9368('0x6'));var attributes=require(_0x9368('0x7'));module['exports']=function(_0x5f435a,_0x269f8b){return _0x5f435a[_0x9368('0x8')]('FreshsalesConfiguration',attributes,{'tableName':_0x9368('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c77=['define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c77,0x9f));var _0x79c7=function(_0x27419d,_0x3c5002){_0x27419d=_0x27419d-0x0;var _0x222248=_0x9c77[_0x27419d];return _0x222248;};'use strict';var _=require(_0x79c7('0x0'));var util=require(_0x79c7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x79c7('0x2'));var BPromise=require(_0x79c7('0x3'));var rp=require(_0x79c7('0x4'));var fs=require('fs');var path=require(_0x79c7('0x5'));var rimraf=require(_0x79c7('0x6'));var config=require(_0x79c7('0x7'));var attributes=require(_0x79c7('0x8'));module['exports']=function(_0x4e9fca,_0x33876c){return _0x4e9fca[_0x79c7('0x9')](_0x79c7('0xa'),attributes,{'tableName':_0x79c7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index b92a105..9a21458 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 _0x963e=['client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0xd7b0a4,_0x53c7d3){var _0x184e9e=function(_0x325bbd){while(--_0x325bbd){_0xd7b0a4['push'](_0xd7b0a4['shift']());}};_0x184e9e(++_0x53c7d3);}(_0x963e,0x1d8));var _0xe963=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0x963e[_0x1bb58c];return _0x277586;};'use strict';var _=require(_0xe963('0x0'));var util=require(_0xe963('0x1'));var moment=require(_0xe963('0x2'));var BPromise=require(_0xe963('0x3'));var rs=require(_0xe963('0x4'));var fs=require('fs');var Redis=require(_0xe963('0x5'));var db=require(_0xe963('0x6'))['db'];var utils=require(_0xe963('0x7'));var logger=require('../../config/logger')(_0xe963('0x8'));var config=require(_0xe963('0x9'));var jayson=require(_0xe963('0xa'));var client=jayson[_0xe963('0xb')][_0xe963('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1695ba,_0x55118e,_0x255732){return new BPromise(function(_0x930b34,_0x12ccf6){return client[_0xe963('0xd')](_0x1695ba,_0x255732)[_0xe963('0xe')](function(_0x32c0a8){logger['info'](_0xe963('0xf'),_0x55118e,_0xe963('0x10'));logger[_0xe963('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x55118e,'request\x20sent',JSON['stringify'](_0x32c0a8));if(_0x32c0a8['error']){if(_0x32c0a8[_0xe963('0x12')]['code']===0x1f4){logger[_0xe963('0x12')](_0xe963('0xf'),_0x55118e,_0x32c0a8[_0xe963('0x12')][_0xe963('0x13')]);return _0x12ccf6(_0x32c0a8[_0xe963('0x12')]['message']);}logger[_0xe963('0x12')](_0xe963('0xf'),_0x55118e,_0x32c0a8[_0xe963('0x12')][_0xe963('0x13')]);return _0x930b34(_0x32c0a8[_0xe963('0x12')][_0xe963('0x13')]);}else{logger[_0xe963('0x14')](_0xe963('0xf'),_0x55118e,_0xe963('0x10'));_0x930b34(_0x32c0a8[_0xe963('0x15')][_0xe963('0x13')]);}})[_0xe963('0x16')](function(_0x2f3bc6){logger[_0xe963('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x55118e,_0x2f3bc6);_0x12ccf6(_0x2f3bc6);});});} \ No newline at end of file +var _0x5128=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0xe62ee0,_0x94ce09){var _0x240454=function(_0x27bf77){while(--_0x27bf77){_0xe62ee0['push'](_0xe62ee0['shift']());}};_0x240454(++_0x94ce09);}(_0x5128,0xf2));var _0x8512=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x5128[_0x5447fd];return _0x15b28a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8512('0x0'));var BPromise=require(_0x8512('0x1'));var rs=require(_0x8512('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8512('0x3'))['db'];var utils=require(_0x8512('0x4'));var logger=require(_0x8512('0x5'))(_0x8512('0x6'));var config=require(_0x8512('0x7'));var jayson=require(_0x8512('0x8'));var client=jayson[_0x8512('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56104b,_0x15f750,_0x8468aa){return new BPromise(function(_0x58a02a,_0x497bc9){return client[_0x8512('0xa')](_0x56104b,_0x8468aa)[_0x8512('0xb')](function(_0x1081bc){logger[_0x8512('0xc')](_0x8512('0xd'),_0x15f750,_0x8512('0xe'));logger['debug'](_0x8512('0xf'),_0x15f750,_0x8512('0xe'),JSON[_0x8512('0x10')](_0x1081bc));if(_0x1081bc[_0x8512('0x11')]){if(_0x1081bc[_0x8512('0x11')][_0x8512('0x12')]===0x1f4){logger[_0x8512('0x11')](_0x8512('0xd'),_0x15f750,_0x1081bc['error']['message']);return _0x497bc9(_0x1081bc['error'][_0x8512('0x13')]);}logger[_0x8512('0x11')](_0x8512('0xd'),_0x15f750,_0x1081bc[_0x8512('0x11')][_0x8512('0x13')]);return _0x58a02a(_0x1081bc[_0x8512('0x11')]['message']);}else{logger[_0x8512('0xc')](_0x8512('0xd'),_0x15f750,_0x8512('0xe'));_0x58a02a(_0x1081bc[_0x8512('0x14')][_0x8512('0x13')]);}})[_0x8512('0x15')](function(_0x5c1feb){logger[_0x8512('0x11')](_0x8512('0xd'),_0x15f750,_0x5c1feb);_0x497bc9(_0x5c1feb);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index e134b08..ac96fe7 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 _0x180f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x226ad1,_0x2858e2){var _0x16b625=function(_0x4dc555){while(--_0x4dc555){_0x226ad1['push'](_0x226ad1['shift']());}};_0x16b625(++_0x2858e2);}(_0x180f,0xf3));var _0xf180=function(_0x36fbef,_0x4ffc84){_0x36fbef=_0x36fbef-0x0;var _0x45e270=_0x180f[_0x36fbef];return _0x45e270;};'use strict';var multer=require(_0xf180('0x0'));var util=require(_0xf180('0x1'));var path=require('path');var timeout=require(_0xf180('0x2'));var express=require(_0xf180('0x3'));var router=express['Router']();var fs_extra=require(_0xf180('0x4'));var auth=require(_0xf180('0x5'));var interaction=require(_0xf180('0x6'));var config=require(_0xf180('0x7'));var controller=require(_0xf180('0x8'));router['get']('/',auth[_0xf180('0x9')](),controller[_0xf180('0xa')]);router['get']('/:id',auth[_0xf180('0x9')](),controller[_0xf180('0xb')]);router[_0xf180('0xc')]('/',auth[_0xf180('0x9')](),controller[_0xf180('0xd')]);router[_0xf180('0xe')](_0xf180('0xf'),auth[_0xf180('0x9')](),controller[_0xf180('0x10')]);router['delete'](_0xf180('0xf'),auth[_0xf180('0x9')](),controller[_0xf180('0x11')]);module[_0xf180('0x12')]=router; \ No newline at end of file +var _0x0328=['../../config/environment','./intFreshsalesField.controller','isAuthenticated','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0328,0x172));var _0x8032=function(_0x1f62d3,_0x24ebbe){_0x1f62d3=_0x1f62d3-0x0;var _0x1f6fd9=_0x0328[_0x1f62d3];return _0x1f6fd9;};'use strict';var multer=require(_0x8032('0x0'));var util=require(_0x8032('0x1'));var path=require(_0x8032('0x2'));var timeout=require(_0x8032('0x3'));var express=require(_0x8032('0x4'));var router=express[_0x8032('0x5')]();var fs_extra=require(_0x8032('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8032('0x7'));var config=require(_0x8032('0x8'));var controller=require(_0x8032('0x9'));router['get']('/',auth[_0x8032('0xa')](),controller['index']);router['get'](_0x8032('0xb'),auth[_0x8032('0xa')](),controller['show']);router[_0x8032('0xc')]('/',auth['isAuthenticated'](),controller[_0x8032('0xd')]);router[_0x8032('0xe')](_0x8032('0xb'),auth['isAuthenticated'](),controller[_0x8032('0xf')]);router[_0x8032('0x10')](_0x8032('0xb'),auth['isAuthenticated'](),controller[_0x8032('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 11d2c44..37c0673 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 _0x5f90=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','STRING'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5f90,0x89));var _0x05f9=function(_0x135b04,_0x4d1323){_0x135b04=_0x135b04-0x0;var _0x436b8a=_0x5f90[_0x135b04];return _0x436b8a;};'use strict';var Sequelize=require(_0x05f9('0x0'));module[_0x05f9('0x1')]={'type':{'type':Sequelize[_0x05f9('0x2')](_0x05f9('0x3'),_0x05f9('0x4'),_0x05f9('0x5'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x05f9('0x6')]},'key':{'type':Sequelize[_0x05f9('0x6')]},'keyType':{'type':Sequelize[_0x05f9('0x2')](_0x05f9('0x3'),_0x05f9('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x05f9('0x6')]},'idField':{'type':Sequelize[_0x05f9('0x6')]},'nameField':{'type':Sequelize[_0x05f9('0x6')]},'customField':{'type':Sequelize[_0x05f9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf1df=['string','variable','customVariable','keyValue','STRING','ENUM','sequelize'];(function(_0x33f6ae,_0x499448){var _0x16ec5c=function(_0x2173d2){while(--_0x2173d2){_0x33f6ae['push'](_0x33f6ae['shift']());}};_0x16ec5c(++_0x499448);}(_0xf1df,0x12c));var _0xff1d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf1df[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xff1d('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xff1d('0x1'),_0xff1d('0x2'),_0xff1d('0x3'),_0xff1d('0x4'),'picklist'),'defaultValue':_0xff1d('0x1')},'content':{'type':Sequelize[_0xff1d('0x5')]},'key':{'type':Sequelize[_0xff1d('0x5')]},'keyType':{'type':Sequelize[_0xff1d('0x6')](_0xff1d('0x1'),_0xff1d('0x2'),_0xff1d('0x3'))},'keyContent':{'type':Sequelize[_0xff1d('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xff1d('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xff1d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index c3f5635..0e1ca4e 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 _0xa149=['then','destroy','error','stack','send','index','map','FreshsalesField','rawAttributes','type','key','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','catch','show','params','keys','find','create','body','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','set','json','apply','save','update'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xa149,0x187));var _0x9a14=function(_0xd195a5,_0x2692be){_0xd195a5=_0xd195a5-0x0;var _0x376e30=_0xa149[_0xd195a5];return _0x376e30;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9a14('0x0'));var rp=require(_0x9a14('0x1'));var moment=require(_0x9a14('0x2'));var BPromise=require(_0x9a14('0x3'));var Mustache=require(_0x9a14('0x4'));var util=require(_0x9a14('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x9a14('0x6'));var ejs=require(_0x9a14('0x7'));var fs=require('fs');var fs_extra=require(_0x9a14('0x8'));var _=require(_0x9a14('0x9'));var squel=require('squel');var crypto=require(_0x9a14('0xa'));var jsforce=require(_0x9a14('0xb'));var deskjs=require(_0x9a14('0xc'));var toCsv=require(_0x9a14('0x6'));var querystring=require(_0x9a14('0xd'));var Papa=require(_0x9a14('0xe'));var Redis=require(_0x9a14('0xf'));var authService=require(_0x9a14('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9a14('0x11'));var hardwareService=require(_0x9a14('0x12'));var logger=require(_0x9a14('0x13'))(_0x9a14('0x14'));var utils=require(_0x9a14('0x15'));var config=require(_0x9a14('0x16'));var licenseUtil=require(_0x9a14('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c995c,_0x2e5ac9){_0x2e5ac9=_0x2e5ac9||0xcc;return function(_0x47fc23){if(_0x47fc23){return _0x2c995c[_0x9a14('0x18')](_0x2e5ac9);}return _0x2c995c[_0x9a14('0x19')](_0x2e5ac9)[_0x9a14('0x1a')]();};}function respondWithResult(_0x39c72b,_0x55f299){_0x55f299=_0x55f299||0xc8;return function(_0x1e3ca7){if(_0x1e3ca7){return _0x39c72b['status'](_0x55f299)['json'](_0x1e3ca7);}};}function respondWithFilteredResult(_0x85c9c1,_0x5b4d9a){return function(_0x38f3ac){if(_0x38f3ac){var _0x4bd6f9=typeof _0x5b4d9a[_0x9a14('0x1b')]==='undefined'&&typeof _0x5b4d9a['limit']===_0x9a14('0x1c');var _0x2eedc9=_0x38f3ac[_0x9a14('0x1d')];var _0xf1d801=_0x4bd6f9?0x0:_0x5b4d9a[_0x9a14('0x1b')];var _0xce2978=_0x4bd6f9?_0x38f3ac['count']:_0x5b4d9a[_0x9a14('0x1b')]+_0x5b4d9a['limit'];var _0x7aaec5;if(_0xce2978>=_0x2eedc9){_0xce2978=_0x2eedc9;_0x7aaec5=0xc8;}else{_0x7aaec5=0xce;}_0x85c9c1[_0x9a14('0x19')](_0x7aaec5);return _0x85c9c1[_0x9a14('0x1e')]('Content-Range',_0xf1d801+'-'+_0xce2978+'/'+_0x2eedc9)[_0x9a14('0x1f')](_0x38f3ac);}return null;};}function patchUpdates(_0x416230){return function(_0x34dcee){try{jsonpatch[_0x9a14('0x20')](_0x34dcee,_0x416230,!![]);}catch(_0x2d9caa){return BPromise['reject'](_0x2d9caa);}return _0x34dcee[_0x9a14('0x21')]();};}function saveUpdates(_0x10e74a,_0xc55e1f){return function(_0x125fb9){if(_0x125fb9){return _0x125fb9[_0x9a14('0x22')](_0x10e74a)[_0x9a14('0x23')](function(_0x949505){return _0x949505;});}return null;};}function removeEntity(_0x5473c6,_0x33270a){return function(_0x4feba8){if(_0x4feba8){return _0x4feba8[_0x9a14('0x24')]()[_0x9a14('0x23')](function(){_0x5473c6[_0x9a14('0x19')](0xcc)[_0x9a14('0x1a')]();});}};}function handleEntityNotFound(_0x14a790,_0x3f67dd){return function(_0x1e8af1){if(!_0x1e8af1){_0x14a790['sendStatus'](0x194);}return _0x1e8af1;};}function handleError(_0x306ddb,_0x2fe5e6){_0x2fe5e6=_0x2fe5e6||0x1f4;return function(_0x3aee42){logger[_0x9a14('0x25')](_0x3aee42[_0x9a14('0x26')]);if(_0x3aee42['name']){delete _0x3aee42['name'];}_0x306ddb[_0x9a14('0x19')](_0x2fe5e6)[_0x9a14('0x27')](_0x3aee42);};}exports[_0x9a14('0x28')]=function(_0x19a374,_0x151d2d){var _0x359aff={},_0x283ead={},_0x1ac5f6={'count':0x0,'rows':[]};var _0x125596=_[_0x9a14('0x29')](db[_0x9a14('0x2a')][_0x9a14('0x2b')],function(_0x2932c4){return{'name':_0x2932c4['fieldName'],'type':_0x2932c4[_0x9a14('0x2c')][_0x9a14('0x2d')]};});_0x283ead['model']=_[_0x9a14('0x29')](_0x125596,_0x9a14('0x2e'));_0x283ead[_0x9a14('0x2f')]=_['keys'](_0x19a374[_0x9a14('0x2f')]);_0x283ead[_0x9a14('0x30')]=_[_0x9a14('0x31')](_0x283ead[_0x9a14('0x32')],_0x283ead[_0x9a14('0x2f')]);_0x359aff[_0x9a14('0x33')]=_[_0x9a14('0x31')](_0x283ead[_0x9a14('0x32')],qs['fields'](_0x19a374['query'][_0x9a14('0x34')]));_0x359aff[_0x9a14('0x33')]=_0x359aff[_0x9a14('0x33')][_0x9a14('0x35')]?_0x359aff[_0x9a14('0x33')]:_0x283ead[_0x9a14('0x32')];if(!_0x19a374[_0x9a14('0x2f')][_0x9a14('0x36')](_0x9a14('0x37'))){_0x359aff[_0x9a14('0x38')]=qs[_0x9a14('0x38')](_0x19a374[_0x9a14('0x2f')][_0x9a14('0x38')]);_0x359aff[_0x9a14('0x1b')]=qs[_0x9a14('0x1b')](_0x19a374[_0x9a14('0x2f')][_0x9a14('0x1b')]);}_0x359aff[_0x9a14('0x39')]=qs[_0x9a14('0x3a')](_0x19a374[_0x9a14('0x2f')][_0x9a14('0x3a')]);_0x359aff[_0x9a14('0x3b')]=qs[_0x9a14('0x30')](_['pick'](_0x19a374['query'],_0x283ead[_0x9a14('0x30')]),_0x125596);if(_0x19a374['query']['filter']){_0x359aff[_0x9a14('0x3b')]=_[_0x9a14('0x3c')](_0x359aff[_0x9a14('0x3b')],{'$or':_['map'](_0x125596,function(_0x35aa88){if(_0x35aa88[_0x9a14('0x2c')]!==_0x9a14('0x3d')){var _0x38aac2={};_0x38aac2[_0x35aa88[_0x9a14('0x2e')]]={'$like':'%'+_0x19a374['query'][_0x9a14('0x3e')]+'%'};return _0x38aac2;}})});}_0x359aff=_[_0x9a14('0x3c')]({},_0x359aff,_0x19a374[_0x9a14('0x3f')]);var _0xc2c1ea={'where':_0x359aff[_0x9a14('0x3b')]};return db[_0x9a14('0x2a')][_0x9a14('0x1d')](_0xc2c1ea)['then'](function(_0x5d9f8d){_0x1ac5f6['count']=_0x5d9f8d;if(_0x19a374[_0x9a14('0x2f')]['includeAll']){_0x359aff['include']=[{'all':!![]}];}return db[_0x9a14('0x2a')]['findAll'](_0x359aff);})[_0x9a14('0x23')](function(_0xb21472){_0x1ac5f6['rows']=_0xb21472;return _0x1ac5f6;})['then'](respondWithFilteredResult(_0x151d2d,_0x359aff))[_0x9a14('0x40')](handleError(_0x151d2d,null));};exports[_0x9a14('0x41')]=function(_0x193f86,_0x2e78f3){var _0xa43670={'raw':!![],'where':{'id':_0x193f86[_0x9a14('0x42')]['id']}},_0x221c54={};_0x221c54[_0x9a14('0x32')]=_['keys'](db[_0x9a14('0x2a')][_0x9a14('0x2b')]);_0x221c54[_0x9a14('0x2f')]=_[_0x9a14('0x43')](_0x193f86['query']);_0x221c54[_0x9a14('0x30')]=_[_0x9a14('0x31')](_0x221c54[_0x9a14('0x32')],_0x221c54['query']);_0xa43670['attributes']=_[_0x9a14('0x31')](_0x221c54[_0x9a14('0x32')],qs['fields'](_0x193f86[_0x9a14('0x2f')][_0x9a14('0x34')]));_0xa43670['attributes']=_0xa43670[_0x9a14('0x33')][_0x9a14('0x35')]?_0xa43670[_0x9a14('0x33')]:_0x221c54[_0x9a14('0x32')];if(_0x193f86[_0x9a14('0x2f')]['includeAll']){_0xa43670['include']=[{'all':!![]}];}_0xa43670=_['merge']({},_0xa43670,_0x193f86['options']);return db[_0x9a14('0x2a')][_0x9a14('0x44')](_0xa43670)[_0x9a14('0x23')](handleEntityNotFound(_0x2e78f3,null))[_0x9a14('0x23')](respondWithResult(_0x2e78f3,null))['catch'](handleError(_0x2e78f3,null));};exports[_0x9a14('0x45')]=function(_0x51c16b,_0x3f9c5f){return db[_0x9a14('0x2a')][_0x9a14('0x45')](_0x51c16b['body'],{})['then'](respondWithResult(_0x3f9c5f,0xc9))['catch'](handleError(_0x3f9c5f,null));};exports[_0x9a14('0x22')]=function(_0x45163c,_0x40244f){if(_0x45163c[_0x9a14('0x46')]['id']){delete _0x45163c[_0x9a14('0x46')]['id'];}return db[_0x9a14('0x2a')][_0x9a14('0x44')]({'where':{'id':_0x45163c['params']['id']}})[_0x9a14('0x23')](handleEntityNotFound(_0x40244f,null))[_0x9a14('0x23')](saveUpdates(_0x45163c['body'],null))[_0x9a14('0x23')](respondWithResult(_0x40244f,null))[_0x9a14('0x40')](handleError(_0x40244f,null));};exports[_0x9a14('0x24')]=function(_0xb3fab1,_0xc7cd92){return db[_0x9a14('0x2a')]['find']({'where':{'id':_0xb3fab1[_0x9a14('0x42')]['id']}})[_0x9a14('0x23')](handleEntityNotFound(_0xc7cd92,null))[_0x9a14('0x23')](removeEntity(_0xc7cd92,null))[_0x9a14('0x40')](handleError(_0xc7cd92,null));}; \ No newline at end of file +var _0x3e7d=['query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','type','VIRTUAL','FreshsalesField','includeAll','include','findAll','catch','show','params','options','find','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','fieldName','key'];(function(_0x56b034,_0xb96f9b){var _0x25f338=function(_0x4134cd){while(--_0x4134cd){_0x56b034['push'](_0x56b034['shift']());}};_0x25f338(++_0xb96f9b);}(_0x3e7d,0x148));var _0xd3e7=function(_0x4eff33,_0x471c8f){_0x4eff33=_0x4eff33-0x0;var _0x31e1b0=_0x3e7d[_0x4eff33];return _0x31e1b0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd3e7('0x0'));var zipdir=require(_0xd3e7('0x1'));var jsonpatch=require(_0xd3e7('0x2'));var rp=require(_0xd3e7('0x3'));var moment=require(_0xd3e7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd3e7('0x5'));var util=require(_0xd3e7('0x6'));var path=require('path');var sox=require(_0xd3e7('0x7'));var csv=require(_0xd3e7('0x8'));var ejs=require(_0xd3e7('0x9'));var fs=require('fs');var fs_extra=require(_0xd3e7('0xa'));var _=require(_0xd3e7('0xb'));var squel=require(_0xd3e7('0xc'));var crypto=require(_0xd3e7('0xd'));var jsforce=require(_0xd3e7('0xe'));var deskjs=require(_0xd3e7('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd3e7('0x10'));var Redis=require(_0xd3e7('0x11'));var authService=require(_0xd3e7('0x12'));var qs=require(_0xd3e7('0x13'));var as=require(_0xd3e7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3e7('0x15'))('api');var utils=require(_0xd3e7('0x16'));var config=require(_0xd3e7('0x17'));var licenseUtil=require(_0xd3e7('0x18'));var db=require(_0xd3e7('0x19'))['db'];function respondWithStatusCode(_0x4e1648,_0x23d8b5){_0x23d8b5=_0x23d8b5||0xcc;return function(_0x389b1a){if(_0x389b1a){return _0x4e1648['sendStatus'](_0x23d8b5);}return _0x4e1648[_0xd3e7('0x1a')](_0x23d8b5)[_0xd3e7('0x1b')]();};}function respondWithResult(_0x470dce,_0x1c1e7e){_0x1c1e7e=_0x1c1e7e||0xc8;return function(_0x17c7dc){if(_0x17c7dc){return _0x470dce[_0xd3e7('0x1a')](_0x1c1e7e)['json'](_0x17c7dc);}};}function respondWithFilteredResult(_0x1d6501,_0x277cb7){return function(_0xd7b801){if(_0xd7b801){var _0x3af232=typeof _0x277cb7['offset']===_0xd3e7('0x1c')&&typeof _0x277cb7[_0xd3e7('0x1d')]==='undefined';var _0x170f68=_0xd7b801[_0xd3e7('0x1e')];var _0x54dd05=_0x3af232?0x0:_0x277cb7[_0xd3e7('0x1f')];var _0x4fa3d2=_0x3af232?_0xd7b801[_0xd3e7('0x1e')]:_0x277cb7[_0xd3e7('0x1f')]+_0x277cb7['limit'];var _0xa48c11;if(_0x4fa3d2>=_0x170f68){_0x4fa3d2=_0x170f68;_0xa48c11=0xc8;}else{_0xa48c11=0xce;}_0x1d6501[_0xd3e7('0x1a')](_0xa48c11);return _0x1d6501['set'](_0xd3e7('0x20'),_0x54dd05+'-'+_0x4fa3d2+'/'+_0x170f68)[_0xd3e7('0x21')](_0xd7b801);}return null;};}function patchUpdates(_0x58d7a3){return function(_0x265e63){try{jsonpatch[_0xd3e7('0x22')](_0x265e63,_0x58d7a3,!![]);}catch(_0x5216db){return BPromise[_0xd3e7('0x23')](_0x5216db);}return _0x265e63[_0xd3e7('0x24')]();};}function saveUpdates(_0x2a8569,_0x239905){return function(_0xdddc76){if(_0xdddc76){return _0xdddc76['update'](_0x2a8569)[_0xd3e7('0x25')](function(_0x2d73fc){return _0x2d73fc;});}return null;};}function removeEntity(_0x3328da,_0x1cfc58){return function(_0xd6b21e){if(_0xd6b21e){return _0xd6b21e[_0xd3e7('0x26')]()[_0xd3e7('0x25')](function(){_0x3328da[_0xd3e7('0x1a')](0xcc)[_0xd3e7('0x1b')]();});}};}function handleEntityNotFound(_0x15f529,_0x3d092b){return function(_0x1bc2b3){if(!_0x1bc2b3){_0x15f529[_0xd3e7('0x27')](0x194);}return _0x1bc2b3;};}function handleError(_0x1cb41b,_0x3b4ac3){_0x3b4ac3=_0x3b4ac3||0x1f4;return function(_0x5d93c2){logger[_0xd3e7('0x28')](_0x5d93c2[_0xd3e7('0x29')]);if(_0x5d93c2['name']){delete _0x5d93c2[_0xd3e7('0x2a')];}_0x1cb41b[_0xd3e7('0x1a')](_0x3b4ac3)[_0xd3e7('0x2b')](_0x5d93c2);};}exports['index']=function(_0x5ec57e,_0x63c61){var _0x48c7a3={},_0x360607={},_0x462621={'count':0x0,'rows':[]};var _0xd82ac1=_[_0xd3e7('0x2c')](db['FreshsalesField']['rawAttributes'],function(_0x41d74d){return{'name':_0x41d74d[_0xd3e7('0x2d')],'type':_0x41d74d['type'][_0xd3e7('0x2e')]};});_0x360607['model']=_[_0xd3e7('0x2c')](_0xd82ac1,'name');_0x360607[_0xd3e7('0x2f')]=_[_0xd3e7('0x30')](_0x5ec57e[_0xd3e7('0x2f')]);_0x360607['filters']=_[_0xd3e7('0x31')](_0x360607[_0xd3e7('0x32')],_0x360607[_0xd3e7('0x2f')]);_0x48c7a3[_0xd3e7('0x33')]=_['intersection'](_0x360607['model'],qs[_0xd3e7('0x34')](_0x5ec57e['query'][_0xd3e7('0x34')]));_0x48c7a3[_0xd3e7('0x33')]=_0x48c7a3['attributes'][_0xd3e7('0x35')]?_0x48c7a3[_0xd3e7('0x33')]:_0x360607[_0xd3e7('0x32')];if(!_0x5ec57e[_0xd3e7('0x2f')][_0xd3e7('0x36')](_0xd3e7('0x37'))){_0x48c7a3[_0xd3e7('0x1d')]=qs['limit'](_0x5ec57e['query']['limit']);_0x48c7a3[_0xd3e7('0x1f')]=qs['offset'](_0x5ec57e[_0xd3e7('0x2f')][_0xd3e7('0x1f')]);}_0x48c7a3[_0xd3e7('0x38')]=qs[_0xd3e7('0x39')](_0x5ec57e[_0xd3e7('0x2f')][_0xd3e7('0x39')]);_0x48c7a3[_0xd3e7('0x3a')]=qs['filters'](_[_0xd3e7('0x3b')](_0x5ec57e[_0xd3e7('0x2f')],_0x360607[_0xd3e7('0x3c')]),_0xd82ac1);if(_0x5ec57e[_0xd3e7('0x2f')]['filter']){_0x48c7a3[_0xd3e7('0x3a')]=_[_0xd3e7('0x3d')](_0x48c7a3[_0xd3e7('0x3a')],{'$or':_['map'](_0xd82ac1,function(_0x1c7277){if(_0x1c7277[_0xd3e7('0x3e')]!==_0xd3e7('0x3f')){var _0x1239c4={};_0x1239c4[_0x1c7277[_0xd3e7('0x2a')]]={'$like':'%'+_0x5ec57e['query']['filter']+'%'};return _0x1239c4;}})});}_0x48c7a3=_[_0xd3e7('0x3d')]({},_0x48c7a3,_0x5ec57e['options']);var _0xa9e9ad={'where':_0x48c7a3[_0xd3e7('0x3a')]};return db[_0xd3e7('0x40')]['count'](_0xa9e9ad)[_0xd3e7('0x25')](function(_0xaf23a2){_0x462621[_0xd3e7('0x1e')]=_0xaf23a2;if(_0x5ec57e[_0xd3e7('0x2f')][_0xd3e7('0x41')]){_0x48c7a3[_0xd3e7('0x42')]=[{'all':!![]}];}return db[_0xd3e7('0x40')][_0xd3e7('0x43')](_0x48c7a3);})[_0xd3e7('0x25')](function(_0x1bdcb7){_0x462621['rows']=_0x1bdcb7;return _0x462621;})[_0xd3e7('0x25')](respondWithFilteredResult(_0x63c61,_0x48c7a3))[_0xd3e7('0x44')](handleError(_0x63c61,null));};exports[_0xd3e7('0x45')]=function(_0x4fdb3d,_0x59d667){var _0x3b2563={'raw':!![],'where':{'id':_0x4fdb3d[_0xd3e7('0x46')]['id']}},_0x41f451={};_0x41f451[_0xd3e7('0x32')]=_[_0xd3e7('0x30')](db[_0xd3e7('0x40')]['rawAttributes']);_0x41f451[_0xd3e7('0x2f')]=_['keys'](_0x4fdb3d[_0xd3e7('0x2f')]);_0x41f451[_0xd3e7('0x3c')]=_['intersection'](_0x41f451['model'],_0x41f451[_0xd3e7('0x2f')]);_0x3b2563[_0xd3e7('0x33')]=_['intersection'](_0x41f451[_0xd3e7('0x32')],qs[_0xd3e7('0x34')](_0x4fdb3d['query']['fields']));_0x3b2563[_0xd3e7('0x33')]=_0x3b2563[_0xd3e7('0x33')][_0xd3e7('0x35')]?_0x3b2563['attributes']:_0x41f451[_0xd3e7('0x32')];if(_0x4fdb3d[_0xd3e7('0x2f')][_0xd3e7('0x41')]){_0x3b2563[_0xd3e7('0x42')]=[{'all':!![]}];}_0x3b2563=_[_0xd3e7('0x3d')]({},_0x3b2563,_0x4fdb3d[_0xd3e7('0x47')]);return db[_0xd3e7('0x40')][_0xd3e7('0x48')](_0x3b2563)[_0xd3e7('0x25')](handleEntityNotFound(_0x59d667,null))[_0xd3e7('0x25')](respondWithResult(_0x59d667,null))['catch'](handleError(_0x59d667,null));};exports['create']=function(_0x21c828,_0x4019df){return db[_0xd3e7('0x40')]['create'](_0x21c828[_0xd3e7('0x49')],{})[_0xd3e7('0x25')](respondWithResult(_0x4019df,0xc9))[_0xd3e7('0x44')](handleError(_0x4019df,null));};exports[_0xd3e7('0x4a')]=function(_0x119d5d,_0x16ca82){if(_0x119d5d[_0xd3e7('0x49')]['id']){delete _0x119d5d[_0xd3e7('0x49')]['id'];}return db[_0xd3e7('0x40')][_0xd3e7('0x48')]({'where':{'id':_0x119d5d[_0xd3e7('0x46')]['id']}})[_0xd3e7('0x25')](handleEntityNotFound(_0x16ca82,null))[_0xd3e7('0x25')](saveUpdates(_0x119d5d[_0xd3e7('0x49')],null))[_0xd3e7('0x25')](respondWithResult(_0x16ca82,null))[_0xd3e7('0x44')](handleError(_0x16ca82,null));};exports['destroy']=function(_0x2d4a64,_0x31c118){return db[_0xd3e7('0x40')][_0xd3e7('0x48')]({'where':{'id':_0x2d4a64[_0xd3e7('0x46')]['id']}})[_0xd3e7('0x25')](handleEntityNotFound(_0x31c118,null))['then'](removeEntity(_0x31c118,null))[_0xd3e7('0x44')](handleError(_0x31c118,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 0cd745e..02323fc 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 _0xaaee=['FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes','exports','define','FreshsalesField','freshsales_unique_index','idField'];(function(_0xd58fea,_0x27b792){var _0x598024=function(_0x994566){while(--_0x994566){_0xd58fea['push'](_0xd58fea['shift']());}};_0x598024(++_0x27b792);}(_0xaaee,0xa9));var _0xeaae=function(_0x195177,_0x49eb42){_0x195177=_0x195177-0x0;var _0x4b93ea=_0xaaee[_0x195177];return _0x4b93ea;};'use strict';var _=require(_0xeaae('0x0'));var util=require('util');var logger=require(_0xeaae('0x1'))(_0xeaae('0x2'));var moment=require('moment');var BPromise=require(_0xeaae('0x3'));var rp=require(_0xeaae('0x4'));var fs=require('fs');var path=require(_0xeaae('0x5'));var rimraf=require(_0xeaae('0x6'));var config=require('../../config/environment');var attributes=require(_0xeaae('0x7'));module[_0xeaae('0x8')]=function(_0x213422,_0x45c104){return _0x213422[_0xeaae('0x9')](_0xeaae('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xeaae('0xb'),'fields':[_0xeaae('0xc'),_0xeaae('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x110f=['freshsales_unique_index','FieldId','lodash','util','bluebird','path','rimraf','../../config/environment','exports','FreshsalesField','int_freshsales_fields'];(function(_0x27cfdc,_0x484964){var _0x3a5be2=function(_0x2173b5){while(--_0x2173b5){_0x27cfdc['push'](_0x27cfdc['shift']());}};_0x3a5be2(++_0x484964);}(_0x110f,0x1e6));var _0xf110=function(_0x10b644,_0x161100){_0x10b644=_0x10b644-0x0;var _0x439c5c=_0x110f[_0x10b644];return _0x439c5c;};'use strict';var _=require(_0xf110('0x0'));var util=require(_0xf110('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf110('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf110('0x3'));var rimraf=require(_0xf110('0x4'));var config=require(_0xf110('0x5'));var attributes=require('./intFreshsalesField.attributes');module[_0xf110('0x6')]=function(_0x3147fd,_0xc27675){return _0x3147fd['define'](_0xf110('0x7'),attributes,{'tableName':_0xf110('0x8'),'paranoid':![],'indexes':[{'name':_0xf110('0x9'),'fields':['idField',_0xf110('0xa')],'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 f7fce45..28bb909 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 _0x33af=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x123a48,_0x45d8d9){var _0x235b7b=function(_0x5353fa){while(--_0x5353fa){_0x123a48['push'](_0x123a48['shift']());}};_0x235b7b(++_0x45d8d9);}(_0x33af,0xec));var _0xf33a=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x33af[_0x55f8b4];return _0x2475f9;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384b14,_0x1b2b01,_0x2f3730){return new BPromise(function(_0x2baabb,_0x2cb169){return client['request'](_0x384b14,_0x2f3730)[_0xf33a('0xa')](function(_0x14eb0e){logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,_0xf33a('0xd'));logger[_0xf33a('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x1b2b01,'request\x20sent',JSON[_0xf33a('0xf')](_0x14eb0e));if(_0x14eb0e[_0xf33a('0x10')]){if(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x11')]===0x1f4){logger[_0xf33a('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2cb169(_0x14eb0e['error']['message']);}logger[_0xf33a('0x10')](_0xf33a('0xc'),_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2baabb(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);}else{logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,'request\x20sent');_0x2baabb(_0x14eb0e[_0xf33a('0x13')]['message']);}})[_0xf33a('0x14')](function(_0x229389){logger['error'](_0xf33a('0xc'),_0x1b2b01,_0x229389);_0x2cb169(_0x229389);});});} \ No newline at end of file +var _0xe2fe=['then','info','FreshsalesField,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x743aa8,_0x44e3ff){var _0x25cb0a=function(_0x44cc01){while(--_0x44cc01){_0x743aa8['push'](_0x743aa8['shift']());}};_0x25cb0a(++_0x44e3ff);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 76ab8e0..d9857df 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3d9414,_0x4031f2){var _0x2bf826=function(_0x81f09d){while(--_0x81f09d){_0x3d9414['push'](_0x3d9414['shift']());}};_0x2bf826(++_0x4031f2);}(_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 +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(_0xed308,_0x5407af){var _0x40b1a9=function(_0x3a52a3){while(--_0x3a52a3){_0xed308['push'](_0xed308['shift']());}};_0x40b1a9(++_0x5407af);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/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 ed3c16d..09571d8 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 _0xa397=['STRING','username','ENUM','integrationTab','newTab','sequelize'];(function(_0x512550,_0x6a8b6f){var _0x19f661=function(_0x5ded2a){while(--_0x5ded2a){_0x512550['push'](_0x512550['shift']());}};_0x19f661(++_0x6a8b6f);}(_0xa397,0xdd));var _0x7a39=function(_0x5c854f,_0x557516){_0x5c854f=_0x5c854f-0x0;var _0x5e1f97=_0xa397[_0x5c854f];return _0x5e1f97;};'use strict';var Sequelize=require(_0x7a39('0x0'));module['exports']={'name':{'type':Sequelize[_0x7a39('0x1')]},'description':{'type':Sequelize[_0x7a39('0x1')]},'username':{'type':Sequelize[_0x7a39('0x1')],'unique':_0x7a39('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x7a39('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x7a39('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x7a39('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7a39('0x3')](_0x7a39('0x4'),_0x7a39('0x5')),'defaultValue':_0x7a39('0x4')}}; \ No newline at end of file +var _0xab9c=['username','ENUM','integrationTab','exports','STRING'];(function(_0xdb51d7,_0x1d1146){var _0x1f368d=function(_0xa64c9f){while(--_0xa64c9f){_0xdb51d7['push'](_0xdb51d7['shift']());}};_0x1f368d(++_0x1d1146);}(_0xab9c,0xd0));var _0xcab9=function(_0x56bf8b,_0x2e334d){_0x56bf8b=_0x56bf8b-0x0;var _0x36b28a=_0xab9c[_0x56bf8b];return _0x36b28a;};'use strict';var Sequelize=require('sequelize');module[_0xcab9('0x0')]={'name':{'type':Sequelize[_0xcab9('0x1')]},'description':{'type':Sequelize[_0xcab9('0x1')]},'username':{'type':Sequelize[_0xcab9('0x1')],'unique':_0xcab9('0x2')},'remoteUri':{'type':Sequelize[_0xcab9('0x1')]},'password':{'type':Sequelize[_0xcab9('0x1')]},'clientId':{'type':Sequelize[_0xcab9('0x1')]},'clientSecret':{'type':Sequelize[_0xcab9('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xcab9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xcab9('0x3')](_0xcab9('0x4'),'newTab'),'defaultValue':_0xcab9('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index d32bfcc..bd1e396 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 _0xcc30=['undefined','limit','count','set','reject','save','update','destroy','then','end','error','stack','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','filter','name','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','pick','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','remoteUri','clientSecret','username','slice','substring','lastIndexOf','Connection','login','password','securityToken','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Description','string','int','phone','remove','includes','label','custom','picklistValues','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','bluebird','mustache','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','../../components/integrations/configuration','sendStatus','status','json','offset'];(function(_0x39758d,_0x346423){var _0x44ac11=function(_0x175008){while(--_0x175008){_0x39758d['push'](_0x39758d['shift']());}};_0x44ac11(++_0x346423);}(_0xcc30,0xce));var _0x0cc3=function(_0x2136a6,_0x35af63){_0x2136a6=_0x2136a6-0x0;var _0x55b948=_0xcc30[_0x2136a6];return _0x55b948;};'use strict';var emlformat=require(_0x0cc3('0x0'));var rimraf=require(_0x0cc3('0x1'));var zipdir=require(_0x0cc3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0cc3('0x3'));var Mustache=require(_0x0cc3('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0cc3('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0cc3('0x6'));var squel=require(_0x0cc3('0x7'));var crypto=require(_0x0cc3('0x8'));var jsforce=require(_0x0cc3('0x9'));var deskjs=require(_0x0cc3('0xa'));var toCsv=require('to-csv');var querystring=require(_0x0cc3('0xb'));var Papa=require(_0x0cc3('0xc'));var Redis=require('ioredis');var authService=require(_0x0cc3('0xd'));var qs=require(_0x0cc3('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0cc3('0xf'));var logger=require('../../config/logger')(_0x0cc3('0x10'));var utils=require(_0x0cc3('0x11'));var config=require(_0x0cc3('0x12'));var licenseUtil=require(_0x0cc3('0x13'));var db=require(_0x0cc3('0x14'))['db'];var integrations=require(_0x0cc3('0x15'));function respondWithStatusCode(_0x1d732f,_0x1588f0){_0x1588f0=_0x1588f0||0xcc;return function(_0x1330d7){if(_0x1330d7){return _0x1d732f[_0x0cc3('0x16')](_0x1588f0);}return _0x1d732f[_0x0cc3('0x17')](_0x1588f0)['end']();};}function respondWithResult(_0x174309,_0x22d7c7){_0x22d7c7=_0x22d7c7||0xc8;return function(_0x470c58){if(_0x470c58){return _0x174309['status'](_0x22d7c7)[_0x0cc3('0x18')](_0x470c58);}};}function respondWithFilteredResult(_0x552d00,_0x1765e1){return function(_0x5216c6){if(_0x5216c6){var _0x11f1db=typeof _0x1765e1[_0x0cc3('0x19')]===_0x0cc3('0x1a')&&typeof _0x1765e1[_0x0cc3('0x1b')]===_0x0cc3('0x1a');var _0x17cf13=_0x5216c6['count'];var _0x20e3e4=_0x11f1db?0x0:_0x1765e1[_0x0cc3('0x19')];var _0x18a150=_0x11f1db?_0x5216c6[_0x0cc3('0x1c')]:_0x1765e1['offset']+_0x1765e1[_0x0cc3('0x1b')];var _0x178862;if(_0x18a150>=_0x17cf13){_0x18a150=_0x17cf13;_0x178862=0xc8;}else{_0x178862=0xce;}_0x552d00[_0x0cc3('0x17')](_0x178862);return _0x552d00[_0x0cc3('0x1d')]('Content-Range',_0x20e3e4+'-'+_0x18a150+'/'+_0x17cf13)['json'](_0x5216c6);}return null;};}function patchUpdates(_0x559604){return function(_0x119285){try{jsonpatch['apply'](_0x119285,_0x559604,!![]);}catch(_0x391a7a){return BPromise[_0x0cc3('0x1e')](_0x391a7a);}return _0x119285[_0x0cc3('0x1f')]();};}function saveUpdates(_0x7f735a,_0x20ac42){return function(_0x180416){if(_0x180416){return _0x180416[_0x0cc3('0x20')](_0x7f735a)['then'](function(_0x267e6d){return _0x267e6d;});}return null;};}function removeEntity(_0x21f9d1,_0x329cee){return function(_0x19b2a6){if(_0x19b2a6){return _0x19b2a6[_0x0cc3('0x21')]()[_0x0cc3('0x22')](function(){_0x21f9d1[_0x0cc3('0x17')](0xcc)[_0x0cc3('0x23')]();});}};}function handleEntityNotFound(_0x348678,_0x5c11a7){return function(_0x476417){if(!_0x476417){_0x348678[_0x0cc3('0x16')](0x194);}return _0x476417;};}function handleError(_0x25bea0,_0x52eb56){_0x52eb56=_0x52eb56||0x1f4;return function(_0xeee491){logger[_0x0cc3('0x24')](_0xeee491[_0x0cc3('0x25')]);if(_0xeee491['name']){delete _0xeee491['name'];}_0x25bea0['status'](_0x52eb56)[_0x0cc3('0x26')](_0xeee491);};}exports[_0x0cc3('0x27')]=function(_0x3a0f17,_0x488b6a){var _0x1322fa={},_0x348fe1={},_0x124e60={'count':0x0,'rows':[]};var _0x2c106c=_[_0x0cc3('0x28')](db[_0x0cc3('0x29')][_0x0cc3('0x2a')],function(_0x348399){return{'name':_0x348399[_0x0cc3('0x2b')],'type':_0x348399[_0x0cc3('0x2c')][_0x0cc3('0x2d')]};});_0x348fe1['model']=_[_0x0cc3('0x28')](_0x2c106c,'name');_0x348fe1[_0x0cc3('0x2e')]=_[_0x0cc3('0x2f')](_0x3a0f17[_0x0cc3('0x2e')]);_0x348fe1[_0x0cc3('0x30')]=_['intersection'](_0x348fe1[_0x0cc3('0x31')],_0x348fe1[_0x0cc3('0x2e')]);_0x1322fa[_0x0cc3('0x32')]=_[_0x0cc3('0x33')](_0x348fe1[_0x0cc3('0x31')],qs[_0x0cc3('0x34')](_0x3a0f17[_0x0cc3('0x2e')]['fields']));_0x1322fa[_0x0cc3('0x32')]=_0x1322fa[_0x0cc3('0x32')][_0x0cc3('0x35')]?_0x1322fa[_0x0cc3('0x32')]:_0x348fe1[_0x0cc3('0x31')];if(!_0x3a0f17[_0x0cc3('0x2e')]['hasOwnProperty'](_0x0cc3('0x36'))){_0x1322fa[_0x0cc3('0x1b')]=qs['limit'](_0x3a0f17[_0x0cc3('0x2e')][_0x0cc3('0x1b')]);_0x1322fa[_0x0cc3('0x19')]=qs[_0x0cc3('0x19')](_0x3a0f17[_0x0cc3('0x2e')][_0x0cc3('0x19')]);}_0x1322fa[_0x0cc3('0x37')]=qs[_0x0cc3('0x38')](_0x3a0f17[_0x0cc3('0x2e')][_0x0cc3('0x38')]);_0x1322fa[_0x0cc3('0x39')]=qs[_0x0cc3('0x30')](_['pick'](_0x3a0f17[_0x0cc3('0x2e')],_0x348fe1[_0x0cc3('0x30')]),_0x2c106c);if(_0x3a0f17[_0x0cc3('0x2e')][_0x0cc3('0x3a')]){_0x1322fa['where']=_['merge'](_0x1322fa[_0x0cc3('0x39')],{'$or':_[_0x0cc3('0x28')](_0x2c106c,function(_0x5d370d){if(_0x5d370d['type']!=='VIRTUAL'){var _0x385692={};_0x385692[_0x5d370d[_0x0cc3('0x3b')]]={'$like':'%'+_0x3a0f17['query']['filter']+'%'};return _0x385692;}})});}_0x1322fa=_[_0x0cc3('0x3c')]({},_0x1322fa,_0x3a0f17[_0x0cc3('0x3d')]);var _0x292568={'where':_0x1322fa[_0x0cc3('0x39')]};return db[_0x0cc3('0x29')]['count'](_0x292568)['then'](function(_0x5e7b5f){_0x124e60[_0x0cc3('0x1c')]=_0x5e7b5f;if(_0x3a0f17[_0x0cc3('0x2e')][_0x0cc3('0x3e')]){_0x1322fa[_0x0cc3('0x3f')]=[{'all':!![]}];}return db[_0x0cc3('0x29')][_0x0cc3('0x40')](_0x1322fa);})[_0x0cc3('0x22')](function(_0x21a294){_0x124e60['rows']=_0x21a294;return _0x124e60;})[_0x0cc3('0x22')](respondWithFilteredResult(_0x488b6a,_0x1322fa))[_0x0cc3('0x41')](handleError(_0x488b6a,null));};exports[_0x0cc3('0x42')]=function(_0x59216b,_0x1a5cd4){var _0x84490d={'raw':![],'where':{'id':_0x59216b[_0x0cc3('0x43')]['id']}},_0x38d462={};_0x38d462[_0x0cc3('0x31')]=_[_0x0cc3('0x2f')](db['SalesforceAccount']['rawAttributes']);_0x38d462[_0x0cc3('0x2e')]=_[_0x0cc3('0x2f')](_0x59216b[_0x0cc3('0x2e')]);_0x38d462[_0x0cc3('0x30')]=_[_0x0cc3('0x33')](_0x38d462[_0x0cc3('0x31')],_0x38d462[_0x0cc3('0x2e')]);_0x84490d[_0x0cc3('0x32')]=_[_0x0cc3('0x33')](_0x38d462[_0x0cc3('0x31')],qs[_0x0cc3('0x34')](_0x59216b[_0x0cc3('0x2e')][_0x0cc3('0x34')]));_0x84490d[_0x0cc3('0x32')]=_0x84490d[_0x0cc3('0x32')][_0x0cc3('0x35')]?_0x84490d[_0x0cc3('0x32')]:_0x38d462[_0x0cc3('0x31')];if(_0x59216b[_0x0cc3('0x2e')][_0x0cc3('0x3e')]){_0x84490d[_0x0cc3('0x3f')]=[{'all':!![]}];}_0x84490d=_[_0x0cc3('0x3c')]({},_0x84490d,_0x59216b[_0x0cc3('0x3d')]);return db[_0x0cc3('0x29')][_0x0cc3('0x44')](_0x84490d)[_0x0cc3('0x22')](handleEntityNotFound(_0x1a5cd4,null))['then'](respondWithResult(_0x1a5cd4,null))[_0x0cc3('0x41')](handleError(_0x1a5cd4,null));};exports['create']=function(_0x282fac,_0x5cfa3c){return db[_0x0cc3('0x29')][_0x0cc3('0x45')](_0x282fac[_0x0cc3('0x46')],{})[_0x0cc3('0x22')](respondWithResult(_0x5cfa3c,0xc9))[_0x0cc3('0x41')](handleError(_0x5cfa3c,null));};exports['update']=function(_0x531095,_0x49925f){if(_0x531095[_0x0cc3('0x46')]['id']){delete _0x531095[_0x0cc3('0x46')]['id'];}return db[_0x0cc3('0x29')][_0x0cc3('0x44')]({'where':{'id':_0x531095[_0x0cc3('0x43')]['id']}})['then'](handleEntityNotFound(_0x49925f,null))[_0x0cc3('0x22')](saveUpdates(_0x531095['body'],null))[_0x0cc3('0x22')](respondWithResult(_0x49925f,null))[_0x0cc3('0x41')](handleError(_0x49925f,null));};exports[_0x0cc3('0x21')]=function(_0x366421,_0x330219){return db[_0x0cc3('0x29')][_0x0cc3('0x44')]({'where':{'id':_0x366421[_0x0cc3('0x43')]['id']}})[_0x0cc3('0x22')](handleEntityNotFound(_0x330219,null))[_0x0cc3('0x22')](removeEntity(_0x330219,null))[_0x0cc3('0x41')](handleError(_0x330219,null));};exports[_0x0cc3('0x47')]=function(_0x158d23,_0x4424e8,_0x1e1351){var _0x337b76={};var _0xdc3335={};var _0x5b9b7d;var _0x4cb125;return db[_0x0cc3('0x29')]['findOne']({'where':{'id':_0x158d23['params']['id']}})[_0x0cc3('0x22')](handleEntityNotFound(_0x4424e8,null))[_0x0cc3('0x22')](function(_0x4f96f7){if(_0x4f96f7){_0x5b9b7d=_0x4f96f7;_0xdc3335['model']=_[_0x0cc3('0x2f')](db['SalesforceConfiguration'][_0x0cc3('0x2a')]);_0xdc3335[_0x0cc3('0x2e')]=_[_0x0cc3('0x2f')](_0x158d23[_0x0cc3('0x2e')]);_0xdc3335[_0x0cc3('0x30')]=_[_0x0cc3('0x33')](_0xdc3335[_0x0cc3('0x31')],_0xdc3335['query']);_0x337b76['attributes']=_['intersection'](_0xdc3335[_0x0cc3('0x31')],qs['fields'](_0x158d23[_0x0cc3('0x2e')]['fields']));_0x337b76[_0x0cc3('0x32')]=_0x337b76[_0x0cc3('0x32')][_0x0cc3('0x35')]?_0x337b76['attributes']:_0xdc3335[_0x0cc3('0x31')];_0x337b76[_0x0cc3('0x37')]=qs[_0x0cc3('0x38')](_0x158d23[_0x0cc3('0x2e')][_0x0cc3('0x38')]);_0x337b76['where']=qs[_0x0cc3('0x30')](_[_0x0cc3('0x48')](_0x158d23['query'],_0xdc3335[_0x0cc3('0x30')]));if(_0x158d23[_0x0cc3('0x2e')][_0x0cc3('0x3a')]){_0x337b76[_0x0cc3('0x39')]=_[_0x0cc3('0x3c')](_0x337b76[_0x0cc3('0x39')],{'$or':_[_0x0cc3('0x28')](_0x337b76[_0x0cc3('0x32')],function(_0x5c6faf){var _0x276e11={};_0x276e11[_0x5c6faf]={'$like':'%'+_0x158d23[_0x0cc3('0x2e')]['filter']+'%'};return _0x276e11;})});}_0x337b76=_[_0x0cc3('0x3c')]({},_0x337b76,_0x158d23[_0x0cc3('0x3d')]);return _0x5b9b7d[_0x0cc3('0x47')](_0x337b76);}})[_0x0cc3('0x22')](function(_0x3781f7){if(_0x3781f7){_0x4cb125=_0x3781f7[_0x0cc3('0x35')];if(!_0x158d23[_0x0cc3('0x2e')]['hasOwnProperty'](_0x0cc3('0x36'))){_0x337b76[_0x0cc3('0x1b')]=qs[_0x0cc3('0x1b')](_0x158d23[_0x0cc3('0x2e')][_0x0cc3('0x1b')]);_0x337b76['offset']=qs[_0x0cc3('0x19')](_0x158d23[_0x0cc3('0x2e')][_0x0cc3('0x19')]);}return _0x5b9b7d[_0x0cc3('0x47')](_0x337b76);}})['then'](function(_0x319206){if(_0x319206){return _0x319206?{'count':_0x4cb125,'rows':_0x319206}:null;}})[_0x0cc3('0x22')](respondWithResult(_0x4424e8,null))[_0x0cc3('0x41')](handleError(_0x4424e8,null));};exports[_0x0cc3('0x49')]=function(_0x66f1a3,_0x12899d,_0x476180){if(_0x66f1a3[_0x0cc3('0x46')]['id']){delete _0x66f1a3[_0x0cc3('0x46')]['id'];}return db[_0x0cc3('0x29')][_0x0cc3('0x4a')]({'where':{'id':_0x66f1a3[_0x0cc3('0x43')]['id']}})[_0x0cc3('0x22')](handleEntityNotFound(_0x12899d,null))[_0x0cc3('0x22')](function(_0x1b6346){if(_0x1b6346){_0x66f1a3[_0x0cc3('0x46')]['AccountId']=_0x1b6346['id'];_0x66f1a3[_0x0cc3('0x46')][_0x0cc3('0x4b')]=integrations[_0x0cc3('0x4c')](_0x66f1a3['body'][_0x0cc3('0x4d')],_0x66f1a3['body'][_0x0cc3('0x2c')]);_0x66f1a3[_0x0cc3('0x46')][_0x0cc3('0x4e')]=integrations[_0x0cc3('0x4f')](_0x66f1a3[_0x0cc3('0x46')][_0x0cc3('0x4d')],_0x66f1a3['body'][_0x0cc3('0x2c')]);return db[_0x0cc3('0x50')]['create'](_0x66f1a3[_0x0cc3('0x46')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x0cc3('0x51')],'as':_0x0cc3('0x4e')}]});}return null;})['then'](respondWithResult(_0x12899d,null))[_0x0cc3('0x41')](handleError(_0x12899d,null));};exports['getFields']=function(_0x2205f2,_0x3bd9f1,_0x5d44a0){var _0x54ab26;var _0x5438ef='';var _0xe13207='Task';return db[_0x0cc3('0x29')]['findOne']({'where':{'id':_0x2205f2[_0x0cc3('0x43')]['id']},'attributes':['id',_0x0cc3('0x52'),'clientId',_0x0cc3('0x53'),_0x0cc3('0x54'),'password','securityToken']})['then'](handleEntityNotFound(_0x3bd9f1,null))[_0x0cc3('0x22')](function(_0x5a6986){if(_0x5a6986){_0x5438ef=_0x5a6986[_0x0cc3('0x52')];var _0x1480f7=_0x5438ef[_0x0cc3('0x55')](-0x1);if(_0x1480f7==='/'){_0x5438ef=_0x5438ef[_0x0cc3('0x56')](0x0,_0x5438ef[_0x0cc3('0x57')](_0x1480f7));}_0x54ab26=new jsforce[(_0x0cc3('0x58'))]({'oauth2':{'loginUrl':_0x5438ef,'clientId':_0x5a6986['clientId'],'clientSecret':_0x5a6986['clientSecret']}});return _0x54ab26[_0x0cc3('0x59')](_0x5a6986[_0x0cc3('0x54')],_0x5a6986[_0x0cc3('0x5a')]['concat'](_0x5a6986[_0x0cc3('0x5b')]));}})['then'](function(_0x2cf0ca){if(_0x2cf0ca){if(!_['isNil'](_0x2205f2[_0x0cc3('0x2e')][_0x0cc3('0x5c')])){_0xe13207=_0x2205f2[_0x0cc3('0x2e')][_0x0cc3('0x5c')];}return _0x54ab26['sobject'](_0xe13207)[_0x0cc3('0x5d')]();}})[_0x0cc3('0x22')](function(_0x1576ce){var _0x34b84b=[_0x0cc3('0x5e'),_0x0cc3('0x5f'),_0x0cc3('0x60'),_0x0cc3('0x61'),'Subject',_0x0cc3('0x62')];var _0x31a200=[_0x0cc3('0x63'),_0x0cc3('0x64'),'picklist','boolean','email','textarea',_0x0cc3('0x65')];if(_0x1576ce){_[_0x0cc3('0x66')](_0x1576ce[_0x0cc3('0x34')],function(_0x7865b2){return _0x34b84b[_0x0cc3('0x67')](_0x7865b2[_0x0cc3('0x3b')])||!_0x31a200[_0x0cc3('0x67')](_0x7865b2[_0x0cc3('0x2c')]);});return{'count':_0x1576ce[_0x0cc3('0x34')][_0x0cc3('0x35')],'rows':_[_0x0cc3('0x28')](_0x1576ce[_0x0cc3('0x34')],function(_0x2c0e7a){return{'id':_0x2c0e7a[_0x0cc3('0x3b')],'name':_0x2c0e7a[_0x0cc3('0x68')],'custom':_0x2c0e7a[_0x0cc3('0x69')],'options':_0x2c0e7a[_0x0cc3('0x6a')][_0x0cc3('0x35')]>0x0?_[_0x0cc3('0x28')](_0x2c0e7a[_0x0cc3('0x6a')],function(_0x251196){return{'name':_0x251196[_0x0cc3('0x68')],'value':_0x251196['value']};}):_0x2c0e7a[_0x0cc3('0x2c')]=='boolean'?[{'name':'True','value':_0x0cc3('0x6b')},{'name':_0x0cc3('0x6c'),'value':_0x0cc3('0x6d')}]:[]};})};}})[_0x0cc3('0x22')](respondWithResult(_0x3bd9f1,null))[_0x0cc3('0x41')](function(_0x1e8a96){var _0x23c3f0=_0x2205f2['query'][_0x0cc3('0x6e')]?0x1f4:_0x1e8a96[_0x0cc3('0x6f')]||0x1f4;logger[_0x0cc3('0x24')](_0x0cc3('0x70'),_0x0cc3('0x71'),_0x23c3f0,JSON[_0x0cc3('0x72')](_0x1e8a96));delete _0x1e8a96[_0x0cc3('0x3b')];if(_0x23c3f0===0x191){_0x23c3f0=0x190;}_0x3bd9f1[_0x0cc3('0x17')](_0x23c3f0)['send'](_0x2205f2['query'][_0x0cc3('0x6e')]?{'message':_0x0cc3('0x73'),'statusCode':_0x1e8a96[_0x0cc3('0x6f')]}:_0x1e8a96);});}; \ No newline at end of file +var _0xd7a5=['getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','offset','limit','undefined','set','Content-Range','apply','update','sendStatus','error','stack','name','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','count','then','includeAll','findAll','rows','catch','show','SalesforceAccount','rawAttributes','include','find','create','body','params','destroy','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientId','clientSecret','username','password','slice','substring','Connection','concat','securityToken','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','boolean','email','remove','label','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xd7a5,0xf9));var _0x5d7a=function(_0x5d07ff,_0x1f976f){_0x5d07ff=_0x5d07ff-0x0;var _0x5226ad=_0xd7a5[_0x5d07ff];return _0x5226ad;};'use strict';var emlformat=require(_0x5d7a('0x0'));var rimraf=require(_0x5d7a('0x1'));var zipdir=require(_0x5d7a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d7a('0x3'));var moment=require(_0x5d7a('0x4'));var BPromise=require(_0x5d7a('0x5'));var Mustache=require(_0x5d7a('0x6'));var util=require(_0x5d7a('0x7'));var path=require(_0x5d7a('0x8'));var sox=require(_0x5d7a('0x9'));var csv=require(_0x5d7a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5d7a('0xb'));var squel=require(_0x5d7a('0xc'));var crypto=require(_0x5d7a('0xd'));var jsforce=require(_0x5d7a('0xe'));var deskjs=require(_0x5d7a('0xf'));var toCsv=require(_0x5d7a('0xa'));var querystring=require(_0x5d7a('0x10'));var Papa=require(_0x5d7a('0x11'));var Redis=require(_0x5d7a('0x12'));var authService=require(_0x5d7a('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d7a('0x14'))(_0x5d7a('0x15'));var utils=require(_0x5d7a('0x16'));var config=require(_0x5d7a('0x17'));var licenseUtil=require(_0x5d7a('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5d7a('0x19'));function respondWithStatusCode(_0x4e9fac,_0x108a1b){_0x108a1b=_0x108a1b||0xcc;return function(_0x45d59d){if(_0x45d59d){return _0x4e9fac['sendStatus'](_0x108a1b);}return _0x4e9fac[_0x5d7a('0x1a')](_0x108a1b)[_0x5d7a('0x1b')]();};}function respondWithResult(_0x1b07b0,_0x857c20){_0x857c20=_0x857c20||0xc8;return function(_0xa0ade2){if(_0xa0ade2){return _0x1b07b0[_0x5d7a('0x1a')](_0x857c20)['json'](_0xa0ade2);}};}function respondWithFilteredResult(_0x52a688,_0x203fe8){return function(_0x319117){if(_0x319117){var _0xed26ed=typeof _0x203fe8[_0x5d7a('0x1c')]==='undefined'&&typeof _0x203fe8[_0x5d7a('0x1d')]===_0x5d7a('0x1e');var _0x408d3b=_0x319117['count'];var _0x18d195=_0xed26ed?0x0:_0x203fe8[_0x5d7a('0x1c')];var _0x249da4=_0xed26ed?_0x319117['count']:_0x203fe8['offset']+_0x203fe8[_0x5d7a('0x1d')];var _0x3b238e;if(_0x249da4>=_0x408d3b){_0x249da4=_0x408d3b;_0x3b238e=0xc8;}else{_0x3b238e=0xce;}_0x52a688[_0x5d7a('0x1a')](_0x3b238e);return _0x52a688[_0x5d7a('0x1f')](_0x5d7a('0x20'),_0x18d195+'-'+_0x249da4+'/'+_0x408d3b)['json'](_0x319117);}return null;};}function patchUpdates(_0x53ecb1){return function(_0x57f64e){try{jsonpatch[_0x5d7a('0x21')](_0x57f64e,_0x53ecb1,!![]);}catch(_0x3d10f4){return BPromise['reject'](_0x3d10f4);}return _0x57f64e['save']();};}function saveUpdates(_0x1007df,_0xcfcebf){return function(_0x3b1f33){if(_0x3b1f33){return _0x3b1f33[_0x5d7a('0x22')](_0x1007df)['then'](function(_0x44c4e0){return _0x44c4e0;});}return null;};}function removeEntity(_0x345c4c,_0x2398c9){return function(_0x11145b){if(_0x11145b){return _0x11145b['destroy']()['then'](function(){_0x345c4c[_0x5d7a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f5291,_0x4d6b54){return function(_0x1c6aee){if(!_0x1c6aee){_0x3f5291[_0x5d7a('0x23')](0x194);}return _0x1c6aee;};}function handleError(_0x5899a3,_0x1af89e){_0x1af89e=_0x1af89e||0x1f4;return function(_0x2afea5){logger[_0x5d7a('0x24')](_0x2afea5[_0x5d7a('0x25')]);if(_0x2afea5[_0x5d7a('0x26')]){delete _0x2afea5['name'];}_0x5899a3[_0x5d7a('0x1a')](_0x1af89e)['send'](_0x2afea5);};}exports['index']=function(_0x5ecbba,_0x307f20){var _0x28f299={},_0x2c94e2={},_0x3ab5c5={'count':0x0,'rows':[]};var _0x4de87d=_['map'](db['SalesforceAccount']['rawAttributes'],function(_0x48284b){return{'name':_0x48284b[_0x5d7a('0x27')],'type':_0x48284b['type'][_0x5d7a('0x28')]};});_0x2c94e2[_0x5d7a('0x29')]=_[_0x5d7a('0x2a')](_0x4de87d,_0x5d7a('0x26'));_0x2c94e2[_0x5d7a('0x2b')]=_[_0x5d7a('0x2c')](_0x5ecbba['query']);_0x2c94e2['filters']=_[_0x5d7a('0x2d')](_0x2c94e2['model'],_0x2c94e2[_0x5d7a('0x2b')]);_0x28f299['attributes']=_[_0x5d7a('0x2d')](_0x2c94e2[_0x5d7a('0x29')],qs[_0x5d7a('0x2e')](_0x5ecbba[_0x5d7a('0x2b')][_0x5d7a('0x2e')]));_0x28f299[_0x5d7a('0x2f')]=_0x28f299['attributes'][_0x5d7a('0x30')]?_0x28f299[_0x5d7a('0x2f')]:_0x2c94e2[_0x5d7a('0x29')];if(!_0x5ecbba[_0x5d7a('0x2b')][_0x5d7a('0x31')](_0x5d7a('0x32'))){_0x28f299[_0x5d7a('0x1d')]=qs[_0x5d7a('0x1d')](_0x5ecbba['query'][_0x5d7a('0x1d')]);_0x28f299[_0x5d7a('0x1c')]=qs[_0x5d7a('0x1c')](_0x5ecbba[_0x5d7a('0x2b')][_0x5d7a('0x1c')]);}_0x28f299[_0x5d7a('0x33')]=qs[_0x5d7a('0x34')](_0x5ecbba['query']['sort']);_0x28f299['where']=qs['filters'](_[_0x5d7a('0x35')](_0x5ecbba[_0x5d7a('0x2b')],_0x2c94e2[_0x5d7a('0x36')]),_0x4de87d);if(_0x5ecbba[_0x5d7a('0x2b')][_0x5d7a('0x37')]){_0x28f299[_0x5d7a('0x38')]=_[_0x5d7a('0x39')](_0x28f299[_0x5d7a('0x38')],{'$or':_[_0x5d7a('0x2a')](_0x4de87d,function(_0x3a3638){if(_0x3a3638[_0x5d7a('0x3a')]!==_0x5d7a('0x3b')){var _0x417102={};_0x417102[_0x3a3638[_0x5d7a('0x26')]]={'$like':'%'+_0x5ecbba[_0x5d7a('0x2b')][_0x5d7a('0x37')]+'%'};return _0x417102;}})});}_0x28f299=_[_0x5d7a('0x39')]({},_0x28f299,_0x5ecbba[_0x5d7a('0x3c')]);var _0x234b80={'where':_0x28f299[_0x5d7a('0x38')]};return db['SalesforceAccount'][_0x5d7a('0x3d')](_0x234b80)[_0x5d7a('0x3e')](function(_0x3f61e6){_0x3ab5c5[_0x5d7a('0x3d')]=_0x3f61e6;if(_0x5ecbba[_0x5d7a('0x2b')][_0x5d7a('0x3f')]){_0x28f299['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0x5d7a('0x40')](_0x28f299);})[_0x5d7a('0x3e')](function(_0x1cdb43){_0x3ab5c5[_0x5d7a('0x41')]=_0x1cdb43;return _0x3ab5c5;})[_0x5d7a('0x3e')](respondWithFilteredResult(_0x307f20,_0x28f299))[_0x5d7a('0x42')](handleError(_0x307f20,null));};exports[_0x5d7a('0x43')]=function(_0x2a5095,_0x5aefe1){var _0x574647={'raw':![],'where':{'id':_0x2a5095['params']['id']}},_0x296fe5={};_0x296fe5['model']=_[_0x5d7a('0x2c')](db[_0x5d7a('0x44')][_0x5d7a('0x45')]);_0x296fe5[_0x5d7a('0x2b')]=_[_0x5d7a('0x2c')](_0x2a5095['query']);_0x296fe5[_0x5d7a('0x36')]=_[_0x5d7a('0x2d')](_0x296fe5[_0x5d7a('0x29')],_0x296fe5['query']);_0x574647[_0x5d7a('0x2f')]=_[_0x5d7a('0x2d')](_0x296fe5[_0x5d7a('0x29')],qs[_0x5d7a('0x2e')](_0x2a5095['query']['fields']));_0x574647[_0x5d7a('0x2f')]=_0x574647[_0x5d7a('0x2f')]['length']?_0x574647['attributes']:_0x296fe5[_0x5d7a('0x29')];if(_0x2a5095[_0x5d7a('0x2b')][_0x5d7a('0x3f')]){_0x574647[_0x5d7a('0x46')]=[{'all':!![]}];}_0x574647=_['merge']({},_0x574647,_0x2a5095['options']);return db[_0x5d7a('0x44')][_0x5d7a('0x47')](_0x574647)[_0x5d7a('0x3e')](handleEntityNotFound(_0x5aefe1,null))[_0x5d7a('0x3e')](respondWithResult(_0x5aefe1,null))[_0x5d7a('0x42')](handleError(_0x5aefe1,null));};exports['create']=function(_0x526b36,_0x485d69){return db[_0x5d7a('0x44')][_0x5d7a('0x48')](_0x526b36[_0x5d7a('0x49')],{})['then'](respondWithResult(_0x485d69,0xc9))['catch'](handleError(_0x485d69,null));};exports['update']=function(_0x3a8d69,_0x60e757){if(_0x3a8d69[_0x5d7a('0x49')]['id']){delete _0x3a8d69['body']['id'];}return db[_0x5d7a('0x44')][_0x5d7a('0x47')]({'where':{'id':_0x3a8d69[_0x5d7a('0x4a')]['id']}})[_0x5d7a('0x3e')](handleEntityNotFound(_0x60e757,null))['then'](saveUpdates(_0x3a8d69[_0x5d7a('0x49')],null))[_0x5d7a('0x3e')](respondWithResult(_0x60e757,null))[_0x5d7a('0x42')](handleError(_0x60e757,null));};exports[_0x5d7a('0x4b')]=function(_0x471ada,_0x2c8981){return db['SalesforceAccount'][_0x5d7a('0x47')]({'where':{'id':_0x471ada['params']['id']}})[_0x5d7a('0x3e')](handleEntityNotFound(_0x2c8981,null))[_0x5d7a('0x3e')](removeEntity(_0x2c8981,null))['catch'](handleError(_0x2c8981,null));};exports[_0x5d7a('0x4c')]=function(_0x17470e,_0x50b846,_0x1d4fb8){var _0x3043d6={};var _0x3817e7={};var _0xb60369;var _0x13b094;return db['SalesforceAccount'][_0x5d7a('0x4d')]({'where':{'id':_0x17470e[_0x5d7a('0x4a')]['id']}})[_0x5d7a('0x3e')](handleEntityNotFound(_0x50b846,null))['then'](function(_0x2e0845){if(_0x2e0845){_0xb60369=_0x2e0845;_0x3817e7[_0x5d7a('0x29')]=_['keys'](db[_0x5d7a('0x4e')]['rawAttributes']);_0x3817e7['query']=_['keys'](_0x17470e[_0x5d7a('0x2b')]);_0x3817e7[_0x5d7a('0x36')]=_[_0x5d7a('0x2d')](_0x3817e7[_0x5d7a('0x29')],_0x3817e7['query']);_0x3043d6[_0x5d7a('0x2f')]=_[_0x5d7a('0x2d')](_0x3817e7['model'],qs[_0x5d7a('0x2e')](_0x17470e['query'][_0x5d7a('0x2e')]));_0x3043d6['attributes']=_0x3043d6['attributes']['length']?_0x3043d6[_0x5d7a('0x2f')]:_0x3817e7[_0x5d7a('0x29')];_0x3043d6[_0x5d7a('0x33')]=qs[_0x5d7a('0x34')](_0x17470e[_0x5d7a('0x2b')][_0x5d7a('0x34')]);_0x3043d6[_0x5d7a('0x38')]=qs[_0x5d7a('0x36')](_['pick'](_0x17470e[_0x5d7a('0x2b')],_0x3817e7['filters']));if(_0x17470e[_0x5d7a('0x2b')][_0x5d7a('0x37')]){_0x3043d6[_0x5d7a('0x38')]=_[_0x5d7a('0x39')](_0x3043d6[_0x5d7a('0x38')],{'$or':_[_0x5d7a('0x2a')](_0x3043d6[_0x5d7a('0x2f')],function(_0x2e60b3){var _0x5654f2={};_0x5654f2[_0x2e60b3]={'$like':'%'+_0x17470e['query']['filter']+'%'};return _0x5654f2;})});}_0x3043d6=_[_0x5d7a('0x39')]({},_0x3043d6,_0x17470e[_0x5d7a('0x3c')]);return _0xb60369['getConfigurations'](_0x3043d6);}})[_0x5d7a('0x3e')](function(_0x3b6f2b){if(_0x3b6f2b){_0x13b094=_0x3b6f2b['length'];if(!_0x17470e['query']['hasOwnProperty']('nolimit')){_0x3043d6[_0x5d7a('0x1d')]=qs['limit'](_0x17470e[_0x5d7a('0x2b')][_0x5d7a('0x1d')]);_0x3043d6[_0x5d7a('0x1c')]=qs[_0x5d7a('0x1c')](_0x17470e[_0x5d7a('0x2b')][_0x5d7a('0x1c')]);}return _0xb60369['getConfigurations'](_0x3043d6);}})[_0x5d7a('0x3e')](function(_0x18dfdc){if(_0x18dfdc){return _0x18dfdc?{'count':_0x13b094,'rows':_0x18dfdc}:null;}})['then'](respondWithResult(_0x50b846,null))[_0x5d7a('0x42')](handleError(_0x50b846,null));};exports[_0x5d7a('0x4f')]=function(_0x1ef176,_0x3f1bcf,_0x2ad28a){if(_0x1ef176['body']['id']){delete _0x1ef176[_0x5d7a('0x49')]['id'];}return db[_0x5d7a('0x44')][_0x5d7a('0x4d')]({'where':{'id':_0x1ef176[_0x5d7a('0x4a')]['id']}})[_0x5d7a('0x3e')](handleEntityNotFound(_0x3f1bcf,null))[_0x5d7a('0x3e')](function(_0x34b9fe){if(_0x34b9fe){_0x1ef176[_0x5d7a('0x49')][_0x5d7a('0x50')]=_0x34b9fe['id'];_0x1ef176[_0x5d7a('0x49')][_0x5d7a('0x51')]=integrations['getSubjects'](_0x1ef176[_0x5d7a('0x49')][_0x5d7a('0x52')],_0x1ef176[_0x5d7a('0x49')][_0x5d7a('0x3a')]);_0x1ef176['body'][_0x5d7a('0x53')]=integrations[_0x5d7a('0x54')](_0x1ef176[_0x5d7a('0x49')][_0x5d7a('0x52')],_0x1ef176['body'][_0x5d7a('0x3a')]);return db[_0x5d7a('0x4e')][_0x5d7a('0x48')](_0x1ef176[_0x5d7a('0x49')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x5d7a('0x55')],'as':_0x5d7a('0x53')}]});}return null;})[_0x5d7a('0x3e')](respondWithResult(_0x3f1bcf,null))[_0x5d7a('0x42')](handleError(_0x3f1bcf,null));};exports['getFields']=function(_0xdec37a,_0xc1f30d,_0x318862){var _0xb278e4;var _0x53fb28='';var _0x12cf2d=_0x5d7a('0x56');return db[_0x5d7a('0x44')][_0x5d7a('0x4d')]({'where':{'id':_0xdec37a[_0x5d7a('0x4a')]['id']},'attributes':['id',_0x5d7a('0x57'),_0x5d7a('0x58'),_0x5d7a('0x59'),_0x5d7a('0x5a'),_0x5d7a('0x5b'),'securityToken']})[_0x5d7a('0x3e')](handleEntityNotFound(_0xc1f30d,null))[_0x5d7a('0x3e')](function(_0x4340ad){if(_0x4340ad){_0x53fb28=_0x4340ad[_0x5d7a('0x57')];var _0x13d189=_0x53fb28[_0x5d7a('0x5c')](-0x1);if(_0x13d189==='/'){_0x53fb28=_0x53fb28[_0x5d7a('0x5d')](0x0,_0x53fb28['lastIndexOf'](_0x13d189));}_0xb278e4=new jsforce[(_0x5d7a('0x5e'))]({'oauth2':{'loginUrl':_0x53fb28,'clientId':_0x4340ad[_0x5d7a('0x58')],'clientSecret':_0x4340ad[_0x5d7a('0x59')]}});return _0xb278e4['login'](_0x4340ad[_0x5d7a('0x5a')],_0x4340ad[_0x5d7a('0x5b')][_0x5d7a('0x5f')](_0x4340ad[_0x5d7a('0x60')]));}})[_0x5d7a('0x3e')](function(_0x3baa99){if(_0x3baa99){if(!_[_0x5d7a('0x61')](_0xdec37a[_0x5d7a('0x2b')][_0x5d7a('0x62')])){_0x12cf2d=_0xdec37a[_0x5d7a('0x2b')][_0x5d7a('0x62')];}return _0xb278e4[_0x5d7a('0x63')](_0x12cf2d)[_0x5d7a('0x64')]();}})[_0x5d7a('0x3e')](function(_0x594012){var _0x248f9d=['OwnerId',_0x5d7a('0x65'),_0x5d7a('0x66'),_0x5d7a('0x67'),_0x5d7a('0x68'),_0x5d7a('0x69')];var _0x27111f=[_0x5d7a('0x6a'),'int','picklist',_0x5d7a('0x6b'),_0x5d7a('0x6c'),'textarea','phone'];if(_0x594012){_[_0x5d7a('0x6d')](_0x594012[_0x5d7a('0x2e')],function(_0x3a46fc){return _0x248f9d['includes'](_0x3a46fc[_0x5d7a('0x26')])||!_0x27111f['includes'](_0x3a46fc[_0x5d7a('0x3a')]);});return{'count':_0x594012[_0x5d7a('0x2e')]['length'],'rows':_[_0x5d7a('0x2a')](_0x594012[_0x5d7a('0x2e')],function(_0x4533de){return{'id':_0x4533de[_0x5d7a('0x26')],'name':_0x4533de[_0x5d7a('0x6e')],'custom':_0x4533de['custom'],'options':_0x4533de[_0x5d7a('0x6f')][_0x5d7a('0x30')]>0x0?_[_0x5d7a('0x2a')](_0x4533de['picklistValues'],function(_0x2e219a){return{'name':_0x2e219a[_0x5d7a('0x6e')],'value':_0x2e219a[_0x5d7a('0x70')]};}):_0x4533de['type']==_0x5d7a('0x6b')?[{'name':_0x5d7a('0x71'),'value':_0x5d7a('0x72')},{'name':_0x5d7a('0x73'),'value':_0x5d7a('0x74')}]:[]};})};}})[_0x5d7a('0x3e')](respondWithResult(_0xc1f30d,null))[_0x5d7a('0x42')](function(_0xbee824){var _0x396b33=_0xdec37a[_0x5d7a('0x2b')][_0x5d7a('0x75')]?0x1f4:_0xbee824[_0x5d7a('0x76')]||0x1f4;logger[_0x5d7a('0x24')](_0x5d7a('0x77'),_0x5d7a('0x78'),_0x396b33,JSON[_0x5d7a('0x79')](_0xbee824));delete _0xbee824[_0x5d7a('0x26')];if(_0x396b33===0x191){_0x396b33=0x190;}_0xc1f30d[_0x5d7a('0x1a')](_0x396b33)['send'](_0xdec37a[_0x5d7a('0x2b')][_0x5d7a('0x75')]?{'message':_0x5d7a('0x7a'),'statusCode':_0xbee824[_0x5d7a('0x76')]}:_0xbee824);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index de5e08c..6d83707 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 _0xa664=['int_salesforce_accounts','lodash','util','api','moment','bluebird','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define'];(function(_0x3ad8a6,_0x555e61){var _0x24a7a6=function(_0xb2595){while(--_0xb2595){_0x3ad8a6['push'](_0x3ad8a6['shift']());}};_0x24a7a6(++_0x555e61);}(_0xa664,0x1f0));var _0x4a66=function(_0x1975db,_0x5290b5){_0x1975db=_0x1975db-0x0;var _0x8b0af8=_0xa664[_0x1975db];return _0x8b0af8;};'use strict';var _=require(_0x4a66('0x0'));var util=require(_0x4a66('0x1'));var logger=require('../../config/logger')(_0x4a66('0x2'));var moment=require(_0x4a66('0x3'));var BPromise=require(_0x4a66('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a66('0x5'));var rimraf=require('rimraf');var config=require(_0x4a66('0x6'));var attributes=require(_0x4a66('0x7'));var integrations=require(_0x4a66('0x8'));module['exports']=function(_0x21b4e8,_0x5e2943){return _0x21b4e8[_0x4a66('0x9')]('SalesforceAccount',attributes,{'tableName':_0x4a66('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda2f=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','int_salesforce_accounts'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xda2f,0xdc));var _0xfda2=function(_0x25099c,_0xc29926){_0x25099c=_0x25099c-0x0;var _0x469e76=_0xda2f[_0x25099c];return _0x469e76;};'use strict';var _=require(_0xfda2('0x0'));var util=require('util');var logger=require(_0xfda2('0x1'))(_0xfda2('0x2'));var moment=require(_0xfda2('0x3'));var BPromise=require(_0xfda2('0x4'));var rp=require(_0xfda2('0x5'));var fs=require('fs');var path=require(_0xfda2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfda2('0x7'));var integrations=require(_0xfda2('0x8'));module[_0xfda2('0x9')]=function(_0x5ea99a,_0x3125bf){return _0x5ea99a['define']('SalesforceAccount',attributes,{'tableName':_0xfda2('0xa'),'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 98028f9..1df43c8 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 _0x7ba6=['message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','ShowSalesforceAccount','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x11061c,_0x1fc7cf){var _0x42e965=function(_0x31caf9){while(--_0x31caf9){_0x11061c['push'](_0x11061c['shift']());}};_0x42e965(++_0x1fc7cf);}(_0x7ba6,0x1aa));var _0x67ba=function(_0x12bf20,_0x3f2715){_0x12bf20=_0x12bf20-0x0;var _0x5bf622=_0x7ba6[_0x12bf20];return _0x5bf622;};'use strict';var _=require(_0x67ba('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x67ba('0x1'));var rs=require(_0x67ba('0x2'));var fs=require('fs');var Redis=require(_0x67ba('0x3'));var db=require(_0x67ba('0x4'))['db'];var utils=require(_0x67ba('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x67ba('0x6'));var client=jayson[_0x67ba('0x7')][_0x67ba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26f0fb,_0x58f427,_0x524dd7){return new BPromise(function(_0x35df9d,_0x300129){return client[_0x67ba('0x9')](_0x26f0fb,_0x524dd7)['then'](function(_0x98a13f){logger[_0x67ba('0xa')](_0x67ba('0xb'),_0x58f427,_0x67ba('0xc'));logger['debug'](_0x67ba('0xd'),_0x58f427,'request\x20sent',JSON['stringify'](_0x98a13f));if(_0x98a13f[_0x67ba('0xe')]){if(_0x98a13f[_0x67ba('0xe')][_0x67ba('0xf')]===0x1f4){logger[_0x67ba('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x58f427,_0x98a13f['error'][_0x67ba('0x10')]);return _0x300129(_0x98a13f['error'][_0x67ba('0x10')]);}logger[_0x67ba('0xe')](_0x67ba('0xb'),_0x58f427,_0x98a13f[_0x67ba('0xe')]['message']);return _0x35df9d(_0x98a13f[_0x67ba('0xe')][_0x67ba('0x10')]);}else{logger[_0x67ba('0xa')](_0x67ba('0xb'),_0x58f427,_0x67ba('0xc'));_0x35df9d(_0x98a13f[_0x67ba('0x11')][_0x67ba('0x10')]);}})[_0x67ba('0x12')](function(_0x42286a){logger['error'](_0x67ba('0xb'),_0x58f427,_0x42286a);_0x300129(_0x42286a);});});}exports[_0x67ba('0x13')]=function(_0x3a84f6){var _0xbe4f06=this;return new Promise(function(_0x375c96,_0x138145){return db[_0x67ba('0x14')]['findAll']({'raw':_0x3a84f6[_0x67ba('0x15')]?_0x3a84f6[_0x67ba('0x15')][_0x67ba('0x16')]===undefined?!![]:![]:!![],'where':_0x3a84f6[_0x67ba('0x15')]?_0x3a84f6[_0x67ba('0x15')][_0x67ba('0x17')]||null:null,'attributes':_0x3a84f6[_0x67ba('0x15')]?_0x3a84f6['options'][_0x67ba('0x18')]||null:null,'limit':_0x3a84f6[_0x67ba('0x15')]?_0x3a84f6['options'][_0x67ba('0x19')]||null:null,'include':_0x3a84f6[_0x67ba('0x15')]?_0x3a84f6[_0x67ba('0x15')][_0x67ba('0x1a')]?_[_0x67ba('0x1b')](_0x3a84f6[_0x67ba('0x15')][_0x67ba('0x1a')],function(_0xb9d19){return{'model':db[_0xb9d19[_0x67ba('0x1c')]],'as':_0xb9d19['as'],'attributes':_0xb9d19[_0x67ba('0x18')],'include':_0xb9d19['include']?_['map'](_0xb9d19['include'],function(_0x10d003){return{'model':db[_0x10d003[_0x67ba('0x1c')]],'as':_0x10d003['as'],'attributes':_0x10d003[_0x67ba('0x18')],'include':_0x10d003[_0x67ba('0x1a')]?_[_0x67ba('0x1b')](_0x10d003[_0x67ba('0x1a')],function(_0x22abf0){return{'model':db[_0x22abf0['model']],'as':_0x22abf0['as'],'attributes':_0x22abf0[_0x67ba('0x18')]};}):[]};}):[]};}):[]:[]})[_0x67ba('0x1d')](function(_0x4f9a66){logger['info'](_0x67ba('0x13'),_0x3a84f6);logger[_0x67ba('0x1e')](_0x67ba('0x13'),_0x3a84f6,JSON[_0x67ba('0x1f')](_0x4f9a66));_0x375c96(_0x4f9a66);})[_0x67ba('0x12')](function(_0x2ab1f0){logger[_0x67ba('0xe')](_0x67ba('0x13'),_0x2ab1f0[_0x67ba('0x10')],_0x3a84f6);_0x138145(_0xbe4f06[_0x67ba('0xe')](0x1f4,_0x2ab1f0[_0x67ba('0x10')]));});});};exports[_0x67ba('0x20')]=function(_0x5051f2){var _0x3196c3=this;return new Promise(function(_0x113f56,_0x25e5bd){return db['SalesforceAccount'][_0x67ba('0x21')]({'raw':_0x5051f2[_0x67ba('0x15')]?_0x5051f2[_0x67ba('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5051f2[_0x67ba('0x15')]?_0x5051f2['options'][_0x67ba('0x17')]||null:null,'attributes':_0x5051f2['options']?_0x5051f2[_0x67ba('0x15')]['attributes']||null:null,'include':_0x5051f2['options']?_0x5051f2['options']['include']?_[_0x67ba('0x1b')](_0x5051f2[_0x67ba('0x15')][_0x67ba('0x1a')],function(_0x2aac1f){return{'model':db[_0x2aac1f[_0x67ba('0x1c')]],'as':_0x2aac1f['as'],'attributes':_0x2aac1f[_0x67ba('0x18')],'include':_0x2aac1f[_0x67ba('0x1a')]?_[_0x67ba('0x1b')](_0x2aac1f[_0x67ba('0x1a')],function(_0x554e6f){return{'model':db[_0x554e6f[_0x67ba('0x1c')]],'as':_0x554e6f['as'],'attributes':_0x554e6f[_0x67ba('0x18')],'include':_0x554e6f[_0x67ba('0x1a')]?_['map'](_0x554e6f[_0x67ba('0x1a')],function(_0x29412a){return{'model':db[_0x29412a[_0x67ba('0x1c')]],'as':_0x29412a['as'],'attributes':_0x29412a[_0x67ba('0x18')]};}):[]};}):[]};}):[]:[]})[_0x67ba('0x1d')](function(_0xddc010){logger[_0x67ba('0xa')](_0x67ba('0x20'),_0x5051f2);logger[_0x67ba('0x1e')](_0x67ba('0x20'),_0x5051f2,JSON[_0x67ba('0x1f')](_0xddc010));_0x113f56(_0xddc010);})['catch'](function(_0x4f6a70){logger[_0x67ba('0xe')](_0x67ba('0x20'),_0x4f6a70[_0x67ba('0x10')],_0x5051f2);_0x25e5bd(_0x3196c3['error'](0x1f4,_0x4f6a70[_0x67ba('0x10')]));});});}; \ No newline at end of file +var _0xa76e=['info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','attributes','limit','include','map','model','ShowSalesforceAccount','find','where','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x1b4e4f,_0x43d866){var _0x2f8949=function(_0x1148d7){while(--_0x1148d7){_0x1b4e4f['push'](_0x1b4e4f['shift']());}};_0x2f8949(++_0x43d866);}(_0xa76e,0xfe));var _0xea76=function(_0x3a78a0,_0x44985f){_0x3a78a0=_0x3a78a0-0x0;var _0x48e917=_0xa76e[_0x3a78a0];return _0x48e917;};'use strict';var _=require('lodash');var util=require(_0xea76('0x0'));var moment=require(_0xea76('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea76('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xea76('0x3'));var logger=require(_0xea76('0x4'))(_0xea76('0x5'));var config=require('../../config/environment');var jayson=require(_0xea76('0x6'));var client=jayson['client'][_0xea76('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ee974,_0x45ac1b,_0x1735ff){return new BPromise(function(_0x5eb746,_0x55aae7){return client[_0xea76('0x8')](_0x4ee974,_0x1735ff)[_0xea76('0x9')](function(_0x1c6723){logger[_0xea76('0xa')]('SalesforceAccount,\x20%s,\x20%s',_0x45ac1b,_0xea76('0xb'));logger[_0xea76('0xc')](_0xea76('0xd'),_0x45ac1b,'request\x20sent',JSON[_0xea76('0xe')](_0x1c6723));if(_0x1c6723[_0xea76('0xf')]){if(_0x1c6723[_0xea76('0xf')][_0xea76('0x10')]===0x1f4){logger[_0xea76('0xf')](_0xea76('0x11'),_0x45ac1b,_0x1c6723[_0xea76('0xf')][_0xea76('0x12')]);return _0x55aae7(_0x1c6723[_0xea76('0xf')][_0xea76('0x12')]);}logger[_0xea76('0xf')](_0xea76('0x11'),_0x45ac1b,_0x1c6723[_0xea76('0xf')][_0xea76('0x12')]);return _0x5eb746(_0x1c6723[_0xea76('0xf')]['message']);}else{logger[_0xea76('0xa')](_0xea76('0x11'),_0x45ac1b,_0xea76('0xb'));_0x5eb746(_0x1c6723[_0xea76('0x13')][_0xea76('0x12')]);}})[_0xea76('0x14')](function(_0x3b47fa){logger[_0xea76('0xf')](_0xea76('0x11'),_0x45ac1b,_0x3b47fa);_0x55aae7(_0x3b47fa);});});}exports[_0xea76('0x15')]=function(_0x210e27){var _0x1efdfa=this;return new Promise(function(_0x5ecdd1,_0x49bc4a){return db[_0xea76('0x16')]['findAll']({'raw':_0x210e27[_0xea76('0x17')]?_0x210e27[_0xea76('0x17')][_0xea76('0x18')]===undefined?!![]:![]:!![],'where':_0x210e27['options']?_0x210e27['options']['where']||null:null,'attributes':_0x210e27[_0xea76('0x17')]?_0x210e27[_0xea76('0x17')][_0xea76('0x19')]||null:null,'limit':_0x210e27[_0xea76('0x17')]?_0x210e27['options'][_0xea76('0x1a')]||null:null,'include':_0x210e27['options']?_0x210e27[_0xea76('0x17')][_0xea76('0x1b')]?_[_0xea76('0x1c')](_0x210e27[_0xea76('0x17')][_0xea76('0x1b')],function(_0x337a78){return{'model':db[_0x337a78[_0xea76('0x1d')]],'as':_0x337a78['as'],'attributes':_0x337a78[_0xea76('0x19')],'include':_0x337a78[_0xea76('0x1b')]?_[_0xea76('0x1c')](_0x337a78[_0xea76('0x1b')],function(_0x1729a2){return{'model':db[_0x1729a2[_0xea76('0x1d')]],'as':_0x1729a2['as'],'attributes':_0x1729a2[_0xea76('0x19')],'include':_0x1729a2[_0xea76('0x1b')]?_[_0xea76('0x1c')](_0x1729a2['include'],function(_0x163dc7){return{'model':db[_0x163dc7['model']],'as':_0x163dc7['as'],'attributes':_0x163dc7['attributes']};}):[]};}):[]};}):[]:[]})[_0xea76('0x9')](function(_0x8a66ac){logger[_0xea76('0xa')](_0xea76('0x15'),_0x210e27);logger[_0xea76('0xc')](_0xea76('0x15'),_0x210e27,JSON[_0xea76('0xe')](_0x8a66ac));_0x5ecdd1(_0x8a66ac);})['catch'](function(_0x5c7960){logger[_0xea76('0xf')](_0xea76('0x15'),_0x5c7960[_0xea76('0x12')],_0x210e27);_0x49bc4a(_0x1efdfa[_0xea76('0xf')](0x1f4,_0x5c7960[_0xea76('0x12')]));});});};exports[_0xea76('0x1e')]=function(_0x12c18f){var _0xbbef85=this;return new Promise(function(_0x203447,_0x2dccd7){return db[_0xea76('0x16')][_0xea76('0x1f')]({'raw':_0x12c18f[_0xea76('0x17')]?_0x12c18f[_0xea76('0x17')][_0xea76('0x18')]===undefined?!![]:![]:!![],'where':_0x12c18f['options']?_0x12c18f[_0xea76('0x17')][_0xea76('0x20')]||null:null,'attributes':_0x12c18f[_0xea76('0x17')]?_0x12c18f['options'][_0xea76('0x19')]||null:null,'include':_0x12c18f[_0xea76('0x17')]?_0x12c18f[_0xea76('0x17')][_0xea76('0x1b')]?_['map'](_0x12c18f[_0xea76('0x17')]['include'],function(_0x5aab4f){return{'model':db[_0x5aab4f[_0xea76('0x1d')]],'as':_0x5aab4f['as'],'attributes':_0x5aab4f['attributes'],'include':_0x5aab4f['include']?_[_0xea76('0x1c')](_0x5aab4f[_0xea76('0x1b')],function(_0x424bbb){return{'model':db[_0x424bbb[_0xea76('0x1d')]],'as':_0x424bbb['as'],'attributes':_0x424bbb[_0xea76('0x19')],'include':_0x424bbb['include']?_[_0xea76('0x1c')](_0x424bbb['include'],function(_0xd9e306){return{'model':db[_0xd9e306[_0xea76('0x1d')]],'as':_0xd9e306['as'],'attributes':_0xd9e306[_0xea76('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x112f1d){logger['info']('ShowSalesforceAccount',_0x12c18f);logger[_0xea76('0xc')](_0xea76('0x1e'),_0x12c18f,JSON[_0xea76('0xe')](_0x112f1d));_0x203447(_0x112f1d);})[_0xea76('0x14')](function(_0x125322){logger[_0xea76('0xf')](_0xea76('0x1e'),_0x125322[_0xea76('0x12')],_0x12c18f);_0x2dccd7(_0xbbef85[_0xea76('0xf')](0x1f4,_0x125322[_0xea76('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 294c939..a307057 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(_0xccfc6c,_0x45064c){var _0x1820f7=function(_0x4ff240){while(--_0x4ff240){_0xccfc6c['push'](_0xccfc6c['shift']());}};_0x1820f7(++_0x45064c);}(_0xadb5,0xad));var _0x5adb=function(_0x58b393,_0x427570){_0x58b393=_0x58b393-0x0;var _0x34f571=_0xadb5[_0x58b393];return _0x34f571;};'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 _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(_0x449d80,_0x214fdb){var _0x464fe9=function(_0x4becf2){while(--_0x4becf2){_0x449d80['push'](_0x449d80['shift']());}};_0x464fe9(++_0x214fdb);}(_0xadb5,0xad));var _0x5adb=function(_0x1bb934,_0x172630){_0x1bb934=_0x1bb934-0x0;var _0x7e6257=_0xadb5[_0x1bb934];return _0x7e6257;};'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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index b4329eb..afbcd41 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 _0x5656=['contact','sequelize','exports','STRING','ENUM','Task','contact_lead','lead','account_contact_lead'];(function(_0x51ba66,_0x1facc8){var _0x2c73ba=function(_0x45096c){while(--_0x45096c){_0x51ba66['push'](_0x51ba66['shift']());}};_0x2c73ba(++_0x1facc8);}(_0x5656,0x1d5));var _0x6565=function(_0x25a7cf,_0x3701e6){_0x25a7cf=_0x25a7cf-0x0;var _0x13e361=_0x5656[_0x25a7cf];return _0x13e361;};'use strict';var Sequelize=require(_0x6565('0x0'));module[_0x6565('0x1')]={'name':{'type':Sequelize[_0x6565('0x2')]},'description':{'type':Sequelize[_0x6565('0x2')]},'ticketType':{'type':Sequelize[_0x6565('0x3')]('Task','Case'),'defaultValue':_0x6565('0x4')},'moduleSearch':{'type':Sequelize[_0x6565('0x3')](_0x6565('0x5'),'contact',_0x6565('0x6'),_0x6565('0x7'),'account'),'defaultValue':_0x6565('0x5')},'moduleCreate':{'type':Sequelize[_0x6565('0x3')]('nothing',_0x6565('0x8'),'lead','account'),'defaultValue':_0x6565('0x6')},'leadId':{'type':Sequelize[_0x6565('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x6565('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x6565('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x6565('0x2')]}}; \ No newline at end of file +var _0xa52f=['exports','STRING','ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0xa52f,0xb3));var _0xfa52=function(_0x182195,_0x32795f){_0x182195=_0x182195-0x0;var _0x283b35=_0xa52f[_0x182195];return _0x283b35;};'use strict';var Sequelize=require(_0xfa52('0x0'));module[_0xfa52('0x1')]={'name':{'type':Sequelize[_0xfa52('0x2')]},'description':{'type':Sequelize[_0xfa52('0x2')]},'ticketType':{'type':Sequelize[_0xfa52('0x3')](_0xfa52('0x4'),_0xfa52('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xfa52('0x3')](_0xfa52('0x6'),_0xfa52('0x7'),_0xfa52('0x8'),_0xfa52('0x9'),_0xfa52('0xa')),'defaultValue':_0xfa52('0x6')},'moduleCreate':{'type':Sequelize[_0xfa52('0x3')](_0xfa52('0xb'),_0xfa52('0x7'),'lead',_0xfa52('0xa')),'defaultValue':_0xfa52('0x8')},'leadId':{'type':Sequelize[_0xfa52('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xfa52('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xfa52('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 81ab3ee..f75de2f 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 _0x64f5=['bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getFields','findOne','SalesforceField','getSubjects','hasOwnProperty','getDescriptions','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x35996d,_0x4f1934){var _0x345d33=function(_0x45d5cb){while(--_0x45d5cb){_0x35996d['push'](_0x35996d['shift']());}};_0x345d33(++_0x4f1934);}(_0x64f5,0x1ee));var _0x564f=function(_0x39fd20,_0xcc5f2f){_0x39fd20=_0x39fd20-0x0;var _0x4a61c0=_0x64f5[_0x39fd20];return _0x4a61c0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x564f('0x0'));var jsonpatch=require(_0x564f('0x1'));var rp=require(_0x564f('0x2'));var moment=require(_0x564f('0x3'));var BPromise=require(_0x564f('0x4'));var Mustache=require('mustache');var util=require(_0x564f('0x5'));var path=require(_0x564f('0x6'));var sox=require('sox');var csv=require(_0x564f('0x7'));var ejs=require(_0x564f('0x8'));var fs=require('fs');var fs_extra=require(_0x564f('0x9'));var _=require('lodash');var squel=require(_0x564f('0xa'));var crypto=require(_0x564f('0xb'));var jsforce=require(_0x564f('0xc'));var deskjs=require(_0x564f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x564f('0xe'));var Papa=require(_0x564f('0xf'));var Redis=require(_0x564f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x564f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x564f('0x12'));var logger=require(_0x564f('0x13'))(_0x564f('0x14'));var utils=require(_0x564f('0x15'));var config=require(_0x564f('0x16'));var licenseUtil=require(_0x564f('0x17'));var db=require(_0x564f('0x18'))['db'];function respondWithStatusCode(_0x41a68a,_0x46adbf){_0x46adbf=_0x46adbf||0xcc;return function(_0x17ae68){if(_0x17ae68){return _0x41a68a[_0x564f('0x19')](_0x46adbf);}return _0x41a68a[_0x564f('0x1a')](_0x46adbf)[_0x564f('0x1b')]();};}function respondWithResult(_0x3acdcf,_0x376dda){_0x376dda=_0x376dda||0xc8;return function(_0x30c868){if(_0x30c868){return _0x3acdcf[_0x564f('0x1a')](_0x376dda)['json'](_0x30c868);}};}function respondWithFilteredResult(_0x325460,_0x47e994){return function(_0x590d5b){if(_0x590d5b){var _0x5cee26=typeof _0x47e994[_0x564f('0x1c')]===_0x564f('0x1d')&&typeof _0x47e994[_0x564f('0x1e')]===_0x564f('0x1d');var _0x4128f=_0x590d5b[_0x564f('0x1f')];var _0x4c255f=_0x5cee26?0x0:_0x47e994[_0x564f('0x1c')];var _0x342268=_0x5cee26?_0x590d5b[_0x564f('0x1f')]:_0x47e994[_0x564f('0x1c')]+_0x47e994['limit'];var _0x3be12f;if(_0x342268>=_0x4128f){_0x342268=_0x4128f;_0x3be12f=0xc8;}else{_0x3be12f=0xce;}_0x325460['status'](_0x3be12f);return _0x325460[_0x564f('0x20')](_0x564f('0x21'),_0x4c255f+'-'+_0x342268+'/'+_0x4128f)[_0x564f('0x22')](_0x590d5b);}return null;};}function patchUpdates(_0x41ed8d){return function(_0x521c82){try{jsonpatch[_0x564f('0x23')](_0x521c82,_0x41ed8d,!![]);}catch(_0x20f79a){return BPromise[_0x564f('0x24')](_0x20f79a);}return _0x521c82[_0x564f('0x25')]();};}function saveUpdates(_0x160f75,_0xb6cecf){return function(_0x3cf6c7){if(_0x3cf6c7){return _0x3cf6c7[_0x564f('0x26')](_0x160f75)[_0x564f('0x27')](function(_0x4eb383){return _0x4eb383;});}return null;};}function removeEntity(_0x500d5a,_0x970ba){return function(_0x55d260){if(_0x55d260){return _0x55d260[_0x564f('0x28')]()[_0x564f('0x27')](function(){_0x500d5a[_0x564f('0x1a')](0xcc)[_0x564f('0x1b')]();});}};}function handleEntityNotFound(_0x4ba852,_0x6b392){return function(_0x2e7b94){if(!_0x2e7b94){_0x4ba852['sendStatus'](0x194);}return _0x2e7b94;};}function handleError(_0x41a804,_0x28aa88){_0x28aa88=_0x28aa88||0x1f4;return function(_0x4c695d){logger['error'](_0x4c695d[_0x564f('0x29')]);if(_0x4c695d['name']){delete _0x4c695d[_0x564f('0x2a')];}_0x41a804[_0x564f('0x1a')](_0x28aa88)[_0x564f('0x2b')](_0x4c695d);};}exports[_0x564f('0x2c')]=function(_0x4c53cc,_0x3df3d1){var _0x5a1e4e={},_0x589636={},_0x422c60={'count':0x0,'rows':[]};var _0x5bad9e=_[_0x564f('0x2d')](db[_0x564f('0x2e')][_0x564f('0x2f')],function(_0x4c0840){return{'name':_0x4c0840['fieldName'],'type':_0x4c0840[_0x564f('0x30')][_0x564f('0x31')]};});_0x589636[_0x564f('0x32')]=_[_0x564f('0x2d')](_0x5bad9e,_0x564f('0x2a'));_0x589636[_0x564f('0x33')]=_[_0x564f('0x34')](_0x4c53cc[_0x564f('0x33')]);_0x589636['filters']=_[_0x564f('0x35')](_0x589636['model'],_0x589636[_0x564f('0x33')]);_0x5a1e4e[_0x564f('0x36')]=_['intersection'](_0x589636[_0x564f('0x32')],qs[_0x564f('0x37')](_0x4c53cc['query'][_0x564f('0x37')]));_0x5a1e4e['attributes']=_0x5a1e4e[_0x564f('0x36')][_0x564f('0x38')]?_0x5a1e4e[_0x564f('0x36')]:_0x589636[_0x564f('0x32')];if(!_0x4c53cc[_0x564f('0x33')]['hasOwnProperty'](_0x564f('0x39'))){_0x5a1e4e['limit']=qs['limit'](_0x4c53cc[_0x564f('0x33')][_0x564f('0x1e')]);_0x5a1e4e[_0x564f('0x1c')]=qs[_0x564f('0x1c')](_0x4c53cc[_0x564f('0x33')][_0x564f('0x1c')]);}_0x5a1e4e[_0x564f('0x3a')]=qs[_0x564f('0x3b')](_0x4c53cc['query'][_0x564f('0x3b')]);_0x5a1e4e[_0x564f('0x3c')]=qs[_0x564f('0x3d')](_[_0x564f('0x3e')](_0x4c53cc[_0x564f('0x33')],_0x589636['filters']),_0x5bad9e);if(_0x4c53cc[_0x564f('0x33')][_0x564f('0x3f')]){_0x5a1e4e[_0x564f('0x3c')]=_[_0x564f('0x40')](_0x5a1e4e['where'],{'$or':_[_0x564f('0x2d')](_0x5bad9e,function(_0xee80c6){if(_0xee80c6[_0x564f('0x30')]!==_0x564f('0x41')){var _0x3c6038={};_0x3c6038[_0xee80c6[_0x564f('0x2a')]]={'$like':'%'+_0x4c53cc[_0x564f('0x33')][_0x564f('0x3f')]+'%'};return _0x3c6038;}})});}_0x5a1e4e=_[_0x564f('0x40')]({},_0x5a1e4e,_0x4c53cc[_0x564f('0x42')]);var _0x493f1f={'where':_0x5a1e4e[_0x564f('0x3c')]};return db[_0x564f('0x2e')][_0x564f('0x1f')](_0x493f1f)[_0x564f('0x27')](function(_0x5a9c3c){_0x422c60[_0x564f('0x1f')]=_0x5a9c3c;if(_0x4c53cc[_0x564f('0x33')][_0x564f('0x43')]){_0x5a1e4e[_0x564f('0x44')]=[{'all':!![]}];}return db[_0x564f('0x2e')][_0x564f('0x45')](_0x5a1e4e);})[_0x564f('0x27')](function(_0x3d27d3){_0x422c60[_0x564f('0x46')]=_0x3d27d3;return _0x422c60;})['then'](respondWithFilteredResult(_0x3df3d1,_0x5a1e4e))[_0x564f('0x47')](handleError(_0x3df3d1,null));};exports[_0x564f('0x48')]=function(_0x1a32f0,_0x2c2b37){var _0x40c5d3={'raw':![],'where':{'id':_0x1a32f0[_0x564f('0x49')]['id']}},_0x3583d9={};_0x3583d9[_0x564f('0x32')]=_[_0x564f('0x34')](db['SalesforceConfiguration'][_0x564f('0x2f')]);_0x3583d9[_0x564f('0x33')]=_[_0x564f('0x34')](_0x1a32f0[_0x564f('0x33')]);_0x3583d9[_0x564f('0x3d')]=_['intersection'](_0x3583d9[_0x564f('0x32')],_0x3583d9[_0x564f('0x33')]);_0x40c5d3[_0x564f('0x36')]=_[_0x564f('0x35')](_0x3583d9[_0x564f('0x32')],qs[_0x564f('0x37')](_0x1a32f0[_0x564f('0x33')][_0x564f('0x37')]));_0x40c5d3['attributes']=_0x40c5d3[_0x564f('0x36')]['length']?_0x40c5d3[_0x564f('0x36')]:_0x3583d9[_0x564f('0x32')];if(_0x1a32f0['query']['includeAll']){_0x40c5d3[_0x564f('0x44')]=[{'all':!![]}];}_0x40c5d3=_[_0x564f('0x40')]({},_0x40c5d3,_0x1a32f0[_0x564f('0x42')]);return db[_0x564f('0x2e')]['find'](_0x40c5d3)['then'](handleEntityNotFound(_0x2c2b37,null))[_0x564f('0x27')](respondWithResult(_0x2c2b37,null))[_0x564f('0x47')](handleError(_0x2c2b37,null));};exports['create']=function(_0x18c090,_0x1cea69){return db[_0x564f('0x2e')][_0x564f('0x4a')](_0x18c090['body'],{})[_0x564f('0x27')](respondWithResult(_0x1cea69,0xc9))['catch'](handleError(_0x1cea69,null));};exports['update']=function(_0x6c7214,_0x105d27){if(_0x6c7214['body']['id']){delete _0x6c7214[_0x564f('0x4b')]['id'];}return db['SalesforceConfiguration'][_0x564f('0x4c')]({'where':{'id':_0x6c7214[_0x564f('0x49')]['id']}})[_0x564f('0x27')](handleEntityNotFound(_0x105d27,null))['then'](saveUpdates(_0x6c7214[_0x564f('0x4b')],null))['then'](respondWithResult(_0x105d27,null))[_0x564f('0x47')](handleError(_0x105d27,null));};exports[_0x564f('0x28')]=function(_0x34c589,_0x47b49d){return db[_0x564f('0x2e')][_0x564f('0x4c')]({'where':{'id':_0x34c589[_0x564f('0x49')]['id']}})[_0x564f('0x27')](handleEntityNotFound(_0x47b49d,null))[_0x564f('0x27')](removeEntity(_0x47b49d,null))['catch'](handleError(_0x47b49d,null));};exports[_0x564f('0x4d')]=function(_0x12ed16,_0x5d71da,_0x10814b){var _0x2acc71={};var _0x33fc60={};var _0x107619;var _0x55ffde;return db[_0x564f('0x2e')][_0x564f('0x4e')]({'where':{'id':_0x12ed16['params']['id']}})[_0x564f('0x27')](handleEntityNotFound(_0x5d71da,null))['then'](function(_0x101862){if(_0x101862){_0x107619=_0x101862;_0x33fc60[_0x564f('0x32')]=_['keys'](db[_0x564f('0x4f')]['rawAttributes']);_0x33fc60[_0x564f('0x33')]=_['keys'](_0x12ed16[_0x564f('0x33')]);_0x33fc60[_0x564f('0x3d')]=_[_0x564f('0x35')](_0x33fc60['model'],_0x33fc60['query']);_0x2acc71[_0x564f('0x36')]=_['intersection'](_0x33fc60[_0x564f('0x32')],qs[_0x564f('0x37')](_0x12ed16[_0x564f('0x33')][_0x564f('0x37')]));_0x2acc71[_0x564f('0x36')]=_0x2acc71['attributes']['length']?_0x2acc71[_0x564f('0x36')]:_0x33fc60[_0x564f('0x32')];_0x2acc71[_0x564f('0x3a')]=qs[_0x564f('0x3b')](_0x12ed16[_0x564f('0x33')][_0x564f('0x3b')]);_0x2acc71[_0x564f('0x3c')]=qs['filters'](_[_0x564f('0x3e')](_0x12ed16[_0x564f('0x33')],_0x33fc60['filters']));if(_0x12ed16[_0x564f('0x33')]['filter']){_0x2acc71[_0x564f('0x3c')]=_[_0x564f('0x40')](_0x2acc71[_0x564f('0x3c')],{'$or':_[_0x564f('0x2d')](_0x2acc71[_0x564f('0x36')],function(_0xc27ca0){var _0x5dc261={};_0x5dc261[_0xc27ca0]={'$like':'%'+_0x12ed16[_0x564f('0x33')][_0x564f('0x3f')]+'%'};return _0x5dc261;})});}_0x2acc71=_['merge']({},_0x2acc71,_0x12ed16['options']);return _0x107619[_0x564f('0x4d')](_0x2acc71);}})[_0x564f('0x27')](function(_0x2b4c0e){if(_0x2b4c0e){_0x55ffde=_0x2b4c0e[_0x564f('0x38')];if(!_0x12ed16[_0x564f('0x33')]['hasOwnProperty']('nolimit')){_0x2acc71[_0x564f('0x1e')]=qs[_0x564f('0x1e')](_0x12ed16[_0x564f('0x33')][_0x564f('0x1e')]);_0x2acc71[_0x564f('0x1c')]=qs[_0x564f('0x1c')](_0x12ed16['query'][_0x564f('0x1c')]);}return _0x107619[_0x564f('0x4d')](_0x2acc71);}})['then'](function(_0x23de4b){if(_0x23de4b){return _0x23de4b?{'count':_0x55ffde,'rows':_0x23de4b}:null;}})['then'](respondWithResult(_0x5d71da,null))[_0x564f('0x47')](handleError(_0x5d71da,null));};exports[_0x564f('0x50')]=function(_0x1c71e7,_0x3cae8f,_0x497d46){var _0x8190d2={};var _0x5c165d={};var _0x42aaf9;var _0x851cf1;return db[_0x564f('0x2e')][_0x564f('0x4e')]({'where':{'id':_0x1c71e7[_0x564f('0x49')]['id']}})[_0x564f('0x27')](handleEntityNotFound(_0x3cae8f,null))[_0x564f('0x27')](function(_0x403451){if(_0x403451){_0x42aaf9=_0x403451;_0x5c165d[_0x564f('0x32')]=_[_0x564f('0x34')](db[_0x564f('0x4f')][_0x564f('0x2f')]);_0x5c165d[_0x564f('0x33')]=_[_0x564f('0x34')](_0x1c71e7[_0x564f('0x33')]);_0x5c165d[_0x564f('0x3d')]=_['intersection'](_0x5c165d[_0x564f('0x32')],_0x5c165d[_0x564f('0x33')]);_0x8190d2[_0x564f('0x36')]=_['intersection'](_0x5c165d['model'],qs[_0x564f('0x37')](_0x1c71e7['query']['fields']));_0x8190d2['attributes']=_0x8190d2[_0x564f('0x36')][_0x564f('0x38')]?_0x8190d2['attributes']:_0x5c165d['model'];_0x8190d2[_0x564f('0x3a')]=qs[_0x564f('0x3b')](_0x1c71e7[_0x564f('0x33')][_0x564f('0x3b')]);_0x8190d2[_0x564f('0x3c')]=qs['filters'](_[_0x564f('0x3e')](_0x1c71e7['query'],_0x5c165d[_0x564f('0x3d')]));if(_0x1c71e7[_0x564f('0x33')][_0x564f('0x3f')]){_0x8190d2['where']=_['merge'](_0x8190d2[_0x564f('0x3c')],{'$or':_[_0x564f('0x2d')](_0x8190d2[_0x564f('0x36')],function(_0x4866c1){var _0x2a0ac7={};_0x2a0ac7[_0x4866c1]={'$like':'%'+_0x1c71e7[_0x564f('0x33')][_0x564f('0x3f')]+'%'};return _0x2a0ac7;})});}_0x8190d2=_[_0x564f('0x40')]({},_0x8190d2,_0x1c71e7[_0x564f('0x42')]);return _0x42aaf9['getSubjects'](_0x8190d2);}})[_0x564f('0x27')](function(_0x336c28){if(_0x336c28){_0x851cf1=_0x336c28[_0x564f('0x38')];if(!_0x1c71e7[_0x564f('0x33')][_0x564f('0x51')](_0x564f('0x39'))){_0x8190d2[_0x564f('0x1e')]=qs['limit'](_0x1c71e7[_0x564f('0x33')][_0x564f('0x1e')]);_0x8190d2[_0x564f('0x1c')]=qs[_0x564f('0x1c')](_0x1c71e7[_0x564f('0x33')][_0x564f('0x1c')]);}return _0x42aaf9[_0x564f('0x50')](_0x8190d2);}})[_0x564f('0x27')](function(_0x1c0fea){if(_0x1c0fea){return _0x1c0fea?{'count':_0x851cf1,'rows':_0x1c0fea}:null;}})[_0x564f('0x27')](respondWithResult(_0x3cae8f,null))['catch'](handleError(_0x3cae8f,null));};exports[_0x564f('0x52')]=function(_0x2cb83b,_0x22dca9,_0x2af474){var _0x467e4d={};var _0x32af12={};var _0x14a5ef;var _0x374ae7;return db[_0x564f('0x2e')][_0x564f('0x4e')]({'where':{'id':_0x2cb83b[_0x564f('0x49')]['id']}})[_0x564f('0x27')](handleEntityNotFound(_0x22dca9,null))['then'](function(_0x163f8d){if(_0x163f8d){_0x14a5ef=_0x163f8d;_0x32af12[_0x564f('0x32')]=_[_0x564f('0x34')](db[_0x564f('0x4f')]['rawAttributes']);_0x32af12[_0x564f('0x33')]=_[_0x564f('0x34')](_0x2cb83b[_0x564f('0x33')]);_0x32af12['filters']=_[_0x564f('0x35')](_0x32af12['model'],_0x32af12['query']);_0x467e4d['attributes']=_[_0x564f('0x35')](_0x32af12[_0x564f('0x32')],qs['fields'](_0x2cb83b[_0x564f('0x33')][_0x564f('0x37')]));_0x467e4d[_0x564f('0x36')]=_0x467e4d[_0x564f('0x36')][_0x564f('0x38')]?_0x467e4d[_0x564f('0x36')]:_0x32af12[_0x564f('0x32')];_0x467e4d[_0x564f('0x3a')]=qs[_0x564f('0x3b')](_0x2cb83b['query'][_0x564f('0x3b')]);_0x467e4d[_0x564f('0x3c')]=qs['filters'](_[_0x564f('0x3e')](_0x2cb83b[_0x564f('0x33')],_0x32af12['filters']));if(_0x2cb83b[_0x564f('0x33')][_0x564f('0x3f')]){_0x467e4d[_0x564f('0x3c')]=_[_0x564f('0x40')](_0x467e4d[_0x564f('0x3c')],{'$or':_[_0x564f('0x2d')](_0x467e4d['attributes'],function(_0x5f0c90){var _0x131848={};_0x131848[_0x5f0c90]={'$like':'%'+_0x2cb83b[_0x564f('0x33')]['filter']+'%'};return _0x131848;})});}_0x467e4d=_['merge']({},_0x467e4d,_0x2cb83b[_0x564f('0x42')]);return _0x14a5ef['getDescriptions'](_0x467e4d);}})['then'](function(_0x2ee0f2){if(_0x2ee0f2){_0x374ae7=_0x2ee0f2['length'];if(!_0x2cb83b['query'][_0x564f('0x51')]('nolimit')){_0x467e4d[_0x564f('0x1e')]=qs[_0x564f('0x1e')](_0x2cb83b[_0x564f('0x33')][_0x564f('0x1e')]);_0x467e4d[_0x564f('0x1c')]=qs[_0x564f('0x1c')](_0x2cb83b[_0x564f('0x33')][_0x564f('0x1c')]);}return _0x14a5ef['getDescriptions'](_0x467e4d);}})['then'](function(_0x5856f3){if(_0x5856f3){return _0x5856f3?{'count':_0x374ae7,'rows':_0x5856f3}:null;}})['then'](respondWithResult(_0x22dca9,null))[_0x564f('0x47')](handleError(_0x22dca9,null));}; \ No newline at end of file +var _0xfd04=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','name','index','SalesforceConfiguration','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','show','params','catch','create','body','find','getFields','findOne','SalesforceField','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x1674e8,_0x4c717a){var _0x3b6ce4=function(_0x21959f){while(--_0x21959f){_0x1674e8['push'](_0x1674e8['shift']());}};_0x3b6ce4(++_0x4c717a);}(_0xfd04,0xe1));var _0x4fd0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfd04[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4fd0('0x0'));var zipdir=require(_0x4fd0('0x1'));var jsonpatch=require(_0x4fd0('0x2'));var rp=require(_0x4fd0('0x3'));var moment=require(_0x4fd0('0x4'));var BPromise=require(_0x4fd0('0x5'));var Mustache=require(_0x4fd0('0x6'));var util=require(_0x4fd0('0x7'));var path=require('path');var sox=require(_0x4fd0('0x8'));var csv=require('to-csv');var ejs=require(_0x4fd0('0x9'));var fs=require('fs');var fs_extra=require(_0x4fd0('0xa'));var _=require(_0x4fd0('0xb'));var squel=require('squel');var crypto=require(_0x4fd0('0xc'));var jsforce=require(_0x4fd0('0xd'));var deskjs=require(_0x4fd0('0xe'));var toCsv=require(_0x4fd0('0xf'));var querystring=require(_0x4fd0('0x10'));var Papa=require(_0x4fd0('0x11'));var Redis=require(_0x4fd0('0x12'));var authService=require(_0x4fd0('0x13'));var qs=require(_0x4fd0('0x14'));var as=require(_0x4fd0('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4fd0('0x16'))('api');var utils=require(_0x4fd0('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4fd0('0x18'));var db=require(_0x4fd0('0x19'))['db'];function respondWithStatusCode(_0x2dd067,_0x8ee7fb){_0x8ee7fb=_0x8ee7fb||0xcc;return function(_0x58612a){if(_0x58612a){return _0x2dd067['sendStatus'](_0x8ee7fb);}return _0x2dd067[_0x4fd0('0x1a')](_0x8ee7fb)['end']();};}function respondWithResult(_0x30ca4e,_0x51b138){_0x51b138=_0x51b138||0xc8;return function(_0x172f71){if(_0x172f71){return _0x30ca4e[_0x4fd0('0x1a')](_0x51b138)[_0x4fd0('0x1b')](_0x172f71);}};}function respondWithFilteredResult(_0x43bbdb,_0xa6510a){return function(_0x111429){if(_0x111429){var _0x429de9=typeof _0xa6510a[_0x4fd0('0x1c')]===_0x4fd0('0x1d')&&typeof _0xa6510a[_0x4fd0('0x1e')]==='undefined';var _0x17dde5=_0x111429[_0x4fd0('0x1f')];var _0x80c7f1=_0x429de9?0x0:_0xa6510a[_0x4fd0('0x1c')];var _0x3096bd=_0x429de9?_0x111429['count']:_0xa6510a['offset']+_0xa6510a['limit'];var _0x5e9bc1;if(_0x3096bd>=_0x17dde5){_0x3096bd=_0x17dde5;_0x5e9bc1=0xc8;}else{_0x5e9bc1=0xce;}_0x43bbdb[_0x4fd0('0x1a')](_0x5e9bc1);return _0x43bbdb['set'](_0x4fd0('0x20'),_0x80c7f1+'-'+_0x3096bd+'/'+_0x17dde5)[_0x4fd0('0x1b')](_0x111429);}return null;};}function patchUpdates(_0x56732d){return function(_0x26aa81){try{jsonpatch['apply'](_0x26aa81,_0x56732d,!![]);}catch(_0x109973){return BPromise[_0x4fd0('0x21')](_0x109973);}return _0x26aa81[_0x4fd0('0x22')]();};}function saveUpdates(_0x2aff98,_0x2e865a){return function(_0x2b1665){if(_0x2b1665){return _0x2b1665[_0x4fd0('0x23')](_0x2aff98)[_0x4fd0('0x24')](function(_0x303bb0){return _0x303bb0;});}return null;};}function removeEntity(_0x2b1a30,_0x3caf09){return function(_0x5b1c5f){if(_0x5b1c5f){return _0x5b1c5f[_0x4fd0('0x25')]()[_0x4fd0('0x24')](function(){_0x2b1a30['status'](0xcc)[_0x4fd0('0x26')]();});}};}function handleEntityNotFound(_0xc724b7,_0xb40252){return function(_0x348510){if(!_0x348510){_0xc724b7[_0x4fd0('0x27')](0x194);}return _0x348510;};}function handleError(_0x3a9ded,_0xd43f77){_0xd43f77=_0xd43f77||0x1f4;return function(_0x239aef){logger[_0x4fd0('0x28')](_0x239aef['stack']);if(_0x239aef[_0x4fd0('0x29')]){delete _0x239aef['name'];}_0x3a9ded['status'](_0xd43f77)['send'](_0x239aef);};}exports[_0x4fd0('0x2a')]=function(_0x5a18fa,_0x2609e8){var _0x3ca0aa={},_0x10b84c={},_0x2fcaf6={'count':0x0,'rows':[]};var _0xbd6c23=_['map'](db[_0x4fd0('0x2b')][_0x4fd0('0x2c')],function(_0x194694){return{'name':_0x194694[_0x4fd0('0x2d')],'type':_0x194694[_0x4fd0('0x2e')]['key']};});_0x10b84c[_0x4fd0('0x2f')]=_[_0x4fd0('0x30')](_0xbd6c23,_0x4fd0('0x29'));_0x10b84c[_0x4fd0('0x31')]=_[_0x4fd0('0x32')](_0x5a18fa[_0x4fd0('0x31')]);_0x10b84c[_0x4fd0('0x33')]=_['intersection'](_0x10b84c[_0x4fd0('0x2f')],_0x10b84c[_0x4fd0('0x31')]);_0x3ca0aa['attributes']=_[_0x4fd0('0x34')](_0x10b84c[_0x4fd0('0x2f')],qs[_0x4fd0('0x35')](_0x5a18fa[_0x4fd0('0x31')][_0x4fd0('0x35')]));_0x3ca0aa['attributes']=_0x3ca0aa['attributes'][_0x4fd0('0x36')]?_0x3ca0aa[_0x4fd0('0x37')]:_0x10b84c[_0x4fd0('0x2f')];if(!_0x5a18fa['query'][_0x4fd0('0x38')]('nolimit')){_0x3ca0aa[_0x4fd0('0x1e')]=qs[_0x4fd0('0x1e')](_0x5a18fa[_0x4fd0('0x31')][_0x4fd0('0x1e')]);_0x3ca0aa[_0x4fd0('0x1c')]=qs[_0x4fd0('0x1c')](_0x5a18fa[_0x4fd0('0x31')][_0x4fd0('0x1c')]);}_0x3ca0aa[_0x4fd0('0x39')]=qs[_0x4fd0('0x3a')](_0x5a18fa[_0x4fd0('0x31')]['sort']);_0x3ca0aa['where']=qs[_0x4fd0('0x33')](_[_0x4fd0('0x3b')](_0x5a18fa['query'],_0x10b84c['filters']),_0xbd6c23);if(_0x5a18fa[_0x4fd0('0x31')][_0x4fd0('0x3c')]){_0x3ca0aa['where']=_[_0x4fd0('0x3d')](_0x3ca0aa[_0x4fd0('0x3e')],{'$or':_[_0x4fd0('0x30')](_0xbd6c23,function(_0xff174e){if(_0xff174e[_0x4fd0('0x2e')]!==_0x4fd0('0x3f')){var _0x3d169c={};_0x3d169c[_0xff174e['name']]={'$like':'%'+_0x5a18fa[_0x4fd0('0x31')]['filter']+'%'};return _0x3d169c;}})});}_0x3ca0aa=_[_0x4fd0('0x3d')]({},_0x3ca0aa,_0x5a18fa[_0x4fd0('0x40')]);var _0x38526c={'where':_0x3ca0aa[_0x4fd0('0x3e')]};return db[_0x4fd0('0x2b')]['count'](_0x38526c)[_0x4fd0('0x24')](function(_0x6f0b3f){_0x2fcaf6[_0x4fd0('0x1f')]=_0x6f0b3f;if(_0x5a18fa[_0x4fd0('0x31')][_0x4fd0('0x41')]){_0x3ca0aa[_0x4fd0('0x42')]=[{'all':!![]}];}return db[_0x4fd0('0x2b')][_0x4fd0('0x43')](_0x3ca0aa);})[_0x4fd0('0x24')](function(_0x5ac79e){_0x2fcaf6['rows']=_0x5ac79e;return _0x2fcaf6;})['then'](respondWithFilteredResult(_0x2609e8,_0x3ca0aa))['catch'](handleError(_0x2609e8,null));};exports[_0x4fd0('0x44')]=function(_0x82ffcb,_0x5948ea){var _0x1650af={'raw':![],'where':{'id':_0x82ffcb[_0x4fd0('0x45')]['id']}},_0x2aed96={};_0x2aed96[_0x4fd0('0x2f')]=_[_0x4fd0('0x32')](db[_0x4fd0('0x2b')]['rawAttributes']);_0x2aed96[_0x4fd0('0x31')]=_['keys'](_0x82ffcb[_0x4fd0('0x31')]);_0x2aed96[_0x4fd0('0x33')]=_['intersection'](_0x2aed96[_0x4fd0('0x2f')],_0x2aed96[_0x4fd0('0x31')]);_0x1650af['attributes']=_[_0x4fd0('0x34')](_0x2aed96[_0x4fd0('0x2f')],qs['fields'](_0x82ffcb[_0x4fd0('0x31')][_0x4fd0('0x35')]));_0x1650af[_0x4fd0('0x37')]=_0x1650af[_0x4fd0('0x37')][_0x4fd0('0x36')]?_0x1650af[_0x4fd0('0x37')]:_0x2aed96[_0x4fd0('0x2f')];if(_0x82ffcb['query']['includeAll']){_0x1650af[_0x4fd0('0x42')]=[{'all':!![]}];}_0x1650af=_[_0x4fd0('0x3d')]({},_0x1650af,_0x82ffcb[_0x4fd0('0x40')]);return db['SalesforceConfiguration']['find'](_0x1650af)[_0x4fd0('0x24')](handleEntityNotFound(_0x5948ea,null))[_0x4fd0('0x24')](respondWithResult(_0x5948ea,null))[_0x4fd0('0x46')](handleError(_0x5948ea,null));};exports[_0x4fd0('0x47')]=function(_0x4d6475,_0x4c24a9){return db[_0x4fd0('0x2b')][_0x4fd0('0x47')](_0x4d6475['body'],{})[_0x4fd0('0x24')](respondWithResult(_0x4c24a9,0xc9))[_0x4fd0('0x46')](handleError(_0x4c24a9,null));};exports[_0x4fd0('0x23')]=function(_0x40569a,_0x6451fb){if(_0x40569a['body']['id']){delete _0x40569a[_0x4fd0('0x48')]['id'];}return db[_0x4fd0('0x2b')][_0x4fd0('0x49')]({'where':{'id':_0x40569a[_0x4fd0('0x45')]['id']}})[_0x4fd0('0x24')](handleEntityNotFound(_0x6451fb,null))[_0x4fd0('0x24')](saveUpdates(_0x40569a[_0x4fd0('0x48')],null))[_0x4fd0('0x24')](respondWithResult(_0x6451fb,null))['catch'](handleError(_0x6451fb,null));};exports['destroy']=function(_0x4b9c18,_0x5e1a84){return db[_0x4fd0('0x2b')][_0x4fd0('0x49')]({'where':{'id':_0x4b9c18['params']['id']}})[_0x4fd0('0x24')](handleEntityNotFound(_0x5e1a84,null))[_0x4fd0('0x24')](removeEntity(_0x5e1a84,null))['catch'](handleError(_0x5e1a84,null));};exports[_0x4fd0('0x4a')]=function(_0x575d40,_0x501a7f,_0x1c5288){var _0x3cc8ec={};var _0x5e912e={};var _0x5befd4;var _0x40701d;return db[_0x4fd0('0x2b')][_0x4fd0('0x4b')]({'where':{'id':_0x575d40['params']['id']}})[_0x4fd0('0x24')](handleEntityNotFound(_0x501a7f,null))[_0x4fd0('0x24')](function(_0x31fff6){if(_0x31fff6){_0x5befd4=_0x31fff6;_0x5e912e[_0x4fd0('0x2f')]=_[_0x4fd0('0x32')](db[_0x4fd0('0x4c')][_0x4fd0('0x2c')]);_0x5e912e[_0x4fd0('0x31')]=_[_0x4fd0('0x32')](_0x575d40['query']);_0x5e912e[_0x4fd0('0x33')]=_[_0x4fd0('0x34')](_0x5e912e[_0x4fd0('0x2f')],_0x5e912e['query']);_0x3cc8ec[_0x4fd0('0x37')]=_['intersection'](_0x5e912e[_0x4fd0('0x2f')],qs[_0x4fd0('0x35')](_0x575d40['query']['fields']));_0x3cc8ec['attributes']=_0x3cc8ec['attributes']['length']?_0x3cc8ec[_0x4fd0('0x37')]:_0x5e912e[_0x4fd0('0x2f')];_0x3cc8ec['order']=qs[_0x4fd0('0x3a')](_0x575d40[_0x4fd0('0x31')][_0x4fd0('0x3a')]);_0x3cc8ec['where']=qs[_0x4fd0('0x33')](_['pick'](_0x575d40[_0x4fd0('0x31')],_0x5e912e[_0x4fd0('0x33')]));if(_0x575d40['query']['filter']){_0x3cc8ec[_0x4fd0('0x3e')]=_[_0x4fd0('0x3d')](_0x3cc8ec[_0x4fd0('0x3e')],{'$or':_[_0x4fd0('0x30')](_0x3cc8ec[_0x4fd0('0x37')],function(_0x13aa92){var _0x1e2794={};_0x1e2794[_0x13aa92]={'$like':'%'+_0x575d40['query'][_0x4fd0('0x3c')]+'%'};return _0x1e2794;})});}_0x3cc8ec=_[_0x4fd0('0x3d')]({},_0x3cc8ec,_0x575d40[_0x4fd0('0x40')]);return _0x5befd4['getFields'](_0x3cc8ec);}})['then'](function(_0x30461d){if(_0x30461d){_0x40701d=_0x30461d[_0x4fd0('0x36')];if(!_0x575d40[_0x4fd0('0x31')][_0x4fd0('0x38')](_0x4fd0('0x4d'))){_0x3cc8ec[_0x4fd0('0x1e')]=qs['limit'](_0x575d40[_0x4fd0('0x31')][_0x4fd0('0x1e')]);_0x3cc8ec[_0x4fd0('0x1c')]=qs[_0x4fd0('0x1c')](_0x575d40[_0x4fd0('0x31')][_0x4fd0('0x1c')]);}return _0x5befd4['getFields'](_0x3cc8ec);}})[_0x4fd0('0x24')](function(_0x4f7f8b){if(_0x4f7f8b){return _0x4f7f8b?{'count':_0x40701d,'rows':_0x4f7f8b}:null;}})[_0x4fd0('0x24')](respondWithResult(_0x501a7f,null))[_0x4fd0('0x46')](handleError(_0x501a7f,null));};exports[_0x4fd0('0x4e')]=function(_0x51887c,_0x31b14d,_0x22ed4e){var _0x3d923d={};var _0x494fc5={};var _0x39851b;var _0x307fb9;return db['SalesforceConfiguration'][_0x4fd0('0x4b')]({'where':{'id':_0x51887c[_0x4fd0('0x45')]['id']}})[_0x4fd0('0x24')](handleEntityNotFound(_0x31b14d,null))[_0x4fd0('0x24')](function(_0x4350c5){if(_0x4350c5){_0x39851b=_0x4350c5;_0x494fc5['model']=_[_0x4fd0('0x32')](db[_0x4fd0('0x4c')][_0x4fd0('0x2c')]);_0x494fc5[_0x4fd0('0x31')]=_[_0x4fd0('0x32')](_0x51887c[_0x4fd0('0x31')]);_0x494fc5[_0x4fd0('0x33')]=_['intersection'](_0x494fc5['model'],_0x494fc5[_0x4fd0('0x31')]);_0x3d923d[_0x4fd0('0x37')]=_[_0x4fd0('0x34')](_0x494fc5['model'],qs[_0x4fd0('0x35')](_0x51887c[_0x4fd0('0x31')][_0x4fd0('0x35')]));_0x3d923d['attributes']=_0x3d923d['attributes'][_0x4fd0('0x36')]?_0x3d923d[_0x4fd0('0x37')]:_0x494fc5[_0x4fd0('0x2f')];_0x3d923d['order']=qs[_0x4fd0('0x3a')](_0x51887c['query'][_0x4fd0('0x3a')]);_0x3d923d[_0x4fd0('0x3e')]=qs[_0x4fd0('0x33')](_[_0x4fd0('0x3b')](_0x51887c['query'],_0x494fc5[_0x4fd0('0x33')]));if(_0x51887c[_0x4fd0('0x31')][_0x4fd0('0x3c')]){_0x3d923d[_0x4fd0('0x3e')]=_[_0x4fd0('0x3d')](_0x3d923d[_0x4fd0('0x3e')],{'$or':_[_0x4fd0('0x30')](_0x3d923d[_0x4fd0('0x37')],function(_0x4760c6){var _0x1fdcf9={};_0x1fdcf9[_0x4760c6]={'$like':'%'+_0x51887c['query'][_0x4fd0('0x3c')]+'%'};return _0x1fdcf9;})});}_0x3d923d=_[_0x4fd0('0x3d')]({},_0x3d923d,_0x51887c[_0x4fd0('0x40')]);return _0x39851b['getSubjects'](_0x3d923d);}})[_0x4fd0('0x24')](function(_0x372858){if(_0x372858){_0x307fb9=_0x372858[_0x4fd0('0x36')];if(!_0x51887c[_0x4fd0('0x31')][_0x4fd0('0x38')](_0x4fd0('0x4d'))){_0x3d923d[_0x4fd0('0x1e')]=qs[_0x4fd0('0x1e')](_0x51887c['query']['limit']);_0x3d923d[_0x4fd0('0x1c')]=qs[_0x4fd0('0x1c')](_0x51887c[_0x4fd0('0x31')][_0x4fd0('0x1c')]);}return _0x39851b[_0x4fd0('0x4e')](_0x3d923d);}})[_0x4fd0('0x24')](function(_0x469d33){if(_0x469d33){return _0x469d33?{'count':_0x307fb9,'rows':_0x469d33}:null;}})[_0x4fd0('0x24')](respondWithResult(_0x31b14d,null))[_0x4fd0('0x46')](handleError(_0x31b14d,null));};exports[_0x4fd0('0x4f')]=function(_0x4dfb22,_0x321605,_0x232a89){var _0x3cda4c={};var _0x47b2ff={};var _0x59840b;var _0x15fc6b;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x4dfb22[_0x4fd0('0x45')]['id']}})[_0x4fd0('0x24')](handleEntityNotFound(_0x321605,null))[_0x4fd0('0x24')](function(_0x184fcb){if(_0x184fcb){_0x59840b=_0x184fcb;_0x47b2ff[_0x4fd0('0x2f')]=_[_0x4fd0('0x32')](db[_0x4fd0('0x4c')][_0x4fd0('0x2c')]);_0x47b2ff[_0x4fd0('0x31')]=_[_0x4fd0('0x32')](_0x4dfb22['query']);_0x47b2ff[_0x4fd0('0x33')]=_['intersection'](_0x47b2ff['model'],_0x47b2ff['query']);_0x3cda4c[_0x4fd0('0x37')]=_['intersection'](_0x47b2ff['model'],qs[_0x4fd0('0x35')](_0x4dfb22[_0x4fd0('0x31')][_0x4fd0('0x35')]));_0x3cda4c['attributes']=_0x3cda4c[_0x4fd0('0x37')][_0x4fd0('0x36')]?_0x3cda4c[_0x4fd0('0x37')]:_0x47b2ff[_0x4fd0('0x2f')];_0x3cda4c[_0x4fd0('0x39')]=qs[_0x4fd0('0x3a')](_0x4dfb22[_0x4fd0('0x31')][_0x4fd0('0x3a')]);_0x3cda4c['where']=qs['filters'](_[_0x4fd0('0x3b')](_0x4dfb22[_0x4fd0('0x31')],_0x47b2ff[_0x4fd0('0x33')]));if(_0x4dfb22['query'][_0x4fd0('0x3c')]){_0x3cda4c[_0x4fd0('0x3e')]=_[_0x4fd0('0x3d')](_0x3cda4c[_0x4fd0('0x3e')],{'$or':_[_0x4fd0('0x30')](_0x3cda4c['attributes'],function(_0x2a52ca){var _0x3d3b38={};_0x3d3b38[_0x2a52ca]={'$like':'%'+_0x4dfb22['query'][_0x4fd0('0x3c')]+'%'};return _0x3d3b38;})});}_0x3cda4c=_[_0x4fd0('0x3d')]({},_0x3cda4c,_0x4dfb22[_0x4fd0('0x40')]);return _0x59840b[_0x4fd0('0x4f')](_0x3cda4c);}})[_0x4fd0('0x24')](function(_0x1bef64){if(_0x1bef64){_0x15fc6b=_0x1bef64['length'];if(!_0x4dfb22[_0x4fd0('0x31')][_0x4fd0('0x38')](_0x4fd0('0x4d'))){_0x3cda4c[_0x4fd0('0x1e')]=qs['limit'](_0x4dfb22['query'][_0x4fd0('0x1e')]);_0x3cda4c[_0x4fd0('0x1c')]=qs[_0x4fd0('0x1c')](_0x4dfb22[_0x4fd0('0x31')][_0x4fd0('0x1c')]);}return _0x59840b[_0x4fd0('0x4f')](_0x3cda4c);}})[_0x4fd0('0x24')](function(_0x3793e7){if(_0x3793e7){return _0x3793e7?{'count':_0x15fc6b,'rows':_0x3793e7}:null;}})['then'](respondWithResult(_0x321605,null))[_0x4fd0('0x46')](handleError(_0x321605,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index da91360..394c90c 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 _0x20b9=['define','SalesforceConfiguration','int_salesforce_configurations','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x20b9,0x1b1));var _0x920b=function(_0x4b3f08,_0x4b3c7a){_0x4b3f08=_0x4b3f08-0x0;var _0x5a45e5=_0x20b9[_0x4b3f08];return _0x5a45e5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x920b('0x0'))('api');var moment=require(_0x920b('0x1'));var BPromise=require(_0x920b('0x2'));var rp=require(_0x920b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x920b('0x4'));var config=require(_0x920b('0x5'));var attributes=require(_0x920b('0x6'));module['exports']=function(_0x9d48,_0x24937f){return _0x9d48[_0x920b('0x7')](_0x920b('0x8'),attributes,{'tableName':_0x920b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf849=['request-promise','./intSalesforceConfiguration.attributes','int_salesforce_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2b3f7c,_0x5d22c2){var _0x564309=function(_0xe4cf06){while(--_0xe4cf06){_0x2b3f7c['push'](_0x2b3f7c['shift']());}};_0x564309(++_0x5d22c2);}(_0xf849,0x193));var _0x9f84=function(_0x3ae8f4,_0x2920f4){_0x3ae8f4=_0x3ae8f4-0x0;var _0x367312=_0xf849[_0x3ae8f4];return _0x367312;};'use strict';var _=require(_0x9f84('0x0'));var util=require(_0x9f84('0x1'));var logger=require(_0x9f84('0x2'))('api');var moment=require(_0x9f84('0x3'));var BPromise=require(_0x9f84('0x4'));var rp=require(_0x9f84('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9f84('0x6'));module['exports']=function(_0x4ce658,_0x1c0717){return _0x4ce658['define']('SalesforceConfiguration',attributes,{'tableName':_0x9f84('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index da139f7..9dffec1 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 _0x6eae=['info','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0xfb9a5a,_0x5abc6e){var _0x30da2a=function(_0x4d23d9){while(--_0x4d23d9){_0xfb9a5a['push'](_0xfb9a5a['shift']());}};_0x30da2a(++_0x5abc6e);}(_0x6eae,0xf0));var _0xe6ea=function(_0x29489f,_0x3bbee2){_0x29489f=_0x29489f-0x0;var _0x19154f=_0x6eae[_0x29489f];return _0x19154f;};'use strict';var _=require(_0xe6ea('0x0'));var util=require(_0xe6ea('0x1'));var moment=require(_0xe6ea('0x2'));var BPromise=require(_0xe6ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe6ea('0x4'))['db'];var utils=require(_0xe6ea('0x5'));var logger=require(_0xe6ea('0x6'))(_0xe6ea('0x7'));var config=require(_0xe6ea('0x8'));var jayson=require(_0xe6ea('0x9'));var client=jayson['client'][_0xe6ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fe0ba,_0x18f0bf,_0x2f85ae){return new BPromise(function(_0x40aeff,_0x34f682){return client[_0xe6ea('0xb')](_0x1fe0ba,_0x2f85ae)['then'](function(_0x2d62f6){logger[_0xe6ea('0xc')](_0xe6ea('0xd'),_0x18f0bf,'request\x20sent');logger['debug'](_0xe6ea('0xe'),_0x18f0bf,_0xe6ea('0xf'),JSON[_0xe6ea('0x10')](_0x2d62f6));if(_0x2d62f6['error']){if(_0x2d62f6[_0xe6ea('0x11')][_0xe6ea('0x12')]===0x1f4){logger[_0xe6ea('0x11')](_0xe6ea('0xd'),_0x18f0bf,_0x2d62f6['error'][_0xe6ea('0x13')]);return _0x34f682(_0x2d62f6[_0xe6ea('0x11')]['message']);}logger[_0xe6ea('0x11')](_0xe6ea('0xd'),_0x18f0bf,_0x2d62f6[_0xe6ea('0x11')][_0xe6ea('0x13')]);return _0x40aeff(_0x2d62f6[_0xe6ea('0x11')][_0xe6ea('0x13')]);}else{logger[_0xe6ea('0xc')](_0xe6ea('0xd'),_0x18f0bf,_0xe6ea('0xf'));_0x40aeff(_0x2d62f6[_0xe6ea('0x14')]['message']);}})['catch'](function(_0x31feb5){logger[_0xe6ea('0x11')](_0xe6ea('0xd'),_0x18f0bf,_0x31feb5);_0x34f682(_0x31feb5);});});} \ No newline at end of file +var _0xa9e7=['SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x9c2a62,_0x2d7f18){var _0x82feb9=function(_0x1d1357){while(--_0x1d1357){_0x9c2a62['push'](_0x9c2a62['shift']());}};_0x82feb9(++_0x2d7f18);}(_0xa9e7,0xaa));var _0x7a9e=function(_0x5950e7,_0x43a5bb){_0x5950e7=_0x5950e7-0x0;var _0x47494d=_0xa9e7[_0x5950e7];return _0x47494d;};'use strict';var _=require('lodash');var util=require(_0x7a9e('0x0'));var moment=require(_0x7a9e('0x1'));var BPromise=require(_0x7a9e('0x2'));var rs=require(_0x7a9e('0x3'));var fs=require('fs');var Redis=require(_0x7a9e('0x4'));var db=require(_0x7a9e('0x5'))['db'];var utils=require(_0x7a9e('0x6'));var logger=require(_0x7a9e('0x7'))(_0x7a9e('0x8'));var config=require(_0x7a9e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7a9e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x398b1b,_0x3e0b56,_0x333b2e){return new BPromise(function(_0x4156a3,_0x51bb44){return client[_0x7a9e('0xb')](_0x398b1b,_0x333b2e)[_0x7a9e('0xc')](function(_0x100d41){logger[_0x7a9e('0xd')](_0x7a9e('0xe'),_0x3e0b56,_0x7a9e('0xf'));logger['debug'](_0x7a9e('0x10'),_0x3e0b56,_0x7a9e('0xf'),JSON[_0x7a9e('0x11')](_0x100d41));if(_0x100d41[_0x7a9e('0x12')]){if(_0x100d41[_0x7a9e('0x12')][_0x7a9e('0x13')]===0x1f4){logger[_0x7a9e('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3e0b56,_0x100d41[_0x7a9e('0x12')]['message']);return _0x51bb44(_0x100d41[_0x7a9e('0x12')]['message']);}logger[_0x7a9e('0x12')](_0x7a9e('0xe'),_0x3e0b56,_0x100d41[_0x7a9e('0x12')][_0x7a9e('0x14')]);return _0x4156a3(_0x100d41['error'][_0x7a9e('0x14')]);}else{logger[_0x7a9e('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3e0b56,'request\x20sent');_0x4156a3(_0x100d41[_0x7a9e('0x15')][_0x7a9e('0x14')]);}})[_0x7a9e('0x16')](function(_0x32253f){logger[_0x7a9e('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3e0b56,_0x32253f);_0x51bb44(_0x32253f);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 3d378da..1df2e7c 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 _0x5177=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','create','put','delete','exports'];(function(_0x1c5bca,_0x4a9a25){var _0x4e0c40=function(_0x3afa19){while(--_0x3afa19){_0x1c5bca['push'](_0x1c5bca['shift']());}};_0x4e0c40(++_0x4a9a25);}(_0x5177,0x180));var _0x7517=function(_0x33fe93,_0x40d9c8){_0x33fe93=_0x33fe93-0x0;var _0x3f4e95=_0x5177[_0x33fe93];return _0x3f4e95;};'use strict';var multer=require(_0x7517('0x0'));var util=require(_0x7517('0x1'));var path=require(_0x7517('0x2'));var timeout=require('connect-timeout');var express=require(_0x7517('0x3'));var router=express[_0x7517('0x4')]();var fs_extra=require(_0x7517('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7517('0x6'));var config=require(_0x7517('0x7'));var controller=require('./intSalesforceField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7517('0x8')](_0x7517('0x9'),auth[_0x7517('0xa')](),controller[_0x7517('0xb')]);router['post']('/',auth[_0x7517('0xa')](),controller[_0x7517('0xc')]);router[_0x7517('0xd')](_0x7517('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x7517('0xe')](_0x7517('0x9'),auth[_0x7517('0xa')](),controller['destroy']);module[_0x7517('0xf')]=router; \ No newline at end of file +var _0x5fe0=['../../components/interaction/service','./intSalesforceField.controller','isAuthenticated','get','show','post','create','put','/:id','update','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5fe0,0x94));var _0x05fe=function(_0x4c01da,_0x1a1585){_0x4c01da=_0x4c01da-0x0;var _0x3c7586=_0x5fe0[_0x4c01da];return _0x3c7586;};'use strict';var multer=require('multer');var util=require(_0x05fe('0x0'));var path=require('path');var timeout=require(_0x05fe('0x1'));var express=require('express');var router=express[_0x05fe('0x2')]();var fs_extra=require(_0x05fe('0x3'));var auth=require(_0x05fe('0x4'));var interaction=require(_0x05fe('0x5'));var config=require('../../config/environment');var controller=require(_0x05fe('0x6'));router['get']('/',auth[_0x05fe('0x7')](),controller['index']);router[_0x05fe('0x8')]('/:id',auth[_0x05fe('0x7')](),controller[_0x05fe('0x9')]);router[_0x05fe('0xa')]('/',auth[_0x05fe('0x7')](),controller[_0x05fe('0xb')]);router[_0x05fe('0xc')](_0x05fe('0xd'),auth['isAuthenticated'](),controller[_0x05fe('0xe')]);router[_0x05fe('0xf')]('/:id',auth[_0x05fe('0x7')](),controller[_0x05fe('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index b7d7683..b489884 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 _0x3b4e=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0xd806c1,_0x11fb2d){var _0x49c7c8=function(_0x5b8f80){while(--_0x5b8f80){_0xd806c1['push'](_0xd806c1['shift']());}};_0x49c7c8(++_0x11fb2d);}(_0x3b4e,0x180));var _0xe3b4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3b4e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xe3b4('0x0'));module[_0xe3b4('0x1')]={'type':{'type':Sequelize[_0xe3b4('0x2')](_0xe3b4('0x3'),_0xe3b4('0x4'),_0xe3b4('0x5'),_0xe3b4('0x6'),'picklist'),'defaultValue':_0xe3b4('0x3')},'content':{'type':Sequelize[_0xe3b4('0x7')]},'key':{'type':Sequelize[_0xe3b4('0x7')]},'keyType':{'type':Sequelize[_0xe3b4('0x2')](_0xe3b4('0x3'),_0xe3b4('0x4'),_0xe3b4('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe3b4('0x7')]},'variableName':{'type':Sequelize[_0xe3b4('0x7')]}}; \ No newline at end of file +var _0xbbfd=['keyValue','picklist','STRING','sequelize','exports','string','variable','customVariable'];(function(_0x2ebd68,_0x10e9cc){var _0x2e68d5=function(_0x57b080){while(--_0x57b080){_0x2ebd68['push'](_0x2ebd68['shift']());}};_0x2e68d5(++_0x10e9cc);}(_0xbbfd,0x93));var _0xdbbf=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xbbfd[_0x2112d4];return _0x434972;};'use strict';var Sequelize=require(_0xdbbf('0x0'));module[_0xdbbf('0x1')]={'type':{'type':Sequelize['ENUM'](_0xdbbf('0x2'),_0xdbbf('0x3'),_0xdbbf('0x4'),_0xdbbf('0x5'),_0xdbbf('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xdbbf('0x7')]},'key':{'type':Sequelize[_0xdbbf('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xdbbf('0x2'),_0xdbbf('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xdbbf('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 7fa353f..d18797d 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 _0x6aa1=['to-csv','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','end','offset','limit','undefined','count','status','Content-Range','json','reject','save','update','destroy','sendStatus','error','stack','name','send','index','map','SalesforceField','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','keys','find','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x3b3f4f,_0x403216){var _0x174dbe=function(_0x30e333){while(--_0x30e333){_0x3b3f4f['push'](_0x3b3f4f['shift']());}};_0x174dbe(++_0x403216);}(_0x6aa1,0x12e));var _0x16aa=function(_0x21d07d,_0x58591c){_0x21d07d=_0x21d07d-0x0;var _0x2e918b=_0x6aa1[_0x21d07d];return _0x2e918b;};'use strict';var emlformat=require(_0x16aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x16aa('0x1'));var jsonpatch=require(_0x16aa('0x2'));var rp=require(_0x16aa('0x3'));var moment=require(_0x16aa('0x4'));var BPromise=require(_0x16aa('0x5'));var Mustache=require(_0x16aa('0x6'));var util=require(_0x16aa('0x7'));var path=require(_0x16aa('0x8'));var sox=require(_0x16aa('0x9'));var csv=require(_0x16aa('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x16aa('0xb'));var squel=require(_0x16aa('0xc'));var crypto=require(_0x16aa('0xd'));var jsforce=require(_0x16aa('0xe'));var deskjs=require(_0x16aa('0xf'));var toCsv=require(_0x16aa('0xa'));var querystring=require(_0x16aa('0x10'));var Papa=require(_0x16aa('0x11'));var Redis=require(_0x16aa('0x12'));var authService=require(_0x16aa('0x13'));var qs=require(_0x16aa('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x16aa('0x15'));var logger=require(_0x16aa('0x16'))(_0x16aa('0x17'));var utils=require(_0x16aa('0x18'));var config=require(_0x16aa('0x19'));var licenseUtil=require(_0x16aa('0x1a'));var db=require(_0x16aa('0x1b'))['db'];function respondWithStatusCode(_0x305f6c,_0xd74b33){_0xd74b33=_0xd74b33||0xcc;return function(_0x4baffd){if(_0x4baffd){return _0x305f6c['sendStatus'](_0xd74b33);}return _0x305f6c['status'](_0xd74b33)[_0x16aa('0x1c')]();};}function respondWithResult(_0x30c0e9,_0x37efb6){_0x37efb6=_0x37efb6||0xc8;return function(_0x23f7ad){if(_0x23f7ad){return _0x30c0e9['status'](_0x37efb6)['json'](_0x23f7ad);}};}function respondWithFilteredResult(_0xe32885,_0x9aca52){return function(_0x1062fa){if(_0x1062fa){var _0x254b38=typeof _0x9aca52[_0x16aa('0x1d')]==='undefined'&&typeof _0x9aca52[_0x16aa('0x1e')]===_0x16aa('0x1f');var _0x24dad3=_0x1062fa[_0x16aa('0x20')];var _0x73a787=_0x254b38?0x0:_0x9aca52['offset'];var _0xda233d=_0x254b38?_0x1062fa[_0x16aa('0x20')]:_0x9aca52[_0x16aa('0x1d')]+_0x9aca52['limit'];var _0x554135;if(_0xda233d>=_0x24dad3){_0xda233d=_0x24dad3;_0x554135=0xc8;}else{_0x554135=0xce;}_0xe32885[_0x16aa('0x21')](_0x554135);return _0xe32885['set'](_0x16aa('0x22'),_0x73a787+'-'+_0xda233d+'/'+_0x24dad3)[_0x16aa('0x23')](_0x1062fa);}return null;};}function patchUpdates(_0x58b4cc){return function(_0x21e44c){try{jsonpatch['apply'](_0x21e44c,_0x58b4cc,!![]);}catch(_0x8c3bb1){return BPromise[_0x16aa('0x24')](_0x8c3bb1);}return _0x21e44c[_0x16aa('0x25')]();};}function saveUpdates(_0x468afd,_0x56515a){return function(_0x41c7a4){if(_0x41c7a4){return _0x41c7a4[_0x16aa('0x26')](_0x468afd)['then'](function(_0x10b720){return _0x10b720;});}return null;};}function removeEntity(_0x5c668c,_0x45c679){return function(_0x330ad9){if(_0x330ad9){return _0x330ad9[_0x16aa('0x27')]()['then'](function(){_0x5c668c[_0x16aa('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x200c9b,_0x4ddf55){return function(_0xecd2f){if(!_0xecd2f){_0x200c9b[_0x16aa('0x28')](0x194);}return _0xecd2f;};}function handleError(_0x79ddbd,_0x362745){_0x362745=_0x362745||0x1f4;return function(_0x11850c){logger[_0x16aa('0x29')](_0x11850c[_0x16aa('0x2a')]);if(_0x11850c['name']){delete _0x11850c[_0x16aa('0x2b')];}_0x79ddbd[_0x16aa('0x21')](_0x362745)[_0x16aa('0x2c')](_0x11850c);};}exports[_0x16aa('0x2d')]=function(_0x144574,_0xb92863){var _0x1de7fc={},_0xfcc9ff={},_0x505b20={'count':0x0,'rows':[]};var _0x1ead25=_[_0x16aa('0x2e')](db[_0x16aa('0x2f')]['rawAttributes'],function(_0x4be45f){return{'name':_0x4be45f[_0x16aa('0x30')],'type':_0x4be45f['type'][_0x16aa('0x31')]};});_0xfcc9ff[_0x16aa('0x32')]=_[_0x16aa('0x2e')](_0x1ead25,'name');_0xfcc9ff['query']=_['keys'](_0x144574[_0x16aa('0x33')]);_0xfcc9ff['filters']=_['intersection'](_0xfcc9ff[_0x16aa('0x32')],_0xfcc9ff[_0x16aa('0x33')]);_0x1de7fc[_0x16aa('0x34')]=_[_0x16aa('0x35')](_0xfcc9ff['model'],qs[_0x16aa('0x36')](_0x144574[_0x16aa('0x33')]['fields']));_0x1de7fc[_0x16aa('0x34')]=_0x1de7fc[_0x16aa('0x34')][_0x16aa('0x37')]?_0x1de7fc['attributes']:_0xfcc9ff[_0x16aa('0x32')];if(!_0x144574[_0x16aa('0x33')][_0x16aa('0x38')]('nolimit')){_0x1de7fc['limit']=qs[_0x16aa('0x1e')](_0x144574[_0x16aa('0x33')][_0x16aa('0x1e')]);_0x1de7fc['offset']=qs['offset'](_0x144574['query'][_0x16aa('0x1d')]);}_0x1de7fc[_0x16aa('0x39')]=qs[_0x16aa('0x3a')](_0x144574[_0x16aa('0x33')]['sort']);_0x1de7fc[_0x16aa('0x3b')]=qs['filters'](_[_0x16aa('0x3c')](_0x144574[_0x16aa('0x33')],_0xfcc9ff[_0x16aa('0x3d')]),_0x1ead25);if(_0x144574[_0x16aa('0x33')][_0x16aa('0x3e')]){_0x1de7fc[_0x16aa('0x3b')]=_[_0x16aa('0x3f')](_0x1de7fc['where'],{'$or':_['map'](_0x1ead25,function(_0x870661){if(_0x870661[_0x16aa('0x40')]!==_0x16aa('0x41')){var _0x382c5b={};_0x382c5b[_0x870661[_0x16aa('0x2b')]]={'$like':'%'+_0x144574[_0x16aa('0x33')][_0x16aa('0x3e')]+'%'};return _0x382c5b;}})});}_0x1de7fc=_[_0x16aa('0x3f')]({},_0x1de7fc,_0x144574[_0x16aa('0x42')]);var _0x29e27f={'where':_0x1de7fc[_0x16aa('0x3b')]};return db[_0x16aa('0x2f')][_0x16aa('0x20')](_0x29e27f)[_0x16aa('0x43')](function(_0x446f4e){_0x505b20[_0x16aa('0x20')]=_0x446f4e;if(_0x144574['query'][_0x16aa('0x44')]){_0x1de7fc[_0x16aa('0x45')]=[{'all':!![]}];}return db[_0x16aa('0x2f')][_0x16aa('0x46')](_0x1de7fc);})[_0x16aa('0x43')](function(_0x24167c){_0x505b20[_0x16aa('0x47')]=_0x24167c;return _0x505b20;})[_0x16aa('0x43')](respondWithFilteredResult(_0xb92863,_0x1de7fc))[_0x16aa('0x48')](handleError(_0xb92863,null));};exports[_0x16aa('0x49')]=function(_0x4bb89b,_0x28fb88){var _0x3f7144={'raw':!![],'where':{'id':_0x4bb89b[_0x16aa('0x4a')]['id']}},_0x375e2e={};_0x375e2e['model']=_['keys'](db[_0x16aa('0x2f')]['rawAttributes']);_0x375e2e['query']=_[_0x16aa('0x4b')](_0x4bb89b[_0x16aa('0x33')]);_0x375e2e[_0x16aa('0x3d')]=_['intersection'](_0x375e2e[_0x16aa('0x32')],_0x375e2e[_0x16aa('0x33')]);_0x3f7144['attributes']=_['intersection'](_0x375e2e['model'],qs['fields'](_0x4bb89b[_0x16aa('0x33')]['fields']));_0x3f7144['attributes']=_0x3f7144[_0x16aa('0x34')][_0x16aa('0x37')]?_0x3f7144[_0x16aa('0x34')]:_0x375e2e[_0x16aa('0x32')];if(_0x4bb89b['query'][_0x16aa('0x44')]){_0x3f7144[_0x16aa('0x45')]=[{'all':!![]}];}_0x3f7144=_[_0x16aa('0x3f')]({},_0x3f7144,_0x4bb89b['options']);return db['SalesforceField'][_0x16aa('0x4c')](_0x3f7144)['then'](handleEntityNotFound(_0x28fb88,null))[_0x16aa('0x43')](respondWithResult(_0x28fb88,null))[_0x16aa('0x48')](handleError(_0x28fb88,null));};exports['create']=function(_0x39d45b,_0x3508dd){return db[_0x16aa('0x2f')]['create'](_0x39d45b['body'],{})[_0x16aa('0x43')](respondWithResult(_0x3508dd,0xc9))['catch'](handleError(_0x3508dd,null));};exports[_0x16aa('0x26')]=function(_0x14f0ca,_0x2eebe9){if(_0x14f0ca['body']['id']){delete _0x14f0ca[_0x16aa('0x4d')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x14f0ca['params']['id']}})[_0x16aa('0x43')](handleEntityNotFound(_0x2eebe9,null))[_0x16aa('0x43')](saveUpdates(_0x14f0ca['body'],null))['then'](respondWithResult(_0x2eebe9,null))[_0x16aa('0x48')](handleError(_0x2eebe9,null));};exports[_0x16aa('0x27')]=function(_0x46ae7a,_0x3755df){return db['SalesforceField'][_0x16aa('0x4c')]({'where':{'id':_0x46ae7a[_0x16aa('0x4a')]['id']}})[_0x16aa('0x43')](handleEntityNotFound(_0x3755df,null))[_0x16aa('0x43')](removeEntity(_0x3755df,null))['catch'](handleError(_0x3755df,null));}; \ No newline at end of file +var _0xca02=['fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','update','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','map','SalesforceField','rawAttributes','fieldName','key','model','query','filters','intersection'];(function(_0x4fa489,_0x4cba6b){var _0x41d2ce=function(_0x364060){while(--_0x364060){_0x4fa489['push'](_0x4fa489['shift']());}};_0x41d2ce(++_0x4cba6b);}(_0xca02,0x14d));var _0x2ca0=function(_0xe7f4fe,_0x44953e){_0xe7f4fe=_0xe7f4fe-0x0;var _0x1e4364=_0xca02[_0xe7f4fe];return _0x1e4364;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ca0('0x0'));var zipdir=require(_0x2ca0('0x1'));var jsonpatch=require(_0x2ca0('0x2'));var rp=require(_0x2ca0('0x3'));var moment=require(_0x2ca0('0x4'));var BPromise=require(_0x2ca0('0x5'));var Mustache=require(_0x2ca0('0x6'));var util=require(_0x2ca0('0x7'));var path=require(_0x2ca0('0x8'));var sox=require(_0x2ca0('0x9'));var csv=require(_0x2ca0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ca0('0xb'));var squel=require(_0x2ca0('0xc'));var crypto=require(_0x2ca0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2ca0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2ca0('0xf'));var Papa=require('papaparse');var Redis=require(_0x2ca0('0x10'));var authService=require(_0x2ca0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2ca0('0x12'));var hardwareService=require(_0x2ca0('0x13'));var logger=require('../../config/logger')(_0x2ca0('0x14'));var utils=require(_0x2ca0('0x15'));var config=require(_0x2ca0('0x16'));var licenseUtil=require(_0x2ca0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38b9aa,_0x1ab0c3){_0x1ab0c3=_0x1ab0c3||0xcc;return function(_0x147d97){if(_0x147d97){return _0x38b9aa[_0x2ca0('0x18')](_0x1ab0c3);}return _0x38b9aa[_0x2ca0('0x19')](_0x1ab0c3)[_0x2ca0('0x1a')]();};}function respondWithResult(_0x33a32e,_0xdc7bfa){_0xdc7bfa=_0xdc7bfa||0xc8;return function(_0x4a4248){if(_0x4a4248){return _0x33a32e[_0x2ca0('0x19')](_0xdc7bfa)[_0x2ca0('0x1b')](_0x4a4248);}};}function respondWithFilteredResult(_0x1460c9,_0x53138a){return function(_0x288a3f){if(_0x288a3f){var _0x20452c=typeof _0x53138a[_0x2ca0('0x1c')]===_0x2ca0('0x1d')&&typeof _0x53138a[_0x2ca0('0x1e')]===_0x2ca0('0x1d');var _0x4607d1=_0x288a3f[_0x2ca0('0x1f')];var _0x4e2d7b=_0x20452c?0x0:_0x53138a[_0x2ca0('0x1c')];var _0x555253=_0x20452c?_0x288a3f['count']:_0x53138a['offset']+_0x53138a[_0x2ca0('0x1e')];var _0x31a8a1;if(_0x555253>=_0x4607d1){_0x555253=_0x4607d1;_0x31a8a1=0xc8;}else{_0x31a8a1=0xce;}_0x1460c9[_0x2ca0('0x19')](_0x31a8a1);return _0x1460c9[_0x2ca0('0x20')](_0x2ca0('0x21'),_0x4e2d7b+'-'+_0x555253+'/'+_0x4607d1)[_0x2ca0('0x1b')](_0x288a3f);}return null;};}function patchUpdates(_0x116464){return function(_0x2ed748){try{jsonpatch[_0x2ca0('0x22')](_0x2ed748,_0x116464,!![]);}catch(_0x3e0486){return BPromise[_0x2ca0('0x23')](_0x3e0486);}return _0x2ed748[_0x2ca0('0x24')]();};}function saveUpdates(_0x361ce4,_0x52a5f1){return function(_0x1270ab){if(_0x1270ab){return _0x1270ab['update'](_0x361ce4)['then'](function(_0x24d7db){return _0x24d7db;});}return null;};}function removeEntity(_0x3e24ab,_0x312665){return function(_0x382398){if(_0x382398){return _0x382398[_0x2ca0('0x25')]()[_0x2ca0('0x26')](function(){_0x3e24ab[_0x2ca0('0x19')](0xcc)[_0x2ca0('0x1a')]();});}};}function handleEntityNotFound(_0x513605,_0x305178){return function(_0x1c1472){if(!_0x1c1472){_0x513605[_0x2ca0('0x18')](0x194);}return _0x1c1472;};}function handleError(_0x40fbd6,_0x679df2){_0x679df2=_0x679df2||0x1f4;return function(_0x1d2e68){logger[_0x2ca0('0x27')](_0x1d2e68[_0x2ca0('0x28')]);if(_0x1d2e68[_0x2ca0('0x29')]){delete _0x1d2e68[_0x2ca0('0x29')];}_0x40fbd6['status'](_0x679df2)['send'](_0x1d2e68);};}exports[_0x2ca0('0x2a')]=function(_0x30924e,_0x390b11){var _0x3f2f85={},_0x397dbf={},_0x365742={'count':0x0,'rows':[]};var _0x2d9492=_[_0x2ca0('0x2b')](db[_0x2ca0('0x2c')][_0x2ca0('0x2d')],function(_0x57df50){return{'name':_0x57df50[_0x2ca0('0x2e')],'type':_0x57df50['type'][_0x2ca0('0x2f')]};});_0x397dbf[_0x2ca0('0x30')]=_[_0x2ca0('0x2b')](_0x2d9492,_0x2ca0('0x29'));_0x397dbf[_0x2ca0('0x31')]=_['keys'](_0x30924e[_0x2ca0('0x31')]);_0x397dbf[_0x2ca0('0x32')]=_[_0x2ca0('0x33')](_0x397dbf[_0x2ca0('0x30')],_0x397dbf['query']);_0x3f2f85['attributes']=_['intersection'](_0x397dbf[_0x2ca0('0x30')],qs[_0x2ca0('0x34')](_0x30924e['query'][_0x2ca0('0x34')]));_0x3f2f85[_0x2ca0('0x35')]=_0x3f2f85['attributes']['length']?_0x3f2f85['attributes']:_0x397dbf['model'];if(!_0x30924e[_0x2ca0('0x31')][_0x2ca0('0x36')](_0x2ca0('0x37'))){_0x3f2f85[_0x2ca0('0x1e')]=qs[_0x2ca0('0x1e')](_0x30924e['query'][_0x2ca0('0x1e')]);_0x3f2f85[_0x2ca0('0x1c')]=qs[_0x2ca0('0x1c')](_0x30924e['query'][_0x2ca0('0x1c')]);}_0x3f2f85[_0x2ca0('0x38')]=qs[_0x2ca0('0x39')](_0x30924e[_0x2ca0('0x31')][_0x2ca0('0x39')]);_0x3f2f85[_0x2ca0('0x3a')]=qs[_0x2ca0('0x32')](_[_0x2ca0('0x3b')](_0x30924e['query'],_0x397dbf[_0x2ca0('0x32')]),_0x2d9492);if(_0x30924e[_0x2ca0('0x31')][_0x2ca0('0x3c')]){_0x3f2f85[_0x2ca0('0x3a')]=_['merge'](_0x3f2f85[_0x2ca0('0x3a')],{'$or':_[_0x2ca0('0x2b')](_0x2d9492,function(_0x23f275){if(_0x23f275[_0x2ca0('0x3d')]!==_0x2ca0('0x3e')){var _0x3582d0={};_0x3582d0[_0x23f275[_0x2ca0('0x29')]]={'$like':'%'+_0x30924e[_0x2ca0('0x31')][_0x2ca0('0x3c')]+'%'};return _0x3582d0;}})});}_0x3f2f85=_[_0x2ca0('0x3f')]({},_0x3f2f85,_0x30924e[_0x2ca0('0x40')]);var _0x4df409={'where':_0x3f2f85[_0x2ca0('0x3a')]};return db['SalesforceField']['count'](_0x4df409)[_0x2ca0('0x26')](function(_0x4808f3){_0x365742[_0x2ca0('0x1f')]=_0x4808f3;if(_0x30924e[_0x2ca0('0x31')][_0x2ca0('0x41')]){_0x3f2f85[_0x2ca0('0x42')]=[{'all':!![]}];}return db[_0x2ca0('0x2c')][_0x2ca0('0x43')](_0x3f2f85);})['then'](function(_0x7eb62c){_0x365742[_0x2ca0('0x44')]=_0x7eb62c;return _0x365742;})[_0x2ca0('0x26')](respondWithFilteredResult(_0x390b11,_0x3f2f85))[_0x2ca0('0x45')](handleError(_0x390b11,null));};exports['show']=function(_0x1be768,_0x1cb53c){var _0xc13de5={'raw':!![],'where':{'id':_0x1be768[_0x2ca0('0x46')]['id']}},_0x3151e8={};_0x3151e8[_0x2ca0('0x30')]=_[_0x2ca0('0x47')](db[_0x2ca0('0x2c')][_0x2ca0('0x2d')]);_0x3151e8[_0x2ca0('0x31')]=_[_0x2ca0('0x47')](_0x1be768['query']);_0x3151e8['filters']=_[_0x2ca0('0x33')](_0x3151e8[_0x2ca0('0x30')],_0x3151e8['query']);_0xc13de5[_0x2ca0('0x35')]=_[_0x2ca0('0x33')](_0x3151e8[_0x2ca0('0x30')],qs[_0x2ca0('0x34')](_0x1be768[_0x2ca0('0x31')][_0x2ca0('0x34')]));_0xc13de5[_0x2ca0('0x35')]=_0xc13de5['attributes'][_0x2ca0('0x48')]?_0xc13de5[_0x2ca0('0x35')]:_0x3151e8[_0x2ca0('0x30')];if(_0x1be768[_0x2ca0('0x31')][_0x2ca0('0x41')]){_0xc13de5['include']=[{'all':!![]}];}_0xc13de5=_[_0x2ca0('0x3f')]({},_0xc13de5,_0x1be768[_0x2ca0('0x40')]);return db[_0x2ca0('0x2c')][_0x2ca0('0x49')](_0xc13de5)[_0x2ca0('0x26')](handleEntityNotFound(_0x1cb53c,null))[_0x2ca0('0x26')](respondWithResult(_0x1cb53c,null))[_0x2ca0('0x45')](handleError(_0x1cb53c,null));};exports['create']=function(_0xbc6875,_0x88129f){return db['SalesforceField'][_0x2ca0('0x4a')](_0xbc6875['body'],{})[_0x2ca0('0x26')](respondWithResult(_0x88129f,0xc9))[_0x2ca0('0x45')](handleError(_0x88129f,null));};exports[_0x2ca0('0x4b')]=function(_0x1b4f58,_0xe7e31b){if(_0x1b4f58[_0x2ca0('0x4c')]['id']){delete _0x1b4f58[_0x2ca0('0x4c')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x1b4f58[_0x2ca0('0x46')]['id']}})[_0x2ca0('0x26')](handleEntityNotFound(_0xe7e31b,null))['then'](saveUpdates(_0x1b4f58[_0x2ca0('0x4c')],null))[_0x2ca0('0x26')](respondWithResult(_0xe7e31b,null))[_0x2ca0('0x45')](handleError(_0xe7e31b,null));};exports['destroy']=function(_0x2c0731,_0x1ba46e){return db[_0x2ca0('0x2c')]['find']({'where':{'id':_0x2c0731['params']['id']}})[_0x2ca0('0x26')](handleEntityNotFound(_0x1ba46e,null))[_0x2ca0('0x26')](removeEntity(_0x1ba46e,null))[_0x2ca0('0x45')](handleError(_0x1ba46e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index fe707f4..30302c2 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 _0x1941=['path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','../../config/logger','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1941,0x1ad));var _0x1194=function(_0x1a18d2,_0x4c34f7){_0x1a18d2=_0x1a18d2-0x0;var _0x1f8b12=_0x1941[_0x1a18d2];return _0x1f8b12;};'use strict';var _=require(_0x1194('0x0'));var util=require(_0x1194('0x1'));var logger=require(_0x1194('0x2'))('api');var moment=require(_0x1194('0x3'));var BPromise=require('bluebird');var rp=require(_0x1194('0x4'));var fs=require('fs');var path=require(_0x1194('0x5'));var rimraf=require(_0x1194('0x6'));var config=require(_0x1194('0x7'));var attributes=require(_0x1194('0x8'));module[_0x1194('0x9')]=function(_0x4fdc96,_0x4d9e59){return _0x4fdc96['define'](_0x1194('0xa'),attributes,{'tableName':_0x1194('0xb'),'paranoid':![],'indexes':[{'name':_0x1194('0xc'),'fields':['idField',_0x1194('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x953f=['../../config/logger','moment','path','rimraf','./intSalesforceField.attributes','exports','SalesforceField','salesforce_unique_index','lodash','util'];(function(_0x53e9c0,_0x2e9102){var _0x539b09=function(_0x27ec99){while(--_0x27ec99){_0x53e9c0['push'](_0x53e9c0['shift']());}};_0x539b09(++_0x2e9102);}(_0x953f,0x76));var _0xf953=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x953f[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xf953('0x0'));var util=require(_0xf953('0x1'));var logger=require(_0xf953('0x2'))('api');var moment=require(_0xf953('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf953('0x4'));var rimraf=require(_0xf953('0x5'));var config=require('../../config/environment');var attributes=require(_0xf953('0x6'));module[_0xf953('0x7')]=function(_0xb685c6,_0x52998c){return _0xb685c6['define'](_0xf953('0x8'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xf953('0x9'),'fields':['idField','FieldId'],'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 d60caad..0cf22ac 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 _0x3a31=['error','code','SalesforceField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5177a0,_0x5474ee){var _0x59b9b3=function(_0x2cb5c8){while(--_0x2cb5c8){_0x5177a0['push'](_0x5177a0['shift']());}};_0x59b9b3(++_0x5474ee);}(_0x3a31,0xb4));var _0x13a3=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3a31[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x13a3('0x0'));var util=require(_0x13a3('0x1'));var moment=require(_0x13a3('0x2'));var BPromise=require(_0x13a3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13a3('0x4'));var db=require(_0x13a3('0x5'))['db'];var utils=require(_0x13a3('0x6'));var logger=require(_0x13a3('0x7'))(_0x13a3('0x8'));var config=require(_0x13a3('0x9'));var jayson=require(_0x13a3('0xa'));var client=jayson[_0x13a3('0xb')][_0x13a3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b1e4e,_0x4c893a,_0x1d3f09){return new BPromise(function(_0x3f80e6,_0x54b4c0){return client[_0x13a3('0xd')](_0x2b1e4e,_0x1d3f09)[_0x13a3('0xe')](function(_0x555c75){logger[_0x13a3('0xf')]('SalesforceField,\x20%s,\x20%s',_0x4c893a,_0x13a3('0x10'));logger[_0x13a3('0x11')](_0x13a3('0x12'),_0x4c893a,_0x13a3('0x10'),JSON[_0x13a3('0x13')](_0x555c75));if(_0x555c75['error']){if(_0x555c75[_0x13a3('0x14')][_0x13a3('0x15')]===0x1f4){logger[_0x13a3('0x14')](_0x13a3('0x16'),_0x4c893a,_0x555c75[_0x13a3('0x14')]['message']);return _0x54b4c0(_0x555c75[_0x13a3('0x14')][_0x13a3('0x17')]);}logger[_0x13a3('0x14')](_0x13a3('0x16'),_0x4c893a,_0x555c75[_0x13a3('0x14')][_0x13a3('0x17')]);return _0x3f80e6(_0x555c75['error'][_0x13a3('0x17')]);}else{logger[_0x13a3('0xf')](_0x13a3('0x16'),_0x4c893a,_0x13a3('0x10'));_0x3f80e6(_0x555c75['result'][_0x13a3('0x17')]);}})[_0x13a3('0x18')](function(_0x4caa43){logger[_0x13a3('0x14')](_0x13a3('0x16'),_0x4c893a,_0x4caa43);_0x54b4c0(_0x4caa43);});});} \ No newline at end of file +var _0xd422=['result','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x1ec127,_0xb74c7e){var _0x36b6bd=function(_0x4b1e28){while(--_0x4b1e28){_0x1ec127['push'](_0x1ec127['shift']());}};_0x36b6bd(++_0xb74c7e);}(_0xd422,0x1e7));var _0x2d42=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xd422[_0x1cb18a];return _0x22442e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2d42('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d42('0x1'));var db=require(_0x2d42('0x2'))['db'];var utils=require(_0x2d42('0x3'));var logger=require(_0x2d42('0x4'))('rpc');var config=require(_0x2d42('0x5'));var jayson=require(_0x2d42('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x438208,_0xee4045,_0x3d1e4e){return new BPromise(function(_0x5e26dc,_0x476ffb){return client[_0x2d42('0x7')](_0x438208,_0x3d1e4e)[_0x2d42('0x8')](function(_0x16da92){logger['info'](_0x2d42('0x9'),_0xee4045,_0x2d42('0xa'));logger[_0x2d42('0xb')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0xee4045,_0x2d42('0xa'),JSON[_0x2d42('0xc')](_0x16da92));if(_0x16da92['error']){if(_0x16da92[_0x2d42('0xd')][_0x2d42('0xe')]===0x1f4){logger['error'](_0x2d42('0x9'),_0xee4045,_0x16da92[_0x2d42('0xd')]['message']);return _0x476ffb(_0x16da92[_0x2d42('0xd')][_0x2d42('0xf')]);}logger[_0x2d42('0xd')](_0x2d42('0x9'),_0xee4045,_0x16da92['error'][_0x2d42('0xf')]);return _0x5e26dc(_0x16da92['error'][_0x2d42('0xf')]);}else{logger[_0x2d42('0x10')](_0x2d42('0x9'),_0xee4045,_0x2d42('0xa'));_0x5e26dc(_0x16da92[_0x2d42('0x11')][_0x2d42('0xf')]);}})['catch'](function(_0xd1ea8e){logger['error']('SalesforceField,\x20%s,\x20%s',_0xee4045,_0xd1ea8e);_0x476ffb(_0xd1ea8e);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 4de7609..eb77476 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 _0x2b81=['index','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x370fab,_0x238e11){var _0x254fd3=function(_0x6783f5){while(--_0x6783f5){_0x370fab['push'](_0x370fab['shift']());}};_0x254fd3(++_0x238e11);}(_0x2b81,0x1ef));var _0x12b8=function(_0x3342cc,_0x41e015){_0x3342cc=_0x3342cc-0x0;var _0x3d0d3a=_0x2b81[_0x3342cc];return _0x3d0d3a;};'use strict';var multer=require(_0x12b8('0x0'));var util=require(_0x12b8('0x1'));var path=require(_0x12b8('0x2'));var timeout=require(_0x12b8('0x3'));var express=require(_0x12b8('0x4'));var router=express[_0x12b8('0x5')]();var fs_extra=require(_0x12b8('0x6'));var auth=require(_0x12b8('0x7'));var interaction=require(_0x12b8('0x8'));var config=require(_0x12b8('0x9'));var controller=require('./intServicenowAccount.controller');router[_0x12b8('0xa')]('/',auth['isAuthenticated'](),controller[_0x12b8('0xb')]);router[_0x12b8('0xa')](_0x12b8('0xc'),auth[_0x12b8('0xd')](),controller['show']);router[_0x12b8('0xa')](_0x12b8('0xe'),auth[_0x12b8('0xd')](),controller[_0x12b8('0xf')]);router[_0x12b8('0xa')](_0x12b8('0x10'),auth[_0x12b8('0xd')](),controller[_0x12b8('0x11')]);router['post']('/',auth[_0x12b8('0xd')](),controller['create']);router['post'](_0x12b8('0xe'),auth[_0x12b8('0xd')](),controller[_0x12b8('0x12')]);router['put'](_0x12b8('0xc'),auth[_0x12b8('0xd')](),controller[_0x12b8('0x13')]);router[_0x12b8('0x14')](_0x12b8('0xc'),auth[_0x12b8('0xd')](),controller[_0x12b8('0x15')]);module['exports']=router; \ No newline at end of file +var _0x6944=['index','/:id','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated'];(function(_0x152ca2,_0x5abd1b){var _0x58fbd2=function(_0x128b08){while(--_0x128b08){_0x152ca2['push'](_0x152ca2['shift']());}};_0x58fbd2(++_0x5abd1b);}(_0x6944,0xe6));var _0x4694=function(_0x169909,_0x1b06ec){_0x169909=_0x169909-0x0;var _0x28470e=_0x6944[_0x169909];return _0x28470e;};'use strict';var multer=require(_0x4694('0x0'));var util=require(_0x4694('0x1'));var path=require(_0x4694('0x2'));var timeout=require(_0x4694('0x3'));var express=require(_0x4694('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4694('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4694('0x6'));var controller=require(_0x4694('0x7'));router[_0x4694('0x8')]('/',auth[_0x4694('0x9')](),controller[_0x4694('0xa')]);router[_0x4694('0x8')](_0x4694('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4694('0x8')](_0x4694('0xc'),auth[_0x4694('0x9')](),controller['getConfigurations']);router[_0x4694('0x8')](_0x4694('0xd'),auth[_0x4694('0x9')](),controller[_0x4694('0xe')]);router['post']('/',auth[_0x4694('0x9')](),controller[_0x4694('0xf')]);router[_0x4694('0x10')](_0x4694('0xc'),auth['isAuthenticated'](),controller[_0x4694('0x11')]);router['put'](_0x4694('0xb'),auth['isAuthenticated'](),controller[_0x4694('0x12')]);router['delete'](_0x4694('0xb'),auth[_0x4694('0x9')](),controller['destroy']);module[_0x4694('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index b6f33d9..ec1c43e 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 _0x5409=['exports','STRING','remoteUri'];(function(_0xcee09,_0x201495){var _0x3d0b6d=function(_0x15aef6){while(--_0x15aef6){_0xcee09['push'](_0xcee09['shift']());}};_0x3d0b6d(++_0x201495);}(_0x5409,0x1c5));var _0x9540=function(_0x3a5036,_0x54d8e4){_0x3a5036=_0x3a5036-0x0;var _0x59735a=_0x5409[_0x3a5036];return _0x59735a;};'use strict';var Sequelize=require('sequelize');module[_0x9540('0x0')]={'name':{'type':Sequelize[_0x9540('0x1')]},'description':{'type':Sequelize[_0x9540('0x1')]},'username':{'type':Sequelize[_0x9540('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x9540('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9540('0x1')],'unique':_0x9540('0x2')},'serverUrl':{'type':Sequelize[_0x9540('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xdfd2=['username','sequelize','exports','STRING'];(function(_0x3b76a2,_0x2d37b3){var _0x327e21=function(_0x5d57d1){while(--_0x5d57d1){_0x3b76a2['push'](_0x3b76a2['shift']());}};_0x327e21(++_0x2d37b3);}(_0xdfd2,0x125));var _0x2dfd=function(_0x114294,_0x5435b0){_0x114294=_0x114294-0x0;var _0x25cf4f=_0xdfd2[_0x114294];return _0x25cf4f;};'use strict';var Sequelize=require(_0x2dfd('0x0'));module[_0x2dfd('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2dfd('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x2dfd('0x3')},'password':{'type':Sequelize[_0x2dfd('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2dfd('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x2dfd('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 412d46d..b719e76 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 _0x41ec=['result','log','assign','remove','includes','forEach','internalType','ServiceNow\x20error:\x20','stack','Wrong\x20credentials','statusCode','boolean','True','true','False','GET','sys_choice?sysparm_query=name=incident^element=','inactive','false','label','value','push','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','error','send','index','map','rawAttributes','fieldName','type','model','name','query','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','options','then','includeAll','ServicenowAccount','findAll','rows','catch','show','keys','include','merge','find','create','body','params','getConfigurations','findOne','order','pick','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','ServicenowConfiguration','ServicenowField','getFields','hold_reason','knowledge','close_code','notify','incident_state','category','parent','made_sla','watch_list','upon_reject','child_incidents','approval_history','number','opened_by','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','reassignment_count','assigned_to','severity','comments','comments_and_work_notes','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','serverUrl','remoteUri','format','password','incident?sysparm_display_value=all'];(function(_0x110f1c,_0x295f3c){var _0x5a6b63=function(_0x25ca11){while(--_0x25ca11){_0x110f1c['push'](_0x110f1c['shift']());}};_0x5a6b63(++_0x295f3c);}(_0x41ec,0x17c));var _0xc41e=function(_0x234aba,_0x1bb527){_0x234aba=_0x234aba-0x0;var _0x3bf4f8=_0x41ec[_0x234aba];return _0x3bf4f8;};'use strict';var emlformat=require(_0xc41e('0x0'));var rimraf=require(_0xc41e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc41e('0x2'));var rp=require(_0xc41e('0x3'));var moment=require(_0xc41e('0x4'));var BPromise=require(_0xc41e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc41e('0x6'));var sox=require(_0xc41e('0x7'));var csv=require(_0xc41e('0x8'));var ejs=require(_0xc41e('0x9'));var fs=require('fs');var fs_extra=require(_0xc41e('0xa'));var _=require('lodash');var squel=require(_0xc41e('0xb'));var crypto=require(_0xc41e('0xc'));var jsforce=require(_0xc41e('0xd'));var deskjs=require(_0xc41e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc41e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc41e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc41e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc41e('0x12'))(_0xc41e('0x13'));var utils=require(_0xc41e('0x14'));var config=require(_0xc41e('0x15'));var licenseUtil=require(_0xc41e('0x16'));var db=require(_0xc41e('0x17'))['db'];var integrations=require(_0xc41e('0x18'));function respondWithStatusCode(_0x2fb25e,_0x27dcc4){_0x27dcc4=_0x27dcc4||0xcc;return function(_0x4a2d9e){if(_0x4a2d9e){return _0x2fb25e[_0xc41e('0x19')](_0x27dcc4);}return _0x2fb25e[_0xc41e('0x1a')](_0x27dcc4)[_0xc41e('0x1b')]();};}function respondWithResult(_0x429848,_0x288504){_0x288504=_0x288504||0xc8;return function(_0x10bb5d){if(_0x10bb5d){return _0x429848[_0xc41e('0x1a')](_0x288504)[_0xc41e('0x1c')](_0x10bb5d);}};}function respondWithFilteredResult(_0xe19df1,_0x41cf6f){return function(_0x1634ca){if(_0x1634ca){var _0x35ea8d=typeof _0x41cf6f[_0xc41e('0x1d')]===_0xc41e('0x1e')&&typeof _0x41cf6f['limit']===_0xc41e('0x1e');var _0x1b56c1=_0x1634ca[_0xc41e('0x1f')];var _0x4ae0f0=_0x35ea8d?0x0:_0x41cf6f[_0xc41e('0x1d')];var _0x4682eb=_0x35ea8d?_0x1634ca[_0xc41e('0x1f')]:_0x41cf6f[_0xc41e('0x1d')]+_0x41cf6f[_0xc41e('0x20')];var _0x24219c;if(_0x4682eb>=_0x1b56c1){_0x4682eb=_0x1b56c1;_0x24219c=0xc8;}else{_0x24219c=0xce;}_0xe19df1['status'](_0x24219c);return _0xe19df1['set'](_0xc41e('0x21'),_0x4ae0f0+'-'+_0x4682eb+'/'+_0x1b56c1)[_0xc41e('0x1c')](_0x1634ca);}return null;};}function patchUpdates(_0x305a76){return function(_0x4eb5a0){try{jsonpatch[_0xc41e('0x22')](_0x4eb5a0,_0x305a76,!![]);}catch(_0x4cf320){return BPromise[_0xc41e('0x23')](_0x4cf320);}return _0x4eb5a0[_0xc41e('0x24')]();};}function saveUpdates(_0x447cb8,_0x2ba2aa){return function(_0x23f6e8){if(_0x23f6e8){return _0x23f6e8[_0xc41e('0x25')](_0x447cb8)['then'](function(_0x1e2a0b){return _0x1e2a0b;});}return null;};}function removeEntity(_0x14fc67,_0x4e48e0){return function(_0x4c31cf){if(_0x4c31cf){return _0x4c31cf[_0xc41e('0x26')]()['then'](function(){_0x14fc67[_0xc41e('0x1a')](0xcc)[_0xc41e('0x1b')]();});}};}function handleEntityNotFound(_0x54a10b,_0x295aa5){return function(_0xe282de){if(!_0xe282de){_0x54a10b[_0xc41e('0x19')](0x194);}return _0xe282de;};}function handleError(_0xb6ea7f,_0x45ca91){_0x45ca91=_0x45ca91||0x1f4;return function(_0x4369cb){logger[_0xc41e('0x27')](_0x4369cb['stack']);if(_0x4369cb['name']){delete _0x4369cb['name'];}_0xb6ea7f[_0xc41e('0x1a')](_0x45ca91)[_0xc41e('0x28')](_0x4369cb);};}exports[_0xc41e('0x29')]=function(_0x5256a1,_0x4dc78e){var _0x2f819d={},_0x28cddb={},_0x18a71c={'count':0x0,'rows':[]};var _0x2b4cde=_[_0xc41e('0x2a')](db['ServicenowAccount'][_0xc41e('0x2b')],function(_0x1b75ff){return{'name':_0x1b75ff[_0xc41e('0x2c')],'type':_0x1b75ff[_0xc41e('0x2d')]['key']};});_0x28cddb[_0xc41e('0x2e')]=_[_0xc41e('0x2a')](_0x2b4cde,_0xc41e('0x2f'));_0x28cddb[_0xc41e('0x30')]=_['keys'](_0x5256a1[_0xc41e('0x30')]);_0x28cddb[_0xc41e('0x31')]=_[_0xc41e('0x32')](_0x28cddb[_0xc41e('0x2e')],_0x28cddb['query']);_0x2f819d['attributes']=_['intersection'](_0x28cddb[_0xc41e('0x2e')],qs[_0xc41e('0x33')](_0x5256a1[_0xc41e('0x30')][_0xc41e('0x33')]));_0x2f819d['attributes']=_0x2f819d[_0xc41e('0x34')][_0xc41e('0x35')]?_0x2f819d['attributes']:_0x28cddb[_0xc41e('0x2e')];if(!_0x5256a1['query']['hasOwnProperty'](_0xc41e('0x36'))){_0x2f819d[_0xc41e('0x20')]=qs[_0xc41e('0x20')](_0x5256a1['query'][_0xc41e('0x20')]);_0x2f819d[_0xc41e('0x1d')]=qs[_0xc41e('0x1d')](_0x5256a1[_0xc41e('0x30')][_0xc41e('0x1d')]);}_0x2f819d['order']=qs[_0xc41e('0x37')](_0x5256a1[_0xc41e('0x30')][_0xc41e('0x37')]);_0x2f819d[_0xc41e('0x38')]=qs[_0xc41e('0x31')](_['pick'](_0x5256a1[_0xc41e('0x30')],_0x28cddb[_0xc41e('0x31')]),_0x2b4cde);if(_0x5256a1[_0xc41e('0x30')][_0xc41e('0x39')]){_0x2f819d[_0xc41e('0x38')]=_['merge'](_0x2f819d[_0xc41e('0x38')],{'$or':_[_0xc41e('0x2a')](_0x2b4cde,function(_0x7b4a0f){if(_0x7b4a0f['type']!=='VIRTUAL'){var _0x334cdf={};_0x334cdf[_0x7b4a0f['name']]={'$like':'%'+_0x5256a1[_0xc41e('0x30')][_0xc41e('0x39')]+'%'};return _0x334cdf;}})});}_0x2f819d=_['merge']({},_0x2f819d,_0x5256a1[_0xc41e('0x3a')]);var _0x227d1b={'where':_0x2f819d[_0xc41e('0x38')]};return db['ServicenowAccount']['count'](_0x227d1b)[_0xc41e('0x3b')](function(_0x481470){_0x18a71c[_0xc41e('0x1f')]=_0x481470;if(_0x5256a1[_0xc41e('0x30')][_0xc41e('0x3c')]){_0x2f819d['include']=[{'all':!![]}];}return db[_0xc41e('0x3d')][_0xc41e('0x3e')](_0x2f819d);})[_0xc41e('0x3b')](function(_0x49fbc8){_0x18a71c[_0xc41e('0x3f')]=_0x49fbc8;return _0x18a71c;})[_0xc41e('0x3b')](respondWithFilteredResult(_0x4dc78e,_0x2f819d))[_0xc41e('0x40')](handleError(_0x4dc78e,null));};exports[_0xc41e('0x41')]=function(_0x333f3a,_0xb696f9){var _0x544463={'raw':![],'where':{'id':_0x333f3a['params']['id']}},_0xf7035d={};_0xf7035d['model']=_['keys'](db[_0xc41e('0x3d')]['rawAttributes']);_0xf7035d['query']=_[_0xc41e('0x42')](_0x333f3a['query']);_0xf7035d[_0xc41e('0x31')]=_[_0xc41e('0x32')](_0xf7035d[_0xc41e('0x2e')],_0xf7035d[_0xc41e('0x30')]);_0x544463[_0xc41e('0x34')]=_[_0xc41e('0x32')](_0xf7035d['model'],qs['fields'](_0x333f3a[_0xc41e('0x30')][_0xc41e('0x33')]));_0x544463[_0xc41e('0x34')]=_0x544463[_0xc41e('0x34')][_0xc41e('0x35')]?_0x544463[_0xc41e('0x34')]:_0xf7035d[_0xc41e('0x2e')];if(_0x333f3a['query'][_0xc41e('0x3c')]){_0x544463[_0xc41e('0x43')]=[{'all':!![]}];}_0x544463=_[_0xc41e('0x44')]({},_0x544463,_0x333f3a[_0xc41e('0x3a')]);return db['ServicenowAccount'][_0xc41e('0x45')](_0x544463)[_0xc41e('0x3b')](handleEntityNotFound(_0xb696f9,null))['then'](respondWithResult(_0xb696f9,null))[_0xc41e('0x40')](handleError(_0xb696f9,null));};exports[_0xc41e('0x46')]=function(_0x371f92,_0x2437c3){return db['ServicenowAccount'][_0xc41e('0x46')](_0x371f92[_0xc41e('0x47')],{})[_0xc41e('0x3b')](respondWithResult(_0x2437c3,0xc9))['catch'](handleError(_0x2437c3,null));};exports[_0xc41e('0x25')]=function(_0x286e08,_0x4c5226){if(_0x286e08[_0xc41e('0x47')]['id']){delete _0x286e08['body']['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x286e08[_0xc41e('0x48')]['id']}})[_0xc41e('0x3b')](handleEntityNotFound(_0x4c5226,null))[_0xc41e('0x3b')](saveUpdates(_0x286e08[_0xc41e('0x47')],null))['then'](respondWithResult(_0x4c5226,null))[_0xc41e('0x40')](handleError(_0x4c5226,null));};exports['destroy']=function(_0x238254,_0x54f0c4){return db[_0xc41e('0x3d')][_0xc41e('0x45')]({'where':{'id':_0x238254[_0xc41e('0x48')]['id']}})[_0xc41e('0x3b')](handleEntityNotFound(_0x54f0c4,null))[_0xc41e('0x3b')](removeEntity(_0x54f0c4,null))['catch'](handleError(_0x54f0c4,null));};exports[_0xc41e('0x49')]=function(_0x4871d8,_0x543e2c,_0x59af64){var _0x341abe={};var _0xbd5a24={};var _0x286d1d;var _0x5f05cc;return db[_0xc41e('0x3d')][_0xc41e('0x4a')]({'where':{'id':_0x4871d8[_0xc41e('0x48')]['id']}})[_0xc41e('0x3b')](handleEntityNotFound(_0x543e2c,null))[_0xc41e('0x3b')](function(_0x538d50){if(_0x538d50){_0x286d1d=_0x538d50;_0xbd5a24[_0xc41e('0x2e')]=_[_0xc41e('0x42')](db['ServicenowConfiguration'][_0xc41e('0x2b')]);_0xbd5a24[_0xc41e('0x30')]=_[_0xc41e('0x42')](_0x4871d8[_0xc41e('0x30')]);_0xbd5a24[_0xc41e('0x31')]=_[_0xc41e('0x32')](_0xbd5a24[_0xc41e('0x2e')],_0xbd5a24[_0xc41e('0x30')]);_0x341abe['attributes']=_[_0xc41e('0x32')](_0xbd5a24[_0xc41e('0x2e')],qs[_0xc41e('0x33')](_0x4871d8[_0xc41e('0x30')]['fields']));_0x341abe['attributes']=_0x341abe[_0xc41e('0x34')][_0xc41e('0x35')]?_0x341abe['attributes']:_0xbd5a24[_0xc41e('0x2e')];_0x341abe[_0xc41e('0x4b')]=qs['sort'](_0x4871d8[_0xc41e('0x30')][_0xc41e('0x37')]);_0x341abe[_0xc41e('0x38')]=qs[_0xc41e('0x31')](_[_0xc41e('0x4c')](_0x4871d8[_0xc41e('0x30')],_0xbd5a24['filters']));if(_0x4871d8[_0xc41e('0x30')][_0xc41e('0x39')]){_0x341abe[_0xc41e('0x38')]=_[_0xc41e('0x44')](_0x341abe['where'],{'$or':_[_0xc41e('0x2a')](_0x341abe['attributes'],function(_0x4bbac6){var _0x573f12={};_0x573f12[_0x4bbac6]={'$like':'%'+_0x4871d8[_0xc41e('0x30')]['filter']+'%'};return _0x573f12;})});}_0x341abe=_['merge']({},_0x341abe,_0x4871d8[_0xc41e('0x3a')]);return _0x286d1d[_0xc41e('0x49')](_0x341abe);}})[_0xc41e('0x3b')](function(_0x4f7fb4){if(_0x4f7fb4){_0x5f05cc=_0x4f7fb4[_0xc41e('0x35')];if(!_0x4871d8['query']['hasOwnProperty']('nolimit')){_0x341abe[_0xc41e('0x20')]=qs['limit'](_0x4871d8[_0xc41e('0x30')][_0xc41e('0x20')]);_0x341abe['offset']=qs[_0xc41e('0x1d')](_0x4871d8[_0xc41e('0x30')][_0xc41e('0x1d')]);}return _0x286d1d[_0xc41e('0x49')](_0x341abe);}})[_0xc41e('0x3b')](function(_0x3439ab){if(_0x3439ab){return _0x3439ab?{'count':_0x5f05cc,'rows':_0x3439ab}:null;}})[_0xc41e('0x3b')](respondWithResult(_0x543e2c,null))[_0xc41e('0x40')](handleError(_0x543e2c,null));};exports[_0xc41e('0x4d')]=function(_0x4a92a5,_0x3ea980,_0x486480){if(_0x4a92a5['body']['id']){delete _0x4a92a5[_0xc41e('0x47')]['id'];}return db[_0xc41e('0x3d')][_0xc41e('0x4a')]({'where':{'id':_0x4a92a5[_0xc41e('0x48')]['id']}})[_0xc41e('0x3b')](handleEntityNotFound(_0x3ea980,null))['then'](function(_0x46d25b){if(_0x46d25b){_0x4a92a5[_0xc41e('0x47')][_0xc41e('0x4e')]=_0x46d25b['id'];_0x4a92a5[_0xc41e('0x47')][_0xc41e('0x4f')]=integrations[_0xc41e('0x50')](_0x4a92a5[_0xc41e('0x47')]['channel'],_0x4a92a5[_0xc41e('0x47')]['type']);_0x4a92a5[_0xc41e('0x47')][_0xc41e('0x51')]=integrations['getDescriptions'](_0x4a92a5['body'][_0xc41e('0x52')],_0x4a92a5[_0xc41e('0x47')][_0xc41e('0x2d')]);return db[_0xc41e('0x53')]['create'](_0x4a92a5[_0xc41e('0x47')],{'include':[{'model':db[_0xc41e('0x54')],'as':_0xc41e('0x4f')},{'model':db[_0xc41e('0x54')],'as':'Descriptions'}]});}return null;})[_0xc41e('0x3b')](respondWithResult(_0x3ea980,null))[_0xc41e('0x40')](handleError(_0x3ea980,null));};exports[_0xc41e('0x55')]=function(_0x1f1d56,_0x20d5e0,_0x5e1faa){var _0x546c05=['made_sla',_0xc41e('0x56'),_0xc41e('0x57'),'subcategory',_0xc41e('0x58'),_0xc41e('0x59'),_0xc41e('0x5a'),'severity',_0xc41e('0x5b')];var _0x55ab0f=[_0xc41e('0x5c'),_0xc41e('0x5d'),'caused_by',_0xc41e('0x5e'),_0xc41e('0x5f'),'sys_updated_on',_0xc41e('0x60'),_0xc41e('0x56'),_0xc41e('0x61'),_0xc41e('0x62'),'resolved_by','sys_updated_by',_0xc41e('0x63'),'user_input',_0xc41e('0x64'),_0xc41e('0x65'),_0xc41e('0x66'),_0xc41e('0x67'),_0xc41e('0x57'),_0xc41e('0x4b'),_0xc41e('0x68'),'closed_at',_0xc41e('0x69'),_0xc41e('0x6a'),_0xc41e('0x6b'),_0xc41e('0x6c'),_0xc41e('0x6d'),_0xc41e('0x6e'),_0xc41e('0x6f'),_0xc41e('0x70'),_0xc41e('0x71'),_0xc41e('0x72'),_0xc41e('0x73'),'opened_at','business_duration',_0xc41e('0x74'),_0xc41e('0x75'),_0xc41e('0x76'),_0xc41e('0x77'),_0xc41e('0x78'),_0xc41e('0x79'),_0xc41e('0x7a'),_0xc41e('0x7b'),_0xc41e('0x7c'),_0xc41e('0x58'),_0xc41e('0x7d'),_0xc41e('0x7e'),_0xc41e('0x7f'),_0xc41e('0x80'),_0xc41e('0x81'),'additional_assignee_list',_0xc41e('0x82'),_0xc41e('0x83'),_0xc41e('0x59'),_0xc41e('0x84'),_0xc41e('0x85'),_0xc41e('0x86'),_0xc41e('0x87'),_0xc41e('0x88'),_0xc41e('0x89'),_0xc41e('0x8a'),_0xc41e('0x8b'),'incident_state',_0xc41e('0x8c'),_0xc41e('0x8d'),'company',_0xc41e('0x8e'),'activity_due',_0xc41e('0x8f'),_0xc41e('0x90'),_0xc41e('0x91'),'sla_due','approval',_0xc41e('0x92'),'due_date',_0xc41e('0x93'),_0xc41e('0x94'),'sys_tags',_0xc41e('0x95'),_0xc41e('0x96'),_0xc41e('0x97'),'location','category'];var _0x56e89a='';var _0x44fbb2='';var _0x29f3be=[];var _0x451ecb='';var _0x44e4e0='';var _0x404d29=[];var _0x330744='';var _0x2dd8c0='';var _0x214619={};var _0x37e1b3='';return db[_0xc41e('0x3d')][_0xc41e('0x4a')]({'where':{'id':_0x1f1d56['params']['id']},'attributes':['id','username','password','email','remoteUri',_0xc41e('0x98')]})['then'](handleEntityNotFound(_0x20d5e0,null))['then'](function(_0x165ce4){if(_0x165ce4){_0x37e1b3=_0x165ce4[_0xc41e('0x99')];var _0x4ae47d=_0x37e1b3['slice'](-0x1);if(_0x4ae47d==='/'){_0x37e1b3=_0x37e1b3['substring'](0x0,_0x37e1b3['lastIndexOf'](_0x4ae47d));}_0x2dd8c0=util[_0xc41e('0x9a')]('%s/api/now/doc/table/schema/',_0x37e1b3);_0x330744=util[_0xc41e('0x9a')]('%s/api/now/table/',_0x37e1b3);_0x214619={'user':_0x165ce4['username'],'pass':_0x165ce4[_0xc41e('0x9b')]};var _0x43d691={'method':'GET','uri':_0x2dd8c0+_0xc41e('0x9c'),'auth':_0x214619,'json':!![]};return rp(_0x43d691);}})[_0xc41e('0x3b')](function(_0x16ebe0){if(_0x16ebe0[_0xc41e('0x9d')]['length']>0x0){_0x56e89a=_0x16ebe0[_0xc41e('0x9d')];}console[_0xc41e('0x9e')]('incident\x20table\x20objects',_0x56e89a);_0x404d29=[];_0x44fbb2=Object[_0xc41e('0x9f')]([],_0x56e89a);_[_0xc41e('0xa0')](_0x44fbb2,function(_0xc52720){return!_0x546c05[_0xc41e('0xa1')](_0xc52720[_0xc41e('0x2f')]);});_0x44fbb2[_0xc41e('0xa2')](function(_0x2236d1){var _0x58255a=createFieldObject(_0x330744,_0x214619,_0x2236d1['internalType'],_0x2236d1[_0xc41e('0x2f')],_0x2236d1['label'],![]);_0x404d29['push'](_0x58255a);});return Promise['all'](_0x404d29);})[_0xc41e('0x3b')](function(_0x12e7f4){_0x29f3be=_0x12e7f4;_0x451ecb=Object[_0xc41e('0x9f')]([],_0x56e89a);console[_0xc41e('0x9e')]('TCL:\x20_object',_0x56e89a);_['remove'](_0x451ecb,function(_0x5da1f0){return _0x55ab0f[_0xc41e('0xa1')](_0x5da1f0[_0xc41e('0x2f')]);});console[_0xc41e('0x9e')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x451ecb);_0x404d29=[];_0x451ecb['forEach'](function(_0x55ff12){var _0xc5a18a=createFieldObject(_0x330744,_0x214619,_0x55ff12[_0xc41e('0xa3')],_0x55ff12[_0xc41e('0x2f')],_0x55ff12['label'],!![]);_0x404d29['push'](_0xc5a18a);});return Promise['all'](_0x404d29);})['then'](function(_0x4fc6df){_0x44e4e0=_0x4fc6df;var _0x8c02c1=_0x29f3be['concat'](_0x44e4e0);return{'count':_0x8c02c1['length'],'rows':_0x8c02c1};})[_0xc41e('0x3b')](respondWithResult(_0x20d5e0,null))[_0xc41e('0x40')](function(_0x3ab2d5){console[_0xc41e('0x9e')](_0xc41e('0xa4')+_0x3ab2d5);var _0x251aed=_0x1f1d56[_0xc41e('0x30')]['test']?0x1f4:_0x3ab2d5['statusCode']||0x1f4;logger[_0xc41e('0x27')](_0x3ab2d5[_0xc41e('0xa5')]);delete _0x3ab2d5['name'];if(_0x251aed===0x191){_0x251aed=0x190;}_0x20d5e0[_0xc41e('0x1a')](_0x251aed)[_0xc41e('0x28')](_0x1f1d56['query']['test']?{'message':_0xc41e('0xa6'),'statusCode':_0x3ab2d5[_0xc41e('0xa7')]}:_0x3ab2d5);});};function createFieldObject(_0x27a36c,_0x8cd79,_0xab5fd9,_0x3de477,_0x155ec5,_0x2a3e62){return new Promise(function(_0x46f617,_0x545e5c){var _0x213721={'id':_0x3de477,'name':_0x155ec5,'custom':_0x2a3e62};if(_0xab5fd9===_0xc41e('0xa8')){_0x213721[_0xc41e('0x3a')]=[{'name':_0xc41e('0xa9'),'value':_0xc41e('0xaa')},{'name':_0xc41e('0xab'),'value':'false'}];_0x46f617(_0x213721);}else{var _0x3f8347={'method':_0xc41e('0xac'),'uri':_0x27a36c+_0xc41e('0xad')+_0x3de477,'auth':_0x8cd79,'json':!![]};return rp(_0x3f8347)[_0xc41e('0x3b')](function(_0x5e8a5d){var _0x1ada32=[];if(_0x5e8a5d['result'][_0xc41e('0x35')]>0x0){_0x5e8a5d[_0xc41e('0x9d')][_0xc41e('0xa2')](function(_0x5c4cb7){if(_0x5c4cb7[_0xc41e('0xae')]===_0xc41e('0xaf')){var _0x10617d={'name':_0x5c4cb7[_0xc41e('0xb0')],'value':_0x5c4cb7[_0xc41e('0xb1')]};_0x1ada32[_0xc41e('0xb2')](_0x10617d);}});}_0x213721[_0xc41e('0x3a')]=_0x1ada32;if(_0x213721[_0xc41e('0x3a')]['length']>0x0){_0x46f617(_0x213721);}else{if(_0x2a3e62==![]){_0x46f617();}else{_0x46f617(_0x213721);}}});}});} \ No newline at end of file +var _0x3361=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','ServicenowAccount','rows','catch','params','includeAll','create','body','find','destroy','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','resolved_by','user_input','sys_created_on','sys_domain','state','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','expected_start','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','severity','comments','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','location','email','remoteUri','serverUrl','slice','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','log','push','all','ServiceNow\x20error:\x20','test','error','stack','Wrong\x20credentials','statusCode','boolean','True','true','GET','false','value','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','update','then','name','send','index','map','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length'];(function(_0x2f3794,_0x3c3bec){var _0x1c9fbe=function(_0x2d2eac){while(--_0x2d2eac){_0x2f3794['push'](_0x2f3794['shift']());}};_0x1c9fbe(++_0x3c3bec);}(_0x3361,0x1e9));var _0x1336=function(_0x18b107,_0x395968){_0x18b107=_0x18b107-0x0;var _0x1451db=_0x3361[_0x18b107];return _0x1451db;};'use strict';var emlformat=require(_0x1336('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1336('0x1'));var jsonpatch=require(_0x1336('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1336('0x3'));var Mustache=require(_0x1336('0x4'));var util=require(_0x1336('0x5'));var path=require('path');var sox=require(_0x1336('0x6'));var csv=require(_0x1336('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1336('0x8'));var _=require('lodash');var squel=require(_0x1336('0x9'));var crypto=require('crypto');var jsforce=require(_0x1336('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1336('0xb'));var Papa=require(_0x1336('0xc'));var Redis=require(_0x1336('0xd'));var authService=require(_0x1336('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1336('0xf'));var hardwareService=require(_0x1336('0x10'));var logger=require(_0x1336('0x11'))(_0x1336('0x12'));var utils=require(_0x1336('0x13'));var config=require(_0x1336('0x14'));var licenseUtil=require(_0x1336('0x15'));var db=require(_0x1336('0x16'))['db'];var integrations=require(_0x1336('0x17'));function respondWithStatusCode(_0xcb3bf9,_0x2d96f8){_0x2d96f8=_0x2d96f8||0xcc;return function(_0x51a0f2){if(_0x51a0f2){return _0xcb3bf9[_0x1336('0x18')](_0x2d96f8);}return _0xcb3bf9[_0x1336('0x19')](_0x2d96f8)[_0x1336('0x1a')]();};}function respondWithResult(_0x2c2de8,_0x4fdc0e){_0x4fdc0e=_0x4fdc0e||0xc8;return function(_0x529cfb){if(_0x529cfb){return _0x2c2de8[_0x1336('0x19')](_0x4fdc0e)[_0x1336('0x1b')](_0x529cfb);}};}function respondWithFilteredResult(_0x53699b,_0x4eed0a){return function(_0x2d81db){if(_0x2d81db){var _0x466473=typeof _0x4eed0a['offset']===_0x1336('0x1c')&&typeof _0x4eed0a[_0x1336('0x1d')]===_0x1336('0x1c');var _0x40a539=_0x2d81db['count'];var _0xc93656=_0x466473?0x0:_0x4eed0a[_0x1336('0x1e')];var _0x91fca=_0x466473?_0x2d81db[_0x1336('0x1f')]:_0x4eed0a['offset']+_0x4eed0a[_0x1336('0x1d')];var _0x44399d;if(_0x91fca>=_0x40a539){_0x91fca=_0x40a539;_0x44399d=0xc8;}else{_0x44399d=0xce;}_0x53699b[_0x1336('0x19')](_0x44399d);return _0x53699b[_0x1336('0x20')](_0x1336('0x21'),_0xc93656+'-'+_0x91fca+'/'+_0x40a539)['json'](_0x2d81db);}return null;};}function patchUpdates(_0x436976){return function(_0x2dff52){try{jsonpatch['apply'](_0x2dff52,_0x436976,!![]);}catch(_0x314d30){return BPromise[_0x1336('0x22')](_0x314d30);}return _0x2dff52['save']();};}function saveUpdates(_0x59af36,_0xbf89d8){return function(_0x3bcc68){if(_0x3bcc68){return _0x3bcc68[_0x1336('0x23')](_0x59af36)[_0x1336('0x24')](function(_0x54401c){return _0x54401c;});}return null;};}function removeEntity(_0xd1ad8d,_0x1830be){return function(_0x105675){if(_0x105675){return _0x105675['destroy']()[_0x1336('0x24')](function(){_0xd1ad8d[_0x1336('0x19')](0xcc)[_0x1336('0x1a')]();});}};}function handleEntityNotFound(_0xe41c23,_0x34747b){return function(_0xf9e23b){if(!_0xf9e23b){_0xe41c23['sendStatus'](0x194);}return _0xf9e23b;};}function handleError(_0x3d042d,_0x2ae079){_0x2ae079=_0x2ae079||0x1f4;return function(_0x11051e){logger['error'](_0x11051e['stack']);if(_0x11051e[_0x1336('0x25')]){delete _0x11051e[_0x1336('0x25')];}_0x3d042d[_0x1336('0x19')](_0x2ae079)[_0x1336('0x26')](_0x11051e);};}exports[_0x1336('0x27')]=function(_0x2f2853,_0x289bac){var _0x301fc0={},_0x44a16b={},_0x2f91a0={'count':0x0,'rows':[]};var _0x24f70c=_[_0x1336('0x28')](db['ServicenowAccount'][_0x1336('0x29')],function(_0x137ae0){return{'name':_0x137ae0['fieldName'],'type':_0x137ae0[_0x1336('0x2a')]['key']};});_0x44a16b[_0x1336('0x2b')]=_[_0x1336('0x28')](_0x24f70c,_0x1336('0x25'));_0x44a16b['query']=_[_0x1336('0x2c')](_0x2f2853[_0x1336('0x2d')]);_0x44a16b[_0x1336('0x2e')]=_[_0x1336('0x2f')](_0x44a16b['model'],_0x44a16b[_0x1336('0x2d')]);_0x301fc0['attributes']=_[_0x1336('0x2f')](_0x44a16b[_0x1336('0x2b')],qs[_0x1336('0x30')](_0x2f2853[_0x1336('0x2d')][_0x1336('0x30')]));_0x301fc0[_0x1336('0x31')]=_0x301fc0[_0x1336('0x31')][_0x1336('0x32')]?_0x301fc0[_0x1336('0x31')]:_0x44a16b[_0x1336('0x2b')];if(!_0x2f2853[_0x1336('0x2d')][_0x1336('0x33')](_0x1336('0x34'))){_0x301fc0[_0x1336('0x1d')]=qs['limit'](_0x2f2853['query'][_0x1336('0x1d')]);_0x301fc0[_0x1336('0x1e')]=qs[_0x1336('0x1e')](_0x2f2853['query'][_0x1336('0x1e')]);}_0x301fc0[_0x1336('0x35')]=qs[_0x1336('0x36')](_0x2f2853['query']['sort']);_0x301fc0[_0x1336('0x37')]=qs[_0x1336('0x2e')](_[_0x1336('0x38')](_0x2f2853[_0x1336('0x2d')],_0x44a16b['filters']),_0x24f70c);if(_0x2f2853[_0x1336('0x2d')][_0x1336('0x39')]){_0x301fc0[_0x1336('0x37')]=_[_0x1336('0x3a')](_0x301fc0[_0x1336('0x37')],{'$or':_[_0x1336('0x28')](_0x24f70c,function(_0x558db8){if(_0x558db8[_0x1336('0x2a')]!==_0x1336('0x3b')){var _0x244648={};_0x244648[_0x558db8[_0x1336('0x25')]]={'$like':'%'+_0x2f2853['query'][_0x1336('0x39')]+'%'};return _0x244648;}})});}_0x301fc0=_[_0x1336('0x3a')]({},_0x301fc0,_0x2f2853[_0x1336('0x3c')]);var _0x155f39={'where':_0x301fc0['where']};return db['ServicenowAccount'][_0x1336('0x1f')](_0x155f39)['then'](function(_0x529c0d){_0x2f91a0['count']=_0x529c0d;if(_0x2f2853[_0x1336('0x2d')]['includeAll']){_0x301fc0[_0x1336('0x3d')]=[{'all':!![]}];}return db[_0x1336('0x3e')]['findAll'](_0x301fc0);})[_0x1336('0x24')](function(_0x50623f){_0x2f91a0[_0x1336('0x3f')]=_0x50623f;return _0x2f91a0;})[_0x1336('0x24')](respondWithFilteredResult(_0x289bac,_0x301fc0))[_0x1336('0x40')](handleError(_0x289bac,null));};exports['show']=function(_0x32df40,_0x2afaca){var _0x49485e={'raw':![],'where':{'id':_0x32df40[_0x1336('0x41')]['id']}},_0x13d80e={};_0x13d80e[_0x1336('0x2b')]=_['keys'](db[_0x1336('0x3e')][_0x1336('0x29')]);_0x13d80e[_0x1336('0x2d')]=_['keys'](_0x32df40[_0x1336('0x2d')]);_0x13d80e[_0x1336('0x2e')]=_['intersection'](_0x13d80e[_0x1336('0x2b')],_0x13d80e['query']);_0x49485e[_0x1336('0x31')]=_[_0x1336('0x2f')](_0x13d80e[_0x1336('0x2b')],qs[_0x1336('0x30')](_0x32df40[_0x1336('0x2d')]['fields']));_0x49485e['attributes']=_0x49485e[_0x1336('0x31')][_0x1336('0x32')]?_0x49485e['attributes']:_0x13d80e['model'];if(_0x32df40[_0x1336('0x2d')][_0x1336('0x42')]){_0x49485e[_0x1336('0x3d')]=[{'all':!![]}];}_0x49485e=_[_0x1336('0x3a')]({},_0x49485e,_0x32df40[_0x1336('0x3c')]);return db[_0x1336('0x3e')]['find'](_0x49485e)[_0x1336('0x24')](handleEntityNotFound(_0x2afaca,null))['then'](respondWithResult(_0x2afaca,null))[_0x1336('0x40')](handleError(_0x2afaca,null));};exports[_0x1336('0x43')]=function(_0x3634f9,_0x3b0ef6){return db[_0x1336('0x3e')][_0x1336('0x43')](_0x3634f9[_0x1336('0x44')],{})[_0x1336('0x24')](respondWithResult(_0x3b0ef6,0xc9))[_0x1336('0x40')](handleError(_0x3b0ef6,null));};exports[_0x1336('0x23')]=function(_0x40b9c9,_0x31b894){if(_0x40b9c9['body']['id']){delete _0x40b9c9['body']['id'];}return db['ServicenowAccount'][_0x1336('0x45')]({'where':{'id':_0x40b9c9[_0x1336('0x41')]['id']}})['then'](handleEntityNotFound(_0x31b894,null))[_0x1336('0x24')](saveUpdates(_0x40b9c9[_0x1336('0x44')],null))[_0x1336('0x24')](respondWithResult(_0x31b894,null))[_0x1336('0x40')](handleError(_0x31b894,null));};exports[_0x1336('0x46')]=function(_0x14de0b,_0x221445){return db[_0x1336('0x3e')][_0x1336('0x45')]({'where':{'id':_0x14de0b['params']['id']}})['then'](handleEntityNotFound(_0x221445,null))[_0x1336('0x24')](removeEntity(_0x221445,null))[_0x1336('0x40')](handleError(_0x221445,null));};exports['getConfigurations']=function(_0x47121c,_0x3835de,_0x4702c7){var _0x29e630={};var _0x3122cf={};var _0x1327ee;var _0x58f350;return db['ServicenowAccount'][_0x1336('0x47')]({'where':{'id':_0x47121c[_0x1336('0x41')]['id']}})[_0x1336('0x24')](handleEntityNotFound(_0x3835de,null))[_0x1336('0x24')](function(_0x2e912b){if(_0x2e912b){_0x1327ee=_0x2e912b;_0x3122cf['model']=_[_0x1336('0x2c')](db[_0x1336('0x48')][_0x1336('0x29')]);_0x3122cf[_0x1336('0x2d')]=_[_0x1336('0x2c')](_0x47121c[_0x1336('0x2d')]);_0x3122cf['filters']=_['intersection'](_0x3122cf['model'],_0x3122cf['query']);_0x29e630['attributes']=_[_0x1336('0x2f')](_0x3122cf[_0x1336('0x2b')],qs[_0x1336('0x30')](_0x47121c[_0x1336('0x2d')][_0x1336('0x30')]));_0x29e630[_0x1336('0x31')]=_0x29e630[_0x1336('0x31')][_0x1336('0x32')]?_0x29e630['attributes']:_0x3122cf[_0x1336('0x2b')];_0x29e630[_0x1336('0x35')]=qs['sort'](_0x47121c['query'][_0x1336('0x36')]);_0x29e630[_0x1336('0x37')]=qs[_0x1336('0x2e')](_[_0x1336('0x38')](_0x47121c[_0x1336('0x2d')],_0x3122cf[_0x1336('0x2e')]));if(_0x47121c['query']['filter']){_0x29e630[_0x1336('0x37')]=_[_0x1336('0x3a')](_0x29e630['where'],{'$or':_[_0x1336('0x28')](_0x29e630[_0x1336('0x31')],function(_0x58fc98){var _0x2ecdaa={};_0x2ecdaa[_0x58fc98]={'$like':'%'+_0x47121c[_0x1336('0x2d')][_0x1336('0x39')]+'%'};return _0x2ecdaa;})});}_0x29e630=_['merge']({},_0x29e630,_0x47121c[_0x1336('0x3c')]);return _0x1327ee[_0x1336('0x49')](_0x29e630);}})['then'](function(_0x33de53){if(_0x33de53){_0x58f350=_0x33de53[_0x1336('0x32')];if(!_0x47121c[_0x1336('0x2d')][_0x1336('0x33')](_0x1336('0x34'))){_0x29e630[_0x1336('0x1d')]=qs['limit'](_0x47121c[_0x1336('0x2d')]['limit']);_0x29e630[_0x1336('0x1e')]=qs[_0x1336('0x1e')](_0x47121c[_0x1336('0x2d')]['offset']);}return _0x1327ee[_0x1336('0x49')](_0x29e630);}})[_0x1336('0x24')](function(_0x4e6312){if(_0x4e6312){return _0x4e6312?{'count':_0x58f350,'rows':_0x4e6312}:null;}})[_0x1336('0x24')](respondWithResult(_0x3835de,null))['catch'](handleError(_0x3835de,null));};exports[_0x1336('0x4a')]=function(_0x3b4c3a,_0x4b784f,_0x18801e){if(_0x3b4c3a[_0x1336('0x44')]['id']){delete _0x3b4c3a[_0x1336('0x44')]['id'];}return db[_0x1336('0x3e')][_0x1336('0x47')]({'where':{'id':_0x3b4c3a[_0x1336('0x41')]['id']}})[_0x1336('0x24')](handleEntityNotFound(_0x4b784f,null))[_0x1336('0x24')](function(_0x52544a){if(_0x52544a){_0x3b4c3a[_0x1336('0x44')]['AccountId']=_0x52544a['id'];_0x3b4c3a[_0x1336('0x44')][_0x1336('0x4b')]=integrations[_0x1336('0x4c')](_0x3b4c3a[_0x1336('0x44')][_0x1336('0x4d')],_0x3b4c3a[_0x1336('0x44')][_0x1336('0x2a')]);_0x3b4c3a['body'][_0x1336('0x4e')]=integrations[_0x1336('0x4f')](_0x3b4c3a['body'][_0x1336('0x4d')],_0x3b4c3a['body']['type']);return db['ServicenowConfiguration'][_0x1336('0x43')](_0x3b4c3a[_0x1336('0x44')],{'include':[{'model':db[_0x1336('0x50')],'as':_0x1336('0x4b')},{'model':db[_0x1336('0x50')],'as':_0x1336('0x4e')}]});}return null;})[_0x1336('0x24')](respondWithResult(_0x4b784f,null))[_0x1336('0x40')](handleError(_0x4b784f,null));};exports[_0x1336('0x51')]=function(_0x43dad7,_0x3dbbec,_0x213f84){var _0x153178=[_0x1336('0x52'),_0x1336('0x53'),_0x1336('0x54'),_0x1336('0x55'),_0x1336('0x56'),_0x1336('0x57'),_0x1336('0x58'),'severity',_0x1336('0x59')];var _0x322636=[_0x1336('0x5a'),_0x1336('0x52'),_0x1336('0x5b'),_0x1336('0x5c'),'upon_reject',_0x1336('0x5d'),_0x1336('0x5e'),_0x1336('0x53'),_0x1336('0x5f'),'number',_0x1336('0x60'),'sys_updated_by','opened_by',_0x1336('0x61'),_0x1336('0x62'),_0x1336('0x63'),_0x1336('0x64'),'sys_created_by',_0x1336('0x54'),'order','calendar_stc','closed_at',_0x1336('0x65'),_0x1336('0x66'),_0x1336('0x67'),_0x1336('0x68'),_0x1336('0x69'),_0x1336('0x6a'),_0x1336('0x6b'),_0x1336('0x6c'),_0x1336('0x6d'),'time_worked',_0x1336('0x6e'),'opened_at','business_duration',_0x1336('0x6f'),_0x1336('0x70'),_0x1336('0x71'),_0x1336('0x72'),_0x1336('0x73'),_0x1336('0x74'),_0x1336('0x55'),'work_notes',_0x1336('0x75'),'close_code',_0x1336('0x76'),_0x1336('0x77'),_0x1336('0x78'),_0x1336('0x79'),_0x1336('0x7a'),'additional_assignee_list',_0x1336('0x7b'),_0x1336('0x7c'),_0x1336('0x57'),_0x1336('0x7d'),_0x1336('0x7e'),'closed_by',_0x1336('0x7f'),_0x1336('0x80'),_0x1336('0x81'),_0x1336('0x82'),_0x1336('0x83'),_0x1336('0x58'),_0x1336('0x84'),_0x1336('0x85'),_0x1336('0x86'),_0x1336('0x87'),_0x1336('0x88'),_0x1336('0x89'),_0x1336('0x8a'),_0x1336('0x8b'),'sla_due',_0x1336('0x8c'),_0x1336('0x8d'),_0x1336('0x8e'),'sys_mod_count',_0x1336('0x8f'),_0x1336('0x90'),_0x1336('0x91'),_0x1336('0x92'),'correlation_id',_0x1336('0x93'),_0x1336('0x59')];var _0x3819ea='';var _0x340bb5='';var _0x4584d8=[];var _0x30aff9='';var _0x16ec0c='';var _0x3339e8=[];var _0x5a0a16='';var _0x3349ce='';var _0xf32cc2={};var _0x299809='';return db[_0x1336('0x3e')][_0x1336('0x47')]({'where':{'id':_0x43dad7[_0x1336('0x41')]['id']},'attributes':['id','username','password',_0x1336('0x94'),_0x1336('0x95'),_0x1336('0x96')]})['then'](handleEntityNotFound(_0x3dbbec,null))['then'](function(_0x5dc5f4){if(_0x5dc5f4){_0x299809=_0x5dc5f4[_0x1336('0x95')];var _0x1826b9=_0x299809[_0x1336('0x97')](-0x1);if(_0x1826b9==='/'){_0x299809=_0x299809['substring'](0x0,_0x299809['lastIndexOf'](_0x1826b9));}_0x3349ce=util[_0x1336('0x98')](_0x1336('0x99'),_0x299809);_0x5a0a16=util[_0x1336('0x98')](_0x1336('0x9a'),_0x299809);_0xf32cc2={'user':_0x5dc5f4[_0x1336('0x9b')],'pass':_0x5dc5f4['password']};var _0x550101={'method':'GET','uri':_0x3349ce+_0x1336('0x9c'),'auth':_0xf32cc2,'json':!![]};return rp(_0x550101);}})[_0x1336('0x24')](function(_0x1d16a8){if(_0x1d16a8[_0x1336('0x9d')][_0x1336('0x32')]>0x0){_0x3819ea=_0x1d16a8[_0x1336('0x9d')];}console['log'](_0x1336('0x9e'),_0x3819ea);_0x3339e8=[];_0x340bb5=Object[_0x1336('0x9f')]([],_0x3819ea);_[_0x1336('0xa0')](_0x340bb5,function(_0x3a98ff){return!_0x153178[_0x1336('0xa1')](_0x3a98ff['name']);});_0x340bb5[_0x1336('0xa2')](function(_0x37cb58){var _0x155a3c=createFieldObject(_0x5a0a16,_0xf32cc2,_0x37cb58[_0x1336('0xa3')],_0x37cb58[_0x1336('0x25')],_0x37cb58[_0x1336('0xa4')],![]);_0x3339e8['push'](_0x155a3c);});return Promise['all'](_0x3339e8);})[_0x1336('0x24')](function(_0x5116b2){_0x4584d8=_0x5116b2;_0x30aff9=Object[_0x1336('0x9f')]([],_0x3819ea);console[_0x1336('0xa5')]('TCL:\x20_object',_0x3819ea);_[_0x1336('0xa0')](_0x30aff9,function(_0x47aca7){return _0x322636['includes'](_0x47aca7[_0x1336('0x25')]);});console[_0x1336('0xa5')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x30aff9);_0x3339e8=[];_0x30aff9['forEach'](function(_0x44ae9d){var _0x3c2fbe=createFieldObject(_0x5a0a16,_0xf32cc2,_0x44ae9d[_0x1336('0xa3')],_0x44ae9d[_0x1336('0x25')],_0x44ae9d[_0x1336('0xa4')],!![]);_0x3339e8[_0x1336('0xa6')](_0x3c2fbe);});return Promise[_0x1336('0xa7')](_0x3339e8);})[_0x1336('0x24')](function(_0x310917){_0x16ec0c=_0x310917;var _0x1b89db=_0x4584d8['concat'](_0x16ec0c);return{'count':_0x1b89db[_0x1336('0x32')],'rows':_0x1b89db};})[_0x1336('0x24')](respondWithResult(_0x3dbbec,null))[_0x1336('0x40')](function(_0x428712){console[_0x1336('0xa5')](_0x1336('0xa8')+_0x428712);var _0x53c692=_0x43dad7['query'][_0x1336('0xa9')]?0x1f4:_0x428712['statusCode']||0x1f4;logger[_0x1336('0xaa')](_0x428712[_0x1336('0xab')]);delete _0x428712[_0x1336('0x25')];if(_0x53c692===0x191){_0x53c692=0x190;}_0x3dbbec['status'](_0x53c692)[_0x1336('0x26')](_0x43dad7[_0x1336('0x2d')][_0x1336('0xa9')]?{'message':_0x1336('0xac'),'statusCode':_0x428712[_0x1336('0xad')]}:_0x428712);});};function createFieldObject(_0x27ff17,_0x38fff,_0x1317c3,_0x534df3,_0x5d3bd7,_0x7f41ae){return new Promise(function(_0x182add,_0x90b352){var _0x5b02e1={'id':_0x534df3,'name':_0x5d3bd7,'custom':_0x7f41ae};if(_0x1317c3===_0x1336('0xae')){_0x5b02e1[_0x1336('0x3c')]=[{'name':_0x1336('0xaf'),'value':_0x1336('0xb0')},{'name':'False','value':'false'}];_0x182add(_0x5b02e1);}else{var _0xbc8b24={'method':_0x1336('0xb1'),'uri':_0x27ff17+'sys_choice?sysparm_query=name=incident^element='+_0x534df3,'auth':_0x38fff,'json':!![]};return rp(_0xbc8b24)[_0x1336('0x24')](function(_0x315bd3){var _0x25d286=[];if(_0x315bd3[_0x1336('0x9d')][_0x1336('0x32')]>0x0){_0x315bd3[_0x1336('0x9d')][_0x1336('0xa2')](function(_0x3f7c82){if(_0x3f7c82['inactive']===_0x1336('0xb2')){var _0x3452fa={'name':_0x3f7c82[_0x1336('0xa4')],'value':_0x3f7c82[_0x1336('0xb3')]};_0x25d286[_0x1336('0xa6')](_0x3452fa);}});}_0x5b02e1[_0x1336('0x3c')]=_0x25d286;if(_0x5b02e1[_0x1336('0x3c')][_0x1336('0x32')]>0x0){_0x182add(_0x5b02e1);}else{if(_0x7f41ae==![]){_0x182add();}else{_0x182add(_0x5b02e1);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 4c189bc..65b3e31 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 _0x5fab=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts'];(function(_0x443e9e,_0x3c1baf){var _0x5db340=function(_0x201893){while(--_0x201893){_0x443e9e['push'](_0x443e9e['shift']());}};_0x5db340(++_0x3c1baf);}(_0x5fab,0x177));var _0xb5fa=function(_0x189d12,_0x17aafc){_0x189d12=_0x189d12-0x0;var _0x39b0ad=_0x5fab[_0x189d12];return _0x39b0ad;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));var integrations=require(_0xb5fa('0xa'));module[_0xb5fa('0xb')]=function(_0x4a0249,_0x5d70f6){return _0x4a0249[_0xb5fa('0xc')](_0xb5fa('0xd'),attributes,{'tableName':_0xb5fa('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f8a=['exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x2b2e68,_0x4e7325){_0x2b2e68=_0x2b2e68-0x0;var _0x3601bd=_0x3f8a[_0x2b2e68];return _0x3601bd;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));var integrations=require(_0xa3f8('0xa'));module[_0xa3f8('0xb')]=function(_0x1f160a,_0xf895d9){return _0x1f160a[_0xa3f8('0xc')](_0xa3f8('0xd'),attributes,{'tableName':_0xa3f8('0xe'),'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 fa61275..7f1e07f 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 _0xfea8=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','limit','include','model','map','find','raw','ShowServicenowAccount'];(function(_0x422be2,_0x1c439e){var _0x1b820e=function(_0x513cc8){while(--_0x513cc8){_0x422be2['push'](_0x422be2['shift']());}};_0x1b820e(++_0x1c439e);}(_0xfea8,0x10a));var _0x8fea=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0xfea8[_0x1b6c6d];return _0x290d9d;};'use strict';var _=require(_0x8fea('0x0'));var util=require(_0x8fea('0x1'));var moment=require(_0x8fea('0x2'));var BPromise=require(_0x8fea('0x3'));var rs=require(_0x8fea('0x4'));var fs=require('fs');var Redis=require(_0x8fea('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8fea('0x6'));var logger=require(_0x8fea('0x7'))(_0x8fea('0x8'));var config=require(_0x8fea('0x9'));var jayson=require(_0x8fea('0xa'));var client=jayson[_0x8fea('0xb')][_0x8fea('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4cd9d0,_0x4b1241,_0x13a55b){return new BPromise(function(_0x341f1b,_0x2558a4){return client[_0x8fea('0xd')](_0x4cd9d0,_0x13a55b)[_0x8fea('0xe')](function(_0x37ef6b){logger[_0x8fea('0xf')](_0x8fea('0x10'),_0x4b1241,_0x8fea('0x11'));logger[_0x8fea('0x12')](_0x8fea('0x13'),_0x4b1241,_0x8fea('0x11'),JSON[_0x8fea('0x14')](_0x37ef6b));if(_0x37ef6b[_0x8fea('0x15')]){if(_0x37ef6b[_0x8fea('0x15')][_0x8fea('0x16')]===0x1f4){logger[_0x8fea('0x15')](_0x8fea('0x10'),_0x4b1241,_0x37ef6b[_0x8fea('0x15')][_0x8fea('0x17')]);return _0x2558a4(_0x37ef6b[_0x8fea('0x15')][_0x8fea('0x17')]);}logger[_0x8fea('0x15')](_0x8fea('0x10'),_0x4b1241,_0x37ef6b[_0x8fea('0x15')][_0x8fea('0x17')]);return _0x341f1b(_0x37ef6b['error'][_0x8fea('0x17')]);}else{logger[_0x8fea('0xf')](_0x8fea('0x10'),_0x4b1241,_0x8fea('0x11'));_0x341f1b(_0x37ef6b['result'][_0x8fea('0x17')]);}})[_0x8fea('0x18')](function(_0x1ac9ab){logger['error'](_0x8fea('0x10'),_0x4b1241,_0x1ac9ab);_0x2558a4(_0x1ac9ab);});});}exports[_0x8fea('0x19')]=function(_0xc8bbdb){var _0x55b810=this;return new Promise(function(_0x46c1a7,_0x33d374){return db[_0x8fea('0x1a')][_0x8fea('0x1b')]({'raw':_0xc8bbdb['options']?_0xc8bbdb[_0x8fea('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xc8bbdb[_0x8fea('0x1c')]?_0xc8bbdb[_0x8fea('0x1c')][_0x8fea('0x1d')]||null:null,'attributes':_0xc8bbdb[_0x8fea('0x1c')]?_0xc8bbdb[_0x8fea('0x1c')][_0x8fea('0x1e')]||null:null,'limit':_0xc8bbdb['options']?_0xc8bbdb[_0x8fea('0x1c')][_0x8fea('0x1f')]||null:null,'include':_0xc8bbdb[_0x8fea('0x1c')]?_0xc8bbdb[_0x8fea('0x1c')]['include']?_['map'](_0xc8bbdb['options'][_0x8fea('0x20')],function(_0x10bfe2){return{'model':db[_0x10bfe2[_0x8fea('0x21')]],'as':_0x10bfe2['as'],'attributes':_0x10bfe2[_0x8fea('0x1e')],'include':_0x10bfe2[_0x8fea('0x20')]?_[_0x8fea('0x22')](_0x10bfe2[_0x8fea('0x20')],function(_0x22c180){return{'model':db[_0x22c180[_0x8fea('0x21')]],'as':_0x22c180['as'],'attributes':_0x22c180[_0x8fea('0x1e')],'include':_0x22c180[_0x8fea('0x20')]?_['map'](_0x22c180['include'],function(_0xa2f589){return{'model':db[_0xa2f589['model']],'as':_0xa2f589['as'],'attributes':_0xa2f589[_0x8fea('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8fea('0xe')](function(_0x20e259){logger['info'](_0x8fea('0x19'),_0xc8bbdb);logger[_0x8fea('0x12')](_0x8fea('0x19'),_0xc8bbdb,JSON[_0x8fea('0x14')](_0x20e259));_0x46c1a7(_0x20e259);})[_0x8fea('0x18')](function(_0x5b4df5){logger[_0x8fea('0x15')](_0x8fea('0x19'),_0x5b4df5[_0x8fea('0x17')],_0xc8bbdb);_0x33d374(_0x55b810[_0x8fea('0x15')](0x1f4,_0x5b4df5[_0x8fea('0x17')]));});});};exports['ShowServicenowAccount']=function(_0x116500){var _0x1294a0=this;return new Promise(function(_0x23671b,_0x5951b5){return db[_0x8fea('0x1a')][_0x8fea('0x23')]({'raw':_0x116500['options']?_0x116500[_0x8fea('0x1c')][_0x8fea('0x24')]===undefined?!![]:![]:!![],'where':_0x116500[_0x8fea('0x1c')]?_0x116500[_0x8fea('0x1c')][_0x8fea('0x1d')]||null:null,'attributes':_0x116500['options']?_0x116500['options'][_0x8fea('0x1e')]||null:null,'include':_0x116500[_0x8fea('0x1c')]?_0x116500['options'][_0x8fea('0x20')]?_['map'](_0x116500[_0x8fea('0x1c')][_0x8fea('0x20')],function(_0x5b7c63){return{'model':db[_0x5b7c63['model']],'as':_0x5b7c63['as'],'attributes':_0x5b7c63['attributes'],'include':_0x5b7c63['include']?_[_0x8fea('0x22')](_0x5b7c63[_0x8fea('0x20')],function(_0xd561e9){return{'model':db[_0xd561e9[_0x8fea('0x21')]],'as':_0xd561e9['as'],'attributes':_0xd561e9[_0x8fea('0x1e')],'include':_0xd561e9['include']?_[_0x8fea('0x22')](_0xd561e9[_0x8fea('0x20')],function(_0x3ca7fd){return{'model':db[_0x3ca7fd[_0x8fea('0x21')]],'as':_0x3ca7fd['as'],'attributes':_0x3ca7fd['attributes']};}):[]};}):[]};}):[]:[]})[_0x8fea('0xe')](function(_0x310b26){logger[_0x8fea('0xf')]('ShowServicenowAccount',_0x116500);logger[_0x8fea('0x12')]('ShowServicenowAccount',_0x116500,JSON[_0x8fea('0x14')](_0x310b26));_0x23671b(_0x310b26);})['catch'](function(_0x4c8cf5){logger[_0x8fea('0x15')](_0x8fea('0x25'),_0x4c8cf5[_0x8fea('0x17')],_0x116500);_0x5951b5(_0x1294a0[_0x8fea('0x15')](0x1f4,_0x4c8cf5['message']));});});}; \ No newline at end of file +var _0xb465=['where','limit','include','map','model','attributes','ShowServicenowAccount','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xb465,0x165));var _0x5b46=function(_0xe7fc9d,_0x95ff35){_0xe7fc9d=_0xe7fc9d-0x0;var _0xd9db00=_0xb465[_0xe7fc9d];return _0xd9db00;};'use strict';var _=require(_0x5b46('0x0'));var util=require(_0x5b46('0x1'));var moment=require('moment');var BPromise=require(_0x5b46('0x2'));var rs=require(_0x5b46('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b46('0x4'))['db'];var utils=require(_0x5b46('0x5'));var logger=require(_0x5b46('0x6'))(_0x5b46('0x7'));var config=require(_0x5b46('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5b46('0x9')][_0x5b46('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57146c,_0x45dc72,_0x17b035){return new BPromise(function(_0x296adc,_0x7f15d4){return client['request'](_0x57146c,_0x17b035)[_0x5b46('0xb')](function(_0x536ff8){logger[_0x5b46('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x45dc72,_0x5b46('0xd'));logger[_0x5b46('0xe')](_0x5b46('0xf'),_0x45dc72,_0x5b46('0xd'),JSON[_0x5b46('0x10')](_0x536ff8));if(_0x536ff8['error']){if(_0x536ff8[_0x5b46('0x11')][_0x5b46('0x12')]===0x1f4){logger[_0x5b46('0x11')](_0x5b46('0x13'),_0x45dc72,_0x536ff8[_0x5b46('0x11')][_0x5b46('0x14')]);return _0x7f15d4(_0x536ff8[_0x5b46('0x11')][_0x5b46('0x14')]);}logger['error'](_0x5b46('0x13'),_0x45dc72,_0x536ff8[_0x5b46('0x11')][_0x5b46('0x14')]);return _0x296adc(_0x536ff8[_0x5b46('0x11')]['message']);}else{logger[_0x5b46('0xc')](_0x5b46('0x13'),_0x45dc72,_0x5b46('0xd'));_0x296adc(_0x536ff8[_0x5b46('0x15')][_0x5b46('0x14')]);}})[_0x5b46('0x16')](function(_0x4febe5){logger['error'](_0x5b46('0x13'),_0x45dc72,_0x4febe5);_0x7f15d4(_0x4febe5);});});}exports[_0x5b46('0x17')]=function(_0x29c4d4){var _0x3930e0=this;return new Promise(function(_0x199ead,_0x4a5f04){return db[_0x5b46('0x18')][_0x5b46('0x19')]({'raw':_0x29c4d4[_0x5b46('0x1a')]?_0x29c4d4['options'][_0x5b46('0x1b')]===undefined?!![]:![]:!![],'where':_0x29c4d4['options']?_0x29c4d4[_0x5b46('0x1a')][_0x5b46('0x1c')]||null:null,'attributes':_0x29c4d4[_0x5b46('0x1a')]?_0x29c4d4[_0x5b46('0x1a')]['attributes']||null:null,'limit':_0x29c4d4[_0x5b46('0x1a')]?_0x29c4d4[_0x5b46('0x1a')][_0x5b46('0x1d')]||null:null,'include':_0x29c4d4['options']?_0x29c4d4[_0x5b46('0x1a')][_0x5b46('0x1e')]?_[_0x5b46('0x1f')](_0x29c4d4[_0x5b46('0x1a')][_0x5b46('0x1e')],function(_0x23831f){return{'model':db[_0x23831f[_0x5b46('0x20')]],'as':_0x23831f['as'],'attributes':_0x23831f[_0x5b46('0x21')],'include':_0x23831f[_0x5b46('0x1e')]?_[_0x5b46('0x1f')](_0x23831f['include'],function(_0x14ab55){return{'model':db[_0x14ab55[_0x5b46('0x20')]],'as':_0x14ab55['as'],'attributes':_0x14ab55[_0x5b46('0x21')],'include':_0x14ab55['include']?_['map'](_0x14ab55[_0x5b46('0x1e')],function(_0x5172f0){return{'model':db[_0x5172f0['model']],'as':_0x5172f0['as'],'attributes':_0x5172f0[_0x5b46('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5b46('0xb')](function(_0x3e7adf){logger[_0x5b46('0xc')](_0x5b46('0x17'),_0x29c4d4);logger['debug']('GetServicenowAccount',_0x29c4d4,JSON[_0x5b46('0x10')](_0x3e7adf));_0x199ead(_0x3e7adf);})[_0x5b46('0x16')](function(_0xe08a){logger[_0x5b46('0x11')](_0x5b46('0x17'),_0xe08a[_0x5b46('0x14')],_0x29c4d4);_0x4a5f04(_0x3930e0[_0x5b46('0x11')](0x1f4,_0xe08a['message']));});});};exports[_0x5b46('0x22')]=function(_0x2c05f4){var _0x495b08=this;return new Promise(function(_0x2612a9,_0x28effd){return db['ServicenowAccount']['find']({'raw':_0x2c05f4[_0x5b46('0x1a')]?_0x2c05f4[_0x5b46('0x1a')][_0x5b46('0x1b')]===undefined?!![]:![]:!![],'where':_0x2c05f4['options']?_0x2c05f4[_0x5b46('0x1a')][_0x5b46('0x1c')]||null:null,'attributes':_0x2c05f4['options']?_0x2c05f4[_0x5b46('0x1a')][_0x5b46('0x21')]||null:null,'include':_0x2c05f4[_0x5b46('0x1a')]?_0x2c05f4[_0x5b46('0x1a')][_0x5b46('0x1e')]?_[_0x5b46('0x1f')](_0x2c05f4['options'][_0x5b46('0x1e')],function(_0x385b07){return{'model':db[_0x385b07[_0x5b46('0x20')]],'as':_0x385b07['as'],'attributes':_0x385b07[_0x5b46('0x21')],'include':_0x385b07[_0x5b46('0x1e')]?_[_0x5b46('0x1f')](_0x385b07[_0x5b46('0x1e')],function(_0x364651){return{'model':db[_0x364651[_0x5b46('0x20')]],'as':_0x364651['as'],'attributes':_0x364651[_0x5b46('0x21')],'include':_0x364651[_0x5b46('0x1e')]?_[_0x5b46('0x1f')](_0x364651[_0x5b46('0x1e')],function(_0x3c28f2){return{'model':db[_0x3c28f2[_0x5b46('0x20')]],'as':_0x3c28f2['as'],'attributes':_0x3c28f2[_0x5b46('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21c93a){logger[_0x5b46('0xc')]('ShowServicenowAccount',_0x2c05f4);logger[_0x5b46('0xe')](_0x5b46('0x22'),_0x2c05f4,JSON[_0x5b46('0x10')](_0x21c93a));_0x2612a9(_0x21c93a);})[_0x5b46('0x16')](function(_0x2beb5f){logger[_0x5b46('0x11')](_0x5b46('0x22'),_0x2beb5f[_0x5b46('0x14')],_0x2c05f4);_0x28effd(_0x495b08[_0x5b46('0x11')](0x1f4,_0x2beb5f[_0x5b46('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 4def80a..1e2316a 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 _0x51cf=['/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated'];(function(_0x3e9227,_0x2f5fce){var _0x239d35=function(_0xf5cc20){while(--_0xf5cc20){_0x3e9227['push'](_0x3e9227['shift']());}};_0x239d35(++_0x2f5fce);}(_0x51cf,0xda));var _0xf51c=function(_0x3810c1,_0x288d7e){_0x3810c1=_0x3810c1-0x0;var _0x597be5=_0x51cf[_0x3810c1];return _0x597be5;};'use strict';var multer=require(_0xf51c('0x0'));var util=require(_0xf51c('0x1'));var path=require(_0xf51c('0x2'));var timeout=require(_0xf51c('0x3'));var express=require(_0xf51c('0x4'));var router=express[_0xf51c('0x5')]();var fs_extra=require(_0xf51c('0x6'));var auth=require(_0xf51c('0x7'));var interaction=require(_0xf51c('0x8'));var config=require('../../config/environment');var controller=require(_0xf51c('0x9'));router[_0xf51c('0xa')]('/',auth[_0xf51c('0xb')](),controller['index']);router[_0xf51c('0xa')](_0xf51c('0xc'),auth[_0xf51c('0xb')](),controller['show']);router[_0xf51c('0xa')](_0xf51c('0xd'),auth['isAuthenticated'](),controller[_0xf51c('0xe')]);router[_0xf51c('0xa')](_0xf51c('0xf'),auth[_0xf51c('0xb')](),controller[_0xf51c('0x10')]);router[_0xf51c('0xa')](_0xf51c('0x11'),auth[_0xf51c('0xb')](),controller[_0xf51c('0x12')]);router['post']('/',auth[_0xf51c('0xb')](),controller[_0xf51c('0x13')]);router['put'](_0xf51c('0xc'),auth[_0xf51c('0xb')](),controller[_0xf51c('0x14')]);router['delete'](_0xf51c('0xc'),auth['isAuthenticated'](),controller[_0xf51c('0x15')]);module[_0xf51c('0x16')]=router; \ No newline at end of file +var _0x693b=['create','update','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x153118,_0x55b60c){var _0x46505a=function(_0x8a2f41){while(--_0x8a2f41){_0x153118['push'](_0x153118['shift']());}};_0x46505a(++_0x55b60c);}(_0x693b,0x11b));var _0xb693=function(_0x19f9af,_0x14e04a){_0x19f9af=_0x19f9af-0x0;var _0x4d850a=_0x693b[_0x19f9af];return _0x4d850a;};'use strict';var multer=require(_0xb693('0x0'));var util=require(_0xb693('0x1'));var path=require('path');var timeout=require(_0xb693('0x2'));var express=require(_0xb693('0x3'));var router=express['Router']();var fs_extra=require(_0xb693('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb693('0x5'));var config=require('../../config/environment');var controller=require(_0xb693('0x6'));router['get']('/',auth[_0xb693('0x7')](),controller[_0xb693('0x8')]);router[_0xb693('0x9')](_0xb693('0xa'),auth['isAuthenticated'](),controller[_0xb693('0xb')]);router['get']('/:id/fields',auth[_0xb693('0x7')](),controller[_0xb693('0xc')]);router['get'](_0xb693('0xd'),auth[_0xb693('0x7')](),controller[_0xb693('0xe')]);router[_0xb693('0x9')](_0xb693('0xf'),auth[_0xb693('0x7')](),controller[_0xb693('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb693('0x11')]);router['put'](_0xb693('0xa'),auth[_0xb693('0x7')](),controller[_0xb693('0x12')]);router['delete']('/:id',auth[_0xb693('0x7')](),controller['destroy']);module[_0xb693('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 51f63e6..cd7a776 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 _0x790a=['sequelize','STRING'];(function(_0x598f7d,_0x4f1b14){var _0x4eb65f=function(_0x35c0c9){while(--_0x35c0c9){_0x598f7d['push'](_0x598f7d['shift']());}};_0x4eb65f(++_0x4f1b14);}(_0x790a,0xee));var _0xa790=function(_0x134d5e,_0x2a47d8){_0x134d5e=_0x134d5e-0x0;var _0x1e166a=_0x790a[_0x134d5e];return _0x1e166a;};'use strict';var Sequelize=require(_0xa790('0x0'));module['exports']={'name':{'type':Sequelize[_0xa790('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdd5d=['exports','STRING','sequelize'];(function(_0x4836e9,_0x42f8e4){var _0x43f54e=function(_0x316e26){while(--_0x316e26){_0x4836e9['push'](_0x4836e9['shift']());}};_0x43f54e(++_0x42f8e4);}(_0xdd5d,0x13d));var _0xddd5=function(_0x42f930,_0x8e3d18){_0x42f930=_0x42f930-0x0;var _0x3d055e=_0xdd5d[_0x42f930];return _0x3d055e;};'use strict';var Sequelize=require(_0xddd5('0x0'));module[_0xddd5('0x1')]={'name':{'type':Sequelize[_0xddd5('0x2')]},'description':{'type':Sequelize[_0xddd5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 3ee5fe3..d523d2c 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 _0x6edd=['findOne','ServicenowField','getSubjects','getDescriptions','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','send','index','map','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowConfiguration','catch','show','params','includeAll','find','body','getFields'];(function(_0x1cc3ce,_0x43791e){var _0x4ac6ac=function(_0x15d789){while(--_0x15d789){_0x1cc3ce['push'](_0x1cc3ce['shift']());}};_0x4ac6ac(++_0x43791e);}(_0x6edd,0x176));var _0xd6ed=function(_0x51ca57,_0x375681){_0x51ca57=_0x51ca57-0x0;var _0x4c5ba5=_0x6edd[_0x51ca57];return _0x4c5ba5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd6ed('0x0'));var moment=require(_0xd6ed('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xd6ed('0x2'));var util=require('util');var path=require(_0xd6ed('0x3'));var sox=require(_0xd6ed('0x4'));var csv=require(_0xd6ed('0x5'));var ejs=require(_0xd6ed('0x6'));var fs=require('fs');var fs_extra=require(_0xd6ed('0x7'));var _=require(_0xd6ed('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd6ed('0x9'));var deskjs=require(_0xd6ed('0xa'));var toCsv=require(_0xd6ed('0x5'));var querystring=require(_0xd6ed('0xb'));var Papa=require(_0xd6ed('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd6ed('0xd'));var as=require(_0xd6ed('0xe'));var hardwareService=require(_0xd6ed('0xf'));var logger=require('../../config/logger')(_0xd6ed('0x10'));var utils=require(_0xd6ed('0x11'));var config=require(_0xd6ed('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xd6ed('0x13'))['db'];function respondWithStatusCode(_0x4950d6,_0xe392c0){_0xe392c0=_0xe392c0||0xcc;return function(_0x12efae){if(_0x12efae){return _0x4950d6[_0xd6ed('0x14')](_0xe392c0);}return _0x4950d6[_0xd6ed('0x15')](_0xe392c0)['end']();};}function respondWithResult(_0x329bcc,_0x54e49e){_0x54e49e=_0x54e49e||0xc8;return function(_0x22c8be){if(_0x22c8be){return _0x329bcc[_0xd6ed('0x15')](_0x54e49e)[_0xd6ed('0x16')](_0x22c8be);}};}function respondWithFilteredResult(_0x544eca,_0x5554b8){return function(_0x16e529){if(_0x16e529){var _0x29aecd=typeof _0x5554b8[_0xd6ed('0x17')]===_0xd6ed('0x18')&&typeof _0x5554b8['limit']===_0xd6ed('0x18');var _0x1957d7=_0x16e529[_0xd6ed('0x19')];var _0xe209dd=_0x29aecd?0x0:_0x5554b8[_0xd6ed('0x17')];var _0x3ed694=_0x29aecd?_0x16e529[_0xd6ed('0x19')]:_0x5554b8[_0xd6ed('0x17')]+_0x5554b8['limit'];var _0xe7f281;if(_0x3ed694>=_0x1957d7){_0x3ed694=_0x1957d7;_0xe7f281=0xc8;}else{_0xe7f281=0xce;}_0x544eca['status'](_0xe7f281);return _0x544eca[_0xd6ed('0x1a')](_0xd6ed('0x1b'),_0xe209dd+'-'+_0x3ed694+'/'+_0x1957d7)['json'](_0x16e529);}return null;};}function patchUpdates(_0x3a7dba){return function(_0x1d41b1){try{jsonpatch[_0xd6ed('0x1c')](_0x1d41b1,_0x3a7dba,!![]);}catch(_0xce43d0){return BPromise[_0xd6ed('0x1d')](_0xce43d0);}return _0x1d41b1['save']();};}function saveUpdates(_0x260dc2,_0x2d91f1){return function(_0x4d739f){if(_0x4d739f){return _0x4d739f[_0xd6ed('0x1e')](_0x260dc2)[_0xd6ed('0x1f')](function(_0x213b22){return _0x213b22;});}return null;};}function removeEntity(_0x187cad,_0x1442da){return function(_0x3e3cdb){if(_0x3e3cdb){return _0x3e3cdb[_0xd6ed('0x20')]()[_0xd6ed('0x1f')](function(){_0x187cad[_0xd6ed('0x15')](0xcc)[_0xd6ed('0x21')]();});}};}function handleEntityNotFound(_0x5edde6,_0x459f12){return function(_0x2712de){if(!_0x2712de){_0x5edde6[_0xd6ed('0x14')](0x194);}return _0x2712de;};}function handleError(_0x2b9bc3,_0x487954){_0x487954=_0x487954||0x1f4;return function(_0x403fba){logger[_0xd6ed('0x22')](_0x403fba[_0xd6ed('0x23')]);if(_0x403fba['name']){delete _0x403fba['name'];}_0x2b9bc3['status'](_0x487954)[_0xd6ed('0x24')](_0x403fba);};}exports[_0xd6ed('0x25')]=function(_0x382524,_0x27611a){var _0x3376cb={},_0x3dadff={},_0x4d6056={'count':0x0,'rows':[]};var _0x11797b=_[_0xd6ed('0x26')](db['ServicenowConfiguration'][_0xd6ed('0x27')],function(_0x7ceae8){return{'name':_0x7ceae8[_0xd6ed('0x28')],'type':_0x7ceae8[_0xd6ed('0x29')]['key']};});_0x3dadff[_0xd6ed('0x2a')]=_[_0xd6ed('0x26')](_0x11797b,_0xd6ed('0x2b'));_0x3dadff[_0xd6ed('0x2c')]=_[_0xd6ed('0x2d')](_0x382524['query']);_0x3dadff[_0xd6ed('0x2e')]=_[_0xd6ed('0x2f')](_0x3dadff[_0xd6ed('0x2a')],_0x3dadff['query']);_0x3376cb[_0xd6ed('0x30')]=_[_0xd6ed('0x2f')](_0x3dadff[_0xd6ed('0x2a')],qs[_0xd6ed('0x31')](_0x382524[_0xd6ed('0x2c')][_0xd6ed('0x31')]));_0x3376cb[_0xd6ed('0x30')]=_0x3376cb[_0xd6ed('0x30')][_0xd6ed('0x32')]?_0x3376cb[_0xd6ed('0x30')]:_0x3dadff[_0xd6ed('0x2a')];if(!_0x382524[_0xd6ed('0x2c')][_0xd6ed('0x33')](_0xd6ed('0x34'))){_0x3376cb[_0xd6ed('0x35')]=qs['limit'](_0x382524[_0xd6ed('0x2c')]['limit']);_0x3376cb['offset']=qs[_0xd6ed('0x17')](_0x382524['query'][_0xd6ed('0x17')]);}_0x3376cb[_0xd6ed('0x36')]=qs[_0xd6ed('0x37')](_0x382524[_0xd6ed('0x2c')][_0xd6ed('0x37')]);_0x3376cb[_0xd6ed('0x38')]=qs['filters'](_[_0xd6ed('0x39')](_0x382524[_0xd6ed('0x2c')],_0x3dadff['filters']),_0x11797b);if(_0x382524[_0xd6ed('0x2c')][_0xd6ed('0x3a')]){_0x3376cb[_0xd6ed('0x38')]=_[_0xd6ed('0x3b')](_0x3376cb[_0xd6ed('0x38')],{'$or':_['map'](_0x11797b,function(_0x132864){if(_0x132864[_0xd6ed('0x29')]!==_0xd6ed('0x3c')){var _0x14f0e6={};_0x14f0e6[_0x132864[_0xd6ed('0x2b')]]={'$like':'%'+_0x382524[_0xd6ed('0x2c')][_0xd6ed('0x3a')]+'%'};return _0x14f0e6;}})});}_0x3376cb=_['merge']({},_0x3376cb,_0x382524[_0xd6ed('0x3d')]);var _0x11df1e={'where':_0x3376cb[_0xd6ed('0x38')]};return db[_0xd6ed('0x3e')][_0xd6ed('0x19')](_0x11df1e)[_0xd6ed('0x1f')](function(_0x2094f4){_0x4d6056[_0xd6ed('0x19')]=_0x2094f4;if(_0x382524[_0xd6ed('0x2c')]['includeAll']){_0x3376cb['include']=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x3376cb);})[_0xd6ed('0x1f')](function(_0x420c55){_0x4d6056['rows']=_0x420c55;return _0x4d6056;})[_0xd6ed('0x1f')](respondWithFilteredResult(_0x27611a,_0x3376cb))[_0xd6ed('0x3f')](handleError(_0x27611a,null));};exports[_0xd6ed('0x40')]=function(_0x34722f,_0x16eded){var _0x5627c3={'raw':![],'where':{'id':_0x34722f[_0xd6ed('0x41')]['id']}},_0x16c47a={};_0x16c47a[_0xd6ed('0x2a')]=_[_0xd6ed('0x2d')](db['ServicenowConfiguration']['rawAttributes']);_0x16c47a['query']=_[_0xd6ed('0x2d')](_0x34722f[_0xd6ed('0x2c')]);_0x16c47a[_0xd6ed('0x2e')]=_[_0xd6ed('0x2f')](_0x16c47a[_0xd6ed('0x2a')],_0x16c47a[_0xd6ed('0x2c')]);_0x5627c3[_0xd6ed('0x30')]=_[_0xd6ed('0x2f')](_0x16c47a['model'],qs[_0xd6ed('0x31')](_0x34722f['query'][_0xd6ed('0x31')]));_0x5627c3[_0xd6ed('0x30')]=_0x5627c3[_0xd6ed('0x30')][_0xd6ed('0x32')]?_0x5627c3[_0xd6ed('0x30')]:_0x16c47a[_0xd6ed('0x2a')];if(_0x34722f[_0xd6ed('0x2c')][_0xd6ed('0x42')]){_0x5627c3['include']=[{'all':!![]}];}_0x5627c3=_[_0xd6ed('0x3b')]({},_0x5627c3,_0x34722f[_0xd6ed('0x3d')]);return db[_0xd6ed('0x3e')][_0xd6ed('0x43')](_0x5627c3)[_0xd6ed('0x1f')](handleEntityNotFound(_0x16eded,null))[_0xd6ed('0x1f')](respondWithResult(_0x16eded,null))[_0xd6ed('0x3f')](handleError(_0x16eded,null));};exports['create']=function(_0x15df6f,_0x3707a5){return db['ServicenowConfiguration']['create'](_0x15df6f[_0xd6ed('0x44')],{})[_0xd6ed('0x1f')](respondWithResult(_0x3707a5,0xc9))[_0xd6ed('0x3f')](handleError(_0x3707a5,null));};exports[_0xd6ed('0x1e')]=function(_0x3bcbc6,_0x5ed9bc){if(_0x3bcbc6[_0xd6ed('0x44')]['id']){delete _0x3bcbc6[_0xd6ed('0x44')]['id'];}return db['ServicenowConfiguration'][_0xd6ed('0x43')]({'where':{'id':_0x3bcbc6['params']['id']}})[_0xd6ed('0x1f')](handleEntityNotFound(_0x5ed9bc,null))[_0xd6ed('0x1f')](saveUpdates(_0x3bcbc6[_0xd6ed('0x44')],null))['then'](respondWithResult(_0x5ed9bc,null))[_0xd6ed('0x3f')](handleError(_0x5ed9bc,null));};exports['destroy']=function(_0x1db594,_0x5c4e2b){return db[_0xd6ed('0x3e')]['find']({'where':{'id':_0x1db594[_0xd6ed('0x41')]['id']}})['then'](handleEntityNotFound(_0x5c4e2b,null))[_0xd6ed('0x1f')](removeEntity(_0x5c4e2b,null))['catch'](handleError(_0x5c4e2b,null));};exports[_0xd6ed('0x45')]=function(_0x4c59b0,_0x477924,_0x215a5a){var _0x595bb5={};var _0x51a416={};var _0x3a735f;var _0x5bf4f6;return db['ServicenowConfiguration'][_0xd6ed('0x46')]({'where':{'id':_0x4c59b0[_0xd6ed('0x41')]['id']}})[_0xd6ed('0x1f')](handleEntityNotFound(_0x477924,null))[_0xd6ed('0x1f')](function(_0x1409e8){if(_0x1409e8){_0x3a735f=_0x1409e8;_0x51a416[_0xd6ed('0x2a')]=_['keys'](db[_0xd6ed('0x47')][_0xd6ed('0x27')]);_0x51a416[_0xd6ed('0x2c')]=_[_0xd6ed('0x2d')](_0x4c59b0[_0xd6ed('0x2c')]);_0x51a416[_0xd6ed('0x2e')]=_[_0xd6ed('0x2f')](_0x51a416[_0xd6ed('0x2a')],_0x51a416[_0xd6ed('0x2c')]);_0x595bb5[_0xd6ed('0x30')]=_['intersection'](_0x51a416['model'],qs[_0xd6ed('0x31')](_0x4c59b0[_0xd6ed('0x2c')][_0xd6ed('0x31')]));_0x595bb5[_0xd6ed('0x30')]=_0x595bb5[_0xd6ed('0x30')][_0xd6ed('0x32')]?_0x595bb5[_0xd6ed('0x30')]:_0x51a416[_0xd6ed('0x2a')];_0x595bb5[_0xd6ed('0x36')]=qs[_0xd6ed('0x37')](_0x4c59b0[_0xd6ed('0x2c')]['sort']);_0x595bb5['where']=qs[_0xd6ed('0x2e')](_[_0xd6ed('0x39')](_0x4c59b0[_0xd6ed('0x2c')],_0x51a416[_0xd6ed('0x2e')]));if(_0x4c59b0[_0xd6ed('0x2c')][_0xd6ed('0x3a')]){_0x595bb5[_0xd6ed('0x38')]=_[_0xd6ed('0x3b')](_0x595bb5['where'],{'$or':_['map'](_0x595bb5['attributes'],function(_0x5ac42d){var _0x1ad9fd={};_0x1ad9fd[_0x5ac42d]={'$like':'%'+_0x4c59b0[_0xd6ed('0x2c')][_0xd6ed('0x3a')]+'%'};return _0x1ad9fd;})});}_0x595bb5=_[_0xd6ed('0x3b')]({},_0x595bb5,_0x4c59b0[_0xd6ed('0x3d')]);return _0x3a735f['getFields'](_0x595bb5);}})[_0xd6ed('0x1f')](function(_0x31bd36){if(_0x31bd36){_0x5bf4f6=_0x31bd36['length'];if(!_0x4c59b0[_0xd6ed('0x2c')][_0xd6ed('0x33')](_0xd6ed('0x34'))){_0x595bb5[_0xd6ed('0x35')]=qs[_0xd6ed('0x35')](_0x4c59b0[_0xd6ed('0x2c')][_0xd6ed('0x35')]);_0x595bb5[_0xd6ed('0x17')]=qs[_0xd6ed('0x17')](_0x4c59b0[_0xd6ed('0x2c')]['offset']);}return _0x3a735f[_0xd6ed('0x45')](_0x595bb5);}})['then'](function(_0x2d4655){if(_0x2d4655){return _0x2d4655?{'count':_0x5bf4f6,'rows':_0x2d4655}:null;}})['then'](respondWithResult(_0x477924,null))[_0xd6ed('0x3f')](handleError(_0x477924,null));};exports[_0xd6ed('0x48')]=function(_0x1fc3cd,_0x1482ca,_0x333963){var _0x265c9d={};var _0x4672b6={};var _0x200fd7;var _0x137431;return db[_0xd6ed('0x3e')][_0xd6ed('0x46')]({'where':{'id':_0x1fc3cd[_0xd6ed('0x41')]['id']}})['then'](handleEntityNotFound(_0x1482ca,null))['then'](function(_0x29f6db){if(_0x29f6db){_0x200fd7=_0x29f6db;_0x4672b6['model']=_['keys'](db[_0xd6ed('0x47')]['rawAttributes']);_0x4672b6[_0xd6ed('0x2c')]=_[_0xd6ed('0x2d')](_0x1fc3cd[_0xd6ed('0x2c')]);_0x4672b6[_0xd6ed('0x2e')]=_['intersection'](_0x4672b6['model'],_0x4672b6[_0xd6ed('0x2c')]);_0x265c9d[_0xd6ed('0x30')]=_[_0xd6ed('0x2f')](_0x4672b6[_0xd6ed('0x2a')],qs[_0xd6ed('0x31')](_0x1fc3cd['query'][_0xd6ed('0x31')]));_0x265c9d['attributes']=_0x265c9d[_0xd6ed('0x30')][_0xd6ed('0x32')]?_0x265c9d[_0xd6ed('0x30')]:_0x4672b6[_0xd6ed('0x2a')];_0x265c9d['order']=qs[_0xd6ed('0x37')](_0x1fc3cd[_0xd6ed('0x2c')]['sort']);_0x265c9d[_0xd6ed('0x38')]=qs[_0xd6ed('0x2e')](_['pick'](_0x1fc3cd['query'],_0x4672b6['filters']));if(_0x1fc3cd[_0xd6ed('0x2c')][_0xd6ed('0x3a')]){_0x265c9d[_0xd6ed('0x38')]=_['merge'](_0x265c9d['where'],{'$or':_[_0xd6ed('0x26')](_0x265c9d[_0xd6ed('0x30')],function(_0x13df66){var _0x52d9d1={};_0x52d9d1[_0x13df66]={'$like':'%'+_0x1fc3cd[_0xd6ed('0x2c')][_0xd6ed('0x3a')]+'%'};return _0x52d9d1;})});}_0x265c9d=_[_0xd6ed('0x3b')]({},_0x265c9d,_0x1fc3cd[_0xd6ed('0x3d')]);return _0x200fd7[_0xd6ed('0x48')](_0x265c9d);}})['then'](function(_0x1415e1){if(_0x1415e1){_0x137431=_0x1415e1[_0xd6ed('0x32')];if(!_0x1fc3cd[_0xd6ed('0x2c')][_0xd6ed('0x33')](_0xd6ed('0x34'))){_0x265c9d[_0xd6ed('0x35')]=qs[_0xd6ed('0x35')](_0x1fc3cd['query'][_0xd6ed('0x35')]);_0x265c9d['offset']=qs[_0xd6ed('0x17')](_0x1fc3cd[_0xd6ed('0x2c')][_0xd6ed('0x17')]);}return _0x200fd7['getSubjects'](_0x265c9d);}})[_0xd6ed('0x1f')](function(_0x10d5a6){if(_0x10d5a6){return _0x10d5a6?{'count':_0x137431,'rows':_0x10d5a6}:null;}})[_0xd6ed('0x1f')](respondWithResult(_0x1482ca,null))['catch'](handleError(_0x1482ca,null));};exports['getDescriptions']=function(_0x2929c6,_0xebba20,_0x3e1a08){var _0x57d267={};var _0x156950={};var _0x41edea;var _0x4b711d;return db[_0xd6ed('0x3e')]['findOne']({'where':{'id':_0x2929c6[_0xd6ed('0x41')]['id']}})[_0xd6ed('0x1f')](handleEntityNotFound(_0xebba20,null))[_0xd6ed('0x1f')](function(_0x4e67bb){if(_0x4e67bb){_0x41edea=_0x4e67bb;_0x156950[_0xd6ed('0x2a')]=_['keys'](db[_0xd6ed('0x47')][_0xd6ed('0x27')]);_0x156950['query']=_[_0xd6ed('0x2d')](_0x2929c6[_0xd6ed('0x2c')]);_0x156950['filters']=_[_0xd6ed('0x2f')](_0x156950['model'],_0x156950[_0xd6ed('0x2c')]);_0x57d267[_0xd6ed('0x30')]=_[_0xd6ed('0x2f')](_0x156950[_0xd6ed('0x2a')],qs['fields'](_0x2929c6[_0xd6ed('0x2c')][_0xd6ed('0x31')]));_0x57d267[_0xd6ed('0x30')]=_0x57d267['attributes']['length']?_0x57d267[_0xd6ed('0x30')]:_0x156950[_0xd6ed('0x2a')];_0x57d267[_0xd6ed('0x36')]=qs[_0xd6ed('0x37')](_0x2929c6[_0xd6ed('0x2c')][_0xd6ed('0x37')]);_0x57d267[_0xd6ed('0x38')]=qs[_0xd6ed('0x2e')](_[_0xd6ed('0x39')](_0x2929c6[_0xd6ed('0x2c')],_0x156950['filters']));if(_0x2929c6[_0xd6ed('0x2c')][_0xd6ed('0x3a')]){_0x57d267['where']=_[_0xd6ed('0x3b')](_0x57d267[_0xd6ed('0x38')],{'$or':_[_0xd6ed('0x26')](_0x57d267['attributes'],function(_0x455593){var _0x4d961c={};_0x4d961c[_0x455593]={'$like':'%'+_0x2929c6[_0xd6ed('0x2c')][_0xd6ed('0x3a')]+'%'};return _0x4d961c;})});}_0x57d267=_[_0xd6ed('0x3b')]({},_0x57d267,_0x2929c6[_0xd6ed('0x3d')]);return _0x41edea['getDescriptions'](_0x57d267);}})[_0xd6ed('0x1f')](function(_0x20ca30){if(_0x20ca30){_0x4b711d=_0x20ca30[_0xd6ed('0x32')];if(!_0x2929c6['query'][_0xd6ed('0x33')](_0xd6ed('0x34'))){_0x57d267[_0xd6ed('0x35')]=qs['limit'](_0x2929c6[_0xd6ed('0x2c')][_0xd6ed('0x35')]);_0x57d267[_0xd6ed('0x17')]=qs[_0xd6ed('0x17')](_0x2929c6[_0xd6ed('0x2c')][_0xd6ed('0x17')]);}return _0x41edea[_0xd6ed('0x49')](_0x57d267);}})[_0xd6ed('0x1f')](function(_0x2cbe7f){if(_0x2cbe7f){return _0x2cbe7f?{'count':_0x4b711d,'rows':_0x2cbe7f}:null;}})['then'](respondWithResult(_0xebba20,null))[_0xd6ed('0x3f')](handleError(_0xebba20,null));}; \ No newline at end of file +var _0xa4af=['pick','filter','merge','options','includeAll','include','catch','show','params','intersection','length','create','body','find','getFields','findOne','ServicenowField','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','fields','attributes','nolimit','order','sort','where','filters'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xa4af,0x190));var _0xfa4a=function(_0x468232,_0x26723f){_0x468232=_0x468232-0x0;var _0x2ed593=_0xa4af[_0x468232];return _0x2ed593;};'use strict';var emlformat=require(_0xfa4a('0x0'));var rimraf=require(_0xfa4a('0x1'));var zipdir=require(_0xfa4a('0x2'));var jsonpatch=require(_0xfa4a('0x3'));var rp=require('request-promise');var moment=require(_0xfa4a('0x4'));var BPromise=require(_0xfa4a('0x5'));var Mustache=require(_0xfa4a('0x6'));var util=require(_0xfa4a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xfa4a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa4a('0x9'));var _=require(_0xfa4a('0xa'));var squel=require(_0xfa4a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfa4a('0xc'));var toCsv=require(_0xfa4a('0x8'));var querystring=require('querystring');var Papa=require(_0xfa4a('0xd'));var Redis=require(_0xfa4a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfa4a('0xf'));var as=require(_0xfa4a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfa4a('0x11'));var utils=require('../../config/utils');var config=require(_0xfa4a('0x12'));var licenseUtil=require(_0xfa4a('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31c920,_0x278659){_0x278659=_0x278659||0xcc;return function(_0x43a275){if(_0x43a275){return _0x31c920[_0xfa4a('0x14')](_0x278659);}return _0x31c920['status'](_0x278659)[_0xfa4a('0x15')]();};}function respondWithResult(_0x4a2645,_0x46a4f3){_0x46a4f3=_0x46a4f3||0xc8;return function(_0x24dd4e){if(_0x24dd4e){return _0x4a2645[_0xfa4a('0x16')](_0x46a4f3)[_0xfa4a('0x17')](_0x24dd4e);}};}function respondWithFilteredResult(_0x1af538,_0x2cde10){return function(_0x28220e){if(_0x28220e){var _0x2bdab1=typeof _0x2cde10[_0xfa4a('0x18')]===_0xfa4a('0x19')&&typeof _0x2cde10[_0xfa4a('0x1a')]===_0xfa4a('0x19');var _0x3faec0=_0x28220e['count'];var _0x457a17=_0x2bdab1?0x0:_0x2cde10[_0xfa4a('0x18')];var _0x2960f1=_0x2bdab1?_0x28220e[_0xfa4a('0x1b')]:_0x2cde10['offset']+_0x2cde10[_0xfa4a('0x1a')];var _0x5930f0;if(_0x2960f1>=_0x3faec0){_0x2960f1=_0x3faec0;_0x5930f0=0xc8;}else{_0x5930f0=0xce;}_0x1af538['status'](_0x5930f0);return _0x1af538[_0xfa4a('0x1c')](_0xfa4a('0x1d'),_0x457a17+'-'+_0x2960f1+'/'+_0x3faec0)[_0xfa4a('0x17')](_0x28220e);}return null;};}function patchUpdates(_0x1ac6f0){return function(_0x4a72e1){try{jsonpatch[_0xfa4a('0x1e')](_0x4a72e1,_0x1ac6f0,!![]);}catch(_0x94dca5){return BPromise[_0xfa4a('0x1f')](_0x94dca5);}return _0x4a72e1[_0xfa4a('0x20')]();};}function saveUpdates(_0x1b1f62,_0x1c43a4){return function(_0x58e9cc){if(_0x58e9cc){return _0x58e9cc[_0xfa4a('0x21')](_0x1b1f62)[_0xfa4a('0x22')](function(_0x5a3fca){return _0x5a3fca;});}return null;};}function removeEntity(_0x12d590,_0x37baf1){return function(_0x3a6b07){if(_0x3a6b07){return _0x3a6b07[_0xfa4a('0x23')]()[_0xfa4a('0x22')](function(){_0x12d590['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e4079,_0x99699f){return function(_0x430654){if(!_0x430654){_0x5e4079['sendStatus'](0x194);}return _0x430654;};}function handleError(_0x3ea802,_0x5c23df){_0x5c23df=_0x5c23df||0x1f4;return function(_0x599dc9){logger[_0xfa4a('0x24')](_0x599dc9['stack']);if(_0x599dc9[_0xfa4a('0x25')]){delete _0x599dc9[_0xfa4a('0x25')];}_0x3ea802[_0xfa4a('0x16')](_0x5c23df)[_0xfa4a('0x26')](_0x599dc9);};}exports[_0xfa4a('0x27')]=function(_0x40cfb9,_0x389b88){var _0x51b3fb={},_0x16a040={},_0x5e621e={'count':0x0,'rows':[]};var _0x2a537b=_[_0xfa4a('0x28')](db[_0xfa4a('0x29')][_0xfa4a('0x2a')],function(_0x175ad3){return{'name':_0x175ad3[_0xfa4a('0x2b')],'type':_0x175ad3[_0xfa4a('0x2c')][_0xfa4a('0x2d')]};});_0x16a040[_0xfa4a('0x2e')]=_[_0xfa4a('0x28')](_0x2a537b,_0xfa4a('0x25'));_0x16a040[_0xfa4a('0x2f')]=_[_0xfa4a('0x30')](_0x40cfb9['query']);_0x16a040['filters']=_['intersection'](_0x16a040[_0xfa4a('0x2e')],_0x16a040[_0xfa4a('0x2f')]);_0x51b3fb['attributes']=_['intersection'](_0x16a040[_0xfa4a('0x2e')],qs[_0xfa4a('0x31')](_0x40cfb9[_0xfa4a('0x2f')][_0xfa4a('0x31')]));_0x51b3fb[_0xfa4a('0x32')]=_0x51b3fb[_0xfa4a('0x32')]['length']?_0x51b3fb[_0xfa4a('0x32')]:_0x16a040[_0xfa4a('0x2e')];if(!_0x40cfb9['query']['hasOwnProperty'](_0xfa4a('0x33'))){_0x51b3fb['limit']=qs[_0xfa4a('0x1a')](_0x40cfb9[_0xfa4a('0x2f')][_0xfa4a('0x1a')]);_0x51b3fb[_0xfa4a('0x18')]=qs[_0xfa4a('0x18')](_0x40cfb9[_0xfa4a('0x2f')]['offset']);}_0x51b3fb[_0xfa4a('0x34')]=qs[_0xfa4a('0x35')](_0x40cfb9[_0xfa4a('0x2f')][_0xfa4a('0x35')]);_0x51b3fb[_0xfa4a('0x36')]=qs[_0xfa4a('0x37')](_[_0xfa4a('0x38')](_0x40cfb9[_0xfa4a('0x2f')],_0x16a040[_0xfa4a('0x37')]),_0x2a537b);if(_0x40cfb9['query'][_0xfa4a('0x39')]){_0x51b3fb[_0xfa4a('0x36')]=_[_0xfa4a('0x3a')](_0x51b3fb[_0xfa4a('0x36')],{'$or':_[_0xfa4a('0x28')](_0x2a537b,function(_0x543786){if(_0x543786[_0xfa4a('0x2c')]!=='VIRTUAL'){var _0x3d3817={};_0x3d3817[_0x543786[_0xfa4a('0x25')]]={'$like':'%'+_0x40cfb9[_0xfa4a('0x2f')][_0xfa4a('0x39')]+'%'};return _0x3d3817;}})});}_0x51b3fb=_[_0xfa4a('0x3a')]({},_0x51b3fb,_0x40cfb9[_0xfa4a('0x3b')]);var _0x51bce8={'where':_0x51b3fb['where']};return db['ServicenowConfiguration']['count'](_0x51bce8)['then'](function(_0x610b74){_0x5e621e['count']=_0x610b74;if(_0x40cfb9[_0xfa4a('0x2f')][_0xfa4a('0x3c')]){_0x51b3fb[_0xfa4a('0x3d')]=[{'all':!![]}];}return db[_0xfa4a('0x29')]['findAll'](_0x51b3fb);})[_0xfa4a('0x22')](function(_0x31e134){_0x5e621e['rows']=_0x31e134;return _0x5e621e;})[_0xfa4a('0x22')](respondWithFilteredResult(_0x389b88,_0x51b3fb))[_0xfa4a('0x3e')](handleError(_0x389b88,null));};exports[_0xfa4a('0x3f')]=function(_0x28a929,_0x1869eb){var _0x26d9a9={'raw':![],'where':{'id':_0x28a929[_0xfa4a('0x40')]['id']}},_0x1c5f72={};_0x1c5f72[_0xfa4a('0x2e')]=_['keys'](db['ServicenowConfiguration'][_0xfa4a('0x2a')]);_0x1c5f72['query']=_[_0xfa4a('0x30')](_0x28a929[_0xfa4a('0x2f')]);_0x1c5f72[_0xfa4a('0x37')]=_['intersection'](_0x1c5f72[_0xfa4a('0x2e')],_0x1c5f72['query']);_0x26d9a9[_0xfa4a('0x32')]=_[_0xfa4a('0x41')](_0x1c5f72[_0xfa4a('0x2e')],qs[_0xfa4a('0x31')](_0x28a929[_0xfa4a('0x2f')][_0xfa4a('0x31')]));_0x26d9a9[_0xfa4a('0x32')]=_0x26d9a9['attributes'][_0xfa4a('0x42')]?_0x26d9a9['attributes']:_0x1c5f72[_0xfa4a('0x2e')];if(_0x28a929[_0xfa4a('0x2f')][_0xfa4a('0x3c')]){_0x26d9a9[_0xfa4a('0x3d')]=[{'all':!![]}];}_0x26d9a9=_['merge']({},_0x26d9a9,_0x28a929['options']);return db[_0xfa4a('0x29')]['find'](_0x26d9a9)[_0xfa4a('0x22')](handleEntityNotFound(_0x1869eb,null))[_0xfa4a('0x22')](respondWithResult(_0x1869eb,null))[_0xfa4a('0x3e')](handleError(_0x1869eb,null));};exports[_0xfa4a('0x43')]=function(_0x6e7b7,_0x55c1f5){return db[_0xfa4a('0x29')][_0xfa4a('0x43')](_0x6e7b7[_0xfa4a('0x44')],{})['then'](respondWithResult(_0x55c1f5,0xc9))[_0xfa4a('0x3e')](handleError(_0x55c1f5,null));};exports[_0xfa4a('0x21')]=function(_0x1a0dca,_0x2f695a){if(_0x1a0dca[_0xfa4a('0x44')]['id']){delete _0x1a0dca[_0xfa4a('0x44')]['id'];}return db[_0xfa4a('0x29')][_0xfa4a('0x45')]({'where':{'id':_0x1a0dca['params']['id']}})[_0xfa4a('0x22')](handleEntityNotFound(_0x2f695a,null))[_0xfa4a('0x22')](saveUpdates(_0x1a0dca[_0xfa4a('0x44')],null))[_0xfa4a('0x22')](respondWithResult(_0x2f695a,null))[_0xfa4a('0x3e')](handleError(_0x2f695a,null));};exports[_0xfa4a('0x23')]=function(_0x1383c5,_0x879837){return db['ServicenowConfiguration'][_0xfa4a('0x45')]({'where':{'id':_0x1383c5[_0xfa4a('0x40')]['id']}})[_0xfa4a('0x22')](handleEntityNotFound(_0x879837,null))['then'](removeEntity(_0x879837,null))[_0xfa4a('0x3e')](handleError(_0x879837,null));};exports[_0xfa4a('0x46')]=function(_0x1420bc,_0x2ce751,_0x4772b7){var _0x345fc4={};var _0x2b20cd={};var _0x374e08;var _0xa404b9;return db[_0xfa4a('0x29')][_0xfa4a('0x47')]({'where':{'id':_0x1420bc[_0xfa4a('0x40')]['id']}})[_0xfa4a('0x22')](handleEntityNotFound(_0x2ce751,null))[_0xfa4a('0x22')](function(_0x1f72ae){if(_0x1f72ae){_0x374e08=_0x1f72ae;_0x2b20cd[_0xfa4a('0x2e')]=_[_0xfa4a('0x30')](db[_0xfa4a('0x48')][_0xfa4a('0x2a')]);_0x2b20cd[_0xfa4a('0x2f')]=_['keys'](_0x1420bc[_0xfa4a('0x2f')]);_0x2b20cd[_0xfa4a('0x37')]=_[_0xfa4a('0x41')](_0x2b20cd[_0xfa4a('0x2e')],_0x2b20cd['query']);_0x345fc4[_0xfa4a('0x32')]=_['intersection'](_0x2b20cd[_0xfa4a('0x2e')],qs[_0xfa4a('0x31')](_0x1420bc['query'][_0xfa4a('0x31')]));_0x345fc4[_0xfa4a('0x32')]=_0x345fc4['attributes'][_0xfa4a('0x42')]?_0x345fc4[_0xfa4a('0x32')]:_0x2b20cd[_0xfa4a('0x2e')];_0x345fc4[_0xfa4a('0x34')]=qs['sort'](_0x1420bc[_0xfa4a('0x2f')][_0xfa4a('0x35')]);_0x345fc4[_0xfa4a('0x36')]=qs[_0xfa4a('0x37')](_['pick'](_0x1420bc[_0xfa4a('0x2f')],_0x2b20cd[_0xfa4a('0x37')]));if(_0x1420bc[_0xfa4a('0x2f')][_0xfa4a('0x39')]){_0x345fc4[_0xfa4a('0x36')]=_[_0xfa4a('0x3a')](_0x345fc4[_0xfa4a('0x36')],{'$or':_['map'](_0x345fc4[_0xfa4a('0x32')],function(_0x5900dc){var _0x544628={};_0x544628[_0x5900dc]={'$like':'%'+_0x1420bc[_0xfa4a('0x2f')][_0xfa4a('0x39')]+'%'};return _0x544628;})});}_0x345fc4=_['merge']({},_0x345fc4,_0x1420bc[_0xfa4a('0x3b')]);return _0x374e08[_0xfa4a('0x46')](_0x345fc4);}})[_0xfa4a('0x22')](function(_0x23485b){if(_0x23485b){_0xa404b9=_0x23485b[_0xfa4a('0x42')];if(!_0x1420bc[_0xfa4a('0x2f')]['hasOwnProperty']('nolimit')){_0x345fc4[_0xfa4a('0x1a')]=qs[_0xfa4a('0x1a')](_0x1420bc['query'][_0xfa4a('0x1a')]);_0x345fc4[_0xfa4a('0x18')]=qs[_0xfa4a('0x18')](_0x1420bc['query'][_0xfa4a('0x18')]);}return _0x374e08[_0xfa4a('0x46')](_0x345fc4);}})[_0xfa4a('0x22')](function(_0x46b683){if(_0x46b683){return _0x46b683?{'count':_0xa404b9,'rows':_0x46b683}:null;}})[_0xfa4a('0x22')](respondWithResult(_0x2ce751,null))['catch'](handleError(_0x2ce751,null));};exports[_0xfa4a('0x49')]=function(_0x236868,_0x399c65,_0x352543){var _0x260c1d={};var _0x255795={};var _0x573d23;var _0x54da31;return db['ServicenowConfiguration'][_0xfa4a('0x47')]({'where':{'id':_0x236868[_0xfa4a('0x40')]['id']}})[_0xfa4a('0x22')](handleEntityNotFound(_0x399c65,null))['then'](function(_0x47db63){if(_0x47db63){_0x573d23=_0x47db63;_0x255795[_0xfa4a('0x2e')]=_['keys'](db[_0xfa4a('0x48')][_0xfa4a('0x2a')]);_0x255795['query']=_[_0xfa4a('0x30')](_0x236868[_0xfa4a('0x2f')]);_0x255795[_0xfa4a('0x37')]=_[_0xfa4a('0x41')](_0x255795[_0xfa4a('0x2e')],_0x255795[_0xfa4a('0x2f')]);_0x260c1d['attributes']=_['intersection'](_0x255795[_0xfa4a('0x2e')],qs[_0xfa4a('0x31')](_0x236868[_0xfa4a('0x2f')][_0xfa4a('0x31')]));_0x260c1d[_0xfa4a('0x32')]=_0x260c1d['attributes']['length']?_0x260c1d['attributes']:_0x255795[_0xfa4a('0x2e')];_0x260c1d[_0xfa4a('0x34')]=qs[_0xfa4a('0x35')](_0x236868[_0xfa4a('0x2f')]['sort']);_0x260c1d[_0xfa4a('0x36')]=qs[_0xfa4a('0x37')](_[_0xfa4a('0x38')](_0x236868[_0xfa4a('0x2f')],_0x255795[_0xfa4a('0x37')]));if(_0x236868[_0xfa4a('0x2f')]['filter']){_0x260c1d[_0xfa4a('0x36')]=_[_0xfa4a('0x3a')](_0x260c1d[_0xfa4a('0x36')],{'$or':_[_0xfa4a('0x28')](_0x260c1d[_0xfa4a('0x32')],function(_0x5c8288){var _0x25735f={};_0x25735f[_0x5c8288]={'$like':'%'+_0x236868[_0xfa4a('0x2f')][_0xfa4a('0x39')]+'%'};return _0x25735f;})});}_0x260c1d=_[_0xfa4a('0x3a')]({},_0x260c1d,_0x236868[_0xfa4a('0x3b')]);return _0x573d23['getSubjects'](_0x260c1d);}})[_0xfa4a('0x22')](function(_0x2c30f2){if(_0x2c30f2){_0x54da31=_0x2c30f2[_0xfa4a('0x42')];if(!_0x236868[_0xfa4a('0x2f')][_0xfa4a('0x4a')]('nolimit')){_0x260c1d[_0xfa4a('0x1a')]=qs[_0xfa4a('0x1a')](_0x236868[_0xfa4a('0x2f')][_0xfa4a('0x1a')]);_0x260c1d[_0xfa4a('0x18')]=qs['offset'](_0x236868[_0xfa4a('0x2f')][_0xfa4a('0x18')]);}return _0x573d23['getSubjects'](_0x260c1d);}})[_0xfa4a('0x22')](function(_0x36a29e){if(_0x36a29e){return _0x36a29e?{'count':_0x54da31,'rows':_0x36a29e}:null;}})['then'](respondWithResult(_0x399c65,null))[_0xfa4a('0x3e')](handleError(_0x399c65,null));};exports['getDescriptions']=function(_0x5cc11c,_0x1bd9e3,_0x431eb1){var _0x171da6={};var _0x138f10={};var _0x5f11b9;var _0x122075;return db[_0xfa4a('0x29')][_0xfa4a('0x47')]({'where':{'id':_0x5cc11c[_0xfa4a('0x40')]['id']}})['then'](handleEntityNotFound(_0x1bd9e3,null))[_0xfa4a('0x22')](function(_0x126f7f){if(_0x126f7f){_0x5f11b9=_0x126f7f;_0x138f10[_0xfa4a('0x2e')]=_[_0xfa4a('0x30')](db[_0xfa4a('0x48')][_0xfa4a('0x2a')]);_0x138f10[_0xfa4a('0x2f')]=_[_0xfa4a('0x30')](_0x5cc11c['query']);_0x138f10['filters']=_[_0xfa4a('0x41')](_0x138f10['model'],_0x138f10['query']);_0x171da6[_0xfa4a('0x32')]=_[_0xfa4a('0x41')](_0x138f10[_0xfa4a('0x2e')],qs[_0xfa4a('0x31')](_0x5cc11c[_0xfa4a('0x2f')]['fields']));_0x171da6['attributes']=_0x171da6['attributes']['length']?_0x171da6[_0xfa4a('0x32')]:_0x138f10[_0xfa4a('0x2e')];_0x171da6[_0xfa4a('0x34')]=qs[_0xfa4a('0x35')](_0x5cc11c[_0xfa4a('0x2f')]['sort']);_0x171da6[_0xfa4a('0x36')]=qs[_0xfa4a('0x37')](_['pick'](_0x5cc11c[_0xfa4a('0x2f')],_0x138f10[_0xfa4a('0x37')]));if(_0x5cc11c[_0xfa4a('0x2f')]['filter']){_0x171da6['where']=_['merge'](_0x171da6[_0xfa4a('0x36')],{'$or':_[_0xfa4a('0x28')](_0x171da6['attributes'],function(_0x26f532){var _0x45afe2={};_0x45afe2[_0x26f532]={'$like':'%'+_0x5cc11c[_0xfa4a('0x2f')][_0xfa4a('0x39')]+'%'};return _0x45afe2;})});}_0x171da6=_[_0xfa4a('0x3a')]({},_0x171da6,_0x5cc11c[_0xfa4a('0x3b')]);return _0x5f11b9[_0xfa4a('0x4b')](_0x171da6);}})['then'](function(_0x2b7484){if(_0x2b7484){_0x122075=_0x2b7484[_0xfa4a('0x42')];if(!_0x5cc11c[_0xfa4a('0x2f')][_0xfa4a('0x4a')](_0xfa4a('0x33'))){_0x171da6[_0xfa4a('0x1a')]=qs[_0xfa4a('0x1a')](_0x5cc11c[_0xfa4a('0x2f')][_0xfa4a('0x1a')]);_0x171da6[_0xfa4a('0x18')]=qs[_0xfa4a('0x18')](_0x5cc11c[_0xfa4a('0x2f')]['offset']);}return _0x5f11b9[_0xfa4a('0x4b')](_0x171da6);}})['then'](function(_0x1d1067){if(_0x1d1067){return _0x1d1067?{'count':_0x122075,'rows':_0x1d1067}:null;}})['then'](respondWithResult(_0x1bd9e3,null))[_0xfa4a('0x3e')](handleError(_0x1bd9e3,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 8ff2e39..d6b9f81 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 _0x5987=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger'];(function(_0x469804,_0x407181){var _0x48acdd=function(_0x59c5ac){while(--_0x59c5ac){_0x469804['push'](_0x469804['shift']());}};_0x48acdd(++_0x407181);}(_0x5987,0x128));var _0x7598=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x5987[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x7598('0x0'));var util=require(_0x7598('0x1'));var logger=require(_0x7598('0x2'))(_0x7598('0x3'));var moment=require('moment');var BPromise=require(_0x7598('0x4'));var rp=require(_0x7598('0x5'));var fs=require('fs');var path=require(_0x7598('0x6'));var rimraf=require(_0x7598('0x7'));var config=require(_0x7598('0x8'));var attributes=require(_0x7598('0x9'));module[_0x7598('0xa')]=function(_0x56cc44,_0x1c78e){return _0x56cc44['define'](_0x7598('0xb'),attributes,{'tableName':_0x7598('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c1d=['./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x18090a,_0x1e4ac4){var _0x26483a=function(_0x4003ee){while(--_0x4003ee){_0x18090a['push'](_0x18090a['shift']());}};_0x26483a(++_0x1e4ac4);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x5c6eb9,_0x5b1945){_0x5c6eb9=_0x5c6eb9-0x0;var _0x576c01=_0x9c1d[_0x5c6eb9];return _0x576c01;};'use strict';var _=require(_0xd9c1('0x0'));var util=require(_0xd9c1('0x1'));var logger=require(_0xd9c1('0x2'))('api');var moment=require(_0xd9c1('0x3'));var BPromise=require(_0xd9c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd9c1('0x5'));var rimraf=require(_0xd9c1('0x6'));var config=require('../../config/environment');var attributes=require(_0xd9c1('0x7'));module[_0xd9c1('0x8')]=function(_0x206639,_0x29840f){return _0x206639[_0xd9c1('0x9')](_0xd9c1('0xa'),attributes,{'tableName':_0xd9c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index aa9b664..37bb21e 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 _0xe277=['error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x501fe9,_0x17b8aa){var _0x65b499=function(_0x48974c){while(--_0x48974c){_0x501fe9['push'](_0x501fe9['shift']());}};_0x65b499(++_0x17b8aa);}(_0xe277,0x15e));var _0x7e27=function(_0x50552a,_0x476d7a){_0x50552a=_0x50552a-0x0;var _0x221483=_0xe277[_0x50552a];return _0x221483;};'use strict';var _=require(_0x7e27('0x0'));var util=require(_0x7e27('0x1'));var moment=require('moment');var BPromise=require(_0x7e27('0x2'));var rs=require(_0x7e27('0x3'));var fs=require('fs');var Redis=require(_0x7e27('0x4'));var db=require(_0x7e27('0x5'))['db'];var utils=require(_0x7e27('0x6'));var logger=require('../../config/logger')(_0x7e27('0x7'));var config=require(_0x7e27('0x8'));var jayson=require(_0x7e27('0x9'));var client=jayson[_0x7e27('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x109e6d,_0x226d4f,_0x118112){return new BPromise(function(_0x47d7b2,_0x44d253){return client[_0x7e27('0xb')](_0x109e6d,_0x118112)[_0x7e27('0xc')](function(_0x410095){logger[_0x7e27('0xd')](_0x7e27('0xe'),_0x226d4f,_0x7e27('0xf'));logger['debug'](_0x7e27('0x10'),_0x226d4f,_0x7e27('0xf'),JSON[_0x7e27('0x11')](_0x410095));if(_0x410095[_0x7e27('0x12')]){if(_0x410095['error'][_0x7e27('0x13')]===0x1f4){logger[_0x7e27('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x226d4f,_0x410095[_0x7e27('0x12')][_0x7e27('0x14')]);return _0x44d253(_0x410095[_0x7e27('0x12')][_0x7e27('0x14')]);}logger[_0x7e27('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x226d4f,_0x410095[_0x7e27('0x12')][_0x7e27('0x14')]);return _0x47d7b2(_0x410095[_0x7e27('0x12')][_0x7e27('0x14')]);}else{logger[_0x7e27('0xd')](_0x7e27('0xe'),_0x226d4f,_0x7e27('0xf'));_0x47d7b2(_0x410095[_0x7e27('0x15')]['message']);}})[_0x7e27('0x16')](function(_0x3d9aa9){logger[_0x7e27('0x12')](_0x7e27('0xe'),_0x226d4f,_0x3d9aa9);_0x44d253(_0x3d9aa9);});});} \ No newline at end of file +var _0xb0df=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x26c597,_0x3cedca){var _0x527985=function(_0x3e8805){while(--_0x3e8805){_0x26c597['push'](_0x26c597['shift']());}};_0x527985(++_0x3cedca);}(_0xb0df,0x85));var _0xfb0d=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xb0df[_0x24237f];return _0x48298e;};'use strict';var _=require('lodash');var util=require(_0xfb0d('0x0'));var moment=require(_0xfb0d('0x1'));var BPromise=require(_0xfb0d('0x2'));var rs=require(_0xfb0d('0x3'));var fs=require('fs');var Redis=require(_0xfb0d('0x4'));var db=require(_0xfb0d('0x5'))['db'];var utils=require(_0xfb0d('0x6'));var logger=require(_0xfb0d('0x7'))(_0xfb0d('0x8'));var config=require('../../config/environment');var jayson=require(_0xfb0d('0x9'));var client=jayson[_0xfb0d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b7591,_0xd9beab,_0xee3329){return new BPromise(function(_0x5cf723,_0x57ab8c){return client[_0xfb0d('0xb')](_0x5b7591,_0xee3329)[_0xfb0d('0xc')](function(_0x501d4f){logger[_0xfb0d('0xd')](_0xfb0d('0xe'),_0xd9beab,_0xfb0d('0xf'));logger[_0xfb0d('0x10')](_0xfb0d('0x11'),_0xd9beab,_0xfb0d('0xf'),JSON['stringify'](_0x501d4f));if(_0x501d4f[_0xfb0d('0x12')]){if(_0x501d4f['error'][_0xfb0d('0x13')]===0x1f4){logger[_0xfb0d('0x12')](_0xfb0d('0xe'),_0xd9beab,_0x501d4f[_0xfb0d('0x12')][_0xfb0d('0x14')]);return _0x57ab8c(_0x501d4f[_0xfb0d('0x12')][_0xfb0d('0x14')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0xd9beab,_0x501d4f['error'][_0xfb0d('0x14')]);return _0x5cf723(_0x501d4f[_0xfb0d('0x12')][_0xfb0d('0x14')]);}else{logger[_0xfb0d('0xd')](_0xfb0d('0xe'),_0xd9beab,_0xfb0d('0xf'));_0x5cf723(_0x501d4f[_0xfb0d('0x15')]['message']);}})[_0xfb0d('0x16')](function(_0x116179){logger[_0xfb0d('0x12')](_0xfb0d('0xe'),_0xd9beab,_0x116179);_0x57ab8c(_0x116179);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 6479a78..c6edcc3 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 _0x96fd=['create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x36c610,_0x16f2ee){var _0x183cbd=function(_0x1754ef){while(--_0x1754ef){_0x36c610['push'](_0x36c610['shift']());}};_0x183cbd(++_0x16f2ee);}(_0x96fd,0x12c));var _0xd96f=function(_0x50b295,_0x420eaf){_0x50b295=_0x50b295-0x0;var _0x230324=_0x96fd[_0x50b295];return _0x230324;};'use strict';var multer=require(_0xd96f('0x0'));var util=require(_0xd96f('0x1'));var path=require(_0xd96f('0x2'));var timeout=require('connect-timeout');var express=require(_0xd96f('0x3'));var router=express[_0xd96f('0x4')]();var fs_extra=require(_0xd96f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd96f('0x6'));var config=require(_0xd96f('0x7'));var controller=require(_0xd96f('0x8'));router[_0xd96f('0x9')]('/',auth[_0xd96f('0xa')](),controller[_0xd96f('0xb')]);router[_0xd96f('0x9')](_0xd96f('0xc'),auth[_0xd96f('0xa')](),controller[_0xd96f('0xd')]);router[_0xd96f('0xe')]('/',auth[_0xd96f('0xa')](),controller[_0xd96f('0xf')]);router[_0xd96f('0x10')](_0xd96f('0xc'),auth[_0xd96f('0xa')](),controller[_0xd96f('0x11')]);router[_0xd96f('0x12')]('/:id',auth[_0xd96f('0xa')](),controller[_0xd96f('0x13')]);module[_0xd96f('0x14')]=router; \ No newline at end of file +var _0x7c03=['isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x7c03,0xc7));var _0x37c0=function(_0x492879,_0x574974){_0x492879=_0x492879-0x0;var _0x3a7358=_0x7c03[_0x492879];return _0x3a7358;};'use strict';var multer=require(_0x37c0('0x0'));var util=require(_0x37c0('0x1'));var path=require(_0x37c0('0x2'));var timeout=require(_0x37c0('0x3'));var express=require(_0x37c0('0x4'));var router=express[_0x37c0('0x5')]();var fs_extra=require(_0x37c0('0x6'));var auth=require(_0x37c0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x37c0('0x8'));var controller=require(_0x37c0('0x9'));router['get']('/',auth[_0x37c0('0xa')](),controller[_0x37c0('0xb')]);router['get'](_0x37c0('0xc'),auth[_0x37c0('0xa')](),controller[_0x37c0('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x37c0('0xe')]);router[_0x37c0('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x37c0('0x10')]);router['delete']('/:id',auth[_0x37c0('0xa')](),controller[_0x37c0('0x11')]);module[_0x37c0('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index b2cf938..b205cf2 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 _0x405b=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x35939f,_0x1fdf17){var _0x30a32a=function(_0x37fcd8){while(--_0x37fcd8){_0x35939f['push'](_0x35939f['shift']());}};_0x30a32a(++_0x1fdf17);}(_0x405b,0xc3));var _0xb405=function(_0x1317f0,_0x4fbe29){_0x1317f0=_0x1317f0-0x0;var _0xadbe9=_0x405b[_0x1317f0];return _0xadbe9;};'use strict';var Sequelize=require(_0xb405('0x0'));module[_0xb405('0x1')]={'type':{'type':Sequelize[_0xb405('0x2')](_0xb405('0x3'),_0xb405('0x4'),_0xb405('0x5'),_0xb405('0x6'),'picklist'),'defaultValue':_0xb405('0x3')},'content':{'type':Sequelize[_0xb405('0x7')]},'key':{'type':Sequelize[_0xb405('0x7')]},'keyType':{'type':Sequelize[_0xb405('0x2')](_0xb405('0x3'),_0xb405('0x4'),_0xb405('0x5'))},'keyContent':{'type':Sequelize[_0xb405('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb405('0x7')]},'customField':{'type':Sequelize[_0xb405('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb405('0x7')]}}; \ No newline at end of file +var _0x3b09=['sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN'];(function(_0x4e59f4,_0x991e01){var _0x546a34=function(_0x5dd903){while(--_0x5dd903){_0x4e59f4['push'](_0x4e59f4['shift']());}};_0x546a34(++_0x991e01);}(_0x3b09,0x10e));var _0x93b0=function(_0x256ae9,_0x50cedb){_0x256ae9=_0x256ae9-0x0;var _0x77ad9a=_0x3b09[_0x256ae9];return _0x77ad9a;};'use strict';var Sequelize=require(_0x93b0('0x0'));module[_0x93b0('0x1')]={'type':{'type':Sequelize[_0x93b0('0x2')](_0x93b0('0x3'),_0x93b0('0x4'),'customVariable',_0x93b0('0x5'),_0x93b0('0x6')),'defaultValue':_0x93b0('0x3')},'content':{'type':Sequelize[_0x93b0('0x7')]},'key':{'type':Sequelize[_0x93b0('0x7')]},'keyType':{'type':Sequelize[_0x93b0('0x2')](_0x93b0('0x3'),'variable',_0x93b0('0x8'))},'keyContent':{'type':Sequelize[_0x93b0('0x7')]},'idField':{'type':Sequelize[_0x93b0('0x7')]},'nameField':{'type':Sequelize[_0x93b0('0x7')]},'customField':{'type':Sequelize[_0x93b0('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x93b0('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 52f8eda..81d269d 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 _0x883c=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','destroy','eml-format','rimraf'];(function(_0x243030,_0x22cadc){var _0x402ace=function(_0x77898a){while(--_0x77898a){_0x243030['push'](_0x243030['shift']());}};_0x402ace(++_0x22cadc);}(_0x883c,0x92));var _0xc883=function(_0x3982b6,_0x310550){_0x3982b6=_0x3982b6-0x0;var _0x1e1ff2=_0x883c[_0x3982b6];return _0x1e1ff2;};'use strict';var emlformat=require(_0xc883('0x0'));var rimraf=require(_0xc883('0x1'));var zipdir=require(_0xc883('0x2'));var jsonpatch=require(_0xc883('0x3'));var rp=require(_0xc883('0x4'));var moment=require(_0xc883('0x5'));var BPromise=require(_0xc883('0x6'));var Mustache=require(_0xc883('0x7'));var util=require(_0xc883('0x8'));var path=require(_0xc883('0x9'));var sox=require('sox');var csv=require(_0xc883('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc883('0xb'));var _=require(_0xc883('0xc'));var squel=require(_0xc883('0xd'));var crypto=require(_0xc883('0xe'));var jsforce=require(_0xc883('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc883('0x10'));var Redis=require('ioredis');var authService=require(_0xc883('0x11'));var qs=require(_0xc883('0x12'));var as=require(_0xc883('0x13'));var hardwareService=require(_0xc883('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xc883('0x15'));var config=require(_0xc883('0x16'));var licenseUtil=require(_0xc883('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29d8e7,_0x1cbf0e){_0x1cbf0e=_0x1cbf0e||0xcc;return function(_0x101971){if(_0x101971){return _0x29d8e7[_0xc883('0x18')](_0x1cbf0e);}return _0x29d8e7[_0xc883('0x19')](_0x1cbf0e)[_0xc883('0x1a')]();};}function respondWithResult(_0x5e459b,_0x21b031){_0x21b031=_0x21b031||0xc8;return function(_0x1bd4ee){if(_0x1bd4ee){return _0x5e459b[_0xc883('0x19')](_0x21b031)['json'](_0x1bd4ee);}};}function respondWithFilteredResult(_0x52a804,_0x478619){return function(_0x587724){if(_0x587724){var _0x52620e=typeof _0x478619['offset']===_0xc883('0x1b')&&typeof _0x478619[_0xc883('0x1c')]==='undefined';var _0x451065=_0x587724[_0xc883('0x1d')];var _0x3b05a2=_0x52620e?0x0:_0x478619['offset'];var _0x5eb5e3=_0x52620e?_0x587724[_0xc883('0x1d')]:_0x478619['offset']+_0x478619[_0xc883('0x1c')];var _0x2b3a24;if(_0x5eb5e3>=_0x451065){_0x5eb5e3=_0x451065;_0x2b3a24=0xc8;}else{_0x2b3a24=0xce;}_0x52a804[_0xc883('0x19')](_0x2b3a24);return _0x52a804[_0xc883('0x1e')](_0xc883('0x1f'),_0x3b05a2+'-'+_0x5eb5e3+'/'+_0x451065)[_0xc883('0x20')](_0x587724);}return null;};}function patchUpdates(_0x2e1c84){return function(_0x409bbd){try{jsonpatch['apply'](_0x409bbd,_0x2e1c84,!![]);}catch(_0x3a076d){return BPromise[_0xc883('0x21')](_0x3a076d);}return _0x409bbd[_0xc883('0x22')]();};}function saveUpdates(_0x21edaa,_0x201e22){return function(_0x297d2d){if(_0x297d2d){return _0x297d2d[_0xc883('0x23')](_0x21edaa)['then'](function(_0x4c5983){return _0x4c5983;});}return null;};}function removeEntity(_0x1ee22e,_0x546a90){return function(_0x180664){if(_0x180664){return _0x180664['destroy']()[_0xc883('0x24')](function(){_0x1ee22e[_0xc883('0x19')](0xcc)[_0xc883('0x1a')]();});}};}function handleEntityNotFound(_0x26c1c9,_0x5d6b62){return function(_0x43df2a){if(!_0x43df2a){_0x26c1c9[_0xc883('0x18')](0x194);}return _0x43df2a;};}function handleError(_0x2e4fef,_0x3718c7){_0x3718c7=_0x3718c7||0x1f4;return function(_0x323163){logger[_0xc883('0x25')](_0x323163[_0xc883('0x26')]);if(_0x323163[_0xc883('0x27')]){delete _0x323163['name'];}_0x2e4fef['status'](_0x3718c7)[_0xc883('0x28')](_0x323163);};}exports[_0xc883('0x29')]=function(_0x4afd73,_0x16b162){var _0x421f11={},_0x29810a={},_0x13358e={'count':0x0,'rows':[]};var _0x2617df=_[_0xc883('0x2a')](db[_0xc883('0x2b')][_0xc883('0x2c')],function(_0x2c5791){return{'name':_0x2c5791[_0xc883('0x2d')],'type':_0x2c5791[_0xc883('0x2e')]['key']};});_0x29810a[_0xc883('0x2f')]=_[_0xc883('0x2a')](_0x2617df,_0xc883('0x27'));_0x29810a['query']=_['keys'](_0x4afd73[_0xc883('0x30')]);_0x29810a[_0xc883('0x31')]=_[_0xc883('0x32')](_0x29810a[_0xc883('0x2f')],_0x29810a['query']);_0x421f11[_0xc883('0x33')]=_['intersection'](_0x29810a['model'],qs[_0xc883('0x34')](_0x4afd73['query'][_0xc883('0x34')]));_0x421f11[_0xc883('0x33')]=_0x421f11['attributes']['length']?_0x421f11[_0xc883('0x33')]:_0x29810a['model'];if(!_0x4afd73['query'][_0xc883('0x35')](_0xc883('0x36'))){_0x421f11[_0xc883('0x1c')]=qs['limit'](_0x4afd73['query'][_0xc883('0x1c')]);_0x421f11[_0xc883('0x37')]=qs[_0xc883('0x37')](_0x4afd73[_0xc883('0x30')]['offset']);}_0x421f11[_0xc883('0x38')]=qs[_0xc883('0x39')](_0x4afd73['query'][_0xc883('0x39')]);_0x421f11[_0xc883('0x3a')]=qs['filters'](_[_0xc883('0x3b')](_0x4afd73[_0xc883('0x30')],_0x29810a[_0xc883('0x31')]),_0x2617df);if(_0x4afd73[_0xc883('0x30')][_0xc883('0x3c')]){_0x421f11[_0xc883('0x3a')]=_[_0xc883('0x3d')](_0x421f11['where'],{'$or':_['map'](_0x2617df,function(_0x259bee){if(_0x259bee[_0xc883('0x2e')]!=='VIRTUAL'){var _0x28a9bd={};_0x28a9bd[_0x259bee['name']]={'$like':'%'+_0x4afd73['query'][_0xc883('0x3c')]+'%'};return _0x28a9bd;}})});}_0x421f11=_[_0xc883('0x3d')]({},_0x421f11,_0x4afd73[_0xc883('0x3e')]);var _0x338ff6={'where':_0x421f11[_0xc883('0x3a')]};return db[_0xc883('0x2b')]['count'](_0x338ff6)[_0xc883('0x24')](function(_0x1f400f){_0x13358e[_0xc883('0x1d')]=_0x1f400f;if(_0x4afd73['query'][_0xc883('0x3f')]){_0x421f11[_0xc883('0x40')]=[{'all':!![]}];}return db[_0xc883('0x2b')][_0xc883('0x41')](_0x421f11);})['then'](function(_0x10bb62){_0x13358e[_0xc883('0x42')]=_0x10bb62;return _0x13358e;})['then'](respondWithFilteredResult(_0x16b162,_0x421f11))[_0xc883('0x43')](handleError(_0x16b162,null));};exports[_0xc883('0x44')]=function(_0x266fb5,_0x36a2d8){var _0x4f13d6={'raw':!![],'where':{'id':_0x266fb5[_0xc883('0x45')]['id']}},_0x201bbe={};_0x201bbe[_0xc883('0x2f')]=_[_0xc883('0x46')](db['ServicenowField'][_0xc883('0x2c')]);_0x201bbe[_0xc883('0x30')]=_[_0xc883('0x46')](_0x266fb5[_0xc883('0x30')]);_0x201bbe['filters']=_[_0xc883('0x32')](_0x201bbe[_0xc883('0x2f')],_0x201bbe['query']);_0x4f13d6['attributes']=_[_0xc883('0x32')](_0x201bbe[_0xc883('0x2f')],qs[_0xc883('0x34')](_0x266fb5[_0xc883('0x30')][_0xc883('0x34')]));_0x4f13d6['attributes']=_0x4f13d6[_0xc883('0x33')]['length']?_0x4f13d6[_0xc883('0x33')]:_0x201bbe['model'];if(_0x266fb5[_0xc883('0x30')][_0xc883('0x3f')]){_0x4f13d6[_0xc883('0x40')]=[{'all':!![]}];}_0x4f13d6=_[_0xc883('0x3d')]({},_0x4f13d6,_0x266fb5[_0xc883('0x3e')]);return db[_0xc883('0x2b')][_0xc883('0x47')](_0x4f13d6)[_0xc883('0x24')](handleEntityNotFound(_0x36a2d8,null))[_0xc883('0x24')](respondWithResult(_0x36a2d8,null))[_0xc883('0x43')](handleError(_0x36a2d8,null));};exports['create']=function(_0xbe23ff,_0x419cac){return db[_0xc883('0x2b')]['create'](_0xbe23ff[_0xc883('0x48')],{})['then'](respondWithResult(_0x419cac,0xc9))['catch'](handleError(_0x419cac,null));};exports[_0xc883('0x23')]=function(_0x1fc2c2,_0xc23ede){if(_0x1fc2c2[_0xc883('0x48')]['id']){delete _0x1fc2c2[_0xc883('0x48')]['id'];}return db[_0xc883('0x2b')][_0xc883('0x47')]({'where':{'id':_0x1fc2c2[_0xc883('0x45')]['id']}})['then'](handleEntityNotFound(_0xc23ede,null))[_0xc883('0x24')](saveUpdates(_0x1fc2c2[_0xc883('0x48')],null))[_0xc883('0x24')](respondWithResult(_0xc23ede,null))[_0xc883('0x43')](handleError(_0xc23ede,null));};exports[_0xc883('0x49')]=function(_0xc5647,_0x468899){return db['ServicenowField']['find']({'where':{'id':_0xc5647['params']['id']}})['then'](handleEntityNotFound(_0x468899,null))[_0xc883('0x24')](removeEntity(_0x468899,null))[_0xc883('0x43')](handleError(_0x468899,null));}; \ No newline at end of file +var _0x5d2c=['catch','show','params','rawAttributes','options','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','limit','order','where','filters','filter','merge','type','VIRTUAL','ServicenowField','includeAll','findAll'];(function(_0x3b9127,_0x1fcfc6){var _0x2d3c7c=function(_0x4d618c){while(--_0x4d618c){_0x3b9127['push'](_0x3b9127['shift']());}};_0x2d3c7c(++_0x1fcfc6);}(_0x5d2c,0x1f3));var _0xc5d2=function(_0x478ad3,_0x428b1c){_0x478ad3=_0x478ad3-0x0;var _0x5d68f2=_0x5d2c[_0x478ad3];return _0x5d68f2;};'use strict';var emlformat=require(_0xc5d2('0x0'));var rimraf=require(_0xc5d2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc5d2('0x2'));var rp=require(_0xc5d2('0x3'));var moment=require('moment');var BPromise=require(_0xc5d2('0x4'));var Mustache=require(_0xc5d2('0x5'));var util=require(_0xc5d2('0x6'));var path=require(_0xc5d2('0x7'));var sox=require(_0xc5d2('0x8'));var csv=require(_0xc5d2('0x9'));var ejs=require(_0xc5d2('0xa'));var fs=require('fs');var fs_extra=require(_0xc5d2('0xb'));var _=require(_0xc5d2('0xc'));var squel=require(_0xc5d2('0xd'));var crypto=require(_0xc5d2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc5d2('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc5d2('0x10'));var authService=require(_0xc5d2('0x11'));var qs=require(_0xc5d2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc5d2('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc5d2('0x14'))['db'];function respondWithStatusCode(_0xfccf27,_0x4e57ac){_0x4e57ac=_0x4e57ac||0xcc;return function(_0x368531){if(_0x368531){return _0xfccf27[_0xc5d2('0x15')](_0x4e57ac);}return _0xfccf27[_0xc5d2('0x16')](_0x4e57ac)['end']();};}function respondWithResult(_0x11a97e,_0x49569f){_0x49569f=_0x49569f||0xc8;return function(_0x264e22){if(_0x264e22){return _0x11a97e[_0xc5d2('0x16')](_0x49569f)[_0xc5d2('0x17')](_0x264e22);}};}function respondWithFilteredResult(_0x5011ed,_0x14d9b8){return function(_0x5744df){if(_0x5744df){var _0x3ef4d5=typeof _0x14d9b8[_0xc5d2('0x18')]==='undefined'&&typeof _0x14d9b8['limit']===_0xc5d2('0x19');var _0x25c679=_0x5744df['count'];var _0x86e628=_0x3ef4d5?0x0:_0x14d9b8[_0xc5d2('0x18')];var _0x2fd016=_0x3ef4d5?_0x5744df[_0xc5d2('0x1a')]:_0x14d9b8['offset']+_0x14d9b8['limit'];var _0x9a5a7;if(_0x2fd016>=_0x25c679){_0x2fd016=_0x25c679;_0x9a5a7=0xc8;}else{_0x9a5a7=0xce;}_0x5011ed['status'](_0x9a5a7);return _0x5011ed[_0xc5d2('0x1b')](_0xc5d2('0x1c'),_0x86e628+'-'+_0x2fd016+'/'+_0x25c679)['json'](_0x5744df);}return null;};}function patchUpdates(_0x45900f){return function(_0x5073bf){try{jsonpatch[_0xc5d2('0x1d')](_0x5073bf,_0x45900f,!![]);}catch(_0x4e9d93){return BPromise[_0xc5d2('0x1e')](_0x4e9d93);}return _0x5073bf[_0xc5d2('0x1f')]();};}function saveUpdates(_0x365e58,_0x3d13ba){return function(_0x6ddee6){if(_0x6ddee6){return _0x6ddee6[_0xc5d2('0x20')](_0x365e58)[_0xc5d2('0x21')](function(_0x3214ec){return _0x3214ec;});}return null;};}function removeEntity(_0x1433a7,_0xec4e8a){return function(_0x40c4ec){if(_0x40c4ec){return _0x40c4ec['destroy']()[_0xc5d2('0x21')](function(){_0x1433a7[_0xc5d2('0x16')](0xcc)[_0xc5d2('0x22')]();});}};}function handleEntityNotFound(_0x163420,_0x5a747f){return function(_0x34d62c){if(!_0x34d62c){_0x163420['sendStatus'](0x194);}return _0x34d62c;};}function handleError(_0x15a687,_0x4434c6){_0x4434c6=_0x4434c6||0x1f4;return function(_0x4d4d06){logger[_0xc5d2('0x23')](_0x4d4d06[_0xc5d2('0x24')]);if(_0x4d4d06['name']){delete _0x4d4d06[_0xc5d2('0x25')];}_0x15a687['status'](_0x4434c6)[_0xc5d2('0x26')](_0x4d4d06);};}exports[_0xc5d2('0x27')]=function(_0x336fe8,_0x4d1afd){var _0x9f59e={},_0x4625ae={},_0x297b4f={'count':0x0,'rows':[]};var _0x26f7ae=_['map'](db['ServicenowField']['rawAttributes'],function(_0x2d0fd2){return{'name':_0x2d0fd2['fieldName'],'type':_0x2d0fd2['type'][_0xc5d2('0x28')]};});_0x4625ae[_0xc5d2('0x29')]=_[_0xc5d2('0x2a')](_0x26f7ae,_0xc5d2('0x25'));_0x4625ae[_0xc5d2('0x2b')]=_[_0xc5d2('0x2c')](_0x336fe8['query']);_0x4625ae['filters']=_[_0xc5d2('0x2d')](_0x4625ae[_0xc5d2('0x29')],_0x4625ae['query']);_0x9f59e[_0xc5d2('0x2e')]=_[_0xc5d2('0x2d')](_0x4625ae['model'],qs[_0xc5d2('0x2f')](_0x336fe8['query'][_0xc5d2('0x2f')]));_0x9f59e['attributes']=_0x9f59e[_0xc5d2('0x2e')][_0xc5d2('0x30')]?_0x9f59e[_0xc5d2('0x2e')]:_0x4625ae['model'];if(!_0x336fe8['query']['hasOwnProperty'](_0xc5d2('0x31'))){_0x9f59e['limit']=qs['limit'](_0x336fe8[_0xc5d2('0x2b')][_0xc5d2('0x32')]);_0x9f59e['offset']=qs[_0xc5d2('0x18')](_0x336fe8[_0xc5d2('0x2b')][_0xc5d2('0x18')]);}_0x9f59e[_0xc5d2('0x33')]=qs['sort'](_0x336fe8[_0xc5d2('0x2b')]['sort']);_0x9f59e[_0xc5d2('0x34')]=qs[_0xc5d2('0x35')](_['pick'](_0x336fe8[_0xc5d2('0x2b')],_0x4625ae[_0xc5d2('0x35')]),_0x26f7ae);if(_0x336fe8[_0xc5d2('0x2b')][_0xc5d2('0x36')]){_0x9f59e[_0xc5d2('0x34')]=_[_0xc5d2('0x37')](_0x9f59e[_0xc5d2('0x34')],{'$or':_['map'](_0x26f7ae,function(_0x24367c){if(_0x24367c[_0xc5d2('0x38')]!==_0xc5d2('0x39')){var _0x132e86={};_0x132e86[_0x24367c['name']]={'$like':'%'+_0x336fe8['query'][_0xc5d2('0x36')]+'%'};return _0x132e86;}})});}_0x9f59e=_[_0xc5d2('0x37')]({},_0x9f59e,_0x336fe8['options']);var _0x294a0c={'where':_0x9f59e['where']};return db[_0xc5d2('0x3a')]['count'](_0x294a0c)['then'](function(_0x5aa8a3){_0x297b4f[_0xc5d2('0x1a')]=_0x5aa8a3;if(_0x336fe8['query'][_0xc5d2('0x3b')]){_0x9f59e['include']=[{'all':!![]}];}return db['ServicenowField'][_0xc5d2('0x3c')](_0x9f59e);})['then'](function(_0x28ef2b){_0x297b4f['rows']=_0x28ef2b;return _0x297b4f;})[_0xc5d2('0x21')](respondWithFilteredResult(_0x4d1afd,_0x9f59e))[_0xc5d2('0x3d')](handleError(_0x4d1afd,null));};exports[_0xc5d2('0x3e')]=function(_0x433b04,_0x3637b7){var _0x529f7a={'raw':!![],'where':{'id':_0x433b04[_0xc5d2('0x3f')]['id']}},_0x478b2e={};_0x478b2e['model']=_[_0xc5d2('0x2c')](db[_0xc5d2('0x3a')][_0xc5d2('0x40')]);_0x478b2e['query']=_[_0xc5d2('0x2c')](_0x433b04[_0xc5d2('0x2b')]);_0x478b2e['filters']=_[_0xc5d2('0x2d')](_0x478b2e['model'],_0x478b2e['query']);_0x529f7a[_0xc5d2('0x2e')]=_[_0xc5d2('0x2d')](_0x478b2e[_0xc5d2('0x29')],qs[_0xc5d2('0x2f')](_0x433b04[_0xc5d2('0x2b')][_0xc5d2('0x2f')]));_0x529f7a['attributes']=_0x529f7a[_0xc5d2('0x2e')]['length']?_0x529f7a[_0xc5d2('0x2e')]:_0x478b2e['model'];if(_0x433b04[_0xc5d2('0x2b')][_0xc5d2('0x3b')]){_0x529f7a['include']=[{'all':!![]}];}_0x529f7a=_[_0xc5d2('0x37')]({},_0x529f7a,_0x433b04[_0xc5d2('0x41')]);return db[_0xc5d2('0x3a')][_0xc5d2('0x42')](_0x529f7a)[_0xc5d2('0x21')](handleEntityNotFound(_0x3637b7,null))[_0xc5d2('0x21')](respondWithResult(_0x3637b7,null))['catch'](handleError(_0x3637b7,null));};exports[_0xc5d2('0x43')]=function(_0x2efca8,_0x20c0e1){return db[_0xc5d2('0x3a')][_0xc5d2('0x43')](_0x2efca8[_0xc5d2('0x44')],{})[_0xc5d2('0x21')](respondWithResult(_0x20c0e1,0xc9))['catch'](handleError(_0x20c0e1,null));};exports[_0xc5d2('0x20')]=function(_0x1421ce,_0x2eefed){if(_0x1421ce[_0xc5d2('0x44')]['id']){delete _0x1421ce[_0xc5d2('0x44')]['id'];}return db[_0xc5d2('0x3a')][_0xc5d2('0x42')]({'where':{'id':_0x1421ce[_0xc5d2('0x3f')]['id']}})[_0xc5d2('0x21')](handleEntityNotFound(_0x2eefed,null))[_0xc5d2('0x21')](saveUpdates(_0x1421ce[_0xc5d2('0x44')],null))[_0xc5d2('0x21')](respondWithResult(_0x2eefed,null))[_0xc5d2('0x3d')](handleError(_0x2eefed,null));};exports[_0xc5d2('0x45')]=function(_0x53c21e,_0xe08310){return db[_0xc5d2('0x3a')][_0xc5d2('0x42')]({'where':{'id':_0x53c21e[_0xc5d2('0x3f')]['id']}})['then'](handleEntityNotFound(_0xe08310,null))[_0xc5d2('0x21')](removeEntity(_0xe08310,null))['catch'](handleError(_0xe08310,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 580df36..1df2939 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 _0xfbaa=['FieldId','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField'];(function(_0x2a94d,_0x1f3858){var _0x5dae00=function(_0x4effb7){while(--_0x4effb7){_0x2a94d['push'](_0x2a94d['shift']());}};_0x5dae00(++_0x1f3858);}(_0xfbaa,0x100));var _0xafba=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xfbaa[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0xafba('0x0'));var util=require('util');var logger=require(_0xafba('0x1'))(_0xafba('0x2'));var moment=require(_0xafba('0x3'));var BPromise=require('bluebird');var rp=require(_0xafba('0x4'));var fs=require('fs');var path=require(_0xafba('0x5'));var rimraf=require(_0xafba('0x6'));var config=require(_0xafba('0x7'));var attributes=require(_0xafba('0x8'));module[_0xafba('0x9')]=function(_0x4ba112,_0x540b6b){return _0x4ba112['define'](_0xafba('0xa'),attributes,{'tableName':_0xafba('0xb'),'paranoid':![],'indexes':[{'name':_0xafba('0xc'),'fields':[_0xafba('0xd'),_0xafba('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9972=['../../config/logger','moment','bluebird','request-promise','path','ServicenowField','int_servicenow_fields','FieldId','lodash','util'];(function(_0x525158,_0x125f09){var _0x1825d3=function(_0x48c5f5){while(--_0x48c5f5){_0x525158['push'](_0x525158['shift']());}};_0x1825d3(++_0x125f09);}(_0x9972,0x17a));var _0x2997=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9972[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x2997('0x0'));var util=require(_0x2997('0x1'));var logger=require(_0x2997('0x2'))('api');var moment=require(_0x2997('0x3'));var BPromise=require(_0x2997('0x4'));var rp=require(_0x2997('0x5'));var fs=require('fs');var path=require(_0x2997('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x2271b8,_0x1b9512){return _0x2271b8['define'](_0x2997('0x7'),attributes,{'tableName':_0x2997('0x8'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField',_0x2997('0x9')],'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 38a073d..b7e82f8 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 _0x0713=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\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(_0x1be3dd,_0x29cbf0){var _0x53d4b3=function(_0x3e276c){while(--_0x3e276c){_0x1be3dd['push'](_0x1be3dd['shift']());}};_0x53d4b3(++_0x29cbf0);}(_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')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x8f3f,_0x7ba86){var _0x362f55=function(_0x3388d2){while(--_0x3388d2){_0x8f3f['push'](_0x8f3f['shift']());}};_0x362f55(++_0x7ba86);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index eb6d504..7ae0ffe 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x34ea67,_0x57d412){var _0x383e68=function(_0x3a2f0f){while(--_0x3a2f0f){_0x34ea67['push'](_0x34ea67['shift']());}};_0x383e68(++_0x57d412);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0xd3adea,_0x59280c){var _0x55dea6=function(_0x43ae62){while(--_0x43ae62){_0xd3adea['push'](_0xd3adea['shift']());}};_0x55dea6(++_0x59280c);}(_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/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 810a2f7..6bcf1c0 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(_0x2288c6,_0x3db308){var _0x224674=function(_0x351eb7){while(--_0x351eb7){_0x2288c6['push'](_0x2288c6['shift']());}};_0x224674(++_0x3db308);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x2f8eab,_0x25e8f0){var _0x3a0e06=function(_0x290e2c){while(--_0x290e2c){_0x2f8eab['push'](_0x2f8eab['shift']());}};_0x3a0e06(++_0x25e8f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 ff8d084..58ed41e 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 _0x8a23=['VIRTUAL','options','SugarcrmAccount','then','includeAll','include','findAll','rows','catch','params','length','find','body','update','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','stringify','Calls','values','module_fields','includes','label','value','test','error','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x475e33,_0x42824a){var _0x318871=function(_0x54394c){while(--_0x54394c){_0x475e33['push'](_0x475e33['shift']());}};_0x318871(++_0x42824a);}(_0x8a23,0x1a1));var _0x38a2=function(_0x179b53,_0x31f6fe){_0x179b53=_0x179b53-0x0;var _0x38a146=_0x8a23[_0x179b53];return _0x38a146;};'use strict';var emlformat=require(_0x38a2('0x0'));var rimraf=require(_0x38a2('0x1'));var zipdir=require(_0x38a2('0x2'));var jsonpatch=require(_0x38a2('0x3'));var rp=require(_0x38a2('0x4'));var moment=require(_0x38a2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x38a2('0x6'));var util=require(_0x38a2('0x7'));var path=require(_0x38a2('0x8'));var sox=require(_0x38a2('0x9'));var csv=require(_0x38a2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x38a2('0xb'));var _=require(_0x38a2('0xc'));var squel=require(_0x38a2('0xd'));var crypto=require(_0x38a2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x38a2('0xf'));var toCsv=require(_0x38a2('0xa'));var querystring=require(_0x38a2('0x10'));var Papa=require(_0x38a2('0x11'));var Redis=require(_0x38a2('0x12'));var authService=require(_0x38a2('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x38a2('0x14'));var logger=require('../../config/logger')(_0x38a2('0x15'));var utils=require(_0x38a2('0x16'));var config=require(_0x38a2('0x17'));var licenseUtil=require(_0x38a2('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2c54ba,_0x402f95){_0x402f95=_0x402f95||0xcc;return function(_0x270acd){if(_0x270acd){return _0x2c54ba[_0x38a2('0x19')](_0x402f95);}return _0x2c54ba[_0x38a2('0x1a')](_0x402f95)[_0x38a2('0x1b')]();};}function respondWithResult(_0x45f6cc,_0x5351f0){_0x5351f0=_0x5351f0||0xc8;return function(_0x11c122){if(_0x11c122){return _0x45f6cc[_0x38a2('0x1a')](_0x5351f0)[_0x38a2('0x1c')](_0x11c122);}};}function respondWithFilteredResult(_0x18ef5d,_0x32ddd6){return function(_0x2e70e9){if(_0x2e70e9){var _0x9ba58b=typeof _0x32ddd6[_0x38a2('0x1d')]==='undefined'&&typeof _0x32ddd6[_0x38a2('0x1e')]===_0x38a2('0x1f');var _0x52318f=_0x2e70e9[_0x38a2('0x20')];var _0x5730af=_0x9ba58b?0x0:_0x32ddd6[_0x38a2('0x1d')];var _0x8f5ff5=_0x9ba58b?_0x2e70e9['count']:_0x32ddd6['offset']+_0x32ddd6[_0x38a2('0x1e')];var _0x24c2c5;if(_0x8f5ff5>=_0x52318f){_0x8f5ff5=_0x52318f;_0x24c2c5=0xc8;}else{_0x24c2c5=0xce;}_0x18ef5d[_0x38a2('0x1a')](_0x24c2c5);return _0x18ef5d['set'](_0x38a2('0x21'),_0x5730af+'-'+_0x8f5ff5+'/'+_0x52318f)[_0x38a2('0x1c')](_0x2e70e9);}return null;};}function patchUpdates(_0x593c34){return function(_0x2fb37a){try{jsonpatch[_0x38a2('0x22')](_0x2fb37a,_0x593c34,!![]);}catch(_0x1d751e){return BPromise['reject'](_0x1d751e);}return _0x2fb37a['save']();};}function saveUpdates(_0x45205b,_0x3c0bb1){return function(_0x53673a){if(_0x53673a){return _0x53673a['update'](_0x45205b)['then'](function(_0x1feedb){return _0x1feedb;});}return null;};}function removeEntity(_0x3529f3,_0x35575c){return function(_0x396181){if(_0x396181){return _0x396181[_0x38a2('0x23')]()['then'](function(){_0x3529f3[_0x38a2('0x1a')](0xcc)[_0x38a2('0x1b')]();});}};}function handleEntityNotFound(_0x4f289d,_0x54c775){return function(_0x320023){if(!_0x320023){_0x4f289d[_0x38a2('0x19')](0x194);}return _0x320023;};}function handleError(_0x1404d0,_0x25b8e6){_0x25b8e6=_0x25b8e6||0x1f4;return function(_0x22f85b){logger['error'](_0x22f85b[_0x38a2('0x24')]);if(_0x22f85b[_0x38a2('0x25')]){delete _0x22f85b[_0x38a2('0x25')];}_0x1404d0[_0x38a2('0x1a')](_0x25b8e6)[_0x38a2('0x26')](_0x22f85b);};}exports[_0x38a2('0x27')]=function(_0x50bd0c,_0x512194){var _0x328b96={},_0x1da328={},_0x40af77={'count':0x0,'rows':[]};var _0x18fbab=_[_0x38a2('0x28')](db['SugarcrmAccount'][_0x38a2('0x29')],function(_0x37aacc){return{'name':_0x37aacc[_0x38a2('0x2a')],'type':_0x37aacc[_0x38a2('0x2b')]['key']};});_0x1da328[_0x38a2('0x2c')]=_['map'](_0x18fbab,_0x38a2('0x25'));_0x1da328[_0x38a2('0x2d')]=_[_0x38a2('0x2e')](_0x50bd0c[_0x38a2('0x2d')]);_0x1da328[_0x38a2('0x2f')]=_[_0x38a2('0x30')](_0x1da328[_0x38a2('0x2c')],_0x1da328['query']);_0x328b96[_0x38a2('0x31')]=_['intersection'](_0x1da328['model'],qs[_0x38a2('0x32')](_0x50bd0c[_0x38a2('0x2d')][_0x38a2('0x32')]));_0x328b96[_0x38a2('0x31')]=_0x328b96['attributes']['length']?_0x328b96['attributes']:_0x1da328[_0x38a2('0x2c')];if(!_0x50bd0c['query'][_0x38a2('0x33')](_0x38a2('0x34'))){_0x328b96[_0x38a2('0x1e')]=qs[_0x38a2('0x1e')](_0x50bd0c[_0x38a2('0x2d')][_0x38a2('0x1e')]);_0x328b96[_0x38a2('0x1d')]=qs[_0x38a2('0x1d')](_0x50bd0c['query'][_0x38a2('0x1d')]);}_0x328b96[_0x38a2('0x35')]=qs[_0x38a2('0x36')](_0x50bd0c['query']['sort']);_0x328b96[_0x38a2('0x37')]=qs[_0x38a2('0x2f')](_[_0x38a2('0x38')](_0x50bd0c['query'],_0x1da328[_0x38a2('0x2f')]),_0x18fbab);if(_0x50bd0c[_0x38a2('0x2d')][_0x38a2('0x39')]){_0x328b96[_0x38a2('0x37')]=_[_0x38a2('0x3a')](_0x328b96[_0x38a2('0x37')],{'$or':_[_0x38a2('0x28')](_0x18fbab,function(_0x47741b){if(_0x47741b['type']!==_0x38a2('0x3b')){var _0x290e0c={};_0x290e0c[_0x47741b[_0x38a2('0x25')]]={'$like':'%'+_0x50bd0c[_0x38a2('0x2d')][_0x38a2('0x39')]+'%'};return _0x290e0c;}})});}_0x328b96=_['merge']({},_0x328b96,_0x50bd0c[_0x38a2('0x3c')]);var _0x19aa9d={'where':_0x328b96['where']};return db[_0x38a2('0x3d')][_0x38a2('0x20')](_0x19aa9d)[_0x38a2('0x3e')](function(_0x8c754f){_0x40af77[_0x38a2('0x20')]=_0x8c754f;if(_0x50bd0c[_0x38a2('0x2d')][_0x38a2('0x3f')]){_0x328b96[_0x38a2('0x40')]=[{'all':!![]}];}return db[_0x38a2('0x3d')][_0x38a2('0x41')](_0x328b96);})[_0x38a2('0x3e')](function(_0x205a83){_0x40af77[_0x38a2('0x42')]=_0x205a83;return _0x40af77;})[_0x38a2('0x3e')](respondWithFilteredResult(_0x512194,_0x328b96))[_0x38a2('0x43')](handleError(_0x512194,null));};exports['show']=function(_0x43ba72,_0x47034d){var _0x543a74={'raw':![],'where':{'id':_0x43ba72[_0x38a2('0x44')]['id']}},_0x30ca61={};_0x30ca61[_0x38a2('0x2c')]=_['keys'](db[_0x38a2('0x3d')][_0x38a2('0x29')]);_0x30ca61[_0x38a2('0x2d')]=_[_0x38a2('0x2e')](_0x43ba72[_0x38a2('0x2d')]);_0x30ca61[_0x38a2('0x2f')]=_[_0x38a2('0x30')](_0x30ca61[_0x38a2('0x2c')],_0x30ca61[_0x38a2('0x2d')]);_0x543a74[_0x38a2('0x31')]=_[_0x38a2('0x30')](_0x30ca61['model'],qs['fields'](_0x43ba72[_0x38a2('0x2d')][_0x38a2('0x32')]));_0x543a74['attributes']=_0x543a74[_0x38a2('0x31')][_0x38a2('0x45')]?_0x543a74['attributes']:_0x30ca61['model'];if(_0x43ba72[_0x38a2('0x2d')]['includeAll']){_0x543a74[_0x38a2('0x40')]=[{'all':!![]}];}_0x543a74=_['merge']({},_0x543a74,_0x43ba72[_0x38a2('0x3c')]);return db[_0x38a2('0x3d')][_0x38a2('0x46')](_0x543a74)[_0x38a2('0x3e')](handleEntityNotFound(_0x47034d,null))[_0x38a2('0x3e')](respondWithResult(_0x47034d,null))[_0x38a2('0x43')](handleError(_0x47034d,null));};exports['create']=function(_0x5d905f,_0x2d6cd3){return db['SugarcrmAccount']['create'](_0x5d905f[_0x38a2('0x47')],{})[_0x38a2('0x3e')](respondWithResult(_0x2d6cd3,0xc9))[_0x38a2('0x43')](handleError(_0x2d6cd3,null));};exports[_0x38a2('0x48')]=function(_0x6bfa12,_0x2d21ce){if(_0x6bfa12[_0x38a2('0x47')]['id']){delete _0x6bfa12[_0x38a2('0x47')]['id'];}return db[_0x38a2('0x3d')][_0x38a2('0x46')]({'where':{'id':_0x6bfa12['params']['id']}})['then'](handleEntityNotFound(_0x2d21ce,null))[_0x38a2('0x3e')](saveUpdates(_0x6bfa12[_0x38a2('0x47')],null))[_0x38a2('0x3e')](respondWithResult(_0x2d21ce,null))[_0x38a2('0x43')](handleError(_0x2d21ce,null));};exports[_0x38a2('0x23')]=function(_0xb9ba4e,_0x3f88ee){return db[_0x38a2('0x3d')][_0x38a2('0x46')]({'where':{'id':_0xb9ba4e[_0x38a2('0x44')]['id']}})[_0x38a2('0x3e')](handleEntityNotFound(_0x3f88ee,null))[_0x38a2('0x3e')](removeEntity(_0x3f88ee,null))[_0x38a2('0x43')](handleError(_0x3f88ee,null));};exports[_0x38a2('0x49')]=function(_0x5ce170,_0xebd46c,_0x5377c7){var _0x4d5a37={};var _0x42e6a0={};var _0x222759;var _0x4fc93e;return db['SugarcrmAccount'][_0x38a2('0x4a')]({'where':{'id':_0x5ce170[_0x38a2('0x44')]['id']}})[_0x38a2('0x3e')](handleEntityNotFound(_0xebd46c,null))[_0x38a2('0x3e')](function(_0x9c2dcc){if(_0x9c2dcc){_0x222759=_0x9c2dcc;_0x42e6a0['model']=_[_0x38a2('0x2e')](db[_0x38a2('0x4b')][_0x38a2('0x29')]);_0x42e6a0[_0x38a2('0x2d')]=_[_0x38a2('0x2e')](_0x5ce170[_0x38a2('0x2d')]);_0x42e6a0[_0x38a2('0x2f')]=_[_0x38a2('0x30')](_0x42e6a0[_0x38a2('0x2c')],_0x42e6a0[_0x38a2('0x2d')]);_0x4d5a37['attributes']=_[_0x38a2('0x30')](_0x42e6a0['model'],qs['fields'](_0x5ce170[_0x38a2('0x2d')][_0x38a2('0x32')]));_0x4d5a37['attributes']=_0x4d5a37['attributes'][_0x38a2('0x45')]?_0x4d5a37[_0x38a2('0x31')]:_0x42e6a0[_0x38a2('0x2c')];_0x4d5a37[_0x38a2('0x35')]=qs[_0x38a2('0x36')](_0x5ce170[_0x38a2('0x2d')][_0x38a2('0x36')]);_0x4d5a37[_0x38a2('0x37')]=qs['filters'](_[_0x38a2('0x38')](_0x5ce170['query'],_0x42e6a0[_0x38a2('0x2f')]));if(_0x5ce170[_0x38a2('0x2d')]['filter']){_0x4d5a37['where']=_['merge'](_0x4d5a37['where'],{'$or':_[_0x38a2('0x28')](_0x4d5a37[_0x38a2('0x31')],function(_0x12c2d1){var _0x53a6eb={};_0x53a6eb[_0x12c2d1]={'$like':'%'+_0x5ce170[_0x38a2('0x2d')]['filter']+'%'};return _0x53a6eb;})});}_0x4d5a37=_[_0x38a2('0x3a')]({},_0x4d5a37,_0x5ce170[_0x38a2('0x3c')]);return _0x222759[_0x38a2('0x49')](_0x4d5a37);}})['then'](function(_0x31bc9e){if(_0x31bc9e){_0x4fc93e=_0x31bc9e[_0x38a2('0x45')];if(!_0x5ce170['query'][_0x38a2('0x33')](_0x38a2('0x34'))){_0x4d5a37[_0x38a2('0x1e')]=qs[_0x38a2('0x1e')](_0x5ce170[_0x38a2('0x2d')][_0x38a2('0x1e')]);_0x4d5a37[_0x38a2('0x1d')]=qs[_0x38a2('0x1d')](_0x5ce170[_0x38a2('0x2d')][_0x38a2('0x1d')]);}return _0x222759[_0x38a2('0x49')](_0x4d5a37);}})['then'](function(_0x39b389){if(_0x39b389){return _0x39b389?{'count':_0x4fc93e,'rows':_0x39b389}:null;}})['then'](respondWithResult(_0xebd46c,null))[_0x38a2('0x43')](handleError(_0xebd46c,null));};exports[_0x38a2('0x4c')]=function(_0x5c4986,_0x5ebb67,_0x406563){if(_0x5c4986[_0x38a2('0x47')]['id']){delete _0x5c4986['body']['id'];}return db[_0x38a2('0x3d')]['findOne']({'where':{'id':_0x5c4986[_0x38a2('0x44')]['id']}})[_0x38a2('0x3e')](handleEntityNotFound(_0x5ebb67,null))[_0x38a2('0x3e')](function(_0x4e3a82){if(_0x4e3a82){_0x5c4986[_0x38a2('0x47')][_0x38a2('0x4d')]=_0x4e3a82['id'];_0x5c4986[_0x38a2('0x47')][_0x38a2('0x4e')]=integrations[_0x38a2('0x4f')](_0x5c4986['body'][_0x38a2('0x50')],_0x5c4986['body'][_0x38a2('0x2b')]);_0x5c4986[_0x38a2('0x47')]['Descriptions']=integrations[_0x38a2('0x51')](_0x5c4986['body'][_0x38a2('0x50')],_0x5c4986['body']['type']);return db[_0x38a2('0x4b')]['create'](_0x5c4986['body'],{'include':[{'model':db[_0x38a2('0x52')],'as':_0x38a2('0x4e')},{'model':db[_0x38a2('0x52')],'as':_0x38a2('0x53')}]});}return null;})['then'](respondWithResult(_0x5ebb67,null))[_0x38a2('0x43')](handleError(_0x5ebb67,null));};exports[_0x38a2('0x54')]=function(_0x1fdac5,_0x154c9c,_0x40d5da){var _0x304b0f='';var _0x3e81e5=['id',_0x38a2('0x25'),_0x38a2('0x55'),_0x38a2('0x56'),_0x38a2('0x57'),_0x38a2('0x58'),_0x38a2('0x59'),'duration_minutes',_0x38a2('0x5a'),'parent_type',_0x38a2('0x5b'),_0x38a2('0x5c')];return db[_0x38a2('0x3d')][_0x38a2('0x4a')]({'where':{'id':_0x1fdac5['params']['id']},'attributes':['id',_0x38a2('0x5d'),_0x38a2('0x5e'),_0x38a2('0x5f')]})[_0x38a2('0x3e')](handleEntityNotFound(_0x154c9c,null))[_0x38a2('0x3e')](function(_0x1181f3){if(_0x1181f3){_0x304b0f=_0x1181f3[_0x38a2('0x5f')];var _0x3fd9d0=_0x304b0f[_0x38a2('0x60')](-0x1);if(_0x3fd9d0==='/'){_0x304b0f=_0x304b0f['substring'](0x0,_0x304b0f[_0x38a2('0x61')](_0x3fd9d0));}return rp({'method':_0x38a2('0x62'),'uri':util[_0x38a2('0x63')](_0x38a2('0x64'),_0x304b0f,_0x38a2('0x65')),'json':!![],'form':{'method':_0x38a2('0x66'),'input_type':'JSON','response_type':_0x38a2('0x67'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1181f3[_0x38a2('0x5d')],'password':_0x1181f3[_0x38a2('0x5e')],'encryption':_0x38a2('0x68')},'application':_0x38a2('0x69')})}});}})[_0x38a2('0x3e')](function(_0x3840a9){if(_0x3840a9&&_0x3840a9[_0x38a2('0x25')]!==_0x38a2('0x6a')&&_0x3840a9[_0x38a2('0x25')]!=='Password\x20Expired'){return rp({'method':_0x38a2('0x62'),'uri':util[_0x38a2('0x63')]('%s%s',_0x304b0f,_0x38a2('0x65')),'json':!![],'form':{'method':_0x38a2('0x6b'),'input_type':'JSON','response_type':_0x38a2('0x67'),'rest_data':JSON[_0x38a2('0x6c')]({'session':_0x3840a9['id'],'module_name':_0x38a2('0x6d')})}})[_0x38a2('0x3e')](function(_0x4866c5){if(_0x4866c5){var _0x3414a3=_[_0x38a2('0x6e')](_0x4866c5[_0x38a2('0x6f')]);_['remove'](_0x3414a3,function(_0x19e7a3){return _0x3e81e5[_0x38a2('0x70')](_0x19e7a3[_0x38a2('0x25')]);});return{'count':_0x3414a3[_0x38a2('0x45')],'rows':_['map'](_0x3414a3,function(_0x262069){return{'id':_0x262069[_0x38a2('0x25')],'name':_0x262069[_0x38a2('0x71')],'custom':_['endsWith'](_0x262069[_0x38a2('0x25')],'_c')?!![]:![],'options':_0x262069['options']?_['map'](_['values'](_0x262069['options']),function(_0x553564){return{'name':_0x553564[_0x38a2('0x72')],'value':_0x553564[_0x38a2('0x25')]};}):[]};})};}})[_0x38a2('0x3e')](respondWithResult(_0x154c9c,null))[_0x38a2('0x43')](function(_0xb8859a){var _0x15af38=_0x1fdac5[_0x38a2('0x2d')][_0x38a2('0x73')]?0x1f4:_0xb8859a['statusCode']||0x1f4;logger[_0x38a2('0x74')]('getFields,\x20%s,\x20%s,\x20%s',_0x38a2('0x54'),_0x15af38,JSON['stringify'](_0xb8859a));delete _0xb8859a['name'];if(_0x15af38===0x191){_0x15af38=0x190;}_0x154c9c[_0x38a2('0x1a')](_0x15af38)[_0x38a2('0x26')](_0x1fdac5['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0xb8859a[_0x38a2('0x75')]}:_0xb8859a);});}else{var _0xd612a7=0x1f4;_0x154c9c[_0x38a2('0x1a')](_0xd612a7)[_0x38a2('0x26')]({'message':_0x38a2('0x76'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xeb8a=['get_module_fields','stringify','values','module_fields','remove','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','map','SugarcrmAccount','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','parent_id','parent_type','direction','username','password','remoteUri','slice','POST','format','/service/v4_1/rest.php','login','JSON','Invalid\x20Login','Password\x20Expired','%s%s'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0xeb8a,0x15c));var _0xaeb8=function(_0x21f307,_0xa80b50){_0x21f307=_0x21f307-0x0;var _0x42f509=_0xeb8a[_0x21f307];return _0x42f509;};'use strict';var emlformat=require(_0xaeb8('0x0'));var rimraf=require(_0xaeb8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaeb8('0x2'));var rp=require(_0xaeb8('0x3'));var moment=require(_0xaeb8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaeb8('0x5'));var util=require(_0xaeb8('0x6'));var path=require(_0xaeb8('0x7'));var sox=require('sox');var csv=require(_0xaeb8('0x8'));var ejs=require(_0xaeb8('0x9'));var fs=require('fs');var fs_extra=require(_0xaeb8('0xa'));var _=require(_0xaeb8('0xb'));var squel=require('squel');var crypto=require(_0xaeb8('0xc'));var jsforce=require(_0xaeb8('0xd'));var deskjs=require(_0xaeb8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xaeb8('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaeb8('0x10'));var qs=require(_0xaeb8('0x11'));var as=require(_0xaeb8('0x12'));var hardwareService=require(_0xaeb8('0x13'));var logger=require(_0xaeb8('0x14'))(_0xaeb8('0x15'));var utils=require(_0xaeb8('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xaeb8('0x17'));function respondWithStatusCode(_0x195b3e,_0x145ef7){_0x145ef7=_0x145ef7||0xcc;return function(_0x1682a7){if(_0x1682a7){return _0x195b3e['sendStatus'](_0x145ef7);}return _0x195b3e[_0xaeb8('0x18')](_0x145ef7)[_0xaeb8('0x19')]();};}function respondWithResult(_0x45fbac,_0x296717){_0x296717=_0x296717||0xc8;return function(_0x22a9f6){if(_0x22a9f6){return _0x45fbac['status'](_0x296717)[_0xaeb8('0x1a')](_0x22a9f6);}};}function respondWithFilteredResult(_0x36f12d,_0x1ad59c){return function(_0x5a8283){if(_0x5a8283){var _0xa327e6=typeof _0x1ad59c['offset']===_0xaeb8('0x1b')&&typeof _0x1ad59c[_0xaeb8('0x1c')]==='undefined';var _0x197cbf=_0x5a8283[_0xaeb8('0x1d')];var _0xe515d6=_0xa327e6?0x0:_0x1ad59c[_0xaeb8('0x1e')];var _0x1c571b=_0xa327e6?_0x5a8283['count']:_0x1ad59c[_0xaeb8('0x1e')]+_0x1ad59c[_0xaeb8('0x1c')];var _0x2bf146;if(_0x1c571b>=_0x197cbf){_0x1c571b=_0x197cbf;_0x2bf146=0xc8;}else{_0x2bf146=0xce;}_0x36f12d[_0xaeb8('0x18')](_0x2bf146);return _0x36f12d[_0xaeb8('0x1f')](_0xaeb8('0x20'),_0xe515d6+'-'+_0x1c571b+'/'+_0x197cbf)['json'](_0x5a8283);}return null;};}function patchUpdates(_0x5ba7d7){return function(_0x2e17b9){try{jsonpatch[_0xaeb8('0x21')](_0x2e17b9,_0x5ba7d7,!![]);}catch(_0x49230c){return BPromise[_0xaeb8('0x22')](_0x49230c);}return _0x2e17b9['save']();};}function saveUpdates(_0x16dcd2,_0x1dac59){return function(_0x167526){if(_0x167526){return _0x167526[_0xaeb8('0x23')](_0x16dcd2)['then'](function(_0x4b3d42){return _0x4b3d42;});}return null;};}function removeEntity(_0x514534,_0x1e0204){return function(_0x501199){if(_0x501199){return _0x501199[_0xaeb8('0x24')]()[_0xaeb8('0x25')](function(){_0x514534[_0xaeb8('0x18')](0xcc)[_0xaeb8('0x19')]();});}};}function handleEntityNotFound(_0x1c904b,_0x140371){return function(_0x209bbb){if(!_0x209bbb){_0x1c904b['sendStatus'](0x194);}return _0x209bbb;};}function handleError(_0x44351a,_0x4adeb3){_0x4adeb3=_0x4adeb3||0x1f4;return function(_0xaffae5){logger[_0xaeb8('0x26')](_0xaffae5[_0xaeb8('0x27')]);if(_0xaffae5[_0xaeb8('0x28')]){delete _0xaffae5['name'];}_0x44351a[_0xaeb8('0x18')](_0x4adeb3)[_0xaeb8('0x29')](_0xaffae5);};}exports['index']=function(_0x2ca279,_0x48ec77){var _0x4105cf={},_0x38297a={},_0x3bf515={'count':0x0,'rows':[]};var _0x1443a7=_[_0xaeb8('0x2a')](db[_0xaeb8('0x2b')][_0xaeb8('0x2c')],function(_0x201f34){return{'name':_0x201f34['fieldName'],'type':_0x201f34[_0xaeb8('0x2d')]['key']};});_0x38297a['model']=_[_0xaeb8('0x2a')](_0x1443a7,_0xaeb8('0x28'));_0x38297a[_0xaeb8('0x2e')]=_[_0xaeb8('0x2f')](_0x2ca279[_0xaeb8('0x2e')]);_0x38297a[_0xaeb8('0x30')]=_[_0xaeb8('0x31')](_0x38297a[_0xaeb8('0x32')],_0x38297a[_0xaeb8('0x2e')]);_0x4105cf[_0xaeb8('0x33')]=_[_0xaeb8('0x31')](_0x38297a['model'],qs['fields'](_0x2ca279[_0xaeb8('0x2e')][_0xaeb8('0x34')]));_0x4105cf[_0xaeb8('0x33')]=_0x4105cf['attributes'][_0xaeb8('0x35')]?_0x4105cf['attributes']:_0x38297a[_0xaeb8('0x32')];if(!_0x2ca279[_0xaeb8('0x2e')][_0xaeb8('0x36')](_0xaeb8('0x37'))){_0x4105cf['limit']=qs[_0xaeb8('0x1c')](_0x2ca279[_0xaeb8('0x2e')][_0xaeb8('0x1c')]);_0x4105cf[_0xaeb8('0x1e')]=qs['offset'](_0x2ca279[_0xaeb8('0x2e')][_0xaeb8('0x1e')]);}_0x4105cf[_0xaeb8('0x38')]=qs[_0xaeb8('0x39')](_0x2ca279[_0xaeb8('0x2e')][_0xaeb8('0x39')]);_0x4105cf['where']=qs[_0xaeb8('0x30')](_[_0xaeb8('0x3a')](_0x2ca279[_0xaeb8('0x2e')],_0x38297a[_0xaeb8('0x30')]),_0x1443a7);if(_0x2ca279['query'][_0xaeb8('0x3b')]){_0x4105cf[_0xaeb8('0x3c')]=_[_0xaeb8('0x3d')](_0x4105cf['where'],{'$or':_['map'](_0x1443a7,function(_0x8c0603){if(_0x8c0603[_0xaeb8('0x2d')]!==_0xaeb8('0x3e')){var _0x102eaa={};_0x102eaa[_0x8c0603[_0xaeb8('0x28')]]={'$like':'%'+_0x2ca279[_0xaeb8('0x2e')]['filter']+'%'};return _0x102eaa;}})});}_0x4105cf=_[_0xaeb8('0x3d')]({},_0x4105cf,_0x2ca279[_0xaeb8('0x3f')]);var _0x376ea2={'where':_0x4105cf['where']};return db['SugarcrmAccount'][_0xaeb8('0x1d')](_0x376ea2)[_0xaeb8('0x25')](function(_0x5b2fe0){_0x3bf515['count']=_0x5b2fe0;if(_0x2ca279[_0xaeb8('0x2e')][_0xaeb8('0x40')]){_0x4105cf[_0xaeb8('0x41')]=[{'all':!![]}];}return db[_0xaeb8('0x2b')][_0xaeb8('0x42')](_0x4105cf);})[_0xaeb8('0x25')](function(_0x2ae8f2){_0x3bf515[_0xaeb8('0x43')]=_0x2ae8f2;return _0x3bf515;})['then'](respondWithFilteredResult(_0x48ec77,_0x4105cf))[_0xaeb8('0x44')](handleError(_0x48ec77,null));};exports[_0xaeb8('0x45')]=function(_0x5d57ef,_0x596290){var _0xfbadd7={'raw':![],'where':{'id':_0x5d57ef[_0xaeb8('0x46')]['id']}},_0x174fa1={};_0x174fa1[_0xaeb8('0x32')]=_[_0xaeb8('0x2f')](db[_0xaeb8('0x2b')]['rawAttributes']);_0x174fa1[_0xaeb8('0x2e')]=_['keys'](_0x5d57ef[_0xaeb8('0x2e')]);_0x174fa1[_0xaeb8('0x30')]=_[_0xaeb8('0x31')](_0x174fa1[_0xaeb8('0x32')],_0x174fa1[_0xaeb8('0x2e')]);_0xfbadd7[_0xaeb8('0x33')]=_[_0xaeb8('0x31')](_0x174fa1[_0xaeb8('0x32')],qs['fields'](_0x5d57ef[_0xaeb8('0x2e')][_0xaeb8('0x34')]));_0xfbadd7[_0xaeb8('0x33')]=_0xfbadd7['attributes'][_0xaeb8('0x35')]?_0xfbadd7[_0xaeb8('0x33')]:_0x174fa1[_0xaeb8('0x32')];if(_0x5d57ef[_0xaeb8('0x2e')][_0xaeb8('0x40')]){_0xfbadd7[_0xaeb8('0x41')]=[{'all':!![]}];}_0xfbadd7=_[_0xaeb8('0x3d')]({},_0xfbadd7,_0x5d57ef[_0xaeb8('0x3f')]);return db[_0xaeb8('0x2b')][_0xaeb8('0x47')](_0xfbadd7)[_0xaeb8('0x25')](handleEntityNotFound(_0x596290,null))[_0xaeb8('0x25')](respondWithResult(_0x596290,null))[_0xaeb8('0x44')](handleError(_0x596290,null));};exports[_0xaeb8('0x48')]=function(_0x459cf1,_0x4eb88d){return db['SugarcrmAccount'][_0xaeb8('0x48')](_0x459cf1[_0xaeb8('0x49')],{})[_0xaeb8('0x25')](respondWithResult(_0x4eb88d,0xc9))[_0xaeb8('0x44')](handleError(_0x4eb88d,null));};exports[_0xaeb8('0x23')]=function(_0xf89b84,_0x14eaf4){if(_0xf89b84['body']['id']){delete _0xf89b84[_0xaeb8('0x49')]['id'];}return db['SugarcrmAccount'][_0xaeb8('0x47')]({'where':{'id':_0xf89b84['params']['id']}})[_0xaeb8('0x25')](handleEntityNotFound(_0x14eaf4,null))[_0xaeb8('0x25')](saveUpdates(_0xf89b84[_0xaeb8('0x49')],null))[_0xaeb8('0x25')](respondWithResult(_0x14eaf4,null))[_0xaeb8('0x44')](handleError(_0x14eaf4,null));};exports[_0xaeb8('0x24')]=function(_0x106e34,_0x470e2d){return db[_0xaeb8('0x2b')]['find']({'where':{'id':_0x106e34[_0xaeb8('0x46')]['id']}})[_0xaeb8('0x25')](handleEntityNotFound(_0x470e2d,null))[_0xaeb8('0x25')](removeEntity(_0x470e2d,null))[_0xaeb8('0x44')](handleError(_0x470e2d,null));};exports[_0xaeb8('0x4a')]=function(_0x5912d3,_0x4efa7f,_0x7869d0){var _0x3e07e6={};var _0x5a4eed={};var _0x6f19b1;var _0x56f52b;return db['SugarcrmAccount'][_0xaeb8('0x4b')]({'where':{'id':_0x5912d3[_0xaeb8('0x46')]['id']}})[_0xaeb8('0x25')](handleEntityNotFound(_0x4efa7f,null))[_0xaeb8('0x25')](function(_0x4973fd){if(_0x4973fd){_0x6f19b1=_0x4973fd;_0x5a4eed[_0xaeb8('0x32')]=_[_0xaeb8('0x2f')](db[_0xaeb8('0x4c')][_0xaeb8('0x2c')]);_0x5a4eed['query']=_[_0xaeb8('0x2f')](_0x5912d3[_0xaeb8('0x2e')]);_0x5a4eed[_0xaeb8('0x30')]=_[_0xaeb8('0x31')](_0x5a4eed[_0xaeb8('0x32')],_0x5a4eed[_0xaeb8('0x2e')]);_0x3e07e6[_0xaeb8('0x33')]=_[_0xaeb8('0x31')](_0x5a4eed['model'],qs[_0xaeb8('0x34')](_0x5912d3[_0xaeb8('0x2e')][_0xaeb8('0x34')]));_0x3e07e6[_0xaeb8('0x33')]=_0x3e07e6[_0xaeb8('0x33')][_0xaeb8('0x35')]?_0x3e07e6['attributes']:_0x5a4eed[_0xaeb8('0x32')];_0x3e07e6[_0xaeb8('0x38')]=qs[_0xaeb8('0x39')](_0x5912d3[_0xaeb8('0x2e')]['sort']);_0x3e07e6[_0xaeb8('0x3c')]=qs[_0xaeb8('0x30')](_[_0xaeb8('0x3a')](_0x5912d3['query'],_0x5a4eed[_0xaeb8('0x30')]));if(_0x5912d3['query'][_0xaeb8('0x3b')]){_0x3e07e6[_0xaeb8('0x3c')]=_[_0xaeb8('0x3d')](_0x3e07e6[_0xaeb8('0x3c')],{'$or':_['map'](_0x3e07e6[_0xaeb8('0x33')],function(_0x33c8d2){var _0x387844={};_0x387844[_0x33c8d2]={'$like':'%'+_0x5912d3[_0xaeb8('0x2e')][_0xaeb8('0x3b')]+'%'};return _0x387844;})});}_0x3e07e6=_[_0xaeb8('0x3d')]({},_0x3e07e6,_0x5912d3['options']);return _0x6f19b1[_0xaeb8('0x4a')](_0x3e07e6);}})[_0xaeb8('0x25')](function(_0x1ba006){if(_0x1ba006){_0x56f52b=_0x1ba006['length'];if(!_0x5912d3[_0xaeb8('0x2e')][_0xaeb8('0x36')](_0xaeb8('0x37'))){_0x3e07e6[_0xaeb8('0x1c')]=qs[_0xaeb8('0x1c')](_0x5912d3[_0xaeb8('0x2e')][_0xaeb8('0x1c')]);_0x3e07e6[_0xaeb8('0x1e')]=qs[_0xaeb8('0x1e')](_0x5912d3[_0xaeb8('0x2e')][_0xaeb8('0x1e')]);}return _0x6f19b1[_0xaeb8('0x4a')](_0x3e07e6);}})[_0xaeb8('0x25')](function(_0x41f063){if(_0x41f063){return _0x41f063?{'count':_0x56f52b,'rows':_0x41f063}:null;}})['then'](respondWithResult(_0x4efa7f,null))[_0xaeb8('0x44')](handleError(_0x4efa7f,null));};exports[_0xaeb8('0x4d')]=function(_0x36263f,_0x4f172d,_0x68b807){if(_0x36263f[_0xaeb8('0x49')]['id']){delete _0x36263f[_0xaeb8('0x49')]['id'];}return db[_0xaeb8('0x2b')][_0xaeb8('0x4b')]({'where':{'id':_0x36263f[_0xaeb8('0x46')]['id']}})[_0xaeb8('0x25')](handleEntityNotFound(_0x4f172d,null))[_0xaeb8('0x25')](function(_0x4dadd5){if(_0x4dadd5){_0x36263f['body'][_0xaeb8('0x4e')]=_0x4dadd5['id'];_0x36263f[_0xaeb8('0x49')]['Subjects']=integrations[_0xaeb8('0x4f')](_0x36263f[_0xaeb8('0x49')][_0xaeb8('0x50')],_0x36263f[_0xaeb8('0x49')][_0xaeb8('0x2d')]);_0x36263f[_0xaeb8('0x49')][_0xaeb8('0x51')]=integrations[_0xaeb8('0x52')](_0x36263f[_0xaeb8('0x49')]['channel'],_0x36263f[_0xaeb8('0x49')][_0xaeb8('0x2d')]);return db[_0xaeb8('0x4c')][_0xaeb8('0x48')](_0x36263f[_0xaeb8('0x49')],{'include':[{'model':db[_0xaeb8('0x53')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0xaeb8('0x25')](respondWithResult(_0x4f172d,null))[_0xaeb8('0x44')](handleError(_0x4f172d,null));};exports[_0xaeb8('0x54')]=function(_0x341868,_0x386789,_0xbb2901){var _0x1336d3='';var _0xd00511=['id',_0xaeb8('0x28'),_0xaeb8('0x55'),'created_by',_0xaeb8('0x56'),_0xaeb8('0x57'),_0xaeb8('0x58'),'duration_minutes',_0xaeb8('0x59'),_0xaeb8('0x5a'),'parent_name',_0xaeb8('0x5b')];return db['SugarcrmAccount'][_0xaeb8('0x4b')]({'where':{'id':_0x341868[_0xaeb8('0x46')]['id']},'attributes':['id',_0xaeb8('0x5c'),_0xaeb8('0x5d'),'remoteUri']})['then'](handleEntityNotFound(_0x386789,null))[_0xaeb8('0x25')](function(_0x280338){if(_0x280338){_0x1336d3=_0x280338[_0xaeb8('0x5e')];var _0x48a095=_0x1336d3[_0xaeb8('0x5f')](-0x1);if(_0x48a095==='/'){_0x1336d3=_0x1336d3['substring'](0x0,_0x1336d3['lastIndexOf'](_0x48a095));}return rp({'method':_0xaeb8('0x60'),'uri':util[_0xaeb8('0x61')]('%s%s',_0x1336d3,_0xaeb8('0x62')),'json':!![],'form':{'method':_0xaeb8('0x63'),'input_type':_0xaeb8('0x64'),'response_type':_0xaeb8('0x64'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x280338[_0xaeb8('0x5c')],'password':_0x280338['password'],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xaeb8('0x25')](function(_0x5882c7){if(_0x5882c7&&_0x5882c7[_0xaeb8('0x28')]!==_0xaeb8('0x65')&&_0x5882c7[_0xaeb8('0x28')]!==_0xaeb8('0x66')){return rp({'method':'POST','uri':util[_0xaeb8('0x61')](_0xaeb8('0x67'),_0x1336d3,_0xaeb8('0x62')),'json':!![],'form':{'method':_0xaeb8('0x68'),'input_type':_0xaeb8('0x64'),'response_type':_0xaeb8('0x64'),'rest_data':JSON[_0xaeb8('0x69')]({'session':_0x5882c7['id'],'module_name':'Calls'})}})[_0xaeb8('0x25')](function(_0x4c049f){if(_0x4c049f){var _0x586712=_[_0xaeb8('0x6a')](_0x4c049f[_0xaeb8('0x6b')]);_[_0xaeb8('0x6c')](_0x586712,function(_0x11a848){return _0xd00511['includes'](_0x11a848[_0xaeb8('0x28')]);});return{'count':_0x586712['length'],'rows':_[_0xaeb8('0x2a')](_0x586712,function(_0x13bc10){return{'id':_0x13bc10[_0xaeb8('0x28')],'name':_0x13bc10[_0xaeb8('0x6d')],'custom':_['endsWith'](_0x13bc10[_0xaeb8('0x28')],'_c')?!![]:![],'options':_0x13bc10[_0xaeb8('0x3f')]?_[_0xaeb8('0x2a')](_[_0xaeb8('0x6a')](_0x13bc10[_0xaeb8('0x3f')]),function(_0x1d4eae){return{'name':_0x1d4eae['value'],'value':_0x1d4eae[_0xaeb8('0x28')]};}):[]};})};}})[_0xaeb8('0x25')](respondWithResult(_0x386789,null))[_0xaeb8('0x44')](function(_0x468bad){var _0x3cd075=_0x341868['query']['test']?0x1f4:_0x468bad[_0xaeb8('0x6e')]||0x1f4;logger['error'](_0xaeb8('0x6f'),_0xaeb8('0x54'),_0x3cd075,JSON['stringify'](_0x468bad));delete _0x468bad['name'];if(_0x3cd075===0x191){_0x3cd075=0x190;}_0x386789[_0xaeb8('0x18')](_0x3cd075)[_0xaeb8('0x29')](_0x341868['query'][_0xaeb8('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x468bad[_0xaeb8('0x6e')]}:_0x468bad);});}else{var _0x8f8fd6=0x1f4;_0x386789[_0xaeb8('0x18')](_0x8f8fd6)[_0xaeb8('0x29')]({'message':'Wrong\x20credentials','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 6792f24..9f2be90 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 _0x1f81=['define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports'];(function(_0xa2b098,_0x461a08){var _0x29502e=function(_0x43291a){while(--_0x43291a){_0xa2b098['push'](_0xa2b098['shift']());}};_0x29502e(++_0x461a08);}(_0x1f81,0xab));var _0x11f8=function(_0x21c2c8,_0x44257e){_0x21c2c8=_0x21c2c8-0x0;var _0x4dd745=_0x1f81[_0x21c2c8];return _0x4dd745;};'use strict';var _=require(_0x11f8('0x0'));var util=require(_0x11f8('0x1'));var logger=require('../../config/logger')(_0x11f8('0x2'));var moment=require(_0x11f8('0x3'));var BPromise=require('bluebird');var rp=require(_0x11f8('0x4'));var fs=require('fs');var path=require(_0x11f8('0x5'));var rimraf=require(_0x11f8('0x6'));var config=require(_0x11f8('0x7'));var attributes=require(_0x11f8('0x8'));var integrations=require(_0x11f8('0x9'));module[_0x11f8('0xa')]=function(_0xe63071,_0x4fd0cf){return _0xe63071[_0x11f8('0xb')](_0x11f8('0xc'),attributes,{'tableName':_0x11f8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bd7=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','int_sugarcrm_accounts','lodash','util'];(function(_0xc60a91,_0x43c54a){var _0x4a6795=function(_0x277d25){while(--_0x277d25){_0xc60a91['push'](_0xc60a91['shift']());}};_0x4a6795(++_0x43c54a);}(_0x9bd7,0x106));var _0x79bd=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9bd7[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x79bd('0x0'));var util=require(_0x79bd('0x1'));var logger=require(_0x79bd('0x2'))(_0x79bd('0x3'));var moment=require(_0x79bd('0x4'));var BPromise=require(_0x79bd('0x5'));var rp=require(_0x79bd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79bd('0x7'));var config=require(_0x79bd('0x8'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x79bd('0x9'));module[_0x79bd('0xa')]=function(_0x35aaed,_0x4d0110){return _0x35aaed['define']('SugarcrmAccount',attributes,{'tableName':_0x79bd('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 6917967..eb8ce49 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 _0x8c9d=['GetSugarcrmAccount','debug','find','ShowSugarcrmAccount','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','SugarcrmAccount','options','raw','where','attributes','limit','include','map','model','then'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8c9d,0xe3));var _0xd8c9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8c9d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xd8c9('0x0'));var util=require(_0xd8c9('0x1'));var moment=require(_0xd8c9('0x2'));var BPromise=require(_0xd8c9('0x3'));var rs=require(_0xd8c9('0x4'));var fs=require('fs');var Redis=require(_0xd8c9('0x5'));var db=require(_0xd8c9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd8c9('0x7'))(_0xd8c9('0x8'));var config=require(_0xd8c9('0x9'));var jayson=require(_0xd8c9('0xa'));var client=jayson[_0xd8c9('0xb')][_0xd8c9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c5a05,_0x449ca4,_0x37f30d){return new BPromise(function(_0x13d006,_0x3d32fa){return client[_0xd8c9('0xd')](_0x3c5a05,_0x37f30d)['then'](function(_0x47cdbe){logger['info'](_0xd8c9('0xe'),_0x449ca4,_0xd8c9('0xf'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x449ca4,_0xd8c9('0xf'),JSON['stringify'](_0x47cdbe));if(_0x47cdbe['error']){if(_0x47cdbe[_0xd8c9('0x10')][_0xd8c9('0x11')]===0x1f4){logger[_0xd8c9('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x449ca4,_0x47cdbe['error'][_0xd8c9('0x12')]);return _0x3d32fa(_0x47cdbe['error'][_0xd8c9('0x12')]);}logger[_0xd8c9('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x449ca4,_0x47cdbe[_0xd8c9('0x10')][_0xd8c9('0x12')]);return _0x13d006(_0x47cdbe[_0xd8c9('0x10')]['message']);}else{logger[_0xd8c9('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x449ca4,_0xd8c9('0xf'));_0x13d006(_0x47cdbe[_0xd8c9('0x14')]['message']);}})[_0xd8c9('0x15')](function(_0xc24939){logger[_0xd8c9('0x10')](_0xd8c9('0xe'),_0x449ca4,_0xc24939);_0x3d32fa(_0xc24939);});});}exports['GetSugarcrmAccount']=function(_0x446305){var _0x583861=this;return new Promise(function(_0x1db8da,_0x2f968e){return db[_0xd8c9('0x16')]['findAll']({'raw':_0x446305[_0xd8c9('0x17')]?_0x446305[_0xd8c9('0x17')][_0xd8c9('0x18')]===undefined?!![]:![]:!![],'where':_0x446305[_0xd8c9('0x17')]?_0x446305[_0xd8c9('0x17')][_0xd8c9('0x19')]||null:null,'attributes':_0x446305[_0xd8c9('0x17')]?_0x446305[_0xd8c9('0x17')][_0xd8c9('0x1a')]||null:null,'limit':_0x446305['options']?_0x446305[_0xd8c9('0x17')][_0xd8c9('0x1b')]||null:null,'include':_0x446305[_0xd8c9('0x17')]?_0x446305['options'][_0xd8c9('0x1c')]?_[_0xd8c9('0x1d')](_0x446305['options'][_0xd8c9('0x1c')],function(_0x3009e5){return{'model':db[_0x3009e5[_0xd8c9('0x1e')]],'as':_0x3009e5['as'],'attributes':_0x3009e5[_0xd8c9('0x1a')],'include':_0x3009e5['include']?_['map'](_0x3009e5['include'],function(_0x46c73e){return{'model':db[_0x46c73e[_0xd8c9('0x1e')]],'as':_0x46c73e['as'],'attributes':_0x46c73e['attributes'],'include':_0x46c73e[_0xd8c9('0x1c')]?_[_0xd8c9('0x1d')](_0x46c73e[_0xd8c9('0x1c')],function(_0x4cdb10){return{'model':db[_0x4cdb10[_0xd8c9('0x1e')]],'as':_0x4cdb10['as'],'attributes':_0x4cdb10[_0xd8c9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd8c9('0x1f')](function(_0x4600be){logger[_0xd8c9('0x13')](_0xd8c9('0x20'),_0x446305);logger[_0xd8c9('0x21')]('GetSugarcrmAccount',_0x446305,JSON['stringify'](_0x4600be));_0x1db8da(_0x4600be);})[_0xd8c9('0x15')](function(_0x5bbcf2){logger[_0xd8c9('0x10')](_0xd8c9('0x20'),_0x5bbcf2['message'],_0x446305);_0x2f968e(_0x583861[_0xd8c9('0x10')](0x1f4,_0x5bbcf2[_0xd8c9('0x12')]));});});};exports['ShowSugarcrmAccount']=function(_0x59f8b6){var _0x4d406c=this;return new Promise(function(_0x276695,_0x5013e1){return db[_0xd8c9('0x16')][_0xd8c9('0x22')]({'raw':_0x59f8b6[_0xd8c9('0x17')]?_0x59f8b6[_0xd8c9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x59f8b6[_0xd8c9('0x17')]?_0x59f8b6['options'][_0xd8c9('0x19')]||null:null,'attributes':_0x59f8b6['options']?_0x59f8b6[_0xd8c9('0x17')][_0xd8c9('0x1a')]||null:null,'include':_0x59f8b6[_0xd8c9('0x17')]?_0x59f8b6[_0xd8c9('0x17')]['include']?_[_0xd8c9('0x1d')](_0x59f8b6[_0xd8c9('0x17')][_0xd8c9('0x1c')],function(_0x3d355b){return{'model':db[_0x3d355b[_0xd8c9('0x1e')]],'as':_0x3d355b['as'],'attributes':_0x3d355b[_0xd8c9('0x1a')],'include':_0x3d355b['include']?_[_0xd8c9('0x1d')](_0x3d355b[_0xd8c9('0x1c')],function(_0x52addd){return{'model':db[_0x52addd[_0xd8c9('0x1e')]],'as':_0x52addd['as'],'attributes':_0x52addd[_0xd8c9('0x1a')],'include':_0x52addd['include']?_['map'](_0x52addd[_0xd8c9('0x1c')],function(_0x5e189f){return{'model':db[_0x5e189f[_0xd8c9('0x1e')]],'as':_0x5e189f['as'],'attributes':_0x5e189f[_0xd8c9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd8c9('0x1f')](function(_0x79a122){logger[_0xd8c9('0x13')](_0xd8c9('0x23'),_0x59f8b6);logger[_0xd8c9('0x21')](_0xd8c9('0x23'),_0x59f8b6,JSON[_0xd8c9('0x24')](_0x79a122));_0x276695(_0x79a122);})['catch'](function(_0x9d61bd){logger[_0xd8c9('0x10')]('ShowSugarcrmAccount',_0x9d61bd[_0xd8c9('0x12')],_0x59f8b6);_0x5013e1(_0x4d406c[_0xd8c9('0x10')](0x1f4,_0x9d61bd[_0xd8c9('0x12')]));});});}; \ No newline at end of file +var _0xeb69=['error','code','message','result','catch','GetSugarcrmAccount','options','raw','where','attributes','limit','include','map','model','stringify','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x448327,_0x2aa6e2){var _0x597a98=function(_0x339867){while(--_0x339867){_0x448327['push'](_0x448327['shift']());}};_0x597a98(++_0x2aa6e2);}(_0xeb69,0xc5));var _0x9eb6=function(_0x388af2,_0x21c2dc){_0x388af2=_0x388af2-0x0;var _0x6b7ef7=_0xeb69[_0x388af2];return _0x6b7ef7;};'use strict';var _=require(_0x9eb6('0x0'));var util=require(_0x9eb6('0x1'));var moment=require(_0x9eb6('0x2'));var BPromise=require(_0x9eb6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9eb6('0x4'));var db=require(_0x9eb6('0x5'))['db'];var utils=require(_0x9eb6('0x6'));var logger=require(_0x9eb6('0x7'))('rpc');var config=require(_0x9eb6('0x8'));var jayson=require(_0x9eb6('0x9'));var client=jayson[_0x9eb6('0xa')][_0x9eb6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e5cb2,_0x1e8b14,_0x3c6f81){return new BPromise(function(_0x35a3cb,_0x1a42a5){return client[_0x9eb6('0xc')](_0x2e5cb2,_0x3c6f81)[_0x9eb6('0xd')](function(_0x1d9b75){logger[_0x9eb6('0xe')](_0x9eb6('0xf'),_0x1e8b14,'request\x20sent');logger[_0x9eb6('0x10')](_0x9eb6('0x11'),_0x1e8b14,_0x9eb6('0x12'),JSON['stringify'](_0x1d9b75));if(_0x1d9b75[_0x9eb6('0x13')]){if(_0x1d9b75[_0x9eb6('0x13')][_0x9eb6('0x14')]===0x1f4){logger[_0x9eb6('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x1e8b14,_0x1d9b75[_0x9eb6('0x13')]['message']);return _0x1a42a5(_0x1d9b75['error']['message']);}logger[_0x9eb6('0x13')](_0x9eb6('0xf'),_0x1e8b14,_0x1d9b75[_0x9eb6('0x13')]['message']);return _0x35a3cb(_0x1d9b75[_0x9eb6('0x13')][_0x9eb6('0x15')]);}else{logger[_0x9eb6('0xe')](_0x9eb6('0xf'),_0x1e8b14,_0x9eb6('0x12'));_0x35a3cb(_0x1d9b75[_0x9eb6('0x16')][_0x9eb6('0x15')]);}})[_0x9eb6('0x17')](function(_0x307896){logger['error'](_0x9eb6('0xf'),_0x1e8b14,_0x307896);_0x1a42a5(_0x307896);});});}exports[_0x9eb6('0x18')]=function(_0x48d961){var _0x324982=this;return new Promise(function(_0xb024bb,_0x55216a){return db['SugarcrmAccount']['findAll']({'raw':_0x48d961[_0x9eb6('0x19')]?_0x48d961[_0x9eb6('0x19')][_0x9eb6('0x1a')]===undefined?!![]:![]:!![],'where':_0x48d961[_0x9eb6('0x19')]?_0x48d961[_0x9eb6('0x19')][_0x9eb6('0x1b')]||null:null,'attributes':_0x48d961[_0x9eb6('0x19')]?_0x48d961[_0x9eb6('0x19')][_0x9eb6('0x1c')]||null:null,'limit':_0x48d961[_0x9eb6('0x19')]?_0x48d961['options'][_0x9eb6('0x1d')]||null:null,'include':_0x48d961[_0x9eb6('0x19')]?_0x48d961[_0x9eb6('0x19')][_0x9eb6('0x1e')]?_[_0x9eb6('0x1f')](_0x48d961[_0x9eb6('0x19')][_0x9eb6('0x1e')],function(_0x18978d){return{'model':db[_0x18978d[_0x9eb6('0x20')]],'as':_0x18978d['as'],'attributes':_0x18978d['attributes'],'include':_0x18978d[_0x9eb6('0x1e')]?_[_0x9eb6('0x1f')](_0x18978d[_0x9eb6('0x1e')],function(_0x5c9c63){return{'model':db[_0x5c9c63[_0x9eb6('0x20')]],'as':_0x5c9c63['as'],'attributes':_0x5c9c63[_0x9eb6('0x1c')],'include':_0x5c9c63[_0x9eb6('0x1e')]?_['map'](_0x5c9c63[_0x9eb6('0x1e')],function(_0x3adcb9){return{'model':db[_0x3adcb9[_0x9eb6('0x20')]],'as':_0x3adcb9['as'],'attributes':_0x3adcb9['attributes']};}):[]};}):[]};}):[]:[]})[_0x9eb6('0xd')](function(_0x44e0cb){logger[_0x9eb6('0xe')](_0x9eb6('0x18'),_0x48d961);logger['debug'](_0x9eb6('0x18'),_0x48d961,JSON[_0x9eb6('0x21')](_0x44e0cb));_0xb024bb(_0x44e0cb);})[_0x9eb6('0x17')](function(_0x1ef75b){logger['error'](_0x9eb6('0x18'),_0x1ef75b[_0x9eb6('0x15')],_0x48d961);_0x55216a(_0x324982[_0x9eb6('0x13')](0x1f4,_0x1ef75b['message']));});});};exports[_0x9eb6('0x22')]=function(_0x48c475){var _0x272e77=this;return new Promise(function(_0x2f25fa,_0x313cf6){return db['SugarcrmAccount'][_0x9eb6('0x23')]({'raw':_0x48c475[_0x9eb6('0x19')]?_0x48c475[_0x9eb6('0x19')][_0x9eb6('0x1a')]===undefined?!![]:![]:!![],'where':_0x48c475[_0x9eb6('0x19')]?_0x48c475[_0x9eb6('0x19')][_0x9eb6('0x1b')]||null:null,'attributes':_0x48c475[_0x9eb6('0x19')]?_0x48c475['options'][_0x9eb6('0x1c')]||null:null,'include':_0x48c475[_0x9eb6('0x19')]?_0x48c475[_0x9eb6('0x19')][_0x9eb6('0x1e')]?_[_0x9eb6('0x1f')](_0x48c475[_0x9eb6('0x19')][_0x9eb6('0x1e')],function(_0x4c72c9){return{'model':db[_0x4c72c9[_0x9eb6('0x20')]],'as':_0x4c72c9['as'],'attributes':_0x4c72c9[_0x9eb6('0x1c')],'include':_0x4c72c9[_0x9eb6('0x1e')]?_['map'](_0x4c72c9['include'],function(_0x471e89){return{'model':db[_0x471e89['model']],'as':_0x471e89['as'],'attributes':_0x471e89['attributes'],'include':_0x471e89[_0x9eb6('0x1e')]?_[_0x9eb6('0x1f')](_0x471e89[_0x9eb6('0x1e')],function(_0x15775a){return{'model':db[_0x15775a[_0x9eb6('0x20')]],'as':_0x15775a['as'],'attributes':_0x15775a[_0x9eb6('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e0739){logger[_0x9eb6('0xe')](_0x9eb6('0x22'),_0x48c475);logger['debug']('ShowSugarcrmAccount',_0x48c475,JSON[_0x9eb6('0x21')](_0x1e0739));_0x2f25fa(_0x1e0739);})[_0x9eb6('0x17')](function(_0x3aadf7){logger['error'](_0x9eb6('0x22'),_0x3aadf7['message'],_0x48c475);_0x313cf6(_0x272e77[_0x9eb6('0x13')](0x1f4,_0x3aadf7[_0x9eb6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index a10f387..0c2dcc2 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 _0xdd2f=['getDescriptions','create','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x4da966,_0x1a7ebf){var _0x23aaf0=function(_0x3f6d86){while(--_0x3f6d86){_0x4da966['push'](_0x4da966['shift']());}};_0x23aaf0(++_0x1a7ebf);}(_0xdd2f,0x1e8));var _0xfdd2=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xdd2f[_0x550d12];return _0x12103d;};'use strict';var multer=require('multer');var util=require(_0xfdd2('0x0'));var path=require(_0xfdd2('0x1'));var timeout=require(_0xfdd2('0x2'));var express=require(_0xfdd2('0x3'));var router=express[_0xfdd2('0x4')]();var fs_extra=require(_0xfdd2('0x5'));var auth=require(_0xfdd2('0x6'));var interaction=require(_0xfdd2('0x7'));var config=require(_0xfdd2('0x8'));var controller=require(_0xfdd2('0x9'));router[_0xfdd2('0xa')]('/',auth[_0xfdd2('0xb')](),controller['index']);router[_0xfdd2('0xa')](_0xfdd2('0xc'),auth[_0xfdd2('0xb')](),controller[_0xfdd2('0xd')]);router['get'](_0xfdd2('0xe'),auth[_0xfdd2('0xb')](),controller['getFields']);router[_0xfdd2('0xa')](_0xfdd2('0xf'),auth['isAuthenticated'](),controller[_0xfdd2('0x10')]);router['get'](_0xfdd2('0x11'),auth[_0xfdd2('0xb')](),controller[_0xfdd2('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfdd2('0x13')]);router['put'](_0xfdd2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xfdd2('0x14')](_0xfdd2('0xc'),auth[_0xfdd2('0xb')](),controller['destroy']);module[_0xfdd2('0x15')]=router; \ No newline at end of file +var _0x2f40=['../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','getDescriptions','post','create','put','update','delete','destroy','multer','util','fs-extra'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x2f40,0xc3));var _0x02f4=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x2f40[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0x02f4('0x0'));var util=require(_0x02f4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x02f4('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x02f4('0x3'));var controller=require(_0x02f4('0x4'));router[_0x02f4('0x5')]('/',auth[_0x02f4('0x6')](),controller['index']);router[_0x02f4('0x5')](_0x02f4('0x7'),auth[_0x02f4('0x6')](),controller[_0x02f4('0x8')]);router[_0x02f4('0x5')]('/:id/fields',auth[_0x02f4('0x6')](),controller[_0x02f4('0x9')]);router['get'](_0x02f4('0xa'),auth['isAuthenticated'](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x02f4('0x6')](),controller[_0x02f4('0xb')]);router[_0x02f4('0xc')]('/',auth[_0x02f4('0x6')](),controller[_0x02f4('0xd')]);router[_0x02f4('0xe')](_0x02f4('0x7'),auth[_0x02f4('0x6')](),controller[_0x02f4('0xf')]);router[_0x02f4('0x10')](_0x02f4('0x7'),auth[_0x02f4('0x6')](),controller[_0x02f4('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 040b78f..4541701 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 _0xb320=['exports','STRING'];(function(_0x43e4b3,_0x1444de){var _0x10c655=function(_0x56c01d){while(--_0x56c01d){_0x43e4b3['push'](_0x43e4b3['shift']());}};_0x10c655(++_0x1444de);}(_0xb320,0xaa));var _0x0b32=function(_0xf4666e,_0x571140){_0xf4666e=_0xf4666e-0x0;var _0x1853f1=_0xb320[_0xf4666e];return _0x1853f1;};'use strict';var Sequelize=require('sequelize');module[_0x0b32('0x0')]={'name':{'type':Sequelize[_0x0b32('0x1')]},'description':{'type':Sequelize[_0x0b32('0x1')]}}; \ No newline at end of file +var _0xca13=['sequelize','STRING'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xca13,0x7e));var _0x3ca1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xca13[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x3ca1('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3ca1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index bc2d780..50ba03d 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 _0x2125=['destroy','error','stack','name','SugarcrmConfiguration','type','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','length','options','find','create','body','params','findOne','SugarcrmField','rawAttributes','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then'];(function(_0xb4b80e,_0x1f02e8){var _0x5e4846=function(_0x12db2){while(--_0x12db2){_0xb4b80e['push'](_0xb4b80e['shift']());}};_0x5e4846(++_0x1f02e8);}(_0x2125,0x1b9));var _0x5212=function(_0x341f5f,_0xa1b593){_0x341f5f=_0x341f5f-0x0;var _0x3244b9=_0x2125[_0x341f5f];return _0x3244b9;};'use strict';var emlformat=require(_0x5212('0x0'));var rimraf=require(_0x5212('0x1'));var zipdir=require(_0x5212('0x2'));var jsonpatch=require(_0x5212('0x3'));var rp=require(_0x5212('0x4'));var moment=require('moment');var BPromise=require(_0x5212('0x5'));var Mustache=require(_0x5212('0x6'));var util=require(_0x5212('0x7'));var path=require(_0x5212('0x8'));var sox=require(_0x5212('0x9'));var csv=require(_0x5212('0xa'));var ejs=require(_0x5212('0xb'));var fs=require('fs');var fs_extra=require(_0x5212('0xc'));var _=require(_0x5212('0xd'));var squel=require(_0x5212('0xe'));var crypto=require(_0x5212('0xf'));var jsforce=require(_0x5212('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5212('0x11'));var Papa=require(_0x5212('0x12'));var Redis=require('ioredis');var authService=require(_0x5212('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5212('0x14'));var hardwareService=require(_0x5212('0x15'));var logger=require(_0x5212('0x16'))(_0x5212('0x17'));var utils=require('../../config/utils');var config=require(_0x5212('0x18'));var licenseUtil=require(_0x5212('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b2ef3,_0x292275){_0x292275=_0x292275||0xcc;return function(_0x343487){if(_0x343487){return _0x1b2ef3[_0x5212('0x1a')](_0x292275);}return _0x1b2ef3[_0x5212('0x1b')](_0x292275)[_0x5212('0x1c')]();};}function respondWithResult(_0x5997e4,_0x272feb){_0x272feb=_0x272feb||0xc8;return function(_0x13dd41){if(_0x13dd41){return _0x5997e4[_0x5212('0x1b')](_0x272feb)[_0x5212('0x1d')](_0x13dd41);}};}function respondWithFilteredResult(_0x5afc6b,_0x4be4ae){return function(_0x12b2c3){if(_0x12b2c3){var _0x71ec81=typeof _0x4be4ae[_0x5212('0x1e')]===_0x5212('0x1f')&&typeof _0x4be4ae[_0x5212('0x20')]===_0x5212('0x1f');var _0x11b88d=_0x12b2c3[_0x5212('0x21')];var _0x5bc8f6=_0x71ec81?0x0:_0x4be4ae[_0x5212('0x1e')];var _0x1e13e0=_0x71ec81?_0x12b2c3[_0x5212('0x21')]:_0x4be4ae[_0x5212('0x1e')]+_0x4be4ae[_0x5212('0x20')];var _0x1cac21;if(_0x1e13e0>=_0x11b88d){_0x1e13e0=_0x11b88d;_0x1cac21=0xc8;}else{_0x1cac21=0xce;}_0x5afc6b['status'](_0x1cac21);return _0x5afc6b[_0x5212('0x22')]('Content-Range',_0x5bc8f6+'-'+_0x1e13e0+'/'+_0x11b88d)['json'](_0x12b2c3);}return null;};}function patchUpdates(_0x2bab13){return function(_0x330de8){try{jsonpatch[_0x5212('0x23')](_0x330de8,_0x2bab13,!![]);}catch(_0x9243f2){return BPromise['reject'](_0x9243f2);}return _0x330de8[_0x5212('0x24')]();};}function saveUpdates(_0x1fb85f,_0x3d1277){return function(_0xb8d7ed){if(_0xb8d7ed){return _0xb8d7ed[_0x5212('0x25')](_0x1fb85f)[_0x5212('0x26')](function(_0x349e4f){return _0x349e4f;});}return null;};}function removeEntity(_0x36f69f,_0x2f4c74){return function(_0x36a52e){if(_0x36a52e){return _0x36a52e[_0x5212('0x27')]()[_0x5212('0x26')](function(){_0x36f69f[_0x5212('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x360e55,_0x30f2b5){return function(_0x19362d){if(!_0x19362d){_0x360e55['sendStatus'](0x194);}return _0x19362d;};}function handleError(_0x3568e0,_0x14e9d7){_0x14e9d7=_0x14e9d7||0x1f4;return function(_0x530981){logger[_0x5212('0x28')](_0x530981[_0x5212('0x29')]);if(_0x530981['name']){delete _0x530981[_0x5212('0x2a')];}_0x3568e0[_0x5212('0x1b')](_0x14e9d7)['send'](_0x530981);};}exports['index']=function(_0x377ca9,_0x4c2a48){var _0x13e85a={},_0x59ae90={},_0x29fc74={'count':0x0,'rows':[]};var _0x1efb82=_['map'](db[_0x5212('0x2b')]['rawAttributes'],function(_0x902da7){return{'name':_0x902da7['fieldName'],'type':_0x902da7[_0x5212('0x2c')]['key']};});_0x59ae90[_0x5212('0x2d')]=_[_0x5212('0x2e')](_0x1efb82,_0x5212('0x2a'));_0x59ae90[_0x5212('0x2f')]=_[_0x5212('0x30')](_0x377ca9[_0x5212('0x2f')]);_0x59ae90[_0x5212('0x31')]=_['intersection'](_0x59ae90[_0x5212('0x2d')],_0x59ae90[_0x5212('0x2f')]);_0x13e85a[_0x5212('0x32')]=_[_0x5212('0x33')](_0x59ae90['model'],qs['fields'](_0x377ca9[_0x5212('0x2f')][_0x5212('0x34')]));_0x13e85a[_0x5212('0x32')]=_0x13e85a[_0x5212('0x32')]['length']?_0x13e85a[_0x5212('0x32')]:_0x59ae90['model'];if(!_0x377ca9['query'][_0x5212('0x35')](_0x5212('0x36'))){_0x13e85a[_0x5212('0x20')]=qs['limit'](_0x377ca9[_0x5212('0x2f')]['limit']);_0x13e85a[_0x5212('0x1e')]=qs[_0x5212('0x1e')](_0x377ca9['query'][_0x5212('0x1e')]);}_0x13e85a[_0x5212('0x37')]=qs[_0x5212('0x38')](_0x377ca9[_0x5212('0x2f')]['sort']);_0x13e85a['where']=qs[_0x5212('0x31')](_[_0x5212('0x39')](_0x377ca9['query'],_0x59ae90['filters']),_0x1efb82);if(_0x377ca9['query'][_0x5212('0x3a')]){_0x13e85a['where']=_['merge'](_0x13e85a[_0x5212('0x3b')],{'$or':_['map'](_0x1efb82,function(_0x3a1104){if(_0x3a1104[_0x5212('0x2c')]!==_0x5212('0x3c')){var _0x438dbe={};_0x438dbe[_0x3a1104[_0x5212('0x2a')]]={'$like':'%'+_0x377ca9[_0x5212('0x2f')][_0x5212('0x3a')]+'%'};return _0x438dbe;}})});}_0x13e85a=_[_0x5212('0x3d')]({},_0x13e85a,_0x377ca9['options']);var _0x1937b9={'where':_0x13e85a[_0x5212('0x3b')]};return db[_0x5212('0x2b')][_0x5212('0x21')](_0x1937b9)[_0x5212('0x26')](function(_0xa16169){_0x29fc74[_0x5212('0x21')]=_0xa16169;if(_0x377ca9[_0x5212('0x2f')][_0x5212('0x3e')]){_0x13e85a[_0x5212('0x3f')]=[{'all':!![]}];}return db[_0x5212('0x2b')][_0x5212('0x40')](_0x13e85a);})[_0x5212('0x26')](function(_0x10c6ce){_0x29fc74[_0x5212('0x41')]=_0x10c6ce;return _0x29fc74;})[_0x5212('0x26')](respondWithFilteredResult(_0x4c2a48,_0x13e85a))[_0x5212('0x42')](handleError(_0x4c2a48,null));};exports[_0x5212('0x43')]=function(_0x4f7162,_0x59ffa3){var _0x40a414={'raw':![],'where':{'id':_0x4f7162['params']['id']}},_0x3c66d2={};_0x3c66d2['model']=_['keys'](db[_0x5212('0x2b')]['rawAttributes']);_0x3c66d2[_0x5212('0x2f')]=_[_0x5212('0x30')](_0x4f7162[_0x5212('0x2f')]);_0x3c66d2['filters']=_[_0x5212('0x33')](_0x3c66d2[_0x5212('0x2d')],_0x3c66d2[_0x5212('0x2f')]);_0x40a414[_0x5212('0x32')]=_[_0x5212('0x33')](_0x3c66d2[_0x5212('0x2d')],qs[_0x5212('0x34')](_0x4f7162[_0x5212('0x2f')][_0x5212('0x34')]));_0x40a414[_0x5212('0x32')]=_0x40a414[_0x5212('0x32')][_0x5212('0x44')]?_0x40a414[_0x5212('0x32')]:_0x3c66d2['model'];if(_0x4f7162[_0x5212('0x2f')][_0x5212('0x3e')]){_0x40a414[_0x5212('0x3f')]=[{'all':!![]}];}_0x40a414=_[_0x5212('0x3d')]({},_0x40a414,_0x4f7162[_0x5212('0x45')]);return db[_0x5212('0x2b')][_0x5212('0x46')](_0x40a414)[_0x5212('0x26')](handleEntityNotFound(_0x59ffa3,null))[_0x5212('0x26')](respondWithResult(_0x59ffa3,null))['catch'](handleError(_0x59ffa3,null));};exports[_0x5212('0x47')]=function(_0x5a7d9d,_0x5b331b){return db[_0x5212('0x2b')]['create'](_0x5a7d9d[_0x5212('0x48')],{})[_0x5212('0x26')](respondWithResult(_0x5b331b,0xc9))[_0x5212('0x42')](handleError(_0x5b331b,null));};exports['update']=function(_0x18b1b5,_0x9aa25d){if(_0x18b1b5[_0x5212('0x48')]['id']){delete _0x18b1b5[_0x5212('0x48')]['id'];}return db['SugarcrmConfiguration'][_0x5212('0x46')]({'where':{'id':_0x18b1b5['params']['id']}})['then'](handleEntityNotFound(_0x9aa25d,null))[_0x5212('0x26')](saveUpdates(_0x18b1b5[_0x5212('0x48')],null))[_0x5212('0x26')](respondWithResult(_0x9aa25d,null))['catch'](handleError(_0x9aa25d,null));};exports['destroy']=function(_0x5f5056,_0x1f768a){return db[_0x5212('0x2b')]['find']({'where':{'id':_0x5f5056[_0x5212('0x49')]['id']}})['then'](handleEntityNotFound(_0x1f768a,null))[_0x5212('0x26')](removeEntity(_0x1f768a,null))['catch'](handleError(_0x1f768a,null));};exports['getFields']=function(_0x249365,_0x152210,_0x923dfa){var _0x4b8d4f={};var _0x5cf7d4={};var _0x5804fc;var _0xc883c9;return db['SugarcrmConfiguration'][_0x5212('0x4a')]({'where':{'id':_0x249365[_0x5212('0x49')]['id']}})['then'](handleEntityNotFound(_0x152210,null))['then'](function(_0x1b96e2){if(_0x1b96e2){_0x5804fc=_0x1b96e2;_0x5cf7d4[_0x5212('0x2d')]=_[_0x5212('0x30')](db[_0x5212('0x4b')][_0x5212('0x4c')]);_0x5cf7d4[_0x5212('0x2f')]=_[_0x5212('0x30')](_0x249365[_0x5212('0x2f')]);_0x5cf7d4[_0x5212('0x31')]=_['intersection'](_0x5cf7d4[_0x5212('0x2d')],_0x5cf7d4['query']);_0x4b8d4f[_0x5212('0x32')]=_[_0x5212('0x33')](_0x5cf7d4['model'],qs[_0x5212('0x34')](_0x249365['query'][_0x5212('0x34')]));_0x4b8d4f['attributes']=_0x4b8d4f['attributes'][_0x5212('0x44')]?_0x4b8d4f[_0x5212('0x32')]:_0x5cf7d4[_0x5212('0x2d')];_0x4b8d4f[_0x5212('0x37')]=qs[_0x5212('0x38')](_0x249365['query'][_0x5212('0x38')]);_0x4b8d4f['where']=qs[_0x5212('0x31')](_[_0x5212('0x39')](_0x249365[_0x5212('0x2f')],_0x5cf7d4[_0x5212('0x31')]));if(_0x249365[_0x5212('0x2f')][_0x5212('0x3a')]){_0x4b8d4f[_0x5212('0x3b')]=_[_0x5212('0x3d')](_0x4b8d4f[_0x5212('0x3b')],{'$or':_['map'](_0x4b8d4f[_0x5212('0x32')],function(_0x44a495){var _0x38a689={};_0x38a689[_0x44a495]={'$like':'%'+_0x249365['query'][_0x5212('0x3a')]+'%'};return _0x38a689;})});}_0x4b8d4f=_[_0x5212('0x3d')]({},_0x4b8d4f,_0x249365[_0x5212('0x45')]);return _0x5804fc[_0x5212('0x4d')](_0x4b8d4f);}})[_0x5212('0x26')](function(_0x203084){if(_0x203084){_0xc883c9=_0x203084[_0x5212('0x44')];if(!_0x249365['query'][_0x5212('0x35')](_0x5212('0x36'))){_0x4b8d4f[_0x5212('0x20')]=qs[_0x5212('0x20')](_0x249365[_0x5212('0x2f')][_0x5212('0x20')]);_0x4b8d4f[_0x5212('0x1e')]=qs[_0x5212('0x1e')](_0x249365[_0x5212('0x2f')]['offset']);}return _0x5804fc['getFields'](_0x4b8d4f);}})[_0x5212('0x26')](function(_0x4c2b6b){if(_0x4c2b6b){return _0x4c2b6b?{'count':_0xc883c9,'rows':_0x4c2b6b}:null;}})[_0x5212('0x26')](respondWithResult(_0x152210,null))[_0x5212('0x42')](handleError(_0x152210,null));};exports[_0x5212('0x4e')]=function(_0x26f4f1,_0x2a234b,_0x52a87f){var _0x3e7243={};var _0x39b1f1={};var _0xa2271f;var _0x59e3ca;return db[_0x5212('0x2b')]['findOne']({'where':{'id':_0x26f4f1[_0x5212('0x49')]['id']}})[_0x5212('0x26')](handleEntityNotFound(_0x2a234b,null))[_0x5212('0x26')](function(_0x34a345){if(_0x34a345){_0xa2271f=_0x34a345;_0x39b1f1['model']=_[_0x5212('0x30')](db[_0x5212('0x4b')][_0x5212('0x4c')]);_0x39b1f1['query']=_[_0x5212('0x30')](_0x26f4f1['query']);_0x39b1f1[_0x5212('0x31')]=_['intersection'](_0x39b1f1['model'],_0x39b1f1['query']);_0x3e7243[_0x5212('0x32')]=_['intersection'](_0x39b1f1['model'],qs['fields'](_0x26f4f1['query']['fields']));_0x3e7243[_0x5212('0x32')]=_0x3e7243[_0x5212('0x32')][_0x5212('0x44')]?_0x3e7243[_0x5212('0x32')]:_0x39b1f1[_0x5212('0x2d')];_0x3e7243['order']=qs[_0x5212('0x38')](_0x26f4f1[_0x5212('0x2f')][_0x5212('0x38')]);_0x3e7243[_0x5212('0x3b')]=qs['filters'](_[_0x5212('0x39')](_0x26f4f1[_0x5212('0x2f')],_0x39b1f1['filters']));if(_0x26f4f1[_0x5212('0x2f')][_0x5212('0x3a')]){_0x3e7243['where']=_['merge'](_0x3e7243['where'],{'$or':_['map'](_0x3e7243['attributes'],function(_0x38113e){var _0x46e4bc={};_0x46e4bc[_0x38113e]={'$like':'%'+_0x26f4f1[_0x5212('0x2f')][_0x5212('0x3a')]+'%'};return _0x46e4bc;})});}_0x3e7243=_['merge']({},_0x3e7243,_0x26f4f1[_0x5212('0x45')]);return _0xa2271f[_0x5212('0x4e')](_0x3e7243);}})[_0x5212('0x26')](function(_0x535347){if(_0x535347){_0x59e3ca=_0x535347['length'];if(!_0x26f4f1[_0x5212('0x2f')][_0x5212('0x35')](_0x5212('0x36'))){_0x3e7243['limit']=qs[_0x5212('0x20')](_0x26f4f1['query'][_0x5212('0x20')]);_0x3e7243['offset']=qs[_0x5212('0x1e')](_0x26f4f1['query']['offset']);}return _0xa2271f[_0x5212('0x4e')](_0x3e7243);}})[_0x5212('0x26')](function(_0x32e2f1){if(_0x32e2f1){return _0x32e2f1?{'count':_0x59e3ca,'rows':_0x32e2f1}:null;}})[_0x5212('0x26')](respondWithResult(_0x2a234b,null))[_0x5212('0x42')](handleError(_0x2a234b,null));};exports[_0x5212('0x4f')]=function(_0x47fe8c,_0x134348,_0x38f7a6){var _0x29c40d={};var _0x5a41ce={};var _0x206468;var _0x1e291b;return db[_0x5212('0x2b')][_0x5212('0x4a')]({'where':{'id':_0x47fe8c['params']['id']}})['then'](handleEntityNotFound(_0x134348,null))[_0x5212('0x26')](function(_0x340381){if(_0x340381){_0x206468=_0x340381;_0x5a41ce[_0x5212('0x2d')]=_['keys'](db[_0x5212('0x4b')][_0x5212('0x4c')]);_0x5a41ce[_0x5212('0x2f')]=_['keys'](_0x47fe8c[_0x5212('0x2f')]);_0x5a41ce[_0x5212('0x31')]=_[_0x5212('0x33')](_0x5a41ce[_0x5212('0x2d')],_0x5a41ce[_0x5212('0x2f')]);_0x29c40d[_0x5212('0x32')]=_[_0x5212('0x33')](_0x5a41ce[_0x5212('0x2d')],qs[_0x5212('0x34')](_0x47fe8c['query']['fields']));_0x29c40d['attributes']=_0x29c40d['attributes']['length']?_0x29c40d[_0x5212('0x32')]:_0x5a41ce['model'];_0x29c40d[_0x5212('0x37')]=qs[_0x5212('0x38')](_0x47fe8c[_0x5212('0x2f')]['sort']);_0x29c40d['where']=qs[_0x5212('0x31')](_['pick'](_0x47fe8c[_0x5212('0x2f')],_0x5a41ce['filters']));if(_0x47fe8c[_0x5212('0x2f')][_0x5212('0x3a')]){_0x29c40d['where']=_[_0x5212('0x3d')](_0x29c40d[_0x5212('0x3b')],{'$or':_[_0x5212('0x2e')](_0x29c40d[_0x5212('0x32')],function(_0x5f01e7){var _0x1d5f2a={};_0x1d5f2a[_0x5f01e7]={'$like':'%'+_0x47fe8c['query'][_0x5212('0x3a')]+'%'};return _0x1d5f2a;})});}_0x29c40d=_['merge']({},_0x29c40d,_0x47fe8c[_0x5212('0x45')]);return _0x206468[_0x5212('0x4f')](_0x29c40d);}})['then'](function(_0x397553){if(_0x397553){_0x1e291b=_0x397553['length'];if(!_0x47fe8c[_0x5212('0x2f')][_0x5212('0x35')](_0x5212('0x36'))){_0x29c40d[_0x5212('0x20')]=qs[_0x5212('0x20')](_0x47fe8c[_0x5212('0x2f')][_0x5212('0x20')]);_0x29c40d['offset']=qs['offset'](_0x47fe8c[_0x5212('0x2f')][_0x5212('0x1e')]);}return _0x206468['getDescriptions'](_0x29c40d);}})[_0x5212('0x26')](function(_0x58fc99){if(_0x58fc99){return _0x58fc99?{'count':_0x1e291b,'rows':_0x58fc99}:null;}})['then'](respondWithResult(_0x134348,null))[_0x5212('0x42')](handleError(_0x134348,null));}; \ No newline at end of file +var _0xccde=['sendStatus','status','end','json','offset','undefined','count','limit','set','apply','destroy','then','stack','name','send','fieldName','type','key','model','map','keys','filters','intersection','query','fields','attributes','length','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','SugarcrmConfiguration','findAll','rows','show','params','catch','create','update','body','find','findOne','SugarcrmField','getFields','hasOwnProperty','nolimit','getSubjects','rawAttributes','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xccde,0x17b));var _0xeccd=function(_0x4c184d,_0x4278ab){_0x4c184d=_0x4c184d-0x0;var _0x23d997=_0xccde[_0x4c184d];return _0x23d997;};'use strict';var emlformat=require(_0xeccd('0x0'));var rimraf=require(_0xeccd('0x1'));var zipdir=require(_0xeccd('0x2'));var jsonpatch=require(_0xeccd('0x3'));var rp=require(_0xeccd('0x4'));var moment=require(_0xeccd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xeccd('0x6'));var util=require(_0xeccd('0x7'));var path=require(_0xeccd('0x8'));var sox=require(_0xeccd('0x9'));var csv=require(_0xeccd('0xa'));var ejs=require(_0xeccd('0xb'));var fs=require('fs');var fs_extra=require(_0xeccd('0xc'));var _=require(_0xeccd('0xd'));var squel=require(_0xeccd('0xe'));var crypto=require('crypto');var jsforce=require(_0xeccd('0xf'));var deskjs=require(_0xeccd('0x10'));var toCsv=require('to-csv');var querystring=require(_0xeccd('0x11'));var Papa=require(_0xeccd('0x12'));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(_0xeccd('0x13'));var logger=require(_0xeccd('0x14'))(_0xeccd('0x15'));var utils=require(_0xeccd('0x16'));var config=require(_0xeccd('0x17'));var licenseUtil=require(_0xeccd('0x18'));var db=require(_0xeccd('0x19'))['db'];function respondWithStatusCode(_0x113ee9,_0x5937d8){_0x5937d8=_0x5937d8||0xcc;return function(_0x177bc1){if(_0x177bc1){return _0x113ee9[_0xeccd('0x1a')](_0x5937d8);}return _0x113ee9[_0xeccd('0x1b')](_0x5937d8)[_0xeccd('0x1c')]();};}function respondWithResult(_0x10df0d,_0xa63ae5){_0xa63ae5=_0xa63ae5||0xc8;return function(_0x5a2a8c){if(_0x5a2a8c){return _0x10df0d[_0xeccd('0x1b')](_0xa63ae5)[_0xeccd('0x1d')](_0x5a2a8c);}};}function respondWithFilteredResult(_0x1ab1cb,_0x5e775f){return function(_0x25de67){if(_0x25de67){var _0x3e3ace=typeof _0x5e775f[_0xeccd('0x1e')]===_0xeccd('0x1f')&&typeof _0x5e775f['limit']===_0xeccd('0x1f');var _0x71a163=_0x25de67[_0xeccd('0x20')];var _0x5dd2c4=_0x3e3ace?0x0:_0x5e775f[_0xeccd('0x1e')];var _0xd19818=_0x3e3ace?_0x25de67[_0xeccd('0x20')]:_0x5e775f['offset']+_0x5e775f[_0xeccd('0x21')];var _0x4f2537;if(_0xd19818>=_0x71a163){_0xd19818=_0x71a163;_0x4f2537=0xc8;}else{_0x4f2537=0xce;}_0x1ab1cb['status'](_0x4f2537);return _0x1ab1cb[_0xeccd('0x22')]('Content-Range',_0x5dd2c4+'-'+_0xd19818+'/'+_0x71a163)['json'](_0x25de67);}return null;};}function patchUpdates(_0x4556fd){return function(_0x40b244){try{jsonpatch[_0xeccd('0x23')](_0x40b244,_0x4556fd,!![]);}catch(_0x5cc218){return BPromise['reject'](_0x5cc218);}return _0x40b244['save']();};}function saveUpdates(_0x51563d,_0x4b44ae){return function(_0x3d9fcd){if(_0x3d9fcd){return _0x3d9fcd['update'](_0x51563d)['then'](function(_0x32598b){return _0x32598b;});}return null;};}function removeEntity(_0x2993fb,_0x3811a3){return function(_0x312284){if(_0x312284){return _0x312284[_0xeccd('0x24')]()[_0xeccd('0x25')](function(){_0x2993fb[_0xeccd('0x1b')](0xcc)[_0xeccd('0x1c')]();});}};}function handleEntityNotFound(_0x574e8a,_0x7bf222){return function(_0x9639a9){if(!_0x9639a9){_0x574e8a['sendStatus'](0x194);}return _0x9639a9;};}function handleError(_0x59de1e,_0x44198b){_0x44198b=_0x44198b||0x1f4;return function(_0x4f9a87){logger['error'](_0x4f9a87[_0xeccd('0x26')]);if(_0x4f9a87[_0xeccd('0x27')]){delete _0x4f9a87[_0xeccd('0x27')];}_0x59de1e[_0xeccd('0x1b')](_0x44198b)[_0xeccd('0x28')](_0x4f9a87);};}exports['index']=function(_0x32b0de,_0xd0c71d){var _0x45d9fa={},_0x189877={},_0x2bc086={'count':0x0,'rows':[]};var _0x3aa527=_['map'](db['SugarcrmConfiguration']['rawAttributes'],function(_0x7ae33e){return{'name':_0x7ae33e[_0xeccd('0x29')],'type':_0x7ae33e[_0xeccd('0x2a')][_0xeccd('0x2b')]};});_0x189877[_0xeccd('0x2c')]=_[_0xeccd('0x2d')](_0x3aa527,'name');_0x189877['query']=_[_0xeccd('0x2e')](_0x32b0de['query']);_0x189877[_0xeccd('0x2f')]=_[_0xeccd('0x30')](_0x189877['model'],_0x189877[_0xeccd('0x31')]);_0x45d9fa['attributes']=_['intersection'](_0x189877[_0xeccd('0x2c')],qs[_0xeccd('0x32')](_0x32b0de[_0xeccd('0x31')][_0xeccd('0x32')]));_0x45d9fa[_0xeccd('0x33')]=_0x45d9fa[_0xeccd('0x33')][_0xeccd('0x34')]?_0x45d9fa['attributes']:_0x189877['model'];if(!_0x32b0de[_0xeccd('0x31')]['hasOwnProperty']('nolimit')){_0x45d9fa[_0xeccd('0x21')]=qs[_0xeccd('0x21')](_0x32b0de['query']['limit']);_0x45d9fa[_0xeccd('0x1e')]=qs[_0xeccd('0x1e')](_0x32b0de[_0xeccd('0x31')]['offset']);}_0x45d9fa[_0xeccd('0x35')]=qs[_0xeccd('0x36')](_0x32b0de[_0xeccd('0x31')]['sort']);_0x45d9fa['where']=qs['filters'](_[_0xeccd('0x37')](_0x32b0de['query'],_0x189877[_0xeccd('0x2f')]),_0x3aa527);if(_0x32b0de[_0xeccd('0x31')][_0xeccd('0x38')]){_0x45d9fa[_0xeccd('0x39')]=_[_0xeccd('0x3a')](_0x45d9fa[_0xeccd('0x39')],{'$or':_['map'](_0x3aa527,function(_0x39b6c0){if(_0x39b6c0[_0xeccd('0x2a')]!==_0xeccd('0x3b')){var _0x11249b={};_0x11249b[_0x39b6c0[_0xeccd('0x27')]]={'$like':'%'+_0x32b0de[_0xeccd('0x31')][_0xeccd('0x38')]+'%'};return _0x11249b;}})});}_0x45d9fa=_['merge']({},_0x45d9fa,_0x32b0de[_0xeccd('0x3c')]);var _0x239b3d={'where':_0x45d9fa[_0xeccd('0x39')]};return db['SugarcrmConfiguration'][_0xeccd('0x20')](_0x239b3d)['then'](function(_0x223e48){_0x2bc086[_0xeccd('0x20')]=_0x223e48;if(_0x32b0de[_0xeccd('0x31')][_0xeccd('0x3d')]){_0x45d9fa[_0xeccd('0x3e')]=[{'all':!![]}];}return db[_0xeccd('0x3f')][_0xeccd('0x40')](_0x45d9fa);})['then'](function(_0x3921d1){_0x2bc086[_0xeccd('0x41')]=_0x3921d1;return _0x2bc086;})['then'](respondWithFilteredResult(_0xd0c71d,_0x45d9fa))['catch'](handleError(_0xd0c71d,null));};exports[_0xeccd('0x42')]=function(_0x357981,_0x885966){var _0x52758a={'raw':![],'where':{'id':_0x357981[_0xeccd('0x43')]['id']}},_0x45e9be={};_0x45e9be[_0xeccd('0x2c')]=_['keys'](db['SugarcrmConfiguration']['rawAttributes']);_0x45e9be[_0xeccd('0x31')]=_[_0xeccd('0x2e')](_0x357981['query']);_0x45e9be[_0xeccd('0x2f')]=_[_0xeccd('0x30')](_0x45e9be['model'],_0x45e9be[_0xeccd('0x31')]);_0x52758a['attributes']=_['intersection'](_0x45e9be[_0xeccd('0x2c')],qs[_0xeccd('0x32')](_0x357981[_0xeccd('0x31')][_0xeccd('0x32')]));_0x52758a[_0xeccd('0x33')]=_0x52758a[_0xeccd('0x33')][_0xeccd('0x34')]?_0x52758a[_0xeccd('0x33')]:_0x45e9be[_0xeccd('0x2c')];if(_0x357981['query'][_0xeccd('0x3d')]){_0x52758a[_0xeccd('0x3e')]=[{'all':!![]}];}_0x52758a=_[_0xeccd('0x3a')]({},_0x52758a,_0x357981['options']);return db[_0xeccd('0x3f')]['find'](_0x52758a)[_0xeccd('0x25')](handleEntityNotFound(_0x885966,null))[_0xeccd('0x25')](respondWithResult(_0x885966,null))[_0xeccd('0x44')](handleError(_0x885966,null));};exports[_0xeccd('0x45')]=function(_0x204dd8,_0xdb6245){return db[_0xeccd('0x3f')]['create'](_0x204dd8['body'],{})['then'](respondWithResult(_0xdb6245,0xc9))['catch'](handleError(_0xdb6245,null));};exports[_0xeccd('0x46')]=function(_0x378cc4,_0x1344c8){if(_0x378cc4[_0xeccd('0x47')]['id']){delete _0x378cc4[_0xeccd('0x47')]['id'];}return db[_0xeccd('0x3f')]['find']({'where':{'id':_0x378cc4[_0xeccd('0x43')]['id']}})['then'](handleEntityNotFound(_0x1344c8,null))[_0xeccd('0x25')](saveUpdates(_0x378cc4['body'],null))[_0xeccd('0x25')](respondWithResult(_0x1344c8,null))['catch'](handleError(_0x1344c8,null));};exports[_0xeccd('0x24')]=function(_0x14f227,_0x22d70b){return db['SugarcrmConfiguration'][_0xeccd('0x48')]({'where':{'id':_0x14f227[_0xeccd('0x43')]['id']}})[_0xeccd('0x25')](handleEntityNotFound(_0x22d70b,null))['then'](removeEntity(_0x22d70b,null))[_0xeccd('0x44')](handleError(_0x22d70b,null));};exports['getFields']=function(_0x2f7327,_0x19944e,_0x2f75e4){var _0x4fb2bc={};var _0x479660={};var _0x172ae7;var _0x438b64;return db['SugarcrmConfiguration'][_0xeccd('0x49')]({'where':{'id':_0x2f7327[_0xeccd('0x43')]['id']}})[_0xeccd('0x25')](handleEntityNotFound(_0x19944e,null))['then'](function(_0x396c19){if(_0x396c19){_0x172ae7=_0x396c19;_0x479660[_0xeccd('0x2c')]=_[_0xeccd('0x2e')](db[_0xeccd('0x4a')]['rawAttributes']);_0x479660[_0xeccd('0x31')]=_[_0xeccd('0x2e')](_0x2f7327[_0xeccd('0x31')]);_0x479660[_0xeccd('0x2f')]=_['intersection'](_0x479660[_0xeccd('0x2c')],_0x479660[_0xeccd('0x31')]);_0x4fb2bc[_0xeccd('0x33')]=_[_0xeccd('0x30')](_0x479660[_0xeccd('0x2c')],qs[_0xeccd('0x32')](_0x2f7327[_0xeccd('0x31')][_0xeccd('0x32')]));_0x4fb2bc['attributes']=_0x4fb2bc[_0xeccd('0x33')][_0xeccd('0x34')]?_0x4fb2bc[_0xeccd('0x33')]:_0x479660['model'];_0x4fb2bc[_0xeccd('0x35')]=qs[_0xeccd('0x36')](_0x2f7327[_0xeccd('0x31')]['sort']);_0x4fb2bc[_0xeccd('0x39')]=qs[_0xeccd('0x2f')](_[_0xeccd('0x37')](_0x2f7327['query'],_0x479660[_0xeccd('0x2f')]));if(_0x2f7327['query'][_0xeccd('0x38')]){_0x4fb2bc[_0xeccd('0x39')]=_['merge'](_0x4fb2bc[_0xeccd('0x39')],{'$or':_[_0xeccd('0x2d')](_0x4fb2bc[_0xeccd('0x33')],function(_0x171aa5){var _0xc71e5d={};_0xc71e5d[_0x171aa5]={'$like':'%'+_0x2f7327['query']['filter']+'%'};return _0xc71e5d;})});}_0x4fb2bc=_[_0xeccd('0x3a')]({},_0x4fb2bc,_0x2f7327['options']);return _0x172ae7[_0xeccd('0x4b')](_0x4fb2bc);}})[_0xeccd('0x25')](function(_0x226ca8){if(_0x226ca8){_0x438b64=_0x226ca8[_0xeccd('0x34')];if(!_0x2f7327[_0xeccd('0x31')][_0xeccd('0x4c')](_0xeccd('0x4d'))){_0x4fb2bc[_0xeccd('0x21')]=qs[_0xeccd('0x21')](_0x2f7327[_0xeccd('0x31')]['limit']);_0x4fb2bc[_0xeccd('0x1e')]=qs[_0xeccd('0x1e')](_0x2f7327[_0xeccd('0x31')][_0xeccd('0x1e')]);}return _0x172ae7[_0xeccd('0x4b')](_0x4fb2bc);}})[_0xeccd('0x25')](function(_0x9e40cf){if(_0x9e40cf){return _0x9e40cf?{'count':_0x438b64,'rows':_0x9e40cf}:null;}})['then'](respondWithResult(_0x19944e,null))[_0xeccd('0x44')](handleError(_0x19944e,null));};exports[_0xeccd('0x4e')]=function(_0xda92fd,_0x25a976,_0x13dd0d){var _0x2186d5={};var _0x56200={};var _0x1057f9;var _0x1ad2b4;return db[_0xeccd('0x3f')][_0xeccd('0x49')]({'where':{'id':_0xda92fd[_0xeccd('0x43')]['id']}})[_0xeccd('0x25')](handleEntityNotFound(_0x25a976,null))[_0xeccd('0x25')](function(_0x5bc3d6){if(_0x5bc3d6){_0x1057f9=_0x5bc3d6;_0x56200[_0xeccd('0x2c')]=_[_0xeccd('0x2e')](db[_0xeccd('0x4a')][_0xeccd('0x4f')]);_0x56200[_0xeccd('0x31')]=_['keys'](_0xda92fd[_0xeccd('0x31')]);_0x56200[_0xeccd('0x2f')]=_[_0xeccd('0x30')](_0x56200[_0xeccd('0x2c')],_0x56200[_0xeccd('0x31')]);_0x2186d5[_0xeccd('0x33')]=_[_0xeccd('0x30')](_0x56200['model'],qs[_0xeccd('0x32')](_0xda92fd['query'][_0xeccd('0x32')]));_0x2186d5[_0xeccd('0x33')]=_0x2186d5['attributes'][_0xeccd('0x34')]?_0x2186d5[_0xeccd('0x33')]:_0x56200[_0xeccd('0x2c')];_0x2186d5[_0xeccd('0x35')]=qs['sort'](_0xda92fd[_0xeccd('0x31')][_0xeccd('0x36')]);_0x2186d5[_0xeccd('0x39')]=qs[_0xeccd('0x2f')](_['pick'](_0xda92fd['query'],_0x56200[_0xeccd('0x2f')]));if(_0xda92fd[_0xeccd('0x31')][_0xeccd('0x38')]){_0x2186d5[_0xeccd('0x39')]=_[_0xeccd('0x3a')](_0x2186d5[_0xeccd('0x39')],{'$or':_['map'](_0x2186d5[_0xeccd('0x33')],function(_0x3b73a1){var _0x5353cf={};_0x5353cf[_0x3b73a1]={'$like':'%'+_0xda92fd[_0xeccd('0x31')]['filter']+'%'};return _0x5353cf;})});}_0x2186d5=_[_0xeccd('0x3a')]({},_0x2186d5,_0xda92fd[_0xeccd('0x3c')]);return _0x1057f9['getSubjects'](_0x2186d5);}})['then'](function(_0x99921){if(_0x99921){_0x1ad2b4=_0x99921['length'];if(!_0xda92fd['query']['hasOwnProperty']('nolimit')){_0x2186d5[_0xeccd('0x21')]=qs[_0xeccd('0x21')](_0xda92fd['query'][_0xeccd('0x21')]);_0x2186d5['offset']=qs[_0xeccd('0x1e')](_0xda92fd['query'][_0xeccd('0x1e')]);}return _0x1057f9[_0xeccd('0x4e')](_0x2186d5);}})[_0xeccd('0x25')](function(_0x40c4d4){if(_0x40c4d4){return _0x40c4d4?{'count':_0x1ad2b4,'rows':_0x40c4d4}:null;}})[_0xeccd('0x25')](respondWithResult(_0x25a976,null))['catch'](handleError(_0x25a976,null));};exports[_0xeccd('0x50')]=function(_0x2dd8a7,_0x211105,_0x55c065){var _0x12caa8={};var _0x490a39={};var _0x50da3b;var _0x5e5a4c;return db[_0xeccd('0x3f')][_0xeccd('0x49')]({'where':{'id':_0x2dd8a7[_0xeccd('0x43')]['id']}})['then'](handleEntityNotFound(_0x211105,null))[_0xeccd('0x25')](function(_0x59cc63){if(_0x59cc63){_0x50da3b=_0x59cc63;_0x490a39[_0xeccd('0x2c')]=_[_0xeccd('0x2e')](db[_0xeccd('0x4a')]['rawAttributes']);_0x490a39['query']=_[_0xeccd('0x2e')](_0x2dd8a7[_0xeccd('0x31')]);_0x490a39[_0xeccd('0x2f')]=_['intersection'](_0x490a39[_0xeccd('0x2c')],_0x490a39[_0xeccd('0x31')]);_0x12caa8['attributes']=_['intersection'](_0x490a39[_0xeccd('0x2c')],qs[_0xeccd('0x32')](_0x2dd8a7[_0xeccd('0x31')][_0xeccd('0x32')]));_0x12caa8[_0xeccd('0x33')]=_0x12caa8['attributes'][_0xeccd('0x34')]?_0x12caa8[_0xeccd('0x33')]:_0x490a39['model'];_0x12caa8[_0xeccd('0x35')]=qs[_0xeccd('0x36')](_0x2dd8a7[_0xeccd('0x31')]['sort']);_0x12caa8[_0xeccd('0x39')]=qs[_0xeccd('0x2f')](_[_0xeccd('0x37')](_0x2dd8a7[_0xeccd('0x31')],_0x490a39[_0xeccd('0x2f')]));if(_0x2dd8a7['query']['filter']){_0x12caa8[_0xeccd('0x39')]=_[_0xeccd('0x3a')](_0x12caa8[_0xeccd('0x39')],{'$or':_[_0xeccd('0x2d')](_0x12caa8[_0xeccd('0x33')],function(_0x4d2913){var _0x7abaa6={};_0x7abaa6[_0x4d2913]={'$like':'%'+_0x2dd8a7[_0xeccd('0x31')][_0xeccd('0x38')]+'%'};return _0x7abaa6;})});}_0x12caa8=_[_0xeccd('0x3a')]({},_0x12caa8,_0x2dd8a7[_0xeccd('0x3c')]);return _0x50da3b['getDescriptions'](_0x12caa8);}})[_0xeccd('0x25')](function(_0x3b9906){if(_0x3b9906){_0x5e5a4c=_0x3b9906[_0xeccd('0x34')];if(!_0x2dd8a7[_0xeccd('0x31')][_0xeccd('0x4c')](_0xeccd('0x4d'))){_0x12caa8[_0xeccd('0x21')]=qs[_0xeccd('0x21')](_0x2dd8a7[_0xeccd('0x31')][_0xeccd('0x21')]);_0x12caa8['offset']=qs[_0xeccd('0x1e')](_0x2dd8a7['query'][_0xeccd('0x1e')]);}return _0x50da3b[_0xeccd('0x50')](_0x12caa8);}})[_0xeccd('0x25')](function(_0x5835d2){if(_0x5835d2){return _0x5835d2?{'count':_0x5e5a4c,'rows':_0x5835d2}:null;}})[_0xeccd('0x25')](respondWithResult(_0x211105,null))['catch'](handleError(_0x211105,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index b432b8b..1121ff1 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 _0x080b=['int_sugarcrm_configurations','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','SugarcrmConfiguration'];(function(_0x19a4f4,_0x5c640d){var _0x45e634=function(_0x172f67){while(--_0x172f67){_0x19a4f4['push'](_0x19a4f4['shift']());}};_0x45e634(++_0x5c640d);}(_0x080b,0x1a5));var _0xb080=function(_0x1976e7,_0x5330c3){_0x1976e7=_0x1976e7-0x0;var _0x5b3d32=_0x080b[_0x1976e7];return _0x5b3d32;};'use strict';var _=require(_0xb080('0x0'));var util=require('util');var logger=require(_0xb080('0x1'))(_0xb080('0x2'));var moment=require(_0xb080('0x3'));var BPromise=require(_0xb080('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb080('0x5'));var rimraf=require(_0xb080('0x6'));var config=require(_0xb080('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x36e506,_0x5f02cb){return _0x36e506['define'](_0xb080('0x8'),attributes,{'tableName':_0xb080('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31e0=['../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5240d4,_0x4e7ad5){var _0x840c0=function(_0xaa977b){while(--_0xaa977b){_0x5240d4['push'](_0x5240d4['shift']());}};_0x840c0(++_0x4e7ad5);}(_0x31e0,0x119));var _0x031e=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x31e0[_0xbf8ebe];return _0x1e25e8;};'use strict';var _=require(_0x031e('0x0'));var util=require('util');var logger=require(_0x031e('0x1'))(_0x031e('0x2'));var moment=require(_0x031e('0x3'));var BPromise=require(_0x031e('0x4'));var rp=require(_0x031e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x031e('0x6'));var config=require(_0x031e('0x7'));var attributes=require(_0x031e('0x8'));module['exports']=function(_0xd9a625,_0x3cf001){return _0xd9a625[_0x031e('0x9')](_0x031e('0xa'),attributes,{'tableName':_0x031e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 8fa6adc..ac73ca1 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 _0xe472=['request\x20sent','debug','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0xe472,0x16f));var _0x2e47=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe472[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x2e47('0x0'));var moment=require(_0x2e47('0x1'));var BPromise=require(_0x2e47('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e47('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2e47('0x4'))(_0x2e47('0x5'));var config=require('../../config/environment');var jayson=require(_0x2e47('0x6'));var client=jayson[_0x2e47('0x7')][_0x2e47('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59d6de,_0x11be72,_0xd3dc68){return new BPromise(function(_0x4adc3e,_0xcffce1){return client[_0x2e47('0x9')](_0x59d6de,_0xd3dc68)[_0x2e47('0xa')](function(_0x184afc){logger[_0x2e47('0xb')](_0x2e47('0xc'),_0x11be72,_0x2e47('0xd'));logger[_0x2e47('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x11be72,_0x2e47('0xd'),JSON[_0x2e47('0xf')](_0x184afc));if(_0x184afc['error']){if(_0x184afc[_0x2e47('0x10')][_0x2e47('0x11')]===0x1f4){logger[_0x2e47('0x10')](_0x2e47('0xc'),_0x11be72,_0x184afc['error'][_0x2e47('0x12')]);return _0xcffce1(_0x184afc[_0x2e47('0x10')][_0x2e47('0x12')]);}logger['error'](_0x2e47('0xc'),_0x11be72,_0x184afc[_0x2e47('0x10')]['message']);return _0x4adc3e(_0x184afc[_0x2e47('0x10')]['message']);}else{logger[_0x2e47('0xb')](_0x2e47('0xc'),_0x11be72,_0x2e47('0xd'));_0x4adc3e(_0x184afc['result'][_0x2e47('0x12')]);}})[_0x2e47('0x13')](function(_0x47c560){logger[_0x2e47('0x10')](_0x2e47('0xc'),_0x11be72,_0x47c560);_0xcffce1(_0x47c560);});});} \ No newline at end of file +var _0x6478=['code','SugarcrmConfiguration,\x20%s,\x20%s','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x43412e,_0x1766a4){var _0x408fb9=function(_0x2de947){while(--_0x2de947){_0x43412e['push'](_0x43412e['shift']());}};_0x408fb9(++_0x1766a4);}(_0x6478,0x1bb));var _0x8647=function(_0xd2c332,_0x1b5f38){_0xd2c332=_0xd2c332-0x0;var _0x4efc6f=_0x6478[_0xd2c332];return _0x4efc6f;};'use strict';var _=require('lodash');var util=require(_0x8647('0x0'));var moment=require(_0x8647('0x1'));var BPromise=require('bluebird');var rs=require(_0x8647('0x2'));var fs=require('fs');var Redis=require(_0x8647('0x3'));var db=require(_0x8647('0x4'))['db'];var utils=require(_0x8647('0x5'));var logger=require(_0x8647('0x6'))(_0x8647('0x7'));var config=require(_0x8647('0x8'));var jayson=require(_0x8647('0x9'));var client=jayson['client'][_0x8647('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fcfb8,_0x317a79,_0x727c83){return new BPromise(function(_0x58ee04,_0x24af24){return client[_0x8647('0xb')](_0x4fcfb8,_0x727c83)[_0x8647('0xc')](function(_0x167ecd){logger[_0x8647('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x317a79,_0x8647('0xe'));logger[_0x8647('0xf')](_0x8647('0x10'),_0x317a79,_0x8647('0xe'),JSON['stringify'](_0x167ecd));if(_0x167ecd['error']){if(_0x167ecd['error'][_0x8647('0x11')]===0x1f4){logger['error'](_0x8647('0x12'),_0x317a79,_0x167ecd[_0x8647('0x13')]['message']);return _0x24af24(_0x167ecd[_0x8647('0x13')][_0x8647('0x14')]);}logger[_0x8647('0x13')](_0x8647('0x12'),_0x317a79,_0x167ecd[_0x8647('0x13')][_0x8647('0x14')]);return _0x58ee04(_0x167ecd[_0x8647('0x13')][_0x8647('0x14')]);}else{logger[_0x8647('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x317a79,_0x8647('0xe'));_0x58ee04(_0x167ecd[_0x8647('0x15')][_0x8647('0x14')]);}})[_0x8647('0x16')](function(_0x11c860){logger['error'](_0x8647('0x12'),_0x317a79,_0x11c860);_0x24af24(_0x11c860);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index ba06771..2fc5c87 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 _0x4455=['update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x47ef96,_0xdf2884){var _0x42558c=function(_0x1baa8f){while(--_0x1baa8f){_0x47ef96['push'](_0x47ef96['shift']());}};_0x42558c(++_0xdf2884);}(_0x4455,0x67));var _0x5445=function(_0x1426da,_0x1757fd){_0x1426da=_0x1426da-0x0;var _0x8a7f6c=_0x4455[_0x1426da];return _0x8a7f6c;};'use strict';var multer=require(_0x5445('0x0'));var util=require('util');var path=require(_0x5445('0x1'));var timeout=require(_0x5445('0x2'));var express=require(_0x5445('0x3'));var router=express['Router']();var fs_extra=require(_0x5445('0x4'));var auth=require(_0x5445('0x5'));var interaction=require(_0x5445('0x6'));var config=require(_0x5445('0x7'));var controller=require(_0x5445('0x8'));router[_0x5445('0x9')]('/',auth[_0x5445('0xa')](),controller[_0x5445('0xb')]);router['get']('/:id',auth[_0x5445('0xa')](),controller[_0x5445('0xc')]);router[_0x5445('0xd')]('/',auth[_0x5445('0xa')](),controller[_0x5445('0xe')]);router[_0x5445('0xf')](_0x5445('0x10'),auth[_0x5445('0xa')](),controller[_0x5445('0x11')]);router[_0x5445('0x12')](_0x5445('0x10'),auth[_0x5445('0xa')](),controller[_0x5445('0x13')]);module['exports']=router; \ No newline at end of file +var _0x68bd=['post','put','update','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id'];(function(_0x13ced3,_0x529a2a){var _0x43897f=function(_0x135f1c){while(--_0x135f1c){_0x13ced3['push'](_0x13ced3['shift']());}};_0x43897f(++_0x529a2a);}(_0x68bd,0x114));var _0xd68b=function(_0x3ff4a3,_0xa5bfa6){_0x3ff4a3=_0x3ff4a3-0x0;var _0x38676f=_0x68bd[_0x3ff4a3];return _0x38676f;};'use strict';var multer=require('multer');var util=require(_0xd68b('0x0'));var path=require(_0xd68b('0x1'));var timeout=require(_0xd68b('0x2'));var express=require('express');var router=express[_0xd68b('0x3')]();var fs_extra=require(_0xd68b('0x4'));var auth=require(_0xd68b('0x5'));var interaction=require(_0xd68b('0x6'));var config=require(_0xd68b('0x7'));var controller=require(_0xd68b('0x8'));router[_0xd68b('0x9')]('/',auth[_0xd68b('0xa')](),controller[_0xd68b('0xb')]);router[_0xd68b('0x9')](_0xd68b('0xc'),auth[_0xd68b('0xa')](),controller['show']);router[_0xd68b('0xd')]('/',auth[_0xd68b('0xa')](),controller['create']);router[_0xd68b('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xd68b('0xf')]);router['delete'](_0xd68b('0xc'),auth[_0xd68b('0xa')](),controller[_0xd68b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 9eb1149..dfecfc6 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 _0x10db=['STRING','BOOLEAN','exports','string','variable','keyValue','picklist','ENUM'];(function(_0x5e31b8,_0x23e122){var _0x145a9d=function(_0x54cadc){while(--_0x54cadc){_0x5e31b8['push'](_0x5e31b8['shift']());}};_0x145a9d(++_0x23e122);}(_0x10db,0xd2));var _0xb10d=function(_0x1f0270,_0x1c8e36){_0x1f0270=_0x1f0270-0x0;var _0x30c4ca=_0x10db[_0x1f0270];return _0x30c4ca;};'use strict';var Sequelize=require('sequelize');module[_0xb10d('0x0')]={'type':{'type':Sequelize['ENUM'](_0xb10d('0x1'),_0xb10d('0x2'),'customVariable',_0xb10d('0x3'),_0xb10d('0x4')),'defaultValue':_0xb10d('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb10d('0x5')](_0xb10d('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xb10d('0x6')]},'idField':{'type':Sequelize[_0xb10d('0x6')]},'nameField':{'type':Sequelize[_0xb10d('0x6')]},'customField':{'type':Sequelize[_0xb10d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb10d('0x6')]}}; \ No newline at end of file +var _0x2497=['picklist','STRING','customVariable','BOOLEAN','sequelize','ENUM','string','variable','keyValue'];(function(_0xac1398,_0x175014){var _0x48813c=function(_0x3b50f9){while(--_0x3b50f9){_0xac1398['push'](_0xac1398['shift']());}};_0x48813c(++_0x175014);}(_0x2497,0x94));var _0x7249=function(_0x3a90e4,_0x1bc3c4){_0x3a90e4=_0x3a90e4-0x0;var _0x1f3ec6=_0x2497[_0x3a90e4];return _0x1f3ec6;};'use strict';var Sequelize=require(_0x7249('0x0'));module['exports']={'type':{'type':Sequelize[_0x7249('0x1')](_0x7249('0x2'),_0x7249('0x3'),'customVariable',_0x7249('0x4'),_0x7249('0x5')),'defaultValue':_0x7249('0x2')},'content':{'type':Sequelize[_0x7249('0x6')]},'key':{'type':Sequelize[_0x7249('0x6')]},'keyType':{'type':Sequelize[_0x7249('0x1')](_0x7249('0x2'),_0x7249('0x3'),_0x7249('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7249('0x6')]},'nameField':{'type':Sequelize[_0x7249('0x6')]},'customField':{'type':Sequelize[_0x7249('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 5fe2fca..cd60a24 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 _0x9894=['request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','includeAll','include','findAll','catch','show','length','merge','options','create','body','params','destroy','find','eml-format','zip-dir'];(function(_0x1d36e9,_0x486977){var _0x824c53=function(_0x3dfce2){while(--_0x3dfce2){_0x1d36e9['push'](_0x1d36e9['shift']());}};_0x824c53(++_0x486977);}(_0x9894,0x17f));var _0x4989=function(_0x1a5478,_0x389cf3){_0x1a5478=_0x1a5478-0x0;var _0x24ee33=_0x9894[_0x1a5478];return _0x24ee33;};'use strict';var emlformat=require(_0x4989('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4989('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4989('0x2'));var moment=require(_0x4989('0x3'));var BPromise=require(_0x4989('0x4'));var Mustache=require('mustache');var util=require(_0x4989('0x5'));var path=require('path');var sox=require(_0x4989('0x6'));var csv=require(_0x4989('0x7'));var ejs=require(_0x4989('0x8'));var fs=require('fs');var fs_extra=require(_0x4989('0x9'));var _=require(_0x4989('0xa'));var squel=require(_0x4989('0xb'));var crypto=require(_0x4989('0xc'));var jsforce=require(_0x4989('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4989('0x7'));var querystring=require(_0x4989('0xe'));var Papa=require(_0x4989('0xf'));var Redis=require(_0x4989('0x10'));var authService=require(_0x4989('0x11'));var qs=require(_0x4989('0x12'));var as=require(_0x4989('0x13'));var hardwareService=require(_0x4989('0x14'));var logger=require(_0x4989('0x15'))(_0x4989('0x16'));var utils=require(_0x4989('0x17'));var config=require(_0x4989('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4989('0x19'))['db'];function respondWithStatusCode(_0x32a888,_0x566508){_0x566508=_0x566508||0xcc;return function(_0xdb025c){if(_0xdb025c){return _0x32a888[_0x4989('0x1a')](_0x566508);}return _0x32a888[_0x4989('0x1b')](_0x566508)[_0x4989('0x1c')]();};}function respondWithResult(_0x267f14,_0x31583f){_0x31583f=_0x31583f||0xc8;return function(_0x24e3e4){if(_0x24e3e4){return _0x267f14[_0x4989('0x1b')](_0x31583f)['json'](_0x24e3e4);}};}function respondWithFilteredResult(_0x1dd3f1,_0x20f4ed){return function(_0x22d25a){if(_0x22d25a){var _0x26c9f4=typeof _0x20f4ed['offset']===_0x4989('0x1d')&&typeof _0x20f4ed[_0x4989('0x1e')]===_0x4989('0x1d');var _0x10fd3a=_0x22d25a[_0x4989('0x1f')];var _0x3f1dd5=_0x26c9f4?0x0:_0x20f4ed[_0x4989('0x20')];var _0x24a77d=_0x26c9f4?_0x22d25a[_0x4989('0x1f')]:_0x20f4ed[_0x4989('0x20')]+_0x20f4ed[_0x4989('0x1e')];var _0x48da3b;if(_0x24a77d>=_0x10fd3a){_0x24a77d=_0x10fd3a;_0x48da3b=0xc8;}else{_0x48da3b=0xce;}_0x1dd3f1[_0x4989('0x1b')](_0x48da3b);return _0x1dd3f1[_0x4989('0x21')](_0x4989('0x22'),_0x3f1dd5+'-'+_0x24a77d+'/'+_0x10fd3a)['json'](_0x22d25a);}return null;};}function patchUpdates(_0x23200e){return function(_0x2668c0){try{jsonpatch[_0x4989('0x23')](_0x2668c0,_0x23200e,!![]);}catch(_0x3b2ac1){return BPromise[_0x4989('0x24')](_0x3b2ac1);}return _0x2668c0[_0x4989('0x25')]();};}function saveUpdates(_0x5dafa0,_0x2f46cb){return function(_0x1c0c8d){if(_0x1c0c8d){return _0x1c0c8d[_0x4989('0x26')](_0x5dafa0)['then'](function(_0x48f8b1){return _0x48f8b1;});}return null;};}function removeEntity(_0x576d9b,_0x46eab2){return function(_0x11dafd){if(_0x11dafd){return _0x11dafd['destroy']()[_0x4989('0x27')](function(){_0x576d9b['status'](0xcc)[_0x4989('0x1c')]();});}};}function handleEntityNotFound(_0xaff8f4,_0x4d5431){return function(_0x3b7d1b){if(!_0x3b7d1b){_0xaff8f4[_0x4989('0x1a')](0x194);}return _0x3b7d1b;};}function handleError(_0xf4a0e1,_0x42a98b){_0x42a98b=_0x42a98b||0x1f4;return function(_0x4d72a1){logger[_0x4989('0x28')](_0x4d72a1['stack']);if(_0x4d72a1[_0x4989('0x29')]){delete _0x4d72a1[_0x4989('0x29')];}_0xf4a0e1[_0x4989('0x1b')](_0x42a98b)[_0x4989('0x2a')](_0x4d72a1);};}exports[_0x4989('0x2b')]=function(_0x3de59d,_0x2481d3){var _0xf18c4b={},_0x282684={},_0x4d4ca3={'count':0x0,'rows':[]};var _0x12186d=_[_0x4989('0x2c')](db[_0x4989('0x2d')][_0x4989('0x2e')],function(_0x5aa2e8){return{'name':_0x5aa2e8[_0x4989('0x2f')],'type':_0x5aa2e8[_0x4989('0x30')][_0x4989('0x31')]};});_0x282684['model']=_['map'](_0x12186d,_0x4989('0x29'));_0x282684[_0x4989('0x32')]=_[_0x4989('0x33')](_0x3de59d[_0x4989('0x32')]);_0x282684[_0x4989('0x34')]=_['intersection'](_0x282684[_0x4989('0x35')],_0x282684[_0x4989('0x32')]);_0xf18c4b[_0x4989('0x36')]=_[_0x4989('0x37')](_0x282684[_0x4989('0x35')],qs[_0x4989('0x38')](_0x3de59d['query'][_0x4989('0x38')]));_0xf18c4b[_0x4989('0x36')]=_0xf18c4b[_0x4989('0x36')]['length']?_0xf18c4b[_0x4989('0x36')]:_0x282684[_0x4989('0x35')];if(!_0x3de59d['query'][_0x4989('0x39')](_0x4989('0x3a'))){_0xf18c4b[_0x4989('0x1e')]=qs['limit'](_0x3de59d[_0x4989('0x32')][_0x4989('0x1e')]);_0xf18c4b[_0x4989('0x20')]=qs['offset'](_0x3de59d[_0x4989('0x32')]['offset']);}_0xf18c4b[_0x4989('0x3b')]=qs[_0x4989('0x3c')](_0x3de59d[_0x4989('0x32')][_0x4989('0x3c')]);_0xf18c4b[_0x4989('0x3d')]=qs[_0x4989('0x34')](_[_0x4989('0x3e')](_0x3de59d['query'],_0x282684['filters']),_0x12186d);if(_0x3de59d[_0x4989('0x32')]['filter']){_0xf18c4b['where']=_['merge'](_0xf18c4b[_0x4989('0x3d')],{'$or':_[_0x4989('0x2c')](_0x12186d,function(_0x155bd1){if(_0x155bd1[_0x4989('0x30')]!==_0x4989('0x3f')){var _0x26db06={};_0x26db06[_0x155bd1[_0x4989('0x29')]]={'$like':'%'+_0x3de59d[_0x4989('0x32')]['filter']+'%'};return _0x26db06;}})});}_0xf18c4b=_['merge']({},_0xf18c4b,_0x3de59d['options']);var _0x529ac2={'where':_0xf18c4b['where']};return db[_0x4989('0x2d')][_0x4989('0x1f')](_0x529ac2)[_0x4989('0x27')](function(_0x4c2401){_0x4d4ca3[_0x4989('0x1f')]=_0x4c2401;if(_0x3de59d[_0x4989('0x32')][_0x4989('0x40')]){_0xf18c4b[_0x4989('0x41')]=[{'all':!![]}];}return db[_0x4989('0x2d')][_0x4989('0x42')](_0xf18c4b);})[_0x4989('0x27')](function(_0x440444){_0x4d4ca3['rows']=_0x440444;return _0x4d4ca3;})['then'](respondWithFilteredResult(_0x2481d3,_0xf18c4b))[_0x4989('0x43')](handleError(_0x2481d3,null));};exports[_0x4989('0x44')]=function(_0x1115b8,_0x9b06c5){var _0x3af364={'raw':!![],'where':{'id':_0x1115b8['params']['id']}},_0xdc7a40={};_0xdc7a40['model']=_['keys'](db[_0x4989('0x2d')][_0x4989('0x2e')]);_0xdc7a40['query']=_['keys'](_0x1115b8[_0x4989('0x32')]);_0xdc7a40[_0x4989('0x34')]=_[_0x4989('0x37')](_0xdc7a40[_0x4989('0x35')],_0xdc7a40[_0x4989('0x32')]);_0x3af364['attributes']=_[_0x4989('0x37')](_0xdc7a40[_0x4989('0x35')],qs[_0x4989('0x38')](_0x1115b8[_0x4989('0x32')]['fields']));_0x3af364[_0x4989('0x36')]=_0x3af364[_0x4989('0x36')][_0x4989('0x45')]?_0x3af364[_0x4989('0x36')]:_0xdc7a40['model'];if(_0x1115b8[_0x4989('0x32')][_0x4989('0x40')]){_0x3af364['include']=[{'all':!![]}];}_0x3af364=_[_0x4989('0x46')]({},_0x3af364,_0x1115b8[_0x4989('0x47')]);return db[_0x4989('0x2d')]['find'](_0x3af364)['then'](handleEntityNotFound(_0x9b06c5,null))[_0x4989('0x27')](respondWithResult(_0x9b06c5,null))[_0x4989('0x43')](handleError(_0x9b06c5,null));};exports[_0x4989('0x48')]=function(_0x28ef99,_0x5b36c2){return db[_0x4989('0x2d')][_0x4989('0x48')](_0x28ef99[_0x4989('0x49')],{})['then'](respondWithResult(_0x5b36c2,0xc9))['catch'](handleError(_0x5b36c2,null));};exports[_0x4989('0x26')]=function(_0x4d4be8,_0x39b39a){if(_0x4d4be8[_0x4989('0x49')]['id']){delete _0x4d4be8[_0x4989('0x49')]['id'];}return db[_0x4989('0x2d')]['find']({'where':{'id':_0x4d4be8[_0x4989('0x4a')]['id']}})[_0x4989('0x27')](handleEntityNotFound(_0x39b39a,null))[_0x4989('0x27')](saveUpdates(_0x4d4be8[_0x4989('0x49')],null))['then'](respondWithResult(_0x39b39a,null))[_0x4989('0x43')](handleError(_0x39b39a,null));};exports[_0x4989('0x4b')]=function(_0x4a0eaf,_0x28682a){return db['SugarcrmField'][_0x4989('0x4c')]({'where':{'id':_0x4a0eaf['params']['id']}})[_0x4989('0x27')](handleEntityNotFound(_0x28682a,null))[_0x4989('0x27')](removeEntity(_0x28682a,null))[_0x4989('0x43')](handleError(_0x28682a,null));}; \ No newline at end of file +var _0x78d3=['then','end','error','stack','index','key','map','name','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','SugarcrmField','includeAll','include','findAll','rows','catch','show','params','keys','length','create','update','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save'];(function(_0x179310,_0x3ad9e2){var _0x39ba77=function(_0x5808e4){while(--_0x5808e4){_0x179310['push'](_0x179310['shift']());}};_0x39ba77(++_0x3ad9e2);}(_0x78d3,0x73));var _0x378d=function(_0x4b9624,_0x22ab4){_0x4b9624=_0x4b9624-0x0;var _0x4267cd=_0x78d3[_0x4b9624];return _0x4267cd;};'use strict';var emlformat=require(_0x378d('0x0'));var rimraf=require(_0x378d('0x1'));var zipdir=require(_0x378d('0x2'));var jsonpatch=require(_0x378d('0x3'));var rp=require(_0x378d('0x4'));var moment=require(_0x378d('0x5'));var BPromise=require(_0x378d('0x6'));var Mustache=require(_0x378d('0x7'));var util=require(_0x378d('0x8'));var path=require(_0x378d('0x9'));var sox=require(_0x378d('0xa'));var csv=require(_0x378d('0xb'));var ejs=require(_0x378d('0xc'));var fs=require('fs');var fs_extra=require(_0x378d('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x378d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x378d('0xf'));var toCsv=require(_0x378d('0xb'));var querystring=require(_0x378d('0x10'));var Papa=require(_0x378d('0x11'));var Redis=require(_0x378d('0x12'));var authService=require(_0x378d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x378d('0x14'));var hardwareService=require(_0x378d('0x15'));var logger=require(_0x378d('0x16'))('api');var utils=require(_0x378d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x378d('0x18'))['db'];function respondWithStatusCode(_0x184383,_0x5a1c1f){_0x5a1c1f=_0x5a1c1f||0xcc;return function(_0x43785f){if(_0x43785f){return _0x184383[_0x378d('0x19')](_0x5a1c1f);}return _0x184383[_0x378d('0x1a')](_0x5a1c1f)['end']();};}function respondWithResult(_0x4609b7,_0x5bf43f){_0x5bf43f=_0x5bf43f||0xc8;return function(_0x756450){if(_0x756450){return _0x4609b7[_0x378d('0x1a')](_0x5bf43f)[_0x378d('0x1b')](_0x756450);}};}function respondWithFilteredResult(_0x40c4fb,_0x209292){return function(_0x5f48db){if(_0x5f48db){var _0x46856f=typeof _0x209292['offset']===_0x378d('0x1c')&&typeof _0x209292[_0x378d('0x1d')]===_0x378d('0x1c');var _0x254ff5=_0x5f48db[_0x378d('0x1e')];var _0x50ce98=_0x46856f?0x0:_0x209292[_0x378d('0x1f')];var _0x4b54c7=_0x46856f?_0x5f48db[_0x378d('0x1e')]:_0x209292[_0x378d('0x1f')]+_0x209292[_0x378d('0x1d')];var _0x1d2852;if(_0x4b54c7>=_0x254ff5){_0x4b54c7=_0x254ff5;_0x1d2852=0xc8;}else{_0x1d2852=0xce;}_0x40c4fb[_0x378d('0x1a')](_0x1d2852);return _0x40c4fb[_0x378d('0x20')](_0x378d('0x21'),_0x50ce98+'-'+_0x4b54c7+'/'+_0x254ff5)['json'](_0x5f48db);}return null;};}function patchUpdates(_0x5a936c){return function(_0x238f30){try{jsonpatch[_0x378d('0x22')](_0x238f30,_0x5a936c,!![]);}catch(_0x48b7f9){return BPromise[_0x378d('0x23')](_0x48b7f9);}return _0x238f30[_0x378d('0x24')]();};}function saveUpdates(_0x2d6c8f,_0x1339fb){return function(_0x3acdf9){if(_0x3acdf9){return _0x3acdf9['update'](_0x2d6c8f)[_0x378d('0x25')](function(_0x4f43a6){return _0x4f43a6;});}return null;};}function removeEntity(_0x17bbf2,_0x402913){return function(_0x3f2ebc){if(_0x3f2ebc){return _0x3f2ebc['destroy']()[_0x378d('0x25')](function(){_0x17bbf2[_0x378d('0x1a')](0xcc)[_0x378d('0x26')]();});}};}function handleEntityNotFound(_0x5e515d,_0x20e5e6){return function(_0x22fee7){if(!_0x22fee7){_0x5e515d[_0x378d('0x19')](0x194);}return _0x22fee7;};}function handleError(_0x1c302a,_0xb65852){_0xb65852=_0xb65852||0x1f4;return function(_0x2ed3ed){logger[_0x378d('0x27')](_0x2ed3ed[_0x378d('0x28')]);if(_0x2ed3ed['name']){delete _0x2ed3ed['name'];}_0x1c302a[_0x378d('0x1a')](_0xb65852)['send'](_0x2ed3ed);};}exports[_0x378d('0x29')]=function(_0x292b73,_0x3f2d5b){var _0x17f952={},_0x53637f={},_0x59945b={'count':0x0,'rows':[]};var _0x3de1af=_['map'](db['SugarcrmField']['rawAttributes'],function(_0x3e1dac){return{'name':_0x3e1dac['fieldName'],'type':_0x3e1dac['type'][_0x378d('0x2a')]};});_0x53637f['model']=_[_0x378d('0x2b')](_0x3de1af,_0x378d('0x2c'));_0x53637f[_0x378d('0x2d')]=_['keys'](_0x292b73[_0x378d('0x2d')]);_0x53637f[_0x378d('0x2e')]=_[_0x378d('0x2f')](_0x53637f[_0x378d('0x30')],_0x53637f[_0x378d('0x2d')]);_0x17f952['attributes']=_[_0x378d('0x2f')](_0x53637f[_0x378d('0x30')],qs[_0x378d('0x31')](_0x292b73[_0x378d('0x2d')]['fields']));_0x17f952[_0x378d('0x32')]=_0x17f952['attributes']['length']?_0x17f952[_0x378d('0x32')]:_0x53637f[_0x378d('0x30')];if(!_0x292b73['query'][_0x378d('0x33')]('nolimit')){_0x17f952['limit']=qs['limit'](_0x292b73[_0x378d('0x2d')][_0x378d('0x1d')]);_0x17f952[_0x378d('0x1f')]=qs[_0x378d('0x1f')](_0x292b73[_0x378d('0x2d')]['offset']);}_0x17f952[_0x378d('0x34')]=qs[_0x378d('0x35')](_0x292b73[_0x378d('0x2d')]['sort']);_0x17f952[_0x378d('0x36')]=qs[_0x378d('0x2e')](_[_0x378d('0x37')](_0x292b73['query'],_0x53637f[_0x378d('0x2e')]),_0x3de1af);if(_0x292b73['query'][_0x378d('0x38')]){_0x17f952['where']=_['merge'](_0x17f952[_0x378d('0x36')],{'$or':_[_0x378d('0x2b')](_0x3de1af,function(_0x43a0d7){if(_0x43a0d7[_0x378d('0x39')]!==_0x378d('0x3a')){var _0x7f668c={};_0x7f668c[_0x43a0d7['name']]={'$like':'%'+_0x292b73['query'][_0x378d('0x38')]+'%'};return _0x7f668c;}})});}_0x17f952=_[_0x378d('0x3b')]({},_0x17f952,_0x292b73[_0x378d('0x3c')]);var _0x1b039d={'where':_0x17f952[_0x378d('0x36')]};return db[_0x378d('0x3d')][_0x378d('0x1e')](_0x1b039d)[_0x378d('0x25')](function(_0x32c4f6){_0x59945b[_0x378d('0x1e')]=_0x32c4f6;if(_0x292b73[_0x378d('0x2d')][_0x378d('0x3e')]){_0x17f952[_0x378d('0x3f')]=[{'all':!![]}];}return db['SugarcrmField'][_0x378d('0x40')](_0x17f952);})['then'](function(_0x5e1b33){_0x59945b[_0x378d('0x41')]=_0x5e1b33;return _0x59945b;})['then'](respondWithFilteredResult(_0x3f2d5b,_0x17f952))[_0x378d('0x42')](handleError(_0x3f2d5b,null));};exports[_0x378d('0x43')]=function(_0x514c6d,_0x480835){var _0x5c3e1e={'raw':!![],'where':{'id':_0x514c6d[_0x378d('0x44')]['id']}},_0x2d2ee2={};_0x2d2ee2[_0x378d('0x30')]=_['keys'](db[_0x378d('0x3d')]['rawAttributes']);_0x2d2ee2[_0x378d('0x2d')]=_[_0x378d('0x45')](_0x514c6d[_0x378d('0x2d')]);_0x2d2ee2[_0x378d('0x2e')]=_['intersection'](_0x2d2ee2[_0x378d('0x30')],_0x2d2ee2['query']);_0x5c3e1e[_0x378d('0x32')]=_[_0x378d('0x2f')](_0x2d2ee2[_0x378d('0x30')],qs[_0x378d('0x31')](_0x514c6d[_0x378d('0x2d')][_0x378d('0x31')]));_0x5c3e1e['attributes']=_0x5c3e1e['attributes'][_0x378d('0x46')]?_0x5c3e1e[_0x378d('0x32')]:_0x2d2ee2[_0x378d('0x30')];if(_0x514c6d['query']['includeAll']){_0x5c3e1e[_0x378d('0x3f')]=[{'all':!![]}];}_0x5c3e1e=_['merge']({},_0x5c3e1e,_0x514c6d['options']);return db['SugarcrmField']['find'](_0x5c3e1e)[_0x378d('0x25')](handleEntityNotFound(_0x480835,null))[_0x378d('0x25')](respondWithResult(_0x480835,null))[_0x378d('0x42')](handleError(_0x480835,null));};exports[_0x378d('0x47')]=function(_0x404176,_0x5c5733){return db[_0x378d('0x3d')][_0x378d('0x47')](_0x404176['body'],{})['then'](respondWithResult(_0x5c5733,0xc9))[_0x378d('0x42')](handleError(_0x5c5733,null));};exports[_0x378d('0x48')]=function(_0x50a8a0,_0x3e6275){if(_0x50a8a0[_0x378d('0x49')]['id']){delete _0x50a8a0[_0x378d('0x49')]['id'];}return db[_0x378d('0x3d')][_0x378d('0x4a')]({'where':{'id':_0x50a8a0[_0x378d('0x44')]['id']}})[_0x378d('0x25')](handleEntityNotFound(_0x3e6275,null))['then'](saveUpdates(_0x50a8a0[_0x378d('0x49')],null))[_0x378d('0x25')](respondWithResult(_0x3e6275,null))[_0x378d('0x42')](handleError(_0x3e6275,null));};exports[_0x378d('0x4b')]=function(_0x509bf1,_0x2e4cd0){return db[_0x378d('0x3d')]['find']({'where':{'id':_0x509bf1[_0x378d('0x44')]['id']}})[_0x378d('0x25')](handleEntityNotFound(_0x2e4cd0,null))['then'](removeEntity(_0x2e4cd0,null))[_0x378d('0x42')](handleError(_0x2e4cd0,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index beabcc1..5a5d06d 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 _0xda97=['lodash','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId'];(function(_0x275bf6,_0x360e6a){var _0x4f9b04=function(_0x3fdb66){while(--_0x3fdb66){_0x275bf6['push'](_0x275bf6['shift']());}};_0x4f9b04(++_0x360e6a);}(_0xda97,0x179));var _0x7da9=function(_0x4dbe69,_0x2d9c43){_0x4dbe69=_0x4dbe69-0x0;var _0x2c13df=_0xda97[_0x4dbe69];return _0x2c13df;};'use strict';var _=require(_0x7da9('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7da9('0x1'));var rp=require(_0x7da9('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7da9('0x3'));var config=require(_0x7da9('0x4'));var attributes=require(_0x7da9('0x5'));module[_0x7da9('0x6')]=function(_0xe98948,_0x69f668){return _0xe98948[_0x7da9('0x7')](_0x7da9('0x8'),attributes,{'tableName':_0x7da9('0x9'),'paranoid':![],'indexes':[{'name':_0x7da9('0xa'),'fields':[_0x7da9('0xb'),_0x7da9('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3070=['../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','idField','FieldId','lodash','request-promise','rimraf'];(function(_0x43362b,_0x445f25){var _0x507e20=function(_0x434412){while(--_0x434412){_0x43362b['push'](_0x43362b['shift']());}};_0x507e20(++_0x445f25);}(_0x3070,0xc3));var _0x0307=function(_0x52b13d,_0x5b9a89){_0x52b13d=_0x52b13d-0x0;var _0x3463cb=_0x3070[_0x52b13d];return _0x3463cb;};'use strict';var _=require(_0x0307('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0307('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0307('0x2'));var config=require(_0x0307('0x3'));var attributes=require(_0x0307('0x4'));module[_0x0307('0x5')]=function(_0x25cde3,_0xafbaae){return _0x25cde3[_0x0307('0x6')](_0x0307('0x7'),attributes,{'tableName':_0x0307('0x8'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x0307('0x9'),_0x0307('0xa')],'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 51c7b15..abecf9e 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 _0x05a6=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x05a6,0x1e3));var _0x605a=function(_0x5a6961,_0xd41ca6){_0x5a6961=_0x5a6961-0x0;var _0x4af0a6=_0x05a6[_0x5a6961];return _0x4af0a6;};'use strict';var _=require(_0x605a('0x0'));var util=require('util');var moment=require(_0x605a('0x1'));var BPromise=require(_0x605a('0x2'));var rs=require(_0x605a('0x3'));var fs=require('fs');var Redis=require(_0x605a('0x4'));var db=require(_0x605a('0x5'))['db'];var utils=require(_0x605a('0x6'));var logger=require('../../config/logger')(_0x605a('0x7'));var config=require(_0x605a('0x8'));var jayson=require(_0x605a('0x9'));var client=jayson[_0x605a('0xa')][_0x605a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c8e29,_0x3f6f1d,_0x455a98){return new BPromise(function(_0x3cfb85,_0x4d721a){return client['request'](_0x3c8e29,_0x455a98)[_0x605a('0xc')](function(_0x489fe5){logger[_0x605a('0xd')](_0x605a('0xe'),_0x3f6f1d,_0x605a('0xf'));logger[_0x605a('0x10')](_0x605a('0x11'),_0x3f6f1d,'request\x20sent',JSON['stringify'](_0x489fe5));if(_0x489fe5[_0x605a('0x12')]){if(_0x489fe5['error'][_0x605a('0x13')]===0x1f4){logger['error'](_0x605a('0xe'),_0x3f6f1d,_0x489fe5[_0x605a('0x12')][_0x605a('0x14')]);return _0x4d721a(_0x489fe5['error'][_0x605a('0x14')]);}logger[_0x605a('0x12')](_0x605a('0xe'),_0x3f6f1d,_0x489fe5['error'][_0x605a('0x14')]);return _0x3cfb85(_0x489fe5[_0x605a('0x12')][_0x605a('0x14')]);}else{logger[_0x605a('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x3f6f1d,_0x605a('0xf'));_0x3cfb85(_0x489fe5[_0x605a('0x15')][_0x605a('0x14')]);}})[_0x605a('0x16')](function(_0x4dbf78){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x3f6f1d,_0x4dbf78);_0x4d721a(_0x4dbf78);});});} \ No newline at end of file +var _0x4de3=['../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x4de3,0x17c));var _0x34de=function(_0x192988,_0x2f854e){_0x192988=_0x192988-0x0;var _0x22c691=_0x4de3[_0x192988];return _0x22c691;};'use strict';var _=require(_0x34de('0x0'));var util=require(_0x34de('0x1'));var moment=require(_0x34de('0x2'));var BPromise=require(_0x34de('0x3'));var rs=require(_0x34de('0x4'));var fs=require('fs');var Redis=require(_0x34de('0x5'));var db=require(_0x34de('0x6'))['db'];var utils=require(_0x34de('0x7'));var logger=require(_0x34de('0x8'))(_0x34de('0x9'));var config=require(_0x34de('0xa'));var jayson=require(_0x34de('0xb'));var client=jayson[_0x34de('0xc')][_0x34de('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x428bf5,_0x5d1601,_0x387f02){return new BPromise(function(_0x299730,_0x15c38a){return client[_0x34de('0xe')](_0x428bf5,_0x387f02)[_0x34de('0xf')](function(_0x10ea82){logger[_0x34de('0x10')](_0x34de('0x11'),_0x5d1601,_0x34de('0x12'));logger[_0x34de('0x13')](_0x34de('0x14'),_0x5d1601,_0x34de('0x12'),JSON['stringify'](_0x10ea82));if(_0x10ea82['error']){if(_0x10ea82[_0x34de('0x15')][_0x34de('0x16')]===0x1f4){logger[_0x34de('0x15')](_0x34de('0x11'),_0x5d1601,_0x10ea82[_0x34de('0x15')][_0x34de('0x17')]);return _0x15c38a(_0x10ea82[_0x34de('0x15')][_0x34de('0x17')]);}logger[_0x34de('0x15')]('SugarcrmField,\x20%s,\x20%s',_0x5d1601,_0x10ea82[_0x34de('0x15')][_0x34de('0x17')]);return _0x299730(_0x10ea82['error']['message']);}else{logger[_0x34de('0x10')](_0x34de('0x11'),_0x5d1601,_0x34de('0x12'));_0x299730(_0x10ea82[_0x34de('0x18')][_0x34de('0x17')]);}})[_0x34de('0x19')](function(_0x4046bb){logger['error'](_0x34de('0x11'),_0x5d1601,_0x4046bb);_0x15c38a(_0x4046bb);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index b528d63..526d5b1 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 _0x48fb=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x262ff6,_0x158799){var _0x4c9b82=function(_0x2d854d){while(--_0x2d854d){_0x262ff6['push'](_0x262ff6['shift']());}};_0x4c9b82(++_0x158799);}(_0x48fb,0x114));var _0xb48f=function(_0x4a2f27,_0x5e29cc){_0x4a2f27=_0x4a2f27-0x0;var _0x51a04b=_0x48fb[_0x4a2f27];return _0x51a04b;};'use strict';var multer=require(_0xb48f('0x0'));var util=require(_0xb48f('0x1'));var path=require(_0xb48f('0x2'));var timeout=require(_0xb48f('0x3'));var express=require(_0xb48f('0x4'));var router=express[_0xb48f('0x5')]();var fs_extra=require(_0xb48f('0x6'));var auth=require(_0xb48f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb48f('0x8'));var controller=require('./intVtigerAccount.controller');router[_0xb48f('0x9')]('/',auth[_0xb48f('0xa')](),controller[_0xb48f('0xb')]);router[_0xb48f('0x9')](_0xb48f('0xc'),auth[_0xb48f('0xa')](),controller[_0xb48f('0xd')]);router[_0xb48f('0x9')](_0xb48f('0xe'),auth[_0xb48f('0xa')](),controller[_0xb48f('0xf')]);router[_0xb48f('0x9')](_0xb48f('0x10'),auth['isAuthenticated'](),controller[_0xb48f('0x11')]);router['post']('/',auth[_0xb48f('0xa')](),controller[_0xb48f('0x12')]);router[_0xb48f('0x13')](_0xb48f('0xe'),auth[_0xb48f('0xa')](),controller['addConfiguration']);router[_0xb48f('0x14')](_0xb48f('0xc'),auth[_0xb48f('0xa')](),controller[_0xb48f('0x15')]);router[_0xb48f('0x16')](_0xb48f('0xc'),auth[_0xb48f('0xa')](),controller[_0xb48f('0x17')]);module['exports']=router; \ No newline at end of file +var _0xd7ed=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util'];(function(_0xbc25e1,_0x27007d){var _0xaf0a85=function(_0x52acb3){while(--_0x52acb3){_0xbc25e1['push'](_0xbc25e1['shift']());}};_0xaf0a85(++_0x27007d);}(_0xd7ed,0x1a8));var _0xdd7e=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0xd7ed[_0x36ed3c];return _0x52a2e0;};'use strict';var multer=require('multer');var util=require(_0xdd7e('0x0'));var path=require(_0xdd7e('0x1'));var timeout=require(_0xdd7e('0x2'));var express=require(_0xdd7e('0x3'));var router=express[_0xdd7e('0x4')]();var fs_extra=require(_0xdd7e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdd7e('0x6'));var config=require(_0xdd7e('0x7'));var controller=require(_0xdd7e('0x8'));router[_0xdd7e('0x9')]('/',auth[_0xdd7e('0xa')](),controller[_0xdd7e('0xb')]);router['get'](_0xdd7e('0xc'),auth['isAuthenticated'](),controller[_0xdd7e('0xd')]);router[_0xdd7e('0x9')](_0xdd7e('0xe'),auth[_0xdd7e('0xa')](),controller[_0xdd7e('0xf')]);router['get']('/:id/fields',auth[_0xdd7e('0xa')](),controller[_0xdd7e('0x10')]);router[_0xdd7e('0x11')]('/',auth['isAuthenticated'](),controller[_0xdd7e('0x12')]);router[_0xdd7e('0x11')](_0xdd7e('0xe'),auth[_0xdd7e('0xa')](),controller[_0xdd7e('0x13')]);router[_0xdd7e('0x14')]('/:id',auth[_0xdd7e('0xa')](),controller[_0xdd7e('0x15')]);router[_0xdd7e('0x16')](_0xdd7e('0xc'),auth[_0xdd7e('0xa')](),controller[_0xdd7e('0x17')]);module[_0xdd7e('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index bcce12a..6df32af 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 _0x9f46=['STRING','HelpDesk','sequelize','exports'];(function(_0x4a426a,_0x33fd3b){var _0x2e0d53=function(_0x7b317c){while(--_0x7b317c){_0x4a426a['push'](_0x4a426a['shift']());}};_0x2e0d53(++_0x33fd3b);}(_0x9f46,0x86));var _0x69f4=function(_0x14e0fb,_0x1d7589){_0x14e0fb=_0x14e0fb-0x0;var _0x5cf7f3=_0x9f46[_0x14e0fb];return _0x5cf7f3;};'use strict';var Sequelize=require(_0x69f4('0x0'));module[_0x69f4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x69f4('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x69f4('0x2')],'allowNull':![],'defaultValue':_0x69f4('0x3')},'remoteUri':{'type':Sequelize[_0x69f4('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x69f4('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x0e9b=['sequelize','STRING','HelpDesk'];(function(_0x137049,_0x278a36){var _0xebbeeb=function(_0x43c517){while(--_0x43c517){_0x137049['push'](_0x137049['shift']());}};_0xebbeeb(++_0x278a36);}(_0x0e9b,0x15c));var _0xb0e9=function(_0x278c37,_0x50bbee){_0x278c37=_0x278c37-0x0;var _0x2c284d=_0x0e9b[_0x278c37];return _0x2c284d;};'use strict';var Sequelize=require(_0xb0e9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb0e9('0x1')]},'username':{'type':Sequelize[_0xb0e9('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xb0e9('0x1')],'allowNull':![],'defaultValue':_0xb0e9('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xb0e9('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xb0e9('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 100e619..5d2ea24 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 _0x89e6=['nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','VtigerConfiguration','VtigerField','Descriptions','md5','getFields','username','description','moduleName','accessKey','remoteUri','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','login','result','token','success','describe','autogenerated','reference','owner','remove','includes','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','where','merge','VIRTUAL','filter','options','VtigerAccount','includeAll','findAll','catch','show','params','include','find','create','body','findOne','order'];(function(_0x1fff1b,_0x5cf82f){var _0x252f17=function(_0x2c532a){while(--_0x2c532a){_0x1fff1b['push'](_0x1fff1b['shift']());}};_0x252f17(++_0x5cf82f);}(_0x89e6,0x11a));var _0x689e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x89e6[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x689e('0x0'));var zipdir=require(_0x689e('0x1'));var jsonpatch=require(_0x689e('0x2'));var rp=require(_0x689e('0x3'));var moment=require(_0x689e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x689e('0x5'));var util=require(_0x689e('0x6'));var path=require('path');var sox=require(_0x689e('0x7'));var csv=require(_0x689e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x689e('0x9'));var squel=require('squel');var crypto=require(_0x689e('0xa'));var jsforce=require(_0x689e('0xb'));var deskjs=require(_0x689e('0xc'));var toCsv=require(_0x689e('0x8'));var querystring=require('querystring');var Papa=require(_0x689e('0xd'));var Redis=require('ioredis');var authService=require(_0x689e('0xe'));var qs=require(_0x689e('0xf'));var as=require(_0x689e('0x10'));var hardwareService=require(_0x689e('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x689e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x689e('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x689e('0x14'));function respondWithStatusCode(_0x5f2a68,_0x633919){_0x633919=_0x633919||0xcc;return function(_0x33cfa3){if(_0x33cfa3){return _0x5f2a68[_0x689e('0x15')](_0x633919);}return _0x5f2a68[_0x689e('0x16')](_0x633919)['end']();};}function respondWithResult(_0x1ab593,_0x52b388){_0x52b388=_0x52b388||0xc8;return function(_0x491d37){if(_0x491d37){return _0x1ab593[_0x689e('0x16')](_0x52b388)[_0x689e('0x17')](_0x491d37);}};}function respondWithFilteredResult(_0x54738c,_0x31b98a){return function(_0x41fd3d){if(_0x41fd3d){var _0x505a65=typeof _0x31b98a['offset']===_0x689e('0x18')&&typeof _0x31b98a[_0x689e('0x19')]==='undefined';var _0x7629a6=_0x41fd3d[_0x689e('0x1a')];var _0x469bf1=_0x505a65?0x0:_0x31b98a[_0x689e('0x1b')];var _0xf0f3bf=_0x505a65?_0x41fd3d[_0x689e('0x1a')]:_0x31b98a[_0x689e('0x1b')]+_0x31b98a[_0x689e('0x19')];var _0xe1645c;if(_0xf0f3bf>=_0x7629a6){_0xf0f3bf=_0x7629a6;_0xe1645c=0xc8;}else{_0xe1645c=0xce;}_0x54738c[_0x689e('0x16')](_0xe1645c);return _0x54738c['set'](_0x689e('0x1c'),_0x469bf1+'-'+_0xf0f3bf+'/'+_0x7629a6)['json'](_0x41fd3d);}return null;};}function patchUpdates(_0x47888c){return function(_0x2fd0ee){try{jsonpatch[_0x689e('0x1d')](_0x2fd0ee,_0x47888c,!![]);}catch(_0x4f963b){return BPromise['reject'](_0x4f963b);}return _0x2fd0ee[_0x689e('0x1e')]();};}function saveUpdates(_0x5ea339,_0x308ddf){return function(_0x471e4c){if(_0x471e4c){return _0x471e4c[_0x689e('0x1f')](_0x5ea339)[_0x689e('0x20')](function(_0x3944aa){return _0x3944aa;});}return null;};}function removeEntity(_0x1e4b02,_0x4ff655){return function(_0xfca9d1){if(_0xfca9d1){return _0xfca9d1[_0x689e('0x21')]()[_0x689e('0x20')](function(){_0x1e4b02[_0x689e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c82fa,_0x2434c3){return function(_0x4ff7c4){if(!_0x4ff7c4){_0x3c82fa[_0x689e('0x15')](0x194);}return _0x4ff7c4;};}function handleError(_0x512e4a,_0x4073ff){_0x4073ff=_0x4073ff||0x1f4;return function(_0x2dfae7){logger[_0x689e('0x22')](_0x2dfae7[_0x689e('0x23')]);if(_0x2dfae7[_0x689e('0x24')]){delete _0x2dfae7[_0x689e('0x24')];}_0x512e4a[_0x689e('0x16')](_0x4073ff)[_0x689e('0x25')](_0x2dfae7);};}exports[_0x689e('0x26')]=function(_0x3fb14c,_0x5eae8d){var _0x1a064a={},_0x981f1e={},_0x182d56={'count':0x0,'rows':[]};var _0x8e6870=_['map'](db['VtigerAccount'][_0x689e('0x27')],function(_0x532f13){return{'name':_0x532f13[_0x689e('0x28')],'type':_0x532f13[_0x689e('0x29')][_0x689e('0x2a')]};});_0x981f1e[_0x689e('0x2b')]=_[_0x689e('0x2c')](_0x8e6870,'name');_0x981f1e[_0x689e('0x2d')]=_[_0x689e('0x2e')](_0x3fb14c[_0x689e('0x2d')]);_0x981f1e['filters']=_[_0x689e('0x2f')](_0x981f1e['model'],_0x981f1e['query']);_0x1a064a[_0x689e('0x30')]=_[_0x689e('0x2f')](_0x981f1e[_0x689e('0x2b')],qs[_0x689e('0x31')](_0x3fb14c[_0x689e('0x2d')]['fields']));_0x1a064a[_0x689e('0x30')]=_0x1a064a['attributes'][_0x689e('0x32')]?_0x1a064a[_0x689e('0x30')]:_0x981f1e[_0x689e('0x2b')];if(!_0x3fb14c[_0x689e('0x2d')][_0x689e('0x33')]('nolimit')){_0x1a064a[_0x689e('0x19')]=qs[_0x689e('0x19')](_0x3fb14c[_0x689e('0x2d')][_0x689e('0x19')]);_0x1a064a['offset']=qs[_0x689e('0x1b')](_0x3fb14c[_0x689e('0x2d')][_0x689e('0x1b')]);}_0x1a064a['order']=qs['sort'](_0x3fb14c[_0x689e('0x2d')][_0x689e('0x34')]);_0x1a064a['where']=qs[_0x689e('0x35')](_[_0x689e('0x36')](_0x3fb14c['query'],_0x981f1e[_0x689e('0x35')]),_0x8e6870);if(_0x3fb14c['query']['filter']){_0x1a064a[_0x689e('0x37')]=_[_0x689e('0x38')](_0x1a064a[_0x689e('0x37')],{'$or':_['map'](_0x8e6870,function(_0x2467c1){if(_0x2467c1[_0x689e('0x29')]!==_0x689e('0x39')){var _0x5666a7={};_0x5666a7[_0x2467c1['name']]={'$like':'%'+_0x3fb14c[_0x689e('0x2d')][_0x689e('0x3a')]+'%'};return _0x5666a7;}})});}_0x1a064a=_['merge']({},_0x1a064a,_0x3fb14c[_0x689e('0x3b')]);var _0x55bea0={'where':_0x1a064a[_0x689e('0x37')]};return db[_0x689e('0x3c')]['count'](_0x55bea0)[_0x689e('0x20')](function(_0xb5d251){_0x182d56[_0x689e('0x1a')]=_0xb5d251;if(_0x3fb14c[_0x689e('0x2d')][_0x689e('0x3d')]){_0x1a064a['include']=[{'all':!![]}];}return db[_0x689e('0x3c')][_0x689e('0x3e')](_0x1a064a);})[_0x689e('0x20')](function(_0x1ecebf){_0x182d56['rows']=_0x1ecebf;return _0x182d56;})[_0x689e('0x20')](respondWithFilteredResult(_0x5eae8d,_0x1a064a))[_0x689e('0x3f')](handleError(_0x5eae8d,null));};exports[_0x689e('0x40')]=function(_0x374e4d,_0x4acafc){var _0x3822e1={'raw':![],'where':{'id':_0x374e4d[_0x689e('0x41')]['id']}},_0x5401ae={};_0x5401ae['model']=_[_0x689e('0x2e')](db[_0x689e('0x3c')][_0x689e('0x27')]);_0x5401ae[_0x689e('0x2d')]=_[_0x689e('0x2e')](_0x374e4d[_0x689e('0x2d')]);_0x5401ae[_0x689e('0x35')]=_[_0x689e('0x2f')](_0x5401ae['model'],_0x5401ae[_0x689e('0x2d')]);_0x3822e1['attributes']=_[_0x689e('0x2f')](_0x5401ae['model'],qs[_0x689e('0x31')](_0x374e4d[_0x689e('0x2d')][_0x689e('0x31')]));_0x3822e1[_0x689e('0x30')]=_0x3822e1['attributes'][_0x689e('0x32')]?_0x3822e1['attributes']:_0x5401ae[_0x689e('0x2b')];if(_0x374e4d['query']['includeAll']){_0x3822e1[_0x689e('0x42')]=[{'all':!![]}];}_0x3822e1=_[_0x689e('0x38')]({},_0x3822e1,_0x374e4d[_0x689e('0x3b')]);return db[_0x689e('0x3c')][_0x689e('0x43')](_0x3822e1)[_0x689e('0x20')](handleEntityNotFound(_0x4acafc,null))['then'](respondWithResult(_0x4acafc,null))[_0x689e('0x3f')](handleError(_0x4acafc,null));};exports[_0x689e('0x44')]=function(_0x5b9982,_0x51b8ba){return db[_0x689e('0x3c')][_0x689e('0x44')](_0x5b9982['body'],{})['then'](respondWithResult(_0x51b8ba,0xc9))['catch'](handleError(_0x51b8ba,null));};exports[_0x689e('0x1f')]=function(_0xcc37f9,_0x2b1dd6){if(_0xcc37f9[_0x689e('0x45')]['id']){delete _0xcc37f9[_0x689e('0x45')]['id'];}return db[_0x689e('0x3c')][_0x689e('0x43')]({'where':{'id':_0xcc37f9['params']['id']}})[_0x689e('0x20')](handleEntityNotFound(_0x2b1dd6,null))[_0x689e('0x20')](saveUpdates(_0xcc37f9['body'],null))['then'](respondWithResult(_0x2b1dd6,null))[_0x689e('0x3f')](handleError(_0x2b1dd6,null));};exports[_0x689e('0x21')]=function(_0x393d29,_0xfdc855){return db[_0x689e('0x3c')][_0x689e('0x43')]({'where':{'id':_0x393d29[_0x689e('0x41')]['id']}})[_0x689e('0x20')](handleEntityNotFound(_0xfdc855,null))[_0x689e('0x20')](removeEntity(_0xfdc855,null))[_0x689e('0x3f')](handleError(_0xfdc855,null));};exports['getConfigurations']=function(_0x436427,_0xdbab10,_0x27762d){var _0x421262={};var _0x397a4b={};var _0x29f7b;var _0x4a9e35;return db[_0x689e('0x3c')][_0x689e('0x46')]({'where':{'id':_0x436427[_0x689e('0x41')]['id']}})[_0x689e('0x20')](handleEntityNotFound(_0xdbab10,null))[_0x689e('0x20')](function(_0x56e943){if(_0x56e943){_0x29f7b=_0x56e943;_0x397a4b[_0x689e('0x2b')]=_[_0x689e('0x2e')](db['VtigerConfiguration']['rawAttributes']);_0x397a4b[_0x689e('0x2d')]=_[_0x689e('0x2e')](_0x436427[_0x689e('0x2d')]);_0x397a4b['filters']=_['intersection'](_0x397a4b[_0x689e('0x2b')],_0x397a4b[_0x689e('0x2d')]);_0x421262[_0x689e('0x30')]=_[_0x689e('0x2f')](_0x397a4b[_0x689e('0x2b')],qs[_0x689e('0x31')](_0x436427['query']['fields']));_0x421262[_0x689e('0x30')]=_0x421262[_0x689e('0x30')][_0x689e('0x32')]?_0x421262[_0x689e('0x30')]:_0x397a4b[_0x689e('0x2b')];_0x421262[_0x689e('0x47')]=qs[_0x689e('0x34')](_0x436427['query'][_0x689e('0x34')]);_0x421262['where']=qs[_0x689e('0x35')](_[_0x689e('0x36')](_0x436427['query'],_0x397a4b['filters']));if(_0x436427[_0x689e('0x2d')][_0x689e('0x3a')]){_0x421262['where']=_['merge'](_0x421262[_0x689e('0x37')],{'$or':_[_0x689e('0x2c')](_0x421262[_0x689e('0x30')],function(_0xc2e670){var _0x50ab30={};_0x50ab30[_0xc2e670]={'$like':'%'+_0x436427[_0x689e('0x2d')][_0x689e('0x3a')]+'%'};return _0x50ab30;})});}_0x421262=_['merge']({},_0x421262,_0x436427[_0x689e('0x3b')]);return _0x29f7b['getConfigurations'](_0x421262);}})[_0x689e('0x20')](function(_0x5b321f){if(_0x5b321f){_0x4a9e35=_0x5b321f[_0x689e('0x32')];if(!_0x436427[_0x689e('0x2d')][_0x689e('0x33')](_0x689e('0x48'))){_0x421262[_0x689e('0x19')]=qs['limit'](_0x436427['query'][_0x689e('0x19')]);_0x421262['offset']=qs[_0x689e('0x1b')](_0x436427[_0x689e('0x2d')][_0x689e('0x1b')]);}return _0x29f7b['getConfigurations'](_0x421262);}})[_0x689e('0x20')](function(_0x422968){if(_0x422968){return _0x422968?{'count':_0x4a9e35,'rows':_0x422968}:null;}})[_0x689e('0x20')](respondWithResult(_0xdbab10,null))['catch'](handleError(_0xdbab10,null));};exports[_0x689e('0x49')]=function(_0x38b258,_0x543ecb,_0x4f2dcc){if(_0x38b258[_0x689e('0x45')]['id']){delete _0x38b258[_0x689e('0x45')]['id'];}return db[_0x689e('0x3c')]['findOne']({'where':{'id':_0x38b258[_0x689e('0x41')]['id']}})[_0x689e('0x20')](handleEntityNotFound(_0x543ecb,null))[_0x689e('0x20')](function(_0x381a60){if(_0x381a60){_0x38b258[_0x689e('0x45')][_0x689e('0x4a')]=_0x381a60['id'];_0x38b258[_0x689e('0x45')][_0x689e('0x4b')]=integrations[_0x689e('0x4c')](_0x38b258[_0x689e('0x45')][_0x689e('0x4d')],_0x38b258['body']['type']);_0x38b258[_0x689e('0x45')]['Descriptions']=integrations['getDescriptions'](_0x38b258[_0x689e('0x45')][_0x689e('0x4d')],_0x38b258[_0x689e('0x45')][_0x689e('0x29')]);return db[_0x689e('0x4e')][_0x689e('0x44')](_0x38b258['body'],{'include':[{'model':db[_0x689e('0x4f')],'as':'Subjects'},{'model':db[_0x689e('0x4f')],'as':_0x689e('0x50')}]});}return null;})[_0x689e('0x20')](respondWithResult(_0x543ecb,null))['catch'](handleError(_0x543ecb,null));};var md5=require(_0x689e('0x51'));exports[_0x689e('0x52')]=function(_0x501648,_0x32b55d,_0x4ce827){var _0xaed223=null;var _0x123b17=null;var _0x18aa17=null;var _0x1292b0=null;var _0x3d3a3c='';return db[_0x689e('0x3c')][_0x689e('0x46')]({'where':{'id':_0x501648['params']['id']},'attributes':['id',_0x689e('0x24'),_0x689e('0x53'),_0x689e('0x54'),_0x689e('0x55'),'remoteUri','serverUrl',_0x689e('0x56')]})['then'](handleEntityNotFound(_0x32b55d,null))[_0x689e('0x20')](function(_0xce8f9e){if(_0xce8f9e){_0xaed223=_0xce8f9e[_0x689e('0x53')];_0x123b17=_0xce8f9e['accessKey'];_0x18aa17=_0xce8f9e[_0x689e('0x55')];_0x3d3a3c=_0xce8f9e[_0x689e('0x57')];var _0x2c5ad1=_0x3d3a3c[_0x689e('0x58')](-0x1);if(_0x2c5ad1==='/'){_0x3d3a3c=_0x3d3a3c['substring'](0x0,_0x3d3a3c[_0x689e('0x59')](_0x2c5ad1));}_0x1292b0=util[_0x689e('0x5a')](_0x689e('0x5b'),_0x3d3a3c);var _0x17e0a5={'method':_0x689e('0x5c'),'uri':_0x1292b0,'qs':{'operation':_0x689e('0x5d'),'username':_0xce8f9e[_0x689e('0x53')]},'json':!![]};return rp(_0x17e0a5);}})[_0x689e('0x20')](function(_0xe78b69){if(_0xe78b69['success']){var _0x122b9c={'method':_0x689e('0x5e'),'uri':_0x1292b0,'form':{'operation':_0x689e('0x5f'),'username':_0xaed223,'accessKey':md5(_0xe78b69[_0x689e('0x60')][_0x689e('0x61')]+_0x123b17)},'json':!![]};return rp(_0x122b9c);}})[_0x689e('0x20')](function(_0x178668){if(_0x178668[_0x689e('0x62')]){var _0x20192d={'method':_0x689e('0x5c'),'uri':_0x1292b0,'qs':{'operation':_0x689e('0x63'),'username':_0xaed223,'sessionName':_0x178668['result']['sessionName'],'elementType':_0x18aa17},'json':!![]};return rp(_0x20192d);}})[_0x689e('0x20')](function(_0x64fd58){if(_0x64fd58[_0x689e('0x62')]){var _0x1d76a7=[_0x689e('0x64'),_0x689e('0x65'),_0x689e('0x66')];_[_0x689e('0x67')](_0x64fd58[_0x689e('0x60')]['fields'],function(_0x179e15){return _0x1d76a7[_0x689e('0x68')](_0x179e15[_0x689e('0x29')][_0x689e('0x24')]);});_['remove'](_0x64fd58[_0x689e('0x60')][_0x689e('0x31')],function(_0x226311){return _0x226311['editable']===_0x689e('0x69');});return{'count':_0x64fd58[_0x689e('0x60')]['fields'][_0x689e('0x32')],'rows':_[_0x689e('0x2c')](_0x64fd58[_0x689e('0x60')][_0x689e('0x31')],function(_0x5b77e){return{'id':_0x5b77e[_0x689e('0x24')],'name':_0x5b77e[_0x689e('0x6a')],'custom':_[_0x689e('0x6b')](_0x5b77e[_0x689e('0x24')],_0x689e('0x6c'))?!![]:![],'options':_0x5b77e[_0x689e('0x29')]['name']===_0x689e('0x6d')&&_0x5b77e[_0x689e('0x29')][_0x689e('0x6e')]['length']>0x0?_[_0x689e('0x2c')](_0x5b77e[_0x689e('0x29')][_0x689e('0x6e')],function(_0x21dcac){return{'name':_0x21dcac[_0x689e('0x6a')],'value':_0x21dcac[_0x689e('0x6f')]};}):[]};})};}})[_0x689e('0x20')](respondWithResult(_0x32b55d,null))[_0x689e('0x3f')](function(_0x3f3124){console[_0x689e('0x70')](_0x689e('0x71')+_0x3f3124);var _0x59e1cf=_0x501648['query'][_0x689e('0x72')]?0x1f4:_0x3f3124[_0x689e('0x73')]||0x1f4;logger[_0x689e('0x22')](_0x689e('0x74'),'getFields',_0x59e1cf,JSON[_0x689e('0x75')](_0x3f3124));delete _0x3f3124[_0x689e('0x24')];if(_0x59e1cf===0x191){_0x59e1cf=0x190;}_0x32b55d[_0x689e('0x16')](_0x59e1cf)[_0x689e('0x25')](_0x501648[_0x689e('0x2d')][_0x689e('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x3f3124[_0x689e('0x73')]}:_0x3f3124);});}; \ No newline at end of file +var _0x488b=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','VtigerAccount','include','find','create','body','destroy','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','getFields','findOne','username','remoteUri','serverUrl','moduleName','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','token','describe','sessionName','autogenerated','owner','remove','result','editable','false','startsWith','cf_','picklist','picklistValues','label','value','log','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','util','path','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','limit','count','offset','Content-Range','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x488b,0x1aa));var _0xb488=function(_0xb636c,_0x16b2fc){_0xb636c=_0xb636c-0x0;var _0x196f12=_0x488b[_0xb636c];return _0x196f12;};'use strict';var emlformat=require(_0xb488('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb488('0x1'));var rp=require(_0xb488('0x2'));var moment=require(_0xb488('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb488('0x4'));var path=require(_0xb488('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb488('0x6'));var _=require(_0xb488('0x7'));var squel=require(_0xb488('0x8'));var crypto=require(_0xb488('0x9'));var jsforce=require(_0xb488('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xb488('0xb'));var querystring=require(_0xb488('0xc'));var Papa=require(_0xb488('0xd'));var Redis=require(_0xb488('0xe'));var authService=require(_0xb488('0xf'));var qs=require(_0xb488('0x10'));var as=require(_0xb488('0x11'));var hardwareService=require(_0xb488('0x12'));var logger=require('../../config/logger')(_0xb488('0x13'));var utils=require(_0xb488('0x14'));var config=require(_0xb488('0x15'));var licenseUtil=require(_0xb488('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb488('0x17'));function respondWithStatusCode(_0x2f8179,_0x1cbd14){_0x1cbd14=_0x1cbd14||0xcc;return function(_0x3cf57b){if(_0x3cf57b){return _0x2f8179[_0xb488('0x18')](_0x1cbd14);}return _0x2f8179[_0xb488('0x19')](_0x1cbd14)[_0xb488('0x1a')]();};}function respondWithResult(_0x14a5f3,_0x1885c2){_0x1885c2=_0x1885c2||0xc8;return function(_0x528621){if(_0x528621){return _0x14a5f3[_0xb488('0x19')](_0x1885c2)[_0xb488('0x1b')](_0x528621);}};}function respondWithFilteredResult(_0x5ab66a,_0x5f5862){return function(_0x1f8e94){if(_0x1f8e94){var _0xe6d655=typeof _0x5f5862['offset']==='undefined'&&typeof _0x5f5862[_0xb488('0x1c')]==='undefined';var _0x36d4ee=_0x1f8e94[_0xb488('0x1d')];var _0x5a11e4=_0xe6d655?0x0:_0x5f5862['offset'];var _0x386ca1=_0xe6d655?_0x1f8e94[_0xb488('0x1d')]:_0x5f5862[_0xb488('0x1e')]+_0x5f5862[_0xb488('0x1c')];var _0x2d4df3;if(_0x386ca1>=_0x36d4ee){_0x386ca1=_0x36d4ee;_0x2d4df3=0xc8;}else{_0x2d4df3=0xce;}_0x5ab66a[_0xb488('0x19')](_0x2d4df3);return _0x5ab66a['set'](_0xb488('0x1f'),_0x5a11e4+'-'+_0x386ca1+'/'+_0x36d4ee)['json'](_0x1f8e94);}return null;};}function patchUpdates(_0x1ac906){return function(_0x479185){try{jsonpatch['apply'](_0x479185,_0x1ac906,!![]);}catch(_0x1047fe){return BPromise[_0xb488('0x20')](_0x1047fe);}return _0x479185[_0xb488('0x21')]();};}function saveUpdates(_0x1d68c2,_0x1cc67b){return function(_0x5db501){if(_0x5db501){return _0x5db501[_0xb488('0x22')](_0x1d68c2)[_0xb488('0x23')](function(_0xcb4a4b){return _0xcb4a4b;});}return null;};}function removeEntity(_0x4eb792,_0x25db44){return function(_0x31474c){if(_0x31474c){return _0x31474c['destroy']()[_0xb488('0x23')](function(){_0x4eb792['status'](0xcc)[_0xb488('0x1a')]();});}};}function handleEntityNotFound(_0x51663d,_0x2f6bdb){return function(_0x457cfc){if(!_0x457cfc){_0x51663d['sendStatus'](0x194);}return _0x457cfc;};}function handleError(_0x23330b,_0x12de60){_0x12de60=_0x12de60||0x1f4;return function(_0x3128df){logger[_0xb488('0x24')](_0x3128df[_0xb488('0x25')]);if(_0x3128df[_0xb488('0x26')]){delete _0x3128df[_0xb488('0x26')];}_0x23330b['status'](_0x12de60)[_0xb488('0x27')](_0x3128df);};}exports[_0xb488('0x28')]=function(_0x56bbff,_0x3d1f43){var _0x4c4949={},_0x4905e3={},_0x41262b={'count':0x0,'rows':[]};var _0x488076=_[_0xb488('0x29')](db['VtigerAccount'][_0xb488('0x2a')],function(_0x569d25){return{'name':_0x569d25['fieldName'],'type':_0x569d25[_0xb488('0x2b')][_0xb488('0x2c')]};});_0x4905e3[_0xb488('0x2d')]=_[_0xb488('0x29')](_0x488076,_0xb488('0x26'));_0x4905e3[_0xb488('0x2e')]=_[_0xb488('0x2f')](_0x56bbff[_0xb488('0x2e')]);_0x4905e3[_0xb488('0x30')]=_[_0xb488('0x31')](_0x4905e3[_0xb488('0x2d')],_0x4905e3[_0xb488('0x2e')]);_0x4c4949['attributes']=_[_0xb488('0x31')](_0x4905e3[_0xb488('0x2d')],qs['fields'](_0x56bbff[_0xb488('0x2e')][_0xb488('0x32')]));_0x4c4949[_0xb488('0x33')]=_0x4c4949[_0xb488('0x33')][_0xb488('0x34')]?_0x4c4949['attributes']:_0x4905e3[_0xb488('0x2d')];if(!_0x56bbff[_0xb488('0x2e')][_0xb488('0x35')](_0xb488('0x36'))){_0x4c4949['limit']=qs[_0xb488('0x1c')](_0x56bbff[_0xb488('0x2e')][_0xb488('0x1c')]);_0x4c4949[_0xb488('0x1e')]=qs[_0xb488('0x1e')](_0x56bbff[_0xb488('0x2e')][_0xb488('0x1e')]);}_0x4c4949[_0xb488('0x37')]=qs[_0xb488('0x38')](_0x56bbff[_0xb488('0x2e')][_0xb488('0x38')]);_0x4c4949[_0xb488('0x39')]=qs[_0xb488('0x30')](_[_0xb488('0x3a')](_0x56bbff['query'],_0x4905e3[_0xb488('0x30')]),_0x488076);if(_0x56bbff[_0xb488('0x2e')][_0xb488('0x3b')]){_0x4c4949[_0xb488('0x39')]=_[_0xb488('0x3c')](_0x4c4949[_0xb488('0x39')],{'$or':_[_0xb488('0x29')](_0x488076,function(_0x13cda5){if(_0x13cda5[_0xb488('0x2b')]!=='VIRTUAL'){var _0x572c88={};_0x572c88[_0x13cda5[_0xb488('0x26')]]={'$like':'%'+_0x56bbff['query'][_0xb488('0x3b')]+'%'};return _0x572c88;}})});}_0x4c4949=_[_0xb488('0x3c')]({},_0x4c4949,_0x56bbff[_0xb488('0x3d')]);var _0x10839d={'where':_0x4c4949[_0xb488('0x39')]};return db['VtigerAccount']['count'](_0x10839d)[_0xb488('0x23')](function(_0xb3119a){_0x41262b[_0xb488('0x1d')]=_0xb3119a;if(_0x56bbff['query'][_0xb488('0x3e')]){_0x4c4949['include']=[{'all':!![]}];}return db['VtigerAccount'][_0xb488('0x3f')](_0x4c4949);})[_0xb488('0x23')](function(_0x46e8c8){_0x41262b[_0xb488('0x40')]=_0x46e8c8;return _0x41262b;})[_0xb488('0x23')](respondWithFilteredResult(_0x3d1f43,_0x4c4949))[_0xb488('0x41')](handleError(_0x3d1f43,null));};exports[_0xb488('0x42')]=function(_0x328008,_0x58705b){var _0x5a831b={'raw':![],'where':{'id':_0x328008[_0xb488('0x43')]['id']}},_0x542e47={};_0x542e47[_0xb488('0x2d')]=_['keys'](db[_0xb488('0x44')]['rawAttributes']);_0x542e47[_0xb488('0x2e')]=_[_0xb488('0x2f')](_0x328008[_0xb488('0x2e')]);_0x542e47[_0xb488('0x30')]=_[_0xb488('0x31')](_0x542e47[_0xb488('0x2d')],_0x542e47[_0xb488('0x2e')]);_0x5a831b[_0xb488('0x33')]=_[_0xb488('0x31')](_0x542e47[_0xb488('0x2d')],qs[_0xb488('0x32')](_0x328008[_0xb488('0x2e')][_0xb488('0x32')]));_0x5a831b[_0xb488('0x33')]=_0x5a831b[_0xb488('0x33')][_0xb488('0x34')]?_0x5a831b[_0xb488('0x33')]:_0x542e47[_0xb488('0x2d')];if(_0x328008[_0xb488('0x2e')][_0xb488('0x3e')]){_0x5a831b[_0xb488('0x45')]=[{'all':!![]}];}_0x5a831b=_[_0xb488('0x3c')]({},_0x5a831b,_0x328008['options']);return db[_0xb488('0x44')][_0xb488('0x46')](_0x5a831b)[_0xb488('0x23')](handleEntityNotFound(_0x58705b,null))[_0xb488('0x23')](respondWithResult(_0x58705b,null))[_0xb488('0x41')](handleError(_0x58705b,null));};exports[_0xb488('0x47')]=function(_0x4ae47f,_0x1f584e){return db[_0xb488('0x44')][_0xb488('0x47')](_0x4ae47f['body'],{})[_0xb488('0x23')](respondWithResult(_0x1f584e,0xc9))[_0xb488('0x41')](handleError(_0x1f584e,null));};exports[_0xb488('0x22')]=function(_0x35a7cc,_0x1aeaf5){if(_0x35a7cc['body']['id']){delete _0x35a7cc[_0xb488('0x48')]['id'];}return db[_0xb488('0x44')][_0xb488('0x46')]({'where':{'id':_0x35a7cc[_0xb488('0x43')]['id']}})['then'](handleEntityNotFound(_0x1aeaf5,null))['then'](saveUpdates(_0x35a7cc[_0xb488('0x48')],null))[_0xb488('0x23')](respondWithResult(_0x1aeaf5,null))['catch'](handleError(_0x1aeaf5,null));};exports[_0xb488('0x49')]=function(_0x213481,_0x10e0bc){return db[_0xb488('0x44')]['find']({'where':{'id':_0x213481[_0xb488('0x43')]['id']}})['then'](handleEntityNotFound(_0x10e0bc,null))[_0xb488('0x23')](removeEntity(_0x10e0bc,null))[_0xb488('0x41')](handleError(_0x10e0bc,null));};exports[_0xb488('0x4a')]=function(_0x224887,_0x470720,_0x3aa185){var _0x43ce43={};var _0x488941={};var _0x1e2306;var _0x2211d1;return db[_0xb488('0x44')]['findOne']({'where':{'id':_0x224887[_0xb488('0x43')]['id']}})[_0xb488('0x23')](handleEntityNotFound(_0x470720,null))[_0xb488('0x23')](function(_0x5e210a){if(_0x5e210a){_0x1e2306=_0x5e210a;_0x488941[_0xb488('0x2d')]=_[_0xb488('0x2f')](db['VtigerConfiguration'][_0xb488('0x2a')]);_0x488941[_0xb488('0x2e')]=_[_0xb488('0x2f')](_0x224887[_0xb488('0x2e')]);_0x488941[_0xb488('0x30')]=_[_0xb488('0x31')](_0x488941[_0xb488('0x2d')],_0x488941[_0xb488('0x2e')]);_0x43ce43[_0xb488('0x33')]=_[_0xb488('0x31')](_0x488941[_0xb488('0x2d')],qs[_0xb488('0x32')](_0x224887[_0xb488('0x2e')][_0xb488('0x32')]));_0x43ce43[_0xb488('0x33')]=_0x43ce43[_0xb488('0x33')][_0xb488('0x34')]?_0x43ce43[_0xb488('0x33')]:_0x488941[_0xb488('0x2d')];_0x43ce43[_0xb488('0x37')]=qs[_0xb488('0x38')](_0x224887[_0xb488('0x2e')][_0xb488('0x38')]);_0x43ce43[_0xb488('0x39')]=qs['filters'](_[_0xb488('0x3a')](_0x224887['query'],_0x488941[_0xb488('0x30')]));if(_0x224887[_0xb488('0x2e')]['filter']){_0x43ce43[_0xb488('0x39')]=_[_0xb488('0x3c')](_0x43ce43[_0xb488('0x39')],{'$or':_[_0xb488('0x29')](_0x43ce43[_0xb488('0x33')],function(_0x185bf7){var _0x55f774={};_0x55f774[_0x185bf7]={'$like':'%'+_0x224887[_0xb488('0x2e')]['filter']+'%'};return _0x55f774;})});}_0x43ce43=_['merge']({},_0x43ce43,_0x224887[_0xb488('0x3d')]);return _0x1e2306[_0xb488('0x4a')](_0x43ce43);}})[_0xb488('0x23')](function(_0x4828e4){if(_0x4828e4){_0x2211d1=_0x4828e4[_0xb488('0x34')];if(!_0x224887['query'][_0xb488('0x35')](_0xb488('0x36'))){_0x43ce43[_0xb488('0x1c')]=qs[_0xb488('0x1c')](_0x224887[_0xb488('0x2e')]['limit']);_0x43ce43[_0xb488('0x1e')]=qs[_0xb488('0x1e')](_0x224887['query'][_0xb488('0x1e')]);}return _0x1e2306[_0xb488('0x4a')](_0x43ce43);}})[_0xb488('0x23')](function(_0x16fb1c){if(_0x16fb1c){return _0x16fb1c?{'count':_0x2211d1,'rows':_0x16fb1c}:null;}})[_0xb488('0x23')](respondWithResult(_0x470720,null))['catch'](handleError(_0x470720,null));};exports[_0xb488('0x4b')]=function(_0x31904c,_0x2a6d56,_0x20a074){if(_0x31904c[_0xb488('0x48')]['id']){delete _0x31904c[_0xb488('0x48')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x31904c[_0xb488('0x43')]['id']}})['then'](handleEntityNotFound(_0x2a6d56,null))['then'](function(_0x26f33f){if(_0x26f33f){_0x31904c[_0xb488('0x48')][_0xb488('0x4c')]=_0x26f33f['id'];_0x31904c[_0xb488('0x48')][_0xb488('0x4d')]=integrations['getSubjects'](_0x31904c[_0xb488('0x48')][_0xb488('0x4e')],_0x31904c[_0xb488('0x48')]['type']);_0x31904c['body'][_0xb488('0x4f')]=integrations[_0xb488('0x50')](_0x31904c[_0xb488('0x48')]['channel'],_0x31904c[_0xb488('0x48')][_0xb488('0x2b')]);return db[_0xb488('0x51')][_0xb488('0x47')](_0x31904c['body'],{'include':[{'model':db['VtigerField'],'as':_0xb488('0x4d')},{'model':db[_0xb488('0x52')],'as':_0xb488('0x4f')}]});}return null;})['then'](respondWithResult(_0x2a6d56,null))['catch'](handleError(_0x2a6d56,null));};var md5=require('md5');exports[_0xb488('0x53')]=function(_0x4c4570,_0x1947ba,_0x36c83a){var _0x40c43a=null;var _0x1f3956=null;var _0x4254fc=null;var _0x7c13f=null;var _0x28ea8b='';return db[_0xb488('0x44')][_0xb488('0x54')]({'where':{'id':_0x4c4570[_0xb488('0x43')]['id']},'attributes':['id',_0xb488('0x26'),_0xb488('0x55'),'description','moduleName',_0xb488('0x56'),_0xb488('0x57'),'accessKey']})['then'](handleEntityNotFound(_0x1947ba,null))[_0xb488('0x23')](function(_0x3195e1){if(_0x3195e1){_0x40c43a=_0x3195e1['username'];_0x1f3956=_0x3195e1['accessKey'];_0x4254fc=_0x3195e1[_0xb488('0x58')];_0x28ea8b=_0x3195e1['remoteUri'];var _0x22d344=_0x28ea8b[_0xb488('0x59')](-0x1);if(_0x22d344==='/'){_0x28ea8b=_0x28ea8b[_0xb488('0x5a')](0x0,_0x28ea8b[_0xb488('0x5b')](_0x22d344));}_0x7c13f=util[_0xb488('0x5c')](_0xb488('0x5d'),_0x28ea8b);var _0x58fb75={'method':_0xb488('0x5e'),'uri':_0x7c13f,'qs':{'operation':_0xb488('0x5f'),'username':_0x3195e1[_0xb488('0x55')]},'json':!![]};return rp(_0x58fb75);}})['then'](function(_0x550de9){if(_0x550de9[_0xb488('0x60')]){var _0x38036a={'method':_0xb488('0x61'),'uri':_0x7c13f,'form':{'operation':'login','username':_0x40c43a,'accessKey':md5(_0x550de9['result'][_0xb488('0x62')]+_0x1f3956)},'json':!![]};return rp(_0x38036a);}})[_0xb488('0x23')](function(_0x19d578){if(_0x19d578[_0xb488('0x60')]){var _0x3d15cf={'method':_0xb488('0x5e'),'uri':_0x7c13f,'qs':{'operation':_0xb488('0x63'),'username':_0x40c43a,'sessionName':_0x19d578['result'][_0xb488('0x64')],'elementType':_0x4254fc},'json':!![]};return rp(_0x3d15cf);}})[_0xb488('0x23')](function(_0xce2bff){if(_0xce2bff[_0xb488('0x60')]){var _0x19705e=[_0xb488('0x65'),'reference',_0xb488('0x66')];_[_0xb488('0x67')](_0xce2bff[_0xb488('0x68')][_0xb488('0x32')],function(_0x2762f8){return _0x19705e['includes'](_0x2762f8[_0xb488('0x2b')]['name']);});_[_0xb488('0x67')](_0xce2bff[_0xb488('0x68')]['fields'],function(_0x3202b6){return _0x3202b6[_0xb488('0x69')]===_0xb488('0x6a');});return{'count':_0xce2bff['result'][_0xb488('0x32')]['length'],'rows':_[_0xb488('0x29')](_0xce2bff[_0xb488('0x68')][_0xb488('0x32')],function(_0x1875f5){return{'id':_0x1875f5[_0xb488('0x26')],'name':_0x1875f5['label'],'custom':_[_0xb488('0x6b')](_0x1875f5[_0xb488('0x26')],_0xb488('0x6c'))?!![]:![],'options':_0x1875f5['type']['name']===_0xb488('0x6d')&&_0x1875f5[_0xb488('0x2b')][_0xb488('0x6e')][_0xb488('0x34')]>0x0?_['map'](_0x1875f5[_0xb488('0x2b')][_0xb488('0x6e')],function(_0x4784d0){return{'name':_0x4784d0[_0xb488('0x6f')],'value':_0x4784d0[_0xb488('0x70')]};}):[]};})};}})['then'](respondWithResult(_0x1947ba,null))[_0xb488('0x41')](function(_0x31629d){console[_0xb488('0x71')]('vTiger\x20error:\x20'+_0x31629d);var _0x50904f=_0x4c4570[_0xb488('0x2e')]['test']?0x1f4:_0x31629d[_0xb488('0x72')]||0x1f4;logger[_0xb488('0x24')](_0xb488('0x73'),_0xb488('0x53'),_0x50904f,JSON[_0xb488('0x74')](_0x31629d));delete _0x31629d[_0xb488('0x26')];if(_0x50904f===0x191){_0x50904f=0x190;}_0x1947ba[_0xb488('0x19')](_0x50904f)[_0xb488('0x27')](_0x4c4570[_0xb488('0x2e')][_0xb488('0x75')]?{'message':_0xb488('0x76'),'statusCode':_0x31629d[_0xb488('0x72')]}:_0x31629d);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 072ac2c..1f57589 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 _0x00f0=['../../config/logger','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount','util'];(function(_0xb15741,_0xb05a9){var _0x275a6f=function(_0x25d8fa){while(--_0x25d8fa){_0xb15741['push'](_0xb15741['shift']());}};_0x275a6f(++_0xb05a9);}(_0x00f0,0x81));var _0x000f=function(_0x45700b,_0x3b7868){_0x45700b=_0x45700b-0x0;var _0x2f9066=_0x00f0[_0x45700b];return _0x2f9066;};'use strict';var _=require('lodash');var util=require(_0x000f('0x0'));var logger=require(_0x000f('0x1'))('api');var moment=require('moment');var BPromise=require(_0x000f('0x2'));var rp=require(_0x000f('0x3'));var fs=require('fs');var path=require(_0x000f('0x4'));var rimraf=require('rimraf');var config=require(_0x000f('0x5'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x000f('0x6'));module[_0x000f('0x7')]=function(_0x4acba0,_0x29779e){return _0x4acba0[_0x000f('0x8')](_0x000f('0x9'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3685=['rimraf','../../config/environment','exports','define','int_vtiger_accounts','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x2ac589,_0x5bb9ec){var _0x2f1b76=function(_0x433c34){while(--_0x433c34){_0x2ac589['push'](_0x2ac589['shift']());}};_0x2f1b76(++_0x5bb9ec);}(_0x3685,0x94));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5368('0x0'));var util=require(_0x5368('0x1'));var logger=require(_0x5368('0x2'))(_0x5368('0x3'));var moment=require('moment');var BPromise=require(_0x5368('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5368('0x5'));var rimraf=require(_0x5368('0x6'));var config=require(_0x5368('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x5368('0x8')]=function(_0x3cd432,_0x306309){return _0x3cd432[_0x5368('0x9')]('VtigerAccount',attributes,{'tableName':_0x5368('0xa'),'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 0e7891f..0b00880 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 _0x757a=['stringify','error','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','ShowVtigerAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s'];(function(_0x37bd2e,_0x3ac90d){var _0x101ad6=function(_0x325316){while(--_0x325316){_0x37bd2e['push'](_0x37bd2e['shift']());}};_0x101ad6(++_0x3ac90d);}(_0x757a,0xde));var _0xa757=function(_0x3dd092,_0x46a7b9){_0x3dd092=_0x3dd092-0x0;var _0x13a395=_0x757a[_0x3dd092];return _0x13a395;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetVtigerAccount',_0x4d9f58);logger['debug']('GetVtigerAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetVtigerAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file +var _0x5423=['options','raw','where','limit','include','attributes','map','model','then','ShowVtigerAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','findAll'];(function(_0x45be95,_0x11c020){var _0x1dadea=function(_0x61b43){while(--_0x61b43){_0x45be95['push'](_0x45be95['shift']());}};_0x1dadea(++_0x11c020);}(_0x5423,0xe3));var _0x3542=function(_0x392f70,_0x27c10c){_0x392f70=_0x392f70-0x0;var _0x20bd58=_0x5423[_0x392f70];return _0x20bd58;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var moment=require('moment');var BPromise=require(_0x3542('0x2'));var rs=require(_0x3542('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3542('0x4'))['db'];var utils=require(_0x3542('0x5'));var logger=require(_0x3542('0x6'))(_0x3542('0x7'));var config=require('../../config/environment');var jayson=require(_0x3542('0x8'));var client=jayson[_0x3542('0x9')][_0x3542('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29c3fa,_0x2e1a62,_0x55413c){return new BPromise(function(_0x4cdc86,_0xbc51ab){return client[_0x3542('0xb')](_0x29c3fa,_0x55413c)['then'](function(_0x681195){logger[_0x3542('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x2e1a62,_0x3542('0xd'));logger[_0x3542('0xe')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x2e1a62,_0x3542('0xd'),JSON[_0x3542('0xf')](_0x681195));if(_0x681195[_0x3542('0x10')]){if(_0x681195[_0x3542('0x10')][_0x3542('0x11')]===0x1f4){logger[_0x3542('0x10')](_0x3542('0x12'),_0x2e1a62,_0x681195[_0x3542('0x10')][_0x3542('0x13')]);return _0xbc51ab(_0x681195[_0x3542('0x10')][_0x3542('0x13')]);}logger[_0x3542('0x10')](_0x3542('0x12'),_0x2e1a62,_0x681195['error'][_0x3542('0x13')]);return _0x4cdc86(_0x681195['error'][_0x3542('0x13')]);}else{logger[_0x3542('0xc')](_0x3542('0x12'),_0x2e1a62,'request\x20sent');_0x4cdc86(_0x681195[_0x3542('0x14')][_0x3542('0x13')]);}})[_0x3542('0x15')](function(_0x5726af){logger[_0x3542('0x10')](_0x3542('0x12'),_0x2e1a62,_0x5726af);_0xbc51ab(_0x5726af);});});}exports[_0x3542('0x16')]=function(_0x3d5199){var _0x493d95=this;return new Promise(function(_0x32df3f,_0x53d4aa){return db[_0x3542('0x17')][_0x3542('0x18')]({'raw':_0x3d5199['options']?_0x3d5199[_0x3542('0x19')][_0x3542('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d5199[_0x3542('0x19')]?_0x3d5199[_0x3542('0x19')][_0x3542('0x1b')]||null:null,'attributes':_0x3d5199['options']?_0x3d5199['options']['attributes']||null:null,'limit':_0x3d5199[_0x3542('0x19')]?_0x3d5199['options'][_0x3542('0x1c')]||null:null,'include':_0x3d5199['options']?_0x3d5199[_0x3542('0x19')]['include']?_['map'](_0x3d5199[_0x3542('0x19')][_0x3542('0x1d')],function(_0x5ae097){return{'model':db[_0x5ae097['model']],'as':_0x5ae097['as'],'attributes':_0x5ae097[_0x3542('0x1e')],'include':_0x5ae097['include']?_[_0x3542('0x1f')](_0x5ae097[_0x3542('0x1d')],function(_0x1e0723){return{'model':db[_0x1e0723[_0x3542('0x20')]],'as':_0x1e0723['as'],'attributes':_0x1e0723[_0x3542('0x1e')],'include':_0x1e0723[_0x3542('0x1d')]?_[_0x3542('0x1f')](_0x1e0723[_0x3542('0x1d')],function(_0x18dc6c){return{'model':db[_0x18dc6c[_0x3542('0x20')]],'as':_0x18dc6c['as'],'attributes':_0x18dc6c[_0x3542('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3542('0x21')](function(_0x220021){logger[_0x3542('0xc')](_0x3542('0x16'),_0x3d5199);logger[_0x3542('0xe')](_0x3542('0x16'),_0x3d5199,JSON[_0x3542('0xf')](_0x220021));_0x32df3f(_0x220021);})[_0x3542('0x15')](function(_0x5590a2){logger[_0x3542('0x10')](_0x3542('0x16'),_0x5590a2[_0x3542('0x13')],_0x3d5199);_0x53d4aa(_0x493d95['error'](0x1f4,_0x5590a2[_0x3542('0x13')]));});});};exports[_0x3542('0x22')]=function(_0x2e883a){var _0x30b5e8=this;return new Promise(function(_0x5c882f,_0x5a274b){return db[_0x3542('0x17')][_0x3542('0x23')]({'raw':_0x2e883a[_0x3542('0x19')]?_0x2e883a[_0x3542('0x19')][_0x3542('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e883a[_0x3542('0x19')]?_0x2e883a[_0x3542('0x19')]['where']||null:null,'attributes':_0x2e883a['options']?_0x2e883a[_0x3542('0x19')]['attributes']||null:null,'include':_0x2e883a['options']?_0x2e883a[_0x3542('0x19')]['include']?_['map'](_0x2e883a[_0x3542('0x19')][_0x3542('0x1d')],function(_0x1bf178){return{'model':db[_0x1bf178['model']],'as':_0x1bf178['as'],'attributes':_0x1bf178[_0x3542('0x1e')],'include':_0x1bf178['include']?_[_0x3542('0x1f')](_0x1bf178[_0x3542('0x1d')],function(_0x561fd0){return{'model':db[_0x561fd0[_0x3542('0x20')]],'as':_0x561fd0['as'],'attributes':_0x561fd0['attributes'],'include':_0x561fd0[_0x3542('0x1d')]?_[_0x3542('0x1f')](_0x561fd0[_0x3542('0x1d')],function(_0x4cfb8f){return{'model':db[_0x4cfb8f[_0x3542('0x20')]],'as':_0x4cfb8f['as'],'attributes':_0x4cfb8f['attributes']};}):[]};}):[]};}):[]:[]})[_0x3542('0x21')](function(_0x1fe5c6){logger[_0x3542('0xc')](_0x3542('0x22'),_0x2e883a);logger[_0x3542('0xe')](_0x3542('0x22'),_0x2e883a,JSON[_0x3542('0xf')](_0x1fe5c6));_0x5c882f(_0x1fe5c6);})[_0x3542('0x15')](function(_0x110aa8){logger[_0x3542('0x10')](_0x3542('0x22'),_0x110aa8[_0x3542('0x13')],_0x2e883a);_0x5a274b(_0x30b5e8[_0x3542('0x10')](0x1f4,_0x110aa8['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 4965ccd..eb45104 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 _0x55aa=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','getDescriptions','post','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1f5bf7,_0x8ea22a){var _0x150087=function(_0x3784e7){while(--_0x3784e7){_0x1f5bf7['push'](_0x1f5bf7['shift']());}};_0x150087(++_0x8ea22a);}(_0x55aa,0x17e));var _0xa55a=function(_0x4b6d75,_0x4f518a){_0x4b6d75=_0x4b6d75-0x0;var _0x3bdb58=_0x55aa[_0x4b6d75];return _0x3bdb58;};'use strict';var multer=require(_0xa55a('0x0'));var util=require(_0xa55a('0x1'));var path=require(_0xa55a('0x2'));var timeout=require(_0xa55a('0x3'));var express=require(_0xa55a('0x4'));var router=express[_0xa55a('0x5')]();var fs_extra=require(_0xa55a('0x6'));var auth=require(_0xa55a('0x7'));var interaction=require(_0xa55a('0x8'));var config=require(_0xa55a('0x9'));var controller=require('./intVtigerConfiguration.controller');router[_0xa55a('0xa')]('/',auth[_0xa55a('0xb')](),controller[_0xa55a('0xc')]);router['get'](_0xa55a('0xd'),auth[_0xa55a('0xb')](),controller[_0xa55a('0xe')]);router['get'](_0xa55a('0xf'),auth[_0xa55a('0xb')](),controller[_0xa55a('0x10')]);router['get']('/:id/subjects',auth[_0xa55a('0xb')](),controller[_0xa55a('0x11')]);router['get']('/:id/descriptions',auth[_0xa55a('0xb')](),controller[_0xa55a('0x12')]);router[_0xa55a('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa55a('0x14')](_0xa55a('0xd'),auth['isAuthenticated'](),controller[_0xa55a('0x15')]);router['delete'](_0xa55a('0xd'),auth[_0xa55a('0xb')](),controller[_0xa55a('0x16')]);module['exports']=router; \ No newline at end of file +var _0xe336=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x3eaa42,_0x604691){var _0x805418=function(_0x204815){while(--_0x204815){_0x3eaa42['push'](_0x3eaa42['shift']());}};_0x805418(++_0x604691);}(_0xe336,0x105));var _0x6e33=function(_0x5d4081,_0x483669){_0x5d4081=_0x5d4081-0x0;var _0x586e8b=_0xe336[_0x5d4081];return _0x586e8b;};'use strict';var multer=require(_0x6e33('0x0'));var util=require('util');var path=require(_0x6e33('0x1'));var timeout=require(_0x6e33('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6e33('0x3'));var auth=require(_0x6e33('0x4'));var interaction=require(_0x6e33('0x5'));var config=require(_0x6e33('0x6'));var controller=require(_0x6e33('0x7'));router[_0x6e33('0x8')]('/',auth[_0x6e33('0x9')](),controller[_0x6e33('0xa')]);router[_0x6e33('0x8')](_0x6e33('0xb'),auth[_0x6e33('0x9')](),controller['show']);router['get'](_0x6e33('0xc'),auth['isAuthenticated'](),controller[_0x6e33('0xd')]);router[_0x6e33('0x8')](_0x6e33('0xe'),auth[_0x6e33('0x9')](),controller[_0x6e33('0xf')]);router[_0x6e33('0x8')](_0x6e33('0x10'),auth[_0x6e33('0x9')](),controller[_0x6e33('0x11')]);router[_0x6e33('0x12')]('/',auth['isAuthenticated'](),controller[_0x6e33('0x13')]);router['put'](_0x6e33('0xb'),auth[_0x6e33('0x9')](),controller[_0x6e33('0x14')]);router[_0x6e33('0x15')](_0x6e33('0xb'),auth[_0x6e33('0x9')](),controller[_0x6e33('0x16')]);module[_0x6e33('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index fa3fbb1..e15ed37 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 _0x27f9=['sequelize','exports','STRING'];(function(_0x78f216,_0x380a4e){var _0x3c6618=function(_0x50b0c7){while(--_0x50b0c7){_0x78f216['push'](_0x78f216['shift']());}};_0x3c6618(++_0x380a4e);}(_0x27f9,0xf3));var _0x927f=function(_0x469355,_0x2657a1){_0x469355=_0x469355-0x0;var _0x4aacff=_0x27f9[_0x469355];return _0x4aacff;};'use strict';var Sequelize=require(_0x927f('0x0'));module[_0x927f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x927f('0x2')]}}; \ No newline at end of file +var _0xcaa5=['STRING','exports'];(function(_0x59880d,_0x465eef){var _0x5b2c95=function(_0x695abc){while(--_0x695abc){_0x59880d['push'](_0x59880d['shift']());}};_0x5b2c95(++_0x465eef);}(_0xcaa5,0xc1));var _0x5caa=function(_0x3a0b7f,_0x550d3b){_0x3a0b7f=_0x3a0b7f-0x0;var _0x551562=_0xcaa5[_0x3a0b7f];return _0x551562;};'use strict';var Sequelize=require('sequelize');module[_0x5caa('0x0')]={'name':{'type':Sequelize[_0x5caa('0x1')]},'description':{'type':Sequelize[_0x5caa('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 209112e..2dff069 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 _0x7d21=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','VtigerConfiguration','includeAll','include','findAll','rows','show','params','find','create','update','body','catch','findOne','VtigerField','pick','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','mustache','path','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0x7d21,0x17d));var _0x17d2=function(_0x5c9c31,_0x1885ed){_0x5c9c31=_0x5c9c31-0x0;var _0xbfcbd8=_0x7d21[_0x5c9c31];return _0xbfcbd8;};'use strict';var emlformat=require(_0x17d2('0x0'));var rimraf=require(_0x17d2('0x1'));var zipdir=require(_0x17d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x17d2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x17d2('0x4'));var util=require('util');var path=require(_0x17d2('0x5'));var sox=require('sox');var csv=require(_0x17d2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x17d2('0x7'));var squel=require(_0x17d2('0x8'));var crypto=require(_0x17d2('0x9'));var jsforce=require(_0x17d2('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x17d2('0xb'));var Redis=require(_0x17d2('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x17d2('0xd'));var as=require(_0x17d2('0xe'));var hardwareService=require(_0x17d2('0xf'));var logger=require(_0x17d2('0x10'))(_0x17d2('0x11'));var utils=require(_0x17d2('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x17d2('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3934e2,_0x20d107){_0x20d107=_0x20d107||0xcc;return function(_0x5047f4){if(_0x5047f4){return _0x3934e2[_0x17d2('0x14')](_0x20d107);}return _0x3934e2[_0x17d2('0x15')](_0x20d107)['end']();};}function respondWithResult(_0x1ecdb7,_0x2f7e04){_0x2f7e04=_0x2f7e04||0xc8;return function(_0x142537){if(_0x142537){return _0x1ecdb7[_0x17d2('0x15')](_0x2f7e04)[_0x17d2('0x16')](_0x142537);}};}function respondWithFilteredResult(_0x14256a,_0x445240){return function(_0x1cb589){if(_0x1cb589){var _0x1d7127=typeof _0x445240[_0x17d2('0x17')]===_0x17d2('0x18')&&typeof _0x445240['limit']==='undefined';var _0x5e8ed1=_0x1cb589[_0x17d2('0x19')];var _0x1b7e98=_0x1d7127?0x0:_0x445240[_0x17d2('0x17')];var _0x414218=_0x1d7127?_0x1cb589[_0x17d2('0x19')]:_0x445240[_0x17d2('0x17')]+_0x445240[_0x17d2('0x1a')];var _0x39f4f0;if(_0x414218>=_0x5e8ed1){_0x414218=_0x5e8ed1;_0x39f4f0=0xc8;}else{_0x39f4f0=0xce;}_0x14256a[_0x17d2('0x15')](_0x39f4f0);return _0x14256a[_0x17d2('0x1b')](_0x17d2('0x1c'),_0x1b7e98+'-'+_0x414218+'/'+_0x5e8ed1)[_0x17d2('0x16')](_0x1cb589);}return null;};}function patchUpdates(_0x39d87d){return function(_0x5c1b67){try{jsonpatch[_0x17d2('0x1d')](_0x5c1b67,_0x39d87d,!![]);}catch(_0x1c569c){return BPromise[_0x17d2('0x1e')](_0x1c569c);}return _0x5c1b67[_0x17d2('0x1f')]();};}function saveUpdates(_0x130c35,_0x1dc796){return function(_0x558b08){if(_0x558b08){return _0x558b08['update'](_0x130c35)[_0x17d2('0x20')](function(_0x162ce4){return _0x162ce4;});}return null;};}function removeEntity(_0x4918d1,_0x300cee){return function(_0x3154cf){if(_0x3154cf){return _0x3154cf[_0x17d2('0x21')]()[_0x17d2('0x20')](function(){_0x4918d1[_0x17d2('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36df17,_0xe35396){return function(_0x367056){if(!_0x367056){_0x36df17[_0x17d2('0x14')](0x194);}return _0x367056;};}function handleError(_0x1b23a1,_0x3a9d15){_0x3a9d15=_0x3a9d15||0x1f4;return function(_0x3a3aa6){logger[_0x17d2('0x22')](_0x3a3aa6[_0x17d2('0x23')]);if(_0x3a3aa6[_0x17d2('0x24')]){delete _0x3a3aa6[_0x17d2('0x24')];}_0x1b23a1[_0x17d2('0x15')](_0x3a9d15)[_0x17d2('0x25')](_0x3a3aa6);};}exports[_0x17d2('0x26')]=function(_0x3ec367,_0x1a5422){var _0x35255f={},_0x5e8866={},_0x167b95={'count':0x0,'rows':[]};var _0x4cc802=_['map'](db['VtigerConfiguration'][_0x17d2('0x27')],function(_0x50d449){return{'name':_0x50d449[_0x17d2('0x28')],'type':_0x50d449[_0x17d2('0x29')][_0x17d2('0x2a')]};});_0x5e8866[_0x17d2('0x2b')]=_[_0x17d2('0x2c')](_0x4cc802,_0x17d2('0x24'));_0x5e8866['query']=_[_0x17d2('0x2d')](_0x3ec367['query']);_0x5e8866[_0x17d2('0x2e')]=_[_0x17d2('0x2f')](_0x5e8866[_0x17d2('0x2b')],_0x5e8866['query']);_0x35255f[_0x17d2('0x30')]=_['intersection'](_0x5e8866[_0x17d2('0x2b')],qs['fields'](_0x3ec367[_0x17d2('0x31')][_0x17d2('0x32')]));_0x35255f[_0x17d2('0x30')]=_0x35255f[_0x17d2('0x30')][_0x17d2('0x33')]?_0x35255f['attributes']:_0x5e8866[_0x17d2('0x2b')];if(!_0x3ec367[_0x17d2('0x31')][_0x17d2('0x34')](_0x17d2('0x35'))){_0x35255f[_0x17d2('0x1a')]=qs['limit'](_0x3ec367[_0x17d2('0x31')][_0x17d2('0x1a')]);_0x35255f[_0x17d2('0x17')]=qs[_0x17d2('0x17')](_0x3ec367['query']['offset']);}_0x35255f[_0x17d2('0x36')]=qs[_0x17d2('0x37')](_0x3ec367[_0x17d2('0x31')][_0x17d2('0x37')]);_0x35255f['where']=qs['filters'](_['pick'](_0x3ec367[_0x17d2('0x31')],_0x5e8866[_0x17d2('0x2e')]),_0x4cc802);if(_0x3ec367[_0x17d2('0x31')][_0x17d2('0x38')]){_0x35255f[_0x17d2('0x39')]=_['merge'](_0x35255f[_0x17d2('0x39')],{'$or':_[_0x17d2('0x2c')](_0x4cc802,function(_0x424259){if(_0x424259[_0x17d2('0x29')]!==_0x17d2('0x3a')){var _0x31b2e9={};_0x31b2e9[_0x424259[_0x17d2('0x24')]]={'$like':'%'+_0x3ec367[_0x17d2('0x31')][_0x17d2('0x38')]+'%'};return _0x31b2e9;}})});}_0x35255f=_[_0x17d2('0x3b')]({},_0x35255f,_0x3ec367[_0x17d2('0x3c')]);var _0x4dbac4={'where':_0x35255f['where']};return db[_0x17d2('0x3d')][_0x17d2('0x19')](_0x4dbac4)['then'](function(_0x2a96d6){_0x167b95['count']=_0x2a96d6;if(_0x3ec367['query'][_0x17d2('0x3e')]){_0x35255f[_0x17d2('0x3f')]=[{'all':!![]}];}return db[_0x17d2('0x3d')][_0x17d2('0x40')](_0x35255f);})[_0x17d2('0x20')](function(_0x5c0bc7){_0x167b95[_0x17d2('0x41')]=_0x5c0bc7;return _0x167b95;})[_0x17d2('0x20')](respondWithFilteredResult(_0x1a5422,_0x35255f))['catch'](handleError(_0x1a5422,null));};exports[_0x17d2('0x42')]=function(_0x26c39b,_0x368b6c){var _0x1a5c0a={'raw':![],'where':{'id':_0x26c39b[_0x17d2('0x43')]['id']}},_0x13b664={};_0x13b664[_0x17d2('0x2b')]=_['keys'](db[_0x17d2('0x3d')][_0x17d2('0x27')]);_0x13b664[_0x17d2('0x31')]=_[_0x17d2('0x2d')](_0x26c39b[_0x17d2('0x31')]);_0x13b664[_0x17d2('0x2e')]=_[_0x17d2('0x2f')](_0x13b664[_0x17d2('0x2b')],_0x13b664[_0x17d2('0x31')]);_0x1a5c0a[_0x17d2('0x30')]=_['intersection'](_0x13b664[_0x17d2('0x2b')],qs[_0x17d2('0x32')](_0x26c39b[_0x17d2('0x31')][_0x17d2('0x32')]));_0x1a5c0a[_0x17d2('0x30')]=_0x1a5c0a['attributes'][_0x17d2('0x33')]?_0x1a5c0a[_0x17d2('0x30')]:_0x13b664[_0x17d2('0x2b')];if(_0x26c39b['query']['includeAll']){_0x1a5c0a[_0x17d2('0x3f')]=[{'all':!![]}];}_0x1a5c0a=_['merge']({},_0x1a5c0a,_0x26c39b[_0x17d2('0x3c')]);return db[_0x17d2('0x3d')][_0x17d2('0x44')](_0x1a5c0a)[_0x17d2('0x20')](handleEntityNotFound(_0x368b6c,null))['then'](respondWithResult(_0x368b6c,null))['catch'](handleError(_0x368b6c,null));};exports['create']=function(_0x53bc2b,_0x54159c){return db[_0x17d2('0x3d')][_0x17d2('0x45')](_0x53bc2b['body'],{})['then'](respondWithResult(_0x54159c,0xc9))['catch'](handleError(_0x54159c,null));};exports[_0x17d2('0x46')]=function(_0x4970ab,_0x386510){if(_0x4970ab['body']['id']){delete _0x4970ab[_0x17d2('0x47')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x4970ab[_0x17d2('0x43')]['id']}})[_0x17d2('0x20')](handleEntityNotFound(_0x386510,null))[_0x17d2('0x20')](saveUpdates(_0x4970ab['body'],null))['then'](respondWithResult(_0x386510,null))[_0x17d2('0x48')](handleError(_0x386510,null));};exports[_0x17d2('0x21')]=function(_0x2ef14b,_0x58b703){return db[_0x17d2('0x3d')][_0x17d2('0x44')]({'where':{'id':_0x2ef14b[_0x17d2('0x43')]['id']}})[_0x17d2('0x20')](handleEntityNotFound(_0x58b703,null))['then'](removeEntity(_0x58b703,null))[_0x17d2('0x48')](handleError(_0x58b703,null));};exports['getFields']=function(_0x4ad8ef,_0x2053c5,_0x37b2d8){var _0x53ae9e={};var _0x100a6a={};var _0x8d7f1f;var _0x3a7fe1;return db['VtigerConfiguration'][_0x17d2('0x49')]({'where':{'id':_0x4ad8ef[_0x17d2('0x43')]['id']}})['then'](handleEntityNotFound(_0x2053c5,null))['then'](function(_0x324ab5){if(_0x324ab5){_0x8d7f1f=_0x324ab5;_0x100a6a[_0x17d2('0x2b')]=_[_0x17d2('0x2d')](db[_0x17d2('0x4a')]['rawAttributes']);_0x100a6a[_0x17d2('0x31')]=_[_0x17d2('0x2d')](_0x4ad8ef['query']);_0x100a6a[_0x17d2('0x2e')]=_['intersection'](_0x100a6a[_0x17d2('0x2b')],_0x100a6a['query']);_0x53ae9e[_0x17d2('0x30')]=_[_0x17d2('0x2f')](_0x100a6a[_0x17d2('0x2b')],qs[_0x17d2('0x32')](_0x4ad8ef[_0x17d2('0x31')][_0x17d2('0x32')]));_0x53ae9e[_0x17d2('0x30')]=_0x53ae9e[_0x17d2('0x30')][_0x17d2('0x33')]?_0x53ae9e['attributes']:_0x100a6a['model'];_0x53ae9e['order']=qs[_0x17d2('0x37')](_0x4ad8ef[_0x17d2('0x31')][_0x17d2('0x37')]);_0x53ae9e[_0x17d2('0x39')]=qs[_0x17d2('0x2e')](_[_0x17d2('0x4b')](_0x4ad8ef[_0x17d2('0x31')],_0x100a6a[_0x17d2('0x2e')]));if(_0x4ad8ef[_0x17d2('0x31')][_0x17d2('0x38')]){_0x53ae9e[_0x17d2('0x39')]=_['merge'](_0x53ae9e[_0x17d2('0x39')],{'$or':_[_0x17d2('0x2c')](_0x53ae9e[_0x17d2('0x30')],function(_0x2fd717){var _0x4ab557={};_0x4ab557[_0x2fd717]={'$like':'%'+_0x4ad8ef[_0x17d2('0x31')][_0x17d2('0x38')]+'%'};return _0x4ab557;})});}_0x53ae9e=_[_0x17d2('0x3b')]({},_0x53ae9e,_0x4ad8ef[_0x17d2('0x3c')]);return _0x8d7f1f['getFields'](_0x53ae9e);}})[_0x17d2('0x20')](function(_0x22fd5f){if(_0x22fd5f){_0x3a7fe1=_0x22fd5f[_0x17d2('0x33')];if(!_0x4ad8ef['query'][_0x17d2('0x34')]('nolimit')){_0x53ae9e['limit']=qs['limit'](_0x4ad8ef[_0x17d2('0x31')]['limit']);_0x53ae9e[_0x17d2('0x17')]=qs[_0x17d2('0x17')](_0x4ad8ef['query'][_0x17d2('0x17')]);}return _0x8d7f1f[_0x17d2('0x4c')](_0x53ae9e);}})[_0x17d2('0x20')](function(_0x24398c){if(_0x24398c){return _0x24398c?{'count':_0x3a7fe1,'rows':_0x24398c}:null;}})['then'](respondWithResult(_0x2053c5,null))[_0x17d2('0x48')](handleError(_0x2053c5,null));};exports[_0x17d2('0x4d')]=function(_0x54e38c,_0x552b5f,_0x43de42){var _0x5501bf={};var _0x29e554={};var _0x3e85b6;var _0x528b91;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x54e38c[_0x17d2('0x43')]['id']}})['then'](handleEntityNotFound(_0x552b5f,null))['then'](function(_0x36ee0b){if(_0x36ee0b){_0x3e85b6=_0x36ee0b;_0x29e554['model']=_[_0x17d2('0x2d')](db['VtigerField'][_0x17d2('0x27')]);_0x29e554[_0x17d2('0x31')]=_[_0x17d2('0x2d')](_0x54e38c[_0x17d2('0x31')]);_0x29e554[_0x17d2('0x2e')]=_[_0x17d2('0x2f')](_0x29e554[_0x17d2('0x2b')],_0x29e554[_0x17d2('0x31')]);_0x5501bf['attributes']=_[_0x17d2('0x2f')](_0x29e554[_0x17d2('0x2b')],qs[_0x17d2('0x32')](_0x54e38c['query'][_0x17d2('0x32')]));_0x5501bf[_0x17d2('0x30')]=_0x5501bf[_0x17d2('0x30')][_0x17d2('0x33')]?_0x5501bf[_0x17d2('0x30')]:_0x29e554['model'];_0x5501bf[_0x17d2('0x36')]=qs[_0x17d2('0x37')](_0x54e38c[_0x17d2('0x31')][_0x17d2('0x37')]);_0x5501bf[_0x17d2('0x39')]=qs[_0x17d2('0x2e')](_[_0x17d2('0x4b')](_0x54e38c[_0x17d2('0x31')],_0x29e554[_0x17d2('0x2e')]));if(_0x54e38c[_0x17d2('0x31')][_0x17d2('0x38')]){_0x5501bf[_0x17d2('0x39')]=_[_0x17d2('0x3b')](_0x5501bf[_0x17d2('0x39')],{'$or':_[_0x17d2('0x2c')](_0x5501bf[_0x17d2('0x30')],function(_0x462481){var _0x44e8f4={};_0x44e8f4[_0x462481]={'$like':'%'+_0x54e38c[_0x17d2('0x31')][_0x17d2('0x38')]+'%'};return _0x44e8f4;})});}_0x5501bf=_[_0x17d2('0x3b')]({},_0x5501bf,_0x54e38c['options']);return _0x3e85b6[_0x17d2('0x4d')](_0x5501bf);}})[_0x17d2('0x20')](function(_0x544790){if(_0x544790){_0x528b91=_0x544790[_0x17d2('0x33')];if(!_0x54e38c['query'][_0x17d2('0x34')]('nolimit')){_0x5501bf[_0x17d2('0x1a')]=qs[_0x17d2('0x1a')](_0x54e38c[_0x17d2('0x31')][_0x17d2('0x1a')]);_0x5501bf['offset']=qs[_0x17d2('0x17')](_0x54e38c['query'][_0x17d2('0x17')]);}return _0x3e85b6[_0x17d2('0x4d')](_0x5501bf);}})['then'](function(_0x41de54){if(_0x41de54){return _0x41de54?{'count':_0x528b91,'rows':_0x41de54}:null;}})[_0x17d2('0x20')](respondWithResult(_0x552b5f,null))[_0x17d2('0x48')](handleError(_0x552b5f,null));};exports[_0x17d2('0x4e')]=function(_0x652c56,_0xaf928d,_0x7c3e09){var _0xfc5bcd={};var _0xa00f91={};var _0x3b6690;var _0x61bc1;return db[_0x17d2('0x3d')][_0x17d2('0x49')]({'where':{'id':_0x652c56[_0x17d2('0x43')]['id']}})['then'](handleEntityNotFound(_0xaf928d,null))[_0x17d2('0x20')](function(_0x289058){if(_0x289058){_0x3b6690=_0x289058;_0xa00f91[_0x17d2('0x2b')]=_['keys'](db[_0x17d2('0x4a')][_0x17d2('0x27')]);_0xa00f91[_0x17d2('0x31')]=_[_0x17d2('0x2d')](_0x652c56['query']);_0xa00f91[_0x17d2('0x2e')]=_[_0x17d2('0x2f')](_0xa00f91[_0x17d2('0x2b')],_0xa00f91['query']);_0xfc5bcd[_0x17d2('0x30')]=_[_0x17d2('0x2f')](_0xa00f91[_0x17d2('0x2b')],qs['fields'](_0x652c56[_0x17d2('0x31')][_0x17d2('0x32')]));_0xfc5bcd[_0x17d2('0x30')]=_0xfc5bcd[_0x17d2('0x30')][_0x17d2('0x33')]?_0xfc5bcd[_0x17d2('0x30')]:_0xa00f91[_0x17d2('0x2b')];_0xfc5bcd[_0x17d2('0x36')]=qs['sort'](_0x652c56[_0x17d2('0x31')][_0x17d2('0x37')]);_0xfc5bcd[_0x17d2('0x39')]=qs[_0x17d2('0x2e')](_['pick'](_0x652c56[_0x17d2('0x31')],_0xa00f91[_0x17d2('0x2e')]));if(_0x652c56[_0x17d2('0x31')][_0x17d2('0x38')]){_0xfc5bcd[_0x17d2('0x39')]=_['merge'](_0xfc5bcd['where'],{'$or':_['map'](_0xfc5bcd[_0x17d2('0x30')],function(_0x4f87a8){var _0x1ad893={};_0x1ad893[_0x4f87a8]={'$like':'%'+_0x652c56[_0x17d2('0x31')]['filter']+'%'};return _0x1ad893;})});}_0xfc5bcd=_[_0x17d2('0x3b')]({},_0xfc5bcd,_0x652c56[_0x17d2('0x3c')]);return _0x3b6690[_0x17d2('0x4e')](_0xfc5bcd);}})[_0x17d2('0x20')](function(_0x4b1563){if(_0x4b1563){_0x61bc1=_0x4b1563[_0x17d2('0x33')];if(!_0x652c56['query'][_0x17d2('0x34')](_0x17d2('0x35'))){_0xfc5bcd[_0x17d2('0x1a')]=qs[_0x17d2('0x1a')](_0x652c56[_0x17d2('0x31')]['limit']);_0xfc5bcd['offset']=qs[_0x17d2('0x17')](_0x652c56[_0x17d2('0x31')][_0x17d2('0x17')]);}return _0x3b6690[_0x17d2('0x4e')](_0xfc5bcd);}})[_0x17d2('0x20')](function(_0x434bc9){if(_0x434bc9){return _0x434bc9?{'count':_0x61bc1,'rows':_0x434bc9}:null;}})[_0x17d2('0x20')](respondWithResult(_0xaf928d,null))['catch'](handleError(_0xaf928d,null));}; \ No newline at end of file +var _0x2baf=['path','to-csv','fs-extra','squel','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','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','VtigerConfiguration','includeAll','include','rows','catch','create','find','params','body','getFields','findOne','getSubjects','VtigerField','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache'];(function(_0x2db252,_0x575d98){var _0x9d0fa2=function(_0x16cb6f){while(--_0x16cb6f){_0x2db252['push'](_0x2db252['shift']());}};_0x9d0fa2(++_0x575d98);}(_0x2baf,0xe7));var _0xf2ba=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x2baf[_0xdea41a];return _0x15d0d8;};'use strict';var emlformat=require(_0xf2ba('0x0'));var rimraf=require(_0xf2ba('0x1'));var zipdir=require(_0xf2ba('0x2'));var jsonpatch=require(_0xf2ba('0x3'));var rp=require('request-promise');var moment=require(_0xf2ba('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf2ba('0x5'));var util=require('util');var path=require(_0xf2ba('0x6'));var sox=require('sox');var csv=require(_0xf2ba('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf2ba('0x8'));var _=require('lodash');var squel=require(_0xf2ba('0x9'));var crypto=require('crypto');var jsforce=require(_0xf2ba('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf2ba('0x7'));var querystring=require(_0xf2ba('0xb'));var Papa=require(_0xf2ba('0xc'));var Redis=require('ioredis');var authService=require(_0xf2ba('0xd'));var qs=require(_0xf2ba('0xe'));var as=require(_0xf2ba('0xf'));var hardwareService=require(_0xf2ba('0x10'));var logger=require(_0xf2ba('0x11'))(_0xf2ba('0x12'));var utils=require(_0xf2ba('0x13'));var config=require(_0xf2ba('0x14'));var licenseUtil=require(_0xf2ba('0x15'));var db=require(_0xf2ba('0x16'))['db'];function respondWithStatusCode(_0x570ad8,_0x6a379d){_0x6a379d=_0x6a379d||0xcc;return function(_0x2141dd){if(_0x2141dd){return _0x570ad8[_0xf2ba('0x17')](_0x6a379d);}return _0x570ad8[_0xf2ba('0x18')](_0x6a379d)['end']();};}function respondWithResult(_0x3b0c0c,_0x45a6e2){_0x45a6e2=_0x45a6e2||0xc8;return function(_0x70f826){if(_0x70f826){return _0x3b0c0c[_0xf2ba('0x18')](_0x45a6e2)[_0xf2ba('0x19')](_0x70f826);}};}function respondWithFilteredResult(_0x5aaf8a,_0x2b3e69){return function(_0x1bb0a2){if(_0x1bb0a2){var _0x3b24ef=typeof _0x2b3e69['offset']===_0xf2ba('0x1a')&&typeof _0x2b3e69[_0xf2ba('0x1b')]===_0xf2ba('0x1a');var _0x54dc0d=_0x1bb0a2[_0xf2ba('0x1c')];var _0x42160a=_0x3b24ef?0x0:_0x2b3e69[_0xf2ba('0x1d')];var _0x48cd4e=_0x3b24ef?_0x1bb0a2['count']:_0x2b3e69[_0xf2ba('0x1d')]+_0x2b3e69[_0xf2ba('0x1b')];var _0x2c93bd;if(_0x48cd4e>=_0x54dc0d){_0x48cd4e=_0x54dc0d;_0x2c93bd=0xc8;}else{_0x2c93bd=0xce;}_0x5aaf8a['status'](_0x2c93bd);return _0x5aaf8a[_0xf2ba('0x1e')](_0xf2ba('0x1f'),_0x42160a+'-'+_0x48cd4e+'/'+_0x54dc0d)[_0xf2ba('0x19')](_0x1bb0a2);}return null;};}function patchUpdates(_0x56b30a){return function(_0x1c1ed){try{jsonpatch[_0xf2ba('0x20')](_0x1c1ed,_0x56b30a,!![]);}catch(_0x43697f){return BPromise[_0xf2ba('0x21')](_0x43697f);}return _0x1c1ed['save']();};}function saveUpdates(_0x25b7b3,_0x30d6af){return function(_0x1d83aa){if(_0x1d83aa){return _0x1d83aa[_0xf2ba('0x22')](_0x25b7b3)[_0xf2ba('0x23')](function(_0x29742c){return _0x29742c;});}return null;};}function removeEntity(_0x29e921,_0x483672){return function(_0x44fb61){if(_0x44fb61){return _0x44fb61[_0xf2ba('0x24')]()[_0xf2ba('0x23')](function(){_0x29e921[_0xf2ba('0x18')](0xcc)[_0xf2ba('0x25')]();});}};}function handleEntityNotFound(_0x1e7835,_0x187fdf){return function(_0x5cfbd0){if(!_0x5cfbd0){_0x1e7835[_0xf2ba('0x17')](0x194);}return _0x5cfbd0;};}function handleError(_0x5cef98,_0x1f4144){_0x1f4144=_0x1f4144||0x1f4;return function(_0x4a2a89){logger[_0xf2ba('0x26')](_0x4a2a89[_0xf2ba('0x27')]);if(_0x4a2a89[_0xf2ba('0x28')]){delete _0x4a2a89[_0xf2ba('0x28')];}_0x5cef98['status'](_0x1f4144)['send'](_0x4a2a89);};}exports[_0xf2ba('0x29')]=function(_0xb71c04,_0x282990){var _0x5d02b3={},_0x281f28={},_0x1db6dc={'count':0x0,'rows':[]};var _0x32ee27=_[_0xf2ba('0x2a')](db['VtigerConfiguration'][_0xf2ba('0x2b')],function(_0x1c96e4){return{'name':_0x1c96e4[_0xf2ba('0x2c')],'type':_0x1c96e4[_0xf2ba('0x2d')][_0xf2ba('0x2e')]};});_0x281f28[_0xf2ba('0x2f')]=_[_0xf2ba('0x2a')](_0x32ee27,_0xf2ba('0x28'));_0x281f28[_0xf2ba('0x30')]=_[_0xf2ba('0x31')](_0xb71c04[_0xf2ba('0x30')]);_0x281f28[_0xf2ba('0x32')]=_[_0xf2ba('0x33')](_0x281f28['model'],_0x281f28[_0xf2ba('0x30')]);_0x5d02b3[_0xf2ba('0x34')]=_[_0xf2ba('0x33')](_0x281f28[_0xf2ba('0x2f')],qs['fields'](_0xb71c04[_0xf2ba('0x30')][_0xf2ba('0x35')]));_0x5d02b3[_0xf2ba('0x34')]=_0x5d02b3[_0xf2ba('0x34')][_0xf2ba('0x36')]?_0x5d02b3[_0xf2ba('0x34')]:_0x281f28[_0xf2ba('0x2f')];if(!_0xb71c04[_0xf2ba('0x30')]['hasOwnProperty'](_0xf2ba('0x37'))){_0x5d02b3[_0xf2ba('0x1b')]=qs[_0xf2ba('0x1b')](_0xb71c04['query'][_0xf2ba('0x1b')]);_0x5d02b3[_0xf2ba('0x1d')]=qs[_0xf2ba('0x1d')](_0xb71c04['query'][_0xf2ba('0x1d')]);}_0x5d02b3[_0xf2ba('0x38')]=qs[_0xf2ba('0x39')](_0xb71c04[_0xf2ba('0x30')][_0xf2ba('0x39')]);_0x5d02b3[_0xf2ba('0x3a')]=qs[_0xf2ba('0x32')](_[_0xf2ba('0x3b')](_0xb71c04['query'],_0x281f28[_0xf2ba('0x32')]),_0x32ee27);if(_0xb71c04[_0xf2ba('0x30')][_0xf2ba('0x3c')]){_0x5d02b3[_0xf2ba('0x3a')]=_['merge'](_0x5d02b3['where'],{'$or':_[_0xf2ba('0x2a')](_0x32ee27,function(_0x5dd738){if(_0x5dd738[_0xf2ba('0x2d')]!==_0xf2ba('0x3d')){var _0x8f5bd3={};_0x8f5bd3[_0x5dd738[_0xf2ba('0x28')]]={'$like':'%'+_0xb71c04['query'][_0xf2ba('0x3c')]+'%'};return _0x8f5bd3;}})});}_0x5d02b3=_[_0xf2ba('0x3e')]({},_0x5d02b3,_0xb71c04[_0xf2ba('0x3f')]);var _0x51c6a3={'where':_0x5d02b3[_0xf2ba('0x3a')]};return db[_0xf2ba('0x40')][_0xf2ba('0x1c')](_0x51c6a3)[_0xf2ba('0x23')](function(_0x2c85e4){_0x1db6dc['count']=_0x2c85e4;if(_0xb71c04[_0xf2ba('0x30')][_0xf2ba('0x41')]){_0x5d02b3[_0xf2ba('0x42')]=[{'all':!![]}];}return db[_0xf2ba('0x40')]['findAll'](_0x5d02b3);})[_0xf2ba('0x23')](function(_0x565509){_0x1db6dc[_0xf2ba('0x43')]=_0x565509;return _0x1db6dc;})['then'](respondWithFilteredResult(_0x282990,_0x5d02b3))[_0xf2ba('0x44')](handleError(_0x282990,null));};exports['show']=function(_0x53dc2a,_0x26260f){var _0x4adb7e={'raw':![],'where':{'id':_0x53dc2a['params']['id']}},_0x4ba30d={};_0x4ba30d[_0xf2ba('0x2f')]=_[_0xf2ba('0x31')](db[_0xf2ba('0x40')][_0xf2ba('0x2b')]);_0x4ba30d[_0xf2ba('0x30')]=_[_0xf2ba('0x31')](_0x53dc2a[_0xf2ba('0x30')]);_0x4ba30d[_0xf2ba('0x32')]=_[_0xf2ba('0x33')](_0x4ba30d[_0xf2ba('0x2f')],_0x4ba30d['query']);_0x4adb7e[_0xf2ba('0x34')]=_['intersection'](_0x4ba30d[_0xf2ba('0x2f')],qs[_0xf2ba('0x35')](_0x53dc2a[_0xf2ba('0x30')][_0xf2ba('0x35')]));_0x4adb7e[_0xf2ba('0x34')]=_0x4adb7e[_0xf2ba('0x34')][_0xf2ba('0x36')]?_0x4adb7e['attributes']:_0x4ba30d[_0xf2ba('0x2f')];if(_0x53dc2a['query'][_0xf2ba('0x41')]){_0x4adb7e[_0xf2ba('0x42')]=[{'all':!![]}];}_0x4adb7e=_[_0xf2ba('0x3e')]({},_0x4adb7e,_0x53dc2a[_0xf2ba('0x3f')]);return db[_0xf2ba('0x40')]['find'](_0x4adb7e)[_0xf2ba('0x23')](handleEntityNotFound(_0x26260f,null))[_0xf2ba('0x23')](respondWithResult(_0x26260f,null))['catch'](handleError(_0x26260f,null));};exports[_0xf2ba('0x45')]=function(_0x206c02,_0x479e42){return db[_0xf2ba('0x40')]['create'](_0x206c02['body'],{})[_0xf2ba('0x23')](respondWithResult(_0x479e42,0xc9))[_0xf2ba('0x44')](handleError(_0x479e42,null));};exports[_0xf2ba('0x22')]=function(_0x241414,_0x1440cd){if(_0x241414['body']['id']){delete _0x241414['body']['id'];}return db[_0xf2ba('0x40')][_0xf2ba('0x46')]({'where':{'id':_0x241414[_0xf2ba('0x47')]['id']}})[_0xf2ba('0x23')](handleEntityNotFound(_0x1440cd,null))[_0xf2ba('0x23')](saveUpdates(_0x241414[_0xf2ba('0x48')],null))[_0xf2ba('0x23')](respondWithResult(_0x1440cd,null))[_0xf2ba('0x44')](handleError(_0x1440cd,null));};exports['destroy']=function(_0x1afb72,_0x1ab5f3){return db['VtigerConfiguration'][_0xf2ba('0x46')]({'where':{'id':_0x1afb72[_0xf2ba('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ab5f3,null))[_0xf2ba('0x23')](removeEntity(_0x1ab5f3,null))['catch'](handleError(_0x1ab5f3,null));};exports[_0xf2ba('0x49')]=function(_0x453d4c,_0x47f4fc,_0x424068){var _0x48fc83={};var _0x2c17b4={};var _0x5b396e;var _0x2e79be;return db[_0xf2ba('0x40')][_0xf2ba('0x4a')]({'where':{'id':_0x453d4c[_0xf2ba('0x47')]['id']}})[_0xf2ba('0x23')](handleEntityNotFound(_0x47f4fc,null))[_0xf2ba('0x23')](function(_0x1a5fcb){if(_0x1a5fcb){_0x5b396e=_0x1a5fcb;_0x2c17b4[_0xf2ba('0x2f')]=_[_0xf2ba('0x31')](db['VtigerField']['rawAttributes']);_0x2c17b4[_0xf2ba('0x30')]=_[_0xf2ba('0x31')](_0x453d4c['query']);_0x2c17b4[_0xf2ba('0x32')]=_['intersection'](_0x2c17b4['model'],_0x2c17b4[_0xf2ba('0x30')]);_0x48fc83['attributes']=_['intersection'](_0x2c17b4[_0xf2ba('0x2f')],qs['fields'](_0x453d4c[_0xf2ba('0x30')][_0xf2ba('0x35')]));_0x48fc83[_0xf2ba('0x34')]=_0x48fc83[_0xf2ba('0x34')][_0xf2ba('0x36')]?_0x48fc83[_0xf2ba('0x34')]:_0x2c17b4[_0xf2ba('0x2f')];_0x48fc83[_0xf2ba('0x38')]=qs[_0xf2ba('0x39')](_0x453d4c[_0xf2ba('0x30')][_0xf2ba('0x39')]);_0x48fc83[_0xf2ba('0x3a')]=qs[_0xf2ba('0x32')](_[_0xf2ba('0x3b')](_0x453d4c[_0xf2ba('0x30')],_0x2c17b4[_0xf2ba('0x32')]));if(_0x453d4c[_0xf2ba('0x30')][_0xf2ba('0x3c')]){_0x48fc83[_0xf2ba('0x3a')]=_[_0xf2ba('0x3e')](_0x48fc83[_0xf2ba('0x3a')],{'$or':_[_0xf2ba('0x2a')](_0x48fc83['attributes'],function(_0x1da25c){var _0x5d2cda={};_0x5d2cda[_0x1da25c]={'$like':'%'+_0x453d4c[_0xf2ba('0x30')][_0xf2ba('0x3c')]+'%'};return _0x5d2cda;})});}_0x48fc83=_[_0xf2ba('0x3e')]({},_0x48fc83,_0x453d4c[_0xf2ba('0x3f')]);return _0x5b396e[_0xf2ba('0x49')](_0x48fc83);}})['then'](function(_0x4f2d9c){if(_0x4f2d9c){_0x2e79be=_0x4f2d9c[_0xf2ba('0x36')];if(!_0x453d4c['query']['hasOwnProperty'](_0xf2ba('0x37'))){_0x48fc83[_0xf2ba('0x1b')]=qs[_0xf2ba('0x1b')](_0x453d4c[_0xf2ba('0x30')]['limit']);_0x48fc83[_0xf2ba('0x1d')]=qs['offset'](_0x453d4c[_0xf2ba('0x30')][_0xf2ba('0x1d')]);}return _0x5b396e['getFields'](_0x48fc83);}})[_0xf2ba('0x23')](function(_0x5d467f){if(_0x5d467f){return _0x5d467f?{'count':_0x2e79be,'rows':_0x5d467f}:null;}})[_0xf2ba('0x23')](respondWithResult(_0x47f4fc,null))[_0xf2ba('0x44')](handleError(_0x47f4fc,null));};exports[_0xf2ba('0x4b')]=function(_0x209825,_0x27e599,_0x2a08da){var _0x1fe2b8={};var _0x241b94={};var _0x40cbdb;var _0x4549e5;return db[_0xf2ba('0x40')][_0xf2ba('0x4a')]({'where':{'id':_0x209825[_0xf2ba('0x47')]['id']}})[_0xf2ba('0x23')](handleEntityNotFound(_0x27e599,null))[_0xf2ba('0x23')](function(_0x5ae812){if(_0x5ae812){_0x40cbdb=_0x5ae812;_0x241b94[_0xf2ba('0x2f')]=_[_0xf2ba('0x31')](db[_0xf2ba('0x4c')][_0xf2ba('0x2b')]);_0x241b94[_0xf2ba('0x30')]=_[_0xf2ba('0x31')](_0x209825[_0xf2ba('0x30')]);_0x241b94[_0xf2ba('0x32')]=_[_0xf2ba('0x33')](_0x241b94[_0xf2ba('0x2f')],_0x241b94['query']);_0x1fe2b8[_0xf2ba('0x34')]=_['intersection'](_0x241b94[_0xf2ba('0x2f')],qs[_0xf2ba('0x35')](_0x209825[_0xf2ba('0x30')][_0xf2ba('0x35')]));_0x1fe2b8[_0xf2ba('0x34')]=_0x1fe2b8[_0xf2ba('0x34')]['length']?_0x1fe2b8['attributes']:_0x241b94[_0xf2ba('0x2f')];_0x1fe2b8[_0xf2ba('0x38')]=qs[_0xf2ba('0x39')](_0x209825[_0xf2ba('0x30')]['sort']);_0x1fe2b8[_0xf2ba('0x3a')]=qs[_0xf2ba('0x32')](_['pick'](_0x209825[_0xf2ba('0x30')],_0x241b94[_0xf2ba('0x32')]));if(_0x209825[_0xf2ba('0x30')]['filter']){_0x1fe2b8[_0xf2ba('0x3a')]=_['merge'](_0x1fe2b8[_0xf2ba('0x3a')],{'$or':_[_0xf2ba('0x2a')](_0x1fe2b8[_0xf2ba('0x34')],function(_0x459059){var _0x2a5c25={};_0x2a5c25[_0x459059]={'$like':'%'+_0x209825[_0xf2ba('0x30')][_0xf2ba('0x3c')]+'%'};return _0x2a5c25;})});}_0x1fe2b8=_['merge']({},_0x1fe2b8,_0x209825['options']);return _0x40cbdb[_0xf2ba('0x4b')](_0x1fe2b8);}})[_0xf2ba('0x23')](function(_0x57b1e6){if(_0x57b1e6){_0x4549e5=_0x57b1e6[_0xf2ba('0x36')];if(!_0x209825[_0xf2ba('0x30')][_0xf2ba('0x4d')]('nolimit')){_0x1fe2b8[_0xf2ba('0x1b')]=qs[_0xf2ba('0x1b')](_0x209825[_0xf2ba('0x30')]['limit']);_0x1fe2b8[_0xf2ba('0x1d')]=qs[_0xf2ba('0x1d')](_0x209825[_0xf2ba('0x30')][_0xf2ba('0x1d')]);}return _0x40cbdb['getSubjects'](_0x1fe2b8);}})[_0xf2ba('0x23')](function(_0x4d7923){if(_0x4d7923){return _0x4d7923?{'count':_0x4549e5,'rows':_0x4d7923}:null;}})[_0xf2ba('0x23')](respondWithResult(_0x27e599,null))[_0xf2ba('0x44')](handleError(_0x27e599,null));};exports[_0xf2ba('0x4e')]=function(_0x541d48,_0x5de9ad,_0x451e3f){var _0x392b65={};var _0xd74164={};var _0x1ba3e7;var _0x1ca08b;return db[_0xf2ba('0x40')][_0xf2ba('0x4a')]({'where':{'id':_0x541d48['params']['id']}})[_0xf2ba('0x23')](handleEntityNotFound(_0x5de9ad,null))[_0xf2ba('0x23')](function(_0x45e977){if(_0x45e977){_0x1ba3e7=_0x45e977;_0xd74164[_0xf2ba('0x2f')]=_['keys'](db[_0xf2ba('0x4c')][_0xf2ba('0x2b')]);_0xd74164['query']=_[_0xf2ba('0x31')](_0x541d48[_0xf2ba('0x30')]);_0xd74164[_0xf2ba('0x32')]=_['intersection'](_0xd74164['model'],_0xd74164[_0xf2ba('0x30')]);_0x392b65[_0xf2ba('0x34')]=_['intersection'](_0xd74164[_0xf2ba('0x2f')],qs['fields'](_0x541d48['query']['fields']));_0x392b65[_0xf2ba('0x34')]=_0x392b65['attributes'][_0xf2ba('0x36')]?_0x392b65[_0xf2ba('0x34')]:_0xd74164[_0xf2ba('0x2f')];_0x392b65[_0xf2ba('0x38')]=qs[_0xf2ba('0x39')](_0x541d48[_0xf2ba('0x30')][_0xf2ba('0x39')]);_0x392b65[_0xf2ba('0x3a')]=qs['filters'](_[_0xf2ba('0x3b')](_0x541d48[_0xf2ba('0x30')],_0xd74164[_0xf2ba('0x32')]));if(_0x541d48[_0xf2ba('0x30')]['filter']){_0x392b65['where']=_['merge'](_0x392b65[_0xf2ba('0x3a')],{'$or':_[_0xf2ba('0x2a')](_0x392b65['attributes'],function(_0x1532f5){var _0x6f7fd8={};_0x6f7fd8[_0x1532f5]={'$like':'%'+_0x541d48['query'][_0xf2ba('0x3c')]+'%'};return _0x6f7fd8;})});}_0x392b65=_[_0xf2ba('0x3e')]({},_0x392b65,_0x541d48['options']);return _0x1ba3e7['getDescriptions'](_0x392b65);}})[_0xf2ba('0x23')](function(_0x254751){if(_0x254751){_0x1ca08b=_0x254751[_0xf2ba('0x36')];if(!_0x541d48['query'][_0xf2ba('0x4d')]('nolimit')){_0x392b65[_0xf2ba('0x1b')]=qs['limit'](_0x541d48[_0xf2ba('0x30')][_0xf2ba('0x1b')]);_0x392b65['offset']=qs[_0xf2ba('0x1d')](_0x541d48['query'][_0xf2ba('0x1d')]);}return _0x1ba3e7[_0xf2ba('0x4e')](_0x392b65);}})[_0xf2ba('0x23')](function(_0x51cb6d){if(_0x51cb6d){return _0x51cb6d?{'count':_0x1ca08b,'rows':_0x51cb6d}:null;}})[_0xf2ba('0x23')](respondWithResult(_0x5de9ad,null))[_0xf2ba('0x44')](handleError(_0x5de9ad,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 1f27846..4962f6a 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 _0xd2da=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','int_vtiger_configurations','lodash','api'];(function(_0x5cde8f,_0x3b877b){var _0x22910d=function(_0x2a9800){while(--_0x2a9800){_0x5cde8f['push'](_0x5cde8f['shift']());}};_0x22910d(++_0x3b877b);}(_0xd2da,0x120));var _0xad2d=function(_0x2d344f,_0x25fa84){_0x2d344f=_0x2d344f-0x0;var _0x2e796b=_0xd2da[_0x2d344f];return _0x2e796b;};'use strict';var _=require(_0xad2d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xad2d('0x1'));var moment=require('moment');var BPromise=require(_0xad2d('0x2'));var rp=require(_0xad2d('0x3'));var fs=require('fs');var path=require(_0xad2d('0x4'));var rimraf=require(_0xad2d('0x5'));var config=require(_0xad2d('0x6'));var attributes=require(_0xad2d('0x7'));module['exports']=function(_0x53f6fe,_0x38fde5){return _0x53f6fe[_0xad2d('0x8')]('VtigerConfiguration',attributes,{'tableName':_0xad2d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1832=['define','int_vtiger_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x202a26,_0x5612f3){var _0x3b2f19=function(_0x1c1956){while(--_0x1c1956){_0x202a26['push'](_0x202a26['shift']());}};_0x3b2f19(++_0x5612f3);}(_0x1832,0xc0));var _0x2183=function(_0x15c8a8,_0x46cb6d){_0x15c8a8=_0x15c8a8-0x0;var _0x148b23=_0x1832[_0x15c8a8];return _0x148b23;};'use strict';var _=require(_0x2183('0x0'));var util=require(_0x2183('0x1'));var logger=require(_0x2183('0x2'))('api');var moment=require(_0x2183('0x3'));var BPromise=require(_0x2183('0x4'));var rp=require(_0x2183('0x5'));var fs=require('fs');var path=require(_0x2183('0x6'));var rimraf=require('rimraf');var config=require(_0x2183('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x3b99a8,_0x1f9436){return _0x3b99a8[_0x2183('0x8')]('VtigerConfiguration',attributes,{'tableName':_0x2183('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index a9fd5da..60156c6 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 _0x5521=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x5521,0xcc));var _0x1552=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5521[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x1552('0x0'));var util=require(_0x1552('0x1'));var moment=require(_0x1552('0x2'));var BPromise=require(_0x1552('0x3'));var rs=require(_0x1552('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1552('0x5'));var logger=require(_0x1552('0x6'))(_0x1552('0x7'));var config=require(_0x1552('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1552('0x9')][_0x1552('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19a4b3,_0x4fe5b4,_0x3de381){return new BPromise(function(_0x1129cc,_0x20a871){return client[_0x1552('0xb')](_0x19a4b3,_0x3de381)['then'](function(_0x15cc8f){logger[_0x1552('0xc')](_0x1552('0xd'),_0x4fe5b4,_0x1552('0xe'));logger[_0x1552('0xf')](_0x1552('0x10'),_0x4fe5b4,_0x1552('0xe'),JSON[_0x1552('0x11')](_0x15cc8f));if(_0x15cc8f[_0x1552('0x12')]){if(_0x15cc8f[_0x1552('0x12')][_0x1552('0x13')]===0x1f4){logger['error'](_0x1552('0xd'),_0x4fe5b4,_0x15cc8f[_0x1552('0x12')][_0x1552('0x14')]);return _0x20a871(_0x15cc8f[_0x1552('0x12')]['message']);}logger[_0x1552('0x12')](_0x1552('0xd'),_0x4fe5b4,_0x15cc8f[_0x1552('0x12')][_0x1552('0x14')]);return _0x1129cc(_0x15cc8f[_0x1552('0x12')]['message']);}else{logger[_0x1552('0xc')](_0x1552('0xd'),_0x4fe5b4,_0x1552('0xe'));_0x1129cc(_0x15cc8f[_0x1552('0x15')][_0x1552('0x14')]);}})['catch'](function(_0x53d1c3){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x4fe5b4,_0x53d1c3);_0x20a871(_0x53d1c3);});});} \ No newline at end of file +var _0x6e07=['error','code','message','info','result','util','moment','bluebird','randomstring','../../mysqldb','jayson/promise','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x521f74,_0x3542f3){var _0x5ee288=function(_0x15c4e2){while(--_0x15c4e2){_0x521f74['push'](_0x521f74['shift']());}};_0x5ee288(++_0x3542f3);}(_0x6e07,0x9d));var _0x76e0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e07[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x76e0('0x0'));var moment=require(_0x76e0('0x1'));var BPromise=require(_0x76e0('0x2'));var rs=require(_0x76e0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76e0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x76e0('0x5'));var client=jayson['client'][_0x76e0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x449521,_0x1b5b7b,_0xafdecc){return new BPromise(function(_0x598d7a,_0x17bbf1){return client[_0x76e0('0x7')](_0x449521,_0xafdecc)[_0x76e0('0x8')](function(_0x326405){logger['info'](_0x76e0('0x9'),_0x1b5b7b,_0x76e0('0xa'));logger[_0x76e0('0xb')](_0x76e0('0xc'),_0x1b5b7b,_0x76e0('0xa'),JSON[_0x76e0('0xd')](_0x326405));if(_0x326405['error']){if(_0x326405[_0x76e0('0xe')][_0x76e0('0xf')]===0x1f4){logger[_0x76e0('0xe')](_0x76e0('0x9'),_0x1b5b7b,_0x326405[_0x76e0('0xe')]['message']);return _0x17bbf1(_0x326405[_0x76e0('0xe')][_0x76e0('0x10')]);}logger[_0x76e0('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x1b5b7b,_0x326405['error'][_0x76e0('0x10')]);return _0x598d7a(_0x326405[_0x76e0('0xe')][_0x76e0('0x10')]);}else{logger[_0x76e0('0x11')](_0x76e0('0x9'),_0x1b5b7b,'request\x20sent');_0x598d7a(_0x326405[_0x76e0('0x12')][_0x76e0('0x10')]);}})['catch'](function(_0x427a7c){logger[_0x76e0('0xe')](_0x76e0('0x9'),_0x1b5b7b,_0x427a7c);_0x17bbf1(_0x427a7c);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index b67f1d8..c684497 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 _0x39e8=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','index','/:id','isAuthenticated','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x1617b5,_0x5e61d8){var _0xd9582d=function(_0x33076b){while(--_0x33076b){_0x1617b5['push'](_0x1617b5['shift']());}};_0xd9582d(++_0x5e61d8);}(_0x39e8,0x115));var _0x839e=function(_0x258ffe,_0x4506cd){_0x258ffe=_0x258ffe-0x0;var _0x1eac83=_0x39e8[_0x258ffe];return _0x1eac83;};'use strict';var multer=require(_0x839e('0x0'));var util=require(_0x839e('0x1'));var path=require(_0x839e('0x2'));var timeout=require(_0x839e('0x3'));var express=require('express');var router=express[_0x839e('0x4')]();var fs_extra=require(_0x839e('0x5'));var auth=require(_0x839e('0x6'));var interaction=require(_0x839e('0x7'));var config=require(_0x839e('0x8'));var controller=require(_0x839e('0x9'));router[_0x839e('0xa')]('/',auth['isAuthenticated'](),controller[_0x839e('0xb')]);router['get'](_0x839e('0xc'),auth[_0x839e('0xd')](),controller['show']);router[_0x839e('0xe')]('/',auth['isAuthenticated'](),controller[_0x839e('0xf')]);router[_0x839e('0x10')]('/:id',auth[_0x839e('0xd')](),controller['update']);router[_0x839e('0x11')](_0x839e('0xc'),auth[_0x839e('0xd')](),controller[_0x839e('0x12')]);module[_0x839e('0x13')]=router; \ No newline at end of file +var _0xe047=['update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','index','/:id','isAuthenticated','post','create','put'];(function(_0xfb42e6,_0x5f5d4b){var _0x27265b=function(_0x163e81){while(--_0x163e81){_0xfb42e6['push'](_0xfb42e6['shift']());}};_0x27265b(++_0x5f5d4b);}(_0xe047,0x1f2));var _0x7e04=function(_0x53f1bc,_0x38e4a3){_0x53f1bc=_0x53f1bc-0x0;var _0x5507cf=_0xe047[_0x53f1bc];return _0x5507cf;};'use strict';var multer=require(_0x7e04('0x0'));var util=require(_0x7e04('0x1'));var path=require(_0x7e04('0x2'));var timeout=require('connect-timeout');var express=require(_0x7e04('0x3'));var router=express['Router']();var fs_extra=require(_0x7e04('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7e04('0x5'));var config=require(_0x7e04('0x6'));var controller=require(_0x7e04('0x7'));router[_0x7e04('0x8')]('/',auth['isAuthenticated'](),controller[_0x7e04('0x9')]);router[_0x7e04('0x8')](_0x7e04('0xa'),auth[_0x7e04('0xb')](),controller['show']);router[_0x7e04('0xc')]('/',auth[_0x7e04('0xb')](),controller[_0x7e04('0xd')]);router[_0x7e04('0xe')](_0x7e04('0xa'),auth['isAuthenticated'](),controller[_0x7e04('0xf')]);router[_0x7e04('0x10')](_0x7e04('0xa'),auth['isAuthenticated'](),controller[_0x7e04('0x11')]);module[_0x7e04('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 97b2575..993a57d 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 _0x6300=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x6300,0xda));var _0x0630=function(_0x5089c6,_0x2a25e7){_0x5089c6=_0x5089c6-0x0;var _0x499919=_0x6300[_0x5089c6];return _0x499919;};'use strict';var Sequelize=require(_0x0630('0x0'));module[_0x0630('0x1')]={'type':{'type':Sequelize[_0x0630('0x2')](_0x0630('0x3'),_0x0630('0x4'),_0x0630('0x5'),_0x0630('0x6'),'picklist'),'defaultValue':_0x0630('0x3')},'content':{'type':Sequelize[_0x0630('0x7')]},'key':{'type':Sequelize[_0x0630('0x7')]},'keyType':{'type':Sequelize[_0x0630('0x2')](_0x0630('0x3'),'variable',_0x0630('0x5'))},'keyContent':{'type':Sequelize[_0x0630('0x7')]},'idField':{'type':Sequelize[_0x0630('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0630('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0630('0x7')]}}; \ No newline at end of file +var _0x3536=['ENUM','string','keyValue','STRING','variable','customVariable','BOOLEAN'];(function(_0x2ae70f,_0x5ae060){var _0x2cbaf2=function(_0x27c557){while(--_0x27c557){_0x2ae70f['push'](_0x2ae70f['shift']());}};_0x2cbaf2(++_0x5ae060);}(_0x3536,0x1d5));var _0x6353=function(_0x30658b,_0x1795e4){_0x30658b=_0x30658b-0x0;var _0x4e015e=_0x3536[_0x30658b];return _0x4e015e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x6353('0x0')](_0x6353('0x1'),'variable','customVariable',_0x6353('0x2'),'picklist'),'defaultValue':_0x6353('0x1')},'content':{'type':Sequelize[_0x6353('0x3')]},'key':{'type':Sequelize[_0x6353('0x3')]},'keyType':{'type':Sequelize['ENUM'](_0x6353('0x1'),_0x6353('0x4'),_0x6353('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6353('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6353('0x3')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index d2537c7..f868493 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 _0x8641=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','VtigerField','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','include','options','find','create','body','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x5d1855,_0x56fb10){var _0x459fd5=function(_0x57b71d){while(--_0x57b71d){_0x5d1855['push'](_0x5d1855['shift']());}};_0x459fd5(++_0x56fb10);}(_0x8641,0x113));var _0x1864=function(_0x284a61,_0x231686){_0x284a61=_0x284a61-0x0;var _0x220e3c=_0x8641[_0x284a61];return _0x220e3c;};'use strict';var emlformat=require(_0x1864('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1864('0x1'));var rp=require('request-promise');var moment=require(_0x1864('0x2'));var BPromise=require(_0x1864('0x3'));var Mustache=require(_0x1864('0x4'));var util=require(_0x1864('0x5'));var path=require(_0x1864('0x6'));var sox=require(_0x1864('0x7'));var csv=require(_0x1864('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1864('0x9'));var _=require(_0x1864('0xa'));var squel=require(_0x1864('0xb'));var crypto=require(_0x1864('0xc'));var jsforce=require(_0x1864('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1864('0x8'));var querystring=require(_0x1864('0xe'));var Papa=require(_0x1864('0xf'));var Redis=require(_0x1864('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1864('0x11'));var as=require(_0x1864('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1864('0x13'));var utils=require(_0x1864('0x14'));var config=require(_0x1864('0x15'));var licenseUtil=require(_0x1864('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x134477,_0x4b0d8c){_0x4b0d8c=_0x4b0d8c||0xcc;return function(_0x373020){if(_0x373020){return _0x134477[_0x1864('0x17')](_0x4b0d8c);}return _0x134477[_0x1864('0x18')](_0x4b0d8c)[_0x1864('0x19')]();};}function respondWithResult(_0x131cf0,_0x3013f2){_0x3013f2=_0x3013f2||0xc8;return function(_0x29a365){if(_0x29a365){return _0x131cf0[_0x1864('0x18')](_0x3013f2)['json'](_0x29a365);}};}function respondWithFilteredResult(_0x4ef066,_0x3a8cc4){return function(_0x50ddb7){if(_0x50ddb7){var _0x3752d8=typeof _0x3a8cc4[_0x1864('0x1a')]===_0x1864('0x1b')&&typeof _0x3a8cc4['limit']===_0x1864('0x1b');var _0x3cff22=_0x50ddb7[_0x1864('0x1c')];var _0x5ee68d=_0x3752d8?0x0:_0x3a8cc4[_0x1864('0x1a')];var _0x4059f1=_0x3752d8?_0x50ddb7[_0x1864('0x1c')]:_0x3a8cc4[_0x1864('0x1a')]+_0x3a8cc4[_0x1864('0x1d')];var _0x1e13df;if(_0x4059f1>=_0x3cff22){_0x4059f1=_0x3cff22;_0x1e13df=0xc8;}else{_0x1e13df=0xce;}_0x4ef066[_0x1864('0x18')](_0x1e13df);return _0x4ef066[_0x1864('0x1e')]('Content-Range',_0x5ee68d+'-'+_0x4059f1+'/'+_0x3cff22)[_0x1864('0x1f')](_0x50ddb7);}return null;};}function patchUpdates(_0x321950){return function(_0x377e22){try{jsonpatch[_0x1864('0x20')](_0x377e22,_0x321950,!![]);}catch(_0x4492f3){return BPromise[_0x1864('0x21')](_0x4492f3);}return _0x377e22[_0x1864('0x22')]();};}function saveUpdates(_0x42f88e,_0x627fc0){return function(_0x1bf2d8){if(_0x1bf2d8){return _0x1bf2d8[_0x1864('0x23')](_0x42f88e)[_0x1864('0x24')](function(_0x2f9dcd){return _0x2f9dcd;});}return null;};}function removeEntity(_0x1146b5,_0x5d13b2){return function(_0xf7931d){if(_0xf7931d){return _0xf7931d[_0x1864('0x25')]()['then'](function(){_0x1146b5[_0x1864('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43aeff,_0x5a1ad9){return function(_0x208554){if(!_0x208554){_0x43aeff[_0x1864('0x17')](0x194);}return _0x208554;};}function handleError(_0x571f41,_0x33eed5){_0x33eed5=_0x33eed5||0x1f4;return function(_0x9d8d05){logger[_0x1864('0x26')](_0x9d8d05[_0x1864('0x27')]);if(_0x9d8d05[_0x1864('0x28')]){delete _0x9d8d05[_0x1864('0x28')];}_0x571f41[_0x1864('0x18')](_0x33eed5)[_0x1864('0x29')](_0x9d8d05);};}exports[_0x1864('0x2a')]=function(_0xff74b,_0x20d89d){var _0x4b436b={},_0x19ab96={},_0x352e68={'count':0x0,'rows':[]};var _0x13b0dd=_['map'](db[_0x1864('0x2b')]['rawAttributes'],function(_0x3bf436){return{'name':_0x3bf436[_0x1864('0x2c')],'type':_0x3bf436['type'][_0x1864('0x2d')]};});_0x19ab96[_0x1864('0x2e')]=_[_0x1864('0x2f')](_0x13b0dd,_0x1864('0x28'));_0x19ab96[_0x1864('0x30')]=_[_0x1864('0x31')](_0xff74b[_0x1864('0x30')]);_0x19ab96[_0x1864('0x32')]=_[_0x1864('0x33')](_0x19ab96[_0x1864('0x2e')],_0x19ab96[_0x1864('0x30')]);_0x4b436b[_0x1864('0x34')]=_[_0x1864('0x33')](_0x19ab96[_0x1864('0x2e')],qs[_0x1864('0x35')](_0xff74b[_0x1864('0x30')][_0x1864('0x35')]));_0x4b436b[_0x1864('0x34')]=_0x4b436b['attributes'][_0x1864('0x36')]?_0x4b436b['attributes']:_0x19ab96[_0x1864('0x2e')];if(!_0xff74b[_0x1864('0x30')][_0x1864('0x37')]('nolimit')){_0x4b436b[_0x1864('0x1d')]=qs[_0x1864('0x1d')](_0xff74b[_0x1864('0x30')][_0x1864('0x1d')]);_0x4b436b[_0x1864('0x1a')]=qs[_0x1864('0x1a')](_0xff74b[_0x1864('0x30')][_0x1864('0x1a')]);}_0x4b436b[_0x1864('0x38')]=qs[_0x1864('0x39')](_0xff74b[_0x1864('0x30')][_0x1864('0x39')]);_0x4b436b[_0x1864('0x3a')]=qs[_0x1864('0x32')](_[_0x1864('0x3b')](_0xff74b[_0x1864('0x30')],_0x19ab96[_0x1864('0x32')]),_0x13b0dd);if(_0xff74b['query'][_0x1864('0x3c')]){_0x4b436b['where']=_[_0x1864('0x3d')](_0x4b436b['where'],{'$or':_[_0x1864('0x2f')](_0x13b0dd,function(_0x319c50){if(_0x319c50['type']!==_0x1864('0x3e')){var _0x3ca5e6={};_0x3ca5e6[_0x319c50['name']]={'$like':'%'+_0xff74b['query'][_0x1864('0x3c')]+'%'};return _0x3ca5e6;}})});}_0x4b436b=_[_0x1864('0x3d')]({},_0x4b436b,_0xff74b['options']);var _0x1c4ca2={'where':_0x4b436b[_0x1864('0x3a')]};return db[_0x1864('0x2b')][_0x1864('0x1c')](_0x1c4ca2)[_0x1864('0x24')](function(_0x13b761){_0x352e68['count']=_0x13b761;if(_0xff74b[_0x1864('0x30')][_0x1864('0x3f')]){_0x4b436b['include']=[{'all':!![]}];}return db['VtigerField'][_0x1864('0x40')](_0x4b436b);})[_0x1864('0x24')](function(_0x449d10){_0x352e68[_0x1864('0x41')]=_0x449d10;return _0x352e68;})[_0x1864('0x24')](respondWithFilteredResult(_0x20d89d,_0x4b436b))[_0x1864('0x42')](handleError(_0x20d89d,null));};exports['show']=function(_0x4a1142,_0x292b51){var _0x19dba0={'raw':!![],'where':{'id':_0x4a1142[_0x1864('0x43')]['id']}},_0x13ba1c={};_0x13ba1c[_0x1864('0x2e')]=_[_0x1864('0x31')](db[_0x1864('0x2b')]['rawAttributes']);_0x13ba1c['query']=_[_0x1864('0x31')](_0x4a1142[_0x1864('0x30')]);_0x13ba1c[_0x1864('0x32')]=_[_0x1864('0x33')](_0x13ba1c[_0x1864('0x2e')],_0x13ba1c['query']);_0x19dba0[_0x1864('0x34')]=_[_0x1864('0x33')](_0x13ba1c[_0x1864('0x2e')],qs[_0x1864('0x35')](_0x4a1142[_0x1864('0x30')][_0x1864('0x35')]));_0x19dba0[_0x1864('0x34')]=_0x19dba0['attributes'][_0x1864('0x36')]?_0x19dba0[_0x1864('0x34')]:_0x13ba1c[_0x1864('0x2e')];if(_0x4a1142[_0x1864('0x30')][_0x1864('0x3f')]){_0x19dba0[_0x1864('0x44')]=[{'all':!![]}];}_0x19dba0=_[_0x1864('0x3d')]({},_0x19dba0,_0x4a1142[_0x1864('0x45')]);return db[_0x1864('0x2b')][_0x1864('0x46')](_0x19dba0)[_0x1864('0x24')](handleEntityNotFound(_0x292b51,null))[_0x1864('0x24')](respondWithResult(_0x292b51,null))[_0x1864('0x42')](handleError(_0x292b51,null));};exports['create']=function(_0x3a404e,_0x5f2ffb){return db[_0x1864('0x2b')][_0x1864('0x47')](_0x3a404e['body'],{})[_0x1864('0x24')](respondWithResult(_0x5f2ffb,0xc9))[_0x1864('0x42')](handleError(_0x5f2ffb,null));};exports['update']=function(_0x2e83d8,_0x5a0106){if(_0x2e83d8[_0x1864('0x48')]['id']){delete _0x2e83d8[_0x1864('0x48')]['id'];}return db[_0x1864('0x2b')][_0x1864('0x46')]({'where':{'id':_0x2e83d8['params']['id']}})['then'](handleEntityNotFound(_0x5a0106,null))[_0x1864('0x24')](saveUpdates(_0x2e83d8[_0x1864('0x48')],null))['then'](respondWithResult(_0x5a0106,null))['catch'](handleError(_0x5a0106,null));};exports[_0x1864('0x25')]=function(_0x508948,_0x50b3fb){return db[_0x1864('0x2b')]['find']({'where':{'id':_0x508948[_0x1864('0x43')]['id']}})[_0x1864('0x24')](handleEntityNotFound(_0x50b3fb,null))[_0x1864('0x24')](removeEntity(_0x50b3fb,null))[_0x1864('0x42')](handleError(_0x50b3fb,null));}; \ No newline at end of file +var _0x5be7=['save','update','then','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','keys','includeAll','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','reject'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x5be7,0x1ba));var _0x75be=function(_0x15f80e,_0x28a721){_0x15f80e=_0x15f80e-0x0;var _0x4c8a21=_0x5be7[_0x15f80e];return _0x4c8a21;};'use strict';var emlformat=require(_0x75be('0x0'));var rimraf=require(_0x75be('0x1'));var zipdir=require(_0x75be('0x2'));var jsonpatch=require(_0x75be('0x3'));var rp=require(_0x75be('0x4'));var moment=require(_0x75be('0x5'));var BPromise=require(_0x75be('0x6'));var Mustache=require(_0x75be('0x7'));var util=require(_0x75be('0x8'));var path=require(_0x75be('0x9'));var sox=require(_0x75be('0xa'));var csv=require(_0x75be('0xb'));var ejs=require(_0x75be('0xc'));var fs=require('fs');var fs_extra=require(_0x75be('0xd'));var _=require(_0x75be('0xe'));var squel=require('squel');var crypto=require(_0x75be('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x75be('0x10'));var toCsv=require(_0x75be('0xb'));var querystring=require(_0x75be('0x11'));var Papa=require(_0x75be('0x12'));var Redis=require(_0x75be('0x13'));var authService=require(_0x75be('0x14'));var qs=require(_0x75be('0x15'));var as=require(_0x75be('0x16'));var hardwareService=require(_0x75be('0x17'));var logger=require(_0x75be('0x18'))(_0x75be('0x19'));var utils=require(_0x75be('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x75be('0x1b'))['db'];function respondWithStatusCode(_0x44040e,_0x218521){_0x218521=_0x218521||0xcc;return function(_0x2310a9){if(_0x2310a9){return _0x44040e[_0x75be('0x1c')](_0x218521);}return _0x44040e[_0x75be('0x1d')](_0x218521)[_0x75be('0x1e')]();};}function respondWithResult(_0x2c76bf,_0x37aaab){_0x37aaab=_0x37aaab||0xc8;return function(_0x3372d6){if(_0x3372d6){return _0x2c76bf['status'](_0x37aaab)['json'](_0x3372d6);}};}function respondWithFilteredResult(_0x1b0815,_0x35e4d4){return function(_0x1c67d6){if(_0x1c67d6){var _0x229e91=typeof _0x35e4d4[_0x75be('0x1f')]==='undefined'&&typeof _0x35e4d4[_0x75be('0x20')]===_0x75be('0x21');var _0x4a19ff=_0x1c67d6[_0x75be('0x22')];var _0x4d356d=_0x229e91?0x0:_0x35e4d4[_0x75be('0x1f')];var _0x2b99eb=_0x229e91?_0x1c67d6[_0x75be('0x22')]:_0x35e4d4[_0x75be('0x1f')]+_0x35e4d4[_0x75be('0x20')];var _0xcfbc2e;if(_0x2b99eb>=_0x4a19ff){_0x2b99eb=_0x4a19ff;_0xcfbc2e=0xc8;}else{_0xcfbc2e=0xce;}_0x1b0815[_0x75be('0x1d')](_0xcfbc2e);return _0x1b0815[_0x75be('0x23')]('Content-Range',_0x4d356d+'-'+_0x2b99eb+'/'+_0x4a19ff)[_0x75be('0x24')](_0x1c67d6);}return null;};}function patchUpdates(_0x470d57){return function(_0x23d8b9){try{jsonpatch['apply'](_0x23d8b9,_0x470d57,!![]);}catch(_0x24e151){return BPromise[_0x75be('0x25')](_0x24e151);}return _0x23d8b9[_0x75be('0x26')]();};}function saveUpdates(_0x5eac27,_0x258d49){return function(_0x44b9a8){if(_0x44b9a8){return _0x44b9a8[_0x75be('0x27')](_0x5eac27)[_0x75be('0x28')](function(_0x5b7f64){return _0x5b7f64;});}return null;};}function removeEntity(_0x58f458,_0x141b93){return function(_0xb36c5f){if(_0xb36c5f){return _0xb36c5f[_0x75be('0x29')]()[_0x75be('0x28')](function(){_0x58f458['status'](0xcc)[_0x75be('0x1e')]();});}};}function handleEntityNotFound(_0x2e1449,_0x41f3d5){return function(_0x45bb21){if(!_0x45bb21){_0x2e1449[_0x75be('0x1c')](0x194);}return _0x45bb21;};}function handleError(_0x473707,_0x2428e2){_0x2428e2=_0x2428e2||0x1f4;return function(_0x42f268){logger[_0x75be('0x2a')](_0x42f268[_0x75be('0x2b')]);if(_0x42f268[_0x75be('0x2c')]){delete _0x42f268[_0x75be('0x2c')];}_0x473707[_0x75be('0x1d')](_0x2428e2)[_0x75be('0x2d')](_0x42f268);};}exports[_0x75be('0x2e')]=function(_0x900241,_0x1bc9a4){var _0x4ef9f9={},_0x557989={},_0x575efb={'count':0x0,'rows':[]};var _0x59d97b=_[_0x75be('0x2f')](db[_0x75be('0x30')][_0x75be('0x31')],function(_0x5e76f8){return{'name':_0x5e76f8[_0x75be('0x32')],'type':_0x5e76f8[_0x75be('0x33')][_0x75be('0x34')]};});_0x557989[_0x75be('0x35')]=_[_0x75be('0x2f')](_0x59d97b,_0x75be('0x2c'));_0x557989['query']=_['keys'](_0x900241[_0x75be('0x36')]);_0x557989[_0x75be('0x37')]=_[_0x75be('0x38')](_0x557989[_0x75be('0x35')],_0x557989[_0x75be('0x36')]);_0x4ef9f9['attributes']=_[_0x75be('0x38')](_0x557989['model'],qs[_0x75be('0x39')](_0x900241[_0x75be('0x36')][_0x75be('0x39')]));_0x4ef9f9[_0x75be('0x3a')]=_0x4ef9f9[_0x75be('0x3a')][_0x75be('0x3b')]?_0x4ef9f9[_0x75be('0x3a')]:_0x557989[_0x75be('0x35')];if(!_0x900241[_0x75be('0x36')][_0x75be('0x3c')](_0x75be('0x3d'))){_0x4ef9f9['limit']=qs[_0x75be('0x20')](_0x900241['query'][_0x75be('0x20')]);_0x4ef9f9[_0x75be('0x1f')]=qs[_0x75be('0x1f')](_0x900241[_0x75be('0x36')][_0x75be('0x1f')]);}_0x4ef9f9[_0x75be('0x3e')]=qs[_0x75be('0x3f')](_0x900241[_0x75be('0x36')][_0x75be('0x3f')]);_0x4ef9f9[_0x75be('0x40')]=qs[_0x75be('0x37')](_[_0x75be('0x41')](_0x900241[_0x75be('0x36')],_0x557989[_0x75be('0x37')]),_0x59d97b);if(_0x900241[_0x75be('0x36')][_0x75be('0x42')]){_0x4ef9f9[_0x75be('0x40')]=_[_0x75be('0x43')](_0x4ef9f9[_0x75be('0x40')],{'$or':_['map'](_0x59d97b,function(_0x48c039){if(_0x48c039['type']!==_0x75be('0x44')){var _0x1d2ff7={};_0x1d2ff7[_0x48c039['name']]={'$like':'%'+_0x900241['query'][_0x75be('0x42')]+'%'};return _0x1d2ff7;}})});}_0x4ef9f9=_[_0x75be('0x43')]({},_0x4ef9f9,_0x900241[_0x75be('0x45')]);var _0x4aa23e={'where':_0x4ef9f9[_0x75be('0x40')]};return db[_0x75be('0x30')]['count'](_0x4aa23e)[_0x75be('0x28')](function(_0x16aa71){_0x575efb[_0x75be('0x22')]=_0x16aa71;if(_0x900241[_0x75be('0x36')]['includeAll']){_0x4ef9f9[_0x75be('0x46')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x4ef9f9);})['then'](function(_0x4b0642){_0x575efb[_0x75be('0x47')]=_0x4b0642;return _0x575efb;})[_0x75be('0x28')](respondWithFilteredResult(_0x1bc9a4,_0x4ef9f9))[_0x75be('0x48')](handleError(_0x1bc9a4,null));};exports[_0x75be('0x49')]=function(_0x1a9565,_0x797678){var _0x587b0d={'raw':!![],'where':{'id':_0x1a9565[_0x75be('0x4a')]['id']}},_0x3ff2c2={};_0x3ff2c2['model']=_[_0x75be('0x4b')](db['VtigerField'][_0x75be('0x31')]);_0x3ff2c2[_0x75be('0x36')]=_[_0x75be('0x4b')](_0x1a9565[_0x75be('0x36')]);_0x3ff2c2['filters']=_['intersection'](_0x3ff2c2[_0x75be('0x35')],_0x3ff2c2[_0x75be('0x36')]);_0x587b0d[_0x75be('0x3a')]=_[_0x75be('0x38')](_0x3ff2c2['model'],qs['fields'](_0x1a9565['query'][_0x75be('0x39')]));_0x587b0d[_0x75be('0x3a')]=_0x587b0d[_0x75be('0x3a')][_0x75be('0x3b')]?_0x587b0d['attributes']:_0x3ff2c2['model'];if(_0x1a9565['query'][_0x75be('0x4c')]){_0x587b0d[_0x75be('0x46')]=[{'all':!![]}];}_0x587b0d=_[_0x75be('0x43')]({},_0x587b0d,_0x1a9565[_0x75be('0x45')]);return db[_0x75be('0x30')]['find'](_0x587b0d)[_0x75be('0x28')](handleEntityNotFound(_0x797678,null))[_0x75be('0x28')](respondWithResult(_0x797678,null))[_0x75be('0x48')](handleError(_0x797678,null));};exports[_0x75be('0x4d')]=function(_0x1c18a3,_0x2f4454){return db['VtigerField'][_0x75be('0x4d')](_0x1c18a3[_0x75be('0x4e')],{})[_0x75be('0x28')](respondWithResult(_0x2f4454,0xc9))[_0x75be('0x48')](handleError(_0x2f4454,null));};exports[_0x75be('0x27')]=function(_0xaec2b7,_0x1bbcc8){if(_0xaec2b7['body']['id']){delete _0xaec2b7[_0x75be('0x4e')]['id'];}return db[_0x75be('0x30')][_0x75be('0x4f')]({'where':{'id':_0xaec2b7[_0x75be('0x4a')]['id']}})[_0x75be('0x28')](handleEntityNotFound(_0x1bbcc8,null))[_0x75be('0x28')](saveUpdates(_0xaec2b7[_0x75be('0x4e')],null))[_0x75be('0x28')](respondWithResult(_0x1bbcc8,null))['catch'](handleError(_0x1bbcc8,null));};exports[_0x75be('0x29')]=function(_0x5ad3f9,_0x4b0ebc){return db[_0x75be('0x30')][_0x75be('0x4f')]({'where':{'id':_0x5ad3f9[_0x75be('0x4a')]['id']}})[_0x75be('0x28')](handleEntityNotFound(_0x4b0ebc,null))['then'](removeEntity(_0x4b0ebc,null))['catch'](handleError(_0x4b0ebc,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 17156bd..b2a997c 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 _0xda86=['vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xda86,0x183));var _0x6da8=function(_0x2197c7,_0x4f4e93){_0x2197c7=_0x2197c7-0x0;var _0x1bb413=_0xda86[_0x2197c7];return _0x1bb413;};'use strict';var _=require(_0x6da8('0x0'));var util=require(_0x6da8('0x1'));var logger=require(_0x6da8('0x2'))('api');var moment=require(_0x6da8('0x3'));var BPromise=require(_0x6da8('0x4'));var rp=require(_0x6da8('0x5'));var fs=require('fs');var path=require(_0x6da8('0x6'));var rimraf=require(_0x6da8('0x7'));var config=require(_0x6da8('0x8'));var attributes=require(_0x6da8('0x9'));module[_0x6da8('0xa')]=function(_0x539d2c,_0x22e94a){return _0x539d2c[_0x6da8('0xb')](_0x6da8('0xc'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x6da8('0xd'),'fields':[_0x6da8('0xe'),_0x6da8('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x19cd=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerField.attributes','exports','define','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash'];(function(_0x5d0746,_0x511b2d){var _0x19a392=function(_0x111382){while(--_0x111382){_0x5d0746['push'](_0x5d0746['shift']());}};_0x19a392(++_0x511b2d);}(_0x19cd,0x1cf));var _0xd19c=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x19cd[_0x369151];return _0x4292d5;};'use strict';var _=require(_0xd19c('0x0'));var util=require(_0xd19c('0x1'));var logger=require(_0xd19c('0x2'))(_0xd19c('0x3'));var moment=require(_0xd19c('0x4'));var BPromise=require(_0xd19c('0x5'));var rp=require(_0xd19c('0x6'));var fs=require('fs');var path=require(_0xd19c('0x7'));var rimraf=require('rimraf');var config=require(_0xd19c('0x8'));var attributes=require(_0xd19c('0x9'));module[_0xd19c('0xa')]=function(_0x55e88b,_0x1915a6){return _0x55e88b[_0xd19c('0xb')]('VtigerField',attributes,{'tableName':_0xd19c('0xc'),'paranoid':![],'indexes':[{'name':_0xd19c('0xd'),'fields':[_0xd19c('0xe'),_0xd19c('0xf')],'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 153499c..6d7b1bb 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 _0xb1d2=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash'];(function(_0x58ed21,_0x52c24b){var _0x2ef891=function(_0x668ad0){while(--_0x668ad0){_0x58ed21['push'](_0x58ed21['shift']());}};_0x2ef891(++_0x52c24b);}(_0xb1d2,0xdf));var _0x2b1d=function(_0x1ed64c,_0x47a758){_0x1ed64c=_0x1ed64c-0x0;var _0x3611ec=_0xb1d2[_0x1ed64c];return _0x3611ec;};'use strict';var _=require(_0x2b1d('0x0'));var util=require('util');var moment=require(_0x2b1d('0x1'));var BPromise=require(_0x2b1d('0x2'));var rs=require(_0x2b1d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b1d('0x4'))['db'];var utils=require(_0x2b1d('0x5'));var logger=require('../../config/logger')(_0x2b1d('0x6'));var config=require('../../config/environment');var jayson=require(_0x2b1d('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x12e17b,_0x3130e6,_0x430d28){return new BPromise(function(_0x38c1e6,_0x311a0c){return client['request'](_0x12e17b,_0x430d28)['then'](function(_0x312943){logger[_0x2b1d('0x8')](_0x2b1d('0x9'),_0x3130e6,_0x2b1d('0xa'));logger[_0x2b1d('0xb')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x3130e6,'request\x20sent',JSON['stringify'](_0x312943));if(_0x312943[_0x2b1d('0xc')]){if(_0x312943[_0x2b1d('0xc')][_0x2b1d('0xd')]===0x1f4){logger['error'](_0x2b1d('0x9'),_0x3130e6,_0x312943[_0x2b1d('0xc')][_0x2b1d('0xe')]);return _0x311a0c(_0x312943['error'][_0x2b1d('0xe')]);}logger[_0x2b1d('0xc')](_0x2b1d('0x9'),_0x3130e6,_0x312943[_0x2b1d('0xc')][_0x2b1d('0xe')]);return _0x38c1e6(_0x312943[_0x2b1d('0xc')][_0x2b1d('0xe')]);}else{logger[_0x2b1d('0x8')](_0x2b1d('0x9'),_0x3130e6,_0x2b1d('0xa'));_0x38c1e6(_0x312943[_0x2b1d('0xf')]['message']);}})['catch'](function(_0x3e5d54){logger[_0x2b1d('0xc')](_0x2b1d('0x9'),_0x3130e6,_0x3e5d54);_0x311a0c(_0x3e5d54);});});} \ No newline at end of file +var _0x6504=['ioredis','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','code','error','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x30f53a,_0x55acf8){var _0x24fd11=function(_0x4e2626){while(--_0x4e2626){_0x30f53a['push'](_0x30f53a['shift']());}};_0x24fd11(++_0x55acf8);}(_0x6504,0x176));var _0x4650=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6504[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4650('0x0'));var util=require('util');var moment=require(_0x4650('0x1'));var BPromise=require(_0x4650('0x2'));var rs=require(_0x4650('0x3'));var fs=require('fs');var Redis=require(_0x4650('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4650('0x5'));var logger=require(_0x4650('0x6'))(_0x4650('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4650('0x8')][_0x4650('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3df10e,_0x349dd6,_0x57d950){return new BPromise(function(_0x5e799a,_0x560056){return client['request'](_0x3df10e,_0x57d950)[_0x4650('0xa')](function(_0xe140db){logger[_0x4650('0xb')]('VtigerField,\x20%s,\x20%s',_0x349dd6,_0x4650('0xc'));logger[_0x4650('0xd')](_0x4650('0xe'),_0x349dd6,_0x4650('0xc'),JSON['stringify'](_0xe140db));if(_0xe140db['error']){if(_0xe140db['error'][_0x4650('0xf')]===0x1f4){logger[_0x4650('0x10')](_0x4650('0x11'),_0x349dd6,_0xe140db[_0x4650('0x10')][_0x4650('0x12')]);return _0x560056(_0xe140db['error']['message']);}logger[_0x4650('0x10')](_0x4650('0x11'),_0x349dd6,_0xe140db[_0x4650('0x10')][_0x4650('0x12')]);return _0x5e799a(_0xe140db[_0x4650('0x10')][_0x4650('0x12')]);}else{logger[_0x4650('0xb')](_0x4650('0x11'),_0x349dd6,'request\x20sent');_0x5e799a(_0xe140db[_0x4650('0x13')][_0x4650('0x12')]);}})[_0x4650('0x14')](function(_0x3c0a58){logger[_0x4650('0x10')](_0x4650('0x11'),_0x349dd6,_0x3c0a58);_0x560056(_0x3c0a58);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 9370a25..a83f550 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 _0x794e=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index','show','get','/:id/configurations','post','create','update','delete','/:id','exports','multer','util','path'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0x794e,0xba));var _0xe794=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x794e[_0x55abd9];return _0x3e5669;};'use strict';var multer=require(_0xe794('0x0'));var util=require(_0xe794('0x1'));var path=require(_0xe794('0x2'));var timeout=require(_0xe794('0x3'));var express=require(_0xe794('0x4'));var router=express[_0xe794('0x5')]();var fs_extra=require(_0xe794('0x6'));var auth=require(_0xe794('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe794('0x8'));var controller=require(_0xe794('0x9'));router['get']('/',auth[_0xe794('0xa')](),controller[_0xe794('0xb')]);router['get']('/:id',auth[_0xe794('0xa')](),controller[_0xe794('0xc')]);router[_0xe794('0xd')](_0xe794('0xe'),auth[_0xe794('0xa')](),controller['getConfigurations']);router[_0xe794('0xd')]('/:id/fields',auth[_0xe794('0xa')](),controller['getFields']);router[_0xe794('0xf')]('/',auth[_0xe794('0xa')](),controller[_0xe794('0x10')]);router[_0xe794('0xf')]('/:id/configurations',auth[_0xe794('0xa')](),controller['addConfiguration']);router['put']('/:id',auth[_0xe794('0xa')](),controller[_0xe794('0x11')]);router[_0xe794('0x12')](_0xe794('0x13'),auth[_0xe794('0xa')](),controller['destroy']);module[_0xe794('0x14')]=router; \ No newline at end of file +var _0xf35c=['show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index'];(function(_0x5e5eb4,_0x4d0090){var _0x41b074=function(_0x1f1744){while(--_0x1f1744){_0x5e5eb4['push'](_0x5e5eb4['shift']());}};_0x41b074(++_0x4d0090);}(_0xf35c,0x1d9));var _0xcf35=function(_0xdd6f7f,_0x3f6265){_0xdd6f7f=_0xdd6f7f-0x0;var _0xa10222=_0xf35c[_0xdd6f7f];return _0xa10222;};'use strict';var multer=require(_0xcf35('0x0'));var util=require(_0xcf35('0x1'));var path=require(_0xcf35('0x2'));var timeout=require(_0xcf35('0x3'));var express=require(_0xcf35('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcf35('0x5'));var interaction=require(_0xcf35('0x6'));var config=require('../../config/environment');var controller=require(_0xcf35('0x7'));router[_0xcf35('0x8')]('/',auth[_0xcf35('0x9')](),controller[_0xcf35('0xa')]);router[_0xcf35('0x8')]('/:id',auth[_0xcf35('0x9')](),controller[_0xcf35('0xb')]);router[_0xcf35('0x8')]('/:id/configurations',auth[_0xcf35('0x9')](),controller['getConfigurations']);router[_0xcf35('0x8')](_0xcf35('0xc'),auth[_0xcf35('0x9')](),controller[_0xcf35('0xd')]);router[_0xcf35('0xe')]('/',auth[_0xcf35('0x9')](),controller[_0xcf35('0xf')]);router[_0xcf35('0xe')](_0xcf35('0x10'),auth[_0xcf35('0x9')](),controller[_0xcf35('0x11')]);router[_0xcf35('0x12')](_0xcf35('0x13'),auth[_0xcf35('0x9')](),controller[_0xcf35('0x14')]);router['delete']('/:id',auth[_0xcf35('0x9')](),controller[_0xcf35('0x15')]);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 5cc9f24..0eb6c07 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 _0xdfb1=['token','password','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x12e1c9,_0x4f9027){var _0x12c781=function(_0x11a9e3){while(--_0x11a9e3){_0x12e1c9['push'](_0x12e1c9['shift']());}};_0x12c781(++_0x4f9027);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x1ba9f5,_0x58830e){_0x1ba9f5=_0x1ba9f5-0x0;var _0x2193bc=_0xdfb1[_0x1ba9f5];return _0x2193bc;};'use strict';var Sequelize=require(_0x1dfb('0x0'));module[_0x1dfb('0x1')]={'name':{'type':Sequelize[_0x1dfb('0x2')]},'description':{'type':Sequelize[_0x1dfb('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1dfb('0x3')},'password':{'type':Sequelize[_0x1dfb('0x2')]},'token':{'type':Sequelize[_0x1dfb('0x2')]},'remoteUri':{'type':Sequelize[_0x1dfb('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM']('password',_0x1dfb('0x4')),'defaultValue':_0x1dfb('0x5')},'serverUrl':{'type':Sequelize[_0x1dfb('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1dfb('0x6'),_0x1dfb('0x7')),'defaultValue':_0x1dfb('0x6')}}; \ No newline at end of file +var _0x430c=['ENUM','password','integrationTab','newTab','sequelize','STRING','username'];(function(_0x4deab5,_0x18b409){var _0x3f9516=function(_0x4b1665){while(--_0x4b1665){_0x4deab5['push'](_0x4deab5['shift']());}};_0x3f9516(++_0x18b409);}(_0x430c,0x1a1));var _0xc430=function(_0x42d2af,_0x3961b5){_0x42d2af=_0x42d2af-0x0;var _0x1d6d63=_0x430c[_0x42d2af];return _0x1d6d63;};'use strict';var Sequelize=require(_0xc430('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc430('0x1')]},'username':{'type':Sequelize[_0xc430('0x1')],'unique':_0xc430('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xc430('0x3')](_0xc430('0x4'),'token'),'defaultValue':_0xc430('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xc430('0x3')](_0xc430('0x5'),_0xc430('0x6')),'defaultValue':_0xc430('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 25dca51..2ce96e5 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 _0x3f8c=['%s/%s','headers','Basic\x20%s','%s:%s','toString','base64','token','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','remove','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','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','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','ZendeskAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','authType','remoteUri','substring','lastIndexOf','format'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3f8c,0x104));var _0xc3f8=function(_0x55b1f3,_0x357cbb){_0x55b1f3=_0x55b1f3-0x0;var _0x5c9690=_0x3f8c[_0x55b1f3];return _0x5c9690;};'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'];var integrations=require(_0xc3f8('0x16'));function respondWithStatusCode(_0x155c80,_0x511763){_0x511763=_0x511763||0xcc;return function(_0x84f489){if(_0x84f489){return _0x155c80[_0xc3f8('0x17')](_0x511763);}return _0x155c80[_0xc3f8('0x18')](_0x511763)[_0xc3f8('0x19')]();};}function respondWithResult(_0x6155e9,_0x47754c){_0x47754c=_0x47754c||0xc8;return function(_0x29e2b6){if(_0x29e2b6){return _0x6155e9[_0xc3f8('0x18')](_0x47754c)[_0xc3f8('0x1a')](_0x29e2b6);}};}function respondWithFilteredResult(_0x2fd8e8,_0x3cb28a){return function(_0x2a9f64){if(_0x2a9f64){var _0x29d031=typeof _0x3cb28a['offset']===_0xc3f8('0x1b')&&typeof _0x3cb28a['limit']==='undefined';var _0x3df137=_0x2a9f64[_0xc3f8('0x1c')];var _0x35500f=_0x29d031?0x0:_0x3cb28a[_0xc3f8('0x1d')];var _0x47a185=_0x29d031?_0x2a9f64[_0xc3f8('0x1c')]:_0x3cb28a[_0xc3f8('0x1d')]+_0x3cb28a['limit'];var _0xe14074;if(_0x47a185>=_0x3df137){_0x47a185=_0x3df137;_0xe14074=0xc8;}else{_0xe14074=0xce;}_0x2fd8e8['status'](_0xe14074);return _0x2fd8e8[_0xc3f8('0x1e')](_0xc3f8('0x1f'),_0x35500f+'-'+_0x47a185+'/'+_0x3df137)[_0xc3f8('0x1a')](_0x2a9f64);}return null;};}function patchUpdates(_0x53ada5){return function(_0x543dca){try{jsonpatch[_0xc3f8('0x20')](_0x543dca,_0x53ada5,!![]);}catch(_0x2a7096){return BPromise[_0xc3f8('0x21')](_0x2a7096);}return _0x543dca[_0xc3f8('0x22')]();};}function saveUpdates(_0x6522e9,_0x251bf7){return function(_0x43b2b4){if(_0x43b2b4){return _0x43b2b4[_0xc3f8('0x23')](_0x6522e9)['then'](function(_0x571f92){return _0x571f92;});}return null;};}function removeEntity(_0x4b83f0,_0x2559a4){return function(_0x5e1d14){if(_0x5e1d14){return _0x5e1d14[_0xc3f8('0x24')]()[_0xc3f8('0x25')](function(){_0x4b83f0['status'](0xcc)[_0xc3f8('0x19')]();});}};}function handleEntityNotFound(_0x327b2d,_0x2d237e){return function(_0xb883b5){if(!_0xb883b5){_0x327b2d[_0xc3f8('0x17')](0x194);}return _0xb883b5;};}function handleError(_0x9d43b4,_0xf1d460){_0xf1d460=_0xf1d460||0x1f4;return function(_0x7f14ad){logger[_0xc3f8('0x26')](_0x7f14ad[_0xc3f8('0x27')]);if(_0x7f14ad[_0xc3f8('0x28')]){delete _0x7f14ad[_0xc3f8('0x28')];}_0x9d43b4[_0xc3f8('0x18')](_0xf1d460)[_0xc3f8('0x29')](_0x7f14ad);};}exports['index']=function(_0x58b303,_0x2909f8){var _0x218029={},_0x5bf6e2={},_0x151bba={'count':0x0,'rows':[]};var _0x4d39a0=_[_0xc3f8('0x2a')](db[_0xc3f8('0x2b')]['rawAttributes'],function(_0x48b32e){return{'name':_0x48b32e[_0xc3f8('0x2c')],'type':_0x48b32e[_0xc3f8('0x2d')][_0xc3f8('0x2e')]};});_0x5bf6e2[_0xc3f8('0x2f')]=_[_0xc3f8('0x2a')](_0x4d39a0,_0xc3f8('0x28'));_0x5bf6e2[_0xc3f8('0x30')]=_[_0xc3f8('0x31')](_0x58b303[_0xc3f8('0x30')]);_0x5bf6e2[_0xc3f8('0x32')]=_['intersection'](_0x5bf6e2[_0xc3f8('0x2f')],_0x5bf6e2[_0xc3f8('0x30')]);_0x218029[_0xc3f8('0x33')]=_[_0xc3f8('0x34')](_0x5bf6e2[_0xc3f8('0x2f')],qs['fields'](_0x58b303['query'][_0xc3f8('0x35')]));_0x218029[_0xc3f8('0x33')]=_0x218029[_0xc3f8('0x33')][_0xc3f8('0x36')]?_0x218029[_0xc3f8('0x33')]:_0x5bf6e2['model'];if(!_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x37')](_0xc3f8('0x38'))){_0x218029['limit']=qs[_0xc3f8('0x39')](_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x39')]);_0x218029['offset']=qs[_0xc3f8('0x1d')](_0x58b303[_0xc3f8('0x30')]['offset']);}_0x218029[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3b')](_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x3b')]);_0x218029[_0xc3f8('0x3c')]=qs[_0xc3f8('0x32')](_['pick'](_0x58b303[_0xc3f8('0x30')],_0x5bf6e2[_0xc3f8('0x32')]),_0x4d39a0);if(_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x3d')]){_0x218029[_0xc3f8('0x3c')]=_['merge'](_0x218029[_0xc3f8('0x3c')],{'$or':_[_0xc3f8('0x2a')](_0x4d39a0,function(_0xaa4c98){if(_0xaa4c98['type']!==_0xc3f8('0x3e')){var _0x83b7ab={};_0x83b7ab[_0xaa4c98[_0xc3f8('0x28')]]={'$like':'%'+_0x58b303[_0xc3f8('0x30')]['filter']+'%'};return _0x83b7ab;}})});}_0x218029=_[_0xc3f8('0x3f')]({},_0x218029,_0x58b303[_0xc3f8('0x40')]);var _0x2df096={'where':_0x218029[_0xc3f8('0x3c')]};return db['ZendeskAccount'][_0xc3f8('0x1c')](_0x2df096)['then'](function(_0x5d144b){_0x151bba[_0xc3f8('0x1c')]=_0x5d144b;if(_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x41')]){_0x218029[_0xc3f8('0x42')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x218029);})[_0xc3f8('0x25')](function(_0x16805c){_0x151bba[_0xc3f8('0x43')]=_0x16805c;return _0x151bba;})[_0xc3f8('0x25')](respondWithFilteredResult(_0x2909f8,_0x218029))[_0xc3f8('0x44')](handleError(_0x2909f8,null));};exports[_0xc3f8('0x45')]=function(_0x3113b4,_0x45e6ea){var _0x13d8dc={'raw':![],'where':{'id':_0x3113b4[_0xc3f8('0x46')]['id']}},_0x34bccd={};_0x34bccd['model']=_[_0xc3f8('0x31')](db[_0xc3f8('0x2b')]['rawAttributes']);_0x34bccd[_0xc3f8('0x30')]=_[_0xc3f8('0x31')](_0x3113b4['query']);_0x34bccd[_0xc3f8('0x32')]=_[_0xc3f8('0x34')](_0x34bccd[_0xc3f8('0x2f')],_0x34bccd[_0xc3f8('0x30')]);_0x13d8dc[_0xc3f8('0x33')]=_[_0xc3f8('0x34')](_0x34bccd[_0xc3f8('0x2f')],qs[_0xc3f8('0x35')](_0x3113b4[_0xc3f8('0x30')][_0xc3f8('0x35')]));_0x13d8dc[_0xc3f8('0x33')]=_0x13d8dc['attributes'][_0xc3f8('0x36')]?_0x13d8dc[_0xc3f8('0x33')]:_0x34bccd['model'];if(_0x3113b4[_0xc3f8('0x30')][_0xc3f8('0x41')]){_0x13d8dc[_0xc3f8('0x42')]=[{'all':!![]}];}_0x13d8dc=_[_0xc3f8('0x3f')]({},_0x13d8dc,_0x3113b4['options']);return db['ZendeskAccount'][_0xc3f8('0x47')](_0x13d8dc)[_0xc3f8('0x25')](handleEntityNotFound(_0x45e6ea,null))[_0xc3f8('0x25')](respondWithResult(_0x45e6ea,null))['catch'](handleError(_0x45e6ea,null));};exports[_0xc3f8('0x48')]=function(_0x3a665e,_0x418961){return db[_0xc3f8('0x2b')][_0xc3f8('0x48')](_0x3a665e['body'],{})[_0xc3f8('0x25')](respondWithResult(_0x418961,0xc9))[_0xc3f8('0x44')](handleError(_0x418961,null));};exports['update']=function(_0x1becae,_0x3fcb6a){if(_0x1becae[_0xc3f8('0x49')]['id']){delete _0x1becae[_0xc3f8('0x49')]['id'];}return db[_0xc3f8('0x2b')][_0xc3f8('0x47')]({'where':{'id':_0x1becae[_0xc3f8('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fcb6a,null))[_0xc3f8('0x25')](saveUpdates(_0x1becae[_0xc3f8('0x49')],null))['then'](respondWithResult(_0x3fcb6a,null))[_0xc3f8('0x44')](handleError(_0x3fcb6a,null));};exports[_0xc3f8('0x24')]=function(_0x2448bf,_0x33e5c5){return db[_0xc3f8('0x2b')][_0xc3f8('0x47')]({'where':{'id':_0x2448bf[_0xc3f8('0x46')]['id']}})['then'](handleEntityNotFound(_0x33e5c5,null))[_0xc3f8('0x25')](removeEntity(_0x33e5c5,null))[_0xc3f8('0x44')](handleError(_0x33e5c5,null));};exports[_0xc3f8('0x4a')]=function(_0x267c95,_0x3e6c1d,_0x3d752a){var _0x97a88e={};var _0x920f4b={};var _0x4fc02c;var _0x51249a;return db[_0xc3f8('0x2b')][_0xc3f8('0x4b')]({'where':{'id':_0x267c95['params']['id']}})['then'](handleEntityNotFound(_0x3e6c1d,null))[_0xc3f8('0x25')](function(_0x4b4adb){if(_0x4b4adb){_0x4fc02c=_0x4b4adb;_0x920f4b[_0xc3f8('0x2f')]=_[_0xc3f8('0x31')](db[_0xc3f8('0x4c')]['rawAttributes']);_0x920f4b[_0xc3f8('0x30')]=_['keys'](_0x267c95['query']);_0x920f4b[_0xc3f8('0x32')]=_['intersection'](_0x920f4b[_0xc3f8('0x2f')],_0x920f4b[_0xc3f8('0x30')]);_0x97a88e[_0xc3f8('0x33')]=_['intersection'](_0x920f4b[_0xc3f8('0x2f')],qs[_0xc3f8('0x35')](_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x35')]));_0x97a88e[_0xc3f8('0x33')]=_0x97a88e['attributes']['length']?_0x97a88e[_0xc3f8('0x33')]:_0x920f4b[_0xc3f8('0x2f')];_0x97a88e[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3b')](_0x267c95[_0xc3f8('0x30')]['sort']);_0x97a88e[_0xc3f8('0x3c')]=qs['filters'](_[_0xc3f8('0x4d')](_0x267c95[_0xc3f8('0x30')],_0x920f4b[_0xc3f8('0x32')]));if(_0x267c95[_0xc3f8('0x30')]['filter']){_0x97a88e[_0xc3f8('0x3c')]=_['merge'](_0x97a88e['where'],{'$or':_['map'](_0x97a88e['attributes'],function(_0x12df02){var _0x143d50={};_0x143d50[_0x12df02]={'$like':'%'+_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x3d')]+'%'};return _0x143d50;})});}_0x97a88e=_[_0xc3f8('0x3f')]({},_0x97a88e,_0x267c95[_0xc3f8('0x40')]);return _0x4fc02c[_0xc3f8('0x4a')](_0x97a88e);}})[_0xc3f8('0x25')](function(_0x5250df){if(_0x5250df){_0x51249a=_0x5250df[_0xc3f8('0x36')];if(!_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x37')](_0xc3f8('0x38'))){_0x97a88e[_0xc3f8('0x39')]=qs['limit'](_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x39')]);_0x97a88e[_0xc3f8('0x1d')]=qs[_0xc3f8('0x1d')](_0x267c95[_0xc3f8('0x30')]['offset']);}return _0x4fc02c[_0xc3f8('0x4a')](_0x97a88e);}})[_0xc3f8('0x25')](function(_0x42b255){if(_0x42b255){return _0x42b255?{'count':_0x51249a,'rows':_0x42b255}:null;}})[_0xc3f8('0x25')](respondWithResult(_0x3e6c1d,null))[_0xc3f8('0x44')](handleError(_0x3e6c1d,null));};exports[_0xc3f8('0x4e')]=function(_0x56fd61,_0x2f199d,_0x4ca426){if(_0x56fd61[_0xc3f8('0x49')]['id']){delete _0x56fd61['body']['id'];}return db[_0xc3f8('0x2b')][_0xc3f8('0x4b')]({'where':{'id':_0x56fd61['params']['id']}})['then'](handleEntityNotFound(_0x2f199d,null))[_0xc3f8('0x25')](function(_0x2c7ab9){if(_0x2c7ab9){_0x56fd61['body'][_0xc3f8('0x4f')]=_0x2c7ab9['id'];_0x56fd61[_0xc3f8('0x49')][_0xc3f8('0x50')]=integrations[_0xc3f8('0x51')](_0x56fd61[_0xc3f8('0x49')][_0xc3f8('0x52')],_0x56fd61[_0xc3f8('0x49')][_0xc3f8('0x2d')]);_0x56fd61['body']['Descriptions']=integrations[_0xc3f8('0x53')](_0x56fd61['body']['channel'],_0x56fd61['body']['type']);return db['ZendeskConfiguration'][_0xc3f8('0x48')](_0x56fd61[_0xc3f8('0x49')],{'include':[{'model':db[_0xc3f8('0x54')],'as':_0xc3f8('0x50')},{'model':db['ZendeskField'],'as':_0xc3f8('0x55')}]});}return null;})[_0xc3f8('0x25')](respondWithResult(_0x2f199d,null))['catch'](handleError(_0x2f199d,null));};exports[_0xc3f8('0x56')]=function(_0x273faf,_0x104eec,_0x531de8){var _0xaedf89='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x273faf['params']['id']},'attributes':['id',_0xc3f8('0x57'),_0xc3f8('0x58'),'token',_0xc3f8('0x59'),_0xc3f8('0x5a')]})['then'](handleEntityNotFound(_0x104eec,null))[_0xc3f8('0x25')](function(_0x2f957a){if(_0x2f957a){_0xaedf89=_0x2f957a['remoteUri'];var _0x34edb9=_0xaedf89['slice'](-0x1);if(_0x34edb9==='/'){_0xaedf89=_0xaedf89[_0xc3f8('0x5b')](0x0,_0xaedf89[_0xc3f8('0x5c')](_0x34edb9));}var _0x4cc654={'method':'GET','uri':util[_0xc3f8('0x5d')](_0xc3f8('0x5e'),_0xaedf89,'ticket_fields'),'json':!![]};switch(_0x2f957a[_0xc3f8('0x59')]){case'password':_0x4cc654[_0xc3f8('0x5f')]={'Authorization':util['format'](_0xc3f8('0x60'),new Buffer(util[_0xc3f8('0x5d')](_0xc3f8('0x61'),_0x2f957a[_0xc3f8('0x57')],_0x2f957a[_0xc3f8('0x58')]))[_0xc3f8('0x62')](_0xc3f8('0x63')))};break;case _0xc3f8('0x64'):_0x4cc654[_0xc3f8('0x5f')]={'Authorization':util['format'](_0xc3f8('0x60'),new Buffer(util[_0xc3f8('0x5d')](_0xc3f8('0x65'),_0x2f957a[_0xc3f8('0x57')],_0x2f957a[_0xc3f8('0x64')]))['toString'](_0xc3f8('0x63')))};break;default:throw new db[(_0xc3f8('0x66'))][(_0xc3f8('0x67'))](_0xc3f8('0x68'));}return rp(_0x4cc654);}})[_0xc3f8('0x25')](function(_0x53c815){if(_0x53c815){var _0x2f69f7=[_0xc3f8('0x69'),_0xc3f8('0x6a'),'group','assignee'];_[_0xc3f8('0x6b')](_0x53c815[_0xc3f8('0x6c')],function(_0x1a9c33){return _0x2f69f7[_0xc3f8('0x6d')](_0x1a9c33['type']);});return{'count':_0x53c815[_0xc3f8('0x6c')][_0xc3f8('0x36')],'rows':_[_0xc3f8('0x2a')](_0x53c815['ticket_fields'],function(_0x2a29fa){return{'id':_0x2a29fa['id'],'name':_0x2a29fa[_0xc3f8('0x6e')]>0x7?_0x2a29fa['title']:_0x2a29fa['type'],'custom':_0x2a29fa[_0xc3f8('0x6e')]>0x7?!![]:![],'options':_0x2a29fa[_0xc3f8('0x6f')]?_0x2a29fa['system_field_options']:_0x2a29fa[_0xc3f8('0x70')]?_0x2a29fa[_0xc3f8('0x70')]:[]};})};}})['then'](respondWithResult(_0x104eec,null))[_0xc3f8('0x44')](function(_0x5f2d86){var _0x3d080a=_0x273faf['query'][_0xc3f8('0x71')]?0x1f4:_0x5f2d86[_0xc3f8('0x72')]||0x1f4;logger[_0xc3f8('0x26')](_0xc3f8('0x73'),_0xc3f8('0x56'),_0x3d080a,JSON[_0xc3f8('0x74')](_0x5f2d86));delete _0x5f2d86[_0xc3f8('0x28')];if(_0x3d080a===0x191){_0x3d080a=0x190;}_0x104eec[_0xc3f8('0x18')](_0x3d080a)[_0xc3f8('0x29')](_0x273faf['query']['test']?{'message':_0xc3f8('0x75'),'statusCode':_0x5f2d86['statusCode']}:_0x5f2d86);});}; \ No newline at end of file +var _0xac4a=['count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','ZendeskAccount','includeAll','include','findAll','catch','show','params','options','find','create','body','update','getConfigurations','findOne','ZendeskConfiguration','order','pick','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField','getFields','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','ticket_fields','Basic\x20%s','base64','headers','%s/token:%s','username','toString','Sequelize','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x15b399,_0x59db1a){var _0x199f2d=function(_0x3bd31c){while(--_0x3bd31c){_0x15b399['push'](_0x15b399['shift']());}};_0x199f2d(++_0x59db1a);}(_0xac4a,0x13f));var _0xaac4=function(_0x2b1348,_0x485a2f){_0x2b1348=_0x2b1348-0x0;var _0x3e3bbb=_0xac4a[_0x2b1348];return _0x3e3bbb;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];var integrations=require(_0xaac4('0x15'));function respondWithStatusCode(_0x45e512,_0x5a4801){_0x5a4801=_0x5a4801||0xcc;return function(_0x6a808d){if(_0x6a808d){return _0x45e512[_0xaac4('0x16')](_0x5a4801);}return _0x45e512['status'](_0x5a4801)[_0xaac4('0x17')]();};}function respondWithResult(_0x2b20d0,_0x46698d){_0x46698d=_0x46698d||0xc8;return function(_0x150fdd){if(_0x150fdd){return _0x2b20d0[_0xaac4('0x18')](_0x46698d)[_0xaac4('0x19')](_0x150fdd);}};}function respondWithFilteredResult(_0x31b7e5,_0x1df9ae){return function(_0x233278){if(_0x233278){var _0xb8466e=typeof _0x1df9ae[_0xaac4('0x1a')]===_0xaac4('0x1b')&&typeof _0x1df9ae[_0xaac4('0x1c')]==='undefined';var _0x33bc73=_0x233278['count'];var _0x220630=_0xb8466e?0x0:_0x1df9ae['offset'];var _0x3ce35a=_0xb8466e?_0x233278[_0xaac4('0x1d')]:_0x1df9ae[_0xaac4('0x1a')]+_0x1df9ae[_0xaac4('0x1c')];var _0x3cbcb1;if(_0x3ce35a>=_0x33bc73){_0x3ce35a=_0x33bc73;_0x3cbcb1=0xc8;}else{_0x3cbcb1=0xce;}_0x31b7e5[_0xaac4('0x18')](_0x3cbcb1);return _0x31b7e5[_0xaac4('0x1e')](_0xaac4('0x1f'),_0x220630+'-'+_0x3ce35a+'/'+_0x33bc73)[_0xaac4('0x19')](_0x233278);}return null;};}function patchUpdates(_0x480fb0){return function(_0x1d9c42){try{jsonpatch['apply'](_0x1d9c42,_0x480fb0,!![]);}catch(_0x3303f1){return BPromise[_0xaac4('0x20')](_0x3303f1);}return _0x1d9c42[_0xaac4('0x21')]();};}function saveUpdates(_0x477b77,_0x17140f){return function(_0x383a8c){if(_0x383a8c){return _0x383a8c['update'](_0x477b77)[_0xaac4('0x22')](function(_0x27a84d){return _0x27a84d;});}return null;};}function removeEntity(_0x174860,_0x4f10ec){return function(_0x3dd059){if(_0x3dd059){return _0x3dd059[_0xaac4('0x23')]()[_0xaac4('0x22')](function(){_0x174860['status'](0xcc)[_0xaac4('0x17')]();});}};}function handleEntityNotFound(_0x4f1b65,_0x54203b){return function(_0x4fac85){if(!_0x4fac85){_0x4f1b65['sendStatus'](0x194);}return _0x4fac85;};}function handleError(_0x22d5a6,_0x17d25f){_0x17d25f=_0x17d25f||0x1f4;return function(_0x22cda2){logger[_0xaac4('0x24')](_0x22cda2[_0xaac4('0x25')]);if(_0x22cda2[_0xaac4('0x26')]){delete _0x22cda2[_0xaac4('0x26')];}_0x22d5a6[_0xaac4('0x18')](_0x17d25f)[_0xaac4('0x27')](_0x22cda2);};}exports[_0xaac4('0x28')]=function(_0x4d0f5f,_0x316445){var _0x16b33c={},_0xda10b6={},_0xb76ccc={'count':0x0,'rows':[]};var _0x669b34=_[_0xaac4('0x29')](db['ZendeskAccount'][_0xaac4('0x2a')],function(_0x5d2c9a){return{'name':_0x5d2c9a[_0xaac4('0x2b')],'type':_0x5d2c9a[_0xaac4('0x2c')][_0xaac4('0x2d')]};});_0xda10b6[_0xaac4('0x2e')]=_['map'](_0x669b34,'name');_0xda10b6['query']=_[_0xaac4('0x2f')](_0x4d0f5f[_0xaac4('0x30')]);_0xda10b6[_0xaac4('0x31')]=_[_0xaac4('0x32')](_0xda10b6[_0xaac4('0x2e')],_0xda10b6[_0xaac4('0x30')]);_0x16b33c[_0xaac4('0x33')]=_[_0xaac4('0x32')](_0xda10b6[_0xaac4('0x2e')],qs[_0xaac4('0x34')](_0x4d0f5f[_0xaac4('0x30')][_0xaac4('0x34')]));_0x16b33c[_0xaac4('0x33')]=_0x16b33c[_0xaac4('0x33')][_0xaac4('0x35')]?_0x16b33c['attributes']:_0xda10b6['model'];if(!_0x4d0f5f[_0xaac4('0x30')][_0xaac4('0x36')](_0xaac4('0x37'))){_0x16b33c['limit']=qs[_0xaac4('0x1c')](_0x4d0f5f[_0xaac4('0x30')][_0xaac4('0x1c')]);_0x16b33c[_0xaac4('0x1a')]=qs[_0xaac4('0x1a')](_0x4d0f5f[_0xaac4('0x30')][_0xaac4('0x1a')]);}_0x16b33c['order']=qs[_0xaac4('0x38')](_0x4d0f5f[_0xaac4('0x30')][_0xaac4('0x38')]);_0x16b33c['where']=qs[_0xaac4('0x31')](_['pick'](_0x4d0f5f['query'],_0xda10b6[_0xaac4('0x31')]),_0x669b34);if(_0x4d0f5f[_0xaac4('0x30')][_0xaac4('0x39')]){_0x16b33c['where']=_['merge'](_0x16b33c[_0xaac4('0x3a')],{'$or':_[_0xaac4('0x29')](_0x669b34,function(_0x2f7300){if(_0x2f7300[_0xaac4('0x2c')]!==_0xaac4('0x3b')){var _0x36f4d4={};_0x36f4d4[_0x2f7300['name']]={'$like':'%'+_0x4d0f5f['query'][_0xaac4('0x39')]+'%'};return _0x36f4d4;}})});}_0x16b33c=_[_0xaac4('0x3c')]({},_0x16b33c,_0x4d0f5f['options']);var _0x416a5b={'where':_0x16b33c[_0xaac4('0x3a')]};return db[_0xaac4('0x3d')]['count'](_0x416a5b)[_0xaac4('0x22')](function(_0x4a4773){_0xb76ccc[_0xaac4('0x1d')]=_0x4a4773;if(_0x4d0f5f['query'][_0xaac4('0x3e')]){_0x16b33c[_0xaac4('0x3f')]=[{'all':!![]}];}return db[_0xaac4('0x3d')][_0xaac4('0x40')](_0x16b33c);})['then'](function(_0x247fea){_0xb76ccc['rows']=_0x247fea;return _0xb76ccc;})['then'](respondWithFilteredResult(_0x316445,_0x16b33c))[_0xaac4('0x41')](handleError(_0x316445,null));};exports[_0xaac4('0x42')]=function(_0x27df36,_0x40c007){var _0x43bc12={'raw':![],'where':{'id':_0x27df36[_0xaac4('0x43')]['id']}},_0xb78221={};_0xb78221[_0xaac4('0x2e')]=_['keys'](db[_0xaac4('0x3d')][_0xaac4('0x2a')]);_0xb78221[_0xaac4('0x30')]=_[_0xaac4('0x2f')](_0x27df36['query']);_0xb78221[_0xaac4('0x31')]=_[_0xaac4('0x32')](_0xb78221[_0xaac4('0x2e')],_0xb78221['query']);_0x43bc12[_0xaac4('0x33')]=_[_0xaac4('0x32')](_0xb78221[_0xaac4('0x2e')],qs[_0xaac4('0x34')](_0x27df36['query'][_0xaac4('0x34')]));_0x43bc12[_0xaac4('0x33')]=_0x43bc12[_0xaac4('0x33')]['length']?_0x43bc12[_0xaac4('0x33')]:_0xb78221[_0xaac4('0x2e')];if(_0x27df36[_0xaac4('0x30')][_0xaac4('0x3e')]){_0x43bc12[_0xaac4('0x3f')]=[{'all':!![]}];}_0x43bc12=_[_0xaac4('0x3c')]({},_0x43bc12,_0x27df36[_0xaac4('0x44')]);return db[_0xaac4('0x3d')][_0xaac4('0x45')](_0x43bc12)['then'](handleEntityNotFound(_0x40c007,null))[_0xaac4('0x22')](respondWithResult(_0x40c007,null))[_0xaac4('0x41')](handleError(_0x40c007,null));};exports[_0xaac4('0x46')]=function(_0x360420,_0x130bb5){return db['ZendeskAccount']['create'](_0x360420[_0xaac4('0x47')],{})[_0xaac4('0x22')](respondWithResult(_0x130bb5,0xc9))[_0xaac4('0x41')](handleError(_0x130bb5,null));};exports[_0xaac4('0x48')]=function(_0x5f33ea,_0x283d51){if(_0x5f33ea['body']['id']){delete _0x5f33ea[_0xaac4('0x47')]['id'];}return db[_0xaac4('0x3d')]['find']({'where':{'id':_0x5f33ea[_0xaac4('0x43')]['id']}})[_0xaac4('0x22')](handleEntityNotFound(_0x283d51,null))[_0xaac4('0x22')](saveUpdates(_0x5f33ea['body'],null))['then'](respondWithResult(_0x283d51,null))[_0xaac4('0x41')](handleError(_0x283d51,null));};exports[_0xaac4('0x23')]=function(_0x22dda7,_0xb32d1d){return db[_0xaac4('0x3d')][_0xaac4('0x45')]({'where':{'id':_0x22dda7['params']['id']}})[_0xaac4('0x22')](handleEntityNotFound(_0xb32d1d,null))[_0xaac4('0x22')](removeEntity(_0xb32d1d,null))[_0xaac4('0x41')](handleError(_0xb32d1d,null));};exports[_0xaac4('0x49')]=function(_0x56201b,_0x3ca377,_0x571418){var _0x33e32f={};var _0x3a703c={};var _0x460252;var _0x3922a0;return db[_0xaac4('0x3d')][_0xaac4('0x4a')]({'where':{'id':_0x56201b[_0xaac4('0x43')]['id']}})[_0xaac4('0x22')](handleEntityNotFound(_0x3ca377,null))[_0xaac4('0x22')](function(_0x1b9219){if(_0x1b9219){_0x460252=_0x1b9219;_0x3a703c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](db[_0xaac4('0x4b')][_0xaac4('0x2a')]);_0x3a703c['query']=_[_0xaac4('0x2f')](_0x56201b[_0xaac4('0x30')]);_0x3a703c[_0xaac4('0x31')]=_[_0xaac4('0x32')](_0x3a703c[_0xaac4('0x2e')],_0x3a703c[_0xaac4('0x30')]);_0x33e32f[_0xaac4('0x33')]=_[_0xaac4('0x32')](_0x3a703c['model'],qs[_0xaac4('0x34')](_0x56201b['query'][_0xaac4('0x34')]));_0x33e32f['attributes']=_0x33e32f[_0xaac4('0x33')]['length']?_0x33e32f['attributes']:_0x3a703c[_0xaac4('0x2e')];_0x33e32f[_0xaac4('0x4c')]=qs['sort'](_0x56201b[_0xaac4('0x30')][_0xaac4('0x38')]);_0x33e32f[_0xaac4('0x3a')]=qs[_0xaac4('0x31')](_[_0xaac4('0x4d')](_0x56201b[_0xaac4('0x30')],_0x3a703c['filters']));if(_0x56201b[_0xaac4('0x30')]['filter']){_0x33e32f[_0xaac4('0x3a')]=_['merge'](_0x33e32f['where'],{'$or':_['map'](_0x33e32f[_0xaac4('0x33')],function(_0x380e9d){var _0x467a61={};_0x467a61[_0x380e9d]={'$like':'%'+_0x56201b[_0xaac4('0x30')]['filter']+'%'};return _0x467a61;})});}_0x33e32f=_[_0xaac4('0x3c')]({},_0x33e32f,_0x56201b[_0xaac4('0x44')]);return _0x460252[_0xaac4('0x49')](_0x33e32f);}})['then'](function(_0x8891d){if(_0x8891d){_0x3922a0=_0x8891d[_0xaac4('0x35')];if(!_0x56201b[_0xaac4('0x30')][_0xaac4('0x36')](_0xaac4('0x37'))){_0x33e32f[_0xaac4('0x1c')]=qs[_0xaac4('0x1c')](_0x56201b['query']['limit']);_0x33e32f[_0xaac4('0x1a')]=qs['offset'](_0x56201b['query'][_0xaac4('0x1a')]);}return _0x460252['getConfigurations'](_0x33e32f);}})[_0xaac4('0x22')](function(_0x4b6881){if(_0x4b6881){return _0x4b6881?{'count':_0x3922a0,'rows':_0x4b6881}:null;}})[_0xaac4('0x22')](respondWithResult(_0x3ca377,null))[_0xaac4('0x41')](handleError(_0x3ca377,null));};exports['addConfiguration']=function(_0x5112d3,_0x4e6de9,_0x4d0ee7){if(_0x5112d3[_0xaac4('0x47')]['id']){delete _0x5112d3[_0xaac4('0x47')]['id'];}return db[_0xaac4('0x3d')][_0xaac4('0x4a')]({'where':{'id':_0x5112d3['params']['id']}})[_0xaac4('0x22')](handleEntityNotFound(_0x4e6de9,null))[_0xaac4('0x22')](function(_0x3b0470){if(_0x3b0470){_0x5112d3[_0xaac4('0x47')][_0xaac4('0x4e')]=_0x3b0470['id'];_0x5112d3[_0xaac4('0x47')][_0xaac4('0x4f')]=integrations[_0xaac4('0x50')](_0x5112d3[_0xaac4('0x47')][_0xaac4('0x51')],_0x5112d3[_0xaac4('0x47')]['type']);_0x5112d3['body'][_0xaac4('0x52')]=integrations['getDescriptions'](_0x5112d3['body'][_0xaac4('0x51')],_0x5112d3['body'][_0xaac4('0x2c')]);return db[_0xaac4('0x4b')][_0xaac4('0x46')](_0x5112d3[_0xaac4('0x47')],{'include':[{'model':db['ZendeskField'],'as':_0xaac4('0x4f')},{'model':db[_0xaac4('0x53')],'as':_0xaac4('0x52')}]});}return null;})[_0xaac4('0x22')](respondWithResult(_0x4e6de9,null))[_0xaac4('0x41')](handleError(_0x4e6de9,null));};exports[_0xaac4('0x54')]=function(_0x5b20c6,_0x1db7c7,_0x429661){var _0x5b5e57='';return db[_0xaac4('0x3d')][_0xaac4('0x4a')]({'where':{'id':_0x5b20c6['params']['id']},'attributes':['id','username',_0xaac4('0x55'),_0xaac4('0x56'),_0xaac4('0x57'),_0xaac4('0x58')]})[_0xaac4('0x22')](handleEntityNotFound(_0x1db7c7,null))[_0xaac4('0x22')](function(_0x13d691){if(_0x13d691){_0x5b5e57=_0x13d691[_0xaac4('0x58')];var _0x59085e=_0x5b5e57[_0xaac4('0x59')](-0x1);if(_0x59085e==='/'){_0x5b5e57=_0x5b5e57[_0xaac4('0x5a')](0x0,_0x5b5e57[_0xaac4('0x5b')](_0x59085e));}var _0x254fb3={'method':_0xaac4('0x5c'),'uri':util[_0xaac4('0x5d')]('%s/%s',_0x5b5e57,_0xaac4('0x5e')),'json':!![]};switch(_0x13d691[_0xaac4('0x57')]){case'password':_0x254fb3['headers']={'Authorization':util['format'](_0xaac4('0x5f'),new Buffer(util['format']('%s:%s',_0x13d691['username'],_0x13d691['password']))['toString'](_0xaac4('0x60')))};break;case _0xaac4('0x56'):_0x254fb3[_0xaac4('0x61')]={'Authorization':util[_0xaac4('0x5d')]('Basic\x20%s',new Buffer(util[_0xaac4('0x5d')](_0xaac4('0x62'),_0x13d691[_0xaac4('0x63')],_0x13d691[_0xaac4('0x56')]))[_0xaac4('0x64')](_0xaac4('0x60')))};break;default:throw new db[(_0xaac4('0x65'))]['ValidationError'](_0xaac4('0x66'));}return rp(_0x254fb3);}})['then'](function(_0x551e53){if(_0x551e53){var _0x20dff9=[_0xaac4('0x67'),_0xaac4('0x68'),_0xaac4('0x69'),_0xaac4('0x6a')];_[_0xaac4('0x6b')](_0x551e53[_0xaac4('0x5e')],function(_0x18d567){return _0x20dff9[_0xaac4('0x6c')](_0x18d567[_0xaac4('0x2c')]);});return{'count':_0x551e53[_0xaac4('0x5e')][_0xaac4('0x35')],'rows':_[_0xaac4('0x29')](_0x551e53[_0xaac4('0x5e')],function(_0xdf6b04){return{'id':_0xdf6b04['id'],'name':_0xdf6b04[_0xaac4('0x6d')]>0x7?_0xdf6b04[_0xaac4('0x6e')]:_0xdf6b04[_0xaac4('0x2c')],'custom':_0xdf6b04[_0xaac4('0x6d')]>0x7?!![]:![],'options':_0xdf6b04[_0xaac4('0x6f')]?_0xdf6b04[_0xaac4('0x6f')]:_0xdf6b04[_0xaac4('0x70')]?_0xdf6b04[_0xaac4('0x70')]:[]};})};}})[_0xaac4('0x22')](respondWithResult(_0x1db7c7,null))[_0xaac4('0x41')](function(_0x59f6dc){var _0xb12069=_0x5b20c6[_0xaac4('0x30')][_0xaac4('0x71')]?0x1f4:_0x59f6dc[_0xaac4('0x72')]||0x1f4;logger[_0xaac4('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xaac4('0x54'),_0xb12069,JSON[_0xaac4('0x73')](_0x59f6dc));delete _0x59f6dc[_0xaac4('0x26')];if(_0xb12069===0x191){_0xb12069=0x190;}_0x1db7c7[_0xaac4('0x18')](_0xb12069)[_0xaac4('0x27')](_0x5b20c6['query'][_0xaac4('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x59f6dc[_0xaac4('0x72')]}:_0x59f6dc);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 5d31db3..a755fca 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 _0x0c3f=['util','api','moment','bluebird','request-promise','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash'];(function(_0x12acaa,_0x6ba35a){var _0xd6e45f=function(_0x17694e){while(--_0x17694e){_0x12acaa['push'](_0x12acaa['shift']());}};_0xd6e45f(++_0x6ba35a);}(_0x0c3f,0x1a3));var _0xf0c3=function(_0x446a16,_0x31f2c7){_0x446a16=_0x446a16-0x0;var _0xaef147=_0x0c3f[_0x446a16];return _0xaef147;};'use strict';var _=require(_0xf0c3('0x0'));var util=require(_0xf0c3('0x1'));var logger=require('../../config/logger')(_0xf0c3('0x2'));var moment=require(_0xf0c3('0x3'));var BPromise=require(_0xf0c3('0x4'));var rp=require(_0xf0c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf0c3('0x6'));var attributes=require(_0xf0c3('0x7'));var integrations=require(_0xf0c3('0x8'));module[_0xf0c3('0x9')]=function(_0x37af61,_0x5fc057){return _0x37af61[_0xf0c3('0xa')](_0xf0c3('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe532=['../../components/integrations/configuration','exports','int_zendesk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4c8a8f,_0x997ef){var _0x404500=function(_0x1c6072){while(--_0x1c6072){_0x4c8a8f['push'](_0x4c8a8f['shift']());}};_0x404500(++_0x997ef);}(_0xe532,0x10b));var _0x2e53=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xe532[_0x31ced5];return _0x10d9e5;};'use strict';var _=require(_0x2e53('0x0'));var util=require('util');var logger=require(_0x2e53('0x1'))(_0x2e53('0x2'));var moment=require(_0x2e53('0x3'));var BPromise=require(_0x2e53('0x4'));var rp=require(_0x2e53('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e53('0x6'));var config=require(_0x2e53('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x2e53('0x8'));module[_0x2e53('0x9')]=function(_0x30d54c,_0x38c774){return _0x30d54c['define']('ZendeskAccount',attributes,{'tableName':_0x2e53('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 1bd8643..4750078 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 _0x4975=['../../config/logger','rpc','../../config/environment','client','request','then','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','GetZendeskAccount','ZendeskAccount','options','raw','where','attributes','limit','include','map','model','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x53730b,_0x1d7cb6){var _0x1bb992=function(_0x1a5601){while(--_0x1a5601){_0x53730b['push'](_0x53730b['shift']());}};_0x1bb992(++_0x1d7cb6);}(_0x4975,0x85));var _0x5497=function(_0x3da8fd,_0x4fb3cb){_0x3da8fd=_0x3da8fd-0x0;var _0x34e110=_0x4975[_0x3da8fd];return _0x34e110;};'use strict';var _=require(_0x5497('0x0'));var util=require(_0x5497('0x1'));var moment=require(_0x5497('0x2'));var BPromise=require(_0x5497('0x3'));var rs=require(_0x5497('0x4'));var fs=require('fs');var Redis=require('ioredis');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('jayson/promise');var client=jayson[_0x5497('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31ce77,_0x2286fb,_0x541313){return new BPromise(function(_0x384a0b,_0xf73c60){return client[_0x5497('0xb')](_0x31ce77,_0x541313)[_0x5497('0xc')](function(_0x329818){logger['info'](_0x5497('0xd'),_0x2286fb,'request\x20sent');logger[_0x5497('0xe')](_0x5497('0xf'),_0x2286fb,_0x5497('0x10'),JSON[_0x5497('0x11')](_0x329818));if(_0x329818['error']){if(_0x329818[_0x5497('0x12')]['code']===0x1f4){logger['error'](_0x5497('0xd'),_0x2286fb,_0x329818[_0x5497('0x12')][_0x5497('0x13')]);return _0xf73c60(_0x329818['error']['message']);}logger['error'](_0x5497('0xd'),_0x2286fb,_0x329818[_0x5497('0x12')][_0x5497('0x13')]);return _0x384a0b(_0x329818[_0x5497('0x12')][_0x5497('0x13')]);}else{logger[_0x5497('0x14')](_0x5497('0xd'),_0x2286fb,'request\x20sent');_0x384a0b(_0x329818[_0x5497('0x15')][_0x5497('0x13')]);}})[_0x5497('0x16')](function(_0x12e821){logger[_0x5497('0x12')](_0x5497('0xd'),_0x2286fb,_0x12e821);_0xf73c60(_0x12e821);});});}exports[_0x5497('0x17')]=function(_0x1671a6){var _0x210324=this;return new Promise(function(_0x1967e7,_0x326ae2){return db[_0x5497('0x18')]['findAll']({'raw':_0x1671a6[_0x5497('0x19')]?_0x1671a6[_0x5497('0x19')][_0x5497('0x1a')]===undefined?!![]:![]:!![],'where':_0x1671a6['options']?_0x1671a6[_0x5497('0x19')][_0x5497('0x1b')]||null:null,'attributes':_0x1671a6[_0x5497('0x19')]?_0x1671a6[_0x5497('0x19')][_0x5497('0x1c')]||null:null,'limit':_0x1671a6[_0x5497('0x19')]?_0x1671a6[_0x5497('0x19')][_0x5497('0x1d')]||null:null,'include':_0x1671a6['options']?_0x1671a6[_0x5497('0x19')][_0x5497('0x1e')]?_[_0x5497('0x1f')](_0x1671a6[_0x5497('0x19')]['include'],function(_0x58a749){return{'model':db[_0x58a749['model']],'as':_0x58a749['as'],'attributes':_0x58a749['attributes'],'include':_0x58a749[_0x5497('0x1e')]?_[_0x5497('0x1f')](_0x58a749[_0x5497('0x1e')],function(_0x2e7e82){return{'model':db[_0x2e7e82['model']],'as':_0x2e7e82['as'],'attributes':_0x2e7e82[_0x5497('0x1c')],'include':_0x2e7e82['include']?_[_0x5497('0x1f')](_0x2e7e82['include'],function(_0x4b89bf){return{'model':db[_0x4b89bf[_0x5497('0x20')]],'as':_0x4b89bf['as'],'attributes':_0x4b89bf[_0x5497('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24f029){logger[_0x5497('0x14')](_0x5497('0x17'),_0x1671a6);logger[_0x5497('0xe')](_0x5497('0x17'),_0x1671a6,JSON[_0x5497('0x11')](_0x24f029));_0x1967e7(_0x24f029);})[_0x5497('0x16')](function(_0x6ecfd7){logger[_0x5497('0x12')]('GetZendeskAccount',_0x6ecfd7[_0x5497('0x13')],_0x1671a6);_0x326ae2(_0x210324['error'](0x1f4,_0x6ecfd7[_0x5497('0x13')]));});});};exports[_0x5497('0x21')]=function(_0x5291dd){var _0x19d80a=this;return new Promise(function(_0x53b916,_0x19bdfb){return db[_0x5497('0x18')][_0x5497('0x22')]({'raw':_0x5291dd[_0x5497('0x19')]?_0x5291dd[_0x5497('0x19')][_0x5497('0x1a')]===undefined?!![]:![]:!![],'where':_0x5291dd[_0x5497('0x19')]?_0x5291dd['options'][_0x5497('0x1b')]||null:null,'attributes':_0x5291dd[_0x5497('0x19')]?_0x5291dd[_0x5497('0x19')][_0x5497('0x1c')]||null:null,'include':_0x5291dd[_0x5497('0x19')]?_0x5291dd[_0x5497('0x19')]['include']?_[_0x5497('0x1f')](_0x5291dd['options'][_0x5497('0x1e')],function(_0x59db38){return{'model':db[_0x59db38[_0x5497('0x20')]],'as':_0x59db38['as'],'attributes':_0x59db38['attributes'],'include':_0x59db38[_0x5497('0x1e')]?_['map'](_0x59db38[_0x5497('0x1e')],function(_0x3eed3f){return{'model':db[_0x3eed3f[_0x5497('0x20')]],'as':_0x3eed3f['as'],'attributes':_0x3eed3f[_0x5497('0x1c')],'include':_0x3eed3f['include']?_['map'](_0x3eed3f[_0x5497('0x1e')],function(_0x5a1533){return{'model':db[_0x5a1533[_0x5497('0x20')]],'as':_0x5a1533['as'],'attributes':_0x5a1533['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x24cfcf){logger[_0x5497('0x14')](_0x5497('0x21'),_0x5291dd);logger[_0x5497('0xe')](_0x5497('0x21'),_0x5291dd,JSON[_0x5497('0x11')](_0x24cfcf));_0x53b916(_0x24cfcf);})[_0x5497('0x16')](function(_0x2edea9){logger[_0x5497('0x12')](_0x5497('0x21'),_0x2edea9[_0x5497('0x13')],_0x5291dd);_0x19bdfb(_0x19d80a[_0x5497('0x12')](0x1f4,_0x2edea9[_0x5497('0x13')]));});});}; \ No newline at end of file +var _0x3575=['find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','limit','include','map','attributes','model','then','stringify','ShowZendeskAccount'];(function(_0x16d27c,_0x5cd0f5){var _0x5ef10b=function(_0x37ef83){while(--_0x37ef83){_0x16d27c['push'](_0x16d27c['shift']());}};_0x5ef10b(++_0x5cd0f5);}(_0x3575,0xbf));var _0x5357=function(_0x58f039,_0x1d10a3){_0x58f039=_0x58f039-0x0;var _0x187b33=_0x3575[_0x58f039];return _0x187b33;};'use strict';var _=require(_0x5357('0x0'));var util=require(_0x5357('0x1'));var moment=require(_0x5357('0x2'));var BPromise=require(_0x5357('0x3'));var rs=require(_0x5357('0x4'));var fs=require('fs');var Redis=require(_0x5357('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5357('0x6'));var logger=require(_0x5357('0x7'))(_0x5357('0x8'));var config=require(_0x5357('0x9'));var jayson=require(_0x5357('0xa'));var client=jayson[_0x5357('0xb')][_0x5357('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x547c86,_0x1fa09b,_0x145c64){return new BPromise(function(_0x365b3d,_0x5588b0){return client[_0x5357('0xd')](_0x547c86,_0x145c64)['then'](function(_0x4fedfe){logger[_0x5357('0xe')](_0x5357('0xf'),_0x1fa09b,'request\x20sent');logger[_0x5357('0x10')](_0x5357('0x11'),_0x1fa09b,_0x5357('0x12'),JSON['stringify'](_0x4fedfe));if(_0x4fedfe[_0x5357('0x13')]){if(_0x4fedfe[_0x5357('0x13')][_0x5357('0x14')]===0x1f4){logger['error'](_0x5357('0xf'),_0x1fa09b,_0x4fedfe[_0x5357('0x13')]['message']);return _0x5588b0(_0x4fedfe[_0x5357('0x13')][_0x5357('0x15')]);}logger[_0x5357('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x1fa09b,_0x4fedfe[_0x5357('0x13')][_0x5357('0x15')]);return _0x365b3d(_0x4fedfe['error'][_0x5357('0x15')]);}else{logger[_0x5357('0xe')](_0x5357('0xf'),_0x1fa09b,_0x5357('0x12'));_0x365b3d(_0x4fedfe['result'][_0x5357('0x15')]);}})[_0x5357('0x16')](function(_0x298c09){logger[_0x5357('0x13')](_0x5357('0xf'),_0x1fa09b,_0x298c09);_0x5588b0(_0x298c09);});});}exports[_0x5357('0x17')]=function(_0x19f6e4){var _0xde64a1=this;return new Promise(function(_0x3ecc4b,_0xf1ab20){return db[_0x5357('0x18')][_0x5357('0x19')]({'raw':_0x19f6e4[_0x5357('0x1a')]?_0x19f6e4[_0x5357('0x1a')][_0x5357('0x1b')]===undefined?!![]:![]:!![],'where':_0x19f6e4[_0x5357('0x1a')]?_0x19f6e4['options'][_0x5357('0x1c')]||null:null,'attributes':_0x19f6e4[_0x5357('0x1a')]?_0x19f6e4['options']['attributes']||null:null,'limit':_0x19f6e4['options']?_0x19f6e4[_0x5357('0x1a')][_0x5357('0x1d')]||null:null,'include':_0x19f6e4[_0x5357('0x1a')]?_0x19f6e4[_0x5357('0x1a')][_0x5357('0x1e')]?_[_0x5357('0x1f')](_0x19f6e4['options'][_0x5357('0x1e')],function(_0x4141a4){return{'model':db[_0x4141a4['model']],'as':_0x4141a4['as'],'attributes':_0x4141a4[_0x5357('0x20')],'include':_0x4141a4[_0x5357('0x1e')]?_[_0x5357('0x1f')](_0x4141a4['include'],function(_0x3735de){return{'model':db[_0x3735de[_0x5357('0x21')]],'as':_0x3735de['as'],'attributes':_0x3735de[_0x5357('0x20')],'include':_0x3735de[_0x5357('0x1e')]?_[_0x5357('0x1f')](_0x3735de['include'],function(_0x1c86fd){return{'model':db[_0x1c86fd[_0x5357('0x21')]],'as':_0x1c86fd['as'],'attributes':_0x1c86fd['attributes']};}):[]};}):[]};}):[]:[]})[_0x5357('0x22')](function(_0xc15ef0){logger[_0x5357('0xe')]('GetZendeskAccount',_0x19f6e4);logger['debug'](_0x5357('0x17'),_0x19f6e4,JSON[_0x5357('0x23')](_0xc15ef0));_0x3ecc4b(_0xc15ef0);})[_0x5357('0x16')](function(_0x48334b){logger['error'](_0x5357('0x17'),_0x48334b[_0x5357('0x15')],_0x19f6e4);_0xf1ab20(_0xde64a1[_0x5357('0x13')](0x1f4,_0x48334b[_0x5357('0x15')]));});});};exports[_0x5357('0x24')]=function(_0x170e29){var _0x45788d=this;return new Promise(function(_0x1e4c67,_0x2d9917){return db[_0x5357('0x18')][_0x5357('0x25')]({'raw':_0x170e29[_0x5357('0x1a')]?_0x170e29['options']['raw']===undefined?!![]:![]:!![],'where':_0x170e29[_0x5357('0x1a')]?_0x170e29[_0x5357('0x1a')][_0x5357('0x1c')]||null:null,'attributes':_0x170e29[_0x5357('0x1a')]?_0x170e29[_0x5357('0x1a')][_0x5357('0x20')]||null:null,'include':_0x170e29[_0x5357('0x1a')]?_0x170e29[_0x5357('0x1a')][_0x5357('0x1e')]?_[_0x5357('0x1f')](_0x170e29['options'][_0x5357('0x1e')],function(_0x3c8476){return{'model':db[_0x3c8476[_0x5357('0x21')]],'as':_0x3c8476['as'],'attributes':_0x3c8476[_0x5357('0x20')],'include':_0x3c8476[_0x5357('0x1e')]?_[_0x5357('0x1f')](_0x3c8476[_0x5357('0x1e')],function(_0x51adf2){return{'model':db[_0x51adf2[_0x5357('0x21')]],'as':_0x51adf2['as'],'attributes':_0x51adf2[_0x5357('0x20')],'include':_0x51adf2[_0x5357('0x1e')]?_[_0x5357('0x1f')](_0x51adf2[_0x5357('0x1e')],function(_0x158235){return{'model':db[_0x158235[_0x5357('0x21')]],'as':_0x158235['as'],'attributes':_0x158235[_0x5357('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5357('0x22')](function(_0x319673){logger['info']('ShowZendeskAccount',_0x170e29);logger['debug'](_0x5357('0x24'),_0x170e29,JSON[_0x5357('0x23')](_0x319673));_0x1e4c67(_0x319673);})['catch'](function(_0x5a8887){logger[_0x5357('0x13')](_0x5357('0x24'),_0x5a8887[_0x5357('0x15')],_0x170e29);_0x2d9917(_0x45788d['error'](0x1f4,_0x5a8887['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 099ecff..7bec74b 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 _0xea28=['Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x221d0f,_0x37c51d){var _0x178f23=function(_0x2a9f9e){while(--_0x2a9f9e){_0x221d0f['push'](_0x221d0f['shift']());}};_0x178f23(++_0x37c51d);}(_0xea28,0x13a));var _0x8ea2=function(_0x3733f5,_0xf1c4c4){_0x3733f5=_0x3733f5-0x0;var _0x5757b2=_0xea28[_0x3733f5];return _0x5757b2;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getSubjects']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['get'](_0x8ea2('0x14'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x15')]);router[_0x8ea2('0x16')]('/',auth[_0x8ea2('0xd')](),controller['create']);router[_0x8ea2('0x16')]('/:id/tags',auth['isAuthenticated'](),controller[_0x8ea2('0x17')]);router[_0x8ea2('0x18')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x1b')]);module[_0x8ea2('0x1c')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','post','create','setTags','put','/:id','delete','destroy','exports','multer','util'];(function(_0x405ac9,_0x2c795c){var _0x2d200f=function(_0x27ae59){while(--_0x27ae59){_0x405ac9['push'](_0x405ac9['shift']());}};_0x2d200f(++_0x2c795c);}(_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('./intZendeskConfiguration.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x9')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x9')]('/:id/descriptions',auth[_0x0d8b('0x7')](),controller['getDescriptions']);router[_0x0d8b('0x9')](_0x0d8b('0xf'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0xf'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller['update']);router[_0x0d8b('0x16')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x17')]);module[_0x0d8b('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 4e31f13..4747159 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 _0x41d1=['exports','STRING','sequelize'];(function(_0x2de169,_0x567c3e){var _0x4e2afd=function(_0x1e1087){while(--_0x1e1087){_0x2de169['push'](_0x2de169['shift']());}};_0x4e2afd(++_0x567c3e);}(_0x41d1,0x1f4));var _0x141d=function(_0x1fd0d5,_0x3cb655){_0x1fd0d5=_0x1fd0d5-0x0;var _0x57d242=_0x41d1[_0x1fd0d5];return _0x57d242;};'use strict';var Sequelize=require(_0x141d('0x0'));module[_0x141d('0x1')]={'name':{'type':Sequelize[_0x141d('0x2')]},'description':{'type':Sequelize[_0x141d('0x2')]}}; \ No newline at end of file +var _0x4e1d=['sequelize','exports','STRING'];(function(_0x373e33,_0x361059){var _0x126dab=function(_0x5ef2f1){while(--_0x5ef2f1){_0x373e33['push'](_0x373e33['shift']());}};_0x126dab(++_0x361059);}(_0x4e1d,0x81));var _0xd4e1=function(_0x47ecb1,_0xe0cfb1){_0x47ecb1=_0x47ecb1-0x0;var _0x1bbadd=_0x4e1d[_0x47ecb1];return _0x1bbadd;};'use strict';var Sequelize=require(_0xd4e1('0x0'));module[_0xd4e1('0x1')]={'name':{'type':Sequelize[_0xd4e1('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 08adbee..47af9dc 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 _0x8b27=['catch','params','rawAttributes','find','create','body','ZendeskField','order','hasOwnProperty','getFields','getSubjects','findOne','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','end','error','stack','send','index','map','ZendeskConfiguration','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x21ad02,_0x463d34){var _0xfc5ab8=function(_0x52724a){while(--_0x52724a){_0x21ad02['push'](_0x21ad02['shift']());}};_0xfc5ab8(++_0x463d34);}(_0x8b27,0x10f));var _0x78b2=function(_0x477be9,_0x221544){_0x477be9=_0x477be9-0x0;var _0xa80aa5=_0x8b27[_0x477be9];return _0xa80aa5;};'use strict';var emlformat=require(_0x78b2('0x0'));var rimraf=require(_0x78b2('0x1'));var zipdir=require(_0x78b2('0x2'));var jsonpatch=require(_0x78b2('0x3'));var rp=require(_0x78b2('0x4'));var moment=require(_0x78b2('0x5'));var BPromise=require(_0x78b2('0x6'));var Mustache=require(_0x78b2('0x7'));var util=require(_0x78b2('0x8'));var path=require('path');var sox=require(_0x78b2('0x9'));var csv=require('to-csv');var ejs=require(_0x78b2('0xa'));var fs=require('fs');var fs_extra=require(_0x78b2('0xb'));var _=require(_0x78b2('0xc'));var squel=require(_0x78b2('0xd'));var crypto=require(_0x78b2('0xe'));var jsforce=require(_0x78b2('0xf'));var deskjs=require(_0x78b2('0x10'));var toCsv=require(_0x78b2('0x11'));var querystring=require(_0x78b2('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x78b2('0x13'));var as=require(_0x78b2('0x14'));var hardwareService=require(_0x78b2('0x15'));var logger=require(_0x78b2('0x16'))(_0x78b2('0x17'));var utils=require('../../config/utils');var config=require(_0x78b2('0x18'));var licenseUtil=require(_0x78b2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x456cb4,_0x1aacde){_0x1aacde=_0x1aacde||0xcc;return function(_0x516999){if(_0x516999){return _0x456cb4[_0x78b2('0x1a')](_0x1aacde);}return _0x456cb4[_0x78b2('0x1b')](_0x1aacde)['end']();};}function respondWithResult(_0x1f3725,_0x2e7d58){_0x2e7d58=_0x2e7d58||0xc8;return function(_0x1287c1){if(_0x1287c1){return _0x1f3725['status'](_0x2e7d58)[_0x78b2('0x1c')](_0x1287c1);}};}function respondWithFilteredResult(_0x407d6e,_0x2ed466){return function(_0x2d528e){if(_0x2d528e){var _0x474361=typeof _0x2ed466[_0x78b2('0x1d')]===_0x78b2('0x1e')&&typeof _0x2ed466[_0x78b2('0x1f')]==='undefined';var _0x33617f=_0x2d528e[_0x78b2('0x20')];var _0x1ff613=_0x474361?0x0:_0x2ed466[_0x78b2('0x1d')];var _0x19b277=_0x474361?_0x2d528e[_0x78b2('0x20')]:_0x2ed466[_0x78b2('0x1d')]+_0x2ed466[_0x78b2('0x1f')];var _0x19839c;if(_0x19b277>=_0x33617f){_0x19b277=_0x33617f;_0x19839c=0xc8;}else{_0x19839c=0xce;}_0x407d6e[_0x78b2('0x1b')](_0x19839c);return _0x407d6e[_0x78b2('0x21')]('Content-Range',_0x1ff613+'-'+_0x19b277+'/'+_0x33617f)[_0x78b2('0x1c')](_0x2d528e);}return null;};}function patchUpdates(_0x436b39){return function(_0x6fb20a){try{jsonpatch[_0x78b2('0x22')](_0x6fb20a,_0x436b39,!![]);}catch(_0x3ae3e7){return BPromise['reject'](_0x3ae3e7);}return _0x6fb20a[_0x78b2('0x23')]();};}function saveUpdates(_0x50697d,_0x167a0a){return function(_0x49be68){if(_0x49be68){return _0x49be68[_0x78b2('0x24')](_0x50697d)[_0x78b2('0x25')](function(_0x255cdd){return _0x255cdd;});}return null;};}function removeEntity(_0x1c3d17,_0x29dfd8){return function(_0x154648){if(_0x154648){return _0x154648[_0x78b2('0x26')]()['then'](function(){_0x1c3d17['status'](0xcc)[_0x78b2('0x27')]();});}};}function handleEntityNotFound(_0x579a32,_0xbc8765){return function(_0x47924f){if(!_0x47924f){_0x579a32['sendStatus'](0x194);}return _0x47924f;};}function handleError(_0x21dd88,_0x2d64a2){_0x2d64a2=_0x2d64a2||0x1f4;return function(_0xb247f5){logger[_0x78b2('0x28')](_0xb247f5[_0x78b2('0x29')]);if(_0xb247f5['name']){delete _0xb247f5['name'];}_0x21dd88['status'](_0x2d64a2)[_0x78b2('0x2a')](_0xb247f5);};}exports[_0x78b2('0x2b')]=function(_0x24841c,_0x48c354){var _0x5a742d={},_0x455484={},_0x2f1c75={'count':0x0,'rows':[]};var _0x502dab=_[_0x78b2('0x2c')](db[_0x78b2('0x2d')]['rawAttributes'],function(_0x1623f1){return{'name':_0x1623f1[_0x78b2('0x2e')],'type':_0x1623f1[_0x78b2('0x2f')][_0x78b2('0x30')]};});_0x455484[_0x78b2('0x31')]=_[_0x78b2('0x2c')](_0x502dab,_0x78b2('0x32'));_0x455484[_0x78b2('0x33')]=_[_0x78b2('0x34')](_0x24841c[_0x78b2('0x33')]);_0x455484['filters']=_[_0x78b2('0x35')](_0x455484[_0x78b2('0x31')],_0x455484[_0x78b2('0x33')]);_0x5a742d[_0x78b2('0x36')]=_['intersection'](_0x455484[_0x78b2('0x31')],qs[_0x78b2('0x37')](_0x24841c[_0x78b2('0x33')]['fields']));_0x5a742d[_0x78b2('0x36')]=_0x5a742d[_0x78b2('0x36')][_0x78b2('0x38')]?_0x5a742d[_0x78b2('0x36')]:_0x455484[_0x78b2('0x31')];if(!_0x24841c['query']['hasOwnProperty'](_0x78b2('0x39'))){_0x5a742d[_0x78b2('0x1f')]=qs[_0x78b2('0x1f')](_0x24841c['query'][_0x78b2('0x1f')]);_0x5a742d['offset']=qs[_0x78b2('0x1d')](_0x24841c[_0x78b2('0x33')][_0x78b2('0x1d')]);}_0x5a742d['order']=qs[_0x78b2('0x3a')](_0x24841c[_0x78b2('0x33')][_0x78b2('0x3a')]);_0x5a742d[_0x78b2('0x3b')]=qs[_0x78b2('0x3c')](_[_0x78b2('0x3d')](_0x24841c['query'],_0x455484['filters']),_0x502dab);if(_0x24841c[_0x78b2('0x33')][_0x78b2('0x3e')]){_0x5a742d[_0x78b2('0x3b')]=_[_0x78b2('0x3f')](_0x5a742d[_0x78b2('0x3b')],{'$or':_[_0x78b2('0x2c')](_0x502dab,function(_0x3614ad){if(_0x3614ad[_0x78b2('0x2f')]!==_0x78b2('0x40')){var _0x1c6611={};_0x1c6611[_0x3614ad[_0x78b2('0x32')]]={'$like':'%'+_0x24841c['query'][_0x78b2('0x3e')]+'%'};return _0x1c6611;}})});}_0x5a742d=_[_0x78b2('0x3f')]({},_0x5a742d,_0x24841c[_0x78b2('0x41')]);var _0x1a380e={'where':_0x5a742d['where']};return db[_0x78b2('0x2d')]['count'](_0x1a380e)[_0x78b2('0x25')](function(_0x20b6f1){_0x2f1c75['count']=_0x20b6f1;if(_0x24841c['query'][_0x78b2('0x42')]){_0x5a742d[_0x78b2('0x43')]=[{'all':!![]}];}return db[_0x78b2('0x2d')][_0x78b2('0x44')](_0x5a742d);})['then'](function(_0x4d7508){_0x2f1c75['rows']=_0x4d7508;return _0x2f1c75;})[_0x78b2('0x25')](respondWithFilteredResult(_0x48c354,_0x5a742d))[_0x78b2('0x45')](handleError(_0x48c354,null));};exports['show']=function(_0x41f7ea,_0x5b9216){var _0x143e26={'raw':![],'where':{'id':_0x41f7ea[_0x78b2('0x46')]['id']}},_0x4830c8={};_0x4830c8['model']=_[_0x78b2('0x34')](db[_0x78b2('0x2d')][_0x78b2('0x47')]);_0x4830c8[_0x78b2('0x33')]=_[_0x78b2('0x34')](_0x41f7ea[_0x78b2('0x33')]);_0x4830c8[_0x78b2('0x3c')]=_[_0x78b2('0x35')](_0x4830c8[_0x78b2('0x31')],_0x4830c8[_0x78b2('0x33')]);_0x143e26[_0x78b2('0x36')]=_['intersection'](_0x4830c8[_0x78b2('0x31')],qs[_0x78b2('0x37')](_0x41f7ea[_0x78b2('0x33')][_0x78b2('0x37')]));_0x143e26[_0x78b2('0x36')]=_0x143e26[_0x78b2('0x36')]['length']?_0x143e26[_0x78b2('0x36')]:_0x4830c8[_0x78b2('0x31')];if(_0x41f7ea[_0x78b2('0x33')][_0x78b2('0x42')]){_0x143e26[_0x78b2('0x43')]=[{'all':!![]}];}_0x143e26=_['merge']({},_0x143e26,_0x41f7ea[_0x78b2('0x41')]);return db[_0x78b2('0x2d')][_0x78b2('0x48')](_0x143e26)[_0x78b2('0x25')](handleEntityNotFound(_0x5b9216,null))['then'](respondWithResult(_0x5b9216,null))[_0x78b2('0x45')](handleError(_0x5b9216,null));};exports[_0x78b2('0x49')]=function(_0x53daa0,_0x40fc0e){return db['ZendeskConfiguration'][_0x78b2('0x49')](_0x53daa0[_0x78b2('0x4a')],{})[_0x78b2('0x25')](respondWithResult(_0x40fc0e,0xc9))[_0x78b2('0x45')](handleError(_0x40fc0e,null));};exports['update']=function(_0x559a9d,_0x1601f6){if(_0x559a9d[_0x78b2('0x4a')]['id']){delete _0x559a9d[_0x78b2('0x4a')]['id'];}return db['ZendeskConfiguration'][_0x78b2('0x48')]({'where':{'id':_0x559a9d[_0x78b2('0x46')]['id']}})[_0x78b2('0x25')](handleEntityNotFound(_0x1601f6,null))[_0x78b2('0x25')](saveUpdates(_0x559a9d[_0x78b2('0x4a')],null))[_0x78b2('0x25')](respondWithResult(_0x1601f6,null))[_0x78b2('0x45')](handleError(_0x1601f6,null));};exports[_0x78b2('0x26')]=function(_0x27ccb8,_0x52f6a2){return db[_0x78b2('0x2d')][_0x78b2('0x48')]({'where':{'id':_0x27ccb8[_0x78b2('0x46')]['id']}})['then'](handleEntityNotFound(_0x52f6a2,null))[_0x78b2('0x25')](removeEntity(_0x52f6a2,null))[_0x78b2('0x45')](handleError(_0x52f6a2,null));};exports['getFields']=function(_0x50d71c,_0x217878,_0xdf4568){var _0x3ff65b={};var _0x565ffa={};var _0x41715b;var _0x33f2ed;return db[_0x78b2('0x2d')]['findOne']({'where':{'id':_0x50d71c[_0x78b2('0x46')]['id']}})[_0x78b2('0x25')](handleEntityNotFound(_0x217878,null))[_0x78b2('0x25')](function(_0x211dfc){if(_0x211dfc){_0x41715b=_0x211dfc;_0x565ffa[_0x78b2('0x31')]=_[_0x78b2('0x34')](db[_0x78b2('0x4b')]['rawAttributes']);_0x565ffa['query']=_[_0x78b2('0x34')](_0x50d71c[_0x78b2('0x33')]);_0x565ffa[_0x78b2('0x3c')]=_[_0x78b2('0x35')](_0x565ffa['model'],_0x565ffa[_0x78b2('0x33')]);_0x3ff65b[_0x78b2('0x36')]=_[_0x78b2('0x35')](_0x565ffa[_0x78b2('0x31')],qs[_0x78b2('0x37')](_0x50d71c[_0x78b2('0x33')][_0x78b2('0x37')]));_0x3ff65b[_0x78b2('0x36')]=_0x3ff65b[_0x78b2('0x36')][_0x78b2('0x38')]?_0x3ff65b[_0x78b2('0x36')]:_0x565ffa['model'];_0x3ff65b[_0x78b2('0x4c')]=qs[_0x78b2('0x3a')](_0x50d71c['query']['sort']);_0x3ff65b[_0x78b2('0x3b')]=qs[_0x78b2('0x3c')](_[_0x78b2('0x3d')](_0x50d71c[_0x78b2('0x33')],_0x565ffa[_0x78b2('0x3c')]));if(_0x50d71c[_0x78b2('0x33')][_0x78b2('0x3e')]){_0x3ff65b[_0x78b2('0x3b')]=_[_0x78b2('0x3f')](_0x3ff65b[_0x78b2('0x3b')],{'$or':_[_0x78b2('0x2c')](_0x3ff65b['attributes'],function(_0x44b32a){var _0x1fa5ab={};_0x1fa5ab[_0x44b32a]={'$like':'%'+_0x50d71c[_0x78b2('0x33')][_0x78b2('0x3e')]+'%'};return _0x1fa5ab;})});}_0x3ff65b=_[_0x78b2('0x3f')]({},_0x3ff65b,_0x50d71c[_0x78b2('0x41')]);return _0x41715b['getFields'](_0x3ff65b);}})[_0x78b2('0x25')](function(_0x25a020){if(_0x25a020){_0x33f2ed=_0x25a020[_0x78b2('0x38')];if(!_0x50d71c[_0x78b2('0x33')][_0x78b2('0x4d')](_0x78b2('0x39'))){_0x3ff65b[_0x78b2('0x1f')]=qs[_0x78b2('0x1f')](_0x50d71c[_0x78b2('0x33')]['limit']);_0x3ff65b[_0x78b2('0x1d')]=qs[_0x78b2('0x1d')](_0x50d71c['query'][_0x78b2('0x1d')]);}return _0x41715b[_0x78b2('0x4e')](_0x3ff65b);}})['then'](function(_0x5699b3){if(_0x5699b3){return _0x5699b3?{'count':_0x33f2ed,'rows':_0x5699b3}:null;}})[_0x78b2('0x25')](respondWithResult(_0x217878,null))[_0x78b2('0x45')](handleError(_0x217878,null));};exports[_0x78b2('0x4f')]=function(_0x312d04,_0xb034e1,_0x219241){var _0x2758ec={};var _0x273a8d={};var _0x424aec;var _0x4ed492;return db[_0x78b2('0x2d')][_0x78b2('0x50')]({'where':{'id':_0x312d04[_0x78b2('0x46')]['id']}})['then'](handleEntityNotFound(_0xb034e1,null))[_0x78b2('0x25')](function(_0x1c3367){if(_0x1c3367){_0x424aec=_0x1c3367;_0x273a8d[_0x78b2('0x31')]=_[_0x78b2('0x34')](db[_0x78b2('0x4b')][_0x78b2('0x47')]);_0x273a8d[_0x78b2('0x33')]=_[_0x78b2('0x34')](_0x312d04['query']);_0x273a8d[_0x78b2('0x3c')]=_[_0x78b2('0x35')](_0x273a8d[_0x78b2('0x31')],_0x273a8d[_0x78b2('0x33')]);_0x2758ec[_0x78b2('0x36')]=_[_0x78b2('0x35')](_0x273a8d['model'],qs[_0x78b2('0x37')](_0x312d04['query'][_0x78b2('0x37')]));_0x2758ec['attributes']=_0x2758ec['attributes'][_0x78b2('0x38')]?_0x2758ec[_0x78b2('0x36')]:_0x273a8d[_0x78b2('0x31')];_0x2758ec[_0x78b2('0x4c')]=qs[_0x78b2('0x3a')](_0x312d04[_0x78b2('0x33')]['sort']);_0x2758ec['where']=qs[_0x78b2('0x3c')](_[_0x78b2('0x3d')](_0x312d04['query'],_0x273a8d[_0x78b2('0x3c')]));if(_0x312d04[_0x78b2('0x33')]['filter']){_0x2758ec[_0x78b2('0x3b')]=_[_0x78b2('0x3f')](_0x2758ec[_0x78b2('0x3b')],{'$or':_[_0x78b2('0x2c')](_0x2758ec[_0x78b2('0x36')],function(_0x1f25f8){var _0x1bde42={};_0x1bde42[_0x1f25f8]={'$like':'%'+_0x312d04[_0x78b2('0x33')]['filter']+'%'};return _0x1bde42;})});}_0x2758ec=_['merge']({},_0x2758ec,_0x312d04[_0x78b2('0x41')]);return _0x424aec[_0x78b2('0x4f')](_0x2758ec);}})['then'](function(_0x2ed572){if(_0x2ed572){_0x4ed492=_0x2ed572[_0x78b2('0x38')];if(!_0x312d04[_0x78b2('0x33')][_0x78b2('0x4d')](_0x78b2('0x39'))){_0x2758ec[_0x78b2('0x1f')]=qs[_0x78b2('0x1f')](_0x312d04[_0x78b2('0x33')]['limit']);_0x2758ec[_0x78b2('0x1d')]=qs[_0x78b2('0x1d')](_0x312d04['query'][_0x78b2('0x1d')]);}return _0x424aec[_0x78b2('0x4f')](_0x2758ec);}})[_0x78b2('0x25')](function(_0x5e2f70){if(_0x5e2f70){return _0x5e2f70?{'count':_0x4ed492,'rows':_0x5e2f70}:null;}})[_0x78b2('0x25')](respondWithResult(_0xb034e1,null))['catch'](handleError(_0xb034e1,null));};exports[_0x78b2('0x51')]=function(_0x5646d6,_0x29fd82,_0xf5f320){var _0x3c1516={};var _0x35f530={};var _0x26964d;var _0x15250a;return db[_0x78b2('0x2d')][_0x78b2('0x50')]({'where':{'id':_0x5646d6[_0x78b2('0x46')]['id']}})['then'](handleEntityNotFound(_0x29fd82,null))[_0x78b2('0x25')](function(_0x27a0db){if(_0x27a0db){_0x26964d=_0x27a0db;_0x35f530[_0x78b2('0x31')]=_[_0x78b2('0x34')](db[_0x78b2('0x4b')][_0x78b2('0x47')]);_0x35f530[_0x78b2('0x33')]=_[_0x78b2('0x34')](_0x5646d6['query']);_0x35f530[_0x78b2('0x3c')]=_[_0x78b2('0x35')](_0x35f530[_0x78b2('0x31')],_0x35f530[_0x78b2('0x33')]);_0x3c1516['attributes']=_[_0x78b2('0x35')](_0x35f530['model'],qs[_0x78b2('0x37')](_0x5646d6[_0x78b2('0x33')][_0x78b2('0x37')]));_0x3c1516[_0x78b2('0x36')]=_0x3c1516[_0x78b2('0x36')][_0x78b2('0x38')]?_0x3c1516['attributes']:_0x35f530[_0x78b2('0x31')];_0x3c1516[_0x78b2('0x4c')]=qs[_0x78b2('0x3a')](_0x5646d6[_0x78b2('0x33')][_0x78b2('0x3a')]);_0x3c1516['where']=qs[_0x78b2('0x3c')](_[_0x78b2('0x3d')](_0x5646d6[_0x78b2('0x33')],_0x35f530['filters']));if(_0x5646d6[_0x78b2('0x33')][_0x78b2('0x3e')]){_0x3c1516[_0x78b2('0x3b')]=_['merge'](_0x3c1516[_0x78b2('0x3b')],{'$or':_['map'](_0x3c1516[_0x78b2('0x36')],function(_0x3772e4){var _0x463223={};_0x463223[_0x3772e4]={'$like':'%'+_0x5646d6['query'][_0x78b2('0x3e')]+'%'};return _0x463223;})});}_0x3c1516=_[_0x78b2('0x3f')]({},_0x3c1516,_0x5646d6[_0x78b2('0x41')]);return _0x26964d['getDescriptions'](_0x3c1516);}})['then'](function(_0x9ef26d){if(_0x9ef26d){_0x15250a=_0x9ef26d['length'];if(!_0x5646d6[_0x78b2('0x33')]['hasOwnProperty'](_0x78b2('0x39'))){_0x3c1516[_0x78b2('0x1f')]=qs['limit'](_0x5646d6[_0x78b2('0x33')][_0x78b2('0x1f')]);_0x3c1516[_0x78b2('0x1d')]=qs[_0x78b2('0x1d')](_0x5646d6[_0x78b2('0x33')][_0x78b2('0x1d')]);}return _0x26964d['getDescriptions'](_0x3c1516);}})['then'](function(_0x1b8a4e){if(_0x1b8a4e){return _0x1b8a4e?{'count':_0x15250a,'rows':_0x1b8a4e}:null;}})[_0x78b2('0x25')](respondWithResult(_0x29fd82,null))[_0x78b2('0x45')](handleError(_0x29fd82,null));};exports['getTags']=function(_0x185e0c,_0x5f2a88,_0x1b450b){var _0xa79ac4={};var _0x5eeffc={};var _0x5b552e;var _0x310ccd;return db[_0x78b2('0x2d')]['findOne']({'where':{'id':_0x185e0c[_0x78b2('0x46')]['id']}})[_0x78b2('0x25')](handleEntityNotFound(_0x5f2a88,null))[_0x78b2('0x25')](function(_0x2bd12d){if(_0x2bd12d){_0x5b552e=_0x2bd12d;_0x5eeffc[_0x78b2('0x31')]=_[_0x78b2('0x34')](db['Tag'][_0x78b2('0x47')]);_0x5eeffc[_0x78b2('0x33')]=_[_0x78b2('0x34')](_0x185e0c[_0x78b2('0x33')]);_0x5eeffc['filters']=_[_0x78b2('0x35')](_0x5eeffc['model'],_0x5eeffc[_0x78b2('0x33')]);_0xa79ac4[_0x78b2('0x36')]=_[_0x78b2('0x35')](_0x5eeffc[_0x78b2('0x31')],qs[_0x78b2('0x37')](_0x185e0c[_0x78b2('0x33')][_0x78b2('0x37')]));_0xa79ac4['attributes']=_0xa79ac4[_0x78b2('0x36')]['length']?_0xa79ac4[_0x78b2('0x36')]:_0x5eeffc[_0x78b2('0x31')];_0xa79ac4[_0x78b2('0x4c')]=qs[_0x78b2('0x3a')](_0x185e0c['query'][_0x78b2('0x3a')]);_0xa79ac4[_0x78b2('0x3b')]=qs['filters'](_['pick'](_0x185e0c[_0x78b2('0x33')],_0x5eeffc['filters']));if(_0x185e0c[_0x78b2('0x33')][_0x78b2('0x3e')]){_0xa79ac4[_0x78b2('0x3b')]=_[_0x78b2('0x3f')](_0xa79ac4[_0x78b2('0x3b')],{'$or':_[_0x78b2('0x2c')](_0xa79ac4[_0x78b2('0x36')],function(_0x4e951e){var _0x3539de={};_0x3539de[_0x4e951e]={'$like':'%'+_0x185e0c[_0x78b2('0x33')][_0x78b2('0x3e')]+'%'};return _0x3539de;})});}_0xa79ac4=_['merge']({},_0xa79ac4,_0x185e0c[_0x78b2('0x41')]);return _0x5b552e['getTags'](_0xa79ac4);}})[_0x78b2('0x25')](function(_0x4a758c){if(_0x4a758c){_0x310ccd=_0x4a758c['length'];if(!_0x185e0c[_0x78b2('0x33')]['hasOwnProperty'](_0x78b2('0x39'))){_0xa79ac4[_0x78b2('0x1f')]=qs['limit'](_0x185e0c['query'][_0x78b2('0x1f')]);_0xa79ac4[_0x78b2('0x1d')]=qs[_0x78b2('0x1d')](_0x185e0c[_0x78b2('0x33')][_0x78b2('0x1d')]);}return _0x5b552e[_0x78b2('0x52')](_0xa79ac4);}})['then'](function(_0x43b2e0){if(_0x43b2e0){return _0x43b2e0?{'count':_0x310ccd,'rows':_0x43b2e0}:null;}})[_0x78b2('0x25')](respondWithResult(_0x5f2a88,null))[_0x78b2('0x45')](handleError(_0x5f2a88,null));};exports[_0x78b2('0x53')]=function(_0x563f2a,_0x2d908b,_0x4987aa){if(_0x563f2a['body']['id']){delete _0x563f2a[_0x78b2('0x4a')]['id'];}return db['ZendeskConfiguration'][_0x78b2('0x50')]({'where':{'id':_0x563f2a[_0x78b2('0x46')]['id']}})[_0x78b2('0x25')](handleEntityNotFound(_0x2d908b,null))[_0x78b2('0x25')](function(_0x6c46d7){if(_0x6c46d7){return _0x6c46d7[_0x78b2('0x53')](_0x563f2a[_0x78b2('0x4a')][_0x78b2('0x54')]||[]);}return null;})[_0x78b2('0x25')](respondWithResult(_0x2d908b,null))[_0x78b2('0x45')](handleError(_0x2d908b,null));}; \ No newline at end of file +var _0x1344=['fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','keys','length','find','create','body','update','findOne','ZendeskField','getFields','getSubjects','getDescriptions','getTags','setTags','ids','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','destroy','then','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','key','query','filters','model','attributes','intersection'];(function(_0x5c0d15,_0xeb0146){var _0x1ad646=function(_0x4333c1){while(--_0x4333c1){_0x5c0d15['push'](_0x5c0d15['shift']());}};_0x1ad646(++_0xeb0146);}(_0x1344,0xbd));var _0x4134=function(_0x468a77,_0x1382be){_0x468a77=_0x468a77-0x0;var _0x2d1c33=_0x1344[_0x468a77];return _0x2d1c33;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4134('0x0'));var jsonpatch=require(_0x4134('0x1'));var rp=require('request-promise');var moment=require(_0x4134('0x2'));var BPromise=require(_0x4134('0x3'));var Mustache=require(_0x4134('0x4'));var util=require('util');var path=require(_0x4134('0x5'));var sox=require(_0x4134('0x6'));var csv=require(_0x4134('0x7'));var ejs=require(_0x4134('0x8'));var fs=require('fs');var fs_extra=require(_0x4134('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4134('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4134('0xb'));var toCsv=require(_0x4134('0x7'));var querystring=require(_0x4134('0xc'));var Papa=require(_0x4134('0xd'));var Redis=require(_0x4134('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4134('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4134('0x10'));var logger=require('../../config/logger')(_0x4134('0x11'));var utils=require(_0x4134('0x12'));var config=require(_0x4134('0x13'));var licenseUtil=require(_0x4134('0x14'));var db=require(_0x4134('0x15'))['db'];function respondWithStatusCode(_0x13c32f,_0xf9722a){_0xf9722a=_0xf9722a||0xcc;return function(_0x56f691){if(_0x56f691){return _0x13c32f[_0x4134('0x16')](_0xf9722a);}return _0x13c32f[_0x4134('0x17')](_0xf9722a)[_0x4134('0x18')]();};}function respondWithResult(_0x960f81,_0x3226cc){_0x3226cc=_0x3226cc||0xc8;return function(_0x5a3722){if(_0x5a3722){return _0x960f81['status'](_0x3226cc)[_0x4134('0x19')](_0x5a3722);}};}function respondWithFilteredResult(_0x3db5fb,_0x2e6357){return function(_0x152934){if(_0x152934){var _0x14b215=typeof _0x2e6357[_0x4134('0x1a')]===_0x4134('0x1b')&&typeof _0x2e6357[_0x4134('0x1c')]===_0x4134('0x1b');var _0x1354a3=_0x152934[_0x4134('0x1d')];var _0x4da1ef=_0x14b215?0x0:_0x2e6357[_0x4134('0x1a')];var _0x346d35=_0x14b215?_0x152934[_0x4134('0x1d')]:_0x2e6357[_0x4134('0x1a')]+_0x2e6357[_0x4134('0x1c')];var _0x29b3e2;if(_0x346d35>=_0x1354a3){_0x346d35=_0x1354a3;_0x29b3e2=0xc8;}else{_0x29b3e2=0xce;}_0x3db5fb[_0x4134('0x17')](_0x29b3e2);return _0x3db5fb[_0x4134('0x1e')]('Content-Range',_0x4da1ef+'-'+_0x346d35+'/'+_0x1354a3)[_0x4134('0x19')](_0x152934);}return null;};}function patchUpdates(_0x1b551d){return function(_0x31f0bf){try{jsonpatch[_0x4134('0x1f')](_0x31f0bf,_0x1b551d,!![]);}catch(_0x503218){return BPromise['reject'](_0x503218);}return _0x31f0bf[_0x4134('0x20')]();};}function saveUpdates(_0x539e0b,_0x47fe78){return function(_0x193516){if(_0x193516){return _0x193516['update'](_0x539e0b)['then'](function(_0xfd2d44){return _0xfd2d44;});}return null;};}function removeEntity(_0x867a3f,_0x1495cb){return function(_0x4ae977){if(_0x4ae977){return _0x4ae977[_0x4134('0x21')]()[_0x4134('0x22')](function(){_0x867a3f[_0x4134('0x17')](0xcc)[_0x4134('0x18')]();});}};}function handleEntityNotFound(_0x14f140,_0x12c7e8){return function(_0xd05055){if(!_0xd05055){_0x14f140[_0x4134('0x16')](0x194);}return _0xd05055;};}function handleError(_0x117e50,_0x2fb9f8){_0x2fb9f8=_0x2fb9f8||0x1f4;return function(_0x14bbd6){logger['error'](_0x14bbd6['stack']);if(_0x14bbd6[_0x4134('0x23')]){delete _0x14bbd6[_0x4134('0x23')];}_0x117e50[_0x4134('0x17')](_0x2fb9f8)[_0x4134('0x24')](_0x14bbd6);};}exports[_0x4134('0x25')]=function(_0x5558ef,_0x1011cd){var _0x3c5f7b={},_0x211854={},_0xc2f24d={'count':0x0,'rows':[]};var _0x180762=_[_0x4134('0x26')](db[_0x4134('0x27')][_0x4134('0x28')],function(_0x23f148){return{'name':_0x23f148[_0x4134('0x29')],'type':_0x23f148['type'][_0x4134('0x2a')]};});_0x211854['model']=_[_0x4134('0x26')](_0x180762,_0x4134('0x23'));_0x211854['query']=_['keys'](_0x5558ef[_0x4134('0x2b')]);_0x211854[_0x4134('0x2c')]=_['intersection'](_0x211854[_0x4134('0x2d')],_0x211854[_0x4134('0x2b')]);_0x3c5f7b[_0x4134('0x2e')]=_[_0x4134('0x2f')](_0x211854[_0x4134('0x2d')],qs['fields'](_0x5558ef[_0x4134('0x2b')][_0x4134('0x30')]));_0x3c5f7b[_0x4134('0x2e')]=_0x3c5f7b['attributes']['length']?_0x3c5f7b[_0x4134('0x2e')]:_0x211854[_0x4134('0x2d')];if(!_0x5558ef[_0x4134('0x2b')][_0x4134('0x31')](_0x4134('0x32'))){_0x3c5f7b[_0x4134('0x1c')]=qs[_0x4134('0x1c')](_0x5558ef[_0x4134('0x2b')][_0x4134('0x1c')]);_0x3c5f7b['offset']=qs[_0x4134('0x1a')](_0x5558ef['query'][_0x4134('0x1a')]);}_0x3c5f7b[_0x4134('0x33')]=qs[_0x4134('0x34')](_0x5558ef[_0x4134('0x2b')][_0x4134('0x34')]);_0x3c5f7b[_0x4134('0x35')]=qs[_0x4134('0x2c')](_[_0x4134('0x36')](_0x5558ef['query'],_0x211854['filters']),_0x180762);if(_0x5558ef[_0x4134('0x2b')][_0x4134('0x37')]){_0x3c5f7b['where']=_[_0x4134('0x38')](_0x3c5f7b[_0x4134('0x35')],{'$or':_[_0x4134('0x26')](_0x180762,function(_0x51512a){if(_0x51512a[_0x4134('0x39')]!==_0x4134('0x3a')){var _0x39bdd9={};_0x39bdd9[_0x51512a['name']]={'$like':'%'+_0x5558ef['query'][_0x4134('0x37')]+'%'};return _0x39bdd9;}})});}_0x3c5f7b=_[_0x4134('0x38')]({},_0x3c5f7b,_0x5558ef[_0x4134('0x3b')]);var _0x479fa6={'where':_0x3c5f7b[_0x4134('0x35')]};return db[_0x4134('0x27')][_0x4134('0x1d')](_0x479fa6)[_0x4134('0x22')](function(_0x50b31){_0xc2f24d[_0x4134('0x1d')]=_0x50b31;if(_0x5558ef[_0x4134('0x2b')][_0x4134('0x3c')]){_0x3c5f7b[_0x4134('0x3d')]=[{'all':!![]}];}return db[_0x4134('0x27')]['findAll'](_0x3c5f7b);})[_0x4134('0x22')](function(_0x5268d4){_0xc2f24d[_0x4134('0x3e')]=_0x5268d4;return _0xc2f24d;})[_0x4134('0x22')](respondWithFilteredResult(_0x1011cd,_0x3c5f7b))[_0x4134('0x3f')](handleError(_0x1011cd,null));};exports['show']=function(_0x233c81,_0x4371ce){var _0x34c339={'raw':![],'where':{'id':_0x233c81[_0x4134('0x40')]['id']}},_0x24f17f={};_0x24f17f[_0x4134('0x2d')]=_['keys'](db[_0x4134('0x27')][_0x4134('0x28')]);_0x24f17f['query']=_[_0x4134('0x41')](_0x233c81[_0x4134('0x2b')]);_0x24f17f['filters']=_[_0x4134('0x2f')](_0x24f17f[_0x4134('0x2d')],_0x24f17f[_0x4134('0x2b')]);_0x34c339[_0x4134('0x2e')]=_[_0x4134('0x2f')](_0x24f17f[_0x4134('0x2d')],qs['fields'](_0x233c81[_0x4134('0x2b')][_0x4134('0x30')]));_0x34c339[_0x4134('0x2e')]=_0x34c339[_0x4134('0x2e')][_0x4134('0x42')]?_0x34c339['attributes']:_0x24f17f[_0x4134('0x2d')];if(_0x233c81['query'][_0x4134('0x3c')]){_0x34c339[_0x4134('0x3d')]=[{'all':!![]}];}_0x34c339=_['merge']({},_0x34c339,_0x233c81[_0x4134('0x3b')]);return db[_0x4134('0x27')][_0x4134('0x43')](_0x34c339)[_0x4134('0x22')](handleEntityNotFound(_0x4371ce,null))[_0x4134('0x22')](respondWithResult(_0x4371ce,null))[_0x4134('0x3f')](handleError(_0x4371ce,null));};exports[_0x4134('0x44')]=function(_0xa65745,_0x25bf65){return db['ZendeskConfiguration'][_0x4134('0x44')](_0xa65745[_0x4134('0x45')],{})[_0x4134('0x22')](respondWithResult(_0x25bf65,0xc9))[_0x4134('0x3f')](handleError(_0x25bf65,null));};exports[_0x4134('0x46')]=function(_0x1d695a,_0x4c4b95){if(_0x1d695a[_0x4134('0x45')]['id']){delete _0x1d695a['body']['id'];}return db[_0x4134('0x27')][_0x4134('0x43')]({'where':{'id':_0x1d695a[_0x4134('0x40')]['id']}})['then'](handleEntityNotFound(_0x4c4b95,null))[_0x4134('0x22')](saveUpdates(_0x1d695a[_0x4134('0x45')],null))['then'](respondWithResult(_0x4c4b95,null))[_0x4134('0x3f')](handleError(_0x4c4b95,null));};exports[_0x4134('0x21')]=function(_0x16ebf6,_0xff7baa){return db[_0x4134('0x27')][_0x4134('0x43')]({'where':{'id':_0x16ebf6[_0x4134('0x40')]['id']}})['then'](handleEntityNotFound(_0xff7baa,null))['then'](removeEntity(_0xff7baa,null))[_0x4134('0x3f')](handleError(_0xff7baa,null));};exports['getFields']=function(_0x532113,_0x2a0a3a,_0x565127){var _0x36a638={};var _0x5b6860={};var _0x2b274a;var _0xcc3470;return db[_0x4134('0x27')][_0x4134('0x47')]({'where':{'id':_0x532113[_0x4134('0x40')]['id']}})['then'](handleEntityNotFound(_0x2a0a3a,null))['then'](function(_0xf2d88d){if(_0xf2d88d){_0x2b274a=_0xf2d88d;_0x5b6860[_0x4134('0x2d')]=_[_0x4134('0x41')](db[_0x4134('0x48')][_0x4134('0x28')]);_0x5b6860['query']=_[_0x4134('0x41')](_0x532113[_0x4134('0x2b')]);_0x5b6860[_0x4134('0x2c')]=_[_0x4134('0x2f')](_0x5b6860[_0x4134('0x2d')],_0x5b6860['query']);_0x36a638[_0x4134('0x2e')]=_['intersection'](_0x5b6860[_0x4134('0x2d')],qs[_0x4134('0x30')](_0x532113[_0x4134('0x2b')]['fields']));_0x36a638[_0x4134('0x2e')]=_0x36a638[_0x4134('0x2e')][_0x4134('0x42')]?_0x36a638[_0x4134('0x2e')]:_0x5b6860[_0x4134('0x2d')];_0x36a638[_0x4134('0x33')]=qs[_0x4134('0x34')](_0x532113['query'][_0x4134('0x34')]);_0x36a638[_0x4134('0x35')]=qs[_0x4134('0x2c')](_[_0x4134('0x36')](_0x532113['query'],_0x5b6860['filters']));if(_0x532113[_0x4134('0x2b')][_0x4134('0x37')]){_0x36a638[_0x4134('0x35')]=_[_0x4134('0x38')](_0x36a638[_0x4134('0x35')],{'$or':_[_0x4134('0x26')](_0x36a638[_0x4134('0x2e')],function(_0x12b501){var _0x50e23c={};_0x50e23c[_0x12b501]={'$like':'%'+_0x532113[_0x4134('0x2b')][_0x4134('0x37')]+'%'};return _0x50e23c;})});}_0x36a638=_[_0x4134('0x38')]({},_0x36a638,_0x532113[_0x4134('0x3b')]);return _0x2b274a[_0x4134('0x49')](_0x36a638);}})['then'](function(_0x399eab){if(_0x399eab){_0xcc3470=_0x399eab[_0x4134('0x42')];if(!_0x532113[_0x4134('0x2b')]['hasOwnProperty']('nolimit')){_0x36a638[_0x4134('0x1c')]=qs[_0x4134('0x1c')](_0x532113[_0x4134('0x2b')]['limit']);_0x36a638[_0x4134('0x1a')]=qs[_0x4134('0x1a')](_0x532113[_0x4134('0x2b')][_0x4134('0x1a')]);}return _0x2b274a[_0x4134('0x49')](_0x36a638);}})['then'](function(_0x521305){if(_0x521305){return _0x521305?{'count':_0xcc3470,'rows':_0x521305}:null;}})[_0x4134('0x22')](respondWithResult(_0x2a0a3a,null))[_0x4134('0x3f')](handleError(_0x2a0a3a,null));};exports[_0x4134('0x4a')]=function(_0xbc1ed9,_0x359ee1,_0x31f9f5){var _0x15255c={};var _0x291ea5={};var _0x3d7f60;var _0x1c2a07;return db[_0x4134('0x27')]['findOne']({'where':{'id':_0xbc1ed9['params']['id']}})[_0x4134('0x22')](handleEntityNotFound(_0x359ee1,null))['then'](function(_0x5d5eda){if(_0x5d5eda){_0x3d7f60=_0x5d5eda;_0x291ea5[_0x4134('0x2d')]=_[_0x4134('0x41')](db['ZendeskField']['rawAttributes']);_0x291ea5[_0x4134('0x2b')]=_[_0x4134('0x41')](_0xbc1ed9[_0x4134('0x2b')]);_0x291ea5[_0x4134('0x2c')]=_['intersection'](_0x291ea5[_0x4134('0x2d')],_0x291ea5[_0x4134('0x2b')]);_0x15255c[_0x4134('0x2e')]=_[_0x4134('0x2f')](_0x291ea5['model'],qs[_0x4134('0x30')](_0xbc1ed9[_0x4134('0x2b')][_0x4134('0x30')]));_0x15255c[_0x4134('0x2e')]=_0x15255c['attributes'][_0x4134('0x42')]?_0x15255c[_0x4134('0x2e')]:_0x291ea5['model'];_0x15255c['order']=qs[_0x4134('0x34')](_0xbc1ed9[_0x4134('0x2b')][_0x4134('0x34')]);_0x15255c[_0x4134('0x35')]=qs[_0x4134('0x2c')](_[_0x4134('0x36')](_0xbc1ed9[_0x4134('0x2b')],_0x291ea5['filters']));if(_0xbc1ed9[_0x4134('0x2b')]['filter']){_0x15255c[_0x4134('0x35')]=_[_0x4134('0x38')](_0x15255c[_0x4134('0x35')],{'$or':_[_0x4134('0x26')](_0x15255c[_0x4134('0x2e')],function(_0x1791e6){var _0xa80c1d={};_0xa80c1d[_0x1791e6]={'$like':'%'+_0xbc1ed9[_0x4134('0x2b')][_0x4134('0x37')]+'%'};return _0xa80c1d;})});}_0x15255c=_[_0x4134('0x38')]({},_0x15255c,_0xbc1ed9[_0x4134('0x3b')]);return _0x3d7f60[_0x4134('0x4a')](_0x15255c);}})[_0x4134('0x22')](function(_0x1cfe8a){if(_0x1cfe8a){_0x1c2a07=_0x1cfe8a['length'];if(!_0xbc1ed9[_0x4134('0x2b')][_0x4134('0x31')]('nolimit')){_0x15255c['limit']=qs[_0x4134('0x1c')](_0xbc1ed9[_0x4134('0x2b')][_0x4134('0x1c')]);_0x15255c[_0x4134('0x1a')]=qs[_0x4134('0x1a')](_0xbc1ed9[_0x4134('0x2b')][_0x4134('0x1a')]);}return _0x3d7f60[_0x4134('0x4a')](_0x15255c);}})[_0x4134('0x22')](function(_0x5e3347){if(_0x5e3347){return _0x5e3347?{'count':_0x1c2a07,'rows':_0x5e3347}:null;}})['then'](respondWithResult(_0x359ee1,null))['catch'](handleError(_0x359ee1,null));};exports['getDescriptions']=function(_0x19e0a1,_0x294d53,_0x40aff6){var _0x2e30b9={};var _0x4930={};var _0x3f67ae;var _0x3e31b9;return db[_0x4134('0x27')][_0x4134('0x47')]({'where':{'id':_0x19e0a1[_0x4134('0x40')]['id']}})['then'](handleEntityNotFound(_0x294d53,null))['then'](function(_0x38be25){if(_0x38be25){_0x3f67ae=_0x38be25;_0x4930[_0x4134('0x2d')]=_['keys'](db[_0x4134('0x48')]['rawAttributes']);_0x4930['query']=_[_0x4134('0x41')](_0x19e0a1[_0x4134('0x2b')]);_0x4930[_0x4134('0x2c')]=_[_0x4134('0x2f')](_0x4930[_0x4134('0x2d')],_0x4930['query']);_0x2e30b9[_0x4134('0x2e')]=_[_0x4134('0x2f')](_0x4930['model'],qs[_0x4134('0x30')](_0x19e0a1['query']['fields']));_0x2e30b9['attributes']=_0x2e30b9[_0x4134('0x2e')][_0x4134('0x42')]?_0x2e30b9[_0x4134('0x2e')]:_0x4930[_0x4134('0x2d')];_0x2e30b9[_0x4134('0x33')]=qs['sort'](_0x19e0a1[_0x4134('0x2b')][_0x4134('0x34')]);_0x2e30b9[_0x4134('0x35')]=qs[_0x4134('0x2c')](_[_0x4134('0x36')](_0x19e0a1[_0x4134('0x2b')],_0x4930[_0x4134('0x2c')]));if(_0x19e0a1[_0x4134('0x2b')][_0x4134('0x37')]){_0x2e30b9[_0x4134('0x35')]=_['merge'](_0x2e30b9['where'],{'$or':_[_0x4134('0x26')](_0x2e30b9[_0x4134('0x2e')],function(_0x407398){var _0x45f07c={};_0x45f07c[_0x407398]={'$like':'%'+_0x19e0a1[_0x4134('0x2b')][_0x4134('0x37')]+'%'};return _0x45f07c;})});}_0x2e30b9=_['merge']({},_0x2e30b9,_0x19e0a1[_0x4134('0x3b')]);return _0x3f67ae[_0x4134('0x4b')](_0x2e30b9);}})[_0x4134('0x22')](function(_0x4210c8){if(_0x4210c8){_0x3e31b9=_0x4210c8[_0x4134('0x42')];if(!_0x19e0a1[_0x4134('0x2b')]['hasOwnProperty'](_0x4134('0x32'))){_0x2e30b9['limit']=qs['limit'](_0x19e0a1['query'][_0x4134('0x1c')]);_0x2e30b9[_0x4134('0x1a')]=qs[_0x4134('0x1a')](_0x19e0a1[_0x4134('0x2b')][_0x4134('0x1a')]);}return _0x3f67ae[_0x4134('0x4b')](_0x2e30b9);}})['then'](function(_0x18e554){if(_0x18e554){return _0x18e554?{'count':_0x3e31b9,'rows':_0x18e554}:null;}})['then'](respondWithResult(_0x294d53,null))['catch'](handleError(_0x294d53,null));};exports[_0x4134('0x4c')]=function(_0x38dd5d,_0x252594,_0x37e4f6){var _0x1aef1f={};var _0x82351d={};var _0x5504d6;var _0xd22859;return db[_0x4134('0x27')]['findOne']({'where':{'id':_0x38dd5d[_0x4134('0x40')]['id']}})['then'](handleEntityNotFound(_0x252594,null))[_0x4134('0x22')](function(_0x1de597){if(_0x1de597){_0x5504d6=_0x1de597;_0x82351d[_0x4134('0x2d')]=_[_0x4134('0x41')](db['Tag'][_0x4134('0x28')]);_0x82351d[_0x4134('0x2b')]=_[_0x4134('0x41')](_0x38dd5d[_0x4134('0x2b')]);_0x82351d[_0x4134('0x2c')]=_[_0x4134('0x2f')](_0x82351d[_0x4134('0x2d')],_0x82351d[_0x4134('0x2b')]);_0x1aef1f[_0x4134('0x2e')]=_[_0x4134('0x2f')](_0x82351d[_0x4134('0x2d')],qs[_0x4134('0x30')](_0x38dd5d[_0x4134('0x2b')][_0x4134('0x30')]));_0x1aef1f[_0x4134('0x2e')]=_0x1aef1f['attributes'][_0x4134('0x42')]?_0x1aef1f[_0x4134('0x2e')]:_0x82351d[_0x4134('0x2d')];_0x1aef1f[_0x4134('0x33')]=qs[_0x4134('0x34')](_0x38dd5d[_0x4134('0x2b')][_0x4134('0x34')]);_0x1aef1f[_0x4134('0x35')]=qs[_0x4134('0x2c')](_[_0x4134('0x36')](_0x38dd5d['query'],_0x82351d[_0x4134('0x2c')]));if(_0x38dd5d[_0x4134('0x2b')][_0x4134('0x37')]){_0x1aef1f[_0x4134('0x35')]=_['merge'](_0x1aef1f['where'],{'$or':_['map'](_0x1aef1f[_0x4134('0x2e')],function(_0x43257f){var _0x1e9b5a={};_0x1e9b5a[_0x43257f]={'$like':'%'+_0x38dd5d[_0x4134('0x2b')][_0x4134('0x37')]+'%'};return _0x1e9b5a;})});}_0x1aef1f=_['merge']({},_0x1aef1f,_0x38dd5d[_0x4134('0x3b')]);return _0x5504d6['getTags'](_0x1aef1f);}})[_0x4134('0x22')](function(_0x363952){if(_0x363952){_0xd22859=_0x363952[_0x4134('0x42')];if(!_0x38dd5d[_0x4134('0x2b')][_0x4134('0x31')](_0x4134('0x32'))){_0x1aef1f[_0x4134('0x1c')]=qs[_0x4134('0x1c')](_0x38dd5d[_0x4134('0x2b')]['limit']);_0x1aef1f[_0x4134('0x1a')]=qs[_0x4134('0x1a')](_0x38dd5d[_0x4134('0x2b')][_0x4134('0x1a')]);}return _0x5504d6[_0x4134('0x4c')](_0x1aef1f);}})['then'](function(_0x74fa9e){if(_0x74fa9e){return _0x74fa9e?{'count':_0xd22859,'rows':_0x74fa9e}:null;}})[_0x4134('0x22')](respondWithResult(_0x252594,null))[_0x4134('0x3f')](handleError(_0x252594,null));};exports['setTags']=function(_0x4e440a,_0x14fdea,_0x594a0d){if(_0x4e440a['body']['id']){delete _0x4e440a[_0x4134('0x45')]['id'];}return db['ZendeskConfiguration'][_0x4134('0x47')]({'where':{'id':_0x4e440a[_0x4134('0x40')]['id']}})[_0x4134('0x22')](handleEntityNotFound(_0x14fdea,null))[_0x4134('0x22')](function(_0x337b56){if(_0x337b56){return _0x337b56[_0x4134('0x4d')](_0x4e440a['body'][_0x4134('0x4e')]||[]);}return null;})[_0x4134('0x22')](respondWithResult(_0x14fdea,null))[_0x4134('0x3f')](handleError(_0x14fdea,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 610876b..f66f0d6 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 _0xd4f4=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define','ZendeskConfiguration','int_zendesk_configurations','lodash'];(function(_0x15942a,_0x13b58c){var _0x36a9fb=function(_0x549c27){while(--_0x549c27){_0x15942a['push'](_0x15942a['shift']());}};_0x36a9fb(++_0x13b58c);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x1c81b3,_0x52d034){_0x1c81b3=_0x1c81b3-0x0;var _0x2c645a=_0xd4f4[_0x1c81b3];return _0x2c645a;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var logger=require(_0x4d4f('0x2'))(_0x4d4f('0x3'));var moment=require(_0x4d4f('0x4'));var BPromise=require(_0x4d4f('0x5'));var rp=require(_0x4d4f('0x6'));var fs=require('fs');var path=require(_0x4d4f('0x7'));var rimraf=require(_0x4d4f('0x8'));var config=require(_0x4d4f('0x9'));var attributes=require(_0x4d4f('0xa'));module['exports']=function(_0x5f451b,_0x5e38d2){return _0x5f451b[_0x4d4f('0xb')](_0x4d4f('0xc'),attributes,{'tableName':_0x4d4f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea28=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2d4d90,_0x523c3d){var _0x58cfc7=function(_0x418e6b){while(--_0x418e6b){_0x2d4d90['push'](_0x2d4d90['shift']());}};_0x58cfc7(++_0x523c3d);}(_0xea28,0x13a));var _0x8ea2=function(_0x4b9c5c,_0x56decf){_0x4b9c5c=_0x4b9c5c-0x0;var _0x47dd0b=_0xea28[_0x4b9c5c];return _0x47dd0b;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var logger=require(_0x8ea2('0x2'))(_0x8ea2('0x3'));var moment=require(_0x8ea2('0x4'));var BPromise=require(_0x8ea2('0x5'));var rp=require(_0x8ea2('0x6'));var fs=require('fs');var path=require(_0x8ea2('0x7'));var rimraf=require('rimraf');var config=require(_0x8ea2('0x8'));var attributes=require(_0x8ea2('0x9'));module[_0x8ea2('0xa')]=function(_0x513a0d,_0x29b82b){return _0x513a0d[_0x8ea2('0xb')](_0x8ea2('0xc'),attributes,{'tableName':_0x8ea2('0xd'),'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 5446c05..9f99d3b 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 _0x6b51=['client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x40887b,_0x596373){var _0x28b61a=function(_0x47d7c8){while(--_0x47d7c8){_0x40887b['push'](_0x40887b['shift']());}};_0x28b61a(++_0x596373);}(_0x6b51,0x146));var _0x16b5=function(_0x5d4cbc,_0x4ba0c1){_0x5d4cbc=_0x5d4cbc-0x0;var _0x4f990b=_0x6b51[_0x5d4cbc];return _0x4f990b;};'use strict';var _=require(_0x16b5('0x0'));var util=require(_0x16b5('0x1'));var moment=require(_0x16b5('0x2'));var BPromise=require('bluebird');var rs=require(_0x16b5('0x3'));var fs=require('fs');var Redis=require(_0x16b5('0x4'));var db=require(_0x16b5('0x5'))['db'];var utils=require(_0x16b5('0x6'));var logger=require(_0x16b5('0x7'))(_0x16b5('0x8'));var config=require('../../config/environment');var jayson=require(_0x16b5('0x9'));var client=jayson[_0x16b5('0xa')][_0x16b5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58ca02,_0x1d5334,_0x34cf0a){return new BPromise(function(_0xee5c9,_0x43436a){return client['request'](_0x58ca02,_0x34cf0a)[_0x16b5('0xc')](function(_0x244ad3){logger[_0x16b5('0xd')](_0x16b5('0xe'),_0x1d5334,_0x16b5('0xf'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1d5334,_0x16b5('0xf'),JSON['stringify'](_0x244ad3));if(_0x244ad3[_0x16b5('0x10')]){if(_0x244ad3[_0x16b5('0x10')][_0x16b5('0x11')]===0x1f4){logger[_0x16b5('0x10')](_0x16b5('0xe'),_0x1d5334,_0x244ad3[_0x16b5('0x10')]['message']);return _0x43436a(_0x244ad3[_0x16b5('0x10')][_0x16b5('0x12')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x1d5334,_0x244ad3[_0x16b5('0x10')][_0x16b5('0x12')]);return _0xee5c9(_0x244ad3[_0x16b5('0x10')][_0x16b5('0x12')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x1d5334,_0x16b5('0xf'));_0xee5c9(_0x244ad3[_0x16b5('0x13')]['message']);}})[_0x16b5('0x14')](function(_0x205adc){logger[_0x16b5('0x10')](_0x16b5('0xe'),_0x1d5334,_0x205adc);_0x43436a(_0x205adc);});});} \ No newline at end of file +var _0x9fc2=['client','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x14a80f,_0x194c7a){var _0x48ee9c=function(_0x295277){while(--_0x295277){_0x14a80f['push'](_0x14a80f['shift']());}};_0x48ee9c(++_0x194c7a);}(_0x9fc2,0x171));var _0x29fc=function(_0x1af90e,_0x613cc2){_0x1af90e=_0x1af90e-0x0;var _0x430138=_0x9fc2[_0x1af90e];return _0x430138;};'use strict';var _=require(_0x29fc('0x0'));var util=require(_0x29fc('0x1'));var moment=require(_0x29fc('0x2'));var BPromise=require(_0x29fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x29fc('0x4'));var db=require(_0x29fc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x29fc('0x6'))(_0x29fc('0x7'));var config=require('../../config/environment');var jayson=require(_0x29fc('0x8'));var client=jayson[_0x29fc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xda0668,_0x574100,_0x1ce1be){return new BPromise(function(_0x27be1e,_0x3a14fe){return client['request'](_0xda0668,_0x1ce1be)['then'](function(_0x14c653){logger[_0x29fc('0xa')](_0x29fc('0xb'),_0x574100,_0x29fc('0xc'));logger[_0x29fc('0xd')](_0x29fc('0xe'),_0x574100,_0x29fc('0xc'),JSON[_0x29fc('0xf')](_0x14c653));if(_0x14c653[_0x29fc('0x10')]){if(_0x14c653[_0x29fc('0x10')][_0x29fc('0x11')]===0x1f4){logger['error'](_0x29fc('0xb'),_0x574100,_0x14c653[_0x29fc('0x10')][_0x29fc('0x12')]);return _0x3a14fe(_0x14c653['error'][_0x29fc('0x12')]);}logger[_0x29fc('0x10')](_0x29fc('0xb'),_0x574100,_0x14c653[_0x29fc('0x10')][_0x29fc('0x12')]);return _0x27be1e(_0x14c653[_0x29fc('0x10')][_0x29fc('0x12')]);}else{logger[_0x29fc('0xa')](_0x29fc('0xb'),_0x574100,_0x29fc('0xc'));_0x27be1e(_0x14c653[_0x29fc('0x13')][_0x29fc('0x12')]);}})[_0x29fc('0x14')](function(_0x66e4c2){logger[_0x29fc('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x574100,_0x66e4c2);_0x3a14fe(_0x66e4c2);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 08ca18d..611cf4c 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 _0x048b=['../../config/environment','get','index','isAuthenticated','post','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x31e9d7,_0x5bdda2){var _0x1e3b6e=function(_0x3413aa){while(--_0x3413aa){_0x31e9d7['push'](_0x31e9d7['shift']());}};_0x1e3b6e(++_0x5bdda2);}(_0x048b,0x70));var _0xb048=function(_0x2f36a7,_0x59f91b){_0x2f36a7=_0x2f36a7-0x0;var _0x23bd6e=_0x048b[_0x2f36a7];return _0x23bd6e;};'use strict';var multer=require(_0xb048('0x0'));var util=require(_0xb048('0x1'));var path=require('path');var timeout=require(_0xb048('0x2'));var express=require(_0xb048('0x3'));var router=express[_0xb048('0x4')]();var fs_extra=require(_0xb048('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb048('0x6'));var config=require(_0xb048('0x7'));var controller=require('./intZendeskField.controller');router[_0xb048('0x8')]('/',auth['isAuthenticated'](),controller[_0xb048('0x9')]);router[_0xb048('0x8')]('/:id',auth[_0xb048('0xa')](),controller['show']);router[_0xb048('0xb')]('/',auth[_0xb048('0xa')](),controller['create']);router['put'](_0xb048('0xc'),auth[_0xb048('0xa')](),controller[_0xb048('0xd')]);router[_0xb048('0xe')](_0xb048('0xc'),auth[_0xb048('0xa')](),controller[_0xb048('0xf')]);module[_0xb048('0x10')]=router; \ No newline at end of file +var _0x7786=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','show','post','create','put','/:id','destroy','multer'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0x7786,0x131));var _0x6778=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7786[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6778('0x0'));var util=require('util');var path=require(_0x6778('0x1'));var timeout=require(_0x6778('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6778('0x3'));var auth=require(_0x6778('0x4'));var interaction=require(_0x6778('0x5'));var config=require(_0x6778('0x6'));var controller=require(_0x6778('0x7'));router['get']('/',auth[_0x6778('0x8')](),controller[_0x6778('0x9')]);router[_0x6778('0xa')]('/:id',auth[_0x6778('0x8')](),controller[_0x6778('0xb')]);router[_0x6778('0xc')]('/',auth['isAuthenticated'](),controller[_0x6778('0xd')]);router[_0x6778('0xe')](_0x6778('0xf'),auth[_0x6778('0x8')](),controller['update']);router['delete']('/:id',auth[_0x6778('0x8')](),controller[_0x6778('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 2f956d2..8c3dfa7 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 _0xae79=['customVariable','keyValue','string','STRING','sequelize','exports','ENUM','variable'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xae79,0x1ec));var _0x9ae7=function(_0x1a9632,_0x28a1fc){_0x1a9632=_0x1a9632-0x0;var _0x257bc3=_0xae79[_0x1a9632];return _0x257bc3;};'use strict';var Sequelize=require(_0x9ae7('0x0'));module[_0x9ae7('0x1')]={'type':{'type':Sequelize[_0x9ae7('0x2')]('string',_0x9ae7('0x3'),_0x9ae7('0x4'),_0x9ae7('0x5'),'picklist'),'defaultValue':_0x9ae7('0x6')},'content':{'type':Sequelize[_0x9ae7('0x7')]},'key':{'type':Sequelize[_0x9ae7('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x9ae7('0x6'),'variable',_0x9ae7('0x4'))},'keyContent':{'type':Sequelize[_0x9ae7('0x7')]},'idField':{'type':Sequelize[_0x9ae7('0x7')]},'nameField':{'type':Sequelize[_0x9ae7('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9ae7('0x7')]}}; \ No newline at end of file +var _0x8b25=['sequelize','string','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN'];(function(_0x54513e,_0x168350){var _0x4b288b=function(_0x1f7454){while(--_0x1f7454){_0x54513e['push'](_0x54513e['shift']());}};_0x4b288b(++_0x168350);}(_0x8b25,0xc0));var _0x58b2=function(_0xfbd370,_0x231071){_0xfbd370=_0xfbd370-0x0;var _0x5ba26e=_0x8b25[_0xfbd370];return _0x5ba26e;};'use strict';var Sequelize=require(_0x58b2('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x58b2('0x1'),'variable',_0x58b2('0x2'),_0x58b2('0x3'),_0x58b2('0x4')),'defaultValue':_0x58b2('0x1')},'content':{'type':Sequelize[_0x58b2('0x5')]},'key':{'type':Sequelize[_0x58b2('0x5')]},'keyType':{'type':Sequelize[_0x58b2('0x6')](_0x58b2('0x1'),'variable',_0x58b2('0x2'))},'keyContent':{'type':Sequelize[_0x58b2('0x5')]},'idField':{'type':Sequelize[_0x58b2('0x5')]},'nameField':{'type':Sequelize[_0x58b2('0x5')]},'customField':{'type':Sequelize[_0x58b2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x58b2('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 1d9bf27..eea1408 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 _0x9c28=['body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','update','then','destroy','error','name','send','index','ZendeskField','rawAttributes','fieldName','type','map','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create'];(function(_0x7c056b,_0x26c04b){var _0x15d93b=function(_0x118096){while(--_0x118096){_0x7c056b['push'](_0x7c056b['shift']());}};_0x15d93b(++_0x26c04b);}(_0x9c28,0x1f2));var _0x89c2=function(_0xa2209e,_0x7631c9){_0xa2209e=_0xa2209e-0x0;var _0x61c0de=_0x9c28[_0xa2209e];return _0x61c0de;};'use strict';var emlformat=require(_0x89c2('0x0'));var rimraf=require(_0x89c2('0x1'));var zipdir=require(_0x89c2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x89c2('0x3'));var moment=require(_0x89c2('0x4'));var BPromise=require(_0x89c2('0x5'));var Mustache=require(_0x89c2('0x6'));var util=require(_0x89c2('0x7'));var path=require('path');var sox=require(_0x89c2('0x8'));var csv=require(_0x89c2('0x9'));var ejs=require(_0x89c2('0xa'));var fs=require('fs');var fs_extra=require(_0x89c2('0xb'));var _=require('lodash');var squel=require(_0x89c2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x89c2('0xd'));var toCsv=require(_0x89c2('0x9'));var querystring=require(_0x89c2('0xe'));var Papa=require(_0x89c2('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x89c2('0x10'));var as=require(_0x89c2('0x11'));var hardwareService=require(_0x89c2('0x12'));var logger=require(_0x89c2('0x13'))(_0x89c2('0x14'));var utils=require(_0x89c2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x89c2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x196703,_0x5ed50c){_0x5ed50c=_0x5ed50c||0xcc;return function(_0xa300d9){if(_0xa300d9){return _0x196703[_0x89c2('0x17')](_0x5ed50c);}return _0x196703[_0x89c2('0x18')](_0x5ed50c)[_0x89c2('0x19')]();};}function respondWithResult(_0x4848bd,_0x13d594){_0x13d594=_0x13d594||0xc8;return function(_0x4e775e){if(_0x4e775e){return _0x4848bd[_0x89c2('0x18')](_0x13d594)[_0x89c2('0x1a')](_0x4e775e);}};}function respondWithFilteredResult(_0x2c92f4,_0x4342c2){return function(_0xebb500){if(_0xebb500){var _0x57451e=typeof _0x4342c2['offset']===_0x89c2('0x1b')&&typeof _0x4342c2['limit']===_0x89c2('0x1b');var _0x5acdba=_0xebb500[_0x89c2('0x1c')];var _0xe72c0b=_0x57451e?0x0:_0x4342c2[_0x89c2('0x1d')];var _0x1e15a3=_0x57451e?_0xebb500[_0x89c2('0x1c')]:_0x4342c2[_0x89c2('0x1d')]+_0x4342c2[_0x89c2('0x1e')];var _0x1d3bcf;if(_0x1e15a3>=_0x5acdba){_0x1e15a3=_0x5acdba;_0x1d3bcf=0xc8;}else{_0x1d3bcf=0xce;}_0x2c92f4[_0x89c2('0x18')](_0x1d3bcf);return _0x2c92f4[_0x89c2('0x1f')]('Content-Range',_0xe72c0b+'-'+_0x1e15a3+'/'+_0x5acdba)[_0x89c2('0x1a')](_0xebb500);}return null;};}function patchUpdates(_0xdb4cb9){return function(_0x583a5a){try{jsonpatch[_0x89c2('0x20')](_0x583a5a,_0xdb4cb9,!![]);}catch(_0xf51a5f){return BPromise['reject'](_0xf51a5f);}return _0x583a5a['save']();};}function saveUpdates(_0x50e09c,_0xcc41e5){return function(_0x356d10){if(_0x356d10){return _0x356d10[_0x89c2('0x21')](_0x50e09c)[_0x89c2('0x22')](function(_0xf11193){return _0xf11193;});}return null;};}function removeEntity(_0x5ab1b2,_0x491274){return function(_0x5488e6){if(_0x5488e6){return _0x5488e6[_0x89c2('0x23')]()[_0x89c2('0x22')](function(){_0x5ab1b2['status'](0xcc)[_0x89c2('0x19')]();});}};}function handleEntityNotFound(_0x2c4c56,_0x4369e6){return function(_0x3aed07){if(!_0x3aed07){_0x2c4c56[_0x89c2('0x17')](0x194);}return _0x3aed07;};}function handleError(_0x5e14fb,_0x309591){_0x309591=_0x309591||0x1f4;return function(_0x2fd242){logger[_0x89c2('0x24')](_0x2fd242['stack']);if(_0x2fd242[_0x89c2('0x25')]){delete _0x2fd242[_0x89c2('0x25')];}_0x5e14fb[_0x89c2('0x18')](_0x309591)[_0x89c2('0x26')](_0x2fd242);};}exports[_0x89c2('0x27')]=function(_0x3273b8,_0x2df3e0){var _0x48587c={},_0x3a4f20={},_0x14ffde={'count':0x0,'rows':[]};var _0x35fae2=_['map'](db[_0x89c2('0x28')][_0x89c2('0x29')],function(_0x35c008){return{'name':_0x35c008[_0x89c2('0x2a')],'type':_0x35c008[_0x89c2('0x2b')]['key']};});_0x3a4f20['model']=_[_0x89c2('0x2c')](_0x35fae2,_0x89c2('0x25'));_0x3a4f20[_0x89c2('0x2d')]=_[_0x89c2('0x2e')](_0x3273b8[_0x89c2('0x2d')]);_0x3a4f20['filters']=_[_0x89c2('0x2f')](_0x3a4f20['model'],_0x3a4f20[_0x89c2('0x2d')]);_0x48587c[_0x89c2('0x30')]=_[_0x89c2('0x2f')](_0x3a4f20[_0x89c2('0x31')],qs[_0x89c2('0x32')](_0x3273b8[_0x89c2('0x2d')][_0x89c2('0x32')]));_0x48587c[_0x89c2('0x30')]=_0x48587c[_0x89c2('0x30')][_0x89c2('0x33')]?_0x48587c[_0x89c2('0x30')]:_0x3a4f20[_0x89c2('0x31')];if(!_0x3273b8['query'][_0x89c2('0x34')]('nolimit')){_0x48587c['limit']=qs['limit'](_0x3273b8[_0x89c2('0x2d')][_0x89c2('0x1e')]);_0x48587c[_0x89c2('0x1d')]=qs[_0x89c2('0x1d')](_0x3273b8['query'][_0x89c2('0x1d')]);}_0x48587c['order']=qs[_0x89c2('0x35')](_0x3273b8[_0x89c2('0x2d')]['sort']);_0x48587c[_0x89c2('0x36')]=qs[_0x89c2('0x37')](_[_0x89c2('0x38')](_0x3273b8[_0x89c2('0x2d')],_0x3a4f20[_0x89c2('0x37')]),_0x35fae2);if(_0x3273b8['query']['filter']){_0x48587c[_0x89c2('0x36')]=_[_0x89c2('0x39')](_0x48587c[_0x89c2('0x36')],{'$or':_[_0x89c2('0x2c')](_0x35fae2,function(_0x3a915a){if(_0x3a915a[_0x89c2('0x2b')]!==_0x89c2('0x3a')){var _0x3ae512={};_0x3ae512[_0x3a915a[_0x89c2('0x25')]]={'$like':'%'+_0x3273b8[_0x89c2('0x2d')][_0x89c2('0x3b')]+'%'};return _0x3ae512;}})});}_0x48587c=_[_0x89c2('0x39')]({},_0x48587c,_0x3273b8['options']);var _0x2d4d2d={'where':_0x48587c['where']};return db[_0x89c2('0x28')][_0x89c2('0x1c')](_0x2d4d2d)[_0x89c2('0x22')](function(_0x37394a){_0x14ffde[_0x89c2('0x1c')]=_0x37394a;if(_0x3273b8[_0x89c2('0x2d')][_0x89c2('0x3c')]){_0x48587c[_0x89c2('0x3d')]=[{'all':!![]}];}return db[_0x89c2('0x28')][_0x89c2('0x3e')](_0x48587c);})[_0x89c2('0x22')](function(_0x5aa1c6){_0x14ffde[_0x89c2('0x3f')]=_0x5aa1c6;return _0x14ffde;})[_0x89c2('0x22')](respondWithFilteredResult(_0x2df3e0,_0x48587c))[_0x89c2('0x40')](handleError(_0x2df3e0,null));};exports[_0x89c2('0x41')]=function(_0x50847d,_0x175294){var _0x103bf4={'raw':!![],'where':{'id':_0x50847d[_0x89c2('0x42')]['id']}},_0x3adc66={};_0x3adc66['model']=_[_0x89c2('0x2e')](db[_0x89c2('0x28')][_0x89c2('0x29')]);_0x3adc66[_0x89c2('0x2d')]=_[_0x89c2('0x2e')](_0x50847d['query']);_0x3adc66[_0x89c2('0x37')]=_['intersection'](_0x3adc66[_0x89c2('0x31')],_0x3adc66[_0x89c2('0x2d')]);_0x103bf4[_0x89c2('0x30')]=_['intersection'](_0x3adc66[_0x89c2('0x31')],qs[_0x89c2('0x32')](_0x50847d[_0x89c2('0x2d')]['fields']));_0x103bf4[_0x89c2('0x30')]=_0x103bf4['attributes'][_0x89c2('0x33')]?_0x103bf4['attributes']:_0x3adc66[_0x89c2('0x31')];if(_0x50847d[_0x89c2('0x2d')]['includeAll']){_0x103bf4[_0x89c2('0x3d')]=[{'all':!![]}];}_0x103bf4=_[_0x89c2('0x39')]({},_0x103bf4,_0x50847d[_0x89c2('0x43')]);return db[_0x89c2('0x28')][_0x89c2('0x44')](_0x103bf4)[_0x89c2('0x22')](handleEntityNotFound(_0x175294,null))[_0x89c2('0x22')](respondWithResult(_0x175294,null))[_0x89c2('0x40')](handleError(_0x175294,null));};exports[_0x89c2('0x45')]=function(_0x28b9a8,_0x1d82ef){return db[_0x89c2('0x28')][_0x89c2('0x45')](_0x28b9a8[_0x89c2('0x46')],{})[_0x89c2('0x22')](respondWithResult(_0x1d82ef,0xc9))[_0x89c2('0x40')](handleError(_0x1d82ef,null));};exports[_0x89c2('0x21')]=function(_0x20baf6,_0x2b0e4f){if(_0x20baf6['body']['id']){delete _0x20baf6[_0x89c2('0x46')]['id'];}return db[_0x89c2('0x28')][_0x89c2('0x44')]({'where':{'id':_0x20baf6[_0x89c2('0x42')]['id']}})['then'](handleEntityNotFound(_0x2b0e4f,null))[_0x89c2('0x22')](saveUpdates(_0x20baf6['body'],null))[_0x89c2('0x22')](respondWithResult(_0x2b0e4f,null))['catch'](handleError(_0x2b0e4f,null));};exports[_0x89c2('0x23')]=function(_0xabae99,_0x21fecd){return db[_0x89c2('0x28')][_0x89c2('0x44')]({'where':{'id':_0xabae99[_0x89c2('0x42')]['id']}})['then'](handleEntityNotFound(_0x21fecd,null))[_0x89c2('0x22')](removeEntity(_0x21fecd,null))[_0x89c2('0x40')](handleError(_0x21fecd,null));}; \ No newline at end of file +var _0xfb7d=['create','body','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','apply','reject','update','destroy','then','end','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','count','findAll','rows','show','params','fields','includeAll','include','find','catch'];(function(_0x34c569,_0x1b0291){var _0x3c8ed3=function(_0x40533d){while(--_0x40533d){_0x34c569['push'](_0x34c569['shift']());}};_0x3c8ed3(++_0x1b0291);}(_0xfb7d,0x94));var _0xdfb7=function(_0x1da0ca,_0x8b2edd){_0x1da0ca=_0x1da0ca-0x0;var _0x40c316=_0xfb7d[_0x1da0ca];return _0x40c316;};'use strict';var emlformat=require(_0xdfb7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdfb7('0x1'));var rp=require(_0xdfb7('0x2'));var moment=require('moment');var BPromise=require(_0xdfb7('0x3'));var Mustache=require(_0xdfb7('0x4'));var util=require(_0xdfb7('0x5'));var path=require(_0xdfb7('0x6'));var sox=require(_0xdfb7('0x7'));var csv=require(_0xdfb7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdfb7('0x9'));var squel=require(_0xdfb7('0xa'));var crypto=require(_0xdfb7('0xb'));var jsforce=require(_0xdfb7('0xc'));var deskjs=require(_0xdfb7('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfb7('0xe'));var Papa=require(_0xdfb7('0xf'));var Redis=require(_0xdfb7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdfb7('0x11'));var as=require(_0xdfb7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdfb7('0x13'));var config=require(_0xdfb7('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdfb7('0x15'))['db'];function respondWithStatusCode(_0x5b6a9b,_0x266bdc){_0x266bdc=_0x266bdc||0xcc;return function(_0x44c1e5){if(_0x44c1e5){return _0x5b6a9b[_0xdfb7('0x16')](_0x266bdc);}return _0x5b6a9b[_0xdfb7('0x17')](_0x266bdc)['end']();};}function respondWithResult(_0x3d9850,_0x33dcd7){_0x33dcd7=_0x33dcd7||0xc8;return function(_0x92e331){if(_0x92e331){return _0x3d9850[_0xdfb7('0x17')](_0x33dcd7)[_0xdfb7('0x18')](_0x92e331);}};}function respondWithFilteredResult(_0xc6b27b,_0x56e9f2){return function(_0x3c9030){if(_0x3c9030){var _0x1d5a90=typeof _0x56e9f2[_0xdfb7('0x19')]===_0xdfb7('0x1a')&&typeof _0x56e9f2['limit']==='undefined';var _0x1c577b=_0x3c9030['count'];var _0x555568=_0x1d5a90?0x0:_0x56e9f2['offset'];var _0x5e434d=_0x1d5a90?_0x3c9030['count']:_0x56e9f2['offset']+_0x56e9f2[_0xdfb7('0x1b')];var _0x46f21e;if(_0x5e434d>=_0x1c577b){_0x5e434d=_0x1c577b;_0x46f21e=0xc8;}else{_0x46f21e=0xce;}_0xc6b27b[_0xdfb7('0x17')](_0x46f21e);return _0xc6b27b['set']('Content-Range',_0x555568+'-'+_0x5e434d+'/'+_0x1c577b)[_0xdfb7('0x18')](_0x3c9030);}return null;};}function patchUpdates(_0x212b83){return function(_0x5cffd2){try{jsonpatch[_0xdfb7('0x1c')](_0x5cffd2,_0x212b83,!![]);}catch(_0x5acae8){return BPromise[_0xdfb7('0x1d')](_0x5acae8);}return _0x5cffd2['save']();};}function saveUpdates(_0x3eea00,_0x4cd02a){return function(_0x529e93){if(_0x529e93){return _0x529e93[_0xdfb7('0x1e')](_0x3eea00)['then'](function(_0x2bb057){return _0x2bb057;});}return null;};}function removeEntity(_0x1b7ecb,_0x5d1bb6){return function(_0x51c6ad){if(_0x51c6ad){return _0x51c6ad[_0xdfb7('0x1f')]()[_0xdfb7('0x20')](function(){_0x1b7ecb[_0xdfb7('0x17')](0xcc)[_0xdfb7('0x21')]();});}};}function handleEntityNotFound(_0xe9e47,_0x495c96){return function(_0x3a2e49){if(!_0x3a2e49){_0xe9e47[_0xdfb7('0x16')](0x194);}return _0x3a2e49;};}function handleError(_0x2b4df5,_0x183e1c){_0x183e1c=_0x183e1c||0x1f4;return function(_0x2a367f){logger[_0xdfb7('0x22')](_0x2a367f[_0xdfb7('0x23')]);if(_0x2a367f['name']){delete _0x2a367f[_0xdfb7('0x24')];}_0x2b4df5['status'](_0x183e1c)[_0xdfb7('0x25')](_0x2a367f);};}exports[_0xdfb7('0x26')]=function(_0x2bfb92,_0x3dcb37){var _0x39b451={},_0x21f6c8={},_0x4f2a73={'count':0x0,'rows':[]};var _0x4a9bff=_[_0xdfb7('0x27')](db[_0xdfb7('0x28')][_0xdfb7('0x29')],function(_0x292d73){return{'name':_0x292d73[_0xdfb7('0x2a')],'type':_0x292d73[_0xdfb7('0x2b')][_0xdfb7('0x2c')]};});_0x21f6c8[_0xdfb7('0x2d')]=_[_0xdfb7('0x27')](_0x4a9bff,'name');_0x21f6c8[_0xdfb7('0x2e')]=_[_0xdfb7('0x2f')](_0x2bfb92[_0xdfb7('0x2e')]);_0x21f6c8[_0xdfb7('0x30')]=_[_0xdfb7('0x31')](_0x21f6c8['model'],_0x21f6c8[_0xdfb7('0x2e')]);_0x39b451[_0xdfb7('0x32')]=_['intersection'](_0x21f6c8['model'],qs['fields'](_0x2bfb92[_0xdfb7('0x2e')]['fields']));_0x39b451[_0xdfb7('0x32')]=_0x39b451[_0xdfb7('0x32')][_0xdfb7('0x33')]?_0x39b451[_0xdfb7('0x32')]:_0x21f6c8[_0xdfb7('0x2d')];if(!_0x2bfb92[_0xdfb7('0x2e')][_0xdfb7('0x34')]('nolimit')){_0x39b451[_0xdfb7('0x1b')]=qs[_0xdfb7('0x1b')](_0x2bfb92[_0xdfb7('0x2e')][_0xdfb7('0x1b')]);_0x39b451['offset']=qs[_0xdfb7('0x19')](_0x2bfb92['query'][_0xdfb7('0x19')]);}_0x39b451[_0xdfb7('0x35')]=qs[_0xdfb7('0x36')](_0x2bfb92[_0xdfb7('0x2e')][_0xdfb7('0x36')]);_0x39b451['where']=qs[_0xdfb7('0x30')](_[_0xdfb7('0x37')](_0x2bfb92[_0xdfb7('0x2e')],_0x21f6c8[_0xdfb7('0x30')]),_0x4a9bff);if(_0x2bfb92[_0xdfb7('0x2e')][_0xdfb7('0x38')]){_0x39b451[_0xdfb7('0x39')]=_[_0xdfb7('0x3a')](_0x39b451['where'],{'$or':_[_0xdfb7('0x27')](_0x4a9bff,function(_0x4bb2ec){if(_0x4bb2ec[_0xdfb7('0x2b')]!==_0xdfb7('0x3b')){var _0x453ed2={};_0x453ed2[_0x4bb2ec['name']]={'$like':'%'+_0x2bfb92[_0xdfb7('0x2e')][_0xdfb7('0x38')]+'%'};return _0x453ed2;}})});}_0x39b451=_[_0xdfb7('0x3a')]({},_0x39b451,_0x2bfb92[_0xdfb7('0x3c')]);var _0x31a6af={'where':_0x39b451[_0xdfb7('0x39')]};return db[_0xdfb7('0x28')][_0xdfb7('0x3d')](_0x31a6af)[_0xdfb7('0x20')](function(_0x1ffbef){_0x4f2a73[_0xdfb7('0x3d')]=_0x1ffbef;if(_0x2bfb92[_0xdfb7('0x2e')]['includeAll']){_0x39b451['include']=[{'all':!![]}];}return db[_0xdfb7('0x28')][_0xdfb7('0x3e')](_0x39b451);})['then'](function(_0x57a93f){_0x4f2a73[_0xdfb7('0x3f')]=_0x57a93f;return _0x4f2a73;})[_0xdfb7('0x20')](respondWithFilteredResult(_0x3dcb37,_0x39b451))['catch'](handleError(_0x3dcb37,null));};exports[_0xdfb7('0x40')]=function(_0x15725b,_0x6f199a){var _0x340ad9={'raw':!![],'where':{'id':_0x15725b[_0xdfb7('0x41')]['id']}},_0x1bb520={};_0x1bb520[_0xdfb7('0x2d')]=_[_0xdfb7('0x2f')](db['ZendeskField'][_0xdfb7('0x29')]);_0x1bb520['query']=_[_0xdfb7('0x2f')](_0x15725b['query']);_0x1bb520[_0xdfb7('0x30')]=_[_0xdfb7('0x31')](_0x1bb520[_0xdfb7('0x2d')],_0x1bb520[_0xdfb7('0x2e')]);_0x340ad9[_0xdfb7('0x32')]=_[_0xdfb7('0x31')](_0x1bb520[_0xdfb7('0x2d')],qs[_0xdfb7('0x42')](_0x15725b[_0xdfb7('0x2e')][_0xdfb7('0x42')]));_0x340ad9[_0xdfb7('0x32')]=_0x340ad9[_0xdfb7('0x32')][_0xdfb7('0x33')]?_0x340ad9[_0xdfb7('0x32')]:_0x1bb520[_0xdfb7('0x2d')];if(_0x15725b[_0xdfb7('0x2e')][_0xdfb7('0x43')]){_0x340ad9[_0xdfb7('0x44')]=[{'all':!![]}];}_0x340ad9=_[_0xdfb7('0x3a')]({},_0x340ad9,_0x15725b[_0xdfb7('0x3c')]);return db['ZendeskField'][_0xdfb7('0x45')](_0x340ad9)[_0xdfb7('0x20')](handleEntityNotFound(_0x6f199a,null))[_0xdfb7('0x20')](respondWithResult(_0x6f199a,null))[_0xdfb7('0x46')](handleError(_0x6f199a,null));};exports[_0xdfb7('0x47')]=function(_0x1ce541,_0x42fde1){return db[_0xdfb7('0x28')]['create'](_0x1ce541['body'],{})['then'](respondWithResult(_0x42fde1,0xc9))[_0xdfb7('0x46')](handleError(_0x42fde1,null));};exports[_0xdfb7('0x1e')]=function(_0x1c61b8,_0x4a698f){if(_0x1c61b8[_0xdfb7('0x48')]['id']){delete _0x1c61b8[_0xdfb7('0x48')]['id'];}return db[_0xdfb7('0x28')][_0xdfb7('0x45')]({'where':{'id':_0x1c61b8[_0xdfb7('0x41')]['id']}})[_0xdfb7('0x20')](handleEntityNotFound(_0x4a698f,null))['then'](saveUpdates(_0x1c61b8['body'],null))[_0xdfb7('0x20')](respondWithResult(_0x4a698f,null))[_0xdfb7('0x46')](handleError(_0x4a698f,null));};exports[_0xdfb7('0x1f')]=function(_0x5897c1,_0x538bf1){return db['ZendeskField'][_0xdfb7('0x45')]({'where':{'id':_0x5897c1[_0xdfb7('0x41')]['id']}})[_0xdfb7('0x20')](handleEntityNotFound(_0x538bf1,null))[_0xdfb7('0x20')](removeEntity(_0x538bf1,null))[_0xdfb7('0x46')](handleError(_0x538bf1,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index c4f3cdf..a957224 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 _0x70dd=['idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','int_zendesk_fields','zendesk_unique_index'];(function(_0x290c13,_0x47b4e){var _0x2c8f1d=function(_0x3e1911){while(--_0x3e1911){_0x290c13['push'](_0x290c13['shift']());}};_0x2c8f1d(++_0x47b4e);}(_0x70dd,0x10c));var _0xd70d=function(_0x5219de,_0x60b267){_0x5219de=_0x5219de-0x0;var _0x1a2231=_0x70dd[_0x5219de];return _0x1a2231;};'use strict';var _=require(_0xd70d('0x0'));var util=require(_0xd70d('0x1'));var logger=require(_0xd70d('0x2'))(_0xd70d('0x3'));var moment=require(_0xd70d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd70d('0x5'));var rimraf=require(_0xd70d('0x6'));var config=require(_0xd70d('0x7'));var attributes=require(_0xd70d('0x8'));module[_0xd70d('0x9')]=function(_0x3e98b4,_0x568cd3){return _0x3e98b4['define']('ZendeskField',attributes,{'tableName':_0xd70d('0xa'),'paranoid':![],'indexes':[{'name':_0xd70d('0xb'),'fields':[_0xd70d('0xc'),_0xd70d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x690a=['moment','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x5a4495,_0x426c41){var _0x47f4b2=function(_0x13d5fe){while(--_0x13d5fe){_0x5a4495['push'](_0x5a4495['shift']());}};_0x47f4b2(++_0x426c41);}(_0x690a,0x165));var _0xa690=function(_0x1f858e,_0x4cd233){_0x1f858e=_0x1f858e-0x0;var _0x510531=_0x690a[_0x1f858e];return _0x510531;};'use strict';var _=require(_0xa690('0x0'));var util=require(_0xa690('0x1'));var logger=require(_0xa690('0x2'))('api');var moment=require(_0xa690('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa690('0x4'));var attributes=require(_0xa690('0x5'));module[_0xa690('0x6')]=function(_0x2b648e,_0x56e10c){return _0x2b648e['define'](_0xa690('0x7'),attributes,{'tableName':_0xa690('0x8'),'paranoid':![],'indexes':[{'name':_0xa690('0x9'),'fields':[_0xa690('0xa'),_0xa690('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 0020683..eae198b 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 _0xe6e2=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe6e2,0x1dd));var _0x2e6e=function(_0x35eb69,_0x186c3b){_0x35eb69=_0x35eb69-0x0;var _0x9b6b54=_0xe6e2[_0x35eb69];return _0x9b6b54;};'use strict';var _=require(_0x2e6e('0x0'));var util=require(_0x2e6e('0x1'));var moment=require('moment');var BPromise=require(_0x2e6e('0x2'));var rs=require(_0x2e6e('0x3'));var fs=require('fs');var Redis=require(_0x2e6e('0x4'));var db=require(_0x2e6e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e6e('0x6'))(_0x2e6e('0x7'));var config=require(_0x2e6e('0x8'));var jayson=require(_0x2e6e('0x9'));var client=jayson[_0x2e6e('0xa')][_0x2e6e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36b32c,_0x4dfb73,_0x1238f3){return new BPromise(function(_0x5e18a1,_0x2075de){return client[_0x2e6e('0xc')](_0x36b32c,_0x1238f3)['then'](function(_0x5a7e1f){logger[_0x2e6e('0xd')](_0x2e6e('0xe'),_0x4dfb73,_0x2e6e('0xf'));logger[_0x2e6e('0x10')](_0x2e6e('0x11'),_0x4dfb73,_0x2e6e('0xf'),JSON[_0x2e6e('0x12')](_0x5a7e1f));if(_0x5a7e1f[_0x2e6e('0x13')]){if(_0x5a7e1f['error'][_0x2e6e('0x14')]===0x1f4){logger['error'](_0x2e6e('0xe'),_0x4dfb73,_0x5a7e1f[_0x2e6e('0x13')][_0x2e6e('0x15')]);return _0x2075de(_0x5a7e1f['error'][_0x2e6e('0x15')]);}logger[_0x2e6e('0x13')](_0x2e6e('0xe'),_0x4dfb73,_0x5a7e1f[_0x2e6e('0x13')][_0x2e6e('0x15')]);return _0x5e18a1(_0x5a7e1f[_0x2e6e('0x13')][_0x2e6e('0x15')]);}else{logger[_0x2e6e('0xd')](_0x2e6e('0xe'),_0x4dfb73,_0x2e6e('0xf'));_0x5e18a1(_0x5a7e1f[_0x2e6e('0x16')][_0x2e6e('0x15')]);}})[_0x2e6e('0x17')](function(_0x24a219){logger[_0x2e6e('0x13')](_0x2e6e('0xe'),_0x4dfb73,_0x24a219);_0x2075de(_0x24a219);});});} \ No newline at end of file +var _0x0e7a=['client','http','request','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e7a,0x1f1));var _0xa0e7=function(_0x1ddb3d,_0x1dd2b2){_0x1ddb3d=_0x1ddb3d-0x0;var _0x4d3809=_0x0e7a[_0x1ddb3d];return _0x4d3809;};'use strict';var _=require('lodash');var util=require(_0xa0e7('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa0e7('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa0e7('0x2'));var logger=require(_0xa0e7('0x3'))(_0xa0e7('0x4'));var config=require(_0xa0e7('0x5'));var jayson=require(_0xa0e7('0x6'));var client=jayson[_0xa0e7('0x7')][_0xa0e7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f120b,_0xb76fd3,_0x564317){return new BPromise(function(_0x4eee58,_0x2438a8){return client[_0xa0e7('0x9')](_0x1f120b,_0x564317)[_0xa0e7('0xa')](function(_0x13b58f){logger[_0xa0e7('0xb')](_0xa0e7('0xc'),_0xb76fd3,'request\x20sent');logger[_0xa0e7('0xd')](_0xa0e7('0xe'),_0xb76fd3,_0xa0e7('0xf'),JSON[_0xa0e7('0x10')](_0x13b58f));if(_0x13b58f[_0xa0e7('0x11')]){if(_0x13b58f[_0xa0e7('0x11')][_0xa0e7('0x12')]===0x1f4){logger[_0xa0e7('0x11')](_0xa0e7('0xc'),_0xb76fd3,_0x13b58f[_0xa0e7('0x11')][_0xa0e7('0x13')]);return _0x2438a8(_0x13b58f[_0xa0e7('0x11')][_0xa0e7('0x13')]);}logger[_0xa0e7('0x11')](_0xa0e7('0xc'),_0xb76fd3,_0x13b58f[_0xa0e7('0x11')]['message']);return _0x4eee58(_0x13b58f[_0xa0e7('0x11')]['message']);}else{logger[_0xa0e7('0xb')](_0xa0e7('0xc'),_0xb76fd3,_0xa0e7('0xf'));_0x4eee58(_0x13b58f[_0xa0e7('0x14')]['message']);}})['catch'](function(_0x1f78c7){logger['error'](_0xa0e7('0xc'),_0xb76fd3,_0x1f78c7);_0x2438a8(_0x1f78c7);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index f6be7b6..ab0d043 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 _0x8289=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports'];(function(_0x2a009e,_0x166e21){var _0x4e357f=function(_0x24625e){while(--_0x24625e){_0x2a009e['push'](_0x2a009e['shift']());}};_0x4e357f(++_0x166e21);}(_0x8289,0xe1));var _0x9828=function(_0x1950c9,_0x2a4a05){_0x1950c9=_0x1950c9-0x0;var _0x34ea3c=_0x8289[_0x1950c9];return _0x34ea3c;};'use strict';var multer=require(_0x9828('0x0'));var util=require(_0x9828('0x1'));var path=require('path');var timeout=require(_0x9828('0x2'));var express=require('express');var router=express[_0x9828('0x3')]();var fs_extra=require(_0x9828('0x4'));var auth=require(_0x9828('0x5'));var interaction=require(_0x9828('0x6'));var config=require(_0x9828('0x7'));var controller=require(_0x9828('0x8'));router[_0x9828('0x9')]('/',auth[_0x9828('0xa')](),controller[_0x9828('0xb')]);router[_0x9828('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9828('0xc')]);router[_0x9828('0x9')](_0x9828('0xd'),auth[_0x9828('0xa')](),controller[_0x9828('0xe')]);router[_0x9828('0x9')]('/:id/fields',auth[_0x9828('0xa')](),controller[_0x9828('0xf')]);router[_0x9828('0x10')]('/',auth[_0x9828('0xa')](),controller[_0x9828('0x11')]);router[_0x9828('0x10')](_0x9828('0xd'),auth[_0x9828('0xa')](),controller[_0x9828('0x12')]);router[_0x9828('0x13')](_0x9828('0x14'),auth[_0x9828('0xa')](),controller[_0x9828('0x15')]);router[_0x9828('0x16')]('/:id',auth[_0x9828('0xa')](),controller[_0x9828('0x17')]);module[_0x9828('0x18')]=router; \ No newline at end of file +var _0xcf73=['post','create','addConfiguration','put','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x4aea2e,_0x89f76){var _0xd58e55=function(_0x57c529){while(--_0x57c529){_0x4aea2e['push'](_0x4aea2e['shift']());}};_0xd58e55(++_0x89f76);}(_0xcf73,0x125));var _0x3cf7=function(_0x3d2850,_0x10270a){_0x3d2850=_0x3d2850-0x0;var _0x4b562d=_0xcf73[_0x3d2850];return _0x4b562d;};'use strict';var multer=require(_0x3cf7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3cf7('0x1'));var express=require(_0x3cf7('0x2'));var router=express[_0x3cf7('0x3')]();var fs_extra=require(_0x3cf7('0x4'));var auth=require(_0x3cf7('0x5'));var interaction=require(_0x3cf7('0x6'));var config=require(_0x3cf7('0x7'));var controller=require('./intZohoAccount.controller');router[_0x3cf7('0x8')]('/',auth[_0x3cf7('0x9')](),controller[_0x3cf7('0xa')]);router[_0x3cf7('0x8')](_0x3cf7('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x3cf7('0x8')](_0x3cf7('0xc'),auth['isAuthenticated'](),controller[_0x3cf7('0xd')]);router['get'](_0x3cf7('0xe'),auth[_0x3cf7('0x9')](),controller['getFields']);router[_0x3cf7('0xf')]('/',auth['isAuthenticated'](),controller[_0x3cf7('0x10')]);router['post']('/:id/configurations',auth[_0x3cf7('0x9')](),controller[_0x3cf7('0x11')]);router[_0x3cf7('0x12')](_0x3cf7('0xb'),auth[_0x3cf7('0x9')](),controller[_0x3cf7('0x13')]);router[_0x3cf7('0x14')](_0x3cf7('0xb'),auth[_0x3cf7('0x9')](),controller[_0x3cf7('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 7d7f506..936cd3a 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 _0x5636=['sequelize','exports','STRING'];(function(_0x254e74,_0x50bb45){var _0x46d852=function(_0x3778e4){while(--_0x3778e4){_0x254e74['push'](_0x254e74['shift']());}};_0x46d852(++_0x50bb45);}(_0x5636,0x102));var _0x6563=function(_0x4eaf0c,_0x545e2b){_0x4eaf0c=_0x4eaf0c-0x0;var _0x19f642=_0x5636[_0x4eaf0c];return _0x19f642;};'use strict';var Sequelize=require(_0x6563('0x0'));module[_0x6563('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x6563('0x2')]},'clientId':{'type':Sequelize[_0x6563('0x2')]},'clientSecret':{'type':Sequelize[_0x6563('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x6563('0x2')]},'refreshToken':{'type':Sequelize[_0x6563('0x2')]}}; \ No newline at end of file +var _0xe14d=['exports','STRING','sequelize'];(function(_0x33c597,_0x1d2772){var _0x4413c5=function(_0xd06961){while(--_0xd06961){_0x33c597['push'](_0x33c597['shift']());}};_0x4413c5(++_0x1d2772);}(_0xe14d,0x1ee));var _0xde14=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xe14d[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0xde14('0x0'));module[_0xde14('0x1')]={'name':{'type':Sequelize[_0xde14('0x2')]},'description':{'type':Sequelize[_0xde14('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xde14('0x2')]},'clientId':{'type':Sequelize[_0xde14('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xde14('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xde14('0x2')]},'refreshToken':{'type':Sequelize[_0xde14('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index a69f28e..dd1acda 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 _0x0428=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','ZohoAccount','includeAll','include','findAll','rows','catch','show','length','create','body','find','params','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','zone','clientId','clientSecret','serverUrl','code','host','zoho.eu','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','data_type','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status'];(function(_0x42d22d,_0x1902a5){var _0x1a9c76=function(_0x5cb6ff){while(--_0x5cb6ff){_0x42d22d['push'](_0x42d22d['shift']());}};_0x1a9c76(++_0x1902a5);}(_0x0428,0xed));var _0x8042=function(_0x36c155,_0x4b234c){_0x36c155=_0x36c155-0x0;var _0x378665=_0x0428[_0x36c155];return _0x378665;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8042('0x0'));var zipdir=require(_0x8042('0x1'));var jsonpatch=require(_0x8042('0x2'));var rp=require(_0x8042('0x3'));var moment=require(_0x8042('0x4'));var BPromise=require(_0x8042('0x5'));var Mustache=require(_0x8042('0x6'));var util=require(_0x8042('0x7'));var path=require(_0x8042('0x8'));var sox=require(_0x8042('0x9'));var csv=require(_0x8042('0xa'));var ejs=require(_0x8042('0xb'));var fs=require('fs');var fs_extra=require(_0x8042('0xc'));var _=require(_0x8042('0xd'));var squel=require(_0x8042('0xe'));var crypto=require('crypto');var jsforce=require(_0x8042('0xf'));var deskjs=require(_0x8042('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8042('0x11'));var Papa=require(_0x8042('0x12'));var Redis=require(_0x8042('0x13'));var authService=require(_0x8042('0x14'));var qs=require(_0x8042('0x15'));var as=require(_0x8042('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8042('0x17'));var config=require(_0x8042('0x18'));var licenseUtil=require(_0x8042('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8042('0x1a'));function respondWithStatusCode(_0x408b6b,_0x47873b){_0x47873b=_0x47873b||0xcc;return function(_0x4df64f){if(_0x4df64f){return _0x408b6b[_0x8042('0x1b')](_0x47873b);}return _0x408b6b[_0x8042('0x1c')](_0x47873b)[_0x8042('0x1d')]();};}function respondWithResult(_0x3e7dd9,_0x3e1445){_0x3e1445=_0x3e1445||0xc8;return function(_0x3da8be){if(_0x3da8be){return _0x3e7dd9['status'](_0x3e1445)[_0x8042('0x1e')](_0x3da8be);}};}function respondWithFilteredResult(_0x50e9dd,_0x28dcd8){return function(_0x380c0f){if(_0x380c0f){var _0x22cd2a=typeof _0x28dcd8[_0x8042('0x1f')]===_0x8042('0x20')&&typeof _0x28dcd8[_0x8042('0x21')]===_0x8042('0x20');var _0x4fd742=_0x380c0f[_0x8042('0x22')];var _0x449596=_0x22cd2a?0x0:_0x28dcd8[_0x8042('0x1f')];var _0x190ae4=_0x22cd2a?_0x380c0f[_0x8042('0x22')]:_0x28dcd8[_0x8042('0x1f')]+_0x28dcd8[_0x8042('0x21')];var _0x1c8da8;if(_0x190ae4>=_0x4fd742){_0x190ae4=_0x4fd742;_0x1c8da8=0xc8;}else{_0x1c8da8=0xce;}_0x50e9dd[_0x8042('0x1c')](_0x1c8da8);return _0x50e9dd[_0x8042('0x23')](_0x8042('0x24'),_0x449596+'-'+_0x190ae4+'/'+_0x4fd742)[_0x8042('0x1e')](_0x380c0f);}return null;};}function patchUpdates(_0x1cfae6){return function(_0x5cfd52){try{jsonpatch[_0x8042('0x25')](_0x5cfd52,_0x1cfae6,!![]);}catch(_0x4958a6){return BPromise[_0x8042('0x26')](_0x4958a6);}return _0x5cfd52['save']();};}function saveUpdates(_0x2e827a,_0x2b8a9f){return function(_0x86c0e8){if(_0x86c0e8){return _0x86c0e8[_0x8042('0x27')](_0x2e827a)[_0x8042('0x28')](function(_0x4fd53e){return _0x4fd53e;});}return null;};}function removeEntity(_0x3c493c,_0x365491){return function(_0x6447b0){if(_0x6447b0){return _0x6447b0[_0x8042('0x29')]()['then'](function(){_0x3c493c[_0x8042('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59394c,_0x33a9c9){return function(_0x1f7dd7){if(!_0x1f7dd7){_0x59394c[_0x8042('0x1b')](0x194);}return _0x1f7dd7;};}function handleError(_0x20da36,_0x296b27){_0x296b27=_0x296b27||0x1f4;return function(_0x312fcd){logger['error'](_0x312fcd['stack']);if(_0x312fcd[_0x8042('0x2a')]){delete _0x312fcd[_0x8042('0x2a')];}_0x20da36[_0x8042('0x1c')](_0x296b27)[_0x8042('0x2b')](_0x312fcd);};}exports[_0x8042('0x2c')]=function(_0x337000,_0x677810){var _0x66096={},_0x8aeca1={},_0x504165={'count':0x0,'rows':[]};var _0x3a0ae7=_[_0x8042('0x2d')](db['ZohoAccount'][_0x8042('0x2e')],function(_0x53586a){return{'name':_0x53586a[_0x8042('0x2f')],'type':_0x53586a[_0x8042('0x30')][_0x8042('0x31')]};});_0x8aeca1[_0x8042('0x32')]=_[_0x8042('0x2d')](_0x3a0ae7,_0x8042('0x2a'));_0x8aeca1[_0x8042('0x33')]=_[_0x8042('0x34')](_0x337000[_0x8042('0x33')]);_0x8aeca1[_0x8042('0x35')]=_[_0x8042('0x36')](_0x8aeca1[_0x8042('0x32')],_0x8aeca1[_0x8042('0x33')]);_0x66096[_0x8042('0x37')]=_[_0x8042('0x36')](_0x8aeca1[_0x8042('0x32')],qs['fields'](_0x337000[_0x8042('0x33')][_0x8042('0x38')]));_0x66096[_0x8042('0x37')]=_0x66096[_0x8042('0x37')]['length']?_0x66096[_0x8042('0x37')]:_0x8aeca1['model'];if(!_0x337000[_0x8042('0x33')]['hasOwnProperty'](_0x8042('0x39'))){_0x66096[_0x8042('0x21')]=qs[_0x8042('0x21')](_0x337000[_0x8042('0x33')][_0x8042('0x21')]);_0x66096['offset']=qs['offset'](_0x337000[_0x8042('0x33')][_0x8042('0x1f')]);}_0x66096['order']=qs[_0x8042('0x3a')](_0x337000[_0x8042('0x33')][_0x8042('0x3a')]);_0x66096[_0x8042('0x3b')]=qs['filters'](_[_0x8042('0x3c')](_0x337000['query'],_0x8aeca1[_0x8042('0x35')]),_0x3a0ae7);if(_0x337000[_0x8042('0x33')][_0x8042('0x3d')]){_0x66096[_0x8042('0x3b')]=_[_0x8042('0x3e')](_0x66096['where'],{'$or':_['map'](_0x3a0ae7,function(_0x110f9b){if(_0x110f9b[_0x8042('0x30')]!==_0x8042('0x3f')){var _0x960cef={};_0x960cef[_0x110f9b[_0x8042('0x2a')]]={'$like':'%'+_0x337000[_0x8042('0x33')][_0x8042('0x3d')]+'%'};return _0x960cef;}})});}_0x66096=_[_0x8042('0x3e')]({},_0x66096,_0x337000[_0x8042('0x40')]);var _0x371120={'where':_0x66096['where']};return db[_0x8042('0x41')]['count'](_0x371120)[_0x8042('0x28')](function(_0x5a835e){_0x504165[_0x8042('0x22')]=_0x5a835e;if(_0x337000[_0x8042('0x33')][_0x8042('0x42')]){_0x66096[_0x8042('0x43')]=[{'all':!![]}];}return db['ZohoAccount'][_0x8042('0x44')](_0x66096);})[_0x8042('0x28')](function(_0x456363){_0x504165[_0x8042('0x45')]=_0x456363;return _0x504165;})[_0x8042('0x28')](respondWithFilteredResult(_0x677810,_0x66096))[_0x8042('0x46')](handleError(_0x677810,null));};exports[_0x8042('0x47')]=function(_0x47e15c,_0x29f03f){var _0x311084={'raw':![],'where':{'id':_0x47e15c['params']['id']}},_0x2c007f={};_0x2c007f['model']=_[_0x8042('0x34')](db[_0x8042('0x41')][_0x8042('0x2e')]);_0x2c007f[_0x8042('0x33')]=_[_0x8042('0x34')](_0x47e15c[_0x8042('0x33')]);_0x2c007f[_0x8042('0x35')]=_['intersection'](_0x2c007f[_0x8042('0x32')],_0x2c007f['query']);_0x311084['attributes']=_[_0x8042('0x36')](_0x2c007f[_0x8042('0x32')],qs[_0x8042('0x38')](_0x47e15c[_0x8042('0x33')]['fields']));_0x311084[_0x8042('0x37')]=_0x311084[_0x8042('0x37')][_0x8042('0x48')]?_0x311084[_0x8042('0x37')]:_0x2c007f[_0x8042('0x32')];if(_0x47e15c[_0x8042('0x33')][_0x8042('0x42')]){_0x311084['include']=[{'all':!![]}];}_0x311084=_[_0x8042('0x3e')]({},_0x311084,_0x47e15c['options']);return db[_0x8042('0x41')]['find'](_0x311084)[_0x8042('0x28')](handleEntityNotFound(_0x29f03f,null))[_0x8042('0x28')](respondWithResult(_0x29f03f,null))[_0x8042('0x46')](handleError(_0x29f03f,null));};exports['create']=function(_0x328519,_0x29cdc6){return db[_0x8042('0x41')][_0x8042('0x49')](_0x328519[_0x8042('0x4a')],{})[_0x8042('0x28')](respondWithResult(_0x29cdc6,0xc9))[_0x8042('0x46')](handleError(_0x29cdc6,null));};exports[_0x8042('0x27')]=function(_0x2b0de8,_0x4006bf){if(_0x2b0de8[_0x8042('0x4a')]['id']){delete _0x2b0de8[_0x8042('0x4a')]['id'];}return db[_0x8042('0x41')][_0x8042('0x4b')]({'where':{'id':_0x2b0de8['params']['id']}})[_0x8042('0x28')](handleEntityNotFound(_0x4006bf,null))[_0x8042('0x28')](saveUpdates(_0x2b0de8['body'],null))[_0x8042('0x28')](respondWithResult(_0x4006bf,null))[_0x8042('0x46')](handleError(_0x4006bf,null));};exports[_0x8042('0x29')]=function(_0x3c157c,_0x1ce54a){return db[_0x8042('0x41')][_0x8042('0x4b')]({'where':{'id':_0x3c157c[_0x8042('0x4c')]['id']}})[_0x8042('0x28')](handleEntityNotFound(_0x1ce54a,null))[_0x8042('0x28')](removeEntity(_0x1ce54a,null))[_0x8042('0x46')](handleError(_0x1ce54a,null));};exports[_0x8042('0x4d')]=function(_0x34f4e5,_0x1cc393,_0x54723a){var _0x2f6ca1={};var _0x47c670={};var _0x1158c7;var _0x9b94a5;return db['ZohoAccount'][_0x8042('0x4e')]({'where':{'id':_0x34f4e5[_0x8042('0x4c')]['id']}})[_0x8042('0x28')](handleEntityNotFound(_0x1cc393,null))['then'](function(_0x5ce472){if(_0x5ce472){_0x1158c7=_0x5ce472;_0x47c670['model']=_[_0x8042('0x34')](db['ZohoConfiguration']['rawAttributes']);_0x47c670[_0x8042('0x33')]=_[_0x8042('0x34')](_0x34f4e5[_0x8042('0x33')]);_0x47c670[_0x8042('0x35')]=_[_0x8042('0x36')](_0x47c670[_0x8042('0x32')],_0x47c670['query']);_0x2f6ca1[_0x8042('0x37')]=_[_0x8042('0x36')](_0x47c670[_0x8042('0x32')],qs[_0x8042('0x38')](_0x34f4e5[_0x8042('0x33')][_0x8042('0x38')]));_0x2f6ca1[_0x8042('0x37')]=_0x2f6ca1['attributes'][_0x8042('0x48')]?_0x2f6ca1[_0x8042('0x37')]:_0x47c670[_0x8042('0x32')];_0x2f6ca1[_0x8042('0x4f')]=qs[_0x8042('0x3a')](_0x34f4e5['query'][_0x8042('0x3a')]);_0x2f6ca1[_0x8042('0x3b')]=qs[_0x8042('0x35')](_['pick'](_0x34f4e5[_0x8042('0x33')],_0x47c670['filters']));if(_0x34f4e5[_0x8042('0x33')][_0x8042('0x3d')]){_0x2f6ca1[_0x8042('0x3b')]=_[_0x8042('0x3e')](_0x2f6ca1[_0x8042('0x3b')],{'$or':_[_0x8042('0x2d')](_0x2f6ca1[_0x8042('0x37')],function(_0x16b111){var _0x51e5b6={};_0x51e5b6[_0x16b111]={'$like':'%'+_0x34f4e5[_0x8042('0x33')][_0x8042('0x3d')]+'%'};return _0x51e5b6;})});}_0x2f6ca1=_[_0x8042('0x3e')]({},_0x2f6ca1,_0x34f4e5['options']);return _0x1158c7[_0x8042('0x4d')](_0x2f6ca1);}})[_0x8042('0x28')](function(_0xf6741){if(_0xf6741){_0x9b94a5=_0xf6741[_0x8042('0x48')];if(!_0x34f4e5['query']['hasOwnProperty'](_0x8042('0x39'))){_0x2f6ca1['limit']=qs[_0x8042('0x21')](_0x34f4e5[_0x8042('0x33')][_0x8042('0x21')]);_0x2f6ca1['offset']=qs[_0x8042('0x1f')](_0x34f4e5[_0x8042('0x33')][_0x8042('0x1f')]);}return _0x1158c7['getConfigurations'](_0x2f6ca1);}})[_0x8042('0x28')](function(_0x151a93){if(_0x151a93){return _0x151a93?{'count':_0x9b94a5,'rows':_0x151a93}:null;}})[_0x8042('0x28')](respondWithResult(_0x1cc393,null))[_0x8042('0x46')](handleError(_0x1cc393,null));};exports[_0x8042('0x50')]=function(_0x3592c6,_0xbdc29d,_0x4bdf5d){if(_0x3592c6[_0x8042('0x4a')]['id']){delete _0x3592c6[_0x8042('0x4a')]['id'];}return db[_0x8042('0x41')][_0x8042('0x4e')]({'where':{'id':_0x3592c6[_0x8042('0x4c')]['id']}})[_0x8042('0x28')](handleEntityNotFound(_0xbdc29d,null))[_0x8042('0x28')](function(_0x3c6d2c){if(_0x3c6d2c){_0x3592c6[_0x8042('0x4a')][_0x8042('0x51')]=_0x3c6d2c['id'];_0x3592c6[_0x8042('0x4a')][_0x8042('0x52')]=integrations['getSubjects'](_0x3592c6[_0x8042('0x4a')][_0x8042('0x53')],_0x3592c6[_0x8042('0x4a')]['type']);_0x3592c6[_0x8042('0x4a')][_0x8042('0x54')]=integrations[_0x8042('0x55')](_0x3592c6[_0x8042('0x4a')][_0x8042('0x53')],_0x3592c6[_0x8042('0x4a')][_0x8042('0x30')]);return db['ZohoConfiguration'][_0x8042('0x49')](_0x3592c6[_0x8042('0x4a')],{'include':[{'model':db[_0x8042('0x56')],'as':_0x8042('0x52')},{'model':db[_0x8042('0x56')],'as':_0x8042('0x54')}]});}return null;})[_0x8042('0x28')](respondWithResult(_0xbdc29d,null))[_0x8042('0x46')](handleError(_0xbdc29d,null));};function getAccessToken(_0x293551){return new Promise(function(_0x68c747,_0x23d1f5){var _0x3bcd17;switch(_0x293551['zone']){case'US':_0x3bcd17='https://accounts.zoho.com';break;case'AU':_0x3bcd17=_0x8042('0x57');break;case'EU':_0x3bcd17=_0x8042('0x58');break;case'IN':_0x3bcd17=_0x8042('0x59');break;case'CN':_0x3bcd17='https://accounts.zoho.com.cn';break;default:_0x3bcd17=_0x8042('0x58');break;}var _0x282ffb={'method':_0x8042('0x5a'),'uri':_0x3bcd17+_0x8042('0x5b'),'qs':{'refresh_token':_0x293551[_0x8042('0x5c')],'client_id':_0x293551['clientId'],'client_secret':_0x293551['clientSecret'],'grant_type':_0x8042('0x5d')},'json':!![]};return rp(_0x282ffb)[_0x8042('0x28')](function(_0x2fd40f){if(_0x2fd40f[_0x8042('0x5e')]){_0x68c747(_0x2fd40f['access_token']);}else{_0x23d1f5(_0x8042('0x5f'));}})[_0x8042('0x46')](function(_0xba1114){_0x23d1f5(_0xba1114);});});}exports[_0x8042('0x60')]=function(_0x4c86cc,_0x2f1ab2,_0x353a1d){var _0x153252,_0x2a9936,_0x996242,_0x26ffaf,_0xc2a61;return db['ZohoAccount']['findOne']({'where':{'id':_0x4c86cc[_0x8042('0x4c')]['id']},'attributes':['id','host',_0x8042('0x61'),_0x8042('0x62'),_0x8042('0x63'),_0x8042('0x64'),_0x8042('0x65'),_0x8042('0x5c')]})[_0x8042('0x28')](handleEntityNotFound(_0x2f1ab2,null))[_0x8042('0x28')](function(_0x33aadc){_0xc2a61=_0x33aadc;_0x153252=_0xc2a61[_0x8042('0x66')];_0x2a9936=_0x153252===_0x8042('0x67')?'eu':'com';_0x996242=_0xc2a61['serverUrl'];var _0xf49a08=_0x996242[_0x8042('0x68')](-0x1);if(_0xf49a08==='/'||_0xf49a08==='\x5c'||_0xf49a08===':'){_0x996242=_0x996242['substring'](0x0,_0x996242[_0x8042('0x69')](_0xf49a08));}if(!_0xc2a61[_0x8042('0x5c')]){throw new Error(_0x8042('0x6a'));}return getAccessToken(_0xc2a61);})[_0x8042('0x28')](function(_0x5d9a9b){if(_0x5d9a9b){return rp({'method':_0x8042('0x6b'),'uri':util[_0x8042('0x6c')](_0x8042('0x6d'),_0x2a9936),'qs':{'module':_0x8042('0x6e')},'headers':{'Authorization':_0x8042('0x6f')+_0x5d9a9b},'json':!![]});}})[_0x8042('0x28')](function(_0x11f524){if(_0x11f524){if(_0x11f524[_0x8042('0x70')]&&_0x11f524['response']['error']){throw new Error(_0x11f524[_0x8042('0x70')][_0x8042('0x71')]['message']);}var _0xb9cee6=[];var _0x8f83ab=[];var _0x7124d6=[_0x8042('0x72'),_0x8042('0x73'),'Description',_0x8042('0x74'),_0x8042('0x75'),_0x8042('0x76'),_0x8042('0x77'),_0x8042('0x78')];_0x8f83ab=_[_0x8042('0x79')](_0x11f524[_0x8042('0x38')],function(_0x2c2330){return _0x7124d6[_0x8042('0x7a')](_0x2c2330[_0x8042('0x7b')]);});for(var _0x57c17d=0x0;_0x57c17d<_0x8f83ab[_0x8042('0x48')];_0x57c17d++){if(_0x8f83ab[_0x57c17d][_0x8042('0x7c')]===![]){_0xb9cee6[_0x8042('0x7d')]({'id':_0x8f83ab[_0x57c17d]['id'],'name':_0x8f83ab[_0x57c17d][_0x8042('0x7e')],'custom':_0x8f83ab[_0x57c17d]['custom_field'],'options':_0x8f83ab[_0x57c17d][_0x8042('0x7f')]==='picklist'&&_0x8f83ab[_0x57c17d][_0x8042('0x80')]['length']>-0x1?_[_0x8042('0x2d')](_0x8f83ab[_0x57c17d]['pick_list_values'],function(_0x4d2fa4){return{'name':_0x4d2fa4,'value':_0x4d2fa4};}):[]});}}return{'count':_0xb9cee6[_0x8042('0x48')],'rows':_0xb9cee6};}else{return{'count':0x0,'rows':[]};}})[_0x8042('0x28')](respondWithResult(_0x2f1ab2,null))[_0x8042('0x46')](function(_0x3baad4){var _0x38fc13=_0x4c86cc[_0x8042('0x33')][_0x8042('0x81')]?0x1f4:_0x3baad4['statusCode']||0x1f4;logger['error'](_0x8042('0x82'),'getFields',_0x38fc13,JSON[_0x8042('0x83')](_0x3baad4));delete _0x3baad4['name'];if(_0x38fc13===0x191){_0x38fc13=0x190;}_0x2f1ab2[_0x8042('0x1c')](_0x38fc13)['send'](_0x4c86cc['query'][_0x8042('0x81')]?{'message':_0x8042('0x84'),'statusCode':_0x3baad4['statusCode']}:_0x3baad4);});}; \ No newline at end of file +var _0xa546=['query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','rawAttributes','create','body','find','params','getConfigurations','findOne','ZohoConfiguration','options','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','serverUrl','zoho.eu','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','test','stringify','send','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ZohoAccount','fieldName','type','key','model'];(function(_0x27c84c,_0x115c01){var _0x1bccfc=function(_0x465bf8){while(--_0x465bf8){_0x27c84c['push'](_0x27c84c['shift']());}};_0x1bccfc(++_0x115c01);}(_0xa546,0x151));var _0x6a54=function(_0x52cc6f,_0x573910){_0x52cc6f=_0x52cc6f-0x0;var _0x23941a=_0xa546[_0x52cc6f];return _0x23941a;};'use strict';var emlformat=require(_0x6a54('0x0'));var rimraf=require(_0x6a54('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6a54('0x2'));var rp=require(_0x6a54('0x3'));var moment=require(_0x6a54('0x4'));var BPromise=require(_0x6a54('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6a54('0x6'));var csv=require('to-csv');var ejs=require(_0x6a54('0x7'));var fs=require('fs');var fs_extra=require(_0x6a54('0x8'));var _=require('lodash');var squel=require(_0x6a54('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6a54('0xa'));var toCsv=require('to-csv');var querystring=require(_0x6a54('0xb'));var Papa=require(_0x6a54('0xc'));var Redis=require(_0x6a54('0xd'));var authService=require(_0x6a54('0xe'));var qs=require(_0x6a54('0xf'));var as=require(_0x6a54('0x10'));var hardwareService=require(_0x6a54('0x11'));var logger=require(_0x6a54('0x12'))('api');var utils=require(_0x6a54('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x6a54('0x14'));function respondWithStatusCode(_0x26245d,_0x1416d0){_0x1416d0=_0x1416d0||0xcc;return function(_0x142cab){if(_0x142cab){return _0x26245d[_0x6a54('0x15')](_0x1416d0);}return _0x26245d[_0x6a54('0x16')](_0x1416d0)[_0x6a54('0x17')]();};}function respondWithResult(_0x49b267,_0x437ffe){_0x437ffe=_0x437ffe||0xc8;return function(_0x57525e){if(_0x57525e){return _0x49b267[_0x6a54('0x16')](_0x437ffe)[_0x6a54('0x18')](_0x57525e);}};}function respondWithFilteredResult(_0x4f0061,_0x1334f3){return function(_0x2775d3){if(_0x2775d3){var _0x2587ab=typeof _0x1334f3[_0x6a54('0x19')]===_0x6a54('0x1a')&&typeof _0x1334f3[_0x6a54('0x1b')]===_0x6a54('0x1a');var _0x32e505=_0x2775d3['count'];var _0x539216=_0x2587ab?0x0:_0x1334f3[_0x6a54('0x19')];var _0x42304f=_0x2587ab?_0x2775d3[_0x6a54('0x1c')]:_0x1334f3[_0x6a54('0x19')]+_0x1334f3[_0x6a54('0x1b')];var _0x30f741;if(_0x42304f>=_0x32e505){_0x42304f=_0x32e505;_0x30f741=0xc8;}else{_0x30f741=0xce;}_0x4f0061[_0x6a54('0x16')](_0x30f741);return _0x4f0061[_0x6a54('0x1d')](_0x6a54('0x1e'),_0x539216+'-'+_0x42304f+'/'+_0x32e505)['json'](_0x2775d3);}return null;};}function patchUpdates(_0x31fd10){return function(_0x4536e3){try{jsonpatch[_0x6a54('0x1f')](_0x4536e3,_0x31fd10,!![]);}catch(_0x214499){return BPromise[_0x6a54('0x20')](_0x214499);}return _0x4536e3[_0x6a54('0x21')]();};}function saveUpdates(_0x4b47b8,_0x175853){return function(_0x4cfc87){if(_0x4cfc87){return _0x4cfc87[_0x6a54('0x22')](_0x4b47b8)[_0x6a54('0x23')](function(_0x3fc031){return _0x3fc031;});}return null;};}function removeEntity(_0x546c5b,_0x45e54a){return function(_0x9a4169){if(_0x9a4169){return _0x9a4169[_0x6a54('0x24')]()[_0x6a54('0x23')](function(){_0x546c5b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c921,_0x4509e1){return function(_0x4168ec){if(!_0x4168ec){_0x3c921['sendStatus'](0x194);}return _0x4168ec;};}function handleError(_0x14f3c2,_0x1688e4){_0x1688e4=_0x1688e4||0x1f4;return function(_0x46a967){logger[_0x6a54('0x25')](_0x46a967[_0x6a54('0x26')]);if(_0x46a967['name']){delete _0x46a967[_0x6a54('0x27')];}_0x14f3c2[_0x6a54('0x16')](_0x1688e4)['send'](_0x46a967);};}exports[_0x6a54('0x28')]=function(_0x5280c1,_0x2d8032){var _0x3b40d3={},_0x3ffa94={},_0x1e149e={'count':0x0,'rows':[]};var _0x4b6c28=_[_0x6a54('0x29')](db[_0x6a54('0x2a')]['rawAttributes'],function(_0x3221da){return{'name':_0x3221da[_0x6a54('0x2b')],'type':_0x3221da[_0x6a54('0x2c')][_0x6a54('0x2d')]};});_0x3ffa94[_0x6a54('0x2e')]=_[_0x6a54('0x29')](_0x4b6c28,'name');_0x3ffa94[_0x6a54('0x2f')]=_[_0x6a54('0x30')](_0x5280c1['query']);_0x3ffa94[_0x6a54('0x31')]=_[_0x6a54('0x32')](_0x3ffa94['model'],_0x3ffa94[_0x6a54('0x2f')]);_0x3b40d3[_0x6a54('0x33')]=_['intersection'](_0x3ffa94[_0x6a54('0x2e')],qs[_0x6a54('0x34')](_0x5280c1[_0x6a54('0x2f')][_0x6a54('0x34')]));_0x3b40d3[_0x6a54('0x33')]=_0x3b40d3[_0x6a54('0x33')][_0x6a54('0x35')]?_0x3b40d3[_0x6a54('0x33')]:_0x3ffa94[_0x6a54('0x2e')];if(!_0x5280c1[_0x6a54('0x2f')]['hasOwnProperty'](_0x6a54('0x36'))){_0x3b40d3[_0x6a54('0x1b')]=qs[_0x6a54('0x1b')](_0x5280c1[_0x6a54('0x2f')]['limit']);_0x3b40d3['offset']=qs['offset'](_0x5280c1[_0x6a54('0x2f')][_0x6a54('0x19')]);}_0x3b40d3[_0x6a54('0x37')]=qs['sort'](_0x5280c1[_0x6a54('0x2f')][_0x6a54('0x38')]);_0x3b40d3[_0x6a54('0x39')]=qs[_0x6a54('0x31')](_[_0x6a54('0x3a')](_0x5280c1[_0x6a54('0x2f')],_0x3ffa94[_0x6a54('0x31')]),_0x4b6c28);if(_0x5280c1[_0x6a54('0x2f')][_0x6a54('0x3b')]){_0x3b40d3[_0x6a54('0x39')]=_[_0x6a54('0x3c')](_0x3b40d3[_0x6a54('0x39')],{'$or':_[_0x6a54('0x29')](_0x4b6c28,function(_0x284c58){if(_0x284c58[_0x6a54('0x2c')]!==_0x6a54('0x3d')){var _0x3887a0={};_0x3887a0[_0x284c58[_0x6a54('0x27')]]={'$like':'%'+_0x5280c1[_0x6a54('0x2f')][_0x6a54('0x3b')]+'%'};return _0x3887a0;}})});}_0x3b40d3=_['merge']({},_0x3b40d3,_0x5280c1['options']);var _0x3f6576={'where':_0x3b40d3[_0x6a54('0x39')]};return db[_0x6a54('0x2a')][_0x6a54('0x1c')](_0x3f6576)['then'](function(_0x535599){_0x1e149e[_0x6a54('0x1c')]=_0x535599;if(_0x5280c1[_0x6a54('0x2f')][_0x6a54('0x3e')]){_0x3b40d3[_0x6a54('0x3f')]=[{'all':!![]}];}return db[_0x6a54('0x2a')][_0x6a54('0x40')](_0x3b40d3);})[_0x6a54('0x23')](function(_0x193126){_0x1e149e['rows']=_0x193126;return _0x1e149e;})['then'](respondWithFilteredResult(_0x2d8032,_0x3b40d3))[_0x6a54('0x41')](handleError(_0x2d8032,null));};exports['show']=function(_0xa9d131,_0x8210bb){var _0x2b1ae6={'raw':![],'where':{'id':_0xa9d131['params']['id']}},_0xe889f={};_0xe889f['model']=_[_0x6a54('0x30')](db[_0x6a54('0x2a')][_0x6a54('0x42')]);_0xe889f[_0x6a54('0x2f')]=_[_0x6a54('0x30')](_0xa9d131[_0x6a54('0x2f')]);_0xe889f['filters']=_[_0x6a54('0x32')](_0xe889f[_0x6a54('0x2e')],_0xe889f['query']);_0x2b1ae6[_0x6a54('0x33')]=_['intersection'](_0xe889f['model'],qs['fields'](_0xa9d131[_0x6a54('0x2f')][_0x6a54('0x34')]));_0x2b1ae6[_0x6a54('0x33')]=_0x2b1ae6['attributes'][_0x6a54('0x35')]?_0x2b1ae6[_0x6a54('0x33')]:_0xe889f[_0x6a54('0x2e')];if(_0xa9d131['query'][_0x6a54('0x3e')]){_0x2b1ae6['include']=[{'all':!![]}];}_0x2b1ae6=_[_0x6a54('0x3c')]({},_0x2b1ae6,_0xa9d131['options']);return db[_0x6a54('0x2a')]['find'](_0x2b1ae6)[_0x6a54('0x23')](handleEntityNotFound(_0x8210bb,null))[_0x6a54('0x23')](respondWithResult(_0x8210bb,null))[_0x6a54('0x41')](handleError(_0x8210bb,null));};exports[_0x6a54('0x43')]=function(_0x67700f,_0x38f5fe){return db[_0x6a54('0x2a')][_0x6a54('0x43')](_0x67700f[_0x6a54('0x44')],{})['then'](respondWithResult(_0x38f5fe,0xc9))[_0x6a54('0x41')](handleError(_0x38f5fe,null));};exports[_0x6a54('0x22')]=function(_0x34963e,_0x20784d){if(_0x34963e[_0x6a54('0x44')]['id']){delete _0x34963e['body']['id'];}return db[_0x6a54('0x2a')][_0x6a54('0x45')]({'where':{'id':_0x34963e[_0x6a54('0x46')]['id']}})[_0x6a54('0x23')](handleEntityNotFound(_0x20784d,null))[_0x6a54('0x23')](saveUpdates(_0x34963e['body'],null))['then'](respondWithResult(_0x20784d,null))['catch'](handleError(_0x20784d,null));};exports['destroy']=function(_0x1856dd,_0x57037e){return db[_0x6a54('0x2a')]['find']({'where':{'id':_0x1856dd[_0x6a54('0x46')]['id']}})['then'](handleEntityNotFound(_0x57037e,null))[_0x6a54('0x23')](removeEntity(_0x57037e,null))[_0x6a54('0x41')](handleError(_0x57037e,null));};exports[_0x6a54('0x47')]=function(_0x265c28,_0x18b09f,_0x402c1c){var _0x581f17={};var _0x4ec2a1={};var _0x2c7d05;var _0x491f94;return db['ZohoAccount'][_0x6a54('0x48')]({'where':{'id':_0x265c28['params']['id']}})[_0x6a54('0x23')](handleEntityNotFound(_0x18b09f,null))['then'](function(_0x36c6aa){if(_0x36c6aa){_0x2c7d05=_0x36c6aa;_0x4ec2a1[_0x6a54('0x2e')]=_[_0x6a54('0x30')](db[_0x6a54('0x49')][_0x6a54('0x42')]);_0x4ec2a1[_0x6a54('0x2f')]=_[_0x6a54('0x30')](_0x265c28[_0x6a54('0x2f')]);_0x4ec2a1['filters']=_['intersection'](_0x4ec2a1['model'],_0x4ec2a1[_0x6a54('0x2f')]);_0x581f17[_0x6a54('0x33')]=_[_0x6a54('0x32')](_0x4ec2a1[_0x6a54('0x2e')],qs[_0x6a54('0x34')](_0x265c28[_0x6a54('0x2f')][_0x6a54('0x34')]));_0x581f17[_0x6a54('0x33')]=_0x581f17[_0x6a54('0x33')]['length']?_0x581f17['attributes']:_0x4ec2a1[_0x6a54('0x2e')];_0x581f17[_0x6a54('0x37')]=qs['sort'](_0x265c28[_0x6a54('0x2f')][_0x6a54('0x38')]);_0x581f17[_0x6a54('0x39')]=qs[_0x6a54('0x31')](_[_0x6a54('0x3a')](_0x265c28[_0x6a54('0x2f')],_0x4ec2a1[_0x6a54('0x31')]));if(_0x265c28['query'][_0x6a54('0x3b')]){_0x581f17[_0x6a54('0x39')]=_['merge'](_0x581f17[_0x6a54('0x39')],{'$or':_[_0x6a54('0x29')](_0x581f17[_0x6a54('0x33')],function(_0xd1792b){var _0x1ebd85={};_0x1ebd85[_0xd1792b]={'$like':'%'+_0x265c28[_0x6a54('0x2f')][_0x6a54('0x3b')]+'%'};return _0x1ebd85;})});}_0x581f17=_[_0x6a54('0x3c')]({},_0x581f17,_0x265c28[_0x6a54('0x4a')]);return _0x2c7d05[_0x6a54('0x47')](_0x581f17);}})[_0x6a54('0x23')](function(_0x137d5a){if(_0x137d5a){_0x491f94=_0x137d5a['length'];if(!_0x265c28[_0x6a54('0x2f')][_0x6a54('0x4b')](_0x6a54('0x36'))){_0x581f17['limit']=qs[_0x6a54('0x1b')](_0x265c28['query']['limit']);_0x581f17[_0x6a54('0x19')]=qs[_0x6a54('0x19')](_0x265c28[_0x6a54('0x2f')][_0x6a54('0x19')]);}return _0x2c7d05[_0x6a54('0x47')](_0x581f17);}})['then'](function(_0x400f50){if(_0x400f50){return _0x400f50?{'count':_0x491f94,'rows':_0x400f50}:null;}})[_0x6a54('0x23')](respondWithResult(_0x18b09f,null))['catch'](handleError(_0x18b09f,null));};exports[_0x6a54('0x4c')]=function(_0x378d20,_0x4fdf46,_0x2c92b4){if(_0x378d20[_0x6a54('0x44')]['id']){delete _0x378d20[_0x6a54('0x44')]['id'];}return db[_0x6a54('0x2a')][_0x6a54('0x48')]({'where':{'id':_0x378d20['params']['id']}})[_0x6a54('0x23')](handleEntityNotFound(_0x4fdf46,null))[_0x6a54('0x23')](function(_0x9a1a5b){if(_0x9a1a5b){_0x378d20['body'][_0x6a54('0x4d')]=_0x9a1a5b['id'];_0x378d20[_0x6a54('0x44')][_0x6a54('0x4e')]=integrations[_0x6a54('0x4f')](_0x378d20['body'][_0x6a54('0x50')],_0x378d20['body'][_0x6a54('0x2c')]);_0x378d20[_0x6a54('0x44')][_0x6a54('0x51')]=integrations['getDescriptions'](_0x378d20[_0x6a54('0x44')]['channel'],_0x378d20[_0x6a54('0x44')][_0x6a54('0x2c')]);return db['ZohoConfiguration'][_0x6a54('0x43')](_0x378d20[_0x6a54('0x44')],{'include':[{'model':db[_0x6a54('0x52')],'as':_0x6a54('0x4e')},{'model':db['ZohoField'],'as':_0x6a54('0x51')}]});}return null;})[_0x6a54('0x23')](respondWithResult(_0x4fdf46,null))[_0x6a54('0x41')](handleError(_0x4fdf46,null));};function getAccessToken(_0x177745){return new Promise(function(_0x5e3e9a,_0xc494d){var _0x40ef80;switch(_0x177745[_0x6a54('0x53')]){case'US':_0x40ef80=_0x6a54('0x54');break;case'AU':_0x40ef80=_0x6a54('0x55');break;case'EU':_0x40ef80=_0x6a54('0x56');break;case'IN':_0x40ef80=_0x6a54('0x57');break;case'CN':_0x40ef80=_0x6a54('0x58');break;default:_0x40ef80=_0x6a54('0x56');break;}var _0x200fa8={'method':'POST','uri':_0x40ef80+_0x6a54('0x59'),'qs':{'refresh_token':_0x177745[_0x6a54('0x5a')],'client_id':_0x177745['clientId'],'client_secret':_0x177745[_0x6a54('0x5b')],'grant_type':_0x6a54('0x5c')},'json':!![]};return rp(_0x200fa8)['then'](function(_0x984fd1){if(_0x984fd1['access_token']){_0x5e3e9a(_0x984fd1[_0x6a54('0x5d')]);}else{_0xc494d(_0x6a54('0x5e'));}})[_0x6a54('0x41')](function(_0x35b21a){_0xc494d(_0x35b21a);});});}exports[_0x6a54('0x5f')]=function(_0x26de40,_0x23bbb5,_0x1dd57a){var _0x44e03b,_0xde6826,_0x52a671,_0x151019,_0x4811f4;return db['ZohoAccount'][_0x6a54('0x48')]({'where':{'id':_0x26de40[_0x6a54('0x46')]['id']},'attributes':['id',_0x6a54('0x60'),_0x6a54('0x53'),_0x6a54('0x61'),_0x6a54('0x5b'),_0x6a54('0x62'),'code',_0x6a54('0x5a')]})[_0x6a54('0x23')](handleEntityNotFound(_0x23bbb5,null))[_0x6a54('0x23')](function(_0x108b76){_0x4811f4=_0x108b76;_0x44e03b=_0x4811f4[_0x6a54('0x60')];_0xde6826=_0x44e03b===_0x6a54('0x63')?'eu':'com';_0x52a671=_0x4811f4['serverUrl'];var _0x55abf4=_0x52a671['slice'](-0x1);if(_0x55abf4==='/'||_0x55abf4==='\x5c'||_0x55abf4===':'){_0x52a671=_0x52a671['substring'](0x0,_0x52a671[_0x6a54('0x64')](_0x55abf4));}if(!_0x4811f4[_0x6a54('0x5a')]){throw new Error(_0x6a54('0x65'));}return getAccessToken(_0x4811f4);})[_0x6a54('0x23')](function(_0x564394){if(_0x564394){return rp({'method':_0x6a54('0x66'),'uri':util[_0x6a54('0x67')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0xde6826),'qs':{'module':_0x6a54('0x68')},'headers':{'Authorization':_0x6a54('0x69')+_0x564394},'json':!![]});}})['then'](function(_0x4e251e){if(_0x4e251e){if(_0x4e251e['response']&&_0x4e251e[_0x6a54('0x6a')][_0x6a54('0x25')]){throw new Error(_0x4e251e[_0x6a54('0x6a')]['error'][_0x6a54('0x6b')]);}var _0x4ff597=[];var _0x73e381=[];var _0x30622e=[_0x6a54('0x6c'),_0x6a54('0x6d'),_0x6a54('0x6e'),_0x6a54('0x6f'),_0x6a54('0x70'),_0x6a54('0x71'),'Call_Start_Time',_0x6a54('0x72')];_0x73e381=_[_0x6a54('0x73')](_0x4e251e[_0x6a54('0x34')],function(_0x567b8d){return _0x30622e[_0x6a54('0x74')](_0x567b8d[_0x6a54('0x75')]);});for(var _0x5d07b3=0x0;_0x5d07b3<_0x73e381[_0x6a54('0x35')];_0x5d07b3++){if(_0x73e381[_0x5d07b3][_0x6a54('0x76')]===![]){_0x4ff597[_0x6a54('0x77')]({'id':_0x73e381[_0x5d07b3]['id'],'name':_0x73e381[_0x5d07b3][_0x6a54('0x78')],'custom':_0x73e381[_0x5d07b3][_0x6a54('0x79')],'options':_0x73e381[_0x5d07b3][_0x6a54('0x7a')]==='picklist'&&_0x73e381[_0x5d07b3]['pick_list_values'][_0x6a54('0x35')]>-0x1?_[_0x6a54('0x29')](_0x73e381[_0x5d07b3]['pick_list_values'],function(_0x377aef){return{'name':_0x377aef,'value':_0x377aef};}):[]});}}return{'count':_0x4ff597[_0x6a54('0x35')],'rows':_0x4ff597};}else{return{'count':0x0,'rows':[]};}})[_0x6a54('0x23')](respondWithResult(_0x23bbb5,null))['catch'](function(_0x2ca4c4){var _0x5f2f30=_0x26de40[_0x6a54('0x2f')][_0x6a54('0x7b')]?0x1f4:_0x2ca4c4['statusCode']||0x1f4;logger[_0x6a54('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5f2f30,JSON[_0x6a54('0x7c')](_0x2ca4c4));delete _0x2ca4c4[_0x6a54('0x27')];if(_0x5f2f30===0x191){_0x5f2f30=0x190;}_0x23bbb5['status'](_0x5f2f30)[_0x6a54('0x7d')](_0x26de40[_0x6a54('0x2f')][_0x6a54('0x7b')]?{'message':_0x6a54('0x7e'),'statusCode':_0x2ca4c4[_0x6a54('0x7f')]}:_0x2ca4c4);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 80aa4ff..a8e523b 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 _0x7ea5=['https://accounts.zoho.in','/oauth/v2/token','application/x-www-form-urlencoded','refreshToken','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientId','clientSecret','code','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','then','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','catch','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','substring'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x7ea5,0xbc));var _0x57ea=function(_0x5bb40b,_0xc2ee56){_0x5bb40b=_0x5bb40b-0x0;var _0x2c32e8=_0x7ea5[_0x5bb40b];return _0x2c32e8;};'use strict';var _=require(_0x57ea('0x0'));var util=require(_0x57ea('0x1'));var logger=require(_0x57ea('0x2'))(_0x57ea('0x3'));var moment=require(_0x57ea('0x4'));var BPromise=require(_0x57ea('0x5'));var rp=require(_0x57ea('0x6'));var fs=require('fs');var path=require(_0x57ea('0x7'));var rimraf=require('rimraf');var config=require(_0x57ea('0x8'));var attributes=require(_0x57ea('0x9'));var integrations=require(_0x57ea('0xa'));module[_0x57ea('0xb')]=function(_0x3e45d7,_0x47fc38){return _0x3e45d7[_0x57ea('0xc')](_0x57ea('0xd'),attributes,{'tableName':_0x57ea('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x42851a,_0xbc2ea4,_0x4e8741){if(_0x42851a['changed'](_0x57ea('0xf'))||_0x42851a[_0x57ea('0x10')](_0x57ea('0x11'))||_0x42851a['changed'](_0x57ea('0x12'))||_0x42851a[_0x57ea('0x10')](_0x57ea('0x13'))||_0x42851a['changed'](_0x57ea('0x14'))||_0x42851a['changed'](_0x57ea('0x15'))){var _0x514c92,_0x477e73;_0x514c92=_0x42851a['serverUrl'];var _0x2c1a5f=_0x514c92[_0x57ea('0x16')](-0x1);if(_0x2c1a5f==='/'||_0x2c1a5f==='\x5c'||_0x2c1a5f===':'){_0x514c92=_0x514c92['substring'](0x0,_0x514c92[_0x57ea('0x17')](_0x2c1a5f));}switch(_0x42851a['zone']){case'US':_0x477e73=_0x57ea('0x18');break;case'AU':_0x477e73=_0x57ea('0x19');break;case'IN':_0x477e73='https://accounts.zoho.in';break;case'CN':_0x477e73=_0x57ea('0x1a');break;default:_0x477e73=_0x57ea('0x1b');break;}var _0x5652e4={'method':_0x57ea('0x1c'),'uri':_0x477e73+'/oauth/v2/token','form':{'grant_type':_0x57ea('0x1d'),'client_id':_0x42851a[_0x57ea('0x12')],'client_secret':_0x42851a[_0x57ea('0x13')],'redirect_uri':_0x42851a[_0x57ea('0x11')],'code':_0x42851a[_0x57ea('0x14')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x5652e4)[_0x57ea('0x1e')](function(_0x38d276){var _0x15e57d=JSON[_0x57ea('0x1f')](_0x38d276);if(_0x15e57d[_0x57ea('0x20')]){_0x42851a['refreshToken']=_0x15e57d[_0x57ea('0x20')];logger[_0x57ea('0x21')](util[_0x57ea('0x22')](_0x57ea('0x23'),_0x42851a[_0x57ea('0x24')],_0x42851a['id']));}else{logger['error'](util[_0x57ea('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x42851a['name'],_0x42851a['id']),util['inspect'](_0x15e57d,{'showHidden':![],'depth':null}));}return _0x4e8741(null,_0xbc2ea4);})[_0x57ea('0x25')](function(_0x414820){logger[_0x57ea('0x26')](util[_0x57ea('0x22')](_0x57ea('0x27'),_0x42851a[_0x57ea('0x24')],_0x42851a['id']),util[_0x57ea('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x4e8741(_0x414820);});}else{return _0x4e8741(null,_0xbc2ea4);}},'beforeUpdate':function(_0x6a4c5c,_0x537303,_0xfc64fd){if(_0x6a4c5c[_0x57ea('0x10')](_0x57ea('0xf'))||_0x6a4c5c[_0x57ea('0x10')]('serverUrl')||_0x6a4c5c[_0x57ea('0x10')](_0x57ea('0x12'))||_0x6a4c5c[_0x57ea('0x10')](_0x57ea('0x13'))||_0x6a4c5c['changed'](_0x57ea('0x14'))||_0x6a4c5c[_0x57ea('0x10')](_0x57ea('0x15'))){var _0x245350,_0x25ea1e;_0x245350=_0x6a4c5c[_0x57ea('0x11')];var _0x5e9209=_0x245350[_0x57ea('0x16')](-0x1);if(_0x5e9209==='/'||_0x5e9209==='\x5c'||_0x5e9209===':'){_0x245350=_0x245350[_0x57ea('0x29')](0x0,_0x245350[_0x57ea('0x17')](_0x5e9209));}switch(_0x6a4c5c[_0x57ea('0xf')]){case'US':_0x25ea1e=_0x57ea('0x18');break;case'AU':_0x25ea1e=_0x57ea('0x19');break;case'IN':_0x25ea1e=_0x57ea('0x2a');break;case'CN':_0x25ea1e='https://accounts.zoho.com.cn';break;default:_0x25ea1e=_0x57ea('0x1b');break;}var _0x39606b={'method':_0x57ea('0x1c'),'uri':_0x25ea1e+_0x57ea('0x2b'),'form':{'grant_type':'authorization_code','client_id':_0x6a4c5c[_0x57ea('0x12')],'client_secret':_0x6a4c5c[_0x57ea('0x13')],'redirect_uri':_0x6a4c5c[_0x57ea('0x11')],'code':_0x6a4c5c[_0x57ea('0x14')]},'headers':{'Content-Type':_0x57ea('0x2c')}};return rp(_0x39606b)[_0x57ea('0x1e')](function(_0x3bcfff){var _0x176570=JSON[_0x57ea('0x1f')](_0x3bcfff);if(_0x176570[_0x57ea('0x20')]){_0x6a4c5c[_0x57ea('0x2d')]=_0x176570['refresh_token'];logger['info'](util[_0x57ea('0x22')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x6a4c5c[_0x57ea('0x24')],_0x6a4c5c['id']));}else{logger[_0x57ea('0x26')](util['format'](_0x57ea('0x27'),_0x6a4c5c['name'],_0x6a4c5c['id']),util['inspect'](_0x176570,{'showHidden':![],'depth':null}));}return _0xfc64fd(null,_0x537303);})[_0x57ea('0x25')](function(_0x5437f6){logger['error'](util['format'](_0x57ea('0x27'),_0x6a4c5c[_0x57ea('0x24')],_0x6a4c5c['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0xfc64fd(_0x5437f6);});}else{return _0xfc64fd(null,_0x537303);}}}});}; \ No newline at end of file +var _0x1c9c=['lastIndexOf','https://accounts.zoho.in','catch','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','ZohoAccount','int_zoho_accounts','zone','changed','clientId','clientSecret','code','host','serverUrl','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d'];(function(_0x144186,_0x4dbe68){var _0x35e8c6=function(_0x32bdf5){while(--_0x32bdf5){_0x144186['push'](_0x144186['shift']());}};_0x35e8c6(++_0x4dbe68);}(_0x1c9c,0xa7));var _0xc1c9=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x1c9c[_0x173d7e];return _0x2220d6;};'use strict';var _=require('lodash');var util=require(_0xc1c9('0x0'));var logger=require(_0xc1c9('0x1'))(_0xc1c9('0x2'));var moment=require(_0xc1c9('0x3'));var BPromise=require('bluebird');var rp=require(_0xc1c9('0x4'));var fs=require('fs');var path=require(_0xc1c9('0x5'));var rimraf=require(_0xc1c9('0x6'));var config=require(_0xc1c9('0x7'));var attributes=require(_0xc1c9('0x8'));var integrations=require(_0xc1c9('0x9'));module['exports']=function(_0x337256,_0x52673e){return _0x337256['define'](_0xc1c9('0xa'),attributes,{'tableName':_0xc1c9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x491c1b,_0x1909df,_0x5771de){if(_0x491c1b['changed'](_0xc1c9('0xc'))||_0x491c1b[_0xc1c9('0xd')]('serverUrl')||_0x491c1b['changed'](_0xc1c9('0xe'))||_0x491c1b[_0xc1c9('0xd')](_0xc1c9('0xf'))||_0x491c1b[_0xc1c9('0xd')](_0xc1c9('0x10'))||_0x491c1b['changed'](_0xc1c9('0x11'))){var _0x4bf3c9,_0x14b563;_0x4bf3c9=_0x491c1b[_0xc1c9('0x12')];var _0x17bfa4=_0x4bf3c9[_0xc1c9('0x13')](-0x1);if(_0x17bfa4==='/'||_0x17bfa4==='\x5c'||_0x17bfa4===':'){_0x4bf3c9=_0x4bf3c9[_0xc1c9('0x14')](0x0,_0x4bf3c9['lastIndexOf'](_0x17bfa4));}switch(_0x491c1b['zone']){case'US':_0x14b563=_0xc1c9('0x15');break;case'AU':_0x14b563=_0xc1c9('0x16');break;case'IN':_0x14b563='https://accounts.zoho.in';break;case'CN':_0x14b563=_0xc1c9('0x17');break;default:_0x14b563=_0xc1c9('0x18');break;}var _0x1abd7a={'method':_0xc1c9('0x19'),'uri':_0x14b563+_0xc1c9('0x1a'),'form':{'grant_type':_0xc1c9('0x1b'),'client_id':_0x491c1b[_0xc1c9('0xe')],'client_secret':_0x491c1b['clientSecret'],'redirect_uri':_0x491c1b[_0xc1c9('0x12')],'code':_0x491c1b[_0xc1c9('0x10')]},'headers':{'Content-Type':_0xc1c9('0x1c')}};return rp(_0x1abd7a)['then'](function(_0xa9b98d){var _0xe6003=JSON[_0xc1c9('0x1d')](_0xa9b98d);if(_0xe6003[_0xc1c9('0x1e')]){_0x491c1b['refreshToken']=_0xe6003[_0xc1c9('0x1e')];logger[_0xc1c9('0x1f')](util[_0xc1c9('0x20')](_0xc1c9('0x21'),_0x491c1b[_0xc1c9('0x22')],_0x491c1b['id']));}else{logger[_0xc1c9('0x23')](util[_0xc1c9('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x491c1b[_0xc1c9('0x22')],_0x491c1b['id']),util[_0xc1c9('0x24')](_0xe6003,{'showHidden':![],'depth':null}));}return _0x5771de(null,_0x1909df);})['catch'](function(_0xb8223f){logger[_0xc1c9('0x23')](util[_0xc1c9('0x20')](_0xc1c9('0x25'),_0x491c1b[_0xc1c9('0x22')],_0x491c1b['id']),util[_0xc1c9('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x5771de(_0xb8223f);});}else{return _0x5771de(null,_0x1909df);}},'beforeUpdate':function(_0x164f96,_0x5b97bd,_0x4ca498){if(_0x164f96['changed'](_0xc1c9('0xc'))||_0x164f96[_0xc1c9('0xd')](_0xc1c9('0x12'))||_0x164f96[_0xc1c9('0xd')]('clientId')||_0x164f96[_0xc1c9('0xd')](_0xc1c9('0xf'))||_0x164f96['changed'](_0xc1c9('0x10'))||_0x164f96['changed'](_0xc1c9('0x11'))){var _0x2bf744,_0x460e1c;_0x2bf744=_0x164f96[_0xc1c9('0x12')];var _0x2ba96f=_0x2bf744[_0xc1c9('0x13')](-0x1);if(_0x2ba96f==='/'||_0x2ba96f==='\x5c'||_0x2ba96f===':'){_0x2bf744=_0x2bf744[_0xc1c9('0x14')](0x0,_0x2bf744[_0xc1c9('0x26')](_0x2ba96f));}switch(_0x164f96[_0xc1c9('0xc')]){case'US':_0x460e1c=_0xc1c9('0x15');break;case'AU':_0x460e1c=_0xc1c9('0x16');break;case'IN':_0x460e1c=_0xc1c9('0x27');break;case'CN':_0x460e1c=_0xc1c9('0x17');break;default:_0x460e1c='https://accounts.zoho.eu';break;}var _0x46b6b7={'method':_0xc1c9('0x19'),'uri':_0x460e1c+_0xc1c9('0x1a'),'form':{'grant_type':'authorization_code','client_id':_0x164f96[_0xc1c9('0xe')],'client_secret':_0x164f96[_0xc1c9('0xf')],'redirect_uri':_0x164f96[_0xc1c9('0x12')],'code':_0x164f96['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x46b6b7)['then'](function(_0x5ee9e8){var _0x2895fd=JSON[_0xc1c9('0x1d')](_0x5ee9e8);if(_0x2895fd['refresh_token']){_0x164f96['refreshToken']=_0x2895fd[_0xc1c9('0x1e')];logger[_0xc1c9('0x1f')](util['format'](_0xc1c9('0x21'),_0x164f96[_0xc1c9('0x22')],_0x164f96['id']));}else{logger['error'](util['format'](_0xc1c9('0x25'),_0x164f96['name'],_0x164f96['id']),util[_0xc1c9('0x24')](_0x2895fd,{'showHidden':![],'depth':null}));}return _0x4ca498(null,_0x5b97bd);})[_0xc1c9('0x28')](function(_0x5e6c78){logger['error'](util[_0xc1c9('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x164f96[_0xc1c9('0x22')],_0x164f96['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4ca498(_0x5e6c78);});}else{return _0x4ca498(null,_0x5b97bd);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 60b3947..8bb8353 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 _0xc224=['request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetZohoAccount','ZohoAccount','options','raw','where','attributes','limit','include','map','model','ShowZohoAccount','find','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc224,0x1af));var _0x4c22=function(_0x56a8da,_0x1e8e6f){_0x56a8da=_0x56a8da-0x0;var _0x57cfc2=_0xc224[_0x56a8da];return _0x57cfc2;};'use strict';var _=require(_0x4c22('0x0'));var util=require(_0x4c22('0x1'));var moment=require(_0x4c22('0x2'));var BPromise=require('bluebird');var rs=require(_0x4c22('0x3'));var fs=require('fs');var Redis=require(_0x4c22('0x4'));var db=require(_0x4c22('0x5'))['db'];var utils=require(_0x4c22('0x6'));var logger=require(_0x4c22('0x7'))(_0x4c22('0x8'));var config=require(_0x4c22('0x9'));var jayson=require(_0x4c22('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49f782,_0x4195b6,_0x3a6191){return new BPromise(function(_0x45397c,_0x309dad){return client[_0x4c22('0xb')](_0x49f782,_0x3a6191)[_0x4c22('0xc')](function(_0x44ec98){logger['info'](_0x4c22('0xd'),_0x4195b6,_0x4c22('0xe'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x4195b6,_0x4c22('0xe'),JSON[_0x4c22('0xf')](_0x44ec98));if(_0x44ec98[_0x4c22('0x10')]){if(_0x44ec98['error'][_0x4c22('0x11')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x4195b6,_0x44ec98['error'][_0x4c22('0x12')]);return _0x309dad(_0x44ec98[_0x4c22('0x10')][_0x4c22('0x12')]);}logger[_0x4c22('0x10')](_0x4c22('0xd'),_0x4195b6,_0x44ec98['error'][_0x4c22('0x12')]);return _0x45397c(_0x44ec98[_0x4c22('0x10')][_0x4c22('0x12')]);}else{logger[_0x4c22('0x13')](_0x4c22('0xd'),_0x4195b6,'request\x20sent');_0x45397c(_0x44ec98['result'][_0x4c22('0x12')]);}})[_0x4c22('0x14')](function(_0x46aaaa){logger[_0x4c22('0x10')](_0x4c22('0xd'),_0x4195b6,_0x46aaaa);_0x309dad(_0x46aaaa);});});}exports[_0x4c22('0x15')]=function(_0x408f6f){var _0x1577c6=this;return new Promise(function(_0x629d81,_0x59f120){return db[_0x4c22('0x16')]['findAll']({'raw':_0x408f6f['options']?_0x408f6f[_0x4c22('0x17')][_0x4c22('0x18')]===undefined?!![]:![]:!![],'where':_0x408f6f[_0x4c22('0x17')]?_0x408f6f[_0x4c22('0x17')][_0x4c22('0x19')]||null:null,'attributes':_0x408f6f[_0x4c22('0x17')]?_0x408f6f['options'][_0x4c22('0x1a')]||null:null,'limit':_0x408f6f['options']?_0x408f6f['options'][_0x4c22('0x1b')]||null:null,'include':_0x408f6f[_0x4c22('0x17')]?_0x408f6f[_0x4c22('0x17')][_0x4c22('0x1c')]?_[_0x4c22('0x1d')](_0x408f6f[_0x4c22('0x17')][_0x4c22('0x1c')],function(_0x38e6d5){return{'model':db[_0x38e6d5[_0x4c22('0x1e')]],'as':_0x38e6d5['as'],'attributes':_0x38e6d5[_0x4c22('0x1a')],'include':_0x38e6d5[_0x4c22('0x1c')]?_[_0x4c22('0x1d')](_0x38e6d5[_0x4c22('0x1c')],function(_0x2fa3d8){return{'model':db[_0x2fa3d8[_0x4c22('0x1e')]],'as':_0x2fa3d8['as'],'attributes':_0x2fa3d8['attributes'],'include':_0x2fa3d8[_0x4c22('0x1c')]?_[_0x4c22('0x1d')](_0x2fa3d8['include'],function(_0x3d15b9){return{'model':db[_0x3d15b9[_0x4c22('0x1e')]],'as':_0x3d15b9['as'],'attributes':_0x3d15b9['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c22('0xc')](function(_0x2d5d49){logger[_0x4c22('0x13')](_0x4c22('0x15'),_0x408f6f);logger['debug'](_0x4c22('0x15'),_0x408f6f,JSON[_0x4c22('0xf')](_0x2d5d49));_0x629d81(_0x2d5d49);})[_0x4c22('0x14')](function(_0x55ca00){logger[_0x4c22('0x10')](_0x4c22('0x15'),_0x55ca00[_0x4c22('0x12')],_0x408f6f);_0x59f120(_0x1577c6[_0x4c22('0x10')](0x1f4,_0x55ca00[_0x4c22('0x12')]));});});};exports[_0x4c22('0x1f')]=function(_0x47fa82){var _0x1ad5e8=this;return new Promise(function(_0x4d10bd,_0x4f4d67){return db['ZohoAccount'][_0x4c22('0x20')]({'raw':_0x47fa82[_0x4c22('0x17')]?_0x47fa82[_0x4c22('0x17')][_0x4c22('0x18')]===undefined?!![]:![]:!![],'where':_0x47fa82[_0x4c22('0x17')]?_0x47fa82[_0x4c22('0x17')][_0x4c22('0x19')]||null:null,'attributes':_0x47fa82[_0x4c22('0x17')]?_0x47fa82[_0x4c22('0x17')][_0x4c22('0x1a')]||null:null,'include':_0x47fa82[_0x4c22('0x17')]?_0x47fa82[_0x4c22('0x17')]['include']?_['map'](_0x47fa82[_0x4c22('0x17')][_0x4c22('0x1c')],function(_0x139726){return{'model':db[_0x139726[_0x4c22('0x1e')]],'as':_0x139726['as'],'attributes':_0x139726[_0x4c22('0x1a')],'include':_0x139726[_0x4c22('0x1c')]?_[_0x4c22('0x1d')](_0x139726[_0x4c22('0x1c')],function(_0x4ad211){return{'model':db[_0x4ad211['model']],'as':_0x4ad211['as'],'attributes':_0x4ad211['attributes'],'include':_0x4ad211['include']?_[_0x4c22('0x1d')](_0x4ad211[_0x4c22('0x1c')],function(_0x17f237){return{'model':db[_0x17f237[_0x4c22('0x1e')]],'as':_0x17f237['as'],'attributes':_0x17f237[_0x4c22('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e1837){logger['info'](_0x4c22('0x1f'),_0x47fa82);logger[_0x4c22('0x21')](_0x4c22('0x1f'),_0x47fa82,JSON[_0x4c22('0xf')](_0x1e1837));_0x4d10bd(_0x1e1837);})[_0x4c22('0x14')](function(_0xf29ec9){logger[_0x4c22('0x10')](_0x4c22('0x1f'),_0xf29ec9[_0x4c22('0x12')],_0x47fa82);_0x4f4d67(_0x1ad5e8[_0x4c22('0x10')](0x1f4,_0xf29ec9['message']));});});}; \ No newline at end of file +var _0xf0f1=['util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','GetZohoAccount','findAll','options','where','attributes','limit','include','map','model','debug','ShowZohoAccount','ZohoAccount','find','raw'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xf0f1,0x110));var _0x1f0f=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0xf0f1[_0x1d50f2];return _0x3769b8;};'use strict';var _=require('lodash');var util=require(_0x1f0f('0x0'));var moment=require(_0x1f0f('0x1'));var BPromise=require(_0x1f0f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f0f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f0f('0x4'))('rpc');var config=require(_0x1f0f('0x5'));var jayson=require(_0x1f0f('0x6'));var client=jayson[_0x1f0f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x145125,_0x31266f,_0x368a4f){return new BPromise(function(_0x43e7fa,_0x2aa60d){return client[_0x1f0f('0x8')](_0x145125,_0x368a4f)[_0x1f0f('0x9')](function(_0x4ed5fb){logger['info'](_0x1f0f('0xa'),_0x31266f,_0x1f0f('0xb'));logger['debug'](_0x1f0f('0xc'),_0x31266f,_0x1f0f('0xb'),JSON[_0x1f0f('0xd')](_0x4ed5fb));if(_0x4ed5fb['error']){if(_0x4ed5fb['error'][_0x1f0f('0xe')]===0x1f4){logger['error'](_0x1f0f('0xa'),_0x31266f,_0x4ed5fb[_0x1f0f('0xf')][_0x1f0f('0x10')]);return _0x2aa60d(_0x4ed5fb[_0x1f0f('0xf')][_0x1f0f('0x10')]);}logger[_0x1f0f('0xf')](_0x1f0f('0xa'),_0x31266f,_0x4ed5fb[_0x1f0f('0xf')][_0x1f0f('0x10')]);return _0x43e7fa(_0x4ed5fb[_0x1f0f('0xf')][_0x1f0f('0x10')]);}else{logger[_0x1f0f('0x11')](_0x1f0f('0xa'),_0x31266f,_0x1f0f('0xb'));_0x43e7fa(_0x4ed5fb[_0x1f0f('0x12')]['message']);}})[_0x1f0f('0x13')](function(_0x22d72c){logger[_0x1f0f('0xf')](_0x1f0f('0xa'),_0x31266f,_0x22d72c);_0x2aa60d(_0x22d72c);});});}exports[_0x1f0f('0x14')]=function(_0x7a8297){var _0x1bd19e=this;return new Promise(function(_0x2b4fb3,_0x4e5081){return db['ZohoAccount'][_0x1f0f('0x15')]({'raw':_0x7a8297[_0x1f0f('0x16')]?_0x7a8297['options']['raw']===undefined?!![]:![]:!![],'where':_0x7a8297[_0x1f0f('0x16')]?_0x7a8297[_0x1f0f('0x16')][_0x1f0f('0x17')]||null:null,'attributes':_0x7a8297['options']?_0x7a8297[_0x1f0f('0x16')][_0x1f0f('0x18')]||null:null,'limit':_0x7a8297[_0x1f0f('0x16')]?_0x7a8297[_0x1f0f('0x16')][_0x1f0f('0x19')]||null:null,'include':_0x7a8297[_0x1f0f('0x16')]?_0x7a8297[_0x1f0f('0x16')][_0x1f0f('0x1a')]?_[_0x1f0f('0x1b')](_0x7a8297[_0x1f0f('0x16')][_0x1f0f('0x1a')],function(_0x2496a2){return{'model':db[_0x2496a2['model']],'as':_0x2496a2['as'],'attributes':_0x2496a2[_0x1f0f('0x18')],'include':_0x2496a2[_0x1f0f('0x1a')]?_[_0x1f0f('0x1b')](_0x2496a2['include'],function(_0x2b8635){return{'model':db[_0x2b8635[_0x1f0f('0x1c')]],'as':_0x2b8635['as'],'attributes':_0x2b8635[_0x1f0f('0x18')],'include':_0x2b8635[_0x1f0f('0x1a')]?_[_0x1f0f('0x1b')](_0x2b8635[_0x1f0f('0x1a')],function(_0x31887e){return{'model':db[_0x31887e[_0x1f0f('0x1c')]],'as':_0x31887e['as'],'attributes':_0x31887e[_0x1f0f('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1f0f('0x9')](function(_0x17fa03){logger['info'](_0x1f0f('0x14'),_0x7a8297);logger[_0x1f0f('0x1d')](_0x1f0f('0x14'),_0x7a8297,JSON[_0x1f0f('0xd')](_0x17fa03));_0x2b4fb3(_0x17fa03);})[_0x1f0f('0x13')](function(_0x351eb6){logger[_0x1f0f('0xf')](_0x1f0f('0x14'),_0x351eb6[_0x1f0f('0x10')],_0x7a8297);_0x4e5081(_0x1bd19e['error'](0x1f4,_0x351eb6[_0x1f0f('0x10')]));});});};exports[_0x1f0f('0x1e')]=function(_0x19aee2){var _0xd782cd=this;return new Promise(function(_0x5a5611,_0x223883){return db[_0x1f0f('0x1f')][_0x1f0f('0x20')]({'raw':_0x19aee2[_0x1f0f('0x16')]?_0x19aee2[_0x1f0f('0x16')][_0x1f0f('0x21')]===undefined?!![]:![]:!![],'where':_0x19aee2['options']?_0x19aee2[_0x1f0f('0x16')][_0x1f0f('0x17')]||null:null,'attributes':_0x19aee2[_0x1f0f('0x16')]?_0x19aee2[_0x1f0f('0x16')][_0x1f0f('0x18')]||null:null,'include':_0x19aee2['options']?_0x19aee2[_0x1f0f('0x16')]['include']?_[_0x1f0f('0x1b')](_0x19aee2[_0x1f0f('0x16')]['include'],function(_0x500121){return{'model':db[_0x500121['model']],'as':_0x500121['as'],'attributes':_0x500121['attributes'],'include':_0x500121[_0x1f0f('0x1a')]?_[_0x1f0f('0x1b')](_0x500121[_0x1f0f('0x1a')],function(_0x5cbe80){return{'model':db[_0x5cbe80['model']],'as':_0x5cbe80['as'],'attributes':_0x5cbe80[_0x1f0f('0x18')],'include':_0x5cbe80[_0x1f0f('0x1a')]?_[_0x1f0f('0x1b')](_0x5cbe80[_0x1f0f('0x1a')],function(_0x4a222a){return{'model':db[_0x4a222a[_0x1f0f('0x1c')]],'as':_0x4a222a['as'],'attributes':_0x4a222a[_0x1f0f('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1f0f('0x9')](function(_0x3ee079){logger[_0x1f0f('0x11')](_0x1f0f('0x1e'),_0x19aee2);logger[_0x1f0f('0x1d')](_0x1f0f('0x1e'),_0x19aee2,JSON[_0x1f0f('0xd')](_0x3ee079));_0x5a5611(_0x3ee079);})[_0x1f0f('0x13')](function(_0x5f31a9){logger[_0x1f0f('0xf')](_0x1f0f('0x1e'),_0x5f31a9['message'],_0x19aee2);_0x223883(_0xd782cd[_0x1f0f('0xf')](0x1f4,_0x5f31a9[_0x1f0f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 473b360..560df41 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 _0xf26f=['isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','delete','destroy','exports','multer','path','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf26f,0x1d4));var _0xff26=function(_0x3aebaa,_0x48d850){_0x3aebaa=_0x3aebaa-0x0;var _0x5d5006=_0xf26f[_0x3aebaa];return _0x5d5006;};'use strict';var multer=require(_0xff26('0x0'));var util=require('util');var path=require(_0xff26('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xff26('0x2'));var auth=require(_0xff26('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xff26('0x4'));var controller=require(_0xff26('0x5'));router[_0xff26('0x6')]('/',auth[_0xff26('0x7')](),controller[_0xff26('0x8')]);router[_0xff26('0x6')](_0xff26('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xff26('0x6')](_0xff26('0xa'),auth[_0xff26('0x7')](),controller['getFields']);router[_0xff26('0x6')](_0xff26('0xb'),auth[_0xff26('0x7')](),controller[_0xff26('0xc')]);router[_0xff26('0x6')](_0xff26('0xd'),auth[_0xff26('0x7')](),controller[_0xff26('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xff26('0xf')]);router['put']('/:id',auth[_0xff26('0x7')](),controller['update']);router[_0xff26('0x10')](_0xff26('0x9'),auth[_0xff26('0x7')](),controller[_0xff26('0x11')]);module[_0xff26('0x12')]=router; \ No newline at end of file +var _0xb2c8=['destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete'];(function(_0x3765db,_0x42772f){var _0x1c13ee=function(_0x2bfe48){while(--_0x2bfe48){_0x3765db['push'](_0x3765db['shift']());}};_0x1c13ee(++_0x42772f);}(_0xb2c8,0x1ba));var _0x8b2c=function(_0x5d2c39,_0x2f755b){_0x5d2c39=_0x5d2c39-0x0;var _0x29f71f=_0xb2c8[_0x5d2c39];return _0x29f71f;};'use strict';var multer=require(_0x8b2c('0x0'));var util=require('util');var path=require(_0x8b2c('0x1'));var timeout=require('connect-timeout');var express=require(_0x8b2c('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8b2c('0x3'));var interaction=require(_0x8b2c('0x4'));var config=require(_0x8b2c('0x5'));var controller=require('./intZohoConfiguration.controller');router['get']('/',auth[_0x8b2c('0x6')](),controller[_0x8b2c('0x7')]);router[_0x8b2c('0x8')](_0x8b2c('0x9'),auth[_0x8b2c('0x6')](),controller['show']);router['get'](_0x8b2c('0xa'),auth[_0x8b2c('0x6')](),controller[_0x8b2c('0xb')]);router['get']('/:id/subjects',auth[_0x8b2c('0x6')](),controller[_0x8b2c('0xc')]);router['get'](_0x8b2c('0xd'),auth[_0x8b2c('0x6')](),controller[_0x8b2c('0xe')]);router[_0x8b2c('0xf')]('/',auth['isAuthenticated'](),controller[_0x8b2c('0x10')]);router[_0x8b2c('0x11')](_0x8b2c('0x9'),auth['isAuthenticated'](),controller[_0x8b2c('0x12')]);router[_0x8b2c('0x13')]('/:id',auth[_0x8b2c('0x6')](),controller[_0x8b2c('0x14')]);module[_0x8b2c('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index cc873bb..2621ae5 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 _0x9578=['ENUM','contact','lead','contact_lead','sequelize','exports','STRING'];(function(_0x5a7112,_0x1f9492){var _0x3147f7=function(_0x4d2329){while(--_0x4d2329){_0x5a7112['push'](_0x5a7112['shift']());}};_0x3147f7(++_0x1f9492);}(_0x9578,0x89));var _0x8957=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9578[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x8957('0x0'));module[_0x8957('0x1')]={'name':{'type':Sequelize[_0x8957('0x2')]},'moduleCreate':{'type':Sequelize[_0x8957('0x3')]('lead',_0x8957('0x4'),'nothing'),'defaultValue':_0x8957('0x5')},'moduleSearch':{'type':Sequelize['ENUM'](_0x8957('0x6'),_0x8957('0x4'),_0x8957('0x5')),'defaultValue':_0x8957('0x6')},'description':{'type':Sequelize[_0x8957('0x2')]}}; \ No newline at end of file +var _0x74fb=['sequelize','exports','lead','contact','nothing','contact_lead','STRING'];(function(_0x248195,_0x4c657d){var _0x1d4dad=function(_0x26bf6d){while(--_0x26bf6d){_0x248195['push'](_0x248195['shift']());}};_0x1d4dad(++_0x4c657d);}(_0x74fb,0x111));var _0xb74f=function(_0x46733d,_0x28cc9a){_0x46733d=_0x46733d-0x0;var _0xb37111=_0x74fb[_0x46733d];return _0xb37111;};'use strict';var Sequelize=require(_0xb74f('0x0'));module[_0xb74f('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0xb74f('0x2'),_0xb74f('0x3'),_0xb74f('0x4')),'defaultValue':_0xb74f('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0xb74f('0x5'),_0xb74f('0x3'),_0xb74f('0x2')),'defaultValue':_0xb74f('0x5')},'description':{'type':Sequelize[_0xb74f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 03bc047..563af1b 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 _0xbfc0=['getDescriptions','ZohoField','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','ZohoConfiguration','rawAttributes','fieldName','type','key','model','map','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','getFields','findOne','getSubjects'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xbfc0,0x146));var _0x0bfc=function(_0x214a25,_0x15071d){_0x214a25=_0x214a25-0x0;var _0x405988=_0xbfc0[_0x214a25];return _0x405988;};'use strict';var emlformat=require(_0x0bfc('0x0'));var rimraf=require(_0x0bfc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0bfc('0x2'));var rp=require(_0x0bfc('0x3'));var moment=require(_0x0bfc('0x4'));var BPromise=require(_0x0bfc('0x5'));var Mustache=require(_0x0bfc('0x6'));var util=require(_0x0bfc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x0bfc('0x8'));var ejs=require(_0x0bfc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0bfc('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0bfc('0xb'));var deskjs=require(_0x0bfc('0xc'));var toCsv=require(_0x0bfc('0x8'));var querystring=require(_0x0bfc('0xd'));var Papa=require('papaparse');var Redis=require(_0x0bfc('0xe'));var authService=require(_0x0bfc('0xf'));var qs=require(_0x0bfc('0x10'));var as=require(_0x0bfc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0bfc('0x12'))('api');var utils=require(_0x0bfc('0x13'));var config=require(_0x0bfc('0x14'));var licenseUtil=require(_0x0bfc('0x15'));var db=require(_0x0bfc('0x16'))['db'];function respondWithStatusCode(_0x327f42,_0xaa2759){_0xaa2759=_0xaa2759||0xcc;return function(_0x36994b){if(_0x36994b){return _0x327f42['sendStatus'](_0xaa2759);}return _0x327f42['status'](_0xaa2759)[_0x0bfc('0x17')]();};}function respondWithResult(_0x2bb24b,_0x409232){_0x409232=_0x409232||0xc8;return function(_0x3594c5){if(_0x3594c5){return _0x2bb24b[_0x0bfc('0x18')](_0x409232)[_0x0bfc('0x19')](_0x3594c5);}};}function respondWithFilteredResult(_0x4bc915,_0x18187d){return function(_0x7cb164){if(_0x7cb164){var _0x226c1d=typeof _0x18187d['offset']===_0x0bfc('0x1a')&&typeof _0x18187d[_0x0bfc('0x1b')]===_0x0bfc('0x1a');var _0x410fbc=_0x7cb164[_0x0bfc('0x1c')];var _0x1f6fbd=_0x226c1d?0x0:_0x18187d[_0x0bfc('0x1d')];var _0x5797b7=_0x226c1d?_0x7cb164[_0x0bfc('0x1c')]:_0x18187d[_0x0bfc('0x1d')]+_0x18187d[_0x0bfc('0x1b')];var _0x4c367b;if(_0x5797b7>=_0x410fbc){_0x5797b7=_0x410fbc;_0x4c367b=0xc8;}else{_0x4c367b=0xce;}_0x4bc915[_0x0bfc('0x18')](_0x4c367b);return _0x4bc915[_0x0bfc('0x1e')](_0x0bfc('0x1f'),_0x1f6fbd+'-'+_0x5797b7+'/'+_0x410fbc)['json'](_0x7cb164);}return null;};}function patchUpdates(_0x1d17f7){return function(_0x3fdc00){try{jsonpatch[_0x0bfc('0x20')](_0x3fdc00,_0x1d17f7,!![]);}catch(_0x3614c4){return BPromise[_0x0bfc('0x21')](_0x3614c4);}return _0x3fdc00[_0x0bfc('0x22')]();};}function saveUpdates(_0x56c994,_0x28bc0e){return function(_0x49aa3f){if(_0x49aa3f){return _0x49aa3f[_0x0bfc('0x23')](_0x56c994)[_0x0bfc('0x24')](function(_0x51ce84){return _0x51ce84;});}return null;};}function removeEntity(_0x295b6d,_0x1ea40d){return function(_0xf97308){if(_0xf97308){return _0xf97308[_0x0bfc('0x25')]()['then'](function(){_0x295b6d[_0x0bfc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51909b,_0x2b3e6b){return function(_0xa95de4){if(!_0xa95de4){_0x51909b['sendStatus'](0x194);}return _0xa95de4;};}function handleError(_0x201410,_0x2bb662){_0x2bb662=_0x2bb662||0x1f4;return function(_0x106232){logger[_0x0bfc('0x26')](_0x106232[_0x0bfc('0x27')]);if(_0x106232['name']){delete _0x106232[_0x0bfc('0x28')];}_0x201410[_0x0bfc('0x18')](_0x2bb662)['send'](_0x106232);};}exports[_0x0bfc('0x29')]=function(_0x3d735c,_0x24e8ea){var _0x31cfc9={},_0x1d1f96={},_0x16aace={'count':0x0,'rows':[]};var _0x1c1bb6=_['map'](db[_0x0bfc('0x2a')][_0x0bfc('0x2b')],function(_0x3cf057){return{'name':_0x3cf057[_0x0bfc('0x2c')],'type':_0x3cf057[_0x0bfc('0x2d')][_0x0bfc('0x2e')]};});_0x1d1f96[_0x0bfc('0x2f')]=_[_0x0bfc('0x30')](_0x1c1bb6,_0x0bfc('0x28'));_0x1d1f96[_0x0bfc('0x31')]=_[_0x0bfc('0x32')](_0x3d735c[_0x0bfc('0x31')]);_0x1d1f96[_0x0bfc('0x33')]=_[_0x0bfc('0x34')](_0x1d1f96['model'],_0x1d1f96[_0x0bfc('0x31')]);_0x31cfc9[_0x0bfc('0x35')]=_[_0x0bfc('0x34')](_0x1d1f96[_0x0bfc('0x2f')],qs[_0x0bfc('0x36')](_0x3d735c[_0x0bfc('0x31')][_0x0bfc('0x36')]));_0x31cfc9[_0x0bfc('0x35')]=_0x31cfc9[_0x0bfc('0x35')][_0x0bfc('0x37')]?_0x31cfc9[_0x0bfc('0x35')]:_0x1d1f96[_0x0bfc('0x2f')];if(!_0x3d735c['query'][_0x0bfc('0x38')](_0x0bfc('0x39'))){_0x31cfc9[_0x0bfc('0x1b')]=qs['limit'](_0x3d735c[_0x0bfc('0x31')][_0x0bfc('0x1b')]);_0x31cfc9[_0x0bfc('0x1d')]=qs['offset'](_0x3d735c[_0x0bfc('0x31')]['offset']);}_0x31cfc9[_0x0bfc('0x3a')]=qs['sort'](_0x3d735c[_0x0bfc('0x31')][_0x0bfc('0x3b')]);_0x31cfc9[_0x0bfc('0x3c')]=qs[_0x0bfc('0x33')](_[_0x0bfc('0x3d')](_0x3d735c[_0x0bfc('0x31')],_0x1d1f96['filters']),_0x1c1bb6);if(_0x3d735c[_0x0bfc('0x31')][_0x0bfc('0x3e')]){_0x31cfc9[_0x0bfc('0x3c')]=_[_0x0bfc('0x3f')](_0x31cfc9['where'],{'$or':_[_0x0bfc('0x30')](_0x1c1bb6,function(_0x4c1631){if(_0x4c1631[_0x0bfc('0x2d')]!==_0x0bfc('0x40')){var _0x2b2bb4={};_0x2b2bb4[_0x4c1631['name']]={'$like':'%'+_0x3d735c[_0x0bfc('0x31')][_0x0bfc('0x3e')]+'%'};return _0x2b2bb4;}})});}_0x31cfc9=_[_0x0bfc('0x3f')]({},_0x31cfc9,_0x3d735c[_0x0bfc('0x41')]);var _0x7ca5d3={'where':_0x31cfc9[_0x0bfc('0x3c')]};return db[_0x0bfc('0x2a')][_0x0bfc('0x1c')](_0x7ca5d3)[_0x0bfc('0x24')](function(_0x4c2fb7){_0x16aace[_0x0bfc('0x1c')]=_0x4c2fb7;if(_0x3d735c[_0x0bfc('0x31')][_0x0bfc('0x42')]){_0x31cfc9[_0x0bfc('0x43')]=[{'all':!![]}];}return db[_0x0bfc('0x2a')][_0x0bfc('0x44')](_0x31cfc9);})[_0x0bfc('0x24')](function(_0x289bff){_0x16aace[_0x0bfc('0x45')]=_0x289bff;return _0x16aace;})[_0x0bfc('0x24')](respondWithFilteredResult(_0x24e8ea,_0x31cfc9))[_0x0bfc('0x46')](handleError(_0x24e8ea,null));};exports[_0x0bfc('0x47')]=function(_0x2a12ad,_0x21c52b){var _0x4401e5={'raw':![],'where':{'id':_0x2a12ad[_0x0bfc('0x48')]['id']}},_0x139099={};_0x139099[_0x0bfc('0x2f')]=_[_0x0bfc('0x32')](db[_0x0bfc('0x2a')]['rawAttributes']);_0x139099['query']=_[_0x0bfc('0x32')](_0x2a12ad[_0x0bfc('0x31')]);_0x139099[_0x0bfc('0x33')]=_[_0x0bfc('0x34')](_0x139099['model'],_0x139099[_0x0bfc('0x31')]);_0x4401e5[_0x0bfc('0x35')]=_['intersection'](_0x139099[_0x0bfc('0x2f')],qs[_0x0bfc('0x36')](_0x2a12ad[_0x0bfc('0x31')]['fields']));_0x4401e5[_0x0bfc('0x35')]=_0x4401e5[_0x0bfc('0x35')][_0x0bfc('0x37')]?_0x4401e5[_0x0bfc('0x35')]:_0x139099['model'];if(_0x2a12ad[_0x0bfc('0x31')][_0x0bfc('0x42')]){_0x4401e5[_0x0bfc('0x43')]=[{'all':!![]}];}_0x4401e5=_['merge']({},_0x4401e5,_0x2a12ad['options']);return db[_0x0bfc('0x2a')][_0x0bfc('0x49')](_0x4401e5)['then'](handleEntityNotFound(_0x21c52b,null))[_0x0bfc('0x24')](respondWithResult(_0x21c52b,null))[_0x0bfc('0x46')](handleError(_0x21c52b,null));};exports[_0x0bfc('0x4a')]=function(_0x452af2,_0x1b0067){return db[_0x0bfc('0x2a')][_0x0bfc('0x4a')](_0x452af2[_0x0bfc('0x4b')],{})['then'](respondWithResult(_0x1b0067,0xc9))[_0x0bfc('0x46')](handleError(_0x1b0067,null));};exports[_0x0bfc('0x23')]=function(_0x4c7e1f,_0xa74b26){if(_0x4c7e1f[_0x0bfc('0x4b')]['id']){delete _0x4c7e1f[_0x0bfc('0x4b')]['id'];}return db[_0x0bfc('0x2a')][_0x0bfc('0x49')]({'where':{'id':_0x4c7e1f[_0x0bfc('0x48')]['id']}})[_0x0bfc('0x24')](handleEntityNotFound(_0xa74b26,null))[_0x0bfc('0x24')](saveUpdates(_0x4c7e1f[_0x0bfc('0x4b')],null))[_0x0bfc('0x24')](respondWithResult(_0xa74b26,null))['catch'](handleError(_0xa74b26,null));};exports[_0x0bfc('0x25')]=function(_0x4c1c18,_0x44487d){return db[_0x0bfc('0x2a')][_0x0bfc('0x49')]({'where':{'id':_0x4c1c18[_0x0bfc('0x48')]['id']}})[_0x0bfc('0x24')](handleEntityNotFound(_0x44487d,null))['then'](removeEntity(_0x44487d,null))['catch'](handleError(_0x44487d,null));};exports[_0x0bfc('0x4c')]=function(_0x17065c,_0x270346,_0x221f2c){var _0x24c24d={};var _0x15e323={};var _0x39c327;var _0x1bea2d;return db[_0x0bfc('0x2a')][_0x0bfc('0x4d')]({'where':{'id':_0x17065c[_0x0bfc('0x48')]['id']}})['then'](handleEntityNotFound(_0x270346,null))[_0x0bfc('0x24')](function(_0x1922e4){if(_0x1922e4){_0x39c327=_0x1922e4;_0x15e323[_0x0bfc('0x2f')]=_[_0x0bfc('0x32')](db['ZohoField'][_0x0bfc('0x2b')]);_0x15e323['query']=_[_0x0bfc('0x32')](_0x17065c[_0x0bfc('0x31')]);_0x15e323[_0x0bfc('0x33')]=_[_0x0bfc('0x34')](_0x15e323['model'],_0x15e323[_0x0bfc('0x31')]);_0x24c24d[_0x0bfc('0x35')]=_[_0x0bfc('0x34')](_0x15e323[_0x0bfc('0x2f')],qs[_0x0bfc('0x36')](_0x17065c['query']['fields']));_0x24c24d[_0x0bfc('0x35')]=_0x24c24d[_0x0bfc('0x35')][_0x0bfc('0x37')]?_0x24c24d[_0x0bfc('0x35')]:_0x15e323['model'];_0x24c24d['order']=qs[_0x0bfc('0x3b')](_0x17065c[_0x0bfc('0x31')][_0x0bfc('0x3b')]);_0x24c24d[_0x0bfc('0x3c')]=qs[_0x0bfc('0x33')](_[_0x0bfc('0x3d')](_0x17065c[_0x0bfc('0x31')],_0x15e323[_0x0bfc('0x33')]));if(_0x17065c[_0x0bfc('0x31')][_0x0bfc('0x3e')]){_0x24c24d[_0x0bfc('0x3c')]=_[_0x0bfc('0x3f')](_0x24c24d[_0x0bfc('0x3c')],{'$or':_[_0x0bfc('0x30')](_0x24c24d[_0x0bfc('0x35')],function(_0x2eefcf){var _0x276333={};_0x276333[_0x2eefcf]={'$like':'%'+_0x17065c[_0x0bfc('0x31')][_0x0bfc('0x3e')]+'%'};return _0x276333;})});}_0x24c24d=_[_0x0bfc('0x3f')]({},_0x24c24d,_0x17065c[_0x0bfc('0x41')]);return _0x39c327[_0x0bfc('0x4c')](_0x24c24d);}})[_0x0bfc('0x24')](function(_0x5d2223){if(_0x5d2223){_0x1bea2d=_0x5d2223[_0x0bfc('0x37')];if(!_0x17065c[_0x0bfc('0x31')][_0x0bfc('0x38')](_0x0bfc('0x39'))){_0x24c24d[_0x0bfc('0x1b')]=qs[_0x0bfc('0x1b')](_0x17065c[_0x0bfc('0x31')]['limit']);_0x24c24d[_0x0bfc('0x1d')]=qs[_0x0bfc('0x1d')](_0x17065c[_0x0bfc('0x31')][_0x0bfc('0x1d')]);}return _0x39c327[_0x0bfc('0x4c')](_0x24c24d);}})['then'](function(_0x4f5c42){if(_0x4f5c42){return _0x4f5c42?{'count':_0x1bea2d,'rows':_0x4f5c42}:null;}})[_0x0bfc('0x24')](respondWithResult(_0x270346,null))[_0x0bfc('0x46')](handleError(_0x270346,null));};exports[_0x0bfc('0x4e')]=function(_0x53af11,_0x48e13d,_0x5aa949){var _0x46282b={};var _0xa057b1={};var _0x5c001c;var _0x5bac4f;return db['ZohoConfiguration'][_0x0bfc('0x4d')]({'where':{'id':_0x53af11[_0x0bfc('0x48')]['id']}})[_0x0bfc('0x24')](handleEntityNotFound(_0x48e13d,null))[_0x0bfc('0x24')](function(_0x325699){if(_0x325699){_0x5c001c=_0x325699;_0xa057b1[_0x0bfc('0x2f')]=_[_0x0bfc('0x32')](db['ZohoField'][_0x0bfc('0x2b')]);_0xa057b1['query']=_[_0x0bfc('0x32')](_0x53af11[_0x0bfc('0x31')]);_0xa057b1['filters']=_[_0x0bfc('0x34')](_0xa057b1['model'],_0xa057b1[_0x0bfc('0x31')]);_0x46282b[_0x0bfc('0x35')]=_[_0x0bfc('0x34')](_0xa057b1[_0x0bfc('0x2f')],qs[_0x0bfc('0x36')](_0x53af11[_0x0bfc('0x31')][_0x0bfc('0x36')]));_0x46282b[_0x0bfc('0x35')]=_0x46282b['attributes']['length']?_0x46282b[_0x0bfc('0x35')]:_0xa057b1[_0x0bfc('0x2f')];_0x46282b[_0x0bfc('0x3a')]=qs['sort'](_0x53af11[_0x0bfc('0x31')]['sort']);_0x46282b[_0x0bfc('0x3c')]=qs[_0x0bfc('0x33')](_[_0x0bfc('0x3d')](_0x53af11['query'],_0xa057b1[_0x0bfc('0x33')]));if(_0x53af11['query']['filter']){_0x46282b[_0x0bfc('0x3c')]=_['merge'](_0x46282b[_0x0bfc('0x3c')],{'$or':_['map'](_0x46282b[_0x0bfc('0x35')],function(_0x37cfff){var _0x27f5ae={};_0x27f5ae[_0x37cfff]={'$like':'%'+_0x53af11[_0x0bfc('0x31')][_0x0bfc('0x3e')]+'%'};return _0x27f5ae;})});}_0x46282b=_['merge']({},_0x46282b,_0x53af11[_0x0bfc('0x41')]);return _0x5c001c[_0x0bfc('0x4e')](_0x46282b);}})[_0x0bfc('0x24')](function(_0xb43fa3){if(_0xb43fa3){_0x5bac4f=_0xb43fa3[_0x0bfc('0x37')];if(!_0x53af11['query'][_0x0bfc('0x38')](_0x0bfc('0x39'))){_0x46282b[_0x0bfc('0x1b')]=qs[_0x0bfc('0x1b')](_0x53af11[_0x0bfc('0x31')][_0x0bfc('0x1b')]);_0x46282b['offset']=qs['offset'](_0x53af11['query'][_0x0bfc('0x1d')]);}return _0x5c001c[_0x0bfc('0x4e')](_0x46282b);}})[_0x0bfc('0x24')](function(_0x1d39d7){if(_0x1d39d7){return _0x1d39d7?{'count':_0x5bac4f,'rows':_0x1d39d7}:null;}})['then'](respondWithResult(_0x48e13d,null))['catch'](handleError(_0x48e13d,null));};exports[_0x0bfc('0x4f')]=function(_0x4ffaa4,_0x46a8a2,_0x5eb955){var _0xbc2b70={};var _0x4e1d7f={};var _0x3d10ed;var _0x568512;return db[_0x0bfc('0x2a')]['findOne']({'where':{'id':_0x4ffaa4['params']['id']}})[_0x0bfc('0x24')](handleEntityNotFound(_0x46a8a2,null))['then'](function(_0x44c239){if(_0x44c239){_0x3d10ed=_0x44c239;_0x4e1d7f[_0x0bfc('0x2f')]=_[_0x0bfc('0x32')](db[_0x0bfc('0x50')][_0x0bfc('0x2b')]);_0x4e1d7f[_0x0bfc('0x31')]=_[_0x0bfc('0x32')](_0x4ffaa4[_0x0bfc('0x31')]);_0x4e1d7f['filters']=_[_0x0bfc('0x34')](_0x4e1d7f[_0x0bfc('0x2f')],_0x4e1d7f[_0x0bfc('0x31')]);_0xbc2b70['attributes']=_[_0x0bfc('0x34')](_0x4e1d7f[_0x0bfc('0x2f')],qs[_0x0bfc('0x36')](_0x4ffaa4[_0x0bfc('0x31')]['fields']));_0xbc2b70['attributes']=_0xbc2b70[_0x0bfc('0x35')][_0x0bfc('0x37')]?_0xbc2b70[_0x0bfc('0x35')]:_0x4e1d7f[_0x0bfc('0x2f')];_0xbc2b70['order']=qs['sort'](_0x4ffaa4[_0x0bfc('0x31')][_0x0bfc('0x3b')]);_0xbc2b70[_0x0bfc('0x3c')]=qs[_0x0bfc('0x33')](_[_0x0bfc('0x3d')](_0x4ffaa4[_0x0bfc('0x31')],_0x4e1d7f['filters']));if(_0x4ffaa4['query'][_0x0bfc('0x3e')]){_0xbc2b70[_0x0bfc('0x3c')]=_[_0x0bfc('0x3f')](_0xbc2b70[_0x0bfc('0x3c')],{'$or':_[_0x0bfc('0x30')](_0xbc2b70[_0x0bfc('0x35')],function(_0x22b2b7){var _0xc39cde={};_0xc39cde[_0x22b2b7]={'$like':'%'+_0x4ffaa4[_0x0bfc('0x31')][_0x0bfc('0x3e')]+'%'};return _0xc39cde;})});}_0xbc2b70=_[_0x0bfc('0x3f')]({},_0xbc2b70,_0x4ffaa4['options']);return _0x3d10ed[_0x0bfc('0x4f')](_0xbc2b70);}})[_0x0bfc('0x24')](function(_0x86e18c){if(_0x86e18c){_0x568512=_0x86e18c[_0x0bfc('0x37')];if(!_0x4ffaa4[_0x0bfc('0x31')][_0x0bfc('0x38')](_0x0bfc('0x39'))){_0xbc2b70[_0x0bfc('0x1b')]=qs[_0x0bfc('0x1b')](_0x4ffaa4[_0x0bfc('0x31')][_0x0bfc('0x1b')]);_0xbc2b70[_0x0bfc('0x1d')]=qs[_0x0bfc('0x1d')](_0x4ffaa4['query'][_0x0bfc('0x1d')]);}return _0x3d10ed[_0x0bfc('0x4f')](_0xbc2b70);}})[_0x0bfc('0x24')](function(_0x4a3b3e){if(_0x4a3b3e){return _0x4a3b3e?{'count':_0x568512,'rows':_0x4a3b3e}:null;}})[_0x0bfc('0x24')](respondWithResult(_0x46a8a2,null))['catch'](handleError(_0x46a8a2,null));}; \ No newline at end of file +var _0xbdaa=['destroy','name','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','catch','show','params','options','find','create','body','getFields','ZohoField','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x3b9634,_0x91afce){var _0x556ee8=function(_0x435030){while(--_0x435030){_0x3b9634['push'](_0x3b9634['shift']());}};_0x556ee8(++_0x91afce);}(_0xbdaa,0x1b3));var _0xabda=function(_0x10b3a2,_0x2b9035){_0x10b3a2=_0x10b3a2-0x0;var _0x15861c=_0xbdaa[_0x10b3a2];return _0x15861c;};'use strict';var emlformat=require(_0xabda('0x0'));var rimraf=require(_0xabda('0x1'));var zipdir=require(_0xabda('0x2'));var jsonpatch=require(_0xabda('0x3'));var rp=require(_0xabda('0x4'));var moment=require(_0xabda('0x5'));var BPromise=require(_0xabda('0x6'));var Mustache=require(_0xabda('0x7'));var util=require(_0xabda('0x8'));var path=require('path');var sox=require(_0xabda('0x9'));var csv=require(_0xabda('0xa'));var ejs=require(_0xabda('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xabda('0xc'));var squel=require(_0xabda('0xd'));var crypto=require(_0xabda('0xe'));var jsforce=require(_0xabda('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xabda('0x10'));var Papa=require(_0xabda('0x11'));var Redis=require(_0xabda('0x12'));var authService=require(_0xabda('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xabda('0x14'));var utils=require(_0xabda('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xabda('0x16'));var db=require(_0xabda('0x17'))['db'];function respondWithStatusCode(_0x36087d,_0x5b26cc){_0x5b26cc=_0x5b26cc||0xcc;return function(_0x4d620b){if(_0x4d620b){return _0x36087d[_0xabda('0x18')](_0x5b26cc);}return _0x36087d[_0xabda('0x19')](_0x5b26cc)[_0xabda('0x1a')]();};}function respondWithResult(_0x2d9afa,_0x4e5fb7){_0x4e5fb7=_0x4e5fb7||0xc8;return function(_0x342472){if(_0x342472){return _0x2d9afa[_0xabda('0x19')](_0x4e5fb7)[_0xabda('0x1b')](_0x342472);}};}function respondWithFilteredResult(_0x2f385b,_0x6bb4eb){return function(_0x23f3f1){if(_0x23f3f1){var _0x3be785=typeof _0x6bb4eb['offset']===_0xabda('0x1c')&&typeof _0x6bb4eb[_0xabda('0x1d')]===_0xabda('0x1c');var _0x4f4d9c=_0x23f3f1['count'];var _0x213117=_0x3be785?0x0:_0x6bb4eb[_0xabda('0x1e')];var _0x26bb46=_0x3be785?_0x23f3f1[_0xabda('0x1f')]:_0x6bb4eb[_0xabda('0x1e')]+_0x6bb4eb[_0xabda('0x1d')];var _0x5610d0;if(_0x26bb46>=_0x4f4d9c){_0x26bb46=_0x4f4d9c;_0x5610d0=0xc8;}else{_0x5610d0=0xce;}_0x2f385b['status'](_0x5610d0);return _0x2f385b[_0xabda('0x20')](_0xabda('0x21'),_0x213117+'-'+_0x26bb46+'/'+_0x4f4d9c)[_0xabda('0x1b')](_0x23f3f1);}return null;};}function patchUpdates(_0xb0624e){return function(_0x124a62){try{jsonpatch[_0xabda('0x22')](_0x124a62,_0xb0624e,!![]);}catch(_0x5835e8){return BPromise[_0xabda('0x23')](_0x5835e8);}return _0x124a62[_0xabda('0x24')]();};}function saveUpdates(_0x30ba7b,_0x200c65){return function(_0x3bd8ad){if(_0x3bd8ad){return _0x3bd8ad[_0xabda('0x25')](_0x30ba7b)[_0xabda('0x26')](function(_0x2f3e12){return _0x2f3e12;});}return null;};}function removeEntity(_0x4692a0,_0x18d234){return function(_0x3c2f52){if(_0x3c2f52){return _0x3c2f52[_0xabda('0x27')]()['then'](function(){_0x4692a0['status'](0xcc)[_0xabda('0x1a')]();});}};}function handleEntityNotFound(_0x509ae6,_0x4e9f5a){return function(_0x3c8ae4){if(!_0x3c8ae4){_0x509ae6[_0xabda('0x18')](0x194);}return _0x3c8ae4;};}function handleError(_0x591d4f,_0xf75721){_0xf75721=_0xf75721||0x1f4;return function(_0x636fec){logger['error'](_0x636fec['stack']);if(_0x636fec[_0xabda('0x28')]){delete _0x636fec['name'];}_0x591d4f[_0xabda('0x19')](_0xf75721)['send'](_0x636fec);};}exports[_0xabda('0x29')]=function(_0x3ad635,_0x3cc136){var _0x44ba39={},_0xacf4a4={},_0x385085={'count':0x0,'rows':[]};var _0x1ec64f=_[_0xabda('0x2a')](db[_0xabda('0x2b')][_0xabda('0x2c')],function(_0x4e925d){return{'name':_0x4e925d[_0xabda('0x2d')],'type':_0x4e925d[_0xabda('0x2e')][_0xabda('0x2f')]};});_0xacf4a4[_0xabda('0x30')]=_[_0xabda('0x2a')](_0x1ec64f,'name');_0xacf4a4[_0xabda('0x31')]=_[_0xabda('0x32')](_0x3ad635[_0xabda('0x31')]);_0xacf4a4[_0xabda('0x33')]=_[_0xabda('0x34')](_0xacf4a4[_0xabda('0x30')],_0xacf4a4[_0xabda('0x31')]);_0x44ba39[_0xabda('0x35')]=_['intersection'](_0xacf4a4[_0xabda('0x30')],qs[_0xabda('0x36')](_0x3ad635['query'][_0xabda('0x36')]));_0x44ba39['attributes']=_0x44ba39[_0xabda('0x35')][_0xabda('0x37')]?_0x44ba39[_0xabda('0x35')]:_0xacf4a4[_0xabda('0x30')];if(!_0x3ad635[_0xabda('0x31')][_0xabda('0x38')](_0xabda('0x39'))){_0x44ba39['limit']=qs[_0xabda('0x1d')](_0x3ad635[_0xabda('0x31')]['limit']);_0x44ba39[_0xabda('0x1e')]=qs[_0xabda('0x1e')](_0x3ad635['query']['offset']);}_0x44ba39[_0xabda('0x3a')]=qs[_0xabda('0x3b')](_0x3ad635['query'][_0xabda('0x3b')]);_0x44ba39[_0xabda('0x3c')]=qs['filters'](_[_0xabda('0x3d')](_0x3ad635[_0xabda('0x31')],_0xacf4a4[_0xabda('0x33')]),_0x1ec64f);if(_0x3ad635['query'][_0xabda('0x3e')]){_0x44ba39[_0xabda('0x3c')]=_['merge'](_0x44ba39[_0xabda('0x3c')],{'$or':_[_0xabda('0x2a')](_0x1ec64f,function(_0x23e7bd){if(_0x23e7bd[_0xabda('0x2e')]!==_0xabda('0x3f')){var _0x13a97a={};_0x13a97a[_0x23e7bd[_0xabda('0x28')]]={'$like':'%'+_0x3ad635[_0xabda('0x31')][_0xabda('0x3e')]+'%'};return _0x13a97a;}})});}_0x44ba39=_[_0xabda('0x40')]({},_0x44ba39,_0x3ad635['options']);var _0x2a8a44={'where':_0x44ba39['where']};return db[_0xabda('0x2b')][_0xabda('0x1f')](_0x2a8a44)[_0xabda('0x26')](function(_0x4d904c){_0x385085['count']=_0x4d904c;if(_0x3ad635[_0xabda('0x31')][_0xabda('0x41')]){_0x44ba39[_0xabda('0x42')]=[{'all':!![]}];}return db[_0xabda('0x2b')]['findAll'](_0x44ba39);})['then'](function(_0x51dc0a){_0x385085['rows']=_0x51dc0a;return _0x385085;})[_0xabda('0x26')](respondWithFilteredResult(_0x3cc136,_0x44ba39))[_0xabda('0x43')](handleError(_0x3cc136,null));};exports[_0xabda('0x44')]=function(_0x111f17,_0x184dd3){var _0x3f02da={'raw':![],'where':{'id':_0x111f17[_0xabda('0x45')]['id']}},_0x207add={};_0x207add['model']=_[_0xabda('0x32')](db[_0xabda('0x2b')][_0xabda('0x2c')]);_0x207add['query']=_[_0xabda('0x32')](_0x111f17['query']);_0x207add['filters']=_['intersection'](_0x207add[_0xabda('0x30')],_0x207add['query']);_0x3f02da[_0xabda('0x35')]=_[_0xabda('0x34')](_0x207add[_0xabda('0x30')],qs['fields'](_0x111f17['query'][_0xabda('0x36')]));_0x3f02da[_0xabda('0x35')]=_0x3f02da['attributes']['length']?_0x3f02da['attributes']:_0x207add[_0xabda('0x30')];if(_0x111f17[_0xabda('0x31')][_0xabda('0x41')]){_0x3f02da[_0xabda('0x42')]=[{'all':!![]}];}_0x3f02da=_['merge']({},_0x3f02da,_0x111f17[_0xabda('0x46')]);return db[_0xabda('0x2b')][_0xabda('0x47')](_0x3f02da)[_0xabda('0x26')](handleEntityNotFound(_0x184dd3,null))['then'](respondWithResult(_0x184dd3,null))[_0xabda('0x43')](handleError(_0x184dd3,null));};exports[_0xabda('0x48')]=function(_0xe745d9,_0x422203){return db[_0xabda('0x2b')][_0xabda('0x48')](_0xe745d9[_0xabda('0x49')],{})[_0xabda('0x26')](respondWithResult(_0x422203,0xc9))[_0xabda('0x43')](handleError(_0x422203,null));};exports[_0xabda('0x25')]=function(_0x176f8e,_0xde960c){if(_0x176f8e[_0xabda('0x49')]['id']){delete _0x176f8e['body']['id'];}return db[_0xabda('0x2b')][_0xabda('0x47')]({'where':{'id':_0x176f8e['params']['id']}})[_0xabda('0x26')](handleEntityNotFound(_0xde960c,null))['then'](saveUpdates(_0x176f8e[_0xabda('0x49')],null))[_0xabda('0x26')](respondWithResult(_0xde960c,null))['catch'](handleError(_0xde960c,null));};exports[_0xabda('0x27')]=function(_0x4a48eb,_0x1b6b36){return db[_0xabda('0x2b')]['find']({'where':{'id':_0x4a48eb[_0xabda('0x45')]['id']}})[_0xabda('0x26')](handleEntityNotFound(_0x1b6b36,null))[_0xabda('0x26')](removeEntity(_0x1b6b36,null))[_0xabda('0x43')](handleError(_0x1b6b36,null));};exports[_0xabda('0x4a')]=function(_0x556e39,_0x24d586,_0x360d68){var _0x4f1999={};var _0x3bfbec={};var _0x4f1afc;var _0x4bd6b2;return db[_0xabda('0x2b')]['findOne']({'where':{'id':_0x556e39[_0xabda('0x45')]['id']}})[_0xabda('0x26')](handleEntityNotFound(_0x24d586,null))[_0xabda('0x26')](function(_0x45f039){if(_0x45f039){_0x4f1afc=_0x45f039;_0x3bfbec['model']=_[_0xabda('0x32')](db[_0xabda('0x4b')][_0xabda('0x2c')]);_0x3bfbec[_0xabda('0x31')]=_[_0xabda('0x32')](_0x556e39['query']);_0x3bfbec['filters']=_[_0xabda('0x34')](_0x3bfbec[_0xabda('0x30')],_0x3bfbec['query']);_0x4f1999['attributes']=_[_0xabda('0x34')](_0x3bfbec[_0xabda('0x30')],qs[_0xabda('0x36')](_0x556e39['query']['fields']));_0x4f1999[_0xabda('0x35')]=_0x4f1999[_0xabda('0x35')][_0xabda('0x37')]?_0x4f1999[_0xabda('0x35')]:_0x3bfbec['model'];_0x4f1999[_0xabda('0x3a')]=qs[_0xabda('0x3b')](_0x556e39[_0xabda('0x31')][_0xabda('0x3b')]);_0x4f1999['where']=qs[_0xabda('0x33')](_['pick'](_0x556e39[_0xabda('0x31')],_0x3bfbec['filters']));if(_0x556e39['query'][_0xabda('0x3e')]){_0x4f1999[_0xabda('0x3c')]=_[_0xabda('0x40')](_0x4f1999['where'],{'$or':_['map'](_0x4f1999['attributes'],function(_0x3ec6aa){var _0x1a8a34={};_0x1a8a34[_0x3ec6aa]={'$like':'%'+_0x556e39[_0xabda('0x31')][_0xabda('0x3e')]+'%'};return _0x1a8a34;})});}_0x4f1999=_['merge']({},_0x4f1999,_0x556e39[_0xabda('0x46')]);return _0x4f1afc[_0xabda('0x4a')](_0x4f1999);}})['then'](function(_0x5ddd59){if(_0x5ddd59){_0x4bd6b2=_0x5ddd59[_0xabda('0x37')];if(!_0x556e39[_0xabda('0x31')][_0xabda('0x38')]('nolimit')){_0x4f1999['limit']=qs['limit'](_0x556e39[_0xabda('0x31')][_0xabda('0x1d')]);_0x4f1999[_0xabda('0x1e')]=qs[_0xabda('0x1e')](_0x556e39[_0xabda('0x31')][_0xabda('0x1e')]);}return _0x4f1afc[_0xabda('0x4a')](_0x4f1999);}})[_0xabda('0x26')](function(_0x23b667){if(_0x23b667){return _0x23b667?{'count':_0x4bd6b2,'rows':_0x23b667}:null;}})[_0xabda('0x26')](respondWithResult(_0x24d586,null))[_0xabda('0x43')](handleError(_0x24d586,null));};exports[_0xabda('0x4c')]=function(_0x469455,_0x37f8a3,_0x2a2e02){var _0x175e80={};var _0x4fff50={};var _0x33daec;var _0xb39bf9;return db[_0xabda('0x2b')]['findOne']({'where':{'id':_0x469455['params']['id']}})[_0xabda('0x26')](handleEntityNotFound(_0x37f8a3,null))['then'](function(_0x3cb403){if(_0x3cb403){_0x33daec=_0x3cb403;_0x4fff50['model']=_[_0xabda('0x32')](db[_0xabda('0x4b')]['rawAttributes']);_0x4fff50['query']=_[_0xabda('0x32')](_0x469455[_0xabda('0x31')]);_0x4fff50[_0xabda('0x33')]=_['intersection'](_0x4fff50[_0xabda('0x30')],_0x4fff50['query']);_0x175e80[_0xabda('0x35')]=_[_0xabda('0x34')](_0x4fff50[_0xabda('0x30')],qs['fields'](_0x469455[_0xabda('0x31')][_0xabda('0x36')]));_0x175e80[_0xabda('0x35')]=_0x175e80['attributes']['length']?_0x175e80['attributes']:_0x4fff50[_0xabda('0x30')];_0x175e80[_0xabda('0x3a')]=qs[_0xabda('0x3b')](_0x469455[_0xabda('0x31')][_0xabda('0x3b')]);_0x175e80[_0xabda('0x3c')]=qs[_0xabda('0x33')](_[_0xabda('0x3d')](_0x469455[_0xabda('0x31')],_0x4fff50['filters']));if(_0x469455['query']['filter']){_0x175e80[_0xabda('0x3c')]=_[_0xabda('0x40')](_0x175e80['where'],{'$or':_[_0xabda('0x2a')](_0x175e80[_0xabda('0x35')],function(_0x12b45b){var _0x5f592d={};_0x5f592d[_0x12b45b]={'$like':'%'+_0x469455[_0xabda('0x31')][_0xabda('0x3e')]+'%'};return _0x5f592d;})});}_0x175e80=_[_0xabda('0x40')]({},_0x175e80,_0x469455[_0xabda('0x46')]);return _0x33daec[_0xabda('0x4c')](_0x175e80);}})[_0xabda('0x26')](function(_0x2c5cbc){if(_0x2c5cbc){_0xb39bf9=_0x2c5cbc[_0xabda('0x37')];if(!_0x469455[_0xabda('0x31')][_0xabda('0x38')](_0xabda('0x39'))){_0x175e80[_0xabda('0x1d')]=qs[_0xabda('0x1d')](_0x469455['query'][_0xabda('0x1d')]);_0x175e80[_0xabda('0x1e')]=qs['offset'](_0x469455[_0xabda('0x31')][_0xabda('0x1e')]);}return _0x33daec[_0xabda('0x4c')](_0x175e80);}})[_0xabda('0x26')](function(_0x4affc5){if(_0x4affc5){return _0x4affc5?{'count':_0xb39bf9,'rows':_0x4affc5}:null;}})[_0xabda('0x26')](respondWithResult(_0x37f8a3,null))[_0xabda('0x43')](handleError(_0x37f8a3,null));};exports[_0xabda('0x4d')]=function(_0x348148,_0x38ac24,_0x3a2027){var _0x5582e1={};var _0x4df4a5={};var _0x1b019d;var _0x2a6627;return db[_0xabda('0x2b')][_0xabda('0x4e')]({'where':{'id':_0x348148[_0xabda('0x45')]['id']}})['then'](handleEntityNotFound(_0x38ac24,null))[_0xabda('0x26')](function(_0x341356){if(_0x341356){_0x1b019d=_0x341356;_0x4df4a5[_0xabda('0x30')]=_[_0xabda('0x32')](db[_0xabda('0x4b')][_0xabda('0x2c')]);_0x4df4a5[_0xabda('0x31')]=_[_0xabda('0x32')](_0x348148[_0xabda('0x31')]);_0x4df4a5['filters']=_[_0xabda('0x34')](_0x4df4a5[_0xabda('0x30')],_0x4df4a5[_0xabda('0x31')]);_0x5582e1[_0xabda('0x35')]=_[_0xabda('0x34')](_0x4df4a5[_0xabda('0x30')],qs[_0xabda('0x36')](_0x348148[_0xabda('0x31')][_0xabda('0x36')]));_0x5582e1['attributes']=_0x5582e1[_0xabda('0x35')][_0xabda('0x37')]?_0x5582e1[_0xabda('0x35')]:_0x4df4a5['model'];_0x5582e1[_0xabda('0x3a')]=qs[_0xabda('0x3b')](_0x348148['query'][_0xabda('0x3b')]);_0x5582e1[_0xabda('0x3c')]=qs['filters'](_[_0xabda('0x3d')](_0x348148['query'],_0x4df4a5[_0xabda('0x33')]));if(_0x348148[_0xabda('0x31')][_0xabda('0x3e')]){_0x5582e1[_0xabda('0x3c')]=_[_0xabda('0x40')](_0x5582e1[_0xabda('0x3c')],{'$or':_[_0xabda('0x2a')](_0x5582e1[_0xabda('0x35')],function(_0x216284){var _0x4159c2={};_0x4159c2[_0x216284]={'$like':'%'+_0x348148[_0xabda('0x31')]['filter']+'%'};return _0x4159c2;})});}_0x5582e1=_[_0xabda('0x40')]({},_0x5582e1,_0x348148[_0xabda('0x46')]);return _0x1b019d[_0xabda('0x4d')](_0x5582e1);}})['then'](function(_0x420175){if(_0x420175){_0x2a6627=_0x420175[_0xabda('0x37')];if(!_0x348148[_0xabda('0x31')][_0xabda('0x38')](_0xabda('0x39'))){_0x5582e1[_0xabda('0x1d')]=qs['limit'](_0x348148[_0xabda('0x31')][_0xabda('0x1d')]);_0x5582e1['offset']=qs[_0xabda('0x1e')](_0x348148[_0xabda('0x31')][_0xabda('0x1e')]);}return _0x1b019d['getDescriptions'](_0x5582e1);}})['then'](function(_0xca8440){if(_0xca8440){return _0xca8440?{'count':_0x2a6627,'rows':_0xca8440}:null;}})[_0xabda('0x26')](respondWithResult(_0x38ac24,null))[_0xabda('0x43')](handleError(_0x38ac24,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 8e21470..beab7e8 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 _0xe629=['rimraf','../../config/environment','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','api','moment','bluebird','path'];(function(_0x147003,_0x36e2e3){var _0x5167b2=function(_0x5b54da){while(--_0x5b54da){_0x147003['push'](_0x147003['shift']());}};_0x5167b2(++_0x36e2e3);}(_0xe629,0x66));var _0x9e62=function(_0x3d103d,_0x24b770){_0x3d103d=_0x3d103d-0x0;var _0x2a3e4b=_0xe629[_0x3d103d];return _0x2a3e4b;};'use strict';var _=require(_0x9e62('0x0'));var util=require(_0x9e62('0x1'));var logger=require('../../config/logger')(_0x9e62('0x2'));var moment=require(_0x9e62('0x3'));var BPromise=require(_0x9e62('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e62('0x5'));var rimraf=require(_0x9e62('0x6'));var config=require(_0x9e62('0x7'));var attributes=require('./intZohoConfiguration.attributes');module[_0x9e62('0x8')]=function(_0x3c3d13,_0x1146b3){return _0x3c3d13[_0x9e62('0x9')](_0x9e62('0xa'),attributes,{'tableName':_0x9e62('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe00d=['../../config/logger','api','moment','bluebird','path','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','util'];(function(_0x53853b,_0x2fc1de){var _0x16dfb5=function(_0x2026c8){while(--_0x2026c8){_0x53853b['push'](_0x53853b['shift']());}};_0x16dfb5(++_0x2fc1de);}(_0xe00d,0x1ad));var _0xde00=function(_0x23b72e,_0x13a42c){_0x23b72e=_0x23b72e-0x0;var _0x4b1507=_0xe00d[_0x23b72e];return _0x4b1507;};'use strict';var _=require('lodash');var util=require(_0xde00('0x0'));var logger=require(_0xde00('0x1'))(_0xde00('0x2'));var moment=require(_0xde00('0x3'));var BPromise=require(_0xde00('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde00('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xde00('0x6'));module[_0xde00('0x7')]=function(_0x4bebcb,_0x1753d0){return _0x4bebcb['define'](_0xde00('0x8'),attributes,{'tableName':_0xde00('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 9cfcdac..dac7103 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 _0x65b1=['request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s'];(function(_0x2c0721,_0x3881d5){var _0x4ab327=function(_0x3d9773){while(--_0x3d9773){_0x2c0721['push'](_0x2c0721['shift']());}};_0x4ab327(++_0x3881d5);}(_0x65b1,0x142));var _0x165b=function(_0x2e35c6,_0x17d112){_0x2e35c6=_0x2e35c6-0x0;var _0xd203e9=_0x65b1[_0x2e35c6];return _0xd203e9;};'use strict';var _=require(_0x165b('0x0'));var util=require(_0x165b('0x1'));var moment=require(_0x165b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x165b('0x3'))['db'];var utils=require(_0x165b('0x4'));var logger=require(_0x165b('0x5'))(_0x165b('0x6'));var config=require('../../config/environment');var jayson=require(_0x165b('0x7'));var client=jayson[_0x165b('0x8')][_0x165b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5efb27,_0x47bc5d,_0x381f83){return new BPromise(function(_0x292a32,_0x49e3b0){return client[_0x165b('0xa')](_0x5efb27,_0x381f83)[_0x165b('0xb')](function(_0x500e45){logger[_0x165b('0xc')](_0x165b('0xd'),_0x47bc5d,_0x165b('0xe'));logger['debug'](_0x165b('0xf'),_0x47bc5d,_0x165b('0xe'),JSON[_0x165b('0x10')](_0x500e45));if(_0x500e45[_0x165b('0x11')]){if(_0x500e45[_0x165b('0x11')]['code']===0x1f4){logger[_0x165b('0x11')](_0x165b('0xd'),_0x47bc5d,_0x500e45[_0x165b('0x11')][_0x165b('0x12')]);return _0x49e3b0(_0x500e45[_0x165b('0x11')][_0x165b('0x12')]);}logger[_0x165b('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x47bc5d,_0x500e45[_0x165b('0x11')]['message']);return _0x292a32(_0x500e45['error'][_0x165b('0x12')]);}else{logger['info'](_0x165b('0xd'),_0x47bc5d,_0x165b('0xe'));_0x292a32(_0x500e45[_0x165b('0x13')][_0x165b('0x12')]);}})[_0x165b('0x14')](function(_0x12fb56){logger[_0x165b('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x47bc5d,_0x12fb56);_0x49e3b0(_0x12fb56);});});} \ No newline at end of file +var _0x06ac=['stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x06ac,0x15e));var _0xc06a=function(_0x52d8d3,_0x49e65d){_0x52d8d3=_0x52d8d3-0x0;var _0x262c6b=_0x06ac[_0x52d8d3];return _0x262c6b;};'use strict';var _=require('lodash');var util=require(_0xc06a('0x0'));var moment=require(_0xc06a('0x1'));var BPromise=require(_0xc06a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc06a('0x3'));var db=require(_0xc06a('0x4'))['db'];var utils=require(_0xc06a('0x5'));var logger=require(_0xc06a('0x6'))('rpc');var config=require(_0xc06a('0x7'));var jayson=require(_0xc06a('0x8'));var client=jayson[_0xc06a('0x9')][_0xc06a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52f3f1,_0x499960,_0x12fd13){return new BPromise(function(_0x2770d4,_0x1e688b){return client[_0xc06a('0xb')](_0x52f3f1,_0x12fd13)[_0xc06a('0xc')](function(_0x5b7667){logger[_0xc06a('0xd')](_0xc06a('0xe'),_0x499960,_0xc06a('0xf'));logger[_0xc06a('0x10')](_0xc06a('0x11'),_0x499960,'request\x20sent',JSON[_0xc06a('0x12')](_0x5b7667));if(_0x5b7667[_0xc06a('0x13')]){if(_0x5b7667[_0xc06a('0x13')][_0xc06a('0x14')]===0x1f4){logger[_0xc06a('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x499960,_0x5b7667[_0xc06a('0x13')]['message']);return _0x1e688b(_0x5b7667[_0xc06a('0x13')][_0xc06a('0x15')]);}logger['error'](_0xc06a('0xe'),_0x499960,_0x5b7667[_0xc06a('0x13')][_0xc06a('0x15')]);return _0x2770d4(_0x5b7667[_0xc06a('0x13')][_0xc06a('0x15')]);}else{logger[_0xc06a('0xd')](_0xc06a('0xe'),_0x499960,_0xc06a('0xf'));_0x2770d4(_0x5b7667[_0xc06a('0x16')][_0xc06a('0x15')]);}})['catch'](function(_0x295b10){logger['error'](_0xc06a('0xe'),_0x499960,_0x295b10);_0x1e688b(_0x295b10);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 28fd200..6cc6f24 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 _0xba26=['isAuthenticated','create','put','update','destroy','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./intZohoField.controller','get','/:id','show','post'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xba26,0x165));var _0x6ba2=function(_0xd085b7,_0x1f7ba9){_0xd085b7=_0xd085b7-0x0;var _0xd9cf4a=_0xba26[_0xd085b7];return _0xd9cf4a;};'use strict';var multer=require(_0x6ba2('0x0'));var util=require('util');var path=require(_0x6ba2('0x1'));var timeout=require(_0x6ba2('0x2'));var express=require('express');var router=express[_0x6ba2('0x3')]();var fs_extra=require(_0x6ba2('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6ba2('0x5'));var controller=require(_0x6ba2('0x6'));router[_0x6ba2('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6ba2('0x7')](_0x6ba2('0x8'),auth['isAuthenticated'](),controller[_0x6ba2('0x9')]);router[_0x6ba2('0xa')]('/',auth[_0x6ba2('0xb')](),controller[_0x6ba2('0xc')]);router[_0x6ba2('0xd')](_0x6ba2('0x8'),auth[_0x6ba2('0xb')](),controller[_0x6ba2('0xe')]);router['delete']('/:id',auth[_0x6ba2('0xb')](),controller[_0x6ba2('0xf')]);module['exports']=router; \ No newline at end of file +var _0xf298=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy'];(function(_0x25c849,_0x41f9e2){var _0x1f5d0a=function(_0xc44663){while(--_0xc44663){_0x25c849['push'](_0x25c849['shift']());}};_0x1f5d0a(++_0x41f9e2);}(_0xf298,0x169));var _0x8f29=function(_0x325989,_0x3908f9){_0x325989=_0x325989-0x0;var _0x3487c7=_0xf298[_0x325989];return _0x3487c7;};'use strict';var multer=require('multer');var util=require(_0x8f29('0x0'));var path=require('path');var timeout=require(_0x8f29('0x1'));var express=require('express');var router=express[_0x8f29('0x2')]();var fs_extra=require(_0x8f29('0x3'));var auth=require(_0x8f29('0x4'));var interaction=require(_0x8f29('0x5'));var config=require(_0x8f29('0x6'));var controller=require(_0x8f29('0x7'));router[_0x8f29('0x8')]('/',auth['isAuthenticated'](),controller[_0x8f29('0x9')]);router[_0x8f29('0x8')](_0x8f29('0xa'),auth[_0x8f29('0xb')](),controller[_0x8f29('0xc')]);router[_0x8f29('0xd')]('/',auth[_0x8f29('0xb')](),controller[_0x8f29('0xe')]);router[_0x8f29('0xf')](_0x8f29('0xa'),auth[_0x8f29('0xb')](),controller[_0x8f29('0x10')]);router[_0x8f29('0x11')]('/:id',auth[_0x8f29('0xb')](),controller[_0x8f29('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 009efee..a6d5854 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 _0x5d9e=['ENUM','string','picklist','STRING','BOOLEAN','exports'];(function(_0x2acda5,_0x3dea6b){var _0x743560=function(_0x222752){while(--_0x222752){_0x2acda5['push'](_0x2acda5['shift']());}};_0x743560(++_0x3dea6b);}(_0x5d9e,0xbf));var _0xe5d9=function(_0x13af35,_0x218859){_0x13af35=_0x13af35-0x0;var _0x4788ce=_0x5d9e[_0x13af35];return _0x4788ce;};'use strict';var Sequelize=require('sequelize');module[_0xe5d9('0x0')]={'type':{'type':Sequelize[_0xe5d9('0x1')](_0xe5d9('0x2'),'variable','customVariable','keyValue',_0xe5d9('0x3')),'defaultValue':_0xe5d9('0x2')},'content':{'type':Sequelize[_0xe5d9('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe5d9('0x1')](_0xe5d9('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xe5d9('0x4')]},'idField':{'type':Sequelize[_0xe5d9('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe5d9('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe5d9('0x4')]}}; \ No newline at end of file +var _0xfc8d=['STRING','customVariable','BOOLEAN','exports','ENUM','string','variable','keyValue'];(function(_0x1267d9,_0x31b5fe){var _0x598bdc=function(_0x595b20){while(--_0x595b20){_0x1267d9['push'](_0x1267d9['shift']());}};_0x598bdc(++_0x31b5fe);}(_0xfc8d,0x83));var _0xdfc8=function(_0x106c88,_0x1de8f1){_0x106c88=_0x106c88-0x0;var _0x264319=_0xfc8d[_0x106c88];return _0x264319;};'use strict';var Sequelize=require('sequelize');module[_0xdfc8('0x0')]={'type':{'type':Sequelize[_0xdfc8('0x1')](_0xdfc8('0x2'),_0xdfc8('0x3'),'customVariable',_0xdfc8('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xdfc8('0x5')]},'key':{'type':Sequelize[_0xdfc8('0x5')]},'keyType':{'type':Sequelize[_0xdfc8('0x1')](_0xdfc8('0x2'),'variable',_0xdfc8('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xdfc8('0x5')]},'nameField':{'type':Sequelize[_0xdfc8('0x5')]},'customField':{'type':Sequelize[_0xdfc8('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdfc8('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 569e808..d2ca93c 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 _0x19b6=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','body','update','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','then','error','name','send','index','ZohoField','rawAttributes','fieldName','type','key','model','query','intersection','fields'];(function(_0x442dd5,_0x53b933){var _0x4126e1=function(_0x180dbf){while(--_0x180dbf){_0x442dd5['push'](_0x442dd5['shift']());}};_0x4126e1(++_0x53b933);}(_0x19b6,0xa6));var _0x619b=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0x19b6[_0xa2c0a3];return _0x52c618;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x619b('0x0'));var zipdir=require(_0x619b('0x1'));var jsonpatch=require(_0x619b('0x2'));var rp=require(_0x619b('0x3'));var moment=require(_0x619b('0x4'));var BPromise=require(_0x619b('0x5'));var Mustache=require(_0x619b('0x6'));var util=require(_0x619b('0x7'));var path=require(_0x619b('0x8'));var sox=require(_0x619b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x619b('0xa'));var squel=require(_0x619b('0xb'));var crypto=require(_0x619b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x619b('0xd'));var toCsv=require(_0x619b('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x619b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x619b('0x10'));var as=require(_0x619b('0x11'));var hardwareService=require(_0x619b('0x12'));var logger=require(_0x619b('0x13'))(_0x619b('0x14'));var utils=require(_0x619b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x619b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33b9b2,_0x27bc08){_0x27bc08=_0x27bc08||0xcc;return function(_0x5e2aec){if(_0x5e2aec){return _0x33b9b2[_0x619b('0x17')](_0x27bc08);}return _0x33b9b2[_0x619b('0x18')](_0x27bc08)[_0x619b('0x19')]();};}function respondWithResult(_0x1eb854,_0x18cab3){_0x18cab3=_0x18cab3||0xc8;return function(_0x28f3ee){if(_0x28f3ee){return _0x1eb854[_0x619b('0x18')](_0x18cab3)[_0x619b('0x1a')](_0x28f3ee);}};}function respondWithFilteredResult(_0x24a5ee,_0x4d088f){return function(_0x8b0618){if(_0x8b0618){var _0xfec75e=typeof _0x4d088f[_0x619b('0x1b')]===_0x619b('0x1c')&&typeof _0x4d088f[_0x619b('0x1d')]===_0x619b('0x1c');var _0x2998a8=_0x8b0618[_0x619b('0x1e')];var _0x9bd7a1=_0xfec75e?0x0:_0x4d088f[_0x619b('0x1b')];var _0x9e8bc2=_0xfec75e?_0x8b0618[_0x619b('0x1e')]:_0x4d088f['offset']+_0x4d088f[_0x619b('0x1d')];var _0x131e09;if(_0x9e8bc2>=_0x2998a8){_0x9e8bc2=_0x2998a8;_0x131e09=0xc8;}else{_0x131e09=0xce;}_0x24a5ee[_0x619b('0x18')](_0x131e09);return _0x24a5ee[_0x619b('0x1f')]('Content-Range',_0x9bd7a1+'-'+_0x9e8bc2+'/'+_0x2998a8)[_0x619b('0x1a')](_0x8b0618);}return null;};}function patchUpdates(_0x4b0bbe){return function(_0x338821){try{jsonpatch[_0x619b('0x20')](_0x338821,_0x4b0bbe,!![]);}catch(_0x14c002){return BPromise['reject'](_0x14c002);}return _0x338821['save']();};}function saveUpdates(_0x21dbeb,_0x446ee0){return function(_0x26a8ef){if(_0x26a8ef){return _0x26a8ef['update'](_0x21dbeb)[_0x619b('0x21')](function(_0x590f2e){return _0x590f2e;});}return null;};}function removeEntity(_0x1db9fe,_0x36a6cf){return function(_0x333fbd){if(_0x333fbd){return _0x333fbd['destroy']()[_0x619b('0x21')](function(){_0x1db9fe[_0x619b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42cec3,_0x19a185){return function(_0x3a645f){if(!_0x3a645f){_0x42cec3[_0x619b('0x17')](0x194);}return _0x3a645f;};}function handleError(_0x336b3d,_0x4b7253){_0x4b7253=_0x4b7253||0x1f4;return function(_0x50332c){logger[_0x619b('0x22')](_0x50332c['stack']);if(_0x50332c[_0x619b('0x23')]){delete _0x50332c[_0x619b('0x23')];}_0x336b3d[_0x619b('0x18')](_0x4b7253)[_0x619b('0x24')](_0x50332c);};}exports[_0x619b('0x25')]=function(_0x3287ee,_0x32a38f){var _0x548c55={},_0x5ca2f8={},_0x39cc08={'count':0x0,'rows':[]};var _0x4493b1=_['map'](db[_0x619b('0x26')][_0x619b('0x27')],function(_0xfcf678){return{'name':_0xfcf678[_0x619b('0x28')],'type':_0xfcf678[_0x619b('0x29')][_0x619b('0x2a')]};});_0x5ca2f8[_0x619b('0x2b')]=_['map'](_0x4493b1,_0x619b('0x23'));_0x5ca2f8[_0x619b('0x2c')]=_['keys'](_0x3287ee[_0x619b('0x2c')]);_0x5ca2f8['filters']=_[_0x619b('0x2d')](_0x5ca2f8[_0x619b('0x2b')],_0x5ca2f8[_0x619b('0x2c')]);_0x548c55['attributes']=_[_0x619b('0x2d')](_0x5ca2f8[_0x619b('0x2b')],qs['fields'](_0x3287ee[_0x619b('0x2c')][_0x619b('0x2e')]));_0x548c55['attributes']=_0x548c55[_0x619b('0x2f')][_0x619b('0x30')]?_0x548c55[_0x619b('0x2f')]:_0x5ca2f8[_0x619b('0x2b')];if(!_0x3287ee[_0x619b('0x2c')][_0x619b('0x31')](_0x619b('0x32'))){_0x548c55[_0x619b('0x1d')]=qs[_0x619b('0x1d')](_0x3287ee[_0x619b('0x2c')][_0x619b('0x1d')]);_0x548c55['offset']=qs[_0x619b('0x1b')](_0x3287ee[_0x619b('0x2c')][_0x619b('0x1b')]);}_0x548c55[_0x619b('0x33')]=qs[_0x619b('0x34')](_0x3287ee[_0x619b('0x2c')]['sort']);_0x548c55[_0x619b('0x35')]=qs['filters'](_[_0x619b('0x36')](_0x3287ee[_0x619b('0x2c')],_0x5ca2f8[_0x619b('0x37')]),_0x4493b1);if(_0x3287ee[_0x619b('0x2c')][_0x619b('0x38')]){_0x548c55['where']=_[_0x619b('0x39')](_0x548c55[_0x619b('0x35')],{'$or':_[_0x619b('0x3a')](_0x4493b1,function(_0x56db10){if(_0x56db10[_0x619b('0x29')]!==_0x619b('0x3b')){var _0x578752={};_0x578752[_0x56db10[_0x619b('0x23')]]={'$like':'%'+_0x3287ee[_0x619b('0x2c')][_0x619b('0x38')]+'%'};return _0x578752;}})});}_0x548c55=_['merge']({},_0x548c55,_0x3287ee['options']);var _0x1293c1={'where':_0x548c55[_0x619b('0x35')]};return db[_0x619b('0x26')][_0x619b('0x1e')](_0x1293c1)['then'](function(_0x3cf5fa){_0x39cc08[_0x619b('0x1e')]=_0x3cf5fa;if(_0x3287ee['query'][_0x619b('0x3c')]){_0x548c55[_0x619b('0x3d')]=[{'all':!![]}];}return db['ZohoField'][_0x619b('0x3e')](_0x548c55);})[_0x619b('0x21')](function(_0x2b300d){_0x39cc08[_0x619b('0x3f')]=_0x2b300d;return _0x39cc08;})[_0x619b('0x21')](respondWithFilteredResult(_0x32a38f,_0x548c55))[_0x619b('0x40')](handleError(_0x32a38f,null));};exports[_0x619b('0x41')]=function(_0x5974fb,_0x45934c){var _0x3e34a1={'raw':!![],'where':{'id':_0x5974fb[_0x619b('0x42')]['id']}},_0x4c0083={};_0x4c0083[_0x619b('0x2b')]=_['keys'](db[_0x619b('0x26')][_0x619b('0x27')]);_0x4c0083['query']=_['keys'](_0x5974fb[_0x619b('0x2c')]);_0x4c0083[_0x619b('0x37')]=_[_0x619b('0x2d')](_0x4c0083[_0x619b('0x2b')],_0x4c0083[_0x619b('0x2c')]);_0x3e34a1[_0x619b('0x2f')]=_[_0x619b('0x2d')](_0x4c0083[_0x619b('0x2b')],qs[_0x619b('0x2e')](_0x5974fb['query'][_0x619b('0x2e')]));_0x3e34a1['attributes']=_0x3e34a1[_0x619b('0x2f')][_0x619b('0x30')]?_0x3e34a1['attributes']:_0x4c0083[_0x619b('0x2b')];if(_0x5974fb[_0x619b('0x2c')][_0x619b('0x3c')]){_0x3e34a1[_0x619b('0x3d')]=[{'all':!![]}];}_0x3e34a1=_[_0x619b('0x39')]({},_0x3e34a1,_0x5974fb['options']);return db[_0x619b('0x26')][_0x619b('0x43')](_0x3e34a1)['then'](handleEntityNotFound(_0x45934c,null))[_0x619b('0x21')](respondWithResult(_0x45934c,null))[_0x619b('0x40')](handleError(_0x45934c,null));};exports['create']=function(_0x1ac657,_0x10a2a7){return db[_0x619b('0x26')]['create'](_0x1ac657[_0x619b('0x44')],{})['then'](respondWithResult(_0x10a2a7,0xc9))[_0x619b('0x40')](handleError(_0x10a2a7,null));};exports[_0x619b('0x45')]=function(_0x4dc12e,_0x45315a){if(_0x4dc12e[_0x619b('0x44')]['id']){delete _0x4dc12e[_0x619b('0x44')]['id'];}return db[_0x619b('0x26')][_0x619b('0x43')]({'where':{'id':_0x4dc12e[_0x619b('0x42')]['id']}})['then'](handleEntityNotFound(_0x45315a,null))[_0x619b('0x21')](saveUpdates(_0x4dc12e[_0x619b('0x44')],null))[_0x619b('0x21')](respondWithResult(_0x45315a,null))['catch'](handleError(_0x45315a,null));};exports[_0x619b('0x46')]=function(_0x34ba41,_0x1e0616){return db['ZohoField'][_0x619b('0x43')]({'where':{'id':_0x34ba41[_0x619b('0x42')]['id']}})[_0x619b('0x21')](handleEntityNotFound(_0x1e0616,null))[_0x619b('0x21')](removeEntity(_0x1e0616,null))[_0x619b('0x40')](handleError(_0x1e0616,null));}; \ No newline at end of file +var _0x2ae7=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','index','ZohoField','rawAttributes','type','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','include','findAll','rows','catch','show','params','intersection','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2ae7,0xcb));var _0x72ae=function(_0x4b5221,_0x515f12){_0x4b5221=_0x4b5221-0x0;var _0x5309bb=_0x2ae7[_0x4b5221];return _0x5309bb;};'use strict';var emlformat=require(_0x72ae('0x0'));var rimraf=require(_0x72ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x72ae('0x2'));var rp=require(_0x72ae('0x3'));var moment=require(_0x72ae('0x4'));var BPromise=require(_0x72ae('0x5'));var Mustache=require(_0x72ae('0x6'));var util=require(_0x72ae('0x7'));var path=require(_0x72ae('0x8'));var sox=require(_0x72ae('0x9'));var csv=require(_0x72ae('0xa'));var ejs=require(_0x72ae('0xb'));var fs=require('fs');var fs_extra=require(_0x72ae('0xc'));var _=require(_0x72ae('0xd'));var squel=require(_0x72ae('0xe'));var crypto=require('crypto');var jsforce=require(_0x72ae('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x72ae('0xa'));var querystring=require(_0x72ae('0x10'));var Papa=require('papaparse');var Redis=require(_0x72ae('0x11'));var authService=require(_0x72ae('0x12'));var qs=require(_0x72ae('0x13'));var as=require(_0x72ae('0x14'));var hardwareService=require(_0x72ae('0x15'));var logger=require(_0x72ae('0x16'))('api');var utils=require(_0x72ae('0x17'));var config=require(_0x72ae('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b0441,_0x3153e6){_0x3153e6=_0x3153e6||0xcc;return function(_0x28a5af){if(_0x28a5af){return _0x1b0441[_0x72ae('0x19')](_0x3153e6);}return _0x1b0441[_0x72ae('0x1a')](_0x3153e6)[_0x72ae('0x1b')]();};}function respondWithResult(_0x142954,_0x10e993){_0x10e993=_0x10e993||0xc8;return function(_0x566882){if(_0x566882){return _0x142954[_0x72ae('0x1a')](_0x10e993)[_0x72ae('0x1c')](_0x566882);}};}function respondWithFilteredResult(_0x3ce732,_0x22a0a8){return function(_0x1a331d){if(_0x1a331d){var _0x108456=typeof _0x22a0a8[_0x72ae('0x1d')]===_0x72ae('0x1e')&&typeof _0x22a0a8[_0x72ae('0x1f')]==='undefined';var _0x4f43bc=_0x1a331d[_0x72ae('0x20')];var _0x43e59b=_0x108456?0x0:_0x22a0a8[_0x72ae('0x1d')];var _0x426f93=_0x108456?_0x1a331d['count']:_0x22a0a8['offset']+_0x22a0a8[_0x72ae('0x1f')];var _0x135c6f;if(_0x426f93>=_0x4f43bc){_0x426f93=_0x4f43bc;_0x135c6f=0xc8;}else{_0x135c6f=0xce;}_0x3ce732[_0x72ae('0x1a')](_0x135c6f);return _0x3ce732[_0x72ae('0x21')]('Content-Range',_0x43e59b+'-'+_0x426f93+'/'+_0x4f43bc)[_0x72ae('0x1c')](_0x1a331d);}return null;};}function patchUpdates(_0x570c06){return function(_0x488f22){try{jsonpatch[_0x72ae('0x22')](_0x488f22,_0x570c06,!![]);}catch(_0xeed2c2){return BPromise[_0x72ae('0x23')](_0xeed2c2);}return _0x488f22['save']();};}function saveUpdates(_0x2c5c1c,_0x5ab3bf){return function(_0x14755c){if(_0x14755c){return _0x14755c[_0x72ae('0x24')](_0x2c5c1c)[_0x72ae('0x25')](function(_0x4ed232){return _0x4ed232;});}return null;};}function removeEntity(_0x4548da,_0x536350){return function(_0x3590b4){if(_0x3590b4){return _0x3590b4[_0x72ae('0x26')]()[_0x72ae('0x25')](function(){_0x4548da[_0x72ae('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xca2503,_0x19831f){return function(_0x384160){if(!_0x384160){_0xca2503['sendStatus'](0x194);}return _0x384160;};}function handleError(_0x4cebfa,_0x367adc){_0x367adc=_0x367adc||0x1f4;return function(_0x473a97){logger[_0x72ae('0x27')](_0x473a97[_0x72ae('0x28')]);if(_0x473a97[_0x72ae('0x29')]){delete _0x473a97[_0x72ae('0x29')];}_0x4cebfa[_0x72ae('0x1a')](_0x367adc)['send'](_0x473a97);};}exports[_0x72ae('0x2a')]=function(_0x173394,_0x3abdb0){var _0x2e4cc1={},_0x639a03={},_0x12afc2={'count':0x0,'rows':[]};var _0x41e346=_['map'](db[_0x72ae('0x2b')][_0x72ae('0x2c')],function(_0x4db4f0){return{'name':_0x4db4f0['fieldName'],'type':_0x4db4f0[_0x72ae('0x2d')][_0x72ae('0x2e')]};});_0x639a03[_0x72ae('0x2f')]=_[_0x72ae('0x30')](_0x41e346,_0x72ae('0x29'));_0x639a03[_0x72ae('0x31')]=_[_0x72ae('0x32')](_0x173394['query']);_0x639a03['filters']=_['intersection'](_0x639a03[_0x72ae('0x2f')],_0x639a03['query']);_0x2e4cc1[_0x72ae('0x33')]=_['intersection'](_0x639a03[_0x72ae('0x2f')],qs[_0x72ae('0x34')](_0x173394[_0x72ae('0x31')][_0x72ae('0x34')]));_0x2e4cc1[_0x72ae('0x33')]=_0x2e4cc1[_0x72ae('0x33')][_0x72ae('0x35')]?_0x2e4cc1[_0x72ae('0x33')]:_0x639a03[_0x72ae('0x2f')];if(!_0x173394['query'][_0x72ae('0x36')](_0x72ae('0x37'))){_0x2e4cc1[_0x72ae('0x1f')]=qs[_0x72ae('0x1f')](_0x173394['query'][_0x72ae('0x1f')]);_0x2e4cc1[_0x72ae('0x1d')]=qs[_0x72ae('0x1d')](_0x173394[_0x72ae('0x31')][_0x72ae('0x1d')]);}_0x2e4cc1[_0x72ae('0x38')]=qs['sort'](_0x173394[_0x72ae('0x31')][_0x72ae('0x39')]);_0x2e4cc1[_0x72ae('0x3a')]=qs[_0x72ae('0x3b')](_[_0x72ae('0x3c')](_0x173394[_0x72ae('0x31')],_0x639a03[_0x72ae('0x3b')]),_0x41e346);if(_0x173394['query']['filter']){_0x2e4cc1['where']=_['merge'](_0x2e4cc1[_0x72ae('0x3a')],{'$or':_[_0x72ae('0x30')](_0x41e346,function(_0x373f97){if(_0x373f97[_0x72ae('0x2d')]!==_0x72ae('0x3d')){var _0x395865={};_0x395865[_0x373f97['name']]={'$like':'%'+_0x173394[_0x72ae('0x31')]['filter']+'%'};return _0x395865;}})});}_0x2e4cc1=_[_0x72ae('0x3e')]({},_0x2e4cc1,_0x173394['options']);var _0x3c5002={'where':_0x2e4cc1[_0x72ae('0x3a')]};return db[_0x72ae('0x2b')][_0x72ae('0x20')](_0x3c5002)[_0x72ae('0x25')](function(_0x1eb344){_0x12afc2[_0x72ae('0x20')]=_0x1eb344;if(_0x173394[_0x72ae('0x31')]['includeAll']){_0x2e4cc1[_0x72ae('0x3f')]=[{'all':!![]}];}return db['ZohoField'][_0x72ae('0x40')](_0x2e4cc1);})[_0x72ae('0x25')](function(_0x158438){_0x12afc2[_0x72ae('0x41')]=_0x158438;return _0x12afc2;})[_0x72ae('0x25')](respondWithFilteredResult(_0x3abdb0,_0x2e4cc1))[_0x72ae('0x42')](handleError(_0x3abdb0,null));};exports[_0x72ae('0x43')]=function(_0x241b84,_0x331ee4){var _0x68b171={'raw':!![],'where':{'id':_0x241b84[_0x72ae('0x44')]['id']}},_0x3e8b60={};_0x3e8b60[_0x72ae('0x2f')]=_[_0x72ae('0x32')](db[_0x72ae('0x2b')][_0x72ae('0x2c')]);_0x3e8b60[_0x72ae('0x31')]=_[_0x72ae('0x32')](_0x241b84[_0x72ae('0x31')]);_0x3e8b60['filters']=_[_0x72ae('0x45')](_0x3e8b60[_0x72ae('0x2f')],_0x3e8b60['query']);_0x68b171[_0x72ae('0x33')]=_[_0x72ae('0x45')](_0x3e8b60[_0x72ae('0x2f')],qs[_0x72ae('0x34')](_0x241b84[_0x72ae('0x31')][_0x72ae('0x34')]));_0x68b171[_0x72ae('0x33')]=_0x68b171[_0x72ae('0x33')]['length']?_0x68b171[_0x72ae('0x33')]:_0x3e8b60[_0x72ae('0x2f')];if(_0x241b84[_0x72ae('0x31')]['includeAll']){_0x68b171['include']=[{'all':!![]}];}_0x68b171=_[_0x72ae('0x3e')]({},_0x68b171,_0x241b84[_0x72ae('0x46')]);return db['ZohoField']['find'](_0x68b171)[_0x72ae('0x25')](handleEntityNotFound(_0x331ee4,null))[_0x72ae('0x25')](respondWithResult(_0x331ee4,null))[_0x72ae('0x42')](handleError(_0x331ee4,null));};exports[_0x72ae('0x47')]=function(_0x36b5d3,_0x10c8ec){return db[_0x72ae('0x2b')][_0x72ae('0x47')](_0x36b5d3['body'],{})[_0x72ae('0x25')](respondWithResult(_0x10c8ec,0xc9))[_0x72ae('0x42')](handleError(_0x10c8ec,null));};exports[_0x72ae('0x24')]=function(_0x5714d3,_0x5a8417){if(_0x5714d3[_0x72ae('0x48')]['id']){delete _0x5714d3[_0x72ae('0x48')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x5714d3[_0x72ae('0x44')]['id']}})[_0x72ae('0x25')](handleEntityNotFound(_0x5a8417,null))[_0x72ae('0x25')](saveUpdates(_0x5714d3[_0x72ae('0x48')],null))['then'](respondWithResult(_0x5a8417,null))[_0x72ae('0x42')](handleError(_0x5a8417,null));};exports['destroy']=function(_0x7b0f91,_0x4bc875){return db[_0x72ae('0x2b')][_0x72ae('0x49')]({'where':{'id':_0x7b0f91['params']['id']}})[_0x72ae('0x25')](handleEntityNotFound(_0x4bc875,null))['then'](removeEntity(_0x4bc875,null))['catch'](handleError(_0x4bc875,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 9065b31..6ec25b6 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 _0xbbbc=['./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x246422,_0x4367e5){_0x246422=_0x246422-0x0;var _0xe86ae7=_0xbbbc[_0x246422];return _0xe86ae7;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var logger=require(_0xcbbb('0x2'))(_0xcbbb('0x3'));var moment=require(_0xcbbb('0x4'));var BPromise=require(_0xcbbb('0x5'));var rp=require(_0xcbbb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbbb('0x7'));var config=require(_0xcbbb('0x8'));var attributes=require(_0xcbbb('0x9'));module[_0xcbbb('0xa')]=function(_0x43ff05,_0x4978a9){return _0x43ff05[_0xcbbb('0xb')](_0xcbbb('0xc'),attributes,{'tableName':_0xcbbb('0xd'),'paranoid':![],'indexes':[{'name':_0xcbbb('0xe'),'fields':[_0xcbbb('0xf'),_0xcbbb('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5464=['util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash'];(function(_0xc8fb34,_0x3c1deb){var _0x34855b=function(_0x37d54a){while(--_0x37d54a){_0xc8fb34['push'](_0xc8fb34['shift']());}};_0x34855b(++_0x3c1deb);}(_0x5464,0x15d));var _0x4546=function(_0x3e0cac,_0x19c06c){_0x3e0cac=_0x3e0cac-0x0;var _0x29c942=_0x5464[_0x3e0cac];return _0x29c942;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var logger=require(_0x4546('0x2'))('api');var moment=require(_0x4546('0x3'));var BPromise=require('bluebird');var rp=require(_0x4546('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4546('0x5'));var config=require(_0x4546('0x6'));var attributes=require(_0x4546('0x7'));module[_0x4546('0x8')]=function(_0x54228a,_0x57391f){return _0x54228a['define'](_0x4546('0x9'),attributes,{'tableName':_0x4546('0xa'),'paranoid':![],'indexes':[{'name':_0x4546('0xb'),'fields':[_0x4546('0xc'),_0x4546('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 7c32fd4..9407b4f 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 _0x2313=['client','http','then','info','ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2ae63c,_0x4f2d25){var _0x55608c=function(_0x1702c2){while(--_0x1702c2){_0x2ae63c['push'](_0x2ae63c['shift']());}};_0x55608c(++_0x4f2d25);}(_0x2313,0x7e));var _0x3231=function(_0x46c9c2,_0x56387e){_0x46c9c2=_0x46c9c2-0x0;var _0x1a0768=_0x2313[_0x46c9c2];return _0x1a0768;};'use strict';var _=require(_0x3231('0x0'));var util=require('util');var moment=require(_0x3231('0x1'));var BPromise=require('bluebird');var rs=require(_0x3231('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3231('0x3'));var logger=require(_0x3231('0x4'))('rpc');var config=require(_0x3231('0x5'));var jayson=require(_0x3231('0x6'));var client=jayson[_0x3231('0x7')][_0x3231('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf60a86,_0x467bf3,_0x139a7a){return new BPromise(function(_0x5e1792,_0x34baa9){return client['request'](_0xf60a86,_0x139a7a)[_0x3231('0x9')](function(_0x2fabfc){logger[_0x3231('0xa')](_0x3231('0xb'),_0x467bf3,'request\x20sent');logger['debug'](_0x3231('0xc'),_0x467bf3,_0x3231('0xd'),JSON[_0x3231('0xe')](_0x2fabfc));if(_0x2fabfc[_0x3231('0xf')]){if(_0x2fabfc[_0x3231('0xf')][_0x3231('0x10')]===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x467bf3,_0x2fabfc[_0x3231('0xf')]['message']);return _0x34baa9(_0x2fabfc[_0x3231('0xf')][_0x3231('0x11')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x467bf3,_0x2fabfc[_0x3231('0xf')][_0x3231('0x11')]);return _0x5e1792(_0x2fabfc[_0x3231('0xf')][_0x3231('0x11')]);}else{logger[_0x3231('0xa')](_0x3231('0xb'),_0x467bf3,_0x3231('0xd'));_0x5e1792(_0x2fabfc['result'][_0x3231('0x11')]);}})[_0x3231('0x12')](function(_0x272c52){logger[_0x3231('0xf')](_0x3231('0xb'),_0x467bf3,_0x272c52);_0x34baa9(_0x272c52);});});} \ No newline at end of file +var _0xe1d7=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch'];(function(_0x2e3416,_0x5073f4){var _0x1749ff=function(_0x3322d1){while(--_0x3322d1){_0x2e3416['push'](_0x2e3416['shift']());}};_0x1749ff(++_0x5073f4);}(_0xe1d7,0x111));var _0x7e1d=function(_0x3e1e91,_0x970a2e){_0x3e1e91=_0x3e1e91-0x0;var _0x4db75d=_0xe1d7[_0x3e1e91];return _0x4db75d;};'use strict';var _=require(_0x7e1d('0x0'));var util=require('util');var moment=require(_0x7e1d('0x1'));var BPromise=require(_0x7e1d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e1d('0x3'));var db=require(_0x7e1d('0x4'))['db'];var utils=require(_0x7e1d('0x5'));var logger=require(_0x7e1d('0x6'))(_0x7e1d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7e1d('0x8')][_0x7e1d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ee7da,_0x335af1,_0x1c0d83){return new BPromise(function(_0x1adfa7,_0x5a84bc){return client['request'](_0x5ee7da,_0x1c0d83)[_0x7e1d('0xa')](function(_0x5f02df){logger['info'](_0x7e1d('0xb'),_0x335af1,'request\x20sent');logger[_0x7e1d('0xc')](_0x7e1d('0xd'),_0x335af1,_0x7e1d('0xe'),JSON[_0x7e1d('0xf')](_0x5f02df));if(_0x5f02df[_0x7e1d('0x10')]){if(_0x5f02df[_0x7e1d('0x10')]['code']===0x1f4){logger[_0x7e1d('0x10')](_0x7e1d('0xb'),_0x335af1,_0x5f02df[_0x7e1d('0x10')][_0x7e1d('0x11')]);return _0x5a84bc(_0x5f02df[_0x7e1d('0x10')][_0x7e1d('0x11')]);}logger[_0x7e1d('0x10')](_0x7e1d('0xb'),_0x335af1,_0x5f02df['error'][_0x7e1d('0x11')]);return _0x1adfa7(_0x5f02df[_0x7e1d('0x10')][_0x7e1d('0x11')]);}else{logger[_0x7e1d('0x12')]('ZohoField,\x20%s,\x20%s',_0x335af1,_0x7e1d('0xe'));_0x1adfa7(_0x5f02df[_0x7e1d('0x13')][_0x7e1d('0x11')]);}})[_0x7e1d('0x14')](function(_0x1f76fa){logger[_0x7e1d('0x10')](_0x7e1d('0xb'),_0x335af1,_0x1f76fa);_0x5a84bc(_0x1f76fa);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 2c0e309..49a95c4 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(_0x22e9fe,_0x3d019f){var _0x47cd19=function(_0x8fd5fc){while(--_0x8fd5fc){_0x22e9fe['push'](_0x22e9fe['shift']());}};_0x47cd19(++_0x3d019f);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5a6d1b,_0x4834ff){var _0x320c85=function(_0x4f76c9){while(--_0x4f76c9){_0x5a6d1b['push'](_0x5a6d1b['shift']());}};_0x320c85(++_0x4834ff);}(_0xe706,0xa3));var _0x6e70=function(_0x510794,_0x120e85){_0x510794=_0x510794-0x0;var _0x3bd818=_0xe706[_0x510794];return _0x3bd818;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 62b4d60..1a28f5b 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 _0x5f5f=['unique_name_and_version','app.js','INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x906fa7,_0x3cb61e){var _0x4db0f7=function(_0x27ef8e){while(--_0x27ef8e){_0x906fa7['push'](_0x906fa7['shift']());}};_0x4db0f7(++_0x3cb61e);}(_0x5f5f,0x178));var _0xf5f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f5f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf5f5('0x0'));module['exports']={'name':{'type':Sequelize[_0xf5f5('0x1')],'allowNull':![],'unique':_0xf5f5('0x2')},'version':{'type':Sequelize[_0xf5f5('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xf5f5('0x1')],'defaultValue':_0xf5f5('0x3')},'filename':{'type':Sequelize[_0xf5f5('0x1')]},'path':{'type':Sequelize[_0xf5f5('0x1')]},'type':{'type':Sequelize[_0xf5f5('0x1')]},'size':{'type':Sequelize[_0xf5f5('0x4')]},'active':{'type':Sequelize[_0xf5f5('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xf5f5('0x1')]},'logo':{'type':Sequelize[_0xf5f5('0x1')]},'state':{'type':Sequelize['STRING'],'unique':'state'},'description':{'type':Sequelize[_0xf5f5('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xf5f5('0x1')]},'link':{'type':Sequelize[_0xf5f5('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x8b78=['BOOLEAN','state','sequelize','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x3ed2be,_0x1a3bc9){var _0x1b8b6f=function(_0x5231ad){while(--_0x5231ad){_0x3ed2be['push'](_0x3ed2be['shift']());}};_0x1b8b6f(++_0x1a3bc9);}(_0x8b78,0xaa));var _0x88b7=function(_0x5802fc,_0x9aced3){_0x5802fc=_0x5802fc-0x0;var _0x1ad6db=_0x8b78[_0x5802fc];return _0x1ad6db;};'use strict';var Sequelize=require(_0x88b7('0x0'));module['exports']={'name':{'type':Sequelize[_0x88b7('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x88b7('0x1')],'allowNull':![],'unique':_0x88b7('0x2')},'main':{'type':Sequelize[_0x88b7('0x1')],'defaultValue':_0x88b7('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x88b7('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x88b7('0x4')]},'active':{'type':Sequelize[_0x88b7('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x88b7('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x88b7('0x1')],'unique':_0x88b7('0x6')},'description':{'type':Sequelize[_0x88b7('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x88b7('0x1')]},'link':{'type':Sequelize[_0x88b7('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index eabda87..a33eb30 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 _0x4c60=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','end','error','stack','name','index','map','Integration','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','includeAll','find','create','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x4c60,0xc1));var _0x04c6=function(_0x1f7cd9,_0x57bb69){_0x1f7cd9=_0x1f7cd9-0x0;var _0x1d03a8=_0x4c60[_0x1f7cd9];return _0x1d03a8;};'use strict';var emlformat=require(_0x04c6('0x0'));var rimraf=require(_0x04c6('0x1'));var zipdir=require(_0x04c6('0x2'));var jsonpatch=require(_0x04c6('0x3'));var rp=require('request-promise');var moment=require(_0x04c6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x04c6('0x5'));var csv=require(_0x04c6('0x6'));var ejs=require(_0x04c6('0x7'));var fs=require('fs');var fs_extra=require(_0x04c6('0x8'));var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x6'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var licenseUtil=require(_0x04c6('0x13'));var db=require(_0x04c6('0x14'))['db'];function respondWithStatusCode(_0x4e5e6,_0x52cdcf){_0x52cdcf=_0x52cdcf||0xcc;return function(_0x257a0a){if(_0x257a0a){return _0x4e5e6[_0x04c6('0x15')](_0x52cdcf);}return _0x4e5e6[_0x04c6('0x16')](_0x52cdcf)['end']();};}function respondWithResult(_0x12d1c5,_0x15cbe0){_0x15cbe0=_0x15cbe0||0xc8;return function(_0x28632e){if(_0x28632e){return _0x12d1c5[_0x04c6('0x16')](_0x15cbe0)[_0x04c6('0x17')](_0x28632e);}};}function respondWithFilteredResult(_0x19a26f,_0x1cd963){return function(_0x3d46a9){if(_0x3d46a9){var _0x5a5a66=typeof _0x1cd963[_0x04c6('0x18')]===_0x04c6('0x19')&&typeof _0x1cd963[_0x04c6('0x1a')]===_0x04c6('0x19');var _0x43596a=_0x3d46a9[_0x04c6('0x1b')];var _0x21674a=_0x5a5a66?0x0:_0x1cd963[_0x04c6('0x18')];var _0x47f400=_0x5a5a66?_0x3d46a9[_0x04c6('0x1b')]:_0x1cd963[_0x04c6('0x18')]+_0x1cd963[_0x04c6('0x1a')];var _0x558b43;if(_0x47f400>=_0x43596a){_0x47f400=_0x43596a;_0x558b43=0xc8;}else{_0x558b43=0xce;}_0x19a26f['status'](_0x558b43);return _0x19a26f['set'](_0x04c6('0x1c'),_0x21674a+'-'+_0x47f400+'/'+_0x43596a)[_0x04c6('0x17')](_0x3d46a9);}return null;};}function patchUpdates(_0x50dd61){return function(_0x5a5e9e){try{jsonpatch[_0x04c6('0x1d')](_0x5a5e9e,_0x50dd61,!![]);}catch(_0x2eed94){return BPromise[_0x04c6('0x1e')](_0x2eed94);}return _0x5a5e9e['save']();};}function saveUpdates(_0x33a0f7,_0x13f2dc){return function(_0x9d41f8){if(_0x9d41f8){return _0x9d41f8['update'](_0x33a0f7)[_0x04c6('0x1f')](function(_0x41e29f){return _0x41e29f;});}return null;};}function removeEntity(_0x562491,_0x54a8b0){return function(_0x4c8d72){if(_0x4c8d72){return _0x4c8d72[_0x04c6('0x20')]()[_0x04c6('0x1f')](function(){_0x562491[_0x04c6('0x16')](0xcc)[_0x04c6('0x21')]();});}};}function handleEntityNotFound(_0x3e1328,_0x52e5f5){return function(_0x562952){if(!_0x562952){_0x3e1328[_0x04c6('0x15')](0x194);}return _0x562952;};}function handleError(_0x2ab1d2,_0x9acfa){_0x9acfa=_0x9acfa||0x1f4;return function(_0x3233d7){logger[_0x04c6('0x22')](_0x3233d7[_0x04c6('0x23')]);if(_0x3233d7['name']){delete _0x3233d7[_0x04c6('0x24')];}_0x2ab1d2[_0x04c6('0x16')](_0x9acfa)['send'](_0x3233d7);};}exports[_0x04c6('0x25')]=function(_0x1cd16a,_0x5f1331){var _0x5c9003={},_0x115d84={},_0x3a6d92={'count':0x0,'rows':[]};var _0x2a191f=_[_0x04c6('0x26')](db[_0x04c6('0x27')][_0x04c6('0x28')],function(_0x49c4ed){return{'name':_0x49c4ed['fieldName'],'type':_0x49c4ed['type'][_0x04c6('0x29')]};});_0x115d84['model']=_[_0x04c6('0x26')](_0x2a191f,_0x04c6('0x24'));_0x115d84['query']=_[_0x04c6('0x2a')](_0x1cd16a[_0x04c6('0x2b')]);_0x115d84[_0x04c6('0x2c')]=_[_0x04c6('0x2d')](_0x115d84['model'],_0x115d84[_0x04c6('0x2b')]);_0x5c9003[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0x115d84[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x30')]));_0x5c9003[_0x04c6('0x2e')]=_0x5c9003[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x5c9003[_0x04c6('0x2e')]:_0x115d84[_0x04c6('0x2f')];if(!_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x32')](_0x04c6('0x33'))){_0x5c9003['limit']=qs[_0x04c6('0x1a')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x1a')]);_0x5c9003[_0x04c6('0x18')]=qs['offset'](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x18')]);}_0x5c9003['order']=qs['sort'](_0x1cd16a['query'][_0x04c6('0x34')]);_0x5c9003[_0x04c6('0x35')]=qs['filters'](_[_0x04c6('0x36')](_0x1cd16a['query'],_0x115d84[_0x04c6('0x2c')]),_0x2a191f);if(_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x37')]){_0x5c9003[_0x04c6('0x35')]=_['merge'](_0x5c9003['where'],{'$or':_[_0x04c6('0x26')](_0x2a191f,function(_0x3a9a3b){if(_0x3a9a3b['type']!==_0x04c6('0x38')){var _0x5ce4b0={};_0x5ce4b0[_0x3a9a3b['name']]={'$like':'%'+_0x1cd16a[_0x04c6('0x2b')]['filter']+'%'};return _0x5ce4b0;}})});}_0x5c9003=_[_0x04c6('0x39')]({},_0x5c9003,_0x1cd16a[_0x04c6('0x3a')]);var _0x59ca18={'where':_0x5c9003[_0x04c6('0x35')]};return db['Integration'][_0x04c6('0x1b')](_0x59ca18)[_0x04c6('0x1f')](function(_0x2d83eb){_0x3a6d92[_0x04c6('0x1b')]=_0x2d83eb;if(_0x1cd16a[_0x04c6('0x2b')]['includeAll']){_0x5c9003[_0x04c6('0x3b')]=[{'all':!![]}];}return db['Integration'][_0x04c6('0x3c')](_0x5c9003);})['then'](function(_0x1f7ead){_0x3a6d92[_0x04c6('0x3d')]=_0x1f7ead;return _0x3a6d92;})[_0x04c6('0x1f')](respondWithFilteredResult(_0x5f1331,_0x5c9003))[_0x04c6('0x3e')](handleError(_0x5f1331,null));};exports[_0x04c6('0x3f')]=function(_0x2cdf34,_0x40477f){var _0x4a3c45={'raw':![],'where':{'id':_0x2cdf34['params']['id']}},_0xdfdc34={};_0xdfdc34[_0x04c6('0x2f')]=_['keys'](db['Integration'][_0x04c6('0x28')]);_0xdfdc34['query']=_[_0x04c6('0x2a')](_0x2cdf34[_0x04c6('0x2b')]);_0xdfdc34[_0x04c6('0x2c')]=_['intersection'](_0xdfdc34[_0x04c6('0x2f')],_0xdfdc34[_0x04c6('0x2b')]);_0x4a3c45[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0xdfdc34[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x2cdf34[_0x04c6('0x2b')]['fields']));_0x4a3c45['attributes']=_0x4a3c45[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x4a3c45[_0x04c6('0x2e')]:_0xdfdc34['model'];if(_0x2cdf34[_0x04c6('0x2b')][_0x04c6('0x40')]){_0x4a3c45[_0x04c6('0x3b')]=[{'all':!![]}];}_0x4a3c45=_['merge']({},_0x4a3c45,_0x2cdf34['options']);return db['Integration'][_0x04c6('0x41')](_0x4a3c45)[_0x04c6('0x1f')](handleEntityNotFound(_0x40477f,null))['then'](respondWithResult(_0x40477f,null))[_0x04c6('0x3e')](handleError(_0x40477f,null));};exports[_0x04c6('0x42')]=function(_0x2bd045,_0x4ef366){return db[_0x04c6('0x27')][_0x04c6('0x42')](_0x2bd045['body'],{})[_0x04c6('0x1f')](respondWithResult(_0x4ef366,0xc9))[_0x04c6('0x3e')](handleError(_0x4ef366,null));};exports[_0x04c6('0x43')]=function(_0xee2822,_0x4cfde2){if(_0xee2822[_0x04c6('0x44')]['id']){delete _0xee2822[_0x04c6('0x44')]['id'];}return db[_0x04c6('0x27')][_0x04c6('0x41')]({'where':{'id':_0xee2822['params']['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x4cfde2,null))[_0x04c6('0x1f')](saveUpdates(_0xee2822[_0x04c6('0x44')],null))[_0x04c6('0x1f')](respondWithResult(_0x4cfde2,null))['catch'](handleError(_0x4cfde2,null));};exports[_0x04c6('0x20')]=function(_0x42273e,_0x15ec61){return db['Integration'][_0x04c6('0x41')]({'where':{'id':_0x42273e[_0x04c6('0x45')]['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x15ec61,null))[_0x04c6('0x1f')](removeEntity(_0x15ec61,null))[_0x04c6('0x3e')](handleError(_0x15ec61,null));}; \ No newline at end of file +var _0x7096=['offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','Integration','find','catch','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x5c266e,_0x4761dd){var _0x182293=function(_0x26e847){while(--_0x26e847){_0x5c266e['push'](_0x5c266e['shift']());}};_0x182293(++_0x4761dd);}(_0x7096,0x10c));var _0x6709=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x7096[_0xbb091];return _0x467a04;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['Integration'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['Integration'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['Integration'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['Integration']['create'](_0x4f82a0[_0x6709('0x49')],{})[_0x6709('0x25')](respondWithResult(_0xfbb810,0xc9))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0x22363b,_0x2b05dc){if(_0x22363b[_0x6709('0x49')]['id']){delete _0x22363b[_0x6709('0x49')]['id'];}return db['Integration'][_0x6709('0x46')]({'where':{'id':_0x22363b[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2b05dc,null))[_0x6709('0x25')](saveUpdates(_0x22363b['body'],null))[_0x6709('0x25')](respondWithResult(_0x2b05dc,null))['catch'](handleError(_0x2b05dc,null));};exports[_0x6709('0x26')]=function(_0x34a950,_0x2a563b){return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'id':_0x34a950['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2a563b,null))[_0x6709('0x25')](removeEntity(_0x2a563b,null))[_0x6709('0x47')](handleError(_0x2a563b,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index fa38e1d..3d448e3 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 _0xa05b=['exports','define','Integration','integrations','lodash','../../config/logger','api','request-promise','../../config/environment','./integration.attributes'];(function(_0x5b6c07,_0x36fa7b){var _0x5bca85=function(_0xae12cd){while(--_0xae12cd){_0x5b6c07['push'](_0x5b6c07['shift']());}};_0x5bca85(++_0x36fa7b);}(_0xa05b,0x130));var _0xba05=function(_0x5dbb84,_0x1bbce9){_0x5dbb84=_0x5dbb84-0x0;var _0x1d6eae=_0xa05b[_0x5dbb84];return _0x1d6eae;};'use strict';var _=require(_0xba05('0x0'));var util=require('util');var logger=require(_0xba05('0x1'))(_0xba05('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xba05('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xba05('0x4'));var attributes=require(_0xba05('0x5'));module[_0xba05('0x6')]=function(_0x5d497d,_0x16a32f){return _0x5d497d[_0xba05('0x7')](_0xba05('0x8'),attributes,{'tableName':_0xba05('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa42=['util','api','moment','request-promise','path','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash'];(function(_0x1466cd,_0xa37517){var _0x61b37b=function(_0x36ae4d){while(--_0x36ae4d){_0x1466cd['push'](_0x1466cd['shift']());}};_0x61b37b(++_0xa37517);}(_0xfa42,0xcb));var _0x2fa4=function(_0x1a1c67,_0x1db4ad){_0x1a1c67=_0x1a1c67-0x0;var _0x542a71=_0xfa42[_0x1a1c67];return _0x542a71;};'use strict';var _=require(_0x2fa4('0x0'));var util=require(_0x2fa4('0x1'));var logger=require('../../config/logger')(_0x2fa4('0x2'));var moment=require(_0x2fa4('0x3'));var BPromise=require('bluebird');var rp=require(_0x2fa4('0x4'));var fs=require('fs');var path=require(_0x2fa4('0x5'));var rimraf=require('rimraf');var config=require(_0x2fa4('0x6'));var attributes=require(_0x2fa4('0x7'));module[_0x2fa4('0x8')]=function(_0xe38e4c,_0x17d90f){return _0xe38e4c[_0x2fa4('0x9')](_0x2fa4('0xa'),attributes,{'tableName':_0x2fa4('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 16f0396..c7b81f7 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 _0x57ca=['client','http','request','info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1bb566,_0x26e040){var _0x342ee8=function(_0x16819c){while(--_0x16819c){_0x1bb566['push'](_0x1bb566['shift']());}};_0x342ee8(++_0x26e040);}(_0x57ca,0x108));var _0xa57c=function(_0x1dbe39,_0x377670){_0x1dbe39=_0x1dbe39-0x0;var _0x31bba4=_0x57ca[_0x1dbe39];return _0x31bba4;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('Integration,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('Integration,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0xd943=['info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x55d9d4,_0x4def57){var _0x481eb2=function(_0x33ed9c){while(--_0x33ed9c){_0x55d9d4['push'](_0x55d9d4['shift']());}};_0x481eb2(++_0x4def57);}(_0xd943,0x15d));var _0x3d94=function(_0x17b11d,_0x1f0e2b){_0x17b11d=_0x17b11d-0x0;var _0x58ba36=_0xd943[_0x17b11d];return _0x58ba36;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('Integration,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 91124bc..c37a6f0 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 _0x4137=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x4137,0xf8));var _0x7413=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4137[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/',auth['isAuthenticated'](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x14')]);router['delete'](_0x7413('0xf'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x15')]=router; \ No newline at end of file +var _0x57ca=['create','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x28535e,_0x1a9753){var _0x2e8574=function(_0x145fc4){while(--_0x145fc4){_0x28535e['push'](_0x28535e['shift']());}};_0x2e8574(++_0x1a9753);}(_0x57ca,0x108));var _0xa57c=function(_0x250ff9,_0x1dbc1b){_0x250ff9=_0x250ff9-0x0;var _0x1bc93c=_0x57ca[_0x250ff9];return _0x1bc93c;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0xf')]('/',auth['isAuthenticated'](),controller[_0xa57c('0x10')]);router['put'](_0xa57c('0xd'),auth[_0xa57c('0x9')](),controller['update']);router[_0xa57c('0x11')]('/:id',auth[_0xa57c('0x9')](),controller[_0xa57c('0x12')]);module[_0xa57c('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index f19415c..a3d59cb 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 _0x511c=['ENUM','SENT','SENDING','RECEIVED','FAILED','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x511c,0xaf));var _0xc511=function(_0x3e8cae,_0x4cb96a){_0x3e8cae=_0x3e8cae-0x0;var _0x45c4d6=_0x511c[_0x3e8cae];return _0x45c4d6;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xc511('0x0')]},'exitStatus':{'type':Sequelize[_0xc511('0x0')]},'ticketId':{'type':Sequelize[_0xc511('0x0')]},'integrationId':{'type':Sequelize[_0xc511('0x1')]},'contacts':{'type':Sequelize[_0xc511('0x0')]},'uniqueid':{'type':Sequelize[_0xc511('0x0')]},'calleridnum':{'type':Sequelize[_0xc511('0x0')]},'calleridname':{'type':Sequelize[_0xc511('0x0')]},'queue':{'type':Sequelize[_0xc511('0x0')]},'interface':{'type':Sequelize[_0xc511('0x0')]},'membername':{'type':Sequelize[_0xc511('0x0')]},'agentcalledAt':{'type':Sequelize[_0xc511('0x2')]},'agentconnectAt':{'type':Sequelize[_0xc511('0x2')]},'holdtime':{'type':Sequelize[_0xc511('0x1')]},'agentcomplete':{'type':Sequelize[_0xc511('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xc511('0x1')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc511('0x1')]},'reason':{'type':Sequelize[_0xc511('0x0')]},'agentringnoanswer':{'type':Sequelize[_0xc511('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xc511('0x2')]},'agentdump':{'type':Sequelize[_0xc511('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xc511('0x2')]},'lastevent':{'type':Sequelize[_0xc511('0x0')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xc511('0x1')]},'channelstatedesc':{'type':Sequelize[_0xc511('0x0')]},'connectedlinenum':{'type':Sequelize[_0xc511('0x0')]},'connectedlinename':{'type':Sequelize[_0xc511('0x0')]},'language':{'type':Sequelize[_0xc511('0x0')]},'accountcode':{'type':Sequelize[_0xc511('0x0')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xc511('0x0')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xc511('0x0')]},'destchannelstate':{'type':Sequelize[_0xc511('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0xc511('0x0')]},'destcalleridnum':{'type':Sequelize[_0xc511('0x0')]},'destcalleridname':{'type':Sequelize[_0xc511('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0xc511('0x0')]},'destconnectedlinename':{'type':Sequelize[_0xc511('0x0')]},'destlanguage':{'type':Sequelize[_0xc511('0x0')]},'destaccountcode':{'type':Sequelize[_0xc511('0x0')]},'destcontext':{'type':Sequelize[_0xc511('0x0')]},'destexten':{'type':Sequelize[_0xc511('0x0')]},'destpriority':{'type':Sequelize[_0xc511('0x0')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xc511('0x0')]},'inReplyTo':{'type':Sequelize[_0xc511('0x0')]},'subject':{'type':Sequelize[_0xc511('0x0')]},'from':{'type':Sequelize[_0xc511('0x0')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xc511('0x4')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xc511('0x5')](_0xc511('0x6'),_0xc511('0x7'),_0xc511('0x8'),_0xc511('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xc511('0x0')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xc511('0x1')]}}; \ No newline at end of file +var _0xaad4=['BOOLEAN','TEXT','SENT','FAILED','sequelize','STRING','INTEGER','DATE'];(function(_0x16d4fc,_0x4c71e3){var _0x5852af=function(_0xb6a9c){while(--_0xb6a9c){_0x16d4fc['push'](_0x16d4fc['shift']());}};_0x5852af(++_0x4c71e3);}(_0xaad4,0x174));var _0x4aad=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xaad4[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x4aad('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x4aad('0x1')]},'exitStatus':{'type':Sequelize[_0x4aad('0x1')]},'ticketId':{'type':Sequelize[_0x4aad('0x1')]},'integrationId':{'type':Sequelize[_0x4aad('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4aad('0x1')]},'calleridname':{'type':Sequelize[_0x4aad('0x1')]},'queue':{'type':Sequelize[_0x4aad('0x1')]},'interface':{'type':Sequelize[_0x4aad('0x1')]},'membername':{'type':Sequelize[_0x4aad('0x1')]},'agentcalledAt':{'type':Sequelize[_0x4aad('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4aad('0x3')]},'holdtime':{'type':Sequelize[_0x4aad('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4aad('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4aad('0x2')]},'reason':{'type':Sequelize[_0x4aad('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x4aad('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x4aad('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4aad('0x1')]},'channelstate':{'type':Sequelize[_0x4aad('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4aad('0x1')]},'connectedlinename':{'type':Sequelize[_0x4aad('0x1')]},'language':{'type':Sequelize[_0x4aad('0x1')]},'accountcode':{'type':Sequelize[_0x4aad('0x1')]},'context':{'type':Sequelize[_0x4aad('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x4aad('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x4aad('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x4aad('0x1')]},'destcalleridnum':{'type':Sequelize[_0x4aad('0x1')]},'destcalleridname':{'type':Sequelize[_0x4aad('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x4aad('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x4aad('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x4aad('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x4aad('0x1')]},'destpriority':{'type':Sequelize[_0x4aad('0x1')]},'destuniqueid':{'type':Sequelize[_0x4aad('0x1')]},'messageId':{'type':Sequelize[_0x4aad('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x4aad('0x1')]},'to':{'type':Sequelize[_0x4aad('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x4aad('0x5')]},'html':{'type':Sequelize[_0x4aad('0x5')]},'text':{'type':Sequelize[_0x4aad('0x5')]},'status':{'type':Sequelize['ENUM'](_0x4aad('0x6'),'SENDING','RECEIVED',_0x4aad('0x7'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x4aad('0x1')]},'projectId':{'type':Sequelize[_0x4aad('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index ccd2c65..0ff8eb9 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 _0x2c81=['../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','error','name','send','map','IntegrationReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','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','../../config/environment','../../config/license/util'];(function(_0x1597e2,_0x388d3e){var _0x4c8c0a=function(_0x3d4795){while(--_0x3d4795){_0x1597e2['push'](_0x1597e2['shift']());}};_0x4c8c0a(++_0x388d3e);}(_0x2c81,0x15f));var _0x12c8=function(_0x56a4a9,_0xb43e00){_0x56a4a9=_0x56a4a9-0x0;var _0x33975c=_0x2c81[_0x56a4a9];return _0x33975c;};'use strict';var emlformat=require(_0x12c8('0x0'));var rimraf=require(_0x12c8('0x1'));var zipdir=require(_0x12c8('0x2'));var jsonpatch=require(_0x12c8('0x3'));var rp=require('request-promise');var moment=require(_0x12c8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x12c8('0x5'));var csv=require(_0x12c8('0x6'));var ejs=require(_0x12c8('0x7'));var fs=require('fs');var fs_extra=require(_0x12c8('0x8'));var _=require(_0x12c8('0x9'));var squel=require(_0x12c8('0xa'));var crypto=require('crypto');var jsforce=require(_0x12c8('0xb'));var deskjs=require(_0x12c8('0xc'));var toCsv=require(_0x12c8('0x6'));var querystring=require('querystring');var Papa=require(_0x12c8('0xd'));var Redis=require(_0x12c8('0xe'));var authService=require(_0x12c8('0xf'));var qs=require(_0x12c8('0x10'));var as=require(_0x12c8('0x11'));var hardwareService=require(_0x12c8('0x12'));var logger=require(_0x12c8('0x13'))(_0x12c8('0x14'));var utils=require(_0x12c8('0x15'));var config=require(_0x12c8('0x16'));var licenseUtil=require(_0x12c8('0x17'));var db=require(_0x12c8('0x18'))['db'];function respondWithStatusCode(_0x8b6334,_0x3087cb){_0x3087cb=_0x3087cb||0xcc;return function(_0x59905a){if(_0x59905a){return _0x8b6334[_0x12c8('0x19')](_0x3087cb);}return _0x8b6334['status'](_0x3087cb)[_0x12c8('0x1a')]();};}function respondWithResult(_0x4f0674,_0x934208){_0x934208=_0x934208||0xc8;return function(_0x415ef3){if(_0x415ef3){return _0x4f0674[_0x12c8('0x1b')](_0x934208)[_0x12c8('0x1c')](_0x415ef3);}};}function respondWithFilteredResult(_0x14f4a0,_0x5775e0){return function(_0x2bde76){if(_0x2bde76){var _0x25f5be=typeof _0x5775e0[_0x12c8('0x1d')]===_0x12c8('0x1e')&&typeof _0x5775e0['limit']===_0x12c8('0x1e');var _0x598829=_0x2bde76[_0x12c8('0x1f')];var _0x383725=_0x25f5be?0x0:_0x5775e0[_0x12c8('0x1d')];var _0x6e0246=_0x25f5be?_0x2bde76[_0x12c8('0x1f')]:_0x5775e0[_0x12c8('0x1d')]+_0x5775e0[_0x12c8('0x20')];var _0x12266f;if(_0x6e0246>=_0x598829){_0x6e0246=_0x598829;_0x12266f=0xc8;}else{_0x12266f=0xce;}_0x14f4a0[_0x12c8('0x1b')](_0x12266f);return _0x14f4a0[_0x12c8('0x21')](_0x12c8('0x22'),_0x383725+'-'+_0x6e0246+'/'+_0x598829)[_0x12c8('0x1c')](_0x2bde76);}return null;};}function patchUpdates(_0x2be62a){return function(_0x1e4db9){try{jsonpatch[_0x12c8('0x23')](_0x1e4db9,_0x2be62a,!![]);}catch(_0x424df9){return BPromise['reject'](_0x424df9);}return _0x1e4db9['save']();};}function saveUpdates(_0x85166b,_0x594ef4){return function(_0x5cabc9){if(_0x5cabc9){return _0x5cabc9[_0x12c8('0x24')](_0x85166b)[_0x12c8('0x25')](function(_0x4eb8dc){return _0x4eb8dc;});}return null;};}function removeEntity(_0xfc6d0c,_0x22e830){return function(_0x4217a6){if(_0x4217a6){return _0x4217a6[_0x12c8('0x26')]()[_0x12c8('0x25')](function(){_0xfc6d0c[_0x12c8('0x1b')](0xcc)[_0x12c8('0x1a')]();});}};}function handleEntityNotFound(_0x1aa3f7,_0x3a1824){return function(_0x304ccf){if(!_0x304ccf){_0x1aa3f7[_0x12c8('0x19')](0x194);}return _0x304ccf;};}function handleError(_0x371d55,_0x378b78){_0x378b78=_0x378b78||0x1f4;return function(_0x3acab3){logger[_0x12c8('0x27')](_0x3acab3['stack']);if(_0x3acab3[_0x12c8('0x28')]){delete _0x3acab3[_0x12c8('0x28')];}_0x371d55[_0x12c8('0x1b')](_0x378b78)[_0x12c8('0x29')](_0x3acab3);};}exports['index']=function(_0x367928,_0x57cf8b){var _0x5abcf0={},_0x344e67={},_0x91f8ff={'count':0x0,'rows':[]};var _0x1e1d5b=_[_0x12c8('0x2a')](db[_0x12c8('0x2b')][_0x12c8('0x2c')],function(_0x47708d){return{'name':_0x47708d['fieldName'],'type':_0x47708d[_0x12c8('0x2d')][_0x12c8('0x2e')]};});_0x344e67[_0x12c8('0x2f')]=_[_0x12c8('0x2a')](_0x1e1d5b,_0x12c8('0x28'));_0x344e67[_0x12c8('0x30')]=_['keys'](_0x367928['query']);_0x344e67[_0x12c8('0x31')]=_[_0x12c8('0x32')](_0x344e67['model'],_0x344e67[_0x12c8('0x30')]);_0x5abcf0[_0x12c8('0x33')]=_['intersection'](_0x344e67[_0x12c8('0x2f')],qs[_0x12c8('0x34')](_0x367928[_0x12c8('0x30')]['fields']));_0x5abcf0[_0x12c8('0x33')]=_0x5abcf0[_0x12c8('0x33')][_0x12c8('0x35')]?_0x5abcf0[_0x12c8('0x33')]:_0x344e67['model'];if(!_0x367928['query'][_0x12c8('0x36')](_0x12c8('0x37'))){_0x5abcf0[_0x12c8('0x20')]=qs[_0x12c8('0x20')](_0x367928[_0x12c8('0x30')][_0x12c8('0x20')]);_0x5abcf0[_0x12c8('0x1d')]=qs[_0x12c8('0x1d')](_0x367928['query'][_0x12c8('0x1d')]);}_0x5abcf0[_0x12c8('0x38')]=qs[_0x12c8('0x39')](_0x367928[_0x12c8('0x30')]['sort']);_0x5abcf0[_0x12c8('0x3a')]=qs[_0x12c8('0x31')](_[_0x12c8('0x3b')](_0x367928[_0x12c8('0x30')],_0x344e67['filters']),_0x1e1d5b);if(_0x367928[_0x12c8('0x30')][_0x12c8('0x3c')]){_0x5abcf0[_0x12c8('0x3a')]=_[_0x12c8('0x3d')](_0x5abcf0[_0x12c8('0x3a')],{'$or':_['map'](_0x1e1d5b,function(_0x259ed3){if(_0x259ed3[_0x12c8('0x2d')]!==_0x12c8('0x3e')){var _0x3463cf={};_0x3463cf[_0x259ed3[_0x12c8('0x28')]]={'$like':'%'+_0x367928['query'][_0x12c8('0x3c')]+'%'};return _0x3463cf;}})});}_0x5abcf0=_[_0x12c8('0x3d')]({},_0x5abcf0,_0x367928[_0x12c8('0x3f')]);var _0x25dc3b={'where':_0x5abcf0['where']};return db[_0x12c8('0x2b')][_0x12c8('0x1f')](_0x25dc3b)[_0x12c8('0x25')](function(_0x549930){_0x91f8ff[_0x12c8('0x1f')]=_0x549930;if(_0x367928[_0x12c8('0x30')]['includeAll']){_0x5abcf0[_0x12c8('0x40')]=[{'all':!![]}];}return db[_0x12c8('0x2b')][_0x12c8('0x41')](_0x5abcf0);})[_0x12c8('0x25')](function(_0x3d17ec){_0x91f8ff[_0x12c8('0x42')]=_0x3d17ec;return _0x91f8ff;})[_0x12c8('0x25')](respondWithFilteredResult(_0x57cf8b,_0x5abcf0))[_0x12c8('0x43')](handleError(_0x57cf8b,null));};exports['show']=function(_0x30f335,_0x19b3ab){var _0x166cbe={'raw':![],'where':{'id':_0x30f335[_0x12c8('0x44')]['id']}},_0x3fff98={};_0x3fff98[_0x12c8('0x2f')]=_[_0x12c8('0x45')](db[_0x12c8('0x2b')][_0x12c8('0x2c')]);_0x3fff98[_0x12c8('0x30')]=_[_0x12c8('0x45')](_0x30f335[_0x12c8('0x30')]);_0x3fff98[_0x12c8('0x31')]=_[_0x12c8('0x32')](_0x3fff98['model'],_0x3fff98['query']);_0x166cbe[_0x12c8('0x33')]=_[_0x12c8('0x32')](_0x3fff98[_0x12c8('0x2f')],qs[_0x12c8('0x34')](_0x30f335['query'][_0x12c8('0x34')]));_0x166cbe[_0x12c8('0x33')]=_0x166cbe[_0x12c8('0x33')][_0x12c8('0x35')]?_0x166cbe['attributes']:_0x3fff98[_0x12c8('0x2f')];if(_0x30f335[_0x12c8('0x30')][_0x12c8('0x46')]){_0x166cbe[_0x12c8('0x40')]=[{'all':!![]}];}_0x166cbe=_['merge']({},_0x166cbe,_0x30f335[_0x12c8('0x3f')]);return db[_0x12c8('0x2b')][_0x12c8('0x47')](_0x166cbe)['then'](handleEntityNotFound(_0x19b3ab,null))['then'](respondWithResult(_0x19b3ab,null))[_0x12c8('0x43')](handleError(_0x19b3ab,null));};exports[_0x12c8('0x48')]=function(_0x323a47,_0x537c15){return db[_0x12c8('0x2b')][_0x12c8('0x48')](_0x323a47[_0x12c8('0x49')],{})[_0x12c8('0x25')](respondWithResult(_0x537c15,0xc9))[_0x12c8('0x43')](handleError(_0x537c15,null));};exports[_0x12c8('0x24')]=function(_0x2b0a13,_0x293fab){if(_0x2b0a13[_0x12c8('0x49')]['id']){delete _0x2b0a13['body']['id'];}return db[_0x12c8('0x2b')][_0x12c8('0x47')]({'where':{'id':_0x2b0a13[_0x12c8('0x44')]['id']}})[_0x12c8('0x25')](handleEntityNotFound(_0x293fab,null))['then'](saveUpdates(_0x2b0a13[_0x12c8('0x49')],null))[_0x12c8('0x25')](respondWithResult(_0x293fab,null))[_0x12c8('0x43')](handleError(_0x293fab,null));};exports[_0x12c8('0x26')]=function(_0x32e451,_0x5cdc97){return db[_0x12c8('0x2b')]['find']({'where':{'id':_0x32e451[_0x12c8('0x44')]['id']}})[_0x12c8('0x25')](handleEntityNotFound(_0x5cdc97,null))['then'](removeEntity(_0x5cdc97,null))[_0x12c8('0x43')](handleError(_0x5cdc97,null));};exports['describe']=function(_0x25dc7b,_0x4aa5af){return db[_0x12c8('0x2b')][_0x12c8('0x4a')]()[_0x12c8('0x25')](respondWithResult(_0x4aa5af,null))[_0x12c8('0x43')](handleError(_0x4aa5af,null));}; \ No newline at end of file +var _0xc5ca=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','type','keys','filters','intersection','model','fields','query','attributes','sort','where','pick','filter','merge','VIRTUAL','options','IntegrationReport','includeAll','findAll','rows','catch','show','length','include','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xc5ca,0x94));var _0xac5c=function(_0x52ddfe,_0x581064){_0x52ddfe=_0x52ddfe-0x0;var _0x3808a4=_0xc5ca[_0x52ddfe];return _0x3808a4;};'use strict';var emlformat=require(_0xac5c('0x0'));var rimraf=require(_0xac5c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac5c('0x2'));var rp=require(_0xac5c('0x3'));var moment=require('moment');var BPromise=require(_0xac5c('0x4'));var Mustache=require('mustache');var util=require(_0xac5c('0x5'));var path=require(_0xac5c('0x6'));var sox=require(_0xac5c('0x7'));var csv=require(_0xac5c('0x8'));var ejs=require(_0xac5c('0x9'));var fs=require('fs');var fs_extra=require(_0xac5c('0xa'));var _=require(_0xac5c('0xb'));var squel=require(_0xac5c('0xc'));var crypto=require(_0xac5c('0xd'));var jsforce=require(_0xac5c('0xe'));var deskjs=require(_0xac5c('0xf'));var toCsv=require(_0xac5c('0x8'));var querystring=require(_0xac5c('0x10'));var Papa=require(_0xac5c('0x11'));var Redis=require(_0xac5c('0x12'));var authService=require(_0xac5c('0x13'));var qs=require(_0xac5c('0x14'));var as=require(_0xac5c('0x15'));var hardwareService=require(_0xac5c('0x16'));var logger=require(_0xac5c('0x17'))(_0xac5c('0x18'));var utils=require(_0xac5c('0x19'));var config=require(_0xac5c('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xac5c('0x1b'))['db'];function respondWithStatusCode(_0x3d07eb,_0x15f2e8){_0x15f2e8=_0x15f2e8||0xcc;return function(_0x1fd682){if(_0x1fd682){return _0x3d07eb[_0xac5c('0x1c')](_0x15f2e8);}return _0x3d07eb[_0xac5c('0x1d')](_0x15f2e8)[_0xac5c('0x1e')]();};}function respondWithResult(_0x344669,_0x376ae4){_0x376ae4=_0x376ae4||0xc8;return function(_0x71bef8){if(_0x71bef8){return _0x344669[_0xac5c('0x1d')](_0x376ae4)[_0xac5c('0x1f')](_0x71bef8);}};}function respondWithFilteredResult(_0x553ab7,_0x2151c9){return function(_0x48de5c){if(_0x48de5c){var _0x47314a=typeof _0x2151c9[_0xac5c('0x20')]==='undefined'&&typeof _0x2151c9[_0xac5c('0x21')]==='undefined';var _0x3ccdb9=_0x48de5c[_0xac5c('0x22')];var _0x6b6973=_0x47314a?0x0:_0x2151c9['offset'];var _0x2f3ee2=_0x47314a?_0x48de5c[_0xac5c('0x22')]:_0x2151c9['offset']+_0x2151c9['limit'];var _0x2a7d3b;if(_0x2f3ee2>=_0x3ccdb9){_0x2f3ee2=_0x3ccdb9;_0x2a7d3b=0xc8;}else{_0x2a7d3b=0xce;}_0x553ab7[_0xac5c('0x1d')](_0x2a7d3b);return _0x553ab7[_0xac5c('0x23')](_0xac5c('0x24'),_0x6b6973+'-'+_0x2f3ee2+'/'+_0x3ccdb9)[_0xac5c('0x1f')](_0x48de5c);}return null;};}function patchUpdates(_0x2c2b18){return function(_0x529fef){try{jsonpatch[_0xac5c('0x25')](_0x529fef,_0x2c2b18,!![]);}catch(_0x26ab0f){return BPromise[_0xac5c('0x26')](_0x26ab0f);}return _0x529fef[_0xac5c('0x27')]();};}function saveUpdates(_0x34fcd7,_0x5f1883){return function(_0x1ec071){if(_0x1ec071){return _0x1ec071[_0xac5c('0x28')](_0x34fcd7)[_0xac5c('0x29')](function(_0x1fd430){return _0x1fd430;});}return null;};}function removeEntity(_0x1c4363,_0x529c64){return function(_0x31ea18){if(_0x31ea18){return _0x31ea18[_0xac5c('0x2a')]()[_0xac5c('0x29')](function(){_0x1c4363[_0xac5c('0x1d')](0xcc)[_0xac5c('0x1e')]();});}};}function handleEntityNotFound(_0x41c4d6,_0x44556f){return function(_0x2cada1){if(!_0x2cada1){_0x41c4d6[_0xac5c('0x1c')](0x194);}return _0x2cada1;};}function handleError(_0x3c1196,_0x3684a3){_0x3684a3=_0x3684a3||0x1f4;return function(_0x259264){logger[_0xac5c('0x2b')](_0x259264[_0xac5c('0x2c')]);if(_0x259264[_0xac5c('0x2d')]){delete _0x259264['name'];}_0x3c1196[_0xac5c('0x1d')](_0x3684a3)['send'](_0x259264);};}exports[_0xac5c('0x2e')]=function(_0x46ab84,_0x8992d1){var _0xc1a7c3={},_0x3da362={},_0x171da1={'count':0x0,'rows':[]};var _0x1104f7=_[_0xac5c('0x2f')](db['IntegrationReport'][_0xac5c('0x30')],function(_0x3af2a2){return{'name':_0x3af2a2['fieldName'],'type':_0x3af2a2[_0xac5c('0x31')]['key']};});_0x3da362['model']=_[_0xac5c('0x2f')](_0x1104f7,'name');_0x3da362['query']=_[_0xac5c('0x32')](_0x46ab84['query']);_0x3da362[_0xac5c('0x33')]=_[_0xac5c('0x34')](_0x3da362[_0xac5c('0x35')],_0x3da362['query']);_0xc1a7c3['attributes']=_[_0xac5c('0x34')](_0x3da362[_0xac5c('0x35')],qs[_0xac5c('0x36')](_0x46ab84[_0xac5c('0x37')][_0xac5c('0x36')]));_0xc1a7c3['attributes']=_0xc1a7c3[_0xac5c('0x38')]['length']?_0xc1a7c3[_0xac5c('0x38')]:_0x3da362['model'];if(!_0x46ab84[_0xac5c('0x37')]['hasOwnProperty']('nolimit')){_0xc1a7c3['limit']=qs['limit'](_0x46ab84[_0xac5c('0x37')][_0xac5c('0x21')]);_0xc1a7c3[_0xac5c('0x20')]=qs[_0xac5c('0x20')](_0x46ab84[_0xac5c('0x37')]['offset']);}_0xc1a7c3['order']=qs[_0xac5c('0x39')](_0x46ab84[_0xac5c('0x37')][_0xac5c('0x39')]);_0xc1a7c3[_0xac5c('0x3a')]=qs[_0xac5c('0x33')](_[_0xac5c('0x3b')](_0x46ab84[_0xac5c('0x37')],_0x3da362[_0xac5c('0x33')]),_0x1104f7);if(_0x46ab84[_0xac5c('0x37')][_0xac5c('0x3c')]){_0xc1a7c3[_0xac5c('0x3a')]=_[_0xac5c('0x3d')](_0xc1a7c3[_0xac5c('0x3a')],{'$or':_[_0xac5c('0x2f')](_0x1104f7,function(_0x565eb5){if(_0x565eb5[_0xac5c('0x31')]!==_0xac5c('0x3e')){var _0x136c06={};_0x136c06[_0x565eb5[_0xac5c('0x2d')]]={'$like':'%'+_0x46ab84[_0xac5c('0x37')][_0xac5c('0x3c')]+'%'};return _0x136c06;}})});}_0xc1a7c3=_[_0xac5c('0x3d')]({},_0xc1a7c3,_0x46ab84[_0xac5c('0x3f')]);var _0x23e372={'where':_0xc1a7c3['where']};return db[_0xac5c('0x40')][_0xac5c('0x22')](_0x23e372)[_0xac5c('0x29')](function(_0x203738){_0x171da1[_0xac5c('0x22')]=_0x203738;if(_0x46ab84[_0xac5c('0x37')][_0xac5c('0x41')]){_0xc1a7c3['include']=[{'all':!![]}];}return db[_0xac5c('0x40')][_0xac5c('0x42')](_0xc1a7c3);})['then'](function(_0x4ad398){_0x171da1[_0xac5c('0x43')]=_0x4ad398;return _0x171da1;})[_0xac5c('0x29')](respondWithFilteredResult(_0x8992d1,_0xc1a7c3))[_0xac5c('0x44')](handleError(_0x8992d1,null));};exports[_0xac5c('0x45')]=function(_0x2fd59d,_0x10ac5b){var _0x4f06ae={'raw':![],'where':{'id':_0x2fd59d['params']['id']}},_0x12765b={};_0x12765b[_0xac5c('0x35')]=_[_0xac5c('0x32')](db[_0xac5c('0x40')][_0xac5c('0x30')]);_0x12765b['query']=_[_0xac5c('0x32')](_0x2fd59d['query']);_0x12765b['filters']=_[_0xac5c('0x34')](_0x12765b[_0xac5c('0x35')],_0x12765b[_0xac5c('0x37')]);_0x4f06ae[_0xac5c('0x38')]=_[_0xac5c('0x34')](_0x12765b['model'],qs['fields'](_0x2fd59d[_0xac5c('0x37')][_0xac5c('0x36')]));_0x4f06ae[_0xac5c('0x38')]=_0x4f06ae[_0xac5c('0x38')][_0xac5c('0x46')]?_0x4f06ae[_0xac5c('0x38')]:_0x12765b['model'];if(_0x2fd59d[_0xac5c('0x37')][_0xac5c('0x41')]){_0x4f06ae[_0xac5c('0x47')]=[{'all':!![]}];}_0x4f06ae=_[_0xac5c('0x3d')]({},_0x4f06ae,_0x2fd59d[_0xac5c('0x3f')]);return db['IntegrationReport'][_0xac5c('0x48')](_0x4f06ae)[_0xac5c('0x29')](handleEntityNotFound(_0x10ac5b,null))[_0xac5c('0x29')](respondWithResult(_0x10ac5b,null))[_0xac5c('0x44')](handleError(_0x10ac5b,null));};exports['create']=function(_0x4001bf,_0x4981ba){return db[_0xac5c('0x40')][_0xac5c('0x49')](_0x4001bf[_0xac5c('0x4a')],{})[_0xac5c('0x29')](respondWithResult(_0x4981ba,0xc9))[_0xac5c('0x44')](handleError(_0x4981ba,null));};exports[_0xac5c('0x28')]=function(_0xea8d82,_0x34875c){if(_0xea8d82[_0xac5c('0x4a')]['id']){delete _0xea8d82[_0xac5c('0x4a')]['id'];}return db['IntegrationReport'][_0xac5c('0x48')]({'where':{'id':_0xea8d82['params']['id']}})[_0xac5c('0x29')](handleEntityNotFound(_0x34875c,null))['then'](saveUpdates(_0xea8d82[_0xac5c('0x4a')],null))[_0xac5c('0x29')](respondWithResult(_0x34875c,null))[_0xac5c('0x44')](handleError(_0x34875c,null));};exports['destroy']=function(_0x45896c,_0x4d5e02){return db[_0xac5c('0x40')][_0xac5c('0x48')]({'where':{'id':_0x45896c[_0xac5c('0x4b')]['id']}})[_0xac5c('0x29')](handleEntityNotFound(_0x4d5e02,null))[_0xac5c('0x29')](removeEntity(_0x4d5e02,null))['catch'](handleError(_0x4d5e02,null));};exports[_0xac5c('0x4c')]=function(_0x38cc25,_0x214ca9){return db[_0xac5c('0x40')][_0xac5c('0x4c')]()[_0xac5c('0x29')](respondWithResult(_0x214ca9,null))[_0xac5c('0x44')](handleError(_0x214ca9,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 9cbbc19..145d319 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 _0xda9d=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','define','report_integration'];(function(_0x3e5151,_0x1682aa){var _0x326c8a=function(_0x5527b5){while(--_0x5527b5){_0x3e5151['push'](_0x3e5151['shift']());}};_0x326c8a(++_0x1682aa);}(_0xda9d,0xfa));var _0xdda9=function(_0x13524d,_0x505b49){_0x13524d=_0x13524d-0x0;var _0x9918b4=_0xda9d[_0x13524d];return _0x9918b4;};'use strict';var _=require('lodash');var util=require(_0xdda9('0x0'));var logger=require('../../config/logger')(_0xdda9('0x1'));var moment=require('moment');var BPromise=require(_0xdda9('0x2'));var rp=require(_0xdda9('0x3'));var fs=require('fs');var path=require(_0xdda9('0x4'));var rimraf=require(_0xdda9('0x5'));var config=require(_0xdda9('0x6'));var attributes=require(_0xdda9('0x7'));module['exports']=function(_0x51314c,_0x10e31a){return _0x51314c[_0xdda9('0x8')]('IntegrationReport',attributes,{'tableName':_0xdda9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6199=['exports','IntegrationReport','report_integration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x5a1aa9,_0x49f80e){var _0x1ed1aa=function(_0x38f3c8){while(--_0x38f3c8){_0x5a1aa9['push'](_0x5a1aa9['shift']());}};_0x1ed1aa(++_0x49f80e);}(_0x6199,0x148));var _0x9619=function(_0x25a2bb,_0x223fdd){_0x25a2bb=_0x25a2bb-0x0;var _0x563485=_0x6199[_0x25a2bb];return _0x563485;};'use strict';var _=require(_0x9619('0x0'));var util=require('util');var logger=require(_0x9619('0x1'))(_0x9619('0x2'));var moment=require(_0x9619('0x3'));var BPromise=require(_0x9619('0x4'));var rp=require(_0x9619('0x5'));var fs=require('fs');var path=require(_0x9619('0x6'));var rimraf=require(_0x9619('0x7'));var config=require(_0x9619('0x8'));var attributes=require(_0x9619('0x9'));module[_0x9619('0xa')]=function(_0x2e41eb,_0x9662fc){return _0x2e41eb['define'](_0x9619('0xb'),attributes,{'tableName':_0x9619('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 3965a50..5ed1c30 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 _0xda19=['error','message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x7ae3ba,_0x1a353c){var _0x272525=function(_0x324ac9){while(--_0x324ac9){_0x7ae3ba['push'](_0x7ae3ba['shift']());}};_0x272525(++_0x1a353c);}(_0xda19,0xd5));var _0x9da1=function(_0x4116e9,_0x23be1b){_0x4116e9=_0x4116e9-0x0;var _0x55e7ee=_0xda19[_0x4116e9];return _0x55e7ee;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){return client['request'](_0x23e4f7,_0x1c24e6)['then'](function(_0x417312){logger['info'](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));logger[_0x9da1('0xc')](_0x9da1('0xd'),_0x2c3cdd,_0x9da1('0xb'),JSON[_0x9da1('0xe')](_0x417312));if(_0x417312[_0x9da1('0xf')]){if(_0x417312['error']['code']===0x1f4){logger[_0x9da1('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x2c3cdd,_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);return _0x47df89(_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);}logger['error'](_0x9da1('0xa'),_0x2c3cdd,_0x417312['error']['message']);return _0x5e2d18(_0x417312[_0x9da1('0xf')]['message']);}else{logger[_0x9da1('0x11')](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));_0x5e2d18(_0x417312[_0x9da1('0x12')][_0x9da1('0x10')]);}})['catch'](function(_0x16f75a){logger[_0x9da1('0xf')](_0x9da1('0xa'),_0x2c3cdd,_0x16f75a);_0x47df89(_0x16f75a);});});} \ No newline at end of file +var _0x7a54=['info','IntegrationReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x1374ec,_0x5372ae){_0x1374ec=_0x1374ec-0x0;var _0x4510a1=_0x7a54[_0x1374ec];return _0x4510a1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index c88fe1b..6d2cb68 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 _0x446c=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','show','get','/:id/sub_intervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals'];(function(_0xe1a3a5,_0xd3e341){var _0x362646=function(_0xdcef03){while(--_0xdcef03){_0xe1a3a5['push'](_0xe1a3a5['shift']());}};_0x362646(++_0xd3e341);}(_0x446c,0x156));var _0xc446=function(_0x1e48d3,_0x5d8c43){_0x1e48d3=_0x1e48d3-0x0;var _0x2852b1=_0x446c[_0x1e48d3];return _0x2852b1;};'use strict';var multer=require(_0xc446('0x0'));var util=require(_0xc446('0x1'));var path=require(_0xc446('0x2'));var timeout=require(_0xc446('0x3'));var express=require('express');var router=express[_0xc446('0x4')]();var fs_extra=require(_0xc446('0x5'));var auth=require(_0xc446('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc446('0x7'));var controller=require('./interval.controller');router['get']('/',auth[_0xc446('0x8')](),controller[_0xc446('0x9')]);router['get']('/:id',auth[_0xc446('0x8')](),controller[_0xc446('0xa')]);router[_0xc446('0xb')](_0xc446('0xc'),auth[_0xc446('0x8')](),controller['getIntervals']);router[_0xc446('0xd')]('/',auth[_0xc446('0x8')](),controller[_0xc446('0xe')]);router[_0xc446('0xd')]('/:id/sub_intervals',auth[_0xc446('0x8')](),controller[_0xc446('0xf')]);router[_0xc446('0xd')](_0xc446('0x10'),auth[_0xc446('0x8')](),controller[_0xc446('0x11')]);router[_0xc446('0x12')](_0xc446('0x13'),auth[_0xc446('0x8')](),controller[_0xc446('0x14')]);router[_0xc446('0x15')](_0xc446('0x13'),auth[_0xc446('0x8')](),controller[_0xc446('0x16')]);module[_0xc446('0x17')]=router; \ No newline at end of file +var _0x0d91=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','addIntervals','put','delete','destroy','exports','multer','util'];(function(_0x1d2ae5,_0x239778){var _0x3168d3=function(_0x19c3e9){while(--_0x19c3e9){_0x1d2ae5['push'](_0x1d2ae5['shift']());}};_0x3168d3(++_0x239778);}(_0x0d91,0x76));var _0x10d9=function(_0x2dce5a,_0x2e992b){_0x2dce5a=_0x2dce5a-0x0;var _0x62fa90=_0x0d91[_0x2dce5a];return _0x62fa90;};'use strict';var multer=require(_0x10d9('0x0'));var util=require(_0x10d9('0x1'));var path=require(_0x10d9('0x2'));var timeout=require(_0x10d9('0x3'));var express=require('express');var router=express[_0x10d9('0x4')]();var fs_extra=require(_0x10d9('0x5'));var auth=require(_0x10d9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x10d9('0x7'));var controller=require(_0x10d9('0x8'));router[_0x10d9('0x9')]('/',auth['isAuthenticated'](),controller[_0x10d9('0xa')]);router[_0x10d9('0x9')](_0x10d9('0xb'),auth[_0x10d9('0xc')](),controller[_0x10d9('0xd')]);router[_0x10d9('0x9')](_0x10d9('0xe'),auth[_0x10d9('0xc')](),controller[_0x10d9('0xf')]);router[_0x10d9('0x10')]('/',auth[_0x10d9('0xc')](),controller[_0x10d9('0x11')]);router[_0x10d9('0x10')](_0x10d9('0xe'),auth[_0x10d9('0xc')](),controller[_0x10d9('0x12')]);router[_0x10d9('0x10')]('/:id/sub_intervals/create_many',auth[_0x10d9('0xc')](),controller[_0x10d9('0x13')]);router[_0x10d9('0x14')](_0x10d9('0xb'),auth[_0x10d9('0xc')](),controller['update']);router[_0x10d9('0x15')]('/:id',auth[_0x10d9('0xc')](),controller[_0x10d9('0x16')]);module[_0x10d9('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 23a6403..111d3f5 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 _0x7e42=['sequelize','STRING'];(function(_0x510e6e,_0x533be4){var _0x30ce69=function(_0x41ce8a){while(--_0x41ce8a){_0x510e6e['push'](_0x510e6e['shift']());}};_0x30ce69(++_0x533be4);}(_0x7e42,0x120));var _0x27e4=function(_0x296df0,_0x9bd1c7){_0x296df0=_0x296df0-0x0;var _0x503153=_0x7e42[_0x296df0];return _0x503153;};'use strict';var Sequelize=require(_0x27e4('0x0'));module['exports']={'name':{'type':Sequelize[_0x27e4('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x27e4('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x0fd1=['STRING','sequelize','exports'];(function(_0x22e753,_0x497f81){var _0x511dd0=function(_0x464d6d){while(--_0x464d6d){_0x22e753['push'](_0x22e753['shift']());}};_0x511dd0(++_0x497f81);}(_0x0fd1,0x112));var _0x10fd=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x0fd1[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require(_0x10fd('0x0'));module[_0x10fd('0x1')]={'name':{'type':Sequelize[_0x10fd('0x2')]},'description':{'type':Sequelize[_0x10fd('0x2')]},'interval':{'type':Sequelize[_0x10fd('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 f9f2b25..8584be2 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 _0x361d=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','get','Intervals','error','stack','name','index','Interval','rawAttributes','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','filter','options','includeAll','findAll','catch','intersection','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addInterval','IntervalId','getIntervals','findOne','sequelize','transaction','bulkCreate','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x4d6f14,_0xdbfb56){var _0x3a5351=function(_0x45c0fe){while(--_0x45c0fe){_0x4d6f14['push'](_0x4d6f14['shift']());}};_0x3a5351(++_0xdbfb56);}(_0x361d,0x156));var _0xd361=function(_0x248c98,_0x2ff500){_0x248c98=_0x248c98-0x0;var _0xd9e769=_0x361d[_0x248c98];return _0xd9e769;};'use strict';var emlformat=require(_0xd361('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd361('0x1'));var jsonpatch=require(_0xd361('0x2'));var rp=require(_0xd361('0x3'));var moment=require(_0xd361('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd361('0x5'));var util=require(_0xd361('0x6'));var path=require(_0xd361('0x7'));var sox=require(_0xd361('0x8'));var csv=require(_0xd361('0x9'));var ejs=require(_0xd361('0xa'));var fs=require('fs');var fs_extra=require(_0xd361('0xb'));var _=require(_0xd361('0xc'));var squel=require(_0xd361('0xd'));var crypto=require(_0xd361('0xe'));var jsforce=require(_0xd361('0xf'));var deskjs=require(_0xd361('0x10'));var toCsv=require(_0xd361('0x9'));var querystring=require('querystring');var Papa=require(_0xd361('0x11'));var Redis=require('ioredis');var authService=require(_0xd361('0x12'));var qs=require(_0xd361('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd361('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd361('0x15'));var config=require(_0xd361('0x16'));var licenseUtil=require(_0xd361('0x17'));var db=require(_0xd361('0x18'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x27a27a,_0xeb3053){_0xeb3053=_0xeb3053||0xcc;return function(_0x9a94ad){if(_0x9a94ad){return _0x27a27a[_0xd361('0x19')](_0xeb3053);}return _0x27a27a[_0xd361('0x1a')](_0xeb3053)[_0xd361('0x1b')]();};}function respondWithResult(_0x1d444d,_0x292df8){_0x292df8=_0x292df8||0xc8;return function(_0x146b01){if(_0x146b01){return _0x1d444d[_0xd361('0x1a')](_0x292df8)['json'](_0x146b01);}};}function respondWithFilteredResult(_0x33cd84,_0x54aa59){return function(_0xdee79f){if(_0xdee79f){var _0x775425=typeof _0x54aa59[_0xd361('0x1c')]===_0xd361('0x1d')&&typeof _0x54aa59['limit']===_0xd361('0x1d');var _0xaf96d5=_0xdee79f[_0xd361('0x1e')];var _0x1619f9=_0x775425?0x0:_0x54aa59[_0xd361('0x1c')];var _0x2867e8=_0x775425?_0xdee79f['count']:_0x54aa59[_0xd361('0x1c')]+_0x54aa59[_0xd361('0x1f')];var _0x35538d;if(_0x2867e8>=_0xaf96d5){_0x2867e8=_0xaf96d5;_0x35538d=0xc8;}else{_0x35538d=0xce;}_0x33cd84['status'](_0x35538d);return _0x33cd84[_0xd361('0x20')](_0xd361('0x21'),_0x1619f9+'-'+_0x2867e8+'/'+_0xaf96d5)[_0xd361('0x22')](_0xdee79f);}return null;};}function patchUpdates(_0x1cf92b){return function(_0x474c4c){try{jsonpatch[_0xd361('0x23')](_0x474c4c,_0x1cf92b,!![]);}catch(_0x4f2f48){return BPromise['reject'](_0x4f2f48);}return _0x474c4c[_0xd361('0x24')]();};}function saveUpdates(_0x28641b,_0x4bc6c6){return function(_0x5ec45e){if(_0x5ec45e){return _0x5ec45e[_0xd361('0x25')](_0x28641b)[_0xd361('0x26')](function(_0x3360cd){return _0x3360cd;});}return null;};}function removeEntity(_0x81ce73,_0x31ac1c){return function(_0x28e34d){if(_0x28e34d){return _0x28e34d[_0xd361('0x27')]()[_0xd361('0x26')](function(){var _0x538aad=_0x28e34d[_0xd361('0x28')]({'plain':!![]});var _0x165a57=_0xd361('0x29');return db['UserProfileResource'][_0xd361('0x27')]({'where':{'type':_0x165a57,'resourceId':_0x538aad['id']}})[_0xd361('0x26')](function(){return _0x28e34d;});})['then'](function(){_0x81ce73[_0xd361('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14673a,_0x27675c){return function(_0x5e6b57){if(!_0x5e6b57){_0x14673a[_0xd361('0x19')](0x194);}return _0x5e6b57;};}function handleError(_0x31091a,_0x99057d){_0x99057d=_0x99057d||0x1f4;return function(_0x4b9884){logger[_0xd361('0x2a')](_0x4b9884[_0xd361('0x2b')]);if(_0x4b9884[_0xd361('0x2c')]){delete _0x4b9884[_0xd361('0x2c')];}_0x31091a[_0xd361('0x1a')](_0x99057d)['send'](_0x4b9884);};}exports[_0xd361('0x2d')]=function(_0xb4a227,_0xe953bf){var _0x548a39={},_0x5b9566={},_0x492992={'count':0x0,'rows':[]};var _0x28ec20=_['map'](db[_0xd361('0x2e')][_0xd361('0x2f')],function(_0x4357a9){return{'name':_0x4357a9['fieldName'],'type':_0x4357a9[_0xd361('0x30')]['key']};});_0x5b9566[_0xd361('0x31')]=_['map'](_0x28ec20,_0xd361('0x2c'));_0x5b9566[_0xd361('0x32')]=_[_0xd361('0x33')](_0xb4a227[_0xd361('0x32')]);_0x5b9566['filters']=_['intersection'](_0x5b9566['model'],_0x5b9566['query']);_0x548a39[_0xd361('0x34')]=_['intersection'](_0x5b9566[_0xd361('0x31')],qs['fields'](_0xb4a227['query'][_0xd361('0x35')]));_0x548a39[_0xd361('0x34')]=_0x548a39[_0xd361('0x34')][_0xd361('0x36')]?_0x548a39[_0xd361('0x34')]:_0x5b9566[_0xd361('0x31')];if(!_0xb4a227[_0xd361('0x32')][_0xd361('0x37')](_0xd361('0x38'))){_0x548a39[_0xd361('0x1f')]=qs[_0xd361('0x1f')](_0xb4a227[_0xd361('0x32')][_0xd361('0x1f')]);_0x548a39[_0xd361('0x1c')]=qs[_0xd361('0x1c')](_0xb4a227[_0xd361('0x32')][_0xd361('0x1c')]);}_0x548a39[_0xd361('0x39')]=qs[_0xd361('0x3a')](_0xb4a227[_0xd361('0x32')][_0xd361('0x3a')]);_0x548a39[_0xd361('0x3b')]=qs[_0xd361('0x3c')](_[_0xd361('0x3d')](_0xb4a227[_0xd361('0x32')],_0x5b9566['filters']),_0x28ec20);if(_0xb4a227[_0xd361('0x32')]['filter']){_0x548a39[_0xd361('0x3b')]=_[_0xd361('0x3e')](_0x548a39[_0xd361('0x3b')],{'$or':_[_0xd361('0x3f')](_0x28ec20,function(_0x380f5e){if(_0x380f5e['type']!=='VIRTUAL'){var _0x1c9a28={};_0x1c9a28[_0x380f5e[_0xd361('0x2c')]]={'$like':'%'+_0xb4a227[_0xd361('0x32')][_0xd361('0x40')]+'%'};return _0x1c9a28;}})});}_0x548a39=_[_0xd361('0x3e')]({},_0x548a39,_0xb4a227[_0xd361('0x41')]);var _0x1582bc={'where':_0x548a39['where']};return db[_0xd361('0x2e')][_0xd361('0x1e')](_0x1582bc)['then'](function(_0x4bfa32){_0x492992[_0xd361('0x1e')]=_0x4bfa32;if(_0xb4a227['query'][_0xd361('0x42')]){_0x548a39['include']=[{'all':!![]}];}return db[_0xd361('0x2e')][_0xd361('0x43')](_0x548a39);})[_0xd361('0x26')](function(_0x37ca1d){_0x492992['rows']=_0x37ca1d;return _0x492992;})[_0xd361('0x26')](respondWithFilteredResult(_0xe953bf,_0x548a39))[_0xd361('0x44')](handleError(_0xe953bf,null));};exports['show']=function(_0x213364,_0x5af279){var _0x56435b={'raw':!![],'where':{'id':_0x213364['params']['id']}},_0x364e9e={};_0x364e9e[_0xd361('0x31')]=_[_0xd361('0x33')](db[_0xd361('0x2e')][_0xd361('0x2f')]);_0x364e9e[_0xd361('0x32')]=_[_0xd361('0x33')](_0x213364['query']);_0x364e9e['filters']=_[_0xd361('0x45')](_0x364e9e[_0xd361('0x31')],_0x364e9e[_0xd361('0x32')]);_0x56435b[_0xd361('0x34')]=_[_0xd361('0x45')](_0x364e9e[_0xd361('0x31')],qs[_0xd361('0x35')](_0x213364['query'][_0xd361('0x35')]));_0x56435b[_0xd361('0x34')]=_0x56435b['attributes'][_0xd361('0x36')]?_0x56435b[_0xd361('0x34')]:_0x364e9e['model'];if(_0x213364[_0xd361('0x32')][_0xd361('0x42')]){_0x56435b[_0xd361('0x46')]=[{'all':!![]}];}_0x56435b=_[_0xd361('0x3e')]({},_0x56435b,_0x213364[_0xd361('0x41')]);return db[_0xd361('0x2e')][_0xd361('0x47')](_0x56435b)['then'](handleEntityNotFound(_0x5af279,null))['then'](respondWithResult(_0x5af279,null))[_0xd361('0x44')](handleError(_0x5af279,null));};exports['create']=function(_0x5e17ed,_0x2698a3){return db[_0xd361('0x2e')][_0xd361('0x48')](_0x5e17ed['body'],{})['then'](function(_0x43a344){var _0x2c8b98=_0x5e17ed[_0xd361('0x49')][_0xd361('0x28')]({'plain':!![]});if(!_0x2c8b98)throw new Error(_0xd361('0x4a'));if(_0x2c8b98[_0xd361('0x4b')]===_0xd361('0x49')){var _0x34474e=_0x43a344['get']({'plain':!![]});var _0x244b35=_0xd361('0x29');return db[_0xd361('0x4c')][_0xd361('0x47')]({'where':{'name':_0x244b35,'userProfileId':_0x2c8b98[_0xd361('0x4d')]},'raw':!![]})[_0xd361('0x26')](function(_0x5ae8e9){if(_0x5ae8e9&&_0x5ae8e9['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x34474e[_0xd361('0x2c')],'resourceId':_0x34474e['id'],'type':_0x5ae8e9[_0xd361('0x2c')],'sectionId':_0x5ae8e9['id']},{})[_0xd361('0x26')](function(){return _0x43a344;});}else{return _0x43a344;}})[_0xd361('0x44')](function(_0x4787c7){logger['error'](_0xd361('0x4e'),_0x4787c7);throw _0x4787c7;});}return _0x43a344;})[_0xd361('0x26')](respondWithResult(_0x2698a3,0xc9))['catch'](handleError(_0x2698a3,null));};exports[_0xd361('0x25')]=function(_0x3df9b5,_0x25ad42){if(_0x3df9b5[_0xd361('0x4f')]['id']){delete _0x3df9b5[_0xd361('0x4f')]['id'];}return db['Interval'][_0xd361('0x47')]({'where':{'id':_0x3df9b5[_0xd361('0x50')]['id']}})['then'](handleEntityNotFound(_0x25ad42,null))[_0xd361('0x26')](saveUpdates(_0x3df9b5[_0xd361('0x4f')],null))[_0xd361('0x26')](respondWithResult(_0x25ad42,null))[_0xd361('0x44')](handleError(_0x25ad42,null));};exports[_0xd361('0x27')]=function(_0x27222c,_0x325f99){return db[_0xd361('0x2e')][_0xd361('0x47')]({'where':{'id':_0x27222c[_0xd361('0x50')]['id']}})[_0xd361('0x26')](handleEntityNotFound(_0x325f99,null))[_0xd361('0x26')](removeEntity(_0x325f99,null))[_0xd361('0x44')](handleError(_0x325f99,null));};exports[_0xd361('0x51')]=function(_0x4274f5,_0x222e76,_0x18dc43){if(_0x4274f5[_0xd361('0x4f')]['id']){delete _0x4274f5[_0xd361('0x4f')]['id'];}return db[_0xd361('0x2e')][_0xd361('0x47')]({'where':{'id':_0x4274f5[_0xd361('0x50')]['id']}})[_0xd361('0x26')](handleEntityNotFound(_0x222e76,null))[_0xd361('0x26')](function(_0x4ac719){if(_0x4ac719){_0x4274f5[_0xd361('0x4f')][_0xd361('0x52')]=_0x4ac719['id'];return db[_0xd361('0x2e')][_0xd361('0x48')](_0x4274f5[_0xd361('0x4f')]);}})[_0xd361('0x26')](respondWithResult(_0x222e76,null))[_0xd361('0x44')](handleError(_0x222e76,null));};exports[_0xd361('0x53')]=function(_0x5d70d9,_0x2aee95,_0x203ad0){var _0x2db8fd={};var _0x5c9a99={};var _0x5d3599;var _0x133038;return db[_0xd361('0x2e')][_0xd361('0x54')]({'where':{'id':_0x5d70d9[_0xd361('0x50')]['id']}})['then'](handleEntityNotFound(_0x2aee95,null))[_0xd361('0x26')](function(_0x550b8b){if(_0x550b8b){_0x5d3599=_0x550b8b;_0x5c9a99[_0xd361('0x31')]=_[_0xd361('0x33')](db['Interval']['rawAttributes']);_0x5c9a99[_0xd361('0x32')]=_[_0xd361('0x33')](_0x5d70d9['query']);_0x5c9a99[_0xd361('0x3c')]=_[_0xd361('0x45')](_0x5c9a99[_0xd361('0x31')],_0x5c9a99[_0xd361('0x32')]);_0x2db8fd[_0xd361('0x34')]=_[_0xd361('0x45')](_0x5c9a99[_0xd361('0x31')],qs[_0xd361('0x35')](_0x5d70d9[_0xd361('0x32')][_0xd361('0x35')]));_0x2db8fd[_0xd361('0x34')]=_0x2db8fd[_0xd361('0x34')]['length']?_0x2db8fd[_0xd361('0x34')]:_0x5c9a99[_0xd361('0x31')];_0x2db8fd[_0xd361('0x39')]=qs[_0xd361('0x3a')](_0x5d70d9['query']['sort']);_0x2db8fd[_0xd361('0x3b')]=qs[_0xd361('0x3c')](_[_0xd361('0x3d')](_0x5d70d9[_0xd361('0x32')],_0x5c9a99['filters']));if(_0x5d70d9[_0xd361('0x32')][_0xd361('0x40')]){_0x2db8fd[_0xd361('0x3b')]=_[_0xd361('0x3e')](_0x2db8fd[_0xd361('0x3b')],{'$or':_['map'](_0x2db8fd['attributes'],function(_0x5dd619){var _0x3d9aa9={};_0x3d9aa9[_0x5dd619]={'$like':'%'+_0x5d70d9[_0xd361('0x32')][_0xd361('0x40')]+'%'};return _0x3d9aa9;})});}_0x2db8fd=_[_0xd361('0x3e')]({},_0x2db8fd,_0x5d70d9['options']);return _0x5d3599[_0xd361('0x53')](_0x2db8fd);}})[_0xd361('0x26')](function(_0x342cc6){if(_0x342cc6){_0x133038=_0x342cc6[_0xd361('0x36')];if(!_0x5d70d9[_0xd361('0x32')][_0xd361('0x37')](_0xd361('0x38'))){_0x2db8fd[_0xd361('0x1f')]=qs[_0xd361('0x1f')](_0x5d70d9[_0xd361('0x32')][_0xd361('0x1f')]);_0x2db8fd[_0xd361('0x1c')]=qs[_0xd361('0x1c')](_0x5d70d9['query']['offset']);}return _0x5d3599[_0xd361('0x53')](_0x2db8fd);}})['then'](function(_0xbd25db){if(_0xbd25db){return _0xbd25db?{'count':_0x133038,'rows':_0xbd25db}:null;}})[_0xd361('0x26')](respondWithResult(_0x2aee95,null))[_0xd361('0x44')](handleError(_0x2aee95,null));};exports['addIntervals']=function(_0x56bdf7,_0xe10b78,_0x1a0d96){return db[_0xd361('0x2e')][_0xd361('0x54')]({'where':{'id':_0x56bdf7[_0xd361('0x50')]['id']}})[_0xd361('0x26')](handleEntityNotFound(_0xe10b78,null))[_0xd361('0x26')](function(_0x518955){if(_0x518955){return db[_0xd361('0x55')][_0xd361('0x56')](function(_0x260149){return db[_0xd361('0x2e')][_0xd361('0x27')]({'where':{'IntervalId':_0x56bdf7['params']['id']},'transaction':_0x260149})[_0xd361('0x26')](function(_0x2d203c){var _0x200de0=_[_0xd361('0x3f')](_0x56bdf7['body'],function(_0x44b8b6){delete _0x44b8b6['id'];_0x44b8b6[_0xd361('0x52')]=_0x56bdf7['params']['id'];return _0x44b8b6;});return db[_0xd361('0x2e')][_0xd361('0x57')](_0x200de0,{'transaction':_0x260149});});})[_0xd361('0x26')](function(){return db[_0xd361('0x2e')][_0xd361('0x43')]({'where':{'IntervalId':_0x56bdf7[_0xd361('0x50')]['id']}});});}})[_0xd361('0x26')](respondWithResult(_0xe10b78,null))[_0xd361('0x44')](handleError(_0xe10b78,null));}; \ No newline at end of file +var _0x7473=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','name','type','key','map','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','Interval','include','findAll','catch','show','params','keys','rawAttributes','length','includeAll','find','create','body','UserProfileSection','autoAssociation','error','IntervalId','getIntervals','findOne','order','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x25af77,_0x2faaed){var _0x55631b=function(_0x3262b1){while(--_0x3262b1){_0x25af77['push'](_0x25af77['shift']());}};_0x55631b(++_0x2faaed);}(_0x7473,0x100));var _0x3747=function(_0x1296d3,_0x30dbbb){_0x1296d3=_0x1296d3-0x0;var _0x599675=_0x7473[_0x1296d3];return _0x599675;};'use strict';var emlformat=require(_0x3747('0x0'));var rimraf=require(_0x3747('0x1'));var zipdir=require(_0x3747('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3747('0x3'));var moment=require(_0x3747('0x4'));var BPromise=require(_0x3747('0x5'));var Mustache=require(_0x3747('0x6'));var util=require(_0x3747('0x7'));var path=require(_0x3747('0x8'));var sox=require(_0x3747('0x9'));var csv=require(_0x3747('0xa'));var ejs=require(_0x3747('0xb'));var fs=require('fs');var fs_extra=require(_0x3747('0xc'));var _=require(_0x3747('0xd'));var squel=require(_0x3747('0xe'));var crypto=require(_0x3747('0xf'));var jsforce=require(_0x3747('0x10'));var deskjs=require(_0x3747('0x11'));var toCsv=require(_0x3747('0xa'));var querystring=require(_0x3747('0x12'));var Papa=require(_0x3747('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3747('0x14'));var hardwareService=require(_0x3747('0x15'));var logger=require('../../config/logger')(_0x3747('0x16'));var utils=require(_0x3747('0x17'));var config=require(_0x3747('0x18'));var licenseUtil=require(_0x3747('0x19'));var db=require(_0x3747('0x1a'))['db'];var extensions=require(_0x3747('0x1b'));function respondWithStatusCode(_0xa785e,_0x4d2703){_0x4d2703=_0x4d2703||0xcc;return function(_0x1408ec){if(_0x1408ec){return _0xa785e[_0x3747('0x1c')](_0x4d2703);}return _0xa785e[_0x3747('0x1d')](_0x4d2703)[_0x3747('0x1e')]();};}function respondWithResult(_0xf93850,_0x436e6e){_0x436e6e=_0x436e6e||0xc8;return function(_0x574e14){if(_0x574e14){return _0xf93850['status'](_0x436e6e)[_0x3747('0x1f')](_0x574e14);}};}function respondWithFilteredResult(_0x34e4ea,_0x31746d){return function(_0x1ba49b){if(_0x1ba49b){var _0x473387=typeof _0x31746d['offset']===_0x3747('0x20')&&typeof _0x31746d['limit']===_0x3747('0x20');var _0x3d64c3=_0x1ba49b[_0x3747('0x21')];var _0x5615a0=_0x473387?0x0:_0x31746d[_0x3747('0x22')];var _0x317433=_0x473387?_0x1ba49b['count']:_0x31746d['offset']+_0x31746d[_0x3747('0x23')];var _0x3aa826;if(_0x317433>=_0x3d64c3){_0x317433=_0x3d64c3;_0x3aa826=0xc8;}else{_0x3aa826=0xce;}_0x34e4ea[_0x3747('0x1d')](_0x3aa826);return _0x34e4ea[_0x3747('0x24')](_0x3747('0x25'),_0x5615a0+'-'+_0x317433+'/'+_0x3d64c3)[_0x3747('0x1f')](_0x1ba49b);}return null;};}function patchUpdates(_0x3b5b6e){return function(_0x24a2ee){try{jsonpatch[_0x3747('0x26')](_0x24a2ee,_0x3b5b6e,!![]);}catch(_0x40da41){return BPromise[_0x3747('0x27')](_0x40da41);}return _0x24a2ee[_0x3747('0x28')]();};}function saveUpdates(_0x4c7960,_0xb1bdba){return function(_0x345605){if(_0x345605){return _0x345605[_0x3747('0x29')](_0x4c7960)[_0x3747('0x2a')](function(_0x583c9f){return _0x583c9f;});}return null;};}function removeEntity(_0x1ea613,_0x4076c3){return function(_0x393b6a){if(_0x393b6a){return _0x393b6a[_0x3747('0x2b')]()[_0x3747('0x2a')](function(){var _0x27edca=_0x393b6a[_0x3747('0x2c')]({'plain':!![]});var _0x289c7c=_0x3747('0x2d');return db[_0x3747('0x2e')][_0x3747('0x2b')]({'where':{'type':_0x289c7c,'resourceId':_0x27edca['id']}})[_0x3747('0x2a')](function(){return _0x393b6a;});})[_0x3747('0x2a')](function(){_0x1ea613[_0x3747('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbcef6f,_0x3536e0){return function(_0x41a044){if(!_0x41a044){_0xbcef6f[_0x3747('0x1c')](0x194);}return _0x41a044;};}function handleError(_0x2bf84b,_0x5f2689){_0x5f2689=_0x5f2689||0x1f4;return function(_0x46ca58){logger['error'](_0x46ca58['stack']);if(_0x46ca58[_0x3747('0x2f')]){delete _0x46ca58[_0x3747('0x2f')];}_0x2bf84b[_0x3747('0x1d')](_0x5f2689)['send'](_0x46ca58);};}exports['index']=function(_0x44f1b3,_0x423086){var _0x15e79f={},_0x41f9a5={},_0x3e393b={'count':0x0,'rows':[]};var _0x4f7534=_['map'](db['Interval']['rawAttributes'],function(_0x5ee316){return{'name':_0x5ee316['fieldName'],'type':_0x5ee316[_0x3747('0x30')][_0x3747('0x31')]};});_0x41f9a5['model']=_[_0x3747('0x32')](_0x4f7534,'name');_0x41f9a5[_0x3747('0x33')]=_['keys'](_0x44f1b3[_0x3747('0x33')]);_0x41f9a5[_0x3747('0x34')]=_['intersection'](_0x41f9a5[_0x3747('0x35')],_0x41f9a5[_0x3747('0x33')]);_0x15e79f['attributes']=_[_0x3747('0x36')](_0x41f9a5['model'],qs[_0x3747('0x37')](_0x44f1b3[_0x3747('0x33')][_0x3747('0x37')]));_0x15e79f['attributes']=_0x15e79f[_0x3747('0x38')]['length']?_0x15e79f[_0x3747('0x38')]:_0x41f9a5['model'];if(!_0x44f1b3[_0x3747('0x33')][_0x3747('0x39')](_0x3747('0x3a'))){_0x15e79f[_0x3747('0x23')]=qs['limit'](_0x44f1b3['query'][_0x3747('0x23')]);_0x15e79f['offset']=qs[_0x3747('0x22')](_0x44f1b3['query']['offset']);}_0x15e79f['order']=qs[_0x3747('0x3b')](_0x44f1b3[_0x3747('0x33')][_0x3747('0x3b')]);_0x15e79f[_0x3747('0x3c')]=qs[_0x3747('0x34')](_['pick'](_0x44f1b3['query'],_0x41f9a5['filters']),_0x4f7534);if(_0x44f1b3[_0x3747('0x33')][_0x3747('0x3d')]){_0x15e79f[_0x3747('0x3c')]=_[_0x3747('0x3e')](_0x15e79f[_0x3747('0x3c')],{'$or':_['map'](_0x4f7534,function(_0x43a3dc){if(_0x43a3dc[_0x3747('0x30')]!==_0x3747('0x3f')){var _0x3963a1={};_0x3963a1[_0x43a3dc[_0x3747('0x2f')]]={'$like':'%'+_0x44f1b3['query'][_0x3747('0x3d')]+'%'};return _0x3963a1;}})});}_0x15e79f=_[_0x3747('0x3e')]({},_0x15e79f,_0x44f1b3[_0x3747('0x40')]);var _0x5ad4eb={'where':_0x15e79f[_0x3747('0x3c')]};return db[_0x3747('0x41')][_0x3747('0x21')](_0x5ad4eb)[_0x3747('0x2a')](function(_0x7b5c0f){_0x3e393b[_0x3747('0x21')]=_0x7b5c0f;if(_0x44f1b3[_0x3747('0x33')]['includeAll']){_0x15e79f[_0x3747('0x42')]=[{'all':!![]}];}return db[_0x3747('0x41')][_0x3747('0x43')](_0x15e79f);})[_0x3747('0x2a')](function(_0x2b3f39){_0x3e393b['rows']=_0x2b3f39;return _0x3e393b;})[_0x3747('0x2a')](respondWithFilteredResult(_0x423086,_0x15e79f))[_0x3747('0x44')](handleError(_0x423086,null));};exports[_0x3747('0x45')]=function(_0x130c8a,_0x588dbe){var _0x5e1049={'raw':!![],'where':{'id':_0x130c8a[_0x3747('0x46')]['id']}},_0x4a78df={};_0x4a78df[_0x3747('0x35')]=_[_0x3747('0x47')](db[_0x3747('0x41')][_0x3747('0x48')]);_0x4a78df[_0x3747('0x33')]=_[_0x3747('0x47')](_0x130c8a['query']);_0x4a78df[_0x3747('0x34')]=_['intersection'](_0x4a78df[_0x3747('0x35')],_0x4a78df[_0x3747('0x33')]);_0x5e1049[_0x3747('0x38')]=_[_0x3747('0x36')](_0x4a78df[_0x3747('0x35')],qs[_0x3747('0x37')](_0x130c8a[_0x3747('0x33')][_0x3747('0x37')]));_0x5e1049[_0x3747('0x38')]=_0x5e1049[_0x3747('0x38')][_0x3747('0x49')]?_0x5e1049[_0x3747('0x38')]:_0x4a78df[_0x3747('0x35')];if(_0x130c8a[_0x3747('0x33')][_0x3747('0x4a')]){_0x5e1049[_0x3747('0x42')]=[{'all':!![]}];}_0x5e1049=_[_0x3747('0x3e')]({},_0x5e1049,_0x130c8a[_0x3747('0x40')]);return db[_0x3747('0x41')][_0x3747('0x4b')](_0x5e1049)[_0x3747('0x2a')](handleEntityNotFound(_0x588dbe,null))['then'](respondWithResult(_0x588dbe,null))[_0x3747('0x44')](handleError(_0x588dbe,null));};exports['create']=function(_0x1f7dd7,_0x1132fb){return db[_0x3747('0x41')][_0x3747('0x4c')](_0x1f7dd7[_0x3747('0x4d')],{})[_0x3747('0x2a')](function(_0x1583e7){var _0x27cfaf=_0x1f7dd7['user'][_0x3747('0x2c')]({'plain':!![]});if(!_0x27cfaf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27cfaf['role']==='user'){var _0x24baf7=_0x1583e7['get']({'plain':!![]});var _0x171d09=_0x3747('0x2d');return db[_0x3747('0x4e')][_0x3747('0x4b')]({'where':{'name':_0x171d09,'userProfileId':_0x27cfaf['userProfileId']},'raw':!![]})[_0x3747('0x2a')](function(_0x39c7ad){if(_0x39c7ad&&_0x39c7ad[_0x3747('0x4f')]===0x0){return db[_0x3747('0x2e')][_0x3747('0x4c')]({'name':_0x24baf7['name'],'resourceId':_0x24baf7['id'],'type':_0x39c7ad[_0x3747('0x2f')],'sectionId':_0x39c7ad['id']},{})[_0x3747('0x2a')](function(){return _0x1583e7;});}else{return _0x1583e7;}})[_0x3747('0x44')](function(_0x3d11e0){logger[_0x3747('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d11e0);throw _0x3d11e0;});}return _0x1583e7;})[_0x3747('0x2a')](respondWithResult(_0x1132fb,0xc9))['catch'](handleError(_0x1132fb,null));};exports[_0x3747('0x29')]=function(_0x364ad9,_0xbb4edf){if(_0x364ad9[_0x3747('0x4d')]['id']){delete _0x364ad9['body']['id'];}return db[_0x3747('0x41')][_0x3747('0x4b')]({'where':{'id':_0x364ad9[_0x3747('0x46')]['id']}})['then'](handleEntityNotFound(_0xbb4edf,null))['then'](saveUpdates(_0x364ad9['body'],null))[_0x3747('0x2a')](respondWithResult(_0xbb4edf,null))[_0x3747('0x44')](handleError(_0xbb4edf,null));};exports[_0x3747('0x2b')]=function(_0x4de2a7,_0x5176f0){return db[_0x3747('0x41')][_0x3747('0x4b')]({'where':{'id':_0x4de2a7[_0x3747('0x46')]['id']}})[_0x3747('0x2a')](handleEntityNotFound(_0x5176f0,null))[_0x3747('0x2a')](removeEntity(_0x5176f0,null))[_0x3747('0x44')](handleError(_0x5176f0,null));};exports['addInterval']=function(_0x8d69bf,_0x3597fc,_0x2bebf9){if(_0x8d69bf[_0x3747('0x4d')]['id']){delete _0x8d69bf[_0x3747('0x4d')]['id'];}return db[_0x3747('0x41')]['find']({'where':{'id':_0x8d69bf[_0x3747('0x46')]['id']}})[_0x3747('0x2a')](handleEntityNotFound(_0x3597fc,null))[_0x3747('0x2a')](function(_0x19b4c5){if(_0x19b4c5){_0x8d69bf[_0x3747('0x4d')][_0x3747('0x51')]=_0x19b4c5['id'];return db['Interval'][_0x3747('0x4c')](_0x8d69bf[_0x3747('0x4d')]);}})[_0x3747('0x2a')](respondWithResult(_0x3597fc,null))[_0x3747('0x44')](handleError(_0x3597fc,null));};exports[_0x3747('0x52')]=function(_0x54a50a,_0x3cda78,_0x3bb38d){var _0x20fac2={};var _0x37d7e3={};var _0x13d661;var _0x2a1d38;return db[_0x3747('0x41')][_0x3747('0x53')]({'where':{'id':_0x54a50a[_0x3747('0x46')]['id']}})[_0x3747('0x2a')](handleEntityNotFound(_0x3cda78,null))[_0x3747('0x2a')](function(_0x55764f){if(_0x55764f){_0x13d661=_0x55764f;_0x37d7e3[_0x3747('0x35')]=_['keys'](db[_0x3747('0x41')][_0x3747('0x48')]);_0x37d7e3['query']=_[_0x3747('0x47')](_0x54a50a['query']);_0x37d7e3[_0x3747('0x34')]=_[_0x3747('0x36')](_0x37d7e3[_0x3747('0x35')],_0x37d7e3[_0x3747('0x33')]);_0x20fac2[_0x3747('0x38')]=_[_0x3747('0x36')](_0x37d7e3[_0x3747('0x35')],qs[_0x3747('0x37')](_0x54a50a[_0x3747('0x33')][_0x3747('0x37')]));_0x20fac2[_0x3747('0x38')]=_0x20fac2[_0x3747('0x38')]['length']?_0x20fac2[_0x3747('0x38')]:_0x37d7e3[_0x3747('0x35')];_0x20fac2[_0x3747('0x54')]=qs[_0x3747('0x3b')](_0x54a50a[_0x3747('0x33')]['sort']);_0x20fac2['where']=qs[_0x3747('0x34')](_['pick'](_0x54a50a[_0x3747('0x33')],_0x37d7e3[_0x3747('0x34')]));if(_0x54a50a[_0x3747('0x33')][_0x3747('0x3d')]){_0x20fac2[_0x3747('0x3c')]=_[_0x3747('0x3e')](_0x20fac2[_0x3747('0x3c')],{'$or':_[_0x3747('0x32')](_0x20fac2[_0x3747('0x38')],function(_0x3b72bc){var _0x58718d={};_0x58718d[_0x3b72bc]={'$like':'%'+_0x54a50a[_0x3747('0x33')][_0x3747('0x3d')]+'%'};return _0x58718d;})});}_0x20fac2=_[_0x3747('0x3e')]({},_0x20fac2,_0x54a50a[_0x3747('0x40')]);return _0x13d661[_0x3747('0x52')](_0x20fac2);}})[_0x3747('0x2a')](function(_0x52ead4){if(_0x52ead4){_0x2a1d38=_0x52ead4[_0x3747('0x49')];if(!_0x54a50a['query'][_0x3747('0x39')](_0x3747('0x3a'))){_0x20fac2[_0x3747('0x23')]=qs[_0x3747('0x23')](_0x54a50a[_0x3747('0x33')]['limit']);_0x20fac2[_0x3747('0x22')]=qs[_0x3747('0x22')](_0x54a50a[_0x3747('0x33')][_0x3747('0x22')]);}return _0x13d661[_0x3747('0x52')](_0x20fac2);}})['then'](function(_0x1412fe){if(_0x1412fe){return _0x1412fe?{'count':_0x2a1d38,'rows':_0x1412fe}:null;}})[_0x3747('0x2a')](respondWithResult(_0x3cda78,null))[_0x3747('0x44')](handleError(_0x3cda78,null));};exports[_0x3747('0x55')]=function(_0x112b89,_0x3dcb3f,_0x3cc7cf){return db[_0x3747('0x41')][_0x3747('0x53')]({'where':{'id':_0x112b89['params']['id']}})[_0x3747('0x2a')](handleEntityNotFound(_0x3dcb3f,null))['then'](function(_0x360ad8){if(_0x360ad8){return db[_0x3747('0x56')][_0x3747('0x57')](function(_0x354036){return db[_0x3747('0x41')][_0x3747('0x2b')]({'where':{'IntervalId':_0x112b89[_0x3747('0x46')]['id']},'transaction':_0x354036})[_0x3747('0x2a')](function(_0xa468f5){var _0x4dad63=_[_0x3747('0x32')](_0x112b89[_0x3747('0x4d')],function(_0x400e3e){delete _0x400e3e['id'];_0x400e3e[_0x3747('0x51')]=_0x112b89[_0x3747('0x46')]['id'];return _0x400e3e;});return db[_0x3747('0x41')][_0x3747('0x58')](_0x4dad63,{'transaction':_0x354036});});})[_0x3747('0x2a')](function(){return db[_0x3747('0x41')][_0x3747('0x43')]({'where':{'IntervalId':_0x112b89[_0x3747('0x46')]['id']}});});}})[_0x3747('0x2a')](respondWithResult(_0x3dcb3f,null))[_0x3747('0x44')](handleError(_0x3dcb3f,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index e8b98a2..891a1ca 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 _0x5692=['string','getIntervals','then','all','map','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','rewrite','interval'];(function(_0x553f22,_0x4e4d7b){var _0x469eb1=function(_0x8719d){while(--_0x8719d){_0x553f22['push'](_0x553f22['shift']());}};_0x469eb1(++_0x4e4d7b);}(_0x5692,0xc5));var _0x2569=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5692[_0x432682];return _0x463d05;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x2569('0x0'));var iftime=require(_0x2569('0x1'))[_0x2569('0x2')];module[_0x2569('0x3')]=function(_0x1c9f37){return _0x1c9f37[_0x2569('0x4')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x34f0cb){extensions[_0x2569('0x5')](_0x1c9f37,_0x34f0cb);},'afterBulkCreate':function(_0x4714cd,_0x3de626,_0x167f93){_0x167f93();extensions[_0x2569('0x5')](_0x1c9f37,_0x4714cd[0x0]);},'afterUpdate':function(_0x5cef05){extensions['rewrite'](_0x1c9f37,_0x5cef05);},'afterDestroy':function(_0x1c02a9){extensions['rewrite'](_0x1c9f37,_0x1c02a9);}},'instanceMethods':{'ifTime':function(_0x1b368d=undefined,_0x2c661d=new Date()){if(typeof this[_0x2569('0x6')]===_0x2569('0x7')){return iftime(this[_0x2569('0x6')],_0x1b368d,_0x2c661d);}else{return this[_0x2569('0x8')]()[_0x2569('0x9')](function(_0x54e919){return Promise[_0x2569('0xa')](_0x54e919[_0x2569('0xb')](function(_0x28a7d5){return _0x28a7d5['ifTime'](_0x1b368d,_0x2c661d);}));})[_0x2569('0x9')](function(_0x2a8310){return _0x2a8310['reduce'](function(_0x1483bb,_0x46071b){return _0x1483bb||_0x46071b;},![]);});}}}});}; \ No newline at end of file +var _0x7599=['rewrite','interval','getIntervals','then','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','tools_intervals'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x7599,0xd1));var _0x9759=function(_0x592d8d,_0x1e9c53){_0x592d8d=_0x592d8d-0x0;var _0x5efbaa=_0x7599[_0x592d8d];return _0x5efbaa;};'use strict';var attributes=require(_0x9759('0x0'));var extensions=require(_0x9759('0x1'));var iftime=require(_0x9759('0x2'))[_0x9759('0x3')];module[_0x9759('0x4')]=function(_0x337a48){return _0x337a48[_0x9759('0x5')]('Interval',attributes,{'tableName':_0x9759('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x45a0b2){extensions[_0x9759('0x7')](_0x337a48,_0x45a0b2);},'afterBulkCreate':function(_0x3b32a,_0x24cfde,_0x484e56){_0x484e56();extensions[_0x9759('0x7')](_0x337a48,_0x3b32a[0x0]);},'afterUpdate':function(_0x4f7d20){extensions['rewrite'](_0x337a48,_0x4f7d20);},'afterDestroy':function(_0x5ee411){extensions[_0x9759('0x7')](_0x337a48,_0x5ee411);}},'instanceMethods':{'ifTime':function(_0x1dc646=undefined,_0x5aabfe=new Date()){if(typeof this['interval']==='string'){return iftime(this[_0x9759('0x8')],_0x1dc646,_0x5aabfe);}else{return this[_0x9759('0x9')]()[_0x9759('0xa')](function(_0x565a00){return Promise['all'](_0x565a00['map'](function(_0x876029){return _0x876029['ifTime'](_0x1dc646,_0x5aabfe);}));})[_0x9759('0xa')](function(_0x522a93){return _0x522a93[_0x9759('0xb')](function(_0x1b4722,_0x2e5179){return _0x1b4722||_0x2e5179;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 7def50d..073584a 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 _0x343e=['catch','message','error','ShowInterval','Interval','then','info','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','isArray','intervals','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly','IntervalIftime','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','GetInterval','findAll','options','raw','where','limit','map','model','attributes','include','debug','stringify'];(function(_0x2bd31c,_0x5df7ae){var _0x18972f=function(_0x580305){while(--_0x580305){_0x2bd31c['push'](_0x2bd31c['shift']());}};_0x18972f(++_0x5df7ae);}(_0x343e,0xc0));var _0xe343=function(_0x5ebfe3,_0x4c3f12){_0x5ebfe3=_0x5ebfe3-0x0;var _0xad7734=_0x343e[_0x5ebfe3];return _0xad7734;};'use strict';var _=require(_0xe343('0x0'));var util=require(_0xe343('0x1'));var db=require(_0xe343('0x2'))['db'];var iftime=require(_0xe343('0x3'))[_0xe343('0x4')];var logger=require(_0xe343('0x5'))('rpc');exports[_0xe343('0x6')]=function(_0x55141b){var _0x3f9e3d=this;return new Promise(function(_0x1cecd4,_0x472251){return db['Interval'][_0xe343('0x7')]({'raw':_0x55141b[_0xe343('0x8')]?_0x55141b[_0xe343('0x8')][_0xe343('0x9')]===undefined?!![]:![]:!![],'where':_0x55141b['options']?_0x55141b[_0xe343('0x8')][_0xe343('0xa')]||null:null,'attributes':_0x55141b[_0xe343('0x8')]?_0x55141b[_0xe343('0x8')]['attributes']||null:null,'limit':_0x55141b[_0xe343('0x8')]?_0x55141b[_0xe343('0x8')][_0xe343('0xb')]||null:null,'include':_0x55141b[_0xe343('0x8')]?_0x55141b[_0xe343('0x8')]['include']?_[_0xe343('0xc')](_0x55141b[_0xe343('0x8')]['include'],function(_0x44e0f3){return{'model':db[_0x44e0f3[_0xe343('0xd')]],'as':_0x44e0f3['as'],'attributes':_0x44e0f3[_0xe343('0xe')],'include':_0x44e0f3[_0xe343('0xf')]?_[_0xe343('0xc')](_0x44e0f3[_0xe343('0xf')],function(_0x376a46){return{'model':db[_0x376a46[_0xe343('0xd')]],'as':_0x376a46['as'],'attributes':_0x376a46[_0xe343('0xe')],'include':_0x376a46['include']?_['map'](_0x376a46['include'],function(_0x31ac48){return{'model':db[_0x31ac48['model']],'as':_0x31ac48['as'],'attributes':_0x31ac48['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x424387){logger['info'](_0xe343('0x6'),_0x55141b);logger[_0xe343('0x10')](_0xe343('0x6'),_0x55141b,JSON[_0xe343('0x11')](_0x424387));_0x1cecd4(_0x424387);})[_0xe343('0x12')](function(_0x48fbeb){logger['error'](_0xe343('0x6'),_0x48fbeb[_0xe343('0x13')],_0x55141b);_0x472251(_0x3f9e3d[_0xe343('0x14')](0x1f4,_0x48fbeb[_0xe343('0x13')]));});});};exports[_0xe343('0x15')]=function(_0x58bc03){var _0x5bcd6a=this;return new Promise(function(_0x5ba31e,_0x191b7b){return db[_0xe343('0x16')]['find']({'raw':_0x58bc03[_0xe343('0x8')]?_0x58bc03[_0xe343('0x8')][_0xe343('0x9')]===undefined?!![]:![]:!![],'where':_0x58bc03[_0xe343('0x8')]?_0x58bc03[_0xe343('0x8')][_0xe343('0xa')]||null:null,'attributes':_0x58bc03[_0xe343('0x8')]?_0x58bc03[_0xe343('0x8')][_0xe343('0xe')]||null:null,'include':_0x58bc03[_0xe343('0x8')]?_0x58bc03['options']['include']?_['map'](_0x58bc03[_0xe343('0x8')]['include'],function(_0x173f8){return{'model':db[_0x173f8[_0xe343('0xd')]],'as':_0x173f8['as'],'attributes':_0x173f8['attributes'],'include':_0x173f8[_0xe343('0xf')]?_['map'](_0x173f8['include'],function(_0x53107a){return{'model':db[_0x53107a[_0xe343('0xd')]],'as':_0x53107a['as'],'attributes':_0x53107a[_0xe343('0xe')],'include':_0x53107a[_0xe343('0xf')]?_[_0xe343('0xc')](_0x53107a[_0xe343('0xf')],function(_0x1bd454){return{'model':db[_0x1bd454[_0xe343('0xd')]],'as':_0x1bd454['as'],'attributes':_0x1bd454[_0xe343('0xe')]};}):[]};}):[]};}):[]:[]})[_0xe343('0x17')](function(_0xe751a6){logger[_0xe343('0x18')](_0xe343('0x15'),_0x58bc03);logger[_0xe343('0x10')](_0xe343('0x15'),_0x58bc03,JSON[_0xe343('0x11')](_0xe751a6));_0x5ba31e(_0xe751a6);})[_0xe343('0x12')](function(_0x3b7115){logger['error'](_0xe343('0x15'),_0x3b7115['message'],_0x58bc03);_0x191b7b(_0x5bcd6a[_0xe343('0x14')](0x1f4,_0x3b7115[_0xe343('0x13')]));});});};function checkArrayOfIntervals(_0x5acba0,_0x513b7b){var _0x178d12=[];return db[_0xe343('0x16')]['findAll']({'where':{'id':_0x5acba0}})[_0xe343('0x17')](function(_0x28e840){_0x178d12=_0x28e840;return Promise['all'](_0x178d12[_0xe343('0xc')](function(_0xdd6b6b){return _0xdd6b6b[_0xe343('0x19')](_0x513b7b);}));})['then'](function(_0x33f368){var _0x3eeb72=_0x33f368[_0xe343('0x1a')](function(_0x5b9fed,_0x29518c){return _0x5b9fed||_0x29518c;},![]);logger['info'](util[_0xe343('0x1b')](_0xe343('0x1c'),_0x178d12[_0xe343('0xc')](function(_0x2fe541){return _0x2fe541['name'];})['join'](',\x20'),_0x178d12[_0xe343('0xc')](function(_0x63e4f2){return _0x63e4f2['id'];})[_0xe343('0x1d')](',\x20')));return _0x3eeb72;});}function checkSingleInterval(_0x29baca,_0x1a6d19){return db[_0xe343('0x16')][_0xe343('0x1e')](_0x29baca)[_0xe343('0x17')](function(_0x5e239f){if(_0x5e239f){logger[_0xe343('0x18')](util[_0xe343('0x1b')](_0xe343('0x1f'),_0x5e239f[_0xe343('0x20')],_0x5e239f['id']));return _0x5e239f[_0xe343('0x19')](_0x1a6d19);}});}exports['IntervalIftime']=function(_0x379fd6){var _0x23094b=_0x379fd6['intervalIds'];var _0x3abc6c=Array[_0xe343('0x21')](_0x379fd6[_0xe343('0x22')])?_0x379fd6[_0xe343('0x22')]:typeof _0x379fd6[_0xe343('0x22')]==='string'?[_0x379fd6[_0xe343('0x22')]]:[];var _0x1b7169=_0x379fd6[_0xe343('0x23')]||undefined;var _0x584458=![];if(_0x3abc6c[_0xe343('0x24')]){logger['info'](util[_0xe343('0x1b')](_0xe343('0x25'),_0x3abc6c[_0xe343('0x1d')](';\x20')));}if(_0x1b7169){logger[_0xe343('0x18')](util['format']('IntervalIftime:\x20timezone\x20=\x20%s',_0x1b7169));}logger[_0xe343('0x10')](_0xe343('0x26'),_0x584458);logger[_0xe343('0x27')](_0xe343('0x28'),_0x379fd6);return Promise[_0xe343('0x29')]()[_0xe343('0x17')](function(){if(Array[_0xe343('0x21')](_0x23094b)){return checkArrayOfIntervals(_0x23094b,_0x1b7169);}else if(_0x23094b){return checkSingleInterval(_0x23094b,_0x1b7169);}})[_0xe343('0x17')](function(_0x1c6975){var _0x1f45c8=_0x3abc6c['reduce'](function(_0x15b05b,_0x181fa2){return _0x15b05b||iftime(_0x181fa2,_0x1b7169);},![]);_0x584458=_0x1c6975||_0x1f45c8;return _0x584458;})[_0xe343('0x12')](function(_0x1daba0){logger['error']('IntervalIftime',_0x379fd6,_0x1daba0);throw this['error'](0x1f4,_0x1daba0[_0xe343('0x13')]);});}; \ No newline at end of file +var _0x5647=['info','debug','catch','error','message','ShowInterval','find','raw','where','ifTime','reduce','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','IntervalIftime','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','lodash','../../mysqldb','../../utils/iftime','iftime','rpc','GetInterval','Interval','findAll','options','attributes','limit','include','map','model','then'];(function(_0x4a4f9c,_0x12e184){var _0x3b6d80=function(_0x15b9bb){while(--_0x15b9bb){_0x4a4f9c['push'](_0x4a4f9c['shift']());}};_0x3b6d80(++_0x12e184);}(_0x5647,0x19f));var _0x7564=function(_0x3b3ecb,_0x39ecaa){_0x3b3ecb=_0x3b3ecb-0x0;var _0x4c00bf=_0x5647[_0x3b3ecb];return _0x4c00bf;};'use strict';var _=require(_0x7564('0x0'));var util=require('util');var db=require(_0x7564('0x1'))['db'];var iftime=require(_0x7564('0x2'))[_0x7564('0x3')];var logger=require('../../config/logger')(_0x7564('0x4'));exports[_0x7564('0x5')]=function(_0x50b4c1){var _0x2ca2b1=this;return new Promise(function(_0x519638,_0x18276d){return db[_0x7564('0x6')][_0x7564('0x7')]({'raw':_0x50b4c1[_0x7564('0x8')]?_0x50b4c1[_0x7564('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x50b4c1[_0x7564('0x8')]?_0x50b4c1['options']['where']||null:null,'attributes':_0x50b4c1[_0x7564('0x8')]?_0x50b4c1[_0x7564('0x8')][_0x7564('0x9')]||null:null,'limit':_0x50b4c1[_0x7564('0x8')]?_0x50b4c1[_0x7564('0x8')][_0x7564('0xa')]||null:null,'include':_0x50b4c1[_0x7564('0x8')]?_0x50b4c1[_0x7564('0x8')][_0x7564('0xb')]?_[_0x7564('0xc')](_0x50b4c1['options'][_0x7564('0xb')],function(_0x259add){return{'model':db[_0x259add[_0x7564('0xd')]],'as':_0x259add['as'],'attributes':_0x259add[_0x7564('0x9')],'include':_0x259add[_0x7564('0xb')]?_['map'](_0x259add['include'],function(_0x44f62e){return{'model':db[_0x44f62e[_0x7564('0xd')]],'as':_0x44f62e['as'],'attributes':_0x44f62e['attributes'],'include':_0x44f62e['include']?_['map'](_0x44f62e[_0x7564('0xb')],function(_0x126e49){return{'model':db[_0x126e49['model']],'as':_0x126e49['as'],'attributes':_0x126e49[_0x7564('0x9')]};}):[]};}):[]};}):[]:[]})[_0x7564('0xe')](function(_0x22701f){logger[_0x7564('0xf')](_0x7564('0x5'),_0x50b4c1);logger[_0x7564('0x10')]('GetInterval',_0x50b4c1,JSON['stringify'](_0x22701f));_0x519638(_0x22701f);})[_0x7564('0x11')](function(_0x3fee7f){logger[_0x7564('0x12')](_0x7564('0x5'),_0x3fee7f[_0x7564('0x13')],_0x50b4c1);_0x18276d(_0x2ca2b1[_0x7564('0x12')](0x1f4,_0x3fee7f[_0x7564('0x13')]));});});};exports[_0x7564('0x14')]=function(_0x84ceb3){var _0x149baa=this;return new Promise(function(_0x9c6ca0,_0x2d9f75){return db[_0x7564('0x6')][_0x7564('0x15')]({'raw':_0x84ceb3[_0x7564('0x8')]?_0x84ceb3[_0x7564('0x8')][_0x7564('0x16')]===undefined?!![]:![]:!![],'where':_0x84ceb3[_0x7564('0x8')]?_0x84ceb3[_0x7564('0x8')][_0x7564('0x17')]||null:null,'attributes':_0x84ceb3[_0x7564('0x8')]?_0x84ceb3[_0x7564('0x8')]['attributes']||null:null,'include':_0x84ceb3[_0x7564('0x8')]?_0x84ceb3['options'][_0x7564('0xb')]?_[_0x7564('0xc')](_0x84ceb3[_0x7564('0x8')][_0x7564('0xb')],function(_0x3c6fe6){return{'model':db[_0x3c6fe6[_0x7564('0xd')]],'as':_0x3c6fe6['as'],'attributes':_0x3c6fe6[_0x7564('0x9')],'include':_0x3c6fe6[_0x7564('0xb')]?_[_0x7564('0xc')](_0x3c6fe6[_0x7564('0xb')],function(_0x1be2fa){return{'model':db[_0x1be2fa[_0x7564('0xd')]],'as':_0x1be2fa['as'],'attributes':_0x1be2fa['attributes'],'include':_0x1be2fa[_0x7564('0xb')]?_[_0x7564('0xc')](_0x1be2fa[_0x7564('0xb')],function(_0x3daf63){return{'model':db[_0x3daf63[_0x7564('0xd')]],'as':_0x3daf63['as'],'attributes':_0x3daf63[_0x7564('0x9')]};}):[]};}):[]};}):[]:[]})[_0x7564('0xe')](function(_0x39b441){logger[_0x7564('0xf')](_0x7564('0x14'),_0x84ceb3);logger[_0x7564('0x10')](_0x7564('0x14'),_0x84ceb3,JSON['stringify'](_0x39b441));_0x9c6ca0(_0x39b441);})[_0x7564('0x11')](function(_0x2ba833){logger[_0x7564('0x12')](_0x7564('0x14'),_0x2ba833[_0x7564('0x13')],_0x84ceb3);_0x2d9f75(_0x149baa['error'](0x1f4,_0x2ba833[_0x7564('0x13')]));});});};function checkArrayOfIntervals(_0x2d712c,_0x9504cb){var _0x3fd8d4=[];return db['Interval'][_0x7564('0x7')]({'where':{'id':_0x2d712c}})[_0x7564('0xe')](function(_0x135202){_0x3fd8d4=_0x135202;return Promise['all'](_0x3fd8d4['map'](function(_0x5e13e3){return _0x5e13e3[_0x7564('0x18')](_0x9504cb);}));})['then'](function(_0x22437c){var _0x2b6d10=_0x22437c[_0x7564('0x19')](function(_0x398807,_0x3daaff){return _0x398807||_0x3daaff;},![]);logger[_0x7564('0xf')](util['format'](_0x7564('0x1a'),_0x3fd8d4[_0x7564('0xc')](function(_0x7f5165){return _0x7f5165['name'];})[_0x7564('0x1b')](',\x20'),_0x3fd8d4[_0x7564('0xc')](function(_0x18d19d){return _0x18d19d['id'];})[_0x7564('0x1b')](',\x20')));return _0x2b6d10;});}function checkSingleInterval(_0x36130e,_0x8cc7e3){return db[_0x7564('0x6')][_0x7564('0x1c')](_0x36130e)[_0x7564('0xe')](function(_0x486b22){if(_0x486b22){logger[_0x7564('0xf')](util[_0x7564('0x1d')](_0x7564('0x1e'),_0x486b22[_0x7564('0x1f')],_0x486b22['id']));return _0x486b22[_0x7564('0x18')](_0x8cc7e3);}});}exports[_0x7564('0x20')]=function(_0x538e7b){var _0x3d1730=_0x538e7b['intervalIds'];var _0x2f0836=Array[_0x7564('0x21')](_0x538e7b['intervals'])?_0x538e7b[_0x7564('0x22')]:typeof _0x538e7b[_0x7564('0x22')]===_0x7564('0x23')?[_0x538e7b[_0x7564('0x22')]]:[];var _0x26a243=_0x538e7b[_0x7564('0x24')]||undefined;var _0x50d0d9=![];if(_0x2f0836[_0x7564('0x25')]){logger[_0x7564('0xf')](util['format'](_0x7564('0x26'),_0x2f0836['join'](';\x20')));}if(_0x26a243){logger['info'](util[_0x7564('0x1d')](_0x7564('0x27'),_0x26a243));}logger[_0x7564('0x10')](_0x7564('0x28'),_0x50d0d9);logger[_0x7564('0x29')](_0x7564('0x20'),_0x538e7b);return Promise[_0x7564('0x2a')]()['then'](function(){if(Array['isArray'](_0x3d1730)){return checkArrayOfIntervals(_0x3d1730,_0x26a243);}else if(_0x3d1730){return checkSingleInterval(_0x3d1730,_0x26a243);}})[_0x7564('0xe')](function(_0x4646ea){var _0x233d4c=_0x2f0836[_0x7564('0x19')](function(_0x50901a,_0x3ae81d){return _0x50901a||iftime(_0x3ae81d,_0x26a243);},![]);_0x50d0d9=_0x4646ea||_0x233d4c;return _0x50d0d9;})[_0x7564('0x11')](function(_0x1a8be7){logger[_0x7564('0x12')]('IntervalIftime',_0x538e7b,_0x1a8be7);throw this[_0x7564('0x12')](0x1f4,_0x1a8be7['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 2369eb8..b122bd9 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 _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x3b6d96,_0x5d3241){var _0x1e6b1c=function(_0x200631){while(--_0x200631){_0x3b6d96['push'](_0x3b6d96['shift']());}};_0x1e6b1c(++_0x5d3241);}(_0x5f2f,0x73));var _0xf5f2=function(_0x57c078,_0x3e1799){_0x57c078=_0x57c078-0x0;var _0x5f0e8e=_0x5f2f[_0x57c078];return _0x5f0e8e;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x327c38,_0x3e1458){var _0x19c0de=function(_0x5e30ef){while(--_0x5e30ef){_0x327c38['push'](_0x327c38['shift']());}};_0x19c0de(++_0x3e1458);}(_0x5f2f,0x73));var _0xf5f2=function(_0x29e2e4,_0x3e3918){_0x29e2e4=_0x29e2e4-0x0;var _0x337fa7=_0x5f2f[_0x29e2e4];return _0x337fa7;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 18d7b76..d053499 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 _0x5bbd=['3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','issuetype','oldToken','fields','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','Basic\x20','toString','base64','stringify','request','setEncoding','data','end','status','parse','api.jira','write','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','api'];(function(_0x1bec53,_0x539d0e){var _0x15f4f3=function(_0x3e92d1){while(--_0x3e92d1){_0x1bec53['push'](_0x1bec53['shift']());}};_0x15f4f3(++_0x539d0e);}(_0x5bbd,0x69));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xd5bb('0x0'));var https=require(_0xd5bb('0x1'));var logger=require('../../config/logger')(_0xd5bb('0x2'));var USERNAME='support';var PASSWORD=_0xd5bb('0x3');function openIssue(_0x3acfcc,_0x1472fc){var _0x58d132={'fields':{'project':{'key':_0x3acfcc[_0xd5bb('0x4')]||_0xd5bb('0x5')},'summary':(_0x3acfcc[_0xd5bb('0x6')]||_0xd5bb('0x7'))+_0xd5bb('0x8')+_0x3acfcc['ip'],'description':_0x3acfcc['description']||JSON['stringify'](_0x3acfcc),'issuetype':{'name':_0x3acfcc[_0xd5bb('0x9')]||'Bug'}}};_0x58d132['fields']['customfield_11500']=_0x3acfcc['email'];_0x58d132['fields']['customfield_11501']=_0x3acfcc[_0xd5bb('0xa')];_0x58d132[_0xd5bb('0xb')]['customfield_11502']=_0x3acfcc['newToken'];_0x58d132[_0xd5bb('0xb')]['customfield_11503']=_0x3acfcc['name'];_0x58d132[_0xd5bb('0xb')][_0xd5bb('0xc')]=_0x3acfcc[_0xd5bb('0xd')];_0x58d132['fields'][_0xd5bb('0xe')]=_0x3acfcc['ip'];var _0x30daeb={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xd5bb('0xf'),'method':_0xd5bb('0x10'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xd5bb('0x11')+new Buffer(USERNAME+':'+PASSWORD)[_0xd5bb('0x12')](_0xd5bb('0x13'))}};var _0x2b0b6d=JSON[_0xd5bb('0x14')](_0x58d132);var _0x342d0b=https[_0xd5bb('0x15')](_0x30daeb,function(_0x277ddb){_0x277ddb[_0xd5bb('0x16')]('utf8');var _0x40f4b7='';_0x277ddb['on'](_0xd5bb('0x17'),function(_0x42a22e){_0x40f4b7+=_0x42a22e;});_0x277ddb['on'](_0xd5bb('0x18'),function(){if(_0x1472fc){return _0x1472fc[_0xd5bb('0x19')](_0x277ddb['statusCode'])['json'](JSON[_0xd5bb('0x1a')](_0x40f4b7));}});});_0x342d0b['on']('error',function(_0x19d43f){if(_0x1472fc){return _0x1472fc[_0xd5bb('0x19')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xd5bb('0x1b')}]});}});_0x342d0b[_0xd5bb('0x1c')](_0x2b0b6d);_0x342d0b[_0xd5bb('0x18')]();}exports['openIssue']=openIssue;exports[_0xd5bb('0x1d')]=function(_0x502522,_0x1ce880){_0x502522[_0xd5bb('0x1e')]['ip']=_0x502522[_0xd5bb('0x1f')][_0xd5bb('0x20')]||_0x502522[_0xd5bb('0x21')]['remoteAddress']||_0x502522['socket']['remoteAddress']||_0x502522['connection'][_0xd5bb('0x22')][_0xd5bb('0x23')];return openIssue(_0x502522[_0xd5bb('0x1e')],_0x1ce880);}; \ No newline at end of file +var _0x1e8e=['description','issuetype','Bug','fields','customfield_11500','email','oldToken','customfield_11502','customfield_11503','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','stringify','setEncoding','utf8','data','end','status','statusCode','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','remoteAddress','socket','connection','body','bluebird','https','../../config/logger','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20'];(function(_0x558e45,_0x87367){var _0x335acd=function(_0x379f5d){while(--_0x379f5d){_0x558e45['push'](_0x558e45['shift']());}};_0x335acd(++_0x87367);}(_0x1e8e,0x12c));var _0xe1e8=function(_0x416da4,_0x5a409c){_0x416da4=_0x416da4-0x0;var _0x38e9f6=_0x1e8e[_0x416da4];return _0x38e9f6;};'use strict';var BPromise=require(_0xe1e8('0x0'));var https=require(_0xe1e8('0x1'));var logger=require(_0xe1e8('0x2'))('api');var USERNAME='support';var PASSWORD=_0xe1e8('0x3');function openIssue(_0x4e99b9,_0x5e3264){var _0x371ff8={'fields':{'project':{'key':_0x4e99b9[_0xe1e8('0x4')]||_0xe1e8('0x5')},'summary':(_0x4e99b9['summary']||_0xe1e8('0x6'))+_0xe1e8('0x7')+_0x4e99b9['ip'],'description':_0x4e99b9[_0xe1e8('0x8')]||JSON['stringify'](_0x4e99b9),'issuetype':{'name':_0x4e99b9[_0xe1e8('0x9')]||_0xe1e8('0xa')}}};_0x371ff8[_0xe1e8('0xb')][_0xe1e8('0xc')]=_0x4e99b9[_0xe1e8('0xd')];_0x371ff8[_0xe1e8('0xb')]['customfield_11501']=_0x4e99b9[_0xe1e8('0xe')];_0x371ff8['fields'][_0xe1e8('0xf')]=_0x4e99b9['newToken'];_0x371ff8[_0xe1e8('0xb')][_0xe1e8('0x10')]=_0x4e99b9['name'];_0x371ff8[_0xe1e8('0xb')]['customfield_11504']=_0x4e99b9['reason'];_0x371ff8['fields'][_0xe1e8('0x11')]=_0x4e99b9['ip'];var _0x37ed19={'host':_0xe1e8('0x12'),'port':0x1bb,'path':_0xe1e8('0x13'),'method':_0xe1e8('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0xe1e8('0x15'),'Authorization':_0xe1e8('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0xe1e8('0x17')]('base64')}};var _0x41571f=JSON[_0xe1e8('0x18')](_0x371ff8);var _0x36a34f=https['request'](_0x37ed19,function(_0x2138d3){_0x2138d3[_0xe1e8('0x19')](_0xe1e8('0x1a'));var _0x3102a0='';_0x2138d3['on'](_0xe1e8('0x1b'),function(_0x4a4724){_0x3102a0+=_0x4a4724;});_0x2138d3['on'](_0xe1e8('0x1c'),function(){if(_0x5e3264){return _0x5e3264[_0xe1e8('0x1d')](_0x2138d3[_0xe1e8('0x1e')])['json'](JSON[_0xe1e8('0x1f')](_0x3102a0));}});});_0x36a34f['on'](_0xe1e8('0x20'),function(_0xd5a05b){if(_0x5e3264){return _0x5e3264[_0xe1e8('0x1d')](0x1f4)[_0xe1e8('0x21')]({'errors':[{'message':_0xe1e8('0x22'),'type':_0xe1e8('0x23')}]});}});_0x36a34f[_0xe1e8('0x24')](_0x41571f);_0x36a34f[_0xe1e8('0x1c')]();}exports[_0xe1e8('0x25')]=openIssue;exports[_0xe1e8('0x26')]=function(_0x5f18f5,_0x14c1fb){_0x5f18f5['body']['ip']=_0x5f18f5[_0xe1e8('0x27')]['x-forwarded-for']||_0x5f18f5['connection'][_0xe1e8('0x28')]||_0x5f18f5[_0xe1e8('0x29')][_0xe1e8('0x28')]||_0x5f18f5[_0xe1e8('0x2a')]['socket'][_0xe1e8('0x28')];return openIssue(_0x5f18f5[_0xe1e8('0x2b')],_0x14c1fb);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index be3782d..a9d5faa 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 _0x34e8=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete'];(function(_0x4c7d83,_0xc19f52){var _0x1ad3ed=function(_0x23d5b1){while(--_0x23d5b1){_0x4c7d83['push'](_0x4c7d83['shift']());}};_0x1ad3ed(++_0xc19f52);}(_0x34e8,0x12c));var _0x834e=function(_0x58dc31,_0x201881){_0x58dc31=_0x58dc31-0x0;var _0x212311=_0x34e8[_0x58dc31];return _0x212311;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0x15')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x16')]=router; \ No newline at end of file +var _0xcb91=['get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller'];(function(_0x1bd7de,_0x3108c0){var _0x56240b=function(_0x2aa0c2){while(--_0x2aa0c2){_0x1bd7de['push'](_0x1bd7de['shift']());}};_0x56240b(++_0x3108c0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0xcb91[_0x2d4421];return _0x2d3b01;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')](_0x1cb9('0xb'),auth['isAuthenticated'](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index cddbecd..315ff65 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(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x7a54,0x106));var _0x47a5=function(_0x2058b3,_0x57c671){_0x2058b3=_0x2058b3-0x0;var _0x4e00d1=_0x7a54[_0x2058b3];return _0x4e00d1;};'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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7a54,0x106));var _0x47a5=function(_0xb850b8,_0x566fb4){_0xb850b8=_0xb850b8-0x0;var _0x475c70=_0x7a54[_0xb850b8];return _0x475c70;};'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 62c89b9..f5634fa 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 _0x9f7a=['end','offset','undefined','limit','count','set','Content-Range','json','update','then','error','name','send','map','JscriptyAnswerReport','type','key','query','intersection','model','attributes','fields','order','sort','filters','pick','filter','where','merge','options','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','fs-extra','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x58700a,_0x3dcb77){var _0x586921=function(_0x49b097){while(--_0x49b097){_0x58700a['push'](_0x58700a['shift']());}};_0x586921(++_0x3dcb77);}(_0x9f7a,0xf1));var _0xa9f7=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x9f7a[_0x725b8e];return _0x43ac45;};'use strict';var emlformat=require(_0xa9f7('0x0'));var rimraf=require(_0xa9f7('0x1'));var zipdir=require(_0xa9f7('0x2'));var jsonpatch=require(_0xa9f7('0x3'));var rp=require('request-promise');var moment=require(_0xa9f7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa9f7('0x5'));var sox=require(_0xa9f7('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9f7('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9f7('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xa9f7('0x9'));var querystring=require(_0xa9f7('0xa'));var Papa=require(_0xa9f7('0xb'));var Redis=require('ioredis');var authService=require(_0xa9f7('0xc'));var qs=require(_0xa9f7('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9f7('0xe'));var logger=require(_0xa9f7('0xf'))(_0xa9f7('0x10'));var utils=require(_0xa9f7('0x11'));var config=require(_0xa9f7('0x12'));var licenseUtil=require(_0xa9f7('0x13'));var db=require(_0xa9f7('0x14'))['db'];function respondWithStatusCode(_0x52e4d4,_0x532485){_0x532485=_0x532485||0xcc;return function(_0x5462c6){if(_0x5462c6){return _0x52e4d4[_0xa9f7('0x15')](_0x532485);}return _0x52e4d4[_0xa9f7('0x16')](_0x532485)[_0xa9f7('0x17')]();};}function respondWithResult(_0x4fb93c,_0x5f097c){_0x5f097c=_0x5f097c||0xc8;return function(_0xe56a20){if(_0xe56a20){return _0x4fb93c['status'](_0x5f097c)['json'](_0xe56a20);}};}function respondWithFilteredResult(_0x188f8a,_0x3987a5){return function(_0x30b935){if(_0x30b935){var _0x4cc9f3=typeof _0x3987a5[_0xa9f7('0x18')]===_0xa9f7('0x19')&&typeof _0x3987a5[_0xa9f7('0x1a')]==='undefined';var _0x310009=_0x30b935[_0xa9f7('0x1b')];var _0x230904=_0x4cc9f3?0x0:_0x3987a5[_0xa9f7('0x18')];var _0x8da225=_0x4cc9f3?_0x30b935[_0xa9f7('0x1b')]:_0x3987a5[_0xa9f7('0x18')]+_0x3987a5[_0xa9f7('0x1a')];var _0x2d0a7b;if(_0x8da225>=_0x310009){_0x8da225=_0x310009;_0x2d0a7b=0xc8;}else{_0x2d0a7b=0xce;}_0x188f8a['status'](_0x2d0a7b);return _0x188f8a[_0xa9f7('0x1c')](_0xa9f7('0x1d'),_0x230904+'-'+_0x8da225+'/'+_0x310009)[_0xa9f7('0x1e')](_0x30b935);}return null;};}function patchUpdates(_0x28590b){return function(_0x402c6d){try{jsonpatch['apply'](_0x402c6d,_0x28590b,!![]);}catch(_0x4a27de){return BPromise['reject'](_0x4a27de);}return _0x402c6d['save']();};}function saveUpdates(_0x4edaf9,_0x4b7202){return function(_0x5c9e4f){if(_0x5c9e4f){return _0x5c9e4f[_0xa9f7('0x1f')](_0x4edaf9)['then'](function(_0x5a62ba){return _0x5a62ba;});}return null;};}function removeEntity(_0x3fa542,_0x530992){return function(_0x502562){if(_0x502562){return _0x502562['destroy']()[_0xa9f7('0x20')](function(){_0x3fa542[_0xa9f7('0x16')](0xcc)[_0xa9f7('0x17')]();});}};}function handleEntityNotFound(_0x537d55,_0x131872){return function(_0x112446){if(!_0x112446){_0x537d55[_0xa9f7('0x15')](0x194);}return _0x112446;};}function handleError(_0x5555f6,_0x44a86d){_0x44a86d=_0x44a86d||0x1f4;return function(_0x52bb0a){logger[_0xa9f7('0x21')](_0x52bb0a['stack']);if(_0x52bb0a[_0xa9f7('0x22')]){delete _0x52bb0a[_0xa9f7('0x22')];}_0x5555f6[_0xa9f7('0x16')](_0x44a86d)[_0xa9f7('0x23')](_0x52bb0a);};}exports['index']=function(_0x41530a,_0x249604){var _0x16437e={},_0x312084={},_0xc9684a={'count':0x0,'rows':[]};var _0x471c3c=_[_0xa9f7('0x24')](db[_0xa9f7('0x25')]['rawAttributes'],function(_0x540f78){return{'name':_0x540f78['fieldName'],'type':_0x540f78[_0xa9f7('0x26')][_0xa9f7('0x27')]};});_0x312084['model']=_[_0xa9f7('0x24')](_0x471c3c,'name');_0x312084['query']=_['keys'](_0x41530a[_0xa9f7('0x28')]);_0x312084['filters']=_[_0xa9f7('0x29')](_0x312084[_0xa9f7('0x2a')],_0x312084[_0xa9f7('0x28')]);_0x16437e[_0xa9f7('0x2b')]=_[_0xa9f7('0x29')](_0x312084['model'],qs[_0xa9f7('0x2c')](_0x41530a[_0xa9f7('0x28')]['fields']));_0x16437e[_0xa9f7('0x2b')]=_0x16437e[_0xa9f7('0x2b')]['length']?_0x16437e[_0xa9f7('0x2b')]:_0x312084[_0xa9f7('0x2a')];if(!_0x41530a[_0xa9f7('0x28')]['hasOwnProperty']('nolimit')){_0x16437e[_0xa9f7('0x1a')]=qs[_0xa9f7('0x1a')](_0x41530a[_0xa9f7('0x28')][_0xa9f7('0x1a')]);_0x16437e[_0xa9f7('0x18')]=qs['offset'](_0x41530a[_0xa9f7('0x28')][_0xa9f7('0x18')]);}_0x16437e[_0xa9f7('0x2d')]=qs['sort'](_0x41530a['query'][_0xa9f7('0x2e')]);_0x16437e['where']=qs[_0xa9f7('0x2f')](_[_0xa9f7('0x30')](_0x41530a[_0xa9f7('0x28')],_0x312084[_0xa9f7('0x2f')]),_0x471c3c);if(_0x41530a['query'][_0xa9f7('0x31')]){_0x16437e[_0xa9f7('0x32')]=_[_0xa9f7('0x33')](_0x16437e[_0xa9f7('0x32')],{'$or':_[_0xa9f7('0x24')](_0x471c3c,function(_0x318f96){if(_0x318f96[_0xa9f7('0x26')]!=='VIRTUAL'){var _0xe6d3e3={};_0xe6d3e3[_0x318f96[_0xa9f7('0x22')]]={'$like':'%'+_0x41530a['query'][_0xa9f7('0x31')]+'%'};return _0xe6d3e3;}})});}_0x16437e=_[_0xa9f7('0x33')]({},_0x16437e,_0x41530a[_0xa9f7('0x34')]);var _0x419433={'where':_0x16437e[_0xa9f7('0x32')]};return db[_0xa9f7('0x25')][_0xa9f7('0x1b')](_0x419433)['then'](function(_0x402808){_0xc9684a[_0xa9f7('0x1b')]=_0x402808;if(_0x41530a[_0xa9f7('0x28')]['includeAll']){_0x16437e[_0xa9f7('0x35')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xa9f7('0x36')](_0x16437e);})[_0xa9f7('0x20')](function(_0x5eb5d2){_0xc9684a[_0xa9f7('0x37')]=_0x5eb5d2;return _0xc9684a;})[_0xa9f7('0x20')](respondWithFilteredResult(_0x249604,_0x16437e))[_0xa9f7('0x38')](handleError(_0x249604,null));};exports[_0xa9f7('0x39')]=function(_0xd56610,_0x492d3f){var _0x3fb0d6={'raw':!![],'where':{'id':_0xd56610[_0xa9f7('0x3a')]['id']}},_0x2d9e79={};_0x2d9e79[_0xa9f7('0x2a')]=_[_0xa9f7('0x3b')](db[_0xa9f7('0x25')][_0xa9f7('0x3c')]);_0x2d9e79[_0xa9f7('0x28')]=_[_0xa9f7('0x3b')](_0xd56610[_0xa9f7('0x28')]);_0x2d9e79[_0xa9f7('0x2f')]=_[_0xa9f7('0x29')](_0x2d9e79['model'],_0x2d9e79['query']);_0x3fb0d6[_0xa9f7('0x2b')]=_[_0xa9f7('0x29')](_0x2d9e79[_0xa9f7('0x2a')],qs[_0xa9f7('0x2c')](_0xd56610[_0xa9f7('0x28')][_0xa9f7('0x2c')]));_0x3fb0d6[_0xa9f7('0x2b')]=_0x3fb0d6[_0xa9f7('0x2b')]['length']?_0x3fb0d6[_0xa9f7('0x2b')]:_0x2d9e79[_0xa9f7('0x2a')];if(_0xd56610[_0xa9f7('0x28')]['includeAll']){_0x3fb0d6['include']=[{'all':!![]}];}_0x3fb0d6=_[_0xa9f7('0x33')]({},_0x3fb0d6,_0xd56610['options']);return db[_0xa9f7('0x25')][_0xa9f7('0x3d')](_0x3fb0d6)[_0xa9f7('0x20')](handleEntityNotFound(_0x492d3f,null))[_0xa9f7('0x20')](respondWithResult(_0x492d3f,null))['catch'](handleError(_0x492d3f,null));};exports[_0xa9f7('0x3e')]=function(_0x4d9cd2,_0x30e7b2){return db[_0xa9f7('0x25')][_0xa9f7('0x3e')](_0x4d9cd2[_0xa9f7('0x3f')],{})[_0xa9f7('0x20')](respondWithResult(_0x30e7b2,0xc9))[_0xa9f7('0x38')](handleError(_0x30e7b2,null));};exports[_0xa9f7('0x1f')]=function(_0x232371,_0x11e37d){if(_0x232371['body']['id']){delete _0x232371[_0xa9f7('0x3f')]['id'];}return db[_0xa9f7('0x25')][_0xa9f7('0x3d')]({'where':{'id':_0x232371['params']['id']}})[_0xa9f7('0x20')](handleEntityNotFound(_0x11e37d,null))[_0xa9f7('0x20')](saveUpdates(_0x232371[_0xa9f7('0x3f')],null))[_0xa9f7('0x20')](respondWithResult(_0x11e37d,null))[_0xa9f7('0x38')](handleError(_0x11e37d,null));};exports[_0xa9f7('0x40')]=function(_0xcb22ff,_0x2afcf5){return db[_0xa9f7('0x25')][_0xa9f7('0x3d')]({'where':{'id':_0xcb22ff[_0xa9f7('0x3a')]['id']}})['then'](handleEntityNotFound(_0x2afcf5,null))[_0xa9f7('0x20')](removeEntity(_0x2afcf5,null))[_0xa9f7('0x38')](handleError(_0x2afcf5,null));};exports[_0xa9f7('0x41')]=function(_0x56b86e,_0x121394){return db[_0xa9f7('0x25')][_0xa9f7('0x41')]()[_0xa9f7('0x20')](respondWithResult(_0x121394,null))[_0xa9f7('0x38')](handleError(_0x121394,null));}; \ No newline at end of file +var _0xef8b=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','status','index','map','fieldName','key','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','type','VIRTUAL','filter','options','JscriptyAnswerReport','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','length','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch'];(function(_0x50fefe,_0x5ac692){var _0x5fceeb=function(_0x4d078e){while(--_0x4d078e){_0x50fefe['push'](_0x50fefe['shift']());}};_0x5fceeb(++_0x5ac692);}(_0xef8b,0x192));var _0xbef8=function(_0x23a79e,_0x235f89){_0x23a79e=_0x23a79e-0x0;var _0x3dab57=_0xef8b[_0x23a79e];return _0x3dab57;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbef8('0x0'));var zipdir=require(_0xbef8('0x1'));var jsonpatch=require(_0xbef8('0x2'));var rp=require(_0xbef8('0x3'));var moment=require(_0xbef8('0x4'));var BPromise=require(_0xbef8('0x5'));var Mustache=require(_0xbef8('0x6'));var util=require(_0xbef8('0x7'));var path=require(_0xbef8('0x8'));var sox=require(_0xbef8('0x9'));var csv=require(_0xbef8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbef8('0xb'));var _=require(_0xbef8('0xc'));var squel=require(_0xbef8('0xd'));var crypto=require('crypto');var jsforce=require(_0xbef8('0xe'));var deskjs=require(_0xbef8('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbef8('0x10'));var authService=require(_0xbef8('0x11'));var qs=require(_0xbef8('0x12'));var as=require(_0xbef8('0x13'));var hardwareService=require(_0xbef8('0x14'));var logger=require(_0xbef8('0x15'))(_0xbef8('0x16'));var utils=require(_0xbef8('0x17'));var config=require(_0xbef8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbef8('0x19'))['db'];function respondWithStatusCode(_0x345393,_0x311cf5){_0x311cf5=_0x311cf5||0xcc;return function(_0x58b93f){if(_0x58b93f){return _0x345393['sendStatus'](_0x311cf5);}return _0x345393['status'](_0x311cf5)[_0xbef8('0x1a')]();};}function respondWithResult(_0x4924b6,_0x3074ca){_0x3074ca=_0x3074ca||0xc8;return function(_0x2ab1e0){if(_0x2ab1e0){return _0x4924b6['status'](_0x3074ca)[_0xbef8('0x1b')](_0x2ab1e0);}};}function respondWithFilteredResult(_0x542f03,_0x583ba8){return function(_0x2ec530){if(_0x2ec530){var _0x58ce7b=typeof _0x583ba8['offset']===_0xbef8('0x1c')&&typeof _0x583ba8[_0xbef8('0x1d')]===_0xbef8('0x1c');var _0x321ad0=_0x2ec530[_0xbef8('0x1e')];var _0x175891=_0x58ce7b?0x0:_0x583ba8['offset'];var _0x45b64b=_0x58ce7b?_0x2ec530[_0xbef8('0x1e')]:_0x583ba8['offset']+_0x583ba8[_0xbef8('0x1d')];var _0x46c92c;if(_0x45b64b>=_0x321ad0){_0x45b64b=_0x321ad0;_0x46c92c=0xc8;}else{_0x46c92c=0xce;}_0x542f03['status'](_0x46c92c);return _0x542f03[_0xbef8('0x1f')](_0xbef8('0x20'),_0x175891+'-'+_0x45b64b+'/'+_0x321ad0)[_0xbef8('0x1b')](_0x2ec530);}return null;};}function patchUpdates(_0x4e763a){return function(_0x5abdf1){try{jsonpatch[_0xbef8('0x21')](_0x5abdf1,_0x4e763a,!![]);}catch(_0x450de9){return BPromise[_0xbef8('0x22')](_0x450de9);}return _0x5abdf1[_0xbef8('0x23')]();};}function saveUpdates(_0x51540d,_0x54dfe4){return function(_0x34d494){if(_0x34d494){return _0x34d494[_0xbef8('0x24')](_0x51540d)[_0xbef8('0x25')](function(_0x2c426d){return _0x2c426d;});}return null;};}function removeEntity(_0x45755e,_0x5ce920){return function(_0x31cacf){if(_0x31cacf){return _0x31cacf[_0xbef8('0x26')]()[_0xbef8('0x25')](function(){_0x45755e['status'](0xcc)[_0xbef8('0x1a')]();});}};}function handleEntityNotFound(_0x573218,_0xe976a1){return function(_0x5d5f5a){if(!_0x5d5f5a){_0x573218[_0xbef8('0x27')](0x194);}return _0x5d5f5a;};}function handleError(_0x55aa51,_0x2af6df){_0x2af6df=_0x2af6df||0x1f4;return function(_0x566f16){logger[_0xbef8('0x28')](_0x566f16[_0xbef8('0x29')]);if(_0x566f16[_0xbef8('0x2a')]){delete _0x566f16[_0xbef8('0x2a')];}_0x55aa51[_0xbef8('0x2b')](_0x2af6df)['send'](_0x566f16);};}exports[_0xbef8('0x2c')]=function(_0x3b36f3,_0x2ba8ac){var _0x5a982e={},_0x14d651={},_0x1a501e={'count':0x0,'rows':[]};var _0x256e48=_[_0xbef8('0x2d')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x2ebe01){return{'name':_0x2ebe01[_0xbef8('0x2e')],'type':_0x2ebe01['type'][_0xbef8('0x2f')]};});_0x14d651['model']=_[_0xbef8('0x2d')](_0x256e48,'name');_0x14d651[_0xbef8('0x30')]=_[_0xbef8('0x31')](_0x3b36f3[_0xbef8('0x30')]);_0x14d651[_0xbef8('0x32')]=_['intersection'](_0x14d651[_0xbef8('0x33')],_0x14d651[_0xbef8('0x30')]);_0x5a982e[_0xbef8('0x34')]=_['intersection'](_0x14d651['model'],qs[_0xbef8('0x35')](_0x3b36f3[_0xbef8('0x30')][_0xbef8('0x35')]));_0x5a982e[_0xbef8('0x34')]=_0x5a982e['attributes']['length']?_0x5a982e[_0xbef8('0x34')]:_0x14d651[_0xbef8('0x33')];if(!_0x3b36f3[_0xbef8('0x30')][_0xbef8('0x36')](_0xbef8('0x37'))){_0x5a982e[_0xbef8('0x1d')]=qs['limit'](_0x3b36f3[_0xbef8('0x30')][_0xbef8('0x1d')]);_0x5a982e[_0xbef8('0x38')]=qs[_0xbef8('0x38')](_0x3b36f3[_0xbef8('0x30')][_0xbef8('0x38')]);}_0x5a982e[_0xbef8('0x39')]=qs[_0xbef8('0x3a')](_0x3b36f3[_0xbef8('0x30')][_0xbef8('0x3a')]);_0x5a982e[_0xbef8('0x3b')]=qs['filters'](_[_0xbef8('0x3c')](_0x3b36f3[_0xbef8('0x30')],_0x14d651['filters']),_0x256e48);if(_0x3b36f3['query']['filter']){_0x5a982e[_0xbef8('0x3b')]=_[_0xbef8('0x3d')](_0x5a982e['where'],{'$or':_[_0xbef8('0x2d')](_0x256e48,function(_0x4c5c16){if(_0x4c5c16[_0xbef8('0x3e')]!==_0xbef8('0x3f')){var _0x274793={};_0x274793[_0x4c5c16[_0xbef8('0x2a')]]={'$like':'%'+_0x3b36f3[_0xbef8('0x30')][_0xbef8('0x40')]+'%'};return _0x274793;}})});}_0x5a982e=_[_0xbef8('0x3d')]({},_0x5a982e,_0x3b36f3[_0xbef8('0x41')]);var _0x207f29={'where':_0x5a982e[_0xbef8('0x3b')]};return db[_0xbef8('0x42')][_0xbef8('0x1e')](_0x207f29)[_0xbef8('0x25')](function(_0x24ef3d){_0x1a501e[_0xbef8('0x1e')]=_0x24ef3d;if(_0x3b36f3[_0xbef8('0x30')][_0xbef8('0x43')]){_0x5a982e['include']=[{'all':!![]}];}return db[_0xbef8('0x42')][_0xbef8('0x44')](_0x5a982e);})['then'](function(_0x4c20ad){_0x1a501e[_0xbef8('0x45')]=_0x4c20ad;return _0x1a501e;})['then'](respondWithFilteredResult(_0x2ba8ac,_0x5a982e))[_0xbef8('0x46')](handleError(_0x2ba8ac,null));};exports[_0xbef8('0x47')]=function(_0x302e11,_0x3cb68f){var _0x480859={'raw':!![],'where':{'id':_0x302e11[_0xbef8('0x48')]['id']}},_0x296161={};_0x296161[_0xbef8('0x33')]=_[_0xbef8('0x31')](db[_0xbef8('0x42')][_0xbef8('0x49')]);_0x296161[_0xbef8('0x30')]=_[_0xbef8('0x31')](_0x302e11['query']);_0x296161[_0xbef8('0x32')]=_[_0xbef8('0x4a')](_0x296161[_0xbef8('0x33')],_0x296161[_0xbef8('0x30')]);_0x480859['attributes']=_[_0xbef8('0x4a')](_0x296161[_0xbef8('0x33')],qs[_0xbef8('0x35')](_0x302e11[_0xbef8('0x30')]['fields']));_0x480859[_0xbef8('0x34')]=_0x480859[_0xbef8('0x34')][_0xbef8('0x4b')]?_0x480859[_0xbef8('0x34')]:_0x296161['model'];if(_0x302e11['query'][_0xbef8('0x43')]){_0x480859[_0xbef8('0x4c')]=[{'all':!![]}];}_0x480859=_[_0xbef8('0x3d')]({},_0x480859,_0x302e11['options']);return db[_0xbef8('0x42')][_0xbef8('0x4d')](_0x480859)['then'](handleEntityNotFound(_0x3cb68f,null))[_0xbef8('0x25')](respondWithResult(_0x3cb68f,null))[_0xbef8('0x46')](handleError(_0x3cb68f,null));};exports[_0xbef8('0x4e')]=function(_0x1eae3f,_0x13e576){return db[_0xbef8('0x42')]['create'](_0x1eae3f[_0xbef8('0x4f')],{})[_0xbef8('0x25')](respondWithResult(_0x13e576,0xc9))['catch'](handleError(_0x13e576,null));};exports[_0xbef8('0x24')]=function(_0x2ba522,_0x4fcc66){if(_0x2ba522[_0xbef8('0x4f')]['id']){delete _0x2ba522[_0xbef8('0x4f')]['id'];}return db[_0xbef8('0x42')][_0xbef8('0x4d')]({'where':{'id':_0x2ba522[_0xbef8('0x48')]['id']}})[_0xbef8('0x25')](handleEntityNotFound(_0x4fcc66,null))[_0xbef8('0x25')](saveUpdates(_0x2ba522[_0xbef8('0x4f')],null))['then'](respondWithResult(_0x4fcc66,null))['catch'](handleError(_0x4fcc66,null));};exports[_0xbef8('0x26')]=function(_0x2739ef,_0x5e4662){return db[_0xbef8('0x42')][_0xbef8('0x4d')]({'where':{'id':_0x2739ef[_0xbef8('0x48')]['id']}})[_0xbef8('0x25')](handleEntityNotFound(_0x5e4662,null))[_0xbef8('0x25')](removeEntity(_0x5e4662,null))[_0xbef8('0x46')](handleError(_0x5e4662,null));};exports[_0xbef8('0x50')]=function(_0x7cd16f,_0xd54e68){return db[_0xbef8('0x42')][_0xbef8('0x50')]()[_0xbef8('0x25')](respondWithResult(_0xd54e68,null))[_0xbef8('0x46')](handleError(_0xd54e68,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 6a05d9b..86b55de 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 _0x024d=['rimraf','../../config/environment','exports','JscriptyAnswerReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x16ae37,_0x3773ff){var _0x63fa82=function(_0x3fcf63){while(--_0x3fcf63){_0x16ae37['push'](_0x16ae37['shift']());}};_0x63fa82(++_0x3773ff);}(_0x024d,0x1e4));var _0xd024=function(_0x56a467,_0x2855f8){_0x56a467=_0x56a467-0x0;var _0x29fe1a=_0x024d[_0x56a467];return _0x29fe1a;};'use strict';var _=require(_0xd024('0x0'));var util=require(_0xd024('0x1'));var logger=require(_0xd024('0x2'))(_0xd024('0x3'));var moment=require(_0xd024('0x4'));var BPromise=require(_0xd024('0x5'));var rp=require(_0xd024('0x6'));var fs=require('fs');var path=require(_0xd024('0x7'));var rimraf=require(_0xd024('0x8'));var config=require(_0xd024('0x9'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xd024('0xa')]=function(_0x12aee5,_0x5dae9d){return _0x12aee5['define'](_0xd024('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53d0=['path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','lodash','util','api','bluebird','request-promise'];(function(_0x254caa,_0x454b80){var _0x1f9aac=function(_0x1a8c87){while(--_0x1a8c87){_0x254caa['push'](_0x254caa['shift']());}};_0x1f9aac(++_0x454b80);}(_0x53d0,0x133));var _0x053d=function(_0x17dfc7,_0x3ec905){_0x17dfc7=_0x17dfc7-0x0;var _0x2e80a8=_0x53d0[_0x17dfc7];return _0x2e80a8;};'use strict';var _=require(_0x053d('0x0'));var util=require(_0x053d('0x1'));var logger=require('../../config/logger')(_0x053d('0x2'));var moment=require('moment');var BPromise=require(_0x053d('0x3'));var rp=require(_0x053d('0x4'));var fs=require('fs');var path=require(_0x053d('0x5'));var rimraf=require(_0x053d('0x6'));var config=require(_0x053d('0x7'));var attributes=require(_0x053d('0x8'));module[_0x053d('0x9')]=function(_0x518ca9,_0x74c598){return _0x518ca9[_0x053d('0xa')](_0x053d('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index fd03f46..081d110 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 _0x68a3=['JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3fdd87,_0x5703e1){var _0x167ce4=function(_0x4bcfc5){while(--_0x4bcfc5){_0x3fdd87['push'](_0x3fdd87['shift']());}};_0x167ce4(++_0x5703e1);}(_0x68a3,0x69));var _0x368a=function(_0x3998ff,_0x58f511){_0x3998ff=_0x3998ff-0x0;var _0xfd997d=_0x68a3[_0x3998ff];return _0xfd997d;};'use strict';var _=require(_0x368a('0x0'));var util=require('util');var moment=require(_0x368a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x368a('0x2'));var db=require(_0x368a('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x368a('0x4'));var config=require(_0x368a('0x5'));var jayson=require(_0x368a('0x6'));var client=jayson[_0x368a('0x7')][_0x368a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18ba31,_0x5b6831,_0x32f7e9){return new BPromise(function(_0x5b53e1,_0xbf1dfb){return client[_0x368a('0x9')](_0x18ba31,_0x32f7e9)[_0x368a('0xa')](function(_0x905ab4){logger[_0x368a('0xb')](_0x368a('0xc'),_0x5b6831,_0x368a('0xd'));logger[_0x368a('0xe')](_0x368a('0xf'),_0x5b6831,_0x368a('0xd'),JSON[_0x368a('0x10')](_0x905ab4));if(_0x905ab4[_0x368a('0x11')]){if(_0x905ab4['error']['code']===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x5b6831,_0x905ab4['error'][_0x368a('0x12')]);return _0xbf1dfb(_0x905ab4[_0x368a('0x11')][_0x368a('0x12')]);}logger['error'](_0x368a('0xc'),_0x5b6831,_0x905ab4[_0x368a('0x11')][_0x368a('0x12')]);return _0x5b53e1(_0x905ab4[_0x368a('0x11')][_0x368a('0x12')]);}else{logger[_0x368a('0xb')](_0x368a('0xc'),_0x5b6831,_0x368a('0xd'));_0x5b53e1(_0x905ab4['result'][_0x368a('0x12')]);}})[_0x368a('0x13')](function(_0x22295b){logger['error'](_0x368a('0xc'),_0x5b6831,_0x22295b);_0xbf1dfb(_0x22295b);});});} \ No newline at end of file +var _0x9f63=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x9f63,0x148));var _0x39f6=function(_0xb2a00c,_0x28f109){_0xb2a00c=_0xb2a00c-0x0;var _0x4c9545=_0x9f63[_0xb2a00c];return _0x4c9545;};'use strict';var _=require(_0x39f6('0x0'));var util=require(_0x39f6('0x1'));var moment=require(_0x39f6('0x2'));var BPromise=require(_0x39f6('0x3'));var rs=require(_0x39f6('0x4'));var fs=require('fs');var Redis=require(_0x39f6('0x5'));var db=require(_0x39f6('0x6'))['db'];var utils=require(_0x39f6('0x7'));var logger=require(_0x39f6('0x8'))('rpc');var config=require(_0x39f6('0x9'));var jayson=require(_0x39f6('0xa'));var client=jayson[_0x39f6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3bb7b1,_0x21f49e,_0x380f08){return new BPromise(function(_0x10778e,_0x47a603){return client[_0x39f6('0xc')](_0x3bb7b1,_0x380f08)[_0x39f6('0xd')](function(_0x4d8948){logger[_0x39f6('0xe')](_0x39f6('0xf'),_0x21f49e,_0x39f6('0x10'));logger[_0x39f6('0x11')](_0x39f6('0x12'),_0x21f49e,_0x39f6('0x10'),JSON['stringify'](_0x4d8948));if(_0x4d8948[_0x39f6('0x13')]){if(_0x4d8948[_0x39f6('0x13')][_0x39f6('0x14')]===0x1f4){logger['error'](_0x39f6('0xf'),_0x21f49e,_0x4d8948[_0x39f6('0x13')][_0x39f6('0x15')]);return _0x47a603(_0x4d8948[_0x39f6('0x13')]['message']);}logger[_0x39f6('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x21f49e,_0x4d8948[_0x39f6('0x13')][_0x39f6('0x15')]);return _0x10778e(_0x4d8948[_0x39f6('0x13')][_0x39f6('0x15')]);}else{logger[_0x39f6('0xe')](_0x39f6('0xf'),_0x21f49e,'request\x20sent');_0x10778e(_0x4d8948[_0x39f6('0x16')][_0x39f6('0x15')]);}})[_0x39f6('0x17')](function(_0x89df4e){logger[_0x39f6('0x13')](_0x39f6('0xf'),_0x21f49e,_0x89df4e);_0x47a603(_0x89df4e);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index aa7acf4..93f28f9 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 _0xfd20=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','show','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','clone','put','/:id','update','delete','destroy'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xfd20,0x19e));var _0x0fd2=function(_0x16c0a7,_0x1aa7ac){_0x16c0a7=_0x16c0a7-0x0;var _0x5e6020=_0xfd20[_0x16c0a7];return _0x5e6020;};'use strict';var multer=require(_0x0fd2('0x0'));var util=require(_0x0fd2('0x1'));var path=require(_0x0fd2('0x2'));var timeout=require(_0x0fd2('0x3'));var express=require(_0x0fd2('0x4'));var router=express['Router']();var fs_extra=require(_0x0fd2('0x5'));var auth=require(_0x0fd2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0fd2('0x7'));var controller=require('./jscriptyProject.controller');router[_0x0fd2('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x0fd2('0x9')](),controller[_0x0fd2('0xa')]);router[_0x0fd2('0x8')]('/:id/sessions',auth[_0x0fd2('0x9')](),controller[_0x0fd2('0xb')]);router[_0x0fd2('0x8')](_0x0fd2('0xc'),auth[_0x0fd2('0x9')](),controller[_0x0fd2('0xd')]);router[_0x0fd2('0x8')](_0x0fd2('0xe'),auth[_0x0fd2('0x9')](),timeout('30s'),controller[_0x0fd2('0xf')]);router['post']('/',auth[_0x0fd2('0x9')](),controller['create']);router[_0x0fd2('0x10')]('/:id/clone',auth['isAuthenticated'](),controller[_0x0fd2('0x11')]);router[_0x0fd2('0x12')](_0x0fd2('0x13'),auth[_0x0fd2('0x9')](),controller[_0x0fd2('0x14')]);router[_0x0fd2('0x15')](_0x0fd2('0x13'),auth[_0x0fd2('0x9')](),controller[_0x0fd2('0x16')]);module['exports']=router; \ No newline at end of file +var _0x1dfc=['Router','fs-extra','../../components/auth/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','getSessions','/:id/answers','getAnswers','/:id/summary','30s','create','post','/:id/clone','clone','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x2a18d8,_0x2ca77e){var _0xb71df8=function(_0x2d3ce9){while(--_0x2d3ce9){_0x2a18d8['push'](_0x2a18d8['shift']());}};_0xb71df8(++_0x2ca77e);}(_0x1dfc,0x1c6));var _0xc1df=function(_0x37c753,_0x509721){_0x37c753=_0x37c753-0x0;var _0x4c881b=_0x1dfc[_0x37c753];return _0x4c881b;};'use strict';var multer=require(_0xc1df('0x0'));var util=require(_0xc1df('0x1'));var path=require(_0xc1df('0x2'));var timeout=require(_0xc1df('0x3'));var express=require(_0xc1df('0x4'));var router=express[_0xc1df('0x5')]();var fs_extra=require(_0xc1df('0x6'));var auth=require(_0xc1df('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc1df('0x8'));router[_0xc1df('0x9')]('/',auth[_0xc1df('0xa')](),controller[_0xc1df('0xb')]);router[_0xc1df('0x9')](_0xc1df('0xc'),auth[_0xc1df('0xa')](),controller[_0xc1df('0xd')]);router[_0xc1df('0x9')]('/:id/sessions',auth[_0xc1df('0xa')](),controller[_0xc1df('0xe')]);router['get'](_0xc1df('0xf'),auth[_0xc1df('0xa')](),controller[_0xc1df('0x10')]);router['get'](_0xc1df('0x11'),auth[_0xc1df('0xa')](),timeout(_0xc1df('0x12')),controller['getSummary']);router['post']('/',auth[_0xc1df('0xa')](),controller[_0xc1df('0x13')]);router[_0xc1df('0x14')](_0xc1df('0x15'),auth[_0xc1df('0xa')](),controller[_0xc1df('0x16')]);router[_0xc1df('0x17')](_0xc1df('0xc'),auth[_0xc1df('0xa')](),controller[_0xc1df('0x18')]);router[_0xc1df('0x19')](_0xc1df('0xc'),auth[_0xc1df('0xa')](),controller[_0xc1df('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index fb124be..fda2b7b 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 _0xba28=['description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','long','isObjectLike','formData','stringify','isString','setDataValue','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0xade0ba,_0x880ee6){var _0x5a9cf4=function(_0x134e8a){while(--_0x134e8a){_0xade0ba['push'](_0xade0ba['shift']());}};_0x5a9cf4(++_0x880ee6);}(_0xba28,0xb2));var _0x8ba2=function(_0xd511d,_0x3546b9){_0xd511d=_0xd511d-0x0;var _0x3f148e=_0xba28[_0xd511d];return _0x3f148e;};'use strict';var Sequelize=require(_0x8ba2('0x0'));var _=require(_0x8ba2('0x1'));var util=require(_0x8ba2('0x2'));module[_0x8ba2('0x3')]={'name':{'type':Sequelize[_0x8ba2('0x4')],'unique':_0x8ba2('0x5')},'description':{'type':Sequelize[_0x8ba2('0x4')]},'formData':{'type':Sequelize['TEXT'](_0x8ba2('0x6')),'set':function(_0x4d40b5){if(_[_0x8ba2('0x7')](_0x4d40b5)){this['setDataValue'](_0x8ba2('0x8'),JSON[_0x8ba2('0x9')](_0x4d40b5));}else if(_[_0x8ba2('0xa')](_0x4d40b5)){this[_0x8ba2('0xb')](_0x8ba2('0x8'),_0x4d40b5);}else{this[_0x8ba2('0xb')](_0x8ba2('0x8'),util['format'](_0x8ba2('0xc'),this[_0x8ba2('0xd')]('name')||'',this[_0x8ba2('0xd')](_0x8ba2('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x8ba2('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x8ba2('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0xc656=['util','STRING','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description','BOOLEAN','sequelize','lodash'];(function(_0x20a12e,_0x2c0446){var _0x29bca3=function(_0x1edda5){while(--_0x1edda5){_0x20a12e['push'](_0x20a12e['shift']());}};_0x29bca3(++_0x2c0446);}(_0xc656,0x14e));var _0x6c65=function(_0x316130,_0x24a3d7){_0x316130=_0x316130-0x0;var _0x3c1040=_0xc656[_0x316130];return _0x3c1040;};'use strict';var Sequelize=require(_0x6c65('0x0'));var _=require(_0x6c65('0x1'));var util=require(_0x6c65('0x2'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x6c65('0x3')]},'formData':{'type':Sequelize['TEXT'](_0x6c65('0x4')),'set':function(_0x37179f){if(_[_0x6c65('0x5')](_0x37179f)){this[_0x6c65('0x6')](_0x6c65('0x7'),JSON[_0x6c65('0x8')](_0x37179f));}else if(_[_0x6c65('0x9')](_0x37179f)){this[_0x6c65('0x6')](_0x6c65('0x7'),_0x37179f);}else{this[_0x6c65('0x6')](_0x6c65('0x7'),util[_0x6c65('0xa')](_0x6c65('0xb'),this[_0x6c65('0xc')](_0x6c65('0xd'))||'',this['getDataValue'](_0x6c65('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x6c65('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x6c65('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 42708db..d22a7c6 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 _0xd1f1=['/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','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Projects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','findAll','getAnswers','JscriptyAnswerReport','order','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync'];(function(_0x573cdd,_0x4bb110){var _0x583c2b=function(_0x4199fa){while(--_0x4199fa){_0x573cdd['push'](_0x573cdd['shift']());}};_0x583c2b(++_0x4bb110);}(_0xd1f1,0x84));var _0x1d1f=function(_0x2795dd,_0x157893){_0x2795dd=_0x2795dd-0x0;var _0x30f875=_0xd1f1[_0x2795dd];return _0x30f875;};'use strict';var emlformat=require(_0x1d1f('0x0'));var rimraf=require(_0x1d1f('0x1'));var zipdir=require(_0x1d1f('0x2'));var jsonpatch=require(_0x1d1f('0x3'));var rp=require(_0x1d1f('0x4'));var moment=require('moment');var BPromise=require(_0x1d1f('0x5'));var Mustache=require(_0x1d1f('0x6'));var util=require(_0x1d1f('0x7'));var path=require('path');var sox=require(_0x1d1f('0x8'));var csv=require(_0x1d1f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d1f('0xa'));var _=require('lodash');var squel=require(_0x1d1f('0xb'));var crypto=require(_0x1d1f('0xc'));var jsforce=require(_0x1d1f('0xd'));var deskjs=require(_0x1d1f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1d1f('0xf'));var authService=require(_0x1d1f('0x10'));var qs=require(_0x1d1f('0x11'));var as=require(_0x1d1f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d1f('0x13'))(_0x1d1f('0x14'));var utils=require(_0x1d1f('0x15'));var config=require(_0x1d1f('0x16'));var licenseUtil=require(_0x1d1f('0x17'));var db=require(_0x1d1f('0x18'))['db'];function respondWithStatusCode(_0x4ce793,_0x4c92c1){_0x4c92c1=_0x4c92c1||0xcc;return function(_0x48e2c0){if(_0x48e2c0){return _0x4ce793[_0x1d1f('0x19')](_0x4c92c1);}return _0x4ce793[_0x1d1f('0x1a')](_0x4c92c1)[_0x1d1f('0x1b')]();};}function respondWithResult(_0x2b156d,_0x43e323){_0x43e323=_0x43e323||0xc8;return function(_0x465f20){if(_0x465f20){return _0x2b156d[_0x1d1f('0x1a')](_0x43e323)[_0x1d1f('0x1c')](_0x465f20);}};}function respondWithFilteredResult(_0xfbadad,_0x37af18){return function(_0x2ec931){if(_0x2ec931){var _0x397f74=typeof _0x37af18[_0x1d1f('0x1d')]==='undefined'&&typeof _0x37af18[_0x1d1f('0x1e')]===_0x1d1f('0x1f');var _0x19eb5a=_0x2ec931[_0x1d1f('0x20')];var _0x32b911=_0x397f74?0x0:_0x37af18[_0x1d1f('0x1d')];var _0x336104=_0x397f74?_0x2ec931[_0x1d1f('0x20')]:_0x37af18[_0x1d1f('0x1d')]+_0x37af18[_0x1d1f('0x1e')];var _0x8bfdfd;if(_0x336104>=_0x19eb5a){_0x336104=_0x19eb5a;_0x8bfdfd=0xc8;}else{_0x8bfdfd=0xce;}_0xfbadad[_0x1d1f('0x1a')](_0x8bfdfd);return _0xfbadad[_0x1d1f('0x21')](_0x1d1f('0x22'),_0x32b911+'-'+_0x336104+'/'+_0x19eb5a)[_0x1d1f('0x1c')](_0x2ec931);}return null;};}function patchUpdates(_0x413c87){return function(_0x2dac03){try{jsonpatch[_0x1d1f('0x23')](_0x2dac03,_0x413c87,!![]);}catch(_0x10ba0d){return BPromise['reject'](_0x10ba0d);}return _0x2dac03[_0x1d1f('0x24')]();};}function saveUpdates(_0x2ca72d,_0x4f1947){return function(_0x18f05b){if(_0x18f05b){return _0x18f05b[_0x1d1f('0x25')](_0x2ca72d)[_0x1d1f('0x26')](function(_0x2a6c09){return _0x2a6c09;});}return null;};}function removeEntity(_0xbd591a,_0x45cd59){return function(_0x5aae81){if(_0x5aae81){return _0x5aae81[_0x1d1f('0x27')]()[_0x1d1f('0x26')](function(){var _0x3e8139=_0x5aae81[_0x1d1f('0x28')]({'plain':!![]});var _0x39313f='Projects';return db[_0x1d1f('0x29')][_0x1d1f('0x27')]({'where':{'type':_0x39313f,'resourceId':_0x3e8139['id']}})['then'](function(){return _0x5aae81;});})['then'](function(){_0xbd591a[_0x1d1f('0x1a')](0xcc)[_0x1d1f('0x1b')]();});}};}function handleEntityNotFound(_0x41bd80,_0x32c5c0){return function(_0x48f73b){if(!_0x48f73b){_0x41bd80['sendStatus'](0x194);}return _0x48f73b;};}function handleError(_0x398108,_0x3a6e0b){_0x3a6e0b=_0x3a6e0b||0x1f4;return function(_0x2b99e3){logger[_0x1d1f('0x2a')](_0x2b99e3[_0x1d1f('0x2b')]);if(_0x2b99e3[_0x1d1f('0x2c')]){delete _0x2b99e3['name'];}_0x398108['status'](_0x3a6e0b)['send'](_0x2b99e3);};}exports[_0x1d1f('0x2d')]=function(_0x2c49bf,_0x3d3601){var _0x4dcdd2={},_0x2e0192={},_0x3fa644={'count':0x0,'rows':[]};var _0x51b2bb=_[_0x1d1f('0x2e')](db[_0x1d1f('0x2f')][_0x1d1f('0x30')],function(_0x44d022){return{'name':_0x44d022[_0x1d1f('0x31')],'type':_0x44d022[_0x1d1f('0x32')][_0x1d1f('0x33')]};});_0x2e0192[_0x1d1f('0x34')]=_[_0x1d1f('0x2e')](_0x51b2bb,_0x1d1f('0x2c'));_0x2e0192[_0x1d1f('0x35')]=_[_0x1d1f('0x36')](_0x2c49bf[_0x1d1f('0x35')]);_0x2e0192[_0x1d1f('0x37')]=_[_0x1d1f('0x38')](_0x2e0192[_0x1d1f('0x34')],_0x2e0192[_0x1d1f('0x35')]);_0x4dcdd2[_0x1d1f('0x39')]=_[_0x1d1f('0x38')](_0x2e0192[_0x1d1f('0x34')],qs[_0x1d1f('0x3a')](_0x2c49bf[_0x1d1f('0x35')][_0x1d1f('0x3a')]));_0x4dcdd2['attributes']=_0x4dcdd2[_0x1d1f('0x39')][_0x1d1f('0x3b')]?_0x4dcdd2[_0x1d1f('0x39')]:_0x2e0192[_0x1d1f('0x34')];if(!_0x2c49bf['query']['hasOwnProperty'](_0x1d1f('0x3c'))){_0x4dcdd2[_0x1d1f('0x1e')]=qs[_0x1d1f('0x1e')](_0x2c49bf[_0x1d1f('0x35')][_0x1d1f('0x1e')]);_0x4dcdd2[_0x1d1f('0x1d')]=qs['offset'](_0x2c49bf[_0x1d1f('0x35')]['offset']);}_0x4dcdd2['order']=qs[_0x1d1f('0x3d')](_0x2c49bf[_0x1d1f('0x35')]['sort']);_0x4dcdd2[_0x1d1f('0x3e')]=qs[_0x1d1f('0x37')](_[_0x1d1f('0x3f')](_0x2c49bf['query'],_0x2e0192[_0x1d1f('0x37')]),_0x51b2bb);if(_0x2c49bf['query'][_0x1d1f('0x40')]){_0x4dcdd2['where']=_[_0x1d1f('0x41')](_0x4dcdd2[_0x1d1f('0x3e')],{'$or':_['map'](_0x51b2bb,function(_0x24ae7a){if(_0x24ae7a[_0x1d1f('0x32')]!==_0x1d1f('0x42')){var _0x63bf93={};_0x63bf93[_0x24ae7a[_0x1d1f('0x2c')]]={'$like':'%'+_0x2c49bf[_0x1d1f('0x35')][_0x1d1f('0x40')]+'%'};return _0x63bf93;}})});}_0x4dcdd2=_['merge']({},_0x4dcdd2,_0x2c49bf[_0x1d1f('0x43')]);var _0x34f34e={'where':_0x4dcdd2[_0x1d1f('0x3e')]};return db['JscriptyProject']['count'](_0x34f34e)[_0x1d1f('0x26')](function(_0x23fb9e){_0x3fa644[_0x1d1f('0x20')]=_0x23fb9e;if(_0x2c49bf['query'][_0x1d1f('0x44')]){_0x4dcdd2[_0x1d1f('0x45')]=[{'all':!![]}];}return db[_0x1d1f('0x2f')]['findAll'](_0x4dcdd2);})[_0x1d1f('0x26')](function(_0x208c9c){_0x3fa644[_0x1d1f('0x46')]=_0x208c9c;return _0x3fa644;})[_0x1d1f('0x26')](respondWithFilteredResult(_0x3d3601,_0x4dcdd2))[_0x1d1f('0x47')](handleError(_0x3d3601,null));};exports[_0x1d1f('0x48')]=function(_0x13cb86,_0x1844dc){var _0x258f71={'raw':![],'where':{'id':_0x13cb86[_0x1d1f('0x49')]['id']}},_0x23fba3={};_0x23fba3[_0x1d1f('0x34')]=_[_0x1d1f('0x36')](db[_0x1d1f('0x2f')][_0x1d1f('0x30')]);_0x23fba3['query']=_[_0x1d1f('0x36')](_0x13cb86[_0x1d1f('0x35')]);_0x23fba3['filters']=_[_0x1d1f('0x38')](_0x23fba3[_0x1d1f('0x34')],_0x23fba3['query']);_0x258f71[_0x1d1f('0x39')]=_[_0x1d1f('0x38')](_0x23fba3[_0x1d1f('0x34')],qs[_0x1d1f('0x3a')](_0x13cb86[_0x1d1f('0x35')][_0x1d1f('0x3a')]));_0x258f71[_0x1d1f('0x39')]=_0x258f71[_0x1d1f('0x39')][_0x1d1f('0x3b')]?_0x258f71['attributes']:_0x23fba3[_0x1d1f('0x34')];if(_0x13cb86['query']['includeAll']){_0x258f71[_0x1d1f('0x45')]=[{'all':!![]}];}_0x258f71=_['merge']({},_0x258f71,_0x13cb86['options']);return db[_0x1d1f('0x2f')][_0x1d1f('0x4a')](_0x258f71)[_0x1d1f('0x26')](handleEntityNotFound(_0x1844dc,null))[_0x1d1f('0x26')](respondWithResult(_0x1844dc,null))['catch'](handleError(_0x1844dc,null));};exports[_0x1d1f('0x4b')]=function(_0x4d3216,_0x44a2db){return db[_0x1d1f('0x2f')]['create'](_0x4d3216[_0x1d1f('0x4c')],{})[_0x1d1f('0x26')](function(_0x3cd97f){var _0x2a598b=_0x4d3216['user'][_0x1d1f('0x28')]({'plain':!![]});if(!_0x2a598b)throw new Error(_0x1d1f('0x4d'));if(_0x2a598b[_0x1d1f('0x4e')]===_0x1d1f('0x4f')){var _0x1193fc=_0x3cd97f['get']({'plain':!![]});var _0x246068=_0x1d1f('0x50');return db[_0x1d1f('0x51')][_0x1d1f('0x4a')]({'where':{'name':_0x246068,'userProfileId':_0x2a598b[_0x1d1f('0x52')]},'raw':!![]})['then'](function(_0x205187){if(_0x205187&&_0x205187[_0x1d1f('0x53')]===0x0){return db[_0x1d1f('0x29')][_0x1d1f('0x4b')]({'name':_0x1193fc[_0x1d1f('0x2c')],'resourceId':_0x1193fc['id'],'type':_0x205187[_0x1d1f('0x2c')],'sectionId':_0x205187['id']},{})[_0x1d1f('0x26')](function(){return _0x3cd97f;});}else{return _0x3cd97f;}})[_0x1d1f('0x47')](function(_0x53c86c){logger[_0x1d1f('0x2a')](_0x1d1f('0x54'),_0x53c86c);throw _0x53c86c;});}return _0x3cd97f;})['then'](respondWithResult(_0x44a2db,0xc9))[_0x1d1f('0x47')](handleError(_0x44a2db,null));};exports[_0x1d1f('0x55')]=function(_0x2199d2,_0x169294){var _0x3a85c7={'where':{'id':_0x2199d2[_0x1d1f('0x49')]['id']}},_0x26760b={};_0x26760b[_0x1d1f('0x34')]=_[_0x1d1f('0x36')](db['JscriptyProject'][_0x1d1f('0x30')]);_0x3a85c7[_0x1d1f('0x39')]=_[_0x1d1f('0x38')](_0x26760b[_0x1d1f('0x34')],qs[_0x1d1f('0x3a')](_0x2199d2[_0x1d1f('0x35')][_0x1d1f('0x3a')]));_0x3a85c7[_0x1d1f('0x39')]=_0x3a85c7[_0x1d1f('0x39')][_0x1d1f('0x3b')]?_0x3a85c7[_0x1d1f('0x39')]:_0x26760b[_0x1d1f('0x34')];if(_0x2199d2[_0x1d1f('0x35')]['includeAll']){_0x3a85c7[_0x1d1f('0x45')]=[{'all':!![]}];}_0x3a85c7=_['merge']({},_0x3a85c7,_0x2199d2[_0x1d1f('0x43')]);return db['JscriptyProject'][_0x1d1f('0x4a')](_0x3a85c7)[_0x1d1f('0x26')](handleEntityNotFound(_0x169294,null))[_0x1d1f('0x26')](function(_0x41f0e5){if(_0x41f0e5){var _0x5c94db=_0x41f0e5[_0x1d1f('0x28')]({'plain':!![]});_0x5c94db=qs[_0x1d1f('0x56')](_0x5c94db,['id',_0x1d1f('0x57'),_0x1d1f('0x58')]);_0x2199d2[_0x1d1f('0x4c')]=_[_0x1d1f('0x56')](_0x2199d2[_0x1d1f('0x4c')],['id',_0x1d1f('0x57'),'updatedAt']);return db[_0x1d1f('0x2f')][_0x1d1f('0x4b')](_[_0x1d1f('0x41')](_0x5c94db,_0x2199d2['body']),{'include':_0x2199d2['query'][_0x1d1f('0x44')]?[{'all':!![]}]:undefined})[_0x1d1f('0x26')](function(_0x1c5cdf){var _0x2d4612=_0x2199d2[_0x1d1f('0x4f')][_0x1d1f('0x28')]({'plain':!![]});if(!_0x2d4612)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d4612[_0x1d1f('0x4e')]===_0x1d1f('0x4f')){var _0x1e8b4c=_0x1c5cdf['get']({'plain':!![]});var _0x4675e3='Projects';return db['UserProfileSection'][_0x1d1f('0x4a')]({'where':{'name':_0x4675e3,'userProfileId':_0x2d4612[_0x1d1f('0x52')]},'raw':!![]})[_0x1d1f('0x26')](function(_0x3d13c5){if(_0x3d13c5&&_0x3d13c5['autoAssociation']===0x0){return db[_0x1d1f('0x29')][_0x1d1f('0x4b')]({'name':_0x1e8b4c['name'],'resourceId':_0x1e8b4c['id'],'type':_0x3d13c5[_0x1d1f('0x2c')],'sectionId':_0x3d13c5['id']},{})['then'](function(){return _0x1c5cdf;});}else{return _0x1c5cdf;}})[_0x1d1f('0x47')](function(_0x303c7e){logger[_0x1d1f('0x2a')](_0x1d1f('0x54'),_0x303c7e);throw _0x303c7e;});}return _0x1c5cdf;});}})[_0x1d1f('0x26')](respondWithResult(_0x169294,0xc9))[_0x1d1f('0x47')](handleError(_0x169294,null));};exports[_0x1d1f('0x25')]=function(_0x2406f5,_0x339cc8){if(_0x2406f5[_0x1d1f('0x4c')]['id']){delete _0x2406f5[_0x1d1f('0x4c')]['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x2406f5[_0x1d1f('0x49')]['id']}})[_0x1d1f('0x26')](handleEntityNotFound(_0x339cc8,null))['then'](saveUpdates(_0x2406f5[_0x1d1f('0x4c')],null))[_0x1d1f('0x26')](respondWithResult(_0x339cc8,null))[_0x1d1f('0x47')](handleError(_0x339cc8,null));};exports[_0x1d1f('0x27')]=function(_0x4f1e03,_0x35dd28){return db[_0x1d1f('0x2f')][_0x1d1f('0x4a')]({'where':{'id':_0x4f1e03[_0x1d1f('0x49')]['id']}})[_0x1d1f('0x26')](handleEntityNotFound(_0x35dd28,null))[_0x1d1f('0x26')](removeEntity(_0x35dd28,null))[_0x1d1f('0x47')](handleError(_0x35dd28,null));};exports['getSessions']=function(_0x3127a7,_0x1dcc08,_0xe9566e){var _0x1a9b53={'raw':!![],'where':{}};var _0x4b0fa5={};var _0x5b400f={'count':0x0,'rows':[]};return db[_0x1d1f('0x2f')][_0x1d1f('0x59')]({'where':{'id':_0x3127a7[_0x1d1f('0x49')]['id']}})[_0x1d1f('0x26')](handleEntityNotFound(_0x1dcc08,null))[_0x1d1f('0x26')](function(_0x38f1a8){if(_0x38f1a8){_0x4b0fa5[_0x1d1f('0x34')]=_[_0x1d1f('0x36')](db[_0x1d1f('0x5a')][_0x1d1f('0x30')]);_0x4b0fa5[_0x1d1f('0x35')]=_['keys'](_0x3127a7['query']);_0x4b0fa5[_0x1d1f('0x37')]=_[_0x1d1f('0x38')](_0x4b0fa5[_0x1d1f('0x34')],_0x4b0fa5[_0x1d1f('0x35')]);_0x1a9b53['attributes']=_[_0x1d1f('0x38')](_0x4b0fa5[_0x1d1f('0x34')],qs[_0x1d1f('0x3a')](_0x3127a7[_0x1d1f('0x35')]['fields']));_0x1a9b53[_0x1d1f('0x39')]=_0x1a9b53[_0x1d1f('0x39')][_0x1d1f('0x3b')]?_0x1a9b53[_0x1d1f('0x39')]:_0x4b0fa5[_0x1d1f('0x34')];if(!_0x3127a7[_0x1d1f('0x35')][_0x1d1f('0x5b')](_0x1d1f('0x3c'))){_0x1a9b53[_0x1d1f('0x1e')]=qs[_0x1d1f('0x1e')](_0x3127a7[_0x1d1f('0x35')][_0x1d1f('0x1e')]);_0x1a9b53['offset']=qs['offset'](_0x3127a7['query'][_0x1d1f('0x1d')]);}_0x1a9b53['order']=qs[_0x1d1f('0x3d')](_0x3127a7['query']['sort']);_0x1a9b53[_0x1d1f('0x3e')]=qs[_0x1d1f('0x37')](_[_0x1d1f('0x3f')](_0x3127a7[_0x1d1f('0x35')],_0x4b0fa5[_0x1d1f('0x37')]));_0x1a9b53[_0x1d1f('0x3e')][_0x1d1f('0x5c')]=_0x38f1a8['id'];if(_0x3127a7[_0x1d1f('0x35')][_0x1d1f('0x40')]){_0x1a9b53[_0x1d1f('0x3e')]=_['merge'](_0x1a9b53[_0x1d1f('0x3e')],{'$or':_[_0x1d1f('0x2e')](_0x1a9b53['attributes'],function(_0x530963){var _0x154e8f={};_0x154e8f[_0x530963]={'$like':'%'+_0x3127a7[_0x1d1f('0x35')][_0x1d1f('0x40')]+'%'};return _0x154e8f;})});}_0x1a9b53=_[_0x1d1f('0x41')]({},_0x1a9b53,_0x3127a7[_0x1d1f('0x43')]);return db[_0x1d1f('0x5a')][_0x1d1f('0x20')]({'where':_0x1a9b53[_0x1d1f('0x3e')]})[_0x1d1f('0x26')](function(_0x10b766){_0x5b400f[_0x1d1f('0x20')]=_0x10b766;if(_0x3127a7['query'][_0x1d1f('0x44')]){_0x1a9b53[_0x1d1f('0x45')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x1d1f('0x5d')](_0x1a9b53);})[_0x1d1f('0x26')](function(_0x54743f){_0x5b400f[_0x1d1f('0x46')]=_0x54743f;return _0x5b400f;});}})['then'](respondWithFilteredResult(_0x1dcc08,_0x1a9b53))[_0x1d1f('0x47')](handleError(_0x1dcc08,null));};exports[_0x1d1f('0x5e')]=function(_0x4eff47,_0x45866a,_0x353165){var _0x343fdd={'raw':!![],'where':{}};var _0x9b29d5={};var _0x3cc45c={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x1d1f('0x59')]({'where':{'id':_0x4eff47[_0x1d1f('0x49')]['id']}})['then'](handleEntityNotFound(_0x45866a,null))['then'](function(_0x1fec96){if(_0x1fec96){_0x9b29d5['model']=_[_0x1d1f('0x36')](db[_0x1d1f('0x5f')][_0x1d1f('0x30')]);_0x9b29d5[_0x1d1f('0x35')]=_[_0x1d1f('0x36')](_0x4eff47[_0x1d1f('0x35')]);_0x9b29d5['filters']=_[_0x1d1f('0x38')](_0x9b29d5[_0x1d1f('0x34')],_0x9b29d5['query']);_0x343fdd[_0x1d1f('0x39')]=_['intersection'](_0x9b29d5[_0x1d1f('0x34')],qs[_0x1d1f('0x3a')](_0x4eff47[_0x1d1f('0x35')][_0x1d1f('0x3a')]));_0x343fdd['attributes']=_0x343fdd[_0x1d1f('0x39')][_0x1d1f('0x3b')]?_0x343fdd['attributes']:_0x9b29d5[_0x1d1f('0x34')];if(!_0x4eff47['query'][_0x1d1f('0x5b')]('nolimit')){_0x343fdd[_0x1d1f('0x1e')]=qs[_0x1d1f('0x1e')](_0x4eff47['query'][_0x1d1f('0x1e')]);_0x343fdd[_0x1d1f('0x1d')]=qs[_0x1d1f('0x1d')](_0x4eff47[_0x1d1f('0x35')]['offset']);}_0x343fdd[_0x1d1f('0x60')]=qs[_0x1d1f('0x3d')](_0x4eff47[_0x1d1f('0x35')][_0x1d1f('0x3d')]);_0x343fdd[_0x1d1f('0x3e')]=qs[_0x1d1f('0x37')](_[_0x1d1f('0x3f')](_0x4eff47[_0x1d1f('0x35')],_0x9b29d5[_0x1d1f('0x37')]));_0x343fdd[_0x1d1f('0x3e')]['ProjectId']=_0x1fec96['id'];if(_0x4eff47[_0x1d1f('0x35')][_0x1d1f('0x40')]){_0x343fdd[_0x1d1f('0x3e')]=_[_0x1d1f('0x41')](_0x343fdd[_0x1d1f('0x3e')],{'$or':_[_0x1d1f('0x2e')](_0x343fdd[_0x1d1f('0x39')],function(_0x5091fa){var _0x1f8f1a={};_0x1f8f1a[_0x5091fa]={'$like':'%'+_0x4eff47[_0x1d1f('0x35')][_0x1d1f('0x40')]+'%'};return _0x1f8f1a;})});}_0x343fdd=_[_0x1d1f('0x41')]({},_0x343fdd,_0x4eff47['options']);return db[_0x1d1f('0x5f')][_0x1d1f('0x20')]({'where':_0x343fdd[_0x1d1f('0x3e')]})[_0x1d1f('0x26')](function(_0x18f828){_0x3cc45c[_0x1d1f('0x20')]=_0x18f828;if(_0x4eff47[_0x1d1f('0x35')][_0x1d1f('0x44')]){_0x343fdd[_0x1d1f('0x45')]=[{'all':!![]}];}return db[_0x1d1f('0x5f')][_0x1d1f('0x5d')](_0x343fdd);})[_0x1d1f('0x26')](function(_0x11409c){_0x3cc45c[_0x1d1f('0x46')]=_0x11409c;return _0x3cc45c;});}})[_0x1d1f('0x26')](respondWithFilteredResult(_0x45866a,_0x343fdd))[_0x1d1f('0x47')](handleError(_0x45866a,null));};function char(_0x20b8f7){return _0x1d1f('0x61')===typeof _0x20b8f7?String[_0x1d1f('0x62')][_0x1d1f('0x23')](null,arguments):_0x20b8f7;}function needsEncapsulation(_0x47b6a2){return!!_0x47b6a2&&(_0x47b6a2[_0x1d1f('0x63')]()['indexOf'](char(0xd))>=0x0||_0x47b6a2[_0x1d1f('0x63')]()[_0x1d1f('0x64')](char(0xa))>=0x0||_0x47b6a2[_0x1d1f('0x63')]()[_0x1d1f('0x64')](char(0x2c))>=0x0||_0x47b6a2[_0x1d1f('0x63')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x7fcca){var _0x1ef1b6=char(0x22),_0x55e526='\x5c'+char(0x22),_0xc43209=_0x7fcca[_0x1d1f('0x63')]()[_0x1d1f('0x65')](new RegExp(_0x1ef1b6,'g'),_0x55e526);return _0x1ef1b6+_0xc43209+_0x1ef1b6;}exports[_0x1d1f('0x66')]=function(_0x30d302,_0x19e45e,_0x2a25a4){var _0x33fd37,_0x12e2e4;var _0x9fecb8={'where':{'ProjectId':_0x30d302[_0x1d1f('0x49')]['id']}};if(_0x30d302[_0x1d1f('0x35')][_0x1d1f('0x67')]){_0x9fecb8[_0x1d1f('0x3e')][_0x1d1f('0x68')]=JSON[_0x1d1f('0x69')](_0x30d302[_0x1d1f('0x35')][_0x1d1f('0x67')]);}return db[_0x1d1f('0x5a')]['findAll'](_0x9fecb8)[_0x1d1f('0x26')](handleEntityNotFound(_0x19e45e,null))[_0x1d1f('0x26')](function(_0x551f5c){if(_0x551f5c){_0x33fd37=_0x551f5c;return db[_0x1d1f('0x6a')][_0x1d1f('0x5d')]({'where':{'SessionId':{'$in':_['map'](_0x33fd37,'id')},'ProjectId':_0x30d302[_0x1d1f('0x49')]['id']},'order':'-createdAt'});}})[_0x1d1f('0x26')](handleEntityNotFound(_0x19e45e,null))[_0x1d1f('0x26')](function(_0x40c396){if(_0x40c396){_0x12e2e4=_0x40c396;var _0x93dbce={};for(var _0x4a8673=0x0,_0x5a9f44=_0x12e2e4[_0x1d1f('0x3b')];_0x4a8673<_0x5a9f44;_0x4a8673++){if(!_0x93dbce[_0x1d1f('0x5b')](_0x12e2e4[_0x4a8673][_0x1d1f('0x6b')])){_0x93dbce[_0x12e2e4[_0x4a8673][_0x1d1f('0x6b')]]=needsEncapsulation(_0x12e2e4[_0x4a8673]['question'])?encapsulate(_0x12e2e4[_0x4a8673][_0x1d1f('0x6c')]):_0x12e2e4[_0x4a8673][_0x1d1f('0x6c')];}}var _0x27ed44=[],_0x5ac723={};for(var _0x32cf9e=0x0,_0xa88a79=_0x33fd37[_0x1d1f('0x3b')];_0x32cf9e<_0xa88a79;_0x32cf9e++){_0x5ac723={'ProjectId':_0x30d302[_0x1d1f('0x49')]['id'],'SessionId':_0x33fd37[_0x32cf9e]['id'],'StartTime':moment(_0x33fd37[_0x32cf9e][_0x1d1f('0x68')])[_0x1d1f('0x6d')](_0x1d1f('0x6e'))};for(var _0x52db96=0x0,_0x1b3da9=_0x12e2e4[_0x1d1f('0x3b')];_0x52db96<_0x1b3da9;_0x52db96++){if(_0x12e2e4[_0x52db96]['SessionId']==_0x33fd37[_0x32cf9e]['id']&&_0x93dbce[_0x1d1f('0x5b')](_0x12e2e4[_0x52db96][_0x1d1f('0x6b')])){_0x5ac723[_0x93dbce[_0x12e2e4[_0x52db96][_0x1d1f('0x6b')]]]=_0x12e2e4[_0x52db96][_0x1d1f('0x6f')];}}for(var _0x2c41bb in _0x93dbce){if(!_0x5ac723['hasOwnProperty'](_0x93dbce[_0x2c41bb])){_0x5ac723[_0x93dbce[_0x2c41bb]]=null;}}_0x27ed44[_0x1d1f('0x70')](_0x5ac723);}return _0x27ed44;}})[_0x1d1f('0x26')](function(_0x3b99b9){if(!_[_0x1d1f('0x71')](_0x3b99b9)){var _0xb2ff5e=toCsv(_0x3b99b9);var _0x594af1=Date[_0x1d1f('0x72')]();fs[_0x1d1f('0x73')](util['format'](_0x1d1f('0x74'),_0x30d302[_0x1d1f('0x49')]['id'],_0x594af1),_0xb2ff5e);_0x19e45e[_0x1d1f('0x75')](_0x1d1f('0x76'),_0x1d1f('0x77')+util[_0x1d1f('0x6d')](_0x1d1f('0x78'),_0x30d302[_0x1d1f('0x49')]['id'],_0x594af1));_0x19e45e[_0x1d1f('0x75')](_0x1d1f('0x79'),_0x1d1f('0x7a'));return _0x19e45e[_0x1d1f('0x7b')](util[_0x1d1f('0x6d')](_0x1d1f('0x74'),_0x30d302[_0x1d1f('0x49')]['id'],_0x594af1));}else{return _0x19e45e[_0x1d1f('0x19')](0xcc);}})['catch'](handleError(_0x19e45e,null));}; \ No newline at end of file +var _0x1619=['catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','UserProfileSection','update','getSessions','pick','ProjectId','JscriptySessionReport','getAnswers','findOne','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','format','zip-dir','request-promise','moment','bluebird','util','sox','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','destroy','then','get','UserProfileResource','error','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1619,0x189));var _0x9161=function(_0x296e99,_0x49ecfb){_0x296e99=_0x296e99-0x0;var _0x113bac=_0x1619[_0x296e99];return _0x113bac;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9161('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9161('0x1'));var moment=require(_0x9161('0x2'));var BPromise=require(_0x9161('0x3'));var Mustache=require('mustache');var util=require(_0x9161('0x4'));var path=require('path');var sox=require(_0x9161('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9161('0x6'));var _=require(_0x9161('0x7'));var squel=require('squel');var crypto=require(_0x9161('0x8'));var jsforce=require(_0x9161('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x9161('0xa'));var querystring=require('querystring');var Papa=require(_0x9161('0xb'));var Redis=require('ioredis');var authService=require(_0x9161('0xc'));var qs=require(_0x9161('0xd'));var as=require(_0x9161('0xe'));var hardwareService=require(_0x9161('0xf'));var logger=require(_0x9161('0x10'))(_0x9161('0x11'));var utils=require(_0x9161('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b955d,_0x19a636){_0x19a636=_0x19a636||0xcc;return function(_0x575ce5){if(_0x575ce5){return _0x4b955d[_0x9161('0x13')](_0x19a636);}return _0x4b955d[_0x9161('0x14')](_0x19a636)[_0x9161('0x15')]();};}function respondWithResult(_0x308d04,_0x1ddcbc){_0x1ddcbc=_0x1ddcbc||0xc8;return function(_0x640de2){if(_0x640de2){return _0x308d04[_0x9161('0x14')](_0x1ddcbc)[_0x9161('0x16')](_0x640de2);}};}function respondWithFilteredResult(_0x4e46f5,_0x147ba9){return function(_0x36677d){if(_0x36677d){var _0x3ec5c5=typeof _0x147ba9['offset']===_0x9161('0x17')&&typeof _0x147ba9[_0x9161('0x18')]===_0x9161('0x17');var _0x517fc6=_0x36677d[_0x9161('0x19')];var _0x26c320=_0x3ec5c5?0x0:_0x147ba9['offset'];var _0x24caae=_0x3ec5c5?_0x36677d[_0x9161('0x19')]:_0x147ba9[_0x9161('0x1a')]+_0x147ba9[_0x9161('0x18')];var _0x221998;if(_0x24caae>=_0x517fc6){_0x24caae=_0x517fc6;_0x221998=0xc8;}else{_0x221998=0xce;}_0x4e46f5[_0x9161('0x14')](_0x221998);return _0x4e46f5[_0x9161('0x1b')]('Content-Range',_0x26c320+'-'+_0x24caae+'/'+_0x517fc6)[_0x9161('0x16')](_0x36677d);}return null;};}function patchUpdates(_0x53b67e){return function(_0x1f137c){try{jsonpatch[_0x9161('0x1c')](_0x1f137c,_0x53b67e,!![]);}catch(_0x2db6a0){return BPromise['reject'](_0x2db6a0);}return _0x1f137c['save']();};}function saveUpdates(_0x50041f,_0x27265b){return function(_0x30f97f){if(_0x30f97f){return _0x30f97f['update'](_0x50041f)['then'](function(_0x5e0abd){return _0x5e0abd;});}return null;};}function removeEntity(_0x5b4eed,_0x20fa48){return function(_0x41a5f8){if(_0x41a5f8){return _0x41a5f8[_0x9161('0x1d')]()[_0x9161('0x1e')](function(){var _0x255b08=_0x41a5f8[_0x9161('0x1f')]({'plain':!![]});var _0x2e5e4a='Projects';return db[_0x9161('0x20')][_0x9161('0x1d')]({'where':{'type':_0x2e5e4a,'resourceId':_0x255b08['id']}})[_0x9161('0x1e')](function(){return _0x41a5f8;});})[_0x9161('0x1e')](function(){_0x5b4eed[_0x9161('0x14')](0xcc)[_0x9161('0x15')]();});}};}function handleEntityNotFound(_0x3102f7,_0xabd4f7){return function(_0x588ea6){if(!_0x588ea6){_0x3102f7[_0x9161('0x13')](0x194);}return _0x588ea6;};}function handleError(_0x37418f,_0x51074d){_0x51074d=_0x51074d||0x1f4;return function(_0x13bf83){logger[_0x9161('0x21')](_0x13bf83['stack']);if(_0x13bf83[_0x9161('0x22')]){delete _0x13bf83[_0x9161('0x22')];}_0x37418f[_0x9161('0x14')](_0x51074d)[_0x9161('0x23')](_0x13bf83);};}exports[_0x9161('0x24')]=function(_0x4096d8,_0x59cd77){var _0x40daaf={},_0x11cbbc={},_0x1476d4={'count':0x0,'rows':[]};var _0x5e38db=_[_0x9161('0x25')](db[_0x9161('0x26')][_0x9161('0x27')],function(_0x4e7ad2){return{'name':_0x4e7ad2[_0x9161('0x28')],'type':_0x4e7ad2[_0x9161('0x29')][_0x9161('0x2a')]};});_0x11cbbc[_0x9161('0x2b')]=_[_0x9161('0x25')](_0x5e38db,_0x9161('0x22'));_0x11cbbc[_0x9161('0x2c')]=_[_0x9161('0x2d')](_0x4096d8[_0x9161('0x2c')]);_0x11cbbc[_0x9161('0x2e')]=_[_0x9161('0x2f')](_0x11cbbc[_0x9161('0x2b')],_0x11cbbc[_0x9161('0x2c')]);_0x40daaf[_0x9161('0x30')]=_[_0x9161('0x2f')](_0x11cbbc[_0x9161('0x2b')],qs[_0x9161('0x31')](_0x4096d8[_0x9161('0x2c')][_0x9161('0x31')]));_0x40daaf[_0x9161('0x30')]=_0x40daaf[_0x9161('0x30')][_0x9161('0x32')]?_0x40daaf['attributes']:_0x11cbbc['model'];if(!_0x4096d8['query'][_0x9161('0x33')](_0x9161('0x34'))){_0x40daaf[_0x9161('0x18')]=qs[_0x9161('0x18')](_0x4096d8[_0x9161('0x2c')]['limit']);_0x40daaf[_0x9161('0x1a')]=qs['offset'](_0x4096d8[_0x9161('0x2c')][_0x9161('0x1a')]);}_0x40daaf[_0x9161('0x35')]=qs['sort'](_0x4096d8[_0x9161('0x2c')][_0x9161('0x36')]);_0x40daaf['where']=qs[_0x9161('0x2e')](_['pick'](_0x4096d8['query'],_0x11cbbc[_0x9161('0x2e')]),_0x5e38db);if(_0x4096d8['query'][_0x9161('0x37')]){_0x40daaf[_0x9161('0x38')]=_['merge'](_0x40daaf['where'],{'$or':_[_0x9161('0x25')](_0x5e38db,function(_0x202df5){if(_0x202df5['type']!==_0x9161('0x39')){var _0x4c8e8e={};_0x4c8e8e[_0x202df5[_0x9161('0x22')]]={'$like':'%'+_0x4096d8[_0x9161('0x2c')][_0x9161('0x37')]+'%'};return _0x4c8e8e;}})});}_0x40daaf=_[_0x9161('0x3a')]({},_0x40daaf,_0x4096d8['options']);var _0x4bcb92={'where':_0x40daaf[_0x9161('0x38')]};return db[_0x9161('0x26')]['count'](_0x4bcb92)['then'](function(_0x10fd72){_0x1476d4[_0x9161('0x19')]=_0x10fd72;if(_0x4096d8[_0x9161('0x2c')][_0x9161('0x3b')]){_0x40daaf[_0x9161('0x3c')]=[{'all':!![]}];}return db[_0x9161('0x26')][_0x9161('0x3d')](_0x40daaf);})[_0x9161('0x1e')](function(_0x2553bd){_0x1476d4[_0x9161('0x3e')]=_0x2553bd;return _0x1476d4;})[_0x9161('0x1e')](respondWithFilteredResult(_0x59cd77,_0x40daaf))[_0x9161('0x3f')](handleError(_0x59cd77,null));};exports[_0x9161('0x40')]=function(_0x2ef987,_0x177849){var _0x410f3={'raw':![],'where':{'id':_0x2ef987[_0x9161('0x41')]['id']}},_0x5d3e53={};_0x5d3e53['model']=_[_0x9161('0x2d')](db['JscriptyProject'][_0x9161('0x27')]);_0x5d3e53[_0x9161('0x2c')]=_[_0x9161('0x2d')](_0x2ef987[_0x9161('0x2c')]);_0x5d3e53[_0x9161('0x2e')]=_['intersection'](_0x5d3e53[_0x9161('0x2b')],_0x5d3e53['query']);_0x410f3[_0x9161('0x30')]=_[_0x9161('0x2f')](_0x5d3e53[_0x9161('0x2b')],qs[_0x9161('0x31')](_0x2ef987[_0x9161('0x2c')][_0x9161('0x31')]));_0x410f3[_0x9161('0x30')]=_0x410f3[_0x9161('0x30')][_0x9161('0x32')]?_0x410f3[_0x9161('0x30')]:_0x5d3e53[_0x9161('0x2b')];if(_0x2ef987[_0x9161('0x2c')][_0x9161('0x3b')]){_0x410f3['include']=[{'all':!![]}];}_0x410f3=_[_0x9161('0x3a')]({},_0x410f3,_0x2ef987[_0x9161('0x42')]);return db[_0x9161('0x26')][_0x9161('0x43')](_0x410f3)[_0x9161('0x1e')](handleEntityNotFound(_0x177849,null))[_0x9161('0x1e')](respondWithResult(_0x177849,null))[_0x9161('0x3f')](handleError(_0x177849,null));};exports[_0x9161('0x44')]=function(_0x3e3864,_0x58928c){return db['JscriptyProject'][_0x9161('0x44')](_0x3e3864[_0x9161('0x45')],{})[_0x9161('0x1e')](function(_0x3da253){var _0x3e135d=_0x3e3864[_0x9161('0x46')][_0x9161('0x1f')]({'plain':!![]});if(!_0x3e135d)throw new Error(_0x9161('0x47'));if(_0x3e135d[_0x9161('0x48')]===_0x9161('0x46')){var _0x141adb=_0x3da253[_0x9161('0x1f')]({'plain':!![]});var _0x2af24a=_0x9161('0x49');return db['UserProfileSection'][_0x9161('0x43')]({'where':{'name':_0x2af24a,'userProfileId':_0x3e135d[_0x9161('0x4a')]},'raw':!![]})[_0x9161('0x1e')](function(_0x3e43c3){if(_0x3e43c3&&_0x3e43c3[_0x9161('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x141adb[_0x9161('0x22')],'resourceId':_0x141adb['id'],'type':_0x3e43c3[_0x9161('0x22')],'sectionId':_0x3e43c3['id']},{})[_0x9161('0x1e')](function(){return _0x3da253;});}else{return _0x3da253;}})[_0x9161('0x3f')](function(_0x11359d){logger[_0x9161('0x21')](_0x9161('0x4c'),_0x11359d);throw _0x11359d;});}return _0x3da253;})[_0x9161('0x1e')](respondWithResult(_0x58928c,0xc9))['catch'](handleError(_0x58928c,null));};exports['clone']=function(_0xc3f20e,_0xebbee1){var _0x1532de={'where':{'id':_0xc3f20e[_0x9161('0x41')]['id']}},_0x157f88={};_0x157f88[_0x9161('0x2b')]=_[_0x9161('0x2d')](db[_0x9161('0x26')][_0x9161('0x27')]);_0x1532de[_0x9161('0x30')]=_['intersection'](_0x157f88[_0x9161('0x2b')],qs['fields'](_0xc3f20e['query'][_0x9161('0x31')]));_0x1532de['attributes']=_0x1532de[_0x9161('0x30')]['length']?_0x1532de['attributes']:_0x157f88[_0x9161('0x2b')];if(_0xc3f20e[_0x9161('0x2c')][_0x9161('0x3b')]){_0x1532de[_0x9161('0x3c')]=[{'all':!![]}];}_0x1532de=_['merge']({},_0x1532de,_0xc3f20e[_0x9161('0x42')]);return db['JscriptyProject'][_0x9161('0x43')](_0x1532de)[_0x9161('0x1e')](handleEntityNotFound(_0xebbee1,null))[_0x9161('0x1e')](function(_0x229c73){if(_0x229c73){var _0x1f102d=_0x229c73[_0x9161('0x1f')]({'plain':!![]});_0x1f102d=qs['omit'](_0x1f102d,['id',_0x9161('0x4d'),_0x9161('0x4e')]);_0xc3f20e[_0x9161('0x45')]=_[_0x9161('0x4f')](_0xc3f20e[_0x9161('0x45')],['id',_0x9161('0x4d'),_0x9161('0x4e')]);return db['JscriptyProject']['create'](_['merge'](_0x1f102d,_0xc3f20e[_0x9161('0x45')]),{'include':_0xc3f20e[_0x9161('0x2c')][_0x9161('0x3b')]?[{'all':!![]}]:undefined})[_0x9161('0x1e')](function(_0x42d0dc){var _0x4398d2=_0xc3f20e[_0x9161('0x46')][_0x9161('0x1f')]({'plain':!![]});if(!_0x4398d2)throw new Error(_0x9161('0x47'));if(_0x4398d2[_0x9161('0x48')]==='user'){var _0x565dfc=_0x42d0dc[_0x9161('0x1f')]({'plain':!![]});var _0x42f381=_0x9161('0x49');return db[_0x9161('0x50')][_0x9161('0x43')]({'where':{'name':_0x42f381,'userProfileId':_0x4398d2['userProfileId']},'raw':!![]})[_0x9161('0x1e')](function(_0xd060a2){if(_0xd060a2&&_0xd060a2['autoAssociation']===0x0){return db['UserProfileResource'][_0x9161('0x44')]({'name':_0x565dfc[_0x9161('0x22')],'resourceId':_0x565dfc['id'],'type':_0xd060a2[_0x9161('0x22')],'sectionId':_0xd060a2['id']},{})[_0x9161('0x1e')](function(){return _0x42d0dc;});}else{return _0x42d0dc;}})[_0x9161('0x3f')](function(_0xac054c){logger[_0x9161('0x21')](_0x9161('0x4c'),_0xac054c);throw _0xac054c;});}return _0x42d0dc;});}})[_0x9161('0x1e')](respondWithResult(_0xebbee1,0xc9))[_0x9161('0x3f')](handleError(_0xebbee1,null));};exports[_0x9161('0x51')]=function(_0x1facbd,_0x126626){if(_0x1facbd[_0x9161('0x45')]['id']){delete _0x1facbd[_0x9161('0x45')]['id'];}return db['JscriptyProject'][_0x9161('0x43')]({'where':{'id':_0x1facbd['params']['id']}})[_0x9161('0x1e')](handleEntityNotFound(_0x126626,null))[_0x9161('0x1e')](saveUpdates(_0x1facbd[_0x9161('0x45')],null))[_0x9161('0x1e')](respondWithResult(_0x126626,null))['catch'](handleError(_0x126626,null));};exports[_0x9161('0x1d')]=function(_0x413a45,_0x4b3296){return db[_0x9161('0x26')][_0x9161('0x43')]({'where':{'id':_0x413a45[_0x9161('0x41')]['id']}})['then'](handleEntityNotFound(_0x4b3296,null))[_0x9161('0x1e')](removeEntity(_0x4b3296,null))['catch'](handleError(_0x4b3296,null));};exports[_0x9161('0x52')]=function(_0x367cfe,_0x4742a0,_0x86856b){var _0x454211={'raw':!![],'where':{}};var _0xef073f={};var _0x4af4d3={'count':0x0,'rows':[]};return db[_0x9161('0x26')]['findOne']({'where':{'id':_0x367cfe['params']['id']}})[_0x9161('0x1e')](handleEntityNotFound(_0x4742a0,null))[_0x9161('0x1e')](function(_0xe84b0f){if(_0xe84b0f){_0xef073f['model']=_[_0x9161('0x2d')](db['JscriptySessionReport']['rawAttributes']);_0xef073f['query']=_[_0x9161('0x2d')](_0x367cfe[_0x9161('0x2c')]);_0xef073f[_0x9161('0x2e')]=_[_0x9161('0x2f')](_0xef073f[_0x9161('0x2b')],_0xef073f[_0x9161('0x2c')]);_0x454211[_0x9161('0x30')]=_[_0x9161('0x2f')](_0xef073f[_0x9161('0x2b')],qs['fields'](_0x367cfe[_0x9161('0x2c')][_0x9161('0x31')]));_0x454211['attributes']=_0x454211[_0x9161('0x30')][_0x9161('0x32')]?_0x454211[_0x9161('0x30')]:_0xef073f[_0x9161('0x2b')];if(!_0x367cfe[_0x9161('0x2c')][_0x9161('0x33')]('nolimit')){_0x454211[_0x9161('0x18')]=qs[_0x9161('0x18')](_0x367cfe['query'][_0x9161('0x18')]);_0x454211[_0x9161('0x1a')]=qs[_0x9161('0x1a')](_0x367cfe['query'][_0x9161('0x1a')]);}_0x454211[_0x9161('0x35')]=qs[_0x9161('0x36')](_0x367cfe['query'][_0x9161('0x36')]);_0x454211[_0x9161('0x38')]=qs['filters'](_[_0x9161('0x53')](_0x367cfe[_0x9161('0x2c')],_0xef073f['filters']));_0x454211[_0x9161('0x38')][_0x9161('0x54')]=_0xe84b0f['id'];if(_0x367cfe[_0x9161('0x2c')]['filter']){_0x454211['where']=_[_0x9161('0x3a')](_0x454211[_0x9161('0x38')],{'$or':_[_0x9161('0x25')](_0x454211[_0x9161('0x30')],function(_0x22082e){var _0x5c8c7e={};_0x5c8c7e[_0x22082e]={'$like':'%'+_0x367cfe[_0x9161('0x2c')][_0x9161('0x37')]+'%'};return _0x5c8c7e;})});}_0x454211=_[_0x9161('0x3a')]({},_0x454211,_0x367cfe[_0x9161('0x42')]);return db[_0x9161('0x55')][_0x9161('0x19')]({'where':_0x454211[_0x9161('0x38')]})[_0x9161('0x1e')](function(_0x4cd017){_0x4af4d3[_0x9161('0x19')]=_0x4cd017;if(_0x367cfe[_0x9161('0x2c')][_0x9161('0x3b')]){_0x454211[_0x9161('0x3c')]=[{'all':!![]}];}return db[_0x9161('0x55')][_0x9161('0x3d')](_0x454211);})[_0x9161('0x1e')](function(_0x15db09){_0x4af4d3[_0x9161('0x3e')]=_0x15db09;return _0x4af4d3;});}})[_0x9161('0x1e')](respondWithFilteredResult(_0x4742a0,_0x454211))[_0x9161('0x3f')](handleError(_0x4742a0,null));};exports[_0x9161('0x56')]=function(_0x4b4b85,_0x5d4c0a,_0x5d5082){var _0x2080c7={'raw':!![],'where':{}};var _0x43f950={};var _0x5b17db={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x9161('0x57')]({'where':{'id':_0x4b4b85[_0x9161('0x41')]['id']}})[_0x9161('0x1e')](handleEntityNotFound(_0x5d4c0a,null))['then'](function(_0x16a00c){if(_0x16a00c){_0x43f950[_0x9161('0x2b')]=_['keys'](db[_0x9161('0x58')][_0x9161('0x27')]);_0x43f950['query']=_[_0x9161('0x2d')](_0x4b4b85[_0x9161('0x2c')]);_0x43f950[_0x9161('0x2e')]=_[_0x9161('0x2f')](_0x43f950['model'],_0x43f950[_0x9161('0x2c')]);_0x2080c7[_0x9161('0x30')]=_[_0x9161('0x2f')](_0x43f950[_0x9161('0x2b')],qs['fields'](_0x4b4b85['query'][_0x9161('0x31')]));_0x2080c7[_0x9161('0x30')]=_0x2080c7[_0x9161('0x30')][_0x9161('0x32')]?_0x2080c7['attributes']:_0x43f950[_0x9161('0x2b')];if(!_0x4b4b85['query']['hasOwnProperty'](_0x9161('0x34'))){_0x2080c7[_0x9161('0x18')]=qs[_0x9161('0x18')](_0x4b4b85[_0x9161('0x2c')][_0x9161('0x18')]);_0x2080c7[_0x9161('0x1a')]=qs[_0x9161('0x1a')](_0x4b4b85[_0x9161('0x2c')][_0x9161('0x1a')]);}_0x2080c7[_0x9161('0x35')]=qs['sort'](_0x4b4b85[_0x9161('0x2c')][_0x9161('0x36')]);_0x2080c7[_0x9161('0x38')]=qs[_0x9161('0x2e')](_['pick'](_0x4b4b85['query'],_0x43f950['filters']));_0x2080c7[_0x9161('0x38')]['ProjectId']=_0x16a00c['id'];if(_0x4b4b85[_0x9161('0x2c')][_0x9161('0x37')]){_0x2080c7[_0x9161('0x38')]=_[_0x9161('0x3a')](_0x2080c7[_0x9161('0x38')],{'$or':_['map'](_0x2080c7['attributes'],function(_0x141533){var _0xc6e3f6={};_0xc6e3f6[_0x141533]={'$like':'%'+_0x4b4b85['query'][_0x9161('0x37')]+'%'};return _0xc6e3f6;})});}_0x2080c7=_[_0x9161('0x3a')]({},_0x2080c7,_0x4b4b85[_0x9161('0x42')]);return db[_0x9161('0x58')]['count']({'where':_0x2080c7[_0x9161('0x38')]})['then'](function(_0xa40b33){_0x5b17db['count']=_0xa40b33;if(_0x4b4b85[_0x9161('0x2c')][_0x9161('0x3b')]){_0x2080c7['include']=[{'all':!![]}];}return db[_0x9161('0x58')][_0x9161('0x3d')](_0x2080c7);})[_0x9161('0x1e')](function(_0x5674ec){_0x5b17db['rows']=_0x5674ec;return _0x5b17db;});}})[_0x9161('0x1e')](respondWithFilteredResult(_0x5d4c0a,_0x2080c7))[_0x9161('0x3f')](handleError(_0x5d4c0a,null));};function char(_0x2dbe3f){return _0x9161('0x59')===typeof _0x2dbe3f?String[_0x9161('0x5a')]['apply'](null,arguments):_0x2dbe3f;}function needsEncapsulation(_0x4cba58){return!!_0x4cba58&&(_0x4cba58[_0x9161('0x5b')]()[_0x9161('0x5c')](char(0xd))>=0x0||_0x4cba58['toString']()[_0x9161('0x5c')](char(0xa))>=0x0||_0x4cba58[_0x9161('0x5b')]()[_0x9161('0x5c')](char(0x2c))>=0x0||_0x4cba58[_0x9161('0x5b')]()[_0x9161('0x5c')](char(0x22))>=0x0);}function encapsulate(_0x4fbf1b){var _0x4e7f22=char(0x22),_0x80b5b8='\x5c'+char(0x22),_0x4839ac=_0x4fbf1b[_0x9161('0x5b')]()['replace'](new RegExp(_0x4e7f22,'g'),_0x80b5b8);return _0x4e7f22+_0x4839ac+_0x4e7f22;}exports[_0x9161('0x5d')]=function(_0x1b1884,_0x434e84,_0x2be810){var _0x2ca118,_0x53656a;var _0x63f8c6={'where':{'ProjectId':_0x1b1884[_0x9161('0x41')]['id']}};if(_0x1b1884[_0x9161('0x2c')][_0x9161('0x5e')]){_0x63f8c6[_0x9161('0x38')][_0x9161('0x5f')]=JSON[_0x9161('0x60')](_0x1b1884['query'][_0x9161('0x5e')]);}return db[_0x9161('0x55')]['findAll'](_0x63f8c6)[_0x9161('0x1e')](handleEntityNotFound(_0x434e84,null))[_0x9161('0x1e')](function(_0x735961){if(_0x735961){_0x2ca118=_0x735961;return db[_0x9161('0x61')][_0x9161('0x3d')]({'where':{'SessionId':{'$in':_['map'](_0x2ca118,'id')},'ProjectId':_0x1b1884[_0x9161('0x41')]['id']},'order':_0x9161('0x62')});}})[_0x9161('0x1e')](handleEntityNotFound(_0x434e84,null))[_0x9161('0x1e')](function(_0x52baa7){if(_0x52baa7){_0x53656a=_0x52baa7;var _0x39b2b1={};for(var _0x1cf8bc=0x0,_0x4b55e1=_0x53656a[_0x9161('0x32')];_0x1cf8bc<_0x4b55e1;_0x1cf8bc++){if(!_0x39b2b1[_0x9161('0x33')](_0x53656a[_0x1cf8bc][_0x9161('0x63')])){_0x39b2b1[_0x53656a[_0x1cf8bc]['questionId']]=needsEncapsulation(_0x53656a[_0x1cf8bc]['question'])?encapsulate(_0x53656a[_0x1cf8bc][_0x9161('0x64')]):_0x53656a[_0x1cf8bc]['question'];}}var _0x310a81=[],_0x5b4e20={};for(var _0x265518=0x0,_0xeec26=_0x2ca118[_0x9161('0x32')];_0x265518<_0xeec26;_0x265518++){_0x5b4e20={'ProjectId':_0x1b1884[_0x9161('0x41')]['id'],'SessionId':_0x2ca118[_0x265518]['id'],'StartTime':moment(_0x2ca118[_0x265518][_0x9161('0x5f')])['format'](_0x9161('0x65'))};for(var _0x457e7d=0x0,_0x9c3994=_0x53656a[_0x9161('0x32')];_0x457e7d<_0x9c3994;_0x457e7d++){if(_0x53656a[_0x457e7d][_0x9161('0x66')]==_0x2ca118[_0x265518]['id']&&_0x39b2b1[_0x9161('0x33')](_0x53656a[_0x457e7d][_0x9161('0x63')])){_0x5b4e20[_0x39b2b1[_0x53656a[_0x457e7d][_0x9161('0x63')]]]=_0x53656a[_0x457e7d][_0x9161('0x67')];}}for(var _0x1c0a01 in _0x39b2b1){if(!_0x5b4e20[_0x9161('0x33')](_0x39b2b1[_0x1c0a01])){_0x5b4e20[_0x39b2b1[_0x1c0a01]]=null;}}_0x310a81[_0x9161('0x68')](_0x5b4e20);}return _0x310a81;}})[_0x9161('0x1e')](function(_0x3a64df){if(!_['isEmpty'](_0x3a64df)){var _0x59460e=toCsv(_0x3a64df);var _0xee6b66=Date[_0x9161('0x69')]();fs[_0x9161('0x6a')](util['format'](_0x9161('0x6b'),_0x1b1884[_0x9161('0x41')]['id'],_0xee6b66),_0x59460e);_0x434e84[_0x9161('0x6c')]('Content-disposition','attachment;\x20filename='+util['format'](_0x9161('0x6d'),_0x1b1884['params']['id'],_0xee6b66));_0x434e84[_0x9161('0x6c')](_0x9161('0x6e'),_0x9161('0x6f'));return _0x434e84[_0x9161('0x70')](util[_0x9161('0x71')](_0x9161('0x6b'),_0x1b1884[_0x9161('0x41')]['id'],_0xee6b66));}else{return _0x434e84[_0x9161('0x13')](0xcc);}})[_0x9161('0x3f')](handleError(_0x434e84,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index af255b8..251910b 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 _0xc6ab=['rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','path'];(function(_0x11542b,_0x599116){var _0xffbab8=function(_0x59850b){while(--_0x59850b){_0x11542b['push'](_0x11542b['shift']());}};_0xffbab8(++_0x599116);}(_0xc6ab,0x96));var _0xbc6a=function(_0x5bf49a,_0x428e1a){_0x5bf49a=_0x5bf49a-0x0;var _0x4b8a33=_0xc6ab[_0x5bf49a];return _0x4b8a33;};'use strict';var _=require(_0xbc6a('0x0'));var util=require(_0xbc6a('0x1'));var logger=require(_0xbc6a('0x2'))(_0xbc6a('0x3'));var moment=require(_0xbc6a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbc6a('0x5'));var rimraf=require(_0xbc6a('0x6'));var config=require(_0xbc6a('0x7'));var attributes=require(_0xbc6a('0x8'));module[_0xbc6a('0x9')]=function(_0x4ccd07,_0x45ed96){return _0x4ccd07[_0xbc6a('0xa')](_0xbc6a('0xb'),attributes,{'tableName':_0xbc6a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed5f=['define','JscriptyProject','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./jscriptyProject.attributes','exports'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xed5f,0x1e6));var _0xfed5=function(_0x428098,_0x1a224f){_0x428098=_0x428098-0x0;var _0x222cd3=_0xed5f[_0x428098];return _0x222cd3;};'use strict';var _=require('lodash');var util=require(_0xfed5('0x0'));var logger=require(_0xfed5('0x1'))(_0xfed5('0x2'));var moment=require('moment');var BPromise=require(_0xfed5('0x3'));var rp=require(_0xfed5('0x4'));var fs=require('fs');var path=require(_0xfed5('0x5'));var rimraf=require(_0xfed5('0x6'));var config=require('../../config/environment');var attributes=require(_0xfed5('0x7'));module[_0xfed5('0x8')]=function(_0x3d6edd,_0x5a1dcc){return _0x3d6edd[_0xfed5('0x9')](_0xfed5('0xa'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 2fe10e4..b694743 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 _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(_0xa63fdf,_0x5c0376){var _0x43f178=function(_0x224053){while(--_0x224053){_0xa63fdf['push'](_0xa63fdf['shift']());}};_0x43f178(++_0x5c0376);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'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 +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0xa22606,_0x497098){var _0x5252d2=function(_0x13944c){while(--_0x13944c){_0xa22606['push'](_0xa22606['shift']());}};_0x5252d2(++_0x497098);}(_0xaa88,0x137));var _0x8aa8=function(_0x3ef2d5,_0x423d46){_0x3ef2d5=_0x3ef2d5-0x0;var _0x2fefb2=_0xaa88[_0x3ef2d5];return _0x2fefb2;};'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')]('JscriptyProject,\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')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index de73385..0259635 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 _0xcf90=['show','create','put','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','index','get','/describe','isAuthenticated','describe','/:id'];(function(_0xe8042e,_0xa01c97){var _0xc95be6=function(_0x23cdf4){while(--_0x23cdf4){_0xe8042e['push'](_0xe8042e['shift']());}};_0xc95be6(++_0xa01c97);}(_0xcf90,0xd8));var _0x0cf9=function(_0x29acde,_0x48c626){_0x29acde=_0x29acde-0x0;var _0x588d4e=_0xcf90[_0x29acde];return _0x588d4e;};'use strict';var multer=require(_0x0cf9('0x0'));var util=require('util');var path=require(_0x0cf9('0x1'));var timeout=require(_0x0cf9('0x2'));var express=require('express');var router=express[_0x0cf9('0x3')]();var fs_extra=require(_0x0cf9('0x4'));var auth=require(_0x0cf9('0x5'));var interaction=require(_0x0cf9('0x6'));var config=require(_0x0cf9('0x7'));var controller=require(_0x0cf9('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0cf9('0x9')]);router[_0x0cf9('0xa')](_0x0cf9('0xb'),auth[_0x0cf9('0xc')](),controller[_0x0cf9('0xd')]);router['get'](_0x0cf9('0xe'),auth[_0x0cf9('0xc')](),controller[_0x0cf9('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0cf9('0x10')]);router[_0x0cf9('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x0cf9('0x12')]);router[_0x0cf9('0x13')]('/:id',auth[_0x0cf9('0xc')](),controller[_0x0cf9('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9494=['../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2a0183,_0x3fc93c){var _0x158c3a=function(_0x57a903){while(--_0x57a903){_0x2a0183['push'](_0x2a0183['shift']());}};_0x158c3a(++_0x3fc93c);}(_0x9494,0x112));var _0x4949=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9494[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4949('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4949('0x1'));var router=express[_0x4949('0x2')]();var fs_extra=require(_0x4949('0x3'));var auth=require(_0x4949('0x4'));var interaction=require(_0x4949('0x5'));var config=require(_0x4949('0x6'));var controller=require(_0x4949('0x7'));router[_0x4949('0x8')]('/',auth[_0x4949('0x9')](),controller[_0x4949('0xa')]);router[_0x4949('0x8')]('/describe',auth[_0x4949('0x9')](),controller['describe']);router['get'](_0x4949('0xb'),auth[_0x4949('0x9')](),controller[_0x4949('0xc')]);router[_0x4949('0xd')]('/',auth[_0x4949('0x9')](),controller[_0x4949('0xe')]);router[_0x4949('0xf')](_0x4949('0xb'),auth['isAuthenticated'](),controller[_0x4949('0x10')]);router[_0x4949('0x11')](_0x4949('0xb'),auth[_0x4949('0x9')](),controller[_0x4949('0x12')]);module[_0x4949('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 5d6aec1..d605fb5 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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7a54,0x106));var _0x47a5=function(_0x2bbf7f,_0x5c8806){_0x2bbf7f=_0x2bbf7f-0x0;var _0x21b153=_0x7a54[_0x2bbf7f];return _0x21b153;};'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(_0x293684,_0x5dc0e6){_0x293684=_0x293684-0x0;var _0x108b77=_0x7a54[_0x293684];return _0x108b77;};'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 f57bc19..b10f746 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 _0x8001=['create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','JscriptyQuestionReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0x8001,0x9d));var _0x1800=function(_0x7a78f8,_0x53f1f8){_0x7a78f8=_0x7a78f8-0x0;var _0x126642=_0x8001[_0x7a78f8];return _0x126642;};'use strict';var emlformat=require(_0x1800('0x0'));var rimraf=require(_0x1800('0x1'));var zipdir=require(_0x1800('0x2'));var jsonpatch=require(_0x1800('0x3'));var rp=require(_0x1800('0x4'));var moment=require(_0x1800('0x5'));var BPromise=require(_0x1800('0x6'));var Mustache=require(_0x1800('0x7'));var util=require(_0x1800('0x8'));var path=require(_0x1800('0x9'));var sox=require(_0x1800('0xa'));var csv=require(_0x1800('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1800('0xc'));var _=require('lodash');var squel=require(_0x1800('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1800('0xe'));var toCsv=require(_0x1800('0xb'));var querystring=require(_0x1800('0xf'));var Papa=require(_0x1800('0x10'));var Redis=require('ioredis');var authService=require(_0x1800('0x11'));var qs=require(_0x1800('0x12'));var as=require(_0x1800('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1800('0x14'))(_0x1800('0x15'));var utils=require(_0x1800('0x16'));var config=require(_0x1800('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1800('0x18'))['db'];function respondWithStatusCode(_0x1b0947,_0x24b925){_0x24b925=_0x24b925||0xcc;return function(_0x355010){if(_0x355010){return _0x1b0947['sendStatus'](_0x24b925);}return _0x1b0947[_0x1800('0x19')](_0x24b925)[_0x1800('0x1a')]();};}function respondWithResult(_0x56a24,_0x4d0f50){_0x4d0f50=_0x4d0f50||0xc8;return function(_0x8013fc){if(_0x8013fc){return _0x56a24['status'](_0x4d0f50)['json'](_0x8013fc);}};}function respondWithFilteredResult(_0x22b254,_0x11f1cc){return function(_0x588a1b){if(_0x588a1b){var _0x2f9dc2=typeof _0x11f1cc[_0x1800('0x1b')]===_0x1800('0x1c')&&typeof _0x11f1cc['limit']==='undefined';var _0x572b11=_0x588a1b[_0x1800('0x1d')];var _0x2369f7=_0x2f9dc2?0x0:_0x11f1cc[_0x1800('0x1b')];var _0x451ccf=_0x2f9dc2?_0x588a1b[_0x1800('0x1d')]:_0x11f1cc[_0x1800('0x1b')]+_0x11f1cc[_0x1800('0x1e')];var _0x1505c5;if(_0x451ccf>=_0x572b11){_0x451ccf=_0x572b11;_0x1505c5=0xc8;}else{_0x1505c5=0xce;}_0x22b254[_0x1800('0x19')](_0x1505c5);return _0x22b254[_0x1800('0x1f')](_0x1800('0x20'),_0x2369f7+'-'+_0x451ccf+'/'+_0x572b11)[_0x1800('0x21')](_0x588a1b);}return null;};}function patchUpdates(_0x31e962){return function(_0x4c44b5){try{jsonpatch[_0x1800('0x22')](_0x4c44b5,_0x31e962,!![]);}catch(_0x5b565f){return BPromise[_0x1800('0x23')](_0x5b565f);}return _0x4c44b5[_0x1800('0x24')]();};}function saveUpdates(_0x32caec,_0x5522ce){return function(_0x2ba594){if(_0x2ba594){return _0x2ba594[_0x1800('0x25')](_0x32caec)[_0x1800('0x26')](function(_0x210870){return _0x210870;});}return null;};}function removeEntity(_0x30ede0,_0x1cfb87){return function(_0x15ce95){if(_0x15ce95){return _0x15ce95[_0x1800('0x27')]()[_0x1800('0x26')](function(){_0x30ede0['status'](0xcc)[_0x1800('0x1a')]();});}};}function handleEntityNotFound(_0x5f4a65,_0x2104c0){return function(_0x10a964){if(!_0x10a964){_0x5f4a65[_0x1800('0x28')](0x194);}return _0x10a964;};}function handleError(_0x21967f,_0x554c9b){_0x554c9b=_0x554c9b||0x1f4;return function(_0x58f8a7){logger[_0x1800('0x29')](_0x58f8a7[_0x1800('0x2a')]);if(_0x58f8a7[_0x1800('0x2b')]){delete _0x58f8a7[_0x1800('0x2b')];}_0x21967f[_0x1800('0x19')](_0x554c9b)['send'](_0x58f8a7);};}exports['index']=function(_0x538b10,_0x1f435b){var _0xbb8408={},_0x54fc55={},_0xbbe763={'count':0x0,'rows':[]};var _0x42d2d1=_['map'](db[_0x1800('0x2c')][_0x1800('0x2d')],function(_0x4da027){return{'name':_0x4da027[_0x1800('0x2e')],'type':_0x4da027['type'][_0x1800('0x2f')]};});_0x54fc55[_0x1800('0x30')]=_[_0x1800('0x31')](_0x42d2d1,_0x1800('0x2b'));_0x54fc55[_0x1800('0x32')]=_[_0x1800('0x33')](_0x538b10[_0x1800('0x32')]);_0x54fc55[_0x1800('0x34')]=_['intersection'](_0x54fc55['model'],_0x54fc55['query']);_0xbb8408['attributes']=_[_0x1800('0x35')](_0x54fc55[_0x1800('0x30')],qs[_0x1800('0x36')](_0x538b10[_0x1800('0x32')][_0x1800('0x36')]));_0xbb8408[_0x1800('0x37')]=_0xbb8408[_0x1800('0x37')]['length']?_0xbb8408['attributes']:_0x54fc55[_0x1800('0x30')];if(!_0x538b10['query'][_0x1800('0x38')](_0x1800('0x39'))){_0xbb8408['limit']=qs[_0x1800('0x1e')](_0x538b10['query'][_0x1800('0x1e')]);_0xbb8408[_0x1800('0x1b')]=qs[_0x1800('0x1b')](_0x538b10[_0x1800('0x32')][_0x1800('0x1b')]);}_0xbb8408['order']=qs[_0x1800('0x3a')](_0x538b10['query'][_0x1800('0x3a')]);_0xbb8408[_0x1800('0x3b')]=qs[_0x1800('0x34')](_['pick'](_0x538b10[_0x1800('0x32')],_0x54fc55[_0x1800('0x34')]),_0x42d2d1);if(_0x538b10[_0x1800('0x32')][_0x1800('0x3c')]){_0xbb8408[_0x1800('0x3b')]=_[_0x1800('0x3d')](_0xbb8408[_0x1800('0x3b')],{'$or':_[_0x1800('0x31')](_0x42d2d1,function(_0xc303ec){if(_0xc303ec[_0x1800('0x3e')]!==_0x1800('0x3f')){var _0x1b73c6={};_0x1b73c6[_0xc303ec[_0x1800('0x2b')]]={'$like':'%'+_0x538b10[_0x1800('0x32')]['filter']+'%'};return _0x1b73c6;}})});}_0xbb8408=_['merge']({},_0xbb8408,_0x538b10[_0x1800('0x40')]);var _0x75aea6={'where':_0xbb8408[_0x1800('0x3b')]};return db[_0x1800('0x2c')][_0x1800('0x1d')](_0x75aea6)[_0x1800('0x26')](function(_0x142267){_0xbbe763['count']=_0x142267;if(_0x538b10[_0x1800('0x32')]['includeAll']){_0xbb8408[_0x1800('0x41')]=[{'all':!![]}];}return db[_0x1800('0x2c')][_0x1800('0x42')](_0xbb8408);})[_0x1800('0x26')](function(_0x5506bd){_0xbbe763[_0x1800('0x43')]=_0x5506bd;return _0xbbe763;})['then'](respondWithFilteredResult(_0x1f435b,_0xbb8408))[_0x1800('0x44')](handleError(_0x1f435b,null));};exports[_0x1800('0x45')]=function(_0x58734c,_0xe6bafa){var _0x154b03={'raw':!![],'where':{'id':_0x58734c[_0x1800('0x46')]['id']}},_0x729656={};_0x729656[_0x1800('0x30')]=_[_0x1800('0x33')](db[_0x1800('0x2c')]['rawAttributes']);_0x729656['query']=_['keys'](_0x58734c[_0x1800('0x32')]);_0x729656['filters']=_[_0x1800('0x35')](_0x729656[_0x1800('0x30')],_0x729656[_0x1800('0x32')]);_0x154b03[_0x1800('0x37')]=_[_0x1800('0x35')](_0x729656[_0x1800('0x30')],qs['fields'](_0x58734c[_0x1800('0x32')][_0x1800('0x36')]));_0x154b03[_0x1800('0x37')]=_0x154b03['attributes'][_0x1800('0x47')]?_0x154b03['attributes']:_0x729656[_0x1800('0x30')];if(_0x58734c[_0x1800('0x32')][_0x1800('0x48')]){_0x154b03[_0x1800('0x41')]=[{'all':!![]}];}_0x154b03=_[_0x1800('0x3d')]({},_0x154b03,_0x58734c[_0x1800('0x40')]);return db[_0x1800('0x2c')][_0x1800('0x49')](_0x154b03)[_0x1800('0x26')](handleEntityNotFound(_0xe6bafa,null))[_0x1800('0x26')](respondWithResult(_0xe6bafa,null))[_0x1800('0x44')](handleError(_0xe6bafa,null));};exports[_0x1800('0x4a')]=function(_0x1a650d,_0x4776a9){return db[_0x1800('0x2c')][_0x1800('0x4a')](_0x1a650d[_0x1800('0x4b')],{})[_0x1800('0x26')](respondWithResult(_0x4776a9,0xc9))[_0x1800('0x44')](handleError(_0x4776a9,null));};exports[_0x1800('0x25')]=function(_0x4b8e8d,_0x1534d5){if(_0x4b8e8d[_0x1800('0x4b')]['id']){delete _0x4b8e8d['body']['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x4b8e8d[_0x1800('0x46')]['id']}})[_0x1800('0x26')](handleEntityNotFound(_0x1534d5,null))[_0x1800('0x26')](saveUpdates(_0x4b8e8d[_0x1800('0x4b')],null))['then'](respondWithResult(_0x1534d5,null))[_0x1800('0x44')](handleError(_0x1534d5,null));};exports[_0x1800('0x27')]=function(_0x2d7bce,_0x35d69f){return db[_0x1800('0x2c')][_0x1800('0x49')]({'where':{'id':_0x2d7bce[_0x1800('0x46')]['id']}})[_0x1800('0x26')](handleEntityNotFound(_0x35d69f,null))[_0x1800('0x26')](removeEntity(_0x35d69f,null))['catch'](handleError(_0x35d69f,null));};exports[_0x1800('0x4c')]=function(_0x2f55f6,_0x27a808){return db[_0x1800('0x2c')][_0x1800('0x4c')]()[_0x1800('0x26')](respondWithResult(_0x27a808,null))[_0x1800('0x44')](handleError(_0x27a808,null));}; \ No newline at end of file +var _0x25ad=['apply','reject','save','update','destroy','then','error','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','name','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','length','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range'];(function(_0x279d12,_0x51caaf){var _0x130954=function(_0x49b5cc){while(--_0x49b5cc){_0x279d12['push'](_0x279d12['shift']());}};_0x130954(++_0x51caaf);}(_0x25ad,0x168));var _0xd25a=function(_0x3caa43,_0x4d8a5b){_0x3caa43=_0x3caa43-0x0;var _0x35e7c4=_0x25ad[_0x3caa43];return _0x35e7c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd25a('0x0'));var zipdir=require(_0xd25a('0x1'));var jsonpatch=require(_0xd25a('0x2'));var rp=require('request-promise');var moment=require(_0xd25a('0x3'));var BPromise=require(_0xd25a('0x4'));var Mustache=require(_0xd25a('0x5'));var util=require(_0xd25a('0x6'));var path=require(_0xd25a('0x7'));var sox=require(_0xd25a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd25a('0x9'));var _=require(_0xd25a('0xa'));var squel=require(_0xd25a('0xb'));var crypto=require(_0xd25a('0xc'));var jsforce=require(_0xd25a('0xd'));var deskjs=require(_0xd25a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd25a('0xf'));var Papa=require(_0xd25a('0x10'));var Redis=require(_0xd25a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd25a('0x12'));var hardwareService=require(_0xd25a('0x13'));var logger=require(_0xd25a('0x14'))(_0xd25a('0x15'));var utils=require(_0xd25a('0x16'));var config=require(_0xd25a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd25a('0x18'))['db'];function respondWithStatusCode(_0xa4ec6c,_0x41b0c5){_0x41b0c5=_0x41b0c5||0xcc;return function(_0x1211dd){if(_0x1211dd){return _0xa4ec6c[_0xd25a('0x19')](_0x41b0c5);}return _0xa4ec6c[_0xd25a('0x1a')](_0x41b0c5)[_0xd25a('0x1b')]();};}function respondWithResult(_0x4b6fe5,_0x13010b){_0x13010b=_0x13010b||0xc8;return function(_0x1a3567){if(_0x1a3567){return _0x4b6fe5['status'](_0x13010b)[_0xd25a('0x1c')](_0x1a3567);}};}function respondWithFilteredResult(_0x305f55,_0x59c3f1){return function(_0x522b38){if(_0x522b38){var _0x22fc9b=typeof _0x59c3f1['offset']==='undefined'&&typeof _0x59c3f1[_0xd25a('0x1d')]===_0xd25a('0x1e');var _0x315734=_0x522b38['count'];var _0x57273b=_0x22fc9b?0x0:_0x59c3f1[_0xd25a('0x1f')];var _0x4249c0=_0x22fc9b?_0x522b38[_0xd25a('0x20')]:_0x59c3f1[_0xd25a('0x1f')]+_0x59c3f1[_0xd25a('0x1d')];var _0x24c764;if(_0x4249c0>=_0x315734){_0x4249c0=_0x315734;_0x24c764=0xc8;}else{_0x24c764=0xce;}_0x305f55[_0xd25a('0x1a')](_0x24c764);return _0x305f55[_0xd25a('0x21')](_0xd25a('0x22'),_0x57273b+'-'+_0x4249c0+'/'+_0x315734)[_0xd25a('0x1c')](_0x522b38);}return null;};}function patchUpdates(_0x35fe86){return function(_0x163f36){try{jsonpatch[_0xd25a('0x23')](_0x163f36,_0x35fe86,!![]);}catch(_0x328115){return BPromise[_0xd25a('0x24')](_0x328115);}return _0x163f36[_0xd25a('0x25')]();};}function saveUpdates(_0x489249,_0x2643f4){return function(_0x49e697){if(_0x49e697){return _0x49e697[_0xd25a('0x26')](_0x489249)['then'](function(_0x365b58){return _0x365b58;});}return null;};}function removeEntity(_0x435a4c,_0x56958b){return function(_0x1c4ef0){if(_0x1c4ef0){return _0x1c4ef0[_0xd25a('0x27')]()[_0xd25a('0x28')](function(){_0x435a4c[_0xd25a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46f1bd,_0x5b1d52){return function(_0x3513bf){if(!_0x3513bf){_0x46f1bd[_0xd25a('0x19')](0x194);}return _0x3513bf;};}function handleError(_0x5570cf,_0x4fb5ee){_0x4fb5ee=_0x4fb5ee||0x1f4;return function(_0x3b95bb){logger[_0xd25a('0x29')](_0x3b95bb['stack']);if(_0x3b95bb['name']){delete _0x3b95bb['name'];}_0x5570cf[_0xd25a('0x1a')](_0x4fb5ee)[_0xd25a('0x2a')](_0x3b95bb);};}exports[_0xd25a('0x2b')]=function(_0xb58b4b,_0x3f4653){var _0x400299={},_0xb0051c={},_0x1affb7={'count':0x0,'rows':[]};var _0x1326ac=_[_0xd25a('0x2c')](db[_0xd25a('0x2d')][_0xd25a('0x2e')],function(_0x4a5bd9){return{'name':_0x4a5bd9[_0xd25a('0x2f')],'type':_0x4a5bd9['type'][_0xd25a('0x30')]};});_0xb0051c['model']=_[_0xd25a('0x2c')](_0x1326ac,_0xd25a('0x31'));_0xb0051c['query']=_[_0xd25a('0x32')](_0xb58b4b[_0xd25a('0x33')]);_0xb0051c[_0xd25a('0x34')]=_[_0xd25a('0x35')](_0xb0051c['model'],_0xb0051c[_0xd25a('0x33')]);_0x400299[_0xd25a('0x36')]=_[_0xd25a('0x35')](_0xb0051c[_0xd25a('0x37')],qs[_0xd25a('0x38')](_0xb58b4b['query']['fields']));_0x400299[_0xd25a('0x36')]=_0x400299['attributes']['length']?_0x400299[_0xd25a('0x36')]:_0xb0051c[_0xd25a('0x37')];if(!_0xb58b4b['query'][_0xd25a('0x39')](_0xd25a('0x3a'))){_0x400299[_0xd25a('0x1d')]=qs[_0xd25a('0x1d')](_0xb58b4b['query'][_0xd25a('0x1d')]);_0x400299[_0xd25a('0x1f')]=qs[_0xd25a('0x1f')](_0xb58b4b['query'][_0xd25a('0x1f')]);}_0x400299[_0xd25a('0x3b')]=qs[_0xd25a('0x3c')](_0xb58b4b[_0xd25a('0x33')][_0xd25a('0x3c')]);_0x400299[_0xd25a('0x3d')]=qs['filters'](_[_0xd25a('0x3e')](_0xb58b4b['query'],_0xb0051c[_0xd25a('0x34')]),_0x1326ac);if(_0xb58b4b[_0xd25a('0x33')]['filter']){_0x400299['where']=_[_0xd25a('0x3f')](_0x400299[_0xd25a('0x3d')],{'$or':_[_0xd25a('0x2c')](_0x1326ac,function(_0x5ca09a){if(_0x5ca09a[_0xd25a('0x40')]!==_0xd25a('0x41')){var _0x8460f6={};_0x8460f6[_0x5ca09a['name']]={'$like':'%'+_0xb58b4b[_0xd25a('0x33')][_0xd25a('0x42')]+'%'};return _0x8460f6;}})});}_0x400299=_['merge']({},_0x400299,_0xb58b4b[_0xd25a('0x43')]);var _0x2dfffe={'where':_0x400299[_0xd25a('0x3d')]};return db['JscriptyQuestionReport'][_0xd25a('0x20')](_0x2dfffe)[_0xd25a('0x28')](function(_0x222570){_0x1affb7[_0xd25a('0x20')]=_0x222570;if(_0xb58b4b['query'][_0xd25a('0x44')]){_0x400299[_0xd25a('0x45')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xd25a('0x46')](_0x400299);})[_0xd25a('0x28')](function(_0x5422f1){_0x1affb7['rows']=_0x5422f1;return _0x1affb7;})[_0xd25a('0x28')](respondWithFilteredResult(_0x3f4653,_0x400299))[_0xd25a('0x47')](handleError(_0x3f4653,null));};exports[_0xd25a('0x48')]=function(_0x8fa4e3,_0x5088bd){var _0x2b175f={'raw':!![],'where':{'id':_0x8fa4e3[_0xd25a('0x49')]['id']}},_0x19eec5={};_0x19eec5[_0xd25a('0x37')]=_['keys'](db['JscriptyQuestionReport'][_0xd25a('0x2e')]);_0x19eec5[_0xd25a('0x33')]=_[_0xd25a('0x32')](_0x8fa4e3[_0xd25a('0x33')]);_0x19eec5[_0xd25a('0x34')]=_[_0xd25a('0x35')](_0x19eec5[_0xd25a('0x37')],_0x19eec5[_0xd25a('0x33')]);_0x2b175f['attributes']=_[_0xd25a('0x35')](_0x19eec5['model'],qs[_0xd25a('0x38')](_0x8fa4e3['query']['fields']));_0x2b175f[_0xd25a('0x36')]=_0x2b175f[_0xd25a('0x36')][_0xd25a('0x4a')]?_0x2b175f['attributes']:_0x19eec5[_0xd25a('0x37')];if(_0x8fa4e3[_0xd25a('0x33')][_0xd25a('0x44')]){_0x2b175f[_0xd25a('0x45')]=[{'all':!![]}];}_0x2b175f=_[_0xd25a('0x3f')]({},_0x2b175f,_0x8fa4e3[_0xd25a('0x43')]);return db[_0xd25a('0x2d')][_0xd25a('0x4b')](_0x2b175f)[_0xd25a('0x28')](handleEntityNotFound(_0x5088bd,null))[_0xd25a('0x28')](respondWithResult(_0x5088bd,null))[_0xd25a('0x47')](handleError(_0x5088bd,null));};exports[_0xd25a('0x4c')]=function(_0x1505d5,_0x274aa8){return db[_0xd25a('0x2d')]['create'](_0x1505d5[_0xd25a('0x4d')],{})[_0xd25a('0x28')](respondWithResult(_0x274aa8,0xc9))['catch'](handleError(_0x274aa8,null));};exports[_0xd25a('0x26')]=function(_0x328f05,_0x4f8fc6){if(_0x328f05[_0xd25a('0x4d')]['id']){delete _0x328f05[_0xd25a('0x4d')]['id'];}return db[_0xd25a('0x2d')][_0xd25a('0x4b')]({'where':{'id':_0x328f05['params']['id']}})[_0xd25a('0x28')](handleEntityNotFound(_0x4f8fc6,null))[_0xd25a('0x28')](saveUpdates(_0x328f05['body'],null))[_0xd25a('0x28')](respondWithResult(_0x4f8fc6,null))[_0xd25a('0x47')](handleError(_0x4f8fc6,null));};exports['destroy']=function(_0x1ba971,_0x544af8){return db[_0xd25a('0x2d')][_0xd25a('0x4b')]({'where':{'id':_0x1ba971[_0xd25a('0x49')]['id']}})['then'](handleEntityNotFound(_0x544af8,null))[_0xd25a('0x28')](removeEntity(_0x544af8,null))[_0xd25a('0x47')](handleError(_0x544af8,null));};exports[_0xd25a('0x4e')]=function(_0x1a4c98,_0x271a1a){return db[_0xd25a('0x2d')][_0xd25a('0x4e')]()[_0xd25a('0x28')](respondWithResult(_0x271a1a,null))[_0xd25a('0x47')](handleError(_0x271a1a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index e1b5129..8a72079 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 _0x6e0f=['path','rimraf','JscriptyQuestionReport','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x44ec25,_0x377c70){var _0x59a73a=function(_0x382e71){while(--_0x382e71){_0x44ec25['push'](_0x44ec25['shift']());}};_0x59a73a(++_0x377c70);}(_0x6e0f,0xed));var _0xf6e0=function(_0x37b624,_0x28c3aa){_0x37b624=_0x37b624-0x0;var _0x44abd9=_0x6e0f[_0x37b624];return _0x44abd9;};'use strict';var _=require(_0xf6e0('0x0'));var util=require(_0xf6e0('0x1'));var logger=require(_0xf6e0('0x2'))(_0xf6e0('0x3'));var moment=require(_0xf6e0('0x4'));var BPromise=require(_0xf6e0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf6e0('0x6'));var rimraf=require(_0xf6e0('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x3a680f,_0x354f5c){return _0x3a680f['define'](_0xf6e0('0x8'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9742=['./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x72f897,_0x16edae){var _0x57d96b=function(_0x18f9f6){while(--_0x18f9f6){_0x72f897['push'](_0x72f897['shift']());}};_0x57d96b(++_0x16edae);}(_0x9742,0xbb));var _0x2974=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9742[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2974('0x0'));var util=require(_0x2974('0x1'));var logger=require(_0x2974('0x2'))(_0x2974('0x3'));var moment=require(_0x2974('0x4'));var BPromise=require(_0x2974('0x5'));var rp=require(_0x2974('0x6'));var fs=require('fs');var path=require(_0x2974('0x7'));var rimraf=require(_0x2974('0x8'));var config=require('../../config/environment');var attributes=require(_0x2974('0x9'));module[_0x2974('0xa')]=function(_0x5c5c01,_0x95c67d){return _0x5c5c01[_0x2974('0xb')](_0x2974('0xc'),attributes,{'tableName':_0x2974('0xd'),'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 f18e2a3..ee38930 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 _0x2180=['rpc','../../config/environment','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils'];(function(_0x4daf04,_0x3ff8f9){var _0x138358=function(_0x3ed0cb){while(--_0x3ed0cb){_0x4daf04['push'](_0x4daf04['shift']());}};_0x138358(++_0x3ff8f9);}(_0x2180,0x79));var _0x0218=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0x2180[_0xabfec4];return _0x7bafa2;};'use strict';var _=require(_0x0218('0x0'));var util=require(_0x0218('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0218('0x2'));var db=require(_0x0218('0x3'))['db'];var utils=require(_0x0218('0x4'));var logger=require('../../config/logger')(_0x0218('0x5'));var config=require(_0x0218('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0218('0x7')][_0x0218('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x147a24,_0x5df65f,_0x325e84){return new BPromise(function(_0x55c70e,_0x354907){return client[_0x0218('0x9')](_0x147a24,_0x325e84)['then'](function(_0x35a263){logger[_0x0218('0xa')](_0x0218('0xb'),_0x5df65f,_0x0218('0xc'));logger[_0x0218('0xd')](_0x0218('0xe'),_0x5df65f,_0x0218('0xc'),JSON[_0x0218('0xf')](_0x35a263));if(_0x35a263[_0x0218('0x10')]){if(_0x35a263[_0x0218('0x10')][_0x0218('0x11')]===0x1f4){logger[_0x0218('0x10')](_0x0218('0xb'),_0x5df65f,_0x35a263['error'][_0x0218('0x12')]);return _0x354907(_0x35a263[_0x0218('0x10')][_0x0218('0x12')]);}logger['error'](_0x0218('0xb'),_0x5df65f,_0x35a263[_0x0218('0x10')][_0x0218('0x12')]);return _0x55c70e(_0x35a263['error'][_0x0218('0x12')]);}else{logger[_0x0218('0xa')](_0x0218('0xb'),_0x5df65f,_0x0218('0xc'));_0x55c70e(_0x35a263[_0x0218('0x13')]['message']);}})[_0x0218('0x14')](function(_0x45fc9e){logger['error'](_0x0218('0xb'),_0x5df65f,_0x45fc9e);_0x354907(_0x45fc9e);});});} \ No newline at end of file +var _0x1617=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x18d5d7,_0x19074b){var _0x30a9ea=function(_0x514f3f){while(--_0x514f3f){_0x18d5d7['push'](_0x18d5d7['shift']());}};_0x30a9ea(++_0x19074b);}(_0x1617,0xce));var _0x7161=function(_0x64aff8,_0x106082){_0x64aff8=_0x64aff8-0x0;var _0x5488a3=_0x1617[_0x64aff8];return _0x5488a3;};'use strict';var _=require(_0x7161('0x0'));var util=require(_0x7161('0x1'));var moment=require(_0x7161('0x2'));var BPromise=require(_0x7161('0x3'));var rs=require(_0x7161('0x4'));var fs=require('fs');var Redis=require(_0x7161('0x5'));var db=require(_0x7161('0x6'))['db'];var utils=require(_0x7161('0x7'));var logger=require(_0x7161('0x8'))('rpc');var config=require(_0x7161('0x9'));var jayson=require(_0x7161('0xa'));var client=jayson[_0x7161('0xb')][_0x7161('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x156984,_0x4ad54f,_0x17ffe8){return new BPromise(function(_0x5b790f,_0x5501af){return client['request'](_0x156984,_0x17ffe8)[_0x7161('0xd')](function(_0x287a96){logger[_0x7161('0xe')](_0x7161('0xf'),_0x4ad54f,_0x7161('0x10'));logger['debug'](_0x7161('0x11'),_0x4ad54f,_0x7161('0x10'),JSON[_0x7161('0x12')](_0x287a96));if(_0x287a96['error']){if(_0x287a96[_0x7161('0x13')][_0x7161('0x14')]===0x1f4){logger[_0x7161('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4ad54f,_0x287a96['error'][_0x7161('0x15')]);return _0x5501af(_0x287a96[_0x7161('0x13')][_0x7161('0x15')]);}logger[_0x7161('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4ad54f,_0x287a96[_0x7161('0x13')][_0x7161('0x15')]);return _0x5b790f(_0x287a96[_0x7161('0x13')][_0x7161('0x15')]);}else{logger['info'](_0x7161('0xf'),_0x4ad54f,_0x7161('0x10'));_0x5b790f(_0x287a96[_0x7161('0x16')][_0x7161('0x15')]);}})['catch'](function(_0x1f3044){logger['error'](_0x7161('0xf'),_0x4ad54f,_0x1f3044);_0x5501af(_0x1f3044);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 64ad400..7d2f1d6 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 _0x1e89=['post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','getQuestions'];(function(_0x203caa,_0x133a46){var _0x5078bb=function(_0x239512){while(--_0x239512){_0x203caa['push'](_0x203caa['shift']());}};_0x5078bb(++_0x133a46);}(_0x1e89,0x1d4));var _0x91e8=function(_0x1fc6dd,_0x43f188){_0x1fc6dd=_0x1fc6dd-0x0;var _0x25a90f=_0x1e89[_0x1fc6dd];return _0x25a90f;};'use strict';var multer=require(_0x91e8('0x0'));var util=require(_0x91e8('0x1'));var path=require(_0x91e8('0x2'));var timeout=require(_0x91e8('0x3'));var express=require(_0x91e8('0x4'));var router=express[_0x91e8('0x5')]();var fs_extra=require(_0x91e8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x91e8('0x7'));var config=require(_0x91e8('0x8'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0x91e8('0x9')](),controller[_0x91e8('0xa')]);router[_0x91e8('0xb')](_0x91e8('0xc'),auth[_0x91e8('0x9')](),controller['describe']);router[_0x91e8('0xb')](_0x91e8('0xd'),auth[_0x91e8('0x9')](),controller['show']);router[_0x91e8('0xb')]('/:id/questions',auth[_0x91e8('0x9')](),controller[_0x91e8('0xe')]);router[_0x91e8('0xf')]('/',auth[_0x91e8('0x9')](),controller[_0x91e8('0x10')]);router[_0x91e8('0x11')](_0x91e8('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x91e8('0x12')](_0x91e8('0xd'),auth['isAuthenticated'](),controller[_0x91e8('0x13')]);module[_0x91e8('0x14')]=router; \ No newline at end of file +var _0xfd76=['./jscriptySessionReport.controller','get','isAuthenticated','index','describe','show','/:id/questions','getQuestions','create','update','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x434783,_0xff395d){var _0x13efcf=function(_0x235dac){while(--_0x235dac){_0x434783['push'](_0x434783['shift']());}};_0x13efcf(++_0xff395d);}(_0xfd76,0x182));var _0x6fd7=function(_0x432917,_0x34faac){_0x432917=_0x432917-0x0;var _0x1b89de=_0xfd76[_0x432917];return _0x1b89de;};'use strict';var multer=require(_0x6fd7('0x0'));var util=require(_0x6fd7('0x1'));var path=require(_0x6fd7('0x2'));var timeout=require(_0x6fd7('0x3'));var express=require(_0x6fd7('0x4'));var router=express[_0x6fd7('0x5')]();var fs_extra=require(_0x6fd7('0x6'));var auth=require(_0x6fd7('0x7'));var interaction=require(_0x6fd7('0x8'));var config=require(_0x6fd7('0x9'));var controller=require(_0x6fd7('0xa'));router[_0x6fd7('0xb')]('/',auth[_0x6fd7('0xc')](),controller[_0x6fd7('0xd')]);router[_0x6fd7('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x6fd7('0xe')]);router[_0x6fd7('0xb')]('/:id',auth[_0x6fd7('0xc')](),controller[_0x6fd7('0xf')]);router[_0x6fd7('0xb')](_0x6fd7('0x10'),auth[_0x6fd7('0xc')](),controller[_0x6fd7('0x11')]);router['post']('/',auth[_0x6fd7('0xc')](),controller[_0x6fd7('0x12')]);router['put']('/:id',auth[_0x6fd7('0xc')](),controller[_0x6fd7('0x13')]);router['delete'](_0x6fd7('0x14'),auth['isAuthenticated'](),controller['destroy']);module[_0x6fd7('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 65f9fbb..70bf7d2 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 _0xdf93=['DATE','STRING','BOOLEAN','moment','sequelize','exports','starttime','setDataValue','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd104,_0x553c0b){var _0x24dbf1=function(_0x2b3ffb){while(--_0x2b3ffb){_0x3dd104['push'](_0x3dd104['shift']());}};_0x24dbf1(++_0x553c0b);}(_0xdf93,0x1c5));var _0x3df9=function(_0x44382a,_0x22095c){_0x44382a=_0x44382a-0x0;var _0x54f8c6=_0xdf93[_0x44382a];return _0x54f8c6;};'use strict';var moment=require(_0x3df9('0x0'));var Sequelize=require(_0x3df9('0x1'));module[_0x3df9('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x29806c){this['setDataValue'](_0x3df9('0x3'),_0x29806c);this[_0x3df9('0x4')]('endtime',moment()[_0x3df9('0x5')](_0x3df9('0x6')));}},'endtime':{'type':Sequelize[_0x3df9('0x7')]},'membername':{'type':Sequelize[_0x3df9('0x8')]},'projectname':{'type':Sequelize[_0x3df9('0x8')]},'queue':{'type':Sequelize[_0x3df9('0x8')]},'uniqueid':{'type':Sequelize[_0x3df9('0x8')]},'calleridname':{'type':Sequelize[_0x3df9('0x8')]},'calleridnum':{'type':Sequelize[_0x3df9('0x8')]},'completed':{'type':Sequelize[_0x3df9('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xf65e=['STRING','BOOLEAN','sequelize','exports','DATE','setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x297619,_0x2025d9){var _0x1fda49=function(_0x3a16e3){while(--_0x3a16e3){_0x297619['push'](_0x297619['shift']());}};_0x1fda49(++_0x2025d9);}(_0xf65e,0x158));var _0xef65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf65e[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0xef65('0x0'));module[_0xef65('0x1')]={'starttime':{'type':Sequelize[_0xef65('0x2')],'set':function(_0x2b59ab){this[_0xef65('0x3')](_0xef65('0x4'),_0x2b59ab);this[_0xef65('0x3')]('endtime',moment()[_0xef65('0x5')](_0xef65('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xef65('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xef65('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xef65('0x7')]},'calleridnum':{'type':Sequelize[_0xef65('0x7')]},'completed':{'type':Sequelize[_0xef65('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 03e7d55..9076b5f 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 _0x93a7=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','query','keys','fields','attributes','model','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','intersection','length','includeAll','find','create','body','params','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','zip-dir','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x46fa35,_0x3fa53a){var _0x285c1b=function(_0x409883){while(--_0x409883){_0x46fa35['push'](_0x46fa35['shift']());}};_0x285c1b(++_0x3fa53a);}(_0x93a7,0x1c7));var _0x793a=function(_0x14a27a,_0x4640e0){_0x14a27a=_0x14a27a-0x0;var _0x1eede5=_0x93a7[_0x14a27a];return _0x1eede5;};'use strict';var emlformat=require(_0x793a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x793a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x793a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x793a('0x3'));var util=require(_0x793a('0x4'));var path=require(_0x793a('0x5'));var sox=require(_0x793a('0x6'));var csv=require('to-csv');var ejs=require(_0x793a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x793a('0x8'));var squel=require(_0x793a('0x9'));var crypto=require(_0x793a('0xa'));var jsforce=require(_0x793a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x793a('0xc'));var querystring=require(_0x793a('0xd'));var Papa=require(_0x793a('0xe'));var Redis=require('ioredis');var authService=require(_0x793a('0xf'));var qs=require(_0x793a('0x10'));var as=require(_0x793a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x793a('0x12'))('api');var utils=require(_0x793a('0x13'));var config=require(_0x793a('0x14'));var licenseUtil=require(_0x793a('0x15'));var db=require(_0x793a('0x16'))['db'];function respondWithStatusCode(_0x3c3dfb,_0x138283){_0x138283=_0x138283||0xcc;return function(_0x1579f9){if(_0x1579f9){return _0x3c3dfb[_0x793a('0x17')](_0x138283);}return _0x3c3dfb[_0x793a('0x18')](_0x138283)['end']();};}function respondWithResult(_0x49ce1f,_0x32c7a5){_0x32c7a5=_0x32c7a5||0xc8;return function(_0x430db2){if(_0x430db2){return _0x49ce1f['status'](_0x32c7a5)[_0x793a('0x19')](_0x430db2);}};}function respondWithFilteredResult(_0x2f8271,_0x1708b1){return function(_0x44a6fc){if(_0x44a6fc){var _0x477ff2=typeof _0x1708b1[_0x793a('0x1a')]===_0x793a('0x1b')&&typeof _0x1708b1[_0x793a('0x1c')]===_0x793a('0x1b');var _0x2fd147=_0x44a6fc[_0x793a('0x1d')];var _0x39db01=_0x477ff2?0x0:_0x1708b1[_0x793a('0x1a')];var _0xb4e126=_0x477ff2?_0x44a6fc['count']:_0x1708b1[_0x793a('0x1a')]+_0x1708b1[_0x793a('0x1c')];var _0x346d00;if(_0xb4e126>=_0x2fd147){_0xb4e126=_0x2fd147;_0x346d00=0xc8;}else{_0x346d00=0xce;}_0x2f8271[_0x793a('0x18')](_0x346d00);return _0x2f8271[_0x793a('0x1e')]('Content-Range',_0x39db01+'-'+_0xb4e126+'/'+_0x2fd147)['json'](_0x44a6fc);}return null;};}function patchUpdates(_0x16a48d){return function(_0x254357){try{jsonpatch[_0x793a('0x1f')](_0x254357,_0x16a48d,!![]);}catch(_0x4173b0){return BPromise[_0x793a('0x20')](_0x4173b0);}return _0x254357[_0x793a('0x21')]();};}function saveUpdates(_0x441090,_0x119c3a){return function(_0x3e9a5c){if(_0x3e9a5c){return _0x3e9a5c[_0x793a('0x22')](_0x441090)[_0x793a('0x23')](function(_0x19b754){return _0x19b754;});}return null;};}function removeEntity(_0x5e1606,_0x73dbde){return function(_0xf03e7){if(_0xf03e7){return _0xf03e7[_0x793a('0x24')]()[_0x793a('0x23')](function(){_0x5e1606[_0x793a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a1476,_0x4abf70){return function(_0x5c75c2){if(!_0x5c75c2){_0x5a1476[_0x793a('0x17')](0x194);}return _0x5c75c2;};}function handleError(_0x5e31e9,_0x591d88){_0x591d88=_0x591d88||0x1f4;return function(_0x46eec4){logger[_0x793a('0x25')](_0x46eec4[_0x793a('0x26')]);if(_0x46eec4[_0x793a('0x27')]){delete _0x46eec4[_0x793a('0x27')];}_0x5e31e9[_0x793a('0x18')](_0x591d88)[_0x793a('0x28')](_0x46eec4);};}exports[_0x793a('0x29')]=function(_0x5a05e0,_0x17f3a2){var _0x3d1122={},_0x5abb68={},_0x201946={'count':0x0,'rows':[]};var _0x514be8=_[_0x793a('0x2a')](db[_0x793a('0x2b')][_0x793a('0x2c')],function(_0x1104a7){return{'name':_0x1104a7[_0x793a('0x2d')],'type':_0x1104a7[_0x793a('0x2e')][_0x793a('0x2f')]};});_0x5abb68['model']=_['map'](_0x514be8,_0x793a('0x27'));_0x5abb68[_0x793a('0x30')]=_[_0x793a('0x31')](_0x5a05e0['query']);_0x5abb68['filters']=_['intersection'](_0x5abb68['model'],_0x5abb68[_0x793a('0x30')]);_0x3d1122['attributes']=_['intersection'](_0x5abb68['model'],qs[_0x793a('0x32')](_0x5a05e0[_0x793a('0x30')][_0x793a('0x32')]));_0x3d1122[_0x793a('0x33')]=_0x3d1122[_0x793a('0x33')]['length']?_0x3d1122[_0x793a('0x33')]:_0x5abb68[_0x793a('0x34')];if(!_0x5a05e0[_0x793a('0x30')]['hasOwnProperty'](_0x793a('0x35'))){_0x3d1122[_0x793a('0x1c')]=qs['limit'](_0x5a05e0[_0x793a('0x30')]['limit']);_0x3d1122[_0x793a('0x1a')]=qs[_0x793a('0x1a')](_0x5a05e0[_0x793a('0x30')][_0x793a('0x1a')]);}_0x3d1122[_0x793a('0x36')]=qs[_0x793a('0x37')](_0x5a05e0['query'][_0x793a('0x37')]);_0x3d1122[_0x793a('0x38')]=qs[_0x793a('0x39')](_[_0x793a('0x3a')](_0x5a05e0[_0x793a('0x30')],_0x5abb68['filters']),_0x514be8);if(_0x5a05e0[_0x793a('0x30')][_0x793a('0x3b')]){_0x3d1122[_0x793a('0x38')]=_[_0x793a('0x3c')](_0x3d1122['where'],{'$or':_[_0x793a('0x2a')](_0x514be8,function(_0x1faca5){if(_0x1faca5[_0x793a('0x2e')]!==_0x793a('0x3d')){var _0x5b8c74={};_0x5b8c74[_0x1faca5['name']]={'$like':'%'+_0x5a05e0[_0x793a('0x30')][_0x793a('0x3b')]+'%'};return _0x5b8c74;}})});}_0x3d1122=_[_0x793a('0x3c')]({},_0x3d1122,_0x5a05e0[_0x793a('0x3e')]);var _0x443dea={'where':_0x3d1122[_0x793a('0x38')]};return db[_0x793a('0x2b')][_0x793a('0x1d')](_0x443dea)[_0x793a('0x23')](function(_0x5f3183){_0x201946['count']=_0x5f3183;if(_0x5a05e0['query']['includeAll']){_0x3d1122[_0x793a('0x3f')]=[{'all':!![]}];}return db[_0x793a('0x2b')][_0x793a('0x40')](_0x3d1122);})[_0x793a('0x23')](function(_0x86f696){_0x201946[_0x793a('0x41')]=_0x86f696;return _0x201946;})[_0x793a('0x23')](respondWithFilteredResult(_0x17f3a2,_0x3d1122))[_0x793a('0x42')](handleError(_0x17f3a2,null));};exports['show']=function(_0x3959a0,_0x340e37){var _0xcfbec={'raw':!![],'where':{'id':_0x3959a0['params']['id']}},_0x3ad337={};_0x3ad337[_0x793a('0x34')]=_[_0x793a('0x31')](db[_0x793a('0x2b')][_0x793a('0x2c')]);_0x3ad337[_0x793a('0x30')]=_['keys'](_0x3959a0[_0x793a('0x30')]);_0x3ad337[_0x793a('0x39')]=_[_0x793a('0x43')](_0x3ad337[_0x793a('0x34')],_0x3ad337[_0x793a('0x30')]);_0xcfbec[_0x793a('0x33')]=_['intersection'](_0x3ad337[_0x793a('0x34')],qs['fields'](_0x3959a0[_0x793a('0x30')][_0x793a('0x32')]));_0xcfbec['attributes']=_0xcfbec[_0x793a('0x33')][_0x793a('0x44')]?_0xcfbec[_0x793a('0x33')]:_0x3ad337[_0x793a('0x34')];if(_0x3959a0[_0x793a('0x30')][_0x793a('0x45')]){_0xcfbec[_0x793a('0x3f')]=[{'all':!![]}];}_0xcfbec=_[_0x793a('0x3c')]({},_0xcfbec,_0x3959a0['options']);return db['JscriptySessionReport'][_0x793a('0x46')](_0xcfbec)['then'](handleEntityNotFound(_0x340e37,null))['then'](respondWithResult(_0x340e37,null))[_0x793a('0x42')](handleError(_0x340e37,null));};exports[_0x793a('0x47')]=function(_0x4c1fa1,_0x172be0){return db['JscriptySessionReport'][_0x793a('0x47')](_0x4c1fa1['body'],{})['then'](respondWithResult(_0x172be0,0xc9))[_0x793a('0x42')](handleError(_0x172be0,null));};exports['update']=function(_0x27472c,_0x1e4bd4){if(_0x27472c[_0x793a('0x48')]['id']){delete _0x27472c[_0x793a('0x48')]['id'];}return db['JscriptySessionReport'][_0x793a('0x46')]({'where':{'id':_0x27472c[_0x793a('0x49')]['id']}})[_0x793a('0x23')](handleEntityNotFound(_0x1e4bd4,null))[_0x793a('0x23')](saveUpdates(_0x27472c[_0x793a('0x48')],null))[_0x793a('0x23')](respondWithResult(_0x1e4bd4,null))[_0x793a('0x42')](handleError(_0x1e4bd4,null));};exports[_0x793a('0x24')]=function(_0x42dab8,_0x3698ba){return db[_0x793a('0x2b')][_0x793a('0x46')]({'where':{'id':_0x42dab8[_0x793a('0x49')]['id']}})[_0x793a('0x23')](handleEntityNotFound(_0x3698ba,null))[_0x793a('0x23')](removeEntity(_0x3698ba,null))[_0x793a('0x42')](handleError(_0x3698ba,null));};exports[_0x793a('0x4a')]=function(_0x4f5c33,_0x2476de){return db[_0x793a('0x2b')][_0x793a('0x4a')]()[_0x793a('0x23')](respondWithResult(_0x2476de,null))[_0x793a('0x42')](handleError(_0x2476de,null));};exports[_0x793a('0x4b')]=function(_0x5943bd,_0x221c18,_0x2152bd){var _0x3e979e={'raw':!![],'where':{}};var _0x43f25e={};var _0xcf2cfe={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x793a('0x4c')]({'where':{'id':_0x5943bd[_0x793a('0x49')]['id']}})['then'](handleEntityNotFound(_0x221c18,null))[_0x793a('0x23')](function(_0x1b0000){if(_0x1b0000){_0x43f25e[_0x793a('0x34')]=_[_0x793a('0x31')](db[_0x793a('0x4d')]['rawAttributes']);_0x43f25e[_0x793a('0x30')]=_['keys'](_0x5943bd[_0x793a('0x30')]);_0x43f25e[_0x793a('0x39')]=_['intersection'](_0x43f25e['model'],_0x43f25e[_0x793a('0x30')]);_0x3e979e[_0x793a('0x33')]=_[_0x793a('0x43')](_0x43f25e[_0x793a('0x34')],qs['fields'](_0x5943bd[_0x793a('0x30')][_0x793a('0x32')]));_0x3e979e['attributes']=_0x3e979e[_0x793a('0x33')][_0x793a('0x44')]?_0x3e979e['attributes']:_0x43f25e[_0x793a('0x34')];if(!_0x5943bd[_0x793a('0x30')]['hasOwnProperty'](_0x793a('0x35'))){_0x3e979e['limit']=qs[_0x793a('0x1c')](_0x5943bd[_0x793a('0x30')][_0x793a('0x1c')]);_0x3e979e[_0x793a('0x1a')]=qs[_0x793a('0x1a')](_0x5943bd['query'][_0x793a('0x1a')]);}_0x3e979e['order']=qs[_0x793a('0x37')](_0x5943bd['query'][_0x793a('0x37')]);_0x3e979e[_0x793a('0x38')]=qs[_0x793a('0x39')](_[_0x793a('0x3a')](_0x5943bd[_0x793a('0x30')],_0x43f25e['filters']));_0x3e979e[_0x793a('0x38')][_0x793a('0x4e')]=_0x1b0000['id'];if(_0x5943bd[_0x793a('0x30')][_0x793a('0x3b')]){_0x3e979e[_0x793a('0x38')]=_[_0x793a('0x3c')](_0x3e979e['where'],{'$or':_['map'](_0x3e979e[_0x793a('0x33')],function(_0x30c89b){var _0x272117={};_0x272117[_0x30c89b]={'$like':'%'+_0x5943bd['query']['filter']+'%'};return _0x272117;})});}_0x3e979e=_[_0x793a('0x3c')]({},_0x3e979e,_0x5943bd[_0x793a('0x3e')]);return db[_0x793a('0x4d')][_0x793a('0x1d')]({'where':_0x3e979e[_0x793a('0x38')]})['then'](function(_0x319274){_0xcf2cfe[_0x793a('0x1d')]=_0x319274;if(_0x5943bd[_0x793a('0x30')][_0x793a('0x45')]){_0x3e979e[_0x793a('0x3f')]=[{'all':!![]}];}return db[_0x793a('0x4d')]['findAll'](_0x3e979e);})[_0x793a('0x23')](function(_0x4b0e21){_0xcf2cfe['rows']=_0x4b0e21;return _0xcf2cfe;});}})['then'](respondWithFilteredResult(_0x221c18,_0x3e979e))[_0x793a('0x42')](handleError(_0x221c18,null));}; \ No newline at end of file +var _0x4b2e=['length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','rows','catch','params','include','options','create','body','find','describe','getQuestions','findOne','pick','SessionId','JscriptyQuestionReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','index','map','JscriptySessionReport','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x4b2e,0x10e));var _0xe4b2=function(_0x1f2221,_0xc743ce){_0x1f2221=_0x1f2221-0x0;var _0x348937=_0x4b2e[_0x1f2221];return _0x348937;};'use strict';var emlformat=require(_0xe4b2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4b2('0x1'));var jsonpatch=require(_0xe4b2('0x2'));var rp=require(_0xe4b2('0x3'));var moment=require(_0xe4b2('0x4'));var BPromise=require(_0xe4b2('0x5'));var Mustache=require(_0xe4b2('0x6'));var util=require(_0xe4b2('0x7'));var path=require(_0xe4b2('0x8'));var sox=require(_0xe4b2('0x9'));var csv=require(_0xe4b2('0xa'));var ejs=require(_0xe4b2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe4b2('0xc'));var squel=require(_0xe4b2('0xd'));var crypto=require(_0xe4b2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe4b2('0xf'));var toCsv=require(_0xe4b2('0xa'));var querystring=require(_0xe4b2('0x10'));var Papa=require(_0xe4b2('0x11'));var Redis=require(_0xe4b2('0x12'));var authService=require(_0xe4b2('0x13'));var qs=require(_0xe4b2('0x14'));var as=require(_0xe4b2('0x15'));var hardwareService=require(_0xe4b2('0x16'));var logger=require(_0xe4b2('0x17'))(_0xe4b2('0x18'));var utils=require(_0xe4b2('0x19'));var config=require(_0xe4b2('0x1a'));var licenseUtil=require(_0xe4b2('0x1b'));var db=require(_0xe4b2('0x1c'))['db'];function respondWithStatusCode(_0xc85c83,_0x5383e4){_0x5383e4=_0x5383e4||0xcc;return function(_0x3a0b8a){if(_0x3a0b8a){return _0xc85c83[_0xe4b2('0x1d')](_0x5383e4);}return _0xc85c83[_0xe4b2('0x1e')](_0x5383e4)[_0xe4b2('0x1f')]();};}function respondWithResult(_0x4d9914,_0x5adcc9){_0x5adcc9=_0x5adcc9||0xc8;return function(_0x168927){if(_0x168927){return _0x4d9914[_0xe4b2('0x1e')](_0x5adcc9)[_0xe4b2('0x20')](_0x168927);}};}function respondWithFilteredResult(_0xd0232b,_0x5aa6de){return function(_0x3ba400){if(_0x3ba400){var _0x61771b=typeof _0x5aa6de[_0xe4b2('0x21')]==='undefined'&&typeof _0x5aa6de[_0xe4b2('0x22')]==='undefined';var _0x245a3d=_0x3ba400[_0xe4b2('0x23')];var _0x50fc79=_0x61771b?0x0:_0x5aa6de[_0xe4b2('0x21')];var _0x1558b7=_0x61771b?_0x3ba400['count']:_0x5aa6de[_0xe4b2('0x21')]+_0x5aa6de[_0xe4b2('0x22')];var _0x68e18f;if(_0x1558b7>=_0x245a3d){_0x1558b7=_0x245a3d;_0x68e18f=0xc8;}else{_0x68e18f=0xce;}_0xd0232b[_0xe4b2('0x1e')](_0x68e18f);return _0xd0232b[_0xe4b2('0x24')](_0xe4b2('0x25'),_0x50fc79+'-'+_0x1558b7+'/'+_0x245a3d)[_0xe4b2('0x20')](_0x3ba400);}return null;};}function patchUpdates(_0x589122){return function(_0x34483c){try{jsonpatch[_0xe4b2('0x26')](_0x34483c,_0x589122,!![]);}catch(_0x33ba87){return BPromise[_0xe4b2('0x27')](_0x33ba87);}return _0x34483c[_0xe4b2('0x28')]();};}function saveUpdates(_0x4c0615,_0x58da7e){return function(_0x460159){if(_0x460159){return _0x460159[_0xe4b2('0x29')](_0x4c0615)['then'](function(_0x231160){return _0x231160;});}return null;};}function removeEntity(_0xdceb9d,_0x296221){return function(_0x3f5f1d){if(_0x3f5f1d){return _0x3f5f1d[_0xe4b2('0x2a')]()[_0xe4b2('0x2b')](function(){_0xdceb9d[_0xe4b2('0x1e')](0xcc)[_0xe4b2('0x1f')]();});}};}function handleEntityNotFound(_0x5d9de2,_0x1e0566){return function(_0x380969){if(!_0x380969){_0x5d9de2['sendStatus'](0x194);}return _0x380969;};}function handleError(_0x5e5310,_0x393cc9){_0x393cc9=_0x393cc9||0x1f4;return function(_0x2dca61){logger['error'](_0x2dca61[_0xe4b2('0x2c')]);if(_0x2dca61[_0xe4b2('0x2d')]){delete _0x2dca61[_0xe4b2('0x2d')];}_0x5e5310[_0xe4b2('0x1e')](_0x393cc9)['send'](_0x2dca61);};}exports[_0xe4b2('0x2e')]=function(_0x3f3aeb,_0x6ec50d){var _0x3b26b2={},_0x22e4e0={},_0x40b535={'count':0x0,'rows':[]};var _0xe07a57=_[_0xe4b2('0x2f')](db[_0xe4b2('0x30')][_0xe4b2('0x31')],function(_0x4db63b){return{'name':_0x4db63b['fieldName'],'type':_0x4db63b[_0xe4b2('0x32')]['key']};});_0x22e4e0[_0xe4b2('0x33')]=_['map'](_0xe07a57,'name');_0x22e4e0[_0xe4b2('0x34')]=_[_0xe4b2('0x35')](_0x3f3aeb[_0xe4b2('0x34')]);_0x22e4e0[_0xe4b2('0x36')]=_['intersection'](_0x22e4e0[_0xe4b2('0x33')],_0x22e4e0[_0xe4b2('0x34')]);_0x3b26b2[_0xe4b2('0x37')]=_[_0xe4b2('0x38')](_0x22e4e0[_0xe4b2('0x33')],qs[_0xe4b2('0x39')](_0x3f3aeb[_0xe4b2('0x34')][_0xe4b2('0x39')]));_0x3b26b2[_0xe4b2('0x37')]=_0x3b26b2[_0xe4b2('0x37')][_0xe4b2('0x3a')]?_0x3b26b2[_0xe4b2('0x37')]:_0x22e4e0['model'];if(!_0x3f3aeb['query'][_0xe4b2('0x3b')](_0xe4b2('0x3c'))){_0x3b26b2[_0xe4b2('0x22')]=qs[_0xe4b2('0x22')](_0x3f3aeb[_0xe4b2('0x34')][_0xe4b2('0x22')]);_0x3b26b2['offset']=qs[_0xe4b2('0x21')](_0x3f3aeb[_0xe4b2('0x34')]['offset']);}_0x3b26b2[_0xe4b2('0x3d')]=qs[_0xe4b2('0x3e')](_0x3f3aeb[_0xe4b2('0x34')]['sort']);_0x3b26b2[_0xe4b2('0x3f')]=qs[_0xe4b2('0x36')](_['pick'](_0x3f3aeb[_0xe4b2('0x34')],_0x22e4e0[_0xe4b2('0x36')]),_0xe07a57);if(_0x3f3aeb[_0xe4b2('0x34')][_0xe4b2('0x40')]){_0x3b26b2['where']=_[_0xe4b2('0x41')](_0x3b26b2['where'],{'$or':_['map'](_0xe07a57,function(_0x526555){if(_0x526555[_0xe4b2('0x32')]!==_0xe4b2('0x42')){var _0x4d74cc={};_0x4d74cc[_0x526555[_0xe4b2('0x2d')]]={'$like':'%'+_0x3f3aeb[_0xe4b2('0x34')][_0xe4b2('0x40')]+'%'};return _0x4d74cc;}})});}_0x3b26b2=_[_0xe4b2('0x41')]({},_0x3b26b2,_0x3f3aeb['options']);var _0x29d383={'where':_0x3b26b2[_0xe4b2('0x3f')]};return db[_0xe4b2('0x30')][_0xe4b2('0x23')](_0x29d383)[_0xe4b2('0x2b')](function(_0x4dc26c){_0x40b535[_0xe4b2('0x23')]=_0x4dc26c;if(_0x3f3aeb[_0xe4b2('0x34')][_0xe4b2('0x43')]){_0x3b26b2['include']=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x3b26b2);})[_0xe4b2('0x2b')](function(_0x373822){_0x40b535[_0xe4b2('0x44')]=_0x373822;return _0x40b535;})['then'](respondWithFilteredResult(_0x6ec50d,_0x3b26b2))[_0xe4b2('0x45')](handleError(_0x6ec50d,null));};exports['show']=function(_0xa35e99,_0x237459){var _0x2e64e6={'raw':!![],'where':{'id':_0xa35e99[_0xe4b2('0x46')]['id']}},_0x497a90={};_0x497a90[_0xe4b2('0x33')]=_[_0xe4b2('0x35')](db[_0xe4b2('0x30')][_0xe4b2('0x31')]);_0x497a90['query']=_['keys'](_0xa35e99['query']);_0x497a90['filters']=_[_0xe4b2('0x38')](_0x497a90[_0xe4b2('0x33')],_0x497a90[_0xe4b2('0x34')]);_0x2e64e6[_0xe4b2('0x37')]=_['intersection'](_0x497a90['model'],qs[_0xe4b2('0x39')](_0xa35e99[_0xe4b2('0x34')][_0xe4b2('0x39')]));_0x2e64e6[_0xe4b2('0x37')]=_0x2e64e6[_0xe4b2('0x37')][_0xe4b2('0x3a')]?_0x2e64e6[_0xe4b2('0x37')]:_0x497a90[_0xe4b2('0x33')];if(_0xa35e99[_0xe4b2('0x34')][_0xe4b2('0x43')]){_0x2e64e6[_0xe4b2('0x47')]=[{'all':!![]}];}_0x2e64e6=_[_0xe4b2('0x41')]({},_0x2e64e6,_0xa35e99[_0xe4b2('0x48')]);return db[_0xe4b2('0x30')]['find'](_0x2e64e6)['then'](handleEntityNotFound(_0x237459,null))[_0xe4b2('0x2b')](respondWithResult(_0x237459,null))[_0xe4b2('0x45')](handleError(_0x237459,null));};exports[_0xe4b2('0x49')]=function(_0x17405e,_0x3f4729){return db[_0xe4b2('0x30')]['create'](_0x17405e[_0xe4b2('0x4a')],{})[_0xe4b2('0x2b')](respondWithResult(_0x3f4729,0xc9))[_0xe4b2('0x45')](handleError(_0x3f4729,null));};exports[_0xe4b2('0x29')]=function(_0x2cc35a,_0x3ef69f){if(_0x2cc35a['body']['id']){delete _0x2cc35a['body']['id'];}return db[_0xe4b2('0x30')][_0xe4b2('0x4b')]({'where':{'id':_0x2cc35a['params']['id']}})['then'](handleEntityNotFound(_0x3ef69f,null))[_0xe4b2('0x2b')](saveUpdates(_0x2cc35a['body'],null))[_0xe4b2('0x2b')](respondWithResult(_0x3ef69f,null))['catch'](handleError(_0x3ef69f,null));};exports[_0xe4b2('0x2a')]=function(_0x2a8422,_0x3f285b){return db[_0xe4b2('0x30')]['find']({'where':{'id':_0x2a8422[_0xe4b2('0x46')]['id']}})[_0xe4b2('0x2b')](handleEntityNotFound(_0x3f285b,null))[_0xe4b2('0x2b')](removeEntity(_0x3f285b,null))[_0xe4b2('0x45')](handleError(_0x3f285b,null));};exports['describe']=function(_0x20b606,_0x251de0){return db['JscriptySessionReport'][_0xe4b2('0x4c')]()[_0xe4b2('0x2b')](respondWithResult(_0x251de0,null))[_0xe4b2('0x45')](handleError(_0x251de0,null));};exports[_0xe4b2('0x4d')]=function(_0x3eb17b,_0x2c0897,_0x456d74){var _0x3d4c73={'raw':!![],'where':{}};var _0x36b6e8={};var _0x244ca0={'count':0x0,'rows':[]};return db[_0xe4b2('0x30')][_0xe4b2('0x4e')]({'where':{'id':_0x3eb17b['params']['id']}})[_0xe4b2('0x2b')](handleEntityNotFound(_0x2c0897,null))[_0xe4b2('0x2b')](function(_0x3b5e80){if(_0x3b5e80){_0x36b6e8[_0xe4b2('0x33')]=_[_0xe4b2('0x35')](db['JscriptyQuestionReport'][_0xe4b2('0x31')]);_0x36b6e8['query']=_[_0xe4b2('0x35')](_0x3eb17b[_0xe4b2('0x34')]);_0x36b6e8[_0xe4b2('0x36')]=_['intersection'](_0x36b6e8[_0xe4b2('0x33')],_0x36b6e8[_0xe4b2('0x34')]);_0x3d4c73['attributes']=_[_0xe4b2('0x38')](_0x36b6e8['model'],qs[_0xe4b2('0x39')](_0x3eb17b[_0xe4b2('0x34')][_0xe4b2('0x39')]));_0x3d4c73['attributes']=_0x3d4c73['attributes'][_0xe4b2('0x3a')]?_0x3d4c73[_0xe4b2('0x37')]:_0x36b6e8[_0xe4b2('0x33')];if(!_0x3eb17b[_0xe4b2('0x34')][_0xe4b2('0x3b')](_0xe4b2('0x3c'))){_0x3d4c73[_0xe4b2('0x22')]=qs[_0xe4b2('0x22')](_0x3eb17b[_0xe4b2('0x34')][_0xe4b2('0x22')]);_0x3d4c73[_0xe4b2('0x21')]=qs[_0xe4b2('0x21')](_0x3eb17b['query'][_0xe4b2('0x21')]);}_0x3d4c73[_0xe4b2('0x3d')]=qs[_0xe4b2('0x3e')](_0x3eb17b['query'][_0xe4b2('0x3e')]);_0x3d4c73['where']=qs[_0xe4b2('0x36')](_[_0xe4b2('0x4f')](_0x3eb17b['query'],_0x36b6e8[_0xe4b2('0x36')]));_0x3d4c73[_0xe4b2('0x3f')][_0xe4b2('0x50')]=_0x3b5e80['id'];if(_0x3eb17b[_0xe4b2('0x34')][_0xe4b2('0x40')]){_0x3d4c73[_0xe4b2('0x3f')]=_[_0xe4b2('0x41')](_0x3d4c73[_0xe4b2('0x3f')],{'$or':_[_0xe4b2('0x2f')](_0x3d4c73[_0xe4b2('0x37')],function(_0x3a9ec0){var _0x4f5015={};_0x4f5015[_0x3a9ec0]={'$like':'%'+_0x3eb17b[_0xe4b2('0x34')][_0xe4b2('0x40')]+'%'};return _0x4f5015;})});}_0x3d4c73=_[_0xe4b2('0x41')]({},_0x3d4c73,_0x3eb17b[_0xe4b2('0x48')]);return db[_0xe4b2('0x51')][_0xe4b2('0x23')]({'where':_0x3d4c73[_0xe4b2('0x3f')]})[_0xe4b2('0x2b')](function(_0x283df3){_0x244ca0[_0xe4b2('0x23')]=_0x283df3;if(_0x3eb17b[_0xe4b2('0x34')]['includeAll']){_0x3d4c73[_0xe4b2('0x47')]=[{'all':!![]}];}return db[_0xe4b2('0x51')]['findAll'](_0x3d4c73);})['then'](function(_0x1019b0){_0x244ca0[_0xe4b2('0x44')]=_0x1019b0;return _0x244ca0;});}})[_0xe4b2('0x2b')](respondWithFilteredResult(_0x2c0897,_0x3d4c73))[_0xe4b2('0x45')](handleError(_0x2c0897,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 8fed655..3e1c5ca 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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2b9e76,_0x467e25){_0x2b9e76=_0x2b9e76-0x0;var _0x4c014e=_0x7fbe[_0x2b9e76];return _0x4c014e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71ab=['exports','define','JscriptySessionReport','report_jscripty_sessions','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x313ed1,_0x5cab6f){var _0xe36ac2=function(_0x2344f7){while(--_0x2344f7){_0x313ed1['push'](_0x313ed1['shift']());}};_0xe36ac2(++_0x5cab6f);}(_0x71ab,0x64));var _0xb71a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x71ab[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));module[_0xb71a('0x8')]=function(_0x38d931,_0x22c072){return _0x38d931[_0xb71a('0x9')](_0xb71a('0xa'),attributes,{'tableName':_0xb71a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 5223123..36cb146 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 _0x6455=['client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5a0d50,_0x3da336){var _0x4908a4=function(_0x4ed537){while(--_0x4ed537){_0x5a0d50['push'](_0x5a0d50['shift']());}};_0x4908a4(++_0x3da336);}(_0x6455,0x97));var _0x5645=function(_0x8f4bc1,_0x7d8961){_0x8f4bc1=_0x8f4bc1-0x0;var _0x5954f5=_0x6455[_0x8f4bc1];return _0x5954f5;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var moment=require(_0x5645('0x1'));var BPromise=require(_0x5645('0x2'));var rs=require(_0x5645('0x3'));var fs=require('fs');var Redis=require(_0x5645('0x4'));var db=require(_0x5645('0x5'))['db'];var utils=require(_0x5645('0x6'));var logger=require('../../config/logger')(_0x5645('0x7'));var config=require(_0x5645('0x8'));var jayson=require(_0x5645('0x9'));var client=jayson[_0x5645('0xa')][_0x5645('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37d672,_0xa14a06,_0x278d86){return new BPromise(function(_0x518a28,_0x5f4037){return client[_0x5645('0xc')](_0x37d672,_0x278d86)[_0x5645('0xd')](function(_0x38c07a){logger[_0x5645('0xe')](_0x5645('0xf'),_0xa14a06,_0x5645('0x10'));logger['debug'](_0x5645('0x11'),_0xa14a06,_0x5645('0x10'),JSON[_0x5645('0x12')](_0x38c07a));if(_0x38c07a[_0x5645('0x13')]){if(_0x38c07a['error'][_0x5645('0x14')]===0x1f4){logger['error'](_0x5645('0xf'),_0xa14a06,_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);return _0x5f4037(_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);}logger[_0x5645('0x13')](_0x5645('0xf'),_0xa14a06,_0x38c07a[_0x5645('0x13')]['message']);return _0x518a28(_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);}else{logger[_0x5645('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0xa14a06,'request\x20sent');_0x518a28(_0x38c07a[_0x5645('0x16')][_0x5645('0x15')]);}})['catch'](function(_0x35e0c7){logger[_0x5645('0x13')](_0x5645('0xf'),_0xa14a06,_0x35e0c7);_0x5f4037(_0x35e0c7);});});} \ No newline at end of file +var _0xd046=['ioredis','../../config/logger','../../config/environment','http','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xd046,0x129));var _0x6d04=function(_0x4ce515,_0x8256ac){_0x4ce515=_0x4ce515-0x0;var _0x1eec06=_0xd046[_0x4ce515];return _0x1eec06;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var moment=require(_0x6d04('0x1'));var BPromise=require(_0x6d04('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d04('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d04('0x4'))('rpc');var config=require(_0x6d04('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6d04('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1968c4,_0x4f83bc,_0x569c7b){return new BPromise(function(_0x2e2c01,_0x42aa22){return client['request'](_0x1968c4,_0x569c7b)['then'](function(_0x27a3d6){logger['info'](_0x6d04('0x7'),_0x4f83bc,'request\x20sent');logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x4f83bc,_0x6d04('0x8'),JSON[_0x6d04('0x9')](_0x27a3d6));if(_0x27a3d6[_0x6d04('0xa')]){if(_0x27a3d6[_0x6d04('0xa')]['code']===0x1f4){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x42aa22(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x2e2c01(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}else{logger[_0x6d04('0xc')](_0x6d04('0x7'),_0x4f83bc,_0x6d04('0x8'));_0x2e2c01(_0x27a3d6[_0x6d04('0xd')][_0x6d04('0xb')]);}})[_0x6d04('0xe')](function(_0xed5538){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0xed5538);_0x42aa22(_0xed5538);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index d631f89..b7985fd 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 _0x92f6=['/download_log_file','isAuthenticated','downloadLogFile','exports','multer','path','express','Router','../../components/interaction/service','get','index','/:id','update'];(function(_0x306fe9,_0x29053b){var _0x5caa25=function(_0x39c95a){while(--_0x39c95a){_0x306fe9['push'](_0x306fe9['shift']());}};_0x5caa25(++_0x29053b);}(_0x92f6,0x108));var _0x692f=function(_0xa77959,_0x2013c7){_0xa77959=_0xa77959-0x0;var _0x12c2d0=_0x92f6[_0xa77959];return _0x12c2d0;};'use strict';var multer=require(_0x692f('0x0'));var util=require('util');var path=require(_0x692f('0x1'));var timeout=require('connect-timeout');var express=require(_0x692f('0x2'));var router=express[_0x692f('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x692f('0x4'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0x692f('0x5')]('/',controller[_0x692f('0x6')]);router['put'](_0x692f('0x7'),auth['isAuthenticated'](),controller[_0x692f('0x8')]);router[_0x692f('0x5')](_0x692f('0x9'),auth[_0x692f('0xa')](),controller[_0x692f('0xb')]);module[_0x692f('0xc')]=router; \ No newline at end of file +var _0x8421=['index','/:id','isAuthenticated','update','get','/download_log_file','downloadLogFile','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x8421,0x69));var _0x1842=function(_0x349b6b,_0x595aa7){_0x349b6b=_0x349b6b-0x0;var _0x4b7e57=_0x8421[_0x349b6b];return _0x4b7e57;};'use strict';var multer=require('multer');var util=require(_0x1842('0x0'));var path=require(_0x1842('0x1'));var timeout=require(_0x1842('0x2'));var express=require(_0x1842('0x3'));var router=express['Router']();var fs_extra=require(_0x1842('0x4'));var auth=require(_0x1842('0x5'));var interaction=require(_0x1842('0x6'));var config=require('../../config/environment');var controller=require('./license.controller');router['get']('/',controller[_0x1842('0x7')]);router['put'](_0x1842('0x8'),auth[_0x1842('0x9')](),controller[_0x1842('0xa')]);router[_0x1842('0xb')](_0x1842('0xc'),auth[_0x1842('0x9')](),controller[_0x1842('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index bc826b6..985dc6a 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 _0x7b70=['STRING','exports','TEXT'];(function(_0x36958,_0x28eaa6){var _0x401eec=function(_0x42e71e){while(--_0x42e71e){_0x36958['push'](_0x36958['shift']());}};_0x401eec(++_0x28eaa6);}(_0x7b70,0x1d5));var _0x07b7=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x7b70[_0x35da42];return _0x370035;};'use strict';var Sequelize=require('sequelize');module[_0x07b7('0x0')]={'license':{'type':Sequelize[_0x07b7('0x1')]},'data1':{'type':Sequelize[_0x07b7('0x2')]},'data2':{'type':Sequelize[_0x07b7('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa476=['TEXT','INTEGER','exports'];(function(_0x2c681f,_0x3bbfba){var _0x261f6f=function(_0x26206b){while(--_0x26206b){_0x2c681f['push'](_0x2c681f['shift']());}};_0x261f6f(++_0x3bbfba);}(_0xa476,0xbf));var _0x6a47=function(_0x3a4b06,_0x2f31e1){_0x3a4b06=_0x3a4b06-0x0;var _0x732702=_0xa476[_0x3a4b06];return _0x732702;};'use strict';var Sequelize=require('sequelize');module[_0x6a47('0x0')]={'license':{'type':Sequelize[_0x6a47('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x6a47('0x2')],'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 8163446..9950e97 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 _0x547d=['count','apply','reject','save','update','then','destroy','error','stack','name','send','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields','getLicense','catch','body','License','find','params','get','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','log','xcally','Content-disposition','attachment;\x20filename=','set','Content-Type','text/plain','download','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit'];(function(_0x33e0a0,_0x482449){var _0x5bf08b=function(_0x373518){while(--_0x373518){_0x33e0a0['push'](_0x33e0a0['shift']());}};_0x5bf08b(++_0x482449);}(_0x547d,0x1d4));var _0xd547=function(_0x223552,_0x27dcaf){_0x223552=_0x223552-0x0;var _0x5117c3=_0x547d[_0x223552];return _0x5117c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd547('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd547('0x1'));var rp=require(_0xd547('0x2'));var moment=require('moment');var BPromise=require(_0xd547('0x3'));var Mustache=require(_0xd547('0x4'));var util=require('util');var path=require(_0xd547('0x5'));var sox=require(_0xd547('0x6'));var csv=require('to-csv');var ejs=require(_0xd547('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd547('0x8'));var squel=require(_0xd547('0x9'));var crypto=require(_0xd547('0xa'));var jsforce=require(_0xd547('0xb'));var deskjs=require(_0xd547('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd547('0xd'));var Papa=require(_0xd547('0xe'));var Redis=require('ioredis');var authService=require(_0xd547('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd547('0x10'));var hardwareService=require(_0xd547('0x11'));var logger=require(_0xd547('0x12'))(_0xd547('0x13'));var utils=require(_0xd547('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd547('0x15'));var db=require(_0xd547('0x16'))['db'];function respondWithStatusCode(_0x277ebc,_0x17b718){_0x17b718=_0x17b718||0xcc;return function(_0x479b13){if(_0x479b13){return _0x277ebc[_0xd547('0x17')](_0x17b718);}return _0x277ebc[_0xd547('0x18')](_0x17b718)['end']();};}function respondWithResult(_0x50cb14,_0x134a8f){_0x134a8f=_0x134a8f||0xc8;return function(_0x296fa3){if(_0x296fa3){return _0x50cb14[_0xd547('0x18')](_0x134a8f)[_0xd547('0x19')](_0x296fa3);}};}function respondWithFilteredResult(_0x510b4b,_0x541cad){return function(_0x35da92){if(_0x35da92){var _0x47f992=typeof _0x541cad[_0xd547('0x1a')]===_0xd547('0x1b')&&typeof _0x541cad[_0xd547('0x1c')]===_0xd547('0x1b');var _0x3663d3=_0x35da92[_0xd547('0x1d')];var _0x25c747=_0x47f992?0x0:_0x541cad[_0xd547('0x1a')];var _0x1cc632=_0x47f992?_0x35da92[_0xd547('0x1d')]:_0x541cad[_0xd547('0x1a')]+_0x541cad[_0xd547('0x1c')];var _0x53b282;if(_0x1cc632>=_0x3663d3){_0x1cc632=_0x3663d3;_0x53b282=0xc8;}else{_0x53b282=0xce;}_0x510b4b['status'](_0x53b282);return _0x510b4b['set']('Content-Range',_0x25c747+'-'+_0x1cc632+'/'+_0x3663d3)[_0xd547('0x19')](_0x35da92);}return null;};}function patchUpdates(_0x50b4a0){return function(_0x33da1b){try{jsonpatch[_0xd547('0x1e')](_0x33da1b,_0x50b4a0,!![]);}catch(_0x27b9bb){return BPromise[_0xd547('0x1f')](_0x27b9bb);}return _0x33da1b[_0xd547('0x20')]();};}function saveUpdates(_0x29abdb,_0x1bb030){return function(_0x1788ea){if(_0x1788ea){return _0x1788ea[_0xd547('0x21')](_0x29abdb)[_0xd547('0x22')](function(_0x21e5c8){return _0x21e5c8;});}return null;};}function removeEntity(_0x112971,_0x5afd53){return function(_0x265bc0){if(_0x265bc0){return _0x265bc0[_0xd547('0x23')]()[_0xd547('0x22')](function(){_0x112971['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e9653,_0x287e73){return function(_0x2476a6){if(!_0x2476a6){_0x5e9653['sendStatus'](0x194);}return _0x2476a6;};}function handleError(_0x29c0f5,_0xe56d6e){_0xe56d6e=_0xe56d6e||0x1f4;return function(_0x5a0bb8){logger[_0xd547('0x24')](_0x5a0bb8[_0xd547('0x25')]);if(_0x5a0bb8[_0xd547('0x26')]){delete _0x5a0bb8[_0xd547('0x26')];}_0x29c0f5[_0xd547('0x18')](_0xe56d6e)[_0xd547('0x27')](_0x5a0bb8);};}var utilLicense=require(_0xd547('0x15'));exports[_0xd547('0x28')]=function(_0x48895e,_0x25fe07){var _0x2644cd={'raw':!![],'where':{'id':0x1}},_0x1b463f={};_0x1b463f[_0xd547('0x29')]=_[_0xd547('0x2a')](db['License'][_0xd547('0x2b')]);_0x1b463f[_0xd547('0x2c')]=_[_0xd547('0x2a')](_0x48895e['query']);_0x1b463f[_0xd547('0x2d')]=_[_0xd547('0x2e')](_0x1b463f['model'],_0x1b463f['query']);_0x2644cd[_0xd547('0x2f')]=_['intersection'](_0x1b463f['model'],qs[_0xd547('0x30')](_0x48895e[_0xd547('0x2c')]['fields']));_0x2644cd[_0xd547('0x2f')]=_0x2644cd[_0xd547('0x2f')]['length']?_0x2644cd[_0xd547('0x2f')]:_0x1b463f[_0xd547('0x29')];_0x2644cd=_['merge']({},_0x2644cd,_0x48895e['options']);return utilLicense[_0xd547('0x31')](_0x2644cd)[_0xd547('0x22')](respondWithResult(_0x25fe07,null))[_0xd547('0x32')](handleError(_0x25fe07,null));};exports['update']=function(_0x4f8ef8,_0x515147){if(_0x4f8ef8[_0xd547('0x33')]['id']){delete _0x4f8ef8['body']['id'];}return db[_0xd547('0x34')][_0xd547('0x35')]({'where':{'id':_0x4f8ef8[_0xd547('0x36')]['id']}})[_0xd547('0x22')](handleEntityNotFound(_0x515147,null))[_0xd547('0x22')](function(_0x5cc851){var _0x58af38=_0x5cc851[_0xd547('0x37')]({'plain':!![]});return utilLicense[_0xd547('0x38')](_0x58af38,_0x4f8ef8['body'][_0xd547('0x39')]);})[_0xd547('0x22')](function(_0xea3b4c){if(!_0xea3b4c[_0xd547('0x3a')]){return saveUpdates(_0x4f8ef8['body'],null);}return _0xea3b4c;})['then'](respondWithResult(_0x515147,null))['catch'](handleError(_0x515147,null));};exports[_0xd547('0x3b')]=function(_0x4fcc87,_0x5243d6){var _0x3b1681=_0xd547('0x3c');var _0xafcf9=path[_0xd547('0x3d')](_0xd547('0x3e'),_0xd547('0x3f'),_0xd547('0x40'),_0x3b1681);_0x5243d6['setHeader'](_0xd547('0x41'),_0xd547('0x42')+_0x3b1681);_0x5243d6[_0xd547('0x43')](_0xd547('0x44'),_0xd547('0x45'));_0x5243d6[_0xd547('0x46')](_0xafcf9);}; \ No newline at end of file +var _0x290f=['length','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','demo','/var','log','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','name','send','keys','License','rawAttributes','query','filters','intersection','model','fields','attributes'];(function(_0x53d7e4,_0x195394){var _0x1db3a4=function(_0x9938de){while(--_0x9938de){_0x53d7e4['push'](_0x53d7e4['shift']());}};_0x1db3a4(++_0x195394);}(_0x290f,0x11e));var _0xf290=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x290f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf290('0x0'));var rimraf=require(_0xf290('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf290('0x2'));var rp=require('request-promise');var moment=require(_0xf290('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf290('0x4'));var util=require(_0xf290('0x5'));var path=require(_0xf290('0x6'));var sox=require(_0xf290('0x7'));var csv=require(_0xf290('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf290('0x9'));var _=require(_0xf290('0xa'));var squel=require('squel');var crypto=require(_0xf290('0xb'));var jsforce=require(_0xf290('0xc'));var deskjs=require(_0xf290('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf290('0xe'));var Redis=require('ioredis');var authService=require(_0xf290('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf290('0x10'));var logger=require(_0xf290('0x11'))(_0xf290('0x12'));var utils=require('../../config/utils');var config=require(_0xf290('0x13'));var licenseUtil=require(_0xf290('0x14'));var db=require(_0xf290('0x15'))['db'];function respondWithStatusCode(_0x15b4d7,_0x39ddee){_0x39ddee=_0x39ddee||0xcc;return function(_0x1d50f4){if(_0x1d50f4){return _0x15b4d7['sendStatus'](_0x39ddee);}return _0x15b4d7[_0xf290('0x16')](_0x39ddee)[_0xf290('0x17')]();};}function respondWithResult(_0x5641d0,_0x2113a4){_0x2113a4=_0x2113a4||0xc8;return function(_0x43c770){if(_0x43c770){return _0x5641d0[_0xf290('0x16')](_0x2113a4)['json'](_0x43c770);}};}function respondWithFilteredResult(_0x1a43cc,_0x2bc917){return function(_0x2a5ba1){if(_0x2a5ba1){var _0x41bc86=typeof _0x2bc917[_0xf290('0x18')]===_0xf290('0x19')&&typeof _0x2bc917[_0xf290('0x1a')]===_0xf290('0x19');var _0x193b0f=_0x2a5ba1[_0xf290('0x1b')];var _0x4f2d9d=_0x41bc86?0x0:_0x2bc917[_0xf290('0x18')];var _0x337f55=_0x41bc86?_0x2a5ba1[_0xf290('0x1b')]:_0x2bc917['offset']+_0x2bc917[_0xf290('0x1a')];var _0x500fe6;if(_0x337f55>=_0x193b0f){_0x337f55=_0x193b0f;_0x500fe6=0xc8;}else{_0x500fe6=0xce;}_0x1a43cc[_0xf290('0x16')](_0x500fe6);return _0x1a43cc[_0xf290('0x1c')](_0xf290('0x1d'),_0x4f2d9d+'-'+_0x337f55+'/'+_0x193b0f)[_0xf290('0x1e')](_0x2a5ba1);}return null;};}function patchUpdates(_0x5b7801){return function(_0x384846){try{jsonpatch[_0xf290('0x1f')](_0x384846,_0x5b7801,!![]);}catch(_0x9e975e){return BPromise[_0xf290('0x20')](_0x9e975e);}return _0x384846[_0xf290('0x21')]();};}function saveUpdates(_0x3b8488,_0x5aea7f){return function(_0x5a45ef){if(_0x5a45ef){return _0x5a45ef[_0xf290('0x22')](_0x3b8488)[_0xf290('0x23')](function(_0x549762){return _0x549762;});}return null;};}function removeEntity(_0xd3a11c,_0x3f53ac){return function(_0x2ff902){if(_0x2ff902){return _0x2ff902['destroy']()[_0xf290('0x23')](function(){_0xd3a11c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19b13c,_0x13c2de){return function(_0x454bab){if(!_0x454bab){_0x19b13c[_0xf290('0x24')](0x194);}return _0x454bab;};}function handleError(_0x24cf09,_0x4e2abb){_0x4e2abb=_0x4e2abb||0x1f4;return function(_0x520bbd){logger[_0xf290('0x25')](_0x520bbd['stack']);if(_0x520bbd['name']){delete _0x520bbd[_0xf290('0x26')];}_0x24cf09[_0xf290('0x16')](_0x4e2abb)[_0xf290('0x27')](_0x520bbd);};}var utilLicense=require(_0xf290('0x14'));exports['index']=function(_0x2f51b7,_0x5f22c7){var _0x2f580c={'raw':!![],'where':{'id':0x1}},_0x240b41={};_0x240b41['model']=_[_0xf290('0x28')](db[_0xf290('0x29')][_0xf290('0x2a')]);_0x240b41['query']=_[_0xf290('0x28')](_0x2f51b7[_0xf290('0x2b')]);_0x240b41[_0xf290('0x2c')]=_[_0xf290('0x2d')](_0x240b41[_0xf290('0x2e')],_0x240b41[_0xf290('0x2b')]);_0x2f580c['attributes']=_[_0xf290('0x2d')](_0x240b41[_0xf290('0x2e')],qs[_0xf290('0x2f')](_0x2f51b7[_0xf290('0x2b')]['fields']));_0x2f580c[_0xf290('0x30')]=_0x2f580c[_0xf290('0x30')][_0xf290('0x31')]?_0x2f580c[_0xf290('0x30')]:_0x240b41[_0xf290('0x2e')];_0x2f580c=_[_0xf290('0x32')]({},_0x2f580c,_0x2f51b7[_0xf290('0x33')]);return utilLicense[_0xf290('0x34')](_0x2f580c)[_0xf290('0x23')](respondWithResult(_0x5f22c7,null))[_0xf290('0x35')](handleError(_0x5f22c7,null));};exports[_0xf290('0x22')]=function(_0x2ae520,_0x29b49e){if(_0x2ae520[_0xf290('0x36')]['id']){delete _0x2ae520['body']['id'];}return db[_0xf290('0x29')][_0xf290('0x37')]({'where':{'id':_0x2ae520[_0xf290('0x38')]['id']}})[_0xf290('0x23')](handleEntityNotFound(_0x29b49e,null))[_0xf290('0x23')](function(_0x6a1571){var _0x29c4b3=_0x6a1571[_0xf290('0x39')]({'plain':!![]});return utilLicense[_0xf290('0x3a')](_0x29c4b3,_0x2ae520[_0xf290('0x36')][_0xf290('0x3b')]);})[_0xf290('0x23')](function(_0x228ce4){if(!_0x228ce4[_0xf290('0x3c')]){return saveUpdates(_0x2ae520[_0xf290('0x36')],null);}return _0x228ce4;})[_0xf290('0x23')](respondWithResult(_0x29b49e,null))[_0xf290('0x35')](handleError(_0x29b49e,null));};exports['downloadLogFile']=function(_0xd38b66,_0xefe661){var _0x2a0b6f='license-info.log';var _0x57aa22=path['join'](_0xf290('0x3d'),_0xf290('0x3e'),'xcally',_0x2a0b6f);_0xefe661[_0xf290('0x3f')](_0xf290('0x40'),_0xf290('0x41')+_0x2a0b6f);_0xefe661[_0xf290('0x1c')](_0xf290('0x42'),'text/plain');_0xefe661['download'](_0x57aa22);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 568614e..2dfccc7 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 _0x9a89=['path','rimraf','../../config/environment','exports','define','License','../../config/logger','api','bluebird','request-promise'];(function(_0x2230a8,_0x18f4df){var _0x491f9f=function(_0x8d21a7){while(--_0x8d21a7){_0x2230a8['push'](_0x2230a8['shift']());}};_0x491f9f(++_0x18f4df);}(_0x9a89,0x1d2));var _0x99a8=function(_0x1258e4,_0x4c7e2e){_0x1258e4=_0x1258e4-0x0;var _0x4781df=_0x9a89[_0x1258e4];return _0x4781df;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x99a8('0x0'))(_0x99a8('0x1'));var moment=require('moment');var BPromise=require(_0x99a8('0x2'));var rp=require(_0x99a8('0x3'));var fs=require('fs');var path=require(_0x99a8('0x4'));var rimraf=require(_0x99a8('0x5'));var config=require(_0x99a8('0x6'));var attributes=require('./license.attributes');module[_0x99a8('0x7')]=function(_0x1c1fb4,_0x3eba53){return _0x1c1fb4[_0x99a8('0x8')](_0x99a8('0x9'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fd7=['define','License','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./license.attributes','exports'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x8fd7,0xec));var _0x78fd=function(_0x42f844,_0x87db96){_0x42f844=_0x42f844-0x0;var _0x3b0376=_0x8fd7[_0x42f844];return _0x3b0376;};'use strict';var _=require(_0x78fd('0x0'));var util=require(_0x78fd('0x1'));var logger=require(_0x78fd('0x2'))(_0x78fd('0x3'));var moment=require(_0x78fd('0x4'));var BPromise=require(_0x78fd('0x5'));var rp=require(_0x78fd('0x6'));var fs=require('fs');var path=require(_0x78fd('0x7'));var rimraf=require('rimraf');var config=require(_0x78fd('0x8'));var attributes=require(_0x78fd('0x9'));module[_0x78fd('0xa')]=function(_0x3c7a81,_0x4da497){return _0x3c7a81[_0x78fd('0xb')](_0x78fd('0xc'),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 b223c31..6e7b9ef 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 _0x637e=['code','message','request\x20sent','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x58d937,_0x3550de){var _0x445496=function(_0x5dcc84){while(--_0x5dcc84){_0x58d937['push'](_0x58d937['shift']());}};_0x445496(++_0x3550de);}(_0x637e,0xc1));var _0xe637=function(_0x4d090e,_0x143ea2){_0x4d090e=_0x4d090e-0x0;var _0x368947=_0x637e[_0x4d090e];return _0x368947;};'use strict';var _=require(_0xe637('0x0'));var util=require('util');var moment=require(_0xe637('0x1'));var BPromise=require(_0xe637('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe637('0x3'));var db=require(_0xe637('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe637('0x5'))(_0xe637('0x6'));var config=require('../../config/environment');var jayson=require(_0xe637('0x7'));var client=jayson['client'][_0xe637('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1dfe8e,_0x3f5c64,_0xf51132){return new BPromise(function(_0x91515d,_0x387f39){return client[_0xe637('0x9')](_0x1dfe8e,_0xf51132)[_0xe637('0xa')](function(_0x2957b8){logger[_0xe637('0xb')](_0xe637('0xc'),_0x3f5c64,'request\x20sent');logger[_0xe637('0xd')](_0xe637('0xe'),_0x3f5c64,'request\x20sent',JSON[_0xe637('0xf')](_0x2957b8));if(_0x2957b8[_0xe637('0x10')]){if(_0x2957b8['error'][_0xe637('0x11')]===0x1f4){logger[_0xe637('0x10')](_0xe637('0xc'),_0x3f5c64,_0x2957b8[_0xe637('0x10')][_0xe637('0x12')]);return _0x387f39(_0x2957b8['error'][_0xe637('0x12')]);}logger[_0xe637('0x10')](_0xe637('0xc'),_0x3f5c64,_0x2957b8[_0xe637('0x10')][_0xe637('0x12')]);return _0x91515d(_0x2957b8[_0xe637('0x10')][_0xe637('0x12')]);}else{logger[_0xe637('0xb')](_0xe637('0xc'),_0x3f5c64,_0xe637('0x13'));_0x91515d(_0x2957b8[_0xe637('0x14')]['message']);}})['catch'](function(_0x3ee919){logger[_0xe637('0x10')](_0xe637('0xc'),_0x3f5c64,_0x3ee919);_0x387f39(_0x3ee919);});});} \ No newline at end of file +var _0x27a9=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','util','moment','randomstring'];(function(_0x478636,_0x336183){var _0xdee60=function(_0x175578){while(--_0x175578){_0x478636['push'](_0x478636['shift']());}};_0xdee60(++_0x336183);}(_0x27a9,0xad));var _0x927a=function(_0x3ea92b,_0x480631){_0x3ea92b=_0x3ea92b-0x0;var _0x371fc2=_0x27a9[_0x3ea92b];return _0x371fc2;};'use strict';var _=require('lodash');var util=require(_0x927a('0x0'));var moment=require(_0x927a('0x1'));var BPromise=require('bluebird');var rs=require(_0x927a('0x2'));var fs=require('fs');var Redis=require(_0x927a('0x3'));var db=require(_0x927a('0x4'))['db'];var utils=require(_0x927a('0x5'));var logger=require(_0x927a('0x6'))('rpc');var config=require(_0x927a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x927a('0x8')][_0x927a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3baddf,_0x338869,_0x4db689){return new BPromise(function(_0x1c42d2,_0x1fd01a){return client[_0x927a('0xa')](_0x3baddf,_0x4db689)[_0x927a('0xb')](function(_0x49eb30){logger[_0x927a('0xc')]('License,\x20%s,\x20%s',_0x338869,_0x927a('0xd'));logger[_0x927a('0xe')](_0x927a('0xf'),_0x338869,_0x927a('0xd'),JSON[_0x927a('0x10')](_0x49eb30));if(_0x49eb30['error']){if(_0x49eb30[_0x927a('0x11')][_0x927a('0x12')]===0x1f4){logger[_0x927a('0x11')](_0x927a('0x13'),_0x338869,_0x49eb30[_0x927a('0x11')][_0x927a('0x14')]);return _0x1fd01a(_0x49eb30[_0x927a('0x11')][_0x927a('0x14')]);}logger[_0x927a('0x11')](_0x927a('0x13'),_0x338869,_0x49eb30['error'][_0x927a('0x14')]);return _0x1c42d2(_0x49eb30[_0x927a('0x11')][_0x927a('0x14')]);}else{logger[_0x927a('0xc')](_0x927a('0x13'),_0x338869,_0x927a('0xd'));_0x1c42d2(_0x49eb30[_0x927a('0x15')][_0x927a('0x14')]);}})['catch'](function(_0x40a0ae){logger[_0x927a('0x11')](_0x927a('0x13'),_0x338869,_0x40a0ae);_0x1fd01a(_0x40a0ae);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 3646f4a..6a8622f 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 _0xaebf=['removeDispositions','removeAnswers','removeSmtp','/:id','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','/:id/users','post','addDisposition','addAnswer','create','addImap','addSmtp','addApplications','/:id/send','addAgents','update','delete'];(function(_0x41b6f5,_0x1ad42f){var _0x5d6142=function(_0xb46850){while(--_0xb46850){_0x41b6f5['push'](_0x41b6f5['shift']());}};_0x5d6142(++_0x1ad42f);}(_0xaebf,0x17f));var _0xfaeb=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xaebf[_0x49b207];return _0x2dc8fa;};'use strict';var multer=require(_0xfaeb('0x0'));var util=require(_0xfaeb('0x1'));var path=require('path');var timeout=require(_0xfaeb('0x2'));var express=require(_0xfaeb('0x3'));var router=express[_0xfaeb('0x4')]();var fs_extra=require(_0xfaeb('0x5'));var auth=require(_0xfaeb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfaeb('0x7'));var controller=require(_0xfaeb('0x8'));router[_0xfaeb('0x9')]('/',auth[_0xfaeb('0xa')](),controller[_0xfaeb('0xb')]);router['get'](_0xfaeb('0xc'),auth['isAuthenticated'](),controller[_0xfaeb('0xd')]);router[_0xfaeb('0x9')]('/:id',auth[_0xfaeb('0xa')](),controller[_0xfaeb('0xe')]);router['get'](_0xfaeb('0xf'),auth[_0xfaeb('0xa')](),controller['getDispositions']);router[_0xfaeb('0x9')](_0xfaeb('0x10'),auth[_0xfaeb('0xa')](),controller[_0xfaeb('0x11')]);router[_0xfaeb('0x9')](_0xfaeb('0x12'),auth['isAuthenticated'](),controller[_0xfaeb('0x13')]);router[_0xfaeb('0x9')](_0xfaeb('0x14'),auth[_0xfaeb('0xa')](),controller[_0xfaeb('0x15')]);router[_0xfaeb('0x9')](_0xfaeb('0x16'),auth['isAuthenticated'](),controller[_0xfaeb('0x17')]);router[_0xfaeb('0x9')](_0xfaeb('0x18'),auth[_0xfaeb('0xa')](),controller[_0xfaeb('0x19')]);router[_0xfaeb('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0xfaeb('0x1a')]);router['get'](_0xfaeb('0x1b'),auth[_0xfaeb('0xa')](),controller['verifySmtp']);router[_0xfaeb('0x9')](_0xfaeb('0x1c'),auth[_0xfaeb('0xa')](),controller['getAgents']);router[_0xfaeb('0x1d')](_0xfaeb('0xf'),auth[_0xfaeb('0xa')](),controller[_0xfaeb('0x1e')]);router['post']('/:id/canned_answers',auth[_0xfaeb('0xa')](),controller[_0xfaeb('0x1f')]);router[_0xfaeb('0x1d')]('/',auth[_0xfaeb('0xa')](),controller[_0xfaeb('0x20')]);router[_0xfaeb('0x1d')](_0xfaeb('0x12'),auth['isAuthenticated'](),controller[_0xfaeb('0x21')]);router[_0xfaeb('0x1d')]('/:id/out_servers',auth[_0xfaeb('0xa')](),controller[_0xfaeb('0x22')]);router[_0xfaeb('0x1d')](_0xfaeb('0x16'),auth[_0xfaeb('0xa')](),controller['addInteraction']);router[_0xfaeb('0x1d')]('/:id/applications',auth['isAuthenticated'](),controller[_0xfaeb('0x23')]);router[_0xfaeb('0x1d')](_0xfaeb('0x24'),auth[_0xfaeb('0xa')](),controller['send']);router['post'](_0xfaeb('0x1c'),auth[_0xfaeb('0xa')](),controller[_0xfaeb('0x25')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xfaeb('0x26')]);router[_0xfaeb('0x27')]('/:id/dispositions',auth[_0xfaeb('0xa')](),controller[_0xfaeb('0x28')]);router['delete'](_0xfaeb('0x10'),auth[_0xfaeb('0xa')](),controller[_0xfaeb('0x29')]);router[_0xfaeb('0x27')](_0xfaeb('0x12'),auth[_0xfaeb('0xa')](),controller['removeImap']);router['delete'](_0xfaeb('0x14'),auth[_0xfaeb('0xa')](),controller[_0xfaeb('0x2a')]);router[_0xfaeb('0x27')](_0xfaeb('0x2b'),auth[_0xfaeb('0xa')](),controller[_0xfaeb('0x2c')]);router['delete'](_0xfaeb('0x1c'),auth[_0xfaeb('0xa')](),controller[_0xfaeb('0x2d')]);module[_0xfaeb('0x2e')]=router; \ No newline at end of file +var _0x291a=['/:id','destroy','removeAgents','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','show','getDispositions','/:id/canned_answers','/:id/in_servers','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getMessages','verifySmtp','/:id/users','getAgents','/:id/dispositions','addDisposition','post','addAnswer','create','addImap','addSmtp','/:id/interactions','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeImap','removeSmtp'];(function(_0x10c16d,_0x2b3e14){var _0x5896f4=function(_0x4306b9){while(--_0x4306b9){_0x10c16d['push'](_0x10c16d['shift']());}};_0x5896f4(++_0x2b3e14);}(_0x291a,0x1a2));var _0xa291=function(_0x4c6233,_0x12bc76){_0x4c6233=_0x4c6233-0x0;var _0x1949b4=_0x291a[_0x4c6233];return _0x1949b4;};'use strict';var multer=require(_0xa291('0x0'));var util=require('util');var path=require(_0xa291('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa291('0x2')]();var fs_extra=require(_0xa291('0x3'));var auth=require(_0xa291('0x4'));var interaction=require(_0xa291('0x5'));var config=require(_0xa291('0x6'));var controller=require(_0xa291('0x7'));router[_0xa291('0x8')]('/',auth[_0xa291('0x9')](),controller[_0xa291('0xa')]);router[_0xa291('0x8')](_0xa291('0xb'),auth[_0xa291('0x9')](),controller[_0xa291('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa291('0xd')]);router[_0xa291('0x8')]('/:id/dispositions',auth[_0xa291('0x9')](),controller[_0xa291('0xe')]);router[_0xa291('0x8')](_0xa291('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xa291('0x8')](_0xa291('0x10'),auth[_0xa291('0x9')](),controller['getImap']);router['get'](_0xa291('0x11'),auth[_0xa291('0x9')](),controller[_0xa291('0x12')]);router[_0xa291('0x8')]('/:id/interactions',auth[_0xa291('0x9')](),controller[_0xa291('0x13')]);router[_0xa291('0x8')](_0xa291('0x14'),auth['isAuthenticated'](),controller['getApplications']);router[_0xa291('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0xa291('0x15')]);router[_0xa291('0x8')]('/:id/verify',auth[_0xa291('0x9')](),controller[_0xa291('0x16')]);router[_0xa291('0x8')](_0xa291('0x17'),auth[_0xa291('0x9')](),controller[_0xa291('0x18')]);router['post'](_0xa291('0x19'),auth[_0xa291('0x9')](),controller[_0xa291('0x1a')]);router[_0xa291('0x1b')](_0xa291('0xf'),auth[_0xa291('0x9')](),controller[_0xa291('0x1c')]);router[_0xa291('0x1b')]('/',auth[_0xa291('0x9')](),controller[_0xa291('0x1d')]);router[_0xa291('0x1b')](_0xa291('0x10'),auth[_0xa291('0x9')](),controller[_0xa291('0x1e')]);router[_0xa291('0x1b')](_0xa291('0x11'),auth[_0xa291('0x9')](),controller[_0xa291('0x1f')]);router['post'](_0xa291('0x20'),auth[_0xa291('0x9')](),controller['addInteraction']);router['post'](_0xa291('0x14'),auth['isAuthenticated'](),controller['addApplications']);router[_0xa291('0x1b')](_0xa291('0x21'),auth[_0xa291('0x9')](),controller[_0xa291('0x22')]);router[_0xa291('0x1b')](_0xa291('0x17'),auth['isAuthenticated'](),controller[_0xa291('0x23')]);router[_0xa291('0x24')]('/:id',auth[_0xa291('0x9')](),controller[_0xa291('0x25')]);router[_0xa291('0x26')](_0xa291('0x19'),auth[_0xa291('0x9')](),controller[_0xa291('0x27')]);router[_0xa291('0x26')]('/:id/canned_answers',auth[_0xa291('0x9')](),controller['removeAnswers']);router[_0xa291('0x26')](_0xa291('0x10'),auth[_0xa291('0x9')](),controller[_0xa291('0x28')]);router[_0xa291('0x26')](_0xa291('0x11'),auth[_0xa291('0x9')](),controller[_0xa291('0x29')]);router[_0xa291('0x26')](_0xa291('0x2a'),auth[_0xa291('0x9')](),controller[_0xa291('0x2b')]);router['delete'](_0xa291('0x17'),auth[_0xa291('0x9')](),controller[_0xa291('0x2c')]);module[_0xa291('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 1ce62b0..5979e18 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 _0xe6ce=['BOOLEAN','STRING','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','mandatoryDispositionPauseId','mandatoryDisposition','yahoo','provider','custom','setDataValue','sequelize'];(function(_0x4a965c,_0x4cb8c6){var _0x169dac=function(_0x2d6cb4){while(--_0x2d6cb4){_0x4a965c['push'](_0x4a965c['shift']());}};_0x169dac(++_0x4cb8c6);}(_0xe6ce,0x15e));var _0xee6c=function(_0x3fe35e,_0x589082){_0x3fe35e=_0x3fe35e-0x0;var _0x12728a=_0xe6ce[_0x3fe35e];return _0x12728a;};'use strict';var Sequelize=require(_0xee6c('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xee6c('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xee6c('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xee6c('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0xee6c('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xee6c('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xee6c('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xee6c('0x4')](0x2)[_0xee6c('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xee6c('0x3')],'defaultValue':function(){return _0xee6c('0x6');}},'notificationSound':{'type':Sequelize[_0xee6c('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xee6c('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xee6c('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xee6c('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xee6c('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xee6c('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xee6c('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xee6c('0x4')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xee6c('0x1')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x186e2a){if(!_0x186e2a)this['setDataValue'](_0xee6c('0x7'),null);this['setDataValue'](_0xee6c('0x8'),_0x186e2a);}},'provider':{'type':Sequelize['ENUM']('gmail','hotmail',_0xee6c('0x9'),'outlook365'),'defaultValue':null,'get':function(){var _0x396d45=this['getDataValue'](_0xee6c('0xa'));return _0x396d45||_0xee6c('0xb');},'set':function(_0x2b6e17){if(_0x2b6e17==='custom'){_0x2b6e17=null;}return this[_0xee6c('0xc')](_0xee6c('0xa'),_0x2b6e17);}}}; \ No newline at end of file +var _0x1470=['mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','ENUM','hotmail','yahoo','outlook365','provider','custom','sequelize','exports','BOOLEAN','STRING','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT'];(function(_0x2b8eb3,_0x42b718){var _0x3d6b02=function(_0x226b82){while(--_0x226b82){_0x2b8eb3['push'](_0x2b8eb3['shift']());}};_0x3d6b02(++_0x42b718);}(_0x1470,0x108));var _0x0147=function(_0x5e7b40,_0xe07e35){_0x5e7b40=_0x5e7b40-0x0;var _0x20a7d4=_0x1470[_0x5e7b40];return _0x20a7d4;};'use strict';var Sequelize=require(_0x0147('0x0'));module[_0x0147('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x0147('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x0147('0x3')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x0147('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x0147('0x3')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x0147('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x0147('0x3')],'allowNull':![],'defaultValue':_0x0147('0x4')},'fontSize':{'type':Sequelize[_0x0147('0x5')](0x2)[_0x0147('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x0147('0x7')],'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['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0147('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0147('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0147('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0147('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0147('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0147('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0147('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5c724b){if(!_0x5c724b)this['setDataValue'](_0x0147('0x8'),null);this[_0x0147('0x9')](_0x0147('0xa'),_0x5c724b);}},'provider':{'type':Sequelize[_0x0147('0xb')]('gmail',_0x0147('0xc'),_0x0147('0xd'),_0x0147('0xe')),'defaultValue':null,'get':function(){var _0x3af250=this['getDataValue'](_0x0147('0xf'));return _0x3af250||_0x0147('0x10');},'set':function(_0x4232a8){if(_0x4232a8===_0x0147('0x10')){_0x4232a8=null;}return this[_0x0147('0x9')](_0x0147('0xf'),_0x4232a8);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index fa0d22e..7eaeffb 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 _0x3ce4=['yahoo','hotmail','outlook365','outlook.office365.com','gmail','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model','name','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Pause','length','find','body','custom','secure','Mail\x20Account\x20not\x20found','describe','MailAccountId','Disposition','create','getDispositions','findOne','pick','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','provider','email','ListId','isNil','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','json','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','List','CmContact','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','root','server/files/attachments','getSmtpOptions','sendMail','messageId','subject','out','Interaction','Messages','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','User','bluebird','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','update','destroy','MailAccounts','UserProfileResource','stack','send','imap.gmail.com'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ce4,0x15e));var _0x43ce=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x3ce4[_0x4fbfd9];return _0x31dc94;};'use strict';var moment=require('moment');var BPromise=require(_0x43ce('0x0'));var util=require(_0x43ce('0x1'));var path=require(_0x43ce('0x2'));var _=require(_0x43ce('0x3'));var juice=require(_0x43ce('0x4'));var Redis=require('ioredis');var qs=require(_0x43ce('0x5'));var logger=require(_0x43ce('0x6'))('api');var config=require(_0x43ce('0x7'));var db=require('../../mysqldb')['db'];config[_0x43ce('0x8')]=_[_0x43ce('0x9')](config[_0x43ce('0x8')],{'host':_0x43ce('0xa'),'port':0x18eb});var socket=require(_0x43ce('0xb'))(new Redis(config[_0x43ce('0x8')]));require(_0x43ce('0xc'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x43ce('0xd')][_0x43ce('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x233fdb,_0x4dee95,_0x3ddabd,_0x46cd10){return new BPromise(function(_0x23dd95,_0x3f5039){var _0x407d69=_0x46cd10||client;return _0x407d69[_0x43ce('0xf')](_0x233fdb,_0x3ddabd)[_0x43ce('0x10')](function(_0x385965){logger[_0x43ce('0x11')](_0x43ce('0x12'),_0x4dee95,_0x43ce('0x13'));logger[_0x43ce('0x14')](_0x43ce('0x15'),_0x4dee95,_0x43ce('0x13'),JSON[_0x43ce('0x16')](_0x385965));if(_0x385965[_0x43ce('0x17')]){if(_0x385965[_0x43ce('0x17')][_0x43ce('0x18')]===0x1f4){logger[_0x43ce('0x17')](_0x43ce('0x12'),_0x4dee95,_0x385965[_0x43ce('0x17')]['message']);return _0x3f5039(_0x385965[_0x43ce('0x17')]['message']);}logger['error'](_0x43ce('0x12'),_0x4dee95,_0x385965[_0x43ce('0x17')]['message']);return _0x23dd95(_0x385965[_0x43ce('0x17')][_0x43ce('0x19')]);}else{logger[_0x43ce('0x11')](_0x43ce('0x12'),_0x4dee95,_0x43ce('0x13'));_0x23dd95(_0x385965[_0x43ce('0x1a')][_0x43ce('0x19')]);}})[_0x43ce('0x1b')](function(_0x4efe8f){logger[_0x43ce('0x17')]('MailAccount,\x20%s,\x20%s',_0x4dee95,_0x4efe8f);_0x3f5039(_0x4efe8f);});});}function respondWithStatusCode(_0x225bb6,_0xf878a1){_0xf878a1=_0xf878a1||0xcc;return function(_0x2bf40e){if(_0x2bf40e){return _0x225bb6[_0x43ce('0x1c')](_0xf878a1);}return _0x225bb6['status'](_0xf878a1)[_0x43ce('0x1d')]();};}function respondWithResult(_0x123074,_0x5ad378){_0x5ad378=_0x5ad378||0xc8;return function(_0x3f9fdb){if(_0x3f9fdb){return _0x123074[_0x43ce('0x1e')](_0x5ad378)['json'](_0x3f9fdb);}};}function respondWithFilteredResult(_0x1f9cdb,_0x5ca2e){return function(_0x21163e){if(_0x21163e){var _0x5dc030=typeof _0x5ca2e['offset']==='undefined'&&typeof _0x5ca2e[_0x43ce('0x1f')]===_0x43ce('0x20');var _0x4ac828=_0x21163e[_0x43ce('0x21')];var _0x2188f7=_0x5dc030?0x0:_0x5ca2e[_0x43ce('0x22')];var _0x9de36b=_0x5dc030?_0x21163e[_0x43ce('0x21')]:_0x5ca2e[_0x43ce('0x22')]+_0x5ca2e[_0x43ce('0x1f')];var _0x391241;if(_0x9de36b>=_0x4ac828){_0x9de36b=_0x4ac828;_0x391241=0xc8;}else{_0x391241=0xce;}_0x1f9cdb[_0x43ce('0x1e')](_0x391241);return _0x1f9cdb[_0x43ce('0x23')](_0x43ce('0x24'),_0x2188f7+'-'+_0x9de36b+'/'+_0x4ac828)['json'](_0x21163e);}return null;};}function saveUpdates(_0x16732e){return function(_0x5303ce){if(_0x5303ce){return _0x5303ce[_0x43ce('0x25')](_0x16732e)[_0x43ce('0x10')](function(_0x376fbc){return _0x376fbc;});}return null;};}function removeEntity(_0x4aa5a9){return function(_0x241c35){if(_0x241c35){return _0x241c35[_0x43ce('0x26')]()[_0x43ce('0x10')](function(){var _0x558e59=_0x241c35['get']({'plain':!![]});var _0x2f7ded=_0x43ce('0x27');return db[_0x43ce('0x28')][_0x43ce('0x26')]({'where':{'type':_0x2f7ded,'resourceId':_0x558e59['id']}})[_0x43ce('0x10')](function(){return _0x241c35;});})[_0x43ce('0x10')](function(){_0x4aa5a9[_0x43ce('0x1e')](0xcc)[_0x43ce('0x1d')]();});}};}function handleEntityNotFound(_0x5a538d){return function(_0x1d1b8f){if(!_0x1d1b8f){_0x5a538d['sendStatus'](0x194);}return _0x1d1b8f;};}function handleError(_0x599008,_0x184ebf){_0x184ebf=_0x184ebf||0x1f4;return function(_0x5dcbb3){logger['error'](_0x5dcbb3[_0x43ce('0x29')]);if(_0x5dcbb3['name']){delete _0x5dcbb3['name'];}_0x599008['status'](_0x184ebf)[_0x43ce('0x2a')](_0x5dcbb3);};}function getImapHost(_0x16a12d){switch(_0x16a12d){case'gmail':return _0x43ce('0x2b');case _0x43ce('0x2c'):return'imap.mail.yahoo.com';case _0x43ce('0x2d'):return'imap-mail.outlook.com';case _0x43ce('0x2e'):return _0x43ce('0x2f');}throw new Error('Unknown\x20email\x20service\x20provider',_0x16a12d);}function getSmtpHost(_0x510037){switch(_0x510037){case _0x43ce('0x30'):return _0x43ce('0x31');case _0x43ce('0x2c'):return _0x43ce('0x32');case'hotmail':return _0x43ce('0x33');case'outlook365':return'smtp.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x510037);}function getAuthenticationOptions(_0x67f065,_0x320658){var _0xc9a608={};var _0x37f915={};if(_0x67f065){_0xc9a608[_0x43ce('0x34')]=_0x37f915['user']=_0x320658[_0x43ce('0x35')];_0xc9a608[_0x43ce('0x36')]=_0x37f915[_0x43ce('0x37')]=_0x320658['password'];if(_0x320658[_0x43ce('0x38')]){_0xc9a608[_0x43ce('0x38')]=_0x37f915[_0x43ce('0x38')]=!![];_0xc9a608[_0x43ce('0x39')]=_0x37f915[_0x43ce('0x39')]=_0x320658[_0x43ce('0x39')];_0xc9a608[_0x43ce('0x36')]=_0x37f915[_0x43ce('0x37')]=null;}else{_0xc9a608[_0x43ce('0x39')]=_0x37f915['CloudProviderId']=null;}_0xc9a608[_0x43ce('0x3a')]=getImapHost(_0x67f065);_0xc9a608[_0x43ce('0x3b')]=0x3e1;_0x37f915['host']=getSmtpHost(_0x67f065);_0x37f915[_0x43ce('0x3b')]=0x24b;_0x37f915['secure']=![];_0xc9a608[_0x43ce('0x3c')]=_0x37f915[_0x43ce('0x3c')]=null;}else{if(_0x320658['authentication']){_0xc9a608[_0x43ce('0x34')]=_0x37f915[_0x43ce('0x34')]=_0x320658['username'];_0xc9a608[_0x43ce('0x36')]=_0x37f915['pass']=_0x320658[_0x43ce('0x36')];}else{_0xc9a608['authentication']=_0x37f915[_0x43ce('0x3d')]=![];_0xc9a608[_0x43ce('0x34')]=_0x37f915[_0x43ce('0x34')]=null;_0xc9a608[_0x43ce('0x36')]=_0x37f915['pass']=null;}_0xc9a608[_0x43ce('0x3a')]=_0x320658['Imap'][_0x43ce('0x3a')];_0xc9a608['port']=_0x320658[_0x43ce('0x3e')]['port'];_0x37f915[_0x43ce('0x3a')]=_0x320658['Smtp']['host'];_0x37f915[_0x43ce('0x3b')]=_0x320658[_0x43ce('0x3f')][_0x43ce('0x3b')];}return{'Imap':_0xc9a608,'Smtp':_0x37f915};}exports[_0x43ce('0x40')]=function(_0xfd41d,_0x54acc3){var _0xd5bf41={'include':[{'model':db[_0x43ce('0x41')],'as':_0x43ce('0x3e')},{'model':db[_0x43ce('0x42')],'as':_0x43ce('0x3f')},{'model':db['Pause'],'as':_0x43ce('0x43')}]},_0x27c560={},_0x2acc17={'count':0x0,'rows':[]};var _0x46437f=_[_0x43ce('0x44')](db[_0x43ce('0x45')][_0x43ce('0x46')],function(_0x593c47){return{'name':_0x593c47[_0x43ce('0x47')],'type':_0x593c47['type'][_0x43ce('0x48')]};});_0x27c560[_0x43ce('0x49')]=_[_0x43ce('0x44')](_0x46437f,_0x43ce('0x4a'));_0x27c560['query']=_[_0x43ce('0x4b')](_0xfd41d[_0x43ce('0x4c')]);_0x27c560[_0x43ce('0x4d')]=_[_0x43ce('0x4e')](_0x27c560[_0x43ce('0x49')],_0x27c560[_0x43ce('0x4c')]);_0xd5bf41['attributes']=_[_0x43ce('0x4e')](_0x27c560['model'],qs[_0x43ce('0x4f')](_0xfd41d['query'][_0x43ce('0x4f')]));_0xd5bf41[_0x43ce('0x50')]=_0xd5bf41[_0x43ce('0x50')]['length']?_0xd5bf41[_0x43ce('0x50')]:_0x27c560[_0x43ce('0x49')];if(!_0xfd41d[_0x43ce('0x4c')][_0x43ce('0x51')](_0x43ce('0x52'))){_0xd5bf41[_0x43ce('0x1f')]=qs[_0x43ce('0x1f')](_0xfd41d[_0x43ce('0x4c')][_0x43ce('0x1f')]);_0xd5bf41[_0x43ce('0x22')]=qs[_0x43ce('0x22')](_0xfd41d[_0x43ce('0x4c')][_0x43ce('0x22')]);}_0xd5bf41[_0x43ce('0x53')]=qs['sort'](_0xfd41d['query'][_0x43ce('0x54')]);_0xd5bf41[_0x43ce('0x55')]=qs[_0x43ce('0x4d')](_['pick'](_0xfd41d['query'],_0x27c560['filters']),_0x46437f);if(_0xfd41d[_0x43ce('0x4c')][_0x43ce('0x56')]){_0xd5bf41['where']=_[_0x43ce('0x57')](_0xd5bf41[_0x43ce('0x55')],{'$or':_[_0x43ce('0x44')](_0x46437f,function(_0x29215b){if(_0x29215b[_0x43ce('0x58')]!==_0x43ce('0x59')){var _0x2b9ddf={};_0x2b9ddf[_0x29215b['name']]={'$like':'%'+_0xfd41d[_0x43ce('0x4c')][_0x43ce('0x56')]+'%'};return _0x2b9ddf;}})});}_0xd5bf41=_[_0x43ce('0x57')]({},_0xd5bf41,_0xfd41d[_0x43ce('0x5a')]);var _0x30b4b7={'where':_0xd5bf41[_0x43ce('0x55')]};return db[_0x43ce('0x45')][_0x43ce('0x21')](_0x30b4b7)[_0x43ce('0x10')](function(_0x5a5dd3){_0x2acc17['count']=_0x5a5dd3;if(_0xfd41d['query'][_0x43ce('0x5b')]){_0xd5bf41[_0x43ce('0x5c')]=[{'all':!![]}];}return db['MailAccount'][_0x43ce('0x5d')](_0xd5bf41);})[_0x43ce('0x10')](function(_0x4d9ea1){_0x2acc17[_0x43ce('0x5e')]=_0x4d9ea1;return _0x2acc17;})[_0x43ce('0x10')](respondWithFilteredResult(_0x54acc3,_0xd5bf41))[_0x43ce('0x1b')](handleError(_0x54acc3,null));};exports[_0x43ce('0x5f')]=function(_0x113aef,_0x18165e){var _0x25837e={'raw':![],'where':{'id':_0x113aef[_0x43ce('0x60')]['id']},'include':[{'model':db[_0x43ce('0x41')],'as':_0x43ce('0x3e')},{'model':db[_0x43ce('0x42')],'as':_0x43ce('0x3f')},{'model':db[_0x43ce('0x61')],'as':_0x43ce('0x43')}]},_0x19b80d={};_0x19b80d[_0x43ce('0x49')]=_[_0x43ce('0x4b')](db[_0x43ce('0x45')][_0x43ce('0x46')]);_0x19b80d[_0x43ce('0x4c')]=_[_0x43ce('0x4b')](_0x113aef[_0x43ce('0x4c')]);_0x19b80d[_0x43ce('0x4d')]=_['intersection'](_0x19b80d[_0x43ce('0x49')],_0x19b80d[_0x43ce('0x4c')]);_0x25837e[_0x43ce('0x50')]=_[_0x43ce('0x4e')](_0x19b80d[_0x43ce('0x49')],qs[_0x43ce('0x4f')](_0x113aef[_0x43ce('0x4c')]['fields']));_0x25837e[_0x43ce('0x50')]=_0x25837e[_0x43ce('0x50')][_0x43ce('0x62')]?_0x25837e[_0x43ce('0x50')]:_0x19b80d['model'];if(_0x113aef['query'][_0x43ce('0x5b')]){_0x25837e[_0x43ce('0x5c')]=[{'all':!![]}];}_0x25837e=_['merge']({},_0x25837e,_0x113aef['options']);return db[_0x43ce('0x45')][_0x43ce('0x63')](_0x25837e)[_0x43ce('0x10')](handleEntityNotFound(_0x18165e,null))[_0x43ce('0x10')](respondWithResult(_0x18165e,null))[_0x43ce('0x1b')](handleError(_0x18165e,null));};exports[_0x43ce('0x25')]=function(_0x387ec7,_0x32b4e4){if(_0x387ec7[_0x43ce('0x64')]['id']){delete _0x387ec7[_0x43ce('0x64')]['id'];}var _0x117d0d=_0x387ec7['body']['provider']===_0x43ce('0x65')?null:_0x387ec7[_0x43ce('0x64')]['provider'];var _0x366800=_0x387ec7[_0x43ce('0x64')][_0x43ce('0x3e')]||{};var _0x4537d1=_0x387ec7[_0x43ce('0x64')][_0x43ce('0x3f')]||{};if(_0x117d0d){_0x366800[_0x43ce('0x3a')]=getImapHost(_0x117d0d);_0x366800[_0x43ce('0x3b')]=0x3e1;_0x4537d1[_0x43ce('0x3a')]=getSmtpHost(_0x117d0d);_0x4537d1['port']=0x24b;_0x4537d1[_0x43ce('0x66')]=![];}if(_0x4537d1['modernAuthentication']){_0x4537d1[_0x43ce('0x66')]=![];}else{_0x4537d1[_0x43ce('0x39')]=null;}if(!_0x366800[_0x43ce('0x38')])_0x366800['CloudProviderId']=null;_0x387ec7[_0x43ce('0x64')][_0x43ce('0x3e')]=_0x366800;_0x387ec7[_0x43ce('0x64')][_0x43ce('0x3f')]=_0x4537d1;return db['MailAccount']['find']({'where':{'id':_0x387ec7[_0x43ce('0x60')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x43ce('0x3e')},{'model':db[_0x43ce('0x42')],'as':'Smtp'},{'model':db['Pause'],'as':_0x43ce('0x43')}]})['then'](handleEntityNotFound(_0x32b4e4,null))[_0x43ce('0x10')](function(_0x51b0af){if(!_0x51b0af)throw new Error(_0x43ce('0x67'));if(_0x51b0af[_0x43ce('0x3c')])delete _0x387ec7[_0x43ce('0x64')][_0x43ce('0x3e')];return _0x51b0af;})[_0x43ce('0x10')](saveUpdates(_0x387ec7['body'],null))[_0x43ce('0x10')](function(_0x27d9e8){if(!_0x387ec7['body'][_0x43ce('0x3e')])return _0x27d9e8;return db[_0x43ce('0x41')]['update'](_0x387ec7[_0x43ce('0x64')][_0x43ce('0x3e')],{'where':{'MailAccountId':_0x27d9e8['id']}})['then'](function(){return _0x27d9e8;});})['then'](function(_0x5c1741){if(!_0x387ec7[_0x43ce('0x64')][_0x43ce('0x3f')])return _0x5c1741;return db[_0x43ce('0x42')][_0x43ce('0x25')](_0x387ec7['body'][_0x43ce('0x3f')],{'where':{'MailAccountId':_0x5c1741['id']}})[_0x43ce('0x10')](function(){return _0x5c1741;});})[_0x43ce('0x10')](respondWithResult(_0x32b4e4,null))[_0x43ce('0x1b')](handleError(_0x32b4e4,null));};exports[_0x43ce('0x68')]=function(_0x10c0e6,_0x1416ea){return db[_0x43ce('0x45')][_0x43ce('0x68')]()['then'](respondWithResult(_0x1416ea,null))[_0x43ce('0x1b')](handleError(_0x1416ea,null));};exports['addDisposition']=function(_0x57864e,_0x442436){if(_0x57864e[_0x43ce('0x64')]['id']){delete _0x57864e[_0x43ce('0x64')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x57864e[_0x43ce('0x60')]['id']}})[_0x43ce('0x10')](handleEntityNotFound(_0x442436,null))[_0x43ce('0x10')](function(_0x4f70bd){if(_0x4f70bd){_0x57864e['body'][_0x43ce('0x69')]=_0x4f70bd['id'];return db[_0x43ce('0x6a')][_0x43ce('0x6b')](_0x57864e[_0x43ce('0x64')]);}})['then'](respondWithResult(_0x442436,null))[_0x43ce('0x1b')](handleError(_0x442436,null));};exports[_0x43ce('0x6c')]=function(_0x4dd42f,_0x5b6eaa){var _0x19d4ee={'raw':![],'where':{}};var _0x308c68={};var _0xdc03={'count':0x0,'rows':[]};return db[_0x43ce('0x45')][_0x43ce('0x6d')]({'where':{'id':_0x4dd42f['params']['id']}})[_0x43ce('0x10')](handleEntityNotFound(_0x5b6eaa,null))[_0x43ce('0x10')](function(_0x384198){if(_0x384198){_0x308c68[_0x43ce('0x49')]=_[_0x43ce('0x4b')](db['Disposition']['rawAttributes']);_0x308c68[_0x43ce('0x4c')]=_[_0x43ce('0x4b')](_0x4dd42f[_0x43ce('0x4c')]);_0x308c68[_0x43ce('0x4d')]=_[_0x43ce('0x4e')](_0x308c68[_0x43ce('0x49')],_0x308c68['query']);_0x19d4ee[_0x43ce('0x50')]=_[_0x43ce('0x4e')](_0x308c68[_0x43ce('0x49')],qs[_0x43ce('0x4f')](_0x4dd42f[_0x43ce('0x4c')]['fields']));_0x19d4ee[_0x43ce('0x50')]=_0x19d4ee[_0x43ce('0x50')][_0x43ce('0x62')]?_0x19d4ee[_0x43ce('0x50')]:_0x308c68['model'];if(!_0x4dd42f[_0x43ce('0x4c')][_0x43ce('0x51')]('nolimit')){_0x19d4ee[_0x43ce('0x1f')]=qs[_0x43ce('0x1f')](_0x4dd42f[_0x43ce('0x4c')]['limit']);_0x19d4ee[_0x43ce('0x22')]=qs[_0x43ce('0x22')](_0x4dd42f[_0x43ce('0x4c')][_0x43ce('0x22')]);}_0x19d4ee[_0x43ce('0x53')]=qs[_0x43ce('0x54')](_0x4dd42f[_0x43ce('0x4c')][_0x43ce('0x54')]);_0x19d4ee[_0x43ce('0x55')]=qs[_0x43ce('0x4d')](_[_0x43ce('0x6e')](_0x4dd42f['query'],_0x308c68[_0x43ce('0x4d')]));_0x19d4ee[_0x43ce('0x55')][_0x43ce('0x69')]=_0x384198['id'];if(_0x4dd42f[_0x43ce('0x4c')]['filter']){_0x19d4ee['where']=_['merge'](_0x19d4ee['where'],{'$or':_[_0x43ce('0x44')](_0x19d4ee['attributes'],function(_0x51f5a5){var _0x4cfea7={};_0x4cfea7[_0x51f5a5]={'$like':'%'+_0x4dd42f[_0x43ce('0x4c')][_0x43ce('0x56')]+'%'};return _0x4cfea7;})});}_0x19d4ee=_['merge']({},_0x19d4ee,_0x4dd42f['options']);return db['Disposition'][_0x43ce('0x21')]({'where':_0x19d4ee[_0x43ce('0x55')]})[_0x43ce('0x10')](function(_0x3d65e6){_0xdc03[_0x43ce('0x21')]=_0x3d65e6;if(_0x4dd42f[_0x43ce('0x4c')][_0x43ce('0x5b')]){_0x19d4ee[_0x43ce('0x5c')]=[{'all':!![]}];}return db[_0x43ce('0x6a')][_0x43ce('0x5d')](_0x19d4ee);})[_0x43ce('0x10')](function(_0x226ade){_0xdc03[_0x43ce('0x5e')]=_0x226ade;return _0xdc03;});}})[_0x43ce('0x10')](respondWithFilteredResult(_0x5b6eaa,_0x19d4ee))[_0x43ce('0x1b')](handleError(_0x5b6eaa,null));};exports[_0x43ce('0x6f')]=function(_0x1bd13a,_0x558fca){return db[_0x43ce('0x45')]['find']({'where':{'id':_0x1bd13a[_0x43ce('0x60')]['id']}})[_0x43ce('0x10')](handleEntityNotFound(_0x558fca,null))[_0x43ce('0x10')](function(_0x39bb2d){if(_0x39bb2d){return _0x39bb2d[_0x43ce('0x6f')](_0x1bd13a[_0x43ce('0x4c')]['ids']);}})[_0x43ce('0x10')](respondWithStatusCode(_0x558fca,null))[_0x43ce('0x1b')](handleError(_0x558fca,null));};exports[_0x43ce('0x70')]=function(_0x319868,_0xb4fe75){if(_0x319868['body']['id']){delete _0x319868[_0x43ce('0x64')]['id'];}return db[_0x43ce('0x45')][_0x43ce('0x63')]({'where':{'id':_0x319868[_0x43ce('0x60')]['id']}})[_0x43ce('0x10')](handleEntityNotFound(_0xb4fe75,null))[_0x43ce('0x10')](function(_0x348a2a){if(_0x348a2a){_0x319868['body']['MailAccountId']=_0x348a2a['id'];return db[_0x43ce('0x71')]['create'](_0x319868['body']);}})[_0x43ce('0x10')](respondWithResult(_0xb4fe75,null))[_0x43ce('0x1b')](handleError(_0xb4fe75,null));};exports[_0x43ce('0x72')]=function(_0x1f0886,_0x20c84c){var _0x98d30c={'raw':![],'where':{}};var _0x614487={};var _0x129e66={'count':0x0,'rows':[]};return db[_0x43ce('0x45')][_0x43ce('0x6d')]({'where':{'id':_0x1f0886[_0x43ce('0x60')]['id']}})[_0x43ce('0x10')](handleEntityNotFound(_0x20c84c,null))[_0x43ce('0x10')](function(_0x4c254e){if(_0x4c254e){_0x614487['model']=_['keys'](db[_0x43ce('0x71')][_0x43ce('0x46')]);_0x614487[_0x43ce('0x4c')]=_[_0x43ce('0x4b')](_0x1f0886['query']);_0x614487[_0x43ce('0x4d')]=_['intersection'](_0x614487[_0x43ce('0x49')],_0x614487[_0x43ce('0x4c')]);_0x98d30c['attributes']=_[_0x43ce('0x4e')](_0x614487[_0x43ce('0x49')],qs[_0x43ce('0x4f')](_0x1f0886[_0x43ce('0x4c')][_0x43ce('0x4f')]));_0x98d30c[_0x43ce('0x50')]=_0x98d30c[_0x43ce('0x50')][_0x43ce('0x62')]?_0x98d30c[_0x43ce('0x50')]:_0x614487['model'];if(!_0x1f0886[_0x43ce('0x4c')]['hasOwnProperty'](_0x43ce('0x52'))){_0x98d30c[_0x43ce('0x1f')]=qs[_0x43ce('0x1f')](_0x1f0886['query'][_0x43ce('0x1f')]);_0x98d30c[_0x43ce('0x22')]=qs[_0x43ce('0x22')](_0x1f0886[_0x43ce('0x4c')][_0x43ce('0x22')]);}_0x98d30c['order']=qs[_0x43ce('0x54')](_0x1f0886[_0x43ce('0x4c')]['sort']);_0x98d30c[_0x43ce('0x55')]=qs[_0x43ce('0x4d')](_[_0x43ce('0x6e')](_0x1f0886[_0x43ce('0x4c')],_0x614487[_0x43ce('0x4d')]));_0x98d30c['where']['MailAccountId']=_0x4c254e['id'];if(_0x1f0886[_0x43ce('0x4c')][_0x43ce('0x56')]){_0x98d30c['where']=_[_0x43ce('0x57')](_0x98d30c[_0x43ce('0x55')],{'$or':_['map'](_0x98d30c[_0x43ce('0x50')],function(_0x1c9865){var _0xf83cb6={};_0xf83cb6[_0x1c9865]={'$like':'%'+_0x1f0886[_0x43ce('0x4c')][_0x43ce('0x56')]+'%'};return _0xf83cb6;})});}_0x98d30c=_[_0x43ce('0x57')]({},_0x98d30c,_0x1f0886[_0x43ce('0x5a')]);return db[_0x43ce('0x71')][_0x43ce('0x21')]({'where':_0x98d30c['where']})[_0x43ce('0x10')](function(_0x50bebc){_0x129e66[_0x43ce('0x21')]=_0x50bebc;if(_0x1f0886['query'][_0x43ce('0x5b')]){_0x98d30c[_0x43ce('0x5c')]=[{'all':!![]}];}return db[_0x43ce('0x71')][_0x43ce('0x5d')](_0x98d30c);})[_0x43ce('0x10')](function(_0x23bdda){_0x129e66[_0x43ce('0x5e')]=_0x23bdda;return _0x129e66;});}})[_0x43ce('0x10')](respondWithFilteredResult(_0x20c84c,_0x98d30c))['catch'](handleError(_0x20c84c,null));};exports[_0x43ce('0x73')]=function(_0x101543,_0x939eb0){return db[_0x43ce('0x45')][_0x43ce('0x63')]({'where':{'id':_0x101543[_0x43ce('0x60')]['id']}})[_0x43ce('0x10')](handleEntityNotFound(_0x939eb0,null))[_0x43ce('0x10')](function(_0x34c751){if(_0x34c751){return _0x34c751[_0x43ce('0x73')](_0x101543[_0x43ce('0x4c')][_0x43ce('0x74')]);}})[_0x43ce('0x10')](respondWithStatusCode(_0x939eb0,null))[_0x43ce('0x1b')](handleError(_0x939eb0,null));};exports[_0x43ce('0x6b')]=function(_0x5a5668,_0x3acc78){var _0x47c7c5={'name':_0x5a5668[_0x43ce('0x64')][_0x43ce('0x4a')],'key':_0x5a5668[_0x43ce('0x64')][_0x43ce('0x48')],'provider':_0x5a5668[_0x43ce('0x64')][_0x43ce('0x75')]===_0x43ce('0x65')?null:_0x5a5668['body'][_0x43ce('0x75')],'email':_0x5a5668[_0x43ce('0x64')][_0x43ce('0x76')],'ListId':_0x5a5668[_0x43ce('0x64')][_0x43ce('0x77')],'active':!_[_0x43ce('0x78')](_0x5a5668['body']['active'])?_0x5a5668[_0x43ce('0x64')][_0x43ce('0x79')]:!![],'description':_0x5a5668[_0x43ce('0x64')][_0x43ce('0x7a')]||null};var _0x138172=getAuthenticationOptions(_0x47c7c5[_0x43ce('0x75')],_0x5a5668[_0x43ce('0x64')]);_0x47c7c5[_0x43ce('0x3e')]=_0x138172['Imap'];_0x47c7c5['Smtp']=_0x138172['Smtp'];return db[_0x43ce('0x45')][_0x43ce('0x6b')](_0x47c7c5,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x43ce('0x41')],'as':'Imap'}]})[_0x43ce('0x10')](function(_0x10c58e){var _0x56351d=_0x5a5668[_0x43ce('0x34')][_0x43ce('0x7b')]({'plain':!![]});if(!_0x56351d)throw new Error(_0x43ce('0x7c'));if(_0x56351d[_0x43ce('0x7d')]===_0x43ce('0x34')){var _0x1ca3d4=_0x10c58e[_0x43ce('0x7b')]({'plain':!![]});return db[_0x43ce('0x7e')][_0x43ce('0x63')]({'where':{'name':'MailAccounts','userProfileId':_0x56351d[_0x43ce('0x7f')]},'raw':!![]})[_0x43ce('0x10')](function(_0x1af391){if(_0x1af391&&_0x1af391['autoAssociation']===0x0){return db['UserProfileResource'][_0x43ce('0x6b')]({'name':_0x1ca3d4[_0x43ce('0x4a')],'resourceId':_0x1ca3d4['id'],'type':_0x1af391[_0x43ce('0x4a')],'sectionId':_0x1af391['id']},{})['then'](function(){return _0x10c58e;});}else{return _0x10c58e;}})[_0x43ce('0x1b')](function(_0x419245){logger['error'](_0x43ce('0x80'),_0x419245);throw _0x419245;});}return _0x10c58e;})['then'](respondWithResult(_0x3acc78,0xc9))[_0x43ce('0x1b')](handleError(_0x3acc78,null));};exports[_0x43ce('0x81')]=function(_0x462712,_0x45b451){return db[_0x43ce('0x45')][_0x43ce('0x6d')]({'where':{'id':_0x462712['params']['id']}})[_0x43ce('0x10')](handleEntityNotFound(_0x45b451,null))[_0x43ce('0x10')](function(_0x7b8afe){if(_0x7b8afe){return _0x7b8afe[_0x43ce('0x81')]();}return null;})[_0x43ce('0x10')](respondWithResult(_0x45b451,null))[_0x43ce('0x1b')](handleError(_0x45b451,null));};exports[_0x43ce('0x82')]=function(_0x40c93b,_0x40e7aa){if(_0x40c93b[_0x43ce('0x64')]['id']){delete _0x40c93b[_0x43ce('0x64')]['id'];}return db['MailAccount'][_0x43ce('0x63')]({'where':{'id':_0x40c93b['params']['id']}})[_0x43ce('0x10')](handleEntityNotFound(_0x40e7aa,null))[_0x43ce('0x10')](function(_0x4d18a8){if(_0x4d18a8){_0x40c93b[_0x43ce('0x64')]['MailAccountId']=_0x4d18a8['id'];return db[_0x43ce('0x41')]['create'](_0x40c93b['body']);}})[_0x43ce('0x10')](respondWithResult(_0x40e7aa,null))[_0x43ce('0x1b')](handleError(_0x40e7aa,null));};exports[_0x43ce('0x83')]=function(_0x2179e7,_0x89d1fc){return db[_0x43ce('0x45')]['findOne']({'where':{'id':_0x2179e7['params']['id']}})[_0x43ce('0x10')](handleEntityNotFound(_0x89d1fc,null))[_0x43ce('0x10')](function(_0x3f8195){if(_0x3f8195){return _0x3f8195[_0x43ce('0x84')](null);}return null;})[_0x43ce('0x10')](respondWithStatusCode(_0x89d1fc,null))[_0x43ce('0x1b')](handleError(_0x89d1fc,null));};exports[_0x43ce('0x85')]=function(_0x2dc075,_0x47da36){return db[_0x43ce('0x45')][_0x43ce('0x6d')]({'where':{'id':_0x2dc075['params']['id']}})[_0x43ce('0x10')](handleEntityNotFound(_0x47da36,null))[_0x43ce('0x10')](function(_0x55e073){if(_0x55e073){return _0x55e073['getSmtp']();}return null;})[_0x43ce('0x10')](respondWithResult(_0x47da36,null))[_0x43ce('0x1b')](handleError(_0x47da36,null));};exports['addSmtp']=function(_0x4c7fb4,_0xeba3a0){if(_0x4c7fb4[_0x43ce('0x64')]['id']){delete _0x4c7fb4[_0x43ce('0x64')]['id'];}return db['MailAccount'][_0x43ce('0x63')]({'where':{'id':_0x4c7fb4[_0x43ce('0x60')]['id']}})[_0x43ce('0x10')](handleEntityNotFound(_0xeba3a0,null))[_0x43ce('0x10')](function(_0xab75cb){if(_0xab75cb){_0x4c7fb4[_0x43ce('0x64')][_0x43ce('0x69')]=_0xab75cb['id'];return db[_0x43ce('0x42')][_0x43ce('0x6b')](_0x4c7fb4['body']);}})[_0x43ce('0x10')](respondWithResult(_0xeba3a0,null))[_0x43ce('0x1b')](handleError(_0xeba3a0,null));};exports[_0x43ce('0x86')]=function(_0x3681cd,_0x3281d6){return db[_0x43ce('0x45')]['findOne']({'where':{'id':_0x3681cd['params']['id']}})['then'](handleEntityNotFound(_0x3281d6,null))[_0x43ce('0x10')](function(_0xc95a0e){if(_0xc95a0e){return _0xc95a0e[_0x43ce('0x87')](null);}return null;})['then'](respondWithStatusCode(_0x3281d6,null))[_0x43ce('0x1b')](handleError(_0x3281d6,null));};exports['addInteraction']=function(_0x347afb,_0x17c338){return db[_0x43ce('0x88')][_0x43ce('0x63')]({'where':{'id':_0x347afb[_0x43ce('0x60')]['id']}})['then'](handleEntityNotFound(_0x17c338,null))[_0x43ce('0x10')](function(_0x42c9bb){if(_0x42c9bb){return _0x42c9bb[_0x43ce('0x89')](_0x347afb[_0x43ce('0x64')][_0x43ce('0x74')],_[_0x43ce('0x8a')](_0x347afb[_0x43ce('0x64')],['ids','id'])||{});}})[_0x43ce('0x10')](respondWithResult(_0x17c338,null))['catch'](handleError(_0x17c338,null));};exports[_0x43ce('0x8b')]=function(_0x2c0f7c,_0xc13af4){var _0x24b6ed={'raw':![],'where':{}};var _0x3c8fc9={};var _0xfb8c07={'count':0x0,'rows':[]};return db['MailAccount'][_0x43ce('0x6d')]({'where':{'id':_0x2c0f7c[_0x43ce('0x60')]['id']}})[_0x43ce('0x10')](handleEntityNotFound(_0xc13af4,null))['then'](function(_0x13d57a){if(_0x13d57a){_0x3c8fc9[_0x43ce('0x49')]=_[_0x43ce('0x4b')](db[_0x43ce('0x88')][_0x43ce('0x46')]);_0x3c8fc9['query']=_[_0x43ce('0x4b')](_0x2c0f7c[_0x43ce('0x4c')]);_0x3c8fc9[_0x43ce('0x4d')]=_[_0x43ce('0x4e')](_0x3c8fc9[_0x43ce('0x49')],_0x3c8fc9[_0x43ce('0x4c')]);_0x24b6ed['attributes']=_[_0x43ce('0x4e')](_0x3c8fc9[_0x43ce('0x49')],qs['fields'](_0x2c0f7c['query'][_0x43ce('0x4f')]));_0x24b6ed[_0x43ce('0x50')]=_0x24b6ed['attributes'][_0x43ce('0x62')]?_0x24b6ed[_0x43ce('0x50')]:_0x3c8fc9[_0x43ce('0x49')];if(!_0x2c0f7c[_0x43ce('0x4c')][_0x43ce('0x51')](_0x43ce('0x52'))){_0x24b6ed[_0x43ce('0x1f')]=qs[_0x43ce('0x1f')](_0x2c0f7c[_0x43ce('0x4c')][_0x43ce('0x1f')]);_0x24b6ed['offset']=qs[_0x43ce('0x22')](_0x2c0f7c[_0x43ce('0x4c')]['offset']);}_0x24b6ed[_0x43ce('0x53')]=qs[_0x43ce('0x54')](_0x2c0f7c[_0x43ce('0x4c')]['sort']);_0x24b6ed['where']=qs[_0x43ce('0x4d')](_[_0x43ce('0x6e')](_0x2c0f7c[_0x43ce('0x4c')],_0x3c8fc9['filters']));_0x24b6ed['where'][_0x43ce('0x69')]=_0x13d57a['id'];if(_0x2c0f7c['query'][_0x43ce('0x56')]){_0x24b6ed[_0x43ce('0x55')]=_[_0x43ce('0x57')](_0x24b6ed[_0x43ce('0x55')],{'$or':_[_0x43ce('0x44')](_0x24b6ed[_0x43ce('0x50')],function(_0x2ded5a){var _0x365a7d={};_0x365a7d[_0x2ded5a]={'$like':'%'+_0x2c0f7c[_0x43ce('0x4c')][_0x43ce('0x56')]+'%'};return _0x365a7d;})});}_0x24b6ed=_['merge']({},_0x24b6ed,_0x2c0f7c[_0x43ce('0x5a')]);return db[_0x43ce('0x88')][_0x43ce('0x21')]({'where':_0x24b6ed[_0x43ce('0x55')]})[_0x43ce('0x10')](function(_0x33a476){_0xfb8c07[_0x43ce('0x21')]=_0x33a476;if(_0x2c0f7c[_0x43ce('0x4c')]['includeAll']){_0x24b6ed[_0x43ce('0x5c')]=[{'model':db['CmContact'],'as':_0x43ce('0x8c'),'required':![]},{'model':db['User'],'as':_0x43ce('0x8d'),'attributes':[_0x43ce('0x4a'),'fullname',_0x43ce('0x8e')],'required':![]},{'model':db[_0x43ce('0x8f')],'as':_0x43ce('0x90'),'attributes':['id',_0x43ce('0x4a'),_0x43ce('0x91')],'where':_0x2c0f7c[_0x43ce('0x4c')][_0x43ce('0x92')]?{'id':_0x2c0f7c[_0x43ce('0x4c')]['tag']}:undefined,'required':_0x2c0f7c[_0x43ce('0x4c')][_0x43ce('0x92')]?!![]:![]}];}return db[_0x43ce('0x88')][_0x43ce('0x5d')](_0x24b6ed);})['then'](function(_0x35a7fd){_0xfb8c07['rows']=_0x35a7fd;return _0xfb8c07;});}})['then'](respondWithFilteredResult(_0xc13af4,_0x24b6ed))['catch'](handleError(_0xc13af4,null));};exports[_0x43ce('0x93')]=function addApplications(_0xaa6d76,_0x2b9c48){var _0xee672f=_0xaa6d76[_0x43ce('0x60')]['id'];var _0x2e3d7b=_0xaa6d76[_0x43ce('0x64')];var _0x127a92=0xc8;var _0x11d8cb=null;return db[_0x43ce('0x94')]['transaction']({'isolationLevel':db[_0x43ce('0x94')][_0x43ce('0x95')]['ISOLATION_LEVELS'][_0x43ce('0x96')]},function(_0xc1552e){return db[_0x43ce('0x45')]['findOne']({'where':{'id':_0xee672f},'transaction':_0xc1552e})[_0x43ce('0x10')](function(_0x53d71f){if(_0x53d71f){return db[_0x43ce('0x97')]['destroy']({'where':{'MailAccountId':_0xee672f},'transaction':_0xc1552e})[_0x43ce('0x10')](function(){var _0x5a7bd6=_[_0x43ce('0x44')](_0x2e3d7b,function(_0x37ef63){_0x37ef63[_0x43ce('0x69')]=_0xee672f;return _0x37ef63;});return db[_0x43ce('0x97')]['bulkCreate'](_0x5a7bd6,{'transaction':_0xc1552e});});}else{_0x127a92=0x194;_0x11d8cb=[];}});})[_0x43ce('0x10')](function(){if(_0x127a92!==0x194){return db['MailApplication'][_0x43ce('0x98')]({'where':{'MailAccountId':_0xee672f},'order':_0x43ce('0x99')})[_0x43ce('0x10')](function(_0x747cc6){_0x11d8cb=_0x747cc6;});}})[_0x43ce('0x1b')](function(_0x105dc4){_0x127a92=0x1f4;logger[_0x43ce('0x17')](_0x105dc4[_0x43ce('0x29')]);if(_0x105dc4[_0x43ce('0x4a')]){delete _0x105dc4[_0x43ce('0x4a')];}_0x11d8cb=_0x105dc4;})[_0x43ce('0x9a')](function(){if(_0x11d8cb===null){_0x2b9c48[_0x43ce('0x1c')](_0x127a92);}else{if(_0x127a92===0x1f4){_0x2b9c48[_0x43ce('0x1e')](_0x127a92)[_0x43ce('0x2a')](_0x11d8cb);}else{_0x2b9c48[_0x43ce('0x1e')](_0x127a92)[_0x43ce('0x9b')](_0x11d8cb);}}});};exports['getApplications']=function(_0x57704f,_0x2bbb01){var _0x4f0b11={};var _0x2f4d74={};var _0x233f6c;var _0x30dd3b;return db['MailAccount'][_0x43ce('0x6d')]({'where':{'id':_0x57704f[_0x43ce('0x60')]['id']}})[_0x43ce('0x10')](handleEntityNotFound(_0x2bbb01,null))['then'](function(_0x75c7ea){if(_0x75c7ea){_0x233f6c=_0x75c7ea;_0x2f4d74['model']=_['keys'](db[_0x43ce('0x97')][_0x43ce('0x46')]);_0x2f4d74[_0x43ce('0x4c')]=_[_0x43ce('0x4b')](_0x57704f[_0x43ce('0x4c')]);_0x2f4d74[_0x43ce('0x4d')]=_[_0x43ce('0x4e')](_0x2f4d74[_0x43ce('0x49')],_0x2f4d74[_0x43ce('0x4c')]);_0x4f0b11[_0x43ce('0x50')]=_['intersection'](_0x2f4d74[_0x43ce('0x49')],qs['fields'](_0x57704f[_0x43ce('0x4c')]['fields']));_0x4f0b11[_0x43ce('0x50')]=_0x4f0b11[_0x43ce('0x50')][_0x43ce('0x62')]?_0x4f0b11[_0x43ce('0x50')]:_0x2f4d74['model'];_0x4f0b11[_0x43ce('0x53')]=qs['sort'](_0x57704f['query'][_0x43ce('0x54')]);_0x4f0b11[_0x43ce('0x55')]=qs[_0x43ce('0x4d')](_[_0x43ce('0x6e')](_0x57704f[_0x43ce('0x4c')],_0x2f4d74[_0x43ce('0x4d')]));if(_0x57704f[_0x43ce('0x4c')][_0x43ce('0x56')]){_0x4f0b11['where']=_[_0x43ce('0x57')](_0x4f0b11[_0x43ce('0x55')],{'$or':_[_0x43ce('0x44')](_0x4f0b11[_0x43ce('0x50')],function(_0x39c63e){var _0x484d85={};_0x484d85[_0x39c63e]={'$like':'%'+_0x57704f['query']['filter']+'%'};return _0x484d85;})});}_0x4f0b11=_[_0x43ce('0x57')]({},_0x4f0b11,_0x57704f[_0x43ce('0x5a')]);return _0x233f6c['getApplications'](_0x4f0b11);}})[_0x43ce('0x10')](function(_0x327113){if(_0x327113){_0x30dd3b=_0x327113[_0x43ce('0x62')];if(!_0x57704f[_0x43ce('0x4c')]['hasOwnProperty'](_0x43ce('0x52'))){_0x4f0b11[_0x43ce('0x1f')]=qs[_0x43ce('0x1f')](_0x57704f[_0x43ce('0x4c')][_0x43ce('0x1f')]);_0x4f0b11['offset']=qs[_0x43ce('0x22')](_0x57704f[_0x43ce('0x4c')][_0x43ce('0x22')]);}return _0x233f6c[_0x43ce('0x9c')](_0x4f0b11);}})[_0x43ce('0x10')](function(_0x19c722){if(_0x19c722){return _0x19c722?{'count':_0x30dd3b,'rows':_0x19c722}:null;}})['then'](respondWithResult(_0x2bbb01,null))[_0x43ce('0x1b')](handleError(_0x2bbb01,null));};exports[_0x43ce('0x9d')]=function(_0x2b2350,_0x1af76a){var _0x47fa0a={'raw':!![],'where':{}};var _0x27a193={};var _0x4d1997={'count':0x0,'rows':[]};return db[_0x43ce('0x45')][_0x43ce('0x6d')]({'where':{'id':_0x2b2350[_0x43ce('0x60')]['id']}})[_0x43ce('0x10')](handleEntityNotFound(_0x1af76a,null))['then'](function(_0x277970){if(_0x277970){_0x27a193[_0x43ce('0x49')]=_['keys'](db['MailMessage'][_0x43ce('0x46')]);_0x27a193['query']=_[_0x43ce('0x4b')](_0x2b2350[_0x43ce('0x4c')]);_0x27a193[_0x43ce('0x4d')]=_['intersection'](_0x27a193[_0x43ce('0x49')],_0x27a193['query']);_0x47fa0a['attributes']=_[_0x43ce('0x4e')](_0x27a193[_0x43ce('0x49')],qs[_0x43ce('0x4f')](_0x2b2350[_0x43ce('0x4c')][_0x43ce('0x4f')]));_0x47fa0a['attributes']=_0x47fa0a[_0x43ce('0x50')][_0x43ce('0x62')]?_0x47fa0a['attributes']:_0x27a193[_0x43ce('0x49')];if(!_0x2b2350[_0x43ce('0x4c')][_0x43ce('0x51')](_0x43ce('0x52'))){_0x47fa0a[_0x43ce('0x1f')]=qs[_0x43ce('0x1f')](_0x2b2350[_0x43ce('0x4c')][_0x43ce('0x1f')]);_0x47fa0a[_0x43ce('0x22')]=qs[_0x43ce('0x22')](_0x2b2350[_0x43ce('0x4c')][_0x43ce('0x22')]);}_0x47fa0a[_0x43ce('0x53')]=qs[_0x43ce('0x54')](_0x2b2350[_0x43ce('0x4c')]['sort']);_0x47fa0a['where']=qs[_0x43ce('0x4d')](_[_0x43ce('0x6e')](_0x2b2350['query'],_0x27a193[_0x43ce('0x4d')]));_0x47fa0a[_0x43ce('0x55')][_0x43ce('0x69')]=_0x277970['id'];if(_0x2b2350[_0x43ce('0x4c')][_0x43ce('0x56')]){_0x47fa0a[_0x43ce('0x55')]=_[_0x43ce('0x57')](_0x47fa0a[_0x43ce('0x55')],{'$or':_[_0x43ce('0x44')](_0x47fa0a[_0x43ce('0x50')],function(_0x546e14){var _0x30169c={};_0x30169c[_0x546e14]={'$like':'%'+_0x2b2350[_0x43ce('0x4c')][_0x43ce('0x56')]+'%'};return _0x30169c;})});}if(_0x2b2350[_0x43ce('0x4c')][_0x43ce('0x9e')]){var _0x153c5e=_0x2b2350['query'][_0x43ce('0x9e')][_0x43ce('0x9f')](',');var _0x292742={};_0x292742[_0x153c5e[0x0]]={'$gte':moment(_0x153c5e[0x1])[_0x43ce('0xa0')](_0x43ce('0xa1'))};_0x47fa0a[_0x43ce('0x55')]=_[_0x43ce('0x57')](_0x47fa0a[_0x43ce('0x55')],_0x292742);}_0x47fa0a=_[_0x43ce('0x57')]({},_0x47fa0a,_0x2b2350[_0x43ce('0x5a')]);return db[_0x43ce('0xa2')]['count']({'where':_0x47fa0a[_0x43ce('0x55')]})['then'](function(_0x527567){_0x4d1997[_0x43ce('0x21')]=_0x527567;if(_0x2b2350['query']['includeAll']){_0x47fa0a[_0x43ce('0x5c')]=[{'all':!![]}];}return db[_0x43ce('0xa2')][_0x43ce('0x5d')](_0x47fa0a);})[_0x43ce('0x10')](function(_0x2c9d3a){if(_0x2b2350['query'][_0x43ce('0xa3')]===_0x43ce('0xa4')){for(var _0xa265e8=0x0;_0xa265e8<_0x2c9d3a[_0x43ce('0x62')];_0xa265e8++){_0x2c9d3a[_0xa265e8][_0x43ce('0x64')]=juice(_0x2c9d3a[_0xa265e8][_0x43ce('0x64')]);}}_0x4d1997[_0x43ce('0x5e')]=_0x2c9d3a;return _0x4d1997;});}})[_0x43ce('0x10')](respondWithFilteredResult(_0x1af76a,_0x47fa0a))[_0x43ce('0x1b')](handleError(_0x1af76a,null));};exports[_0x43ce('0x2a')]=function(_0x72b0e6,_0x5c8572){var _0x234974,_0x136a24={},_0x2b6e0a;if(_0x72b0e6['body']['to']){_0x2b6e0a=_0x72b0e6[_0x43ce('0x64')]['to'][_0x43ce('0x9f')](',')[0x0];}return db[_0x43ce('0x45')][_0x43ce('0x63')]({'where':{'id':_0x72b0e6[_0x43ce('0x60')]['id']},'include':[{'model':db[_0x43ce('0xa5')],'as':_0x43ce('0xa6'),'include':[{'model':db[_0x43ce('0xa7')],'as':_0x43ce('0xa8'),'where':{'email':_0x2b6e0a},'limit':0x1,'order':[[_0x43ce('0xa9'),_0x43ce('0xaa')]]}]},{'model':db[_0x43ce('0x42')],'as':_0x43ce('0x3f'),'raw':!![],'include':[{'model':db[_0x43ce('0xab')],'as':_0x43ce('0xab'),'raw':!![]}]}]})[_0x43ce('0x10')](handleEntityNotFound(_0x5c8572,null))['then'](function(_0x258b6b){if(!_0x258b6b)return;_0x234974=_0x258b6b;if(!_0x258b6b[_0x43ce('0x3f')])throw new Error(_0x43ce('0xac'));if(_[_0x43ce('0x78')](_0x72b0e6[_0x43ce('0x64')][_0x43ce('0xad')])){_0x72b0e6[_0x43ce('0x64')][_0x43ce('0xad')]=util[_0x43ce('0xa0')](_0x43ce('0xae'),_0x258b6b['name'],_0x258b6b[_0x43ce('0x76')]||_0x258b6b[_0x43ce('0x3f')]['user']);}if(_0x72b0e6[_0x43ce('0x64')]['attachments']&&_0x72b0e6[_0x43ce('0x64')]['attachments'][_0x43ce('0x62')]){for(var _0x4fba24=0x0;_0x4fba24<_0x72b0e6['body'][_0x43ce('0xaf')][_0x43ce('0x62')];_0x4fba24+=0x1){_0x72b0e6[_0x43ce('0x64')][_0x43ce('0xaf')][_0x4fba24]={'filename':_0x72b0e6['body'][_0x43ce('0xaf')][_0x4fba24][_0x43ce('0x4a')],'path':path['join'](config[_0x43ce('0xb0')],_0x43ce('0xb1'),_0x72b0e6['body']['attachments'][_0x4fba24]['basename'])};}}var _0x423952=_0x258b6b[_0x43ce('0xb2')]();return respondWithRpcPromise('SendMail',_0x43ce('0xb3'),{'account':_0x423952,'message':_0x72b0e6[_0x43ce('0x64')]});})['then'](function(_0x54c3f5){if(!_0x54c3f5)return;_0x136a24=_0x54c3f5;if(!_0x234974[_0x43ce('0xa6')])throw new Error('List\x20not\x20found');if(_0x234974['List'][_0x43ce('0xa8')][_0x43ce('0x62')])return _0x234974[_0x43ce('0xa6')][_0x43ce('0xa8')][0x0];return db[_0x43ce('0xa7')][_0x43ce('0x6b')](_['defaults'](_0x72b0e6[_0x43ce('0x64')],{'firstName':_0x72b0e6[_0x43ce('0x64')]['to'],'email':_0x72b0e6[_0x43ce('0x64')]['to'],'phone':_0x72b0e6['body']['to'],'ListId':_0x234974[_0x43ce('0x77')]}));})['then'](function(_0x1dff7a){if(!_0x1dff7a)return;var _0x2a2e16={'UserId':_0x72b0e6[_0x43ce('0x34')]['id'],'ContactId':_0x1dff7a['id'],'MailAccountId':_0x234974['id'],'inReplyTo':_0x136a24[_0x43ce('0xb4')],'to':_0x72b0e6[_0x43ce('0x64')][_0x43ce('0xad')],'cc':_0x72b0e6['body']['cc'],'subject':_0x72b0e6[_0x43ce('0x64')][_0x43ce('0xb5')],'attach':_0x72b0e6[_0x43ce('0x64')]['attach'],'firstMsgDirection':_0x43ce('0xb6'),'lastMsgAt':moment()[_0x43ce('0xa0')](_0x43ce('0xa1')),'lastMsgDirection':_0x43ce('0xb6'),'Messages':[_['merge'](_0x72b0e6['body'],{'messageId':_0x136a24[_0x43ce('0xb4')],'sentAt':moment()[_0x43ce('0xa0')](_0x43ce('0xa1')),'read':!![],'MailAccountId':_0x234974['id'],'UserId':_0x72b0e6[_0x43ce('0x34')]['id'],'ContactId':_0x1dff7a['id']})]};if(_0x72b0e6[_0x43ce('0x64')][_0x43ce('0xb7')]){_0x2a2e16=_['merge'](_0x2a2e16,_0x72b0e6[_0x43ce('0x64')]['Interaction']);}return db[_0x43ce('0x88')]['create'](_0x2a2e16,{'include':[{'model':db[_0x43ce('0xa2')],'as':_0x43ce('0xb8')}]});})[_0x43ce('0x10')](respondWithResult(_0x5c8572,null))[_0x43ce('0x1b')](handleError(_0x5c8572,null));};exports['verifySmtp']=function(_0x14e16b,_0x18c773){return db['MailAccount'][_0x43ce('0x63')]({'where':{'id':_0x14e16b['params']['id']},'include':[{'model':db[_0x43ce('0x42')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x43ce('0xab')],'as':_0x43ce('0xab'),'raw':!![]}]}]})[_0x43ce('0x10')](handleEntityNotFound(_0x18c773,null))['then'](function(_0x230d17){if(!_0x230d17[_0x43ce('0x3f')])return;var _0x35e667=_0x230d17[_0x43ce('0xb2')]();return respondWithRpcPromise('VerifySmtp',_0x43ce('0xb9'),{'account':_0x35e667});})[_0x43ce('0x10')](respondWithResult(_0x18c773,null))[_0x43ce('0x1b')](handleError(_0x18c773,null));};exports[_0x43ce('0x26')]=function(_0x25eb65,_0x5ab12b){return db[_0x43ce('0x45')][_0x43ce('0x63')]({'where':{'id':_0x25eb65[_0x43ce('0x60')]['id']}})[_0x43ce('0x10')](handleEntityNotFound(_0x5ab12b,null))[_0x43ce('0x10')](function(_0x474704){if(_0x474704&&_0x474704[_0x43ce('0x3c')]){throw new db['Sequelize'][(_0x43ce('0xba'))](_0x43ce('0xbb'));}return _0x474704;})['then'](removeEntity(_0x5ab12b,null))[_0x43ce('0x1b')](handleError(_0x5ab12b,null));};exports[_0x43ce('0xbc')]=function(_0x11ed52,_0x19fbf0){return db[_0x43ce('0x45')]['find']({'where':{'id':_0x11ed52[_0x43ce('0x60')]['id']}})[_0x43ce('0x10')](handleEntityNotFound(_0x19fbf0,null))[_0x43ce('0x10')](function(_0x4383e1){if(_0x4383e1){return _0x4383e1[_0x43ce('0xbc')](_0x11ed52['body'][_0x43ce('0x74')],_[_0x43ce('0x8a')](_0x11ed52[_0x43ce('0x64')],[_0x43ce('0x74'),'id'])||{})[_0x43ce('0xbd')](function(_0x16ced2){for(var _0x178712=0x0;_0x178712<_0x11ed52[_0x43ce('0x64')][_0x43ce('0x74')][_0x43ce('0x62')];_0x178712+=0x1){socket['emit'](_0x43ce('0xbe'),{'UserId':Number(_0x11ed52[_0x43ce('0x64')][_0x43ce('0x74')][_0x178712]),'MailAccountId':Number(_0x11ed52[_0x43ce('0x60')]['id'])});}return _0x16ced2;});}})[_0x43ce('0x10')](respondWithResult(_0x19fbf0,null))[_0x43ce('0x1b')](handleError(_0x19fbf0,null));};exports[_0x43ce('0xbf')]=function(_0x284ce1,_0x4e5f5a){return db['MailAccount'][_0x43ce('0x63')]({'where':{'id':_0x284ce1['params']['id']}})[_0x43ce('0x10')](handleEntityNotFound(_0x4e5f5a,null))[_0x43ce('0x10')](function(_0x5b089a){if(_0x5b089a){return _0x5b089a[_0x43ce('0xbf')](_0x284ce1['query']['ids'])[_0x43ce('0x10')](function(){if(_[_0x43ce('0xc0')](_0x284ce1['query'][_0x43ce('0x74')])){for(var _0x7221f6=0x0;_0x7221f6<_0x284ce1[_0x43ce('0x4c')]['ids'][_0x43ce('0x62')];_0x7221f6+=0x1){socket[_0x43ce('0xc1')]('userMailAccount:remove',{'UserId':Number(_0x284ce1['query'][_0x43ce('0x74')][_0x7221f6]),'MailAccountId':Number(_0x284ce1[_0x43ce('0x60')]['id'])});}}else{socket[_0x43ce('0xc1')](_0x43ce('0xc2'),{'UserId':Number(_0x284ce1['query'][_0x43ce('0x74')]),'MailAccountId':Number(_0x284ce1[_0x43ce('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x4e5f5a,null))[_0x43ce('0x1b')](handleError(_0x4e5f5a,null));};exports[_0x43ce('0xc3')]=function(_0x327913,_0x4f35c1){var _0x5eada1={};var _0x31537b={};var _0x322ac0;var _0x5b0223;return db[_0x43ce('0x45')][_0x43ce('0x6d')]({'where':{'id':_0x327913[_0x43ce('0x60')]['id']}})['then'](handleEntityNotFound(_0x4f35c1,null))[_0x43ce('0x10')](function(_0x2f99fd){if(_0x2f99fd){_0x322ac0=_0x2f99fd;_0x31537b[_0x43ce('0x49')]=_[_0x43ce('0x4b')](db[_0x43ce('0xc4')][_0x43ce('0x46')]);_0x31537b[_0x43ce('0x4c')]=_[_0x43ce('0x4b')](_0x327913[_0x43ce('0x4c')]);_0x31537b['filters']=_[_0x43ce('0x4e')](_0x31537b[_0x43ce('0x49')],_0x31537b[_0x43ce('0x4c')]);_0x5eada1['attributes']=_[_0x43ce('0x4e')](_0x31537b[_0x43ce('0x49')],qs[_0x43ce('0x4f')](_0x327913['query']['fields']));_0x5eada1[_0x43ce('0x50')]=_0x5eada1[_0x43ce('0x50')][_0x43ce('0x62')]?_0x5eada1[_0x43ce('0x50')]:_0x31537b[_0x43ce('0x49')];_0x5eada1[_0x43ce('0x53')]=qs[_0x43ce('0x54')](_0x327913[_0x43ce('0x4c')][_0x43ce('0x54')]);_0x5eada1[_0x43ce('0x55')]=qs[_0x43ce('0x4d')](_['pick'](_0x327913[_0x43ce('0x4c')],_0x31537b[_0x43ce('0x4d')]));if(_0x327913[_0x43ce('0x4c')][_0x43ce('0x56')]){_0x5eada1[_0x43ce('0x55')]=_[_0x43ce('0x57')](_0x5eada1[_0x43ce('0x55')],{'$or':_[_0x43ce('0x44')](_0x5eada1[_0x43ce('0x50')],function(_0x513d34){var _0xd24235={};_0xd24235[_0x513d34]={'$like':'%'+_0x327913[_0x43ce('0x4c')][_0x43ce('0x56')]+'%'};return _0xd24235;})});}_0x5eada1=_[_0x43ce('0x57')]({},_0x5eada1,_0x327913['options']);return _0x322ac0[_0x43ce('0xc3')](_0x5eada1);}})['then'](function(_0x337047){if(_0x337047){_0x5b0223=_0x337047[_0x43ce('0x62')];if(!_0x327913[_0x43ce('0x4c')][_0x43ce('0x51')]('nolimit')){_0x5eada1[_0x43ce('0x1f')]=qs[_0x43ce('0x1f')](_0x327913[_0x43ce('0x4c')][_0x43ce('0x1f')]);_0x5eada1['offset']=qs[_0x43ce('0x22')](_0x327913[_0x43ce('0x4c')]['offset']);}return _0x322ac0[_0x43ce('0xc3')](_0x5eada1);}})[_0x43ce('0x10')](function(_0x13304e){if(_0x13304e){return _0x13304e?{'count':_0x5b0223,'rows':_0x13304e}:null;}})[_0x43ce('0x10')](respondWithResult(_0x4f35c1,null))[_0x43ce('0x1b')](handleError(_0x4f35c1,null));}; \ No newline at end of file +var _0xa23f=['MailAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','show','params','MailServerOut','rawAttributes','include','find','body','provider','custom','MailServerIn','Mail\x20Account\x20not\x20found','describe','create','getDispositions','findOne','Disposition','hasOwnProperty','MailAccountId','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','finally','getApplications','getMessages','MailMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','getSmtpOptions','List\x20not\x20found','messageId','subject','out','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','moment','bluebird','lodash','juice','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','gmail','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','smtp-mail.outlook.com','user','password','modernAuthentication','CloudProviderId','pass','port','host','secure','service','authentication','Smtp','index','Imap','Pause','mandatoryDispositionPause','map'];(function(_0x4611e0,_0x9e2aa9){var _0x218136=function(_0x109bf1){while(--_0x109bf1){_0x4611e0['push'](_0x4611e0['shift']());}};_0x218136(++_0x9e2aa9);}(_0xa23f,0x7c));var _0xfa23=function(_0x2eff0b,_0x533335){_0x2eff0b=_0x2eff0b-0x0;var _0x2664a7=_0xa23f[_0x2eff0b];return _0x2664a7;};'use strict';var moment=require(_0xfa23('0x0'));var BPromise=require(_0xfa23('0x1'));var util=require('util');var path=require('path');var _=require(_0xfa23('0x2'));var juice=require(_0xfa23('0x3'));var Redis=require(_0xfa23('0x4'));var qs=require(_0xfa23('0x5'));var logger=require('../../config/logger')(_0xfa23('0x6'));var config=require('../../config/environment');var db=require(_0xfa23('0x7'))['db'];config[_0xfa23('0x8')]=_[_0xfa23('0x9')](config[_0xfa23('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xfa23('0xa'))(new Redis(config['redis']));require(_0xfa23('0xb'))[_0xfa23('0xc')](socket);var jayson=require(_0xfa23('0xd'));var client=jayson[_0xfa23('0xe')][_0xfa23('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x539453,_0x4b59d1,_0x20a9b6,_0x4ea7a8){return new BPromise(function(_0x3128d3,_0x5c0ec9){var _0x1b99b7=_0x4ea7a8||client;return _0x1b99b7[_0xfa23('0x10')](_0x539453,_0x20a9b6)[_0xfa23('0x11')](function(_0x52ef2a){logger[_0xfa23('0x12')](_0xfa23('0x13'),_0x4b59d1,_0xfa23('0x14'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x4b59d1,_0xfa23('0x14'),JSON[_0xfa23('0x15')](_0x52ef2a));if(_0x52ef2a[_0xfa23('0x16')]){if(_0x52ef2a[_0xfa23('0x16')]['code']===0x1f4){logger[_0xfa23('0x16')](_0xfa23('0x13'),_0x4b59d1,_0x52ef2a[_0xfa23('0x16')][_0xfa23('0x17')]);return _0x5c0ec9(_0x52ef2a['error'][_0xfa23('0x17')]);}logger[_0xfa23('0x16')](_0xfa23('0x13'),_0x4b59d1,_0x52ef2a[_0xfa23('0x16')][_0xfa23('0x17')]);return _0x3128d3(_0x52ef2a['error']['message']);}else{logger['info'](_0xfa23('0x13'),_0x4b59d1,_0xfa23('0x14'));_0x3128d3(_0x52ef2a['result'][_0xfa23('0x17')]);}})[_0xfa23('0x18')](function(_0x1eb87e){logger['error'](_0xfa23('0x13'),_0x4b59d1,_0x1eb87e);_0x5c0ec9(_0x1eb87e);});});}function respondWithStatusCode(_0x452604,_0x47c323){_0x47c323=_0x47c323||0xcc;return function(_0x16e4f9){if(_0x16e4f9){return _0x452604[_0xfa23('0x19')](_0x47c323);}return _0x452604[_0xfa23('0x1a')](_0x47c323)[_0xfa23('0x1b')]();};}function respondWithResult(_0x2ce89a,_0x10ef95){_0x10ef95=_0x10ef95||0xc8;return function(_0x31eedb){if(_0x31eedb){return _0x2ce89a['status'](_0x10ef95)[_0xfa23('0x1c')](_0x31eedb);}};}function respondWithFilteredResult(_0xf78c62,_0x34a2ce){return function(_0xe4680f){if(_0xe4680f){var _0x542cde=typeof _0x34a2ce[_0xfa23('0x1d')]==='undefined'&&typeof _0x34a2ce[_0xfa23('0x1e')]===_0xfa23('0x1f');var _0x2481e9=_0xe4680f[_0xfa23('0x20')];var _0x3362f3=_0x542cde?0x0:_0x34a2ce[_0xfa23('0x1d')];var _0x21bbc0=_0x542cde?_0xe4680f[_0xfa23('0x20')]:_0x34a2ce['offset']+_0x34a2ce[_0xfa23('0x1e')];var _0x4ab34d;if(_0x21bbc0>=_0x2481e9){_0x21bbc0=_0x2481e9;_0x4ab34d=0xc8;}else{_0x4ab34d=0xce;}_0xf78c62[_0xfa23('0x1a')](_0x4ab34d);return _0xf78c62['set']('Content-Range',_0x3362f3+'-'+_0x21bbc0+'/'+_0x2481e9)[_0xfa23('0x1c')](_0xe4680f);}return null;};}function saveUpdates(_0x1a9a90){return function(_0xbf9d19){if(_0xbf9d19){return _0xbf9d19[_0xfa23('0x21')](_0x1a9a90)[_0xfa23('0x11')](function(_0x24da31){return _0x24da31;});}return null;};}function removeEntity(_0x3c9d9d){return function(_0x4c1ab0){if(_0x4c1ab0){return _0x4c1ab0[_0xfa23('0x22')]()['then'](function(){var _0x380d42=_0x4c1ab0[_0xfa23('0x23')]({'plain':!![]});var _0x5df1f9=_0xfa23('0x24');return db[_0xfa23('0x25')][_0xfa23('0x22')]({'where':{'type':_0x5df1f9,'resourceId':_0x380d42['id']}})[_0xfa23('0x11')](function(){return _0x4c1ab0;});})[_0xfa23('0x11')](function(){_0x3c9d9d[_0xfa23('0x1a')](0xcc)[_0xfa23('0x1b')]();});}};}function handleEntityNotFound(_0x19c7bc){return function(_0x1617e3){if(!_0x1617e3){_0x19c7bc['sendStatus'](0x194);}return _0x1617e3;};}function handleError(_0x2eb32e,_0x59c393){_0x59c393=_0x59c393||0x1f4;return function(_0x9d0602){logger[_0xfa23('0x16')](_0x9d0602[_0xfa23('0x26')]);if(_0x9d0602[_0xfa23('0x27')]){delete _0x9d0602[_0xfa23('0x27')];}_0x2eb32e[_0xfa23('0x1a')](_0x59c393)[_0xfa23('0x28')](_0x9d0602);};}function getImapHost(_0x33aa43){switch(_0x33aa43){case _0xfa23('0x29'):return'imap.gmail.com';case _0xfa23('0x2a'):return'imap.mail.yahoo.com';case _0xfa23('0x2b'):return _0xfa23('0x2c');case _0xfa23('0x2d'):return _0xfa23('0x2e');}throw new Error(_0xfa23('0x2f'),_0x33aa43);}function getSmtpHost(_0x300ec0){switch(_0x300ec0){case _0xfa23('0x29'):return'smtp.gmail.com';case _0xfa23('0x2a'):return _0xfa23('0x30');case _0xfa23('0x2b'):return _0xfa23('0x31');case'outlook365':return'smtp.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x300ec0);}function getAuthenticationOptions(_0x4528cb,_0x3e004f){var _0x584fa2={};var _0x22fd83={};if(_0x4528cb){_0x584fa2[_0xfa23('0x32')]=_0x22fd83[_0xfa23('0x32')]=_0x3e004f['username'];_0x584fa2[_0xfa23('0x33')]=_0x22fd83['pass']=_0x3e004f[_0xfa23('0x33')];if(_0x3e004f[_0xfa23('0x34')]){_0x584fa2[_0xfa23('0x34')]=_0x22fd83[_0xfa23('0x34')]=!![];_0x584fa2[_0xfa23('0x35')]=_0x22fd83[_0xfa23('0x35')]=_0x3e004f['CloudProviderId'];_0x584fa2[_0xfa23('0x33')]=_0x22fd83[_0xfa23('0x36')]=null;}else{_0x584fa2[_0xfa23('0x35')]=_0x22fd83[_0xfa23('0x35')]=null;}_0x584fa2['host']=getImapHost(_0x4528cb);_0x584fa2[_0xfa23('0x37')]=0x3e1;_0x22fd83[_0xfa23('0x38')]=getSmtpHost(_0x4528cb);_0x22fd83[_0xfa23('0x37')]=0x24b;_0x22fd83[_0xfa23('0x39')]=![];_0x584fa2[_0xfa23('0x3a')]=_0x22fd83[_0xfa23('0x3a')]=null;}else{if(_0x3e004f['authentication']){_0x584fa2[_0xfa23('0x32')]=_0x22fd83['user']=_0x3e004f['username'];_0x584fa2[_0xfa23('0x33')]=_0x22fd83[_0xfa23('0x36')]=_0x3e004f['password'];}else{_0x584fa2[_0xfa23('0x3b')]=_0x22fd83[_0xfa23('0x3b')]=![];_0x584fa2[_0xfa23('0x32')]=_0x22fd83['user']=null;_0x584fa2[_0xfa23('0x33')]=_0x22fd83[_0xfa23('0x36')]=null;}_0x584fa2[_0xfa23('0x38')]=_0x3e004f['Imap']['host'];_0x584fa2[_0xfa23('0x37')]=_0x3e004f['Imap'][_0xfa23('0x37')];_0x22fd83[_0xfa23('0x38')]=_0x3e004f[_0xfa23('0x3c')]['host'];_0x22fd83[_0xfa23('0x37')]=_0x3e004f[_0xfa23('0x3c')][_0xfa23('0x37')];}return{'Imap':_0x584fa2,'Smtp':_0x22fd83};}exports[_0xfa23('0x3d')]=function(_0x4e7558,_0x857544){var _0x14e99b={'include':[{'model':db['MailServerIn'],'as':_0xfa23('0x3e')},{'model':db['MailServerOut'],'as':_0xfa23('0x3c')},{'model':db[_0xfa23('0x3f')],'as':_0xfa23('0x40')}]},_0x28b7ba={},_0x58657a={'count':0x0,'rows':[]};var _0xf8b228=_[_0xfa23('0x41')](db[_0xfa23('0x42')]['rawAttributes'],function(_0xd2345d){return{'name':_0xd2345d[_0xfa23('0x43')],'type':_0xd2345d[_0xfa23('0x44')][_0xfa23('0x45')]};});_0x28b7ba[_0xfa23('0x46')]=_[_0xfa23('0x41')](_0xf8b228,'name');_0x28b7ba[_0xfa23('0x47')]=_[_0xfa23('0x48')](_0x4e7558[_0xfa23('0x47')]);_0x28b7ba[_0xfa23('0x49')]=_[_0xfa23('0x4a')](_0x28b7ba['model'],_0x28b7ba[_0xfa23('0x47')]);_0x14e99b[_0xfa23('0x4b')]=_[_0xfa23('0x4a')](_0x28b7ba['model'],qs[_0xfa23('0x4c')](_0x4e7558[_0xfa23('0x47')][_0xfa23('0x4c')]));_0x14e99b[_0xfa23('0x4b')]=_0x14e99b[_0xfa23('0x4b')][_0xfa23('0x4d')]?_0x14e99b[_0xfa23('0x4b')]:_0x28b7ba['model'];if(!_0x4e7558[_0xfa23('0x47')]['hasOwnProperty'](_0xfa23('0x4e'))){_0x14e99b[_0xfa23('0x1e')]=qs[_0xfa23('0x1e')](_0x4e7558[_0xfa23('0x47')][_0xfa23('0x1e')]);_0x14e99b[_0xfa23('0x1d')]=qs['offset'](_0x4e7558[_0xfa23('0x47')][_0xfa23('0x1d')]);}_0x14e99b[_0xfa23('0x4f')]=qs[_0xfa23('0x50')](_0x4e7558[_0xfa23('0x47')][_0xfa23('0x50')]);_0x14e99b[_0xfa23('0x51')]=qs['filters'](_[_0xfa23('0x52')](_0x4e7558[_0xfa23('0x47')],_0x28b7ba[_0xfa23('0x49')]),_0xf8b228);if(_0x4e7558[_0xfa23('0x47')]['filter']){_0x14e99b[_0xfa23('0x51')]=_[_0xfa23('0x53')](_0x14e99b[_0xfa23('0x51')],{'$or':_[_0xfa23('0x41')](_0xf8b228,function(_0x401309){if(_0x401309[_0xfa23('0x44')]!=='VIRTUAL'){var _0x29ca4b={};_0x29ca4b[_0x401309['name']]={'$like':'%'+_0x4e7558[_0xfa23('0x47')][_0xfa23('0x54')]+'%'};return _0x29ca4b;}})});}_0x14e99b=_['merge']({},_0x14e99b,_0x4e7558[_0xfa23('0x55')]);var _0x39121b={'where':_0x14e99b['where']};return db[_0xfa23('0x42')][_0xfa23('0x20')](_0x39121b)['then'](function(_0x123116){_0x58657a[_0xfa23('0x20')]=_0x123116;if(_0x4e7558[_0xfa23('0x47')][_0xfa23('0x56')]){_0x14e99b['include']=[{'all':!![]}];}return db[_0xfa23('0x42')][_0xfa23('0x57')](_0x14e99b);})['then'](function(_0x2d1c75){_0x58657a[_0xfa23('0x58')]=_0x2d1c75;return _0x58657a;})[_0xfa23('0x11')](respondWithFilteredResult(_0x857544,_0x14e99b))[_0xfa23('0x18')](handleError(_0x857544,null));};exports[_0xfa23('0x59')]=function(_0x30e92f,_0x53b605){var _0x1924c7={'raw':![],'where':{'id':_0x30e92f[_0xfa23('0x5a')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xfa23('0x3e')},{'model':db[_0xfa23('0x5b')],'as':_0xfa23('0x3c')},{'model':db['Pause'],'as':_0xfa23('0x40')}]},_0x3a7fcb={};_0x3a7fcb[_0xfa23('0x46')]=_[_0xfa23('0x48')](db[_0xfa23('0x42')][_0xfa23('0x5c')]);_0x3a7fcb['query']=_['keys'](_0x30e92f[_0xfa23('0x47')]);_0x3a7fcb[_0xfa23('0x49')]=_[_0xfa23('0x4a')](_0x3a7fcb[_0xfa23('0x46')],_0x3a7fcb['query']);_0x1924c7['attributes']=_[_0xfa23('0x4a')](_0x3a7fcb[_0xfa23('0x46')],qs[_0xfa23('0x4c')](_0x30e92f[_0xfa23('0x47')]['fields']));_0x1924c7[_0xfa23('0x4b')]=_0x1924c7[_0xfa23('0x4b')]['length']?_0x1924c7[_0xfa23('0x4b')]:_0x3a7fcb[_0xfa23('0x46')];if(_0x30e92f['query'][_0xfa23('0x56')]){_0x1924c7[_0xfa23('0x5d')]=[{'all':!![]}];}_0x1924c7=_[_0xfa23('0x53')]({},_0x1924c7,_0x30e92f[_0xfa23('0x55')]);return db[_0xfa23('0x42')][_0xfa23('0x5e')](_0x1924c7)['then'](handleEntityNotFound(_0x53b605,null))[_0xfa23('0x11')](respondWithResult(_0x53b605,null))['catch'](handleError(_0x53b605,null));};exports[_0xfa23('0x21')]=function(_0x263f8c,_0x192d28){if(_0x263f8c[_0xfa23('0x5f')]['id']){delete _0x263f8c[_0xfa23('0x5f')]['id'];}var _0x1f9344=_0x263f8c[_0xfa23('0x5f')][_0xfa23('0x60')]===_0xfa23('0x61')?null:_0x263f8c['body'][_0xfa23('0x60')];var _0x55bb9b=_0x263f8c[_0xfa23('0x5f')][_0xfa23('0x3e')]||{};var _0x4c2103=_0x263f8c['body'][_0xfa23('0x3c')]||{};if(_0x1f9344){_0x55bb9b['host']=getImapHost(_0x1f9344);_0x55bb9b[_0xfa23('0x37')]=0x3e1;_0x4c2103[_0xfa23('0x38')]=getSmtpHost(_0x1f9344);_0x4c2103[_0xfa23('0x37')]=0x24b;_0x4c2103[_0xfa23('0x39')]=![];}if(_0x4c2103[_0xfa23('0x34')]){_0x4c2103[_0xfa23('0x39')]=![];}else{_0x4c2103[_0xfa23('0x35')]=null;}if(!_0x55bb9b['modernAuthentication'])_0x55bb9b['CloudProviderId']=null;_0x263f8c[_0xfa23('0x5f')][_0xfa23('0x3e')]=_0x55bb9b;_0x263f8c[_0xfa23('0x5f')][_0xfa23('0x3c')]=_0x4c2103;return db['MailAccount'][_0xfa23('0x5e')]({'where':{'id':_0x263f8c['params']['id']},'include':[{'model':db[_0xfa23('0x62')],'as':_0xfa23('0x3e')},{'model':db[_0xfa23('0x5b')],'as':_0xfa23('0x3c')},{'model':db[_0xfa23('0x3f')],'as':_0xfa23('0x40')}]})[_0xfa23('0x11')](handleEntityNotFound(_0x192d28,null))[_0xfa23('0x11')](function(_0x787989){if(!_0x787989)throw new Error(_0xfa23('0x63'));if(_0x787989['service'])delete _0x263f8c['body'][_0xfa23('0x3e')];return _0x787989;})['then'](saveUpdates(_0x263f8c[_0xfa23('0x5f')],null))['then'](function(_0x445f1e){if(!_0x263f8c[_0xfa23('0x5f')]['Imap'])return _0x445f1e;return db[_0xfa23('0x62')]['update'](_0x263f8c['body'][_0xfa23('0x3e')],{'where':{'MailAccountId':_0x445f1e['id']}})[_0xfa23('0x11')](function(){return _0x445f1e;});})['then'](function(_0xccca4d){if(!_0x263f8c[_0xfa23('0x5f')][_0xfa23('0x3c')])return _0xccca4d;return db[_0xfa23('0x5b')][_0xfa23('0x21')](_0x263f8c[_0xfa23('0x5f')][_0xfa23('0x3c')],{'where':{'MailAccountId':_0xccca4d['id']}})['then'](function(){return _0xccca4d;});})[_0xfa23('0x11')](respondWithResult(_0x192d28,null))[_0xfa23('0x18')](handleError(_0x192d28,null));};exports[_0xfa23('0x64')]=function(_0x9657f6,_0x21e87d){return db['MailAccount'][_0xfa23('0x64')]()['then'](respondWithResult(_0x21e87d,null))['catch'](handleError(_0x21e87d,null));};exports['addDisposition']=function(_0x1b303e,_0x329ef8){if(_0x1b303e[_0xfa23('0x5f')]['id']){delete _0x1b303e['body']['id'];}return db[_0xfa23('0x42')][_0xfa23('0x5e')]({'where':{'id':_0x1b303e['params']['id']}})[_0xfa23('0x11')](handleEntityNotFound(_0x329ef8,null))[_0xfa23('0x11')](function(_0x281fd2){if(_0x281fd2){_0x1b303e[_0xfa23('0x5f')]['MailAccountId']=_0x281fd2['id'];return db['Disposition'][_0xfa23('0x65')](_0x1b303e['body']);}})[_0xfa23('0x11')](respondWithResult(_0x329ef8,null))[_0xfa23('0x18')](handleError(_0x329ef8,null));};exports[_0xfa23('0x66')]=function(_0x4a77e5,_0x19d308){var _0x46feb9={'raw':![],'where':{}};var _0x195aaf={};var _0xcf4b16={'count':0x0,'rows':[]};return db[_0xfa23('0x42')][_0xfa23('0x67')]({'where':{'id':_0x4a77e5['params']['id']}})[_0xfa23('0x11')](handleEntityNotFound(_0x19d308,null))[_0xfa23('0x11')](function(_0x37548a){if(_0x37548a){_0x195aaf[_0xfa23('0x46')]=_[_0xfa23('0x48')](db[_0xfa23('0x68')]['rawAttributes']);_0x195aaf[_0xfa23('0x47')]=_[_0xfa23('0x48')](_0x4a77e5['query']);_0x195aaf[_0xfa23('0x49')]=_[_0xfa23('0x4a')](_0x195aaf[_0xfa23('0x46')],_0x195aaf[_0xfa23('0x47')]);_0x46feb9[_0xfa23('0x4b')]=_['intersection'](_0x195aaf[_0xfa23('0x46')],qs['fields'](_0x4a77e5['query']['fields']));_0x46feb9['attributes']=_0x46feb9[_0xfa23('0x4b')]['length']?_0x46feb9[_0xfa23('0x4b')]:_0x195aaf[_0xfa23('0x46')];if(!_0x4a77e5[_0xfa23('0x47')][_0xfa23('0x69')](_0xfa23('0x4e'))){_0x46feb9[_0xfa23('0x1e')]=qs[_0xfa23('0x1e')](_0x4a77e5[_0xfa23('0x47')]['limit']);_0x46feb9[_0xfa23('0x1d')]=qs['offset'](_0x4a77e5[_0xfa23('0x47')][_0xfa23('0x1d')]);}_0x46feb9['order']=qs[_0xfa23('0x50')](_0x4a77e5[_0xfa23('0x47')]['sort']);_0x46feb9[_0xfa23('0x51')]=qs['filters'](_[_0xfa23('0x52')](_0x4a77e5['query'],_0x195aaf[_0xfa23('0x49')]));_0x46feb9['where'][_0xfa23('0x6a')]=_0x37548a['id'];if(_0x4a77e5[_0xfa23('0x47')]['filter']){_0x46feb9[_0xfa23('0x51')]=_[_0xfa23('0x53')](_0x46feb9[_0xfa23('0x51')],{'$or':_['map'](_0x46feb9[_0xfa23('0x4b')],function(_0x518e4d){var _0xfee428={};_0xfee428[_0x518e4d]={'$like':'%'+_0x4a77e5[_0xfa23('0x47')][_0xfa23('0x54')]+'%'};return _0xfee428;})});}_0x46feb9=_[_0xfa23('0x53')]({},_0x46feb9,_0x4a77e5['options']);return db[_0xfa23('0x68')]['count']({'where':_0x46feb9[_0xfa23('0x51')]})['then'](function(_0x15e568){_0xcf4b16[_0xfa23('0x20')]=_0x15e568;if(_0x4a77e5[_0xfa23('0x47')][_0xfa23('0x56')]){_0x46feb9[_0xfa23('0x5d')]=[{'all':!![]}];}return db['Disposition'][_0xfa23('0x57')](_0x46feb9);})['then'](function(_0x47c07e){_0xcf4b16[_0xfa23('0x58')]=_0x47c07e;return _0xcf4b16;});}})[_0xfa23('0x11')](respondWithFilteredResult(_0x19d308,_0x46feb9))[_0xfa23('0x18')](handleError(_0x19d308,null));};exports[_0xfa23('0x6b')]=function(_0x49d168,_0x367701){return db[_0xfa23('0x42')][_0xfa23('0x5e')]({'where':{'id':_0x49d168[_0xfa23('0x5a')]['id']}})[_0xfa23('0x11')](handleEntityNotFound(_0x367701,null))[_0xfa23('0x11')](function(_0x2bdc8e){if(_0x2bdc8e){return _0x2bdc8e[_0xfa23('0x6b')](_0x49d168[_0xfa23('0x47')][_0xfa23('0x6c')]);}})[_0xfa23('0x11')](respondWithStatusCode(_0x367701,null))[_0xfa23('0x18')](handleError(_0x367701,null));};exports['addAnswer']=function(_0x267fb4,_0x3cc203){if(_0x267fb4[_0xfa23('0x5f')]['id']){delete _0x267fb4[_0xfa23('0x5f')]['id'];}return db[_0xfa23('0x42')][_0xfa23('0x5e')]({'where':{'id':_0x267fb4[_0xfa23('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3cc203,null))[_0xfa23('0x11')](function(_0x571f0a){if(_0x571f0a){_0x267fb4['body']['MailAccountId']=_0x571f0a['id'];return db['CannedAnswer'][_0xfa23('0x65')](_0x267fb4[_0xfa23('0x5f')]);}})[_0xfa23('0x11')](respondWithResult(_0x3cc203,null))['catch'](handleError(_0x3cc203,null));};exports[_0xfa23('0x6d')]=function(_0x1d5f64,_0x28ed8c){var _0xbda484={'raw':![],'where':{}};var _0x382afe={};var _0x5d397f={'count':0x0,'rows':[]};return db[_0xfa23('0x42')][_0xfa23('0x67')]({'where':{'id':_0x1d5f64[_0xfa23('0x5a')]['id']}})[_0xfa23('0x11')](handleEntityNotFound(_0x28ed8c,null))[_0xfa23('0x11')](function(_0x2152a1){if(_0x2152a1){_0x382afe['model']=_['keys'](db['CannedAnswer']['rawAttributes']);_0x382afe[_0xfa23('0x47')]=_[_0xfa23('0x48')](_0x1d5f64[_0xfa23('0x47')]);_0x382afe[_0xfa23('0x49')]=_[_0xfa23('0x4a')](_0x382afe['model'],_0x382afe[_0xfa23('0x47')]);_0xbda484[_0xfa23('0x4b')]=_[_0xfa23('0x4a')](_0x382afe['model'],qs[_0xfa23('0x4c')](_0x1d5f64['query']['fields']));_0xbda484[_0xfa23('0x4b')]=_0xbda484[_0xfa23('0x4b')][_0xfa23('0x4d')]?_0xbda484[_0xfa23('0x4b')]:_0x382afe['model'];if(!_0x1d5f64[_0xfa23('0x47')][_0xfa23('0x69')]('nolimit')){_0xbda484[_0xfa23('0x1e')]=qs[_0xfa23('0x1e')](_0x1d5f64['query']['limit']);_0xbda484[_0xfa23('0x1d')]=qs['offset'](_0x1d5f64[_0xfa23('0x47')][_0xfa23('0x1d')]);}_0xbda484[_0xfa23('0x4f')]=qs[_0xfa23('0x50')](_0x1d5f64[_0xfa23('0x47')][_0xfa23('0x50')]);_0xbda484[_0xfa23('0x51')]=qs[_0xfa23('0x49')](_[_0xfa23('0x52')](_0x1d5f64[_0xfa23('0x47')],_0x382afe[_0xfa23('0x49')]));_0xbda484['where'][_0xfa23('0x6a')]=_0x2152a1['id'];if(_0x1d5f64[_0xfa23('0x47')]['filter']){_0xbda484[_0xfa23('0x51')]=_[_0xfa23('0x53')](_0xbda484[_0xfa23('0x51')],{'$or':_[_0xfa23('0x41')](_0xbda484['attributes'],function(_0x55c627){var _0x3c4fde={};_0x3c4fde[_0x55c627]={'$like':'%'+_0x1d5f64[_0xfa23('0x47')][_0xfa23('0x54')]+'%'};return _0x3c4fde;})});}_0xbda484=_[_0xfa23('0x53')]({},_0xbda484,_0x1d5f64['options']);return db['CannedAnswer'][_0xfa23('0x20')]({'where':_0xbda484[_0xfa23('0x51')]})[_0xfa23('0x11')](function(_0x54705e){_0x5d397f[_0xfa23('0x20')]=_0x54705e;if(_0x1d5f64[_0xfa23('0x47')]['includeAll']){_0xbda484[_0xfa23('0x5d')]=[{'all':!![]}];}return db[_0xfa23('0x6e')][_0xfa23('0x57')](_0xbda484);})[_0xfa23('0x11')](function(_0x35c4b2){_0x5d397f[_0xfa23('0x58')]=_0x35c4b2;return _0x5d397f;});}})[_0xfa23('0x11')](respondWithFilteredResult(_0x28ed8c,_0xbda484))[_0xfa23('0x18')](handleError(_0x28ed8c,null));};exports[_0xfa23('0x6f')]=function(_0x50ac27,_0x597d8b){return db[_0xfa23('0x42')][_0xfa23('0x5e')]({'where':{'id':_0x50ac27[_0xfa23('0x5a')]['id']}})['then'](handleEntityNotFound(_0x597d8b,null))[_0xfa23('0x11')](function(_0x3591ce){if(_0x3591ce){return _0x3591ce[_0xfa23('0x6f')](_0x50ac27[_0xfa23('0x47')][_0xfa23('0x6c')]);}})[_0xfa23('0x11')](respondWithStatusCode(_0x597d8b,null))[_0xfa23('0x18')](handleError(_0x597d8b,null));};exports[_0xfa23('0x65')]=function(_0x5755d0,_0x2d17b1){var _0x25651f={'name':_0x5755d0[_0xfa23('0x5f')][_0xfa23('0x27')],'key':_0x5755d0[_0xfa23('0x5f')][_0xfa23('0x45')],'provider':_0x5755d0['body'][_0xfa23('0x60')]===_0xfa23('0x61')?null:_0x5755d0['body'][_0xfa23('0x60')],'email':_0x5755d0[_0xfa23('0x5f')][_0xfa23('0x70')],'ListId':_0x5755d0[_0xfa23('0x5f')][_0xfa23('0x71')],'active':!_[_0xfa23('0x72')](_0x5755d0[_0xfa23('0x5f')][_0xfa23('0x73')])?_0x5755d0[_0xfa23('0x5f')][_0xfa23('0x73')]:!![],'description':_0x5755d0[_0xfa23('0x5f')][_0xfa23('0x74')]||null};var _0xcfcd5c=getAuthenticationOptions(_0x25651f[_0xfa23('0x60')],_0x5755d0[_0xfa23('0x5f')]);_0x25651f[_0xfa23('0x3e')]=_0xcfcd5c[_0xfa23('0x3e')];_0x25651f[_0xfa23('0x3c')]=_0xcfcd5c[_0xfa23('0x3c')];return db[_0xfa23('0x42')][_0xfa23('0x65')](_0x25651f,{'include':[{'model':db['MailServerOut'],'as':_0xfa23('0x3c')},{'model':db[_0xfa23('0x62')],'as':_0xfa23('0x3e')}]})[_0xfa23('0x11')](function(_0x146d2e){var _0x55d550=_0x5755d0[_0xfa23('0x32')][_0xfa23('0x23')]({'plain':!![]});if(!_0x55d550)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55d550[_0xfa23('0x75')]===_0xfa23('0x32')){var _0xd1193a=_0x146d2e[_0xfa23('0x23')]({'plain':!![]});return db[_0xfa23('0x76')][_0xfa23('0x5e')]({'where':{'name':'MailAccounts','userProfileId':_0x55d550[_0xfa23('0x77')]},'raw':!![]})[_0xfa23('0x11')](function(_0x3b6730){if(_0x3b6730&&_0x3b6730[_0xfa23('0x78')]===0x0){return db[_0xfa23('0x25')][_0xfa23('0x65')]({'name':_0xd1193a[_0xfa23('0x27')],'resourceId':_0xd1193a['id'],'type':_0x3b6730[_0xfa23('0x27')],'sectionId':_0x3b6730['id']},{})[_0xfa23('0x11')](function(){return _0x146d2e;});}else{return _0x146d2e;}})['catch'](function(_0x3335ec){logger[_0xfa23('0x16')](_0xfa23('0x79'),_0x3335ec);throw _0x3335ec;});}return _0x146d2e;})['then'](respondWithResult(_0x2d17b1,0xc9))[_0xfa23('0x18')](handleError(_0x2d17b1,null));};exports[_0xfa23('0x7a')]=function(_0x11f764,_0x2a52ad){return db[_0xfa23('0x42')][_0xfa23('0x67')]({'where':{'id':_0x11f764[_0xfa23('0x5a')]['id']}})[_0xfa23('0x11')](handleEntityNotFound(_0x2a52ad,null))[_0xfa23('0x11')](function(_0x15bfc2){if(_0x15bfc2){return _0x15bfc2['getImap']();}return null;})[_0xfa23('0x11')](respondWithResult(_0x2a52ad,null))[_0xfa23('0x18')](handleError(_0x2a52ad,null));};exports['addImap']=function(_0x48f2ee,_0x3cc5f6){if(_0x48f2ee[_0xfa23('0x5f')]['id']){delete _0x48f2ee[_0xfa23('0x5f')]['id'];}return db[_0xfa23('0x42')]['find']({'where':{'id':_0x48f2ee[_0xfa23('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3cc5f6,null))[_0xfa23('0x11')](function(_0x59ca8a){if(_0x59ca8a){_0x48f2ee[_0xfa23('0x5f')][_0xfa23('0x6a')]=_0x59ca8a['id'];return db['MailServerIn'][_0xfa23('0x65')](_0x48f2ee[_0xfa23('0x5f')]);}})[_0xfa23('0x11')](respondWithResult(_0x3cc5f6,null))[_0xfa23('0x18')](handleError(_0x3cc5f6,null));};exports[_0xfa23('0x7b')]=function(_0x52a8bb,_0x31ce88){return db[_0xfa23('0x42')]['findOne']({'where':{'id':_0x52a8bb['params']['id']}})[_0xfa23('0x11')](handleEntityNotFound(_0x31ce88,null))[_0xfa23('0x11')](function(_0x212e59){if(_0x212e59){return _0x212e59[_0xfa23('0x7c')](null);}return null;})[_0xfa23('0x11')](respondWithStatusCode(_0x31ce88,null))[_0xfa23('0x18')](handleError(_0x31ce88,null));};exports[_0xfa23('0x7d')]=function(_0x1f91cd,_0x268bd9){return db[_0xfa23('0x42')][_0xfa23('0x67')]({'where':{'id':_0x1f91cd[_0xfa23('0x5a')]['id']}})[_0xfa23('0x11')](handleEntityNotFound(_0x268bd9,null))[_0xfa23('0x11')](function(_0x3c0db9){if(_0x3c0db9){return _0x3c0db9['getSmtp']();}return null;})['then'](respondWithResult(_0x268bd9,null))['catch'](handleError(_0x268bd9,null));};exports[_0xfa23('0x7e')]=function(_0x5eacf4,_0x2213e6){if(_0x5eacf4[_0xfa23('0x5f')]['id']){delete _0x5eacf4[_0xfa23('0x5f')]['id'];}return db[_0xfa23('0x42')]['find']({'where':{'id':_0x5eacf4[_0xfa23('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2213e6,null))[_0xfa23('0x11')](function(_0x540b78){if(_0x540b78){_0x5eacf4[_0xfa23('0x5f')][_0xfa23('0x6a')]=_0x540b78['id'];return db[_0xfa23('0x5b')][_0xfa23('0x65')](_0x5eacf4[_0xfa23('0x5f')]);}})[_0xfa23('0x11')](respondWithResult(_0x2213e6,null))[_0xfa23('0x18')](handleError(_0x2213e6,null));};exports[_0xfa23('0x7f')]=function(_0x478d8c,_0x3cb708){return db[_0xfa23('0x42')][_0xfa23('0x67')]({'where':{'id':_0x478d8c[_0xfa23('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3cb708,null))[_0xfa23('0x11')](function(_0x25bedb){if(_0x25bedb){return _0x25bedb[_0xfa23('0x80')](null);}return null;})[_0xfa23('0x11')](respondWithStatusCode(_0x3cb708,null))[_0xfa23('0x18')](handleError(_0x3cb708,null));};exports[_0xfa23('0x81')]=function(_0x2fff8e,_0x3bae0b){return db[_0xfa23('0x82')]['find']({'where':{'id':_0x2fff8e[_0xfa23('0x5a')]['id']}})[_0xfa23('0x11')](handleEntityNotFound(_0x3bae0b,null))[_0xfa23('0x11')](function(_0x4e29da){if(_0x4e29da){return _0x4e29da['addInteraction'](_0x2fff8e[_0xfa23('0x5f')][_0xfa23('0x6c')],_[_0xfa23('0x83')](_0x2fff8e[_0xfa23('0x5f')],[_0xfa23('0x6c'),'id'])||{});}})[_0xfa23('0x11')](respondWithResult(_0x3bae0b,null))['catch'](handleError(_0x3bae0b,null));};exports[_0xfa23('0x84')]=function(_0x2c4fb0,_0x5440a4){var _0x31bf34={'raw':![],'where':{}};var _0x2fe73b={};var _0x3e791b={'count':0x0,'rows':[]};return db[_0xfa23('0x42')][_0xfa23('0x67')]({'where':{'id':_0x2c4fb0[_0xfa23('0x5a')]['id']}})[_0xfa23('0x11')](handleEntityNotFound(_0x5440a4,null))['then'](function(_0x38c6ca){if(_0x38c6ca){_0x2fe73b[_0xfa23('0x46')]=_[_0xfa23('0x48')](db['MailInteraction'][_0xfa23('0x5c')]);_0x2fe73b['query']=_[_0xfa23('0x48')](_0x2c4fb0[_0xfa23('0x47')]);_0x2fe73b[_0xfa23('0x49')]=_[_0xfa23('0x4a')](_0x2fe73b[_0xfa23('0x46')],_0x2fe73b['query']);_0x31bf34[_0xfa23('0x4b')]=_[_0xfa23('0x4a')](_0x2fe73b[_0xfa23('0x46')],qs[_0xfa23('0x4c')](_0x2c4fb0[_0xfa23('0x47')][_0xfa23('0x4c')]));_0x31bf34[_0xfa23('0x4b')]=_0x31bf34[_0xfa23('0x4b')]['length']?_0x31bf34[_0xfa23('0x4b')]:_0x2fe73b['model'];if(!_0x2c4fb0[_0xfa23('0x47')][_0xfa23('0x69')](_0xfa23('0x4e'))){_0x31bf34[_0xfa23('0x1e')]=qs[_0xfa23('0x1e')](_0x2c4fb0['query'][_0xfa23('0x1e')]);_0x31bf34['offset']=qs[_0xfa23('0x1d')](_0x2c4fb0[_0xfa23('0x47')][_0xfa23('0x1d')]);}_0x31bf34[_0xfa23('0x4f')]=qs[_0xfa23('0x50')](_0x2c4fb0[_0xfa23('0x47')][_0xfa23('0x50')]);_0x31bf34[_0xfa23('0x51')]=qs[_0xfa23('0x49')](_[_0xfa23('0x52')](_0x2c4fb0['query'],_0x2fe73b[_0xfa23('0x49')]));_0x31bf34[_0xfa23('0x51')][_0xfa23('0x6a')]=_0x38c6ca['id'];if(_0x2c4fb0[_0xfa23('0x47')][_0xfa23('0x54')]){_0x31bf34['where']=_[_0xfa23('0x53')](_0x31bf34[_0xfa23('0x51')],{'$or':_[_0xfa23('0x41')](_0x31bf34[_0xfa23('0x4b')],function(_0x2b3307){var _0x5a2686={};_0x5a2686[_0x2b3307]={'$like':'%'+_0x2c4fb0[_0xfa23('0x47')][_0xfa23('0x54')]+'%'};return _0x5a2686;})});}_0x31bf34=_[_0xfa23('0x53')]({},_0x31bf34,_0x2c4fb0[_0xfa23('0x55')]);return db[_0xfa23('0x82')]['count']({'where':_0x31bf34[_0xfa23('0x51')]})['then'](function(_0x55dc5f){_0x3e791b['count']=_0x55dc5f;if(_0x2c4fb0[_0xfa23('0x47')]['includeAll']){_0x31bf34['include']=[{'model':db[_0xfa23('0x85')],'as':_0xfa23('0x86'),'required':![]},{'model':db[_0xfa23('0x87')],'as':_0xfa23('0x88'),'attributes':[_0xfa23('0x27'),_0xfa23('0x89'),_0xfa23('0x8a')],'required':![]},{'model':db[_0xfa23('0x8b')],'as':_0xfa23('0x8c'),'attributes':['id',_0xfa23('0x27'),_0xfa23('0x8d')],'where':_0x2c4fb0[_0xfa23('0x47')][_0xfa23('0x8e')]?{'id':_0x2c4fb0[_0xfa23('0x47')][_0xfa23('0x8e')]}:undefined,'required':_0x2c4fb0[_0xfa23('0x47')][_0xfa23('0x8e')]?!![]:![]}];}return db['MailInteraction'][_0xfa23('0x57')](_0x31bf34);})['then'](function(_0x369b88){_0x3e791b[_0xfa23('0x58')]=_0x369b88;return _0x3e791b;});}})['then'](respondWithFilteredResult(_0x5440a4,_0x31bf34))[_0xfa23('0x18')](handleError(_0x5440a4,null));};exports[_0xfa23('0x8f')]=function addApplications(_0x235ea6,_0xdb3e45){var _0x128400=_0x235ea6[_0xfa23('0x5a')]['id'];var _0x156a42=_0x235ea6[_0xfa23('0x5f')];var _0x196a20=0xc8;var _0x35971d=null;return db[_0xfa23('0x90')][_0xfa23('0x91')]({'isolationLevel':db[_0xfa23('0x90')]['Transaction'][_0xfa23('0x92')][_0xfa23('0x93')]},function(_0x1ed7c5){return db[_0xfa23('0x42')][_0xfa23('0x67')]({'where':{'id':_0x128400},'transaction':_0x1ed7c5})[_0xfa23('0x11')](function(_0x287132){if(_0x287132){return db[_0xfa23('0x94')][_0xfa23('0x22')]({'where':{'MailAccountId':_0x128400},'transaction':_0x1ed7c5})[_0xfa23('0x11')](function(){var _0x55f89c=_[_0xfa23('0x41')](_0x156a42,function(_0x4d2468){_0x4d2468[_0xfa23('0x6a')]=_0x128400;return _0x4d2468;});return db[_0xfa23('0x94')]['bulkCreate'](_0x55f89c,{'transaction':_0x1ed7c5});});}else{_0x196a20=0x194;_0x35971d=[];}});})[_0xfa23('0x11')](function(){if(_0x196a20!==0x194){return db[_0xfa23('0x94')][_0xfa23('0x95')]({'where':{'MailAccountId':_0x128400},'order':'priority'})[_0xfa23('0x11')](function(_0x47cb3e){_0x35971d=_0x47cb3e;});}})[_0xfa23('0x18')](function(_0x5efee0){_0x196a20=0x1f4;logger[_0xfa23('0x16')](_0x5efee0[_0xfa23('0x26')]);if(_0x5efee0[_0xfa23('0x27')]){delete _0x5efee0[_0xfa23('0x27')];}_0x35971d=_0x5efee0;})[_0xfa23('0x96')](function(){if(_0x35971d===null){_0xdb3e45[_0xfa23('0x19')](_0x196a20);}else{if(_0x196a20===0x1f4){_0xdb3e45[_0xfa23('0x1a')](_0x196a20)[_0xfa23('0x28')](_0x35971d);}else{_0xdb3e45[_0xfa23('0x1a')](_0x196a20)[_0xfa23('0x1c')](_0x35971d);}}});};exports[_0xfa23('0x97')]=function(_0x5c038b,_0x487203){var _0x188ce1={};var _0x5db43d={};var _0x545e64;var _0x268dad;return db[_0xfa23('0x42')][_0xfa23('0x67')]({'where':{'id':_0x5c038b[_0xfa23('0x5a')]['id']}})[_0xfa23('0x11')](handleEntityNotFound(_0x487203,null))['then'](function(_0x4bbf37){if(_0x4bbf37){_0x545e64=_0x4bbf37;_0x5db43d[_0xfa23('0x46')]=_[_0xfa23('0x48')](db[_0xfa23('0x94')][_0xfa23('0x5c')]);_0x5db43d['query']=_['keys'](_0x5c038b[_0xfa23('0x47')]);_0x5db43d[_0xfa23('0x49')]=_['intersection'](_0x5db43d[_0xfa23('0x46')],_0x5db43d[_0xfa23('0x47')]);_0x188ce1[_0xfa23('0x4b')]=_[_0xfa23('0x4a')](_0x5db43d[_0xfa23('0x46')],qs[_0xfa23('0x4c')](_0x5c038b[_0xfa23('0x47')][_0xfa23('0x4c')]));_0x188ce1[_0xfa23('0x4b')]=_0x188ce1[_0xfa23('0x4b')][_0xfa23('0x4d')]?_0x188ce1[_0xfa23('0x4b')]:_0x5db43d[_0xfa23('0x46')];_0x188ce1[_0xfa23('0x4f')]=qs['sort'](_0x5c038b['query'][_0xfa23('0x50')]);_0x188ce1[_0xfa23('0x51')]=qs[_0xfa23('0x49')](_[_0xfa23('0x52')](_0x5c038b[_0xfa23('0x47')],_0x5db43d[_0xfa23('0x49')]));if(_0x5c038b['query'][_0xfa23('0x54')]){_0x188ce1[_0xfa23('0x51')]=_[_0xfa23('0x53')](_0x188ce1[_0xfa23('0x51')],{'$or':_[_0xfa23('0x41')](_0x188ce1[_0xfa23('0x4b')],function(_0x2048a6){var _0xad8355={};_0xad8355[_0x2048a6]={'$like':'%'+_0x5c038b[_0xfa23('0x47')][_0xfa23('0x54')]+'%'};return _0xad8355;})});}_0x188ce1=_['merge']({},_0x188ce1,_0x5c038b[_0xfa23('0x55')]);return _0x545e64['getApplications'](_0x188ce1);}})[_0xfa23('0x11')](function(_0x3d4904){if(_0x3d4904){_0x268dad=_0x3d4904[_0xfa23('0x4d')];if(!_0x5c038b['query'][_0xfa23('0x69')]('nolimit')){_0x188ce1[_0xfa23('0x1e')]=qs['limit'](_0x5c038b[_0xfa23('0x47')][_0xfa23('0x1e')]);_0x188ce1[_0xfa23('0x1d')]=qs[_0xfa23('0x1d')](_0x5c038b[_0xfa23('0x47')][_0xfa23('0x1d')]);}return _0x545e64[_0xfa23('0x97')](_0x188ce1);}})[_0xfa23('0x11')](function(_0x3f72eb){if(_0x3f72eb){return _0x3f72eb?{'count':_0x268dad,'rows':_0x3f72eb}:null;}})[_0xfa23('0x11')](respondWithResult(_0x487203,null))[_0xfa23('0x18')](handleError(_0x487203,null));};exports[_0xfa23('0x98')]=function(_0x2540ab,_0x245069){var _0x107ac7={'raw':!![],'where':{}};var _0x5d3b38={};var _0x15f3df={'count':0x0,'rows':[]};return db[_0xfa23('0x42')]['findOne']({'where':{'id':_0x2540ab['params']['id']}})[_0xfa23('0x11')](handleEntityNotFound(_0x245069,null))[_0xfa23('0x11')](function(_0x1df102){if(_0x1df102){_0x5d3b38['model']=_[_0xfa23('0x48')](db[_0xfa23('0x99')][_0xfa23('0x5c')]);_0x5d3b38[_0xfa23('0x47')]=_['keys'](_0x2540ab[_0xfa23('0x47')]);_0x5d3b38[_0xfa23('0x49')]=_[_0xfa23('0x4a')](_0x5d3b38[_0xfa23('0x46')],_0x5d3b38[_0xfa23('0x47')]);_0x107ac7[_0xfa23('0x4b')]=_[_0xfa23('0x4a')](_0x5d3b38[_0xfa23('0x46')],qs[_0xfa23('0x4c')](_0x2540ab[_0xfa23('0x47')]['fields']));_0x107ac7[_0xfa23('0x4b')]=_0x107ac7[_0xfa23('0x4b')][_0xfa23('0x4d')]?_0x107ac7['attributes']:_0x5d3b38[_0xfa23('0x46')];if(!_0x2540ab['query'][_0xfa23('0x69')](_0xfa23('0x4e'))){_0x107ac7[_0xfa23('0x1e')]=qs[_0xfa23('0x1e')](_0x2540ab['query'][_0xfa23('0x1e')]);_0x107ac7[_0xfa23('0x1d')]=qs[_0xfa23('0x1d')](_0x2540ab[_0xfa23('0x47')][_0xfa23('0x1d')]);}_0x107ac7[_0xfa23('0x4f')]=qs[_0xfa23('0x50')](_0x2540ab[_0xfa23('0x47')]['sort']);_0x107ac7[_0xfa23('0x51')]=qs[_0xfa23('0x49')](_['pick'](_0x2540ab['query'],_0x5d3b38['filters']));_0x107ac7['where'][_0xfa23('0x6a')]=_0x1df102['id'];if(_0x2540ab[_0xfa23('0x47')][_0xfa23('0x54')]){_0x107ac7[_0xfa23('0x51')]=_[_0xfa23('0x53')](_0x107ac7[_0xfa23('0x51')],{'$or':_[_0xfa23('0x41')](_0x107ac7[_0xfa23('0x4b')],function(_0x1515ab){var _0x31d48c={};_0x31d48c[_0x1515ab]={'$like':'%'+_0x2540ab[_0xfa23('0x47')][_0xfa23('0x54')]+'%'};return _0x31d48c;})});}if(_0x2540ab[_0xfa23('0x47')]['$gte']){var _0x146f3f=_0x2540ab[_0xfa23('0x47')]['$gte'][_0xfa23('0x9a')](',');var _0x13e415={};_0x13e415[_0x146f3f[0x0]]={'$gte':moment(_0x146f3f[0x1])[_0xfa23('0x9b')](_0xfa23('0x9c'))};_0x107ac7[_0xfa23('0x51')]=_[_0xfa23('0x53')](_0x107ac7['where'],_0x13e415);}_0x107ac7=_[_0xfa23('0x53')]({},_0x107ac7,_0x2540ab['options']);return db['MailMessage'][_0xfa23('0x20')]({'where':_0x107ac7['where']})['then'](function(_0x384332){_0x15f3df[_0xfa23('0x20')]=_0x384332;if(_0x2540ab[_0xfa23('0x47')][_0xfa23('0x56')]){_0x107ac7['include']=[{'all':!![]}];}return db[_0xfa23('0x99')][_0xfa23('0x57')](_0x107ac7);})[_0xfa23('0x11')](function(_0x50d80a){if(_0x2540ab[_0xfa23('0x47')][_0xfa23('0x9d')]===_0xfa23('0x9e')){for(var _0x2a6c4f=0x0;_0x2a6c4f<_0x50d80a[_0xfa23('0x4d')];_0x2a6c4f++){_0x50d80a[_0x2a6c4f][_0xfa23('0x5f')]=juice(_0x50d80a[_0x2a6c4f][_0xfa23('0x5f')]);}}_0x15f3df[_0xfa23('0x58')]=_0x50d80a;return _0x15f3df;});}})[_0xfa23('0x11')](respondWithFilteredResult(_0x245069,_0x107ac7))['catch'](handleError(_0x245069,null));};exports[_0xfa23('0x28')]=function(_0x4ac1af,_0x3507c6){var _0x391822,_0x79d263={},_0x1c0130;if(_0x4ac1af[_0xfa23('0x5f')]['to']){_0x1c0130=_0x4ac1af[_0xfa23('0x5f')]['to']['split'](',')[0x0];}return db[_0xfa23('0x42')]['find']({'where':{'id':_0x4ac1af[_0xfa23('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0xfa23('0x9f'),'include':[{'model':db[_0xfa23('0x85')],'as':_0xfa23('0xa0'),'where':{'email':_0x1c0130},'limit':0x1,'order':[[_0xfa23('0xa1'),_0xfa23('0xa2')]]}]},{'model':db[_0xfa23('0x5b')],'as':_0xfa23('0x3c'),'raw':!![],'include':[{'model':db[_0xfa23('0xa3')],'as':_0xfa23('0xa3'),'raw':!![]}]}]})[_0xfa23('0x11')](handleEntityNotFound(_0x3507c6,null))[_0xfa23('0x11')](function(_0x3e77fb){if(!_0x3e77fb)return;_0x391822=_0x3e77fb;if(!_0x3e77fb['Smtp'])throw new Error(_0xfa23('0xa4'));if(_[_0xfa23('0x72')](_0x4ac1af[_0xfa23('0x5f')][_0xfa23('0xa5')])){_0x4ac1af[_0xfa23('0x5f')][_0xfa23('0xa5')]=util['format'](_0xfa23('0xa6'),_0x3e77fb[_0xfa23('0x27')],_0x3e77fb[_0xfa23('0x70')]||_0x3e77fb['Smtp'][_0xfa23('0x32')]);}if(_0x4ac1af[_0xfa23('0x5f')][_0xfa23('0xa7')]&&_0x4ac1af[_0xfa23('0x5f')]['attachments'][_0xfa23('0x4d')]){for(var _0x4072ec=0x0;_0x4072ec<_0x4ac1af['body'][_0xfa23('0xa7')][_0xfa23('0x4d')];_0x4072ec+=0x1){_0x4ac1af['body'][_0xfa23('0xa7')][_0x4072ec]={'filename':_0x4ac1af[_0xfa23('0x5f')][_0xfa23('0xa7')][_0x4072ec][_0xfa23('0x27')],'path':path[_0xfa23('0xa8')](config[_0xfa23('0xa9')],_0xfa23('0xaa'),_0x4ac1af['body']['attachments'][_0x4072ec]['basename'])};}}var _0x15e683=_0x3e77fb[_0xfa23('0xab')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x15e683,'message':_0x4ac1af[_0xfa23('0x5f')]});})[_0xfa23('0x11')](function(_0x1f66f6){if(!_0x1f66f6)return;_0x79d263=_0x1f66f6;if(!_0x391822[_0xfa23('0x9f')])throw new Error(_0xfa23('0xac'));if(_0x391822[_0xfa23('0x9f')]['Contacts'][_0xfa23('0x4d')])return _0x391822[_0xfa23('0x9f')][_0xfa23('0xa0')][0x0];return db[_0xfa23('0x85')][_0xfa23('0x65')](_[_0xfa23('0x9')](_0x4ac1af[_0xfa23('0x5f')],{'firstName':_0x4ac1af[_0xfa23('0x5f')]['to'],'email':_0x4ac1af['body']['to'],'phone':_0x4ac1af[_0xfa23('0x5f')]['to'],'ListId':_0x391822[_0xfa23('0x71')]}));})[_0xfa23('0x11')](function(_0x119558){if(!_0x119558)return;var _0x45bc08={'UserId':_0x4ac1af[_0xfa23('0x32')]['id'],'ContactId':_0x119558['id'],'MailAccountId':_0x391822['id'],'inReplyTo':_0x79d263[_0xfa23('0xad')],'to':_0x4ac1af[_0xfa23('0x5f')]['from'],'cc':_0x4ac1af[_0xfa23('0x5f')]['cc'],'subject':_0x4ac1af[_0xfa23('0x5f')][_0xfa23('0xae')],'attach':_0x4ac1af[_0xfa23('0x5f')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0xfa23('0x9b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xfa23('0xaf'),'Messages':[_['merge'](_0x4ac1af[_0xfa23('0x5f')],{'messageId':_0x79d263[_0xfa23('0xad')],'sentAt':moment()[_0xfa23('0x9b')](_0xfa23('0x9c')),'read':!![],'MailAccountId':_0x391822['id'],'UserId':_0x4ac1af['user']['id'],'ContactId':_0x119558['id']})]};if(_0x4ac1af[_0xfa23('0x5f')]['Interaction']){_0x45bc08=_[_0xfa23('0x53')](_0x45bc08,_0x4ac1af[_0xfa23('0x5f')][_0xfa23('0xb0')]);}return db['MailInteraction'][_0xfa23('0x65')](_0x45bc08,{'include':[{'model':db[_0xfa23('0x99')],'as':_0xfa23('0xb1')}]});})['then'](respondWithResult(_0x3507c6,null))[_0xfa23('0x18')](handleError(_0x3507c6,null));};exports['verifySmtp']=function(_0x4944af,_0x8d8a1e){return db[_0xfa23('0x42')][_0xfa23('0x5e')]({'where':{'id':_0x4944af[_0xfa23('0x5a')]['id']},'include':[{'model':db[_0xfa23('0x5b')],'as':_0xfa23('0x3c'),'raw':!![],'include':[{'model':db[_0xfa23('0xa3')],'as':_0xfa23('0xa3'),'raw':!![]}]}]})[_0xfa23('0x11')](handleEntityNotFound(_0x8d8a1e,null))[_0xfa23('0x11')](function(_0x1bfc19){if(!_0x1bfc19[_0xfa23('0x3c')])return;var _0x156dc5=_0x1bfc19[_0xfa23('0xab')]();return respondWithRpcPromise(_0xfa23('0xb2'),_0xfa23('0xb3'),{'account':_0x156dc5});})[_0xfa23('0x11')](respondWithResult(_0x8d8a1e,null))[_0xfa23('0x18')](handleError(_0x8d8a1e,null));};exports[_0xfa23('0x22')]=function(_0x12a759,_0x322b19){return db[_0xfa23('0x42')]['find']({'where':{'id':_0x12a759[_0xfa23('0x5a')]['id']}})[_0xfa23('0x11')](handleEntityNotFound(_0x322b19,null))[_0xfa23('0x11')](function(_0x1e867e){if(_0x1e867e&&_0x1e867e[_0xfa23('0x3a')]){throw new db[(_0xfa23('0xb4'))]['ValidationError'](_0xfa23('0xb5'));}return _0x1e867e;})[_0xfa23('0x11')](removeEntity(_0x322b19,null))[_0xfa23('0x18')](handleError(_0x322b19,null));};exports[_0xfa23('0xb6')]=function(_0x5bc9af,_0x4c3fdb){return db[_0xfa23('0x42')][_0xfa23('0x5e')]({'where':{'id':_0x5bc9af[_0xfa23('0x5a')]['id']}})[_0xfa23('0x11')](handleEntityNotFound(_0x4c3fdb,null))[_0xfa23('0x11')](function(_0x1567d5){if(_0x1567d5){return _0x1567d5[_0xfa23('0xb6')](_0x5bc9af[_0xfa23('0x5f')][_0xfa23('0x6c')],_['omit'](_0x5bc9af[_0xfa23('0x5f')],[_0xfa23('0x6c'),'id'])||{})[_0xfa23('0xb7')](function(_0x115e1d){for(var _0x436c39=0x0;_0x436c39<_0x5bc9af[_0xfa23('0x5f')][_0xfa23('0x6c')][_0xfa23('0x4d')];_0x436c39+=0x1){socket['emit'](_0xfa23('0xb8'),{'UserId':Number(_0x5bc9af[_0xfa23('0x5f')][_0xfa23('0x6c')][_0x436c39]),'MailAccountId':Number(_0x5bc9af[_0xfa23('0x5a')]['id'])});}return _0x115e1d;});}})[_0xfa23('0x11')](respondWithResult(_0x4c3fdb,null))[_0xfa23('0x18')](handleError(_0x4c3fdb,null));};exports[_0xfa23('0xb9')]=function(_0x23493b,_0x2d9b01){return db[_0xfa23('0x42')][_0xfa23('0x5e')]({'where':{'id':_0x23493b[_0xfa23('0x5a')]['id']}})[_0xfa23('0x11')](handleEntityNotFound(_0x2d9b01,null))['then'](function(_0x4e5e2b){if(_0x4e5e2b){return _0x4e5e2b[_0xfa23('0xb9')](_0x23493b['query']['ids'])[_0xfa23('0x11')](function(){if(_[_0xfa23('0xba')](_0x23493b[_0xfa23('0x47')][_0xfa23('0x6c')])){for(var _0x465a6e=0x0;_0x465a6e<_0x23493b[_0xfa23('0x47')]['ids'][_0xfa23('0x4d')];_0x465a6e+=0x1){socket[_0xfa23('0xbb')]('userMailAccount:remove',{'UserId':Number(_0x23493b[_0xfa23('0x47')][_0xfa23('0x6c')][_0x465a6e]),'MailAccountId':Number(_0x23493b[_0xfa23('0x5a')]['id'])});}}else{socket['emit'](_0xfa23('0xbc'),{'UserId':Number(_0x23493b['query']['ids']),'MailAccountId':Number(_0x23493b['params']['id'])});}});}})[_0xfa23('0x11')](respondWithStatusCode(_0x2d9b01,null))['catch'](handleError(_0x2d9b01,null));};exports[_0xfa23('0xbd')]=function(_0x30dc8a,_0x18a474){var _0x2f01d0={};var _0xe1b185={};var _0x2a9c44;var _0x48bf04;return db[_0xfa23('0x42')][_0xfa23('0x67')]({'where':{'id':_0x30dc8a[_0xfa23('0x5a')]['id']}})[_0xfa23('0x11')](handleEntityNotFound(_0x18a474,null))[_0xfa23('0x11')](function(_0x472e9f){if(_0x472e9f){_0x2a9c44=_0x472e9f;_0xe1b185[_0xfa23('0x46')]=_[_0xfa23('0x48')](db[_0xfa23('0x87')][_0xfa23('0x5c')]);_0xe1b185[_0xfa23('0x47')]=_[_0xfa23('0x48')](_0x30dc8a[_0xfa23('0x47')]);_0xe1b185[_0xfa23('0x49')]=_[_0xfa23('0x4a')](_0xe1b185[_0xfa23('0x46')],_0xe1b185[_0xfa23('0x47')]);_0x2f01d0[_0xfa23('0x4b')]=_[_0xfa23('0x4a')](_0xe1b185[_0xfa23('0x46')],qs[_0xfa23('0x4c')](_0x30dc8a[_0xfa23('0x47')][_0xfa23('0x4c')]));_0x2f01d0[_0xfa23('0x4b')]=_0x2f01d0[_0xfa23('0x4b')][_0xfa23('0x4d')]?_0x2f01d0[_0xfa23('0x4b')]:_0xe1b185[_0xfa23('0x46')];_0x2f01d0['order']=qs[_0xfa23('0x50')](_0x30dc8a['query'][_0xfa23('0x50')]);_0x2f01d0[_0xfa23('0x51')]=qs[_0xfa23('0x49')](_[_0xfa23('0x52')](_0x30dc8a[_0xfa23('0x47')],_0xe1b185[_0xfa23('0x49')]));if(_0x30dc8a['query'][_0xfa23('0x54')]){_0x2f01d0[_0xfa23('0x51')]=_[_0xfa23('0x53')](_0x2f01d0[_0xfa23('0x51')],{'$or':_[_0xfa23('0x41')](_0x2f01d0[_0xfa23('0x4b')],function(_0x43d9b6){var _0x7e9295={};_0x7e9295[_0x43d9b6]={'$like':'%'+_0x30dc8a[_0xfa23('0x47')][_0xfa23('0x54')]+'%'};return _0x7e9295;})});}_0x2f01d0=_[_0xfa23('0x53')]({},_0x2f01d0,_0x30dc8a[_0xfa23('0x55')]);return _0x2a9c44['getAgents'](_0x2f01d0);}})[_0xfa23('0x11')](function(_0x1577bd){if(_0x1577bd){_0x48bf04=_0x1577bd['length'];if(!_0x30dc8a['query'][_0xfa23('0x69')](_0xfa23('0x4e'))){_0x2f01d0[_0xfa23('0x1e')]=qs['limit'](_0x30dc8a[_0xfa23('0x47')][_0xfa23('0x1e')]);_0x2f01d0['offset']=qs[_0xfa23('0x1d')](_0x30dc8a[_0xfa23('0x47')][_0xfa23('0x1d')]);}return _0x2a9c44[_0xfa23('0xbd')](_0x2f01d0);}})['then'](function(_0x3afa14){if(_0x3afa14){return _0x3afa14?{'count':_0x48bf04,'rows':_0x3afa14}:null;}})['then'](respondWithResult(_0x18a474,null))[_0xfa23('0x18')](handleError(_0x18a474,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 9a538d2..2ee94ce 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 _0x99a0=['hook','events','../../mysqldb','remove','emit','hasOwnProperty'];(function(_0x9c05a6,_0x1b3e3a){var _0xe4c2fd=function(_0x16c302){while(--_0x16c302){_0x9c05a6['push'](_0x9c05a6['shift']());}};_0xe4c2fd(++_0x1b3e3a);}(_0x99a0,0x121));var _0x099a=function(_0x159725,_0xc6fb82){_0x159725=_0x159725-0x0;var _0x3b0b33=_0x99a0[_0x159725];return _0x3b0b33;};'use strict';var EventEmitter=require(_0x099a('0x0'));var MailAccount=require(_0x099a('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x099a('0x2')};function emitEvent(_0x2b5e88){return function(_0x5d6b40,_0x21d681,_0x1d3f16){MailAccountEvents[_0x099a('0x3')](_0x2b5e88+':'+_0x5d6b40['id'],_0x5d6b40);MailAccountEvents[_0x099a('0x3')](_0x2b5e88,_0x5d6b40);_0x1d3f16(null);};}for(var e in events){if(events[_0x099a('0x4')](e)){var event=events[e];MailAccount[_0x099a('0x5')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xf2a0=['save','remove','emit','hasOwnProperty','hook','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xf2a0,0x7d));var _0x0f2a=function(_0x1b0307,_0x4336b1){_0x1b0307=_0x1b0307-0x0;var _0x5c8d34=_0xf2a0[_0x1b0307];return _0x5c8d34;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x0f2a('0x0'))['db'][_0x0f2a('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x0f2a('0x2')](0x0);var events={'afterCreate':_0x0f2a('0x3'),'afterUpdate':'update','afterDestroy':_0x0f2a('0x4')};function emitEvent(_0x53675){return function(_0x17fdb8,_0x56095c,_0x452b83){MailAccountEvents[_0x0f2a('0x5')](_0x53675+':'+_0x17fdb8['id'],_0x17fdb8);MailAccountEvents['emit'](_0x53675,_0x17fdb8);_0x452b83(null);};}for(var e in events){if(events[_0x0f2a('0x6')](e)){var event=events[e];MailAccount[_0x0f2a('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index f4c53b2..793e08e 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 _0x65b5=['Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','data5','./mailAccount.attributes','exports','MailAccount','mail_accounts','provider','service','host','Smtp','port','secure','CloudProvider'];(function(_0x4528f1,_0x12977c){var _0x30602a=function(_0x4f1a59){while(--_0x4f1a59){_0x4528f1['push'](_0x4528f1['shift']());}};_0x30602a(++_0x12977c);}(_0x65b5,0x199));var _0x565b=function(_0x5d4db3,_0x5e0e9f){_0x5d4db3=_0x5d4db3-0x0;var _0x2c42a7=_0x65b5[_0x5d4db3];return _0x2c42a7;};'use strict';var attributes=require(_0x565b('0x0'));module[_0x565b('0x1')]=function(_0x24e5d5){return _0x24e5d5['define'](_0x565b('0x2'),attributes,{'tableName':_0x565b('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x4a7b18=this;var _0x3f5d0e={'id':_0x4a7b18['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4a7b18[_0x565b('0x4')]!=='custom'){_0x3f5d0e[_0x565b('0x5')]=_0x4a7b18['provider'];}else{_0x3f5d0e[_0x565b('0x6')]=_0x4a7b18[_0x565b('0x7')]['host'];_0x3f5d0e[_0x565b('0x8')]=_0x4a7b18[_0x565b('0x7')]['port'];_0x3f5d0e[_0x565b('0x9')]=_0x4a7b18[_0x565b('0x7')][_0x565b('0x9')];}if(_0x4a7b18[_0x565b('0x7')]['authentication']){if(_0x4a7b18[_0x565b('0x7')]['modernAuthentication']){if(!_0x4a7b18[_0x565b('0x7')][_0x565b('0xa')])throw new Error(_0x565b('0xb'));_0x3f5d0e['auth']={'type':_0x565b('0xc'),'user':_0x4a7b18[_0x565b('0x7')][_0x565b('0xd')],'accessToken':_0x4a7b18[_0x565b('0x7')][_0x565b('0xa')][_0x565b('0xe')]};}else{_0x3f5d0e['auth']={'user':_0x4a7b18[_0x565b('0x7')][_0x565b('0xd')],'pass':_0x4a7b18['Smtp']['pass']};}}return _0x3f5d0e;}}});}; \ No newline at end of file +var _0xfedf=['auth','pass','./mailAccount.attributes','MailAccount','mail_accounts','provider','custom','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','OAuth2','user','data5'];(function(_0x378710,_0x20c004){var _0x3b993b=function(_0x186b89){while(--_0x186b89){_0x378710['push'](_0x378710['shift']());}};_0x3b993b(++_0x20c004);}(_0xfedf,0xda));var _0xffed=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xfedf[_0x243b59];return _0x3e1676;};'use strict';var attributes=require(_0xffed('0x0'));module['exports']=function(_0x43c2ba){return _0x43c2ba['define'](_0xffed('0x1'),attributes,{'tableName':_0xffed('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x5a06c=this;var _0x42981d={'id':_0x5a06c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5a06c[_0xffed('0x3')]!==_0xffed('0x4')){_0x42981d[_0xffed('0x5')]=_0x5a06c[_0xffed('0x3')];}else{_0x42981d[_0xffed('0x6')]=_0x5a06c[_0xffed('0x7')][_0xffed('0x6')];_0x42981d[_0xffed('0x8')]=_0x5a06c['Smtp']['port'];_0x42981d[_0xffed('0x9')]=_0x5a06c[_0xffed('0x7')][_0xffed('0x9')];}if(_0x5a06c[_0xffed('0x7')][_0xffed('0xa')]){if(_0x5a06c[_0xffed('0x7')][_0xffed('0xb')]){if(!_0x5a06c[_0xffed('0x7')][_0xffed('0xc')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x42981d['auth']={'type':_0xffed('0xd'),'user':_0x5a06c[_0xffed('0x7')][_0xffed('0xe')],'accessToken':_0x5a06c[_0xffed('0x7')]['CloudProvider'][_0xffed('0xf')]};}else{_0x42981d[_0xffed('0x10')]={'user':_0x5a06c[_0xffed('0x7')]['user'],'pass':_0x5a06c[_0xffed('0x7')][_0xffed('0x11')]};}}return _0x42981d;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 60f5180..d6c998a 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 _0x029b=['lodash','moment','randomstring','ioredis','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetMailAccount','MailAccount','findAll','options','attributes','limit','include','map','model','then','stringify','find','where','setDataValue','smtpOptions','getSmtpOptions','ShowMailAccount','body','mail','difference','CmContact','rawAttributes','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','list','applications','orderBy','priority','autoclose','close','*,*,*,*','length','create','List\x20not\x20found','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','interaction','get','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','User','name','unshift','agent','MailQueue','queue','Start','startRouting'];(function(_0x4f7e6e,_0x3b4818){var _0x1b0846=function(_0xf9a64b){while(--_0xf9a64b){_0x4f7e6e['push'](_0x4f7e6e['shift']());}};_0x1b0846(++_0x3b4818);}(_0x029b,0x66));var _0xb029=function(_0x379a11,_0x540853){_0x379a11=_0x379a11-0x0;var _0x33171e=_0x029b[_0x379a11];return _0x33171e;};'use strict';var _=require(_0xb029('0x0'));var moment=require(_0xb029('0x1'));var BPromise=require('bluebird');var rs=require(_0xb029('0x2'));var Redis=require(_0xb029('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xb029('0x4'))(_0xb029('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb029('0x6')][_0xb029('0x7')]({'port':0x232c});config[_0xb029('0x8')]=_[_0xb029('0x9')](config[_0xb029('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xb029('0xa'))(new Redis(config['redis']));require(_0xb029('0xb'))['register'](socket);function respondWithRpcPromise(_0x2c3772,_0x5a8bb7,_0x23fee0){return new BPromise(function(_0x4b3036,_0x2696e3){return client[_0xb029('0xc')](_0x2c3772,_0x23fee0)['then'](function(_0x266df5){logger[_0xb029('0xd')](_0xb029('0xe'),_0x5a8bb7,_0xb029('0xf'));logger[_0xb029('0x10')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x5a8bb7,_0xb029('0xf'),JSON['stringify'](_0x266df5));if(_0x266df5[_0xb029('0x11')]){if(_0x266df5[_0xb029('0x11')][_0xb029('0x12')]===0x1f4){logger[_0xb029('0x11')]('MailAccount,\x20%s,\x20%s',_0x5a8bb7,_0x266df5[_0xb029('0x11')][_0xb029('0x13')]);return _0x2696e3(_0x266df5[_0xb029('0x11')]['message']);}logger[_0xb029('0x11')](_0xb029('0xe'),_0x5a8bb7,_0x266df5[_0xb029('0x11')][_0xb029('0x13')]);return _0x4b3036(_0x266df5[_0xb029('0x11')][_0xb029('0x13')]);}else{logger[_0xb029('0xd')](_0xb029('0xe'),_0x5a8bb7,_0xb029('0xf'));_0x4b3036(_0x266df5['result']['message']);}})[_0xb029('0x14')](function(_0x5373cd){logger[_0xb029('0x11')](_0xb029('0xe'),_0x5a8bb7,_0x5373cd);_0x2696e3(_0x5373cd);});});}exports[_0xb029('0x15')]=function(_0x497ca0){var _0x5e1741=this;return new Promise(function(_0x13ff77,_0x8d3e35){return db[_0xb029('0x16')][_0xb029('0x17')]({'raw':_0x497ca0[_0xb029('0x18')]?_0x497ca0[_0xb029('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x497ca0['options']?_0x497ca0['options']['where']||null:null,'attributes':_0x497ca0[_0xb029('0x18')]?_0x497ca0[_0xb029('0x18')][_0xb029('0x19')]||null:null,'limit':_0x497ca0[_0xb029('0x18')]?_0x497ca0['options'][_0xb029('0x1a')]||null:null,'include':_0x497ca0[_0xb029('0x18')]?_0x497ca0[_0xb029('0x18')][_0xb029('0x1b')]?_[_0xb029('0x1c')](_0x497ca0[_0xb029('0x18')][_0xb029('0x1b')],function(_0x3eb5ac){return{'model':db[_0x3eb5ac[_0xb029('0x1d')]],'as':_0x3eb5ac['as'],'attributes':_0x3eb5ac[_0xb029('0x19')],'include':_0x3eb5ac[_0xb029('0x1b')]?_[_0xb029('0x1c')](_0x3eb5ac[_0xb029('0x1b')],function(_0x599a14){return{'model':db[_0x599a14[_0xb029('0x1d')]],'as':_0x599a14['as'],'attributes':_0x599a14[_0xb029('0x19')],'include':_0x599a14['include']?_['map'](_0x599a14[_0xb029('0x1b')],function(_0x3b030a){return{'model':db[_0x3b030a[_0xb029('0x1d')]],'as':_0x3b030a['as'],'attributes':_0x3b030a[_0xb029('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb029('0x1e')](function(_0x4af2ad){logger[_0xb029('0xd')]('GetMailAccount',_0x497ca0);logger[_0xb029('0x10')](_0xb029('0x15'),_0x497ca0,JSON[_0xb029('0x1f')](_0x4af2ad));_0x13ff77(_0x4af2ad);})['catch'](function(_0x1aa94b){logger[_0xb029('0x11')]('GetMailAccount',_0x1aa94b[_0xb029('0x13')],_0x497ca0);_0x8d3e35(_0x5e1741['error'](0x1f4,_0x1aa94b[_0xb029('0x13')]));});});};exports['ShowMailAccount']=function(_0x88a69b){var _0x3b0bfe=this;return new Promise(function(_0x392d0f,_0x2324f3){return db[_0xb029('0x16')][_0xb029('0x20')]({'raw':_0x88a69b[_0xb029('0x18')]?_0x88a69b[_0xb029('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x88a69b[_0xb029('0x18')]?_0x88a69b[_0xb029('0x18')][_0xb029('0x21')]||null:null,'attributes':_0x88a69b['options']?_0x88a69b[_0xb029('0x18')][_0xb029('0x19')]||null:null,'include':_0x88a69b['options']?_0x88a69b[_0xb029('0x18')]['include']?_[_0xb029('0x1c')](_0x88a69b['options'][_0xb029('0x1b')],function(_0x42f980){return{'model':db[_0x42f980[_0xb029('0x1d')]],'as':_0x42f980['as'],'attributes':_0x42f980[_0xb029('0x19')],'include':_0x42f980[_0xb029('0x1b')]?_[_0xb029('0x1c')](_0x42f980[_0xb029('0x1b')],function(_0x5a1d11){return{'model':db[_0x5a1d11[_0xb029('0x1d')]],'as':_0x5a1d11['as'],'attributes':_0x5a1d11[_0xb029('0x19')],'include':_0x5a1d11['include']?_[_0xb029('0x1c')](_0x5a1d11[_0xb029('0x1b')],function(_0x35105c){return{'model':db[_0x35105c[_0xb029('0x1d')]],'as':_0x35105c['as'],'attributes':_0x35105c['attributes']};}):[]};}):[]};}):[]:[]})[_0xb029('0x1e')](function(_0x3a2547){if(_0x88a69b[_0xb029('0x18')]['smtp']===!![])_0x3a2547[_0xb029('0x22')](_0xb029('0x23'),_0x3a2547[_0xb029('0x24')]());logger[_0xb029('0xd')](_0xb029('0x25'),_0x88a69b);logger[_0xb029('0x10')](_0xb029('0x25'),_0x88a69b,JSON[_0xb029('0x1f')](_0x3a2547));_0x392d0f(_0x3a2547);})[_0xb029('0x14')](function(_0x1392af){logger['error'](_0xb029('0x25'),_0x1392af[_0xb029('0x13')],_0x88a69b);_0x2324f3(_0x3b0bfe[_0xb029('0x11')](0x1f4,_0x1392af['message']));});});};exports['NotifyMailAccount']=function(_0x521b20){var _0x31477a=this;return new Promise(function(_0x41a857,_0x5c7082){var _0x1a7285={'body':_0x521b20[_0xb029('0x26')],'channel':_0xb029('0x27')};var _0x3bc456=_[_0xb029('0x28')](_['keys'](db[_0xb029('0x29')][_0xb029('0x2a')]),['createdAt',_0xb029('0x2b'),_0xb029('0x2c'),_0xb029('0x2d')]);var _0x56a470=![];if(_0x521b20[_0xb029('0x26')]['id']){delete _0x521b20[_0xb029('0x26')]['id'];}if(_['isNil'](_0x521b20['body'][_0xb029('0x2e')])){return _0x5c7082(_0x31477a[_0xb029('0x11')](0x1f4,_0xb029('0x2f')));}if(_[_0xb029('0x30')](_0x521b20['body']['body'])||_0x521b20[_0xb029('0x26')]['body']===''){return _0x5c7082(_0x31477a[_0xb029('0x11')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xb029('0x30')](_0x521b20[_0xb029('0x26')][_0xb029('0x31')])){return _0x5c7082(_0x31477a[_0xb029('0x11')](0x1f4,_0xb029('0x32')+_0x3bc456));}if(!_[_0xb029('0x33')](_0x3bc456,_0x521b20['body'][_0xb029('0x31')])){return _0x5c7082(_0x31477a['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3bc456));}var _0x2dde2e={};_0x2dde2e[_0x521b20['body'][_0xb029('0x31')]]=_0x521b20['body'][_0xb029('0x2e')];return db[_0xb029('0x16')][_0xb029('0x20')]({'where':{'id':_0x521b20[_0xb029('0x34')]['id']},'include':[{'model':db['CmList'],'as':_0xb029('0x35'),'include':[{'model':db[_0xb029('0x29')],'as':_0xb029('0x36'),'where':_0x2dde2e,'limit':0x1,'order':[[_0xb029('0x2b'),_0xb029('0x37')]]}]},{'model':db[_0xb029('0x38')],'as':_0xb029('0x39')},{'model':db[_0xb029('0x3a')],'as':_0xb029('0x3b'),'include':[{'model':db[_0xb029('0x3c')],'as':'CloudProvider'}]}]})[_0xb029('0x1e')](function(_0x2345cd){if(_0x2345cd&&_0x2345cd[_0xb029('0x35')]){var _0x3172a2=_0x2345cd['get']({'plain':!![]});_0x1a7285[_0xb029('0x34')]=_['omit'](_0x3172a2,[_0xb029('0x39'),_0xb029('0x35')]);_0x1a7285[_0xb029('0x34')][_0xb029('0x23')]=_0x2345cd[_0xb029('0x24')]();_0x1a7285['applications']=_0x3172a2['Applications'];_0x1a7285[_0xb029('0x3d')]=_0x3172a2[_0xb029('0x35')];_0x1a7285[_0xb029('0x3e')]=_[_0xb029('0x3f')](_0x1a7285[_0xb029('0x3e')],[_0xb029('0x40')],['asc']);if(_0x1a7285[_0xb029('0x34')]&&_0x1a7285[_0xb029('0x34')][_0xb029('0x41')]){_0x1a7285['applications']['push']({'id':0x0,'priority':_0x1a7285[_0xb029('0x3e')]['length']+0x1,'app':_0xb029('0x42'),'appdata':_0xb029('0x41'),'interval':_0xb029('0x43')});}if(_0x1a7285['account'][_0xb029('0x39')]){delete _0x1a7285[_0xb029('0x34')]['Applications'];}if(_0x1a7285[_0xb029('0x34')][_0xb029('0x35')]){delete _0x1a7285[_0xb029('0x34')]['List'];}if(_0x3172a2[_0xb029('0x35')][_0xb029('0x36')][_0xb029('0x44')]){return _0x3172a2[_0xb029('0x35')]['Contacts'][0x0];}var _0x3cbbfe=_[_0xb029('0x9')](_0x521b20[_0xb029('0x26')],{'firstName':_0x521b20['body'][_0xb029('0x2e')],'ListId':_0x3172a2['ListId']});_0x3cbbfe[_0x521b20[_0xb029('0x26')][_0xb029('0x31')]]=_0x521b20[_0xb029('0x26')][_0xb029('0x2e')];return db[_0xb029('0x29')][_0xb029('0x45')](_0x3cbbfe);}else{throw new Error(_0xb029('0x46'));}})['then'](function(_0x4f41ad){_0x1a7285['contact']=_0x4f41ad;if(_0x4f41ad){if(!_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x47')]){_0x521b20[_0xb029('0x26')][_0xb029('0x13')]['messageId']=rs[_0xb029('0x48')]()+'\x20'+_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x2e')];}var _0x5b7c6d={'ContactId':_0x4f41ad['id'],'MailAccountId':_0x521b20[_0xb029('0x34')]['id'],'inReplyTo':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x47')],'to':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x2e')],'cc':_0x521b20[_0xb029('0x26')]['message']['cc'],'subject':_0x521b20[_0xb029('0x26')][_0xb029('0x13')]['subject'],'attach':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x49')],'lastMsgAt':moment()[_0xb029('0x4a')](_0xb029('0x4b')),'lastMsgDirection':'in'};return db[_0xb029('0x4c')][_0xb029('0x20')]({'where':{'closed':![],'MailAccountId':_0x521b20[_0xb029('0x34')]['id']},'include':[{'model':db['MailMessage'],'as':_0xb029('0x4d'),'attributes':['messageId'],'where':{'messageId':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x4e')]}}]})['then'](function(_0xd82930){if(_0xd82930){return[_0xd82930,![]];}return db[_0xb029('0x4c')]['create'](_0x5b7c6d)['then'](function(_0x5792a1){return[_0x5792a1,!![]];});});}else{throw new Error(_0xb029('0x4f'));}})['spread'](function(_0x3d8ff6,_0x5419d5){if(_0x3d8ff6){_0x56a470=_0x5419d5;if(!_0x5419d5){return _0x3d8ff6['update']({'inReplyTo':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x47')],'to':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x2e')],'cc':_0x521b20[_0xb029('0x26')]['message']['cc'],'subject':_0x521b20[_0xb029('0x26')][_0xb029('0x13')]['subject'],'attach':_0x3d8ff6[_0xb029('0x49')]?_0x3d8ff6[_0xb029('0x49')]:_0x521b20[_0xb029('0x26')]['message'][_0xb029('0x49')],'substatus':null,'substatusAt':moment()[_0xb029('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xb029('0x4a')](_0xb029('0x4b')),'lastMsgDirection':'in'});}else{return _0x3d8ff6;}}})['then'](function(_0x227bfd){_0x1a7285[_0xb029('0x50')]=_0x227bfd[_0xb029('0x51')]({'plain':!![]});_0x1a7285[_0xb029('0x50')][_0xb029('0x52')]=_0x56a470;return db['MailMessage'][_0xb029('0x45')]({'body':_0x521b20['body']['body'],'MailAccountId':_0x521b20[_0xb029('0x34')]['id'],'MailInteractionId':_0x227bfd['id'],'direction':'in','ContactId':_0x1a7285[_0xb029('0x53')]['id'],'messageId':_0x521b20[_0xb029('0x26')]['message'][_0xb029('0x47')],'from':_0x521b20[_0xb029('0x26')]['message']['from'],'to':_0x521b20[_0xb029('0x26')]['message']['to'],'cc':_0x521b20[_0xb029('0x26')]['message']['cc'],'subject':_0x521b20['body'][_0xb029('0x13')]['subject'],'attach':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x49')],'Attachments':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x54')],'originTo':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x55')],'originCc':_0x521b20['body'][_0xb029('0x13')][_0xb029('0x56')],'bcc':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x57')],'ChatWebsiteId':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x58')]||null,'originChannel':_0x521b20[_0xb029('0x26')]['message'][_0xb029('0x59')]||_0xb029('0x5a'),'ChatOfflineMessageId':_0x521b20[_0xb029('0x26')]['message'][_0xb029('0x5b')]||null},{'include':[{'model':db[_0xb029('0x5c')],'as':_0xb029('0x5d')}]});})[_0xb029('0x1e')](function(_0x133e8c){_0x1a7285[_0xb029('0x13')]=_0x133e8c;if(!_0x1a7285[_0xb029('0x50')]['UserId']){return;}return db[_0xb029('0x5e')]['find']({'attributes':['id',_0xb029('0x5f')],'where':{'id':_0x1a7285[_0xb029('0x50')]['UserId']}});})[_0xb029('0x1e')](function(_0x493c86){if(_0x493c86){_0x1a7285['applications'][_0xb029('0x60')]({'id':0x0,'priority':0x0,'app':_0xb029('0x61'),'appdata':_0x493c86[_0xb029('0x5f')]+','+(_0x1a7285[_0xb029('0x34')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x1a7285[_0xb029('0x50')]['queueId']){return;}return db[_0xb029('0x62')][_0xb029('0x20')]({'attributes':['id',_0xb029('0x5f')],'where':{'id':_0x1a7285[_0xb029('0x50')]['queueId']}});})[_0xb029('0x1e')](function(_0x5849c9){if(_0x5849c9){_0x1a7285['applications'][_0xb029('0x60')]({'id':0x0,'priority':0x1,'app':_0xb029('0x63'),'appdata':_0x5849c9[_0xb029('0x5f')]+','+(_0x1a7285[_0xb029('0x34')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb029('0x64'),_0xb029('0x65'),_0x1a7285);})[_0xb029('0x1e')](function(_0xc0111b){_0x41a857(_0xc0111b);})[_0xb029('0x14')](function(_0x4969af){_0x5c7082(_0x31477a[_0xb029('0x11')](0x1f4,_0x4969af[_0xb029('0x13')]));});});}; \ No newline at end of file +var _0x6f47=['./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','limit','include','model','map','find','where','then','smtp','smtpOptions','getSmtpOptions','ShowMailAccount','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','body','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','Contacts','DESC','Applications','MailServerOut','Smtp','CloudProvider','get','omit','applications','List','priority','asc','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','spread','attach','interaction','created','attachments','originCc','bcc','ChatWebsiteId','Email','Attachments','UserId','name','unshift','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0x6f47,0xc7));var _0x76f4=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x6f47[_0xbd08b4];return _0x314f1e;};'use strict';var _=require('lodash');var moment=require(_0x76f4('0x0'));var BPromise=require(_0x76f4('0x1'));var rs=require('randomstring');var Redis=require(_0x76f4('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x76f4('0x3'))('rpc');var config=require(_0x76f4('0x4'));var jayson=require(_0x76f4('0x5'));var client=jayson[_0x76f4('0x6')][_0x76f4('0x7')]({'port':0x232c});config['redis']=_[_0x76f4('0x8')](config[_0x76f4('0x9')],{'host':_0x76f4('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x76f4('0x9')]));require(_0x76f4('0xb'))[_0x76f4('0xc')](socket);function respondWithRpcPromise(_0xf9b468,_0x101f55,_0x4c6b5c){return new BPromise(function(_0x5367d6,_0x3347ef){return client[_0x76f4('0xd')](_0xf9b468,_0x4c6b5c)['then'](function(_0x51d500){logger[_0x76f4('0xe')](_0x76f4('0xf'),_0x101f55,_0x76f4('0x10'));logger[_0x76f4('0x11')](_0x76f4('0x12'),_0x101f55,_0x76f4('0x10'),JSON[_0x76f4('0x13')](_0x51d500));if(_0x51d500[_0x76f4('0x14')]){if(_0x51d500[_0x76f4('0x14')]['code']===0x1f4){logger[_0x76f4('0x14')](_0x76f4('0xf'),_0x101f55,_0x51d500['error']['message']);return _0x3347ef(_0x51d500['error'][_0x76f4('0x15')]);}logger[_0x76f4('0x14')](_0x76f4('0xf'),_0x101f55,_0x51d500[_0x76f4('0x14')][_0x76f4('0x15')]);return _0x5367d6(_0x51d500[_0x76f4('0x14')][_0x76f4('0x15')]);}else{logger[_0x76f4('0xe')](_0x76f4('0xf'),_0x101f55,_0x76f4('0x10'));_0x5367d6(_0x51d500[_0x76f4('0x16')][_0x76f4('0x15')]);}})[_0x76f4('0x17')](function(_0x38450e){logger[_0x76f4('0x14')](_0x76f4('0xf'),_0x101f55,_0x38450e);_0x3347ef(_0x38450e);});});}exports[_0x76f4('0x18')]=function(_0x3e809f){var _0x435534=this;return new Promise(function(_0x35b406,_0x46f057){return db[_0x76f4('0x19')]['findAll']({'raw':_0x3e809f[_0x76f4('0x1a')]?_0x3e809f['options'][_0x76f4('0x1b')]===undefined?!![]:![]:!![],'where':_0x3e809f[_0x76f4('0x1a')]?_0x3e809f[_0x76f4('0x1a')]['where']||null:null,'attributes':_0x3e809f['options']?_0x3e809f['options'][_0x76f4('0x1c')]||null:null,'limit':_0x3e809f[_0x76f4('0x1a')]?_0x3e809f[_0x76f4('0x1a')][_0x76f4('0x1d')]||null:null,'include':_0x3e809f[_0x76f4('0x1a')]?_0x3e809f[_0x76f4('0x1a')][_0x76f4('0x1e')]?_['map'](_0x3e809f['options'][_0x76f4('0x1e')],function(_0x497913){return{'model':db[_0x497913[_0x76f4('0x1f')]],'as':_0x497913['as'],'attributes':_0x497913['attributes'],'include':_0x497913['include']?_['map'](_0x497913[_0x76f4('0x1e')],function(_0x38300d){return{'model':db[_0x38300d[_0x76f4('0x1f')]],'as':_0x38300d['as'],'attributes':_0x38300d[_0x76f4('0x1c')],'include':_0x38300d[_0x76f4('0x1e')]?_[_0x76f4('0x20')](_0x38300d['include'],function(_0x306cb4){return{'model':db[_0x306cb4['model']],'as':_0x306cb4['as'],'attributes':_0x306cb4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x10ddb4){logger[_0x76f4('0xe')](_0x76f4('0x18'),_0x3e809f);logger[_0x76f4('0x11')]('GetMailAccount',_0x3e809f,JSON[_0x76f4('0x13')](_0x10ddb4));_0x35b406(_0x10ddb4);})['catch'](function(_0x259c26){logger[_0x76f4('0x14')](_0x76f4('0x18'),_0x259c26[_0x76f4('0x15')],_0x3e809f);_0x46f057(_0x435534[_0x76f4('0x14')](0x1f4,_0x259c26['message']));});});};exports['ShowMailAccount']=function(_0x55cc6d){var _0x31364a=this;return new Promise(function(_0x36c360,_0x281db6){return db[_0x76f4('0x19')][_0x76f4('0x21')]({'raw':_0x55cc6d[_0x76f4('0x1a')]?_0x55cc6d[_0x76f4('0x1a')][_0x76f4('0x1b')]===undefined?!![]:![]:!![],'where':_0x55cc6d[_0x76f4('0x1a')]?_0x55cc6d[_0x76f4('0x1a')][_0x76f4('0x22')]||null:null,'attributes':_0x55cc6d['options']?_0x55cc6d['options']['attributes']||null:null,'include':_0x55cc6d['options']?_0x55cc6d[_0x76f4('0x1a')][_0x76f4('0x1e')]?_[_0x76f4('0x20')](_0x55cc6d[_0x76f4('0x1a')][_0x76f4('0x1e')],function(_0x51aa36){return{'model':db[_0x51aa36[_0x76f4('0x1f')]],'as':_0x51aa36['as'],'attributes':_0x51aa36[_0x76f4('0x1c')],'include':_0x51aa36[_0x76f4('0x1e')]?_[_0x76f4('0x20')](_0x51aa36[_0x76f4('0x1e')],function(_0x23278f){return{'model':db[_0x23278f[_0x76f4('0x1f')]],'as':_0x23278f['as'],'attributes':_0x23278f[_0x76f4('0x1c')],'include':_0x23278f[_0x76f4('0x1e')]?_[_0x76f4('0x20')](_0x23278f[_0x76f4('0x1e')],function(_0x244607){return{'model':db[_0x244607[_0x76f4('0x1f')]],'as':_0x244607['as'],'attributes':_0x244607[_0x76f4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x76f4('0x23')](function(_0x88506b){if(_0x55cc6d[_0x76f4('0x1a')][_0x76f4('0x24')]===!![])_0x88506b['setDataValue'](_0x76f4('0x25'),_0x88506b[_0x76f4('0x26')]());logger[_0x76f4('0xe')]('ShowMailAccount',_0x55cc6d);logger['debug'](_0x76f4('0x27'),_0x55cc6d,JSON['stringify'](_0x88506b));_0x36c360(_0x88506b);})[_0x76f4('0x17')](function(_0x5ac18f){logger[_0x76f4('0x14')](_0x76f4('0x27'),_0x5ac18f[_0x76f4('0x15')],_0x55cc6d);_0x281db6(_0x31364a[_0x76f4('0x14')](0x1f4,_0x5ac18f[_0x76f4('0x15')]));});});};exports[_0x76f4('0x28')]=function(_0x21ae82){var _0x109ad9=this;return new Promise(function(_0x16779e,_0x80e29f){var _0x5340a9={'body':_0x21ae82['body'],'channel':_0x76f4('0x29')};var _0x13a5a7=_[_0x76f4('0x2a')](_[_0x76f4('0x2b')](db[_0x76f4('0x2c')][_0x76f4('0x2d')]),[_0x76f4('0x2e'),_0x76f4('0x2f'),_0x76f4('0x30'),'ListId']);var _0xbc3d7e=![];if(_0x21ae82[_0x76f4('0x31')]['id']){delete _0x21ae82['body']['id'];}if(_['isNil'](_0x21ae82[_0x76f4('0x31')][_0x76f4('0x32')])){return _0x80e29f(_0x109ad9[_0x76f4('0x14')](0x1f4,_0x76f4('0x33')));}if(_[_0x76f4('0x34')](_0x21ae82['body'][_0x76f4('0x31')])||_0x21ae82[_0x76f4('0x31')][_0x76f4('0x31')]===''){return _0x80e29f(_0x109ad9[_0x76f4('0x14')](0x1f4,_0x76f4('0x35')));}if(_[_0x76f4('0x34')](_0x21ae82['body'][_0x76f4('0x36')])){return _0x80e29f(_0x109ad9[_0x76f4('0x14')](0x1f4,_0x76f4('0x37')+_0x13a5a7));}if(!_['includes'](_0x13a5a7,_0x21ae82['body'][_0x76f4('0x36')])){return _0x80e29f(_0x109ad9[_0x76f4('0x14')](0x1f4,_0x76f4('0x38')+_0x13a5a7));}var _0x2bea6d={};_0x2bea6d[_0x21ae82[_0x76f4('0x31')]['mapKey']]=_0x21ae82['body'][_0x76f4('0x32')];return db['MailAccount'][_0x76f4('0x21')]({'where':{'id':_0x21ae82[_0x76f4('0x39')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x76f4('0x2c')],'as':_0x76f4('0x3a'),'where':_0x2bea6d,'limit':0x1,'order':[[_0x76f4('0x2f'),_0x76f4('0x3b')]]}]},{'model':db['MailApplication'],'as':_0x76f4('0x3c')},{'model':db[_0x76f4('0x3d')],'as':_0x76f4('0x3e'),'include':[{'model':db['CloudProvider'],'as':_0x76f4('0x3f')}]}]})[_0x76f4('0x23')](function(_0x535eca){if(_0x535eca&&_0x535eca['List']){var _0x4ab620=_0x535eca[_0x76f4('0x40')]({'plain':!![]});_0x5340a9[_0x76f4('0x39')]=_[_0x76f4('0x41')](_0x4ab620,[_0x76f4('0x3c'),'List']);_0x5340a9[_0x76f4('0x39')]['smtpOptions']=_0x535eca[_0x76f4('0x26')]();_0x5340a9[_0x76f4('0x42')]=_0x4ab620[_0x76f4('0x3c')];_0x5340a9['list']=_0x4ab620[_0x76f4('0x43')];_0x5340a9[_0x76f4('0x42')]=_['orderBy'](_0x5340a9[_0x76f4('0x42')],[_0x76f4('0x44')],[_0x76f4('0x45')]);if(_0x5340a9[_0x76f4('0x39')]&&_0x5340a9[_0x76f4('0x39')]['autoclose']){_0x5340a9[_0x76f4('0x42')]['push']({'id':0x0,'priority':_0x5340a9[_0x76f4('0x42')][_0x76f4('0x46')]+0x1,'app':_0x76f4('0x47'),'appdata':'autoclose','interval':_0x76f4('0x48')});}if(_0x5340a9[_0x76f4('0x39')][_0x76f4('0x3c')]){delete _0x5340a9[_0x76f4('0x39')]['Applications'];}if(_0x5340a9[_0x76f4('0x39')][_0x76f4('0x43')]){delete _0x5340a9[_0x76f4('0x39')][_0x76f4('0x43')];}if(_0x4ab620['List'][_0x76f4('0x3a')]['length']){return _0x4ab620[_0x76f4('0x43')][_0x76f4('0x3a')][0x0];}var _0x5ca332=_['defaults'](_0x21ae82[_0x76f4('0x31')],{'firstName':_0x21ae82[_0x76f4('0x31')][_0x76f4('0x32')],'ListId':_0x4ab620['ListId']});_0x5ca332[_0x21ae82[_0x76f4('0x31')][_0x76f4('0x36')]]=_0x21ae82[_0x76f4('0x31')]['from'];return db['CmContact'][_0x76f4('0x49')](_0x5ca332);}else{throw new Error(_0x76f4('0x4a'));}})['then'](function(_0x490ced){_0x5340a9[_0x76f4('0x4b')]=_0x490ced;if(_0x490ced){if(!_0x21ae82[_0x76f4('0x31')][_0x76f4('0x15')][_0x76f4('0x4c')]){_0x21ae82[_0x76f4('0x31')][_0x76f4('0x15')][_0x76f4('0x4c')]=rs[_0x76f4('0x4d')]()+'\x20'+_0x21ae82[_0x76f4('0x31')]['message']['from'];}var _0x5cc5c1={'ContactId':_0x490ced['id'],'MailAccountId':_0x21ae82[_0x76f4('0x39')]['id'],'inReplyTo':_0x21ae82[_0x76f4('0x31')][_0x76f4('0x15')][_0x76f4('0x4c')],'to':_0x21ae82['body']['message'][_0x76f4('0x32')],'cc':_0x21ae82['body'][_0x76f4('0x15')]['cc'],'subject':_0x21ae82['body'][_0x76f4('0x15')][_0x76f4('0x4e')],'attach':_0x21ae82[_0x76f4('0x31')][_0x76f4('0x15')]['attach'],'lastMsgAt':moment()[_0x76f4('0x4f')](_0x76f4('0x50')),'lastMsgDirection':'in'};return db[_0x76f4('0x51')][_0x76f4('0x21')]({'where':{'closed':![],'MailAccountId':_0x21ae82[_0x76f4('0x39')]['id']},'include':[{'model':db[_0x76f4('0x52')],'as':_0x76f4('0x53'),'attributes':['messageId'],'where':{'messageId':_0x21ae82[_0x76f4('0x31')][_0x76f4('0x15')][_0x76f4('0x54')]}}]})[_0x76f4('0x23')](function(_0x28cf4c){if(_0x28cf4c){return[_0x28cf4c,![]];}return db[_0x76f4('0x51')][_0x76f4('0x49')](_0x5cc5c1)[_0x76f4('0x23')](function(_0x5724c3){return[_0x5724c3,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x76f4('0x55')](function(_0x617924,_0x3b10dd){if(_0x617924){_0xbc3d7e=_0x3b10dd;if(!_0x3b10dd){return _0x617924['update']({'inReplyTo':_0x21ae82[_0x76f4('0x31')]['message'][_0x76f4('0x4c')],'to':_0x21ae82[_0x76f4('0x31')]['message'][_0x76f4('0x32')],'cc':_0x21ae82[_0x76f4('0x31')][_0x76f4('0x15')]['cc'],'subject':_0x21ae82[_0x76f4('0x31')][_0x76f4('0x15')][_0x76f4('0x4e')],'attach':_0x617924[_0x76f4('0x56')]?_0x617924[_0x76f4('0x56')]:_0x21ae82[_0x76f4('0x31')]['message'][_0x76f4('0x56')],'substatus':null,'substatusAt':moment()['format'](_0x76f4('0x50')),'lastMsgAt':moment()[_0x76f4('0x4f')](_0x76f4('0x50')),'lastMsgDirection':'in'});}else{return _0x617924;}}})[_0x76f4('0x23')](function(_0xfbb52c){_0x5340a9[_0x76f4('0x57')]=_0xfbb52c[_0x76f4('0x40')]({'plain':!![]});_0x5340a9[_0x76f4('0x57')][_0x76f4('0x58')]=_0xbc3d7e;return db[_0x76f4('0x52')]['create']({'body':_0x21ae82[_0x76f4('0x31')][_0x76f4('0x31')],'MailAccountId':_0x21ae82['account']['id'],'MailInteractionId':_0xfbb52c['id'],'direction':'in','ContactId':_0x5340a9[_0x76f4('0x4b')]['id'],'messageId':_0x21ae82[_0x76f4('0x31')][_0x76f4('0x15')]['messageId'],'from':_0x21ae82[_0x76f4('0x31')][_0x76f4('0x15')][_0x76f4('0x32')],'to':_0x21ae82['body'][_0x76f4('0x15')]['to'],'cc':_0x21ae82[_0x76f4('0x31')][_0x76f4('0x15')]['cc'],'subject':_0x21ae82[_0x76f4('0x31')][_0x76f4('0x15')][_0x76f4('0x4e')],'attach':_0x21ae82[_0x76f4('0x31')][_0x76f4('0x15')][_0x76f4('0x56')],'Attachments':_0x21ae82['body'][_0x76f4('0x15')][_0x76f4('0x59')],'originTo':_0x21ae82[_0x76f4('0x31')][_0x76f4('0x15')]['originTo'],'originCc':_0x21ae82[_0x76f4('0x31')][_0x76f4('0x15')][_0x76f4('0x5a')],'bcc':_0x21ae82['body'][_0x76f4('0x15')][_0x76f4('0x5b')],'ChatWebsiteId':_0x21ae82[_0x76f4('0x31')][_0x76f4('0x15')][_0x76f4('0x5c')]||null,'originChannel':_0x21ae82['body'][_0x76f4('0x15')]['originChannel']||_0x76f4('0x5d'),'ChatOfflineMessageId':_0x21ae82[_0x76f4('0x31')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':_0x76f4('0x5e')}]});})[_0x76f4('0x23')](function(_0x1e7b6){_0x5340a9[_0x76f4('0x15')]=_0x1e7b6;if(!_0x5340a9[_0x76f4('0x57')][_0x76f4('0x5f')]){return;}return db['User'][_0x76f4('0x21')]({'attributes':['id',_0x76f4('0x60')],'where':{'id':_0x5340a9[_0x76f4('0x57')][_0x76f4('0x5f')]}});})[_0x76f4('0x23')](function(_0x1c8973){if(_0x1c8973){_0x5340a9[_0x76f4('0x42')][_0x76f4('0x61')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1c8973[_0x76f4('0x60')]+','+(_0x5340a9['account'][_0x76f4('0x62')]||0xa),'interval':_0x76f4('0x48')});}if(!_0x5340a9[_0x76f4('0x57')][_0x76f4('0x63')]){return;}return db[_0x76f4('0x64')][_0x76f4('0x21')]({'attributes':['id',_0x76f4('0x60')],'where':{'id':_0x5340a9[_0x76f4('0x57')]['queueId']}});})[_0x76f4('0x23')](function(_0x521f00){if(_0x521f00){_0x5340a9['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x76f4('0x65'),'appdata':_0x521f00[_0x76f4('0x60')]+','+(_0x5340a9[_0x76f4('0x39')][_0x76f4('0x66')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x76f4('0x67'),_0x76f4('0x68'),_0x5340a9);})[_0x76f4('0x23')](function(_0x5f5c24){_0x16779e(_0x5f5c24);})[_0x76f4('0x17')](function(_0x21ce59){_0x80e29f(_0x109ad9[_0x76f4('0x14')](0x1f4,_0x21ce59[_0x76f4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 5d39072..394a919 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 _0x34d7=['mailAccount:','./mailAccount.events','save','remove','update','emit','length'];(function(_0x117417,_0x214c67){var _0x5ba86d=function(_0x35ad70){while(--_0x35ad70){_0x117417['push'](_0x117417['shift']());}};_0x5ba86d(++_0x214c67);}(_0x34d7,0x13c));var _0x734d=function(_0x427d5e,_0xa295ef){_0x427d5e=_0x427d5e-0x0;var _0xc4bd11=_0x34d7[_0x427d5e];return _0xc4bd11;};'use strict';var MailAccountEvents=require(_0x734d('0x0'));var events=[_0x734d('0x1'),_0x734d('0x2'),_0x734d('0x3')];function createListener(_0x2da9e8,_0xf54525){return function(_0x365941){_0xf54525[_0x734d('0x4')](_0x2da9e8,_0x365941);};}function removeListener(_0x2913bb,_0x4044f9){return function(){MailAccountEvents['removeListener'](_0x2913bb,_0x4044f9);};}exports['register']=function(_0x1b7994){for(var _0x3addbb=0x0,_0x1fa2e9=events[_0x734d('0x5')];_0x3addbb<_0x1fa2e9;_0x3addbb++){var _0x4d7313=events[_0x3addbb];var _0x1c07f0=createListener(_0x734d('0x6')+_0x4d7313,_0x1b7994);MailAccountEvents['on'](_0x4d7313,_0x1c07f0);}}; \ No newline at end of file +var _0xc8f2=['./mailAccount.events','remove','update','emit','removeListener','register','length','mailAccount:'];(function(_0x453b37,_0x711290){var _0xfada65=function(_0x2795ee){while(--_0x2795ee){_0x453b37['push'](_0x453b37['shift']());}};_0xfada65(++_0x711290);}(_0xc8f2,0x120));var _0x2c8f=function(_0x41749a,_0x4106f4){_0x41749a=_0x41749a-0x0;var _0x4c0505=_0xc8f2[_0x41749a];return _0x4c0505;};'use strict';var MailAccountEvents=require(_0x2c8f('0x0'));var events=['save',_0x2c8f('0x1'),_0x2c8f('0x2')];function createListener(_0x713a2f,_0x4897e3){return function(_0x4fe362){_0x4897e3[_0x2c8f('0x3')](_0x713a2f,_0x4fe362);};}function removeListener(_0x1aad6b,_0x2ccc05){return function(){MailAccountEvents[_0x2c8f('0x4')](_0x1aad6b,_0x2ccc05);};}exports[_0x2c8f('0x5')]=function(_0x136cd3){for(var _0x3be988=0x0,_0x5c547c=events[_0x2c8f('0x6')];_0x3be988<_0x5c547c;_0x3be988++){var _0x1652ed=events[_0x3be988];var _0x542ad2=createListener(_0x2c8f('0x7')+_0x1652ed,_0x136cd3);MailAccountEvents['on'](_0x1652ed,_0x542ad2);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 5fd9ddb..4d739c2 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 _0xaef7=['../../config/environment','./mailApplication.controller','get','show','put','/:id','isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0xe6372f,_0x1f769c){var _0x311689=function(_0x3bbd7d){while(--_0x3bbd7d){_0xe6372f['push'](_0xe6372f['shift']());}};_0x311689(++_0x1f769c);}(_0xaef7,0xe8));var _0x7aef=function(_0x117926,_0x268445){_0x117926=_0x117926-0x0;var _0xc34604=_0xaef7[_0x117926];return _0xc34604;};'use strict';var multer=require('multer');var util=require(_0x7aef('0x0'));var path=require(_0x7aef('0x1'));var timeout=require(_0x7aef('0x2'));var express=require(_0x7aef('0x3'));var router=express[_0x7aef('0x4')]();var fs_extra=require(_0x7aef('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7aef('0x6'));var controller=require(_0x7aef('0x7'));router[_0x7aef('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x7aef('0x9')]);router[_0x7aef('0xa')](_0x7aef('0xb'),auth[_0x7aef('0xc')](),controller[_0x7aef('0xd')]);router[_0x7aef('0xe')](_0x7aef('0xb'),auth[_0x7aef('0xc')](),controller[_0x7aef('0xf')]);module[_0x7aef('0x10')]=router; \ No newline at end of file +var _0x0951=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','put','delete','exports','multer'];(function(_0xc49df0,_0x2d18c3){var _0x515f5d=function(_0x45172d){while(--_0x45172d){_0xc49df0['push'](_0xc49df0['shift']());}};_0x515f5d(++_0x2d18c3);}(_0x0951,0xbf));var _0x1095=function(_0x2ee485,_0x527e57){_0x2ee485=_0x2ee485-0x0;var _0x225e24=_0x0951[_0x2ee485];return _0x225e24;};'use strict';var multer=require(_0x1095('0x0'));var util=require(_0x1095('0x1'));var path=require(_0x1095('0x2'));var timeout=require(_0x1095('0x3'));var express=require(_0x1095('0x4'));var router=express[_0x1095('0x5')]();var fs_extra=require(_0x1095('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1095('0x7'));var config=require(_0x1095('0x8'));var controller=require(_0x1095('0x9'));router[_0x1095('0xa')](_0x1095('0xb'),auth[_0x1095('0xc')](),controller['show']);router[_0x1095('0xd')](_0x1095('0xb'),auth[_0x1095('0xc')](),controller['update']);router[_0x1095('0xe')]('/:id',auth[_0x1095('0xc')](),controller['destroy']);module[_0x1095('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 7d4f81b..ff0fb49 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 _0x3ef3=['INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x88576c,_0x53c177){var _0xb50943=function(_0x33e7b1){while(--_0x33e7b1){_0x88576c['push'](_0x88576c['shift']());}};_0xb50943(++_0x53c177);}(_0x3ef3,0x19e));var _0x33ef=function(_0x206137,_0x2a56c7){_0x206137=_0x206137-0x0;var _0x96c5f7=_0x3ef3[_0x206137];return _0x96c5f7;};'use strict';var Sequelize=require(_0x33ef('0x0'));module['exports']={'priority':{'type':Sequelize[_0x33ef('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x33ef('0x2')],'allowNull':![],'defaultValue':_0x33ef('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x33ef('0x2')]},'interval':{'type':Sequelize[_0x33ef('0x2')],'defaultValue':_0x33ef('0x4')}}; \ No newline at end of file +var _0x8689=['INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x389822,_0x1ec9fe){var _0xc095c1=function(_0x2646ba){while(--_0x2646ba){_0x389822['push'](_0x389822['shift']());}};_0xc095c1(++_0x1ec9fe);}(_0x8689,0x12b));var _0x9868=function(_0x3cc0dd,_0x28eab8){_0x3cc0dd=_0x3cc0dd-0x0;var _0x74cfe8=_0x8689[_0x3cc0dd];return _0x74cfe8;};'use strict';var Sequelize=require(_0x9868('0x0'));module[_0x9868('0x1')]={'priority':{'type':Sequelize[_0x9868('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9868('0x3')},'appdata':{'type':Sequelize[_0x9868('0x4')]()},'description':{'type':Sequelize[_0x9868('0x5')]},'interval':{'type':Sequelize[_0x9868('0x5')],'defaultValue':_0x9868('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index d5ff25b..9f8b86d 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x364f99,_0x35b2a2){var _0x51d365=function(_0x36a8a5){while(--_0x36a8a5){_0x364f99['push'](_0x364f99['shift']());}};_0x51d365(++_0x35b2a2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2a4095,_0x13f4f0){_0x2a4095=_0x2a4095-0x0;var _0x52eeab=_0xcb91[_0x2a4095];return _0x52eeab;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={'raw':!![],'where':{'id':_0xb644b3[_0x1cb9('0x29')]['id']}},_0x48888d={};_0x48888d['model']=_[_0x1cb9('0x2a')](db['MailApplication'][_0x1cb9('0x2b')]);_0x48888d[_0x1cb9('0x2c')]=_[_0x1cb9('0x2a')](_0xb644b3[_0x1cb9('0x2c')]);_0x48888d['filters']=_[_0x1cb9('0x2d')](_0x48888d['model'],_0x48888d[_0x1cb9('0x2c')]);_0x9de64b[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x48888d['model'],qs[_0x1cb9('0x2f')](_0xb644b3['query'][_0x1cb9('0x2f')]));_0x9de64b['attributes']=_0x9de64b[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x9de64b[_0x1cb9('0x2e')]:_0x48888d[_0x1cb9('0x31')];if(_0xb644b3['query'][_0x1cb9('0x32')]){_0x9de64b[_0x1cb9('0x33')]=[{'all':!![]}];}_0x9de64b=_[_0x1cb9('0x34')]({},_0x9de64b,_0xb644b3[_0x1cb9('0x35')]);return db[_0x1cb9('0x36')][_0x1cb9('0x37')](_0x9de64b)[_0x1cb9('0x22')](handleEntityNotFound(_0x41e5c2,null))[_0x1cb9('0x22')](respondWithResult(_0x41e5c2,null))[_0x1cb9('0x38')](handleError(_0x41e5c2,null));};exports[_0x1cb9('0x21')]=function(_0x294eec,_0x26b950){if(_0x294eec[_0x1cb9('0x39')]['id']){delete _0x294eec['body']['id'];}return db['MailApplication'][_0x1cb9('0x37')]({'where':{'id':_0x294eec[_0x1cb9('0x29')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x26b950,null))[_0x1cb9('0x22')](saveUpdates(_0x294eec[_0x1cb9('0x39')],null))[_0x1cb9('0x22')](respondWithResult(_0x26b950,null))[_0x1cb9('0x38')](handleError(_0x26b950,null));};exports[_0x1cb9('0x23')]=function(_0x4d3e39,_0x2aa59b){return db[_0x1cb9('0x36')][_0x1cb9('0x37')]({'where':{'id':_0x4d3e39['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2aa59b,null))['then'](removeEntity(_0x2aa59b,null))[_0x1cb9('0x38')](handleError(_0x2aa59b,null));}; \ No newline at end of file +var _0x54ef=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','MailApplication','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x94ff4f,_0x4e7570){var _0x412c53=function(_0x19a85a){while(--_0x19a85a){_0x94ff4f['push'](_0x94ff4f['shift']());}};_0x412c53(++_0x4e7570);}(_0x54ef,0x112));var _0xf54e=function(_0x573d20,_0x15e366){_0x573d20=_0x573d20-0x0;var _0x3bd79c=_0x54ef[_0x573d20];return _0x3bd79c;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];function respondWithStatusCode(_0x4b0ee1,_0x4bd828){_0x4bd828=_0x4bd828||0xcc;return function(_0x15a9d4){if(_0x15a9d4){return _0x4b0ee1[_0xf54e('0x19')](_0x4bd828);}return _0x4b0ee1[_0xf54e('0x1a')](_0x4bd828)[_0xf54e('0x1b')]();};}function respondWithResult(_0x5644aa,_0x331732){_0x331732=_0x331732||0xc8;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1a')](_0x331732)[_0xf54e('0x1c')](_0x1bbeaa);}};}function respondWithFilteredResult(_0x56828e,_0x2366ee){return function(_0x389abc){if(_0x389abc){var _0x3eb415=typeof _0x2366ee['offset']==='undefined'&&typeof _0x2366ee[_0xf54e('0x1d')]===_0xf54e('0x1e');var _0x1c02e7=_0x389abc[_0xf54e('0x1f')];var _0x15cc48=_0x3eb415?0x0:_0x2366ee[_0xf54e('0x20')];var _0x2e27b6=_0x3eb415?_0x389abc[_0xf54e('0x1f')]:_0x2366ee[_0xf54e('0x20')]+_0x2366ee[_0xf54e('0x1d')];var _0x226c96;if(_0x2e27b6>=_0x1c02e7){_0x2e27b6=_0x1c02e7;_0x226c96=0xc8;}else{_0x226c96=0xce;}_0x56828e['status'](_0x226c96);return _0x56828e['set'](_0xf54e('0x21'),_0x15cc48+'-'+_0x2e27b6+'/'+_0x1c02e7)['json'](_0x389abc);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x22')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x23')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x24')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x25')](_0x388aa0)[_0xf54e('0x26')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x27')]()[_0xf54e('0x26')](function(){_0x6f6d29[_0xf54e('0x1a')](0xcc)[_0xf54e('0x1b')]();});}};}function handleEntityNotFound(_0x160160,_0x1e08d1){return function(_0x43488d){if(!_0x43488d){_0x160160[_0xf54e('0x19')](0x194);}return _0x43488d;};}function handleError(_0x33457f,_0xf6cdd7){_0xf6cdd7=_0xf6cdd7||0x1f4;return function(_0x39c0ae){logger[_0xf54e('0x28')](_0x39c0ae['stack']);if(_0x39c0ae[_0xf54e('0x29')]){delete _0x39c0ae['name'];}_0x33457f[_0xf54e('0x1a')](_0xf6cdd7)['send'](_0x39c0ae);};}exports[_0xf54e('0x2a')]=function(_0x269f47,_0x21ba00){var _0xa13cd0={'raw':!![],'where':{'id':_0x269f47[_0xf54e('0x2b')]['id']}},_0x25b643={};_0x25b643[_0xf54e('0x2c')]=_['keys'](db['MailApplication'][_0xf54e('0x2d')]);_0x25b643[_0xf54e('0x2e')]=_[_0xf54e('0x2f')](_0x269f47[_0xf54e('0x2e')]);_0x25b643[_0xf54e('0x30')]=_[_0xf54e('0x31')](_0x25b643[_0xf54e('0x2c')],_0x25b643[_0xf54e('0x2e')]);_0xa13cd0[_0xf54e('0x32')]=_[_0xf54e('0x31')](_0x25b643['model'],qs['fields'](_0x269f47[_0xf54e('0x2e')][_0xf54e('0x33')]));_0xa13cd0['attributes']=_0xa13cd0[_0xf54e('0x32')][_0xf54e('0x34')]?_0xa13cd0[_0xf54e('0x32')]:_0x25b643[_0xf54e('0x2c')];if(_0x269f47['query']['includeAll']){_0xa13cd0['include']=[{'all':!![]}];}_0xa13cd0=_[_0xf54e('0x35')]({},_0xa13cd0,_0x269f47[_0xf54e('0x36')]);return db[_0xf54e('0x37')][_0xf54e('0x38')](_0xa13cd0)[_0xf54e('0x26')](handleEntityNotFound(_0x21ba00,null))[_0xf54e('0x26')](respondWithResult(_0x21ba00,null))['catch'](handleError(_0x21ba00,null));};exports['update']=function(_0x530cee,_0xc04e04){if(_0x530cee[_0xf54e('0x39')]['id']){delete _0x530cee['body']['id'];}return db['MailApplication'][_0xf54e('0x38')]({'where':{'id':_0x530cee[_0xf54e('0x2b')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0xc04e04,null))['then'](saveUpdates(_0x530cee[_0xf54e('0x39')],null))[_0xf54e('0x26')](respondWithResult(_0xc04e04,null))['catch'](handleError(_0xc04e04,null));};exports[_0xf54e('0x27')]=function(_0x6e5bdf,_0x5af03){return db[_0xf54e('0x37')][_0xf54e('0x38')]({'where':{'id':_0x6e5bdf[_0xf54e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5af03,null))['then'](removeEntity(_0x5af03,null))[_0xf54e('0x3a')](handleError(_0x5af03,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 567da74..fd32012 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 _0xcc56=['exports','define','mail_applications','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes'];(function(_0x215998,_0x3635a3){var _0x16edb4=function(_0x1bd0fd){while(--_0x1bd0fd){_0x215998['push'](_0x215998['shift']());}};_0x16edb4(++_0x3635a3);}(_0xcc56,0xb3));var _0x6cc5=function(_0x3fea63,_0x1b68f1){_0x3fea63=_0x3fea63-0x0;var _0xc4442b=_0xcc56[_0x3fea63];return _0xc4442b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6cc5('0x0'))(_0x6cc5('0x1'));var moment=require(_0x6cc5('0x2'));var BPromise=require('bluebird');var rp=require(_0x6cc5('0x3'));var fs=require('fs');var path=require(_0x6cc5('0x4'));var rimraf=require(_0x6cc5('0x5'));var config=require(_0x6cc5('0x6'));var attributes=require(_0x6cc5('0x7'));module[_0x6cc5('0x8')]=function(_0xc28361,_0x1bf228){return _0xc28361[_0x6cc5('0x9')]('MailApplication',attributes,{'tableName':_0x6cc5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x430e=['utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','rimraf','./mailApplication.attributes','define','mail_applications'];(function(_0xfe95a,_0xb7757e){var _0x1031df=function(_0x381fbf){while(--_0x381fbf){_0xfe95a['push'](_0xfe95a['shift']());}};_0x1031df(++_0xb7757e);}(_0x430e,0x14b));var _0xe430=function(_0x52ef79,_0x23f3f0){_0x52ef79=_0x52ef79-0x0;var _0x23f33f=_0x430e[_0x52ef79];return _0x23f33f;};'use strict';var _=require(_0xe430('0x0'));var util=require(_0xe430('0x1'));var logger=require('../../config/logger')(_0xe430('0x2'));var moment=require('moment');var BPromise=require(_0xe430('0x3'));var rp=require(_0xe430('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe430('0x5'));var config=require('../../config/environment');var attributes=require(_0xe430('0x6'));module['exports']=function(_0x452284,_0x3d79a1){return _0x452284[_0xe430('0x7')]('MailApplication',attributes,{'tableName':_0xe430('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe430('0x9')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 02d1af5..3a20297 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 _0x0722=['raw','where','attributes','limit','stringify','catch','util','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','UpdateMailApplication','MailApplication','update','options'];(function(_0x150fc8,_0x14f156){var _0x4dbe12=function(_0xc7414e){while(--_0xc7414e){_0x150fc8['push'](_0x150fc8['shift']());}};_0x4dbe12(++_0x14f156);}(_0x0722,0xc3));var _0x2072=function(_0x5b4328,_0x166683){_0x5b4328=_0x5b4328-0x0;var _0x2c8b8c=_0x0722[_0x5b4328];return _0x2c8b8c;};'use strict';var _=require('lodash');var util=require(_0x2072('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2072('0x1'));var db=require(_0x2072('0x2'))['db'];var utils=require(_0x2072('0x3'));var logger=require('../../config/logger')(_0x2072('0x4'));var config=require('../../config/environment');var jayson=require(_0x2072('0x5'));var client=jayson[_0x2072('0x6')][_0x2072('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f60f4,_0x1f1342,_0x1f1488){return new BPromise(function(_0x503d23,_0x458aa4){return client['request'](_0x3f60f4,_0x1f1488)[_0x2072('0x8')](function(_0x54e886){logger[_0x2072('0x9')](_0x2072('0xa'),_0x1f1342,_0x2072('0xb'));logger[_0x2072('0xc')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x1f1342,_0x2072('0xb'),JSON['stringify'](_0x54e886));if(_0x54e886[_0x2072('0xd')]){if(_0x54e886[_0x2072('0xd')][_0x2072('0xe')]===0x1f4){logger[_0x2072('0xd')](_0x2072('0xa'),_0x1f1342,_0x54e886[_0x2072('0xd')][_0x2072('0xf')]);return _0x458aa4(_0x54e886[_0x2072('0xd')][_0x2072('0xf')]);}logger[_0x2072('0xd')](_0x2072('0xa'),_0x1f1342,_0x54e886[_0x2072('0xd')]['message']);return _0x503d23(_0x54e886[_0x2072('0xd')][_0x2072('0xf')]);}else{logger[_0x2072('0x9')](_0x2072('0xa'),_0x1f1342,'request\x20sent');_0x503d23(_0x54e886[_0x2072('0x10')][_0x2072('0xf')]);}})['catch'](function(_0x536357){logger['error']('MailApplication,\x20%s,\x20%s',_0x1f1342,_0x536357);_0x458aa4(_0x536357);});});}exports[_0x2072('0x11')]=function(_0xa439d9){var _0xe77ba3=this;return new Promise(function(_0x174504,_0x301579){return db[_0x2072('0x12')][_0x2072('0x13')](_0xa439d9['body'],{'raw':_0xa439d9[_0x2072('0x14')]?_0xa439d9['options'][_0x2072('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa439d9[_0x2072('0x14')]?_0xa439d9['options'][_0x2072('0x16')]||null:null,'attributes':_0xa439d9[_0x2072('0x14')]?_0xa439d9['options'][_0x2072('0x17')]||null:null,'limit':_0xa439d9[_0x2072('0x14')]?_0xa439d9[_0x2072('0x14')][_0x2072('0x18')]||null:null})[_0x2072('0x8')](function(_0x5efed9){logger[_0x2072('0x9')](_0x2072('0x11'),_0xa439d9);logger[_0x2072('0xc')]('UpdateMailApplication',_0xa439d9,JSON[_0x2072('0x19')](_0x5efed9));_0x174504(_0x5efed9);})[_0x2072('0x1a')](function(_0x161d38){logger[_0x2072('0xd')]('UpdateMailApplication',_0x161d38[_0x2072('0xf')],_0xa439d9);_0x301579(_0xe77ba3[_0x2072('0xd')](0x1f4,_0x161d38[_0x2072('0xf')]));});});}; \ No newline at end of file +var _0xe5fe=['UpdateMailApplication','update','body','options','raw','limit','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','stringify','error','code','MailApplication,\x20%s,\x20%s','message','result','catch'];(function(_0x59bdfb,_0x5bc1e8){var _0x4bf40c=function(_0x9c5071){while(--_0x9c5071){_0x59bdfb['push'](_0x59bdfb['shift']());}};_0x4bf40c(++_0x5bc1e8);}(_0xe5fe,0x93));var _0xee5f=function(_0x5ad294,_0x1477c7){_0x5ad294=_0x5ad294-0x0;var _0x20a450=_0xe5fe[_0x5ad294];return _0x20a450;};'use strict';var _=require(_0xee5f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee5f('0x1'));var rs=require(_0xee5f('0x2'));var fs=require('fs');var Redis=require(_0xee5f('0x3'));var db=require(_0xee5f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xee5f('0x5'))(_0xee5f('0x6'));var config=require(_0xee5f('0x7'));var jayson=require(_0xee5f('0x8'));var client=jayson[_0xee5f('0x9')][_0xee5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4490cf,_0x366741,_0x1ecc44){return new BPromise(function(_0x3512df,_0x311853){return client['request'](_0x4490cf,_0x1ecc44)[_0xee5f('0xb')](function(_0x323a8c){logger[_0xee5f('0xc')]('MailApplication,\x20%s,\x20%s',_0x366741,'request\x20sent');logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x366741,_0xee5f('0xd'),JSON[_0xee5f('0xe')](_0x323a8c));if(_0x323a8c[_0xee5f('0xf')]){if(_0x323a8c[_0xee5f('0xf')][_0xee5f('0x10')]===0x1f4){logger['error'](_0xee5f('0x11'),_0x366741,_0x323a8c[_0xee5f('0xf')][_0xee5f('0x12')]);return _0x311853(_0x323a8c['error']['message']);}logger[_0xee5f('0xf')]('MailApplication,\x20%s,\x20%s',_0x366741,_0x323a8c['error']['message']);return _0x3512df(_0x323a8c[_0xee5f('0xf')][_0xee5f('0x12')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x366741,_0xee5f('0xd'));_0x3512df(_0x323a8c[_0xee5f('0x13')][_0xee5f('0x12')]);}})[_0xee5f('0x14')](function(_0xde7381){logger['error']('MailApplication,\x20%s,\x20%s',_0x366741,_0xde7381);_0x311853(_0xde7381);});});}exports[_0xee5f('0x15')]=function(_0x4dbbc1){var _0x3be163=this;return new Promise(function(_0x238bf9,_0x1cdd2f){return db['MailApplication'][_0xee5f('0x16')](_0x4dbbc1[_0xee5f('0x17')],{'raw':_0x4dbbc1[_0xee5f('0x18')]?_0x4dbbc1[_0xee5f('0x18')][_0xee5f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4dbbc1[_0xee5f('0x18')]?_0x4dbbc1['options']['where']||null:null,'attributes':_0x4dbbc1[_0xee5f('0x18')]?_0x4dbbc1[_0xee5f('0x18')]['attributes']||null:null,'limit':_0x4dbbc1[_0xee5f('0x18')]?_0x4dbbc1['options'][_0xee5f('0x1a')]||null:null})['then'](function(_0x74c26d){logger[_0xee5f('0xc')](_0xee5f('0x15'),_0x4dbbc1);logger[_0xee5f('0x1b')](_0xee5f('0x15'),_0x4dbbc1,JSON[_0xee5f('0xe')](_0x74c26d));_0x238bf9(_0x74c26d);})[_0xee5f('0x14')](function(_0x55d7ac){logger['error']('UpdateMailApplication',_0x55d7ac['message'],_0x4dbbc1);_0x1cdd2f(_0x3be163[_0xee5f('0xf')](0x1f4,_0x55d7ac[_0xee5f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index af73736..b745b2c 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 _0xbcd9=['/:id/tags','tracked','mail','put','mailinteraction:update','delete','destroy','removeTags','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','describe','/:id','show','/:id/messages','isAuthenticated','getMessages','/:id/download','post','create','addMessage'];(function(_0x500801,_0x532cd6){var _0x504c73=function(_0x5736e7){while(--_0x5736e7){_0x500801['push'](_0x500801['shift']());}};_0x504c73(++_0x532cd6);}(_0xbcd9,0x85));var _0x9bcd=function(_0x1fc49c,_0x2b17d6){_0x1fc49c=_0x1fc49c-0x0;var _0x30a5f3=_0xbcd9[_0x1fc49c];return _0x30a5f3;};'use strict';var express=require(_0x9bcd('0x0'));var router=express[_0x9bcd('0x1')]();var auth=require(_0x9bcd('0x2'));var interaction=require(_0x9bcd('0x3'));var controller=require('./mailInteraction.controller');router[_0x9bcd('0x4')]('/',auth['isAuthenticated'](),controller[_0x9bcd('0x5')]);router[_0x9bcd('0x4')](_0x9bcd('0x6'),auth['isAuthenticated'](),controller[_0x9bcd('0x7')]);router[_0x9bcd('0x4')](_0x9bcd('0x8'),auth['isAuthenticated'](),controller[_0x9bcd('0x9')]);router[_0x9bcd('0x4')](_0x9bcd('0xa'),auth[_0x9bcd('0xb')](),controller[_0x9bcd('0xc')]);router[_0x9bcd('0x4')](_0x9bcd('0xd'),auth[_0x9bcd('0xb')](),controller['download']);router[_0x9bcd('0xe')]('/',auth['isAuthenticated'](),controller[_0x9bcd('0xf')]);router['post'](_0x9bcd('0xa'),auth[_0x9bcd('0xb')](),controller[_0x9bcd('0x10')]);router[_0x9bcd('0xe')](_0x9bcd('0x11'),auth[_0x9bcd('0xb')](),interaction[_0x9bcd('0x12')](_0x9bcd('0x13'),'mailinteraction:addtags'),controller['addTags']);router[_0x9bcd('0x14')](_0x9bcd('0x8'),auth[_0x9bcd('0xb')](),interaction[_0x9bcd('0x12')](_0x9bcd('0x13'),_0x9bcd('0x15')),controller['update']);router[_0x9bcd('0x16')](_0x9bcd('0x8'),auth[_0x9bcd('0xb')](),interaction['tracked'](_0x9bcd('0x13'),'mailinteraction:destroy'),controller[_0x9bcd('0x17')]);router[_0x9bcd('0x16')](_0x9bcd('0x11'),auth[_0x9bcd('0xb')](),controller[_0x9bcd('0x18')]);module['exports']=router; \ No newline at end of file +var _0x4a39=['/:id','destroy','delete','removeTags','exports','express','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index','show','getMessages','/:id/download','post','create','/:id/messages','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','update'];(function(_0x5cbf3a,_0x31b32b){var _0x360805=function(_0x13b23a){while(--_0x13b23a){_0x5cbf3a['push'](_0x5cbf3a['shift']());}};_0x360805(++_0x31b32b);}(_0x4a39,0x65));var _0x94a3=function(_0x1a9796,_0x1ab8c0){_0x1a9796=_0x1a9796-0x0;var _0x2b6192=_0x4a39[_0x1a9796];return _0x2b6192;};'use strict';var express=require(_0x94a3('0x0'));var router=express['Router']();var auth=require(_0x94a3('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0x94a3('0x2'));router[_0x94a3('0x3')]('/',auth[_0x94a3('0x4')](),controller[_0x94a3('0x5')]);router[_0x94a3('0x3')]('/describe',auth[_0x94a3('0x4')](),controller['describe']);router[_0x94a3('0x3')]('/:id',auth[_0x94a3('0x4')](),controller[_0x94a3('0x6')]);router[_0x94a3('0x3')]('/:id/messages',auth[_0x94a3('0x4')](),controller[_0x94a3('0x7')]);router[_0x94a3('0x3')](_0x94a3('0x8'),auth['isAuthenticated'](),controller['download']);router[_0x94a3('0x9')]('/',auth[_0x94a3('0x4')](),controller[_0x94a3('0xa')]);router[_0x94a3('0x9')](_0x94a3('0xb'),auth[_0x94a3('0x4')](),controller['addMessage']);router['post'](_0x94a3('0xc'),auth[_0x94a3('0x4')](),interaction[_0x94a3('0xd')](_0x94a3('0xe'),_0x94a3('0xf')),controller[_0x94a3('0x10')]);router[_0x94a3('0x11')]('/:id',auth[_0x94a3('0x4')](),interaction['tracked'](_0x94a3('0xe'),'mailinteraction:update'),controller[_0x94a3('0x12')]);router['delete'](_0x94a3('0x13'),auth[_0x94a3('0x4')](),interaction['tracked'](_0x94a3('0xe'),'mailinteraction:destroy'),controller[_0x94a3('0x14')]);router[_0x94a3('0x15')]('/:id/tags',auth[_0x94a3('0x4')](),controller[_0x94a3('0x16')]);module[_0x94a3('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 2d12ef2..186e59c 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 _0x55db=['out','ENUM','sequelize','exports','BOOLEAN','DATE','STRING','TEXT','long'];(function(_0x4c2fe1,_0x42d8f5){var _0x1b3731=function(_0x486087){while(--_0x486087){_0x4c2fe1['push'](_0x4c2fe1['shift']());}};_0x1b3731(++_0x42d8f5);}(_0x55db,0x110));var _0xb55d=function(_0x17fe2e,_0x5ae71a){_0x17fe2e=_0x17fe2e-0x0;var _0x4ee7a6=_0x55db[_0x17fe2e];return _0x4ee7a6;};'use strict';var Sequelize=require(_0xb55d('0x0'));var iconv=require('iconv');module[_0xb55d('0x1')]={'closed':{'type':Sequelize[_0xb55d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb55d('0x3')]},'disposition':{'type':Sequelize[_0xb55d('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb55d('0x4')]},'note':{'type':Sequelize[_0xb55d('0x4')]},'inReplyTo':{'type':Sequelize[_0xb55d('0x4')](0x1fe)},'to':{'type':Sequelize[_0xb55d('0x4')]},'cc':{'type':Sequelize[_0xb55d('0x5')](_0xb55d('0x6'))},'subject':{'type':Sequelize[_0xb55d('0x5')]()},'attach':{'type':Sequelize[_0xb55d('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb55d('0x3')]},'substatus':{'type':Sequelize[_0xb55d('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb55d('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb55d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb55d('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb55d('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x32ae=['INTEGER','iconv','exports','BOOLEAN','DATE','STRING','TEXT','ENUM','out'];(function(_0xd773d,_0x1c9549){var _0x17e7e1=function(_0x4730e4){while(--_0x4730e4){_0xd773d['push'](_0xd773d['shift']());}};_0x17e7e1(++_0x1c9549);}(_0x32ae,0x1cc));var _0xe32a=function(_0x14f681,_0xa0808e){_0x14f681=_0x14f681-0x0;var _0x1d4cb2=_0x32ae[_0x14f681];return _0x1d4cb2;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xe32a('0x0'));module[_0xe32a('0x1')]={'closed':{'type':Sequelize[_0xe32a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe32a('0x3')]},'disposition':{'type':Sequelize[_0xe32a('0x4')]},'secondDisposition':{'type':Sequelize[_0xe32a('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe32a('0x4')]},'note':{'type':Sequelize[_0xe32a('0x4')]},'inReplyTo':{'type':Sequelize[_0xe32a('0x4')](0x1fe)},'to':{'type':Sequelize[_0xe32a('0x4')]},'cc':{'type':Sequelize[_0xe32a('0x5')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xe32a('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xe32a('0x3')]},'substatus':{'type':Sequelize[_0xe32a('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xe32a('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe32a('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xe32a('0x6')]('in',_0xe32a('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe32a('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index fa8831b..870aa34 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 _0x63e4=['pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','rows','addTags','setTags','omit','spread','Tag','color','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','from','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','Bcc','basename','existsSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','html-entities','defaults','localhost','socket.io-emitter','redis','register','end','status','json','offset','limit','count','Content-Range','update','then','sendStatus','stack','name','send','map','fieldName','type','key','findAll','mail','query','user','catch','params','model','keys','MailInteraction','rawAttributes','filters','intersection','attributes','length','includeAll','include','merge','options','body','find','destroy','describe','MailMessage','ids','getMessages','findOne','fields','hasOwnProperty','order','sort','where'];(function(_0x7ca1b7,_0x25f3b3){var _0x52918f=function(_0x4d3ded){while(--_0x4d3ded){_0x7ca1b7['push'](_0x7ca1b7['shift']());}};_0x52918f(++_0x25f3b3);}(_0x63e4,0x18b));var _0x463e=function(_0x8925ae,_0x13502a){_0x8925ae=_0x8925ae-0x0;var _0x5b06b7=_0x63e4[_0x8925ae];return _0x5b06b7;};'use strict';var emlformat=require(_0x463e('0x0'));var rimraf=require(_0x463e('0x1'));var zipdir=require(_0x463e('0x2'));var moment=require(_0x463e('0x3'));var BPromise=require(_0x463e('0x4'));var util=require(_0x463e('0x5'));var path=require(_0x463e('0x6'));var fs=require('fs');var _=require(_0x463e('0x7'));var juice=require(_0x463e('0x8'));var Redis=require(_0x463e('0x9'));var interaction=require(_0x463e('0xa'));var qs=require(_0x463e('0xb'));var logger=require(_0x463e('0xc'))(_0x463e('0xd'));var config=require('../../config/environment');var db=require(_0x463e('0xe'))['db'];var htmlEntities=require(_0x463e('0xf'));config['redis']=_[_0x463e('0x10')](config['redis'],{'host':_0x463e('0x11'),'port':0x18eb});var socket=require(_0x463e('0x12'))(new Redis(config[_0x463e('0x13')]));require('./mailInteraction.socket')[_0x463e('0x14')](socket);function respondWithStatusCode(_0x584e13,_0x529baa){_0x529baa=_0x529baa||0xcc;return function(_0x22322f){if(_0x22322f){return _0x584e13['sendStatus'](_0x529baa);}return _0x584e13['status'](_0x529baa)[_0x463e('0x15')]();};}function respondWithResult(_0x2a80c7,_0x8c4675){_0x8c4675=_0x8c4675||0xc8;return function(_0x174498){if(_0x174498){return _0x2a80c7[_0x463e('0x16')](_0x8c4675)[_0x463e('0x17')](_0x174498);}};}function respondWithFilteredResult(_0x3cd2eb,_0x505877){return function(_0x3c6b5b){if(_0x3c6b5b){var _0x2d30f7=typeof _0x505877[_0x463e('0x18')]==='undefined'&&typeof _0x505877[_0x463e('0x19')]==='undefined';var _0x20b9a0=_0x3c6b5b[_0x463e('0x1a')];var _0x27239b=_0x2d30f7?0x0:_0x505877[_0x463e('0x18')];var _0x32dd1f=_0x2d30f7?_0x3c6b5b[_0x463e('0x1a')]:_0x505877['offset']+_0x505877[_0x463e('0x19')];var _0x450445;if(_0x32dd1f>=_0x20b9a0){_0x32dd1f=_0x20b9a0;_0x450445=0xc8;}else{_0x450445=0xce;}_0x3cd2eb[_0x463e('0x16')](_0x450445);return _0x3cd2eb['set'](_0x463e('0x1b'),_0x27239b+'-'+_0x32dd1f+'/'+_0x20b9a0)[_0x463e('0x17')](_0x3c6b5b);}return null;};}function saveUpdates(_0x898bb4){return function(_0x1b1e02){if(_0x1b1e02){return _0x1b1e02[_0x463e('0x1c')](_0x898bb4)[_0x463e('0x1d')](function(_0x461a80){return _0x461a80;});}return null;};}function removeEntity(_0x5952fe){return function(_0x4d662f){if(_0x4d662f){return _0x4d662f['destroy']()[_0x463e('0x1d')](function(){_0x5952fe['status'](0xcc)[_0x463e('0x15')]();});}};}function handleEntityNotFound(_0x157650){return function(_0x2fc5c5){if(!_0x2fc5c5){_0x157650[_0x463e('0x1e')](0x194);}return _0x2fc5c5;};}function handleError(_0x4bac2b,_0x10235f){_0x10235f=_0x10235f||0x1f4;return function(_0x48fb79){logger['error'](_0x48fb79[_0x463e('0x1f')]);if(_0x48fb79['name']){delete _0x48fb79[_0x463e('0x20')];}_0x4bac2b[_0x463e('0x16')](_0x10235f)[_0x463e('0x21')](_0x48fb79);};}exports['index']=function(_0x4d2de2,_0x34b5a2){var _0x5aa894={};var _0x4ca5f0=_[_0x463e('0x22')](db['MailInteraction']['rawAttributes'],function(_0x517568){return{'name':_0x517568[_0x463e('0x23')],'type':_0x517568[_0x463e('0x24')][_0x463e('0x25')]};});_0x5aa894=qs['getOptions'](_0x4ca5f0,_0x4d2de2);return interaction[_0x463e('0x26')](_0x463e('0x27'),_0x4d2de2[_0x463e('0x28')],_0x4d2de2[_0x463e('0x29')],_0x5aa894,_0x4ca5f0)[_0x463e('0x1d')](respondWithFilteredResult(_0x34b5a2,_0x5aa894))[_0x463e('0x2a')](handleError(_0x34b5a2,null));};exports['show']=function(_0x5c3a20,_0x5cc91c){var _0x4c915a={'raw':![],'where':{'id':_0x5c3a20[_0x463e('0x2b')]['id']}},_0x59e57b={};_0x59e57b[_0x463e('0x2c')]=_[_0x463e('0x2d')](db[_0x463e('0x2e')][_0x463e('0x2f')]);_0x59e57b['query']=_[_0x463e('0x2d')](_0x5c3a20[_0x463e('0x28')]);_0x59e57b[_0x463e('0x30')]=_[_0x463e('0x31')](_0x59e57b[_0x463e('0x2c')],_0x59e57b[_0x463e('0x28')]);_0x4c915a[_0x463e('0x32')]=_[_0x463e('0x31')](_0x59e57b['model'],qs['fields'](_0x5c3a20[_0x463e('0x28')]['fields']));_0x4c915a[_0x463e('0x32')]=_0x4c915a[_0x463e('0x32')][_0x463e('0x33')]?_0x4c915a['attributes']:_0x59e57b[_0x463e('0x2c')];if(_0x5c3a20[_0x463e('0x28')][_0x463e('0x34')]){_0x4c915a[_0x463e('0x35')]=[{'all':!![]}];}_0x4c915a=_[_0x463e('0x36')]({},_0x4c915a,_0x5c3a20[_0x463e('0x37')]);return db[_0x463e('0x2e')]['find'](_0x4c915a)['then'](handleEntityNotFound(_0x5cc91c,null))[_0x463e('0x1d')](respondWithResult(_0x5cc91c,null))[_0x463e('0x2a')](handleError(_0x5cc91c,null));};exports['create']=function(_0x1bf08a,_0x2c8ecf){return db['MailInteraction']['create'](_0x1bf08a[_0x463e('0x38')],{})['then'](respondWithResult(_0x2c8ecf,0xc9))[_0x463e('0x2a')](handleError(_0x2c8ecf,null));};exports[_0x463e('0x1c')]=function(_0x17de3c,_0x136f46){if(_0x17de3c['body']['id']){delete _0x17de3c[_0x463e('0x38')]['id'];}return db['MailInteraction'][_0x463e('0x39')]({'where':{'id':_0x17de3c[_0x463e('0x2b')]['id']}})[_0x463e('0x1d')](handleEntityNotFound(_0x136f46,null))['then'](saveUpdates(_0x17de3c[_0x463e('0x38')],null))['then'](respondWithResult(_0x136f46,null))[_0x463e('0x2a')](handleError(_0x136f46,null));};exports[_0x463e('0x3a')]=function(_0x41be3c,_0x5d50c3){return db['MailInteraction']['find']({'where':{'id':_0x41be3c[_0x463e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5d50c3,null))['then'](removeEntity(_0x5d50c3,null))[_0x463e('0x2a')](handleError(_0x5d50c3,null));};exports[_0x463e('0x3b')]=function(_0x5f423b,_0x1e24b3){return db['MailInteraction'][_0x463e('0x3b')]()['then'](respondWithResult(_0x1e24b3,null))[_0x463e('0x2a')](handleError(_0x1e24b3,null));};exports['addMessage']=function(_0xee6033,_0x418198){return db[_0x463e('0x3c')][_0x463e('0x39')]({'where':{'id':_0xee6033[_0x463e('0x2b')]['id']}})[_0x463e('0x1d')](handleEntityNotFound(_0x418198,null))['then'](function(_0x2de468){if(_0x2de468){return _0x2de468['addMessage'](_0xee6033[_0x463e('0x38')][_0x463e('0x3d')],_['omit'](_0xee6033[_0x463e('0x38')],[_0x463e('0x3d'),'id'])||{});}})[_0x463e('0x1d')](respondWithResult(_0x418198,null))['catch'](handleError(_0x418198,null));};exports[_0x463e('0x3e')]=function(_0x2d1e45,_0x4ac79a){var _0x599f2b={'raw':![],'where':{}};var _0x156a34={};var _0x5de62c={'count':0x0,'rows':[]};return db[_0x463e('0x2e')][_0x463e('0x3f')]({'where':{'id':_0x2d1e45['params']['id']}})[_0x463e('0x1d')](handleEntityNotFound(_0x4ac79a,null))['then'](function(_0x390c2d){if(_0x390c2d){_0x156a34[_0x463e('0x2c')]=_[_0x463e('0x2d')](db[_0x463e('0x3c')][_0x463e('0x2f')]);_0x156a34[_0x463e('0x28')]=_[_0x463e('0x2d')](_0x2d1e45['query']);_0x156a34[_0x463e('0x30')]=_[_0x463e('0x31')](_0x156a34[_0x463e('0x2c')],_0x156a34[_0x463e('0x28')]);_0x599f2b[_0x463e('0x32')]=_[_0x463e('0x31')](_0x156a34[_0x463e('0x2c')],qs[_0x463e('0x40')](_0x2d1e45[_0x463e('0x28')][_0x463e('0x40')]));_0x599f2b[_0x463e('0x32')]=_0x599f2b[_0x463e('0x32')][_0x463e('0x33')]?_0x599f2b['attributes']:_0x156a34[_0x463e('0x2c')];if(!_0x2d1e45[_0x463e('0x28')][_0x463e('0x41')]('nolimit')){_0x599f2b[_0x463e('0x19')]=qs['limit'](_0x2d1e45[_0x463e('0x28')][_0x463e('0x19')]);_0x599f2b[_0x463e('0x18')]=qs[_0x463e('0x18')](_0x2d1e45[_0x463e('0x28')][_0x463e('0x18')]);}_0x599f2b[_0x463e('0x42')]=qs[_0x463e('0x43')](_0x2d1e45['query'][_0x463e('0x43')]);_0x599f2b[_0x463e('0x44')]=qs[_0x463e('0x30')](_[_0x463e('0x45')](_0x2d1e45['query'],_0x156a34[_0x463e('0x30')]));_0x599f2b[_0x463e('0x44')][_0x463e('0x46')]=_0x390c2d['id'];if(_0x2d1e45[_0x463e('0x28')][_0x463e('0x47')]){_0x599f2b[_0x463e('0x44')]=_['merge'](_0x599f2b[_0x463e('0x44')],{'$or':_['map'](_0x599f2b['attributes'],function(_0x38df58){var _0x19bd1d={};_0x19bd1d[_0x38df58]={'$like':'%'+_0x2d1e45[_0x463e('0x28')][_0x463e('0x47')]+'%'};return _0x19bd1d;})});}if(_0x2d1e45[_0x463e('0x28')]['$gte']){var _0x146709=_0x2d1e45[_0x463e('0x28')][_0x463e('0x48')][_0x463e('0x49')](',');var _0x19140c={};_0x19140c[_0x146709[0x0]]={'$gte':moment(_0x146709[0x1])[_0x463e('0x4a')](_0x463e('0x4b'))};_0x599f2b[_0x463e('0x44')]=_[_0x463e('0x36')](_0x599f2b[_0x463e('0x44')],_0x19140c);}_0x599f2b=_['merge']({},_0x599f2b,_0x2d1e45[_0x463e('0x37')]);return db[_0x463e('0x3c')][_0x463e('0x1a')]({'where':_0x599f2b[_0x463e('0x44')]})[_0x463e('0x1d')](function(_0x189cc5){_0x5de62c['count']=_0x189cc5;if(_0x2d1e45[_0x463e('0x28')][_0x463e('0x34')]){_0x599f2b['include']=[{'all':!![]}];}return db[_0x463e('0x3c')][_0x463e('0x26')](_0x599f2b);})[_0x463e('0x1d')](function(_0x32ea1f){if(_0x2d1e45[_0x463e('0x28')]['inlineCss']===_0x463e('0x4c')){for(var _0x16ea47=0x0;_0x16ea47<_0x32ea1f[_0x463e('0x33')];_0x16ea47++){_0x32ea1f[_0x16ea47][_0x463e('0x38')]=juice(_0x32ea1f[_0x16ea47][_0x463e('0x38')]);}}_0x5de62c[_0x463e('0x4d')]=_0x32ea1f;return _0x5de62c;});}})[_0x463e('0x1d')](respondWithFilteredResult(_0x4ac79a,_0x599f2b))[_0x463e('0x2a')](handleError(_0x4ac79a,null));};exports[_0x463e('0x4e')]=function(_0x456d50,_0x144908){return db[_0x463e('0x2e')][_0x463e('0x39')]({'where':{'id':_0x456d50[_0x463e('0x2b')]['id']}})[_0x463e('0x1d')](handleEntityNotFound(_0x144908,null))[_0x463e('0x1d')](function(_0x5a37b3){if(_0x5a37b3){return _0x5a37b3[_0x463e('0x4f')](_0x456d50['body'][_0x463e('0x3d')],_[_0x463e('0x50')](_0x456d50[_0x463e('0x38')],[_0x463e('0x3d'),'id'])||{})[_0x463e('0x51')](function(){return db[_0x463e('0x52')][_0x463e('0x26')]({'attributes':['id','name',_0x463e('0x53')],'where':{'id':_0x456d50['body']['ids']}});})[_0x463e('0x1d')](function(_0x42fe50){socket[_0x463e('0x54')]('mailInteractionTags:save',{'id':Number(_0x456d50['params']['id']),'tags':_0x42fe50||[]});return{'id':Number(_0x456d50[_0x463e('0x2b')]['id']),'tags':_0x42fe50||[]};});}})[_0x463e('0x1d')](respondWithResult(_0x144908,null))[_0x463e('0x2a')](handleError(_0x144908,null));};exports[_0x463e('0x55')]=function(_0x4e6e16,_0x1d6fca){return db['MailInteraction'][_0x463e('0x39')]({'where':{'id':_0x4e6e16[_0x463e('0x2b')]['id']}})[_0x463e('0x1d')](handleEntityNotFound(_0x1d6fca,null))[_0x463e('0x1d')](function(_0x5ca731){if(_0x5ca731){return _0x5ca731[_0x463e('0x55')](_0x4e6e16[_0x463e('0x28')][_0x463e('0x3d')]);}})[_0x463e('0x1d')](respondWithStatusCode(_0x1d6fca,null))[_0x463e('0x2a')](handleError(_0x1d6fca,null));};exports[_0x463e('0x56')]=function(_0x5da68c,_0x53b080){var _0x3ca925=moment()[_0x463e('0x57')]()['toString']();var _0x1cbf8f=path[_0x463e('0x58')](config[_0x463e('0x59')],_0x463e('0x5a'),_0x463e('0x5b'),_0x463e('0x5c'));var _0x22cb2b=path[_0x463e('0x58')](config[_0x463e('0x59')],'server',_0x463e('0x5b'),_0x463e('0x5d'));var _0x5f31cf=path[_0x463e('0x58')](_0x1cbf8f,_0x3ca925);var _0x523971=util['format'](_0x463e('0x5e'),_0x5da68c[_0x463e('0x2b')]['id'],_0x3ca925);var _0x144e2b=path[_0x463e('0x58')](_0x1cbf8f,_0x523971);var _0x45a724=[];if(_0x5da68c['query'][_0x463e('0x5d')]){_0x45a724[_0x463e('0x5f')]({'model':db[_0x463e('0x60')],'as':'Attachments','raw':!![]});}var _0x110353=[{'model':db[_0x463e('0x3c')],'as':_0x463e('0x61'),'attributes':['id',_0x463e('0x38'),_0x463e('0x62'),'to','cc','bcc',_0x463e('0x63'),_0x463e('0x64')],'where':{'secret':![]},'order':qs[_0x463e('0x43')]('id'),'include':_0x45a724}];return db[_0x463e('0x2e')][_0x463e('0x39')]({'where':{'id':_0x5da68c[_0x463e('0x2b')]['id']},'include':_0x110353})[_0x463e('0x1d')](handleEntityNotFound(_0x53b080,null))[_0x463e('0x1d')](function(_0x9282b7){if(_0x9282b7&&_0x9282b7[_0x463e('0x61')]){var _0x3a4fe8=_0x9282b7[_0x463e('0x65')]({'plain':!![]});fs[_0x463e('0x66')](_0x5f31cf);return BPromise[_0x463e('0x67')](_0x3a4fe8['Messages'],function(_0x29f3bf,_0x1a2b21){var _0x5b1488={'from':_0x29f3bf[_0x463e('0x62')],'to':_0x29f3bf['to']||_0x463e('0x68'),'subject':_0x29f3bf['subject'],'html':htmlEntities[_0x463e('0x69')](_0x29f3bf['body']),'headers':{'Date':moment(_0x29f3bf[_0x463e('0x64')])['format'](_0x463e('0x6a'))},'attachments':[]};if(_0x29f3bf['cc']){_0x5b1488['headers']['Cc']=_0x29f3bf['cc'];}if(_0x29f3bf[_0x463e('0x6b')]){_0x5b1488[_0x463e('0x6c')][_0x463e('0x6d')]=_0x29f3bf[_0x463e('0x6b')];}return new BPromise(function(_0x2e33da,_0xcad9e7){if(_0x29f3bf['Attachments']){for(var _0xb02d88=0x0;_0xb02d88<_0x29f3bf['Attachments'][_0x463e('0x33')];_0xb02d88++){var _0xe90489=_0x29f3bf['Attachments'][_0xb02d88];var _0x1f1e2d=path[_0x463e('0x58')](_0x22cb2b,_0xe90489[_0x463e('0x6e')]);if(fs[_0x463e('0x6f')](_0x1f1e2d)){_0x5b1488[_0x463e('0x5d')][_0x463e('0x5f')]({'name':_0xe90489[_0x463e('0x20')],'contentType':_0xe90489[_0x463e('0x24')],'data':fs['readFileSync'](_0x1f1e2d)});}}}emlformat[_0x463e('0x70')](_0x5b1488,function(_0x52bfbf,_0x436777){if(_0x52bfbf)return _0xcad9e7(_0x52bfbf);fs[_0x463e('0x71')](path[_0x463e('0x58')](_0x5f31cf,util[_0x463e('0x4a')](_0x463e('0x72'),_0x1a2b21)),_0x436777);return _0x2e33da(_0x436777);});});})[_0x463e('0x1d')](function(){return new BPromise(function(_0x4c9aa8,_0x5b0e71){zipdir(_0x5f31cf,{'saveTo':_0x144e2b},function(_0x28e0b6,_0x351572){if(_0x28e0b6)return _0x5b0e71(_0x28e0b6);return _0x4c9aa8(_0x351572);});})[_0x463e('0x1d')](function(){return new BPromise(function(_0x2a6445,_0x483cd8){rimraf(_0x5f31cf,function(_0x2848b9){if(_0x2848b9)_0x483cd8(_0x2848b9);return _0x2a6445();});});})['then'](function(){return _0x53b080[_0x463e('0x56')](_0x144e2b,_0x523971,function(_0x26db6c){if(!_0x26db6c)fs[_0x463e('0x73')](_0x144e2b);});});});}else{return _0x53b080[_0x463e('0x1e')](0xc8);}})[_0x463e('0x2a')](handleError(_0x53b080,null));}; \ No newline at end of file +var _0xa270=['createdAt','get','mkdirSync','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','join','basename','existsSync','push','readFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','api','../../mysqldb','html-entities','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','status','end','json','offset','undefined','limit','Content-Range','then','destroy','sendStatus','error','stack','name','send','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','catch','params','model','keys','query','filters','intersection','fields','attributes','length','include','merge','options','find','create','body','update','describe','addMessage','omit','findOne','MailMessage','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','count','includeAll','inlineCss','rows','setTags','ids','spread','Tag','findAll','color','mailInteractionTags:save','removeTags','download','server','files','tmp','root','attachments','transcript-%d-%s.zip','Attachment','Messages','from','bcc'];(function(_0x5b288f,_0x2a0089){var _0x8de147=function(_0x6d3b70){while(--_0x6d3b70){_0x5b288f['push'](_0x5b288f['shift']());}};_0x8de147(++_0x2a0089);}(_0xa270,0x7e));var _0x0a27=function(_0x5c8663,_0x308e97){_0x5c8663=_0x5c8663-0x0;var _0x585f37=_0xa270[_0x5c8663];return _0x585f37;};'use strict';var emlformat=require(_0x0a27('0x0'));var rimraf=require(_0x0a27('0x1'));var zipdir=require(_0x0a27('0x2'));var moment=require(_0x0a27('0x3'));var BPromise=require(_0x0a27('0x4'));var util=require(_0x0a27('0x5'));var path=require(_0x0a27('0x6'));var fs=require('fs');var _=require(_0x0a27('0x7'));var juice=require('juice');var Redis=require(_0x0a27('0x8'));var interaction=require('../../components/interaction/service');var qs=require(_0x0a27('0x9'));var logger=require('../../config/logger')(_0x0a27('0xa'));var config=require('../../config/environment');var db=require(_0x0a27('0xb'))['db'];var htmlEntities=require(_0x0a27('0xc'));config[_0x0a27('0xd')]=_['defaults'](config[_0x0a27('0xd')],{'host':_0x0a27('0xe'),'port':0x18eb});var socket=require(_0x0a27('0xf'))(new Redis(config[_0x0a27('0xd')]));require(_0x0a27('0x10'))[_0x0a27('0x11')](socket);function respondWithStatusCode(_0x552a4d,_0x10648f){_0x10648f=_0x10648f||0xcc;return function(_0x51c060){if(_0x51c060){return _0x552a4d['sendStatus'](_0x10648f);}return _0x552a4d[_0x0a27('0x12')](_0x10648f)[_0x0a27('0x13')]();};}function respondWithResult(_0x272a08,_0x24cce9){_0x24cce9=_0x24cce9||0xc8;return function(_0x51c208){if(_0x51c208){return _0x272a08[_0x0a27('0x12')](_0x24cce9)[_0x0a27('0x14')](_0x51c208);}};}function respondWithFilteredResult(_0x14a40f,_0x163330){return function(_0x162306){if(_0x162306){var _0x5d9fb8=typeof _0x163330[_0x0a27('0x15')]===_0x0a27('0x16')&&typeof _0x163330['limit']===_0x0a27('0x16');var _0x401ea6=_0x162306['count'];var _0x2dcdaa=_0x5d9fb8?0x0:_0x163330[_0x0a27('0x15')];var _0x154199=_0x5d9fb8?_0x162306['count']:_0x163330[_0x0a27('0x15')]+_0x163330[_0x0a27('0x17')];var _0x3a2d81;if(_0x154199>=_0x401ea6){_0x154199=_0x401ea6;_0x3a2d81=0xc8;}else{_0x3a2d81=0xce;}_0x14a40f[_0x0a27('0x12')](_0x3a2d81);return _0x14a40f['set'](_0x0a27('0x18'),_0x2dcdaa+'-'+_0x154199+'/'+_0x401ea6)[_0x0a27('0x14')](_0x162306);}return null;};}function saveUpdates(_0xcd3a46){return function(_0x20ec44){if(_0x20ec44){return _0x20ec44['update'](_0xcd3a46)[_0x0a27('0x19')](function(_0x45863c){return _0x45863c;});}return null;};}function removeEntity(_0x4fc0f4){return function(_0xc9c1fc){if(_0xc9c1fc){return _0xc9c1fc[_0x0a27('0x1a')]()[_0x0a27('0x19')](function(){_0x4fc0f4[_0x0a27('0x12')](0xcc)[_0x0a27('0x13')]();});}};}function handleEntityNotFound(_0x21d390){return function(_0x594855){if(!_0x594855){_0x21d390[_0x0a27('0x1b')](0x194);}return _0x594855;};}function handleError(_0x9bd96a,_0x4ec0da){_0x4ec0da=_0x4ec0da||0x1f4;return function(_0x23fff0){logger[_0x0a27('0x1c')](_0x23fff0[_0x0a27('0x1d')]);if(_0x23fff0[_0x0a27('0x1e')]){delete _0x23fff0[_0x0a27('0x1e')];}_0x9bd96a[_0x0a27('0x12')](_0x4ec0da)[_0x0a27('0x1f')](_0x23fff0);};}exports['index']=function(_0x1416d6,_0x373586){var _0x2393fd={};var _0x312359=_[_0x0a27('0x20')](db[_0x0a27('0x21')][_0x0a27('0x22')],function(_0xcfa625){return{'name':_0xcfa625[_0x0a27('0x23')],'type':_0xcfa625[_0x0a27('0x24')][_0x0a27('0x25')]};});_0x2393fd=qs[_0x0a27('0x26')](_0x312359,_0x1416d6);return interaction['findAll']('mail',_0x1416d6['query'],_0x1416d6['user'],_0x2393fd,_0x312359)['then'](respondWithFilteredResult(_0x373586,_0x2393fd))[_0x0a27('0x27')](handleError(_0x373586,null));};exports['show']=function(_0x407ba2,_0x3f7322){var _0x4bea96={'raw':![],'where':{'id':_0x407ba2[_0x0a27('0x28')]['id']}},_0x3b924e={};_0x3b924e[_0x0a27('0x29')]=_[_0x0a27('0x2a')](db[_0x0a27('0x21')]['rawAttributes']);_0x3b924e[_0x0a27('0x2b')]=_[_0x0a27('0x2a')](_0x407ba2['query']);_0x3b924e[_0x0a27('0x2c')]=_['intersection'](_0x3b924e['model'],_0x3b924e[_0x0a27('0x2b')]);_0x4bea96['attributes']=_[_0x0a27('0x2d')](_0x3b924e[_0x0a27('0x29')],qs[_0x0a27('0x2e')](_0x407ba2[_0x0a27('0x2b')][_0x0a27('0x2e')]));_0x4bea96[_0x0a27('0x2f')]=_0x4bea96[_0x0a27('0x2f')][_0x0a27('0x30')]?_0x4bea96[_0x0a27('0x2f')]:_0x3b924e[_0x0a27('0x29')];if(_0x407ba2[_0x0a27('0x2b')]['includeAll']){_0x4bea96[_0x0a27('0x31')]=[{'all':!![]}];}_0x4bea96=_[_0x0a27('0x32')]({},_0x4bea96,_0x407ba2[_0x0a27('0x33')]);return db[_0x0a27('0x21')][_0x0a27('0x34')](_0x4bea96)[_0x0a27('0x19')](handleEntityNotFound(_0x3f7322,null))['then'](respondWithResult(_0x3f7322,null))['catch'](handleError(_0x3f7322,null));};exports['create']=function(_0x14f150,_0x530c39){return db[_0x0a27('0x21')][_0x0a27('0x35')](_0x14f150[_0x0a27('0x36')],{})['then'](respondWithResult(_0x530c39,0xc9))[_0x0a27('0x27')](handleError(_0x530c39,null));};exports[_0x0a27('0x37')]=function(_0x5e9be6,_0x1a087c){if(_0x5e9be6[_0x0a27('0x36')]['id']){delete _0x5e9be6['body']['id'];}return db[_0x0a27('0x21')][_0x0a27('0x34')]({'where':{'id':_0x5e9be6['params']['id']}})['then'](handleEntityNotFound(_0x1a087c,null))['then'](saveUpdates(_0x5e9be6[_0x0a27('0x36')],null))['then'](respondWithResult(_0x1a087c,null))[_0x0a27('0x27')](handleError(_0x1a087c,null));};exports['destroy']=function(_0x392afe,_0x559285){return db[_0x0a27('0x21')][_0x0a27('0x34')]({'where':{'id':_0x392afe[_0x0a27('0x28')]['id']}})[_0x0a27('0x19')](handleEntityNotFound(_0x559285,null))[_0x0a27('0x19')](removeEntity(_0x559285,null))[_0x0a27('0x27')](handleError(_0x559285,null));};exports[_0x0a27('0x38')]=function(_0x5f45a2,_0x4e0083){return db['MailInteraction'][_0x0a27('0x38')]()[_0x0a27('0x19')](respondWithResult(_0x4e0083,null))['catch'](handleError(_0x4e0083,null));};exports[_0x0a27('0x39')]=function(_0x5cc49d,_0x1f5b58){return db['MailMessage'][_0x0a27('0x34')]({'where':{'id':_0x5cc49d[_0x0a27('0x28')]['id']}})[_0x0a27('0x19')](handleEntityNotFound(_0x1f5b58,null))[_0x0a27('0x19')](function(_0x3562bd){if(_0x3562bd){return _0x3562bd['addMessage'](_0x5cc49d[_0x0a27('0x36')]['ids'],_[_0x0a27('0x3a')](_0x5cc49d['body'],['ids','id'])||{});}})[_0x0a27('0x19')](respondWithResult(_0x1f5b58,null))[_0x0a27('0x27')](handleError(_0x1f5b58,null));};exports['getMessages']=function(_0xf6a193,_0x1945e5){var _0x28f8cc={'raw':![],'where':{}};var _0xf8cf0e={};var _0x48ef4d={'count':0x0,'rows':[]};return db['MailInteraction'][_0x0a27('0x3b')]({'where':{'id':_0xf6a193['params']['id']}})[_0x0a27('0x19')](handleEntityNotFound(_0x1945e5,null))[_0x0a27('0x19')](function(_0x29e215){if(_0x29e215){_0xf8cf0e[_0x0a27('0x29')]=_[_0x0a27('0x2a')](db[_0x0a27('0x3c')]['rawAttributes']);_0xf8cf0e[_0x0a27('0x2b')]=_['keys'](_0xf6a193[_0x0a27('0x2b')]);_0xf8cf0e[_0x0a27('0x2c')]=_[_0x0a27('0x2d')](_0xf8cf0e[_0x0a27('0x29')],_0xf8cf0e['query']);_0x28f8cc[_0x0a27('0x2f')]=_[_0x0a27('0x2d')](_0xf8cf0e[_0x0a27('0x29')],qs[_0x0a27('0x2e')](_0xf6a193[_0x0a27('0x2b')][_0x0a27('0x2e')]));_0x28f8cc[_0x0a27('0x2f')]=_0x28f8cc[_0x0a27('0x2f')][_0x0a27('0x30')]?_0x28f8cc[_0x0a27('0x2f')]:_0xf8cf0e[_0x0a27('0x29')];if(!_0xf6a193[_0x0a27('0x2b')][_0x0a27('0x3d')](_0x0a27('0x3e'))){_0x28f8cc[_0x0a27('0x17')]=qs[_0x0a27('0x17')](_0xf6a193[_0x0a27('0x2b')][_0x0a27('0x17')]);_0x28f8cc[_0x0a27('0x15')]=qs['offset'](_0xf6a193[_0x0a27('0x2b')][_0x0a27('0x15')]);}_0x28f8cc[_0x0a27('0x3f')]=qs['sort'](_0xf6a193[_0x0a27('0x2b')][_0x0a27('0x40')]);_0x28f8cc[_0x0a27('0x41')]=qs[_0x0a27('0x2c')](_[_0x0a27('0x42')](_0xf6a193[_0x0a27('0x2b')],_0xf8cf0e['filters']));_0x28f8cc[_0x0a27('0x41')]['MailInteractionId']=_0x29e215['id'];if(_0xf6a193[_0x0a27('0x2b')]['filter']){_0x28f8cc[_0x0a27('0x41')]=_[_0x0a27('0x32')](_0x28f8cc[_0x0a27('0x41')],{'$or':_['map'](_0x28f8cc['attributes'],function(_0x5f1139){var _0x5c1e80={};_0x5c1e80[_0x5f1139]={'$like':'%'+_0xf6a193[_0x0a27('0x2b')][_0x0a27('0x43')]+'%'};return _0x5c1e80;})});}if(_0xf6a193[_0x0a27('0x2b')][_0x0a27('0x44')]){var _0x134210=_0xf6a193['query']['$gte']['split'](',');var _0x397c20={};_0x397c20[_0x134210[0x0]]={'$gte':moment(_0x134210[0x1])[_0x0a27('0x45')](_0x0a27('0x46'))};_0x28f8cc[_0x0a27('0x41')]=_[_0x0a27('0x32')](_0x28f8cc[_0x0a27('0x41')],_0x397c20);}_0x28f8cc=_[_0x0a27('0x32')]({},_0x28f8cc,_0xf6a193[_0x0a27('0x33')]);return db['MailMessage'][_0x0a27('0x47')]({'where':_0x28f8cc[_0x0a27('0x41')]})[_0x0a27('0x19')](function(_0x5d3b3e){_0x48ef4d[_0x0a27('0x47')]=_0x5d3b3e;if(_0xf6a193['query'][_0x0a27('0x48')]){_0x28f8cc[_0x0a27('0x31')]=[{'all':!![]}];}return db[_0x0a27('0x3c')]['findAll'](_0x28f8cc);})[_0x0a27('0x19')](function(_0x3badc7){if(_0xf6a193[_0x0a27('0x2b')][_0x0a27('0x49')]==='true'){for(var _0x251e57=0x0;_0x251e57<_0x3badc7[_0x0a27('0x30')];_0x251e57++){_0x3badc7[_0x251e57][_0x0a27('0x36')]=juice(_0x3badc7[_0x251e57][_0x0a27('0x36')]);}}_0x48ef4d[_0x0a27('0x4a')]=_0x3badc7;return _0x48ef4d;});}})[_0x0a27('0x19')](respondWithFilteredResult(_0x1945e5,_0x28f8cc))[_0x0a27('0x27')](handleError(_0x1945e5,null));};exports['addTags']=function(_0x3c8279,_0x2efd0a){return db[_0x0a27('0x21')]['find']({'where':{'id':_0x3c8279[_0x0a27('0x28')]['id']}})[_0x0a27('0x19')](handleEntityNotFound(_0x2efd0a,null))['then'](function(_0x237c24){if(_0x237c24){return _0x237c24[_0x0a27('0x4b')](_0x3c8279[_0x0a27('0x36')][_0x0a27('0x4c')],_[_0x0a27('0x3a')](_0x3c8279[_0x0a27('0x36')],['ids','id'])||{})[_0x0a27('0x4d')](function(){return db[_0x0a27('0x4e')][_0x0a27('0x4f')]({'attributes':['id','name',_0x0a27('0x50')],'where':{'id':_0x3c8279['body'][_0x0a27('0x4c')]}});})[_0x0a27('0x19')](function(_0xf49121){socket['emit'](_0x0a27('0x51'),{'id':Number(_0x3c8279['params']['id']),'tags':_0xf49121||[]});return{'id':Number(_0x3c8279[_0x0a27('0x28')]['id']),'tags':_0xf49121||[]};});}})[_0x0a27('0x19')](respondWithResult(_0x2efd0a,null))[_0x0a27('0x27')](handleError(_0x2efd0a,null));};exports[_0x0a27('0x52')]=function(_0x4809bc,_0x1f8e48){return db[_0x0a27('0x21')][_0x0a27('0x34')]({'where':{'id':_0x4809bc[_0x0a27('0x28')]['id']}})['then'](handleEntityNotFound(_0x1f8e48,null))['then'](function(_0x3b72ec){if(_0x3b72ec){return _0x3b72ec[_0x0a27('0x52')](_0x4809bc[_0x0a27('0x2b')][_0x0a27('0x4c')]);}})[_0x0a27('0x19')](respondWithStatusCode(_0x1f8e48,null))['catch'](handleError(_0x1f8e48,null));};exports[_0x0a27('0x53')]=function(_0x3a7377,_0x359e5c){var _0x522439=moment()['unix']()['toString']();var _0x22e2c7=path['join'](config['root'],_0x0a27('0x54'),_0x0a27('0x55'),_0x0a27('0x56'));var _0x181135=path['join'](config[_0x0a27('0x57')],_0x0a27('0x54'),_0x0a27('0x55'),_0x0a27('0x58'));var _0x25279e=path['join'](_0x22e2c7,_0x522439);var _0x25d423=util[_0x0a27('0x45')](_0x0a27('0x59'),_0x3a7377[_0x0a27('0x28')]['id'],_0x522439);var _0x2c2a48=path['join'](_0x22e2c7,_0x25d423);var _0x57beb3=[];if(_0x3a7377[_0x0a27('0x2b')][_0x0a27('0x58')]){_0x57beb3['push']({'model':db[_0x0a27('0x5a')],'as':'Attachments','raw':!![]});}var _0x4c58d4=[{'model':db['MailMessage'],'as':_0x0a27('0x5b'),'attributes':['id',_0x0a27('0x36'),_0x0a27('0x5c'),'to','cc',_0x0a27('0x5d'),'subject',_0x0a27('0x5e')],'where':{'secret':![]},'order':qs[_0x0a27('0x40')]('id'),'include':_0x57beb3}];return db[_0x0a27('0x21')][_0x0a27('0x34')]({'where':{'id':_0x3a7377['params']['id']},'include':_0x4c58d4})[_0x0a27('0x19')](handleEntityNotFound(_0x359e5c,null))[_0x0a27('0x19')](function(_0x1b7a62){if(_0x1b7a62&&_0x1b7a62[_0x0a27('0x5b')]){var _0x510c60=_0x1b7a62[_0x0a27('0x5f')]({'plain':!![]});fs[_0x0a27('0x60')](_0x25279e);return BPromise['each'](_0x510c60[_0x0a27('0x5b')],function(_0x285e1d,_0x89e762){var _0x52d342={'from':_0x285e1d['from'],'to':_0x285e1d['to']||_0x0a27('0x61'),'subject':_0x285e1d['subject'],'html':htmlEntities[_0x0a27('0x62')](_0x285e1d[_0x0a27('0x36')]),'headers':{'Date':moment(_0x285e1d['createdAt'])['format'](_0x0a27('0x63'))},'attachments':[]};if(_0x285e1d['cc']){_0x52d342[_0x0a27('0x64')]['Cc']=_0x285e1d['cc'];}if(_0x285e1d[_0x0a27('0x5d')]){_0x52d342[_0x0a27('0x64')][_0x0a27('0x65')]=_0x285e1d[_0x0a27('0x5d')];}return new BPromise(function(_0xcc6ac,_0x59ecf7){if(_0x285e1d[_0x0a27('0x66')]){for(var _0x53a786=0x0;_0x53a786<_0x285e1d[_0x0a27('0x66')][_0x0a27('0x30')];_0x53a786++){var _0x9e6135=_0x285e1d[_0x0a27('0x66')][_0x53a786];var _0x248c90=path[_0x0a27('0x67')](_0x181135,_0x9e6135[_0x0a27('0x68')]);if(fs[_0x0a27('0x69')](_0x248c90)){_0x52d342['attachments'][_0x0a27('0x6a')]({'name':_0x9e6135[_0x0a27('0x1e')],'contentType':_0x9e6135[_0x0a27('0x24')],'data':fs[_0x0a27('0x6b')](_0x248c90)});}}}emlformat['build'](_0x52d342,function(_0x425ebf,_0x79aa5a){if(_0x425ebf)return _0x59ecf7(_0x425ebf);fs['writeFileSync'](path[_0x0a27('0x67')](_0x25279e,util[_0x0a27('0x45')](_0x0a27('0x6c'),_0x89e762)),_0x79aa5a);return _0xcc6ac(_0x79aa5a);});});})[_0x0a27('0x19')](function(){return new BPromise(function(_0x59ae66,_0x1bf16b){zipdir(_0x25279e,{'saveTo':_0x2c2a48},function(_0xa12f07,_0x3282bf){if(_0xa12f07)return _0x1bf16b(_0xa12f07);return _0x59ae66(_0x3282bf);});})[_0x0a27('0x19')](function(){return new BPromise(function(_0x4c721b,_0x4b6a2c){rimraf(_0x25279e,function(_0x488a01){if(_0x488a01)_0x4b6a2c(_0x488a01);return _0x4c721b();});});})[_0x0a27('0x19')](function(){return _0x359e5c['download'](_0x2c2a48,_0x25d423,function(_0x278bfb){if(!_0x278bfb)fs[_0x0a27('0x6d')](_0x2c2a48);});});});}else{return _0x359e5c['sendStatus'](0xc8);}})[_0x0a27('0x27')](handleError(_0x359e5c,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index f23ae4f..22bb203 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 _0x30f1=['findAll','unreadMessages','emit','catch','hook','exports','events','../../mysqldb','MailMessage','save','update','getUsers','then','setDataValue','map'];(function(_0x2a9641,_0x10d0ac){var _0x18620a=function(_0x51c258){while(--_0x51c258){_0x2a9641['push'](_0x2a9641['shift']());}};_0x18620a(++_0x10d0ac);}(_0x30f1,0xc9));var _0x130f=function(_0x246229,_0xbc5ffb){_0x246229=_0x246229-0x0;var _0x45f780=_0x30f1[_0x246229];return _0x45f780;};'use strict';var EventEmitter=require(_0x130f('0x0'));var MailInteraction=require(_0x130f('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x130f('0x1'))['db'][_0x130f('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x130f('0x3'),'afterUpdate':_0x130f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x274c86){return function(_0x22c7a2,_0x33ccc6,_0x487a0e){_0x22c7a2[_0x130f('0x5')]({'attributes':['id'],'raw':!![]})[_0x130f('0x6')](function(_0x56a68f){_0x22c7a2[_0x130f('0x7')]('Users',_0x56a68f[_0x130f('0x8')](function(_0x3b6810){return{'id':_0x3b6810['id']};}));return MailMessage[_0x130f('0x9')]({'where':{'MailInteractionId':_0x22c7a2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x130f('0x6')](function(_0x408946){_0x22c7a2[_0x130f('0x7')](_0x130f('0xa'),_0x408946['length']);MailInteractionEvents[_0x130f('0xb')](_0x274c86+':'+_0x22c7a2['id'],_0x22c7a2);MailInteractionEvents[_0x130f('0xb')](_0x274c86,_0x22c7a2);_0x487a0e(null);})[_0x130f('0xc')](_0x487a0e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x130f('0xd')](e,emitEvent(event));}}module[_0x130f('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0x0436=['MailInteraction','MailMessage','setMaxListeners','save','update','getUsers','Users','map','findAll','then','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3d9966,_0x9ac14a){var _0x520827=function(_0x715801){while(--_0x715801){_0x3d9966['push'](_0x3d9966['shift']());}};_0x520827(++_0x9ac14a);}(_0x0436,0x96));var _0x6043=function(_0x38cb7b,_0x359f50){_0x38cb7b=_0x38cb7b-0x0;var _0x5014fd=_0x0436[_0x38cb7b];return _0x5014fd;};'use strict';var EventEmitter=require(_0x6043('0x0'));var MailInteraction=require(_0x6043('0x1'))['db'][_0x6043('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x6043('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6043('0x4')](0x0);var events={'afterCreate':_0x6043('0x5'),'afterUpdate':_0x6043('0x6'),'afterDestroy':'remove'};function emitEvent(_0x1f2086){return function(_0x1c13fb,_0x56ee6a,_0xaa9e0a){_0x1c13fb[_0x6043('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x222841){_0x1c13fb['setDataValue'](_0x6043('0x8'),_0x222841[_0x6043('0x9')](function(_0x22e7b2){return{'id':_0x22e7b2['id']};}));return MailMessage[_0x6043('0xa')]({'where':{'MailInteractionId':_0x1c13fb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6043('0xb')](function(_0x5f52c1){_0x1c13fb[_0x6043('0xc')]('unreadMessages',_0x5f52c1[_0x6043('0xd')]);MailInteractionEvents[_0x6043('0xe')](_0x1f2086+':'+_0x1c13fb['id'],_0x1c13fb);MailInteractionEvents[_0x6043('0xe')](_0x1f2086,_0x1c13fb);_0xaa9e0a(null);})[_0x6043('0xf')](_0xaa9e0a(null));};}for(var e in events){if(events[_0x6043('0x10')](e)){var event=events[e];MailInteraction[_0x6043('0x11')](e,emitEvent(event));}}module[_0x6043('0x12')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 15f5f80..89c24fa 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 _0x2cef=['changed','closed','closedAt','models','get','MailMessage','update','then','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','subject','FULLTEXT','YYYY-MM-DD\x20HH:mm:ss','substatusAt','substatus','format'];(function(_0x6f11c6,_0x3278d0){var _0x560a9f=function(_0x5610e0){while(--_0x5610e0){_0x6f11c6['push'](_0x6f11c6['shift']());}};_0x560a9f(++_0x3278d0);}(_0x2cef,0xc6));var _0xf2ce=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x2cef[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0xf2ce('0x0'));var util=require(_0xf2ce('0x1'));var logger=require(_0xf2ce('0x2'))('api');var moment=require(_0xf2ce('0x3'));var BPromise=require(_0xf2ce('0x4'));var rp=require(_0xf2ce('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf2ce('0x6'));var config=require(_0xf2ce('0x7'));var attributes=require(_0xf2ce('0x8'));module[_0xf2ce('0x9')]=function(_0x969742,_0x15cb63){return _0x969742[_0xf2ce('0xa')](_0xf2ce('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xf2ce('0xc'),'to'],'type':_0xf2ce('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xb12f94,_0x37b02e,_0x283488){if(_0xb12f94['substatus']){_0xb12f94['substatusAt']=moment()['format'](_0xf2ce('0xe'));}if(_0xb12f94['closed']){_0xb12f94['closedAt']=moment()['format'](_0xf2ce('0xe'));}_0x283488(null,_0x37b02e);},'beforeUpdate':function(_0x3517b6,_0x55080a,_0xe3e5eb){if(_0x3517b6['changed']('substatus')){_0x3517b6[_0xf2ce('0xf')]=_0x3517b6[_0xf2ce('0x10')]?moment()[_0xf2ce('0x11')](_0xf2ce('0xe')):null;}if(_0x3517b6[_0xf2ce('0x12')](_0xf2ce('0x13'))){_0x3517b6[_0xf2ce('0x14')]=moment()['format'](_0xf2ce('0xe'));_0x3517b6[_0xf2ce('0x10')]=null;_0x3517b6[_0xf2ce('0xf')]=null;}_0xe3e5eb(null,_0x3517b6);},'afterUpdate':function(_0x28e2a6,_0x300233,_0xf0ccc2){var _0x10169b=_0x969742[_0xf2ce('0x15')];var _0x17e58d=_0x28e2a6[_0xf2ce('0x16')]({'plain':!![]});if(_0x17e58d[_0xf2ce('0x13')]){return _0x10169b[_0xf2ce('0x17')][_0xf2ce('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x17e58d['id']}})[_0xf2ce('0x19')](function(){_0xf0ccc2();})['catch'](function(_0x57adc0){_0xf0ccc2(_0x57adc0);});}else{_0xf0ccc2();}}},'charset':_0xf2ce('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x21ab=['substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','subject','FULLTEXT'];(function(_0x5cc5ab,_0x1222d1){var _0x322b04=function(_0x4e4504){while(--_0x4e4504){_0x5cc5ab['push'](_0x5cc5ab['shift']());}};_0x322b04(++_0x1222d1);}(_0x21ab,0xd3));var _0xb21a=function(_0x40c849,_0xbc22a1){_0x40c849=_0x40c849-0x0;var _0x7d3bef=_0x21ab[_0x40c849];return _0x7d3bef;};'use strict';var _=require(_0xb21a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb21a('0x1'));var moment=require(_0xb21a('0x2'));var BPromise=require('bluebird');var rp=require(_0xb21a('0x3'));var fs=require('fs');var path=require(_0xb21a('0x4'));var rimraf=require(_0xb21a('0x5'));var config=require('../../config/environment');var attributes=require(_0xb21a('0x6'));module[_0xb21a('0x7')]=function(_0x166f97,_0x1c3810){return _0x166f97[_0xb21a('0x8')](_0xb21a('0x9'),attributes,{'tableName':_0xb21a('0xa'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xb21a('0xb'),'to'],'type':_0xb21a('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xadc041,_0x33d0db,_0x3a6888){if(_0xadc041[_0xb21a('0xd')]){_0xadc041[_0xb21a('0xe')]=moment()[_0xb21a('0xf')](_0xb21a('0x10'));}if(_0xadc041[_0xb21a('0x11')]){_0xadc041[_0xb21a('0x12')]=moment()['format'](_0xb21a('0x10'));}_0x3a6888(null,_0x33d0db);},'beforeUpdate':function(_0x269d68,_0x399343,_0x9aaed1){if(_0x269d68[_0xb21a('0x13')](_0xb21a('0xd'))){_0x269d68['substatusAt']=_0x269d68[_0xb21a('0xd')]?moment()[_0xb21a('0xf')](_0xb21a('0x10')):null;}if(_0x269d68['changed'](_0xb21a('0x11'))){_0x269d68[_0xb21a('0x12')]=moment()[_0xb21a('0xf')](_0xb21a('0x10'));_0x269d68[_0xb21a('0xd')]=null;_0x269d68['substatusAt']=null;}_0x9aaed1(null,_0x269d68);},'afterUpdate':function(_0xd8c353,_0x5b1788,_0x1c9b3c){var _0x4863b2=_0x166f97[_0xb21a('0x14')];var _0x478238=_0xd8c353[_0xb21a('0x15')]({'plain':!![]});if(_0x478238['closed']){return _0x4863b2[_0xb21a('0x16')][_0xb21a('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x478238['id']}})[_0xb21a('0x18')](function(){_0x1c9b3c();})[_0xb21a('0x19')](function(_0x3b9686){_0x1c9b3c(_0x3b9686);});}else{_0x1c9b3c();}}},'charset':_0xb21a('0x1a'),'collate':_0xb21a('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 02d77e4..5b8e506 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 _0xc405=['request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','limit','then','debug','addTags','ids','omit','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','info'];(function(_0x5a7625,_0x560c50){var _0x2a3954=function(_0x422a6f){while(--_0x422a6f){_0x5a7625['push'](_0x5a7625['shift']());}};_0x2a3954(++_0x560c50);}(_0xc405,0x69));var _0x5c40=function(_0x3b2806,_0x329a73){_0x3b2806=_0x3b2806-0x0;var _0x3c10bb=_0xc405[_0x3b2806];return _0x3c10bb;};'use strict';var _=require(_0x5c40('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5c40('0x1'));var rs=require(_0x5c40('0x2'));var fs=require('fs');var Redis=require(_0x5c40('0x3'));var db=require(_0x5c40('0x4'))['db'];var utils=require(_0x5c40('0x5'));var logger=require('../../config/logger')(_0x5c40('0x6'));var config=require(_0x5c40('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5c40('0x8')][_0x5c40('0x9')]({'port':0x232a});config[_0x5c40('0xa')]=_[_0x5c40('0xb')](config[_0x5c40('0xa')],{'host':_0x5c40('0xc'),'port':0x18eb});var socket=require(_0x5c40('0xd'))(new Redis(config['redis']));require(_0x5c40('0xe'))[_0x5c40('0xf')](socket);function respondWithRpcPromise(_0x43c057,_0xdc75a0,_0x22e4bc){return new BPromise(function(_0x3aa6df,_0x462a12){return client[_0x5c40('0x10')](_0x43c057,_0x22e4bc)['then'](function(_0x5757b4){logger[_0x5c40('0x11')]('MailInteraction,\x20%s,\x20%s',_0xdc75a0,_0x5c40('0x12'));logger['debug'](_0x5c40('0x13'),_0xdc75a0,_0x5c40('0x12'),JSON[_0x5c40('0x14')](_0x5757b4));if(_0x5757b4[_0x5c40('0x15')]){if(_0x5757b4[_0x5c40('0x15')][_0x5c40('0x16')]===0x1f4){logger[_0x5c40('0x15')](_0x5c40('0x17'),_0xdc75a0,_0x5757b4[_0x5c40('0x15')][_0x5c40('0x18')]);return _0x462a12(_0x5757b4['error'][_0x5c40('0x18')]);}logger[_0x5c40('0x15')](_0x5c40('0x17'),_0xdc75a0,_0x5757b4['error']['message']);return _0x3aa6df(_0x5757b4[_0x5c40('0x15')][_0x5c40('0x18')]);}else{logger[_0x5c40('0x11')](_0x5c40('0x17'),_0xdc75a0,_0x5c40('0x12'));_0x3aa6df(_0x5757b4[_0x5c40('0x19')][_0x5c40('0x18')]);}})[_0x5c40('0x1a')](function(_0x3225d6){logger[_0x5c40('0x15')](_0x5c40('0x17'),_0xdc75a0,_0x3225d6);_0x462a12(_0x3225d6);});});}exports[_0x5c40('0x1b')]=function(_0x46d275){var _0x1413ea=this;return new Promise(function(_0x2d7993,_0x485cbe){return db[_0x5c40('0x1c')]['update'](_0x46d275[_0x5c40('0x1d')],{'raw':_0x46d275[_0x5c40('0x1e')]?_0x46d275['options'][_0x5c40('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46d275[_0x5c40('0x1e')]?_0x46d275[_0x5c40('0x1e')][_0x5c40('0x20')]||null:null,'attributes':_0x46d275[_0x5c40('0x1e')]?_0x46d275[_0x5c40('0x1e')][_0x5c40('0x21')]||null:null,'limit':_0x46d275[_0x5c40('0x1e')]?_0x46d275[_0x5c40('0x1e')][_0x5c40('0x22')]||null:null})[_0x5c40('0x23')](function(_0xa33b30){logger['info'](_0x5c40('0x1b'),_0x46d275);logger[_0x5c40('0x24')](_0x5c40('0x1b'),_0x46d275,JSON[_0x5c40('0x14')](_0xa33b30));_0x2d7993(_0xa33b30);})['catch'](function(_0x358eb4){logger[_0x5c40('0x15')](_0x5c40('0x1b'),_0x358eb4[_0x5c40('0x18')],_0x46d275);_0x485cbe(_0x1413ea[_0x5c40('0x15')](0x1f4,_0x358eb4[_0x5c40('0x18')]));});});};exports['AddTagsToMailInteraction']=function(_0xb6ea48){return new Promise(function(_0x5bbb43,_0x4a6982){return db[_0x5c40('0x1c')]['find']({'where':_0xb6ea48['options']?_0xb6ea48[_0x5c40('0x1e')][_0x5c40('0x20')]||null:null})[_0x5c40('0x23')](function(_0x53377d){if(_0x53377d){return _0x53377d[_0x5c40('0x25')](_0xb6ea48[_0x5c40('0x1d')][_0x5c40('0x26')],_[_0x5c40('0x27')](_0xb6ea48['body'],[_0x5c40('0x26'),'id'])||{});}})['spread'](function(_0x2a17e2){logger['info'](_0x5c40('0x28'),_0xb6ea48);logger[_0x5c40('0x24')](_0x5c40('0x28'),_0xb6ea48,JSON['stringify'](_0x2a17e2));_0x5bbb43(_0x2a17e2);})[_0x5c40('0x1a')](function(_0x520ec2){logger['error']('AddTags',_0x520ec2[_0x5c40('0x18')],_0xb6ea48);_0x4a6982(_this[_0x5c40('0x15')](0x1f4,_0x520ec2[_0x5c40('0x18')]));});});}; \ No newline at end of file +var _0xa23f=['AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','socket.io-emitter','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','then','stringify','AddTagsToMailInteraction','find','addTags','ids','omit','spread'];(function(_0x3b3391,_0xd846f8){var _0x2fa2d0=function(_0x4e01ea){while(--_0x4e01ea){_0x3b3391['push'](_0x3b3391['shift']());}};_0x2fa2d0(++_0xd846f8);}(_0xa23f,0x7c));var _0xfa23=function(_0x7599ec,_0x463d0f){_0x7599ec=_0x7599ec-0x0;var _0x306730=_0xa23f[_0x7599ec];return _0x306730;};'use strict';var _=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfa23('0x2'));var fs=require('fs');var Redis=require(_0xfa23('0x3'));var db=require(_0xfa23('0x4'))['db'];var utils=require(_0xfa23('0x5'));var logger=require('../../config/logger')(_0xfa23('0x6'));var config=require('../../config/environment');var jayson=require(_0xfa23('0x7'));var client=jayson[_0xfa23('0x8')][_0xfa23('0x9')]({'port':0x232a});config[_0xfa23('0xa')]=_['defaults'](config[_0xfa23('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xfa23('0xb'))(new Redis(config[_0xfa23('0xa')]));require(_0xfa23('0xc'))[_0xfa23('0xd')](socket);function respondWithRpcPromise(_0x798943,_0x539453,_0x4b59d1){return new BPromise(function(_0x20a9b6,_0x4ea7a8){return client[_0xfa23('0xe')](_0x798943,_0x4b59d1)['then'](function(_0x1b99b7){logger[_0xfa23('0xf')](_0xfa23('0x10'),_0x539453,'request\x20sent');logger[_0xfa23('0x11')](_0xfa23('0x12'),_0x539453,_0xfa23('0x13'),JSON['stringify'](_0x1b99b7));if(_0x1b99b7['error']){if(_0x1b99b7[_0xfa23('0x14')][_0xfa23('0x15')]===0x1f4){logger[_0xfa23('0x14')](_0xfa23('0x10'),_0x539453,_0x1b99b7['error'][_0xfa23('0x16')]);return _0x4ea7a8(_0x1b99b7[_0xfa23('0x14')][_0xfa23('0x16')]);}logger[_0xfa23('0x14')]('MailInteraction,\x20%s,\x20%s',_0x539453,_0x1b99b7[_0xfa23('0x14')][_0xfa23('0x16')]);return _0x20a9b6(_0x1b99b7[_0xfa23('0x14')][_0xfa23('0x16')]);}else{logger[_0xfa23('0xf')]('MailInteraction,\x20%s,\x20%s',_0x539453,'request\x20sent');_0x20a9b6(_0x1b99b7['result'][_0xfa23('0x16')]);}})[_0xfa23('0x17')](function(_0x4bd0e0){logger[_0xfa23('0x14')](_0xfa23('0x10'),_0x539453,_0x4bd0e0);_0x4ea7a8(_0x4bd0e0);});});}exports[_0xfa23('0x18')]=function(_0x54bb04){var _0x1970ec=this;return new Promise(function(_0x452604,_0x47c323){return db[_0xfa23('0x19')][_0xfa23('0x1a')](_0x54bb04[_0xfa23('0x1b')],{'raw':_0x54bb04[_0xfa23('0x1c')]?_0x54bb04[_0xfa23('0x1c')][_0xfa23('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54bb04[_0xfa23('0x1c')]?_0x54bb04['options'][_0xfa23('0x1e')]||null:null,'attributes':_0x54bb04[_0xfa23('0x1c')]?_0x54bb04[_0xfa23('0x1c')][_0xfa23('0x1f')]||null:null,'limit':_0x54bb04['options']?_0x54bb04[_0xfa23('0x1c')]['limit']||null:null})[_0xfa23('0x20')](function(_0x1abb42){logger[_0xfa23('0xf')](_0xfa23('0x18'),_0x54bb04);logger[_0xfa23('0x11')](_0xfa23('0x18'),_0x54bb04,JSON[_0xfa23('0x21')](_0x1abb42));_0x452604(_0x1abb42);})[_0xfa23('0x17')](function(_0x5e1780){logger[_0xfa23('0x14')]('UpdateMailInteraction',_0x5e1780[_0xfa23('0x16')],_0x54bb04);_0x47c323(_0x1970ec['error'](0x1f4,_0x5e1780['message']));});});};exports[_0xfa23('0x22')]=function(_0x1a9a90){return new Promise(function(_0xbf9d19,_0x3b00a8){return db[_0xfa23('0x19')][_0xfa23('0x23')]({'where':_0x1a9a90[_0xfa23('0x1c')]?_0x1a9a90['options'][_0xfa23('0x1e')]||null:null})['then'](function(_0x380d42){if(_0x380d42){return _0x380d42[_0xfa23('0x24')](_0x1a9a90['body'][_0xfa23('0x25')],_[_0xfa23('0x26')](_0x1a9a90[_0xfa23('0x1b')],[_0xfa23('0x25'),'id'])||{});}})[_0xfa23('0x27')](function(_0x16393f){logger[_0xfa23('0xf')](_0xfa23('0x28'),_0x1a9a90);logger[_0xfa23('0x11')]('AddTags',_0x1a9a90,JSON[_0xfa23('0x21')](_0x16393f));_0xbf9d19(_0x16393f);})['catch'](function(_0x9d0602){logger[_0xfa23('0x14')](_0xfa23('0x28'),_0x9d0602[_0xfa23('0x16')],_0x1a9a90);_0x3b00a8(_this[_0xfa23('0x14')](0x1f4,_0x9d0602[_0xfa23('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 15d0ce7..1dff995 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 _0x8a8e=['length','save','remove','update','emit','removeListener'];(function(_0x3ef526,_0x2cb29d){var _0x257f66=function(_0x52f25f){while(--_0x52f25f){_0x3ef526['push'](_0x3ef526['shift']());}};_0x257f66(++_0x2cb29d);}(_0x8a8e,0xc7));var _0xe8a8=function(_0x37065a,_0xd1f059){_0x37065a=_0x37065a-0x0;var _0x293d11=_0x8a8e[_0x37065a];return _0x293d11;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xe8a8('0x0'),_0xe8a8('0x1'),_0xe8a8('0x2')];function createListener(_0x4f06c9,_0x576627){return function(_0x28ce24){_0x576627[_0xe8a8('0x3')](_0x4f06c9,_0x28ce24);};}function removeListener(_0x3012fb,_0x3c3914){return function(){MailInteractionEvents[_0xe8a8('0x4')](_0x3012fb,_0x3c3914);};}exports['register']=function(_0x2843d8){for(var _0x8301b3=0x0,_0x4a6e6c=events[_0xe8a8('0x5')];_0x8301b3<_0x4a6e6c;_0x8301b3++){var _0x37a120=events[_0x8301b3];var _0x1864a9=createListener('mailInteraction:'+_0x37a120,_0x2843d8);MailInteractionEvents['on'](_0x37a120,_0x1864a9);}}; \ No newline at end of file +var _0xd0a7=['remove','update','length','./mailInteraction.events','save'];(function(_0x44e195,_0x1e59ee){var _0x416bf0=function(_0x20ee19){while(--_0x20ee19){_0x44e195['push'](_0x44e195['shift']());}};_0x416bf0(++_0x1e59ee);}(_0xd0a7,0x1d9));var _0x7d0a=function(_0x5a6a4e,_0x1b3a62){_0x5a6a4e=_0x5a6a4e-0x0;var _0x3bb765=_0xd0a7[_0x5a6a4e];return _0x3bb765;};'use strict';var MailInteractionEvents=require(_0x7d0a('0x0'));var events=[_0x7d0a('0x1'),_0x7d0a('0x2'),_0x7d0a('0x3')];function createListener(_0x3bde78,_0x53603c){return function(_0x2d6522){_0x53603c['emit'](_0x3bde78,_0x2d6522);};}function removeListener(_0x132ecd,_0x2b3299){return function(){MailInteractionEvents['removeListener'](_0x132ecd,_0x2b3299);};}exports['register']=function(_0x12e9cc){for(var _0x54c1f1=0x0,_0xe2a23d=events[_0x7d0a('0x4')];_0x54c1f1<_0xe2a23d;_0x54c1f1++){var _0x221ec4=events[_0x54c1f1];var _0x16f5c5=createListener('mailInteraction:'+_0x221ec4,_0x12e9cc);MailInteractionEvents['on'](_0x221ec4,_0x16f5c5);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index b7a2e6d..b9cc6a2 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8028=['Router','./mailInteractionHasTag.controller','/describe','isAuthenticated'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x8028,0xcc));var _0x8802=function(_0x3541d3,_0x35ea4a){_0x3541d3=_0x3541d3-0x0;var _0x2c0f70=_0x8028[_0x3541d3];return _0x2c0f70;};'use strict';var express=require('express');var router=express[_0x8802('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x8802('0x1'));router['get'](_0x8802('0x2'),auth[_0x8802('0x3')](),controller['describe']);module['exports']=router; \ No newline at end of file +var _0xc599=['describe','exports','Router','./mailInteractionHasTag.controller','get','/describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc599,0x1b2));var _0x9c59=function(_0x24ef1c,_0x559d36){_0x24ef1c=_0x24ef1c-0x0;var _0x45ab3e=_0xc599[_0x24ef1c];return _0x45ab3e;};'use strict';var express=require('express');var router=express[_0x9c59('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x9c59('0x1'));router[_0x9c59('0x2')](_0x9c59('0x3'),auth['isAuthenticated'](),controller[_0x9c59('0x4')]);module[_0x9c59('0x5')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index b5b503a..6c4d850 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0xd8b1e,_0x2ea7e0){var _0x402b29=function(_0x353433){while(--_0x353433){_0xd8b1e['push'](_0xd8b1e['shift']());}};_0x402b29(++_0x2ea7e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x215032,_0x4c3a2c){var _0x23afde=function(_0x5b2061){while(--_0x5b2061){_0x215032['push'](_0x215032['shift']());}};_0x23afde(++_0x4c3a2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index 68d27c0..8b2da9d 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0fbe=['INTEGER','sequelize','exports'];(function(_0x4a7c22,_0x486f37){var _0x28e469=function(_0x354719){while(--_0x354719){_0x4a7c22['push'](_0x4a7c22['shift']());}};_0x28e469(++_0x486f37);}(_0x0fbe,0xb2));var _0xe0fb=function(_0xa6aa71,_0x2a5f0c){_0xa6aa71=_0xa6aa71-0x0;var _0x3c02cb=_0x0fbe[_0xa6aa71];return _0x3c02cb;};'use strict';var Sequelize=require(_0xe0fb('0x0'));module[_0xe0fb('0x1')]={'MailInteractionId':{'type':Sequelize[_0xe0fb('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file +var _0x283a=['INTEGER','sequelize'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x283a,0x12b));var _0xa283=function(_0x41582d,_0x291b1c){_0x41582d=_0x41582d-0x0;var _0x59c504=_0x283a[_0x41582d];return _0x59c504;};'use strict';var Sequelize=require(_0xa283('0x0'));module['exports']={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xa283('0x1')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index ae2f417..bec97e3 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a4a=['define','MailInteractionHasTag','mail_interaction_has_tags'];(function(_0x31c5fd,_0x33131f){var _0x3799ab=function(_0x1538bf){while(--_0x1538bf){_0x31c5fd['push'](_0x31c5fd['shift']());}};_0x3799ab(++_0x33131f);}(_0x4a4a,0x144));var _0xa4a4=function(_0x4a338c,_0x2d40ab){_0x4a338c=_0x4a338c-0x0;var _0x4c597e=_0x4a4a[_0x4a338c];return _0x4c597e;};'use strict';var attributes=require('./mailInteractionHasTag');module['exports']=function(_0x2b33b1){return _0x2b33b1[_0xa4a4('0x0')](_0xa4a4('0x1'),attributes,{'tableName':_0xa4a4('0x2'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a7c=['./mailInteractionHasTag','exports','MailInteractionHasTag'];(function(_0x3d3a3f,_0x41d1cc){var _0x89ee48=function(_0x2a1e66){while(--_0x2a1e66){_0x3d3a3f['push'](_0x3d3a3f['shift']());}};_0x89ee48(++_0x41d1cc);}(_0x1a7c,0xa2));var _0xc1a7=function(_0x10cfc2,_0x88b59d){_0x10cfc2=_0x10cfc2-0x0;var _0x25b436=_0x1a7c[_0x10cfc2];return _0x25b436;};'use strict';var attributes=require(_0xc1a7('0x0'));module[_0xc1a7('0x1')]=function(_0xa3e5c){return _0xa3e5c['define'](_0xc1a7('0x2'),attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 3391b0e..6567ef3 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 _0x9ea8=['/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','update','accept','reject','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe'];(function(_0x114250,_0x24dc7e){var _0x161bd8=function(_0x37296a){while(--_0x37296a){_0x114250['push'](_0x114250['shift']());}};_0x161bd8(++_0x24dc7e);}(_0x9ea8,0x147));var _0x89ea=function(_0x3fc20a,_0x1e6b7c){_0x3fc20a=_0x3fc20a-0x0;var _0x5719fa=_0x9ea8[_0x3fc20a];return _0x5719fa;};'use strict';var multer=require('multer');var util=require(_0x89ea('0x0'));var path=require(_0x89ea('0x1'));var timeout=require(_0x89ea('0x2'));var express=require(_0x89ea('0x3'));var router=express[_0x89ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x89ea('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x89ea('0x6'));var controller=require('./mailMessage.controller');router['get']('/',auth[_0x89ea('0x7')](),controller[_0x89ea('0x8')]);router[_0x89ea('0x9')](_0x89ea('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x89ea('0x9')](_0x89ea('0xb'),auth[_0x89ea('0x7')](),controller[_0x89ea('0xc')]);router[_0x89ea('0x9')](_0x89ea('0xd'),auth[_0x89ea('0x7')](),controller[_0x89ea('0xe')]);router[_0x89ea('0xf')]('/',auth[_0x89ea('0x7')](),interaction[_0x89ea('0x10')](_0x89ea('0x11'),_0x89ea('0x12')),controller[_0x89ea('0x13')]);router[_0x89ea('0x14')]('/:id',auth[_0x89ea('0x7')](),controller[_0x89ea('0x15')]);router[_0x89ea('0x14')]('/:id/accept',auth[_0x89ea('0x7')](),controller[_0x89ea('0x16')]);router['put']('/:id/reject',auth[_0x89ea('0x7')](),controller[_0x89ea('0x17')]);router[_0x89ea('0x18')](_0x89ea('0xb'),auth[_0x89ea('0x7')](),controller[_0x89ea('0x19')]);module['exports']=router; \ No newline at end of file +var _0x3a41=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','update','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3b1809,_0x1345b7){var _0x58089a=function(_0x59e756){while(--_0x59e756){_0x3b1809['push'](_0x3b1809['shift']());}};_0x58089a(++_0x1345b7);}(_0x3a41,0x86));var _0x13a4=function(_0x45be7a,_0x150ca7){_0x45be7a=_0x45be7a-0x0;var _0x4a9234=_0x3a41[_0x45be7a];return _0x4a9234;};'use strict';var multer=require(_0x13a4('0x0'));var util=require(_0x13a4('0x1'));var path=require(_0x13a4('0x2'));var timeout=require(_0x13a4('0x3'));var express=require(_0x13a4('0x4'));var router=express[_0x13a4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x13a4('0x6'));var interaction=require(_0x13a4('0x7'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0x13a4('0x8')]('/',auth[_0x13a4('0x9')](),controller[_0x13a4('0xa')]);router[_0x13a4('0x8')](_0x13a4('0xb'),auth['isAuthenticated'](),controller[_0x13a4('0xc')]);router[_0x13a4('0x8')](_0x13a4('0xd'),auth[_0x13a4('0x9')](),controller[_0x13a4('0xe')]);router[_0x13a4('0x8')](_0x13a4('0xf'),auth[_0x13a4('0x9')](),controller[_0x13a4('0x10')]);router[_0x13a4('0x11')]('/',auth[_0x13a4('0x9')](),interaction[_0x13a4('0x12')](_0x13a4('0x13'),'mailmessage:create'),controller['create']);router['put'](_0x13a4('0xd'),auth['isAuthenticated'](),controller[_0x13a4('0x14')]);router[_0x13a4('0x15')](_0x13a4('0x16'),auth['isAuthenticated'](),controller[_0x13a4('0x17')]);router['put'](_0x13a4('0x18'),auth['isAuthenticated'](),controller['reject']);router[_0x13a4('0x19')]('/:id',auth[_0x13a4('0x9')](),controller[_0x13a4('0x1a')]);module[_0x13a4('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 80ace51..779419c 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 _0x16a2=['Email','Chat','sequelize','lodash','exports','TEXT','long','medium','ENUM','out','STRING','DATE','INTEGER','BOOLEAN'];(function(_0xf04c6d,_0xe98786){var _0x4a804e=function(_0x431a0a){while(--_0x431a0a){_0xf04c6d['push'](_0xf04c6d['shift']());}};_0x4a804e(++_0xe98786);}(_0x16a2,0xaa));var _0x216a=function(_0x37b3e5,_0x33b516){_0x37b3e5=_0x37b3e5-0x0;var _0x207f20=_0x16a2[_0x37b3e5];return _0x207f20;};'use strict';var Sequelize=require(_0x216a('0x0'));var _=require(_0x216a('0x1'));module[_0x216a('0x2')]={'body':{'type':Sequelize[_0x216a('0x3')](_0x216a('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x216a('0x3')](_0x216a('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x216a('0x6')]('in','out'),'defaultValue':_0x216a('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x216a('0x8')](0x1fe)},'from':{'type':Sequelize[_0x216a('0x8')]},'to':{'type':Sequelize[_0x216a('0x3')](_0x216a('0x4'))},'cc':{'type':Sequelize[_0x216a('0x3')]('long')},'bcc':{'type':Sequelize[_0x216a('0x3')](_0x216a('0x4'))},'subject':{'type':Sequelize[_0x216a('0x3')]},'sentAt':{'type':Sequelize[_0x216a('0x9')]},'attach':{'type':Sequelize[_0x216a('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x216a('0xb')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x216a('0x3')]('long')},'originCc':{'type':Sequelize[_0x216a('0x3')]('long')},'originChannel':{'type':Sequelize[_0x216a('0x6')](_0x216a('0xc'),_0x216a('0xd')),'defaultValue':_0x216a('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0x4b0f=['ENUM','out','STRING','long','DATE','Email','Chat','lodash','exports','TEXT','medium','BOOLEAN'];(function(_0x24f862,_0x4b645a){var _0x198aa4=function(_0x131195){while(--_0x131195){_0x24f862['push'](_0x24f862['shift']());}};_0x198aa4(++_0x4b645a);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x25446b,_0x5d05aa){_0x25446b=_0x25446b-0x0;var _0x11409e=_0x4b0f[_0x25446b];return _0x11409e;};'use strict';var Sequelize=require('sequelize');var _=require(_0xf4b0('0x0'));module[_0xf4b0('0x1')]={'body':{'type':Sequelize[_0xf4b0('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf4b0('0x2')](_0xf4b0('0x3'))},'read':{'type':Sequelize[_0xf4b0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf4b0('0x5')]('in',_0xf4b0('0x6')),'defaultValue':_0xf4b0('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf4b0('0x7')](0x1fe)},'from':{'type':Sequelize[_0xf4b0('0x7')]},'to':{'type':Sequelize[_0xf4b0('0x2')](_0xf4b0('0x8'))},'cc':{'type':Sequelize[_0xf4b0('0x2')](_0xf4b0('0x8'))},'bcc':{'type':Sequelize[_0xf4b0('0x2')](_0xf4b0('0x8'))},'subject':{'type':Sequelize[_0xf4b0('0x2')]},'sentAt':{'type':Sequelize[_0xf4b0('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xf4b0('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xf4b0('0x9')]},'originTo':{'type':Sequelize[_0xf4b0('0x2')](_0xf4b0('0x8'))},'originCc':{'type':Sequelize[_0xf4b0('0x2')](_0xf4b0('0x8'))},'originChannel':{'type':Sequelize[_0xf4b0('0x5')](_0xf4b0('0xa'),_0xf4b0('0xb')),'defaultValue':_0xf4b0('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 3f1bd5d..48eb2b7 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 _0x250d=['CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','List','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','mail','readAt','UserId','user','get','read1stAt','format','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','contact','User','fullname','internal','manual','interface','SIP/%s','channel','event','accept','fromString','EventManager','acceptmessage','reject','MailInteraction','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId','sequelize','SELECT','agent','email','motionChannel','rejectmessage','download','unix','toString','root','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','writeFileSync','eml-format','moment','bluebird','util','lodash','ioredis','html-to-text','../../components/parsers/qs','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','jayson/promise','http','client','request','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','MailMessage,\x20%s,\x20%s','catch','status','offset','undefined','count','limit','set','json','destroy','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','then','includeAll','include','findAll','options','find','update','body','params','describe','create','direction','out','secret','split','MailAccount','findOne'];(function(_0x59ad3c,_0x41df41){var _0x1f9735=function(_0x2a824f){while(--_0x2a824f){_0x59ad3c['push'](_0x59ad3c['shift']());}};_0x1f9735(++_0x41df41);}(_0x250d,0xe8));var _0xd250=function(_0x5302fb,_0x1a2db3){_0x5302fb=_0x5302fb-0x0;var _0x43e6a4=_0x250d[_0x5302fb];return _0x43e6a4;};'use strict';var emlformat=require(_0xd250('0x0'));var moment=require(_0xd250('0x1'));var BPromise=require(_0xd250('0x2'));var util=require(_0xd250('0x3'));var path=require('path');var fs=require('fs');var _=require(_0xd250('0x4'));var Redis=require(_0xd250('0x5'));var htmlToText=require(_0xd250('0x6'));var qs=require(_0xd250('0x7'));var logger=require('../../config/logger')('api');var interaction_log=require('../../config/logger')(_0xd250('0x8'));var config=require(_0xd250('0x9'));var db=require(_0xd250('0xa'))['db'];config[_0xd250('0xb')]=_[_0xd250('0xc')](config['redis'],{'host':_0xd250('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd250('0xb')]));var htmlEntities=require('html-entities');require(_0xd250('0xe'))['register'](socket);var jayson=require(_0xd250('0xf'));var client=jayson['client'][_0xd250('0x10')]({'port':0x232c});var client9003=jayson[_0xd250('0x11')][_0xd250('0x10')]({'port':0x232b});var client9002=jayson[_0xd250('0x11')]['http']({'port':0x232a});function respondWithRpcPromise(_0x281468,_0x5eaca8,_0x125199,_0x4dc4b8){return new BPromise(function(_0x1bee22,_0x4bc61a){var _0x1b846a=_0x4dc4b8||client;return _0x1b846a[_0xd250('0x12')](_0x281468,_0x125199)['then'](function(_0x556a70){logger[_0xd250('0x13')]('MailMessage,\x20%s,\x20%s',_0x5eaca8,_0xd250('0x14'));logger['debug'](_0xd250('0x15'),_0x5eaca8,_0xd250('0x14'),JSON[_0xd250('0x16')](_0x556a70));if(_0x556a70[_0xd250('0x17')]){if(_0x556a70[_0xd250('0x17')]['code']===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x5eaca8,_0x556a70['error'][_0xd250('0x18')]);return _0x4bc61a(_0x556a70[_0xd250('0x17')][_0xd250('0x18')]);}logger['error'](_0xd250('0x19'),_0x5eaca8,_0x556a70[_0xd250('0x17')][_0xd250('0x18')]);return _0x1bee22(_0x556a70[_0xd250('0x17')][_0xd250('0x18')]);}else{logger['info'](_0xd250('0x19'),_0x5eaca8,_0xd250('0x14'));_0x1bee22(_0x556a70['result']['message']);}})[_0xd250('0x1a')](function(_0x4d3bb8){logger[_0xd250('0x17')](_0xd250('0x19'),_0x5eaca8,_0x4d3bb8);_0x4bc61a(_0x4d3bb8);});});}function respondWithResult(_0x32e97f,_0x1ddddf){_0x1ddddf=_0x1ddddf||0xc8;return function(_0x1b1423){if(_0x1b1423){return _0x32e97f[_0xd250('0x1b')](_0x1ddddf)['json'](_0x1b1423);}};}function respondWithFilteredResult(_0x5d3c68,_0xe96870){return function(_0x26cc8c){if(_0x26cc8c){var _0x1082f9=typeof _0xe96870[_0xd250('0x1c')]===_0xd250('0x1d')&&typeof _0xe96870['limit']===_0xd250('0x1d');var _0x5efdce=_0x26cc8c['count'];var _0x23e7a4=_0x1082f9?0x0:_0xe96870['offset'];var _0x2ed9b8=_0x1082f9?_0x26cc8c[_0xd250('0x1e')]:_0xe96870['offset']+_0xe96870[_0xd250('0x1f')];var _0x274ab0;if(_0x2ed9b8>=_0x5efdce){_0x2ed9b8=_0x5efdce;_0x274ab0=0xc8;}else{_0x274ab0=0xce;}_0x5d3c68['status'](_0x274ab0);return _0x5d3c68[_0xd250('0x20')]('Content-Range',_0x23e7a4+'-'+_0x2ed9b8+'/'+_0x5efdce)[_0xd250('0x21')](_0x26cc8c);}return null;};}function saveUpdates(_0x5a71c2){return function(_0x27e6b1){if(_0x27e6b1){return _0x27e6b1['update'](_0x5a71c2)['then'](function(_0x25b885){return _0x25b885;});}return null;};}function removeEntity(_0xef7e67){return function(_0x1929de){if(_0x1929de){return _0x1929de[_0xd250('0x22')]()['then'](function(){_0xef7e67[_0xd250('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52fd97){return function(_0x477a3c){if(!_0x477a3c){_0x52fd97[_0xd250('0x23')](0x194);}return _0x477a3c;};}function handleError(_0x49626f,_0x5cd3b9){_0x5cd3b9=_0x5cd3b9||0x1f4;return function(_0x5563c6){logger['error'](_0x5563c6[_0xd250('0x24')]);if(_0x5563c6[_0xd250('0x25')]){delete _0x5563c6['name'];}_0x49626f[_0xd250('0x1b')](_0x5cd3b9)['send'](_0x5563c6);};}exports[_0xd250('0x26')]=function(_0x5c5f4f,_0x1d6570){var _0x29070f={},_0x8e7d2c={},_0x375f72={'count':0x0,'rows':[]};var _0x176263=_[_0xd250('0x27')](db[_0xd250('0x28')][_0xd250('0x29')],function(_0x96a3f2){return{'name':_0x96a3f2[_0xd250('0x2a')],'type':_0x96a3f2[_0xd250('0x2b')]['key']};});_0x8e7d2c[_0xd250('0x2c')]=_[_0xd250('0x27')](_0x176263,'name');_0x8e7d2c[_0xd250('0x2d')]=_[_0xd250('0x2e')](_0x5c5f4f[_0xd250('0x2d')]);_0x8e7d2c[_0xd250('0x2f')]=_[_0xd250('0x30')](_0x8e7d2c['model'],_0x8e7d2c['query']);_0x29070f[_0xd250('0x31')]=_[_0xd250('0x30')](_0x8e7d2c['model'],qs[_0xd250('0x32')](_0x5c5f4f['query'][_0xd250('0x32')]));_0x29070f['attributes']=_0x29070f[_0xd250('0x31')][_0xd250('0x33')]?_0x29070f['attributes']:_0x8e7d2c[_0xd250('0x2c')];if(!_0x5c5f4f['query'][_0xd250('0x34')](_0xd250('0x35'))){_0x29070f[_0xd250('0x1f')]=qs[_0xd250('0x1f')](_0x5c5f4f[_0xd250('0x2d')]['limit']);_0x29070f[_0xd250('0x1c')]=qs['offset'](_0x5c5f4f[_0xd250('0x2d')][_0xd250('0x1c')]);}_0x29070f['order']=qs[_0xd250('0x36')](_0x5c5f4f[_0xd250('0x2d')][_0xd250('0x36')]);_0x29070f[_0xd250('0x37')]=qs[_0xd250('0x2f')](_['pick'](_0x5c5f4f[_0xd250('0x2d')],_0x8e7d2c[_0xd250('0x2f')]),_0x176263);if(_0x5c5f4f[_0xd250('0x2d')][_0xd250('0x38')]){_0x29070f[_0xd250('0x37')]=_[_0xd250('0x39')](_0x29070f[_0xd250('0x37')],{'$or':_[_0xd250('0x27')](_0x176263,function(_0x2fe7f0){if(_0x2fe7f0[_0xd250('0x2b')]!==_0xd250('0x3a')){var _0x4f2166={};_0x4f2166[_0x2fe7f0[_0xd250('0x25')]]={'$like':'%'+_0x5c5f4f['query'][_0xd250('0x38')]+'%'};return _0x4f2166;}})});}_0x29070f=_[_0xd250('0x39')]({},_0x29070f,_0x5c5f4f['options']);var _0x4dee5a={'where':_0x29070f[_0xd250('0x37')]};return db[_0xd250('0x28')]['count'](_0x4dee5a)[_0xd250('0x3b')](function(_0x18f896){_0x375f72[_0xd250('0x1e')]=_0x18f896;if(_0x5c5f4f[_0xd250('0x2d')][_0xd250('0x3c')]){_0x29070f[_0xd250('0x3d')]=[{'all':!![]}];}return db['MailMessage'][_0xd250('0x3e')](_0x29070f);})[_0xd250('0x3b')](function(_0x4b4c54){_0x375f72['rows']=_0x4b4c54;return _0x375f72;})[_0xd250('0x3b')](respondWithFilteredResult(_0x1d6570,_0x29070f))['catch'](handleError(_0x1d6570,null));};exports['show']=function(_0x56d682,_0xfa34c){var _0x4cfda7={'raw':!![],'where':{'id':_0x56d682['params']['id']}},_0x2ab371={};_0x2ab371['model']=_[_0xd250('0x2e')](db[_0xd250('0x28')][_0xd250('0x29')]);_0x2ab371['query']=_[_0xd250('0x2e')](_0x56d682[_0xd250('0x2d')]);_0x2ab371[_0xd250('0x2f')]=_['intersection'](_0x2ab371['model'],_0x2ab371[_0xd250('0x2d')]);_0x4cfda7[_0xd250('0x31')]=_['intersection'](_0x2ab371['model'],qs['fields'](_0x56d682[_0xd250('0x2d')][_0xd250('0x32')]));_0x4cfda7['attributes']=_0x4cfda7[_0xd250('0x31')]['length']?_0x4cfda7[_0xd250('0x31')]:_0x2ab371[_0xd250('0x2c')];if(_0x56d682['query'][_0xd250('0x3c')]){_0x4cfda7[_0xd250('0x3d')]=[{'all':!![]}];}_0x4cfda7=_['merge']({},_0x4cfda7,_0x56d682[_0xd250('0x3f')]);return db[_0xd250('0x28')][_0xd250('0x40')](_0x4cfda7)['then'](handleEntityNotFound(_0xfa34c,null))[_0xd250('0x3b')](respondWithResult(_0xfa34c,null))[_0xd250('0x1a')](handleError(_0xfa34c,null));};exports[_0xd250('0x41')]=function(_0x107bcd,_0x36d66a){if(_0x107bcd[_0xd250('0x42')]['id']){delete _0x107bcd['body']['id'];}return db[_0xd250('0x28')][_0xd250('0x40')]({'where':{'id':_0x107bcd[_0xd250('0x43')]['id']}})['then'](handleEntityNotFound(_0x36d66a,null))['then'](saveUpdates(_0x107bcd[_0xd250('0x42')],null))[_0xd250('0x3b')](respondWithResult(_0x36d66a,null))['catch'](handleError(_0x36d66a,null));};exports[_0xd250('0x22')]=function(_0x2693de,_0x552f7b){return db[_0xd250('0x28')][_0xd250('0x40')]({'where':{'id':_0x2693de[_0xd250('0x43')]['id']}})[_0xd250('0x3b')](handleEntityNotFound(_0x552f7b,null))[_0xd250('0x3b')](removeEntity(_0x552f7b,null))[_0xd250('0x1a')](handleError(_0x552f7b,null));};exports[_0xd250('0x44')]=function(_0x197c17,_0x2cfd68){return db[_0xd250('0x28')][_0xd250('0x44')]()[_0xd250('0x3b')](respondWithResult(_0x2cfd68,null))['catch'](handleError(_0x2cfd68,null));};exports[_0xd250('0x45')]=function(_0x37d160,_0x3718de){return db['MailMessage'][_0xd250('0x45')](_0x37d160[_0xd250('0x42')])[_0xd250('0x3b')](function(_0x13a69e){if(_0x13a69e){if(_0x13a69e[_0xd250('0x46')]===_0xd250('0x47')&&!_0x13a69e[_0xd250('0x48')]){var _0x359324,_0x27c38c,_0x107e5a;if(_0x37d160[_0xd250('0x42')]['to']){_0x27c38c=_0x37d160[_0xd250('0x42')]['to'][_0xd250('0x49')](',')[0x0];}return db[_0xd250('0x4a')][_0xd250('0x4b')]({'where':{'id':_0x13a69e['MailAccountId']},'include':[{'model':db[_0xd250('0x4c')],'as':'List','include':[{'model':db[_0xd250('0x4d')],'as':_0xd250('0x4e'),'where':{'email':_0x27c38c},'limit':0x1,'order':[[_0xd250('0x4f'),_0xd250('0x50')]]}]},{'model':db[_0xd250('0x51')],'as':_0xd250('0x52'),'raw':!![],'include':[{'model':db[_0xd250('0x53')],'as':_0xd250('0x53'),'raw':!![]}]}]})['then'](function(_0x3d5316){_0x359324=_0x3d5316;if(!_0x359324||!_0x359324[_0xd250('0x52')])return;var _0x1c7d13=_0x359324[_0xd250('0x54')]();if(_0x37d160[_0xd250('0x42')][_0xd250('0x55')]&&_0x37d160[_0xd250('0x42')][_0xd250('0x55')][_0xd250('0x33')]){for(var _0x6afaf9=0x0;_0x6afaf9<_0x37d160[_0xd250('0x42')][_0xd250('0x55')][_0xd250('0x33')];_0x6afaf9+=0x1){_0x37d160[_0xd250('0x42')][_0xd250('0x55')][_0x6afaf9]={'filename':_0x37d160[_0xd250('0x42')][_0xd250('0x55')][_0x6afaf9][_0xd250('0x25')],'path':path[_0xd250('0x56')](config['root'],_0xd250('0x57'),_0x37d160[_0xd250('0x42')][_0xd250('0x55')][_0x6afaf9][_0xd250('0x58')])};}}_0x107e5a={'account':_0x1c7d13,'message':_0x37d160[_0xd250('0x42')]};return;})[_0xd250('0x3b')](function(){if(_0x359324['List']){if(_0x359324[_0xd250('0x59')][_0xd250('0x4e')][_0xd250('0x33')]){return _0x359324[_0xd250('0x59')][_0xd250('0x4e')][0x0];}else{return db[_0xd250('0x4d')][_0xd250('0x45')](_[_0xd250('0xc')](_0x37d160[_0xd250('0x42')],{'firstName':_0x37d160['body']['to'],'email':_0x37d160['body']['to'],'phone':_0x37d160[_0xd250('0x42')]['to'],'ListId':_0x359324['ListId']}));}}else{throw new Error(_0xd250('0x5a'));}})['then'](function(){if(_0x107e5a){return respondWithRpcPromise(_0xd250('0x5b'),_0xd250('0x5c'),_0x107e5a,client9003)['then'](function(_0x584a9e){return _0x13a69e[_0xd250('0x41')]({'read':!![],'messageId':_0x584a9e[_0xd250('0x5d')],'sentAt':moment()['format'](_0xd250('0x5e'))});})['catch'](function(_0x59810e){logger[_0xd250('0x17')]('%s',JSON[_0xd250('0x16')](_0x59810e));return _0x13a69e;});}return _0x13a69e;});}return _0x13a69e;}})[_0xd250('0x3b')](respondWithResult(_0x3718de,0xc9))['catch'](handleError(_0x3718de,null));};exports['accept']=function(_0x17ab73,_0x589b9f){var _0x506edc={'agent':{},'channel':_0xd250('0x5f')};if(_0x17ab73[_0xd250('0x42')]['id']){delete _0x17ab73[_0xd250('0x42')]['id'];}_0x17ab73[_0xd250('0x42')]['read']=!![];_0x17ab73[_0xd250('0x42')][_0xd250('0x60')]=moment()['format'](_0xd250('0x5e'));_0x17ab73[_0xd250('0x42')][_0xd250('0x61')]=_0x17ab73[_0xd250('0x42')][_0xd250('0x61')]||_0x17ab73[_0xd250('0x62')]['id'];_0x506edc['agent']['id']=_0x17ab73['body'][_0xd250('0x61')];return db['MailMessage']['find']({'where':{'id':_0x17ab73['params']['id'],'UserId':null}})[_0xd250('0x3b')](handleEntityNotFound(_0x589b9f,null))['then'](saveUpdates(_0x17ab73[_0xd250('0x42')],null))[_0xd250('0x3b')](function(_0x3536bf){if(_0x3536bf){_0x506edc['message']=_0x3536bf[_0xd250('0x63')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x3536bf['MailInteractionId']}});}return null;})[_0xd250('0x3b')](handleEntityNotFound(_0x589b9f,null))['then'](function(_0x4b156d){if(_0x4b156d){return _0x4b156d['update']({'UserId':_0x17ab73[_0xd250('0x42')]['UserId'],'read1stAt':_['isNil'](_0x4b156d[_0xd250('0x64')])?moment()[_0xd250('0x65')](_0xd250('0x5e')):undefined});}return null;})['then'](function(_0x2ce9fb){if(_0x2ce9fb){_0x506edc[_0xd250('0x66')]=_0x2ce9fb['get']({'plain':!![]});interaction_log[_0xd250('0x13')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x17ab73['user']['id'],_0x17ab73[_0xd250('0x62')][_0xd250('0x25')],_0x17ab73[_0xd250('0x62')][_0xd250('0x67')],_0x506edc[_0xd250('0x66')]['id'],_0x17ab73[_0xd250('0x42')]?JSON['stringify'](_0x17ab73[_0xd250('0x42')]):_0xd250('0x68'));return respondWithRpcPromise(_0xd250('0x69'),_0xd250('0x6a'),_0x506edc);}return null;})[_0xd250('0x3b')](function(_0x21cb82){var _0x1f4122=_0xd250('0x6b')+_0x21cb82[_0xd250('0x18')]['ContactId'];return db['sequelize'][_0xd250('0x2d')](_0x1f4122,{'type':db['Sequelize'][_0xd250('0x6c')]['SELECT'],'raw':!![]})[_0xd250('0x3b')](function(_0x37e843){return _0x37e843;});})['then'](function(_0x5745b0){if(_0x5745b0){_0x506edc[_0xd250('0x18')][_0xd250('0x6d')]=_0x5745b0[0x0];if(!_0x17ab73['body'][_0xd250('0x61')])return;return db[_0xd250('0x6e')][_0xd250('0x40')]({'where':{'id':_0x17ab73[_0xd250('0x42')][_0xd250('0x61')],'role':'agent'},'attributes':['id',_0xd250('0x25'),_0xd250('0x6f'),'email',_0xd250('0x70')],'raw':!![]});}return null;})[_0xd250('0x3b')](function(_0xb14e8d){if(!_0xb14e8d)return null;_0x506edc[_0xd250('0x18')]['agent']=_0xb14e8d;return _0x506edc;})[_0xd250('0x3b')](function(_0x5c9f8d){if(_0x5c9f8d){if(_0x17ab73['body'][_0xd250('0x71')]){_0x506edc['message'][_0xd250('0x72')]=util[_0xd250('0x65')](_0xd250('0x73'),_0x17ab73['user'][_0xd250('0x25')]);_0x506edc[_0xd250('0x18')][_0xd250('0x74')]=_0x506edc[_0xd250('0x74')];_0x506edc[_0xd250('0x18')]['motionChannel']=_0x506edc[_0xd250('0x74')];_0x506edc[_0xd250('0x18')][_0xd250('0x75')]=_0xd250('0x76');_0x506edc[_0xd250('0x18')][_0xd250('0x42')]=htmlToText[_0xd250('0x77')](_0x506edc[_0xd250('0x18')][_0xd250('0x42')]);return respondWithRpcPromise(_0xd250('0x78'),_0xd250('0x78'),{'event':_0xd250('0x79'),'message':_0x506edc[_0xd250('0x18')]},client9002)[_0xd250('0x3b')](function(){return _0x506edc;});}return _0x506edc;}return null;})[_0xd250('0x3b')](respondWithResult(_0x589b9f,null))['catch'](handleError(_0x589b9f,null));};exports[_0xd250('0x7a')]=function(_0x116110,_0x470dda){var _0x498c84={'agent':{},'channel':_0xd250('0x5f')};if(_0x116110[_0xd250('0x42')]['id']){delete _0x116110[_0xd250('0x42')]['id'];}_0x116110[_0xd250('0x42')][_0xd250('0x61')]=_0x116110[_0xd250('0x42')][_0xd250('0x61')]||_0x116110[_0xd250('0x62')]['id'];_0x498c84['agent']['id']=_0x116110[_0xd250('0x42')][_0xd250('0x61')];return db['MailMessage'][_0xd250('0x40')]({'where':{'id':_0x116110[_0xd250('0x43')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x470dda,null))[_0xd250('0x3b')](function(_0xb4a89d){if(_0xb4a89d){_0x498c84['message']=_0xb4a89d['get']({'plain':!![]});return db[_0xd250('0x7b')][_0xd250('0x40')]({'where':{'id':_0xb4a89d[_0xd250('0x7c')]}});}return null;})['then'](handleEntityNotFound(_0x470dda,null))[_0xd250('0x3b')](function(_0x983355){if(_0x983355){_0x498c84[_0xd250('0x66')]=_0x983355[_0xd250('0x63')]({'plain':!![]});interaction_log[_0xd250('0x13')](_0xd250('0x7d'),_0x116110[_0xd250('0x62')]['id'],_0x116110[_0xd250('0x62')][_0xd250('0x25')],_0x116110['user'][_0xd250('0x67')],_0x498c84[_0xd250('0x66')]['id'],_0x116110[_0xd250('0x42')]?JSON[_0xd250('0x16')](_0x116110[_0xd250('0x42')]):_0xd250('0x68'));return respondWithRpcPromise('RejectMessage',_0xd250('0x7e'),_0x498c84);}return null;})[_0xd250('0x3b')](function(_0x126b01){var _0x2aadf0=_0xd250('0x6b')+_0x126b01[_0xd250('0x18')][_0xd250('0x7f')];return db[_0xd250('0x80')]['query'](_0x2aadf0,{'type':db['Sequelize'][_0xd250('0x6c')][_0xd250('0x81')],'raw':!![]})['then'](function(_0x4bc589){return _0x4bc589;});})['then'](function(_0x21c502){if(_0x21c502){_0x498c84[_0xd250('0x18')][_0xd250('0x6d')]=_0x21c502[0x0];if(!_0x116110['body'][_0xd250('0x61')])return;return db[_0xd250('0x6e')][_0xd250('0x40')]({'where':{'id':_0x116110[_0xd250('0x42')][_0xd250('0x61')],'role':_0xd250('0x82')},'attributes':['id',_0xd250('0x25'),'fullname',_0xd250('0x83'),_0xd250('0x70')],'raw':!![]});}return null;})[_0xd250('0x3b')](function(_0x5c7ab1){if(!_0x5c7ab1)return null;_0x498c84[_0xd250('0x18')]['agent']=_0x5c7ab1;return _0x498c84;})['then'](function(_0xfcba38){if(_0xfcba38){_0xfcba38[_0xd250('0x18')][_0xd250('0x72')]=util[_0xd250('0x65')](_0xd250('0x73'),_0x116110[_0xd250('0x62')]['name']);_0xfcba38['message'][_0xd250('0x74')]=_0x498c84[_0xd250('0x74')];_0xfcba38[_0xd250('0x18')][_0xd250('0x84')]=_0x498c84[_0xd250('0x74')];_0xfcba38[_0xd250('0x18')]['event']=_0xd250('0x7a');_0xfcba38['message'][_0xd250('0x42')]=htmlToText[_0xd250('0x77')](_0x498c84[_0xd250('0x18')][_0xd250('0x42')]);respondWithRpcPromise(_0xd250('0x78'),_0xd250('0x78'),{'event':_0xd250('0x85'),'message':_0xfcba38[_0xd250('0x18')]},client9002);return _0x498c84;}return null;})[_0xd250('0x3b')](respondWithResult(_0x470dda,null))[_0xd250('0x1a')](handleError(_0x470dda,null));};exports[_0xd250('0x86')]=function(_0x8c9482,_0x1b2570){var _0xeb9ec3=moment()[_0xd250('0x87')]()[_0xd250('0x88')]();var _0x9b3afe=path['join'](config[_0xd250('0x89')],_0xd250('0x8a'),_0xd250('0x8b'),'tmp');var _0x4eadc3=path[_0xd250('0x56')](config[_0xd250('0x89')],'server',_0xd250('0x8b'),_0xd250('0x55'));var _0x3cc391=util[_0xd250('0x65')](_0xd250('0x8c'),_0xeb9ec3);return db[_0xd250('0x28')][_0xd250('0x40')]({'where':{'id':_0x8c9482[_0xd250('0x43')]['id']},'attributes':['id',_0xd250('0x42'),_0xd250('0x8d'),'to','cc',_0xd250('0x8e'),_0xd250('0x8f'),_0xd250('0x90')],'include':_0x8c9482[_0xd250('0x2d')]['attachments']?[{'model':db[_0xd250('0x91')],'as':_0xd250('0x92')}]:undefined})[_0xd250('0x3b')](handleEntityNotFound(_0x1b2570,null))['then'](function(_0x4325cf){if(_0x4325cf){var _0x5c84ec=_0x4325cf;var _0x3f49f9={'from':_0x5c84ec[_0xd250('0x8d')],'to':_0x5c84ec['to'],'subject':_0x5c84ec[_0xd250('0x8f')],'html':htmlEntities['decode'](_0x5c84ec[_0xd250('0x42')]),'headers':{'Date':moment(_0x5c84ec['createdAt'])[_0xd250('0x65')](_0xd250('0x93'))},'attachments':[]};if(_0x4325cf['cc']){_0x3f49f9[_0xd250('0x94')]['Cc']=_0x4325cf['cc'];}if(_0x4325cf[_0xd250('0x8e')]){_0x3f49f9[_0xd250('0x94')][_0xd250('0x95')]=_0x4325cf[_0xd250('0x8e')];}return new BPromise(function(_0x4edfce,_0x10193b){if(_0x4325cf[_0xd250('0x92')]){for(var _0x15726b=0x0;_0x15726b<_0x4325cf[_0xd250('0x92')][_0xd250('0x33')];_0x15726b++){var _0x49766d=_0x4325cf['Attachments'][_0x15726b];var _0x26b992=path['join'](_0x4eadc3,_0x49766d[_0xd250('0x58')]);if(fs[_0xd250('0x96')](_0x26b992)){_0x3f49f9[_0xd250('0x55')][_0xd250('0x97')]({'name':_0x49766d['name'],'contentType':_0x49766d['type'],'data':fs[_0xd250('0x98')](_0x26b992)});}}}emlformat['build'](_0x3f49f9,function(_0x538c54,_0x439464){if(_0x538c54)return _0x10193b(_0x538c54);fs[_0xd250('0x99')](path[_0xd250('0x56')](_0x9b3afe,_0x3cc391),_0x439464);return _0x4edfce(_0x439464);});});}})[_0xd250('0x3b')](function(_0x869aac){if(_0x869aac){return _0x1b2570[_0xd250('0x86')](path[_0xd250('0x56')](_0x9b3afe,_0x3cc391),_0x3cc391,function(_0x5c287a){if(!_0x5c287a)fs['unlinkSync'](path[_0xd250('0x56')](_0x9b3afe,_0x3cc391));});}})[_0xd250('0x1a')](handleError(_0x1b2570,null));}; \ No newline at end of file +var _0x11aa=['headers','readFileSync','download','unlinkSync','eml-format','util','path','lodash','ioredis','html-to-text','../../components/interaction/service','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','undefined','limit','count','offset','status','json','update','stack','name','send','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','includeAll','include','findAll','show','params','options','find','body','describe','create','direction','secret','split','MailAccount','findOne','MailAccountId','CmList','CmContact','updatedAt','Smtp','CloudProvider','getSmtpOptions','attachments','root','basename','List','Contacts','ListId','sendMail','messageId','format','accept','acceptMessage','reject','mail','UserId','user','agent','MailInteraction','MailInteractionId','interaction','get','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','rejectmessage','unix','toString','join','server','tmp','files','message-%s.eml','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ'];(function(_0x231f28,_0x1f199f){var _0x4c1064=function(_0x16d823){while(--_0x16d823){_0x231f28['push'](_0x231f28['shift']());}};_0x4c1064(++_0x1f199f);}(_0x11aa,0x1ab));var _0xa11a=function(_0x18d6b0,_0x3fb3b1){_0x18d6b0=_0x18d6b0-0x0;var _0x33ede0=_0x11aa[_0x18d6b0];return _0x33ede0;};'use strict';var emlformat=require(_0xa11a('0x0'));var moment=require('moment');var util=require(_0xa11a('0x1'));var path=require(_0xa11a('0x2'));var fs=require('fs');var _=require(_0xa11a('0x3'));var Redis=require(_0xa11a('0x4'));var htmlToText=require(_0xa11a('0x5'));var interactionService=require(_0xa11a('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0xa11a('0x7'))('api');var interaction_log=require('../../config/logger')(_0xa11a('0x8'));var config=require(_0xa11a('0x9'));var db=require(_0xa11a('0xa'))['db'];config[_0xa11a('0xb')]=_[_0xa11a('0xc')](config[_0xa11a('0xb')],{'host':_0xa11a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa11a('0xb')]));var htmlEntities=require('html-entities');require(_0xa11a('0xe'))['register'](socket);var jayson=require(_0xa11a('0xf'));var client=jayson[_0xa11a('0x10')][_0xa11a('0x11')]({'port':0x232c});var client9003=jayson[_0xa11a('0x10')][_0xa11a('0x11')]({'port':0x232b});var client9002=jayson[_0xa11a('0x10')][_0xa11a('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x1d15bb,_0xae59be,_0x449c98,_0x1a1dd4){return new Promise(function(_0x5e5dce,_0x4880e8){var _0xa98096=_0x1a1dd4||client;return _0xa98096['request'](_0x1d15bb,_0x449c98)[_0xa11a('0x12')](function(_0x500d7c){logger[_0xa11a('0x13')](_0xa11a('0x14'),_0xae59be,_0xa11a('0x15'));logger[_0xa11a('0x16')](_0xa11a('0x17'),_0xae59be,_0xa11a('0x15'),JSON[_0xa11a('0x18')](_0x500d7c));if(_0x500d7c[_0xa11a('0x19')]){if(_0x500d7c[_0xa11a('0x19')][_0xa11a('0x1a')]===0x1f4){logger[_0xa11a('0x19')](_0xa11a('0x14'),_0xae59be,_0x500d7c[_0xa11a('0x19')]['message']);return _0x4880e8(_0x500d7c[_0xa11a('0x19')][_0xa11a('0x1b')]);}logger[_0xa11a('0x19')](_0xa11a('0x14'),_0xae59be,_0x500d7c[_0xa11a('0x19')]['message']);return _0x5e5dce(_0x500d7c[_0xa11a('0x19')][_0xa11a('0x1b')]);}else{logger[_0xa11a('0x13')](_0xa11a('0x14'),_0xae59be,_0xa11a('0x15'));_0x5e5dce(_0x500d7c[_0xa11a('0x1c')][_0xa11a('0x1b')]);}})[_0xa11a('0x1d')](function(_0x3b37d7){logger['error'](_0xa11a('0x14'),_0xae59be,_0x3b37d7);_0x4880e8(_0x3b37d7);});});}function respondWithResult(_0x48becb,_0x127c60){_0x127c60=_0x127c60||0xc8;return function(_0x2c5ce9){if(_0x2c5ce9){return _0x48becb['status'](_0x127c60)['json'](_0x2c5ce9);}};}function respondWithFilteredResult(_0x52d189,_0x1a40fd){return function(_0xb2aeb){if(_0xb2aeb){var _0x5b21a8=typeof _0x1a40fd['offset']===_0xa11a('0x1e')&&typeof _0x1a40fd[_0xa11a('0x1f')]===_0xa11a('0x1e');var _0x3ada9a=_0xb2aeb[_0xa11a('0x20')];var _0x22cde2=_0x5b21a8?0x0:_0x1a40fd['offset'];var _0x587ba9=_0x5b21a8?_0xb2aeb[_0xa11a('0x20')]:_0x1a40fd[_0xa11a('0x21')]+_0x1a40fd[_0xa11a('0x1f')];var _0x7e72b6;if(_0x587ba9>=_0x3ada9a){_0x587ba9=_0x3ada9a;_0x7e72b6=0xc8;}else{_0x7e72b6=0xce;}_0x52d189[_0xa11a('0x22')](_0x7e72b6);return _0x52d189['set']('Content-Range',_0x22cde2+'-'+_0x587ba9+'/'+_0x3ada9a)[_0xa11a('0x23')](_0xb2aeb);}return null;};}function saveUpdates(_0x13bad4){return function(_0x39b84a){if(_0x39b84a){return _0x39b84a[_0xa11a('0x24')](_0x13bad4)[_0xa11a('0x12')](function(_0x37d508){return _0x37d508;});}return null;};}function removeEntity(_0x3d1614){return function(_0x1e0b90){if(_0x1e0b90){return _0x1e0b90['destroy']()[_0xa11a('0x12')](function(){_0x3d1614[_0xa11a('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x286cea){return function(_0x1821e4){if(!_0x1821e4){_0x286cea['sendStatus'](0x194);}return _0x1821e4;};}function handleError(_0x481f82,_0x1e58f9){_0x1e58f9=_0x1e58f9||0x1f4;return function(_0x55203c){logger['error'](_0x55203c[_0xa11a('0x25')]);if(_0x55203c[_0xa11a('0x26')]){delete _0x55203c[_0xa11a('0x26')];}_0x481f82[_0xa11a('0x22')](_0x1e58f9)[_0xa11a('0x27')](_0x55203c);};}exports['index']=function(_0x211949,_0x50acf1){var _0x5e753b={},_0x47c510={},_0x1591ea={'count':0x0,'rows':[]};var _0x2299f9=_[_0xa11a('0x28')](db[_0xa11a('0x29')][_0xa11a('0x2a')],function(_0x125381){return{'name':_0x125381[_0xa11a('0x2b')],'type':_0x125381[_0xa11a('0x2c')][_0xa11a('0x2d')]};});_0x47c510[_0xa11a('0x2e')]=_[_0xa11a('0x28')](_0x2299f9,'name');_0x47c510[_0xa11a('0x2f')]=_[_0xa11a('0x30')](_0x211949[_0xa11a('0x2f')]);_0x47c510[_0xa11a('0x31')]=_[_0xa11a('0x32')](_0x47c510[_0xa11a('0x2e')],_0x47c510[_0xa11a('0x2f')]);_0x5e753b[_0xa11a('0x33')]=_[_0xa11a('0x32')](_0x47c510[_0xa11a('0x2e')],qs[_0xa11a('0x34')](_0x211949[_0xa11a('0x2f')][_0xa11a('0x34')]));_0x5e753b[_0xa11a('0x33')]=_0x5e753b[_0xa11a('0x33')][_0xa11a('0x35')]?_0x5e753b[_0xa11a('0x33')]:_0x47c510['model'];if(!_0x211949[_0xa11a('0x2f')][_0xa11a('0x36')]('nolimit')){_0x5e753b['limit']=qs[_0xa11a('0x1f')](_0x211949[_0xa11a('0x2f')][_0xa11a('0x1f')]);_0x5e753b[_0xa11a('0x21')]=qs[_0xa11a('0x21')](_0x211949['query'][_0xa11a('0x21')]);}_0x5e753b['order']=qs['sort'](_0x211949[_0xa11a('0x2f')][_0xa11a('0x37')]);_0x5e753b[_0xa11a('0x38')]=qs[_0xa11a('0x31')](_[_0xa11a('0x39')](_0x211949[_0xa11a('0x2f')],_0x47c510[_0xa11a('0x31')]),_0x2299f9);if(_0x211949[_0xa11a('0x2f')]['filter']){_0x5e753b[_0xa11a('0x38')]=_['merge'](_0x5e753b[_0xa11a('0x38')],{'$or':_[_0xa11a('0x28')](_0x2299f9,function(_0x56480a){if(_0x56480a[_0xa11a('0x2c')]!=='VIRTUAL'){var _0x302466={};_0x302466[_0x56480a[_0xa11a('0x26')]]={'$like':'%'+_0x211949[_0xa11a('0x2f')][_0xa11a('0x3a')]+'%'};return _0x302466;}})});}_0x5e753b=_[_0xa11a('0x3b')]({},_0x5e753b,_0x211949['options']);var _0x1b845f={'where':_0x5e753b['where']};return db[_0xa11a('0x29')][_0xa11a('0x20')](_0x1b845f)[_0xa11a('0x12')](function(_0xede8f){_0x1591ea[_0xa11a('0x20')]=_0xede8f;if(_0x211949['query'][_0xa11a('0x3c')]){_0x5e753b[_0xa11a('0x3d')]=[{'all':!![]}];}return db[_0xa11a('0x29')][_0xa11a('0x3e')](_0x5e753b);})['then'](function(_0x3399f3){_0x1591ea['rows']=_0x3399f3;return _0x1591ea;})[_0xa11a('0x12')](respondWithFilteredResult(_0x50acf1,_0x5e753b))[_0xa11a('0x1d')](handleError(_0x50acf1,null));};exports[_0xa11a('0x3f')]=function(_0x5c752e,_0x543d19){var _0x346fc3={'raw':!![],'where':{'id':_0x5c752e[_0xa11a('0x40')]['id']}},_0x286850={};_0x286850['model']=_[_0xa11a('0x30')](db['MailMessage'][_0xa11a('0x2a')]);_0x286850['query']=_['keys'](_0x5c752e[_0xa11a('0x2f')]);_0x286850[_0xa11a('0x31')]=_[_0xa11a('0x32')](_0x286850[_0xa11a('0x2e')],_0x286850[_0xa11a('0x2f')]);_0x346fc3[_0xa11a('0x33')]=_[_0xa11a('0x32')](_0x286850[_0xa11a('0x2e')],qs[_0xa11a('0x34')](_0x5c752e['query']['fields']));_0x346fc3[_0xa11a('0x33')]=_0x346fc3[_0xa11a('0x33')][_0xa11a('0x35')]?_0x346fc3[_0xa11a('0x33')]:_0x286850[_0xa11a('0x2e')];if(_0x5c752e[_0xa11a('0x2f')][_0xa11a('0x3c')]){_0x346fc3[_0xa11a('0x3d')]=[{'all':!![]}];}_0x346fc3=_['merge']({},_0x346fc3,_0x5c752e[_0xa11a('0x41')]);return db[_0xa11a('0x29')][_0xa11a('0x42')](_0x346fc3)['then'](handleEntityNotFound(_0x543d19,null))['then'](respondWithResult(_0x543d19,null))['catch'](handleError(_0x543d19,null));};exports[_0xa11a('0x24')]=function(_0xcde3bf,_0x3c02b4){if(_0xcde3bf[_0xa11a('0x43')]['id']){delete _0xcde3bf[_0xa11a('0x43')]['id'];}return db[_0xa11a('0x29')][_0xa11a('0x42')]({'where':{'id':_0xcde3bf[_0xa11a('0x40')]['id']}})[_0xa11a('0x12')](handleEntityNotFound(_0x3c02b4,null))['then'](saveUpdates(_0xcde3bf[_0xa11a('0x43')],null))['then'](respondWithResult(_0x3c02b4,null))['catch'](handleError(_0x3c02b4,null));};exports['destroy']=function(_0x57f505,_0x418521){return db[_0xa11a('0x29')]['find']({'where':{'id':_0x57f505[_0xa11a('0x40')]['id']}})['then'](handleEntityNotFound(_0x418521,null))[_0xa11a('0x12')](removeEntity(_0x418521,null))[_0xa11a('0x1d')](handleError(_0x418521,null));};exports[_0xa11a('0x44')]=function(_0x2a098a,_0x5bc794){return db[_0xa11a('0x29')]['describe']()[_0xa11a('0x12')](respondWithResult(_0x5bc794,null))[_0xa11a('0x1d')](handleError(_0x5bc794,null));};exports[_0xa11a('0x45')]=function(_0x4c0a16,_0x2423a1){return db['MailMessage'][_0xa11a('0x45')](_0x4c0a16[_0xa11a('0x43')])[_0xa11a('0x12')](function(_0xb810d){if(_0xb810d){if(_0xb810d[_0xa11a('0x46')]==='out'&&!_0xb810d[_0xa11a('0x47')]){var _0x1a02aa,_0x28e845,_0x4f4643;if(_0x4c0a16[_0xa11a('0x43')]['to']){_0x28e845=_0x4c0a16[_0xa11a('0x43')]['to'][_0xa11a('0x48')](',')[0x0];}return db[_0xa11a('0x49')][_0xa11a('0x4a')]({'where':{'id':_0xb810d[_0xa11a('0x4b')]},'include':[{'model':db[_0xa11a('0x4c')],'as':'List','include':[{'model':db[_0xa11a('0x4d')],'as':'Contacts','where':{'email':_0x28e845},'limit':0x1,'order':[[_0xa11a('0x4e'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0xa11a('0x4f'),'raw':!![],'include':[{'model':db[_0xa11a('0x50')],'as':_0xa11a('0x50'),'raw':!![]}]}]})[_0xa11a('0x12')](function(_0x4d55f3){_0x1a02aa=_0x4d55f3;if(!_0x1a02aa||!_0x1a02aa[_0xa11a('0x4f')])return;var _0x1cd12e=_0x1a02aa[_0xa11a('0x51')]();if(_0x4c0a16[_0xa11a('0x43')][_0xa11a('0x52')]&&_0x4c0a16[_0xa11a('0x43')][_0xa11a('0x52')][_0xa11a('0x35')]){for(var _0xdfcf97=0x0;_0xdfcf97<_0x4c0a16[_0xa11a('0x43')][_0xa11a('0x52')][_0xa11a('0x35')];_0xdfcf97+=0x1){_0x4c0a16[_0xa11a('0x43')][_0xa11a('0x52')][_0xdfcf97]={'filename':_0x4c0a16[_0xa11a('0x43')][_0xa11a('0x52')][_0xdfcf97]['name'],'path':path['join'](config[_0xa11a('0x53')],'server/files/attachments',_0x4c0a16[_0xa11a('0x43')][_0xa11a('0x52')][_0xdfcf97][_0xa11a('0x54')])};}}_0x4f4643={'account':_0x1cd12e,'message':_0x4c0a16[_0xa11a('0x43')]};return;})['then'](function(){if(_0x1a02aa[_0xa11a('0x55')]){if(_0x1a02aa[_0xa11a('0x55')]['Contacts']['length']){return _0x1a02aa[_0xa11a('0x55')][_0xa11a('0x56')][0x0];}else{return db[_0xa11a('0x4d')]['create'](_[_0xa11a('0xc')](_0x4c0a16['body'],{'firstName':_0x4c0a16[_0xa11a('0x43')]['to'],'email':_0x4c0a16[_0xa11a('0x43')]['to'],'phone':_0x4c0a16['body']['to'],'ListId':_0x1a02aa[_0xa11a('0x57')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x4f4643){return respondWithRpcPromise('SendMail',_0xa11a('0x58'),_0x4f4643,client9003)[_0xa11a('0x12')](function(_0x3a82ac){return _0xb810d[_0xa11a('0x24')]({'read':!![],'messageId':_0x3a82ac[_0xa11a('0x59')],'sentAt':moment()[_0xa11a('0x5a')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xa11a('0x1d')](function(_0x1ad32d){logger[_0xa11a('0x19')]('%s',JSON[_0xa11a('0x18')](_0x1ad32d));return _0xb810d;});}return _0xb810d;});}return _0xb810d;}})[_0xa11a('0x12')](respondWithResult(_0x2423a1,0xc9))['catch'](handleError(_0x2423a1,null));};exports[_0xa11a('0x5b')]=function(_0x4ba587,_0x82d754){var _0x5ab7f8='mail';return interactionService[_0xa11a('0x5c')](_0x4ba587,_0x5ab7f8)[_0xa11a('0x12')](respondWithResult(_0x82d754,null))[_0xa11a('0x1d')](handleError(_0x82d754,null));};exports[_0xa11a('0x5d')]=function(_0x33d6b2,_0x366afe){var _0x1565e4={'agent':{},'channel':_0xa11a('0x5e')};if(_0x33d6b2[_0xa11a('0x43')]['id']){delete _0x33d6b2[_0xa11a('0x43')]['id'];}_0x33d6b2[_0xa11a('0x43')][_0xa11a('0x5f')]=_0x33d6b2[_0xa11a('0x43')][_0xa11a('0x5f')]||_0x33d6b2[_0xa11a('0x60')]['id'];_0x1565e4[_0xa11a('0x61')]['id']=_0x33d6b2['body'][_0xa11a('0x5f')];return db[_0xa11a('0x29')][_0xa11a('0x42')]({'where':{'id':_0x33d6b2[_0xa11a('0x40')]['id'],'UserId':null}})[_0xa11a('0x12')](handleEntityNotFound(_0x366afe,null))[_0xa11a('0x12')](function(_0x13507b){if(_0x13507b){_0x1565e4[_0xa11a('0x1b')]=_0x13507b['get']({'plain':!![]});return db[_0xa11a('0x62')][_0xa11a('0x42')]({'where':{'id':_0x13507b[_0xa11a('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x366afe,null))['then'](function(_0x3eb448){if(_0x3eb448){_0x1565e4[_0xa11a('0x64')]=_0x3eb448[_0xa11a('0x65')]({'plain':!![]});interaction_log[_0xa11a('0x13')](_0xa11a('0x66'),_0x33d6b2[_0xa11a('0x60')]['id'],_0x33d6b2['user']['name'],_0x33d6b2[_0xa11a('0x60')][_0xa11a('0x67')],_0x1565e4[_0xa11a('0x64')]['id'],_0x33d6b2['body']?JSON[_0xa11a('0x18')](_0x33d6b2['body']):_0xa11a('0x68'));return respondWithRpcPromise(_0xa11a('0x69'),'rejectMessage',_0x1565e4);}return null;})[_0xa11a('0x12')](function(_0x469dc7){var _0xe1a612=_0xa11a('0x6a')+_0x469dc7['message'][_0xa11a('0x6b')];return db['sequelize'][_0xa11a('0x2f')](_0xe1a612,{'type':db[_0xa11a('0x6c')][_0xa11a('0x6d')][_0xa11a('0x6e')],'raw':!![]})['then'](function(_0x3255d4){return _0x3255d4;});})[_0xa11a('0x12')](function(_0x58baed){if(_0x58baed){_0x1565e4[_0xa11a('0x1b')][_0xa11a('0x6f')]=_0x58baed[0x0];if(!_0x33d6b2['body']['UserId'])return;return db[_0xa11a('0x70')][_0xa11a('0x42')]({'where':{'id':_0x33d6b2['body'][_0xa11a('0x5f')],'role':'agent'},'attributes':['id',_0xa11a('0x26'),_0xa11a('0x71'),_0xa11a('0x72'),_0xa11a('0x73')],'raw':!![]});}return null;})['then'](function(_0x2f4298){if(!_0x2f4298)return null;_0x1565e4[_0xa11a('0x1b')]['agent']=_0x2f4298;return _0x1565e4;})[_0xa11a('0x12')](function(_0x1350cd){if(_0x1350cd){_0x1350cd[_0xa11a('0x1b')][_0xa11a('0x74')]=util[_0xa11a('0x5a')](_0xa11a('0x75'),_0x33d6b2[_0xa11a('0x60')][_0xa11a('0x26')]);_0x1350cd[_0xa11a('0x1b')][_0xa11a('0x76')]=_0x1565e4[_0xa11a('0x76')];_0x1350cd[_0xa11a('0x1b')][_0xa11a('0x77')]=_0x1565e4[_0xa11a('0x76')];_0x1350cd[_0xa11a('0x1b')][_0xa11a('0x78')]=_0xa11a('0x5d');_0x1350cd[_0xa11a('0x1b')]['body']=htmlToText[_0xa11a('0x79')](_0x1565e4[_0xa11a('0x1b')][_0xa11a('0x43')]);respondWithRpcPromise(_0xa11a('0x7a'),_0xa11a('0x7a'),{'event':_0xa11a('0x7b'),'message':_0x1350cd[_0xa11a('0x1b')]},client9002);return _0x1565e4;}return null;})[_0xa11a('0x12')](respondWithResult(_0x366afe,null))['catch'](handleError(_0x366afe,null));};exports['download']=function(_0x12b77,_0x4e71a3){var _0x27ba2c=moment()[_0xa11a('0x7c')]()[_0xa11a('0x7d')]();var _0x1f6ecb=path[_0xa11a('0x7e')](config['root'],_0xa11a('0x7f'),'files',_0xa11a('0x80'));var _0x27db6e=path[_0xa11a('0x7e')](config[_0xa11a('0x53')],_0xa11a('0x7f'),_0xa11a('0x81'),_0xa11a('0x52'));var _0x399946=util[_0xa11a('0x5a')](_0xa11a('0x82'),_0x27ba2c);return db['MailMessage']['find']({'where':{'id':_0x12b77['params']['id']},'attributes':['id',_0xa11a('0x43'),'from','to','cc',_0xa11a('0x83'),_0xa11a('0x84'),_0xa11a('0x85')],'include':_0x12b77[_0xa11a('0x2f')][_0xa11a('0x52')]?[{'model':db[_0xa11a('0x86')],'as':_0xa11a('0x87')}]:undefined})[_0xa11a('0x12')](handleEntityNotFound(_0x4e71a3,null))['then'](function(_0x1d3374){if(_0x1d3374){var _0x2738f5=_0x1d3374;var _0x425a8b={'from':_0x2738f5['from'],'to':_0x2738f5['to'],'subject':_0x2738f5[_0xa11a('0x84')],'html':htmlEntities['decode'](_0x2738f5[_0xa11a('0x43')]),'headers':{'Date':moment(_0x2738f5[_0xa11a('0x85')])['format'](_0xa11a('0x88'))},'attachments':[]};if(_0x1d3374['cc']){_0x425a8b[_0xa11a('0x89')]['Cc']=_0x1d3374['cc'];}if(_0x1d3374[_0xa11a('0x83')]){_0x425a8b[_0xa11a('0x89')]['Bcc']=_0x1d3374[_0xa11a('0x83')];}return new Promise(function(_0x3ce5d7,_0xb9c026){if(_0x1d3374[_0xa11a('0x87')]){for(var _0x47511b=0x0;_0x47511b<_0x1d3374[_0xa11a('0x87')][_0xa11a('0x35')];_0x47511b++){var _0x3f80a9=_0x1d3374['Attachments'][_0x47511b];var _0x21bdfd=path[_0xa11a('0x7e')](_0x27db6e,_0x3f80a9[_0xa11a('0x54')]);if(fs['existsSync'](_0x21bdfd)){_0x425a8b['attachments']['push']({'name':_0x3f80a9[_0xa11a('0x26')],'contentType':_0x3f80a9['type'],'data':fs[_0xa11a('0x8a')](_0x21bdfd)});}}}emlformat['build'](_0x425a8b,function(_0x509619,_0x3c9925){if(_0x509619)return _0xb9c026(_0x509619);fs['writeFileSync'](path[_0xa11a('0x7e')](_0x1f6ecb,_0x399946),_0x3c9925);return _0x3ce5d7(_0x3c9925);});});}})[_0xa11a('0x12')](function(_0x1d3da7){if(_0x1d3da7){return _0x4e71a3[_0xa11a('0x8b')](path['join'](_0x1f6ecb,_0x399946),_0x399946,function(_0x40aca1){if(!_0x40aca1)fs[_0xa11a('0x8c')](path[_0xa11a('0x7e')](_0x1f6ecb,_0x399946));});}})[_0xa11a('0x1d')](handleError(_0x4e71a3,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 13a0bca..179db8a 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 _0xc816=['hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','emit'];(function(_0x42b463,_0x557de1){var _0x3a675e=function(_0x29f0ef){while(--_0x29f0ef){_0x42b463['push'](_0x42b463['shift']());}};_0x3a675e(++_0x557de1);}(_0xc816,0x1c5));var _0x6c81=function(_0x10df8d,_0x561555){_0x10df8d=_0x10df8d-0x0;var _0x1c8057=_0xc816[_0x10df8d];return _0x1c8057;};'use strict';var EventEmitter=require(_0x6c81('0x0'));var MailMessage=require(_0x6c81('0x1'))['db'][_0x6c81('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x6c81('0x3')](0x0);var events={'afterCreate':_0x6c81('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x41bad5){return function(_0x37b82b,_0x4b4132,_0xab3b08){MailMessageEvents[_0x6c81('0x5')](_0x41bad5+':'+_0x37b82b['id'],_0x37b82b);MailMessageEvents[_0x6c81('0x5')](_0x41bad5,_0x37b82b);_0xab3b08(null);};}for(var e in events){if(events[_0x6c81('0x6')](e)){var event=events[e];MailMessage[_0x6c81('0x7')](e,emitEvent(event));}}module[_0x6c81('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x5c8e=['update','remove','emit','hook','../../mysqldb','MailMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c8e,0xfa));var _0xe5c8=function(_0x43a2fe,_0x20327f){_0x43a2fe=_0x43a2fe-0x0;var _0x22d250=_0x5c8e[_0x43a2fe];return _0x22d250;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xe5c8('0x0'))['db'][_0xe5c8('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe5c8('0x2'),'afterDestroy':_0xe5c8('0x3')};function emitEvent(_0x194858){return function(_0x3c176a,_0x5d7e1c,_0x33d630){MailMessageEvents[_0xe5c8('0x4')](_0x194858+':'+_0x3c176a['id'],_0x3c176a);MailMessageEvents['emit'](_0x194858,_0x3c176a);_0x33d630(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xe5c8('0x5')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 0b43b47..0b14736 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 _0x7ce2=['util','../../config/logger','api','moment','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','subject','body','get','toLowerCase','direction','out','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','catch','utf8mb4','utf8mb4_unicode_ci'];(function(_0x12004e,_0x78a266){var _0x52a494=function(_0x250530){while(--_0x250530){_0x12004e['push'](_0x12004e['shift']());}};_0x52a494(++_0x78a266);}(_0x7ce2,0x1c0));var _0x27ce=function(_0x38cbcb,_0x3cd0c2){_0x38cbcb=_0x38cbcb-0x0;var _0x2b30bb=_0x7ce2[_0x38cbcb];return _0x2b30bb;};'use strict';var _=require('lodash');var util=require(_0x27ce('0x0'));var logger=require(_0x27ce('0x1'))(_0x27ce('0x2'));var moment=require(_0x27ce('0x3'));var BPromise=require(_0x27ce('0x4'));var rp=require('request-promise');var htmlToText=require(_0x27ce('0x5'));var fs=require('fs');var path=require(_0x27ce('0x6'));var rimraf=require(_0x27ce('0x7'));var config=require(_0x27ce('0x8'));var attributes=require(_0x27ce('0x9'));module[_0x27ce('0xa')]=function(_0x2b6af7,_0x2a8ae8){return _0x2b6af7[_0x27ce('0xb')](_0x27ce('0xc'),attributes,{'tableName':_0x27ce('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x27ce('0xe')]},{'name':'fti_mail_messages','fields':[_0x27ce('0xf'),_0x27ce('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x35255d,_0x5c2dca,_0x358e15){if(_0x35255d['body']){_0x35255d[_0x27ce('0xf')]=htmlToText['fromString'](_0x35255d[_0x27ce('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x358e15(null,_0x5c2dca);},'afterCreate':function(_0x2c8bc8,_0x44f9c9,_0x3f1da5){var _0x55dcbc=_0x2b6af7['models'];var _0x2bb0f4=_0x2c8bc8[_0x27ce('0x12')]({'plain':!![]});if(_0x2bb0f4['direction'][_0x27ce('0x13')]()==='in'||_0x2bb0f4[_0x27ce('0x14')][_0x27ce('0x13')]()===_0x27ce('0x15')&&!_0x2bb0f4['secret']&&!_[_0x27ce('0x16')](_0x2bb0f4[_0x27ce('0x17')])){_0x55dcbc[_0x27ce('0x18')][_0x27ce('0x19')]({'where':{'id':_0x2bb0f4[_0x27ce('0x1a')]}})[_0x27ce('0x1b')](function(_0x2c8fad){if(_0x2c8fad){_0x2c8fad['update']({'lastMsgAt':_0x2bb0f4[_0x27ce('0x1c')],'lastMsgDirection':_0x2bb0f4[_0x27ce('0x14')][_0x27ce('0x13')]()});}})[_0x27ce('0x1d')](function(_0x4600ec){console['error'](_0x4600ec);});}_0x3f1da5();}},'charset':_0x27ce('0x1e'),'collate':_0x27ce('0x1f')});}; \ No newline at end of file +var _0x1f7e=['FULLTEXT','body','fromString','models','get','direction','toLowerCase','isNil','UserId','MailInteraction','MailInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise','rimraf','./mailMessage.attributes','exports','define','messageId','fti_mail_messages','plainBody','subject'];(function(_0x3ab1f8,_0x139b8b){var _0x37ace3=function(_0x265830){while(--_0x265830){_0x3ab1f8['push'](_0x3ab1f8['shift']());}};_0x37ace3(++_0x139b8b);}(_0x1f7e,0x1a7));var _0xe1f7=function(_0x21b0de,_0x4720ae){_0x21b0de=_0x21b0de-0x0;var _0x8aed7e=_0x1f7e[_0x21b0de];return _0x8aed7e;};'use strict';var _=require('lodash');var util=require(_0xe1f7('0x0'));var logger=require(_0xe1f7('0x1'))('api');var moment=require(_0xe1f7('0x2'));var BPromise=require('bluebird');var rp=require(_0xe1f7('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0xe1f7('0x4'));var config=require('../../config/environment');var attributes=require(_0xe1f7('0x5'));module[_0xe1f7('0x6')]=function(_0x1a05d5,_0x406e73){return _0x1a05d5[_0xe1f7('0x7')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xe1f7('0x8'),'fields':[_0xe1f7('0x8')]},{'name':_0xe1f7('0x9'),'fields':[_0xe1f7('0xa'),_0xe1f7('0xb')],'type':_0xe1f7('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x362a62,_0xcd3c3f,_0xf73c0c){if(_0x362a62[_0xe1f7('0xd')]){_0x362a62['plainBody']=htmlToText[_0xe1f7('0xe')](_0x362a62[_0xe1f7('0xd')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xf73c0c(null,_0xcd3c3f);},'afterCreate':function(_0x239159,_0x23de46,_0x283375){var _0x251fe9=_0x1a05d5[_0xe1f7('0xf')];var _0x24c575=_0x239159[_0xe1f7('0x10')]({'plain':!![]});if(_0x24c575[_0xe1f7('0x11')][_0xe1f7('0x12')]()==='in'||_0x24c575['direction'][_0xe1f7('0x12')]()==='out'&&!_0x24c575['secret']&&!_[_0xe1f7('0x13')](_0x24c575[_0xe1f7('0x14')])){_0x251fe9[_0xe1f7('0x15')]['findOne']({'where':{'id':_0x24c575[_0xe1f7('0x16')]}})['then'](function(_0xf814c6){if(_0xf814c6){_0xf814c6[_0xe1f7('0x17')]({'lastMsgAt':_0x24c575[_0xe1f7('0x18')],'lastMsgDirection':_0x24c575['direction'][_0xe1f7('0x12')]()});}})[_0xe1f7('0x19')](function(_0x3d4f75){console[_0xe1f7('0x1a')](_0x3d4f75);});}_0x283375();}},'charset':_0xe1f7('0x1b'),'collate':_0xe1f7('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index a05b005..8dc1b43 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 _0x93e9=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','info','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','then','debug'];(function(_0x1443d6,_0x476eb6){var _0x42dece=function(_0x4d3380){while(--_0x4d3380){_0x1443d6['push'](_0x1443d6['shift']());}};_0x42dece(++_0x476eb6);}(_0x93e9,0xcc));var _0x993e=function(_0x54b41e,_0x52bae1){_0x54b41e=_0x54b41e-0x0;var _0x3ac113=_0x93e9[_0x54b41e];return _0x3ac113;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var moment=require(_0x993e('0x2'));var BPromise=require(_0x993e('0x3'));var rs=require(_0x993e('0x4'));var fs=require('fs');var Redis=require(_0x993e('0x5'));var db=require(_0x993e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x993e('0x7'));var config=require(_0x993e('0x8'));var jayson=require(_0x993e('0x9'));var client=jayson[_0x993e('0xa')][_0x993e('0xb')]({'port':0x232a});config[_0x993e('0xc')]=_[_0x993e('0xd')](config[_0x993e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x993e('0xe'))(new Redis(config[_0x993e('0xc')]));require(_0x993e('0xf'))[_0x993e('0x10')](socket);function respondWithRpcPromise(_0x2cd389,_0x27a28f,_0x1c2324){return new BPromise(function(_0x48291a,_0x196f6d){return client[_0x993e('0x11')](_0x2cd389,_0x1c2324)['then'](function(_0x5ebc8c){logger[_0x993e('0x12')]('MailMessage,\x20%s,\x20%s',_0x27a28f,_0x993e('0x13'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x27a28f,_0x993e('0x13'),JSON[_0x993e('0x14')](_0x5ebc8c));if(_0x5ebc8c[_0x993e('0x15')]){if(_0x5ebc8c[_0x993e('0x15')][_0x993e('0x16')]===0x1f4){logger[_0x993e('0x15')](_0x993e('0x17'),_0x27a28f,_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);return _0x196f6d(_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);}logger[_0x993e('0x15')](_0x993e('0x17'),_0x27a28f,_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);return _0x48291a(_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);}else{logger['info'](_0x993e('0x17'),_0x27a28f,_0x993e('0x13'));_0x48291a(_0x5ebc8c[_0x993e('0x19')][_0x993e('0x18')]);}})[_0x993e('0x1a')](function(_0x3eda77){logger['error'](_0x993e('0x17'),_0x27a28f,_0x3eda77);_0x196f6d(_0x3eda77);});});}exports[_0x993e('0x1b')]=function(_0x1eaf57){var _0x22390e=this;return new Promise(function(_0x130a8a,_0x425ab4){return db[_0x993e('0x1c')][_0x993e('0x1d')](_0x1eaf57['body'],{'raw':_0x1eaf57[_0x993e('0x1e')]?_0x1eaf57['options'][_0x993e('0x1f')]===undefined?!![]:![]:!![]})[_0x993e('0x20')](function(_0x32b09e){logger['info'](_0x993e('0x1b'),_0x1eaf57);logger[_0x993e('0x21')](_0x993e('0x1b'),_0x1eaf57,JSON[_0x993e('0x14')](_0x32b09e));_0x130a8a(_0x32b09e);})[_0x993e('0x1a')](function(_0x328d22){logger[_0x993e('0x15')](_0x993e('0x1b'),_0x328d22[_0x993e('0x18')],_0x1eaf57);_0x425ab4(_0x22390e[_0x993e('0x15')](0x1f4,_0x328d22[_0x993e('0x18')]));});});}; \ No newline at end of file +var _0x430c=['ioredis','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','MailMessage','body','raw','CreateMailMessage','lodash','bluebird','randomstring'];(function(_0x2eb57e,_0x1a638e){var _0x284e5d=function(_0x52ff9a){while(--_0x52ff9a){_0x2eb57e['push'](_0x2eb57e['shift']());}};_0x284e5d(++_0x1a638e);}(_0x430c,0x1a1));var _0xc430=function(_0x545bed,_0x221e96){_0x545bed=_0x545bed-0x0;var _0x16c79c=_0x430c[_0x545bed];return _0x16c79c;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc430('0x1'));var rs=require(_0xc430('0x2'));var fs=require('fs');var Redis=require(_0xc430('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc430('0x4'));var jayson=require(_0xc430('0x5'));var client=jayson['client'][_0xc430('0x6')]({'port':0x232a});config['redis']=_[_0xc430('0x7')](config[_0xc430('0x8')],{'host':_0xc430('0x9'),'port':0x18eb});var socket=require(_0xc430('0xa'))(new Redis(config[_0xc430('0x8')]));require(_0xc430('0xb'))[_0xc430('0xc')](socket);function respondWithRpcPromise(_0x115814,_0x24737a,_0x5bbdf9){return new BPromise(function(_0x97fa5b,_0x2b47d6){return client['request'](_0x115814,_0x5bbdf9)[_0xc430('0xd')](function(_0x5aeed9){logger[_0xc430('0xe')]('MailMessage,\x20%s,\x20%s',_0x24737a,_0xc430('0xf'));logger[_0xc430('0x10')](_0xc430('0x11'),_0x24737a,_0xc430('0xf'),JSON[_0xc430('0x12')](_0x5aeed9));if(_0x5aeed9[_0xc430('0x13')]){if(_0x5aeed9[_0xc430('0x13')]['code']===0x1f4){logger['error'](_0xc430('0x14'),_0x24737a,_0x5aeed9[_0xc430('0x13')][_0xc430('0x15')]);return _0x2b47d6(_0x5aeed9[_0xc430('0x13')][_0xc430('0x15')]);}logger['error'](_0xc430('0x14'),_0x24737a,_0x5aeed9['error']['message']);return _0x97fa5b(_0x5aeed9[_0xc430('0x13')][_0xc430('0x15')]);}else{logger[_0xc430('0xe')]('MailMessage,\x20%s,\x20%s',_0x24737a,'request\x20sent');_0x97fa5b(_0x5aeed9[_0xc430('0x16')]['message']);}})[_0xc430('0x17')](function(_0x4f7094){logger['error'](_0xc430('0x14'),_0x24737a,_0x4f7094);_0x2b47d6(_0x4f7094);});});}exports['CreateMailMessage']=function(_0x302926){var _0x1eae3b=this;return new Promise(function(_0x3eb888,_0x1f90bb){return db[_0xc430('0x18')]['create'](_0x302926[_0xc430('0x19')],{'raw':_0x302926['options']?_0x302926['options'][_0xc430('0x1a')]===undefined?!![]:![]:!![]})[_0xc430('0xd')](function(_0x3c7afa){logger['info'](_0xc430('0x1b'),_0x302926);logger['debug'](_0xc430('0x1b'),_0x302926,JSON[_0xc430('0x12')](_0x3c7afa));_0x3eb888(_0x3c7afa);})['catch'](function(_0x31b4f1){logger[_0xc430('0x13')]('CreateMailMessage',_0x31b4f1[_0xc430('0x15')],_0x302926);_0x1f90bb(_0x1eae3b['error'](0x1f4,_0x31b4f1[_0xc430('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 64e3554..bd43705 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 _0x64d0=['update','removeListener','register','mailMessage:','./mailMessage.events','save','remove'];(function(_0x406fca,_0x4aa0b4){var _0x501463=function(_0x414435){while(--_0x414435){_0x406fca['push'](_0x406fca['shift']());}};_0x501463(++_0x4aa0b4);}(_0x64d0,0xf2));var _0x064d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64d0[_0x3dd15e];return _0x231fd0;};'use strict';var MailMessageEvents=require(_0x064d('0x0'));var events=[_0x064d('0x1'),_0x064d('0x2'),_0x064d('0x3')];function createListener(_0x5d3e7b,_0xa08c99){return function(_0x960eed){_0xa08c99['emit'](_0x5d3e7b,_0x960eed);};}function removeListener(_0x14acb1,_0x56f423){return function(){MailMessageEvents[_0x064d('0x4')](_0x14acb1,_0x56f423);};}exports[_0x064d('0x5')]=function(_0x1c2b61){for(var _0x1ec37b=0x0,_0x55d1e9=events['length'];_0x1ec37b<_0x55d1e9;_0x1ec37b++){var _0x51bcc4=events[_0x1ec37b];var _0x350771=createListener(_0x064d('0x6')+_0x51bcc4,_0x1c2b61);MailMessageEvents['on'](_0x51bcc4,_0x350771);}}; \ No newline at end of file +var _0xc44d=['./mailMessage.events','remove','update','emit','register','mailMessage:'];(function(_0x2f3ecd,_0x57976b){var _0xffdc44=function(_0xf21bc6){while(--_0xf21bc6){_0x2f3ecd['push'](_0x2f3ecd['shift']());}};_0xffdc44(++_0x57976b);}(_0xc44d,0xc6));var _0xdc44=function(_0xbb321,_0x5e65e2){_0xbb321=_0xbb321-0x0;var _0x5479b2=_0xc44d[_0xbb321];return _0x5479b2;};'use strict';var MailMessageEvents=require(_0xdc44('0x0'));var events=['save',_0xdc44('0x1'),_0xdc44('0x2')];function createListener(_0x1105d7,_0x5be53a){return function(_0x380401){_0x5be53a[_0xdc44('0x3')](_0x1105d7,_0x380401);};}function removeListener(_0x226526,_0x2f46b2){return function(){MailMessageEvents['removeListener'](_0x226526,_0x2f46b2);};}exports[_0xdc44('0x4')]=function(_0x5cbb51){for(var _0x36a987=0x0,_0x4eca1a=events['length'];_0x36a987<_0x4eca1a;_0x36a987++){var _0x5447d1=events[_0x36a987];var _0x58dc89=createListener(_0xdc44('0x5')+_0x5447d1,_0x5cbb51);MailMessageEvents['on'](_0x5447d1,_0x58dc89);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 2e8fb12..c7b22c2 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 _0x0539=['put','delete','destroy','removeTeams','/:id/users','removeAgents','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','addTeams','addAgents'];(function(_0x8cb2f9,_0x2b8706){var _0x164887=function(_0x1812cc){while(--_0x1812cc){_0x8cb2f9['push'](_0x8cb2f9['shift']());}};_0x164887(++_0x2b8706);}(_0x0539,0x165));var _0x9053=function(_0x7379d1,_0x17c2bb){_0x7379d1=_0x7379d1-0x0;var _0x4e8d88=_0x0539[_0x7379d1];return _0x4e8d88;};'use strict';var multer=require(_0x9053('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9053('0x1'));var express=require(_0x9053('0x2'));var router=express['Router']();var fs_extra=require(_0x9053('0x3'));var auth=require(_0x9053('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9053('0x5'));var controller=require('./mailQueue.controller');router[_0x9053('0x6')]('/',auth[_0x9053('0x7')](),controller[_0x9053('0x8')]);router[_0x9053('0x6')](_0x9053('0x9'),auth['isAuthenticated'](),controller[_0x9053('0xa')]);router[_0x9053('0x6')](_0x9053('0xb'),auth['isAuthenticated'](),controller[_0x9053('0xc')]);router[_0x9053('0x6')](_0x9053('0xd'),auth['isAuthenticated'](),controller[_0x9053('0xe')]);router['get'](_0x9053('0xf'),auth[_0x9053('0x7')](),controller['getTeams']);router[_0x9053('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0x9053('0x10')]);router[_0x9053('0x11')]('/',auth['isAuthenticated'](),controller[_0x9053('0x12')]);router[_0x9053('0x11')](_0x9053('0xf'),auth[_0x9053('0x7')](),controller[_0x9053('0x13')]);router[_0x9053('0x11')]('/:id/users',auth[_0x9053('0x7')](),controller[_0x9053('0x14')]);router[_0x9053('0x15')](_0x9053('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x9053('0x16')]('/:id',auth[_0x9053('0x7')](),controller[_0x9053('0x17')]);router[_0x9053('0x16')]('/:id/teams',auth[_0x9053('0x7')](),controller[_0x9053('0x18')]);router[_0x9053('0x16')](_0x9053('0x19'),auth[_0x9053('0x7')](),controller[_0x9053('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xbd70=['connect-timeout','Router','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','destroy','delete','removeTeams','removeAgents','exports','multer','path'];(function(_0x31c922,_0x27daee){var _0x576754=function(_0x2e38c9){while(--_0x2e38c9){_0x31c922['push'](_0x31c922['shift']());}};_0x576754(++_0x27daee);}(_0xbd70,0x1eb));var _0x0bd7=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xbd70[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x0bd7('0x0'));var util=require('util');var path=require(_0x0bd7('0x1'));var timeout=require(_0x0bd7('0x2'));var express=require('express');var router=express[_0x0bd7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0bd7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0bd7('0x5'));var controller=require(_0x0bd7('0x6'));router[_0x0bd7('0x7')]('/',auth[_0x0bd7('0x8')](),controller[_0x0bd7('0x9')]);router[_0x0bd7('0x7')](_0x0bd7('0xa'),auth[_0x0bd7('0x8')](),controller[_0x0bd7('0xb')]);router[_0x0bd7('0x7')](_0x0bd7('0xc'),auth['isAuthenticated'](),controller[_0x0bd7('0xd')]);router['get'](_0x0bd7('0xe'),auth[_0x0bd7('0x8')](),controller['getMembers']);router['get'](_0x0bd7('0xf'),auth[_0x0bd7('0x8')](),controller[_0x0bd7('0x10')]);router[_0x0bd7('0x7')](_0x0bd7('0x11'),auth[_0x0bd7('0x8')](),controller[_0x0bd7('0x12')]);router[_0x0bd7('0x13')]('/',auth[_0x0bd7('0x8')](),controller[_0x0bd7('0x14')]);router['post'](_0x0bd7('0xf'),auth['isAuthenticated'](),controller[_0x0bd7('0x15')]);router['post'](_0x0bd7('0x11'),auth['isAuthenticated'](),controller[_0x0bd7('0x16')]);router[_0x0bd7('0x17')](_0x0bd7('0xc'),auth[_0x0bd7('0x8')](),controller['update']);router['delete'](_0x0bd7('0xc'),auth[_0x0bd7('0x8')](),controller[_0x0bd7('0x18')]);router[_0x0bd7('0x19')](_0x0bd7('0xf'),auth[_0x0bd7('0x8')](),controller[_0x0bd7('0x1a')]);router[_0x0bd7('0x19')](_0x0bd7('0x11'),auth[_0x0bd7('0x8')](),controller[_0x0bd7('0x1b')]);module[_0x0bd7('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index aad7a87..815625a 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 _0xad6d=['name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x4480e3,_0x52796f){var _0x2c8327=function(_0x1fc5de){while(--_0x1fc5de){_0x4480e3['push'](_0x4480e3['shift']());}};_0x2c8327(++_0x52796f);}(_0xad6d,0x130));var _0xdad6=function(_0x13207d,_0x1b7196){_0x13207d=_0x13207d-0x0;var _0x343a10=_0xad6d[_0x13207d];return _0x343a10;};'use strict';var Sequelize=require(_0xdad6('0x0'));module[_0xdad6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xdad6('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdad6('0x3')]},'timeout':{'type':Sequelize[_0xdad6('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdad6('0x5')](_0xdad6('0x6'),_0xdad6('0x7'),_0xdad6('0x8'))}}; \ No newline at end of file +var _0xc430=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x3d630b,_0x48e393){var _0x272b0c=function(_0x5df058){while(--_0x5df058){_0x3d630b['push'](_0x3d630b['shift']());}};_0x272b0c(++_0x48e393);}(_0xc430,0x1e6));var _0x0c43=function(_0x161b34,_0x260362){_0x161b34=_0x161b34-0x0;var _0x504cf6=_0xc430[_0x161b34];return _0x504cf6;};'use strict';var Sequelize=require(_0x0c43('0x0'));module[_0x0c43('0x1')]={'name':{'type':Sequelize[_0x0c43('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0c43('0x2')]},'timeout':{'type':Sequelize[_0x0c43('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0c43('0x4'),_0x0c43('0x5'),_0x0c43('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index aa11b9f..885d4c0 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 _0x2f42=['UserMailQueue','findOrCreate','emit','userMailQueue:save','removeTeams','select','field','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','every','TeamId','includes','all','union','compact','value','isEmpty','forEach','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','update','destroy','then','get','MailQueues','end','error','stack','name','send','map','MailQueue','rawAttributes','type','key','getOptions','where','include','findAll','show','params','keys','query','filters','intersection','attributes','fields','length','model','merge','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort','pick','filter','User','UserId','mailPause','createdAt','rows','format','%s/%s','Team','getTeams','addTeams','ids','Agents','voicePause','sequelize','transaction','each'];(function(_0x10852d,_0x4cdcc6){var _0x13a8d6=function(_0x2ece16){while(--_0x2ece16){_0x10852d['push'](_0x10852d['shift']());}};_0x13a8d6(++_0x4cdcc6);}(_0x2f42,0x180));var _0x22f4=function(_0x3a2075,_0x15d168){_0x3a2075=_0x3a2075-0x0;var _0xcb9230=_0x2f42[_0x3a2075];return _0xcb9230;};'use strict';var BPromise=require(_0x22f4('0x0'));var util=require('util');var _=require(_0x22f4('0x1'));var squel=require(_0x22f4('0x2'));var Redis=require(_0x22f4('0x3'));var qs=require(_0x22f4('0x4'));var logger=require(_0x22f4('0x5'))(_0x22f4('0x6'));var config=require(_0x22f4('0x7'));var db=require(_0x22f4('0x8'))['db'];config['redis']=_[_0x22f4('0x9')](config[_0x22f4('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x22f4('0xb'))(new Redis(config[_0x22f4('0xa')]));require(_0x22f4('0xc'))[_0x22f4('0xd')](socket);function respondWithStatusCode(_0x456311,_0x4c2038){_0x4c2038=_0x4c2038||0xcc;return function(_0x4d2f77){if(_0x4d2f77){return _0x456311[_0x22f4('0xe')](_0x4c2038);}return _0x456311[_0x22f4('0xf')](_0x4c2038)['end']();};}function respondWithResult(_0x24af3a,_0x5cb2d2){_0x5cb2d2=_0x5cb2d2||0xc8;return function(_0x3be939){if(_0x3be939){return _0x24af3a[_0x22f4('0xf')](_0x5cb2d2)[_0x22f4('0x10')](_0x3be939);}};}function respondWithFilteredResult(_0x3573a7,_0x40fc34){return function(_0x4f3eaa){if(_0x4f3eaa){var _0x56f2b4=typeof _0x40fc34[_0x22f4('0x11')]===_0x22f4('0x12')&&typeof _0x40fc34['limit']===_0x22f4('0x12');var _0x3553f0=_0x4f3eaa[_0x22f4('0x13')];var _0x502316=_0x56f2b4?0x0:_0x40fc34[_0x22f4('0x11')];var _0x42f81f=_0x56f2b4?_0x4f3eaa[_0x22f4('0x13')]:_0x40fc34[_0x22f4('0x11')]+_0x40fc34[_0x22f4('0x14')];var _0x54263c;if(_0x42f81f>=_0x3553f0){_0x42f81f=_0x3553f0;_0x54263c=0xc8;}else{_0x54263c=0xce;}_0x3573a7[_0x22f4('0xf')](_0x54263c);return _0x3573a7['set']('Content-Range',_0x502316+'-'+_0x42f81f+'/'+_0x3553f0)['json'](_0x4f3eaa);}return null;};}function saveUpdates(_0x2c72c5){return function(_0x5c769e){if(_0x5c769e){return _0x5c769e[_0x22f4('0x15')](_0x2c72c5)['then'](function(_0x3378c4){return _0x3378c4;});}return null;};}function removeEntity(_0xd4357f){return function(_0x342f96){if(_0x342f96){return _0x342f96[_0x22f4('0x16')]()[_0x22f4('0x17')](function(){var _0x4fccd5=_0x342f96[_0x22f4('0x18')]({'plain':!![]});var _0x4e745d=_0x22f4('0x19');return db['UserProfileResource'][_0x22f4('0x16')]({'where':{'type':_0x4e745d,'resourceId':_0x4fccd5['id']}})[_0x22f4('0x17')](function(){return _0x342f96;});})[_0x22f4('0x17')](function(){_0xd4357f[_0x22f4('0xf')](0xcc)[_0x22f4('0x1a')]();});}};}function handleEntityNotFound(_0x65375){return function(_0x286ecb){if(!_0x286ecb){_0x65375[_0x22f4('0xe')](0x194);}return _0x286ecb;};}function handleError(_0x310e96,_0x4f9911){_0x4f9911=_0x4f9911||0x1f4;return function(_0x5d6075){logger[_0x22f4('0x1b')](_0x5d6075[_0x22f4('0x1c')]);if(_0x5d6075[_0x22f4('0x1d')]){delete _0x5d6075[_0x22f4('0x1d')];}_0x310e96[_0x22f4('0xf')](_0x4f9911)[_0x22f4('0x1e')](_0x5d6075);};}exports['index']=function(_0x399c96,_0x19a11b){var _0x1d29f8={};var _0x331c95={'count':0x0,'rows':[]};var _0x5b7501=_[_0x22f4('0x1f')](db[_0x22f4('0x20')][_0x22f4('0x21')],function(_0x50af2a){return{'name':_0x50af2a['fieldName'],'type':_0x50af2a[_0x22f4('0x22')][_0x22f4('0x23')]};});_0x1d29f8=qs[_0x22f4('0x24')](_0x5b7501,_0x399c96);var _0x500586={'where':_0x1d29f8[_0x22f4('0x25')]};return db[_0x22f4('0x20')]['count'](_0x500586)[_0x22f4('0x17')](function(_0x7951b){_0x331c95[_0x22f4('0x13')]=_0x7951b;_0x1d29f8[_0x22f4('0x26')]=qs[_0x22f4('0x26')](_0x399c96['query']);return db['MailQueue'][_0x22f4('0x27')](_0x1d29f8);})['then'](function(_0x45a9be){_0x331c95['rows']=_0x45a9be;return _0x331c95;})['then'](respondWithFilteredResult(_0x19a11b,_0x1d29f8))['catch'](handleError(_0x19a11b,null));};exports[_0x22f4('0x28')]=function(_0x498a0f,_0x1d9b36){var _0x27e983={'raw':!![],'where':{'id':_0x498a0f[_0x22f4('0x29')]['id']}},_0x30a762={};_0x30a762['model']=_[_0x22f4('0x2a')](db['MailQueue']['rawAttributes']);_0x30a762['query']=_[_0x22f4('0x2a')](_0x498a0f[_0x22f4('0x2b')]);_0x30a762[_0x22f4('0x2c')]=_[_0x22f4('0x2d')](_0x30a762['model'],_0x30a762[_0x22f4('0x2b')]);_0x27e983[_0x22f4('0x2e')]=_['intersection'](_0x30a762['model'],qs[_0x22f4('0x2f')](_0x498a0f['query'][_0x22f4('0x2f')]));_0x27e983[_0x22f4('0x2e')]=_0x27e983['attributes'][_0x22f4('0x30')]?_0x27e983[_0x22f4('0x2e')]:_0x30a762[_0x22f4('0x31')];if(_0x498a0f['query']['includeAll']){_0x27e983['include']=[{'all':!![]}];}_0x27e983=_[_0x22f4('0x32')]({},_0x27e983,_0x498a0f[_0x22f4('0x33')]);return db[_0x22f4('0x20')][_0x22f4('0x34')](_0x27e983)[_0x22f4('0x17')](handleEntityNotFound(_0x1d9b36,null))[_0x22f4('0x17')](respondWithResult(_0x1d9b36,null))[_0x22f4('0x35')](handleError(_0x1d9b36,null));};exports[_0x22f4('0x36')]=function(_0x5aa65a,_0x24ad76){return db['MailQueue']['create'](_0x5aa65a['body'],{})[_0x22f4('0x17')](function(_0x15e114){var _0x381014=_0x5aa65a[_0x22f4('0x37')]['get']({'plain':!![]});if(!_0x381014)throw new Error(_0x22f4('0x38'));if(_0x381014[_0x22f4('0x39')]===_0x22f4('0x37')){var _0x555123=_0x15e114[_0x22f4('0x18')]({'plain':!![]});var _0x3dc613=_0x22f4('0x19');return db['UserProfileSection']['find']({'where':{'name':_0x3dc613,'userProfileId':_0x381014[_0x22f4('0x3a')]},'raw':!![]})[_0x22f4('0x17')](function(_0x160404){if(_0x160404&&_0x160404[_0x22f4('0x3b')]===0x0){return db[_0x22f4('0x3c')][_0x22f4('0x36')]({'name':_0x555123[_0x22f4('0x1d')],'resourceId':_0x555123['id'],'type':_0x160404[_0x22f4('0x1d')],'sectionId':_0x160404['id']},{})[_0x22f4('0x17')](function(){return _0x15e114;});}else{return _0x15e114;}})['catch'](function(_0x3951d2){logger['error'](_0x22f4('0x3d'),_0x3951d2);throw _0x3951d2;});}return _0x15e114;})[_0x22f4('0x17')](respondWithResult(_0x24ad76,0xc9))[_0x22f4('0x35')](handleError(_0x24ad76,null));};exports[_0x22f4('0x15')]=function(_0x2fefa0,_0x433560){if(_0x2fefa0[_0x22f4('0x3e')]['id']){delete _0x2fefa0[_0x22f4('0x3e')]['id'];}return db['MailQueue'][_0x22f4('0x34')]({'where':{'id':_0x2fefa0[_0x22f4('0x29')]['id']}})['then'](handleEntityNotFound(_0x433560,null))[_0x22f4('0x17')](saveUpdates(_0x2fefa0[_0x22f4('0x3e')],null))[_0x22f4('0x17')](respondWithResult(_0x433560,null))[_0x22f4('0x35')](handleError(_0x433560,null));};exports['destroy']=function(_0x3b3ff3,_0x467432){return db['MailQueue']['find']({'where':{'id':_0x3b3ff3[_0x22f4('0x29')]['id']}})[_0x22f4('0x17')](handleEntityNotFound(_0x467432,null))[_0x22f4('0x17')](removeEntity(_0x467432,null))[_0x22f4('0x35')](handleError(_0x467432,null));};exports[_0x22f4('0x3f')]=function(_0x16a58e,_0x388b5f){return db[_0x22f4('0x20')][_0x22f4('0x3f')]()['then'](respondWithResult(_0x388b5f,null))[_0x22f4('0x35')](handleError(_0x388b5f,null));};exports[_0x22f4('0x40')]=function(_0x22a7e6,_0x51b670){var _0x303dd5={'raw':!![],'where':{}},_0x128100={},_0x3a40bb;return db['MailQueue'][_0x22f4('0x41')]({'where':{'id':_0x22a7e6[_0x22f4('0x29')]['id']}})['then'](handleEntityNotFound(_0x51b670,null))[_0x22f4('0x17')](function(_0x8bff02){if(_0x8bff02){_0x3a40bb=_0x8bff02[_0x22f4('0x18')]({'plain':!![]});_0x128100[_0x22f4('0x31')]=_[_0x22f4('0x2a')](db['UserMailQueue'][_0x22f4('0x21')]);_0x128100[_0x22f4('0x2b')]=_['keys'](_0x22a7e6['query']);_0x128100[_0x22f4('0x2c')]=_['intersection'](_0x128100['model'],_0x128100[_0x22f4('0x2b')]);_0x303dd5['attributes']=_[_0x22f4('0x2d')](_0x128100[_0x22f4('0x31')],qs[_0x22f4('0x2f')](_0x22a7e6[_0x22f4('0x2b')][_0x22f4('0x2f')]));_0x303dd5[_0x22f4('0x2e')]=_0x303dd5[_0x22f4('0x2e')][_0x22f4('0x30')]?_0x303dd5['attributes']:_0x128100[_0x22f4('0x31')];if(!_0x22a7e6[_0x22f4('0x2b')][_0x22f4('0x42')](_0x22f4('0x43'))){_0x303dd5[_0x22f4('0x14')]=qs[_0x22f4('0x14')](_0x22a7e6['query'][_0x22f4('0x14')]);_0x303dd5['offset']=qs[_0x22f4('0x11')](_0x22a7e6[_0x22f4('0x2b')][_0x22f4('0x11')]);}_0x303dd5[_0x22f4('0x44')]=qs['sort'](_0x22a7e6[_0x22f4('0x2b')][_0x22f4('0x45')]);_0x303dd5[_0x22f4('0x25')]=qs[_0x22f4('0x2c')](_[_0x22f4('0x46')](_0x22a7e6['query'],_0x128100[_0x22f4('0x2c')]));_0x303dd5[_0x22f4('0x25')]['MailQueueId']=_0x8bff02['id'];if(_0x22a7e6['query'][_0x22f4('0x47')]){_0x303dd5[_0x22f4('0x25')]=_[_0x22f4('0x32')](_0x303dd5[_0x22f4('0x25')],{'$or':_[_0x22f4('0x1f')](_0x303dd5[_0x22f4('0x2e')],function(_0x37bc06){var _0x579d2a={};_0x579d2a[_0x37bc06]={'$like':'%'+_0x22a7e6[_0x22f4('0x2b')][_0x22f4('0x47')]+'%'};return _0x579d2a;})});}_0x303dd5=_[_0x22f4('0x32')]({},_0x303dd5,_0x22a7e6['options']);return db['UserMailQueue'][_0x22f4('0x27')](_0x303dd5);}})['then'](function(_0x404e9a){if(_0x404e9a){return db[_0x22f4('0x48')]['findAndCountAll']({'where':{'id':_['map'](_0x404e9a,_0x22f4('0x49')),'role':'agent'},'attributes':['id',_0x22f4('0x1d'),_0x22f4('0x4a'),'updatedAt',_0x22f4('0x4b')]});}})[_0x22f4('0x17')](function(_0x290588){if(_0x290588){return{'count':_0x290588[_0x22f4('0x13')],'rows':_[_0x22f4('0x1f')](_0x290588[_0x22f4('0x4c')],function(_0x978451){return{'membername':_0x978451[_0x22f4('0x1d')],'UserId':_0x978451['id'],'queue_name':_0x3a40bb[_0x22f4('0x1d')],'MailQueueId':_0x3a40bb['id'],'interface':util[_0x22f4('0x4d')](_0x22f4('0x4e'),'SIP',_0x978451[_0x22f4('0x1d')]),'penalty':0x0,'paused':_0x978451[_0x22f4('0x4a')],'createdAt':_0x978451[_0x22f4('0x4b')],'updatedAt':_0x978451['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x51b670,_0x303dd5))[_0x22f4('0x35')](handleError(_0x51b670,null));};exports['getTeams']=function(_0x4b7aea,_0xae3937){var _0x41adbd={};var _0x46e3e1={};var _0x1ebf5e;var _0x4d1ad0;return db[_0x22f4('0x20')][_0x22f4('0x41')]({'where':{'id':_0x4b7aea[_0x22f4('0x29')]['id']}})[_0x22f4('0x17')](handleEntityNotFound(_0xae3937,null))['then'](function(_0x497dd5){if(_0x497dd5){_0x1ebf5e=_0x497dd5;_0x46e3e1[_0x22f4('0x31')]=_[_0x22f4('0x2a')](db[_0x22f4('0x4f')][_0x22f4('0x21')]);_0x46e3e1[_0x22f4('0x2b')]=_[_0x22f4('0x2a')](_0x4b7aea[_0x22f4('0x2b')]);_0x46e3e1['filters']=_[_0x22f4('0x2d')](_0x46e3e1['model'],_0x46e3e1[_0x22f4('0x2b')]);_0x41adbd[_0x22f4('0x2e')]=_[_0x22f4('0x2d')](_0x46e3e1['model'],qs[_0x22f4('0x2f')](_0x4b7aea[_0x22f4('0x2b')]['fields']));_0x41adbd['attributes']=_0x41adbd[_0x22f4('0x2e')][_0x22f4('0x30')]?_0x41adbd[_0x22f4('0x2e')]:_0x46e3e1[_0x22f4('0x31')];_0x41adbd[_0x22f4('0x44')]=qs[_0x22f4('0x45')](_0x4b7aea['query']['sort']);_0x41adbd[_0x22f4('0x25')]=qs[_0x22f4('0x2c')](_[_0x22f4('0x46')](_0x4b7aea[_0x22f4('0x2b')],_0x46e3e1['filters']));if(_0x4b7aea[_0x22f4('0x2b')][_0x22f4('0x47')]){_0x41adbd[_0x22f4('0x25')]=_[_0x22f4('0x32')](_0x41adbd[_0x22f4('0x25')],{'$or':_[_0x22f4('0x1f')](_0x41adbd[_0x22f4('0x2e')],function(_0x2e9152){var _0x20c4fa={};_0x20c4fa[_0x2e9152]={'$like':'%'+_0x4b7aea[_0x22f4('0x2b')][_0x22f4('0x47')]+'%'};return _0x20c4fa;})});}_0x41adbd=_[_0x22f4('0x32')]({},_0x41adbd,_0x4b7aea[_0x22f4('0x33')]);return _0x1ebf5e['getTeams'](_0x41adbd);}})[_0x22f4('0x17')](function(_0x5cfd2f){if(_0x5cfd2f){_0x4d1ad0=_0x5cfd2f[_0x22f4('0x30')];if(!_0x4b7aea[_0x22f4('0x2b')][_0x22f4('0x42')](_0x22f4('0x43'))){_0x41adbd[_0x22f4('0x14')]=qs[_0x22f4('0x14')](_0x4b7aea[_0x22f4('0x2b')]['limit']);_0x41adbd['offset']=qs[_0x22f4('0x11')](_0x4b7aea[_0x22f4('0x2b')][_0x22f4('0x11')]);}return _0x1ebf5e[_0x22f4('0x50')](_0x41adbd);}})[_0x22f4('0x17')](function(_0x1d995c){if(_0x1d995c){return _0x1d995c?{'count':_0x4d1ad0,'rows':_0x1d995c}:null;}})[_0x22f4('0x17')](respondWithResult(_0xae3937,null))['catch'](handleError(_0xae3937,null));};exports[_0x22f4('0x51')]=function(_0xf0f7b,_0x22661f){var _0x44aa91=_0xf0f7b[_0x22f4('0x3e')][_0x22f4('0x52')];return db[_0x22f4('0x4f')][_0x22f4('0x27')]({'where':{'id':_0x44aa91},'attributes':['id'],'include':[{'model':db[_0x22f4('0x48')],'as':_0x22f4('0x53'),'attributes':['id',_0x22f4('0x1d'),'online',_0x22f4('0x54'),'interface'],'raw':!![]}]})[_0x22f4('0x17')](function(_0x32c01c){if(_0x32c01c){var _0x5312ee=_['flatMap'](_0x32c01c,function(_0x3a2976){var _0x2c8d2a=_0x3a2976['get']({'plain':!![]});return _0x2c8d2a[_0x22f4('0x53')];});return db['MailQueue'][_0x22f4('0x34')]({'where':{'id':_0xf0f7b[_0x22f4('0x29')]['id']}})[_0x22f4('0x17')](function(_0x2e120e){return db[_0x22f4('0x55')][_0x22f4('0x56')](function(_0xc84858){return _0x2e120e[_0x22f4('0x51')](_0x44aa91,{'transaction':_0xc84858})['then'](function(){return BPromise[_0x22f4('0x57')](_0x5312ee,function(_0x130681){return db[_0x22f4('0x58')][_0x22f4('0x59')]({'where':{'UserId':_0x130681['id'],'MailQueueId':_0xf0f7b[_0x22f4('0x29')]['id']},'transaction':_0xc84858});});})[_0x22f4('0x17')](function(){_0x5312ee['forEach'](function(_0x4c7781){socket[_0x22f4('0x5a')](_0x22f4('0x5b'),{'UserId':_0x4c7781['id'],'MailQueueId':_0x2e120e['id']});});});});});}})[_0x22f4('0x17')](respondWithStatusCode(_0x22661f,null))[_0x22f4('0x35')](handleError(_0x22661f,null));};exports[_0x22f4('0x5c')]=function(_0x13b38d,_0x71e354){return db[_0x22f4('0x4f')][_0x22f4('0x27')]({'where':{'id':_0x13b38d['query'][_0x22f4('0x52')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x22f4('0x53'),'attributes':['id'],'raw':!![]}]})[_0x22f4('0x17')](handleEntityNotFound(_0x71e354,null))[_0x22f4('0x17')](function(_0x1c8ade){var _0x47b8d2=_[_0x22f4('0x1f')](_0x1c8ade,'id');var _0x4c733e=[];var _0x58ed68=[];var _0x4fcb2c=squel[_0x22f4('0x5d')]();_0x4fcb2c[_0x22f4('0x5e')]('tq.TeamId')['from'](_0x22f4('0x5f'),'tq')[_0x22f4('0x60')](_0x22f4('0x61'),'ut',_0x22f4('0x62'))[_0x22f4('0x25')](_0x22f4('0x63'),_0x13b38d[_0x22f4('0x29')]['id']);for(var _0x10c4c2=0x0;_0x10c4c2<_0x1c8ade[_0x22f4('0x30')];_0x10c4c2+=0x1){let _0x86ea5f=_0x1c8ade[_0x10c4c2];for(var _0x1e6382=0x0;_0x1e6382<_0x86ea5f['Agents'][_0x22f4('0x30')];_0x1e6382+=0x1){let _0x5716b3=_0x86ea5f[_0x22f4('0x53')][_0x1e6382];var _0x971dce=_0x4fcb2c['clone']();_0x971dce[_0x22f4('0x25')](_0x22f4('0x64'),_0x5716b3['id']);_0x58ed68[_0x22f4('0x65')](db['sequelize']['query'](_0x971dce['toString'](),{'type':db[_0x22f4('0x55')]['QueryTypes']['SELECT']})[_0x22f4('0x17')](function(_0x424c4d){if(_0x424c4d[_0x22f4('0x30')]===0x1){return _0x5716b3['id'];}else{var _0x35ad74=_[_0x22f4('0x66')](_[_0x22f4('0x1f')](_0x424c4d,_0x22f4('0x67')),function(_0x1f3af3){return _[_0x22f4('0x68')](_0x47b8d2,_0x1f3af3);});if(_0x35ad74){return _0x5716b3['id'];}}}));}}return BPromise[_0x22f4('0x69')](_0x58ed68)[_0x22f4('0x17')](function(_0x45af12){_0x4c733e=_(_0x4c733e)[_0x22f4('0x6a')](_0x45af12)[_0x22f4('0x6b')]()[_0x22f4('0x6c')]();return db[_0x22f4('0x20')][_0x22f4('0x34')]({'where':{'id':_0x13b38d['params']['id']}})[_0x22f4('0x17')](function(_0x5c089a){return db[_0x22f4('0x55')][_0x22f4('0x56')](function(_0x4f0a0d){return _0x5c089a[_0x22f4('0x5c')](_0x13b38d['query']['ids'],{'transaction':_0x4f0a0d})[_0x22f4('0x17')](function(){if(!_[_0x22f4('0x6d')](_0x4c733e)){return _0x5c089a['removeAgents'](_0x4c733e,{'transaction':_0x4f0a0d});}})[_0x22f4('0x17')](function(){_0x4c733e[_0x22f4('0x6e')](function(_0x26cddc){socket[_0x22f4('0x5a')](_0x22f4('0x6f'),{'UserId':_0x26cddc,'MailQueueId':_0x5c089a['id']});});});});});});})[_0x22f4('0x17')](respondWithStatusCode(_0x71e354,null))[_0x22f4('0x35')](handleError(_0x71e354,null));};exports[_0x22f4('0x70')]=function(_0x2a3e5e,_0x4e52fa){return db[_0x22f4('0x20')][_0x22f4('0x34')]({'where':{'id':_0x2a3e5e[_0x22f4('0x29')]['id']}})[_0x22f4('0x17')](handleEntityNotFound(_0x4e52fa,null))['then'](function(_0x5781a2){if(_0x5781a2){return _0x5781a2[_0x22f4('0x70')](_0x2a3e5e['body'][_0x22f4('0x52')],_[_0x22f4('0x71')](_0x2a3e5e[_0x22f4('0x3e')],[_0x22f4('0x52'),'id'])||{})[_0x22f4('0x72')](function(_0x53d508){for(var _0x153c62=0x0;_0x153c62<_0x2a3e5e[_0x22f4('0x3e')]['ids']['length'];_0x153c62+=0x1){socket[_0x22f4('0x5a')](_0x22f4('0x5b'),{'UserId':Number(_0x2a3e5e[_0x22f4('0x3e')][_0x22f4('0x52')][_0x153c62]),'MailQueueId':Number(_0x2a3e5e['params']['id'])});}return _0x53d508;});}})[_0x22f4('0x17')](respondWithResult(_0x4e52fa,null))[_0x22f4('0x35')](handleError(_0x4e52fa,null));};exports[_0x22f4('0x73')]=function(_0x158b5f,_0x2c4d9d){return db[_0x22f4('0x20')][_0x22f4('0x34')]({'where':{'id':_0x158b5f[_0x22f4('0x29')]['id']}})[_0x22f4('0x17')](handleEntityNotFound(_0x2c4d9d,null))[_0x22f4('0x17')](function(_0x400a7b){if(_0x400a7b){return _0x400a7b[_0x22f4('0x73')](_0x158b5f['query'][_0x22f4('0x52')])['then'](function(){if(_[_0x22f4('0x74')](_0x158b5f[_0x22f4('0x2b')]['ids'])){for(var _0x5a9b50=0x0;_0x5a9b50<_0x158b5f['query'][_0x22f4('0x52')][_0x22f4('0x30')];_0x5a9b50+=0x1){socket[_0x22f4('0x5a')]('userMailQueue:remove',{'UserId':Number(_0x158b5f[_0x22f4('0x2b')][_0x22f4('0x52')][_0x5a9b50]),'MailQueueId':Number(_0x158b5f['params']['id'])});}}else{socket[_0x22f4('0x5a')](_0x22f4('0x6f'),{'UserId':Number(_0x158b5f[_0x22f4('0x2b')][_0x22f4('0x52')]),'MailQueueId':Number(_0x158b5f['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2c4d9d,null))[_0x22f4('0x35')](handleError(_0x2c4d9d,null));};exports[_0x22f4('0x75')]=function(_0x2e503c,_0x781a41){var _0xf1bee0={};var _0x1e5f63={};var _0x5d7962;var _0x1486b5;return db[_0x22f4('0x20')]['findOne']({'where':{'id':_0x2e503c[_0x22f4('0x29')]['id']}})[_0x22f4('0x17')](handleEntityNotFound(_0x781a41,null))[_0x22f4('0x17')](function(_0x1a99d0){if(_0x1a99d0){_0x5d7962=_0x1a99d0;_0x1e5f63[_0x22f4('0x31')]=_[_0x22f4('0x2a')](db[_0x22f4('0x48')][_0x22f4('0x21')]);_0x1e5f63['query']=_[_0x22f4('0x2a')](_0x2e503c['query']);_0x1e5f63[_0x22f4('0x2c')]=_[_0x22f4('0x2d')](_0x1e5f63[_0x22f4('0x31')],_0x1e5f63[_0x22f4('0x2b')]);_0xf1bee0[_0x22f4('0x2e')]=_[_0x22f4('0x2d')](_0x1e5f63[_0x22f4('0x31')],qs['fields'](_0x2e503c['query'][_0x22f4('0x2f')]));_0xf1bee0[_0x22f4('0x2e')]=_0xf1bee0[_0x22f4('0x2e')][_0x22f4('0x30')]?_0xf1bee0[_0x22f4('0x2e')]:_0x1e5f63[_0x22f4('0x31')];_0xf1bee0[_0x22f4('0x44')]=qs[_0x22f4('0x45')](_0x2e503c['query'][_0x22f4('0x45')]);_0xf1bee0[_0x22f4('0x25')]=qs['filters'](_[_0x22f4('0x46')](_0x2e503c[_0x22f4('0x2b')],_0x1e5f63[_0x22f4('0x2c')]));if(_0x2e503c[_0x22f4('0x2b')][_0x22f4('0x47')]){_0xf1bee0['where']=_[_0x22f4('0x32')](_0xf1bee0['where'],{'$or':_[_0x22f4('0x1f')](_0xf1bee0[_0x22f4('0x2e')],function(_0x545902){var _0x3c2114={};_0x3c2114[_0x545902]={'$like':'%'+_0x2e503c[_0x22f4('0x2b')][_0x22f4('0x47')]+'%'};return _0x3c2114;})});}_0xf1bee0=_[_0x22f4('0x32')]({},_0xf1bee0,_0x2e503c[_0x22f4('0x33')]);return _0x5d7962[_0x22f4('0x75')](_0xf1bee0);}})[_0x22f4('0x17')](function(_0x3b5569){if(_0x3b5569){_0x1486b5=_0x3b5569[_0x22f4('0x30')];if(!_0x2e503c['query']['hasOwnProperty'](_0x22f4('0x43'))){_0xf1bee0[_0x22f4('0x14')]=qs['limit'](_0x2e503c['query'][_0x22f4('0x14')]);_0xf1bee0[_0x22f4('0x11')]=qs[_0x22f4('0x11')](_0x2e503c[_0x22f4('0x2b')][_0x22f4('0x11')]);}return _0x5d7962[_0x22f4('0x75')](_0xf1bee0);}})['then'](function(_0x1193d5){if(_0x1193d5){return _0x1193d5?{'count':_0x1486b5,'rows':_0x1193d5}:null;}})['then'](respondWithResult(_0x781a41,null))[_0x22f4('0x35')](handleError(_0x781a41,null));}; \ No newline at end of file +var _0x921d=['describe','getMembers','UserMailQueue','nolimit','order','sort','pick','filter','map','options','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','getTeams','Team','fields','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','includes','all','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','findOne','hasOwnProperty','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','send','MailQueue','fieldName','type','key','getOptions','where','include','query','findAll','rows','show','model','keys','rawAttributes','filters','attributes','intersection','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','UserProfileResource','name','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params'];(function(_0xff289b,_0x239c16){var _0x4288a1=function(_0x275a33){while(--_0x275a33){_0xff289b['push'](_0xff289b['shift']());}};_0x4288a1(++_0x239c16);}(_0x921d,0x12f));var _0xd921=function(_0x202755,_0x4ef87e){_0x202755=_0x202755-0x0;var _0x4dc6a1=_0x921d[_0x202755];return _0x4dc6a1;};'use strict';var BPromise=require(_0xd921('0x0'));var util=require(_0xd921('0x1'));var _=require(_0xd921('0x2'));var squel=require(_0xd921('0x3'));var Redis=require(_0xd921('0x4'));var qs=require(_0xd921('0x5'));var logger=require(_0xd921('0x6'))(_0xd921('0x7'));var config=require('../../config/environment');var db=require(_0xd921('0x8'))['db'];config[_0xd921('0x9')]=_[_0xd921('0xa')](config[_0xd921('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xd921('0xb'))(new Redis(config['redis']));require(_0xd921('0xc'))[_0xd921('0xd')](socket);function respondWithStatusCode(_0x140e7f,_0x2cbd31){_0x2cbd31=_0x2cbd31||0xcc;return function(_0x3e8683){if(_0x3e8683){return _0x140e7f[_0xd921('0xe')](_0x2cbd31);}return _0x140e7f[_0xd921('0xf')](_0x2cbd31)[_0xd921('0x10')]();};}function respondWithResult(_0x5cbe58,_0x5ba78a){_0x5ba78a=_0x5ba78a||0xc8;return function(_0x49822b){if(_0x49822b){return _0x5cbe58[_0xd921('0xf')](_0x5ba78a)['json'](_0x49822b);}};}function respondWithFilteredResult(_0xdd9166,_0xd44f77){return function(_0x3bb3f0){if(_0x3bb3f0){var _0x2a2818=typeof _0xd44f77[_0xd921('0x11')]===_0xd921('0x12')&&typeof _0xd44f77[_0xd921('0x13')]===_0xd921('0x12');var _0x3d5e57=_0x3bb3f0['count'];var _0x141aa8=_0x2a2818?0x0:_0xd44f77[_0xd921('0x11')];var _0x38034b=_0x2a2818?_0x3bb3f0[_0xd921('0x14')]:_0xd44f77[_0xd921('0x11')]+_0xd44f77[_0xd921('0x13')];var _0x127e91;if(_0x38034b>=_0x3d5e57){_0x38034b=_0x3d5e57;_0x127e91=0xc8;}else{_0x127e91=0xce;}_0xdd9166[_0xd921('0xf')](_0x127e91);return _0xdd9166[_0xd921('0x15')](_0xd921('0x16'),_0x141aa8+'-'+_0x38034b+'/'+_0x3d5e57)['json'](_0x3bb3f0);}return null;};}function saveUpdates(_0x3b72b8){return function(_0xc5a033){if(_0xc5a033){return _0xc5a033[_0xd921('0x17')](_0x3b72b8)['then'](function(_0x24945d){return _0x24945d;});}return null;};}function removeEntity(_0x2a6118){return function(_0xef864b){if(_0xef864b){return _0xef864b[_0xd921('0x18')]()[_0xd921('0x19')](function(){var _0x19b70e=_0xef864b['get']({'plain':!![]});var _0x54f899='MailQueues';return db['UserProfileResource'][_0xd921('0x18')]({'where':{'type':_0x54f899,'resourceId':_0x19b70e['id']}})[_0xd921('0x19')](function(){return _0xef864b;});})['then'](function(){_0x2a6118[_0xd921('0xf')](0xcc)[_0xd921('0x10')]();});}};}function handleEntityNotFound(_0x26c0ba){return function(_0x2bdf12){if(!_0x2bdf12){_0x26c0ba[_0xd921('0xe')](0x194);}return _0x2bdf12;};}function handleError(_0x437b3d,_0x5eddae){_0x5eddae=_0x5eddae||0x1f4;return function(_0xfea720){logger[_0xd921('0x1a')](_0xfea720[_0xd921('0x1b')]);if(_0xfea720['name']){delete _0xfea720['name'];}_0x437b3d['status'](_0x5eddae)[_0xd921('0x1c')](_0xfea720);};}exports['index']=function(_0x53a64f,_0x4a5e8d){var _0x26bea2={};var _0x12cd86={'count':0x0,'rows':[]};var _0x11d55d=_['map'](db[_0xd921('0x1d')]['rawAttributes'],function(_0x4773e8){return{'name':_0x4773e8[_0xd921('0x1e')],'type':_0x4773e8[_0xd921('0x1f')][_0xd921('0x20')]};});_0x26bea2=qs[_0xd921('0x21')](_0x11d55d,_0x53a64f);var _0xad40a0={'where':_0x26bea2[_0xd921('0x22')]};return db['MailQueue'][_0xd921('0x14')](_0xad40a0)[_0xd921('0x19')](function(_0x5c4be7){_0x12cd86[_0xd921('0x14')]=_0x5c4be7;_0x26bea2['include']=qs[_0xd921('0x23')](_0x53a64f[_0xd921('0x24')]);return db[_0xd921('0x1d')][_0xd921('0x25')](_0x26bea2);})[_0xd921('0x19')](function(_0xb48aac){_0x12cd86[_0xd921('0x26')]=_0xb48aac;return _0x12cd86;})[_0xd921('0x19')](respondWithFilteredResult(_0x4a5e8d,_0x26bea2))['catch'](handleError(_0x4a5e8d,null));};exports[_0xd921('0x27')]=function(_0x4e9e59,_0x29c3cd){var _0x142aef={'raw':!![],'where':{'id':_0x4e9e59['params']['id']}},_0x449f5d={};_0x449f5d[_0xd921('0x28')]=_[_0xd921('0x29')](db[_0xd921('0x1d')][_0xd921('0x2a')]);_0x449f5d[_0xd921('0x24')]=_['keys'](_0x4e9e59[_0xd921('0x24')]);_0x449f5d[_0xd921('0x2b')]=_['intersection'](_0x449f5d[_0xd921('0x28')],_0x449f5d[_0xd921('0x24')]);_0x142aef[_0xd921('0x2c')]=_[_0xd921('0x2d')](_0x449f5d[_0xd921('0x28')],qs['fields'](_0x4e9e59['query']['fields']));_0x142aef['attributes']=_0x142aef[_0xd921('0x2c')][_0xd921('0x2e')]?_0x142aef['attributes']:_0x449f5d[_0xd921('0x28')];if(_0x4e9e59[_0xd921('0x24')][_0xd921('0x2f')]){_0x142aef[_0xd921('0x23')]=[{'all':!![]}];}_0x142aef=_[_0xd921('0x30')]({},_0x142aef,_0x4e9e59['options']);return db[_0xd921('0x1d')][_0xd921('0x31')](_0x142aef)[_0xd921('0x19')](handleEntityNotFound(_0x29c3cd,null))[_0xd921('0x19')](respondWithResult(_0x29c3cd,null))['catch'](handleError(_0x29c3cd,null));};exports[_0xd921('0x32')]=function(_0x2a1167,_0x1f4b8f){return db[_0xd921('0x1d')][_0xd921('0x32')](_0x2a1167[_0xd921('0x33')],{})[_0xd921('0x19')](function(_0x1c212c){var _0x3cd1fd=_0x2a1167[_0xd921('0x34')]['get']({'plain':!![]});if(!_0x3cd1fd)throw new Error(_0xd921('0x35'));if(_0x3cd1fd[_0xd921('0x36')]===_0xd921('0x34')){var _0x3ed065=_0x1c212c[_0xd921('0x37')]({'plain':!![]});var _0x988b50='MailQueues';return db[_0xd921('0x38')]['find']({'where':{'name':_0x988b50,'userProfileId':_0x3cd1fd[_0xd921('0x39')]},'raw':!![]})[_0xd921('0x19')](function(_0xf7910f){if(_0xf7910f&&_0xf7910f['autoAssociation']===0x0){return db[_0xd921('0x3a')]['create']({'name':_0x3ed065['name'],'resourceId':_0x3ed065['id'],'type':_0xf7910f[_0xd921('0x3b')],'sectionId':_0xf7910f['id']},{})[_0xd921('0x19')](function(){return _0x1c212c;});}else{return _0x1c212c;}})[_0xd921('0x3c')](function(_0x27c91b){logger[_0xd921('0x1a')](_0xd921('0x3d'),_0x27c91b);throw _0x27c91b;});}return _0x1c212c;})[_0xd921('0x19')](respondWithResult(_0x1f4b8f,0xc9))[_0xd921('0x3c')](handleError(_0x1f4b8f,null));};exports[_0xd921('0x17')]=function(_0x353d7c,_0x24f36a){if(_0x353d7c[_0xd921('0x33')]['id']){delete _0x353d7c[_0xd921('0x33')]['id'];}return db['MailQueue'][_0xd921('0x31')]({'where':{'id':_0x353d7c[_0xd921('0x3e')]['id']}})[_0xd921('0x19')](handleEntityNotFound(_0x24f36a,null))[_0xd921('0x19')](saveUpdates(_0x353d7c['body'],null))[_0xd921('0x19')](respondWithResult(_0x24f36a,null))[_0xd921('0x3c')](handleError(_0x24f36a,null));};exports[_0xd921('0x18')]=function(_0x46b78a,_0x5df306){return db[_0xd921('0x1d')][_0xd921('0x31')]({'where':{'id':_0x46b78a[_0xd921('0x3e')]['id']}})[_0xd921('0x19')](handleEntityNotFound(_0x5df306,null))[_0xd921('0x19')](removeEntity(_0x5df306,null))[_0xd921('0x3c')](handleError(_0x5df306,null));};exports[_0xd921('0x3f')]=function(_0x3dfd61,_0x8e3f7e){return db[_0xd921('0x1d')][_0xd921('0x3f')]()['then'](respondWithResult(_0x8e3f7e,null))['catch'](handleError(_0x8e3f7e,null));};exports[_0xd921('0x40')]=function(_0x8675f8,_0x4943af){var _0x2d285d={'raw':!![],'where':{}},_0x577e37={},_0x156a04;return db[_0xd921('0x1d')]['findOne']({'where':{'id':_0x8675f8[_0xd921('0x3e')]['id']}})[_0xd921('0x19')](handleEntityNotFound(_0x4943af,null))['then'](function(_0x3f7f02){if(_0x3f7f02){_0x156a04=_0x3f7f02[_0xd921('0x37')]({'plain':!![]});_0x577e37['model']=_['keys'](db[_0xd921('0x41')][_0xd921('0x2a')]);_0x577e37['query']=_[_0xd921('0x29')](_0x8675f8[_0xd921('0x24')]);_0x577e37[_0xd921('0x2b')]=_[_0xd921('0x2d')](_0x577e37['model'],_0x577e37[_0xd921('0x24')]);_0x2d285d[_0xd921('0x2c')]=_['intersection'](_0x577e37['model'],qs['fields'](_0x8675f8[_0xd921('0x24')]['fields']));_0x2d285d[_0xd921('0x2c')]=_0x2d285d[_0xd921('0x2c')][_0xd921('0x2e')]?_0x2d285d[_0xd921('0x2c')]:_0x577e37[_0xd921('0x28')];if(!_0x8675f8[_0xd921('0x24')]['hasOwnProperty'](_0xd921('0x42'))){_0x2d285d[_0xd921('0x13')]=qs[_0xd921('0x13')](_0x8675f8['query'][_0xd921('0x13')]);_0x2d285d[_0xd921('0x11')]=qs[_0xd921('0x11')](_0x8675f8['query'][_0xd921('0x11')]);}_0x2d285d[_0xd921('0x43')]=qs[_0xd921('0x44')](_0x8675f8[_0xd921('0x24')][_0xd921('0x44')]);_0x2d285d['where']=qs[_0xd921('0x2b')](_[_0xd921('0x45')](_0x8675f8['query'],_0x577e37['filters']));_0x2d285d['where']['MailQueueId']=_0x3f7f02['id'];if(_0x8675f8[_0xd921('0x24')][_0xd921('0x46')]){_0x2d285d[_0xd921('0x22')]=_[_0xd921('0x30')](_0x2d285d[_0xd921('0x22')],{'$or':_[_0xd921('0x47')](_0x2d285d[_0xd921('0x2c')],function(_0x653975){var _0x3e311f={};_0x3e311f[_0x653975]={'$like':'%'+_0x8675f8[_0xd921('0x24')][_0xd921('0x46')]+'%'};return _0x3e311f;})});}_0x2d285d=_['merge']({},_0x2d285d,_0x8675f8[_0xd921('0x48')]);return db[_0xd921('0x41')][_0xd921('0x25')](_0x2d285d);}})[_0xd921('0x19')](function(_0x594995){if(_0x594995){return db[_0xd921('0x49')][_0xd921('0x4a')]({'where':{'id':_[_0xd921('0x47')](_0x594995,_0xd921('0x4b')),'role':_0xd921('0x4c')},'attributes':['id',_0xd921('0x3b'),_0xd921('0x4d'),_0xd921('0x4e'),_0xd921('0x4f')]});}})[_0xd921('0x19')](function(_0x3953f7){if(_0x3953f7){return{'count':_0x3953f7[_0xd921('0x14')],'rows':_[_0xd921('0x47')](_0x3953f7[_0xd921('0x26')],function(_0x54e9a3){return{'membername':_0x54e9a3[_0xd921('0x3b')],'UserId':_0x54e9a3['id'],'queue_name':_0x156a04[_0xd921('0x3b')],'MailQueueId':_0x156a04['id'],'interface':util['format']('%s/%s','SIP',_0x54e9a3[_0xd921('0x3b')]),'penalty':0x0,'paused':_0x54e9a3[_0xd921('0x4d')],'createdAt':_0x54e9a3['createdAt'],'updatedAt':_0x54e9a3[_0xd921('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd921('0x19')](respondWithFilteredResult(_0x4943af,_0x2d285d))[_0xd921('0x3c')](handleError(_0x4943af,null));};exports[_0xd921('0x50')]=function(_0x16baaa,_0x14394e){var _0x19ba2c={};var _0x118133={};var _0x3f982d;var _0x32985c;return db['MailQueue']['findOne']({'where':{'id':_0x16baaa[_0xd921('0x3e')]['id']}})[_0xd921('0x19')](handleEntityNotFound(_0x14394e,null))['then'](function(_0xdfd1d5){if(_0xdfd1d5){_0x3f982d=_0xdfd1d5;_0x118133[_0xd921('0x28')]=_[_0xd921('0x29')](db[_0xd921('0x51')]['rawAttributes']);_0x118133[_0xd921('0x24')]=_[_0xd921('0x29')](_0x16baaa['query']);_0x118133[_0xd921('0x2b')]=_[_0xd921('0x2d')](_0x118133[_0xd921('0x28')],_0x118133[_0xd921('0x24')]);_0x19ba2c[_0xd921('0x2c')]=_['intersection'](_0x118133[_0xd921('0x28')],qs[_0xd921('0x52')](_0x16baaa[_0xd921('0x24')][_0xd921('0x52')]));_0x19ba2c['attributes']=_0x19ba2c['attributes'][_0xd921('0x2e')]?_0x19ba2c[_0xd921('0x2c')]:_0x118133[_0xd921('0x28')];_0x19ba2c[_0xd921('0x43')]=qs[_0xd921('0x44')](_0x16baaa[_0xd921('0x24')]['sort']);_0x19ba2c[_0xd921('0x22')]=qs[_0xd921('0x2b')](_['pick'](_0x16baaa[_0xd921('0x24')],_0x118133[_0xd921('0x2b')]));if(_0x16baaa['query'][_0xd921('0x46')]){_0x19ba2c[_0xd921('0x22')]=_[_0xd921('0x30')](_0x19ba2c[_0xd921('0x22')],{'$or':_['map'](_0x19ba2c['attributes'],function(_0x4ec995){var _0x35ea2b={};_0x35ea2b[_0x4ec995]={'$like':'%'+_0x16baaa[_0xd921('0x24')][_0xd921('0x46')]+'%'};return _0x35ea2b;})});}_0x19ba2c=_[_0xd921('0x30')]({},_0x19ba2c,_0x16baaa[_0xd921('0x48')]);return _0x3f982d[_0xd921('0x50')](_0x19ba2c);}})[_0xd921('0x19')](function(_0x5b2396){if(_0x5b2396){_0x32985c=_0x5b2396[_0xd921('0x2e')];if(!_0x16baaa['query']['hasOwnProperty'](_0xd921('0x42'))){_0x19ba2c[_0xd921('0x13')]=qs[_0xd921('0x13')](_0x16baaa['query']['limit']);_0x19ba2c[_0xd921('0x11')]=qs[_0xd921('0x11')](_0x16baaa[_0xd921('0x24')][_0xd921('0x11')]);}return _0x3f982d['getTeams'](_0x19ba2c);}})['then'](function(_0x727121){if(_0x727121){return _0x727121?{'count':_0x32985c,'rows':_0x727121}:null;}})[_0xd921('0x19')](respondWithResult(_0x14394e,null))[_0xd921('0x3c')](handleError(_0x14394e,null));};exports[_0xd921('0x53')]=function(_0x8d4f3b,_0x403cf9){var _0x1b9613=_0x8d4f3b[_0xd921('0x33')][_0xd921('0x54')];return db[_0xd921('0x51')][_0xd921('0x25')]({'where':{'id':_0x1b9613},'attributes':['id'],'include':[{'model':db[_0xd921('0x49')],'as':_0xd921('0x55'),'attributes':['id',_0xd921('0x3b'),_0xd921('0x56'),_0xd921('0x57'),_0xd921('0x58')],'raw':!![]}]})[_0xd921('0x19')](function(_0x1e775c){if(_0x1e775c){var _0x1860a1=_[_0xd921('0x59')](_0x1e775c,function(_0x10759d){var _0x26dc63=_0x10759d[_0xd921('0x37')]({'plain':!![]});return _0x26dc63[_0xd921('0x55')];});return db[_0xd921('0x1d')][_0xd921('0x31')]({'where':{'id':_0x8d4f3b[_0xd921('0x3e')]['id']}})[_0xd921('0x19')](function(_0x15fcce){return db[_0xd921('0x5a')][_0xd921('0x5b')](function(_0x3a0b43){return _0x15fcce[_0xd921('0x53')](_0x1b9613,{'transaction':_0x3a0b43})['then'](function(){return BPromise['each'](_0x1860a1,function(_0x3e289e){return db[_0xd921('0x41')][_0xd921('0x5c')]({'where':{'UserId':_0x3e289e['id'],'MailQueueId':_0x8d4f3b['params']['id']},'transaction':_0x3a0b43});});})[_0xd921('0x19')](function(){_0x1860a1[_0xd921('0x5d')](function(_0x5b048e){socket[_0xd921('0x5e')](_0xd921('0x5f'),{'UserId':_0x5b048e['id'],'MailQueueId':_0x15fcce['id']});});});});});}})[_0xd921('0x19')](respondWithStatusCode(_0x403cf9,null))[_0xd921('0x3c')](handleError(_0x403cf9,null));};exports[_0xd921('0x60')]=function(_0x30fa74,_0x4e2b54){return db['Team'][_0xd921('0x25')]({'where':{'id':_0x30fa74[_0xd921('0x24')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd921('0x55'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4e2b54,null))[_0xd921('0x19')](function(_0x1394d3){var _0x5cebe1=_[_0xd921('0x47')](_0x1394d3,'id');var _0x1a641b=[];var _0x222e8a=[];var _0x4516ab=squel[_0xd921('0x61')]();_0x4516ab['field']('tq.TeamId')['from'](_0xd921('0x62'),'tq')[_0xd921('0x63')](_0xd921('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd921('0x22')](_0xd921('0x65'),_0x30fa74[_0xd921('0x3e')]['id']);for(var _0x1ad017=0x0;_0x1ad017<_0x1394d3[_0xd921('0x2e')];_0x1ad017+=0x1){let _0x463e5b=_0x1394d3[_0x1ad017];for(var _0x18f4ab=0x0;_0x18f4ab<_0x463e5b['Agents'][_0xd921('0x2e')];_0x18f4ab+=0x1){let _0x54d292=_0x463e5b[_0xd921('0x55')][_0x18f4ab];var _0x1db57a=_0x4516ab[_0xd921('0x66')]();_0x1db57a[_0xd921('0x22')](_0xd921('0x67'),_0x54d292['id']);_0x222e8a[_0xd921('0x68')](db['sequelize'][_0xd921('0x24')](_0x1db57a[_0xd921('0x69')](),{'type':db[_0xd921('0x5a')]['QueryTypes'][_0xd921('0x6a')]})[_0xd921('0x19')](function(_0x404168){if(_0x404168['length']===0x1){return _0x54d292['id'];}else{var _0x56fb22=_['every'](_['map'](_0x404168,_0xd921('0x6b')),function(_0x5358ca){return _[_0xd921('0x6c')](_0x5cebe1,_0x5358ca);});if(_0x56fb22){return _0x54d292['id'];}}}));}}return BPromise[_0xd921('0x6d')](_0x222e8a)[_0xd921('0x19')](function(_0x471741){_0x1a641b=_(_0x1a641b)['union'](_0x471741)[_0xd921('0x6e')]()[_0xd921('0x6f')]();return db[_0xd921('0x1d')]['find']({'where':{'id':_0x30fa74[_0xd921('0x3e')]['id']}})[_0xd921('0x19')](function(_0x41c6b9){return db[_0xd921('0x5a')][_0xd921('0x5b')](function(_0x28da87){return _0x41c6b9[_0xd921('0x60')](_0x30fa74['query'][_0xd921('0x54')],{'transaction':_0x28da87})[_0xd921('0x19')](function(){if(!_[_0xd921('0x70')](_0x1a641b)){return _0x41c6b9[_0xd921('0x71')](_0x1a641b,{'transaction':_0x28da87});}})['then'](function(){_0x1a641b['forEach'](function(_0x4472ae){socket[_0xd921('0x5e')](_0xd921('0x72'),{'UserId':_0x4472ae,'MailQueueId':_0x41c6b9['id']});});});});});});})[_0xd921('0x19')](respondWithStatusCode(_0x4e2b54,null))[_0xd921('0x3c')](handleError(_0x4e2b54,null));};exports['addAgents']=function(_0x47a312,_0x44b130){return db[_0xd921('0x1d')][_0xd921('0x31')]({'where':{'id':_0x47a312[_0xd921('0x3e')]['id']}})[_0xd921('0x19')](handleEntityNotFound(_0x44b130,null))[_0xd921('0x19')](function(_0x53f5b9){if(_0x53f5b9){return _0x53f5b9[_0xd921('0x73')](_0x47a312['body']['ids'],_[_0xd921('0x74')](_0x47a312[_0xd921('0x33')],[_0xd921('0x54'),'id'])||{})[_0xd921('0x75')](function(_0x2d4971){for(var _0x36692c=0x0;_0x36692c<_0x47a312[_0xd921('0x33')][_0xd921('0x54')][_0xd921('0x2e')];_0x36692c+=0x1){socket['emit'](_0xd921('0x5f'),{'UserId':Number(_0x47a312['body'][_0xd921('0x54')][_0x36692c]),'MailQueueId':Number(_0x47a312[_0xd921('0x3e')]['id'])});}return _0x2d4971;});}})[_0xd921('0x19')](respondWithResult(_0x44b130,null))[_0xd921('0x3c')](handleError(_0x44b130,null));};exports['removeAgents']=function(_0xc905df,_0x325bac){return db[_0xd921('0x1d')][_0xd921('0x31')]({'where':{'id':_0xc905df[_0xd921('0x3e')]['id']}})[_0xd921('0x19')](handleEntityNotFound(_0x325bac,null))[_0xd921('0x19')](function(_0x2ebf4f){if(_0x2ebf4f){return _0x2ebf4f[_0xd921('0x71')](_0xc905df[_0xd921('0x24')][_0xd921('0x54')])[_0xd921('0x19')](function(){if(_[_0xd921('0x76')](_0xc905df[_0xd921('0x24')][_0xd921('0x54')])){for(var _0x363bad=0x0;_0x363bad<_0xc905df[_0xd921('0x24')][_0xd921('0x54')]['length'];_0x363bad+=0x1){socket[_0xd921('0x5e')](_0xd921('0x72'),{'UserId':Number(_0xc905df[_0xd921('0x24')][_0xd921('0x54')][_0x363bad]),'MailQueueId':Number(_0xc905df[_0xd921('0x3e')]['id'])});}}else{socket[_0xd921('0x5e')](_0xd921('0x72'),{'UserId':Number(_0xc905df[_0xd921('0x24')][_0xd921('0x54')]),'MailQueueId':Number(_0xc905df[_0xd921('0x3e')]['id'])});}});}})[_0xd921('0x19')](respondWithStatusCode(_0x325bac,null))[_0xd921('0x3c')](handleError(_0x325bac,null));};exports[_0xd921('0x77')]=function(_0x13fabd,_0x1d6e29){var _0x4b212c={};var _0x45435a={};var _0x2ded74;var _0x291287;return db['MailQueue'][_0xd921('0x78')]({'where':{'id':_0x13fabd[_0xd921('0x3e')]['id']}})[_0xd921('0x19')](handleEntityNotFound(_0x1d6e29,null))[_0xd921('0x19')](function(_0xb45cdf){if(_0xb45cdf){_0x2ded74=_0xb45cdf;_0x45435a[_0xd921('0x28')]=_[_0xd921('0x29')](db[_0xd921('0x49')][_0xd921('0x2a')]);_0x45435a[_0xd921('0x24')]=_['keys'](_0x13fabd[_0xd921('0x24')]);_0x45435a[_0xd921('0x2b')]=_['intersection'](_0x45435a[_0xd921('0x28')],_0x45435a[_0xd921('0x24')]);_0x4b212c[_0xd921('0x2c')]=_[_0xd921('0x2d')](_0x45435a[_0xd921('0x28')],qs[_0xd921('0x52')](_0x13fabd['query'][_0xd921('0x52')]));_0x4b212c['attributes']=_0x4b212c['attributes'][_0xd921('0x2e')]?_0x4b212c[_0xd921('0x2c')]:_0x45435a[_0xd921('0x28')];_0x4b212c[_0xd921('0x43')]=qs[_0xd921('0x44')](_0x13fabd[_0xd921('0x24')][_0xd921('0x44')]);_0x4b212c[_0xd921('0x22')]=qs['filters'](_[_0xd921('0x45')](_0x13fabd[_0xd921('0x24')],_0x45435a[_0xd921('0x2b')]));if(_0x13fabd['query'][_0xd921('0x46')]){_0x4b212c[_0xd921('0x22')]=_[_0xd921('0x30')](_0x4b212c[_0xd921('0x22')],{'$or':_[_0xd921('0x47')](_0x4b212c[_0xd921('0x2c')],function(_0x265921){var _0x1d1fd0={};_0x1d1fd0[_0x265921]={'$like':'%'+_0x13fabd['query'][_0xd921('0x46')]+'%'};return _0x1d1fd0;})});}_0x4b212c=_[_0xd921('0x30')]({},_0x4b212c,_0x13fabd[_0xd921('0x48')]);return _0x2ded74[_0xd921('0x77')](_0x4b212c);}})[_0xd921('0x19')](function(_0x28a358){if(_0x28a358){_0x291287=_0x28a358[_0xd921('0x2e')];if(!_0x13fabd[_0xd921('0x24')][_0xd921('0x79')]('nolimit')){_0x4b212c['limit']=qs[_0xd921('0x13')](_0x13fabd[_0xd921('0x24')][_0xd921('0x13')]);_0x4b212c[_0xd921('0x11')]=qs[_0xd921('0x11')](_0x13fabd['query'][_0xd921('0x11')]);}return _0x2ded74[_0xd921('0x77')](_0x4b212c);}})[_0xd921('0x19')](function(_0x3731bc){if(_0x3731bc){return _0x3731bc?{'count':_0x291287,'rows':_0x3731bc}:null;}})['then'](respondWithResult(_0x1d6e29,null))[_0xd921('0x3c')](handleError(_0x1d6e29,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 77e1ba4..aab40d4 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 _0xd1da=['emit','hasOwnProperty','events','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xd1da,0x104));var _0xad1d=function(_0x4ec9e3,_0x15fbf4){_0x4ec9e3=_0x4ec9e3-0x0;var _0x2883ce=_0xd1da[_0x4ec9e3];return _0x2883ce;};'use strict';var EventEmitter=require(_0xad1d('0x0'));var MailQueue=require(_0xad1d('0x1'))['db'][_0xad1d('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xad1d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x194280){return function(_0x253d37,_0x52fab5,_0x2d309b){MailQueueEvents[_0xad1d('0x4')](_0x194280+':'+_0x253d37['id'],_0x253d37);MailQueueEvents[_0xad1d('0x4')](_0x194280,_0x253d37);_0x2d309b(null);};}for(var e in events){if(events[_0xad1d('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x1263=['hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x36cf91,_0x43734e){var _0x3dc100=function(_0x324a38){while(--_0x324a38){_0x36cf91['push'](_0x36cf91['shift']());}};_0x3dc100(++_0x43734e);}(_0x1263,0x91));var _0x3126=function(_0x2d75c7,_0x40b40c){_0x2d75c7=_0x2d75c7-0x0;var _0x44d832=_0x1263[_0x2d75c7];return _0x44d832;};'use strict';var EventEmitter=require(_0x3126('0x0'));var MailQueue=require(_0x3126('0x1'))['db'][_0x3126('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x3126('0x3')](0x0);var events={'afterCreate':_0x3126('0x4'),'afterUpdate':_0x3126('0x5'),'afterDestroy':_0x3126('0x6')};function emitEvent(_0x12cea7){return function(_0x2a6649,_0x36577b,_0x128596){MailQueueEvents[_0x3126('0x7')](_0x12cea7+':'+_0x2a6649['id'],_0x2a6649);MailQueueEvents[_0x3126('0x7')](_0x12cea7,_0x2a6649);_0x128596(null);};}for(var e in events){if(events[_0x3126('0x8')](e)){var event=events[e];MailQueue[_0x3126('0x9')](e,emitEvent(event));}}module[_0x3126('0xa')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 446f6ec..c310541 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 _0x7303=['path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','../../config/logger','api','bluebird'];(function(_0x471aaa,_0x2421b2){var _0x2e6423=function(_0x29e11a){while(--_0x29e11a){_0x471aaa['push'](_0x471aaa['shift']());}};_0x2e6423(++_0x2421b2);}(_0x7303,0x98));var _0x3730=function(_0x395e09,_0xa875e2){_0x395e09=_0x395e09-0x0;var _0x50816a=_0x7303[_0x395e09];return _0x50816a;};'use strict';var _=require(_0x3730('0x0'));var util=require('util');var logger=require(_0x3730('0x1'))(_0x3730('0x2'));var moment=require('moment');var BPromise=require(_0x3730('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3730('0x4'));var rimraf=require(_0x3730('0x5'));var config=require(_0x3730('0x6'));var attributes=require(_0x3730('0x7'));module[_0x3730('0x8')]=function(_0xd32a88,_0x11c538){return _0xd32a88[_0x3730('0x9')](_0x3730('0xa'),attributes,{'tableName':_0x3730('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fde=['../../config/environment','./mailQueue.attributes','exports','define','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x747ec,_0x145b4b){var _0x4a06bd=function(_0x4d14ad){while(--_0x4d14ad){_0x747ec['push'](_0x747ec['shift']());}};_0x4a06bd(++_0x145b4b);}(_0x8fde,0xcc));var _0xe8fd=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x8fde[_0x35885a];return _0xe86249;};'use strict';var _=require(_0xe8fd('0x0'));var util=require(_0xe8fd('0x1'));var logger=require(_0xe8fd('0x2'))(_0xe8fd('0x3'));var moment=require(_0xe8fd('0x4'));var BPromise=require('bluebird');var rp=require(_0xe8fd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe8fd('0x6'));var attributes=require(_0xe8fd('0x7'));module[_0xe8fd('0x8')]=function(_0x478713,_0xaa58fd){return _0x478713[_0xe8fd('0x9')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 301b862..3ec1e01 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 _0xfca2=['info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MailQueue','findAll','options','where','attributes','limit','include','model','map','GetMailQueue','find','raw','ShowMailQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then'];(function(_0xdd7fe0,_0x5541f6){var _0x593929=function(_0x471dbc){while(--_0x471dbc){_0xdd7fe0['push'](_0xdd7fe0['shift']());}};_0x593929(++_0x5541f6);}(_0xfca2,0x6d));var _0x2fca=function(_0x434804,_0x415f68){_0x434804=_0x434804-0x0;var _0x573fc8=_0xfca2[_0x434804];return _0x573fc8;};'use strict';var _=require(_0x2fca('0x0'));var util=require('util');var moment=require(_0x2fca('0x1'));var BPromise=require(_0x2fca('0x2'));var rs=require(_0x2fca('0x3'));var fs=require('fs');var Redis=require(_0x2fca('0x4'));var db=require(_0x2fca('0x5'))['db'];var utils=require(_0x2fca('0x6'));var logger=require(_0x2fca('0x7'))(_0x2fca('0x8'));var config=require('../../config/environment');var jayson=require(_0x2fca('0x9'));var client=jayson[_0x2fca('0xa')][_0x2fca('0xb')]({'port':0x232a});config[_0x2fca('0xc')]=_[_0x2fca('0xd')](config['redis'],{'host':_0x2fca('0xe'),'port':0x18eb});var socket=require(_0x2fca('0xf'))(new Redis(config['redis']));require(_0x2fca('0x10'))[_0x2fca('0x11')](socket);function respondWithRpcPromise(_0x31ed9e,_0x11c87b,_0x5bfbbf){return new BPromise(function(_0x1f3512,_0x448578){return client[_0x2fca('0x12')](_0x31ed9e,_0x5bfbbf)[_0x2fca('0x13')](function(_0x18110d){logger[_0x2fca('0x14')](_0x2fca('0x15'),_0x11c87b,_0x2fca('0x16'));logger[_0x2fca('0x17')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x11c87b,_0x2fca('0x16'),JSON[_0x2fca('0x18')](_0x18110d));if(_0x18110d['error']){if(_0x18110d[_0x2fca('0x19')][_0x2fca('0x1a')]===0x1f4){logger[_0x2fca('0x19')]('MailQueue,\x20%s,\x20%s',_0x11c87b,_0x18110d['error']['message']);return _0x448578(_0x18110d[_0x2fca('0x19')][_0x2fca('0x1b')]);}logger[_0x2fca('0x19')](_0x2fca('0x15'),_0x11c87b,_0x18110d['error'][_0x2fca('0x1b')]);return _0x1f3512(_0x18110d[_0x2fca('0x19')][_0x2fca('0x1b')]);}else{logger[_0x2fca('0x14')](_0x2fca('0x15'),_0x11c87b,_0x2fca('0x16'));_0x1f3512(_0x18110d[_0x2fca('0x1c')]['message']);}})[_0x2fca('0x1d')](function(_0x442e04){logger[_0x2fca('0x19')]('MailQueue,\x20%s,\x20%s',_0x11c87b,_0x442e04);_0x448578(_0x442e04);});});}exports['GetMailQueue']=function(_0x3162a4){var _0x2a0347=this;return new Promise(function(_0x348b50,_0x2b1a26){return db[_0x2fca('0x1e')][_0x2fca('0x1f')]({'raw':_0x3162a4[_0x2fca('0x20')]?_0x3162a4[_0x2fca('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x3162a4['options']?_0x3162a4[_0x2fca('0x20')][_0x2fca('0x21')]||null:null,'attributes':_0x3162a4[_0x2fca('0x20')]?_0x3162a4['options'][_0x2fca('0x22')]||null:null,'limit':_0x3162a4[_0x2fca('0x20')]?_0x3162a4[_0x2fca('0x20')][_0x2fca('0x23')]||null:null,'include':_0x3162a4[_0x2fca('0x20')]?_0x3162a4[_0x2fca('0x20')][_0x2fca('0x24')]?_['map'](_0x3162a4[_0x2fca('0x20')][_0x2fca('0x24')],function(_0x3b8d1b){return{'model':db[_0x3b8d1b[_0x2fca('0x25')]],'as':_0x3b8d1b['as'],'attributes':_0x3b8d1b['attributes'],'include':_0x3b8d1b[_0x2fca('0x24')]?_[_0x2fca('0x26')](_0x3b8d1b[_0x2fca('0x24')],function(_0x2b8016){return{'model':db[_0x2b8016[_0x2fca('0x25')]],'as':_0x2b8016['as'],'attributes':_0x2b8016[_0x2fca('0x22')],'include':_0x2b8016[_0x2fca('0x24')]?_[_0x2fca('0x26')](_0x2b8016[_0x2fca('0x24')],function(_0x10bd01){return{'model':db[_0x10bd01[_0x2fca('0x25')]],'as':_0x10bd01['as'],'attributes':_0x10bd01['attributes']};}):[]};}):[]};}):[]:[]})[_0x2fca('0x13')](function(_0x5f1223){logger[_0x2fca('0x14')](_0x2fca('0x27'),_0x3162a4);logger['debug'](_0x2fca('0x27'),_0x3162a4,JSON['stringify'](_0x5f1223));_0x348b50(_0x5f1223);})['catch'](function(_0x41bbca){logger[_0x2fca('0x19')]('GetMailQueue',_0x41bbca[_0x2fca('0x1b')],_0x3162a4);_0x2b1a26(_0x2a0347[_0x2fca('0x19')](0x1f4,_0x41bbca[_0x2fca('0x1b')]));});});};exports['ShowMailQueue']=function(_0x42e1ee){var _0x25f267=this;return new Promise(function(_0x1dde49,_0xb809db){return db[_0x2fca('0x1e')][_0x2fca('0x28')]({'raw':_0x42e1ee[_0x2fca('0x20')]?_0x42e1ee['options'][_0x2fca('0x29')]===undefined?!![]:![]:!![],'where':_0x42e1ee[_0x2fca('0x20')]?_0x42e1ee[_0x2fca('0x20')][_0x2fca('0x21')]||null:null,'attributes':_0x42e1ee[_0x2fca('0x20')]?_0x42e1ee[_0x2fca('0x20')][_0x2fca('0x22')]||null:null,'include':_0x42e1ee[_0x2fca('0x20')]?_0x42e1ee[_0x2fca('0x20')][_0x2fca('0x24')]?_[_0x2fca('0x26')](_0x42e1ee[_0x2fca('0x20')][_0x2fca('0x24')],function(_0x288ec2){return{'model':db[_0x288ec2[_0x2fca('0x25')]],'as':_0x288ec2['as'],'attributes':_0x288ec2[_0x2fca('0x22')],'include':_0x288ec2[_0x2fca('0x24')]?_['map'](_0x288ec2[_0x2fca('0x24')],function(_0x5af54e){return{'model':db[_0x5af54e[_0x2fca('0x25')]],'as':_0x5af54e['as'],'attributes':_0x5af54e[_0x2fca('0x22')],'include':_0x5af54e['include']?_[_0x2fca('0x26')](_0x5af54e['include'],function(_0x4fbfa0){return{'model':db[_0x4fbfa0[_0x2fca('0x25')]],'as':_0x4fbfa0['as'],'attributes':_0x4fbfa0[_0x2fca('0x22')]};}):[]};}):[]};}):[]:[]})[_0x2fca('0x13')](function(_0x1fa1e4){logger[_0x2fca('0x14')](_0x2fca('0x2a'),_0x42e1ee);logger['debug']('ShowMailQueue',_0x42e1ee,JSON[_0x2fca('0x18')](_0x1fa1e4));_0x1dde49(_0x1fa1e4);})['catch'](function(_0x3ff324){logger['error']('ShowMailQueue',_0x3ff324[_0x2fca('0x1b')],_0x42e1ee);_0xb809db(_0x25f267[_0x2fca('0x19')](0x1f4,_0x3ff324[_0x2fca('0x1b')]));});});}; \ No newline at end of file +var _0xc181=['catch','options','raw','where','attributes','limit','map','model','include','then','info','GetMailQueue','ShowMailQueue','MailQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1648df,_0x1107a7){var _0x2f5d2b=function(_0x241f45){while(--_0x241f45){_0x1648df['push'](_0x1648df['shift']());}};_0x2f5d2b(++_0x1107a7);}(_0xc181,0x126));var _0x1c18=function(_0x3cec45,_0x37d817){_0x3cec45=_0x3cec45-0x0;var _0x51d691=_0xc181[_0x3cec45];return _0x51d691;};'use strict';var _=require(_0x1c18('0x0'));var util=require(_0x1c18('0x1'));var moment=require('moment');var BPromise=require(_0x1c18('0x2'));var rs=require(_0x1c18('0x3'));var fs=require('fs');var Redis=require(_0x1c18('0x4'));var db=require(_0x1c18('0x5'))['db'];var utils=require(_0x1c18('0x6'));var logger=require('../../config/logger')(_0x1c18('0x7'));var config=require(_0x1c18('0x8'));var jayson=require(_0x1c18('0x9'));var client=jayson[_0x1c18('0xa')][_0x1c18('0xb')]({'port':0x232a});config[_0x1c18('0xc')]=_[_0x1c18('0xd')](config[_0x1c18('0xc')],{'host':_0x1c18('0xe'),'port':0x18eb});var socket=require(_0x1c18('0xf'))(new Redis(config[_0x1c18('0xc')]));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x80e7b0,_0x29b678,_0x2934af){return new BPromise(function(_0x50a9ad,_0x437ea5){return client[_0x1c18('0x10')](_0x80e7b0,_0x2934af)['then'](function(_0x4b5aaa){logger['info'](_0x1c18('0x11'),_0x29b678,_0x1c18('0x12'));logger[_0x1c18('0x13')](_0x1c18('0x14'),_0x29b678,'request\x20sent',JSON[_0x1c18('0x15')](_0x4b5aaa));if(_0x4b5aaa[_0x1c18('0x16')]){if(_0x4b5aaa[_0x1c18('0x16')][_0x1c18('0x17')]===0x1f4){logger[_0x1c18('0x16')](_0x1c18('0x11'),_0x29b678,_0x4b5aaa['error'][_0x1c18('0x18')]);return _0x437ea5(_0x4b5aaa['error'][_0x1c18('0x18')]);}logger[_0x1c18('0x16')]('MailQueue,\x20%s,\x20%s',_0x29b678,_0x4b5aaa[_0x1c18('0x16')][_0x1c18('0x18')]);return _0x50a9ad(_0x4b5aaa[_0x1c18('0x16')][_0x1c18('0x18')]);}else{logger['info'](_0x1c18('0x11'),_0x29b678,'request\x20sent');_0x50a9ad(_0x4b5aaa[_0x1c18('0x19')][_0x1c18('0x18')]);}})[_0x1c18('0x1a')](function(_0x1262bb){logger[_0x1c18('0x16')](_0x1c18('0x11'),_0x29b678,_0x1262bb);_0x437ea5(_0x1262bb);});});}exports['GetMailQueue']=function(_0x38942d){var _0x53c44c=this;return new Promise(function(_0x599140,_0x591d7a){return db['MailQueue']['findAll']({'raw':_0x38942d[_0x1c18('0x1b')]?_0x38942d[_0x1c18('0x1b')][_0x1c18('0x1c')]===undefined?!![]:![]:!![],'where':_0x38942d[_0x1c18('0x1b')]?_0x38942d['options'][_0x1c18('0x1d')]||null:null,'attributes':_0x38942d['options']?_0x38942d['options'][_0x1c18('0x1e')]||null:null,'limit':_0x38942d[_0x1c18('0x1b')]?_0x38942d['options'][_0x1c18('0x1f')]||null:null,'include':_0x38942d[_0x1c18('0x1b')]?_0x38942d[_0x1c18('0x1b')]['include']?_[_0x1c18('0x20')](_0x38942d[_0x1c18('0x1b')]['include'],function(_0x3fa7c7){return{'model':db[_0x3fa7c7[_0x1c18('0x21')]],'as':_0x3fa7c7['as'],'attributes':_0x3fa7c7[_0x1c18('0x1e')],'include':_0x3fa7c7['include']?_['map'](_0x3fa7c7['include'],function(_0x349120){return{'model':db[_0x349120[_0x1c18('0x21')]],'as':_0x349120['as'],'attributes':_0x349120[_0x1c18('0x1e')],'include':_0x349120[_0x1c18('0x22')]?_['map'](_0x349120['include'],function(_0x5a5a95){return{'model':db[_0x5a5a95['model']],'as':_0x5a5a95['as'],'attributes':_0x5a5a95[_0x1c18('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1c18('0x23')](function(_0x5018ea){logger[_0x1c18('0x24')](_0x1c18('0x25'),_0x38942d);logger[_0x1c18('0x13')]('GetMailQueue',_0x38942d,JSON[_0x1c18('0x15')](_0x5018ea));_0x599140(_0x5018ea);})[_0x1c18('0x1a')](function(_0xcfa8a9){logger['error']('GetMailQueue',_0xcfa8a9[_0x1c18('0x18')],_0x38942d);_0x591d7a(_0x53c44c[_0x1c18('0x16')](0x1f4,_0xcfa8a9[_0x1c18('0x18')]));});});};exports[_0x1c18('0x26')]=function(_0x530411){var _0x1e5735=this;return new Promise(function(_0x22100c,_0x9a35ba){return db[_0x1c18('0x27')]['find']({'raw':_0x530411[_0x1c18('0x1b')]?_0x530411['options']['raw']===undefined?!![]:![]:!![],'where':_0x530411[_0x1c18('0x1b')]?_0x530411[_0x1c18('0x1b')][_0x1c18('0x1d')]||null:null,'attributes':_0x530411[_0x1c18('0x1b')]?_0x530411[_0x1c18('0x1b')][_0x1c18('0x1e')]||null:null,'include':_0x530411[_0x1c18('0x1b')]?_0x530411['options'][_0x1c18('0x22')]?_[_0x1c18('0x20')](_0x530411['options']['include'],function(_0x51b835){return{'model':db[_0x51b835[_0x1c18('0x21')]],'as':_0x51b835['as'],'attributes':_0x51b835[_0x1c18('0x1e')],'include':_0x51b835[_0x1c18('0x22')]?_[_0x1c18('0x20')](_0x51b835['include'],function(_0x46ea89){return{'model':db[_0x46ea89[_0x1c18('0x21')]],'as':_0x46ea89['as'],'attributes':_0x46ea89[_0x1c18('0x1e')],'include':_0x46ea89[_0x1c18('0x22')]?_['map'](_0x46ea89[_0x1c18('0x22')],function(_0x58cc20){return{'model':db[_0x58cc20[_0x1c18('0x21')]],'as':_0x58cc20['as'],'attributes':_0x58cc20[_0x1c18('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1c18('0x23')](function(_0x28ffe8){logger[_0x1c18('0x24')](_0x1c18('0x26'),_0x530411);logger[_0x1c18('0x13')](_0x1c18('0x26'),_0x530411,JSON['stringify'](_0x28ffe8));_0x22100c(_0x28ffe8);})['catch'](function(_0x1174d8){logger['error'](_0x1c18('0x26'),_0x1174d8['message'],_0x530411);_0x9a35ba(_0x1e5735[_0x1c18('0x16')](0x1f4,_0x1174d8[_0x1c18('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 2fdebd5..1b7ee6f 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 _0x6cd8=['save','remove','update','emit','removeListener','register','length','mailQueue:','./mailQueue.events'];(function(_0x25fab6,_0x5a127a){var _0x68e322=function(_0x456319){while(--_0x456319){_0x25fab6['push'](_0x25fab6['shift']());}};_0x68e322(++_0x5a127a);}(_0x6cd8,0x194));var _0x86cd=function(_0x1d8305,_0x1e63c6){_0x1d8305=_0x1d8305-0x0;var _0x183f62=_0x6cd8[_0x1d8305];return _0x183f62;};'use strict';var MailQueueEvents=require(_0x86cd('0x0'));var events=[_0x86cd('0x1'),_0x86cd('0x2'),_0x86cd('0x3')];function createListener(_0x499329,_0x445398){return function(_0x551a35){_0x445398[_0x86cd('0x4')](_0x499329,_0x551a35);};}function removeListener(_0x49ed86,_0x24d1e7){return function(){MailQueueEvents[_0x86cd('0x5')](_0x49ed86,_0x24d1e7);};}exports[_0x86cd('0x6')]=function(_0x248328){for(var _0x2d42ca=0x0,_0x1b6863=events[_0x86cd('0x7')];_0x2d42ca<_0x1b6863;_0x2d42ca++){var _0x2262c1=events[_0x2d42ca];var _0x457c3e=createListener(_0x86cd('0x8')+_0x2262c1,_0x248328);MailQueueEvents['on'](_0x2262c1,_0x457c3e);}}; \ No newline at end of file +var _0x0901=['removeListener','register','length','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x527824,_0xc824a9){var _0xc8b8ed=function(_0x1b0e19){while(--_0x1b0e19){_0x527824['push'](_0x527824['shift']());}};_0xc8b8ed(++_0xc824a9);}(_0x0901,0x134));var _0x1090=function(_0x38a3ce,_0x40dea5){_0x38a3ce=_0x38a3ce-0x0;var _0x49a0fc=_0x0901[_0x38a3ce];return _0x49a0fc;};'use strict';var MailQueueEvents=require(_0x1090('0x0'));var events=[_0x1090('0x1'),_0x1090('0x2'),_0x1090('0x3')];function createListener(_0x448052,_0x39d2f1){return function(_0x57800a){_0x39d2f1['emit'](_0x448052,_0x57800a);};}function removeListener(_0x698fbb,_0xf8da8c){return function(){MailQueueEvents[_0x1090('0x4')](_0x698fbb,_0xf8da8c);};}exports[_0x1090('0x5')]=function(_0x9a1121){for(var _0x395921=0x0,_0x4c4e89=events[_0x1090('0x6')];_0x395921<_0x4c4e89;_0x395921++){var _0x3c1afe=events[_0x395921];var _0x5cd3f0=createListener(_0x1090('0x7')+_0x3c1afe,_0x9a1121);MailQueueEvents['on'](_0x3c1afe,_0x5cd3f0);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 414ff8f..75aa183 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 _0x32af=['express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','util','connect-timeout'];(function(_0x40942e,_0x54c755){var _0x5a4935=function(_0xbdb5b4){while(--_0xbdb5b4){_0x40942e['push'](_0x40942e['shift']());}};_0x5a4935(++_0x54c755);}(_0x32af,0x1c0));var _0xf32a=function(_0x212be8,_0x15c512){_0x212be8=_0x212be8-0x0;var _0x398c46=_0x32af[_0x212be8];return _0x398c46;};'use strict';var multer=require('multer');var util=require(_0xf32a('0x0'));var path=require('path');var timeout=require(_0xf32a('0x1'));var express=require(_0xf32a('0x2'));var router=express[_0xf32a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf32a('0x4'));var interaction=require(_0xf32a('0x5'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0xf32a('0x6')]('/',auth[_0xf32a('0x7')](),controller['index']);router[_0xf32a('0x6')](_0xf32a('0x8'),auth[_0xf32a('0x7')](),controller[_0xf32a('0x9')]);router['get'](_0xf32a('0xa'),auth[_0xf32a('0x7')](),controller[_0xf32a('0xb')]);router[_0xf32a('0xc')]('/',auth[_0xf32a('0x7')](),controller[_0xf32a('0xd')]);router['put'](_0xf32a('0xa'),auth[_0xf32a('0x7')](),controller[_0xf32a('0xe')]);router[_0xf32a('0xf')](_0xf32a('0xa'),auth[_0xf32a('0x7')](),controller[_0xf32a('0x10')]);module[_0xf32a('0x11')]=router; \ No newline at end of file +var _0x5bde=['/:id','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','describe'];(function(_0x108b78,_0x28a619){var _0x3f81ed=function(_0x117143){while(--_0x117143){_0x108b78['push'](_0x108b78['shift']());}};_0x3f81ed(++_0x28a619);}(_0x5bde,0x183));var _0xe5bd=function(_0x1ab675,_0x5c0e99){_0x1ab675=_0x1ab675-0x0;var _0xb0195f=_0x5bde[_0x1ab675];return _0xb0195f;};'use strict';var multer=require(_0xe5bd('0x0'));var util=require('util');var path=require(_0xe5bd('0x1'));var timeout=require(_0xe5bd('0x2'));var express=require(_0xe5bd('0x3'));var router=express[_0xe5bd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe5bd('0x5'));var interaction=require(_0xe5bd('0x6'));var config=require(_0xe5bd('0x7'));var controller=require(_0xe5bd('0x8'));router[_0xe5bd('0x9')]('/',auth[_0xe5bd('0xa')](),controller[_0xe5bd('0xb')]);router['get']('/describe',auth[_0xe5bd('0xa')](),controller[_0xe5bd('0xc')]);router[_0xe5bd('0x9')](_0xe5bd('0xd'),auth[_0xe5bd('0xa')](),controller['show']);router[_0xe5bd('0xe')]('/',auth[_0xe5bd('0xa')](),controller[_0xe5bd('0xf')]);router[_0xe5bd('0x10')](_0xe5bd('0xd'),auth[_0xe5bd('0xa')](),controller['update']);router[_0xe5bd('0x11')](_0xe5bd('0xd'),auth[_0xe5bd('0xa')](),controller[_0xe5bd('0x12')]);module[_0xe5bd('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 6d7bc81..7bfc7c1 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 _0x8892=['exports','STRING','DATE','sequelize'];(function(_0x48a04f,_0x5b3f05){var _0x479bf1=function(_0x5d31c3){while(--_0x5d31c3){_0x48a04f['push'](_0x48a04f['shift']());}};_0x479bf1(++_0x5b3f05);}(_0x8892,0x14f));var _0x2889=function(_0x3380c8,_0x2da490){_0x3380c8=_0x3380c8-0x0;var _0x381bb5=_0x8892[_0x3380c8];return _0x381bb5;};'use strict';var moment=require('moment');var Sequelize=require(_0x2889('0x0'));module[_0x2889('0x1')]={'uniqueid':{'type':Sequelize[_0x2889('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x2889('0x3')]},'reason':{'type':Sequelize[_0x2889('0x2')]}}; \ No newline at end of file +var _0xef26=['DATE','sequelize','exports','STRING'];(function(_0x5302cf,_0x308b53){var _0x10b32e=function(_0x36a32b){while(--_0x36a32b){_0x5302cf['push'](_0x5302cf['shift']());}};_0x10b32e(++_0x308b53);}(_0xef26,0x71));var _0x6ef2=function(_0x87e5e7,_0x32097a){_0x87e5e7=_0x87e5e7-0x0;var _0x5317ff=_0xef26[_0x87e5e7];return _0x5317ff;};'use strict';var moment=require('moment');var Sequelize=require(_0x6ef2('0x0'));module[_0x6ef2('0x1')]={'uniqueid':{'type':Sequelize[_0x6ef2('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6ef2('0x2')]},'joinAt':{'type':Sequelize[_0x6ef2('0x3')]},'leaveAt':{'type':Sequelize[_0x6ef2('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6ef2('0x3')]},'reason':{'type':Sequelize[_0x6ef2('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 30293fe..f39369a 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 _0x524e=['end','json','offset','limit','count','set','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','MailQueueReport','then','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x174780,_0x498fcd){var _0x5d4208=function(_0x44ef8c){while(--_0x44ef8c){_0x174780['push'](_0x174780['shift']());}};_0x5d4208(++_0x498fcd);}(_0x524e,0x15e));var _0xe524=function(_0x115459,_0x1984df){_0x115459=_0x115459-0x0;var _0x3d46e5=_0x524e[_0x115459];return _0x3d46e5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1c')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1d')](_0x4b0f51)[_0xe524('0x1e')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x1f')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=typeof _0x48165e[_0xe524('0x20')]==='undefined'&&typeof _0x48165e[_0xe524('0x21')]==='undefined';var _0x5c8736=_0x569660['count'];var _0x3a4027=_0x488fce?0x0:_0x48165e['offset'];var _0x11b2a1=_0x488fce?_0x569660[_0xe524('0x22')]:_0x48165e[_0xe524('0x20')]+_0x48165e[_0xe524('0x21')];var _0x5d7b17;if(_0x11b2a1>=_0x5c8736){_0x11b2a1=_0x5c8736;_0x5d7b17=0xc8;}else{_0x5d7b17=0xce;}_0x1b0af6[_0xe524('0x1d')](_0x5d7b17);return _0x1b0af6[_0xe524('0x23')]('Content-Range',_0x3a4027+'-'+_0x11b2a1+'/'+_0x5c8736)[_0xe524('0x1f')](_0x569660);}return null;};}function patchUpdates(_0x309f85){return function(_0x43a4f9){try{jsonpatch[_0xe524('0x24')](_0x43a4f9,_0x309f85,!![]);}catch(_0x1c4194){return BPromise[_0xe524('0x25')](_0x1c4194);}return _0x43a4f9[_0xe524('0x26')]();};}function saveUpdates(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x27')](_0x375219)['then'](function(_0x577d1f){return _0x577d1f;});}return null;};}function removeEntity(_0x2d2f83,_0x23df5e){return function(_0x1ad106){if(_0x1ad106){return _0x1ad106[_0xe524('0x28')]()['then'](function(){_0x2d2f83[_0xe524('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e245,_0xcf5db){return function(_0xd62772){if(!_0xd62772){_0x17e245[_0xe524('0x1c')](0x194);}return _0xd62772;};}function handleError(_0x4102d9,_0xfd5965){_0xfd5965=_0xfd5965||0x1f4;return function(_0x2141db){logger['error'](_0x2141db['stack']);if(_0x2141db[_0xe524('0x29')]){delete _0x2141db[_0xe524('0x29')];}_0x4102d9[_0xe524('0x1d')](_0xfd5965)[_0xe524('0x2a')](_0x2141db);};}exports[_0xe524('0x2b')]=function(_0x5405e4,_0x52f140){var _0x4b1ff={},_0x25e7a7={},_0x3aedd9={'count':0x0,'rows':[]};var _0x8070e4=_[_0xe524('0x2c')](db['MailQueueReport'][_0xe524('0x2d')],function(_0x9a7e98){return{'name':_0x9a7e98['fieldName'],'type':_0x9a7e98['type'][_0xe524('0x2e')]};});_0x25e7a7[_0xe524('0x2f')]=_['map'](_0x8070e4,_0xe524('0x29'));_0x25e7a7['query']=_[_0xe524('0x30')](_0x5405e4['query']);_0x25e7a7[_0xe524('0x31')]=_[_0xe524('0x32')](_0x25e7a7[_0xe524('0x2f')],_0x25e7a7['query']);_0x4b1ff[_0xe524('0x33')]=_['intersection'](_0x25e7a7[_0xe524('0x2f')],qs[_0xe524('0x34')](_0x5405e4[_0xe524('0x35')]['fields']));_0x4b1ff[_0xe524('0x33')]=_0x4b1ff[_0xe524('0x33')]['length']?_0x4b1ff[_0xe524('0x33')]:_0x25e7a7[_0xe524('0x2f')];if(!_0x5405e4[_0xe524('0x35')][_0xe524('0x36')]('nolimit')){_0x4b1ff[_0xe524('0x21')]=qs[_0xe524('0x21')](_0x5405e4[_0xe524('0x35')][_0xe524('0x21')]);_0x4b1ff[_0xe524('0x20')]=qs[_0xe524('0x20')](_0x5405e4[_0xe524('0x35')][_0xe524('0x20')]);}_0x4b1ff['order']=qs[_0xe524('0x37')](_0x5405e4['query'][_0xe524('0x37')]);_0x4b1ff[_0xe524('0x38')]=qs['filters'](_[_0xe524('0x39')](_0x5405e4['query'],_0x25e7a7[_0xe524('0x31')]),_0x8070e4);if(_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]){_0x4b1ff[_0xe524('0x38')]=_[_0xe524('0x3b')](_0x4b1ff[_0xe524('0x38')],{'$or':_[_0xe524('0x2c')](_0x8070e4,function(_0x13762c){if(_0x13762c['type']!==_0xe524('0x3c')){var _0x940c05={};_0x940c05[_0x13762c[_0xe524('0x29')]]={'$like':'%'+_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]+'%'};return _0x940c05;}})});}_0x4b1ff=_[_0xe524('0x3b')]({},_0x4b1ff,_0x5405e4[_0xe524('0x3d')]);var _0x158d45={'where':_0x4b1ff['where']};return db[_0xe524('0x3e')][_0xe524('0x22')](_0x158d45)[_0xe524('0x3f')](function(_0x59781b){_0x3aedd9[_0xe524('0x22')]=_0x59781b;if(_0x5405e4['query'][_0xe524('0x40')]){_0x4b1ff[_0xe524('0x41')]=[{'all':!![]}];}return db[_0xe524('0x3e')][_0xe524('0x42')](_0x4b1ff);})[_0xe524('0x3f')](function(_0x4746cd){_0x3aedd9[_0xe524('0x43')]=_0x4746cd;return _0x3aedd9;})['then'](respondWithFilteredResult(_0x52f140,_0x4b1ff))[_0xe524('0x44')](handleError(_0x52f140,null));};exports[_0xe524('0x45')]=function(_0x13c54c,_0x376505){var _0x438962={'raw':!![],'where':{'id':_0x13c54c['params']['id']}},_0x1ae283={};_0x1ae283[_0xe524('0x2f')]=_[_0xe524('0x30')](db[_0xe524('0x3e')]['rawAttributes']);_0x1ae283[_0xe524('0x35')]=_['keys'](_0x13c54c['query']);_0x1ae283[_0xe524('0x31')]=_[_0xe524('0x32')](_0x1ae283['model'],_0x1ae283[_0xe524('0x35')]);_0x438962[_0xe524('0x33')]=_[_0xe524('0x32')](_0x1ae283[_0xe524('0x2f')],qs['fields'](_0x13c54c['query'][_0xe524('0x34')]));_0x438962[_0xe524('0x33')]=_0x438962['attributes'][_0xe524('0x46')]?_0x438962['attributes']:_0x1ae283[_0xe524('0x2f')];if(_0x13c54c[_0xe524('0x35')][_0xe524('0x40')]){_0x438962[_0xe524('0x41')]=[{'all':!![]}];}_0x438962=_[_0xe524('0x3b')]({},_0x438962,_0x13c54c[_0xe524('0x3d')]);return db[_0xe524('0x3e')][_0xe524('0x47')](_0x438962)[_0xe524('0x3f')](handleEntityNotFound(_0x376505,null))[_0xe524('0x3f')](respondWithResult(_0x376505,null))[_0xe524('0x44')](handleError(_0x376505,null));};exports[_0xe524('0x48')]=function(_0x3d7ab7,_0x33b1c8){return db[_0xe524('0x3e')]['create'](_0x3d7ab7[_0xe524('0x49')],{})['then'](respondWithResult(_0x33b1c8,0xc9))['catch'](handleError(_0x33b1c8,null));};exports[_0xe524('0x27')]=function(_0x59fe6b,_0x232cf0){if(_0x59fe6b[_0xe524('0x49')]['id']){delete _0x59fe6b['body']['id'];}return db[_0xe524('0x3e')]['find']({'where':{'id':_0x59fe6b['params']['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x232cf0,null))[_0xe524('0x3f')](saveUpdates(_0x59fe6b[_0xe524('0x49')],null))['then'](respondWithResult(_0x232cf0,null))['catch'](handleError(_0x232cf0,null));};exports['destroy']=function(_0x4e9c3b,_0x4f7a64){return db['MailQueueReport'][_0xe524('0x47')]({'where':{'id':_0x4e9c3b[_0xe524('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f7a64,null))[_0xe524('0x3f')](removeEntity(_0x4f7a64,null))[_0xe524('0x44')](handleError(_0x4f7a64,null));};exports[_0xe524('0x4b')]=function(_0x208aa8,_0x2fa143){return db['MailQueueReport'][_0xe524('0x4b')]()[_0xe524('0x3f')](respondWithResult(_0x2fa143,null))[_0xe524('0x44')](handleError(_0x2fa143,null));}; \ No newline at end of file +var _0x47c5=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','key','model'];(function(_0x501ecf,_0x3da445){var _0x1a31ad=function(_0x44f355){while(--_0x44f355){_0x501ecf['push'](_0x501ecf['shift']());}};_0x1a31ad(++_0x3da445);}(_0x47c5,0x165));var _0x547c=function(_0x10acc2,_0x381818){_0x10acc2=_0x10acc2-0x0;var _0x5159f0=_0x47c5[_0x10acc2];return _0x5159f0;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x361c5c[_0x547c('0x1d')](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x507895,_0x39c5f9){return function(_0x4c66b9){if(!_0x4c66b9){_0x507895['sendStatus'](0x194);}return _0x4c66b9;};}function handleError(_0x4855fd,_0x478f04){_0x478f04=_0x478f04||0x1f4;return function(_0x2c725d){logger['error'](_0x2c725d[_0x547c('0x2b')]);if(_0x2c725d['name']){delete _0x2c725d[_0x547c('0x2c')];}_0x4855fd['status'](_0x478f04)[_0x547c('0x2d')](_0x2c725d);};}exports[_0x547c('0x2e')]=function(_0x2389de,_0x30a96c){var _0x198afb={},_0x569924={},_0x575c74={'count':0x0,'rows':[]};var _0x28c282=_['map'](db[_0x547c('0x2f')][_0x547c('0x30')],function(_0x3e7652){return{'name':_0x3e7652[_0x547c('0x31')],'type':_0x3e7652[_0x547c('0x32')][_0x547c('0x33')]};});_0x569924[_0x547c('0x34')]=_['map'](_0x28c282,'name');_0x569924[_0x547c('0x35')]=_[_0x547c('0x36')](_0x2389de[_0x547c('0x35')]);_0x569924[_0x547c('0x37')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],_0x569924[_0x547c('0x35')]);_0x198afb[_0x547c('0x39')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],qs[_0x547c('0x3a')](_0x2389de[_0x547c('0x35')][_0x547c('0x3a')]));_0x198afb[_0x547c('0x39')]=_0x198afb['attributes'][_0x547c('0x3b')]?_0x198afb['attributes']:_0x569924['model'];if(!_0x2389de['query'][_0x547c('0x3c')](_0x547c('0x3d'))){_0x198afb[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x2389de[_0x547c('0x35')][_0x547c('0x22')]);_0x198afb['offset']=qs['offset'](_0x2389de['query'][_0x547c('0x20')]);}_0x198afb[_0x547c('0x3e')]=qs[_0x547c('0x3f')](_0x2389de[_0x547c('0x35')][_0x547c('0x3f')]);_0x198afb[_0x547c('0x40')]=qs['filters'](_[_0x547c('0x41')](_0x2389de['query'],_0x569924[_0x547c('0x37')]),_0x28c282);if(_0x2389de[_0x547c('0x35')]['filter']){_0x198afb[_0x547c('0x40')]=_['merge'](_0x198afb['where'],{'$or':_[_0x547c('0x42')](_0x28c282,function(_0x281d52){if(_0x281d52[_0x547c('0x32')]!==_0x547c('0x43')){var _0x4c36b9={};_0x4c36b9[_0x281d52['name']]={'$like':'%'+_0x2389de[_0x547c('0x35')][_0x547c('0x44')]+'%'};return _0x4c36b9;}})});}_0x198afb=_[_0x547c('0x45')]({},_0x198afb,_0x2389de['options']);var _0x3886ae={'where':_0x198afb[_0x547c('0x40')]};return db[_0x547c('0x2f')]['count'](_0x3886ae)[_0x547c('0x2a')](function(_0x3a6a0a){_0x575c74[_0x547c('0x46')]=_0x3a6a0a;if(_0x2389de['query'][_0x547c('0x47')]){_0x198afb[_0x547c('0x48')]=[{'all':!![]}];}return db['MailQueueReport'][_0x547c('0x49')](_0x198afb);})[_0x547c('0x2a')](function(_0x9c3cb2){_0x575c74['rows']=_0x9c3cb2;return _0x575c74;})[_0x547c('0x2a')](respondWithFilteredResult(_0x30a96c,_0x198afb))['catch'](handleError(_0x30a96c,null));};exports[_0x547c('0x4a')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':!![],'where':{'id':_0x5393a2[_0x547c('0x4b')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x34')]=_[_0x547c('0x36')](db['MailQueueReport']['rawAttributes']);_0x3d37d7[_0x547c('0x35')]=_[_0x547c('0x36')](_0x5393a2[_0x547c('0x35')]);_0x3d37d7['filters']=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],_0x3d37d7[_0x547c('0x35')]);_0x414b9d[_0x547c('0x39')]=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],qs['fields'](_0x5393a2[_0x547c('0x35')][_0x547c('0x3a')]));_0x414b9d[_0x547c('0x39')]=_0x414b9d['attributes'][_0x547c('0x3b')]?_0x414b9d[_0x547c('0x39')]:_0x3d37d7[_0x547c('0x34')];if(_0x5393a2[_0x547c('0x35')]['includeAll']){_0x414b9d[_0x547c('0x48')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x4c')]);return db['MailQueueReport'][_0x547c('0x4d')](_0x414b9d)[_0x547c('0x2a')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x4e')](handleError(_0xb86f5f,null));};exports[_0x547c('0x4f')]=function(_0xa005cc,_0x1ddf30){return db['MailQueueReport'][_0x547c('0x4f')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x4e')](handleError(_0x1ddf30,null));};exports[_0x547c('0x28')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x50')]['id']){delete _0x3e3f52[_0x547c('0x50')]['id'];}return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x3e3f52[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x2a')](saveUpdates(_0x3e3f52[_0x547c('0x50')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x29')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x21ea26[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x2a')](removeEntity(_0x48de6e,null))[_0x547c('0x4e')](handleError(_0x48de6e,null));};exports['describe']=function(_0x152982,_0x5258cf){return db[_0x547c('0x2f')][_0x547c('0x51')]()[_0x547c('0x2a')](respondWithResult(_0x5258cf,null))['catch'](handleError(_0x5258cf,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index d798361..a12b6f6 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 _0x3639=['bluebird','request-promise','path','rimraf','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','api','moment'];(function(_0x5225d5,_0x2cf9a4){var _0x41b5b9=function(_0x24dd7a){while(--_0x24dd7a){_0x5225d5['push'](_0x5225d5['shift']());}};_0x41b5b9(++_0x2cf9a4);}(_0x3639,0x6c));var _0x9363=function(_0x1840fe,_0x397fe6){_0x1840fe=_0x1840fe-0x0;var _0x2fbc4e=_0x3639[_0x1840fe];return _0x2fbc4e;};'use strict';var _=require(_0x9363('0x0'));var util=require(_0x9363('0x1'));var logger=require('../../config/logger')(_0x9363('0x2'));var moment=require(_0x9363('0x3'));var BPromise=require(_0x9363('0x4'));var rp=require(_0x9363('0x5'));var fs=require('fs');var path=require(_0x9363('0x6'));var rimraf=require(_0x9363('0x7'));var config=require('../../config/environment');var attributes=require(_0x9363('0x8'));module[_0x9363('0x9')]=function(_0x42c73b,_0x4171f7){return _0x42c73b[_0x9363('0xa')](_0x9363('0xb'),attributes,{'tableName':_0x9363('0xc'),'paranoid':![],'indexes':[{'name':_0x9363('0xd'),'fields':[_0x9363('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9cf8=['exports','MailQueueReport','report_mail_queue','util','api','request-promise','path','../../config/environment','./mailQueueReport.attributes'];(function(_0x78e311,_0x46cc09){var _0x137117=function(_0x533ae8){while(--_0x533ae8){_0x78e311['push'](_0x78e311['shift']());}};_0x137117(++_0x46cc09);}(_0x9cf8,0x1f2));var _0x89cf=function(_0x14c88a,_0x583042){_0x14c88a=_0x14c88a-0x0;var _0x5a7993=_0x9cf8[_0x14c88a];return _0x5a7993;};'use strict';var _=require('lodash');var util=require(_0x89cf('0x0'));var logger=require('../../config/logger')(_0x89cf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x89cf('0x2'));var fs=require('fs');var path=require(_0x89cf('0x3'));var rimraf=require('rimraf');var config=require(_0x89cf('0x4'));var attributes=require(_0x89cf('0x5'));module[_0x89cf('0x6')]=function(_0x44a13c,_0x1c2e0c){return _0x44a13c['define'](_0x89cf('0x7'),attributes,{'tableName':_0x89cf('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 44ec378..15bdebc 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x127c7e,_0x470192){var _0x45f955=function(_0x26dcea){while(--_0x26dcea){_0x127c7e['push'](_0x127c7e['shift']());}};_0x45f955(++_0x470192);}(_0xdb28,0x106));var _0x8db2=function(_0x50a979,_0x37f72c){_0x50a979=_0x50a979-0x0;var _0x384890=_0xdb28[_0x50a979];return _0x384890;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x166b22,_0xf5bb14){var _0x3dca9e=function(_0x182d15){while(--_0x182d15){_0x166b22['push'](_0x166b22['shift']());}};_0x3dca9e(++_0xf5bb14);}(_0x5f2f,0x73));var _0xf5f2=function(_0xfde133,_0x10ad04){_0xfde133=_0xfde133-0x0;var _0x54a0ad=_0x5f2f[_0xfde133];return _0x54a0ad;};'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')]('MailQueueReport,\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);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 1dc4479..3979286 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x34f9a6,_0x29443f){var _0x454ad8=function(_0xcef613){while(--_0xcef613){_0x34f9a6['push'](_0x34f9a6['shift']());}};_0x454ad8(++_0x29443f);}(_0xe706,0xa3));var _0x6e70=function(_0x38c699,_0x56fea7){_0x38c699=_0x38c699-0x0;var _0x3b1ded=_0xe706[_0x38c699];return _0x3b1ded;};'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(_0x2c684a,_0x1a8030){var _0xc553b7=function(_0x5227ac){while(--_0x5227ac){_0x2c684a['push'](_0x2c684a['shift']());}};_0xc553b7(++_0x1a8030);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 73973d8..5b74639 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 _0xbec2=['STRING','BOOLEAN','INTEGER','INBOX','sequelize','exports'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0xbec2,0x166));var _0x2bec=function(_0x3947a8,_0x1919bc){_0x3947a8=_0x3947a8-0x0;var _0x4ba892=_0xbec2[_0x3947a8];return _0x4ba892;};'use strict';var Sequelize=require(_0x2bec('0x0'));module[_0x2bec('0x1')]={'description':{'type':Sequelize[_0x2bec('0x2')]},'host':{'type':Sequelize[_0x2bec('0x2')]},'authentication':{'type':Sequelize[_0x2bec('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x2bec('0x2')]},'password':{'type':Sequelize[_0x2bec('0x2')]},'port':{'type':Sequelize[_0x2bec('0x4')]},'tls':{'type':Sequelize[_0x2bec('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x2bec('0x2')],'defaultValue':_0x2bec('0x5')},'connTimeout':{'type':Sequelize[_0x2bec('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x2bec('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x2bec('0x2')]},'modernAuthentication':{'type':Sequelize[_0x2bec('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xc3c2=['exports','STRING','INTEGER','BOOLEAN','INBOX'];(function(_0x1bb79b,_0xd90599){var _0x3961ba=function(_0x38ef05){while(--_0x38ef05){_0x1bb79b['push'](_0x1bb79b['shift']());}};_0x3961ba(++_0xd90599);}(_0xc3c2,0x64));var _0x2c3c=function(_0x4e12cd,_0x54fd3f){_0x4e12cd=_0x4e12cd-0x0;var _0x210b7a=_0xc3c2[_0x4e12cd];return _0x210b7a;};'use strict';var Sequelize=require('sequelize');module[_0x2c3c('0x0')]={'description':{'type':Sequelize[_0x2c3c('0x1')]},'host':{'type':Sequelize[_0x2c3c('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x2c3c('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x2c3c('0x2')]},'tls':{'type':Sequelize[_0x2c3c('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x2c3c('0x1')],'defaultValue':_0x2c3c('0x4')},'connTimeout':{'type':Sequelize[_0x2c3c('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x2c3c('0x2')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x2c3c('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 7ec26eb..98a0527 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 _0xee34=['bluebird','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','moment'];(function(_0x4974e3,_0x22630b){var _0x5472a3=function(_0x1322b6){while(--_0x1322b6){_0x4974e3['push'](_0x4974e3['shift']());}};_0x5472a3(++_0x22630b);}(_0xee34,0xec));var _0x4ee3=function(_0x23d3bb,_0x436f4d){_0x23d3bb=_0x23d3bb-0x0;var _0x5f183a=_0xee34[_0x23d3bb];return _0x5f183a;};'use strict';var _=require(_0x4ee3('0x0'));var util=require(_0x4ee3('0x1'));var logger=require(_0x4ee3('0x2'))('api');var moment=require(_0x4ee3('0x3'));var BPromise=require(_0x4ee3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ee3('0x5'));var config=require(_0x4ee3('0x6'));var attributes=require(_0x4ee3('0x7'));module[_0x4ee3('0x8')]=function(_0x5a8036,_0x55747e){return _0x5a8036[_0x4ee3('0x9')](_0x4ee3('0xa'),attributes,{'tableName':_0x4ee3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe683=['MailServerIn','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define'];(function(_0x53f95e,_0x21da29){var _0x234ede=function(_0x4aac64){while(--_0x4aac64){_0x53f95e['push'](_0x53f95e['shift']());}};_0x234ede(++_0x21da29);}(_0xe683,0x1ae));var _0x3e68=function(_0x29e1e0,_0x59237f){_0x29e1e0=_0x29e1e0-0x0;var _0x5e0929=_0xe683[_0x29e1e0];return _0x5e0929;};'use strict';var _=require('lodash');var util=require(_0x3e68('0x0'));var logger=require(_0x3e68('0x1'))('api');var moment=require(_0x3e68('0x2'));var BPromise=require(_0x3e68('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e68('0x4'));var rimraf=require(_0x3e68('0x5'));var config=require(_0x3e68('0x6'));var attributes=require(_0x3e68('0x7'));module[_0x3e68('0x8')]=function(_0x5331f5,_0x3b1d8b){return _0x5331f5[_0x3e68('0x9')](_0x3e68('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 5c11f58..2f0b266 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 _0x39d6=['catch','GetMailServerIn','findAll','options','raw','attributes','include','model','map','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x39d6,0x8a));var _0x639d=function(_0x2715cf,_0x517bb2){_0x2715cf=_0x2715cf-0x0;var _0x1bdcb8=_0x39d6[_0x2715cf];return _0x1bdcb8;};'use strict';var _=require(_0x639d('0x0'));var util=require(_0x639d('0x1'));var moment=require(_0x639d('0x2'));var BPromise=require(_0x639d('0x3'));var rs=require(_0x639d('0x4'));var fs=require('fs');var Redis=require(_0x639d('0x5'));var db=require(_0x639d('0x6'))['db'];var utils=require(_0x639d('0x7'));var logger=require(_0x639d('0x8'))(_0x639d('0x9'));var config=require('../../config/environment');var jayson=require(_0x639d('0xa'));var client=jayson[_0x639d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5840fa,_0x1a8135,_0x4944fa){return new BPromise(function(_0x1475f5,_0x1e6ae8){return client[_0x639d('0xc')](_0x5840fa,_0x4944fa)[_0x639d('0xd')](function(_0x111e2c){logger['info'](_0x639d('0xe'),_0x1a8135,_0x639d('0xf'));logger[_0x639d('0x10')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x1a8135,_0x639d('0xf'),JSON['stringify'](_0x111e2c));if(_0x111e2c[_0x639d('0x11')]){if(_0x111e2c[_0x639d('0x11')][_0x639d('0x12')]===0x1f4){logger[_0x639d('0x11')](_0x639d('0xe'),_0x1a8135,_0x111e2c[_0x639d('0x11')]['message']);return _0x1e6ae8(_0x111e2c[_0x639d('0x11')][_0x639d('0x13')]);}logger[_0x639d('0x11')](_0x639d('0xe'),_0x1a8135,_0x111e2c['error'][_0x639d('0x13')]);return _0x1475f5(_0x111e2c[_0x639d('0x11')][_0x639d('0x13')]);}else{logger[_0x639d('0x14')](_0x639d('0xe'),_0x1a8135,_0x639d('0xf'));_0x1475f5(_0x111e2c[_0x639d('0x15')][_0x639d('0x13')]);}})[_0x639d('0x16')](function(_0x452dad){logger[_0x639d('0x11')]('MailServerIn,\x20%s,\x20%s',_0x1a8135,_0x452dad);_0x1e6ae8(_0x452dad);});});}exports[_0x639d('0x17')]=function(_0x2d1820){var _0x430b18=this;return new Promise(function(_0x4ba54b,_0x3c4938){return db['MailServerIn'][_0x639d('0x18')]({'raw':_0x2d1820[_0x639d('0x19')]?_0x2d1820[_0x639d('0x19')][_0x639d('0x1a')]===undefined?!![]:![]:!![],'where':_0x2d1820['options']?_0x2d1820[_0x639d('0x19')]['where']||null:null,'attributes':_0x2d1820[_0x639d('0x19')]?_0x2d1820[_0x639d('0x19')][_0x639d('0x1b')]||null:null,'limit':_0x2d1820[_0x639d('0x19')]?_0x2d1820['options']['limit']||null:null,'include':_0x2d1820[_0x639d('0x19')]?_0x2d1820[_0x639d('0x19')]['include']?_['map'](_0x2d1820[_0x639d('0x19')][_0x639d('0x1c')],function(_0x504ec0){return{'model':db[_0x504ec0[_0x639d('0x1d')]],'as':_0x504ec0['as'],'attributes':_0x504ec0[_0x639d('0x1b')],'include':_0x504ec0[_0x639d('0x1c')]?_[_0x639d('0x1e')](_0x504ec0[_0x639d('0x1c')],function(_0x1019fb){return{'model':db[_0x1019fb[_0x639d('0x1d')]],'as':_0x1019fb['as'],'attributes':_0x1019fb['attributes'],'include':_0x1019fb[_0x639d('0x1c')]?_[_0x639d('0x1e')](_0x1019fb['include'],function(_0x575da4){return{'model':db[_0x575da4[_0x639d('0x1d')]],'as':_0x575da4['as'],'attributes':_0x575da4[_0x639d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c3a4c){logger['info'](_0x639d('0x17'),_0x2d1820);logger[_0x639d('0x10')](_0x639d('0x17'),_0x2d1820,JSON[_0x639d('0x1f')](_0x1c3a4c));_0x4ba54b(_0x1c3a4c);})[_0x639d('0x16')](function(_0x5d14a5){logger[_0x639d('0x11')](_0x639d('0x17'),_0x5d14a5[_0x639d('0x13')],_0x2d1820);_0x3c4938(_0x430b18[_0x639d('0x11')](0x1f4,_0x5d14a5[_0x639d('0x13')]));});});}; \ No newline at end of file +var _0x8017=['info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','message','result','catch','MailServerIn,\x20%s,\x20%s','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','map','include','model','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8017,0x154));var _0x7801=function(_0x1dac7a,_0x1828ce){_0x1dac7a=_0x1dac7a-0x0;var _0x4cb363=_0x8017[_0x1dac7a];return _0x4cb363;};'use strict';var _=require(_0x7801('0x0'));var util=require('util');var moment=require(_0x7801('0x1'));var BPromise=require(_0x7801('0x2'));var rs=require(_0x7801('0x3'));var fs=require('fs');var Redis=require(_0x7801('0x4'));var db=require(_0x7801('0x5'))['db'];var utils=require(_0x7801('0x6'));var logger=require('../../config/logger')(_0x7801('0x7'));var config=require(_0x7801('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7801('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22515c,_0x61463b,_0x3f412b){return new BPromise(function(_0x112111,_0x5b86a0){return client[_0x7801('0xa')](_0x22515c,_0x3f412b)[_0x7801('0xb')](function(_0x57b9ab){logger[_0x7801('0xc')]('MailServerIn,\x20%s,\x20%s',_0x61463b,_0x7801('0xd'));logger[_0x7801('0xe')](_0x7801('0xf'),_0x61463b,_0x7801('0xd'),JSON['stringify'](_0x57b9ab));if(_0x57b9ab['error']){if(_0x57b9ab[_0x7801('0x10')]['code']===0x1f4){logger[_0x7801('0x10')]('MailServerIn,\x20%s,\x20%s',_0x61463b,_0x57b9ab[_0x7801('0x10')][_0x7801('0x11')]);return _0x5b86a0(_0x57b9ab['error']['message']);}logger[_0x7801('0x10')]('MailServerIn,\x20%s,\x20%s',_0x61463b,_0x57b9ab['error']['message']);return _0x112111(_0x57b9ab['error'][_0x7801('0x11')]);}else{logger[_0x7801('0xc')]('MailServerIn,\x20%s,\x20%s',_0x61463b,'request\x20sent');_0x112111(_0x57b9ab[_0x7801('0x12')][_0x7801('0x11')]);}})[_0x7801('0x13')](function(_0x1ca708){logger[_0x7801('0x10')](_0x7801('0x14'),_0x61463b,_0x1ca708);_0x5b86a0(_0x1ca708);});});}exports[_0x7801('0x15')]=function(_0x4ebb59){var _0x2232d3=this;return new Promise(function(_0x19dd9a,_0x5bd724){return db[_0x7801('0x16')][_0x7801('0x17')]({'raw':_0x4ebb59[_0x7801('0x18')]?_0x4ebb59[_0x7801('0x18')][_0x7801('0x19')]===undefined?!![]:![]:!![],'where':_0x4ebb59['options']?_0x4ebb59[_0x7801('0x18')][_0x7801('0x1a')]||null:null,'attributes':_0x4ebb59[_0x7801('0x18')]?_0x4ebb59['options'][_0x7801('0x1b')]||null:null,'limit':_0x4ebb59[_0x7801('0x18')]?_0x4ebb59[_0x7801('0x18')]['limit']||null:null,'include':_0x4ebb59['options']?_0x4ebb59[_0x7801('0x18')]['include']?_[_0x7801('0x1c')](_0x4ebb59['options']['include'],function(_0x4fa43a){return{'model':db[_0x4fa43a['model']],'as':_0x4fa43a['as'],'attributes':_0x4fa43a[_0x7801('0x1b')],'include':_0x4fa43a[_0x7801('0x1d')]?_['map'](_0x4fa43a['include'],function(_0x435259){return{'model':db[_0x435259[_0x7801('0x1e')]],'as':_0x435259['as'],'attributes':_0x435259[_0x7801('0x1b')],'include':_0x435259[_0x7801('0x1d')]?_[_0x7801('0x1c')](_0x435259[_0x7801('0x1d')],function(_0x54df66){return{'model':db[_0x54df66[_0x7801('0x1e')]],'as':_0x54df66['as'],'attributes':_0x54df66[_0x7801('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7801('0xb')](function(_0x4de09a){logger['info'](_0x7801('0x15'),_0x4ebb59);logger['debug'](_0x7801('0x15'),_0x4ebb59,JSON[_0x7801('0x1f')](_0x4de09a));_0x19dd9a(_0x4de09a);})[_0x7801('0x13')](function(_0x5a325a){logger[_0x7801('0x10')](_0x7801('0x15'),_0x5a325a['message'],_0x4ebb59);_0x5bd724(_0x2232d3['error'](0x1f4,_0x5a325a['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 6bb6d0a..97d6973 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(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_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 _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x7a54,0x106));var _0x47a5=function(_0x3a94d5,_0x8b4215){_0x3a94d5=_0x3a94d5-0x0;var _0x58b16c=_0x7a54[_0x3a94d5];return _0x58b16c;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index c1c3ed4..081d29e 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(_0x5c2356,_0x50a80f){var _0x23bc1b=function(_0x178f6f){while(--_0x178f6f){_0x5c2356['push'](_0x5c2356['shift']());}};_0x23bc1b(++_0x50a80f);}(_0x351d,0x90));var _0xd351=function(_0x1f0bd3,_0x2dbf4a){_0x1f0bd3=_0x1f0bd3-0x0;var _0x333aac=_0x351d[_0x1f0bd3];return _0x333aac;};'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 _0xe706=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x9d6ad7,_0x1ea592){var _0x16f279=function(_0x5ec793){while(--_0x5ec793){_0x9d6ad7['push'](_0x9d6ad7['shift']());}};_0x16f279(++_0x1ea592);}(_0xe706,0xa3));var _0x6e70=function(_0x254849,_0x321ff6){_0x254849=_0x254849-0x0;var _0x4f73d1=_0xe706[_0x254849];return _0x4f73d1;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'description':{'type':Sequelize[_0x6e70('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x6e70('0x2')]},'pass':{'type':Sequelize[_0x6e70('0x2')]},'port':{'type':Sequelize[_0x6e70('0x3')]},'secure':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x6e70('0x2')]},'authentication':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index d6ee7c3..31079f0 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 _0x5f44=['update','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','rows','catch','show','params','attributes','length','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save'];(function(_0x334746,_0x25901c){var _0x4e4aaa=function(_0x123c43){while(--_0x123c43){_0x334746['push'](_0x334746['shift']());}};_0x4e4aaa(++_0x25901c);}(_0x5f44,0x16d));var _0x45f4=function(_0xe539bb,_0xdebeb0){_0xe539bb=_0xe539bb-0x0;var _0x398b72=_0x5f44[_0xe539bb];return _0x398b72;};'use strict';var emlformat=require(_0x45f4('0x0'));var rimraf=require(_0x45f4('0x1'));var zipdir=require(_0x45f4('0x2'));var jsonpatch=require(_0x45f4('0x3'));var rp=require(_0x45f4('0x4'));var moment=require(_0x45f4('0x5'));var BPromise=require(_0x45f4('0x6'));var Mustache=require(_0x45f4('0x7'));var util=require('util');var path=require(_0x45f4('0x8'));var sox=require(_0x45f4('0x9'));var csv=require(_0x45f4('0xa'));var ejs=require(_0x45f4('0xb'));var fs=require('fs');var fs_extra=require(_0x45f4('0xc'));var _=require(_0x45f4('0xd'));var squel=require(_0x45f4('0xe'));var crypto=require(_0x45f4('0xf'));var jsforce=require(_0x45f4('0x10'));var deskjs=require(_0x45f4('0x11'));var toCsv=require(_0x45f4('0xa'));var querystring=require(_0x45f4('0x12'));var Papa=require(_0x45f4('0x13'));var Redis=require(_0x45f4('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x45f4('0x15'));var as=require(_0x45f4('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x45f4('0x17'))(_0x45f4('0x18'));var utils=require(_0x45f4('0x19'));var config=require(_0x45f4('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x45f4('0x1b'))['db'];function respondWithStatusCode(_0x26e8bf,_0x2569a3){_0x2569a3=_0x2569a3||0xcc;return function(_0x5f5b8d){if(_0x5f5b8d){return _0x26e8bf[_0x45f4('0x1c')](_0x2569a3);}return _0x26e8bf[_0x45f4('0x1d')](_0x2569a3)[_0x45f4('0x1e')]();};}function respondWithResult(_0x488a1a,_0xa6796a){_0xa6796a=_0xa6796a||0xc8;return function(_0x12cebd){if(_0x12cebd){return _0x488a1a[_0x45f4('0x1d')](_0xa6796a)[_0x45f4('0x1f')](_0x12cebd);}};}function respondWithFilteredResult(_0x2754ee,_0x6c5d1a){return function(_0x3d096d){if(_0x3d096d){var _0x176082=typeof _0x6c5d1a['offset']===_0x45f4('0x20')&&typeof _0x6c5d1a['limit']===_0x45f4('0x20');var _0x203599=_0x3d096d[_0x45f4('0x21')];var _0x57b0fe=_0x176082?0x0:_0x6c5d1a[_0x45f4('0x22')];var _0x124854=_0x176082?_0x3d096d[_0x45f4('0x21')]:_0x6c5d1a[_0x45f4('0x22')]+_0x6c5d1a[_0x45f4('0x23')];var _0x4ef1f0;if(_0x124854>=_0x203599){_0x124854=_0x203599;_0x4ef1f0=0xc8;}else{_0x4ef1f0=0xce;}_0x2754ee['status'](_0x4ef1f0);return _0x2754ee['set'](_0x45f4('0x24'),_0x57b0fe+'-'+_0x124854+'/'+_0x203599)['json'](_0x3d096d);}return null;};}function patchUpdates(_0x17fb49){return function(_0x23cb9f){try{jsonpatch[_0x45f4('0x25')](_0x23cb9f,_0x17fb49,!![]);}catch(_0x4f2422){return BPromise[_0x45f4('0x26')](_0x4f2422);}return _0x23cb9f[_0x45f4('0x27')]();};}function saveUpdates(_0x173d9c,_0xe7dbb3){return function(_0x3f8a27){if(_0x3f8a27){return _0x3f8a27[_0x45f4('0x28')](_0x173d9c)['then'](function(_0xcd7d13){return _0xcd7d13;});}return null;};}function removeEntity(_0x3b1183,_0x2114ae){return function(_0x44aa8c){if(_0x44aa8c){return _0x44aa8c[_0x45f4('0x29')]()['then'](function(){_0x3b1183['status'](0xcc)[_0x45f4('0x1e')]();});}};}function handleEntityNotFound(_0x4dd4a6,_0x2741ee){return function(_0x37a2cc){if(!_0x37a2cc){_0x4dd4a6['sendStatus'](0x194);}return _0x37a2cc;};}function handleError(_0x872658,_0x498e42){_0x498e42=_0x498e42||0x1f4;return function(_0x280a2b){logger[_0x45f4('0x2a')](_0x280a2b[_0x45f4('0x2b')]);if(_0x280a2b[_0x45f4('0x2c')]){delete _0x280a2b[_0x45f4('0x2c')];}_0x872658[_0x45f4('0x1d')](_0x498e42)[_0x45f4('0x2d')](_0x280a2b);};}exports[_0x45f4('0x2e')]=function(_0x432bea,_0x3f898f){var _0x208910={},_0x22f0ba={},_0x54da64={'count':0x0,'rows':[]};var _0x26be59=_[_0x45f4('0x2f')](db[_0x45f4('0x30')][_0x45f4('0x31')],function(_0x5f174a){return{'name':_0x5f174a[_0x45f4('0x32')],'type':_0x5f174a[_0x45f4('0x33')][_0x45f4('0x34')]};});_0x22f0ba[_0x45f4('0x35')]=_[_0x45f4('0x2f')](_0x26be59,_0x45f4('0x2c'));_0x22f0ba[_0x45f4('0x36')]=_[_0x45f4('0x37')](_0x432bea[_0x45f4('0x36')]);_0x22f0ba[_0x45f4('0x38')]=_[_0x45f4('0x39')](_0x22f0ba[_0x45f4('0x35')],_0x22f0ba['query']);_0x208910['attributes']=_[_0x45f4('0x39')](_0x22f0ba[_0x45f4('0x35')],qs[_0x45f4('0x3a')](_0x432bea[_0x45f4('0x36')][_0x45f4('0x3a')]));_0x208910['attributes']=_0x208910['attributes']['length']?_0x208910['attributes']:_0x22f0ba[_0x45f4('0x35')];if(!_0x432bea[_0x45f4('0x36')][_0x45f4('0x3b')](_0x45f4('0x3c'))){_0x208910['limit']=qs[_0x45f4('0x23')](_0x432bea['query'][_0x45f4('0x23')]);_0x208910['offset']=qs[_0x45f4('0x22')](_0x432bea[_0x45f4('0x36')]['offset']);}_0x208910[_0x45f4('0x3d')]=qs['sort'](_0x432bea['query'][_0x45f4('0x3e')]);_0x208910['where']=qs[_0x45f4('0x38')](_[_0x45f4('0x3f')](_0x432bea[_0x45f4('0x36')],_0x22f0ba[_0x45f4('0x38')]),_0x26be59);if(_0x432bea[_0x45f4('0x36')][_0x45f4('0x40')]){_0x208910[_0x45f4('0x41')]=_[_0x45f4('0x42')](_0x208910[_0x45f4('0x41')],{'$or':_[_0x45f4('0x2f')](_0x26be59,function(_0x5a5cd4){if(_0x5a5cd4[_0x45f4('0x33')]!==_0x45f4('0x43')){var _0x2bf413={};_0x2bf413[_0x5a5cd4['name']]={'$like':'%'+_0x432bea[_0x45f4('0x36')]['filter']+'%'};return _0x2bf413;}})});}_0x208910=_[_0x45f4('0x42')]({},_0x208910,_0x432bea['options']);var _0x17a3cf={'where':_0x208910[_0x45f4('0x41')]};return db[_0x45f4('0x30')][_0x45f4('0x21')](_0x17a3cf)[_0x45f4('0x44')](function(_0x1f95d2){_0x54da64['count']=_0x1f95d2;if(_0x432bea['query'][_0x45f4('0x45')]){_0x208910[_0x45f4('0x46')]=[{'all':!![]}];}return db[_0x45f4('0x30')]['findAll'](_0x208910);})['then'](function(_0x4ddc76){_0x54da64[_0x45f4('0x47')]=_0x4ddc76;return _0x54da64;})[_0x45f4('0x44')](respondWithFilteredResult(_0x3f898f,_0x208910))[_0x45f4('0x48')](handleError(_0x3f898f,null));};exports[_0x45f4('0x49')]=function(_0x26dc37,_0x5f03a8){var _0x4018aa={'raw':!![],'where':{'id':_0x26dc37[_0x45f4('0x4a')]['id']}},_0x38281f={};_0x38281f[_0x45f4('0x35')]=_[_0x45f4('0x37')](db['MailServerOut'][_0x45f4('0x31')]);_0x38281f['query']=_['keys'](_0x26dc37[_0x45f4('0x36')]);_0x38281f[_0x45f4('0x38')]=_[_0x45f4('0x39')](_0x38281f['model'],_0x38281f[_0x45f4('0x36')]);_0x4018aa[_0x45f4('0x4b')]=_[_0x45f4('0x39')](_0x38281f[_0x45f4('0x35')],qs[_0x45f4('0x3a')](_0x26dc37['query'][_0x45f4('0x3a')]));_0x4018aa['attributes']=_0x4018aa[_0x45f4('0x4b')][_0x45f4('0x4c')]?_0x4018aa['attributes']:_0x38281f[_0x45f4('0x35')];if(_0x26dc37[_0x45f4('0x36')][_0x45f4('0x45')]){_0x4018aa['include']=[{'all':!![]}];}_0x4018aa=_['merge']({},_0x4018aa,_0x26dc37[_0x45f4('0x4d')]);return db['MailServerOut'][_0x45f4('0x4e')](_0x4018aa)['then'](handleEntityNotFound(_0x5f03a8,null))['then'](respondWithResult(_0x5f03a8,null))[_0x45f4('0x48')](handleError(_0x5f03a8,null));};exports['create']=function(_0x294c46,_0x16d3ed){return db[_0x45f4('0x30')][_0x45f4('0x4f')](_0x294c46[_0x45f4('0x50')],{})['then'](respondWithResult(_0x16d3ed,0xc9))[_0x45f4('0x48')](handleError(_0x16d3ed,null));};exports[_0x45f4('0x28')]=function(_0x3b5721,_0x3c980b){if(_0x3b5721[_0x45f4('0x50')]['id']){delete _0x3b5721[_0x45f4('0x50')]['id'];}return db[_0x45f4('0x30')][_0x45f4('0x4e')]({'where':{'id':_0x3b5721[_0x45f4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3c980b,null))[_0x45f4('0x44')](saveUpdates(_0x3b5721['body'],null))['then'](respondWithResult(_0x3c980b,null))['catch'](handleError(_0x3c980b,null));};exports[_0x45f4('0x29')]=function(_0x15d806,_0x3fc707){return db[_0x45f4('0x30')][_0x45f4('0x4e')]({'where':{'id':_0x15d806['params']['id']}})[_0x45f4('0x44')](handleEntityNotFound(_0x3fc707,null))[_0x45f4('0x44')](removeEntity(_0x3fc707,null))[_0x45f4('0x48')](handleError(_0x3fc707,null));}; \ No newline at end of file +var _0x90b3=['undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','MailServerOut','findAll','catch','show','params','length','find','create','body','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x90b3,0x100));var _0x390b=function(_0xb314a6,_0x3e9b41){_0xb314a6=_0xb314a6-0x0;var _0x1a5c11=_0x90b3[_0xb314a6];return _0x1a5c11;};'use strict';var emlformat=require(_0x390b('0x0'));var rimraf=require(_0x390b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x390b('0x2'));var rp=require('request-promise');var moment=require(_0x390b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x390b('0x4'));var util=require(_0x390b('0x5'));var path=require(_0x390b('0x6'));var sox=require(_0x390b('0x7'));var csv=require(_0x390b('0x8'));var ejs=require(_0x390b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x390b('0xa'));var squel=require(_0x390b('0xb'));var crypto=require('crypto');var jsforce=require(_0x390b('0xc'));var deskjs=require(_0x390b('0xd'));var toCsv=require(_0x390b('0x8'));var querystring=require(_0x390b('0xe'));var Papa=require(_0x390b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x390b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x390b('0x11'));var utils=require('../../config/utils');var config=require(_0x390b('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x390b('0x13'))['db'];function respondWithStatusCode(_0x3c6c20,_0x2d2e9d){_0x2d2e9d=_0x2d2e9d||0xcc;return function(_0xffed3d){if(_0xffed3d){return _0x3c6c20[_0x390b('0x14')](_0x2d2e9d);}return _0x3c6c20[_0x390b('0x15')](_0x2d2e9d)[_0x390b('0x16')]();};}function respondWithResult(_0x3b8c2a,_0x10530d){_0x10530d=_0x10530d||0xc8;return function(_0x1b8b40){if(_0x1b8b40){return _0x3b8c2a[_0x390b('0x15')](_0x10530d)['json'](_0x1b8b40);}};}function respondWithFilteredResult(_0x5c25b8,_0x350d6b){return function(_0x1d2980){if(_0x1d2980){var _0x10bce3=typeof _0x350d6b[_0x390b('0x17')]===_0x390b('0x18')&&typeof _0x350d6b[_0x390b('0x19')]==='undefined';var _0x27442a=_0x1d2980[_0x390b('0x1a')];var _0x3c1582=_0x10bce3?0x0:_0x350d6b[_0x390b('0x17')];var _0x3362b2=_0x10bce3?_0x1d2980[_0x390b('0x1a')]:_0x350d6b[_0x390b('0x17')]+_0x350d6b[_0x390b('0x19')];var _0x1afad8;if(_0x3362b2>=_0x27442a){_0x3362b2=_0x27442a;_0x1afad8=0xc8;}else{_0x1afad8=0xce;}_0x5c25b8[_0x390b('0x15')](_0x1afad8);return _0x5c25b8[_0x390b('0x1b')](_0x390b('0x1c'),_0x3c1582+'-'+_0x3362b2+'/'+_0x27442a)['json'](_0x1d2980);}return null;};}function patchUpdates(_0x39c071){return function(_0x3c4cf6){try{jsonpatch[_0x390b('0x1d')](_0x3c4cf6,_0x39c071,!![]);}catch(_0x1ede55){return BPromise[_0x390b('0x1e')](_0x1ede55);}return _0x3c4cf6[_0x390b('0x1f')]();};}function saveUpdates(_0x57c9c9,_0x3de02c){return function(_0x5045d4){if(_0x5045d4){return _0x5045d4[_0x390b('0x20')](_0x57c9c9)[_0x390b('0x21')](function(_0x1e4340){return _0x1e4340;});}return null;};}function removeEntity(_0x5713a7,_0x975247){return function(_0x20e17a){if(_0x20e17a){return _0x20e17a[_0x390b('0x22')]()[_0x390b('0x21')](function(){_0x5713a7[_0x390b('0x15')](0xcc)[_0x390b('0x16')]();});}};}function handleEntityNotFound(_0x5684cd,_0x1f98d4){return function(_0x70ad63){if(!_0x70ad63){_0x5684cd[_0x390b('0x14')](0x194);}return _0x70ad63;};}function handleError(_0x396507,_0x13ad16){_0x13ad16=_0x13ad16||0x1f4;return function(_0x4f2de9){logger[_0x390b('0x23')](_0x4f2de9[_0x390b('0x24')]);if(_0x4f2de9['name']){delete _0x4f2de9[_0x390b('0x25')];}_0x396507['status'](_0x13ad16)['send'](_0x4f2de9);};}exports['index']=function(_0x48a9cf,_0x2d77dd){var _0x1ba7c9={},_0x4c48b5={},_0x13a7a3={'count':0x0,'rows':[]};var _0xc36dc=_['map'](db['MailServerOut'][_0x390b('0x26')],function(_0x3a9d56){return{'name':_0x3a9d56[_0x390b('0x27')],'type':_0x3a9d56[_0x390b('0x28')][_0x390b('0x29')]};});_0x4c48b5['model']=_[_0x390b('0x2a')](_0xc36dc,_0x390b('0x25'));_0x4c48b5[_0x390b('0x2b')]=_[_0x390b('0x2c')](_0x48a9cf['query']);_0x4c48b5['filters']=_[_0x390b('0x2d')](_0x4c48b5[_0x390b('0x2e')],_0x4c48b5[_0x390b('0x2b')]);_0x1ba7c9[_0x390b('0x2f')]=_[_0x390b('0x2d')](_0x4c48b5[_0x390b('0x2e')],qs[_0x390b('0x30')](_0x48a9cf['query'][_0x390b('0x30')]));_0x1ba7c9[_0x390b('0x2f')]=_0x1ba7c9[_0x390b('0x2f')]['length']?_0x1ba7c9['attributes']:_0x4c48b5[_0x390b('0x2e')];if(!_0x48a9cf[_0x390b('0x2b')]['hasOwnProperty'](_0x390b('0x31'))){_0x1ba7c9['limit']=qs[_0x390b('0x19')](_0x48a9cf['query'][_0x390b('0x19')]);_0x1ba7c9[_0x390b('0x17')]=qs[_0x390b('0x17')](_0x48a9cf[_0x390b('0x2b')]['offset']);}_0x1ba7c9[_0x390b('0x32')]=qs['sort'](_0x48a9cf[_0x390b('0x2b')][_0x390b('0x33')]);_0x1ba7c9['where']=qs[_0x390b('0x34')](_[_0x390b('0x35')](_0x48a9cf[_0x390b('0x2b')],_0x4c48b5[_0x390b('0x34')]),_0xc36dc);if(_0x48a9cf[_0x390b('0x2b')][_0x390b('0x36')]){_0x1ba7c9[_0x390b('0x37')]=_['merge'](_0x1ba7c9[_0x390b('0x37')],{'$or':_['map'](_0xc36dc,function(_0x2eb4e3){if(_0x2eb4e3[_0x390b('0x28')]!==_0x390b('0x38')){var _0xba147d={};_0xba147d[_0x2eb4e3['name']]={'$like':'%'+_0x48a9cf[_0x390b('0x2b')][_0x390b('0x36')]+'%'};return _0xba147d;}})});}_0x1ba7c9=_[_0x390b('0x39')]({},_0x1ba7c9,_0x48a9cf[_0x390b('0x3a')]);var _0x24d064={'where':_0x1ba7c9[_0x390b('0x37')]};return db['MailServerOut'][_0x390b('0x1a')](_0x24d064)['then'](function(_0x569b61){_0x13a7a3[_0x390b('0x1a')]=_0x569b61;if(_0x48a9cf[_0x390b('0x2b')][_0x390b('0x3b')]){_0x1ba7c9[_0x390b('0x3c')]=[{'all':!![]}];}return db[_0x390b('0x3d')][_0x390b('0x3e')](_0x1ba7c9);})['then'](function(_0x411b9c){_0x13a7a3['rows']=_0x411b9c;return _0x13a7a3;})[_0x390b('0x21')](respondWithFilteredResult(_0x2d77dd,_0x1ba7c9))[_0x390b('0x3f')](handleError(_0x2d77dd,null));};exports[_0x390b('0x40')]=function(_0x2fa5f4,_0xe420d7){var _0x1f446e={'raw':!![],'where':{'id':_0x2fa5f4[_0x390b('0x41')]['id']}},_0x40a783={};_0x40a783[_0x390b('0x2e')]=_[_0x390b('0x2c')](db[_0x390b('0x3d')][_0x390b('0x26')]);_0x40a783[_0x390b('0x2b')]=_[_0x390b('0x2c')](_0x2fa5f4[_0x390b('0x2b')]);_0x40a783[_0x390b('0x34')]=_['intersection'](_0x40a783[_0x390b('0x2e')],_0x40a783[_0x390b('0x2b')]);_0x1f446e[_0x390b('0x2f')]=_['intersection'](_0x40a783[_0x390b('0x2e')],qs['fields'](_0x2fa5f4['query'][_0x390b('0x30')]));_0x1f446e[_0x390b('0x2f')]=_0x1f446e[_0x390b('0x2f')][_0x390b('0x42')]?_0x1f446e[_0x390b('0x2f')]:_0x40a783[_0x390b('0x2e')];if(_0x2fa5f4[_0x390b('0x2b')][_0x390b('0x3b')]){_0x1f446e[_0x390b('0x3c')]=[{'all':!![]}];}_0x1f446e=_['merge']({},_0x1f446e,_0x2fa5f4[_0x390b('0x3a')]);return db[_0x390b('0x3d')][_0x390b('0x43')](_0x1f446e)['then'](handleEntityNotFound(_0xe420d7,null))[_0x390b('0x21')](respondWithResult(_0xe420d7,null))[_0x390b('0x3f')](handleError(_0xe420d7,null));};exports['create']=function(_0x349c78,_0x25d1cc){return db[_0x390b('0x3d')][_0x390b('0x44')](_0x349c78[_0x390b('0x45')],{})['then'](respondWithResult(_0x25d1cc,0xc9))[_0x390b('0x3f')](handleError(_0x25d1cc,null));};exports[_0x390b('0x20')]=function(_0x5700f7,_0x537d80){if(_0x5700f7['body']['id']){delete _0x5700f7[_0x390b('0x45')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x5700f7[_0x390b('0x41')]['id']}})[_0x390b('0x21')](handleEntityNotFound(_0x537d80,null))[_0x390b('0x21')](saveUpdates(_0x5700f7[_0x390b('0x45')],null))[_0x390b('0x21')](respondWithResult(_0x537d80,null))[_0x390b('0x3f')](handleError(_0x537d80,null));};exports[_0x390b('0x22')]=function(_0x5337a5,_0x2e5e3a){return db[_0x390b('0x3d')][_0x390b('0x43')]({'where':{'id':_0x5337a5['params']['id']}})['then'](handleEntityNotFound(_0x2e5e3a,null))[_0x390b('0x21')](removeEntity(_0x2e5e3a,null))['catch'](handleError(_0x2e5e3a,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index e0fffaf..d484acb 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 _0x8905=['./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x31cf62,_0x11f276){var _0xf8c702=function(_0x4fb993){while(--_0x4fb993){_0x31cf62['push'](_0x31cf62['shift']());}};_0xf8c702(++_0x11f276);}(_0x8905,0x179));var _0x5890=function(_0x51acde,_0x271808){_0x51acde=_0x51acde-0x0;var _0xfac992=_0x8905[_0x51acde];return _0xfac992;};'use strict';var _=require(_0x5890('0x0'));var util=require(_0x5890('0x1'));var logger=require('../../config/logger')(_0x5890('0x2'));var moment=require('moment');var BPromise=require(_0x5890('0x3'));var rp=require(_0x5890('0x4'));var fs=require('fs');var path=require(_0x5890('0x5'));var rimraf=require(_0x5890('0x6'));var config=require('../../config/environment');var attributes=require(_0x5890('0x7'));module[_0x5890('0x8')]=function(_0x5b401c,_0x54d434){return _0x5b401c[_0x5890('0x9')](_0x5890('0xa'),attributes,{'tableName':_0x5890('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43d4=['path','rimraf','../../config/environment','./mailServerOut.attributes','define','MailServerOut','mail_servers_out','lodash','util','api','moment','bluebird','request-promise'];(function(_0x3b5632,_0x3a0a3b){var _0x23a64e=function(_0x4ca252){while(--_0x4ca252){_0x3b5632['push'](_0x3b5632['shift']());}};_0x23a64e(++_0x3a0a3b);}(_0x43d4,0x173));var _0x443d=function(_0x41c0e4,_0x233994){_0x41c0e4=_0x41c0e4-0x0;var _0x5656c5=_0x43d4[_0x41c0e4];return _0x5656c5;};'use strict';var _=require(_0x443d('0x0'));var util=require(_0x443d('0x1'));var logger=require('../../config/logger')(_0x443d('0x2'));var moment=require(_0x443d('0x3'));var BPromise=require(_0x443d('0x4'));var rp=require(_0x443d('0x5'));var fs=require('fs');var path=require(_0x443d('0x6'));var rimraf=require(_0x443d('0x7'));var config=require(_0x443d('0x8'));var attributes=require(_0x443d('0x9'));module['exports']=function(_0x32f357,_0x1337aa){return _0x32f357[_0x443d('0xa')](_0x443d('0xb'),attributes,{'tableName':_0x443d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 172beb5..7d28f39 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0xa17300,_0x9b9985){var _0x443e9b=function(_0x16719b){while(--_0x16719b){_0xa17300['push'](_0xa17300['shift']());}};_0x443e9b(++_0x9b9985);}(_0xdb28,0x106));var _0x8db2=function(_0x56e61f,_0x3aeb1e){_0x56e61f=_0x56e61f-0x0;var _0x154ca4=_0xdb28[_0x56e61f];return _0x154ca4;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _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(_0xba250d,_0xebc097){var _0x12da65=function(_0x44156e){while(--_0x44156e){_0xba250d['push'](_0xba250d['shift']());}};_0x12da65(++_0xebc097);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xc4aa[_0x16b9ed];return _0x66b1f8;};'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 diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 5ca2936..66ff63f 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 _0x44b0=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','update'];(function(_0x1f5834,_0x421950){var _0x418e31=function(_0x5f5cc4){while(--_0x5f5cc4){_0x1f5834['push'](_0x1f5834['shift']());}};_0x418e31(++_0x421950);}(_0x44b0,0x99));var _0x044b=function(_0xdc70cc,_0x359e99){_0xdc70cc=_0xdc70cc-0x0;var _0x297b59=_0x44b0[_0xdc70cc];return _0x297b59;};'use strict';var multer=require(_0x044b('0x0'));var util=require(_0x044b('0x1'));var path=require(_0x044b('0x2'));var timeout=require(_0x044b('0x3'));var express=require(_0x044b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x044b('0x5'));var interaction=require(_0x044b('0x6'));var config=require(_0x044b('0x7'));var controller=require(_0x044b('0x8'));router['get']('/',auth[_0x044b('0x9')](),controller[_0x044b('0xa')]);router[_0x044b('0xb')](_0x044b('0xc'),auth[_0x044b('0x9')](),controller[_0x044b('0xd')]);router[_0x044b('0xb')](_0x044b('0xe'),auth[_0x044b('0x9')](),controller[_0x044b('0xf')]);router['post']('/',auth[_0x044b('0x9')](),controller['create']);router[_0x044b('0x10')](_0x044b('0xe'),auth[_0x044b('0x9')](),controller[_0x044b('0x11')]);router['delete']('/:id',auth[_0x044b('0x9')](),controller['destroy']);module[_0x044b('0x12')]=router; \ No newline at end of file +var _0x41a9=['index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated'];(function(_0x2728a2,_0x499cb9){var _0x5bd705=function(_0x1cbe8c){while(--_0x1cbe8c){_0x2728a2['push'](_0x2728a2['shift']());}};_0x5bd705(++_0x499cb9);}(_0x41a9,0x1ee));var _0x941a=function(_0x4e364e,_0x2ee796){_0x4e364e=_0x4e364e-0x0;var _0x279cf5=_0x41a9[_0x4e364e];return _0x279cf5;};'use strict';var multer=require(_0x941a('0x0'));var util=require(_0x941a('0x1'));var path=require(_0x941a('0x2'));var timeout=require(_0x941a('0x3'));var express=require(_0x941a('0x4'));var router=express[_0x941a('0x5')]();var fs_extra=require(_0x941a('0x6'));var auth=require(_0x941a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x941a('0x8'));var controller=require(_0x941a('0x9'));router[_0x941a('0xa')]('/',auth[_0x941a('0xb')](),controller[_0x941a('0xc')]);router[_0x941a('0xa')](_0x941a('0xd'),auth['isAuthenticated'](),controller[_0x941a('0xe')]);router[_0x941a('0xa')](_0x941a('0xf'),auth[_0x941a('0xb')](),controller[_0x941a('0x10')]);router[_0x941a('0x11')]('/',auth[_0x941a('0xb')](),controller[_0x941a('0x12')]);router[_0x941a('0x13')](_0x941a('0xf'),auth[_0x941a('0xb')](),controller[_0x941a('0x14')]);router[_0x941a('0x15')](_0x941a('0xf'),auth['isAuthenticated'](),controller[_0x941a('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 86a414c..d4e37da 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 _0xfcf0=['sequelize','exports','name','STRING'];(function(_0x1affd0,_0x42efc6){var _0x3b6b73=function(_0x54a6b5){while(--_0x54a6b5){_0x1affd0['push'](_0x1affd0['shift']());}};_0x3b6b73(++_0x42efc6);}(_0xfcf0,0x138));var _0x0fcf=function(_0x5d61b4,_0x4f7b91){_0x5d61b4=_0x5d61b4-0x0;var _0x183fc5=_0xfcf0[_0x5d61b4];return _0x183fc5;};'use strict';var Sequelize=require(_0x0fcf('0x0'));module[_0x0fcf('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0fcf('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0fcf('0x3')]}}; \ No newline at end of file +var _0x6c7b=['STRING','sequelize'];(function(_0x1f1fa6,_0x2864d4){var _0xe38738=function(_0x245df6){while(--_0x245df6){_0x1f1fa6['push'](_0x1f1fa6['shift']());}};_0xe38738(++_0x2864d4);}(_0x6c7b,0x10b));var _0xb6c7=function(_0xf0e870,_0x543a53){_0xf0e870=_0xf0e870-0x0;var _0x14a6d2=_0x6c7b[_0xf0e870];return _0x14a6d2;};'use strict';var Sequelize=require(_0xb6c7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb6c7('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index cf7b73f..86683af 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 _0x1dab=['key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','length','find','body','update','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','MailSubstatus','rawAttributes'];(function(_0x83bb3,_0x4f5a1c){var _0x46289c=function(_0x375eea){while(--_0x375eea){_0x83bb3['push'](_0x83bb3['shift']());}};_0x46289c(++_0x4f5a1c);}(_0x1dab,0x18f));var _0xb1da=function(_0x2377e3,_0x2c0352){_0x2377e3=_0x2377e3-0x0;var _0x2a6d1b=_0x1dab[_0x2377e3];return _0x2a6d1b;};'use strict';var emlformat=require(_0xb1da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb1da('0x1'));var jsonpatch=require(_0xb1da('0x2'));var rp=require(_0xb1da('0x3'));var moment=require(_0xb1da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb1da('0x5'));var util=require(_0xb1da('0x6'));var path=require(_0xb1da('0x7'));var sox=require(_0xb1da('0x8'));var csv=require(_0xb1da('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb1da('0xa'));var _=require(_0xb1da('0xb'));var squel=require('squel');var crypto=require(_0xb1da('0xc'));var jsforce=require(_0xb1da('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb1da('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb1da('0xe'));var authService=require(_0xb1da('0xf'));var qs=require(_0xb1da('0x10'));var as=require(_0xb1da('0x11'));var hardwareService=require(_0xb1da('0x12'));var logger=require(_0xb1da('0x13'))(_0xb1da('0x14'));var utils=require('../../config/utils');var config=require(_0xb1da('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb1da('0x16'))['db'];function respondWithStatusCode(_0x512146,_0x287eda){_0x287eda=_0x287eda||0xcc;return function(_0x64ba10){if(_0x64ba10){return _0x512146[_0xb1da('0x17')](_0x287eda);}return _0x512146[_0xb1da('0x18')](_0x287eda)[_0xb1da('0x19')]();};}function respondWithResult(_0x5b33c4,_0x178307){_0x178307=_0x178307||0xc8;return function(_0x1df640){if(_0x1df640){return _0x5b33c4[_0xb1da('0x18')](_0x178307)[_0xb1da('0x1a')](_0x1df640);}};}function respondWithFilteredResult(_0x19fe19,_0x510b69){return function(_0x15418a){if(_0x15418a){var _0x1c7a82=typeof _0x510b69[_0xb1da('0x1b')]===_0xb1da('0x1c')&&typeof _0x510b69[_0xb1da('0x1d')]===_0xb1da('0x1c');var _0x1556d4=_0x15418a[_0xb1da('0x1e')];var _0x2f94a1=_0x1c7a82?0x0:_0x510b69['offset'];var _0x56e8eb=_0x1c7a82?_0x15418a[_0xb1da('0x1e')]:_0x510b69[_0xb1da('0x1b')]+_0x510b69[_0xb1da('0x1d')];var _0x1ef8c4;if(_0x56e8eb>=_0x1556d4){_0x56e8eb=_0x1556d4;_0x1ef8c4=0xc8;}else{_0x1ef8c4=0xce;}_0x19fe19['status'](_0x1ef8c4);return _0x19fe19[_0xb1da('0x1f')](_0xb1da('0x20'),_0x2f94a1+'-'+_0x56e8eb+'/'+_0x1556d4)[_0xb1da('0x1a')](_0x15418a);}return null;};}function patchUpdates(_0x223e33){return function(_0x59a0b3){try{jsonpatch[_0xb1da('0x21')](_0x59a0b3,_0x223e33,!![]);}catch(_0x393488){return BPromise[_0xb1da('0x22')](_0x393488);}return _0x59a0b3[_0xb1da('0x23')]();};}function saveUpdates(_0x2f0436,_0x5615c3){return function(_0x1d04f2){if(_0x1d04f2){return _0x1d04f2['update'](_0x2f0436)[_0xb1da('0x24')](function(_0x5f09d9){return _0x5f09d9;});}return null;};}function removeEntity(_0x3d5dc4,_0x3fc344){return function(_0x4e01c7){if(_0x4e01c7){return _0x4e01c7['destroy']()[_0xb1da('0x24')](function(){_0x3d5dc4[_0xb1da('0x18')](0xcc)[_0xb1da('0x19')]();});}};}function handleEntityNotFound(_0x1f9583,_0x3fa323){return function(_0x47439e){if(!_0x47439e){_0x1f9583[_0xb1da('0x17')](0x194);}return _0x47439e;};}function handleError(_0x4fa62e,_0x4c3b48){_0x4c3b48=_0x4c3b48||0x1f4;return function(_0x4aa720){logger[_0xb1da('0x25')](_0x4aa720[_0xb1da('0x26')]);if(_0x4aa720[_0xb1da('0x27')]){delete _0x4aa720[_0xb1da('0x27')];}_0x4fa62e['status'](_0x4c3b48)[_0xb1da('0x28')](_0x4aa720);};}exports[_0xb1da('0x29')]=function(_0x2c3c3d,_0x364f57){var _0x314241={},_0x119c12={},_0xbeadbb={'count':0x0,'rows':[]};var _0x11a2ab=_[_0xb1da('0x2a')](db[_0xb1da('0x2b')][_0xb1da('0x2c')],function(_0x282ef2){return{'name':_0x282ef2['fieldName'],'type':_0x282ef2['type'][_0xb1da('0x2d')]};});_0x119c12[_0xb1da('0x2e')]=_[_0xb1da('0x2a')](_0x11a2ab,_0xb1da('0x27'));_0x119c12[_0xb1da('0x2f')]=_['keys'](_0x2c3c3d[_0xb1da('0x2f')]);_0x119c12[_0xb1da('0x30')]=_[_0xb1da('0x31')](_0x119c12[_0xb1da('0x2e')],_0x119c12[_0xb1da('0x2f')]);_0x314241['attributes']=_['intersection'](_0x119c12[_0xb1da('0x2e')],qs[_0xb1da('0x32')](_0x2c3c3d[_0xb1da('0x2f')][_0xb1da('0x32')]));_0x314241['attributes']=_0x314241['attributes']['length']?_0x314241[_0xb1da('0x33')]:_0x119c12['model'];if(!_0x2c3c3d[_0xb1da('0x2f')][_0xb1da('0x34')](_0xb1da('0x35'))){_0x314241[_0xb1da('0x1d')]=qs[_0xb1da('0x1d')](_0x2c3c3d[_0xb1da('0x2f')]['limit']);_0x314241['offset']=qs[_0xb1da('0x1b')](_0x2c3c3d[_0xb1da('0x2f')][_0xb1da('0x1b')]);}_0x314241[_0xb1da('0x36')]=qs[_0xb1da('0x37')](_0x2c3c3d[_0xb1da('0x2f')][_0xb1da('0x37')]);_0x314241[_0xb1da('0x38')]=qs['filters'](_[_0xb1da('0x39')](_0x2c3c3d['query'],_0x119c12[_0xb1da('0x30')]),_0x11a2ab);if(_0x2c3c3d[_0xb1da('0x2f')][_0xb1da('0x3a')]){_0x314241[_0xb1da('0x38')]=_['merge'](_0x314241[_0xb1da('0x38')],{'$or':_[_0xb1da('0x2a')](_0x11a2ab,function(_0x199201){if(_0x199201['type']!=='VIRTUAL'){var _0x1c9b5d={};_0x1c9b5d[_0x199201[_0xb1da('0x27')]]={'$like':'%'+_0x2c3c3d[_0xb1da('0x2f')][_0xb1da('0x3a')]+'%'};return _0x1c9b5d;}})});}_0x314241=_[_0xb1da('0x3b')]({},_0x314241,_0x2c3c3d[_0xb1da('0x3c')]);var _0x14984e={'where':_0x314241['where']};return db[_0xb1da('0x2b')][_0xb1da('0x1e')](_0x14984e)['then'](function(_0x97d12e){_0xbeadbb[_0xb1da('0x1e')]=_0x97d12e;if(_0x2c3c3d['query'][_0xb1da('0x3d')]){_0x314241[_0xb1da('0x3e')]=[{'all':!![]}];}return db[_0xb1da('0x2b')][_0xb1da('0x3f')](_0x314241);})[_0xb1da('0x24')](function(_0x190644){_0xbeadbb['rows']=_0x190644;return _0xbeadbb;})[_0xb1da('0x24')](respondWithFilteredResult(_0x364f57,_0x314241))[_0xb1da('0x40')](handleError(_0x364f57,null));};exports[_0xb1da('0x41')]=function(_0x30703b,_0x5c4de5){var _0x4bd8fb={'raw':!![],'where':{'id':_0x30703b[_0xb1da('0x42')]['id']}},_0x2b4557={};_0x2b4557[_0xb1da('0x2e')]=_[_0xb1da('0x43')](db['MailSubstatus']['rawAttributes']);_0x2b4557[_0xb1da('0x2f')]=_[_0xb1da('0x43')](_0x30703b[_0xb1da('0x2f')]);_0x2b4557[_0xb1da('0x30')]=_[_0xb1da('0x31')](_0x2b4557[_0xb1da('0x2e')],_0x2b4557[_0xb1da('0x2f')]);_0x4bd8fb[_0xb1da('0x33')]=_[_0xb1da('0x31')](_0x2b4557[_0xb1da('0x2e')],qs[_0xb1da('0x32')](_0x30703b[_0xb1da('0x2f')][_0xb1da('0x32')]));_0x4bd8fb['attributes']=_0x4bd8fb['attributes'][_0xb1da('0x44')]?_0x4bd8fb[_0xb1da('0x33')]:_0x2b4557['model'];if(_0x30703b['query']['includeAll']){_0x4bd8fb[_0xb1da('0x3e')]=[{'all':!![]}];}_0x4bd8fb=_[_0xb1da('0x3b')]({},_0x4bd8fb,_0x30703b[_0xb1da('0x3c')]);return db[_0xb1da('0x2b')][_0xb1da('0x45')](_0x4bd8fb)[_0xb1da('0x24')](handleEntityNotFound(_0x5c4de5,null))[_0xb1da('0x24')](respondWithResult(_0x5c4de5,null))['catch'](handleError(_0x5c4de5,null));};exports['create']=function(_0x840254,_0x491117){return db[_0xb1da('0x2b')]['create'](_0x840254[_0xb1da('0x46')],{})[_0xb1da('0x24')](respondWithResult(_0x491117,0xc9))['catch'](handleError(_0x491117,null));};exports[_0xb1da('0x47')]=function(_0x4f3f72,_0x17c73c){if(_0x4f3f72[_0xb1da('0x46')]['id']){delete _0x4f3f72[_0xb1da('0x46')]['id'];}return db[_0xb1da('0x2b')][_0xb1da('0x45')]({'where':{'id':_0x4f3f72[_0xb1da('0x42')]['id']}})[_0xb1da('0x24')](handleEntityNotFound(_0x17c73c,null))[_0xb1da('0x24')](saveUpdates(_0x4f3f72[_0xb1da('0x46')],null))[_0xb1da('0x24')](respondWithResult(_0x17c73c,null))['catch'](handleError(_0x17c73c,null));};exports[_0xb1da('0x48')]=function(_0x32d8e5,_0x1f27c5){return db['MailSubstatus'][_0xb1da('0x45')]({'where':{'id':_0x32d8e5[_0xb1da('0x42')]['id']}})[_0xb1da('0x24')](handleEntityNotFound(_0x1f27c5,null))[_0xb1da('0x24')](removeEntity(_0x1f27c5,null))['catch'](handleError(_0x1f27c5,null));};exports[_0xb1da('0x49')]=function(_0x2d023e,_0x3babd8){return db['MailSubstatus'][_0xb1da('0x49')]()[_0xb1da('0x24')](respondWithResult(_0x3babd8,null))[_0xb1da('0x40')](handleError(_0x3babd8,null));}; \ No newline at end of file +var _0xecc3=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','save','then','destroy','stack','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','update','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x403f81,_0x4a19b9){var _0x232132=function(_0xf59a56){while(--_0xf59a56){_0x403f81['push'](_0x403f81['shift']());}};_0x232132(++_0x4a19b9);}(_0xecc3,0xca));var _0x3ecc=function(_0x3fd592,_0x3b0301){_0x3fd592=_0x3fd592-0x0;var _0x17c2f3=_0xecc3[_0x3fd592];return _0x17c2f3;};'use strict';var emlformat=require(_0x3ecc('0x0'));var rimraf=require(_0x3ecc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ecc('0x2'));var rp=require(_0x3ecc('0x3'));var moment=require('moment');var BPromise=require(_0x3ecc('0x4'));var Mustache=require(_0x3ecc('0x5'));var util=require(_0x3ecc('0x6'));var path=require(_0x3ecc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3ecc('0x8'));var fs=require('fs');var fs_extra=require(_0x3ecc('0x9'));var _=require(_0x3ecc('0xa'));var squel=require(_0x3ecc('0xb'));var crypto=require(_0x3ecc('0xc'));var jsforce=require(_0x3ecc('0xd'));var deskjs=require(_0x3ecc('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3ecc('0xf'));var Papa=require('papaparse');var Redis=require(_0x3ecc('0x10'));var authService=require(_0x3ecc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3ecc('0x12'));var hardwareService=require(_0x3ecc('0x13'));var logger=require(_0x3ecc('0x14'))('api');var utils=require(_0x3ecc('0x15'));var config=require(_0x3ecc('0x16'));var licenseUtil=require(_0x3ecc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ce99a,_0x5b8c1){_0x5b8c1=_0x5b8c1||0xcc;return function(_0x10c7cf){if(_0x10c7cf){return _0x3ce99a[_0x3ecc('0x18')](_0x5b8c1);}return _0x3ce99a['status'](_0x5b8c1)['end']();};}function respondWithResult(_0x46e7be,_0x5b019c){_0x5b019c=_0x5b019c||0xc8;return function(_0x2500aa){if(_0x2500aa){return _0x46e7be[_0x3ecc('0x19')](_0x5b019c)[_0x3ecc('0x1a')](_0x2500aa);}};}function respondWithFilteredResult(_0x191275,_0x4b07c8){return function(_0x162564){if(_0x162564){var _0x577c59=typeof _0x4b07c8[_0x3ecc('0x1b')]===_0x3ecc('0x1c')&&typeof _0x4b07c8['limit']===_0x3ecc('0x1c');var _0x2e8b5b=_0x162564[_0x3ecc('0x1d')];var _0x4af436=_0x577c59?0x0:_0x4b07c8[_0x3ecc('0x1b')];var _0x4df20d=_0x577c59?_0x162564[_0x3ecc('0x1d')]:_0x4b07c8[_0x3ecc('0x1b')]+_0x4b07c8[_0x3ecc('0x1e')];var _0x3f5d28;if(_0x4df20d>=_0x2e8b5b){_0x4df20d=_0x2e8b5b;_0x3f5d28=0xc8;}else{_0x3f5d28=0xce;}_0x191275[_0x3ecc('0x19')](_0x3f5d28);return _0x191275[_0x3ecc('0x1f')](_0x3ecc('0x20'),_0x4af436+'-'+_0x4df20d+'/'+_0x2e8b5b)[_0x3ecc('0x1a')](_0x162564);}return null;};}function patchUpdates(_0x1c3f59){return function(_0x2e7bed){try{jsonpatch['apply'](_0x2e7bed,_0x1c3f59,!![]);}catch(_0x3264c8){return BPromise['reject'](_0x3264c8);}return _0x2e7bed[_0x3ecc('0x21')]();};}function saveUpdates(_0x55b5b6,_0x3655e1){return function(_0x1ec424){if(_0x1ec424){return _0x1ec424['update'](_0x55b5b6)[_0x3ecc('0x22')](function(_0x1748af){return _0x1748af;});}return null;};}function removeEntity(_0x524102,_0x119272){return function(_0x4f57e4){if(_0x4f57e4){return _0x4f57e4[_0x3ecc('0x23')]()[_0x3ecc('0x22')](function(){_0x524102['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe7dae2,_0x260117){return function(_0x36b32a){if(!_0x36b32a){_0xe7dae2['sendStatus'](0x194);}return _0x36b32a;};}function handleError(_0x5092ec,_0x89e821){_0x89e821=_0x89e821||0x1f4;return function(_0x4c0d2c){logger['error'](_0x4c0d2c[_0x3ecc('0x24')]);if(_0x4c0d2c['name']){delete _0x4c0d2c['name'];}_0x5092ec['status'](_0x89e821)[_0x3ecc('0x25')](_0x4c0d2c);};}exports[_0x3ecc('0x26')]=function(_0x52ee4d,_0x498e93){var _0x2249a1={},_0x2dacb7={},_0x53636c={'count':0x0,'rows':[]};var _0x387a30=_[_0x3ecc('0x27')](db[_0x3ecc('0x28')][_0x3ecc('0x29')],function(_0x2b8001){return{'name':_0x2b8001[_0x3ecc('0x2a')],'type':_0x2b8001[_0x3ecc('0x2b')][_0x3ecc('0x2c')]};});_0x2dacb7[_0x3ecc('0x2d')]=_[_0x3ecc('0x27')](_0x387a30,_0x3ecc('0x2e'));_0x2dacb7[_0x3ecc('0x2f')]=_[_0x3ecc('0x30')](_0x52ee4d[_0x3ecc('0x2f')]);_0x2dacb7[_0x3ecc('0x31')]=_[_0x3ecc('0x32')](_0x2dacb7['model'],_0x2dacb7['query']);_0x2249a1[_0x3ecc('0x33')]=_[_0x3ecc('0x32')](_0x2dacb7[_0x3ecc('0x2d')],qs[_0x3ecc('0x34')](_0x52ee4d[_0x3ecc('0x2f')][_0x3ecc('0x34')]));_0x2249a1['attributes']=_0x2249a1['attributes'][_0x3ecc('0x35')]?_0x2249a1[_0x3ecc('0x33')]:_0x2dacb7[_0x3ecc('0x2d')];if(!_0x52ee4d[_0x3ecc('0x2f')][_0x3ecc('0x36')](_0x3ecc('0x37'))){_0x2249a1['limit']=qs['limit'](_0x52ee4d[_0x3ecc('0x2f')][_0x3ecc('0x1e')]);_0x2249a1[_0x3ecc('0x1b')]=qs[_0x3ecc('0x1b')](_0x52ee4d['query'][_0x3ecc('0x1b')]);}_0x2249a1['order']=qs['sort'](_0x52ee4d[_0x3ecc('0x2f')][_0x3ecc('0x38')]);_0x2249a1['where']=qs[_0x3ecc('0x31')](_[_0x3ecc('0x39')](_0x52ee4d[_0x3ecc('0x2f')],_0x2dacb7[_0x3ecc('0x31')]),_0x387a30);if(_0x52ee4d[_0x3ecc('0x2f')][_0x3ecc('0x3a')]){_0x2249a1['where']=_[_0x3ecc('0x3b')](_0x2249a1[_0x3ecc('0x3c')],{'$or':_[_0x3ecc('0x27')](_0x387a30,function(_0x363318){if(_0x363318['type']!==_0x3ecc('0x3d')){var _0x55ee32={};_0x55ee32[_0x363318[_0x3ecc('0x2e')]]={'$like':'%'+_0x52ee4d['query'][_0x3ecc('0x3a')]+'%'};return _0x55ee32;}})});}_0x2249a1=_['merge']({},_0x2249a1,_0x52ee4d[_0x3ecc('0x3e')]);var _0x6d48a8={'where':_0x2249a1[_0x3ecc('0x3c')]};return db['MailSubstatus']['count'](_0x6d48a8)[_0x3ecc('0x22')](function(_0x15c5d4){_0x53636c['count']=_0x15c5d4;if(_0x52ee4d[_0x3ecc('0x2f')][_0x3ecc('0x3f')]){_0x2249a1[_0x3ecc('0x40')]=[{'all':!![]}];}return db[_0x3ecc('0x28')]['findAll'](_0x2249a1);})[_0x3ecc('0x22')](function(_0x3f9db8){_0x53636c[_0x3ecc('0x41')]=_0x3f9db8;return _0x53636c;})[_0x3ecc('0x22')](respondWithFilteredResult(_0x498e93,_0x2249a1))[_0x3ecc('0x42')](handleError(_0x498e93,null));};exports[_0x3ecc('0x43')]=function(_0x235f4a,_0x200bec){var _0x5c41d6={'raw':!![],'where':{'id':_0x235f4a['params']['id']}},_0xca5c61={};_0xca5c61[_0x3ecc('0x2d')]=_[_0x3ecc('0x30')](db[_0x3ecc('0x28')][_0x3ecc('0x29')]);_0xca5c61[_0x3ecc('0x2f')]=_[_0x3ecc('0x30')](_0x235f4a[_0x3ecc('0x2f')]);_0xca5c61['filters']=_['intersection'](_0xca5c61[_0x3ecc('0x2d')],_0xca5c61[_0x3ecc('0x2f')]);_0x5c41d6[_0x3ecc('0x33')]=_['intersection'](_0xca5c61[_0x3ecc('0x2d')],qs[_0x3ecc('0x34')](_0x235f4a[_0x3ecc('0x2f')][_0x3ecc('0x34')]));_0x5c41d6[_0x3ecc('0x33')]=_0x5c41d6[_0x3ecc('0x33')][_0x3ecc('0x35')]?_0x5c41d6[_0x3ecc('0x33')]:_0xca5c61['model'];if(_0x235f4a['query']['includeAll']){_0x5c41d6[_0x3ecc('0x40')]=[{'all':!![]}];}_0x5c41d6=_[_0x3ecc('0x3b')]({},_0x5c41d6,_0x235f4a[_0x3ecc('0x3e')]);return db[_0x3ecc('0x28')][_0x3ecc('0x44')](_0x5c41d6)['then'](handleEntityNotFound(_0x200bec,null))[_0x3ecc('0x22')](respondWithResult(_0x200bec,null))[_0x3ecc('0x42')](handleError(_0x200bec,null));};exports[_0x3ecc('0x45')]=function(_0x3b00d6,_0x20f6d5){return db['MailSubstatus']['create'](_0x3b00d6[_0x3ecc('0x46')],{})[_0x3ecc('0x22')](respondWithResult(_0x20f6d5,0xc9))['catch'](handleError(_0x20f6d5,null));};exports[_0x3ecc('0x47')]=function(_0x53f2c1,_0x2f78aa){if(_0x53f2c1[_0x3ecc('0x46')]['id']){delete _0x53f2c1[_0x3ecc('0x46')]['id'];}return db[_0x3ecc('0x28')][_0x3ecc('0x44')]({'where':{'id':_0x53f2c1[_0x3ecc('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f78aa,null))[_0x3ecc('0x22')](saveUpdates(_0x53f2c1[_0x3ecc('0x46')],null))[_0x3ecc('0x22')](respondWithResult(_0x2f78aa,null))['catch'](handleError(_0x2f78aa,null));};exports[_0x3ecc('0x23')]=function(_0x384f7d,_0x3d6502){return db[_0x3ecc('0x28')][_0x3ecc('0x44')]({'where':{'id':_0x384f7d[_0x3ecc('0x48')]['id']}})[_0x3ecc('0x22')](handleEntityNotFound(_0x3d6502,null))[_0x3ecc('0x22')](removeEntity(_0x3d6502,null))['catch'](handleError(_0x3d6502,null));};exports[_0x3ecc('0x49')]=function(_0x3e2892,_0x20f526){return db['MailSubstatus'][_0x3ecc('0x49')]()[_0x3ecc('0x22')](respondWithResult(_0x20f526,null))[_0x3ecc('0x42')](handleError(_0x20f526,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 5018adc..f5d983a 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 _0x0195=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus'];(function(_0x2506f5,_0x3641ee){var _0x71dc73=function(_0x42a571){while(--_0x42a571){_0x2506f5['push'](_0x2506f5['shift']());}};_0x71dc73(++_0x3641ee);}(_0x0195,0x123));var _0x5019=function(_0x2a0cb8,_0x10bca7){_0x2a0cb8=_0x2a0cb8-0x0;var _0x5c7e66=_0x0195[_0x2a0cb8];return _0x5c7e66;};'use strict';var EventEmitter=require(_0x5019('0x0'));var MailSubstatus=require(_0x5019('0x1'))['db'][_0x5019('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':'update'};function emitEvent(_0xf2e7d7){return function(_0x13c55f,_0x2f1349,_0x5d6fb6){MailSubstatusEvents[_0x5019('0x3')](_0xf2e7d7+':'+_0x13c55f['id'],_0x13c55f);MailSubstatusEvents['emit'](_0xf2e7d7,_0x13c55f);_0x5d6fb6(null);};}for(var e in events){if(events[_0x5019('0x4')](e)){var event=events[e];MailSubstatus[_0x5019('0x5')](e,emitEvent(event));}}module[_0x5019('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x4086=['../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','events'];(function(_0x3c3e61,_0x359085){var _0x1d7184=function(_0x363966){while(--_0x363966){_0x3c3e61['push'](_0x3c3e61['shift']());}};_0x1d7184(++_0x359085);}(_0x4086,0x1c6));var _0x6408=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4086[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x6408('0x0'));var MailSubstatus=require(_0x6408('0x1'))['db'][_0x6408('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x6408('0x3')](0x0);var events={'afterUpdate':_0x6408('0x4')};function emitEvent(_0x154e5e){return function(_0x169569,_0x51dc5b,_0x357e8b){MailSubstatusEvents[_0x6408('0x5')](_0x154e5e+':'+_0x169569['id'],_0x169569);MailSubstatusEvents['emit'](_0x154e5e,_0x169569);_0x357e8b(null);};}for(var e in events){if(events[_0x6408('0x6')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index c93d2aa..9f1525c 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 _0xefd8=['exports','models','define','MailSubstatus','Condition','update','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes'];(function(_0x527ae6,_0x4187f1){var _0x3f2b13=function(_0x248876){while(--_0x248876){_0x527ae6['push'](_0x527ae6['shift']());}};_0x3f2b13(++_0x4187f1);}(_0xefd8,0x1d3));var _0x8efd=function(_0x23d7a7,_0x4b0f57){_0x23d7a7=_0x23d7a7-0x0;var _0x43f390=_0xefd8[_0x23d7a7];return _0x43f390;};'use strict';var attributes=require(_0x8efd('0x0'));module[_0x8efd('0x1')]=function(_0x3772f7){var _0x1724ae=_0x3772f7[_0x8efd('0x2')];return _0x3772f7[_0x8efd('0x3')](_0x8efd('0x4'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x507702,_0x351167,_0x46cc7c){return _0x1724ae[_0x8efd('0x5')][_0x8efd('0x6')]({'value':_0x507702[_0x8efd('0x7')]},{'where':{'field':_0x8efd('0x8'),'value':_0x507702[_0x8efd('0x9')][_0x8efd('0x7')]}})[_0x8efd('0xa')](function(){_0x46cc7c();})[_0x8efd('0xb')](function(_0xbdff29){_0x46cc7c(_0xbdff29);});}}});}; \ No newline at end of file +var _0x41ec=['mail_substatuses','update','name','mailSubstatus','_previousDataValues','then','exports','models','define'];(function(_0x1fd4de,_0x4b1eaf){var _0x4a52bc=function(_0x3111bd){while(--_0x3111bd){_0x1fd4de['push'](_0x1fd4de['shift']());}};_0x4a52bc(++_0x4b1eaf);}(_0x41ec,0xde));var _0xc41e=function(_0x3fd0a3,_0x326767){_0x3fd0a3=_0x3fd0a3-0x0;var _0x11d437=_0x41ec[_0x3fd0a3];return _0x11d437;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0xc41e('0x0')]=function(_0x41272c){var _0x318d96=_0x41272c[_0xc41e('0x1')];return _0x41272c[_0xc41e('0x2')]('MailSubstatus',attributes,{'tableName':_0xc41e('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x1ec2b4,_0x50d823,_0x3e2ad2){return _0x318d96['Condition'][_0xc41e('0x4')]({'value':_0x1ec2b4[_0xc41e('0x5')]},{'where':{'field':_0xc41e('0x6'),'value':_0x1ec2b4[_0xc41e('0x7')][_0xc41e('0x5')]}})[_0xc41e('0x8')](function(){_0x3e2ad2();})['catch'](function(_0x47f878){_0x3e2ad2(_0x47f878);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index d5ad85a..5a92435 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 _0x3acc=['code','MailSubstatus,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error'];(function(_0x36fb1a,_0x816c48){var _0x224539=function(_0x5d70d5){while(--_0x5d70d5){_0x36fb1a['push'](_0x36fb1a['shift']());}};_0x224539(++_0x816c48);}(_0x3acc,0x1e8));var _0xc3ac=function(_0x329384,_0x5eec18){_0x329384=_0x329384-0x0;var _0x301586=_0x3acc[_0x329384];return _0x301586;};'use strict';var _=require(_0xc3ac('0x0'));var util=require(_0xc3ac('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc3ac('0x2'));var fs=require('fs');var Redis=require(_0xc3ac('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc3ac('0x4'));var logger=require(_0xc3ac('0x5'))(_0xc3ac('0x6'));var config=require(_0xc3ac('0x7'));var jayson=require(_0xc3ac('0x8'));var client=jayson[_0xc3ac('0x9')][_0xc3ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cdc58,_0x437f3e,_0x3ebe16){return new BPromise(function(_0x1d6d10,_0xdce77c){return client[_0xc3ac('0xb')](_0x2cdc58,_0x3ebe16)['then'](function(_0x391abe){logger[_0xc3ac('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x437f3e,_0xc3ac('0xd'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x437f3e,_0xc3ac('0xd'),JSON[_0xc3ac('0xe')](_0x391abe));if(_0x391abe[_0xc3ac('0xf')]){if(_0x391abe[_0xc3ac('0xf')][_0xc3ac('0x10')]===0x1f4){logger[_0xc3ac('0xf')](_0xc3ac('0x11'),_0x437f3e,_0x391abe[_0xc3ac('0xf')][_0xc3ac('0x12')]);return _0xdce77c(_0x391abe[_0xc3ac('0xf')][_0xc3ac('0x12')]);}logger[_0xc3ac('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x437f3e,_0x391abe[_0xc3ac('0xf')][_0xc3ac('0x12')]);return _0x1d6d10(_0x391abe[_0xc3ac('0xf')][_0xc3ac('0x12')]);}else{logger['info'](_0xc3ac('0x11'),_0x437f3e,_0xc3ac('0xd'));_0x1d6d10(_0x391abe[_0xc3ac('0x13')][_0xc3ac('0x12')]);}})[_0xc3ac('0x14')](function(_0x57859e){logger[_0xc3ac('0xf')](_0xc3ac('0x11'),_0x437f3e,_0x57859e);_0xdce77c(_0x57859e);});});} \ No newline at end of file +var _0x7a01=['result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','MailSubstatus,\x20%s,\x20%s','MailSubstatus,\x20%s,\x20%s,\x20%s','error','message','request\x20sent'];(function(_0x477ec3,_0x4e5fd7){var _0x185ed5=function(_0x5ba2bd){while(--_0x5ba2bd){_0x477ec3['push'](_0x477ec3['shift']());}};_0x185ed5(++_0x4e5fd7);}(_0x7a01,0x1f0));var _0x17a0=function(_0x6be88a,_0xea4ba2){_0x6be88a=_0x6be88a-0x0;var _0x101824=_0x7a01[_0x6be88a];return _0x101824;};'use strict';var _=require(_0x17a0('0x0'));var util=require(_0x17a0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x17a0('0x2'));var db=require(_0x17a0('0x3'))['db'];var utils=require(_0x17a0('0x4'));var logger=require(_0x17a0('0x5'))(_0x17a0('0x6'));var config=require(_0x17a0('0x7'));var jayson=require(_0x17a0('0x8'));var client=jayson[_0x17a0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28c874,_0x398ec7,_0x523088){return new BPromise(function(_0x3b038b,_0x15430d){return client['request'](_0x28c874,_0x523088)[_0x17a0('0xa')](function(_0x43b4d0){logger[_0x17a0('0xb')](_0x17a0('0xc'),_0x398ec7,'request\x20sent');logger['debug'](_0x17a0('0xd'),_0x398ec7,'request\x20sent',JSON['stringify'](_0x43b4d0));if(_0x43b4d0[_0x17a0('0xe')]){if(_0x43b4d0['error']['code']===0x1f4){logger[_0x17a0('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x398ec7,_0x43b4d0[_0x17a0('0xe')][_0x17a0('0xf')]);return _0x15430d(_0x43b4d0[_0x17a0('0xe')][_0x17a0('0xf')]);}logger['error'](_0x17a0('0xc'),_0x398ec7,_0x43b4d0[_0x17a0('0xe')][_0x17a0('0xf')]);return _0x3b038b(_0x43b4d0[_0x17a0('0xe')][_0x17a0('0xf')]);}else{logger[_0x17a0('0xb')](_0x17a0('0xc'),_0x398ec7,_0x17a0('0x10'));_0x3b038b(_0x43b4d0[_0x17a0('0x11')][_0x17a0('0xf')]);}})[_0x17a0('0x12')](function(_0x16be13){logger[_0x17a0('0xe')](_0x17a0('0xc'),_0x398ec7,_0x16be13);_0x15430d(_0x16be13);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index d870e84..c124606 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 _0xef14=['delete','exports','multer','util','connect-timeout','express','Router','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update'];(function(_0x12d449,_0x322825){var _0x403672=function(_0x3d0c3e){while(--_0x3d0c3e){_0x12d449['push'](_0x12d449['shift']());}};_0x403672(++_0x322825);}(_0xef14,0xe6));var _0x4ef1=function(_0x202b41,_0x1b51d4){_0x202b41=_0x202b41-0x0;var _0x5aba2a=_0xef14[_0x202b41];return _0x5aba2a;};'use strict';var multer=require(_0x4ef1('0x0'));var util=require(_0x4ef1('0x1'));var path=require('path');var timeout=require(_0x4ef1('0x2'));var express=require(_0x4ef1('0x3'));var router=express[_0x4ef1('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ef1('0x5'));var controller=require(_0x4ef1('0x6'));router['get']('/',auth[_0x4ef1('0x7')](),controller[_0x4ef1('0x8')]);router[_0x4ef1('0x9')](_0x4ef1('0xa'),auth['isAuthenticated'](),controller[_0x4ef1('0xb')]);router['get'](_0x4ef1('0xc'),auth[_0x4ef1('0x7')](),controller[_0x4ef1('0xd')]);router['post']('/',auth[_0x4ef1('0x7')](),controller[_0x4ef1('0xe')]);router[_0x4ef1('0xf')](_0x4ef1('0xc'),auth[_0x4ef1('0x7')](),controller[_0x4ef1('0x10')]);router[_0x4ef1('0x11')]('/:id',auth[_0x4ef1('0x7')](),controller['destroy']);module[_0x4ef1('0x12')]=router; \ No newline at end of file +var _0xf6c4=['index','/describe','describe','/:id','create','put','update','delete','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated'];(function(_0x51e89f,_0x4ba442){var _0x1fe83c=function(_0x589692){while(--_0x589692){_0x51e89f['push'](_0x51e89f['shift']());}};_0x1fe83c(++_0x4ba442);}(_0xf6c4,0x1c2));var _0x4f6c=function(_0x4de3ed,_0x593201){_0x4de3ed=_0x4de3ed-0x0;var _0x9b1374=_0xf6c4[_0x4de3ed];return _0x9b1374;};'use strict';var multer=require('multer');var util=require(_0x4f6c('0x0'));var path=require(_0x4f6c('0x1'));var timeout=require('connect-timeout');var express=require(_0x4f6c('0x2'));var router=express['Router']();var fs_extra=require(_0x4f6c('0x3'));var auth=require(_0x4f6c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4f6c('0x5'));var controller=require(_0x4f6c('0x6'));router[_0x4f6c('0x7')]('/',auth[_0x4f6c('0x8')](),controller[_0x4f6c('0x9')]);router[_0x4f6c('0x7')](_0x4f6c('0xa'),auth[_0x4f6c('0x8')](),controller[_0x4f6c('0xb')]);router[_0x4f6c('0x7')](_0x4f6c('0xc'),auth[_0x4f6c('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x4f6c('0xd')]);router[_0x4f6c('0xe')](_0x4f6c('0xc'),auth[_0x4f6c('0x8')](),controller[_0x4f6c('0xf')]);router[_0x4f6c('0x10')](_0x4f6c('0xc'),auth[_0x4f6c('0x8')](),controller['destroy']);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 f593772..a71ae98 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x5a2a07,_0x11e242){var _0x289ff8=function(_0x36c6bb){while(--_0x36c6bb){_0x5a2a07['push'](_0x5a2a07['shift']());}};_0x289ff8(++_0x11e242);}(_0x70e0,0x17b));var _0x070e=function(_0x443b3a,_0xe91714){_0x443b3a=_0x443b3a-0x0;var _0x314bbb=_0x70e0[_0x443b3a];return _0x314bbb;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x5b2e39,_0x136669){var _0x2b74ff=function(_0x4dc5a9){while(--_0x4dc5a9){_0x5b2e39['push'](_0x5b2e39['shift']());}};_0x2b74ff(++_0x136669);}(_0xedd9,0xfc));var _0x9edd=function(_0x44e54f,_0x36673f){_0x44e54f=_0x44e54f-0x0;var _0x3cd718=_0xedd9[_0x44e54f];return _0x3cd718;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 8e9155c..9dcbd92 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 _0xf955=['key','model','map','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','stack','name','send','index','MailTransferReport','fieldName','type'];(function(_0x1f1837,_0x4b304e){var _0x25ab57=function(_0x4dec8c){while(--_0x4dec8c){_0x1f1837['push'](_0x1f1837['shift']());}};_0x25ab57(++_0x4b304e);}(_0xf955,0x19b));var _0x5f95=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xf955[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0x5f95('0x0'));var rimraf=require(_0x5f95('0x1'));var zipdir=require(_0x5f95('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f95('0x3'));var moment=require('moment');var BPromise=require(_0x5f95('0x4'));var Mustache=require(_0x5f95('0x5'));var util=require(_0x5f95('0x6'));var path=require(_0x5f95('0x7'));var sox=require(_0x5f95('0x8'));var csv=require(_0x5f95('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5f95('0xa'));var crypto=require(_0x5f95('0xb'));var jsforce=require(_0x5f95('0xc'));var deskjs=require(_0x5f95('0xd'));var toCsv=require(_0x5f95('0x9'));var querystring=require(_0x5f95('0xe'));var Papa=require('papaparse');var Redis=require(_0x5f95('0xf'));var authService=require(_0x5f95('0x10'));var qs=require(_0x5f95('0x11'));var as=require(_0x5f95('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5f95('0x13'))(_0x5f95('0x14'));var utils=require('../../config/utils');var config=require(_0x5f95('0x15'));var licenseUtil=require(_0x5f95('0x16'));var db=require(_0x5f95('0x17'))['db'];function respondWithStatusCode(_0x225373,_0x4de556){_0x4de556=_0x4de556||0xcc;return function(_0x2acad3){if(_0x2acad3){return _0x225373[_0x5f95('0x18')](_0x4de556);}return _0x225373[_0x5f95('0x19')](_0x4de556)[_0x5f95('0x1a')]();};}function respondWithResult(_0x26ff71,_0x10fad8){_0x10fad8=_0x10fad8||0xc8;return function(_0x852cb2){if(_0x852cb2){return _0x26ff71[_0x5f95('0x19')](_0x10fad8)[_0x5f95('0x1b')](_0x852cb2);}};}function respondWithFilteredResult(_0x315aa0,_0x497f1a){return function(_0x512968){if(_0x512968){var _0x2dead1=typeof _0x497f1a['offset']===_0x5f95('0x1c')&&typeof _0x497f1a[_0x5f95('0x1d')]===_0x5f95('0x1c');var _0x387b64=_0x512968[_0x5f95('0x1e')];var _0x5a28d0=_0x2dead1?0x0:_0x497f1a[_0x5f95('0x1f')];var _0x491856=_0x2dead1?_0x512968['count']:_0x497f1a[_0x5f95('0x1f')]+_0x497f1a[_0x5f95('0x1d')];var _0xbe421;if(_0x491856>=_0x387b64){_0x491856=_0x387b64;_0xbe421=0xc8;}else{_0xbe421=0xce;}_0x315aa0['status'](_0xbe421);return _0x315aa0[_0x5f95('0x20')](_0x5f95('0x21'),_0x5a28d0+'-'+_0x491856+'/'+_0x387b64)['json'](_0x512968);}return null;};}function patchUpdates(_0x34d384){return function(_0x30c599){try{jsonpatch['apply'](_0x30c599,_0x34d384,!![]);}catch(_0x3a6a0a){return BPromise['reject'](_0x3a6a0a);}return _0x30c599[_0x5f95('0x22')]();};}function saveUpdates(_0x3d728d,_0x410557){return function(_0x1b2b83){if(_0x1b2b83){return _0x1b2b83[_0x5f95('0x23')](_0x3d728d)[_0x5f95('0x24')](function(_0x4abdd1){return _0x4abdd1;});}return null;};}function removeEntity(_0xb9e592,_0x391400){return function(_0x8da9bc){if(_0x8da9bc){return _0x8da9bc[_0x5f95('0x25')]()[_0x5f95('0x24')](function(){_0xb9e592[_0x5f95('0x19')](0xcc)[_0x5f95('0x1a')]();});}};}function handleEntityNotFound(_0x3409af,_0xc4959b){return function(_0x13c057){if(!_0x13c057){_0x3409af[_0x5f95('0x18')](0x194);}return _0x13c057;};}function handleError(_0x3c13b3,_0x4d17ff){_0x4d17ff=_0x4d17ff||0x1f4;return function(_0x55bb0b){logger['error'](_0x55bb0b[_0x5f95('0x26')]);if(_0x55bb0b[_0x5f95('0x27')]){delete _0x55bb0b['name'];}_0x3c13b3['status'](_0x4d17ff)[_0x5f95('0x28')](_0x55bb0b);};}exports[_0x5f95('0x29')]=function(_0x230f3b,_0x4632ce){var _0x2991a0={},_0x48fbf3={},_0x34e150={'count':0x0,'rows':[]};var _0xca1c4a=_['map'](db[_0x5f95('0x2a')]['rawAttributes'],function(_0x3dd053){return{'name':_0x3dd053[_0x5f95('0x2b')],'type':_0x3dd053[_0x5f95('0x2c')][_0x5f95('0x2d')]};});_0x48fbf3[_0x5f95('0x2e')]=_[_0x5f95('0x2f')](_0xca1c4a,_0x5f95('0x27'));_0x48fbf3['query']=_[_0x5f95('0x30')](_0x230f3b['query']);_0x48fbf3[_0x5f95('0x31')]=_[_0x5f95('0x32')](_0x48fbf3[_0x5f95('0x2e')],_0x48fbf3['query']);_0x2991a0[_0x5f95('0x33')]=_[_0x5f95('0x32')](_0x48fbf3['model'],qs[_0x5f95('0x34')](_0x230f3b[_0x5f95('0x35')][_0x5f95('0x34')]));_0x2991a0[_0x5f95('0x33')]=_0x2991a0[_0x5f95('0x33')][_0x5f95('0x36')]?_0x2991a0[_0x5f95('0x33')]:_0x48fbf3[_0x5f95('0x2e')];if(!_0x230f3b[_0x5f95('0x35')][_0x5f95('0x37')]('nolimit')){_0x2991a0['limit']=qs[_0x5f95('0x1d')](_0x230f3b[_0x5f95('0x35')][_0x5f95('0x1d')]);_0x2991a0[_0x5f95('0x1f')]=qs[_0x5f95('0x1f')](_0x230f3b[_0x5f95('0x35')][_0x5f95('0x1f')]);}_0x2991a0[_0x5f95('0x38')]=qs[_0x5f95('0x39')](_0x230f3b[_0x5f95('0x35')][_0x5f95('0x39')]);_0x2991a0[_0x5f95('0x3a')]=qs['filters'](_[_0x5f95('0x3b')](_0x230f3b[_0x5f95('0x35')],_0x48fbf3[_0x5f95('0x31')]),_0xca1c4a);if(_0x230f3b[_0x5f95('0x35')]['filter']){_0x2991a0['where']=_[_0x5f95('0x3c')](_0x2991a0[_0x5f95('0x3a')],{'$or':_['map'](_0xca1c4a,function(_0x114bfc){if(_0x114bfc[_0x5f95('0x2c')]!==_0x5f95('0x3d')){var _0x3db1f0={};_0x3db1f0[_0x114bfc[_0x5f95('0x27')]]={'$like':'%'+_0x230f3b['query'][_0x5f95('0x3e')]+'%'};return _0x3db1f0;}})});}_0x2991a0=_[_0x5f95('0x3c')]({},_0x2991a0,_0x230f3b[_0x5f95('0x3f')]);var _0x245c0d={'where':_0x2991a0[_0x5f95('0x3a')]};return db[_0x5f95('0x2a')][_0x5f95('0x1e')](_0x245c0d)[_0x5f95('0x24')](function(_0x4471ce){_0x34e150[_0x5f95('0x1e')]=_0x4471ce;if(_0x230f3b[_0x5f95('0x35')][_0x5f95('0x40')]){_0x2991a0[_0x5f95('0x41')]=[{'all':!![]}];}return db['MailTransferReport'][_0x5f95('0x42')](_0x2991a0);})[_0x5f95('0x24')](function(_0x30d6e2){_0x34e150[_0x5f95('0x43')]=_0x30d6e2;return _0x34e150;})[_0x5f95('0x24')](respondWithFilteredResult(_0x4632ce,_0x2991a0))[_0x5f95('0x44')](handleError(_0x4632ce,null));};exports[_0x5f95('0x45')]=function(_0x17dded,_0x417a33){var _0x4e316f={'raw':!![],'where':{'id':_0x17dded['params']['id']}},_0x4572fe={};_0x4572fe[_0x5f95('0x2e')]=_[_0x5f95('0x30')](db[_0x5f95('0x2a')][_0x5f95('0x46')]);_0x4572fe[_0x5f95('0x35')]=_[_0x5f95('0x30')](_0x17dded['query']);_0x4572fe['filters']=_[_0x5f95('0x32')](_0x4572fe[_0x5f95('0x2e')],_0x4572fe['query']);_0x4e316f[_0x5f95('0x33')]=_[_0x5f95('0x32')](_0x4572fe[_0x5f95('0x2e')],qs[_0x5f95('0x34')](_0x17dded['query'][_0x5f95('0x34')]));_0x4e316f['attributes']=_0x4e316f['attributes'][_0x5f95('0x36')]?_0x4e316f['attributes']:_0x4572fe[_0x5f95('0x2e')];if(_0x17dded[_0x5f95('0x35')][_0x5f95('0x40')]){_0x4e316f[_0x5f95('0x41')]=[{'all':!![]}];}_0x4e316f=_[_0x5f95('0x3c')]({},_0x4e316f,_0x17dded[_0x5f95('0x3f')]);return db[_0x5f95('0x2a')][_0x5f95('0x47')](_0x4e316f)[_0x5f95('0x24')](handleEntityNotFound(_0x417a33,null))[_0x5f95('0x24')](respondWithResult(_0x417a33,null))[_0x5f95('0x44')](handleError(_0x417a33,null));};exports[_0x5f95('0x48')]=function(_0x2c0663,_0x3738fe){return db[_0x5f95('0x2a')][_0x5f95('0x48')](_0x2c0663['body'],{})['then'](respondWithResult(_0x3738fe,0xc9))[_0x5f95('0x44')](handleError(_0x3738fe,null));};exports[_0x5f95('0x23')]=function(_0x11e402,_0x575fb1){if(_0x11e402[_0x5f95('0x49')]['id']){delete _0x11e402[_0x5f95('0x49')]['id'];}return db['MailTransferReport'][_0x5f95('0x47')]({'where':{'id':_0x11e402[_0x5f95('0x4a')]['id']}})[_0x5f95('0x24')](handleEntityNotFound(_0x575fb1,null))[_0x5f95('0x24')](saveUpdates(_0x11e402['body'],null))[_0x5f95('0x24')](respondWithResult(_0x575fb1,null))['catch'](handleError(_0x575fb1,null));};exports['destroy']=function(_0xdd7040,_0x4b7ab4){return db[_0x5f95('0x2a')][_0x5f95('0x47')]({'where':{'id':_0xdd7040['params']['id']}})[_0x5f95('0x24')](handleEntityNotFound(_0x4b7ab4,null))[_0x5f95('0x24')](removeEntity(_0x4b7ab4,null))[_0x5f95('0x44')](handleError(_0x4b7ab4,null));};exports[_0x5f95('0x4b')]=function(_0x1cba6f,_0x71e312){return db[_0x5f95('0x2a')][_0x5f95('0x4b')]()[_0x5f95('0x24')](respondWithResult(_0x71e312,null))[_0x5f95('0x44')](handleError(_0x71e312,null));}; \ No newline at end of file +var _0x3723=['map','MailTransferReport','fieldName','type','key','model','query','keys','attributes','intersection','length','limit','sort','where','filters','pick','filter','merge','count','includeAll','include','findAll','rows','catch','params','rawAttributes','fields','options','find','body','describe','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/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index'];(function(_0x1eff1a,_0x5d05a9){var _0x478b4b=function(_0x480e04){while(--_0x480e04){_0x1eff1a['push'](_0x1eff1a['shift']());}};_0x478b4b(++_0x5d05a9);}(_0x3723,0x1e7));var _0x3372=function(_0x5748cb,_0x3820d6){_0x5748cb=_0x5748cb-0x0;var _0x1e9d84=_0x3723[_0x5748cb];return _0x1e9d84;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3372('0x0'));var zipdir=require(_0x3372('0x1'));var jsonpatch=require(_0x3372('0x2'));var rp=require(_0x3372('0x3'));var moment=require(_0x3372('0x4'));var BPromise=require(_0x3372('0x5'));var Mustache=require(_0x3372('0x6'));var util=require('util');var path=require(_0x3372('0x7'));var sox=require(_0x3372('0x8'));var csv=require(_0x3372('0x9'));var ejs=require(_0x3372('0xa'));var fs=require('fs');var fs_extra=require(_0x3372('0xb'));var _=require(_0x3372('0xc'));var squel=require(_0x3372('0xd'));var crypto=require('crypto');var jsforce=require(_0x3372('0xe'));var deskjs=require(_0x3372('0xf'));var toCsv=require(_0x3372('0x9'));var querystring=require(_0x3372('0x10'));var Papa=require('papaparse');var Redis=require(_0x3372('0x11'));var authService=require(_0x3372('0x12'));var qs=require(_0x3372('0x13'));var as=require(_0x3372('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3372('0x15'));var utils=require(_0x3372('0x16'));var config=require(_0x3372('0x17'));var licenseUtil=require(_0x3372('0x18'));var db=require(_0x3372('0x19'))['db'];function respondWithStatusCode(_0x93363f,_0x427cf8){_0x427cf8=_0x427cf8||0xcc;return function(_0x1a8c82){if(_0x1a8c82){return _0x93363f['sendStatus'](_0x427cf8);}return _0x93363f[_0x3372('0x1a')](_0x427cf8)['end']();};}function respondWithResult(_0x2311e2,_0x31ed3d){_0x31ed3d=_0x31ed3d||0xc8;return function(_0x52a117){if(_0x52a117){return _0x2311e2['status'](_0x31ed3d)[_0x3372('0x1b')](_0x52a117);}};}function respondWithFilteredResult(_0x3feecb,_0x4c6943){return function(_0x3c62af){if(_0x3c62af){var _0x55d20a=typeof _0x4c6943[_0x3372('0x1c')]===_0x3372('0x1d')&&typeof _0x4c6943['limit']===_0x3372('0x1d');var _0x2adcbd=_0x3c62af['count'];var _0x5ee16e=_0x55d20a?0x0:_0x4c6943[_0x3372('0x1c')];var _0x26d294=_0x55d20a?_0x3c62af['count']:_0x4c6943['offset']+_0x4c6943['limit'];var _0x329014;if(_0x26d294>=_0x2adcbd){_0x26d294=_0x2adcbd;_0x329014=0xc8;}else{_0x329014=0xce;}_0x3feecb[_0x3372('0x1a')](_0x329014);return _0x3feecb[_0x3372('0x1e')](_0x3372('0x1f'),_0x5ee16e+'-'+_0x26d294+'/'+_0x2adcbd)['json'](_0x3c62af);}return null;};}function patchUpdates(_0x4a4508){return function(_0x39a46f){try{jsonpatch[_0x3372('0x20')](_0x39a46f,_0x4a4508,!![]);}catch(_0x3c907c){return BPromise[_0x3372('0x21')](_0x3c907c);}return _0x39a46f[_0x3372('0x22')]();};}function saveUpdates(_0x31540f,_0x56d26c){return function(_0x5b231f){if(_0x5b231f){return _0x5b231f[_0x3372('0x23')](_0x31540f)[_0x3372('0x24')](function(_0x2d8c2e){return _0x2d8c2e;});}return null;};}function removeEntity(_0x37f387,_0x69ce0c){return function(_0x110fab){if(_0x110fab){return _0x110fab[_0x3372('0x25')]()[_0x3372('0x24')](function(){_0x37f387[_0x3372('0x1a')](0xcc)[_0x3372('0x26')]();});}};}function handleEntityNotFound(_0xf43e92,_0x366ac1){return function(_0x1fa2f5){if(!_0x1fa2f5){_0xf43e92[_0x3372('0x27')](0x194);}return _0x1fa2f5;};}function handleError(_0x12c2eb,_0x3d500a){_0x3d500a=_0x3d500a||0x1f4;return function(_0x29b17a){logger[_0x3372('0x28')](_0x29b17a[_0x3372('0x29')]);if(_0x29b17a[_0x3372('0x2a')]){delete _0x29b17a[_0x3372('0x2a')];}_0x12c2eb[_0x3372('0x1a')](_0x3d500a)[_0x3372('0x2b')](_0x29b17a);};}exports[_0x3372('0x2c')]=function(_0x324093,_0x558e5){var _0x2fd83b={},_0x23898f={},_0x42c034={'count':0x0,'rows':[]};var _0x5b01a8=_[_0x3372('0x2d')](db[_0x3372('0x2e')]['rawAttributes'],function(_0x64868){return{'name':_0x64868[_0x3372('0x2f')],'type':_0x64868[_0x3372('0x30')][_0x3372('0x31')]};});_0x23898f[_0x3372('0x32')]=_[_0x3372('0x2d')](_0x5b01a8,'name');_0x23898f[_0x3372('0x33')]=_[_0x3372('0x34')](_0x324093[_0x3372('0x33')]);_0x23898f['filters']=_['intersection'](_0x23898f[_0x3372('0x32')],_0x23898f[_0x3372('0x33')]);_0x2fd83b[_0x3372('0x35')]=_[_0x3372('0x36')](_0x23898f['model'],qs['fields'](_0x324093[_0x3372('0x33')]['fields']));_0x2fd83b['attributes']=_0x2fd83b[_0x3372('0x35')][_0x3372('0x37')]?_0x2fd83b[_0x3372('0x35')]:_0x23898f[_0x3372('0x32')];if(!_0x324093['query']['hasOwnProperty']('nolimit')){_0x2fd83b['limit']=qs[_0x3372('0x38')](_0x324093[_0x3372('0x33')][_0x3372('0x38')]);_0x2fd83b[_0x3372('0x1c')]=qs[_0x3372('0x1c')](_0x324093[_0x3372('0x33')][_0x3372('0x1c')]);}_0x2fd83b['order']=qs['sort'](_0x324093[_0x3372('0x33')][_0x3372('0x39')]);_0x2fd83b[_0x3372('0x3a')]=qs[_0x3372('0x3b')](_[_0x3372('0x3c')](_0x324093[_0x3372('0x33')],_0x23898f[_0x3372('0x3b')]),_0x5b01a8);if(_0x324093[_0x3372('0x33')][_0x3372('0x3d')]){_0x2fd83b[_0x3372('0x3a')]=_[_0x3372('0x3e')](_0x2fd83b['where'],{'$or':_[_0x3372('0x2d')](_0x5b01a8,function(_0x2208e0){if(_0x2208e0[_0x3372('0x30')]!=='VIRTUAL'){var _0x6d3b8b={};_0x6d3b8b[_0x2208e0[_0x3372('0x2a')]]={'$like':'%'+_0x324093[_0x3372('0x33')][_0x3372('0x3d')]+'%'};return _0x6d3b8b;}})});}_0x2fd83b=_[_0x3372('0x3e')]({},_0x2fd83b,_0x324093['options']);var _0x104332={'where':_0x2fd83b[_0x3372('0x3a')]};return db[_0x3372('0x2e')][_0x3372('0x3f')](_0x104332)[_0x3372('0x24')](function(_0x5e88a2){_0x42c034[_0x3372('0x3f')]=_0x5e88a2;if(_0x324093[_0x3372('0x33')][_0x3372('0x40')]){_0x2fd83b[_0x3372('0x41')]=[{'all':!![]}];}return db[_0x3372('0x2e')][_0x3372('0x42')](_0x2fd83b);})[_0x3372('0x24')](function(_0x3b44ad){_0x42c034[_0x3372('0x43')]=_0x3b44ad;return _0x42c034;})[_0x3372('0x24')](respondWithFilteredResult(_0x558e5,_0x2fd83b))[_0x3372('0x44')](handleError(_0x558e5,null));};exports['show']=function(_0x21482a,_0x1e29c6){var _0x4401e6={'raw':!![],'where':{'id':_0x21482a[_0x3372('0x45')]['id']}},_0x5b184d={};_0x5b184d[_0x3372('0x32')]=_[_0x3372('0x34')](db[_0x3372('0x2e')][_0x3372('0x46')]);_0x5b184d[_0x3372('0x33')]=_[_0x3372('0x34')](_0x21482a[_0x3372('0x33')]);_0x5b184d[_0x3372('0x3b')]=_['intersection'](_0x5b184d[_0x3372('0x32')],_0x5b184d[_0x3372('0x33')]);_0x4401e6[_0x3372('0x35')]=_[_0x3372('0x36')](_0x5b184d['model'],qs[_0x3372('0x47')](_0x21482a[_0x3372('0x33')][_0x3372('0x47')]));_0x4401e6['attributes']=_0x4401e6['attributes'][_0x3372('0x37')]?_0x4401e6[_0x3372('0x35')]:_0x5b184d['model'];if(_0x21482a['query'][_0x3372('0x40')]){_0x4401e6[_0x3372('0x41')]=[{'all':!![]}];}_0x4401e6=_[_0x3372('0x3e')]({},_0x4401e6,_0x21482a[_0x3372('0x48')]);return db['MailTransferReport'][_0x3372('0x49')](_0x4401e6)[_0x3372('0x24')](handleEntityNotFound(_0x1e29c6,null))['then'](respondWithResult(_0x1e29c6,null))[_0x3372('0x44')](handleError(_0x1e29c6,null));};exports['create']=function(_0x3f54e7,_0x51a0ff){return db['MailTransferReport']['create'](_0x3f54e7[_0x3372('0x4a')],{})[_0x3372('0x24')](respondWithResult(_0x51a0ff,0xc9))[_0x3372('0x44')](handleError(_0x51a0ff,null));};exports[_0x3372('0x23')]=function(_0x5ab185,_0x3bf922){if(_0x5ab185[_0x3372('0x4a')]['id']){delete _0x5ab185[_0x3372('0x4a')]['id'];}return db[_0x3372('0x2e')]['find']({'where':{'id':_0x5ab185[_0x3372('0x45')]['id']}})[_0x3372('0x24')](handleEntityNotFound(_0x3bf922,null))[_0x3372('0x24')](saveUpdates(_0x5ab185[_0x3372('0x4a')],null))[_0x3372('0x24')](respondWithResult(_0x3bf922,null))[_0x3372('0x44')](handleError(_0x3bf922,null));};exports[_0x3372('0x25')]=function(_0xe0c78a,_0x28c768){return db['MailTransferReport'][_0x3372('0x49')]({'where':{'id':_0xe0c78a[_0x3372('0x45')]['id']}})[_0x3372('0x24')](handleEntityNotFound(_0x28c768,null))[_0x3372('0x24')](removeEntity(_0x28c768,null))['catch'](handleError(_0x28c768,null));};exports[_0x3372('0x4b')]=function(_0x152c95,_0x454e22){return db[_0x3372('0x2e')][_0x3372('0x4b')]()[_0x3372('0x24')](respondWithResult(_0x454e22,null))[_0x3372('0x44')](handleError(_0x454e22,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 4865d24..f8f0090 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 _0xb55e=['../../config/logger','api','request-promise','path','../../config/environment','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util'];(function(_0x1adb28,_0x1525b6){var _0x2fd43f=function(_0x3b286f){while(--_0x3b286f){_0x1adb28['push'](_0x1adb28['shift']());}};_0x2fd43f(++_0x1525b6);}(_0xb55e,0x106));var _0xeb55=function(_0x347238,_0x1b1751){_0x347238=_0x347238-0x0;var _0x5baa4c=_0xb55e[_0x347238];return _0x5baa4c;};'use strict';var _=require(_0xeb55('0x0'));var util=require(_0xeb55('0x1'));var logger=require(_0xeb55('0x2'))(_0xeb55('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xeb55('0x4'));var fs=require('fs');var path=require(_0xeb55('0x5'));var rimraf=require('rimraf');var config=require(_0xeb55('0x6'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x5738a8,_0x3172e9){return _0x5738a8[_0xeb55('0x7')](_0xeb55('0x8'),attributes,{'tableName':_0xeb55('0x9'),'paranoid':![],'indexes':[{'name':_0xeb55('0xa'),'fields':[_0xeb55('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3d4f=['../../config/logger','moment','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x3d4f,0xef));var _0xf3d4=function(_0xe5287b,_0x26b8ab){_0xe5287b=_0xe5287b-0x0;var _0x346f77=_0x3d4f[_0xe5287b];return _0x346f77;};'use strict';var _=require('lodash');var util=require(_0xf3d4('0x0'));var logger=require(_0xf3d4('0x1'))('api');var moment=require(_0xf3d4('0x2'));var BPromise=require('bluebird');var rp=require(_0xf3d4('0x3'));var fs=require('fs');var path=require(_0xf3d4('0x4'));var rimraf=require('rimraf');var config=require(_0xf3d4('0x5'));var attributes=require(_0xf3d4('0x6'));module[_0xf3d4('0x7')]=function(_0x286306,_0x14ab14){return _0x286306[_0xf3d4('0x8')](_0xf3d4('0x9'),attributes,{'tableName':_0xf3d4('0xa'),'paranoid':![],'indexes':[{'name':_0xf3d4('0xb'),'fields':[_0xf3d4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index f04d637..128b802 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 _0x1401=['stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x447863,_0x5bf764){var _0x1d9843=function(_0x179cd6){while(--_0x179cd6){_0x447863['push'](_0x447863['shift']());}};_0x1d9843(++_0x5bf764);}(_0x1401,0x131));var _0x1140=function(_0x1bdc52,_0x4876a9){_0x1bdc52=_0x1bdc52-0x0;var _0xdf3fa3=_0x1401[_0x1bdc52];return _0xdf3fa3;};'use strict';var _=require('lodash');var util=require(_0x1140('0x0'));var moment=require(_0x1140('0x1'));var BPromise=require(_0x1140('0x2'));var rs=require(_0x1140('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1140('0x4'))['db'];var utils=require(_0x1140('0x5'));var logger=require('../../config/logger')(_0x1140('0x6'));var config=require(_0x1140('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1140('0x8')][_0x1140('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2efdee,_0x570f65,_0xd52e00){return new BPromise(function(_0x18e9ef,_0x4e2a74){return client['request'](_0x2efdee,_0xd52e00)[_0x1140('0xa')](function(_0x44cb95){logger[_0x1140('0xb')](_0x1140('0xc'),_0x570f65,_0x1140('0xd'));logger['debug'](_0x1140('0xe'),_0x570f65,_0x1140('0xd'),JSON[_0x1140('0xf')](_0x44cb95));if(_0x44cb95[_0x1140('0x10')]){if(_0x44cb95[_0x1140('0x10')]['code']===0x1f4){logger[_0x1140('0x10')](_0x1140('0xc'),_0x570f65,_0x44cb95[_0x1140('0x10')][_0x1140('0x11')]);return _0x4e2a74(_0x44cb95[_0x1140('0x10')]['message']);}logger[_0x1140('0x10')](_0x1140('0xc'),_0x570f65,_0x44cb95[_0x1140('0x10')][_0x1140('0x11')]);return _0x18e9ef(_0x44cb95[_0x1140('0x10')]['message']);}else{logger[_0x1140('0xb')](_0x1140('0xc'),_0x570f65,_0x1140('0xd'));_0x18e9ef(_0x44cb95[_0x1140('0x12')][_0x1140('0x11')]);}})[_0x1140('0x13')](function(_0x9eda0c){logger[_0x1140('0x10')](_0x1140('0xc'),_0x570f65,_0x9eda0c);_0x4e2a74(_0x9eda0c);});});} \ No newline at end of file +var _0x3c25=['debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x476c7,_0x298ee0){var _0x47ae56=function(_0x4acf5a){while(--_0x4acf5a){_0x476c7['push'](_0x476c7['shift']());}};_0x47ae56(++_0x298ee0);}(_0x3c25,0x7a));var _0x53c2=function(_0x5a48e8,_0x3d01ab){_0x5a48e8=_0x5a48e8-0x0;var _0x2a1a19=_0x3c25[_0x5a48e8];return _0x2a1a19;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x53c2('0x0'));var BPromise=require(_0x53c2('0x1'));var rs=require(_0x53c2('0x2'));var fs=require('fs');var Redis=require(_0x53c2('0x3'));var db=require(_0x53c2('0x4'))['db'];var utils=require(_0x53c2('0x5'));var logger=require(_0x53c2('0x6'))(_0x53c2('0x7'));var config=require('../../config/environment');var jayson=require(_0x53c2('0x8'));var client=jayson[_0x53c2('0x9')][_0x53c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47333b,_0x31ffc6,_0x2447e9){return new BPromise(function(_0x54b264,_0x557837){return client[_0x53c2('0xb')](_0x47333b,_0x2447e9)[_0x53c2('0xc')](function(_0x79434e){logger[_0x53c2('0xd')](_0x53c2('0xe'),_0x31ffc6,_0x53c2('0xf'));logger[_0x53c2('0x10')](_0x53c2('0x11'),_0x31ffc6,_0x53c2('0xf'),JSON[_0x53c2('0x12')](_0x79434e));if(_0x79434e[_0x53c2('0x13')]){if(_0x79434e[_0x53c2('0x13')]['code']===0x1f4){logger[_0x53c2('0x13')](_0x53c2('0xe'),_0x31ffc6,_0x79434e[_0x53c2('0x13')][_0x53c2('0x14')]);return _0x557837(_0x79434e['error'][_0x53c2('0x14')]);}logger[_0x53c2('0x13')](_0x53c2('0xe'),_0x31ffc6,_0x79434e[_0x53c2('0x13')][_0x53c2('0x14')]);return _0x54b264(_0x79434e[_0x53c2('0x13')][_0x53c2('0x14')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x31ffc6,'request\x20sent');_0x54b264(_0x79434e[_0x53c2('0x15')]['message']);}})[_0x53c2('0x16')](function(_0x5073a3){logger[_0x53c2('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x31ffc6,_0x5073a3);_0x557837(_0x5073a3);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 3b95941..2ebb349 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 _0x35ba=['index','/describe','isAuthenticated','describe','post','create','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get'];(function(_0x2b6e53,_0x4ed0d2){var _0x35bab1=function(_0x138843){while(--_0x138843){_0x2b6e53['push'](_0x2b6e53['shift']());}};_0x35bab1(++_0x4ed0d2);}(_0x35ba,0x1af));var _0xa35b=function(_0x2543d6,_0x3a5e78){_0x2543d6=_0x2543d6-0x0;var _0x55213c=_0x35ba[_0x2543d6];return _0x55213c;};'use strict';var multer=require(_0xa35b('0x0'));var util=require(_0xa35b('0x1'));var path=require('path');var timeout=require(_0xa35b('0x2'));var express=require(_0xa35b('0x3'));var router=express[_0xa35b('0x4')]();var fs_extra=require(_0xa35b('0x5'));var auth=require(_0xa35b('0x6'));var interaction=require(_0xa35b('0x7'));var config=require('../../config/environment');var controller=require(_0xa35b('0x8'));router[_0xa35b('0x9')]('/',auth['isAuthenticated'](),controller[_0xa35b('0xa')]);router['get'](_0xa35b('0xb'),auth[_0xa35b('0xc')](),controller[_0xa35b('0xd')]);router['get']('/:id',auth[_0xa35b('0xc')](),controller['show']);router[_0xa35b('0xe')]('/',auth[_0xa35b('0xc')](),controller[_0xa35b('0xf')]);router[_0xa35b('0x10')](_0xa35b('0x11'),auth[_0xa35b('0xc')](),controller['update']);router[_0xa35b('0x12')](_0xa35b('0x11'),auth[_0xa35b('0xc')](),controller[_0xa35b('0x13')]);module[_0xa35b('0x14')]=router; \ No newline at end of file +var _0x8b6a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','delete','exports','util','path','connect-timeout','express'];(function(_0x4df79a,_0x312c71){var _0x123bd4=function(_0x57fca7){while(--_0x57fca7){_0x4df79a['push'](_0x4df79a['shift']());}};_0x123bd4(++_0x312c71);}(_0x8b6a,0x152));var _0xa8b6=function(_0x5c54a7,_0x46c3c3){_0x5c54a7=_0x5c54a7-0x0;var _0x55af25=_0x8b6a[_0x5c54a7];return _0x55af25;};'use strict';var multer=require('multer');var util=require(_0xa8b6('0x0'));var path=require(_0xa8b6('0x1'));var timeout=require(_0xa8b6('0x2'));var express=require(_0xa8b6('0x3'));var router=express[_0xa8b6('0x4')]();var fs_extra=require(_0xa8b6('0x5'));var auth=require(_0xa8b6('0x6'));var interaction=require(_0xa8b6('0x7'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0xa8b6('0x8')]('/',auth[_0xa8b6('0x9')](),controller['index']);router[_0xa8b6('0x8')](_0xa8b6('0xa'),auth[_0xa8b6('0x9')](),controller[_0xa8b6('0xb')]);router[_0xa8b6('0x8')](_0xa8b6('0xc'),auth[_0xa8b6('0x9')](),controller[_0xa8b6('0xd')]);router[_0xa8b6('0xe')]('/',auth[_0xa8b6('0x9')](),controller[_0xa8b6('0xf')]);router[_0xa8b6('0x10')](_0xa8b6('0xc'),auth[_0xa8b6('0x9')](),controller['update']);router[_0xa8b6('0x11')]('/:id',auth[_0xa8b6('0x9')](),controller['destroy']);module[_0xa8b6('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index a730dba..5768c85 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 _0xa8f1=['exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','setDataValue'];(function(_0x1a595a,_0x263824){var _0x33f008=function(_0x1e2f9c){while(--_0x1e2f9c){_0x1a595a['push'](_0x1a595a['shift']());}};_0x33f008(++_0x263824);}(_0xa8f1,0x19f));var _0x1a8f=function(_0x1e1f9d,_0x38962c){_0x1e1f9d=_0x1e1f9d-0x0;var _0x4dff0f=_0xa8f1[_0x1e1f9d];return _0x4dff0f;};'use strict';var Sequelize=require(_0x1a8f('0x0'));var moment=require(_0x1a8f('0x1'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1a8f('0x2')]},'interface':{'type':Sequelize[_0x1a8f('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x1a8f('0x3')},'duration':{'type':Sequelize[_0x1a8f('0x4')]},'enterAt':{'type':Sequelize[_0x1a8f('0x5')]},'exitAt':{'type':Sequelize[_0x1a8f('0x5')],'set':function(_0x47bc07){var _0x3f51a9=moment(_0x47bc07);var _0x8fd165=moment(this[_0x1a8f('0x6')](_0x1a8f('0x7')));var _0x559076=_0x3f51a9[_0x1a8f('0x8')](_0x8fd165,'seconds');this[_0x1a8f('0x9')](_0x1a8f('0xa'),_0x47bc07);this[_0x1a8f('0x9')](_0x1a8f('0xb'),_0x559076>=0x0?_0x559076:null);}},'data1':{'type':Sequelize[_0x1a8f('0x2')],'comment':_0x1a8f('0xc')},'data2':{'type':Sequelize[_0x1a8f('0x2')],'comment':_0x1a8f('0xd')},'data3':{'type':Sequelize['STRING'],'comment':_0x1a8f('0xe')},'data4':{'type':Sequelize[_0x1a8f('0x2')],'comment':_0x1a8f('0xf')},'data5':{'type':Sequelize[_0x1a8f('0x2')],'comment':_0x1a8f('0x10')},'role':{'type':Sequelize[_0x1a8f('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x1a8f('0x2')]}}; \ No newline at end of file +var _0x4d40=['seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4d40,0xf7));var _0x04d4=function(_0x28a8c2,_0x494d5){_0x28a8c2=_0x28a8c2-0x0;var _0x37ac3c=_0x4d40[_0x28a8c2];return _0x37ac3c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x04d4('0x0'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x04d4('0x1')],'defaultValue':_0x04d4('0x2'),'comment':_0x04d4('0x3')},'duration':{'type':Sequelize[_0x04d4('0x4')]},'enterAt':{'type':Sequelize[_0x04d4('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x4cfafc){var _0xd85340=moment(_0x4cfafc);var _0x151c04=moment(this[_0x04d4('0x6')](_0x04d4('0x7')));var _0x4ec79b=_0xd85340[_0x04d4('0x8')](_0x151c04,_0x04d4('0x9'));this['setDataValue'](_0x04d4('0xa'),_0x4cfafc);this[_0x04d4('0xb')](_0x04d4('0xc'),_0x4ec79b>=0x0?_0x4ec79b:null);}},'data1':{'type':Sequelize[_0x04d4('0x1')],'comment':_0x04d4('0xd')},'data2':{'type':Sequelize[_0x04d4('0x1')],'comment':_0x04d4('0xe')},'data3':{'type':Sequelize[_0x04d4('0x1')],'comment':_0x04d4('0xf')},'data4':{'type':Sequelize[_0x04d4('0x1')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x04d4('0x4')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 8f12bbd..d1daa37 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x9addb3,_0x53dcfb){var _0x2a4af0=function(_0x2fce29){while(--_0x2fce29){_0x9addb3['push'](_0x9addb3['shift']());}};_0x2a4af0(++_0x53dcfb);}(_0x3e74,0x175));var _0x43e7=function(_0x3364b4,_0x5bd77a){_0x3364b4=_0x3364b4-0x0;var _0x38a107=_0x3e74[_0x3364b4];return _0x38a107;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x55ca,0x126));var _0xa55c=function(_0x16d6a2,_0x266958){_0x16d6a2=_0x16d6a2-0x0;var _0x681283=_0x55ca[_0x16d6a2];return _0x681283;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 1e701f9..2f4ed81 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 _0xb6b3=['exports','define','MemberReport','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x500439,_0x24b02e){var _0x476501=function(_0x1b92ca){while(--_0x1b92ca){_0x500439['push'](_0x500439['shift']());}};_0x476501(++_0x24b02e);}(_0xb6b3,0x76));var _0x3b6b=function(_0x726aec,_0x3e8ef4){_0x726aec=_0x726aec-0x0;var _0x5f0687=_0xb6b3[_0x726aec];return _0x5f0687;};'use strict';var _=require(_0x3b6b('0x0'));var util=require(_0x3b6b('0x1'));var logger=require(_0x3b6b('0x2'))(_0x3b6b('0x3'));var moment=require(_0x3b6b('0x4'));var BPromise=require('bluebird');var rp=require(_0x3b6b('0x5'));var fs=require('fs');var path=require(_0x3b6b('0x6'));var rimraf=require('rimraf');var config=require(_0x3b6b('0x7'));var attributes=require('./memberReport.attributes');module[_0x3b6b('0x8')]=function(_0x39f562,_0x41edf7){return _0x39f562[_0x3b6b('0x9')](_0x3b6b('0xa'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x3b6b('0xb'),'fields':[_0x3b6b('0xc'),_0x3b6b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3809=['define','MemberReport','report_member','membername_interface','membername','interface','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./memberReport.attributes','exports'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x3809,0xca));var _0x9380=function(_0x4c5ed6,_0x3afd28){_0x4c5ed6=_0x4c5ed6-0x0;var _0x258a74=_0x3809[_0x4c5ed6];return _0x258a74;};'use strict';var _=require('lodash');var util=require(_0x9380('0x0'));var logger=require(_0x9380('0x1'))(_0x9380('0x2'));var moment=require('moment');var BPromise=require(_0x9380('0x3'));var rp=require(_0x9380('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9380('0x5'));var attributes=require(_0x9380('0x6'));module[_0x9380('0x7')]=function(_0x2466bd,_0x26f7f7){return _0x2466bd[_0x9380('0x8')](_0x9380('0x9'),attributes,{'tableName':_0x9380('0xa'),'paranoid':![],'indexes':[{'name':_0x9380('0xb'),'fields':[_0x9380('0xc'),_0x9380('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index a2d702c..cc32649 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 _0xd86a=['request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','options','raw','where','map','model','attributes','include','CreateMemberReport','create','UpdateMemberReport','body','limit','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x1e8f04,_0x48f7e6){var _0x3181e3=function(_0x28c657){while(--_0x28c657){_0x1e8f04['push'](_0x1e8f04['shift']());}};_0x3181e3(++_0x48f7e6);}(_0xd86a,0xf3));var _0xad86=function(_0x56756b,_0x3e8cc7){_0x56756b=_0x56756b-0x0;var _0xa3002=_0xd86a[_0x56756b];return _0xa3002;};'use strict';var _=require(_0xad86('0x0'));var util=require(_0xad86('0x1'));var moment=require(_0xad86('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad86('0x3'));var db=require(_0xad86('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xad86('0x5'));var config=require(_0xad86('0x6'));var jayson=require(_0xad86('0x7'));var client=jayson[_0xad86('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fa30b,_0x4eeb1f,_0x1da622){return new BPromise(function(_0xb47442,_0x43b855){return client[_0xad86('0x9')](_0x4fa30b,_0x1da622)[_0xad86('0xa')](function(_0x380417){logger[_0xad86('0xb')]('MemberReport,\x20%s,\x20%s',_0x4eeb1f,_0xad86('0xc'));logger[_0xad86('0xd')](_0xad86('0xe'),_0x4eeb1f,_0xad86('0xc'),JSON[_0xad86('0xf')](_0x380417));if(_0x380417['error']){if(_0x380417[_0xad86('0x10')][_0xad86('0x11')]===0x1f4){logger['error'](_0xad86('0x12'),_0x4eeb1f,_0x380417[_0xad86('0x10')]['message']);return _0x43b855(_0x380417[_0xad86('0x10')]['message']);}logger[_0xad86('0x10')]('MemberReport,\x20%s,\x20%s',_0x4eeb1f,_0x380417[_0xad86('0x10')][_0xad86('0x13')]);return _0xb47442(_0x380417['error'][_0xad86('0x13')]);}else{logger[_0xad86('0xb')]('MemberReport,\x20%s,\x20%s',_0x4eeb1f,_0xad86('0xc'));_0xb47442(_0x380417[_0xad86('0x14')][_0xad86('0x13')]);}})[_0xad86('0x15')](function(_0x23e02e){logger[_0xad86('0x10')](_0xad86('0x12'),_0x4eeb1f,_0x23e02e);_0x43b855(_0x23e02e);});});}exports[_0xad86('0x16')]=function(_0x54ff5d){var _0xb8377e=this;return new Promise(function(_0x167d8c,_0x5461cc){return db[_0xad86('0x17')]['findAll']({'raw':_0x54ff5d['options']?_0x54ff5d[_0xad86('0x18')][_0xad86('0x19')]===undefined?!![]:![]:!![],'where':_0x54ff5d[_0xad86('0x18')]?_0x54ff5d[_0xad86('0x18')][_0xad86('0x1a')]||null:null,'attributes':_0x54ff5d[_0xad86('0x18')]?_0x54ff5d[_0xad86('0x18')]['attributes']||null:null,'limit':_0x54ff5d[_0xad86('0x18')]?_0x54ff5d['options']['limit']||null:null,'include':_0x54ff5d['options']?_0x54ff5d['options']['include']?_[_0xad86('0x1b')](_0x54ff5d[_0xad86('0x18')]['include'],function(_0x1c040d){return{'model':db[_0x1c040d[_0xad86('0x1c')]],'as':_0x1c040d['as'],'attributes':_0x1c040d[_0xad86('0x1d')],'include':_0x1c040d[_0xad86('0x1e')]?_[_0xad86('0x1b')](_0x1c040d[_0xad86('0x1e')],function(_0x33634e){return{'model':db[_0x33634e[_0xad86('0x1c')]],'as':_0x33634e['as'],'attributes':_0x33634e[_0xad86('0x1d')],'include':_0x33634e['include']?_[_0xad86('0x1b')](_0x33634e[_0xad86('0x1e')],function(_0x55b92f){return{'model':db[_0x55b92f['model']],'as':_0x55b92f['as'],'attributes':_0x55b92f[_0xad86('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xad86('0xa')](function(_0x2d2e60){logger['info'](_0xad86('0x16'),_0x54ff5d);logger['debug'](_0xad86('0x16'),_0x54ff5d,JSON[_0xad86('0xf')](_0x2d2e60));_0x167d8c(_0x2d2e60);})[_0xad86('0x15')](function(_0x3e2776){logger[_0xad86('0x10')](_0xad86('0x16'),_0x3e2776['message'],_0x54ff5d);_0x5461cc(_0xb8377e[_0xad86('0x10')](0x1f4,_0x3e2776[_0xad86('0x13')]));});});};exports[_0xad86('0x1f')]=function(_0x4c66b4){var _0x453619=this;return new Promise(function(_0x2c2fab,_0x17a0fe){return db[_0xad86('0x17')][_0xad86('0x20')](_0x4c66b4['body'],{'raw':_0x4c66b4['options']?_0x4c66b4[_0xad86('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xad86('0xa')](function(_0x230329){logger[_0xad86('0xb')](_0xad86('0x1f'),_0x4c66b4);logger[_0xad86('0xd')]('CreateMemberReport',_0x4c66b4,JSON[_0xad86('0xf')](_0x230329));_0x2c2fab(_0x230329);})[_0xad86('0x15')](function(_0x53ad97){logger['error'](_0xad86('0x1f'),_0x53ad97['message'],_0x4c66b4);_0x17a0fe(_0x453619[_0xad86('0x10')](0x1f4,_0x53ad97[_0xad86('0x13')]));});});};exports[_0xad86('0x21')]=function(_0x5d2aca){var _0x566da7=this;return new Promise(function(_0x404a85,_0x2bb73e){return db[_0xad86('0x17')]['update'](_0x5d2aca[_0xad86('0x22')],{'raw':_0x5d2aca[_0xad86('0x18')]?_0x5d2aca[_0xad86('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d2aca[_0xad86('0x18')]?_0x5d2aca[_0xad86('0x18')][_0xad86('0x1a')]||null:null,'attributes':_0x5d2aca[_0xad86('0x18')]?_0x5d2aca[_0xad86('0x18')][_0xad86('0x1d')]||null:null,'limit':_0x5d2aca[_0xad86('0x18')]?_0x5d2aca[_0xad86('0x18')][_0xad86('0x23')]||null:null})[_0xad86('0xa')](function(_0x30de05){logger[_0xad86('0xb')](_0xad86('0x21'),_0x5d2aca);logger[_0xad86('0xd')]('UpdateMemberReport',_0x5d2aca,JSON[_0xad86('0xf')](_0x30de05));_0x404a85(_0x30de05);})['catch'](function(_0x387748){logger[_0xad86('0x10')](_0xad86('0x21'),_0x387748[_0xad86('0x13')],_0x5d2aca);_0x2bb73e(_0x566da7['error'](0x1f4,_0x387748[_0xad86('0x13')]));});});}; \ No newline at end of file +var _0xc1fa=['options','where','attributes','include','map','model','debug','CreateMemberReport','create','body','raw','stringify','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMemberReport','MemberReport','findAll'];(function(_0x59460a,_0x14a5df){var _0x523d12=function(_0x12c998){while(--_0x12c998){_0x59460a['push'](_0x59460a['shift']());}};_0x523d12(++_0x14a5df);}(_0xc1fa,0x83));var _0xac1f=function(_0x277af0,_0x1f0361){_0x277af0=_0x277af0-0x0;var _0x43bd7c=_0xc1fa[_0x277af0];return _0x43bd7c;};'use strict';var _=require(_0xac1f('0x0'));var util=require(_0xac1f('0x1'));var moment=require(_0xac1f('0x2'));var BPromise=require(_0xac1f('0x3'));var rs=require(_0xac1f('0x4'));var fs=require('fs');var Redis=require(_0xac1f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xac1f('0x6'));var logger=require(_0xac1f('0x7'))(_0xac1f('0x8'));var config=require(_0xac1f('0x9'));var jayson=require(_0xac1f('0xa'));var client=jayson[_0xac1f('0xb')][_0xac1f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x406495,_0x306807,_0xef0b44){return new BPromise(function(_0x33d385,_0x384cd2){return client['request'](_0x406495,_0xef0b44)[_0xac1f('0xd')](function(_0x45d5ec){logger[_0xac1f('0xe')](_0xac1f('0xf'),_0x306807,_0xac1f('0x10'));logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x306807,_0xac1f('0x10'),JSON['stringify'](_0x45d5ec));if(_0x45d5ec['error']){if(_0x45d5ec[_0xac1f('0x11')][_0xac1f('0x12')]===0x1f4){logger['error'](_0xac1f('0xf'),_0x306807,_0x45d5ec[_0xac1f('0x11')][_0xac1f('0x13')]);return _0x384cd2(_0x45d5ec[_0xac1f('0x11')][_0xac1f('0x13')]);}logger[_0xac1f('0x11')](_0xac1f('0xf'),_0x306807,_0x45d5ec[_0xac1f('0x11')][_0xac1f('0x13')]);return _0x33d385(_0x45d5ec[_0xac1f('0x11')][_0xac1f('0x13')]);}else{logger[_0xac1f('0xe')](_0xac1f('0xf'),_0x306807,'request\x20sent');_0x33d385(_0x45d5ec[_0xac1f('0x14')][_0xac1f('0x13')]);}})[_0xac1f('0x15')](function(_0x494f0c){logger[_0xac1f('0x11')]('MemberReport,\x20%s,\x20%s',_0x306807,_0x494f0c);_0x384cd2(_0x494f0c);});});}exports[_0xac1f('0x16')]=function(_0x1c5e74){var _0x120b4e=this;return new Promise(function(_0x3f826,_0x518180){return db[_0xac1f('0x17')][_0xac1f('0x18')]({'raw':_0x1c5e74['options']?_0x1c5e74[_0xac1f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1c5e74[_0xac1f('0x19')]?_0x1c5e74[_0xac1f('0x19')][_0xac1f('0x1a')]||null:null,'attributes':_0x1c5e74[_0xac1f('0x19')]?_0x1c5e74[_0xac1f('0x19')][_0xac1f('0x1b')]||null:null,'limit':_0x1c5e74[_0xac1f('0x19')]?_0x1c5e74[_0xac1f('0x19')]['limit']||null:null,'include':_0x1c5e74['options']?_0x1c5e74[_0xac1f('0x19')][_0xac1f('0x1c')]?_[_0xac1f('0x1d')](_0x1c5e74[_0xac1f('0x19')][_0xac1f('0x1c')],function(_0x2718d3){return{'model':db[_0x2718d3[_0xac1f('0x1e')]],'as':_0x2718d3['as'],'attributes':_0x2718d3['attributes'],'include':_0x2718d3[_0xac1f('0x1c')]?_[_0xac1f('0x1d')](_0x2718d3[_0xac1f('0x1c')],function(_0x5b69ce){return{'model':db[_0x5b69ce['model']],'as':_0x5b69ce['as'],'attributes':_0x5b69ce[_0xac1f('0x1b')],'include':_0x5b69ce[_0xac1f('0x1c')]?_[_0xac1f('0x1d')](_0x5b69ce[_0xac1f('0x1c')],function(_0x1f1472){return{'model':db[_0x1f1472[_0xac1f('0x1e')]],'as':_0x1f1472['as'],'attributes':_0x1f1472[_0xac1f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xac1f('0xd')](function(_0x22b33a){logger['info'](_0xac1f('0x16'),_0x1c5e74);logger[_0xac1f('0x1f')](_0xac1f('0x16'),_0x1c5e74,JSON['stringify'](_0x22b33a));_0x3f826(_0x22b33a);})['catch'](function(_0x35fa85){logger[_0xac1f('0x11')](_0xac1f('0x16'),_0x35fa85['message'],_0x1c5e74);_0x518180(_0x120b4e['error'](0x1f4,_0x35fa85[_0xac1f('0x13')]));});});};exports[_0xac1f('0x20')]=function(_0x3a930d){var _0x1a0701=this;return new Promise(function(_0x1d3601,_0x427119){return db[_0xac1f('0x17')][_0xac1f('0x21')](_0x3a930d[_0xac1f('0x22')],{'raw':_0x3a930d[_0xac1f('0x19')]?_0x3a930d[_0xac1f('0x19')][_0xac1f('0x23')]===undefined?!![]:![]:!![]})[_0xac1f('0xd')](function(_0x3f3645){logger[_0xac1f('0xe')](_0xac1f('0x20'),_0x3a930d);logger[_0xac1f('0x1f')]('CreateMemberReport',_0x3a930d,JSON[_0xac1f('0x24')](_0x3f3645));_0x1d3601(_0x3f3645);})[_0xac1f('0x15')](function(_0x122c3d){logger['error'](_0xac1f('0x20'),_0x122c3d[_0xac1f('0x13')],_0x3a930d);_0x427119(_0x1a0701[_0xac1f('0x11')](0x1f4,_0x122c3d[_0xac1f('0x13')]));});});};exports[_0xac1f('0x25')]=function(_0x4a8d06){var _0x2777ca=this;return new Promise(function(_0x1a94e6,_0x3a8292){return db[_0xac1f('0x17')][_0xac1f('0x26')](_0x4a8d06[_0xac1f('0x22')],{'raw':_0x4a8d06[_0xac1f('0x19')]?_0x4a8d06[_0xac1f('0x19')][_0xac1f('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a8d06[_0xac1f('0x19')]?_0x4a8d06[_0xac1f('0x19')][_0xac1f('0x1a')]||null:null,'attributes':_0x4a8d06[_0xac1f('0x19')]?_0x4a8d06[_0xac1f('0x19')][_0xac1f('0x1b')]||null:null,'limit':_0x4a8d06[_0xac1f('0x19')]?_0x4a8d06['options']['limit']||null:null})[_0xac1f('0xd')](function(_0xa81088){logger[_0xac1f('0xe')]('UpdateMemberReport',_0x4a8d06);logger[_0xac1f('0x1f')](_0xac1f('0x25'),_0x4a8d06,JSON[_0xac1f('0x24')](_0xa81088));_0x1a94e6(_0xa81088);})[_0xac1f('0x15')](function(_0x2fcfea){logger[_0xac1f('0x11')]('UpdateMemberReport',_0x2fcfea['message'],_0x4a8d06);_0x3a8292(_0x2777ca['error'](0x1f4,_0x2fcfea['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index de105e8..c614135 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 _0x3880=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./migration.controller','index','multer','util','path'];(function(_0x201f5b,_0x390f63){var _0x427128=function(_0x461e4f){while(--_0x461e4f){_0x201f5b['push'](_0x201f5b['shift']());}};_0x427128(++_0x390f63);}(_0x3880,0x13d));var _0x0388=function(_0x33815a,_0x25a869){_0x33815a=_0x33815a-0x0;var _0x45deb1=_0x3880[_0x33815a];return _0x45deb1;};'use strict';var multer=require(_0x0388('0x0'));var util=require(_0x0388('0x1'));var path=require(_0x0388('0x2'));var timeout=require(_0x0388('0x3'));var express=require(_0x0388('0x4'));var router=express[_0x0388('0x5')]();var fs_extra=require(_0x0388('0x6'));var auth=require(_0x0388('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0388('0x8'));router['get']('/',controller[_0x0388('0x9')]);module['exports']=router; \ No newline at end of file +var _0x201d=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','exports','path'];(function(_0x18f7cd,_0x566dcb){var _0x41bb43=function(_0x3fef44){while(--_0x3fef44){_0x18f7cd['push'](_0x18f7cd['shift']());}};_0x41bb43(++_0x566dcb);}(_0x201d,0x97));var _0xd201=function(_0x5cbcca,_0x40c626){_0x5cbcca=_0x5cbcca-0x0;var _0x5392aa=_0x201d[_0x5cbcca];return _0x5392aa;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd201('0x0'));var timeout=require('connect-timeout');var express=require(_0xd201('0x1'));var router=express[_0xd201('0x2')]();var fs_extra=require(_0xd201('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd201('0x4'));var config=require(_0xd201('0x5'));var controller=require('./migration.controller');router['get']('/',controller[_0xd201('0x6')]);module[_0xd201('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 ccc13f7..fe21429 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 _0x13e6=['version','sequelize','exports','STRING'];(function(_0x2ca794,_0x3e0030){var _0x27b67b=function(_0x40f96b){while(--_0x40f96b){_0x2ca794['push'](_0x2ca794['shift']());}};_0x27b67b(++_0x3e0030);}(_0x13e6,0x81));var _0x613e=function(_0x52a2cd,_0x5015f3){_0x52a2cd=_0x52a2cd-0x0;var _0x153b82=_0x13e6[_0x52a2cd];return _0x153b82;};'use strict';var Sequelize=require(_0x613e('0x0'));module[_0x613e('0x1')]={'version':{'type':Sequelize[_0x613e('0x2')],'unique':_0x613e('0x3')}}; \ No newline at end of file +var _0xb8df=['exports','version','sequelize'];(function(_0x48dd5c,_0x5b6cb5){var _0x522607=function(_0x150246){while(--_0x150246){_0x48dd5c['push'](_0x48dd5c['shift']());}};_0x522607(++_0x5b6cb5);}(_0xb8df,0x74));var _0xfb8d=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xb8df[_0x4b7b62];return _0x2280df;};'use strict';var Sequelize=require(_0xfb8d('0x0'));module[_0xfb8d('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0xfb8d('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index de55e3d..78c58c1 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 _0xb5ba=['bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','apply','reject','save','then','destroy','error','stack','index','map','Migration','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','eml-format','fast-json-patch','moment'];(function(_0x5a2655,_0x3e36c3){var _0x4ddb50=function(_0x484f5e){while(--_0x484f5e){_0x5a2655['push'](_0x5a2655['shift']());}};_0x4ddb50(++_0x3e36c3);}(_0xb5ba,0xe9));var _0xab5b=function(_0x27a3cb,_0x4af597){_0x27a3cb=_0x27a3cb-0x0;var _0x54ff38=_0xb5ba[_0x27a3cb];return _0x54ff38;};'use strict';var emlformat=require(_0xab5b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xab5b('0x1'));var rp=require('request-promise');var moment=require(_0xab5b('0x2'));var BPromise=require(_0xab5b('0x3'));var Mustache=require('mustache');var util=require(_0xab5b('0x4'));var path=require(_0xab5b('0x5'));var sox=require(_0xab5b('0x6'));var csv=require(_0xab5b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab5b('0x8'));var _=require(_0xab5b('0x9'));var squel=require('squel');var crypto=require(_0xab5b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xab5b('0x7'));var querystring=require(_0xab5b('0xb'));var Papa=require(_0xab5b('0xc'));var Redis=require(_0xab5b('0xd'));var authService=require(_0xab5b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xab5b('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xab5b('0x10'))(_0xab5b('0x11'));var utils=require(_0xab5b('0x12'));var config=require(_0xab5b('0x13'));var licenseUtil=require(_0xab5b('0x14'));var db=require(_0xab5b('0x15'))['db'];function respondWithStatusCode(_0x48bfed,_0x3224c6){_0x3224c6=_0x3224c6||0xcc;return function(_0x26a17d){if(_0x26a17d){return _0x48bfed[_0xab5b('0x16')](_0x3224c6);}return _0x48bfed[_0xab5b('0x17')](_0x3224c6)[_0xab5b('0x18')]();};}function respondWithResult(_0x41540f,_0x4dd71c){_0x4dd71c=_0x4dd71c||0xc8;return function(_0x4d4d09){if(_0x4d4d09){return _0x41540f['status'](_0x4dd71c)[_0xab5b('0x19')](_0x4d4d09);}};}function respondWithFilteredResult(_0x4bbbd1,_0xd2cc3c){return function(_0x2f5f54){if(_0x2f5f54){var _0x42c94d=typeof _0xd2cc3c[_0xab5b('0x1a')]==='undefined'&&typeof _0xd2cc3c['limit']==='undefined';var _0x143714=_0x2f5f54[_0xab5b('0x1b')];var _0x570724=_0x42c94d?0x0:_0xd2cc3c['offset'];var _0x439c7d=_0x42c94d?_0x2f5f54[_0xab5b('0x1b')]:_0xd2cc3c[_0xab5b('0x1a')]+_0xd2cc3c[_0xab5b('0x1c')];var _0x316248;if(_0x439c7d>=_0x143714){_0x439c7d=_0x143714;_0x316248=0xc8;}else{_0x316248=0xce;}_0x4bbbd1[_0xab5b('0x17')](_0x316248);return _0x4bbbd1['set']('Content-Range',_0x570724+'-'+_0x439c7d+'/'+_0x143714)['json'](_0x2f5f54);}return null;};}function patchUpdates(_0x322681){return function(_0x3356fe){try{jsonpatch[_0xab5b('0x1d')](_0x3356fe,_0x322681,!![]);}catch(_0x34361e){return BPromise[_0xab5b('0x1e')](_0x34361e);}return _0x3356fe[_0xab5b('0x1f')]();};}function saveUpdates(_0x23b602,_0x120729){return function(_0x256369){if(_0x256369){return _0x256369['update'](_0x23b602)[_0xab5b('0x20')](function(_0x3d3e87){return _0x3d3e87;});}return null;};}function removeEntity(_0xda0db4,_0xa55773){return function(_0x2f4502){if(_0x2f4502){return _0x2f4502[_0xab5b('0x21')]()[_0xab5b('0x20')](function(){_0xda0db4[_0xab5b('0x17')](0xcc)[_0xab5b('0x18')]();});}};}function handleEntityNotFound(_0x3f5e67,_0x530dd2){return function(_0x5c23f4){if(!_0x5c23f4){_0x3f5e67[_0xab5b('0x16')](0x194);}return _0x5c23f4;};}function handleError(_0x5d90df,_0x58c398){_0x58c398=_0x58c398||0x1f4;return function(_0x524c82){logger[_0xab5b('0x22')](_0x524c82[_0xab5b('0x23')]);if(_0x524c82['name']){delete _0x524c82['name'];}_0x5d90df[_0xab5b('0x17')](_0x58c398)['send'](_0x524c82);};}exports[_0xab5b('0x24')]=function(_0x14ae5a,_0x4edea2){var _0x20b8f8={},_0x4b4c89={},_0x4f41e0={'count':0x0,'rows':[]};var _0x489543=_[_0xab5b('0x25')](db[_0xab5b('0x26')]['rawAttributes'],function(_0x4ae315){return{'name':_0x4ae315[_0xab5b('0x27')],'type':_0x4ae315[_0xab5b('0x28')][_0xab5b('0x29')]};});_0x4b4c89[_0xab5b('0x2a')]=_['map'](_0x489543,'name');_0x4b4c89[_0xab5b('0x2b')]=_['keys'](_0x14ae5a[_0xab5b('0x2b')]);_0x4b4c89[_0xab5b('0x2c')]=_[_0xab5b('0x2d')](_0x4b4c89[_0xab5b('0x2a')],_0x4b4c89[_0xab5b('0x2b')]);_0x20b8f8[_0xab5b('0x2e')]=_[_0xab5b('0x2d')](_0x4b4c89['model'],qs[_0xab5b('0x2f')](_0x14ae5a['query'][_0xab5b('0x2f')]));_0x20b8f8[_0xab5b('0x2e')]=_0x20b8f8[_0xab5b('0x2e')][_0xab5b('0x30')]?_0x20b8f8['attributes']:_0x4b4c89[_0xab5b('0x2a')];if(!_0x14ae5a[_0xab5b('0x2b')][_0xab5b('0x31')]('nolimit')){_0x20b8f8[_0xab5b('0x1c')]=qs[_0xab5b('0x1c')](_0x14ae5a[_0xab5b('0x2b')][_0xab5b('0x1c')]);_0x20b8f8[_0xab5b('0x1a')]=qs['offset'](_0x14ae5a[_0xab5b('0x2b')]['offset']);}_0x20b8f8['order']=qs['sort'](_0x14ae5a['query']['sort']);_0x20b8f8[_0xab5b('0x32')]=qs[_0xab5b('0x2c')](_['pick'](_0x14ae5a['query'],_0x4b4c89['filters']),_0x489543);if(_0x14ae5a[_0xab5b('0x2b')][_0xab5b('0x33')]){_0x20b8f8[_0xab5b('0x32')]=_[_0xab5b('0x34')](_0x20b8f8[_0xab5b('0x32')],{'$or':_[_0xab5b('0x25')](_0x489543,function(_0x27a93c){if(_0x27a93c['type']!==_0xab5b('0x35')){var _0x522d72={};_0x522d72[_0x27a93c['name']]={'$like':'%'+_0x14ae5a[_0xab5b('0x2b')][_0xab5b('0x33')]+'%'};return _0x522d72;}})});}_0x20b8f8=_[_0xab5b('0x34')]({},_0x20b8f8,_0x14ae5a[_0xab5b('0x36')]);var _0x5139b7={'where':_0x20b8f8['where']};return db[_0xab5b('0x26')][_0xab5b('0x1b')](_0x5139b7)[_0xab5b('0x20')](function(_0x113be6){_0x4f41e0['count']=_0x113be6;if(_0x14ae5a[_0xab5b('0x2b')][_0xab5b('0x37')]){_0x20b8f8[_0xab5b('0x38')]=[{'all':!![]}];}return db['Migration'][_0xab5b('0x39')](_0x20b8f8);})[_0xab5b('0x20')](function(_0x316d8f){_0x4f41e0['rows']=_0x316d8f;return _0x4f41e0;})[_0xab5b('0x20')](respondWithFilteredResult(_0x4edea2,_0x20b8f8))[_0xab5b('0x3a')](handleError(_0x4edea2,null));}; \ No newline at end of file +var _0x3a44=['undefined','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','rimraf','zip-dir','fast-json-patch','moment','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','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit'];(function(_0x5e6ec8,_0xd061c4){var _0x14c8f8=function(_0x887593){while(--_0x887593){_0x5e6ec8['push'](_0x5e6ec8['shift']());}};_0x14c8f8(++_0xd061c4);}(_0x3a44,0xb0));var _0x43a4=function(_0x14c06f,_0xf680aa){_0x14c06f=_0x14c06f-0x0;var _0x1e9329=_0x3a44[_0x14c06f];return _0x1e9329;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x43a4('0x0'));var zipdir=require(_0x43a4('0x1'));var jsonpatch=require(_0x43a4('0x2'));var rp=require('request-promise');var moment=require(_0x43a4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x43a4('0x4'));var util=require(_0x43a4('0x5'));var path=require(_0x43a4('0x6'));var sox=require(_0x43a4('0x7'));var csv=require(_0x43a4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43a4('0x9'));var _=require(_0x43a4('0xa'));var squel=require(_0x43a4('0xb'));var crypto=require(_0x43a4('0xc'));var jsforce=require(_0x43a4('0xd'));var deskjs=require(_0x43a4('0xe'));var toCsv=require(_0x43a4('0x8'));var querystring=require(_0x43a4('0xf'));var Papa=require(_0x43a4('0x10'));var Redis=require(_0x43a4('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x43a4('0x12'));var hardwareService=require(_0x43a4('0x13'));var logger=require(_0x43a4('0x14'))('api');var utils=require(_0x43a4('0x15'));var config=require(_0x43a4('0x16'));var licenseUtil=require(_0x43a4('0x17'));var db=require(_0x43a4('0x18'))['db'];function respondWithStatusCode(_0x2b00da,_0x47b213){_0x47b213=_0x47b213||0xcc;return function(_0x43a8d7){if(_0x43a8d7){return _0x2b00da[_0x43a4('0x19')](_0x47b213);}return _0x2b00da['status'](_0x47b213)[_0x43a4('0x1a')]();};}function respondWithResult(_0x5d1f60,_0x3c0c26){_0x3c0c26=_0x3c0c26||0xc8;return function(_0x18a98b){if(_0x18a98b){return _0x5d1f60[_0x43a4('0x1b')](_0x3c0c26)[_0x43a4('0x1c')](_0x18a98b);}};}function respondWithFilteredResult(_0x1628b8,_0x56ee05){return function(_0x295447){if(_0x295447){var _0x2b7513=typeof _0x56ee05[_0x43a4('0x1d')]==='undefined'&&typeof _0x56ee05[_0x43a4('0x1e')]===_0x43a4('0x1f');var _0x13277b=_0x295447[_0x43a4('0x20')];var _0x1faccd=_0x2b7513?0x0:_0x56ee05[_0x43a4('0x1d')];var _0x2802a8=_0x2b7513?_0x295447[_0x43a4('0x20')]:_0x56ee05[_0x43a4('0x1d')]+_0x56ee05[_0x43a4('0x1e')];var _0x4ae104;if(_0x2802a8>=_0x13277b){_0x2802a8=_0x13277b;_0x4ae104=0xc8;}else{_0x4ae104=0xce;}_0x1628b8[_0x43a4('0x1b')](_0x4ae104);return _0x1628b8[_0x43a4('0x21')](_0x43a4('0x22'),_0x1faccd+'-'+_0x2802a8+'/'+_0x13277b)[_0x43a4('0x1c')](_0x295447);}return null;};}function patchUpdates(_0x385441){return function(_0x1b3ba7){try{jsonpatch[_0x43a4('0x23')](_0x1b3ba7,_0x385441,!![]);}catch(_0x350652){return BPromise[_0x43a4('0x24')](_0x350652);}return _0x1b3ba7['save']();};}function saveUpdates(_0x19630b,_0x304e83){return function(_0x1706f0){if(_0x1706f0){return _0x1706f0[_0x43a4('0x25')](_0x19630b)[_0x43a4('0x26')](function(_0x25fbd9){return _0x25fbd9;});}return null;};}function removeEntity(_0x2e4e55,_0x4b968a){return function(_0x235678){if(_0x235678){return _0x235678[_0x43a4('0x27')]()[_0x43a4('0x26')](function(){_0x2e4e55[_0x43a4('0x1b')](0xcc)[_0x43a4('0x1a')]();});}};}function handleEntityNotFound(_0x313e7a,_0x18ec28){return function(_0x5836af){if(!_0x5836af){_0x313e7a[_0x43a4('0x19')](0x194);}return _0x5836af;};}function handleError(_0x4f004d,_0x4f3f97){_0x4f3f97=_0x4f3f97||0x1f4;return function(_0x9bd13){logger['error'](_0x9bd13[_0x43a4('0x28')]);if(_0x9bd13[_0x43a4('0x29')]){delete _0x9bd13[_0x43a4('0x29')];}_0x4f004d[_0x43a4('0x1b')](_0x4f3f97)[_0x43a4('0x2a')](_0x9bd13);};}exports[_0x43a4('0x2b')]=function(_0x326275,_0x443ab7){var _0x36f941={},_0x286013={},_0x523009={'count':0x0,'rows':[]};var _0x3d93ba=_[_0x43a4('0x2c')](db[_0x43a4('0x2d')][_0x43a4('0x2e')],function(_0x198455){return{'name':_0x198455[_0x43a4('0x2f')],'type':_0x198455[_0x43a4('0x30')][_0x43a4('0x31')]};});_0x286013[_0x43a4('0x32')]=_[_0x43a4('0x2c')](_0x3d93ba,'name');_0x286013[_0x43a4('0x33')]=_[_0x43a4('0x34')](_0x326275[_0x43a4('0x33')]);_0x286013[_0x43a4('0x35')]=_['intersection'](_0x286013['model'],_0x286013['query']);_0x36f941[_0x43a4('0x36')]=_[_0x43a4('0x37')](_0x286013[_0x43a4('0x32')],qs['fields'](_0x326275['query']['fields']));_0x36f941[_0x43a4('0x36')]=_0x36f941[_0x43a4('0x36')][_0x43a4('0x38')]?_0x36f941[_0x43a4('0x36')]:_0x286013[_0x43a4('0x32')];if(!_0x326275['query'][_0x43a4('0x39')](_0x43a4('0x3a'))){_0x36f941['limit']=qs['limit'](_0x326275[_0x43a4('0x33')][_0x43a4('0x1e')]);_0x36f941[_0x43a4('0x1d')]=qs['offset'](_0x326275['query']['offset']);}_0x36f941['order']=qs[_0x43a4('0x3b')](_0x326275['query'][_0x43a4('0x3b')]);_0x36f941[_0x43a4('0x3c')]=qs[_0x43a4('0x35')](_[_0x43a4('0x3d')](_0x326275['query'],_0x286013['filters']),_0x3d93ba);if(_0x326275[_0x43a4('0x33')][_0x43a4('0x3e')]){_0x36f941[_0x43a4('0x3c')]=_['merge'](_0x36f941[_0x43a4('0x3c')],{'$or':_['map'](_0x3d93ba,function(_0x552996){if(_0x552996['type']!==_0x43a4('0x3f')){var _0x324772={};_0x324772[_0x552996[_0x43a4('0x29')]]={'$like':'%'+_0x326275['query'][_0x43a4('0x3e')]+'%'};return _0x324772;}})});}_0x36f941=_['merge']({},_0x36f941,_0x326275[_0x43a4('0x40')]);var _0x520fe4={'where':_0x36f941[_0x43a4('0x3c')]};return db[_0x43a4('0x2d')][_0x43a4('0x20')](_0x520fe4)[_0x43a4('0x26')](function(_0x5cb613){_0x523009[_0x43a4('0x20')]=_0x5cb613;if(_0x326275[_0x43a4('0x33')]['includeAll']){_0x36f941[_0x43a4('0x41')]=[{'all':!![]}];}return db['Migration'][_0x43a4('0x42')](_0x36f941);})[_0x43a4('0x26')](function(_0x20657c){_0x523009[_0x43a4('0x43')]=_0x20657c;return _0x523009;})[_0x43a4('0x26')](respondWithFilteredResult(_0x443ab7,_0x36f941))[_0x43a4('0x44')](handleError(_0x443ab7,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index a824e7e..fc08c0a 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 _0x010c=['moment','bluebird','request-promise','path','./migration.attributes','define','Migration','lodash','../../config/logger','api'];(function(_0x19eea8,_0x3a80cb){var _0x5ab7e1=function(_0x1a44ca){while(--_0x1a44ca){_0x19eea8['push'](_0x19eea8['shift']());}};_0x5ab7e1(++_0x3a80cb);}(_0x010c,0x16f));var _0xc010=function(_0x304e63,_0x134e71){_0x304e63=_0x304e63-0x0;var _0x3c927a=_0x010c[_0x304e63];return _0x3c927a;};'use strict';var _=require(_0xc010('0x0'));var util=require('util');var logger=require(_0xc010('0x1'))(_0xc010('0x2'));var moment=require(_0xc010('0x3'));var BPromise=require(_0xc010('0x4'));var rp=require(_0xc010('0x5'));var fs=require('fs');var path=require(_0xc010('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc010('0x7'));module['exports']=function(_0x5b1149,_0xc4d55f){return _0x5b1149[_0xc010('0x8')](_0xc010('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x056d=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','migrations','lodash','util'];(function(_0xe4c88c,_0x5c6637){var _0x2a96f2=function(_0x3d39fd){while(--_0x3d39fd){_0xe4c88c['push'](_0xe4c88c['shift']());}};_0x2a96f2(++_0x5c6637);}(_0x056d,0x1c1));var _0xd056=function(_0x3d9ee0,_0x3e106a){_0x3d9ee0=_0x3d9ee0-0x0;var _0x126719=_0x056d[_0x3d9ee0];return _0x126719;};'use strict';var _=require(_0xd056('0x0'));var util=require(_0xd056('0x1'));var logger=require(_0xd056('0x2'))(_0xd056('0x3'));var moment=require('moment');var BPromise=require(_0xd056('0x4'));var rp=require(_0xd056('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd056('0x6'));var config=require(_0xd056('0x7'));var attributes=require('./migration.attributes');module[_0xd056('0x8')]=function(_0x572ce8,_0x4c630f){return _0x572ce8[_0xd056('0x9')]('Migration',attributes,{'tableName':_0xd056('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index abdbd50..e595183 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 _0x97c1=['../../config/logger','rpc','../../config/environment','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x861e02,_0x33f772){var _0x48fc24=function(_0x21b4d3){while(--_0x21b4d3){_0x861e02['push'](_0x861e02['shift']());}};_0x48fc24(++_0x33f772);}(_0x97c1,0xdf));var _0x197c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x97c1[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var moment=require('moment');var BPromise=require(_0x197c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x197c('0x3'))['db'];var utils=require(_0x197c('0x4'));var logger=require(_0x197c('0x5'))(_0x197c('0x6'));var config=require(_0x197c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x197c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x437214,_0x60fab2,_0xfcee35){return new BPromise(function(_0x5cf5cb,_0x5d42c5){return client[_0x197c('0x9')](_0x437214,_0xfcee35)['then'](function(_0x339fab){logger[_0x197c('0xa')](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));logger['debug'](_0x197c('0xd'),_0x60fab2,_0x197c('0xc'),JSON[_0x197c('0xe')](_0x339fab));if(_0x339fab[_0x197c('0xf')]){if(_0x339fab[_0x197c('0xf')]['code']===0x1f4){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5d42c5(_0x339fab['error'][_0x197c('0x10')]);}logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5cf5cb(_0x339fab[_0x197c('0xf')]['message']);}else{logger['info'](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));_0x5cf5cb(_0x339fab[_0x197c('0x11')][_0x197c('0x10')]);}})[_0x197c('0x12')](function(_0x7e302f){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x7e302f);_0x5d42c5(_0x7e302f);});});} \ No newline at end of file +var _0xa588=['stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa588,0xe1));var _0x8a58=function(_0x18e488,_0x3ff5cd){_0x18e488=_0x18e488-0x0;var _0x11f094=_0xa588[_0x18e488];return _0x11f094;};'use strict';var _=require('lodash');var util=require(_0x8a58('0x0'));var moment=require(_0x8a58('0x1'));var BPromise=require(_0x8a58('0x2'));var rs=require(_0x8a58('0x3'));var fs=require('fs');var Redis=require(_0x8a58('0x4'));var db=require(_0x8a58('0x5'))['db'];var utils=require(_0x8a58('0x6'));var logger=require(_0x8a58('0x7'))(_0x8a58('0x8'));var config=require('../../config/environment');var jayson=require(_0x8a58('0x9'));var client=jayson[_0x8a58('0xa')][_0x8a58('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35d5ad,_0xe0af18,_0x140f99){return new BPromise(function(_0x77b421,_0x585376){return client['request'](_0x35d5ad,_0x140f99)[_0x8a58('0xc')](function(_0x39a20e){logger[_0x8a58('0xd')](_0x8a58('0xe'),_0xe0af18,_0x8a58('0xf'));logger['debug'](_0x8a58('0x10'),_0xe0af18,_0x8a58('0xf'),JSON[_0x8a58('0x11')](_0x39a20e));if(_0x39a20e[_0x8a58('0x12')]){if(_0x39a20e['error']['code']===0x1f4){logger[_0x8a58('0x12')]('Migration,\x20%s,\x20%s',_0xe0af18,_0x39a20e[_0x8a58('0x12')][_0x8a58('0x13')]);return _0x585376(_0x39a20e['error'][_0x8a58('0x13')]);}logger[_0x8a58('0x12')]('Migration,\x20%s,\x20%s',_0xe0af18,_0x39a20e[_0x8a58('0x12')][_0x8a58('0x13')]);return _0x77b421(_0x39a20e['error'][_0x8a58('0x13')]);}else{logger[_0x8a58('0xd')](_0x8a58('0xe'),_0xe0af18,_0x8a58('0xf'));_0x77b421(_0x39a20e[_0x8a58('0x14')][_0x8a58('0x13')]);}})[_0x8a58('0x15')](function(_0x49ee0e){logger['error'](_0x8a58('0xe'),_0xe0af18,_0x49ee0e);_0x585376(_0x49ee0e);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 66b2995..8ae0749 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 _0xe2bc=['index','show','create','put','/:id','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated'];(function(_0x4a90a8,_0x4d3929){var _0x88e69d=function(_0x47f737){while(--_0x47f737){_0x4a90a8['push'](_0x4a90a8['shift']());}};_0x88e69d(++_0x4d3929);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xe2bc[_0x9dfc10];return _0x4f938a;};'use strict';var multer=require(_0xce2b('0x0'));var util=require('util');var path=require(_0xce2b('0x1'));var timeout=require('connect-timeout');var express=require(_0xce2b('0x2'));var router=express[_0xce2b('0x3')]();var fs_extra=require(_0xce2b('0x4'));var auth=require(_0xce2b('0x5'));var interaction=require(_0xce2b('0x6'));var config=require('../../config/environment');var controller=require(_0xce2b('0x7'));router[_0xce2b('0x8')]('/',auth[_0xce2b('0x9')](),controller[_0xce2b('0xa')]);router[_0xce2b('0x8')]('/:id',auth[_0xce2b('0x9')](),controller[_0xce2b('0xb')]);router['post']('/',auth[_0xce2b('0x9')](),controller[_0xce2b('0xc')]);router[_0xce2b('0xd')](_0xce2b('0xe'),auth[_0xce2b('0x9')](),controller[_0xce2b('0xf')]);router[_0xce2b('0x10')](_0xce2b('0xe'),auth[_0xce2b('0x9')](),controller[_0xce2b('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1a0e=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x5039a3,_0x309b19){var _0x3e11b2=function(_0x5859ae){while(--_0x5859ae){_0x5039a3['push'](_0x5039a3['shift']());}};_0x3e11b2(++_0x309b19);}(_0x1a0e,0x1c6));var _0xe1a0=function(_0x4145a8,_0x55e817){_0x4145a8=_0x4145a8-0x0;var _0x155db0=_0x1a0e[_0x4145a8];return _0x155db0;};'use strict';var multer=require(_0xe1a0('0x0'));var util=require(_0xe1a0('0x1'));var path=require(_0xe1a0('0x2'));var timeout=require(_0xe1a0('0x3'));var express=require(_0xe1a0('0x4'));var router=express[_0xe1a0('0x5')]();var fs_extra=require(_0xe1a0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe1a0('0x7'));var config=require('../../config/environment');var controller=require('./network.controller');router['get']('/',auth[_0xe1a0('0x8')](),controller[_0xe1a0('0x9')]);router[_0xe1a0('0xa')](_0xe1a0('0xb'),auth[_0xe1a0('0x8')](),controller[_0xe1a0('0xc')]);router[_0xe1a0('0xd')]('/',auth[_0xe1a0('0x8')](),controller[_0xe1a0('0xe')]);router[_0xe1a0('0xf')](_0xe1a0('0xb'),auth[_0xe1a0('0x8')](),controller[_0xe1a0('0x10')]);router['delete'](_0xe1a0('0xb'),auth['isAuthenticated'](),controller[_0xe1a0('0x11')]);module[_0xe1a0('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 14b4718..4f6d598 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 _0x0333=['stun','STRING','sequelize','exports','localnet','externip'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x0333,0x194));var _0x3033=function(_0x2074db,_0x10b81b){_0x2074db=_0x2074db-0x0;var _0x27324c=_0x0333[_0x2074db];return _0x27324c;};'use strict';var Sequelize=require(_0x3033('0x0'));module[_0x3033('0x1')]={'type':{'type':Sequelize['ENUM'](_0x3033('0x2'),_0x3033('0x3'),_0x3033('0x4'),'turn')},'value':{'type':Sequelize[_0x3033('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x3033('0x5')]}}; \ No newline at end of file +var _0x1333=['externip','stun','turn','STRING','sequelize'];(function(_0x41729c,_0x3a1d61){var _0x41b611=function(_0x127e55){while(--_0x127e55){_0x41729c['push'](_0x41729c['shift']());}};_0x41b611(++_0x3a1d61);}(_0x1333,0x17b));var _0x3133=function(_0x56c1cb,_0x216255){_0x56c1cb=_0x56c1cb-0x0;var _0x3bd932=_0x1333[_0x56c1cb];return _0x3bd932;};'use strict';var Sequelize=require(_0x3133('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('localnet',_0x3133('0x1'),_0x3133('0x2'),_0x3133('0x3'))},'value':{'type':Sequelize[_0x3133('0x4')]},'username':{'type':Sequelize[_0x3133('0x4')]},'password':{'type':Sequelize[_0x3133('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 11b2c4f..7a52ca0 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 _0x17f8=['count','status','set','Content-Range','update','then','end','sendStatus','stack','name','send','map','Network','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','create','body','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','server/files/templates/turn_multiple.ejs','res_stun_monitor.so','root','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','find','params','TURN','/etc/asterisk/turn_xcally.conf','toLowerCase','destroy','util','path','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','json','offset','undefined','limit'];(function(_0x40015a,_0x415db5){var _0x42f8a4=function(_0x5685ad){while(--_0x5685ad){_0x40015a['push'](_0x40015a['shift']());}};_0x42f8a4(++_0x415db5);}(_0x17f8,0x1a3));var _0x817f=function(_0x236ad8,_0x1d4f32){_0x236ad8=_0x236ad8-0x0;var _0x36eb39=_0x17f8[_0x236ad8];return _0x36eb39;};'use strict';var util=require(_0x817f('0x0'));var path=require(_0x817f('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x817f('0x2'));var qs=require(_0x817f('0x3'));var logger=require(_0x817f('0x4'))(_0x817f('0x5'));var config=require(_0x817f('0x6'));var db=require(_0x817f('0x7'))['db'];var jayson=require(_0x817f('0x8'));var client=jayson[_0x817f('0x9')][_0x817f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b4763,_0x473548,_0x1ab13b,_0x1f0eb1){return new Promise(function(_0x2c38c5,_0x18e65a){var _0x24f289=_0x1f0eb1||client;return _0x24f289[_0x817f('0xb')](_0x2b4763,_0x1ab13b)['then'](function(_0x598168){logger[_0x817f('0xc')](_0x817f('0xd'),_0x473548,'request\x20sent');logger[_0x817f('0xe')](_0x817f('0xf'),_0x473548,'request\x20sent',JSON[_0x817f('0x10')](_0x598168));if(_0x598168[_0x817f('0x11')]){if(_0x598168[_0x817f('0x11')][_0x817f('0x12')]===0x1f4){logger[_0x817f('0x11')]('Network,\x20%s,\x20%s',_0x473548,_0x598168[_0x817f('0x11')][_0x817f('0x13')]);return _0x18e65a(_0x598168[_0x817f('0x11')]['message']);}logger[_0x817f('0x11')]('Network,\x20%s,\x20%s',_0x473548,_0x598168[_0x817f('0x11')]['message']);return _0x2c38c5(_0x598168['error']['message']);}else{logger[_0x817f('0xc')]('Network,\x20%s,\x20%s',_0x473548,_0x817f('0x14'));_0x2c38c5(_0x598168['result'][_0x817f('0x13')]);}})[_0x817f('0x15')](function(_0x39a154){logger[_0x817f('0x11')](_0x817f('0xd'),_0x473548,_0x39a154);_0x18e65a(_0x39a154);});});}function respondWithResult(_0x335694,_0xe8d4c6){_0xe8d4c6=_0xe8d4c6||0xc8;return function(_0x2a61ad){if(_0x2a61ad){return _0x335694['status'](_0xe8d4c6)[_0x817f('0x16')](_0x2a61ad);}};}function respondWithFilteredResult(_0xeb83ff,_0xcc6421){return function(_0x4fd641){if(_0x4fd641){var _0x86c65e=typeof _0xcc6421[_0x817f('0x17')]===_0x817f('0x18')&&typeof _0xcc6421[_0x817f('0x19')]===_0x817f('0x18');var _0x3bae53=_0x4fd641[_0x817f('0x1a')];var _0x2a4144=_0x86c65e?0x0:_0xcc6421[_0x817f('0x17')];var _0x3bd919=_0x86c65e?_0x4fd641[_0x817f('0x1a')]:_0xcc6421['offset']+_0xcc6421[_0x817f('0x19')];var _0x37ea1f;if(_0x3bd919>=_0x3bae53){_0x3bd919=_0x3bae53;_0x37ea1f=0xc8;}else{_0x37ea1f=0xce;}_0xeb83ff[_0x817f('0x1b')](_0x37ea1f);return _0xeb83ff[_0x817f('0x1c')](_0x817f('0x1d'),_0x2a4144+'-'+_0x3bd919+'/'+_0x3bae53)[_0x817f('0x16')](_0x4fd641);}return null;};}function saveUpdates(_0x56599c){return function(_0xacfe0a){if(_0xacfe0a){return _0xacfe0a[_0x817f('0x1e')](_0x56599c)[_0x817f('0x1f')](function(_0x4db35d){return _0x4db35d;});}return null;};}function removeEntity(_0x14c7ca){return function(_0x4916ac){if(_0x4916ac){return _0x4916ac['destroy']()[_0x817f('0x1f')](function(){_0x14c7ca['status'](0xcc)[_0x817f('0x20')]();});}};}function handleEntityNotFound(_0x48fedc){return function(_0x3b3418){if(!_0x3b3418){_0x48fedc[_0x817f('0x21')](0x194);}return _0x3b3418;};}function handleError(_0x3e1cd8,_0x47ee5f){_0x47ee5f=_0x47ee5f||0x1f4;return function(_0x5f3a94){logger[_0x817f('0x11')](_0x5f3a94[_0x817f('0x22')]);if(_0x5f3a94[_0x817f('0x23')]){delete _0x5f3a94[_0x817f('0x23')];}_0x3e1cd8[_0x817f('0x1b')](_0x47ee5f)[_0x817f('0x24')](_0x5f3a94);};}exports['index']=function(_0x490680,_0x3d6121){var _0x8c3933={},_0x21a895={},_0x570205={'count':0x0,'rows':[]};var _0x344ad7=_[_0x817f('0x25')](db[_0x817f('0x26')][_0x817f('0x27')],function(_0x4c1c30){return{'name':_0x4c1c30[_0x817f('0x28')],'type':_0x4c1c30[_0x817f('0x29')][_0x817f('0x2a')]};});_0x21a895[_0x817f('0x2b')]=_['map'](_0x344ad7,'name');_0x21a895['query']=_[_0x817f('0x2c')](_0x490680[_0x817f('0x2d')]);_0x21a895[_0x817f('0x2e')]=_[_0x817f('0x2f')](_0x21a895['model'],_0x21a895[_0x817f('0x2d')]);_0x8c3933[_0x817f('0x30')]=_['intersection'](_0x21a895[_0x817f('0x2b')],qs['fields'](_0x490680['query'][_0x817f('0x31')]));_0x8c3933['attributes']=_0x8c3933['attributes'][_0x817f('0x32')]?_0x8c3933['attributes']:_0x21a895['model'];if(!_0x490680[_0x817f('0x2d')][_0x817f('0x33')]('nolimit')){_0x8c3933['limit']=qs[_0x817f('0x19')](_0x490680[_0x817f('0x2d')]['limit']);_0x8c3933['offset']=qs['offset'](_0x490680[_0x817f('0x2d')][_0x817f('0x17')]);}_0x8c3933[_0x817f('0x34')]=qs[_0x817f('0x35')](_0x490680[_0x817f('0x2d')][_0x817f('0x35')]);_0x8c3933[_0x817f('0x36')]=qs['filters'](_[_0x817f('0x37')](_0x490680[_0x817f('0x2d')],_0x21a895[_0x817f('0x2e')]),_0x344ad7);if(_0x490680[_0x817f('0x2d')][_0x817f('0x38')]){_0x8c3933[_0x817f('0x36')]=_[_0x817f('0x39')](_0x8c3933['where'],{'$or':_['map'](_0x344ad7,function(_0x92b6c3){if(_0x92b6c3[_0x817f('0x29')]!=='VIRTUAL'){var _0x34cab4={};_0x34cab4[_0x92b6c3[_0x817f('0x23')]]={'$like':'%'+_0x490680[_0x817f('0x2d')][_0x817f('0x38')]+'%'};return _0x34cab4;}})});}_0x8c3933=_[_0x817f('0x39')]({},_0x8c3933,_0x490680[_0x817f('0x3a')]);var _0x4f656c={'where':_0x8c3933[_0x817f('0x36')]};return db[_0x817f('0x26')][_0x817f('0x1a')](_0x4f656c)[_0x817f('0x1f')](function(_0x5922cb){_0x570205[_0x817f('0x1a')]=_0x5922cb;if(_0x490680[_0x817f('0x2d')][_0x817f('0x3b')]){_0x8c3933[_0x817f('0x3c')]=[{'all':!![]}];}return db[_0x817f('0x26')][_0x817f('0x3d')](_0x8c3933);})[_0x817f('0x1f')](function(_0x3d493a){_0x570205[_0x817f('0x3e')]=_0x3d493a;return _0x570205;})[_0x817f('0x1f')](respondWithFilteredResult(_0x3d6121,_0x8c3933))['catch'](handleError(_0x3d6121,null));};exports[_0x817f('0x3f')]=function(_0x423e09,_0x23b9d8){var _0x1d5ea2={'raw':!![],'where':{'id':_0x423e09['params']['id']}},_0x1015cb={};_0x1015cb[_0x817f('0x2b')]=_[_0x817f('0x2c')](db[_0x817f('0x26')][_0x817f('0x27')]);_0x1015cb[_0x817f('0x2d')]=_[_0x817f('0x2c')](_0x423e09['query']);_0x1015cb[_0x817f('0x2e')]=_['intersection'](_0x1015cb[_0x817f('0x2b')],_0x1015cb[_0x817f('0x2d')]);_0x1d5ea2[_0x817f('0x30')]=_['intersection'](_0x1015cb[_0x817f('0x2b')],qs[_0x817f('0x31')](_0x423e09[_0x817f('0x2d')]['fields']));_0x1d5ea2['attributes']=_0x1d5ea2[_0x817f('0x30')][_0x817f('0x32')]?_0x1d5ea2[_0x817f('0x30')]:_0x1015cb[_0x817f('0x2b')];if(_0x423e09[_0x817f('0x2d')][_0x817f('0x3b')]){_0x1d5ea2[_0x817f('0x3c')]=[{'all':!![]}];}_0x1d5ea2=_[_0x817f('0x39')]({},_0x1d5ea2,_0x423e09[_0x817f('0x3a')]);return db[_0x817f('0x26')]['find'](_0x1d5ea2)[_0x817f('0x1f')](handleEntityNotFound(_0x23b9d8,null))[_0x817f('0x1f')](respondWithResult(_0x23b9d8,null))[_0x817f('0x15')](handleError(_0x23b9d8,null));};exports[_0x817f('0x40')]=function(_0x18c039,_0x59e426){var _0x2dd247;return db[_0x817f('0x26')][_0x817f('0x40')](_0x18c039[_0x817f('0x41')],{'raw':!![]})['then'](function(_0x54bff6){_0x2dd247=_0x54bff6;return db[_0x817f('0x26')][_0x817f('0x3d')]({'where':{'type':_0x18c039['body'][_0x817f('0x29')]},'raw':!![]});})[_0x817f('0x1f')](function(_0x26b5a3){if(_0x2dd247['type'][_0x817f('0x42')]()==_0x817f('0x43')){var _0x376920=fs[_0x817f('0x44')](path[_0x817f('0x45')](config['root'],_0x817f('0x46')),_0x817f('0x47'));var _0x16d3f4=ejs[_0x817f('0x48')](_0x376920,{'networks':_0x26b5a3||[]});fs[_0x817f('0x49')](_0x817f('0x4a'),_0x16d3f4);return respondWithRpcPromise(_0x817f('0x4b'),_0x817f('0x40'),{'module':'res_stun_monitor.so'});}else if(_0x2dd247[_0x817f('0x29')][_0x817f('0x42')]()=='TURN'){var _0x492b63=fs[_0x817f('0x44')](path[_0x817f('0x45')](config['root'],_0x817f('0x4c')),_0x817f('0x47'));var _0x1a9f02=ejs['render'](_0x492b63,{'networks':_0x26b5a3||[]});fs[_0x817f('0x49')]('/etc/asterisk/turn_xcally.conf',_0x1a9f02);return respondWithRpcPromise('Reload',_0x817f('0x40'),{'module':_0x817f('0x4d')});}else{var _0x2ff308=fs[_0x817f('0x44')](path[_0x817f('0x45')](config[_0x817f('0x4e')],_0x817f('0x4f')),_0x817f('0x47'));var _0x14f2f8=ejs[_0x817f('0x48')](_0x2ff308,{'networks':_0x26b5a3||[]});fs[_0x817f('0x49')](util[_0x817f('0x50')](_0x817f('0x51'),_0x18c039[_0x817f('0x41')][_0x817f('0x29')]['toLowerCase']()),_0x14f2f8);return respondWithRpcPromise(_0x817f('0x4b'),_0x817f('0x40'),{'module':_0x817f('0x52')});}})[_0x817f('0x1f')](function(){return _0x2dd247;})['then'](respondWithResult(_0x59e426,0xc9))[_0x817f('0x15')](handleError(_0x59e426,null));};exports[_0x817f('0x1e')]=function(_0xe98f79,_0x386193){var _0x4d01a5;return db[_0x817f('0x26')][_0x817f('0x53')]({'where':{'id':_0xe98f79[_0x817f('0x54')]['id']}})['then'](handleEntityNotFound(_0x386193,null))[_0x817f('0x1f')](saveUpdates(_0xe98f79[_0x817f('0x41')],null))[_0x817f('0x1f')](function(_0x371ce2){if(_0x371ce2){_0x4d01a5=_0x371ce2;return db[_0x817f('0x26')]['findAll']({'where':{'type':_0x4d01a5['type']},'raw':!![]});}return null;})[_0x817f('0x1f')](function(_0x3f3c8d){if(_0x4d01a5['type'][_0x817f('0x42')]()==_0x817f('0x43')){var _0x24c8de=fs[_0x817f('0x44')](path[_0x817f('0x45')](config[_0x817f('0x4e')],'server/files/templates/stun_multiple.ejs'),_0x817f('0x47'));var _0x390067=ejs[_0x817f('0x48')](_0x24c8de,{'networks':_0x3f3c8d||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x390067);return respondWithRpcPromise('Reload','update',{'module':'res_stun_monitor.so'});}else if(_0x4d01a5['type'][_0x817f('0x42')]()==_0x817f('0x55')){var _0x16a4f4=fs[_0x817f('0x44')](path[_0x817f('0x45')](config['root'],_0x817f('0x4c')),_0x817f('0x47'));var _0x1d530d=ejs['render'](_0x16a4f4,{'networks':_0x3f3c8d||[]});fs['writeFileSync'](_0x817f('0x56'),_0x1d530d);return respondWithRpcPromise(_0x817f('0x4b'),_0x817f('0x1e'),{'module':_0x817f('0x4d')});}else{var _0x2ad200=fs['readFileSync'](path[_0x817f('0x45')](config['root'],'server/files/templates/network.ejs'),_0x817f('0x47'));var _0x36d0db=ejs['render'](_0x2ad200,{'networks':_0x3f3c8d||[]});fs['writeFileSync'](util['format'](_0x817f('0x51'),_0xe98f79[_0x817f('0x41')]['type'][_0x817f('0x57')]()),_0x36d0db);return respondWithRpcPromise(_0x817f('0x4b'),'update',{'module':_0x817f('0x52')});}})['then'](function(_0x24b41b){if(_0x24b41b){return _0x4d01a5;}return null;})[_0x817f('0x1f')](respondWithResult(_0x386193,null))[_0x817f('0x15')](handleError(_0x386193,null));};exports[_0x817f('0x58')]=function(_0x55a048,_0x2c58bf){var _0x1ad6ef;return db[_0x817f('0x26')][_0x817f('0x53')]({'where':{'id':_0x55a048[_0x817f('0x54')]['id']}})['then'](function(_0x2f7c7d){_0x1ad6ef=_0x2f7c7d;return _0x2f7c7d;})[_0x817f('0x1f')](handleEntityNotFound(_0x2c58bf,null))['then'](removeEntity(_0x2c58bf,null))[_0x817f('0x1f')](function(){if(_0x1ad6ef){return db[_0x817f('0x26')]['findAll']({'where':{'type':_0x1ad6ef[_0x817f('0x29')]},'raw':!![]});}})[_0x817f('0x1f')](function(_0x2a449d){if(_0x1ad6ef['type'][_0x817f('0x42')]()==_0x817f('0x43')){var _0x59d719=fs[_0x817f('0x44')](path['join'](config[_0x817f('0x4e')],_0x817f('0x46')),_0x817f('0x47'));var _0x5eecf4=ejs[_0x817f('0x48')](_0x59d719,{'networks':_0x2a449d||[]});fs['writeFileSync'](_0x817f('0x4a'),_0x5eecf4);return respondWithRpcPromise(_0x817f('0x4b'),'destroy',{'module':_0x817f('0x4d')});}else if(_0x1ad6ef[_0x817f('0x29')]['toUpperCase']()=='TURN'){var _0x30680d=fs[_0x817f('0x44')](path[_0x817f('0x45')](config[_0x817f('0x4e')],_0x817f('0x4c')),'utf8');var _0x3fa338=ejs['render'](_0x30680d,{'networks':_0x2a449d||[]});fs[_0x817f('0x49')](_0x817f('0x56'),_0x3fa338);return respondWithRpcPromise('Reload','destroy',{'module':'res_stun_monitor.so'});}else{var _0x264ebb=fs['readFileSync'](path['join'](config[_0x817f('0x4e')],_0x817f('0x4f')),_0x817f('0x47'));var _0x10a0f5=ejs[_0x817f('0x48')](_0x264ebb,{'networks':_0x2a449d||[]});fs[_0x817f('0x49')](util[_0x817f('0x50')](_0x817f('0x51'),_0x1ad6ef[_0x817f('0x29')][_0x817f('0x57')]()),_0x10a0f5);return respondWithRpcPromise(_0x817f('0x4b'),_0x817f('0x58'),{'module':_0x817f('0x52')});}})['catch'](handleError(_0x2c58bf,null));}; \ No newline at end of file +var _0xc98b=['update','destroy','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','rows','params','keys','length','find','create','findAll','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','utf8','format','toLowerCase','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','util','path','ejs','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set'];(function(_0xf16b1,_0x33c637){var _0x26f94d=function(_0x5643d7){while(--_0x5643d7){_0xf16b1['push'](_0xf16b1['shift']());}};_0x26f94d(++_0x33c637);}(_0xc98b,0x19f));var _0xbc98=function(_0x1382d1,_0x5200ee){_0x1382d1=_0x1382d1-0x0;var _0xf9d005=_0xc98b[_0x1382d1];return _0xf9d005;};'use strict';var util=require(_0xbc98('0x0'));var path=require(_0xbc98('0x1'));var ejs=require(_0xbc98('0x2'));var fs=require('fs');var _=require(_0xbc98('0x3'));var qs=require(_0xbc98('0x4'));var logger=require('../../config/logger')(_0xbc98('0x5'));var config=require(_0xbc98('0x6'));var db=require(_0xbc98('0x7'))['db'];var jayson=require(_0xbc98('0x8'));var client=jayson[_0xbc98('0x9')][_0xbc98('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b10fe,_0x5acf91,_0x5d8a9b,_0x187128){return new Promise(function(_0x3d3ee8,_0x225c9a){var _0x39cb36=_0x187128||client;return _0x39cb36['request'](_0x3b10fe,_0x5d8a9b)[_0xbc98('0xb')](function(_0x4c151b){logger[_0xbc98('0xc')](_0xbc98('0xd'),_0x5acf91,_0xbc98('0xe'));logger[_0xbc98('0xf')](_0xbc98('0x10'),_0x5acf91,_0xbc98('0xe'),JSON[_0xbc98('0x11')](_0x4c151b));if(_0x4c151b[_0xbc98('0x12')]){if(_0x4c151b[_0xbc98('0x12')][_0xbc98('0x13')]===0x1f4){logger[_0xbc98('0x12')](_0xbc98('0xd'),_0x5acf91,_0x4c151b[_0xbc98('0x12')][_0xbc98('0x14')]);return _0x225c9a(_0x4c151b['error'][_0xbc98('0x14')]);}logger[_0xbc98('0x12')](_0xbc98('0xd'),_0x5acf91,_0x4c151b[_0xbc98('0x12')][_0xbc98('0x14')]);return _0x3d3ee8(_0x4c151b[_0xbc98('0x12')]['message']);}else{logger['info'](_0xbc98('0xd'),_0x5acf91,'request\x20sent');_0x3d3ee8(_0x4c151b[_0xbc98('0x15')]['message']);}})[_0xbc98('0x16')](function(_0x50c907){logger[_0xbc98('0x12')](_0xbc98('0xd'),_0x5acf91,_0x50c907);_0x225c9a(_0x50c907);});});}function respondWithResult(_0x88212a,_0x5a154f){_0x5a154f=_0x5a154f||0xc8;return function(_0x194581){if(_0x194581){return _0x88212a[_0xbc98('0x17')](_0x5a154f)[_0xbc98('0x18')](_0x194581);}};}function respondWithFilteredResult(_0x3d67aa,_0x9edcdb){return function(_0xb8da12){if(_0xb8da12){var _0x2fc709=typeof _0x9edcdb[_0xbc98('0x19')]===_0xbc98('0x1a')&&typeof _0x9edcdb[_0xbc98('0x1b')]===_0xbc98('0x1a');var _0x14f6cb=_0xb8da12[_0xbc98('0x1c')];var _0x4a6015=_0x2fc709?0x0:_0x9edcdb[_0xbc98('0x19')];var _0x220b57=_0x2fc709?_0xb8da12[_0xbc98('0x1c')]:_0x9edcdb[_0xbc98('0x19')]+_0x9edcdb[_0xbc98('0x1b')];var _0x282817;if(_0x220b57>=_0x14f6cb){_0x220b57=_0x14f6cb;_0x282817=0xc8;}else{_0x282817=0xce;}_0x3d67aa[_0xbc98('0x17')](_0x282817);return _0x3d67aa[_0xbc98('0x1d')]('Content-Range',_0x4a6015+'-'+_0x220b57+'/'+_0x14f6cb)[_0xbc98('0x18')](_0xb8da12);}return null;};}function saveUpdates(_0x1b509a){return function(_0x618fce){if(_0x618fce){return _0x618fce[_0xbc98('0x1e')](_0x1b509a)[_0xbc98('0xb')](function(_0x500099){return _0x500099;});}return null;};}function removeEntity(_0x1f64f8){return function(_0xd95ed6){if(_0xd95ed6){return _0xd95ed6[_0xbc98('0x1f')]()[_0xbc98('0xb')](function(){_0x1f64f8[_0xbc98('0x17')](0xcc)[_0xbc98('0x20')]();});}};}function handleEntityNotFound(_0x377bc9){return function(_0x39ffe0){if(!_0x39ffe0){_0x377bc9[_0xbc98('0x21')](0x194);}return _0x39ffe0;};}function handleError(_0x4d0547,_0x213178){_0x213178=_0x213178||0x1f4;return function(_0x10d352){logger[_0xbc98('0x12')](_0x10d352[_0xbc98('0x22')]);if(_0x10d352[_0xbc98('0x23')]){delete _0x10d352[_0xbc98('0x23')];}_0x4d0547['status'](_0x213178)[_0xbc98('0x24')](_0x10d352);};}exports[_0xbc98('0x25')]=function(_0x41a379,_0xd7b87c){var _0x31d1f1={},_0x134c91={},_0x495a7e={'count':0x0,'rows':[]};var _0x48f43c=_[_0xbc98('0x26')](db[_0xbc98('0x27')][_0xbc98('0x28')],function(_0x18f2da){return{'name':_0x18f2da[_0xbc98('0x29')],'type':_0x18f2da[_0xbc98('0x2a')]['key']};});_0x134c91[_0xbc98('0x2b')]=_[_0xbc98('0x26')](_0x48f43c,'name');_0x134c91['query']=_['keys'](_0x41a379[_0xbc98('0x2c')]);_0x134c91[_0xbc98('0x2d')]=_['intersection'](_0x134c91[_0xbc98('0x2b')],_0x134c91['query']);_0x31d1f1[_0xbc98('0x2e')]=_[_0xbc98('0x2f')](_0x134c91['model'],qs[_0xbc98('0x30')](_0x41a379[_0xbc98('0x2c')]['fields']));_0x31d1f1[_0xbc98('0x2e')]=_0x31d1f1['attributes']['length']?_0x31d1f1[_0xbc98('0x2e')]:_0x134c91[_0xbc98('0x2b')];if(!_0x41a379[_0xbc98('0x2c')][_0xbc98('0x31')](_0xbc98('0x32'))){_0x31d1f1[_0xbc98('0x1b')]=qs[_0xbc98('0x1b')](_0x41a379[_0xbc98('0x2c')][_0xbc98('0x1b')]);_0x31d1f1[_0xbc98('0x19')]=qs['offset'](_0x41a379[_0xbc98('0x2c')][_0xbc98('0x19')]);}_0x31d1f1[_0xbc98('0x33')]=qs[_0xbc98('0x34')](_0x41a379[_0xbc98('0x2c')][_0xbc98('0x34')]);_0x31d1f1['where']=qs[_0xbc98('0x2d')](_[_0xbc98('0x35')](_0x41a379[_0xbc98('0x2c')],_0x134c91[_0xbc98('0x2d')]),_0x48f43c);if(_0x41a379['query'][_0xbc98('0x36')]){_0x31d1f1['where']=_[_0xbc98('0x37')](_0x31d1f1['where'],{'$or':_['map'](_0x48f43c,function(_0xb7e75b){if(_0xb7e75b[_0xbc98('0x2a')]!==_0xbc98('0x38')){var _0x38c324={};_0x38c324[_0xb7e75b[_0xbc98('0x23')]]={'$like':'%'+_0x41a379[_0xbc98('0x2c')][_0xbc98('0x36')]+'%'};return _0x38c324;}})});}_0x31d1f1=_[_0xbc98('0x37')]({},_0x31d1f1,_0x41a379[_0xbc98('0x39')]);var _0x4d3f01={'where':_0x31d1f1[_0xbc98('0x3a')]};return db[_0xbc98('0x27')][_0xbc98('0x1c')](_0x4d3f01)[_0xbc98('0xb')](function(_0x5488f9){_0x495a7e[_0xbc98('0x1c')]=_0x5488f9;if(_0x41a379[_0xbc98('0x2c')][_0xbc98('0x3b')]){_0x31d1f1[_0xbc98('0x3c')]=[{'all':!![]}];}return db['Network']['findAll'](_0x31d1f1);})[_0xbc98('0xb')](function(_0x21997a){_0x495a7e[_0xbc98('0x3d')]=_0x21997a;return _0x495a7e;})[_0xbc98('0xb')](respondWithFilteredResult(_0xd7b87c,_0x31d1f1))['catch'](handleError(_0xd7b87c,null));};exports['show']=function(_0x5dee11,_0x1520a0){var _0x172fa5={'raw':!![],'where':{'id':_0x5dee11[_0xbc98('0x3e')]['id']}},_0x6aece6={};_0x6aece6[_0xbc98('0x2b')]=_[_0xbc98('0x3f')](db[_0xbc98('0x27')]['rawAttributes']);_0x6aece6['query']=_[_0xbc98('0x3f')](_0x5dee11[_0xbc98('0x2c')]);_0x6aece6[_0xbc98('0x2d')]=_[_0xbc98('0x2f')](_0x6aece6['model'],_0x6aece6['query']);_0x172fa5['attributes']=_[_0xbc98('0x2f')](_0x6aece6[_0xbc98('0x2b')],qs[_0xbc98('0x30')](_0x5dee11['query'][_0xbc98('0x30')]));_0x172fa5[_0xbc98('0x2e')]=_0x172fa5[_0xbc98('0x2e')][_0xbc98('0x40')]?_0x172fa5[_0xbc98('0x2e')]:_0x6aece6[_0xbc98('0x2b')];if(_0x5dee11[_0xbc98('0x2c')][_0xbc98('0x3b')]){_0x172fa5[_0xbc98('0x3c')]=[{'all':!![]}];}_0x172fa5=_['merge']({},_0x172fa5,_0x5dee11[_0xbc98('0x39')]);return db[_0xbc98('0x27')][_0xbc98('0x41')](_0x172fa5)[_0xbc98('0xb')](handleEntityNotFound(_0x1520a0,null))[_0xbc98('0xb')](respondWithResult(_0x1520a0,null))[_0xbc98('0x16')](handleError(_0x1520a0,null));};exports[_0xbc98('0x42')]=function(_0x57956f,_0x1c9bcb){var _0x572ec8;return db[_0xbc98('0x27')]['create'](_0x57956f['body'],{'raw':!![]})[_0xbc98('0xb')](function(_0x569ed7){_0x572ec8=_0x569ed7;return db[_0xbc98('0x27')][_0xbc98('0x43')]({'where':{'type':_0x57956f[_0xbc98('0x44')]['type']},'raw':!![]});})['then'](function(_0x2eee81){if(_0x572ec8[_0xbc98('0x2a')]['toUpperCase']()==_0xbc98('0x45')){var _0x2b160b=fs[_0xbc98('0x46')](path[_0xbc98('0x47')](config[_0xbc98('0x48')],_0xbc98('0x49')),'utf8');var _0x2e2122=ejs[_0xbc98('0x4a')](_0x2b160b,{'networks':_0x2eee81||[]});fs[_0xbc98('0x4b')](_0xbc98('0x4c'),_0x2e2122);return respondWithRpcPromise(_0xbc98('0x4d'),_0xbc98('0x42'),{'module':_0xbc98('0x4e')});}else if(_0x572ec8[_0xbc98('0x2a')][_0xbc98('0x4f')]()==_0xbc98('0x50')){var _0x343d60=fs[_0xbc98('0x46')](path['join'](config['root'],_0xbc98('0x51')),_0xbc98('0x52'));var _0x61a989=ejs[_0xbc98('0x4a')](_0x343d60,{'networks':_0x2eee81||[]});fs[_0xbc98('0x4b')]('/etc/asterisk/turn_xcally.conf',_0x61a989);return respondWithRpcPromise(_0xbc98('0x4d'),_0xbc98('0x42'),{'module':'res_stun_monitor.so'});}else{var _0x17df51=fs[_0xbc98('0x46')](path[_0xbc98('0x47')](config[_0xbc98('0x48')],'server/files/templates/network.ejs'),'utf8');var _0x284572=ejs[_0xbc98('0x4a')](_0x17df51,{'networks':_0x2eee81||[]});fs[_0xbc98('0x4b')](util[_0xbc98('0x53')]('/etc/asterisk/sip_xcally_%s.conf',_0x57956f['body'][_0xbc98('0x2a')][_0xbc98('0x54')]()),_0x284572);return respondWithRpcPromise(_0xbc98('0x4d'),_0xbc98('0x42'),{'module':'chan_sip.so'});}})[_0xbc98('0xb')](function(){return _0x572ec8;})[_0xbc98('0xb')](respondWithResult(_0x1c9bcb,0xc9))[_0xbc98('0x16')](handleError(_0x1c9bcb,null));};exports[_0xbc98('0x1e')]=function(_0x451eac,_0x52b614){var _0x17752e;return db[_0xbc98('0x27')][_0xbc98('0x41')]({'where':{'id':_0x451eac[_0xbc98('0x3e')]['id']}})['then'](handleEntityNotFound(_0x52b614,null))['then'](saveUpdates(_0x451eac['body'],null))[_0xbc98('0xb')](function(_0x43932f){if(_0x43932f){_0x17752e=_0x43932f;return db['Network'][_0xbc98('0x43')]({'where':{'type':_0x17752e[_0xbc98('0x2a')]},'raw':!![]});}return null;})['then'](function(_0x4ce4c9){if(_0x17752e['type'][_0xbc98('0x4f')]()==_0xbc98('0x45')){var _0x5c3a80=fs[_0xbc98('0x46')](path['join'](config[_0xbc98('0x48')],_0xbc98('0x49')),_0xbc98('0x52'));var _0x16b111=ejs[_0xbc98('0x4a')](_0x5c3a80,{'networks':_0x4ce4c9||[]});fs[_0xbc98('0x4b')](_0xbc98('0x4c'),_0x16b111);return respondWithRpcPromise(_0xbc98('0x4d'),_0xbc98('0x1e'),{'module':_0xbc98('0x4e')});}else if(_0x17752e[_0xbc98('0x2a')][_0xbc98('0x4f')]()==_0xbc98('0x50')){var _0x47b5a3=fs['readFileSync'](path[_0xbc98('0x47')](config['root'],_0xbc98('0x51')),_0xbc98('0x52'));var _0x37eed7=ejs['render'](_0x47b5a3,{'networks':_0x4ce4c9||[]});fs[_0xbc98('0x4b')](_0xbc98('0x55'),_0x37eed7);return respondWithRpcPromise(_0xbc98('0x4d'),_0xbc98('0x1e'),{'module':_0xbc98('0x4e')});}else{var _0x1b5ef3=fs['readFileSync'](path[_0xbc98('0x47')](config[_0xbc98('0x48')],_0xbc98('0x56')),_0xbc98('0x52'));var _0x39d6e1=ejs[_0xbc98('0x4a')](_0x1b5ef3,{'networks':_0x4ce4c9||[]});fs[_0xbc98('0x4b')](util[_0xbc98('0x53')](_0xbc98('0x57'),_0x451eac['body'][_0xbc98('0x2a')]['toLowerCase']()),_0x39d6e1);return respondWithRpcPromise('Reload',_0xbc98('0x1e'),{'module':'chan_sip.so'});}})[_0xbc98('0xb')](function(_0x436d5b){if(_0x436d5b){return _0x17752e;}return null;})['then'](respondWithResult(_0x52b614,null))[_0xbc98('0x16')](handleError(_0x52b614,null));};exports[_0xbc98('0x1f')]=function(_0x1fb346,_0x1dff19){var _0x3ca545;return db[_0xbc98('0x27')][_0xbc98('0x41')]({'where':{'id':_0x1fb346[_0xbc98('0x3e')]['id']}})['then'](function(_0x57058e){_0x3ca545=_0x57058e;return _0x57058e;})[_0xbc98('0xb')](handleEntityNotFound(_0x1dff19,null))[_0xbc98('0xb')](removeEntity(_0x1dff19,null))[_0xbc98('0xb')](function(){if(_0x3ca545){return db[_0xbc98('0x27')][_0xbc98('0x43')]({'where':{'type':_0x3ca545['type']},'raw':!![]});}})[_0xbc98('0xb')](function(_0x33514c){if(_0x3ca545['type'][_0xbc98('0x4f')]()==_0xbc98('0x45')){var _0x26514a=fs['readFileSync'](path[_0xbc98('0x47')](config[_0xbc98('0x48')],'server/files/templates/stun_multiple.ejs'),_0xbc98('0x52'));var _0x3f5589=ejs[_0xbc98('0x4a')](_0x26514a,{'networks':_0x33514c||[]});fs[_0xbc98('0x4b')](_0xbc98('0x4c'),_0x3f5589);return respondWithRpcPromise(_0xbc98('0x4d'),'destroy',{'module':_0xbc98('0x4e')});}else if(_0x3ca545[_0xbc98('0x2a')][_0xbc98('0x4f')]()==_0xbc98('0x50')){var _0x8518f5=fs['readFileSync'](path[_0xbc98('0x47')](config[_0xbc98('0x48')],'server/files/templates/turn_multiple.ejs'),_0xbc98('0x52'));var _0x1551bd=ejs[_0xbc98('0x4a')](_0x8518f5,{'networks':_0x33514c||[]});fs[_0xbc98('0x4b')](_0xbc98('0x55'),_0x1551bd);return respondWithRpcPromise('Reload',_0xbc98('0x1f'),{'module':_0xbc98('0x4e')});}else{var _0x14b241=fs[_0xbc98('0x46')](path[_0xbc98('0x47')](config[_0xbc98('0x48')],'server/files/templates/network.ejs'),_0xbc98('0x52'));var _0x2ebe92=ejs['render'](_0x14b241,{'networks':_0x33514c||[]});fs['writeFileSync'](util[_0xbc98('0x53')](_0xbc98('0x57'),_0x3ca545[_0xbc98('0x2a')][_0xbc98('0x54')]()),_0x2ebe92);return respondWithRpcPromise(_0xbc98('0x4d'),_0xbc98('0x1f'),{'module':_0xbc98('0x58')});}})[_0xbc98('0x16')](handleError(_0x1dff19,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 6a77248..5ee545e 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 _0x6b24=['api','moment','rimraf','./network.attributes','Network','network','util','../../config/logger'];(function(_0x551bf1,_0x56658e){var _0x257f45=function(_0x432107){while(--_0x432107){_0x551bf1['push'](_0x551bf1['shift']());}};_0x257f45(++_0x56658e);}(_0x6b24,0x1ce));var _0x46b2=function(_0x441e18,_0x2a4780){_0x441e18=_0x441e18-0x0;var _0x4adf21=_0x6b24[_0x441e18];return _0x4adf21;};'use strict';var _=require('lodash');var util=require(_0x46b2('0x0'));var logger=require(_0x46b2('0x1'))(_0x46b2('0x2'));var moment=require(_0x46b2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x46b2('0x4'));var config=require('../../config/environment');var attributes=require(_0x46b2('0x5'));module['exports']=function(_0x2e5227,_0x5598df){return _0x2e5227['define'](_0x46b2('0x6'),attributes,{'tableName':_0x46b2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4876=['../../config/environment','./network.attributes','Network','network','../../config/logger','bluebird','path','rimraf'];(function(_0x2a14e3,_0x4e04e2){var _0x2d4a19=function(_0x38a5d8){while(--_0x38a5d8){_0x2a14e3['push'](_0x2a14e3['shift']());}};_0x2d4a19(++_0x4e04e2);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6487('0x0'))('api');var moment=require('moment');var BPromise=require(_0x6487('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6487('0x2'));var rimraf=require(_0x6487('0x3'));var config=require(_0x6487('0x4'));var attributes=require(_0x6487('0x5'));module['exports']=function(_0x23e50b,_0x856b1c){return _0x23e50b['define'](_0x6487('0x6'),attributes,{'tableName':_0x6487('0x7'),'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 e80d64d..0babc2a 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x132634,_0x368bc4){_0x132634=_0x132634-0x0;var _0xaccd06=_0x7a54[_0x132634];return _0xaccd06;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x222157,_0x195db6){var _0x20592c=function(_0x2038d8){while(--_0x2038d8){_0x222157['push'](_0x222157['shift']());}};_0x20592c(++_0x195db6);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 940e826..e63c0f7 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 _0x9f0e=['/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','/:id/users','getAgents','post','/:id/canned_answers','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','send','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x9f0e,0x116));var _0xe9f0=function(_0x124d7d,_0x3bec03){_0x124d7d=_0x124d7d-0x0;var _0x5dca83=_0x9f0e[_0x124d7d];return _0x5dca83;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0x9')](_0xe9f0('0xe'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x9')]('/:id/canned_answers',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x10')]);router[_0xe9f0('0x9')]('/:id/applications',auth[_0xe9f0('0xb')](),controller['getApplications']);router[_0xe9f0('0x9')](_0xe9f0('0x11'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x12')]);router['get'](_0xe9f0('0x13'),auth['isAuthenticated'](),controller[_0xe9f0('0x14')]);router[_0xe9f0('0x15')]('/',auth[_0xe9f0('0xb')](),controller['create']);router[_0xe9f0('0x15')](_0xe9f0('0xe'),auth[_0xe9f0('0xb')](),controller['addDisposition']);router[_0xe9f0('0x15')](_0xe9f0('0x16'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x17')]);router[_0xe9f0('0x15')](_0xe9f0('0x18'),controller[_0xe9f0('0x19')]);router['post'](_0xe9f0('0x1a'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x1b')]);router['post'](_0xe9f0('0x13'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x1c')]);router[_0xe9f0('0x15')]('/:id/send',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x1d')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe9f0('0x1e')]);router[_0xe9f0('0x1f')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x20')]);router['delete'](_0xe9f0('0xe'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x21')]);router[_0xe9f0('0x1f')](_0xe9f0('0x16'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x22')]);router[_0xe9f0('0x1f')](_0xe9f0('0x13'),auth[_0xe9f0('0xb')](),controller['removeAgents']);module[_0xe9f0('0x23')]=router; \ No newline at end of file +var _0x47c5=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','/:id/notify','notify','addApplications','addAgents','send','delete','removeDispositions','removeAnswers','multer','util','path'];(function(_0xc4ea75,_0x273753){var _0x52ea5e=function(_0x1ee872){while(--_0x1ee872){_0xc4ea75['push'](_0xc4ea75['shift']());}};_0x52ea5e(++_0x273753);}(_0x47c5,0x165));var _0x547c=function(_0x3db140,_0x88e7d0){_0x3db140=_0x3db140-0x0;var _0x5c88cf=_0x47c5[_0x3db140];return _0x5c88cf;};'use strict';var multer=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var path=require(_0x547c('0x2'));var timeout=require(_0x547c('0x3'));var express=require(_0x547c('0x4'));var router=express[_0x547c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x547c('0x6'));var interaction=require(_0x547c('0x7'));var config=require('../../config/environment');var controller=require(_0x547c('0x8'));router[_0x547c('0x9')]('/',auth['isAuthenticated'](),controller[_0x547c('0xa')]);router[_0x547c('0x9')](_0x547c('0xb'),auth[_0x547c('0xc')](),controller[_0x547c('0xd')]);router[_0x547c('0x9')](_0x547c('0xe'),auth[_0x547c('0xc')](),controller[_0x547c('0xf')]);router[_0x547c('0x9')](_0x547c('0x10'),auth[_0x547c('0xc')](),controller[_0x547c('0x11')]);router[_0x547c('0x9')](_0x547c('0x12'),auth[_0x547c('0xc')](),controller[_0x547c('0x13')]);router['get'](_0x547c('0x14'),auth[_0x547c('0xc')](),controller['getApplications']);router[_0x547c('0x9')](_0x547c('0x15'),auth[_0x547c('0xc')](),controller[_0x547c('0x16')]);router[_0x547c('0x9')](_0x547c('0x17'),auth[_0x547c('0xc')](),controller[_0x547c('0x18')]);router[_0x547c('0x19')]('/',auth[_0x547c('0xc')](),controller[_0x547c('0x1a')]);router[_0x547c('0x19')](_0x547c('0x10'),auth[_0x547c('0xc')](),controller[_0x547c('0x1b')]);router[_0x547c('0x19')](_0x547c('0x12'),auth[_0x547c('0xc')](),controller['addAnswer']);router['post'](_0x547c('0x1c'),controller[_0x547c('0x1d')]);router[_0x547c('0x19')]('/:id/applications',auth[_0x547c('0xc')](),controller[_0x547c('0x1e')]);router[_0x547c('0x19')]('/:id/users',auth[_0x547c('0xc')](),controller[_0x547c('0x1f')]);router['post']('/:id/send',auth[_0x547c('0xc')](),controller[_0x547c('0x20')]);router['put'](_0x547c('0xe'),auth[_0x547c('0xc')](),controller['update']);router[_0x547c('0x21')](_0x547c('0xe'),auth[_0x547c('0xc')](),controller['destroy']);router[_0x547c('0x21')](_0x547c('0x10'),auth[_0x547c('0xc')](),controller[_0x547c('0x22')]);router[_0x547c('0x21')](_0x547c('0x12'),auth[_0x547c('0xc')](),controller[_0x547c('0x23')]);router['delete'](_0x547c('0x17'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 126073a..51437c3 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 _0xb006=['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','randomstring','exports','STRING','generate'];(function(_0x3b4eb2,_0x43edb5){var _0xdd9ca2=function(_0x477601){while(--_0x477601){_0x3b4eb2['push'](_0x3b4eb2['shift']());}};_0xdd9ca2(++_0x43edb5);}(_0xb006,0xa1));var _0x6b00=function(_0xcf6d6b,_0x2b15b7){_0xcf6d6b=_0xcf6d6b-0x0;var _0x337966=_0xb006[_0xcf6d6b];return _0x337966;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6b00('0x0'));module[_0x6b00('0x1')]={'name':{'type':Sequelize[_0x6b00('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x6b00('0x2')]},'token':{'type':Sequelize[_0x6b00('0x2')],'defaultValue':function(){return rs[_0x6b00('0x3')]();}},'replyUri':{'type':Sequelize[_0x6b00('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x6b00('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6b00('0x4');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6b00('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6b00('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6b00('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6b00('0x2')]},'queueTransfer':{'type':Sequelize[_0x6b00('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6b00('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6b00('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x6b00('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x12bc05){if(!_0x12bc05)this[_0x6b00('0x8')](_0x6b00('0x9'),null);this['setDataValue'](_0x6b00('0xa'),_0x12bc05);}}}; \ No newline at end of file +var _0xecaa=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue'];(function(_0x5aeb55,_0x1d5540){var _0x304feb=function(_0x2c0781){while(--_0x2c0781){_0x5aeb55['push'](_0x5aeb55['shift']());}};_0x304feb(++_0x1d5540);}(_0xecaa,0x12e));var _0xaeca=function(_0x381873,_0x520f70){_0x381873=_0x381873-0x0;var _0x99e256=_0xecaa[_0x381873];return _0x99e256;};'use strict';var Sequelize=require(_0xaeca('0x0'));var rs=require('randomstring');module[_0xaeca('0x1')]={'name':{'type':Sequelize[_0xaeca('0x2')],'unique':_0xaeca('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xaeca('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xaeca('0x4')],'defaultValue':function(){return _0xaeca('0x5');}},'notificationSound':{'type':Sequelize[_0xaeca('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xaeca('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xaeca('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xaeca('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xaeca('0x2')]},'queueTransfer':{'type':Sequelize[_0xaeca('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xaeca('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xaeca('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xaeca('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaeca('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xaeca('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xaeca('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x494373){if(!_0x494373)this[_0xaeca('0x9')](_0xaeca('0xa'),null);this[_0xaeca('0x9')](_0xaeca('0xb'),_0x494373);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index a6427e2..518774d 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 _0x5b20=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','OpenchannelAccountId','Disposition','sort','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','openchannel','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','isNil','ValidationError','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','from','List','Contacts','DESC','Applications','account','applications','list','orderBy','asc','CmContact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','firstName','messageId','interaction','created','autoclose','push','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','unshift','queue','waitForTheAssignedQueue','*,*,*,*','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','priority','finally','send','json','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','undefined','count','offset','set','apply','save','destroy','get','OpenchannelAccounts','stack','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','query','keys'];(function(_0x483f05,_0x5c75b3){var _0x58c343=function(_0x345888){while(--_0x345888){_0x483f05['push'](_0x483f05['shift']());}};_0x58c343(++_0x5c75b3);}(_0x5b20,0x86));var _0x05b2=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x5b20[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0x05b2('0x0'));var rimraf=require(_0x05b2('0x1'));var zipdir=require(_0x05b2('0x2'));var jsonpatch=require(_0x05b2('0x3'));var rp=require(_0x05b2('0x4'));var moment=require(_0x05b2('0x5'));var BPromise=require(_0x05b2('0x6'));var Mustache=require(_0x05b2('0x7'));var util=require(_0x05b2('0x8'));var path=require(_0x05b2('0x9'));var sox=require(_0x05b2('0xa'));var csv=require('to-csv');var ejs=require(_0x05b2('0xb'));var fs=require('fs');var fs_extra=require(_0x05b2('0xc'));var _=require('lodash');var squel=require(_0x05b2('0xd'));var crypto=require(_0x05b2('0xe'));var jsforce=require(_0x05b2('0xf'));var deskjs=require(_0x05b2('0x10'));var toCsv=require(_0x05b2('0x11'));var querystring=require(_0x05b2('0x12'));var Papa=require(_0x05b2('0x13'));var Redis=require(_0x05b2('0x14'));var authService=require(_0x05b2('0x15'));var qs=require(_0x05b2('0x16'));var as=require(_0x05b2('0x17'));var hardwareService=require(_0x05b2('0x18'));var logger=require(_0x05b2('0x19'))(_0x05b2('0x1a'));var utils=require(_0x05b2('0x1b'));var config=require(_0x05b2('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x05b2('0x1d'))['db'];config[_0x05b2('0x1e')]=_[_0x05b2('0x1f')](config[_0x05b2('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0x05b2('0x20'))(new Redis(config[_0x05b2('0x1e')]));require(_0x05b2('0x21'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x05b2('0x22')][_0x05b2('0x23')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d3664,_0x3fe466,_0x3a544c,_0x189114){return new BPromise(function(_0x234843,_0xe43c6a){var _0x290cce=_0x189114||client;return _0x290cce[_0x05b2('0x24')](_0x3d3664,_0x3a544c)[_0x05b2('0x25')](function(_0x1fd4b8){logger[_0x05b2('0x26')](_0x05b2('0x27'),_0x3fe466,_0x05b2('0x28'));logger[_0x05b2('0x29')](_0x05b2('0x2a'),_0x3fe466,_0x05b2('0x28'),JSON['stringify'](_0x1fd4b8));if(_0x1fd4b8[_0x05b2('0x2b')]){if(_0x1fd4b8[_0x05b2('0x2b')][_0x05b2('0x2c')]===0x1f4){logger[_0x05b2('0x2b')](_0x05b2('0x27'),_0x3fe466,_0x1fd4b8[_0x05b2('0x2b')][_0x05b2('0x2d')]);return _0xe43c6a(_0x1fd4b8['error'][_0x05b2('0x2d')]);}logger['error'](_0x05b2('0x27'),_0x3fe466,_0x1fd4b8[_0x05b2('0x2b')]['message']);return _0x234843(_0x1fd4b8[_0x05b2('0x2b')][_0x05b2('0x2d')]);}else{logger[_0x05b2('0x26')](_0x05b2('0x27'),_0x3fe466,_0x05b2('0x28'));_0x234843(_0x1fd4b8[_0x05b2('0x2e')][_0x05b2('0x2d')]);}})[_0x05b2('0x2f')](function(_0x4f1e20){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x3fe466,_0x4f1e20);_0xe43c6a(_0x4f1e20);});});}function respondWithStatusCode(_0x171fc2,_0x4f0b2b){_0x4f0b2b=_0x4f0b2b||0xcc;return function(_0x5d79a2){if(_0x5d79a2){return _0x171fc2[_0x05b2('0x30')](_0x4f0b2b);}return _0x171fc2[_0x05b2('0x31')](_0x4f0b2b)[_0x05b2('0x32')]();};}function respondWithResult(_0x218b77,_0x14e31b){_0x14e31b=_0x14e31b||0xc8;return function(_0x1eff4a){if(_0x1eff4a){return _0x218b77[_0x05b2('0x31')](_0x14e31b)['json'](_0x1eff4a);}};}function respondWithFilteredResult(_0x14ebf8,_0x1c7e8a){return function(_0x717140){if(_0x717140){var _0x121ada=typeof _0x1c7e8a['offset']===_0x05b2('0x33')&&typeof _0x1c7e8a['limit']===_0x05b2('0x33');var _0xcb4fd3=_0x717140[_0x05b2('0x34')];var _0x30f0db=_0x121ada?0x0:_0x1c7e8a['offset'];var _0x3fffe0=_0x121ada?_0x717140['count']:_0x1c7e8a[_0x05b2('0x35')]+_0x1c7e8a['limit'];var _0x27f699;if(_0x3fffe0>=_0xcb4fd3){_0x3fffe0=_0xcb4fd3;_0x27f699=0xc8;}else{_0x27f699=0xce;}_0x14ebf8[_0x05b2('0x31')](_0x27f699);return _0x14ebf8[_0x05b2('0x36')]('Content-Range',_0x30f0db+'-'+_0x3fffe0+'/'+_0xcb4fd3)['json'](_0x717140);}return null;};}function patchUpdates(_0x1be4b3){return function(_0x3e80ad){try{jsonpatch[_0x05b2('0x37')](_0x3e80ad,_0x1be4b3,!![]);}catch(_0x461286){return BPromise['reject'](_0x461286);}return _0x3e80ad[_0x05b2('0x38')]();};}function saveUpdates(_0x5ef722,_0xe27816){return function(_0x93a978){if(_0x93a978){return _0x93a978['update'](_0x5ef722)[_0x05b2('0x25')](function(_0x10f1ba){return _0x10f1ba;});}return null;};}function removeEntity(_0x4abc98,_0x54193c){return function(_0x25c3f2){if(_0x25c3f2){return _0x25c3f2[_0x05b2('0x39')]()['then'](function(){var _0x3e9008=_0x25c3f2[_0x05b2('0x3a')]({'plain':!![]});var _0x475f27=_0x05b2('0x3b');return db['UserProfileResource']['destroy']({'where':{'type':_0x475f27,'resourceId':_0x3e9008['id']}})['then'](function(){return _0x25c3f2;});})[_0x05b2('0x25')](function(){_0x4abc98[_0x05b2('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43edec,_0x30b774){return function(_0x310b9f){if(!_0x310b9f){_0x43edec[_0x05b2('0x30')](0x194);}return _0x310b9f;};}function handleError(_0x34267e,_0x32bb1f){_0x32bb1f=_0x32bb1f||0x1f4;return function(_0x161517){logger['error'](_0x161517[_0x05b2('0x3c')]);if(_0x161517[_0x05b2('0x3d')]){delete _0x161517[_0x05b2('0x3d')];}_0x34267e[_0x05b2('0x31')](_0x32bb1f)['send'](_0x161517);};}exports[_0x05b2('0x3e')]=function(_0x10cee1,_0x5b6ad7){var _0x58f622={'include':[{'model':db[_0x05b2('0x3f')],'as':_0x05b2('0x40')}]},_0x6d1c87={},_0x7458fd={'count':0x0,'rows':[]};var _0xbf443=_[_0x05b2('0x41')](db[_0x05b2('0x42')][_0x05b2('0x43')],function(_0x539e0a){return{'name':_0x539e0a['fieldName'],'type':_0x539e0a[_0x05b2('0x44')][_0x05b2('0x45')]};});_0x6d1c87['model']=_[_0x05b2('0x41')](_0xbf443,_0x05b2('0x3d'));_0x6d1c87[_0x05b2('0x46')]=_[_0x05b2('0x47')](_0x10cee1[_0x05b2('0x46')]);_0x6d1c87[_0x05b2('0x48')]=_[_0x05b2('0x49')](_0x6d1c87['model'],_0x6d1c87[_0x05b2('0x46')]);_0x58f622['attributes']=_[_0x05b2('0x49')](_0x6d1c87[_0x05b2('0x4a')],qs['fields'](_0x10cee1[_0x05b2('0x46')][_0x05b2('0x4b')]));_0x58f622['attributes']=_0x58f622[_0x05b2('0x4c')][_0x05b2('0x4d')]?_0x58f622[_0x05b2('0x4c')]:_0x6d1c87[_0x05b2('0x4a')];if(!_0x10cee1[_0x05b2('0x46')][_0x05b2('0x4e')](_0x05b2('0x4f'))){_0x58f622[_0x05b2('0x50')]=qs['limit'](_0x10cee1['query'][_0x05b2('0x50')]);_0x58f622[_0x05b2('0x35')]=qs['offset'](_0x10cee1['query']['offset']);}_0x58f622[_0x05b2('0x51')]=qs['sort'](_0x10cee1[_0x05b2('0x46')]['sort']);_0x58f622[_0x05b2('0x52')]=qs[_0x05b2('0x48')](_[_0x05b2('0x53')](_0x10cee1[_0x05b2('0x46')],_0x6d1c87[_0x05b2('0x48')]),_0xbf443);if(_0x10cee1[_0x05b2('0x46')][_0x05b2('0x54')]){_0x58f622[_0x05b2('0x52')]=_[_0x05b2('0x55')](_0x58f622['where'],{'$or':_[_0x05b2('0x41')](_0xbf443,function(_0xa4416c){if(_0xa4416c[_0x05b2('0x44')]!==_0x05b2('0x56')){var _0x42b605={};_0x42b605[_0xa4416c['name']]={'$like':'%'+_0x10cee1['query'][_0x05b2('0x54')]+'%'};return _0x42b605;}})});}_0x58f622=_[_0x05b2('0x55')]({},_0x58f622,_0x10cee1[_0x05b2('0x57')]);var _0x1b6973={'where':_0x58f622[_0x05b2('0x52')]};return db[_0x05b2('0x42')]['count'](_0x1b6973)[_0x05b2('0x25')](function(_0x42bcb2){_0x7458fd[_0x05b2('0x34')]=_0x42bcb2;if(_0x10cee1[_0x05b2('0x46')][_0x05b2('0x58')]){_0x58f622[_0x05b2('0x59')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x05b2('0x5a')](_0x58f622);})[_0x05b2('0x25')](function(_0x1ef89c){_0x7458fd[_0x05b2('0x5b')]=_0x1ef89c;return _0x7458fd;})[_0x05b2('0x25')](respondWithFilteredResult(_0x5b6ad7,_0x58f622))[_0x05b2('0x2f')](handleError(_0x5b6ad7,null));};exports[_0x05b2('0x5c')]=function(_0x46c051,_0x367ab1){var _0x577e41={'raw':![],'where':{'id':_0x46c051[_0x05b2('0x5d')]['id']},'include':[{'model':db[_0x05b2('0x3f')],'as':_0x05b2('0x40')}]},_0xd3f335={};_0xd3f335[_0x05b2('0x4a')]=_[_0x05b2('0x47')](db[_0x05b2('0x42')][_0x05b2('0x43')]);_0xd3f335[_0x05b2('0x46')]=_['keys'](_0x46c051['query']);_0xd3f335[_0x05b2('0x48')]=_[_0x05b2('0x49')](_0xd3f335[_0x05b2('0x4a')],_0xd3f335[_0x05b2('0x46')]);_0x577e41[_0x05b2('0x4c')]=_[_0x05b2('0x49')](_0xd3f335[_0x05b2('0x4a')],qs['fields'](_0x46c051[_0x05b2('0x46')]['fields']));_0x577e41['attributes']=_0x577e41[_0x05b2('0x4c')][_0x05b2('0x4d')]?_0x577e41[_0x05b2('0x4c')]:_0xd3f335[_0x05b2('0x4a')];if(_0x46c051[_0x05b2('0x46')][_0x05b2('0x58')]){_0x577e41[_0x05b2('0x59')]=[{'all':!![]}];}_0x577e41=_[_0x05b2('0x55')]({},_0x577e41,_0x46c051['options']);return db[_0x05b2('0x42')][_0x05b2('0x5e')](_0x577e41)[_0x05b2('0x25')](handleEntityNotFound(_0x367ab1,null))[_0x05b2('0x25')](respondWithResult(_0x367ab1,null))[_0x05b2('0x2f')](handleError(_0x367ab1,null));};exports[_0x05b2('0x5f')]=function(_0x3139b8,_0x530ea9){return db[_0x05b2('0x42')][_0x05b2('0x5f')](_0x3139b8[_0x05b2('0x60')],{})['then'](function(_0x3fe35e){var _0x54b101=_0x3139b8['user'][_0x05b2('0x3a')]({'plain':!![]});if(!_0x54b101)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54b101[_0x05b2('0x61')]===_0x05b2('0x62')){var _0x53b743=_0x3fe35e[_0x05b2('0x3a')]({'plain':!![]});var _0x1d3664='OpenchannelAccounts';return db[_0x05b2('0x63')]['find']({'where':{'name':_0x1d3664,'userProfileId':_0x54b101[_0x05b2('0x64')]},'raw':!![]})['then'](function(_0x1dd699){if(_0x1dd699&&_0x1dd699[_0x05b2('0x65')]===0x0){return db[_0x05b2('0x66')][_0x05b2('0x5f')]({'name':_0x53b743['name'],'resourceId':_0x53b743['id'],'type':_0x1dd699[_0x05b2('0x3d')],'sectionId':_0x1dd699['id']},{})[_0x05b2('0x25')](function(){return _0x3fe35e;});}else{return _0x3fe35e;}})[_0x05b2('0x2f')](function(_0x1b7a70){logger[_0x05b2('0x2b')](_0x05b2('0x67'),_0x1b7a70);throw _0x1b7a70;});}return _0x3fe35e;})[_0x05b2('0x25')](respondWithResult(_0x530ea9,0xc9))['catch'](handleError(_0x530ea9,null));};exports[_0x05b2('0x68')]=function(_0x38da3b,_0x5518a5){if(_0x38da3b[_0x05b2('0x60')]['id']){delete _0x38da3b[_0x05b2('0x60')]['id'];}return db[_0x05b2('0x42')][_0x05b2('0x5e')]({'where':{'id':_0x38da3b['params']['id']},'include':[{'model':db['Pause'],'as':_0x05b2('0x40')}]})[_0x05b2('0x25')](handleEntityNotFound(_0x5518a5,null))[_0x05b2('0x25')](saveUpdates(_0x38da3b[_0x05b2('0x60')],null))[_0x05b2('0x25')](respondWithResult(_0x5518a5,null))[_0x05b2('0x2f')](handleError(_0x5518a5,null));};exports['destroy']=function(_0xa84fed,_0x5cdade){return db[_0x05b2('0x42')][_0x05b2('0x5e')]({'where':{'id':_0xa84fed['params']['id']}})[_0x05b2('0x25')](handleEntityNotFound(_0x5cdade,null))['then'](removeEntity(_0x5cdade,null))[_0x05b2('0x2f')](handleError(_0x5cdade,null));};exports[_0x05b2('0x69')]=function(_0x50280d,_0x40e40c){return db['OpenchannelAccount']['describe']()[_0x05b2('0x25')](respondWithResult(_0x40e40c,null))[_0x05b2('0x2f')](handleError(_0x40e40c,null));};exports[_0x05b2('0x6a')]=function(_0x549abf,_0x42b5f3,_0x34589b){if(_0x549abf[_0x05b2('0x60')]['id']){delete _0x549abf[_0x05b2('0x60')]['id'];}return db['OpenchannelAccount'][_0x05b2('0x5e')]({'where':{'id':_0x549abf[_0x05b2('0x5d')]['id']}})['then'](handleEntityNotFound(_0x42b5f3,null))[_0x05b2('0x25')](function(_0x372b43){if(_0x372b43){_0x549abf[_0x05b2('0x60')][_0x05b2('0x6b')]=_0x372b43['id'];return db[_0x05b2('0x6c')]['create'](_0x549abf[_0x05b2('0x60')]);}})[_0x05b2('0x25')](respondWithResult(_0x42b5f3,null))['catch'](handleError(_0x42b5f3,null));};exports['getDispositions']=function(_0x39a644,_0x2b5958,_0x5a0b96){var _0xa50289={'raw':![],'where':{}};var _0x5c628a={};var _0x4a1945={'count':0x0,'rows':[]};return db[_0x05b2('0x42')]['findOne']({'where':{'id':_0x39a644[_0x05b2('0x5d')]['id']}})[_0x05b2('0x25')](handleEntityNotFound(_0x2b5958,null))[_0x05b2('0x25')](function(_0x434137){if(_0x434137){_0x5c628a[_0x05b2('0x4a')]=_['keys'](db[_0x05b2('0x6c')][_0x05b2('0x43')]);_0x5c628a[_0x05b2('0x46')]=_[_0x05b2('0x47')](_0x39a644[_0x05b2('0x46')]);_0x5c628a[_0x05b2('0x48')]=_[_0x05b2('0x49')](_0x5c628a[_0x05b2('0x4a')],_0x5c628a['query']);_0xa50289[_0x05b2('0x4c')]=_['intersection'](_0x5c628a['model'],qs['fields'](_0x39a644['query'][_0x05b2('0x4b')]));_0xa50289[_0x05b2('0x4c')]=_0xa50289[_0x05b2('0x4c')]['length']?_0xa50289[_0x05b2('0x4c')]:_0x5c628a[_0x05b2('0x4a')];if(!_0x39a644['query']['hasOwnProperty'](_0x05b2('0x4f'))){_0xa50289[_0x05b2('0x50')]=qs[_0x05b2('0x50')](_0x39a644[_0x05b2('0x46')]['limit']);_0xa50289[_0x05b2('0x35')]=qs[_0x05b2('0x35')](_0x39a644[_0x05b2('0x46')][_0x05b2('0x35')]);}_0xa50289['order']=qs[_0x05b2('0x6d')](_0x39a644[_0x05b2('0x46')][_0x05b2('0x6d')]);_0xa50289[_0x05b2('0x52')]=qs[_0x05b2('0x48')](_[_0x05b2('0x53')](_0x39a644['query'],_0x5c628a[_0x05b2('0x48')]));_0xa50289[_0x05b2('0x52')][_0x05b2('0x6b')]=_0x434137['id'];if(_0x39a644[_0x05b2('0x46')]['filter']){_0xa50289[_0x05b2('0x52')]=_[_0x05b2('0x55')](_0xa50289[_0x05b2('0x52')],{'$or':_[_0x05b2('0x41')](_0xa50289['attributes'],function(_0x40da35){var _0x346343={};_0x346343[_0x40da35]={'$like':'%'+_0x39a644[_0x05b2('0x46')][_0x05b2('0x54')]+'%'};return _0x346343;})});}_0xa50289=_['merge']({},_0xa50289,_0x39a644[_0x05b2('0x57')]);return db[_0x05b2('0x6c')][_0x05b2('0x34')]({'where':_0xa50289['where']})[_0x05b2('0x25')](function(_0x54468e){_0x4a1945[_0x05b2('0x34')]=_0x54468e;if(_0x39a644[_0x05b2('0x46')][_0x05b2('0x58')]){_0xa50289[_0x05b2('0x59')]=[{'all':!![]}];}return db[_0x05b2('0x6c')][_0x05b2('0x5a')](_0xa50289);})[_0x05b2('0x25')](function(_0x44f70f){_0x4a1945[_0x05b2('0x5b')]=_0x44f70f;return _0x4a1945;});}})['then'](respondWithFilteredResult(_0x2b5958,_0xa50289))['catch'](handleError(_0x2b5958,null));};exports[_0x05b2('0x6e')]=function(_0x30ab1d,_0x128642,_0xc59b15){return db[_0x05b2('0x42')][_0x05b2('0x5e')]({'where':{'id':_0x30ab1d[_0x05b2('0x5d')]['id']}})[_0x05b2('0x25')](handleEntityNotFound(_0x128642,null))[_0x05b2('0x25')](function(_0x44a751){if(_0x44a751){return _0x44a751['removeDispositions'](_0x30ab1d[_0x05b2('0x46')][_0x05b2('0x6f')]);}})[_0x05b2('0x25')](respondWithStatusCode(_0x128642,null))[_0x05b2('0x2f')](handleError(_0x128642,null));};exports[_0x05b2('0x70')]=function(_0x5d338f,_0x5b4fed,_0x138d6e){if(_0x5d338f[_0x05b2('0x60')]['id']){delete _0x5d338f[_0x05b2('0x60')]['id'];}return db[_0x05b2('0x42')][_0x05b2('0x5e')]({'where':{'id':_0x5d338f['params']['id']}})[_0x05b2('0x25')](handleEntityNotFound(_0x5b4fed,null))['then'](function(_0x4604ad){if(_0x4604ad){_0x5d338f[_0x05b2('0x60')][_0x05b2('0x6b')]=_0x4604ad['id'];return db[_0x05b2('0x71')][_0x05b2('0x5f')](_0x5d338f[_0x05b2('0x60')]);}})[_0x05b2('0x25')](respondWithResult(_0x5b4fed,null))[_0x05b2('0x2f')](handleError(_0x5b4fed,null));};exports[_0x05b2('0x72')]=function(_0x412997,_0x3b2746,_0x7ab34a){var _0x114edc={'raw':![],'where':{}};var _0x335864={};var _0x33d2ed={'count':0x0,'rows':[]};return db[_0x05b2('0x42')][_0x05b2('0x73')]({'where':{'id':_0x412997[_0x05b2('0x5d')]['id']}})[_0x05b2('0x25')](handleEntityNotFound(_0x3b2746,null))[_0x05b2('0x25')](function(_0x530620){if(_0x530620){_0x335864['model']=_[_0x05b2('0x47')](db[_0x05b2('0x71')][_0x05b2('0x43')]);_0x335864['query']=_[_0x05b2('0x47')](_0x412997['query']);_0x335864['filters']=_[_0x05b2('0x49')](_0x335864['model'],_0x335864['query']);_0x114edc[_0x05b2('0x4c')]=_[_0x05b2('0x49')](_0x335864[_0x05b2('0x4a')],qs[_0x05b2('0x4b')](_0x412997['query'][_0x05b2('0x4b')]));_0x114edc[_0x05b2('0x4c')]=_0x114edc[_0x05b2('0x4c')][_0x05b2('0x4d')]?_0x114edc[_0x05b2('0x4c')]:_0x335864[_0x05b2('0x4a')];if(!_0x412997[_0x05b2('0x46')][_0x05b2('0x4e')]('nolimit')){_0x114edc[_0x05b2('0x50')]=qs[_0x05b2('0x50')](_0x412997['query'][_0x05b2('0x50')]);_0x114edc['offset']=qs['offset'](_0x412997[_0x05b2('0x46')][_0x05b2('0x35')]);}_0x114edc['order']=qs[_0x05b2('0x6d')](_0x412997[_0x05b2('0x46')][_0x05b2('0x6d')]);_0x114edc['where']=qs[_0x05b2('0x48')](_[_0x05b2('0x53')](_0x412997[_0x05b2('0x46')],_0x335864[_0x05b2('0x48')]));_0x114edc[_0x05b2('0x52')]['OpenchannelAccountId']=_0x530620['id'];if(_0x412997['query'][_0x05b2('0x54')]){_0x114edc[_0x05b2('0x52')]=_[_0x05b2('0x55')](_0x114edc[_0x05b2('0x52')],{'$or':_[_0x05b2('0x41')](_0x114edc['attributes'],function(_0x3dd4cc){var _0x21218a={};_0x21218a[_0x3dd4cc]={'$like':'%'+_0x412997['query']['filter']+'%'};return _0x21218a;})});}_0x114edc=_[_0x05b2('0x55')]({},_0x114edc,_0x412997[_0x05b2('0x57')]);return db[_0x05b2('0x71')][_0x05b2('0x34')]({'where':_0x114edc[_0x05b2('0x52')]})['then'](function(_0x3d8df5){_0x33d2ed['count']=_0x3d8df5;if(_0x412997[_0x05b2('0x46')][_0x05b2('0x58')]){_0x114edc[_0x05b2('0x59')]=[{'all':!![]}];}return db[_0x05b2('0x71')][_0x05b2('0x5a')](_0x114edc);})[_0x05b2('0x25')](function(_0x2b4019){_0x33d2ed[_0x05b2('0x5b')]=_0x2b4019;return _0x33d2ed;});}})['then'](respondWithFilteredResult(_0x3b2746,_0x114edc))[_0x05b2('0x2f')](handleError(_0x3b2746,null));};exports['removeAnswers']=function(_0x35d1f3,_0x1b063a,_0x56d77a){return db[_0x05b2('0x42')]['find']({'where':{'id':_0x35d1f3['params']['id']}})['then'](handleEntityNotFound(_0x1b063a,null))['then'](function(_0x33a9c2){if(_0x33a9c2){return _0x33a9c2[_0x05b2('0x74')](_0x35d1f3[_0x05b2('0x46')][_0x05b2('0x6f')]);}})['then'](respondWithStatusCode(_0x1b063a,null))['catch'](handleError(_0x1b063a,null));};exports[_0x05b2('0x75')]=function(_0x2482aa,_0x31cee2,_0x4dac7a){var _0x3d14f0={'body':_0x2482aa[_0x05b2('0x60')],'channel':_0x05b2('0x76')};var _0x48652f=[];var _0x318269=[];var _0x182048={};var _0x3c7342=![];return db['CmContact'][_0x05b2('0x69')]()[_0x05b2('0x25')](function(_0x5b449c){if(!_0x5b449c){throw new db[(_0x05b2('0x77'))]['ValidationError']('no\x20available\x20attributes');}_0x48652f=_[_0x05b2('0x78')](_['keys'](_0x5b449c),[_0x05b2('0x79'),_0x05b2('0x7a')]);_0x318269=_[_0x05b2('0x78')](_[_0x05b2('0x47')](_0x5b449c),['createdAt',_0x05b2('0x7a'),_0x05b2('0x7b'),_0x05b2('0x7c')]);if(_0x2482aa['body']['id']){delete _0x2482aa[_0x05b2('0x60')]['id'];}if(_[_0x05b2('0x7d')](_0x2482aa[_0x05b2('0x60')]['from'])){throw new db[(_0x05b2('0x77'))][(_0x05b2('0x7e'))](_0x05b2('0x7f'));}if(_[_0x05b2('0x7d')](_0x2482aa[_0x05b2('0x60')][_0x05b2('0x60')])||_0x2482aa[_0x05b2('0x60')][_0x05b2('0x60')]===''){throw new db[(_0x05b2('0x77'))][(_0x05b2('0x7e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2482aa[_0x05b2('0x60')]['mapKey'])){throw new db[(_0x05b2('0x77'))]['ValidationError'](_0x05b2('0x80')+_0x318269);}if(!_[_0x05b2('0x81')](_0x318269,_0x2482aa['body']['mapKey'])){throw new db[(_0x05b2('0x77'))][(_0x05b2('0x7e'))](_0x05b2('0x82')+_0x318269);}_0x182048[_0x2482aa[_0x05b2('0x60')][_0x05b2('0x83')]]=_0x2482aa[_0x05b2('0x60')][_0x05b2('0x84')];})['then'](function(){return db[_0x05b2('0x42')]['find']({'where':{'id':_0x2482aa[_0x05b2('0x5d')]['id']},'include':[{'model':db['CmList'],'as':_0x05b2('0x85'),'include':[{'model':db['CmContact'],'as':_0x05b2('0x86'),'where':_0x182048,'limit':0x1,'order':[[_0x05b2('0x7a'),_0x05b2('0x87')]]}]},{'model':db['OpenchannelApplication'],'as':_0x05b2('0x88')}]});})['then'](handleEntityNotFound(_0x31cee2,null))['then'](function(_0x2bec05){if(_0x2bec05&&_0x2bec05[_0x05b2('0x85')]){_0x3d14f0[_0x05b2('0x89')]=_0x2bec05;_0x3d14f0[_0x05b2('0x8a')]=_0x2bec05['Applications'];_0x3d14f0[_0x05b2('0x8b')]=_0x2bec05[_0x05b2('0x85')];_0x3d14f0[_0x05b2('0x8a')]=_[_0x05b2('0x8c')](_0x3d14f0[_0x05b2('0x8a')],['priority'],[_0x05b2('0x8d')]);if(_0x3d14f0[_0x05b2('0x89')][_0x05b2('0x88')]){delete _0x3d14f0[_0x05b2('0x89')][_0x05b2('0x88')];}if(_0x3d14f0['account'][_0x05b2('0x85')]&&_0x3d14f0['account'][_0x05b2('0x85')][_0x05b2('0x86')][_0x05b2('0x4d')]){return _0x3d14f0[_0x05b2('0x89')][_0x05b2('0x85')][_0x05b2('0x86')][0x0];}var _0x2e97a0=_[_0x05b2('0x1f')](_0x2482aa[_0x05b2('0x60')],{'firstName':_0x2482aa[_0x05b2('0x60')][_0x05b2('0x84')],'ListId':_0x2bec05[_0x05b2('0x7c')]});_0x2e97a0[_0x2482aa[_0x05b2('0x60')][_0x05b2('0x83')]]=_0x2482aa[_0x05b2('0x60')]['from'];return db[_0x05b2('0x8e')][_0x05b2('0x5f')](_0x2e97a0,{'fields':_0x48652f,'raw':!![]});}})[_0x05b2('0x25')](handleEntityNotFound(_0x31cee2,null))['then'](function(_0xc34ac7){_0x3d14f0['contact']=_0xc34ac7;if(_0xc34ac7){var _0x4e8510={'ContactId':_0xc34ac7['id'],'OpenchannelAccountId':_0x2482aa[_0x05b2('0x5d')]['id'],'from':(_0xc34ac7['firstName']||'')+'\x20'+(_0xc34ac7[_0x05b2('0x8f')]||'')};var _0x19c0d1={'OpenchannelAccountId':_0x2482aa['params']['id'],'closed':![]};if(_0x2482aa[_0x05b2('0x60')]['threadId']){_0x19c0d1[_0x05b2('0x90')]=_0x2482aa[_0x05b2('0x60')]['threadId'];return db[_0x05b2('0x91')][_0x05b2('0x5e')]({'where':_0x19c0d1})[_0x05b2('0x25')](function(_0x1eb9e3){if(_0x1eb9e3){return[_0x1eb9e3,![]];}_0x4e8510[_0x05b2('0x90')]=_0x2482aa['body'][_0x05b2('0x90')];_0x4e8510[_0x05b2('0x92')]=_0x2482aa[_0x05b2('0x60')][_0x05b2('0x92')];return db[_0x05b2('0x91')][_0x05b2('0x5f')](_0x4e8510)[_0x05b2('0x25')](function(_0x42e571){return[_0x42e571,!![]];});});}else{_0x19c0d1['threadId']=null;}_0x19c0d1[_0x05b2('0x93')]=_0xc34ac7['id'];return db['OpenchannelInteraction'][_0x05b2('0x5e')]({'where':_0x19c0d1})[_0x05b2('0x25')](function(_0x90cbd4){if(_0x90cbd4){return[_0x90cbd4,![]];}return db['OpenchannelInteraction'][_0x05b2('0x5f')](_0x4e8510)['then'](function(_0x46c0ca){return[_0x46c0ca,!![]];});});}})[_0x05b2('0x94')](function(_0x9cfa9c,_0x4fddd4){if(_0x9cfa9c){_0x3c7342=_0x4fddd4;if(!_0x4fddd4){var _0x5457c6={'from':(_0x3d14f0[_0x05b2('0x95')][_0x05b2('0x96')]||'')+'\x20'+(_0x3d14f0[_0x05b2('0x95')][_0x05b2('0x8f')]||'')};if(_0x2482aa[_0x05b2('0x60')][_0x05b2('0x90')]&&_0x2482aa[_0x05b2('0x60')][_0x05b2('0x97')]&&_0x2482aa[_0x05b2('0x60')][_0x05b2('0x90')]!=_0x2482aa[_0x05b2('0x60')][_0x05b2('0x97')]){_0x5457c6[_0x05b2('0x90')]=_0x2482aa[_0x05b2('0x60')][_0x05b2('0x97')];}return _0x9cfa9c['update'](_0x5457c6);}else{return _0x9cfa9c;}}})['then'](function(_0x2f52ad){_0x3d14f0[_0x05b2('0x98')]=_0x2f52ad[_0x05b2('0x3a')]({'plain':!![]});_0x3d14f0[_0x05b2('0x98')][_0x05b2('0x99')]=_0x3c7342;if(_0x3d14f0[_0x05b2('0x98')]['created']){if(_0x3d14f0[_0x05b2('0x89')][_0x05b2('0x9a')]){_0x3d14f0[_0x05b2('0x8a')][_0x05b2('0x9b')]({'id':0x0,'priority':_0x3d14f0[_0x05b2('0x8a')][_0x05b2('0x4d')]+0x1,'app':_0x05b2('0x9c'),'appdata':_0x05b2('0x9d'),'interval':'*,*,*,*'});}}return db[_0x05b2('0x9e')][_0x05b2('0x5f')]({'body':_0x2482aa['body'][_0x05b2('0x60')],'OpenchannelAccountId':_0x2482aa[_0x05b2('0x5d')]['id'],'OpenchannelInteractionId':_0x2f52ad['id'],'direction':'in','ContactId':_0x3d14f0[_0x05b2('0x95')]['id'],'AttachmentId':_0x2482aa[_0x05b2('0x60')][_0x05b2('0x9f')]});})[_0x05b2('0x25')](function(_0x436166){_0x3d14f0[_0x05b2('0x2d')]=_0x436166;if(!_0x3d14f0[_0x05b2('0x98')][_0x05b2('0xa0')])return;return db[_0x05b2('0xa1')]['find']({'attributes':['id','name'],'where':{'id':_0x3d14f0[_0x05b2('0x98')][_0x05b2('0xa0')]}});})['then'](function(_0x5ebd8d){if(_0x5ebd8d){_0x3d14f0[_0x05b2('0x8a')]['unshift']({'id':0x0,'priority':0x0,'app':_0x05b2('0xa2'),'appdata':_0x5ebd8d[_0x05b2('0x3d')]+','+(_0x3d14f0['account'][_0x05b2('0xa3')]||0xa),'interval':'*,*,*,*'});}if(!_0x3d14f0[_0x05b2('0x98')][_0x05b2('0xa4')])return;return db[_0x05b2('0xa5')][_0x05b2('0x5e')]({'attributes':['id',_0x05b2('0x3d')],'where':{'id':_0x3d14f0['interaction'][_0x05b2('0xa4')]}});})[_0x05b2('0x25')](function(_0x16efb1){if(_0x16efb1){_0x3d14f0[_0x05b2('0x8a')][_0x05b2('0xa6')]({'id':0x0,'priority':0x1,'app':_0x05b2('0xa7'),'appdata':_0x16efb1[_0x05b2('0x3d')]+','+(_0x3d14f0['account'][_0x05b2('0xa8')]||0x12c),'interval':_0x05b2('0xa9')});}return respondWithRpcPromise(_0x05b2('0xaa'),_0x05b2('0xab'),_0x3d14f0);})[_0x05b2('0x25')](function(_0x315228){respondWithRpcPromise(_0x05b2('0xac'),'EventManager',{'event':_0x05b2('0x75'),'message':_0x315228},client9002);return _0x315228;})['then'](respondWithResult(_0x31cee2,null))[_0x05b2('0x2f')](handleError(_0x31cee2,null));};exports[_0x05b2('0xad')]=function(_0x4692e1,_0x4b72b4){var _0xa70739=_0x4692e1[_0x05b2('0x5d')]['id'];var _0x214cf0=_0x4692e1[_0x05b2('0x60')];var _0x38a7e6=0xc8;var _0xe810de=null;return db[_0x05b2('0xae')][_0x05b2('0xaf')]({'isolationLevel':db[_0x05b2('0xae')][_0x05b2('0xb0')][_0x05b2('0xb1')][_0x05b2('0xb2')]},function(_0x3d1dde){return db[_0x05b2('0x42')][_0x05b2('0x73')]({'where':{'id':_0xa70739},'transaction':_0x3d1dde})['then'](function(_0x14516b){if(_0x14516b){return db[_0x05b2('0xb3')][_0x05b2('0x39')]({'where':{'OpenchannelAccountId':_0xa70739},'transaction':_0x3d1dde})[_0x05b2('0x25')](function(){var _0x2574a3=_[_0x05b2('0x41')](_0x214cf0,function(_0x2d4521){_0x2d4521['OpenchannelAccountId']=_0xa70739;return _0x2d4521;});return db[_0x05b2('0xb3')][_0x05b2('0xb4')](_0x2574a3,{'transaction':_0x3d1dde});});}else{_0x38a7e6=0x194;_0xe810de=[];}});})[_0x05b2('0x25')](function(){if(_0x38a7e6!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0xa70739},'order':_0x05b2('0xb5')})[_0x05b2('0x25')](function(_0x49db4c){_0xe810de=_0x49db4c;});}})[_0x05b2('0x2f')](function(_0x2a5645){_0x38a7e6=0x1f4;logger[_0x05b2('0x2b')](_0x2a5645[_0x05b2('0x3c')]);if(_0x2a5645[_0x05b2('0x3d')]){delete _0x2a5645[_0x05b2('0x3d')];}_0xe810de=_0x2a5645;})[_0x05b2('0xb6')](function(){if(_0xe810de===null){_0x4b72b4[_0x05b2('0x30')](_0x38a7e6);}else{if(_0x38a7e6===0x1f4){_0x4b72b4[_0x05b2('0x31')](_0x38a7e6)[_0x05b2('0xb7')](_0xe810de);}else{_0x4b72b4[_0x05b2('0x31')](_0x38a7e6)[_0x05b2('0xb8')](_0xe810de);}}});};exports[_0x05b2('0xb9')]=function(_0x2e991c,_0x3d212e,_0x449fd3){var _0x32003c={};var _0x13ae0e={};var _0x5888c3;var _0x5bfafc;return db[_0x05b2('0x42')][_0x05b2('0x73')]({'where':{'id':_0x2e991c[_0x05b2('0x5d')]['id']}})[_0x05b2('0x25')](handleEntityNotFound(_0x3d212e,null))[_0x05b2('0x25')](function(_0x2a65ed){if(_0x2a65ed){_0x5888c3=_0x2a65ed;_0x13ae0e[_0x05b2('0x4a')]=_[_0x05b2('0x47')](db[_0x05b2('0xb3')][_0x05b2('0x43')]);_0x13ae0e[_0x05b2('0x46')]=_[_0x05b2('0x47')](_0x2e991c[_0x05b2('0x46')]);_0x13ae0e[_0x05b2('0x48')]=_[_0x05b2('0x49')](_0x13ae0e[_0x05b2('0x4a')],_0x13ae0e[_0x05b2('0x46')]);_0x32003c[_0x05b2('0x4c')]=_['intersection'](_0x13ae0e[_0x05b2('0x4a')],qs[_0x05b2('0x4b')](_0x2e991c[_0x05b2('0x46')][_0x05b2('0x4b')]));_0x32003c[_0x05b2('0x4c')]=_0x32003c[_0x05b2('0x4c')][_0x05b2('0x4d')]?_0x32003c[_0x05b2('0x4c')]:_0x13ae0e['model'];_0x32003c[_0x05b2('0x51')]=qs[_0x05b2('0x6d')](_0x2e991c['query'][_0x05b2('0x6d')]);_0x32003c['where']=qs[_0x05b2('0x48')](_[_0x05b2('0x53')](_0x2e991c['query'],_0x13ae0e[_0x05b2('0x48')]));if(_0x2e991c[_0x05b2('0x46')][_0x05b2('0x54')]){_0x32003c['where']=_[_0x05b2('0x55')](_0x32003c[_0x05b2('0x52')],{'$or':_[_0x05b2('0x41')](_0x32003c[_0x05b2('0x4c')],function(_0xed2d7){var _0x7a1c72={};_0x7a1c72[_0xed2d7]={'$like':'%'+_0x2e991c[_0x05b2('0x46')][_0x05b2('0x54')]+'%'};return _0x7a1c72;})});}_0x32003c=_[_0x05b2('0x55')]({},_0x32003c,_0x2e991c[_0x05b2('0x57')]);return _0x5888c3[_0x05b2('0xb9')](_0x32003c);}})[_0x05b2('0x25')](function(_0x38e1fd){if(_0x38e1fd){_0x5bfafc=_0x38e1fd[_0x05b2('0x4d')];if(!_0x2e991c[_0x05b2('0x46')]['hasOwnProperty']('nolimit')){_0x32003c['limit']=qs['limit'](_0x2e991c[_0x05b2('0x46')][_0x05b2('0x50')]);_0x32003c[_0x05b2('0x35')]=qs['offset'](_0x2e991c['query']['offset']);}return _0x5888c3[_0x05b2('0xb9')](_0x32003c);}})[_0x05b2('0x25')](function(_0x58f8fd){if(_0x58f8fd){return _0x58f8fd?{'count':_0x5bfafc,'rows':_0x58f8fd}:null;}})[_0x05b2('0x25')](respondWithResult(_0x3d212e,null))['catch'](handleError(_0x3d212e,null));};exports[_0x05b2('0xba')]=function(_0x99e577,_0x542099,_0xa2aea8){var _0xf61fc5={'raw':![],'where':{}};var _0x20b22c={};var _0x3d5632={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x05b2('0x73')]({'where':{'id':_0x99e577[_0x05b2('0x5d')]['id']}})[_0x05b2('0x25')](handleEntityNotFound(_0x542099,null))[_0x05b2('0x25')](function(_0xa0fee3){if(_0xa0fee3){_0x20b22c[_0x05b2('0x4a')]=_[_0x05b2('0x47')](db['OpenchannelInteraction'][_0x05b2('0x43')]);_0x20b22c[_0x05b2('0x46')]=_['keys'](_0x99e577[_0x05b2('0x46')]);_0x20b22c['filters']=_['intersection'](_0x20b22c[_0x05b2('0x4a')],_0x20b22c['query']);_0xf61fc5['attributes']=_[_0x05b2('0x49')](_0x20b22c[_0x05b2('0x4a')],qs[_0x05b2('0x4b')](_0x99e577[_0x05b2('0x46')]['fields']));_0xf61fc5[_0x05b2('0x4c')]=_0xf61fc5[_0x05b2('0x4c')][_0x05b2('0x4d')]?_0xf61fc5[_0x05b2('0x4c')]:_0x20b22c[_0x05b2('0x4a')];if(!_0x99e577[_0x05b2('0x46')][_0x05b2('0x4e')](_0x05b2('0x4f'))){_0xf61fc5[_0x05b2('0x50')]=qs[_0x05b2('0x50')](_0x99e577[_0x05b2('0x46')]['limit']);_0xf61fc5[_0x05b2('0x35')]=qs[_0x05b2('0x35')](_0x99e577[_0x05b2('0x46')][_0x05b2('0x35')]);}_0xf61fc5[_0x05b2('0x51')]=qs[_0x05b2('0x6d')](_0x99e577['query'][_0x05b2('0x6d')]);_0xf61fc5['where']=qs[_0x05b2('0x48')](_[_0x05b2('0x53')](_0x99e577[_0x05b2('0x46')],_0x20b22c[_0x05b2('0x48')]));_0xf61fc5[_0x05b2('0x52')][_0x05b2('0x6b')]=_0xa0fee3['id'];if(_0x99e577['query'][_0x05b2('0x54')]){_0xf61fc5[_0x05b2('0x52')]=_['merge'](_0xf61fc5[_0x05b2('0x52')],{'$or':_['map'](_0xf61fc5[_0x05b2('0x4c')],function(_0x521ed8){var _0x82e1ae={};_0x82e1ae[_0x521ed8]={'$like':'%'+_0x99e577[_0x05b2('0x46')][_0x05b2('0x54')]+'%'};return _0x82e1ae;})});}_0xf61fc5=_[_0x05b2('0x55')]({},_0xf61fc5,_0x99e577['options']);return db[_0x05b2('0x91')][_0x05b2('0x34')]({'where':_0xf61fc5[_0x05b2('0x52')]})[_0x05b2('0x25')](function(_0x27d1d8){_0x3d5632[_0x05b2('0x34')]=_0x27d1d8;if(_0x99e577['query'][_0x05b2('0x58')]){_0xf61fc5[_0x05b2('0x59')]=[{'model':db[_0x05b2('0x8e')],'as':_0x05b2('0xbb'),'required':![]},{'model':db[_0x05b2('0xa1')],'as':'Owner','attributes':['name',_0x05b2('0xbc'),_0x05b2('0xbd')],'required':![]},{'model':db[_0x05b2('0xbe')],'as':_0x05b2('0xbf'),'attributes':['id',_0x05b2('0x3d'),_0x05b2('0xc0')],'where':_0x99e577['query'][_0x05b2('0xc1')]?{'id':_0x99e577['query'][_0x05b2('0xc1')]}:undefined,'required':_0x99e577['query'][_0x05b2('0xc1')]?!![]:![]}];}return db[_0x05b2('0x91')][_0x05b2('0x5a')](_0xf61fc5);})['then'](function(_0x5803fc){_0x3d5632[_0x05b2('0x5b')]=_0x5803fc;return _0x3d5632;});}})[_0x05b2('0x25')](respondWithFilteredResult(_0x542099,_0xf61fc5))['catch'](handleError(_0x542099,null));};exports[_0x05b2('0xc2')]=function(_0x2e0d52,_0x53be8f,_0x573b4d){return db[_0x05b2('0x42')][_0x05b2('0x5e')]({'where':{'id':_0x2e0d52[_0x05b2('0x5d')]['id']}})['then'](handleEntityNotFound(_0x53be8f,null))[_0x05b2('0x25')](function(_0x2d1b8b){if(_0x2d1b8b){return _0x2d1b8b['addAgents'](_0x2e0d52[_0x05b2('0x60')][_0x05b2('0x6f')],_[_0x05b2('0xc3')](_0x2e0d52[_0x05b2('0x60')],[_0x05b2('0x6f'),'id'])||{})['spread'](function(_0xad0fa4){for(var _0x1eab27=0x0;_0x1eab27<_0x2e0d52[_0x05b2('0x60')][_0x05b2('0x6f')][_0x05b2('0x4d')];_0x1eab27+=0x1){socket[_0x05b2('0xc4')](_0x05b2('0xc5'),{'UserId':Number(_0x2e0d52[_0x05b2('0x60')]['ids'][_0x1eab27]),'OpenchannelAccountId':Number(_0x2e0d52['params']['id'])});}return _0xad0fa4;});}})['then'](respondWithResult(_0x53be8f,null))[_0x05b2('0x2f')](handleError(_0x53be8f,null));};exports[_0x05b2('0xc6')]=function(_0x254518,_0x44e07f,_0x1610ee){return db[_0x05b2('0x42')][_0x05b2('0x5e')]({'where':{'id':_0x254518[_0x05b2('0x5d')]['id']}})[_0x05b2('0x25')](handleEntityNotFound(_0x44e07f,null))[_0x05b2('0x25')](function(_0xe556df){if(_0xe556df){return _0xe556df['removeAgents'](_0x254518[_0x05b2('0x46')][_0x05b2('0x6f')])[_0x05b2('0x25')](function(){if(_[_0x05b2('0xc7')](_0x254518[_0x05b2('0x46')]['ids'])){for(var _0x1a72c8=0x0;_0x1a72c8<_0x254518[_0x05b2('0x46')][_0x05b2('0x6f')][_0x05b2('0x4d')];_0x1a72c8+=0x1){socket[_0x05b2('0xc4')](_0x05b2('0xc8'),{'UserId':Number(_0x254518[_0x05b2('0x46')][_0x05b2('0x6f')][_0x1a72c8]),'OpenchannelAccountId':Number(_0x254518[_0x05b2('0x5d')]['id'])});}}else{socket[_0x05b2('0xc4')]('userOpenchannelAccount:remove',{'UserId':Number(_0x254518[_0x05b2('0x46')][_0x05b2('0x6f')]),'OpenchannelAccountId':Number(_0x254518[_0x05b2('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x44e07f,null))[_0x05b2('0x2f')](handleError(_0x44e07f,null));};exports[_0x05b2('0xc9')]=function(_0x5da81e,_0x72868e,_0x2ce766){var _0x4e5c5c={};var _0x2266c9={};var _0x7bcf69;var _0x5dae66;return db[_0x05b2('0x42')][_0x05b2('0x73')]({'where':{'id':_0x5da81e['params']['id']}})[_0x05b2('0x25')](handleEntityNotFound(_0x72868e,null))[_0x05b2('0x25')](function(_0xc5d37c){if(_0xc5d37c){_0x7bcf69=_0xc5d37c;_0x2266c9[_0x05b2('0x4a')]=_['keys'](db[_0x05b2('0xa1')][_0x05b2('0x43')]);_0x2266c9[_0x05b2('0x46')]=_['keys'](_0x5da81e[_0x05b2('0x46')]);_0x2266c9['filters']=_[_0x05b2('0x49')](_0x2266c9[_0x05b2('0x4a')],_0x2266c9[_0x05b2('0x46')]);_0x4e5c5c[_0x05b2('0x4c')]=_['intersection'](_0x2266c9[_0x05b2('0x4a')],qs[_0x05b2('0x4b')](_0x5da81e[_0x05b2('0x46')]['fields']));_0x4e5c5c[_0x05b2('0x4c')]=_0x4e5c5c[_0x05b2('0x4c')]['length']?_0x4e5c5c[_0x05b2('0x4c')]:_0x2266c9[_0x05b2('0x4a')];_0x4e5c5c['order']=qs[_0x05b2('0x6d')](_0x5da81e['query'][_0x05b2('0x6d')]);_0x4e5c5c[_0x05b2('0x52')]=qs[_0x05b2('0x48')](_[_0x05b2('0x53')](_0x5da81e['query'],_0x2266c9[_0x05b2('0x48')]));if(_0x5da81e[_0x05b2('0x46')]['filter']){_0x4e5c5c[_0x05b2('0x52')]=_['merge'](_0x4e5c5c['where'],{'$or':_[_0x05b2('0x41')](_0x4e5c5c['attributes'],function(_0x2dfc3f){var _0x24558d={};_0x24558d[_0x2dfc3f]={'$like':'%'+_0x5da81e[_0x05b2('0x46')][_0x05b2('0x54')]+'%'};return _0x24558d;})});}_0x4e5c5c=_[_0x05b2('0x55')]({},_0x4e5c5c,_0x5da81e[_0x05b2('0x57')]);return _0x7bcf69[_0x05b2('0xc9')](_0x4e5c5c);}})['then'](function(_0x40a6e1){if(_0x40a6e1){_0x5dae66=_0x40a6e1['length'];if(!_0x5da81e[_0x05b2('0x46')][_0x05b2('0x4e')]('nolimit')){_0x4e5c5c[_0x05b2('0x50')]=qs[_0x05b2('0x50')](_0x5da81e[_0x05b2('0x46')][_0x05b2('0x50')]);_0x4e5c5c['offset']=qs[_0x05b2('0x35')](_0x5da81e[_0x05b2('0x46')][_0x05b2('0x35')]);}return _0x7bcf69[_0x05b2('0xc9')](_0x4e5c5c);}})[_0x05b2('0x25')](function(_0x2600b7){if(_0x2600b7){return _0x2600b7?{'count':_0x5dae66,'rows':_0x2600b7}:null;}})[_0x05b2('0x25')](respondWithResult(_0x72868e,null))[_0x05b2('0x2f')](handleError(_0x72868e,null));};exports['send']=function(_0x305a45,_0x3f57f8,_0x1d70ad){var _0x56305c,_0x5a6bae,_0x187fcb;if(_['isNil'](_0x305a45[_0x05b2('0x60')][_0x05b2('0x60')])||_0x305a45['body'][_0x05b2('0x60')]===''){throw new db[(_0x05b2('0x77'))][(_0x05b2('0x7e'))](_0x05b2('0xca'));}if(_['isNil'](_0x305a45[_0x05b2('0x60')]['to'])){}_0x56305c=_0x305a45[_0x05b2('0x60')]['to'];return db[_0x05b2('0x42')][_0x05b2('0x73')]({'where':{'id':_0x305a45['params']['id']}})['then'](handleEntityNotFound(_0x3f57f8,null))[_0x05b2('0x25')](function(_0x1c87a5){if(_0x1c87a5){return db['OpenchannelAccount'][_0x05b2('0x5e')]({'where':{'id':_0x1c87a5['id']},'include':[{'model':db['CmList'],'as':_0x05b2('0x85'),'include':[{'model':db[_0x05b2('0x8e')],'as':_0x05b2('0x86'),'where':{[_0x1c87a5['mapKey']]:_0x56305c},'limit':0x1,'order':[[_0x05b2('0x7a'),_0x05b2('0x87')]]}]}]})[_0x05b2('0x25')](handleEntityNotFound(_0x3f57f8,null))[_0x05b2('0x25')](function(_0x51fe88){if(_0x51fe88&&_0x51fe88[_0x05b2('0x85')]){_0x5a6bae=_0x51fe88[_0x05b2('0x3a')]({'plain':!![]});if(_0x5a6bae[_0x05b2('0x85')]&&_0x5a6bae[_0x05b2('0x85')][_0x05b2('0x86')][_0x05b2('0x4d')]){return _0x5a6bae['List'][_0x05b2('0x86')][0x0];}return db[_0x05b2('0x8e')]['create'](_['defaults'](_0x305a45['body'],{'firstName':_0x56305c,[_0x51fe88['mapKey']]:_0x56305c,'phone':_0x56305c,'ListId':_0x5a6bae[_0x05b2('0x7c')]}));}})[_0x05b2('0x25')](handleEntityNotFound(_0x3f57f8,null))[_0x05b2('0x25')](function(_0x143d4d){if(_0x143d4d){_0x187fcb=_0x143d4d;return db[_0x05b2('0x91')][_0x05b2('0x5e')]({'where':{'ContactId':_0x187fcb['id'],'closed':![],'OpenchannelAccountId':_0x5a6bae['id']}})[_0x05b2('0x25')](function(_0x55506d){if(_0x55506d){return[_0x55506d,![]];}return db[_0x05b2('0x91')][_0x05b2('0x5f')]({'UserId':_0x305a45[_0x05b2('0x62')]['id'],'ContactId':_0x187fcb['id'],'OpenchannelAccountId':_0x5a6bae['id'],'lastMsgDirection':_0x05b2('0xcb'),'firstMsgDirection':_0x05b2('0xcb'),'Messages':[_[_0x05b2('0x55')](_0x305a45['body'],{'read':![],'body':_0x305a45[_0x05b2('0x60')][_0x05b2('0x60')],'OpenchannelAccountId':_0x5a6bae['id'],'UserId':_0x305a45['user']['id'],'ContactId':_0x187fcb['id']})]},{'include':[{'model':db[_0x05b2('0x9e')],'as':'Messages'}]})[_0x05b2('0x25')](function(_0x26edc7){return[_0x26edc7,!![]];});});}})[_0x05b2('0x94')](function(_0xb8ddd,_0x20c458){if(_0x20c458){return _0xb8ddd;}return db['OpenchannelMessage'][_0x05b2('0x5f')](_['merge'](_0x305a45['body'],{'read':![],'body':_0x305a45['body'][_0x05b2('0x60')],'OpenchannelAccountId':_0x5a6bae['id'],'OpenchannelInteractionId':_0xb8ddd['id'],'UserId':_0x305a45[_0x05b2('0x62')]['id'],'ContactId':_0x187fcb['id']}))[_0x05b2('0x25')](function(_0x3e8698){_0xb8ddd[_0x05b2('0xcc')][_0x05b2('0xcd')]=[];_0xb8ddd[_0x05b2('0xcc')]['Messages'][_0x05b2('0x9b')](_0x3e8698['dataValues']);return _0xb8ddd;});});}})[_0x05b2('0x25')](respondWithResult(_0x3f57f8,null))[_0x05b2('0x2f')](handleError(_0x3f57f8,null));}; \ No newline at end of file +var _0x078a=['rows','show','Pause','rawAttributes','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','ValidationError','difference','createdAt','updatedAt','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','OpenchannelApplication','Applications','List','account','applications','list','orderBy','priority','asc','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','send','getInteractions','Contact','internal','Tags','color','tag','addAgents','ids','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','OpenchannelMessage','dataValues','Messages','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','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/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','get','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0x078a,0x12d));var _0xa078=function(_0xa050aa,_0x4482b2){_0xa050aa=_0xa050aa-0x0;var _0x2498d7=_0x078a[_0xa050aa];return _0x2498d7;};'use strict';var emlformat=require(_0xa078('0x0'));var rimraf=require(_0xa078('0x1'));var zipdir=require(_0xa078('0x2'));var jsonpatch=require(_0xa078('0x3'));var rp=require(_0xa078('0x4'));var moment=require(_0xa078('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa078('0x6'));var util=require(_0xa078('0x7'));var path=require(_0xa078('0x8'));var sox=require('sox');var csv=require(_0xa078('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa078('0xa'));var _=require(_0xa078('0xb'));var squel=require(_0xa078('0xc'));var crypto=require(_0xa078('0xd'));var jsforce=require(_0xa078('0xe'));var deskjs=require(_0xa078('0xf'));var toCsv=require(_0xa078('0x9'));var querystring=require(_0xa078('0x10'));var Papa=require('papaparse');var Redis=require(_0xa078('0x11'));var authService=require(_0xa078('0x12'));var qs=require(_0xa078('0x13'));var as=require(_0xa078('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa078('0x15'))(_0xa078('0x16'));var utils=require(_0xa078('0x17'));var config=require(_0xa078('0x18'));var licenseUtil=require(_0xa078('0x19'));var db=require('../../mysqldb')['db'];config[_0xa078('0x1a')]=_[_0xa078('0x1b')](config[_0xa078('0x1a')],{'host':_0xa078('0x1c'),'port':0x18eb});var socket=require(_0xa078('0x1d'))(new Redis(config[_0xa078('0x1a')]));require(_0xa078('0x1e'))[_0xa078('0x1f')](socket);var jayson=require(_0xa078('0x20'));var client=jayson[_0xa078('0x21')][_0xa078('0x22')]({'port':0x232c});var client9002=jayson[_0xa078('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a24f8,_0x410ff9,_0x361963,_0x4cf39e){return new BPromise(function(_0x2100e3,_0x348ac5){var _0x5da909=_0x4cf39e||client;return _0x5da909[_0xa078('0x23')](_0x3a24f8,_0x361963)[_0xa078('0x24')](function(_0x389474){logger['info'](_0xa078('0x25'),_0x410ff9,_0xa078('0x26'));logger[_0xa078('0x27')](_0xa078('0x28'),_0x410ff9,_0xa078('0x26'),JSON[_0xa078('0x29')](_0x389474));if(_0x389474['error']){if(_0x389474['error'][_0xa078('0x2a')]===0x1f4){logger['error'](_0xa078('0x25'),_0x410ff9,_0x389474[_0xa078('0x2b')][_0xa078('0x2c')]);return _0x348ac5(_0x389474[_0xa078('0x2b')][_0xa078('0x2c')]);}logger[_0xa078('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x410ff9,_0x389474[_0xa078('0x2b')]['message']);return _0x2100e3(_0x389474['error'][_0xa078('0x2c')]);}else{logger[_0xa078('0x2d')]('OpenchannelAccount,\x20%s,\x20%s',_0x410ff9,'request\x20sent');_0x2100e3(_0x389474[_0xa078('0x2e')][_0xa078('0x2c')]);}})[_0xa078('0x2f')](function(_0x262b22){logger['error'](_0xa078('0x25'),_0x410ff9,_0x262b22);_0x348ac5(_0x262b22);});});}function respondWithStatusCode(_0x22d7be,_0x550560){_0x550560=_0x550560||0xcc;return function(_0xeb5d3d){if(_0xeb5d3d){return _0x22d7be[_0xa078('0x30')](_0x550560);}return _0x22d7be[_0xa078('0x31')](_0x550560)[_0xa078('0x32')]();};}function respondWithResult(_0x2e673a,_0x157322){_0x157322=_0x157322||0xc8;return function(_0x3b1433){if(_0x3b1433){return _0x2e673a[_0xa078('0x31')](_0x157322)[_0xa078('0x33')](_0x3b1433);}};}function respondWithFilteredResult(_0x18d6b2,_0x308085){return function(_0x5ae5ac){if(_0x5ae5ac){var _0x2e2199=typeof _0x308085[_0xa078('0x34')]===_0xa078('0x35')&&typeof _0x308085[_0xa078('0x36')]===_0xa078('0x35');var _0x4575a5=_0x5ae5ac['count'];var _0x128dec=_0x2e2199?0x0:_0x308085['offset'];var _0x447a04=_0x2e2199?_0x5ae5ac[_0xa078('0x37')]:_0x308085[_0xa078('0x34')]+_0x308085[_0xa078('0x36')];var _0x4ee85a;if(_0x447a04>=_0x4575a5){_0x447a04=_0x4575a5;_0x4ee85a=0xc8;}else{_0x4ee85a=0xce;}_0x18d6b2[_0xa078('0x31')](_0x4ee85a);return _0x18d6b2[_0xa078('0x38')](_0xa078('0x39'),_0x128dec+'-'+_0x447a04+'/'+_0x4575a5)[_0xa078('0x33')](_0x5ae5ac);}return null;};}function patchUpdates(_0x31a6cb){return function(_0x4cc457){try{jsonpatch['apply'](_0x4cc457,_0x31a6cb,!![]);}catch(_0x39b9d2){return BPromise[_0xa078('0x3a')](_0x39b9d2);}return _0x4cc457['save']();};}function saveUpdates(_0x1948fc,_0x4908cd){return function(_0x4dca73){if(_0x4dca73){return _0x4dca73[_0xa078('0x3b')](_0x1948fc)[_0xa078('0x24')](function(_0x317013){return _0x317013;});}return null;};}function removeEntity(_0x21f54f,_0x23971a){return function(_0x1cc46f){if(_0x1cc46f){return _0x1cc46f[_0xa078('0x3c')]()[_0xa078('0x24')](function(){var _0x4c2022=_0x1cc46f[_0xa078('0x3d')]({'plain':!![]});var _0x10a3f3='OpenchannelAccounts';return db[_0xa078('0x3e')]['destroy']({'where':{'type':_0x10a3f3,'resourceId':_0x4c2022['id']}})['then'](function(){return _0x1cc46f;});})['then'](function(){_0x21f54f['status'](0xcc)[_0xa078('0x32')]();});}};}function handleEntityNotFound(_0x5561ae,_0x3c850d){return function(_0x36ab3b){if(!_0x36ab3b){_0x5561ae['sendStatus'](0x194);}return _0x36ab3b;};}function handleError(_0x34c0b6,_0xe6e4eb){_0xe6e4eb=_0xe6e4eb||0x1f4;return function(_0x2338f3){logger['error'](_0x2338f3[_0xa078('0x3f')]);if(_0x2338f3[_0xa078('0x40')]){delete _0x2338f3[_0xa078('0x40')];}_0x34c0b6[_0xa078('0x31')](_0xe6e4eb)['send'](_0x2338f3);};}exports[_0xa078('0x41')]=function(_0x1621b8,_0x103179){var _0x42689d={'include':[{'model':db['Pause'],'as':_0xa078('0x42')}]},_0x7efdc3={},_0x54aa97={'count':0x0,'rows':[]};var _0x3dda89=_[_0xa078('0x43')](db[_0xa078('0x44')]['rawAttributes'],function(_0x1e8f03){return{'name':_0x1e8f03[_0xa078('0x45')],'type':_0x1e8f03[_0xa078('0x46')][_0xa078('0x47')]};});_0x7efdc3[_0xa078('0x48')]=_[_0xa078('0x43')](_0x3dda89,_0xa078('0x40'));_0x7efdc3[_0xa078('0x49')]=_[_0xa078('0x4a')](_0x1621b8[_0xa078('0x49')]);_0x7efdc3[_0xa078('0x4b')]=_[_0xa078('0x4c')](_0x7efdc3[_0xa078('0x48')],_0x7efdc3[_0xa078('0x49')]);_0x42689d[_0xa078('0x4d')]=_[_0xa078('0x4c')](_0x7efdc3[_0xa078('0x48')],qs[_0xa078('0x4e')](_0x1621b8[_0xa078('0x49')]['fields']));_0x42689d[_0xa078('0x4d')]=_0x42689d[_0xa078('0x4d')][_0xa078('0x4f')]?_0x42689d[_0xa078('0x4d')]:_0x7efdc3[_0xa078('0x48')];if(!_0x1621b8[_0xa078('0x49')][_0xa078('0x50')](_0xa078('0x51'))){_0x42689d[_0xa078('0x36')]=qs[_0xa078('0x36')](_0x1621b8['query'][_0xa078('0x36')]);_0x42689d[_0xa078('0x34')]=qs[_0xa078('0x34')](_0x1621b8[_0xa078('0x49')][_0xa078('0x34')]);}_0x42689d[_0xa078('0x52')]=qs[_0xa078('0x53')](_0x1621b8['query'][_0xa078('0x53')]);_0x42689d['where']=qs[_0xa078('0x4b')](_[_0xa078('0x54')](_0x1621b8['query'],_0x7efdc3[_0xa078('0x4b')]),_0x3dda89);if(_0x1621b8[_0xa078('0x49')][_0xa078('0x55')]){_0x42689d[_0xa078('0x56')]=_[_0xa078('0x57')](_0x42689d['where'],{'$or':_['map'](_0x3dda89,function(_0xee182a){if(_0xee182a[_0xa078('0x46')]!=='VIRTUAL'){var _0x28e982={};_0x28e982[_0xee182a[_0xa078('0x40')]]={'$like':'%'+_0x1621b8['query'][_0xa078('0x55')]+'%'};return _0x28e982;}})});}_0x42689d=_[_0xa078('0x57')]({},_0x42689d,_0x1621b8[_0xa078('0x58')]);var _0x4bf214={'where':_0x42689d[_0xa078('0x56')]};return db[_0xa078('0x44')][_0xa078('0x37')](_0x4bf214)[_0xa078('0x24')](function(_0x2b0727){_0x54aa97[_0xa078('0x37')]=_0x2b0727;if(_0x1621b8['query'][_0xa078('0x59')]){_0x42689d[_0xa078('0x5a')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x42689d);})[_0xa078('0x24')](function(_0x2c941d){_0x54aa97[_0xa078('0x5b')]=_0x2c941d;return _0x54aa97;})['then'](respondWithFilteredResult(_0x103179,_0x42689d))[_0xa078('0x2f')](handleError(_0x103179,null));};exports[_0xa078('0x5c')]=function(_0x445310,_0x591f64){var _0x4ff1cf={'raw':![],'where':{'id':_0x445310['params']['id']},'include':[{'model':db[_0xa078('0x5d')],'as':_0xa078('0x42')}]},_0x533b21={};_0x533b21[_0xa078('0x48')]=_['keys'](db['OpenchannelAccount'][_0xa078('0x5e')]);_0x533b21[_0xa078('0x49')]=_['keys'](_0x445310[_0xa078('0x49')]);_0x533b21['filters']=_['intersection'](_0x533b21[_0xa078('0x48')],_0x533b21['query']);_0x4ff1cf[_0xa078('0x4d')]=_[_0xa078('0x4c')](_0x533b21[_0xa078('0x48')],qs['fields'](_0x445310[_0xa078('0x49')]['fields']));_0x4ff1cf[_0xa078('0x4d')]=_0x4ff1cf[_0xa078('0x4d')][_0xa078('0x4f')]?_0x4ff1cf[_0xa078('0x4d')]:_0x533b21[_0xa078('0x48')];if(_0x445310[_0xa078('0x49')][_0xa078('0x59')]){_0x4ff1cf['include']=[{'all':!![]}];}_0x4ff1cf=_[_0xa078('0x57')]({},_0x4ff1cf,_0x445310['options']);return db[_0xa078('0x44')]['find'](_0x4ff1cf)['then'](handleEntityNotFound(_0x591f64,null))[_0xa078('0x24')](respondWithResult(_0x591f64,null))[_0xa078('0x2f')](handleError(_0x591f64,null));};exports['create']=function(_0x618eae,_0x59701c){return db[_0xa078('0x44')]['create'](_0x618eae[_0xa078('0x5f')],{})[_0xa078('0x24')](function(_0x15e195){var _0x10be9b=_0x618eae[_0xa078('0x60')][_0xa078('0x3d')]({'plain':!![]});if(!_0x10be9b)throw new Error(_0xa078('0x61'));if(_0x10be9b['role']===_0xa078('0x60')){var _0x528d59=_0x15e195['get']({'plain':!![]});var _0x577fd2='OpenchannelAccounts';return db['UserProfileSection'][_0xa078('0x62')]({'where':{'name':_0x577fd2,'userProfileId':_0x10be9b[_0xa078('0x63')]},'raw':!![]})['then'](function(_0xdb2569){if(_0xdb2569&&_0xdb2569['autoAssociation']===0x0){return db[_0xa078('0x3e')][_0xa078('0x64')]({'name':_0x528d59['name'],'resourceId':_0x528d59['id'],'type':_0xdb2569['name'],'sectionId':_0xdb2569['id']},{})[_0xa078('0x24')](function(){return _0x15e195;});}else{return _0x15e195;}})['catch'](function(_0x3e88e4){logger[_0xa078('0x2b')](_0xa078('0x65'),_0x3e88e4);throw _0x3e88e4;});}return _0x15e195;})[_0xa078('0x24')](respondWithResult(_0x59701c,0xc9))['catch'](handleError(_0x59701c,null));};exports['update']=function(_0x583068,_0xc4c877){if(_0x583068['body']['id']){delete _0x583068[_0xa078('0x5f')]['id'];}return db['OpenchannelAccount'][_0xa078('0x62')]({'where':{'id':_0x583068[_0xa078('0x66')]['id']},'include':[{'model':db[_0xa078('0x5d')],'as':_0xa078('0x42')}]})[_0xa078('0x24')](handleEntityNotFound(_0xc4c877,null))[_0xa078('0x24')](saveUpdates(_0x583068['body'],null))[_0xa078('0x24')](respondWithResult(_0xc4c877,null))[_0xa078('0x2f')](handleError(_0xc4c877,null));};exports[_0xa078('0x3c')]=function(_0xefb29b,_0x5169dd){return db['OpenchannelAccount'][_0xa078('0x62')]({'where':{'id':_0xefb29b['params']['id']}})[_0xa078('0x24')](handleEntityNotFound(_0x5169dd,null))[_0xa078('0x24')](removeEntity(_0x5169dd,null))[_0xa078('0x2f')](handleError(_0x5169dd,null));};exports[_0xa078('0x67')]=function(_0x5ecfe1,_0x142375){return db[_0xa078('0x44')]['describe']()[_0xa078('0x24')](respondWithResult(_0x142375,null))[_0xa078('0x2f')](handleError(_0x142375,null));};exports[_0xa078('0x68')]=function(_0x3f1381,_0x37ea7c,_0x5a5cc6){if(_0x3f1381[_0xa078('0x5f')]['id']){delete _0x3f1381['body']['id'];}return db[_0xa078('0x44')][_0xa078('0x62')]({'where':{'id':_0x3f1381[_0xa078('0x66')]['id']}})[_0xa078('0x24')](handleEntityNotFound(_0x37ea7c,null))[_0xa078('0x24')](function(_0x4fc7f0){if(_0x4fc7f0){_0x3f1381['body'][_0xa078('0x69')]=_0x4fc7f0['id'];return db[_0xa078('0x6a')][_0xa078('0x64')](_0x3f1381[_0xa078('0x5f')]);}})['then'](respondWithResult(_0x37ea7c,null))[_0xa078('0x2f')](handleError(_0x37ea7c,null));};exports[_0xa078('0x6b')]=function(_0x5b9f89,_0x5f4a86,_0x3d030c){var _0x412c89={'raw':![],'where':{}};var _0x25700e={};var _0x211179={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xa078('0x6c')]({'where':{'id':_0x5b9f89[_0xa078('0x66')]['id']}})[_0xa078('0x24')](handleEntityNotFound(_0x5f4a86,null))[_0xa078('0x24')](function(_0x52d765){if(_0x52d765){_0x25700e[_0xa078('0x48')]=_[_0xa078('0x4a')](db[_0xa078('0x6a')][_0xa078('0x5e')]);_0x25700e['query']=_['keys'](_0x5b9f89[_0xa078('0x49')]);_0x25700e['filters']=_[_0xa078('0x4c')](_0x25700e['model'],_0x25700e[_0xa078('0x49')]);_0x412c89['attributes']=_[_0xa078('0x4c')](_0x25700e[_0xa078('0x48')],qs[_0xa078('0x4e')](_0x5b9f89[_0xa078('0x49')][_0xa078('0x4e')]));_0x412c89[_0xa078('0x4d')]=_0x412c89[_0xa078('0x4d')][_0xa078('0x4f')]?_0x412c89[_0xa078('0x4d')]:_0x25700e[_0xa078('0x48')];if(!_0x5b9f89[_0xa078('0x49')][_0xa078('0x50')](_0xa078('0x51'))){_0x412c89['limit']=qs[_0xa078('0x36')](_0x5b9f89[_0xa078('0x49')][_0xa078('0x36')]);_0x412c89['offset']=qs[_0xa078('0x34')](_0x5b9f89[_0xa078('0x49')]['offset']);}_0x412c89['order']=qs[_0xa078('0x53')](_0x5b9f89['query'][_0xa078('0x53')]);_0x412c89[_0xa078('0x56')]=qs[_0xa078('0x4b')](_[_0xa078('0x54')](_0x5b9f89[_0xa078('0x49')],_0x25700e[_0xa078('0x4b')]));_0x412c89[_0xa078('0x56')][_0xa078('0x69')]=_0x52d765['id'];if(_0x5b9f89[_0xa078('0x49')][_0xa078('0x55')]){_0x412c89[_0xa078('0x56')]=_[_0xa078('0x57')](_0x412c89[_0xa078('0x56')],{'$or':_['map'](_0x412c89[_0xa078('0x4d')],function(_0x4d690c){var _0x4a7629={};_0x4a7629[_0x4d690c]={'$like':'%'+_0x5b9f89[_0xa078('0x49')]['filter']+'%'};return _0x4a7629;})});}_0x412c89=_[_0xa078('0x57')]({},_0x412c89,_0x5b9f89[_0xa078('0x58')]);return db[_0xa078('0x6a')][_0xa078('0x37')]({'where':_0x412c89['where']})['then'](function(_0x5cb132){_0x211179[_0xa078('0x37')]=_0x5cb132;if(_0x5b9f89[_0xa078('0x49')][_0xa078('0x59')]){_0x412c89[_0xa078('0x5a')]=[{'all':!![]}];}return db[_0xa078('0x6a')][_0xa078('0x6d')](_0x412c89);})[_0xa078('0x24')](function(_0xff31d6){_0x211179[_0xa078('0x5b')]=_0xff31d6;return _0x211179;});}})[_0xa078('0x24')](respondWithFilteredResult(_0x5f4a86,_0x412c89))[_0xa078('0x2f')](handleError(_0x5f4a86,null));};exports[_0xa078('0x6e')]=function(_0x3d7220,_0x44cead,_0x18f968){return db[_0xa078('0x44')][_0xa078('0x62')]({'where':{'id':_0x3d7220['params']['id']}})[_0xa078('0x24')](handleEntityNotFound(_0x44cead,null))[_0xa078('0x24')](function(_0x58a87a){if(_0x58a87a){return _0x58a87a[_0xa078('0x6e')](_0x3d7220['query']['ids']);}})[_0xa078('0x24')](respondWithStatusCode(_0x44cead,null))[_0xa078('0x2f')](handleError(_0x44cead,null));};exports[_0xa078('0x6f')]=function(_0x50200d,_0x40a1c4,_0x2b465b){if(_0x50200d[_0xa078('0x5f')]['id']){delete _0x50200d['body']['id'];}return db[_0xa078('0x44')]['find']({'where':{'id':_0x50200d['params']['id']}})['then'](handleEntityNotFound(_0x40a1c4,null))[_0xa078('0x24')](function(_0x22cef2){if(_0x22cef2){_0x50200d[_0xa078('0x5f')]['OpenchannelAccountId']=_0x22cef2['id'];return db[_0xa078('0x70')]['create'](_0x50200d[_0xa078('0x5f')]);}})[_0xa078('0x24')](respondWithResult(_0x40a1c4,null))[_0xa078('0x2f')](handleError(_0x40a1c4,null));};exports['getAnswers']=function(_0x1c7fed,_0x5385f4,_0x7abdfa){var _0x478c30={'raw':![],'where':{}};var _0x5ea53c={};var _0x42db4c={'count':0x0,'rows':[]};return db[_0xa078('0x44')]['findOne']({'where':{'id':_0x1c7fed['params']['id']}})[_0xa078('0x24')](handleEntityNotFound(_0x5385f4,null))[_0xa078('0x24')](function(_0x2e2fe0){if(_0x2e2fe0){_0x5ea53c[_0xa078('0x48')]=_[_0xa078('0x4a')](db[_0xa078('0x70')][_0xa078('0x5e')]);_0x5ea53c[_0xa078('0x49')]=_['keys'](_0x1c7fed['query']);_0x5ea53c['filters']=_[_0xa078('0x4c')](_0x5ea53c[_0xa078('0x48')],_0x5ea53c[_0xa078('0x49')]);_0x478c30['attributes']=_[_0xa078('0x4c')](_0x5ea53c['model'],qs['fields'](_0x1c7fed[_0xa078('0x49')]['fields']));_0x478c30[_0xa078('0x4d')]=_0x478c30['attributes']['length']?_0x478c30[_0xa078('0x4d')]:_0x5ea53c[_0xa078('0x48')];if(!_0x1c7fed['query']['hasOwnProperty'](_0xa078('0x51'))){_0x478c30[_0xa078('0x36')]=qs[_0xa078('0x36')](_0x1c7fed[_0xa078('0x49')][_0xa078('0x36')]);_0x478c30[_0xa078('0x34')]=qs[_0xa078('0x34')](_0x1c7fed[_0xa078('0x49')]['offset']);}_0x478c30[_0xa078('0x52')]=qs[_0xa078('0x53')](_0x1c7fed['query'][_0xa078('0x53')]);_0x478c30['where']=qs[_0xa078('0x4b')](_[_0xa078('0x54')](_0x1c7fed[_0xa078('0x49')],_0x5ea53c[_0xa078('0x4b')]));_0x478c30[_0xa078('0x56')][_0xa078('0x69')]=_0x2e2fe0['id'];if(_0x1c7fed[_0xa078('0x49')]['filter']){_0x478c30[_0xa078('0x56')]=_[_0xa078('0x57')](_0x478c30['where'],{'$or':_[_0xa078('0x43')](_0x478c30[_0xa078('0x4d')],function(_0x4ccde0){var _0x15869c={};_0x15869c[_0x4ccde0]={'$like':'%'+_0x1c7fed[_0xa078('0x49')][_0xa078('0x55')]+'%'};return _0x15869c;})});}_0x478c30=_['merge']({},_0x478c30,_0x1c7fed[_0xa078('0x58')]);return db[_0xa078('0x70')]['count']({'where':_0x478c30[_0xa078('0x56')]})['then'](function(_0x1c8949){_0x42db4c[_0xa078('0x37')]=_0x1c8949;if(_0x1c7fed[_0xa078('0x49')][_0xa078('0x59')]){_0x478c30[_0xa078('0x5a')]=[{'all':!![]}];}return db[_0xa078('0x70')][_0xa078('0x6d')](_0x478c30);})['then'](function(_0x40f0e3){_0x42db4c[_0xa078('0x5b')]=_0x40f0e3;return _0x42db4c;});}})[_0xa078('0x24')](respondWithFilteredResult(_0x5385f4,_0x478c30))[_0xa078('0x2f')](handleError(_0x5385f4,null));};exports['removeAnswers']=function(_0x5290ea,_0x1e5341,_0xc22b98){return db[_0xa078('0x44')][_0xa078('0x62')]({'where':{'id':_0x5290ea['params']['id']}})['then'](handleEntityNotFound(_0x1e5341,null))[_0xa078('0x24')](function(_0x2d315f){if(_0x2d315f){return _0x2d315f[_0xa078('0x71')](_0x5290ea[_0xa078('0x49')]['ids']);}})[_0xa078('0x24')](respondWithStatusCode(_0x1e5341,null))[_0xa078('0x2f')](handleError(_0x1e5341,null));};exports[_0xa078('0x72')]=function(_0x17089c,_0x5b064c,_0x1dbe6e){var _0x2b1574={'body':_0x17089c[_0xa078('0x5f')],'channel':_0xa078('0x73')};var _0x127b8f=[];var _0x1f0f03=[];var _0x5f47f5={};var _0x11c980=![];return db[_0xa078('0x74')][_0xa078('0x67')]()[_0xa078('0x24')](function(_0x3b50ed){if(!_0x3b50ed){throw new db['Sequelize'][(_0xa078('0x75'))]('no\x20available\x20attributes');}_0x127b8f=_[_0xa078('0x76')](_[_0xa078('0x4a')](_0x3b50ed),[_0xa078('0x77'),_0xa078('0x78')]);_0x1f0f03=_[_0xa078('0x76')](_[_0xa078('0x4a')](_0x3b50ed),[_0xa078('0x77'),_0xa078('0x78'),'CompanyId',_0xa078('0x79')]);if(_0x17089c[_0xa078('0x5f')]['id']){delete _0x17089c['body']['id'];}if(_[_0xa078('0x7a')](_0x17089c[_0xa078('0x5f')][_0xa078('0x7b')])){throw new db[(_0xa078('0x7c'))]['ValidationError'](_0xa078('0x7d'));}if(_[_0xa078('0x7a')](_0x17089c[_0xa078('0x5f')][_0xa078('0x5f')])||_0x17089c['body']['body']===''){throw new db[(_0xa078('0x7c'))][(_0xa078('0x75'))](_0xa078('0x7e'));}if(_[_0xa078('0x7a')](_0x17089c['body'][_0xa078('0x7f')])){throw new db['Sequelize'][(_0xa078('0x75'))](_0xa078('0x80')+_0x1f0f03);}if(!_[_0xa078('0x81')](_0x1f0f03,_0x17089c[_0xa078('0x5f')][_0xa078('0x7f')])){throw new db[(_0xa078('0x7c'))][(_0xa078('0x75'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1f0f03);}_0x5f47f5[_0x17089c[_0xa078('0x5f')][_0xa078('0x7f')]]=_0x17089c[_0xa078('0x5f')][_0xa078('0x7b')];})[_0xa078('0x24')](function(){return db['OpenchannelAccount'][_0xa078('0x62')]({'where':{'id':_0x17089c[_0xa078('0x66')]['id']},'include':[{'model':db[_0xa078('0x82')],'as':'List','include':[{'model':db[_0xa078('0x74')],'as':_0xa078('0x83'),'where':_0x5f47f5,'limit':0x1,'order':[[_0xa078('0x78'),_0xa078('0x84')]]}]},{'model':db[_0xa078('0x85')],'as':_0xa078('0x86')}]});})[_0xa078('0x24')](handleEntityNotFound(_0x5b064c,null))[_0xa078('0x24')](function(_0x114e03){if(_0x114e03&&_0x114e03[_0xa078('0x87')]){_0x2b1574[_0xa078('0x88')]=_0x114e03;_0x2b1574[_0xa078('0x89')]=_0x114e03[_0xa078('0x86')];_0x2b1574[_0xa078('0x8a')]=_0x114e03[_0xa078('0x87')];_0x2b1574[_0xa078('0x89')]=_[_0xa078('0x8b')](_0x2b1574[_0xa078('0x89')],[_0xa078('0x8c')],[_0xa078('0x8d')]);if(_0x2b1574[_0xa078('0x88')]['Applications']){delete _0x2b1574[_0xa078('0x88')][_0xa078('0x86')];}if(_0x2b1574[_0xa078('0x88')][_0xa078('0x87')]&&_0x2b1574[_0xa078('0x88')][_0xa078('0x87')][_0xa078('0x83')][_0xa078('0x4f')]){return _0x2b1574[_0xa078('0x88')][_0xa078('0x87')]['Contacts'][0x0];}var _0x5d9825=_[_0xa078('0x1b')](_0x17089c[_0xa078('0x5f')],{'firstName':_0x17089c['body'][_0xa078('0x7b')],'ListId':_0x114e03[_0xa078('0x79')]});_0x5d9825[_0x17089c[_0xa078('0x5f')][_0xa078('0x7f')]]=_0x17089c['body']['from'];return db[_0xa078('0x74')][_0xa078('0x64')](_0x5d9825,{'fields':_0x127b8f,'raw':!![]});}})[_0xa078('0x24')](handleEntityNotFound(_0x5b064c,null))[_0xa078('0x24')](function(_0x5f46a7){_0x2b1574[_0xa078('0x8e')]=_0x5f46a7;if(_0x5f46a7){var _0x46a5dc={'ContactId':_0x5f46a7['id'],'OpenchannelAccountId':_0x17089c[_0xa078('0x66')]['id'],'from':(_0x5f46a7[_0xa078('0x8f')]||'')+'\x20'+(_0x5f46a7[_0xa078('0x90')]||'')};var _0x597665={'OpenchannelAccountId':_0x17089c[_0xa078('0x66')]['id'],'closed':![]};if(_0x17089c[_0xa078('0x5f')][_0xa078('0x91')]){_0x597665[_0xa078('0x91')]=_0x17089c['body'][_0xa078('0x91')];return db['OpenchannelInteraction']['find']({'where':_0x597665})[_0xa078('0x24')](function(_0x424ecd){if(_0x424ecd){return[_0x424ecd,![]];}_0x46a5dc[_0xa078('0x91')]=_0x17089c[_0xa078('0x5f')][_0xa078('0x91')];_0x46a5dc[_0xa078('0x92')]=_0x17089c[_0xa078('0x5f')][_0xa078('0x92')];return db[_0xa078('0x93')]['create'](_0x46a5dc)[_0xa078('0x24')](function(_0xcc1acf){return[_0xcc1acf,!![]];});});}else{_0x597665[_0xa078('0x91')]=null;}_0x597665[_0xa078('0x94')]=_0x5f46a7['id'];return db[_0xa078('0x93')][_0xa078('0x62')]({'where':_0x597665})[_0xa078('0x24')](function(_0x1ddd94){if(_0x1ddd94){return[_0x1ddd94,![]];}return db[_0xa078('0x93')][_0xa078('0x64')](_0x46a5dc)[_0xa078('0x24')](function(_0x13d1c1){return[_0x13d1c1,!![]];});});}})[_0xa078('0x95')](function(_0x37be60,_0xfaa463){if(_0x37be60){_0x11c980=_0xfaa463;if(!_0xfaa463){var _0x9fdc01={'from':(_0x2b1574[_0xa078('0x8e')][_0xa078('0x8f')]||'')+'\x20'+(_0x2b1574['contact']['lastName']||'')};if(_0x17089c['body'][_0xa078('0x91')]&&_0x17089c['body']['messageId']&&_0x17089c[_0xa078('0x5f')][_0xa078('0x91')]!=_0x17089c['body'][_0xa078('0x96')]){_0x9fdc01[_0xa078('0x91')]=_0x17089c[_0xa078('0x5f')][_0xa078('0x96')];}return _0x37be60[_0xa078('0x3b')](_0x9fdc01);}else{return _0x37be60;}}})['then'](function(_0x475518){_0x2b1574[_0xa078('0x97')]=_0x475518[_0xa078('0x3d')]({'plain':!![]});_0x2b1574[_0xa078('0x97')][_0xa078('0x98')]=_0x11c980;if(_0x2b1574['interaction'][_0xa078('0x98')]){if(_0x2b1574['account'][_0xa078('0x99')]){_0x2b1574[_0xa078('0x89')]['push']({'id':0x0,'priority':_0x2b1574['applications'][_0xa078('0x4f')]+0x1,'app':_0xa078('0x9a'),'appdata':_0xa078('0x9b'),'interval':_0xa078('0x9c')});}}return db['OpenchannelMessage'][_0xa078('0x64')]({'body':_0x17089c[_0xa078('0x5f')][_0xa078('0x5f')],'OpenchannelAccountId':_0x17089c[_0xa078('0x66')]['id'],'OpenchannelInteractionId':_0x475518['id'],'direction':'in','ContactId':_0x2b1574[_0xa078('0x8e')]['id'],'AttachmentId':_0x17089c[_0xa078('0x5f')][_0xa078('0x9d')]});})['then'](function(_0x19cd96){_0x2b1574['message']=_0x19cd96;if(!_0x2b1574[_0xa078('0x97')][_0xa078('0x9e')])return;return db['User'][_0xa078('0x62')]({'attributes':['id','name'],'where':{'id':_0x2b1574[_0xa078('0x97')]['UserId']}});})[_0xa078('0x24')](function(_0x248b7c){if(_0x248b7c){_0x2b1574[_0xa078('0x89')][_0xa078('0x9f')]({'id':0x0,'priority':0x0,'app':_0xa078('0xa0'),'appdata':_0x248b7c[_0xa078('0x40')]+','+(_0x2b1574[_0xa078('0x88')][_0xa078('0xa1')]||0xa),'interval':_0xa078('0x9c')});}if(!_0x2b1574['interaction'][_0xa078('0xa2')])return;return db[_0xa078('0xa3')]['find']({'attributes':['id',_0xa078('0x40')],'where':{'id':_0x2b1574[_0xa078('0x97')][_0xa078('0xa2')]}});})[_0xa078('0x24')](function(_0xd701c6){if(_0xd701c6){_0x2b1574[_0xa078('0x89')]['unshift']({'id':0x0,'priority':0x1,'app':_0xa078('0xa4'),'appdata':_0xd701c6[_0xa078('0x40')]+','+(_0x2b1574['account'][_0xa078('0xa5')]||0x12c),'interval':_0xa078('0x9c')});}return respondWithRpcPromise('Start',_0xa078('0xa6'),_0x2b1574);})[_0xa078('0x24')](function(_0x2c2825){respondWithRpcPromise('EventManager',_0xa078('0xa7'),{'event':'notify','message':_0x2c2825},client9002);return _0x2c2825;})[_0xa078('0x24')](respondWithResult(_0x5b064c,null))[_0xa078('0x2f')](handleError(_0x5b064c,null));};exports[_0xa078('0xa8')]=function(_0x4f73e3,_0x413388){var _0x1397f3=_0x4f73e3[_0xa078('0x66')]['id'];var _0x2308b6=_0x4f73e3[_0xa078('0x5f')];var _0x5136b8=0xc8;var _0x3b14c1=null;return db['sequelize'][_0xa078('0xa9')]({'isolationLevel':db[_0xa078('0xaa')][_0xa078('0xab')][_0xa078('0xac')][_0xa078('0xad')]},function(_0x55adf0){return db[_0xa078('0x44')][_0xa078('0x6c')]({'where':{'id':_0x1397f3},'transaction':_0x55adf0})[_0xa078('0x24')](function(_0x4e74bb){if(_0x4e74bb){return db[_0xa078('0x85')]['destroy']({'where':{'OpenchannelAccountId':_0x1397f3},'transaction':_0x55adf0})[_0xa078('0x24')](function(){var _0x2025d2=_['map'](_0x2308b6,function(_0x46faaf){_0x46faaf['OpenchannelAccountId']=_0x1397f3;return _0x46faaf;});return db[_0xa078('0x85')]['bulkCreate'](_0x2025d2,{'transaction':_0x55adf0});});}else{_0x5136b8=0x194;_0x3b14c1=[];}});})[_0xa078('0x24')](function(){if(_0x5136b8!==0x194){return db['OpenchannelApplication'][_0xa078('0xae')]({'where':{'OpenchannelAccountId':_0x1397f3},'order':_0xa078('0x8c')})['then'](function(_0x34bfee){_0x3b14c1=_0x34bfee;});}})[_0xa078('0x2f')](function(_0x470040){_0x5136b8=0x1f4;logger[_0xa078('0x2b')](_0x470040['stack']);if(_0x470040['name']){delete _0x470040[_0xa078('0x40')];}_0x3b14c1=_0x470040;})[_0xa078('0xaf')](function(){if(_0x3b14c1===null){_0x413388[_0xa078('0x30')](_0x5136b8);}else{if(_0x5136b8===0x1f4){_0x413388['status'](_0x5136b8)[_0xa078('0xb0')](_0x3b14c1);}else{_0x413388[_0xa078('0x31')](_0x5136b8)[_0xa078('0x33')](_0x3b14c1);}}});};exports['getApplications']=function(_0x3b8084,_0x2f87bb,_0x11bf4d){var _0x312056={};var _0x236ec7={};var _0xa9aca7;var _0x361198;return db[_0xa078('0x44')][_0xa078('0x6c')]({'where':{'id':_0x3b8084['params']['id']}})['then'](handleEntityNotFound(_0x2f87bb,null))[_0xa078('0x24')](function(_0x2d1e38){if(_0x2d1e38){_0xa9aca7=_0x2d1e38;_0x236ec7['model']=_['keys'](db[_0xa078('0x85')][_0xa078('0x5e')]);_0x236ec7[_0xa078('0x49')]=_[_0xa078('0x4a')](_0x3b8084[_0xa078('0x49')]);_0x236ec7[_0xa078('0x4b')]=_['intersection'](_0x236ec7[_0xa078('0x48')],_0x236ec7[_0xa078('0x49')]);_0x312056[_0xa078('0x4d')]=_[_0xa078('0x4c')](_0x236ec7[_0xa078('0x48')],qs[_0xa078('0x4e')](_0x3b8084[_0xa078('0x49')][_0xa078('0x4e')]));_0x312056[_0xa078('0x4d')]=_0x312056[_0xa078('0x4d')][_0xa078('0x4f')]?_0x312056[_0xa078('0x4d')]:_0x236ec7[_0xa078('0x48')];_0x312056[_0xa078('0x52')]=qs[_0xa078('0x53')](_0x3b8084[_0xa078('0x49')][_0xa078('0x53')]);_0x312056[_0xa078('0x56')]=qs['filters'](_[_0xa078('0x54')](_0x3b8084['query'],_0x236ec7['filters']));if(_0x3b8084[_0xa078('0x49')][_0xa078('0x55')]){_0x312056[_0xa078('0x56')]=_[_0xa078('0x57')](_0x312056[_0xa078('0x56')],{'$or':_[_0xa078('0x43')](_0x312056['attributes'],function(_0x21612b){var _0x4858ca={};_0x4858ca[_0x21612b]={'$like':'%'+_0x3b8084['query'][_0xa078('0x55')]+'%'};return _0x4858ca;})});}_0x312056=_['merge']({},_0x312056,_0x3b8084[_0xa078('0x58')]);return _0xa9aca7['getApplications'](_0x312056);}})[_0xa078('0x24')](function(_0x50d65c){if(_0x50d65c){_0x361198=_0x50d65c[_0xa078('0x4f')];if(!_0x3b8084[_0xa078('0x49')]['hasOwnProperty'](_0xa078('0x51'))){_0x312056['limit']=qs[_0xa078('0x36')](_0x3b8084['query']['limit']);_0x312056[_0xa078('0x34')]=qs['offset'](_0x3b8084['query'][_0xa078('0x34')]);}return _0xa9aca7['getApplications'](_0x312056);}})['then'](function(_0x4a3f76){if(_0x4a3f76){return _0x4a3f76?{'count':_0x361198,'rows':_0x4a3f76}:null;}})[_0xa078('0x24')](respondWithResult(_0x2f87bb,null))[_0xa078('0x2f')](handleError(_0x2f87bb,null));};exports[_0xa078('0xb1')]=function(_0x4832ee,_0x531b1e,_0x32ae59){var _0xe98b7c={'raw':![],'where':{}};var _0x5b8f7e={};var _0x20443b={'count':0x0,'rows':[]};return db[_0xa078('0x44')]['findOne']({'where':{'id':_0x4832ee[_0xa078('0x66')]['id']}})[_0xa078('0x24')](handleEntityNotFound(_0x531b1e,null))['then'](function(_0x2d9a66){if(_0x2d9a66){_0x5b8f7e['model']=_[_0xa078('0x4a')](db[_0xa078('0x93')]['rawAttributes']);_0x5b8f7e[_0xa078('0x49')]=_[_0xa078('0x4a')](_0x4832ee[_0xa078('0x49')]);_0x5b8f7e[_0xa078('0x4b')]=_['intersection'](_0x5b8f7e['model'],_0x5b8f7e[_0xa078('0x49')]);_0xe98b7c[_0xa078('0x4d')]=_[_0xa078('0x4c')](_0x5b8f7e[_0xa078('0x48')],qs[_0xa078('0x4e')](_0x4832ee[_0xa078('0x49')][_0xa078('0x4e')]));_0xe98b7c[_0xa078('0x4d')]=_0xe98b7c[_0xa078('0x4d')]['length']?_0xe98b7c[_0xa078('0x4d')]:_0x5b8f7e['model'];if(!_0x4832ee[_0xa078('0x49')][_0xa078('0x50')]('nolimit')){_0xe98b7c[_0xa078('0x36')]=qs[_0xa078('0x36')](_0x4832ee[_0xa078('0x49')][_0xa078('0x36')]);_0xe98b7c[_0xa078('0x34')]=qs[_0xa078('0x34')](_0x4832ee[_0xa078('0x49')][_0xa078('0x34')]);}_0xe98b7c[_0xa078('0x52')]=qs[_0xa078('0x53')](_0x4832ee[_0xa078('0x49')][_0xa078('0x53')]);_0xe98b7c[_0xa078('0x56')]=qs[_0xa078('0x4b')](_[_0xa078('0x54')](_0x4832ee['query'],_0x5b8f7e[_0xa078('0x4b')]));_0xe98b7c[_0xa078('0x56')][_0xa078('0x69')]=_0x2d9a66['id'];if(_0x4832ee[_0xa078('0x49')][_0xa078('0x55')]){_0xe98b7c[_0xa078('0x56')]=_['merge'](_0xe98b7c['where'],{'$or':_[_0xa078('0x43')](_0xe98b7c[_0xa078('0x4d')],function(_0x3bbc7a){var _0x49a03d={};_0x49a03d[_0x3bbc7a]={'$like':'%'+_0x4832ee[_0xa078('0x49')][_0xa078('0x55')]+'%'};return _0x49a03d;})});}_0xe98b7c=_[_0xa078('0x57')]({},_0xe98b7c,_0x4832ee['options']);return db[_0xa078('0x93')][_0xa078('0x37')]({'where':_0xe98b7c[_0xa078('0x56')]})['then'](function(_0x3ecef6){_0x20443b['count']=_0x3ecef6;if(_0x4832ee[_0xa078('0x49')][_0xa078('0x59')]){_0xe98b7c[_0xa078('0x5a')]=[{'model':db[_0xa078('0x74')],'as':_0xa078('0xb2'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xa078('0x40'),'fullname',_0xa078('0xb3')],'required':![]},{'model':db['Tag'],'as':_0xa078('0xb4'),'attributes':['id','name',_0xa078('0xb5')],'where':_0x4832ee[_0xa078('0x49')][_0xa078('0xb6')]?{'id':_0x4832ee[_0xa078('0x49')][_0xa078('0xb6')]}:undefined,'required':_0x4832ee[_0xa078('0x49')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xa078('0x6d')](_0xe98b7c);})[_0xa078('0x24')](function(_0x2653fc){_0x20443b['rows']=_0x2653fc;return _0x20443b;});}})['then'](respondWithFilteredResult(_0x531b1e,_0xe98b7c))[_0xa078('0x2f')](handleError(_0x531b1e,null));};exports['addAgents']=function(_0x44cc0b,_0x4a3d4b,_0x2cb63e){return db['OpenchannelAccount']['find']({'where':{'id':_0x44cc0b[_0xa078('0x66')]['id']}})[_0xa078('0x24')](handleEntityNotFound(_0x4a3d4b,null))[_0xa078('0x24')](function(_0x57808f){if(_0x57808f){return _0x57808f[_0xa078('0xb7')](_0x44cc0b[_0xa078('0x5f')][_0xa078('0xb8')],_[_0xa078('0xb9')](_0x44cc0b['body'],[_0xa078('0xb8'),'id'])||{})['spread'](function(_0x2223e4){for(var _0x35af23=0x0;_0x35af23<_0x44cc0b[_0xa078('0x5f')]['ids']['length'];_0x35af23+=0x1){socket['emit'](_0xa078('0xba'),{'UserId':Number(_0x44cc0b[_0xa078('0x5f')]['ids'][_0x35af23]),'OpenchannelAccountId':Number(_0x44cc0b[_0xa078('0x66')]['id'])});}return _0x2223e4;});}})['then'](respondWithResult(_0x4a3d4b,null))[_0xa078('0x2f')](handleError(_0x4a3d4b,null));};exports['removeAgents']=function(_0x19cd0a,_0x248136,_0x3d243d){return db[_0xa078('0x44')][_0xa078('0x62')]({'where':{'id':_0x19cd0a['params']['id']}})[_0xa078('0x24')](handleEntityNotFound(_0x248136,null))[_0xa078('0x24')](function(_0x585a67){if(_0x585a67){return _0x585a67[_0xa078('0xbb')](_0x19cd0a[_0xa078('0x49')][_0xa078('0xb8')])[_0xa078('0x24')](function(){if(_[_0xa078('0xbc')](_0x19cd0a[_0xa078('0x49')]['ids'])){for(var _0x763cfd=0x0;_0x763cfd<_0x19cd0a[_0xa078('0x49')]['ids'][_0xa078('0x4f')];_0x763cfd+=0x1){socket[_0xa078('0xbd')](_0xa078('0xbe'),{'UserId':Number(_0x19cd0a['query']['ids'][_0x763cfd]),'OpenchannelAccountId':Number(_0x19cd0a[_0xa078('0x66')]['id'])});}}else{socket[_0xa078('0xbd')](_0xa078('0xbe'),{'UserId':Number(_0x19cd0a[_0xa078('0x49')][_0xa078('0xb8')]),'OpenchannelAccountId':Number(_0x19cd0a[_0xa078('0x66')]['id'])});}});}})[_0xa078('0x24')](respondWithStatusCode(_0x248136,null))[_0xa078('0x2f')](handleError(_0x248136,null));};exports['getAgents']=function(_0x8fa10f,_0x436e81,_0x51916a){var _0x311c2b={};var _0x86de65={};var _0x498f47;var _0x438287;return db[_0xa078('0x44')][_0xa078('0x6c')]({'where':{'id':_0x8fa10f[_0xa078('0x66')]['id']}})[_0xa078('0x24')](handleEntityNotFound(_0x436e81,null))[_0xa078('0x24')](function(_0x3fbb08){if(_0x3fbb08){_0x498f47=_0x3fbb08;_0x86de65[_0xa078('0x48')]=_[_0xa078('0x4a')](db['User'][_0xa078('0x5e')]);_0x86de65[_0xa078('0x49')]=_['keys'](_0x8fa10f[_0xa078('0x49')]);_0x86de65['filters']=_['intersection'](_0x86de65['model'],_0x86de65[_0xa078('0x49')]);_0x311c2b['attributes']=_[_0xa078('0x4c')](_0x86de65[_0xa078('0x48')],qs[_0xa078('0x4e')](_0x8fa10f[_0xa078('0x49')]['fields']));_0x311c2b[_0xa078('0x4d')]=_0x311c2b['attributes'][_0xa078('0x4f')]?_0x311c2b[_0xa078('0x4d')]:_0x86de65[_0xa078('0x48')];_0x311c2b['order']=qs['sort'](_0x8fa10f[_0xa078('0x49')][_0xa078('0x53')]);_0x311c2b[_0xa078('0x56')]=qs[_0xa078('0x4b')](_[_0xa078('0x54')](_0x8fa10f[_0xa078('0x49')],_0x86de65[_0xa078('0x4b')]));if(_0x8fa10f['query'][_0xa078('0x55')]){_0x311c2b[_0xa078('0x56')]=_[_0xa078('0x57')](_0x311c2b[_0xa078('0x56')],{'$or':_[_0xa078('0x43')](_0x311c2b[_0xa078('0x4d')],function(_0x2f15da){var _0x3d18cd={};_0x3d18cd[_0x2f15da]={'$like':'%'+_0x8fa10f[_0xa078('0x49')][_0xa078('0x55')]+'%'};return _0x3d18cd;})});}_0x311c2b=_[_0xa078('0x57')]({},_0x311c2b,_0x8fa10f[_0xa078('0x58')]);return _0x498f47[_0xa078('0xbf')](_0x311c2b);}})[_0xa078('0x24')](function(_0x52f79f){if(_0x52f79f){_0x438287=_0x52f79f[_0xa078('0x4f')];if(!_0x8fa10f[_0xa078('0x49')][_0xa078('0x50')](_0xa078('0x51'))){_0x311c2b[_0xa078('0x36')]=qs[_0xa078('0x36')](_0x8fa10f[_0xa078('0x49')][_0xa078('0x36')]);_0x311c2b[_0xa078('0x34')]=qs[_0xa078('0x34')](_0x8fa10f[_0xa078('0x49')][_0xa078('0x34')]);}return _0x498f47['getAgents'](_0x311c2b);}})['then'](function(_0x3513ff){if(_0x3513ff){return _0x3513ff?{'count':_0x438287,'rows':_0x3513ff}:null;}})[_0xa078('0x24')](respondWithResult(_0x436e81,null))['catch'](handleError(_0x436e81,null));};exports[_0xa078('0xb0')]=function(_0x308f4d,_0xa1d285,_0xedcef9){var _0x309bc8,_0x138c04,_0x3ac4f0;if(_[_0xa078('0x7a')](_0x308f4d[_0xa078('0x5f')][_0xa078('0x5f')])||_0x308f4d['body']['body']===''){throw new db[(_0xa078('0x7c'))][(_0xa078('0x75'))](_0xa078('0x7e'));}if(_[_0xa078('0x7a')](_0x308f4d[_0xa078('0x5f')]['to'])){}_0x309bc8=_0x308f4d['body']['to'];return db[_0xa078('0x44')][_0xa078('0x6c')]({'where':{'id':_0x308f4d['params']['id']}})[_0xa078('0x24')](handleEntityNotFound(_0xa1d285,null))[_0xa078('0x24')](function(_0x2d79ab){if(_0x2d79ab){return db[_0xa078('0x44')]['find']({'where':{'id':_0x2d79ab['id']},'include':[{'model':db[_0xa078('0x82')],'as':_0xa078('0x87'),'include':[{'model':db[_0xa078('0x74')],'as':'Contacts','where':{[_0x2d79ab[_0xa078('0x7f')]]:_0x309bc8},'limit':0x1,'order':[['updatedAt',_0xa078('0x84')]]}]}]})[_0xa078('0x24')](handleEntityNotFound(_0xa1d285,null))[_0xa078('0x24')](function(_0x4e2870){if(_0x4e2870&&_0x4e2870[_0xa078('0x87')]){_0x138c04=_0x4e2870[_0xa078('0x3d')]({'plain':!![]});if(_0x138c04[_0xa078('0x87')]&&_0x138c04[_0xa078('0x87')]['Contacts'][_0xa078('0x4f')]){return _0x138c04['List'][_0xa078('0x83')][0x0];}return db[_0xa078('0x74')][_0xa078('0x64')](_['defaults'](_0x308f4d['body'],{'firstName':_0x309bc8,[_0x4e2870[_0xa078('0x7f')]]:_0x309bc8,'phone':_0x309bc8,'ListId':_0x138c04[_0xa078('0x79')]}));}})['then'](handleEntityNotFound(_0xa1d285,null))['then'](function(_0x38550b){if(_0x38550b){_0x3ac4f0=_0x38550b;return db[_0xa078('0x93')]['find']({'where':{'ContactId':_0x3ac4f0['id'],'closed':![],'OpenchannelAccountId':_0x138c04['id']}})[_0xa078('0x24')](function(_0x25d589){if(_0x25d589){return[_0x25d589,![]];}return db[_0xa078('0x93')][_0xa078('0x64')]({'UserId':_0x308f4d['user']['id'],'ContactId':_0x3ac4f0['id'],'OpenchannelAccountId':_0x138c04['id'],'lastMsgDirection':'out','firstMsgDirection':'out','Messages':[_[_0xa078('0x57')](_0x308f4d[_0xa078('0x5f')],{'read':![],'body':_0x308f4d['body'][_0xa078('0x5f')],'OpenchannelAccountId':_0x138c04['id'],'UserId':_0x308f4d['user']['id'],'ContactId':_0x3ac4f0['id']})]},{'include':[{'model':db[_0xa078('0xc0')],'as':'Messages'}]})['then'](function(_0x922689){return[_0x922689,!![]];});});}})['spread'](function(_0x14e1ff,_0x4bdd40){if(_0x4bdd40){return _0x14e1ff;}return db[_0xa078('0xc0')][_0xa078('0x64')](_[_0xa078('0x57')](_0x308f4d[_0xa078('0x5f')],{'read':![],'body':_0x308f4d['body'][_0xa078('0x5f')],'OpenchannelAccountId':_0x138c04['id'],'OpenchannelInteractionId':_0x14e1ff['id'],'UserId':_0x308f4d[_0xa078('0x60')]['id'],'ContactId':_0x3ac4f0['id']}))['then'](function(_0x556f22){_0x14e1ff[_0xa078('0xc1')][_0xa078('0xc2')]=[];_0x14e1ff[_0xa078('0xc1')]['Messages'][_0xa078('0xc3')](_0x556f22['dataValues']);return _0x14e1ff;});});}})[_0xa078('0x24')](respondWithResult(_0xa1d285,null))['catch'](handleError(_0xa1d285,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 9539381..0687a35 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 _0xb4e6=['update','remove','emit','hook','events','OpenchannelAccount','setMaxListeners','save'];(function(_0x395c24,_0x48d2cb){var _0x1d708b=function(_0x517a7b){while(--_0x517a7b){_0x395c24['push'](_0x395c24['shift']());}};_0x1d708b(++_0x48d2cb);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x1ebeea,_0x2f54f4){_0x1ebeea=_0x1ebeea-0x0;var _0x576465=_0xb4e6[_0x1ebeea];return _0x576465;};'use strict';var EventEmitter=require(_0x6b4e('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x6b4e('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x6b4e('0x2')](0x0);var events={'afterCreate':_0x6b4e('0x3'),'afterUpdate':_0x6b4e('0x4'),'afterDestroy':_0x6b4e('0x5')};function emitEvent(_0x31e8ad){return function(_0x1929b8,_0x52313b,_0x40da90){OpenchannelAccountEvents[_0x6b4e('0x6')](_0x31e8ad+':'+_0x1929b8['id'],_0x1929b8);OpenchannelAccountEvents[_0x6b4e('0x6')](_0x31e8ad,_0x1929b8);_0x40da90(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x6b4e('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x702d=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount'];(function(_0xcf089b,_0x5d2123){var _0x50c729=function(_0x32039b){while(--_0x32039b){_0xcf089b['push'](_0xcf089b['shift']());}};_0x50c729(++_0x5d2123);}(_0x702d,0x147));var _0xd702=function(_0x363c69,_0x1dc342){_0x363c69=_0x363c69-0x0;var _0x58d0ed=_0x702d[_0x363c69];return _0x58d0ed;};'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 diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 57e5bf4..e39c65c 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(_0x398061,_0x3c2973){var _0x4d89d9=function(_0x32082c){while(--_0x32082c){_0x398061['push'](_0x398061['shift']());}};_0x4d89d9(++_0x3c2973);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x4e7b54,_0x3158c5){var _0x241c93=function(_0x6b79a6){while(--_0x6b79a6){_0x4e7b54['push'](_0x4e7b54['shift']());}};_0x241c93(++_0x3158c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 30b2288..887011b 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 _0x174b=['localhost','socket.io-emitter','./openchannelAccount.socket','request','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults'];(function(_0xa7879c,_0x4dc1d9){var _0x576d61=function(_0x54d9f0){while(--_0x54d9f0){_0xa7879c['push'](_0xa7879c['shift']());}};_0x576d61(++_0x4dc1d9);}(_0x174b,0x19d));var _0xb174=function(_0xe1764e,_0x394910){_0xe1764e=_0xe1764e-0x0;var _0x2853db=_0x174b[_0xe1764e];return _0x2853db;};'use strict';var _=require(_0xb174('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb174('0x1'));var rs=require(_0xb174('0x2'));var fs=require('fs');var Redis=require(_0xb174('0x3'));var db=require(_0xb174('0x4'))['db'];var utils=require(_0xb174('0x5'));var logger=require(_0xb174('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb174('0x7'));var client=jayson[_0xb174('0x8')][_0xb174('0x9')]({'port':0x232a});config[_0xb174('0xa')]=_[_0xb174('0xb')](config[_0xb174('0xa')],{'host':_0xb174('0xc'),'port':0x18eb});var socket=require(_0xb174('0xd'))(new Redis(config[_0xb174('0xa')]));require(_0xb174('0xe'))['register'](socket);function respondWithRpcPromise(_0x84e738,_0x4b6dd6,_0x3a05e9){return new BPromise(function(_0x1a4775,_0x4dffab){return client[_0xb174('0xf')](_0x84e738,_0x3a05e9)['then'](function(_0x3fbd28){logger[_0xb174('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x4b6dd6,_0xb174('0x11'));logger[_0xb174('0x12')](_0xb174('0x13'),_0x4b6dd6,_0xb174('0x11'),JSON['stringify'](_0x3fbd28));if(_0x3fbd28[_0xb174('0x14')]){if(_0x3fbd28['error'][_0xb174('0x15')]===0x1f4){logger[_0xb174('0x14')](_0xb174('0x16'),_0x4b6dd6,_0x3fbd28[_0xb174('0x14')]['message']);return _0x4dffab(_0x3fbd28[_0xb174('0x14')][_0xb174('0x17')]);}logger[_0xb174('0x14')](_0xb174('0x16'),_0x4b6dd6,_0x3fbd28[_0xb174('0x14')][_0xb174('0x17')]);return _0x1a4775(_0x3fbd28['error']['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x4b6dd6,_0xb174('0x11'));_0x1a4775(_0x3fbd28['result'][_0xb174('0x17')]);}})[_0xb174('0x18')](function(_0x5ac337){logger[_0xb174('0x14')](_0xb174('0x16'),_0x4b6dd6,_0x5ac337);_0x4dffab(_0x5ac337);});});} \ No newline at end of file +var _0x131e=['info','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','./openchannelAccount.socket','request','then'];(function(_0x1a05dd,_0x295f93){var _0x395a6a=function(_0x1af5f3){while(--_0x1af5f3){_0x1a05dd['push'](_0x1a05dd['shift']());}};_0x395a6a(++_0x295f93);}(_0x131e,0x1ec));var _0xe131=function(_0x35d5ed,_0x4c2c3f){_0x35d5ed=_0x35d5ed-0x0;var _0x2bba37=_0x131e[_0x35d5ed];return _0x2bba37;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe131('0x0'));var rs=require(_0xe131('0x1'));var fs=require('fs');var Redis=require(_0xe131('0x2'));var db=require(_0xe131('0x3'))['db'];var utils=require(_0xe131('0x4'));var logger=require(_0xe131('0x5'))('rpc');var config=require(_0xe131('0x6'));var jayson=require(_0xe131('0x7'));var client=jayson[_0xe131('0x8')][_0xe131('0x9')]({'port':0x232a});config[_0xe131('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe131('0xa')]));require(_0xe131('0xb'))['register'](socket);function respondWithRpcPromise(_0xfdbf4c,_0x4e126a,_0x149011){return new BPromise(function(_0x18f749,_0x5ae4c1){return client[_0xe131('0xc')](_0xfdbf4c,_0x149011)[_0xe131('0xd')](function(_0x2438af){logger[_0xe131('0xe')]('OpenchannelAccount,\x20%s,\x20%s',_0x4e126a,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x4e126a,_0xe131('0xf'),JSON[_0xe131('0x10')](_0x2438af));if(_0x2438af[_0xe131('0x11')]){if(_0x2438af[_0xe131('0x11')][_0xe131('0x12')]===0x1f4){logger[_0xe131('0x11')](_0xe131('0x13'),_0x4e126a,_0x2438af[_0xe131('0x11')][_0xe131('0x14')]);return _0x5ae4c1(_0x2438af['error']['message']);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x4e126a,_0x2438af['error'][_0xe131('0x14')]);return _0x18f749(_0x2438af[_0xe131('0x11')][_0xe131('0x14')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x4e126a,_0xe131('0xf'));_0x18f749(_0x2438af[_0xe131('0x15')][_0xe131('0x14')]);}})[_0xe131('0x16')](function(_0x317200){logger[_0xe131('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x4e126a,_0x317200);_0x5ae4c1(_0x317200);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 22bfd1c..c0f51ea 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 _0xc36d=['update','emit','removeListener','register','openchannelAccount:','./openchannelAccount.events','save','remove'];(function(_0x6abcaf,_0x31fead){var _0x160419=function(_0x193c2a){while(--_0x193c2a){_0x6abcaf['push'](_0x6abcaf['shift']());}};_0x160419(++_0x31fead);}(_0xc36d,0x7d));var _0xdc36=function(_0x546895,_0xb414da){_0x546895=_0x546895-0x0;var _0x3b5a09=_0xc36d[_0x546895];return _0x3b5a09;};'use strict';var OpenchannelAccountEvents=require(_0xdc36('0x0'));var events=[_0xdc36('0x1'),_0xdc36('0x2'),_0xdc36('0x3')];function createListener(_0x471240,_0x2d5df5){return function(_0x4c42dd){_0x2d5df5[_0xdc36('0x4')](_0x471240,_0x4c42dd);};}function removeListener(_0x3431f9,_0x53ac17){return function(){OpenchannelAccountEvents[_0xdc36('0x5')](_0x3431f9,_0x53ac17);};}exports[_0xdc36('0x6')]=function(_0x186c58){for(var _0x11ad3b=0x0,_0x6e4753=events['length'];_0x11ad3b<_0x6e4753;_0x11ad3b++){var _0x20ba02=events[_0x11ad3b];var _0x456897=createListener(_0xdc36('0x7')+_0x20ba02,_0x186c58);OpenchannelAccountEvents['on'](_0x20ba02,_0x456897);}}; \ No newline at end of file +var _0x049e=['register','length','./openchannelAccount.events','save','update','emit'];(function(_0x41d8da,_0x5a349c){var _0x7884b1=function(_0x1c96f6){while(--_0x1c96f6){_0x41d8da['push'](_0x41d8da['shift']());}};_0x7884b1(++_0x5a349c);}(_0x049e,0x16a));var _0xe049=function(_0x28be72,_0x2b83af){_0x28be72=_0x28be72-0x0;var _0x46c5da=_0x049e[_0x28be72];return _0x46c5da;};'use strict';var OpenchannelAccountEvents=require(_0xe049('0x0'));var events=[_0xe049('0x1'),'remove',_0xe049('0x2')];function createListener(_0x47aa93,_0x155cb3){return function(_0x13cc6a){_0x155cb3[_0xe049('0x3')](_0x47aa93,_0x13cc6a);};}function removeListener(_0x4001a8,_0x2abd06){return function(){OpenchannelAccountEvents['removeListener'](_0x4001a8,_0x2abd06);};}exports[_0xe049('0x4')]=function(_0x196af2){for(var _0x22e8f5=0x0,_0x221a5f=events[_0xe049('0x5')];_0x22e8f5<_0x221a5f;_0x22e8f5++){var _0x17945b=events[_0x22e8f5];var _0x22abb2=createListener('openchannelAccount:'+_0x17945b,_0x196af2);OpenchannelAccountEvents['on'](_0x17945b,_0x22abb2);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 4937c8e..dcba0cb 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 _0x3696=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller'];(function(_0x2f94fd,_0x367f2c){var _0x223222=function(_0x3e5a12){while(--_0x3e5a12){_0x2f94fd['push'](_0x2f94fd['shift']());}};_0x223222(++_0x367f2c);}(_0x3696,0x15c));var _0x6369=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x3696[_0x24f31b];return _0x488401;};'use strict';var multer=require(_0x6369('0x0'));var util=require('util');var path=require(_0x6369('0x1'));var timeout=require(_0x6369('0x2'));var express=require(_0x6369('0x3'));var router=express[_0x6369('0x4')]();var fs_extra=require(_0x6369('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6369('0x6'));var config=require(_0x6369('0x7'));var controller=require(_0x6369('0x8'));router[_0x6369('0x9')]('/',auth[_0x6369('0xa')](),controller[_0x6369('0xb')]);router[_0x6369('0x9')](_0x6369('0xc'),auth['isAuthenticated'](),controller[_0x6369('0xd')]);router[_0x6369('0xe')]('/',auth[_0x6369('0xa')](),controller[_0x6369('0xf')]);router[_0x6369('0x10')](_0x6369('0xc'),auth[_0x6369('0xa')](),controller[_0x6369('0x11')]);router[_0x6369('0x12')](_0x6369('0xc'),auth[_0x6369('0xa')](),controller[_0x6369('0x13')]);module[_0x6369('0x14')]=router; \ No newline at end of file +var _0x6a51=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy'];(function(_0x13ed01,_0x380d36){var _0x4769e0=function(_0x18e09a){while(--_0x18e09a){_0x13ed01['push'](_0x13ed01['shift']());}};_0x4769e0(++_0x380d36);}(_0x6a51,0x17d));var _0x16a5=function(_0xbebf50,_0x44ec09){_0xbebf50=_0xbebf50-0x0;var _0xce1496=_0x6a51[_0xbebf50];return _0xce1496;};'use strict';var multer=require(_0x16a5('0x0'));var util=require(_0x16a5('0x1'));var path=require('path');var timeout=require(_0x16a5('0x2'));var express=require('express');var router=express[_0x16a5('0x3')]();var fs_extra=require(_0x16a5('0x4'));var auth=require(_0x16a5('0x5'));var interaction=require(_0x16a5('0x6'));var config=require(_0x16a5('0x7'));var controller=require(_0x16a5('0x8'));router[_0x16a5('0x9')]('/',auth[_0x16a5('0xa')](),controller[_0x16a5('0xb')]);router[_0x16a5('0x9')](_0x16a5('0xc'),auth['isAuthenticated'](),controller[_0x16a5('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x16a5('0xe')]);router[_0x16a5('0xf')](_0x16a5('0xc'),auth[_0x16a5('0xa')](),controller['update']);router[_0x16a5('0x10')](_0x16a5('0xc'),auth[_0x16a5('0xa')](),controller[_0x16a5('0x11')]);module[_0x16a5('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 234f191..d6396e0 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 _0x9156=['*,*,*,*','sequelize','exports','INTEGER','noop','TEXT','STRING'];(function(_0x55ec31,_0x3f1d64){var _0x47a20e=function(_0x312d99){while(--_0x312d99){_0x55ec31['push'](_0x55ec31['shift']());}};_0x47a20e(++_0x3f1d64);}(_0x9156,0xa9));var _0x6915=function(_0x49fc2c,_0x25a95c){_0x49fc2c=_0x49fc2c-0x0;var _0x23ebab=_0x9156[_0x49fc2c];return _0x23ebab;};'use strict';var Sequelize=require(_0x6915('0x0'));module[_0x6915('0x1')]={'priority':{'type':Sequelize[_0x6915('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6915('0x3')},'appdata':{'type':Sequelize[_0x6915('0x4')]()},'description':{'type':Sequelize[_0x6915('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x6915('0x6')}}; \ No newline at end of file +var _0x3f0d=['sequelize','exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x1b7edd,_0x4da46f){var _0x3a1f8d=function(_0x570aea){while(--_0x570aea){_0x1b7edd['push'](_0x1b7edd['shift']());}};_0x3a1f8d(++_0x4da46f);}(_0x3f0d,0x144));var _0xd3f0=function(_0x1b5e3b,_0x154984){_0x1b5e3b=_0x1b5e3b-0x0;var _0x9d910d=_0x3f0d[_0x1b5e3b];return _0x9d910d;};'use strict';var Sequelize=require(_0xd3f0('0x0'));module[_0xd3f0('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd3f0('0x2')],'allowNull':![],'defaultValue':_0xd3f0('0x3')},'appdata':{'type':Sequelize[_0xd3f0('0x4')]()},'description':{'type':Sequelize[_0xd3f0('0x2')]},'interval':{'type':Sequelize[_0xd3f0('0x2')],'defaultValue':_0xd3f0('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 68635b8..58d5c98 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 _0x1483=['desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','limit','count','offset','set','Content-Range','update','then','destroy','error','send','OpenchannelApplication','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','include','create','body','find','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x5d30b4,_0x199248){var _0x1acfb8=function(_0x3544b2){while(--_0x3544b2){_0x5d30b4['push'](_0x5d30b4['shift']());}};_0x1acfb8(++_0x199248);}(_0x1483,0x149));var _0x3148=function(_0x39efbf,_0x118364){_0x39efbf=_0x39efbf-0x0;var _0xcbd510=_0x1483[_0x39efbf];return _0xcbd510;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3148('0x0'));var rp=require(_0x3148('0x1'));var moment=require('moment');var BPromise=require(_0x3148('0x2'));var Mustache=require('mustache');var util=require(_0x3148('0x3'));var path=require(_0x3148('0x4'));var sox=require(_0x3148('0x5'));var csv=require('to-csv');var ejs=require(_0x3148('0x6'));var fs=require('fs');var fs_extra=require(_0x3148('0x7'));var _=require(_0x3148('0x8'));var squel=require(_0x3148('0x9'));var crypto=require('crypto');var jsforce=require(_0x3148('0xa'));var deskjs=require(_0x3148('0xb'));var toCsv=require(_0x3148('0xc'));var querystring=require('querystring');var Papa=require(_0x3148('0xd'));var Redis=require(_0x3148('0xe'));var authService=require(_0x3148('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3148('0x10'));var hardwareService=require(_0x3148('0x11'));var logger=require(_0x3148('0x12'))(_0x3148('0x13'));var utils=require(_0x3148('0x14'));var config=require(_0x3148('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25063f,_0x4e0a8f){_0x4e0a8f=_0x4e0a8f||0xcc;return function(_0x1585f6){if(_0x1585f6){return _0x25063f[_0x3148('0x16')](_0x4e0a8f);}return _0x25063f['status'](_0x4e0a8f)[_0x3148('0x17')]();};}function respondWithResult(_0x45ae13,_0x3a5104){_0x3a5104=_0x3a5104||0xc8;return function(_0x150531){if(_0x150531){return _0x45ae13[_0x3148('0x18')](_0x3a5104)[_0x3148('0x19')](_0x150531);}};}function respondWithFilteredResult(_0x227050,_0x1e99eb){return function(_0x5e8439){if(_0x5e8439){var _0xc6030f=typeof _0x1e99eb['offset']==='undefined'&&typeof _0x1e99eb[_0x3148('0x1a')]==='undefined';var _0x29d0cd=_0x5e8439[_0x3148('0x1b')];var _0x43f4bc=_0xc6030f?0x0:_0x1e99eb[_0x3148('0x1c')];var _0x4ccaaa=_0xc6030f?_0x5e8439[_0x3148('0x1b')]:_0x1e99eb[_0x3148('0x1c')]+_0x1e99eb['limit'];var _0x34f66d;if(_0x4ccaaa>=_0x29d0cd){_0x4ccaaa=_0x29d0cd;_0x34f66d=0xc8;}else{_0x34f66d=0xce;}_0x227050[_0x3148('0x18')](_0x34f66d);return _0x227050[_0x3148('0x1d')](_0x3148('0x1e'),_0x43f4bc+'-'+_0x4ccaaa+'/'+_0x29d0cd)[_0x3148('0x19')](_0x5e8439);}return null;};}function patchUpdates(_0x178e3a){return function(_0x3ea61d){try{jsonpatch['apply'](_0x3ea61d,_0x178e3a,!![]);}catch(_0x5c1a9e){return BPromise['reject'](_0x5c1a9e);}return _0x3ea61d['save']();};}function saveUpdates(_0xf63a0e,_0x5bfe97){return function(_0x17d216){if(_0x17d216){return _0x17d216[_0x3148('0x1f')](_0xf63a0e)[_0x3148('0x20')](function(_0x3644dc){return _0x3644dc;});}return null;};}function removeEntity(_0x55645c,_0x14e401){return function(_0x558b2a){if(_0x558b2a){return _0x558b2a[_0x3148('0x21')]()[_0x3148('0x20')](function(){_0x55645c[_0x3148('0x18')](0xcc)[_0x3148('0x17')]();});}};}function handleEntityNotFound(_0x4e32c9,_0x415cf1){return function(_0x5f0643){if(!_0x5f0643){_0x4e32c9[_0x3148('0x16')](0x194);}return _0x5f0643;};}function handleError(_0x1b4e56,_0x64ba7f){_0x64ba7f=_0x64ba7f||0x1f4;return function(_0x502b75){logger[_0x3148('0x22')](_0x502b75['stack']);if(_0x502b75['name']){delete _0x502b75['name'];}_0x1b4e56[_0x3148('0x18')](_0x64ba7f)[_0x3148('0x23')](_0x502b75);};}exports['index']=function(_0x479319,_0x1d4470){var _0x4e07cb={},_0x58f35c={},_0x170bef={'count':0x0,'rows':[]};var _0x3370e9=_['map'](db[_0x3148('0x24')][_0x3148('0x25')],function(_0xbe705d){return{'name':_0xbe705d[_0x3148('0x26')],'type':_0xbe705d[_0x3148('0x27')][_0x3148('0x28')]};});_0x58f35c[_0x3148('0x29')]=_[_0x3148('0x2a')](_0x3370e9,_0x3148('0x2b'));_0x58f35c[_0x3148('0x2c')]=_[_0x3148('0x2d')](_0x479319[_0x3148('0x2c')]);_0x58f35c[_0x3148('0x2e')]=_[_0x3148('0x2f')](_0x58f35c[_0x3148('0x29')],_0x58f35c[_0x3148('0x2c')]);_0x4e07cb[_0x3148('0x30')]=_[_0x3148('0x2f')](_0x58f35c[_0x3148('0x29')],qs['fields'](_0x479319['query'][_0x3148('0x31')]));_0x4e07cb[_0x3148('0x30')]=_0x4e07cb[_0x3148('0x30')][_0x3148('0x32')]?_0x4e07cb[_0x3148('0x30')]:_0x58f35c[_0x3148('0x29')];if(!_0x479319[_0x3148('0x2c')][_0x3148('0x33')](_0x3148('0x34'))){_0x4e07cb['limit']=qs['limit'](_0x479319['query'][_0x3148('0x1a')]);_0x4e07cb[_0x3148('0x1c')]=qs[_0x3148('0x1c')](_0x479319['query'][_0x3148('0x1c')]);}_0x4e07cb['order']=qs[_0x3148('0x35')](_0x479319[_0x3148('0x2c')][_0x3148('0x35')]);_0x4e07cb[_0x3148('0x36')]=qs[_0x3148('0x2e')](_[_0x3148('0x37')](_0x479319[_0x3148('0x2c')],_0x58f35c[_0x3148('0x2e')]),_0x3370e9);if(_0x479319[_0x3148('0x2c')][_0x3148('0x38')]){_0x4e07cb[_0x3148('0x36')]=_[_0x3148('0x39')](_0x4e07cb[_0x3148('0x36')],{'$or':_[_0x3148('0x2a')](_0x3370e9,function(_0x260563){if(_0x260563[_0x3148('0x27')]!=='VIRTUAL'){var _0x4ced59={};_0x4ced59[_0x260563[_0x3148('0x2b')]]={'$like':'%'+_0x479319['query']['filter']+'%'};return _0x4ced59;}})});}_0x4e07cb=_['merge']({},_0x4e07cb,_0x479319[_0x3148('0x3a')]);var _0x3036e6={'where':_0x4e07cb[_0x3148('0x36')]};return db['OpenchannelApplication'][_0x3148('0x1b')](_0x3036e6)[_0x3148('0x20')](function(_0x198446){_0x170bef['count']=_0x198446;if(_0x479319[_0x3148('0x2c')][_0x3148('0x3b')]){_0x4e07cb['include']=[{'all':!![]}];}return db[_0x3148('0x24')][_0x3148('0x3c')](_0x4e07cb);})[_0x3148('0x20')](function(_0xea0b65){_0x170bef[_0x3148('0x3d')]=_0xea0b65;return _0x170bef;})['then'](respondWithFilteredResult(_0x1d4470,_0x4e07cb))[_0x3148('0x3e')](handleError(_0x1d4470,null));};exports['show']=function(_0x23c8f2,_0x4cce7f){var _0x2177a3={'raw':!![],'where':{'id':_0x23c8f2[_0x3148('0x3f')]['id']}},_0x58db3b={};_0x58db3b[_0x3148('0x29')]=_[_0x3148('0x2d')](db[_0x3148('0x24')]['rawAttributes']);_0x58db3b[_0x3148('0x2c')]=_[_0x3148('0x2d')](_0x23c8f2[_0x3148('0x2c')]);_0x58db3b[_0x3148('0x2e')]=_[_0x3148('0x2f')](_0x58db3b['model'],_0x58db3b['query']);_0x2177a3[_0x3148('0x30')]=_[_0x3148('0x2f')](_0x58db3b['model'],qs[_0x3148('0x31')](_0x23c8f2[_0x3148('0x2c')][_0x3148('0x31')]));_0x2177a3[_0x3148('0x30')]=_0x2177a3[_0x3148('0x30')][_0x3148('0x32')]?_0x2177a3[_0x3148('0x30')]:_0x58db3b[_0x3148('0x29')];if(_0x23c8f2[_0x3148('0x2c')][_0x3148('0x3b')]){_0x2177a3[_0x3148('0x40')]=[{'all':!![]}];}_0x2177a3=_[_0x3148('0x39')]({},_0x2177a3,_0x23c8f2[_0x3148('0x3a')]);return db[_0x3148('0x24')]['find'](_0x2177a3)[_0x3148('0x20')](handleEntityNotFound(_0x4cce7f,null))[_0x3148('0x20')](respondWithResult(_0x4cce7f,null))['catch'](handleError(_0x4cce7f,null));};exports[_0x3148('0x41')]=function(_0x499c8b,_0x4dc059){return db[_0x3148('0x24')][_0x3148('0x41')](_0x499c8b['body'],{})['then'](respondWithResult(_0x4dc059,0xc9))[_0x3148('0x3e')](handleError(_0x4dc059,null));};exports[_0x3148('0x1f')]=function(_0x218d99,_0x2f76b1){if(_0x218d99['body']['id']){delete _0x218d99[_0x3148('0x42')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x218d99[_0x3148('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2f76b1,null))[_0x3148('0x20')](saveUpdates(_0x218d99[_0x3148('0x42')],null))[_0x3148('0x20')](respondWithResult(_0x2f76b1,null))['catch'](handleError(_0x2f76b1,null));};exports[_0x3148('0x21')]=function(_0x1c8f34,_0x91a8c6){return db[_0x3148('0x24')][_0x3148('0x43')]({'where':{'id':_0x1c8f34[_0x3148('0x3f')]['id']}})[_0x3148('0x20')](handleEntityNotFound(_0x91a8c6,null))[_0x3148('0x20')](removeEntity(_0x91a8c6,null))[_0x3148('0x3e')](handleError(_0x91a8c6,null));}; \ No newline at end of file +var _0x3ce4=['sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','keys','query','attributes','fields','length','hasOwnProperty','offset','sort','where','filters','filter','merge','VIRTUAL','then','includeAll','include','OpenchannelApplication','rows','catch','params','intersection','options','find','create','body','rimraf','fast-json-patch','util','path','sox','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x3ce4,0x18a));var _0x43ce=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x3ce4[_0x1a9204];return _0x17ca68;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x43ce('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x43ce('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x43ce('0x2'));var path=require(_0x43ce('0x3'));var sox=require(_0x43ce('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x43ce('0x5'));var squel=require(_0x43ce('0x6'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x43ce('0x7'));var toCsv=require(_0x43ce('0x8'));var querystring=require(_0x43ce('0x9'));var Papa=require('papaparse');var Redis=require(_0x43ce('0xa'));var authService=require(_0x43ce('0xb'));var qs=require(_0x43ce('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43ce('0xd'));var logger=require(_0x43ce('0xe'))(_0x43ce('0xf'));var utils=require(_0x43ce('0x10'));var config=require(_0x43ce('0x11'));var licenseUtil=require(_0x43ce('0x12'));var db=require(_0x43ce('0x13'))['db'];function respondWithStatusCode(_0x540f71,_0x555b06){_0x555b06=_0x555b06||0xcc;return function(_0x57d4cd){if(_0x57d4cd){return _0x540f71[_0x43ce('0x14')](_0x555b06);}return _0x540f71['status'](_0x555b06)['end']();};}function respondWithResult(_0x1dfed9,_0x58798d){_0x58798d=_0x58798d||0xc8;return function(_0x1254f3){if(_0x1254f3){return _0x1dfed9[_0x43ce('0x15')](_0x58798d)[_0x43ce('0x16')](_0x1254f3);}};}function respondWithFilteredResult(_0x2c13c6,_0x2940a5){return function(_0x1d2278){if(_0x1d2278){var _0x4c9dfc=typeof _0x2940a5['offset']===_0x43ce('0x17')&&typeof _0x2940a5[_0x43ce('0x18')]===_0x43ce('0x17');var _0x473d08=_0x1d2278[_0x43ce('0x19')];var _0x1f0f31=_0x4c9dfc?0x0:_0x2940a5['offset'];var _0x4bf486=_0x4c9dfc?_0x1d2278['count']:_0x2940a5['offset']+_0x2940a5[_0x43ce('0x18')];var _0x51e7b9;if(_0x4bf486>=_0x473d08){_0x4bf486=_0x473d08;_0x51e7b9=0xc8;}else{_0x51e7b9=0xce;}_0x2c13c6['status'](_0x51e7b9);return _0x2c13c6[_0x43ce('0x1a')](_0x43ce('0x1b'),_0x1f0f31+'-'+_0x4bf486+'/'+_0x473d08)[_0x43ce('0x16')](_0x1d2278);}return null;};}function patchUpdates(_0x15c06e){return function(_0x5ae66c){try{jsonpatch[_0x43ce('0x1c')](_0x5ae66c,_0x15c06e,!![]);}catch(_0x403f4d){return BPromise[_0x43ce('0x1d')](_0x403f4d);}return _0x5ae66c[_0x43ce('0x1e')]();};}function saveUpdates(_0x544f6e,_0x1a04e1){return function(_0x19b887){if(_0x19b887){return _0x19b887[_0x43ce('0x1f')](_0x544f6e)['then'](function(_0x2b4ce7){return _0x2b4ce7;});}return null;};}function removeEntity(_0x5016c8,_0x5da27d){return function(_0x13a47a){if(_0x13a47a){return _0x13a47a[_0x43ce('0x20')]()['then'](function(){_0x5016c8[_0x43ce('0x15')](0xcc)[_0x43ce('0x21')]();});}};}function handleEntityNotFound(_0x92406b,_0x2944f3){return function(_0x3d738c){if(!_0x3d738c){_0x92406b['sendStatus'](0x194);}return _0x3d738c;};}function handleError(_0x1e06f1,_0x56e666){_0x56e666=_0x56e666||0x1f4;return function(_0x524873){logger[_0x43ce('0x22')](_0x524873[_0x43ce('0x23')]);if(_0x524873[_0x43ce('0x24')]){delete _0x524873[_0x43ce('0x24')];}_0x1e06f1[_0x43ce('0x15')](_0x56e666)['send'](_0x524873);};}exports[_0x43ce('0x25')]=function(_0x26f17a,_0x20c256){var _0x3ca161={},_0x59b9bf={},_0x38e8c4={'count':0x0,'rows':[]};var _0x714715=_['map'](db['OpenchannelApplication'][_0x43ce('0x26')],function(_0x5f04ae){return{'name':_0x5f04ae[_0x43ce('0x27')],'type':_0x5f04ae[_0x43ce('0x28')][_0x43ce('0x29')]};});_0x59b9bf[_0x43ce('0x2a')]=_[_0x43ce('0x2b')](_0x714715,_0x43ce('0x24'));_0x59b9bf['query']=_[_0x43ce('0x2c')](_0x26f17a[_0x43ce('0x2d')]);_0x59b9bf['filters']=_['intersection'](_0x59b9bf[_0x43ce('0x2a')],_0x59b9bf[_0x43ce('0x2d')]);_0x3ca161[_0x43ce('0x2e')]=_['intersection'](_0x59b9bf[_0x43ce('0x2a')],qs[_0x43ce('0x2f')](_0x26f17a['query'][_0x43ce('0x2f')]));_0x3ca161[_0x43ce('0x2e')]=_0x3ca161[_0x43ce('0x2e')][_0x43ce('0x30')]?_0x3ca161[_0x43ce('0x2e')]:_0x59b9bf['model'];if(!_0x26f17a['query'][_0x43ce('0x31')]('nolimit')){_0x3ca161[_0x43ce('0x18')]=qs[_0x43ce('0x18')](_0x26f17a['query'][_0x43ce('0x18')]);_0x3ca161['offset']=qs[_0x43ce('0x32')](_0x26f17a[_0x43ce('0x2d')][_0x43ce('0x32')]);}_0x3ca161['order']=qs[_0x43ce('0x33')](_0x26f17a[_0x43ce('0x2d')][_0x43ce('0x33')]);_0x3ca161[_0x43ce('0x34')]=qs[_0x43ce('0x35')](_['pick'](_0x26f17a['query'],_0x59b9bf['filters']),_0x714715);if(_0x26f17a[_0x43ce('0x2d')][_0x43ce('0x36')]){_0x3ca161[_0x43ce('0x34')]=_[_0x43ce('0x37')](_0x3ca161['where'],{'$or':_[_0x43ce('0x2b')](_0x714715,function(_0x12ed0f){if(_0x12ed0f[_0x43ce('0x28')]!==_0x43ce('0x38')){var _0x36af31={};_0x36af31[_0x12ed0f[_0x43ce('0x24')]]={'$like':'%'+_0x26f17a[_0x43ce('0x2d')][_0x43ce('0x36')]+'%'};return _0x36af31;}})});}_0x3ca161=_[_0x43ce('0x37')]({},_0x3ca161,_0x26f17a['options']);var _0x3b01c0={'where':_0x3ca161['where']};return db['OpenchannelApplication'][_0x43ce('0x19')](_0x3b01c0)[_0x43ce('0x39')](function(_0x43ec97){_0x38e8c4['count']=_0x43ec97;if(_0x26f17a['query'][_0x43ce('0x3a')]){_0x3ca161[_0x43ce('0x3b')]=[{'all':!![]}];}return db[_0x43ce('0x3c')]['findAll'](_0x3ca161);})[_0x43ce('0x39')](function(_0x578fd0){_0x38e8c4[_0x43ce('0x3d')]=_0x578fd0;return _0x38e8c4;})[_0x43ce('0x39')](respondWithFilteredResult(_0x20c256,_0x3ca161))[_0x43ce('0x3e')](handleError(_0x20c256,null));};exports['show']=function(_0x312589,_0x37327c){var _0x14fc9f={'raw':!![],'where':{'id':_0x312589[_0x43ce('0x3f')]['id']}},_0xe25568={};_0xe25568[_0x43ce('0x2a')]=_[_0x43ce('0x2c')](db['OpenchannelApplication'][_0x43ce('0x26')]);_0xe25568[_0x43ce('0x2d')]=_[_0x43ce('0x2c')](_0x312589[_0x43ce('0x2d')]);_0xe25568[_0x43ce('0x35')]=_[_0x43ce('0x40')](_0xe25568[_0x43ce('0x2a')],_0xe25568[_0x43ce('0x2d')]);_0x14fc9f[_0x43ce('0x2e')]=_['intersection'](_0xe25568[_0x43ce('0x2a')],qs['fields'](_0x312589['query'][_0x43ce('0x2f')]));_0x14fc9f[_0x43ce('0x2e')]=_0x14fc9f[_0x43ce('0x2e')][_0x43ce('0x30')]?_0x14fc9f[_0x43ce('0x2e')]:_0xe25568[_0x43ce('0x2a')];if(_0x312589[_0x43ce('0x2d')][_0x43ce('0x3a')]){_0x14fc9f[_0x43ce('0x3b')]=[{'all':!![]}];}_0x14fc9f=_[_0x43ce('0x37')]({},_0x14fc9f,_0x312589[_0x43ce('0x41')]);return db[_0x43ce('0x3c')][_0x43ce('0x42')](_0x14fc9f)[_0x43ce('0x39')](handleEntityNotFound(_0x37327c,null))[_0x43ce('0x39')](respondWithResult(_0x37327c,null))['catch'](handleError(_0x37327c,null));};exports[_0x43ce('0x43')]=function(_0x17a5ef,_0x4a3482){return db[_0x43ce('0x3c')][_0x43ce('0x43')](_0x17a5ef[_0x43ce('0x44')],{})[_0x43ce('0x39')](respondWithResult(_0x4a3482,0xc9))[_0x43ce('0x3e')](handleError(_0x4a3482,null));};exports[_0x43ce('0x1f')]=function(_0x47f5ca,_0x3adcd0){if(_0x47f5ca[_0x43ce('0x44')]['id']){delete _0x47f5ca[_0x43ce('0x44')]['id'];}return db[_0x43ce('0x3c')][_0x43ce('0x42')]({'where':{'id':_0x47f5ca[_0x43ce('0x3f')]['id']}})[_0x43ce('0x39')](handleEntityNotFound(_0x3adcd0,null))[_0x43ce('0x39')](saveUpdates(_0x47f5ca['body'],null))[_0x43ce('0x39')](respondWithResult(_0x3adcd0,null))[_0x43ce('0x3e')](handleError(_0x3adcd0,null));};exports[_0x43ce('0x20')]=function(_0x535112,_0x26c6c4){return db[_0x43ce('0x3c')]['find']({'where':{'id':_0x535112['params']['id']}})['then'](handleEntityNotFound(_0x26c6c4,null))[_0x43ce('0x39')](removeEntity(_0x26c6c4,null))[_0x43ce('0x3e')](handleError(_0x26c6c4,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 69fcc8f..44c33bb 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 _0xccfb=['utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications'];(function(_0xb5120,_0x304bc2){var _0x329847=function(_0x4e6846){while(--_0x4e6846){_0xb5120['push'](_0xb5120['shift']());}};_0x329847(++_0x304bc2);}(_0xccfb,0x1ed));var _0xbccf=function(_0x74594c,_0x15bdc4){_0x74594c=_0x74594c-0x0;var _0x5164a9=_0xccfb[_0x74594c];return _0x5164a9;};'use strict';var _=require(_0xbccf('0x0'));var util=require(_0xbccf('0x1'));var logger=require(_0xbccf('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbccf('0x3'));var rp=require(_0xbccf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbccf('0x5'));var config=require(_0xbccf('0x6'));var attributes=require(_0xbccf('0x7'));module[_0xbccf('0x8')]=function(_0x1a4e82,_0x5c3185){return _0x1a4e82[_0xbccf('0x9')]('OpenchannelApplication',attributes,{'tableName':_0xbccf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xbccf('0xb')});}; \ No newline at end of file +var _0x6337=['request-promise','path','rimraf','../../config/environment','exports','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird'];(function(_0x129b59,_0x5a33ee){var _0x44d106=function(_0x4301b5){while(--_0x4301b5){_0x129b59['push'](_0x129b59['shift']());}};_0x44d106(++_0x5a33ee);}(_0x6337,0xf8));var _0x7633=function(_0x49163f,_0x585238){_0x49163f=_0x49163f-0x0;var _0x1d3928=_0x6337[_0x49163f];return _0x1d3928;};'use strict';var _=require(_0x7633('0x0'));var util=require(_0x7633('0x1'));var logger=require(_0x7633('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7633('0x3'));var rp=require(_0x7633('0x4'));var fs=require('fs');var path=require(_0x7633('0x5'));var rimraf=require(_0x7633('0x6'));var config=require(_0x7633('0x7'));var attributes=require('./openchannelApplication.attributes');module[_0x7633('0x8')]=function(_0x4255c3,_0x5e2d69){return _0x4255c3['define'](_0x7633('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7633('0xa'),'collate':_0x7633('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 6b33bdf..bafd582 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 _0x893b=['options','raw','where','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body'];(function(_0x1997f7,_0x19cc05){var _0x533691=function(_0x18bbbf){while(--_0x18bbbf){_0x1997f7['push'](_0x1997f7['shift']());}};_0x533691(++_0x19cc05);}(_0x893b,0x1b6));var _0xb893=function(_0xb5adca,_0x315195){_0xb5adca=_0xb5adca-0x0;var _0x17dafc=_0x893b[_0xb5adca];return _0x17dafc;};'use strict';var _=require(_0xb893('0x0'));var util=require(_0xb893('0x1'));var moment=require(_0xb893('0x2'));var BPromise=require('bluebird');var rs=require(_0xb893('0x3'));var fs=require('fs');var Redis=require(_0xb893('0x4'));var db=require(_0xb893('0x5'))['db'];var utils=require(_0xb893('0x6'));var logger=require(_0xb893('0x7'))('rpc');var config=require(_0xb893('0x8'));var jayson=require(_0xb893('0x9'));var client=jayson['client'][_0xb893('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x275697,_0x228e4c,_0x2ff0c3){return new BPromise(function(_0x313a7f,_0x441903){return client[_0xb893('0xb')](_0x275697,_0x2ff0c3)[_0xb893('0xc')](function(_0x38053c){logger[_0xb893('0xd')](_0xb893('0xe'),_0x228e4c,'request\x20sent');logger[_0xb893('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x228e4c,'request\x20sent',JSON[_0xb893('0x10')](_0x38053c));if(_0x38053c[_0xb893('0x11')]){if(_0x38053c['error'][_0xb893('0x12')]===0x1f4){logger[_0xb893('0x11')](_0xb893('0xe'),_0x228e4c,_0x38053c[_0xb893('0x11')][_0xb893('0x13')]);return _0x441903(_0x38053c[_0xb893('0x11')]['message']);}logger[_0xb893('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x228e4c,_0x38053c[_0xb893('0x11')][_0xb893('0x13')]);return _0x313a7f(_0x38053c[_0xb893('0x11')][_0xb893('0x13')]);}else{logger[_0xb893('0xd')](_0xb893('0xe'),_0x228e4c,_0xb893('0x14'));_0x313a7f(_0x38053c[_0xb893('0x15')][_0xb893('0x13')]);}})[_0xb893('0x16')](function(_0x106513){logger[_0xb893('0x11')](_0xb893('0xe'),_0x228e4c,_0x106513);_0x441903(_0x106513);});});}exports[_0xb893('0x17')]=function(_0xdf6cb8){var _0x3a94c0=this;return new Promise(function(_0x978400,_0x4e327f){return db[_0xb893('0x18')][_0xb893('0x19')](_0xdf6cb8[_0xb893('0x1a')],{'raw':_0xdf6cb8[_0xb893('0x1b')]?_0xdf6cb8['options'][_0xb893('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdf6cb8[_0xb893('0x1b')]?_0xdf6cb8[_0xb893('0x1b')][_0xb893('0x1d')]||null:null,'attributes':_0xdf6cb8['options']?_0xdf6cb8[_0xb893('0x1b')][_0xb893('0x1e')]||null:null,'limit':_0xdf6cb8['options']?_0xdf6cb8[_0xb893('0x1b')]['limit']||null:null})['then'](function(_0x58093a){logger[_0xb893('0xd')](_0xb893('0x17'),_0xdf6cb8);logger['debug']('UpdateOpenchannelApplication',_0xdf6cb8,JSON[_0xb893('0x10')](_0x58093a));_0x978400(_0x58093a);})[_0xb893('0x16')](function(_0x1e1cc1){logger[_0xb893('0x11')](_0xb893('0x17'),_0x1e1cc1['message'],_0xdf6cb8);_0x4e327f(_0x3a94c0[_0xb893('0x11')](0x1f4,_0x1e1cc1[_0xb893('0x13')]));});});}; \ No newline at end of file +var _0x52ae=['result','catch','OpenchannelApplication','update','options','raw','where','attributes','limit','UpdateOpenchannelApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelApplication,\x20%s,\x20%s'];(function(_0x436add,_0x368cf0){var _0x413ba6=function(_0x1a30d7){while(--_0x1a30d7){_0x436add['push'](_0x436add['shift']());}};_0x413ba6(++_0x368cf0);}(_0x52ae,0x16a));var _0xe52a=function(_0x594ece,_0x2a1f27){_0x594ece=_0x594ece-0x0;var _0x471bc4=_0x52ae[_0x594ece];return _0x471bc4;};'use strict';var _=require(_0xe52a('0x0'));var util=require(_0xe52a('0x1'));var moment=require(_0xe52a('0x2'));var BPromise=require(_0xe52a('0x3'));var rs=require(_0xe52a('0x4'));var fs=require('fs');var Redis=require(_0xe52a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe52a('0x6'));var logger=require('../../config/logger')(_0xe52a('0x7'));var config=require(_0xe52a('0x8'));var jayson=require(_0xe52a('0x9'));var client=jayson[_0xe52a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35b263,_0xcbc6ec,_0x73194c){return new BPromise(function(_0x31d60a,_0x17122b){return client[_0xe52a('0xb')](_0x35b263,_0x73194c)[_0xe52a('0xc')](function(_0x3f68e0){logger[_0xe52a('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0xcbc6ec,_0xe52a('0xe'));logger[_0xe52a('0xf')](_0xe52a('0x10'),_0xcbc6ec,_0xe52a('0xe'),JSON[_0xe52a('0x11')](_0x3f68e0));if(_0x3f68e0[_0xe52a('0x12')]){if(_0x3f68e0[_0xe52a('0x12')][_0xe52a('0x13')]===0x1f4){logger[_0xe52a('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0xcbc6ec,_0x3f68e0[_0xe52a('0x12')][_0xe52a('0x14')]);return _0x17122b(_0x3f68e0[_0xe52a('0x12')][_0xe52a('0x14')]);}logger[_0xe52a('0x12')](_0xe52a('0x15'),_0xcbc6ec,_0x3f68e0[_0xe52a('0x12')][_0xe52a('0x14')]);return _0x31d60a(_0x3f68e0[_0xe52a('0x12')][_0xe52a('0x14')]);}else{logger[_0xe52a('0xd')](_0xe52a('0x15'),_0xcbc6ec,'request\x20sent');_0x31d60a(_0x3f68e0[_0xe52a('0x16')]['message']);}})[_0xe52a('0x17')](function(_0x536dd2){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0xcbc6ec,_0x536dd2);_0x17122b(_0x536dd2);});});}exports['UpdateOpenchannelApplication']=function(_0x740e6b){var _0x524794=this;return new Promise(function(_0x602f03,_0xe7807f){return db[_0xe52a('0x18')][_0xe52a('0x19')](_0x740e6b['body'],{'raw':_0x740e6b[_0xe52a('0x1a')]?_0x740e6b['options'][_0xe52a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x740e6b['options']?_0x740e6b[_0xe52a('0x1a')][_0xe52a('0x1c')]||null:null,'attributes':_0x740e6b[_0xe52a('0x1a')]?_0x740e6b[_0xe52a('0x1a')][_0xe52a('0x1d')]||null:null,'limit':_0x740e6b[_0xe52a('0x1a')]?_0x740e6b[_0xe52a('0x1a')][_0xe52a('0x1e')]||null:null})[_0xe52a('0xc')](function(_0x1895a8){logger[_0xe52a('0xd')]('UpdateOpenchannelApplication',_0x740e6b);logger[_0xe52a('0xf')](_0xe52a('0x1f'),_0x740e6b,JSON['stringify'](_0x1895a8));_0x602f03(_0x1895a8);})[_0xe52a('0x17')](function(_0x135dc5){logger[_0xe52a('0x12')]('UpdateOpenchannelApplication',_0x135dc5[_0xe52a('0x14')],_0x740e6b);_0xe7807f(_0x524794[_0xe52a('0x12')](0x1f4,_0x135dc5['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index b7ea920..0718d48 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 _0x683a=['getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','/:id/messages'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x683a,0x166));var _0xa683=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x683a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa683('0x0'));var util=require(_0xa683('0x1'));var path=require(_0xa683('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa683('0x3')]();var fs_extra=require(_0xa683('0x4'));var auth=require(_0xa683('0x5'));var interaction=require(_0xa683('0x6'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0xa683('0x7')]('/',auth[_0xa683('0x8')](),controller[_0xa683('0x9')]);router[_0xa683('0x7')](_0xa683('0xa'),auth[_0xa683('0x8')](),controller['describe']);router[_0xa683('0x7')](_0xa683('0xb'),auth[_0xa683('0x8')](),controller[_0xa683('0xc')]);router['get'](_0xa683('0xd'),auth[_0xa683('0x8')](),controller[_0xa683('0xe')]);router['get'](_0xa683('0xf'),auth['isAuthenticated'](),controller[_0xa683('0x10')]);router[_0xa683('0x11')]('/',auth[_0xa683('0x8')](),controller[_0xa683('0x12')]);router[_0xa683('0x11')](_0xa683('0xd'),auth[_0xa683('0x8')](),controller[_0xa683('0x13')]);router[_0xa683('0x11')](_0xa683('0x14'),auth[_0xa683('0x8')](),interaction[_0xa683('0x15')](_0xa683('0x16'),_0xa683('0x17')),controller[_0xa683('0x18')]);router[_0xa683('0x19')](_0xa683('0xb'),auth[_0xa683('0x8')](),interaction['tracked'](_0xa683('0x16'),'openchannelinteraction:update'),controller['update']);router[_0xa683('0x1a')](_0xa683('0xb'),auth[_0xa683('0x8')](),interaction[_0xa683('0x15')](_0xa683('0x16'),_0xa683('0x1b')),controller[_0xa683('0x1c')]);router[_0xa683('0x1a')](_0xa683('0x14'),auth[_0xa683('0x8')](),controller[_0xa683('0x1d')]);module[_0xa683('0x1e')]=router; \ No newline at end of file +var _0xee9c=['../../components/interaction/service','get','/describe','isAuthenticated','describe','show','/:id/messages','/:id/download','download','post','create','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','/:id','tracked','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','removeTags','exports','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2f6c25,_0xe26db){var _0x377275=function(_0x4b4d07){while(--_0x4b4d07){_0x2f6c25['push'](_0x2f6c25['shift']());}};_0x377275(++_0xe26db);}(_0xee9c,0x6f));var _0xcee9=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0xee9c[_0xbf8ebe];return _0x1e25e8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcee9('0x0'));var timeout=require(_0xcee9('0x1'));var express=require(_0xcee9('0x2'));var router=express[_0xcee9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcee9('0x4'));var interaction=require(_0xcee9('0x5'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0xcee9('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcee9('0x6')](_0xcee9('0x7'),auth[_0xcee9('0x8')](),controller[_0xcee9('0x9')]);router[_0xcee9('0x6')]('/:id',auth[_0xcee9('0x8')](),controller[_0xcee9('0xa')]);router[_0xcee9('0x6')](_0xcee9('0xb'),auth[_0xcee9('0x8')](),controller['getMessages']);router['get'](_0xcee9('0xc'),auth['isAuthenticated'](),controller[_0xcee9('0xd')]);router[_0xcee9('0xe')]('/',auth['isAuthenticated'](),controller[_0xcee9('0xf')]);router[_0xcee9('0xe')](_0xcee9('0xb'),auth[_0xcee9('0x8')](),controller['addMessage']);router[_0xcee9('0xe')](_0xcee9('0x10'),auth[_0xcee9('0x8')](),interaction['tracked'](_0xcee9('0x11'),_0xcee9('0x12')),controller[_0xcee9('0x13')]);router[_0xcee9('0x14')](_0xcee9('0x15'),auth[_0xcee9('0x8')](),interaction[_0xcee9('0x16')]('openchannel',_0xcee9('0x17')),controller[_0xcee9('0x18')]);router[_0xcee9('0x19')](_0xcee9('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0xcee9('0x11'),_0xcee9('0x1a')),controller['destroy']);router['delete'](_0xcee9('0x10'),auth[_0xcee9('0x8')](),controller[_0xcee9('0x1b')]);module[_0xcee9('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index cdfa7a8..d652927 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 _0x25e1=['out','INTEGER','sequelize','BOOLEAN','DATE','STRING','ENUM'];(function(_0x1bf5bf,_0x57beee){var _0x389acc=function(_0x46cf7a){while(--_0x46cf7a){_0x1bf5bf['push'](_0x1bf5bf['shift']());}};_0x389acc(++_0x57beee);}(_0x25e1,0x1d0));var _0x125e=function(_0x3e00e0,_0x40aba1){_0x3e00e0=_0x3e00e0-0x0;var _0x6930ef=_0x25e1[_0x3e00e0];return _0x6930ef;};'use strict';var Sequelize=require(_0x125e('0x0'));module['exports']={'closed':{'type':Sequelize[_0x125e('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x125e('0x2')]},'disposition':{'type':Sequelize[_0x125e('0x3')]},'secondDisposition':{'type':Sequelize[_0x125e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x125e('0x3')]},'note':{'type':Sequelize[_0x125e('0x3')]},'read1stAt':{'type':Sequelize[_0x125e('0x2')]},'threadId':{'type':Sequelize[_0x125e('0x3')]},'externalUrl':{'type':Sequelize[_0x125e('0x3')]},'lastMsgAt':{'type':Sequelize[_0x125e('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x125e('0x4')]('in',_0x125e('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x125e('0x4')]('in',_0x125e('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x125e('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x125e('0x6')]}}; \ No newline at end of file +var _0x60a5=['DATE','STRING','ENUM','BOOLEAN','INTEGER','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x60a5,0x83));var _0x560a=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x60a5[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0x560a('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x560a('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x560a('0x2')]},'note':{'type':Sequelize[_0x560a('0x2')]},'read1stAt':{'type':Sequelize[_0x560a('0x1')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x560a('0x2')]},'lastMsgAt':{'type':Sequelize[_0x560a('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x560a('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x560a('0x4')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x560a('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index ac6147e..2d2f01a 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 _0x309e=['join','attachments','format','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','lastName','Attachment','createdAt','direction','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','threadId','Public','Private','Messages','existsSync','pipe','createWriteStream','basename','out','System','secret','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','sendStatus','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','OpenchannelInteraction','fieldName','key','getOptions','findAll','openchannel','query','user','catch','show','from','params','keys','rawAttributes','filters','intersection','model','fields','attributes','includeAll','include','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','addTags','setTags','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','toString','root','server','files','tmp'];(function(_0x488a6b,_0xbe0e76){var _0x27e75c=function(_0x5040a0){while(--_0x5040a0){_0x488a6b['push'](_0x488a6b['shift']());}};_0x27e75c(++_0xbe0e76);}(_0x309e,0xb3));var _0xe309=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x309e[_0x279d37];return _0x530173;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xe309('0x0'));var moment=require(_0xe309('0x1'));var util=require(_0xe309('0x2'));var path=require(_0xe309('0x3'));var ejs=require(_0xe309('0x4'));var fs=require('fs');var _=require(_0xe309('0x5'));var Redis=require(_0xe309('0x6'));var interaction=require(_0xe309('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0xe309('0x8'));var logger=require(_0xe309('0x9'))(_0xe309('0xa'));var config=require(_0xe309('0xb'));var db=require('../../mysqldb')['db'];config[_0xe309('0xc')]=_[_0xe309('0xd')](config[_0xe309('0xc')],{'host':_0xe309('0xe'),'port':0x18eb});var socket=require(_0xe309('0xf'))(new Redis(config[_0xe309('0xc')]));require('./openchannelInteraction.socket')[_0xe309('0x10')](socket);function respondWithStatusCode(_0x4ff17c,_0x12924a){_0x12924a=_0x12924a||0xcc;return function(_0x19cd3a){if(_0x19cd3a){return _0x4ff17c['sendStatus'](_0x12924a);}return _0x4ff17c[_0xe309('0x11')](_0x12924a)[_0xe309('0x12')]();};}function respondWithResult(_0xd6f3b3,_0x39cb66){_0x39cb66=_0x39cb66||0xc8;return function(_0x28a4e6){if(_0x28a4e6){return _0xd6f3b3[_0xe309('0x11')](_0x39cb66)[_0xe309('0x13')](_0x28a4e6);}};}function respondWithFilteredResult(_0x22f24b,_0x39a8de){return function(_0x38b44f){if(_0x38b44f){var _0x52abb7=typeof _0x39a8de[_0xe309('0x14')]===_0xe309('0x15')&&typeof _0x39a8de[_0xe309('0x16')]==='undefined';var _0x3c360f=_0x38b44f[_0xe309('0x17')];var _0x3bd7c0=_0x52abb7?0x0:_0x39a8de[_0xe309('0x14')];var _0x54d855=_0x52abb7?_0x38b44f[_0xe309('0x17')]:_0x39a8de[_0xe309('0x14')]+_0x39a8de['limit'];var _0x2afc60;if(_0x54d855>=_0x3c360f){_0x54d855=_0x3c360f;_0x2afc60=0xc8;}else{_0x2afc60=0xce;}_0x22f24b[_0xe309('0x11')](_0x2afc60);return _0x22f24b[_0xe309('0x18')](_0xe309('0x19'),_0x3bd7c0+'-'+_0x54d855+'/'+_0x3c360f)[_0xe309('0x13')](_0x38b44f);}return null;};}function saveUpdates(_0xf2c0a2){return function(_0xa7ae3){if(_0xa7ae3){return _0xa7ae3[_0xe309('0x1a')](_0xf2c0a2)[_0xe309('0x1b')](function(_0x346f56){return _0x346f56;});}return null;};}function removeEntity(_0x233580){return function(_0x234b84){if(_0x234b84){return _0x234b84[_0xe309('0x1c')]()[_0xe309('0x1b')](function(){_0x233580['status'](0xcc)[_0xe309('0x12')]();});}};}function handleEntityNotFound(_0x58b6c3){return function(_0xf64684){if(!_0xf64684){_0x58b6c3['sendStatus'](0x194);}return _0xf64684;};}function handleError(_0x1fec15,_0x2d78f4){_0x2d78f4=_0x2d78f4||0x1f4;return function(_0xc052af){logger[_0xe309('0x1d')](_0xc052af[_0xe309('0x1e')]);if(_0xc052af[_0xe309('0x1f')]){delete _0xc052af['name'];}_0x1fec15[_0xe309('0x11')](_0x2d78f4)[_0xe309('0x20')](_0xc052af);};}exports[_0xe309('0x21')]=function(_0x58605a,_0x5d3d77){var _0x1e821e={};var _0x536af6=_[_0xe309('0x22')](db[_0xe309('0x23')]['rawAttributes'],function(_0x2797e4){return{'name':_0x2797e4[_0xe309('0x24')],'type':_0x2797e4['type'][_0xe309('0x25')]};});_0x1e821e=qs[_0xe309('0x26')](_0x536af6,_0x58605a);return interaction[_0xe309('0x27')](_0xe309('0x28'),_0x58605a[_0xe309('0x29')],_0x58605a[_0xe309('0x2a')],_0x1e821e,_0x536af6)[_0xe309('0x1b')](respondWithFilteredResult(_0x5d3d77,_0x1e821e))[_0xe309('0x2b')](handleError(_0x5d3d77,null));};exports[_0xe309('0x2c')]=function(_0x274778,_0x5683c9){var _0x1689d5={};if(_0x274778[_0xe309('0x29')]['type']&&_0x274778[_0xe309('0x29')]['type']===_0xe309('0x2d')){_0x1689d5['from']=_0x274778[_0xe309('0x2e')]['id'];}else{_0x1689d5['id']=_0x274778[_0xe309('0x2e')]['id'];}var _0x1255f4={'raw':![],'where':_0x1689d5},_0x14547d={};_0x14547d['model']=_[_0xe309('0x2f')](db[_0xe309('0x23')][_0xe309('0x30')]);_0x14547d['query']=_[_0xe309('0x2f')](_0x274778['query']);_0x14547d[_0xe309('0x31')]=_[_0xe309('0x32')](_0x14547d[_0xe309('0x33')],_0x14547d[_0xe309('0x29')]);_0x1255f4['attributes']=_[_0xe309('0x32')](_0x14547d[_0xe309('0x33')],qs[_0xe309('0x34')](_0x274778[_0xe309('0x29')][_0xe309('0x34')]));_0x1255f4[_0xe309('0x35')]=_0x1255f4['attributes']['length']?_0x1255f4['attributes']:_0x14547d[_0xe309('0x33')];if(_0x274778[_0xe309('0x29')][_0xe309('0x36')]){_0x1255f4[_0xe309('0x37')]=[{'all':!![]}];}_0x1255f4=_[_0xe309('0x38')]({},_0x1255f4,_0x274778[_0xe309('0x39')]);return db[_0xe309('0x23')][_0xe309('0x3a')](_0x1255f4)[_0xe309('0x1b')](handleEntityNotFound(_0x5683c9,null))[_0xe309('0x1b')](respondWithResult(_0x5683c9,null))[_0xe309('0x2b')](handleError(_0x5683c9,null));};exports['create']=function(_0xe9bb24,_0x42eb92){return db[_0xe309('0x23')][_0xe309('0x3b')](_0xe9bb24[_0xe309('0x3c')],{})['then'](respondWithResult(_0x42eb92,0xc9))['catch'](handleError(_0x42eb92,null));};exports[_0xe309('0x1a')]=function(_0xbda1da,_0xf3c250){if(_0xbda1da['body']['id']){delete _0xbda1da[_0xe309('0x3c')]['id'];}return db['OpenchannelInteraction'][_0xe309('0x3a')]({'where':{'id':_0xbda1da['params']['id']}})[_0xe309('0x1b')](handleEntityNotFound(_0xf3c250,null))['then'](saveUpdates(_0xbda1da[_0xe309('0x3c')],null))[_0xe309('0x1b')](respondWithResult(_0xf3c250,null))['catch'](handleError(_0xf3c250,null));};exports[_0xe309('0x1c')]=function(_0x3bb3ec,_0x5dbb5f){return db[_0xe309('0x23')]['find']({'where':{'id':_0x3bb3ec[_0xe309('0x2e')]['id']}})[_0xe309('0x1b')](handleEntityNotFound(_0x5dbb5f,null))[_0xe309('0x1b')](removeEntity(_0x5dbb5f,null))[_0xe309('0x2b')](handleError(_0x5dbb5f,null));};exports[_0xe309('0x3d')]=function(_0x4974a4,_0x3472d2){return db[_0xe309('0x23')][_0xe309('0x3d')]()['then'](respondWithResult(_0x3472d2,null))[_0xe309('0x2b')](handleError(_0x3472d2,null));};exports[_0xe309('0x3e')]=function(_0x2a7fd5,_0x25c66f){return db[_0xe309('0x3f')][_0xe309('0x3a')]({'where':{'id':_0x2a7fd5['params']['id']}})[_0xe309('0x1b')](handleEntityNotFound(_0x25c66f,null))[_0xe309('0x1b')](function(_0x278953){if(_0x278953){return _0x278953[_0xe309('0x3e')](_0x2a7fd5['body']['ids'],_['omit'](_0x2a7fd5['body'],[_0xe309('0x40'),'id'])||{});}})['then'](respondWithResult(_0x25c66f,null))[_0xe309('0x2b')](handleError(_0x25c66f,null));};exports[_0xe309('0x41')]=function(_0x9a8ec2,_0x422eed){var _0xbc8344={'raw':![],'where':{}};var _0x7e7096={};var _0x430904={'count':0x0,'rows':[]};return db[_0xe309('0x23')][_0xe309('0x42')]({'where':{'id':_0x9a8ec2[_0xe309('0x2e')]['id']}})['then'](handleEntityNotFound(_0x422eed,null))[_0xe309('0x1b')](function(_0x15d165){if(_0x15d165){_0x7e7096[_0xe309('0x33')]=_[_0xe309('0x2f')](db[_0xe309('0x3f')]['rawAttributes']);_0x7e7096['query']=_[_0xe309('0x2f')](_0x9a8ec2[_0xe309('0x29')]);_0x7e7096['filters']=_[_0xe309('0x32')](_0x7e7096[_0xe309('0x33')],_0x7e7096['query']);_0xbc8344['attributes']=_[_0xe309('0x32')](_0x7e7096[_0xe309('0x33')],qs[_0xe309('0x34')](_0x9a8ec2[_0xe309('0x29')][_0xe309('0x34')]));_0xbc8344[_0xe309('0x35')]=_0xbc8344[_0xe309('0x35')]['length']?_0xbc8344['attributes']:_0x7e7096['model'];if(!_0x9a8ec2['query'][_0xe309('0x43')](_0xe309('0x44'))){_0xbc8344[_0xe309('0x16')]=qs[_0xe309('0x16')](_0x9a8ec2['query'][_0xe309('0x16')]);_0xbc8344[_0xe309('0x14')]=qs['offset'](_0x9a8ec2[_0xe309('0x29')]['offset']);}_0xbc8344[_0xe309('0x45')]=qs[_0xe309('0x46')](_0x9a8ec2['query']['sort']);_0xbc8344[_0xe309('0x47')]=qs[_0xe309('0x31')](_[_0xe309('0x48')](_0x9a8ec2[_0xe309('0x29')],_0x7e7096[_0xe309('0x31')]));_0xbc8344['where']['OpenchannelInteractionId']=_0x15d165['id'];if(_0x9a8ec2[_0xe309('0x29')][_0xe309('0x49')]){_0xbc8344[_0xe309('0x47')]=_[_0xe309('0x38')](_0xbc8344[_0xe309('0x47')],{'$or':_['map'](_0xbc8344[_0xe309('0x35')],function(_0x19c836){var _0x464bdd={};_0x464bdd[_0x19c836]={'$like':'%'+_0x9a8ec2[_0xe309('0x29')][_0xe309('0x49')]+'%'};return _0x464bdd;})});}if(_0x9a8ec2['query']['$gte']){var _0x2fae51=_0x9a8ec2[_0xe309('0x29')][_0xe309('0x4a')][_0xe309('0x4b')](',');var _0x57f01c={};_0x57f01c[_0x2fae51[0x0]]={'$gte':moment(_0x2fae51[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0xbc8344[_0xe309('0x47')]=_[_0xe309('0x38')](_0xbc8344['where'],_0x57f01c);}_0xbc8344=_[_0xe309('0x38')]({},_0xbc8344,_0x9a8ec2[_0xe309('0x39')]);return db[_0xe309('0x3f')][_0xe309('0x17')]({'where':_0xbc8344['where']})[_0xe309('0x1b')](function(_0x2b06cf){_0x430904['count']=_0x2b06cf;if(_0x9a8ec2['query'][_0xe309('0x36')]){_0xbc8344[_0xe309('0x37')]=[{'all':!![]}];}return db[_0xe309('0x3f')][_0xe309('0x27')](_0xbc8344);})[_0xe309('0x1b')](function(_0x405131){_0x430904['rows']=_0x405131;return _0x430904;});}})[_0xe309('0x1b')](respondWithFilteredResult(_0x422eed,_0xbc8344))[_0xe309('0x2b')](handleError(_0x422eed,null));};exports[_0xe309('0x4c')]=function(_0x277842,_0x170f05){return db[_0xe309('0x23')]['find']({'where':{'id':_0x277842[_0xe309('0x2e')]['id']}})['then'](handleEntityNotFound(_0x170f05,null))['then'](function(_0x1569b9){if(_0x1569b9){return _0x1569b9[_0xe309('0x4d')](_0x277842[_0xe309('0x3c')][_0xe309('0x40')],_['omit'](_0x277842['body'],[_0xe309('0x40'),'id'])||{})[_0xe309('0x4e')](function(){return db[_0xe309('0x4f')][_0xe309('0x27')]({'attributes':['id',_0xe309('0x1f'),'color'],'where':{'id':_0x277842[_0xe309('0x3c')][_0xe309('0x40')]}});})[_0xe309('0x1b')](function(_0x2f23aa){socket[_0xe309('0x50')](_0xe309('0x51'),{'id':Number(_0x277842[_0xe309('0x2e')]['id']),'tags':_0x2f23aa||[]});return{'id':Number(_0x277842['params']['id']),'tags':_0x2f23aa||[]};});}})[_0xe309('0x1b')](respondWithResult(_0x170f05,null))[_0xe309('0x2b')](handleError(_0x170f05,null));};exports['removeTags']=function(_0x295402,_0x2f17c2){return db[_0xe309('0x23')][_0xe309('0x3a')]({'where':{'id':_0x295402['params']['id']}})['then'](handleEntityNotFound(_0x2f17c2,null))[_0xe309('0x1b')](function(_0x23ec52){if(_0x23ec52){return _0x23ec52[_0xe309('0x52')](_0x295402[_0xe309('0x29')][_0xe309('0x40')]);}})[_0xe309('0x1b')](respondWithStatusCode(_0x2f17c2,null))[_0xe309('0x2b')](handleError(_0x2f17c2,null));};exports[_0xe309('0x53')]=function(_0x327dcf,_0x4e36ba){var _0xa54413=moment()['unix']()[_0xe309('0x54')]();var _0x43bc7e=path['join'](config[_0xe309('0x55')],_0xe309('0x56'),_0xe309('0x57'),_0xe309('0x58'));var _0x5741a9=path[_0xe309('0x59')](config[_0xe309('0x55')],_0xe309('0x56'),_0xe309('0x57'),_0xe309('0x5a'));var _0x2e7fa8=path[_0xe309('0x59')](_0x43bc7e,_0xa54413);var _0x276e93=util[_0xe309('0x5b')](_0xe309('0x5c'),_0x327dcf[_0xe309('0x2e')]['id'],_0xa54413);var _0x2ac894=path[_0xe309('0x59')](_0x43bc7e,_0x276e93);var _0x43b9c8=[];_0x43b9c8['push']({'model':db[_0xe309('0x5d')],'as':'User','attributes':['id',_0xe309('0x5e')],'raw':!![]});_0x43b9c8[_0xe309('0x5f')]({'model':db[_0xe309('0x60')],'as':_0xe309('0x61'),'attributes':['id',_0xe309('0x62'),_0xe309('0x63')],'raw':!![]});if(_0x327dcf[_0xe309('0x29')][_0xe309('0x5a')]){_0x43b9c8['push']({'model':db[_0xe309('0x64')],'as':_0xe309('0x64'),'raw':!![]});}var _0x3ff805=[{'model':db[_0xe309('0x3f')],'as':'Messages','attributes':['id',_0xe309('0x3c'),_0xe309('0x65'),_0xe309('0x66'),'secret',_0xe309('0x67')],'include':_0x43b9c8}];_0x3ff805[_0xe309('0x5f')]({'model':db[_0xe309('0x68')],'as':_0xe309('0x69'),'attributes':['id',_0xe309('0x1f')]});_0x3ff805[_0xe309('0x5f')]({'model':db[_0xe309('0x5d')],'as':_0xe309('0x6a'),'attributes':['id',_0xe309('0x5e')]});return db[_0xe309('0x23')]['find']({'where':{'id':_0x327dcf[_0xe309('0x2e')]['id']},'include':_0x3ff805})[_0xe309('0x1b')](handleEntityNotFound(_0x4e36ba,null))[_0xe309('0x1b')](function(_0x2fd867){if(_0x2fd867){var _0x50d281=_0x2fd867[_0xe309('0x6b')]({'plain':!![]});fs[_0xe309('0x6c')](_0x2e7fa8);var _0x4f2b09={'channel':_0xe309('0x6d'),'account':_0x50d281[_0xe309('0x69')][_0xe309('0x1f')],'agent':_0x50d281[_0xe309('0x6a')]?_0x50d281[_0xe309('0x6a')]['fullname']:_0xe309('0x6e'),'createdAt':moment(_0x50d281[_0xe309('0x65')])[_0xe309('0x5b')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe309('0x54')](),'closedAt':_0x50d281[_0xe309('0x6f')]?moment(_0x50d281[_0xe309('0x70')])[_0xe309('0x5b')](_0xe309('0x71'))[_0xe309('0x54')]():'','disposition':_0x50d281[_0xe309('0x72')],'visibility':_0x50d281[_0xe309('0x73')]?_0xe309('0x74'):_0xe309('0x75'),'messages':_(_0x50d281[_0xe309('0x76')])[_0xe309('0x49')]({'secret':![]})[_0xe309('0x22')](function(_0x208c36){if(_0x208c36[_0xe309('0x64')]){var _0xe5ee9f=path[_0xe309('0x59')](_0x5741a9,_0x208c36[_0xe309('0x64')]['basename']);if(fs[_0xe309('0x77')](_0xe5ee9f)){fs['createReadStream'](_0xe5ee9f)[_0xe309('0x78')](fs[_0xe309('0x79')](path[_0xe309('0x59')](_0x2e7fa8,_0x208c36[_0xe309('0x64')][_0xe309('0x7a')])));}}return{'date':moment(_0x208c36[_0xe309('0x65')])[_0xe309('0x5b')](_0xe309('0x71'))[_0xe309('0x54')](),'sender':_0x208c36[_0xe309('0x66')]===_0xe309('0x7b')?_0x208c36[_0xe309('0x5d')]?_0x208c36[_0xe309('0x5d')][_0xe309('0x5e')]:_0xe309('0x7c'):_0x208c36[_0xe309('0x61')][_0xe309('0x62')]+(_0x208c36[_0xe309('0x61')][_0xe309('0x63')]?'\x20'+_0x208c36['Contact'][_0xe309('0x63')]:''),'body':_0x208c36['Attachment']?_0x208c36[_0xe309('0x64')]['basename']:_0x208c36[_0xe309('0x3c')],'direction':_0x208c36[_0xe309('0x66')]===_0xe309('0x7b')?'A':'C','secret':_0x208c36[_0xe309('0x7d')],'read':_0x208c36[_0xe309('0x67')],'attachment':_0x208c36[_0xe309('0x64')]};})['value']()};return ejs[_0xe309('0x7e')](path[_0xe309('0x59')](config[_0xe309('0x55')],_0xe309('0x56'),_0xe309('0x7f'),_0xe309('0x80')),{'interaction':_0x4f2b09})['then'](function(_0x4f18ce){var _0x31bc05=path[_0xe309('0x59')](_0x2e7fa8,_0xe309('0x81')+_0x50d281['id']+'-'+_0xa54413+_0xe309('0x82'));var _0x587e3d={'path':_0x31bc05,'channel':'Openchannel','interactionId':_0x50d281['id']};return pdf[_0xe309('0x83')](_0x4f18ce,_0x587e3d);})[_0xe309('0x1b')](function(){return new Promise(function(_0xad006a,_0x42d007){zipdir(_0x2e7fa8,{'saveTo':_0x2ac894},function(_0x3d9114,_0x5c4c36){if(_0x3d9114)return _0x42d007(_0x3d9114);return _0xad006a(_0x5c4c36);});})[_0xe309('0x1b')](function(){return new Promise(function(_0x1df950,_0x1d778a){rimraf(_0x2e7fa8,function(_0x2dc48e){if(_0x2dc48e)_0x1d778a(_0x2dc48e);return _0x1df950();});});})['then'](function(){return _0x4e36ba[_0xe309('0x53')](_0x2ac894,_0x276e93,function(_0x3200bc){if(_0x3200bc){logger['error']('Unable\x20to\x20delete\x20zip\x20file',_0x3200bc);}else{fs[_0xe309('0x84')](_0x2ac894);}});});});}else{return _0x4e36ba[_0xe309('0x85')](0xc8);}})['catch'](handleError(_0x4e36ba,null));}; \ No newline at end of file +var _0xe360=['fields','nolimit','order','sort','pick','filter','where','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','emit','removeTags','toString','join','server','files','tmp','attachments','transcript-%d-%s.zip','User','push','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Owner','fullname','get','mkdirSync','Account','N.A.','disposition','Public','Private','basename','createReadStream','out','value','renderFile','root','views','transcript-','.pdf','Openchannel','createPdfFromHTML','download','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','error','stack','name','send','OpenchannelInteraction','rawAttributes','key','getOptions','findAll','openchannel','query','catch','show','type','from','params','model','keys','attributes','intersection','length','includeAll','include','merge','options','create','body','destroy','find','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','filters'];(function(_0x5b06a3,_0x439059){var _0x561727=function(_0x536bbc){while(--_0x536bbc){_0x5b06a3['push'](_0x5b06a3['shift']());}};_0x561727(++_0x439059);}(_0xe360,0xb7));var _0x0e36=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xe360[_0x174ef5];return _0x1cc379;};'use strict';var rimraf=require(_0x0e36('0x0'));var zipdir=require(_0x0e36('0x1'));var moment=require(_0x0e36('0x2'));var util=require('util');var path=require('path');var ejs=require(_0x0e36('0x3'));var fs=require('fs');var _=require(_0x0e36('0x4'));var Redis=require('ioredis');var interaction=require(_0x0e36('0x5'));var qs=require(_0x0e36('0x6'));var pdf=require(_0x0e36('0x7'));var logger=require(_0x0e36('0x8'))(_0x0e36('0x9'));var config=require(_0x0e36('0xa'));var db=require(_0x0e36('0xb'))['db'];config[_0x0e36('0xc')]=_['defaults'](config[_0x0e36('0xc')],{'host':_0x0e36('0xd'),'port':0x18eb});var socket=require(_0x0e36('0xe'))(new Redis(config[_0x0e36('0xc')]));require(_0x0e36('0xf'))[_0x0e36('0x10')](socket);function respondWithStatusCode(_0x1921e7,_0x5001fb){_0x5001fb=_0x5001fb||0xcc;return function(_0x46eb83){if(_0x46eb83){return _0x1921e7[_0x0e36('0x11')](_0x5001fb);}return _0x1921e7[_0x0e36('0x12')](_0x5001fb)[_0x0e36('0x13')]();};}function respondWithResult(_0x126c3b,_0x2dd5bf){_0x2dd5bf=_0x2dd5bf||0xc8;return function(_0x2622cb){if(_0x2622cb){return _0x126c3b[_0x0e36('0x12')](_0x2dd5bf)[_0x0e36('0x14')](_0x2622cb);}};}function respondWithFilteredResult(_0x1ff32a,_0x4ca0de){return function(_0x91b0ed){if(_0x91b0ed){var _0x38f672=typeof _0x4ca0de[_0x0e36('0x15')]===_0x0e36('0x16')&&typeof _0x4ca0de[_0x0e36('0x17')]===_0x0e36('0x16');var _0x58437d=_0x91b0ed[_0x0e36('0x18')];var _0x17ac38=_0x38f672?0x0:_0x4ca0de['offset'];var _0x2204dd=_0x38f672?_0x91b0ed[_0x0e36('0x18')]:_0x4ca0de[_0x0e36('0x15')]+_0x4ca0de[_0x0e36('0x17')];var _0x8af263;if(_0x2204dd>=_0x58437d){_0x2204dd=_0x58437d;_0x8af263=0xc8;}else{_0x8af263=0xce;}_0x1ff32a[_0x0e36('0x12')](_0x8af263);return _0x1ff32a['set'](_0x0e36('0x19'),_0x17ac38+'-'+_0x2204dd+'/'+_0x58437d)[_0x0e36('0x14')](_0x91b0ed);}return null;};}function saveUpdates(_0x938587){return function(_0x1f5db9){if(_0x1f5db9){return _0x1f5db9[_0x0e36('0x1a')](_0x938587)['then'](function(_0x181ac7){return _0x181ac7;});}return null;};}function removeEntity(_0x190aad){return function(_0x432fa0){if(_0x432fa0){return _0x432fa0['destroy']()[_0x0e36('0x1b')](function(){_0x190aad['status'](0xcc)[_0x0e36('0x13')]();});}};}function handleEntityNotFound(_0x2e92e0){return function(_0x552a87){if(!_0x552a87){_0x2e92e0[_0x0e36('0x11')](0x194);}return _0x552a87;};}function handleError(_0x19ef47,_0x521fcd){_0x521fcd=_0x521fcd||0x1f4;return function(_0xead768){logger[_0x0e36('0x1c')](_0xead768[_0x0e36('0x1d')]);if(_0xead768[_0x0e36('0x1e')]){delete _0xead768[_0x0e36('0x1e')];}_0x19ef47['status'](_0x521fcd)[_0x0e36('0x1f')](_0xead768);};}exports['index']=function(_0x185079,_0x484436){var _0x4b62ee={};var _0xad025f=_['map'](db[_0x0e36('0x20')][_0x0e36('0x21')],function(_0x5babf4){return{'name':_0x5babf4['fieldName'],'type':_0x5babf4['type'][_0x0e36('0x22')]};});_0x4b62ee=qs[_0x0e36('0x23')](_0xad025f,_0x185079);return interaction[_0x0e36('0x24')](_0x0e36('0x25'),_0x185079[_0x0e36('0x26')],_0x185079['user'],_0x4b62ee,_0xad025f)[_0x0e36('0x1b')](respondWithFilteredResult(_0x484436,_0x4b62ee))[_0x0e36('0x27')](handleError(_0x484436,null));};exports[_0x0e36('0x28')]=function(_0x58cd0b,_0x2e0a4b){var _0x1c3d28={};if(_0x58cd0b[_0x0e36('0x26')][_0x0e36('0x29')]&&_0x58cd0b[_0x0e36('0x26')]['type']===_0x0e36('0x2a')){_0x1c3d28[_0x0e36('0x2a')]=_0x58cd0b[_0x0e36('0x2b')]['id'];}else{_0x1c3d28['id']=_0x58cd0b[_0x0e36('0x2b')]['id'];}var _0x5b1d28={'raw':![],'where':_0x1c3d28},_0x40542b={};_0x40542b[_0x0e36('0x2c')]=_[_0x0e36('0x2d')](db[_0x0e36('0x20')]['rawAttributes']);_0x40542b[_0x0e36('0x26')]=_[_0x0e36('0x2d')](_0x58cd0b[_0x0e36('0x26')]);_0x40542b['filters']=_['intersection'](_0x40542b['model'],_0x40542b['query']);_0x5b1d28[_0x0e36('0x2e')]=_[_0x0e36('0x2f')](_0x40542b[_0x0e36('0x2c')],qs['fields'](_0x58cd0b[_0x0e36('0x26')]['fields']));_0x5b1d28[_0x0e36('0x2e')]=_0x5b1d28[_0x0e36('0x2e')][_0x0e36('0x30')]?_0x5b1d28[_0x0e36('0x2e')]:_0x40542b[_0x0e36('0x2c')];if(_0x58cd0b[_0x0e36('0x26')][_0x0e36('0x31')]){_0x5b1d28[_0x0e36('0x32')]=[{'all':!![]}];}_0x5b1d28=_[_0x0e36('0x33')]({},_0x5b1d28,_0x58cd0b[_0x0e36('0x34')]);return db[_0x0e36('0x20')]['find'](_0x5b1d28)[_0x0e36('0x1b')](handleEntityNotFound(_0x2e0a4b,null))[_0x0e36('0x1b')](respondWithResult(_0x2e0a4b,null))[_0x0e36('0x27')](handleError(_0x2e0a4b,null));};exports['create']=function(_0xbd9052,_0xc42fc2){return db[_0x0e36('0x20')][_0x0e36('0x35')](_0xbd9052[_0x0e36('0x36')],{})[_0x0e36('0x1b')](respondWithResult(_0xc42fc2,0xc9))['catch'](handleError(_0xc42fc2,null));};exports[_0x0e36('0x1a')]=function(_0x1595bb,_0x86df77){if(_0x1595bb['body']['id']){delete _0x1595bb[_0x0e36('0x36')]['id'];}return db[_0x0e36('0x20')]['find']({'where':{'id':_0x1595bb['params']['id']}})[_0x0e36('0x1b')](handleEntityNotFound(_0x86df77,null))[_0x0e36('0x1b')](saveUpdates(_0x1595bb['body'],null))[_0x0e36('0x1b')](respondWithResult(_0x86df77,null))[_0x0e36('0x27')](handleError(_0x86df77,null));};exports[_0x0e36('0x37')]=function(_0x16433a,_0x291ade){return db[_0x0e36('0x20')][_0x0e36('0x38')]({'where':{'id':_0x16433a[_0x0e36('0x2b')]['id']}})[_0x0e36('0x1b')](handleEntityNotFound(_0x291ade,null))[_0x0e36('0x1b')](removeEntity(_0x291ade,null))['catch'](handleError(_0x291ade,null));};exports['describe']=function(_0x5705b2,_0x673658){return db['OpenchannelInteraction'][_0x0e36('0x39')]()[_0x0e36('0x1b')](respondWithResult(_0x673658,null))['catch'](handleError(_0x673658,null));};exports[_0x0e36('0x3a')]=function(_0x3ea203,_0x28782b){return db[_0x0e36('0x3b')]['find']({'where':{'id':_0x3ea203[_0x0e36('0x2b')]['id']}})[_0x0e36('0x1b')](handleEntityNotFound(_0x28782b,null))[_0x0e36('0x1b')](function(_0x35f394){if(_0x35f394){return _0x35f394['addMessage'](_0x3ea203[_0x0e36('0x36')][_0x0e36('0x3c')],_[_0x0e36('0x3d')](_0x3ea203[_0x0e36('0x36')],[_0x0e36('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x28782b,null))[_0x0e36('0x27')](handleError(_0x28782b,null));};exports[_0x0e36('0x3e')]=function(_0x5bd5cd,_0x34e330){var _0x3c58fd={'raw':![],'where':{}};var _0x1e6a19={};var _0x7a1f05={'count':0x0,'rows':[]};return db[_0x0e36('0x20')][_0x0e36('0x3f')]({'where':{'id':_0x5bd5cd[_0x0e36('0x2b')]['id']}})['then'](handleEntityNotFound(_0x34e330,null))[_0x0e36('0x1b')](function(_0x452f8c){if(_0x452f8c){_0x1e6a19[_0x0e36('0x2c')]=_[_0x0e36('0x2d')](db['OpenchannelMessage'][_0x0e36('0x21')]);_0x1e6a19[_0x0e36('0x26')]=_[_0x0e36('0x2d')](_0x5bd5cd[_0x0e36('0x26')]);_0x1e6a19[_0x0e36('0x40')]=_[_0x0e36('0x2f')](_0x1e6a19[_0x0e36('0x2c')],_0x1e6a19[_0x0e36('0x26')]);_0x3c58fd[_0x0e36('0x2e')]=_['intersection'](_0x1e6a19['model'],qs[_0x0e36('0x41')](_0x5bd5cd[_0x0e36('0x26')][_0x0e36('0x41')]));_0x3c58fd[_0x0e36('0x2e')]=_0x3c58fd[_0x0e36('0x2e')][_0x0e36('0x30')]?_0x3c58fd['attributes']:_0x1e6a19[_0x0e36('0x2c')];if(!_0x5bd5cd[_0x0e36('0x26')]['hasOwnProperty'](_0x0e36('0x42'))){_0x3c58fd[_0x0e36('0x17')]=qs[_0x0e36('0x17')](_0x5bd5cd['query'][_0x0e36('0x17')]);_0x3c58fd[_0x0e36('0x15')]=qs[_0x0e36('0x15')](_0x5bd5cd['query'][_0x0e36('0x15')]);}_0x3c58fd[_0x0e36('0x43')]=qs[_0x0e36('0x44')](_0x5bd5cd[_0x0e36('0x26')]['sort']);_0x3c58fd['where']=qs[_0x0e36('0x40')](_[_0x0e36('0x45')](_0x5bd5cd[_0x0e36('0x26')],_0x1e6a19[_0x0e36('0x40')]));_0x3c58fd['where']['OpenchannelInteractionId']=_0x452f8c['id'];if(_0x5bd5cd[_0x0e36('0x26')][_0x0e36('0x46')]){_0x3c58fd[_0x0e36('0x47')]=_[_0x0e36('0x33')](_0x3c58fd['where'],{'$or':_['map'](_0x3c58fd['attributes'],function(_0x27b315){var _0x4581ae={};_0x4581ae[_0x27b315]={'$like':'%'+_0x5bd5cd[_0x0e36('0x26')]['filter']+'%'};return _0x4581ae;})});}if(_0x5bd5cd[_0x0e36('0x26')][_0x0e36('0x48')]){var _0x2c099d=_0x5bd5cd[_0x0e36('0x26')][_0x0e36('0x48')][_0x0e36('0x49')](',');var _0x3fabdb={};_0x3fabdb[_0x2c099d[0x0]]={'$gte':moment(_0x2c099d[0x1])[_0x0e36('0x4a')](_0x0e36('0x4b'))};_0x3c58fd['where']=_[_0x0e36('0x33')](_0x3c58fd[_0x0e36('0x47')],_0x3fabdb);}_0x3c58fd=_[_0x0e36('0x33')]({},_0x3c58fd,_0x5bd5cd[_0x0e36('0x34')]);return db[_0x0e36('0x3b')][_0x0e36('0x18')]({'where':_0x3c58fd['where']})[_0x0e36('0x1b')](function(_0x250f03){_0x7a1f05[_0x0e36('0x18')]=_0x250f03;if(_0x5bd5cd[_0x0e36('0x26')][_0x0e36('0x31')]){_0x3c58fd['include']=[{'all':!![]}];}return db[_0x0e36('0x3b')][_0x0e36('0x24')](_0x3c58fd);})[_0x0e36('0x1b')](function(_0x2549fc){_0x7a1f05['rows']=_0x2549fc;return _0x7a1f05;});}})['then'](respondWithFilteredResult(_0x34e330,_0x3c58fd))[_0x0e36('0x27')](handleError(_0x34e330,null));};exports[_0x0e36('0x4c')]=function(_0x157e22,_0x1a8793){return db[_0x0e36('0x20')][_0x0e36('0x38')]({'where':{'id':_0x157e22[_0x0e36('0x2b')]['id']}})[_0x0e36('0x1b')](handleEntityNotFound(_0x1a8793,null))[_0x0e36('0x1b')](function(_0x403c43){if(_0x403c43){return _0x403c43[_0x0e36('0x4d')](_0x157e22[_0x0e36('0x36')][_0x0e36('0x3c')],_[_0x0e36('0x3d')](_0x157e22[_0x0e36('0x36')],[_0x0e36('0x3c'),'id'])||{})[_0x0e36('0x4e')](function(){return db['Tag'][_0x0e36('0x24')]({'attributes':['id',_0x0e36('0x1e'),'color'],'where':{'id':_0x157e22[_0x0e36('0x36')][_0x0e36('0x3c')]}});})[_0x0e36('0x1b')](function(_0xa4ce25){socket[_0x0e36('0x4f')]('openchannelInteractionTags:save',{'id':Number(_0x157e22[_0x0e36('0x2b')]['id']),'tags':_0xa4ce25||[]});return{'id':Number(_0x157e22[_0x0e36('0x2b')]['id']),'tags':_0xa4ce25||[]};});}})[_0x0e36('0x1b')](respondWithResult(_0x1a8793,null))[_0x0e36('0x27')](handleError(_0x1a8793,null));};exports[_0x0e36('0x50')]=function(_0x12f64d,_0x10cec7){return db[_0x0e36('0x20')][_0x0e36('0x38')]({'where':{'id':_0x12f64d['params']['id']}})[_0x0e36('0x1b')](handleEntityNotFound(_0x10cec7,null))['then'](function(_0x5c650a){if(_0x5c650a){return _0x5c650a[_0x0e36('0x50')](_0x12f64d[_0x0e36('0x26')][_0x0e36('0x3c')]);}})['then'](respondWithStatusCode(_0x10cec7,null))[_0x0e36('0x27')](handleError(_0x10cec7,null));};exports['download']=function(_0x447d2a,_0x3b9767){var _0x417e13=moment()['unix']()[_0x0e36('0x51')]();var _0x46119e=path[_0x0e36('0x52')](config['root'],_0x0e36('0x53'),_0x0e36('0x54'),_0x0e36('0x55'));var _0x5c836b=path[_0x0e36('0x52')](config['root'],_0x0e36('0x53'),_0x0e36('0x54'),_0x0e36('0x56'));var _0x176c14=path[_0x0e36('0x52')](_0x46119e,_0x417e13);var _0x34ddc0=util[_0x0e36('0x4a')](_0x0e36('0x57'),_0x447d2a[_0x0e36('0x2b')]['id'],_0x417e13);var _0x17e4cb=path[_0x0e36('0x52')](_0x46119e,_0x34ddc0);var _0xbd2bf5=[];_0xbd2bf5['push']({'model':db[_0x0e36('0x58')],'as':_0x0e36('0x58'),'attributes':['id','fullname'],'raw':!![]});_0xbd2bf5[_0x0e36('0x59')]({'model':db[_0x0e36('0x5a')],'as':_0x0e36('0x5b'),'attributes':['id',_0x0e36('0x5c'),_0x0e36('0x5d')],'raw':!![]});if(_0x447d2a[_0x0e36('0x26')][_0x0e36('0x56')]){_0xbd2bf5[_0x0e36('0x59')]({'model':db[_0x0e36('0x5e')],'as':_0x0e36('0x5e'),'raw':!![]});}var _0x406e49=[{'model':db['OpenchannelMessage'],'as':_0x0e36('0x5f'),'attributes':['id',_0x0e36('0x36'),_0x0e36('0x60'),_0x0e36('0x61'),_0x0e36('0x62'),_0x0e36('0x63')],'include':_0xbd2bf5}];_0x406e49['push']({'model':db[_0x0e36('0x64')],'as':'Account','attributes':['id',_0x0e36('0x1e')]});_0x406e49['push']({'model':db['User'],'as':_0x0e36('0x65'),'attributes':['id',_0x0e36('0x66')]});return db['OpenchannelInteraction'][_0x0e36('0x38')]({'where':{'id':_0x447d2a[_0x0e36('0x2b')]['id']},'include':_0x406e49})[_0x0e36('0x1b')](handleEntityNotFound(_0x3b9767,null))[_0x0e36('0x1b')](function(_0x53c889){if(_0x53c889){var _0x411b55=_0x53c889[_0x0e36('0x67')]({'plain':!![]});fs[_0x0e36('0x68')](_0x176c14);var _0x5f3ae2={'channel':'Openchannel','account':_0x411b55[_0x0e36('0x69')][_0x0e36('0x1e')],'agent':_0x411b55['Owner']?_0x411b55[_0x0e36('0x65')][_0x0e36('0x66')]:_0x0e36('0x6a'),'createdAt':moment(_0x411b55['createdAt'])[_0x0e36('0x4a')](_0x0e36('0x4b'))['toString'](),'closedAt':_0x411b55['closed']?moment(_0x411b55['closedAt'])[_0x0e36('0x4a')](_0x0e36('0x4b'))[_0x0e36('0x51')]():'','disposition':_0x411b55[_0x0e36('0x6b')],'visibility':_0x411b55['threadId']?_0x0e36('0x6c'):_0x0e36('0x6d'),'messages':_(_0x411b55[_0x0e36('0x5f')])['filter']({'secret':![]})['map'](function(_0x446821){if(_0x446821[_0x0e36('0x5e')]){var _0x409fc1=path[_0x0e36('0x52')](_0x5c836b,_0x446821[_0x0e36('0x5e')][_0x0e36('0x6e')]);if(fs['existsSync'](_0x409fc1)){fs[_0x0e36('0x6f')](_0x409fc1)['pipe'](fs['createWriteStream'](path[_0x0e36('0x52')](_0x176c14,_0x446821[_0x0e36('0x5e')][_0x0e36('0x6e')])));}}return{'date':moment(_0x446821[_0x0e36('0x60')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x0e36('0x51')](),'sender':_0x446821[_0x0e36('0x61')]===_0x0e36('0x70')?_0x446821[_0x0e36('0x58')]?_0x446821[_0x0e36('0x58')][_0x0e36('0x66')]:'System':_0x446821[_0x0e36('0x5b')][_0x0e36('0x5c')]+(_0x446821[_0x0e36('0x5b')][_0x0e36('0x5d')]?'\x20'+_0x446821[_0x0e36('0x5b')][_0x0e36('0x5d')]:''),'body':_0x446821[_0x0e36('0x5e')]?_0x446821[_0x0e36('0x5e')][_0x0e36('0x6e')]:_0x446821[_0x0e36('0x36')],'direction':_0x446821[_0x0e36('0x61')]===_0x0e36('0x70')?'A':'C','secret':_0x446821['secret'],'read':_0x446821[_0x0e36('0x63')],'attachment':_0x446821[_0x0e36('0x5e')]};})[_0x0e36('0x71')]()};return ejs[_0x0e36('0x72')](path[_0x0e36('0x52')](config[_0x0e36('0x73')],_0x0e36('0x53'),_0x0e36('0x74'),'downloadInteraction.ejs'),{'interaction':_0x5f3ae2})[_0x0e36('0x1b')](function(_0x4c906b){var _0x33f75e=path[_0x0e36('0x52')](_0x176c14,_0x0e36('0x75')+_0x411b55['id']+'-'+_0x417e13+_0x0e36('0x76'));var _0x2dcfc1={'path':_0x33f75e,'channel':_0x0e36('0x77'),'interactionId':_0x411b55['id']};return pdf[_0x0e36('0x78')](_0x4c906b,_0x2dcfc1);})['then'](function(){return new Promise(function(_0x572942,_0x323503){zipdir(_0x176c14,{'saveTo':_0x17e4cb},function(_0x1680db,_0x248080){if(_0x1680db)return _0x323503(_0x1680db);return _0x572942(_0x248080);});})[_0x0e36('0x1b')](function(){return new Promise(function(_0x3e80d2,_0x354f12){rimraf(_0x176c14,function(_0x20ce56){if(_0x20ce56)_0x354f12(_0x20ce56);return _0x3e80d2();});});})[_0x0e36('0x1b')](function(){return _0x3b9767[_0x0e36('0x79')](_0x17e4cb,_0x34ddc0,function(_0x2b7914){if(_0x2b7914){logger[_0x0e36('0x1c')](_0x0e36('0x7a'),_0x2b7914);}else{fs[_0x0e36('0x7b')](_0x17e4cb);}});});});}else{return _0x3b9767[_0x0e36('0x11')](0xc8);}})[_0x0e36('0x27')](handleError(_0x3b9767,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 8efe618..4e20419 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 _0x450a=['OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','catch','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x865dd6,_0x583224){var _0x102caa=function(_0x5797fc){while(--_0x5797fc){_0x865dd6['push'](_0x865dd6['shift']());}};_0x102caa(++_0x583224);}(_0x450a,0x153));var _0xa450=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x450a[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xa450('0x0'))['db'][_0xa450('0x1')];var OpenchannelMessage=require(_0xa450('0x0'))['db'][_0xa450('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xa450('0x3')](0x0);var events={'afterCreate':_0xa450('0x4'),'afterUpdate':_0xa450('0x5'),'afterDestroy':_0xa450('0x6')};function emitEvent(_0x260dba){return function(_0x40dec5,_0x56f024,_0xf483ba){_0x40dec5[_0xa450('0x7')]({'attributes':['id'],'raw':!![]})[_0xa450('0x8')](function(_0x4f2aa8){_0x40dec5[_0xa450('0x9')]('Users',_0x4f2aa8[_0xa450('0xa')](function(_0x424687){return{'id':_0x424687['id']};}));return OpenchannelMessage[_0xa450('0xb')]({'where':{'OpenchannelInteractionId':_0x40dec5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa450('0x8')](function(_0x1dfa95){_0x40dec5[_0xa450('0x9')](_0xa450('0xc'),_0x1dfa95['length']);OpenchannelInteractionEvents['emit'](_0x260dba+':'+_0x40dec5['id'],_0x40dec5);OpenchannelInteractionEvents['emit'](_0x260dba,_0x40dec5);_0xf483ba(null);})[_0xa450('0xd')](_0xf483ba(null));};}for(var e in events){if(events[_0xa450('0xe')](e)){var event=events[e];OpenchannelInteraction[_0xa450('0xf')](e,emitEvent(event));}}module[_0xa450('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x83ff=['setDataValue','Users','map','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','getUsers','then'];(function(_0x35c6ee,_0x20aea2){var _0x58ce5b=function(_0xb8dd73){while(--_0xb8dd73){_0x35c6ee['push'](_0x35c6ee['shift']());}};_0x58ce5b(++_0x20aea2);}(_0x83ff,0xe9));var _0xf83f=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x83ff[_0x75f869];return _0x10af8b;};'use strict';var EventEmitter=require(_0xf83f('0x0'));var OpenchannelInteraction=require(_0xf83f('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xf83f('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xf83f('0x2')](0x0);var events={'afterCreate':_0xf83f('0x3'),'afterUpdate':'update','afterDestroy':_0xf83f('0x4')};function emitEvent(_0x9b2a03){return function(_0x998920,_0x5dbc34,_0x2cef81){_0x998920[_0xf83f('0x5')]({'attributes':['id'],'raw':!![]})[_0xf83f('0x6')](function(_0xba8c9f){_0x998920[_0xf83f('0x7')](_0xf83f('0x8'),_0xba8c9f[_0xf83f('0x9')](function(_0x2272d3){return{'id':_0x2272d3['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x998920['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf83f('0x6')](function(_0x9bc931){_0x998920['setDataValue'](_0xf83f('0xa'),_0x9bc931[_0xf83f('0xb')]);OpenchannelInteractionEvents[_0xf83f('0xc')](_0x9b2a03+':'+_0x998920['id'],_0x998920);OpenchannelInteractionEvents['emit'](_0x9b2a03,_0x998920);_0x2cef81(null);})[_0xf83f('0xd')](_0x2cef81(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xf83f('0xe')](e,emitEvent(event));}}module[_0xf83f('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 97f8a9f..b1edd3c 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 _0xc43c=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','request-promise','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closed','closedAt'];(function(_0x6d2694,_0x2a10b3){var _0x1cf1ca=function(_0x5e109c){while(--_0x5e109c){_0x6d2694['push'](_0x6d2694['shift']());}};_0x1cf1ca(++_0x2a10b3);}(_0xc43c,0xd4));var _0xcc43=function(_0x20ac1c,_0x54ca1a){_0x20ac1c=_0x20ac1c-0x0;var _0xef202b=_0xc43c[_0x20ac1c];return _0xef202b;};'use strict';var _=require(_0xcc43('0x0'));var util=require(_0xcc43('0x1'));var logger=require(_0xcc43('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcc43('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcc43('0x4'));module[_0xcc43('0x5')]=function(_0x13d329,_0x5e818f){return _0x13d329[_0xcc43('0x6')](_0xcc43('0x7'),attributes,{'tableName':_0xcc43('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcc43('0x9'),'collate':_0xcc43('0xa'),'hooks':{'beforeUpdate':function(_0x327c4e,_0x3d0462,_0xd311b1){if(_0x327c4e['changed'](_0xcc43('0xb'))){_0x327c4e[_0xcc43('0xc')]=moment()[_0xcc43('0xd')](_0xcc43('0xe'));}_0xd311b1(null,_0x327c4e);}}});}; \ No newline at end of file +var _0x29c7=['OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','path','../../config/environment','./openchannelInteraction.attributes','exports','define'];(function(_0x259301,_0x497973){var _0x37633a=function(_0x4e1c2b){while(--_0x4e1c2b){_0x259301['push'](_0x259301['shift']());}};_0x37633a(++_0x497973);}(_0x29c7,0x147));var _0x729c=function(_0x1942d8,_0xdfd408){_0x1942d8=_0x1942d8-0x0;var _0x58fe3f=_0x29c7[_0x1942d8];return _0x58fe3f;};'use strict';var _=require(_0x729c('0x0'));var util=require('util');var logger=require(_0x729c('0x1'))(_0x729c('0x2'));var moment=require(_0x729c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x729c('0x4'));var rimraf=require('rimraf');var config=require(_0x729c('0x5'));var attributes=require(_0x729c('0x6'));module[_0x729c('0x7')]=function(_0x443099,_0xf6e876){return _0x443099[_0x729c('0x8')](_0x729c('0x9'),attributes,{'tableName':_0x729c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x729c('0xb'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x7764c0,_0x2557b5,_0x3954d2){if(_0x7764c0[_0x729c('0xc')](_0x729c('0xd'))){_0x7764c0['closedAt']=moment()[_0x729c('0xe')](_0x729c('0xf'));}_0x3954d2(null,_0x7764c0);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index b21c1da..7cd57c3 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 _0x77ff=['./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','catch','UpdateOpenchannelInteraction','update','body','options','where','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','ids','omit','spread','AddTags','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost'];(function(_0xe30e17,_0xce02be){var _0x2342c9=function(_0x20b733){while(--_0x20b733){_0xe30e17['push'](_0xe30e17['shift']());}};_0x2342c9(++_0xce02be);}(_0x77ff,0xa8));var _0xf77f=function(_0x234cc1,_0x152886){_0x234cc1=_0x234cc1-0x0;var _0x25e023=_0x77ff[_0x234cc1];return _0x25e023;};'use strict';var _=require(_0xf77f('0x0'));var util=require(_0xf77f('0x1'));var moment=require(_0xf77f('0x2'));var BPromise=require('bluebird');var rs=require(_0xf77f('0x3'));var fs=require('fs');var Redis=require(_0xf77f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf77f('0x5'));var logger=require('../../config/logger')(_0xf77f('0x6'));var config=require('../../config/environment');var jayson=require(_0xf77f('0x7'));var client=jayson['client'][_0xf77f('0x8')]({'port':0x232a});config[_0xf77f('0x9')]=_[_0xf77f('0xa')](config[_0xf77f('0x9')],{'host':_0xf77f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf77f('0x9')]));require(_0xf77f('0xc'))[_0xf77f('0xd')](socket);function respondWithRpcPromise(_0x1c3125,_0x3e08bd,_0x7765a0){return new BPromise(function(_0x3c08a5,_0x525400){return client[_0xf77f('0xe')](_0x1c3125,_0x7765a0)[_0xf77f('0xf')](function(_0x4a32c2){logger[_0xf77f('0x10')](_0xf77f('0x11'),_0x3e08bd,_0xf77f('0x12'));logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x3e08bd,'request\x20sent',JSON['stringify'](_0x4a32c2));if(_0x4a32c2[_0xf77f('0x13')]){if(_0x4a32c2['error'][_0xf77f('0x14')]===0x1f4){logger['error'](_0xf77f('0x11'),_0x3e08bd,_0x4a32c2[_0xf77f('0x13')]['message']);return _0x525400(_0x4a32c2[_0xf77f('0x13')][_0xf77f('0x15')]);}logger[_0xf77f('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3e08bd,_0x4a32c2[_0xf77f('0x13')][_0xf77f('0x15')]);return _0x3c08a5(_0x4a32c2[_0xf77f('0x13')][_0xf77f('0x15')]);}else{logger[_0xf77f('0x10')](_0xf77f('0x11'),_0x3e08bd,_0xf77f('0x12'));_0x3c08a5(_0x4a32c2['result']['message']);}})[_0xf77f('0x16')](function(_0x1dd087){logger[_0xf77f('0x13')](_0xf77f('0x11'),_0x3e08bd,_0x1dd087);_0x525400(_0x1dd087);});});}exports[_0xf77f('0x17')]=function(_0x4b669a){var _0x5d9ed1=this;return new Promise(function(_0x30df61,_0x1eff35){return db['OpenchannelInteraction'][_0xf77f('0x18')](_0x4b669a[_0xf77f('0x19')],{'raw':_0x4b669a[_0xf77f('0x1a')]?_0x4b669a[_0xf77f('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b669a[_0xf77f('0x1a')]?_0x4b669a[_0xf77f('0x1a')][_0xf77f('0x1b')]||null:null,'attributes':_0x4b669a[_0xf77f('0x1a')]?_0x4b669a[_0xf77f('0x1a')]['attributes']||null:null,'limit':_0x4b669a['options']?_0x4b669a[_0xf77f('0x1a')]['limit']||null:null})['then'](function(_0x2835d8){logger[_0xf77f('0x10')](_0xf77f('0x17'),_0x4b669a);logger['debug'](_0xf77f('0x17'),_0x4b669a,JSON['stringify'](_0x2835d8));_0x30df61(_0x2835d8);})[_0xf77f('0x16')](function(_0x5391ba){logger[_0xf77f('0x13')](_0xf77f('0x17'),_0x5391ba['message'],_0x4b669a);_0x1eff35(_0x5d9ed1['error'](0x1f4,_0x5391ba[_0xf77f('0x15')]));});});};exports[_0xf77f('0x1c')]=function(_0x29a8af){return new Promise(function(_0x331db3,_0x16dfd6){return db[_0xf77f('0x1d')][_0xf77f('0x1e')]({'where':_0x29a8af[_0xf77f('0x1a')]?_0x29a8af[_0xf77f('0x1a')][_0xf77f('0x1b')]||null:null})[_0xf77f('0xf')](function(_0x1a0049){if(_0x1a0049){return _0x1a0049['addTags'](_0x29a8af[_0xf77f('0x19')][_0xf77f('0x1f')],_[_0xf77f('0x20')](_0x29a8af[_0xf77f('0x19')],[_0xf77f('0x1f'),'id'])||{});}})[_0xf77f('0x21')](function(_0x372151){logger[_0xf77f('0x10')](_0xf77f('0x22'),_0x29a8af);logger['debug'](_0xf77f('0x22'),_0x29a8af,JSON[_0xf77f('0x23')](_0x372151));_0x331db3(_0x372151);})[_0xf77f('0x16')](function(_0x88a5a9){logger['error']('AddTags',_0x88a5a9['message'],_0x29a8af);_0x16dfd6(_this[_0xf77f('0x13')](0x1f4,_0x88a5a9[_0xf77f('0x15')]));});});}; \ No newline at end of file +var _0x782a=['debug','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','update','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent'];(function(_0x3bd7a0,_0x2d5ad6){var _0x2ef2cb=function(_0x16ff71){while(--_0x16ff71){_0x3bd7a0['push'](_0x3bd7a0['shift']());}};_0x2ef2cb(++_0x2d5ad6);}(_0x782a,0x70));var _0xa782=function(_0x17c2a8,_0xc7c2){_0x17c2a8=_0x17c2a8-0x0;var _0x5ecfdc=_0x782a[_0x17c2a8];return _0x5ecfdc;};'use strict';var _=require(_0xa782('0x0'));var util=require(_0xa782('0x1'));var moment=require('moment');var BPromise=require(_0xa782('0x2'));var rs=require(_0xa782('0x3'));var fs=require('fs');var Redis=require(_0xa782('0x4'));var db=require(_0xa782('0x5'))['db'];var utils=require(_0xa782('0x6'));var logger=require(_0xa782('0x7'))(_0xa782('0x8'));var config=require(_0xa782('0x9'));var jayson=require(_0xa782('0xa'));var client=jayson[_0xa782('0xb')]['http']({'port':0x232a});config[_0xa782('0xc')]=_[_0xa782('0xd')](config['redis'],{'host':_0xa782('0xe'),'port':0x18eb});var socket=require(_0xa782('0xf'))(new Redis(config[_0xa782('0xc')]));require('./openchannelInteraction.socket')[_0xa782('0x10')](socket);function respondWithRpcPromise(_0x5b8bc2,_0xe0e8f0,_0x2f1b65){return new BPromise(function(_0x655b77,_0x4bac4a){return client['request'](_0x5b8bc2,_0x2f1b65)[_0xa782('0x11')](function(_0x322266){logger[_0xa782('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0xe0e8f0,_0xa782('0x13'));logger[_0xa782('0x14')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0xe0e8f0,_0xa782('0x13'),JSON[_0xa782('0x15')](_0x322266));if(_0x322266[_0xa782('0x16')]){if(_0x322266[_0xa782('0x16')][_0xa782('0x17')]===0x1f4){logger[_0xa782('0x16')](_0xa782('0x18'),_0xe0e8f0,_0x322266[_0xa782('0x16')][_0xa782('0x19')]);return _0x4bac4a(_0x322266['error'][_0xa782('0x19')]);}logger[_0xa782('0x16')](_0xa782('0x18'),_0xe0e8f0,_0x322266[_0xa782('0x16')][_0xa782('0x19')]);return _0x655b77(_0x322266[_0xa782('0x16')]['message']);}else{logger[_0xa782('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0xe0e8f0,'request\x20sent');_0x655b77(_0x322266[_0xa782('0x1a')][_0xa782('0x19')]);}})[_0xa782('0x1b')](function(_0x42724f){logger[_0xa782('0x16')](_0xa782('0x18'),_0xe0e8f0,_0x42724f);_0x4bac4a(_0x42724f);});});}exports[_0xa782('0x1c')]=function(_0x247a57){var _0x58818b=this;return new Promise(function(_0x3f7011,_0x8e1a66){return db['OpenchannelInteraction'][_0xa782('0x1d')](_0x247a57['body'],{'raw':_0x247a57['options']?_0x247a57[_0xa782('0x1e')][_0xa782('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x247a57['options']?_0x247a57[_0xa782('0x1e')][_0xa782('0x20')]||null:null,'attributes':_0x247a57[_0xa782('0x1e')]?_0x247a57[_0xa782('0x1e')][_0xa782('0x21')]||null:null,'limit':_0x247a57[_0xa782('0x1e')]?_0x247a57['options'][_0xa782('0x22')]||null:null})[_0xa782('0x11')](function(_0x283dc5){logger[_0xa782('0x12')](_0xa782('0x1c'),_0x247a57);logger[_0xa782('0x14')]('UpdateOpenchannelInteraction',_0x247a57,JSON[_0xa782('0x15')](_0x283dc5));_0x3f7011(_0x283dc5);})[_0xa782('0x1b')](function(_0x34716c){logger['error'](_0xa782('0x1c'),_0x34716c[_0xa782('0x19')],_0x247a57);_0x8e1a66(_0x58818b[_0xa782('0x16')](0x1f4,_0x34716c['message']));});});};exports[_0xa782('0x23')]=function(_0x53d493){return new Promise(function(_0x45e234,_0x13e8de){return db[_0xa782('0x24')][_0xa782('0x25')]({'where':_0x53d493['options']?_0x53d493[_0xa782('0x1e')][_0xa782('0x20')]||null:null})[_0xa782('0x11')](function(_0x1ffcb0){if(_0x1ffcb0){return _0x1ffcb0[_0xa782('0x26')](_0x53d493[_0xa782('0x27')][_0xa782('0x28')],_[_0xa782('0x29')](_0x53d493[_0xa782('0x27')],[_0xa782('0x28'),'id'])||{});}})[_0xa782('0x2a')](function(_0x29f78a){logger[_0xa782('0x12')](_0xa782('0x2b'),_0x53d493);logger['debug'](_0xa782('0x2b'),_0x53d493,JSON[_0xa782('0x15')](_0x29f78a));_0x45e234(_0x29f78a);})['catch'](function(_0x35bd62){logger[_0xa782('0x16')](_0xa782('0x2b'),_0x35bd62[_0xa782('0x19')],_0x53d493);_0x13e8de(_this['error'](0x1f4,_0x35bd62[_0xa782('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 84dcde0..da5e9a3 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 _0x8b37=['update','emit','removeListener','length','save','remove'];(function(_0x1f529d,_0x18308c){var _0x4e5197=function(_0xef9299){while(--_0xef9299){_0x1f529d['push'](_0x1f529d['shift']());}};_0x4e5197(++_0x18308c);}(_0x8b37,0x130));var _0x78b3=function(_0xd7b12e,_0x5ba7ae){_0xd7b12e=_0xd7b12e-0x0;var _0x51b93b=_0x8b37[_0xd7b12e];return _0x51b93b;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x78b3('0x0'),_0x78b3('0x1'),_0x78b3('0x2')];function createListener(_0x2dde6c,_0x3dd3dc){return function(_0xc82335){_0x3dd3dc[_0x78b3('0x3')](_0x2dde6c,_0xc82335);};}function removeListener(_0x2a9fb4,_0x24b1ba){return function(){OpenchannelInteractionEvents[_0x78b3('0x4')](_0x2a9fb4,_0x24b1ba);};}exports['register']=function(_0x572842){for(var _0x3bf627=0x0,_0x45b844=events[_0x78b3('0x5')];_0x3bf627<_0x45b844;_0x3bf627++){var _0x4d298c=events[_0x3bf627];var _0x33f89b=createListener('openchannelInteraction:'+_0x4d298c,_0x572842);OpenchannelInteractionEvents['on'](_0x4d298c,_0x33f89b);}}; \ No newline at end of file +var _0x5031=['remove','update','emit','removeListener','register','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x3fd6cb,_0x1f0602){var _0x1f2d3f=function(_0x2bdfe6){while(--_0x2bdfe6){_0x3fd6cb['push'](_0x3fd6cb['shift']());}};_0x1f2d3f(++_0x1f0602);}(_0x5031,0x66));var _0x1503=function(_0x194872,_0x307002){_0x194872=_0x194872-0x0;var _0x556fa6=_0x5031[_0x194872];return _0x556fa6;};'use strict';var OpenchannelInteractionEvents=require(_0x1503('0x0'));var events=[_0x1503('0x1'),_0x1503('0x2'),_0x1503('0x3')];function createListener(_0x1675ef,_0x857a68){return function(_0x3d6c30){_0x857a68[_0x1503('0x4')](_0x1675ef,_0x3d6c30);};}function removeListener(_0x1ca5ab,_0x28a544){return function(){OpenchannelInteractionEvents[_0x1503('0x5')](_0x1ca5ab,_0x28a544);};}exports[_0x1503('0x6')]=function(_0x4e02b8){for(var _0x187177=0x0,_0x1fe72c=events['length'];_0x187177<_0x1fe72c;_0x187177++){var _0xd20781=events[_0x187177];var _0x542274=createListener(_0x1503('0x7')+_0xd20781,_0x4e02b8);OpenchannelInteractionEvents['on'](_0xd20781,_0x542274);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index bc5532a..abbf715 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x16e63d,_0x1f0a66){var _0x5605e4=function(_0x26f519){while(--_0x26f519){_0x16e63d['push'](_0x16e63d['shift']());}};_0x5605e4(++_0x1f0a66);}(_0xedd9,0xfc));var _0x9edd=function(_0x1aa1b9,_0x590c85){_0x1aa1b9=_0x1aa1b9-0x0;var _0x1b3a36=_0xedd9[_0x1aa1b9];return _0x1b3a36;};'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['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file +var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x59fc33,_0x2e182d){var _0x39066f=function(_0x4d843d){while(--_0x4d843d){_0x59fc33['push'](_0x59fc33['shift']());}};_0x39066f(++_0x2e182d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x547add,_0x387042){_0x547add=_0x547add-0x0;var _0x2ed1f3=_0xcb91[_0x547add];return _0x2ed1f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 267efe7..1e98585 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 _0x88c3=['DATE','STRING','sequelize','TEXT','BOOLEAN','out'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x88c3,0x1ee));var _0x388c=function(_0x499258,_0x9e9882){_0x499258=_0x499258-0x0;var _0x54f0e0=_0x88c3[_0x499258];return _0x54f0e0;};'use strict';var Sequelize=require(_0x388c('0x0'));module['exports']={'body':{'type':Sequelize[_0x388c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x388c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x388c('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x388c('0x4')]},'providerName':{'type':Sequelize[_0x388c('0x5')]},'providerResponse':{'type':Sequelize[_0x388c('0x1')]}}; \ No newline at end of file +var _0xbcff=['TEXT','BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports'];(function(_0x26a169,_0x54f908){var _0x1f07a1=function(_0x344027){while(--_0x344027){_0x26a169['push'](_0x26a169['shift']());}};_0x1f07a1(++_0x54f908);}(_0xbcff,0x12e));var _0xfbcf=function(_0x2c8953,_0x4b2efd){_0x2c8953=_0x2c8953-0x0;var _0x42310e=_0xbcff[_0x2c8953];return _0x42310e;};'use strict';var Sequelize=require(_0xfbcf('0x0'));module[_0xfbcf('0x1')]={'body':{'type':Sequelize[_0xfbcf('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xfbcf('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xfbcf('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfbcf('0x4')]('in','out'),'defaultValue':_0xfbcf('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xfbcf('0x6')]},'providerName':{'type':Sequelize[_0xfbcf('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index d6d7103..5abede4 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 _0xc1e6=['isNil','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','email','rejectmessage','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','json','offset','undefined','limit','status','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','OpenchannelMessage','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','count','include','findAll','rows','params','rawAttributes','includeAll','options','find','create','body','describe','openchannel-interactions','accept','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction'];(function(_0x5bc3d0,_0x25c45f){var _0x5c6661=function(_0x1d0a77){while(--_0x1d0a77){_0x5bc3d0['push'](_0x5bc3d0['shift']());}};_0x5c6661(++_0x25c45f);}(_0xc1e6,0x12a));var _0x6c1e=function(_0x665588,_0x471163){_0x665588=_0x665588-0x0;var _0x327c1a=_0xc1e6[_0x665588];return _0x327c1a;};'use strict';var emlformat=require(_0x6c1e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1e('0x1'));var moment=require(_0x6c1e('0x2'));var BPromise=require(_0x6c1e('0x3'));var Mustache=require(_0x6c1e('0x4'));var util=require(_0x6c1e('0x5'));var path=require(_0x6c1e('0x6'));var sox=require(_0x6c1e('0x7'));var csv=require(_0x6c1e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1e('0x9'));var _=require(_0x6c1e('0xa'));var squel=require(_0x6c1e('0xb'));var crypto=require(_0x6c1e('0xc'));var jsforce=require(_0x6c1e('0xd'));var deskjs=require(_0x6c1e('0xe'));var toCsv=require(_0x6c1e('0x8'));var querystring=require(_0x6c1e('0xf'));var Papa=require(_0x6c1e('0x10'));var Redis=require(_0x6c1e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c1e('0x12'));var logger=require(_0x6c1e('0x13'))(_0x6c1e('0x14'));var utils=require(_0x6c1e('0x15'));var config=require(_0x6c1e('0x16'));var licenseUtil=require(_0x6c1e('0x17'));var db=require('../../mysqldb')['db'];config[_0x6c1e('0x18')]=_['defaults'](config[_0x6c1e('0x18')],{'host':_0x6c1e('0x19'),'port':0x18eb});var socket=require(_0x6c1e('0x1a'))(new Redis(config[_0x6c1e('0x18')]));require(_0x6c1e('0x1b'))[_0x6c1e('0x1c')](socket);var jayson=require(_0x6c1e('0x1d'));var client=jayson[_0x6c1e('0x1e')][_0x6c1e('0x1f')]({'port':0x232c});var client9002=jayson[_0x6c1e('0x1e')][_0x6c1e('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4a3d83,_0x56b4e5,_0x3a42e6,_0x575336){return new BPromise(function(_0x104149,_0x5a15af){var _0x281bef=_0x575336||client;return _0x281bef[_0x6c1e('0x20')](_0x4a3d83,_0x3a42e6)[_0x6c1e('0x21')](function(_0x1b5e14){logger[_0x6c1e('0x22')](_0x6c1e('0x23'),_0x56b4e5,_0x6c1e('0x24'));logger[_0x6c1e('0x25')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x56b4e5,'request\x20sent',JSON[_0x6c1e('0x26')](_0x1b5e14));if(_0x1b5e14[_0x6c1e('0x27')]){if(_0x1b5e14[_0x6c1e('0x27')][_0x6c1e('0x28')]===0x1f4){logger['error'](_0x6c1e('0x23'),_0x56b4e5,_0x1b5e14[_0x6c1e('0x27')][_0x6c1e('0x29')]);return _0x5a15af(_0x1b5e14[_0x6c1e('0x27')][_0x6c1e('0x29')]);}logger[_0x6c1e('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x56b4e5,_0x1b5e14[_0x6c1e('0x27')]['message']);return _0x104149(_0x1b5e14['error']['message']);}else{logger[_0x6c1e('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x56b4e5,'request\x20sent');_0x104149(_0x1b5e14[_0x6c1e('0x2a')][_0x6c1e('0x29')]);}})[_0x6c1e('0x2b')](function(_0x3a3cba){logger[_0x6c1e('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x56b4e5,_0x3a3cba);_0x5a15af(_0x3a3cba);});});}function respondWithStatusCode(_0x2dcca2,_0x620520){_0x620520=_0x620520||0xcc;return function(_0x1d1b97){if(_0x1d1b97){return _0x2dcca2[_0x6c1e('0x2c')](_0x620520);}return _0x2dcca2['status'](_0x620520)['end']();};}function respondWithResult(_0x2933b7,_0x58a621){_0x58a621=_0x58a621||0xc8;return function(_0x3423e4){if(_0x3423e4){return _0x2933b7['status'](_0x58a621)[_0x6c1e('0x2d')](_0x3423e4);}};}function respondWithFilteredResult(_0x5973f6,_0x51d859){return function(_0x146416){if(_0x146416){var _0x5f288f=typeof _0x51d859[_0x6c1e('0x2e')]===_0x6c1e('0x2f')&&typeof _0x51d859['limit']===_0x6c1e('0x2f');var _0x5b1851=_0x146416['count'];var _0x2842e3=_0x5f288f?0x0:_0x51d859[_0x6c1e('0x2e')];var _0x2912a8=_0x5f288f?_0x146416['count']:_0x51d859[_0x6c1e('0x2e')]+_0x51d859[_0x6c1e('0x30')];var _0x25b027;if(_0x2912a8>=_0x5b1851){_0x2912a8=_0x5b1851;_0x25b027=0xc8;}else{_0x25b027=0xce;}_0x5973f6[_0x6c1e('0x31')](_0x25b027);return _0x5973f6[_0x6c1e('0x32')](_0x6c1e('0x33'),_0x2842e3+'-'+_0x2912a8+'/'+_0x5b1851)[_0x6c1e('0x2d')](_0x146416);}return null;};}function patchUpdates(_0x9c032){return function(_0x1eb521){try{jsonpatch[_0x6c1e('0x34')](_0x1eb521,_0x9c032,!![]);}catch(_0x32df68){return BPromise[_0x6c1e('0x35')](_0x32df68);}return _0x1eb521[_0x6c1e('0x36')]();};}function saveUpdates(_0x462bb8,_0x47b708){return function(_0x478470){if(_0x478470){return _0x478470[_0x6c1e('0x37')](_0x462bb8)[_0x6c1e('0x21')](function(_0x93971d){return _0x93971d;});}return null;};}function removeEntity(_0x5dfd1a,_0x191410){return function(_0x188da7){if(_0x188da7){return _0x188da7[_0x6c1e('0x38')]()['then'](function(){_0x5dfd1a[_0x6c1e('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x443fed,_0x186086){return function(_0x268974){if(!_0x268974){_0x443fed['sendStatus'](0x194);}return _0x268974;};}function handleError(_0xe1b13f,_0x1bc95a){_0x1bc95a=_0x1bc95a||0x1f4;return function(_0x204e3f){logger[_0x6c1e('0x27')](_0x204e3f[_0x6c1e('0x39')]);if(_0x204e3f[_0x6c1e('0x3a')]){delete _0x204e3f[_0x6c1e('0x3a')];}_0xe1b13f['status'](_0x1bc95a)['send'](_0x204e3f);};}exports[_0x6c1e('0x3b')]=function(_0x5ced23,_0x565d22){var _0x225c5f={},_0x265011={},_0x44ef42={'count':0x0,'rows':[]};var _0x2628ac=_[_0x6c1e('0x3c')](db[_0x6c1e('0x3d')]['rawAttributes'],function(_0x35702d){return{'name':_0x35702d[_0x6c1e('0x3e')],'type':_0x35702d[_0x6c1e('0x3f')][_0x6c1e('0x40')]};});_0x265011[_0x6c1e('0x41')]=_[_0x6c1e('0x3c')](_0x2628ac,_0x6c1e('0x3a'));_0x265011[_0x6c1e('0x42')]=_[_0x6c1e('0x43')](_0x5ced23['query']);_0x265011[_0x6c1e('0x44')]=_[_0x6c1e('0x45')](_0x265011[_0x6c1e('0x41')],_0x265011['query']);_0x225c5f['attributes']=_[_0x6c1e('0x45')](_0x265011[_0x6c1e('0x41')],qs[_0x6c1e('0x46')](_0x5ced23[_0x6c1e('0x42')][_0x6c1e('0x46')]));_0x225c5f[_0x6c1e('0x47')]=_0x225c5f['attributes'][_0x6c1e('0x48')]?_0x225c5f['attributes']:_0x265011[_0x6c1e('0x41')];if(!_0x5ced23[_0x6c1e('0x42')]['hasOwnProperty'](_0x6c1e('0x49'))){_0x225c5f[_0x6c1e('0x30')]=qs[_0x6c1e('0x30')](_0x5ced23['query'][_0x6c1e('0x30')]);_0x225c5f[_0x6c1e('0x2e')]=qs[_0x6c1e('0x2e')](_0x5ced23[_0x6c1e('0x42')][_0x6c1e('0x2e')]);}_0x225c5f[_0x6c1e('0x4a')]=qs[_0x6c1e('0x4b')](_0x5ced23['query'][_0x6c1e('0x4b')]);_0x225c5f['where']=qs[_0x6c1e('0x44')](_[_0x6c1e('0x4c')](_0x5ced23[_0x6c1e('0x42')],_0x265011[_0x6c1e('0x44')]),_0x2628ac);if(_0x5ced23[_0x6c1e('0x42')][_0x6c1e('0x4d')]){_0x225c5f[_0x6c1e('0x4e')]=_['merge'](_0x225c5f[_0x6c1e('0x4e')],{'$or':_[_0x6c1e('0x3c')](_0x2628ac,function(_0xd70f28){if(_0xd70f28['type']!==_0x6c1e('0x4f')){var _0x115d91={};_0x115d91[_0xd70f28['name']]={'$like':'%'+_0x5ced23[_0x6c1e('0x42')]['filter']+'%'};return _0x115d91;}})});}_0x225c5f=_[_0x6c1e('0x50')]({},_0x225c5f,_0x5ced23['options']);var _0x114bee={'where':_0x225c5f[_0x6c1e('0x4e')]};return db[_0x6c1e('0x3d')][_0x6c1e('0x51')](_0x114bee)[_0x6c1e('0x21')](function(_0x361dfc){_0x44ef42[_0x6c1e('0x51')]=_0x361dfc;if(_0x5ced23[_0x6c1e('0x42')]['includeAll']){_0x225c5f[_0x6c1e('0x52')]=[{'all':!![]}];}return db[_0x6c1e('0x3d')][_0x6c1e('0x53')](_0x225c5f);})['then'](function(_0x242dbb){_0x44ef42[_0x6c1e('0x54')]=_0x242dbb;return _0x44ef42;})[_0x6c1e('0x21')](respondWithFilteredResult(_0x565d22,_0x225c5f))[_0x6c1e('0x2b')](handleError(_0x565d22,null));};exports['show']=function(_0x1ab040,_0x17f9db){var _0x25f3c3={'raw':!![],'where':{'id':_0x1ab040[_0x6c1e('0x55')]['id']}},_0x34cb66={};_0x34cb66[_0x6c1e('0x41')]=_[_0x6c1e('0x43')](db[_0x6c1e('0x3d')][_0x6c1e('0x56')]);_0x34cb66['query']=_['keys'](_0x1ab040[_0x6c1e('0x42')]);_0x34cb66[_0x6c1e('0x44')]=_['intersection'](_0x34cb66[_0x6c1e('0x41')],_0x34cb66['query']);_0x25f3c3['attributes']=_[_0x6c1e('0x45')](_0x34cb66[_0x6c1e('0x41')],qs[_0x6c1e('0x46')](_0x1ab040[_0x6c1e('0x42')][_0x6c1e('0x46')]));_0x25f3c3[_0x6c1e('0x47')]=_0x25f3c3[_0x6c1e('0x47')][_0x6c1e('0x48')]?_0x25f3c3[_0x6c1e('0x47')]:_0x34cb66[_0x6c1e('0x41')];if(_0x1ab040['query'][_0x6c1e('0x57')]){_0x25f3c3[_0x6c1e('0x52')]=[{'all':!![]}];}_0x25f3c3=_[_0x6c1e('0x50')]({},_0x25f3c3,_0x1ab040[_0x6c1e('0x58')]);return db[_0x6c1e('0x3d')][_0x6c1e('0x59')](_0x25f3c3)['then'](handleEntityNotFound(_0x17f9db,null))[_0x6c1e('0x21')](respondWithResult(_0x17f9db,null))[_0x6c1e('0x2b')](handleError(_0x17f9db,null));};exports['create']=function(_0x7ce1c8,_0x4e6c4b){return db['OpenchannelMessage'][_0x6c1e('0x5a')](_0x7ce1c8[_0x6c1e('0x5b')],{})['then'](respondWithResult(_0x4e6c4b,0xc9))['catch'](handleError(_0x4e6c4b,null));};exports[_0x6c1e('0x37')]=function(_0x30f971,_0x319522){if(_0x30f971[_0x6c1e('0x5b')]['id']){delete _0x30f971['body']['id'];}return db[_0x6c1e('0x3d')]['find']({'where':{'id':_0x30f971[_0x6c1e('0x55')]['id']}})[_0x6c1e('0x21')](handleEntityNotFound(_0x319522,null))['then'](saveUpdates(_0x30f971['body'],null))[_0x6c1e('0x21')](respondWithResult(_0x319522,null))[_0x6c1e('0x2b')](handleError(_0x319522,null));};exports['destroy']=function(_0x335ee0,_0x3de4d6){return db[_0x6c1e('0x3d')][_0x6c1e('0x59')]({'where':{'id':_0x335ee0[_0x6c1e('0x55')]['id']}})[_0x6c1e('0x21')](handleEntityNotFound(_0x3de4d6,null))[_0x6c1e('0x21')](removeEntity(_0x3de4d6,null))['catch'](handleError(_0x3de4d6,null));};exports[_0x6c1e('0x5c')]=function(_0x452598,_0x4994d9){return db['OpenchannelMessage'][_0x6c1e('0x5c')]()[_0x6c1e('0x21')](respondWithResult(_0x4994d9,null))[_0x6c1e('0x2b')](handleError(_0x4994d9,null));};var interaction_log=require('../../config/logger')(_0x6c1e('0x5d'));exports[_0x6c1e('0x5e')]=function(_0x424f68,_0xd47be9,_0x5a261b){var _0xdc4a7f={'agent':{},'channel':_0x6c1e('0x5f')};if(_0x424f68[_0x6c1e('0x5b')]['id']){delete _0x424f68[_0x6c1e('0x5b')]['id'];}_0x424f68['body'][_0x6c1e('0x60')]=!![];_0x424f68[_0x6c1e('0x5b')]['readAt']=moment()[_0x6c1e('0x61')](_0x6c1e('0x62'));_0x424f68[_0x6c1e('0x5b')]['UserId']=_0x424f68[_0x6c1e('0x5b')][_0x6c1e('0x63')]||_0x424f68[_0x6c1e('0x64')]['id'];_0xdc4a7f[_0x6c1e('0x65')]['id']=_0x424f68['body'][_0x6c1e('0x63')];return db[_0x6c1e('0x3d')][_0x6c1e('0x59')]({'where':{'id':_0x424f68['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0xd47be9,null))[_0x6c1e('0x21')](saveUpdates(_0x424f68[_0x6c1e('0x5b')],null))['then'](function(_0x18e4b9){if(_0x18e4b9){_0xdc4a7f[_0x6c1e('0x29')]=_0x18e4b9[_0x6c1e('0x66')]({'plain':!![]});return db[_0x6c1e('0x67')]['find']({'where':{'id':_0x18e4b9['OpenchannelInteractionId']}});}return null;})[_0x6c1e('0x21')](handleEntityNotFound(_0xd47be9,null))[_0x6c1e('0x21')](function(_0x53125e){if(_0x53125e){return _0x53125e[_0x6c1e('0x37')]({'UserId':_0x424f68['body'][_0x6c1e('0x63')],'read1stAt':_[_0x6c1e('0x68')](_0x53125e['read1stAt'])?moment()[_0x6c1e('0x61')](_0x6c1e('0x62')):undefined});}return null;})[_0x6c1e('0x21')](function(_0x4d2a6d){if(_0x4d2a6d){_0xdc4a7f['interaction']=_0x4d2a6d[_0x6c1e('0x66')]({'plain':!![]});interaction_log[_0x6c1e('0x22')](_0x6c1e('0x69'),_0x424f68[_0x6c1e('0x64')]['id'],_0x424f68['user'][_0x6c1e('0x3a')],_0x424f68[_0x6c1e('0x64')][_0x6c1e('0x6a')],_0xdc4a7f[_0x6c1e('0x6b')]['id'],_0x424f68['body']?JSON[_0x6c1e('0x26')](_0x424f68[_0x6c1e('0x5b')]):_0x6c1e('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x6c1e('0x6d'),_0xdc4a7f);}return null;})['then'](function(_0x3864fe){var _0x33f810=_0x6c1e('0x6e')+_0x3864fe[_0x6c1e('0x29')][_0x6c1e('0x6f')];return db[_0x6c1e('0x70')][_0x6c1e('0x42')](_0x33f810,{'type':db[_0x6c1e('0x71')][_0x6c1e('0x72')][_0x6c1e('0x73')],'raw':!![]})[_0x6c1e('0x21')](function(_0x55daca){return _0x55daca;});})[_0x6c1e('0x21')](function(_0x2e76f1){if(_0x2e76f1){_0xdc4a7f['message'][_0x6c1e('0x74')]=_0x2e76f1[0x0];if(!_0x424f68[_0x6c1e('0x5b')][_0x6c1e('0x63')])return;return db['User'][_0x6c1e('0x59')]({'where':{'id':_0x424f68[_0x6c1e('0x5b')][_0x6c1e('0x63')],'role':_0x6c1e('0x65')},'attributes':['id',_0x6c1e('0x3a'),_0x6c1e('0x75'),'email',_0x6c1e('0x76')],'raw':!![]});}return null;})['then'](function(_0x2add5a){if(!_0x2add5a)return null;_0xdc4a7f[_0x6c1e('0x29')][_0x6c1e('0x65')]=_0x2add5a;return _0xdc4a7f;})[_0x6c1e('0x21')](function(_0xca14a3){if(_0xca14a3){if(_0x424f68[_0x6c1e('0x5b')][_0x6c1e('0x77')]){_0xdc4a7f['message'][_0x6c1e('0x78')]=util['format'](_0x6c1e('0x79'),_0x424f68[_0x6c1e('0x64')][_0x6c1e('0x3a')]);_0xdc4a7f[_0x6c1e('0x29')][_0x6c1e('0x7a')]=_0xdc4a7f[_0x6c1e('0x7a')];_0xdc4a7f[_0x6c1e('0x29')][_0x6c1e('0x7b')]=_0xdc4a7f[_0x6c1e('0x7a')];_0xdc4a7f['message'][_0x6c1e('0x7c')]=_0x6c1e('0x5e');return respondWithRpcPromise(_0x6c1e('0x7d'),_0x6c1e('0x7d'),{'event':_0x6c1e('0x7e'),'message':_0xdc4a7f['message']},client9002)[_0x6c1e('0x21')](function(){return _0xdc4a7f;});}return _0xdc4a7f;}return null;})[_0x6c1e('0x21')](respondWithResult(_0xd47be9,null))[_0x6c1e('0x2b')](handleError(_0xd47be9,null));};var interaction_log=require(_0x6c1e('0x13'))(_0x6c1e('0x5d'));exports[_0x6c1e('0x35')]=function(_0x8c435c,_0x32886c,_0x48d2fe){var _0x2c3fe4={'agent':{},'channel':_0x6c1e('0x5f')};if(_0x8c435c[_0x6c1e('0x5b')]['id']){delete _0x8c435c[_0x6c1e('0x5b')]['id'];}_0x8c435c[_0x6c1e('0x5b')][_0x6c1e('0x63')]=_0x8c435c[_0x6c1e('0x5b')][_0x6c1e('0x63')]||_0x8c435c['user']['id'];_0x2c3fe4[_0x6c1e('0x65')]['id']=_0x8c435c[_0x6c1e('0x5b')][_0x6c1e('0x63')];return db['OpenchannelMessage'][_0x6c1e('0x59')]({'where':{'id':_0x8c435c[_0x6c1e('0x55')]['id'],'UserId':null}})[_0x6c1e('0x21')](handleEntityNotFound(_0x32886c,null))['then'](function(_0x45fec2){if(_0x45fec2){_0x2c3fe4['message']=_0x45fec2[_0x6c1e('0x66')]({'plain':!![]});return db[_0x6c1e('0x67')]['find']({'where':{'id':_0x45fec2[_0x6c1e('0x7f')]}});}return null;})[_0x6c1e('0x21')](handleEntityNotFound(_0x32886c,null))['then'](function(_0x562299){if(_0x562299){_0x2c3fe4[_0x6c1e('0x6b')]=_0x562299[_0x6c1e('0x66')]({'plain':!![]});interaction_log['info'](_0x6c1e('0x80'),_0x8c435c[_0x6c1e('0x64')]['id'],_0x8c435c[_0x6c1e('0x64')][_0x6c1e('0x3a')],_0x8c435c['user'][_0x6c1e('0x6a')],_0x2c3fe4[_0x6c1e('0x6b')]['id'],_0x8c435c['body']?JSON[_0x6c1e('0x26')](_0x8c435c[_0x6c1e('0x5b')]):_0x6c1e('0x6c'));return respondWithRpcPromise(_0x6c1e('0x81'),_0x6c1e('0x82'),_0x2c3fe4);}return null;})[_0x6c1e('0x21')](function(_0x41054f){var _0x86e202=_0x6c1e('0x6e')+_0x41054f['message'][_0x6c1e('0x6f')];return db[_0x6c1e('0x70')][_0x6c1e('0x42')](_0x86e202,{'type':db[_0x6c1e('0x71')]['QueryTypes'][_0x6c1e('0x73')],'raw':!![]})[_0x6c1e('0x21')](function(_0x446a86){return _0x446a86;});})[_0x6c1e('0x21')](function(_0x85c7c9){if(_0x85c7c9){_0x2c3fe4['message']['contact']=_0x85c7c9[0x0];if(!_0x8c435c[_0x6c1e('0x5b')][_0x6c1e('0x63')])return;return db[_0x6c1e('0x83')][_0x6c1e('0x59')]({'where':{'id':_0x8c435c['body'][_0x6c1e('0x63')],'role':_0x6c1e('0x65')},'attributes':['id',_0x6c1e('0x3a'),_0x6c1e('0x75'),_0x6c1e('0x84'),_0x6c1e('0x76')],'raw':!![]});}return null;})['then'](function(_0x1c9176){if(!_0x1c9176)return null;_0x2c3fe4[_0x6c1e('0x29')][_0x6c1e('0x65')]=_0x1c9176;return _0x2c3fe4;})['then'](function(_0x2a4307){if(_0x2a4307){_0x2a4307[_0x6c1e('0x29')][_0x6c1e('0x78')]=util[_0x6c1e('0x61')](_0x6c1e('0x79'),_0x8c435c[_0x6c1e('0x64')][_0x6c1e('0x3a')]);_0x2a4307[_0x6c1e('0x29')][_0x6c1e('0x7a')]=_0x2c3fe4[_0x6c1e('0x7a')];_0x2a4307[_0x6c1e('0x29')][_0x6c1e('0x7b')]=_0x2c3fe4[_0x6c1e('0x7a')];_0x2a4307['message'][_0x6c1e('0x7c')]=_0x6c1e('0x35');respondWithRpcPromise(_0x6c1e('0x7d'),_0x6c1e('0x7d'),{'event':_0x6c1e('0x85'),'message':_0x2a4307['message']},client9002);return _0x2c3fe4;}return null;})[_0x6c1e('0x21')](respondWithResult(_0x32886c,null))[_0x6c1e('0x2b')](handleError(_0x32886c,null));}; \ No newline at end of file +var _0x4b8d=['stack','name','index','OpenchannelMessage','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','show','rawAttributes','includeAll','create','body','find','params','describe','openchannel','acceptMessage','reject','UserId','user','agent','get','OpenchannelInteraction','interaction','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','fullname','email','internal','interface','format','channel','motionChannel','event','EventManager','rejectmessage','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','openchannel-interactions','then','info','debug','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','sendStatus'];(function(_0x279f6d,_0x122316){var _0x5874a5=function(_0x4823ae){while(--_0x4823ae){_0x279f6d['push'](_0x279f6d['shift']());}};_0x5874a5(++_0x122316);}(_0x4b8d,0x174));var _0xd4b8=function(_0x19aa84,_0x549537){_0x19aa84=_0x19aa84-0x0;var _0x536146=_0x4b8d[_0x19aa84];return _0x536146;};'use strict';var util=require(_0xd4b8('0x0'));var _=require(_0xd4b8('0x1'));var Redis=require(_0xd4b8('0x2'));var interactionService=require(_0xd4b8('0x3'));var qs=require(_0xd4b8('0x4'));var logger=require(_0xd4b8('0x5'))(_0xd4b8('0x6'));var config=require(_0xd4b8('0x7'));var db=require(_0xd4b8('0x8'))['db'];config[_0xd4b8('0x9')]=_[_0xd4b8('0xa')](config[_0xd4b8('0x9')],{'host':_0xd4b8('0xb'),'port':0x18eb});var socket=require(_0xd4b8('0xc'))(new Redis(config[_0xd4b8('0x9')]));require(_0xd4b8('0xd'))[_0xd4b8('0xe')](socket);var jayson=require(_0xd4b8('0xf'));var client=jayson[_0xd4b8('0x10')]['http']({'port':0x232c});var client9002=jayson[_0xd4b8('0x10')][_0xd4b8('0x11')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0xd4b8('0x12'));function respondWithRpcPromise(_0x1fc1be,_0xd7ee76,_0x4fe9d5,_0x1b1ec6){return new Promise(function(_0x435951,_0xead079){var _0x59fd5a=_0x1b1ec6||client;return _0x59fd5a['request'](_0x1fc1be,_0x4fe9d5)[_0xd4b8('0x13')](function(_0x18a84b){logger[_0xd4b8('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0xd7ee76,'request\x20sent');logger[_0xd4b8('0x15')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0xd7ee76,'request\x20sent',JSON[_0xd4b8('0x16')](_0x18a84b));if(_0x18a84b['error']){if(_0x18a84b[_0xd4b8('0x17')][_0xd4b8('0x18')]===0x1f4){logger['error'](_0xd4b8('0x19'),_0xd7ee76,_0x18a84b[_0xd4b8('0x17')][_0xd4b8('0x1a')]);return _0xead079(_0x18a84b['error'][_0xd4b8('0x1a')]);}logger['error'](_0xd4b8('0x19'),_0xd7ee76,_0x18a84b['error'][_0xd4b8('0x1a')]);return _0x435951(_0x18a84b[_0xd4b8('0x17')][_0xd4b8('0x1a')]);}else{logger[_0xd4b8('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0xd7ee76,'request\x20sent');_0x435951(_0x18a84b[_0xd4b8('0x1b')][_0xd4b8('0x1a')]);}})[_0xd4b8('0x1c')](function(_0xddcbd1){logger[_0xd4b8('0x17')](_0xd4b8('0x19'),_0xd7ee76,_0xddcbd1);_0xead079(_0xddcbd1);});});}function respondWithResult(_0x548223,_0x5361e6){_0x5361e6=_0x5361e6||0xc8;return function(_0x15e8f1){if(_0x15e8f1){return _0x548223['status'](_0x5361e6)[_0xd4b8('0x1d')](_0x15e8f1);}};}function respondWithFilteredResult(_0x47716d,_0x4a28c4){return function(_0x2e32b9){if(_0x2e32b9){var _0x424a54=typeof _0x4a28c4[_0xd4b8('0x1e')]===_0xd4b8('0x1f')&&typeof _0x4a28c4[_0xd4b8('0x20')]===_0xd4b8('0x1f');var _0x3a8e15=_0x2e32b9['count'];var _0x4d5f80=_0x424a54?0x0:_0x4a28c4[_0xd4b8('0x1e')];var _0x4c4c75=_0x424a54?_0x2e32b9[_0xd4b8('0x21')]:_0x4a28c4['offset']+_0x4a28c4[_0xd4b8('0x20')];var _0x503baf;if(_0x4c4c75>=_0x3a8e15){_0x4c4c75=_0x3a8e15;_0x503baf=0xc8;}else{_0x503baf=0xce;}_0x47716d[_0xd4b8('0x22')](_0x503baf);return _0x47716d[_0xd4b8('0x23')](_0xd4b8('0x24'),_0x4d5f80+'-'+_0x4c4c75+'/'+_0x3a8e15)[_0xd4b8('0x1d')](_0x2e32b9);}return null;};}function saveUpdates(_0x37988d){return function(_0x39543f){if(_0x39543f){return _0x39543f[_0xd4b8('0x25')](_0x37988d)[_0xd4b8('0x13')](function(_0x3a0ab3){return _0x3a0ab3;});}return null;};}function removeEntity(_0x18c18d){return function(_0x118759){if(_0x118759){return _0x118759[_0xd4b8('0x26')]()['then'](function(){_0x18c18d[_0xd4b8('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfc0032){return function(_0xf55fec){if(!_0xf55fec){_0xfc0032[_0xd4b8('0x27')](0x194);}return _0xf55fec;};}function handleError(_0x2cbff2,_0x161973){_0x161973=_0x161973||0x1f4;return function(_0x31af37){logger['error'](_0x31af37[_0xd4b8('0x28')]);if(_0x31af37['name']){delete _0x31af37[_0xd4b8('0x29')];}_0x2cbff2['status'](_0x161973)['send'](_0x31af37);};}exports[_0xd4b8('0x2a')]=function(_0x7807ee,_0x30b4cf){var _0x4ecc5c={},_0x19899d={},_0x24eca1={'count':0x0,'rows':[]};var _0x34a987=_['map'](db[_0xd4b8('0x2b')]['rawAttributes'],function(_0xd2fbb9){return{'name':_0xd2fbb9[_0xd4b8('0x2c')],'type':_0xd2fbb9[_0xd4b8('0x2d')][_0xd4b8('0x2e')]};});_0x19899d[_0xd4b8('0x2f')]=_[_0xd4b8('0x30')](_0x34a987,'name');_0x19899d[_0xd4b8('0x31')]=_['keys'](_0x7807ee[_0xd4b8('0x31')]);_0x19899d[_0xd4b8('0x32')]=_[_0xd4b8('0x33')](_0x19899d[_0xd4b8('0x2f')],_0x19899d[_0xd4b8('0x31')]);_0x4ecc5c[_0xd4b8('0x34')]=_[_0xd4b8('0x33')](_0x19899d['model'],qs['fields'](_0x7807ee[_0xd4b8('0x31')][_0xd4b8('0x35')]));_0x4ecc5c[_0xd4b8('0x34')]=_0x4ecc5c[_0xd4b8('0x34')][_0xd4b8('0x36')]?_0x4ecc5c[_0xd4b8('0x34')]:_0x19899d[_0xd4b8('0x2f')];if(!_0x7807ee['query'][_0xd4b8('0x37')](_0xd4b8('0x38'))){_0x4ecc5c['limit']=qs[_0xd4b8('0x20')](_0x7807ee[_0xd4b8('0x31')][_0xd4b8('0x20')]);_0x4ecc5c[_0xd4b8('0x1e')]=qs[_0xd4b8('0x1e')](_0x7807ee['query']['offset']);}_0x4ecc5c[_0xd4b8('0x39')]=qs[_0xd4b8('0x3a')](_0x7807ee[_0xd4b8('0x31')][_0xd4b8('0x3a')]);_0x4ecc5c[_0xd4b8('0x3b')]=qs['filters'](_[_0xd4b8('0x3c')](_0x7807ee['query'],_0x19899d[_0xd4b8('0x32')]),_0x34a987);if(_0x7807ee[_0xd4b8('0x31')]['filter']){_0x4ecc5c['where']=_[_0xd4b8('0x3d')](_0x4ecc5c['where'],{'$or':_['map'](_0x34a987,function(_0x4055b7){if(_0x4055b7[_0xd4b8('0x2d')]!==_0xd4b8('0x3e')){var _0x29f7f6={};_0x29f7f6[_0x4055b7[_0xd4b8('0x29')]]={'$like':'%'+_0x7807ee[_0xd4b8('0x31')]['filter']+'%'};return _0x29f7f6;}})});}_0x4ecc5c=_[_0xd4b8('0x3d')]({},_0x4ecc5c,_0x7807ee[_0xd4b8('0x3f')]);var _0x4e26a6={'where':_0x4ecc5c[_0xd4b8('0x3b')]};return db[_0xd4b8('0x2b')][_0xd4b8('0x21')](_0x4e26a6)[_0xd4b8('0x13')](function(_0x4fd279){_0x24eca1[_0xd4b8('0x21')]=_0x4fd279;if(_0x7807ee[_0xd4b8('0x31')]['includeAll']){_0x4ecc5c[_0xd4b8('0x40')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xd4b8('0x41')](_0x4ecc5c);})[_0xd4b8('0x13')](function(_0x1e51a6){_0x24eca1['rows']=_0x1e51a6;return _0x24eca1;})[_0xd4b8('0x13')](respondWithFilteredResult(_0x30b4cf,_0x4ecc5c))[_0xd4b8('0x1c')](handleError(_0x30b4cf,null));};exports[_0xd4b8('0x42')]=function(_0xfdba58,_0x13d348){var _0x5e2f55={'raw':!![],'where':{'id':_0xfdba58['params']['id']}},_0x1cd9a6={};_0x1cd9a6['model']=_['keys'](db['OpenchannelMessage'][_0xd4b8('0x43')]);_0x1cd9a6[_0xd4b8('0x31')]=_['keys'](_0xfdba58[_0xd4b8('0x31')]);_0x1cd9a6[_0xd4b8('0x32')]=_[_0xd4b8('0x33')](_0x1cd9a6[_0xd4b8('0x2f')],_0x1cd9a6[_0xd4b8('0x31')]);_0x5e2f55['attributes']=_['intersection'](_0x1cd9a6['model'],qs[_0xd4b8('0x35')](_0xfdba58[_0xd4b8('0x31')][_0xd4b8('0x35')]));_0x5e2f55['attributes']=_0x5e2f55[_0xd4b8('0x34')][_0xd4b8('0x36')]?_0x5e2f55[_0xd4b8('0x34')]:_0x1cd9a6[_0xd4b8('0x2f')];if(_0xfdba58[_0xd4b8('0x31')][_0xd4b8('0x44')]){_0x5e2f55[_0xd4b8('0x40')]=[{'all':!![]}];}_0x5e2f55=_[_0xd4b8('0x3d')]({},_0x5e2f55,_0xfdba58[_0xd4b8('0x3f')]);return db[_0xd4b8('0x2b')]['find'](_0x5e2f55)[_0xd4b8('0x13')](handleEntityNotFound(_0x13d348,null))['then'](respondWithResult(_0x13d348,null))['catch'](handleError(_0x13d348,null));};exports[_0xd4b8('0x45')]=function(_0x2473ad,_0x332377){return db[_0xd4b8('0x2b')][_0xd4b8('0x45')](_0x2473ad[_0xd4b8('0x46')],{})[_0xd4b8('0x13')](respondWithResult(_0x332377,0xc9))[_0xd4b8('0x1c')](handleError(_0x332377,null));};exports[_0xd4b8('0x25')]=function(_0x46d5b5,_0x22ec88){if(_0x46d5b5['body']['id']){delete _0x46d5b5[_0xd4b8('0x46')]['id'];}return db[_0xd4b8('0x2b')][_0xd4b8('0x47')]({'where':{'id':_0x46d5b5[_0xd4b8('0x48')]['id']}})[_0xd4b8('0x13')](handleEntityNotFound(_0x22ec88,null))['then'](saveUpdates(_0x46d5b5[_0xd4b8('0x46')],null))[_0xd4b8('0x13')](respondWithResult(_0x22ec88,null))['catch'](handleError(_0x22ec88,null));};exports[_0xd4b8('0x26')]=function(_0x3bbe7a,_0x57fb50){return db[_0xd4b8('0x2b')][_0xd4b8('0x47')]({'where':{'id':_0x3bbe7a[_0xd4b8('0x48')]['id']}})[_0xd4b8('0x13')](handleEntityNotFound(_0x57fb50,null))[_0xd4b8('0x13')](removeEntity(_0x57fb50,null))[_0xd4b8('0x1c')](handleError(_0x57fb50,null));};exports[_0xd4b8('0x49')]=function(_0x51a06e,_0x34fcb7){return db[_0xd4b8('0x2b')][_0xd4b8('0x49')]()[_0xd4b8('0x13')](respondWithResult(_0x34fcb7,null))[_0xd4b8('0x1c')](handleError(_0x34fcb7,null));};exports['accept']=function(_0x3aee99,_0x399502){var _0xe83a06=_0xd4b8('0x4a');return interactionService[_0xd4b8('0x4b')](_0x3aee99,_0xe83a06)[_0xd4b8('0x13')](respondWithResult(_0x399502,null))['catch'](handleError(_0x399502,null));};exports[_0xd4b8('0x4c')]=function(_0x2ef1f2,_0x158260){var _0x44befb={'agent':{},'channel':_0xd4b8('0x4a')};if(_0x2ef1f2['body']['id']){delete _0x2ef1f2[_0xd4b8('0x46')]['id'];}_0x2ef1f2['body'][_0xd4b8('0x4d')]=_0x2ef1f2[_0xd4b8('0x46')][_0xd4b8('0x4d')]||_0x2ef1f2[_0xd4b8('0x4e')]['id'];_0x44befb[_0xd4b8('0x4f')]['id']=_0x2ef1f2['body']['UserId'];return db[_0xd4b8('0x2b')][_0xd4b8('0x47')]({'where':{'id':_0x2ef1f2[_0xd4b8('0x48')]['id'],'UserId':null}})[_0xd4b8('0x13')](handleEntityNotFound(_0x158260,null))[_0xd4b8('0x13')](function(_0x3aae1b){if(_0x3aae1b){_0x44befb[_0xd4b8('0x1a')]=_0x3aae1b[_0xd4b8('0x50')]({'plain':!![]});return db[_0xd4b8('0x51')][_0xd4b8('0x47')]({'where':{'id':_0x3aae1b['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x158260,null))['then'](function(_0x4c18cc){if(_0x4c18cc){_0x44befb[_0xd4b8('0x52')]=_0x4c18cc[_0xd4b8('0x50')]({'plain':!![]});interaction_log[_0xd4b8('0x14')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2ef1f2[_0xd4b8('0x4e')]['id'],_0x2ef1f2[_0xd4b8('0x4e')][_0xd4b8('0x29')],_0x2ef1f2[_0xd4b8('0x4e')][_0xd4b8('0x53')],_0x44befb[_0xd4b8('0x52')]['id'],_0x2ef1f2[_0xd4b8('0x46')]?JSON[_0xd4b8('0x16')](_0x2ef1f2[_0xd4b8('0x46')]):_0xd4b8('0x54'));return respondWithRpcPromise(_0xd4b8('0x55'),_0xd4b8('0x56'),_0x44befb);}return null;})['then'](function(_0x584327){var _0x16206a=_0xd4b8('0x57')+_0x584327[_0xd4b8('0x1a')][_0xd4b8('0x58')];return db[_0xd4b8('0x59')]['query'](_0x16206a,{'type':db[_0xd4b8('0x5a')]['QueryTypes'][_0xd4b8('0x5b')],'raw':!![]})[_0xd4b8('0x13')](function(_0x29de86){return _0x29de86;});})[_0xd4b8('0x13')](function(_0x2063e7){if(_0x2063e7){_0x44befb['message']['contact']=_0x2063e7[0x0];if(!_0x2ef1f2['body']['UserId'])return;return db[_0xd4b8('0x5c')][_0xd4b8('0x47')]({'where':{'id':_0x2ef1f2['body'][_0xd4b8('0x4d')],'role':_0xd4b8('0x4f')},'attributes':['id','name',_0xd4b8('0x5d'),_0xd4b8('0x5e'),_0xd4b8('0x5f')],'raw':!![]});}return null;})[_0xd4b8('0x13')](function(_0x1c9191){if(!_0x1c9191)return null;_0x44befb[_0xd4b8('0x1a')][_0xd4b8('0x4f')]=_0x1c9191;return _0x44befb;})['then'](function(_0x47e17d){if(_0x47e17d){_0x47e17d[_0xd4b8('0x1a')][_0xd4b8('0x60')]=util[_0xd4b8('0x61')]('SIP/%s',_0x2ef1f2[_0xd4b8('0x4e')][_0xd4b8('0x29')]);_0x47e17d[_0xd4b8('0x1a')][_0xd4b8('0x62')]=_0x44befb[_0xd4b8('0x62')];_0x47e17d['message'][_0xd4b8('0x63')]=_0x44befb[_0xd4b8('0x62')];_0x47e17d[_0xd4b8('0x1a')][_0xd4b8('0x64')]='reject';respondWithRpcPromise(_0xd4b8('0x65'),_0xd4b8('0x65'),{'event':_0xd4b8('0x66'),'message':_0x47e17d['message']},client9002);return _0x44befb;}return null;})[_0xd4b8('0x13')](respondWithResult(_0x158260,null))[_0xd4b8('0x1c')](handleError(_0x158260,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 7daaefe..eec2082 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 _0xaa9f=['OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa9f,0x12a));var _0xfaa9=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0xaa9f[_0x2a7b8e];return _0x29b5c8;};'use strict';var EventEmitter=require(_0xfaa9('0x0'));var OpenchannelMessage=require(_0xfaa9('0x1'))['db'][_0xfaa9('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xfaa9('0x3')](0x0);var events={'afterCreate':_0xfaa9('0x4'),'afterUpdate':_0xfaa9('0x5'),'afterDestroy':_0xfaa9('0x6')};function emitEvent(_0x1b5d19){return function(_0x39aaf9,_0x160900,_0x3dc0fe){OpenchannelMessageEvents[_0xfaa9('0x7')](_0x1b5d19+':'+_0x39aaf9['id'],_0x39aaf9);OpenchannelMessageEvents[_0xfaa9('0x7')](_0x1b5d19,_0x39aaf9);_0x3dc0fe(null);};}for(var e in events){if(events[_0xfaa9('0x8')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xfaa9('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x36c8=['events','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x2394fd,_0x5e8f2b){var _0x4caa72=function(_0x294536){while(--_0x294536){_0x2394fd['push'](_0x2394fd['shift']());}};_0x4caa72(++_0x5e8f2b);}(_0x36c8,0x190));var _0x836c=function(_0x3d9557,_0x5d09d2){_0x3d9557=_0x3d9557-0x0;var _0x359ff8=_0x36c8[_0x3d9557];return _0x359ff8;};'use strict';var EventEmitter=require(_0x836c('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x836c('0x1')](0x0);var events={'afterCreate':_0x836c('0x2'),'afterUpdate':_0x836c('0x3'),'afterDestroy':_0x836c('0x4')};function emitEvent(_0x5234eb){return function(_0x493fef,_0x171694,_0x13d635){OpenchannelMessageEvents[_0x836c('0x5')](_0x5234eb+':'+_0x493fef['id'],_0x493fef);OpenchannelMessageEvents[_0x836c('0x5')](_0x5234eb,_0x493fef);_0x13d635(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x836c('0x6')](e,emitEvent(event));}}module[_0x836c('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 e124c34..868db45 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 _0x714c=['moment','bluebird','request-promise','../../config/environment','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','find','Interactions','keys','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','omit','Contact','method','GET','POST','info','threadId','Interaction','inspect','finally','utf8mb4','lodash','../../config/logger'];(function(_0x37053d,_0x15ba93){var _0x45dcd8=function(_0x2e30b9){while(--_0x2e30b9){_0x37053d['push'](_0x37053d['shift']());}};_0x45dcd8(++_0x15ba93);}(_0x714c,0x147));var _0xc714=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0x714c[_0x462999];return _0x4b1366;};'use strict';var _=require(_0xc714('0x0'));var util=require('util');var logger=require(_0xc714('0x1'))('api');var moment=require(_0xc714('0x2'));var BPromise=require(_0xc714('0x3'));var rp=require(_0xc714('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc714('0x5'));var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x28033f,_0x46feb5){return _0x28033f[_0xc714('0x6')](_0xc714('0x7'),attributes,{'tableName':_0xc714('0x8'),'paranoid':![],'indexes':[{'name':_0xc714('0x9'),'fields':[_0xc714('0xa')],'type':_0xc714('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a0a0a,_0x5f5603,_0x34e71a){var _0x3dbaff=_0x28033f[_0xc714('0xc')];var _0x544702=_0x3a0a0a[_0xc714('0xd')]({'plain':!![]});if(_0x544702[_0xc714('0xe')][_0xc714('0xf')]()==='in'||_0x544702['direction'][_0xc714('0xf')]()===_0xc714('0x10')&&!_0x544702[_0xc714('0x11')]&&!_['isNil'](_0x544702[_0xc714('0x12')])){_0x3dbaff[_0xc714('0x13')][_0xc714('0x14')]({'where':{'id':_0x544702[_0xc714('0x15')]}})[_0xc714('0x16')](function(_0x37febb){if(_0x37febb){_0x37febb[_0xc714('0x17')]({'lastMsgAt':_0x544702[_0xc714('0x18')],'lastMsgDirection':_0x544702[_0xc714('0xe')]['toLowerCase']()});}})[_0xc714('0x19')](function(_0x4d7b2b){console[_0xc714('0x1a')](_0x4d7b2b);});}if(_0x544702[_0xc714('0xe')]===_0xc714('0x10')&&!_0x544702[_0xc714('0x11')]){var _0x4e0014;_0x3dbaff[_0xc714('0x1b')]['describe']()[_0xc714('0x16')](function(_0x416109){return _0x3dbaff['OpenchannelAccount'][_0xc714('0x1c')]({'where':{'id':_0x544702['OpenchannelAccountId']},'include':[{'model':_0x3dbaff[_0xc714('0x13')],'as':_0xc714('0x1d'),'where':{'id':_0x544702[_0xc714('0x15')]},'limit':0x1,'include':[{'model':_0x3dbaff[_0xc714('0x1b')],'as':'Contact','attributes':_[_0xc714('0x1e')](_0x416109)}]}]});})['then'](function(_0x4fd367){_0x4e0014=_0x4fd367[_0xc714('0xd')]({'plain':!![]});if(_0x4e0014&&_0x4e0014['replyUri']){logger['info'](_0xc714('0x1f'),_0xc714('0x20'),util[_0xc714('0x21')](_0xc714('0x22'),_0x544702['id'],_0x4e0014[_0xc714('0x23')]));if(_0x4e0014[_0xc714('0x1d')]&&_0x4e0014[_0xc714('0x1d')]['length']){_0x544702['Interaction']=_[_0xc714('0x24')](_0x4e0014[_0xc714('0x1d')][0x0],_0xc714('0x25'));_0x544702[_0xc714('0x25')]=_0x4e0014[_0xc714('0x1d')][0x0][_0xc714('0x25')];}var _0x5f5603={'method':'POST','uri':encodeURI(_0x4e0014[_0xc714('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5f5603[_0xc714('0x26')]){case _0xc714('0x27'):_0x5f5603['qs']=_0x544702;break;case _0xc714('0x28'):_0x5f5603[_0xc714('0xa')]=_0x544702;break;}return rp(_0x5f5603)[_0xc714('0x16')](function(_0x5127e2){logger[_0xc714('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0xc714('0x20'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x544702['id'],_0x4e0014[_0xc714('0x23')]));if(_0x5127e2[_0xc714('0xa')][_0xc714('0x2a')]&&_0x5127e2[_0xc714('0xa')][_0xc714('0x2a')]!=_0x544702[_0xc714('0x2b')][_0xc714('0x2a')]){return _0x3dbaff[_0xc714('0x13')][_0xc714('0x17')]({'threadId':_0x5127e2[_0xc714('0xa')][_0xc714('0x2a')]},{'where':{'id':_0x544702[_0xc714('0x2b')]['id']}});}else{return;}})[_0xc714('0x16')](function(){return _0x3a0a0a[_0xc714('0x17')]({'read':!![]});})[_0xc714('0x19')](function(_0x5c59e8){logger[_0xc714('0x1a')](_0xc714('0x1f'),_0xc714('0x20'),util[_0xc714('0x2c')](_0x5c59e8,{'showHidden':![],'depth':null}));_0x34e71a();});}else{_0x34e71a();}})[_0xc714('0x2d')](function(){_0x34e71a();});}else{_0x34e71a();}}},'charset':_0xc714('0x2e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9620=['then','update','createdAt','out','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','keys','get','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','GET','info','body','threadId','catch','error','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','direction','toLowerCase','isNil','UserId','findOne','OpenchannelInteractionId'];(function(_0xafc64b,_0x21584c){var _0x3dab70=function(_0x2fe103){while(--_0x2fe103){_0xafc64b['push'](_0xafc64b['shift']());}};_0x3dab70(++_0x21584c);}(_0x9620,0x18d));var _0x0962=function(_0x7f429c,_0x46d438){_0x7f429c=_0x7f429c-0x0;var _0x465bd6=_0x9620[_0x7f429c];return _0x465bd6;};'use strict';var _=require(_0x0962('0x0'));var util=require(_0x0962('0x1'));var logger=require('../../config/logger')(_0x0962('0x2'));var moment=require(_0x0962('0x3'));var BPromise=require('bluebird');var rp=require(_0x0962('0x4'));var fs=require('fs');var path=require(_0x0962('0x5'));var rimraf=require(_0x0962('0x6'));var config=require(_0x0962('0x7'));var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x58c603,_0x337639){return _0x58c603[_0x0962('0x8')](_0x0962('0x9'),attributes,{'tableName':_0x0962('0xa'),'paranoid':![],'indexes':[{'name':_0x0962('0xb'),'fields':['body'],'type':_0x0962('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x364a21,_0x7b2a3a,_0x299aef){var _0x400427=_0x58c603['models'];var _0x2ad61f=_0x364a21['get']({'plain':!![]});if(_0x2ad61f[_0x0962('0xd')][_0x0962('0xe')]()==='in'||_0x2ad61f[_0x0962('0xd')][_0x0962('0xe')]()==='out'&&!_0x2ad61f['secret']&&!_[_0x0962('0xf')](_0x2ad61f[_0x0962('0x10')])){_0x400427['OpenchannelInteraction'][_0x0962('0x11')]({'where':{'id':_0x2ad61f[_0x0962('0x12')]}})[_0x0962('0x13')](function(_0x11aff2){if(_0x11aff2){_0x11aff2[_0x0962('0x14')]({'lastMsgAt':_0x2ad61f[_0x0962('0x15')],'lastMsgDirection':_0x2ad61f[_0x0962('0xd')][_0x0962('0xe')]()});}})['catch'](function(_0x398f4d){console['error'](_0x398f4d);});}if(_0x2ad61f[_0x0962('0xd')]===_0x0962('0x16')&&!_0x2ad61f[_0x0962('0x17')]){var _0x5abc98;_0x400427[_0x0962('0x18')][_0x0962('0x19')]()[_0x0962('0x13')](function(_0x1043c3){return _0x400427[_0x0962('0x1a')][_0x0962('0x1b')]({'where':{'id':_0x2ad61f[_0x0962('0x1c')]},'include':[{'model':_0x400427[_0x0962('0x1d')],'as':_0x0962('0x1e'),'where':{'id':_0x2ad61f[_0x0962('0x12')]},'limit':0x1,'include':[{'model':_0x400427[_0x0962('0x18')],'as':_0x0962('0x1f'),'attributes':_[_0x0962('0x20')](_0x1043c3)}]}]});})['then'](function(_0x244e3a){_0x5abc98=_0x244e3a[_0x0962('0x21')]({'plain':!![]});if(_0x5abc98&&_0x5abc98[_0x0962('0x22')]){logger['info'](_0x0962('0x23'),_0x0962('0x24'),util['format'](_0x0962('0x25'),_0x2ad61f['id'],_0x5abc98[_0x0962('0x22')]));if(_0x5abc98[_0x0962('0x1e')]&&_0x5abc98['Interactions'][_0x0962('0x26')]){_0x2ad61f[_0x0962('0x27')]=_[_0x0962('0x28')](_0x5abc98[_0x0962('0x1e')][0x0],'Contact');_0x2ad61f[_0x0962('0x1f')]=_0x5abc98[_0x0962('0x1e')][0x0][_0x0962('0x1f')];}var _0x7b2a3a={'method':_0x0962('0x29'),'uri':encodeURI(_0x5abc98['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x7b2a3a[_0x0962('0x2a')]){case _0x0962('0x2b'):_0x7b2a3a['qs']=_0x2ad61f;break;case _0x0962('0x29'):_0x7b2a3a['body']=_0x2ad61f;break;}return rp(_0x7b2a3a)['then'](function(_0x328576){logger[_0x0962('0x2c')](_0x0962('0x23'),'afterCreate',util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x2ad61f['id'],_0x5abc98[_0x0962('0x22')]));if(_0x328576['body']['threadId']&&_0x328576[_0x0962('0x2d')][_0x0962('0x2e')]!=_0x2ad61f[_0x0962('0x27')][_0x0962('0x2e')]){return _0x400427[_0x0962('0x1d')]['update']({'threadId':_0x328576[_0x0962('0x2d')][_0x0962('0x2e')]},{'where':{'id':_0x2ad61f[_0x0962('0x27')]['id']}});}else{return;}})[_0x0962('0x13')](function(){return _0x364a21[_0x0962('0x14')]({'read':!![]});})[_0x0962('0x2f')](function(_0x5edeed){logger[_0x0962('0x30')]('OpenchannelMessage,\x20%s,\x20%s',_0x0962('0x24'),util[_0x0962('0x31')](_0x5edeed,{'showHidden':![],'depth':null}));_0x299aef();});}else{_0x299aef();}})['finally'](function(){_0x299aef();});}else{_0x299aef();}}},'charset':_0x0962('0x32'),'collate':_0x0962('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 1bd5f5b..e66e3cc 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2c4e82,_0x5d91ba){var _0x3db7ba=function(_0x8f0894){while(--_0x8f0894){_0x2c4e82['push'](_0x2c4e82['shift']());}};_0x3db7ba(++_0x5d91ba);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1f9e9d,_0x32ce8f){_0x1f9e9d=_0x1f9e9d-0x0;var _0x2e7fd2=_0x5f2f[_0x1f9e9d];return _0x2e7fd2;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _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(_0x3cecba,_0x2a5e73){var _0x3fd584=function(_0x961341){while(--_0x961341){_0x3cecba['push'](_0x3cecba['shift']());}};_0x3fd584(++_0x2a5e73);}(_0x1261,0x144));var _0x1126=function(_0x4392af,_0xec5afe){_0x4392af=_0x4392af-0x0;var _0x9fa8eb=_0x1261[_0x4392af];return _0x9fa8eb;};'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 d0d7695..8b0f741 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 _0xa031=['remove','update','emit','removeListener','register','length','./openchannelMessage.events'];(function(_0x46e67b,_0x1e60e6){var _0x317ae8=function(_0x49c935){while(--_0x49c935){_0x46e67b['push'](_0x46e67b['shift']());}};_0x317ae8(++_0x1e60e6);}(_0xa031,0x1f0));var _0x1a03=function(_0xfd6e98,_0x54e1d6){_0xfd6e98=_0xfd6e98-0x0;var _0x4a3dc1=_0xa031[_0xfd6e98];return _0x4a3dc1;};'use strict';var OpenchannelMessageEvents=require(_0x1a03('0x0'));var events=['save',_0x1a03('0x1'),_0x1a03('0x2')];function createListener(_0x35abc6,_0x398594){return function(_0x4a7ed8){_0x398594[_0x1a03('0x3')](_0x35abc6,_0x4a7ed8);};}function removeListener(_0x15266b,_0x28a3f4){return function(){OpenchannelMessageEvents[_0x1a03('0x4')](_0x15266b,_0x28a3f4);};}exports[_0x1a03('0x5')]=function(_0x1e0643){for(var _0x5d40dd=0x0,_0x54d6f4=events[_0x1a03('0x6')];_0x5d40dd<_0x54d6f4;_0x5d40dd++){var _0x21a378=events[_0x5d40dd];var _0xe1e6c8=createListener('openchannelMessage:'+_0x21a378,_0x1e0643);OpenchannelMessageEvents['on'](_0x21a378,_0xe1e6c8);}}; \ No newline at end of file +var _0x261a=['removeListener','register','openchannelMessage:','./openchannelMessage.events','save','update','emit'];(function(_0xd9e8b,_0x207023){var _0x33b14f=function(_0x508740){while(--_0x508740){_0xd9e8b['push'](_0xd9e8b['shift']());}};_0x33b14f(++_0x207023);}(_0x261a,0x1e6));var _0xa261=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x261a[_0x321bb2];return _0x9c12ed;};'use strict';var OpenchannelMessageEvents=require(_0xa261('0x0'));var events=[_0xa261('0x1'),'remove',_0xa261('0x2')];function createListener(_0x21143a,_0x5ae060){return function(_0x42162a){_0x5ae060[_0xa261('0x3')](_0x21143a,_0x42162a);};}function removeListener(_0x311e6f,_0x128d65){return function(){OpenchannelMessageEvents[_0xa261('0x4')](_0x311e6f,_0x128d65);};}exports[_0xa261('0x5')]=function(_0x5a511c){for(var _0x218878=0x0,_0x2357f4=events['length'];_0x218878<_0x2357f4;_0x218878++){var _0x3b0544=events[_0x218878];var _0x2f0a41=createListener(_0xa261('0x6')+_0x3b0544,_0x5a511c);OpenchannelMessageEvents['on'](_0x3b0544,_0x2f0a41);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 6982905..9cb85c1 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 _0x5fb5=['/:id','update','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','Router','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','/describe','describe','get','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put'];(function(_0x3c65d6,_0x180d07){var _0x2c27aa=function(_0xb80249){while(--_0xb80249){_0x3c65d6['push'](_0x3c65d6['shift']());}};_0x2c27aa(++_0x180d07);}(_0x5fb5,0x11e));var _0x55fb=function(_0x1b1f88,_0x3fe1cb){_0x1b1f88=_0x1b1f88-0x0;var _0x5045b9=_0x5fb5[_0x1b1f88];return _0x5045b9;};'use strict';var multer=require(_0x55fb('0x0'));var util=require('util');var path=require(_0x55fb('0x1'));var timeout=require(_0x55fb('0x2'));var express=require('express');var router=express[_0x55fb('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x55fb('0x4'));var controller=require(_0x55fb('0x5'));router['get']('/',auth[_0x55fb('0x6')](),controller[_0x55fb('0x7')]);router['get'](_0x55fb('0x8'),auth[_0x55fb('0x6')](),controller[_0x55fb('0x9')]);router[_0x55fb('0xa')]('/:id',auth[_0x55fb('0x6')](),controller[_0x55fb('0xb')]);router['get'](_0x55fb('0xc'),auth['isAuthenticated'](),controller[_0x55fb('0xd')]);router[_0x55fb('0xa')](_0x55fb('0xe'),auth[_0x55fb('0x6')](),controller[_0x55fb('0xf')]);router[_0x55fb('0xa')](_0x55fb('0x10'),auth[_0x55fb('0x6')](),controller['getAgents']);router[_0x55fb('0x11')]('/',auth['isAuthenticated'](),controller[_0x55fb('0x12')]);router[_0x55fb('0x11')](_0x55fb('0xe'),auth[_0x55fb('0x6')](),controller[_0x55fb('0x13')]);router[_0x55fb('0x11')](_0x55fb('0x10'),auth[_0x55fb('0x6')](),controller[_0x55fb('0x14')]);router[_0x55fb('0x15')](_0x55fb('0x16'),auth['isAuthenticated'](),controller[_0x55fb('0x17')]);router['delete'](_0x55fb('0x16'),auth[_0x55fb('0x6')](),controller['destroy']);router[_0x55fb('0x18')](_0x55fb('0xe'),auth['isAuthenticated'](),controller[_0x55fb('0x19')]);router[_0x55fb('0x18')](_0x55fb('0x10'),auth['isAuthenticated'](),controller[_0x55fb('0x1a')]);module[_0x55fb('0x1b')]=router; \ No newline at end of file +var _0x705c=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','isAuthenticated','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','/:id/users','removeAgents','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x260ab7,_0x3a6147){var _0x5dea8e=function(_0x142be7){while(--_0x142be7){_0x260ab7['push'](_0x260ab7['shift']());}};_0x5dea8e(++_0x3a6147);}(_0x705c,0x11d));var _0xc705=function(_0x26eb55,_0x4413cb){_0x26eb55=_0x26eb55-0x0;var _0x1dffd3=_0x705c[_0x26eb55];return _0x1dffd3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc705('0x0'));var timeout=require(_0xc705('0x1'));var express=require(_0xc705('0x2'));var router=express[_0xc705('0x3')]();var fs_extra=require(_0xc705('0x4'));var auth=require(_0xc705('0x5'));var interaction=require(_0xc705('0x6'));var config=require(_0xc705('0x7'));var controller=require('./openchannelQueue.controller');router[_0xc705('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc705('0x9'),auth['isAuthenticated'](),controller[_0xc705('0xa')]);router[_0xc705('0x8')](_0xc705('0xb'),auth['isAuthenticated'](),controller[_0xc705('0xc')]);router[_0xc705('0x8')](_0xc705('0xd'),auth['isAuthenticated'](),controller[_0xc705('0xe')]);router[_0xc705('0x8')](_0xc705('0xf'),auth[_0xc705('0x10')](),controller['getTeams']);router['get']('/:id/users',auth[_0xc705('0x10')](),controller[_0xc705('0x11')]);router[_0xc705('0x12')]('/',auth[_0xc705('0x10')](),controller[_0xc705('0x13')]);router[_0xc705('0x12')](_0xc705('0xf'),auth['isAuthenticated'](),controller[_0xc705('0x14')]);router[_0xc705('0x12')]('/:id/users',auth[_0xc705('0x10')](),controller[_0xc705('0x15')]);router[_0xc705('0x16')](_0xc705('0xb'),auth[_0xc705('0x10')](),controller[_0xc705('0x17')]);router[_0xc705('0x18')](_0xc705('0xb'),auth[_0xc705('0x10')](),controller['destroy']);router[_0xc705('0x18')](_0xc705('0xf'),auth[_0xc705('0x10')](),controller[_0xc705('0x19')]);router[_0xc705('0x18')](_0xc705('0x1a'),auth[_0xc705('0x10')](),controller[_0xc705('0x1b')]);module[_0xc705('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 4772ef7..a8ea92a 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 _0x104d=['name','INTEGER','ENUM','beepall','exports','STRING'];(function(_0x3da2ec,_0x275558){var _0x2de712=function(_0x2f3de8){while(--_0x2f3de8){_0x3da2ec['push'](_0x3da2ec['shift']());}};_0x2de712(++_0x275558);}(_0x104d,0xee));var _0xd104=function(_0x27af8e,_0x44328b){_0x27af8e=_0x27af8e-0x0;var _0x3d00f8=_0x104d[_0x27af8e];return _0x3d00f8;};'use strict';var Sequelize=require('sequelize');module[_0xd104('0x0')]={'name':{'type':Sequelize[_0xd104('0x1')],'unique':_0xd104('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd104('0x1')]},'timeout':{'type':Sequelize[_0xd104('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd104('0x4')]('rrmemory',_0xd104('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x3e25=['beepall','roundrobin','sequelize','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x4bf5ae,_0x9ed8dd){var _0x30d9c9=function(_0x976544){while(--_0x976544){_0x4bf5ae['push'](_0x4bf5ae['shift']());}};_0x30d9c9(++_0x9ed8dd);}(_0x3e25,0x1e2));var _0x53e2=function(_0x6ee9eb,_0x583aab){_0x6ee9eb=_0x6ee9eb-0x0;var _0x130a08=_0x3e25[_0x6ee9eb];return _0x130a08;};'use strict';var Sequelize=require(_0x53e2('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x53e2('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x53e2('0x2')]},'timeout':{'type':Sequelize[_0x53e2('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x53e2('0x4')](_0x53e2('0x5'),_0x53e2('0x6'),_0x53e2('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 24b6814..676f755 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 _0x6d7c=['UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','ids','Agents','online','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','findOne','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','offset','undefined','count','limit','set','json','update','then','destroy','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','where','findAll','rows','catch','show','params','query','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','hasOwnProperty','nolimit','order','sort','pick','filter','map','UserOpenchannelQueue','User','findAndCountAll'];(function(_0xd7df6d,_0x2e784b){var _0x304544=function(_0x4e6594){while(--_0x4e6594){_0xd7df6d['push'](_0xd7df6d['shift']());}};_0x304544(++_0x2e784b);}(_0x6d7c,0x19b));var _0xc6d7=function(_0x14776e,_0x378224){_0x14776e=_0x14776e-0x0;var _0x3301b5=_0x6d7c[_0x14776e];return _0x3301b5;};'use strict';var BPromise=require(_0xc6d7('0x0'));var util=require(_0xc6d7('0x1'));var _=require(_0xc6d7('0x2'));var squel=require(_0xc6d7('0x3'));var Redis=require(_0xc6d7('0x4'));var qs=require(_0xc6d7('0x5'));var logger=require(_0xc6d7('0x6'))('api');var config=require(_0xc6d7('0x7'));var db=require(_0xc6d7('0x8'))['db'];config[_0xc6d7('0x9')]=_[_0xc6d7('0xa')](config[_0xc6d7('0x9')],{'host':_0xc6d7('0xb'),'port':0x18eb});var socket=require(_0xc6d7('0xc'))(new Redis(config['redis']));require(_0xc6d7('0xd'))[_0xc6d7('0xe')](socket);function respondWithStatusCode(_0x38f373,_0x94b8d6){_0x94b8d6=_0x94b8d6||0xcc;return function(_0x48c1f0){if(_0x48c1f0){return _0x38f373['sendStatus'](_0x94b8d6);}return _0x38f373[_0xc6d7('0xf')](_0x94b8d6)[_0xc6d7('0x10')]();};}function respondWithResult(_0x43d620,_0x2b4d67){_0x2b4d67=_0x2b4d67||0xc8;return function(_0x787795){if(_0x787795){return _0x43d620[_0xc6d7('0xf')](_0x2b4d67)['json'](_0x787795);}};}function respondWithFilteredResult(_0x123283,_0x40259a){return function(_0x100f35){if(_0x100f35){var _0x2a0b8b=typeof _0x40259a[_0xc6d7('0x11')]===_0xc6d7('0x12')&&typeof _0x40259a['limit']===_0xc6d7('0x12');var _0x14d426=_0x100f35[_0xc6d7('0x13')];var _0x488efe=_0x2a0b8b?0x0:_0x40259a['offset'];var _0x60fce2=_0x2a0b8b?_0x100f35['count']:_0x40259a[_0xc6d7('0x11')]+_0x40259a[_0xc6d7('0x14')];var _0x192101;if(_0x60fce2>=_0x14d426){_0x60fce2=_0x14d426;_0x192101=0xc8;}else{_0x192101=0xce;}_0x123283[_0xc6d7('0xf')](_0x192101);return _0x123283[_0xc6d7('0x15')]('Content-Range',_0x488efe+'-'+_0x60fce2+'/'+_0x14d426)[_0xc6d7('0x16')](_0x100f35);}return null;};}function saveUpdates(_0x47106d){return function(_0x589169){if(_0x589169){return _0x589169[_0xc6d7('0x17')](_0x47106d)[_0xc6d7('0x18')](function(_0x16f079){return _0x16f079;});}return null;};}function removeEntity(_0x897467){return function(_0x2ad94d){if(_0x2ad94d){return _0x2ad94d[_0xc6d7('0x19')]()['then'](function(){var _0x3ba031=_0x2ad94d['get']({'plain':!![]});var _0x8764c2=_0xc6d7('0x1a');return db[_0xc6d7('0x1b')][_0xc6d7('0x19')]({'where':{'type':_0x8764c2,'resourceId':_0x3ba031['id']}})[_0xc6d7('0x18')](function(){return _0x2ad94d;});})['then'](function(){_0x897467[_0xc6d7('0xf')](0xcc)[_0xc6d7('0x10')]();});}};}function handleEntityNotFound(_0x4051db){return function(_0x5d8c03){if(!_0x5d8c03){_0x4051db[_0xc6d7('0x1c')](0x194);}return _0x5d8c03;};}function handleError(_0x5ce819,_0x57bbae){_0x57bbae=_0x57bbae||0x1f4;return function(_0x52e3c1){logger[_0xc6d7('0x1d')](_0x52e3c1[_0xc6d7('0x1e')]);if(_0x52e3c1[_0xc6d7('0x1f')]){delete _0x52e3c1[_0xc6d7('0x1f')];}_0x5ce819[_0xc6d7('0xf')](_0x57bbae)[_0xc6d7('0x20')](_0x52e3c1);};}exports[_0xc6d7('0x21')]=function(_0x50daa8,_0x498929){var _0x3cb178={};var _0x3b60e1={'count':0x0,'rows':[]};var _0x3d928d=_['map'](db[_0xc6d7('0x22')][_0xc6d7('0x23')],function(_0x36ee15){return{'name':_0x36ee15[_0xc6d7('0x24')],'type':_0x36ee15[_0xc6d7('0x25')][_0xc6d7('0x26')]};});_0x3cb178=qs[_0xc6d7('0x27')](_0x3d928d,_0x50daa8);var _0x269438={'where':_0x3cb178[_0xc6d7('0x28')]};return db[_0xc6d7('0x22')][_0xc6d7('0x13')](_0x269438)[_0xc6d7('0x18')](function(_0x1644f7){_0x3b60e1['count']=_0x1644f7;_0x3cb178['include']=qs['include'](_0x50daa8['query']);return db[_0xc6d7('0x22')][_0xc6d7('0x29')](_0x3cb178);})['then'](function(_0x9c50a7){_0x3b60e1[_0xc6d7('0x2a')]=_0x9c50a7;return _0x3b60e1;})[_0xc6d7('0x18')](respondWithFilteredResult(_0x498929,_0x3cb178))[_0xc6d7('0x2b')](handleError(_0x498929,null));};exports[_0xc6d7('0x2c')]=function(_0x1df1ce,_0x47b83c){var _0x2fdb5b={'raw':!![],'where':{'id':_0x1df1ce[_0xc6d7('0x2d')]['id']}},_0x1731a2={};_0x1731a2['model']=_['keys'](db[_0xc6d7('0x22')][_0xc6d7('0x23')]);_0x1731a2[_0xc6d7('0x2e')]=_[_0xc6d7('0x2f')](_0x1df1ce[_0xc6d7('0x2e')]);_0x1731a2[_0xc6d7('0x30')]=_[_0xc6d7('0x31')](_0x1731a2[_0xc6d7('0x32')],_0x1731a2[_0xc6d7('0x2e')]);_0x2fdb5b[_0xc6d7('0x33')]=_['intersection'](_0x1731a2[_0xc6d7('0x32')],qs[_0xc6d7('0x34')](_0x1df1ce[_0xc6d7('0x2e')][_0xc6d7('0x34')]));_0x2fdb5b[_0xc6d7('0x33')]=_0x2fdb5b['attributes'][_0xc6d7('0x35')]?_0x2fdb5b[_0xc6d7('0x33')]:_0x1731a2[_0xc6d7('0x32')];if(_0x1df1ce[_0xc6d7('0x2e')][_0xc6d7('0x36')]){_0x2fdb5b['include']=[{'all':!![]}];}_0x2fdb5b=_[_0xc6d7('0x37')]({},_0x2fdb5b,_0x1df1ce[_0xc6d7('0x38')]);return db[_0xc6d7('0x22')]['find'](_0x2fdb5b)['then'](handleEntityNotFound(_0x47b83c,null))[_0xc6d7('0x18')](respondWithResult(_0x47b83c,null))[_0xc6d7('0x2b')](handleError(_0x47b83c,null));};exports[_0xc6d7('0x39')]=function(_0x44797e,_0x59b025){return db[_0xc6d7('0x22')][_0xc6d7('0x39')](_0x44797e[_0xc6d7('0x3a')],{})[_0xc6d7('0x18')](function(_0x532a21){var _0x45b25b=_0x44797e[_0xc6d7('0x3b')]['get']({'plain':!![]});if(!_0x45b25b)throw new Error(_0xc6d7('0x3c'));if(_0x45b25b['role']===_0xc6d7('0x3b')){var _0x29676c=_0x532a21[_0xc6d7('0x3d')]({'plain':!![]});var _0x2a1487=_0xc6d7('0x1a');return db[_0xc6d7('0x3e')][_0xc6d7('0x3f')]({'where':{'name':_0x2a1487,'userProfileId':_0x45b25b[_0xc6d7('0x40')]},'raw':!![]})[_0xc6d7('0x18')](function(_0x5eda75){if(_0x5eda75&&_0x5eda75['autoAssociation']===0x0){return db['UserProfileResource'][_0xc6d7('0x39')]({'name':_0x29676c['name'],'resourceId':_0x29676c['id'],'type':_0x5eda75[_0xc6d7('0x1f')],'sectionId':_0x5eda75['id']},{})[_0xc6d7('0x18')](function(){return _0x532a21;});}else{return _0x532a21;}})[_0xc6d7('0x2b')](function(_0x35b1ae){logger[_0xc6d7('0x1d')](_0xc6d7('0x41'),_0x35b1ae);throw _0x35b1ae;});}return _0x532a21;})['then'](respondWithResult(_0x59b025,0xc9))[_0xc6d7('0x2b')](handleError(_0x59b025,null));};exports[_0xc6d7('0x17')]=function(_0x182c6a,_0x73630d){if(_0x182c6a[_0xc6d7('0x3a')]['id']){delete _0x182c6a[_0xc6d7('0x3a')]['id'];}return db[_0xc6d7('0x22')][_0xc6d7('0x3f')]({'where':{'id':_0x182c6a[_0xc6d7('0x2d')]['id']}})[_0xc6d7('0x18')](handleEntityNotFound(_0x73630d,null))[_0xc6d7('0x18')](saveUpdates(_0x182c6a['body'],null))[_0xc6d7('0x18')](respondWithResult(_0x73630d,null))[_0xc6d7('0x2b')](handleError(_0x73630d,null));};exports[_0xc6d7('0x19')]=function(_0x4a243a,_0x45b878){return db[_0xc6d7('0x22')][_0xc6d7('0x3f')]({'where':{'id':_0x4a243a[_0xc6d7('0x2d')]['id']}})['then'](handleEntityNotFound(_0x45b878,null))[_0xc6d7('0x18')](removeEntity(_0x45b878,null))[_0xc6d7('0x2b')](handleError(_0x45b878,null));};exports[_0xc6d7('0x42')]=function(_0x2877f2,_0x28fe1c){return db[_0xc6d7('0x22')][_0xc6d7('0x42')]()[_0xc6d7('0x18')](respondWithResult(_0x28fe1c,null))['catch'](handleError(_0x28fe1c,null));};exports['getMembers']=function(_0x29db83,_0x344115){var _0x3970f5={'raw':!![],'where':{}},_0x2a78e0={},_0x240092;return db[_0xc6d7('0x22')]['findOne']({'where':{'id':_0x29db83[_0xc6d7('0x2d')]['id']}})['then'](handleEntityNotFound(_0x344115,null))[_0xc6d7('0x18')](function(_0x130c8d){if(_0x130c8d){_0x240092=_0x130c8d[_0xc6d7('0x3d')]({'plain':!![]});_0x2a78e0[_0xc6d7('0x32')]=_[_0xc6d7('0x2f')](db['UserOpenchannelQueue']['rawAttributes']);_0x2a78e0['query']=_[_0xc6d7('0x2f')](_0x29db83[_0xc6d7('0x2e')]);_0x2a78e0[_0xc6d7('0x30')]=_[_0xc6d7('0x31')](_0x2a78e0['model'],_0x2a78e0[_0xc6d7('0x2e')]);_0x3970f5[_0xc6d7('0x33')]=_[_0xc6d7('0x31')](_0x2a78e0[_0xc6d7('0x32')],qs[_0xc6d7('0x34')](_0x29db83[_0xc6d7('0x2e')][_0xc6d7('0x34')]));_0x3970f5['attributes']=_0x3970f5[_0xc6d7('0x33')][_0xc6d7('0x35')]?_0x3970f5[_0xc6d7('0x33')]:_0x2a78e0[_0xc6d7('0x32')];if(!_0x29db83[_0xc6d7('0x2e')][_0xc6d7('0x43')](_0xc6d7('0x44'))){_0x3970f5[_0xc6d7('0x14')]=qs[_0xc6d7('0x14')](_0x29db83['query']['limit']);_0x3970f5[_0xc6d7('0x11')]=qs[_0xc6d7('0x11')](_0x29db83['query']['offset']);}_0x3970f5[_0xc6d7('0x45')]=qs['sort'](_0x29db83['query'][_0xc6d7('0x46')]);_0x3970f5[_0xc6d7('0x28')]=qs[_0xc6d7('0x30')](_[_0xc6d7('0x47')](_0x29db83['query'],_0x2a78e0[_0xc6d7('0x30')]));_0x3970f5[_0xc6d7('0x28')]['OpenchannelQueueId']=_0x130c8d['id'];if(_0x29db83[_0xc6d7('0x2e')][_0xc6d7('0x48')]){_0x3970f5[_0xc6d7('0x28')]=_[_0xc6d7('0x37')](_0x3970f5[_0xc6d7('0x28')],{'$or':_[_0xc6d7('0x49')](_0x3970f5[_0xc6d7('0x33')],function(_0xa0a3d6){var _0xf6dc58={};_0xf6dc58[_0xa0a3d6]={'$like':'%'+_0x29db83[_0xc6d7('0x2e')][_0xc6d7('0x48')]+'%'};return _0xf6dc58;})});}_0x3970f5=_[_0xc6d7('0x37')]({},_0x3970f5,_0x29db83[_0xc6d7('0x38')]);return db[_0xc6d7('0x4a')][_0xc6d7('0x29')](_0x3970f5);}})[_0xc6d7('0x18')](function(_0xf15296){if(_0xf15296){return db[_0xc6d7('0x4b')][_0xc6d7('0x4c')]({'where':{'id':_[_0xc6d7('0x49')](_0xf15296,_0xc6d7('0x4d')),'role':_0xc6d7('0x4e')},'attributes':['id',_0xc6d7('0x1f'),_0xc6d7('0x4f'),_0xc6d7('0x50'),_0xc6d7('0x51')]});}})['then'](function(_0x38e257){if(_0x38e257){return{'count':_0x38e257[_0xc6d7('0x13')],'rows':_[_0xc6d7('0x49')](_0x38e257['rows'],function(_0x2b7205){return{'membername':_0x2b7205[_0xc6d7('0x1f')],'UserId':_0x2b7205['id'],'queue_name':_0x240092[_0xc6d7('0x1f')],'OpenchannelQueueId':_0x240092['id'],'interface':util[_0xc6d7('0x52')](_0xc6d7('0x53'),_0xc6d7('0x54'),_0x2b7205['name']),'penalty':0x0,'paused':_0x2b7205[_0xc6d7('0x4f')],'createdAt':_0x2b7205[_0xc6d7('0x51')],'updatedAt':_0x2b7205[_0xc6d7('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x344115,_0x3970f5))[_0xc6d7('0x2b')](handleError(_0x344115,null));};exports['getTeams']=function(_0x5c136c,_0xf54739){var _0x529dab={};var _0x5cf391={};var _0x20d2a1;var _0x5789d4;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x5c136c[_0xc6d7('0x2d')]['id']}})[_0xc6d7('0x18')](handleEntityNotFound(_0xf54739,null))[_0xc6d7('0x18')](function(_0x117f8e){if(_0x117f8e){_0x20d2a1=_0x117f8e;_0x5cf391[_0xc6d7('0x32')]=_[_0xc6d7('0x2f')](db[_0xc6d7('0x55')][_0xc6d7('0x23')]);_0x5cf391[_0xc6d7('0x2e')]=_['keys'](_0x5c136c[_0xc6d7('0x2e')]);_0x5cf391[_0xc6d7('0x30')]=_['intersection'](_0x5cf391['model'],_0x5cf391[_0xc6d7('0x2e')]);_0x529dab[_0xc6d7('0x33')]=_[_0xc6d7('0x31')](_0x5cf391['model'],qs['fields'](_0x5c136c[_0xc6d7('0x2e')]['fields']));_0x529dab['attributes']=_0x529dab['attributes'][_0xc6d7('0x35')]?_0x529dab[_0xc6d7('0x33')]:_0x5cf391['model'];_0x529dab[_0xc6d7('0x45')]=qs[_0xc6d7('0x46')](_0x5c136c['query'][_0xc6d7('0x46')]);_0x529dab[_0xc6d7('0x28')]=qs[_0xc6d7('0x30')](_[_0xc6d7('0x47')](_0x5c136c[_0xc6d7('0x2e')],_0x5cf391[_0xc6d7('0x30')]));if(_0x5c136c['query'][_0xc6d7('0x48')]){_0x529dab['where']=_[_0xc6d7('0x37')](_0x529dab[_0xc6d7('0x28')],{'$or':_[_0xc6d7('0x49')](_0x529dab['attributes'],function(_0x24cf3c){var _0x4c307a={};_0x4c307a[_0x24cf3c]={'$like':'%'+_0x5c136c[_0xc6d7('0x2e')][_0xc6d7('0x48')]+'%'};return _0x4c307a;})});}_0x529dab=_[_0xc6d7('0x37')]({},_0x529dab,_0x5c136c[_0xc6d7('0x38')]);return _0x20d2a1[_0xc6d7('0x56')](_0x529dab);}})[_0xc6d7('0x18')](function(_0x6dbc8f){if(_0x6dbc8f){_0x5789d4=_0x6dbc8f[_0xc6d7('0x35')];if(!_0x5c136c['query'][_0xc6d7('0x43')]('nolimit')){_0x529dab['limit']=qs[_0xc6d7('0x14')](_0x5c136c[_0xc6d7('0x2e')][_0xc6d7('0x14')]);_0x529dab['offset']=qs[_0xc6d7('0x11')](_0x5c136c['query']['offset']);}return _0x20d2a1[_0xc6d7('0x56')](_0x529dab);}})['then'](function(_0x163e9a){if(_0x163e9a){return _0x163e9a?{'count':_0x5789d4,'rows':_0x163e9a}:null;}})[_0xc6d7('0x18')](respondWithResult(_0xf54739,null))[_0xc6d7('0x2b')](handleError(_0xf54739,null));};exports['addTeams']=function(_0x1cc6a5,_0x50c6da){var _0x57949a=_0x1cc6a5[_0xc6d7('0x3a')][_0xc6d7('0x57')];return db[_0xc6d7('0x55')][_0xc6d7('0x29')]({'where':{'id':_0x57949a},'attributes':['id'],'include':[{'model':db[_0xc6d7('0x4b')],'as':_0xc6d7('0x58'),'attributes':['id',_0xc6d7('0x1f'),_0xc6d7('0x59'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x43304b){if(_0x43304b){var _0x480775=_[_0xc6d7('0x5a')](_0x43304b,function(_0x10f41e){var _0x1d1d60=_0x10f41e[_0xc6d7('0x3d')]({'plain':!![]});return _0x1d1d60[_0xc6d7('0x58')];});return db[_0xc6d7('0x22')][_0xc6d7('0x3f')]({'where':{'id':_0x1cc6a5[_0xc6d7('0x2d')]['id']}})[_0xc6d7('0x18')](function(_0x1bdeef){return db[_0xc6d7('0x5b')][_0xc6d7('0x5c')](function(_0x489a3b){return _0x1bdeef[_0xc6d7('0x5d')](_0x57949a,{'transaction':_0x489a3b})['then'](function(){return BPromise[_0xc6d7('0x5e')](_0x480775,function(_0x268c64){return db[_0xc6d7('0x4a')][_0xc6d7('0x5f')]({'where':{'UserId':_0x268c64['id'],'OpenchannelQueueId':_0x1cc6a5['params']['id']},'transaction':_0x489a3b});});})[_0xc6d7('0x18')](function(){_0x480775[_0xc6d7('0x60')](function(_0x2c5bbe){socket[_0xc6d7('0x61')](_0xc6d7('0x62'),{'UserId':_0x2c5bbe['id'],'OpenchannelQueueId':_0x1bdeef['id']});});});});});}})[_0xc6d7('0x18')](respondWithStatusCode(_0x50c6da,null))[_0xc6d7('0x2b')](handleError(_0x50c6da,null));};exports[_0xc6d7('0x63')]=function(_0x3cfd48,_0x5bf9c6){return db['Team'][_0xc6d7('0x29')]({'where':{'id':_0x3cfd48[_0xc6d7('0x2e')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc6d7('0x4b')],'as':_0xc6d7('0x58'),'attributes':['id'],'raw':!![]}]})[_0xc6d7('0x18')](handleEntityNotFound(_0x5bf9c6,null))[_0xc6d7('0x18')](function(_0x2792b3){var _0xe5fe4a=_[_0xc6d7('0x49')](_0x2792b3,'id');var _0x5a6997=[];var _0x5f1502=[];var _0x468881=squel[_0xc6d7('0x64')]();_0x468881['field']('tq.TeamId')[_0xc6d7('0x65')](_0xc6d7('0x66'),'tq')[_0xc6d7('0x67')]('user_has_teams','ut',_0xc6d7('0x68'))[_0xc6d7('0x28')]('OpenchannelQueueId\x20=\x20?',_0x3cfd48[_0xc6d7('0x2d')]['id']);for(var _0x2f96bb=0x0;_0x2f96bb<_0x2792b3['length'];_0x2f96bb+=0x1){let _0x4f9b22=_0x2792b3[_0x2f96bb];for(var _0x53ed99=0x0;_0x53ed99<_0x4f9b22[_0xc6d7('0x58')][_0xc6d7('0x35')];_0x53ed99+=0x1){let _0x344369=_0x4f9b22['Agents'][_0x53ed99];var _0x43c1a9=_0x468881['clone']();_0x43c1a9[_0xc6d7('0x28')](_0xc6d7('0x69'),_0x344369['id']);_0x5f1502['push'](db[_0xc6d7('0x5b')][_0xc6d7('0x2e')](_0x43c1a9[_0xc6d7('0x6a')](),{'type':db['sequelize']['QueryTypes'][_0xc6d7('0x6b')]})[_0xc6d7('0x18')](function(_0xd04eed){if(_0xd04eed[_0xc6d7('0x35')]===0x1){return _0x344369['id'];}else{var _0x17d503=_[_0xc6d7('0x6c')](_[_0xc6d7('0x49')](_0xd04eed,'TeamId'),function(_0x5425fd){return _[_0xc6d7('0x6d')](_0xe5fe4a,_0x5425fd);});if(_0x17d503){return _0x344369['id'];}}}));}}return BPromise[_0xc6d7('0x6e')](_0x5f1502)['then'](function(_0xf428e1){_0x5a6997=_(_0x5a6997)[_0xc6d7('0x6f')](_0xf428e1)[_0xc6d7('0x70')]()[_0xc6d7('0x71')]();return db[_0xc6d7('0x22')][_0xc6d7('0x3f')]({'where':{'id':_0x3cfd48[_0xc6d7('0x2d')]['id']}})['then'](function(_0x5efe56){return db[_0xc6d7('0x5b')][_0xc6d7('0x5c')](function(_0x9a7b75){return _0x5efe56['removeTeams'](_0x3cfd48[_0xc6d7('0x2e')]['ids'],{'transaction':_0x9a7b75})['then'](function(){if(!_[_0xc6d7('0x72')](_0x5a6997)){return _0x5efe56[_0xc6d7('0x73')](_0x5a6997,{'transaction':_0x9a7b75});}})['then'](function(){_0x5a6997[_0xc6d7('0x60')](function(_0x18d5a5){socket['emit'](_0xc6d7('0x74'),{'UserId':_0x18d5a5,'OpenchannelQueueId':_0x5efe56['id']});});});});});});})['then'](respondWithStatusCode(_0x5bf9c6,null))['catch'](handleError(_0x5bf9c6,null));};exports[_0xc6d7('0x75')]=function(_0x19ea45,_0x298c7c){return db['OpenchannelQueue'][_0xc6d7('0x3f')]({'where':{'id':_0x19ea45[_0xc6d7('0x2d')]['id']}})[_0xc6d7('0x18')](handleEntityNotFound(_0x298c7c,null))['then'](function(_0x245eec){if(_0x245eec){return _0x245eec['addAgents'](_0x19ea45[_0xc6d7('0x3a')]['ids'],_[_0xc6d7('0x76')](_0x19ea45[_0xc6d7('0x3a')],[_0xc6d7('0x57'),'id'])||{})[_0xc6d7('0x77')](function(_0x22e960){for(var _0x26230a=0x0;_0x26230a<_0x19ea45['body']['ids']['length'];_0x26230a+=0x1){socket[_0xc6d7('0x61')]('userOpenchannelQueue:save',{'UserId':Number(_0x19ea45['body'][_0xc6d7('0x57')][_0x26230a]),'OpenchannelQueueId':Number(_0x19ea45[_0xc6d7('0x2d')]['id'])});}return _0x22e960;});}})['then'](respondWithResult(_0x298c7c,null))[_0xc6d7('0x2b')](handleError(_0x298c7c,null));};exports[_0xc6d7('0x73')]=function(_0x5d558a,_0x54f133){return db['OpenchannelQueue']['find']({'where':{'id':_0x5d558a[_0xc6d7('0x2d')]['id']}})['then'](handleEntityNotFound(_0x54f133,null))[_0xc6d7('0x18')](function(_0x3822f6){if(_0x3822f6){return _0x3822f6[_0xc6d7('0x73')](_0x5d558a[_0xc6d7('0x2e')][_0xc6d7('0x57')])[_0xc6d7('0x18')](function(){if(_['isArray'](_0x5d558a[_0xc6d7('0x2e')]['ids'])){for(var _0x3b03de=0x0;_0x3b03de<_0x5d558a['query'][_0xc6d7('0x57')]['length'];_0x3b03de+=0x1){socket[_0xc6d7('0x61')](_0xc6d7('0x74'),{'UserId':Number(_0x5d558a[_0xc6d7('0x2e')][_0xc6d7('0x57')][_0x3b03de]),'OpenchannelQueueId':Number(_0x5d558a[_0xc6d7('0x2d')]['id'])});}}else{socket[_0xc6d7('0x61')](_0xc6d7('0x74'),{'UserId':Number(_0x5d558a[_0xc6d7('0x2e')][_0xc6d7('0x57')]),'OpenchannelQueueId':Number(_0x5d558a[_0xc6d7('0x2d')]['id'])});}});}})[_0xc6d7('0x18')](respondWithStatusCode(_0x54f133,null))['catch'](handleError(_0x54f133,null));};exports['getAgents']=function(_0x5185db,_0x46a296){var _0x32ede7={};var _0x44d2c1={};var _0x26a632;var _0x35ee9b;return db['OpenchannelQueue'][_0xc6d7('0x78')]({'where':{'id':_0x5185db[_0xc6d7('0x2d')]['id']}})[_0xc6d7('0x18')](handleEntityNotFound(_0x46a296,null))[_0xc6d7('0x18')](function(_0x31ea4e){if(_0x31ea4e){_0x26a632=_0x31ea4e;_0x44d2c1[_0xc6d7('0x32')]=_[_0xc6d7('0x2f')](db[_0xc6d7('0x4b')][_0xc6d7('0x23')]);_0x44d2c1[_0xc6d7('0x2e')]=_[_0xc6d7('0x2f')](_0x5185db[_0xc6d7('0x2e')]);_0x44d2c1[_0xc6d7('0x30')]=_[_0xc6d7('0x31')](_0x44d2c1[_0xc6d7('0x32')],_0x44d2c1[_0xc6d7('0x2e')]);_0x32ede7['attributes']=_['intersection'](_0x44d2c1['model'],qs[_0xc6d7('0x34')](_0x5185db[_0xc6d7('0x2e')][_0xc6d7('0x34')]));_0x32ede7[_0xc6d7('0x33')]=_0x32ede7[_0xc6d7('0x33')][_0xc6d7('0x35')]?_0x32ede7[_0xc6d7('0x33')]:_0x44d2c1[_0xc6d7('0x32')];_0x32ede7[_0xc6d7('0x45')]=qs[_0xc6d7('0x46')](_0x5185db[_0xc6d7('0x2e')][_0xc6d7('0x46')]);_0x32ede7[_0xc6d7('0x28')]=qs[_0xc6d7('0x30')](_[_0xc6d7('0x47')](_0x5185db[_0xc6d7('0x2e')],_0x44d2c1[_0xc6d7('0x30')]));if(_0x5185db[_0xc6d7('0x2e')][_0xc6d7('0x48')]){_0x32ede7[_0xc6d7('0x28')]=_[_0xc6d7('0x37')](_0x32ede7['where'],{'$or':_[_0xc6d7('0x49')](_0x32ede7['attributes'],function(_0x481700){var _0x11a57e={};_0x11a57e[_0x481700]={'$like':'%'+_0x5185db[_0xc6d7('0x2e')][_0xc6d7('0x48')]+'%'};return _0x11a57e;})});}_0x32ede7=_[_0xc6d7('0x37')]({},_0x32ede7,_0x5185db['options']);return _0x26a632[_0xc6d7('0x79')](_0x32ede7);}})[_0xc6d7('0x18')](function(_0x2862c6){if(_0x2862c6){_0x35ee9b=_0x2862c6['length'];if(!_0x5185db[_0xc6d7('0x2e')][_0xc6d7('0x43')](_0xc6d7('0x44'))){_0x32ede7[_0xc6d7('0x14')]=qs[_0xc6d7('0x14')](_0x5185db[_0xc6d7('0x2e')][_0xc6d7('0x14')]);_0x32ede7[_0xc6d7('0x11')]=qs[_0xc6d7('0x11')](_0x5185db[_0xc6d7('0x2e')][_0xc6d7('0x11')]);}return _0x26a632[_0xc6d7('0x79')](_0x32ede7);}})['then'](function(_0x11709d){if(_0x11709d){return _0x11709d?{'count':_0x35ee9b,'rows':_0x11709d}:null;}})['then'](respondWithResult(_0x46a296,null))[_0xc6d7('0x2b')](handleError(_0x46a296,null));}; \ No newline at end of file +var _0x6193=['set','Content-Range','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','OpenchannelQueue','include','findAll','rows','catch','params','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','body','user','OpenchannelQueues','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelQueueId','filter','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','openchannelPause','getTeams','addTeams','ids','Team','Agents','online','interface','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','select','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','every','TeamId','includes','union','value','transaction','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x929713,_0x320f15){var _0x5063e8=function(_0x40489a){while(--_0x40489a){_0x929713['push'](_0x929713['shift']());}};_0x5063e8(++_0x320f15);}(_0x6193,0x68));var _0x3619=function(_0x458127,_0x259b86){_0x458127=_0x458127-0x0;var _0x533ec2=_0x6193[_0x458127];return _0x533ec2;};'use strict';var BPromise=require(_0x3619('0x0'));var util=require(_0x3619('0x1'));var _=require('lodash');var squel=require(_0x3619('0x2'));var Redis=require(_0x3619('0x3'));var qs=require(_0x3619('0x4'));var logger=require(_0x3619('0x5'))('api');var config=require(_0x3619('0x6'));var db=require(_0x3619('0x7'))['db'];config[_0x3619('0x8')]=_['defaults'](config[_0x3619('0x8')],{'host':_0x3619('0x9'),'port':0x18eb});var socket=require(_0x3619('0xa'))(new Redis(config['redis']));require(_0x3619('0xb'))['register'](socket);function respondWithStatusCode(_0x54fbc2,_0x3d8de0){_0x3d8de0=_0x3d8de0||0xcc;return function(_0x29a580){if(_0x29a580){return _0x54fbc2[_0x3619('0xc')](_0x3d8de0);}return _0x54fbc2['status'](_0x3d8de0)['end']();};}function respondWithResult(_0x1c079e,_0x563de9){_0x563de9=_0x563de9||0xc8;return function(_0x974b8a){if(_0x974b8a){return _0x1c079e[_0x3619('0xd')](_0x563de9)[_0x3619('0xe')](_0x974b8a);}};}function respondWithFilteredResult(_0xe1ff4,_0x16df5a){return function(_0x1f8ff3){if(_0x1f8ff3){var _0x224b2f=typeof _0x16df5a[_0x3619('0xf')]===_0x3619('0x10')&&typeof _0x16df5a[_0x3619('0x11')]===_0x3619('0x10');var _0x303d1f=_0x1f8ff3[_0x3619('0x12')];var _0x3cf942=_0x224b2f?0x0:_0x16df5a['offset'];var _0x3d1cda=_0x224b2f?_0x1f8ff3['count']:_0x16df5a[_0x3619('0xf')]+_0x16df5a[_0x3619('0x11')];var _0x3d58d5;if(_0x3d1cda>=_0x303d1f){_0x3d1cda=_0x303d1f;_0x3d58d5=0xc8;}else{_0x3d58d5=0xce;}_0xe1ff4['status'](_0x3d58d5);return _0xe1ff4[_0x3619('0x13')](_0x3619('0x14'),_0x3cf942+'-'+_0x3d1cda+'/'+_0x303d1f)['json'](_0x1f8ff3);}return null;};}function saveUpdates(_0x4d772b){return function(_0x5a6f77){if(_0x5a6f77){return _0x5a6f77['update'](_0x4d772b)[_0x3619('0x15')](function(_0x119ae8){return _0x119ae8;});}return null;};}function removeEntity(_0x26d8ef){return function(_0x538888){if(_0x538888){return _0x538888[_0x3619('0x16')]()[_0x3619('0x15')](function(){var _0x44e061=_0x538888[_0x3619('0x17')]({'plain':!![]});var _0xbca810='OpenchannelQueues';return db[_0x3619('0x18')][_0x3619('0x16')]({'where':{'type':_0xbca810,'resourceId':_0x44e061['id']}})['then'](function(){return _0x538888;});})[_0x3619('0x15')](function(){_0x26d8ef[_0x3619('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x339712){return function(_0x2588ef){if(!_0x2588ef){_0x339712[_0x3619('0xc')](0x194);}return _0x2588ef;};}function handleError(_0x6ae449,_0x57cba8){_0x57cba8=_0x57cba8||0x1f4;return function(_0x583110){logger[_0x3619('0x19')](_0x583110[_0x3619('0x1a')]);if(_0x583110[_0x3619('0x1b')]){delete _0x583110[_0x3619('0x1b')];}_0x6ae449[_0x3619('0xd')](_0x57cba8)[_0x3619('0x1c')](_0x583110);};}exports[_0x3619('0x1d')]=function(_0x40ec0b,_0x3bb2c8){var _0x179298={};var _0xb7016d={'count':0x0,'rows':[]};var _0x2a5e02=_[_0x3619('0x1e')](db['OpenchannelQueue'][_0x3619('0x1f')],function(_0x15a684){return{'name':_0x15a684[_0x3619('0x20')],'type':_0x15a684[_0x3619('0x21')][_0x3619('0x22')]};});_0x179298=qs[_0x3619('0x23')](_0x2a5e02,_0x40ec0b);var _0x376a6a={'where':_0x179298['where']};return db[_0x3619('0x24')]['count'](_0x376a6a)[_0x3619('0x15')](function(_0x5a821c){_0xb7016d[_0x3619('0x12')]=_0x5a821c;_0x179298[_0x3619('0x25')]=qs['include'](_0x40ec0b['query']);return db[_0x3619('0x24')][_0x3619('0x26')](_0x179298);})[_0x3619('0x15')](function(_0x341bd6){_0xb7016d[_0x3619('0x27')]=_0x341bd6;return _0xb7016d;})[_0x3619('0x15')](respondWithFilteredResult(_0x3bb2c8,_0x179298))[_0x3619('0x28')](handleError(_0x3bb2c8,null));};exports['show']=function(_0x1a3154,_0x44213f){var _0xd322c8={'raw':!![],'where':{'id':_0x1a3154[_0x3619('0x29')]['id']}},_0x33cb63={};_0x33cb63['model']=_[_0x3619('0x2a')](db['OpenchannelQueue']['rawAttributes']);_0x33cb63[_0x3619('0x2b')]=_[_0x3619('0x2a')](_0x1a3154['query']);_0x33cb63[_0x3619('0x2c')]=_[_0x3619('0x2d')](_0x33cb63[_0x3619('0x2e')],_0x33cb63[_0x3619('0x2b')]);_0xd322c8[_0x3619('0x2f')]=_[_0x3619('0x2d')](_0x33cb63['model'],qs[_0x3619('0x30')](_0x1a3154[_0x3619('0x2b')]['fields']));_0xd322c8[_0x3619('0x2f')]=_0xd322c8['attributes'][_0x3619('0x31')]?_0xd322c8[_0x3619('0x2f')]:_0x33cb63[_0x3619('0x2e')];if(_0x1a3154[_0x3619('0x2b')][_0x3619('0x32')]){_0xd322c8['include']=[{'all':!![]}];}_0xd322c8=_[_0x3619('0x33')]({},_0xd322c8,_0x1a3154[_0x3619('0x34')]);return db[_0x3619('0x24')][_0x3619('0x35')](_0xd322c8)[_0x3619('0x15')](handleEntityNotFound(_0x44213f,null))[_0x3619('0x15')](respondWithResult(_0x44213f,null))[_0x3619('0x28')](handleError(_0x44213f,null));};exports[_0x3619('0x36')]=function(_0x4aff0e,_0x3332b5){return db[_0x3619('0x24')]['create'](_0x4aff0e[_0x3619('0x37')],{})[_0x3619('0x15')](function(_0xd43289){var _0x3c47d9=_0x4aff0e[_0x3619('0x38')]['get']({'plain':!![]});if(!_0x3c47d9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c47d9['role']===_0x3619('0x38')){var _0x3089ea=_0xd43289['get']({'plain':!![]});var _0x397a5f=_0x3619('0x39');return db[_0x3619('0x3a')][_0x3619('0x35')]({'where':{'name':_0x397a5f,'userProfileId':_0x3c47d9['userProfileId']},'raw':!![]})[_0x3619('0x15')](function(_0x1cdcbf){if(_0x1cdcbf&&_0x1cdcbf['autoAssociation']===0x0){return db['UserProfileResource'][_0x3619('0x36')]({'name':_0x3089ea['name'],'resourceId':_0x3089ea['id'],'type':_0x1cdcbf[_0x3619('0x1b')],'sectionId':_0x1cdcbf['id']},{})['then'](function(){return _0xd43289;});}else{return _0xd43289;}})[_0x3619('0x28')](function(_0x5d047c){logger[_0x3619('0x19')](_0x3619('0x3b'),_0x5d047c);throw _0x5d047c;});}return _0xd43289;})['then'](respondWithResult(_0x3332b5,0xc9))[_0x3619('0x28')](handleError(_0x3332b5,null));};exports[_0x3619('0x3c')]=function(_0x5f28e9,_0x5a1fff){if(_0x5f28e9[_0x3619('0x37')]['id']){delete _0x5f28e9[_0x3619('0x37')]['id'];}return db[_0x3619('0x24')][_0x3619('0x35')]({'where':{'id':_0x5f28e9[_0x3619('0x29')]['id']}})[_0x3619('0x15')](handleEntityNotFound(_0x5a1fff,null))[_0x3619('0x15')](saveUpdates(_0x5f28e9['body'],null))[_0x3619('0x15')](respondWithResult(_0x5a1fff,null))[_0x3619('0x28')](handleError(_0x5a1fff,null));};exports['destroy']=function(_0x3350e4,_0x543c24){return db['OpenchannelQueue'][_0x3619('0x35')]({'where':{'id':_0x3350e4[_0x3619('0x29')]['id']}})[_0x3619('0x15')](handleEntityNotFound(_0x543c24,null))[_0x3619('0x15')](removeEntity(_0x543c24,null))[_0x3619('0x28')](handleError(_0x543c24,null));};exports[_0x3619('0x3d')]=function(_0x8ae924,_0x54932b){return db[_0x3619('0x24')][_0x3619('0x3d')]()[_0x3619('0x15')](respondWithResult(_0x54932b,null))[_0x3619('0x28')](handleError(_0x54932b,null));};exports['getMembers']=function(_0x5a7a47,_0x20ce7e){var _0x2ec365={'raw':!![],'where':{}},_0x31da90={},_0x5db44d;return db[_0x3619('0x24')][_0x3619('0x3e')]({'where':{'id':_0x5a7a47[_0x3619('0x29')]['id']}})['then'](handleEntityNotFound(_0x20ce7e,null))[_0x3619('0x15')](function(_0xf97d84){if(_0xf97d84){_0x5db44d=_0xf97d84[_0x3619('0x17')]({'plain':!![]});_0x31da90[_0x3619('0x2e')]=_[_0x3619('0x2a')](db['UserOpenchannelQueue'][_0x3619('0x1f')]);_0x31da90[_0x3619('0x2b')]=_[_0x3619('0x2a')](_0x5a7a47[_0x3619('0x2b')]);_0x31da90[_0x3619('0x2c')]=_[_0x3619('0x2d')](_0x31da90[_0x3619('0x2e')],_0x31da90[_0x3619('0x2b')]);_0x2ec365[_0x3619('0x2f')]=_[_0x3619('0x2d')](_0x31da90['model'],qs[_0x3619('0x30')](_0x5a7a47[_0x3619('0x2b')][_0x3619('0x30')]));_0x2ec365['attributes']=_0x2ec365['attributes'][_0x3619('0x31')]?_0x2ec365[_0x3619('0x2f')]:_0x31da90['model'];if(!_0x5a7a47[_0x3619('0x2b')][_0x3619('0x3f')](_0x3619('0x40'))){_0x2ec365['limit']=qs['limit'](_0x5a7a47[_0x3619('0x2b')][_0x3619('0x11')]);_0x2ec365[_0x3619('0xf')]=qs['offset'](_0x5a7a47[_0x3619('0x2b')][_0x3619('0xf')]);}_0x2ec365[_0x3619('0x41')]=qs['sort'](_0x5a7a47[_0x3619('0x2b')][_0x3619('0x42')]);_0x2ec365[_0x3619('0x43')]=qs[_0x3619('0x2c')](_[_0x3619('0x44')](_0x5a7a47[_0x3619('0x2b')],_0x31da90[_0x3619('0x2c')]));_0x2ec365[_0x3619('0x43')][_0x3619('0x45')]=_0xf97d84['id'];if(_0x5a7a47[_0x3619('0x2b')][_0x3619('0x46')]){_0x2ec365[_0x3619('0x43')]=_[_0x3619('0x33')](_0x2ec365[_0x3619('0x43')],{'$or':_[_0x3619('0x1e')](_0x2ec365[_0x3619('0x2f')],function(_0x589259){var _0xe61fff={};_0xe61fff[_0x589259]={'$like':'%'+_0x5a7a47[_0x3619('0x2b')][_0x3619('0x46')]+'%'};return _0xe61fff;})});}_0x2ec365=_[_0x3619('0x33')]({},_0x2ec365,_0x5a7a47[_0x3619('0x34')]);return db[_0x3619('0x47')]['findAll'](_0x2ec365);}})['then'](function(_0x5d7d83){if(_0x5d7d83){return db[_0x3619('0x48')][_0x3619('0x49')]({'where':{'id':_[_0x3619('0x1e')](_0x5d7d83,_0x3619('0x4a')),'role':_0x3619('0x4b')},'attributes':['id',_0x3619('0x1b'),'openchannelPause',_0x3619('0x4c'),_0x3619('0x4d')]});}})[_0x3619('0x15')](function(_0x5beb5b){if(_0x5beb5b){return{'count':_0x5beb5b[_0x3619('0x12')],'rows':_['map'](_0x5beb5b['rows'],function(_0x2ab060){return{'membername':_0x2ab060[_0x3619('0x1b')],'UserId':_0x2ab060['id'],'queue_name':_0x5db44d['name'],'OpenchannelQueueId':_0x5db44d['id'],'interface':util[_0x3619('0x4e')](_0x3619('0x4f'),_0x3619('0x50'),_0x2ab060[_0x3619('0x1b')]),'penalty':0x0,'paused':_0x2ab060[_0x3619('0x51')],'createdAt':_0x2ab060[_0x3619('0x4d')],'updatedAt':_0x2ab060[_0x3619('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3619('0x15')](respondWithFilteredResult(_0x20ce7e,_0x2ec365))['catch'](handleError(_0x20ce7e,null));};exports[_0x3619('0x52')]=function(_0x1688e7,_0x34e624){var _0x182c97={};var _0x1f0e89={};var _0x29e907;var _0x44a66d;return db[_0x3619('0x24')]['findOne']({'where':{'id':_0x1688e7[_0x3619('0x29')]['id']}})['then'](handleEntityNotFound(_0x34e624,null))[_0x3619('0x15')](function(_0x175a34){if(_0x175a34){_0x29e907=_0x175a34;_0x1f0e89[_0x3619('0x2e')]=_['keys'](db['Team'][_0x3619('0x1f')]);_0x1f0e89[_0x3619('0x2b')]=_[_0x3619('0x2a')](_0x1688e7[_0x3619('0x2b')]);_0x1f0e89[_0x3619('0x2c')]=_['intersection'](_0x1f0e89[_0x3619('0x2e')],_0x1f0e89[_0x3619('0x2b')]);_0x182c97[_0x3619('0x2f')]=_[_0x3619('0x2d')](_0x1f0e89[_0x3619('0x2e')],qs['fields'](_0x1688e7[_0x3619('0x2b')][_0x3619('0x30')]));_0x182c97['attributes']=_0x182c97['attributes']['length']?_0x182c97[_0x3619('0x2f')]:_0x1f0e89[_0x3619('0x2e')];_0x182c97['order']=qs[_0x3619('0x42')](_0x1688e7[_0x3619('0x2b')]['sort']);_0x182c97[_0x3619('0x43')]=qs[_0x3619('0x2c')](_['pick'](_0x1688e7[_0x3619('0x2b')],_0x1f0e89[_0x3619('0x2c')]));if(_0x1688e7['query'][_0x3619('0x46')]){_0x182c97[_0x3619('0x43')]=_[_0x3619('0x33')](_0x182c97[_0x3619('0x43')],{'$or':_[_0x3619('0x1e')](_0x182c97[_0x3619('0x2f')],function(_0x433bcf){var _0x58fb22={};_0x58fb22[_0x433bcf]={'$like':'%'+_0x1688e7['query'][_0x3619('0x46')]+'%'};return _0x58fb22;})});}_0x182c97=_[_0x3619('0x33')]({},_0x182c97,_0x1688e7['options']);return _0x29e907[_0x3619('0x52')](_0x182c97);}})[_0x3619('0x15')](function(_0x156e01){if(_0x156e01){_0x44a66d=_0x156e01[_0x3619('0x31')];if(!_0x1688e7['query'][_0x3619('0x3f')](_0x3619('0x40'))){_0x182c97['limit']=qs[_0x3619('0x11')](_0x1688e7[_0x3619('0x2b')][_0x3619('0x11')]);_0x182c97[_0x3619('0xf')]=qs[_0x3619('0xf')](_0x1688e7[_0x3619('0x2b')]['offset']);}return _0x29e907[_0x3619('0x52')](_0x182c97);}})['then'](function(_0x14e9ad){if(_0x14e9ad){return _0x14e9ad?{'count':_0x44a66d,'rows':_0x14e9ad}:null;}})[_0x3619('0x15')](respondWithResult(_0x34e624,null))[_0x3619('0x28')](handleError(_0x34e624,null));};exports[_0x3619('0x53')]=function(_0x2143c4,_0x336a16){var _0x516935=_0x2143c4[_0x3619('0x37')][_0x3619('0x54')];return db[_0x3619('0x55')]['findAll']({'where':{'id':_0x516935},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3619('0x56'),'attributes':['id','name',_0x3619('0x57'),'voicePause',_0x3619('0x58')],'raw':!![]}]})[_0x3619('0x15')](function(_0x30b099){if(_0x30b099){var _0x5075a6=_['flatMap'](_0x30b099,function(_0x1a74ab){var _0x2bd343=_0x1a74ab[_0x3619('0x17')]({'plain':!![]});return _0x2bd343[_0x3619('0x56')];});return db['OpenchannelQueue'][_0x3619('0x35')]({'where':{'id':_0x2143c4[_0x3619('0x29')]['id']}})['then'](function(_0xbb1a3b){return db['sequelize']['transaction'](function(_0xdeb2a3){return _0xbb1a3b[_0x3619('0x53')](_0x516935,{'transaction':_0xdeb2a3})[_0x3619('0x15')](function(){return BPromise[_0x3619('0x59')](_0x5075a6,function(_0x24b4c6){return db['UserOpenchannelQueue'][_0x3619('0x5a')]({'where':{'UserId':_0x24b4c6['id'],'OpenchannelQueueId':_0x2143c4[_0x3619('0x29')]['id']},'transaction':_0xdeb2a3});});})[_0x3619('0x15')](function(){_0x5075a6[_0x3619('0x5b')](function(_0x607d12){socket[_0x3619('0x5c')](_0x3619('0x5d'),{'UserId':_0x607d12['id'],'OpenchannelQueueId':_0xbb1a3b['id']});});});});});}})['then'](respondWithStatusCode(_0x336a16,null))[_0x3619('0x28')](handleError(_0x336a16,null));};exports['removeTeams']=function(_0x5a21bb,_0x2ad6dd){return db['Team'][_0x3619('0x26')]({'where':{'id':_0x5a21bb['query'][_0x3619('0x54')]},'attributes':['id'],'include':[{'model':db[_0x3619('0x48')],'as':_0x3619('0x56'),'attributes':['id'],'raw':!![]}]})[_0x3619('0x15')](handleEntityNotFound(_0x2ad6dd,null))['then'](function(_0x2f4deb){var _0x20e63b=_['map'](_0x2f4deb,'id');var _0x3a6b4d=[];var _0x2c1d5e=[];var _0x374257=squel[_0x3619('0x5e')]();_0x374257[_0x3619('0x5f')](_0x3619('0x60'))['from'](_0x3619('0x61'),'tq')[_0x3619('0x62')](_0x3619('0x63'),'ut',_0x3619('0x64'))[_0x3619('0x43')](_0x3619('0x65'),_0x5a21bb['params']['id']);for(var _0x177c5c=0x0;_0x177c5c<_0x2f4deb['length'];_0x177c5c+=0x1){let _0x140b81=_0x2f4deb[_0x177c5c];for(var _0x16f968=0x0;_0x16f968<_0x140b81[_0x3619('0x56')]['length'];_0x16f968+=0x1){let _0x5eb389=_0x140b81[_0x3619('0x56')][_0x16f968];var _0x135e9c=_0x374257[_0x3619('0x66')]();_0x135e9c[_0x3619('0x43')](_0x3619('0x67'),_0x5eb389['id']);_0x2c1d5e[_0x3619('0x68')](db['sequelize'][_0x3619('0x2b')](_0x135e9c[_0x3619('0x69')](),{'type':db[_0x3619('0x6a')][_0x3619('0x6b')]['SELECT']})['then'](function(_0x1b81bd){if(_0x1b81bd[_0x3619('0x31')]===0x1){return _0x5eb389['id'];}else{var _0xf3b027=_[_0x3619('0x6c')](_[_0x3619('0x1e')](_0x1b81bd,_0x3619('0x6d')),function(_0x237e19){return _[_0x3619('0x6e')](_0x20e63b,_0x237e19);});if(_0xf3b027){return _0x5eb389['id'];}}}));}}return BPromise['all'](_0x2c1d5e)[_0x3619('0x15')](function(_0x1bee20){_0x3a6b4d=_(_0x3a6b4d)[_0x3619('0x6f')](_0x1bee20)['compact']()[_0x3619('0x70')]();return db[_0x3619('0x24')]['find']({'where':{'id':_0x5a21bb['params']['id']}})[_0x3619('0x15')](function(_0x3c6b0a){return db[_0x3619('0x6a')][_0x3619('0x71')](function(_0x2aae7d){return _0x3c6b0a[_0x3619('0x72')](_0x5a21bb[_0x3619('0x2b')][_0x3619('0x54')],{'transaction':_0x2aae7d})[_0x3619('0x15')](function(){if(!_[_0x3619('0x73')](_0x3a6b4d)){return _0x3c6b0a[_0x3619('0x74')](_0x3a6b4d,{'transaction':_0x2aae7d});}})[_0x3619('0x15')](function(){_0x3a6b4d['forEach'](function(_0x24ac76){socket[_0x3619('0x5c')](_0x3619('0x75'),{'UserId':_0x24ac76,'OpenchannelQueueId':_0x3c6b0a['id']});});});});});});})['then'](respondWithStatusCode(_0x2ad6dd,null))['catch'](handleError(_0x2ad6dd,null));};exports[_0x3619('0x76')]=function(_0x11ddb2,_0x6d01be){return db['OpenchannelQueue']['find']({'where':{'id':_0x11ddb2[_0x3619('0x29')]['id']}})[_0x3619('0x15')](handleEntityNotFound(_0x6d01be,null))[_0x3619('0x15')](function(_0x4a3a0e){if(_0x4a3a0e){return _0x4a3a0e[_0x3619('0x76')](_0x11ddb2[_0x3619('0x37')]['ids'],_[_0x3619('0x77')](_0x11ddb2[_0x3619('0x37')],[_0x3619('0x54'),'id'])||{})[_0x3619('0x78')](function(_0x341059){for(var _0x30d715=0x0;_0x30d715<_0x11ddb2[_0x3619('0x37')][_0x3619('0x54')][_0x3619('0x31')];_0x30d715+=0x1){socket[_0x3619('0x5c')](_0x3619('0x5d'),{'UserId':Number(_0x11ddb2[_0x3619('0x37')][_0x3619('0x54')][_0x30d715]),'OpenchannelQueueId':Number(_0x11ddb2[_0x3619('0x29')]['id'])});}return _0x341059;});}})[_0x3619('0x15')](respondWithResult(_0x6d01be,null))[_0x3619('0x28')](handleError(_0x6d01be,null));};exports[_0x3619('0x74')]=function(_0x3bb2fc,_0x3fb6d3){return db[_0x3619('0x24')][_0x3619('0x35')]({'where':{'id':_0x3bb2fc[_0x3619('0x29')]['id']}})[_0x3619('0x15')](handleEntityNotFound(_0x3fb6d3,null))[_0x3619('0x15')](function(_0x32c874){if(_0x32c874){return _0x32c874[_0x3619('0x74')](_0x3bb2fc[_0x3619('0x2b')][_0x3619('0x54')])[_0x3619('0x15')](function(){if(_[_0x3619('0x79')](_0x3bb2fc[_0x3619('0x2b')][_0x3619('0x54')])){for(var _0x1a54e1=0x0;_0x1a54e1<_0x3bb2fc[_0x3619('0x2b')][_0x3619('0x54')][_0x3619('0x31')];_0x1a54e1+=0x1){socket[_0x3619('0x5c')](_0x3619('0x75'),{'UserId':Number(_0x3bb2fc[_0x3619('0x2b')][_0x3619('0x54')][_0x1a54e1]),'OpenchannelQueueId':Number(_0x3bb2fc[_0x3619('0x29')]['id'])});}}else{socket[_0x3619('0x5c')](_0x3619('0x75'),{'UserId':Number(_0x3bb2fc[_0x3619('0x2b')][_0x3619('0x54')]),'OpenchannelQueueId':Number(_0x3bb2fc[_0x3619('0x29')]['id'])});}});}})[_0x3619('0x15')](respondWithStatusCode(_0x3fb6d3,null))[_0x3619('0x28')](handleError(_0x3fb6d3,null));};exports[_0x3619('0x7a')]=function(_0x2215b5,_0x13124b){var _0x5e8b60={};var _0x5ae173={};var _0x3c0be0;var _0x2b21e0;return db['OpenchannelQueue'][_0x3619('0x3e')]({'where':{'id':_0x2215b5['params']['id']}})[_0x3619('0x15')](handleEntityNotFound(_0x13124b,null))[_0x3619('0x15')](function(_0x3f2050){if(_0x3f2050){_0x3c0be0=_0x3f2050;_0x5ae173[_0x3619('0x2e')]=_[_0x3619('0x2a')](db[_0x3619('0x48')][_0x3619('0x1f')]);_0x5ae173[_0x3619('0x2b')]=_[_0x3619('0x2a')](_0x2215b5[_0x3619('0x2b')]);_0x5ae173[_0x3619('0x2c')]=_[_0x3619('0x2d')](_0x5ae173[_0x3619('0x2e')],_0x5ae173[_0x3619('0x2b')]);_0x5e8b60[_0x3619('0x2f')]=_[_0x3619('0x2d')](_0x5ae173[_0x3619('0x2e')],qs[_0x3619('0x30')](_0x2215b5[_0x3619('0x2b')]['fields']));_0x5e8b60[_0x3619('0x2f')]=_0x5e8b60[_0x3619('0x2f')][_0x3619('0x31')]?_0x5e8b60['attributes']:_0x5ae173[_0x3619('0x2e')];_0x5e8b60['order']=qs[_0x3619('0x42')](_0x2215b5['query'][_0x3619('0x42')]);_0x5e8b60['where']=qs[_0x3619('0x2c')](_[_0x3619('0x44')](_0x2215b5[_0x3619('0x2b')],_0x5ae173['filters']));if(_0x2215b5[_0x3619('0x2b')][_0x3619('0x46')]){_0x5e8b60[_0x3619('0x43')]=_[_0x3619('0x33')](_0x5e8b60[_0x3619('0x43')],{'$or':_[_0x3619('0x1e')](_0x5e8b60['attributes'],function(_0x52a1fd){var _0x5da1bb={};_0x5da1bb[_0x52a1fd]={'$like':'%'+_0x2215b5[_0x3619('0x2b')]['filter']+'%'};return _0x5da1bb;})});}_0x5e8b60=_[_0x3619('0x33')]({},_0x5e8b60,_0x2215b5[_0x3619('0x34')]);return _0x3c0be0[_0x3619('0x7a')](_0x5e8b60);}})[_0x3619('0x15')](function(_0xa402d2){if(_0xa402d2){_0x2b21e0=_0xa402d2['length'];if(!_0x2215b5[_0x3619('0x2b')]['hasOwnProperty'](_0x3619('0x40'))){_0x5e8b60[_0x3619('0x11')]=qs[_0x3619('0x11')](_0x2215b5['query']['limit']);_0x5e8b60['offset']=qs[_0x3619('0xf')](_0x2215b5['query']['offset']);}return _0x3c0be0[_0x3619('0x7a')](_0x5e8b60);}})[_0x3619('0x15')](function(_0x4677fb){if(_0x4677fb){return _0x4677fb?{'count':_0x2b21e0,'rows':_0x4677fb}:null;}})[_0x3619('0x15')](respondWithResult(_0x13124b,null))[_0x3619('0x28')](handleError(_0x13124b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 53145de..77005fd 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 _0x6fa8=['update','remove','emit','hook','exports','OpenchannelQueue','setMaxListeners','save'];(function(_0x2fdce0,_0x496242){var _0x36f07e=function(_0x44c8c6){while(--_0x44c8c6){_0x2fdce0['push'](_0x2fdce0['shift']());}};_0x36f07e(++_0x496242);}(_0x6fa8,0x75));var _0x86fa=function(_0x5185c6,_0x4e7c65){_0x5185c6=_0x5185c6-0x0;var _0x1a9c19=_0x6fa8[_0x5185c6];return _0x1a9c19;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require('../../mysqldb')['db'][_0x86fa('0x0')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x86fa('0x1')](0x0);var events={'afterCreate':_0x86fa('0x2'),'afterUpdate':_0x86fa('0x3'),'afterDestroy':_0x86fa('0x4')};function emitEvent(_0x1f3304){return function(_0x15e479,_0x15a027,_0x2bb6ba){OpenchannelQueueEvents[_0x86fa('0x5')](_0x1f3304+':'+_0x15e479['id'],_0x15e479);OpenchannelQueueEvents['emit'](_0x1f3304,_0x15e479);_0x2bb6ba(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x86fa('0x6')](e,emitEvent(event));}}module[_0x86fa('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xfcb5=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','emit'];(function(_0x1875d3,_0x4a6628){var _0x5d42b5=function(_0x16409b){while(--_0x16409b){_0x1875d3['push'](_0x1875d3['shift']());}};_0x5d42b5(++_0x4a6628);}(_0xfcb5,0xab));var _0x5fcb=function(_0x36fd2f,_0x5a0493){_0x36fd2f=_0x36fd2f-0x0;var _0x31ce9e=_0xfcb5[_0x36fd2f];return _0x31ce9e;};'use strict';var EventEmitter=require(_0x5fcb('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x5fcb('0x1')](0x0);var events={'afterCreate':_0x5fcb('0x2'),'afterUpdate':_0x5fcb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3709b9){return function(_0xe485d,_0x49adb8,_0x117a43){OpenchannelQueueEvents[_0x5fcb('0x4')](_0x3709b9+':'+_0xe485d['id'],_0xe485d);OpenchannelQueueEvents[_0x5fcb('0x4')](_0x3709b9,_0xe485d);_0x117a43(null);};}for(var e in events){if(events[_0x5fcb('0x5')](e)){var event=events[e];OpenchannelQueue[_0x5fcb('0x6')](e,emitEvent(event));}}module[_0x5fcb('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index bca98b2..1c84018 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 _0xe5e6=['moment','bluebird','request-promise','path','rimraf','exports','define','openchannel_queues','lodash','util','../../config/logger','api'];(function(_0x184de4,_0xa62bc6){var _0x2de260=function(_0x571c96){while(--_0x571c96){_0x184de4['push'](_0x184de4['shift']());}};_0x2de260(++_0xa62bc6);}(_0xe5e6,0xec));var _0x6e5e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe5e6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6e5e('0x0'));var util=require(_0x6e5e('0x1'));var logger=require(_0x6e5e('0x2'))(_0x6e5e('0x3'));var moment=require(_0x6e5e('0x4'));var BPromise=require(_0x6e5e('0x5'));var rp=require(_0x6e5e('0x6'));var fs=require('fs');var path=require(_0x6e5e('0x7'));var rimraf=require(_0x6e5e('0x8'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0x6e5e('0x9')]=function(_0xcc42ed,_0x587046){return _0xcc42ed[_0x6e5e('0xa')]('OpenchannelQueue',attributes,{'tableName':_0x6e5e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7f3=['path','../../config/environment','define','OpenchannelQueue','util','api','moment','bluebird','request-promise'];(function(_0x57d979,_0x135e67){var _0x1f0747=function(_0x27df83){while(--_0x27df83){_0x57d979['push'](_0x57d979['shift']());}};_0x1f0747(++_0x135e67);}(_0xc7f3,0xe5));var _0x3c7f=function(_0x13594e,_0x6f0ed0){_0x13594e=_0x13594e-0x0;var _0x1a4f42=_0xc7f3[_0x13594e];return _0x1a4f42;};'use strict';var _=require('lodash');var util=require(_0x3c7f('0x0'));var logger=require('../../config/logger')(_0x3c7f('0x1'));var moment=require(_0x3c7f('0x2'));var BPromise=require(_0x3c7f('0x3'));var rp=require(_0x3c7f('0x4'));var fs=require('fs');var path=require(_0x3c7f('0x5'));var rimraf=require('rimraf');var config=require(_0x3c7f('0x6'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x11ef9a,_0x40c06d){return _0x11ef9a[_0x3c7f('0x7')](_0x3c7f('0x8'),attributes,{'tableName':'openchannel_queues','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 4da237f..896e288 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 _0x6b94=['OpenchannelQueue','findAll','options','where','limit','include','map','model','attributes','then','debug','catch','ShowOpenchannelQueue','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueue,\x20%s,\x20%s','message','result','GetOpenchannelQueue'];(function(_0x483f79,_0x36af41){var _0x1ade2f=function(_0x2bdeb6){while(--_0x2bdeb6){_0x483f79['push'](_0x483f79['shift']());}};_0x1ade2f(++_0x36af41);}(_0x6b94,0x156));var _0x46b9=function(_0x6fc7bf,_0x57b7ad){_0x6fc7bf=_0x6fc7bf-0x0;var _0x97def1=_0x6b94[_0x6fc7bf];return _0x97def1;};'use strict';var _=require(_0x46b9('0x0'));var util=require('util');var moment=require(_0x46b9('0x1'));var BPromise=require(_0x46b9('0x2'));var rs=require(_0x46b9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46b9('0x4'))['db'];var utils=require(_0x46b9('0x5'));var logger=require(_0x46b9('0x6'))(_0x46b9('0x7'));var config=require('../../config/environment');var jayson=require(_0x46b9('0x8'));var client=jayson[_0x46b9('0x9')][_0x46b9('0xa')]({'port':0x232a});config[_0x46b9('0xb')]=_[_0x46b9('0xc')](config[_0x46b9('0xb')],{'host':_0x46b9('0xd'),'port':0x18eb});var socket=require(_0x46b9('0xe'))(new Redis(config[_0x46b9('0xb')]));require(_0x46b9('0xf'))[_0x46b9('0x10')](socket);function respondWithRpcPromise(_0x46a0e8,_0x464edc,_0xae0e80){return new BPromise(function(_0x5e24d7,_0x4f38c8){return client[_0x46b9('0x11')](_0x46a0e8,_0xae0e80)['then'](function(_0x365689){logger[_0x46b9('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x464edc,_0x46b9('0x13'));logger['debug'](_0x46b9('0x14'),_0x464edc,_0x46b9('0x13'),JSON[_0x46b9('0x15')](_0x365689));if(_0x365689[_0x46b9('0x16')]){if(_0x365689['error']['code']===0x1f4){logger['error'](_0x46b9('0x17'),_0x464edc,_0x365689[_0x46b9('0x16')][_0x46b9('0x18')]);return _0x4f38c8(_0x365689[_0x46b9('0x16')][_0x46b9('0x18')]);}logger['error'](_0x46b9('0x17'),_0x464edc,_0x365689[_0x46b9('0x16')][_0x46b9('0x18')]);return _0x5e24d7(_0x365689['error'][_0x46b9('0x18')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x464edc,_0x46b9('0x13'));_0x5e24d7(_0x365689[_0x46b9('0x19')][_0x46b9('0x18')]);}})['catch'](function(_0x4b43c9){logger[_0x46b9('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x464edc,_0x4b43c9);_0x4f38c8(_0x4b43c9);});});}exports[_0x46b9('0x1a')]=function(_0x3ce0b7){var _0x367360=this;return new Promise(function(_0x31b0ed,_0x209bd2){return db[_0x46b9('0x1b')][_0x46b9('0x1c')]({'raw':_0x3ce0b7[_0x46b9('0x1d')]?_0x3ce0b7[_0x46b9('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3ce0b7[_0x46b9('0x1d')]?_0x3ce0b7[_0x46b9('0x1d')][_0x46b9('0x1e')]||null:null,'attributes':_0x3ce0b7[_0x46b9('0x1d')]?_0x3ce0b7[_0x46b9('0x1d')]['attributes']||null:null,'limit':_0x3ce0b7['options']?_0x3ce0b7[_0x46b9('0x1d')][_0x46b9('0x1f')]||null:null,'include':_0x3ce0b7[_0x46b9('0x1d')]?_0x3ce0b7[_0x46b9('0x1d')][_0x46b9('0x20')]?_[_0x46b9('0x21')](_0x3ce0b7['options'][_0x46b9('0x20')],function(_0x55e2c3){return{'model':db[_0x55e2c3['model']],'as':_0x55e2c3['as'],'attributes':_0x55e2c3['attributes'],'include':_0x55e2c3[_0x46b9('0x20')]?_[_0x46b9('0x21')](_0x55e2c3[_0x46b9('0x20')],function(_0x20fe44){return{'model':db[_0x20fe44[_0x46b9('0x22')]],'as':_0x20fe44['as'],'attributes':_0x20fe44['attributes'],'include':_0x20fe44[_0x46b9('0x20')]?_['map'](_0x20fe44[_0x46b9('0x20')],function(_0x383ff4){return{'model':db[_0x383ff4[_0x46b9('0x22')]],'as':_0x383ff4['as'],'attributes':_0x383ff4[_0x46b9('0x23')]};}):[]};}):[]};}):[]:[]})[_0x46b9('0x24')](function(_0x431d03){logger['info'](_0x46b9('0x1a'),_0x3ce0b7);logger[_0x46b9('0x25')]('GetOpenchannelQueue',_0x3ce0b7,JSON[_0x46b9('0x15')](_0x431d03));_0x31b0ed(_0x431d03);})[_0x46b9('0x26')](function(_0x2454fd){logger[_0x46b9('0x16')](_0x46b9('0x1a'),_0x2454fd[_0x46b9('0x18')],_0x3ce0b7);_0x209bd2(_0x367360[_0x46b9('0x16')](0x1f4,_0x2454fd[_0x46b9('0x18')]));});});};exports[_0x46b9('0x27')]=function(_0x4e3511){var _0xa1b4ab=this;return new Promise(function(_0x8bcf62,_0x1f4f4a){return db[_0x46b9('0x1b')][_0x46b9('0x28')]({'raw':_0x4e3511['options']?_0x4e3511[_0x46b9('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4e3511[_0x46b9('0x1d')]?_0x4e3511[_0x46b9('0x1d')][_0x46b9('0x1e')]||null:null,'attributes':_0x4e3511[_0x46b9('0x1d')]?_0x4e3511[_0x46b9('0x1d')][_0x46b9('0x23')]||null:null,'include':_0x4e3511[_0x46b9('0x1d')]?_0x4e3511['options'][_0x46b9('0x20')]?_[_0x46b9('0x21')](_0x4e3511[_0x46b9('0x1d')]['include'],function(_0x5d1a9c){return{'model':db[_0x5d1a9c[_0x46b9('0x22')]],'as':_0x5d1a9c['as'],'attributes':_0x5d1a9c['attributes'],'include':_0x5d1a9c[_0x46b9('0x20')]?_['map'](_0x5d1a9c[_0x46b9('0x20')],function(_0x80ede0){return{'model':db[_0x80ede0[_0x46b9('0x22')]],'as':_0x80ede0['as'],'attributes':_0x80ede0[_0x46b9('0x23')],'include':_0x80ede0[_0x46b9('0x20')]?_['map'](_0x80ede0[_0x46b9('0x20')],function(_0x2d0116){return{'model':db[_0x2d0116[_0x46b9('0x22')]],'as':_0x2d0116['as'],'attributes':_0x2d0116[_0x46b9('0x23')]};}):[]};}):[]};}):[]:[]})[_0x46b9('0x24')](function(_0x1a6c77){logger['info'](_0x46b9('0x27'),_0x4e3511);logger[_0x46b9('0x25')]('ShowOpenchannelQueue',_0x4e3511,JSON[_0x46b9('0x15')](_0x1a6c77));_0x8bcf62(_0x1a6c77);})[_0x46b9('0x26')](function(_0x39be74){logger['error'](_0x46b9('0x27'),_0x39be74[_0x46b9('0x18')],_0x4e3511);_0x1f4f4a(_0xa1b4ab[_0x46b9('0x16')](0x1f4,_0x39be74['message']));});});}; \ No newline at end of file +var _0x5b0d=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowOpenchannelQueue','find'];(function(_0xe4ee1e,_0xea8b9b){var _0x22f903=function(_0x423070){while(--_0x423070){_0xe4ee1e['push'](_0xe4ee1e['shift']());}};_0x22f903(++_0xea8b9b);}(_0x5b0d,0x1e0));var _0xd5b0=function(_0x344073,_0x443928){_0x344073=_0x344073-0x0;var _0x22aa0d=_0x5b0d[_0x344073];return _0x22aa0d;};'use strict';var _=require(_0xd5b0('0x0'));var util=require(_0xd5b0('0x1'));var moment=require(_0xd5b0('0x2'));var BPromise=require('bluebird');var rs=require(_0xd5b0('0x3'));var fs=require('fs');var Redis=require(_0xd5b0('0x4'));var db=require(_0xd5b0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd5b0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd5b0('0x7')][_0xd5b0('0x8')]({'port':0x232a});config[_0xd5b0('0x9')]=_[_0xd5b0('0xa')](config[_0xd5b0('0x9')],{'host':_0xd5b0('0xb'),'port':0x18eb});var socket=require(_0xd5b0('0xc'))(new Redis(config[_0xd5b0('0x9')]));require(_0xd5b0('0xd'))[_0xd5b0('0xe')](socket);function respondWithRpcPromise(_0x195efb,_0x4a1be4,_0x2a2391){return new BPromise(function(_0x3f1ca5,_0x42b553){return client[_0xd5b0('0xf')](_0x195efb,_0x2a2391)[_0xd5b0('0x10')](function(_0x53df16){logger[_0xd5b0('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x4a1be4,_0xd5b0('0x12'));logger['debug'](_0xd5b0('0x13'),_0x4a1be4,'request\x20sent',JSON[_0xd5b0('0x14')](_0x53df16));if(_0x53df16['error']){if(_0x53df16[_0xd5b0('0x15')][_0xd5b0('0x16')]===0x1f4){logger['error'](_0xd5b0('0x17'),_0x4a1be4,_0x53df16[_0xd5b0('0x15')][_0xd5b0('0x18')]);return _0x42b553(_0x53df16[_0xd5b0('0x15')][_0xd5b0('0x18')]);}logger[_0xd5b0('0x15')](_0xd5b0('0x17'),_0x4a1be4,_0x53df16[_0xd5b0('0x15')][_0xd5b0('0x18')]);return _0x3f1ca5(_0x53df16['error'][_0xd5b0('0x18')]);}else{logger[_0xd5b0('0x11')](_0xd5b0('0x17'),_0x4a1be4,_0xd5b0('0x12'));_0x3f1ca5(_0x53df16[_0xd5b0('0x19')][_0xd5b0('0x18')]);}})[_0xd5b0('0x1a')](function(_0x3282b4){logger['error'](_0xd5b0('0x17'),_0x4a1be4,_0x3282b4);_0x42b553(_0x3282b4);});});}exports[_0xd5b0('0x1b')]=function(_0x9f973d){var _0x21bbfa=this;return new Promise(function(_0xc9c2b9,_0x26a41e){return db['OpenchannelQueue'][_0xd5b0('0x1c')]({'raw':_0x9f973d[_0xd5b0('0x1d')]?_0x9f973d[_0xd5b0('0x1d')][_0xd5b0('0x1e')]===undefined?!![]:![]:!![],'where':_0x9f973d[_0xd5b0('0x1d')]?_0x9f973d['options'][_0xd5b0('0x1f')]||null:null,'attributes':_0x9f973d[_0xd5b0('0x1d')]?_0x9f973d[_0xd5b0('0x1d')][_0xd5b0('0x20')]||null:null,'limit':_0x9f973d[_0xd5b0('0x1d')]?_0x9f973d[_0xd5b0('0x1d')][_0xd5b0('0x21')]||null:null,'include':_0x9f973d[_0xd5b0('0x1d')]?_0x9f973d[_0xd5b0('0x1d')][_0xd5b0('0x22')]?_[_0xd5b0('0x23')](_0x9f973d[_0xd5b0('0x1d')][_0xd5b0('0x22')],function(_0x10f540){return{'model':db[_0x10f540[_0xd5b0('0x24')]],'as':_0x10f540['as'],'attributes':_0x10f540[_0xd5b0('0x20')],'include':_0x10f540['include']?_[_0xd5b0('0x23')](_0x10f540['include'],function(_0x11443c){return{'model':db[_0x11443c['model']],'as':_0x11443c['as'],'attributes':_0x11443c[_0xd5b0('0x20')],'include':_0x11443c[_0xd5b0('0x22')]?_[_0xd5b0('0x23')](_0x11443c[_0xd5b0('0x22')],function(_0x2cb86b){return{'model':db[_0x2cb86b[_0xd5b0('0x24')]],'as':_0x2cb86b['as'],'attributes':_0x2cb86b[_0xd5b0('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd5b0('0x10')](function(_0x56b9bb){logger[_0xd5b0('0x11')]('GetOpenchannelQueue',_0x9f973d);logger[_0xd5b0('0x25')](_0xd5b0('0x1b'),_0x9f973d,JSON[_0xd5b0('0x14')](_0x56b9bb));_0xc9c2b9(_0x56b9bb);})[_0xd5b0('0x1a')](function(_0x319fc3){logger[_0xd5b0('0x15')]('GetOpenchannelQueue',_0x319fc3[_0xd5b0('0x18')],_0x9f973d);_0x26a41e(_0x21bbfa[_0xd5b0('0x15')](0x1f4,_0x319fc3[_0xd5b0('0x18')]));});});};exports[_0xd5b0('0x26')]=function(_0x448745){var _0x1b6706=this;return new Promise(function(_0x3597fb,_0x569ab2){return db['OpenchannelQueue'][_0xd5b0('0x27')]({'raw':_0x448745[_0xd5b0('0x1d')]?_0x448745[_0xd5b0('0x1d')][_0xd5b0('0x1e')]===undefined?!![]:![]:!![],'where':_0x448745[_0xd5b0('0x1d')]?_0x448745['options']['where']||null:null,'attributes':_0x448745['options']?_0x448745['options'][_0xd5b0('0x20')]||null:null,'include':_0x448745[_0xd5b0('0x1d')]?_0x448745[_0xd5b0('0x1d')][_0xd5b0('0x22')]?_['map'](_0x448745[_0xd5b0('0x1d')]['include'],function(_0x296966){return{'model':db[_0x296966[_0xd5b0('0x24')]],'as':_0x296966['as'],'attributes':_0x296966[_0xd5b0('0x20')],'include':_0x296966['include']?_[_0xd5b0('0x23')](_0x296966['include'],function(_0x4c08ba){return{'model':db[_0x4c08ba[_0xd5b0('0x24')]],'as':_0x4c08ba['as'],'attributes':_0x4c08ba['attributes'],'include':_0x4c08ba['include']?_['map'](_0x4c08ba[_0xd5b0('0x22')],function(_0x9fd075){return{'model':db[_0x9fd075[_0xd5b0('0x24')]],'as':_0x9fd075['as'],'attributes':_0x9fd075[_0xd5b0('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd5b0('0x10')](function(_0x220fed){logger['info'](_0xd5b0('0x26'),_0x448745);logger[_0xd5b0('0x25')](_0xd5b0('0x26'),_0x448745,JSON[_0xd5b0('0x14')](_0x220fed));_0x3597fb(_0x220fed);})[_0xd5b0('0x1a')](function(_0x243b4f){logger[_0xd5b0('0x15')]('ShowOpenchannelQueue',_0x243b4f[_0xd5b0('0x18')],_0x448745);_0x569ab2(_0x1b6706['error'](0x1f4,_0x243b4f[_0xd5b0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index e41dc40..e8b44af 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 _0xedf5=['emit','register','length','openchannelQueue:','./openchannelQueue.events','remove','update'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0xedf5,0x131));var _0x5edf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xedf5[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelQueueEvents=require(_0x5edf('0x0'));var events=['save',_0x5edf('0x1'),_0x5edf('0x2')];function createListener(_0x324054,_0x50b18a){return function(_0x26c065){_0x50b18a[_0x5edf('0x3')](_0x324054,_0x26c065);};}function removeListener(_0x4b62eb,_0x314638){return function(){OpenchannelQueueEvents['removeListener'](_0x4b62eb,_0x314638);};}exports[_0x5edf('0x4')]=function(_0x3c3f19){for(var _0x470e7b=0x0,_0x5d1194=events[_0x5edf('0x5')];_0x470e7b<_0x5d1194;_0x470e7b++){var _0x2b4734=events[_0x470e7b];var _0x6eeb6a=createListener(_0x5edf('0x6')+_0x2b4734,_0x3c3f19);OpenchannelQueueEvents['on'](_0x2b4734,_0x6eeb6a);}}; \ No newline at end of file +var _0x9b93=['update','length','remove'];(function(_0x4da599,_0x1b8240){var _0x18d81c=function(_0x5a7217){while(--_0x5a7217){_0x4da599['push'](_0x4da599['shift']());}};_0x18d81c(++_0x1b8240);}(_0x9b93,0xe9));var _0x39b9=function(_0x152b03,_0x2b427f){_0x152b03=_0x152b03-0x0;var _0x5a5d4b=_0x9b93[_0x152b03];return _0x5a5d4b;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0x39b9('0x0'),_0x39b9('0x1')];function createListener(_0x40694b,_0x2572cc){return function(_0x3cb41f){_0x2572cc['emit'](_0x40694b,_0x3cb41f);};}function removeListener(_0x5f06cc,_0x7d09b3){return function(){OpenchannelQueueEvents['removeListener'](_0x5f06cc,_0x7d09b3);};}exports['register']=function(_0x234130){for(var _0x3ee9e7=0x0,_0x52adb6=events[_0x39b9('0x2')];_0x3ee9e7<_0x52adb6;_0x3ee9e7++){var _0x3dc71a=events[_0x3ee9e7];var _0x3114fc=createListener('openchannelQueue:'+_0x3dc71a,_0x234130);OpenchannelQueueEvents['on'](_0x3dc71a,_0x3114fc);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 8573e12..ee05565 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 _0x30bc=['exports','multer','util','path','fs-extra','../../config/environment','get','isAuthenticated','/describe','describe','/:id','post','create','delete','destroy'];(function(_0x49567a,_0x34b40d){var _0x560cd0=function(_0x54ba19){while(--_0x54ba19){_0x49567a['push'](_0x49567a['shift']());}};_0x560cd0(++_0x34b40d);}(_0x30bc,0x1d2));var _0xc30b=function(_0x13c4eb,_0x5d218c){_0x13c4eb=_0x13c4eb-0x0;var _0x421546=_0x30bc[_0x13c4eb];return _0x421546;};'use strict';var multer=require(_0xc30b('0x0'));var util=require(_0xc30b('0x1'));var path=require(_0xc30b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xc30b('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc30b('0x4'));var controller=require('./openchannelQueueReport.controller');router[_0xc30b('0x5')]('/',auth[_0xc30b('0x6')](),controller['index']);router[_0xc30b('0x5')](_0xc30b('0x7'),auth[_0xc30b('0x6')](),controller[_0xc30b('0x8')]);router[_0xc30b('0x5')](_0xc30b('0x9'),auth[_0xc30b('0x6')](),controller['show']);router[_0xc30b('0xa')]('/',auth['isAuthenticated'](),controller[_0xc30b('0xb')]);router['put']('/:id',auth[_0xc30b('0x6')](),controller['update']);router[_0xc30b('0xc')](_0xc30b('0x9'),auth[_0xc30b('0x6')](),controller[_0xc30b('0xd')]);module[_0xc30b('0xe')]=router; \ No newline at end of file +var _0x148b=['update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x148b,0x154));var _0xb148=function(_0x59e96a,_0x49234f){_0x59e96a=_0x59e96a-0x0;var _0x10ee58=_0x148b[_0x59e96a];return _0x10ee58;};'use strict';var multer=require(_0xb148('0x0'));var util=require('util');var path=require(_0xb148('0x1'));var timeout=require('connect-timeout');var express=require(_0xb148('0x2'));var router=express[_0xb148('0x3')]();var fs_extra=require(_0xb148('0x4'));var auth=require(_0xb148('0x5'));var interaction=require(_0xb148('0x6'));var config=require(_0xb148('0x7'));var controller=require(_0xb148('0x8'));router[_0xb148('0x9')]('/',auth[_0xb148('0xa')](),controller['index']);router['get']('/describe',auth[_0xb148('0xa')](),controller[_0xb148('0xb')]);router['get'](_0xb148('0xc'),auth[_0xb148('0xa')](),controller[_0xb148('0xd')]);router[_0xb148('0xe')]('/',auth[_0xb148('0xa')](),controller[_0xb148('0xf')]);router[_0xb148('0x10')](_0xb148('0xc'),auth['isAuthenticated'](),controller[_0xb148('0x11')]);router[_0xb148('0x12')](_0xb148('0xc'),auth[_0xb148('0xa')](),controller[_0xb148('0x13')]);module[_0xb148('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index f93cbee..c99dbe8 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 _0x45cb=['DATE','STRING','moment','exports'];(function(_0x2d086e,_0x5516c7){var _0x39bd87=function(_0x4c9997){while(--_0x4c9997){_0x2d086e['push'](_0x2d086e['shift']());}};_0x39bd87(++_0x5516c7);}(_0x45cb,0x126));var _0xb45c=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x45cb[_0xaa1b3e];return _0x454d7d;};'use strict';var moment=require(_0xb45c('0x0'));var Sequelize=require('sequelize');module[_0xb45c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb45c('0x2')]},'leaveAt':{'type':Sequelize[_0xb45c('0x2')]},'acceptAt':{'type':Sequelize[_0xb45c('0x2')]},'exitAt':{'type':Sequelize[_0xb45c('0x2')]},'reason':{'type':Sequelize[_0xb45c('0x3')]}}; \ No newline at end of file +var _0x7db4=['moment','sequelize','exports','STRING','DATE'];(function(_0x239c5a,_0x398f18){var _0x412a94=function(_0x2727ee){while(--_0x2727ee){_0x239c5a['push'](_0x239c5a['shift']());}};_0x412a94(++_0x398f18);}(_0x7db4,0x127));var _0x47db=function(_0x190b37,_0x386197){_0x190b37=_0x190b37-0x0;var _0x4e7eb7=_0x7db4[_0x190b37];return _0x4e7eb7;};'use strict';var moment=require(_0x47db('0x0'));var Sequelize=require(_0x47db('0x1'));module[_0x47db('0x2')]={'uniqueid':{'type':Sequelize[_0x47db('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x47db('0x3')]},'joinAt':{'type':Sequelize[_0x47db('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x47db('0x4')]},'exitAt':{'type':Sequelize[_0x47db('0x4')]},'reason':{'type':Sequelize[_0x47db('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 7f74cf6..b02d78b 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 _0xf37b=['find','destroy','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','OpenchannelQueueReport','includeAll','rows','catch','show','params','include','create','body'];(function(_0x33c603,_0x6d0ce4){var _0xae96f4=function(_0x2679f8){while(--_0x2679f8){_0x33c603['push'](_0x33c603['shift']());}};_0xae96f4(++_0x6d0ce4);}(_0xf37b,0x97));var _0xbf37=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xf37b[_0x187ee1];return _0x388160;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf37('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf37('0x1'));var rp=require(_0xbf37('0x2'));var moment=require(_0xbf37('0x3'));var BPromise=require(_0xbf37('0x4'));var Mustache=require(_0xbf37('0x5'));var util=require(_0xbf37('0x6'));var path=require(_0xbf37('0x7'));var sox=require(_0xbf37('0x8'));var csv=require(_0xbf37('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf37('0xa'));var squel=require(_0xbf37('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbf37('0xc'));var toCsv=require(_0xbf37('0x9'));var querystring=require(_0xbf37('0xd'));var Papa=require(_0xbf37('0xe'));var Redis=require(_0xbf37('0xf'));var authService=require(_0xbf37('0x10'));var qs=require(_0xbf37('0x11'));var as=require(_0xbf37('0x12'));var hardwareService=require(_0xbf37('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xbf37('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbf37('0x15'))['db'];function respondWithStatusCode(_0x554c08,_0x5153b5){_0x5153b5=_0x5153b5||0xcc;return function(_0x3034fe){if(_0x3034fe){return _0x554c08['sendStatus'](_0x5153b5);}return _0x554c08[_0xbf37('0x16')](_0x5153b5)[_0xbf37('0x17')]();};}function respondWithResult(_0x53000b,_0x36aba2){_0x36aba2=_0x36aba2||0xc8;return function(_0x119aef){if(_0x119aef){return _0x53000b[_0xbf37('0x16')](_0x36aba2)[_0xbf37('0x18')](_0x119aef);}};}function respondWithFilteredResult(_0x5b14da,_0x2c63c6){return function(_0x3ca4a6){if(_0x3ca4a6){var _0x47c885=typeof _0x2c63c6['offset']===_0xbf37('0x19')&&typeof _0x2c63c6[_0xbf37('0x1a')]==='undefined';var _0x286b80=_0x3ca4a6[_0xbf37('0x1b')];var _0x24bfcc=_0x47c885?0x0:_0x2c63c6[_0xbf37('0x1c')];var _0x52e766=_0x47c885?_0x3ca4a6['count']:_0x2c63c6['offset']+_0x2c63c6[_0xbf37('0x1a')];var _0x469420;if(_0x52e766>=_0x286b80){_0x52e766=_0x286b80;_0x469420=0xc8;}else{_0x469420=0xce;}_0x5b14da[_0xbf37('0x16')](_0x469420);return _0x5b14da[_0xbf37('0x1d')](_0xbf37('0x1e'),_0x24bfcc+'-'+_0x52e766+'/'+_0x286b80)[_0xbf37('0x18')](_0x3ca4a6);}return null;};}function patchUpdates(_0x5c90c0){return function(_0x501d3b){try{jsonpatch[_0xbf37('0x1f')](_0x501d3b,_0x5c90c0,!![]);}catch(_0x21424e){return BPromise[_0xbf37('0x20')](_0x21424e);}return _0x501d3b[_0xbf37('0x21')]();};}function saveUpdates(_0x4846ac,_0x58357c){return function(_0x4079c3){if(_0x4079c3){return _0x4079c3[_0xbf37('0x22')](_0x4846ac)[_0xbf37('0x23')](function(_0x4f7f4a){return _0x4f7f4a;});}return null;};}function removeEntity(_0x3c5a81,_0x9bca2f){return function(_0x39f2c0){if(_0x39f2c0){return _0x39f2c0['destroy']()[_0xbf37('0x23')](function(){_0x3c5a81['status'](0xcc)[_0xbf37('0x17')]();});}};}function handleEntityNotFound(_0x50d016,_0x26ddfe){return function(_0x59d85f){if(!_0x59d85f){_0x50d016[_0xbf37('0x24')](0x194);}return _0x59d85f;};}function handleError(_0x54d6af,_0x44379f){_0x44379f=_0x44379f||0x1f4;return function(_0x46257d){logger['error'](_0x46257d['stack']);if(_0x46257d[_0xbf37('0x25')]){delete _0x46257d['name'];}_0x54d6af['status'](_0x44379f)[_0xbf37('0x26')](_0x46257d);};}exports[_0xbf37('0x27')]=function(_0x130e34,_0x5977fe){var _0x1d6286={},_0x4dea36={},_0x418aa1={'count':0x0,'rows':[]};var _0x461593=_[_0xbf37('0x28')](db['OpenchannelQueueReport'][_0xbf37('0x29')],function(_0x94aa53){return{'name':_0x94aa53[_0xbf37('0x2a')],'type':_0x94aa53[_0xbf37('0x2b')][_0xbf37('0x2c')]};});_0x4dea36[_0xbf37('0x2d')]=_[_0xbf37('0x28')](_0x461593,_0xbf37('0x25'));_0x4dea36[_0xbf37('0x2e')]=_[_0xbf37('0x2f')](_0x130e34['query']);_0x4dea36[_0xbf37('0x30')]=_[_0xbf37('0x31')](_0x4dea36[_0xbf37('0x2d')],_0x4dea36[_0xbf37('0x2e')]);_0x1d6286[_0xbf37('0x32')]=_[_0xbf37('0x31')](_0x4dea36[_0xbf37('0x2d')],qs[_0xbf37('0x33')](_0x130e34['query'][_0xbf37('0x33')]));_0x1d6286[_0xbf37('0x32')]=_0x1d6286[_0xbf37('0x32')][_0xbf37('0x34')]?_0x1d6286['attributes']:_0x4dea36[_0xbf37('0x2d')];if(!_0x130e34['query'][_0xbf37('0x35')]('nolimit')){_0x1d6286[_0xbf37('0x1a')]=qs['limit'](_0x130e34['query'][_0xbf37('0x1a')]);_0x1d6286['offset']=qs['offset'](_0x130e34['query']['offset']);}_0x1d6286[_0xbf37('0x36')]=qs[_0xbf37('0x37')](_0x130e34[_0xbf37('0x2e')]['sort']);_0x1d6286[_0xbf37('0x38')]=qs['filters'](_[_0xbf37('0x39')](_0x130e34[_0xbf37('0x2e')],_0x4dea36[_0xbf37('0x30')]),_0x461593);if(_0x130e34[_0xbf37('0x2e')][_0xbf37('0x3a')]){_0x1d6286['where']=_['merge'](_0x1d6286[_0xbf37('0x38')],{'$or':_[_0xbf37('0x28')](_0x461593,function(_0x111d5d){if(_0x111d5d['type']!==_0xbf37('0x3b')){var _0x1bec70={};_0x1bec70[_0x111d5d[_0xbf37('0x25')]]={'$like':'%'+_0x130e34[_0xbf37('0x2e')]['filter']+'%'};return _0x1bec70;}})});}_0x1d6286=_[_0xbf37('0x3c')]({},_0x1d6286,_0x130e34[_0xbf37('0x3d')]);var _0x5554e1={'where':_0x1d6286[_0xbf37('0x38')]};return db[_0xbf37('0x3e')][_0xbf37('0x1b')](_0x5554e1)[_0xbf37('0x23')](function(_0x477167){_0x418aa1['count']=_0x477167;if(_0x130e34[_0xbf37('0x2e')][_0xbf37('0x3f')]){_0x1d6286['include']=[{'all':!![]}];}return db[_0xbf37('0x3e')]['findAll'](_0x1d6286);})[_0xbf37('0x23')](function(_0x39da42){_0x418aa1[_0xbf37('0x40')]=_0x39da42;return _0x418aa1;})[_0xbf37('0x23')](respondWithFilteredResult(_0x5977fe,_0x1d6286))[_0xbf37('0x41')](handleError(_0x5977fe,null));};exports[_0xbf37('0x42')]=function(_0x30d1a8,_0x92da94){var _0x249da8={'raw':!![],'where':{'id':_0x30d1a8[_0xbf37('0x43')]['id']}},_0x28fcd3={};_0x28fcd3['model']=_[_0xbf37('0x2f')](db[_0xbf37('0x3e')][_0xbf37('0x29')]);_0x28fcd3[_0xbf37('0x2e')]=_[_0xbf37('0x2f')](_0x30d1a8[_0xbf37('0x2e')]);_0x28fcd3[_0xbf37('0x30')]=_[_0xbf37('0x31')](_0x28fcd3[_0xbf37('0x2d')],_0x28fcd3[_0xbf37('0x2e')]);_0x249da8[_0xbf37('0x32')]=_[_0xbf37('0x31')](_0x28fcd3['model'],qs['fields'](_0x30d1a8['query'][_0xbf37('0x33')]));_0x249da8[_0xbf37('0x32')]=_0x249da8[_0xbf37('0x32')][_0xbf37('0x34')]?_0x249da8[_0xbf37('0x32')]:_0x28fcd3[_0xbf37('0x2d')];if(_0x30d1a8[_0xbf37('0x2e')][_0xbf37('0x3f')]){_0x249da8[_0xbf37('0x44')]=[{'all':!![]}];}_0x249da8=_[_0xbf37('0x3c')]({},_0x249da8,_0x30d1a8['options']);return db[_0xbf37('0x3e')]['find'](_0x249da8)[_0xbf37('0x23')](handleEntityNotFound(_0x92da94,null))['then'](respondWithResult(_0x92da94,null))['catch'](handleError(_0x92da94,null));};exports['create']=function(_0x30d99d,_0x47e584){return db[_0xbf37('0x3e')][_0xbf37('0x45')](_0x30d99d[_0xbf37('0x46')],{})['then'](respondWithResult(_0x47e584,0xc9))[_0xbf37('0x41')](handleError(_0x47e584,null));};exports[_0xbf37('0x22')]=function(_0x2e5492,_0x1bb84e){if(_0x2e5492[_0xbf37('0x46')]['id']){delete _0x2e5492['body']['id'];}return db[_0xbf37('0x3e')][_0xbf37('0x47')]({'where':{'id':_0x2e5492['params']['id']}})['then'](handleEntityNotFound(_0x1bb84e,null))[_0xbf37('0x23')](saveUpdates(_0x2e5492[_0xbf37('0x46')],null))[_0xbf37('0x23')](respondWithResult(_0x1bb84e,null))[_0xbf37('0x41')](handleError(_0x1bb84e,null));};exports[_0xbf37('0x48')]=function(_0x101bed,_0x2fc45e){return db[_0xbf37('0x3e')][_0xbf37('0x47')]({'where':{'id':_0x101bed[_0xbf37('0x43')]['id']}})[_0xbf37('0x23')](handleEntityNotFound(_0x2fc45e,null))['then'](removeEntity(_0x2fc45e,null))[_0xbf37('0x41')](handleError(_0x2fc45e,null));};exports[_0xbf37('0x49')]=function(_0x5a1d63,_0x4953fe){return db[_0xbf37('0x3e')]['describe']()[_0xbf37('0x23')](respondWithResult(_0x4953fe,null))[_0xbf37('0x41')](handleError(_0x4953fe,null));}; \ No newline at end of file +var _0x843f=['undefined','limit','count','set','apply','save','update','then','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','keys','query','attributes','fields','nolimit','order','sort','where','filters','merge','filter','includeAll','include','findAll','rows','catch','show','intersection','length','options','create','body','find','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x843f,0xbb));var _0xf843=function(_0x3d0613,_0x5023fa){_0x3d0613=_0x3d0613-0x0;var _0x4cea91=_0x843f[_0x3d0613];return _0x4cea91;};'use strict';var emlformat=require(_0xf843('0x0'));var rimraf=require(_0xf843('0x1'));var zipdir=require(_0xf843('0x2'));var jsonpatch=require(_0xf843('0x3'));var rp=require(_0xf843('0x4'));var moment=require('moment');var BPromise=require(_0xf843('0x5'));var Mustache=require(_0xf843('0x6'));var util=require(_0xf843('0x7'));var path=require(_0xf843('0x8'));var sox=require(_0xf843('0x9'));var csv=require(_0xf843('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf843('0xb'));var _=require('lodash');var squel=require(_0xf843('0xc'));var crypto=require(_0xf843('0xd'));var jsforce=require(_0xf843('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf843('0xa'));var querystring=require(_0xf843('0xf'));var Papa=require('papaparse');var Redis=require(_0xf843('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf843('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf843('0x12'));var logger=require(_0xf843('0x13'))('api');var utils=require(_0xf843('0x14'));var config=require(_0xf843('0x15'));var licenseUtil=require(_0xf843('0x16'));var db=require(_0xf843('0x17'))['db'];function respondWithStatusCode(_0x825686,_0x444102){_0x444102=_0x444102||0xcc;return function(_0x4335f3){if(_0x4335f3){return _0x825686[_0xf843('0x18')](_0x444102);}return _0x825686[_0xf843('0x19')](_0x444102)[_0xf843('0x1a')]();};}function respondWithResult(_0x12ef86,_0x33825e){_0x33825e=_0x33825e||0xc8;return function(_0x506e98){if(_0x506e98){return _0x12ef86['status'](_0x33825e)[_0xf843('0x1b')](_0x506e98);}};}function respondWithFilteredResult(_0x25708d,_0x34d981){return function(_0x4feec6){if(_0x4feec6){var _0xa58778=typeof _0x34d981[_0xf843('0x1c')]===_0xf843('0x1d')&&typeof _0x34d981[_0xf843('0x1e')]===_0xf843('0x1d');var _0x4db009=_0x4feec6['count'];var _0xe29811=_0xa58778?0x0:_0x34d981[_0xf843('0x1c')];var _0x2e6b02=_0xa58778?_0x4feec6[_0xf843('0x1f')]:_0x34d981[_0xf843('0x1c')]+_0x34d981[_0xf843('0x1e')];var _0x1c1fac;if(_0x2e6b02>=_0x4db009){_0x2e6b02=_0x4db009;_0x1c1fac=0xc8;}else{_0x1c1fac=0xce;}_0x25708d[_0xf843('0x19')](_0x1c1fac);return _0x25708d[_0xf843('0x20')]('Content-Range',_0xe29811+'-'+_0x2e6b02+'/'+_0x4db009)[_0xf843('0x1b')](_0x4feec6);}return null;};}function patchUpdates(_0x45f128){return function(_0x473695){try{jsonpatch[_0xf843('0x21')](_0x473695,_0x45f128,!![]);}catch(_0x16b244){return BPromise['reject'](_0x16b244);}return _0x473695[_0xf843('0x22')]();};}function saveUpdates(_0x29358d,_0x338104){return function(_0x5903d8){if(_0x5903d8){return _0x5903d8[_0xf843('0x23')](_0x29358d)['then'](function(_0x47432d){return _0x47432d;});}return null;};}function removeEntity(_0x5c94b3,_0x1789da){return function(_0x5875f5){if(_0x5875f5){return _0x5875f5['destroy']()[_0xf843('0x24')](function(){_0x5c94b3['status'](0xcc)[_0xf843('0x1a')]();});}};}function handleEntityNotFound(_0x47c979,_0x5a9667){return function(_0x4bb881){if(!_0x4bb881){_0x47c979[_0xf843('0x18')](0x194);}return _0x4bb881;};}function handleError(_0x559073,_0x6553dc){_0x6553dc=_0x6553dc||0x1f4;return function(_0x450955){logger['error'](_0x450955['stack']);if(_0x450955[_0xf843('0x25')]){delete _0x450955[_0xf843('0x25')];}_0x559073[_0xf843('0x19')](_0x6553dc)['send'](_0x450955);};}exports[_0xf843('0x26')]=function(_0x5da273,_0x4ba368){var _0x5ed274={},_0x19d3a8={},_0x5d3df0={'count':0x0,'rows':[]};var _0x2c486b=_[_0xf843('0x27')](db[_0xf843('0x28')][_0xf843('0x29')],function(_0x186871){return{'name':_0x186871[_0xf843('0x2a')],'type':_0x186871[_0xf843('0x2b')][_0xf843('0x2c')]};});_0x19d3a8[_0xf843('0x2d')]=_[_0xf843('0x27')](_0x2c486b,'name');_0x19d3a8['query']=_[_0xf843('0x2e')](_0x5da273[_0xf843('0x2f')]);_0x19d3a8['filters']=_['intersection'](_0x19d3a8[_0xf843('0x2d')],_0x19d3a8[_0xf843('0x2f')]);_0x5ed274[_0xf843('0x30')]=_['intersection'](_0x19d3a8[_0xf843('0x2d')],qs['fields'](_0x5da273[_0xf843('0x2f')][_0xf843('0x31')]));_0x5ed274[_0xf843('0x30')]=_0x5ed274[_0xf843('0x30')]['length']?_0x5ed274[_0xf843('0x30')]:_0x19d3a8[_0xf843('0x2d')];if(!_0x5da273[_0xf843('0x2f')]['hasOwnProperty'](_0xf843('0x32'))){_0x5ed274[_0xf843('0x1e')]=qs[_0xf843('0x1e')](_0x5da273[_0xf843('0x2f')][_0xf843('0x1e')]);_0x5ed274[_0xf843('0x1c')]=qs[_0xf843('0x1c')](_0x5da273['query'][_0xf843('0x1c')]);}_0x5ed274[_0xf843('0x33')]=qs[_0xf843('0x34')](_0x5da273[_0xf843('0x2f')]['sort']);_0x5ed274[_0xf843('0x35')]=qs['filters'](_['pick'](_0x5da273[_0xf843('0x2f')],_0x19d3a8[_0xf843('0x36')]),_0x2c486b);if(_0x5da273['query']['filter']){_0x5ed274['where']=_[_0xf843('0x37')](_0x5ed274['where'],{'$or':_[_0xf843('0x27')](_0x2c486b,function(_0x556075){if(_0x556075[_0xf843('0x2b')]!=='VIRTUAL'){var _0x2aafdb={};_0x2aafdb[_0x556075[_0xf843('0x25')]]={'$like':'%'+_0x5da273[_0xf843('0x2f')][_0xf843('0x38')]+'%'};return _0x2aafdb;}})});}_0x5ed274=_[_0xf843('0x37')]({},_0x5ed274,_0x5da273['options']);var _0x55bbcb={'where':_0x5ed274['where']};return db['OpenchannelQueueReport']['count'](_0x55bbcb)[_0xf843('0x24')](function(_0x54a7ed){_0x5d3df0[_0xf843('0x1f')]=_0x54a7ed;if(_0x5da273[_0xf843('0x2f')][_0xf843('0x39')]){_0x5ed274[_0xf843('0x3a')]=[{'all':!![]}];}return db[_0xf843('0x28')][_0xf843('0x3b')](_0x5ed274);})[_0xf843('0x24')](function(_0x32bb68){_0x5d3df0[_0xf843('0x3c')]=_0x32bb68;return _0x5d3df0;})[_0xf843('0x24')](respondWithFilteredResult(_0x4ba368,_0x5ed274))[_0xf843('0x3d')](handleError(_0x4ba368,null));};exports[_0xf843('0x3e')]=function(_0x5379e8,_0x2b20c7){var _0x396576={'raw':!![],'where':{'id':_0x5379e8['params']['id']}},_0x44a119={};_0x44a119[_0xf843('0x2d')]=_['keys'](db['OpenchannelQueueReport']['rawAttributes']);_0x44a119[_0xf843('0x2f')]=_['keys'](_0x5379e8[_0xf843('0x2f')]);_0x44a119['filters']=_[_0xf843('0x3f')](_0x44a119[_0xf843('0x2d')],_0x44a119[_0xf843('0x2f')]);_0x396576['attributes']=_[_0xf843('0x3f')](_0x44a119[_0xf843('0x2d')],qs[_0xf843('0x31')](_0x5379e8[_0xf843('0x2f')][_0xf843('0x31')]));_0x396576['attributes']=_0x396576[_0xf843('0x30')][_0xf843('0x40')]?_0x396576[_0xf843('0x30')]:_0x44a119[_0xf843('0x2d')];if(_0x5379e8[_0xf843('0x2f')]['includeAll']){_0x396576[_0xf843('0x3a')]=[{'all':!![]}];}_0x396576=_[_0xf843('0x37')]({},_0x396576,_0x5379e8[_0xf843('0x41')]);return db['OpenchannelQueueReport']['find'](_0x396576)[_0xf843('0x24')](handleEntityNotFound(_0x2b20c7,null))[_0xf843('0x24')](respondWithResult(_0x2b20c7,null))[_0xf843('0x3d')](handleError(_0x2b20c7,null));};exports[_0xf843('0x42')]=function(_0x1130fe,_0x15f391){return db[_0xf843('0x28')][_0xf843('0x42')](_0x1130fe[_0xf843('0x43')],{})[_0xf843('0x24')](respondWithResult(_0x15f391,0xc9))[_0xf843('0x3d')](handleError(_0x15f391,null));};exports[_0xf843('0x23')]=function(_0x5324ef,_0x38a870){if(_0x5324ef[_0xf843('0x43')]['id']){delete _0x5324ef['body']['id'];}return db[_0xf843('0x28')][_0xf843('0x44')]({'where':{'id':_0x5324ef[_0xf843('0x45')]['id']}})['then'](handleEntityNotFound(_0x38a870,null))[_0xf843('0x24')](saveUpdates(_0x5324ef[_0xf843('0x43')],null))['then'](respondWithResult(_0x38a870,null))[_0xf843('0x3d')](handleError(_0x38a870,null));};exports[_0xf843('0x46')]=function(_0x5157cc,_0x6da6fd){return db[_0xf843('0x28')]['find']({'where':{'id':_0x5157cc[_0xf843('0x45')]['id']}})[_0xf843('0x24')](handleEntityNotFound(_0x6da6fd,null))['then'](removeEntity(_0x6da6fd,null))['catch'](handleError(_0x6da6fd,null));};exports[_0xf843('0x47')]=function(_0x1e258e,_0x27d47a){return db['OpenchannelQueueReport'][_0xf843('0x47')]()[_0xf843('0x24')](respondWithResult(_0x27d47a,null))[_0xf843('0x3d')](handleError(_0x27d47a,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 4bca3b4..1c23e0c 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0xbeb252,_0x5aa81f){var _0x198639=function(_0x35278f){while(--_0x35278f){_0xbeb252['push'](_0xbeb252['shift']());}};_0x198639(++_0x5aa81f);}(_0x1261,0x144));var _0x1126=function(_0x28f632,_0x19c6b5){_0x28f632=_0x28f632-0x0;var _0x1bbfa2=_0x1261[_0x28f632];return _0x1bbfa2;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x56a871,_0x18b7fe){var _0x124954=function(_0x39b7a1){while(--_0x39b7a1){_0x56a871['push'](_0x56a871['shift']());}};_0x124954(++_0x18b7fe);}(_0x814b,0x1a2));var _0xb814=function(_0x479650,_0x2bee99){_0x479650=_0x479650-0x0;var _0x26b288=_0x814b[_0x479650];return _0x26b288;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index ddbcbad..ec5979f 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 _0x9c00=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','where','attributes','limit','lodash','util','randomstring','ioredis'];(function(_0x3b0e0c,_0x5e4814){var _0x3efb86=function(_0x82a918){while(--_0x82a918){_0x3b0e0c['push'](_0x3b0e0c['shift']());}};_0x3efb86(++_0x5e4814);}(_0x9c00,0x1a0));var _0x09c0=function(_0x529f1c,_0x437ed1){_0x529f1c=_0x529f1c-0x0;var _0x4d57ab=_0x9c00[_0x529f1c];return _0x4d57ab;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x09c0('0x2'));var fs=require('fs');var Redis=require(_0x09c0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x09c0('0x4'));var logger=require(_0x09c0('0x5'))(_0x09c0('0x6'));var config=require(_0x09c0('0x7'));var jayson=require(_0x09c0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f3d7e,_0x17d11f,_0x1b633b){return new BPromise(function(_0x3187aa,_0x17cd9d){return client['request'](_0x1f3d7e,_0x1b633b)[_0x09c0('0x9')](function(_0x1c1246){logger[_0x09c0('0xa')](_0x09c0('0xb'),_0x17d11f,_0x09c0('0xc'));logger[_0x09c0('0xd')](_0x09c0('0xe'),_0x17d11f,_0x09c0('0xc'),JSON[_0x09c0('0xf')](_0x1c1246));if(_0x1c1246[_0x09c0('0x10')]){if(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x11')]===0x1f4){logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);return _0x17cd9d(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);}logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);return _0x3187aa(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);}else{logger[_0x09c0('0xa')](_0x09c0('0xb'),_0x17d11f,'request\x20sent');_0x3187aa(_0x1c1246['result']['message']);}})[_0x09c0('0x13')](function(_0x11f4b2){logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x11f4b2);_0x17cd9d(_0x11f4b2);});});}exports['CreateOpenchannelQueueReport']=function(_0x2c4440){var _0x4aa8a5=this;return new Promise(function(_0x4c29a7,_0x2c12da){return db['OpenchannelQueueReport'][_0x09c0('0x14')](_0x2c4440[_0x09c0('0x15')],{'raw':_0x2c4440[_0x09c0('0x16')]?_0x2c4440['options'][_0x09c0('0x17')]===undefined?!![]:![]:!![]})[_0x09c0('0x9')](function(_0x8ad645){logger[_0x09c0('0xa')](_0x09c0('0x18'),_0x2c4440);logger[_0x09c0('0xd')](_0x09c0('0x18'),_0x2c4440,JSON['stringify'](_0x8ad645));_0x4c29a7(_0x8ad645);})[_0x09c0('0x13')](function(_0x46f171){logger[_0x09c0('0x10')](_0x09c0('0x18'),_0x46f171['message'],_0x2c4440);_0x2c12da(_0x4aa8a5['error'](0x1f4,_0x46f171[_0x09c0('0x12')]));});});};exports[_0x09c0('0x19')]=function(_0x1e8a1c){var _0x3a5370=this;return new Promise(function(_0x491e6f,_0x42ebfc){return db[_0x09c0('0x1a')]['update'](_0x1e8a1c[_0x09c0('0x15')],{'raw':_0x1e8a1c[_0x09c0('0x16')]?_0x1e8a1c[_0x09c0('0x16')][_0x09c0('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e8a1c[_0x09c0('0x16')]?_0x1e8a1c[_0x09c0('0x16')][_0x09c0('0x1b')]||null:null,'attributes':_0x1e8a1c[_0x09c0('0x16')]?_0x1e8a1c[_0x09c0('0x16')][_0x09c0('0x1c')]||null:null,'limit':_0x1e8a1c[_0x09c0('0x16')]?_0x1e8a1c['options'][_0x09c0('0x1d')]||null:null})[_0x09c0('0x9')](function(_0x53a7b8){logger[_0x09c0('0xa')]('UpdateOpenchannelQueueReport',_0x1e8a1c);logger[_0x09c0('0xd')]('UpdateOpenchannelQueueReport',_0x1e8a1c,JSON[_0x09c0('0xf')](_0x53a7b8));_0x491e6f(_0x53a7b8);})[_0x09c0('0x13')](function(_0x108409){logger[_0x09c0('0x10')]('UpdateOpenchannelQueueReport',_0x108409['message'],_0x1e8a1c);_0x42ebfc(_0x3a5370[_0x09c0('0x10')](0x1f4,_0x108409[_0x09c0('0x12')]));});});}; \ No newline at end of file +var _0x9d5b=['message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','UpdateOpenchannelQueueReport','where','limit','info','debug','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1ae19e,_0x422a72){var _0xf9a1=function(_0x10fcc3){while(--_0x10fcc3){_0x1ae19e['push'](_0x1ae19e['shift']());}};_0xf9a1(++_0x422a72);}(_0x9d5b,0x14d));var _0xb9d5=function(_0xc68dc4,_0x4cf17a){_0xc68dc4=_0xc68dc4-0x0;var _0x1547d7=_0x9d5b[_0xc68dc4];return _0x1547d7;};'use strict';var _=require('lodash');var util=require(_0xb9d5('0x0'));var moment=require(_0xb9d5('0x1'));var BPromise=require(_0xb9d5('0x2'));var rs=require(_0xb9d5('0x3'));var fs=require('fs');var Redis=require(_0xb9d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9d5('0x5'));var logger=require('../../config/logger')(_0xb9d5('0x6'));var config=require(_0xb9d5('0x7'));var jayson=require(_0xb9d5('0x8'));var client=jayson[_0xb9d5('0x9')][_0xb9d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5144c7,_0x1ddb78,_0x35cf2){return new BPromise(function(_0x4dc4be,_0x2d3f66){return client[_0xb9d5('0xb')](_0x5144c7,_0x35cf2)[_0xb9d5('0xc')](function(_0x94e766){logger['info'](_0xb9d5('0xd'),_0x1ddb78,_0xb9d5('0xe'));logger['debug'](_0xb9d5('0xf'),_0x1ddb78,_0xb9d5('0xe'),JSON[_0xb9d5('0x10')](_0x94e766));if(_0x94e766[_0xb9d5('0x11')]){if(_0x94e766[_0xb9d5('0x11')][_0xb9d5('0x12')]===0x1f4){logger[_0xb9d5('0x11')](_0xb9d5('0xd'),_0x1ddb78,_0x94e766[_0xb9d5('0x11')][_0xb9d5('0x13')]);return _0x2d3f66(_0x94e766[_0xb9d5('0x11')]['message']);}logger[_0xb9d5('0x11')](_0xb9d5('0xd'),_0x1ddb78,_0x94e766['error'][_0xb9d5('0x13')]);return _0x4dc4be(_0x94e766[_0xb9d5('0x11')][_0xb9d5('0x13')]);}else{logger['info'](_0xb9d5('0xd'),_0x1ddb78,_0xb9d5('0xe'));_0x4dc4be(_0x94e766[_0xb9d5('0x14')][_0xb9d5('0x13')]);}})[_0xb9d5('0x15')](function(_0x321a77){logger[_0xb9d5('0x11')](_0xb9d5('0xd'),_0x1ddb78,_0x321a77);_0x2d3f66(_0x321a77);});});}exports[_0xb9d5('0x16')]=function(_0x436002){var _0x248cb3=this;return new Promise(function(_0xf2c261,_0x2f8df6){return db[_0xb9d5('0x17')]['create'](_0x436002[_0xb9d5('0x18')],{'raw':_0x436002[_0xb9d5('0x19')]?_0x436002[_0xb9d5('0x19')][_0xb9d5('0x1a')]===undefined?!![]:![]:!![]})[_0xb9d5('0xc')](function(_0x457d69){logger['info'](_0xb9d5('0x16'),_0x436002);logger['debug'](_0xb9d5('0x16'),_0x436002,JSON[_0xb9d5('0x10')](_0x457d69));_0xf2c261(_0x457d69);})[_0xb9d5('0x15')](function(_0x13fc35){logger[_0xb9d5('0x11')](_0xb9d5('0x16'),_0x13fc35[_0xb9d5('0x13')],_0x436002);_0x2f8df6(_0x248cb3[_0xb9d5('0x11')](0x1f4,_0x13fc35['message']));});});};exports[_0xb9d5('0x1b')]=function(_0x30b06f){var _0x5508c6=this;return new Promise(function(_0x1c0b89,_0x25ebf2){return db[_0xb9d5('0x17')]['update'](_0x30b06f[_0xb9d5('0x18')],{'raw':_0x30b06f[_0xb9d5('0x19')]?_0x30b06f[_0xb9d5('0x19')][_0xb9d5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30b06f[_0xb9d5('0x19')]?_0x30b06f[_0xb9d5('0x19')][_0xb9d5('0x1c')]||null:null,'attributes':_0x30b06f[_0xb9d5('0x19')]?_0x30b06f[_0xb9d5('0x19')]['attributes']||null:null,'limit':_0x30b06f[_0xb9d5('0x19')]?_0x30b06f['options'][_0xb9d5('0x1d')]||null:null})[_0xb9d5('0xc')](function(_0x1de8e6){logger[_0xb9d5('0x1e')](_0xb9d5('0x1b'),_0x30b06f);logger[_0xb9d5('0x1f')](_0xb9d5('0x1b'),_0x30b06f,JSON[_0xb9d5('0x10')](_0x1de8e6));_0x1c0b89(_0x1de8e6);})[_0xb9d5('0x15')](function(_0x385701){logger[_0xb9d5('0x11')](_0xb9d5('0x1b'),_0x385701[_0xb9d5('0x13')],_0x30b06f);_0x25ebf2(_0x5508c6[_0xb9d5('0x11')](0x1f4,_0x385701[_0xb9d5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 9cb31e3..4406830 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 _0x1588=['show','post','create','put','update','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe'];(function(_0x3a7107,_0x608872){var _0x3e4aed=function(_0x71760d){while(--_0x71760d){_0x3a7107['push'](_0x3a7107['shift']());}};_0x3e4aed(++_0x608872);}(_0x1588,0x14a));var _0x8158=function(_0x5a7cdd,_0x3aecd0){_0x5a7cdd=_0x5a7cdd-0x0;var _0x1bda0a=_0x1588[_0x5a7cdd];return _0x1bda0a;};'use strict';var multer=require(_0x8158('0x0'));var util=require(_0x8158('0x1'));var path=require(_0x8158('0x2'));var timeout=require('connect-timeout');var express=require(_0x8158('0x3'));var router=express[_0x8158('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8158('0x5'));var interaction=require(_0x8158('0x6'));var config=require(_0x8158('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0x8158('0x8')]('/',auth[_0x8158('0x9')](),controller[_0x8158('0xa')]);router[_0x8158('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x8158('0xb')]);router[_0x8158('0x8')]('/:id',auth[_0x8158('0x9')](),controller[_0x8158('0xc')]);router[_0x8158('0xd')]('/',auth[_0x8158('0x9')](),controller[_0x8158('0xe')]);router[_0x8158('0xf')]('/:id',auth[_0x8158('0x9')](),controller[_0x8158('0x10')]);router['delete']('/:id',auth[_0x8158('0x9')](),controller[_0x8158('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8011=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','post','create','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x2452b1,_0x2f51d8){var _0x3c7685=function(_0x15c9fd){while(--_0x15c9fd){_0x2452b1['push'](_0x2452b1['shift']());}};_0x3c7685(++_0x2f51d8);}(_0x8011,0x1d8));var _0x1801=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8011[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x1801('0x0'));var util=require(_0x1801('0x1'));var path=require(_0x1801('0x2'));var timeout=require(_0x1801('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1801('0x4'));var auth=require(_0x1801('0x5'));var interaction=require(_0x1801('0x6'));var config=require('../../config/environment');var controller=require(_0x1801('0x7'));router[_0x1801('0x8')]('/',auth[_0x1801('0x9')](),controller[_0x1801('0xa')]);router[_0x1801('0x8')](_0x1801('0xb'),auth[_0x1801('0x9')](),controller['describe']);router[_0x1801('0x8')]('/:id',auth[_0x1801('0x9')](),controller['show']);router[_0x1801('0xc')]('/',auth[_0x1801('0x9')](),controller[_0x1801('0xd')]);router['put'](_0x1801('0xe'),auth['isAuthenticated'](),controller[_0x1801('0xf')]);router[_0x1801('0x10')](_0x1801('0xe'),auth[_0x1801('0x9')](),controller[_0x1801('0x11')]);module[_0x1801('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 6271e5d..e3a41aa 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x3b49b5,_0xa79943){var _0x26b11e=function(_0x115633){while(--_0x115633){_0x3b49b5['push'](_0x3b49b5['shift']());}};_0x26b11e(++_0xa79943);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3b2e0a,_0x49a3f9){_0x3b2e0a=_0x3b2e0a-0x0;var _0x4a84bd=_0xf3cd[_0x3b2e0a];return _0x4a84bd;};'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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x2d5678,_0xdfb48f){var _0x4ad11a=function(_0x474ad3){while(--_0x474ad3){_0x2d5678['push'](_0x2d5678['shift']());}};_0x4ad11a(++_0xdfb48f);}(_0x008c,0x188));var _0xc008=function(_0x3f7146,_0x824eba){_0x3f7146=_0x3f7146-0x0;var _0x316350=_0x008c[_0x3f7146];return _0x316350;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index c4f4507..4155f59 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 _0xa11d=['path','sox','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/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','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','describe','fast-json-patch','request-promise','moment','mustache'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa11d,0x173));var _0xda11=function(_0x31567c,_0x2f91d1){_0x31567c=_0x31567c-0x0;var _0x24d0bc=_0xa11d[_0x31567c];return _0x24d0bc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xda11('0x0'));var rp=require(_0xda11('0x1'));var moment=require(_0xda11('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xda11('0x3'));var util=require('util');var path=require(_0xda11('0x4'));var sox=require(_0xda11('0x5'));var csv=require('to-csv');var ejs=require(_0xda11('0x6'));var fs=require('fs');var fs_extra=require(_0xda11('0x7'));var _=require(_0xda11('0x8'));var squel=require(_0xda11('0x9'));var crypto=require(_0xda11('0xa'));var jsforce=require(_0xda11('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xda11('0xc'));var Papa=require('papaparse');var Redis=require(_0xda11('0xd'));var authService=require(_0xda11('0xe'));var qs=require(_0xda11('0xf'));var as=require(_0xda11('0x10'));var hardwareService=require(_0xda11('0x11'));var logger=require(_0xda11('0x12'))(_0xda11('0x13'));var utils=require('../../config/utils');var config=require(_0xda11('0x14'));var licenseUtil=require(_0xda11('0x15'));var db=require(_0xda11('0x16'))['db'];function respondWithStatusCode(_0x129961,_0x3de780){_0x3de780=_0x3de780||0xcc;return function(_0x218c84){if(_0x218c84){return _0x129961[_0xda11('0x17')](_0x3de780);}return _0x129961[_0xda11('0x18')](_0x3de780)[_0xda11('0x19')]();};}function respondWithResult(_0x3c5208,_0x15afb0){_0x15afb0=_0x15afb0||0xc8;return function(_0x3759bc){if(_0x3759bc){return _0x3c5208[_0xda11('0x18')](_0x15afb0)[_0xda11('0x1a')](_0x3759bc);}};}function respondWithFilteredResult(_0x32d522,_0x46af44){return function(_0x3d02c9){if(_0x3d02c9){var _0x458925=typeof _0x46af44[_0xda11('0x1b')]===_0xda11('0x1c')&&typeof _0x46af44[_0xda11('0x1d')]===_0xda11('0x1c');var _0x27fb28=_0x3d02c9[_0xda11('0x1e')];var _0x14c85c=_0x458925?0x0:_0x46af44['offset'];var _0x4f0685=_0x458925?_0x3d02c9['count']:_0x46af44[_0xda11('0x1b')]+_0x46af44['limit'];var _0x40f9ec;if(_0x4f0685>=_0x27fb28){_0x4f0685=_0x27fb28;_0x40f9ec=0xc8;}else{_0x40f9ec=0xce;}_0x32d522['status'](_0x40f9ec);return _0x32d522[_0xda11('0x1f')](_0xda11('0x20'),_0x14c85c+'-'+_0x4f0685+'/'+_0x27fb28)[_0xda11('0x1a')](_0x3d02c9);}return null;};}function patchUpdates(_0x351d3d){return function(_0x27d660){try{jsonpatch[_0xda11('0x21')](_0x27d660,_0x351d3d,!![]);}catch(_0x1f13e1){return BPromise[_0xda11('0x22')](_0x1f13e1);}return _0x27d660[_0xda11('0x23')]();};}function saveUpdates(_0x1f5d4b,_0x4a9e2c){return function(_0x4b1146){if(_0x4b1146){return _0x4b1146[_0xda11('0x24')](_0x1f5d4b)['then'](function(_0x57075d){return _0x57075d;});}return null;};}function removeEntity(_0x4de508,_0xf8f687){return function(_0x3fa27b){if(_0x3fa27b){return _0x3fa27b[_0xda11('0x25')]()[_0xda11('0x26')](function(){_0x4de508[_0xda11('0x18')](0xcc)[_0xda11('0x19')]();});}};}function handleEntityNotFound(_0x526469,_0x4259e2){return function(_0x4e2363){if(!_0x4e2363){_0x526469['sendStatus'](0x194);}return _0x4e2363;};}function handleError(_0x49d54e,_0x33a96a){_0x33a96a=_0x33a96a||0x1f4;return function(_0x309e2){logger[_0xda11('0x27')](_0x309e2[_0xda11('0x28')]);if(_0x309e2[_0xda11('0x29')]){delete _0x309e2[_0xda11('0x29')];}_0x49d54e[_0xda11('0x18')](_0x33a96a)['send'](_0x309e2);};}exports[_0xda11('0x2a')]=function(_0x42b4ba,_0x31c3cc){var _0x310c4c={},_0x477b46={},_0x252a04={'count':0x0,'rows':[]};var _0x5770d6=_[_0xda11('0x2b')](db[_0xda11('0x2c')][_0xda11('0x2d')],function(_0x59d487){return{'name':_0x59d487[_0xda11('0x2e')],'type':_0x59d487[_0xda11('0x2f')]['key']};});_0x477b46[_0xda11('0x30')]=_[_0xda11('0x2b')](_0x5770d6,_0xda11('0x29'));_0x477b46[_0xda11('0x31')]=_[_0xda11('0x32')](_0x42b4ba['query']);_0x477b46[_0xda11('0x33')]=_[_0xda11('0x34')](_0x477b46[_0xda11('0x30')],_0x477b46[_0xda11('0x31')]);_0x310c4c['attributes']=_[_0xda11('0x34')](_0x477b46['model'],qs[_0xda11('0x35')](_0x42b4ba['query']['fields']));_0x310c4c[_0xda11('0x36')]=_0x310c4c['attributes']['length']?_0x310c4c[_0xda11('0x36')]:_0x477b46[_0xda11('0x30')];if(!_0x42b4ba['query'][_0xda11('0x37')](_0xda11('0x38'))){_0x310c4c[_0xda11('0x1d')]=qs[_0xda11('0x1d')](_0x42b4ba['query'][_0xda11('0x1d')]);_0x310c4c[_0xda11('0x1b')]=qs['offset'](_0x42b4ba[_0xda11('0x31')]['offset']);}_0x310c4c[_0xda11('0x39')]=qs[_0xda11('0x3a')](_0x42b4ba[_0xda11('0x31')]['sort']);_0x310c4c[_0xda11('0x3b')]=qs[_0xda11('0x33')](_['pick'](_0x42b4ba[_0xda11('0x31')],_0x477b46[_0xda11('0x33')]),_0x5770d6);if(_0x42b4ba['query'][_0xda11('0x3c')]){_0x310c4c[_0xda11('0x3b')]=_['merge'](_0x310c4c[_0xda11('0x3b')],{'$or':_[_0xda11('0x2b')](_0x5770d6,function(_0x3fe40a){if(_0x3fe40a[_0xda11('0x2f')]!=='VIRTUAL'){var _0x13cb13={};_0x13cb13[_0x3fe40a[_0xda11('0x29')]]={'$like':'%'+_0x42b4ba[_0xda11('0x31')][_0xda11('0x3c')]+'%'};return _0x13cb13;}})});}_0x310c4c=_[_0xda11('0x3d')]({},_0x310c4c,_0x42b4ba[_0xda11('0x3e')]);var _0x392910={'where':_0x310c4c[_0xda11('0x3b')]};return db[_0xda11('0x2c')][_0xda11('0x1e')](_0x392910)[_0xda11('0x26')](function(_0x371eb5){_0x252a04[_0xda11('0x1e')]=_0x371eb5;if(_0x42b4ba[_0xda11('0x31')][_0xda11('0x3f')]){_0x310c4c[_0xda11('0x40')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xda11('0x41')](_0x310c4c);})[_0xda11('0x26')](function(_0x1443af){_0x252a04[_0xda11('0x42')]=_0x1443af;return _0x252a04;})[_0xda11('0x26')](respondWithFilteredResult(_0x31c3cc,_0x310c4c))['catch'](handleError(_0x31c3cc,null));};exports[_0xda11('0x43')]=function(_0x58c691,_0x1ecc02){var _0x56e28b={'raw':!![],'where':{'id':_0x58c691[_0xda11('0x44')]['id']}},_0x246d5a={};_0x246d5a['model']=_[_0xda11('0x32')](db[_0xda11('0x2c')][_0xda11('0x2d')]);_0x246d5a[_0xda11('0x31')]=_[_0xda11('0x32')](_0x58c691[_0xda11('0x31')]);_0x246d5a[_0xda11('0x33')]=_['intersection'](_0x246d5a['model'],_0x246d5a[_0xda11('0x31')]);_0x56e28b[_0xda11('0x36')]=_[_0xda11('0x34')](_0x246d5a['model'],qs[_0xda11('0x35')](_0x58c691[_0xda11('0x31')][_0xda11('0x35')]));_0x56e28b[_0xda11('0x36')]=_0x56e28b[_0xda11('0x36')][_0xda11('0x45')]?_0x56e28b[_0xda11('0x36')]:_0x246d5a[_0xda11('0x30')];if(_0x58c691[_0xda11('0x31')][_0xda11('0x3f')]){_0x56e28b[_0xda11('0x40')]=[{'all':!![]}];}_0x56e28b=_[_0xda11('0x3d')]({},_0x56e28b,_0x58c691[_0xda11('0x3e')]);return db[_0xda11('0x2c')][_0xda11('0x46')](_0x56e28b)[_0xda11('0x26')](handleEntityNotFound(_0x1ecc02,null))['then'](respondWithResult(_0x1ecc02,null))[_0xda11('0x47')](handleError(_0x1ecc02,null));};exports['create']=function(_0x2ffc90,_0x1c306e){return db[_0xda11('0x2c')][_0xda11('0x48')](_0x2ffc90[_0xda11('0x49')],{})[_0xda11('0x26')](respondWithResult(_0x1c306e,0xc9))[_0xda11('0x47')](handleError(_0x1c306e,null));};exports['update']=function(_0x3691d2,_0x30ee37){if(_0x3691d2[_0xda11('0x49')]['id']){delete _0x3691d2[_0xda11('0x49')]['id'];}return db[_0xda11('0x2c')][_0xda11('0x46')]({'where':{'id':_0x3691d2[_0xda11('0x44')]['id']}})['then'](handleEntityNotFound(_0x30ee37,null))['then'](saveUpdates(_0x3691d2[_0xda11('0x49')],null))[_0xda11('0x26')](respondWithResult(_0x30ee37,null))[_0xda11('0x47')](handleError(_0x30ee37,null));};exports['destroy']=function(_0x25535e,_0x3c7fdd){return db['OpenchannelTransferReport'][_0xda11('0x46')]({'where':{'id':_0x25535e[_0xda11('0x44')]['id']}})[_0xda11('0x26')](handleEntityNotFound(_0x3c7fdd,null))['then'](removeEntity(_0x3c7fdd,null))['catch'](handleError(_0x3c7fdd,null));};exports[_0xda11('0x4a')]=function(_0x3ba663,_0x27054e){return db[_0xda11('0x2c')][_0xda11('0x4a')]()[_0xda11('0x26')](respondWithResult(_0x27054e,null))[_0xda11('0x47')](handleError(_0x27054e,null));}; \ No newline at end of file +var _0x47a5=['reject','save','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply'];(function(_0x346f0a,_0x29ddb4){var _0x27edeb=function(_0x1ef635){while(--_0x1ef635){_0x346f0a['push'](_0x346f0a['shift']());}};_0x27edeb(++_0x29ddb4);}(_0x47a5,0x1a6));var _0x547a=function(_0x328976,_0x1e2de9){_0x328976=_0x328976-0x0;var _0x59633f=_0x47a5[_0x328976];return _0x59633f;};'use strict';var emlformat=require(_0x547a('0x0'));var rimraf=require(_0x547a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x547a('0x2'));var rp=require(_0x547a('0x3'));var moment=require(_0x547a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x547a('0x5'));var util=require(_0x547a('0x6'));var path=require(_0x547a('0x7'));var sox=require('sox');var csv=require(_0x547a('0x8'));var ejs=require(_0x547a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x547a('0xa'));var squel=require(_0x547a('0xb'));var crypto=require('crypto');var jsforce=require(_0x547a('0xc'));var deskjs=require(_0x547a('0xd'));var toCsv=require(_0x547a('0x8'));var querystring=require(_0x547a('0xe'));var Papa=require(_0x547a('0xf'));var Redis=require(_0x547a('0x10'));var authService=require(_0x547a('0x11'));var qs=require(_0x547a('0x12'));var as=require(_0x547a('0x13'));var hardwareService=require(_0x547a('0x14'));var logger=require('../../config/logger')(_0x547a('0x15'));var utils=require('../../config/utils');var config=require(_0x547a('0x16'));var licenseUtil=require(_0x547a('0x17'));var db=require(_0x547a('0x18'))['db'];function respondWithStatusCode(_0xbc9133,_0x594f9b){_0x594f9b=_0x594f9b||0xcc;return function(_0x30c8e1){if(_0x30c8e1){return _0xbc9133[_0x547a('0x19')](_0x594f9b);}return _0xbc9133['status'](_0x594f9b)['end']();};}function respondWithResult(_0x537a4b,_0x2a9ba5){_0x2a9ba5=_0x2a9ba5||0xc8;return function(_0x3cb0db){if(_0x3cb0db){return _0x537a4b[_0x547a('0x1a')](_0x2a9ba5)[_0x547a('0x1b')](_0x3cb0db);}};}function respondWithFilteredResult(_0x618da3,_0x1c994c){return function(_0x5a53c7){if(_0x5a53c7){var _0xd61aa1=typeof _0x1c994c[_0x547a('0x1c')]===_0x547a('0x1d')&&typeof _0x1c994c[_0x547a('0x1e')]==='undefined';var _0x130934=_0x5a53c7['count'];var _0x514abe=_0xd61aa1?0x0:_0x1c994c['offset'];var _0x280b07=_0xd61aa1?_0x5a53c7[_0x547a('0x1f')]:_0x1c994c[_0x547a('0x1c')]+_0x1c994c[_0x547a('0x1e')];var _0x4ede2e;if(_0x280b07>=_0x130934){_0x280b07=_0x130934;_0x4ede2e=0xc8;}else{_0x4ede2e=0xce;}_0x618da3['status'](_0x4ede2e);return _0x618da3[_0x547a('0x20')]('Content-Range',_0x514abe+'-'+_0x280b07+'/'+_0x130934)[_0x547a('0x1b')](_0x5a53c7);}return null;};}function patchUpdates(_0x54160e){return function(_0x19c265){try{jsonpatch[_0x547a('0x21')](_0x19c265,_0x54160e,!![]);}catch(_0x173ea7){return BPromise[_0x547a('0x22')](_0x173ea7);}return _0x19c265[_0x547a('0x23')]();};}function saveUpdates(_0xe2b3fb,_0x1e78f7){return function(_0x19870d){if(_0x19870d){return _0x19870d[_0x547a('0x24')](_0xe2b3fb)[_0x547a('0x25')](function(_0x3faeb7){return _0x3faeb7;});}return null;};}function removeEntity(_0x54f509,_0x3d0ef0){return function(_0x2dc268){if(_0x2dc268){return _0x2dc268[_0x547a('0x26')]()[_0x547a('0x25')](function(){_0x54f509[_0x547a('0x1a')](0xcc)[_0x547a('0x27')]();});}};}function handleEntityNotFound(_0x2592a4,_0x4763d7){return function(_0x47be21){if(!_0x47be21){_0x2592a4['sendStatus'](0x194);}return _0x47be21;};}function handleError(_0x136e77,_0x278c9f){_0x278c9f=_0x278c9f||0x1f4;return function(_0x3c3911){logger[_0x547a('0x28')](_0x3c3911[_0x547a('0x29')]);if(_0x3c3911[_0x547a('0x2a')]){delete _0x3c3911[_0x547a('0x2a')];}_0x136e77[_0x547a('0x1a')](_0x278c9f)[_0x547a('0x2b')](_0x3c3911);};}exports[_0x547a('0x2c')]=function(_0x47d399,_0x15f349){var _0x31588b={},_0x5991ac={},_0x3cea76={'count':0x0,'rows':[]};var _0xa127ae=_[_0x547a('0x2d')](db[_0x547a('0x2e')][_0x547a('0x2f')],function(_0x1b3b22){return{'name':_0x1b3b22[_0x547a('0x30')],'type':_0x1b3b22[_0x547a('0x31')][_0x547a('0x32')]};});_0x5991ac[_0x547a('0x33')]=_['map'](_0xa127ae,_0x547a('0x2a'));_0x5991ac['query']=_[_0x547a('0x34')](_0x47d399['query']);_0x5991ac[_0x547a('0x35')]=_[_0x547a('0x36')](_0x5991ac[_0x547a('0x33')],_0x5991ac[_0x547a('0x37')]);_0x31588b[_0x547a('0x38')]=_['intersection'](_0x5991ac['model'],qs[_0x547a('0x39')](_0x47d399[_0x547a('0x37')][_0x547a('0x39')]));_0x31588b['attributes']=_0x31588b[_0x547a('0x38')][_0x547a('0x3a')]?_0x31588b[_0x547a('0x38')]:_0x5991ac['model'];if(!_0x47d399[_0x547a('0x37')][_0x547a('0x3b')]('nolimit')){_0x31588b[_0x547a('0x1e')]=qs[_0x547a('0x1e')](_0x47d399[_0x547a('0x37')]['limit']);_0x31588b['offset']=qs[_0x547a('0x1c')](_0x47d399['query'][_0x547a('0x1c')]);}_0x31588b[_0x547a('0x3c')]=qs[_0x547a('0x3d')](_0x47d399['query']['sort']);_0x31588b[_0x547a('0x3e')]=qs[_0x547a('0x35')](_[_0x547a('0x3f')](_0x47d399[_0x547a('0x37')],_0x5991ac[_0x547a('0x35')]),_0xa127ae);if(_0x47d399[_0x547a('0x37')][_0x547a('0x40')]){_0x31588b[_0x547a('0x3e')]=_[_0x547a('0x41')](_0x31588b['where'],{'$or':_[_0x547a('0x2d')](_0xa127ae,function(_0x3b6723){if(_0x3b6723[_0x547a('0x31')]!==_0x547a('0x42')){var _0x3d08ab={};_0x3d08ab[_0x3b6723[_0x547a('0x2a')]]={'$like':'%'+_0x47d399[_0x547a('0x37')]['filter']+'%'};return _0x3d08ab;}})});}_0x31588b=_[_0x547a('0x41')]({},_0x31588b,_0x47d399[_0x547a('0x43')]);var _0x3ef88e={'where':_0x31588b[_0x547a('0x3e')]};return db['OpenchannelTransferReport']['count'](_0x3ef88e)[_0x547a('0x25')](function(_0x2aa29d){_0x3cea76[_0x547a('0x1f')]=_0x2aa29d;if(_0x47d399[_0x547a('0x37')]['includeAll']){_0x31588b[_0x547a('0x44')]=[{'all':!![]}];}return db[_0x547a('0x2e')]['findAll'](_0x31588b);})[_0x547a('0x25')](function(_0x43b4cf){_0x3cea76[_0x547a('0x45')]=_0x43b4cf;return _0x3cea76;})[_0x547a('0x25')](respondWithFilteredResult(_0x15f349,_0x31588b))[_0x547a('0x46')](handleError(_0x15f349,null));};exports[_0x547a('0x47')]=function(_0x522719,_0x1dd72e){var _0xede178={'raw':!![],'where':{'id':_0x522719[_0x547a('0x48')]['id']}},_0x16020a={};_0x16020a['model']=_[_0x547a('0x34')](db[_0x547a('0x2e')][_0x547a('0x2f')]);_0x16020a[_0x547a('0x37')]=_[_0x547a('0x34')](_0x522719['query']);_0x16020a[_0x547a('0x35')]=_['intersection'](_0x16020a[_0x547a('0x33')],_0x16020a[_0x547a('0x37')]);_0xede178[_0x547a('0x38')]=_[_0x547a('0x36')](_0x16020a[_0x547a('0x33')],qs[_0x547a('0x39')](_0x522719[_0x547a('0x37')][_0x547a('0x39')]));_0xede178['attributes']=_0xede178[_0x547a('0x38')][_0x547a('0x3a')]?_0xede178[_0x547a('0x38')]:_0x16020a[_0x547a('0x33')];if(_0x522719[_0x547a('0x37')]['includeAll']){_0xede178[_0x547a('0x44')]=[{'all':!![]}];}_0xede178=_['merge']({},_0xede178,_0x522719['options']);return db[_0x547a('0x2e')][_0x547a('0x49')](_0xede178)[_0x547a('0x25')](handleEntityNotFound(_0x1dd72e,null))['then'](respondWithResult(_0x1dd72e,null))[_0x547a('0x46')](handleError(_0x1dd72e,null));};exports['create']=function(_0x301668,_0x47359f){return db[_0x547a('0x2e')]['create'](_0x301668['body'],{})[_0x547a('0x25')](respondWithResult(_0x47359f,0xc9))['catch'](handleError(_0x47359f,null));};exports[_0x547a('0x24')]=function(_0x573d70,_0x7c9ebb){if(_0x573d70[_0x547a('0x4a')]['id']){delete _0x573d70[_0x547a('0x4a')]['id'];}return db['OpenchannelTransferReport'][_0x547a('0x49')]({'where':{'id':_0x573d70[_0x547a('0x48')]['id']}})[_0x547a('0x25')](handleEntityNotFound(_0x7c9ebb,null))[_0x547a('0x25')](saveUpdates(_0x573d70[_0x547a('0x4a')],null))['then'](respondWithResult(_0x7c9ebb,null))[_0x547a('0x46')](handleError(_0x7c9ebb,null));};exports[_0x547a('0x26')]=function(_0x1fe88e,_0x4f8ade){return db['OpenchannelTransferReport'][_0x547a('0x49')]({'where':{'id':_0x1fe88e[_0x547a('0x48')]['id']}})[_0x547a('0x25')](handleEntityNotFound(_0x4f8ade,null))['then'](removeEntity(_0x4f8ade,null))[_0x547a('0x46')](handleError(_0x4f8ade,null));};exports[_0x547a('0x4b')]=function(_0x1fd855,_0x3ba668){return db['OpenchannelTransferReport'][_0x547a('0x4b')]()[_0x547a('0x25')](respondWithResult(_0x3ba668,null))[_0x547a('0x46')](handleError(_0x3ba668,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 4053bc2..8ec51f3 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 _0xbd71=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','lodash','api','bluebird'];(function(_0x5e489e,_0x1f4b49){var _0x1832fb=function(_0x1246d7){while(--_0x1246d7){_0x5e489e['push'](_0x5e489e['shift']());}};_0x1832fb(++_0x1f4b49);}(_0xbd71,0x1b5));var _0x1bd7=function(_0x5cfb19,_0x16671d){_0x5cfb19=_0x5cfb19-0x0;var _0xd31451=_0xbd71[_0x5cfb19];return _0xd31451;};'use strict';var _=require(_0x1bd7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1bd7('0x1'));var moment=require('moment');var BPromise=require(_0x1bd7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1bd7('0x3'));var rimraf=require(_0x1bd7('0x4'));var config=require(_0x1bd7('0x5'));var attributes=require(_0x1bd7('0x6'));module[_0x1bd7('0x7')]=function(_0x34e529,_0x47eb84){return _0x34e529[_0x1bd7('0x8')]('OpenchannelTransferReport',attributes,{'tableName':_0x1bd7('0x9'),'paranoid':![],'indexes':[{'name':_0x1bd7('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x58bd=['api','moment','bluebird','rimraf','../../config/environment','./openchannelTransferReport.attributes','uniqueid','lodash'];(function(_0x5201c2,_0x37c972){var _0x391649=function(_0x4bd9ef){while(--_0x4bd9ef){_0x5201c2['push'](_0x5201c2['shift']());}};_0x391649(++_0x37c972);}(_0x58bd,0x6f));var _0xd58b=function(_0x59dfe5,_0x713f1b){_0x59dfe5=_0x59dfe5-0x0;var _0x288edc=_0x58bd[_0x59dfe5];return _0x288edc;};'use strict';var _=require(_0xd58b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd58b('0x1'));var moment=require(_0xd58b('0x2'));var BPromise=require(_0xd58b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd58b('0x4'));var config=require(_0xd58b('0x5'));var attributes=require(_0xd58b('0x6'));module['exports']=function(_0x399a74,_0x1f2c77){return _0x399a74['define']('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xd58b('0x7'),'fields':[_0xd58b('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index aee2256..efeadf2 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 _0xa4dc=['code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x260952,_0x4d9101){var _0x2c1748=function(_0x174abc){while(--_0x174abc){_0x260952['push'](_0x260952['shift']());}};_0x2c1748(++_0x4d9101);}(_0xa4dc,0x16a));var _0xca4d=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xa4dc[_0x20ef64];return _0x3707d8;};'use strict';var _=require(_0xca4d('0x0'));var util=require(_0xca4d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xca4d('0x2'));var fs=require('fs');var Redis=require(_0xca4d('0x3'));var db=require(_0xca4d('0x4'))['db'];var utils=require(_0xca4d('0x5'));var logger=require(_0xca4d('0x6'))('rpc');var config=require(_0xca4d('0x7'));var jayson=require(_0xca4d('0x8'));var client=jayson[_0xca4d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x299f58,_0x5e3284,_0x35b21a){return new BPromise(function(_0x2fa52a,_0x21c434){return client[_0xca4d('0xa')](_0x299f58,_0x35b21a)['then'](function(_0x182f8a){logger[_0xca4d('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5e3284,_0xca4d('0xc'));logger['debug'](_0xca4d('0xd'),_0x5e3284,_0xca4d('0xc'),JSON[_0xca4d('0xe')](_0x182f8a));if(_0x182f8a[_0xca4d('0xf')]){if(_0x182f8a[_0xca4d('0xf')][_0xca4d('0x10')]===0x1f4){logger[_0xca4d('0xf')](_0xca4d('0x11'),_0x5e3284,_0x182f8a['error'][_0xca4d('0x12')]);return _0x21c434(_0x182f8a['error'][_0xca4d('0x12')]);}logger[_0xca4d('0xf')](_0xca4d('0x11'),_0x5e3284,_0x182f8a['error'][_0xca4d('0x12')]);return _0x2fa52a(_0x182f8a['error'][_0xca4d('0x12')]);}else{logger[_0xca4d('0xb')](_0xca4d('0x11'),_0x5e3284,_0xca4d('0xc'));_0x2fa52a(_0x182f8a[_0xca4d('0x13')][_0xca4d('0x12')]);}})[_0xca4d('0x14')](function(_0x5b7620){logger[_0xca4d('0xf')](_0xca4d('0x11'),_0x5e3284,_0x5b7620);_0x21c434(_0x5b7620);});});} \ No newline at end of file +var _0xea89=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0xe87e8b,_0x23be1a){var _0x2ef201=function(_0x46d21c){while(--_0x46d21c){_0xe87e8b['push'](_0xe87e8b['shift']());}};_0x2ef201(++_0x23be1a);}(_0xea89,0x1e2));var _0x9ea8=function(_0x3b6aaf,_0x4aef36){_0x3b6aaf=_0x3b6aaf-0x0;var _0x295fa9=_0xea89[_0x3b6aaf];return _0x295fa9;};'use strict';var _=require(_0x9ea8('0x0'));var util=require(_0x9ea8('0x1'));var moment=require(_0x9ea8('0x2'));var BPromise=require(_0x9ea8('0x3'));var rs=require(_0x9ea8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ea8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ea8('0x6'))('rpc');var config=require(_0x9ea8('0x7'));var jayson=require(_0x9ea8('0x8'));var client=jayson[_0x9ea8('0x9')][_0x9ea8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f2210,_0x2ad47f,_0x265c85){return new BPromise(function(_0x4889de,_0xad3e18){return client[_0x9ea8('0xb')](_0x1f2210,_0x265c85)['then'](function(_0x436faf){logger[_0x9ea8('0xc')](_0x9ea8('0xd'),_0x2ad47f,'request\x20sent');logger[_0x9ea8('0xe')](_0x9ea8('0xf'),_0x2ad47f,_0x9ea8('0x10'),JSON[_0x9ea8('0x11')](_0x436faf));if(_0x436faf[_0x9ea8('0x12')]){if(_0x436faf[_0x9ea8('0x12')][_0x9ea8('0x13')]===0x1f4){logger['error'](_0x9ea8('0xd'),_0x2ad47f,_0x436faf[_0x9ea8('0x12')][_0x9ea8('0x14')]);return _0xad3e18(_0x436faf['error'][_0x9ea8('0x14')]);}logger[_0x9ea8('0x12')](_0x9ea8('0xd'),_0x2ad47f,_0x436faf[_0x9ea8('0x12')][_0x9ea8('0x14')]);return _0x4889de(_0x436faf[_0x9ea8('0x12')][_0x9ea8('0x14')]);}else{logger['info'](_0x9ea8('0xd'),_0x2ad47f,_0x9ea8('0x10'));_0x4889de(_0x436faf[_0x9ea8('0x15')]['message']);}})[_0x9ea8('0x16')](function(_0x558869){logger[_0x9ea8('0x12')](_0x9ea8('0xd'),_0x2ad47f,_0x558869);_0xad3e18(_0x558869);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 9779f91..3b043e6 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 _0x5bb3=['delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x38805d,_0x214109){var _0x1e52b9=function(_0x322843){while(--_0x322843){_0x38805d['push'](_0x38805d['shift']());}};_0x1e52b9(++_0x214109);}(_0x5bb3,0x159));var _0x35bb=function(_0x10ec04,_0x45ca9d){_0x10ec04=_0x10ec04-0x0;var _0x46eca4=_0x5bb3[_0x10ec04];return _0x46eca4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x35bb('0x0'));var timeout=require(_0x35bb('0x1'));var express=require(_0x35bb('0x2'));var router=express[_0x35bb('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x35bb('0x4'));var config=require('../../config/environment');var controller=require(_0x35bb('0x5'));router[_0x35bb('0x6')]('/',auth[_0x35bb('0x7')](),controller[_0x35bb('0x8')]);router[_0x35bb('0x6')](_0x35bb('0x9'),auth['isAuthenticated'](),controller[_0x35bb('0xa')]);router[_0x35bb('0xb')]('/',auth['isAuthenticated'](),controller[_0x35bb('0xc')]);router[_0x35bb('0xd')](_0x35bb('0x9'),auth[_0x35bb('0x7')](),controller[_0x35bb('0xe')]);router[_0x35bb('0xf')](_0x35bb('0x9'),auth[_0x35bb('0x7')](),controller[_0x35bb('0x10')]);module[_0x35bb('0x11')]=router; \ No newline at end of file +var _0xe7df=['connect-timeout','express','Router','../../components/interaction/service','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x5a34ae,_0x5682d8){var _0x2841d7=function(_0x2ef934){while(--_0x2ef934){_0x5a34ae['push'](_0x5a34ae['shift']());}};_0x2841d7(++_0x5682d8);}(_0xe7df,0xb3));var _0xfe7d=function(_0xdef0e8,_0x5261bb){_0xdef0e8=_0xdef0e8-0x0;var _0x226947=_0xe7df[_0xdef0e8];return _0x226947;};'use strict';var multer=require(_0xfe7d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfe7d('0x1'));var express=require(_0xfe7d('0x2'));var router=express[_0xfe7d('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfe7d('0x4'));var config=require('../../config/environment');var controller=require(_0xfe7d('0x5'));router[_0xfe7d('0x6')]('/',auth[_0xfe7d('0x7')](),controller[_0xfe7d('0x8')]);router[_0xfe7d('0x6')](_0xfe7d('0x9'),auth[_0xfe7d('0x7')](),controller[_0xfe7d('0xa')]);router[_0xfe7d('0xb')]('/',auth['isAuthenticated'](),controller[_0xfe7d('0xc')]);router[_0xfe7d('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xfe7d('0xe')]);router[_0xfe7d('0xf')]('/:id',auth[_0xfe7d('0x7')](),controller[_0xfe7d('0x10')]);module[_0xfe7d('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 2dfe0cb..7f6b37b 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 _0x4e5d=['STRING','sequelize'];(function(_0xb6bddf,_0x2372c3){var _0x1a7749=function(_0x3e020e){while(--_0x3e020e){_0xb6bddf['push'](_0xb6bddf['shift']());}};_0x1a7749(++_0x2372c3);}(_0x4e5d,0x10b));var _0xd4e5=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x4e5d[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require(_0xd4e5('0x0'));module['exports']={'name':{'type':Sequelize[_0xd4e5('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xd4e5('0x1')]}}; \ No newline at end of file +var _0x1d5c=['name','sequelize','exports','STRING'];(function(_0xdd511d,_0x4ae9e1){var _0x5f0f08=function(_0x1605ce){while(--_0x1605ce){_0xdd511d['push'](_0xdd511d['shift']());}};_0x5f0f08(++_0x4ae9e1);}(_0x1d5c,0xe9));var _0xc1d5=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0x1d5c[_0x1d87fc];return _0x492b56;};'use strict';var Sequelize=require(_0xc1d5('0x0'));module[_0xc1d5('0x1')]={'name':{'type':Sequelize[_0xc1d5('0x2')],'unique':_0xc1d5('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xc1d5('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index b4c4dd5..2788208 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 _0xb641=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Pauses','UserProfileResource','end','sendStatus','error','stack','name','send','map','Pause','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x58c7ae,_0x3d33de){var _0x5f309f=function(_0x3fe287){while(--_0x3fe287){_0x58c7ae['push'](_0x58c7ae['shift']());}};_0x5f309f(++_0x3d33de);}(_0xb641,0xac));var _0x1b64=function(_0x56b2c,_0x297427){_0x56b2c=_0x56b2c-0x0;var _0x327fe3=_0xb641[_0x56b2c];return _0x327fe3;};'use strict';var emlformat=require(_0x1b64('0x0'));var rimraf=require(_0x1b64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1b64('0x2'));var rp=require(_0x1b64('0x3'));var moment=require(_0x1b64('0x4'));var BPromise=require(_0x1b64('0x5'));var Mustache=require('mustache');var util=require(_0x1b64('0x6'));var path=require('path');var sox=require(_0x1b64('0x7'));var csv=require(_0x1b64('0x8'));var ejs=require(_0x1b64('0x9'));var fs=require('fs');var fs_extra=require(_0x1b64('0xa'));var _=require(_0x1b64('0xb'));var squel=require(_0x1b64('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1b64('0x8'));var querystring=require(_0x1b64('0xd'));var Papa=require(_0x1b64('0xe'));var Redis=require(_0x1b64('0xf'));var authService=require(_0x1b64('0x10'));var qs=require(_0x1b64('0x11'));var as=require(_0x1b64('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b64('0x13'))(_0x1b64('0x14'));var utils=require(_0x1b64('0x15'));var config=require(_0x1b64('0x16'));var licenseUtil=require(_0x1b64('0x17'));var db=require(_0x1b64('0x18'))['db'];function respondWithStatusCode(_0x3d1486,_0x6f2b40){_0x6f2b40=_0x6f2b40||0xcc;return function(_0x309bfc){if(_0x309bfc){return _0x3d1486['sendStatus'](_0x6f2b40);}return _0x3d1486[_0x1b64('0x19')](_0x6f2b40)['end']();};}function respondWithResult(_0x4a8f30,_0x1e56b5){_0x1e56b5=_0x1e56b5||0xc8;return function(_0x1e64f1){if(_0x1e64f1){return _0x4a8f30[_0x1b64('0x19')](_0x1e56b5)['json'](_0x1e64f1);}};}function respondWithFilteredResult(_0x3ecbe9,_0x30f7fa){return function(_0x2cddbb){if(_0x2cddbb){var _0x5d493b=typeof _0x30f7fa[_0x1b64('0x1a')]==='undefined'&&typeof _0x30f7fa[_0x1b64('0x1b')]===_0x1b64('0x1c');var _0x147c6a=_0x2cddbb['count'];var _0x40e984=_0x5d493b?0x0:_0x30f7fa['offset'];var _0x2ca977=_0x5d493b?_0x2cddbb[_0x1b64('0x1d')]:_0x30f7fa[_0x1b64('0x1a')]+_0x30f7fa[_0x1b64('0x1b')];var _0x5345a0;if(_0x2ca977>=_0x147c6a){_0x2ca977=_0x147c6a;_0x5345a0=0xc8;}else{_0x5345a0=0xce;}_0x3ecbe9['status'](_0x5345a0);return _0x3ecbe9[_0x1b64('0x1e')](_0x1b64('0x1f'),_0x40e984+'-'+_0x2ca977+'/'+_0x147c6a)[_0x1b64('0x20')](_0x2cddbb);}return null;};}function patchUpdates(_0xf154e7){return function(_0x4c1e35){try{jsonpatch[_0x1b64('0x21')](_0x4c1e35,_0xf154e7,!![]);}catch(_0x7d0977){return BPromise[_0x1b64('0x22')](_0x7d0977);}return _0x4c1e35[_0x1b64('0x23')]();};}function saveUpdates(_0x19c5ff,_0x1e0077){return function(_0xb2bff){if(_0xb2bff){return _0xb2bff['update'](_0x19c5ff)[_0x1b64('0x24')](function(_0x17b9a5){return _0x17b9a5;});}return null;};}function removeEntity(_0x5a99ac,_0x104b5a){return function(_0xf14598){if(_0xf14598){return _0xf14598[_0x1b64('0x25')]()[_0x1b64('0x24')](function(){var _0x1d9bee=_0xf14598[_0x1b64('0x26')]({'plain':!![]});var _0x4e2efc=_0x1b64('0x27');return db[_0x1b64('0x28')]['destroy']({'where':{'type':_0x4e2efc,'resourceId':_0x1d9bee['id']}})[_0x1b64('0x24')](function(){return _0xf14598;});})[_0x1b64('0x24')](function(){_0x5a99ac[_0x1b64('0x19')](0xcc)[_0x1b64('0x29')]();});}};}function handleEntityNotFound(_0x182c1e,_0x1a0f1c){return function(_0x347cc9){if(!_0x347cc9){_0x182c1e[_0x1b64('0x2a')](0x194);}return _0x347cc9;};}function handleError(_0x20f482,_0x58550d){_0x58550d=_0x58550d||0x1f4;return function(_0x127759){logger[_0x1b64('0x2b')](_0x127759[_0x1b64('0x2c')]);if(_0x127759[_0x1b64('0x2d')]){delete _0x127759[_0x1b64('0x2d')];}_0x20f482['status'](_0x58550d)[_0x1b64('0x2e')](_0x127759);};}exports['index']=function(_0x4bc022,_0x21531a){var _0x17cdc9={},_0x576915={},_0x25f095={'count':0x0,'rows':[]};var _0x2bd57d=_[_0x1b64('0x2f')](db[_0x1b64('0x30')]['rawAttributes'],function(_0x467bba){return{'name':_0x467bba[_0x1b64('0x31')],'type':_0x467bba[_0x1b64('0x32')][_0x1b64('0x33')]};});_0x576915[_0x1b64('0x34')]=_[_0x1b64('0x2f')](_0x2bd57d,'name');_0x576915[_0x1b64('0x35')]=_[_0x1b64('0x36')](_0x4bc022[_0x1b64('0x35')]);_0x576915[_0x1b64('0x37')]=_['intersection'](_0x576915[_0x1b64('0x34')],_0x576915[_0x1b64('0x35')]);_0x17cdc9[_0x1b64('0x38')]=_[_0x1b64('0x39')](_0x576915[_0x1b64('0x34')],qs[_0x1b64('0x3a')](_0x4bc022['query'][_0x1b64('0x3a')]));_0x17cdc9[_0x1b64('0x38')]=_0x17cdc9[_0x1b64('0x38')][_0x1b64('0x3b')]?_0x17cdc9['attributes']:_0x576915[_0x1b64('0x34')];if(!_0x4bc022[_0x1b64('0x35')][_0x1b64('0x3c')](_0x1b64('0x3d'))){_0x17cdc9[_0x1b64('0x1b')]=qs[_0x1b64('0x1b')](_0x4bc022[_0x1b64('0x35')][_0x1b64('0x1b')]);_0x17cdc9['offset']=qs[_0x1b64('0x1a')](_0x4bc022[_0x1b64('0x35')][_0x1b64('0x1a')]);}_0x17cdc9[_0x1b64('0x3e')]=qs[_0x1b64('0x3f')](_0x4bc022[_0x1b64('0x35')]['sort']);_0x17cdc9[_0x1b64('0x40')]=qs[_0x1b64('0x37')](_['pick'](_0x4bc022[_0x1b64('0x35')],_0x576915[_0x1b64('0x37')]),_0x2bd57d);if(_0x4bc022['query'][_0x1b64('0x41')]){_0x17cdc9[_0x1b64('0x40')]=_[_0x1b64('0x42')](_0x17cdc9[_0x1b64('0x40')],{'$or':_['map'](_0x2bd57d,function(_0x207c60){if(_0x207c60[_0x1b64('0x32')]!==_0x1b64('0x43')){var _0x1e36a6={};_0x1e36a6[_0x207c60[_0x1b64('0x2d')]]={'$like':'%'+_0x4bc022[_0x1b64('0x35')][_0x1b64('0x41')]+'%'};return _0x1e36a6;}})});}_0x17cdc9=_[_0x1b64('0x42')]({},_0x17cdc9,_0x4bc022[_0x1b64('0x44')]);var _0xb59531={'where':_0x17cdc9['where']};return db['Pause'][_0x1b64('0x1d')](_0xb59531)[_0x1b64('0x24')](function(_0x55aea7){_0x25f095[_0x1b64('0x1d')]=_0x55aea7;if(_0x4bc022[_0x1b64('0x35')]['includeAll']){_0x17cdc9[_0x1b64('0x45')]=[{'all':!![]}];}return db[_0x1b64('0x30')][_0x1b64('0x46')](_0x17cdc9);})[_0x1b64('0x24')](function(_0x451285){_0x25f095[_0x1b64('0x47')]=_0x451285;return _0x25f095;})[_0x1b64('0x24')](respondWithFilteredResult(_0x21531a,_0x17cdc9))[_0x1b64('0x48')](handleError(_0x21531a,null));};exports['show']=function(_0x3f5e50,_0x1c5a6f){var _0x22dce6={'raw':!![],'where':{'id':_0x3f5e50[_0x1b64('0x49')]['id']}},_0x383450={};_0x383450[_0x1b64('0x34')]=_['keys'](db['Pause'][_0x1b64('0x4a')]);_0x383450[_0x1b64('0x35')]=_['keys'](_0x3f5e50[_0x1b64('0x35')]);_0x383450[_0x1b64('0x37')]=_[_0x1b64('0x39')](_0x383450[_0x1b64('0x34')],_0x383450[_0x1b64('0x35')]);_0x22dce6[_0x1b64('0x38')]=_['intersection'](_0x383450[_0x1b64('0x34')],qs[_0x1b64('0x3a')](_0x3f5e50[_0x1b64('0x35')][_0x1b64('0x3a')]));_0x22dce6[_0x1b64('0x38')]=_0x22dce6[_0x1b64('0x38')][_0x1b64('0x3b')]?_0x22dce6['attributes']:_0x383450[_0x1b64('0x34')];if(_0x3f5e50['query'][_0x1b64('0x4b')]){_0x22dce6[_0x1b64('0x45')]=[{'all':!![]}];}_0x22dce6=_['merge']({},_0x22dce6,_0x3f5e50[_0x1b64('0x44')]);return db[_0x1b64('0x30')][_0x1b64('0x4c')](_0x22dce6)[_0x1b64('0x24')](handleEntityNotFound(_0x1c5a6f,null))[_0x1b64('0x24')](respondWithResult(_0x1c5a6f,null))[_0x1b64('0x48')](handleError(_0x1c5a6f,null));};exports[_0x1b64('0x4d')]=function(_0x338cf9,_0x1676d5){return db[_0x1b64('0x30')][_0x1b64('0x4d')](_0x338cf9[_0x1b64('0x4e')],{})['then'](function(_0x4c22c9){var _0x4b1df5=_0x338cf9[_0x1b64('0x4f')]['get']({'plain':!![]});if(!_0x4b1df5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b1df5[_0x1b64('0x50')]===_0x1b64('0x4f')){var _0xc34140=_0x4c22c9[_0x1b64('0x26')]({'plain':!![]});var _0x4ee72a=_0x1b64('0x27');return db[_0x1b64('0x51')][_0x1b64('0x4c')]({'where':{'name':_0x4ee72a,'userProfileId':_0x4b1df5[_0x1b64('0x52')]},'raw':!![]})['then'](function(_0x1423fc){if(_0x1423fc&&_0x1423fc[_0x1b64('0x53')]===0x0){return db[_0x1b64('0x28')][_0x1b64('0x4d')]({'name':_0xc34140[_0x1b64('0x2d')],'resourceId':_0xc34140['id'],'type':_0x1423fc[_0x1b64('0x2d')],'sectionId':_0x1423fc['id']},{})[_0x1b64('0x24')](function(){return _0x4c22c9;});}else{return _0x4c22c9;}})[_0x1b64('0x48')](function(_0x78f51f){logger[_0x1b64('0x2b')](_0x1b64('0x54'),_0x78f51f);throw _0x78f51f;});}return _0x4c22c9;})[_0x1b64('0x24')](respondWithResult(_0x1676d5,0xc9))['catch'](handleError(_0x1676d5,null));};exports[_0x1b64('0x55')]=function(_0x121eae,_0x515afa){if(_0x121eae['body']['id']){delete _0x121eae[_0x1b64('0x4e')]['id'];}return db[_0x1b64('0x30')]['find']({'where':{'id':_0x121eae[_0x1b64('0x49')]['id']}})['then'](handleEntityNotFound(_0x515afa,null))[_0x1b64('0x24')](saveUpdates(_0x121eae[_0x1b64('0x4e')],null))['then'](respondWithResult(_0x515afa,null))[_0x1b64('0x48')](handleError(_0x515afa,null));};exports[_0x1b64('0x25')]=function(_0x440c34,_0x251754){return db[_0x1b64('0x30')][_0x1b64('0x4c')]({'where':{'id':_0x440c34[_0x1b64('0x49')]['id']}})['then'](handleEntityNotFound(_0x251754,null))[_0x1b64('0x24')](removeEntity(_0x251754,null))[_0x1b64('0x48')](handleError(_0x251754,null));}; \ No newline at end of file +var _0xca8a=['status','end','offset','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','Pause','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0xc0bdb8,_0x4a5d8b){var _0x2c8d74=function(_0x5c9aaf){while(--_0x5c9aaf){_0xc0bdb8['push'](_0xc0bdb8['shift']());}};_0x2c8d74(++_0x4a5d8b);}(_0xca8a,0xcf));var _0xaca8=function(_0x3897d7,_0xd2e82e){_0x3897d7=_0x3897d7-0x0;var _0x52e594=_0xca8a[_0x3897d7];return _0x52e594;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaca8('0x0'));var zipdir=require(_0xaca8('0x1'));var jsonpatch=require(_0xaca8('0x2'));var rp=require('request-promise');var moment=require(_0xaca8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaca8('0x4'));var util=require(_0xaca8('0x5'));var path=require(_0xaca8('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaca8('0x7'));var squel=require('squel');var crypto=require(_0xaca8('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xaca8('0x9'));var toCsv=require(_0xaca8('0xa'));var querystring=require(_0xaca8('0xb'));var Papa=require(_0xaca8('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaca8('0xd'));var as=require(_0xaca8('0xe'));var hardwareService=require(_0xaca8('0xf'));var logger=require(_0xaca8('0x10'))(_0xaca8('0x11'));var utils=require('../../config/utils');var config=require(_0xaca8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xaca8('0x13'))['db'];function respondWithStatusCode(_0x2f91f4,_0x5a4420){_0x5a4420=_0x5a4420||0xcc;return function(_0x33714a){if(_0x33714a){return _0x2f91f4[_0xaca8('0x14')](_0x5a4420);}return _0x2f91f4[_0xaca8('0x15')](_0x5a4420)[_0xaca8('0x16')]();};}function respondWithResult(_0x21b526,_0x58752b){_0x58752b=_0x58752b||0xc8;return function(_0x21a67){if(_0x21a67){return _0x21b526[_0xaca8('0x15')](_0x58752b)['json'](_0x21a67);}};}function respondWithFilteredResult(_0x334934,_0x2ff103){return function(_0x4c5bfc){if(_0x4c5bfc){var _0x22f7ed=typeof _0x2ff103[_0xaca8('0x17')]==='undefined'&&typeof _0x2ff103[_0xaca8('0x18')]==='undefined';var _0x4f0ad8=_0x4c5bfc[_0xaca8('0x19')];var _0x4e4409=_0x22f7ed?0x0:_0x2ff103[_0xaca8('0x17')];var _0x1766ec=_0x22f7ed?_0x4c5bfc[_0xaca8('0x19')]:_0x2ff103['offset']+_0x2ff103['limit'];var _0x44c514;if(_0x1766ec>=_0x4f0ad8){_0x1766ec=_0x4f0ad8;_0x44c514=0xc8;}else{_0x44c514=0xce;}_0x334934[_0xaca8('0x15')](_0x44c514);return _0x334934[_0xaca8('0x1a')](_0xaca8('0x1b'),_0x4e4409+'-'+_0x1766ec+'/'+_0x4f0ad8)[_0xaca8('0x1c')](_0x4c5bfc);}return null;};}function patchUpdates(_0x385915){return function(_0x498a8d){try{jsonpatch[_0xaca8('0x1d')](_0x498a8d,_0x385915,!![]);}catch(_0x1337e1){return BPromise['reject'](_0x1337e1);}return _0x498a8d[_0xaca8('0x1e')]();};}function saveUpdates(_0x389d1a,_0x14c875){return function(_0x28bdee){if(_0x28bdee){return _0x28bdee[_0xaca8('0x1f')](_0x389d1a)[_0xaca8('0x20')](function(_0x57a606){return _0x57a606;});}return null;};}function removeEntity(_0x36a55a,_0x162862){return function(_0x5040f5){if(_0x5040f5){return _0x5040f5[_0xaca8('0x21')]()[_0xaca8('0x20')](function(){var _0x479483=_0x5040f5[_0xaca8('0x22')]({'plain':!![]});var _0x550ce4='Pauses';return db[_0xaca8('0x23')]['destroy']({'where':{'type':_0x550ce4,'resourceId':_0x479483['id']}})[_0xaca8('0x20')](function(){return _0x5040f5;});})['then'](function(){_0x36a55a[_0xaca8('0x15')](0xcc)[_0xaca8('0x16')]();});}};}function handleEntityNotFound(_0x524212,_0x560b0e){return function(_0x28ceb2){if(!_0x28ceb2){_0x524212[_0xaca8('0x14')](0x194);}return _0x28ceb2;};}function handleError(_0x43f622,_0x44597f){_0x44597f=_0x44597f||0x1f4;return function(_0x96a2c9){logger[_0xaca8('0x24')](_0x96a2c9[_0xaca8('0x25')]);if(_0x96a2c9[_0xaca8('0x26')]){delete _0x96a2c9[_0xaca8('0x26')];}_0x43f622[_0xaca8('0x15')](_0x44597f)['send'](_0x96a2c9);};}exports[_0xaca8('0x27')]=function(_0x3796b9,_0x5407f5){var _0x360617={},_0x44948d={},_0x13e27c={'count':0x0,'rows':[]};var _0x55ed82=_[_0xaca8('0x28')](db[_0xaca8('0x29')][_0xaca8('0x2a')],function(_0x4c356f){return{'name':_0x4c356f['fieldName'],'type':_0x4c356f[_0xaca8('0x2b')][_0xaca8('0x2c')]};});_0x44948d[_0xaca8('0x2d')]=_['map'](_0x55ed82,'name');_0x44948d[_0xaca8('0x2e')]=_[_0xaca8('0x2f')](_0x3796b9[_0xaca8('0x2e')]);_0x44948d[_0xaca8('0x30')]=_['intersection'](_0x44948d[_0xaca8('0x2d')],_0x44948d[_0xaca8('0x2e')]);_0x360617[_0xaca8('0x31')]=_[_0xaca8('0x32')](_0x44948d[_0xaca8('0x2d')],qs[_0xaca8('0x33')](_0x3796b9[_0xaca8('0x2e')][_0xaca8('0x33')]));_0x360617['attributes']=_0x360617[_0xaca8('0x31')][_0xaca8('0x34')]?_0x360617[_0xaca8('0x31')]:_0x44948d['model'];if(!_0x3796b9[_0xaca8('0x2e')][_0xaca8('0x35')]('nolimit')){_0x360617[_0xaca8('0x18')]=qs[_0xaca8('0x18')](_0x3796b9[_0xaca8('0x2e')][_0xaca8('0x18')]);_0x360617[_0xaca8('0x17')]=qs[_0xaca8('0x17')](_0x3796b9['query']['offset']);}_0x360617[_0xaca8('0x36')]=qs[_0xaca8('0x37')](_0x3796b9[_0xaca8('0x2e')][_0xaca8('0x37')]);_0x360617['where']=qs[_0xaca8('0x30')](_[_0xaca8('0x38')](_0x3796b9[_0xaca8('0x2e')],_0x44948d[_0xaca8('0x30')]),_0x55ed82);if(_0x3796b9[_0xaca8('0x2e')]['filter']){_0x360617[_0xaca8('0x39')]=_[_0xaca8('0x3a')](_0x360617['where'],{'$or':_[_0xaca8('0x28')](_0x55ed82,function(_0x3855db){if(_0x3855db[_0xaca8('0x2b')]!==_0xaca8('0x3b')){var _0xe485ed={};_0xe485ed[_0x3855db['name']]={'$like':'%'+_0x3796b9[_0xaca8('0x2e')][_0xaca8('0x3c')]+'%'};return _0xe485ed;}})});}_0x360617=_[_0xaca8('0x3a')]({},_0x360617,_0x3796b9[_0xaca8('0x3d')]);var _0x3054c0={'where':_0x360617[_0xaca8('0x39')]};return db[_0xaca8('0x29')][_0xaca8('0x19')](_0x3054c0)[_0xaca8('0x20')](function(_0x2ee079){_0x13e27c['count']=_0x2ee079;if(_0x3796b9['query']['includeAll']){_0x360617['include']=[{'all':!![]}];}return db['Pause'][_0xaca8('0x3e')](_0x360617);})[_0xaca8('0x20')](function(_0x4fbe3d){_0x13e27c[_0xaca8('0x3f')]=_0x4fbe3d;return _0x13e27c;})[_0xaca8('0x20')](respondWithFilteredResult(_0x5407f5,_0x360617))[_0xaca8('0x40')](handleError(_0x5407f5,null));};exports[_0xaca8('0x41')]=function(_0x42d5df,_0x3b5903){var _0x78166b={'raw':!![],'where':{'id':_0x42d5df[_0xaca8('0x42')]['id']}},_0x5d6a1e={};_0x5d6a1e[_0xaca8('0x2d')]=_['keys'](db[_0xaca8('0x29')][_0xaca8('0x2a')]);_0x5d6a1e['query']=_[_0xaca8('0x2f')](_0x42d5df[_0xaca8('0x2e')]);_0x5d6a1e[_0xaca8('0x30')]=_[_0xaca8('0x32')](_0x5d6a1e[_0xaca8('0x2d')],_0x5d6a1e[_0xaca8('0x2e')]);_0x78166b['attributes']=_[_0xaca8('0x32')](_0x5d6a1e[_0xaca8('0x2d')],qs[_0xaca8('0x33')](_0x42d5df['query'][_0xaca8('0x33')]));_0x78166b[_0xaca8('0x31')]=_0x78166b[_0xaca8('0x31')][_0xaca8('0x34')]?_0x78166b[_0xaca8('0x31')]:_0x5d6a1e['model'];if(_0x42d5df[_0xaca8('0x2e')]['includeAll']){_0x78166b[_0xaca8('0x43')]=[{'all':!![]}];}_0x78166b=_['merge']({},_0x78166b,_0x42d5df['options']);return db[_0xaca8('0x29')][_0xaca8('0x44')](_0x78166b)[_0xaca8('0x20')](handleEntityNotFound(_0x3b5903,null))[_0xaca8('0x20')](respondWithResult(_0x3b5903,null))[_0xaca8('0x40')](handleError(_0x3b5903,null));};exports[_0xaca8('0x45')]=function(_0x40631e,_0x356ae9){return db[_0xaca8('0x29')][_0xaca8('0x45')](_0x40631e[_0xaca8('0x46')],{})[_0xaca8('0x20')](function(_0x4ee184){var _0x5632ff=_0x40631e[_0xaca8('0x47')][_0xaca8('0x22')]({'plain':!![]});if(!_0x5632ff)throw new Error(_0xaca8('0x48'));if(_0x5632ff[_0xaca8('0x49')]===_0xaca8('0x47')){var _0x240d50=_0x4ee184[_0xaca8('0x22')]({'plain':!![]});var _0x2107d2=_0xaca8('0x4a');return db[_0xaca8('0x4b')]['find']({'where':{'name':_0x2107d2,'userProfileId':_0x5632ff['userProfileId']},'raw':!![]})['then'](function(_0x3f417f){if(_0x3f417f&&_0x3f417f['autoAssociation']===0x0){return db[_0xaca8('0x23')]['create']({'name':_0x240d50[_0xaca8('0x26')],'resourceId':_0x240d50['id'],'type':_0x3f417f[_0xaca8('0x26')],'sectionId':_0x3f417f['id']},{})[_0xaca8('0x20')](function(){return _0x4ee184;});}else{return _0x4ee184;}})[_0xaca8('0x40')](function(_0x3c1dc9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c1dc9);throw _0x3c1dc9;});}return _0x4ee184;})['then'](respondWithResult(_0x356ae9,0xc9))[_0xaca8('0x40')](handleError(_0x356ae9,null));};exports[_0xaca8('0x1f')]=function(_0x147ae5,_0x1b4c45){if(_0x147ae5['body']['id']){delete _0x147ae5[_0xaca8('0x46')]['id'];}return db['Pause'][_0xaca8('0x44')]({'where':{'id':_0x147ae5[_0xaca8('0x42')]['id']}})[_0xaca8('0x20')](handleEntityNotFound(_0x1b4c45,null))[_0xaca8('0x20')](saveUpdates(_0x147ae5[_0xaca8('0x46')],null))[_0xaca8('0x20')](respondWithResult(_0x1b4c45,null))[_0xaca8('0x40')](handleError(_0x1b4c45,null));};exports['destroy']=function(_0x3ea218,_0x1fd530){return db[_0xaca8('0x29')]['find']({'where':{'id':_0x3ea218[_0xaca8('0x42')]['id']}})[_0xaca8('0x20')](handleEntityNotFound(_0x1fd530,null))['then'](removeEntity(_0x1fd530,null))[_0xaca8('0x40')](handleError(_0x1fd530,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index b6666b3..0bed611 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 _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x27bfd9,_0x5c53eb){var _0x4dd58a=function(_0x24e2e6){while(--_0x24e2e6){_0x27bfd9['push'](_0x27bfd9['shift']());}};_0x4dd58a(++_0x5c53eb);}(_0x326f,0xd1));var _0xf326=function(_0x56523a,_0x2bfbf2){_0x56523a=_0x56523a-0x0;var _0x231e20=_0x326f[_0x56523a];return _0x231e20;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x7217,0x19e));var _0x7721=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x7217[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index ab59cea..5f08f12 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x40cd87,_0x39acea){var _0x187be6=function(_0x6f186){while(--_0x6f186){_0x40cd87['push'](_0x40cd87['shift']());}};_0x187be6(++_0x39acea);}(_0x7a54,0x106));var _0x47a5=function(_0x63a106,_0x54d484){_0x63a106=_0x63a106-0x0;var _0xd93f6b=_0x7a54[_0x63a106];return _0xd93f6b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x3bfa10,_0x49af57){var _0x15bdf9=function(_0x1d673d){while(--_0x1d673d){_0x3bfa10['push'](_0x3bfa10['shift']());}};_0x15bdf9(++_0x49af57);}(_0xb10b,0x12a));var _0xbb10=function(_0x2cb58b,_0x5a879d){_0x2cb58b=_0x2cb58b-0x0;var _0xe9dd9c=_0xb10b[_0x2cb58b];return _0xe9dd9c;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index adf482e..e461c67 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 _0x9bde=['exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','isAuthenticated','show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','replace','format','extname','now','post','file','upload','webhookPost','put','delete'];(function(_0x248787,_0x5c12b4){var _0x31ddd2=function(_0x51b19d){while(--_0x51b19d){_0x248787['push'](_0x248787['shift']());}};_0x31ddd2(++_0x5c12b4);}(_0x9bde,0xe1));var _0xe9bd=function(_0xdc07f6,_0x24b62f){_0xdc07f6=_0xdc07f6-0x0;var _0x3b625e=_0x9bde[_0xdc07f6];return _0x3b625e;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var fs_extra=require(_0xe9bd('0x3'));var auth=require(_0xe9bd('0x4'));var interaction=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var controller=require(_0xe9bd('0x7'));router[_0xe9bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9bd('0x9')]);router[_0xe9bd('0x8')](_0xe9bd('0xa'),controller[_0xe9bd('0xb')]);router[_0xe9bd('0x8')](_0xe9bd('0xc'),auth[_0xe9bd('0xd')](),controller[_0xe9bd('0xe')]);router[_0xe9bd('0x8')](_0xe9bd('0xf'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xe9bd('0x10')]({'destination':function(_0x145521,_0x2601ac,_0x581ab9){_0x581ab9(null,path[_0xe9bd('0x11')](config[_0xe9bd('0x12')],_0xe9bd('0x13')));},'filename':function(_0x141587,_0x5e022a,_0x2c1d98){_0x5e022a['originalname']=_0x5e022a[_0xe9bd('0x14')][_0xe9bd('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2c1d98(null,util[_0xe9bd('0x16')]('%s-%s%s',path['basename'](_0x5e022a[_0xe9bd('0x14')],path[_0xe9bd('0x17')](_0x5e022a[_0xe9bd('0x14')])),Date[_0xe9bd('0x18')](),path[_0xe9bd('0x17')](_0x5e022a[_0xe9bd('0x14')])));}})});router[_0xe9bd('0x19')]('/',upload['single'](_0xe9bd('0x1a')),controller[_0xe9bd('0x1b')]);router[_0xe9bd('0x19')]('/webhook',controller[_0xe9bd('0x1c')]);router[_0xe9bd('0x1d')](_0xe9bd('0xc'),auth[_0xe9bd('0xd')](),controller['update']);router[_0xe9bd('0x1e')]('/:id',auth[_0xe9bd('0xd')](),controller['delete']);module[_0xe9bd('0x1f')]=router; \ No newline at end of file +var _0x425d=['isAuthenticated','index','/webhook','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','format','%s-%s%s','basename','extname','now','single','file','upload','post','webhookPost','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get'];(function(_0x58db1a,_0x4674d9){var _0xf84bd0=function(_0x4f5d3e){while(--_0x4f5d3e){_0x58db1a['push'](_0x58db1a['shift']());}};_0xf84bd0(++_0x4674d9);}(_0x425d,0x1e0));var _0xd425=function(_0x3815b2,_0xdeaa84){_0x3815b2=_0x3815b2-0x0;var _0x2ebd79=_0x425d[_0x3815b2];return _0x2ebd79;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var fs_extra=require(_0xd425('0x5'));var auth=require(_0xd425('0x6'));var interaction=require(_0xd425('0x7'));var config=require('../../config/environment');var controller=require(_0xd425('0x8'));router[_0xd425('0x9')]('/',auth[_0xd425('0xa')](),controller[_0xd425('0xb')]);router[_0xd425('0x9')](_0xd425('0xc'),controller['webhookGet']);router[_0xd425('0x9')](_0xd425('0xd'),auth[_0xd425('0xa')](),controller[_0xd425('0xe')]);router[_0xd425('0x9')](_0xd425('0xf'),auth[_0xd425('0xa')](),controller[_0xd425('0x10')]);var upload=multer({'storage':multer[_0xd425('0x11')]({'destination':function(_0x35a7f4,_0x3d2bcf,_0x10d463){_0x10d463(null,path[_0xd425('0x12')](config[_0xd425('0x13')],_0xd425('0x14')));},'filename':function(_0x2385a5,_0x9bb611,_0x3cacf7){_0x9bb611[_0xd425('0x15')]=_0x9bb611[_0xd425('0x15')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3cacf7(null,util[_0xd425('0x16')](_0xd425('0x17'),path[_0xd425('0x18')](_0x9bb611['originalname'],path[_0xd425('0x19')](_0x9bb611[_0xd425('0x15')])),Date[_0xd425('0x1a')](),path[_0xd425('0x19')](_0x9bb611[_0xd425('0x15')])));}})});router['post']('/',upload[_0xd425('0x1b')](_0xd425('0x1c')),controller[_0xd425('0x1d')]);router[_0xd425('0x1e')]('/webhook',controller[_0xd425('0x1f')]);router[_0xd425('0x20')](_0xd425('0xd'),auth[_0xd425('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd425('0x21')]);module[_0xd425('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 29cbac2..6543e60 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 _0x4710=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','never'];(function(_0x26eb44,_0xa701be){var _0x1c1c23=function(_0x38775d){while(--_0x38775d){_0x26eb44['push'](_0x26eb44['shift']());}};_0x1c1c23(++_0xa701be);}(_0x4710,0x79));var _0x0471=function(_0x571282,_0x2b3123){_0x571282=_0x571282-0x0;var _0x391933=_0x4710[_0x571282];return _0x391933;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0471('0x0')]},'type':{'type':Sequelize[_0x0471('0x1')](_0x0471('0x2'),_0x0471('0x3'))},'description':{'type':Sequelize[_0x0471('0x4')]},'version':{'type':Sequelize[_0x0471('0x4')]},'path':{'type':Sequelize[_0x0471('0x0')],'comment':_0x0471('0x5')},'active':{'type':Sequelize[_0x0471('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x0471('0x7'),_0x0471('0x8'),_0x0471('0x9'),_0x0471('0xa')),'defaultValue':'always','comment':_0x0471('0xb')},'icon':{'type':Sequelize[_0x0471('0x0')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x0471('0x0')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x0471('0x0')]}}; \ No newline at end of file +var _0xbcb4=['BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never','STRING','ENUM','html','TEXT'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xbcb4,0x1ac));var _0x4bcb=function(_0x15022a,_0x4c0084){_0x15022a=_0x15022a-0x0;var _0x71418f=_0xbcb4[_0x15022a];return _0x71418f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4bcb('0x0')]},'type':{'type':Sequelize[_0x4bcb('0x1')](_0x4bcb('0x2'),'script')},'description':{'type':Sequelize[_0x4bcb('0x3')]},'version':{'type':Sequelize[_0x4bcb('0x3')]},'path':{'type':Sequelize[_0x4bcb('0x0')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x4bcb('0x4')],'defaultValue':0x0,'comment':_0x4bcb('0x5')},'sidebar':{'type':Sequelize[_0x4bcb('0x1')]('adminOnly',_0x4bcb('0x6'),_0x4bcb('0x7'),_0x4bcb('0x8')),'defaultValue':_0x4bcb('0x7'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x4bcb('0x0')]},'adminUrl':{'type':Sequelize[_0x4bcb('0x0')]},'agentUrl':{'type':Sequelize[_0x4bcb('0x0')]},'scriptName':{'type':Sequelize[_0x4bcb('0x0')]},'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 fb45db7..9a8a07a 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 _0x1f62=['Plugin','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','download','path','join','root','server/files/plugins','format','%s.zip','createWriteStream','zip','code','ENOENT','Error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','basename','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','type','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','admin','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','create','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','headers','content-length','content-type','statusCode','http://localhost:','%s%s','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','extract-zip','archiver','../../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','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map'];(function(_0x24f862,_0x4b645a){var _0x198aa4=function(_0x131195){while(--_0x131195){_0x24f862['push'](_0x24f862['shift']());}};_0x198aa4(++_0x4b645a);}(_0x1f62,0x76));var _0x21f6=function(_0xa9eaa0,_0x4ba2b4){_0xa9eaa0=_0xa9eaa0-0x0;var _0x30897a=_0x1f62[_0xa9eaa0];return _0x30897a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21f6('0x0'));var zipdir=require(_0x21f6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x21f6('0x2'));var moment=require(_0x21f6('0x3'));var BPromise=require(_0x21f6('0x4'));var Mustache=require(_0x21f6('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x21f6('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x21f6('0x7'));var _=require(_0x21f6('0x8'));var squel=require(_0x21f6('0x9'));var crypto=require(_0x21f6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x21f6('0xb'));var toCsv=require(_0x21f6('0x6'));var querystring=require(_0x21f6('0xc'));var Papa=require(_0x21f6('0xd'));var extract=require(_0x21f6('0xe'));var rimraf=require('rimraf');var archiver=require(_0x21f6('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x21f6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x21f6('0x11'));var logger=require(_0x21f6('0x12'))(_0x21f6('0x13'));var utils=require(_0x21f6('0x14'));var config=require(_0x21f6('0x15'));var licenseUtil=require(_0x21f6('0x16'));var db=require(_0x21f6('0x17'))['db'];config[_0x21f6('0x18')]=_[_0x21f6('0x19')](config[_0x21f6('0x18')],{'host':_0x21f6('0x1a'),'port':0x18eb});var socket=require(_0x21f6('0x1b'))(new Redis(config[_0x21f6('0x18')]));require('./plugin.socket')[_0x21f6('0x1c')](socket);function respondWithStatusCode(_0x51225a,_0x281d27){_0x281d27=_0x281d27||0xcc;return function(_0x7337fd){if(_0x7337fd){return _0x51225a[_0x21f6('0x1d')](_0x281d27);}return _0x51225a[_0x21f6('0x1e')](_0x281d27)[_0x21f6('0x1f')]();};}function respondWithResult(_0x47cfa3,_0x5beb82){_0x5beb82=_0x5beb82||0xc8;return function(_0x2cb636){if(_0x2cb636){return _0x47cfa3[_0x21f6('0x1e')](_0x5beb82)['json'](_0x2cb636);}};}function respondWithFilteredResult(_0x176d83,_0x35c71f){return function(_0x5f0a42){if(_0x5f0a42){var _0x364ebc=typeof _0x35c71f[_0x21f6('0x20')]===_0x21f6('0x21')&&typeof _0x35c71f['limit']==='undefined';var _0x46f793=_0x5f0a42['count'];var _0x31045a=_0x364ebc?0x0:_0x35c71f[_0x21f6('0x20')];var _0xfe4283=_0x364ebc?_0x5f0a42[_0x21f6('0x22')]:_0x35c71f[_0x21f6('0x20')]+_0x35c71f[_0x21f6('0x23')];var _0x1156ec;if(_0xfe4283>=_0x46f793){_0xfe4283=_0x46f793;_0x1156ec=0xc8;}else{_0x1156ec=0xce;}_0x176d83[_0x21f6('0x1e')](_0x1156ec);return _0x176d83[_0x21f6('0x24')](_0x21f6('0x25'),_0x31045a+'-'+_0xfe4283+'/'+_0x46f793)[_0x21f6('0x26')](_0x5f0a42);}return null;};}function patchUpdates(_0x40aabb){return function(_0x4b8abb){try{jsonpatch[_0x21f6('0x27')](_0x4b8abb,_0x40aabb,!![]);}catch(_0x40193c){return BPromise[_0x21f6('0x28')](_0x40193c);}return _0x4b8abb[_0x21f6('0x29')]();};}function saveUpdates(_0x2c4240,_0x5672ac){return function(_0x4ab082){if(_0x4ab082){return _0x4ab082[_0x21f6('0x2a')](_0x2c4240)[_0x21f6('0x2b')](function(_0x1d4460){return _0x1d4460;});}return null;};}function removeEntity(_0x4f8747,_0x560492){return function(_0x2b218e){if(_0x2b218e){return _0x2b218e[_0x21f6('0x2c')]()[_0x21f6('0x2b')](function(){var _0x2f82e7=_0x2b218e[_0x21f6('0x2d')]({'plain':!![]});var _0x12ebd4=_0x21f6('0x2e');return db[_0x21f6('0x2f')][_0x21f6('0x2c')]({'where':{'type':_0x12ebd4,'resourceId':_0x2f82e7['id']}})['then'](function(){return _0x2b218e;});})[_0x21f6('0x2b')](function(){_0x4f8747[_0x21f6('0x1e')](0xcc)[_0x21f6('0x1f')]();});}};}function handleEntityNotFound(_0x6e48d,_0x1e997c){return function(_0x2ae13f){if(!_0x2ae13f){_0x6e48d[_0x21f6('0x1d')](0x194);}return _0x2ae13f;};}function handleError(_0x4923db,_0x4ec3bb){_0x4ec3bb=_0x4ec3bb||0x1f4;return function(_0x2e44f0){logger[_0x21f6('0x30')](_0x2e44f0[_0x21f6('0x31')]);if(_0x2e44f0['name']){delete _0x2e44f0[_0x21f6('0x32')];}_0x4923db['status'](_0x4ec3bb)[_0x21f6('0x33')](_0x2e44f0);};}exports[_0x21f6('0x34')]=function(_0x365a56,_0x31847a){var _0x5c0ed2={},_0x13f423={},_0x3d1e1f={'count':0x0,'rows':[]};var _0x12fe16=_[_0x21f6('0x35')](db[_0x21f6('0x36')][_0x21f6('0x37')],function(_0x3d4e56){return{'name':_0x3d4e56['fieldName'],'type':_0x3d4e56['type'][_0x21f6('0x38')]};});_0x13f423[_0x21f6('0x39')]=_['map'](_0x12fe16,_0x21f6('0x32'));_0x13f423[_0x21f6('0x3a')]=_[_0x21f6('0x3b')](_0x365a56[_0x21f6('0x3a')]);_0x13f423[_0x21f6('0x3c')]=_['intersection'](_0x13f423['model'],_0x13f423[_0x21f6('0x3a')]);_0x5c0ed2[_0x21f6('0x3d')]=_[_0x21f6('0x3e')](_0x13f423[_0x21f6('0x39')],qs[_0x21f6('0x3f')](_0x365a56[_0x21f6('0x3a')][_0x21f6('0x3f')]));_0x5c0ed2[_0x21f6('0x3d')]=_0x5c0ed2['attributes'][_0x21f6('0x40')]?_0x5c0ed2[_0x21f6('0x3d')]:_0x13f423['model'];if(!_0x365a56['query'][_0x21f6('0x41')](_0x21f6('0x42'))){_0x5c0ed2[_0x21f6('0x23')]=qs['limit'](_0x365a56[_0x21f6('0x3a')][_0x21f6('0x23')]);_0x5c0ed2[_0x21f6('0x20')]=qs[_0x21f6('0x20')](_0x365a56[_0x21f6('0x3a')][_0x21f6('0x20')]);}_0x5c0ed2['order']=qs[_0x21f6('0x43')](_0x365a56['query']['sort']);_0x5c0ed2['where']=qs['filters'](_[_0x21f6('0x44')](_0x365a56[_0x21f6('0x3a')],_0x13f423['filters']),_0x12fe16);if(_0x365a56['query'][_0x21f6('0x45')]){_0x5c0ed2[_0x21f6('0x46')]=_['merge'](_0x5c0ed2['where'],{'$or':_[_0x21f6('0x35')](_0x12fe16,function(_0x575c8e){if(_0x575c8e['type']!==_0x21f6('0x47')){var _0x2da9ed={};_0x2da9ed[_0x575c8e[_0x21f6('0x32')]]={'$like':'%'+_0x365a56['query'][_0x21f6('0x45')]+'%'};return _0x2da9ed;}})});}_0x5c0ed2=_[_0x21f6('0x48')]({},_0x5c0ed2,_0x365a56[_0x21f6('0x49')]);var _0x2cd5fb={'where':_0x5c0ed2[_0x21f6('0x46')]};return db[_0x21f6('0x36')]['count'](_0x2cd5fb)[_0x21f6('0x2b')](function(_0x4fcb3c){_0x3d1e1f[_0x21f6('0x22')]=_0x4fcb3c;if(_0x365a56['query'][_0x21f6('0x4a')]){_0x5c0ed2[_0x21f6('0x4b')]=[{'all':!![]}];}return db[_0x21f6('0x36')][_0x21f6('0x4c')](_0x5c0ed2);})['then'](function(_0x34bae9){_0x3d1e1f['rows']=_0x34bae9;return _0x3d1e1f;})[_0x21f6('0x2b')](respondWithFilteredResult(_0x31847a,_0x5c0ed2))[_0x21f6('0x4d')](handleError(_0x31847a,null));};exports[_0x21f6('0x4e')]=function(_0x4d5128,_0x368dbd){var _0x2c11bc={'raw':!![],'where':{'id':_0x4d5128[_0x21f6('0x4f')]['id']}},_0x520c31={};_0x520c31[_0x21f6('0x39')]=_[_0x21f6('0x3b')](db[_0x21f6('0x36')][_0x21f6('0x37')]);_0x520c31[_0x21f6('0x3a')]=_['keys'](_0x4d5128['query']);_0x520c31['filters']=_[_0x21f6('0x3e')](_0x520c31[_0x21f6('0x39')],_0x520c31['query']);_0x2c11bc[_0x21f6('0x3d')]=_[_0x21f6('0x3e')](_0x520c31[_0x21f6('0x39')],qs[_0x21f6('0x3f')](_0x4d5128[_0x21f6('0x3a')][_0x21f6('0x3f')]));_0x2c11bc['attributes']=_0x2c11bc[_0x21f6('0x3d')][_0x21f6('0x40')]?_0x2c11bc['attributes']:_0x520c31[_0x21f6('0x39')];if(_0x4d5128[_0x21f6('0x3a')][_0x21f6('0x4a')]){_0x2c11bc[_0x21f6('0x4b')]=[{'all':!![]}];}_0x2c11bc=_[_0x21f6('0x48')]({},_0x2c11bc,_0x4d5128[_0x21f6('0x49')]);return db['Plugin'][_0x21f6('0x50')](_0x2c11bc)[_0x21f6('0x2b')](handleEntityNotFound(_0x368dbd,null))[_0x21f6('0x2b')](respondWithResult(_0x368dbd,null))[_0x21f6('0x4d')](handleError(_0x368dbd,null));};exports[_0x21f6('0x51')]=function(_0x58df37,_0x2f9dce,_0xf79502){return db[_0x21f6('0x36')][_0x21f6('0x50')]({'where':{'id':_0x58df37[_0x21f6('0x4f')]['id']},'attributes':[_0x21f6('0x32'),_0x21f6('0x52')],'raw':!![]})[_0x21f6('0x2b')](handleEntityNotFound(_0x2f9dce,null))[_0x21f6('0x2b')](function(_0x36af14){if(_0x36af14){var _0x805003=path[_0x21f6('0x53')](config[_0x21f6('0x54')],_0x21f6('0x55'),util[_0x21f6('0x56')](_0x21f6('0x57'),path['basename'](_0x36af14[_0x21f6('0x52')])));var _0x2b7052=fs[_0x21f6('0x58')](_0x805003);var _0x19787e=archiver(_0x21f6('0x59'),{'zlib':{'level':0x9}});_0x19787e['on']('warning',function(_0x4540ae){if(_0x4540ae[_0x21f6('0x5a')]===_0x21f6('0x5b')){logger[_0x21f6('0x30')](_0x4540ae);}else{throw new db['Sequelize'][(_0x21f6('0x5c'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x19787e['on'](_0x21f6('0x30'),function(_0x1871b4){throw new db[(_0x21f6('0x5d'))][(_0x21f6('0x5c'))](_0x21f6('0x5e'));});_0x19787e[_0x21f6('0x5f')](_0x2b7052);_0x19787e[_0x21f6('0x60')](_0x21f6('0x61'),{'cwd':path[_0x21f6('0x53')](config[_0x21f6('0x54')],_0x21f6('0x55'),path[_0x21f6('0x62')](_0x36af14[_0x21f6('0x52')])),'ignore':[path[_0x21f6('0x53')](path[_0x21f6('0x63')](_0x36af14['path']),'node_modules/**/*'),path['join'](path['basename'](_0x36af14[_0x21f6('0x52')]),_0x21f6('0x64'))],'nodir':!![]})[_0x21f6('0x65')]();_0x2b7052['on']('close',function(){if(!fs[_0x21f6('0x66')](_0x805003)){throw new db['Sequelize'][(_0x21f6('0x5c'))](_0x21f6('0x67'));}return _0x2f9dce['download'](_0x805003,util[_0x21f6('0x56')](_0x21f6('0x57'),path[_0x21f6('0x63')](_0x36af14[_0x21f6('0x52')])),function(_0x4bd384){if(_0x4bd384){throw new db[(_0x21f6('0x5d'))][(_0x21f6('0x5c'))](_0x21f6('0x68'));}fs[_0x21f6('0x69')](_0x805003);logger[_0x21f6('0x6a')](_0x21f6('0x6b'));logger[_0x21f6('0x6a')](_0x21f6('0x6c'));});});}return null;})['catch'](handleError(_0x2f9dce,null));};exports[_0x21f6('0x6d')]=function(_0x1b39eb,_0x8b79,_0x4bc921){var _0x5ba801=path[_0x21f6('0x63')](_0x1b39eb[_0x21f6('0x6e')][_0x21f6('0x6f')],path[_0x21f6('0x70')](_0x1b39eb['file']['filename']));var _0x26157e=path[_0x21f6('0x53')](config[_0x21f6('0x54')],_0x21f6('0x55'),_0x1b39eb['file'][_0x21f6('0x6f')]);var _0x5b2151=path[_0x21f6('0x53')](config['root'],_0x21f6('0x55'),_0x5ba801);logger[_0x21f6('0x6a')]('Plugin\x20upload\x20filepath:\x20%s',_0x26157e);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x5b2151);try{fs['chmodSync'](_0x26157e,parseInt(_0x21f6('0x71'),0x8));extract(_0x26157e,{'dir':_0x5b2151},function(_0x4cfeee){if(_0x4cfeee){logger[_0x21f6('0x30')](_0x4cfeee);handleError(_0x4cfeee,!![]);};var _0x55e26b=fs[_0x21f6('0x72')](_0x5b2151);if(_0x55e26b['length']>0x1){removeReferences(_0x26157e,_0x5b2151);logger[_0x21f6('0x30')](_0x21f6('0x73'));return _0x4bc921(new Error('Invalid\x20plugin\x20structure'));}var _0x1c3a18=fs['lstatSync'](path[_0x21f6('0x53')](_0x5b2151,_0x55e26b[0x0]));if(_0x1c3a18[_0x21f6('0x74')]()){removeReferences(_0x26157e,_0x5b2151);logger[_0x21f6('0x30')](_0x21f6('0x73'));return _0x4bc921(new Error(_0x21f6('0x73')));}if(_0x1c3a18[_0x21f6('0x75')]()){var _0x1aa03e=fs[_0x21f6('0x72')](path['join'](_0x5b2151,_0x55e26b[0x0]));if(_0x1aa03e[_0x21f6('0x40')]===0x0){removeReferences(_0x26157e,_0x5b2151);logger[_0x21f6('0x30')]('Invalid\x20plugin\x20structure');return _0x4bc921(new Error(_0x21f6('0x73')));}var _0x32ed96=_0x1aa03e[_0x21f6('0x76')](function(_0x1bfd73){return _0x1bfd73==='manifest.json';});if(!_0x32ed96){return _0x4bc921(new Error(_0x21f6('0x77')));}var _0x31e1fe=fs[_0x21f6('0x78')](path[_0x21f6('0x53')](_0x5b2151,_0x55e26b[0x0],_0x21f6('0x79')));var _0x6359a4=JSON[_0x21f6('0x7a')](_0x31e1fe);if(_0x21f6('0x21')==typeof _0x6359a4[_0x21f6('0x32')]){return _0x4bc921(new Error(_0x21f6('0x7b')));}if('undefined'==typeof _0x6359a4[_0x21f6('0x7c')]){return _0x4bc921(new Error(_0x21f6('0x7d')));}if(_0x21f6('0x21')==typeof _0x6359a4[_0x21f6('0x7e')]){return _0x4bc921(new Error(_0x21f6('0x7f')));}if(_0x21f6('0x21')==typeof _0x6359a4[_0x21f6('0x80')]){return _0x4bc921(new Error(_0x21f6('0x81')));}if(_0x6359a4[_0x21f6('0x7c')]===_0x21f6('0x82')){if(_0x21f6('0x21')==typeof _0x6359a4['parameters'][_0x21f6('0x83')]){return _0x4bc921(new Error(_0x21f6('0x84')));}if(_0x21f6('0x21')==typeof _0x6359a4[_0x21f6('0x80')][_0x21f6('0x83')]['admin']&&_0x21f6('0x21')==typeof _0x6359a4['parameters'][_0x21f6('0x83')][_0x21f6('0x85')]){return _0x4bc921(new Error(_0x21f6('0x86')));}}else if(_0x6359a4[_0x21f6('0x7c')]===_0x21f6('0x87')){if(_0x21f6('0x21')==typeof _0x6359a4[_0x21f6('0x80')][_0x21f6('0x88')]){return _0x4bc921(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x21f6('0x21')==typeof _0x6359a4[_0x21f6('0x80')][_0x21f6('0x89')]){return _0x4bc921(new Error(_0x21f6('0x8a')));}}else{return _0x4bc921(new Error(_0x21f6('0x8b')));}var _0x415743=_0x6359a4['name'];var _0x197635=_0x6359a4['description'];var _0x23435a=_0x6359a4[_0x21f6('0x7c')];var _0x15a65d=_0x6359a4[_0x21f6('0x8c')]?_0x6359a4[_0x21f6('0x8c')]:_0x21f6('0x8d');var _0x4a257b=_0x6359a4[_0x21f6('0x8e')]?_0x6359a4['icon']:_0x21f6('0x8f');var _0x508fab='';var _0x16fd36='';var _0x4853f8='';var _0x6d839b='';var _0x1f6f48=_0x6359a4['version'];if(_0x23435a==='html'){if(_0x21f6('0x21')!=typeof _0x6359a4[_0x21f6('0x80')][_0x21f6('0x83')][_0x21f6('0x90')]){var _0x18ec69=_0x6359a4['parameters'][_0x21f6('0x83')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x21f6('0x91')](_0x18ec69)){_0x508fab=path[_0x21f6('0x53')]('plugins',_0x5ba801,_0x55e26b[0x0],_0x18ec69);}else{_0x508fab=_0x18ec69;}}else{logger[_0x21f6('0x6a')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x21f6('0x21')!=typeof _0x6359a4['parameters'][_0x21f6('0x83')][_0x21f6('0x85')]){var _0x338f1a=_0x6359a4[_0x21f6('0x80')][_0x21f6('0x83')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x338f1a)){_0x16fd36=path['join'](_0x21f6('0x92'),_0x5ba801,_0x55e26b[0x0],_0x338f1a);}else{_0x16fd36=_0x338f1a;}}else{logger['info'](_0x21f6('0x93'));}}else if(_0x23435a==='script'){_0x4853f8=_0x6359a4[_0x21f6('0x80')]['scriptName'];_0x6d839b=_0x6359a4[_0x21f6('0x80')]['scriptPath'];if(_0x21f6('0x21')!=typeof _0x6359a4['parameters'][_0x21f6('0x83')]){if(_0x21f6('0x21')!=typeof _0x6359a4[_0x21f6('0x80')][_0x21f6('0x83')][_0x21f6('0x90')]){var _0x18ec69=_0x6359a4[_0x21f6('0x80')][_0x21f6('0x83')][_0x21f6('0x90')];if(!/^(f|ht)tps?:\/\//i[_0x21f6('0x91')](_0x18ec69)){_0x508fab=path[_0x21f6('0x53')](_0x21f6('0x92'),_0x5ba801,_0x55e26b[0x0],_0x18ec69);}else{_0x508fab=_0x18ec69;}}if(_0x21f6('0x21')!=typeof _0x6359a4['parameters'][_0x21f6('0x83')][_0x21f6('0x85')]){var _0x338f1a=_0x6359a4[_0x21f6('0x80')][_0x21f6('0x83')][_0x21f6('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x338f1a)){_0x16fd36=path[_0x21f6('0x53')](_0x21f6('0x92'),_0x5ba801,_0x55e26b[0x0],_0x338f1a);}else{_0x16fd36=_0x338f1a;}}}}var _0xd02b29={'name':_0x415743,'description':_0x197635,'path':path[_0x21f6('0x53')](_0x5ba801,_0x55e26b[0x0]),'type':_0x23435a,'sidebar':_0x15a65d,'icon':_0x4a257b,'adminUrl':_0x508fab,'agentUrl':_0x16fd36,'scriptName':_0x4853f8,'scriptPath':_0x6d839b,'version':_0x1f6f48};removeReferences(_0x26157e,null);return db[_0x21f6('0x36')]['create'](_0xd02b29)['then'](function(_0x4dba62){var _0xbcbcf1={'role':_0x1b39eb[_0x21f6('0x94')]['role'],'userProfileId':_0x1b39eb[_0x21f6('0x94')][_0x21f6('0x95')]};if(!_0xbcbcf1)throw new Error(_0x21f6('0x96'));if(_0xbcbcf1[_0x21f6('0x97')]===_0x21f6('0x98')){var _0x467d87=_0x4dba62['get']({'plain':!![]});return db[_0x21f6('0x99')]['find']({'where':{'name':_0x21f6('0x2e'),'userProfileId':_0xbcbcf1[_0x21f6('0x95')]},'raw':!![]})[_0x21f6('0x2b')](function(_0x436e22){if(_0x436e22&&_0x436e22['autoAssociation']===0x0){return db['UserProfileResource'][_0x21f6('0x9a')]({'name':_0x467d87[_0x21f6('0x32')],'resourceId':_0x467d87['id'],'type':_0x436e22[_0x21f6('0x32')],'sectionId':_0x436e22['id']},{})['then'](function(){return _0x4dba62;});}else{return _0x4dba62;}})[_0x21f6('0x4d')](function(_0x1ec941){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ec941);throw _0x1ec941;});}return _0x4dba62;})[_0x21f6('0x2b')](respondWithResult(_0x8b79,null))[_0x21f6('0x4d')](handleError(_0x8b79,null));}});}catch(_0xba3b8e){_0x8b79[_0x21f6('0x1e')](0x1f4)[_0x21f6('0x33')](_0xba3b8e);}};function removeReferences(_0x5c9670,_0x5f1506){try{if(_0x5c9670){fs['unlinkSync'](_0x5c9670);logger[_0x21f6('0x6a')](_0x21f6('0x9b'));}if(_0x5f1506){rimraf(_0x5f1506,function(){});logger['info'](_0x21f6('0x9c'));}}catch(_0x310a13){logger[_0x21f6('0x30')](_0x310a13);}}exports[_0x21f6('0x2a')]=function(_0x2908cd,_0x984e4a,_0x3d95a3){return db['Plugin'][_0x21f6('0x50')]({'where':{'id':_0x2908cd['params']['id']}})['then'](handleEntityNotFound(_0x984e4a,null))[_0x21f6('0x2b')](saveUpdates(_0x2908cd[_0x21f6('0x94')],null))[_0x21f6('0x2b')](respondWithResult(_0x984e4a,null))[_0x21f6('0x4d')](handleError(_0x984e4a,null));};exports[_0x21f6('0x9d')]=function(_0x3069cb,_0x38bf1d,_0x4b8a1f){return db[_0x21f6('0x36')][_0x21f6('0x50')]({'where':{'id':_0x3069cb['params']['id']}})['then'](function(_0x445d20){if(_0x445d20){return _0x445d20[_0x21f6('0x2c')]();}})[_0x21f6('0x2b')](function(_0x46aee4){rimraf(path[_0x21f6('0x53')](config[_0x21f6('0x54')],_0x21f6('0x55'),path[_0x21f6('0x62')](_0x46aee4[_0x21f6('0x52')])),function(){});return _0x46aee4;})[_0x21f6('0x2b')](handleEntityNotFound(_0x38bf1d,null))[_0x21f6('0x2b')](respondWithStatusCode(_0x38bf1d,null))[_0x21f6('0x4d')](handleError(_0x38bf1d,null));};exports[_0x21f6('0x9e')]=function(_0x4e8eb2,_0x7dd11d,_0x1af964){return BPromise[_0x21f6('0x9f')]()[_0x21f6('0x2b')](function(){if(!_0x4e8eb2[_0x21f6('0x3a')][_0x21f6('0x52')]){throw new Error(_0x21f6('0xa0'));}if(!_0x4e8eb2[_0x21f6('0x3a')][_0x21f6('0xa1')]){throw new Error(_0x21f6('0xa2'));}var _0x25bfc4=_0x4e8eb2['query'][_0x21f6('0xa3')]?_0x4e8eb2[_0x21f6('0x3a')][_0x21f6('0xa3')]+':'+_0x4e8eb2['query'][_0x21f6('0xa1')]:'http://localhost:'+_0x4e8eb2['query'][_0x21f6('0xa1')];var _0x3b7963=_0x4e8eb2['query']['json']?_0x4e8eb2[_0x21f6('0x3a')][_0x21f6('0x26')]:!![];var _0x4ada88=_0x4e8eb2[_0x21f6('0x3a')][_0x21f6('0xa4')]?_0x4e8eb2[_0x21f6('0x3a')][_0x21f6('0xa4')]:null;var _0x3a5226={'method':_0x4e8eb2[_0x21f6('0xa5')],'uri':util[_0x21f6('0x56')]('%s%s',_0x25bfc4,_0x4e8eb2[_0x21f6('0x3a')][_0x21f6('0x52')]),'json':_0x3b7963,'resolveWithFullResponse':!![],'encoding':_0x4ada88,'qs':_0x4e8eb2[_0x21f6('0x3a')]};if(_0x4e8eb2[_0x21f6('0xa6')]){_0x3a5226[_0x21f6('0xa6')]=_0x4e8eb2[_0x21f6('0xa6')];if(_0x3a5226[_0x21f6('0xa6')][_0x21f6('0xa7')]){delete _0x3a5226[_0x21f6('0xa6')][_0x21f6('0xa7')];}}if(_0x3a5226['headers'][_0x21f6('0xa8')]){delete _0x3a5226[_0x21f6('0xa6')][_0x21f6('0xa8')];}return rp(_0x3a5226);})[_0x21f6('0x2b')](function(_0x2d1161){if(_0x2d1161){_0x7dd11d['set'](_0x2d1161[_0x21f6('0xa6')]);logger[_0x21f6('0x6a')](_0x2d1161[_0x21f6('0x94')]);if(_['endsWith'](_0x4e8eb2[_0x21f6('0x3a')]['path'],_0x21f6('0x51'))&&_0x2d1161[_0x21f6('0xa9')]==0x1f4){return _0x7dd11d[_0x21f6('0x1d')](_0x2d1161['statusCode']);}else{return _0x7dd11d[_0x21f6('0x1e')](_0x2d1161['statusCode'])[_0x21f6('0x33')](_0x2d1161['body']);}}else{return _0x7dd11d[_0x21f6('0x1d')](0xc8);}})[_0x21f6('0x4d')](handleError(_0x7dd11d,null));};exports['webhookPost']=function(_0xb97a01,_0x18626e,_0xde84b7){return BPromise[_0x21f6('0x9f')]()[_0x21f6('0x2b')](function(){if(!_0xb97a01['query']['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xb97a01['query'][_0x21f6('0xa1')]){throw new Error(_0x21f6('0xa2'));}var _0x563b07=_0xb97a01[_0x21f6('0x3a')][_0x21f6('0xa3')]?_0xb97a01[_0x21f6('0x3a')][_0x21f6('0xa3')]+':'+_0xb97a01[_0x21f6('0x3a')][_0x21f6('0xa1')]:_0x21f6('0xaa')+_0xb97a01['query']['port'];var _0x21b2de=_0xb97a01[_0x21f6('0x3a')][_0x21f6('0x26')]?_0xb97a01[_0x21f6('0x3a')][_0x21f6('0x26')]:!![];var _0x628821=_0xb97a01[_0x21f6('0x3a')][_0x21f6('0xa4')]?_0xb97a01['query'][_0x21f6('0xa4')]:null;var _0x3980fc={'method':_0xb97a01[_0x21f6('0xa5')],'uri':util[_0x21f6('0x56')](_0x21f6('0xab'),_0x563b07,_0xb97a01[_0x21f6('0x3a')][_0x21f6('0x52')]),'json':_0x21b2de,'resolveWithFullResponse':!![],'encoding':_0x628821,'body':_0xb97a01[_0x21f6('0x94')]};if(_0xb97a01[_0x21f6('0xa6')]){_0x3980fc[_0x21f6('0xa6')]=_0xb97a01[_0x21f6('0xa6')];if(_0x3980fc[_0x21f6('0xa6')]['content-length']){delete _0x3980fc[_0x21f6('0xa6')][_0x21f6('0xa7')];}}if(_0x3980fc[_0x21f6('0xa6')][_0x21f6('0xa8')]){delete _0x3980fc['headers'][_0x21f6('0xa8')];}return rp(_0x3980fc);})[_0x21f6('0x2b')](function(_0x345ba8){if(_0x345ba8){_0x18626e['set'](_0x345ba8[_0x21f6('0xa6')]);logger['info'](_0x345ba8[_0x21f6('0x94')]);return _0x18626e[_0x21f6('0x1e')](_0x345ba8[_0x21f6('0xa9')])[_0x21f6('0x33')](_0x345ba8[_0x21f6('0x94')]);}else{return _0x18626e[_0x21f6('0x1d')](0xc8);}})[_0x21f6('0x4d')](handleError(_0x18626e,null));}; \ No newline at end of file +var _0x6ac4=['get','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','extract-zip','archiver','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','./plugin.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','Plugins','UserProfileResource','end','error','stack','name','send','index','Plugin','fieldName','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','download','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','join','dirname','attachments/**/*','finalize','close','Plugin\x20not\x20found','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','type','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','admin','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptName','test','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x43d7af,_0x33a464){var _0x1f0460=function(_0x293aa5){while(--_0x293aa5){_0x43d7af['push'](_0x43d7af['shift']());}};_0x1f0460(++_0x33a464);}(_0x6ac4,0xca));var _0x46ac=function(_0x1488ab,_0x2b69ac){_0x1488ab=_0x1488ab-0x0;var _0x42f3c5=_0x6ac4[_0x1488ab];return _0x42f3c5;};'use strict';var emlformat=require(_0x46ac('0x0'));var rimraf=require(_0x46ac('0x1'));var zipdir=require(_0x46ac('0x2'));var jsonpatch=require(_0x46ac('0x3'));var rp=require(_0x46ac('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x46ac('0x5'));var util=require(_0x46ac('0x6'));var path=require(_0x46ac('0x7'));var sox=require(_0x46ac('0x8'));var csv=require(_0x46ac('0x9'));var ejs=require(_0x46ac('0xa'));var fs=require('fs');var fs_extra=require(_0x46ac('0xb'));var _=require(_0x46ac('0xc'));var squel=require(_0x46ac('0xd'));var crypto=require(_0x46ac('0xe'));var jsforce=require(_0x46ac('0xf'));var deskjs=require(_0x46ac('0x10'));var toCsv=require(_0x46ac('0x9'));var querystring=require('querystring');var Papa=require(_0x46ac('0x11'));var extract=require(_0x46ac('0x12'));var rimraf=require(_0x46ac('0x1'));var archiver=require(_0x46ac('0x13'));var Redis=require(_0x46ac('0x14'));var authService=require(_0x46ac('0x15'));var qs=require(_0x46ac('0x16'));var as=require(_0x46ac('0x17'));var hardwareService=require(_0x46ac('0x18'));var logger=require(_0x46ac('0x19'))(_0x46ac('0x1a'));var utils=require(_0x46ac('0x1b'));var config=require(_0x46ac('0x1c'));var licenseUtil=require(_0x46ac('0x1d'));var db=require(_0x46ac('0x1e'))['db'];config[_0x46ac('0x1f')]=_['defaults'](config[_0x46ac('0x1f')],{'host':_0x46ac('0x20'),'port':0x18eb});var socket=require(_0x46ac('0x21'))(new Redis(config[_0x46ac('0x1f')]));require(_0x46ac('0x22'))[_0x46ac('0x23')](socket);function respondWithStatusCode(_0x55a382,_0x4c477e){_0x4c477e=_0x4c477e||0xcc;return function(_0x3dff95){if(_0x3dff95){return _0x55a382[_0x46ac('0x24')](_0x4c477e);}return _0x55a382['status'](_0x4c477e)['end']();};}function respondWithResult(_0x49449a,_0x5f1e68){_0x5f1e68=_0x5f1e68||0xc8;return function(_0x51e5d5){if(_0x51e5d5){return _0x49449a[_0x46ac('0x25')](_0x5f1e68)[_0x46ac('0x26')](_0x51e5d5);}};}function respondWithFilteredResult(_0xf67259,_0x37c66c){return function(_0x3b1a4c){if(_0x3b1a4c){var _0x504ab4=typeof _0x37c66c[_0x46ac('0x27')]===_0x46ac('0x28')&&typeof _0x37c66c[_0x46ac('0x29')]===_0x46ac('0x28');var _0x20492e=_0x3b1a4c[_0x46ac('0x2a')];var _0x53669e=_0x504ab4?0x0:_0x37c66c[_0x46ac('0x27')];var _0x4ec4ed=_0x504ab4?_0x3b1a4c['count']:_0x37c66c['offset']+_0x37c66c[_0x46ac('0x29')];var _0x3dd084;if(_0x4ec4ed>=_0x20492e){_0x4ec4ed=_0x20492e;_0x3dd084=0xc8;}else{_0x3dd084=0xce;}_0xf67259['status'](_0x3dd084);return _0xf67259['set'](_0x46ac('0x2b'),_0x53669e+'-'+_0x4ec4ed+'/'+_0x20492e)[_0x46ac('0x26')](_0x3b1a4c);}return null;};}function patchUpdates(_0x592390){return function(_0x4e1545){try{jsonpatch[_0x46ac('0x2c')](_0x4e1545,_0x592390,!![]);}catch(_0x675af2){return BPromise['reject'](_0x675af2);}return _0x4e1545[_0x46ac('0x2d')]();};}function saveUpdates(_0x45de8e,_0xae771f){return function(_0x40f2cd){if(_0x40f2cd){return _0x40f2cd[_0x46ac('0x2e')](_0x45de8e)[_0x46ac('0x2f')](function(_0x3cbc81){return _0x3cbc81;});}return null;};}function removeEntity(_0x385392,_0x4733dc){return function(_0x308265){if(_0x308265){return _0x308265[_0x46ac('0x30')]()['then'](function(){var _0x3744cc=_0x308265['get']({'plain':!![]});var _0x24013e=_0x46ac('0x31');return db[_0x46ac('0x32')]['destroy']({'where':{'type':_0x24013e,'resourceId':_0x3744cc['id']}})[_0x46ac('0x2f')](function(){return _0x308265;});})[_0x46ac('0x2f')](function(){_0x385392[_0x46ac('0x25')](0xcc)[_0x46ac('0x33')]();});}};}function handleEntityNotFound(_0x461929,_0x256638){return function(_0x35c11f){if(!_0x35c11f){_0x461929[_0x46ac('0x24')](0x194);}return _0x35c11f;};}function handleError(_0x472533,_0x51f8cd){_0x51f8cd=_0x51f8cd||0x1f4;return function(_0x310f4c){logger[_0x46ac('0x34')](_0x310f4c[_0x46ac('0x35')]);if(_0x310f4c['name']){delete _0x310f4c[_0x46ac('0x36')];}_0x472533[_0x46ac('0x25')](_0x51f8cd)[_0x46ac('0x37')](_0x310f4c);};}exports[_0x46ac('0x38')]=function(_0x383bf8,_0x4f1d5a){var _0x48a3dc={},_0x3f9377={},_0x468241={'count':0x0,'rows':[]};var _0x461a32=_['map'](db[_0x46ac('0x39')]['rawAttributes'],function(_0x59aee7){return{'name':_0x59aee7[_0x46ac('0x3a')],'type':_0x59aee7['type'][_0x46ac('0x3b')]};});_0x3f9377[_0x46ac('0x3c')]=_[_0x46ac('0x3d')](_0x461a32,_0x46ac('0x36'));_0x3f9377['query']=_[_0x46ac('0x3e')](_0x383bf8[_0x46ac('0x3f')]);_0x3f9377[_0x46ac('0x40')]=_['intersection'](_0x3f9377[_0x46ac('0x3c')],_0x3f9377['query']);_0x48a3dc[_0x46ac('0x41')]=_[_0x46ac('0x42')](_0x3f9377[_0x46ac('0x3c')],qs[_0x46ac('0x43')](_0x383bf8[_0x46ac('0x3f')][_0x46ac('0x43')]));_0x48a3dc[_0x46ac('0x41')]=_0x48a3dc['attributes'][_0x46ac('0x44')]?_0x48a3dc[_0x46ac('0x41')]:_0x3f9377[_0x46ac('0x3c')];if(!_0x383bf8[_0x46ac('0x3f')][_0x46ac('0x45')](_0x46ac('0x46'))){_0x48a3dc[_0x46ac('0x29')]=qs['limit'](_0x383bf8[_0x46ac('0x3f')][_0x46ac('0x29')]);_0x48a3dc[_0x46ac('0x27')]=qs[_0x46ac('0x27')](_0x383bf8[_0x46ac('0x3f')][_0x46ac('0x27')]);}_0x48a3dc[_0x46ac('0x47')]=qs[_0x46ac('0x48')](_0x383bf8['query']['sort']);_0x48a3dc[_0x46ac('0x49')]=qs['filters'](_[_0x46ac('0x4a')](_0x383bf8['query'],_0x3f9377[_0x46ac('0x40')]),_0x461a32);if(_0x383bf8[_0x46ac('0x3f')][_0x46ac('0x4b')]){_0x48a3dc[_0x46ac('0x49')]=_[_0x46ac('0x4c')](_0x48a3dc[_0x46ac('0x49')],{'$or':_[_0x46ac('0x3d')](_0x461a32,function(_0x12a73d){if(_0x12a73d['type']!=='VIRTUAL'){var _0xdd64c5={};_0xdd64c5[_0x12a73d[_0x46ac('0x36')]]={'$like':'%'+_0x383bf8[_0x46ac('0x3f')][_0x46ac('0x4b')]+'%'};return _0xdd64c5;}})});}_0x48a3dc=_[_0x46ac('0x4c')]({},_0x48a3dc,_0x383bf8['options']);var _0x4447a6={'where':_0x48a3dc[_0x46ac('0x49')]};return db[_0x46ac('0x39')][_0x46ac('0x2a')](_0x4447a6)[_0x46ac('0x2f')](function(_0x437da7){_0x468241[_0x46ac('0x2a')]=_0x437da7;if(_0x383bf8[_0x46ac('0x3f')][_0x46ac('0x4d')]){_0x48a3dc[_0x46ac('0x4e')]=[{'all':!![]}];}return db['Plugin'][_0x46ac('0x4f')](_0x48a3dc);})[_0x46ac('0x2f')](function(_0x4e4e3a){_0x468241[_0x46ac('0x50')]=_0x4e4e3a;return _0x468241;})[_0x46ac('0x2f')](respondWithFilteredResult(_0x4f1d5a,_0x48a3dc))[_0x46ac('0x51')](handleError(_0x4f1d5a,null));};exports[_0x46ac('0x52')]=function(_0x11c780,_0xfd5f9c){var _0x1cbc2e={'raw':!![],'where':{'id':_0x11c780[_0x46ac('0x53')]['id']}},_0x4e54ff={};_0x4e54ff['model']=_[_0x46ac('0x3e')](db['Plugin'][_0x46ac('0x54')]);_0x4e54ff[_0x46ac('0x3f')]=_[_0x46ac('0x3e')](_0x11c780[_0x46ac('0x3f')]);_0x4e54ff[_0x46ac('0x40')]=_[_0x46ac('0x42')](_0x4e54ff[_0x46ac('0x3c')],_0x4e54ff[_0x46ac('0x3f')]);_0x1cbc2e[_0x46ac('0x41')]=_[_0x46ac('0x42')](_0x4e54ff['model'],qs[_0x46ac('0x43')](_0x11c780[_0x46ac('0x3f')]['fields']));_0x1cbc2e[_0x46ac('0x41')]=_0x1cbc2e[_0x46ac('0x41')][_0x46ac('0x44')]?_0x1cbc2e[_0x46ac('0x41')]:_0x4e54ff[_0x46ac('0x3c')];if(_0x11c780[_0x46ac('0x3f')][_0x46ac('0x4d')]){_0x1cbc2e[_0x46ac('0x4e')]=[{'all':!![]}];}_0x1cbc2e=_[_0x46ac('0x4c')]({},_0x1cbc2e,_0x11c780['options']);return db['Plugin']['find'](_0x1cbc2e)[_0x46ac('0x2f')](handleEntityNotFound(_0xfd5f9c,null))[_0x46ac('0x2f')](respondWithResult(_0xfd5f9c,null))[_0x46ac('0x51')](handleError(_0xfd5f9c,null));};exports[_0x46ac('0x55')]=function(_0x17580a,_0x47796c,_0x845a1d){return db[_0x46ac('0x39')]['find']({'where':{'id':_0x17580a[_0x46ac('0x53')]['id']},'attributes':['name',_0x46ac('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x47796c,null))[_0x46ac('0x2f')](function(_0x2e5715){if(_0x2e5715){var _0x4cf614=path['join'](config[_0x46ac('0x56')],_0x46ac('0x57'),util[_0x46ac('0x58')](_0x46ac('0x59'),path[_0x46ac('0x5a')](_0x2e5715[_0x46ac('0x7')])));var _0x479606=fs[_0x46ac('0x5b')](_0x4cf614);var _0x5bbdc1=archiver(_0x46ac('0x5c'),{'zlib':{'level':0x9}});_0x5bbdc1['on']('warning',function(_0x2bec09){if(_0x2bec09[_0x46ac('0x5d')]==='ENOENT'){logger[_0x46ac('0x34')](_0x2bec09);}else{throw new db[(_0x46ac('0x5e'))][(_0x46ac('0x5f'))](_0x46ac('0x60'));}});_0x5bbdc1['on'](_0x46ac('0x34'),function(_0x2c7cb3){throw new db[(_0x46ac('0x5e'))][(_0x46ac('0x5f'))](_0x46ac('0x60'));});_0x5bbdc1[_0x46ac('0x61')](_0x479606);_0x5bbdc1['glob'](_0x46ac('0x62'),{'cwd':path[_0x46ac('0x63')](config[_0x46ac('0x56')],_0x46ac('0x57'),path[_0x46ac('0x64')](_0x2e5715[_0x46ac('0x7')])),'ignore':[path[_0x46ac('0x63')](path[_0x46ac('0x5a')](_0x2e5715[_0x46ac('0x7')]),'node_modules/**/*'),path[_0x46ac('0x63')](path['basename'](_0x2e5715[_0x46ac('0x7')]),_0x46ac('0x65'))],'nodir':!![]})[_0x46ac('0x66')]();_0x479606['on'](_0x46ac('0x67'),function(){if(!fs['existsSync'](_0x4cf614)){throw new db[(_0x46ac('0x5e'))]['Error'](_0x46ac('0x68'));}return _0x47796c[_0x46ac('0x55')](_0x4cf614,util['format'](_0x46ac('0x59'),path[_0x46ac('0x5a')](_0x2e5715[_0x46ac('0x7')])),function(_0x506f23){if(_0x506f23){throw new db[(_0x46ac('0x5e'))][(_0x46ac('0x5f'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x46ac('0x69')](_0x4cf614);logger[_0x46ac('0x6a')]('Download\x20completed');logger[_0x46ac('0x6a')](_0x46ac('0x6b'));});});}return null;})[_0x46ac('0x51')](handleError(_0x47796c,null));};exports[_0x46ac('0x6c')]=function(_0x5ab9fb,_0x45f630,_0x15257c){var _0x1757ad=path['basename'](_0x5ab9fb[_0x46ac('0x6d')][_0x46ac('0x6e')],path[_0x46ac('0x6f')](_0x5ab9fb[_0x46ac('0x6d')]['filename']));var _0x49d3e3=path[_0x46ac('0x63')](config[_0x46ac('0x56')],_0x46ac('0x57'),_0x5ab9fb[_0x46ac('0x6d')]['filename']);var _0x557c0e=path[_0x46ac('0x63')](config[_0x46ac('0x56')],_0x46ac('0x57'),_0x1757ad);logger[_0x46ac('0x6a')](_0x46ac('0x70'),_0x49d3e3);logger[_0x46ac('0x6a')](_0x46ac('0x71'),_0x557c0e);try{fs[_0x46ac('0x72')](_0x49d3e3,parseInt(_0x46ac('0x73'),0x8));extract(_0x49d3e3,{'dir':_0x557c0e},function(_0x4500a0){if(_0x4500a0){logger[_0x46ac('0x34')](_0x4500a0);handleError(_0x4500a0,!![]);};var _0x4038dd=fs['readdirSync'](_0x557c0e);if(_0x4038dd[_0x46ac('0x44')]>0x1){removeReferences(_0x49d3e3,_0x557c0e);logger[_0x46ac('0x34')](_0x46ac('0x74'));return _0x15257c(new Error(_0x46ac('0x74')));}var _0x3b79f7=fs[_0x46ac('0x75')](path[_0x46ac('0x63')](_0x557c0e,_0x4038dd[0x0]));if(_0x3b79f7[_0x46ac('0x76')]()){removeReferences(_0x49d3e3,_0x557c0e);logger['error'](_0x46ac('0x74'));return _0x15257c(new Error(_0x46ac('0x74')));}if(_0x3b79f7[_0x46ac('0x77')]()){var _0x207248=fs['readdirSync'](path[_0x46ac('0x63')](_0x557c0e,_0x4038dd[0x0]));if(_0x207248[_0x46ac('0x44')]===0x0){removeReferences(_0x49d3e3,_0x557c0e);logger[_0x46ac('0x34')](_0x46ac('0x74'));return _0x15257c(new Error('Invalid\x20plugin\x20structure'));}var _0x334022=_0x207248['some'](function(_0x2d61cc){return _0x2d61cc==='manifest.json';});if(!_0x334022){return _0x15257c(new Error(_0x46ac('0x78')));}var _0x53d57e=fs[_0x46ac('0x79')](path[_0x46ac('0x63')](_0x557c0e,_0x4038dd[0x0],_0x46ac('0x7a')));var _0x5d0923=JSON[_0x46ac('0x7b')](_0x53d57e);if('undefined'==typeof _0x5d0923['name']){return _0x15257c(new Error(_0x46ac('0x7c')));}if(_0x46ac('0x28')==typeof _0x5d0923[_0x46ac('0x7d')]){return _0x15257c(new Error(_0x46ac('0x7e')));}if(_0x46ac('0x28')==typeof _0x5d0923['version']){return _0x15257c(new Error(_0x46ac('0x7f')));}if('undefined'==typeof _0x5d0923[_0x46ac('0x80')]){return _0x15257c(new Error(_0x46ac('0x81')));}if(_0x5d0923[_0x46ac('0x7d')]===_0x46ac('0x82')){if('undefined'==typeof _0x5d0923[_0x46ac('0x80')][_0x46ac('0x83')]){return _0x15257c(new Error(_0x46ac('0x84')));}if(_0x46ac('0x28')==typeof _0x5d0923[_0x46ac('0x80')]['views']['admin']&&_0x46ac('0x28')==typeof _0x5d0923['parameters'][_0x46ac('0x83')][_0x46ac('0x85')]){return _0x15257c(new Error(_0x46ac('0x86')));}}else if(_0x5d0923[_0x46ac('0x7d')]===_0x46ac('0x87')){if(_0x46ac('0x28')==typeof _0x5d0923[_0x46ac('0x80')]['scriptName']){return _0x15257c(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x5d0923[_0x46ac('0x80')][_0x46ac('0x88')]){return _0x15257c(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x15257c(new Error(_0x46ac('0x89')));}var _0x3ebe06=_0x5d0923['name'];var _0x45b9bd=_0x5d0923[_0x46ac('0x8a')];var _0x363790=_0x5d0923[_0x46ac('0x7d')];var _0x1a8093=_0x5d0923[_0x46ac('0x8b')]?_0x5d0923['sidebar']:_0x46ac('0x8c');var _0xb8a0e1=_0x5d0923[_0x46ac('0x8d')]?_0x5d0923[_0x46ac('0x8d')]:_0x46ac('0x8e');var _0x1e3227='';var _0x7a6437='';var _0x2e6a7a='';var _0x1ec842='';var _0x36c4c8=_0x5d0923[_0x46ac('0x8f')];if(_0x363790===_0x46ac('0x82')){if('undefined'!=typeof _0x5d0923[_0x46ac('0x80')][_0x46ac('0x83')][_0x46ac('0x90')]){var _0x3732f4=_0x5d0923['parameters'][_0x46ac('0x83')][_0x46ac('0x90')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3732f4)){_0x1e3227=path[_0x46ac('0x63')](_0x46ac('0x91'),_0x1757ad,_0x4038dd[0x0],_0x3732f4);}else{_0x1e3227=_0x3732f4;}}else{logger['info'](_0x46ac('0x92'));}if('undefined'!=typeof _0x5d0923['parameters'][_0x46ac('0x83')]['agent']){var _0x2e2609=_0x5d0923[_0x46ac('0x80')][_0x46ac('0x83')][_0x46ac('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2e2609)){_0x7a6437=path[_0x46ac('0x63')](_0x46ac('0x91'),_0x1757ad,_0x4038dd[0x0],_0x2e2609);}else{_0x7a6437=_0x2e2609;}}else{logger[_0x46ac('0x6a')](_0x46ac('0x93'));}}else if(_0x363790===_0x46ac('0x87')){_0x2e6a7a=_0x5d0923[_0x46ac('0x80')][_0x46ac('0x94')];_0x1ec842=_0x5d0923['parameters']['scriptPath'];if(_0x46ac('0x28')!=typeof _0x5d0923[_0x46ac('0x80')]['views']){if(_0x46ac('0x28')!=typeof _0x5d0923[_0x46ac('0x80')][_0x46ac('0x83')][_0x46ac('0x90')]){var _0x3732f4=_0x5d0923[_0x46ac('0x80')][_0x46ac('0x83')][_0x46ac('0x90')];if(!/^(f|ht)tps?:\/\//i[_0x46ac('0x95')](_0x3732f4)){_0x1e3227=path['join']('plugins',_0x1757ad,_0x4038dd[0x0],_0x3732f4);}else{_0x1e3227=_0x3732f4;}}if('undefined'!=typeof _0x5d0923[_0x46ac('0x80')]['views'][_0x46ac('0x85')]){var _0x2e2609=_0x5d0923[_0x46ac('0x80')][_0x46ac('0x83')][_0x46ac('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2e2609)){_0x7a6437=path['join'](_0x46ac('0x91'),_0x1757ad,_0x4038dd[0x0],_0x2e2609);}else{_0x7a6437=_0x2e2609;}}}}var _0x4409c9={'name':_0x3ebe06,'description':_0x45b9bd,'path':path['join'](_0x1757ad,_0x4038dd[0x0]),'type':_0x363790,'sidebar':_0x1a8093,'icon':_0xb8a0e1,'adminUrl':_0x1e3227,'agentUrl':_0x7a6437,'scriptName':_0x2e6a7a,'scriptPath':_0x1ec842,'version':_0x36c4c8};removeReferences(_0x49d3e3,null);return db[_0x46ac('0x39')][_0x46ac('0x96')](_0x4409c9)[_0x46ac('0x2f')](function(_0x393b1b){var _0x1712c4={'role':_0x5ab9fb[_0x46ac('0x97')]['role'],'userProfileId':_0x5ab9fb[_0x46ac('0x97')]['userProfileId']};if(!_0x1712c4)throw new Error(_0x46ac('0x98'));if(_0x1712c4[_0x46ac('0x99')]==='user'){var _0x13df7f=_0x393b1b[_0x46ac('0x9a')]({'plain':!![]});return db['UserProfileSection'][_0x46ac('0x9b')]({'where':{'name':'Plugins','userProfileId':_0x1712c4[_0x46ac('0x9c')]},'raw':!![]})[_0x46ac('0x2f')](function(_0x560409){if(_0x560409&&_0x560409[_0x46ac('0x9d')]===0x0){return db[_0x46ac('0x32')][_0x46ac('0x96')]({'name':_0x13df7f['name'],'resourceId':_0x13df7f['id'],'type':_0x560409['name'],'sectionId':_0x560409['id']},{})[_0x46ac('0x2f')](function(){return _0x393b1b;});}else{return _0x393b1b;}})['catch'](function(_0x23cc07){logger['error'](_0x46ac('0x9e'),_0x23cc07);throw _0x23cc07;});}return _0x393b1b;})[_0x46ac('0x2f')](respondWithResult(_0x45f630,null))[_0x46ac('0x51')](handleError(_0x45f630,null));}});}catch(_0x4a3a2f){_0x45f630[_0x46ac('0x25')](0x1f4)['send'](_0x4a3a2f);}};function removeReferences(_0x5eb12c,_0x5d2d29){try{if(_0x5eb12c){fs[_0x46ac('0x69')](_0x5eb12c);logger['info']('Zip\x20archive\x20removed');}if(_0x5d2d29){rimraf(_0x5d2d29,function(){});logger[_0x46ac('0x6a')](_0x46ac('0x9f'));}}catch(_0x598a0b){logger['error'](_0x598a0b);}}exports['update']=function(_0x2833a2,_0x2e3c22,_0x570fc8){return db[_0x46ac('0x39')]['find']({'where':{'id':_0x2833a2[_0x46ac('0x53')]['id']}})[_0x46ac('0x2f')](handleEntityNotFound(_0x2e3c22,null))[_0x46ac('0x2f')](saveUpdates(_0x2833a2[_0x46ac('0x97')],null))['then'](respondWithResult(_0x2e3c22,null))[_0x46ac('0x51')](handleError(_0x2e3c22,null));};exports[_0x46ac('0xa0')]=function(_0x5890de,_0xbc1379,_0x5950f1){return db['Plugin']['find']({'where':{'id':_0x5890de['params']['id']}})['then'](function(_0x56e230){if(_0x56e230){return _0x56e230[_0x46ac('0x30')]();}})[_0x46ac('0x2f')](function(_0x40825c){rimraf(path['join'](config[_0x46ac('0x56')],_0x46ac('0x57'),path[_0x46ac('0x64')](_0x40825c[_0x46ac('0x7')])),function(){});return _0x40825c;})[_0x46ac('0x2f')](handleEntityNotFound(_0xbc1379,null))[_0x46ac('0x2f')](respondWithStatusCode(_0xbc1379,null))[_0x46ac('0x51')](handleError(_0xbc1379,null));};exports[_0x46ac('0xa1')]=function(_0x5cd7ab,_0x155d93,_0x3f853b){return BPromise[_0x46ac('0xa2')]()[_0x46ac('0x2f')](function(){if(!_0x5cd7ab[_0x46ac('0x3f')][_0x46ac('0x7')]){throw new Error(_0x46ac('0xa3'));}if(!_0x5cd7ab[_0x46ac('0x3f')][_0x46ac('0xa4')]){throw new Error(_0x46ac('0xa5'));}var _0xd35d20=_0x5cd7ab[_0x46ac('0x3f')][_0x46ac('0xa6')]?_0x5cd7ab['query'][_0x46ac('0xa6')]+':'+_0x5cd7ab['query']['port']:_0x46ac('0xa7')+_0x5cd7ab[_0x46ac('0x3f')]['port'];var _0x4373d3=_0x5cd7ab[_0x46ac('0x3f')]['json']?_0x5cd7ab[_0x46ac('0x3f')][_0x46ac('0x26')]:!![];var _0x3fceab=_0x5cd7ab['query'][_0x46ac('0xa8')]?_0x5cd7ab['query'][_0x46ac('0xa8')]:null;var _0x2db5a5={'method':_0x5cd7ab[_0x46ac('0xa9')],'uri':util[_0x46ac('0x58')](_0x46ac('0xaa'),_0xd35d20,_0x5cd7ab[_0x46ac('0x3f')][_0x46ac('0x7')]),'json':_0x4373d3,'resolveWithFullResponse':!![],'encoding':_0x3fceab,'qs':_0x5cd7ab['query']};if(_0x5cd7ab[_0x46ac('0xab')]){_0x2db5a5[_0x46ac('0xab')]=_0x5cd7ab[_0x46ac('0xab')];if(_0x2db5a5['headers'][_0x46ac('0xac')]){delete _0x2db5a5['headers'][_0x46ac('0xac')];}}if(_0x2db5a5[_0x46ac('0xab')][_0x46ac('0xad')]){delete _0x2db5a5['headers']['content-type'];}return rp(_0x2db5a5);})['then'](function(_0x4efcd0){if(_0x4efcd0){_0x155d93[_0x46ac('0xae')](_0x4efcd0[_0x46ac('0xab')]);logger[_0x46ac('0x6a')](_0x4efcd0[_0x46ac('0x97')]);if(_[_0x46ac('0xaf')](_0x5cd7ab['query'][_0x46ac('0x7')],_0x46ac('0x55'))&&_0x4efcd0[_0x46ac('0xb0')]==0x1f4){return _0x155d93[_0x46ac('0x24')](_0x4efcd0[_0x46ac('0xb0')]);}else{return _0x155d93[_0x46ac('0x25')](_0x4efcd0[_0x46ac('0xb0')])[_0x46ac('0x37')](_0x4efcd0[_0x46ac('0x97')]);}}else{return _0x155d93[_0x46ac('0x24')](0xc8);}})[_0x46ac('0x51')](handleError(_0x155d93,null));};exports[_0x46ac('0xb1')]=function(_0xd52eb4,_0x1b6c4b,_0x453c3c){return BPromise['resolve']()[_0x46ac('0x2f')](function(){if(!_0xd52eb4[_0x46ac('0x3f')]['path']){throw new Error(_0x46ac('0xa3'));}if(!_0xd52eb4[_0x46ac('0x3f')][_0x46ac('0xa4')]){throw new Error(_0x46ac('0xa5'));}var _0x2fb28e=_0xd52eb4[_0x46ac('0x3f')]['hostname']?_0xd52eb4[_0x46ac('0x3f')][_0x46ac('0xa6')]+':'+_0xd52eb4[_0x46ac('0x3f')][_0x46ac('0xa4')]:'http://localhost:'+_0xd52eb4[_0x46ac('0x3f')][_0x46ac('0xa4')];var _0xc91bb=_0xd52eb4[_0x46ac('0x3f')][_0x46ac('0x26')]?_0xd52eb4[_0x46ac('0x3f')][_0x46ac('0x26')]:!![];var _0x3c2805=_0xd52eb4[_0x46ac('0x3f')][_0x46ac('0xa8')]?_0xd52eb4[_0x46ac('0x3f')][_0x46ac('0xa8')]:null;var _0x33cc52={'method':_0xd52eb4[_0x46ac('0xa9')],'uri':util[_0x46ac('0x58')]('%s%s',_0x2fb28e,_0xd52eb4[_0x46ac('0x3f')][_0x46ac('0x7')]),'json':_0xc91bb,'resolveWithFullResponse':!![],'encoding':_0x3c2805,'body':_0xd52eb4[_0x46ac('0x97')]};if(_0xd52eb4['headers']){_0x33cc52[_0x46ac('0xab')]=_0xd52eb4[_0x46ac('0xab')];if(_0x33cc52[_0x46ac('0xab')][_0x46ac('0xac')]){delete _0x33cc52[_0x46ac('0xab')]['content-length'];}}if(_0x33cc52[_0x46ac('0xab')]['content-type']){delete _0x33cc52[_0x46ac('0xab')][_0x46ac('0xad')];}return rp(_0x33cc52);})[_0x46ac('0x2f')](function(_0x369ef1){if(_0x369ef1){_0x1b6c4b['set'](_0x369ef1[_0x46ac('0xab')]);logger['info'](_0x369ef1[_0x46ac('0x97')]);return _0x1b6c4b[_0x46ac('0x25')](_0x369ef1[_0x46ac('0xb0')])[_0x46ac('0x37')](_0x369ef1[_0x46ac('0x97')]);}else{return _0x1b6c4b[_0x46ac('0x24')](0xc8);}})[_0x46ac('0x51')](handleError(_0x1b6c4b,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index ff64ae2..73b38cf 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 _0xd3e3=['exports','events','../../mysqldb','Plugin','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x18dbeb,_0x29a895){var _0x479147=function(_0x3f8aa5){while(--_0x3f8aa5){_0x18dbeb['push'](_0x18dbeb['shift']());}};_0x479147(++_0x29a895);}(_0xd3e3,0xdd));var _0x3d3e=function(_0x1d3ea8,_0x98964b){_0x1d3ea8=_0x1d3ea8-0x0;var _0xaea89f=_0xd3e3[_0x1d3ea8];return _0xaea89f;};'use strict';var EventEmitter=require(_0x3d3e('0x0'));var Plugin=require(_0x3d3e('0x1'))['db'][_0x3d3e('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x3d3e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3d3e('0x4'),'afterDestroy':_0x3d3e('0x5')};function emitEvent(_0x56d1bb){return function(_0x289083,_0x1c7ded,_0x5d341e){PluginEvents[_0x3d3e('0x6')](_0x56d1bb+':'+_0x289083['id'],_0x289083);PluginEvents[_0x3d3e('0x6')](_0x56d1bb,_0x289083);_0x5d341e(null);};}for(var e in events){if(events[_0x3d3e('0x7')](e)){var event=events[e];Plugin[_0x3d3e('0x8')](e,emitEvent(event));}}module[_0x3d3e('0x9')]=PluginEvents; \ No newline at end of file +var _0x326f=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x326f,0xd1));var _0xf326=function(_0x452372,_0x316ef4){_0x452372=_0x452372-0x0;var _0x2e9e91=_0x326f[_0x452372];return _0x2e9e91;};'use strict';var EventEmitter=require(_0xf326('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xf326('0x1')](0x0);var events={'afterCreate':_0xf326('0x2'),'afterUpdate':_0xf326('0x3'),'afterDestroy':_0xf326('0x4')};function emitEvent(_0x27e8d7){return function(_0x120a26,_0x9445c6,_0xf1c243){PluginEvents[_0xf326('0x5')](_0x27e8d7+':'+_0x120a26['id'],_0x120a26);PluginEvents[_0xf326('0x5')](_0x27e8d7,_0x120a26);_0xf1c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xf326('0x6')](e,emitEvent(event));}}module[_0xf326('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 4c19d2d..d4a890e 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 _0xbc8a=['./plugin.attributes','define','Plugin','plugins','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5316c9,_0x1599b8){var _0x4b7507=function(_0x49dc0c){while(--_0x49dc0c){_0x5316c9['push'](_0x5316c9['shift']());}};_0x4b7507(++_0x1599b8);}(_0xbc8a,0x190));var _0xabc8=function(_0x18405f,_0x3ed101){_0x18405f=_0x18405f-0x0;var _0x3a86da=_0xbc8a[_0x18405f];return _0x3a86da;};'use strict';var _=require('lodash');var util=require(_0xabc8('0x0'));var logger=require('../../config/logger')(_0xabc8('0x1'));var moment=require(_0xabc8('0x2'));var BPromise=require(_0xabc8('0x3'));var rp=require(_0xabc8('0x4'));var fs=require('fs');var path=require(_0xabc8('0x5'));var rimraf=require(_0xabc8('0x6'));var config=require(_0xabc8('0x7'));var attributes=require(_0xabc8('0x8'));module['exports']=function(_0x4b2afa,_0x3bf739){return _0x4b2afa[_0xabc8('0x9')](_0xabc8('0xa'),attributes,{'tableName':_0xabc8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d80=['../../config/environment','exports','Plugin','plugins','lodash','util','bluebird','path','rimraf'];(function(_0x322e9e,_0x4b667c){var _0x287165=function(_0xf247cf){while(--_0xf247cf){_0x322e9e['push'](_0x322e9e['shift']());}};_0x287165(++_0x4b667c);}(_0x1d80,0xaf));var _0x01d8=function(_0x2bd37b,_0x3d2035){_0x2bd37b=_0x2bd37b-0x0;var _0x64dc4f=_0x1d80[_0x2bd37b];return _0x64dc4f;};'use strict';var _=require(_0x01d8('0x0'));var util=require(_0x01d8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x01d8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x01d8('0x3'));var rimraf=require(_0x01d8('0x4'));var config=require(_0x01d8('0x5'));var attributes=require('./plugin.attributes');module[_0x01d8('0x6')]=function(_0x356ab1,_0x425da1){return _0x356ab1['define'](_0x01d8('0x7'),attributes,{'tableName':_0x01d8('0x8'),'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 c3eaf21..831019f 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 _0x76e9=['request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Plugin,\x20%s,\x20%s','catch','CreatePlugin','Plugin','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info'];(function(_0x354580,_0x4e625d){var _0x52ea16=function(_0x16c6cf){while(--_0x16c6cf){_0x354580['push'](_0x354580['shift']());}};_0x52ea16(++_0x4e625d);}(_0x76e9,0x140));var _0x976e=function(_0x5a2339,_0xa1c4d8){_0x5a2339=_0x5a2339-0x0;var _0x276e23=_0x76e9[_0x5a2339];return _0x276e23;};'use strict';var _=require(_0x976e('0x0'));var util=require(_0x976e('0x1'));var moment=require(_0x976e('0x2'));var BPromise=require(_0x976e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x976e('0x4'));var db=require(_0x976e('0x5'))['db'];var utils=require(_0x976e('0x6'));var logger=require(_0x976e('0x7'))(_0x976e('0x8'));var config=require('../../config/environment');var jayson=require(_0x976e('0x9'));var client=jayson[_0x976e('0xa')][_0x976e('0xb')]({'port':0x232a});config[_0x976e('0xc')]=_[_0x976e('0xd')](config[_0x976e('0xc')],{'host':_0x976e('0xe'),'port':0x18eb});var socket=require(_0x976e('0xf'))(new Redis(config[_0x976e('0xc')]));require('./plugin.socket')[_0x976e('0x10')](socket);function respondWithRpcPromise(_0x335fa8,_0x428b6e,_0x5eb285){return new BPromise(function(_0x4c40f5,_0x3758e1){return client[_0x976e('0x11')](_0x335fa8,_0x5eb285)[_0x976e('0x12')](function(_0x4e22ec){logger[_0x976e('0x13')]('Plugin,\x20%s,\x20%s',_0x428b6e,_0x976e('0x14'));logger[_0x976e('0x15')](_0x976e('0x16'),_0x428b6e,_0x976e('0x14'),JSON[_0x976e('0x17')](_0x4e22ec));if(_0x4e22ec[_0x976e('0x18')]){if(_0x4e22ec[_0x976e('0x18')][_0x976e('0x19')]===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x428b6e,_0x4e22ec[_0x976e('0x18')]['message']);return _0x3758e1(_0x4e22ec['error'][_0x976e('0x1a')]);}logger[_0x976e('0x18')](_0x976e('0x1b'),_0x428b6e,_0x4e22ec[_0x976e('0x18')][_0x976e('0x1a')]);return _0x4c40f5(_0x4e22ec[_0x976e('0x18')][_0x976e('0x1a')]);}else{logger[_0x976e('0x13')](_0x976e('0x1b'),_0x428b6e,_0x976e('0x14'));_0x4c40f5(_0x4e22ec['result'][_0x976e('0x1a')]);}})[_0x976e('0x1c')](function(_0x330095){logger[_0x976e('0x18')](_0x976e('0x1b'),_0x428b6e,_0x330095);_0x3758e1(_0x330095);});});}exports[_0x976e('0x1d')]=function(_0x53bda6){var _0x44207c=this;return new Promise(function(_0x7fe6b6,_0x426741){return db[_0x976e('0x1e')]['create'](_0x53bda6[_0x976e('0x1f')],{'raw':_0x53bda6[_0x976e('0x20')]?_0x53bda6[_0x976e('0x20')][_0x976e('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x55c8cb){logger[_0x976e('0x13')](_0x976e('0x1d'),_0x53bda6);logger['debug'](_0x976e('0x1d'),_0x53bda6,JSON[_0x976e('0x17')](_0x55c8cb));_0x7fe6b6(_0x55c8cb);})[_0x976e('0x1c')](function(_0x42871d){logger[_0x976e('0x18')]('CreatePlugin',_0x42871d[_0x976e('0x1a')],_0x53bda6);_0x426741(_0x44207c[_0x976e('0x18')](0x1f4,_0x42871d[_0x976e('0x1a')]));});});}; \ No newline at end of file +var _0xa013=['code','Plugin,\x20%s,\x20%s','message','info','result','catch','CreatePlugin','create','body','options','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./plugin.socket','register','request','then','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa013,0x1ea));var _0x3a01=function(_0x2132a3,_0x4639e9){_0x2132a3=_0x2132a3-0x0;var _0x21890c=_0xa013[_0x2132a3];return _0x21890c;};'use strict';var _=require('lodash');var util=require(_0x3a01('0x0'));var moment=require('moment');var BPromise=require(_0x3a01('0x1'));var rs=require(_0x3a01('0x2'));var fs=require('fs');var Redis=require(_0x3a01('0x3'));var db=require(_0x3a01('0x4'))['db'];var utils=require(_0x3a01('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3a01('0x6'));var jayson=require(_0x3a01('0x7'));var client=jayson[_0x3a01('0x8')][_0x3a01('0x9')]({'port':0x232a});config['redis']=_[_0x3a01('0xa')](config[_0x3a01('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3a01('0xc'))(new Redis(config[_0x3a01('0xb')]));require(_0x3a01('0xd'))[_0x3a01('0xe')](socket);function respondWithRpcPromise(_0x2c864c,_0x1bcf00,_0x5584a6){return new BPromise(function(_0x4dad65,_0x125f2d){return client[_0x3a01('0xf')](_0x2c864c,_0x5584a6)[_0x3a01('0x10')](function(_0x525645){logger['info']('Plugin,\x20%s,\x20%s',_0x1bcf00,_0x3a01('0x11'));logger[_0x3a01('0x12')](_0x3a01('0x13'),_0x1bcf00,'request\x20sent',JSON[_0x3a01('0x14')](_0x525645));if(_0x525645[_0x3a01('0x15')]){if(_0x525645['error'][_0x3a01('0x16')]===0x1f4){logger[_0x3a01('0x15')](_0x3a01('0x17'),_0x1bcf00,_0x525645[_0x3a01('0x15')]['message']);return _0x125f2d(_0x525645['error'][_0x3a01('0x18')]);}logger[_0x3a01('0x15')](_0x3a01('0x17'),_0x1bcf00,_0x525645[_0x3a01('0x15')][_0x3a01('0x18')]);return _0x4dad65(_0x525645[_0x3a01('0x15')]['message']);}else{logger[_0x3a01('0x19')](_0x3a01('0x17'),_0x1bcf00,_0x3a01('0x11'));_0x4dad65(_0x525645[_0x3a01('0x1a')][_0x3a01('0x18')]);}})[_0x3a01('0x1b')](function(_0x250738){logger['error']('Plugin,\x20%s,\x20%s',_0x1bcf00,_0x250738);_0x125f2d(_0x250738);});});}exports[_0x3a01('0x1c')]=function(_0x51cf62){var _0x215dfd=this;return new Promise(function(_0x3c2326,_0x2cd6f9){return db['Plugin'][_0x3a01('0x1d')](_0x51cf62[_0x3a01('0x1e')],{'raw':_0x51cf62[_0x3a01('0x1f')]?_0x51cf62[_0x3a01('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x3a01('0x10')](function(_0x5419d3){logger[_0x3a01('0x19')](_0x3a01('0x1c'),_0x51cf62);logger[_0x3a01('0x12')](_0x3a01('0x1c'),_0x51cf62,JSON[_0x3a01('0x14')](_0x5419d3));_0x3c2326(_0x5419d3);})['catch'](function(_0x389917){logger[_0x3a01('0x15')](_0x3a01('0x1c'),_0x389917['message'],_0x51cf62);_0x2cd6f9(_0x215dfd[_0x3a01('0x15')](0x1f4,_0x389917['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index f07b1e8..e119514 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 _0x5243=['save','remove','update','emit','removeListener','register','length','plugin:'];(function(_0x49094d,_0x4dec15){var _0x47c5ec=function(_0x58bac9){while(--_0x58bac9){_0x49094d['push'](_0x49094d['shift']());}};_0x47c5ec(++_0x4dec15);}(_0x5243,0x170));var _0x3524=function(_0xfb0c66,_0x4a3de5){_0xfb0c66=_0xfb0c66-0x0;var _0x29c62c=_0x5243[_0xfb0c66];return _0x29c62c;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x3524('0x0'),_0x3524('0x1'),_0x3524('0x2')];function createListener(_0x188df9,_0x120901){return function(_0x159128){_0x120901[_0x3524('0x3')](_0x188df9,_0x159128);};}function removeListener(_0x4fcc9d,_0x5714bf){return function(){PluginEvents[_0x3524('0x4')](_0x4fcc9d,_0x5714bf);};}exports[_0x3524('0x5')]=function(_0x528936){for(var _0x1f30c8=0x0,_0x25f733=events[_0x3524('0x6')];_0x1f30c8<_0x25f733;_0x1f30c8++){var _0x45550c=events[_0x1f30c8];var _0x4cb091=createListener(_0x3524('0x7')+_0x45550c,_0x528936);PluginEvents['on'](_0x45550c,_0x4cb091);}}; \ No newline at end of file +var _0x218c=['./plugin.events','update','emit','removeListener','register','length','plugin:'];(function(_0x4ac31f,_0x3bf843){var _0x1f1926=function(_0x362de5){while(--_0x362de5){_0x4ac31f['push'](_0x4ac31f['shift']());}};_0x1f1926(++_0x3bf843);}(_0x218c,0x17a));var _0xc218=function(_0x2dfd28,_0x153b3c){_0x2dfd28=_0x2dfd28-0x0;var _0x49c016=_0x218c[_0x2dfd28];return _0x49c016;};'use strict';var PluginEvents=require(_0xc218('0x0'));var events=['save','remove',_0xc218('0x1')];function createListener(_0x2a1059,_0x46688d){return function(_0x5a079a){_0x46688d[_0xc218('0x2')](_0x2a1059,_0x5a079a);};}function removeListener(_0x40d08c,_0x15bacf){return function(){PluginEvents[_0xc218('0x3')](_0x40d08c,_0x15bacf);};}exports[_0xc218('0x4')]=function(_0x537cfe){for(var _0xb1d1b1=0x0,_0x366ef6=events[_0xc218('0x5')];_0xb1d1b1<_0x366ef6;_0xb1d1b1++){var _0x3082b3=events[_0xb1d1b1];var _0x136adc=createListener(_0xc218('0x6')+_0x3082b3,_0x537cfe);PluginEvents['on'](_0x3082b3,_0x136adc);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index be0a661..08a8034 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(_0x3f0e15,_0x82c7f9){var _0x45b3a1=function(_0x1177f3){while(--_0x1177f3){_0x3f0e15['push'](_0x3f0e15['shift']());}};_0x45b3a1(++_0x82c7f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x298842,_0x477c41){var _0x4ed1f6=function(_0x582835){while(--_0x582835){_0x298842['push'](_0x298842['shift']());}};_0x4ed1f6(++_0x477c41);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 e9a5fa9..5bb2922 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 _0x6c76=['status','npm\x20install','info','error','index','list','then','reject','motion2','length','catch','params','create','body','script','join','../../files/plugins','cwd','chdir','start','dump','send','restart','stop','hasOwnProperty','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','path','child_process','sendStatus','stack','name'];(function(_0x31a46c,_0x4395a2){var _0x523ebb=function(_0x3e623d){while(--_0x3e623d){_0x31a46c['push'](_0x31a46c['shift']());}};_0x523ebb(++_0x4395a2);}(_0x6c76,0x184));var _0x66c7=function(_0x36bc66,_0x17da93){_0x36bc66=_0x36bc66-0x0;var _0x135543=_0x6c76[_0x36bc66];return _0x135543;};'use strict';var _=require(_0x66c7('0x0'));var pm2=require(_0x66c7('0x1'));var logger=require(_0x66c7('0x2'))('api');var path=require(_0x66c7('0x3'));var exec=require(_0x66c7('0x4'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x2f6db7,_0x2b7cf3){return function(_0x49d437){if(!_0x49d437){_0x2f6db7[_0x66c7('0x5')](0x194);;}return _0x49d437;};}function respondWithResult(_0x45b0a5,_0x52f71b){_0x52f71b=_0x52f71b||0xc8;return function(_0x23408c){if(_0x23408c){return _0x45b0a5['status'](_0x52f71b)['json'](_0x23408c);}return null;};}function handleError(_0x208d06,_0x2b0065){_0x2b0065=_0x2b0065||0x1f4;return function(_0x24349f){logger['error'](_0x24349f[_0x66c7('0x6')]);if(_0x24349f[_0x66c7('0x7')]){delete _0x24349f[_0x66c7('0x7')];}_0x208d06[_0x66c7('0x8')](_0x2b0065)['send'](_0x24349f);};}function execChildProcess(){return new BPromise(function(_0x464085,_0x45db57){exec(_0x66c7('0x9'),function(_0x187e00,_0x21fb64,_0x406e41){logger[_0x66c7('0xa')](_0x21fb64);logger['info'](_0x406e41);if(_0x187e00){logger[_0x66c7('0xb')](_0x187e00);return _0x45db57(_0x187e00);}return _0x464085(_0x21fb64);});});}exports[_0x66c7('0xc')]=function(_0x35cbc2,_0xea3f56){return pm2[_0x66c7('0xd')]()[_0x66c7('0xe')](function(_0x618bd7){if(_0x618bd7){var _0xf3b04=_[_0x66c7('0xf')](_0x618bd7,function(_0x5d44e1){return _0x5d44e1[_0x66c7('0x7')]==='express'||_0x5d44e1[_0x66c7('0x7')]===_0x66c7('0x10');});return{'rows':_0xf3b04,'count':_0xf3b04[_0x66c7('0x11')]};}return null;})[_0x66c7('0xe')](respondWithResult(_0xea3f56,null))[_0x66c7('0x12')](handleError(_0xea3f56,null));};exports['show']=function(_0x5cf913,_0x53fb36){return pm2['describe'](_0x5cf913[_0x66c7('0x13')]['id'])[_0x66c7('0xe')](respondWithResult(_0x53fb36,null))['then'](handleEntityNotFound(_0x53fb36,null))['catch'](handleError(_0x53fb36,null));};exports[_0x66c7('0x14')]=function(_0x9b65cf,_0x4756f7){if(_0x9b65cf[_0x66c7('0x15')]['name']&&_0x9b65cf['body'][_0x66c7('0x16')]){var _0x237177=path[_0x66c7('0x17')](__dirname,_0x66c7('0x18'),_0x9b65cf[_0x66c7('0x15')][_0x66c7('0x16')]);var _0x4804cf=process[_0x66c7('0x19')]();process[_0x66c7('0x1a')](path['dirname'](_0x237177));return execChildProcess()[_0x66c7('0xe')](function(_0x8b96b1){process[_0x66c7('0x1a')](_0x4804cf);return pm2[_0x66c7('0x1b')]({'name':_0x9b65cf['body'][_0x66c7('0x7')],'script':_0x237177});})[_0x66c7('0xe')](function(_0x5b28e6){pm2[_0x66c7('0x1c')]();return _0x5b28e6[0x0];})[_0x66c7('0xe')](respondWithResult(_0x4756f7,0xc9))[_0x66c7('0x12')](handleError(_0x4756f7,null));}else{return _0x4756f7[_0x66c7('0x8')](0x1f4)[_0x66c7('0x1d')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x4e514a,_0x2dd131){if(_0x4e514a[_0x66c7('0x15')]['id']){delete _0x4e514a['body']['id'];}var _0x9afd50={'online':_0x66c7('0x1e'),'stopped':_0x66c7('0x1f')};if(_0x9afd50[_0x66c7('0x20')](_0x4e514a[_0x66c7('0x15')][_0x66c7('0x8')])){return pm2[_0x9afd50[_0x4e514a['body'][_0x66c7('0x8')]]](_0x4e514a[_0x66c7('0x13')]['id'])[_0x66c7('0xe')](respondWithResult(_0x2dd131,0xc8))[_0x66c7('0x12')](handleError(_0x2dd131,null));}else{return _0x2dd131[_0x66c7('0x8')](0x1f4)['send']({'message':_0x66c7('0x21')});}};exports['destroy']=function(_0xfbd97,_0x543fbf){if(_0xfbd97[_0x66c7('0x15')]['id']){delete _0xfbd97[_0x66c7('0x15')]['id'];}if(_0xfbd97[_0x66c7('0x13')]['id']){return pm2[_0x66c7('0x22')](_0xfbd97[_0x66c7('0x13')]['id'])[_0x66c7('0xe')](function(_0x559ab9){pm2['dump']();return _0x559ab9[0x0];})[_0x66c7('0xe')](respondWithResult(_0x543fbf,null))[_0x66c7('0x12')](handleError(_0x543fbf,null));}else{return _0x543fbf[_0x66c7('0x8')](0x1f4)[_0x66c7('0x1d')]({'message':_0x66c7('0x23')});}}; \ No newline at end of file +var _0x5ff3=['Unknown\x20id','../../config/pm2','api','child_process','exec','bluebird','sendStatus','json','error','name','status','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','params','create','body','join','../../files/plugins','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','delete'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x5ff3,0x17d));var _0x35ff=function(_0x1e0945,_0x5c9f31){_0x1e0945=_0x1e0945-0x0;var _0x18bc81=_0x5ff3[_0x1e0945];return _0x18bc81;};'use strict';var _=require('lodash');var pm2=require(_0x35ff('0x0'));var logger=require('../../config/logger')(_0x35ff('0x1'));var path=require('path');var exec=require(_0x35ff('0x2'))[_0x35ff('0x3')];var BPromise=require(_0x35ff('0x4'));function handleEntityNotFound(_0xd0846d,_0x551514){return function(_0x2fcb74){if(!_0x2fcb74){_0xd0846d[_0x35ff('0x5')](0x194);;}return _0x2fcb74;};}function respondWithResult(_0x2e9873,_0x11e738){_0x11e738=_0x11e738||0xc8;return function(_0x30c3ff){if(_0x30c3ff){return _0x2e9873['status'](_0x11e738)[_0x35ff('0x6')](_0x30c3ff);}return null;};}function handleError(_0x4c9fab,_0x2e7470){_0x2e7470=_0x2e7470||0x1f4;return function(_0xfcec34){logger[_0x35ff('0x7')](_0xfcec34['stack']);if(_0xfcec34[_0x35ff('0x8')]){delete _0xfcec34['name'];}_0x4c9fab[_0x35ff('0x9')](_0x2e7470)[_0x35ff('0xa')](_0xfcec34);};}function execChildProcess(){return new BPromise(function(_0x57ad20,_0x5c3131){exec(_0x35ff('0xb'),function(_0x574c81,_0x592295,_0x567080){logger[_0x35ff('0xc')](_0x592295);logger[_0x35ff('0xc')](_0x567080);if(_0x574c81){logger[_0x35ff('0x7')](_0x574c81);return _0x5c3131(_0x574c81);}return _0x57ad20(_0x592295);});});}exports[_0x35ff('0xd')]=function(_0x559e33,_0x33154f){return pm2[_0x35ff('0xe')]()[_0x35ff('0xf')](function(_0x4d1d41){if(_0x4d1d41){var _0xff8ac=_[_0x35ff('0x10')](_0x4d1d41,function(_0x254975){return _0x254975[_0x35ff('0x8')]===_0x35ff('0x11')||_0x254975[_0x35ff('0x8')]===_0x35ff('0x12');});return{'rows':_0xff8ac,'count':_0xff8ac[_0x35ff('0x13')]};}return null;})[_0x35ff('0xf')](respondWithResult(_0x33154f,null))[_0x35ff('0x14')](handleError(_0x33154f,null));};exports[_0x35ff('0x15')]=function(_0x3430e2,_0x37ea06){return pm2[_0x35ff('0x16')](_0x3430e2[_0x35ff('0x17')]['id'])['then'](respondWithResult(_0x37ea06,null))[_0x35ff('0xf')](handleEntityNotFound(_0x37ea06,null))[_0x35ff('0x14')](handleError(_0x37ea06,null));};exports[_0x35ff('0x18')]=function(_0x1c0d8c,_0x567bcb){if(_0x1c0d8c['body'][_0x35ff('0x8')]&&_0x1c0d8c[_0x35ff('0x19')]['script']){var _0x238f65=path[_0x35ff('0x1a')](__dirname,_0x35ff('0x1b'),_0x1c0d8c[_0x35ff('0x19')]['script']);var _0x3d60b4=process['cwd']();process[_0x35ff('0x1c')](path[_0x35ff('0x1d')](_0x238f65));return execChildProcess()[_0x35ff('0xf')](function(_0x16a5a0){process[_0x35ff('0x1c')](_0x3d60b4);return pm2[_0x35ff('0x1e')]({'name':_0x1c0d8c[_0x35ff('0x19')]['name'],'script':_0x238f65});})[_0x35ff('0xf')](function(_0x2ffcb){pm2['dump']();return _0x2ffcb[0x0];})[_0x35ff('0xf')](respondWithResult(_0x567bcb,0xc9))['catch'](handleError(_0x567bcb,null));}else{return _0x567bcb['status'](0x1f4)[_0x35ff('0xa')]({'message':_0x35ff('0x1f')});}};exports[_0x35ff('0x20')]=function(_0x11a5eb,_0x302d5a){if(_0x11a5eb['body']['id']){delete _0x11a5eb[_0x35ff('0x19')]['id'];}var _0x412873={'online':_0x35ff('0x21'),'stopped':'stop'};if(_0x412873[_0x35ff('0x22')](_0x11a5eb[_0x35ff('0x19')][_0x35ff('0x9')])){return pm2[_0x412873[_0x11a5eb[_0x35ff('0x19')][_0x35ff('0x9')]]](_0x11a5eb[_0x35ff('0x17')]['id'])[_0x35ff('0xf')](respondWithResult(_0x302d5a,0xc8))[_0x35ff('0x14')](handleError(_0x302d5a,null));}else{return _0x302d5a[_0x35ff('0x9')](0x1f4)['send']({'message':_0x35ff('0x23')});}};exports['destroy']=function(_0x1cb370,_0x257501){if(_0x1cb370[_0x35ff('0x19')]['id']){delete _0x1cb370[_0x35ff('0x19')]['id'];}if(_0x1cb370['params']['id']){return pm2[_0x35ff('0x24')](_0x1cb370['params']['id'])[_0x35ff('0xf')](function(_0xf88865){pm2['dump']();return _0xf88865[0x0];})['then'](respondWithResult(_0x257501,null))[_0x35ff('0x14')](handleError(_0x257501,null));}else{return _0x257501[_0x35ff('0x9')](0x1f4)['send']({'message':_0x35ff('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 36c556d..a53cd2f 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 _0x67ef=['getAgents','/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated'];(function(_0x2519f2,_0x56de73){var _0x544811=function(_0x2686d6){while(--_0x2686d6){_0x2519f2['push'](_0x2519f2['shift']());}};_0x544811(++_0x56de73);}(_0x67ef,0xe0));var _0xf67e=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x67ef[_0x2dadb9];return _0x2f0097;};'use strict';var express=require(_0xf67e('0x0'));var router=express[_0xf67e('0x1')]();var auth=require(_0xf67e('0x2'));var controller=require(_0xf67e('0x3'));router[_0xf67e('0x4')](_0xf67e('0x5'),auth[_0xf67e('0x6')](),controller[_0xf67e('0x7')]);router[_0xf67e('0x4')](_0xf67e('0x8'),auth[_0xf67e('0x6')](),controller[_0xf67e('0x9')]);module[_0xf67e('0xa')]=router; \ No newline at end of file +var _0x5fae=['/queues','getQueues','express','Router','../../components/auth/service','get','isAuthenticated'];(function(_0x3a94e1,_0x22e4fd){var _0x6a09d5=function(_0x2d6d1c){while(--_0x2d6d1c){_0x3a94e1['push'](_0x3a94e1['shift']());}};_0x6a09d5(++_0x22e4fd);}(_0x5fae,0x105));var _0xe5fa=function(_0x5436e5,_0xee7cee){_0x5436e5=_0x5436e5-0x0;var _0x240daa=_0x5fae[_0x5436e5];return _0x240daa;};'use strict';var express=require(_0xe5fa('0x0'));var router=express[_0xe5fa('0x1')]();var auth=require(_0xe5fa('0x2'));var controller=require('./realtime.controller');router[_0xe5fa('0x3')]('/agents',auth[_0xe5fa('0x4')](),controller['getAgents']);router[_0xe5fa('0x3')](_0xe5fa('0x5'),auth[_0xe5fa('0x4')](),controller[_0xe5fa('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index cd810d5..b53d8c8 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 _0x1199=['resolve','Channel\x20parameter\x20%s\x20is\x20invalid','startCase','Queue','fieldName','outbound','dialActive','dialMethod','getOptions','QueueCampaigns','Queues','name','filter','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','then','channel','isValidChannel','format','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','length','map','User','rawAttributes','type','key','role','agent','push','sequelize','literal','forEach','Pause','where','user','userProfileId','Agents','extraQueryConditions','assign','omit','UserProfile','getResources','findAndCountAll','count','merge','getAgentStatus','voice','voiceStatus','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1199,0x173));var _0x9119=function(_0x7dd1ad,_0x591860){_0x7dd1ad=_0x7dd1ad-0x0;var _0x172e5f=_0x1199[_0x7dd1ad];return _0x172e5f;};'use strict';var _=require(_0x9119('0x0'));var util=require(_0x9119('0x1'));var rta=require(_0x9119('0x2'));var rtq=require('../../components/realtime/queues');var qs=require(_0x9119('0x3'));var utils=require(_0x9119('0x4'));var db=require(_0x9119('0x5'))['db'];var APIBadRequestError=require(_0x9119('0x6'))[_0x9119('0x7')];var APIHandleError=require(_0x9119('0x6'))[_0x9119('0x8')];function respondWithFilteredResult(_0x5410fc,_0x59a3b5){return function(_0x20aeb0){if(_0x20aeb0){var _0x3554ae=typeof _0x59a3b5[_0x9119('0x9')]===_0x9119('0xa')&&typeof _0x59a3b5[_0x9119('0xb')]==='undefined';var _0x191f90=_0x20aeb0['count'];var _0x567ba9=_0x3554ae?0x0:_0x59a3b5['offset'];var _0x591ce8=_0x3554ae?_0x20aeb0['count']:_0x59a3b5[_0x9119('0x9')]+_0x59a3b5[_0x9119('0xb')];var _0x318ebf;if(_0x591ce8>=_0x191f90){_0x591ce8=_0x191f90;_0x318ebf=0xc8;}else{_0x318ebf=0xce;}_0x5410fc[_0x9119('0xc')](_0x318ebf);return _0x5410fc[_0x9119('0xd')](_0x9119('0xe'),_0x567ba9+'-'+_0x591ce8+'/'+_0x191f90)[_0x9119('0xf')](_0x20aeb0);}return null;};}exports[_0x9119('0x10')]=function(_0x22eedb,_0x559c10){var _0x23e402={'count':0x0,'rows':[]};var _0x204558={};var _0x1f0095;var _0x526326=utils[_0x9119('0x11')]();var _0x52d56b;var _0x5e3c75;var _0xef5aff=_0x22eedb[_0x9119('0x12')][_0x9119('0x13')];var _0x2465d2=_0x22eedb['query'][_0x9119('0x14')];var _0x3a6d28=_0x22eedb[_0x9119('0x12')][_0x9119('0x15')];var _0x3948cb=_0x2465d2===_0x9119('0x16')||_0x2465d2===_0x9119('0x17')?!![]:![];var _0x15b7ca=[];var _0x146d0a;var _0x3130a1;Promise['resolve']()[_0x9119('0x18')](function(){if(_0x22eedb['query'][_0x9119('0x19')]){if(!utils[_0x9119('0x1a')](_0x22eedb[_0x9119('0x12')][_0x9119('0x19')])){throw new APIBadRequestError(util[_0x9119('0x1b')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x22eedb[_0x9119('0x12')][_0x9119('0x19')]));}_0x1f0095=_0x22eedb[_0x9119('0x12')]['channel'][_0x9119('0x1c')]();}if(!_0x22eedb[_0x9119('0x12')][_0x9119('0x1d')]||!_0x22eedb[_0x9119('0x12')][_0x9119('0x1d')][_0x9119('0x1e')](_0x9119('0x1f'))){_0x22eedb[_0x9119('0x12')][_0x9119('0x1d')]=rta[_0x9119('0x20')](_0x22eedb[_0x9119('0x12')][_0x9119('0x1d')]);return;}var _0x438dc9=rta[_0x9119('0x21')](_0x22eedb[_0x9119('0x12')][_0x9119('0x1d')]);_0x22eedb[_0x9119('0x12')]['sort']=_0x438dc9[_0x9119('0x22')][_0x9119('0x23')](',');_0x146d0a=_0x438dc9['order'];})[_0x9119('0x18')](function(){if(!_0xef5aff){return[];}return rta[_0x9119('0x24')](_0xef5aff,_0x1f0095);})[_0x9119('0x18')](function(_0x3dc00a){_0x15b7ca=_0x3dc00a;return rta[_0x9119('0x25')]();})[_0x9119('0x18')](function(_0x4b602c){_0x5e3c75=_0x4b602c[_0x9119('0x26')];if((!_0x2465d2||_0x3948cb)&&!_0x146d0a){return _0x15b7ca;}if(_0x146d0a&&!_0x2465d2){return rta[_0x9119('0x27')](_0x5e3c75,_0x15b7ca,_0x146d0a);}else{return rta['getAgentIdsByStatus'](_0x5e3c75,_0x15b7ca,_0x2465d2);}})[_0x9119('0x18')](function(_0x1fbc13){_0x15b7ca=_0x1fbc13;var _0x511671=![];if(_0x15b7ca[_0x9119('0x28')]===0x0){if(_0xef5aff||_0x2465d2){_0x511671=!![];}if(_0x3948cb){_0x511671=![];}}if(_0x511671){return _0x23e402;}var _0x1cb3f3=_[_0x9119('0x29')](db[_0x9119('0x2a')][_0x9119('0x2b')],function(_0x33af64){return{'name':_0x33af64['fieldName'],'type':_0x33af64[_0x9119('0x2c')][_0x9119('0x2d')]};});_0x22eedb[_0x9119('0x12')][_0x9119('0x2e')]=_0x9119('0x2f');_0x204558=qs['getOptions'](_0x1cb3f3,_0x22eedb);_0x204558['raw']=!![];var _0x1979b3=[];if(_0x15b7ca[_0x9119('0x28')]>0x0){_0x1979b3[_0x9119('0x30')]({'id':{'$in':_0x15b7ca}});if(_0x146d0a&&!_0x2465d2){_0x3130a1=[db[_0x9119('0x31')][_0x9119('0x32')]('FIELD(id,'+_0x15b7ca+')')];_0x204558['order']=_0x3130a1;}}if(_0x3948cb){_0x526326[_0x9119('0x33')](function(_0x5246c6){var _0xaa2cb4=!![];if(_0x2465d2===_0x9119('0x17')&&_0x1f0095!==_0x5246c6){_0xaa2cb4=![];}_0x1979b3[_0x9119('0x30')]({[_0x5246c6+_0x9119('0x34')]:_0xaa2cb4});});if(_0x3a6d28){_0x1979b3[_0x9119('0x30')]({'pauseType':_0x3a6d28});}}else if(_0x2465d2){_0x526326[_0x9119('0x33')](function(_0x2330bc){_0x1979b3['push']({[_0x2330bc+_0x9119('0x34')]:![]});});}_0x204558['where']=_['merge'](_0x204558[_0x9119('0x35')],{'$and':_0x1979b3});if(_0x22eedb[_0x9119('0x36')][_0x9119('0x2e')]===_0x9119('0x36')){var _0x146536={'params':{'id':_0x22eedb[_0x9119('0x36')][_0x9119('0x37')]},'query':{'section':_0x9119('0x38'),'role':_0x9119('0x2f'),'raw':!![],'ids':_0x15b7ca,'customSorting':_0x3130a1}};if(_0x22eedb[_0x9119('0x12')]['online']){_0x146536[_0x9119('0x12')]['online']=!![];}if(_0x3948cb){_0x146536[_0x9119('0x12')][_0x9119('0x39')]=_0x1979b3;}_0x146536[_0x9119('0x12')]=Object[_0x9119('0x3a')](_0x146536['query'],_[_0x9119('0x3b')](_0x22eedb['query'],'id'));return db[_0x9119('0x3c')][_0x9119('0x3d')](_0x146536);}return db['User'][_0x9119('0x3e')](_0x204558);})[_0x9119('0x18')](function(_0x3dd78e){_0x23e402[_0x9119('0x3f')]=_0x3dd78e[_0x9119('0x3f')];_0x52d56b=_0x3dd78e[_0x9119('0x26')];return _0x52d56b['map'](function(_0x5b85a6){var _0x546f8e=_['find'](_0x5e3c75,['id',_0x5b85a6['id']]);if(_0x546f8e){var _0x2f563e=rta['filterAgentAttributes'](_0x546f8e);_[_0x9119('0x40')](_0x5b85a6,_0x2f563e);}_0x5b85a6[_0x9119('0x1f')]=rta[_0x9119('0x41')](_0x5b85a6);if(_0x5b85a6['globalStatus'][_0x9119('0x1e')]('pause')){_0x526326[_0x9119('0x33')](function(_0x45014b){if(_0x5b85a6[_0x45014b+_0x9119('0x34')]){if(_0x45014b===_0x9119('0x42')){if(_0x5b85a6['voiceStatus']!=='talking'){_0x5b85a6[_0x9119('0x43')]=_0x9119('0x16');}}else{_0x5b85a6[_0x45014b+_0x9119('0x44')]='pause';}}});}return _0x5b85a6;});})[_0x9119('0x18')](function(_0x11e7fb){if(!_0x146d0a||_0x3130a1){return _0x11e7fb;}return rta[_0x9119('0x45')](_0x11e7fb,_0x146d0a);})['then'](function(_0x2ecee9){var _0x35b228=rta[_0x9119('0x46')]();_0x23e402[_0x9119('0x26')]=_0x2ecee9[_0x9119('0x29')](function(_0x1bca87){return _[_0x9119('0x47')](_0x1bca87,_0x35b228);});return _0x23e402;})[_0x9119('0x18')](respondWithFilteredResult(_0x559c10,_0x204558))[_0x9119('0x48')](APIHandleError(_0x559c10));};exports[_0x9119('0x49')]=function(_0x3f70d6,_0x5aef5f){var _0x209ab5={'count':0x0,'rows':[]};var _0x35708c={};var _0x36dcb7;var _0x2bc74e;var _0x10c637;Promise[_0x9119('0x4a')]()['then'](function(){if(_0x3f70d6[_0x9119('0x12')][_0x9119('0x19')]){if(!utils['isValidChannel'](_0x3f70d6['query'][_0x9119('0x19')])){throw new APIBadRequestError(util[_0x9119('0x1b')](_0x9119('0x4b'),_0x3f70d6['query'][_0x9119('0x19')]));}_0x36dcb7=_0x3f70d6[_0x9119('0x12')][_0x9119('0x19')][_0x9119('0x1c')]();}var _0x116abb=_[_0x9119('0x4c')](_0x36dcb7)+_0x9119('0x4d');var _0x55af8c=_[_0x9119('0x29')](db[_0x116abb][_0x9119('0x2b')],function(_0x1c04b0){return{'name':_0x1c04b0[_0x9119('0x4e')],'type':_0x1c04b0[_0x9119('0x2c')][_0x9119('0x2d')]};});if(!_0x3f70d6[_0x9119('0x12')][_0x9119('0x22')]){var _0x39a50f=['id','name'];if(_0x36dcb7===_0x9119('0x42')){_0x39a50f[_0x9119('0x30')]('type');if(_0x3f70d6[_0x9119('0x12')][_0x9119('0x2c')]===_0x9119('0x4f')){_0x39a50f[_0x9119('0x30')]([_0x9119('0x50'),_0x9119('0x51')]);}}_0x3f70d6[_0x9119('0x12')][_0x9119('0x22')]=_0x39a50f['join'](',');}_0x35708c=qs[_0x9119('0x52')](_0x55af8c,_0x3f70d6);if(_0x3f70d6[_0x9119('0x36')][_0x9119('0x2e')]===_0x9119('0x36')){var _0x4d9537={'params':{'id':_0x3f70d6[_0x9119('0x36')][_0x9119('0x37')]},'query':{'section':_0x36dcb7==='voice'&&_0x3f70d6[_0x9119('0x12')][_0x9119('0x2c')]==='outbound'?_0x9119('0x53'):_[_0x9119('0x4c')](_0x36dcb7)+_0x9119('0x54'),'type':_0x3f70d6[_0x9119('0x12')][_0x9119('0x2c')],'nolimit':!![],'sort':_0x9119('0x55'),'filter':_0x3f70d6[_0x9119('0x12')][_0x9119('0x56')]}};_0x4d9537['query']=Object[_0x9119('0x3a')](_0x4d9537['query'],_0x3f70d6['query']);delete _0x4d9537[_0x9119('0x12')]['id'];return db['UserProfile'][_0x9119('0x3d')](_0x4d9537);}return db[_0x116abb][_0x9119('0x3e')](_0x35708c);})['then'](function(_0x4823e3){_0x209ab5[_0x9119('0x3f')]=_0x4823e3[_0x9119('0x3f')];_0x2bc74e=_0x4823e3[_0x9119('0x26')];return rtq[_0x9119('0x57')](_0x3f70d6,_0x36dcb7);})[_0x9119('0x18')](function(_0x26cc23){_0x10c637=_0x26cc23[_0x9119('0x26')];return rtq[_0x9119('0x58')](_0x2bc74e,_0x10c637,_0x36dcb7,_0x3f70d6[_0x9119('0x12')][_0x9119('0x2c')]);})[_0x9119('0x18')](function(_0x480f20){_0x209ab5[_0x9119('0x26')]=_0x480f20;return _0x209ab5;})[_0x9119('0x18')](respondWithFilteredResult(_0x5aef5f,_0x35708c))[_0x9119('0x48')](APIHandleError(_0x5aef5f));}; \ No newline at end of file +var _0x2b20=['user','userProfileId','online','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','find','getAgentStatus','pause','voice','voiceStatus','talking','pick','getQueues','rawAttributes','type','dialActive','dialMethod','outbound','startCase','Queues','name','filter','getRealtimeQueues','catch','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','offset','undefined','count','limit','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','order','getAgentIdsByQueues','getRealtimeAgents','rows','getAgentIdsByStatus','map','User','fieldName','key','role','agent','getOptions','raw','length','sequelize','literal','FIELD(id,','push','forEach','Pause','where','merge'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0x2b20,0x6e));var _0x02b2=function(_0x338cb9,_0x3f17fa){_0x338cb9=_0x338cb9-0x0;var _0x9a8658=_0x2b20[_0x338cb9];return _0x9a8658;};'use strict';var _=require('lodash');var util=require('util');var rta=require(_0x02b2('0x0'));var rtq=require(_0x02b2('0x1'));var qs=require(_0x02b2('0x2'));var utils=require(_0x02b2('0x3'));var db=require(_0x02b2('0x4'))['db'];var APIBadRequestError=require(_0x02b2('0x5'))[_0x02b2('0x6')];var APIHandleError=require('../../errors/api')['handleError'];function respondWithFilteredResult(_0x13cb1f,_0x2810e6){return function(_0x2f2062){if(_0x2f2062){var _0x1b86f6=typeof _0x2810e6[_0x02b2('0x7')]===_0x02b2('0x8')&&typeof _0x2810e6['limit']==='undefined';var _0x5eef67=_0x2f2062['count'];var _0x435be8=_0x1b86f6?0x0:_0x2810e6[_0x02b2('0x7')];var _0x1e11d1=_0x1b86f6?_0x2f2062[_0x02b2('0x9')]:_0x2810e6['offset']+_0x2810e6[_0x02b2('0xa')];var _0x598c31;if(_0x1e11d1>=_0x5eef67){_0x1e11d1=_0x5eef67;_0x598c31=0xc8;}else{_0x598c31=0xce;}_0x13cb1f['status'](_0x598c31);return _0x13cb1f[_0x02b2('0xb')](_0x02b2('0xc'),_0x435be8+'-'+_0x1e11d1+'/'+_0x5eef67)[_0x02b2('0xd')](_0x2f2062);}return null;};}exports[_0x02b2('0xe')]=function(_0x1c1743,_0x286fc3){var _0x1ca55f={'count':0x0,'rows':[]};var _0x38f55f={};var _0x4fd16b;var _0x119df5=utils[_0x02b2('0xf')]();var _0x276470;var _0x1d828d;var _0x2c89b8=_0x1c1743[_0x02b2('0x10')][_0x02b2('0x11')];var _0x44e791=_0x1c1743['query'][_0x02b2('0x12')];var _0xa942b8=_0x1c1743[_0x02b2('0x10')][_0x02b2('0x13')];var _0x2c6934=_0x44e791==='pause'||_0x44e791===_0x02b2('0x14')?!![]:![];var _0x212c5f=[];var _0x363899;var _0x54d4cb;Promise[_0x02b2('0x15')]()[_0x02b2('0x16')](function(){if(_0x1c1743[_0x02b2('0x10')][_0x02b2('0x17')]){if(!utils[_0x02b2('0x18')](_0x1c1743[_0x02b2('0x10')]['channel'])){throw new APIBadRequestError(util[_0x02b2('0x19')](_0x02b2('0x1a'),_0x1c1743['query']['channel']));}_0x4fd16b=_0x1c1743[_0x02b2('0x10')]['channel'][_0x02b2('0x1b')]();}if(!_0x1c1743['query'][_0x02b2('0x1c')]||!_0x1c1743[_0x02b2('0x10')][_0x02b2('0x1c')][_0x02b2('0x1d')](_0x02b2('0x1e'))){_0x1c1743[_0x02b2('0x10')]['sort']=rta[_0x02b2('0x1f')](_0x1c1743[_0x02b2('0x10')][_0x02b2('0x1c')]);return;}var _0x9b5d56=rta[_0x02b2('0x20')](_0x1c1743['query'][_0x02b2('0x1c')]);_0x1c1743[_0x02b2('0x10')][_0x02b2('0x1c')]=_0x9b5d56[_0x02b2('0x21')]['join'](',');_0x363899=_0x9b5d56[_0x02b2('0x22')];})['then'](function(){if(!_0x2c89b8){return[];}return rta[_0x02b2('0x23')](_0x2c89b8,_0x4fd16b);})[_0x02b2('0x16')](function(_0x264cc9){_0x212c5f=_0x264cc9;return rta[_0x02b2('0x24')]();})[_0x02b2('0x16')](function(_0x3ebae3){_0x1d828d=_0x3ebae3[_0x02b2('0x25')];if((!_0x44e791||_0x2c6934)&&!_0x363899){return _0x212c5f;}if(_0x363899&&!_0x44e791){return rta['getSortedAgentsIdsByStatus'](_0x1d828d,_0x212c5f,_0x363899);}else{return rta[_0x02b2('0x26')](_0x1d828d,_0x212c5f,_0x44e791);}})[_0x02b2('0x16')](function(_0xe169ab){_0x212c5f=_0xe169ab;var _0xa5f227=![];if(_0x212c5f['length']===0x0){if(_0x2c89b8||_0x44e791){_0xa5f227=!![];}if(_0x2c6934){_0xa5f227=![];}}if(_0xa5f227){return _0x1ca55f;}var _0x46a490=_[_0x02b2('0x27')](db[_0x02b2('0x28')]['rawAttributes'],function(_0x4a1af4){return{'name':_0x4a1af4[_0x02b2('0x29')],'type':_0x4a1af4['type'][_0x02b2('0x2a')]};});_0x1c1743[_0x02b2('0x10')][_0x02b2('0x2b')]=_0x02b2('0x2c');_0x38f55f=qs[_0x02b2('0x2d')](_0x46a490,_0x1c1743);_0x38f55f[_0x02b2('0x2e')]=!![];var _0x3b3a19=[];if(_0x212c5f[_0x02b2('0x2f')]>0x0){_0x3b3a19['push']({'id':{'$in':_0x212c5f}});if(_0x363899&&!_0x44e791){_0x54d4cb=[db[_0x02b2('0x30')][_0x02b2('0x31')](_0x02b2('0x32')+_0x212c5f+')')];_0x38f55f['order']=_0x54d4cb;}}if(_0x2c6934){_0x119df5['forEach'](function(_0x226135){var _0x29fae7=!![];if(_0x44e791===_0x02b2('0x14')&&_0x4fd16b!==_0x226135){_0x29fae7=![];}_0x3b3a19[_0x02b2('0x33')]({[_0x226135+'Pause']:_0x29fae7});});if(_0xa942b8){_0x3b3a19[_0x02b2('0x33')]({'pauseType':_0xa942b8});}}else if(_0x44e791){_0x119df5[_0x02b2('0x34')](function(_0x6bce0b){_0x3b3a19[_0x02b2('0x33')]({[_0x6bce0b+_0x02b2('0x35')]:![]});});}_0x38f55f[_0x02b2('0x36')]=_[_0x02b2('0x37')](_0x38f55f[_0x02b2('0x36')],{'$and':_0x3b3a19});if(_0x1c1743[_0x02b2('0x38')][_0x02b2('0x2b')]==='user'){var _0x746894={'params':{'id':_0x1c1743[_0x02b2('0x38')][_0x02b2('0x39')]},'query':{'section':'Agents','role':_0x02b2('0x2c'),'raw':!![],'ids':_0x212c5f,'customSorting':_0x54d4cb}};if(_0x1c1743[_0x02b2('0x10')]['online']){_0x746894['query'][_0x02b2('0x3a')]=!![];}if(_0x2c6934){_0x746894[_0x02b2('0x10')][_0x02b2('0x3b')]=_0x3b3a19;}_0x746894[_0x02b2('0x10')]=Object[_0x02b2('0x3c')](_0x746894[_0x02b2('0x10')],_['omit'](_0x1c1743[_0x02b2('0x10')],'id'));return db[_0x02b2('0x3d')][_0x02b2('0x3e')](_0x746894);}return db[_0x02b2('0x28')][_0x02b2('0x3f')](_0x38f55f);})['then'](function(_0x296a22){_0x1ca55f[_0x02b2('0x9')]=_0x296a22[_0x02b2('0x9')];_0x276470=_0x296a22[_0x02b2('0x25')];return _0x276470[_0x02b2('0x27')](function(_0xe9c93){var _0x34c5b9=_[_0x02b2('0x40')](_0x1d828d,['id',_0xe9c93['id']]);if(_0x34c5b9){var _0x10b8ba=rta['filterAgentAttributes'](_0x34c5b9);_[_0x02b2('0x37')](_0xe9c93,_0x10b8ba);}_0xe9c93[_0x02b2('0x1e')]=rta[_0x02b2('0x41')](_0xe9c93);if(_0xe9c93[_0x02b2('0x1e')]['includes'](_0x02b2('0x42'))){_0x119df5['forEach'](function(_0x4cd016){if(_0xe9c93[_0x4cd016+_0x02b2('0x35')]){if(_0x4cd016===_0x02b2('0x43')){if(_0xe9c93[_0x02b2('0x44')]!==_0x02b2('0x45')){_0xe9c93[_0x02b2('0x44')]='pause';}}else{_0xe9c93[_0x4cd016+'Status']=_0x02b2('0x42');}}});}return _0xe9c93;});})[_0x02b2('0x16')](function(_0x190e3e){if(!_0x363899||_0x54d4cb){return _0x190e3e;}return rta['sortAgentsByStatus'](_0x190e3e,_0x363899);})[_0x02b2('0x16')](function(_0x3cb154){var _0x36ba0a=rta['getRealtimeAgentsQueryFields']();_0x1ca55f[_0x02b2('0x25')]=_0x3cb154[_0x02b2('0x27')](function(_0x4d811b){return _[_0x02b2('0x46')](_0x4d811b,_0x36ba0a);});return _0x1ca55f;})[_0x02b2('0x16')](respondWithFilteredResult(_0x286fc3,_0x38f55f))['catch'](APIHandleError(_0x286fc3));};exports[_0x02b2('0x47')]=function(_0x27e4cc,_0x26d7dd){var _0x1f886c={'count':0x0,'rows':[]};var _0x2e01ad={};var _0x44c653;var _0x448491;var _0x17c55f;Promise['resolve']()[_0x02b2('0x16')](function(){if(_0x27e4cc[_0x02b2('0x10')][_0x02b2('0x17')]){if(!utils[_0x02b2('0x18')](_0x27e4cc['query'][_0x02b2('0x17')])){throw new APIBadRequestError(util[_0x02b2('0x19')](_0x02b2('0x1a'),_0x27e4cc['query']['channel']));}_0x44c653=_0x27e4cc[_0x02b2('0x10')]['channel'][_0x02b2('0x1b')]();}var _0xd87164=_['startCase'](_0x44c653)+'Queue';var _0x527f1e=_[_0x02b2('0x27')](db[_0xd87164][_0x02b2('0x48')],function(_0x3185ca){return{'name':_0x3185ca[_0x02b2('0x29')],'type':_0x3185ca['type'][_0x02b2('0x2a')]};});if(!_0x27e4cc[_0x02b2('0x10')]['fields']){var _0x44c4b2=['id','name'];if(_0x44c653==='voice'){_0x44c4b2[_0x02b2('0x33')](_0x02b2('0x49'));if(_0x27e4cc[_0x02b2('0x10')][_0x02b2('0x49')]==='outbound'){_0x44c4b2[_0x02b2('0x33')]([_0x02b2('0x4a'),_0x02b2('0x4b')]);}}_0x27e4cc[_0x02b2('0x10')][_0x02b2('0x21')]=_0x44c4b2['join'](',');}_0x2e01ad=qs[_0x02b2('0x2d')](_0x527f1e,_0x27e4cc);if(_0x27e4cc['user'][_0x02b2('0x2b')]===_0x02b2('0x38')){var _0x6cabd8={'params':{'id':_0x27e4cc['user'][_0x02b2('0x39')]},'query':{'section':_0x44c653==='voice'&&_0x27e4cc['query']['type']===_0x02b2('0x4c')?'QueueCampaigns':_[_0x02b2('0x4d')](_0x44c653)+_0x02b2('0x4e'),'type':_0x27e4cc[_0x02b2('0x10')][_0x02b2('0x49')],'nolimit':!![],'sort':_0x02b2('0x4f'),'filter':_0x27e4cc[_0x02b2('0x10')][_0x02b2('0x50')]}};_0x6cabd8[_0x02b2('0x10')]=Object[_0x02b2('0x3c')](_0x6cabd8[_0x02b2('0x10')],_0x27e4cc[_0x02b2('0x10')]);delete _0x6cabd8[_0x02b2('0x10')]['id'];return db[_0x02b2('0x3d')][_0x02b2('0x3e')](_0x6cabd8);}return db[_0xd87164][_0x02b2('0x3f')](_0x2e01ad);})['then'](function(_0x2aa80a){_0x1f886c[_0x02b2('0x9')]=_0x2aa80a[_0x02b2('0x9')];_0x448491=_0x2aa80a[_0x02b2('0x25')];return rtq[_0x02b2('0x51')](_0x27e4cc,_0x44c653);})[_0x02b2('0x16')](function(_0x24e3c6){_0x17c55f=_0x24e3c6[_0x02b2('0x25')];return rtq['initializeQueues'](_0x448491,_0x17c55f,_0x44c653,_0x27e4cc['query'][_0x02b2('0x49')]);})['then'](function(_0x2eb1a2){_0x1f886c['rows']=_0x2eb1a2;return _0x1f886c;})[_0x02b2('0x16')](respondWithFilteredResult(_0x26d7dd,_0x2e01ad))[_0x02b2('0x52')](APIHandleError(_0x26d7dd));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 7883262..af306cf 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x50ab95,_0x480438){var _0x2c62cd=function(_0x2af369){while(--_0x2af369){_0x50ab95['push'](_0x50ab95['shift']());}};_0x2c62cd(++_0x480438);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x24fccb,_0x149b9b){var _0x559f86=function(_0x1fa6d1){while(--_0x1fa6d1){_0x24fccb['push'](_0x24fccb['shift']());}};_0x559f86(++_0x149b9b);}(_0xe706,0xa3));var _0x6e70=function(_0x354e7a,_0x4e4dc0){_0x354e7a=_0x354e7a-0x0;var _0x17b550=_0xe706[_0x354e7a];return _0x17b550;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 78c29d7..e9c0972 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 _0x9432=['exports','STRING','DATE','sequelize'];(function(_0x13be98,_0x8fbfad){var _0xc50f71=function(_0x426a7f){while(--_0x426a7f){_0x13be98['push'](_0x13be98['shift']());}};_0xc50f71(++_0x8fbfad);}(_0x9432,0x1e3));var _0x2943=function(_0x1e55d8,_0x2807ae){_0x1e55d8=_0x1e55d8-0x0;var _0x1d7aec=_0x9432[_0x1e55d8];return _0x1d7aec;};'use strict';var Sequelize=require(_0x2943('0x0'));module[_0x2943('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x2943('0x2')]},'scheduledat':{'type':Sequelize[_0x2943('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x2943('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x2943('0x2')]},'campaigntype':{'type':Sequelize[_0x2943('0x2')]},'membername':{'type':Sequelize[_0x2943('0x2')]}}; \ No newline at end of file +var _0xf105=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf105,0x1b0));var _0x5f10=function(_0x51bde5,_0x40687b){_0x51bde5=_0x51bde5-0x0;var _0x2b4563=_0xf105[_0x51bde5];return _0x2b4563;};'use strict';var Sequelize=require(_0x5f10('0x0'));module[_0x5f10('0x1')]={'state':{'type':Sequelize[_0x5f10('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5f10('0x3')]},'scheduledat':{'type':Sequelize[_0x5f10('0x4')]},'uniqueid':{'type':Sequelize[_0x5f10('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x5f10('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5f10('0x3')]},'campaigntype':{'type':Sequelize[_0x5f10('0x3')]},'membername':{'type':Sequelize[_0x5f10('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index e4af901..fe620ae 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 _0x4ff0=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','report_agent_preview','lodash'];(function(_0x4435b3,_0x49c541){var _0x276e91=function(_0x883e48){while(--_0x883e48){_0x4435b3['push'](_0x4435b3['shift']());}};_0x276e91(++_0x49c541);}(_0x4ff0,0x8e));var _0x04ff=function(_0x5b15e7,_0x35861f){_0x5b15e7=_0x5b15e7-0x0;var _0x142c3e=_0x4ff0[_0x5b15e7];return _0x142c3e;};'use strict';var _=require(_0x04ff('0x0'));var util=require('util');var logger=require(_0x04ff('0x1'))(_0x04ff('0x2'));var moment=require(_0x04ff('0x3'));var BPromise=require(_0x04ff('0x4'));var rp=require(_0x04ff('0x5'));var fs=require('fs');var path=require(_0x04ff('0x6'));var rimraf=require(_0x04ff('0x7'));var config=require(_0x04ff('0x8'));var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x263d36,_0x530e50){return _0x263d36[_0x04ff('0x9')]('ReportAgentPreview',attributes,{'tableName':_0x04ff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18ee=['ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x18ee,0x11f));var _0xe18e=function(_0x230508,_0x2a358b){_0x230508=_0x230508-0x0;var _0xf29c9a=_0x18ee[_0x230508];return _0xf29c9a;};'use strict';var _=require(_0xe18e('0x0'));var util=require(_0xe18e('0x1'));var logger=require(_0xe18e('0x2'))(_0xe18e('0x3'));var moment=require(_0xe18e('0x4'));var BPromise=require(_0xe18e('0x5'));var rp=require(_0xe18e('0x6'));var fs=require('fs');var path=require(_0xe18e('0x7'));var rimraf=require(_0xe18e('0x8'));var config=require(_0xe18e('0x9'));var attributes=require(_0xe18e('0xa'));module[_0xe18e('0xb')]=function(_0x383947,_0x10ddfb){return _0x383947[_0xe18e('0xc')](_0xe18e('0xd'),attributes,{'tableName':_0xe18e('0xe'),'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 e91c886..6a6982d 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 _0x4e6a=['rpc','../../config/environment','jayson/promise','client','then','info','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','ReportAgentPreview','create','options','raw','debug','CreateReportAgentPreview','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x592a62,_0x85482a){var _0x14b007=function(_0x4febd6){while(--_0x4febd6){_0x592a62['push'](_0x592a62['shift']());}};_0x14b007(++_0x85482a);}(_0x4e6a,0xec));var _0xa4e6=function(_0x53a466,_0x22f158){_0x53a466=_0x53a466-0x0;var _0x48be60=_0x4e6a[_0x53a466];return _0x48be60;};'use strict';var _=require(_0xa4e6('0x0'));var util=require(_0xa4e6('0x1'));var moment=require(_0xa4e6('0x2'));var BPromise=require('bluebird');var rs=require(_0xa4e6('0x3'));var fs=require('fs');var Redis=require(_0xa4e6('0x4'));var db=require(_0xa4e6('0x5'))['db'];var utils=require(_0xa4e6('0x6'));var logger=require('../../config/logger')(_0xa4e6('0x7'));var config=require(_0xa4e6('0x8'));var jayson=require(_0xa4e6('0x9'));var client=jayson[_0xa4e6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f8502,_0x132703,_0x11a9cf){return new BPromise(function(_0x1942d7,_0x279f69){return client['request'](_0x2f8502,_0x11a9cf)[_0xa4e6('0xb')](function(_0x23318d){logger[_0xa4e6('0xc')](_0xa4e6('0xd'),_0x132703,'request\x20sent');logger['debug'](_0xa4e6('0xe'),_0x132703,'request\x20sent',JSON[_0xa4e6('0xf')](_0x23318d));if(_0x23318d[_0xa4e6('0x10')]){if(_0x23318d[_0xa4e6('0x10')]['code']===0x1f4){logger[_0xa4e6('0x10')](_0xa4e6('0xd'),_0x132703,_0x23318d[_0xa4e6('0x10')]['message']);return _0x279f69(_0x23318d[_0xa4e6('0x10')][_0xa4e6('0x11')]);}logger[_0xa4e6('0x10')](_0xa4e6('0xd'),_0x132703,_0x23318d['error'][_0xa4e6('0x11')]);return _0x1942d7(_0x23318d[_0xa4e6('0x10')][_0xa4e6('0x11')]);}else{logger['info'](_0xa4e6('0xd'),_0x132703,_0xa4e6('0x12'));_0x1942d7(_0x23318d[_0xa4e6('0x13')]['message']);}})[_0xa4e6('0x14')](function(_0xa34c95){logger[_0xa4e6('0x10')](_0xa4e6('0xd'),_0x132703,_0xa34c95);_0x279f69(_0xa34c95);});});}exports['CreateReportAgentPreview']=function(_0x4aa0e7){var _0x518a41=this;return new Promise(function(_0x3a8ff9,_0x2432cf){return db[_0xa4e6('0x15')][_0xa4e6('0x16')](_0x4aa0e7['body'],{'raw':_0x4aa0e7[_0xa4e6('0x17')]?_0x4aa0e7[_0xa4e6('0x17')][_0xa4e6('0x18')]===undefined?!![]:![]:!![]})[_0xa4e6('0xb')](function(_0x300666){logger['info']('CreateReportAgentPreview',_0x4aa0e7);logger[_0xa4e6('0x19')](_0xa4e6('0x1a'),_0x4aa0e7,JSON['stringify'](_0x300666));_0x3a8ff9(_0x300666);})['catch'](function(_0x265e4f){logger[_0xa4e6('0x10')](_0xa4e6('0x1a'),_0x265e4f[_0xa4e6('0x11')],_0x4aa0e7);_0x2432cf(_0x518a41[_0xa4e6('0x10')](0x1f4,_0x265e4f[_0xa4e6('0x11')]));});});}; \ No newline at end of file +var _0x93fb=['options','raw','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body'];(function(_0x2f8be8,_0x46cff7){var _0x58b0d7=function(_0x3fc1a8){while(--_0x3fc1a8){_0x2f8be8['push'](_0x2f8be8['shift']());}};_0x58b0d7(++_0x46cff7);}(_0x93fb,0x1d4));var _0xb93f=function(_0x11f3f2,_0x4abfcf){_0x11f3f2=_0x11f3f2-0x0;var _0x15369d=_0x93fb[_0x11f3f2];return _0x15369d;};'use strict';var _=require(_0xb93f('0x0'));var util=require(_0xb93f('0x1'));var moment=require(_0xb93f('0x2'));var BPromise=require(_0xb93f('0x3'));var rs=require(_0xb93f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb93f('0x5'))['db'];var utils=require(_0xb93f('0x6'));var logger=require('../../config/logger')(_0xb93f('0x7'));var config=require(_0xb93f('0x8'));var jayson=require(_0xb93f('0x9'));var client=jayson[_0xb93f('0xa')][_0xb93f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x301eef,_0xcadebe,_0x29d430){return new BPromise(function(_0x170619,_0x2cb8d6){return client[_0xb93f('0xc')](_0x301eef,_0x29d430)[_0xb93f('0xd')](function(_0x1b5ce8){logger[_0xb93f('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0xcadebe,_0xb93f('0xf'));logger[_0xb93f('0x10')](_0xb93f('0x11'),_0xcadebe,'request\x20sent',JSON[_0xb93f('0x12')](_0x1b5ce8));if(_0x1b5ce8[_0xb93f('0x13')]){if(_0x1b5ce8['error'][_0xb93f('0x14')]===0x1f4){logger[_0xb93f('0x13')](_0xb93f('0x15'),_0xcadebe,_0x1b5ce8['error'][_0xb93f('0x16')]);return _0x2cb8d6(_0x1b5ce8[_0xb93f('0x13')]['message']);}logger[_0xb93f('0x13')](_0xb93f('0x15'),_0xcadebe,_0x1b5ce8[_0xb93f('0x13')][_0xb93f('0x16')]);return _0x170619(_0x1b5ce8[_0xb93f('0x13')][_0xb93f('0x16')]);}else{logger[_0xb93f('0xe')](_0xb93f('0x15'),_0xcadebe,'request\x20sent');_0x170619(_0x1b5ce8[_0xb93f('0x17')][_0xb93f('0x16')]);}})['catch'](function(_0x3aa5be){logger[_0xb93f('0x13')](_0xb93f('0x15'),_0xcadebe,_0x3aa5be);_0x2cb8d6(_0x3aa5be);});});}exports[_0xb93f('0x18')]=function(_0x28578b){var _0xa9570c=this;return new Promise(function(_0x320dae,_0x29b629){return db[_0xb93f('0x19')][_0xb93f('0x1a')](_0x28578b[_0xb93f('0x1b')],{'raw':_0x28578b[_0xb93f('0x1c')]?_0x28578b[_0xb93f('0x1c')][_0xb93f('0x1d')]===undefined?!![]:![]:!![]})[_0xb93f('0xd')](function(_0x45d8b7){logger[_0xb93f('0xe')](_0xb93f('0x18'),_0x28578b);logger[_0xb93f('0x10')](_0xb93f('0x18'),_0x28578b,JSON[_0xb93f('0x12')](_0x45d8b7));_0x320dae(_0x45d8b7);})[_0xb93f('0x1e')](function(_0x537ed2){logger[_0xb93f('0x13')](_0xb93f('0x18'),_0x537ed2[_0xb93f('0x16')],_0x28578b);_0x29b629(_0xa9570c[_0xb93f('0x13')](0x1f4,_0x537ed2['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 40edbd6..f4442e2 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 _0xba3a=['/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','agents','put','/agents/:id/capacity','/telephones','telephones','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','/agents/:id/notify','multer','path','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup'];(function(_0x1eb75b,_0x2c3f99){var _0x207faa=function(_0x39131b){while(--_0x39131b){_0x1eb75b['push'](_0x1eb75b['shift']());}};_0x207faa(++_0x2c3f99);}(_0xba3a,0x84));var _0xaba3=function(_0x47b6b0,_0x47afce){_0x47b6b0=_0x47b6b0-0x0;var _0x3a9bf5=_0xba3a[_0x47b6b0];return _0x3a9bf5;};'use strict';var multer=require(_0xaba3('0x0'));var util=require('util');var path=require(_0xaba3('0x1'));var express=require('express');var router=express[_0xaba3('0x2')]();var auth=require(_0xaba3('0x3'));var controller=require('./rpc.controller');router[_0xaba3('0x4')](_0xaba3('0x5'),auth[_0xaba3('0x6')](),controller[_0xaba3('0x7')]);router[_0xaba3('0x4')](_0xaba3('0x8'),auth['isAuthenticated'](),controller[_0xaba3('0x9')]);router[_0xaba3('0x4')](_0xaba3('0xa'),auth[_0xaba3('0x6')](),controller[_0xaba3('0xb')]);router['get'](_0xaba3('0xc'),auth[_0xaba3('0x6')](),controller[_0xaba3('0xd')]);router[_0xaba3('0x4')](_0xaba3('0xe'),auth[_0xaba3('0x6')](),controller[_0xaba3('0xf')]);router[_0xaba3('0x4')]('/mail/queues',auth['isAuthenticated'](),controller[_0xaba3('0x10')]);router['get'](_0xaba3('0x11'),auth[_0xaba3('0x6')](),controller[_0xaba3('0x12')]);router[_0xaba3('0x4')](_0xaba3('0x13'),auth[_0xaba3('0x6')](),controller[_0xaba3('0x14')]);router['get']('/sms/queues',auth[_0xaba3('0x6')](),controller[_0xaba3('0x15')]);router['get']('/whatsapp/queues',auth['isAuthenticated'](),controller[_0xaba3('0x16')]);router['get'](_0xaba3('0x17'),auth[_0xaba3('0x6')](),controller[_0xaba3('0x18')]);router[_0xaba3('0x4')]('/voice/queues/preview/:id',auth[_0xaba3('0x6')](),controller[_0xaba3('0x19')]);router[_0xaba3('0x4')](_0xaba3('0x1a'),auth[_0xaba3('0x6')](),controller[_0xaba3('0x1b')]);router[_0xaba3('0x4')](_0xaba3('0x1c'),auth[_0xaba3('0x6')](),controller['voiceQueuesChannel']);router[_0xaba3('0x4')](_0xaba3('0x1d'),auth[_0xaba3('0x6')](),controller['voiceQueuesChannelHangup']);router[_0xaba3('0x4')](_0xaba3('0x1e'),auth[_0xaba3('0x6')](),controller[_0xaba3('0x1f')]);router[_0xaba3('0x4')](_0xaba3('0x20'),auth['isAuthenticated'](),controller[_0xaba3('0x21')]);router['put'](_0xaba3('0x20'),auth[_0xaba3('0x6')](),controller['updateVoiceQueue']);router[_0xaba3('0x4')](_0xaba3('0x22'),auth[_0xaba3('0x6')](),controller[_0xaba3('0x23')]);router[_0xaba3('0x4')](_0xaba3('0x24'),auth[_0xaba3('0x6')](),controller[_0xaba3('0x25')]);router[_0xaba3('0x4')]('/agents',auth[_0xaba3('0x6')](),controller[_0xaba3('0x26')]);router[_0xaba3('0x27')](_0xaba3('0x28'),auth[_0xaba3('0x6')](),controller['agentCapacity']);router['get'](_0xaba3('0x29'),auth[_0xaba3('0x6')](),controller[_0xaba3('0x2a')]);router['get']('/trunks',auth[_0xaba3('0x6')](),controller['trunks']);router[_0xaba3('0x4')](_0xaba3('0x2b'),auth[_0xaba3('0x6')](),controller[_0xaba3('0x2c')]);router[_0xaba3('0x4')](_0xaba3('0x2d'),auth[_0xaba3('0x6')](),controller[_0xaba3('0x2e')]);router[_0xaba3('0x4')](_0xaba3('0x2f'),auth[_0xaba3('0x6')](),controller[_0xaba3('0x30')]);router[_0xaba3('0x4')](_0xaba3('0x31'),auth['isAuthenticated'](),controller[_0xaba3('0x32')]);router[_0xaba3('0x4')](_0xaba3('0x33'),auth[_0xaba3('0x6')](),controller[_0xaba3('0x34')]);router['get'](_0xaba3('0x35'),auth['isAuthenticated'](),controller[_0xaba3('0x36')]);router['get']('/sms/queues/waitinginteractions',auth[_0xaba3('0x6')](),controller[_0xaba3('0x37')]);router[_0xaba3('0x4')](_0xaba3('0x38'),auth[_0xaba3('0x6')](),controller[_0xaba3('0x39')]);router[_0xaba3('0x4')](_0xaba3('0x3a'),auth[_0xaba3('0x6')](),controller[_0xaba3('0x3b')]);router[_0xaba3('0x3c')](_0xaba3('0x3d'),auth[_0xaba3('0x6')](),controller[_0xaba3('0x3e')](_0xaba3('0x3f')));router[_0xaba3('0x4')](_0xaba3('0x40'),auth[_0xaba3('0x6')](),controller[_0xaba3('0x41')]);router[_0xaba3('0x3c')](_0xaba3('0x42'),auth['isAuthenticated'](),controller[_0xaba3('0x3e')](_0xaba3('0x43')));router[_0xaba3('0x4')](_0xaba3('0x44'),auth[_0xaba3('0x6')](),controller['showChatQueues']);router[_0xaba3('0x3c')](_0xaba3('0x45'),auth[_0xaba3('0x6')](),controller['queueNotify'](_0xaba3('0x46')));router[_0xaba3('0x4')]('/fax/queues/:id',auth[_0xaba3('0x6')](),controller[_0xaba3('0x47')]);router[_0xaba3('0x3c')](_0xaba3('0x48'),auth['isAuthenticated'](),controller[_0xaba3('0x3e')](_0xaba3('0x49')));router[_0xaba3('0x4')]('/openchannel/queues/:id',auth[_0xaba3('0x6')](),controller[_0xaba3('0x4a')]);router[_0xaba3('0x3c')]('/sms/queues/:id/notify',auth[_0xaba3('0x6')](),controller[_0xaba3('0x3e')](_0xaba3('0x4b')));router['post'](_0xaba3('0x4c'),auth[_0xaba3('0x6')](),controller[_0xaba3('0x3e')](_0xaba3('0x4d')));router[_0xaba3('0x4')](_0xaba3('0x4e'),auth[_0xaba3('0x6')](),controller['showSmsQueues']);router[_0xaba3('0x4')](_0xaba3('0x4f'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router[_0xaba3('0x3c')](_0xaba3('0x50'),auth[_0xaba3('0x6')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0x9493=['/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailAccounts','/sms/queues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','fax','/fax/queues/:id','openchannel','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','Router','../../components/auth/service','./rpc.controller','/voice/channels','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor'];(function(_0x2c7adf,_0x49af98){var _0x4857b5=function(_0x13f6ba){while(--_0x13f6ba){_0x2c7adf['push'](_0x2c7adf['shift']());}};_0x4857b5(++_0x49af98);}(_0x9493,0x17a));var _0x3949=function(_0x848fee,_0x3e5442){_0x848fee=_0x848fee-0x0;var _0x5822ce=_0x9493[_0x848fee];return _0x5822ce;};'use strict';var multer=require(_0x3949('0x0'));var util=require(_0x3949('0x1'));var path=require(_0x3949('0x2'));var express=require('express');var router=express[_0x3949('0x3')]();var auth=require(_0x3949('0x4'));var controller=require(_0x3949('0x5'));router['get'](_0x3949('0x6'),auth['isAuthenticated'](),controller[_0x3949('0x7')]);router[_0x3949('0x8')](_0x3949('0x9'),auth[_0x3949('0xa')](),controller[_0x3949('0xb')]);router['get'](_0x3949('0xc'),auth[_0x3949('0xa')](),controller[_0x3949('0xd')]);router[_0x3949('0x8')](_0x3949('0xe'),auth[_0x3949('0xa')](),controller[_0x3949('0xf')]);router['get'](_0x3949('0x10'),auth['isAuthenticated'](),controller[_0x3949('0x11')]);router['get'](_0x3949('0x12'),auth[_0x3949('0xa')](),controller['mailQueues']);router[_0x3949('0x8')]('/mail/accounts',auth[_0x3949('0xa')](),controller[_0x3949('0x13')]);router[_0x3949('0x8')]('/openchannel/queues',auth['isAuthenticated'](),controller['openchannelQueues']);router['get'](_0x3949('0x14'),auth['isAuthenticated'](),controller['smsQueues']);router['get'](_0x3949('0x15'),auth[_0x3949('0xa')](),controller['whatsappQueues']);router[_0x3949('0x8')](_0x3949('0x16'),auth[_0x3949('0xa')](),controller[_0x3949('0x17')]);router['get'](_0x3949('0x18'),auth['isAuthenticated'](),controller['voiceQueuesPreview']);router[_0x3949('0x8')](_0x3949('0x19'),auth[_0x3949('0xa')](),controller[_0x3949('0x1a')]);router[_0x3949('0x8')](_0x3949('0x1b'),auth[_0x3949('0xa')](),controller['voiceQueuesChannel']);router['get'](_0x3949('0x1c'),auth[_0x3949('0xa')](),controller[_0x3949('0x1d')]);router[_0x3949('0x8')](_0x3949('0x1e'),auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router[_0x3949('0x8')](_0x3949('0x1f'),auth[_0x3949('0xa')](),controller[_0x3949('0x20')]);router[_0x3949('0x21')](_0x3949('0x1f'),auth['isAuthenticated'](),controller[_0x3949('0x22')]);router[_0x3949('0x8')](_0x3949('0x23'),auth[_0x3949('0xa')](),controller['outbound']);router[_0x3949('0x8')](_0x3949('0x24'),auth[_0x3949('0xa')](),controller[_0x3949('0x25')]);router[_0x3949('0x8')](_0x3949('0x26'),auth['isAuthenticated'](),controller[_0x3949('0x27')]);router[_0x3949('0x21')](_0x3949('0x28'),auth[_0x3949('0xa')](),controller[_0x3949('0x29')]);router[_0x3949('0x8')](_0x3949('0x2a'),auth['isAuthenticated'](),controller[_0x3949('0x2b')]);router[_0x3949('0x8')]('/trunks',auth['isAuthenticated'](),controller[_0x3949('0x2c')]);router[_0x3949('0x8')](_0x3949('0x2d'),auth[_0x3949('0xa')](),controller[_0x3949('0x2e')]);router[_0x3949('0x8')](_0x3949('0x2f'),auth[_0x3949('0xa')](),controller[_0x3949('0x30')]);router[_0x3949('0x8')](_0x3949('0x31'),auth[_0x3949('0xa')](),controller[_0x3949('0x32')]);router[_0x3949('0x8')]('/mail/queues/waitinginteractions',auth[_0x3949('0xa')](),controller[_0x3949('0x33')]);router[_0x3949('0x8')](_0x3949('0x34'),auth[_0x3949('0xa')](),controller[_0x3949('0x35')]);router[_0x3949('0x8')](_0x3949('0x36'),auth[_0x3949('0xa')](),controller[_0x3949('0x37')]);router[_0x3949('0x8')](_0x3949('0x38'),auth[_0x3949('0xa')](),controller[_0x3949('0x39')]);router[_0x3949('0x8')](_0x3949('0x3a'),auth[_0x3949('0xa')](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0x3949('0x3b'),auth[_0x3949('0xa')](),controller[_0x3949('0x3c')]);router[_0x3949('0x3d')]('/mail/queues/:id/notify',auth[_0x3949('0xa')](),controller[_0x3949('0x3e')]('mail'));router[_0x3949('0x8')](_0x3949('0x3f'),auth[_0x3949('0xa')](),controller[_0x3949('0x40')]);router[_0x3949('0x3d')](_0x3949('0x41'),auth[_0x3949('0xa')](),controller['queueNotify'](_0x3949('0x42')));router[_0x3949('0x8')]('/chat/queues/:id',auth[_0x3949('0xa')](),controller[_0x3949('0x43')]);router[_0x3949('0x3d')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0x3949('0x3e')](_0x3949('0x44')));router[_0x3949('0x8')](_0x3949('0x45'),auth['isAuthenticated'](),controller['showFaxQueues']);router['post']('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0x3949('0x3e')](_0x3949('0x46')));router[_0x3949('0x8')]('/openchannel/queues/:id',auth[_0x3949('0xa')](),controller['showOpenchannelQueues']);router[_0x3949('0x3d')](_0x3949('0x47'),auth[_0x3949('0xa')](),controller[_0x3949('0x3e')](_0x3949('0x48')));router[_0x3949('0x3d')](_0x3949('0x49'),auth[_0x3949('0xa')](),controller[_0x3949('0x3e')](_0x3949('0x4a')));router[_0x3949('0x8')]('/sms/queues/:id',auth[_0x3949('0xa')](),controller['showSmsQueues']);router[_0x3949('0x8')]('/whatsapp/queues/:id',auth[_0x3949('0xa')](),controller[_0x3949('0x4b')]);router[_0x3949('0x3d')](_0x3949('0x4c'),auth[_0x3949('0xa')](),controller[_0x3949('0x4d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index a3944b2..4aa9cde 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 _0xb10b=['showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','*,*,*,*','agentNotify','channel','chat','User','Agent\x20not\x20found','Start','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','then','error','message','result','status','json','stack','name','send','isNil','rows','find','voiceChannels','query','catch','voiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','showVoiceQueues','VoiceQueues','UpdateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','SIP/%s','interface','agent','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues'];(function(_0x2af009,_0x5432ee){var _0x46d15f=function(_0x26569f){while(--_0x26569f){_0x2af009['push'](_0x2af009['shift']());}};_0x46d15f(++_0x5432ee);}(_0xb10b,0x12a));var _0xbb10=function(_0x3aea4e,_0x3da357){_0x3aea4e=_0x3aea4e-0x0;var _0x2e9db0=_0xb10b[_0x3aea4e];return _0x2e9db0;};'use strict';var BPromise=require(_0xbb10('0x0'));var moment=require('moment');var _=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var db=require(_0xbb10('0x3'))['db'];var logger=require('../../config/logger')(_0xbb10('0x4'));var jayson=require(_0xbb10('0x5'));var amiClient=jayson[_0xbb10('0x6')][_0xbb10('0x7')]({'port':0x232a});var mailClient=jayson[_0xbb10('0x6')][_0xbb10('0x7')]({'port':0x232b});var routingClient=jayson['client'][_0xbb10('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){var _0x1c3ee5=_0x1b9e94?_0x1b9e94:amiClient;return _0x1c3ee5[_0xbb10('0x8')](_0x3cdd53,_0x513741)[_0xbb10('0x9')](function(_0x229887){if(_0x229887[_0xbb10('0xa')]){if(_0x229887['error']['code']===0x1f4){return _0x21370f(_0x229887[_0xbb10('0xa')][_0xbb10('0xb')]);}return _0x3fb675(_0x229887[_0xbb10('0xa')]['message']);}else{_0x3fb675(_0x229887[_0xbb10('0xc')]);}})['catch'](function(_0x44fb19){_0x21370f(_0x44fb19);});});}function respondWithResult(_0x916a32,_0x285009){_0x285009=_0x285009||0xc8;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0xd')](_0x285009)[_0xbb10('0xe')](_0x193a27);}return _0x916a32['sendStatus'](0x194);};}function handleError(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0x1f4;return function(_0x45b9d6){logger[_0xbb10('0xa')](_0x45b9d6[_0xbb10('0xf')]);if(_0x45b9d6[_0xbb10('0x10')]){delete _0x45b9d6[_0xbb10('0x10')];}_0x26e021[_0xbb10('0xd')](_0x42d7e4)[_0xbb10('0x11')](_0x45b9d6);};}function findById(_0x2b184e){return function(_0x4a2bfc){if(!_[_0xbb10('0x12')](_0x2b184e)&&!_[_0xbb10('0x12')](_0x4a2bfc)&&!_[_0xbb10('0x12')](_0x4a2bfc[_0xbb10('0x13')])){return _[_0xbb10('0x14')](_0x4a2bfc[_0xbb10('0x13')],function(_0x575cca){return _0x575cca['id']==_0x2b184e;});}return null;};}exports[_0xbb10('0x15')]=function(_0xbf2906,_0xe1c665){return respondWithRpcPromise('VoiceChannels',_0xbf2906[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0xe1c665,null))[_0xbb10('0x17')](handleError(_0xe1c665,null));};exports[_0xbb10('0x18')]=function(_0xdf237d,_0x44e563){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xbb10('0x19')](_0xdf237d[_0xbb10('0x16')],_0xdf237d['params']))['then'](respondWithResult(_0x44e563,null))[_0xbb10('0x17')](handleError(_0x44e563,null));};exports[_0xbb10('0x1a')]=function(_0x2e911d,_0x317da4){return respondWithRpcPromise(_0xbb10('0x1b'),_[_0xbb10('0x19')](_0x2e911d[_0xbb10('0x16')],_0x2e911d[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x317da4,null))[_0xbb10('0x17')](handleError(_0x317da4,null));};exports[_0xbb10('0x1d')]=function(_0x26ad93,_0x537898){return respondWithRpcPromise('VoiceQueues',_0x26ad93['query'])[_0xbb10('0x9')](respondWithResult(_0x537898,null))[_0xbb10('0x17')](handleError(_0x537898,null));};exports[_0xbb10('0x1e')]=function(_0x4e25ff,_0x2fdde9){return respondWithRpcPromise(_0xbb10('0x1f'),_0x4e25ff[_0xbb10('0x16')])[_0xbb10('0x9')](findById(_0x4e25ff[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x2fdde9,null))[_0xbb10('0x17')](handleError(_0x2fdde9,null));};exports['updateVoiceQueue']=function(_0x3796c7,_0x21ac54){return respondWithRpcPromise(_0xbb10('0x20'),_[_0xbb10('0x19')](_0x3796c7[_0xbb10('0x21')],_0x3796c7[_0xbb10('0x1c')]))['then'](respondWithResult(_0x21ac54,null))[_0xbb10('0x17')](handleError(_0x21ac54,null));};exports['voiceQueuesPreview']=function(_0x448d5c,_0x56f2da){return respondWithRpcPromise(_0xbb10('0x22'),_[_0xbb10('0x19')](_0x448d5c[_0xbb10('0x16')],_0x448d5c['params']))['then'](respondWithResult(_0x56f2da,null))[_0xbb10('0x17')](handleError(_0x56f2da,null));};exports[_0xbb10('0x23')]=function(_0x4f590d,_0x359ad4){return respondWithRpcPromise(_0xbb10('0x24'),_0x4f590d[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x359ad4,null))[_0xbb10('0x17')](handleError(_0x359ad4,null));};exports[_0xbb10('0x25')]=function(_0xf85197,_0x4975f5){return respondWithRpcPromise(_0xbb10('0x26'),_[_0xbb10('0x19')](_0xf85197[_0xbb10('0x16')],_0xf85197[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x4975f5,null))[_0xbb10('0x17')](handleError(_0x4975f5,null));};exports[_0xbb10('0x27')]=function(_0x10202c,_0x3c8d7d){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xbb10('0x19')](_0x10202c[_0xbb10('0x16')],_0x10202c[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x3c8d7d,null))['catch'](handleError(_0x3c8d7d,null));};exports[_0xbb10('0x28')]=function(_0x5de37b,_0x4e2754){return respondWithRpcPromise(_0xbb10('0x29'),_[_0xbb10('0x19')](_0x5de37b[_0xbb10('0x16')],_0x5de37b[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x4e2754,null))[_0xbb10('0x17')](handleError(_0x4e2754,null));};exports['outbound']=function(_0x1e5bbd,_0x25d72f){return respondWithRpcPromise('Outbound',_0x1e5bbd['query'])['then'](respondWithResult(_0x25d72f,null))[_0xbb10('0x17')](handleError(_0x25d72f,null));};exports[_0xbb10('0x2a')]=function(_0x2b658a,_0x4d5a9b){return respondWithRpcPromise(_0xbb10('0x2b'),_0x2b658a[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x4d5a9b,null))['catch'](handleError(_0x4d5a9b,null));};exports[_0xbb10('0x2c')]=function(_0x12238a,_0x1dcd38){var _0x446f49;return respondWithRpcPromise('Agents',_0x12238a[_0xbb10('0x16')])[_0xbb10('0x9')](function(_0x5835fd){_0x446f49=_0x5835fd;return respondWithRpcPromise(_0xbb10('0x2d'),_0x12238a[_0xbb10('0x16')],routingClient);})[_0xbb10('0x9')](function(_0x3a9934){return _[_0xbb10('0x19')]({},_0x3a9934,_0x446f49);})[_0xbb10('0x9')](respondWithResult(_0x1dcd38,null))['catch'](handleError(_0x1dcd38,null));};exports[_0xbb10('0x2e')]=function(_0x1c7fae,_0x3e7b4c){if(_0x1c7fae[_0xbb10('0x21')]&&_0x1c7fae['body'][_0xbb10('0x2f')]&&_0x1c7fae[_0xbb10('0x30')]&&_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')]){for(var _0x5e2cfa in _0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')]){if(_0x1c7fae['body']['interaction'][_0xbb10('0x31')](_0x5e2cfa)){db['MemberReport'][_0xbb10('0x32')]({'where':{'channel':_0x5e2cfa,'membername':_0x1c7fae[_0xbb10('0x30')]['name'],'type':_0xbb10('0x33'),'exitAt':null,'uniqueid':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')][_0x5e2cfa]&&_0x1c7fae['body'][_0xbb10('0x2f')][_0x5e2cfa][_0xbb10('0x34')]?{'$notIn':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')][_0x5e2cfa]}:{'$ne':null}}})[_0xbb10('0x9')](function(_0x19f94d){var _0x190781=moment()[_0xbb10('0x35')](_0xbb10('0x36'));for(var _0x43b948=0x0,_0x197871=_0x19f94d[_0xbb10('0x34')];_0x43b948<_0x197871;_0x43b948+=0x1){_0x19f94d[_0x43b948]['updateAttributes']({'exitAt':_0x190781});}});for(var _0x426b95=0x0;_0x426b95<_0x1c7fae[_0xbb10('0x21')]['interaction'][_0x5e2cfa][_0xbb10('0x34')];_0x426b95+=0x1){db[_0xbb10('0x37')][_0xbb10('0x38')]({'where':{'channel':_0x5e2cfa,'membername':_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')],'type':_0xbb10('0x33'),'uniqueid':_0x1c7fae[_0xbb10('0x21')]['interaction'][_0x5e2cfa][_0x426b95],'exitAt':null},'defaults':{'channel':_0x5e2cfa,'membername':_0x1c7fae['user'][_0xbb10('0x10')],'interface':_[_0xbb10('0x12')](_0x1c7fae[_0xbb10('0x30')]['interface'])?util['format'](_0xbb10('0x39'),_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')]):_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x3a')],'type':_0xbb10('0x33'),'enterAt':moment()[_0xbb10('0x35')](_0xbb10('0x36')),'role':_0xbb10('0x3b'),'internal':_0x1c7fae[_0xbb10('0x30')]['internal'],'uniqueid':_0x1c7fae['body'][_0xbb10('0x2f')][_0x5e2cfa][_0x426b95]}});}}}}return respondWithRpcPromise(_0xbb10('0x3c'),{'id':_0x1c7fae[_0xbb10('0x1c')]['id'],'capacity':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x3d')]},routingClient)[_0xbb10('0x9')](respondWithResult(_0x3e7b4c,null))[_0xbb10('0x17')](handleError(_0x3e7b4c,null));};exports[_0xbb10('0x3e')]=function(_0x1c0d8f,_0x1214f7){return respondWithRpcPromise(_0xbb10('0x3f'),_0x1c0d8f[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x1214f7,null))[_0xbb10('0x17')](handleError(_0x1214f7,null));};exports[_0xbb10('0x40')]=function(_0x547a7a,_0x124052){return respondWithRpcPromise('Trunks',_0x547a7a[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x124052,null))[_0xbb10('0x17')](handleError(_0x124052,null));};exports[_0xbb10('0x41')]=function(_0x26e66e,_0x32d8e9){return respondWithRpcPromise(_0xbb10('0x42'),_0x26e66e[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x32d8e9,null))[_0xbb10('0x17')](handleError(_0x32d8e9,null));};exports[_0xbb10('0x43')]=function(_0x1c2dce,_0x1d49e1){return respondWithRpcPromise(_0xbb10('0x44'),_0x1c2dce[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x1d49e1,null))[_0xbb10('0x17')](handleError(_0x1d49e1,null));};exports[_0xbb10('0x45')]=function(_0x1b83a9,_0x4ce8e7){return respondWithRpcPromise(_0xbb10('0x44'),_0x1b83a9[_0xbb10('0x16')],routingClient)['then'](findById(_0x1b83a9[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x4ce8e7,null))[_0xbb10('0x17')](handleError(_0x4ce8e7,null));};exports[_0xbb10('0x46')]=function(_0x432728,_0x22de7f){return respondWithRpcPromise(_0xbb10('0x47'),_0x432728[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x22de7f,null))[_0xbb10('0x17')](handleError(_0x22de7f,null));};exports[_0xbb10('0x48')]=function(_0x2a1ce1,_0x16932f){return respondWithRpcPromise('MailQueues',_0x2a1ce1['query'],routingClient)[_0xbb10('0x9')](findById(_0x2a1ce1[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x16932f,null))[_0xbb10('0x17')](handleError(_0x16932f,null));};exports['mailAccounts']=function(_0x506498,_0x79411e){return respondWithRpcPromise(_0xbb10('0x49'),_0x506498[_0xbb10('0x16')],mailClient)[_0xbb10('0x9')](respondWithResult(_0x79411e,null))[_0xbb10('0x17')](handleError(_0x79411e,null));};exports[_0xbb10('0x4a')]=function(_0x45c0dc,_0x4a5fb9){return respondWithRpcPromise(_0xbb10('0x4b'),_0x45c0dc[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x4a5fb9,null))['catch'](handleError(_0x4a5fb9,null));};exports['showOpenchannelQueues']=function(_0x32c1e8,_0x31c727){return respondWithRpcPromise(_0xbb10('0x4b'),_0x32c1e8['query'],routingClient)['then'](findById(_0x32c1e8['params']['id']))[_0xbb10('0x9')](respondWithResult(_0x31c727,null))[_0xbb10('0x17')](handleError(_0x31c727,null));};exports[_0xbb10('0x4c')]=function(_0x4e9fbd,_0xa1bbd9){return respondWithRpcPromise(_0xbb10('0x4d'),_0x4e9fbd['query'],routingClient)['then'](respondWithResult(_0xa1bbd9,null))[_0xbb10('0x17')](handleError(_0xa1bbd9,null));};exports[_0xbb10('0x4e')]=function(_0xd77753,_0x237246){return respondWithRpcPromise('SmsQueues',_0xd77753[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](findById(_0xd77753[_0xbb10('0x1c')]['id']))['then'](respondWithResult(_0x237246,null))[_0xbb10('0x17')](handleError(_0x237246,null));};exports[_0xbb10('0x4f')]=function(_0x3e3617,_0x5b2bd4){return respondWithRpcPromise(_0xbb10('0x50'),_0x3e3617[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x5b2bd4,null))[_0xbb10('0x17')](handleError(_0x5b2bd4,null));};exports['showWhatsappQueues']=function(_0x251417,_0x258e55){return respondWithRpcPromise(_0xbb10('0x50'),_0x251417[_0xbb10('0x16')],routingClient)['then'](findById(_0x251417[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x258e55,null))[_0xbb10('0x17')](handleError(_0x258e55,null));};exports[_0xbb10('0x51')]=function(_0x12f750,_0x17807e){return respondWithRpcPromise(_0xbb10('0x52'),_0x12f750['query'],routingClient)['then'](respondWithResult(_0x17807e,null))['catch'](handleError(_0x17807e,null));};exports[_0xbb10('0x53')]=function(_0x9c672d,_0x3eda96){return respondWithRpcPromise('FaxQueues',_0x9c672d['query'],routingClient)[_0xbb10('0x9')](findById(_0x9c672d[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x3eda96,null))[_0xbb10('0x17')](handleError(_0x3eda96,null));};exports[_0xbb10('0x54')]=function(_0x1ad2ed,_0x4cf2f3){return respondWithRpcPromise(_0xbb10('0x55'),_0x1ad2ed[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x4cf2f3,null))[_0xbb10('0x17')](handleError(_0x4cf2f3,null));};exports[_0xbb10('0x56')]=function(_0x5bfc68,_0x56094a){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5bfc68[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x56094a,null))[_0xbb10('0x17')](handleError(_0x56094a,null));};exports[_0xbb10('0x57')]=function(_0x2f7d2a,_0x1d40b8){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x2f7d2a[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x1d40b8,null))['catch'](handleError(_0x1d40b8,null));};exports['openchannelQueuesWaitingInteractions']=function(_0xdf634f,_0x13040d){return respondWithRpcPromise(_0xbb10('0x58'),_0xdf634f[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x13040d,null))[_0xbb10('0x17')](handleError(_0x13040d,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x576179,_0x165fe9){return respondWithRpcPromise(_0xbb10('0x58'),_0x576179[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](function(_0xfa3c7c){if(_0x576179['query'][_0xbb10('0x59')]!==undefined){var _0x19fcec=_(_0xfa3c7c[_0xbb10('0x13')])[_0xbb10('0x5a')]([_0x576179[_0xbb10('0x16')][_0xbb10('0x59')],_0x576179[_0xbb10('0x1c')]['id']])['map'](_0xbb10('0x5b'))[_0xbb10('0x5c')]()[_0xbb10('0x5d')]();return _0xfa3c7c[_0xbb10('0x13')][_0xbb10('0x5a')](function(_0x172be3){return _0x19fcec[_0xbb10('0x5e')](_0x172be3[_0xbb10('0x5b')])>-0x1;});}else{return _0xfa3c7c['rows'][_0xbb10('0x5a')](function(_0x218690){return _0x218690[_0xbb10('0x5b')]===parseInt(_0x576179['params']['id']);});}})['then'](respondWithResult(_0x165fe9,null))['catch'](handleError(_0x165fe9,null));};exports[_0xbb10('0x5f')]=function(_0x5a3c44,_0x4e3d6a){return respondWithRpcPromise(_0xbb10('0x60'),_0x5a3c44[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x4e3d6a,null))[_0xbb10('0x17')](handleError(_0x4e3d6a,null));};exports[_0xbb10('0x61')]=function(_0x24dca6,_0x33116){return respondWithRpcPromise(_0xbb10('0x62'),_0x24dca6[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x33116,null))[_0xbb10('0x17')](handleError(_0x33116,null));};exports[_0xbb10('0x63')]=function(_0x46b6d2,_0x35b811){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x46b6d2['query'],routingClient)[_0xbb10('0x9')](respondWithResult(_0x35b811,null))[_0xbb10('0x17')](handleError(_0x35b811,null));};exports[_0xbb10('0x64')]=function(_0x32bb25){return function(_0x5ee705,_0x17d596){var _0x275bce,_0x3f0d74;var _0xf7b3e1=_[_0xbb10('0x65')](_0x32bb25);var _0x517185=_0x32bb25==='chat'?_0xbb10('0x66'):_0xbb10('0x67');return db[_0xf7b3e1+_0xbb10('0x68')]['findOne']({'raw':!![],'where':{'id':_0x5ee705[_0xbb10('0x1c')]['id']}})[_0xbb10('0x9')](function(_0x50bcc9){if(_['isNil'](_0x50bcc9)){throw new Error(_0xf7b3e1+_0xbb10('0x69'));}_0x275bce=_0x50bcc9;return db[_0xf7b3e1+_0xbb10('0x6a')][_0xbb10('0x6b')]({'where':{'id':_0x5ee705['body'][_0xbb10('0x6c')]},'include':[{'model':db[_0xf7b3e1+_0xbb10('0x6d')],'as':_0xbb10('0x6d')},{'model':db[_0xf7b3e1+_0x517185],'as':_0xbb10('0x67')}]});})[_0xbb10('0x9')](function(_0x5de006){if(_[_0xbb10('0x12')](_0x5de006)){throw new Error(_0xf7b3e1+_0xbb10('0x6e'));}_0x3f0d74=_0x5de006;return _0x5de006[_0xbb10('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3367d4={'uniqueid':_0x32bb25+'.'+_0x3f0d74['id']+'.'+_0x3f0d74[_0xbb10('0x6d')]['id'],'FromUserId':_0x5ee705[_0xbb10('0x30')]['id'],'type':_0xbb10('0x70')};_0x3367d4[_0xf7b3e1+_0xbb10('0x71')]=_0x3f0d74['id'];_0x3367d4[_0xf7b3e1+_0xbb10('0x72')]=_0x3f0d74[_0xbb10('0x6d')]['id'];_0x3367d4[_0xbb10('0x73')+_0xf7b3e1+_0x517185+'Id']=_0x3f0d74[_0xbb10('0x67')]['id'];_0x3367d4['To'+_0xf7b3e1+_0xbb10('0x74')]=_0x275bce['id'];return db[_0xf7b3e1+_0xbb10('0x75')][_0xbb10('0x76')](_0x3367d4);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x32bb25,'interaction':_0x3f0d74[_0xbb10('0x6d')],'message':_0x3f0d74,'account':_0x3f0d74[_0xbb10('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0xbb10('0x70'),'appdata':_0x275bce[_0xbb10('0x10')]+','+(_0x3f0d74[_0xbb10('0x67')]['queueTransferTimeout']||0x12c),'interval':_0xbb10('0x77')}],'transfer':!![]},routingClient);})[_0xbb10('0x9')](respondWithResult(_0x17d596,null))[_0xbb10('0x17')](handleError(_0x17d596,null));};};exports[_0xbb10('0x78')]=function(_0x19694d,_0x379d49){var _0x546db5,_0xb25e71;if(_[_0xbb10('0x12')](_0x19694d['body'][_0xbb10('0x79')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0xc53c87=_0x19694d[_0xbb10('0x21')][_0xbb10('0x79')];var _0xa99bf5=_[_0xbb10('0x65')](_0xc53c87);var _0x556d7b=_0xc53c87===_0xbb10('0x7a')?'Website':_0xbb10('0x67');return db[_0xbb10('0x7b')]['findOne']({'raw':!![],'where':{'id':_0x19694d['params']['id'],'role':_0xbb10('0x3b')}})[_0xbb10('0x9')](function(_0x1b77c2){if(_[_0xbb10('0x12')](_0x1b77c2)){throw new Error(_0xbb10('0x7c'));}_0x546db5=_0x1b77c2;return db[_0xa99bf5+_0xbb10('0x6a')][_0xbb10('0x6b')]({'where':{'id':_0x19694d[_0xbb10('0x21')][_0xbb10('0x6c')]},'include':[{'model':db[_0xa99bf5+_0xbb10('0x6d')],'as':_0xbb10('0x6d')},{'model':db[_0xa99bf5+_0x556d7b],'as':'Account'}]});})[_0xbb10('0x9')](function(_0x3eeceb){if(_[_0xbb10('0x12')](_0x3eeceb)){throw new Error(_0xa99bf5+_0xbb10('0x6e'));}_0xb25e71=_0x3eeceb;return _0x3eeceb[_0xbb10('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbb10('0x9')](function(){var _0xfefa17={'uniqueid':_0xc53c87+'.'+_0xb25e71['id']+'.'+_0xb25e71[_0xbb10('0x6d')]['id'],'FromUserId':_0x19694d[_0xbb10('0x30')]['id'],'type':_0xbb10('0x3b'),'ToUserId':_0x546db5['id']};_0xfefa17[_0xa99bf5+_0xbb10('0x71')]=_0xb25e71['id'];_0xfefa17[_0xa99bf5+_0xbb10('0x72')]=_0xb25e71['Interaction']['id'];_0xfefa17[_0xbb10('0x73')+_0xa99bf5+_0x556d7b+'Id']=_0xb25e71['Account']['id'];return db[_0xa99bf5+_0xbb10('0x75')][_0xbb10('0x76')](_0xfefa17);})[_0xbb10('0x9')](function(){return respondWithRpcPromise(_0xbb10('0x7d'),{'channel':_0xc53c87,'interaction':_0xb25e71[_0xbb10('0x6d')],'message':_0xb25e71,'account':_0xb25e71['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xbb10('0x3b'),'appdata':_0x546db5[_0xbb10('0x10')]+','+(_0xb25e71[_0xbb10('0x67')][_0xbb10('0x7e')]||0x12c),'interval':_0xbb10('0x77')}],'transfer':!![]},routingClient);})[_0xbb10('0x9')](respondWithResult(_0x379d49,null))['catch'](handleError(_0x379d49,null));}; \ No newline at end of file +var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x1dae22,_0x23e2f5){var _0x551848=function(_0x3eebc5){while(--_0x3eebc5){_0x1dae22['push'](_0x1dae22['shift']());}};_0x551848(++_0x23e2f5);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index b0ac193..84e378b 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 _0x0889=['/:id','show','/:id/run','run','post','create','put','update','delete','destroy','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0889,0x10e));var _0x9088=function(_0xdb7de6,_0x5a17fa){_0xdb7de6=_0xdb7de6-0x0;var _0x49be54=_0x0889[_0xdb7de6];return _0x49be54;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9088('0x0'));var timeout=require('connect-timeout');var express=require(_0x9088('0x1'));var router=express[_0x9088('0x2')]();var fs_extra=require(_0x9088('0x3'));var auth=require(_0x9088('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9088('0x5'));var controller=require(_0x9088('0x6'));router[_0x9088('0x7')]('/',auth[_0x9088('0x8')](),controller[_0x9088('0x9')]);router[_0x9088('0x7')](_0x9088('0xa'),auth['isAuthenticated'](),controller[_0x9088('0xb')]);router[_0x9088('0x7')](_0x9088('0xc'),auth[_0x9088('0x8')](),controller[_0x9088('0xd')]);router[_0x9088('0xe')]('/',auth[_0x9088('0x8')](),controller[_0x9088('0xf')]);router[_0x9088('0x10')]('/:id',auth[_0x9088('0x8')](),controller[_0x9088('0x11')]);router[_0x9088('0x12')](_0x9088('0xa'),auth[_0x9088('0x8')](),controller[_0x9088('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe1d6=['./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe1d6,0x12f));var _0x6e1d=function(_0x423eba,_0x275383){_0x423eba=_0x423eba-0x0;var _0x4adb55=_0xe1d6[_0x423eba];return _0x4adb55;};'use strict';var multer=require(_0x6e1d('0x0'));var util=require(_0x6e1d('0x1'));var path=require(_0x6e1d('0x2'));var timeout=require(_0x6e1d('0x3'));var express=require(_0x6e1d('0x4'));var router=express[_0x6e1d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6e1d('0x6'));var interaction=require(_0x6e1d('0x7'));var config=require(_0x6e1d('0x8'));var controller=require(_0x6e1d('0x9'));router[_0x6e1d('0xa')]('/',auth[_0x6e1d('0xb')](),controller[_0x6e1d('0xc')]);router[_0x6e1d('0xa')](_0x6e1d('0xd'),auth['isAuthenticated'](),controller[_0x6e1d('0xe')]);router['get'](_0x6e1d('0xf'),auth[_0x6e1d('0xb')](),controller[_0x6e1d('0x10')]);router[_0x6e1d('0x11')]('/',auth['isAuthenticated'](),controller[_0x6e1d('0x12')]);router[_0x6e1d('0x13')](_0x6e1d('0xd'),auth[_0x6e1d('0xb')](),controller[_0x6e1d('0x14')]);router[_0x6e1d('0x15')](_0x6e1d('0xd'),auth[_0x6e1d('0xb')](),controller[_0x6e1d('0x16')]);module[_0x6e1d('0x17')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 54e98ec..59b2ff6 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 _0x1a9e=['csv','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','days','hours','minutes','xlsx'];(function(_0x3421ab,_0x227d8c){var _0x3b3066=function(_0x388052){while(--_0x388052){_0x3421ab['push'](_0x3421ab['shift']());}};_0x3b3066(++_0x227d8c);}(_0x1a9e,0x134));var _0xe1a9=function(_0x373d15,_0x114bef){_0x373d15=_0x373d15-0x0;var _0x11254a=_0x1a9e[_0x373d15];return _0x11254a;};'use strict';var Sequelize=require(_0xe1a9('0x0'));module[_0xe1a9('0x1')]={'name':{'type':Sequelize[_0xe1a9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe1a9('0x2')]},'active':{'type':Sequelize[_0xe1a9('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xe1a9('0x2')],'allowNull':![],'defaultValue':_0xe1a9('0x4')},'startAt':{'type':Sequelize[_0xe1a9('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xe1a9('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xe1a9('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xe1a9('0x7')](_0xe1a9('0x8'),_0xe1a9('0x9'),_0xe1a9('0xa'),'weeks',_0xe1a9('0xb'),_0xe1a9('0xc'),_0xe1a9('0xd')),'allowNull':![],'defaultValue':_0xe1a9('0xb')},'output':{'type':Sequelize[_0xe1a9('0x7')]('csv','pdf',_0xe1a9('0xe')),'allowNull':![],'defaultValue':_0xe1a9('0xf')},'type':{'type':Sequelize[_0xe1a9('0x7')]('custom',_0xe1a9('0x10')),'allowNull':![],'defaultValue':_0xe1a9('0x11')},'sendMail':{'type':Sequelize[_0xe1a9('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xe1a9('0x2')]},'cc':{'type':Sequelize[_0xe1a9('0x12')]},'bcc':{'type':Sequelize[_0xe1a9('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xe1a9('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2bec=['TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','months','weeks','days','hours','minutes','pdf','xlsx','csv','custom','default'];(function(_0x30b096,_0x370a08){var _0x5d6123=function(_0xd18ea0){while(--_0xd18ea0){_0x30b096['push'](_0x30b096['shift']());}};_0x5d6123(++_0x370a08);}(_0x2bec,0x119));var _0xc2be=function(_0x3bd6a1,_0x1272ba){_0x3bd6a1=_0x3bd6a1-0x0;var _0x2056ad=_0x2bec[_0x3bd6a1];return _0x2056ad;};'use strict';var Sequelize=require(_0xc2be('0x0'));module[_0xc2be('0x1')]={'name':{'type':Sequelize[_0xc2be('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc2be('0x2')]},'active':{'type':Sequelize[_0xc2be('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc2be('0x2')],'allowNull':![],'defaultValue':_0xc2be('0x4')},'startAt':{'type':Sequelize[_0xc2be('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xc2be('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xc2be('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xc2be('0x7')](_0xc2be('0x8'),'quarters',_0xc2be('0x9'),_0xc2be('0xa'),_0xc2be('0xb'),_0xc2be('0xc'),_0xc2be('0xd')),'allowNull':![],'defaultValue':_0xc2be('0xb')},'output':{'type':Sequelize[_0xc2be('0x7')]('csv',_0xc2be('0xe'),_0xc2be('0xf')),'allowNull':![],'defaultValue':_0xc2be('0x10')},'type':{'type':Sequelize[_0xc2be('0x7')](_0xc2be('0x11'),_0xc2be('0x12')),'allowNull':![],'defaultValue':_0xc2be('0x11')},'sendMail':{'type':Sequelize[_0xc2be('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xc2be('0x2')]},'cc':{'type':Sequelize[_0xc2be('0x13')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xc2be('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 5d102f5..9fab2b0 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 _0x5380=['util','path','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','stack','send','index','map','Schedule','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','name','merge','options','includeAll','include','rows','rawAttributes','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','run','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x47862c,_0x5e0120){var _0x49644=function(_0x5c146d){while(--_0x5c146d){_0x47862c['push'](_0x47862c['shift']());}};_0x49644(++_0x5e0120);}(_0x5380,0xa6));var _0x0538=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5380[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0538('0x0'));var zipdir=require(_0x0538('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0538('0x2'));var moment=require(_0x0538('0x3'));var BPromise=require(_0x0538('0x4'));var Mustache=require(_0x0538('0x5'));var util=require(_0x0538('0x6'));var path=require(_0x0538('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0538('0x8'));var fs=require('fs');var fs_extra=require(_0x0538('0x9'));var _=require(_0x0538('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0538('0xb'));var deskjs=require(_0x0538('0xc'));var toCsv=require(_0x0538('0xd'));var querystring=require('querystring');var Papa=require(_0x0538('0xe'));var Redis=require(_0x0538('0xf'));var authService=require(_0x0538('0x10'));var qs=require(_0x0538('0x11'));var as=require(_0x0538('0x12'));var hardwareService=require(_0x0538('0x13'));var logger=require(_0x0538('0x14'))(_0x0538('0x15'));var utils=require(_0x0538('0x16'));var config=require(_0x0538('0x17'));var licenseUtil=require(_0x0538('0x18'));var db=require(_0x0538('0x19'))['db'];function respondWithStatusCode(_0x144a1c,_0x291d92){_0x291d92=_0x291d92||0xcc;return function(_0x4cc8ca){if(_0x4cc8ca){return _0x144a1c['sendStatus'](_0x291d92);}return _0x144a1c['status'](_0x291d92)['end']();};}function respondWithResult(_0x35fdeb,_0x3b34d0){_0x3b34d0=_0x3b34d0||0xc8;return function(_0x274beb){if(_0x274beb){return _0x35fdeb[_0x0538('0x1a')](_0x3b34d0)[_0x0538('0x1b')](_0x274beb);}};}function respondWithFilteredResult(_0x2440a6,_0x109186){return function(_0x208e54){if(_0x208e54){var _0x39c20d=typeof _0x109186['offset']===_0x0538('0x1c')&&typeof _0x109186[_0x0538('0x1d')]===_0x0538('0x1c');var _0x45942d=_0x208e54[_0x0538('0x1e')];var _0x263b04=_0x39c20d?0x0:_0x109186[_0x0538('0x1f')];var _0x22fb8d=_0x39c20d?_0x208e54[_0x0538('0x1e')]:_0x109186[_0x0538('0x1f')]+_0x109186[_0x0538('0x1d')];var _0x5d6409;if(_0x22fb8d>=_0x45942d){_0x22fb8d=_0x45942d;_0x5d6409=0xc8;}else{_0x5d6409=0xce;}_0x2440a6[_0x0538('0x1a')](_0x5d6409);return _0x2440a6[_0x0538('0x20')](_0x0538('0x21'),_0x263b04+'-'+_0x22fb8d+'/'+_0x45942d)[_0x0538('0x1b')](_0x208e54);}return null;};}function patchUpdates(_0x3b920e){return function(_0x120cbd){try{jsonpatch[_0x0538('0x22')](_0x120cbd,_0x3b920e,!![]);}catch(_0x37c019){return BPromise[_0x0538('0x23')](_0x37c019);}return _0x120cbd['save']();};}function saveUpdates(_0x22be10,_0x3b80e4){return function(_0x4b16c9){if(_0x4b16c9){return _0x4b16c9[_0x0538('0x24')](_0x22be10)[_0x0538('0x25')](function(_0x59c975){return _0x59c975;});}return null;};}function removeEntity(_0x19801b,_0x231f05){return function(_0xa39b66){if(_0xa39b66){return _0xa39b66[_0x0538('0x26')]()[_0x0538('0x25')](function(){var _0x38138d=_0xa39b66[_0x0538('0x27')]({'plain':!![]});var _0x42f52b=_0x0538('0x28');return db[_0x0538('0x29')][_0x0538('0x26')]({'where':{'type':_0x42f52b,'resourceId':_0x38138d['id']}})['then'](function(){return _0xa39b66;});})['then'](function(){_0x19801b[_0x0538('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x235b98,_0x10c82e){return function(_0x10972e){if(!_0x10972e){_0x235b98[_0x0538('0x2a')](0x194);}return _0x10972e;};}function handleError(_0x12edad,_0x2236e1){_0x2236e1=_0x2236e1||0x1f4;return function(_0x572a9e){logger['error'](_0x572a9e[_0x0538('0x2b')]);if(_0x572a9e['name']){delete _0x572a9e['name'];}_0x12edad[_0x0538('0x1a')](_0x2236e1)[_0x0538('0x2c')](_0x572a9e);};}exports[_0x0538('0x2d')]=function(_0x47f104,_0x378b23){var _0x325094={},_0xccd90a={},_0x2c5ac6={'count':0x0,'rows':[]};var _0x58d7ed=_[_0x0538('0x2e')](db[_0x0538('0x2f')]['rawAttributes'],function(_0x1a758c){return{'name':_0x1a758c[_0x0538('0x30')],'type':_0x1a758c[_0x0538('0x31')][_0x0538('0x32')]};});_0xccd90a[_0x0538('0x33')]=_[_0x0538('0x2e')](_0x58d7ed,'name');_0xccd90a[_0x0538('0x34')]=_[_0x0538('0x35')](_0x47f104['query']);_0xccd90a[_0x0538('0x36')]=_[_0x0538('0x37')](_0xccd90a[_0x0538('0x33')],_0xccd90a[_0x0538('0x34')]);_0x325094[_0x0538('0x38')]=_[_0x0538('0x37')](_0xccd90a[_0x0538('0x33')],qs['fields'](_0x47f104[_0x0538('0x34')][_0x0538('0x39')]));_0x325094[_0x0538('0x38')]=_0x325094[_0x0538('0x38')][_0x0538('0x3a')]?_0x325094[_0x0538('0x38')]:_0xccd90a['model'];if(!_0x47f104[_0x0538('0x34')][_0x0538('0x3b')](_0x0538('0x3c'))){_0x325094['limit']=qs[_0x0538('0x1d')](_0x47f104[_0x0538('0x34')][_0x0538('0x1d')]);_0x325094[_0x0538('0x1f')]=qs[_0x0538('0x1f')](_0x47f104[_0x0538('0x34')][_0x0538('0x1f')]);}_0x325094[_0x0538('0x3d')]=qs['sort'](_0x47f104[_0x0538('0x34')][_0x0538('0x3e')]);_0x325094[_0x0538('0x3f')]=qs['filters'](_[_0x0538('0x40')](_0x47f104[_0x0538('0x34')],_0xccd90a[_0x0538('0x36')]),_0x58d7ed);if(_0x47f104['query'][_0x0538('0x41')]){_0x325094[_0x0538('0x3f')]=_['merge'](_0x325094[_0x0538('0x3f')],{'$or':_[_0x0538('0x2e')](_0x58d7ed,function(_0x3e8824){if(_0x3e8824[_0x0538('0x31')]!==_0x0538('0x42')){var _0x2fe3d1={};_0x2fe3d1[_0x3e8824[_0x0538('0x43')]]={'$like':'%'+_0x47f104[_0x0538('0x34')][_0x0538('0x41')]+'%'};return _0x2fe3d1;}})});}_0x325094=_[_0x0538('0x44')]({},_0x325094,_0x47f104[_0x0538('0x45')]);var _0x9af98d={'where':_0x325094[_0x0538('0x3f')]};return db[_0x0538('0x2f')]['count'](_0x9af98d)[_0x0538('0x25')](function(_0x11fa21){_0x2c5ac6[_0x0538('0x1e')]=_0x11fa21;if(_0x47f104[_0x0538('0x34')][_0x0538('0x46')]){_0x325094[_0x0538('0x47')]=[{'all':!![]}];}return db[_0x0538('0x2f')]['findAll'](_0x325094);})[_0x0538('0x25')](function(_0x4f2bdb){_0x2c5ac6[_0x0538('0x48')]=_0x4f2bdb;return _0x2c5ac6;})[_0x0538('0x25')](respondWithFilteredResult(_0x378b23,_0x325094))['catch'](handleError(_0x378b23,null));};exports['show']=function(_0x183760,_0x483746){var _0x4cc6f6={'raw':![],'where':{'id':_0x183760['params']['id']}},_0x31c000={};_0x31c000[_0x0538('0x33')]=_[_0x0538('0x35')](db['Schedule'][_0x0538('0x49')]);_0x31c000['query']=_[_0x0538('0x35')](_0x183760[_0x0538('0x34')]);_0x31c000[_0x0538('0x36')]=_[_0x0538('0x37')](_0x31c000[_0x0538('0x33')],_0x31c000['query']);_0x4cc6f6[_0x0538('0x38')]=_[_0x0538('0x37')](_0x31c000[_0x0538('0x33')],qs[_0x0538('0x39')](_0x183760[_0x0538('0x34')]['fields']));_0x4cc6f6[_0x0538('0x38')]=_0x4cc6f6[_0x0538('0x38')][_0x0538('0x3a')]?_0x4cc6f6[_0x0538('0x38')]:_0x31c000[_0x0538('0x33')];if(_0x183760['query']['includeAll']){_0x4cc6f6[_0x0538('0x47')]=[{'all':!![]}];}_0x4cc6f6=_[_0x0538('0x44')]({},_0x4cc6f6,_0x183760[_0x0538('0x45')]);return db['Schedule'][_0x0538('0x4a')](_0x4cc6f6)[_0x0538('0x25')](handleEntityNotFound(_0x483746,null))[_0x0538('0x25')](respondWithResult(_0x483746,null))[_0x0538('0x4b')](handleError(_0x483746,null));};exports[_0x0538('0x4c')]=function(_0x1b91e6,_0x475cf6){return db['Schedule'][_0x0538('0x4c')](_0x1b91e6['body'],{})[_0x0538('0x25')](function(_0x4099ec){var _0x20ce7b=_0x1b91e6[_0x0538('0x4d')][_0x0538('0x27')]({'plain':!![]});if(!_0x20ce7b)throw new Error(_0x0538('0x4e'));if(_0x20ce7b[_0x0538('0x4f')]===_0x0538('0x4d')){var _0x1c21e4=_0x4099ec[_0x0538('0x27')]({'plain':!![]});var _0x41e9e6='Scheduler';return db['UserProfileSection'][_0x0538('0x4a')]({'where':{'name':_0x41e9e6,'userProfileId':_0x20ce7b[_0x0538('0x50')]},'raw':!![]})[_0x0538('0x25')](function(_0x2f0590){if(_0x2f0590&&_0x2f0590['autoAssociation']===0x0){return db[_0x0538('0x29')][_0x0538('0x4c')]({'name':_0x1c21e4[_0x0538('0x43')],'resourceId':_0x1c21e4['id'],'type':_0x2f0590[_0x0538('0x43')],'sectionId':_0x2f0590['id']},{})[_0x0538('0x25')](function(){return _0x4099ec;});}else{return _0x4099ec;}})[_0x0538('0x4b')](function(_0x457607){logger[_0x0538('0x51')](_0x0538('0x52'),_0x457607);throw _0x457607;});}return _0x4099ec;})[_0x0538('0x25')](respondWithResult(_0x475cf6,0xc9))[_0x0538('0x4b')](handleError(_0x475cf6,null));};exports[_0x0538('0x24')]=function(_0x336bac,_0x454ada){if(_0x336bac[_0x0538('0x53')]['id']){delete _0x336bac[_0x0538('0x53')]['id'];}return db[_0x0538('0x2f')][_0x0538('0x4a')]({'where':{'id':_0x336bac[_0x0538('0x54')]['id']}})['then'](handleEntityNotFound(_0x454ada,null))[_0x0538('0x25')](saveUpdates(_0x336bac[_0x0538('0x53')],null))[_0x0538('0x25')](respondWithResult(_0x454ada,null))[_0x0538('0x4b')](handleError(_0x454ada,null));};exports[_0x0538('0x26')]=function(_0x194a0c,_0x47f3af){return db[_0x0538('0x2f')][_0x0538('0x4a')]({'where':{'id':_0x194a0c['params']['id']}})[_0x0538('0x25')](handleEntityNotFound(_0x47f3af,null))['then'](removeEntity(_0x47f3af,null))[_0x0538('0x4b')](handleError(_0x47f3af,null));};exports[_0x0538('0x55')]=function(_0x5ac2ca,_0x3ad154,_0x1a97e6){var _0x3537f3=require('../../config/schedule');return db[_0x0538('0x2f')][_0x0538('0x4a')]({'where':{'id':_0x5ac2ca[_0x0538('0x54')]['id']},'raw':!![]})[_0x0538('0x25')](handleEntityNotFound(_0x3ad154,null))[_0x0538('0x25')](function(){_0x3537f3['run'](_0x5ac2ca['params']['id']);})['then'](respondWithStatusCode(_0x3ad154,null))['catch'](handleError(_0x3ad154,null));}; \ No newline at end of file +var _0x9944=['merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','params','../../config/schedule','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../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','update','then','destroy','get','UserProfileResource','error','name','send','index','map','Schedule','fieldName','type','key','model','query','keys','intersection','attributes','fields','order','sort','filters','pick','filter','where'];(function(_0x1c9fc7,_0x2f71a8){var _0x15539c=function(_0x90d065){while(--_0x90d065){_0x1c9fc7['push'](_0x1c9fc7['shift']());}};_0x15539c(++_0x2f71a8);}(_0x9944,0x16e));var _0x4994=function(_0xa8351b,_0x1f37b7){_0xa8351b=_0xa8351b-0x0;var _0x84753e=_0x9944[_0xa8351b];return _0x84753e;};'use strict';var emlformat=require(_0x4994('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4994('0x1'));var jsonpatch=require(_0x4994('0x2'));var rp=require('request-promise');var moment=require(_0x4994('0x3'));var BPromise=require(_0x4994('0x4'));var Mustache=require(_0x4994('0x5'));var util=require('util');var path=require(_0x4994('0x6'));var sox=require(_0x4994('0x7'));var csv=require(_0x4994('0x8'));var ejs=require(_0x4994('0x9'));var fs=require('fs');var fs_extra=require(_0x4994('0xa'));var _=require(_0x4994('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4994('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4994('0xd'));var Papa=require(_0x4994('0xe'));var Redis=require(_0x4994('0xf'));var authService=require(_0x4994('0x10'));var qs=require(_0x4994('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4994('0x12'));var logger=require(_0x4994('0x13'))(_0x4994('0x14'));var utils=require(_0x4994('0x15'));var config=require(_0x4994('0x16'));var licenseUtil=require(_0x4994('0x17'));var db=require(_0x4994('0x18'))['db'];function respondWithStatusCode(_0x3cd869,_0x9c0cd4){_0x9c0cd4=_0x9c0cd4||0xcc;return function(_0x31c447){if(_0x31c447){return _0x3cd869[_0x4994('0x19')](_0x9c0cd4);}return _0x3cd869['status'](_0x9c0cd4)[_0x4994('0x1a')]();};}function respondWithResult(_0x5ea1ec,_0x4ad064){_0x4ad064=_0x4ad064||0xc8;return function(_0x1436e1){if(_0x1436e1){return _0x5ea1ec[_0x4994('0x1b')](_0x4ad064)[_0x4994('0x1c')](_0x1436e1);}};}function respondWithFilteredResult(_0x16e75b,_0x11aef2){return function(_0x1cb4db){if(_0x1cb4db){var _0x211cb0=typeof _0x11aef2[_0x4994('0x1d')]===_0x4994('0x1e')&&typeof _0x11aef2[_0x4994('0x1f')]===_0x4994('0x1e');var _0x4c1e7d=_0x1cb4db[_0x4994('0x20')];var _0x20a30a=_0x211cb0?0x0:_0x11aef2[_0x4994('0x1d')];var _0x4e4f10=_0x211cb0?_0x1cb4db['count']:_0x11aef2['offset']+_0x11aef2[_0x4994('0x1f')];var _0x54b704;if(_0x4e4f10>=_0x4c1e7d){_0x4e4f10=_0x4c1e7d;_0x54b704=0xc8;}else{_0x54b704=0xce;}_0x16e75b[_0x4994('0x1b')](_0x54b704);return _0x16e75b[_0x4994('0x21')](_0x4994('0x22'),_0x20a30a+'-'+_0x4e4f10+'/'+_0x4c1e7d)[_0x4994('0x1c')](_0x1cb4db);}return null;};}function patchUpdates(_0x1e4546){return function(_0x30e672){try{jsonpatch[_0x4994('0x23')](_0x30e672,_0x1e4546,!![]);}catch(_0x3392dc){return BPromise[_0x4994('0x24')](_0x3392dc);}return _0x30e672[_0x4994('0x25')]();};}function saveUpdates(_0x517b88,_0x41fec4){return function(_0x25a3ef){if(_0x25a3ef){return _0x25a3ef[_0x4994('0x26')](_0x517b88)[_0x4994('0x27')](function(_0x6f2734){return _0x6f2734;});}return null;};}function removeEntity(_0x20d7fa,_0x2bffc9){return function(_0x5d872c){if(_0x5d872c){return _0x5d872c[_0x4994('0x28')]()[_0x4994('0x27')](function(){var _0x2d0d7e=_0x5d872c[_0x4994('0x29')]({'plain':!![]});var _0x418f46='Scheduler';return db[_0x4994('0x2a')][_0x4994('0x28')]({'where':{'type':_0x418f46,'resourceId':_0x2d0d7e['id']}})[_0x4994('0x27')](function(){return _0x5d872c;});})['then'](function(){_0x20d7fa[_0x4994('0x1b')](0xcc)[_0x4994('0x1a')]();});}};}function handleEntityNotFound(_0x1cd7c3,_0x1b3826){return function(_0x336ccb){if(!_0x336ccb){_0x1cd7c3[_0x4994('0x19')](0x194);}return _0x336ccb;};}function handleError(_0x3709f7,_0x1afc6a){_0x1afc6a=_0x1afc6a||0x1f4;return function(_0x279aab){logger[_0x4994('0x2b')](_0x279aab['stack']);if(_0x279aab[_0x4994('0x2c')]){delete _0x279aab[_0x4994('0x2c')];}_0x3709f7[_0x4994('0x1b')](_0x1afc6a)[_0x4994('0x2d')](_0x279aab);};}exports[_0x4994('0x2e')]=function(_0x5c8195,_0x4c9d35){var _0x31dfee={},_0x32c8c7={},_0x433740={'count':0x0,'rows':[]};var _0x408a03=_[_0x4994('0x2f')](db[_0x4994('0x30')]['rawAttributes'],function(_0x5d4f80){return{'name':_0x5d4f80[_0x4994('0x31')],'type':_0x5d4f80[_0x4994('0x32')][_0x4994('0x33')]};});_0x32c8c7[_0x4994('0x34')]=_[_0x4994('0x2f')](_0x408a03,_0x4994('0x2c'));_0x32c8c7[_0x4994('0x35')]=_[_0x4994('0x36')](_0x5c8195[_0x4994('0x35')]);_0x32c8c7['filters']=_[_0x4994('0x37')](_0x32c8c7[_0x4994('0x34')],_0x32c8c7[_0x4994('0x35')]);_0x31dfee[_0x4994('0x38')]=_['intersection'](_0x32c8c7[_0x4994('0x34')],qs['fields'](_0x5c8195[_0x4994('0x35')][_0x4994('0x39')]));_0x31dfee[_0x4994('0x38')]=_0x31dfee[_0x4994('0x38')]['length']?_0x31dfee[_0x4994('0x38')]:_0x32c8c7[_0x4994('0x34')];if(!_0x5c8195[_0x4994('0x35')]['hasOwnProperty']('nolimit')){_0x31dfee['limit']=qs[_0x4994('0x1f')](_0x5c8195[_0x4994('0x35')][_0x4994('0x1f')]);_0x31dfee[_0x4994('0x1d')]=qs['offset'](_0x5c8195['query'][_0x4994('0x1d')]);}_0x31dfee[_0x4994('0x3a')]=qs[_0x4994('0x3b')](_0x5c8195['query'][_0x4994('0x3b')]);_0x31dfee['where']=qs[_0x4994('0x3c')](_[_0x4994('0x3d')](_0x5c8195['query'],_0x32c8c7[_0x4994('0x3c')]),_0x408a03);if(_0x5c8195[_0x4994('0x35')][_0x4994('0x3e')]){_0x31dfee[_0x4994('0x3f')]=_[_0x4994('0x40')](_0x31dfee[_0x4994('0x3f')],{'$or':_[_0x4994('0x2f')](_0x408a03,function(_0x44bafd){if(_0x44bafd[_0x4994('0x32')]!==_0x4994('0x41')){var _0x58d473={};_0x58d473[_0x44bafd[_0x4994('0x2c')]]={'$like':'%'+_0x5c8195[_0x4994('0x35')][_0x4994('0x3e')]+'%'};return _0x58d473;}})});}_0x31dfee=_['merge']({},_0x31dfee,_0x5c8195['options']);var _0x3c178c={'where':_0x31dfee['where']};return db['Schedule'][_0x4994('0x20')](_0x3c178c)[_0x4994('0x27')](function(_0x5e1e2a){_0x433740[_0x4994('0x20')]=_0x5e1e2a;if(_0x5c8195[_0x4994('0x35')][_0x4994('0x42')]){_0x31dfee[_0x4994('0x43')]=[{'all':!![]}];}return db[_0x4994('0x30')][_0x4994('0x44')](_0x31dfee);})[_0x4994('0x27')](function(_0x11766c){_0x433740[_0x4994('0x45')]=_0x11766c;return _0x433740;})[_0x4994('0x27')](respondWithFilteredResult(_0x4c9d35,_0x31dfee))[_0x4994('0x46')](handleError(_0x4c9d35,null));};exports[_0x4994('0x47')]=function(_0x165020,_0x1ae37d){var _0x298932={'raw':![],'where':{'id':_0x165020['params']['id']}},_0x2fdb5f={};_0x2fdb5f[_0x4994('0x34')]=_[_0x4994('0x36')](db[_0x4994('0x30')][_0x4994('0x48')]);_0x2fdb5f[_0x4994('0x35')]=_[_0x4994('0x36')](_0x165020[_0x4994('0x35')]);_0x2fdb5f[_0x4994('0x3c')]=_[_0x4994('0x37')](_0x2fdb5f[_0x4994('0x34')],_0x2fdb5f['query']);_0x298932[_0x4994('0x38')]=_['intersection'](_0x2fdb5f[_0x4994('0x34')],qs['fields'](_0x165020[_0x4994('0x35')][_0x4994('0x39')]));_0x298932[_0x4994('0x38')]=_0x298932['attributes'][_0x4994('0x49')]?_0x298932['attributes']:_0x2fdb5f['model'];if(_0x165020['query'][_0x4994('0x42')]){_0x298932[_0x4994('0x43')]=[{'all':!![]}];}_0x298932=_['merge']({},_0x298932,_0x165020['options']);return db[_0x4994('0x30')][_0x4994('0x4a')](_0x298932)[_0x4994('0x27')](handleEntityNotFound(_0x1ae37d,null))[_0x4994('0x27')](respondWithResult(_0x1ae37d,null))['catch'](handleError(_0x1ae37d,null));};exports[_0x4994('0x4b')]=function(_0x192783,_0x40eeed){return db['Schedule'][_0x4994('0x4b')](_0x192783[_0x4994('0x4c')],{})[_0x4994('0x27')](function(_0x56eec8){var _0x17c200=_0x192783[_0x4994('0x4d')][_0x4994('0x29')]({'plain':!![]});if(!_0x17c200)throw new Error(_0x4994('0x4e'));if(_0x17c200[_0x4994('0x4f')]===_0x4994('0x4d')){var _0x13518f=_0x56eec8['get']({'plain':!![]});var _0x43d7af=_0x4994('0x50');return db[_0x4994('0x51')][_0x4994('0x4a')]({'where':{'name':_0x43d7af,'userProfileId':_0x17c200[_0x4994('0x52')]},'raw':!![]})[_0x4994('0x27')](function(_0x39193d){if(_0x39193d&&_0x39193d[_0x4994('0x53')]===0x0){return db[_0x4994('0x2a')][_0x4994('0x4b')]({'name':_0x13518f[_0x4994('0x2c')],'resourceId':_0x13518f['id'],'type':_0x39193d[_0x4994('0x2c')],'sectionId':_0x39193d['id']},{})['then'](function(){return _0x56eec8;});}else{return _0x56eec8;}})['catch'](function(_0x54cfe3){logger[_0x4994('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54cfe3);throw _0x54cfe3;});}return _0x56eec8;})[_0x4994('0x27')](respondWithResult(_0x40eeed,0xc9))[_0x4994('0x46')](handleError(_0x40eeed,null));};exports['update']=function(_0x574b8b,_0x4150e3){if(_0x574b8b[_0x4994('0x4c')]['id']){delete _0x574b8b['body']['id'];}return db[_0x4994('0x30')][_0x4994('0x4a')]({'where':{'id':_0x574b8b[_0x4994('0x54')]['id']}})['then'](handleEntityNotFound(_0x4150e3,null))['then'](saveUpdates(_0x574b8b['body'],null))['then'](respondWithResult(_0x4150e3,null))[_0x4994('0x46')](handleError(_0x4150e3,null));};exports['destroy']=function(_0x2ec31d,_0x30a9fa){return db[_0x4994('0x30')][_0x4994('0x4a')]({'where':{'id':_0x2ec31d[_0x4994('0x54')]['id']}})['then'](handleEntityNotFound(_0x30a9fa,null))[_0x4994('0x27')](removeEntity(_0x30a9fa,null))['catch'](handleError(_0x30a9fa,null));};exports['run']=function(_0x241526,_0x25ade5,_0x5ad60a){var _0x11d5ce=require(_0x4994('0x55'));return db[_0x4994('0x30')][_0x4994('0x4a')]({'where':{'id':_0x241526[_0x4994('0x54')]['id']},'raw':!![]})[_0x4994('0x27')](handleEntityNotFound(_0x25ade5,null))['then'](function(){_0x11d5ce['run'](_0x241526[_0x4994('0x54')]['id']);})[_0x4994('0x27')](respondWithStatusCode(_0x25ade5,null))['catch'](handleError(_0x25ade5,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 49a8ab2..0df5f5b 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 _0xc473=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./schedule.attributes','exports','Schedule','tools_schedules','../../config/logger'];(function(_0x2c3255,_0x4e00ae){var _0x282aba=function(_0x5721d5){while(--_0x5721d5){_0x2c3255['push'](_0x2c3255['shift']());}};_0x282aba(++_0x4e00ae);}(_0xc473,0xc5));var _0x3c47=function(_0x157011,_0x3db093){_0x157011=_0x157011-0x0;var _0x35f8ba=_0xc473[_0x157011];return _0x35f8ba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3c47('0x0'))(_0x3c47('0x1'));var moment=require(_0x3c47('0x2'));var BPromise=require(_0x3c47('0x3'));var rp=require(_0x3c47('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c47('0x5'));var config=require(_0x3c47('0x6'));var attributes=require(_0x3c47('0x7'));module[_0x3c47('0x8')]=function(_0x5b121c,_0x2b58de){return _0x5b121c['define'](_0x3c47('0x9'),attributes,{'tableName':_0x3c47('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c37=['rimraf','./schedule.attributes','exports','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0x2c37,0xe2));var _0x72c3=function(_0x4a9170,_0x28e249){_0x4a9170=_0x4a9170-0x0;var _0x5eadef=_0x2c37[_0x4a9170];return _0x5eadef;};'use strict';var _=require(_0x72c3('0x0'));var util=require(_0x72c3('0x1'));var logger=require(_0x72c3('0x2'))(_0x72c3('0x3'));var moment=require(_0x72c3('0x4'));var BPromise=require(_0x72c3('0x5'));var rp=require(_0x72c3('0x6'));var fs=require('fs');var path=require(_0x72c3('0x7'));var rimraf=require(_0x72c3('0x8'));var config=require('../../config/environment');var attributes=require(_0x72c3('0x9'));module[_0x72c3('0xa')]=function(_0x204d03,_0x48ff5a){return _0x204d03['define'](_0x72c3('0xb'),attributes,{'tableName':_0x72c3('0xc'),'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 e4ea876..8cbe6cd 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 _0x9daa=['then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','request'];(function(_0x53c1b1,_0x21a594){var _0x4f0890=function(_0x3b69c8){while(--_0x3b69c8){_0x53c1b1['push'](_0x53c1b1['shift']());}};_0x4f0890(++_0x21a594);}(_0x9daa,0xfb));var _0xa9da=function(_0x41073f,_0x1779de){_0x41073f=_0x41073f-0x0;var _0x2a6ab6=_0x9daa[_0x41073f];return _0x2a6ab6;};'use strict';var _=require(_0xa9da('0x0'));var util=require('util');var moment=require(_0xa9da('0x1'));var BPromise=require(_0xa9da('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9da('0x3'));var db=require(_0xa9da('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9da('0x5'))(_0xa9da('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa9da('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2b0674,_0x33aac3,_0x4aeb4b){return new BPromise(function(_0x5f4310,_0x5aec7d){return client[_0xa9da('0x8')](_0x2b0674,_0x4aeb4b)[_0xa9da('0x9')](function(_0x111462){logger[_0xa9da('0xa')](_0xa9da('0xb'),_0x33aac3,_0xa9da('0xc'));logger[_0xa9da('0xd')](_0xa9da('0xe'),_0x33aac3,_0xa9da('0xc'),JSON[_0xa9da('0xf')](_0x111462));if(_0x111462[_0xa9da('0x10')]){if(_0x111462['error'][_0xa9da('0x11')]===0x1f4){logger[_0xa9da('0x10')](_0xa9da('0xb'),_0x33aac3,_0x111462['error']['message']);return _0x5aec7d(_0x111462[_0xa9da('0x10')]['message']);}logger['error'](_0xa9da('0xb'),_0x33aac3,_0x111462[_0xa9da('0x10')][_0xa9da('0x12')]);return _0x5f4310(_0x111462[_0xa9da('0x10')][_0xa9da('0x12')]);}else{logger['info'](_0xa9da('0xb'),_0x33aac3,_0xa9da('0xc'));_0x5f4310(_0x111462[_0xa9da('0x13')][_0xa9da('0x12')]);}})['catch'](function(_0x1a7f81){logger['error'](_0xa9da('0xb'),_0x33aac3,_0x1a7f81);_0x5aec7d(_0x1a7f81);});});} \ No newline at end of file +var _0x322f=['debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../config/utils','jayson/promise','client','http','info','Schedule,\x20%s,\x20%s'];(function(_0x1b5e26,_0x453ef6){var _0x246191=function(_0x54a89e){while(--_0x54a89e){_0x1b5e26['push'](_0x1b5e26['shift']());}};_0x246191(++_0x453ef6);}(_0x322f,0x194));var _0xf322=function(_0x297c51,_0xec5a74){_0x297c51=_0x297c51-0x0;var _0x19e5da=_0x322f[_0x297c51];return _0x19e5da;};'use strict';var _=require(_0xf322('0x0'));var util=require('util');var moment=require(_0xf322('0x1'));var BPromise=require(_0xf322('0x2'));var rs=require(_0xf322('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf322('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf322('0x5'));var client=jayson[_0xf322('0x6')][_0xf322('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3d453c,_0x3a0c57,_0x24d2dd){return new BPromise(function(_0x5614d1,_0x163a51){return client['request'](_0x3d453c,_0x24d2dd)['then'](function(_0x22de1d){logger[_0xf322('0x8')](_0xf322('0x9'),_0x3a0c57,'request\x20sent');logger[_0xf322('0xa')](_0xf322('0xb'),_0x3a0c57,_0xf322('0xc'),JSON[_0xf322('0xd')](_0x22de1d));if(_0x22de1d['error']){if(_0x22de1d[_0xf322('0xe')][_0xf322('0xf')]===0x1f4){logger[_0xf322('0xe')](_0xf322('0x9'),_0x3a0c57,_0x22de1d['error'][_0xf322('0x10')]);return _0x163a51(_0x22de1d['error'][_0xf322('0x10')]);}logger['error']('Schedule,\x20%s,\x20%s',_0x3a0c57,_0x22de1d['error']['message']);return _0x5614d1(_0x22de1d[_0xf322('0xe')]['message']);}else{logger[_0xf322('0x8')](_0xf322('0x9'),_0x3a0c57,'request\x20sent');_0x5614d1(_0x22de1d['result']['message']);}})[_0xf322('0x11')](function(_0x435f52){logger[_0xf322('0xe')](_0xf322('0x9'),_0x3a0c57,_0x435f52);_0x163a51(_0x435f52);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 060cc06..e549248 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 _0x7e16=['Router','fs-extra','../../components/auth/service','./screenRecording.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/download','post','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0x7e16,0x1b5));var _0x67e1=function(_0x53936c,_0x403f5c){_0x53936c=_0x53936c-0x0;var _0xad7363=_0x7e16[_0x53936c];return _0xad7363;};'use strict';var multer=require(_0x67e1('0x0'));var util=require('util');var path=require(_0x67e1('0x1'));var timeout=require(_0x67e1('0x2'));var express=require(_0x67e1('0x3'));var router=express[_0x67e1('0x4')]();var fs_extra=require(_0x67e1('0x5'));var auth=require(_0x67e1('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x67e1('0x7'));router[_0x67e1('0x8')]('/',auth['isAuthenticated'](),controller[_0x67e1('0x9')]);router[_0x67e1('0x8')](_0x67e1('0xa'),auth['isAuthenticated'](),controller[_0x67e1('0xb')]);router[_0x67e1('0x8')](_0x67e1('0xc'),auth[_0x67e1('0xd')](),controller[_0x67e1('0xe')]);router['get'](_0x67e1('0xf'),auth[_0x67e1('0xd')](),controller['download']);router[_0x67e1('0x10')]('/',auth[_0x67e1('0xd')](),controller['create']);router[_0x67e1('0x11')](_0x67e1('0xc'),auth[_0x67e1('0xd')](),controller['update']);router[_0x67e1('0x12')](_0x67e1('0xc'),auth[_0x67e1('0xd')](),controller[_0x67e1('0x13')]);module[_0x67e1('0x14')]=router; \ No newline at end of file +var _0xb79a=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/download','create','put','update','exports','multer'];(function(_0x71076a,_0x56a2a3){var _0x102ecb=function(_0x445d7d){while(--_0x445d7d){_0x71076a['push'](_0x71076a['shift']());}};_0x102ecb(++_0x56a2a3);}(_0xb79a,0x18e));var _0xab79=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb79a[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xab79('0x0'));var util=require(_0xab79('0x1'));var path=require('path');var timeout=require(_0xab79('0x2'));var express=require(_0xab79('0x3'));var router=express[_0xab79('0x4')]();var fs_extra=require(_0xab79('0x5'));var auth=require(_0xab79('0x6'));var interaction=require(_0xab79('0x7'));var config=require(_0xab79('0x8'));var controller=require(_0xab79('0x9'));router['get']('/',auth[_0xab79('0xa')](),controller['index']);router[_0xab79('0xb')](_0xab79('0xc'),auth[_0xab79('0xa')](),controller[_0xab79('0xd')]);router[_0xab79('0xb')](_0xab79('0xe'),auth[_0xab79('0xa')](),controller[_0xab79('0xf')]);router[_0xab79('0xb')](_0xab79('0x10'),auth[_0xab79('0xa')](),controller['download']);router['post']('/',auth[_0xab79('0xa')](),controller[_0xab79('0x11')]);router[_0xab79('0x12')](_0xab79('0xe'),auth[_0xab79('0xa')](),controller[_0xab79('0x13')]);router['delete']('/:id',auth[_0xab79('0xa')](),controller['destroy']);module[_0xab79('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 01a576e..725da0d 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 _0xba37=['INTEGER','setDataValue','startedAt','subtract','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','sequelize','path','exports','getDataValue','value','extname','STRING','replace'];(function(_0xef7cf5,_0x1f097d){var _0x1f72a3=function(_0x2d8dba){while(--_0x2d8dba){_0xef7cf5['push'](_0xef7cf5['shift']());}};_0x1f72a3(++_0x1f097d);}(_0xba37,0xb6));var _0x7ba3=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xba37[_0x3070dc];return _0x431489;};'use strict';var Sequelize=require(_0x7ba3('0x0'));var moment=require('moment');var path=require(_0x7ba3('0x1'));var config=require('../../config/environment');module[_0x7ba3('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x7ba3('0x3')](_0x7ba3('0x4'))?path[_0x7ba3('0x5')](this[_0x7ba3('0x3')](_0x7ba3('0x4'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7ba3('0x6')]},'value':{'type':Sequelize['STRING'],'set':function(_0x4b4052){var _0x1cac44=_0x4b4052[_0x7ba3('0x7')](/\\/g,'/');this['setDataValue'](_0x7ba3('0x4'),_0x1cac44);}},'rating':{'type':Sequelize[_0x7ba3('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x7ba3('0x8')],'set':function(_0x108326){this[_0x7ba3('0x9')](_0x7ba3('0xa'),moment()[_0x7ba3('0xb')](_0x108326,'ms'));this[_0x7ba3('0x9')](_0x7ba3('0xc'),moment());this['setDataValue'](_0x7ba3('0xd'),_0x108326);}},'startedAt':{'type':Sequelize[_0x7ba3('0xe')],'get':function(){return moment(this[_0x7ba3('0x3')](_0x7ba3('0xa')))['format'](_0x7ba3('0xf'))[_0x7ba3('0x10')]();}},'closedAt':{'type':Sequelize[_0x7ba3('0xe')],'get':function(){return moment(this[_0x7ba3('0x3')](_0x7ba3('0xc')))[_0x7ba3('0x11')](_0x7ba3('0xf'))['toString']();}},'createdAt':{'type':Sequelize[_0x7ba3('0xe')],'get':function(){return moment(this[_0x7ba3('0x3')](_0x7ba3('0x12')))[_0x7ba3('0x11')](_0x7ba3('0xf'))[_0x7ba3('0x10')]();}},'updatedAt':{'type':Sequelize[_0x7ba3('0xe')],'get':function(){return moment(this[_0x7ba3('0x3')]('updatedAt'))['format'](_0x7ba3('0xf'))[_0x7ba3('0x10')]();}}}; \ No newline at end of file +var _0x47d6=['INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue'];(function(_0x2f7cdf,_0x3dd24b){var _0x34fa6d=function(_0x3c2007){while(--_0x3c2007){_0x2f7cdf['push'](_0x2f7cdf['shift']());}};_0x34fa6d(++_0x3dd24b);}(_0x47d6,0x13f));var _0x647d=function(_0x2a24ef,_0x516cf6){_0x2a24ef=_0x2a24ef-0x0;var _0x1f446e=_0x47d6[_0x2a24ef];return _0x1f446e;};'use strict';var Sequelize=require(_0x647d('0x0'));var moment=require(_0x647d('0x1'));var path=require(_0x647d('0x2'));var config=require(_0x647d('0x3'));module[_0x647d('0x4')]={'format':{'type':Sequelize[_0x647d('0x5')],'get':function(){return this[_0x647d('0x6')](_0x647d('0x7'))?path[_0x647d('0x8')](this[_0x647d('0x6')](_0x647d('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x647d('0x9')]},'channel':{'type':Sequelize[_0x647d('0x9')]},'value':{'type':Sequelize[_0x647d('0x9')],'set':function(_0x1db1db){var _0x1c6a88=_0x1db1db['replace'](/\\/g,'/');this[_0x647d('0xa')](_0x647d('0x7'),_0x1c6a88);}},'rating':{'type':Sequelize[_0x647d('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x647d('0xb')],'set':function(_0x414518){this[_0x647d('0xa')](_0x647d('0xc'),moment()[_0x647d('0xd')](_0x414518,'ms'));this[_0x647d('0xa')](_0x647d('0xe'),moment());this[_0x647d('0xa')](_0x647d('0xf'),_0x414518);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x647d('0xc')))[_0x647d('0x10')](_0x647d('0x11'))[_0x647d('0x12')]();}},'closedAt':{'type':Sequelize[_0x647d('0x13')],'get':function(){return moment(this[_0x647d('0x6')](_0x647d('0xe')))[_0x647d('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x647d('0x12')]();}},'createdAt':{'type':Sequelize[_0x647d('0x13')],'get':function(){return moment(this['getDataValue'](_0x647d('0x14')))[_0x647d('0x10')](_0x647d('0x11'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x647d('0x6')](_0x647d('0x15')))[_0x647d('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x647d('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 845bbde..47f95ed 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 _0x207c=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','duration','createdAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','recording','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb'];(function(_0x43cea0,_0x479e22){var _0x2b742f=function(_0x420b7f){while(--_0x420b7f){_0x43cea0['push'](_0x43cea0['shift']());}};_0x2b742f(++_0x479e22);}(_0x207c,0x1e8));var _0xc207=function(_0x4ded16,_0x23fcbf){_0x4ded16=_0x4ded16-0x0;var _0x4a525a=_0x207c[_0x4ded16];return _0x4a525a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc207('0x0'));var zipdir=require(_0xc207('0x1'));var jsonpatch=require(_0xc207('0x2'));var rp=require(_0xc207('0x3'));var moment=require(_0xc207('0x4'));var BPromise=require(_0xc207('0x5'));var Mustache=require(_0xc207('0x6'));var util=require('util');var path=require(_0xc207('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc207('0x8'));var _=require(_0xc207('0x9'));var squel=require(_0xc207('0xa'));var crypto=require('crypto');var jsforce=require(_0xc207('0xb'));var deskjs=require(_0xc207('0xc'));var toCsv=require(_0xc207('0xd'));var querystring=require('querystring');var Papa=require(_0xc207('0xe'));var Redis=require(_0xc207('0xf'));var authService=require(_0xc207('0x10'));var qs=require(_0xc207('0x11'));var as=require(_0xc207('0x12'));var hardwareService=require(_0xc207('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc207('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc207('0x15'))['db'];function respondWithStatusCode(_0x2782ce,_0x59d401){_0x59d401=_0x59d401||0xcc;return function(_0x3e1108){if(_0x3e1108){return _0x2782ce[_0xc207('0x16')](_0x59d401);}return _0x2782ce[_0xc207('0x17')](_0x59d401)[_0xc207('0x18')]();};}function respondWithResult(_0xe993a0,_0x51e967){_0x51e967=_0x51e967||0xc8;return function(_0xc62672){if(_0xc62672){return _0xe993a0[_0xc207('0x17')](_0x51e967)[_0xc207('0x19')](_0xc62672);}};}function respondWithFilteredResult(_0x4031ad,_0x4ef6c4){return function(_0x564cef){if(_0x564cef){var _0x554e5c=typeof _0x4ef6c4[_0xc207('0x1a')]===_0xc207('0x1b')&&typeof _0x4ef6c4[_0xc207('0x1c')]===_0xc207('0x1b');var _0x4b8f44=_0x564cef[_0xc207('0x1d')];var _0x282595=_0x554e5c?0x0:_0x4ef6c4[_0xc207('0x1a')];var _0x5f288e=_0x554e5c?_0x564cef[_0xc207('0x1d')]:_0x4ef6c4['offset']+_0x4ef6c4[_0xc207('0x1c')];var _0x33ddb1;if(_0x5f288e>=_0x4b8f44){_0x5f288e=_0x4b8f44;_0x33ddb1=0xc8;}else{_0x33ddb1=0xce;}_0x4031ad[_0xc207('0x17')](_0x33ddb1);return _0x4031ad[_0xc207('0x1e')](_0xc207('0x1f'),_0x282595+'-'+_0x5f288e+'/'+_0x4b8f44)[_0xc207('0x19')](_0x564cef);}return null;};}function patchUpdates(_0x35c0b0){return function(_0x464dea){try{jsonpatch[_0xc207('0x20')](_0x464dea,_0x35c0b0,!![]);}catch(_0x2bd2eb){return BPromise[_0xc207('0x21')](_0x2bd2eb);}return _0x464dea[_0xc207('0x22')]();};}function saveUpdates(_0x40de25,_0x4b52a7){return function(_0x163b36){if(_0x163b36){return _0x163b36['update'](_0x40de25)[_0xc207('0x23')](function(_0x3ac142){return _0x3ac142;});}return null;};}function removeEntity(_0x1eabe8,_0x83253f){return function(_0x3539f4){if(_0x3539f4){return _0x3539f4[_0xc207('0x24')]()[_0xc207('0x23')](function(){_0x1eabe8[_0xc207('0x17')](0xcc)[_0xc207('0x18')]();});}};}function handleEntityNotFound(_0x2385f7,_0x25c91e){return function(_0x27df03){if(!_0x27df03){_0x2385f7[_0xc207('0x16')](0x194);}return _0x27df03;};}function handleError(_0x138970,_0x1445d3){_0x1445d3=_0x1445d3||0x1f4;return function(_0x56a066){logger[_0xc207('0x25')](_0x56a066['stack']);if(_0x56a066['name']){delete _0x56a066[_0xc207('0x26')];}_0x138970[_0xc207('0x17')](_0x1445d3)[_0xc207('0x27')](_0x56a066);};}exports[_0xc207('0x28')]=function(_0x6a653d,_0x478af7){var _0xe5e848={},_0x463ac8={},_0x6223ef={'count':0x0,'rows':[]};var _0x1bec3f=_[_0xc207('0x29')](db[_0xc207('0x2a')][_0xc207('0x2b')],function(_0x27bc72){return{'name':_0x27bc72[_0xc207('0x2c')],'type':_0x27bc72[_0xc207('0x2d')][_0xc207('0x2e')]};});_0x463ac8[_0xc207('0x2f')]=_[_0xc207('0x30')](_['map'](_0x1bec3f,_0xc207('0x26')),[_0xc207('0x31')]);_0x463ac8[_0xc207('0x32')]=_[_0xc207('0x33')](_0x6a653d[_0xc207('0x32')]);_0x463ac8[_0xc207('0x34')]=_['intersection'](_0x463ac8[_0xc207('0x2f')],_0x463ac8[_0xc207('0x32')]);_0xe5e848[_0xc207('0x35')]=_[_0xc207('0x36')](_0x463ac8['model'],qs[_0xc207('0x37')](_0x6a653d[_0xc207('0x32')][_0xc207('0x37')]));_0xe5e848[_0xc207('0x35')]=_0xe5e848[_0xc207('0x35')][_0xc207('0x38')]?_0xe5e848[_0xc207('0x35')]:_0x463ac8[_0xc207('0x2f')];if(!_0x6a653d[_0xc207('0x32')]['hasOwnProperty']('nolimit')){_0xe5e848[_0xc207('0x1c')]=qs[_0xc207('0x1c')](_0x6a653d[_0xc207('0x32')][_0xc207('0x1c')]);_0xe5e848['offset']=qs[_0xc207('0x1a')](_0x6a653d[_0xc207('0x32')][_0xc207('0x1a')]);}_0xe5e848[_0xc207('0x39')]=qs[_0xc207('0x3a')](_0x6a653d['query'][_0xc207('0x3a')]);_0xe5e848[_0xc207('0x3b')]=qs['filters'](_[_0xc207('0x3c')](_0x6a653d['query'],_0x463ac8[_0xc207('0x34')]),_0x1bec3f);if(_0x6a653d[_0xc207('0x32')]['filter']){_0xe5e848[_0xc207('0x3b')]=_[_0xc207('0x3d')](_0xe5e848[_0xc207('0x3b')],{'$or':_['map'](_0x1bec3f,function(_0x5b3041){if(_0x5b3041[_0xc207('0x2d')]!==_0xc207('0x3e')){var _0x41d66c={};_0x41d66c[_0x5b3041[_0xc207('0x26')]]={'$like':'%'+_0x6a653d['query'][_0xc207('0x3f')]+'%'};return _0x41d66c;}})});}_0xe5e848=_['merge']({},_0xe5e848,_0x6a653d['options']);var _0x4c10ed={'where':_0xe5e848['where']};return db[_0xc207('0x2a')][_0xc207('0x1d')](_0x4c10ed)[_0xc207('0x23')](function(_0x487f98){_0x6223ef[_0xc207('0x1d')]=_0x487f98;if(_0x6a653d[_0xc207('0x32')][_0xc207('0x40')]){_0xe5e848[_0xc207('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xc207('0x42')](_0xe5e848);})[_0xc207('0x23')](function(_0x123a46){_0x6223ef[_0xc207('0x43')]=_0x123a46;return _0x6223ef;})[_0xc207('0x23')](respondWithFilteredResult(_0x478af7,_0xe5e848))['catch'](handleError(_0x478af7,null));};exports[_0xc207('0x44')]=function(_0x19a67d,_0x3a935a){var _0x471a85={'raw':![],'where':{'id':_0x19a67d[_0xc207('0x45')]['id']}},_0x153490={};_0x153490[_0xc207('0x2f')]=_[_0xc207('0x33')](db[_0xc207('0x2a')]['rawAttributes']);_0x153490[_0xc207('0x32')]=_[_0xc207('0x33')](_0x19a67d['query']);_0x153490[_0xc207('0x34')]=_[_0xc207('0x36')](_0x153490[_0xc207('0x2f')],_0x153490[_0xc207('0x32')]);_0x471a85[_0xc207('0x35')]=_['intersection'](_0x153490[_0xc207('0x2f')],qs[_0xc207('0x37')](_0x19a67d[_0xc207('0x32')]['fields']));_0x471a85[_0xc207('0x35')]=_0x471a85[_0xc207('0x35')][_0xc207('0x38')]?_0x471a85[_0xc207('0x35')]:_0x153490['model'];if(_0x19a67d['query'][_0xc207('0x40')]){_0x471a85[_0xc207('0x41')]=[{'all':!![]}];}_0x471a85=_[_0xc207('0x3d')]({},_0x471a85,_0x19a67d[_0xc207('0x46')]);return db[_0xc207('0x2a')][_0xc207('0x47')](_0x471a85)[_0xc207('0x23')](handleEntityNotFound(_0x3a935a,null))[_0xc207('0x23')](respondWithResult(_0x3a935a,null))[_0xc207('0x48')](handleError(_0x3a935a,null));};exports[_0xc207('0x49')]=function(_0x2afcd1,_0x2fda4f){return db['ScreenRecording']['create'](_0x2afcd1[_0xc207('0x4a')],{})[_0xc207('0x23')](respondWithResult(_0x2fda4f,0xc9))[_0xc207('0x48')](handleError(_0x2fda4f,null));};exports['update']=function(_0x2b89e0,_0x3f712d){if(_0x2b89e0[_0xc207('0x4a')]['id']){delete _0x2b89e0[_0xc207('0x4a')]['id'];}delete _0x2b89e0['body'][_0xc207('0x4b')];delete _0x2b89e0['body'][_0xc207('0x4c')];delete _0x2b89e0['body']['closedAt'];delete _0x2b89e0[_0xc207('0x4a')][_0xc207('0x4d')];return db['ScreenRecording']['find']({'where':{'id':_0x2b89e0['params']['id']}})[_0xc207('0x23')](handleEntityNotFound(_0x3f712d,null))[_0xc207('0x23')](saveUpdates(_0x2b89e0[_0xc207('0x4a')],null))[_0xc207('0x23')](respondWithResult(_0x3f712d,null))[_0xc207('0x48')](handleError(_0x3f712d,null));};exports[_0xc207('0x4e')]=function(_0x3dc457,_0x1dfdee){return db['ScreenRecording'][_0xc207('0x4e')]()[_0xc207('0x23')](respondWithResult(_0x1dfdee,null))['catch'](handleError(_0x1dfdee,null));};exports['download']=function(_0x362001,_0x47c630,_0x49a78b){var _0x2634d6=require(_0xc207('0x4f'));var _0x356c8c=![];var _0x3b2448={};if(_0x362001[_0xc207('0x32')][_0xc207('0x2d')]&&_0x362001[_0xc207('0x32')][_0xc207('0x2d')]===_0xc207('0x50')){_0x3b2448[_0xc207('0x50')]=_0x362001[_0xc207('0x45')]['id'];}else{_0x3b2448['id']=_0x362001['params']['id'];}return db['ScreenRecording'][_0xc207('0x47')]({'where':_0x3b2448,'attributes':['id',_0xc207('0x4d')],'raw':!![]})[_0xc207('0x23')](handleEntityNotFound(_0x47c630,null))[_0xc207('0x23')](function(_0xaff7a0){if(_0xaff7a0){var _0x21c12b=path[_0xc207('0x51')](config[_0xc207('0x52')],_0xc207('0x53'),_0xaff7a0['value']);var _0x1cc4e3=util[_0xc207('0x31')](_0xc207('0x54'),_0x21c12b);if(fs[_0xc207('0x55')](_0x1cc4e3)){_0x356c8c=!![];return _0x2634d6['decryptFile'](_0x1cc4e3,_0x21c12b,config[_0xc207('0x56')][_0xc207('0x57')])[_0xc207('0x23')](function(){return _0xaff7a0;});}return _0xaff7a0;}})[_0xc207('0x23')](function(_0x464263){if(_0x464263){var _0x45ad58=path[_0xc207('0x51')](config['root'],_0xc207('0x53'),_0x464263[_0xc207('0x4d')]);if(!fs[_0xc207('0x55')](_0x45ad58)){throw new db[(_0xc207('0x58'))]['ValidationError'](_0xc207('0x59'));}if(_0x464263['filename']){return _0x47c630['download'](_0x45ad58,_0x464263[_0xc207('0x5a')]+path[_0xc207('0x5b')](_0x45ad58),function(){if(_0x356c8c){fs[_0xc207('0x5c')](_0x45ad58);}});}else{return _0x47c630[_0xc207('0x5d')](_0x45ad58,function(_0x441d5f){if(_0x356c8c){fs[_0xc207('0x5c')](_0x45ad58);}});}}})[_0xc207('0x48')](function(_0x33c372){if(_0x33c372[_0xc207('0x5e')]===_0xc207('0x59')){_0x47c630[_0xc207('0x17')](0x194)[_0xc207('0x27')](_0xc207('0x5f'));}else{return handleError(_0x47c630,null);}});};exports[_0xc207('0x24')]=function(_0x282ae5,_0x501bca){return db[_0xc207('0x2a')]['find']({'where':{'id':_0x282ae5[_0xc207('0x45')]['id']}})[_0xc207('0x23')](function(_0x2ade23){if(_['isNil'](_0x2ade23)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2ade23;})[_0xc207('0x23')](function(_0x3ac0dd){var _0x2f18a2=path['join'](config[_0xc207('0x52')],_0xc207('0x53'),_0x3ac0dd[_0xc207('0x4d')]);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x2f18a2);if(!_[_0xc207('0x60')](_0x3ac0dd['value'])&&fs[_0xc207('0x55')](_0x2f18a2)){logger[_0xc207('0x61')](_0xc207('0x62')+_0x2f18a2+_0xc207('0x63'));fs[_0xc207('0x64')](_0x2f18a2);}_0x2f18a2=_0x2f18a2+_0xc207('0x65');if(!_[_0xc207('0x60')](_0x3ac0dd[_0xc207('0x4d')])&&fs['existsSync'](_0x2f18a2)){logger[_0xc207('0x61')](_0xc207('0x62')+_0x2f18a2+_0xc207('0x63'));fs[_0xc207('0x64')](_0x2f18a2);}return _0x3ac0dd;})[_0xc207('0x23')](function(_0x14050a){if(!_0x14050a)throw new InternalError();return _0x14050a[_0xc207('0x24')]();})[_0xc207('0x23')](function(){_0x501bca[_0xc207('0x17')](0xcc)[_0xc207('0x18')]();})[_0xc207('0x48')](handleError(_0x501bca,null));}; \ No newline at end of file +var _0x9957=['sort','pick','filter','where','merge','map','VIRTUAL','options','ScreenRecording','includeAll','include','catch','show','rawAttributes','find','create','body','duration','closedAt','params','describe','download','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','Sequelize','filename','extname','unlink','message','ScreenRecording\x20not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','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','index','fieldName','type','key','model','differenceBy','format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x16ad0a,_0x111e11){var _0x2da9f3=function(_0x3960d6){while(--_0x3960d6){_0x16ad0a['push'](_0x16ad0a['shift']());}};_0x2da9f3(++_0x111e11);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ScreenRecording']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_['map'](_0x4253e5,'name'),[_0x7995('0x31')]);_0x456a28['query']=_[_0x7995('0x32')](_0x4b6f99[_0x7995('0x33')]);_0x456a28[_0x7995('0x34')]=_[_0x7995('0x35')](_0x456a28[_0x7995('0x2f')],_0x456a28['query']);_0x514445[_0x7995('0x36')]=_[_0x7995('0x35')](_0x456a28['model'],qs['fields'](_0x4b6f99['query'][_0x7995('0x37')]));_0x514445[_0x7995('0x36')]=_0x514445['attributes'][_0x7995('0x38')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99[_0x7995('0x33')][_0x7995('0x39')]('nolimit')){_0x514445['limit']=qs[_0x7995('0x21')](_0x4b6f99['query']['limit']);_0x514445[_0x7995('0x20')]=qs[_0x7995('0x20')](_0x4b6f99['query'][_0x7995('0x20')]);}_0x514445[_0x7995('0x3a')]=qs[_0x7995('0x3b')](_0x4b6f99[_0x7995('0x33')][_0x7995('0x3b')]);_0x514445['where']=qs[_0x7995('0x34')](_[_0x7995('0x3c')](_0x4b6f99[_0x7995('0x33')],_0x456a28[_0x7995('0x34')]),_0x4253e5);if(_0x4b6f99['query'][_0x7995('0x3d')]){_0x514445[_0x7995('0x3e')]=_[_0x7995('0x3f')](_0x514445[_0x7995('0x3e')],{'$or':_[_0x7995('0x40')](_0x4253e5,function(_0x1035dc){if(_0x1035dc['type']!==_0x7995('0x41')){var _0x3be298={};_0x3be298[_0x1035dc[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x33')][_0x7995('0x3d')]+'%'};return _0x3be298;}})});}_0x514445=_[_0x7995('0x3f')]({},_0x514445,_0x4b6f99[_0x7995('0x42')]);var _0x270c0e={'where':_0x514445[_0x7995('0x3e')]};return db[_0x7995('0x43')][_0x7995('0x1f')](_0x270c0e)[_0x7995('0x26')](function(_0x7b4e67){_0x3250e0['count']=_0x7b4e67;if(_0x4b6f99['query'][_0x7995('0x44')]){_0x514445[_0x7995('0x45')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x514445);})[_0x7995('0x26')](function(_0x4a9fef){_0x3250e0['rows']=_0x4a9fef;return _0x3250e0;})[_0x7995('0x26')](respondWithFilteredResult(_0x9b2a15,_0x514445))[_0x7995('0x46')](handleError(_0x9b2a15,null));};exports[_0x7995('0x47')]=function(_0x576b96,_0x46ac4f){var _0x5e85b9={'raw':![],'where':{'id':_0x576b96['params']['id']}},_0x3993b5={};_0x3993b5['model']=_[_0x7995('0x32')](db[_0x7995('0x43')][_0x7995('0x48')]);_0x3993b5[_0x7995('0x33')]=_['keys'](_0x576b96[_0x7995('0x33')]);_0x3993b5[_0x7995('0x34')]=_[_0x7995('0x35')](_0x3993b5[_0x7995('0x2f')],_0x3993b5['query']);_0x5e85b9['attributes']=_[_0x7995('0x35')](_0x3993b5['model'],qs[_0x7995('0x37')](_0x576b96['query'][_0x7995('0x37')]));_0x5e85b9['attributes']=_0x5e85b9[_0x7995('0x36')][_0x7995('0x38')]?_0x5e85b9['attributes']:_0x3993b5[_0x7995('0x2f')];if(_0x576b96[_0x7995('0x33')][_0x7995('0x44')]){_0x5e85b9[_0x7995('0x45')]=[{'all':!![]}];}_0x5e85b9=_['merge']({},_0x5e85b9,_0x576b96[_0x7995('0x42')]);return db[_0x7995('0x43')][_0x7995('0x49')](_0x5e85b9)['then'](handleEntityNotFound(_0x46ac4f,null))[_0x7995('0x26')](respondWithResult(_0x46ac4f,null))[_0x7995('0x46')](handleError(_0x46ac4f,null));};exports[_0x7995('0x4a')]=function(_0x3d8ae3,_0x255313){return db['ScreenRecording'][_0x7995('0x4a')](_0x3d8ae3[_0x7995('0x4b')],{})['then'](respondWithResult(_0x255313,0xc9))[_0x7995('0x46')](handleError(_0x255313,null));};exports['update']=function(_0x1d87f9,_0x187735){if(_0x1d87f9[_0x7995('0x4b')]['id']){delete _0x1d87f9[_0x7995('0x4b')]['id'];}delete _0x1d87f9[_0x7995('0x4b')][_0x7995('0x4c')];delete _0x1d87f9[_0x7995('0x4b')]['createdAt'];delete _0x1d87f9[_0x7995('0x4b')][_0x7995('0x4d')];delete _0x1d87f9[_0x7995('0x4b')]['value'];return db[_0x7995('0x43')][_0x7995('0x49')]({'where':{'id':_0x1d87f9[_0x7995('0x4e')]['id']}})['then'](handleEntityNotFound(_0x187735,null))['then'](saveUpdates(_0x1d87f9['body'],null))[_0x7995('0x26')](respondWithResult(_0x187735,null))[_0x7995('0x46')](handleError(_0x187735,null));};exports['describe']=function(_0x1cd85,_0x29f300){return db[_0x7995('0x43')][_0x7995('0x4f')]()[_0x7995('0x26')](respondWithResult(_0x29f300,null))['catch'](handleError(_0x29f300,null));};exports[_0x7995('0x50')]=function(_0x4ab09f,_0x14fe7f,_0x33c801){var _0x206d2a=require('../../components/encryptor');var _0x5e1f34=![];var _0x54e2b1={};if(_0x4ab09f['query'][_0x7995('0x2d')]&&_0x4ab09f[_0x7995('0x33')][_0x7995('0x2d')]===_0x7995('0x51')){_0x54e2b1[_0x7995('0x51')]=_0x4ab09f[_0x7995('0x4e')]['id'];}else{_0x54e2b1['id']=_0x4ab09f[_0x7995('0x4e')]['id'];}return db[_0x7995('0x43')][_0x7995('0x49')]({'where':_0x54e2b1,'attributes':['id',_0x7995('0x52')],'raw':!![]})[_0x7995('0x26')](handleEntityNotFound(_0x14fe7f,null))[_0x7995('0x26')](function(_0x3da72b){if(_0x3da72b){var _0x35bea3=path[_0x7995('0x53')](config[_0x7995('0x54')],_0x7995('0x55'),_0x3da72b[_0x7995('0x52')]);var _0x45e86e=util['format'](_0x7995('0x56'),_0x35bea3);if(fs[_0x7995('0x57')](_0x45e86e)){_0x5e1f34=!![];return _0x206d2a[_0x7995('0x58')](_0x45e86e,_0x35bea3,config[_0x7995('0x59')]['recording'])['then'](function(){return _0x3da72b;});}return _0x3da72b;}})[_0x7995('0x26')](function(_0x197b52){if(_0x197b52){var _0x5b9467=path[_0x7995('0x53')](config['root'],_0x7995('0x55'),_0x197b52[_0x7995('0x52')]);if(!fs[_0x7995('0x57')](_0x5b9467)){throw new db[(_0x7995('0x5a'))]['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x197b52[_0x7995('0x5b')]){return _0x14fe7f[_0x7995('0x50')](_0x5b9467,_0x197b52[_0x7995('0x5b')]+path[_0x7995('0x5c')](_0x5b9467),function(){if(_0x5e1f34){fs[_0x7995('0x5d')](_0x5b9467);}});}else{return _0x14fe7f[_0x7995('0x50')](_0x5b9467,function(_0x1d4689){if(_0x5e1f34){fs[_0x7995('0x5d')](_0x5b9467);}});}}})[_0x7995('0x46')](function(_0x50caf5){if(_0x50caf5[_0x7995('0x5e')]===_0x7995('0x5f')){_0x14fe7f[_0x7995('0x1c')](0x194)[_0x7995('0x2a')]('Not\x20found');}else{return handleError(_0x14fe7f,null);}});};exports['destroy']=function(_0x3053fd,_0xebb5c8){return db['ScreenRecording'][_0x7995('0x49')]({'where':{'id':_0x3053fd[_0x7995('0x4e')]['id']}})[_0x7995('0x26')](function(_0x57727e){if(_[_0x7995('0x60')](_0x57727e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x57727e;})[_0x7995('0x26')](function(_0x564fca){var _0x3e0a46=path[_0x7995('0x53')](config[_0x7995('0x54')],_0x7995('0x55'),_0x564fca[_0x7995('0x52')]);logger[_0x7995('0x61')](_0x7995('0x62'),_0x3e0a46);if(!_[_0x7995('0x60')](_0x564fca[_0x7995('0x52')])&&fs[_0x7995('0x57')](_0x3e0a46)){logger[_0x7995('0x61')](_0x7995('0x63')+_0x3e0a46+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x7995('0x64')](_0x3e0a46);}_0x3e0a46=_0x3e0a46+_0x7995('0x65');if(!_[_0x7995('0x60')](_0x564fca[_0x7995('0x52')])&&fs[_0x7995('0x57')](_0x3e0a46)){logger['info']('File:\x20\x22'+_0x3e0a46+_0x7995('0x66'));fs[_0x7995('0x64')](_0x3e0a46);}return _0x564fca;})[_0x7995('0x26')](function(_0xae6166){if(!_0xae6166)throw new InternalError();return _0xae6166['destroy']();})[_0x7995('0x26')](function(){_0xebb5c8['status'](0xcc)['end']();})[_0x7995('0x46')](handleError(_0xebb5c8,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index a57ce68..098ee01 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 _0x6b92=['screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./screenRecording.attributes','exports','define'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x6b92,0x12e));var _0x26b9=function(_0xec9d5c,_0x3c0e38){_0xec9d5c=_0xec9d5c-0x0;var _0x49e9ba=_0x6b92[_0xec9d5c];return _0x49e9ba;};'use strict';var _=require(_0x26b9('0x0'));var util=require(_0x26b9('0x1'));var logger=require(_0x26b9('0x2'))(_0x26b9('0x3'));var moment=require(_0x26b9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x26b9('0x5'));var config=require(_0x26b9('0x6'));var attributes=require(_0x26b9('0x7'));module[_0x26b9('0x8')]=function(_0x3add74,_0x48f355){return _0x3add74[_0x26b9('0x9')]('ScreenRecording',attributes,{'tableName':_0x26b9('0xa'),'paranoid':![],'indexes':[{'name':_0x26b9('0xb'),'fields':[_0x26b9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdd80=['util','../../config/logger','api','path','rimraf','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash'];(function(_0x513bfb,_0x140a1f){var _0x20ab79=function(_0x83733c){while(--_0x83733c){_0x513bfb['push'](_0x513bfb['shift']());}};_0x20ab79(++_0x140a1f);}(_0xdd80,0x83));var _0x0dd8=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xdd80[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x0dd8('0x0'));var util=require(_0x0dd8('0x1'));var logger=require(_0x0dd8('0x2'))(_0x0dd8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0dd8('0x4'));var rimraf=require(_0x0dd8('0x5'));var config=require('../../config/environment');var attributes=require(_0x0dd8('0x6'));module[_0x0dd8('0x7')]=function(_0x44feaa,_0x34e59d){return _0x44feaa['define'](_0x0dd8('0x8'),attributes,{'tableName':_0x0dd8('0x9'),'paranoid':![],'indexes':[{'name':_0x0dd8('0xa'),'fields':[_0x0dd8('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 635dc22..dd2d0be 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 _0x686b=['debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s'];(function(_0x589104,_0x3b7fac){var _0x985044=function(_0x4e79e2){while(--_0x4e79e2){_0x589104['push'](_0x589104['shift']());}};_0x985044(++_0x3b7fac);}(_0x686b,0x193));var _0xb686=function(_0x326dd0,_0x12121e){_0x326dd0=_0x326dd0-0x0;var _0x598f80=_0x686b[_0x326dd0];return _0x598f80;};'use strict';var _=require(_0xb686('0x0'));var util=require('util');var moment=require(_0xb686('0x1'));var BPromise=require(_0xb686('0x2'));var rs=require(_0xb686('0x3'));var fs=require('fs');var Redis=require(_0xb686('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb686('0x5'));var logger=require(_0xb686('0x6'))(_0xb686('0x7'));var config=require(_0xb686('0x8'));var jayson=require(_0xb686('0x9'));var client=jayson['client'][_0xb686('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x308362,_0x37f2d4,_0x3b74cb){return new BPromise(function(_0x35b204,_0x427432){return client[_0xb686('0xb')](_0x308362,_0x3b74cb)[_0xb686('0xc')](function(_0x2233b7){logger[_0xb686('0xd')](_0xb686('0xe'),_0x37f2d4,'request\x20sent');logger[_0xb686('0xf')](_0xb686('0x10'),_0x37f2d4,'request\x20sent',JSON['stringify'](_0x2233b7));if(_0x2233b7[_0xb686('0x11')]){if(_0x2233b7[_0xb686('0x11')][_0xb686('0x12')]===0x1f4){logger[_0xb686('0x11')](_0xb686('0xe'),_0x37f2d4,_0x2233b7[_0xb686('0x11')][_0xb686('0x13')]);return _0x427432(_0x2233b7[_0xb686('0x11')][_0xb686('0x13')]);}logger['error'](_0xb686('0xe'),_0x37f2d4,_0x2233b7[_0xb686('0x11')][_0xb686('0x13')]);return _0x35b204(_0x2233b7[_0xb686('0x11')][_0xb686('0x13')]);}else{logger['info'](_0xb686('0xe'),_0x37f2d4,_0xb686('0x14'));_0x35b204(_0x2233b7['result']['message']);}})[_0xb686('0x15')](function(_0x4be911){logger[_0xb686('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x37f2d4,_0x4be911);_0x427432(_0x4be911);});});} \ No newline at end of file +var _0xec6f=['../../config/environment','jayson/promise','http','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1517be,_0x499922){var _0x3a275e=function(_0xcbd79c){while(--_0xcbd79c){_0x1517be['push'](_0x1517be['shift']());}};_0x3a275e(++_0x499922);}(_0xec6f,0x7b));var _0xfec6=function(_0x1d77c8,_0x474bcf){_0x1d77c8=_0x1d77c8-0x0;var _0x3efd70=_0xec6f[_0x1d77c8];return _0x3efd70;};'use strict';var _=require(_0xfec6('0x0'));var util=require(_0xfec6('0x1'));var moment=require(_0xfec6('0x2'));var BPromise=require(_0xfec6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfec6('0x4'));var db=require(_0xfec6('0x5'))['db'];var utils=require(_0xfec6('0x6'));var logger=require(_0xfec6('0x7'))(_0xfec6('0x8'));var config=require(_0xfec6('0x9'));var jayson=require(_0xfec6('0xa'));var client=jayson['client'][_0xfec6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb7edce,_0x367305,_0x2c745e){return new BPromise(function(_0x45fddd,_0x4ee11f){return client[_0xfec6('0xc')](_0xb7edce,_0x2c745e)['then'](function(_0x3899ff){logger[_0xfec6('0xd')](_0xfec6('0xe'),_0x367305,_0xfec6('0xf'));logger[_0xfec6('0x10')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x367305,_0xfec6('0xf'),JSON['stringify'](_0x3899ff));if(_0x3899ff[_0xfec6('0x11')]){if(_0x3899ff[_0xfec6('0x11')][_0xfec6('0x12')]===0x1f4){logger[_0xfec6('0x11')](_0xfec6('0xe'),_0x367305,_0x3899ff[_0xfec6('0x11')]['message']);return _0x4ee11f(_0x3899ff[_0xfec6('0x11')][_0xfec6('0x13')]);}logger[_0xfec6('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x367305,_0x3899ff[_0xfec6('0x11')]['message']);return _0x45fddd(_0x3899ff[_0xfec6('0x11')]['message']);}else{logger['info'](_0xfec6('0xe'),_0x367305,_0xfec6('0xf'));_0x45fddd(_0x3899ff[_0xfec6('0x14')][_0xfec6('0x13')]);}})[_0xfec6('0x15')](function(_0x5d51c0){logger[_0xfec6('0x11')](_0xfec6('0xe'),_0x367305,_0x5d51c0);_0x4ee11f(_0x5d51c0);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 5bcfca1..03a537f 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 _0xfbb6=['/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','originalname','single','addLogo','logologin','extname','post','file','addLogoLogin','preferred','addPreferred','addFavicon','put','/:id','isAuthenticated','update','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','index','/now','getDate','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr'];(function(_0x46bbc6,_0x3ac8a7){var _0x56440b=function(_0x4eb79d){while(--_0x4eb79d){_0x46bbc6['push'](_0x46bbc6['shift']());}};_0x56440b(++_0x3ac8a7);}(_0xfbb6,0x1e8));var _0x6fbb=function(_0x49cb71,_0x2f0149){_0x49cb71=_0x49cb71-0x0;var _0x3a50fd=_0xfbb6[_0x49cb71];return _0x3a50fd;};'use strict';var multer=require(_0x6fbb('0x0'));var util=require('util');var path=require(_0x6fbb('0x1'));var timeout=require(_0x6fbb('0x2'));var express=require(_0x6fbb('0x3'));var router=express['Router']();var fs_extra=require(_0x6fbb('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6fbb('0x5'));var config=require(_0x6fbb('0x6'));var controller=require('./setting.controller');router[_0x6fbb('0x7')]('/',auth['isAuthenticated'](),controller[_0x6fbb('0x8')]);router[_0x6fbb('0x7')](_0x6fbb('0x9'),controller[_0x6fbb('0xa')]);router[_0x6fbb('0x7')]('/:id',controller[_0x6fbb('0xb')]);router[_0x6fbb('0x7')](_0x6fbb('0xc'),controller['getLogo']);router[_0x6fbb('0x7')](_0x6fbb('0xd'),controller[_0x6fbb('0xe')]);router[_0x6fbb('0x7')](_0x6fbb('0xf'),controller['gdpr']);router[_0x6fbb('0x7')](_0x6fbb('0x10'),controller['getPreferred']);router[_0x6fbb('0x7')](_0x6fbb('0x11'),controller[_0x6fbb('0x12')]);var upload=multer({'storage':multer[_0x6fbb('0x13')]({'destination':function(_0x41c1d7,_0x1eaa4c,_0x1af715){_0x1af715(null,path[_0x6fbb('0x14')](config[_0x6fbb('0x15')],_0x6fbb('0x16')));},'filename':function(_0x23664c,_0x510c89,_0x530f9c){_0x530f9c(null,util[_0x6fbb('0x17')](_0x6fbb('0x18'),_0x6fbb('0x19'),path['extname'](_0x510c89[_0x6fbb('0x1a')])));}})});router['post'](_0x6fbb('0xc'),upload[_0x6fbb('0x1b')]('file'),controller[_0x6fbb('0x1c')]);var upload=multer({'storage':multer[_0x6fbb('0x13')]({'destination':function(_0x459db4,_0x297171,_0x11af41){_0x11af41(null,path[_0x6fbb('0x14')](config[_0x6fbb('0x15')],'server/files/images/logos/'));},'filename':function(_0x3ca9eb,_0x58ff66,_0x4025ba){_0x4025ba(null,util['format'](_0x6fbb('0x18'),_0x6fbb('0x1d'),path[_0x6fbb('0x1e')](_0x58ff66['originalname'])));}})});router[_0x6fbb('0x1f')]('/:id/logo_login',upload[_0x6fbb('0x1b')](_0x6fbb('0x20')),controller[_0x6fbb('0x21')]);var upload=multer({'storage':multer[_0x6fbb('0x13')]({'destination':function(_0x1971d7,_0x4c22ed,_0x44b57d){_0x44b57d(null,path[_0x6fbb('0x14')](config[_0x6fbb('0x15')],_0x6fbb('0x16')));},'filename':function(_0x142b13,_0x2cb577,_0x5785ab){_0x5785ab(null,util['format'](_0x6fbb('0x18'),_0x6fbb('0x22'),path[_0x6fbb('0x1e')](_0x2cb577[_0x6fbb('0x1a')])));}})});router[_0x6fbb('0x1f')](_0x6fbb('0x10'),upload[_0x6fbb('0x1b')](_0x6fbb('0x20')),controller[_0x6fbb('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x57ac49,_0x5ac931,_0x430dc5){_0x430dc5(null,path[_0x6fbb('0x14')](config[_0x6fbb('0x15')],_0x6fbb('0x16')));},'filename':function(_0x3f15a9,_0x4827b6,_0x12d4f6){_0x12d4f6(null,util[_0x6fbb('0x17')](_0x6fbb('0x18'),'favicon',path[_0x6fbb('0x1e')](_0x4827b6['originalname'])));}})});router['post'](_0x6fbb('0x11'),upload['single']('file'),controller[_0x6fbb('0x24')]);router[_0x6fbb('0x25')](_0x6fbb('0x26'),auth[_0x6fbb('0x27')](),controller[_0x6fbb('0x28')]);module[_0x6fbb('0x29')]=router; \ No newline at end of file +var _0xc90a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','get','/now','show','/:id/logo','getLogo','/:id/logo_login','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','format','logo','extname','originalname','post','single','file','join','%s%s','logologin','preferred','addPreferred','favicon','addFavicon','put','/:id','update','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc90a,0x7a));var _0xac90=function(_0xb455c6,_0x4454c8){_0xb455c6=_0xb455c6-0x0;var _0x227540=_0xc90a[_0xb455c6];return _0x227540;};'use strict';var multer=require(_0xac90('0x0'));var util=require(_0xac90('0x1'));var path=require(_0xac90('0x2'));var timeout=require(_0xac90('0x3'));var express=require(_0xac90('0x4'));var router=express[_0xac90('0x5')]();var fs_extra=require(_0xac90('0x6'));var auth=require(_0xac90('0x7'));var interaction=require(_0xac90('0x8'));var config=require(_0xac90('0x9'));var controller=require(_0xac90('0xa'));router['get']('/',auth[_0xac90('0xb')](),controller['index']);router[_0xac90('0xc')](_0xac90('0xd'),controller['getDate']);router[_0xac90('0xc')]('/:id',controller[_0xac90('0xe')]);router[_0xac90('0xc')](_0xac90('0xf'),controller[_0xac90('0x10')]);router[_0xac90('0xc')](_0xac90('0x11'),controller['getLogoLogin']);router[_0xac90('0xc')]('/:id/gdpr',controller[_0xac90('0x12')]);router[_0xac90('0xc')](_0xac90('0x13'),controller[_0xac90('0x14')]);router[_0xac90('0xc')](_0xac90('0x15'),controller[_0xac90('0x16')]);var upload=multer({'storage':multer[_0xac90('0x17')]({'destination':function(_0x57c952,_0x22a535,_0x11d2d1){_0x11d2d1(null,path['join'](config[_0xac90('0x18')],_0xac90('0x19')));},'filename':function(_0x4bdf6e,_0x885535,_0x4bf786){_0x4bf786(null,util[_0xac90('0x1a')]('%s%s',_0xac90('0x1b'),path[_0xac90('0x1c')](_0x885535[_0xac90('0x1d')])));}})});router[_0xac90('0x1e')](_0xac90('0xf'),upload[_0xac90('0x1f')](_0xac90('0x20')),controller['addLogo']);var upload=multer({'storage':multer[_0xac90('0x17')]({'destination':function(_0x1d8e32,_0x489531,_0x16d790){_0x16d790(null,path[_0xac90('0x21')](config['root'],_0xac90('0x19')));},'filename':function(_0x27b5b5,_0x4a8ca5,_0x80b8ec){_0x80b8ec(null,util['format'](_0xac90('0x22'),_0xac90('0x23'),path[_0xac90('0x1c')](_0x4a8ca5[_0xac90('0x1d')])));}})});router['post'](_0xac90('0x11'),upload[_0xac90('0x1f')](_0xac90('0x20')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d4cbe,_0x4fa7b6,_0x497696){_0x497696(null,path['join'](config['root'],_0xac90('0x19')));},'filename':function(_0x4e451f,_0x30e47d,_0x213b90){_0x213b90(null,util['format'](_0xac90('0x22'),_0xac90('0x24'),path[_0xac90('0x1c')](_0x30e47d[_0xac90('0x1d')])));}})});router[_0xac90('0x1e')](_0xac90('0x13'),upload['single'](_0xac90('0x20')),controller[_0xac90('0x25')]);var upload=multer({'storage':multer[_0xac90('0x17')]({'destination':function(_0xe51c98,_0x5e5475,_0x2078eb){_0x2078eb(null,path['join'](config[_0xac90('0x18')],_0xac90('0x19')));},'filename':function(_0x56c0eb,_0x29b56b,_0x21dc51){_0x21dc51(null,util[_0xac90('0x1a')](_0xac90('0x22'),_0xac90('0x26'),path[_0xac90('0x1c')](_0x29b56b[_0xac90('0x1d')])));}})});router[_0xac90('0x1e')](_0xac90('0x15'),upload[_0xac90('0x1f')]('file'),controller[_0xac90('0x27')]);router[_0xac90('0x28')](_0xac90('0x29'),auth['isAuthenticated'](),controller[_0xac90('0x2a')]);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 d1bc5e2..302e417 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 _0x86b6=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING'];(function(_0x4de79e,_0x30121e){var _0x4e27b5=function(_0x169ae5){while(--_0x169ae5){_0x4de79e['push'](_0x4de79e['shift']());}};_0x4e27b5(++_0x30121e);}(_0x86b6,0x112));var _0x686b=function(_0xbc3542,_0x4de021){_0xbc3542=_0xbc3542-0x0;var _0x1c88ff=_0x86b6[_0xbc3542];return _0x1c88ff;};'use strict';var Sequelize=require(_0x686b('0x0'));module[_0x686b('0x1')]={'min_internal':{'type':Sequelize[_0x686b('0x2')](0xb),'unique':_0x686b('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x686b('0x2')](0xb),'unique':_0x686b('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x686b('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x686b('0x5')],'defaultValue':_0x686b('0x6')},'logo':{'type':Sequelize[_0x686b('0x5')]},'defaultLogo':{'type':Sequelize[_0x686b('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x686b('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x686b('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x686b('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x686b('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x686b('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x686b('0x5')]},'turnaddr':{'type':Sequelize[_0x686b('0x5')]},'turnusername':{'type':Sequelize[_0x686b('0x5')]},'turnpassword':{'type':Sequelize[_0x686b('0x5')]},'pageTitle':{'type':Sequelize[_0x686b('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x686b('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x686b('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x686b('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x686b('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x686b('0x5')],'defaultValue':_0x686b('0x8')},'enableEmailPreview':{'type':Sequelize[_0x686b('0x7')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x686b('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x686b('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x686b('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x686b('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x686b('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x686b('0x5')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x686b('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x686b('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x686b('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x686b('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x686b('0x5')]},'defaultFavicon':{'type':Sequelize[_0x686b('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x686b('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x686b('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x686b('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x686b('0x2')]},'transcribeRegion':{'type':Sequelize[_0x686b('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x686b('0x5')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x686b('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x686b('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x686b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x686b('0x2')](0x2)[_0x686b('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x686b('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x686b('0x2')](0x2)[_0x686b('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x686b('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x686b('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x686b('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x686b('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x686b('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x686b('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x686b('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x686b('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x686b('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xaa60=['min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','INTEGER'];(function(_0x38c2cf,_0x3308d5){var _0x5cb5e4=function(_0x5e7d1e){while(--_0x5e7d1e){_0x38c2cf['push'](_0x38c2cf['shift']());}};_0x5cb5e4(++_0x3308d5);}(_0xaa60,0x7d));var _0x0aa6=function(_0x1e4be4,_0x162d0a){_0x1e4be4=_0x1e4be4-0x0;var _0x50621e=_0xaa60[_0x1e4be4];return _0x50621e;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize[_0x0aa6('0x0')](0xb),'unique':_0x0aa6('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x0aa6('0x0')](0xb),'unique':_0x0aa6('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x0aa6('0x0')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0aa6('0x3')],'defaultValue':_0x0aa6('0x4')},'logo':{'type':Sequelize[_0x0aa6('0x3')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0aa6('0x3')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x0aa6('0x3')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0aa6('0x3')]},'defaultPageTitle':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0aa6('0x0')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0aa6('0x3')],'defaultValue':_0x0aa6('0x6')},'enableEmailPreview':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x0aa6('0x0')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0aa6('0x0')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x0aa6('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x0aa6('0x3')]},'defaultPreferred':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0aa6('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0x0aa6('0x0')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0aa6('0x0')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0aa6('0x3')]},'defaultFavicon':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0aa6('0x0')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x0aa6('0x0')]},'transcribeRegion':{'type':Sequelize[_0x0aa6('0x3')]},'sentiment':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x0aa6('0x3')]},'language':{'type':Sequelize[_0x0aa6('0x3')]},'bucket':{'type':Sequelize[_0x0aa6('0x3')]},'googleSsoEnabled':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0aa6('0x0')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0aa6('0x0')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0aa6('0x0')](0x2)[_0x0aa6('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0aa6('0x0')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0aa6('0x0')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x0aa6('0x0')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0aa6('0x0')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x0aa6('0x0')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x0aa6('0x0')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0aa6('0x0')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x0aa6('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0aa6('0x0')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 6660f80..633fafd 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 _0x1801=['destroy','stack','name','index','Setting','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','rows','show','params','include','options','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','root','toLower','join','default_logo.svg','default','upperFirst','Sequelize','\x20not\x20found','getLogoLogin','server/files/images/logos','defaultFavicon','default_loginLogo.svg','ValidationError','download','gdpr','securePassword','addPreferred','default_preferred.png','custom','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','client','http','request','then','info','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','request\x20sent','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','update'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x1801,0xc6));var _0x1180=function(_0x1bfb09,_0x4dcf83){_0x1bfb09=_0x1bfb09-0x0;var _0x16e26a=_0x1801[_0x1bfb09];return _0x16e26a;};'use strict';var emlformat=require(_0x1180('0x0'));var rimraf=require(_0x1180('0x1'));var zipdir=require(_0x1180('0x2'));var jsonpatch=require(_0x1180('0x3'));var rp=require(_0x1180('0x4'));var moment=require(_0x1180('0x5'));var BPromise=require(_0x1180('0x6'));var Mustache=require(_0x1180('0x7'));var util=require(_0x1180('0x8'));var path=require(_0x1180('0x9'));var sox=require(_0x1180('0xa'));var csv=require(_0x1180('0xb'));var ejs=require(_0x1180('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1180('0xd'));var squel=require(_0x1180('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1180('0xf'));var toCsv=require(_0x1180('0xb'));var querystring=require(_0x1180('0x10'));var Papa=require(_0x1180('0x11'));var Redis=require(_0x1180('0x12'));var authService=require(_0x1180('0x13'));var qs=require(_0x1180('0x14'));var as=require(_0x1180('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1180('0x16'))(_0x1180('0x17'));var utils=require(_0x1180('0x18'));var config=require(_0x1180('0x19'));var licenseUtil=require(_0x1180('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x1180('0x1b')][_0x1180('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x405159,_0x218acf,_0xcd59e4,_0x1ae3c6){return new BPromise(function(_0x23876c,_0x414c1d){var _0x4434d2=_0x1ae3c6||client;return _0x4434d2[_0x1180('0x1d')](_0x405159,_0xcd59e4)[_0x1180('0x1e')](function(_0x35807b){logger[_0x1180('0x1f')]('Setting,\x20%s,\x20%s',_0x218acf,'request\x20sent');logger['debug'](_0x1180('0x20'),_0x218acf,'request\x20sent',JSON[_0x1180('0x21')](_0x35807b));if(_0x35807b['error']){if(_0x35807b[_0x1180('0x22')][_0x1180('0x23')]===0x1f4){logger[_0x1180('0x22')](_0x1180('0x24'),_0x218acf,_0x35807b[_0x1180('0x22')][_0x1180('0x25')]);return _0x414c1d(_0x35807b[_0x1180('0x22')][_0x1180('0x25')]);}logger[_0x1180('0x22')](_0x1180('0x24'),_0x218acf,_0x35807b[_0x1180('0x22')]['message']);return _0x23876c(_0x35807b[_0x1180('0x22')][_0x1180('0x25')]);}else{logger[_0x1180('0x1f')]('Setting,\x20%s,\x20%s',_0x218acf,_0x1180('0x26'));_0x23876c(_0x35807b['result'][_0x1180('0x25')]);}})[_0x1180('0x27')](function(_0x3a4e82){logger[_0x1180('0x22')](_0x1180('0x24'),_0x218acf,_0x3a4e82);_0x414c1d(_0x3a4e82);});});}function respondWithStatusCode(_0x4ab2f7,_0x276594){_0x276594=_0x276594||0xcc;return function(_0x199586){if(_0x199586){return _0x4ab2f7[_0x1180('0x28')](_0x276594);}return _0x4ab2f7[_0x1180('0x29')](_0x276594)[_0x1180('0x2a')]();};}function respondWithResult(_0x3f4657,_0x3586ff){_0x3586ff=_0x3586ff||0xc8;return function(_0xdd7df5){if(_0xdd7df5){return _0x3f4657['status'](_0x3586ff)[_0x1180('0x2b')](_0xdd7df5);}};}function respondWithFilteredResult(_0x3f7348,_0x289013){return function(_0x712441){if(_0x712441){var _0x2edc3d=typeof _0x289013['offset']===_0x1180('0x2c')&&typeof _0x289013[_0x1180('0x2d')]===_0x1180('0x2c');var _0x125720=_0x712441['count'];var _0x349783=_0x2edc3d?0x0:_0x289013[_0x1180('0x2e')];var _0x1917f5=_0x2edc3d?_0x712441[_0x1180('0x2f')]:_0x289013[_0x1180('0x2e')]+_0x289013[_0x1180('0x2d')];var _0x5a3f6f;if(_0x1917f5>=_0x125720){_0x1917f5=_0x125720;_0x5a3f6f=0xc8;}else{_0x5a3f6f=0xce;}_0x3f7348['status'](_0x5a3f6f);return _0x3f7348[_0x1180('0x30')](_0x1180('0x31'),_0x349783+'-'+_0x1917f5+'/'+_0x125720)['json'](_0x712441);}return null;};}function patchUpdates(_0x1fdd59){return function(_0x548d03){try{jsonpatch[_0x1180('0x32')](_0x548d03,_0x1fdd59,!![]);}catch(_0xc6513b){return BPromise['reject'](_0xc6513b);}return _0x548d03['save']();};}function saveUpdates(_0x2d2e04,_0x41d55c){return function(_0x3cdaaa){if(_0x3cdaaa){return _0x3cdaaa[_0x1180('0x33')](_0x2d2e04)[_0x1180('0x1e')](function(_0xa88840){return _0xa88840;});}return null;};}function removeEntity(_0x1d5978,_0x57875f){return function(_0x501ae5){if(_0x501ae5){return _0x501ae5[_0x1180('0x34')]()[_0x1180('0x1e')](function(){_0x1d5978[_0x1180('0x29')](0xcc)[_0x1180('0x2a')]();});}};}function handleEntityNotFound(_0xe7535a,_0x566331){return function(_0x2cf6bc){if(!_0x2cf6bc){_0xe7535a[_0x1180('0x28')](0x194);}return _0x2cf6bc;};}function handleError(_0x490429,_0xa2aff8){_0xa2aff8=_0xa2aff8||0x1f4;return function(_0xb6167c){logger['error'](_0xb6167c[_0x1180('0x35')]);if(_0xb6167c[_0x1180('0x36')]){delete _0xb6167c[_0x1180('0x36')];}_0x490429[_0x1180('0x29')](_0xa2aff8)['send'](_0xb6167c);};}exports[_0x1180('0x37')]=function(_0x28ca12,_0x4cf663){var _0x1d82fd={},_0x8d0c9c={},_0xfdeca8={'count':0x0,'rows':[]};var _0x5bb77e=_['map'](db[_0x1180('0x38')][_0x1180('0x39')],function(_0x5cc735){return{'name':_0x5cc735[_0x1180('0x3a')],'type':_0x5cc735['type'][_0x1180('0x3b')]};});_0x8d0c9c[_0x1180('0x3c')]=_[_0x1180('0x3d')](_0x5bb77e,_0x1180('0x36'));_0x8d0c9c[_0x1180('0x3e')]=_[_0x1180('0x3f')](_0x28ca12['query']);_0x8d0c9c[_0x1180('0x40')]=_[_0x1180('0x41')](_0x8d0c9c[_0x1180('0x3c')],_0x8d0c9c[_0x1180('0x3e')]);_0x1d82fd[_0x1180('0x42')]=_[_0x1180('0x41')](_0x8d0c9c['model'],qs[_0x1180('0x43')](_0x28ca12[_0x1180('0x3e')]['fields']));_0x1d82fd[_0x1180('0x42')]=_0x1d82fd['attributes'][_0x1180('0x44')]?_0x1d82fd[_0x1180('0x42')]:_0x8d0c9c[_0x1180('0x3c')];if(!_0x28ca12[_0x1180('0x3e')][_0x1180('0x45')](_0x1180('0x46'))){_0x1d82fd[_0x1180('0x2d')]=qs['limit'](_0x28ca12[_0x1180('0x3e')][_0x1180('0x2d')]);_0x1d82fd[_0x1180('0x2e')]=qs['offset'](_0x28ca12[_0x1180('0x3e')][_0x1180('0x2e')]);}_0x1d82fd[_0x1180('0x47')]=qs[_0x1180('0x48')](_0x28ca12[_0x1180('0x3e')][_0x1180('0x48')]);_0x1d82fd[_0x1180('0x49')]=qs[_0x1180('0x40')](_[_0x1180('0x4a')](_0x28ca12[_0x1180('0x3e')],_0x8d0c9c[_0x1180('0x40')]),_0x5bb77e);if(_0x28ca12['query'][_0x1180('0x4b')]){_0x1d82fd[_0x1180('0x49')]=_[_0x1180('0x4c')](_0x1d82fd[_0x1180('0x49')],{'$or':_[_0x1180('0x3d')](_0x5bb77e,function(_0x461b38){if(_0x461b38['type']!=='VIRTUAL'){var _0x4c326c={};_0x4c326c[_0x461b38[_0x1180('0x36')]]={'$like':'%'+_0x28ca12[_0x1180('0x3e')][_0x1180('0x4b')]+'%'};return _0x4c326c;}})});}_0x1d82fd=_['merge']({},_0x1d82fd,_0x28ca12['options']);var _0x5ca016={'where':_0x1d82fd[_0x1180('0x49')]};return db[_0x1180('0x38')][_0x1180('0x2f')](_0x5ca016)['then'](function(_0x3a0cb7){_0xfdeca8[_0x1180('0x2f')]=_0x3a0cb7;if(_0x28ca12[_0x1180('0x3e')][_0x1180('0x4d')]){_0x1d82fd['include']=[{'all':!![]}];}return db['Setting']['findAll'](_0x1d82fd);})[_0x1180('0x1e')](function(_0x121b8b){_0xfdeca8[_0x1180('0x4e')]=_0x121b8b;return _0xfdeca8;})['then'](respondWithFilteredResult(_0x4cf663,_0x1d82fd))[_0x1180('0x27')](handleError(_0x4cf663,null));};exports[_0x1180('0x4f')]=function(_0x3d9fd6,_0x1bc2f9){var _0x1f6f97={'raw':![],'where':{'id':_0x3d9fd6[_0x1180('0x50')]['id']}},_0x4a89e3={};_0x4a89e3[_0x1180('0x3c')]=_[_0x1180('0x3f')](db[_0x1180('0x38')][_0x1180('0x39')]);_0x4a89e3[_0x1180('0x3e')]=_[_0x1180('0x3f')](_0x3d9fd6['query']);_0x4a89e3['filters']=_[_0x1180('0x41')](_0x4a89e3[_0x1180('0x3c')],_0x4a89e3['query']);_0x1f6f97[_0x1180('0x42')]=_['intersection'](_0x4a89e3['model'],qs[_0x1180('0x43')](_0x3d9fd6['query'][_0x1180('0x43')]));_0x1f6f97['attributes']=_0x1f6f97[_0x1180('0x42')][_0x1180('0x44')]?_0x1f6f97[_0x1180('0x42')]:_0x4a89e3['model'];if(_0x3d9fd6[_0x1180('0x3e')]['includeAll']){_0x1f6f97[_0x1180('0x51')]=[{'all':!![]}];}_0x1f6f97=_[_0x1180('0x4c')]({},_0x1f6f97,_0x3d9fd6[_0x1180('0x52')]);return db[_0x1180('0x38')][_0x1180('0x53')](_0x1f6f97)[_0x1180('0x1e')](handleEntityNotFound(_0x1bc2f9,null))[_0x1180('0x1e')](respondWithResult(_0x1bc2f9,null))['catch'](handleError(_0x1bc2f9,null));};exports[_0x1180('0x33')]=function(_0x239ebd,_0x3ee12d){if(_0x239ebd['body']['id']){delete _0x239ebd[_0x1180('0x54')]['id'];}return db[_0x1180('0x38')][_0x1180('0x53')]({'where':{'id':_0x239ebd['params']['id']}})[_0x1180('0x1e')](handleEntityNotFound(_0x3ee12d,null))[_0x1180('0x1e')](saveUpdates(_0x239ebd[_0x1180('0x54')],null))[_0x1180('0x1e')](respondWithResult(_0x3ee12d,null))['catch'](handleError(_0x3ee12d,null));};exports[_0x1180('0x55')]=function(_0x11a8f7,_0x360b95,_0xfe8822){if(_0x11a8f7[_0x1180('0x56')]&&_0x11a8f7[_0x1180('0x56')][_0x1180('0x57')]){_0x11a8f7[_0x1180('0x54')][_0x1180('0x58')]=_0x11a8f7[_0x1180('0x56')][_0x1180('0x57')];}return db[_0x1180('0x38')][_0x1180('0x53')]({'where':{'id':_0x11a8f7[_0x1180('0x50')]['id']}})[_0x1180('0x1e')](handleEntityNotFound(_0x360b95,null))[_0x1180('0x1e')](saveUpdates(_0x11a8f7[_0x1180('0x54')],null))['then'](respondWithResult(_0x360b95,null))[_0x1180('0x27')](handleError(_0x360b95,null));};exports[_0x1180('0x59')]=function(_0x16722a,_0x25dd5b,_0xaa4c2f){if(_0x16722a['file']&&_0x16722a[_0x1180('0x56')][_0x1180('0x57')]){_0x16722a[_0x1180('0x54')][_0x1180('0x5a')]=_0x16722a[_0x1180('0x56')][_0x1180('0x57')];}return db[_0x1180('0x38')]['find']({'where':{'id':_0x16722a['params']['id']}})['then'](handleEntityNotFound(_0x25dd5b,null))[_0x1180('0x1e')](saveUpdates(_0x16722a[_0x1180('0x54')],null))[_0x1180('0x1e')](respondWithResult(_0x25dd5b,null))[_0x1180('0x27')](handleError(_0x25dd5b,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x1ca31b,_0x5a233f,_0x3a55b1){var _0x4dfb8e='server/files/images/logos';var _0x15a453={'custom':![]};return utilLicense[_0x1180('0x5b')]()['then'](function(_0x580636){if(_0x580636){_0x15a453=_0x580636;}return db['Setting'][_0x1180('0x53')]({'where':{'id':_0x1ca31b[_0x1180('0x50')]['id']},'attributes':[_0x1180('0x58'),_0x1180('0x5a'),_0x1180('0x5c'),_0x1180('0x5d'),_0x1180('0x5e'),_0x1180('0x5f'),_0x1180('0x60'),'defaultFavicon'],'raw':!![]});})[_0x1180('0x1e')](handleEntityNotFound(_0x5a233f,null))[_0x1180('0x1e')](function(_0x897c66){if(_0x897c66){var _0x3b2d6e=_0x897c66['logo']&&fs[_0x1180('0x61')](path['join'](config[_0x1180('0x62')],_0x4dfb8e,_[_0x1180('0x63')](_0x897c66['logo'])))?path[_0x1180('0x64')](config[_0x1180('0x62')],_0x4dfb8e,_[_0x1180('0x63')](_0x897c66[_0x1180('0x58')])):path[_0x1180('0x64')](config[_0x1180('0x62')],_0x4dfb8e,_[_0x1180('0x63')](_0x1180('0x65')));var _0x131e40=_0x1180('0x66')+_[_0x1180('0x67')](_0x1180('0x58'));if(_0x897c66[_0x131e40]||!_0x15a453['custom']){_0x3b2d6e=path['join'](config[_0x1180('0x62')],_0x4dfb8e,_[_0x1180('0x63')](_0x1180('0x65')));}if(!fs[_0x1180('0x61')](_0x3b2d6e)){throw new db[(_0x1180('0x68'))]['ValidationError'](_[_0x1180('0x67')](_0x1180('0x58'))+_0x1180('0x69'));}return _0x5a233f['download'](_0x3b2d6e);}})[_0x1180('0x27')](handleError(_0x5a233f,null));};var utilLicense=require(_0x1180('0x1a'));exports[_0x1180('0x6a')]=function(_0x43dfc0,_0x23462b,_0x39a2cf){var _0x9a43c7=_0x1180('0x6b');var _0x40bc2d={'custom':![]};return utilLicense[_0x1180('0x5b')]()[_0x1180('0x1e')](function(_0xf88bf6){if(_0xf88bf6){_0x40bc2d=_0xf88bf6;}return db[_0x1180('0x38')]['find']({'where':{'id':_0x43dfc0['params']['id']},'attributes':['logo',_0x1180('0x5a'),_0x1180('0x5c'),_0x1180('0x5d'),_0x1180('0x5e'),_0x1180('0x5f'),'defaultPreferred',_0x1180('0x6c')],'raw':!![]});})['then'](handleEntityNotFound(_0x23462b,null))['then'](function(_0x2dad36){if(_0x2dad36){var _0x54cf92=_0x2dad36[_0x1180('0x5a')]&&fs['existsSync'](path[_0x1180('0x64')](config[_0x1180('0x62')],_0x9a43c7,_[_0x1180('0x63')](_0x2dad36[_0x1180('0x5a')])))?path[_0x1180('0x64')](config['root'],_0x9a43c7,_[_0x1180('0x63')](_0x2dad36['loginLogo'])):path[_0x1180('0x64')](config[_0x1180('0x62')],_0x9a43c7,_[_0x1180('0x63')](_0x1180('0x6d')));var _0x1631b4=_0x1180('0x66')+_[_0x1180('0x67')](_0x1180('0x5a'));if(_0x2dad36[_0x1631b4]||!_0x40bc2d['custom']){_0x54cf92=path[_0x1180('0x64')](config[_0x1180('0x62')],_0x9a43c7,_[_0x1180('0x63')]('default_loginLogo.svg'));}if(!fs[_0x1180('0x61')](_0x54cf92)){throw new db[(_0x1180('0x68'))][(_0x1180('0x6e'))](_['upperFirst']('loginLogo')+_0x1180('0x69'));}return _0x23462b[_0x1180('0x6f')](_0x54cf92);}})[_0x1180('0x27')](handleError(_0x23462b,null));};exports[_0x1180('0x70')]=function(_0x3cb19a,_0x3fe32c){return db[_0x1180('0x38')][_0x1180('0x53')]({'where':{'id':_0x3cb19a[_0x1180('0x50')]['id']},'attributes':[_0x1180('0x71')]})[_0x1180('0x1e')](respondWithResult(_0x3fe32c,null))[_0x1180('0x27')](handleError(_0x3fe32c,null));};exports[_0x1180('0x72')]=function(_0x5e0946,_0x160e96,_0x58636e){if(_0x5e0946[_0x1180('0x56')]&&_0x5e0946['file'][_0x1180('0x57')]){_0x5e0946[_0x1180('0x54')][_0x1180('0x5c')]=_0x5e0946['file']['filename'];}return db[_0x1180('0x38')]['find']({'where':{'id':_0x5e0946[_0x1180('0x50')]['id']}})['then'](handleEntityNotFound(_0x160e96,null))[_0x1180('0x1e')](saveUpdates(_0x5e0946['body'],null))['then'](respondWithResult(_0x160e96,null))['catch'](handleError(_0x160e96,null));};var utilLicense=require(_0x1180('0x1a'));exports['getPreferred']=function(_0x36715a,_0x41e522,_0x4c964e){var _0x33ab19=_0x1180('0x6b');var _0x292bc6={'custom':![]};return utilLicense[_0x1180('0x5b')]()[_0x1180('0x1e')](function(_0x314e4d){if(_0x314e4d){_0x292bc6=_0x314e4d;}return db[_0x1180('0x38')][_0x1180('0x53')]({'where':{'id':_0x36715a[_0x1180('0x50')]['id']},'attributes':[_0x1180('0x58'),_0x1180('0x5a'),'preferred',_0x1180('0x5d'),_0x1180('0x5e'),_0x1180('0x5f'),'defaultPreferred',_0x1180('0x6c')],'raw':!![]});})[_0x1180('0x1e')](handleEntityNotFound(_0x41e522,null))['then'](function(_0x5a7674){if(_0x5a7674){var _0x36877a=_0x5a7674[_0x1180('0x5c')]&&fs[_0x1180('0x61')](path[_0x1180('0x64')](config['root'],_0x33ab19,_['toLower'](_0x5a7674[_0x1180('0x5c')])))?path['join'](config[_0x1180('0x62')],_0x33ab19,_[_0x1180('0x63')](_0x5a7674[_0x1180('0x5c')])):path['join'](config[_0x1180('0x62')],_0x33ab19,_[_0x1180('0x63')](_0x1180('0x73')));var _0x5317c0=_0x1180('0x66')+_[_0x1180('0x67')](_0x1180('0x5c'));if(_0x5a7674[_0x5317c0]||!_0x292bc6[_0x1180('0x74')]||!_0x292bc6[_0x1180('0x5c')]){_0x36877a=path[_0x1180('0x64')](config[_0x1180('0x62')],_0x33ab19,_[_0x1180('0x63')]('default_preferred.png'));}if(!fs['existsSync'](_0x36877a)){throw new db[(_0x1180('0x68'))]['ValidationError'](_[_0x1180('0x67')](_0x1180('0x5c'))+_0x1180('0x69'));}return _0x41e522['download'](_0x36877a);}})['catch'](handleError(_0x41e522,null));};exports[_0x1180('0x75')]=function(_0x29e55f,_0x4ef66d,_0x4ccd66){if(_0x29e55f[_0x1180('0x56')]&&_0x29e55f[_0x1180('0x56')][_0x1180('0x57')]){_0x29e55f[_0x1180('0x54')]['favicon']=_0x29e55f['file'][_0x1180('0x57')];}return db['Setting'][_0x1180('0x53')]({'where':{'id':_0x29e55f['params']['id']}})[_0x1180('0x1e')](handleEntityNotFound(_0x4ef66d,null))['then'](saveUpdates(_0x29e55f['body'],null))[_0x1180('0x1e')](respondWithResult(_0x4ef66d,null))[_0x1180('0x27')](handleError(_0x4ef66d,null));};var utilLicense=require(_0x1180('0x1a'));exports[_0x1180('0x76')]=function(_0x220f6d,_0x46e9c8,_0x52eac5){var _0x5cd2aa=_0x1180('0x6b');var _0x5eb61f={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x3b17f1){if(_0x3b17f1){_0x5eb61f=_0x3b17f1;}return db[_0x1180('0x38')][_0x1180('0x53')]({'where':{'id':_0x220f6d['params']['id']},'attributes':['logo',_0x1180('0x5a'),_0x1180('0x5c'),_0x1180('0x5d'),_0x1180('0x5e'),_0x1180('0x5f'),_0x1180('0x60'),_0x1180('0x6c')],'raw':!![]});})[_0x1180('0x1e')](handleEntityNotFound(_0x46e9c8,null))[_0x1180('0x1e')](function(_0x25a326){if(_0x25a326){var _0x476395=_0x25a326[_0x1180('0x5d')]&&fs[_0x1180('0x61')](path['join'](config[_0x1180('0x62')],_0x5cd2aa,_[_0x1180('0x63')](_0x25a326[_0x1180('0x5d')])))?path[_0x1180('0x64')](config[_0x1180('0x62')],_0x5cd2aa,_[_0x1180('0x63')](_0x25a326[_0x1180('0x5d')])):path[_0x1180('0x64')](config[_0x1180('0x62')],_0x5cd2aa,_[_0x1180('0x63')](_0x1180('0x77')));var _0x33f903=_0x1180('0x66')+_['upperFirst'](_0x1180('0x5d'));if(_0x25a326[_0x33f903]||!_0x5eb61f[_0x1180('0x74')]){_0x476395=path[_0x1180('0x64')](config[_0x1180('0x62')],_0x5cd2aa,_[_0x1180('0x63')](_0x1180('0x77')));}if(!fs[_0x1180('0x61')](_0x476395)){throw new db[(_0x1180('0x68'))][(_0x1180('0x6e'))](_[_0x1180('0x67')](_0x1180('0x5d'))+_0x1180('0x69'));}return _0x46e9c8[_0x1180('0x6f')](_0x476395);}})['catch'](handleError(_0x46e9c8,null));};exports[_0x1180('0x78')]=function(_0x59c99f,_0x197812){var _0x4613c9={'offset':moment()['utcOffset']()};_0x4613c9[_0x1180('0x79')]=moment()[_0x1180('0x7a')](_0x4613c9[_0x1180('0x2e')])[_0x1180('0x7b')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x197812[_0x1180('0x29')](0xc8)[_0x1180('0x7c')](_0x4613c9);}; \ No newline at end of file +var _0x7a59=['getPreferred','defaultFavicon','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','request','then','info','Setting,\x20%s,\x20%s','debug','request\x20sent','code','error','message','result','catch','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','reject','save','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','includeAll','find','body','filename','file','addLogoLogin','loginLogo','../../config/license/util','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','logo','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','getLicense','defaultPreferred','default_loginLogo.svg','download','gdpr','securePassword','addPreferred'];(function(_0xc08399,_0x5cab43){var _0x5777a9=function(_0x182aec){while(--_0x182aec){_0xc08399['push'](_0xc08399['shift']());}};_0x5777a9(++_0x5cab43);}(_0x7a59,0x16e));var _0x97a5=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x7a59[_0x25d386];return _0x857f4a;};'use strict';var emlformat=require(_0x97a5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x97a5('0x1'));var rp=require(_0x97a5('0x2'));var moment=require(_0x97a5('0x3'));var BPromise=require(_0x97a5('0x4'));var Mustache=require(_0x97a5('0x5'));var util=require('util');var path=require(_0x97a5('0x6'));var sox=require(_0x97a5('0x7'));var csv=require(_0x97a5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97a5('0x9'));var _=require(_0x97a5('0xa'));var squel=require(_0x97a5('0xb'));var crypto=require(_0x97a5('0xc'));var jsforce=require(_0x97a5('0xd'));var deskjs=require(_0x97a5('0xe'));var toCsv=require(_0x97a5('0x8'));var querystring=require('querystring');var Papa=require(_0x97a5('0xf'));var Redis=require(_0x97a5('0x10'));var authService=require(_0x97a5('0x11'));var qs=require(_0x97a5('0x12'));var as=require(_0x97a5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x97a5('0x14'));var utils=require(_0x97a5('0x15'));var config=require(_0x97a5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x97a5('0x17'))['db'];var jayson=require(_0x97a5('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3876fc,_0x9051d0,_0x50d291,_0x595437){return new BPromise(function(_0x51d5e2,_0x5a4471){var _0x36dd1f=_0x595437||client;return _0x36dd1f[_0x97a5('0x19')](_0x3876fc,_0x50d291)[_0x97a5('0x1a')](function(_0x4d8ba7){logger[_0x97a5('0x1b')](_0x97a5('0x1c'),_0x9051d0,'request\x20sent');logger[_0x97a5('0x1d')]('Setting,\x20%s,\x20%s,\x20%s',_0x9051d0,_0x97a5('0x1e'),JSON['stringify'](_0x4d8ba7));if(_0x4d8ba7['error']){if(_0x4d8ba7['error'][_0x97a5('0x1f')]===0x1f4){logger['error'](_0x97a5('0x1c'),_0x9051d0,_0x4d8ba7[_0x97a5('0x20')][_0x97a5('0x21')]);return _0x5a4471(_0x4d8ba7[_0x97a5('0x20')]['message']);}logger['error'](_0x97a5('0x1c'),_0x9051d0,_0x4d8ba7[_0x97a5('0x20')]['message']);return _0x51d5e2(_0x4d8ba7['error'][_0x97a5('0x21')]);}else{logger[_0x97a5('0x1b')](_0x97a5('0x1c'),_0x9051d0,'request\x20sent');_0x51d5e2(_0x4d8ba7[_0x97a5('0x22')][_0x97a5('0x21')]);}})[_0x97a5('0x23')](function(_0x5a6253){logger[_0x97a5('0x20')](_0x97a5('0x1c'),_0x9051d0,_0x5a6253);_0x5a4471(_0x5a6253);});});}function respondWithStatusCode(_0x4e2074,_0x5e731e){_0x5e731e=_0x5e731e||0xcc;return function(_0x469592){if(_0x469592){return _0x4e2074[_0x97a5('0x24')](_0x5e731e);}return _0x4e2074[_0x97a5('0x25')](_0x5e731e)[_0x97a5('0x26')]();};}function respondWithResult(_0x5239f2,_0x302d78){_0x302d78=_0x302d78||0xc8;return function(_0xf7ad1e){if(_0xf7ad1e){return _0x5239f2[_0x97a5('0x25')](_0x302d78)['json'](_0xf7ad1e);}};}function respondWithFilteredResult(_0x2038dd,_0x46ee45){return function(_0x2ca97c){if(_0x2ca97c){var _0x14fe08=typeof _0x46ee45[_0x97a5('0x27')]===_0x97a5('0x28')&&typeof _0x46ee45['limit']===_0x97a5('0x28');var _0x3eff21=_0x2ca97c['count'];var _0x274ccb=_0x14fe08?0x0:_0x46ee45[_0x97a5('0x27')];var _0x48f1c1=_0x14fe08?_0x2ca97c[_0x97a5('0x29')]:_0x46ee45[_0x97a5('0x27')]+_0x46ee45['limit'];var _0x2546ee;if(_0x48f1c1>=_0x3eff21){_0x48f1c1=_0x3eff21;_0x2546ee=0xc8;}else{_0x2546ee=0xce;}_0x2038dd['status'](_0x2546ee);return _0x2038dd[_0x97a5('0x2a')](_0x97a5('0x2b'),_0x274ccb+'-'+_0x48f1c1+'/'+_0x3eff21)[_0x97a5('0x2c')](_0x2ca97c);}return null;};}function patchUpdates(_0x1188d4){return function(_0x4845ed){try{jsonpatch['apply'](_0x4845ed,_0x1188d4,!![]);}catch(_0x2cb4e0){return BPromise[_0x97a5('0x2d')](_0x2cb4e0);}return _0x4845ed[_0x97a5('0x2e')]();};}function saveUpdates(_0x57c7d7,_0x3e2a58){return function(_0x1da16b){if(_0x1da16b){return _0x1da16b['update'](_0x57c7d7)[_0x97a5('0x1a')](function(_0x4234b1){return _0x4234b1;});}return null;};}function removeEntity(_0x59d8dd,_0x4817b0){return function(_0x96de29){if(_0x96de29){return _0x96de29[_0x97a5('0x2f')]()['then'](function(){_0x59d8dd[_0x97a5('0x25')](0xcc)[_0x97a5('0x26')]();});}};}function handleEntityNotFound(_0x347ad5,_0xcc9d91){return function(_0x4cf1ff){if(!_0x4cf1ff){_0x347ad5[_0x97a5('0x24')](0x194);}return _0x4cf1ff;};}function handleError(_0x442bbd,_0x499e7b){_0x499e7b=_0x499e7b||0x1f4;return function(_0xde33a6){logger[_0x97a5('0x20')](_0xde33a6[_0x97a5('0x30')]);if(_0xde33a6[_0x97a5('0x31')]){delete _0xde33a6[_0x97a5('0x31')];}_0x442bbd[_0x97a5('0x25')](_0x499e7b)[_0x97a5('0x32')](_0xde33a6);};}exports[_0x97a5('0x33')]=function(_0x138372,_0x440261){var _0x1c007d={},_0x1d5c4a={},_0x470777={'count':0x0,'rows':[]};var _0x49b19a=_[_0x97a5('0x34')](db[_0x97a5('0x35')][_0x97a5('0x36')],function(_0x305d92){return{'name':_0x305d92[_0x97a5('0x37')],'type':_0x305d92['type']['key']};});_0x1d5c4a[_0x97a5('0x38')]=_[_0x97a5('0x34')](_0x49b19a,_0x97a5('0x31'));_0x1d5c4a[_0x97a5('0x39')]=_[_0x97a5('0x3a')](_0x138372[_0x97a5('0x39')]);_0x1d5c4a['filters']=_[_0x97a5('0x3b')](_0x1d5c4a['model'],_0x1d5c4a[_0x97a5('0x39')]);_0x1c007d[_0x97a5('0x3c')]=_[_0x97a5('0x3b')](_0x1d5c4a[_0x97a5('0x38')],qs[_0x97a5('0x3d')](_0x138372['query'][_0x97a5('0x3d')]));_0x1c007d[_0x97a5('0x3c')]=_0x1c007d[_0x97a5('0x3c')][_0x97a5('0x3e')]?_0x1c007d[_0x97a5('0x3c')]:_0x1d5c4a['model'];if(!_0x138372['query'][_0x97a5('0x3f')](_0x97a5('0x40'))){_0x1c007d[_0x97a5('0x41')]=qs[_0x97a5('0x41')](_0x138372['query'][_0x97a5('0x41')]);_0x1c007d['offset']=qs[_0x97a5('0x27')](_0x138372[_0x97a5('0x39')][_0x97a5('0x27')]);}_0x1c007d['order']=qs[_0x97a5('0x42')](_0x138372[_0x97a5('0x39')]['sort']);_0x1c007d[_0x97a5('0x43')]=qs[_0x97a5('0x44')](_[_0x97a5('0x45')](_0x138372[_0x97a5('0x39')],_0x1d5c4a[_0x97a5('0x44')]),_0x49b19a);if(_0x138372[_0x97a5('0x39')][_0x97a5('0x46')]){_0x1c007d[_0x97a5('0x43')]=_[_0x97a5('0x47')](_0x1c007d[_0x97a5('0x43')],{'$or':_[_0x97a5('0x34')](_0x49b19a,function(_0x3cd574){if(_0x3cd574['type']!==_0x97a5('0x48')){var _0x2888f7={};_0x2888f7[_0x3cd574[_0x97a5('0x31')]]={'$like':'%'+_0x138372['query'][_0x97a5('0x46')]+'%'};return _0x2888f7;}})});}_0x1c007d=_[_0x97a5('0x47')]({},_0x1c007d,_0x138372[_0x97a5('0x49')]);var _0x218f2b={'where':_0x1c007d[_0x97a5('0x43')]};return db['Setting'][_0x97a5('0x29')](_0x218f2b)[_0x97a5('0x1a')](function(_0x3245a4){_0x470777[_0x97a5('0x29')]=_0x3245a4;if(_0x138372[_0x97a5('0x39')]['includeAll']){_0x1c007d[_0x97a5('0x4a')]=[{'all':!![]}];}return db['Setting'][_0x97a5('0x4b')](_0x1c007d);})[_0x97a5('0x1a')](function(_0x330f6a){_0x470777['rows']=_0x330f6a;return _0x470777;})[_0x97a5('0x1a')](respondWithFilteredResult(_0x440261,_0x1c007d))[_0x97a5('0x23')](handleError(_0x440261,null));};exports[_0x97a5('0x4c')]=function(_0x423c98,_0x2647b9){var _0x42ced6={'raw':![],'where':{'id':_0x423c98[_0x97a5('0x4d')]['id']}},_0x49b215={};_0x49b215[_0x97a5('0x38')]=_[_0x97a5('0x3a')](db[_0x97a5('0x35')]['rawAttributes']);_0x49b215[_0x97a5('0x39')]=_[_0x97a5('0x3a')](_0x423c98['query']);_0x49b215[_0x97a5('0x44')]=_[_0x97a5('0x3b')](_0x49b215[_0x97a5('0x38')],_0x49b215['query']);_0x42ced6[_0x97a5('0x3c')]=_[_0x97a5('0x3b')](_0x49b215['model'],qs[_0x97a5('0x3d')](_0x423c98[_0x97a5('0x39')][_0x97a5('0x3d')]));_0x42ced6['attributes']=_0x42ced6[_0x97a5('0x3c')][_0x97a5('0x3e')]?_0x42ced6[_0x97a5('0x3c')]:_0x49b215['model'];if(_0x423c98['query'][_0x97a5('0x4e')]){_0x42ced6[_0x97a5('0x4a')]=[{'all':!![]}];}_0x42ced6=_[_0x97a5('0x47')]({},_0x42ced6,_0x423c98[_0x97a5('0x49')]);return db['Setting'][_0x97a5('0x4f')](_0x42ced6)[_0x97a5('0x1a')](handleEntityNotFound(_0x2647b9,null))[_0x97a5('0x1a')](respondWithResult(_0x2647b9,null))['catch'](handleError(_0x2647b9,null));};exports['update']=function(_0x4deb41,_0xccd906){if(_0x4deb41[_0x97a5('0x50')]['id']){delete _0x4deb41[_0x97a5('0x50')]['id'];}return db['Setting'][_0x97a5('0x4f')]({'where':{'id':_0x4deb41[_0x97a5('0x4d')]['id']}})[_0x97a5('0x1a')](handleEntityNotFound(_0xccd906,null))[_0x97a5('0x1a')](saveUpdates(_0x4deb41[_0x97a5('0x50')],null))[_0x97a5('0x1a')](respondWithResult(_0xccd906,null))[_0x97a5('0x23')](handleError(_0xccd906,null));};exports['addLogo']=function(_0x514149,_0x4fcb2a,_0x13b86d){if(_0x514149['file']&&_0x514149['file'][_0x97a5('0x51')]){_0x514149[_0x97a5('0x50')]['logo']=_0x514149[_0x97a5('0x52')][_0x97a5('0x51')];}return db['Setting'][_0x97a5('0x4f')]({'where':{'id':_0x514149['params']['id']}})[_0x97a5('0x1a')](handleEntityNotFound(_0x4fcb2a,null))['then'](saveUpdates(_0x514149[_0x97a5('0x50')],null))['then'](respondWithResult(_0x4fcb2a,null))[_0x97a5('0x23')](handleError(_0x4fcb2a,null));};exports[_0x97a5('0x53')]=function(_0x4db956,_0x42cc2b,_0x58f013){if(_0x4db956[_0x97a5('0x52')]&&_0x4db956['file']['filename']){_0x4db956['body'][_0x97a5('0x54')]=_0x4db956[_0x97a5('0x52')][_0x97a5('0x51')];}return db[_0x97a5('0x35')][_0x97a5('0x4f')]({'where':{'id':_0x4db956[_0x97a5('0x4d')]['id']}})[_0x97a5('0x1a')](handleEntityNotFound(_0x42cc2b,null))[_0x97a5('0x1a')](saveUpdates(_0x4db956['body'],null))['then'](respondWithResult(_0x42cc2b,null))['catch'](handleError(_0x42cc2b,null));};var utilLicense=require(_0x97a5('0x55'));exports['getLogo']=function(_0x5ba758,_0x42d3b3,_0x162e10){var _0x5b3d6b=_0x97a5('0x56');var _0x14e950={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x189ce9){if(_0x189ce9){_0x14e950=_0x189ce9;}return db[_0x97a5('0x35')][_0x97a5('0x4f')]({'where':{'id':_0x5ba758[_0x97a5('0x4d')]['id']},'attributes':['logo',_0x97a5('0x54'),_0x97a5('0x57'),_0x97a5('0x58'),_0x97a5('0x59'),_0x97a5('0x5a'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x97a5('0x1a')](handleEntityNotFound(_0x42d3b3,null))[_0x97a5('0x1a')](function(_0x5b353b){if(_0x5b353b){var _0x2eb416=_0x5b353b[_0x97a5('0x5b')]&&fs[_0x97a5('0x5c')](path[_0x97a5('0x5d')](config['root'],_0x5b3d6b,_[_0x97a5('0x5e')](_0x5b353b['logo'])))?path['join'](config['root'],_0x5b3d6b,_['toLower'](_0x5b353b[_0x97a5('0x5b')])):path[_0x97a5('0x5d')](config[_0x97a5('0x5f')],_0x5b3d6b,_[_0x97a5('0x5e')](_0x97a5('0x60')));var _0x219694=_0x97a5('0x61')+_[_0x97a5('0x62')]('logo');if(_0x5b353b[_0x219694]||!_0x14e950[_0x97a5('0x63')]){_0x2eb416=path[_0x97a5('0x5d')](config['root'],_0x5b3d6b,_[_0x97a5('0x5e')](_0x97a5('0x60')));}if(!fs['existsSync'](_0x2eb416)){throw new db[(_0x97a5('0x64'))][(_0x97a5('0x65'))](_['upperFirst'](_0x97a5('0x5b'))+_0x97a5('0x66'));}return _0x42d3b3['download'](_0x2eb416);}})['catch'](handleError(_0x42d3b3,null));};var utilLicense=require(_0x97a5('0x55'));exports['getLogoLogin']=function(_0x3deee8,_0x58e9a5,_0xf184ff){var _0xc6477c=_0x97a5('0x56');var _0x294b62={'custom':![]};return utilLicense[_0x97a5('0x67')]()[_0x97a5('0x1a')](function(_0x4e9245){if(_0x4e9245){_0x294b62=_0x4e9245;}return db['Setting'][_0x97a5('0x4f')]({'where':{'id':_0x3deee8[_0x97a5('0x4d')]['id']},'attributes':[_0x97a5('0x5b'),_0x97a5('0x54'),_0x97a5('0x57'),'favicon','defaultLogo',_0x97a5('0x5a'),_0x97a5('0x68'),'defaultFavicon'],'raw':!![]});})[_0x97a5('0x1a')](handleEntityNotFound(_0x58e9a5,null))[_0x97a5('0x1a')](function(_0x4b651f){if(_0x4b651f){var _0x30ea29=_0x4b651f['loginLogo']&&fs[_0x97a5('0x5c')](path[_0x97a5('0x5d')](config[_0x97a5('0x5f')],_0xc6477c,_[_0x97a5('0x5e')](_0x4b651f[_0x97a5('0x54')])))?path['join'](config[_0x97a5('0x5f')],_0xc6477c,_['toLower'](_0x4b651f[_0x97a5('0x54')])):path['join'](config[_0x97a5('0x5f')],_0xc6477c,_[_0x97a5('0x5e')]('default_loginLogo.svg'));var _0x2b84fa=_0x97a5('0x61')+_[_0x97a5('0x62')]('loginLogo');if(_0x4b651f[_0x2b84fa]||!_0x294b62[_0x97a5('0x63')]){_0x30ea29=path[_0x97a5('0x5d')](config[_0x97a5('0x5f')],_0xc6477c,_[_0x97a5('0x5e')](_0x97a5('0x69')));}if(!fs[_0x97a5('0x5c')](_0x30ea29)){throw new db[(_0x97a5('0x64'))][(_0x97a5('0x65'))](_[_0x97a5('0x62')](_0x97a5('0x54'))+_0x97a5('0x66'));}return _0x58e9a5[_0x97a5('0x6a')](_0x30ea29);}})['catch'](handleError(_0x58e9a5,null));};exports[_0x97a5('0x6b')]=function(_0x43f639,_0x2e2600){return db['Setting'][_0x97a5('0x4f')]({'where':{'id':_0x43f639['params']['id']},'attributes':[_0x97a5('0x6c')]})[_0x97a5('0x1a')](respondWithResult(_0x2e2600,null))[_0x97a5('0x23')](handleError(_0x2e2600,null));};exports[_0x97a5('0x6d')]=function(_0x46b9db,_0x5159cd,_0x16eb72){if(_0x46b9db[_0x97a5('0x52')]&&_0x46b9db[_0x97a5('0x52')][_0x97a5('0x51')]){_0x46b9db['body']['preferred']=_0x46b9db['file'][_0x97a5('0x51')];}return db[_0x97a5('0x35')][_0x97a5('0x4f')]({'where':{'id':_0x46b9db[_0x97a5('0x4d')]['id']}})[_0x97a5('0x1a')](handleEntityNotFound(_0x5159cd,null))[_0x97a5('0x1a')](saveUpdates(_0x46b9db[_0x97a5('0x50')],null))[_0x97a5('0x1a')](respondWithResult(_0x5159cd,null))[_0x97a5('0x23')](handleError(_0x5159cd,null));};var utilLicense=require(_0x97a5('0x55'));exports[_0x97a5('0x6e')]=function(_0x4c27f0,_0x38010e,_0x619c78){var _0x43c7f7=_0x97a5('0x56');var _0x5c7fb3={'custom':![]};return utilLicense[_0x97a5('0x67')]()[_0x97a5('0x1a')](function(_0x4a526d){if(_0x4a526d){_0x5c7fb3=_0x4a526d;}return db[_0x97a5('0x35')][_0x97a5('0x4f')]({'where':{'id':_0x4c27f0[_0x97a5('0x4d')]['id']},'attributes':[_0x97a5('0x5b'),_0x97a5('0x54'),_0x97a5('0x57'),_0x97a5('0x58'),'defaultLogo',_0x97a5('0x5a'),'defaultPreferred',_0x97a5('0x6f')],'raw':!![]});})['then'](handleEntityNotFound(_0x38010e,null))[_0x97a5('0x1a')](function(_0xe46572){if(_0xe46572){var _0x3b084b=_0xe46572[_0x97a5('0x57')]&&fs[_0x97a5('0x5c')](path[_0x97a5('0x5d')](config['root'],_0x43c7f7,_['toLower'](_0xe46572[_0x97a5('0x57')])))?path['join'](config['root'],_0x43c7f7,_[_0x97a5('0x5e')](_0xe46572[_0x97a5('0x57')])):path[_0x97a5('0x5d')](config[_0x97a5('0x5f')],_0x43c7f7,_[_0x97a5('0x5e')](_0x97a5('0x70')));var _0x5ea1be=_0x97a5('0x61')+_[_0x97a5('0x62')]('preferred');if(_0xe46572[_0x5ea1be]||!_0x5c7fb3[_0x97a5('0x63')]||!_0x5c7fb3[_0x97a5('0x57')]){_0x3b084b=path['join'](config[_0x97a5('0x5f')],_0x43c7f7,_['toLower'](_0x97a5('0x70')));}if(!fs[_0x97a5('0x5c')](_0x3b084b)){throw new db[(_0x97a5('0x64'))][(_0x97a5('0x65'))](_[_0x97a5('0x62')]('preferred')+_0x97a5('0x66'));}return _0x38010e['download'](_0x3b084b);}})[_0x97a5('0x23')](handleError(_0x38010e,null));};exports[_0x97a5('0x71')]=function(_0x4422b4,_0x54ffe3,_0x432e40){if(_0x4422b4['file']&&_0x4422b4[_0x97a5('0x52')][_0x97a5('0x51')]){_0x4422b4['body'][_0x97a5('0x58')]=_0x4422b4[_0x97a5('0x52')][_0x97a5('0x51')];}return db['Setting'][_0x97a5('0x4f')]({'where':{'id':_0x4422b4[_0x97a5('0x4d')]['id']}})[_0x97a5('0x1a')](handleEntityNotFound(_0x54ffe3,null))['then'](saveUpdates(_0x4422b4['body'],null))[_0x97a5('0x1a')](respondWithResult(_0x54ffe3,null))[_0x97a5('0x23')](handleError(_0x54ffe3,null));};var utilLicense=require(_0x97a5('0x55'));exports['getFavicon']=function(_0x4940ba,_0x3965f9,_0x462e20){var _0x5def02='server/files/images/logos';var _0x3ba37b={'custom':![]};return utilLicense[_0x97a5('0x67')]()[_0x97a5('0x1a')](function(_0x27b5c6){if(_0x27b5c6){_0x3ba37b=_0x27b5c6;}return db[_0x97a5('0x35')]['find']({'where':{'id':_0x4940ba[_0x97a5('0x4d')]['id']},'attributes':['logo',_0x97a5('0x54'),'preferred','favicon',_0x97a5('0x59'),_0x97a5('0x5a'),_0x97a5('0x68'),_0x97a5('0x6f')],'raw':!![]});})[_0x97a5('0x1a')](handleEntityNotFound(_0x3965f9,null))[_0x97a5('0x1a')](function(_0x2ccd45){if(_0x2ccd45){var _0x32dc24=_0x2ccd45[_0x97a5('0x58')]&&fs[_0x97a5('0x5c')](path[_0x97a5('0x5d')](config[_0x97a5('0x5f')],_0x5def02,_[_0x97a5('0x5e')](_0x2ccd45[_0x97a5('0x58')])))?path[_0x97a5('0x5d')](config[_0x97a5('0x5f')],_0x5def02,_[_0x97a5('0x5e')](_0x2ccd45[_0x97a5('0x58')])):path[_0x97a5('0x5d')](config[_0x97a5('0x5f')],_0x5def02,_[_0x97a5('0x5e')](_0x97a5('0x72')));var _0x2a4497=_0x97a5('0x61')+_[_0x97a5('0x62')](_0x97a5('0x58'));if(_0x2ccd45[_0x2a4497]||!_0x3ba37b[_0x97a5('0x63')]){_0x32dc24=path['join'](config[_0x97a5('0x5f')],_0x5def02,_[_0x97a5('0x5e')](_0x97a5('0x72')));}if(!fs[_0x97a5('0x5c')](_0x32dc24)){throw new db[(_0x97a5('0x64'))][(_0x97a5('0x65'))](_[_0x97a5('0x62')](_0x97a5('0x58'))+_0x97a5('0x66'));}return _0x3965f9[_0x97a5('0x6a')](_0x32dc24);}})[_0x97a5('0x23')](handleError(_0x3965f9,null));};exports[_0x97a5('0x73')]=function(_0x460087,_0x4ee787){var _0x371c2f={'offset':moment()[_0x97a5('0x74')]()};_0x371c2f[_0x97a5('0x75')]=moment()['utcOffset'](_0x371c2f['offset'])['format'](_0x97a5('0x76'));return _0x4ee787['status'](0xc8)[_0x97a5('0x32')](_0x371c2f);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 49c2b38..4d5f89a 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 _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0x7217,0x19e));var _0x7721=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7217[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x573328,_0x33025e){var _0x19ae25=function(_0x4e198b){while(--_0x4e198b){_0x573328['push'](_0x573328['shift']());}};_0x19ae25(++_0x33025e);}(_0xe14b,0x93));var _0xbe14=function(_0x34ee17,_0x4c93bd){_0x34ee17=_0x34ee17-0x0;var _0x3222f4=_0xe14b[_0x34ee17];return _0x3222f4;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 31fb684..a73dd3b 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 _0x082c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','Setting','find','options','raw','where','include','map','model','attributes','lodash','moment','bluebird','ioredis'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x082c,0x1b6));var _0xc082=function(_0x4097d0,_0x4228e9){_0x4097d0=_0x4097d0-0x0;var _0x178931=_0x082c[_0x4097d0];return _0x178931;};'use strict';var _=require(_0xc082('0x0'));var util=require('util');var moment=require(_0xc082('0x1'));var BPromise=require(_0xc082('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc082('0x3'));var db=require(_0xc082('0x4'))['db'];var utils=require(_0xc082('0x5'));var logger=require(_0xc082('0x6'))(_0xc082('0x7'));var config=require(_0xc082('0x8'));var jayson=require(_0xc082('0x9'));var client=jayson[_0xc082('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x780f9,_0x45d710,_0xe566c0){return new BPromise(function(_0x391154,_0xdf5775){return client[_0xc082('0xb')](_0x780f9,_0xe566c0)[_0xc082('0xc')](function(_0x26da87){logger[_0xc082('0xd')](_0xc082('0xe'),_0x45d710,_0xc082('0xf'));logger[_0xc082('0x10')](_0xc082('0x11'),_0x45d710,_0xc082('0xf'),JSON[_0xc082('0x12')](_0x26da87));if(_0x26da87[_0xc082('0x13')]){if(_0x26da87[_0xc082('0x13')][_0xc082('0x14')]===0x1f4){logger[_0xc082('0x13')](_0xc082('0xe'),_0x45d710,_0x26da87[_0xc082('0x13')][_0xc082('0x15')]);return _0xdf5775(_0x26da87['error'][_0xc082('0x15')]);}logger[_0xc082('0x13')](_0xc082('0xe'),_0x45d710,_0x26da87[_0xc082('0x13')][_0xc082('0x15')]);return _0x391154(_0x26da87[_0xc082('0x13')][_0xc082('0x15')]);}else{logger[_0xc082('0xd')](_0xc082('0xe'),_0x45d710,_0xc082('0xf'));_0x391154(_0x26da87[_0xc082('0x16')][_0xc082('0x15')]);}})[_0xc082('0x17')](function(_0x619d84){logger['error'](_0xc082('0xe'),_0x45d710,_0x619d84);_0xdf5775(_0x619d84);});});}exports[_0xc082('0x18')]=function(_0x4965b5){var _0x37c088=this;return new Promise(function(_0x53d4fb,_0x5015df){return db[_0xc082('0x19')][_0xc082('0x1a')]({'raw':_0x4965b5[_0xc082('0x1b')]?_0x4965b5[_0xc082('0x1b')][_0xc082('0x1c')]===undefined?!![]:![]:!![],'where':_0x4965b5[_0xc082('0x1b')]?_0x4965b5[_0xc082('0x1b')][_0xc082('0x1d')]||null:null,'attributes':_0x4965b5['options']?_0x4965b5[_0xc082('0x1b')]['attributes']||null:null,'include':_0x4965b5['options']?_0x4965b5[_0xc082('0x1b')][_0xc082('0x1e')]?_[_0xc082('0x1f')](_0x4965b5[_0xc082('0x1b')]['include'],function(_0x1d0b52){return{'model':db[_0x1d0b52[_0xc082('0x20')]],'as':_0x1d0b52['as'],'attributes':_0x1d0b52['attributes'],'include':_0x1d0b52[_0xc082('0x1e')]?_[_0xc082('0x1f')](_0x1d0b52['include'],function(_0x4e0f53){return{'model':db[_0x4e0f53[_0xc082('0x20')]],'as':_0x4e0f53['as'],'attributes':_0x4e0f53[_0xc082('0x21')],'include':_0x4e0f53[_0xc082('0x1e')]?_[_0xc082('0x1f')](_0x4e0f53[_0xc082('0x1e')],function(_0x20d164){return{'model':db[_0x20d164['model']],'as':_0x20d164['as'],'attributes':_0x20d164[_0xc082('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x106472){logger[_0xc082('0xd')](_0xc082('0x18'),_0x4965b5);logger['debug'](_0xc082('0x18'),_0x4965b5,JSON[_0xc082('0x12')](_0x106472));_0x53d4fb(_0x106472);})[_0xc082('0x17')](function(_0xea56bf){logger[_0xc082('0x13')](_0xc082('0x18'),_0xea56bf[_0xc082('0x15')],_0x4965b5);_0x5015df(_0x37c088['error'](0x1f4,_0xea56bf['message']));});});}; \ No newline at end of file +var _0xafa4=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','error','code','Setting,\x20%s,\x20%s','message','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird'];(function(_0x5fbedf,_0xa200d8){var _0x40590e=function(_0xa79199){while(--_0xa79199){_0x5fbedf['push'](_0x5fbedf['shift']());}};_0x40590e(++_0xa200d8);}(_0xafa4,0x1ec));var _0x4afa=function(_0x452fde,_0x50be29){_0x452fde=_0x452fde-0x0;var _0x533b5e=_0xafa4[_0x452fde];return _0x533b5e;};'use strict';var _=require(_0x4afa('0x0'));var util=require(_0x4afa('0x1'));var moment=require(_0x4afa('0x2'));var BPromise=require(_0x4afa('0x3'));var rs=require(_0x4afa('0x4'));var fs=require('fs');var Redis=require(_0x4afa('0x5'));var db=require(_0x4afa('0x6'))['db'];var utils=require(_0x4afa('0x7'));var logger=require(_0x4afa('0x8'))(_0x4afa('0x9'));var config=require(_0x4afa('0xa'));var jayson=require(_0x4afa('0xb'));var client=jayson['client'][_0x4afa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x24923b,_0x2ffa55,_0x249080){return new BPromise(function(_0x2c4ecb,_0x579d7b){return client[_0x4afa('0xd')](_0x24923b,_0x249080)[_0x4afa('0xe')](function(_0x2640d9){logger[_0x4afa('0xf')]('Setting,\x20%s,\x20%s',_0x2ffa55,_0x4afa('0x10'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x2ffa55,_0x4afa('0x10'),JSON['stringify'](_0x2640d9));if(_0x2640d9[_0x4afa('0x11')]){if(_0x2640d9[_0x4afa('0x11')][_0x4afa('0x12')]===0x1f4){logger[_0x4afa('0x11')](_0x4afa('0x13'),_0x2ffa55,_0x2640d9[_0x4afa('0x11')][_0x4afa('0x14')]);return _0x579d7b(_0x2640d9[_0x4afa('0x11')][_0x4afa('0x14')]);}logger[_0x4afa('0x11')](_0x4afa('0x13'),_0x2ffa55,_0x2640d9['error'][_0x4afa('0x14')]);return _0x2c4ecb(_0x2640d9[_0x4afa('0x11')][_0x4afa('0x14')]);}else{logger[_0x4afa('0xf')](_0x4afa('0x13'),_0x2ffa55,'request\x20sent');_0x2c4ecb(_0x2640d9['result'][_0x4afa('0x14')]);}})['catch'](function(_0x35f5a7){logger['error'](_0x4afa('0x13'),_0x2ffa55,_0x35f5a7);_0x579d7b(_0x35f5a7);});});}exports[_0x4afa('0x15')]=function(_0xf9b50f){var _0x38bbcb=this;return new Promise(function(_0x159723,_0x4a8faf){return db[_0x4afa('0x16')][_0x4afa('0x17')]({'raw':_0xf9b50f[_0x4afa('0x18')]?_0xf9b50f['options'][_0x4afa('0x19')]===undefined?!![]:![]:!![],'where':_0xf9b50f[_0x4afa('0x18')]?_0xf9b50f[_0x4afa('0x18')][_0x4afa('0x1a')]||null:null,'attributes':_0xf9b50f[_0x4afa('0x18')]?_0xf9b50f['options'][_0x4afa('0x1b')]||null:null,'include':_0xf9b50f['options']?_0xf9b50f['options'][_0x4afa('0x1c')]?_[_0x4afa('0x1d')](_0xf9b50f[_0x4afa('0x18')][_0x4afa('0x1c')],function(_0x352bbb){return{'model':db[_0x352bbb[_0x4afa('0x1e')]],'as':_0x352bbb['as'],'attributes':_0x352bbb[_0x4afa('0x1b')],'include':_0x352bbb[_0x4afa('0x1c')]?_[_0x4afa('0x1d')](_0x352bbb[_0x4afa('0x1c')],function(_0x91cb5){return{'model':db[_0x91cb5['model']],'as':_0x91cb5['as'],'attributes':_0x91cb5[_0x4afa('0x1b')],'include':_0x91cb5['include']?_[_0x4afa('0x1d')](_0x91cb5[_0x4afa('0x1c')],function(_0x20c558){return{'model':db[_0x20c558[_0x4afa('0x1e')]],'as':_0x20c558['as'],'attributes':_0x20c558['attributes']};}):[]};}):[]};}):[]:[]})[_0x4afa('0xe')](function(_0x1be1ca){logger['info'](_0x4afa('0x15'),_0xf9b50f);logger['debug'](_0x4afa('0x15'),_0xf9b50f,JSON['stringify'](_0x1be1ca));_0x159723(_0x1be1ca);})['catch'](function(_0x1ef9a6){logger[_0x4afa('0x11')](_0x4afa('0x15'),_0x1ef9a6['message'],_0xf9b50f);_0x4a8faf(_0x38bbcb[_0x4afa('0x11')](0x1f4,_0x1ef9a6[_0x4afa('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 04462e6..351b74b 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x295765,_0x333c52){var _0x170548=function(_0x1875a2){while(--_0x1875a2){_0x295765['push'](_0x295765['shift']());}};_0x170548(++_0x333c52);}(_0x7a54,0x106));var _0x47a5=function(_0x4535f6,_0x5e1e70){_0x4535f6=_0x4535f6-0x0;var _0x37e4e7=_0x7a54[_0x4535f6];return _0x37e4e7;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x3cdf8f,_0x5adb9c){var _0x35344f=function(_0x3a112d){while(--_0x3a112d){_0x3cdf8f['push'](_0x3cdf8f['shift']());}};_0x35344f(++_0x5adb9c);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 0b05aa4..2f50989 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 _0x3bf1=['plivo','clickatell','bandwidth','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','name','generate','ENUM','twilio','connectel'];(function(_0x1b2a4c,_0x5e55be){var _0x395fb7=function(_0x25c0ca){while(--_0x25c0ca){_0x1b2a4c['push'](_0x1b2a4c['shift']());}};_0x395fb7(++_0x5e55be);}(_0x3bf1,0x98));var _0x13bf=function(_0x1c02b1,_0x1ed643){_0x1c02b1=_0x1c02b1-0x0;var _0x39d390=_0x3bf1[_0x1c02b1];return _0x39d390;};'use strict';var Sequelize=require(_0x13bf('0x0'));var rs=require('randomstring');module[_0x13bf('0x1')]={'name':{'type':Sequelize[_0x13bf('0x2')],'unique':_0x13bf('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x13bf('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x13bf('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x13bf('0x2')],'defaultValue':function(){return rs[_0x13bf('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x13bf('0x5')](_0x13bf('0x6'),'skebby',_0x13bf('0x7'),'clicksend',_0x13bf('0x8'),_0x13bf('0x9'),_0x13bf('0xa'),_0x13bf('0xb'),_0x13bf('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0x13bf('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x13bf('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x13bf('0x2')]},'accountId':{'type':Sequelize[_0x13bf('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x13bf('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x13bf('0x2')]},'notificationTemplate':{'type':Sequelize[_0x13bf('0xe')],'defaultValue':function(){return _0x13bf('0xf');}},'notificationSound':{'type':Sequelize[_0x13bf('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x13bf('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x13bf('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x13bf('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x13bf('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x13bf('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x13bf('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x13bf('0x10')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x13bf('0xd')],'defaultValue':![],'comment':_0x13bf('0x11'),'set':function(_0x8f4880){if(!_0x8f4880)this[_0x13bf('0x12')](_0x13bf('0x13'),null);this['setDataValue']('mandatoryDisposition',_0x8f4880);}}}; \ No newline at end of file +var _0x90b1=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','skebby','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT'];(function(_0xbaeb69,_0x608efe){var _0x2656c5=function(_0x8ee202){while(--_0x8ee202){_0xbaeb69['push'](_0xbaeb69['shift']());}};_0x2656c5(++_0x608efe);}(_0x90b1,0xa0));var _0x190b=function(_0x572156,_0xb11cdf){_0x572156=_0x572156-0x0;var _0x4c0640=_0x90b1[_0x572156];return _0x4c0640;};'use strict';var Sequelize=require(_0x190b('0x0'));var rs=require(_0x190b('0x1'));module[_0x190b('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x190b('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x190b('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x190b('0x3')],'defaultValue':function(){return rs[_0x190b('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x190b('0x5')]('twilio',_0x190b('0x6'),_0x190b('0x7'),_0x190b('0x8'),_0x190b('0x9'),_0x190b('0xa'),'bandwidth',_0x190b('0xb'),_0x190b('0xc'),_0x190b('0xd'))},'accountSid':{'type':Sequelize[_0x190b('0x3')]},'authId':{'type':Sequelize[_0x190b('0x3')]},'authToken':{'type':Sequelize[_0x190b('0x3')]},'smsMethod':{'type':Sequelize[_0x190b('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x190b('0x3')]},'apiKey':{'type':Sequelize[_0x190b('0x3')]},'applicationId':{'type':Sequelize[_0x190b('0x3')]},'accountId':{'type':Sequelize[_0x190b('0x3')]},'senderString':{'type':Sequelize[_0x190b('0x3')]},'deliveryReport':{'type':Sequelize[_0x190b('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x190b('0x3')]},'notificationTemplate':{'type':Sequelize[_0x190b('0xf')],'defaultValue':function(){return _0x190b('0x10');}},'notificationSound':{'type':Sequelize[_0x190b('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x190b('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x190b('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x190b('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x190b('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x190b('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x190b('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x190b('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x190b('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x190b('0x11')],'comment':_0x190b('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x21b49e){if(!_0x21b49e)this[_0x190b('0x13')](_0x190b('0x14'),null);this[_0x190b('0x13')](_0x190b('0x15'),_0x21b49e);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index be79fcd..fcf3f1e 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 _0xd683=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','length','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','ids','notify','SmsApplication','Applications','account','priority','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','Text','MessageUUID','infobip','results','segmentedMessage','clickatell','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','omit','contact','SmsInteraction','interaction','created','autoclose','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','applications','waitForTheAssignedAgent','queueId','unshift','queue','waitForTheAssignedQueue','Start','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','send','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','out','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','csc','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','get','SmsAccounts','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation'];(function(_0x410250,_0x50ffa8){var _0x1a40b6=function(_0x49008f){while(--_0x49008f){_0x410250['push'](_0x410250['shift']());}};_0x1a40b6(++_0x50ffa8);}(_0xd683,0x171));var _0x3d68=function(_0x11241e,_0x56f117){_0x11241e=_0x11241e-0x0;var _0x1dd23e=_0xd683[_0x11241e];return _0x1dd23e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3d68('0x0'));var zipdir=require(_0x3d68('0x1'));var jsonpatch=require(_0x3d68('0x2'));var rp=require('request-promise');var moment=require(_0x3d68('0x3'));var BPromise=require(_0x3d68('0x4'));var Mustache=require('mustache');var util=require(_0x3d68('0x5'));var path=require(_0x3d68('0x6'));var sox=require('sox');var csv=require(_0x3d68('0x7'));var ejs=require(_0x3d68('0x8'));var fs=require('fs');var fs_extra=require(_0x3d68('0x9'));var _=require(_0x3d68('0xa'));var squel=require(_0x3d68('0xb'));var crypto=require(_0x3d68('0xc'));var jsforce=require(_0x3d68('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3d68('0x7'));var querystring=require(_0x3d68('0xe'));var Papa=require(_0x3d68('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3d68('0x10'));var as=require(_0x3d68('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d68('0x12'))(_0x3d68('0x13'));var utils=require(_0x3d68('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3d68('0x15'));var db=require('../../mysqldb')['db'];config[_0x3d68('0x16')]=_[_0x3d68('0x17')](config[_0x3d68('0x16')],{'host':_0x3d68('0x18'),'port':0x18eb});var socket=require(_0x3d68('0x19'))(new Redis(config[_0x3d68('0x16')]));require(_0x3d68('0x1a'))[_0x3d68('0x1b')](socket);var jayson=require(_0x3d68('0x1c'));var client=jayson['client'][_0x3d68('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x409333,_0x394a45,_0x8b4925,_0x5c15f3){return new BPromise(function(_0x1c1871,_0x2be43a){var _0x197443=_0x5c15f3||client;return _0x197443[_0x3d68('0x1e')](_0x409333,_0x8b4925)['then'](function(_0x191db3){logger[_0x3d68('0x1f')](_0x3d68('0x20'),_0x394a45,_0x3d68('0x21'));logger[_0x3d68('0x22')](_0x3d68('0x23'),_0x394a45,_0x3d68('0x21'),JSON[_0x3d68('0x24')](_0x191db3));if(_0x191db3[_0x3d68('0x25')]){if(_0x191db3['error'][_0x3d68('0x26')]===0x1f4){logger[_0x3d68('0x25')](_0x3d68('0x20'),_0x394a45,_0x191db3['error']['message']);return _0x2be43a(_0x191db3[_0x3d68('0x25')][_0x3d68('0x27')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x394a45,_0x191db3[_0x3d68('0x25')][_0x3d68('0x27')]);return _0x1c1871(_0x191db3[_0x3d68('0x25')][_0x3d68('0x27')]);}else{logger[_0x3d68('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x394a45,'request\x20sent');_0x1c1871(_0x191db3['result'][_0x3d68('0x27')]);}})[_0x3d68('0x28')](function(_0x43e193){logger['error'](_0x3d68('0x20'),_0x394a45,_0x43e193);_0x2be43a(_0x43e193);});});}function respondWithStatusCode(_0xa0cf6e,_0x392508){_0x392508=_0x392508||0xcc;return function(_0x1b508d){if(_0x1b508d){return _0xa0cf6e[_0x3d68('0x29')](_0x392508);}return _0xa0cf6e[_0x3d68('0x2a')](_0x392508)[_0x3d68('0x2b')]();};}function respondWithResult(_0x45a50e,_0x3f4c26){_0x3f4c26=_0x3f4c26||0xc8;return function(_0x32cb39){if(_0x32cb39){return _0x45a50e[_0x3d68('0x2a')](_0x3f4c26)[_0x3d68('0x2c')](_0x32cb39);}};}function respondWithFilteredResult(_0x5f17dd,_0x5537b6){return function(_0xb88ea2){if(_0xb88ea2){var _0x2e2fe3=typeof _0x5537b6['offset']==='undefined'&&typeof _0x5537b6[_0x3d68('0x2d')]===_0x3d68('0x2e');var _0x5867a0=_0xb88ea2['count'];var _0xfaec7a=_0x2e2fe3?0x0:_0x5537b6[_0x3d68('0x2f')];var _0x18dfbb=_0x2e2fe3?_0xb88ea2[_0x3d68('0x30')]:_0x5537b6[_0x3d68('0x2f')]+_0x5537b6[_0x3d68('0x2d')];var _0x2a0d74;if(_0x18dfbb>=_0x5867a0){_0x18dfbb=_0x5867a0;_0x2a0d74=0xc8;}else{_0x2a0d74=0xce;}_0x5f17dd[_0x3d68('0x2a')](_0x2a0d74);return _0x5f17dd[_0x3d68('0x31')](_0x3d68('0x32'),_0xfaec7a+'-'+_0x18dfbb+'/'+_0x5867a0)[_0x3d68('0x2c')](_0xb88ea2);}return null;};}function patchUpdates(_0x27cd32){return function(_0x5d530c){try{jsonpatch[_0x3d68('0x33')](_0x5d530c,_0x27cd32,!![]);}catch(_0x3deb96){return BPromise[_0x3d68('0x34')](_0x3deb96);}return _0x5d530c[_0x3d68('0x35')]();};}function saveUpdates(_0x528527,_0x119d2e){return function(_0x3be37b){if(_0x3be37b){return _0x3be37b[_0x3d68('0x36')](_0x528527)['then'](function(_0x196c58){return _0x196c58;});}return null;};}function removeEntity(_0x547ff4,_0x39b2ec){return function(_0x3cf474){if(_0x3cf474){return _0x3cf474[_0x3d68('0x37')]()[_0x3d68('0x38')](function(){var _0x21535a=_0x3cf474[_0x3d68('0x39')]({'plain':!![]});var _0x3be7ed=_0x3d68('0x3a');return db[_0x3d68('0x3b')][_0x3d68('0x37')]({'where':{'type':_0x3be7ed,'resourceId':_0x21535a['id']}})[_0x3d68('0x38')](function(){return _0x3cf474;});})['then'](function(){_0x547ff4[_0x3d68('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c90cc,_0x367124){return function(_0x30c925){if(!_0x30c925){_0x4c90cc[_0x3d68('0x29')](0x194);}return _0x30c925;};}function handleError(_0x171326,_0x373169){_0x373169=_0x373169||0x1f4;return function(_0x36ef42){logger[_0x3d68('0x25')](_0x36ef42['stack']);if(_0x36ef42[_0x3d68('0x3c')]){delete _0x36ef42[_0x3d68('0x3c')];}_0x171326[_0x3d68('0x2a')](_0x373169)['send'](_0x36ef42);};}exports[_0x3d68('0x3d')]=function(_0x3a08f6,_0x242554){var _0x379b72={'include':[{'model':db[_0x3d68('0x3e')],'as':_0x3d68('0x3f')}]},_0x349936={},_0x1a7caf={'count':0x0,'rows':[]};var _0x421dd5=_[_0x3d68('0x40')](db[_0x3d68('0x41')][_0x3d68('0x42')],function(_0x562565){return{'name':_0x562565[_0x3d68('0x43')],'type':_0x562565[_0x3d68('0x44')][_0x3d68('0x45')]};});_0x349936[_0x3d68('0x46')]=_[_0x3d68('0x40')](_0x421dd5,'name');_0x349936[_0x3d68('0x47')]=_[_0x3d68('0x48')](_0x3a08f6['query']);_0x349936[_0x3d68('0x49')]=_[_0x3d68('0x4a')](_0x349936[_0x3d68('0x46')],_0x349936[_0x3d68('0x47')]);_0x379b72[_0x3d68('0x4b')]=_[_0x3d68('0x4a')](_0x349936['model'],qs['fields'](_0x3a08f6['query'][_0x3d68('0x4c')]));_0x379b72[_0x3d68('0x4b')]=_0x379b72[_0x3d68('0x4b')]['length']?_0x379b72[_0x3d68('0x4b')]:_0x349936[_0x3d68('0x46')];if(!_0x3a08f6[_0x3d68('0x47')][_0x3d68('0x4d')](_0x3d68('0x4e'))){_0x379b72['limit']=qs['limit'](_0x3a08f6[_0x3d68('0x47')]['limit']);_0x379b72['offset']=qs['offset'](_0x3a08f6[_0x3d68('0x47')]['offset']);}_0x379b72[_0x3d68('0x4f')]=qs[_0x3d68('0x50')](_0x3a08f6['query']['sort']);_0x379b72[_0x3d68('0x51')]=qs[_0x3d68('0x49')](_[_0x3d68('0x52')](_0x3a08f6['query'],_0x349936[_0x3d68('0x49')]),_0x421dd5);if(_0x3a08f6[_0x3d68('0x47')][_0x3d68('0x53')]){_0x379b72[_0x3d68('0x51')]=_[_0x3d68('0x54')](_0x379b72[_0x3d68('0x51')],{'$or':_[_0x3d68('0x40')](_0x421dd5,function(_0x373be6){if(_0x373be6['type']!==_0x3d68('0x55')){var _0x49c686={};_0x49c686[_0x373be6[_0x3d68('0x3c')]]={'$like':'%'+_0x3a08f6[_0x3d68('0x47')][_0x3d68('0x53')]+'%'};return _0x49c686;}})});}_0x379b72=_[_0x3d68('0x54')]({},_0x379b72,_0x3a08f6['options']);var _0x195fb2={'where':_0x379b72[_0x3d68('0x51')]};return db[_0x3d68('0x41')][_0x3d68('0x30')](_0x195fb2)[_0x3d68('0x38')](function(_0x272f00){_0x1a7caf[_0x3d68('0x30')]=_0x272f00;if(_0x3a08f6[_0x3d68('0x47')][_0x3d68('0x56')]){_0x379b72[_0x3d68('0x57')]=[{'all':!![]}];}return db[_0x3d68('0x41')][_0x3d68('0x58')](_0x379b72);})[_0x3d68('0x38')](function(_0x35011b){_0x1a7caf['rows']=_0x35011b;return _0x1a7caf;})[_0x3d68('0x38')](respondWithFilteredResult(_0x242554,_0x379b72))[_0x3d68('0x28')](handleError(_0x242554,null));};exports[_0x3d68('0x59')]=function(_0xaee103,_0x63a4ad){var _0x4c9aab={'raw':![],'where':{'id':_0xaee103[_0x3d68('0x5a')]['id']},'include':[{'model':db[_0x3d68('0x3e')],'as':_0x3d68('0x3f')}]},_0x5a9f56={};_0x5a9f56[_0x3d68('0x46')]=_[_0x3d68('0x48')](db['SmsAccount'][_0x3d68('0x42')]);_0x5a9f56['query']=_[_0x3d68('0x48')](_0xaee103[_0x3d68('0x47')]);_0x5a9f56[_0x3d68('0x49')]=_[_0x3d68('0x4a')](_0x5a9f56[_0x3d68('0x46')],_0x5a9f56[_0x3d68('0x47')]);_0x4c9aab['attributes']=_[_0x3d68('0x4a')](_0x5a9f56[_0x3d68('0x46')],qs[_0x3d68('0x4c')](_0xaee103['query']['fields']));_0x4c9aab[_0x3d68('0x4b')]=_0x4c9aab[_0x3d68('0x4b')]['length']?_0x4c9aab[_0x3d68('0x4b')]:_0x5a9f56[_0x3d68('0x46')];if(_0xaee103[_0x3d68('0x47')]['includeAll']){_0x4c9aab[_0x3d68('0x57')]=[{'all':!![]}];}_0x4c9aab=_[_0x3d68('0x54')]({},_0x4c9aab,_0xaee103[_0x3d68('0x5b')]);return db['SmsAccount'][_0x3d68('0x5c')](_0x4c9aab)[_0x3d68('0x38')](handleEntityNotFound(_0x63a4ad,null))[_0x3d68('0x38')](respondWithResult(_0x63a4ad,null))[_0x3d68('0x28')](handleError(_0x63a4ad,null));};exports[_0x3d68('0x5d')]=function(_0x21b80e,_0xbc9776){return db[_0x3d68('0x41')][_0x3d68('0x5d')](_0x21b80e[_0x3d68('0x5e')],{})[_0x3d68('0x38')](function(_0x5cc616){var _0x231a3e=_0x21b80e[_0x3d68('0x5f')][_0x3d68('0x39')]({'plain':!![]});if(!_0x231a3e)throw new Error(_0x3d68('0x60'));if(_0x231a3e['role']===_0x3d68('0x5f')){var _0x10a869=_0x5cc616[_0x3d68('0x39')]({'plain':!![]});var _0x10996b=_0x3d68('0x3a');return db['UserProfileSection']['find']({'where':{'name':_0x10996b,'userProfileId':_0x231a3e[_0x3d68('0x61')]},'raw':!![]})[_0x3d68('0x38')](function(_0x1f441e){if(_0x1f441e&&_0x1f441e[_0x3d68('0x62')]===0x0){return db[_0x3d68('0x3b')][_0x3d68('0x5d')]({'name':_0x10a869[_0x3d68('0x3c')],'resourceId':_0x10a869['id'],'type':_0x1f441e[_0x3d68('0x3c')],'sectionId':_0x1f441e['id']},{})[_0x3d68('0x38')](function(){return _0x5cc616;});}else{return _0x5cc616;}})['catch'](function(_0x24fcb4){logger[_0x3d68('0x25')](_0x3d68('0x63'),_0x24fcb4);throw _0x24fcb4;});}return _0x5cc616;})['then'](respondWithResult(_0xbc9776,0xc9))[_0x3d68('0x28')](handleError(_0xbc9776,null));};exports[_0x3d68('0x36')]=function(_0x53722d,_0x5e8ec1){if(_0x53722d[_0x3d68('0x5e')]['id']){delete _0x53722d[_0x3d68('0x5e')]['id'];}return db[_0x3d68('0x41')][_0x3d68('0x5c')]({'where':{'id':_0x53722d['params']['id']},'include':[{'model':db['Pause'],'as':_0x3d68('0x3f')}]})[_0x3d68('0x38')](handleEntityNotFound(_0x5e8ec1,null))['then'](saveUpdates(_0x53722d[_0x3d68('0x5e')],null))[_0x3d68('0x38')](respondWithResult(_0x5e8ec1,null))['catch'](handleError(_0x5e8ec1,null));};exports['destroy']=function(_0x2f42f7,_0x1ce0c6){return db[_0x3d68('0x41')]['find']({'where':{'id':_0x2f42f7[_0x3d68('0x5a')]['id']}})[_0x3d68('0x38')](handleEntityNotFound(_0x1ce0c6,null))[_0x3d68('0x38')](removeEntity(_0x1ce0c6,null))[_0x3d68('0x28')](handleError(_0x1ce0c6,null));};exports[_0x3d68('0x64')]=function(_0x3e7b3d,_0x1d981a){return db[_0x3d68('0x41')]['describe']()[_0x3d68('0x38')](respondWithResult(_0x1d981a,null))[_0x3d68('0x28')](handleError(_0x1d981a,null));};exports[_0x3d68('0x65')]=function(_0x193553,_0x454b7e,_0x18119b){if(_0x193553[_0x3d68('0x5e')]['id']){delete _0x193553[_0x3d68('0x5e')]['id'];}return db['SmsAccount'][_0x3d68('0x5c')]({'where':{'id':_0x193553[_0x3d68('0x5a')]['id']}})[_0x3d68('0x38')](handleEntityNotFound(_0x454b7e,null))[_0x3d68('0x38')](function(_0x6d349a){if(_0x6d349a){_0x193553[_0x3d68('0x5e')][_0x3d68('0x66')]=_0x6d349a['id'];return db[_0x3d68('0x67')][_0x3d68('0x5d')](_0x193553['body']);}})['then'](respondWithResult(_0x454b7e,null))['catch'](handleError(_0x454b7e,null));};exports[_0x3d68('0x68')]=function(_0x2e95e5,_0x33be4e,_0x4db844){var _0x35ac9d={'raw':![],'where':{}};var _0x237b9b={};var _0x5c5619={'count':0x0,'rows':[]};return db[_0x3d68('0x41')]['findOne']({'where':{'id':_0x2e95e5[_0x3d68('0x5a')]['id']}})[_0x3d68('0x38')](handleEntityNotFound(_0x33be4e,null))['then'](function(_0x502558){if(_0x502558){_0x237b9b['model']=_['keys'](db[_0x3d68('0x67')][_0x3d68('0x42')]);_0x237b9b[_0x3d68('0x47')]=_[_0x3d68('0x48')](_0x2e95e5[_0x3d68('0x47')]);_0x237b9b[_0x3d68('0x49')]=_[_0x3d68('0x4a')](_0x237b9b[_0x3d68('0x46')],_0x237b9b[_0x3d68('0x47')]);_0x35ac9d['attributes']=_[_0x3d68('0x4a')](_0x237b9b[_0x3d68('0x46')],qs[_0x3d68('0x4c')](_0x2e95e5['query'][_0x3d68('0x4c')]));_0x35ac9d[_0x3d68('0x4b')]=_0x35ac9d['attributes'][_0x3d68('0x69')]?_0x35ac9d[_0x3d68('0x4b')]:_0x237b9b[_0x3d68('0x46')];if(!_0x2e95e5[_0x3d68('0x47')]['hasOwnProperty']('nolimit')){_0x35ac9d[_0x3d68('0x2d')]=qs[_0x3d68('0x2d')](_0x2e95e5['query']['limit']);_0x35ac9d[_0x3d68('0x2f')]=qs[_0x3d68('0x2f')](_0x2e95e5[_0x3d68('0x47')][_0x3d68('0x2f')]);}_0x35ac9d['order']=qs['sort'](_0x2e95e5['query'][_0x3d68('0x50')]);_0x35ac9d[_0x3d68('0x51')]=qs[_0x3d68('0x49')](_['pick'](_0x2e95e5[_0x3d68('0x47')],_0x237b9b[_0x3d68('0x49')]));_0x35ac9d[_0x3d68('0x51')][_0x3d68('0x66')]=_0x502558['id'];if(_0x2e95e5[_0x3d68('0x47')]['filter']){_0x35ac9d[_0x3d68('0x51')]=_['merge'](_0x35ac9d['where'],{'$or':_[_0x3d68('0x40')](_0x35ac9d[_0x3d68('0x4b')],function(_0x29a59f){var _0x35afdb={};_0x35afdb[_0x29a59f]={'$like':'%'+_0x2e95e5[_0x3d68('0x47')][_0x3d68('0x53')]+'%'};return _0x35afdb;})});}_0x35ac9d=_[_0x3d68('0x54')]({},_0x35ac9d,_0x2e95e5[_0x3d68('0x5b')]);return db['Disposition'][_0x3d68('0x30')]({'where':_0x35ac9d[_0x3d68('0x51')]})['then'](function(_0x203bb9){_0x5c5619[_0x3d68('0x30')]=_0x203bb9;if(_0x2e95e5['query'][_0x3d68('0x56')]){_0x35ac9d['include']=[{'all':!![]}];}return db[_0x3d68('0x67')]['findAll'](_0x35ac9d);})['then'](function(_0x3347e5){_0x5c5619[_0x3d68('0x6a')]=_0x3347e5;return _0x5c5619;});}})[_0x3d68('0x38')](respondWithFilteredResult(_0x33be4e,_0x35ac9d))[_0x3d68('0x28')](handleError(_0x33be4e,null));};exports[_0x3d68('0x6b')]=function(_0x1b63c3,_0x1c3928,_0x23a3e2){return db[_0x3d68('0x41')][_0x3d68('0x5c')]({'where':{'id':_0x1b63c3[_0x3d68('0x5a')]['id']}})[_0x3d68('0x38')](handleEntityNotFound(_0x1c3928,null))[_0x3d68('0x38')](function(_0x6b4c06){if(_0x6b4c06){return _0x6b4c06[_0x3d68('0x6b')](_0x1b63c3[_0x3d68('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x1c3928,null))[_0x3d68('0x28')](handleError(_0x1c3928,null));};exports[_0x3d68('0x6c')]=function(_0x2815d2,_0x55bb86,_0x4f5d02){if(_0x2815d2[_0x3d68('0x5e')]['id']){delete _0x2815d2[_0x3d68('0x5e')]['id'];}return db[_0x3d68('0x41')][_0x3d68('0x5c')]({'where':{'id':_0x2815d2[_0x3d68('0x5a')]['id']}})['then'](handleEntityNotFound(_0x55bb86,null))[_0x3d68('0x38')](function(_0x35d90d){if(_0x35d90d){_0x2815d2['body']['SmsAccountId']=_0x35d90d['id'];return db[_0x3d68('0x6d')]['create'](_0x2815d2[_0x3d68('0x5e')]);}})[_0x3d68('0x38')](respondWithResult(_0x55bb86,null))[_0x3d68('0x28')](handleError(_0x55bb86,null));};exports[_0x3d68('0x6e')]=function(_0x3cb7b5,_0x3d22af,_0x314fcd){var _0x17641b={'raw':![],'where':{}};var _0x7bfd5e={};var _0x2dc169={'count':0x0,'rows':[]};return db[_0x3d68('0x41')][_0x3d68('0x6f')]({'where':{'id':_0x3cb7b5[_0x3d68('0x5a')]['id']}})[_0x3d68('0x38')](handleEntityNotFound(_0x3d22af,null))['then'](function(_0x5d66ae){if(_0x5d66ae){_0x7bfd5e['model']=_['keys'](db[_0x3d68('0x6d')][_0x3d68('0x42')]);_0x7bfd5e['query']=_[_0x3d68('0x48')](_0x3cb7b5[_0x3d68('0x47')]);_0x7bfd5e[_0x3d68('0x49')]=_[_0x3d68('0x4a')](_0x7bfd5e['model'],_0x7bfd5e['query']);_0x17641b[_0x3d68('0x4b')]=_[_0x3d68('0x4a')](_0x7bfd5e['model'],qs[_0x3d68('0x4c')](_0x3cb7b5[_0x3d68('0x47')]['fields']));_0x17641b['attributes']=_0x17641b['attributes']['length']?_0x17641b[_0x3d68('0x4b')]:_0x7bfd5e[_0x3d68('0x46')];if(!_0x3cb7b5[_0x3d68('0x47')]['hasOwnProperty'](_0x3d68('0x4e'))){_0x17641b[_0x3d68('0x2d')]=qs[_0x3d68('0x2d')](_0x3cb7b5[_0x3d68('0x47')][_0x3d68('0x2d')]);_0x17641b[_0x3d68('0x2f')]=qs[_0x3d68('0x2f')](_0x3cb7b5[_0x3d68('0x47')][_0x3d68('0x2f')]);}_0x17641b[_0x3d68('0x4f')]=qs[_0x3d68('0x50')](_0x3cb7b5[_0x3d68('0x47')][_0x3d68('0x50')]);_0x17641b[_0x3d68('0x51')]=qs[_0x3d68('0x49')](_['pick'](_0x3cb7b5['query'],_0x7bfd5e[_0x3d68('0x49')]));_0x17641b['where'][_0x3d68('0x66')]=_0x5d66ae['id'];if(_0x3cb7b5[_0x3d68('0x47')][_0x3d68('0x53')]){_0x17641b[_0x3d68('0x51')]=_[_0x3d68('0x54')](_0x17641b[_0x3d68('0x51')],{'$or':_[_0x3d68('0x40')](_0x17641b['attributes'],function(_0x4856eb){var _0x51a0e2={};_0x51a0e2[_0x4856eb]={'$like':'%'+_0x3cb7b5['query']['filter']+'%'};return _0x51a0e2;})});}_0x17641b=_['merge']({},_0x17641b,_0x3cb7b5[_0x3d68('0x5b')]);return db[_0x3d68('0x6d')][_0x3d68('0x30')]({'where':_0x17641b[_0x3d68('0x51')]})[_0x3d68('0x38')](function(_0x5b74c6){_0x2dc169[_0x3d68('0x30')]=_0x5b74c6;if(_0x3cb7b5[_0x3d68('0x47')][_0x3d68('0x56')]){_0x17641b[_0x3d68('0x57')]=[{'all':!![]}];}return db[_0x3d68('0x6d')][_0x3d68('0x58')](_0x17641b);})[_0x3d68('0x38')](function(_0x4f8a9b){_0x2dc169[_0x3d68('0x6a')]=_0x4f8a9b;return _0x2dc169;});}})[_0x3d68('0x38')](respondWithFilteredResult(_0x3d22af,_0x17641b))[_0x3d68('0x28')](handleError(_0x3d22af,null));};exports['removeAnswers']=function(_0xd7b71c,_0x91b4e0,_0xa84f76){return db['SmsAccount'][_0x3d68('0x5c')]({'where':{'id':_0xd7b71c[_0x3d68('0x5a')]['id']}})['then'](handleEntityNotFound(_0x91b4e0,null))[_0x3d68('0x38')](function(_0x36f445){if(_0x36f445){return _0x36f445['removeAnswers'](_0xd7b71c[_0x3d68('0x47')][_0x3d68('0x70')]);}})[_0x3d68('0x38')](respondWithStatusCode(_0x91b4e0,null))[_0x3d68('0x28')](handleError(_0x91b4e0,null));};exports[_0x3d68('0x71')]=function(_0xbf5dab,_0x489415,_0x34bd23){var _0x58342f={'channel':'sms'};var _0x4cba85=[];var _0x30297f=[];var _0x50e166={};return db[_0x3d68('0x41')][_0x3d68('0x5c')]({'where':{'id':_0xbf5dab['params']['id']},'include':[{'model':db[_0x3d68('0x72')],'as':_0x3d68('0x73')}]})[_0x3d68('0x38')](handleEntityNotFound(_0x489415,null))[_0x3d68('0x38')](function(_0x2247da){_0x58342f[_0x3d68('0x74')]=_0x2247da;_0x58342f['applications']=_['orderBy'](_0x2247da[_0x3d68('0x73')],[_0x3d68('0x75')],['asc']);if(_0x58342f[_0x3d68('0x74')][_0x3d68('0x73')]){delete _0x58342f[_0x3d68('0x74')][_0x3d68('0x73')];}return db[_0x3d68('0x76')][_0x3d68('0x64')]();})[_0x3d68('0x38')](function(_0x1ea1a5){if(!_0x1ea1a5){throw new db[(_0x3d68('0x77'))]['ValidationError'](_0x3d68('0x78'));}_0x4cba85=_[_0x3d68('0x79')](_['keys'](_0x1ea1a5),[_0x3d68('0x7a'),_0x3d68('0x7b')]);_0x30297f=_[_0x3d68('0x79')](_['keys'](_0x1ea1a5),['createdAt','updatedAt',_0x3d68('0x7c'),'ListId']);_0x58342f[_0x3d68('0x5e')]={'mapKey':_0x3d68('0x7d')};if(_0x58342f[_0x3d68('0x74')]['type']){switch(_0x58342f[_0x3d68('0x74')][_0x3d68('0x44')]){case'twilio':_0x58342f[_0x3d68('0x5e')][_0x3d68('0x7e')]=_0xbf5dab[_0x3d68('0x5e')][_0x3d68('0x7f')];_0x58342f[_0x3d68('0x5e')][_0x3d68('0x5e')]=_0xbf5dab[_0x3d68('0x5e')][_0x3d68('0x80')];_0x58342f[_0x3d68('0x5e')][_0x3d68('0x81')]=_0xbf5dab[_0x3d68('0x5e')][_0x3d68('0x82')];break;case _0x3d68('0x83'):_0x58342f[_0x3d68('0x5e')][_0x3d68('0x7e')]='+'+_0xbf5dab['body'][_0x3d68('0x84')];_0x58342f[_0x3d68('0x5e')][_0x3d68('0x5e')]=_0xbf5dab[_0x3d68('0x5e')][_0x3d68('0x85')];break;case _0x3d68('0x86'):_0x58342f[_0x3d68('0x5e')][_0x3d68('0x7e')]=_0xbf5dab['body'][_0x3d68('0x7e')];_0x58342f[_0x3d68('0x5e')]['body']=_0xbf5dab[_0x3d68('0x5e')][_0x3d68('0x27')];break;case _0x3d68('0x87'):_0x58342f[_0x3d68('0x5e')][_0x3d68('0x7e')]=_0xbf5dab['body'][_0x3d68('0x7e')];_0x58342f[_0x3d68('0x5e')]['body']=_0xbf5dab[_0x3d68('0x5e')][_0x3d68('0x5e')];_0x58342f[_0x3d68('0x5e')][_0x3d68('0x81')]=_0xbf5dab[_0x3d68('0x5e')][_0x3d68('0x88')];break;case'plivo':_0x58342f[_0x3d68('0x5e')][_0x3d68('0x7e')]=_0xbf5dab[_0x3d68('0x5e')][_0x3d68('0x7f')];_0x58342f[_0x3d68('0x5e')][_0x3d68('0x5e')]=_0xbf5dab[_0x3d68('0x5e')][_0x3d68('0x89')];_0x58342f['body'][_0x3d68('0x81')]=_0xbf5dab[_0x3d68('0x5e')][_0x3d68('0x8a')];break;case _0x3d68('0x8b'):_0x58342f[_0x3d68('0x5e')][_0x3d68('0x7e')]='+'+_0xbf5dab[_0x3d68('0x5e')][_0x3d68('0x8c')][0x0][_0x3d68('0x7e')];_0x58342f[_0x3d68('0x5e')][_0x3d68('0x5e')]=_0xbf5dab[_0x3d68('0x5e')][_0x3d68('0x8c')][0x0]['text'];_0x58342f['body']['messageId']=_0xbf5dab[_0x3d68('0x5e')][_0x3d68('0x8c')][0x0][_0x3d68('0x81')];break;case'csc':_0x58342f[_0x3d68('0x5e')]['from']=_0xbf5dab['body']['originatingAddress'];_0x58342f[_0x3d68('0x5e')][_0x3d68('0x5e')]=_0xbf5dab[_0x3d68('0x5e')][_0x3d68('0x8d')]['message'];break;case _0x3d68('0x8e'):_0x58342f[_0x3d68('0x5e')][_0x3d68('0x7e')]=_0xbf5dab[_0x3d68('0x5e')]['fromNumber'];_0x58342f[_0x3d68('0x5e')][_0x3d68('0x5e')]=_0xbf5dab[_0x3d68('0x5e')][_0x3d68('0x85')];_0x58342f[_0x3d68('0x5e')]['messageId']=_0xbf5dab['body'][_0x3d68('0x8f')];break;case _0x3d68('0x90'):_0x58342f[_0x3d68('0x5e')]['messageId']=_0xbf5dab['body'][0x0][_0x3d68('0x27')]['id'];_0x58342f[_0x3d68('0x5e')][_0x3d68('0x7e')]=_0xbf5dab['body'][0x0][_0x3d68('0x27')][_0x3d68('0x7e')];_0x58342f[_0x3d68('0x5e')][_0x3d68('0x5e')]=_0xbf5dab[_0x3d68('0x5e')][0x0][_0x3d68('0x27')][_0x3d68('0x85')];break;case _0x3d68('0x91'):_0x58342f['body']['from']=_0xbf5dab[_0x3d68('0x5e')][_0x3d68('0x7e')];_0x58342f[_0x3d68('0x5e')][_0x3d68('0x5e')]=_0xbf5dab[_0x3d68('0x5e')][_0x3d68('0x27')];_0x58342f['body'][_0x3d68('0x81')]=_0xbf5dab['body'][_0x3d68('0x92')];break;}}if(_0x58342f[_0x3d68('0x5e')]['id']){delete _0x58342f[_0x3d68('0x5e')]['id'];}if(_[_0x3d68('0x93')](_0x58342f[_0x3d68('0x5e')][_0x3d68('0x7e')])){throw new db[(_0x3d68('0x77'))][(_0x3d68('0x94'))](_0x3d68('0x95'));}if(_[_0x3d68('0x93')](_0x58342f[_0x3d68('0x5e')]['body'])||_0x58342f[_0x3d68('0x5e')][_0x3d68('0x5e')]===''){throw new db[(_0x3d68('0x77'))][(_0x3d68('0x94'))](_0x3d68('0x96'));}if(_['isNil'](_0x58342f[_0x3d68('0x5e')][_0x3d68('0x97')])){throw new db[(_0x3d68('0x77'))][(_0x3d68('0x94'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x30297f);}if(!_[_0x3d68('0x98')](_0x30297f,_0x58342f[_0x3d68('0x5e')][_0x3d68('0x97')])){throw new db[(_0x3d68('0x77'))][(_0x3d68('0x94'))](_0x3d68('0x99')+_0x30297f);}_0x50e166[_0x58342f[_0x3d68('0x5e')][_0x3d68('0x97')]]=_0x58342f[_0x3d68('0x5e')][_0x3d68('0x7e')];return db[_0x3d68('0x9a')]['find']({'where':{'id':_0x58342f[_0x3d68('0x74')][_0x3d68('0x9b')]},'include':[{'model':db[_0x3d68('0x76')],'as':_0x3d68('0x9c'),'where':_0x50e166,'limit':0x1,'order':[[_0x3d68('0x7b'),_0x3d68('0x9d')]]}]});})['then'](handleEntityNotFound(_0x489415,null))[_0x3d68('0x38')](function(_0x4e927f){if(_0x4e927f){_0x58342f['list']=_[_0x3d68('0x9e')](_0x4e927f,[_0x3d68('0x9c')]);if(_0x4e927f['Contacts'][_0x3d68('0x69')]){return _0x4e927f[_0x3d68('0x9c')][0x0];}var _0x256170=_['defaults'](_0x58342f[_0x3d68('0x5e')],{'firstName':_0x58342f['body'][_0x3d68('0x7e')],'ListId':_0x4e927f['id']});_0x256170[_0x58342f[_0x3d68('0x5e')]['mapKey']]=_0x58342f[_0x3d68('0x5e')][_0x3d68('0x7e')];return db[_0x3d68('0x76')][_0x3d68('0x5d')](_0x256170,{'fields':_0x4cba85,'raw':!![]});}})[_0x3d68('0x38')](handleEntityNotFound(_0x489415,null))[_0x3d68('0x38')](function(_0x1c0cfe){if(_0x1c0cfe){_0x58342f[_0x3d68('0x9f')]=_0x1c0cfe;var _0x2bc199={'ContactId':_0x1c0cfe['id'],'phone':_0x58342f[_0x3d68('0x5e')]['from'],'SmsAccountId':_0xbf5dab[_0x3d68('0x5a')]['id']};var _0x3d9116={'ContactId':_0x1c0cfe['id'],'SmsAccountId':_0xbf5dab[_0x3d68('0x5a')]['id'],'closed':![]};return db[_0x3d68('0xa0')][_0x3d68('0x5c')]({'where':_0x3d9116})[_0x3d68('0x38')](function(_0x426012){if(_0x426012){return[_0x426012,![]];}return db[_0x3d68('0xa0')]['create'](_0x2bc199)[_0x3d68('0x38')](function(_0x595045){return[_0x595045,!![]];});});}})['spread'](function(_0x491ba9,_0x5476d1){_0x58342f[_0x3d68('0xa1')]=_0x491ba9[_0x3d68('0x39')]({'plain':!![]});_0x58342f[_0x3d68('0xa1')][_0x3d68('0xa2')]=![];if(_0x5476d1){if(_0x58342f[_0x3d68('0x74')][_0x3d68('0xa3')]){_0x58342f['applications']['push']({'id':0x0,'priority':_0x58342f['applications'][_0x3d68('0x69')]+0x1,'app':'close','appdata':_0x3d68('0xa4'),'interval':_0x3d68('0xa5')});}_0x58342f[_0x3d68('0xa1')][_0x3d68('0xa2')]=!![];}return db[_0x3d68('0xa6')][_0x3d68('0x5d')]({'phone':_0x58342f[_0x3d68('0x5e')][_0x3d68('0x7e')],'messageId':_0x58342f[_0x3d68('0x5e')][_0x3d68('0x81')],'body':_0x58342f[_0x3d68('0x5e')]['body'],'SmsAccountId':_0xbf5dab[_0x3d68('0x5a')]['id'],'SmsInteractionId':_0x491ba9['id'],'direction':'in','ContactId':_0x491ba9[_0x3d68('0xa7')],'AttachmentId':_0x58342f[_0x3d68('0x5e')][_0x3d68('0xa8')]});})[_0x3d68('0x38')](function(_0x1a43cd){_0x58342f['message']=_0x1a43cd;if(!_0x58342f[_0x3d68('0xa1')][_0x3d68('0xa9')])return;return db[_0x3d68('0xaa')][_0x3d68('0x5c')]({'attributes':['id',_0x3d68('0x3c')],'where':{'id':_0x58342f[_0x3d68('0xa1')][_0x3d68('0xa9')]}});})[_0x3d68('0x38')](function(_0x4a2c3a){if(_0x4a2c3a){_0x58342f[_0x3d68('0xab')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4a2c3a['name']+','+(_0x58342f[_0x3d68('0x74')][_0x3d68('0xac')]||0xa),'interval':_0x3d68('0xa5')});}if(!_0x58342f[_0x3d68('0xa1')]['queueId'])return;return db['SmsQueue'][_0x3d68('0x5c')]({'attributes':['id',_0x3d68('0x3c')],'where':{'id':_0x58342f[_0x3d68('0xa1')][_0x3d68('0xad')]}});})[_0x3d68('0x38')](function(_0x2d0d18){if(_0x2d0d18){_0x58342f[_0x3d68('0xab')][_0x3d68('0xae')]({'id':0x0,'priority':0x1,'app':_0x3d68('0xaf'),'appdata':_0x2d0d18['name']+','+(_0x58342f['account'][_0x3d68('0xb0')]||0x12c),'interval':_0x3d68('0xa5')});}return respondWithRpcPromise(_0x3d68('0xb1'),'startRouting',_0x58342f);})[_0x3d68('0x38')](function(_0x3d6ef8){if(_0x3d6ef8){var _0x40f75a=0xc8;var _0x48011f=_0x3d68('0xb2');logger[_0x3d68('0x1f')](_0x3d68('0x23'),_0x48011f,_0x40f75a,'entity\x20found');logger[_0x3d68('0x22')](_0x3d68('0xb3'),_0x48011f,_0x40f75a,_0x3d68('0xb4'),JSON[_0x3d68('0x24')](_0x3d6ef8));if(_0x58342f[_0x3d68('0x74')][_0x3d68('0x44')]==='twilio'){return _0x489415[_0x3d68('0x2a')](_0x40f75a)[_0x3d68('0x31')](_0x3d68('0xb5'),_0x3d68('0xb6'))[_0x3d68('0xb7')](_0x3d68('0xb8'));}else{return _0x489415['status'](_0x40f75a)[_0x3d68('0x2c')](_0x3d6ef8);}}})['catch'](handleError(_0x489415,null));};exports[_0x3d68('0xb9')]=function(_0x5bb537,_0x2e22f1){var _0x593176=_0x5bb537['params']['id'];var _0x756fff=_0x5bb537[_0x3d68('0x5e')];var _0x3a25d6=0xc8;var _0x4b99f6=null;return db[_0x3d68('0xba')][_0x3d68('0xbb')]({'isolationLevel':db[_0x3d68('0xba')]['Transaction'][_0x3d68('0xbc')][_0x3d68('0xbd')]},function(_0x244dc0){return db[_0x3d68('0x41')][_0x3d68('0x6f')]({'where':{'id':_0x593176},'transaction':_0x244dc0})[_0x3d68('0x38')](function(_0x29b7ef){if(_0x29b7ef){return db[_0x3d68('0x72')][_0x3d68('0x37')]({'where':{'SmsAccountId':_0x593176},'transaction':_0x244dc0})[_0x3d68('0x38')](function(){var _0x45050f=_[_0x3d68('0x40')](_0x756fff,function(_0x5631f8){_0x5631f8['SmsAccountId']=_0x593176;return _0x5631f8;});return db[_0x3d68('0x72')][_0x3d68('0xbe')](_0x45050f,{'transaction':_0x244dc0});});}else{_0x3a25d6=0x194;_0x4b99f6=[];}});})[_0x3d68('0x38')](function(){if(_0x3a25d6!==0x194){return db[_0x3d68('0x72')][_0x3d68('0xbf')]({'where':{'SmsAccountId':_0x593176},'order':_0x3d68('0x75')})[_0x3d68('0x38')](function(_0x23fad8){_0x4b99f6=_0x23fad8;});}})[_0x3d68('0x28')](function(_0x327cce){_0x3a25d6=0x1f4;logger[_0x3d68('0x25')](_0x327cce[_0x3d68('0xc0')]);if(_0x327cce['name']){delete _0x327cce[_0x3d68('0x3c')];}_0x4b99f6=_0x327cce;})[_0x3d68('0xc1')](function(){if(_0x4b99f6===null){_0x2e22f1['sendStatus'](_0x3a25d6);}else{if(_0x3a25d6===0x1f4){_0x2e22f1[_0x3d68('0x2a')](_0x3a25d6)[_0x3d68('0xb7')](_0x4b99f6);}else{_0x2e22f1[_0x3d68('0x2a')](_0x3a25d6)['json'](_0x4b99f6);}}});};exports[_0x3d68('0xc2')]=function(_0x416bf3,_0x4c21a8,_0x5be249){var _0x58e774={};var _0x3a8cf9={};var _0x390a67;var _0x4625c9;return db['SmsAccount'][_0x3d68('0x6f')]({'where':{'id':_0x416bf3[_0x3d68('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4c21a8,null))[_0x3d68('0x38')](function(_0x635f4c){if(_0x635f4c){_0x390a67=_0x635f4c;_0x3a8cf9[_0x3d68('0x46')]=_['keys'](db['SmsApplication'][_0x3d68('0x42')]);_0x3a8cf9[_0x3d68('0x47')]=_[_0x3d68('0x48')](_0x416bf3[_0x3d68('0x47')]);_0x3a8cf9[_0x3d68('0x49')]=_[_0x3d68('0x4a')](_0x3a8cf9[_0x3d68('0x46')],_0x3a8cf9['query']);_0x58e774['attributes']=_[_0x3d68('0x4a')](_0x3a8cf9['model'],qs[_0x3d68('0x4c')](_0x416bf3['query'][_0x3d68('0x4c')]));_0x58e774['attributes']=_0x58e774[_0x3d68('0x4b')]['length']?_0x58e774['attributes']:_0x3a8cf9[_0x3d68('0x46')];_0x58e774[_0x3d68('0x4f')]=qs[_0x3d68('0x50')](_0x416bf3['query'][_0x3d68('0x50')]);_0x58e774[_0x3d68('0x51')]=qs['filters'](_[_0x3d68('0x52')](_0x416bf3[_0x3d68('0x47')],_0x3a8cf9[_0x3d68('0x49')]));if(_0x416bf3['query'][_0x3d68('0x53')]){_0x58e774[_0x3d68('0x51')]=_[_0x3d68('0x54')](_0x58e774['where'],{'$or':_[_0x3d68('0x40')](_0x58e774[_0x3d68('0x4b')],function(_0x3b9c11){var _0x363557={};_0x363557[_0x3b9c11]={'$like':'%'+_0x416bf3[_0x3d68('0x47')]['filter']+'%'};return _0x363557;})});}_0x58e774=_[_0x3d68('0x54')]({},_0x58e774,_0x416bf3['options']);return _0x390a67[_0x3d68('0xc2')](_0x58e774);}})[_0x3d68('0x38')](function(_0x5b2189){if(_0x5b2189){_0x4625c9=_0x5b2189[_0x3d68('0x69')];if(!_0x416bf3['query'][_0x3d68('0x4d')](_0x3d68('0x4e'))){_0x58e774[_0x3d68('0x2d')]=qs[_0x3d68('0x2d')](_0x416bf3['query'][_0x3d68('0x2d')]);_0x58e774[_0x3d68('0x2f')]=qs[_0x3d68('0x2f')](_0x416bf3[_0x3d68('0x47')][_0x3d68('0x2f')]);}return _0x390a67[_0x3d68('0xc2')](_0x58e774);}})[_0x3d68('0x38')](function(_0x1863fb){if(_0x1863fb){return _0x1863fb?{'count':_0x4625c9,'rows':_0x1863fb}:null;}})['then'](respondWithResult(_0x4c21a8,null))[_0x3d68('0x28')](handleError(_0x4c21a8,null));};exports[_0x3d68('0xc3')]=function(_0x8be8b1,_0xe09cae,_0x38fd32){var _0x37a323={'raw':![],'where':{}};var _0xc3f871={};var _0x2832fe={'count':0x0,'rows':[]};return db['SmsAccount'][_0x3d68('0x6f')]({'where':{'id':_0x8be8b1[_0x3d68('0x5a')]['id']}})[_0x3d68('0x38')](handleEntityNotFound(_0xe09cae,null))[_0x3d68('0x38')](function(_0x179050){if(_0x179050){_0xc3f871[_0x3d68('0x46')]=_[_0x3d68('0x48')](db[_0x3d68('0xa0')][_0x3d68('0x42')]);_0xc3f871[_0x3d68('0x47')]=_[_0x3d68('0x48')](_0x8be8b1[_0x3d68('0x47')]);_0xc3f871['filters']=_[_0x3d68('0x4a')](_0xc3f871[_0x3d68('0x46')],_0xc3f871[_0x3d68('0x47')]);_0x37a323['attributes']=_[_0x3d68('0x4a')](_0xc3f871[_0x3d68('0x46')],qs[_0x3d68('0x4c')](_0x8be8b1[_0x3d68('0x47')]['fields']));_0x37a323[_0x3d68('0x4b')]=_0x37a323[_0x3d68('0x4b')]['length']?_0x37a323['attributes']:_0xc3f871[_0x3d68('0x46')];if(!_0x8be8b1[_0x3d68('0x47')][_0x3d68('0x4d')](_0x3d68('0x4e'))){_0x37a323['limit']=qs['limit'](_0x8be8b1[_0x3d68('0x47')][_0x3d68('0x2d')]);_0x37a323['offset']=qs[_0x3d68('0x2f')](_0x8be8b1[_0x3d68('0x47')][_0x3d68('0x2f')]);}_0x37a323[_0x3d68('0x4f')]=qs[_0x3d68('0x50')](_0x8be8b1[_0x3d68('0x47')]['sort']);_0x37a323[_0x3d68('0x51')]=qs['filters'](_[_0x3d68('0x52')](_0x8be8b1[_0x3d68('0x47')],_0xc3f871[_0x3d68('0x49')]));_0x37a323[_0x3d68('0x51')][_0x3d68('0x66')]=_0x179050['id'];if(_0x8be8b1[_0x3d68('0x47')][_0x3d68('0x53')]){_0x37a323[_0x3d68('0x51')]=_[_0x3d68('0x54')](_0x37a323[_0x3d68('0x51')],{'$or':_[_0x3d68('0x40')](_0x37a323[_0x3d68('0x4b')],function(_0x39be4f){var _0x2c701e={};_0x2c701e[_0x39be4f]={'$like':'%'+_0x8be8b1[_0x3d68('0x47')][_0x3d68('0x53')]+'%'};return _0x2c701e;})});}_0x37a323=_[_0x3d68('0x54')]({},_0x37a323,_0x8be8b1['options']);return db['SmsInteraction'][_0x3d68('0x30')]({'where':_0x37a323['where']})[_0x3d68('0x38')](function(_0x4bc1bd){_0x2832fe['count']=_0x4bc1bd;if(_0x8be8b1[_0x3d68('0x47')][_0x3d68('0x56')]){_0x37a323[_0x3d68('0x57')]=[{'model':db[_0x3d68('0x76')],'as':_0x3d68('0xc4'),'required':![]},{'model':db[_0x3d68('0xaa')],'as':_0x3d68('0xc5'),'attributes':[_0x3d68('0x3c'),'fullname',_0x3d68('0xc6')],'required':![]},{'model':db[_0x3d68('0xc7')],'as':_0x3d68('0xc8'),'attributes':['id',_0x3d68('0x3c'),'color'],'where':_0x8be8b1[_0x3d68('0x47')]['tag']?{'id':_0x8be8b1[_0x3d68('0x47')][_0x3d68('0xc9')]}:undefined,'required':_0x8be8b1[_0x3d68('0x47')][_0x3d68('0xc9')]?!![]:![]}];}return db[_0x3d68('0xa0')][_0x3d68('0x58')](_0x37a323);})[_0x3d68('0x38')](function(_0x2cc95c){_0x2832fe[_0x3d68('0x6a')]=_0x2cc95c;return _0x2832fe;});}})[_0x3d68('0x38')](respondWithFilteredResult(_0xe09cae,_0x37a323))['catch'](handleError(_0xe09cae,null));};exports['send']=function(_0x3f7cd4,_0x5dc90d,_0x5ad873){var _0x3ae33f,_0x131294,_0x3af244;if(_[_0x3d68('0x93')](_0x3f7cd4[_0x3d68('0x5e')][_0x3d68('0x5e')])||_0x3f7cd4[_0x3d68('0x5e')][_0x3d68('0x5e')]===''){throw new db[(_0x3d68('0x77'))][(_0x3d68('0x94'))](_0x3d68('0x96'));}if(_[_0x3d68('0x93')](_0x3f7cd4[_0x3d68('0x5e')]['to'])){throw new db[(_0x3d68('0x77'))][(_0x3d68('0x94'))](_0x3d68('0xca'));}_0x3ae33f=_0x3f7cd4[_0x3d68('0x5e')]['to'];return db[_0x3d68('0x41')][_0x3d68('0x5c')]({'where':{'id':_0x3f7cd4[_0x3d68('0x5a')]['id']},'include':[{'model':db[_0x3d68('0x9a')],'as':'List','include':[{'model':db[_0x3d68('0x76')],'as':_0x3d68('0x9c'),'where':{'mobile':_0x3ae33f},'limit':0x1,'order':[[_0x3d68('0x7b'),_0x3d68('0x9d')]]}]}]})['then'](handleEntityNotFound(_0x5dc90d,null))[_0x3d68('0x38')](function(_0xeed2f4){if(_0xeed2f4&&_0xeed2f4['List']){_0x131294=_0xeed2f4[_0x3d68('0x39')]({'plain':!![]});if(_0x131294[_0x3d68('0xcb')]&&_0x131294[_0x3d68('0xcb')][_0x3d68('0x9c')]['length']){return _0x131294[_0x3d68('0xcb')][_0x3d68('0x9c')][0x0];}return db[_0x3d68('0x76')][_0x3d68('0x5d')](_[_0x3d68('0x17')](_0x3f7cd4[_0x3d68('0x5e')],{'firstName':_0x3ae33f,'mobile':_0x3ae33f,'phone':_0x3ae33f,'ListId':_0x131294[_0x3d68('0x9b')]}));}})['then'](handleEntityNotFound(_0x5dc90d,null))[_0x3d68('0x38')](function(_0xee7579){if(_0xee7579){_0x3af244=_0xee7579;return db[_0x3d68('0xa0')][_0x3d68('0x5c')]({'where':{'ContactId':_0x3af244['id'],'closed':![],'SmsAccountId':_0x131294['id']}})['then'](function(_0x583c22){if(_0x583c22){return[_0x583c22,![]];}return db[_0x3d68('0xa0')][_0x3d68('0x5d')]({'UserId':_0x3f7cd4[_0x3d68('0x5f')]['id'],'ContactId':_0x3af244['id'],'SmsAccountId':_0x131294['id'],'phone':_0x3ae33f,'firstMsgDirection':_0x3d68('0xcc'),'Messages':[_['merge'](_0x3f7cd4['body'],{'read':![],'body':_0x3f7cd4[_0x3d68('0x5e')][_0x3d68('0x5e')],'phone':_0x3ae33f,'SmsAccountId':_0x131294['id'],'UserId':_0x3f7cd4[_0x3d68('0x5f')]['id'],'ContactId':_0x3af244['id']})]},{'include':[{'model':db[_0x3d68('0xa6')],'as':_0x3d68('0xcd')}]})[_0x3d68('0x38')](function(_0x42ca96){return[_0x42ca96,!![]];});});}})[_0x3d68('0xce')](function(_0x56656b,_0x1e288f){if(_0x1e288f){return _0x56656b;}return db[_0x3d68('0xa6')][_0x3d68('0x5d')](_[_0x3d68('0x54')](_0x3f7cd4[_0x3d68('0x5e')],{'read':![],'body':_0x3f7cd4['body'][_0x3d68('0x5e')],'phone':_0x3ae33f,'SmsAccountId':_0x131294['id'],'SmsInteractionId':_0x56656b['id'],'UserId':_0x3f7cd4[_0x3d68('0x5f')]['id'],'ContactId':_0x3af244['id']}))[_0x3d68('0x38')](function(_0x38d3e5){_0x56656b['dataValues'][_0x3d68('0xcd')]=[];_0x56656b[_0x3d68('0xcf')][_0x3d68('0xcd')]['push'](_0x38d3e5[_0x3d68('0xcf')]);return _0x56656b;});})[_0x3d68('0x38')](respondWithResult(_0x5dc90d,null))[_0x3d68('0x28')](handleError(_0x5dc90d,null));};exports[_0x3d68('0x2a')]=function(_0x81c227,_0x227fde,_0x2298e7){if(_0x81c227[_0x3d68('0x5e')]['id']){delete _0x81c227[_0x3d68('0x5e')]['id'];}var _0x37e947,_0x3ec879,_0x347788;return db[_0x3d68('0x41')][_0x3d68('0x5c')]({'where':{'id':_0x81c227[_0x3d68('0x5a')]['id']}})[_0x3d68('0x38')](handleEntityNotFound(_0x227fde,null))[_0x3d68('0x38')](function(_0x33810b){if(_0x33810b){_0x347788=_0x33810b;logger[_0x3d68('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3d68('0x2a'),_0x3d68('0xd0'),_0x33810b[_0x3d68('0x44')],util[_0x3d68('0xd1')](_0x81c227[_0x3d68('0x5e')],{'showHidden':![],'depth':null}));switch(_0x33810b['type']){case _0x3d68('0x83'):if(_0x81c227[_0x3d68('0x5e')][_0x3d68('0xd2')]&&_0x81c227['body'][_0x3d68('0x2a')]){_0x3ec879=_0x81c227[_0x3d68('0x5e')][_0x3d68('0x2a')];return db[_0x3d68('0xa6')][_0x3d68('0x5c')]({'where':{'messageId':_0x81c227[_0x3d68('0x5e')][_0x3d68('0xd2')]}});}break;case _0x3d68('0x86'):if(_0x81c227[_0x3d68('0x5e')][_0x3d68('0xd3')]&&_0x81c227[_0x3d68('0x5e')][_0x3d68('0xd4')]){_0x3ec879=_0x81c227[_0x3d68('0x5e')][_0x3d68('0xd4')];return db[_0x3d68('0xa6')][_0x3d68('0x5c')]({'where':{'messageId':_0x81c227[_0x3d68('0x5e')]['requestid']}});}break;case'clicksend':if(_0x81c227[_0x3d68('0x5e')][_0x3d68('0x88')]&&_0x81c227['body'][_0x3d68('0xd5')]){_0x3ec879=_0x81c227[_0x3d68('0x5e')]['status_code'];return db[_0x3d68('0xa6')]['find']({'where':{'messageId':_0x81c227[_0x3d68('0x5e')]['message_id']}});}break;case'infobip':var _0x436fd5=_0x81c227[_0x3d68('0x5e')][_0x3d68('0x8c')][0x0];if(_0x436fd5[_0x3d68('0x81')]&&_0x436fd5[_0x3d68('0x2a')][_0x3d68('0xd6')]==='DELIVERED'){_0x3ec879=_0x436fd5[_0x3d68('0x2a')][_0x3d68('0xd6')];return db[_0x3d68('0xa6')][_0x3d68('0x5c')]({'where':{'messageId':_0x436fd5['messageId']}});}break;case _0x3d68('0x8e'):if(_0x81c227[_0x3d68('0x5e')]['messageId']&&_0x81c227[_0x3d68('0x5e')][_0x3d68('0x2a')]){_0x3ec879=_0x81c227[_0x3d68('0x5e')]['status'];return db[_0x3d68('0xa6')][_0x3d68('0x5c')]({'where':{'messageId':_0x81c227[_0x3d68('0x5e')]['messageId']}});}break;case _0x3d68('0x90'):if(_0x81c227[_0x3d68('0x5e')][0x0][_0x3d68('0x27')]['id']){_0x3ec879=_0x81c227[_0x3d68('0x5e')][0x0]['type'];return db[_0x3d68('0xa6')][_0x3d68('0x5c')]({'where':{'messageId':_0x81c227[_0x3d68('0x5e')][0x0][_0x3d68('0x27')]['id']}});}break;case'intelepeer':if(_0x81c227['body']['redif']&&_0x81c227['body']['status']){_0x3ec879=_0x81c227[_0x3d68('0x5e')][_0x3d68('0x2a')];return db[_0x3d68('0xa6')][_0x3d68('0x5c')]({'where':{'messageId':_0x81c227[_0x3d68('0x5e')][_0x3d68('0xd7')]}});}break;}}})['then'](handleEntityNotFound(_0x227fde,null))[_0x3d68('0x38')](function(_0x5b1226){if(_0x5b1226){_0x37e947=_0x5b1226;switch(_0x347788[_0x3d68('0x44')]){case _0x3d68('0x83'):if(_0x3ec879===_0x3d68('0xd8')){return _0x37e947[_0x3d68('0x36')]({'read':!![]});}else{logger[_0x3d68('0x25')](_0x3d68('0x23'),_0x3d68('0x2a'),_0x3d68('0x83'),util[_0x3d68('0xd1')](_0x81c227[_0x3d68('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x3d68('0x86'):if(_0x3ec879==='1'){return _0x37e947['update']({'read':!![]});}else{logger[_0x3d68('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3d68('0x2a'),'skebby',util[_0x3d68('0xd1')](_0x81c227['body'],{'showHidden':![],'depth':null}));}break;case _0x3d68('0x87'):if(!_0x81c227[_0x3d68('0x5e')][_0x3d68('0xd9')]&&_0x3ec879>=0xc8&&_0x3ec879<=0xce){return _0x37e947[_0x3d68('0x36')]({'read':!![]});}else{logger[_0x3d68('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3d68('0x2a'),_0x3d68('0x87'),util[_0x3d68('0xd1')](_0x81c227[_0x3d68('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x3d68('0x8b'):var _0x41afe3=_0x81c227[_0x3d68('0x5e')]['results'][0x0];if(_0x41afe3['status']['groupName']==='DELIVERED'){return _0x37e947[_0x3d68('0x36')]({'read':!![]});}else{logger[_0x3d68('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3d68('0x2a'),'infobip',util[_0x3d68('0xd1')](_0x81c227[_0x3d68('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x3d68('0x8e'):if(_0x3ec879==_0x3d68('0xda')||_0x3ec879==_0x3d68('0xdb')){return _0x37e947[_0x3d68('0x36')]({'read':!![]});}else{logger[_0x3d68('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x3d68('0x8e'),util[_0x3d68('0xd1')](_0x81c227[_0x3d68('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x3d68('0x90'):if(_0x3ec879==_0x3d68('0xdc')){return _0x37e947['update']({'read':!![]});}else{logger[_0x3d68('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3d68('0x2a'),_0x3d68('0x90'),util[_0x3d68('0xd1')](_0x81c227[_0x3d68('0x5e')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x3ec879===_0x3d68('0xdd')||_0x3ec879===_0x3d68('0xde')){return _0x37e947['update']({'read':!![]});}else{logger[_0x3d68('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3d68('0x2a'),'intelepeer',util[_0x3d68('0xd1')](_0x81c227[_0x3d68('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x37e947;}})[_0x3d68('0x38')](respondWithResult(_0x227fde,null))['catch'](handleError(_0x227fde,null));};exports[_0x3d68('0xdf')]=function(_0x44ad5f,_0x1478d3,_0x3be293){var _0x5290e9,_0x30de6a,_0x368f2a;return db[_0x3d68('0x41')][_0x3d68('0x5c')]({'where':{'id':_0x44ad5f['params']['id']}})[_0x3d68('0x38')](handleEntityNotFound(_0x1478d3,null))['then'](function(_0x1971e2){if(_0x1971e2){_0x368f2a=_0x1971e2;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x3d68('0xd0'),_0x1971e2[_0x3d68('0x44')],util['inspect'](_0x44ad5f[_0x3d68('0x47')],{'showHidden':![],'depth':null}));switch(_0x1971e2[_0x3d68('0x44')]){case'csc':if(_0x44ad5f['query'][_0x3d68('0xe0')]&&_0x44ad5f[_0x3d68('0x47')][_0x3d68('0xe1')]){_0x30de6a=_0x44ad5f[_0x3d68('0x47')][_0x3d68('0xe1')];return db['SmsMessage'][_0x3d68('0x5c')]({'where':{'messageId':_0x44ad5f[_0x3d68('0x47')]['message-id']}});}break;}}})[_0x3d68('0x38')](handleEntityNotFound(_0x1478d3,null))[_0x3d68('0x38')](function(_0x210f4f){if(_0x210f4f){_0x5290e9=_0x210f4f;switch(_0x368f2a[_0x3d68('0x44')]){case _0x3d68('0xe2'):if(_0x30de6a==='2'||_0x30de6a==='6'){return _0x5290e9[_0x3d68('0x36')]({'read':!![]});}else{logger[_0x3d68('0x25')](_0x3d68('0x23'),_0x3d68('0x2a'),_0x3d68('0xe2'),util[_0x3d68('0xd1')](_0x44ad5f[_0x3d68('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x5290e9;}})['then'](respondWithResult(_0x1478d3,null))[_0x3d68('0x28')](handleError(_0x1478d3,null));};exports[_0x3d68('0xe3')]=function(_0x35ab63,_0x4723e3,_0x2497cc){return db['SmsAccount'][_0x3d68('0x5c')]({'where':{'id':_0x35ab63['params']['id']}})[_0x3d68('0x38')](handleEntityNotFound(_0x4723e3,null))[_0x3d68('0x38')](function(_0x250ff4){if(_0x250ff4){return _0x250ff4[_0x3d68('0xe3')](_0x35ab63[_0x3d68('0x5e')]['ids'],_[_0x3d68('0x9e')](_0x35ab63['body'],[_0x3d68('0x70'),'id'])||{})[_0x3d68('0xce')](function(_0x5057af){for(var _0x45a195=0x0;_0x45a195<_0x35ab63[_0x3d68('0x5e')][_0x3d68('0x70')][_0x3d68('0x69')];_0x45a195+=0x1){socket[_0x3d68('0xe4')](_0x3d68('0xe5'),{'UserId':Number(_0x35ab63[_0x3d68('0x5e')][_0x3d68('0x70')][_0x45a195]),'SmsAccountId':Number(_0x35ab63['params']['id'])});}return _0x5057af;});}})[_0x3d68('0x38')](respondWithResult(_0x4723e3,null))[_0x3d68('0x28')](handleError(_0x4723e3,null));};exports[_0x3d68('0xe6')]=function(_0x57bb7d,_0x4329ba,_0x1df72c){return db['SmsAccount'][_0x3d68('0x5c')]({'where':{'id':_0x57bb7d[_0x3d68('0x5a')]['id']}})[_0x3d68('0x38')](handleEntityNotFound(_0x4329ba,null))[_0x3d68('0x38')](function(_0x29cdc0){if(_0x29cdc0){return _0x29cdc0[_0x3d68('0xe6')](_0x57bb7d[_0x3d68('0x47')][_0x3d68('0x70')])[_0x3d68('0x38')](function(){if(_[_0x3d68('0xe7')](_0x57bb7d[_0x3d68('0x47')][_0x3d68('0x70')])){for(var _0x4fdc3d=0x0;_0x4fdc3d<_0x57bb7d[_0x3d68('0x47')][_0x3d68('0x70')][_0x3d68('0x69')];_0x4fdc3d+=0x1){socket[_0x3d68('0xe4')](_0x3d68('0xe8'),{'UserId':Number(_0x57bb7d[_0x3d68('0x47')][_0x3d68('0x70')][_0x4fdc3d]),'SmsAccountId':Number(_0x57bb7d['params']['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x57bb7d['query'][_0x3d68('0x70')]),'SmsAccountId':Number(_0x57bb7d[_0x3d68('0x5a')]['id'])});}});}})[_0x3d68('0x38')](respondWithStatusCode(_0x4329ba,null))[_0x3d68('0x28')](handleError(_0x4329ba,null));};exports['getAgents']=function(_0x15010c,_0x2b89e2,_0x429721){var _0x3d7694={};var _0x4a7f73={};var _0x1b41ce;var _0x3eeba3;return db[_0x3d68('0x41')]['findOne']({'where':{'id':_0x15010c[_0x3d68('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2b89e2,null))[_0x3d68('0x38')](function(_0x14a230){if(_0x14a230){_0x1b41ce=_0x14a230;_0x4a7f73[_0x3d68('0x46')]=_[_0x3d68('0x48')](db[_0x3d68('0xaa')][_0x3d68('0x42')]);_0x4a7f73[_0x3d68('0x47')]=_[_0x3d68('0x48')](_0x15010c[_0x3d68('0x47')]);_0x4a7f73[_0x3d68('0x49')]=_[_0x3d68('0x4a')](_0x4a7f73[_0x3d68('0x46')],_0x4a7f73[_0x3d68('0x47')]);_0x3d7694[_0x3d68('0x4b')]=_[_0x3d68('0x4a')](_0x4a7f73['model'],qs[_0x3d68('0x4c')](_0x15010c[_0x3d68('0x47')]['fields']));_0x3d7694['attributes']=_0x3d7694[_0x3d68('0x4b')][_0x3d68('0x69')]?_0x3d7694[_0x3d68('0x4b')]:_0x4a7f73['model'];_0x3d7694[_0x3d68('0x4f')]=qs['sort'](_0x15010c[_0x3d68('0x47')][_0x3d68('0x50')]);_0x3d7694[_0x3d68('0x51')]=qs[_0x3d68('0x49')](_['pick'](_0x15010c[_0x3d68('0x47')],_0x4a7f73['filters']));if(_0x15010c[_0x3d68('0x47')]['filter']){_0x3d7694['where']=_[_0x3d68('0x54')](_0x3d7694[_0x3d68('0x51')],{'$or':_[_0x3d68('0x40')](_0x3d7694['attributes'],function(_0x78c875){var _0x278248={};_0x278248[_0x78c875]={'$like':'%'+_0x15010c[_0x3d68('0x47')][_0x3d68('0x53')]+'%'};return _0x278248;})});}_0x3d7694=_[_0x3d68('0x54')]({},_0x3d7694,_0x15010c[_0x3d68('0x5b')]);return _0x1b41ce[_0x3d68('0xe9')](_0x3d7694);}})[_0x3d68('0x38')](function(_0x136ff5){if(_0x136ff5){_0x3eeba3=_0x136ff5[_0x3d68('0x69')];if(!_0x15010c['query'][_0x3d68('0x4d')]('nolimit')){_0x3d7694[_0x3d68('0x2d')]=qs[_0x3d68('0x2d')](_0x15010c[_0x3d68('0x47')][_0x3d68('0x2d')]);_0x3d7694['offset']=qs[_0x3d68('0x2f')](_0x15010c[_0x3d68('0x47')][_0x3d68('0x2f')]);}return _0x1b41ce[_0x3d68('0xe9')](_0x3d7694);}})[_0x3d68('0x38')](function(_0x5690a9){if(_0x5690a9){return _0x5690a9?{'count':_0x3eeba3,'rows':_0x5690a9}:null;}})['then'](respondWithResult(_0x2b89e2,null))['catch'](handleError(_0x2b89e2,null));}; \ No newline at end of file +var _0x9e04=['status','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getDispositions','pick','SmsAccountId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','notify','SmsApplication','Applications','account','applications','orderBy','asc','CmContact','Sequelize','difference','createdAt','updatedAt','ListId','mobile','twilio','From','Body','messageId','MessageSid','from','sender','text','clicksend','message_id','plivo','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','SmsQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','priority','json','getInteractions','Contact','User','Owner','fullname','internal','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','SmsMessage','dataValues','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','bandwidth','redif','infobip','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','received\x20delivery\x20report\x20from','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end'];(function(_0x55f266,_0x198546){var _0x1d5db5=function(_0x23ab23){while(--_0x23ab23){_0x55f266['push'](_0x55f266['shift']());}};_0x1d5db5(++_0x198546);}(_0x9e04,0x1a8));var _0x49e0=function(_0x212900,_0x5c007c){_0x212900=_0x212900-0x0;var _0xc9dbcb=_0x9e04[_0x212900];return _0xc9dbcb;};'use strict';var emlformat=require(_0x49e0('0x0'));var rimraf=require(_0x49e0('0x1'));var zipdir=require(_0x49e0('0x2'));var jsonpatch=require(_0x49e0('0x3'));var rp=require('request-promise');var moment=require(_0x49e0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x49e0('0x5'));var util=require(_0x49e0('0x6'));var path=require(_0x49e0('0x7'));var sox=require(_0x49e0('0x8'));var csv=require(_0x49e0('0x9'));var ejs=require(_0x49e0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x49e0('0xb'));var squel=require(_0x49e0('0xc'));var crypto=require(_0x49e0('0xd'));var jsforce=require(_0x49e0('0xe'));var deskjs=require(_0x49e0('0xf'));var toCsv=require(_0x49e0('0x9'));var querystring=require(_0x49e0('0x10'));var Papa=require(_0x49e0('0x11'));var Redis=require('ioredis');var authService=require(_0x49e0('0x12'));var qs=require(_0x49e0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x49e0('0x14'));var utils=require(_0x49e0('0x15'));var config=require(_0x49e0('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x49e0('0x17')](config[_0x49e0('0x18')],{'host':_0x49e0('0x19'),'port':0x18eb});var socket=require(_0x49e0('0x1a'))(new Redis(config[_0x49e0('0x18')]));require('./smsAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x409115,_0xd4e060,_0x4668a9,_0x379ba7){return new BPromise(function(_0x2fd017,_0x133045){var _0x445db6=_0x379ba7||client;return _0x445db6[_0x49e0('0x1b')](_0x409115,_0x4668a9)[_0x49e0('0x1c')](function(_0x4cec71){logger[_0x49e0('0x1d')](_0x49e0('0x1e'),_0xd4e060,'request\x20sent');logger[_0x49e0('0x1f')](_0x49e0('0x20'),_0xd4e060,_0x49e0('0x21'),JSON[_0x49e0('0x22')](_0x4cec71));if(_0x4cec71[_0x49e0('0x23')]){if(_0x4cec71['error'][_0x49e0('0x24')]===0x1f4){logger[_0x49e0('0x23')](_0x49e0('0x1e'),_0xd4e060,_0x4cec71[_0x49e0('0x23')][_0x49e0('0x25')]);return _0x133045(_0x4cec71[_0x49e0('0x23')][_0x49e0('0x25')]);}logger['error'](_0x49e0('0x1e'),_0xd4e060,_0x4cec71['error'][_0x49e0('0x25')]);return _0x2fd017(_0x4cec71['error'][_0x49e0('0x25')]);}else{logger['info'](_0x49e0('0x1e'),_0xd4e060,_0x49e0('0x21'));_0x2fd017(_0x4cec71[_0x49e0('0x26')][_0x49e0('0x25')]);}})[_0x49e0('0x27')](function(_0x3d3de2){logger[_0x49e0('0x23')]('SmsAccount,\x20%s,\x20%s',_0xd4e060,_0x3d3de2);_0x133045(_0x3d3de2);});});}function respondWithStatusCode(_0x4d7334,_0xe97acc){_0xe97acc=_0xe97acc||0xcc;return function(_0x5e0052){if(_0x5e0052){return _0x4d7334[_0x49e0('0x28')](_0xe97acc);}return _0x4d7334['status'](_0xe97acc)[_0x49e0('0x29')]();};}function respondWithResult(_0x506dca,_0xe1c6ed){_0xe1c6ed=_0xe1c6ed||0xc8;return function(_0x626467){if(_0x626467){return _0x506dca[_0x49e0('0x2a')](_0xe1c6ed)['json'](_0x626467);}};}function respondWithFilteredResult(_0x3c13a1,_0x5f3b69){return function(_0x2124d1){if(_0x2124d1){var _0x369f57=typeof _0x5f3b69[_0x49e0('0x2b')]===_0x49e0('0x2c')&&typeof _0x5f3b69['limit']===_0x49e0('0x2c');var _0x573e78=_0x2124d1[_0x49e0('0x2d')];var _0x2c3b99=_0x369f57?0x0:_0x5f3b69[_0x49e0('0x2b')];var _0x534b7d=_0x369f57?_0x2124d1[_0x49e0('0x2d')]:_0x5f3b69[_0x49e0('0x2b')]+_0x5f3b69['limit'];var _0x101739;if(_0x534b7d>=_0x573e78){_0x534b7d=_0x573e78;_0x101739=0xc8;}else{_0x101739=0xce;}_0x3c13a1['status'](_0x101739);return _0x3c13a1[_0x49e0('0x2e')](_0x49e0('0x2f'),_0x2c3b99+'-'+_0x534b7d+'/'+_0x573e78)['json'](_0x2124d1);}return null;};}function patchUpdates(_0x573f31){return function(_0x44dcb4){try{jsonpatch[_0x49e0('0x30')](_0x44dcb4,_0x573f31,!![]);}catch(_0x5c6fbc){return BPromise[_0x49e0('0x31')](_0x5c6fbc);}return _0x44dcb4[_0x49e0('0x32')]();};}function saveUpdates(_0x183c85,_0x23c767){return function(_0x34fdfd){if(_0x34fdfd){return _0x34fdfd[_0x49e0('0x33')](_0x183c85)['then'](function(_0x3697d0){return _0x3697d0;});}return null;};}function removeEntity(_0x29de14,_0x6dfd84){return function(_0x42e5b5){if(_0x42e5b5){return _0x42e5b5[_0x49e0('0x34')]()[_0x49e0('0x1c')](function(){var _0x1c6c5a=_0x42e5b5[_0x49e0('0x35')]({'plain':!![]});var _0x23a6a3=_0x49e0('0x36');return db[_0x49e0('0x37')][_0x49e0('0x34')]({'where':{'type':_0x23a6a3,'resourceId':_0x1c6c5a['id']}})[_0x49e0('0x1c')](function(){return _0x42e5b5;});})['then'](function(){_0x29de14[_0x49e0('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18c523,_0x557974){return function(_0x4b21e7){if(!_0x4b21e7){_0x18c523[_0x49e0('0x28')](0x194);}return _0x4b21e7;};}function handleError(_0x4b97e0,_0x4bac89){_0x4bac89=_0x4bac89||0x1f4;return function(_0x100048){logger['error'](_0x100048[_0x49e0('0x38')]);if(_0x100048[_0x49e0('0x39')]){delete _0x100048[_0x49e0('0x39')];}_0x4b97e0[_0x49e0('0x2a')](_0x4bac89)['send'](_0x100048);};}exports[_0x49e0('0x3a')]=function(_0x477530,_0x2892f4){var _0x24eeea={'include':[{'model':db[_0x49e0('0x3b')],'as':_0x49e0('0x3c')}]},_0xb9792={},_0x3e3449={'count':0x0,'rows':[]};var _0x5a9c30=_['map'](db[_0x49e0('0x3d')][_0x49e0('0x3e')],function(_0x3797b0){return{'name':_0x3797b0[_0x49e0('0x3f')],'type':_0x3797b0[_0x49e0('0x40')][_0x49e0('0x41')]};});_0xb9792['model']=_[_0x49e0('0x42')](_0x5a9c30,_0x49e0('0x39'));_0xb9792[_0x49e0('0x43')]=_[_0x49e0('0x44')](_0x477530['query']);_0xb9792[_0x49e0('0x45')]=_[_0x49e0('0x46')](_0xb9792[_0x49e0('0x47')],_0xb9792['query']);_0x24eeea['attributes']=_['intersection'](_0xb9792['model'],qs[_0x49e0('0x48')](_0x477530[_0x49e0('0x43')]['fields']));_0x24eeea[_0x49e0('0x49')]=_0x24eeea['attributes'][_0x49e0('0x4a')]?_0x24eeea[_0x49e0('0x49')]:_0xb9792[_0x49e0('0x47')];if(!_0x477530[_0x49e0('0x43')][_0x49e0('0x4b')](_0x49e0('0x4c'))){_0x24eeea[_0x49e0('0x4d')]=qs[_0x49e0('0x4d')](_0x477530['query'][_0x49e0('0x4d')]);_0x24eeea[_0x49e0('0x2b')]=qs[_0x49e0('0x2b')](_0x477530['query'][_0x49e0('0x2b')]);}_0x24eeea[_0x49e0('0x4e')]=qs[_0x49e0('0x4f')](_0x477530[_0x49e0('0x43')][_0x49e0('0x4f')]);_0x24eeea['where']=qs[_0x49e0('0x45')](_['pick'](_0x477530[_0x49e0('0x43')],_0xb9792[_0x49e0('0x45')]),_0x5a9c30);if(_0x477530[_0x49e0('0x43')][_0x49e0('0x50')]){_0x24eeea[_0x49e0('0x51')]=_[_0x49e0('0x52')](_0x24eeea[_0x49e0('0x51')],{'$or':_[_0x49e0('0x42')](_0x5a9c30,function(_0x491b63){if(_0x491b63[_0x49e0('0x40')]!=='VIRTUAL'){var _0xe0ea70={};_0xe0ea70[_0x491b63['name']]={'$like':'%'+_0x477530[_0x49e0('0x43')][_0x49e0('0x50')]+'%'};return _0xe0ea70;}})});}_0x24eeea=_[_0x49e0('0x52')]({},_0x24eeea,_0x477530[_0x49e0('0x53')]);var _0x289acc={'where':_0x24eeea[_0x49e0('0x51')]};return db[_0x49e0('0x3d')][_0x49e0('0x2d')](_0x289acc)[_0x49e0('0x1c')](function(_0x2c78c5){_0x3e3449['count']=_0x2c78c5;if(_0x477530[_0x49e0('0x43')][_0x49e0('0x54')]){_0x24eeea[_0x49e0('0x55')]=[{'all':!![]}];}return db[_0x49e0('0x3d')][_0x49e0('0x56')](_0x24eeea);})[_0x49e0('0x1c')](function(_0x2efeb){_0x3e3449[_0x49e0('0x57')]=_0x2efeb;return _0x3e3449;})['then'](respondWithFilteredResult(_0x2892f4,_0x24eeea))[_0x49e0('0x27')](handleError(_0x2892f4,null));};exports[_0x49e0('0x58')]=function(_0x297d40,_0x45fe01){var _0x5e7c9f={'raw':![],'where':{'id':_0x297d40[_0x49e0('0x59')]['id']},'include':[{'model':db[_0x49e0('0x3b')],'as':_0x49e0('0x3c')}]},_0xabd4b6={};_0xabd4b6[_0x49e0('0x47')]=_[_0x49e0('0x44')](db[_0x49e0('0x3d')][_0x49e0('0x3e')]);_0xabd4b6[_0x49e0('0x43')]=_[_0x49e0('0x44')](_0x297d40['query']);_0xabd4b6['filters']=_[_0x49e0('0x46')](_0xabd4b6[_0x49e0('0x47')],_0xabd4b6[_0x49e0('0x43')]);_0x5e7c9f[_0x49e0('0x49')]=_[_0x49e0('0x46')](_0xabd4b6[_0x49e0('0x47')],qs[_0x49e0('0x48')](_0x297d40[_0x49e0('0x43')][_0x49e0('0x48')]));_0x5e7c9f['attributes']=_0x5e7c9f['attributes'][_0x49e0('0x4a')]?_0x5e7c9f[_0x49e0('0x49')]:_0xabd4b6[_0x49e0('0x47')];if(_0x297d40['query'][_0x49e0('0x54')]){_0x5e7c9f[_0x49e0('0x55')]=[{'all':!![]}];}_0x5e7c9f=_[_0x49e0('0x52')]({},_0x5e7c9f,_0x297d40['options']);return db[_0x49e0('0x3d')][_0x49e0('0x5a')](_0x5e7c9f)[_0x49e0('0x1c')](handleEntityNotFound(_0x45fe01,null))[_0x49e0('0x1c')](respondWithResult(_0x45fe01,null))[_0x49e0('0x27')](handleError(_0x45fe01,null));};exports[_0x49e0('0x5b')]=function(_0x56a9ea,_0x27631e){return db[_0x49e0('0x3d')]['create'](_0x56a9ea[_0x49e0('0x5c')],{})[_0x49e0('0x1c')](function(_0x5f4346){var _0x3bcb60=_0x56a9ea[_0x49e0('0x5d')]['get']({'plain':!![]});if(!_0x3bcb60)throw new Error(_0x49e0('0x5e'));if(_0x3bcb60[_0x49e0('0x5f')]===_0x49e0('0x5d')){var _0x148fb5=_0x5f4346[_0x49e0('0x35')]({'plain':!![]});var _0x2dfaab=_0x49e0('0x36');return db[_0x49e0('0x60')][_0x49e0('0x5a')]({'where':{'name':_0x2dfaab,'userProfileId':_0x3bcb60[_0x49e0('0x61')]},'raw':!![]})[_0x49e0('0x1c')](function(_0x32fb8b){if(_0x32fb8b&&_0x32fb8b[_0x49e0('0x62')]===0x0){return db[_0x49e0('0x37')]['create']({'name':_0x148fb5[_0x49e0('0x39')],'resourceId':_0x148fb5['id'],'type':_0x32fb8b[_0x49e0('0x39')],'sectionId':_0x32fb8b['id']},{})[_0x49e0('0x1c')](function(){return _0x5f4346;});}else{return _0x5f4346;}})[_0x49e0('0x27')](function(_0xf9555c){logger['error'](_0x49e0('0x63'),_0xf9555c);throw _0xf9555c;});}return _0x5f4346;})[_0x49e0('0x1c')](respondWithResult(_0x27631e,0xc9))[_0x49e0('0x27')](handleError(_0x27631e,null));};exports[_0x49e0('0x33')]=function(_0x30e25b,_0x36ff65){if(_0x30e25b['body']['id']){delete _0x30e25b[_0x49e0('0x5c')]['id'];}return db[_0x49e0('0x3d')]['find']({'where':{'id':_0x30e25b[_0x49e0('0x59')]['id']},'include':[{'model':db[_0x49e0('0x3b')],'as':_0x49e0('0x3c')}]})[_0x49e0('0x1c')](handleEntityNotFound(_0x36ff65,null))[_0x49e0('0x1c')](saveUpdates(_0x30e25b['body'],null))[_0x49e0('0x1c')](respondWithResult(_0x36ff65,null))[_0x49e0('0x27')](handleError(_0x36ff65,null));};exports[_0x49e0('0x34')]=function(_0x3ab717,_0x22b984){return db['SmsAccount'][_0x49e0('0x5a')]({'where':{'id':_0x3ab717[_0x49e0('0x59')]['id']}})[_0x49e0('0x1c')](handleEntityNotFound(_0x22b984,null))['then'](removeEntity(_0x22b984,null))[_0x49e0('0x27')](handleError(_0x22b984,null));};exports['describe']=function(_0x21a08a,_0x254e70){return db[_0x49e0('0x3d')][_0x49e0('0x64')]()[_0x49e0('0x1c')](respondWithResult(_0x254e70,null))['catch'](handleError(_0x254e70,null));};exports['addDisposition']=function(_0x118007,_0x1bf71c,_0x1cc06d){if(_0x118007[_0x49e0('0x5c')]['id']){delete _0x118007[_0x49e0('0x5c')]['id'];}return db[_0x49e0('0x3d')][_0x49e0('0x5a')]({'where':{'id':_0x118007[_0x49e0('0x59')]['id']}})[_0x49e0('0x1c')](handleEntityNotFound(_0x1bf71c,null))['then'](function(_0x75f025){if(_0x75f025){_0x118007[_0x49e0('0x5c')]['SmsAccountId']=_0x75f025['id'];return db['Disposition'][_0x49e0('0x5b')](_0x118007[_0x49e0('0x5c')]);}})[_0x49e0('0x1c')](respondWithResult(_0x1bf71c,null))[_0x49e0('0x27')](handleError(_0x1bf71c,null));};exports[_0x49e0('0x65')]=function(_0x469645,_0x51b6ff,_0x4dc676){var _0x536883={'raw':![],'where':{}};var _0x4269b9={};var _0xe0ccb4={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x469645['params']['id']}})[_0x49e0('0x1c')](handleEntityNotFound(_0x51b6ff,null))[_0x49e0('0x1c')](function(_0x1c2fdb){if(_0x1c2fdb){_0x4269b9[_0x49e0('0x47')]=_[_0x49e0('0x44')](db['Disposition'][_0x49e0('0x3e')]);_0x4269b9[_0x49e0('0x43')]=_[_0x49e0('0x44')](_0x469645[_0x49e0('0x43')]);_0x4269b9[_0x49e0('0x45')]=_[_0x49e0('0x46')](_0x4269b9[_0x49e0('0x47')],_0x4269b9[_0x49e0('0x43')]);_0x536883[_0x49e0('0x49')]=_[_0x49e0('0x46')](_0x4269b9[_0x49e0('0x47')],qs[_0x49e0('0x48')](_0x469645[_0x49e0('0x43')][_0x49e0('0x48')]));_0x536883['attributes']=_0x536883['attributes']['length']?_0x536883[_0x49e0('0x49')]:_0x4269b9[_0x49e0('0x47')];if(!_0x469645[_0x49e0('0x43')][_0x49e0('0x4b')](_0x49e0('0x4c'))){_0x536883[_0x49e0('0x4d')]=qs[_0x49e0('0x4d')](_0x469645[_0x49e0('0x43')][_0x49e0('0x4d')]);_0x536883[_0x49e0('0x2b')]=qs[_0x49e0('0x2b')](_0x469645['query'][_0x49e0('0x2b')]);}_0x536883[_0x49e0('0x4e')]=qs[_0x49e0('0x4f')](_0x469645[_0x49e0('0x43')][_0x49e0('0x4f')]);_0x536883['where']=qs[_0x49e0('0x45')](_[_0x49e0('0x66')](_0x469645[_0x49e0('0x43')],_0x4269b9[_0x49e0('0x45')]));_0x536883['where'][_0x49e0('0x67')]=_0x1c2fdb['id'];if(_0x469645[_0x49e0('0x43')][_0x49e0('0x50')]){_0x536883[_0x49e0('0x51')]=_[_0x49e0('0x52')](_0x536883[_0x49e0('0x51')],{'$or':_[_0x49e0('0x42')](_0x536883[_0x49e0('0x49')],function(_0x8c68d7){var _0x36e89e={};_0x36e89e[_0x8c68d7]={'$like':'%'+_0x469645[_0x49e0('0x43')]['filter']+'%'};return _0x36e89e;})});}_0x536883=_[_0x49e0('0x52')]({},_0x536883,_0x469645[_0x49e0('0x53')]);return db[_0x49e0('0x68')][_0x49e0('0x2d')]({'where':_0x536883[_0x49e0('0x51')]})[_0x49e0('0x1c')](function(_0x48aedc){_0xe0ccb4[_0x49e0('0x2d')]=_0x48aedc;if(_0x469645['query'][_0x49e0('0x54')]){_0x536883[_0x49e0('0x55')]=[{'all':!![]}];}return db[_0x49e0('0x68')][_0x49e0('0x56')](_0x536883);})['then'](function(_0x186188){_0xe0ccb4[_0x49e0('0x57')]=_0x186188;return _0xe0ccb4;});}})[_0x49e0('0x1c')](respondWithFilteredResult(_0x51b6ff,_0x536883))['catch'](handleError(_0x51b6ff,null));};exports[_0x49e0('0x69')]=function(_0x4a3d46,_0x2e9537,_0x246ea9){return db[_0x49e0('0x3d')][_0x49e0('0x5a')]({'where':{'id':_0x4a3d46[_0x49e0('0x59')]['id']}})[_0x49e0('0x1c')](handleEntityNotFound(_0x2e9537,null))['then'](function(_0x5cbec3){if(_0x5cbec3){return _0x5cbec3[_0x49e0('0x69')](_0x4a3d46['query'][_0x49e0('0x6a')]);}})['then'](respondWithStatusCode(_0x2e9537,null))[_0x49e0('0x27')](handleError(_0x2e9537,null));};exports[_0x49e0('0x6b')]=function(_0x57413a,_0x39ceb4,_0x2e5654){if(_0x57413a['body']['id']){delete _0x57413a[_0x49e0('0x5c')]['id'];}return db[_0x49e0('0x3d')][_0x49e0('0x5a')]({'where':{'id':_0x57413a[_0x49e0('0x59')]['id']}})[_0x49e0('0x1c')](handleEntityNotFound(_0x39ceb4,null))[_0x49e0('0x1c')](function(_0x523251){if(_0x523251){_0x57413a[_0x49e0('0x5c')]['SmsAccountId']=_0x523251['id'];return db[_0x49e0('0x6c')][_0x49e0('0x5b')](_0x57413a[_0x49e0('0x5c')]);}})[_0x49e0('0x1c')](respondWithResult(_0x39ceb4,null))[_0x49e0('0x27')](handleError(_0x39ceb4,null));};exports[_0x49e0('0x6d')]=function(_0x5a06b5,_0x2e73f3,_0x3f3e03){var _0x4c6561={'raw':![],'where':{}};var _0x387dfc={};var _0xe9a9db={'count':0x0,'rows':[]};return db[_0x49e0('0x3d')][_0x49e0('0x6e')]({'where':{'id':_0x5a06b5[_0x49e0('0x59')]['id']}})[_0x49e0('0x1c')](handleEntityNotFound(_0x2e73f3,null))[_0x49e0('0x1c')](function(_0x3c189f){if(_0x3c189f){_0x387dfc[_0x49e0('0x47')]=_['keys'](db[_0x49e0('0x6c')]['rawAttributes']);_0x387dfc[_0x49e0('0x43')]=_['keys'](_0x5a06b5[_0x49e0('0x43')]);_0x387dfc['filters']=_['intersection'](_0x387dfc[_0x49e0('0x47')],_0x387dfc[_0x49e0('0x43')]);_0x4c6561[_0x49e0('0x49')]=_[_0x49e0('0x46')](_0x387dfc[_0x49e0('0x47')],qs['fields'](_0x5a06b5[_0x49e0('0x43')][_0x49e0('0x48')]));_0x4c6561['attributes']=_0x4c6561[_0x49e0('0x49')][_0x49e0('0x4a')]?_0x4c6561['attributes']:_0x387dfc['model'];if(!_0x5a06b5[_0x49e0('0x43')][_0x49e0('0x4b')](_0x49e0('0x4c'))){_0x4c6561[_0x49e0('0x4d')]=qs[_0x49e0('0x4d')](_0x5a06b5[_0x49e0('0x43')][_0x49e0('0x4d')]);_0x4c6561[_0x49e0('0x2b')]=qs[_0x49e0('0x2b')](_0x5a06b5[_0x49e0('0x43')][_0x49e0('0x2b')]);}_0x4c6561[_0x49e0('0x4e')]=qs[_0x49e0('0x4f')](_0x5a06b5[_0x49e0('0x43')][_0x49e0('0x4f')]);_0x4c6561[_0x49e0('0x51')]=qs['filters'](_[_0x49e0('0x66')](_0x5a06b5[_0x49e0('0x43')],_0x387dfc[_0x49e0('0x45')]));_0x4c6561['where'][_0x49e0('0x67')]=_0x3c189f['id'];if(_0x5a06b5[_0x49e0('0x43')][_0x49e0('0x50')]){_0x4c6561[_0x49e0('0x51')]=_[_0x49e0('0x52')](_0x4c6561[_0x49e0('0x51')],{'$or':_[_0x49e0('0x42')](_0x4c6561[_0x49e0('0x49')],function(_0x4701f5){var _0x1e7483={};_0x1e7483[_0x4701f5]={'$like':'%'+_0x5a06b5[_0x49e0('0x43')][_0x49e0('0x50')]+'%'};return _0x1e7483;})});}_0x4c6561=_[_0x49e0('0x52')]({},_0x4c6561,_0x5a06b5[_0x49e0('0x53')]);return db['CannedAnswer'][_0x49e0('0x2d')]({'where':_0x4c6561['where']})[_0x49e0('0x1c')](function(_0x36cd43){_0xe9a9db[_0x49e0('0x2d')]=_0x36cd43;if(_0x5a06b5[_0x49e0('0x43')][_0x49e0('0x54')]){_0x4c6561['include']=[{'all':!![]}];}return db[_0x49e0('0x6c')][_0x49e0('0x56')](_0x4c6561);})[_0x49e0('0x1c')](function(_0x29aa9f){_0xe9a9db[_0x49e0('0x57')]=_0x29aa9f;return _0xe9a9db;});}})[_0x49e0('0x1c')](respondWithFilteredResult(_0x2e73f3,_0x4c6561))[_0x49e0('0x27')](handleError(_0x2e73f3,null));};exports['removeAnswers']=function(_0x587492,_0x3bc073,_0x35782c){return db['SmsAccount'][_0x49e0('0x5a')]({'where':{'id':_0x587492[_0x49e0('0x59')]['id']}})['then'](handleEntityNotFound(_0x3bc073,null))['then'](function(_0x5c93bc){if(_0x5c93bc){return _0x5c93bc['removeAnswers'](_0x587492['query'][_0x49e0('0x6a')]);}})[_0x49e0('0x1c')](respondWithStatusCode(_0x3bc073,null))[_0x49e0('0x27')](handleError(_0x3bc073,null));};exports[_0x49e0('0x6f')]=function(_0x488043,_0x29aed4,_0x1a36df){var _0x372d3a={'channel':'sms'};var _0x16853d=[];var _0x3efcad=[];var _0x47440d={};return db[_0x49e0('0x3d')][_0x49e0('0x5a')]({'where':{'id':_0x488043[_0x49e0('0x59')]['id']},'include':[{'model':db[_0x49e0('0x70')],'as':_0x49e0('0x71')}]})[_0x49e0('0x1c')](handleEntityNotFound(_0x29aed4,null))[_0x49e0('0x1c')](function(_0x340ac0){_0x372d3a[_0x49e0('0x72')]=_0x340ac0;_0x372d3a[_0x49e0('0x73')]=_[_0x49e0('0x74')](_0x340ac0['Applications'],['priority'],[_0x49e0('0x75')]);if(_0x372d3a[_0x49e0('0x72')][_0x49e0('0x71')]){delete _0x372d3a[_0x49e0('0x72')][_0x49e0('0x71')];}return db[_0x49e0('0x76')]['describe']();})[_0x49e0('0x1c')](function(_0x49c616){if(!_0x49c616){throw new db[(_0x49e0('0x77'))]['ValidationError']('no\x20available\x20attributes');}_0x16853d=_[_0x49e0('0x78')](_[_0x49e0('0x44')](_0x49c616),[_0x49e0('0x79'),_0x49e0('0x7a')]);_0x3efcad=_[_0x49e0('0x78')](_[_0x49e0('0x44')](_0x49c616),[_0x49e0('0x79'),'updatedAt','CompanyId',_0x49e0('0x7b')]);_0x372d3a['body']={'mapKey':_0x49e0('0x7c')};if(_0x372d3a[_0x49e0('0x72')][_0x49e0('0x40')]){switch(_0x372d3a['account'][_0x49e0('0x40')]){case _0x49e0('0x7d'):_0x372d3a[_0x49e0('0x5c')]['from']=_0x488043[_0x49e0('0x5c')][_0x49e0('0x7e')];_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x5c')]=_0x488043['body'][_0x49e0('0x7f')];_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x80')]=_0x488043[_0x49e0('0x5c')][_0x49e0('0x81')];break;case'skebby':_0x372d3a['body'][_0x49e0('0x82')]='+'+_0x488043[_0x49e0('0x5c')][_0x49e0('0x83')];_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x5c')]=_0x488043[_0x49e0('0x5c')][_0x49e0('0x84')];break;case'connectel':_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x82')]=_0x488043[_0x49e0('0x5c')][_0x49e0('0x82')];_0x372d3a['body'][_0x49e0('0x5c')]=_0x488043[_0x49e0('0x5c')][_0x49e0('0x25')];break;case _0x49e0('0x85'):_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x82')]=_0x488043['body'][_0x49e0('0x82')];_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x5c')]=_0x488043[_0x49e0('0x5c')]['body'];_0x372d3a[_0x49e0('0x5c')]['messageId']=_0x488043[_0x49e0('0x5c')][_0x49e0('0x86')];break;case _0x49e0('0x87'):_0x372d3a['body'][_0x49e0('0x82')]=_0x488043[_0x49e0('0x5c')]['From'];_0x372d3a[_0x49e0('0x5c')]['body']=_0x488043[_0x49e0('0x5c')]['Text'];_0x372d3a['body']['messageId']=_0x488043[_0x49e0('0x5c')]['MessageUUID'];break;case'infobip':_0x372d3a[_0x49e0('0x5c')]['from']='+'+_0x488043[_0x49e0('0x5c')]['results'][0x0][_0x49e0('0x82')];_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x5c')]=_0x488043[_0x49e0('0x5c')][_0x49e0('0x88')][0x0][_0x49e0('0x84')];_0x372d3a['body'][_0x49e0('0x80')]=_0x488043[_0x49e0('0x5c')][_0x49e0('0x88')][0x0]['messageId'];break;case _0x49e0('0x89'):_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x82')]=_0x488043[_0x49e0('0x5c')][_0x49e0('0x8a')];_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x5c')]=_0x488043[_0x49e0('0x5c')][_0x49e0('0x8b')][_0x49e0('0x25')];break;case _0x49e0('0x8c'):_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x82')]=_0x488043[_0x49e0('0x5c')][_0x49e0('0x8d')];_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x5c')]=_0x488043[_0x49e0('0x5c')]['text'];_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x80')]=_0x488043[_0x49e0('0x5c')][_0x49e0('0x8e')];break;case'bandwidth':_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x80')]=_0x488043['body'][0x0][_0x49e0('0x25')]['id'];_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x82')]=_0x488043['body'][0x0][_0x49e0('0x25')][_0x49e0('0x82')];_0x372d3a['body'][_0x49e0('0x5c')]=_0x488043['body'][0x0][_0x49e0('0x25')][_0x49e0('0x84')];break;case _0x49e0('0x8f'):_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x82')]=_0x488043[_0x49e0('0x5c')][_0x49e0('0x82')];_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x5c')]=_0x488043[_0x49e0('0x5c')][_0x49e0('0x25')];_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x80')]=_0x488043[_0x49e0('0x5c')][_0x49e0('0x90')];break;}}if(_0x372d3a[_0x49e0('0x5c')]['id']){delete _0x372d3a[_0x49e0('0x5c')]['id'];}if(_[_0x49e0('0x91')](_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x82')])){throw new db['Sequelize'][(_0x49e0('0x92'))](_0x49e0('0x93'));}if(_[_0x49e0('0x91')](_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x5c')])||_0x372d3a['body'][_0x49e0('0x5c')]===''){throw new db[(_0x49e0('0x77'))][(_0x49e0('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x49e0('0x91')](_0x372d3a[_0x49e0('0x5c')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x49e0('0x94')+_0x3efcad);}if(!_[_0x49e0('0x95')](_0x3efcad,_0x372d3a[_0x49e0('0x5c')]['mapKey'])){throw new db[(_0x49e0('0x77'))]['ValidationError'](_0x49e0('0x96')+_0x3efcad);}_0x47440d[_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x97')]]=_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x82')];return db[_0x49e0('0x98')][_0x49e0('0x5a')]({'where':{'id':_0x372d3a[_0x49e0('0x72')]['ListId']},'include':[{'model':db[_0x49e0('0x76')],'as':_0x49e0('0x99'),'where':_0x47440d,'limit':0x1,'order':[[_0x49e0('0x7a'),_0x49e0('0x9a')]]}]});})[_0x49e0('0x1c')](handleEntityNotFound(_0x29aed4,null))[_0x49e0('0x1c')](function(_0x395815){if(_0x395815){_0x372d3a[_0x49e0('0x9b')]=_[_0x49e0('0x9c')](_0x395815,['Contacts']);if(_0x395815[_0x49e0('0x99')][_0x49e0('0x4a')]){return _0x395815[_0x49e0('0x99')][0x0];}var _0x57f512=_[_0x49e0('0x17')](_0x372d3a['body'],{'firstName':_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x82')],'ListId':_0x395815['id']});_0x57f512[_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x97')]]=_0x372d3a['body'][_0x49e0('0x82')];return db[_0x49e0('0x76')][_0x49e0('0x5b')](_0x57f512,{'fields':_0x16853d,'raw':!![]});}})['then'](handleEntityNotFound(_0x29aed4,null))[_0x49e0('0x1c')](function(_0x11566b){if(_0x11566b){_0x372d3a[_0x49e0('0x9d')]=_0x11566b;var _0x120bcc={'ContactId':_0x11566b['id'],'phone':_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x82')],'SmsAccountId':_0x488043[_0x49e0('0x59')]['id']};var _0x41c692={'ContactId':_0x11566b['id'],'SmsAccountId':_0x488043[_0x49e0('0x59')]['id'],'closed':![]};return db[_0x49e0('0x9e')]['find']({'where':_0x41c692})[_0x49e0('0x1c')](function(_0x4326c5){if(_0x4326c5){return[_0x4326c5,![]];}return db[_0x49e0('0x9e')][_0x49e0('0x5b')](_0x120bcc)['then'](function(_0x51737a){return[_0x51737a,!![]];});});}})[_0x49e0('0x9f')](function(_0x3c2552,_0x13769e){_0x372d3a[_0x49e0('0xa0')]=_0x3c2552[_0x49e0('0x35')]({'plain':!![]});_0x372d3a['interaction'][_0x49e0('0xa1')]=![];if(_0x13769e){if(_0x372d3a[_0x49e0('0x72')][_0x49e0('0xa2')]){_0x372d3a['applications'][_0x49e0('0xa3')]({'id':0x0,'priority':_0x372d3a[_0x49e0('0x73')]['length']+0x1,'app':'close','appdata':_0x49e0('0xa4'),'interval':_0x49e0('0xa5')});}_0x372d3a[_0x49e0('0xa0')][_0x49e0('0xa1')]=!![];}return db['SmsMessage'][_0x49e0('0x5b')]({'phone':_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x82')],'messageId':_0x372d3a[_0x49e0('0x5c')][_0x49e0('0x80')],'body':_0x372d3a[_0x49e0('0x5c')]['body'],'SmsAccountId':_0x488043[_0x49e0('0x59')]['id'],'SmsInteractionId':_0x3c2552['id'],'direction':'in','ContactId':_0x3c2552[_0x49e0('0xa6')],'AttachmentId':_0x372d3a[_0x49e0('0x5c')][_0x49e0('0xa7')]});})['then'](function(_0x434c6e){_0x372d3a[_0x49e0('0x25')]=_0x434c6e;if(!_0x372d3a[_0x49e0('0xa0')][_0x49e0('0xa8')])return;return db['User'][_0x49e0('0x5a')]({'attributes':['id','name'],'where':{'id':_0x372d3a[_0x49e0('0xa0')][_0x49e0('0xa8')]}});})['then'](function(_0x112294){if(_0x112294){_0x372d3a[_0x49e0('0x73')][_0x49e0('0xa9')]({'id':0x0,'priority':0x0,'app':_0x49e0('0xaa'),'appdata':_0x112294[_0x49e0('0x39')]+','+(_0x372d3a[_0x49e0('0x72')]['waitForTheAssignedAgent']||0xa),'interval':_0x49e0('0xa5')});}if(!_0x372d3a[_0x49e0('0xa0')]['queueId'])return;return db[_0x49e0('0xab')][_0x49e0('0x5a')]({'attributes':['id',_0x49e0('0x39')],'where':{'id':_0x372d3a[_0x49e0('0xa0')][_0x49e0('0xac')]}});})[_0x49e0('0x1c')](function(_0x3a2968){if(_0x3a2968){_0x372d3a[_0x49e0('0x73')][_0x49e0('0xa9')]({'id':0x0,'priority':0x1,'app':_0x49e0('0xad'),'appdata':_0x3a2968[_0x49e0('0x39')]+','+(_0x372d3a[_0x49e0('0x72')][_0x49e0('0xae')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x49e0('0xaf'),_0x49e0('0xb0'),_0x372d3a);})[_0x49e0('0x1c')](function(_0x48022f){if(_0x48022f){var _0x2bf999=0xc8;var _0x9fadc3=_0x49e0('0xb1');logger['info'](_0x49e0('0x20'),_0x9fadc3,_0x2bf999,'entity\x20found');logger[_0x49e0('0x1f')](_0x49e0('0xb2'),_0x9fadc3,_0x2bf999,'entity\x20found',JSON[_0x49e0('0x22')](_0x48022f));if(_0x372d3a['account'][_0x49e0('0x40')]==='twilio'){return _0x29aed4['status'](_0x2bf999)[_0x49e0('0x2e')](_0x49e0('0xb3'),_0x49e0('0xb4'))[_0x49e0('0xb5')](_0x49e0('0xb6'));}else{return _0x29aed4[_0x49e0('0x2a')](_0x2bf999)['json'](_0x48022f);}}})[_0x49e0('0x27')](handleError(_0x29aed4,null));};exports[_0x49e0('0xb7')]=function(_0x2bbfc1,_0x49e5f4){var _0x346d79=_0x2bbfc1[_0x49e0('0x59')]['id'];var _0x11d464=_0x2bbfc1[_0x49e0('0x5c')];var _0x567502=0xc8;var _0x234ab4=null;return db[_0x49e0('0xb8')][_0x49e0('0xb9')]({'isolationLevel':db['sequelize'][_0x49e0('0xba')][_0x49e0('0xbb')][_0x49e0('0xbc')]},function(_0x343842){return db['SmsAccount']['findOne']({'where':{'id':_0x346d79},'transaction':_0x343842})[_0x49e0('0x1c')](function(_0x349549){if(_0x349549){return db[_0x49e0('0x70')][_0x49e0('0x34')]({'where':{'SmsAccountId':_0x346d79},'transaction':_0x343842})[_0x49e0('0x1c')](function(){var _0x273204=_['map'](_0x11d464,function(_0x2e5ee1){_0x2e5ee1[_0x49e0('0x67')]=_0x346d79;return _0x2e5ee1;});return db[_0x49e0('0x70')][_0x49e0('0xbd')](_0x273204,{'transaction':_0x343842});});}else{_0x567502=0x194;_0x234ab4=[];}});})[_0x49e0('0x1c')](function(){if(_0x567502!==0x194){return db[_0x49e0('0x70')]['findAndCountAll']({'where':{'SmsAccountId':_0x346d79},'order':_0x49e0('0xbe')})[_0x49e0('0x1c')](function(_0x242b5b){_0x234ab4=_0x242b5b;});}})['catch'](function(_0x5b92f4){_0x567502=0x1f4;logger[_0x49e0('0x23')](_0x5b92f4[_0x49e0('0x38')]);if(_0x5b92f4[_0x49e0('0x39')]){delete _0x5b92f4['name'];}_0x234ab4=_0x5b92f4;})['finally'](function(){if(_0x234ab4===null){_0x49e5f4[_0x49e0('0x28')](_0x567502);}else{if(_0x567502===0x1f4){_0x49e5f4[_0x49e0('0x2a')](_0x567502)['send'](_0x234ab4);}else{_0x49e5f4['status'](_0x567502)[_0x49e0('0xbf')](_0x234ab4);}}});};exports['getApplications']=function(_0x5a4524,_0x2310b4,_0xb0e694){var _0xc2999b={};var _0x3191da={};var _0x585384;var _0x456f0f;return db[_0x49e0('0x3d')][_0x49e0('0x6e')]({'where':{'id':_0x5a4524['params']['id']}})[_0x49e0('0x1c')](handleEntityNotFound(_0x2310b4,null))['then'](function(_0x20287b){if(_0x20287b){_0x585384=_0x20287b;_0x3191da[_0x49e0('0x47')]=_[_0x49e0('0x44')](db['SmsApplication'][_0x49e0('0x3e')]);_0x3191da[_0x49e0('0x43')]=_[_0x49e0('0x44')](_0x5a4524[_0x49e0('0x43')]);_0x3191da[_0x49e0('0x45')]=_[_0x49e0('0x46')](_0x3191da[_0x49e0('0x47')],_0x3191da[_0x49e0('0x43')]);_0xc2999b[_0x49e0('0x49')]=_['intersection'](_0x3191da[_0x49e0('0x47')],qs[_0x49e0('0x48')](_0x5a4524[_0x49e0('0x43')][_0x49e0('0x48')]));_0xc2999b[_0x49e0('0x49')]=_0xc2999b[_0x49e0('0x49')][_0x49e0('0x4a')]?_0xc2999b[_0x49e0('0x49')]:_0x3191da[_0x49e0('0x47')];_0xc2999b[_0x49e0('0x4e')]=qs['sort'](_0x5a4524['query'][_0x49e0('0x4f')]);_0xc2999b[_0x49e0('0x51')]=qs[_0x49e0('0x45')](_[_0x49e0('0x66')](_0x5a4524[_0x49e0('0x43')],_0x3191da[_0x49e0('0x45')]));if(_0x5a4524[_0x49e0('0x43')]['filter']){_0xc2999b[_0x49e0('0x51')]=_[_0x49e0('0x52')](_0xc2999b[_0x49e0('0x51')],{'$or':_[_0x49e0('0x42')](_0xc2999b[_0x49e0('0x49')],function(_0x429f00){var _0x44d4ad={};_0x44d4ad[_0x429f00]={'$like':'%'+_0x5a4524[_0x49e0('0x43')][_0x49e0('0x50')]+'%'};return _0x44d4ad;})});}_0xc2999b=_[_0x49e0('0x52')]({},_0xc2999b,_0x5a4524[_0x49e0('0x53')]);return _0x585384['getApplications'](_0xc2999b);}})[_0x49e0('0x1c')](function(_0x36d7bf){if(_0x36d7bf){_0x456f0f=_0x36d7bf['length'];if(!_0x5a4524[_0x49e0('0x43')][_0x49e0('0x4b')](_0x49e0('0x4c'))){_0xc2999b['limit']=qs[_0x49e0('0x4d')](_0x5a4524['query'][_0x49e0('0x4d')]);_0xc2999b['offset']=qs[_0x49e0('0x2b')](_0x5a4524[_0x49e0('0x43')][_0x49e0('0x2b')]);}return _0x585384['getApplications'](_0xc2999b);}})[_0x49e0('0x1c')](function(_0x4f1feb){if(_0x4f1feb){return _0x4f1feb?{'count':_0x456f0f,'rows':_0x4f1feb}:null;}})[_0x49e0('0x1c')](respondWithResult(_0x2310b4,null))[_0x49e0('0x27')](handleError(_0x2310b4,null));};exports[_0x49e0('0xc0')]=function(_0x500511,_0x57ca28,_0x35f7b1){var _0x113939={'raw':![],'where':{}};var _0x49d131={};var _0x5c060e={'count':0x0,'rows':[]};return db[_0x49e0('0x3d')][_0x49e0('0x6e')]({'where':{'id':_0x500511[_0x49e0('0x59')]['id']}})[_0x49e0('0x1c')](handleEntityNotFound(_0x57ca28,null))['then'](function(_0x445f37){if(_0x445f37){_0x49d131[_0x49e0('0x47')]=_[_0x49e0('0x44')](db[_0x49e0('0x9e')][_0x49e0('0x3e')]);_0x49d131[_0x49e0('0x43')]=_[_0x49e0('0x44')](_0x500511[_0x49e0('0x43')]);_0x49d131['filters']=_[_0x49e0('0x46')](_0x49d131[_0x49e0('0x47')],_0x49d131['query']);_0x113939[_0x49e0('0x49')]=_[_0x49e0('0x46')](_0x49d131[_0x49e0('0x47')],qs[_0x49e0('0x48')](_0x500511['query'][_0x49e0('0x48')]));_0x113939[_0x49e0('0x49')]=_0x113939[_0x49e0('0x49')]['length']?_0x113939[_0x49e0('0x49')]:_0x49d131[_0x49e0('0x47')];if(!_0x500511[_0x49e0('0x43')][_0x49e0('0x4b')]('nolimit')){_0x113939[_0x49e0('0x4d')]=qs['limit'](_0x500511[_0x49e0('0x43')][_0x49e0('0x4d')]);_0x113939['offset']=qs[_0x49e0('0x2b')](_0x500511[_0x49e0('0x43')][_0x49e0('0x2b')]);}_0x113939[_0x49e0('0x4e')]=qs['sort'](_0x500511[_0x49e0('0x43')][_0x49e0('0x4f')]);_0x113939['where']=qs[_0x49e0('0x45')](_['pick'](_0x500511[_0x49e0('0x43')],_0x49d131['filters']));_0x113939[_0x49e0('0x51')][_0x49e0('0x67')]=_0x445f37['id'];if(_0x500511['query'][_0x49e0('0x50')]){_0x113939[_0x49e0('0x51')]=_[_0x49e0('0x52')](_0x113939[_0x49e0('0x51')],{'$or':_[_0x49e0('0x42')](_0x113939[_0x49e0('0x49')],function(_0x5a7a8d){var _0xfd0f7d={};_0xfd0f7d[_0x5a7a8d]={'$like':'%'+_0x500511[_0x49e0('0x43')][_0x49e0('0x50')]+'%'};return _0xfd0f7d;})});}_0x113939=_['merge']({},_0x113939,_0x500511['options']);return db[_0x49e0('0x9e')]['count']({'where':_0x113939['where']})['then'](function(_0x349813){_0x5c060e[_0x49e0('0x2d')]=_0x349813;if(_0x500511[_0x49e0('0x43')][_0x49e0('0x54')]){_0x113939[_0x49e0('0x55')]=[{'model':db[_0x49e0('0x76')],'as':_0x49e0('0xc1'),'required':![]},{'model':db[_0x49e0('0xc2')],'as':_0x49e0('0xc3'),'attributes':[_0x49e0('0x39'),_0x49e0('0xc4'),_0x49e0('0xc5')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x49e0('0x39'),_0x49e0('0xc6')],'where':_0x500511[_0x49e0('0x43')]['tag']?{'id':_0x500511[_0x49e0('0x43')]['tag']}:undefined,'required':_0x500511[_0x49e0('0x43')][_0x49e0('0xc7')]?!![]:![]}];}return db[_0x49e0('0x9e')]['findAll'](_0x113939);})[_0x49e0('0x1c')](function(_0x2b3daf){_0x5c060e[_0x49e0('0x57')]=_0x2b3daf;return _0x5c060e;});}})['then'](respondWithFilteredResult(_0x57ca28,_0x113939))[_0x49e0('0x27')](handleError(_0x57ca28,null));};exports[_0x49e0('0xb5')]=function(_0x2b0319,_0x48e2fa,_0x4caa69){var _0x39872b,_0x51fcee,_0x3dd86b;if(_[_0x49e0('0x91')](_0x2b0319['body']['body'])||_0x2b0319[_0x49e0('0x5c')]['body']===''){throw new db[(_0x49e0('0x77'))][(_0x49e0('0x92'))](_0x49e0('0xc8'));}if(_[_0x49e0('0x91')](_0x2b0319[_0x49e0('0x5c')]['to'])){throw new db[(_0x49e0('0x77'))][(_0x49e0('0x92'))](_0x49e0('0xc9'));}_0x39872b=_0x2b0319[_0x49e0('0x5c')]['to'];return db[_0x49e0('0x3d')][_0x49e0('0x5a')]({'where':{'id':_0x2b0319[_0x49e0('0x59')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x49e0('0x76')],'as':'Contacts','where':{'mobile':_0x39872b},'limit':0x1,'order':[[_0x49e0('0x7a'),_0x49e0('0x9a')]]}]}]})[_0x49e0('0x1c')](handleEntityNotFound(_0x48e2fa,null))[_0x49e0('0x1c')](function(_0x32425f){if(_0x32425f&&_0x32425f['List']){_0x51fcee=_0x32425f[_0x49e0('0x35')]({'plain':!![]});if(_0x51fcee[_0x49e0('0xca')]&&_0x51fcee[_0x49e0('0xca')]['Contacts']['length']){return _0x51fcee[_0x49e0('0xca')][_0x49e0('0x99')][0x0];}return db[_0x49e0('0x76')]['create'](_[_0x49e0('0x17')](_0x2b0319[_0x49e0('0x5c')],{'firstName':_0x39872b,'mobile':_0x39872b,'phone':_0x39872b,'ListId':_0x51fcee['ListId']}));}})[_0x49e0('0x1c')](handleEntityNotFound(_0x48e2fa,null))['then'](function(_0x4d8288){if(_0x4d8288){_0x3dd86b=_0x4d8288;return db[_0x49e0('0x9e')]['find']({'where':{'ContactId':_0x3dd86b['id'],'closed':![],'SmsAccountId':_0x51fcee['id']}})[_0x49e0('0x1c')](function(_0x34e015){if(_0x34e015){return[_0x34e015,![]];}return db[_0x49e0('0x9e')]['create']({'UserId':_0x2b0319[_0x49e0('0x5d')]['id'],'ContactId':_0x3dd86b['id'],'SmsAccountId':_0x51fcee['id'],'phone':_0x39872b,'firstMsgDirection':_0x49e0('0xcb'),'Messages':[_[_0x49e0('0x52')](_0x2b0319[_0x49e0('0x5c')],{'read':![],'body':_0x2b0319[_0x49e0('0x5c')]['body'],'phone':_0x39872b,'SmsAccountId':_0x51fcee['id'],'UserId':_0x2b0319[_0x49e0('0x5d')]['id'],'ContactId':_0x3dd86b['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x49e0('0xcc')}]})[_0x49e0('0x1c')](function(_0x1f5c67){return[_0x1f5c67,!![]];});});}})[_0x49e0('0x9f')](function(_0x2f88a6,_0x2eae95){if(_0x2eae95){return _0x2f88a6;}return db[_0x49e0('0xcd')][_0x49e0('0x5b')](_[_0x49e0('0x52')](_0x2b0319[_0x49e0('0x5c')],{'read':![],'body':_0x2b0319[_0x49e0('0x5c')][_0x49e0('0x5c')],'phone':_0x39872b,'SmsAccountId':_0x51fcee['id'],'SmsInteractionId':_0x2f88a6['id'],'UserId':_0x2b0319[_0x49e0('0x5d')]['id'],'ContactId':_0x3dd86b['id']}))[_0x49e0('0x1c')](function(_0x53fcf3){_0x2f88a6[_0x49e0('0xce')][_0x49e0('0xcc')]=[];_0x2f88a6['dataValues']['Messages']['push'](_0x53fcf3[_0x49e0('0xce')]);return _0x2f88a6;});})[_0x49e0('0x1c')](respondWithResult(_0x48e2fa,null))['catch'](handleError(_0x48e2fa,null));};exports['status']=function(_0x23cbcf,_0x335f38,_0x55d3eb){if(_0x23cbcf['body']['id']){delete _0x23cbcf[_0x49e0('0x5c')]['id'];}var _0x542323,_0x27ba55,_0x4d8113;return db[_0x49e0('0x3d')][_0x49e0('0x5a')]({'where':{'id':_0x23cbcf[_0x49e0('0x59')]['id']}})['then'](handleEntityNotFound(_0x335f38,null))[_0x49e0('0x1c')](function(_0x552431){if(_0x552431){_0x4d8113=_0x552431;logger['debug'](_0x49e0('0x20'),_0x49e0('0x2a'),'received\x20delivery\x20report\x20from',_0x552431[_0x49e0('0x40')],util[_0x49e0('0xcf')](_0x23cbcf[_0x49e0('0x5c')],{'showHidden':![],'depth':null}));switch(_0x552431['type']){case _0x49e0('0xd0'):if(_0x23cbcf[_0x49e0('0x5c')][_0x49e0('0xd1')]&&_0x23cbcf[_0x49e0('0x5c')]['status']){_0x27ba55=_0x23cbcf[_0x49e0('0x5c')][_0x49e0('0x2a')];return db[_0x49e0('0xcd')][_0x49e0('0x5a')]({'where':{'messageId':_0x23cbcf['body'][_0x49e0('0xd1')]}});}break;case'connectel':if(_0x23cbcf[_0x49e0('0x5c')][_0x49e0('0xd2')]&&_0x23cbcf[_0x49e0('0x5c')][_0x49e0('0xd3')]){_0x27ba55=_0x23cbcf[_0x49e0('0x5c')][_0x49e0('0xd3')];return db[_0x49e0('0xcd')]['find']({'where':{'messageId':_0x23cbcf[_0x49e0('0x5c')]['requestid']}});}break;case _0x49e0('0x85'):if(_0x23cbcf[_0x49e0('0x5c')][_0x49e0('0x86')]&&_0x23cbcf[_0x49e0('0x5c')]['status_code']){_0x27ba55=_0x23cbcf[_0x49e0('0x5c')][_0x49e0('0xd4')];return db[_0x49e0('0xcd')][_0x49e0('0x5a')]({'where':{'messageId':_0x23cbcf[_0x49e0('0x5c')][_0x49e0('0x86')]}});}break;case'infobip':var _0x50e896=_0x23cbcf['body']['results'][0x0];if(_0x50e896[_0x49e0('0x80')]&&_0x50e896[_0x49e0('0x2a')][_0x49e0('0xd5')]===_0x49e0('0xd6')){_0x27ba55=_0x50e896[_0x49e0('0x2a')][_0x49e0('0xd5')];return db[_0x49e0('0xcd')][_0x49e0('0x5a')]({'where':{'messageId':_0x50e896['messageId']}});}break;case _0x49e0('0x8c'):if(_0x23cbcf['body'][_0x49e0('0x80')]&&_0x23cbcf[_0x49e0('0x5c')][_0x49e0('0x2a')]){_0x27ba55=_0x23cbcf[_0x49e0('0x5c')][_0x49e0('0x2a')];return db['SmsMessage']['find']({'where':{'messageId':_0x23cbcf[_0x49e0('0x5c')]['messageId']}});}break;case _0x49e0('0xd7'):if(_0x23cbcf[_0x49e0('0x5c')][0x0][_0x49e0('0x25')]['id']){_0x27ba55=_0x23cbcf[_0x49e0('0x5c')][0x0]['type'];return db[_0x49e0('0xcd')]['find']({'where':{'messageId':_0x23cbcf[_0x49e0('0x5c')][0x0][_0x49e0('0x25')]['id']}});}break;case _0x49e0('0x8f'):if(_0x23cbcf['body']['redif']&&_0x23cbcf[_0x49e0('0x5c')][_0x49e0('0x2a')]){_0x27ba55=_0x23cbcf[_0x49e0('0x5c')]['status'];return db[_0x49e0('0xcd')]['find']({'where':{'messageId':_0x23cbcf['body'][_0x49e0('0xd8')]}});}break;}}})[_0x49e0('0x1c')](handleEntityNotFound(_0x335f38,null))[_0x49e0('0x1c')](function(_0x271012){if(_0x271012){_0x542323=_0x271012;switch(_0x4d8113[_0x49e0('0x40')]){case'skebby':if(_0x27ba55===_0x49e0('0xd6')){return _0x542323['update']({'read':!![]});}else{logger[_0x49e0('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util[_0x49e0('0xcf')](_0x23cbcf[_0x49e0('0x5c')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x27ba55==='1'){return _0x542323[_0x49e0('0x33')]({'read':!![]});}else{logger[_0x49e0('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x49e0('0xd0'),util[_0x49e0('0xcf')](_0x23cbcf[_0x49e0('0x5c')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x23cbcf['body']['error_code']&&_0x27ba55>=0xc8&&_0x27ba55<=0xce){return _0x542323[_0x49e0('0x33')]({'read':!![]});}else{logger[_0x49e0('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x49e0('0x85'),util[_0x49e0('0xcf')](_0x23cbcf[_0x49e0('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x49e0('0xd9'):var _0x3d0f1b=_0x23cbcf['body'][_0x49e0('0x88')][0x0];if(_0x3d0f1b['status'][_0x49e0('0xd5')]==='DELIVERED'){return _0x542323[_0x49e0('0x33')]({'read':!![]});}else{logger[_0x49e0('0x23')](_0x49e0('0x20'),'status',_0x49e0('0xd9'),util[_0x49e0('0xcf')](_0x23cbcf['body'],{'showHidden':![],'depth':null}));}break;case _0x49e0('0x8c'):if(_0x27ba55==_0x49e0('0xda')||_0x27ba55==_0x49e0('0xdb')){return _0x542323[_0x49e0('0x33')]({'read':!![]});}else{logger['error'](_0x49e0('0x20'),_0x49e0('0x2a'),_0x49e0('0x8c'),util[_0x49e0('0xcf')](_0x23cbcf[_0x49e0('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x49e0('0xd7'):if(_0x27ba55==_0x49e0('0xdc')){return _0x542323[_0x49e0('0x33')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x49e0('0x2a'),_0x49e0('0xd7'),util[_0x49e0('0xcf')](_0x23cbcf[_0x49e0('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x49e0('0x8f'):if(_0x27ba55===_0x49e0('0xdd')||_0x27ba55===_0x49e0('0xde')){return _0x542323[_0x49e0('0x33')]({'read':!![]});}else{logger[_0x49e0('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x49e0('0x2a'),_0x49e0('0x8f'),util[_0x49e0('0xcf')](_0x23cbcf['body'],{'showHidden':![],'depth':null}));}break;}return _0x542323;}})[_0x49e0('0x1c')](respondWithResult(_0x335f38,null))['catch'](handleError(_0x335f38,null));};exports['statusGet']=function(_0xbb6f5d,_0x127526,_0x3dbbd8){var _0xe65841,_0x7ab98b,_0x50794a;return db[_0x49e0('0x3d')][_0x49e0('0x5a')]({'where':{'id':_0xbb6f5d[_0x49e0('0x59')]['id']}})[_0x49e0('0x1c')](handleEntityNotFound(_0x127526,null))['then'](function(_0x557f13){if(_0x557f13){_0x50794a=_0x557f13;logger[_0x49e0('0x1f')](_0x49e0('0x20'),'status',_0x49e0('0xdf'),_0x557f13[_0x49e0('0x40')],util['inspect'](_0xbb6f5d[_0x49e0('0x43')],{'showHidden':![],'depth':null}));switch(_0x557f13[_0x49e0('0x40')]){case _0x49e0('0x89'):if(_0xbb6f5d['query'][_0x49e0('0xe0')]&&_0xbb6f5d['query'][_0x49e0('0xe1')]){_0x7ab98b=_0xbb6f5d[_0x49e0('0x43')][_0x49e0('0xe1')];return db['SmsMessage'][_0x49e0('0x5a')]({'where':{'messageId':_0xbb6f5d['query'][_0x49e0('0xe0')]}});}break;}}})[_0x49e0('0x1c')](handleEntityNotFound(_0x127526,null))[_0x49e0('0x1c')](function(_0x1425ba){if(_0x1425ba){_0xe65841=_0x1425ba;switch(_0x50794a['type']){case _0x49e0('0x89'):if(_0x7ab98b==='2'||_0x7ab98b==='6'){return _0xe65841['update']({'read':!![]});}else{logger[_0x49e0('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x49e0('0x2a'),_0x49e0('0x89'),util[_0x49e0('0xcf')](_0xbb6f5d[_0x49e0('0x43')],{'showHidden':![],'depth':null}));};break;}return _0xe65841;}})[_0x49e0('0x1c')](respondWithResult(_0x127526,null))[_0x49e0('0x27')](handleError(_0x127526,null));};exports['addAgents']=function(_0x395293,_0x494115,_0x3af463){return db[_0x49e0('0x3d')][_0x49e0('0x5a')]({'where':{'id':_0x395293[_0x49e0('0x59')]['id']}})[_0x49e0('0x1c')](handleEntityNotFound(_0x494115,null))['then'](function(_0x2c8941){if(_0x2c8941){return _0x2c8941[_0x49e0('0xe2')](_0x395293[_0x49e0('0x5c')]['ids'],_[_0x49e0('0x9c')](_0x395293[_0x49e0('0x5c')],['ids','id'])||{})['spread'](function(_0x5ac88d){for(var _0x262e4c=0x0;_0x262e4c<_0x395293[_0x49e0('0x5c')]['ids'][_0x49e0('0x4a')];_0x262e4c+=0x1){socket['emit'](_0x49e0('0xe3'),{'UserId':Number(_0x395293[_0x49e0('0x5c')][_0x49e0('0x6a')][_0x262e4c]),'SmsAccountId':Number(_0x395293[_0x49e0('0x59')]['id'])});}return _0x5ac88d;});}})['then'](respondWithResult(_0x494115,null))[_0x49e0('0x27')](handleError(_0x494115,null));};exports[_0x49e0('0xe4')]=function(_0xba1775,_0x1977bb,_0x25e5ca){return db['SmsAccount'][_0x49e0('0x5a')]({'where':{'id':_0xba1775['params']['id']}})[_0x49e0('0x1c')](handleEntityNotFound(_0x1977bb,null))[_0x49e0('0x1c')](function(_0x3f60d5){if(_0x3f60d5){return _0x3f60d5[_0x49e0('0xe4')](_0xba1775[_0x49e0('0x43')][_0x49e0('0x6a')])[_0x49e0('0x1c')](function(){if(_[_0x49e0('0xe5')](_0xba1775['query'][_0x49e0('0x6a')])){for(var _0x148a96=0x0;_0x148a96<_0xba1775[_0x49e0('0x43')][_0x49e0('0x6a')][_0x49e0('0x4a')];_0x148a96+=0x1){socket[_0x49e0('0xe6')]('userSmsAccount:remove',{'UserId':Number(_0xba1775[_0x49e0('0x43')][_0x49e0('0x6a')][_0x148a96]),'SmsAccountId':Number(_0xba1775[_0x49e0('0x59')]['id'])});}}else{socket[_0x49e0('0xe6')](_0x49e0('0xe7'),{'UserId':Number(_0xba1775['query'][_0x49e0('0x6a')]),'SmsAccountId':Number(_0xba1775[_0x49e0('0x59')]['id'])});}});}})[_0x49e0('0x1c')](respondWithStatusCode(_0x1977bb,null))[_0x49e0('0x27')](handleError(_0x1977bb,null));};exports[_0x49e0('0xe8')]=function(_0xce9a3b,_0x3f5152,_0x3c1bac){var _0x4fddd2={};var _0x29bd1b={};var _0x139ffa;var _0x23df2b;return db['SmsAccount'][_0x49e0('0x6e')]({'where':{'id':_0xce9a3b[_0x49e0('0x59')]['id']}})[_0x49e0('0x1c')](handleEntityNotFound(_0x3f5152,null))[_0x49e0('0x1c')](function(_0x1b083e){if(_0x1b083e){_0x139ffa=_0x1b083e;_0x29bd1b[_0x49e0('0x47')]=_[_0x49e0('0x44')](db[_0x49e0('0xc2')]['rawAttributes']);_0x29bd1b['query']=_['keys'](_0xce9a3b[_0x49e0('0x43')]);_0x29bd1b[_0x49e0('0x45')]=_['intersection'](_0x29bd1b[_0x49e0('0x47')],_0x29bd1b['query']);_0x4fddd2[_0x49e0('0x49')]=_[_0x49e0('0x46')](_0x29bd1b[_0x49e0('0x47')],qs[_0x49e0('0x48')](_0xce9a3b['query']['fields']));_0x4fddd2['attributes']=_0x4fddd2[_0x49e0('0x49')]['length']?_0x4fddd2[_0x49e0('0x49')]:_0x29bd1b['model'];_0x4fddd2[_0x49e0('0x4e')]=qs['sort'](_0xce9a3b[_0x49e0('0x43')][_0x49e0('0x4f')]);_0x4fddd2[_0x49e0('0x51')]=qs[_0x49e0('0x45')](_[_0x49e0('0x66')](_0xce9a3b['query'],_0x29bd1b[_0x49e0('0x45')]));if(_0xce9a3b[_0x49e0('0x43')][_0x49e0('0x50')]){_0x4fddd2[_0x49e0('0x51')]=_[_0x49e0('0x52')](_0x4fddd2['where'],{'$or':_[_0x49e0('0x42')](_0x4fddd2['attributes'],function(_0x4ffc88){var _0x4ca66f={};_0x4ca66f[_0x4ffc88]={'$like':'%'+_0xce9a3b[_0x49e0('0x43')]['filter']+'%'};return _0x4ca66f;})});}_0x4fddd2=_[_0x49e0('0x52')]({},_0x4fddd2,_0xce9a3b[_0x49e0('0x53')]);return _0x139ffa[_0x49e0('0xe8')](_0x4fddd2);}})[_0x49e0('0x1c')](function(_0x1d5ca5){if(_0x1d5ca5){_0x23df2b=_0x1d5ca5[_0x49e0('0x4a')];if(!_0xce9a3b[_0x49e0('0x43')][_0x49e0('0x4b')](_0x49e0('0x4c'))){_0x4fddd2[_0x49e0('0x4d')]=qs[_0x49e0('0x4d')](_0xce9a3b[_0x49e0('0x43')][_0x49e0('0x4d')]);_0x4fddd2[_0x49e0('0x2b')]=qs[_0x49e0('0x2b')](_0xce9a3b[_0x49e0('0x43')][_0x49e0('0x2b')]);}return _0x139ffa[_0x49e0('0xe8')](_0x4fddd2);}})['then'](function(_0x133de5){if(_0x133de5){return _0x133de5?{'count':_0x23df2b,'rows':_0x133de5}:null;}})[_0x49e0('0x1c')](respondWithResult(_0x3f5152,null))[_0x49e0('0x27')](handleError(_0x3f5152,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 2696dc6..7ae6665 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 _0x4ae4=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','remove'];(function(_0x271caa,_0x485e70){var _0x18a8fa=function(_0x205826){while(--_0x205826){_0x271caa['push'](_0x271caa['shift']());}};_0x18a8fa(++_0x485e70);}(_0x4ae4,0x1c6));var _0x44ae=function(_0x3c15be,_0x28ba2e){_0x3c15be=_0x3c15be-0x0;var _0x3ed3a3=_0x4ae4[_0x3c15be];return _0x3ed3a3;};'use strict';var EventEmitter=require(_0x44ae('0x0'));var SmsAccount=require(_0x44ae('0x1'))['db'][_0x44ae('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x44ae('0x3')](0x0);var events={'afterCreate':_0x44ae('0x4'),'afterUpdate':'update','afterDestroy':_0x44ae('0x5')};function emitEvent(_0x56c461){return function(_0x203d5f,_0x23dcd5,_0x4fe941){SmsAccountEvents[_0x44ae('0x6')](_0x56c461+':'+_0x203d5f['id'],_0x203d5f);SmsAccountEvents[_0x44ae('0x6')](_0x56c461,_0x203d5f);_0x4fe941(null);};}for(var e in events){if(events[_0x44ae('0x7')](e)){var event=events[e];SmsAccount[_0x44ae('0x8')](e,emitEvent(event));}}module[_0x44ae('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0xc874=['save','update','remove','emit','hasOwnProperty','SmsAccount','setMaxListeners'];(function(_0x4bb010,_0x5c862b){var _0x45e1dc=function(_0x3db201){while(--_0x3db201){_0x4bb010['push'](_0x4bb010['shift']());}};_0x45e1dc(++_0x5c862b);}(_0xc874,0x8a));var _0x4c87=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xc874[_0x21aec3];return _0x288bbc;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0x4c87('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x4c87('0x1')](0x0);var events={'afterCreate':_0x4c87('0x2'),'afterUpdate':_0x4c87('0x3'),'afterDestroy':_0x4c87('0x4')};function emitEvent(_0x4f4a86){return function(_0x165463,_0x2203e0,_0xdc1c8c){SmsAccountEvents[_0x4c87('0x5')](_0x4f4a86+':'+_0x165463['id'],_0x165463);SmsAccountEvents[_0x4c87('0x5')](_0x4f4a86,_0x165463);_0xdc1c8c(null);};}for(var e in events){if(events[_0x4c87('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 159c55e..550713f 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 _0x3537=['define','SmsAccount','sms_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./smsAccount.attributes','exports'];(function(_0x22053c,_0x45f41c){var _0x3ae144=function(_0xe04e83){while(--_0xe04e83){_0x22053c['push'](_0x22053c['shift']());}};_0x3ae144(++_0x45f41c);}(_0x3537,0x114));var _0x7353=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0x3537[_0x2abc3d];return _0x252745;};'use strict';var _=require(_0x7353('0x0'));var util=require(_0x7353('0x1'));var logger=require(_0x7353('0x2'))('api');var moment=require(_0x7353('0x3'));var BPromise=require(_0x7353('0x4'));var rp=require(_0x7353('0x5'));var fs=require('fs');var path=require(_0x7353('0x6'));var rimraf=require(_0x7353('0x7'));var config=require('../../config/environment');var attributes=require(_0x7353('0x8'));module[_0x7353('0x9')]=function(_0x20a046,_0x43cae8){return _0x20a046[_0x7353('0xa')](_0x7353('0xb'),attributes,{'tableName':_0x7353('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b9f=['./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x7f4c0d,_0x3bca59){var _0x29219b=function(_0xc9987a){while(--_0xc9987a){_0x7f4c0d['push'](_0x7f4c0d['shift']());}};_0x29219b(++_0x3bca59);}(_0x8b9f,0x1f4));var _0xf8b9=function(_0x167357,_0x265fdc){_0x167357=_0x167357-0x0;var _0x4c322c=_0x8b9f[_0x167357];return _0x4c322c;};'use strict';var _=require('lodash');var util=require(_0xf8b9('0x0'));var logger=require(_0xf8b9('0x1'))('api');var moment=require(_0xf8b9('0x2'));var BPromise=require('bluebird');var rp=require(_0xf8b9('0x3'));var fs=require('fs');var path=require(_0xf8b9('0x4'));var rimraf=require(_0xf8b9('0x5'));var config=require('../../config/environment');var attributes=require(_0xf8b9('0x6'));module[_0xf8b9('0x7')]=function(_0x5d24fa,_0x2cb693){return _0x5d24fa[_0xf8b9('0x8')](_0xf8b9('0x9'),attributes,{'tableName':_0xf8b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index cecd254..855465e 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 _0xfc3f=['include','map','model','ShowSmsAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SmsAccount','options','raw','attributes'];(function(_0x4f98bd,_0x5a478d){var _0x143a7d=function(_0xb4e744){while(--_0xb4e744){_0x4f98bd['push'](_0x4f98bd['shift']());}};_0x143a7d(++_0x5a478d);}(_0xfc3f,0x70));var _0xffc3=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xfc3f[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0xffc3('0x0'));var util=require(_0xffc3('0x1'));var moment=require(_0xffc3('0x2'));var BPromise=require(_0xffc3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xffc3('0x4'));var db=require(_0xffc3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xffc3('0x6'))('rpc');var config=require(_0xffc3('0x7'));var jayson=require(_0xffc3('0x8'));var client=jayson[_0xffc3('0x9')][_0xffc3('0xa')]({'port':0x232a});config['redis']=_[_0xffc3('0xb')](config['redis'],{'host':_0xffc3('0xc'),'port':0x18eb});var socket=require(_0xffc3('0xd'))(new Redis(config['redis']));require(_0xffc3('0xe'))[_0xffc3('0xf')](socket);function respondWithRpcPromise(_0x361320,_0x14e4eb,_0x58b18f){return new BPromise(function(_0x1b93e4,_0x57481e){return client[_0xffc3('0x10')](_0x361320,_0x58b18f)['then'](function(_0x2bb459){logger['info'](_0xffc3('0x11'),_0x14e4eb,_0xffc3('0x12'));logger[_0xffc3('0x13')](_0xffc3('0x14'),_0x14e4eb,_0xffc3('0x12'),JSON[_0xffc3('0x15')](_0x2bb459));if(_0x2bb459[_0xffc3('0x16')]){if(_0x2bb459['error'][_0xffc3('0x17')]===0x1f4){logger[_0xffc3('0x16')](_0xffc3('0x11'),_0x14e4eb,_0x2bb459[_0xffc3('0x16')][_0xffc3('0x18')]);return _0x57481e(_0x2bb459[_0xffc3('0x16')][_0xffc3('0x18')]);}logger[_0xffc3('0x16')]('SmsAccount,\x20%s,\x20%s',_0x14e4eb,_0x2bb459[_0xffc3('0x16')][_0xffc3('0x18')]);return _0x1b93e4(_0x2bb459[_0xffc3('0x16')][_0xffc3('0x18')]);}else{logger[_0xffc3('0x19')](_0xffc3('0x11'),_0x14e4eb,_0xffc3('0x12'));_0x1b93e4(_0x2bb459[_0xffc3('0x1a')][_0xffc3('0x18')]);}})[_0xffc3('0x1b')](function(_0x43fa0e){logger[_0xffc3('0x16')]('SmsAccount,\x20%s,\x20%s',_0x14e4eb,_0x43fa0e);_0x57481e(_0x43fa0e);});});}exports['ShowSmsAccount']=function(_0x3da45b){var _0x196436=this;return new Promise(function(_0x15eb42,_0x5e4407){return db[_0xffc3('0x1c')]['find']({'raw':_0x3da45b[_0xffc3('0x1d')]?_0x3da45b[_0xffc3('0x1d')][_0xffc3('0x1e')]===undefined?!![]:![]:!![],'where':_0x3da45b[_0xffc3('0x1d')]?_0x3da45b['options']['where']||null:null,'attributes':_0x3da45b[_0xffc3('0x1d')]?_0x3da45b[_0xffc3('0x1d')][_0xffc3('0x1f')]||null:null,'include':_0x3da45b['options']?_0x3da45b[_0xffc3('0x1d')][_0xffc3('0x20')]?_[_0xffc3('0x21')](_0x3da45b[_0xffc3('0x1d')][_0xffc3('0x20')],function(_0x3a8a0f){return{'model':db[_0x3a8a0f[_0xffc3('0x22')]],'as':_0x3a8a0f['as'],'attributes':_0x3a8a0f[_0xffc3('0x1f')],'include':_0x3a8a0f[_0xffc3('0x20')]?_[_0xffc3('0x21')](_0x3a8a0f[_0xffc3('0x20')],function(_0x4a418b){return{'model':db[_0x4a418b['model']],'as':_0x4a418b['as'],'attributes':_0x4a418b[_0xffc3('0x1f')],'include':_0x4a418b['include']?_[_0xffc3('0x21')](_0x4a418b['include'],function(_0x47c3d0){return{'model':db[_0x47c3d0[_0xffc3('0x22')]],'as':_0x47c3d0['as'],'attributes':_0x47c3d0[_0xffc3('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b6c60){logger[_0xffc3('0x19')](_0xffc3('0x23'),_0x3da45b);logger[_0xffc3('0x13')](_0xffc3('0x23'),_0x3da45b,JSON['stringify'](_0x5b6c60));_0x15eb42(_0x5b6c60);})['catch'](function(_0x375d7b){logger[_0xffc3('0x16')](_0xffc3('0x23'),_0x375d7b[_0xffc3('0x18')],_0x3da45b);_0x5e4407(_0x196436['error'](0x1f4,_0x375d7b[_0xffc3('0x18')]));});});}; \ No newline at end of file +var _0x2ae9=['../../config/logger','rpc','client','redis','localhost','./smsAccount.socket','register','request','then','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','SmsAccount,\x20%s,\x20%s','message','info','result','catch','SmsAccount','find','options','where','attributes','include','map','model','ShowSmsAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4fbaba,_0x46b0ac){var _0x4e2b94=function(_0x16dd2b){while(--_0x16dd2b){_0x4fbaba['push'](_0x4fbaba['shift']());}};_0x4e2b94(++_0x46b0ac);}(_0x2ae9,0x16f));var _0x92ae=function(_0x4f3242,_0x391954){_0x4f3242=_0x4f3242-0x0;var _0x49844f=_0x2ae9[_0x4f3242];return _0x49844f;};'use strict';var _=require(_0x92ae('0x0'));var util=require(_0x92ae('0x1'));var moment=require('moment');var BPromise=require(_0x92ae('0x2'));var rs=require(_0x92ae('0x3'));var fs=require('fs');var Redis=require(_0x92ae('0x4'));var db=require(_0x92ae('0x5'))['db'];var utils=require(_0x92ae('0x6'));var logger=require(_0x92ae('0x7'))(_0x92ae('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x92ae('0x9')]['http']({'port':0x232a});config[_0x92ae('0xa')]=_['defaults'](config[_0x92ae('0xa')],{'host':_0x92ae('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x92ae('0xa')]));require(_0x92ae('0xc'))[_0x92ae('0xd')](socket);function respondWithRpcPromise(_0x6e1d35,_0x3b03e6,_0x8869c3){return new BPromise(function(_0x3e347d,_0x1ec40e){return client[_0x92ae('0xe')](_0x6e1d35,_0x8869c3)[_0x92ae('0xf')](function(_0x1f911c){logger['info']('SmsAccount,\x20%s,\x20%s',_0x3b03e6,'request\x20sent');logger[_0x92ae('0x10')](_0x92ae('0x11'),_0x3b03e6,_0x92ae('0x12'),JSON['stringify'](_0x1f911c));if(_0x1f911c[_0x92ae('0x13')]){if(_0x1f911c[_0x92ae('0x13')]['code']===0x1f4){logger[_0x92ae('0x13')](_0x92ae('0x14'),_0x3b03e6,_0x1f911c[_0x92ae('0x13')][_0x92ae('0x15')]);return _0x1ec40e(_0x1f911c[_0x92ae('0x13')][_0x92ae('0x15')]);}logger[_0x92ae('0x13')](_0x92ae('0x14'),_0x3b03e6,_0x1f911c[_0x92ae('0x13')][_0x92ae('0x15')]);return _0x3e347d(_0x1f911c[_0x92ae('0x13')][_0x92ae('0x15')]);}else{logger[_0x92ae('0x16')](_0x92ae('0x14'),_0x3b03e6,'request\x20sent');_0x3e347d(_0x1f911c[_0x92ae('0x17')][_0x92ae('0x15')]);}})[_0x92ae('0x18')](function(_0x3b5f7e){logger[_0x92ae('0x13')]('SmsAccount,\x20%s,\x20%s',_0x3b03e6,_0x3b5f7e);_0x1ec40e(_0x3b5f7e);});});}exports['ShowSmsAccount']=function(_0x44f7b3){var _0xa7665f=this;return new Promise(function(_0x1ed5dc,_0x5d256f){return db[_0x92ae('0x19')][_0x92ae('0x1a')]({'raw':_0x44f7b3['options']?_0x44f7b3[_0x92ae('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x44f7b3[_0x92ae('0x1b')]?_0x44f7b3['options'][_0x92ae('0x1c')]||null:null,'attributes':_0x44f7b3[_0x92ae('0x1b')]?_0x44f7b3['options'][_0x92ae('0x1d')]||null:null,'include':_0x44f7b3['options']?_0x44f7b3[_0x92ae('0x1b')][_0x92ae('0x1e')]?_['map'](_0x44f7b3[_0x92ae('0x1b')][_0x92ae('0x1e')],function(_0xf769b8){return{'model':db[_0xf769b8['model']],'as':_0xf769b8['as'],'attributes':_0xf769b8[_0x92ae('0x1d')],'include':_0xf769b8[_0x92ae('0x1e')]?_[_0x92ae('0x1f')](_0xf769b8[_0x92ae('0x1e')],function(_0x48b8ab){return{'model':db[_0x48b8ab[_0x92ae('0x20')]],'as':_0x48b8ab['as'],'attributes':_0x48b8ab['attributes'],'include':_0x48b8ab[_0x92ae('0x1e')]?_[_0x92ae('0x1f')](_0x48b8ab[_0x92ae('0x1e')],function(_0x4e6986){return{'model':db[_0x4e6986[_0x92ae('0x20')]],'as':_0x4e6986['as'],'attributes':_0x4e6986['attributes']};}):[]};}):[]};}):[]:[]})[_0x92ae('0xf')](function(_0x35f1de){logger[_0x92ae('0x16')](_0x92ae('0x21'),_0x44f7b3);logger[_0x92ae('0x10')](_0x92ae('0x21'),_0x44f7b3,JSON['stringify'](_0x35f1de));_0x1ed5dc(_0x35f1de);})['catch'](function(_0x5446e0){logger[_0x92ae('0x13')](_0x92ae('0x21'),_0x5446e0[_0x92ae('0x15')],_0x44f7b3);_0x5d256f(_0xa7665f[_0x92ae('0x13')](0x1f4,_0x5446e0[_0x92ae('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 6301741..50d1abf 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 a2be533..883fc8b 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 _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x2284cb,_0x2b60bd){var _0x4b3663=function(_0x5cf33f){while(--_0x5cf33f){_0x2284cb['push'](_0x2284cb['shift']());}};_0x4b3663(++_0x2b60bd);}(_0x7217,0x19e));var _0x7721=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x7217[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x257a01,_0x143777){var _0xc2cd98=function(_0x3d1842){while(--_0x3d1842){_0x257a01['push'](_0x257a01['shift']());}};_0xc2cd98(++_0x143777);}(_0x34e8,0x12c));var _0x834e=function(_0x4f64f3,_0x479e38){_0x4f64f3=_0x4f64f3-0x0;var _0x5a65bd=_0x34e8[_0x4f64f3];return _0x5a65bd;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index b55d15a..b506afa 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 _0xbccd=['TEXT','sequelize','exports','INTEGER','STRING'];(function(_0xdaab62,_0x2728ab){var _0x13d767=function(_0x14bf14){while(--_0x14bf14){_0xdaab62['push'](_0xdaab62['shift']());}};_0x13d767(++_0x2728ab);}(_0xbccd,0xd8));var _0xdbcc=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xbccd[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0xdbcc('0x0'));module[_0xdbcc('0x1')]={'priority':{'type':Sequelize[_0xdbcc('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xdbcc('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xdbcc('0x4')]()},'description':{'type':Sequelize[_0xdbcc('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x37c4=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0x37c4,0x12e));var _0x437c=function(_0x2bfa26,_0x284274){_0x2bfa26=_0x2bfa26-0x0;var _0x3256a7=_0x37c4[_0x2bfa26];return _0x3256a7;};'use strict';var Sequelize=require(_0x437c('0x0'));module[_0x437c('0x1')]={'priority':{'type':Sequelize[_0x437c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x437c('0x3')],'allowNull':![],'defaultValue':_0x437c('0x4')},'appdata':{'type':Sequelize[_0x437c('0x5')]()},'description':{'type':Sequelize[_0x437c('0x3')]},'interval':{'type':Sequelize[_0x437c('0x3')],'defaultValue':_0x437c('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 7a49023..8c664b9 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 _0xd862=['ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','SmsApplication','includeAll','include','catch','params','keys','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd862,0x156));var _0x2d86=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xd862[_0xc4001c];return _0x49f7bc;};'use strict';var emlformat=require(_0x2d86('0x0'));var rimraf=require(_0x2d86('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d86('0x2'));var rp=require(_0x2d86('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2d86('0x4'));var util=require(_0x2d86('0x5'));var path=require('path');var sox=require(_0x2d86('0x6'));var csv=require(_0x2d86('0x7'));var ejs=require(_0x2d86('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d86('0x9'));var squel=require(_0x2d86('0xa'));var crypto=require(_0x2d86('0xb'));var jsforce=require(_0x2d86('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2d86('0xd'));var Redis=require(_0x2d86('0xe'));var authService=require(_0x2d86('0xf'));var qs=require(_0x2d86('0x10'));var as=require(_0x2d86('0x11'));var hardwareService=require(_0x2d86('0x12'));var logger=require(_0x2d86('0x13'))(_0x2d86('0x14'));var utils=require(_0x2d86('0x15'));var config=require(_0x2d86('0x16'));var licenseUtil=require(_0x2d86('0x17'));var db=require(_0x2d86('0x18'))['db'];function respondWithStatusCode(_0x4499e6,_0x4bb3be){_0x4bb3be=_0x4bb3be||0xcc;return function(_0x162cd0){if(_0x162cd0){return _0x4499e6[_0x2d86('0x19')](_0x4bb3be);}return _0x4499e6['status'](_0x4bb3be)['end']();};}function respondWithResult(_0x38c079,_0x438ae4){_0x438ae4=_0x438ae4||0xc8;return function(_0x2cda9d){if(_0x2cda9d){return _0x38c079[_0x2d86('0x1a')](_0x438ae4)[_0x2d86('0x1b')](_0x2cda9d);}};}function respondWithFilteredResult(_0x5422ae,_0x5be261){return function(_0x58ab1a){if(_0x58ab1a){var _0x5dd521=typeof _0x5be261[_0x2d86('0x1c')]===_0x2d86('0x1d')&&typeof _0x5be261[_0x2d86('0x1e')]===_0x2d86('0x1d');var _0x2fbc66=_0x58ab1a[_0x2d86('0x1f')];var _0x19ad8d=_0x5dd521?0x0:_0x5be261['offset'];var _0x37cd13=_0x5dd521?_0x58ab1a[_0x2d86('0x1f')]:_0x5be261[_0x2d86('0x1c')]+_0x5be261[_0x2d86('0x1e')];var _0x7fb234;if(_0x37cd13>=_0x2fbc66){_0x37cd13=_0x2fbc66;_0x7fb234=0xc8;}else{_0x7fb234=0xce;}_0x5422ae[_0x2d86('0x1a')](_0x7fb234);return _0x5422ae[_0x2d86('0x20')](_0x2d86('0x21'),_0x19ad8d+'-'+_0x37cd13+'/'+_0x2fbc66)[_0x2d86('0x1b')](_0x58ab1a);}return null;};}function patchUpdates(_0x565575){return function(_0x535a4d){try{jsonpatch[_0x2d86('0x22')](_0x535a4d,_0x565575,!![]);}catch(_0x2a3e22){return BPromise[_0x2d86('0x23')](_0x2a3e22);}return _0x535a4d[_0x2d86('0x24')]();};}function saveUpdates(_0x9a877,_0x51b4da){return function(_0x15c7f7){if(_0x15c7f7){return _0x15c7f7[_0x2d86('0x25')](_0x9a877)[_0x2d86('0x26')](function(_0x4ba92a){return _0x4ba92a;});}return null;};}function removeEntity(_0x2b9237,_0x48e5ae){return function(_0x537289){if(_0x537289){return _0x537289[_0x2d86('0x27')]()['then'](function(){_0x2b9237[_0x2d86('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4393a4,_0x398118){return function(_0x104c54){if(!_0x104c54){_0x4393a4[_0x2d86('0x19')](0x194);}return _0x104c54;};}function handleError(_0x1fca4d,_0x388e8d){_0x388e8d=_0x388e8d||0x1f4;return function(_0x2c2c56){logger['error'](_0x2c2c56['stack']);if(_0x2c2c56[_0x2d86('0x28')]){delete _0x2c2c56[_0x2d86('0x28')];}_0x1fca4d[_0x2d86('0x1a')](_0x388e8d)[_0x2d86('0x29')](_0x2c2c56);};}exports[_0x2d86('0x2a')]=function(_0x11e962,_0x458dcc){var _0x32b6e0={},_0x142089={},_0x5b8eb2={'count':0x0,'rows':[]};var _0x44a7da=_[_0x2d86('0x2b')](db['SmsApplication'][_0x2d86('0x2c')],function(_0x22a8d3){return{'name':_0x22a8d3[_0x2d86('0x2d')],'type':_0x22a8d3['type'][_0x2d86('0x2e')]};});_0x142089[_0x2d86('0x2f')]=_[_0x2d86('0x2b')](_0x44a7da,'name');_0x142089[_0x2d86('0x30')]=_['keys'](_0x11e962[_0x2d86('0x30')]);_0x142089[_0x2d86('0x31')]=_['intersection'](_0x142089[_0x2d86('0x2f')],_0x142089[_0x2d86('0x30')]);_0x32b6e0[_0x2d86('0x32')]=_[_0x2d86('0x33')](_0x142089['model'],qs[_0x2d86('0x34')](_0x11e962[_0x2d86('0x30')]['fields']));_0x32b6e0[_0x2d86('0x32')]=_0x32b6e0[_0x2d86('0x32')][_0x2d86('0x35')]?_0x32b6e0[_0x2d86('0x32')]:_0x142089[_0x2d86('0x2f')];if(!_0x11e962[_0x2d86('0x30')]['hasOwnProperty'](_0x2d86('0x36'))){_0x32b6e0['limit']=qs['limit'](_0x11e962['query'][_0x2d86('0x1e')]);_0x32b6e0[_0x2d86('0x1c')]=qs[_0x2d86('0x1c')](_0x11e962['query']['offset']);}_0x32b6e0['order']=qs[_0x2d86('0x37')](_0x11e962[_0x2d86('0x30')][_0x2d86('0x37')]);_0x32b6e0[_0x2d86('0x38')]=qs[_0x2d86('0x31')](_['pick'](_0x11e962['query'],_0x142089[_0x2d86('0x31')]),_0x44a7da);if(_0x11e962['query'][_0x2d86('0x39')]){_0x32b6e0[_0x2d86('0x38')]=_[_0x2d86('0x3a')](_0x32b6e0[_0x2d86('0x38')],{'$or':_['map'](_0x44a7da,function(_0x552965){if(_0x552965['type']!==_0x2d86('0x3b')){var _0x3b6ce6={};_0x3b6ce6[_0x552965[_0x2d86('0x28')]]={'$like':'%'+_0x11e962[_0x2d86('0x30')][_0x2d86('0x39')]+'%'};return _0x3b6ce6;}})});}_0x32b6e0=_[_0x2d86('0x3a')]({},_0x32b6e0,_0x11e962[_0x2d86('0x3c')]);var _0x5a1523={'where':_0x32b6e0[_0x2d86('0x38')]};return db[_0x2d86('0x3d')][_0x2d86('0x1f')](_0x5a1523)['then'](function(_0xf3aada){_0x5b8eb2[_0x2d86('0x1f')]=_0xf3aada;if(_0x11e962['query'][_0x2d86('0x3e')]){_0x32b6e0[_0x2d86('0x3f')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x32b6e0);})[_0x2d86('0x26')](function(_0x55b222){_0x5b8eb2['rows']=_0x55b222;return _0x5b8eb2;})['then'](respondWithFilteredResult(_0x458dcc,_0x32b6e0))[_0x2d86('0x40')](handleError(_0x458dcc,null));};exports['show']=function(_0xbc68e1,_0x4885cb){var _0x16192f={'raw':!![],'where':{'id':_0xbc68e1[_0x2d86('0x41')]['id']}},_0x5ed514={};_0x5ed514[_0x2d86('0x2f')]=_[_0x2d86('0x42')](db[_0x2d86('0x3d')][_0x2d86('0x2c')]);_0x5ed514['query']=_[_0x2d86('0x42')](_0xbc68e1[_0x2d86('0x30')]);_0x5ed514[_0x2d86('0x31')]=_[_0x2d86('0x33')](_0x5ed514[_0x2d86('0x2f')],_0x5ed514[_0x2d86('0x30')]);_0x16192f[_0x2d86('0x32')]=_[_0x2d86('0x33')](_0x5ed514['model'],qs[_0x2d86('0x34')](_0xbc68e1[_0x2d86('0x30')][_0x2d86('0x34')]));_0x16192f[_0x2d86('0x32')]=_0x16192f[_0x2d86('0x32')][_0x2d86('0x35')]?_0x16192f[_0x2d86('0x32')]:_0x5ed514[_0x2d86('0x2f')];if(_0xbc68e1[_0x2d86('0x30')][_0x2d86('0x3e')]){_0x16192f[_0x2d86('0x3f')]=[{'all':!![]}];}_0x16192f=_[_0x2d86('0x3a')]({},_0x16192f,_0xbc68e1[_0x2d86('0x3c')]);return db[_0x2d86('0x3d')][_0x2d86('0x43')](_0x16192f)[_0x2d86('0x26')](handleEntityNotFound(_0x4885cb,null))['then'](respondWithResult(_0x4885cb,null))[_0x2d86('0x40')](handleError(_0x4885cb,null));};exports['create']=function(_0x318590,_0x2680f7){return db[_0x2d86('0x3d')][_0x2d86('0x44')](_0x318590[_0x2d86('0x45')],{})[_0x2d86('0x26')](respondWithResult(_0x2680f7,0xc9))[_0x2d86('0x40')](handleError(_0x2680f7,null));};exports['update']=function(_0x42acb9,_0x2a8167){if(_0x42acb9['body']['id']){delete _0x42acb9[_0x2d86('0x45')]['id'];}return db[_0x2d86('0x3d')][_0x2d86('0x43')]({'where':{'id':_0x42acb9['params']['id']}})[_0x2d86('0x26')](handleEntityNotFound(_0x2a8167,null))[_0x2d86('0x26')](saveUpdates(_0x42acb9[_0x2d86('0x45')],null))[_0x2d86('0x26')](respondWithResult(_0x2a8167,null))[_0x2d86('0x40')](handleError(_0x2a8167,null));};exports['destroy']=function(_0x4d8ce9,_0xcb8f7a){return db['SmsApplication'][_0x2d86('0x43')]({'where':{'id':_0x4d8ce9[_0x2d86('0x41')]['id']}})[_0x2d86('0x26')](handleEntityNotFound(_0xcb8f7a,null))[_0x2d86('0x26')](removeEntity(_0xcb8f7a,null))[_0x2d86('0x40')](handleError(_0xcb8f7a,null));}; \ No newline at end of file +var _0x880a=['SmsApplication','type','key','model','name','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','where','includeAll','include','findAll','rows','catch','fields','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','error','stack','send','index','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x880a,0xae));var _0xa880=function(_0x35fc3c,_0x2660e9){_0x35fc3c=_0x35fc3c-0x0;var _0x584629=_0x880a[_0x35fc3c];return _0x584629;};'use strict';var emlformat=require(_0xa880('0x0'));var rimraf=require(_0xa880('0x1'));var zipdir=require(_0xa880('0x2'));var jsonpatch=require(_0xa880('0x3'));var rp=require(_0xa880('0x4'));var moment=require('moment');var BPromise=require(_0xa880('0x5'));var Mustache=require(_0xa880('0x6'));var util=require(_0xa880('0x7'));var path=require('path');var sox=require(_0xa880('0x8'));var csv=require('to-csv');var ejs=require(_0xa880('0x9'));var fs=require('fs');var fs_extra=require(_0xa880('0xa'));var _=require('lodash');var squel=require(_0xa880('0xb'));var crypto=require(_0xa880('0xc'));var jsforce=require(_0xa880('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa880('0xe'));var querystring=require('querystring');var Papa=require(_0xa880('0xf'));var Redis=require(_0xa880('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa880('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa880('0x12'));var utils=require(_0xa880('0x13'));var config=require(_0xa880('0x14'));var licenseUtil=require(_0xa880('0x15'));var db=require(_0xa880('0x16'))['db'];function respondWithStatusCode(_0x207460,_0x1426de){_0x1426de=_0x1426de||0xcc;return function(_0x124db8){if(_0x124db8){return _0x207460[_0xa880('0x17')](_0x1426de);}return _0x207460[_0xa880('0x18')](_0x1426de)[_0xa880('0x19')]();};}function respondWithResult(_0x21ab69,_0x4a0943){_0x4a0943=_0x4a0943||0xc8;return function(_0x141681){if(_0x141681){return _0x21ab69['status'](_0x4a0943)[_0xa880('0x1a')](_0x141681);}};}function respondWithFilteredResult(_0x2df239,_0x3c6458){return function(_0x4524fb){if(_0x4524fb){var _0x1debd8=typeof _0x3c6458[_0xa880('0x1b')]==='undefined'&&typeof _0x3c6458[_0xa880('0x1c')]===_0xa880('0x1d');var _0x4ca51f=_0x4524fb[_0xa880('0x1e')];var _0x3e7b8a=_0x1debd8?0x0:_0x3c6458['offset'];var _0x3a07b5=_0x1debd8?_0x4524fb[_0xa880('0x1e')]:_0x3c6458['offset']+_0x3c6458[_0xa880('0x1c')];var _0x21c4ac;if(_0x3a07b5>=_0x4ca51f){_0x3a07b5=_0x4ca51f;_0x21c4ac=0xc8;}else{_0x21c4ac=0xce;}_0x2df239['status'](_0x21c4ac);return _0x2df239['set'](_0xa880('0x1f'),_0x3e7b8a+'-'+_0x3a07b5+'/'+_0x4ca51f)[_0xa880('0x1a')](_0x4524fb);}return null;};}function patchUpdates(_0x4055f4){return function(_0x5f42e2){try{jsonpatch['apply'](_0x5f42e2,_0x4055f4,!![]);}catch(_0x2db86f){return BPromise[_0xa880('0x20')](_0x2db86f);}return _0x5f42e2[_0xa880('0x21')]();};}function saveUpdates(_0x23e7e6,_0x5b022f){return function(_0x95b5b6){if(_0x95b5b6){return _0x95b5b6[_0xa880('0x22')](_0x23e7e6)[_0xa880('0x23')](function(_0x1990a6){return _0x1990a6;});}return null;};}function removeEntity(_0x2fdaf1,_0x1f3e80){return function(_0x6daa4){if(_0x6daa4){return _0x6daa4[_0xa880('0x24')]()[_0xa880('0x23')](function(){_0x2fdaf1[_0xa880('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5311c7,_0x16931a){return function(_0x102200){if(!_0x102200){_0x5311c7[_0xa880('0x17')](0x194);}return _0x102200;};}function handleError(_0x39e49e,_0x10a2b7){_0x10a2b7=_0x10a2b7||0x1f4;return function(_0x263cd0){logger[_0xa880('0x25')](_0x263cd0[_0xa880('0x26')]);if(_0x263cd0['name']){delete _0x263cd0['name'];}_0x39e49e[_0xa880('0x18')](_0x10a2b7)[_0xa880('0x27')](_0x263cd0);};}exports[_0xa880('0x28')]=function(_0x71bdf0,_0x561daa){var _0x3b5b77={},_0x3f4536={},_0x1135ce={'count':0x0,'rows':[]};var _0x2acff3=_[_0xa880('0x29')](db[_0xa880('0x2a')]['rawAttributes'],function(_0xba0478){return{'name':_0xba0478['fieldName'],'type':_0xba0478[_0xa880('0x2b')][_0xa880('0x2c')]};});_0x3f4536[_0xa880('0x2d')]=_[_0xa880('0x29')](_0x2acff3,_0xa880('0x2e'));_0x3f4536['query']=_[_0xa880('0x2f')](_0x71bdf0[_0xa880('0x30')]);_0x3f4536[_0xa880('0x31')]=_[_0xa880('0x32')](_0x3f4536[_0xa880('0x2d')],_0x3f4536[_0xa880('0x30')]);_0x3b5b77[_0xa880('0x33')]=_[_0xa880('0x32')](_0x3f4536['model'],qs['fields'](_0x71bdf0[_0xa880('0x30')]['fields']));_0x3b5b77['attributes']=_0x3b5b77[_0xa880('0x33')][_0xa880('0x34')]?_0x3b5b77['attributes']:_0x3f4536['model'];if(!_0x71bdf0[_0xa880('0x30')][_0xa880('0x35')](_0xa880('0x36'))){_0x3b5b77['limit']=qs[_0xa880('0x1c')](_0x71bdf0['query'][_0xa880('0x1c')]);_0x3b5b77[_0xa880('0x1b')]=qs[_0xa880('0x1b')](_0x71bdf0[_0xa880('0x30')][_0xa880('0x1b')]);}_0x3b5b77[_0xa880('0x37')]=qs['sort'](_0x71bdf0[_0xa880('0x30')][_0xa880('0x38')]);_0x3b5b77['where']=qs[_0xa880('0x31')](_[_0xa880('0x39')](_0x71bdf0[_0xa880('0x30')],_0x3f4536[_0xa880('0x31')]),_0x2acff3);if(_0x71bdf0[_0xa880('0x30')][_0xa880('0x3a')]){_0x3b5b77['where']=_[_0xa880('0x3b')](_0x3b5b77['where'],{'$or':_[_0xa880('0x29')](_0x2acff3,function(_0x4c994e){if(_0x4c994e[_0xa880('0x2b')]!==_0xa880('0x3c')){var _0x40c2c9={};_0x40c2c9[_0x4c994e['name']]={'$like':'%'+_0x71bdf0['query'][_0xa880('0x3a')]+'%'};return _0x40c2c9;}})});}_0x3b5b77=_['merge']({},_0x3b5b77,_0x71bdf0['options']);var _0x511872={'where':_0x3b5b77[_0xa880('0x3d')]};return db[_0xa880('0x2a')][_0xa880('0x1e')](_0x511872)[_0xa880('0x23')](function(_0x49c273){_0x1135ce[_0xa880('0x1e')]=_0x49c273;if(_0x71bdf0[_0xa880('0x30')][_0xa880('0x3e')]){_0x3b5b77[_0xa880('0x3f')]=[{'all':!![]}];}return db[_0xa880('0x2a')][_0xa880('0x40')](_0x3b5b77);})[_0xa880('0x23')](function(_0x44aaa9){_0x1135ce[_0xa880('0x41')]=_0x44aaa9;return _0x1135ce;})['then'](respondWithFilteredResult(_0x561daa,_0x3b5b77))[_0xa880('0x42')](handleError(_0x561daa,null));};exports['show']=function(_0x13f97e,_0x50297f){var _0x1bcbaa={'raw':!![],'where':{'id':_0x13f97e['params']['id']}},_0xd13f6d={};_0xd13f6d[_0xa880('0x2d')]=_[_0xa880('0x2f')](db[_0xa880('0x2a')]['rawAttributes']);_0xd13f6d[_0xa880('0x30')]=_[_0xa880('0x2f')](_0x13f97e['query']);_0xd13f6d[_0xa880('0x31')]=_[_0xa880('0x32')](_0xd13f6d['model'],_0xd13f6d[_0xa880('0x30')]);_0x1bcbaa[_0xa880('0x33')]=_[_0xa880('0x32')](_0xd13f6d[_0xa880('0x2d')],qs['fields'](_0x13f97e['query'][_0xa880('0x43')]));_0x1bcbaa['attributes']=_0x1bcbaa[_0xa880('0x33')][_0xa880('0x34')]?_0x1bcbaa['attributes']:_0xd13f6d['model'];if(_0x13f97e[_0xa880('0x30')]['includeAll']){_0x1bcbaa[_0xa880('0x3f')]=[{'all':!![]}];}_0x1bcbaa=_['merge']({},_0x1bcbaa,_0x13f97e['options']);return db['SmsApplication']['find'](_0x1bcbaa)[_0xa880('0x23')](handleEntityNotFound(_0x50297f,null))['then'](respondWithResult(_0x50297f,null))[_0xa880('0x42')](handleError(_0x50297f,null));};exports[_0xa880('0x44')]=function(_0x34630f,_0x1dd852){return db[_0xa880('0x2a')][_0xa880('0x44')](_0x34630f[_0xa880('0x45')],{})[_0xa880('0x23')](respondWithResult(_0x1dd852,0xc9))[_0xa880('0x42')](handleError(_0x1dd852,null));};exports[_0xa880('0x22')]=function(_0x14e9bf,_0x101a27){if(_0x14e9bf[_0xa880('0x45')]['id']){delete _0x14e9bf['body']['id'];}return db[_0xa880('0x2a')][_0xa880('0x46')]({'where':{'id':_0x14e9bf['params']['id']}})[_0xa880('0x23')](handleEntityNotFound(_0x101a27,null))[_0xa880('0x23')](saveUpdates(_0x14e9bf[_0xa880('0x45')],null))['then'](respondWithResult(_0x101a27,null))['catch'](handleError(_0x101a27,null));};exports[_0xa880('0x24')]=function(_0x4effde,_0x5d8666){return db[_0xa880('0x2a')][_0xa880('0x46')]({'where':{'id':_0x4effde[_0xa880('0x47')]['id']}})['then'](handleEntityNotFound(_0x5d8666,null))[_0xa880('0x23')](removeEntity(_0x5d8666,null))[_0xa880('0x42')](handleError(_0x5d8666,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 74e17f0..fa839f0 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 _0xc32e=['bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','utf8mb4','util','../../config/logger','api','moment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xc32e,0x168));var _0xec32=function(_0x5ebe94,_0x5f20d7){_0x5ebe94=_0x5ebe94-0x0;var _0x3feb9f=_0xc32e[_0x5ebe94];return _0x3feb9f;};'use strict';var _=require('lodash');var util=require(_0xec32('0x0'));var logger=require(_0xec32('0x1'))(_0xec32('0x2'));var moment=require(_0xec32('0x3'));var BPromise=require(_0xec32('0x4'));var rp=require(_0xec32('0x5'));var fs=require('fs');var path=require(_0xec32('0x6'));var rimraf=require(_0xec32('0x7'));var config=require(_0xec32('0x8'));var attributes=require(_0xec32('0x9'));module['exports']=function(_0x2d2ba1,_0x269148){return _0x2d2ba1[_0xec32('0xa')](_0xec32('0xb'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xec32('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9221=['exports','SmsApplication','sms_applications','utf8mb4','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x9221,0x64));var _0x1922=function(_0x3cc8b4,_0x33bc7d){_0x3cc8b4=_0x3cc8b4-0x0;var _0x20ff15=_0x9221[_0x3cc8b4];return _0x20ff15;};'use strict';var _=require('lodash');var util=require(_0x1922('0x0'));var logger=require(_0x1922('0x1'))('api');var moment=require(_0x1922('0x2'));var BPromise=require(_0x1922('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1922('0x4'));var rimraf=require(_0x1922('0x5'));var config=require(_0x1922('0x6'));var attributes=require(_0x1922('0x7'));module[_0x1922('0x8')]=function(_0x1944a5,_0x1351a0){return _0x1944a5['define'](_0x1922('0x9'),attributes,{'tableName':_0x1922('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1922('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index d16d471..82422d4 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 _0xd506=['catch','lodash','../../config/logger','client','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','code','error','message'];(function(_0x223839,_0x3694df){var _0x4040b2=function(_0x21acd7){while(--_0x21acd7){_0x223839['push'](_0x223839['shift']());}};_0x4040b2(++_0x3694df);}(_0xd506,0x197));var _0x6d50=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xd506[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x6d50('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d50('0x1'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6d50('0x2')][_0x6d50('0x3')]({'port':0x232a});function respondWithRpcPromise(_0x1b0af3,_0x4cf512,_0x9565b6){return new BPromise(function(_0xce67b6,_0x2dacde){return client['request'](_0x1b0af3,_0x9565b6)[_0x6d50('0x4')](function(_0x5012ed){logger[_0x6d50('0x5')](_0x6d50('0x6'),_0x4cf512,_0x6d50('0x7'));logger[_0x6d50('0x8')](_0x6d50('0x9'),_0x4cf512,_0x6d50('0x7'),JSON['stringify'](_0x5012ed));if(_0x5012ed['error']){if(_0x5012ed['error'][_0x6d50('0xa')]===0x1f4){logger[_0x6d50('0xb')](_0x6d50('0x6'),_0x4cf512,_0x5012ed[_0x6d50('0xb')]['message']);return _0x2dacde(_0x5012ed[_0x6d50('0xb')]['message']);}logger[_0x6d50('0xb')]('SmsApplication,\x20%s,\x20%s',_0x4cf512,_0x5012ed['error']['message']);return _0xce67b6(_0x5012ed[_0x6d50('0xb')]['message']);}else{logger[_0x6d50('0x5')](_0x6d50('0x6'),_0x4cf512,'request\x20sent');_0xce67b6(_0x5012ed['result'][_0x6d50('0xc')]);}})[_0x6d50('0xd')](function(_0x38068e){logger['error'](_0x6d50('0x6'),_0x4cf512,_0x38068e);_0x2dacde(_0x38068e);});});} \ No newline at end of file +var _0x7382=['message','result','catch','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x4fa97c,_0x4aa6ab){var _0x518c7f=function(_0x2bd135){while(--_0x2bd135){_0x4fa97c['push'](_0x4fa97c['shift']());}};_0x518c7f(++_0x4aa6ab);}(_0x7382,0x111));var _0x2738=function(_0x36b99f,_0x2dbfe7){_0x36b99f=_0x36b99f-0x0;var _0x4d530c=_0x7382[_0x36b99f];return _0x4d530c;};'use strict';var _=require('lodash');var util=require(_0x2738('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2738('0x1'));var logger=require(_0x2738('0x2'))(_0x2738('0x3'));var config=require(_0x2738('0x4'));var jayson=require(_0x2738('0x5'));var client=jayson['client'][_0x2738('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2bc38a,_0xd74b07,_0x523aef){return new BPromise(function(_0x4235e7,_0x487d14){return client[_0x2738('0x7')](_0x2bc38a,_0x523aef)['then'](function(_0x476864){logger[_0x2738('0x8')](_0x2738('0x9'),_0xd74b07,'request\x20sent');logger[_0x2738('0xa')](_0x2738('0xb'),_0xd74b07,_0x2738('0xc'),JSON['stringify'](_0x476864));if(_0x476864['error']){if(_0x476864[_0x2738('0xd')][_0x2738('0xe')]===0x1f4){logger[_0x2738('0xd')](_0x2738('0x9'),_0xd74b07,_0x476864[_0x2738('0xd')][_0x2738('0xf')]);return _0x487d14(_0x476864[_0x2738('0xd')][_0x2738('0xf')]);}logger[_0x2738('0xd')](_0x2738('0x9'),_0xd74b07,_0x476864[_0x2738('0xd')]['message']);return _0x4235e7(_0x476864[_0x2738('0xd')][_0x2738('0xf')]);}else{logger['info'](_0x2738('0x9'),_0xd74b07,'request\x20sent');_0x4235e7(_0x476864[_0x2738('0x10')]['message']);}})[_0x2738('0x11')](function(_0x568065){logger[_0x2738('0xd')](_0x2738('0x9'),_0xd74b07,_0x568065);_0x487d14(_0x568065);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index f4b54bb..d04e469 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 _0x3423=['/:id','/:id/messages','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','delete','smsinteraction:destroy','destroy','removeTags','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x39cf70,_0x3ec55b){var _0x580424=function(_0x580a4e){while(--_0x580a4e){_0x39cf70['push'](_0x39cf70['shift']());}};_0x580424(++_0x3ec55b);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var fs_extra=require(_0x3342('0x4'));var auth=require(_0x3342('0x5'));var interaction=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var controller=require(_0x3342('0x8'));router[_0x3342('0x9')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xb')]);router[_0x3342('0x9')](_0x3342('0xc'),auth[_0x3342('0xa')](),controller[_0x3342('0xd')]);router[_0x3342('0x9')](_0x3342('0xe'),auth[_0x3342('0xa')](),controller['show']);router['get'](_0x3342('0xf'),auth['isAuthenticated'](),controller['getMessages']);router['get']('/:id/download',auth[_0x3342('0xa')](),controller[_0x3342('0x10')]);router['post']('/',auth[_0x3342('0xa')](),controller['create']);router[_0x3342('0x11')](_0x3342('0xf'),auth['isAuthenticated'](),controller[_0x3342('0x12')]);router[_0x3342('0x11')](_0x3342('0x13'),auth[_0x3342('0xa')](),interaction[_0x3342('0x14')](_0x3342('0x15'),_0x3342('0x16')),controller['addTags']);router[_0x3342('0x17')](_0x3342('0xe'),auth['isAuthenticated'](),interaction[_0x3342('0x14')](_0x3342('0x15'),'smsinteraction:update'),controller['update']);router[_0x3342('0x18')](_0x3342('0xe'),auth[_0x3342('0xa')](),interaction[_0x3342('0x14')](_0x3342('0x15'),_0x3342('0x19')),controller[_0x3342('0x1a')]);router[_0x3342('0x18')](_0x3342('0x13'),auth['isAuthenticated'](),controller[_0x3342('0x1b')]);module[_0x3342('0x1c')]=router; \ No newline at end of file +var _0x80ed=['delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update'];(function(_0x496af1,_0x2d5f59){var _0x5700b3=function(_0x4e346a){while(--_0x4e346a){_0x496af1['push'](_0x496af1['shift']());}};_0x5700b3(++_0x2d5f59);}(_0x80ed,0x11c));var _0xd80e=function(_0x23244a,_0x9442b6){_0x23244a=_0x23244a-0x0;var _0x146e6e=_0x80ed[_0x23244a];return _0x146e6e;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var fs_extra=require(_0xd80e('0x4'));var auth=require(_0xd80e('0x5'));var interaction=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var controller=require('./smsInteraction.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0x8')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0x8')](_0xd80e('0xf'),auth[_0xd80e('0x9')](),controller['getMessages']);router[_0xd80e('0x8')](_0xd80e('0x10'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);router[_0xd80e('0x12')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0x13')]);router[_0xd80e('0x12')](_0xd80e('0xf'),auth['isAuthenticated'](),controller['addMessage']);router['post']('/:id/tags',auth[_0xd80e('0x9')](),interaction[_0xd80e('0x14')](_0xd80e('0x15'),_0xd80e('0x16')),controller[_0xd80e('0x17')]);router['put'](_0xd80e('0xd'),auth[_0xd80e('0x9')](),interaction[_0xd80e('0x14')](_0xd80e('0x15'),_0xd80e('0x18')),controller[_0xd80e('0x19')]);router[_0xd80e('0x1a')](_0xd80e('0xd'),auth['isAuthenticated'](),interaction[_0xd80e('0x14')](_0xd80e('0x15'),_0xd80e('0x1b')),controller[_0xd80e('0x1c')]);router['delete'](_0xd80e('0x1d'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index a32f36d..0ec472b 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 _0x85f8=['moment','exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0x246f67,_0x2868dc){var _0x4dde64=function(_0x356fa0){while(--_0x356fa0){_0x246f67['push'](_0x246f67['shift']());}};_0x4dde64(++_0x2868dc);}(_0x85f8,0xd7));var _0x885f=function(_0x56b439,_0x24782c){_0x56b439=_0x56b439-0x0;var _0x1f11ce=_0x85f8[_0x56b439];return _0x1f11ce;};'use strict';var Sequelize=require(_0x885f('0x0'));var moment=require(_0x885f('0x1'));module[_0x885f('0x2')]={'closed':{'type':Sequelize[_0x885f('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x885f('0x4')]},'disposition':{'type':Sequelize[_0x885f('0x5')]},'secondDisposition':{'type':Sequelize[_0x885f('0x5')]},'thirdDisposition':{'type':Sequelize[_0x885f('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x885f('0x5')]},'read1stAt':{'type':Sequelize[_0x885f('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x885f('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x885f('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x885f('0x6')]('in',_0x885f('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x885f('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x885f('0x8')]}}; \ No newline at end of file +var _0x29b1=['DATE','STRING','ENUM','out','INTEGER','sequelize','moment','exports','BOOLEAN'];(function(_0x5b8fc1,_0x28a8fb){var _0x104e9b=function(_0x4a841d){while(--_0x4a841d){_0x5b8fc1['push'](_0x5b8fc1['shift']());}};_0x104e9b(++_0x28a8fb);}(_0x29b1,0x16d));var _0x129b=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x29b1[_0x1a36a5];return _0x746243;};'use strict';var Sequelize=require(_0x129b('0x0'));var moment=require(_0x129b('0x1'));module[_0x129b('0x2')]={'closed':{'type':Sequelize[_0x129b('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x129b('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x129b('0x5')]},'thirdDisposition':{'type':Sequelize[_0x129b('0x5')]},'note':{'type':Sequelize[_0x129b('0x5')]},'phone':{'type':Sequelize[_0x129b('0x5')]},'read1stAt':{'type':Sequelize[_0x129b('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x129b('0x6')]('in',_0x129b('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x129b('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x129b('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x129b('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 3184a4b..01af5fe 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 _0xf222=['download','toString','server','tmp','join','push','User','CmContact','firstName','lastName','Messages','createdAt','direction','secret','SmsAccount','Account','Owner','fullname','mkdirSync','Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','out','System','Contact','read','renderFile','root','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','stack','name','send','index','map','rawAttributes','type','key','findAll','sms','user','catch','show','params','model','keys','SmsInteraction','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','body','update','describe','addMessage','SmsMessage','ids','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','format','rows','setTags','omit','spread','Tag','color','smsInteractionTags:save','removeTags'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0xf222,0x11e));var _0x2f22=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf222[_0x19e35c];return _0x3e1fe8;};'use strict';var rimraf=require(_0x2f22('0x0'));var zipdir=require(_0x2f22('0x1'));var moment=require(_0x2f22('0x2'));var BPromise=require(_0x2f22('0x3'));var util=require(_0x2f22('0x4'));var path=require(_0x2f22('0x5'));var ejs=require(_0x2f22('0x6'));var fs=require('fs');var _=require(_0x2f22('0x7'));var Redis=require(_0x2f22('0x8'));var interaction=require(_0x2f22('0x9'));var qs=require(_0x2f22('0xa'));var pdf=require(_0x2f22('0xb'));var logger=require(_0x2f22('0xc'))(_0x2f22('0xd'));var config=require(_0x2f22('0xe'));var db=require(_0x2f22('0xf'))['db'];config['redis']=_[_0x2f22('0x10')](config[_0x2f22('0x11')],{'host':_0x2f22('0x12'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2f22('0x11')]));require(_0x2f22('0x13'))[_0x2f22('0x14')](socket);function respondWithStatusCode(_0x4309d9,_0x2ee0a9){_0x2ee0a9=_0x2ee0a9||0xcc;return function(_0x3323b2){if(_0x3323b2){return _0x4309d9[_0x2f22('0x15')](_0x2ee0a9);}return _0x4309d9[_0x2f22('0x16')](_0x2ee0a9)['end']();};}function respondWithResult(_0x5c1a60,_0x28c717){_0x28c717=_0x28c717||0xc8;return function(_0x9d7b45){if(_0x9d7b45){return _0x5c1a60[_0x2f22('0x16')](_0x28c717)[_0x2f22('0x17')](_0x9d7b45);}};}function respondWithFilteredResult(_0x1f0115,_0x17285c){return function(_0xef5c3){if(_0xef5c3){var _0x3e50e9=typeof _0x17285c[_0x2f22('0x18')]===_0x2f22('0x19')&&typeof _0x17285c[_0x2f22('0x1a')]===_0x2f22('0x19');var _0x47ca8e=_0xef5c3[_0x2f22('0x1b')];var _0x2f8425=_0x3e50e9?0x0:_0x17285c['offset'];var _0x3b4f1b=_0x3e50e9?_0xef5c3[_0x2f22('0x1b')]:_0x17285c['offset']+_0x17285c['limit'];var _0x1292df;if(_0x3b4f1b>=_0x47ca8e){_0x3b4f1b=_0x47ca8e;_0x1292df=0xc8;}else{_0x1292df=0xce;}_0x1f0115[_0x2f22('0x16')](_0x1292df);return _0x1f0115[_0x2f22('0x1c')](_0x2f22('0x1d'),_0x2f8425+'-'+_0x3b4f1b+'/'+_0x47ca8e)[_0x2f22('0x17')](_0xef5c3);}return null;};}function saveUpdates(_0x15622d){return function(_0x4dbf13){if(_0x4dbf13){return _0x4dbf13['update'](_0x15622d)[_0x2f22('0x1e')](function(_0x1843f9){return _0x1843f9;});}return null;};}function removeEntity(_0x19877b){return function(_0x1b53a0){if(_0x1b53a0){return _0x1b53a0[_0x2f22('0x1f')]()[_0x2f22('0x1e')](function(){_0x19877b[_0x2f22('0x16')](0xcc)[_0x2f22('0x20')]();});}};}function handleEntityNotFound(_0x267eec){return function(_0x2e3c43){if(!_0x2e3c43){_0x267eec['sendStatus'](0x194);}return _0x2e3c43;};}function handleError(_0x1844de,_0x186abb){_0x186abb=_0x186abb||0x1f4;return function(_0x48bf93){logger['error'](_0x48bf93[_0x2f22('0x21')]);if(_0x48bf93[_0x2f22('0x22')]){delete _0x48bf93[_0x2f22('0x22')];}_0x1844de[_0x2f22('0x16')](_0x186abb)[_0x2f22('0x23')](_0x48bf93);};}exports[_0x2f22('0x24')]=function(_0x113843,_0x471b9c){var _0x34adaa={};var _0x44b094=_[_0x2f22('0x25')](db['SmsInteraction'][_0x2f22('0x26')],function(_0x4fda03){return{'name':_0x4fda03['fieldName'],'type':_0x4fda03[_0x2f22('0x27')][_0x2f22('0x28')]};});_0x34adaa=qs['getOptions'](_0x44b094,_0x113843);return interaction[_0x2f22('0x29')](_0x2f22('0x2a'),_0x113843['query'],_0x113843[_0x2f22('0x2b')],_0x34adaa,_0x44b094)[_0x2f22('0x1e')](respondWithFilteredResult(_0x471b9c,_0x34adaa))[_0x2f22('0x2c')](handleError(_0x471b9c,null));};exports[_0x2f22('0x2d')]=function(_0x16ffc9,_0x502c1c){var _0x326d5b={'raw':![],'where':{'id':_0x16ffc9[_0x2f22('0x2e')]['id']}},_0x3dcaf7={};_0x3dcaf7[_0x2f22('0x2f')]=_[_0x2f22('0x30')](db[_0x2f22('0x31')][_0x2f22('0x26')]);_0x3dcaf7[_0x2f22('0x32')]=_['keys'](_0x16ffc9[_0x2f22('0x32')]);_0x3dcaf7[_0x2f22('0x33')]=_['intersection'](_0x3dcaf7[_0x2f22('0x2f')],_0x3dcaf7['query']);_0x326d5b[_0x2f22('0x34')]=_[_0x2f22('0x35')](_0x3dcaf7[_0x2f22('0x2f')],qs[_0x2f22('0x36')](_0x16ffc9[_0x2f22('0x32')]['fields']));_0x326d5b[_0x2f22('0x34')]=_0x326d5b['attributes'][_0x2f22('0x37')]?_0x326d5b[_0x2f22('0x34')]:_0x3dcaf7['model'];if(_0x16ffc9[_0x2f22('0x32')][_0x2f22('0x38')]){_0x326d5b[_0x2f22('0x39')]=[{'all':!![]}];}_0x326d5b=_[_0x2f22('0x3a')]({},_0x326d5b,_0x16ffc9[_0x2f22('0x3b')]);return db[_0x2f22('0x31')][_0x2f22('0x3c')](_0x326d5b)[_0x2f22('0x1e')](handleEntityNotFound(_0x502c1c,null))['then'](respondWithResult(_0x502c1c,null))[_0x2f22('0x2c')](handleError(_0x502c1c,null));};exports[_0x2f22('0x3d')]=function(_0x747403,_0x4326d3){return db[_0x2f22('0x31')][_0x2f22('0x3d')](_0x747403[_0x2f22('0x3e')],{})[_0x2f22('0x1e')](respondWithResult(_0x4326d3,0xc9))[_0x2f22('0x2c')](handleError(_0x4326d3,null));};exports[_0x2f22('0x3f')]=function(_0x5e4cde,_0x408c14){if(_0x5e4cde['body']['id']){delete _0x5e4cde[_0x2f22('0x3e')]['id'];}return db[_0x2f22('0x31')][_0x2f22('0x3c')]({'where':{'id':_0x5e4cde[_0x2f22('0x2e')]['id']}})['then'](handleEntityNotFound(_0x408c14,null))[_0x2f22('0x1e')](saveUpdates(_0x5e4cde['body'],null))[_0x2f22('0x1e')](respondWithResult(_0x408c14,null))['catch'](handleError(_0x408c14,null));};exports[_0x2f22('0x1f')]=function(_0x287c36,_0x3dadca){return db[_0x2f22('0x31')][_0x2f22('0x3c')]({'where':{'id':_0x287c36[_0x2f22('0x2e')]['id']}})[_0x2f22('0x1e')](handleEntityNotFound(_0x3dadca,null))[_0x2f22('0x1e')](removeEntity(_0x3dadca,null))['catch'](handleError(_0x3dadca,null));};exports[_0x2f22('0x40')]=function(_0x1b330c,_0x47ac1a){return db['SmsInteraction'][_0x2f22('0x40')]()[_0x2f22('0x1e')](respondWithResult(_0x47ac1a,null))['catch'](handleError(_0x47ac1a,null));};exports[_0x2f22('0x41')]=function(_0x41c157,_0x31c0cd){return db[_0x2f22('0x42')]['find']({'where':{'id':_0x41c157['params']['id']}})['then'](handleEntityNotFound(_0x31c0cd,null))[_0x2f22('0x1e')](function(_0x250531){if(_0x250531){return _0x250531[_0x2f22('0x41')](_0x41c157[_0x2f22('0x3e')][_0x2f22('0x43')],_['omit'](_0x41c157['body'],[_0x2f22('0x43'),'id'])||{});}})[_0x2f22('0x1e')](respondWithResult(_0x31c0cd,null))[_0x2f22('0x2c')](handleError(_0x31c0cd,null));};exports['getMessages']=function(_0x24beac,_0x2ad636){var _0x5a8eab={'raw':![],'where':{}};var _0x56585e={};var _0x5d8670={'count':0x0,'rows':[]};return db[_0x2f22('0x31')]['findOne']({'where':{'id':_0x24beac[_0x2f22('0x2e')]['id']}})[_0x2f22('0x1e')](handleEntityNotFound(_0x2ad636,null))['then'](function(_0x12571c){if(_0x12571c){_0x56585e[_0x2f22('0x2f')]=_['keys'](db['SmsMessage'][_0x2f22('0x26')]);_0x56585e[_0x2f22('0x32')]=_[_0x2f22('0x30')](_0x24beac[_0x2f22('0x32')]);_0x56585e[_0x2f22('0x33')]=_[_0x2f22('0x35')](_0x56585e[_0x2f22('0x2f')],_0x56585e['query']);_0x5a8eab[_0x2f22('0x34')]=_[_0x2f22('0x35')](_0x56585e['model'],qs['fields'](_0x24beac['query'][_0x2f22('0x36')]));_0x5a8eab[_0x2f22('0x34')]=_0x5a8eab[_0x2f22('0x34')][_0x2f22('0x37')]?_0x5a8eab['attributes']:_0x56585e[_0x2f22('0x2f')];if(!_0x24beac[_0x2f22('0x32')][_0x2f22('0x44')](_0x2f22('0x45'))){_0x5a8eab['limit']=qs['limit'](_0x24beac['query'][_0x2f22('0x1a')]);_0x5a8eab[_0x2f22('0x18')]=qs[_0x2f22('0x18')](_0x24beac['query'][_0x2f22('0x18')]);}_0x5a8eab[_0x2f22('0x46')]=qs[_0x2f22('0x47')](_0x24beac['query']['sort']);_0x5a8eab[_0x2f22('0x48')]=qs[_0x2f22('0x33')](_[_0x2f22('0x49')](_0x24beac['query'],_0x56585e[_0x2f22('0x33')]));_0x5a8eab[_0x2f22('0x48')]['SmsInteractionId']=_0x12571c['id'];if(_0x24beac[_0x2f22('0x32')][_0x2f22('0x4a')]){_0x5a8eab[_0x2f22('0x48')]=_['merge'](_0x5a8eab['where'],{'$or':_[_0x2f22('0x25')](_0x5a8eab[_0x2f22('0x34')],function(_0x3b86fd){var _0x46bbaf={};_0x46bbaf[_0x3b86fd]={'$like':'%'+_0x24beac[_0x2f22('0x32')]['filter']+'%'};return _0x46bbaf;})});}if(_0x24beac[_0x2f22('0x32')][_0x2f22('0x4b')]){var _0x1cc8d0=_0x24beac[_0x2f22('0x32')][_0x2f22('0x4b')][_0x2f22('0x4c')](',');var _0x535378={};_0x535378[_0x1cc8d0[0x0]]={'$gte':moment(_0x1cc8d0[0x1])[_0x2f22('0x4d')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5a8eab[_0x2f22('0x48')]=_['merge'](_0x5a8eab[_0x2f22('0x48')],_0x535378);}_0x5a8eab=_[_0x2f22('0x3a')]({},_0x5a8eab,_0x24beac[_0x2f22('0x3b')]);return db['SmsMessage'][_0x2f22('0x1b')]({'where':_0x5a8eab['where']})[_0x2f22('0x1e')](function(_0x12bb30){_0x5d8670[_0x2f22('0x1b')]=_0x12bb30;if(_0x24beac[_0x2f22('0x32')][_0x2f22('0x38')]){_0x5a8eab[_0x2f22('0x39')]=[{'all':!![]}];}return db[_0x2f22('0x42')][_0x2f22('0x29')](_0x5a8eab);})[_0x2f22('0x1e')](function(_0x4c57c9){_0x5d8670[_0x2f22('0x4e')]=_0x4c57c9;return _0x5d8670;});}})[_0x2f22('0x1e')](respondWithFilteredResult(_0x2ad636,_0x5a8eab))[_0x2f22('0x2c')](handleError(_0x2ad636,null));};exports['addTags']=function(_0xe06f0,_0x1f8384){return db[_0x2f22('0x31')][_0x2f22('0x3c')]({'where':{'id':_0xe06f0[_0x2f22('0x2e')]['id']}})[_0x2f22('0x1e')](handleEntityNotFound(_0x1f8384,null))['then'](function(_0x22f77f){if(_0x22f77f){return _0x22f77f[_0x2f22('0x4f')](_0xe06f0[_0x2f22('0x3e')][_0x2f22('0x43')],_[_0x2f22('0x50')](_0xe06f0['body'],['ids','id'])||{})[_0x2f22('0x51')](function(){return db[_0x2f22('0x52')]['findAll']({'attributes':['id',_0x2f22('0x22'),_0x2f22('0x53')],'where':{'id':_0xe06f0[_0x2f22('0x3e')]['ids']}});})[_0x2f22('0x1e')](function(_0x500a60){socket['emit'](_0x2f22('0x54'),{'id':Number(_0xe06f0[_0x2f22('0x2e')]['id']),'tags':_0x500a60||[]});return{'id':Number(_0xe06f0[_0x2f22('0x2e')]['id']),'tags':_0x500a60||[]};});}})[_0x2f22('0x1e')](respondWithResult(_0x1f8384,null))[_0x2f22('0x2c')](handleError(_0x1f8384,null));};exports[_0x2f22('0x55')]=function(_0x58cdc9,_0x2c2675){return db[_0x2f22('0x31')]['find']({'where':{'id':_0x58cdc9['params']['id']}})['then'](handleEntityNotFound(_0x2c2675,null))[_0x2f22('0x1e')](function(_0x5e8d0f){if(_0x5e8d0f){return _0x5e8d0f[_0x2f22('0x55')](_0x58cdc9[_0x2f22('0x32')][_0x2f22('0x43')]);}})[_0x2f22('0x1e')](respondWithStatusCode(_0x2c2675,null))['catch'](handleError(_0x2c2675,null));};exports[_0x2f22('0x56')]=function(_0x47c514,_0x4acdd2){var _0x299145=moment()['unix']()[_0x2f22('0x57')]();var _0x40dcbe=path['join'](config['root'],_0x2f22('0x58'),'files',_0x2f22('0x59'));var _0xee418b=path[_0x2f22('0x5a')](_0x40dcbe,_0x299145);var _0x32bff5=util[_0x2f22('0x4d')]('transcript-%d-%s.zip',_0x47c514['params']['id'],_0x299145);var _0x2f6db2=path[_0x2f22('0x5a')](_0x40dcbe,_0x32bff5);var _0xe97be6=[];_0xe97be6[_0x2f22('0x5b')]({'model':db[_0x2f22('0x5c')],'as':_0x2f22('0x5c'),'attributes':['id','fullname'],'raw':!![]});_0xe97be6['push']({'model':db[_0x2f22('0x5d')],'as':'Contact','attributes':['id',_0x2f22('0x5e'),_0x2f22('0x5f')],'raw':!![]});var _0x5aed3c=[{'model':db[_0x2f22('0x42')],'as':_0x2f22('0x60'),'attributes':['id',_0x2f22('0x3e'),_0x2f22('0x61'),_0x2f22('0x62'),_0x2f22('0x63'),'read'],'include':_0xe97be6}];_0x5aed3c[_0x2f22('0x5b')]({'model':db[_0x2f22('0x64')],'as':_0x2f22('0x65'),'attributes':['id',_0x2f22('0x22')]});_0x5aed3c[_0x2f22('0x5b')]({'model':db[_0x2f22('0x5c')],'as':_0x2f22('0x66'),'attributes':['id',_0x2f22('0x67')]});return db['SmsInteraction'][_0x2f22('0x3c')]({'where':{'id':_0x47c514[_0x2f22('0x2e')]['id']},'include':_0x5aed3c})['then'](handleEntityNotFound(_0x4acdd2,null))[_0x2f22('0x1e')](function(_0xb285a2){if(_0xb285a2){var _0x54e7c5=_0xb285a2['get']({'plain':!![]});fs[_0x2f22('0x68')](_0xee418b);var _0x469975={'channel':_0x2f22('0x69'),'account':_0x54e7c5[_0x2f22('0x65')][_0x2f22('0x22')],'agent':_0x54e7c5[_0x2f22('0x66')]?_0x54e7c5[_0x2f22('0x66')]['fullname']:_0x2f22('0x6a'),'createdAt':moment(_0x54e7c5['createdAt'])[_0x2f22('0x4d')](_0x2f22('0x6b'))[_0x2f22('0x57')](),'closedAt':_0x54e7c5[_0x2f22('0x6c')]?moment(_0x54e7c5[_0x2f22('0x6d')])[_0x2f22('0x4d')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2f22('0x57')]():'','disposition':_0x54e7c5[_0x2f22('0x6e')],'messages':_(_0x54e7c5['Messages'])[_0x2f22('0x4a')]({'secret':![]})[_0x2f22('0x25')](function(_0x34d18d){return{'date':moment(_0x34d18d[_0x2f22('0x61')])[_0x2f22('0x4d')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2f22('0x57')](),'sender':_0x34d18d[_0x2f22('0x62')]===_0x2f22('0x6f')?_0x34d18d[_0x2f22('0x5c')]?_0x34d18d['User'][_0x2f22('0x67')]:_0x2f22('0x70'):_0x34d18d[_0x2f22('0x71')][_0x2f22('0x5e')]+(_0x34d18d[_0x2f22('0x71')]['lastName']?'\x20'+_0x34d18d['Contact'][_0x2f22('0x5f')]:''),'body':_0x34d18d[_0x2f22('0x3e')],'direction':_0x34d18d[_0x2f22('0x62')]===_0x2f22('0x6f')?'A':'C','secret':_0x34d18d[_0x2f22('0x63')],'read':_0x34d18d[_0x2f22('0x72')]};})['value']()};return ejs[_0x2f22('0x73')](path[_0x2f22('0x5a')](config[_0x2f22('0x74')],_0x2f22('0x58'),_0x2f22('0x75'),_0x2f22('0x76')),{'interaction':_0x469975})[_0x2f22('0x1e')](function(_0x18c23a){var _0x345dfa=path['join'](_0xee418b,_0x2f22('0x77')+_0x54e7c5['id']+'-'+_0x299145+_0x2f22('0x78'));var _0x4a6dfc={'path':_0x345dfa,'channel':_0x2f22('0x69'),'interactionId':_0x54e7c5['id']};return pdf[_0x2f22('0x79')](_0x18c23a,_0x4a6dfc);})['then'](function(){return new BPromise(function(_0x4dfa4c,_0x30321c){zipdir(_0xee418b,{'saveTo':_0x2f6db2},function(_0x4b96ac,_0x1591d6){if(_0x4b96ac)return _0x30321c(_0x4b96ac);return _0x4dfa4c(_0x1591d6);});})[_0x2f22('0x1e')](function(){return new BPromise(function(_0x35c6f7,_0x3269f6){rimraf(_0xee418b,function(_0x13beed){if(_0x13beed)_0x3269f6(_0x13beed);return _0x35c6f7();});});})[_0x2f22('0x1e')](function(){return _0x4acdd2[_0x2f22('0x56')](_0x2f6db2,_0x32bff5,function(_0x1af83c){if(_0x1af83c){console[_0x2f22('0x7a')](_0x2f22('0x7b'),_0x1af83c);}else{fs['unlinkSync'](_0x2f6db2);}});});});}else{return _0x4acdd2['sendStatus'](0xc8);}})[_0x2f22('0x2c')](handleError(_0x4acdd2,null));}; \ No newline at end of file +var _0xd32c=['toString','root','server','join','transcript-%d-%s.zip','push','User','Contact','firstName','Messages','direction','secret','read','Account','fullname','Sms','Owner','N.A.','format','closed','closedAt','disposition','createdAt','out','lastName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','then','name','send','SmsInteraction','rawAttributes','fieldName','key','getOptions','findAll','sms','query','user','catch','show','params','keys','filters','model','fields','length','attributes','includeAll','merge','options','find','create','body','update','destroy','describe','addMessage','SmsMessage','omit','findOne','intersection','hasOwnProperty','order','sort','where','pick','SmsInteractionId','filter','map','split','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','setTags','ids','spread','Tag','emit','removeTags','download','unix'];(function(_0x29a501,_0x401841){var _0x25e28=function(_0x20b1fe){while(--_0x20b1fe){_0x29a501['push'](_0x29a501['shift']());}};_0x25e28(++_0x401841);}(_0xd32c,0x113));var _0xcd32=function(_0xff780c,_0x3c94eb){_0xff780c=_0xff780c-0x0;var _0x1f0861=_0xd32c[_0xff780c];return _0x1f0861;};'use strict';var rimraf=require(_0xcd32('0x0'));var zipdir=require(_0xcd32('0x1'));var moment=require(_0xcd32('0x2'));var BPromise=require(_0xcd32('0x3'));var util=require(_0xcd32('0x4'));var path=require(_0xcd32('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcd32('0x6'));var Redis=require(_0xcd32('0x7'));var interaction=require(_0xcd32('0x8'));var qs=require(_0xcd32('0x9'));var pdf=require(_0xcd32('0xa'));var logger=require(_0xcd32('0xb'))('api');var config=require(_0xcd32('0xc'));var db=require(_0xcd32('0xd'))['db'];config[_0xcd32('0xe')]=_[_0xcd32('0xf')](config[_0xcd32('0xe')],{'host':_0xcd32('0x10'),'port':0x18eb});var socket=require(_0xcd32('0x11'))(new Redis(config[_0xcd32('0xe')]));require(_0xcd32('0x12'))[_0xcd32('0x13')](socket);function respondWithStatusCode(_0x1a42e1,_0x654d14){_0x654d14=_0x654d14||0xcc;return function(_0xdad47e){if(_0xdad47e){return _0x1a42e1[_0xcd32('0x14')](_0x654d14);}return _0x1a42e1[_0xcd32('0x15')](_0x654d14)[_0xcd32('0x16')]();};}function respondWithResult(_0x1e7c6d,_0x562294){_0x562294=_0x562294||0xc8;return function(_0x38fc91){if(_0x38fc91){return _0x1e7c6d[_0xcd32('0x15')](_0x562294)['json'](_0x38fc91);}};}function respondWithFilteredResult(_0xa788a7,_0x19f4b3){return function(_0x4155ad){if(_0x4155ad){var _0x5d8971=typeof _0x19f4b3['offset']===_0xcd32('0x17')&&typeof _0x19f4b3['limit']===_0xcd32('0x17');var _0x5743fd=_0x4155ad[_0xcd32('0x18')];var _0x291916=_0x5d8971?0x0:_0x19f4b3[_0xcd32('0x19')];var _0x1aa31f=_0x5d8971?_0x4155ad[_0xcd32('0x18')]:_0x19f4b3[_0xcd32('0x19')]+_0x19f4b3[_0xcd32('0x1a')];var _0xca5ba8;if(_0x1aa31f>=_0x5743fd){_0x1aa31f=_0x5743fd;_0xca5ba8=0xc8;}else{_0xca5ba8=0xce;}_0xa788a7[_0xcd32('0x15')](_0xca5ba8);return _0xa788a7['set'](_0xcd32('0x1b'),_0x291916+'-'+_0x1aa31f+'/'+_0x5743fd)[_0xcd32('0x1c')](_0x4155ad);}return null;};}function saveUpdates(_0x3ccd08){return function(_0x246d3e){if(_0x246d3e){return _0x246d3e['update'](_0x3ccd08)[_0xcd32('0x1d')](function(_0x271de1){return _0x271de1;});}return null;};}function removeEntity(_0x3965f2){return function(_0x2c0fce){if(_0x2c0fce){return _0x2c0fce['destroy']()[_0xcd32('0x1d')](function(){_0x3965f2[_0xcd32('0x15')](0xcc)[_0xcd32('0x16')]();});}};}function handleEntityNotFound(_0x40cb3b){return function(_0x414fdb){if(!_0x414fdb){_0x40cb3b['sendStatus'](0x194);}return _0x414fdb;};}function handleError(_0x510c6d,_0x410bd8){_0x410bd8=_0x410bd8||0x1f4;return function(_0xb11949){logger['error'](_0xb11949['stack']);if(_0xb11949[_0xcd32('0x1e')]){delete _0xb11949[_0xcd32('0x1e')];}_0x510c6d['status'](_0x410bd8)[_0xcd32('0x1f')](_0xb11949);};}exports['index']=function(_0x45efdb,_0x492989){var _0x41dcb5={};var _0x4bfc16=_['map'](db[_0xcd32('0x20')][_0xcd32('0x21')],function(_0x5032d9){return{'name':_0x5032d9[_0xcd32('0x22')],'type':_0x5032d9['type'][_0xcd32('0x23')]};});_0x41dcb5=qs[_0xcd32('0x24')](_0x4bfc16,_0x45efdb);return interaction[_0xcd32('0x25')](_0xcd32('0x26'),_0x45efdb[_0xcd32('0x27')],_0x45efdb[_0xcd32('0x28')],_0x41dcb5,_0x4bfc16)[_0xcd32('0x1d')](respondWithFilteredResult(_0x492989,_0x41dcb5))[_0xcd32('0x29')](handleError(_0x492989,null));};exports[_0xcd32('0x2a')]=function(_0x283076,_0x54b541){var _0x4b8658={'raw':![],'where':{'id':_0x283076[_0xcd32('0x2b')]['id']}},_0x50b1d0={};_0x50b1d0['model']=_[_0xcd32('0x2c')](db['SmsInteraction'][_0xcd32('0x21')]);_0x50b1d0[_0xcd32('0x27')]=_[_0xcd32('0x2c')](_0x283076[_0xcd32('0x27')]);_0x50b1d0[_0xcd32('0x2d')]=_['intersection'](_0x50b1d0['model'],_0x50b1d0[_0xcd32('0x27')]);_0x4b8658['attributes']=_['intersection'](_0x50b1d0[_0xcd32('0x2e')],qs[_0xcd32('0x2f')](_0x283076[_0xcd32('0x27')][_0xcd32('0x2f')]));_0x4b8658['attributes']=_0x4b8658['attributes'][_0xcd32('0x30')]?_0x4b8658[_0xcd32('0x31')]:_0x50b1d0['model'];if(_0x283076['query'][_0xcd32('0x32')]){_0x4b8658['include']=[{'all':!![]}];}_0x4b8658=_[_0xcd32('0x33')]({},_0x4b8658,_0x283076[_0xcd32('0x34')]);return db[_0xcd32('0x20')][_0xcd32('0x35')](_0x4b8658)['then'](handleEntityNotFound(_0x54b541,null))[_0xcd32('0x1d')](respondWithResult(_0x54b541,null))['catch'](handleError(_0x54b541,null));};exports[_0xcd32('0x36')]=function(_0x5e3dcc,_0x4539ed){return db[_0xcd32('0x20')][_0xcd32('0x36')](_0x5e3dcc[_0xcd32('0x37')],{})[_0xcd32('0x1d')](respondWithResult(_0x4539ed,0xc9))[_0xcd32('0x29')](handleError(_0x4539ed,null));};exports[_0xcd32('0x38')]=function(_0x593ba1,_0x104fb4){if(_0x593ba1[_0xcd32('0x37')]['id']){delete _0x593ba1['body']['id'];}return db[_0xcd32('0x20')][_0xcd32('0x35')]({'where':{'id':_0x593ba1[_0xcd32('0x2b')]['id']}})[_0xcd32('0x1d')](handleEntityNotFound(_0x104fb4,null))[_0xcd32('0x1d')](saveUpdates(_0x593ba1[_0xcd32('0x37')],null))[_0xcd32('0x1d')](respondWithResult(_0x104fb4,null))[_0xcd32('0x29')](handleError(_0x104fb4,null));};exports[_0xcd32('0x39')]=function(_0x48b974,_0x48e5ec){return db[_0xcd32('0x20')][_0xcd32('0x35')]({'where':{'id':_0x48b974[_0xcd32('0x2b')]['id']}})[_0xcd32('0x1d')](handleEntityNotFound(_0x48e5ec,null))[_0xcd32('0x1d')](removeEntity(_0x48e5ec,null))[_0xcd32('0x29')](handleError(_0x48e5ec,null));};exports[_0xcd32('0x3a')]=function(_0x59f8d6,_0x3f0ea2){return db[_0xcd32('0x20')][_0xcd32('0x3a')]()[_0xcd32('0x1d')](respondWithResult(_0x3f0ea2,null))[_0xcd32('0x29')](handleError(_0x3f0ea2,null));};exports[_0xcd32('0x3b')]=function(_0x337d16,_0x501790){return db[_0xcd32('0x3c')][_0xcd32('0x35')]({'where':{'id':_0x337d16['params']['id']}})['then'](handleEntityNotFound(_0x501790,null))[_0xcd32('0x1d')](function(_0x17d094){if(_0x17d094){return _0x17d094[_0xcd32('0x3b')](_0x337d16[_0xcd32('0x37')]['ids'],_[_0xcd32('0x3d')](_0x337d16[_0xcd32('0x37')],['ids','id'])||{});}})['then'](respondWithResult(_0x501790,null))['catch'](handleError(_0x501790,null));};exports['getMessages']=function(_0x226110,_0x54065e){var _0x433ca3={'raw':![],'where':{}};var _0x520a95={};var _0x47aab8={'count':0x0,'rows':[]};return db[_0xcd32('0x20')][_0xcd32('0x3e')]({'where':{'id':_0x226110[_0xcd32('0x2b')]['id']}})['then'](handleEntityNotFound(_0x54065e,null))[_0xcd32('0x1d')](function(_0x253731){if(_0x253731){_0x520a95[_0xcd32('0x2e')]=_[_0xcd32('0x2c')](db['SmsMessage']['rawAttributes']);_0x520a95[_0xcd32('0x27')]=_[_0xcd32('0x2c')](_0x226110[_0xcd32('0x27')]);_0x520a95[_0xcd32('0x2d')]=_[_0xcd32('0x3f')](_0x520a95[_0xcd32('0x2e')],_0x520a95['query']);_0x433ca3[_0xcd32('0x31')]=_[_0xcd32('0x3f')](_0x520a95[_0xcd32('0x2e')],qs[_0xcd32('0x2f')](_0x226110['query']['fields']));_0x433ca3[_0xcd32('0x31')]=_0x433ca3[_0xcd32('0x31')][_0xcd32('0x30')]?_0x433ca3['attributes']:_0x520a95[_0xcd32('0x2e')];if(!_0x226110[_0xcd32('0x27')][_0xcd32('0x40')]('nolimit')){_0x433ca3[_0xcd32('0x1a')]=qs['limit'](_0x226110[_0xcd32('0x27')]['limit']);_0x433ca3[_0xcd32('0x19')]=qs['offset'](_0x226110[_0xcd32('0x27')][_0xcd32('0x19')]);}_0x433ca3[_0xcd32('0x41')]=qs[_0xcd32('0x42')](_0x226110['query']['sort']);_0x433ca3[_0xcd32('0x43')]=qs[_0xcd32('0x2d')](_[_0xcd32('0x44')](_0x226110['query'],_0x520a95[_0xcd32('0x2d')]));_0x433ca3['where'][_0xcd32('0x45')]=_0x253731['id'];if(_0x226110[_0xcd32('0x27')][_0xcd32('0x46')]){_0x433ca3[_0xcd32('0x43')]=_['merge'](_0x433ca3['where'],{'$or':_[_0xcd32('0x47')](_0x433ca3['attributes'],function(_0x2c9416){var _0x225816={};_0x225816[_0x2c9416]={'$like':'%'+_0x226110[_0xcd32('0x27')][_0xcd32('0x46')]+'%'};return _0x225816;})});}if(_0x226110[_0xcd32('0x27')]['$gte']){var _0x8bc25f=_0x226110[_0xcd32('0x27')]['$gte'][_0xcd32('0x48')](',');var _0x2874ec={};_0x2874ec[_0x8bc25f[0x0]]={'$gte':moment(_0x8bc25f[0x1])['format'](_0xcd32('0x49'))};_0x433ca3[_0xcd32('0x43')]=_[_0xcd32('0x33')](_0x433ca3[_0xcd32('0x43')],_0x2874ec);}_0x433ca3=_[_0xcd32('0x33')]({},_0x433ca3,_0x226110[_0xcd32('0x34')]);return db[_0xcd32('0x3c')][_0xcd32('0x18')]({'where':_0x433ca3[_0xcd32('0x43')]})['then'](function(_0x350545){_0x47aab8['count']=_0x350545;if(_0x226110[_0xcd32('0x27')][_0xcd32('0x32')]){_0x433ca3[_0xcd32('0x4a')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x433ca3);})[_0xcd32('0x1d')](function(_0x5c065c){_0x47aab8[_0xcd32('0x4b')]=_0x5c065c;return _0x47aab8;});}})[_0xcd32('0x1d')](respondWithFilteredResult(_0x54065e,_0x433ca3))[_0xcd32('0x29')](handleError(_0x54065e,null));};exports[_0xcd32('0x4c')]=function(_0x44eb00,_0x35085b){return db[_0xcd32('0x20')]['find']({'where':{'id':_0x44eb00[_0xcd32('0x2b')]['id']}})[_0xcd32('0x1d')](handleEntityNotFound(_0x35085b,null))['then'](function(_0x1046b0){if(_0x1046b0){return _0x1046b0[_0xcd32('0x4d')](_0x44eb00[_0xcd32('0x37')][_0xcd32('0x4e')],_[_0xcd32('0x3d')](_0x44eb00[_0xcd32('0x37')],[_0xcd32('0x4e'),'id'])||{})[_0xcd32('0x4f')](function(){return db[_0xcd32('0x50')][_0xcd32('0x25')]({'attributes':['id',_0xcd32('0x1e'),'color'],'where':{'id':_0x44eb00[_0xcd32('0x37')][_0xcd32('0x4e')]}});})[_0xcd32('0x1d')](function(_0x114158){socket[_0xcd32('0x51')]('smsInteractionTags:save',{'id':Number(_0x44eb00[_0xcd32('0x2b')]['id']),'tags':_0x114158||[]});return{'id':Number(_0x44eb00[_0xcd32('0x2b')]['id']),'tags':_0x114158||[]};});}})['then'](respondWithResult(_0x35085b,null))[_0xcd32('0x29')](handleError(_0x35085b,null));};exports['removeTags']=function(_0x405f04,_0x5c65b4){return db['SmsInteraction'][_0xcd32('0x35')]({'where':{'id':_0x405f04['params']['id']}})['then'](handleEntityNotFound(_0x5c65b4,null))[_0xcd32('0x1d')](function(_0x17e971){if(_0x17e971){return _0x17e971[_0xcd32('0x52')](_0x405f04[_0xcd32('0x27')][_0xcd32('0x4e')]);}})[_0xcd32('0x1d')](respondWithStatusCode(_0x5c65b4,null))[_0xcd32('0x29')](handleError(_0x5c65b4,null));};exports[_0xcd32('0x53')]=function(_0x52b600,_0x3a41fa){var _0x49aff6=moment()[_0xcd32('0x54')]()[_0xcd32('0x55')]();var _0x155616=path['join'](config[_0xcd32('0x56')],_0xcd32('0x57'),'files','tmp');var _0x5d8a06=path[_0xcd32('0x58')](_0x155616,_0x49aff6);var _0x316916=util['format'](_0xcd32('0x59'),_0x52b600['params']['id'],_0x49aff6);var _0x4274e0=path[_0xcd32('0x58')](_0x155616,_0x316916);var _0x1db7bc=[];_0x1db7bc[_0xcd32('0x5a')]({'model':db['User'],'as':_0xcd32('0x5b'),'attributes':['id','fullname'],'raw':!![]});_0x1db7bc[_0xcd32('0x5a')]({'model':db['CmContact'],'as':_0xcd32('0x5c'),'attributes':['id',_0xcd32('0x5d'),'lastName'],'raw':!![]});var _0xbbe9fd=[{'model':db[_0xcd32('0x3c')],'as':_0xcd32('0x5e'),'attributes':['id',_0xcd32('0x37'),'createdAt',_0xcd32('0x5f'),_0xcd32('0x60'),_0xcd32('0x61')],'include':_0x1db7bc}];_0xbbe9fd['push']({'model':db['SmsAccount'],'as':_0xcd32('0x62'),'attributes':['id',_0xcd32('0x1e')]});_0xbbe9fd['push']({'model':db[_0xcd32('0x5b')],'as':'Owner','attributes':['id',_0xcd32('0x63')]});return db[_0xcd32('0x20')]['find']({'where':{'id':_0x52b600[_0xcd32('0x2b')]['id']},'include':_0xbbe9fd})[_0xcd32('0x1d')](handleEntityNotFound(_0x3a41fa,null))[_0xcd32('0x1d')](function(_0x203e4a){if(_0x203e4a){var _0x37ac51=_0x203e4a['get']({'plain':!![]});fs['mkdirSync'](_0x5d8a06);var _0x173ad8={'channel':_0xcd32('0x64'),'account':_0x37ac51[_0xcd32('0x62')]['name'],'agent':_0x37ac51[_0xcd32('0x65')]?_0x37ac51[_0xcd32('0x65')][_0xcd32('0x63')]:_0xcd32('0x66'),'createdAt':moment(_0x37ac51['createdAt'])[_0xcd32('0x67')](_0xcd32('0x49'))[_0xcd32('0x55')](),'closedAt':_0x37ac51[_0xcd32('0x68')]?moment(_0x37ac51[_0xcd32('0x69')])[_0xcd32('0x67')](_0xcd32('0x49'))['toString']():'','disposition':_0x37ac51[_0xcd32('0x6a')],'messages':_(_0x37ac51[_0xcd32('0x5e')])[_0xcd32('0x46')]({'secret':![]})[_0xcd32('0x47')](function(_0x3203c9){return{'date':moment(_0x3203c9[_0xcd32('0x6b')])[_0xcd32('0x67')]('YYYY-MM-DD\x20HH:mm:ss')[_0xcd32('0x55')](),'sender':_0x3203c9[_0xcd32('0x5f')]===_0xcd32('0x6c')?_0x3203c9[_0xcd32('0x5b')]?_0x3203c9['User'][_0xcd32('0x63')]:'System':_0x3203c9['Contact']['firstName']+(_0x3203c9['Contact']['lastName']?'\x20'+_0x3203c9['Contact'][_0xcd32('0x6d')]:''),'body':_0x3203c9['body'],'direction':_0x3203c9['direction']===_0xcd32('0x6c')?'A':'C','secret':_0x3203c9[_0xcd32('0x60')],'read':_0x3203c9[_0xcd32('0x61')]};})[_0xcd32('0x6e')]()};return ejs[_0xcd32('0x6f')](path[_0xcd32('0x58')](config[_0xcd32('0x56')],_0xcd32('0x57'),_0xcd32('0x70'),_0xcd32('0x71')),{'interaction':_0x173ad8})[_0xcd32('0x1d')](function(_0xb48328){var _0x3197ef=path[_0xcd32('0x58')](_0x5d8a06,_0xcd32('0x72')+_0x37ac51['id']+'-'+_0x49aff6+_0xcd32('0x73'));var _0x30d6b2={'path':_0x3197ef,'channel':'Sms','interactionId':_0x37ac51['id']};return pdf[_0xcd32('0x74')](_0xb48328,_0x30d6b2);})['then'](function(){return new BPromise(function(_0x161f41,_0x346302){zipdir(_0x5d8a06,{'saveTo':_0x4274e0},function(_0x5cfa5a,_0x24da09){if(_0x5cfa5a)return _0x346302(_0x5cfa5a);return _0x161f41(_0x24da09);});})[_0xcd32('0x1d')](function(){return new BPromise(function(_0x5d2c0a,_0x5f084c){rimraf(_0x5d8a06,function(_0xd7e206){if(_0xd7e206)_0x5f084c(_0xd7e206);return _0x5d2c0a();});});})[_0xcd32('0x1d')](function(){return _0x3a41fa[_0xcd32('0x53')](_0x4274e0,_0x316916,function(_0x5859cc){if(_0x5859cc){console[_0xcd32('0x75')](_0xcd32('0x76'),_0x5859cc);}else{fs[_0xcd32('0x77')](_0x4274e0);}});});});}else{return _0x3a41fa['sendStatus'](0xc8);}})[_0xcd32('0x29')](handleError(_0x3a41fa,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 59a6716..3cb9f7a 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 _0x236c=['length','emit','catch','hasOwnProperty','exports','events','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','remove','getUsers','setDataValue','findAll','unreadMessages'];(function(_0x44299c,_0x4c5141){var _0x5db8ce=function(_0x21d6ba){while(--_0x21d6ba){_0x44299c['push'](_0x44299c['shift']());}};_0x5db8ce(++_0x4c5141);}(_0x236c,0x155));var _0xc236=function(_0x1c84cd,_0x47e634){_0x1c84cd=_0x1c84cd-0x0;var _0x4e2b23=_0x236c[_0x1c84cd];return _0x4e2b23;};'use strict';var EventEmitter=require(_0xc236('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xc236('0x1')];var SmsMessage=require(_0xc236('0x2'))['db'][_0xc236('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc236('0x4')](0x0);var events={'afterCreate':_0xc236('0x5'),'afterUpdate':'update','afterDestroy':_0xc236('0x6')};function emitEvent(_0x36e87d){return function(_0x33bc57,_0xd582f6,_0x23d3cc){_0x33bc57[_0xc236('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0xd612c6){_0x33bc57[_0xc236('0x8')]('Users',_0xd612c6['map'](function(_0x5cdee5){return{'id':_0x5cdee5['id']};}));return SmsMessage[_0xc236('0x9')]({'where':{'SmsInteractionId':_0x33bc57['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x30a28d){_0x33bc57[_0xc236('0x8')](_0xc236('0xa'),_0x30a28d[_0xc236('0xb')]);SmsInteractionEvents[_0xc236('0xc')](_0x36e87d+':'+_0x33bc57['id'],_0x33bc57);SmsInteractionEvents['emit'](_0x36e87d,_0x33bc57);_0x23d3cc(null);})[_0xc236('0xd')](_0x23d3cc(null));};}for(var e in events){if(events[_0xc236('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xc236('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x5204=['hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0xf32a89,_0x42755e){var _0x3952d7=function(_0x46470b){while(--_0x46470b){_0xf32a89['push'](_0xf32a89['shift']());}};_0x3952d7(++_0x42755e);}(_0x5204,0xdf));var _0x4520=function(_0x12e3e3,_0x501eaf){_0x12e3e3=_0x12e3e3-0x0;var _0x26602e=_0x5204[_0x12e3e3];return _0x26602e;};'use strict';var EventEmitter=require(_0x4520('0x0'));var SmsInteraction=require(_0x4520('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x4520('0x1'))['db'][_0x4520('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4520('0x3')](0x0);var events={'afterCreate':_0x4520('0x4'),'afterUpdate':_0x4520('0x5'),'afterDestroy':'remove'};function emitEvent(_0x41d89c){return function(_0x58b8a8,_0x180174,_0x209381){_0x58b8a8[_0x4520('0x6')]({'attributes':['id'],'raw':!![]})[_0x4520('0x7')](function(_0x396d29){_0x58b8a8[_0x4520('0x8')](_0x4520('0x9'),_0x396d29['map'](function(_0x297f0a){return{'id':_0x297f0a['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x58b8a8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4520('0x7')](function(_0x37a617){_0x58b8a8[_0x4520('0x8')](_0x4520('0xa'),_0x37a617[_0x4520('0xb')]);SmsInteractionEvents[_0x4520('0xc')](_0x41d89c+':'+_0x58b8a8['id'],_0x58b8a8);SmsInteractionEvents[_0x4520('0xc')](_0x41d89c,_0x58b8a8);_0x209381(null);})[_0x4520('0xd')](_0x209381(null));};}for(var e in events){if(events[_0x4520('0xe')](e)){var event=events[e];SmsInteraction[_0x4520('0xf')](e,emitEvent(event));}}module[_0x4520('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index bb111a2..759ab79 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 _0xa6da=['../../config/logger','api','path','rimraf','./smsInteraction.attributes','define','SmsInteraction','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x229af4,_0x535b69){var _0x1e8da4=function(_0x16c9a8){while(--_0x16c9a8){_0x229af4['push'](_0x229af4['shift']());}};_0x1e8da4(++_0x535b69);}(_0xa6da,0x82));var _0xaa6d=function(_0x5d0ae1,_0x1315fd){_0x5d0ae1=_0x5d0ae1-0x0;var _0x38c98d=_0xa6da[_0x5d0ae1];return _0x38c98d;};'use strict';var _=require(_0xaa6d('0x0'));var util=require(_0xaa6d('0x1'));var logger=require(_0xaa6d('0x2'))(_0xaa6d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa6d('0x4'));var rimraf=require(_0xaa6d('0x5'));var config=require('../../config/environment');var attributes=require(_0xaa6d('0x6'));module['exports']=function(_0x1d1b5b,_0x4cb6dc){return _0x1d1b5b[_0xaa6d('0x7')](_0xaa6d('0x8'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4aaa30,_0x5c51b8,_0x58fbe9){if(_0x4aaa30[_0xaa6d('0x9')]('closed')){_0x4aaa30['closedAt']=moment()[_0xaa6d('0xa')](_0xaa6d('0xb'));}_0x58fbe9(null,_0x4aaa30);}}});}; \ No newline at end of file +var _0x7e85=['../../config/logger','api','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x7e85,0xf6));var _0x57e8=function(_0x7cf8eb,_0x5a470e){_0x7cf8eb=_0x7cf8eb-0x0;var _0x24e417=_0x7e85[_0x7cf8eb];return _0x24e417;};'use strict';var _=require('lodash');var util=require(_0x57e8('0x0'));var logger=require(_0x57e8('0x1'))(_0x57e8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x57e8('0x3'));var rimraf=require(_0x57e8('0x4'));var config=require(_0x57e8('0x5'));var attributes=require(_0x57e8('0x6'));module[_0x57e8('0x7')]=function(_0x37fb95,_0x2bf9c7){return _0x37fb95['define'](_0x57e8('0x8'),attributes,{'tableName':_0x57e8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe12bbe,_0x694e0a,_0x430e11){if(_0xe12bbe['changed']('closed')){_0xe12bbe[_0x57e8('0xa')]=moment()[_0x57e8('0xb')](_0x57e8('0xc'));}_0x430e11(null,_0xe12bbe);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index dee1c0b..9e64fa9 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 _0x326c=['limit','AddTagsToSmsInteraction','SmsInteraction','find','addTags','ids','omit','AddTags','lodash','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateSmsInteraction','update','body','options','where','attributes'];(function(_0x3b884e,_0x24b6e6){var _0x181128=function(_0x296d65){while(--_0x296d65){_0x3b884e['push'](_0x3b884e['shift']());}};_0x181128(++_0x24b6e6);}(_0x326c,0x1d0));var _0xc326=function(_0x368e81,_0x389804){_0x368e81=_0x368e81-0x0;var _0x3930e8=_0x326c[_0x368e81];return _0x3930e8;};'use strict';var _=require(_0xc326('0x0'));var util=require(_0xc326('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc326('0x2'));var logger=require(_0xc326('0x3'))(_0xc326('0x4'));var config=require(_0xc326('0x5'));var jayson=require(_0xc326('0x6'));var client=jayson['client'][_0xc326('0x7')]({'port':0x232a});config[_0xc326('0x8')]=_[_0xc326('0x9')](config['redis'],{'host':_0xc326('0xa'),'port':0x18eb});var socket=require(_0xc326('0xb'))(new Redis(config[_0xc326('0x8')]));require('./smsInteraction.socket')[_0xc326('0xc')](socket);function respondWithRpcPromise(_0x49e399,_0x559fa1,_0x31dd74){return new BPromise(function(_0x283a56,_0x189c85){return client['request'](_0x49e399,_0x31dd74)[_0xc326('0xd')](function(_0x3a54a5){logger[_0xc326('0xe')](_0xc326('0xf'),_0x559fa1,_0xc326('0x10'));logger[_0xc326('0x11')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x559fa1,_0xc326('0x10'),JSON[_0xc326('0x12')](_0x3a54a5));if(_0x3a54a5[_0xc326('0x13')]){if(_0x3a54a5[_0xc326('0x13')][_0xc326('0x14')]===0x1f4){logger['error'](_0xc326('0xf'),_0x559fa1,_0x3a54a5[_0xc326('0x13')]['message']);return _0x189c85(_0x3a54a5[_0xc326('0x13')]['message']);}logger[_0xc326('0x13')](_0xc326('0xf'),_0x559fa1,_0x3a54a5[_0xc326('0x13')][_0xc326('0x15')]);return _0x283a56(_0x3a54a5['error'][_0xc326('0x15')]);}else{logger[_0xc326('0xe')]('SmsInteraction,\x20%s,\x20%s',_0x559fa1,_0xc326('0x10'));_0x283a56(_0x3a54a5[_0xc326('0x16')][_0xc326('0x15')]);}})[_0xc326('0x17')](function(_0x59c1fc){logger['error'](_0xc326('0xf'),_0x559fa1,_0x59c1fc);_0x189c85(_0x59c1fc);});});}exports[_0xc326('0x18')]=function(_0x5571c1){var _0x4de740=this;return new Promise(function(_0x44395e,_0x4ad6c9){return db['SmsInteraction'][_0xc326('0x19')](_0x5571c1[_0xc326('0x1a')],{'raw':_0x5571c1['options']?_0x5571c1[_0xc326('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5571c1['options']?_0x5571c1['options'][_0xc326('0x1c')]||null:null,'attributes':_0x5571c1[_0xc326('0x1b')]?_0x5571c1['options'][_0xc326('0x1d')]||null:null,'limit':_0x5571c1[_0xc326('0x1b')]?_0x5571c1[_0xc326('0x1b')][_0xc326('0x1e')]||null:null})[_0xc326('0xd')](function(_0x5793f6){logger[_0xc326('0xe')]('UpdateSmsInteraction',_0x5571c1);logger['debug'](_0xc326('0x18'),_0x5571c1,JSON[_0xc326('0x12')](_0x5793f6));_0x44395e(_0x5793f6);})[_0xc326('0x17')](function(_0x36776c){logger['error']('UpdateSmsInteraction',_0x36776c[_0xc326('0x15')],_0x5571c1);_0x4ad6c9(_0x4de740[_0xc326('0x13')](0x1f4,_0x36776c[_0xc326('0x15')]));});});};exports[_0xc326('0x1f')]=function(_0x2c2e07){return new Promise(function(_0x293826,_0xb4359e){return db[_0xc326('0x20')][_0xc326('0x21')]({'where':_0x2c2e07[_0xc326('0x1b')]?_0x2c2e07[_0xc326('0x1b')][_0xc326('0x1c')]||null:null})[_0xc326('0xd')](function(_0x1046e2){if(_0x1046e2){return _0x1046e2[_0xc326('0x22')](_0x2c2e07['body'][_0xc326('0x23')],_[_0xc326('0x24')](_0x2c2e07[_0xc326('0x1a')],[_0xc326('0x23'),'id'])||{});}})['spread'](function(_0x1b18aa){logger[_0xc326('0xe')](_0xc326('0x25'),_0x2c2e07);logger[_0xc326('0x11')](_0xc326('0x25'),_0x2c2e07,JSON[_0xc326('0x12')](_0x1b18aa));_0x293826(_0x1b18aa);})['catch'](function(_0x220278){logger[_0xc326('0x13')](_0xc326('0x25'),_0x220278[_0xc326('0x15')],_0x2c2e07);_0xb4359e(_this[_0xc326('0x13')](0x1f4,_0x220278['message']));});});}; \ No newline at end of file +var _0x9696=['error','code','message','result','SmsInteraction','update','body','options','raw','where','attributes','then','UpdateSmsInteraction','catch','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./smsInteraction.socket','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x370d9e,_0x5f3312){var _0x4427c5=function(_0x357fab){while(--_0x357fab){_0x370d9e['push'](_0x370d9e['shift']());}};_0x4427c5(++_0x5f3312);}(_0x9696,0x10b));var _0x6969=function(_0x1526e2,_0x1289a6){_0x1526e2=_0x1526e2-0x0;var _0x4709e7=_0x9696[_0x1526e2];return _0x4709e7;};'use strict';var _=require(_0x6969('0x0'));var util=require('util');var moment=require(_0x6969('0x1'));var BPromise=require(_0x6969('0x2'));var rs=require(_0x6969('0x3'));var fs=require('fs');var Redis=require(_0x6969('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6969('0x5'));var logger=require('../../config/logger')(_0x6969('0x6'));var config=require(_0x6969('0x7'));var jayson=require(_0x6969('0x8'));var client=jayson[_0x6969('0x9')]['http']({'port':0x232a});config[_0x6969('0xa')]=_['defaults'](config[_0x6969('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6969('0xb'))(new Redis(config[_0x6969('0xa')]));require(_0x6969('0xc'))['register'](socket);function respondWithRpcPromise(_0x3c6e60,_0x4910e6,_0x24b1e6){return new BPromise(function(_0xcb3f22,_0x4c6611){return client[_0x6969('0xd')](_0x3c6e60,_0x24b1e6)['then'](function(_0x2fd8d1){logger[_0x6969('0xe')](_0x6969('0xf'),_0x4910e6,_0x6969('0x10'));logger[_0x6969('0x11')](_0x6969('0x12'),_0x4910e6,_0x6969('0x10'),JSON[_0x6969('0x13')](_0x2fd8d1));if(_0x2fd8d1[_0x6969('0x14')]){if(_0x2fd8d1[_0x6969('0x14')][_0x6969('0x15')]===0x1f4){logger[_0x6969('0x14')](_0x6969('0xf'),_0x4910e6,_0x2fd8d1['error'][_0x6969('0x16')]);return _0x4c6611(_0x2fd8d1[_0x6969('0x14')][_0x6969('0x16')]);}logger[_0x6969('0x14')](_0x6969('0xf'),_0x4910e6,_0x2fd8d1[_0x6969('0x14')][_0x6969('0x16')]);return _0xcb3f22(_0x2fd8d1[_0x6969('0x14')][_0x6969('0x16')]);}else{logger[_0x6969('0xe')](_0x6969('0xf'),_0x4910e6,_0x6969('0x10'));_0xcb3f22(_0x2fd8d1[_0x6969('0x17')][_0x6969('0x16')]);}})['catch'](function(_0x48fa54){logger[_0x6969('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x4910e6,_0x48fa54);_0x4c6611(_0x48fa54);});});}exports['UpdateSmsInteraction']=function(_0xc99340){var _0x7fe514=this;return new Promise(function(_0x17854d,_0x4016e8){return db[_0x6969('0x18')][_0x6969('0x19')](_0xc99340[_0x6969('0x1a')],{'raw':_0xc99340[_0x6969('0x1b')]?_0xc99340[_0x6969('0x1b')][_0x6969('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc99340[_0x6969('0x1b')]?_0xc99340['options'][_0x6969('0x1d')]||null:null,'attributes':_0xc99340['options']?_0xc99340['options'][_0x6969('0x1e')]||null:null,'limit':_0xc99340['options']?_0xc99340[_0x6969('0x1b')]['limit']||null:null})[_0x6969('0x1f')](function(_0x5ce30e){logger[_0x6969('0xe')](_0x6969('0x20'),_0xc99340);logger[_0x6969('0x11')](_0x6969('0x20'),_0xc99340,JSON[_0x6969('0x13')](_0x5ce30e));_0x17854d(_0x5ce30e);})[_0x6969('0x21')](function(_0x3e2bac){logger['error'](_0x6969('0x20'),_0x3e2bac['message'],_0xc99340);_0x4016e8(_0x7fe514[_0x6969('0x14')](0x1f4,_0x3e2bac['message']));});});};exports[_0x6969('0x22')]=function(_0x1faa76){return new Promise(function(_0x27e7f2,_0x280f0f){return db['SmsInteraction'][_0x6969('0x23')]({'where':_0x1faa76[_0x6969('0x1b')]?_0x1faa76[_0x6969('0x1b')][_0x6969('0x1d')]||null:null})['then'](function(_0xb43bbe){if(_0xb43bbe){return _0xb43bbe[_0x6969('0x24')](_0x1faa76[_0x6969('0x1a')][_0x6969('0x25')],_[_0x6969('0x26')](_0x1faa76[_0x6969('0x1a')],[_0x6969('0x25'),'id'])||{});}})[_0x6969('0x27')](function(_0xa535b3){logger[_0x6969('0xe')](_0x6969('0x28'),_0x1faa76);logger['debug']('AddTags',_0x1faa76,JSON[_0x6969('0x13')](_0xa535b3));_0x27e7f2(_0xa535b3);})[_0x6969('0x21')](function(_0x4a2468){logger[_0x6969('0x14')](_0x6969('0x28'),_0x4a2468[_0x6969('0x16')],_0x1faa76);_0x280f0f(_this[_0x6969('0x14')](0x1f4,_0x4a2468[_0x6969('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 31a84df..b3ca55b 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 _0xb1df=['length','smsInteraction:','./smsInteraction.events','update','emit','removeListener','register'];(function(_0x37597b,_0x46e807){var _0x1b10a4=function(_0x3c2f82){while(--_0x3c2f82){_0x37597b['push'](_0x37597b['shift']());}};_0x1b10a4(++_0x46e807);}(_0xb1df,0x121));var _0xfb1d=function(_0x3c4898,_0x1c706d){_0x3c4898=_0x3c4898-0x0;var _0x26389c=_0xb1df[_0x3c4898];return _0x26389c;};'use strict';var SmsInteractionEvents=require(_0xfb1d('0x0'));var events=['save','remove',_0xfb1d('0x1')];function createListener(_0x119633,_0x3cf4a2){return function(_0x5c5180){_0x3cf4a2[_0xfb1d('0x2')](_0x119633,_0x5c5180);};}function removeListener(_0x453ff3,_0x4358e4){return function(){SmsInteractionEvents[_0xfb1d('0x3')](_0x453ff3,_0x4358e4);};}exports[_0xfb1d('0x4')]=function(_0x46235b){for(var _0x3971ea=0x0,_0x7d67b2=events[_0xfb1d('0x5')];_0x3971ea<_0x7d67b2;_0x3971ea++){var _0x5c3493=events[_0x3971ea];var _0x510762=createListener(_0xfb1d('0x6')+_0x5c3493,_0x46235b);SmsInteractionEvents['on'](_0x5c3493,_0x510762);}}; \ No newline at end of file +var _0x5745=['emit','register','smsInteraction:','./smsInteraction.events','save','remove'];(function(_0xce87e3,_0x58cae4){var _0x7d87f4=function(_0x5bc232){while(--_0x5bc232){_0xce87e3['push'](_0xce87e3['shift']());}};_0x7d87f4(++_0x58cae4);}(_0x5745,0x11d));var _0x5574=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5745[_0x502c7d];return _0x30b7ed;};'use strict';var SmsInteractionEvents=require(_0x5574('0x0'));var events=[_0x5574('0x1'),_0x5574('0x2'),'update'];function createListener(_0x86f02f,_0x2b042b){return function(_0x25a74c){_0x2b042b[_0x5574('0x3')](_0x86f02f,_0x25a74c);};}function removeListener(_0x211f6a,_0x5d5047){return function(){SmsInteractionEvents['removeListener'](_0x211f6a,_0x5d5047);};}exports[_0x5574('0x4')]=function(_0x92a52a){for(var _0x40d149=0x0,_0x2de90f=events['length'];_0x40d149<_0x2de90f;_0x40d149++){var _0x464608=events[_0x40d149];var _0x4cbecd=createListener(_0x5574('0x5')+_0x464608,_0x92a52a);SmsInteractionEvents['on'](_0x464608,_0x4cbecd);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 8424685..e46b833 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 _0x3b43=['get','/describe','describe','show','post','sms','smsmessage:create','create','/:id/status','status','put','/:id','/:id/accept','/:id/reject','reject','delete','destroy','multer','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index'];(function(_0x176a6,_0x52607c){var _0x3b3639=function(_0x531cb2){while(--_0x531cb2){_0x176a6['push'](_0x176a6['shift']());}};_0x3b3639(++_0x52607c);}(_0x3b43,0x115));var _0x33b4=function(_0x7e0ba9,_0x17a017){_0x7e0ba9=_0x7e0ba9-0x0;var _0x57ac91=_0x3b43[_0x7e0ba9];return _0x57ac91;};'use strict';var multer=require(_0x33b4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x33b4('0x1'));var express=require(_0x33b4('0x2'));var router=express['Router']();var fs_extra=require(_0x33b4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x33b4('0x4'));var config=require(_0x33b4('0x5'));var controller=require(_0x33b4('0x6'));router['get']('/',auth[_0x33b4('0x7')](),controller[_0x33b4('0x8')]);router[_0x33b4('0x9')](_0x33b4('0xa'),auth[_0x33b4('0x7')](),controller[_0x33b4('0xb')]);router[_0x33b4('0x9')]('/:id',auth[_0x33b4('0x7')](),controller[_0x33b4('0xc')]);router[_0x33b4('0xd')]('/',auth[_0x33b4('0x7')](),interaction['tracked'](_0x33b4('0xe'),_0x33b4('0xf')),controller[_0x33b4('0x10')]);router[_0x33b4('0xd')](_0x33b4('0x11'),controller[_0x33b4('0x12')]);router[_0x33b4('0x13')](_0x33b4('0x14'),auth[_0x33b4('0x7')](),controller['update']);router[_0x33b4('0x13')](_0x33b4('0x15'),auth[_0x33b4('0x7')](),controller['accept']);router[_0x33b4('0x13')](_0x33b4('0x16'),auth['isAuthenticated'](),controller[_0x33b4('0x17')]);router[_0x33b4('0x18')](_0x33b4('0x14'),auth['isAuthenticated'](),controller[_0x33b4('0x19')]);module['exports']=router; \ No newline at end of file +var _0xc022=['../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','get','/:id','show','sms','smsmessage:create','post','/:id/status','status','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xa39bd2,_0xb7e04d){var _0x35ab7e=function(_0x1dec06){while(--_0x1dec06){_0xa39bd2['push'](_0xa39bd2['shift']());}};_0x35ab7e(++_0xb7e04d);}(_0xc022,0xd1));var _0x2c02=function(_0x3ef984,_0x3f5981){_0x3ef984=_0x3ef984-0x0;var _0x578b03=_0xc022[_0x3ef984];return _0x578b03;};'use strict';var multer=require(_0x2c02('0x0'));var util=require(_0x2c02('0x1'));var path=require('path');var timeout=require(_0x2c02('0x2'));var express=require(_0x2c02('0x3'));var router=express[_0x2c02('0x4')]();var fs_extra=require(_0x2c02('0x5'));var auth=require(_0x2c02('0x6'));var interaction=require(_0x2c02('0x7'));var config=require(_0x2c02('0x8'));var controller=require(_0x2c02('0x9'));router['get']('/',auth[_0x2c02('0xa')](),controller[_0x2c02('0xb')]);router[_0x2c02('0xc')]('/describe',auth[_0x2c02('0xa')](),controller['describe']);router[_0x2c02('0xc')](_0x2c02('0xd'),auth[_0x2c02('0xa')](),controller[_0x2c02('0xe')]);router['post']('/',auth[_0x2c02('0xa')](),interaction['tracked'](_0x2c02('0xf'),_0x2c02('0x10')),controller['create']);router[_0x2c02('0x11')](_0x2c02('0x12'),controller[_0x2c02('0x13')]);router[_0x2c02('0x14')](_0x2c02('0xd'),auth[_0x2c02('0xa')](),controller['update']);router[_0x2c02('0x14')](_0x2c02('0x15'),auth['isAuthenticated'](),controller[_0x2c02('0x16')]);router[_0x2c02('0x14')](_0x2c02('0x17'),auth['isAuthenticated'](),controller['reject']);router[_0x2c02('0x18')](_0x2c02('0xd'),auth[_0x2c02('0xa')](),controller[_0x2c02('0x19')]);module[_0x2c02('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 2b6ca9a..5a0bd81 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 _0x6565=['medium','BOOLEAN','out','STRING','sequelize','exports','TEXT'];(function(_0x277721,_0x46971e){var _0x286051=function(_0x130c98){while(--_0x130c98){_0x277721['push'](_0x277721['shift']());}};_0x286051(++_0x46971e);}(_0x6565,0x115));var _0x5656=function(_0x12aba8,_0x40a036){_0x12aba8=_0x12aba8-0x0;var _0x2aac66=_0x6565[_0x12aba8];return _0x2aac66;};'use strict';var Sequelize=require(_0x5656('0x0'));module[_0x5656('0x1')]={'body':{'type':Sequelize[_0x5656('0x2')](_0x5656('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5656('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5656('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x5656('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x5656('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5656('0x6')]},'providerResponse':{'type':Sequelize[_0x5656('0x2')]}}; \ No newline at end of file +var _0x7117=['ENUM','out','STRING','DATE','BOOLEAN','sequelize','exports','TEXT','medium'];(function(_0xeec891,_0x1c3633){var _0x33d2e8=function(_0x4ccc90){while(--_0x4ccc90){_0xeec891['push'](_0xeec891['shift']());}};_0x33d2e8(++_0x1c3633);}(_0x7117,0x71));var _0x7711=function(_0x39fe9f,_0x375687){_0x39fe9f=_0x39fe9f-0x0;var _0x34f0c9=_0x7117[_0x39fe9f];return _0x34f0c9;};'use strict';var Sequelize=require(_0x7711('0x0'));module[_0x7711('0x1')]={'body':{'type':Sequelize[_0x7711('0x2')](_0x7711('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x7711('0x4')]('in',_0x7711('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x7711('0x6')](0xbe)},'phone':{'type':Sequelize[_0x7711('0x6')]},'readAt':{'type':Sequelize[_0x7711('0x7')]},'secret':{'type':Sequelize[_0x7711('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x7711('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 6823d62..927c1f1 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 _0xb7ac=['undefined','count','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','params','find','create','body','describe','sms-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteractionId','isNil','format','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','get','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','QueryTypes','interface','motionChannel','SmsAccount','SmsAccountId','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','infobip','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','code','SmsMessage,\x20%s,\x20%s','error','message','result','catch','status','end','json','offset'];(function(_0x1c7c00,_0x49b351){var _0x48cd0a=function(_0xfd49c3){while(--_0xfd49c3){_0x1c7c00['push'](_0x1c7c00['shift']());}};_0x48cd0a(++_0x49b351);}(_0xb7ac,0x18a));var _0xcb7a=function(_0x203cbe,_0xdb99df){_0x203cbe=_0x203cbe-0x0;var _0x2db579=_0xb7ac[_0x203cbe];return _0x2db579;};'use strict';var emlformat=require(_0xcb7a('0x0'));var rimraf=require(_0xcb7a('0x1'));var zipdir=require(_0xcb7a('0x2'));var jsonpatch=require(_0xcb7a('0x3'));var rp=require(_0xcb7a('0x4'));var moment=require('moment');var BPromise=require(_0xcb7a('0x5'));var Mustache=require('mustache');var util=require(_0xcb7a('0x6'));var path=require(_0xcb7a('0x7'));var sox=require('sox');var csv=require(_0xcb7a('0x8'));var ejs=require(_0xcb7a('0x9'));var fs=require('fs');var fs_extra=require(_0xcb7a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcb7a('0xb'));var jsforce=require(_0xcb7a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcb7a('0x8'));var querystring=require(_0xcb7a('0xd'));var Papa=require(_0xcb7a('0xe'));var Redis=require(_0xcb7a('0xf'));var authService=require(_0xcb7a('0x10'));var qs=require(_0xcb7a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb7a('0x12'));var logger=require(_0xcb7a('0x13'))(_0xcb7a('0x14'));var utils=require('../../config/utils');var config=require(_0xcb7a('0x15'));var licenseUtil=require(_0xcb7a('0x16'));var db=require('../../mysqldb')['db'];config[_0xcb7a('0x17')]=_[_0xcb7a('0x18')](config[_0xcb7a('0x17')],{'host':_0xcb7a('0x19'),'port':0x18eb});var socket=require(_0xcb7a('0x1a'))(new Redis(config[_0xcb7a('0x17')]));require(_0xcb7a('0x1b'))[_0xcb7a('0x1c')](socket);var jayson=require(_0xcb7a('0x1d'));var client=jayson['client'][_0xcb7a('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xcb7a('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x38acef,_0x7f1071,_0x37ea19,_0x53721a){return new BPromise(function(_0x2bb2e9,_0x39b3b7){var _0x28d09d=_0x53721a||client;return _0x28d09d[_0xcb7a('0x1f')](_0x38acef,_0x37ea19)[_0xcb7a('0x20')](function(_0x28be52){logger[_0xcb7a('0x21')]('SmsMessage,\x20%s,\x20%s',_0x7f1071,_0xcb7a('0x22'));logger[_0xcb7a('0x23')](_0xcb7a('0x24'),_0x7f1071,_0xcb7a('0x22'),JSON['stringify'](_0x28be52));if(_0x28be52['error']){if(_0x28be52['error'][_0xcb7a('0x25')]===0x1f4){logger['error'](_0xcb7a('0x26'),_0x7f1071,_0x28be52[_0xcb7a('0x27')][_0xcb7a('0x28')]);return _0x39b3b7(_0x28be52[_0xcb7a('0x27')][_0xcb7a('0x28')]);}logger[_0xcb7a('0x27')](_0xcb7a('0x26'),_0x7f1071,_0x28be52[_0xcb7a('0x27')][_0xcb7a('0x28')]);return _0x2bb2e9(_0x28be52[_0xcb7a('0x27')][_0xcb7a('0x28')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x7f1071,'request\x20sent');_0x2bb2e9(_0x28be52[_0xcb7a('0x29')][_0xcb7a('0x28')]);}})[_0xcb7a('0x2a')](function(_0x28682a){logger['error'](_0xcb7a('0x26'),_0x7f1071,_0x28682a);_0x39b3b7(_0x28682a);});});}function respondWithStatusCode(_0xe20b78,_0x282350){_0x282350=_0x282350||0xcc;return function(_0x2c59d8){if(_0x2c59d8){return _0xe20b78['sendStatus'](_0x282350);}return _0xe20b78[_0xcb7a('0x2b')](_0x282350)[_0xcb7a('0x2c')]();};}function respondWithResult(_0x4fd6bf,_0x3b7fc8){_0x3b7fc8=_0x3b7fc8||0xc8;return function(_0x1f3a3d){if(_0x1f3a3d){return _0x4fd6bf[_0xcb7a('0x2b')](_0x3b7fc8)[_0xcb7a('0x2d')](_0x1f3a3d);}};}function respondWithFilteredResult(_0x4680ea,_0x5ba723){return function(_0x3aa77c){if(_0x3aa77c){var _0x59c56a=typeof _0x5ba723[_0xcb7a('0x2e')]==='undefined'&&typeof _0x5ba723['limit']===_0xcb7a('0x2f');var _0x3b17f9=_0x3aa77c[_0xcb7a('0x30')];var _0x1303d9=_0x59c56a?0x0:_0x5ba723[_0xcb7a('0x2e')];var _0x55e6a4=_0x59c56a?_0x3aa77c[_0xcb7a('0x30')]:_0x5ba723[_0xcb7a('0x2e')]+_0x5ba723[_0xcb7a('0x31')];var _0x2efb4b;if(_0x55e6a4>=_0x3b17f9){_0x55e6a4=_0x3b17f9;_0x2efb4b=0xc8;}else{_0x2efb4b=0xce;}_0x4680ea[_0xcb7a('0x2b')](_0x2efb4b);return _0x4680ea[_0xcb7a('0x32')](_0xcb7a('0x33'),_0x1303d9+'-'+_0x55e6a4+'/'+_0x3b17f9)[_0xcb7a('0x2d')](_0x3aa77c);}return null;};}function patchUpdates(_0x3bb4f6){return function(_0x272920){try{jsonpatch[_0xcb7a('0x34')](_0x272920,_0x3bb4f6,!![]);}catch(_0x1062a4){return BPromise[_0xcb7a('0x35')](_0x1062a4);}return _0x272920['save']();};}function saveUpdates(_0xc58d05,_0x5adfc1){return function(_0x3f99fb){if(_0x3f99fb){return _0x3f99fb[_0xcb7a('0x36')](_0xc58d05)[_0xcb7a('0x20')](function(_0x212cbf){return _0x212cbf;});}return null;};}function removeEntity(_0x52557e,_0x2132e4){return function(_0x5de97f){if(_0x5de97f){return _0x5de97f[_0xcb7a('0x37')]()[_0xcb7a('0x20')](function(){_0x52557e[_0xcb7a('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d62ac,_0x231331){return function(_0x50c745){if(!_0x50c745){_0x2d62ac[_0xcb7a('0x38')](0x194);}return _0x50c745;};}function handleError(_0x22f86f,_0x8e900f){_0x8e900f=_0x8e900f||0x1f4;return function(_0xb62490){logger['error'](_0xb62490[_0xcb7a('0x39')]);if(_0xb62490[_0xcb7a('0x3a')]){delete _0xb62490[_0xcb7a('0x3a')];}_0x22f86f['status'](_0x8e900f)[_0xcb7a('0x3b')](_0xb62490);};}exports[_0xcb7a('0x3c')]=function(_0x4636d7,_0x403d42){var _0x31371a={},_0x2b10d1={},_0x4ee2c3={'count':0x0,'rows':[]};var _0xae1541=_[_0xcb7a('0x3d')](db[_0xcb7a('0x3e')][_0xcb7a('0x3f')],function(_0x4c4dfc){return{'name':_0x4c4dfc[_0xcb7a('0x40')],'type':_0x4c4dfc[_0xcb7a('0x41')][_0xcb7a('0x42')]};});_0x2b10d1[_0xcb7a('0x43')]=_[_0xcb7a('0x3d')](_0xae1541,_0xcb7a('0x3a'));_0x2b10d1[_0xcb7a('0x44')]=_[_0xcb7a('0x45')](_0x4636d7[_0xcb7a('0x44')]);_0x2b10d1[_0xcb7a('0x46')]=_[_0xcb7a('0x47')](_0x2b10d1['model'],_0x2b10d1['query']);_0x31371a['attributes']=_[_0xcb7a('0x47')](_0x2b10d1['model'],qs[_0xcb7a('0x48')](_0x4636d7[_0xcb7a('0x44')][_0xcb7a('0x48')]));_0x31371a['attributes']=_0x31371a[_0xcb7a('0x49')][_0xcb7a('0x4a')]?_0x31371a[_0xcb7a('0x49')]:_0x2b10d1[_0xcb7a('0x43')];if(!_0x4636d7['query'][_0xcb7a('0x4b')](_0xcb7a('0x4c'))){_0x31371a[_0xcb7a('0x31')]=qs[_0xcb7a('0x31')](_0x4636d7['query'][_0xcb7a('0x31')]);_0x31371a[_0xcb7a('0x2e')]=qs['offset'](_0x4636d7[_0xcb7a('0x44')]['offset']);}_0x31371a[_0xcb7a('0x4d')]=qs['sort'](_0x4636d7[_0xcb7a('0x44')]['sort']);_0x31371a['where']=qs[_0xcb7a('0x46')](_[_0xcb7a('0x4e')](_0x4636d7[_0xcb7a('0x44')],_0x2b10d1['filters']),_0xae1541);if(_0x4636d7[_0xcb7a('0x44')][_0xcb7a('0x4f')]){_0x31371a[_0xcb7a('0x50')]=_[_0xcb7a('0x51')](_0x31371a[_0xcb7a('0x50')],{'$or':_['map'](_0xae1541,function(_0x14af47){if(_0x14af47['type']!==_0xcb7a('0x52')){var _0x2a7315={};_0x2a7315[_0x14af47[_0xcb7a('0x3a')]]={'$like':'%'+_0x4636d7[_0xcb7a('0x44')][_0xcb7a('0x4f')]+'%'};return _0x2a7315;}})});}_0x31371a=_[_0xcb7a('0x51')]({},_0x31371a,_0x4636d7[_0xcb7a('0x53')]);var _0x3ce8db={'where':_0x31371a[_0xcb7a('0x50')]};return db[_0xcb7a('0x3e')][_0xcb7a('0x30')](_0x3ce8db)[_0xcb7a('0x20')](function(_0xbccabc){_0x4ee2c3[_0xcb7a('0x30')]=_0xbccabc;if(_0x4636d7[_0xcb7a('0x44')][_0xcb7a('0x54')]){_0x31371a['include']=[{'all':!![]}];}return db[_0xcb7a('0x3e')][_0xcb7a('0x55')](_0x31371a);})[_0xcb7a('0x20')](function(_0xfefd29){_0x4ee2c3[_0xcb7a('0x56')]=_0xfefd29;return _0x4ee2c3;})[_0xcb7a('0x20')](respondWithFilteredResult(_0x403d42,_0x31371a))[_0xcb7a('0x2a')](handleError(_0x403d42,null));};exports['show']=function(_0x18dbce,_0x45d267){var _0x4094a3={'raw':!![],'where':{'id':_0x18dbce[_0xcb7a('0x57')]['id']}},_0x284055={};_0x284055[_0xcb7a('0x43')]=_[_0xcb7a('0x45')](db[_0xcb7a('0x3e')][_0xcb7a('0x3f')]);_0x284055[_0xcb7a('0x44')]=_[_0xcb7a('0x45')](_0x18dbce[_0xcb7a('0x44')]);_0x284055[_0xcb7a('0x46')]=_[_0xcb7a('0x47')](_0x284055['model'],_0x284055[_0xcb7a('0x44')]);_0x4094a3[_0xcb7a('0x49')]=_['intersection'](_0x284055[_0xcb7a('0x43')],qs['fields'](_0x18dbce[_0xcb7a('0x44')][_0xcb7a('0x48')]));_0x4094a3['attributes']=_0x4094a3['attributes']['length']?_0x4094a3[_0xcb7a('0x49')]:_0x284055[_0xcb7a('0x43')];if(_0x18dbce[_0xcb7a('0x44')][_0xcb7a('0x54')]){_0x4094a3['include']=[{'all':!![]}];}_0x4094a3=_[_0xcb7a('0x51')]({},_0x4094a3,_0x18dbce[_0xcb7a('0x53')]);return db[_0xcb7a('0x3e')][_0xcb7a('0x58')](_0x4094a3)[_0xcb7a('0x20')](handleEntityNotFound(_0x45d267,null))[_0xcb7a('0x20')](respondWithResult(_0x45d267,null))[_0xcb7a('0x2a')](handleError(_0x45d267,null));};exports['create']=function(_0x101888,_0x57a4ce){return db[_0xcb7a('0x3e')][_0xcb7a('0x59')](_0x101888['body'],{})[_0xcb7a('0x20')](respondWithResult(_0x57a4ce,0xc9))[_0xcb7a('0x2a')](handleError(_0x57a4ce,null));};exports[_0xcb7a('0x36')]=function(_0x1095d9,_0x44f3f8){if(_0x1095d9[_0xcb7a('0x5a')]['id']){delete _0x1095d9['body']['id'];}return db['SmsMessage'][_0xcb7a('0x58')]({'where':{'id':_0x1095d9['params']['id']}})['then'](handleEntityNotFound(_0x44f3f8,null))[_0xcb7a('0x20')](saveUpdates(_0x1095d9['body'],null))[_0xcb7a('0x20')](respondWithResult(_0x44f3f8,null))['catch'](handleError(_0x44f3f8,null));};exports[_0xcb7a('0x37')]=function(_0x25f14e,_0x19b885){return db[_0xcb7a('0x3e')][_0xcb7a('0x58')]({'where':{'id':_0x25f14e[_0xcb7a('0x57')]['id']}})[_0xcb7a('0x20')](handleEntityNotFound(_0x19b885,null))[_0xcb7a('0x20')](removeEntity(_0x19b885,null))[_0xcb7a('0x2a')](handleError(_0x19b885,null));};exports[_0xcb7a('0x5b')]=function(_0x4b536d,_0x5984f2){return db[_0xcb7a('0x3e')]['describe']()[_0xcb7a('0x20')](respondWithResult(_0x5984f2,null))['catch'](handleError(_0x5984f2,null));};var interaction_log=require(_0xcb7a('0x13'))(_0xcb7a('0x5c'));exports[_0xcb7a('0x5d')]=function(_0x213b84,_0x2d70f0,_0x5128b7){var _0x24365f={'agent':{},'channel':'sms'};if(_0x213b84[_0xcb7a('0x5a')]['id']){delete _0x213b84[_0xcb7a('0x5a')]['id'];}_0x213b84[_0xcb7a('0x5a')][_0xcb7a('0x5e')]=!![];_0x213b84['body'][_0xcb7a('0x5f')]=moment()['format'](_0xcb7a('0x60'));_0x213b84['body'][_0xcb7a('0x61')]=_0x213b84[_0xcb7a('0x5a')]['UserId']||_0x213b84[_0xcb7a('0x62')]['id'];_0x24365f[_0xcb7a('0x63')]['id']=_0x213b84[_0xcb7a('0x5a')][_0xcb7a('0x61')];return db[_0xcb7a('0x3e')]['find']({'where':{'id':_0x213b84[_0xcb7a('0x57')]['id'],'UserId':null}})[_0xcb7a('0x20')](handleEntityNotFound(_0x2d70f0,null))[_0xcb7a('0x20')](saveUpdates(_0x213b84[_0xcb7a('0x5a')],null))[_0xcb7a('0x20')](function(_0x2c587c){if(_0x2c587c){_0x24365f['message']=_0x2c587c['get']({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x2c587c[_0xcb7a('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x2d70f0,null))['then'](function(_0x250515){if(_0x250515){return _0x250515[_0xcb7a('0x36')]({'UserId':_0x213b84[_0xcb7a('0x5a')]['UserId'],'read1stAt':_[_0xcb7a('0x65')](_0x250515['read1stAt'])?moment()[_0xcb7a('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x7921c8){if(_0x7921c8){_0x24365f['interaction']=_0x7921c8['get']({'plain':!![]});interaction_log['info'](_0xcb7a('0x67'),_0x213b84['user']['id'],_0x213b84[_0xcb7a('0x62')]['name'],_0x213b84[_0xcb7a('0x62')]['role'],_0x24365f[_0xcb7a('0x68')]['id'],_0x213b84[_0xcb7a('0x5a')]?JSON[_0xcb7a('0x69')](_0x213b84[_0xcb7a('0x5a')]):_0xcb7a('0x6a'));return respondWithRpcPromise(_0xcb7a('0x6b'),_0xcb7a('0x6c'),_0x24365f);}return null;})[_0xcb7a('0x20')](function(_0x3b5ee4){var _0x4126eb=_0xcb7a('0x6d')+_0x3b5ee4[_0xcb7a('0x28')]['ContactId'];return db[_0xcb7a('0x6e')]['query'](_0x4126eb,{'type':db['Sequelize']['QueryTypes'][_0xcb7a('0x6f')],'raw':!![]})['then'](function(_0x29e61c){return _0x29e61c;});})[_0xcb7a('0x20')](function(_0x531a11){if(_0x531a11){_0x24365f[_0xcb7a('0x28')][_0xcb7a('0x70')]=_0x531a11[0x0];if(!_0x213b84[_0xcb7a('0x5a')][_0xcb7a('0x61')])return;return db[_0xcb7a('0x71')]['find']({'where':{'id':_0x213b84[_0xcb7a('0x5a')][_0xcb7a('0x61')],'role':_0xcb7a('0x63')},'attributes':['id',_0xcb7a('0x3a'),_0xcb7a('0x72'),_0xcb7a('0x73'),_0xcb7a('0x74')],'raw':!![]});}return null;})['then'](function(_0x3c2dee){if(!_0x3c2dee)return null;_0x24365f[_0xcb7a('0x28')][_0xcb7a('0x63')]=_0x3c2dee;return _0x24365f;})[_0xcb7a('0x20')](function(_0x1fdce8){if(_0x1fdce8){if(_0x213b84['body'][_0xcb7a('0x75')]){_0x24365f[_0xcb7a('0x28')]['interface']=util[_0xcb7a('0x66')](_0xcb7a('0x76'),_0x213b84[_0xcb7a('0x62')][_0xcb7a('0x3a')]);_0x24365f[_0xcb7a('0x28')][_0xcb7a('0x77')]=_0x24365f[_0xcb7a('0x77')];_0x24365f['message']['motionChannel']=_0x24365f[_0xcb7a('0x77')];_0x24365f[_0xcb7a('0x28')][_0xcb7a('0x78')]='accept';return respondWithRpcPromise(_0xcb7a('0x79'),_0xcb7a('0x79'),{'event':_0xcb7a('0x7a'),'message':_0x24365f[_0xcb7a('0x28')]},client9002)[_0xcb7a('0x20')](function(){return _0x24365f;});}return _0x24365f;}return null;})['then'](respondWithResult(_0x2d70f0,null))[_0xcb7a('0x2a')](handleError(_0x2d70f0,null));};var interaction_log=require('../../config/logger')(_0xcb7a('0x5c'));exports[_0xcb7a('0x35')]=function(_0x5e4d3b,_0x21c6fa,_0x4c755c){var _0x4b7a04={'agent':{},'channel':'sms'};if(_0x5e4d3b[_0xcb7a('0x5a')]['id']){delete _0x5e4d3b[_0xcb7a('0x5a')]['id'];}_0x5e4d3b[_0xcb7a('0x5a')][_0xcb7a('0x61')]=_0x5e4d3b[_0xcb7a('0x5a')][_0xcb7a('0x61')]||_0x5e4d3b[_0xcb7a('0x62')]['id'];_0x4b7a04[_0xcb7a('0x63')]['id']=_0x5e4d3b[_0xcb7a('0x5a')][_0xcb7a('0x61')];return db['SmsMessage']['find']({'where':{'id':_0x5e4d3b[_0xcb7a('0x57')]['id'],'UserId':null}})[_0xcb7a('0x20')](handleEntityNotFound(_0x21c6fa,null))[_0xcb7a('0x20')](function(_0x3c9980){if(_0x3c9980){_0x4b7a04[_0xcb7a('0x28')]=_0x3c9980[_0xcb7a('0x7b')]({'plain':!![]});return db[_0xcb7a('0x7c')][_0xcb7a('0x58')]({'where':{'id':_0x3c9980[_0xcb7a('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x21c6fa,null))[_0xcb7a('0x20')](function(_0xd97cda){if(_0xd97cda){_0x4b7a04[_0xcb7a('0x68')]=_0xd97cda[_0xcb7a('0x7b')]({'plain':!![]});interaction_log['info'](_0xcb7a('0x7d'),_0x5e4d3b[_0xcb7a('0x62')]['id'],_0x5e4d3b[_0xcb7a('0x62')][_0xcb7a('0x3a')],_0x5e4d3b[_0xcb7a('0x62')][_0xcb7a('0x7e')],_0x4b7a04['interaction']['id'],_0x5e4d3b['body']?JSON[_0xcb7a('0x69')](_0x5e4d3b[_0xcb7a('0x5a')]):'null');return respondWithRpcPromise(_0xcb7a('0x7f'),'rejectMessage',_0x4b7a04);}return null;})[_0xcb7a('0x20')](function(_0x243e30){var _0x58930a=_0xcb7a('0x6d')+_0x243e30[_0xcb7a('0x28')]['ContactId'];return db[_0xcb7a('0x6e')][_0xcb7a('0x44')](_0x58930a,{'type':db['Sequelize'][_0xcb7a('0x80')][_0xcb7a('0x6f')],'raw':!![]})['then'](function(_0x31987d){return _0x31987d;});})[_0xcb7a('0x20')](function(_0x23ffc7){if(_0x23ffc7){_0x4b7a04[_0xcb7a('0x28')][_0xcb7a('0x70')]=_0x23ffc7[0x0];if(!_0x5e4d3b[_0xcb7a('0x5a')][_0xcb7a('0x61')])return;return db[_0xcb7a('0x71')][_0xcb7a('0x58')]({'where':{'id':_0x5e4d3b[_0xcb7a('0x5a')]['UserId'],'role':_0xcb7a('0x63')},'attributes':['id',_0xcb7a('0x3a'),'fullname',_0xcb7a('0x73'),'internal'],'raw':!![]});}return null;})[_0xcb7a('0x20')](function(_0x58097e){if(!_0x58097e)return null;_0x4b7a04[_0xcb7a('0x28')][_0xcb7a('0x63')]=_0x58097e;return _0x4b7a04;})[_0xcb7a('0x20')](function(_0x2ea8a0){if(_0x2ea8a0){_0x2ea8a0[_0xcb7a('0x28')][_0xcb7a('0x81')]=util[_0xcb7a('0x66')](_0xcb7a('0x76'),_0x5e4d3b[_0xcb7a('0x62')][_0xcb7a('0x3a')]);_0x2ea8a0['message'][_0xcb7a('0x77')]=_0x4b7a04[_0xcb7a('0x77')];_0x2ea8a0[_0xcb7a('0x28')][_0xcb7a('0x82')]=_0x4b7a04[_0xcb7a('0x77')];_0x2ea8a0[_0xcb7a('0x28')][_0xcb7a('0x78')]=_0xcb7a('0x35');respondWithRpcPromise(_0xcb7a('0x79'),_0xcb7a('0x79'),{'event':'rejectmessage','message':_0x2ea8a0['message']},client9002);return _0x4b7a04;}return null;})[_0xcb7a('0x20')](respondWithResult(_0x21c6fa,null))['catch'](handleError(_0x21c6fa,null));};exports['status']=function(_0x2aa719,_0x26535d,_0x1fbb70){if(_0x2aa719['body']['id']){delete _0x2aa719[_0xcb7a('0x5a')]['id'];}var _0x4384d2;return db[_0xcb7a('0x3e')][_0xcb7a('0x58')]({'where':{'id':_0x2aa719[_0xcb7a('0x57')]['id']}})['then'](handleEntityNotFound(_0x26535d,null))[_0xcb7a('0x20')](function(_0x33c0f5){if(_0x33c0f5){_0x4384d2=_0x33c0f5;return db[_0xcb7a('0x83')]['find']({'where':{'id':_0x33c0f5[_0xcb7a('0x84')]}});}})['then'](handleEntityNotFound(_0x26535d,null))['then'](function(_0xa9aefb){if(_0xa9aefb){logger[_0xcb7a('0x23')](_0xcb7a('0x24'),_0xcb7a('0x2b'),'received\x20delivery\x20report\x20from',_0xa9aefb['type'],util[_0xcb7a('0x85')](_0x2aa719[_0xcb7a('0x5a')],{'showHidden':![],'depth':null}));switch(_0xa9aefb[_0xcb7a('0x41')]){case _0xcb7a('0x86'):if(_0x2aa719['body'][_0xcb7a('0x87')]&&_0x2aa719[_0xcb7a('0x5a')][_0xcb7a('0x87')]===_0x4384d2[_0xcb7a('0x88')]){return _0x4384d2[_0xcb7a('0x36')]({'read':!![]});}else{logger[_0xcb7a('0x27')](_0xcb7a('0x89'),_0xcb7a('0x2b'),_0xcb7a('0x86'),util[_0xcb7a('0x85')](_0x2aa719[_0xcb7a('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xcb7a('0x8a'):if(_0x2aa719[_0xcb7a('0x5a')]['MessageUUID']&&_0x2aa719[_0xcb7a('0x5a')][_0xcb7a('0x8b')]===_0x4384d2[_0xcb7a('0x88')]&&_[_0xcb7a('0x8c')]([_0xcb7a('0x8d'),_0xcb7a('0x8e')],_0x2aa719[_0xcb7a('0x5a')][_0xcb7a('0x8f')])>=0x0){return _0x4384d2['update']({'read':!![]});}else{logger[_0xcb7a('0x27')](_0xcb7a('0x89'),_0xcb7a('0x2b'),'plivio',util[_0xcb7a('0x85')](_0x2aa719[_0xcb7a('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xcb7a('0x90'):var _0x31146f=_0x2aa719[_0xcb7a('0x5a')]['results'][0x0];if(_0x31146f[_0xcb7a('0x2b')][_0xcb7a('0x91')]===_0xcb7a('0x92')){return _0x4384d2[_0xcb7a('0x36')]({'read':!![]});}else{logger[_0xcb7a('0x27')](_0xcb7a('0x89'),_0xcb7a('0x2b'),_0xcb7a('0x90'),util[_0xcb7a('0x85')](_0x2aa719[_0xcb7a('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4384d2;}})['then'](respondWithResult(_0x26535d,null))[_0xcb7a('0x2a')](handleError(_0x26535d,null));}; \ No newline at end of file +var _0x4c9c=['order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','rows','includeAll','find','create','body','catch','params','describe','sms','acceptMessage','reject','UserId','SmsInteraction','SmsInteractionId','interaction','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','stringify','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','agent','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','plivio','infobip','results','groupName','util','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','sms-interactions','request','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','result','status','json','offset','undefined','limit','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','SmsMessage','rawAttributes','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x2bec81,_0x408be8){var _0x57fd5b=function(_0x12db8b){while(--_0x12db8b){_0x2bec81['push'](_0x2bec81['shift']());}};_0x57fd5b(++_0x408be8);}(_0x4c9c,0x1ac));var _0xc4c9=function(_0x240860,_0x20c04d){_0x240860=_0x240860-0x0;var _0x40e288=_0x4c9c[_0x240860];return _0x40e288;};'use strict';var util=require(_0xc4c9('0x0'));var _=require(_0xc4c9('0x1'));var Redis=require('ioredis');var interactionService=require(_0xc4c9('0x2'));var qs=require(_0xc4c9('0x3'));var logger=require(_0xc4c9('0x4'))(_0xc4c9('0x5'));var config=require(_0xc4c9('0x6'));var db=require(_0xc4c9('0x7'))['db'];config[_0xc4c9('0x8')]=_[_0xc4c9('0x9')](config[_0xc4c9('0x8')],{'host':_0xc4c9('0xa'),'port':0x18eb});var socket=require(_0xc4c9('0xb'))(new Redis(config[_0xc4c9('0x8')]));require(_0xc4c9('0xc'))[_0xc4c9('0xd')](socket);var jayson=require(_0xc4c9('0xe'));var client=jayson[_0xc4c9('0xf')][_0xc4c9('0x10')]({'port':0x232c});var client9002=jayson[_0xc4c9('0xf')][_0xc4c9('0x10')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0xc4c9('0x11'));function respondWithRpcPromise(_0x17a2e2,_0x49dabd,_0x35cd61,_0x5adb59){return new Promise(function(_0x2624ac,_0x3dcb61){var _0x102fbb=_0x5adb59||client;return _0x102fbb[_0xc4c9('0x12')](_0x17a2e2,_0x35cd61)[_0xc4c9('0x13')](function(_0x2a3899){logger[_0xc4c9('0x14')]('SmsMessage,\x20%s,\x20%s',_0x49dabd,'request\x20sent');logger[_0xc4c9('0x15')](_0xc4c9('0x16'),_0x49dabd,'request\x20sent',JSON['stringify'](_0x2a3899));if(_0x2a3899['error']){if(_0x2a3899[_0xc4c9('0x17')][_0xc4c9('0x18')]===0x1f4){logger[_0xc4c9('0x17')](_0xc4c9('0x19'),_0x49dabd,_0x2a3899[_0xc4c9('0x17')][_0xc4c9('0x1a')]);return _0x3dcb61(_0x2a3899[_0xc4c9('0x17')][_0xc4c9('0x1a')]);}logger[_0xc4c9('0x17')](_0xc4c9('0x19'),_0x49dabd,_0x2a3899['error'][_0xc4c9('0x1a')]);return _0x2624ac(_0x2a3899['error'][_0xc4c9('0x1a')]);}else{logger[_0xc4c9('0x14')]('SmsMessage,\x20%s,\x20%s',_0x49dabd,'request\x20sent');_0x2624ac(_0x2a3899[_0xc4c9('0x1b')][_0xc4c9('0x1a')]);}})['catch'](function(_0x16494d){logger['error'](_0xc4c9('0x19'),_0x49dabd,_0x16494d);_0x3dcb61(_0x16494d);});});}function respondWithResult(_0x501a82,_0x2685fa){_0x2685fa=_0x2685fa||0xc8;return function(_0x324c38){if(_0x324c38){return _0x501a82[_0xc4c9('0x1c')](_0x2685fa)[_0xc4c9('0x1d')](_0x324c38);}};}function respondWithFilteredResult(_0x32c980,_0x4021a9){return function(_0x1ed200){if(_0x1ed200){var _0x3a28c7=typeof _0x4021a9[_0xc4c9('0x1e')]===_0xc4c9('0x1f')&&typeof _0x4021a9[_0xc4c9('0x20')]===_0xc4c9('0x1f');var _0x667731=_0x1ed200['count'];var _0x29f322=_0x3a28c7?0x0:_0x4021a9[_0xc4c9('0x1e')];var _0x2af6cb=_0x3a28c7?_0x1ed200['count']:_0x4021a9[_0xc4c9('0x1e')]+_0x4021a9[_0xc4c9('0x20')];var _0x269509;if(_0x2af6cb>=_0x667731){_0x2af6cb=_0x667731;_0x269509=0xc8;}else{_0x269509=0xce;}_0x32c980[_0xc4c9('0x1c')](_0x269509);return _0x32c980[_0xc4c9('0x21')](_0xc4c9('0x22'),_0x29f322+'-'+_0x2af6cb+'/'+_0x667731)[_0xc4c9('0x1d')](_0x1ed200);}return null;};}function saveUpdates(_0x40e155){return function(_0x5b427a){if(_0x5b427a){return _0x5b427a[_0xc4c9('0x23')](_0x40e155)[_0xc4c9('0x13')](function(_0x378811){return _0x378811;});}return null;};}function removeEntity(_0x4c435e){return function(_0x323892){if(_0x323892){return _0x323892[_0xc4c9('0x24')]()[_0xc4c9('0x13')](function(){_0x4c435e[_0xc4c9('0x1c')](0xcc)[_0xc4c9('0x25')]();});}};}function handleEntityNotFound(_0x2162ac){return function(_0x2d8314){if(!_0x2d8314){_0x2162ac[_0xc4c9('0x26')](0x194);}return _0x2d8314;};}function handleError(_0x29211c,_0x568d0e){_0x568d0e=_0x568d0e||0x1f4;return function(_0x5b3f95){logger[_0xc4c9('0x17')](_0x5b3f95[_0xc4c9('0x27')]);if(_0x5b3f95[_0xc4c9('0x28')]){delete _0x5b3f95[_0xc4c9('0x28')];}_0x29211c['status'](_0x568d0e)[_0xc4c9('0x29')](_0x5b3f95);};}exports['index']=function(_0x2e2717,_0x1c6071){var _0x183446={},_0x55f39c={},_0x3ef111={'count':0x0,'rows':[]};var _0x3d2524=_['map'](db[_0xc4c9('0x2a')][_0xc4c9('0x2b')],function(_0x292b56){return{'name':_0x292b56['fieldName'],'type':_0x292b56['type'][_0xc4c9('0x2c')]};});_0x55f39c['model']=_[_0xc4c9('0x2d')](_0x3d2524,_0xc4c9('0x28'));_0x55f39c['query']=_[_0xc4c9('0x2e')](_0x2e2717[_0xc4c9('0x2f')]);_0x55f39c[_0xc4c9('0x30')]=_[_0xc4c9('0x31')](_0x55f39c[_0xc4c9('0x32')],_0x55f39c[_0xc4c9('0x2f')]);_0x183446[_0xc4c9('0x33')]=_[_0xc4c9('0x31')](_0x55f39c[_0xc4c9('0x32')],qs['fields'](_0x2e2717[_0xc4c9('0x2f')][_0xc4c9('0x34')]));_0x183446[_0xc4c9('0x33')]=_0x183446[_0xc4c9('0x33')][_0xc4c9('0x35')]?_0x183446['attributes']:_0x55f39c['model'];if(!_0x2e2717[_0xc4c9('0x2f')][_0xc4c9('0x36')](_0xc4c9('0x37'))){_0x183446[_0xc4c9('0x20')]=qs[_0xc4c9('0x20')](_0x2e2717['query'][_0xc4c9('0x20')]);_0x183446[_0xc4c9('0x1e')]=qs['offset'](_0x2e2717['query'][_0xc4c9('0x1e')]);}_0x183446[_0xc4c9('0x38')]=qs[_0xc4c9('0x39')](_0x2e2717['query'][_0xc4c9('0x39')]);_0x183446[_0xc4c9('0x3a')]=qs[_0xc4c9('0x30')](_[_0xc4c9('0x3b')](_0x2e2717['query'],_0x55f39c[_0xc4c9('0x30')]),_0x3d2524);if(_0x2e2717[_0xc4c9('0x2f')][_0xc4c9('0x3c')]){_0x183446['where']=_[_0xc4c9('0x3d')](_0x183446['where'],{'$or':_[_0xc4c9('0x2d')](_0x3d2524,function(_0x5ae110){if(_0x5ae110[_0xc4c9('0x3e')]!==_0xc4c9('0x3f')){var _0x1a959c={};_0x1a959c[_0x5ae110[_0xc4c9('0x28')]]={'$like':'%'+_0x2e2717[_0xc4c9('0x2f')]['filter']+'%'};return _0x1a959c;}})});}_0x183446=_[_0xc4c9('0x3d')]({},_0x183446,_0x2e2717[_0xc4c9('0x40')]);var _0x495f96={'where':_0x183446['where']};return db[_0xc4c9('0x2a')]['count'](_0x495f96)['then'](function(_0x3ed364){_0x3ef111[_0xc4c9('0x41')]=_0x3ed364;if(_0x2e2717[_0xc4c9('0x2f')]['includeAll']){_0x183446[_0xc4c9('0x42')]=[{'all':!![]}];}return db['SmsMessage'][_0xc4c9('0x43')](_0x183446);})[_0xc4c9('0x13')](function(_0x5e5b93){_0x3ef111[_0xc4c9('0x44')]=_0x5e5b93;return _0x3ef111;})[_0xc4c9('0x13')](respondWithFilteredResult(_0x1c6071,_0x183446))['catch'](handleError(_0x1c6071,null));};exports['show']=function(_0x1a2572,_0x477094){var _0x5919af={'raw':!![],'where':{'id':_0x1a2572['params']['id']}},_0x277e6={};_0x277e6['model']=_[_0xc4c9('0x2e')](db[_0xc4c9('0x2a')][_0xc4c9('0x2b')]);_0x277e6[_0xc4c9('0x2f')]=_[_0xc4c9('0x2e')](_0x1a2572[_0xc4c9('0x2f')]);_0x277e6[_0xc4c9('0x30')]=_[_0xc4c9('0x31')](_0x277e6[_0xc4c9('0x32')],_0x277e6[_0xc4c9('0x2f')]);_0x5919af[_0xc4c9('0x33')]=_[_0xc4c9('0x31')](_0x277e6['model'],qs['fields'](_0x1a2572[_0xc4c9('0x2f')]['fields']));_0x5919af[_0xc4c9('0x33')]=_0x5919af['attributes'][_0xc4c9('0x35')]?_0x5919af[_0xc4c9('0x33')]:_0x277e6[_0xc4c9('0x32')];if(_0x1a2572[_0xc4c9('0x2f')][_0xc4c9('0x45')]){_0x5919af[_0xc4c9('0x42')]=[{'all':!![]}];}_0x5919af=_[_0xc4c9('0x3d')]({},_0x5919af,_0x1a2572[_0xc4c9('0x40')]);return db[_0xc4c9('0x2a')][_0xc4c9('0x46')](_0x5919af)['then'](handleEntityNotFound(_0x477094,null))['then'](respondWithResult(_0x477094,null))['catch'](handleError(_0x477094,null));};exports[_0xc4c9('0x47')]=function(_0x4bfe10,_0x241889){return db[_0xc4c9('0x2a')][_0xc4c9('0x47')](_0x4bfe10[_0xc4c9('0x48')],{})[_0xc4c9('0x13')](respondWithResult(_0x241889,0xc9))[_0xc4c9('0x49')](handleError(_0x241889,null));};exports[_0xc4c9('0x23')]=function(_0x1138af,_0x5dac04){if(_0x1138af[_0xc4c9('0x48')]['id']){delete _0x1138af[_0xc4c9('0x48')]['id'];}return db[_0xc4c9('0x2a')]['find']({'where':{'id':_0x1138af[_0xc4c9('0x4a')]['id']}})[_0xc4c9('0x13')](handleEntityNotFound(_0x5dac04,null))['then'](saveUpdates(_0x1138af[_0xc4c9('0x48')],null))[_0xc4c9('0x13')](respondWithResult(_0x5dac04,null))[_0xc4c9('0x49')](handleError(_0x5dac04,null));};exports['destroy']=function(_0x1bedc9,_0x3d6569){return db['SmsMessage']['find']({'where':{'id':_0x1bedc9[_0xc4c9('0x4a')]['id']}})[_0xc4c9('0x13')](handleEntityNotFound(_0x3d6569,null))[_0xc4c9('0x13')](removeEntity(_0x3d6569,null))[_0xc4c9('0x49')](handleError(_0x3d6569,null));};exports[_0xc4c9('0x4b')]=function(_0x3d85fa,_0xaeba5){return db[_0xc4c9('0x2a')][_0xc4c9('0x4b')]()['then'](respondWithResult(_0xaeba5,null))[_0xc4c9('0x49')](handleError(_0xaeba5,null));};exports['accept']=function(_0x3fc340,_0x31290b){var _0x9bde41=_0xc4c9('0x4c');return interactionService[_0xc4c9('0x4d')](_0x3fc340,_0x9bde41)[_0xc4c9('0x13')](respondWithResult(_0x31290b,null))[_0xc4c9('0x49')](handleError(_0x31290b,null));};exports[_0xc4c9('0x4e')]=function(_0x491ab1,_0x33eec6){var _0x4df5b0={'agent':{},'channel':_0xc4c9('0x4c')};if(_0x491ab1[_0xc4c9('0x48')]['id']){delete _0x491ab1[_0xc4c9('0x48')]['id'];}_0x491ab1[_0xc4c9('0x48')][_0xc4c9('0x4f')]=_0x491ab1[_0xc4c9('0x48')][_0xc4c9('0x4f')]||_0x491ab1['user']['id'];_0x4df5b0['agent']['id']=_0x491ab1['body'][_0xc4c9('0x4f')];return db[_0xc4c9('0x2a')][_0xc4c9('0x46')]({'where':{'id':_0x491ab1[_0xc4c9('0x4a')]['id'],'UserId':null}})[_0xc4c9('0x13')](handleEntityNotFound(_0x33eec6,null))['then'](function(_0x519ffe){if(_0x519ffe){_0x4df5b0[_0xc4c9('0x1a')]=_0x519ffe['get']({'plain':!![]});return db[_0xc4c9('0x50')]['find']({'where':{'id':_0x519ffe[_0xc4c9('0x51')]}});}return null;})[_0xc4c9('0x13')](handleEntityNotFound(_0x33eec6,null))[_0xc4c9('0x13')](function(_0xc44fa1){if(_0xc44fa1){_0x4df5b0[_0xc4c9('0x52')]=_0xc44fa1[_0xc4c9('0x53')]({'plain':!![]});interaction_log[_0xc4c9('0x14')](_0xc4c9('0x54'),_0x491ab1['user']['id'],_0x491ab1[_0xc4c9('0x55')][_0xc4c9('0x28')],_0x491ab1[_0xc4c9('0x55')]['role'],_0x4df5b0[_0xc4c9('0x52')]['id'],_0x491ab1[_0xc4c9('0x48')]?JSON[_0xc4c9('0x56')](_0x491ab1[_0xc4c9('0x48')]):_0xc4c9('0x57'));return respondWithRpcPromise('RejectMessage',_0xc4c9('0x58'),_0x4df5b0);}return null;})[_0xc4c9('0x13')](function(_0x1ee769){var _0x5bf229=_0xc4c9('0x59')+_0x1ee769[_0xc4c9('0x1a')][_0xc4c9('0x5a')];return db[_0xc4c9('0x5b')][_0xc4c9('0x2f')](_0x5bf229,{'type':db['Sequelize'][_0xc4c9('0x5c')][_0xc4c9('0x5d')],'raw':!![]})[_0xc4c9('0x13')](function(_0x270921){return _0x270921;});})['then'](function(_0x36da85){if(_0x36da85){_0x4df5b0[_0xc4c9('0x1a')][_0xc4c9('0x5e')]=_0x36da85[0x0];if(!_0x491ab1[_0xc4c9('0x48')][_0xc4c9('0x4f')])return;return db[_0xc4c9('0x5f')][_0xc4c9('0x46')]({'where':{'id':_0x491ab1[_0xc4c9('0x48')][_0xc4c9('0x4f')],'role':_0xc4c9('0x60')},'attributes':['id','name','fullname',_0xc4c9('0x61'),_0xc4c9('0x62')],'raw':!![]});}return null;})[_0xc4c9('0x13')](function(_0x60c6){if(!_0x60c6)return null;_0x4df5b0[_0xc4c9('0x1a')]['agent']=_0x60c6;return _0x4df5b0;})[_0xc4c9('0x13')](function(_0x5f2bcd){if(_0x5f2bcd){_0x5f2bcd[_0xc4c9('0x1a')][_0xc4c9('0x63')]=util['format'](_0xc4c9('0x64'),_0x491ab1[_0xc4c9('0x55')][_0xc4c9('0x28')]);_0x5f2bcd['message'][_0xc4c9('0x65')]=_0x4df5b0[_0xc4c9('0x65')];_0x5f2bcd[_0xc4c9('0x1a')][_0xc4c9('0x66')]=_0x4df5b0[_0xc4c9('0x65')];_0x5f2bcd[_0xc4c9('0x1a')][_0xc4c9('0x67')]=_0xc4c9('0x4e');respondWithRpcPromise(_0xc4c9('0x68'),_0xc4c9('0x68'),{'event':_0xc4c9('0x69'),'message':_0x5f2bcd['message']},client9002);return _0x4df5b0;}return null;})[_0xc4c9('0x13')](respondWithResult(_0x33eec6,null))[_0xc4c9('0x49')](handleError(_0x33eec6,null));};exports['status']=function(_0x53df48,_0x23eeee){if(_0x53df48[_0xc4c9('0x48')]['id']){delete _0x53df48[_0xc4c9('0x48')]['id'];}var _0x125295;return db[_0xc4c9('0x2a')][_0xc4c9('0x46')]({'where':{'id':_0x53df48[_0xc4c9('0x4a')]['id']}})[_0xc4c9('0x13')](handleEntityNotFound(_0x23eeee,null))[_0xc4c9('0x13')](function(_0x54213c){if(_0x54213c){_0x125295=_0x54213c;return db[_0xc4c9('0x6a')][_0xc4c9('0x46')]({'where':{'id':_0x54213c[_0xc4c9('0x6b')]}});}})[_0xc4c9('0x13')](handleEntityNotFound(_0x23eeee,null))[_0xc4c9('0x13')](function(_0x43e2c2){if(_0x43e2c2){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc4c9('0x1c'),_0xc4c9('0x6c'),_0x43e2c2['type'],util[_0xc4c9('0x6d')](_0x53df48['body'],{'showHidden':![],'depth':null}));switch(_0x43e2c2['type']){case _0xc4c9('0x6e'):if(_0x53df48['body'][_0xc4c9('0x6f')]&&_0x53df48['body'][_0xc4c9('0x6f')]===_0x125295[_0xc4c9('0x70')]){return _0x125295['update']({'read':!![]});}else{logger[_0xc4c9('0x17')](_0xc4c9('0x71'),_0xc4c9('0x1c'),_0xc4c9('0x6e'),util[_0xc4c9('0x6d')](_0x53df48[_0xc4c9('0x48')],{'showHidden':![],'depth':null}));}break;case _0xc4c9('0x72'):if(_0x53df48['body'][_0xc4c9('0x73')]&&_0x53df48[_0xc4c9('0x48')][_0xc4c9('0x73')]===_0x125295['messageId']&&_['indexOf']([_0xc4c9('0x74'),'delivered'],_0x53df48[_0xc4c9('0x48')]['Status'])>=0x0){return _0x125295[_0xc4c9('0x23')]({'read':!![]});}else{logger[_0xc4c9('0x17')](_0xc4c9('0x71'),'status',_0xc4c9('0x75'),util[_0xc4c9('0x6d')](_0x53df48[_0xc4c9('0x48')],{'showHidden':![],'depth':null}));}break;case _0xc4c9('0x76'):var _0x29e8a6=_0x53df48[_0xc4c9('0x48')][_0xc4c9('0x77')][0x0];if(_0x29e8a6['status'][_0xc4c9('0x78')]==='DELIVERED'){return _0x125295[_0xc4c9('0x23')]({'read':!![]});}else{logger[_0xc4c9('0x17')](_0xc4c9('0x71'),'status',_0xc4c9('0x76'),util[_0xc4c9('0x6d')](_0x53df48[_0xc4c9('0x48')],{'showHidden':![],'depth':null}));}break;}return _0x125295;}})[_0xc4c9('0x13')](respondWithResult(_0x23eeee,null))['catch'](handleError(_0x23eeee,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index d5b7774..1ab8e9e 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 _0xf0ba=['events','../../mysqldb','SmsMessage','save','update','exports'];(function(_0x438aff,_0x2b68c8){var _0x9e6dd9=function(_0x19773e){while(--_0x19773e){_0x438aff['push'](_0x438aff['shift']());}};_0x9e6dd9(++_0x2b68c8);}(_0xf0ba,0x144));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xaf0b('0x0'));var SmsMessage=require(_0xaf0b('0x1'))['db'][_0xaf0b('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaf0b('0x3'),'afterUpdate':_0xaf0b('0x4'),'afterDestroy':'remove'};function emitEvent(_0xc4b5bb){return function(_0xb2d816,_0x40babc,_0x5a8f11){SmsMessageEvents['emit'](_0xc4b5bb+':'+_0xb2d816['id'],_0xb2d816);SmsMessageEvents['emit'](_0xc4b5bb,_0xb2d816);_0x5a8f11(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xaf0b('0x5')]=SmsMessageEvents; \ No newline at end of file +var _0x0269=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','save','update','remove'];(function(_0xd5faf0,_0x3e95cd){var _0x14c14e=function(_0x2cd464){while(--_0x2cd464){_0xd5faf0['push'](_0xd5faf0['shift']());}};_0x14c14e(++_0x3e95cd);}(_0x0269,0xcc));var _0x9026=function(_0x5266e4,_0x3d185e){_0x5266e4=_0x5266e4-0x0;var _0x2ba0d3=_0x0269[_0x5266e4];return _0x2ba0d3;};'use strict';var EventEmitter=require(_0x9026('0x0'));var SmsMessage=require(_0x9026('0x1'))['db'][_0x9026('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9026('0x3'),'afterUpdate':_0x9026('0x4'),'afterDestroy':_0x9026('0x5')};function emitEvent(_0x2a602d){return function(_0xe87e42,_0x49e71d,_0x17d4af){SmsMessageEvents['emit'](_0x2a602d+':'+_0xe87e42['id'],_0xe87e42);SmsMessageEvents[_0x9026('0x6')](_0x2a602d,_0xe87e42);_0x17d4af(null);};}for(var e in events){if(events[_0x9026('0x7')](e)){var event=events[e];SmsMessage[_0x9026('0x8')](e,emitEvent(event));}}module[_0x9026('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 5945ca9..a3c5391 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 _0x687e=['out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','update','createdAt','catch','error','SmsAccount','then','type','twilio','authToken','phone','accountSid','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','GET','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','crypto','apiKey','login','text','timestamp','keys','sort','length','digest','hex','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','message','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','path','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase'];(function(_0x5129e1,_0x4baf70){var _0x58b34e=function(_0x4fd2f7){while(--_0x4fd2f7){_0x5129e1['push'](_0x5129e1['shift']());}};_0x58b34e(++_0x4baf70);}(_0x687e,0x14e));var _0xe687=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x687e[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require(_0xe687('0x0'));var logger=require(_0xe687('0x1'))('api');var moment=require(_0xe687('0x2'));var BPromise=require(_0xe687('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe687('0x4'));var rimraf=require('rimraf');var config=require(_0xe687('0x5'));var attributes=require(_0xe687('0x6'));module[_0xe687('0x7')]=function(_0x4adfe5,_0x1766b8){return _0x4adfe5[_0xe687('0x8')]('SmsMessage',attributes,{'tableName':_0xe687('0x9'),'paranoid':![],'indexes':[{'name':_0xe687('0xa'),'fields':[_0xe687('0xa')]},{'name':_0xe687('0xb'),'fields':[_0xe687('0xc')],'type':_0xe687('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x46d01e,_0x127c76,_0x4f0436){var _0x234d7b=_0x4adfe5['models'];var _0x127413=_0x46d01e[_0xe687('0xe')]({'plain':!![]});if(_0x127413[_0xe687('0xf')][_0xe687('0x10')]()==='in'||_0x127413['direction'][_0xe687('0x10')]()===_0xe687('0x11')&&!_0x127413[_0xe687('0x12')]&&!_[_0xe687('0x13')](_0x127413[_0xe687('0x14')])&&!_['isNil'](_0x127413[_0xe687('0x15')])){_0x234d7b[_0xe687('0x16')][_0xe687('0x17')]({'where':{'id':_0x127413[_0xe687('0x15')]}})['then'](function(_0x23d357){if(_0x23d357){_0x23d357[_0xe687('0x18')]({'lastMsgAt':_0x127413[_0xe687('0x19')],'lastMsgDirection':_0x127413[_0xe687('0xf')][_0xe687('0x10')]()});}})[_0xe687('0x1a')](function(_0x5841f1){console[_0xe687('0x1b')](_0x5841f1);});}if(_0x127413[_0xe687('0xf')]==='out'&&!_0x127413['secret']){var _0x43e273;_0x234d7b[_0xe687('0x1c')]['find']({'where':{'id':_0x127413['SmsAccountId']},'raw':!![]})[_0xe687('0x1d')](function(_0x2d8c1e){_0x43e273=_0x2d8c1e;if(_0x43e273&&_0x43e273[_0xe687('0x1e')]){switch(_0x43e273[_0xe687('0x1e')]){case'twilio':var _0x4177c4=require(_0xe687('0x1f'));if(_0x43e273['accountSid']&&_0x43e273[_0xe687('0x20')]&&_0x43e273[_0xe687('0x21')]){var _0x168982=new _0x4177c4(_0x43e273[_0xe687('0x22')],_0x43e273[_0xe687('0x20')]);_0x168982[_0xe687('0x23')][_0xe687('0x24')]({'body':_0x127413[_0xe687('0xc')],'to':_0x127413[_0xe687('0x21')],'from':_0x43e273[_0xe687('0x21')],'statusCallback':_0x43e273[_0xe687('0x25')]+_0xe687('0x26')+_0x127413['id']+_0xe687('0x27')+_0x43e273[_0xe687('0x28')]})[_0xe687('0x1d')](function(_0x17bfa4){if(_0x17bfa4['sid']){return _0x46d01e[_0xe687('0x18')]({'messageId':_0x17bfa4[_0xe687('0x29')]});}})[_0xe687('0x1a')](function(_0x9a37d7){logger[_0xe687('0x1b')](_0xe687('0x2a'),_0xe687('0x2b'),_0xe687('0x1f'),util['inspect'](_0x9a37d7,{'showHidden':![],'depth':null}));});}else{logger[_0xe687('0x1b')](_0xe687('0x2a'),_0xe687('0x2b'),_0xe687('0x1f'),_0xe687('0x2c'));}break;case _0xe687('0x2d'):var _0x1a8717=_0xe687('0x2e');if(_0x43e273[_0xe687('0x2f')]&&_0x43e273[_0xe687('0x30')]){var _0x4fbb94={'recipient':[_0x127413['phone']],'message':_0x127413[_0xe687('0xc')],'message_type':_0x43e273[_0xe687('0x31')]};if(_0x43e273[_0xe687('0x31')]&&_0x43e273[_0xe687('0x31')]!=='SI'){_0x4fbb94[_0xe687('0x32')]=_0x43e273[_0xe687('0x21')];}var _0x52c065={'url':_0x1a8717+'login?username='+_0x43e273[_0xe687('0x2f')]+'&password='+_0x43e273['password'],'method':_0xe687('0x33')};rp(_0x52c065)['then'](function(_0x550394){var _0x1bca0d=_0x550394['split'](';');var _0x62812d={'user_key':_0x1bca0d[0x0],'session_key':_0x1bca0d[0x1]};_0x52c065={'url':_0x1a8717+'sms','method':_0xe687('0x34'),'headers':{'user_key':_0x62812d[_0xe687('0x35')],'Session_key':_0x62812d[_0xe687('0x36')]},'json':!![],'body':_0x4fbb94};return rp(_0x52c065);})[_0xe687('0x1d')](function(_0x9f65b8){if(_0x9f65b8[_0xe687('0x37')]>=0x1){var _0x2976df={'messageId':_0x9f65b8[_0xe687('0x38')]};if(_0x43e273[_0xe687('0x31')]!=='GP'||!_0x43e273[_0xe687('0x39')]){_0x2976df[_0xe687('0x3a')]=!![];}return _0x46d01e['update'](_0x2976df);}else{return logger[_0xe687('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe687('0x2b'),_0xe687('0x2d'),util[_0xe687('0x3b')](_0x9f65b8,{'showHidden':![],'depth':null}));}})[_0xe687('0x1a')](function(_0x440ae3){return logger[_0xe687('0x1b')](_0xe687('0x2a'),_0xe687('0x2b'),_0xe687('0x2d'),util[_0xe687('0x3b')](_0x440ae3,{'showHidden':![],'depth':null}));});}else{logger[_0xe687('0x1b')](_0xe687('0x2a'),'afterCreate','skebby',_0xe687('0x3c'));}break;case _0xe687('0x3d'):if(_0x43e273[_0xe687('0x20')]){var _0xbb2a22={'recipient':_0x127413['phone'],'message':_0x127413['body'],'sender':_0x43e273[_0xe687('0x3e')]||_0x43e273[_0xe687('0x21')],'authorization':_0x43e273[_0xe687('0x20')]};var _0x127c76={'method':_0xe687('0x34'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0xbb2a22,'json':!![]};rp(_0x127c76)['then'](function(_0x21cfdd){var _0x5839cd={'messageId':_0x21cfdd[_0xe687('0x3f')]};if(!_0x43e273['deliveryReport']){_0x5839cd[_0xe687('0x3a')]=!![];}return _0x46d01e[_0xe687('0x18')](_0x5839cd);})['catch'](function(_0x4dc63d){logger[_0xe687('0x1b')](_0xe687('0x2a'),_0xe687('0x2b'),_0xe687('0x3d'),util[_0xe687('0x3b')](_0x4dc63d,{'showHidden':![],'depth':null}));});}else{logger[_0xe687('0x1b')](_0xe687('0x2a'),_0xe687('0x2b'),_0xe687('0x3d'),'Missing\x20parameters:\x20authToken');}break;case _0xe687('0x40'):if(_0x43e273[_0xe687('0x2f')]&&_0x43e273[_0xe687('0x30')]){var _0xbb2a22={'messages':[{'source':_0xe687('0x41'),'to':_0x127413[_0xe687('0x21')],'body':_0x127413['body'],'from':_0x43e273[_0xe687('0x3e')]||_0x43e273[_0xe687('0x21')]}]};var _0x5f2cd9=util[_0xe687('0x42')](_0xe687('0x43'),_0x43e273['username'],_0x43e273[_0xe687('0x30')]);var _0x127c76={'method':_0xe687('0x34'),'uri':_0xe687('0x44'),'body':_0xbb2a22,'headers':{'Authorization':util[_0xe687('0x42')](_0xe687('0x45'),new Buffer(_0x5f2cd9)[_0xe687('0x46')](_0xe687('0x47')))},'json':!![]};rp(_0x127c76)[_0xe687('0x1d')](function(_0x56461f){if(_0x56461f[_0xe687('0x48')]>=0xc8&&_0x56461f[_0xe687('0x48')]<=0xce){if(_0x56461f[_0xe687('0x49')]&&_0x56461f['data'][_0xe687('0x4a')]>0x0){var _0x4c70d2=_[_0xe687('0x4b')](_0x56461f[_0xe687('0x49')][_0xe687('0x23')]);var _0x3b9b3f={'messageId':_0x4c70d2[_0xe687('0x4c')]};if(!_0x43e273[_0xe687('0x39')]){_0x3b9b3f[_0xe687('0x3a')]=!![];}return _0x46d01e['update'](_0x3b9b3f);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe687('0x2b'),_0xe687('0x4d'),util[_0xe687('0x3b')](_0x56461f,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xe687('0x2a'),_0xe687('0x2b'),_0xe687('0x4d'),util['inspect'](_0x56461f,{'showHidden':![],'depth':null}));}})[_0xe687('0x1a')](function(_0x1cdd92){logger[_0xe687('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe687('0x2b'),'clickSend',util['inspect'](_0x1cdd92,{'showHidden':![],'depth':null}));});}else{logger[_0xe687('0x1b')](_0xe687('0x2a'),_0xe687('0x2b'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case _0xe687('0x4e'):if(_0x43e273[_0xe687('0x4f')]&&_0x43e273[_0xe687('0x20')]){var _0xbb2a22={'dst':_0x127413[_0xe687('0x21')],'text':_0x127413['body'],'src':_0x43e273[_0xe687('0x3e')]||_0x43e273[_0xe687('0x21')],'url':_0x43e273[_0xe687('0x25')]+'/api/sms/messages/'+_0x127413['id']+_0xe687('0x27')+_0x43e273[_0xe687('0x28')]};var _0x5f2cd9=util[_0xe687('0x42')]('%s:%s',_0x43e273[_0xe687('0x4f')],_0x43e273[_0xe687('0x20')]);var _0x127c76={'method':_0xe687('0x34'),'uri':util[_0xe687('0x42')](_0xe687('0x50'),_0x43e273[_0xe687('0x4f')]),'body':_0xbb2a22,'headers':{'Authorization':util[_0xe687('0x42')](_0xe687('0x45'),new Buffer(_0x5f2cd9)[_0xe687('0x46')](_0xe687('0x47')))},'json':!![]};rp(_0x127c76)['then'](function(_0x23db7c){var _0x3f1be7={'messageId':_0x23db7c['message_uuid'][0x0]};return _0x46d01e[_0xe687('0x18')](_0x3f1be7);})['catch'](function(_0x5717b1){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe687('0x2b'),_0xe687('0x4e'),util['inspect'](_0x5717b1,{'showHidden':![],'depth':null}));});}else{logger[_0xe687('0x1b')](_0xe687('0x2a'),_0xe687('0x2b'),_0xe687('0x4e'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xe687('0x51'):if(_0x43e273[_0xe687('0x2f')]&&_0x43e273['password']){if(_0x43e273['baseUrl']){var _0x5ec379={'method':_0xe687('0x34'),'uri':_0x43e273[_0xe687('0x52')]+_0xe687('0x53'),'body':{'username':_0x43e273[_0xe687('0x2f')],'password':_0x43e273['password']},'json':!![]};return rp(_0x5ec379)[_0xe687('0x1d')](function(_0xf4eae8){var _0x673b67={'method':_0xe687('0x34'),'uri':_0x43e273[_0xe687('0x52')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x43e273[_0xe687('0x21')],'destinations':[{'to':_0x127413[_0xe687('0x21')]}],'text':_0x127413[_0xe687('0xc')],'notifyUrl':_0x43e273['remote']+'/api/sms/messages/'+_0x127413['id']+_0xe687('0x27')+_0x43e273[_0xe687('0x28')],'notifyContentType':_0xe687('0x54'),'callbackData':_0x43e273['phone']+';'+_0x127413[_0xe687('0xc')]}]},'headers':{'Authorization':_0xe687('0x55')+_0xf4eae8[_0xe687('0x28')]},'json':!![]};return rp(_0x673b67)[_0xe687('0x1d')](function(_0x29063d){if(_0x29063d[_0xe687('0x23')]){var _0x5c49ad={'messageId':_0x29063d['messages'][0x0][_0xe687('0xa')]};if(!_0x43e273[_0xe687('0x39')]){_0x5c49ad[_0xe687('0x3a')]=!![];}return _0x46d01e[_0xe687('0x18')](_0x5c49ad);}else{return logger[_0xe687('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe687('0x2b'),_0xe687('0x51'),util[_0xe687('0x3b')](_0x29063d,{'showHidden':![],'depth':null}));}});})[_0xe687('0x1a')](function(_0x793ed2){return logger[_0xe687('0x1b')](_0xe687('0x2a'),_0xe687('0x2b'),_0xe687('0x51'),util['inspect'](_0x793ed2,{'showHidden':![],'depth':null}));});}else{logger[_0xe687('0x1b')](_0xe687('0x2a'),_0xe687('0x2b'),_0xe687('0x51'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xe687('0x1b')](_0xe687('0x2a'),_0xe687('0x2b'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x30a1f0=require(_0xe687('0x56'));if(_0x43e273[_0xe687('0x57')]){var _0x3cc973={};_0x3cc973[_0xe687('0x58')]=_0x43e273[_0xe687('0x2f')];_0x3cc973[_0xe687('0x21')]=_0x127413[_0xe687('0x21')];_0x3cc973[_0xe687('0x32')]=_0x43e273['phone'];_0x3cc973[_0xe687('0x59')]=_0x127413[_0xe687('0xc')];_0x3cc973[_0xe687('0x5a')]=+new Date();var _0x5de797='';var _0x4f8f31='';var _0x422397=Object[_0xe687('0x5b')](_0x3cc973);_0x422397[_0xe687('0x5c')]();for(var _0x5547c6=0x0;_0x5547c6<_0x422397[_0xe687('0x5d')];_0x5547c6++){if(_0x5de797!=''){_0x5de797+='&';}_0x5de797+=_0x422397[_0x5547c6]+'='+encodeURIComponent(_0x3cc973[_0x422397[_0x5547c6]]);_0x4f8f31+=_0x3cc973[_0x422397[_0x5547c6]];}_0x4f8f31+=_0x43e273[_0xe687('0x57')];_0x4f8f31=_0x30a1f0['createHash']('md5')['update'](_0x4f8f31)[_0xe687('0x5e')](_0xe687('0x5f'));if(_0x5de797!==''){_0x5de797+='&';}_0x5de797+='signature='+_0x4f8f31;var _0x52c065={'method':'GET','uri':_0x43e273[_0xe687('0x52')]+_0xe687('0x60')+_0x5de797,'json':!![]};return rp(_0x52c065)['then'](function(_0x49e3a0){var _0x44b2d4=Object[_0xe687('0x5b')](_0x49e3a0);if(_0x49e3a0[_0x44b2d4[0x0]]['error']&&parseInt(_0x49e3a0[_0x44b2d4[0x0]][_0xe687('0x1b')])===0x0){var _0x2c65bf={'messageId':_0x49e3a0[_0x44b2d4[0x0]][_0xe687('0x61')]};if(!_0x43e273[_0xe687('0x39')]){_0x2c65bf[_0xe687('0x3a')]=!![];}return _0x46d01e['update'](_0x2c65bf);}else{return logger[_0xe687('0x1b')](_0xe687('0x2a'),'afterCreate',_0xe687('0x62'),util['inspect'](_0x49e3a0['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1bc457){return logger['error'](_0xe687('0x2a'),'afterCreate',_0xe687('0x62'),util[_0xe687('0x3b')](_0x1bc457,{'showHidden':![],'depth':null}));});}else{logger[_0xe687('0x1b')](_0xe687('0x2a'),_0xe687('0x2b'),'csc',_0xe687('0x63'));}break;case _0xe687('0x64'):if(_0x43e273['apiKey']){var _0x59ff2e={'method':'POST','uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x43e273[_0xe687('0x57')]},'body':{'content':_0x127413[_0xe687('0xc')],'to':[_0x127413[_0xe687('0x21')]],'from':_0x43e273[_0xe687('0x21')],'binary':![],'clientMessageId':_0xe687('0x65'),'charset':_0xe687('0x66')},'json':!![]};rp(_0x59ff2e)[_0xe687('0x1d')](function(_0x12c6ca){if(!_0x12c6ca[_0xe687('0x1b')]){var _0x2032fc={'messageId':_0x12c6ca['messages'][0x0][_0xe687('0x67')]};if(!_0x43e273[_0xe687('0x39')]){_0x2032fc[_0xe687('0x3a')]=!![];}return _0x46d01e[_0xe687('0x18')](_0x2032fc);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe687('0x2b'),_0xe687('0x64'),util[_0xe687('0x3b')](_0x12c6ca[_0xe687('0x1b')],{'showHidden':![],'depth':null}));}})[_0xe687('0x1a')](function(_0x1f64cb){return logger[_0xe687('0x1b')](_0xe687('0x2a'),_0xe687('0x2b'),_0xe687('0x64'),util['inspect'](_0x1f64cb,{'showHidden':![],'depth':null}));});}else{logger[_0xe687('0x1b')](_0xe687('0x2a'),_0xe687('0x2b'),'clickatell',_0xe687('0x63'));}break;case _0xe687('0x68'):if(_0x43e273[_0xe687('0x2f')]&&_0x43e273[_0xe687('0x30')]){var _0x5f2cd9=util[_0xe687('0x42')]('%s:%s',_0x43e273['username'],_0x43e273[_0xe687('0x30')]);var _0x127c76={'method':_0xe687('0x34'),'uri':_0xe687('0x69')+_0x43e273['accountId']+_0xe687('0x6a'),'body':{'to':[_0x127413[_0xe687('0x21')]],'text':_0x127413[_0xe687('0xc')],'from':_0x43e273['phone'],'applicationId':_0x43e273[_0xe687('0x6b')]},'headers':{'Authorization':util[_0xe687('0x42')](_0xe687('0x45'),new Buffer(_0x5f2cd9)['toString'](_0xe687('0x47')))},'json':!![]};rp(_0x127c76)[_0xe687('0x1d')](function(_0x1f52a2){if(_0x1f52a2['id']){var _0x35d46b={'messageId':_0x1f52a2['id']};return _0x46d01e['update'](_0x35d46b);}else{logger[_0xe687('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe687('0x2b'),_0xe687('0x68'),util[_0xe687('0x3b')](_0x1f52a2,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1c77b4){logger[_0xe687('0x1b')](_0xe687('0x2a'),_0xe687('0x2b'),_0xe687('0x68'),util[_0xe687('0x3b')](_0x1c77b4,{'showHidden':![],'depth':null}));});}else{logger[_0xe687('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe687('0x2b'),_0xe687('0x68'),_0xe687('0x3c'));}break;case _0xe687('0x6c'):if(_0x43e273[_0xe687('0x57')]){var _0x38aa9d={};var _0x52c065={'method':'POST','uri':_0xe687('0x6d'),'headers':{'Authorization':_0xe687('0x6e')+_0x43e273[_0xe687('0x57')],'Content-Type':_0xe687('0x54')},'body':{'from':_0x43e273[_0xe687('0x21')],'to':_0x127413[_0xe687('0x21')],'text':_0x127413[_0xe687('0xc')]},'json':!![]};return rp(_0x52c065)['then'](function(_0x31053e){if(_0x31053e['code']==0xca){_0x38aa9d['message']=_0x31053e;var _0x146411={'method':_0xe687('0x34'),'uri':_0xe687('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0x43e273[_0xe687('0x57')],'Content-Type':_0xe687('0x54')},'body':{'refid':_0x38aa9d['message'][_0xe687('0x70')]},'json':!![]};return rp(_0x146411)['then'](function(_0x1707ef){_0x38aa9d['status']=_0x1707ef;var _0x472ae5={'messageId':_0x38aa9d[_0xe687('0x71')][_0xe687('0x70')],'read':!![]};return _0x46d01e['update'](_0x472ae5);});}else{return logger['error'](_0xe687('0x2a'),_0xe687('0x2b'),'intelepeer',util[_0xe687('0x3b')](_0x31053e,{'showHidden':![],'depth':null}));}})[_0xe687('0x1a')](function(_0x3f4162){return logger[_0xe687('0x1b')](_0xe687('0x2a'),_0xe687('0x2b'),_0xe687('0x6c'),util[_0xe687('0x3b')](_0x3f4162,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xe687('0x2a'),_0xe687('0x2b'),_0xe687('0x6c'),'Token\x20not\x20received');}break;}}})[_0xe687('0x72')](function(){_0x4f0436();});}else{_0x4f0436();}}},'charset':_0xe687('0x73'),'collate':_0xe687('0x74')});}; \ No newline at end of file +var _0x6677=['connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','read','catch','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','clickSend','plivo','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','csc','crypto','apiKey','login','text','keys','sort','createHash','md5','hex','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','status','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SmsMessage','messageId','body','FULLTEXT','get','direction','toLowerCase','out','UserId','SmsInteractionId','SmsInteraction','findOne','createdAt','error','secret','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','token','then','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','skebby','username','smsMethod','login?username=','&password=','password','GET','user_key','session_key','total_sent','internal_order_id','deliveryReport','Missing\x20parameters:\x20username,\x20password'];(function(_0x3b6aea,_0x753010){var _0x441514=function(_0x1cb659){while(--_0x1cb659){_0x3b6aea['push'](_0x3b6aea['shift']());}};_0x441514(++_0x753010);}(_0x6677,0x1a0));var _0x7667=function(_0x2e4310,_0x418105){_0x2e4310=_0x2e4310-0x0;var _0x2bf4cb=_0x6677[_0x2e4310];return _0x2bf4cb;};'use strict';var _=require(_0x7667('0x0'));var util=require(_0x7667('0x1'));var logger=require(_0x7667('0x2'))(_0x7667('0x3'));var moment=require(_0x7667('0x4'));var BPromise=require(_0x7667('0x5'));var rp=require(_0x7667('0x6'));var fs=require('fs');var path=require(_0x7667('0x7'));var rimraf=require(_0x7667('0x8'));var config=require(_0x7667('0x9'));var attributes=require('./smsMessage.attributes');module[_0x7667('0xa')]=function(_0x28ddaa,_0x11e776){return _0x28ddaa['define'](_0x7667('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x7667('0xc')]},{'name':'fti_sms_messages','fields':[_0x7667('0xd')],'type':_0x7667('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a7de0,_0x20242f,_0x58e071){var _0x10acc0=_0x28ddaa['models'];var _0x1c0ef0=_0x1a7de0[_0x7667('0xf')]({'plain':!![]});if(_0x1c0ef0[_0x7667('0x10')][_0x7667('0x11')]()==='in'||_0x1c0ef0['direction'][_0x7667('0x11')]()===_0x7667('0x12')&&!_0x1c0ef0['secret']&&!_['isNil'](_0x1c0ef0[_0x7667('0x13')])&&!_['isNil'](_0x1c0ef0[_0x7667('0x14')])){_0x10acc0[_0x7667('0x15')][_0x7667('0x16')]({'where':{'id':_0x1c0ef0['SmsInteractionId']}})['then'](function(_0xb34809){if(_0xb34809){_0xb34809['update']({'lastMsgAt':_0x1c0ef0[_0x7667('0x17')],'lastMsgDirection':_0x1c0ef0[_0x7667('0x10')][_0x7667('0x11')]()});}})['catch'](function(_0x233f71){console[_0x7667('0x18')](_0x233f71);});}if(_0x1c0ef0[_0x7667('0x10')]===_0x7667('0x12')&&!_0x1c0ef0[_0x7667('0x19')]){var _0x564f42;_0x10acc0['SmsAccount']['find']({'where':{'id':_0x1c0ef0[_0x7667('0x1a')]},'raw':!![]})['then'](function(_0x5229d8){_0x564f42=_0x5229d8;if(_0x564f42&&_0x564f42[_0x7667('0x1b')]){switch(_0x564f42['type']){case'twilio':var _0x193b32=require(_0x7667('0x1c'));if(_0x564f42[_0x7667('0x1d')]&&_0x564f42[_0x7667('0x1e')]&&_0x564f42[_0x7667('0x1f')]){var _0x3fea75=new _0x193b32(_0x564f42['accountSid'],_0x564f42[_0x7667('0x1e')]);_0x3fea75[_0x7667('0x20')][_0x7667('0x21')]({'body':_0x1c0ef0[_0x7667('0xd')],'to':_0x1c0ef0[_0x7667('0x1f')],'from':_0x564f42['phone'],'statusCallback':_0x564f42[_0x7667('0x22')]+_0x7667('0x23')+_0x1c0ef0['id']+'/status?token='+_0x564f42[_0x7667('0x24')]})[_0x7667('0x25')](function(_0x8942c3){if(_0x8942c3[_0x7667('0x26')]){return _0x1a7de0[_0x7667('0x27')]({'messageId':_0x8942c3['sid']});}})['catch'](function(_0xbb659f){logger[_0x7667('0x18')](_0x7667('0x28'),'afterCreate',_0x7667('0x1c'),util[_0x7667('0x29')](_0xbb659f,{'showHidden':![],'depth':null}));});}else{logger[_0x7667('0x18')](_0x7667('0x28'),_0x7667('0x2a'),_0x7667('0x1c'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x7667('0x2b'):var _0x685912='https://api.skebby.it/API/v1.0/REST/';if(_0x564f42[_0x7667('0x2c')]&&_0x564f42['password']){var _0x5d947c={'recipient':[_0x1c0ef0['phone']],'message':_0x1c0ef0[_0x7667('0xd')],'message_type':_0x564f42[_0x7667('0x2d')]};if(_0x564f42['smsMethod']&&_0x564f42['smsMethod']!=='SI'){_0x5d947c['sender']=_0x564f42[_0x7667('0x1f')];}var _0x195384={'url':_0x685912+_0x7667('0x2e')+_0x564f42[_0x7667('0x2c')]+_0x7667('0x2f')+_0x564f42[_0x7667('0x30')],'method':_0x7667('0x31')};rp(_0x195384)[_0x7667('0x25')](function(_0xa8d482){var _0x103ee7=_0xa8d482['split'](';');var _0x29a266={'user_key':_0x103ee7[0x0],'session_key':_0x103ee7[0x1]};_0x195384={'url':_0x685912+'sms','method':'POST','headers':{'user_key':_0x29a266[_0x7667('0x32')],'Session_key':_0x29a266[_0x7667('0x33')]},'json':!![],'body':_0x5d947c};return rp(_0x195384);})['then'](function(_0x52f5bf){if(_0x52f5bf[_0x7667('0x34')]>=0x1){var _0xd5e71b={'messageId':_0x52f5bf[_0x7667('0x35')]};if(_0x564f42[_0x7667('0x2d')]!=='GP'||!_0x564f42[_0x7667('0x36')]){_0xd5e71b['read']=!![];}return _0x1a7de0[_0x7667('0x27')](_0xd5e71b);}else{return logger[_0x7667('0x18')](_0x7667('0x28'),'afterCreate','skebby',util[_0x7667('0x29')](_0x52f5bf,{'showHidden':![],'depth':null}));}})['catch'](function(_0xb791d7){return logger[_0x7667('0x18')](_0x7667('0x28'),_0x7667('0x2a'),_0x7667('0x2b'),util['inspect'](_0xb791d7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7667('0x28'),_0x7667('0x2a'),'skebby',_0x7667('0x37'));}break;case _0x7667('0x38'):if(_0x564f42[_0x7667('0x1e')]){var _0x23fabe={'recipient':_0x1c0ef0[_0x7667('0x1f')],'message':_0x1c0ef0[_0x7667('0xd')],'sender':_0x564f42[_0x7667('0x39')]||_0x564f42[_0x7667('0x1f')],'authorization':_0x564f42['authToken']};var _0x20242f={'method':_0x7667('0x3a'),'uri':_0x7667('0x3b'),'body':_0x23fabe,'json':!![]};rp(_0x20242f)['then'](function(_0x112dcf){var _0x4cc1ca={'messageId':_0x112dcf[_0x7667('0x3c')]};if(!_0x564f42[_0x7667('0x36')]){_0x4cc1ca[_0x7667('0x3d')]=!![];}return _0x1a7de0[_0x7667('0x27')](_0x4cc1ca);})[_0x7667('0x3e')](function(_0x13b0a4){logger['error'](_0x7667('0x28'),_0x7667('0x2a'),_0x7667('0x38'),util[_0x7667('0x29')](_0x13b0a4,{'showHidden':![],'depth':null}));});}else{logger[_0x7667('0x18')](_0x7667('0x28'),_0x7667('0x2a'),_0x7667('0x38'),_0x7667('0x3f'));}break;case _0x7667('0x40'):if(_0x564f42['username']&&_0x564f42['password']){var _0x23fabe={'messages':[{'source':_0x7667('0x41'),'to':_0x1c0ef0[_0x7667('0x1f')],'body':_0x1c0ef0[_0x7667('0xd')],'from':_0x564f42[_0x7667('0x39')]||_0x564f42[_0x7667('0x1f')]}]};var _0x118f01=util[_0x7667('0x42')](_0x7667('0x43'),_0x564f42['username'],_0x564f42[_0x7667('0x30')]);var _0x20242f={'method':_0x7667('0x3a'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x23fabe,'headers':{'Authorization':util[_0x7667('0x42')](_0x7667('0x44'),new Buffer(_0x118f01)[_0x7667('0x45')](_0x7667('0x46')))},'json':!![]};rp(_0x20242f)[_0x7667('0x25')](function(_0x29fda2){if(_0x29fda2[_0x7667('0x47')]>=0xc8&&_0x29fda2[_0x7667('0x47')]<=0xce){if(_0x29fda2['data']&&_0x29fda2[_0x7667('0x48')][_0x7667('0x49')]>0x0){var _0x4dc49b=_['head'](_0x29fda2[_0x7667('0x48')]['messages']);var _0x4d3d6f={'messageId':_0x4dc49b[_0x7667('0x4a')]};if(!_0x564f42[_0x7667('0x36')]){_0x4d3d6f['read']=!![];}return _0x1a7de0[_0x7667('0x27')](_0x4d3d6f);}else{logger[_0x7667('0x18')](_0x7667('0x28'),_0x7667('0x2a'),_0x7667('0x4b'),util[_0x7667('0x29')](_0x29fda2,{'showHidden':![],'depth':null}));}}else{logger[_0x7667('0x18')](_0x7667('0x28'),_0x7667('0x2a'),'clickSend',util[_0x7667('0x29')](_0x29fda2,{'showHidden':![],'depth':null}));}})[_0x7667('0x3e')](function(_0x274e44){logger[_0x7667('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7667('0x2a'),_0x7667('0x4b'),util[_0x7667('0x29')](_0x274e44,{'showHidden':![],'depth':null}));});}else{logger[_0x7667('0x18')](_0x7667('0x28'),_0x7667('0x2a'),'clickSend',_0x7667('0x37'));}break;case _0x7667('0x4c'):if(_0x564f42[_0x7667('0x4d')]&&_0x564f42[_0x7667('0x1e')]){var _0x23fabe={'dst':_0x1c0ef0['phone'],'text':_0x1c0ef0[_0x7667('0xd')],'src':_0x564f42[_0x7667('0x39')]||_0x564f42[_0x7667('0x1f')],'url':_0x564f42[_0x7667('0x22')]+_0x7667('0x23')+_0x1c0ef0['id']+_0x7667('0x4e')+_0x564f42['token']};var _0x118f01=util[_0x7667('0x42')]('%s:%s',_0x564f42['authId'],_0x564f42[_0x7667('0x1e')]);var _0x20242f={'method':'POST','uri':util['format'](_0x7667('0x4f'),_0x564f42[_0x7667('0x4d')]),'body':_0x23fabe,'headers':{'Authorization':util[_0x7667('0x42')](_0x7667('0x44'),new Buffer(_0x118f01)['toString']('base64'))},'json':!![]};rp(_0x20242f)[_0x7667('0x25')](function(_0x28e664){var _0x3ea376={'messageId':_0x28e664['message_uuid'][0x0]};return _0x1a7de0['update'](_0x3ea376);})[_0x7667('0x3e')](function(_0x307423){logger[_0x7667('0x18')](_0x7667('0x28'),_0x7667('0x2a'),'plivo',util[_0x7667('0x29')](_0x307423,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7667('0x28'),_0x7667('0x2a'),_0x7667('0x4c'),_0x7667('0x50'));}break;case _0x7667('0x51'):if(_0x564f42['username']&&_0x564f42[_0x7667('0x30')]){if(_0x564f42[_0x7667('0x52')]){var _0x1b876b={'method':_0x7667('0x3a'),'uri':_0x564f42['baseUrl']+_0x7667('0x53'),'body':{'username':_0x564f42['username'],'password':_0x564f42[_0x7667('0x30')]},'json':!![]};return rp(_0x1b876b)[_0x7667('0x25')](function(_0xefe866){var _0x91ab01={'method':_0x7667('0x3a'),'uri':_0x564f42[_0x7667('0x52')]+_0x7667('0x54'),'body':{'messages':[{'from':_0x564f42['phone'],'destinations':[{'to':_0x1c0ef0[_0x7667('0x1f')]}],'text':_0x1c0ef0[_0x7667('0xd')],'notifyUrl':_0x564f42[_0x7667('0x22')]+'/api/sms/messages/'+_0x1c0ef0['id']+_0x7667('0x4e')+_0x564f42[_0x7667('0x24')],'notifyContentType':_0x7667('0x55'),'callbackData':_0x564f42['phone']+';'+_0x1c0ef0[_0x7667('0xd')]}]},'headers':{'Authorization':'IBSSO\x20'+_0xefe866['token']},'json':!![]};return rp(_0x91ab01)[_0x7667('0x25')](function(_0x1e733a){if(_0x1e733a[_0x7667('0x20')]){var _0x4a6552={'messageId':_0x1e733a[_0x7667('0x20')][0x0][_0x7667('0xc')]};if(!_0x564f42[_0x7667('0x36')]){_0x4a6552[_0x7667('0x3d')]=!![];}return _0x1a7de0[_0x7667('0x27')](_0x4a6552);}else{return logger['error'](_0x7667('0x28'),_0x7667('0x2a'),_0x7667('0x51'),util[_0x7667('0x29')](_0x1e733a,{'showHidden':![],'depth':null}));}});})[_0x7667('0x3e')](function(_0x4c5926){return logger[_0x7667('0x18')](_0x7667('0x28'),'afterCreate',_0x7667('0x51'),util[_0x7667('0x29')](_0x4c5926,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7667('0x28'),_0x7667('0x2a'),_0x7667('0x51'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x7667('0x18')](_0x7667('0x28'),_0x7667('0x2a'),_0x7667('0x51'),_0x7667('0x37'));}break;case _0x7667('0x56'):var _0x501baa=require(_0x7667('0x57'));if(_0x564f42[_0x7667('0x58')]){var _0x41e8bd={};_0x41e8bd[_0x7667('0x59')]=_0x564f42[_0x7667('0x2c')];_0x41e8bd['phone']=_0x1c0ef0[_0x7667('0x1f')];_0x41e8bd['sender']=_0x564f42[_0x7667('0x1f')];_0x41e8bd[_0x7667('0x5a')]=_0x1c0ef0[_0x7667('0xd')];_0x41e8bd['timestamp']=+new Date();var _0x225033='';var _0x18afd0='';var _0x4d59cd=Object[_0x7667('0x5b')](_0x41e8bd);_0x4d59cd[_0x7667('0x5c')]();for(var _0x28a5a0=0x0;_0x28a5a0<_0x4d59cd['length'];_0x28a5a0++){if(_0x225033!=''){_0x225033+='&';}_0x225033+=_0x4d59cd[_0x28a5a0]+'='+encodeURIComponent(_0x41e8bd[_0x4d59cd[_0x28a5a0]]);_0x18afd0+=_0x41e8bd[_0x4d59cd[_0x28a5a0]];}_0x18afd0+=_0x564f42[_0x7667('0x58')];_0x18afd0=_0x501baa[_0x7667('0x5d')](_0x7667('0x5e'))[_0x7667('0x27')](_0x18afd0)['digest'](_0x7667('0x5f'));if(_0x225033!==''){_0x225033+='&';}_0x225033+='signature='+_0x18afd0;var _0x195384={'method':_0x7667('0x31'),'uri':_0x564f42['baseUrl']+_0x7667('0x60')+_0x225033,'json':!![]};return rp(_0x195384)['then'](function(_0xca710e){var _0x38a020=Object['keys'](_0xca710e);if(_0xca710e[_0x38a020[0x0]][_0x7667('0x18')]&&parseInt(_0xca710e[_0x38a020[0x0]][_0x7667('0x18')])===0x0){var _0x3efb69={'messageId':_0xca710e[_0x38a020[0x0]]['id_sms']};if(!_0x564f42[_0x7667('0x36')]){_0x3efb69[_0x7667('0x3d')]=!![];}return _0x1a7de0[_0x7667('0x27')](_0x3efb69);}else{return logger[_0x7667('0x18')](_0x7667('0x28'),'afterCreate',_0x7667('0x56'),util[_0x7667('0x29')](_0xca710e[_0x7667('0x18')],{'showHidden':![],'depth':null}));}})[_0x7667('0x3e')](function(_0x45ec13){return logger[_0x7667('0x18')](_0x7667('0x28'),_0x7667('0x2a'),'csc',util['inspect'](_0x45ec13,{'showHidden':![],'depth':null}));});}else{logger[_0x7667('0x18')](_0x7667('0x28'),_0x7667('0x2a'),_0x7667('0x56'),_0x7667('0x61'));}break;case _0x7667('0x62'):if(_0x564f42[_0x7667('0x58')]){var _0x5c43bf={'method':_0x7667('0x3a'),'uri':_0x7667('0x63'),'headers':{'Authorization':_0x564f42[_0x7667('0x58')]},'body':{'content':_0x1c0ef0[_0x7667('0xd')],'to':[_0x1c0ef0[_0x7667('0x1f')]],'from':_0x564f42[_0x7667('0x1f')],'binary':![],'clientMessageId':_0x7667('0x64'),'charset':_0x7667('0x65')},'json':!![]};rp(_0x5c43bf)[_0x7667('0x25')](function(_0xc9d020){if(!_0xc9d020['error']){var _0x4c0960={'messageId':_0xc9d020[_0x7667('0x20')][0x0][_0x7667('0x66')]};if(!_0x564f42['deliveryReport']){_0x4c0960[_0x7667('0x3d')]=!![];}return _0x1a7de0['update'](_0x4c0960);}else{return logger['error'](_0x7667('0x28'),_0x7667('0x2a'),'clickatell',util['inspect'](_0xc9d020['error'],{'showHidden':![],'depth':null}));}})[_0x7667('0x3e')](function(_0x42b6fb){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7667('0x2a'),_0x7667('0x62'),util[_0x7667('0x29')](_0x42b6fb,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7667('0x62'),_0x7667('0x61'));}break;case'bandwidth':if(_0x564f42[_0x7667('0x2c')]&&_0x564f42[_0x7667('0x30')]){var _0x118f01=util['format'](_0x7667('0x43'),_0x564f42[_0x7667('0x2c')],_0x564f42[_0x7667('0x30')]);var _0x20242f={'method':'POST','uri':_0x7667('0x67')+_0x564f42[_0x7667('0x68')]+_0x7667('0x69'),'body':{'to':[_0x1c0ef0[_0x7667('0x1f')]],'text':_0x1c0ef0[_0x7667('0xd')],'from':_0x564f42[_0x7667('0x1f')],'applicationId':_0x564f42[_0x7667('0x6a')]},'headers':{'Authorization':util[_0x7667('0x42')](_0x7667('0x44'),new Buffer(_0x118f01)['toString'](_0x7667('0x46')))},'json':!![]};rp(_0x20242f)[_0x7667('0x25')](function(_0x51e679){if(_0x51e679['id']){var _0x59f3d4={'messageId':_0x51e679['id']};return _0x1a7de0[_0x7667('0x27')](_0x59f3d4);}else{logger[_0x7667('0x18')](_0x7667('0x28'),_0x7667('0x2a'),_0x7667('0x6b'),util[_0x7667('0x29')](_0x51e679,{'showHidden':![],'depth':null}));}})[_0x7667('0x3e')](function(_0x4283a1){logger['error'](_0x7667('0x28'),_0x7667('0x2a'),'bandwidth',util[_0x7667('0x29')](_0x4283a1,{'showHidden':![],'depth':null}));});}else{logger[_0x7667('0x18')](_0x7667('0x28'),_0x7667('0x2a'),_0x7667('0x6b'),_0x7667('0x37'));}break;case _0x7667('0x6c'):if(_0x564f42[_0x7667('0x58')]){var _0x2db5e6={};var _0x195384={'method':'POST','uri':_0x7667('0x6d'),'headers':{'Authorization':_0x7667('0x6e')+_0x564f42[_0x7667('0x58')],'Content-Type':_0x7667('0x55')},'body':{'from':_0x564f42[_0x7667('0x1f')],'to':_0x1c0ef0[_0x7667('0x1f')],'text':_0x1c0ef0[_0x7667('0xd')]},'json':!![]};return rp(_0x195384)[_0x7667('0x25')](function(_0x5776e0){if(_0x5776e0[_0x7667('0x6f')]==0xca){_0x2db5e6[_0x7667('0x70')]=_0x5776e0;var _0x423b82={'method':_0x7667('0x3a'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x564f42['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x2db5e6[_0x7667('0x70')][_0x7667('0x71')]},'json':!![]};return rp(_0x423b82)[_0x7667('0x25')](function(_0x184f82){_0x2db5e6[_0x7667('0x72')]=_0x184f82;var _0xfb217b={'messageId':_0x2db5e6[_0x7667('0x70')][_0x7667('0x71')],'read':!![]};return _0x1a7de0[_0x7667('0x27')](_0xfb217b);});}else{return logger[_0x7667('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7667('0x2a'),'intelepeer',util[_0x7667('0x29')](_0x5776e0,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2e2360){return logger[_0x7667('0x18')](_0x7667('0x28'),_0x7667('0x2a'),'intelepeer',util[_0x7667('0x29')](_0x2e2360,{'showHidden':![],'depth':null}));});}else{return logger[_0x7667('0x18')](_0x7667('0x28'),_0x7667('0x2a'),_0x7667('0x6c'),_0x7667('0x73'));}break;}}})[_0x7667('0x74')](function(){_0x58e071();});}else{_0x58e071();}}},'charset':'utf8mb4','collate':_0x7667('0x75')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index b8d6811..ce55197 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 _0x349d=['error','code','SmsMessage,\x20%s,\x20%s','message','info','catch','SmsMessage','options','then','CreateSmsMessage','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./smsMessage.socket','request','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3bceea,_0x58af75){var _0x30a8d3=function(_0x1550b5){while(--_0x1550b5){_0x3bceea['push'](_0x3bceea['shift']());}};_0x30a8d3(++_0x58af75);}(_0x349d,0xe2));var _0xd349=function(_0xf34bcf,_0x41d6be){_0xf34bcf=_0xf34bcf-0x0;var _0x2b733b=_0x349d[_0xf34bcf];return _0x2b733b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd349('0x0'));var BPromise=require(_0xd349('0x1'));var rs=require(_0xd349('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd349('0x3'))['db'];var utils=require(_0xd349('0x4'));var logger=require('../../config/logger')(_0xd349('0x5'));var config=require(_0xd349('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd349('0x7')]({'port':0x232a});config[_0xd349('0x8')]=_['defaults'](config[_0xd349('0x8')],{'host':_0xd349('0x9'),'port':0x18eb});var socket=require(_0xd349('0xa'))(new Redis(config[_0xd349('0x8')]));require(_0xd349('0xb'))['register'](socket);function respondWithRpcPromise(_0x52f879,_0x24b3a6,_0x4d404a){return new BPromise(function(_0x2d1847,_0x1f5745){return client[_0xd349('0xc')](_0x52f879,_0x4d404a)['then'](function(_0x30b201){logger['info']('SmsMessage,\x20%s,\x20%s',_0x24b3a6,_0xd349('0xd'));logger[_0xd349('0xe')](_0xd349('0xf'),_0x24b3a6,_0xd349('0xd'),JSON[_0xd349('0x10')](_0x30b201));if(_0x30b201[_0xd349('0x11')]){if(_0x30b201[_0xd349('0x11')][_0xd349('0x12')]===0x1f4){logger[_0xd349('0x11')](_0xd349('0x13'),_0x24b3a6,_0x30b201[_0xd349('0x11')][_0xd349('0x14')]);return _0x1f5745(_0x30b201['error'][_0xd349('0x14')]);}logger['error'](_0xd349('0x13'),_0x24b3a6,_0x30b201[_0xd349('0x11')][_0xd349('0x14')]);return _0x2d1847(_0x30b201[_0xd349('0x11')][_0xd349('0x14')]);}else{logger[_0xd349('0x15')](_0xd349('0x13'),_0x24b3a6,_0xd349('0xd'));_0x2d1847(_0x30b201['result']['message']);}})[_0xd349('0x16')](function(_0x598b17){logger[_0xd349('0x11')]('SmsMessage,\x20%s,\x20%s',_0x24b3a6,_0x598b17);_0x1f5745(_0x598b17);});});}exports['CreateSmsMessage']=function(_0x9a431){var _0x395582=this;return new Promise(function(_0x1f4196,_0x307442){return db[_0xd349('0x17')]['create'](_0x9a431['body'],{'raw':_0x9a431['options']?_0x9a431[_0xd349('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xd349('0x19')](function(_0x4b8771){logger[_0xd349('0x15')](_0xd349('0x1a'),_0x9a431);logger[_0xd349('0xe')]('CreateSmsMessage',_0x9a431,JSON['stringify'](_0x4b8771));_0x1f4196(_0x4b8771);})[_0xd349('0x16')](function(_0x5af082){logger['error'](_0xd349('0x1a'),_0x5af082[_0xd349('0x14')],_0x9a431);_0x307442(_0x395582['error'](0x1f4,_0x5af082[_0xd349('0x14')]));});});}; \ No newline at end of file +var _0x31ca=['SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSmsMessage','create','body','options','then','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','register','info'];(function(_0x34dfb3,_0x401d83){var _0x224c88=function(_0x13a24a){while(--_0x13a24a){_0x34dfb3['push'](_0x34dfb3['shift']());}};_0x224c88(++_0x401d83);}(_0x31ca,0xb3));var _0xa31c=function(_0x2da2a1,_0x55050e){_0x2da2a1=_0x2da2a1-0x0;var _0x10b804=_0x31ca[_0x2da2a1];return _0x10b804;};'use strict';var _=require(_0xa31c('0x0'));var util=require(_0xa31c('0x1'));var moment=require(_0xa31c('0x2'));var BPromise=require(_0xa31c('0x3'));var rs=require(_0xa31c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa31c('0x5'))['db'];var utils=require(_0xa31c('0x6'));var logger=require(_0xa31c('0x7'))(_0xa31c('0x8'));var config=require(_0xa31c('0x9'));var jayson=require(_0xa31c('0xa'));var client=jayson[_0xa31c('0xb')][_0xa31c('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa31c('0xd')],{'host':_0xa31c('0xe'),'port':0x18eb});var socket=require(_0xa31c('0xf'))(new Redis(config['redis']));require(_0xa31c('0x10'))[_0xa31c('0x11')](socket);function respondWithRpcPromise(_0x76b616,_0xc30310,_0x8eb992){return new BPromise(function(_0x5f3beb,_0x137f72){return client['request'](_0x76b616,_0x8eb992)['then'](function(_0x3c8e19){logger[_0xa31c('0x12')](_0xa31c('0x13'),_0xc30310,'request\x20sent');logger['debug'](_0xa31c('0x14'),_0xc30310,_0xa31c('0x15'),JSON[_0xa31c('0x16')](_0x3c8e19));if(_0x3c8e19['error']){if(_0x3c8e19[_0xa31c('0x17')][_0xa31c('0x18')]===0x1f4){logger[_0xa31c('0x17')](_0xa31c('0x13'),_0xc30310,_0x3c8e19['error'][_0xa31c('0x19')]);return _0x137f72(_0x3c8e19['error']['message']);}logger[_0xa31c('0x17')]('SmsMessage,\x20%s,\x20%s',_0xc30310,_0x3c8e19[_0xa31c('0x17')][_0xa31c('0x19')]);return _0x5f3beb(_0x3c8e19[_0xa31c('0x17')][_0xa31c('0x19')]);}else{logger[_0xa31c('0x12')](_0xa31c('0x13'),_0xc30310,_0xa31c('0x15'));_0x5f3beb(_0x3c8e19['result'][_0xa31c('0x19')]);}})[_0xa31c('0x1a')](function(_0x30e05e){logger[_0xa31c('0x17')](_0xa31c('0x13'),_0xc30310,_0x30e05e);_0x137f72(_0x30e05e);});});}exports[_0xa31c('0x1b')]=function(_0xab485c){var _0x2978cb=this;return new Promise(function(_0x4dc79a,_0x1e510e){return db['SmsMessage'][_0xa31c('0x1c')](_0xab485c[_0xa31c('0x1d')],{'raw':_0xab485c[_0xa31c('0x1e')]?_0xab485c[_0xa31c('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xa31c('0x1f')](function(_0x1eb65b){logger['info'](_0xa31c('0x1b'),_0xab485c);logger[_0xa31c('0x20')](_0xa31c('0x1b'),_0xab485c,JSON[_0xa31c('0x16')](_0x1eb65b));_0x4dc79a(_0x1eb65b);})['catch'](function(_0x288dee){logger[_0xa31c('0x17')]('CreateSmsMessage',_0x288dee[_0xa31c('0x19')],_0xab485c);_0x1e510e(_0x2978cb['error'](0x1f4,_0x288dee[_0xa31c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 8c8a03b..7b1c38c 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 _0x0f43=['emit','removeListener','register','length','smsMessage:','remove','update'];(function(_0x4bc84a,_0x5772f2){var _0x3538b1=function(_0x1fb82d){while(--_0x1fb82d){_0x4bc84a['push'](_0x4bc84a['shift']());}};_0x3538b1(++_0x5772f2);}(_0x0f43,0xa6));var _0x30f4=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x0f43[_0x5f309e];return _0x487b5e;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0x30f4('0x0'),_0x30f4('0x1')];function createListener(_0x31ba59,_0x321720){return function(_0x24cf76){_0x321720[_0x30f4('0x2')](_0x31ba59,_0x24cf76);};}function removeListener(_0x2aa5ae,_0x14b553){return function(){SmsMessageEvents[_0x30f4('0x3')](_0x2aa5ae,_0x14b553);};}exports[_0x30f4('0x4')]=function(_0x172161){for(var _0x5bf4b8=0x0,_0x4a3ff2=events[_0x30f4('0x5')];_0x5bf4b8<_0x4a3ff2;_0x5bf4b8++){var _0x1bc10e=events[_0x5bf4b8];var _0x5d93ce=createListener(_0x30f4('0x6')+_0x1bc10e,_0x172161);SmsMessageEvents['on'](_0x1bc10e,_0x5d93ce);}}; \ No newline at end of file +var _0xe818=['length','smsMessage:','remove','update','emit','removeListener'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0xe818,0x110));var _0x8e81=function(_0x4dae57,_0x1cdc84){_0x4dae57=_0x4dae57-0x0;var _0x5b247d=_0xe818[_0x4dae57];return _0x5b247d;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0x8e81('0x0'),_0x8e81('0x1')];function createListener(_0x531a06,_0x5cfc2c){return function(_0x2d9ccc){_0x5cfc2c[_0x8e81('0x2')](_0x531a06,_0x2d9ccc);};}function removeListener(_0x3242b7,_0x234452){return function(){SmsMessageEvents[_0x8e81('0x3')](_0x3242b7,_0x234452);};}exports['register']=function(_0x450f84){for(var _0x58cc0b=0x0,_0x5ef269=events[_0x8e81('0x4')];_0x58cc0b<_0x5ef269;_0x58cc0b++){var _0x47af47=events[_0x58cc0b];var _0x3e3164=createListener(_0x8e81('0x5')+_0x47af47,_0x450f84);SmsMessageEvents['on'](_0x47af47,_0x3e3164);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index e2cf3ef..d2e7a65 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 _0xe4f6=['post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','describe','show','/:id/teams','getAgents'];(function(_0x4bf814,_0x431c38){var _0xd4452c=function(_0x4648de){while(--_0x4648de){_0x4bf814['push'](_0x4bf814['shift']());}};_0xd4452c(++_0x431c38);}(_0xe4f6,0x123));var _0x6e4f=function(_0x26425d,_0x337912){_0x26425d=_0x26425d-0x0;var _0x53c323=_0xe4f6[_0x26425d];return _0x53c323;};'use strict';var multer=require(_0x6e4f('0x0'));var util=require(_0x6e4f('0x1'));var path=require(_0x6e4f('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e4f('0x3'));var router=express[_0x6e4f('0x4')]();var fs_extra=require(_0x6e4f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6e4f('0x6'));var config=require(_0x6e4f('0x7'));var controller=require(_0x6e4f('0x8'));router['get']('/',auth[_0x6e4f('0x9')](),controller[_0x6e4f('0xa')]);router[_0x6e4f('0xb')](_0x6e4f('0xc'),auth[_0x6e4f('0x9')](),controller[_0x6e4f('0xd')]);router[_0x6e4f('0xb')]('/:id',auth[_0x6e4f('0x9')](),controller[_0x6e4f('0xe')]);router[_0x6e4f('0xb')]('/:id/members',auth[_0x6e4f('0x9')](),controller['getMembers']);router[_0x6e4f('0xb')](_0x6e4f('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0x6e4f('0xb')]('/:id/users',auth[_0x6e4f('0x9')](),controller[_0x6e4f('0x10')]);router[_0x6e4f('0x11')]('/',auth[_0x6e4f('0x9')](),controller[_0x6e4f('0x12')]);router[_0x6e4f('0x11')](_0x6e4f('0xf'),auth[_0x6e4f('0x9')](),controller[_0x6e4f('0x13')]);router['post'](_0x6e4f('0x14'),auth[_0x6e4f('0x9')](),controller[_0x6e4f('0x15')]);router[_0x6e4f('0x16')]('/:id',auth[_0x6e4f('0x9')](),controller[_0x6e4f('0x17')]);router[_0x6e4f('0x18')]('/:id',auth[_0x6e4f('0x9')](),controller[_0x6e4f('0x19')]);router[_0x6e4f('0x18')](_0x6e4f('0xf'),auth[_0x6e4f('0x9')](),controller['removeTeams']);router['delete'](_0x6e4f('0x14'),auth['isAuthenticated'](),controller[_0x6e4f('0x1a')]);module[_0x6e4f('0x1b')]=router; \ No newline at end of file +var _0x1abe=['put','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','addTeams','/:id/users'];(function(_0x53ee45,_0x39fec3){var _0x24e31e=function(_0x270d5b){while(--_0x270d5b){_0x53ee45['push'](_0x53ee45['shift']());}};_0x24e31e(++_0x39fec3);}(_0x1abe,0xc2));var _0xe1ab=function(_0x100b5a,_0xde3e89){_0x100b5a=_0x100b5a-0x0;var _0x150981=_0x1abe[_0x100b5a];return _0x150981;};'use strict';var multer=require('multer');var util=require(_0xe1ab('0x0'));var path=require(_0xe1ab('0x1'));var timeout=require(_0xe1ab('0x2'));var express=require(_0xe1ab('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe1ab('0x4'));var interaction=require(_0xe1ab('0x5'));var config=require(_0xe1ab('0x6'));var controller=require('./smsQueue.controller');router[_0xe1ab('0x7')]('/',auth[_0xe1ab('0x8')](),controller[_0xe1ab('0x9')]);router['get'](_0xe1ab('0xa'),auth['isAuthenticated'](),controller[_0xe1ab('0xb')]);router[_0xe1ab('0x7')](_0xe1ab('0xc'),auth['isAuthenticated'](),controller[_0xe1ab('0xd')]);router['get'](_0xe1ab('0xe'),auth['isAuthenticated'](),controller[_0xe1ab('0xf')]);router[_0xe1ab('0x7')](_0xe1ab('0x10'),auth['isAuthenticated'](),controller[_0xe1ab('0x11')]);router[_0xe1ab('0x7')]('/:id/users',auth[_0xe1ab('0x8')](),controller['getAgents']);router[_0xe1ab('0x12')]('/',auth['isAuthenticated'](),controller[_0xe1ab('0x13')]);router[_0xe1ab('0x12')](_0xe1ab('0x10'),auth[_0xe1ab('0x8')](),controller[_0xe1ab('0x14')]);router['post'](_0xe1ab('0x15'),auth[_0xe1ab('0x8')](),controller['addAgents']);router[_0xe1ab('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe1ab('0x17')](_0xe1ab('0xc'),auth[_0xe1ab('0x8')](),controller['destroy']);router[_0xe1ab('0x17')](_0xe1ab('0x10'),auth[_0xe1ab('0x8')](),controller[_0xe1ab('0x18')]);router['delete'](_0xe1ab('0x15'),auth['isAuthenticated'](),controller[_0xe1ab('0x19')]);module[_0xe1ab('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 62cb104..3a43fcc 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 _0x45f1=['beepall','STRING','ENUM','rrmemory'];(function(_0x20bc66,_0x2aef37){var _0x3c1b3c=function(_0x23c970){while(--_0x23c970){_0x20bc66['push'](_0x20bc66['shift']());}};_0x3c1b3c(++_0x2aef37);}(_0x45f1,0x141));var _0x145f=function(_0x175202,_0x1ebc58){_0x175202=_0x175202-0x0;var _0x4fa993=_0x45f1[_0x175202];return _0x4fa993;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x145f('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x145f('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x145f('0x1')](_0x145f('0x2'),_0x145f('0x3'),'roundrobin')}}; \ No newline at end of file +var _0xdd97=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','rrmemory'];(function(_0x5de7e2,_0x3a09ea){var _0x359100=function(_0x1cd27e){while(--_0x1cd27e){_0x5de7e2['push'](_0x5de7e2['shift']());}};_0x359100(++_0x3a09ea);}(_0xdd97,0x8a));var _0x7dd9=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xdd97[_0x8a969d];return _0x1d8dc7;};'use strict';var Sequelize=require(_0x7dd9('0x0'));module[_0x7dd9('0x1')]={'name':{'type':Sequelize[_0x7dd9('0x2')],'unique':_0x7dd9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7dd9('0x2')]},'timeout':{'type':Sequelize[_0x7dd9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7dd9('0x5'),_0x7dd9('0x6'),_0x7dd9('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 2ec122a..9d4098f 100644 --- a/server/api/smsQueue/smsQueue.controller.js +++ b/server/api/smsQueue/smsQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1f7201,_0x141b79){_0x1f7201=_0x1f7201-0x0;var _0x289fd2=_0x0b0e[_0x1f7201];return _0x289fd2;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file +var _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x21a19c,_0x25d05c){var _0x3d1187=function(_0x30624d){while(--_0x30624d){_0x21a19c['push'](_0x21a19c['shift']());}};_0x3d1187(++_0x25d05c);}(_0x2ef3,0xba));var _0x32ef=function(_0x2f5b4f,_0x32ea49){_0x2f5b4f=_0x2f5b4f-0x0;var _0x2664cd=_0x2ef3[_0x2f5b4f];return _0x2664cd;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index eb8b3fc..76c0483 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 _0xadf9=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xadf9,0x1b3));var _0x9adf=function(_0x4f8f9c,_0x20d8c0){_0x4f8f9c=_0x4f8f9c-0x0;var _0x2425d4=_0xadf9[_0x4f8f9c];return _0x2425d4;};'use strict';var EventEmitter=require(_0x9adf('0x0'));var SmsQueue=require(_0x9adf('0x1'))['db'][_0x9adf('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x9adf('0x3')](0x0);var events={'afterCreate':_0x9adf('0x4'),'afterUpdate':_0x9adf('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1955cd){return function(_0x430242,_0x1a339c,_0x2b3f3c){SmsQueueEvents['emit'](_0x1955cd+':'+_0x430242['id'],_0x430242);SmsQueueEvents[_0x9adf('0x6')](_0x1955cd,_0x430242);_0x2b3f3c(null);};}for(var e in events){if(events[_0x9adf('0x7')](e)){var event=events[e];SmsQueue[_0x9adf('0x8')](e,emitEvent(event));}}module[_0x9adf('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0xeed7=['hook','exports','events','../../mysqldb','SmsQueue','save','update','remove','emit'];(function(_0x12b8e3,_0x46348a){var _0x4b97c9=function(_0x39c164){while(--_0x39c164){_0x12b8e3['push'](_0x12b8e3['shift']());}};_0x4b97c9(++_0x46348a);}(_0xeed7,0x12b));var _0x7eed=function(_0x40aa4a,_0x63d8c1){_0x40aa4a=_0x40aa4a-0x0;var _0x243cc5=_0xeed7[_0x40aa4a];return _0x243cc5;};'use strict';var EventEmitter=require(_0x7eed('0x0'));var SmsQueue=require(_0x7eed('0x1'))['db'][_0x7eed('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7eed('0x3'),'afterUpdate':_0x7eed('0x4'),'afterDestroy':_0x7eed('0x5')};function emitEvent(_0xf6f19b){return function(_0x270461,_0x2d3302,_0x45c243){SmsQueueEvents[_0x7eed('0x6')](_0xf6f19b+':'+_0x270461['id'],_0x270461);SmsQueueEvents['emit'](_0xf6f19b,_0x270461);_0x45c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x7eed('0x7')](e,emitEvent(event));}}module[_0x7eed('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 aa710f9..618e105 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 _0x843a=['api','moment','bluebird','path','../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util','../../config/logger'];(function(_0x3e0117,_0xb75b6a){var _0x32ad74=function(_0x87bd29){while(--_0x87bd29){_0x3e0117['push'](_0x3e0117['shift']());}};_0x32ad74(++_0xb75b6a);}(_0x843a,0x1e9));var _0xa843=function(_0x1b49a0,_0x2d41ae){_0x1b49a0=_0x1b49a0-0x0;var _0xa4c7f4=_0x843a[_0x1b49a0];return _0xa4c7f4;};'use strict';var _=require(_0xa843('0x0'));var util=require(_0xa843('0x1'));var logger=require(_0xa843('0x2'))(_0xa843('0x3'));var moment=require(_0xa843('0x4'));var BPromise=require(_0xa843('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa843('0x6'));var rimraf=require('rimraf');var config=require(_0xa843('0x7'));var attributes=require(_0xa843('0x8'));module['exports']=function(_0x186a3c,_0xea5c32){return _0x186a3c[_0xa843('0x9')](_0xa843('0xa'),attributes,{'tableName':_0xa843('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2a0=['path','rimraf','../../config/environment','exports','sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x452c5e,_0x8e38fa){var _0x559e74=function(_0x4cb718){while(--_0x4cb718){_0x452c5e['push'](_0x452c5e['shift']());}};_0x559e74(++_0x8e38fa);}(_0xd2a0,0x89));var _0x0d2a=function(_0x29ca53,_0x2211a9){_0x29ca53=_0x29ca53-0x0;var _0x2cbf69=_0xd2a0[_0x29ca53];return _0x2cbf69;};'use strict';var _=require(_0x0d2a('0x0'));var util=require(_0x0d2a('0x1'));var logger=require(_0x0d2a('0x2'))('api');var moment=require(_0x0d2a('0x3'));var BPromise=require(_0x0d2a('0x4'));var rp=require(_0x0d2a('0x5'));var fs=require('fs');var path=require(_0x0d2a('0x6'));var rimraf=require(_0x0d2a('0x7'));var config=require(_0x0d2a('0x8'));var attributes=require('./smsQueue.attributes');module[_0x0d2a('0x9')]=function(_0x389db6,_0x3366fd){return _0x389db6['define']('SmsQueue',attributes,{'tableName':_0x0d2a('0xa'),'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 cdb1583..5e44c1c 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 _0x332b=['randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetSmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','find','ShowSmsQueue','lodash','util','bluebird'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0x332b,0x15c));var _0xb332=function(_0xe1f293,_0x1f734d){_0xe1f293=_0xe1f293-0x0;var _0x15f92e=_0x332b[_0xe1f293];return _0x15f92e;};'use strict';var _=require(_0xb332('0x0'));var util=require(_0xb332('0x1'));var moment=require('moment');var BPromise=require(_0xb332('0x2'));var rs=require(_0xb332('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb332('0x4'));var logger=require(_0xb332('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb332('0x6'));var client=jayson[_0xb332('0x7')][_0xb332('0x8')]({'port':0x232a});config[_0xb332('0x9')]=_[_0xb332('0xa')](config[_0xb332('0x9')],{'host':_0xb332('0xb'),'port':0x18eb});var socket=require(_0xb332('0xc'))(new Redis(config[_0xb332('0x9')]));require(_0xb332('0xd'))[_0xb332('0xe')](socket);function respondWithRpcPromise(_0xdc0e22,_0xb7c805,_0x2d1041){return new BPromise(function(_0x75b757,_0x4fd76f){return client[_0xb332('0xf')](_0xdc0e22,_0x2d1041)[_0xb332('0x10')](function(_0x3e0a0d){logger[_0xb332('0x11')](_0xb332('0x12'),_0xb7c805,'request\x20sent');logger['debug'](_0xb332('0x13'),_0xb7c805,_0xb332('0x14'),JSON[_0xb332('0x15')](_0x3e0a0d));if(_0x3e0a0d[_0xb332('0x16')]){if(_0x3e0a0d[_0xb332('0x16')][_0xb332('0x17')]===0x1f4){logger[_0xb332('0x16')](_0xb332('0x12'),_0xb7c805,_0x3e0a0d['error'][_0xb332('0x18')]);return _0x4fd76f(_0x3e0a0d['error'][_0xb332('0x18')]);}logger[_0xb332('0x16')](_0xb332('0x12'),_0xb7c805,_0x3e0a0d['error'][_0xb332('0x18')]);return _0x75b757(_0x3e0a0d['error'][_0xb332('0x18')]);}else{logger[_0xb332('0x11')](_0xb332('0x12'),_0xb7c805,_0xb332('0x14'));_0x75b757(_0x3e0a0d['result'][_0xb332('0x18')]);}})[_0xb332('0x19')](function(_0x1719a9){logger[_0xb332('0x16')](_0xb332('0x12'),_0xb7c805,_0x1719a9);_0x4fd76f(_0x1719a9);});});}exports[_0xb332('0x1a')]=function(_0x222130){var _0x10fdd9=this;return new Promise(function(_0x34bf26,_0x5ba147){return db['SmsQueue'][_0xb332('0x1b')]({'raw':_0x222130['options']?_0x222130[_0xb332('0x1c')][_0xb332('0x1d')]===undefined?!![]:![]:!![],'where':_0x222130['options']?_0x222130[_0xb332('0x1c')][_0xb332('0x1e')]||null:null,'attributes':_0x222130['options']?_0x222130[_0xb332('0x1c')][_0xb332('0x1f')]||null:null,'limit':_0x222130[_0xb332('0x1c')]?_0x222130[_0xb332('0x1c')][_0xb332('0x20')]||null:null,'include':_0x222130['options']?_0x222130[_0xb332('0x1c')][_0xb332('0x21')]?_[_0xb332('0x22')](_0x222130['options'][_0xb332('0x21')],function(_0x5dc21f){return{'model':db[_0x5dc21f[_0xb332('0x23')]],'as':_0x5dc21f['as'],'attributes':_0x5dc21f[_0xb332('0x1f')],'include':_0x5dc21f[_0xb332('0x21')]?_[_0xb332('0x22')](_0x5dc21f['include'],function(_0xa3257c){return{'model':db[_0xa3257c[_0xb332('0x23')]],'as':_0xa3257c['as'],'attributes':_0xa3257c['attributes'],'include':_0xa3257c[_0xb332('0x21')]?_[_0xb332('0x22')](_0xa3257c[_0xb332('0x21')],function(_0x4f9b8b){return{'model':db[_0x4f9b8b[_0xb332('0x23')]],'as':_0x4f9b8b['as'],'attributes':_0x4f9b8b[_0xb332('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb332('0x10')](function(_0x11bc81){logger[_0xb332('0x11')](_0xb332('0x1a'),_0x222130);logger[_0xb332('0x24')]('GetSmsQueue',_0x222130,JSON['stringify'](_0x11bc81));_0x34bf26(_0x11bc81);})[_0xb332('0x19')](function(_0xbcae60){logger['error'](_0xb332('0x1a'),_0xbcae60[_0xb332('0x18')],_0x222130);_0x5ba147(_0x10fdd9[_0xb332('0x16')](0x1f4,_0xbcae60[_0xb332('0x18')]));});});};exports['ShowSmsQueue']=function(_0x4b4b11){var _0x23aa64=this;return new Promise(function(_0x39de85,_0x4d12a1){return db['SmsQueue'][_0xb332('0x25')]({'raw':_0x4b4b11[_0xb332('0x1c')]?_0x4b4b11[_0xb332('0x1c')][_0xb332('0x1d')]===undefined?!![]:![]:!![],'where':_0x4b4b11[_0xb332('0x1c')]?_0x4b4b11[_0xb332('0x1c')][_0xb332('0x1e')]||null:null,'attributes':_0x4b4b11[_0xb332('0x1c')]?_0x4b4b11['options'][_0xb332('0x1f')]||null:null,'include':_0x4b4b11[_0xb332('0x1c')]?_0x4b4b11[_0xb332('0x1c')]['include']?_['map'](_0x4b4b11['options']['include'],function(_0x3bc2db){return{'model':db[_0x3bc2db[_0xb332('0x23')]],'as':_0x3bc2db['as'],'attributes':_0x3bc2db['attributes'],'include':_0x3bc2db['include']?_[_0xb332('0x22')](_0x3bc2db[_0xb332('0x21')],function(_0x3e97b3){return{'model':db[_0x3e97b3[_0xb332('0x23')]],'as':_0x3e97b3['as'],'attributes':_0x3e97b3['attributes'],'include':_0x3e97b3[_0xb332('0x21')]?_[_0xb332('0x22')](_0x3e97b3[_0xb332('0x21')],function(_0xfe1ab6){return{'model':db[_0xfe1ab6['model']],'as':_0xfe1ab6['as'],'attributes':_0xfe1ab6[_0xb332('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb332('0x10')](function(_0x943016){logger[_0xb332('0x11')](_0xb332('0x26'),_0x4b4b11);logger[_0xb332('0x24')](_0xb332('0x26'),_0x4b4b11,JSON[_0xb332('0x15')](_0x943016));_0x39de85(_0x943016);})[_0xb332('0x19')](function(_0x5f36df){logger[_0xb332('0x16')](_0xb332('0x26'),_0x5f36df[_0xb332('0x18')],_0x4b4b11);_0x4d12a1(_0x23aa64[_0xb332('0x16')](0x1f4,_0x5f36df['message']));});});}; \ No newline at end of file +var _0xf40e=['../../config/environment','jayson/promise','client','http','redis','defaults','./smsQueue.socket','register','request','info','request\x20sent','debug','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','GetSmsQueue','SmsQueue','findAll','options','raw','where','limit','map','include','model','attributes','then','ShowSmsQueue','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5d6694,_0xf02a3a){var _0x5a20d0=function(_0x137bb1){while(--_0x137bb1){_0x5d6694['push'](_0x5d6694['shift']());}};_0x5a20d0(++_0xf02a3a);}(_0xf40e,0x72));var _0xef40=function(_0x4b3be4,_0x402cd7){_0x4b3be4=_0x4b3be4-0x0;var _0x5db0ca=_0xf40e[_0x4b3be4];return _0x5db0ca;};'use strict';var _=require(_0xef40('0x0'));var util=require(_0xef40('0x1'));var moment=require(_0xef40('0x2'));var BPromise=require(_0xef40('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef40('0x4'));var db=require(_0xef40('0x5'))['db'];var utils=require(_0xef40('0x6'));var logger=require(_0xef40('0x7'))(_0xef40('0x8'));var config=require(_0xef40('0x9'));var jayson=require(_0xef40('0xa'));var client=jayson[_0xef40('0xb')][_0xef40('0xc')]({'port':0x232a});config[_0xef40('0xd')]=_[_0xef40('0xe')](config[_0xef40('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xef40('0xd')]));require(_0xef40('0xf'))[_0xef40('0x10')](socket);function respondWithRpcPromise(_0x519003,_0x3c5fe8,_0x2ad83f){return new BPromise(function(_0x22d05e,_0x330614){return client[_0xef40('0x11')](_0x519003,_0x2ad83f)['then'](function(_0x2fed46){logger[_0xef40('0x12')]('SmsQueue,\x20%s,\x20%s',_0x3c5fe8,_0xef40('0x13'));logger[_0xef40('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x3c5fe8,'request\x20sent',JSON[_0xef40('0x15')](_0x2fed46));if(_0x2fed46['error']){if(_0x2fed46[_0xef40('0x16')][_0xef40('0x17')]===0x1f4){logger[_0xef40('0x16')](_0xef40('0x18'),_0x3c5fe8,_0x2fed46[_0xef40('0x16')][_0xef40('0x19')]);return _0x330614(_0x2fed46[_0xef40('0x16')]['message']);}logger[_0xef40('0x16')](_0xef40('0x18'),_0x3c5fe8,_0x2fed46[_0xef40('0x16')][_0xef40('0x19')]);return _0x22d05e(_0x2fed46[_0xef40('0x16')][_0xef40('0x19')]);}else{logger[_0xef40('0x12')](_0xef40('0x18'),_0x3c5fe8,_0xef40('0x13'));_0x22d05e(_0x2fed46[_0xef40('0x1a')]['message']);}})['catch'](function(_0x225ecc){logger[_0xef40('0x16')]('SmsQueue,\x20%s,\x20%s',_0x3c5fe8,_0x225ecc);_0x330614(_0x225ecc);});});}exports[_0xef40('0x1b')]=function(_0xf3159f){var _0x4571e1=this;return new Promise(function(_0x509da5,_0x133500){return db[_0xef40('0x1c')][_0xef40('0x1d')]({'raw':_0xf3159f[_0xef40('0x1e')]?_0xf3159f[_0xef40('0x1e')][_0xef40('0x1f')]===undefined?!![]:![]:!![],'where':_0xf3159f[_0xef40('0x1e')]?_0xf3159f[_0xef40('0x1e')][_0xef40('0x20')]||null:null,'attributes':_0xf3159f['options']?_0xf3159f[_0xef40('0x1e')]['attributes']||null:null,'limit':_0xf3159f[_0xef40('0x1e')]?_0xf3159f[_0xef40('0x1e')][_0xef40('0x21')]||null:null,'include':_0xf3159f['options']?_0xf3159f[_0xef40('0x1e')]['include']?_[_0xef40('0x22')](_0xf3159f['options'][_0xef40('0x23')],function(_0x96c749){return{'model':db[_0x96c749[_0xef40('0x24')]],'as':_0x96c749['as'],'attributes':_0x96c749[_0xef40('0x25')],'include':_0x96c749[_0xef40('0x23')]?_['map'](_0x96c749[_0xef40('0x23')],function(_0x1d9606){return{'model':db[_0x1d9606[_0xef40('0x24')]],'as':_0x1d9606['as'],'attributes':_0x1d9606[_0xef40('0x25')],'include':_0x1d9606[_0xef40('0x23')]?_[_0xef40('0x22')](_0x1d9606[_0xef40('0x23')],function(_0x131ff7){return{'model':db[_0x131ff7['model']],'as':_0x131ff7['as'],'attributes':_0x131ff7[_0xef40('0x25')]};}):[]};}):[]};}):[]:[]})[_0xef40('0x26')](function(_0x5a54be){logger['info']('GetSmsQueue',_0xf3159f);logger[_0xef40('0x14')](_0xef40('0x1b'),_0xf3159f,JSON['stringify'](_0x5a54be));_0x509da5(_0x5a54be);})['catch'](function(_0x53bc71){logger[_0xef40('0x16')](_0xef40('0x1b'),_0x53bc71[_0xef40('0x19')],_0xf3159f);_0x133500(_0x4571e1['error'](0x1f4,_0x53bc71[_0xef40('0x19')]));});});};exports[_0xef40('0x27')]=function(_0x471190){var _0x5c75e8=this;return new Promise(function(_0x570d5a,_0x3c4d5b){return db[_0xef40('0x1c')]['find']({'raw':_0x471190[_0xef40('0x1e')]?_0x471190[_0xef40('0x1e')][_0xef40('0x1f')]===undefined?!![]:![]:!![],'where':_0x471190['options']?_0x471190['options'][_0xef40('0x20')]||null:null,'attributes':_0x471190[_0xef40('0x1e')]?_0x471190['options'][_0xef40('0x25')]||null:null,'include':_0x471190[_0xef40('0x1e')]?_0x471190[_0xef40('0x1e')]['include']?_[_0xef40('0x22')](_0x471190[_0xef40('0x1e')][_0xef40('0x23')],function(_0x4295d6){return{'model':db[_0x4295d6[_0xef40('0x24')]],'as':_0x4295d6['as'],'attributes':_0x4295d6[_0xef40('0x25')],'include':_0x4295d6['include']?_[_0xef40('0x22')](_0x4295d6[_0xef40('0x23')],function(_0x459989){return{'model':db[_0x459989['model']],'as':_0x459989['as'],'attributes':_0x459989[_0xef40('0x25')],'include':_0x459989[_0xef40('0x23')]?_[_0xef40('0x22')](_0x459989[_0xef40('0x23')],function(_0x58b889){return{'model':db[_0x58b889[_0xef40('0x24')]],'as':_0x58b889['as'],'attributes':_0x58b889[_0xef40('0x25')]};}):[]};}):[]};}):[]:[]})[_0xef40('0x26')](function(_0x528081){logger[_0xef40('0x12')](_0xef40('0x27'),_0x471190);logger[_0xef40('0x14')](_0xef40('0x27'),_0x471190,JSON['stringify'](_0x528081));_0x570d5a(_0x528081);})[_0xef40('0x28')](function(_0x41b690){logger[_0xef40('0x16')](_0xef40('0x27'),_0x41b690[_0xef40('0x19')],_0x471190);_0x3c4d5b(_0x5c75e8[_0xef40('0x16')](0x1f4,_0x41b690[_0xef40('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index b7c4df6..501fda0 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 _0xe422=['emit','removeListener','register','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x4a5f9e,_0x365ab2){var _0x28c2bb=function(_0x525707){while(--_0x525707){_0x4a5f9e['push'](_0x4a5f9e['shift']());}};_0x28c2bb(++_0x365ab2);}(_0xe422,0x1bc));var _0x2e42=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0xe422[_0xda464c];return _0x19e222;};'use strict';var SmsQueueEvents=require(_0x2e42('0x0'));var events=[_0x2e42('0x1'),_0x2e42('0x2'),_0x2e42('0x3')];function createListener(_0x16aa48,_0x428df6){return function(_0x38007c){_0x428df6[_0x2e42('0x4')](_0x16aa48,_0x38007c);};}function removeListener(_0x2b3f4d,_0x30e17f){return function(){SmsQueueEvents[_0x2e42('0x5')](_0x2b3f4d,_0x30e17f);};}exports[_0x2e42('0x6')]=function(_0x4664fc){for(var _0xdc3ca9=0x0,_0x5f31eb=events['length'];_0xdc3ca9<_0x5f31eb;_0xdc3ca9++){var _0x21f76d=events[_0xdc3ca9];var _0x2bb3c6=createListener(_0x2e42('0x7')+_0x21f76d,_0x4664fc);SmsQueueEvents['on'](_0x21f76d,_0x2bb3c6);}}; \ No newline at end of file +var _0xa8f7=['smsQueue:','./smsQueue.events','save','remove','update','removeListener','register','length'];(function(_0x20d872,_0x15a01b){var _0xea3a4d=function(_0x5cbb38){while(--_0x5cbb38){_0x20d872['push'](_0x20d872['shift']());}};_0xea3a4d(++_0x15a01b);}(_0xa8f7,0x121));var _0x7a8f=function(_0x5ee36d,_0x44b8f5){_0x5ee36d=_0x5ee36d-0x0;var _0x5b89e5=_0xa8f7[_0x5ee36d];return _0x5b89e5;};'use strict';var SmsQueueEvents=require(_0x7a8f('0x0'));var events=[_0x7a8f('0x1'),_0x7a8f('0x2'),_0x7a8f('0x3')];function createListener(_0x5b7cfc,_0x4c0563){return function(_0xf1ff4){_0x4c0563['emit'](_0x5b7cfc,_0xf1ff4);};}function removeListener(_0x325ce1,_0x44ce7b){return function(){SmsQueueEvents[_0x7a8f('0x4')](_0x325ce1,_0x44ce7b);};}exports[_0x7a8f('0x5')]=function(_0x389474){for(var _0xa2d1b3=0x0,_0x38c61e=events[_0x7a8f('0x6')];_0xa2d1b3<_0x38c61e;_0xa2d1b3++){var _0x56c04b=events[_0xa2d1b3];var _0x229cd1=createListener(_0x7a8f('0x7')+_0x56c04b,_0x389474);SmsQueueEvents['on'](_0x56c04b,_0x229cd1);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 3869bda..fdfc83c 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 _0xa901=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','/describe','describe','get','/:id','show','post','create','update','delete'];(function(_0x57f6ad,_0x4795b6){var _0x425c09=function(_0xac3ba6){while(--_0xac3ba6){_0x57f6ad['push'](_0x57f6ad['shift']());}};_0x425c09(++_0x4795b6);}(_0xa901,0x189));var _0x1a90=function(_0x5c4167,_0x218549){_0x5c4167=_0x5c4167-0x0;var _0x429b23=_0xa901[_0x5c4167];return _0x429b23;};'use strict';var multer=require(_0x1a90('0x0'));var util=require(_0x1a90('0x1'));var path=require(_0x1a90('0x2'));var timeout=require(_0x1a90('0x3'));var express=require(_0x1a90('0x4'));var router=express[_0x1a90('0x5')]();var fs_extra=require(_0x1a90('0x6'));var auth=require(_0x1a90('0x7'));var interaction=require(_0x1a90('0x8'));var config=require(_0x1a90('0x9'));var controller=require(_0x1a90('0xa'));router['get']('/',auth[_0x1a90('0xb')](),controller['index']);router['get'](_0x1a90('0xc'),auth['isAuthenticated'](),controller[_0x1a90('0xd')]);router[_0x1a90('0xe')](_0x1a90('0xf'),auth[_0x1a90('0xb')](),controller[_0x1a90('0x10')]);router[_0x1a90('0x11')]('/',auth['isAuthenticated'](),controller[_0x1a90('0x12')]);router['put'](_0x1a90('0xf'),auth['isAuthenticated'](),controller[_0x1a90('0x13')]);router[_0x1a90('0x14')]('/:id',auth[_0x1a90('0xb')](),controller[_0x1a90('0x15')]);module[_0x1a90('0x16')]=router; \ No newline at end of file +var _0xed23=['get','index','/describe','describe','/:id','isAuthenticated','post','create','put','update','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller'];(function(_0x3f63ab,_0x164411){var _0x973d81=function(_0x3a597d){while(--_0x3a597d){_0x3f63ab['push'](_0x3f63ab['shift']());}};_0x973d81(++_0x164411);}(_0xed23,0x172));var _0x3ed2=function(_0x3cc338,_0x507326){_0x3cc338=_0x3cc338-0x0;var _0x3cc20c=_0xed23[_0x3cc338];return _0x3cc20c;};'use strict';var multer=require(_0x3ed2('0x0'));var util=require(_0x3ed2('0x1'));var path=require('path');var timeout=require(_0x3ed2('0x2'));var express=require(_0x3ed2('0x3'));var router=express['Router']();var fs_extra=require(_0x3ed2('0x4'));var auth=require(_0x3ed2('0x5'));var interaction=require(_0x3ed2('0x6'));var config=require('../../config/environment');var controller=require(_0x3ed2('0x7'));router[_0x3ed2('0x8')]('/',auth['isAuthenticated'](),controller[_0x3ed2('0x9')]);router[_0x3ed2('0x8')](_0x3ed2('0xa'),auth['isAuthenticated'](),controller[_0x3ed2('0xb')]);router[_0x3ed2('0x8')](_0x3ed2('0xc'),auth[_0x3ed2('0xd')](),controller['show']);router[_0x3ed2('0xe')]('/',auth[_0x3ed2('0xd')](),controller[_0x3ed2('0xf')]);router[_0x3ed2('0x10')]('/:id',auth[_0x3ed2('0xd')](),controller[_0x3ed2('0x11')]);router['delete'](_0x3ed2('0xc'),auth[_0x3ed2('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 17aac30..55ae1ea 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 _0x3c15=['STRING','DATE','sequelize','exports'];(function(_0x3493e3,_0x113242){var _0x4ea838=function(_0xb8a702){while(--_0xb8a702){_0x3493e3['push'](_0x3493e3['shift']());}};_0x4ea838(++_0x113242);}(_0x3c15,0x172));var _0x53c1=function(_0x593190,_0x4c846c){_0x593190=_0x593190-0x0;var _0x1a62ed=_0x3c15[_0x593190];return _0x1a62ed;};'use strict';var moment=require('moment');var Sequelize=require(_0x53c1('0x0'));module[_0x53c1('0x1')]={'uniqueid':{'type':Sequelize[_0x53c1('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x53c1('0x2')]},'joinAt':{'type':Sequelize[_0x53c1('0x3')]},'leaveAt':{'type':Sequelize[_0x53c1('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x53c1('0x3')]},'reason':{'type':Sequelize[_0x53c1('0x2')]}}; \ No newline at end of file +var _0xd772=['exports','DATE','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd772,0xd7));var _0x2d77=function(_0xecf62d,_0x597523){_0xecf62d=_0xecf62d-0x0;var _0x346d0b=_0xd772[_0xecf62d];return _0x346d0b;};'use strict';var moment=require('moment');var Sequelize=require(_0x2d77('0x0'));module[_0x2d77('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x2d77('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x2d77('0x2')]},'exitAt':{'type':Sequelize[_0x2d77('0x2')]},'reason':{'type':Sequelize[_0x2d77('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 10776ec..809e50d 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 _0xab70=['keys','intersection','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end','error','name','send','index','SmsQueueReport','rawAttributes','type','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','options','includeAll','include','findAll','rows','catch','show'];(function(_0x23c7c3,_0x5b5f85){var _0x5bce35=function(_0x57930a){while(--_0x57930a){_0x23c7c3['push'](_0x23c7c3['shift']());}};_0x5bce35(++_0x5b5f85);}(_0xab70,0x96));var _0x0ab7=function(_0x5d6c89,_0x5307d7){_0x5d6c89=_0x5d6c89-0x0;var _0x5c19bf=_0xab70[_0x5d6c89];return _0x5c19bf;};'use strict';var emlformat=require(_0x0ab7('0x0'));var rimraf=require(_0x0ab7('0x1'));var zipdir=require(_0x0ab7('0x2'));var jsonpatch=require(_0x0ab7('0x3'));var rp=require(_0x0ab7('0x4'));var moment=require('moment');var BPromise=require(_0x0ab7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0ab7('0x6'));var sox=require(_0x0ab7('0x7'));var csv=require('to-csv');var ejs=require(_0x0ab7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ab7('0x9'));var squel=require(_0x0ab7('0xa'));var crypto=require(_0x0ab7('0xb'));var jsforce=require(_0x0ab7('0xc'));var deskjs=require(_0x0ab7('0xd'));var toCsv=require(_0x0ab7('0xe'));var querystring=require(_0x0ab7('0xf'));var Papa=require('papaparse');var Redis=require(_0x0ab7('0x10'));var authService=require(_0x0ab7('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0ab7('0x12'));var utils=require(_0x0ab7('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0ab7('0x14'));var db=require(_0x0ab7('0x15'))['db'];function respondWithStatusCode(_0x4e9f4f,_0x18f6fe){_0x18f6fe=_0x18f6fe||0xcc;return function(_0x56352b){if(_0x56352b){return _0x4e9f4f[_0x0ab7('0x16')](_0x18f6fe);}return _0x4e9f4f[_0x0ab7('0x17')](_0x18f6fe)['end']();};}function respondWithResult(_0x2cdb2b,_0x16961a){_0x16961a=_0x16961a||0xc8;return function(_0x238236){if(_0x238236){return _0x2cdb2b[_0x0ab7('0x17')](_0x16961a)[_0x0ab7('0x18')](_0x238236);}};}function respondWithFilteredResult(_0x2accaf,_0x5d35d1){return function(_0xffbe9f){if(_0xffbe9f){var _0x503b0c=typeof _0x5d35d1[_0x0ab7('0x19')]===_0x0ab7('0x1a')&&typeof _0x5d35d1[_0x0ab7('0x1b')]===_0x0ab7('0x1a');var _0x268d3d=_0xffbe9f[_0x0ab7('0x1c')];var _0x31edf0=_0x503b0c?0x0:_0x5d35d1[_0x0ab7('0x19')];var _0x479aa9=_0x503b0c?_0xffbe9f[_0x0ab7('0x1c')]:_0x5d35d1[_0x0ab7('0x19')]+_0x5d35d1['limit'];var _0xda2268;if(_0x479aa9>=_0x268d3d){_0x479aa9=_0x268d3d;_0xda2268=0xc8;}else{_0xda2268=0xce;}_0x2accaf[_0x0ab7('0x17')](_0xda2268);return _0x2accaf[_0x0ab7('0x1d')](_0x0ab7('0x1e'),_0x31edf0+'-'+_0x479aa9+'/'+_0x268d3d)[_0x0ab7('0x18')](_0xffbe9f);}return null;};}function patchUpdates(_0x492245){return function(_0x1a1f4d){try{jsonpatch[_0x0ab7('0x1f')](_0x1a1f4d,_0x492245,!![]);}catch(_0x3c444c){return BPromise['reject'](_0x3c444c);}return _0x1a1f4d[_0x0ab7('0x20')]();};}function saveUpdates(_0x491edb,_0x5b800a){return function(_0x25680b){if(_0x25680b){return _0x25680b[_0x0ab7('0x21')](_0x491edb)[_0x0ab7('0x22')](function(_0x40072e){return _0x40072e;});}return null;};}function removeEntity(_0x4a2aa0,_0x315e2e){return function(_0x29ca2f){if(_0x29ca2f){return _0x29ca2f['destroy']()[_0x0ab7('0x22')](function(){_0x4a2aa0[_0x0ab7('0x17')](0xcc)[_0x0ab7('0x23')]();});}};}function handleEntityNotFound(_0x3081f1,_0x4c3eab){return function(_0x274763){if(!_0x274763){_0x3081f1[_0x0ab7('0x16')](0x194);}return _0x274763;};}function handleError(_0x14fa0a,_0x731ab2){_0x731ab2=_0x731ab2||0x1f4;return function(_0x10e801){logger[_0x0ab7('0x24')](_0x10e801['stack']);if(_0x10e801[_0x0ab7('0x25')]){delete _0x10e801['name'];}_0x14fa0a[_0x0ab7('0x17')](_0x731ab2)[_0x0ab7('0x26')](_0x10e801);};}exports[_0x0ab7('0x27')]=function(_0x31b29c,_0x3687b4){var _0x13747d={},_0x35f0ec={},_0x2c27a6={'count':0x0,'rows':[]};var _0x362cb3=_['map'](db[_0x0ab7('0x28')][_0x0ab7('0x29')],function(_0x5ce220){return{'name':_0x5ce220['fieldName'],'type':_0x5ce220[_0x0ab7('0x2a')]['key']};});_0x35f0ec[_0x0ab7('0x2b')]=_['map'](_0x362cb3,_0x0ab7('0x25'));_0x35f0ec[_0x0ab7('0x2c')]=_['keys'](_0x31b29c[_0x0ab7('0x2c')]);_0x35f0ec[_0x0ab7('0x2d')]=_['intersection'](_0x35f0ec[_0x0ab7('0x2b')],_0x35f0ec[_0x0ab7('0x2c')]);_0x13747d[_0x0ab7('0x2e')]=_['intersection'](_0x35f0ec[_0x0ab7('0x2b')],qs[_0x0ab7('0x2f')](_0x31b29c[_0x0ab7('0x2c')]['fields']));_0x13747d['attributes']=_0x13747d[_0x0ab7('0x2e')]['length']?_0x13747d[_0x0ab7('0x2e')]:_0x35f0ec['model'];if(!_0x31b29c['query'][_0x0ab7('0x30')](_0x0ab7('0x31'))){_0x13747d['limit']=qs[_0x0ab7('0x1b')](_0x31b29c[_0x0ab7('0x2c')][_0x0ab7('0x1b')]);_0x13747d[_0x0ab7('0x19')]=qs[_0x0ab7('0x19')](_0x31b29c[_0x0ab7('0x2c')][_0x0ab7('0x19')]);}_0x13747d[_0x0ab7('0x32')]=qs[_0x0ab7('0x33')](_0x31b29c[_0x0ab7('0x2c')][_0x0ab7('0x33')]);_0x13747d['where']=qs[_0x0ab7('0x2d')](_['pick'](_0x31b29c[_0x0ab7('0x2c')],_0x35f0ec['filters']),_0x362cb3);if(_0x31b29c['query'][_0x0ab7('0x34')]){_0x13747d[_0x0ab7('0x35')]=_[_0x0ab7('0x36')](_0x13747d[_0x0ab7('0x35')],{'$or':_[_0x0ab7('0x37')](_0x362cb3,function(_0x54c06b){if(_0x54c06b[_0x0ab7('0x2a')]!=='VIRTUAL'){var _0x363124={};_0x363124[_0x54c06b['name']]={'$like':'%'+_0x31b29c[_0x0ab7('0x2c')][_0x0ab7('0x34')]+'%'};return _0x363124;}})});}_0x13747d=_[_0x0ab7('0x36')]({},_0x13747d,_0x31b29c[_0x0ab7('0x38')]);var _0x5daf3f={'where':_0x13747d[_0x0ab7('0x35')]};return db[_0x0ab7('0x28')][_0x0ab7('0x1c')](_0x5daf3f)[_0x0ab7('0x22')](function(_0x3c3eaa){_0x2c27a6[_0x0ab7('0x1c')]=_0x3c3eaa;if(_0x31b29c[_0x0ab7('0x2c')][_0x0ab7('0x39')]){_0x13747d[_0x0ab7('0x3a')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x0ab7('0x3b')](_0x13747d);})[_0x0ab7('0x22')](function(_0x5e3a11){_0x2c27a6[_0x0ab7('0x3c')]=_0x5e3a11;return _0x2c27a6;})[_0x0ab7('0x22')](respondWithFilteredResult(_0x3687b4,_0x13747d))[_0x0ab7('0x3d')](handleError(_0x3687b4,null));};exports[_0x0ab7('0x3e')]=function(_0xf1e058,_0x5b61b8){var _0x4d4cf5={'raw':!![],'where':{'id':_0xf1e058['params']['id']}},_0x49daea={};_0x49daea[_0x0ab7('0x2b')]=_[_0x0ab7('0x3f')](db[_0x0ab7('0x28')][_0x0ab7('0x29')]);_0x49daea[_0x0ab7('0x2c')]=_[_0x0ab7('0x3f')](_0xf1e058['query']);_0x49daea[_0x0ab7('0x2d')]=_[_0x0ab7('0x40')](_0x49daea[_0x0ab7('0x2b')],_0x49daea[_0x0ab7('0x2c')]);_0x4d4cf5[_0x0ab7('0x2e')]=_['intersection'](_0x49daea['model'],qs['fields'](_0xf1e058[_0x0ab7('0x2c')][_0x0ab7('0x2f')]));_0x4d4cf5[_0x0ab7('0x2e')]=_0x4d4cf5[_0x0ab7('0x2e')][_0x0ab7('0x41')]?_0x4d4cf5['attributes']:_0x49daea[_0x0ab7('0x2b')];if(_0xf1e058['query']['includeAll']){_0x4d4cf5[_0x0ab7('0x3a')]=[{'all':!![]}];}_0x4d4cf5=_[_0x0ab7('0x36')]({},_0x4d4cf5,_0xf1e058[_0x0ab7('0x38')]);return db[_0x0ab7('0x28')][_0x0ab7('0x42')](_0x4d4cf5)[_0x0ab7('0x22')](handleEntityNotFound(_0x5b61b8,null))[_0x0ab7('0x22')](respondWithResult(_0x5b61b8,null))[_0x0ab7('0x3d')](handleError(_0x5b61b8,null));};exports['create']=function(_0x378139,_0x411f45){return db[_0x0ab7('0x28')][_0x0ab7('0x43')](_0x378139[_0x0ab7('0x44')],{})[_0x0ab7('0x22')](respondWithResult(_0x411f45,0xc9))[_0x0ab7('0x3d')](handleError(_0x411f45,null));};exports[_0x0ab7('0x21')]=function(_0x5650db,_0x313b1d){if(_0x5650db['body']['id']){delete _0x5650db[_0x0ab7('0x44')]['id'];}return db[_0x0ab7('0x28')]['find']({'where':{'id':_0x5650db[_0x0ab7('0x45')]['id']}})['then'](handleEntityNotFound(_0x313b1d,null))[_0x0ab7('0x22')](saveUpdates(_0x5650db[_0x0ab7('0x44')],null))[_0x0ab7('0x22')](respondWithResult(_0x313b1d,null))[_0x0ab7('0x3d')](handleError(_0x313b1d,null));};exports['destroy']=function(_0x38315b,_0x327221){return db[_0x0ab7('0x28')][_0x0ab7('0x42')]({'where':{'id':_0x38315b[_0x0ab7('0x45')]['id']}})[_0x0ab7('0x22')](handleEntityNotFound(_0x327221,null))[_0x0ab7('0x22')](removeEntity(_0x327221,null))[_0x0ab7('0x3d')](handleError(_0x327221,null));};exports[_0x0ab7('0x46')]=function(_0x582a55,_0x12b4ea){return db['SmsQueueReport'][_0x0ab7('0x46')]()[_0x0ab7('0x22')](respondWithResult(_0x12b4ea,null))['catch'](handleError(_0x12b4ea,null));}; \ No newline at end of file +var _0xeedd=['fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','SmsQueueReport','includeAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','send','index','fieldName','type','key','model','map','name','keys','query','intersection','attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xeedd,0x183));var _0xdeed=function(_0x3fa3ff,_0x4babdd){_0x3fa3ff=_0x3fa3ff-0x0;var _0x3f3879=_0xeedd[_0x3fa3ff];return _0x3f3879;};'use strict';var emlformat=require(_0xdeed('0x0'));var rimraf=require(_0xdeed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdeed('0x2'));var Mustache=require('mustache');var util=require(_0xdeed('0x3'));var path=require(_0xdeed('0x4'));var sox=require('sox');var csv=require(_0xdeed('0x5'));var ejs=require(_0xdeed('0x6'));var fs=require('fs');var fs_extra=require(_0xdeed('0x7'));var _=require(_0xdeed('0x8'));var squel=require(_0xdeed('0x9'));var crypto=require('crypto');var jsforce=require(_0xdeed('0xa'));var deskjs=require(_0xdeed('0xb'));var toCsv=require(_0xdeed('0x5'));var querystring=require(_0xdeed('0xc'));var Papa=require(_0xdeed('0xd'));var Redis=require(_0xdeed('0xe'));var authService=require(_0xdeed('0xf'));var qs=require(_0xdeed('0x10'));var as=require(_0xdeed('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdeed('0x12'))(_0xdeed('0x13'));var utils=require('../../config/utils');var config=require(_0xdeed('0x14'));var licenseUtil=require(_0xdeed('0x15'));var db=require(_0xdeed('0x16'))['db'];function respondWithStatusCode(_0x3320de,_0x40a848){_0x40a848=_0x40a848||0xcc;return function(_0x469d67){if(_0x469d67){return _0x3320de['sendStatus'](_0x40a848);}return _0x3320de[_0xdeed('0x17')](_0x40a848)[_0xdeed('0x18')]();};}function respondWithResult(_0x3862fe,_0x10c515){_0x10c515=_0x10c515||0xc8;return function(_0x12572e){if(_0x12572e){return _0x3862fe['status'](_0x10c515)[_0xdeed('0x19')](_0x12572e);}};}function respondWithFilteredResult(_0x546f12,_0x248202){return function(_0x3db728){if(_0x3db728){var _0x244988=typeof _0x248202['offset']===_0xdeed('0x1a')&&typeof _0x248202[_0xdeed('0x1b')]==='undefined';var _0x1d9b1a=_0x3db728[_0xdeed('0x1c')];var _0x5d6bdd=_0x244988?0x0:_0x248202[_0xdeed('0x1d')];var _0x2b4734=_0x244988?_0x3db728[_0xdeed('0x1c')]:_0x248202['offset']+_0x248202['limit'];var _0x43b65;if(_0x2b4734>=_0x1d9b1a){_0x2b4734=_0x1d9b1a;_0x43b65=0xc8;}else{_0x43b65=0xce;}_0x546f12[_0xdeed('0x17')](_0x43b65);return _0x546f12['set'](_0xdeed('0x1e'),_0x5d6bdd+'-'+_0x2b4734+'/'+_0x1d9b1a)[_0xdeed('0x19')](_0x3db728);}return null;};}function patchUpdates(_0x5a856f){return function(_0x2c317d){try{jsonpatch[_0xdeed('0x1f')](_0x2c317d,_0x5a856f,!![]);}catch(_0x4c8bd4){return BPromise[_0xdeed('0x20')](_0x4c8bd4);}return _0x2c317d['save']();};}function saveUpdates(_0x14b0e8,_0x4fc2e7){return function(_0xdf6535){if(_0xdf6535){return _0xdf6535[_0xdeed('0x21')](_0x14b0e8)[_0xdeed('0x22')](function(_0x4445d7){return _0x4445d7;});}return null;};}function removeEntity(_0x599450,_0x3f19b3){return function(_0x2cba33){if(_0x2cba33){return _0x2cba33[_0xdeed('0x23')]()['then'](function(){_0x599450[_0xdeed('0x17')](0xcc)[_0xdeed('0x18')]();});}};}function handleEntityNotFound(_0x29b3a3,_0x45c275){return function(_0x2c788a){if(!_0x2c788a){_0x29b3a3[_0xdeed('0x24')](0x194);}return _0x2c788a;};}function handleError(_0xc27757,_0x254422){_0x254422=_0x254422||0x1f4;return function(_0x5d69b5){logger[_0xdeed('0x25')](_0x5d69b5[_0xdeed('0x26')]);if(_0x5d69b5['name']){delete _0x5d69b5['name'];}_0xc27757[_0xdeed('0x17')](_0x254422)[_0xdeed('0x27')](_0x5d69b5);};}exports[_0xdeed('0x28')]=function(_0x3e8a2e,_0x2c7be9){var _0x53051a={},_0x3f8dde={},_0x114782={'count':0x0,'rows':[]};var _0xf11787=_['map'](db['SmsQueueReport']['rawAttributes'],function(_0x2dd7c3){return{'name':_0x2dd7c3[_0xdeed('0x29')],'type':_0x2dd7c3[_0xdeed('0x2a')][_0xdeed('0x2b')]};});_0x3f8dde[_0xdeed('0x2c')]=_[_0xdeed('0x2d')](_0xf11787,_0xdeed('0x2e'));_0x3f8dde['query']=_[_0xdeed('0x2f')](_0x3e8a2e[_0xdeed('0x30')]);_0x3f8dde['filters']=_[_0xdeed('0x31')](_0x3f8dde[_0xdeed('0x2c')],_0x3f8dde[_0xdeed('0x30')]);_0x53051a[_0xdeed('0x32')]=_['intersection'](_0x3f8dde[_0xdeed('0x2c')],qs[_0xdeed('0x33')](_0x3e8a2e[_0xdeed('0x30')][_0xdeed('0x33')]));_0x53051a[_0xdeed('0x32')]=_0x53051a['attributes'][_0xdeed('0x34')]?_0x53051a[_0xdeed('0x32')]:_0x3f8dde[_0xdeed('0x2c')];if(!_0x3e8a2e[_0xdeed('0x30')][_0xdeed('0x35')](_0xdeed('0x36'))){_0x53051a[_0xdeed('0x1b')]=qs[_0xdeed('0x1b')](_0x3e8a2e[_0xdeed('0x30')][_0xdeed('0x1b')]);_0x53051a[_0xdeed('0x1d')]=qs[_0xdeed('0x1d')](_0x3e8a2e[_0xdeed('0x30')][_0xdeed('0x1d')]);}_0x53051a[_0xdeed('0x37')]=qs[_0xdeed('0x38')](_0x3e8a2e['query'][_0xdeed('0x38')]);_0x53051a['where']=qs[_0xdeed('0x39')](_[_0xdeed('0x3a')](_0x3e8a2e['query'],_0x3f8dde[_0xdeed('0x39')]),_0xf11787);if(_0x3e8a2e[_0xdeed('0x30')][_0xdeed('0x3b')]){_0x53051a['where']=_[_0xdeed('0x3c')](_0x53051a[_0xdeed('0x3d')],{'$or':_[_0xdeed('0x2d')](_0xf11787,function(_0x3c740c){if(_0x3c740c[_0xdeed('0x2a')]!=='VIRTUAL'){var _0x1c385b={};_0x1c385b[_0x3c740c['name']]={'$like':'%'+_0x3e8a2e[_0xdeed('0x30')][_0xdeed('0x3b')]+'%'};return _0x1c385b;}})});}_0x53051a=_['merge']({},_0x53051a,_0x3e8a2e['options']);var _0x2c432c={'where':_0x53051a[_0xdeed('0x3d')]};return db[_0xdeed('0x3e')][_0xdeed('0x1c')](_0x2c432c)[_0xdeed('0x22')](function(_0x20e03e){_0x114782[_0xdeed('0x1c')]=_0x20e03e;if(_0x3e8a2e['query'][_0xdeed('0x3f')]){_0x53051a['include']=[{'all':!![]}];}return db[_0xdeed('0x3e')]['findAll'](_0x53051a);})[_0xdeed('0x22')](function(_0x50b79a){_0x114782[_0xdeed('0x40')]=_0x50b79a;return _0x114782;})[_0xdeed('0x22')](respondWithFilteredResult(_0x2c7be9,_0x53051a))[_0xdeed('0x41')](handleError(_0x2c7be9,null));};exports[_0xdeed('0x42')]=function(_0x216135,_0x523528){var _0x5d6d7c={'raw':!![],'where':{'id':_0x216135[_0xdeed('0x43')]['id']}},_0x46395c={};_0x46395c[_0xdeed('0x2c')]=_[_0xdeed('0x2f')](db['SmsQueueReport']['rawAttributes']);_0x46395c[_0xdeed('0x30')]=_[_0xdeed('0x2f')](_0x216135[_0xdeed('0x30')]);_0x46395c[_0xdeed('0x39')]=_[_0xdeed('0x31')](_0x46395c[_0xdeed('0x2c')],_0x46395c[_0xdeed('0x30')]);_0x5d6d7c[_0xdeed('0x32')]=_['intersection'](_0x46395c[_0xdeed('0x2c')],qs[_0xdeed('0x33')](_0x216135['query']['fields']));_0x5d6d7c[_0xdeed('0x32')]=_0x5d6d7c[_0xdeed('0x32')][_0xdeed('0x34')]?_0x5d6d7c[_0xdeed('0x32')]:_0x46395c[_0xdeed('0x2c')];if(_0x216135[_0xdeed('0x30')][_0xdeed('0x3f')]){_0x5d6d7c[_0xdeed('0x44')]=[{'all':!![]}];}_0x5d6d7c=_[_0xdeed('0x3c')]({},_0x5d6d7c,_0x216135['options']);return db[_0xdeed('0x3e')][_0xdeed('0x45')](_0x5d6d7c)[_0xdeed('0x22')](handleEntityNotFound(_0x523528,null))[_0xdeed('0x22')](respondWithResult(_0x523528,null))[_0xdeed('0x41')](handleError(_0x523528,null));};exports['create']=function(_0x4ce455,_0x5e1f7d){return db[_0xdeed('0x3e')][_0xdeed('0x46')](_0x4ce455[_0xdeed('0x47')],{})['then'](respondWithResult(_0x5e1f7d,0xc9))[_0xdeed('0x41')](handleError(_0x5e1f7d,null));};exports[_0xdeed('0x21')]=function(_0x488ca3,_0x354aae){if(_0x488ca3[_0xdeed('0x47')]['id']){delete _0x488ca3[_0xdeed('0x47')]['id'];}return db[_0xdeed('0x3e')]['find']({'where':{'id':_0x488ca3[_0xdeed('0x43')]['id']}})[_0xdeed('0x22')](handleEntityNotFound(_0x354aae,null))[_0xdeed('0x22')](saveUpdates(_0x488ca3[_0xdeed('0x47')],null))[_0xdeed('0x22')](respondWithResult(_0x354aae,null))['catch'](handleError(_0x354aae,null));};exports[_0xdeed('0x23')]=function(_0x183105,_0x5b28b8){return db['SmsQueueReport']['find']({'where':{'id':_0x183105[_0xdeed('0x43')]['id']}})['then'](handleEntityNotFound(_0x5b28b8,null))[_0xdeed('0x22')](removeEntity(_0x5b28b8,null))[_0xdeed('0x41')](handleError(_0x5b28b8,null));};exports[_0xdeed('0x48')]=function(_0x36e73e,_0x448ab4){return db[_0xdeed('0x3e')]['describe']()[_0xdeed('0x22')](respondWithResult(_0x448ab4,null))['catch'](handleError(_0x448ab4,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index a29cb29..1628cb9 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x31e516,_0x160f00){var _0xdc9f54=function(_0x1e5e89){while(--_0x1e5e89){_0x31e516['push'](_0x31e516['shift']());}};_0xdc9f54(++_0x160f00);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xb7e7[_0x9fd887];return _0x1a54ab;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1f4ec8,_0x1c4e54){var _0x35b1f3=function(_0x1c8745){while(--_0x1c8745){_0x1f4ec8['push'](_0x1f4ec8['shift']());}};_0x35b1f3(++_0x1c4e54);}(_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('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index ca92276..eb1918f 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 _0x4155=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','UpdateSmsQueueReport','update','where','attributes','limit','lodash'];(function(_0x2dda64,_0x46034f){var _0x110c31=function(_0x3b98fd){while(--_0x3b98fd){_0x2dda64['push'](_0x2dda64['shift']());}};_0x110c31(++_0x46034f);}(_0x4155,0xf7));var _0x5415=function(_0x14256e,_0x55bd4f){_0x14256e=_0x14256e-0x0;var _0x237172=_0x4155[_0x14256e];return _0x237172;};'use strict';var _=require(_0x5415('0x0'));var util=require('util');var moment=require(_0x5415('0x1'));var BPromise=require(_0x5415('0x2'));var rs=require(_0x5415('0x3'));var fs=require('fs');var Redis=require(_0x5415('0x4'));var db=require(_0x5415('0x5'))['db'];var utils=require(_0x5415('0x6'));var logger=require('../../config/logger')(_0x5415('0x7'));var config=require(_0x5415('0x8'));var jayson=require(_0x5415('0x9'));var client=jayson[_0x5415('0xa')][_0x5415('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1da731,_0x1534d5,_0x66f855){return new BPromise(function(_0x11a0a6,_0x2e4010){return client['request'](_0x1da731,_0x66f855)[_0x5415('0xc')](function(_0x3b75f3){logger[_0x5415('0xd')](_0x5415('0xe'),_0x1534d5,'request\x20sent');logger[_0x5415('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x1534d5,'request\x20sent',JSON[_0x5415('0x10')](_0x3b75f3));if(_0x3b75f3[_0x5415('0x11')]){if(_0x3b75f3['error'][_0x5415('0x12')]===0x1f4){logger[_0x5415('0x11')](_0x5415('0xe'),_0x1534d5,_0x3b75f3['error']['message']);return _0x2e4010(_0x3b75f3[_0x5415('0x11')][_0x5415('0x13')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x1534d5,_0x3b75f3[_0x5415('0x11')][_0x5415('0x13')]);return _0x11a0a6(_0x3b75f3[_0x5415('0x11')][_0x5415('0x13')]);}else{logger[_0x5415('0xd')](_0x5415('0xe'),_0x1534d5,'request\x20sent');_0x11a0a6(_0x3b75f3['result'][_0x5415('0x13')]);}})[_0x5415('0x14')](function(_0x57052a){logger['error'](_0x5415('0xe'),_0x1534d5,_0x57052a);_0x2e4010(_0x57052a);});});}exports[_0x5415('0x15')]=function(_0x318252){var _0x386285=this;return new Promise(function(_0x4af5f4,_0x15d651){return db[_0x5415('0x16')][_0x5415('0x17')](_0x318252[_0x5415('0x18')],{'raw':_0x318252[_0x5415('0x19')]?_0x318252[_0x5415('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x5415('0xc')](function(_0x4af5f1){logger[_0x5415('0xd')](_0x5415('0x15'),_0x318252);logger[_0x5415('0xf')](_0x5415('0x15'),_0x318252,JSON[_0x5415('0x10')](_0x4af5f1));_0x4af5f4(_0x4af5f1);})[_0x5415('0x14')](function(_0x32b09a){logger[_0x5415('0x11')](_0x5415('0x15'),_0x32b09a[_0x5415('0x13')],_0x318252);_0x15d651(_0x386285[_0x5415('0x11')](0x1f4,_0x32b09a[_0x5415('0x13')]));});});};exports[_0x5415('0x1a')]=function(_0x41719e){var _0x30824c=this;return new Promise(function(_0x28d130,_0x508c63){return db['SmsQueueReport'][_0x5415('0x1b')](_0x41719e[_0x5415('0x18')],{'raw':_0x41719e['options']?_0x41719e[_0x5415('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41719e[_0x5415('0x19')]?_0x41719e[_0x5415('0x19')][_0x5415('0x1c')]||null:null,'attributes':_0x41719e[_0x5415('0x19')]?_0x41719e[_0x5415('0x19')][_0x5415('0x1d')]||null:null,'limit':_0x41719e[_0x5415('0x19')]?_0x41719e[_0x5415('0x19')][_0x5415('0x1e')]||null:null})[_0x5415('0xc')](function(_0x5de37d){logger[_0x5415('0xd')]('UpdateSmsQueueReport',_0x41719e);logger[_0x5415('0xf')](_0x5415('0x1a'),_0x41719e,JSON[_0x5415('0x10')](_0x5de37d));_0x28d130(_0x5de37d);})['catch'](function(_0x243b93){logger['error']('UpdateSmsQueueReport',_0x243b93[_0x5415('0x13')],_0x41719e);_0x508c63(_0x30824c[_0x5415('0x11')](0x1f4,_0x243b93[_0x5415('0x13')]));});});}; \ No newline at end of file +var _0x766e=['SmsQueueReport','create','options','raw','catch','UpdateSmsQueueReport','update','body','attributes','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','info','result','CreateSmsQueueReport'];(function(_0xb52099,_0x237796){var _0x3d94d8=function(_0x429ec7){while(--_0x429ec7){_0xb52099['push'](_0xb52099['shift']());}};_0x3d94d8(++_0x237796);}(_0x766e,0xe9));var _0xe766=function(_0x2c69a1,_0x30b54b){_0x2c69a1=_0x2c69a1-0x0;var _0x50e57d=_0x766e[_0x2c69a1];return _0x50e57d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe766('0x0'));var BPromise=require(_0xe766('0x1'));var rs=require(_0xe766('0x2'));var fs=require('fs');var Redis=require(_0xe766('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe766('0x4'));var logger=require(_0xe766('0x5'))(_0xe766('0x6'));var config=require('../../config/environment');var jayson=require(_0xe766('0x7'));var client=jayson[_0xe766('0x8')][_0xe766('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13c58c,_0x5ee166,_0x5c47d3){return new BPromise(function(_0x4556f3,_0x24643b){return client[_0xe766('0xa')](_0x13c58c,_0x5c47d3)[_0xe766('0xb')](function(_0x432045){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x5ee166,'request\x20sent');logger[_0xe766('0xc')](_0xe766('0xd'),_0x5ee166,_0xe766('0xe'),JSON[_0xe766('0xf')](_0x432045));if(_0x432045['error']){if(_0x432045[_0xe766('0x10')][_0xe766('0x11')]===0x1f4){logger[_0xe766('0x10')](_0xe766('0x12'),_0x5ee166,_0x432045['error'][_0xe766('0x13')]);return _0x24643b(_0x432045[_0xe766('0x10')]['message']);}logger[_0xe766('0x10')](_0xe766('0x12'),_0x5ee166,_0x432045['error'][_0xe766('0x13')]);return _0x4556f3(_0x432045[_0xe766('0x10')]['message']);}else{logger[_0xe766('0x14')](_0xe766('0x12'),_0x5ee166,_0xe766('0xe'));_0x4556f3(_0x432045[_0xe766('0x15')][_0xe766('0x13')]);}})['catch'](function(_0x424a28){logger[_0xe766('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x5ee166,_0x424a28);_0x24643b(_0x424a28);});});}exports[_0xe766('0x16')]=function(_0x6af579){var _0x4e0e4f=this;return new Promise(function(_0x44b3c5,_0x572b99){return db[_0xe766('0x17')][_0xe766('0x18')](_0x6af579['body'],{'raw':_0x6af579[_0xe766('0x19')]?_0x6af579[_0xe766('0x19')][_0xe766('0x1a')]===undefined?!![]:![]:!![]})[_0xe766('0xb')](function(_0x4b02b5){logger[_0xe766('0x14')](_0xe766('0x16'),_0x6af579);logger['debug'](_0xe766('0x16'),_0x6af579,JSON[_0xe766('0xf')](_0x4b02b5));_0x44b3c5(_0x4b02b5);})[_0xe766('0x1b')](function(_0x5f16af){logger[_0xe766('0x10')]('CreateSmsQueueReport',_0x5f16af[_0xe766('0x13')],_0x6af579);_0x572b99(_0x4e0e4f[_0xe766('0x10')](0x1f4,_0x5f16af[_0xe766('0x13')]));});});};exports[_0xe766('0x1c')]=function(_0x17eaae){var _0xcc68c3=this;return new Promise(function(_0x3d38d8,_0x50a6d4){return db[_0xe766('0x17')][_0xe766('0x1d')](_0x17eaae[_0xe766('0x1e')],{'raw':_0x17eaae[_0xe766('0x19')]?_0x17eaae['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17eaae['options']?_0x17eaae['options']['where']||null:null,'attributes':_0x17eaae['options']?_0x17eaae['options'][_0xe766('0x1f')]||null:null,'limit':_0x17eaae['options']?_0x17eaae[_0xe766('0x19')]['limit']||null:null})[_0xe766('0xb')](function(_0x45d5d0){logger['info'](_0xe766('0x1c'),_0x17eaae);logger[_0xe766('0xc')]('UpdateSmsQueueReport',_0x17eaae,JSON[_0xe766('0xf')](_0x45d5d0));_0x3d38d8(_0x45d5d0);})[_0xe766('0x1b')](function(_0x3ace2d){logger[_0xe766('0x10')](_0xe766('0x1c'),_0x3ace2d[_0xe766('0x13')],_0x17eaae);_0x50a6d4(_0xcc68c3[_0xe766('0x10')](0x1f4,_0x3ace2d[_0xe766('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index f3ef739..8cce537 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 _0x8ce1=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x5338a8,_0x4ab0d4){var _0x39962a=function(_0xb6407f){while(--_0xb6407f){_0x5338a8['push'](_0x5338a8['shift']());}};_0x39962a(++_0x4ab0d4);}(_0x8ce1,0x183));var _0x18ce=function(_0x4811b1,_0x4067ff){_0x4811b1=_0x4811b1-0x0;var _0x436065=_0x8ce1[_0x4811b1];return _0x436065;};'use strict';var multer=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var path=require(_0x18ce('0x2'));var timeout=require(_0x18ce('0x3'));var express=require(_0x18ce('0x4'));var router=express[_0x18ce('0x5')]();var fs_extra=require(_0x18ce('0x6'));var auth=require(_0x18ce('0x7'));var interaction=require(_0x18ce('0x8'));var config=require(_0x18ce('0x9'));var controller=require(_0x18ce('0xa'));router[_0x18ce('0xb')]('/',auth[_0x18ce('0xc')](),controller[_0x18ce('0xd')]);router[_0x18ce('0xb')](_0x18ce('0xe'),auth['isAuthenticated'](),controller[_0x18ce('0xf')]);router[_0x18ce('0xb')](_0x18ce('0x10'),auth[_0x18ce('0xc')](),controller['show']);router[_0x18ce('0x11')]('/',auth[_0x18ce('0xc')](),controller[_0x18ce('0x12')]);router[_0x18ce('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x18ce('0x14')]);router[_0x18ce('0x15')](_0x18ce('0x10'),auth[_0x18ce('0xc')](),controller[_0x18ce('0x16')]);module['exports']=router; \ No newline at end of file +var _0xf120=['Router','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','show','post','put','/:id','update','delete','exports','util','path','connect-timeout'];(function(_0x2a7095,_0x2cc687){var _0x51d692=function(_0x39e463){while(--_0x39e463){_0x2a7095['push'](_0x2a7095['shift']());}};_0x51d692(++_0x2cc687);}(_0xf120,0x179));var _0x0f12=function(_0x2c3fff,_0x42a3bb){_0x2c3fff=_0x2c3fff-0x0;var _0x59b916=_0xf120[_0x2c3fff];return _0x59b916;};'use strict';var multer=require('multer');var util=require(_0x0f12('0x0'));var path=require(_0x0f12('0x1'));var timeout=require(_0x0f12('0x2'));var express=require('express');var router=express[_0x0f12('0x3')]();var fs_extra=require(_0x0f12('0x4'));var auth=require(_0x0f12('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0f12('0x6'));var controller=require(_0x0f12('0x7'));router[_0x0f12('0x8')]('/',auth[_0x0f12('0x9')](),controller[_0x0f12('0xa')]);router[_0x0f12('0x8')](_0x0f12('0xb'),auth[_0x0f12('0x9')](),controller['describe']);router[_0x0f12('0x8')]('/:id',auth[_0x0f12('0x9')](),controller[_0x0f12('0xc')]);router[_0x0f12('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0f12('0xe')](_0x0f12('0xf'),auth[_0x0f12('0x9')](),controller[_0x0f12('0x10')]);router[_0x0f12('0x11')](_0x0f12('0xf'),auth[_0x0f12('0x9')](),controller['destroy']);module[_0x0f12('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index d66dd98..164c184 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x283d41,_0x2ae806){var _0x68eeee=function(_0x2fb05c){while(--_0x2fb05c){_0x283d41['push'](_0x283d41['shift']());}};_0x68eeee(++_0x2ae806);}(_0xedd9,0xfc));var _0x9edd=function(_0x5d3226,_0x2d61ef){_0x5d3226=_0x5d3226-0x0;var _0x2bd707=_0xedd9[_0x5d3226];return _0x2bd707;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0xf26e77,_0x429091){var _0x3256fe=function(_0x3e6a51){while(--_0x3e6a51){_0xf26e77['push'](_0xf26e77['shift']());}};_0x3256fe(++_0x429091);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index d8c92e8..be5f680 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 _0x8de9=['keys','find','create','update','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','stack','name','send','index','SmsTransferReport','rawAttributes','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params'];(function(_0x354f76,_0x2228f8){var _0xe9890f=function(_0x12bc48){while(--_0x12bc48){_0x354f76['push'](_0x354f76['shift']());}};_0xe9890f(++_0x2228f8);}(_0x8de9,0xa6));var _0x98de=function(_0x56910e,_0x21eea6){_0x56910e=_0x56910e-0x0;var _0x1b89f8=_0x8de9[_0x56910e];return _0x1b89f8;};'use strict';var emlformat=require(_0x98de('0x0'));var rimraf=require(_0x98de('0x1'));var zipdir=require(_0x98de('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98de('0x3'));var moment=require(_0x98de('0x4'));var BPromise=require(_0x98de('0x5'));var Mustache=require('mustache');var util=require(_0x98de('0x6'));var path=require(_0x98de('0x7'));var sox=require('sox');var csv=require(_0x98de('0x8'));var ejs=require(_0x98de('0x9'));var fs=require('fs');var fs_extra=require(_0x98de('0xa'));var _=require(_0x98de('0xb'));var squel=require(_0x98de('0xc'));var crypto=require(_0x98de('0xd'));var jsforce=require(_0x98de('0xe'));var deskjs=require(_0x98de('0xf'));var toCsv=require(_0x98de('0x8'));var querystring=require(_0x98de('0x10'));var Papa=require(_0x98de('0x11'));var Redis=require(_0x98de('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x98de('0x13'));var as=require(_0x98de('0x14'));var hardwareService=require(_0x98de('0x15'));var logger=require(_0x98de('0x16'))(_0x98de('0x17'));var utils=require(_0x98de('0x18'));var config=require(_0x98de('0x19'));var licenseUtil=require(_0x98de('0x1a'));var db=require(_0x98de('0x1b'))['db'];function respondWithStatusCode(_0x46093b,_0x49c940){_0x49c940=_0x49c940||0xcc;return function(_0x11dad3){if(_0x11dad3){return _0x46093b[_0x98de('0x1c')](_0x49c940);}return _0x46093b['status'](_0x49c940)[_0x98de('0x1d')]();};}function respondWithResult(_0x5532b6,_0x3b5f91){_0x3b5f91=_0x3b5f91||0xc8;return function(_0x18036f){if(_0x18036f){return _0x5532b6[_0x98de('0x1e')](_0x3b5f91)[_0x98de('0x1f')](_0x18036f);}};}function respondWithFilteredResult(_0x338974,_0x7fd2ed){return function(_0x47c21b){if(_0x47c21b){var _0x4cf54a=typeof _0x7fd2ed[_0x98de('0x20')]===_0x98de('0x21')&&typeof _0x7fd2ed[_0x98de('0x22')]===_0x98de('0x21');var _0x492533=_0x47c21b[_0x98de('0x23')];var _0x2c91e2=_0x4cf54a?0x0:_0x7fd2ed[_0x98de('0x20')];var _0x1ed296=_0x4cf54a?_0x47c21b['count']:_0x7fd2ed[_0x98de('0x20')]+_0x7fd2ed['limit'];var _0x2f8dc2;if(_0x1ed296>=_0x492533){_0x1ed296=_0x492533;_0x2f8dc2=0xc8;}else{_0x2f8dc2=0xce;}_0x338974['status'](_0x2f8dc2);return _0x338974[_0x98de('0x24')]('Content-Range',_0x2c91e2+'-'+_0x1ed296+'/'+_0x492533)[_0x98de('0x1f')](_0x47c21b);}return null;};}function patchUpdates(_0x2bc60e){return function(_0x47ce79){try{jsonpatch[_0x98de('0x25')](_0x47ce79,_0x2bc60e,!![]);}catch(_0x34f34f){return BPromise[_0x98de('0x26')](_0x34f34f);}return _0x47ce79[_0x98de('0x27')]();};}function saveUpdates(_0x5c0993,_0x5bc559){return function(_0x152771){if(_0x152771){return _0x152771['update'](_0x5c0993)['then'](function(_0x1690fe){return _0x1690fe;});}return null;};}function removeEntity(_0x40c233,_0x46485d){return function(_0xfe5b9f){if(_0xfe5b9f){return _0xfe5b9f[_0x98de('0x28')]()[_0x98de('0x29')](function(){_0x40c233[_0x98de('0x1e')](0xcc)[_0x98de('0x1d')]();});}};}function handleEntityNotFound(_0x8a6b10,_0x5aa630){return function(_0x170217){if(!_0x170217){_0x8a6b10[_0x98de('0x1c')](0x194);}return _0x170217;};}function handleError(_0x3e1b7c,_0x160b51){_0x160b51=_0x160b51||0x1f4;return function(_0x2b66d3){logger['error'](_0x2b66d3[_0x98de('0x2a')]);if(_0x2b66d3[_0x98de('0x2b')]){delete _0x2b66d3[_0x98de('0x2b')];}_0x3e1b7c['status'](_0x160b51)[_0x98de('0x2c')](_0x2b66d3);};}exports[_0x98de('0x2d')]=function(_0x23a53e,_0x591b57){var _0x2e0b1a={},_0x47bb4d={},_0x326d3f={'count':0x0,'rows':[]};var _0xebc4a1=_['map'](db[_0x98de('0x2e')][_0x98de('0x2f')],function(_0x50464a){return{'name':_0x50464a['fieldName'],'type':_0x50464a[_0x98de('0x30')][_0x98de('0x31')]};});_0x47bb4d['model']=_[_0x98de('0x32')](_0xebc4a1,'name');_0x47bb4d[_0x98de('0x33')]=_['keys'](_0x23a53e['query']);_0x47bb4d[_0x98de('0x34')]=_[_0x98de('0x35')](_0x47bb4d[_0x98de('0x36')],_0x47bb4d[_0x98de('0x33')]);_0x2e0b1a[_0x98de('0x37')]=_[_0x98de('0x35')](_0x47bb4d[_0x98de('0x36')],qs[_0x98de('0x38')](_0x23a53e[_0x98de('0x33')][_0x98de('0x38')]));_0x2e0b1a[_0x98de('0x37')]=_0x2e0b1a['attributes'][_0x98de('0x39')]?_0x2e0b1a[_0x98de('0x37')]:_0x47bb4d[_0x98de('0x36')];if(!_0x23a53e['query'][_0x98de('0x3a')](_0x98de('0x3b'))){_0x2e0b1a[_0x98de('0x22')]=qs[_0x98de('0x22')](_0x23a53e['query'][_0x98de('0x22')]);_0x2e0b1a[_0x98de('0x20')]=qs['offset'](_0x23a53e['query']['offset']);}_0x2e0b1a[_0x98de('0x3c')]=qs[_0x98de('0x3d')](_0x23a53e['query'][_0x98de('0x3d')]);_0x2e0b1a[_0x98de('0x3e')]=qs[_0x98de('0x34')](_[_0x98de('0x3f')](_0x23a53e[_0x98de('0x33')],_0x47bb4d[_0x98de('0x34')]),_0xebc4a1);if(_0x23a53e[_0x98de('0x33')][_0x98de('0x40')]){_0x2e0b1a[_0x98de('0x3e')]=_[_0x98de('0x41')](_0x2e0b1a['where'],{'$or':_[_0x98de('0x32')](_0xebc4a1,function(_0x11f281){if(_0x11f281[_0x98de('0x30')]!==_0x98de('0x42')){var _0x3a649={};_0x3a649[_0x11f281[_0x98de('0x2b')]]={'$like':'%'+_0x23a53e[_0x98de('0x33')][_0x98de('0x40')]+'%'};return _0x3a649;}})});}_0x2e0b1a=_[_0x98de('0x41')]({},_0x2e0b1a,_0x23a53e[_0x98de('0x43')]);var _0x2e7337={'where':_0x2e0b1a['where']};return db[_0x98de('0x2e')][_0x98de('0x23')](_0x2e7337)['then'](function(_0x119610){_0x326d3f[_0x98de('0x23')]=_0x119610;if(_0x23a53e[_0x98de('0x33')]['includeAll']){_0x2e0b1a[_0x98de('0x44')]=[{'all':!![]}];}return db[_0x98de('0x2e')][_0x98de('0x45')](_0x2e0b1a);})[_0x98de('0x29')](function(_0x5ae822){_0x326d3f[_0x98de('0x46')]=_0x5ae822;return _0x326d3f;})[_0x98de('0x29')](respondWithFilteredResult(_0x591b57,_0x2e0b1a))[_0x98de('0x47')](handleError(_0x591b57,null));};exports[_0x98de('0x48')]=function(_0x14c6cf,_0x6c512a){var _0x2d5da6={'raw':!![],'where':{'id':_0x14c6cf[_0x98de('0x49')]['id']}},_0x2a27f2={};_0x2a27f2[_0x98de('0x36')]=_['keys'](db[_0x98de('0x2e')][_0x98de('0x2f')]);_0x2a27f2[_0x98de('0x33')]=_[_0x98de('0x4a')](_0x14c6cf[_0x98de('0x33')]);_0x2a27f2[_0x98de('0x34')]=_[_0x98de('0x35')](_0x2a27f2[_0x98de('0x36')],_0x2a27f2[_0x98de('0x33')]);_0x2d5da6['attributes']=_[_0x98de('0x35')](_0x2a27f2[_0x98de('0x36')],qs[_0x98de('0x38')](_0x14c6cf['query']['fields']));_0x2d5da6[_0x98de('0x37')]=_0x2d5da6['attributes'][_0x98de('0x39')]?_0x2d5da6[_0x98de('0x37')]:_0x2a27f2[_0x98de('0x36')];if(_0x14c6cf['query']['includeAll']){_0x2d5da6[_0x98de('0x44')]=[{'all':!![]}];}_0x2d5da6=_['merge']({},_0x2d5da6,_0x14c6cf[_0x98de('0x43')]);return db[_0x98de('0x2e')][_0x98de('0x4b')](_0x2d5da6)[_0x98de('0x29')](handleEntityNotFound(_0x6c512a,null))['then'](respondWithResult(_0x6c512a,null))[_0x98de('0x47')](handleError(_0x6c512a,null));};exports[_0x98de('0x4c')]=function(_0x1d952e,_0x3c1325){return db[_0x98de('0x2e')][_0x98de('0x4c')](_0x1d952e['body'],{})[_0x98de('0x29')](respondWithResult(_0x3c1325,0xc9))[_0x98de('0x47')](handleError(_0x3c1325,null));};exports[_0x98de('0x4d')]=function(_0x8cbead,_0x436653){if(_0x8cbead[_0x98de('0x4e')]['id']){delete _0x8cbead[_0x98de('0x4e')]['id'];}return db[_0x98de('0x2e')]['find']({'where':{'id':_0x8cbead['params']['id']}})[_0x98de('0x29')](handleEntityNotFound(_0x436653,null))[_0x98de('0x29')](saveUpdates(_0x8cbead[_0x98de('0x4e')],null))[_0x98de('0x29')](respondWithResult(_0x436653,null))[_0x98de('0x47')](handleError(_0x436653,null));};exports[_0x98de('0x28')]=function(_0x6f6c47,_0x386d76){return db['SmsTransferReport'][_0x98de('0x4b')]({'where':{'id':_0x6f6c47['params']['id']}})[_0x98de('0x29')](handleEntityNotFound(_0x386d76,null))[_0x98de('0x29')](removeEntity(_0x386d76,null))['catch'](handleError(_0x386d76,null));};exports[_0x98de('0x4f')]=function(_0x359f49,_0xc4c5a9){return db[_0x98de('0x2e')]['describe']()[_0x98de('0x29')](respondWithResult(_0xc4c5a9,null))['catch'](handleError(_0xc4c5a9,null));}; \ No newline at end of file +var _0xd233=['merge','create','body','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','stack','send','index','map','rawAttributes','fieldName','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','SmsTransferReport','includeAll','include','findAll','rows','catch','show','params'];(function(_0x1a9b15,_0x4f684d){var _0x55c0cd=function(_0x1afd85){while(--_0x1afd85){_0x1a9b15['push'](_0x1a9b15['shift']());}};_0x55c0cd(++_0x4f684d);}(_0xd233,0xe6));var _0x3d23=function(_0x2adfbd,_0x486dc0){_0x2adfbd=_0x2adfbd-0x0;var _0x22620c=_0xd233[_0x2adfbd];return _0x22620c;};'use strict';var emlformat=require(_0x3d23('0x0'));var rimraf=require(_0x3d23('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d23('0x2'));var rp=require('request-promise');var moment=require(_0x3d23('0x3'));var BPromise=require(_0x3d23('0x4'));var Mustache=require('mustache');var util=require(_0x3d23('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x3d23('0x6'));var ejs=require(_0x3d23('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d23('0x8'));var squel=require(_0x3d23('0x9'));var crypto=require(_0x3d23('0xa'));var jsforce=require(_0x3d23('0xb'));var deskjs=require(_0x3d23('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3d23('0xd'));var Papa=require(_0x3d23('0xe'));var Redis=require(_0x3d23('0xf'));var authService=require(_0x3d23('0x10'));var qs=require(_0x3d23('0x11'));var as=require(_0x3d23('0x12'));var hardwareService=require(_0x3d23('0x13'));var logger=require(_0x3d23('0x14'))(_0x3d23('0x15'));var utils=require('../../config/utils');var config=require(_0x3d23('0x16'));var licenseUtil=require(_0x3d23('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x306fbd,_0x5e9599){_0x5e9599=_0x5e9599||0xcc;return function(_0x9c56fe){if(_0x9c56fe){return _0x306fbd[_0x3d23('0x18')](_0x5e9599);}return _0x306fbd[_0x3d23('0x19')](_0x5e9599)[_0x3d23('0x1a')]();};}function respondWithResult(_0x7fe960,_0x484cba){_0x484cba=_0x484cba||0xc8;return function(_0x3436de){if(_0x3436de){return _0x7fe960[_0x3d23('0x19')](_0x484cba)[_0x3d23('0x1b')](_0x3436de);}};}function respondWithFilteredResult(_0x2996e2,_0x5662bf){return function(_0x26a2f6){if(_0x26a2f6){var _0xc5d850=typeof _0x5662bf[_0x3d23('0x1c')]==='undefined'&&typeof _0x5662bf[_0x3d23('0x1d')]===_0x3d23('0x1e');var _0x48bf6a=_0x26a2f6[_0x3d23('0x1f')];var _0x1307bb=_0xc5d850?0x0:_0x5662bf[_0x3d23('0x1c')];var _0x444f63=_0xc5d850?_0x26a2f6['count']:_0x5662bf[_0x3d23('0x1c')]+_0x5662bf[_0x3d23('0x1d')];var _0x4a1e6f;if(_0x444f63>=_0x48bf6a){_0x444f63=_0x48bf6a;_0x4a1e6f=0xc8;}else{_0x4a1e6f=0xce;}_0x2996e2[_0x3d23('0x19')](_0x4a1e6f);return _0x2996e2[_0x3d23('0x20')](_0x3d23('0x21'),_0x1307bb+'-'+_0x444f63+'/'+_0x48bf6a)['json'](_0x26a2f6);}return null;};}function patchUpdates(_0x489922){return function(_0x5cc34){try{jsonpatch[_0x3d23('0x22')](_0x5cc34,_0x489922,!![]);}catch(_0x3a7c9e){return BPromise[_0x3d23('0x23')](_0x3a7c9e);}return _0x5cc34['save']();};}function saveUpdates(_0x1dc86d,_0x2f1d56){return function(_0x2bb8c3){if(_0x2bb8c3){return _0x2bb8c3[_0x3d23('0x24')](_0x1dc86d)[_0x3d23('0x25')](function(_0x56d860){return _0x56d860;});}return null;};}function removeEntity(_0x15d544,_0x1d4230){return function(_0x6cd0d9){if(_0x6cd0d9){return _0x6cd0d9[_0x3d23('0x26')]()[_0x3d23('0x25')](function(){_0x15d544[_0x3d23('0x19')](0xcc)[_0x3d23('0x1a')]();});}};}function handleEntityNotFound(_0x4dba3d,_0x23f427){return function(_0x1cc383){if(!_0x1cc383){_0x4dba3d[_0x3d23('0x18')](0x194);}return _0x1cc383;};}function handleError(_0x17e28c,_0xc82f29){_0xc82f29=_0xc82f29||0x1f4;return function(_0x4bc9cf){logger['error'](_0x4bc9cf[_0x3d23('0x27')]);if(_0x4bc9cf['name']){delete _0x4bc9cf['name'];}_0x17e28c['status'](_0xc82f29)[_0x3d23('0x28')](_0x4bc9cf);};}exports[_0x3d23('0x29')]=function(_0x3ef7b8,_0x210585){var _0x3c0817={},_0x3f1826={},_0x544762={'count':0x0,'rows':[]};var _0xd58961=_[_0x3d23('0x2a')](db['SmsTransferReport'][_0x3d23('0x2b')],function(_0x3c0ed0){return{'name':_0x3c0ed0[_0x3d23('0x2c')],'type':_0x3c0ed0['type']['key']};});_0x3f1826[_0x3d23('0x2d')]=_[_0x3d23('0x2a')](_0xd58961,_0x3d23('0x2e'));_0x3f1826['query']=_[_0x3d23('0x2f')](_0x3ef7b8[_0x3d23('0x30')]);_0x3f1826[_0x3d23('0x31')]=_[_0x3d23('0x32')](_0x3f1826[_0x3d23('0x2d')],_0x3f1826['query']);_0x3c0817[_0x3d23('0x33')]=_[_0x3d23('0x32')](_0x3f1826['model'],qs['fields'](_0x3ef7b8[_0x3d23('0x30')][_0x3d23('0x34')]));_0x3c0817[_0x3d23('0x33')]=_0x3c0817[_0x3d23('0x33')][_0x3d23('0x35')]?_0x3c0817['attributes']:_0x3f1826['model'];if(!_0x3ef7b8[_0x3d23('0x30')][_0x3d23('0x36')]('nolimit')){_0x3c0817[_0x3d23('0x1d')]=qs['limit'](_0x3ef7b8[_0x3d23('0x30')][_0x3d23('0x1d')]);_0x3c0817[_0x3d23('0x1c')]=qs['offset'](_0x3ef7b8[_0x3d23('0x30')][_0x3d23('0x1c')]);}_0x3c0817[_0x3d23('0x37')]=qs[_0x3d23('0x38')](_0x3ef7b8['query'][_0x3d23('0x38')]);_0x3c0817[_0x3d23('0x39')]=qs[_0x3d23('0x31')](_[_0x3d23('0x3a')](_0x3ef7b8[_0x3d23('0x30')],_0x3f1826[_0x3d23('0x31')]),_0xd58961);if(_0x3ef7b8[_0x3d23('0x30')][_0x3d23('0x3b')]){_0x3c0817[_0x3d23('0x39')]=_['merge'](_0x3c0817[_0x3d23('0x39')],{'$or':_[_0x3d23('0x2a')](_0xd58961,function(_0x5ab9dc){if(_0x5ab9dc['type']!==_0x3d23('0x3c')){var _0x49950={};_0x49950[_0x5ab9dc[_0x3d23('0x2e')]]={'$like':'%'+_0x3ef7b8[_0x3d23('0x30')][_0x3d23('0x3b')]+'%'};return _0x49950;}})});}_0x3c0817=_['merge']({},_0x3c0817,_0x3ef7b8[_0x3d23('0x3d')]);var _0x1ba075={'where':_0x3c0817['where']};return db[_0x3d23('0x3e')][_0x3d23('0x1f')](_0x1ba075)[_0x3d23('0x25')](function(_0x9ad8b1){_0x544762[_0x3d23('0x1f')]=_0x9ad8b1;if(_0x3ef7b8[_0x3d23('0x30')][_0x3d23('0x3f')]){_0x3c0817[_0x3d23('0x40')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x3d23('0x41')](_0x3c0817);})['then'](function(_0x4c4b64){_0x544762[_0x3d23('0x42')]=_0x4c4b64;return _0x544762;})['then'](respondWithFilteredResult(_0x210585,_0x3c0817))[_0x3d23('0x43')](handleError(_0x210585,null));};exports[_0x3d23('0x44')]=function(_0x721055,_0x5f56ed){var _0x45ae48={'raw':!![],'where':{'id':_0x721055[_0x3d23('0x45')]['id']}},_0x4199f0={};_0x4199f0[_0x3d23('0x2d')]=_[_0x3d23('0x2f')](db['SmsTransferReport'][_0x3d23('0x2b')]);_0x4199f0[_0x3d23('0x30')]=_['keys'](_0x721055[_0x3d23('0x30')]);_0x4199f0[_0x3d23('0x31')]=_[_0x3d23('0x32')](_0x4199f0[_0x3d23('0x2d')],_0x4199f0[_0x3d23('0x30')]);_0x45ae48[_0x3d23('0x33')]=_['intersection'](_0x4199f0['model'],qs['fields'](_0x721055[_0x3d23('0x30')][_0x3d23('0x34')]));_0x45ae48[_0x3d23('0x33')]=_0x45ae48[_0x3d23('0x33')]['length']?_0x45ae48[_0x3d23('0x33')]:_0x4199f0[_0x3d23('0x2d')];if(_0x721055[_0x3d23('0x30')][_0x3d23('0x3f')]){_0x45ae48['include']=[{'all':!![]}];}_0x45ae48=_[_0x3d23('0x46')]({},_0x45ae48,_0x721055[_0x3d23('0x3d')]);return db['SmsTransferReport']['find'](_0x45ae48)[_0x3d23('0x25')](handleEntityNotFound(_0x5f56ed,null))[_0x3d23('0x25')](respondWithResult(_0x5f56ed,null))[_0x3d23('0x43')](handleError(_0x5f56ed,null));};exports[_0x3d23('0x47')]=function(_0x2991b2,_0x4172ca){return db[_0x3d23('0x3e')][_0x3d23('0x47')](_0x2991b2[_0x3d23('0x48')],{})['then'](respondWithResult(_0x4172ca,0xc9))[_0x3d23('0x43')](handleError(_0x4172ca,null));};exports[_0x3d23('0x24')]=function(_0x2cfcd5,_0x5d2da0){if(_0x2cfcd5[_0x3d23('0x48')]['id']){delete _0x2cfcd5['body']['id'];}return db[_0x3d23('0x3e')][_0x3d23('0x49')]({'where':{'id':_0x2cfcd5[_0x3d23('0x45')]['id']}})[_0x3d23('0x25')](handleEntityNotFound(_0x5d2da0,null))[_0x3d23('0x25')](saveUpdates(_0x2cfcd5[_0x3d23('0x48')],null))['then'](respondWithResult(_0x5d2da0,null))[_0x3d23('0x43')](handleError(_0x5d2da0,null));};exports[_0x3d23('0x26')]=function(_0x3b36f9,_0x2133f6){return db['SmsTransferReport'][_0x3d23('0x49')]({'where':{'id':_0x3b36f9[_0x3d23('0x45')]['id']}})[_0x3d23('0x25')](handleEntityNotFound(_0x2133f6,null))[_0x3d23('0x25')](removeEntity(_0x2133f6,null))[_0x3d23('0x43')](handleError(_0x2133f6,null));};exports['describe']=function(_0x4a626b,_0x2bc5f5){return db['SmsTransferReport'][_0x3d23('0x4a')]()['then'](respondWithResult(_0x2bc5f5,null))[_0x3d23('0x43')](handleError(_0x2bc5f5,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index d881acf..19cc726 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 _0x2cbe=['define','uniqueid','util','../../config/logger','api','moment','rimraf','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x59393a,_0x2207cc){var _0x5e5d02=function(_0x95f94d){while(--_0x95f94d){_0x59393a['push'](_0x59393a['shift']());}};_0x5e5d02(++_0x2207cc);}(_0x2cbe,0x110));var _0xe2cb=function(_0x2bcd1f,_0x4f1972){_0x2bcd1f=_0x2bcd1f-0x0;var _0x2381ca=_0x2cbe[_0x2bcd1f];return _0x2381ca;};'use strict';var _=require('lodash');var util=require(_0xe2cb('0x0'));var logger=require(_0xe2cb('0x1'))(_0xe2cb('0x2'));var moment=require(_0xe2cb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe2cb('0x4'));var config=require(_0xe2cb('0x5'));var attributes=require(_0xe2cb('0x6'));module[_0xe2cb('0x7')]=function(_0x468d75,_0x4abcca){return _0x468d75[_0xe2cb('0x8')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xe2cb('0x9'),'fields':[_0xe2cb('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab86=['./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','bluebird','path','../../config/environment'];(function(_0x1f0d91,_0x24b032){var _0xafee7a=function(_0x2d1295){while(--_0x2d1295){_0x1f0d91['push'](_0x1f0d91['shift']());}};_0xafee7a(++_0x24b032);}(_0xab86,0x13e));var _0x6ab8=function(_0x55b1be,_0x38b59a){_0x55b1be=_0x55b1be-0x0;var _0x23d5e4=_0xab86[_0x55b1be];return _0x23d5e4;};'use strict';var _=require(_0x6ab8('0x0'));var util=require(_0x6ab8('0x1'));var logger=require(_0x6ab8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ab8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ab8('0x4'));var rimraf=require('rimraf');var config=require(_0x6ab8('0x5'));var attributes=require(_0x6ab8('0x6'));module[_0x6ab8('0x7')]=function(_0x154d17,_0x6f41f){return _0x154d17[_0x6ab8('0x8')](_0x6ab8('0x9'),attributes,{'tableName':_0x6ab8('0xa'),'paranoid':![],'indexes':[{'name':_0x6ab8('0xb'),'fields':[_0x6ab8('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 1866686..5fd3427 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 _0xc6ab=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','stringify','error','code','SmsTransferReport,\x20%s,\x20%s'];(function(_0x2e795a,_0x379bbf){var _0x25c62e=function(_0x50667b){while(--_0x50667b){_0x2e795a['push'](_0x2e795a['shift']());}};_0x25c62e(++_0x379bbf);}(_0xc6ab,0x96));var _0xbc6a=function(_0x54a79c,_0x59e212){_0x54a79c=_0x54a79c-0x0;var _0x5d9db9=_0xc6ab[_0x54a79c];return _0x5d9db9;};'use strict';var _=require(_0xbc6a('0x0'));var util=require(_0xbc6a('0x1'));var moment=require(_0xbc6a('0x2'));var BPromise=require(_0xbc6a('0x3'));var rs=require(_0xbc6a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbc6a('0x5'));var logger=require(_0xbc6a('0x6'))(_0xbc6a('0x7'));var config=require(_0xbc6a('0x8'));var jayson=require(_0xbc6a('0x9'));var client=jayson['client'][_0xbc6a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x263f4b,_0x325592,_0x1b7a4c){return new BPromise(function(_0x2f7f5f,_0x529b73){return client['request'](_0x263f4b,_0x1b7a4c)[_0xbc6a('0xb')](function(_0x2a1ba6){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x325592,_0xbc6a('0xc'));logger[_0xbc6a('0xd')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x325592,_0xbc6a('0xc'),JSON[_0xbc6a('0xe')](_0x2a1ba6));if(_0x2a1ba6[_0xbc6a('0xf')]){if(_0x2a1ba6['error'][_0xbc6a('0x10')]===0x1f4){logger[_0xbc6a('0xf')](_0xbc6a('0x11'),_0x325592,_0x2a1ba6[_0xbc6a('0xf')]['message']);return _0x529b73(_0x2a1ba6['error']['message']);}logger[_0xbc6a('0xf')](_0xbc6a('0x11'),_0x325592,_0x2a1ba6['error'][_0xbc6a('0x12')]);return _0x2f7f5f(_0x2a1ba6['error'][_0xbc6a('0x12')]);}else{logger['info'](_0xbc6a('0x11'),_0x325592,_0xbc6a('0xc'));_0x2f7f5f(_0x2a1ba6[_0xbc6a('0x13')][_0xbc6a('0x12')]);}})[_0xbc6a('0x14')](function(_0x3e6393){logger[_0xbc6a('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x325592,_0x3e6393);_0x529b73(_0x3e6393);});});} \ No newline at end of file +var _0x5636=['code','SmsTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5636,0x102));var _0x6563=function(_0x99dd3,_0x5f3c54){_0x99dd3=_0x99dd3-0x0;var _0x4d79ea=_0x5636[_0x99dd3];return _0x4d79ea;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6563('0x2'));var db=require(_0x6563('0x3'))['db'];var utils=require(_0x6563('0x4'));var logger=require('../../config/logger')(_0x6563('0x5'));var config=require(_0x6563('0x6'));var jayson=require(_0x6563('0x7'));var client=jayson[_0x6563('0x8')][_0x6563('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x193942,_0x9884a9,_0x2d57d5){return new BPromise(function(_0x2d0d5b,_0x98fcd4){return client[_0x6563('0xa')](_0x193942,_0x2d57d5)[_0x6563('0xb')](function(_0x3ccb4e){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x9884a9,_0x6563('0xc'));logger[_0x6563('0xd')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x9884a9,'request\x20sent',JSON['stringify'](_0x3ccb4e));if(_0x3ccb4e[_0x6563('0xe')]){if(_0x3ccb4e[_0x6563('0xe')][_0x6563('0xf')]===0x1f4){logger[_0x6563('0xe')](_0x6563('0x10'),_0x9884a9,_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);return _0x98fcd4(_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);}logger['error'](_0x6563('0x10'),_0x9884a9,_0x3ccb4e['error'][_0x6563('0x11')]);return _0x2d0d5b(_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);}else{logger[_0x6563('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x9884a9,_0x6563('0xc'));_0x2d0d5b(_0x3ccb4e[_0x6563('0x13')][_0x6563('0x11')]);}})[_0x6563('0x14')](function(_0x4e7282){logger[_0x6563('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x9884a9,_0x4e7282);_0x98fcd4(_0x4e7282);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 3d9d386..549fa74 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 _0x5c78=['../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','/:id','isAuthenticated','show','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','now','extname','single','create','delete','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0xd649c1,_0x328221){var _0x17a73f=function(_0x5aad7e){while(--_0x5aad7e){_0xd649c1['push'](_0xd649c1['shift']());}};_0x17a73f(++_0x328221);}(_0x5c78,0x1f2));var _0x85c7=function(_0x1e6b46,_0x4130bf){_0x1e6b46=_0x1e6b46-0x0;var _0xefd0ac=_0x5c78[_0x1e6b46];return _0xefd0ac;};'use strict';var multer=require(_0x85c7('0x0'));var util=require(_0x85c7('0x1'));var path=require(_0x85c7('0x2'));var timeout=require(_0x85c7('0x3'));var express=require('express');var router=express[_0x85c7('0x4')]();var fs_extra=require(_0x85c7('0x5'));var auth=require(_0x85c7('0x6'));var interaction=require(_0x85c7('0x7'));var config=require(_0x85c7('0x8'));var controller=require(_0x85c7('0x9'));router[_0x85c7('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x85c7('0xa')](_0x85c7('0xb'),auth[_0x85c7('0xc')](),controller[_0x85c7('0xd')]);router[_0x85c7('0xa')]('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x85c7('0xe')]({'destination':function(_0x23a080,_0x354798,_0x22d112){_0x22d112(null,path[_0x85c7('0xf')](config[_0x85c7('0x10')],_0x85c7('0x11')));},'filename':function(_0x5565da,_0x592d10,_0x515eef){_0x592d10[_0x85c7('0x12')]=_0x592d10[_0x85c7('0x12')][_0x85c7('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x515eef(null,util[_0x85c7('0x14')](_0x85c7('0x15'),path['basename'](_0x592d10[_0x85c7('0x12')],path['extname'](_0x592d10['originalname'])),Date[_0x85c7('0x16')](),path[_0x85c7('0x17')](_0x592d10[_0x85c7('0x12')])));}})});router['post']('/',upload[_0x85c7('0x18')]('file'),controller[_0x85c7('0x19')]);router['put']('/:id',auth[_0x85c7('0xc')](),controller['update']);router[_0x85c7('0x1a')](_0x85c7('0xb'),auth['isAuthenticated'](),controller[_0x85c7('0x1a')]);module[_0x85c7('0x1b')]=router; \ No newline at end of file +var _0xae76=['create','put','update','delete','exports','util','path','express','Router','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','/:id/download','download','root','server/files/sounds/original/','originalname','%s-%s%s','basename','extname','post','single','file'];(function(_0xf0ab02,_0x43c0c5){var _0x43bbb3=function(_0x590a41){while(--_0x590a41){_0xf0ab02['push'](_0xf0ab02['shift']());}};_0x43bbb3(++_0x43c0c5);}(_0xae76,0x1f3));var _0x6ae7=function(_0x5779dc,_0x46b82b){_0x5779dc=_0x5779dc-0x0;var _0x226637=_0xae76[_0x5779dc];return _0x226637;};'use strict';var multer=require('multer');var util=require(_0x6ae7('0x0'));var path=require(_0x6ae7('0x1'));var timeout=require('connect-timeout');var express=require(_0x6ae7('0x2'));var router=express[_0x6ae7('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6ae7('0x4'));var controller=require(_0x6ae7('0x5'));router[_0x6ae7('0x6')]('/',auth[_0x6ae7('0x7')](),controller['index']);router[_0x6ae7('0x6')](_0x6ae7('0x8'),auth[_0x6ae7('0x7')](),controller[_0x6ae7('0x9')]);router['get'](_0x6ae7('0xa'),auth[_0x6ae7('0x7')](),controller[_0x6ae7('0xb')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2fbf90,_0x51dd28,_0xe87650){_0xe87650(null,path['join'](config[_0x6ae7('0xc')],_0x6ae7('0xd')));},'filename':function(_0x4770b3,_0x5e005d,_0x2ea2d2){_0x5e005d[_0x6ae7('0xe')]=_0x5e005d[_0x6ae7('0xe')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2ea2d2(null,util['format'](_0x6ae7('0xf'),path[_0x6ae7('0x10')](_0x5e005d[_0x6ae7('0xe')],path[_0x6ae7('0x11')](_0x5e005d[_0x6ae7('0xe')])),Date['now'](),path[_0x6ae7('0x11')](_0x5e005d[_0x6ae7('0xe')])));}})});router[_0x6ae7('0x12')]('/',upload[_0x6ae7('0x13')](_0x6ae7('0x14')),controller[_0x6ae7('0x15')]);router[_0x6ae7('0x16')](_0x6ae7('0x8'),auth[_0x6ae7('0x7')](),controller[_0x6ae7('0x17')]);router[_0x6ae7('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x6ae7('0x18')]);module[_0x6ae7('0x19')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 17513c7..86f4984 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 _0xefb6=['BIGINT','FLOAT','INTEGER','sequelize','exports','STRING'];(function(_0x21de5c,_0x2abe23){var _0x23db32=function(_0x305b0e){while(--_0x305b0e){_0x21de5c['push'](_0x21de5c['shift']());}};_0x23db32(++_0x2abe23);}(_0xefb6,0x1ad));var _0x6efb=function(_0x4327fe,_0x4f8040){_0x4327fe=_0x4327fe-0x0;var _0x138651=_0xefb6[_0x4327fe];return _0x138651;};'use strict';var Sequelize=require(_0x6efb('0x0'));module[_0x6efb('0x1')]={'name':{'type':Sequelize[_0x6efb('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x6efb('0x2')]},'display_name':{'type':Sequelize[_0x6efb('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x6efb('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x6efb('0x3')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x6efb('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x6efb('0x3')]},'converted_channelCount':{'type':Sequelize[_0x6efb('0x5')]},'converted_bitRate':{'type':Sequelize[_0x6efb('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x6efb('0x5')]}}; \ No newline at end of file +var _0x1da6=['STRING','name','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0xa079f3,_0x54543d){var _0x932bf9=function(_0x1dff7d){while(--_0x1dff7d){_0xa079f3['push'](_0xa079f3['shift']());}};_0x932bf9(++_0x54543d);}(_0x1da6,0x7c));var _0x61da=function(_0x2962b4,_0x4b0786){_0x2962b4=_0x2962b4-0x0;var _0x411b7d=_0x1da6[_0x2962b4];return _0x411b7d;};'use strict';var Sequelize=require(_0x61da('0x0'));module[_0x61da('0x1')]={'name':{'type':Sequelize[_0x61da('0x2')],'unique':_0x61da('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x61da('0x2')]},'display_name':{'type':Sequelize[_0x61da('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x61da('0x2')]},'original_format':{'type':Sequelize[_0x61da('0x2')]},'original_duration':{'type':Sequelize[_0x61da('0x4')]},'original_sampleCount':{'type':Sequelize[_0x61da('0x5')]},'original_channelCount':{'type':Sequelize[_0x61da('0x6')]},'original_bitRate':{'type':Sequelize[_0x61da('0x5')]},'original_sampleRate':{'type':Sequelize[_0x61da('0x6')]},'converted_format':{'type':Sequelize[_0x61da('0x2')]},'converted_duration':{'type':Sequelize[_0x61da('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x61da('0x5')]},'converted_channelCount':{'type':Sequelize[_0x61da('0x6')]},'converted_bitRate':{'type':Sequelize[_0x61da('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x61da('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index df868d7..0cda1ef 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 _0xf171=['offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','get','UserProfileResource','destroy','name','index','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','download','params','converted_format','existsSync','join','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','root','format','%s.%s','create','basename','file','originalname','filename','extname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','error','unlinkSync','send','src','original_duration','duration','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','0777','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','end','status'];(function(_0x342c8e,_0x5d5867){var _0x186394=function(_0x253cf4){while(--_0x253cf4){_0x342c8e['push'](_0x342c8e['shift']());}};_0x186394(++_0x5d5867);}(_0xf171,0x1d8));var _0x1f17=function(_0x1f62c3,_0x1ff95b){_0x1f62c3=_0x1f62c3-0x0;var _0x385c1c=_0xf171[_0x1f62c3];return _0x385c1c;};'use strict';var emlformat=require(_0x1f17('0x0'));var rimraf=require(_0x1f17('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f17('0x2'));var rp=require(_0x1f17('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1f17('0x4'));var util=require(_0x1f17('0x5'));var path=require(_0x1f17('0x6'));var sox=require(_0x1f17('0x7'));var csv=require(_0x1f17('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f17('0x9'));var _=require('lodash');var squel=require(_0x1f17('0xa'));var crypto=require(_0x1f17('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1f17('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1f17('0xd'));var Papa=require(_0x1f17('0xe'));var Redis=require('ioredis');var authService=require(_0x1f17('0xf'));var qs=require(_0x1f17('0x10'));var as=require(_0x1f17('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f17('0x12'))(_0x1f17('0x13'));var utils=require(_0x1f17('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26fd11,_0x595094){_0x595094=_0x595094||0xcc;return function(_0x3f8bf0){if(_0x3f8bf0){return _0x26fd11[_0x1f17('0x15')](_0x595094);}return _0x26fd11['status'](_0x595094)[_0x1f17('0x16')]();};}function respondWithResult(_0x30052d,_0x2ec811){_0x2ec811=_0x2ec811||0xc8;return function(_0x1babee){if(_0x1babee){return _0x30052d[_0x1f17('0x17')](_0x2ec811)['json'](_0x1babee);}};}function respondWithFilteredResult(_0x244549,_0x489370){return function(_0xa9cd82){if(_0xa9cd82){var _0xe5aa06=typeof _0x489370[_0x1f17('0x18')]===_0x1f17('0x19')&&typeof _0x489370[_0x1f17('0x1a')]==='undefined';var _0x433ea9=_0xa9cd82[_0x1f17('0x1b')];var _0x595595=_0xe5aa06?0x0:_0x489370[_0x1f17('0x18')];var _0xc20160=_0xe5aa06?_0xa9cd82[_0x1f17('0x1b')]:_0x489370[_0x1f17('0x18')]+_0x489370[_0x1f17('0x1a')];var _0x52d442;if(_0xc20160>=_0x433ea9){_0xc20160=_0x433ea9;_0x52d442=0xc8;}else{_0x52d442=0xce;}_0x244549['status'](_0x52d442);return _0x244549[_0x1f17('0x1c')](_0x1f17('0x1d'),_0x595595+'-'+_0xc20160+'/'+_0x433ea9)[_0x1f17('0x1e')](_0xa9cd82);}return null;};}function patchUpdates(_0x340c79){return function(_0x1e7d06){try{jsonpatch[_0x1f17('0x1f')](_0x1e7d06,_0x340c79,!![]);}catch(_0x54dfca){return BPromise[_0x1f17('0x20')](_0x54dfca);}return _0x1e7d06['save']();};}function saveUpdates(_0x31c345,_0x38f657){return function(_0x361d62){if(_0x361d62){return _0x361d62['update'](_0x31c345)[_0x1f17('0x21')](function(_0x4ef6bd){return _0x4ef6bd;});}return null;};}function removeEntity(_0xdaea69,_0xb489d5){return function(_0x51bce1){if(_0x51bce1){return _0x51bce1['destroy']()['then'](function(){var _0x220d9b=_0x51bce1[_0x1f17('0x22')]({'plain':!![]});var _0x30c63a='Sounds';return db[_0x1f17('0x23')][_0x1f17('0x24')]({'where':{'type':_0x30c63a,'resourceId':_0x220d9b['id']}})[_0x1f17('0x21')](function(){return _0x51bce1;});})[_0x1f17('0x21')](function(){_0xdaea69['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x448de7,_0x2d5be9){return function(_0x2f875e){if(!_0x2f875e){_0x448de7[_0x1f17('0x15')](0x194);}return _0x2f875e;};}function handleError(_0x487352,_0x2061c8){_0x2061c8=_0x2061c8||0x1f4;return function(_0x1d0474){logger['error'](_0x1d0474['stack']);if(_0x1d0474[_0x1f17('0x25')]){delete _0x1d0474['name'];}_0x487352['status'](_0x2061c8)['send'](_0x1d0474);};}exports[_0x1f17('0x26')]=function(_0x2ba9bf,_0x5561e2){var _0x2c33cf={},_0x4f5526={},_0x372724={'count':0x0,'rows':[]};var _0x21f938=_[_0x1f17('0x27')](db[_0x1f17('0x28')][_0x1f17('0x29')],function(_0x4ace05){return{'name':_0x4ace05[_0x1f17('0x2a')],'type':_0x4ace05[_0x1f17('0x2b')][_0x1f17('0x2c')]};});_0x4f5526[_0x1f17('0x2d')]=_[_0x1f17('0x27')](_0x21f938,_0x1f17('0x25'));_0x4f5526[_0x1f17('0x2e')]=_[_0x1f17('0x2f')](_0x2ba9bf[_0x1f17('0x2e')]);_0x4f5526['filters']=_[_0x1f17('0x30')](_0x4f5526[_0x1f17('0x2d')],_0x4f5526[_0x1f17('0x2e')]);_0x2c33cf['attributes']=_['intersection'](_0x4f5526['model'],qs[_0x1f17('0x31')](_0x2ba9bf['query'][_0x1f17('0x31')]));_0x2c33cf[_0x1f17('0x32')]=_0x2c33cf[_0x1f17('0x32')]['length']?_0x2c33cf[_0x1f17('0x32')]:_0x4f5526[_0x1f17('0x2d')];if(!_0x2ba9bf[_0x1f17('0x2e')][_0x1f17('0x33')](_0x1f17('0x34'))){_0x2c33cf[_0x1f17('0x1a')]=qs[_0x1f17('0x1a')](_0x2ba9bf['query'][_0x1f17('0x1a')]);_0x2c33cf[_0x1f17('0x18')]=qs[_0x1f17('0x18')](_0x2ba9bf['query']['offset']);}_0x2c33cf[_0x1f17('0x35')]=qs[_0x1f17('0x36')](_0x2ba9bf[_0x1f17('0x2e')][_0x1f17('0x36')]);_0x2c33cf['where']=qs[_0x1f17('0x37')](_[_0x1f17('0x38')](_0x2ba9bf[_0x1f17('0x2e')],_0x4f5526[_0x1f17('0x37')]),_0x21f938);if(_0x2ba9bf[_0x1f17('0x2e')][_0x1f17('0x39')]){_0x2c33cf[_0x1f17('0x3a')]=_[_0x1f17('0x3b')](_0x2c33cf[_0x1f17('0x3a')],{'$or':_[_0x1f17('0x27')](_0x21f938,function(_0x4cadfe){if(_0x4cadfe[_0x1f17('0x2b')]!==_0x1f17('0x3c')){var _0x483adf={};_0x483adf[_0x4cadfe[_0x1f17('0x25')]]={'$like':'%'+_0x2ba9bf[_0x1f17('0x2e')][_0x1f17('0x39')]+'%'};return _0x483adf;}})});}_0x2c33cf=_[_0x1f17('0x3b')]({},_0x2c33cf,_0x2ba9bf[_0x1f17('0x3d')]);var _0x333f0d={'where':_0x2c33cf[_0x1f17('0x3a')]};return db[_0x1f17('0x28')][_0x1f17('0x1b')](_0x333f0d)[_0x1f17('0x21')](function(_0x197704){_0x372724[_0x1f17('0x1b')]=_0x197704;if(_0x2ba9bf[_0x1f17('0x2e')][_0x1f17('0x3e')]){_0x2c33cf[_0x1f17('0x3f')]=[{'all':!![]}];}return db[_0x1f17('0x28')][_0x1f17('0x40')](_0x2c33cf);})[_0x1f17('0x21')](function(_0x19b3a7){_0x372724['rows']=_0x19b3a7;return _0x372724;})[_0x1f17('0x21')](respondWithFilteredResult(_0x5561e2,_0x2c33cf))[_0x1f17('0x41')](handleError(_0x5561e2,null));};exports[_0x1f17('0x42')]=function(_0xcb327b,_0x22da93){var _0x15de47={'raw':!![],'where':{'id':_0xcb327b['params']['id']}},_0x516fc8={};_0x516fc8['model']=_[_0x1f17('0x2f')](db[_0x1f17('0x28')][_0x1f17('0x29')]);_0x516fc8[_0x1f17('0x2e')]=_[_0x1f17('0x2f')](_0xcb327b[_0x1f17('0x2e')]);_0x516fc8['filters']=_[_0x1f17('0x30')](_0x516fc8['model'],_0x516fc8[_0x1f17('0x2e')]);_0x15de47['attributes']=_['intersection'](_0x516fc8[_0x1f17('0x2d')],qs[_0x1f17('0x31')](_0xcb327b[_0x1f17('0x2e')][_0x1f17('0x31')]));_0x15de47[_0x1f17('0x32')]=_0x15de47[_0x1f17('0x32')]['length']?_0x15de47[_0x1f17('0x32')]:_0x516fc8[_0x1f17('0x2d')];if(_0xcb327b['query']['includeAll']){_0x15de47[_0x1f17('0x3f')]=[{'all':!![]}];}_0x15de47=_[_0x1f17('0x3b')]({},_0x15de47,_0xcb327b[_0x1f17('0x3d')]);return db['Sound'][_0x1f17('0x43')](_0x15de47)['then'](handleEntityNotFound(_0x22da93,null))[_0x1f17('0x21')](respondWithResult(_0x22da93,null))[_0x1f17('0x41')](handleError(_0x22da93,null));};exports[_0x1f17('0x44')]=function(_0x3d8478,_0x375b01,_0x291868){return db[_0x1f17('0x28')][_0x1f17('0x43')]({'where':{'id':_0x3d8478[_0x1f17('0x45')]['id']},'attributes':[_0x1f17('0x25'),'save_name',_0x1f17('0x46')],'raw':!![]})[_0x1f17('0x21')](handleEntityNotFound(_0x375b01,null))['then'](function(_0x8311a0){if(_0x8311a0){if(!fs[_0x1f17('0x47')](path[_0x1f17('0x48')](config['root'],_0x1f17('0x49'),_0x8311a0[_0x1f17('0x4a')]+'.'+_0x8311a0[_0x1f17('0x46')]))){throw new db[(_0x1f17('0x4b'))][(_0x1f17('0x4c'))](_0x1f17('0x4d'));}return _0x375b01[_0x1f17('0x44')](path[_0x1f17('0x48')](config[_0x1f17('0x4e')],_0x1f17('0x49'),util[_0x1f17('0x4f')](_0x1f17('0x50'),_0x8311a0[_0x1f17('0x4a')],_0x8311a0[_0x1f17('0x46')])),util[_0x1f17('0x4f')](_0x1f17('0x50'),_0x8311a0['name'],_0x8311a0[_0x1f17('0x46')]));}return null;})[_0x1f17('0x41')](handleError(_0x375b01,null));};exports[_0x1f17('0x51')]=function(_0x330bda,_0x2102f1,_0x5ea347){var _0x499baf={'name':path[_0x1f17('0x52')](_0x330bda['file']['originalname'],path['extname'](_0x330bda[_0x1f17('0x53')][_0x1f17('0x54')])),'save_name':path[_0x1f17('0x52')](_0x330bda[_0x1f17('0x53')][_0x1f17('0x55')],path[_0x1f17('0x56')](_0x330bda['file']['filename'])),'original_format':path[_0x1f17('0x56')](_0x330bda[_0x1f17('0x53')][_0x1f17('0x54')])[_0x1f17('0x57')](0x1),'converted_format':_0x1f17('0x58')};var _0xdb2ca4=path['join'](config[_0x1f17('0x4e')],_0x1f17('0x59'),_0x330bda[_0x1f17('0x53')][_0x1f17('0x55')]);var _0x50fb3f=path['join'](config[_0x1f17('0x4e')],_0x1f17('0x49'),util['format'](_0x1f17('0x50'),path[_0x1f17('0x52')](_0x330bda[_0x1f17('0x53')][_0x1f17('0x55')],path[_0x1f17('0x56')](_0x330bda['file'][_0x1f17('0x55')])),_0x499baf[_0x1f17('0x46')]));logger[_0x1f17('0x5a')](_0x1f17('0x5b'),_0xdb2ca4);logger[_0x1f17('0x5a')](_0x1f17('0x5c'),_0x50fb3f);try{fs[_0x1f17('0x5d')](_0xdb2ca4,parseInt('0777',0x8));var _0x4750b9=sox[_0x1f17('0x5e')](_0xdb2ca4,_0x50fb3f,{'sampleRate':0x1f40,'format':_0x1f17('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4750b9['on'](_0x1f17('0x5f'),function(_0x2f30ac){fs[_0x1f17('0x60')](_0xdb2ca4);_0x2102f1['status'](0x1f4)[_0x1f17('0x61')](_0x2f30ac);});_0x4750b9['on'](_0x1f17('0x62'),function(_0x2b6e5d){_0x499baf[_0x1f17('0x63')]=isNaN(_0x2b6e5d['duration'])?null:_0x2b6e5d[_0x1f17('0x64')]*0x3e8;_0x499baf['original_sampleCount']=isNaN(_0x2b6e5d[_0x1f17('0x65')])?null:_0x2b6e5d[_0x1f17('0x65')];_0x499baf['original_channelCount']=isNaN(_0x2b6e5d['channelCount'])?null:_0x2b6e5d[_0x1f17('0x66')];_0x499baf[_0x1f17('0x67')]=isNaN(_0x2b6e5d['bitRate'])?null:_0x2b6e5d[_0x1f17('0x68')];_0x499baf[_0x1f17('0x69')]=isNaN(_0x2b6e5d[_0x1f17('0x6a')])?null:_0x2b6e5d[_0x1f17('0x6a')];});_0x4750b9['on'](_0x1f17('0x6b'),function(_0x6c59de){_0x499baf[_0x1f17('0x6c')]=isNaN(_0x6c59de[_0x1f17('0x64')])?null:_0x6c59de['duration']*0x3e8;_0x499baf[_0x1f17('0x6d')]=isNaN(_0x6c59de['sampleCount'])?null:_0x6c59de[_0x1f17('0x65')];_0x499baf[_0x1f17('0x6e')]=isNaN(_0x6c59de[_0x1f17('0x66')])?null:_0x6c59de['channelCount'];_0x499baf['converted_bitRate']=isNaN(_0x6c59de[_0x1f17('0x68')])?null:_0x6c59de['bitRate'];_0x499baf[_0x1f17('0x6f')]=isNaN(_0x6c59de[_0x1f17('0x6a')])?null:_0x6c59de['sampleRate'];});_0x4750b9['on'](_0x1f17('0x16'),function(){fs[_0x1f17('0x5d')](_0x50fb3f,parseInt(_0x1f17('0x70'),0x8));return db[_0x1f17('0x28')][_0x1f17('0x51')](_0x499baf)[_0x1f17('0x21')](function(_0x168bfa){var _0x34f79f={'role':_0x330bda['body'][_0x1f17('0x71')],'userProfileId':_0x330bda[_0x1f17('0x72')][_0x1f17('0x73')]};if(!_0x34f79f)throw new Error(_0x1f17('0x74'));if(_0x34f79f['role']==='user'){var _0x59cee1=_0x168bfa[_0x1f17('0x22')]({'plain':!![]});return db[_0x1f17('0x75')][_0x1f17('0x43')]({'where':{'name':'Sounds','userProfileId':_0x34f79f[_0x1f17('0x73')]},'raw':!![]})[_0x1f17('0x21')](function(_0x42509f){if(_0x42509f&&_0x42509f[_0x1f17('0x76')]===0x0){return db[_0x1f17('0x23')]['create']({'name':_0x59cee1[_0x1f17('0x25')],'resourceId':_0x59cee1['id'],'type':_0x42509f[_0x1f17('0x25')],'sectionId':_0x42509f['id']},{})[_0x1f17('0x21')](function(){return _0x168bfa;});}else{return _0x168bfa;}})[_0x1f17('0x41')](function(_0x8d851e){logger[_0x1f17('0x5f')](_0x1f17('0x77'),_0x8d851e);throw _0x8d851e;});}return _0x168bfa;})[_0x1f17('0x21')](respondWithResult(_0x2102f1,null))[_0x1f17('0x41')](handleError(_0x2102f1,null));});_0x4750b9[_0x1f17('0x78')]();}catch(_0x277a6e){_0x2102f1['status'](0x1f4)[_0x1f17('0x61')](_0x277a6e);}};exports['update']=function(_0x373cde,_0x2483c0,_0x26dc89){return db[_0x1f17('0x28')][_0x1f17('0x43')]({'where':{'id':_0x373cde[_0x1f17('0x45')]['id']}})[_0x1f17('0x21')](handleEntityNotFound(_0x2483c0,null))[_0x1f17('0x21')](saveUpdates(_[_0x1f17('0x38')](_0x373cde[_0x1f17('0x72')],[_0x1f17('0x25'),_0x1f17('0x79')]),null))['then'](respondWithResult(_0x2483c0,null))['catch'](handleError(_0x2483c0,null));};exports[_0x1f17('0x7a')]=function(_0x35702d,_0x1183bc,_0x5cd4d0){return db['Sound'][_0x1f17('0x43')]({'where':{'id':_0x35702d['params']['id']}})['then'](function(_0x48aaef){if(_0x48aaef){return _0x48aaef[_0x1f17('0x24')]();}})[_0x1f17('0x21')](function(_0x2106f2){var _0x17e0c6=path[_0x1f17('0x48')](config[_0x1f17('0x4e')],_0x1f17('0x59'),util[_0x1f17('0x4f')](_0x1f17('0x50'),_0x2106f2[_0x1f17('0x4a')],_0x2106f2[_0x1f17('0x7b')]));var _0x198a59=path[_0x1f17('0x48')](config[_0x1f17('0x4e')],_0x1f17('0x49'),util[_0x1f17('0x4f')]('%s.%s',_0x2106f2[_0x1f17('0x4a')],_0x2106f2[_0x1f17('0x46')]));fs[_0x1f17('0x60')](_0x17e0c6);fs['unlinkSync'](_0x198a59);return _0x2106f2;})['then'](function(_0x4bd32b){if(_0x4bd32b){return _0x1183bc['status'](0xcc)[_0x1f17('0x16')]();}})['then'](handleEntityNotFound(_0x1183bc,null))['catch'](handleError(_0x1183bc,null));}; \ No newline at end of file +var _0xa362=['originalname','filename','extname','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create','start','update','description','original_format','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','Sound','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','download','save_name','existsSync','join','root','converted_format','ValidationError','server/files/sounds/converted','format','%s.%s','basename','file'];(function(_0x51e0ff,_0x5179c6){var _0x3932bb=function(_0x50e0e5){while(--_0x50e0e5){_0x51e0ff['push'](_0x51e0ff['shift']());}};_0x3932bb(++_0x5179c6);}(_0xa362,0x117));var _0x2a36=function(_0x2703cd,_0x4de5e2){_0x2703cd=_0x2703cd-0x0;var _0x129a93=_0xa362[_0x2703cd];return _0x129a93;};'use strict';var emlformat=require(_0x2a36('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2a36('0x1'));var jsonpatch=require(_0x2a36('0x2'));var rp=require(_0x2a36('0x3'));var moment=require(_0x2a36('0x4'));var BPromise=require(_0x2a36('0x5'));var Mustache=require(_0x2a36('0x6'));var util=require(_0x2a36('0x7'));var path=require(_0x2a36('0x8'));var sox=require(_0x2a36('0x9'));var csv=require(_0x2a36('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2a36('0xb'));var crypto=require('crypto');var jsforce=require(_0x2a36('0xc'));var deskjs=require(_0x2a36('0xd'));var toCsv=require(_0x2a36('0xa'));var querystring=require(_0x2a36('0xe'));var Papa=require(_0x2a36('0xf'));var Redis=require(_0x2a36('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2a36('0x11'));var as=require(_0x2a36('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2a36('0x13'));var config=require(_0x2a36('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a36('0x15'))['db'];function respondWithStatusCode(_0x42fd23,_0x5c2fec){_0x5c2fec=_0x5c2fec||0xcc;return function(_0x6006e2){if(_0x6006e2){return _0x42fd23[_0x2a36('0x16')](_0x5c2fec);}return _0x42fd23['status'](_0x5c2fec)[_0x2a36('0x17')]();};}function respondWithResult(_0xb8f9be,_0x4986b0){_0x4986b0=_0x4986b0||0xc8;return function(_0x520ffa){if(_0x520ffa){return _0xb8f9be[_0x2a36('0x18')](_0x4986b0)[_0x2a36('0x19')](_0x520ffa);}};}function respondWithFilteredResult(_0x4783b9,_0x3d5aa0){return function(_0x38b507){if(_0x38b507){var _0x12c0a9=typeof _0x3d5aa0[_0x2a36('0x1a')]===_0x2a36('0x1b')&&typeof _0x3d5aa0[_0x2a36('0x1c')]==='undefined';var _0x99e316=_0x38b507['count'];var _0x3512c7=_0x12c0a9?0x0:_0x3d5aa0[_0x2a36('0x1a')];var _0x13ffc5=_0x12c0a9?_0x38b507[_0x2a36('0x1d')]:_0x3d5aa0[_0x2a36('0x1a')]+_0x3d5aa0[_0x2a36('0x1c')];var _0x2b42e2;if(_0x13ffc5>=_0x99e316){_0x13ffc5=_0x99e316;_0x2b42e2=0xc8;}else{_0x2b42e2=0xce;}_0x4783b9[_0x2a36('0x18')](_0x2b42e2);return _0x4783b9['set'](_0x2a36('0x1e'),_0x3512c7+'-'+_0x13ffc5+'/'+_0x99e316)['json'](_0x38b507);}return null;};}function patchUpdates(_0x3a6d2c){return function(_0x47f916){try{jsonpatch[_0x2a36('0x1f')](_0x47f916,_0x3a6d2c,!![]);}catch(_0xb9e7f6){return BPromise['reject'](_0xb9e7f6);}return _0x47f916[_0x2a36('0x20')]();};}function saveUpdates(_0x5a440a,_0x284588){return function(_0x29084b){if(_0x29084b){return _0x29084b['update'](_0x5a440a)[_0x2a36('0x21')](function(_0x3abbb1){return _0x3abbb1;});}return null;};}function removeEntity(_0xa647,_0x3c48b1){return function(_0x4f5656){if(_0x4f5656){return _0x4f5656[_0x2a36('0x22')]()[_0x2a36('0x21')](function(){var _0x3f9d2d=_0x4f5656[_0x2a36('0x23')]({'plain':!![]});var _0x8b23fe=_0x2a36('0x24');return db[_0x2a36('0x25')][_0x2a36('0x22')]({'where':{'type':_0x8b23fe,'resourceId':_0x3f9d2d['id']}})['then'](function(){return _0x4f5656;});})[_0x2a36('0x21')](function(){_0xa647[_0x2a36('0x18')](0xcc)[_0x2a36('0x17')]();});}};}function handleEntityNotFound(_0x560c83,_0x7a3459){return function(_0x130dca){if(!_0x130dca){_0x560c83[_0x2a36('0x16')](0x194);}return _0x130dca;};}function handleError(_0x5c8907,_0x16321f){_0x16321f=_0x16321f||0x1f4;return function(_0x49a653){logger[_0x2a36('0x26')](_0x49a653[_0x2a36('0x27')]);if(_0x49a653[_0x2a36('0x28')]){delete _0x49a653['name'];}_0x5c8907['status'](_0x16321f)[_0x2a36('0x29')](_0x49a653);};}exports[_0x2a36('0x2a')]=function(_0x3d79fe,_0x47e9c0){var _0xb3ddec={},_0x31ebc0={},_0x2b20a6={'count':0x0,'rows':[]};var _0x1a9793=_['map'](db[_0x2a36('0x2b')][_0x2a36('0x2c')],function(_0x36baad){return{'name':_0x36baad[_0x2a36('0x2d')],'type':_0x36baad['type'][_0x2a36('0x2e')]};});_0x31ebc0[_0x2a36('0x2f')]=_[_0x2a36('0x30')](_0x1a9793,'name');_0x31ebc0[_0x2a36('0x31')]=_[_0x2a36('0x32')](_0x3d79fe[_0x2a36('0x31')]);_0x31ebc0['filters']=_[_0x2a36('0x33')](_0x31ebc0[_0x2a36('0x2f')],_0x31ebc0[_0x2a36('0x31')]);_0xb3ddec['attributes']=_[_0x2a36('0x33')](_0x31ebc0[_0x2a36('0x2f')],qs['fields'](_0x3d79fe[_0x2a36('0x31')][_0x2a36('0x34')]));_0xb3ddec[_0x2a36('0x35')]=_0xb3ddec[_0x2a36('0x35')][_0x2a36('0x36')]?_0xb3ddec[_0x2a36('0x35')]:_0x31ebc0[_0x2a36('0x2f')];if(!_0x3d79fe['query'][_0x2a36('0x37')]('nolimit')){_0xb3ddec[_0x2a36('0x1c')]=qs[_0x2a36('0x1c')](_0x3d79fe[_0x2a36('0x31')][_0x2a36('0x1c')]);_0xb3ddec[_0x2a36('0x1a')]=qs[_0x2a36('0x1a')](_0x3d79fe[_0x2a36('0x31')]['offset']);}_0xb3ddec[_0x2a36('0x38')]=qs[_0x2a36('0x39')](_0x3d79fe[_0x2a36('0x31')][_0x2a36('0x39')]);_0xb3ddec[_0x2a36('0x3a')]=qs['filters'](_[_0x2a36('0x3b')](_0x3d79fe[_0x2a36('0x31')],_0x31ebc0[_0x2a36('0x3c')]),_0x1a9793);if(_0x3d79fe[_0x2a36('0x31')]['filter']){_0xb3ddec[_0x2a36('0x3a')]=_[_0x2a36('0x3d')](_0xb3ddec[_0x2a36('0x3a')],{'$or':_['map'](_0x1a9793,function(_0x448df0){if(_0x448df0[_0x2a36('0x3e')]!=='VIRTUAL'){var _0x4bf0c6={};_0x4bf0c6[_0x448df0[_0x2a36('0x28')]]={'$like':'%'+_0x3d79fe[_0x2a36('0x31')]['filter']+'%'};return _0x4bf0c6;}})});}_0xb3ddec=_[_0x2a36('0x3d')]({},_0xb3ddec,_0x3d79fe[_0x2a36('0x3f')]);var _0x49325e={'where':_0xb3ddec['where']};return db[_0x2a36('0x2b')][_0x2a36('0x1d')](_0x49325e)[_0x2a36('0x21')](function(_0x5c2df4){_0x2b20a6[_0x2a36('0x1d')]=_0x5c2df4;if(_0x3d79fe[_0x2a36('0x31')][_0x2a36('0x40')]){_0xb3ddec[_0x2a36('0x41')]=[{'all':!![]}];}return db[_0x2a36('0x2b')][_0x2a36('0x42')](_0xb3ddec);})['then'](function(_0x1a1bbc){_0x2b20a6[_0x2a36('0x43')]=_0x1a1bbc;return _0x2b20a6;})['then'](respondWithFilteredResult(_0x47e9c0,_0xb3ddec))[_0x2a36('0x44')](handleError(_0x47e9c0,null));};exports[_0x2a36('0x45')]=function(_0x4cef6f,_0x156848){var _0x3520c6={'raw':!![],'where':{'id':_0x4cef6f[_0x2a36('0x46')]['id']}},_0x36e2c4={};_0x36e2c4[_0x2a36('0x2f')]=_[_0x2a36('0x32')](db[_0x2a36('0x2b')]['rawAttributes']);_0x36e2c4[_0x2a36('0x31')]=_[_0x2a36('0x32')](_0x4cef6f['query']);_0x36e2c4[_0x2a36('0x3c')]=_[_0x2a36('0x33')](_0x36e2c4['model'],_0x36e2c4[_0x2a36('0x31')]);_0x3520c6['attributes']=_[_0x2a36('0x33')](_0x36e2c4['model'],qs[_0x2a36('0x34')](_0x4cef6f[_0x2a36('0x31')][_0x2a36('0x34')]));_0x3520c6[_0x2a36('0x35')]=_0x3520c6[_0x2a36('0x35')][_0x2a36('0x36')]?_0x3520c6[_0x2a36('0x35')]:_0x36e2c4['model'];if(_0x4cef6f[_0x2a36('0x31')][_0x2a36('0x40')]){_0x3520c6[_0x2a36('0x41')]=[{'all':!![]}];}_0x3520c6=_[_0x2a36('0x3d')]({},_0x3520c6,_0x4cef6f[_0x2a36('0x3f')]);return db[_0x2a36('0x2b')][_0x2a36('0x47')](_0x3520c6)['then'](handleEntityNotFound(_0x156848,null))[_0x2a36('0x21')](respondWithResult(_0x156848,null))[_0x2a36('0x44')](handleError(_0x156848,null));};exports[_0x2a36('0x48')]=function(_0x14d3fe,_0x57a2af,_0x356d1a){return db[_0x2a36('0x2b')][_0x2a36('0x47')]({'where':{'id':_0x14d3fe['params']['id']},'attributes':[_0x2a36('0x28'),_0x2a36('0x49'),'converted_format'],'raw':!![]})[_0x2a36('0x21')](handleEntityNotFound(_0x57a2af,null))[_0x2a36('0x21')](function(_0x26b38b){if(_0x26b38b){if(!fs[_0x2a36('0x4a')](path[_0x2a36('0x4b')](config[_0x2a36('0x4c')],'server/files/sounds/converted',_0x26b38b[_0x2a36('0x49')]+'.'+_0x26b38b[_0x2a36('0x4d')]))){throw new db['Sequelize'][(_0x2a36('0x4e'))]('Sound\x20not\x20found');}return _0x57a2af[_0x2a36('0x48')](path[_0x2a36('0x4b')](config[_0x2a36('0x4c')],_0x2a36('0x4f'),util[_0x2a36('0x50')](_0x2a36('0x51'),_0x26b38b['save_name'],_0x26b38b[_0x2a36('0x4d')])),util[_0x2a36('0x50')]('%s.%s',_0x26b38b[_0x2a36('0x28')],_0x26b38b['converted_format']));}return null;})[_0x2a36('0x44')](handleError(_0x57a2af,null));};exports['create']=function(_0x51d59d,_0x4cdc61,_0x2c08a2){var _0x7c21df={'name':path[_0x2a36('0x52')](_0x51d59d[_0x2a36('0x53')]['originalname'],path['extname'](_0x51d59d[_0x2a36('0x53')][_0x2a36('0x54')])),'save_name':path[_0x2a36('0x52')](_0x51d59d[_0x2a36('0x53')][_0x2a36('0x55')],path[_0x2a36('0x56')](_0x51d59d[_0x2a36('0x53')]['filename'])),'original_format':path['extname'](_0x51d59d[_0x2a36('0x53')]['originalname'])[_0x2a36('0x57')](0x1),'converted_format':_0x2a36('0x58')};var _0x50ae0d=path[_0x2a36('0x4b')](config[_0x2a36('0x4c')],_0x2a36('0x59'),_0x51d59d[_0x2a36('0x53')][_0x2a36('0x55')]);var _0x1a4cc3=path[_0x2a36('0x4b')](config[_0x2a36('0x4c')],_0x2a36('0x4f'),util[_0x2a36('0x50')](_0x2a36('0x51'),path[_0x2a36('0x52')](_0x51d59d[_0x2a36('0x53')][_0x2a36('0x55')],path['extname'](_0x51d59d['file']['filename'])),_0x7c21df['converted_format']));logger['info'](_0x2a36('0x5a'),_0x50ae0d);logger[_0x2a36('0x5b')](_0x2a36('0x5c'),_0x1a4cc3);try{fs[_0x2a36('0x5d')](_0x50ae0d,parseInt(_0x2a36('0x5e'),0x8));var _0x2e2a54=sox[_0x2a36('0x5f')](_0x50ae0d,_0x1a4cc3,{'sampleRate':0x1f40,'format':_0x2a36('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2e2a54['on'](_0x2a36('0x26'),function(_0x94f5e6){fs[_0x2a36('0x60')](_0x50ae0d);_0x4cdc61[_0x2a36('0x18')](0x1f4)[_0x2a36('0x29')](_0x94f5e6);});_0x2e2a54['on'](_0x2a36('0x61'),function(_0xf4ed40){_0x7c21df['original_duration']=isNaN(_0xf4ed40['duration'])?null:_0xf4ed40[_0x2a36('0x62')]*0x3e8;_0x7c21df[_0x2a36('0x63')]=isNaN(_0xf4ed40['sampleCount'])?null:_0xf4ed40[_0x2a36('0x64')];_0x7c21df[_0x2a36('0x65')]=isNaN(_0xf4ed40[_0x2a36('0x66')])?null:_0xf4ed40[_0x2a36('0x66')];_0x7c21df['original_bitRate']=isNaN(_0xf4ed40[_0x2a36('0x67')])?null:_0xf4ed40[_0x2a36('0x67')];_0x7c21df[_0x2a36('0x68')]=isNaN(_0xf4ed40['sampleRate'])?null:_0xf4ed40[_0x2a36('0x69')];});_0x2e2a54['on'](_0x2a36('0x6a'),function(_0x326ec6){_0x7c21df['converted_duration']=isNaN(_0x326ec6[_0x2a36('0x62')])?null:_0x326ec6['duration']*0x3e8;_0x7c21df[_0x2a36('0x6b')]=isNaN(_0x326ec6[_0x2a36('0x64')])?null:_0x326ec6[_0x2a36('0x64')];_0x7c21df[_0x2a36('0x6c')]=isNaN(_0x326ec6['channelCount'])?null:_0x326ec6['channelCount'];_0x7c21df[_0x2a36('0x6d')]=isNaN(_0x326ec6[_0x2a36('0x67')])?null:_0x326ec6[_0x2a36('0x67')];_0x7c21df['converted_sampleRate']=isNaN(_0x326ec6[_0x2a36('0x69')])?null:_0x326ec6[_0x2a36('0x69')];});_0x2e2a54['on'](_0x2a36('0x17'),function(){fs[_0x2a36('0x5d')](_0x1a4cc3,parseInt(_0x2a36('0x5e'),0x8));return db[_0x2a36('0x2b')]['create'](_0x7c21df)[_0x2a36('0x21')](function(_0x3ed973){var _0x3728a0={'role':_0x51d59d['body'][_0x2a36('0x6e')],'userProfileId':_0x51d59d[_0x2a36('0x6f')]['userProfileId']};if(!_0x3728a0)throw new Error(_0x2a36('0x70'));if(_0x3728a0[_0x2a36('0x6e')]===_0x2a36('0x71')){var _0x50c3d1=_0x3ed973[_0x2a36('0x23')]({'plain':!![]});return db[_0x2a36('0x72')]['find']({'where':{'name':_0x2a36('0x24'),'userProfileId':_0x3728a0[_0x2a36('0x73')]},'raw':!![]})[_0x2a36('0x21')](function(_0x57ffae){if(_0x57ffae&&_0x57ffae['autoAssociation']===0x0){return db[_0x2a36('0x25')][_0x2a36('0x74')]({'name':_0x50c3d1[_0x2a36('0x28')],'resourceId':_0x50c3d1['id'],'type':_0x57ffae[_0x2a36('0x28')],'sectionId':_0x57ffae['id']},{})['then'](function(){return _0x3ed973;});}else{return _0x3ed973;}})[_0x2a36('0x44')](function(_0xd59567){logger[_0x2a36('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd59567);throw _0xd59567;});}return _0x3ed973;})['then'](respondWithResult(_0x4cdc61,null))[_0x2a36('0x44')](handleError(_0x4cdc61,null));});_0x2e2a54[_0x2a36('0x75')]();}catch(_0x220338){_0x4cdc61[_0x2a36('0x18')](0x1f4)[_0x2a36('0x29')](_0x220338);}};exports[_0x2a36('0x76')]=function(_0x5b955d,_0x4ad0f6,_0x383e8a){return db[_0x2a36('0x2b')]['find']({'where':{'id':_0x5b955d['params']['id']}})[_0x2a36('0x21')](handleEntityNotFound(_0x4ad0f6,null))[_0x2a36('0x21')](saveUpdates(_[_0x2a36('0x3b')](_0x5b955d[_0x2a36('0x6f')],['name',_0x2a36('0x77')]),null))[_0x2a36('0x21')](respondWithResult(_0x4ad0f6,null))['catch'](handleError(_0x4ad0f6,null));};exports['delete']=function(_0x144f8f,_0x3dcb9c,_0xf7ecec){return db[_0x2a36('0x2b')][_0x2a36('0x47')]({'where':{'id':_0x144f8f[_0x2a36('0x46')]['id']}})[_0x2a36('0x21')](function(_0x1005eb){if(_0x1005eb){return _0x1005eb[_0x2a36('0x22')]();}})[_0x2a36('0x21')](function(_0x2df198){var _0x23f656=path[_0x2a36('0x4b')](config['root'],_0x2a36('0x59'),util[_0x2a36('0x50')](_0x2a36('0x51'),_0x2df198[_0x2a36('0x49')],_0x2df198[_0x2a36('0x78')]));var _0x5d3aa7=path[_0x2a36('0x4b')](config[_0x2a36('0x4c')],_0x2a36('0x4f'),util[_0x2a36('0x50')](_0x2a36('0x51'),_0x2df198[_0x2a36('0x49')],_0x2df198[_0x2a36('0x4d')]));fs[_0x2a36('0x60')](_0x23f656);fs[_0x2a36('0x60')](_0x5d3aa7);return _0x2df198;})['then'](function(_0x1201a5){if(_0x1201a5){return _0x3dcb9c[_0x2a36('0x18')](0xcc)[_0x2a36('0x17')]();}})[_0x2a36('0x21')](handleEntityNotFound(_0x3dcb9c,null))['catch'](handleError(_0x3dcb9c,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index eb73c41..45af5f1 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 _0xaee0=['exports','Sound','tools_sounds','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes'];(function(_0xb8009d,_0x190621){var _0x4bc43c=function(_0x1248b3){while(--_0x1248b3){_0xb8009d['push'](_0xb8009d['shift']());}};_0x4bc43c(++_0x190621);}(_0xaee0,0x177));var _0x0aee=function(_0x48e6c1,_0x2c5211){_0x48e6c1=_0x48e6c1-0x0;var _0x1521e2=_0xaee0[_0x48e6c1];return _0x1521e2;};'use strict';var _=require(_0x0aee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0aee('0x1'));var moment=require(_0x0aee('0x2'));var BPromise=require(_0x0aee('0x3'));var rp=require(_0x0aee('0x4'));var fs=require('fs');var path=require(_0x0aee('0x5'));var rimraf=require(_0x0aee('0x6'));var config=require(_0x0aee('0x7'));var attributes=require(_0x0aee('0x8'));module[_0x0aee('0x9')]=function(_0xcfe144,_0xe297e3){return _0xcfe144['define'](_0x0aee('0xa'),attributes,{'tableName':_0x0aee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x444a=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./sound.attributes','Sound','tools_sounds','lodash'];(function(_0x53f964,_0x3b52b8){var _0x17be6c=function(_0x25a732){while(--_0x25a732){_0x53f964['push'](_0x53f964['shift']());}};_0x17be6c(++_0x3b52b8);}(_0x444a,0xba));var _0xa444=function(_0x4a6156,_0x2b8ce6){_0x4a6156=_0x4a6156-0x0;var _0x12c1f6=_0x444a[_0x4a6156];return _0x12c1f6;};'use strict';var _=require(_0xa444('0x0'));var util=require(_0xa444('0x1'));var logger=require(_0xa444('0x2'))('api');var moment=require(_0xa444('0x3'));var BPromise=require(_0xa444('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa444('0x5'));var rimraf=require(_0xa444('0x6'));var config=require(_0xa444('0x7'));var attributes=require(_0xa444('0x8'));module['exports']=function(_0x3e926a,_0x6cb7e4){return _0x3e926a['define'](_0xa444('0x9'),attributes,{'tableName':_0xa444('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 975ebdc..722c98d 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 _0x0901=['jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSound','find','options','where','attributes','include','map','model','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3e80e5,_0x5ba461){var _0x43a128=function(_0x403688){while(--_0x403688){_0x3e80e5['push'](_0x3e80e5['shift']());}};_0x43a128(++_0x5ba461);}(_0x0901,0xcb));var _0x1090=function(_0x54a924,_0x5eca90){_0x54a924=_0x54a924-0x0;var _0x47512b=_0x0901[_0x54a924];return _0x47512b;};'use strict';var _=require(_0x1090('0x0'));var util=require(_0x1090('0x1'));var moment=require(_0x1090('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1090('0x3'));var db=require(_0x1090('0x4'))['db'];var utils=require(_0x1090('0x5'));var logger=require('../../config/logger')(_0x1090('0x6'));var config=require('../../config/environment');var jayson=require(_0x1090('0x7'));var client=jayson['client'][_0x1090('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1dc5ac,_0xd553bf,_0xcd53b7){return new BPromise(function(_0x3dc509,_0xbb6b5c){return client[_0x1090('0x9')](_0x1dc5ac,_0xcd53b7)[_0x1090('0xa')](function(_0x3dc2d0){logger[_0x1090('0xb')](_0x1090('0xc'),_0xd553bf,'request\x20sent');logger[_0x1090('0xd')](_0x1090('0xe'),_0xd553bf,_0x1090('0xf'),JSON['stringify'](_0x3dc2d0));if(_0x3dc2d0[_0x1090('0x10')]){if(_0x3dc2d0[_0x1090('0x10')][_0x1090('0x11')]===0x1f4){logger[_0x1090('0x10')](_0x1090('0xc'),_0xd553bf,_0x3dc2d0[_0x1090('0x10')]['message']);return _0xbb6b5c(_0x3dc2d0['error']['message']);}logger[_0x1090('0x10')](_0x1090('0xc'),_0xd553bf,_0x3dc2d0[_0x1090('0x10')][_0x1090('0x12')]);return _0x3dc509(_0x3dc2d0[_0x1090('0x10')][_0x1090('0x12')]);}else{logger['info'](_0x1090('0xc'),_0xd553bf,_0x1090('0xf'));_0x3dc509(_0x3dc2d0[_0x1090('0x13')][_0x1090('0x12')]);}})[_0x1090('0x14')](function(_0x213640){logger['error'](_0x1090('0xc'),_0xd553bf,_0x213640);_0xbb6b5c(_0x213640);});});}exports[_0x1090('0x15')]=function(_0x3b453b){var _0x164146=this;return new Promise(function(_0x130b90,_0x4199b1){return db['Sound'][_0x1090('0x16')]({'raw':_0x3b453b['options']?_0x3b453b[_0x1090('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3b453b['options']?_0x3b453b[_0x1090('0x17')][_0x1090('0x18')]||null:null,'attributes':_0x3b453b[_0x1090('0x17')]?_0x3b453b[_0x1090('0x17')][_0x1090('0x19')]||null:null,'include':_0x3b453b[_0x1090('0x17')]?_0x3b453b['options'][_0x1090('0x1a')]?_[_0x1090('0x1b')](_0x3b453b[_0x1090('0x17')]['include'],function(_0x405b9c){return{'model':db[_0x405b9c[_0x1090('0x1c')]],'as':_0x405b9c['as'],'attributes':_0x405b9c[_0x1090('0x19')],'include':_0x405b9c[_0x1090('0x1a')]?_[_0x1090('0x1b')](_0x405b9c['include'],function(_0x1b92b7){return{'model':db[_0x1b92b7[_0x1090('0x1c')]],'as':_0x1b92b7['as'],'attributes':_0x1b92b7[_0x1090('0x19')],'include':_0x1b92b7[_0x1090('0x1a')]?_[_0x1090('0x1b')](_0x1b92b7[_0x1090('0x1a')],function(_0x557496){return{'model':db[_0x557496[_0x1090('0x1c')]],'as':_0x557496['as'],'attributes':_0x557496[_0x1090('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1090('0xa')](function(_0x98524f){logger[_0x1090('0xb')](_0x1090('0x15'),_0x3b453b);logger[_0x1090('0xd')](_0x1090('0x15'),_0x3b453b,JSON[_0x1090('0x1d')](_0x98524f));_0x130b90(_0x98524f);})[_0x1090('0x14')](function(_0x361a8b){logger[_0x1090('0x10')](_0x1090('0x15'),_0x361a8b['message'],_0x3b453b);_0x4199b1(_0x164146['error'](0x1f4,_0x361a8b[_0x1090('0x12')]));});});}; \ No newline at end of file +var _0x50bb=['request\x20sent','stringify','error','code','Sound,\x20%s,\x20%s','message','info','result','ShowSound','Sound','find','options','raw','where','attributes','map','include','model','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','then','debug','Sound,\x20%s,\x20%s,\x20%s'];(function(_0x35a441,_0x3a2ec6){var _0x571ce3=function(_0x161827){while(--_0x161827){_0x35a441['push'](_0x35a441['shift']());}};_0x571ce3(++_0x3a2ec6);}(_0x50bb,0x1b6));var _0xb50b=function(_0x236c88,_0x300655){_0x236c88=_0x236c88-0x0;var _0x58bc0=_0x50bb[_0x236c88];return _0x58bc0;};'use strict';var _=require(_0xb50b('0x0'));var util=require('util');var moment=require(_0xb50b('0x1'));var BPromise=require(_0xb50b('0x2'));var rs=require(_0xb50b('0x3'));var fs=require('fs');var Redis=require(_0xb50b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb50b('0x5'));var config=require(_0xb50b('0x6'));var jayson=require(_0xb50b('0x7'));var client=jayson['client'][_0xb50b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20c241,_0x2a508b,_0x529a8f){return new BPromise(function(_0x1f8495,_0x4ea78d){return client['request'](_0x20c241,_0x529a8f)[_0xb50b('0x9')](function(_0x2866a8){logger['info']('Sound,\x20%s,\x20%s',_0x2a508b,'request\x20sent');logger[_0xb50b('0xa')](_0xb50b('0xb'),_0x2a508b,_0xb50b('0xc'),JSON[_0xb50b('0xd')](_0x2866a8));if(_0x2866a8[_0xb50b('0xe')]){if(_0x2866a8[_0xb50b('0xe')][_0xb50b('0xf')]===0x1f4){logger[_0xb50b('0xe')](_0xb50b('0x10'),_0x2a508b,_0x2866a8[_0xb50b('0xe')][_0xb50b('0x11')]);return _0x4ea78d(_0x2866a8[_0xb50b('0xe')][_0xb50b('0x11')]);}logger[_0xb50b('0xe')](_0xb50b('0x10'),_0x2a508b,_0x2866a8[_0xb50b('0xe')][_0xb50b('0x11')]);return _0x1f8495(_0x2866a8[_0xb50b('0xe')][_0xb50b('0x11')]);}else{logger[_0xb50b('0x12')]('Sound,\x20%s,\x20%s',_0x2a508b,'request\x20sent');_0x1f8495(_0x2866a8[_0xb50b('0x13')][_0xb50b('0x11')]);}})['catch'](function(_0x4d94a8){logger['error'](_0xb50b('0x10'),_0x2a508b,_0x4d94a8);_0x4ea78d(_0x4d94a8);});});}exports[_0xb50b('0x14')]=function(_0x5d96b0){var _0x5e82b1=this;return new Promise(function(_0x467a45,_0x1d40aa){return db[_0xb50b('0x15')][_0xb50b('0x16')]({'raw':_0x5d96b0['options']?_0x5d96b0[_0xb50b('0x17')][_0xb50b('0x18')]===undefined?!![]:![]:!![],'where':_0x5d96b0['options']?_0x5d96b0['options'][_0xb50b('0x19')]||null:null,'attributes':_0x5d96b0[_0xb50b('0x17')]?_0x5d96b0[_0xb50b('0x17')][_0xb50b('0x1a')]||null:null,'include':_0x5d96b0['options']?_0x5d96b0[_0xb50b('0x17')]['include']?_[_0xb50b('0x1b')](_0x5d96b0[_0xb50b('0x17')]['include'],function(_0x270cab){return{'model':db[_0x270cab['model']],'as':_0x270cab['as'],'attributes':_0x270cab[_0xb50b('0x1a')],'include':_0x270cab[_0xb50b('0x1c')]?_['map'](_0x270cab[_0xb50b('0x1c')],function(_0x36edcc){return{'model':db[_0x36edcc[_0xb50b('0x1d')]],'as':_0x36edcc['as'],'attributes':_0x36edcc[_0xb50b('0x1a')],'include':_0x36edcc[_0xb50b('0x1c')]?_[_0xb50b('0x1b')](_0x36edcc[_0xb50b('0x1c')],function(_0x3ae786){return{'model':db[_0x3ae786[_0xb50b('0x1d')]],'as':_0x3ae786['as'],'attributes':_0x3ae786[_0xb50b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb50b('0x9')](function(_0x52c8d3){logger[_0xb50b('0x12')](_0xb50b('0x14'),_0x5d96b0);logger[_0xb50b('0xa')](_0xb50b('0x14'),_0x5d96b0,JSON[_0xb50b('0xd')](_0x52c8d3));_0x467a45(_0x52c8d3);})['catch'](function(_0x2f8fa1){logger[_0xb50b('0xe')]('ShowSound',_0x2f8fa1[_0xb50b('0x11')],_0x5d96b0);_0x1d40aa(_0x5e82b1['error'](0x1f4,_0x2f8fa1['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 4ff72c3..a66217d 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 _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0xda2d,0x102));var _0xdda2=function(_0xbc162a,_0x56932d){_0xbc162a=_0xbc162a-0x0;var _0x13c5d4=_0xda2d[_0xbc162a];return _0x13c5d4;};'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 _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x259ca5,_0x4b4ad6){var _0x3ced4e=function(_0x4a1ab2){while(--_0x4a1ab2){_0x259ca5['push'](_0x259ca5['shift']());}};_0x3ced4e(++_0x4b4ad6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 0f79450..cd6ee57 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 _0x4cec=['STRING','ENUM','out','sequelize','exports'];(function(_0x4ac743,_0x5bd1a6){var _0x150cf0=function(_0x1cc727){while(--_0x1cc727){_0x4ac743['push'](_0x4ac743['shift']());}};_0x150cf0(++_0x5bd1a6);}(_0x4cec,0xf8));var _0xc4ce=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4cec[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xc4ce('0x0'));module[_0xc4ce('0x1')]={'uniqueid':{'type':Sequelize[_0xc4ce('0x2')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xc4ce('0x3')]('in',_0xc4ce('0x4')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0xc4ce('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xbfca=['medium','ENUM','out','STRING','sequelize','exports','TEXT'];(function(_0x223fc5,_0x3fcb6c){var _0xf39d2a=function(_0x3e927c){while(--_0x3e927c){_0x223fc5['push'](_0x223fc5['shift']());}};_0xf39d2a(++_0x3fcb6c);}(_0xbfca,0xba));var _0xabfc=function(_0x256030,_0x2557d1){_0x256030=_0x256030-0x0;var _0x11ba2f=_0xbfca[_0x256030];return _0x11ba2f;};'use strict';var Sequelize=require(_0xabfc('0x0'));module[_0xabfc('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xabfc('0x2')](_0xabfc('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xabfc('0x4')]('in',_0xabfc('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0xabfc('0x6')]},'providerResponse':{'type':Sequelize[_0xabfc('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index bebad20..3c34be2 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 _0x4049=['show','params','rawAttributes','find','body','eml-format','rimraf','zip-dir','moment','bluebird','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','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','then','destroy','sendStatus','error','name','send','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','SquareMessage','findAll','rows','catch'];(function(_0x121b9f,_0x3e538b){var _0x3d1f31=function(_0x343511){while(--_0x343511){_0x121b9f['push'](_0x121b9f['shift']());}};_0x3d1f31(++_0x3e538b);}(_0x4049,0x177));var _0x9404=function(_0x39ec06,_0xa5e032){_0x39ec06=_0x39ec06-0x0;var _0x43c12f=_0x4049[_0x39ec06];return _0x43c12f;};'use strict';var emlformat=require(_0x9404('0x0'));var rimraf=require(_0x9404('0x1'));var zipdir=require(_0x9404('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9404('0x3'));var BPromise=require(_0x9404('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9404('0x5'));var sox=require('sox');var csv=require(_0x9404('0x6'));var ejs=require(_0x9404('0x7'));var fs=require('fs');var fs_extra=require(_0x9404('0x8'));var _=require(_0x9404('0x9'));var squel=require(_0x9404('0xa'));var crypto=require(_0x9404('0xb'));var jsforce=require(_0x9404('0xc'));var deskjs=require(_0x9404('0xd'));var toCsv=require(_0x9404('0x6'));var querystring=require(_0x9404('0xe'));var Papa=require(_0x9404('0xf'));var Redis=require(_0x9404('0x10'));var authService=require(_0x9404('0x11'));var qs=require(_0x9404('0x12'));var as=require(_0x9404('0x13'));var hardwareService=require(_0x9404('0x14'));var logger=require(_0x9404('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x9404('0x16'));var licenseUtil=require(_0x9404('0x17'));var db=require(_0x9404('0x18'))['db'];function respondWithStatusCode(_0x3398bd,_0x34f5a0){_0x34f5a0=_0x34f5a0||0xcc;return function(_0x567bcc){if(_0x567bcc){return _0x3398bd['sendStatus'](_0x34f5a0);}return _0x3398bd[_0x9404('0x19')](_0x34f5a0)[_0x9404('0x1a')]();};}function respondWithResult(_0x15d49d,_0x927f73){_0x927f73=_0x927f73||0xc8;return function(_0x3d13e8){if(_0x3d13e8){return _0x15d49d[_0x9404('0x19')](_0x927f73)['json'](_0x3d13e8);}};}function respondWithFilteredResult(_0x75e18f,_0x4db206){return function(_0x42c863){if(_0x42c863){var _0x5e42c0=typeof _0x4db206['offset']===_0x9404('0x1b')&&typeof _0x4db206['limit']==='undefined';var _0x6583c8=_0x42c863[_0x9404('0x1c')];var _0x29f018=_0x5e42c0?0x0:_0x4db206[_0x9404('0x1d')];var _0x34068f=_0x5e42c0?_0x42c863[_0x9404('0x1c')]:_0x4db206[_0x9404('0x1d')]+_0x4db206[_0x9404('0x1e')];var _0x122231;if(_0x34068f>=_0x6583c8){_0x34068f=_0x6583c8;_0x122231=0xc8;}else{_0x122231=0xce;}_0x75e18f['status'](_0x122231);return _0x75e18f[_0x9404('0x1f')](_0x9404('0x20'),_0x29f018+'-'+_0x34068f+'/'+_0x6583c8)[_0x9404('0x21')](_0x42c863);}return null;};}function patchUpdates(_0x40d2db){return function(_0x465787){try{jsonpatch[_0x9404('0x22')](_0x465787,_0x40d2db,!![]);}catch(_0x46e447){return BPromise[_0x9404('0x23')](_0x46e447);}return _0x465787['save']();};}function saveUpdates(_0x3ea676,_0x241182){return function(_0x4e0953){if(_0x4e0953){return _0x4e0953['update'](_0x3ea676)[_0x9404('0x24')](function(_0x59eabb){return _0x59eabb;});}return null;};}function removeEntity(_0x50185a,_0x36ab65){return function(_0x48d713){if(_0x48d713){return _0x48d713[_0x9404('0x25')]()['then'](function(){_0x50185a[_0x9404('0x19')](0xcc)[_0x9404('0x1a')]();});}};}function handleEntityNotFound(_0x4eca2d,_0x3d41c5){return function(_0x3940aa){if(!_0x3940aa){_0x4eca2d[_0x9404('0x26')](0x194);}return _0x3940aa;};}function handleError(_0x224c67,_0x4173bb){_0x4173bb=_0x4173bb||0x1f4;return function(_0x419221){logger[_0x9404('0x27')](_0x419221['stack']);if(_0x419221[_0x9404('0x28')]){delete _0x419221[_0x9404('0x28')];}_0x224c67[_0x9404('0x19')](_0x4173bb)[_0x9404('0x29')](_0x419221);};}exports['index']=function(_0xddb0f9,_0x4a600a){var _0x4a3af7={},_0x1c2169={},_0x1b1a76={'count':0x0,'rows':[]};var _0x217f4e=_['map'](db['SquareMessage']['rawAttributes'],function(_0x26a2a8){return{'name':_0x26a2a8[_0x9404('0x2a')],'type':_0x26a2a8[_0x9404('0x2b')]['key']};});_0x1c2169[_0x9404('0x2c')]=_['map'](_0x217f4e,_0x9404('0x28'));_0x1c2169[_0x9404('0x2d')]=_[_0x9404('0x2e')](_0xddb0f9[_0x9404('0x2d')]);_0x1c2169[_0x9404('0x2f')]=_['intersection'](_0x1c2169[_0x9404('0x2c')],_0x1c2169['query']);_0x4a3af7[_0x9404('0x30')]=_[_0x9404('0x31')](_0x1c2169[_0x9404('0x2c')],qs[_0x9404('0x32')](_0xddb0f9[_0x9404('0x2d')][_0x9404('0x32')]));_0x4a3af7[_0x9404('0x30')]=_0x4a3af7[_0x9404('0x30')][_0x9404('0x33')]?_0x4a3af7[_0x9404('0x30')]:_0x1c2169['model'];if(!_0xddb0f9[_0x9404('0x2d')][_0x9404('0x34')](_0x9404('0x35'))){_0x4a3af7[_0x9404('0x1e')]=qs['limit'](_0xddb0f9[_0x9404('0x2d')][_0x9404('0x1e')]);_0x4a3af7['offset']=qs[_0x9404('0x1d')](_0xddb0f9[_0x9404('0x2d')][_0x9404('0x1d')]);}_0x4a3af7[_0x9404('0x36')]=qs[_0x9404('0x37')](_0xddb0f9['query'][_0x9404('0x37')]);_0x4a3af7[_0x9404('0x38')]=qs[_0x9404('0x2f')](_[_0x9404('0x39')](_0xddb0f9[_0x9404('0x2d')],_0x1c2169['filters']),_0x217f4e);if(_0xddb0f9[_0x9404('0x2d')][_0x9404('0x3a')]){_0x4a3af7[_0x9404('0x38')]=_[_0x9404('0x3b')](_0x4a3af7[_0x9404('0x38')],{'$or':_[_0x9404('0x3c')](_0x217f4e,function(_0x28858e){if(_0x28858e[_0x9404('0x2b')]!==_0x9404('0x3d')){var _0x2558ca={};_0x2558ca[_0x28858e[_0x9404('0x28')]]={'$like':'%'+_0xddb0f9['query'][_0x9404('0x3a')]+'%'};return _0x2558ca;}})});}_0x4a3af7=_[_0x9404('0x3b')]({},_0x4a3af7,_0xddb0f9[_0x9404('0x3e')]);var _0x35c313={'where':_0x4a3af7[_0x9404('0x38')]};return db['SquareMessage'][_0x9404('0x1c')](_0x35c313)[_0x9404('0x24')](function(_0xfe145){_0x1b1a76[_0x9404('0x1c')]=_0xfe145;if(_0xddb0f9[_0x9404('0x2d')][_0x9404('0x3f')]){_0x4a3af7[_0x9404('0x40')]=[{'all':!![]}];}return db[_0x9404('0x41')][_0x9404('0x42')](_0x4a3af7);})['then'](function(_0x444975){_0x1b1a76[_0x9404('0x43')]=_0x444975;return _0x1b1a76;})['then'](respondWithFilteredResult(_0x4a600a,_0x4a3af7))[_0x9404('0x44')](handleError(_0x4a600a,null));};exports[_0x9404('0x45')]=function(_0x58c134,_0x351c96){var _0x2a07df={'raw':!![],'where':{'id':_0x58c134[_0x9404('0x46')]['id']}},_0x3bdafb={};_0x3bdafb[_0x9404('0x2c')]=_[_0x9404('0x2e')](db['SquareMessage'][_0x9404('0x47')]);_0x3bdafb[_0x9404('0x2d')]=_[_0x9404('0x2e')](_0x58c134[_0x9404('0x2d')]);_0x3bdafb[_0x9404('0x2f')]=_['intersection'](_0x3bdafb[_0x9404('0x2c')],_0x3bdafb[_0x9404('0x2d')]);_0x2a07df[_0x9404('0x30')]=_['intersection'](_0x3bdafb['model'],qs[_0x9404('0x32')](_0x58c134[_0x9404('0x2d')][_0x9404('0x32')]));_0x2a07df[_0x9404('0x30')]=_0x2a07df['attributes'][_0x9404('0x33')]?_0x2a07df[_0x9404('0x30')]:_0x3bdafb['model'];if(_0x58c134[_0x9404('0x2d')][_0x9404('0x3f')]){_0x2a07df[_0x9404('0x40')]=[{'all':!![]}];}_0x2a07df=_[_0x9404('0x3b')]({},_0x2a07df,_0x58c134[_0x9404('0x3e')]);return db[_0x9404('0x41')][_0x9404('0x48')](_0x2a07df)['then'](handleEntityNotFound(_0x351c96,null))['then'](respondWithResult(_0x351c96,null))[_0x9404('0x44')](handleError(_0x351c96,null));};exports['create']=function(_0x501a3d,_0x2186c2){return db[_0x9404('0x41')]['create'](_0x501a3d[_0x9404('0x49')],{})['then'](respondWithResult(_0x2186c2,0xc9))[_0x9404('0x44')](handleError(_0x2186c2,null));};exports['update']=function(_0x1bc451,_0x5641d5){if(_0x1bc451['body']['id']){delete _0x1bc451[_0x9404('0x49')]['id'];}return db[_0x9404('0x41')][_0x9404('0x48')]({'where':{'id':_0x1bc451[_0x9404('0x46')]['id']}})[_0x9404('0x24')](handleEntityNotFound(_0x5641d5,null))[_0x9404('0x24')](saveUpdates(_0x1bc451['body'],null))[_0x9404('0x24')](respondWithResult(_0x5641d5,null))[_0x9404('0x44')](handleError(_0x5641d5,null));};exports[_0x9404('0x25')]=function(_0x476d19,_0x3caa79){return db[_0x9404('0x41')][_0x9404('0x48')]({'where':{'id':_0x476d19[_0x9404('0x46')]['id']}})[_0x9404('0x24')](handleEntityNotFound(_0x3caa79,null))['then'](removeEntity(_0x3caa79,null))[_0x9404('0x44')](handleError(_0x3caa79,null));}; \ No newline at end of file +var _0xb847=['create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','SquareMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','count','then','includeAll','include','findAll','rows','catch','show','params','merge','options','find'];(function(_0x2a4095,_0x13f4f0){var _0x52eeab=function(_0x3950dd){while(--_0x3950dd){_0x2a4095['push'](_0x2a4095['shift']());}};_0x52eeab(++_0x13f4f0);}(_0xb847,0x17e));var _0x7b84=function(_0x44aac2,_0x336163){_0x44aac2=_0x44aac2-0x0;var _0x38a6bc=_0xb847[_0x44aac2];return _0x38a6bc;};'use strict';var emlformat=require(_0x7b84('0x0'));var rimraf=require(_0x7b84('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b84('0x2'));var rp=require('request-promise');var moment=require(_0x7b84('0x3'));var BPromise=require(_0x7b84('0x4'));var Mustache=require(_0x7b84('0x5'));var util=require(_0x7b84('0x6'));var path=require(_0x7b84('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b84('0x8'));var _=require(_0x7b84('0x9'));var squel=require(_0x7b84('0xa'));var crypto=require(_0x7b84('0xb'));var jsforce=require(_0x7b84('0xc'));var deskjs=require(_0x7b84('0xd'));var toCsv=require(_0x7b84('0xe'));var querystring=require(_0x7b84('0xf'));var Papa=require(_0x7b84('0x10'));var Redis=require('ioredis');var authService=require(_0x7b84('0x11'));var qs=require(_0x7b84('0x12'));var as=require(_0x7b84('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7b84('0x14'));var utils=require('../../config/utils');var config=require(_0x7b84('0x15'));var licenseUtil=require(_0x7b84('0x16'));var db=require(_0x7b84('0x17'))['db'];function respondWithStatusCode(_0x430e11,_0x153e75){_0x153e75=_0x153e75||0xcc;return function(_0x50f78b){if(_0x50f78b){return _0x430e11['sendStatus'](_0x153e75);}return _0x430e11['status'](_0x153e75)[_0x7b84('0x18')]();};}function respondWithResult(_0x41eedf,_0x26fbf1){_0x26fbf1=_0x26fbf1||0xc8;return function(_0x3d094e){if(_0x3d094e){return _0x41eedf[_0x7b84('0x19')](_0x26fbf1)[_0x7b84('0x1a')](_0x3d094e);}};}function respondWithFilteredResult(_0x1b6f6f,_0x10c625){return function(_0x8e1d97){if(_0x8e1d97){var _0x3fdf29=typeof _0x10c625[_0x7b84('0x1b')]===_0x7b84('0x1c')&&typeof _0x10c625[_0x7b84('0x1d')]===_0x7b84('0x1c');var _0xb2569e=_0x8e1d97['count'];var _0x4b8410=_0x3fdf29?0x0:_0x10c625[_0x7b84('0x1b')];var _0x11d883=_0x3fdf29?_0x8e1d97['count']:_0x10c625['offset']+_0x10c625['limit'];var _0x1ca73e;if(_0x11d883>=_0xb2569e){_0x11d883=_0xb2569e;_0x1ca73e=0xc8;}else{_0x1ca73e=0xce;}_0x1b6f6f[_0x7b84('0x19')](_0x1ca73e);return _0x1b6f6f[_0x7b84('0x1e')](_0x7b84('0x1f'),_0x4b8410+'-'+_0x11d883+'/'+_0xb2569e)[_0x7b84('0x1a')](_0x8e1d97);}return null;};}function patchUpdates(_0x2239ba){return function(_0xa8b8ec){try{jsonpatch[_0x7b84('0x20')](_0xa8b8ec,_0x2239ba,!![]);}catch(_0x55611d){return BPromise[_0x7b84('0x21')](_0x55611d);}return _0xa8b8ec[_0x7b84('0x22')]();};}function saveUpdates(_0x352ab9,_0x53fb34){return function(_0x75831d){if(_0x75831d){return _0x75831d[_0x7b84('0x23')](_0x352ab9)['then'](function(_0x1ac0a8){return _0x1ac0a8;});}return null;};}function removeEntity(_0x4fb367,_0x12d084){return function(_0x2f70de){if(_0x2f70de){return _0x2f70de[_0x7b84('0x24')]()['then'](function(){_0x4fb367['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x32da71,_0x348241){return function(_0x5abb6e){if(!_0x5abb6e){_0x32da71[_0x7b84('0x25')](0x194);}return _0x5abb6e;};}function handleError(_0x344c50,_0x4d57f5){_0x4d57f5=_0x4d57f5||0x1f4;return function(_0x5a2697){logger['error'](_0x5a2697[_0x7b84('0x26')]);if(_0x5a2697[_0x7b84('0x27')]){delete _0x5a2697[_0x7b84('0x27')];}_0x344c50[_0x7b84('0x19')](_0x4d57f5)[_0x7b84('0x28')](_0x5a2697);};}exports['index']=function(_0x50fd74,_0x52925d){var _0x5e76d7={},_0x68c6d7={},_0x2903f2={'count':0x0,'rows':[]};var _0x4df1fd=_[_0x7b84('0x29')](db[_0x7b84('0x2a')][_0x7b84('0x2b')],function(_0x495c7d){return{'name':_0x495c7d[_0x7b84('0x2c')],'type':_0x495c7d['type'][_0x7b84('0x2d')]};});_0x68c6d7[_0x7b84('0x2e')]=_['map'](_0x4df1fd,_0x7b84('0x27'));_0x68c6d7['query']=_[_0x7b84('0x2f')](_0x50fd74[_0x7b84('0x30')]);_0x68c6d7[_0x7b84('0x31')]=_[_0x7b84('0x32')](_0x68c6d7[_0x7b84('0x2e')],_0x68c6d7['query']);_0x5e76d7[_0x7b84('0x33')]=_['intersection'](_0x68c6d7[_0x7b84('0x2e')],qs[_0x7b84('0x34')](_0x50fd74['query'][_0x7b84('0x34')]));_0x5e76d7[_0x7b84('0x33')]=_0x5e76d7[_0x7b84('0x33')][_0x7b84('0x35')]?_0x5e76d7['attributes']:_0x68c6d7['model'];if(!_0x50fd74[_0x7b84('0x30')][_0x7b84('0x36')](_0x7b84('0x37'))){_0x5e76d7['limit']=qs[_0x7b84('0x1d')](_0x50fd74[_0x7b84('0x30')][_0x7b84('0x1d')]);_0x5e76d7[_0x7b84('0x1b')]=qs[_0x7b84('0x1b')](_0x50fd74['query'][_0x7b84('0x1b')]);}_0x5e76d7['order']=qs[_0x7b84('0x38')](_0x50fd74[_0x7b84('0x30')][_0x7b84('0x38')]);_0x5e76d7[_0x7b84('0x39')]=qs['filters'](_[_0x7b84('0x3a')](_0x50fd74[_0x7b84('0x30')],_0x68c6d7[_0x7b84('0x31')]),_0x4df1fd);if(_0x50fd74[_0x7b84('0x30')][_0x7b84('0x3b')]){_0x5e76d7[_0x7b84('0x39')]=_['merge'](_0x5e76d7['where'],{'$or':_[_0x7b84('0x29')](_0x4df1fd,function(_0x533f1b){if(_0x533f1b[_0x7b84('0x3c')]!==_0x7b84('0x3d')){var _0x2212e4={};_0x2212e4[_0x533f1b[_0x7b84('0x27')]]={'$like':'%'+_0x50fd74['query'][_0x7b84('0x3b')]+'%'};return _0x2212e4;}})});}_0x5e76d7=_['merge']({},_0x5e76d7,_0x50fd74['options']);var _0x5104f8={'where':_0x5e76d7['where']};return db[_0x7b84('0x2a')][_0x7b84('0x3e')](_0x5104f8)[_0x7b84('0x3f')](function(_0x3b4cff){_0x2903f2[_0x7b84('0x3e')]=_0x3b4cff;if(_0x50fd74[_0x7b84('0x30')][_0x7b84('0x40')]){_0x5e76d7[_0x7b84('0x41')]=[{'all':!![]}];}return db[_0x7b84('0x2a')][_0x7b84('0x42')](_0x5e76d7);})['then'](function(_0x3271df){_0x2903f2[_0x7b84('0x43')]=_0x3271df;return _0x2903f2;})[_0x7b84('0x3f')](respondWithFilteredResult(_0x52925d,_0x5e76d7))[_0x7b84('0x44')](handleError(_0x52925d,null));};exports[_0x7b84('0x45')]=function(_0x22d1e4,_0x4abd2a){var _0x195379={'raw':!![],'where':{'id':_0x22d1e4[_0x7b84('0x46')]['id']}},_0x591c1e={};_0x591c1e[_0x7b84('0x2e')]=_[_0x7b84('0x2f')](db[_0x7b84('0x2a')][_0x7b84('0x2b')]);_0x591c1e['query']=_[_0x7b84('0x2f')](_0x22d1e4[_0x7b84('0x30')]);_0x591c1e[_0x7b84('0x31')]=_[_0x7b84('0x32')](_0x591c1e[_0x7b84('0x2e')],_0x591c1e[_0x7b84('0x30')]);_0x195379['attributes']=_[_0x7b84('0x32')](_0x591c1e['model'],qs[_0x7b84('0x34')](_0x22d1e4[_0x7b84('0x30')][_0x7b84('0x34')]));_0x195379[_0x7b84('0x33')]=_0x195379[_0x7b84('0x33')][_0x7b84('0x35')]?_0x195379['attributes']:_0x591c1e['model'];if(_0x22d1e4[_0x7b84('0x30')][_0x7b84('0x40')]){_0x195379[_0x7b84('0x41')]=[{'all':!![]}];}_0x195379=_[_0x7b84('0x47')]({},_0x195379,_0x22d1e4[_0x7b84('0x48')]);return db[_0x7b84('0x2a')][_0x7b84('0x49')](_0x195379)[_0x7b84('0x3f')](handleEntityNotFound(_0x4abd2a,null))[_0x7b84('0x3f')](respondWithResult(_0x4abd2a,null))[_0x7b84('0x44')](handleError(_0x4abd2a,null));};exports[_0x7b84('0x4a')]=function(_0x57f314,_0x396108){return db[_0x7b84('0x2a')][_0x7b84('0x4a')](_0x57f314[_0x7b84('0x4b')],{})['then'](respondWithResult(_0x396108,0xc9))[_0x7b84('0x44')](handleError(_0x396108,null));};exports['update']=function(_0x2f27ee,_0x36e117){if(_0x2f27ee[_0x7b84('0x4b')]['id']){delete _0x2f27ee[_0x7b84('0x4b')]['id'];}return db['SquareMessage'][_0x7b84('0x49')]({'where':{'id':_0x2f27ee[_0x7b84('0x46')]['id']}})['then'](handleEntityNotFound(_0x36e117,null))[_0x7b84('0x3f')](saveUpdates(_0x2f27ee[_0x7b84('0x4b')],null))[_0x7b84('0x3f')](respondWithResult(_0x36e117,null))[_0x7b84('0x44')](handleError(_0x36e117,null));};exports[_0x7b84('0x24')]=function(_0x1bae00,_0xd5cade){return db[_0x7b84('0x2a')][_0x7b84('0x49')]({'where':{'id':_0x1bae00['params']['id']}})[_0x7b84('0x3f')](handleEntityNotFound(_0xd5cade,null))['then'](removeEntity(_0xd5cade,null))[_0x7b84('0x44')](handleError(_0xd5cade,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 47e872b..ee69ed2 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 _0x3706=['../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x152752,_0x2d4b31){var _0xacddb3=function(_0x317df9){while(--_0x317df9){_0x152752['push'](_0x152752['shift']());}};_0xacddb3(++_0x2d4b31);}(_0x3706,0x172));var _0x6370=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0x3706[_0x44268d];return _0x4be92d;};'use strict';var _=require(_0x6370('0x0'));var util=require(_0x6370('0x1'));var logger=require(_0x6370('0x2'))('api');var moment=require(_0x6370('0x3'));var BPromise=require(_0x6370('0x4'));var rp=require(_0x6370('0x5'));var fs=require('fs');var path=require(_0x6370('0x6'));var rimraf=require(_0x6370('0x7'));var config=require(_0x6370('0x8'));var attributes=require(_0x6370('0x9'));module[_0x6370('0xa')]=function(_0x2b3f34,_0x4c1fea){return _0x2b3f34[_0x6370('0xb')](_0x6370('0xc'),attributes,{'tableName':_0x6370('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f7c=['SquareMessage','util','api','moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x8f7c,0x161));var _0xc8f7=function(_0x486e56,_0x39eff8){_0x486e56=_0x486e56-0x0;var _0x489279=_0x8f7c[_0x486e56];return _0x489279;};'use strict';var _=require('lodash');var util=require(_0xc8f7('0x0'));var logger=require('../../config/logger')(_0xc8f7('0x1'));var moment=require(_0xc8f7('0x2'));var BPromise=require(_0xc8f7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8f7('0x4'));var rimraf=require(_0xc8f7('0x5'));var config=require(_0xc8f7('0x6'));var attributes=require(_0xc8f7('0x7'));module[_0xc8f7('0x8')]=function(_0x6e46e8,_0x6e7e3b){return _0x6e46e8[_0xc8f7('0x9')](_0xc8f7('0xa'),attributes,{'tableName':'square_messages','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 7398b5f..e802432 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 _0xdc3e=['CreateSquareMessage','create','options','raw','debug','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xdc3e,0x118));var _0xedc3=function(_0x3de2e7,_0x331bea){_0x3de2e7=_0x3de2e7-0x0;var _0x43eabc=_0xdc3e[_0x3de2e7];return _0x43eabc;};'use strict';var _=require(_0xedc3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xedc3('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedc3('0x2'))['db'];var utils=require(_0xedc3('0x3'));var logger=require(_0xedc3('0x4'))(_0xedc3('0x5'));var config=require(_0xedc3('0x6'));var jayson=require(_0xedc3('0x7'));var client=jayson[_0xedc3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x221038,_0x21df63,_0x975849){return new BPromise(function(_0x306ec9,_0x133206){return client[_0xedc3('0x9')](_0x221038,_0x975849)[_0xedc3('0xa')](function(_0x2e1ae6){logger[_0xedc3('0xb')](_0xedc3('0xc'),_0x21df63,_0xedc3('0xd'));logger['debug'](_0xedc3('0xe'),_0x21df63,_0xedc3('0xd'),JSON[_0xedc3('0xf')](_0x2e1ae6));if(_0x2e1ae6[_0xedc3('0x10')]){if(_0x2e1ae6[_0xedc3('0x10')][_0xedc3('0x11')]===0x1f4){logger[_0xedc3('0x10')]('SquareMessage,\x20%s,\x20%s',_0x21df63,_0x2e1ae6[_0xedc3('0x10')][_0xedc3('0x12')]);return _0x133206(_0x2e1ae6[_0xedc3('0x10')]['message']);}logger[_0xedc3('0x10')](_0xedc3('0xc'),_0x21df63,_0x2e1ae6[_0xedc3('0x10')][_0xedc3('0x12')]);return _0x306ec9(_0x2e1ae6[_0xedc3('0x10')][_0xedc3('0x12')]);}else{logger[_0xedc3('0xb')]('SquareMessage,\x20%s,\x20%s',_0x21df63,_0xedc3('0xd'));_0x306ec9(_0x2e1ae6['result'][_0xedc3('0x12')]);}})[_0xedc3('0x13')](function(_0x5a45e9){logger[_0xedc3('0x10')](_0xedc3('0xc'),_0x21df63,_0x5a45e9);_0x133206(_0x5a45e9);});});}exports[_0xedc3('0x14')]=function(_0x18b7ca){var _0x1506f9=this;return new Promise(function(_0x4b74a4,_0x5d0f0){return db['SquareMessage'][_0xedc3('0x15')](_0x18b7ca['body'],{'raw':_0x18b7ca[_0xedc3('0x16')]?_0x18b7ca[_0xedc3('0x16')][_0xedc3('0x17')]===undefined?!![]:![]:!![]})[_0xedc3('0xa')](function(_0x502f2e){logger[_0xedc3('0xb')](_0xedc3('0x14'),_0x18b7ca);logger[_0xedc3('0x18')](_0xedc3('0x14'),_0x18b7ca,JSON[_0xedc3('0xf')](_0x502f2e));_0x4b74a4(_0x502f2e);})[_0xedc3('0x13')](function(_0x1caca0){logger[_0xedc3('0x10')](_0xedc3('0x14'),_0x1caca0[_0xedc3('0x12')],_0x18b7ca);_0x5d0f0(_0x1506f9[_0xedc3('0x10')](0x1f4,_0x1caca0[_0xedc3('0x12')]));});});}; \ No newline at end of file +var _0x84c2=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash'];(function(_0x381f65,_0x302e0e){var _0x199bf5=function(_0x42bdbf){while(--_0x42bdbf){_0x381f65['push'](_0x381f65['shift']());}};_0x199bf5(++_0x302e0e);}(_0x84c2,0x1e5));var _0x284c=function(_0x1997db,_0x179579){_0x1997db=_0x1997db-0x0;var _0x1e85f6=_0x84c2[_0x1997db];return _0x1e85f6;};'use strict';var _=require(_0x284c('0x0'));var util=require(_0x284c('0x1'));var moment=require(_0x284c('0x2'));var BPromise=require(_0x284c('0x3'));var rs=require(_0x284c('0x4'));var fs=require('fs');var Redis=require(_0x284c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x284c('0x6'));var logger=require(_0x284c('0x7'))(_0x284c('0x8'));var config=require(_0x284c('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x284c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1278bb,_0x1aacd3,_0xf0d545){return new BPromise(function(_0x139ed9,_0xd8ae09){return client[_0x284c('0xb')](_0x1278bb,_0xf0d545)['then'](function(_0x42590e){logger['info'](_0x284c('0xc'),_0x1aacd3,'request\x20sent');logger[_0x284c('0xd')](_0x284c('0xe'),_0x1aacd3,_0x284c('0xf'),JSON[_0x284c('0x10')](_0x42590e));if(_0x42590e[_0x284c('0x11')]){if(_0x42590e[_0x284c('0x11')]['code']===0x1f4){logger[_0x284c('0x11')](_0x284c('0xc'),_0x1aacd3,_0x42590e[_0x284c('0x11')][_0x284c('0x12')]);return _0xd8ae09(_0x42590e[_0x284c('0x11')]['message']);}logger[_0x284c('0x11')](_0x284c('0xc'),_0x1aacd3,_0x42590e['error']['message']);return _0x139ed9(_0x42590e[_0x284c('0x11')][_0x284c('0x12')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x1aacd3,'request\x20sent');_0x139ed9(_0x42590e[_0x284c('0x13')][_0x284c('0x12')]);}})[_0x284c('0x14')](function(_0x1fe2b3){logger[_0x284c('0x11')](_0x284c('0xc'),_0x1aacd3,_0x1fe2b3);_0xd8ae09(_0x1fe2b3);});});}exports[_0x284c('0x15')]=function(_0x5d82aa){var _0x5ed430=this;return new Promise(function(_0x513a3a,_0x5abce3){return db[_0x284c('0x16')][_0x284c('0x17')](_0x5d82aa[_0x284c('0x18')],{'raw':_0x5d82aa[_0x284c('0x19')]?_0x5d82aa[_0x284c('0x19')][_0x284c('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4e324d){logger['info'](_0x284c('0x15'),_0x5d82aa);logger[_0x284c('0xd')](_0x284c('0x15'),_0x5d82aa,JSON['stringify'](_0x4e324d));_0x513a3a(_0x4e324d);})[_0x284c('0x14')](function(_0xba6e0b){logger[_0x284c('0x11')](_0x284c('0x15'),_0xba6e0b[_0x284c('0x12')],_0x5d82aa);_0x5abce3(_0x5ed430[_0x284c('0x11')](0x1f4,_0xba6e0b[_0x284c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index b2daa0c..c25dc97 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 _0xcc8e=['multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','post','create','update','delete','destroy','exports'];(function(_0x5c2234,_0x112042){var _0x44f7fd=function(_0x5d3974){while(--_0x5d3974){_0x5c2234['push'](_0x5c2234['shift']());}};_0x44f7fd(++_0x112042);}(_0xcc8e,0x176));var _0xecc8=function(_0x5b4265,_0x49ed19){_0x5b4265=_0x5b4265-0x0;var _0x42f84b=_0xcc8e[_0x5b4265];return _0x42f84b;};'use strict';var multer=require(_0xecc8('0x0'));var util=require(_0xecc8('0x1'));var path=require(_0xecc8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xecc8('0x3')]();var fs_extra=require(_0xecc8('0x4'));var auth=require(_0xecc8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xecc8('0x6'));var controller=require(_0xecc8('0x7'));router[_0xecc8('0x8')]('/',auth[_0xecc8('0x9')](),controller[_0xecc8('0xa')]);router['get'](_0xecc8('0xb'),auth[_0xecc8('0x9')](),controller[_0xecc8('0xc')]);router[_0xecc8('0x8')](_0xecc8('0xd'),auth[_0xecc8('0x9')](),timeout(_0xecc8('0xe')),controller[_0xecc8('0xf')]);router[_0xecc8('0x10')]('/',auth['isAuthenticated'](),controller[_0xecc8('0x11')]);router['put'](_0xecc8('0xb'),auth[_0xecc8('0x9')](),controller[_0xecc8('0x12')]);router[_0xecc8('0x13')](_0xecc8('0xb'),auth[_0xecc8('0x9')](),controller[_0xecc8('0x14')]);module[_0xecc8('0x15')]=router; \ No newline at end of file +var _0x1c6a=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','/:id/test','15s','test','create','put','update','delete','destroy','exports'];(function(_0x211b8d,_0x2b98e4){var _0x36e8ba=function(_0x3a032b){while(--_0x3a032b){_0x211b8d['push'](_0x211b8d['shift']());}};_0x36e8ba(++_0x2b98e4);}(_0x1c6a,0x1e3));var _0xa1c6=function(_0x4ad095,_0x5f4d18){_0x4ad095=_0x4ad095-0x0;var _0x168ddf=_0x1c6a[_0x4ad095];return _0x168ddf;};'use strict';var multer=require(_0xa1c6('0x0'));var util=require(_0xa1c6('0x1'));var path=require(_0xa1c6('0x2'));var timeout=require(_0xa1c6('0x3'));var express=require('express');var router=express[_0xa1c6('0x4')]();var fs_extra=require(_0xa1c6('0x5'));var auth=require(_0xa1c6('0x6'));var interaction=require(_0xa1c6('0x7'));var config=require(_0xa1c6('0x8'));var controller=require(_0xa1c6('0x9'));router['get']('/',auth[_0xa1c6('0xa')](),controller[_0xa1c6('0xb')]);router[_0xa1c6('0xc')](_0xa1c6('0xd'),auth[_0xa1c6('0xa')](),controller['show']);router[_0xa1c6('0xc')](_0xa1c6('0xe'),auth[_0xa1c6('0xa')](),timeout(_0xa1c6('0xf')),controller[_0xa1c6('0x10')]);router['post']('/',auth[_0xa1c6('0xa')](),controller[_0xa1c6('0x11')]);router[_0xa1c6('0x12')](_0xa1c6('0xd'),auth[_0xa1c6('0xa')](),controller[_0xa1c6('0x13')]);router[_0xa1c6('0x14')](_0xa1c6('0xd'),auth[_0xa1c6('0xa')](),controller[_0xa1c6('0x15')]);module[_0xa1c6('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 8e7d5ad..ca0d1af 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 _0xaba2=['STRING','name','sequelize','exports'];(function(_0x2ce963,_0x11c5e5){var _0x1478ef=function(_0x135aa7){while(--_0x135aa7){_0x2ce963['push'](_0x2ce963['shift']());}};_0x1478ef(++_0x11c5e5);}(_0xaba2,0xe2));var _0x2aba=function(_0x38b444,_0x259a27){_0x38b444=_0x38b444-0x0;var _0x270f58=_0xaba2[_0x38b444];return _0x270f58;};'use strict';var Sequelize=require(_0x2aba('0x0'));module[_0x2aba('0x1')]={'name':{'type':Sequelize[_0x2aba('0x2')],'unique':_0x2aba('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x2aba('0x2')]},'description':{'type':Sequelize[_0x2aba('0x2')]}}; \ No newline at end of file +var _0xc19e=['exports','STRING'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xc19e,0x102));var _0xec19=function(_0x4cfcf9,_0xc0c2ab){_0x4cfcf9=_0x4cfcf9-0x0;var _0x528bb6=_0xc19e[_0x4cfcf9];return _0x528bb6;};'use strict';var Sequelize=require('sequelize');module[_0xec19('0x0')]={'name':{'type':Sequelize[_0xec19('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xec19('0x1')]},'description':{'type':Sequelize[_0xec19('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index db4fbc0..903307c 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 _0x23d5=['pick','filter','VIRTUAL','includeAll','findAll','rows','params','fields','include','merge','options','catch','create','body','user','get','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1e2de9,_0x3b54a6){var _0x3b4c93=function(_0x5d30e5){while(--_0x5d30e5){_0x1e2de9['push'](_0x1e2de9['shift']());}};_0x3b4c93(++_0x3b54a6);}(_0x23d5,0xc7));var _0x523d=function(_0x2aa55d,_0x2430f1){_0x2aa55d=_0x2aa55d-0x0;var _0x4874a0=_0x23d5[_0x2aa55d];return _0x4874a0;};'use strict';var emlformat=require(_0x523d('0x0'));var rimraf=require(_0x523d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x523d('0x2'));var rp=require(_0x523d('0x3'));var moment=require(_0x523d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x523d('0x5'));var util=require('util');var path=require(_0x523d('0x6'));var sox=require(_0x523d('0x7'));var csv=require(_0x523d('0x8'));var ejs=require(_0x523d('0x9'));var fs=require('fs');var fs_extra=require(_0x523d('0xa'));var _=require('lodash');var squel=require(_0x523d('0xb'));var crypto=require(_0x523d('0xc'));var jsforce=require(_0x523d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x523d('0x8'));var querystring=require(_0x523d('0xe'));var Papa=require('papaparse');var Redis=require(_0x523d('0xf'));var authService=require(_0x523d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x523d('0x11'));var hardwareService=require(_0x523d('0x12'));var logger=require(_0x523d('0x13'))('api');var utils=require(_0x523d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x523d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56aeec,_0x232e05){_0x232e05=_0x232e05||0xcc;return function(_0x348042){if(_0x348042){return _0x56aeec['sendStatus'](_0x232e05);}return _0x56aeec[_0x523d('0x16')](_0x232e05)[_0x523d('0x17')]();};}function respondWithResult(_0x584ab2,_0x3273b7){_0x3273b7=_0x3273b7||0xc8;return function(_0x35740e){if(_0x35740e){return _0x584ab2[_0x523d('0x16')](_0x3273b7)[_0x523d('0x18')](_0x35740e);}};}function respondWithFilteredResult(_0x23f6cd,_0x33bb49){return function(_0x5950d5){if(_0x5950d5){var _0x46af5e=typeof _0x33bb49[_0x523d('0x19')]==='undefined'&&typeof _0x33bb49[_0x523d('0x1a')]===_0x523d('0x1b');var _0x1c06e1=_0x5950d5[_0x523d('0x1c')];var _0x5839e0=_0x46af5e?0x0:_0x33bb49['offset'];var _0x361714=_0x46af5e?_0x5950d5[_0x523d('0x1c')]:_0x33bb49[_0x523d('0x19')]+_0x33bb49[_0x523d('0x1a')];var _0xe26ad7;if(_0x361714>=_0x1c06e1){_0x361714=_0x1c06e1;_0xe26ad7=0xc8;}else{_0xe26ad7=0xce;}_0x23f6cd[_0x523d('0x16')](_0xe26ad7);return _0x23f6cd[_0x523d('0x1d')]('Content-Range',_0x5839e0+'-'+_0x361714+'/'+_0x1c06e1)[_0x523d('0x18')](_0x5950d5);}return null;};}function patchUpdates(_0x4e8775){return function(_0x3bf9e8){try{jsonpatch[_0x523d('0x1e')](_0x3bf9e8,_0x4e8775,!![]);}catch(_0x23b1ee){return BPromise[_0x523d('0x1f')](_0x23b1ee);}return _0x3bf9e8[_0x523d('0x20')]();};}function saveUpdates(_0x2f958d,_0x5839e1){return function(_0x48c8d7){if(_0x48c8d7){return _0x48c8d7[_0x523d('0x21')](_0x2f958d)[_0x523d('0x22')](function(_0x4337a4){return _0x4337a4;});}return null;};}function removeEntity(_0x145595,_0x56e41e){return function(_0x18cbe1){if(_0x18cbe1){return _0x18cbe1[_0x523d('0x23')]()[_0x523d('0x22')](function(){var _0x19cc59=_0x18cbe1['get']({'plain':!![]});var _0xa753c2='ODBC';return db[_0x523d('0x24')][_0x523d('0x23')]({'where':{'type':_0xa753c2,'resourceId':_0x19cc59['id']}})['then'](function(){return _0x18cbe1;});})[_0x523d('0x22')](function(){_0x145595[_0x523d('0x16')](0xcc)[_0x523d('0x17')]();});}};}function handleEntityNotFound(_0xdb3e53,_0x39ecbf){return function(_0x2b38c4){if(!_0x2b38c4){_0xdb3e53[_0x523d('0x25')](0x194);}return _0x2b38c4;};}function handleError(_0x17725d,_0x2ba515){_0x2ba515=_0x2ba515||0x1f4;return function(_0x5181fa){logger['error'](_0x5181fa[_0x523d('0x26')]);if(_0x5181fa[_0x523d('0x27')]){delete _0x5181fa[_0x523d('0x27')];}_0x17725d[_0x523d('0x16')](_0x2ba515)[_0x523d('0x28')](_0x5181fa);};}exports[_0x523d('0x29')]=function(_0x37e549,_0x5a18ca){var _0x7053d1={},_0x2664ea={},_0x574a32={'count':0x0,'rows':[]};var _0x2a13ca=_[_0x523d('0x2a')](db[_0x523d('0x2b')][_0x523d('0x2c')],function(_0x446f56){return{'name':_0x446f56[_0x523d('0x2d')],'type':_0x446f56[_0x523d('0x2e')][_0x523d('0x2f')]};});_0x2664ea['model']=_[_0x523d('0x2a')](_0x2a13ca,_0x523d('0x27'));_0x2664ea[_0x523d('0x30')]=_[_0x523d('0x31')](_0x37e549[_0x523d('0x30')]);_0x2664ea[_0x523d('0x32')]=_[_0x523d('0x33')](_0x2664ea[_0x523d('0x34')],_0x2664ea[_0x523d('0x30')]);_0x7053d1[_0x523d('0x35')]=_['intersection'](_0x2664ea[_0x523d('0x34')],qs['fields'](_0x37e549['query']['fields']));_0x7053d1['attributes']=_0x7053d1[_0x523d('0x35')]['length']?_0x7053d1[_0x523d('0x35')]:_0x2664ea[_0x523d('0x34')];if(!_0x37e549[_0x523d('0x30')][_0x523d('0x36')](_0x523d('0x37'))){_0x7053d1['limit']=qs[_0x523d('0x1a')](_0x37e549[_0x523d('0x30')][_0x523d('0x1a')]);_0x7053d1[_0x523d('0x19')]=qs[_0x523d('0x19')](_0x37e549[_0x523d('0x30')][_0x523d('0x19')]);}_0x7053d1[_0x523d('0x38')]=qs[_0x523d('0x39')](_0x37e549[_0x523d('0x30')][_0x523d('0x39')]);_0x7053d1[_0x523d('0x3a')]=qs['filters'](_[_0x523d('0x3b')](_0x37e549[_0x523d('0x30')],_0x2664ea['filters']),_0x2a13ca);if(_0x37e549['query'][_0x523d('0x3c')]){_0x7053d1['where']=_['merge'](_0x7053d1[_0x523d('0x3a')],{'$or':_[_0x523d('0x2a')](_0x2a13ca,function(_0x1800a1){if(_0x1800a1[_0x523d('0x2e')]!==_0x523d('0x3d')){var _0x382225={};_0x382225[_0x1800a1[_0x523d('0x27')]]={'$like':'%'+_0x37e549[_0x523d('0x30')][_0x523d('0x3c')]+'%'};return _0x382225;}})});}_0x7053d1=_['merge']({},_0x7053d1,_0x37e549['options']);var _0x4b89ae={'where':_0x7053d1[_0x523d('0x3a')]};return db['SquareOdbc'][_0x523d('0x1c')](_0x4b89ae)[_0x523d('0x22')](function(_0x47fde5){_0x574a32['count']=_0x47fde5;if(_0x37e549['query'][_0x523d('0x3e')]){_0x7053d1['include']=[{'all':!![]}];}return db[_0x523d('0x2b')][_0x523d('0x3f')](_0x7053d1);})[_0x523d('0x22')](function(_0x43ce63){_0x574a32[_0x523d('0x40')]=_0x43ce63;return _0x574a32;})[_0x523d('0x22')](respondWithFilteredResult(_0x5a18ca,_0x7053d1))['catch'](handleError(_0x5a18ca,null));};exports['show']=function(_0x34311f,_0x30660f){var _0x1b1bd0={'raw':!![],'where':{'id':_0x34311f[_0x523d('0x41')]['id']}},_0x1ca590={};_0x1ca590[_0x523d('0x34')]=_[_0x523d('0x31')](db[_0x523d('0x2b')][_0x523d('0x2c')]);_0x1ca590[_0x523d('0x30')]=_[_0x523d('0x31')](_0x34311f[_0x523d('0x30')]);_0x1ca590[_0x523d('0x32')]=_[_0x523d('0x33')](_0x1ca590[_0x523d('0x34')],_0x1ca590[_0x523d('0x30')]);_0x1b1bd0[_0x523d('0x35')]=_[_0x523d('0x33')](_0x1ca590[_0x523d('0x34')],qs['fields'](_0x34311f[_0x523d('0x30')][_0x523d('0x42')]));_0x1b1bd0[_0x523d('0x35')]=_0x1b1bd0[_0x523d('0x35')]['length']?_0x1b1bd0[_0x523d('0x35')]:_0x1ca590['model'];if(_0x34311f['query'][_0x523d('0x3e')]){_0x1b1bd0[_0x523d('0x43')]=[{'all':!![]}];}_0x1b1bd0=_[_0x523d('0x44')]({},_0x1b1bd0,_0x34311f[_0x523d('0x45')]);return db[_0x523d('0x2b')]['find'](_0x1b1bd0)[_0x523d('0x22')](handleEntityNotFound(_0x30660f,null))[_0x523d('0x22')](respondWithResult(_0x30660f,null))[_0x523d('0x46')](handleError(_0x30660f,null));};exports[_0x523d('0x47')]=function(_0x3e3155,_0x53ca62){return db[_0x523d('0x2b')][_0x523d('0x47')](_0x3e3155[_0x523d('0x48')],{})[_0x523d('0x22')](function(_0x41f7a0){var _0x15526a=_0x3e3155[_0x523d('0x49')][_0x523d('0x4a')]({'plain':!![]});if(!_0x15526a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15526a['role']===_0x523d('0x49')){var _0x3cfd12=_0x41f7a0['get']({'plain':!![]});var _0x368864='ODBC';return db[_0x523d('0x4b')][_0x523d('0x4c')]({'where':{'name':_0x368864,'userProfileId':_0x15526a[_0x523d('0x4d')]},'raw':!![]})[_0x523d('0x22')](function(_0x1e0ecd){if(_0x1e0ecd&&_0x1e0ecd[_0x523d('0x4e')]===0x0){return db[_0x523d('0x24')]['create']({'name':_0x3cfd12['name'],'resourceId':_0x3cfd12['id'],'type':_0x1e0ecd[_0x523d('0x27')],'sectionId':_0x1e0ecd['id']},{})[_0x523d('0x22')](function(){return _0x41f7a0;});}else{return _0x41f7a0;}})[_0x523d('0x46')](function(_0x1bde3b){logger[_0x523d('0x4f')](_0x523d('0x50'),_0x1bde3b);throw _0x1bde3b;});}return _0x41f7a0;})['then'](respondWithResult(_0x53ca62,0xc9))['catch'](handleError(_0x53ca62,null));};exports[_0x523d('0x21')]=function(_0x8810d3,_0x5a71f0){if(_0x8810d3[_0x523d('0x48')]['id']){delete _0x8810d3[_0x523d('0x48')]['id'];}return db[_0x523d('0x2b')][_0x523d('0x4c')]({'where':{'id':_0x8810d3[_0x523d('0x41')]['id']}})[_0x523d('0x22')](handleEntityNotFound(_0x5a71f0,null))[_0x523d('0x22')](saveUpdates(_0x8810d3[_0x523d('0x48')],null))[_0x523d('0x22')](respondWithResult(_0x5a71f0,null))['catch'](handleError(_0x5a71f0,null));};exports['destroy']=function(_0x4dd2f0,_0x4ba8e7){return db[_0x523d('0x2b')][_0x523d('0x4c')]({'where':{'id':_0x4dd2f0[_0x523d('0x41')]['id']}})[_0x523d('0x22')](handleEntityNotFound(_0x4ba8e7,null))[_0x523d('0x22')](removeEntity(_0x4ba8e7,null))['catch'](handleError(_0x4ba8e7,null));};exports[_0x523d('0x51')]=function(_0xe69638,_0x337bc6,_0x1008d3){var _0x2c73e0;return db[_0x523d('0x2b')]['find']({'where':{'id':_0xe69638[_0x523d('0x41')]['id']},'attributes':['id',_0x523d('0x52')]})[_0x523d('0x22')](handleEntityNotFound(_0x337bc6,null))[_0x523d('0x22')](function(_0x9acc18){if(_0x9acc18){var _0x180bc9=require(_0x523d('0x53'))();_0x180bc9[_0x523d('0x54')](_0x9acc18['dsn']);_0x180bc9[_0x523d('0x55')]();return _0x9acc18;}})['then'](respondWithResult(_0x337bc6,null))['catch'](handleError(_0x337bc6,null));}; \ No newline at end of file +var _0x62ee=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','openSync','closeSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','update','then','destroy','ODBC','UserProfileResource','name','send','map','SquareOdbc','rawAttributes','type','key','query','keys','filters'];(function(_0x28d6b9,_0xbe9964){var _0x1e2bee=function(_0xc75f76){while(--_0xc75f76){_0x28d6b9['push'](_0x28d6b9['shift']());}};_0x1e2bee(++_0xbe9964);}(_0x62ee,0xd2));var _0xe62e=function(_0x107a92,_0x4fbfc0){_0x107a92=_0x107a92-0x0;var _0x54a267=_0x62ee[_0x107a92];return _0x54a267;};'use strict';var emlformat=require(_0xe62e('0x0'));var rimraf=require(_0xe62e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe62e('0x2'));var rp=require(_0xe62e('0x3'));var moment=require(_0xe62e('0x4'));var BPromise=require(_0xe62e('0x5'));var Mustache=require(_0xe62e('0x6'));var util=require(_0xe62e('0x7'));var path=require(_0xe62e('0x8'));var sox=require('sox');var csv=require(_0xe62e('0x9'));var ejs=require(_0xe62e('0xa'));var fs=require('fs');var fs_extra=require(_0xe62e('0xb'));var _=require('lodash');var squel=require(_0xe62e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe62e('0xd'));var deskjs=require(_0xe62e('0xe'));var toCsv=require(_0xe62e('0x9'));var querystring=require(_0xe62e('0xf'));var Papa=require(_0xe62e('0x10'));var Redis=require(_0xe62e('0x11'));var authService=require(_0xe62e('0x12'));var qs=require(_0xe62e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe62e('0x14'));var logger=require(_0xe62e('0x15'))(_0xe62e('0x16'));var utils=require(_0xe62e('0x17'));var config=require(_0xe62e('0x18'));var licenseUtil=require(_0xe62e('0x19'));var db=require(_0xe62e('0x1a'))['db'];function respondWithStatusCode(_0x84b3b0,_0x1e3e1b){_0x1e3e1b=_0x1e3e1b||0xcc;return function(_0x11d7e2){if(_0x11d7e2){return _0x84b3b0[_0xe62e('0x1b')](_0x1e3e1b);}return _0x84b3b0['status'](_0x1e3e1b)['end']();};}function respondWithResult(_0x3eba90,_0x1d272c){_0x1d272c=_0x1d272c||0xc8;return function(_0x281438){if(_0x281438){return _0x3eba90[_0xe62e('0x1c')](_0x1d272c)[_0xe62e('0x1d')](_0x281438);}};}function respondWithFilteredResult(_0x4b3b61,_0x512077){return function(_0x2c17fc){if(_0x2c17fc){var _0x128648=typeof _0x512077[_0xe62e('0x1e')]===_0xe62e('0x1f')&&typeof _0x512077[_0xe62e('0x20')]==='undefined';var _0x444361=_0x2c17fc['count'];var _0x187164=_0x128648?0x0:_0x512077[_0xe62e('0x1e')];var _0x23c6b3=_0x128648?_0x2c17fc[_0xe62e('0x21')]:_0x512077[_0xe62e('0x1e')]+_0x512077[_0xe62e('0x20')];var _0xea1130;if(_0x23c6b3>=_0x444361){_0x23c6b3=_0x444361;_0xea1130=0xc8;}else{_0xea1130=0xce;}_0x4b3b61[_0xe62e('0x1c')](_0xea1130);return _0x4b3b61['set']('Content-Range',_0x187164+'-'+_0x23c6b3+'/'+_0x444361)[_0xe62e('0x1d')](_0x2c17fc);}return null;};}function patchUpdates(_0x59a758){return function(_0x2f83aa){try{jsonpatch[_0xe62e('0x22')](_0x2f83aa,_0x59a758,!![]);}catch(_0x21db79){return BPromise[_0xe62e('0x23')](_0x21db79);}return _0x2f83aa['save']();};}function saveUpdates(_0x2788d9,_0x435287){return function(_0x55bd58){if(_0x55bd58){return _0x55bd58[_0xe62e('0x24')](_0x2788d9)[_0xe62e('0x25')](function(_0x554104){return _0x554104;});}return null;};}function removeEntity(_0x3e9cd3,_0x1a81d9){return function(_0x20792d){if(_0x20792d){return _0x20792d[_0xe62e('0x26')]()[_0xe62e('0x25')](function(){var _0x125504=_0x20792d['get']({'plain':!![]});var _0x1d32c9=_0xe62e('0x27');return db[_0xe62e('0x28')]['destroy']({'where':{'type':_0x1d32c9,'resourceId':_0x125504['id']}})[_0xe62e('0x25')](function(){return _0x20792d;});})['then'](function(){_0x3e9cd3[_0xe62e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a2551,_0x3a084b){return function(_0x111d5c){if(!_0x111d5c){_0x5a2551[_0xe62e('0x1b')](0x194);}return _0x111d5c;};}function handleError(_0x13a0a0,_0x5ef8f5){_0x5ef8f5=_0x5ef8f5||0x1f4;return function(_0x58ce99){logger['error'](_0x58ce99['stack']);if(_0x58ce99[_0xe62e('0x29')]){delete _0x58ce99[_0xe62e('0x29')];}_0x13a0a0[_0xe62e('0x1c')](_0x5ef8f5)[_0xe62e('0x2a')](_0x58ce99);};}exports['index']=function(_0xc2d74,_0x490707){var _0x4ae216={},_0x23ea14={},_0x3a1222={'count':0x0,'rows':[]};var _0x521ba0=_[_0xe62e('0x2b')](db[_0xe62e('0x2c')][_0xe62e('0x2d')],function(_0x35cf09){return{'name':_0x35cf09['fieldName'],'type':_0x35cf09[_0xe62e('0x2e')][_0xe62e('0x2f')]};});_0x23ea14['model']=_[_0xe62e('0x2b')](_0x521ba0,_0xe62e('0x29'));_0x23ea14[_0xe62e('0x30')]=_[_0xe62e('0x31')](_0xc2d74[_0xe62e('0x30')]);_0x23ea14[_0xe62e('0x32')]=_[_0xe62e('0x33')](_0x23ea14[_0xe62e('0x34')],_0x23ea14['query']);_0x4ae216[_0xe62e('0x35')]=_[_0xe62e('0x33')](_0x23ea14['model'],qs[_0xe62e('0x36')](_0xc2d74['query'][_0xe62e('0x36')]));_0x4ae216[_0xe62e('0x35')]=_0x4ae216['attributes'][_0xe62e('0x37')]?_0x4ae216[_0xe62e('0x35')]:_0x23ea14[_0xe62e('0x34')];if(!_0xc2d74[_0xe62e('0x30')][_0xe62e('0x38')](_0xe62e('0x39'))){_0x4ae216[_0xe62e('0x20')]=qs[_0xe62e('0x20')](_0xc2d74[_0xe62e('0x30')][_0xe62e('0x20')]);_0x4ae216[_0xe62e('0x1e')]=qs[_0xe62e('0x1e')](_0xc2d74[_0xe62e('0x30')][_0xe62e('0x1e')]);}_0x4ae216[_0xe62e('0x3a')]=qs[_0xe62e('0x3b')](_0xc2d74[_0xe62e('0x30')][_0xe62e('0x3b')]);_0x4ae216[_0xe62e('0x3c')]=qs[_0xe62e('0x32')](_['pick'](_0xc2d74['query'],_0x23ea14[_0xe62e('0x32')]),_0x521ba0);if(_0xc2d74['query'][_0xe62e('0x3d')]){_0x4ae216[_0xe62e('0x3c')]=_['merge'](_0x4ae216[_0xe62e('0x3c')],{'$or':_[_0xe62e('0x2b')](_0x521ba0,function(_0x59f650){if(_0x59f650[_0xe62e('0x2e')]!==_0xe62e('0x3e')){var _0x2a0db8={};_0x2a0db8[_0x59f650[_0xe62e('0x29')]]={'$like':'%'+_0xc2d74[_0xe62e('0x30')][_0xe62e('0x3d')]+'%'};return _0x2a0db8;}})});}_0x4ae216=_[_0xe62e('0x3f')]({},_0x4ae216,_0xc2d74[_0xe62e('0x40')]);var _0x22ebd3={'where':_0x4ae216[_0xe62e('0x3c')]};return db[_0xe62e('0x2c')][_0xe62e('0x21')](_0x22ebd3)['then'](function(_0x557436){_0x3a1222['count']=_0x557436;if(_0xc2d74[_0xe62e('0x30')][_0xe62e('0x41')]){_0x4ae216[_0xe62e('0x42')]=[{'all':!![]}];}return db[_0xe62e('0x2c')][_0xe62e('0x43')](_0x4ae216);})[_0xe62e('0x25')](function(_0x4b0d33){_0x3a1222[_0xe62e('0x44')]=_0x4b0d33;return _0x3a1222;})['then'](respondWithFilteredResult(_0x490707,_0x4ae216))[_0xe62e('0x45')](handleError(_0x490707,null));};exports[_0xe62e('0x46')]=function(_0xa2c90f,_0x353879){var _0x2737d3={'raw':!![],'where':{'id':_0xa2c90f[_0xe62e('0x47')]['id']}},_0x935dcd={};_0x935dcd[_0xe62e('0x34')]=_[_0xe62e('0x31')](db[_0xe62e('0x2c')][_0xe62e('0x2d')]);_0x935dcd['query']=_['keys'](_0xa2c90f[_0xe62e('0x30')]);_0x935dcd['filters']=_[_0xe62e('0x33')](_0x935dcd[_0xe62e('0x34')],_0x935dcd[_0xe62e('0x30')]);_0x2737d3[_0xe62e('0x35')]=_[_0xe62e('0x33')](_0x935dcd['model'],qs[_0xe62e('0x36')](_0xa2c90f['query']['fields']));_0x2737d3[_0xe62e('0x35')]=_0x2737d3[_0xe62e('0x35')][_0xe62e('0x37')]?_0x2737d3[_0xe62e('0x35')]:_0x935dcd[_0xe62e('0x34')];if(_0xa2c90f[_0xe62e('0x30')]['includeAll']){_0x2737d3[_0xe62e('0x42')]=[{'all':!![]}];}_0x2737d3=_['merge']({},_0x2737d3,_0xa2c90f[_0xe62e('0x40')]);return db['SquareOdbc'][_0xe62e('0x48')](_0x2737d3)[_0xe62e('0x25')](handleEntityNotFound(_0x353879,null))[_0xe62e('0x25')](respondWithResult(_0x353879,null))['catch'](handleError(_0x353879,null));};exports['create']=function(_0xac8265,_0x37e67e){return db['SquareOdbc'][_0xe62e('0x49')](_0xac8265[_0xe62e('0x4a')],{})['then'](function(_0x5f04b3){var _0x44da5f=_0xac8265[_0xe62e('0x4b')][_0xe62e('0x4c')]({'plain':!![]});if(!_0x44da5f)throw new Error(_0xe62e('0x4d'));if(_0x44da5f[_0xe62e('0x4e')]===_0xe62e('0x4b')){var _0x36c35c=_0x5f04b3[_0xe62e('0x4c')]({'plain':!![]});var _0x2f106b=_0xe62e('0x27');return db[_0xe62e('0x4f')][_0xe62e('0x48')]({'where':{'name':_0x2f106b,'userProfileId':_0x44da5f[_0xe62e('0x50')]},'raw':!![]})[_0xe62e('0x25')](function(_0xba8ac1){if(_0xba8ac1&&_0xba8ac1[_0xe62e('0x51')]===0x0){return db[_0xe62e('0x28')][_0xe62e('0x49')]({'name':_0x36c35c['name'],'resourceId':_0x36c35c['id'],'type':_0xba8ac1[_0xe62e('0x29')],'sectionId':_0xba8ac1['id']},{})[_0xe62e('0x25')](function(){return _0x5f04b3;});}else{return _0x5f04b3;}})[_0xe62e('0x45')](function(_0x206410){logger['error'](_0xe62e('0x52'),_0x206410);throw _0x206410;});}return _0x5f04b3;})[_0xe62e('0x25')](respondWithResult(_0x37e67e,0xc9))[_0xe62e('0x45')](handleError(_0x37e67e,null));};exports[_0xe62e('0x24')]=function(_0x5eb1ba,_0x315690){if(_0x5eb1ba[_0xe62e('0x4a')]['id']){delete _0x5eb1ba[_0xe62e('0x4a')]['id'];}return db['SquareOdbc'][_0xe62e('0x48')]({'where':{'id':_0x5eb1ba[_0xe62e('0x47')]['id']}})[_0xe62e('0x25')](handleEntityNotFound(_0x315690,null))[_0xe62e('0x25')](saveUpdates(_0x5eb1ba[_0xe62e('0x4a')],null))[_0xe62e('0x25')](respondWithResult(_0x315690,null))[_0xe62e('0x45')](handleError(_0x315690,null));};exports[_0xe62e('0x26')]=function(_0x44d34c,_0x2205bc){return db[_0xe62e('0x2c')][_0xe62e('0x48')]({'where':{'id':_0x44d34c[_0xe62e('0x47')]['id']}})[_0xe62e('0x25')](handleEntityNotFound(_0x2205bc,null))[_0xe62e('0x25')](removeEntity(_0x2205bc,null))[_0xe62e('0x45')](handleError(_0x2205bc,null));};exports[_0xe62e('0x53')]=function(_0x4360e6,_0x3b963e,_0x7bac7){var _0x146ebb;return db[_0xe62e('0x2c')][_0xe62e('0x48')]({'where':{'id':_0x4360e6[_0xe62e('0x47')]['id']},'attributes':['id',_0xe62e('0x54')]})['then'](handleEntityNotFound(_0x3b963e,null))[_0xe62e('0x25')](function(_0x356570){if(_0x356570){var _0x40d016=require('odbc')();_0x40d016[_0xe62e('0x55')](_0x356570[_0xe62e('0x54')]);_0x40d016[_0xe62e('0x56')]();return _0x356570;}})['then'](respondWithResult(_0x3b963e,null))['catch'](handleError(_0x3b963e,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 1845424..28cf0fa 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 _0x2e8f=['../../config/environment','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x45e3d9,_0x2f25d5){var _0x5419c7=function(_0x3f3b01){while(--_0x3f3b01){_0x45e3d9['push'](_0x45e3d9['shift']());}};_0x5419c7(++_0x2f25d5);}(_0x2e8f,0x1e5));var _0xf2e8=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x2e8f[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xf2e8('0x0'));var util=require(_0xf2e8('0x1'));var logger=require(_0xf2e8('0x2'))(_0xf2e8('0x3'));var moment=require(_0xf2e8('0x4'));var BPromise=require(_0xf2e8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2e8('0x6'));var rimraf=require('rimraf');var config=require(_0xf2e8('0x7'));var attributes=require('./squareOdbc.attributes');module[_0xf2e8('0x8')]=function(_0x1ab603,_0x2fc09d){return _0x1ab603[_0xf2e8('0x9')](_0xf2e8('0xa'),attributes,{'tableName':_0xf2e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb5d=['bluebird','request-promise','rimraf','./squareOdbc.attributes','exports','define','square_odbc','util','../../config/logger','api','moment'];(function(_0x237698,_0x24c507){var _0xad15c=function(_0x5ed8f6){while(--_0x5ed8f6){_0x237698['push'](_0x237698['shift']());}};_0xad15c(++_0x24c507);}(_0xeb5d,0x172));var _0xdeb5=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xeb5d[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0xdeb5('0x0'));var logger=require(_0xdeb5('0x1'))(_0xdeb5('0x2'));var moment=require(_0xdeb5('0x3'));var BPromise=require(_0xdeb5('0x4'));var rp=require(_0xdeb5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdeb5('0x6'));var config=require('../../config/environment');var attributes=require(_0xdeb5('0x7'));module[_0xdeb5('0x8')]=function(_0x1e4063,_0x1517e0){return _0x1e4063[_0xdeb5('0x9')]('SquareOdbc',attributes,{'tableName':_0xdeb5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 40dabd9..dab147e 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 _0x6dcb=['ShowSquareOdbc','SquareOdbc','options','raw','where','attributes','include','map','model','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','result'];(function(_0x7c0074,_0x1ffdcf){var _0x13e95b=function(_0x521212){while(--_0x521212){_0x7c0074['push'](_0x7c0074['shift']());}};_0x13e95b(++_0x1ffdcf);}(_0x6dcb,0x1a2));var _0xb6dc=function(_0x1e8bd7,_0x286e49){_0x1e8bd7=_0x1e8bd7-0x0;var _0x75d2c2=_0x6dcb[_0x1e8bd7];return _0x75d2c2;};'use strict';var _=require(_0xb6dc('0x0'));var util=require(_0xb6dc('0x1'));var moment=require(_0xb6dc('0x2'));var BPromise=require(_0xb6dc('0x3'));var rs=require(_0xb6dc('0x4'));var fs=require('fs');var Redis=require(_0xb6dc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb6dc('0x6'));var logger=require(_0xb6dc('0x7'))(_0xb6dc('0x8'));var config=require(_0xb6dc('0x9'));var jayson=require(_0xb6dc('0xa'));var client=jayson[_0xb6dc('0xb')][_0xb6dc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b590c,_0xd7455c,_0xe08bfe){return new BPromise(function(_0x914036,_0x4baf78){return client[_0xb6dc('0xd')](_0x4b590c,_0xe08bfe)[_0xb6dc('0xe')](function(_0x47c634){logger[_0xb6dc('0xf')]('SquareOdbc,\x20%s,\x20%s',_0xd7455c,'request\x20sent');logger[_0xb6dc('0x10')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0xd7455c,_0xb6dc('0x11'),JSON[_0xb6dc('0x12')](_0x47c634));if(_0x47c634[_0xb6dc('0x13')]){if(_0x47c634[_0xb6dc('0x13')][_0xb6dc('0x14')]===0x1f4){logger[_0xb6dc('0x13')](_0xb6dc('0x15'),_0xd7455c,_0x47c634[_0xb6dc('0x13')][_0xb6dc('0x16')]);return _0x4baf78(_0x47c634[_0xb6dc('0x13')][_0xb6dc('0x16')]);}logger[_0xb6dc('0x13')](_0xb6dc('0x15'),_0xd7455c,_0x47c634[_0xb6dc('0x13')][_0xb6dc('0x16')]);return _0x914036(_0x47c634['error'][_0xb6dc('0x16')]);}else{logger[_0xb6dc('0xf')]('SquareOdbc,\x20%s,\x20%s',_0xd7455c,_0xb6dc('0x11'));_0x914036(_0x47c634[_0xb6dc('0x17')][_0xb6dc('0x16')]);}})['catch'](function(_0x9d4a41){logger[_0xb6dc('0x13')](_0xb6dc('0x15'),_0xd7455c,_0x9d4a41);_0x4baf78(_0x9d4a41);});});}exports[_0xb6dc('0x18')]=function(_0x34fd1d){var _0x49f619=this;return new Promise(function(_0x415eb6,_0x467c36){return db[_0xb6dc('0x19')]['find']({'raw':_0x34fd1d[_0xb6dc('0x1a')]?_0x34fd1d[_0xb6dc('0x1a')][_0xb6dc('0x1b')]===undefined?!![]:![]:!![],'where':_0x34fd1d['options']?_0x34fd1d['options'][_0xb6dc('0x1c')]||null:null,'attributes':_0x34fd1d[_0xb6dc('0x1a')]?_0x34fd1d['options'][_0xb6dc('0x1d')]||null:null,'include':_0x34fd1d['options']?_0x34fd1d[_0xb6dc('0x1a')][_0xb6dc('0x1e')]?_['map'](_0x34fd1d[_0xb6dc('0x1a')][_0xb6dc('0x1e')],function(_0x25b4ee){return{'model':db[_0x25b4ee['model']],'as':_0x25b4ee['as'],'attributes':_0x25b4ee[_0xb6dc('0x1d')],'include':_0x25b4ee[_0xb6dc('0x1e')]?_[_0xb6dc('0x1f')](_0x25b4ee[_0xb6dc('0x1e')],function(_0x1d3451){return{'model':db[_0x1d3451['model']],'as':_0x1d3451['as'],'attributes':_0x1d3451[_0xb6dc('0x1d')],'include':_0x1d3451[_0xb6dc('0x1e')]?_[_0xb6dc('0x1f')](_0x1d3451[_0xb6dc('0x1e')],function(_0x2a42bb){return{'model':db[_0x2a42bb[_0xb6dc('0x20')]],'as':_0x2a42bb['as'],'attributes':_0x2a42bb['attributes']};}):[]};}):[]};}):[]:[]})[_0xb6dc('0xe')](function(_0x29ea3e){logger[_0xb6dc('0xf')]('ShowSquareOdbc',_0x34fd1d);logger[_0xb6dc('0x10')](_0xb6dc('0x18'),_0x34fd1d,JSON[_0xb6dc('0x12')](_0x29ea3e));_0x415eb6(_0x29ea3e);})[_0xb6dc('0x21')](function(_0x4df35c){logger[_0xb6dc('0x13')](_0xb6dc('0x18'),_0x4df35c[_0xb6dc('0x16')],_0x34fd1d);_0x467c36(_0x49f619['error'](0x1f4,_0x4df35c[_0xb6dc('0x16')]));});});}; \ No newline at end of file +var _0xb712=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','SquareOdbc,\x20%s,\x20%s','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','map','model','include','stringify','lodash','util','../../config/utils'];(function(_0xbe31a4,_0x11ba89){var _0x15ec28=function(_0x124633){while(--_0x124633){_0xbe31a4['push'](_0xbe31a4['shift']());}};_0x15ec28(++_0x11ba89);}(_0xb712,0x93));var _0x2b71=function(_0x35ccb5,_0x4af907){_0x35ccb5=_0x35ccb5-0x0;var _0x28d0d8=_0xb712[_0x35ccb5];return _0x28d0d8;};'use strict';var _=require(_0x2b71('0x0'));var util=require(_0x2b71('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2b71('0x2'));var logger=require(_0x2b71('0x3'))(_0x2b71('0x4'));var config=require(_0x2b71('0x5'));var jayson=require(_0x2b71('0x6'));var client=jayson[_0x2b71('0x7')][_0x2b71('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36dd18,_0x4c4045,_0x6869ff){return new BPromise(function(_0x175488,_0x1f8cea){return client['request'](_0x36dd18,_0x6869ff)[_0x2b71('0x9')](function(_0x2ac319){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x4c4045,_0x2b71('0xa'));logger[_0x2b71('0xb')](_0x2b71('0xc'),_0x4c4045,_0x2b71('0xa'),JSON['stringify'](_0x2ac319));if(_0x2ac319[_0x2b71('0xd')]){if(_0x2ac319['error'][_0x2b71('0xe')]===0x1f4){logger[_0x2b71('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4c4045,_0x2ac319[_0x2b71('0xd')]['message']);return _0x1f8cea(_0x2ac319[_0x2b71('0xd')]['message']);}logger[_0x2b71('0xd')](_0x2b71('0xf'),_0x4c4045,_0x2ac319[_0x2b71('0xd')]['message']);return _0x175488(_0x2ac319[_0x2b71('0xd')][_0x2b71('0x10')]);}else{logger[_0x2b71('0x11')](_0x2b71('0xf'),_0x4c4045,'request\x20sent');_0x175488(_0x2ac319[_0x2b71('0x12')]['message']);}})[_0x2b71('0x13')](function(_0x4b884d){logger[_0x2b71('0xd')](_0x2b71('0xf'),_0x4c4045,_0x4b884d);_0x1f8cea(_0x4b884d);});});}exports[_0x2b71('0x14')]=function(_0x14aff7){var _0x5df6e4=this;return new Promise(function(_0x30413c,_0x10159c){return db[_0x2b71('0x15')][_0x2b71('0x16')]({'raw':_0x14aff7['options']?_0x14aff7['options']['raw']===undefined?!![]:![]:!![],'where':_0x14aff7[_0x2b71('0x17')]?_0x14aff7['options'][_0x2b71('0x18')]||null:null,'attributes':_0x14aff7[_0x2b71('0x17')]?_0x14aff7[_0x2b71('0x17')][_0x2b71('0x19')]||null:null,'include':_0x14aff7['options']?_0x14aff7[_0x2b71('0x17')]['include']?_[_0x2b71('0x1a')](_0x14aff7[_0x2b71('0x17')]['include'],function(_0xec504){return{'model':db[_0xec504[_0x2b71('0x1b')]],'as':_0xec504['as'],'attributes':_0xec504[_0x2b71('0x19')],'include':_0xec504[_0x2b71('0x1c')]?_[_0x2b71('0x1a')](_0xec504[_0x2b71('0x1c')],function(_0x5bbe79){return{'model':db[_0x5bbe79[_0x2b71('0x1b')]],'as':_0x5bbe79['as'],'attributes':_0x5bbe79[_0x2b71('0x19')],'include':_0x5bbe79[_0x2b71('0x1c')]?_[_0x2b71('0x1a')](_0x5bbe79['include'],function(_0x53c039){return{'model':db[_0x53c039['model']],'as':_0x53c039['as'],'attributes':_0x53c039[_0x2b71('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2b71('0x9')](function(_0x1570f7){logger['info']('ShowSquareOdbc',_0x14aff7);logger[_0x2b71('0xb')]('ShowSquareOdbc',_0x14aff7,JSON[_0x2b71('0x1d')](_0x1570f7));_0x30413c(_0x1570f7);})['catch'](function(_0x1c852b){logger[_0x2b71('0xd')]('ShowSquareOdbc',_0x1c852b[_0x2b71('0x10')],_0x14aff7);_0x10159c(_0x5df6e4['error'](0x1f4,_0x1c852b['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index c53105b..1bc6953 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 _0x9001=['post','create','put','delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','isAuthenticated','/:id','show'];(function(_0x12b9b7,_0x21c498){var _0x1cc235=function(_0x4db4aa){while(--_0x4db4aa){_0x12b9b7['push'](_0x12b9b7['shift']());}};_0x1cc235(++_0x21c498);}(_0x9001,0xa9));var _0x1900=function(_0x374f04,_0x41cff5){_0x374f04=_0x374f04-0x0;var _0xef9417=_0x9001[_0x374f04];return _0xef9417;};'use strict';var multer=require(_0x1900('0x0'));var util=require(_0x1900('0x1'));var path=require(_0x1900('0x2'));var timeout=require(_0x1900('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1900('0x4'));var auth=require(_0x1900('0x5'));var interaction=require(_0x1900('0x6'));var config=require('../../config/environment');var controller=require(_0x1900('0x7'));router['get']('/',auth[_0x1900('0x8')](),controller['index']);router['get'](_0x1900('0x9'),auth[_0x1900('0x8')](),controller[_0x1900('0xa')]);router[_0x1900('0xb')]('/',auth[_0x1900('0x8')](),controller[_0x1900('0xc')]);router[_0x1900('0xd')](_0x1900('0x9'),auth[_0x1900('0x8')](),controller['update']);router[_0x1900('0xe')](_0x1900('0x9'),auth[_0x1900('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xadaf=['post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','/:id','show'];(function(_0x2dd20b,_0x47cc68){var _0x39ebee=function(_0x14e48d){while(--_0x14e48d){_0x2dd20b['push'](_0x2dd20b['shift']());}};_0x39ebee(++_0x47cc68);}(_0xadaf,0xb9));var _0xfada=function(_0x352100,_0x59802a){_0x352100=_0x352100-0x0;var _0xaf156=_0xadaf[_0x352100];return _0xaf156;};'use strict';var multer=require(_0xfada('0x0'));var util=require(_0xfada('0x1'));var path=require(_0xfada('0x2'));var timeout=require(_0xfada('0x3'));var express=require(_0xfada('0x4'));var router=express[_0xfada('0x5')]();var fs_extra=require(_0xfada('0x6'));var auth=require(_0xfada('0x7'));var interaction=require(_0xfada('0x8'));var config=require(_0xfada('0x9'));var controller=require(_0xfada('0xa'));router['get']('/',auth[_0xfada('0xb')](),controller[_0xfada('0xc')]);router['get'](_0xfada('0xd'),auth[_0xfada('0xb')](),controller[_0xfada('0xe')]);router[_0xfada('0xf')]('/',auth[_0xfada('0xb')](),controller[_0xfada('0x10')]);router[_0xfada('0x11')](_0xfada('0xd'),auth[_0xfada('0xb')](),controller['update']);router[_0xfada('0x12')](_0xfada('0xd'),auth[_0xfada('0xb')](),controller['destroy']);module[_0xfada('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index a2e6728..ad82ce7 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 _0x6d6f=['production','DATE','sequelize','exports','STRING','TEXT','long','getDataValue','preproduction','toString'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0x6d6f,0xb6));var _0xf6d6=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0x6d6f[_0x3c59fc];return _0x2b78d4;};'use strict';var Sequelize=require(_0xf6d6('0x0'));module[_0xf6d6('0x1')]={'name':{'type':Sequelize[_0xf6d6('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xf6d6('0x2')]},'notes':{'type':Sequelize[_0xf6d6('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0xf6d6('0x4')),'get':function(){if(this[_0xf6d6('0x5')]('preproduction')){return this[_0xf6d6('0x5')](_0xf6d6('0x6'))[_0xf6d6('0x7')]('utf8');}}},'production':{'type':Sequelize['BLOB'](_0xf6d6('0x4')),'get':function(){if(this[_0xf6d6('0x5')](_0xf6d6('0x8'))){return this[_0xf6d6('0x5')](_0xf6d6('0x8'))[_0xf6d6('0x7')]('utf8');}}},'savedAt':{'type':Sequelize[_0xf6d6('0x9')]},'publishedAt':{'type':Sequelize[_0xf6d6('0x9')]}}; \ No newline at end of file +var _0x3116=['toString','utf8','BLOB','production','DATE','sequelize','exports','STRING','name','TEXT','long','getDataValue','preproduction'];(function(_0x31bcb2,_0x23cc0e){var _0x3f150c=function(_0x119f71){while(--_0x119f71){_0x31bcb2['push'](_0x31bcb2['shift']());}};_0x3f150c(++_0x23cc0e);}(_0x3116,0x17e));var _0x6311=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x3116[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0x6311('0x0'));module[_0x6311('0x1')]={'name':{'type':Sequelize[_0x6311('0x2')],'unique':_0x6311('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6311('0x2')]},'notes':{'type':Sequelize[_0x6311('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x6311('0x5')),'get':function(){if(this[_0x6311('0x6')](_0x6311('0x7'))){return this[_0x6311('0x6')]('preproduction')[_0x6311('0x8')](_0x6311('0x9'));}}},'production':{'type':Sequelize[_0x6311('0xa')](_0x6311('0x5')),'get':function(){if(this[_0x6311('0x6')](_0x6311('0xb'))){return this[_0x6311('0x6')](_0x6311('0xb'))[_0x6311('0x8')](_0x6311('0x9'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x6311('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 8693aab..efab756 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 _0x5452=['body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','agi','production','params','lodash','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','SquareProjects','UserProfileResource','publish','stringify','end','sendStatus','error','name','send','index','SquareProject','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','intersection','options','find','create'];(function(_0x15a346,_0x46d825){var _0x275a0f=function(_0x3df115){while(--_0x3df115){_0x15a346['push'](_0x15a346['shift']());}};_0x275a0f(++_0x46d825);}(_0x5452,0x12c));var _0x2545=function(_0x3d4fe2,_0x16e5ae){_0x3d4fe2=_0x3d4fe2-0x0;var _0x594b95=_0x5452[_0x3d4fe2];return _0x594b95;};'use strict';var _=require(_0x2545('0x0'));var Redis=require(_0x2545('0x1'));var qs=require(_0x2545('0x2'));var logger=require('../../config/logger')(_0x2545('0x3'));var config=require('../../config/environment');var db=require(_0x2545('0x4'))['db'];config[_0x2545('0x5')]=_[_0x2545('0x6')](config[_0x2545('0x5')],{'host':_0x2545('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2545('0x5')]));require(_0x2545('0x8'))[_0x2545('0x9')](socket);function respondWithResult(_0x445966,_0x285c72){_0x285c72=_0x285c72||0xc8;return function(_0x18e946){if(_0x18e946){return _0x445966[_0x2545('0xa')](_0x285c72)[_0x2545('0xb')](_0x18e946);}};}function respondWithFilteredResult(_0x34199a,_0x294b02){return function(_0x561e9d){if(_0x561e9d){var _0x45eb28=typeof _0x294b02[_0x2545('0xc')]===_0x2545('0xd')&&typeof _0x294b02[_0x2545('0xe')]===_0x2545('0xd');var _0x517ec6=_0x561e9d[_0x2545('0xf')];var _0x2f5c22=_0x45eb28?0x0:_0x294b02[_0x2545('0xc')];var _0x200061=_0x45eb28?_0x561e9d['count']:_0x294b02[_0x2545('0xc')]+_0x294b02[_0x2545('0xe')];var _0x2c4fe3;if(_0x200061>=_0x517ec6){_0x200061=_0x517ec6;_0x2c4fe3=0xc8;}else{_0x2c4fe3=0xce;}_0x34199a[_0x2545('0xa')](_0x2c4fe3);return _0x34199a[_0x2545('0x10')](_0x2545('0x11'),_0x2f5c22+'-'+_0x200061+'/'+_0x517ec6)[_0x2545('0xb')](_0x561e9d);}return null;};}function saveUpdates(_0x91f9ca){return function(_0x194c63){if(_0x194c63){return _0x194c63[_0x2545('0x12')](_0x91f9ca)[_0x2545('0x13')](function(_0x131f3a){return _0x131f3a;});}return null;};}function removeEntity(_0x507513){return function(_0x449b08){if(_0x449b08){return _0x449b08[_0x2545('0x14')]()['then'](function(){var _0x1af9a5=_0x449b08['get']({'plain':!![]});var _0x5bad77=_0x2545('0x15');return db[_0x2545('0x16')][_0x2545('0x14')]({'where':{'type':_0x5bad77,'resourceId':_0x1af9a5['id']}})[_0x2545('0x13')](function(){return _0x449b08;});})['then'](function(){var _0x2e3566=new Redis(config[_0x2545('0x5')]);_0x2e3566[_0x2545('0x17')]('agi',JSON[_0x2545('0x18')]({'id':_0x449b08['id'],'deleted':!![]}));})[_0x2545('0x13')](function(){_0x507513['status'](0xcc)[_0x2545('0x19')]();});}};}function handleEntityNotFound(_0x1939d1){return function(_0x1d216e){if(!_0x1d216e){_0x1939d1[_0x2545('0x1a')](0x194);}return _0x1d216e;};}function handleError(_0x244f59,_0x1a564e){_0x1a564e=_0x1a564e||0x1f4;return function(_0x15ed50){logger[_0x2545('0x1b')](_0x15ed50['stack']);if(_0x15ed50[_0x2545('0x1c')]){delete _0x15ed50[_0x2545('0x1c')];}_0x244f59[_0x2545('0xa')](_0x1a564e)[_0x2545('0x1d')](_0x15ed50);};}exports[_0x2545('0x1e')]=function(_0x5327a5,_0x2d9e1b){var _0x3e78a3={},_0x119a02={},_0x5cd2c8={'count':0x0,'rows':[]};var _0x152fe8=_['map'](db[_0x2545('0x1f')][_0x2545('0x20')],function(_0x523f3a){return{'name':_0x523f3a[_0x2545('0x21')],'type':_0x523f3a[_0x2545('0x22')]['key']};});_0x119a02[_0x2545('0x23')]=_[_0x2545('0x24')](_0x152fe8,_0x2545('0x1c'));_0x119a02[_0x2545('0x25')]=_[_0x2545('0x26')](_0x5327a5[_0x2545('0x25')]);_0x119a02[_0x2545('0x27')]=_['intersection'](_0x119a02['model'],_0x119a02[_0x2545('0x25')]);_0x3e78a3[_0x2545('0x28')]=_['intersection'](_0x119a02[_0x2545('0x23')],qs[_0x2545('0x29')](_0x5327a5[_0x2545('0x25')]['fields']));_0x3e78a3['attributes']=_0x3e78a3[_0x2545('0x28')][_0x2545('0x2a')]?_0x3e78a3[_0x2545('0x28')]:_0x119a02['model'];if(!_0x5327a5[_0x2545('0x25')][_0x2545('0x2b')](_0x2545('0x2c'))){_0x3e78a3['limit']=qs[_0x2545('0xe')](_0x5327a5[_0x2545('0x25')]['limit']);_0x3e78a3['offset']=qs[_0x2545('0xc')](_0x5327a5[_0x2545('0x25')][_0x2545('0xc')]);}_0x3e78a3[_0x2545('0x2d')]=qs[_0x2545('0x2e')](_0x5327a5[_0x2545('0x25')][_0x2545('0x2e')]);_0x3e78a3[_0x2545('0x2f')]=qs[_0x2545('0x27')](_[_0x2545('0x30')](_0x5327a5[_0x2545('0x25')],_0x119a02[_0x2545('0x27')]),_0x152fe8);if(_0x5327a5[_0x2545('0x25')][_0x2545('0x31')]){_0x3e78a3['where']=_[_0x2545('0x32')](_0x3e78a3[_0x2545('0x2f')],{'$or':_[_0x2545('0x24')](_0x152fe8,function(_0xfc177e){if(_0xfc177e['type']!==_0x2545('0x33')){var _0x6d3bd9={};_0x6d3bd9[_0xfc177e[_0x2545('0x1c')]]={'$like':'%'+_0x5327a5[_0x2545('0x25')][_0x2545('0x31')]+'%'};return _0x6d3bd9;}})});}_0x3e78a3=_[_0x2545('0x32')]({},_0x3e78a3,_0x5327a5['options']);var _0x29ac23={'where':_0x3e78a3[_0x2545('0x2f')]};return db[_0x2545('0x1f')]['count'](_0x29ac23)['then'](function(_0xa65924){_0x5cd2c8[_0x2545('0xf')]=_0xa65924;if(_0x5327a5[_0x2545('0x25')]['includeAll']){_0x3e78a3[_0x2545('0x34')]=[{'all':!![]}];}return db[_0x2545('0x1f')]['findAll'](_0x3e78a3);})['then'](function(_0x1157d7){_0x5cd2c8[_0x2545('0x35')]=_0x1157d7;return _0x5cd2c8;})[_0x2545('0x13')](respondWithFilteredResult(_0x2d9e1b,_0x3e78a3))[_0x2545('0x36')](handleError(_0x2d9e1b,null));};exports[_0x2545('0x37')]=function(_0x57da19,_0x1f6255){var _0x786cea={'raw':![],'where':{'id':_0x57da19['params']['id']}},_0x1eb6ca={};_0x1eb6ca[_0x2545('0x23')]=_[_0x2545('0x26')](db['SquareProject']['rawAttributes']);_0x1eb6ca[_0x2545('0x25')]=_[_0x2545('0x26')](_0x57da19[_0x2545('0x25')]);_0x1eb6ca[_0x2545('0x27')]=_[_0x2545('0x38')](_0x1eb6ca[_0x2545('0x23')],_0x1eb6ca[_0x2545('0x25')]);_0x786cea['attributes']=_[_0x2545('0x38')](_0x1eb6ca[_0x2545('0x23')],qs[_0x2545('0x29')](_0x57da19[_0x2545('0x25')][_0x2545('0x29')]));_0x786cea['attributes']=_0x786cea[_0x2545('0x28')][_0x2545('0x2a')]?_0x786cea['attributes']:_0x1eb6ca[_0x2545('0x23')];if(_0x57da19['query']['includeAll']){_0x786cea['include']=[{'all':!![]}];}_0x786cea=_[_0x2545('0x32')]({},_0x786cea,_0x57da19[_0x2545('0x39')]);return db['SquareProject'][_0x2545('0x3a')](_0x786cea)[_0x2545('0x13')](handleEntityNotFound(_0x1f6255,null))[_0x2545('0x13')](respondWithResult(_0x1f6255,null))[_0x2545('0x36')](handleError(_0x1f6255,null));};exports[_0x2545('0x3b')]=function(_0x27b3a3,_0x5a4c0b){return db[_0x2545('0x1f')][_0x2545('0x3b')](_0x27b3a3[_0x2545('0x3c')],{})[_0x2545('0x13')](function(_0x5eb0ef){var _0x53fe07=_0x27b3a3['user']['get']({'plain':!![]});if(!_0x53fe07)throw new Error(_0x2545('0x3d'));if(_0x53fe07[_0x2545('0x3e')]===_0x2545('0x3f')){var _0xf627ff=_0x5eb0ef[_0x2545('0x40')]({'plain':!![]});var _0x171229=_0x2545('0x15');return db[_0x2545('0x41')][_0x2545('0x3a')]({'where':{'name':_0x171229,'userProfileId':_0x53fe07[_0x2545('0x42')]},'raw':!![]})[_0x2545('0x13')](function(_0x361e6d){if(_0x361e6d&&_0x361e6d[_0x2545('0x43')]===0x0){return db['UserProfileResource'][_0x2545('0x3b')]({'name':_0xf627ff[_0x2545('0x1c')],'resourceId':_0xf627ff['id'],'type':_0x361e6d[_0x2545('0x1c')],'sectionId':_0x361e6d['id']},{})[_0x2545('0x13')](function(){return _0x5eb0ef;});}else{return _0x5eb0ef;}})[_0x2545('0x36')](function(_0x432436){logger[_0x2545('0x1b')](_0x2545('0x44'),_0x432436);throw _0x432436;});}return _0x5eb0ef;})[_0x2545('0x13')](respondWithResult(_0x5a4c0b,0xc9))[_0x2545('0x36')](handleError(_0x5a4c0b,null));};exports[_0x2545('0x12')]=function(_0x454f4d,_0x39f421){if(_0x454f4d[_0x2545('0x3c')]['id']){delete _0x454f4d[_0x2545('0x3c')]['id'];}return db[_0x2545('0x1f')][_0x2545('0x3a')]({'where':{'id':_0x454f4d['params']['id']}})[_0x2545('0x13')](handleEntityNotFound(_0x39f421,null))['then'](saveUpdates(_0x454f4d['body'],null))[_0x2545('0x13')](function(_0x57030e){if(!_0x57030e)return;var _0x57a00d=_0x57030e[_0x2545('0x40')]({'plain':!![]});return _0x57a00d;})[_0x2545('0x13')](function(_0x481b5c){var _0x35087e=new Redis(config[_0x2545('0x5')]);_0x35087e[_0x2545('0x17')](_0x2545('0x45'),JSON[_0x2545('0x18')](_[_0x2545('0x30')](_0x481b5c,['id',_0x2545('0x1c'),_0x2545('0x46')])));return _0x481b5c;})[_0x2545('0x13')](respondWithResult(_0x39f421,null))[_0x2545('0x36')](handleError(_0x39f421,null));};exports[_0x2545('0x14')]=function(_0x46a0c0,_0x16801a){return db[_0x2545('0x1f')][_0x2545('0x3a')]({'where':{'id':_0x46a0c0[_0x2545('0x47')]['id']}})[_0x2545('0x13')](handleEntityNotFound(_0x16801a,null))[_0x2545('0x13')](removeEntity(_0x16801a,null))[_0x2545('0x36')](handleError(_0x16801a,null));}; \ No newline at end of file +var _0x2e15=['catch','params','keys','include','options','find','create','body','user','get','UserProfileSection','userProfileId','publish','agi','pick','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','json','offset','undefined','limit','status','set','Content-Range','update','destroy','then','SquareProjects','UserProfileResource','stringify','end','sendStatus','error','stack','name','index','map','SquareProject','rawAttributes','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','count','includeAll','findAll'];(function(_0x793a34,_0x2c1f10){var _0x3a5bf6=function(_0x4edd15){while(--_0x4edd15){_0x793a34['push'](_0x793a34['shift']());}};_0x3a5bf6(++_0x2c1f10);}(_0x2e15,0xdc));var _0x52e1=function(_0x29f31c,_0x46bbdf){_0x29f31c=_0x29f31c-0x0;var _0x3b6b8a=_0x2e15[_0x29f31c];return _0x3b6b8a;};'use strict';var _=require(_0x52e1('0x0'));var Redis=require(_0x52e1('0x1'));var qs=require(_0x52e1('0x2'));var logger=require(_0x52e1('0x3'))(_0x52e1('0x4'));var config=require('../../config/environment');var db=require(_0x52e1('0x5'))['db'];config[_0x52e1('0x6')]=_[_0x52e1('0x7')](config[_0x52e1('0x6')],{'host':_0x52e1('0x8'),'port':0x18eb});var socket=require(_0x52e1('0x9'))(new Redis(config[_0x52e1('0x6')]));require('./squareProject.socket')[_0x52e1('0xa')](socket);function respondWithResult(_0x4c79f5,_0x255a68){_0x255a68=_0x255a68||0xc8;return function(_0x52d716){if(_0x52d716){return _0x4c79f5['status'](_0x255a68)[_0x52e1('0xb')](_0x52d716);}};}function respondWithFilteredResult(_0x3add51,_0x45be9c){return function(_0x5bf1a0){if(_0x5bf1a0){var _0x526944=typeof _0x45be9c[_0x52e1('0xc')]===_0x52e1('0xd')&&typeof _0x45be9c['limit']===_0x52e1('0xd');var _0x4c9fe1=_0x5bf1a0['count'];var _0x25f005=_0x526944?0x0:_0x45be9c[_0x52e1('0xc')];var _0x1b4905=_0x526944?_0x5bf1a0['count']:_0x45be9c[_0x52e1('0xc')]+_0x45be9c[_0x52e1('0xe')];var _0x578927;if(_0x1b4905>=_0x4c9fe1){_0x1b4905=_0x4c9fe1;_0x578927=0xc8;}else{_0x578927=0xce;}_0x3add51[_0x52e1('0xf')](_0x578927);return _0x3add51[_0x52e1('0x10')](_0x52e1('0x11'),_0x25f005+'-'+_0x1b4905+'/'+_0x4c9fe1)[_0x52e1('0xb')](_0x5bf1a0);}return null;};}function saveUpdates(_0x105ecd){return function(_0x2f9ea0){if(_0x2f9ea0){return _0x2f9ea0[_0x52e1('0x12')](_0x105ecd)['then'](function(_0xac0703){return _0xac0703;});}return null;};}function removeEntity(_0xb10a76){return function(_0x1eaf6f){if(_0x1eaf6f){return _0x1eaf6f[_0x52e1('0x13')]()[_0x52e1('0x14')](function(){var _0x4f9b68=_0x1eaf6f['get']({'plain':!![]});var _0x14714f=_0x52e1('0x15');return db[_0x52e1('0x16')]['destroy']({'where':{'type':_0x14714f,'resourceId':_0x4f9b68['id']}})['then'](function(){return _0x1eaf6f;});})['then'](function(){var _0x400789=new Redis(config[_0x52e1('0x6')]);_0x400789['publish']('agi',JSON[_0x52e1('0x17')]({'id':_0x1eaf6f['id'],'deleted':!![]}));})['then'](function(){_0xb10a76['status'](0xcc)[_0x52e1('0x18')]();});}};}function handleEntityNotFound(_0x1f64c6){return function(_0x139c6b){if(!_0x139c6b){_0x1f64c6[_0x52e1('0x19')](0x194);}return _0x139c6b;};}function handleError(_0x4a1deb,_0x7c9d63){_0x7c9d63=_0x7c9d63||0x1f4;return function(_0x7501f6){logger[_0x52e1('0x1a')](_0x7501f6[_0x52e1('0x1b')]);if(_0x7501f6['name']){delete _0x7501f6[_0x52e1('0x1c')];}_0x4a1deb[_0x52e1('0xf')](_0x7c9d63)['send'](_0x7501f6);};}exports[_0x52e1('0x1d')]=function(_0x40a09f,_0x3dd744){var _0x30c3e6={},_0x308199={},_0x4da9da={'count':0x0,'rows':[]};var _0x1b444d=_[_0x52e1('0x1e')](db[_0x52e1('0x1f')][_0x52e1('0x20')],function(_0xeb1b52){return{'name':_0xeb1b52['fieldName'],'type':_0xeb1b52['type']['key']};});_0x308199[_0x52e1('0x21')]=_[_0x52e1('0x1e')](_0x1b444d,_0x52e1('0x1c'));_0x308199['query']=_['keys'](_0x40a09f['query']);_0x308199[_0x52e1('0x22')]=_[_0x52e1('0x23')](_0x308199['model'],_0x308199[_0x52e1('0x24')]);_0x30c3e6['attributes']=_[_0x52e1('0x23')](_0x308199[_0x52e1('0x21')],qs[_0x52e1('0x25')](_0x40a09f[_0x52e1('0x24')][_0x52e1('0x25')]));_0x30c3e6[_0x52e1('0x26')]=_0x30c3e6[_0x52e1('0x26')][_0x52e1('0x27')]?_0x30c3e6[_0x52e1('0x26')]:_0x308199[_0x52e1('0x21')];if(!_0x40a09f[_0x52e1('0x24')][_0x52e1('0x28')](_0x52e1('0x29'))){_0x30c3e6[_0x52e1('0xe')]=qs[_0x52e1('0xe')](_0x40a09f[_0x52e1('0x24')]['limit']);_0x30c3e6[_0x52e1('0xc')]=qs['offset'](_0x40a09f[_0x52e1('0x24')]['offset']);}_0x30c3e6[_0x52e1('0x2a')]=qs[_0x52e1('0x2b')](_0x40a09f[_0x52e1('0x24')][_0x52e1('0x2b')]);_0x30c3e6[_0x52e1('0x2c')]=qs['filters'](_['pick'](_0x40a09f[_0x52e1('0x24')],_0x308199[_0x52e1('0x22')]),_0x1b444d);if(_0x40a09f[_0x52e1('0x24')][_0x52e1('0x2d')]){_0x30c3e6[_0x52e1('0x2c')]=_[_0x52e1('0x2e')](_0x30c3e6[_0x52e1('0x2c')],{'$or':_[_0x52e1('0x1e')](_0x1b444d,function(_0x56ad65){if(_0x56ad65[_0x52e1('0x2f')]!==_0x52e1('0x30')){var _0x7b1511={};_0x7b1511[_0x56ad65[_0x52e1('0x1c')]]={'$like':'%'+_0x40a09f[_0x52e1('0x24')][_0x52e1('0x2d')]+'%'};return _0x7b1511;}})});}_0x30c3e6=_[_0x52e1('0x2e')]({},_0x30c3e6,_0x40a09f['options']);var _0x15a9ef={'where':_0x30c3e6[_0x52e1('0x2c')]};return db[_0x52e1('0x1f')][_0x52e1('0x31')](_0x15a9ef)[_0x52e1('0x14')](function(_0x5dc446){_0x4da9da[_0x52e1('0x31')]=_0x5dc446;if(_0x40a09f[_0x52e1('0x24')][_0x52e1('0x32')]){_0x30c3e6['include']=[{'all':!![]}];}return db[_0x52e1('0x1f')][_0x52e1('0x33')](_0x30c3e6);})[_0x52e1('0x14')](function(_0x341c8a){_0x4da9da['rows']=_0x341c8a;return _0x4da9da;})[_0x52e1('0x14')](respondWithFilteredResult(_0x3dd744,_0x30c3e6))[_0x52e1('0x34')](handleError(_0x3dd744,null));};exports['show']=function(_0x426248,_0x280f19){var _0x3ac4fe={'raw':![],'where':{'id':_0x426248[_0x52e1('0x35')]['id']}},_0x4f2294={};_0x4f2294['model']=_[_0x52e1('0x36')](db['SquareProject'][_0x52e1('0x20')]);_0x4f2294[_0x52e1('0x24')]=_[_0x52e1('0x36')](_0x426248[_0x52e1('0x24')]);_0x4f2294[_0x52e1('0x22')]=_[_0x52e1('0x23')](_0x4f2294[_0x52e1('0x21')],_0x4f2294[_0x52e1('0x24')]);_0x3ac4fe[_0x52e1('0x26')]=_[_0x52e1('0x23')](_0x4f2294[_0x52e1('0x21')],qs['fields'](_0x426248[_0x52e1('0x24')][_0x52e1('0x25')]));_0x3ac4fe['attributes']=_0x3ac4fe[_0x52e1('0x26')]['length']?_0x3ac4fe[_0x52e1('0x26')]:_0x4f2294[_0x52e1('0x21')];if(_0x426248[_0x52e1('0x24')][_0x52e1('0x32')]){_0x3ac4fe[_0x52e1('0x37')]=[{'all':!![]}];}_0x3ac4fe=_['merge']({},_0x3ac4fe,_0x426248[_0x52e1('0x38')]);return db[_0x52e1('0x1f')][_0x52e1('0x39')](_0x3ac4fe)[_0x52e1('0x14')](handleEntityNotFound(_0x280f19,null))[_0x52e1('0x14')](respondWithResult(_0x280f19,null))[_0x52e1('0x34')](handleError(_0x280f19,null));};exports[_0x52e1('0x3a')]=function(_0x4cec35,_0x46f050){return db[_0x52e1('0x1f')][_0x52e1('0x3a')](_0x4cec35[_0x52e1('0x3b')],{})[_0x52e1('0x14')](function(_0x1cc303){var _0x412dd1=_0x4cec35[_0x52e1('0x3c')][_0x52e1('0x3d')]({'plain':!![]});if(!_0x412dd1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x412dd1['role']===_0x52e1('0x3c')){var _0x3d0e9c=_0x1cc303[_0x52e1('0x3d')]({'plain':!![]});var _0x1932fc=_0x52e1('0x15');return db[_0x52e1('0x3e')][_0x52e1('0x39')]({'where':{'name':_0x1932fc,'userProfileId':_0x412dd1[_0x52e1('0x3f')]},'raw':!![]})['then'](function(_0x48efb8){if(_0x48efb8&&_0x48efb8['autoAssociation']===0x0){return db[_0x52e1('0x16')][_0x52e1('0x3a')]({'name':_0x3d0e9c['name'],'resourceId':_0x3d0e9c['id'],'type':_0x48efb8['name'],'sectionId':_0x48efb8['id']},{})[_0x52e1('0x14')](function(){return _0x1cc303;});}else{return _0x1cc303;}})['catch'](function(_0x591f84){logger[_0x52e1('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x591f84);throw _0x591f84;});}return _0x1cc303;})[_0x52e1('0x14')](respondWithResult(_0x46f050,0xc9))[_0x52e1('0x34')](handleError(_0x46f050,null));};exports[_0x52e1('0x12')]=function(_0x35a94c,_0x231969){if(_0x35a94c[_0x52e1('0x3b')]['id']){delete _0x35a94c[_0x52e1('0x3b')]['id'];}return db[_0x52e1('0x1f')][_0x52e1('0x39')]({'where':{'id':_0x35a94c[_0x52e1('0x35')]['id']}})[_0x52e1('0x14')](handleEntityNotFound(_0x231969,null))[_0x52e1('0x14')](saveUpdates(_0x35a94c['body'],null))[_0x52e1('0x14')](function(_0x2217f4){if(!_0x2217f4)return;var _0x4430c1=_0x2217f4[_0x52e1('0x3d')]({'plain':!![]});return _0x4430c1;})[_0x52e1('0x14')](function(_0x64df3e){var _0x20c6de=new Redis(config['redis']);_0x20c6de[_0x52e1('0x40')](_0x52e1('0x41'),JSON[_0x52e1('0x17')](_[_0x52e1('0x42')](_0x64df3e,['id',_0x52e1('0x1c'),_0x52e1('0x43')])));return _0x64df3e;})[_0x52e1('0x14')](respondWithResult(_0x231969,null))[_0x52e1('0x34')](handleError(_0x231969,null));};exports[_0x52e1('0x13')]=function(_0x4fe3fe,_0x27f5a8){return db[_0x52e1('0x1f')][_0x52e1('0x39')]({'where':{'id':_0x4fe3fe['params']['id']}})[_0x52e1('0x14')](handleEntityNotFound(_0x27f5a8,null))[_0x52e1('0x14')](removeEntity(_0x27f5a8,null))['catch'](handleError(_0x27f5a8,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 5199efe..ab95f3b 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 _0x8e66=['events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3c59fc,_0x10dbd2){var _0x2b78d4=function(_0x5f161a){while(--_0x5f161a){_0x3c59fc['push'](_0x3c59fc['shift']());}};_0x2b78d4(++_0x10dbd2);}(_0x8e66,0x16b));var _0x68e6=function(_0x107267,_0x1bcc4f){_0x107267=_0x107267-0x0;var _0x261669=_0x8e66[_0x107267];return _0x261669;};'use strict';var EventEmitter=require(_0x68e6('0x0'));var SquareProject=require(_0x68e6('0x1'))['db'][_0x68e6('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x68e6('0x3')](0x0);var events={'afterCreate':_0x68e6('0x4'),'afterUpdate':_0x68e6('0x5'),'afterDestroy':_0x68e6('0x6')};function emitEvent(_0x496e8f){return function(_0x31bdc6,_0x326b5e,_0x2d6d26){SquareProjectEvents[_0x68e6('0x7')](_0x496e8f+':'+_0x31bdc6['id'],_0x31bdc6);SquareProjectEvents[_0x68e6('0x7')](_0x496e8f,_0x31bdc6);_0x2d6d26(null);};}for(var e in events){if(events[_0x68e6('0x8')](e)){var event=events[e];SquareProject[_0x68e6('0x9')](e,emitEvent(event));}}module[_0x68e6('0xa')]=SquareProjectEvents; \ No newline at end of file +var _0x05d9=['exports','events','../../mysqldb','SquareProject','save','remove','emit','hasOwnProperty','hook'];(function(_0x180ec7,_0x1a4ed0){var _0xcb4d28=function(_0x49ddbd){while(--_0x49ddbd){_0x180ec7['push'](_0x180ec7['shift']());}};_0xcb4d28(++_0x1a4ed0);}(_0x05d9,0x145));var _0x905d=function(_0x588581,_0x27b973){_0x588581=_0x588581-0x0;var _0x506180=_0x05d9[_0x588581];return _0x506180;};'use strict';var EventEmitter=require(_0x905d('0x0'));var SquareProject=require(_0x905d('0x1'))['db'][_0x905d('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x905d('0x3'),'afterUpdate':'update','afterDestroy':_0x905d('0x4')};function emitEvent(_0x1342a9){return function(_0x238fd3,_0xffc4d2,_0x2afe40){SquareProjectEvents[_0x905d('0x5')](_0x1342a9+':'+_0x238fd3['id'],_0x238fd3);SquareProjectEvents['emit'](_0x1342a9,_0x238fd3);_0x2afe40(null);};}for(var e in events){if(events[_0x905d('0x6')](e)){var event=events[e];SquareProject[_0x905d('0x7')](e,emitEvent(event));}}module[_0x905d('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 2135978..3cca0bf 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 _0x2a5a=['preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed'];(function(_0x25dfdf,_0x542333){var _0x5220da=function(_0x53accc){while(--_0x53accc){_0x25dfdf['push'](_0x25dfdf['shift']());}};_0x5220da(++_0x542333);}(_0x2a5a,0x10f));var _0xa2a5=function(_0x197695,_0x503cd9){_0x197695=_0x197695-0x0;var _0x202419=_0x2a5a[_0x197695];return _0x202419;};'use strict';var _=require('lodash');var util=require(_0xa2a5('0x0'));var logger=require(_0xa2a5('0x1'))(_0xa2a5('0x2'));var moment=require(_0xa2a5('0x3'));var BPromise=require('bluebird');var rp=require(_0xa2a5('0x4'));var fs=require('fs');var path=require(_0xa2a5('0x5'));var rimraf=require(_0xa2a5('0x6'));var config=require(_0xa2a5('0x7'));var attributes=require(_0xa2a5('0x8'));module[_0xa2a5('0x9')]=function(_0x20f158,_0x4b7083){return _0x20f158[_0xa2a5('0xa')](_0xa2a5('0xb'),attributes,{'tableName':_0xa2a5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x451613,_0x1e9a97,_0x5c7d1){if(_0x451613[_0xa2a5('0xd')](_0xa2a5('0xe'))){_0x451613[_0xa2a5('0xf')]=moment()[_0xa2a5('0x10')](_0xa2a5('0x11'));}if(_0x451613['changed']('production')){_0x451613[_0xa2a5('0x12')]=moment()['format'](_0xa2a5('0x11'));}_0x5c7d1(null,_0x451613);}}});}; \ No newline at end of file +var _0x005f=['YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','changed','preproduction','savedAt','format'];(function(_0x57330c,_0x52aa8f){var _0x21765b=function(_0x4585a3){while(--_0x4585a3){_0x57330c['push'](_0x57330c['shift']());}};_0x21765b(++_0x52aa8f);}(_0x005f,0x1de));var _0xf005=function(_0x42b2fc,_0x1f2c2e){_0x42b2fc=_0x42b2fc-0x0;var _0x474ff4=_0x005f[_0x42b2fc];return _0x474ff4;};'use strict';var _=require(_0xf005('0x0'));var util=require(_0xf005('0x1'));var logger=require(_0xf005('0x2'))(_0xf005('0x3'));var moment=require('moment');var BPromise=require(_0xf005('0x4'));var rp=require(_0xf005('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf005('0x6'));var config=require(_0xf005('0x7'));var attributes=require(_0xf005('0x8'));module[_0xf005('0x9')]=function(_0x3f9cdc,_0x18131b){return _0x3f9cdc[_0xf005('0xa')](_0xf005('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5d27ba,_0x288828,_0x2a5b88){if(_0x5d27ba[_0xf005('0xc')](_0xf005('0xd'))){_0x5d27ba[_0xf005('0xe')]=moment()[_0xf005('0xf')](_0xf005('0x10'));}if(_0x5d27ba['changed'](_0xf005('0x11'))){_0x5d27ba[_0xf005('0x12')]=moment()['format'](_0xf005('0x10'));}_0x2a5b88(null,_0x5d27ba);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index d0a4602..51d2922 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 _0x4513=['debug','stringify','catch','error','message','ShowSquareProject','where','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','register','GetSquareProjects','SquareProject','findAll','options','raw','attributes','limit','map','include','model','then','info'];(function(_0x49967e,_0x2a4d8c){var _0x3cfd83=function(_0x13bfba){while(--_0x13bfba){_0x49967e['push'](_0x49967e['shift']());}};_0x3cfd83(++_0x2a4d8c);}(_0x4513,0x1ba));var _0x3451=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4513[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x3451('0x0'));var Redis=require(_0x3451('0x1'));var db=require(_0x3451('0x2'))['db'];var logger=require(_0x3451('0x3'))(_0x3451('0x4'));var config=require(_0x3451('0x5'));config[_0x3451('0x6')]=_[_0x3451('0x7')](config[_0x3451('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x3451('0x8'))(new Redis(config['redis']));require('./squareProject.socket')[_0x3451('0x9')](socket);exports[_0x3451('0xa')]=function(_0x582a58){var _0x4e93fc=this;return new Promise(function(_0x165bb4,_0x5e8f50){return db[_0x3451('0xb')][_0x3451('0xc')]({'raw':_0x582a58['options']?_0x582a58[_0x3451('0xd')][_0x3451('0xe')]===undefined?!![]:![]:!![],'where':_0x582a58['options']?_0x582a58[_0x3451('0xd')]['where']||null:null,'attributes':_0x582a58[_0x3451('0xd')]?_0x582a58[_0x3451('0xd')][_0x3451('0xf')]||null:null,'limit':_0x582a58[_0x3451('0xd')]?_0x582a58[_0x3451('0xd')][_0x3451('0x10')]||null:null,'include':_0x582a58[_0x3451('0xd')]?_0x582a58[_0x3451('0xd')]['include']?_[_0x3451('0x11')](_0x582a58[_0x3451('0xd')][_0x3451('0x12')],function(_0x18a00d){return{'model':db[_0x18a00d['model']],'as':_0x18a00d['as'],'attributes':_0x18a00d[_0x3451('0xf')],'include':_0x18a00d[_0x3451('0x12')]?_[_0x3451('0x11')](_0x18a00d[_0x3451('0x12')],function(_0x1c504c){return{'model':db[_0x1c504c[_0x3451('0x13')]],'as':_0x1c504c['as'],'attributes':_0x1c504c[_0x3451('0xf')],'include':_0x1c504c[_0x3451('0x12')]?_[_0x3451('0x11')](_0x1c504c[_0x3451('0x12')],function(_0x70718d){return{'model':db[_0x70718d[_0x3451('0x13')]],'as':_0x70718d['as'],'attributes':_0x70718d['attributes']};}):[]};}):[]};}):[]:[]})[_0x3451('0x14')](function(_0x30d35f){logger[_0x3451('0x15')](_0x3451('0xa'),_0x582a58);logger[_0x3451('0x16')]('GetSquareProjects',_0x582a58,JSON[_0x3451('0x17')](_0x30d35f));_0x165bb4(_0x30d35f);})[_0x3451('0x18')](function(_0x50626a){logger[_0x3451('0x19')]('GetSquareProjects',_0x50626a['message'],_0x582a58);_0x5e8f50(_0x4e93fc[_0x3451('0x19')](0x1f4,_0x50626a[_0x3451('0x1a')]));});});};exports[_0x3451('0x1b')]=function(_0x36723a){var _0x2665b0=this;return new Promise(function(_0x18fc47,_0x5512ab){return db[_0x3451('0xb')]['find']({'raw':_0x36723a['options']?_0x36723a['options'][_0x3451('0xe')]===undefined?!![]:![]:!![],'where':_0x36723a[_0x3451('0xd')]?_0x36723a['options'][_0x3451('0x1c')]||null:null,'attributes':_0x36723a[_0x3451('0xd')]?_0x36723a['options']['attributes']||null:null,'include':_0x36723a[_0x3451('0xd')]?_0x36723a[_0x3451('0xd')]['include']?_[_0x3451('0x11')](_0x36723a['options']['include'],function(_0xdadd4f){return{'model':db[_0xdadd4f['model']],'as':_0xdadd4f['as'],'attributes':_0xdadd4f[_0x3451('0xf')],'include':_0xdadd4f['include']?_[_0x3451('0x11')](_0xdadd4f[_0x3451('0x12')],function(_0x32a612){return{'model':db[_0x32a612[_0x3451('0x13')]],'as':_0x32a612['as'],'attributes':_0x32a612[_0x3451('0xf')],'include':_0x32a612[_0x3451('0x12')]?_[_0x3451('0x11')](_0x32a612['include'],function(_0x182417){return{'model':db[_0x182417[_0x3451('0x13')]],'as':_0x182417['as'],'attributes':_0x182417[_0x3451('0xf')]};}):[]};}):[]};}):[]:[]})[_0x3451('0x14')](function(_0x20ee65){logger[_0x3451('0x15')](_0x3451('0x1b'),_0x36723a);logger[_0x3451('0x16')](_0x3451('0x1b'),_0x36723a,JSON[_0x3451('0x17')](_0x20ee65));_0x18fc47(_0x20ee65);})[_0x3451('0x18')](function(_0x55dd33){logger[_0x3451('0x19')](_0x3451('0x1b'),_0x55dd33['message'],_0x36723a);_0x5512ab(_0x2665b0[_0x3451('0x19')](0x1f4,_0x55dd33[_0x3451('0x1a')]));});});}; \ No newline at end of file +var _0xf0ce=['stringify','error','GetSquareProjects','message','ShowSquareProject','SquareProject','find','catch','lodash','ioredis','../../mysqldb','../../config/logger','rpc','redis','localhost','./squareProject.socket','register','options','where','attributes','limit','include','model','map','then','info','debug'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xf0ce,0x131));var _0xef0c=function(_0x32244d,_0x316e2f){_0x32244d=_0x32244d-0x0;var _0x3c8621=_0xf0ce[_0x32244d];return _0x3c8621;};'use strict';var _=require(_0xef0c('0x0'));var Redis=require(_0xef0c('0x1'));var db=require(_0xef0c('0x2'))['db'];var logger=require(_0xef0c('0x3'))(_0xef0c('0x4'));var config=require('../../config/environment');config[_0xef0c('0x5')]=_['defaults'](config[_0xef0c('0x5')],{'host':_0xef0c('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xef0c('0x5')]));require(_0xef0c('0x7'))[_0xef0c('0x8')](socket);exports['GetSquareProjects']=function(_0x4a8b76){var _0x1cee47=this;return new Promise(function(_0x317a29,_0x47da52){return db['SquareProject']['findAll']({'raw':_0x4a8b76[_0xef0c('0x9')]?_0x4a8b76[_0xef0c('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x4a8b76[_0xef0c('0x9')]?_0x4a8b76[_0xef0c('0x9')][_0xef0c('0xa')]||null:null,'attributes':_0x4a8b76[_0xef0c('0x9')]?_0x4a8b76['options'][_0xef0c('0xb')]||null:null,'limit':_0x4a8b76[_0xef0c('0x9')]?_0x4a8b76['options'][_0xef0c('0xc')]||null:null,'include':_0x4a8b76[_0xef0c('0x9')]?_0x4a8b76[_0xef0c('0x9')][_0xef0c('0xd')]?_['map'](_0x4a8b76[_0xef0c('0x9')][_0xef0c('0xd')],function(_0x58d37c){return{'model':db[_0x58d37c[_0xef0c('0xe')]],'as':_0x58d37c['as'],'attributes':_0x58d37c[_0xef0c('0xb')],'include':_0x58d37c['include']?_[_0xef0c('0xf')](_0x58d37c[_0xef0c('0xd')],function(_0x32f132){return{'model':db[_0x32f132[_0xef0c('0xe')]],'as':_0x32f132['as'],'attributes':_0x32f132[_0xef0c('0xb')],'include':_0x32f132['include']?_[_0xef0c('0xf')](_0x32f132[_0xef0c('0xd')],function(_0x1f882e){return{'model':db[_0x1f882e[_0xef0c('0xe')]],'as':_0x1f882e['as'],'attributes':_0x1f882e[_0xef0c('0xb')]};}):[]};}):[]};}):[]:[]})[_0xef0c('0x10')](function(_0x3cafba){logger[_0xef0c('0x11')]('GetSquareProjects',_0x4a8b76);logger[_0xef0c('0x12')]('GetSquareProjects',_0x4a8b76,JSON[_0xef0c('0x13')](_0x3cafba));_0x317a29(_0x3cafba);})['catch'](function(_0x1f218f){logger[_0xef0c('0x14')](_0xef0c('0x15'),_0x1f218f[_0xef0c('0x16')],_0x4a8b76);_0x47da52(_0x1cee47[_0xef0c('0x14')](0x1f4,_0x1f218f['message']));});});};exports[_0xef0c('0x17')]=function(_0x563252){var _0x155746=this;return new Promise(function(_0x3cd13c,_0xebed20){return db[_0xef0c('0x18')][_0xef0c('0x19')]({'raw':_0x563252[_0xef0c('0x9')]?_0x563252[_0xef0c('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x563252[_0xef0c('0x9')]?_0x563252[_0xef0c('0x9')][_0xef0c('0xa')]||null:null,'attributes':_0x563252[_0xef0c('0x9')]?_0x563252[_0xef0c('0x9')][_0xef0c('0xb')]||null:null,'include':_0x563252[_0xef0c('0x9')]?_0x563252[_0xef0c('0x9')][_0xef0c('0xd')]?_['map'](_0x563252[_0xef0c('0x9')][_0xef0c('0xd')],function(_0x2657ff){return{'model':db[_0x2657ff[_0xef0c('0xe')]],'as':_0x2657ff['as'],'attributes':_0x2657ff[_0xef0c('0xb')],'include':_0x2657ff[_0xef0c('0xd')]?_[_0xef0c('0xf')](_0x2657ff[_0xef0c('0xd')],function(_0x176297){return{'model':db[_0x176297[_0xef0c('0xe')]],'as':_0x176297['as'],'attributes':_0x176297[_0xef0c('0xb')],'include':_0x176297[_0xef0c('0xd')]?_[_0xef0c('0xf')](_0x176297['include'],function(_0x54e17b){return{'model':db[_0x54e17b[_0xef0c('0xe')]],'as':_0x54e17b['as'],'attributes':_0x54e17b[_0xef0c('0xb')]};}):[]};}):[]};}):[]:[]})[_0xef0c('0x10')](function(_0x3c48b4){logger[_0xef0c('0x11')]('ShowSquareProject',_0x563252);logger[_0xef0c('0x12')](_0xef0c('0x17'),_0x563252,JSON['stringify'](_0x3c48b4));_0x3cd13c(_0x3c48b4);})[_0xef0c('0x1a')](function(_0x50b8eb){logger[_0xef0c('0x14')](_0xef0c('0x17'),_0x50b8eb[_0xef0c('0x16')],_0x563252);_0xebed20(_0x155746[_0xef0c('0x14')](0x1f4,_0x50b8eb[_0xef0c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index e7ea074..04c9f99 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 _0xb0a1=['squareProject:','./squareProject.events','save','remove','update','emit','register','length'];(function(_0x459336,_0x3a7f49){var _0x504b34=function(_0x585d1c){while(--_0x585d1c){_0x459336['push'](_0x459336['shift']());}};_0x504b34(++_0x3a7f49);}(_0xb0a1,0x179));var _0x1b0a=function(_0x24577b,_0x5531a2){_0x24577b=_0x24577b-0x0;var _0x162f71=_0xb0a1[_0x24577b];return _0x162f71;};'use strict';var SquareProjectEvents=require(_0x1b0a('0x0'));var events=[_0x1b0a('0x1'),_0x1b0a('0x2'),_0x1b0a('0x3')];function createListener(_0x496648,_0x5be0e6){return function(_0x4cb962){_0x5be0e6[_0x1b0a('0x4')](_0x496648,_0x4cb962);};}function removeListener(_0x330da4,_0x4d60a4){return function(){SquareProjectEvents['removeListener'](_0x330da4,_0x4d60a4);};}exports[_0x1b0a('0x5')]=function(_0x4c4239){for(var _0x49b06b=0x0,_0x288e9a=events[_0x1b0a('0x6')];_0x49b06b<_0x288e9a;_0x49b06b++){var _0x2fedf9=events[_0x49b06b];var _0x59cb7e=createListener(_0x1b0a('0x7')+_0x2fedf9,_0x4c4239);SquareProjectEvents['on'](_0x2fedf9,_0x59cb7e);}}; \ No newline at end of file +var _0xa71f=['removeListener','register','length','squareProject:','./squareProject.events','save','update','emit'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xa71f,0x104));var _0xfa71=function(_0x57a177,_0x269b7d){_0x57a177=_0x57a177-0x0;var _0x5903ff=_0xa71f[_0x57a177];return _0x5903ff;};'use strict';var SquareProjectEvents=require(_0xfa71('0x0'));var events=[_0xfa71('0x1'),'remove',_0xfa71('0x2')];function createListener(_0x496396,_0x20648e){return function(_0x5c8496){_0x20648e[_0xfa71('0x3')](_0x496396,_0x5c8496);};}function removeListener(_0x4780a4,_0x3038b1){return function(){SquareProjectEvents[_0xfa71('0x4')](_0x4780a4,_0x3038b1);};}exports[_0xfa71('0x5')]=function(_0x278382){for(var _0x37fc6b=0x0,_0xd050ce=events[_0xfa71('0x6')];_0x37fc6b<_0xd050ce;_0x37fc6b++){var _0xff9a6f=events[_0x37fc6b];var _0x2338e0=createListener(_0xfa71('0x7')+_0xff9a6f,_0x278382);SquareProjectEvents['on'](_0xff9a6f,_0x2338e0);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 556a7c7..08075e3 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 _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x12e2b0,_0x2b403e){var _0x12c3ba=function(_0x4ecf05){while(--_0x4ecf05){_0x12e2b0['push'](_0x12e2b0['shift']());}};_0x12c3ba(++_0x2b403e);}(_0x814b,0x1a2));var _0xb814=function(_0x2f09f7,_0x461707){_0x2f09f7=_0x2f09f7-0x0;var _0x1b266c=_0x814b[_0x2f09f7];return _0x1b266c;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file +var _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x2e09ff,_0x55a3b9){var _0x681769=function(_0x3c54f4){while(--_0x3c54f4){_0x2e09ff['push'](_0x2e09ff['shift']());}};_0x681769(++_0x55a3b9);}(_0x1261,0x144));var _0x1126=function(_0x2640fa,_0xaeaf32){_0x2640fa=_0x2640fa-0x0;var _0x5aa2cd=_0x1261[_0x2640fa];return _0x5aa2cd;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 2aefdeb..2ecc07f 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 _0xf494=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xf494,0x1c6));var _0x4f49=function(_0xe4f05b,_0x4a5910){_0xe4f05b=_0xe4f05b-0x0;var _0x70ab37=_0xf494[_0xe4f05b];return _0x70ab37;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'uniqueid':{'type':Sequelize[_0x4f49('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4f49('0x2')]},'context':{'type':Sequelize[_0x4f49('0x2')]},'extension':{'type':Sequelize[_0x4f49('0x2')]},'priority':{'type':Sequelize[_0x4f49('0x2')]},'accountcode':{'type':Sequelize[_0x4f49('0x2')]},'dnid':{'type':Sequelize[_0x4f49('0x2')]},'projectName':{'type':Sequelize[_0x4f49('0x2')]},'saveName':{'type':Sequelize[_0x4f49('0x2')]},'filename':{'type':Sequelize[_0x4f49('0x2')]},'savePath':{'type':Sequelize[_0x4f49('0x2')]},'format':{'type':Sequelize[_0x4f49('0x3')],'get':function(){var _0x5eb186='';var _0x58e9a0=this[_0x4f49('0x4')](_0x4f49('0x5'));if(_0x58e9a0){_0x5eb186=_0x58e9a0[_0x4f49('0x6')](_0x58e9a0[_0x4f49('0x7')]('.'));}return _0x5eb186;}}}; \ No newline at end of file +var _0x98a8=['exports','STRING','VIRTUAL','savePath','substring','lastIndexOf','sequelize'];(function(_0x49e77b,_0x59ced7){var _0x58b978=function(_0x572228){while(--_0x572228){_0x49e77b['push'](_0x49e77b['shift']());}};_0x58b978(++_0x59ced7);}(_0x98a8,0x12c));var _0x898a=function(_0x3b543b,_0x298643){_0x3b543b=_0x3b543b-0x0;var _0x56ffad=_0x98a8[_0x3b543b];return _0x56ffad;};'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 diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 435c1fb..d146f09 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 _0x0fb7=['fast-json-patch','request-promise','bluebird','path','sox','to-csv','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','end','stack','name','send','index','map','SquareRecording','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','download','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','existsSync','decryptFile','Sequelize','extname','unlink','SquareRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','destroy'];(function(_0x26f956,_0x4421c1){var _0x468c52=function(_0x1377ec){while(--_0x1377ec){_0x26f956['push'](_0x26f956['shift']());}};_0x468c52(++_0x4421c1);}(_0x0fb7,0xae));var _0x70fb=function(_0x3d83ac,_0x1d0135){_0x3d83ac=_0x3d83ac-0x0;var _0x299760=_0x0fb7[_0x3d83ac];return _0x299760;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x70fb('0x0'));var rp=require(_0x70fb('0x1'));var moment=require('moment');var BPromise=require(_0x70fb('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x70fb('0x3'));var sox=require(_0x70fb('0x4'));var csv=require(_0x70fb('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x70fb('0x6'));var _=require(_0x70fb('0x7'));var squel=require('squel');var crypto=require(_0x70fb('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x70fb('0x5'));var querystring=require(_0x70fb('0x9'));var Papa=require(_0x70fb('0xa'));var Redis=require(_0x70fb('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x70fb('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x70fb('0xd'));var logger=require('../../config/logger')(_0x70fb('0xe'));var utils=require(_0x70fb('0xf'));var config=require(_0x70fb('0x10'));var licenseUtil=require(_0x70fb('0x11'));var db=require(_0x70fb('0x12'))['db'];function respondWithStatusCode(_0x2ba6c1,_0x359cb3){_0x359cb3=_0x359cb3||0xcc;return function(_0x5062e2){if(_0x5062e2){return _0x2ba6c1[_0x70fb('0x13')](_0x359cb3);}return _0x2ba6c1[_0x70fb('0x14')](_0x359cb3)['end']();};}function respondWithResult(_0x4f9915,_0x4b0c6a){_0x4b0c6a=_0x4b0c6a||0xc8;return function(_0x4b80c5){if(_0x4b80c5){return _0x4f9915['status'](_0x4b0c6a)[_0x70fb('0x15')](_0x4b80c5);}};}function respondWithFilteredResult(_0x50106c,_0x20ea04){return function(_0x15b509){if(_0x15b509){var _0x404456=typeof _0x20ea04[_0x70fb('0x16')]===_0x70fb('0x17')&&typeof _0x20ea04[_0x70fb('0x18')]===_0x70fb('0x17');var _0x5a0d99=_0x15b509[_0x70fb('0x19')];var _0x5bffef=_0x404456?0x0:_0x20ea04[_0x70fb('0x16')];var _0x341a5f=_0x404456?_0x15b509[_0x70fb('0x19')]:_0x20ea04[_0x70fb('0x16')]+_0x20ea04[_0x70fb('0x18')];var _0x3f0fa3;if(_0x341a5f>=_0x5a0d99){_0x341a5f=_0x5a0d99;_0x3f0fa3=0xc8;}else{_0x3f0fa3=0xce;}_0x50106c[_0x70fb('0x14')](_0x3f0fa3);return _0x50106c['set'](_0x70fb('0x1a'),_0x5bffef+'-'+_0x341a5f+'/'+_0x5a0d99)[_0x70fb('0x15')](_0x15b509);}return null;};}function patchUpdates(_0xc77c73){return function(_0x4c9d22){try{jsonpatch['apply'](_0x4c9d22,_0xc77c73,!![]);}catch(_0x4f6f4a){return BPromise[_0x70fb('0x1b')](_0x4f6f4a);}return _0x4c9d22['save']();};}function saveUpdates(_0x4dae81,_0x5bbc17){return function(_0x295790){if(_0x295790){return _0x295790[_0x70fb('0x1c')](_0x4dae81)[_0x70fb('0x1d')](function(_0x412cd6){return _0x412cd6;});}return null;};}function removeEntity(_0x1ce399,_0x503b64){return function(_0x93d1ae){if(_0x93d1ae){return _0x93d1ae['destroy']()['then'](function(){_0x1ce399['status'](0xcc)[_0x70fb('0x1e')]();});}};}function handleEntityNotFound(_0x503df7,_0xb1cdf1){return function(_0x148482){if(!_0x148482){_0x503df7[_0x70fb('0x13')](0x194);}return _0x148482;};}function handleError(_0x28c885,_0x1cb225){_0x1cb225=_0x1cb225||0x1f4;return function(_0x52902e){logger['error'](_0x52902e[_0x70fb('0x1f')]);if(_0x52902e[_0x70fb('0x20')]){delete _0x52902e[_0x70fb('0x20')];}_0x28c885[_0x70fb('0x14')](_0x1cb225)[_0x70fb('0x21')](_0x52902e);};}exports[_0x70fb('0x22')]=function(_0x105ab9,_0xd9b41){var _0x1a7913={},_0x4b6173={},_0x3ee473={'count':0x0,'rows':[]};var _0x1acfc2=_[_0x70fb('0x23')](db[_0x70fb('0x24')]['rawAttributes'],function(_0x26c1b2){return{'name':_0x26c1b2[_0x70fb('0x25')],'type':_0x26c1b2[_0x70fb('0x26')]['key']};});_0x4b6173[_0x70fb('0x27')]=_[_0x70fb('0x23')](_0x1acfc2,_0x70fb('0x20'));_0x4b6173[_0x70fb('0x28')]=_[_0x70fb('0x29')](_0x105ab9['query']);_0x4b6173[_0x70fb('0x2a')]=_[_0x70fb('0x2b')](_0x4b6173[_0x70fb('0x27')],_0x4b6173[_0x70fb('0x28')]);_0x1a7913[_0x70fb('0x2c')]=_['intersection'](_0x4b6173[_0x70fb('0x27')],qs['fields'](_0x105ab9['query'][_0x70fb('0x2d')]));_0x1a7913['attributes']=_0x1a7913[_0x70fb('0x2c')][_0x70fb('0x2e')]?_0x1a7913[_0x70fb('0x2c')]:_0x4b6173[_0x70fb('0x27')];if(!_0x105ab9[_0x70fb('0x28')][_0x70fb('0x2f')]('nolimit')){_0x1a7913[_0x70fb('0x18')]=qs[_0x70fb('0x18')](_0x105ab9['query'][_0x70fb('0x18')]);_0x1a7913[_0x70fb('0x16')]=qs[_0x70fb('0x16')](_0x105ab9['query'][_0x70fb('0x16')]);}_0x1a7913[_0x70fb('0x30')]=qs[_0x70fb('0x31')](_0x105ab9[_0x70fb('0x28')][_0x70fb('0x31')]);_0x1a7913['where']=qs['filters'](_[_0x70fb('0x32')](_0x105ab9['query'],_0x4b6173['filters']),_0x1acfc2);if(_0x105ab9[_0x70fb('0x28')][_0x70fb('0x33')]){_0x1a7913[_0x70fb('0x34')]=_['merge'](_0x1a7913['where'],{'$or':_[_0x70fb('0x23')](_0x1acfc2,function(_0x44bd6b){if(_0x44bd6b[_0x70fb('0x26')]!=='VIRTUAL'){var _0x1e9a3c={};_0x1e9a3c[_0x44bd6b[_0x70fb('0x20')]]={'$like':'%'+_0x105ab9[_0x70fb('0x28')][_0x70fb('0x33')]+'%'};return _0x1e9a3c;}})});}_0x1a7913=_[_0x70fb('0x35')]({},_0x1a7913,_0x105ab9['options']);var _0x532061={'where':_0x1a7913['where']};return db['SquareRecording']['count'](_0x532061)[_0x70fb('0x1d')](function(_0x201e39){_0x3ee473[_0x70fb('0x19')]=_0x201e39;if(_0x105ab9[_0x70fb('0x28')][_0x70fb('0x36')]){_0x1a7913[_0x70fb('0x37')]=[{'all':!![]}];}return db[_0x70fb('0x24')][_0x70fb('0x38')](_0x1a7913);})[_0x70fb('0x1d')](function(_0x277819){_0x3ee473[_0x70fb('0x39')]=_0x277819;return _0x3ee473;})[_0x70fb('0x1d')](respondWithFilteredResult(_0xd9b41,_0x1a7913))[_0x70fb('0x3a')](handleError(_0xd9b41,null));};exports[_0x70fb('0x3b')]=function(_0x3bde92,_0x25e43e){var _0x38fcff={'raw':!![],'where':{'id':_0x3bde92['params']['id']}},_0x1d5673={};_0x1d5673['model']=_[_0x70fb('0x29')](db[_0x70fb('0x24')][_0x70fb('0x3c')]);_0x1d5673[_0x70fb('0x28')]=_[_0x70fb('0x29')](_0x3bde92['query']);_0x1d5673[_0x70fb('0x2a')]=_[_0x70fb('0x2b')](_0x1d5673[_0x70fb('0x27')],_0x1d5673[_0x70fb('0x28')]);_0x38fcff['attributes']=_[_0x70fb('0x2b')](_0x1d5673[_0x70fb('0x27')],qs[_0x70fb('0x2d')](_0x3bde92[_0x70fb('0x28')]['fields']));_0x38fcff[_0x70fb('0x2c')]=_0x38fcff['attributes']['length']?_0x38fcff[_0x70fb('0x2c')]:_0x1d5673['model'];if(_0x3bde92[_0x70fb('0x28')][_0x70fb('0x36')]){_0x38fcff[_0x70fb('0x37')]=[{'all':!![]}];}_0x38fcff=_[_0x70fb('0x35')]({},_0x38fcff,_0x3bde92['options']);return db[_0x70fb('0x24')][_0x70fb('0x3d')](_0x38fcff)[_0x70fb('0x1d')](handleEntityNotFound(_0x25e43e,null))[_0x70fb('0x1d')](respondWithResult(_0x25e43e,null))[_0x70fb('0x3a')](handleError(_0x25e43e,null));};exports[_0x70fb('0x3e')]=function(_0x2706b4,_0xece824){return db['SquareRecording'][_0x70fb('0x3e')](_0x2706b4[_0x70fb('0x3f')],{})['then'](respondWithResult(_0xece824,0xc9))[_0x70fb('0x3a')](handleError(_0xece824,null));};exports[_0x70fb('0x1c')]=function(_0x3f6825,_0x9e7b99){if(_0x3f6825[_0x70fb('0x3f')]['id']){delete _0x3f6825[_0x70fb('0x3f')]['id'];}return db[_0x70fb('0x24')]['find']({'where':{'id':_0x3f6825[_0x70fb('0x40')]['id']}})[_0x70fb('0x1d')](handleEntityNotFound(_0x9e7b99,null))[_0x70fb('0x1d')](saveUpdates(_0x3f6825[_0x70fb('0x3f')],null))[_0x70fb('0x1d')](respondWithResult(_0x9e7b99,null))[_0x70fb('0x3a')](handleError(_0x9e7b99,null));};exports[_0x70fb('0x41')]=function(_0x5ef587,_0x5bb76f,_0x3a5675){var _0x531162=require(_0x70fb('0x42'));var _0x31064b=![];var _0x263369={};if(_0x5ef587[_0x70fb('0x28')][_0x70fb('0x26')]&&_0x5ef587[_0x70fb('0x28')][_0x70fb('0x26')]===_0x70fb('0x43')){_0x263369[_0x70fb('0x43')]=_0x5ef587[_0x70fb('0x40')]['id'];}else{_0x263369['id']=_0x5ef587[_0x70fb('0x40')]['id'];}return db[_0x70fb('0x24')]['find']({'where':_0x263369,'attributes':['id','savePath',_0x70fb('0x44')],'raw':!![]})[_0x70fb('0x1d')](handleEntityNotFound(_0x5bb76f,null))['then'](function(_0x4bac39){if(_0x4bac39){var _0x480194=_0x4bac39[_0x70fb('0x45')];var _0x426659=util[_0x70fb('0x46')](_0x70fb('0x47'),_0x480194);if(fs[_0x70fb('0x48')](_0x426659)){_0x31064b=!![];return _0x531162[_0x70fb('0x49')](_0x426659,_0x480194,config['secrets']['recording'])[_0x70fb('0x1d')](function(){return _0x4bac39;});}return _0x4bac39;}})[_0x70fb('0x1d')](function(_0x28d196){if(_0x28d196){var _0x1d1bb2=_0x28d196[_0x70fb('0x45')];if(!fs[_0x70fb('0x48')](_0x1d1bb2)){throw new db[(_0x70fb('0x4a'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x28d196[_0x70fb('0x44')]){return _0x5bb76f[_0x70fb('0x41')](_0x1d1bb2,_0x28d196['filename']+path[_0x70fb('0x4b')](_0x1d1bb2),function(){if(_0x31064b){fs[_0x70fb('0x4c')](_0x1d1bb2);}});}else{return _0x5bb76f['download'](_0x1d1bb2,function(_0x1d4637){if(_0x31064b){fs[_0x70fb('0x4c')](_0x1d1bb2);}});}}})[_0x70fb('0x3a')](function(_0x3cfffe){if(_0x3cfffe['message']===_0x70fb('0x4d')){_0x5bb76f[_0x70fb('0x14')](0x194)[_0x70fb('0x21')](_0x70fb('0x4e'));}else{return handleError(_0x5bb76f,null);}});};exports['destroy']=function(_0x466e43,_0x531a42){return db[_0x70fb('0x24')][_0x70fb('0x3d')]({'where':{'id':_0x466e43['params']['id']}})['then'](function(_0x5c9a89){if(_[_0x70fb('0x4f')](_0x5c9a89)){throw new ReferenceError(_0x70fb('0x50'));}return _0x5c9a89;})[_0x70fb('0x1d')](function(_0x5be7f3){var _0x31b4bd=_0x5be7f3[_0x70fb('0x45')];logger[_0x70fb('0x51')](_0x70fb('0x52'),_0x31b4bd);if(!_[_0x70fb('0x4f')](_0x5be7f3['savePath'])&&fs[_0x70fb('0x48')](_0x31b4bd)){logger['info'](_0x70fb('0x53')+_0x31b4bd+_0x70fb('0x54'));fs[_0x70fb('0x55')](_0x31b4bd);}_0x31b4bd=_0x31b4bd+'.cypher';if(!_[_0x70fb('0x4f')](_0x5be7f3[_0x70fb('0x45')])&&fs[_0x70fb('0x48')](_0x31b4bd)){logger[_0x70fb('0x51')]('File:\x20\x22'+_0x31b4bd+_0x70fb('0x54'));fs['unlinkSync'](_0x31b4bd);}return _0x5be7f3;})[_0x70fb('0x1d')](function(_0x134583){if(!_0x134583)throw new InternalError();return _0x134583[_0x70fb('0x56')]();})[_0x70fb('0x1d')](function(){_0x531a42[_0x70fb('0x14')](0xcc)[_0x70fb('0x1e')]();})['catch'](handleError(_0x531a42,null));}; \ No newline at end of file +var _0x5875=['moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','SquareRecording','rawAttributes','fieldName','type','key','map','query','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','keys','length','options','find','create','body','catch','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','extname','unlink','SquareRecording\x20not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','rimraf','fast-json-patch','request-promise'];(function(_0x25fded,_0x34216e){var _0x269156=function(_0x190fe0){while(--_0x190fe0){_0x25fded['push'](_0x25fded['shift']());}};_0x269156(++_0x34216e);}(_0x5875,0x1e2));var _0x5587=function(_0x341cab,_0x4c58b0){_0x341cab=_0x341cab-0x0;var _0x3d43b7=_0x5875[_0x341cab];return _0x3d43b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5587('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5587('0x1'));var rp=require(_0x5587('0x2'));var moment=require(_0x5587('0x3'));var BPromise=require(_0x5587('0x4'));var Mustache=require(_0x5587('0x5'));var util=require(_0x5587('0x6'));var path=require(_0x5587('0x7'));var sox=require(_0x5587('0x8'));var csv=require(_0x5587('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5587('0xa'));var _=require('lodash');var squel=require(_0x5587('0xb'));var crypto=require(_0x5587('0xc'));var jsforce=require(_0x5587('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5587('0x9'));var querystring=require(_0x5587('0xe'));var Papa=require('papaparse');var Redis=require(_0x5587('0xf'));var authService=require(_0x5587('0x10'));var qs=require(_0x5587('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5587('0x12'))(_0x5587('0x13'));var utils=require(_0x5587('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5587('0x15'));var db=require(_0x5587('0x16'))['db'];function respondWithStatusCode(_0x21b0b9,_0x1b8846){_0x1b8846=_0x1b8846||0xcc;return function(_0x25533d){if(_0x25533d){return _0x21b0b9[_0x5587('0x17')](_0x1b8846);}return _0x21b0b9[_0x5587('0x18')](_0x1b8846)['end']();};}function respondWithResult(_0xe90128,_0x4a1d15){_0x4a1d15=_0x4a1d15||0xc8;return function(_0x2bddf4){if(_0x2bddf4){return _0xe90128[_0x5587('0x18')](_0x4a1d15)[_0x5587('0x19')](_0x2bddf4);}};}function respondWithFilteredResult(_0x1daacc,_0x3e594e){return function(_0x227010){if(_0x227010){var _0x295bf8=typeof _0x3e594e[_0x5587('0x1a')]===_0x5587('0x1b')&&typeof _0x3e594e[_0x5587('0x1c')]===_0x5587('0x1b');var _0x181528=_0x227010['count'];var _0x3c6320=_0x295bf8?0x0:_0x3e594e['offset'];var _0x2bf25c=_0x295bf8?_0x227010[_0x5587('0x1d')]:_0x3e594e['offset']+_0x3e594e['limit'];var _0x2f96ed;if(_0x2bf25c>=_0x181528){_0x2bf25c=_0x181528;_0x2f96ed=0xc8;}else{_0x2f96ed=0xce;}_0x1daacc['status'](_0x2f96ed);return _0x1daacc[_0x5587('0x1e')](_0x5587('0x1f'),_0x3c6320+'-'+_0x2bf25c+'/'+_0x181528)[_0x5587('0x19')](_0x227010);}return null;};}function patchUpdates(_0x30c9db){return function(_0x57cec2){try{jsonpatch[_0x5587('0x20')](_0x57cec2,_0x30c9db,!![]);}catch(_0xe788cc){return BPromise[_0x5587('0x21')](_0xe788cc);}return _0x57cec2['save']();};}function saveUpdates(_0xfc2eb2,_0x45dd61){return function(_0x469806){if(_0x469806){return _0x469806[_0x5587('0x22')](_0xfc2eb2)[_0x5587('0x23')](function(_0x262f69){return _0x262f69;});}return null;};}function removeEntity(_0x249491,_0xee0e5b){return function(_0x436235){if(_0x436235){return _0x436235['destroy']()[_0x5587('0x23')](function(){_0x249491[_0x5587('0x18')](0xcc)[_0x5587('0x24')]();});}};}function handleEntityNotFound(_0x4b453b,_0x3e4b82){return function(_0x277469){if(!_0x277469){_0x4b453b['sendStatus'](0x194);}return _0x277469;};}function handleError(_0x5622b0,_0x20a134){_0x20a134=_0x20a134||0x1f4;return function(_0x1a9236){logger[_0x5587('0x25')](_0x1a9236[_0x5587('0x26')]);if(_0x1a9236[_0x5587('0x27')]){delete _0x1a9236['name'];}_0x5622b0[_0x5587('0x18')](_0x20a134)[_0x5587('0x28')](_0x1a9236);};}exports['index']=function(_0xdd3bca,_0x28498a){var _0x36fe0e={},_0x341966={},_0x44a4fd={'count':0x0,'rows':[]};var _0x4ebcdf=_['map'](db[_0x5587('0x29')][_0x5587('0x2a')],function(_0x206448){return{'name':_0x206448[_0x5587('0x2b')],'type':_0x206448[_0x5587('0x2c')][_0x5587('0x2d')]};});_0x341966['model']=_[_0x5587('0x2e')](_0x4ebcdf,_0x5587('0x27'));_0x341966[_0x5587('0x2f')]=_['keys'](_0xdd3bca[_0x5587('0x2f')]);_0x341966[_0x5587('0x30')]=_['intersection'](_0x341966['model'],_0x341966[_0x5587('0x2f')]);_0x36fe0e[_0x5587('0x31')]=_[_0x5587('0x32')](_0x341966[_0x5587('0x33')],qs[_0x5587('0x34')](_0xdd3bca[_0x5587('0x2f')][_0x5587('0x34')]));_0x36fe0e[_0x5587('0x31')]=_0x36fe0e[_0x5587('0x31')]['length']?_0x36fe0e[_0x5587('0x31')]:_0x341966[_0x5587('0x33')];if(!_0xdd3bca['query'][_0x5587('0x35')](_0x5587('0x36'))){_0x36fe0e[_0x5587('0x1c')]=qs[_0x5587('0x1c')](_0xdd3bca[_0x5587('0x2f')][_0x5587('0x1c')]);_0x36fe0e[_0x5587('0x1a')]=qs[_0x5587('0x1a')](_0xdd3bca[_0x5587('0x2f')][_0x5587('0x1a')]);}_0x36fe0e[_0x5587('0x37')]=qs['sort'](_0xdd3bca[_0x5587('0x2f')][_0x5587('0x38')]);_0x36fe0e[_0x5587('0x39')]=qs[_0x5587('0x30')](_[_0x5587('0x3a')](_0xdd3bca[_0x5587('0x2f')],_0x341966[_0x5587('0x30')]),_0x4ebcdf);if(_0xdd3bca[_0x5587('0x2f')][_0x5587('0x3b')]){_0x36fe0e[_0x5587('0x39')]=_['merge'](_0x36fe0e['where'],{'$or':_['map'](_0x4ebcdf,function(_0x3be98b){if(_0x3be98b[_0x5587('0x2c')]!=='VIRTUAL'){var _0x48574d={};_0x48574d[_0x3be98b[_0x5587('0x27')]]={'$like':'%'+_0xdd3bca[_0x5587('0x2f')][_0x5587('0x3b')]+'%'};return _0x48574d;}})});}_0x36fe0e=_[_0x5587('0x3c')]({},_0x36fe0e,_0xdd3bca['options']);var _0x2a6a91={'where':_0x36fe0e['where']};return db[_0x5587('0x29')][_0x5587('0x1d')](_0x2a6a91)[_0x5587('0x23')](function(_0xca4b82){_0x44a4fd[_0x5587('0x1d')]=_0xca4b82;if(_0xdd3bca[_0x5587('0x2f')][_0x5587('0x3d')]){_0x36fe0e[_0x5587('0x3e')]=[{'all':!![]}];}return db[_0x5587('0x29')][_0x5587('0x3f')](_0x36fe0e);})[_0x5587('0x23')](function(_0x21f04f){_0x44a4fd[_0x5587('0x40')]=_0x21f04f;return _0x44a4fd;})[_0x5587('0x23')](respondWithFilteredResult(_0x28498a,_0x36fe0e))['catch'](handleError(_0x28498a,null));};exports[_0x5587('0x41')]=function(_0x5a9af7,_0x27606d){var _0x1e31c3={'raw':!![],'where':{'id':_0x5a9af7[_0x5587('0x42')]['id']}},_0x2818a3={};_0x2818a3[_0x5587('0x33')]=_[_0x5587('0x43')](db[_0x5587('0x29')][_0x5587('0x2a')]);_0x2818a3[_0x5587('0x2f')]=_[_0x5587('0x43')](_0x5a9af7[_0x5587('0x2f')]);_0x2818a3[_0x5587('0x30')]=_['intersection'](_0x2818a3[_0x5587('0x33')],_0x2818a3[_0x5587('0x2f')]);_0x1e31c3[_0x5587('0x31')]=_[_0x5587('0x32')](_0x2818a3['model'],qs[_0x5587('0x34')](_0x5a9af7[_0x5587('0x2f')]['fields']));_0x1e31c3[_0x5587('0x31')]=_0x1e31c3[_0x5587('0x31')][_0x5587('0x44')]?_0x1e31c3[_0x5587('0x31')]:_0x2818a3[_0x5587('0x33')];if(_0x5a9af7[_0x5587('0x2f')][_0x5587('0x3d')]){_0x1e31c3[_0x5587('0x3e')]=[{'all':!![]}];}_0x1e31c3=_[_0x5587('0x3c')]({},_0x1e31c3,_0x5a9af7[_0x5587('0x45')]);return db[_0x5587('0x29')][_0x5587('0x46')](_0x1e31c3)[_0x5587('0x23')](handleEntityNotFound(_0x27606d,null))['then'](respondWithResult(_0x27606d,null))['catch'](handleError(_0x27606d,null));};exports[_0x5587('0x47')]=function(_0xd6677e,_0x30cd7f){return db[_0x5587('0x29')][_0x5587('0x47')](_0xd6677e[_0x5587('0x48')],{})['then'](respondWithResult(_0x30cd7f,0xc9))[_0x5587('0x49')](handleError(_0x30cd7f,null));};exports['update']=function(_0x3bac26,_0x437d6d){if(_0x3bac26['body']['id']){delete _0x3bac26[_0x5587('0x48')]['id'];}return db[_0x5587('0x29')][_0x5587('0x46')]({'where':{'id':_0x3bac26[_0x5587('0x42')]['id']}})[_0x5587('0x23')](handleEntityNotFound(_0x437d6d,null))[_0x5587('0x23')](saveUpdates(_0x3bac26['body'],null))[_0x5587('0x23')](respondWithResult(_0x437d6d,null))[_0x5587('0x49')](handleError(_0x437d6d,null));};exports[_0x5587('0x4a')]=function(_0x552e51,_0x35de07,_0x9abccd){var _0x3d610f=require(_0x5587('0x4b'));var _0x1cc642=![];var _0x5911ba={};if(_0x552e51['query'][_0x5587('0x2c')]&&_0x552e51[_0x5587('0x2f')][_0x5587('0x2c')]==='uniqueid'){_0x5911ba[_0x5587('0x4c')]=_0x552e51[_0x5587('0x42')]['id'];}else{_0x5911ba['id']=_0x552e51[_0x5587('0x42')]['id'];}return db['SquareRecording'][_0x5587('0x46')]({'where':_0x5911ba,'attributes':['id',_0x5587('0x4d'),_0x5587('0x4e')],'raw':!![]})[_0x5587('0x23')](handleEntityNotFound(_0x35de07,null))['then'](function(_0x374647){if(_0x374647){var _0x419c58=_0x374647['savePath'];var _0x490152=util[_0x5587('0x4f')](_0x5587('0x50'),_0x419c58);if(fs[_0x5587('0x51')](_0x490152)){_0x1cc642=!![];return _0x3d610f[_0x5587('0x52')](_0x490152,_0x419c58,config['secrets'][_0x5587('0x53')])[_0x5587('0x23')](function(){return _0x374647;});}return _0x374647;}})[_0x5587('0x23')](function(_0x266b9c){if(_0x266b9c){var _0x286d8b=_0x266b9c[_0x5587('0x4d')];if(!fs['existsSync'](_0x286d8b)){throw new db[(_0x5587('0x54'))][(_0x5587('0x55'))]('SquareRecording\x20not\x20found');}if(_0x266b9c[_0x5587('0x4e')]){return _0x35de07['download'](_0x286d8b,_0x266b9c['filename']+path[_0x5587('0x56')](_0x286d8b),function(){if(_0x1cc642){fs[_0x5587('0x57')](_0x286d8b);}});}else{return _0x35de07['download'](_0x286d8b,function(_0x1d277d){if(_0x1cc642){fs[_0x5587('0x57')](_0x286d8b);}});}}})['catch'](function(_0x1b1fe0){if(_0x1b1fe0['message']===_0x5587('0x58')){_0x35de07[_0x5587('0x18')](0x194)[_0x5587('0x28')]('Not\x20found');}else{return handleError(_0x35de07,null);}});};exports[_0x5587('0x59')]=function(_0x44dde0,_0x374168){return db['SquareRecording'][_0x5587('0x46')]({'where':{'id':_0x44dde0[_0x5587('0x42')]['id']}})[_0x5587('0x23')](function(_0x33d127){if(_[_0x5587('0x5a')](_0x33d127)){throw new ReferenceError(_0x5587('0x5b'));}return _0x33d127;})[_0x5587('0x23')](function(_0x4bcd64){var _0x28f911=_0x4bcd64['savePath'];logger[_0x5587('0x5c')](_0x5587('0x5d'),_0x28f911);if(!_[_0x5587('0x5a')](_0x4bcd64[_0x5587('0x4d')])&&fs[_0x5587('0x51')](_0x28f911)){logger[_0x5587('0x5c')](_0x5587('0x5e')+_0x28f911+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x5587('0x5f')](_0x28f911);}_0x28f911=_0x28f911+_0x5587('0x60');if(!_['isNil'](_0x4bcd64[_0x5587('0x4d')])&&fs[_0x5587('0x51')](_0x28f911)){logger[_0x5587('0x5c')](_0x5587('0x5e')+_0x28f911+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x28f911);}return _0x4bcd64;})['then'](function(_0x3bc084){if(!_0x3bc084)throw new InternalError();return _0x3bc084[_0x5587('0x59')]();})[_0x5587('0x23')](function(){_0x374168[_0x5587('0x18')](0xcc)[_0x5587('0x24')]();})['catch'](handleError(_0x374168,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 3427764..2d68835 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 _0xb422=['square_recordings','api','request-promise','rimraf','./squareRecording.attributes','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb422,0x85));var _0x2b42=function(_0x5967c0,_0x452377){_0x5967c0=_0x5967c0-0x0;var _0x2ad249=_0xb422[_0x5967c0];return _0x2ad249;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2b42('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2b42('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2b42('0x2'));var config=require('../../config/environment');var attributes=require(_0x2b42('0x3'));module['exports']=function(_0x406d93,_0x1a0fbe){return _0x406d93[_0x2b42('0x4')]('SquareRecording',attributes,{'tableName':_0x2b42('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d14=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','square_recordings','lodash'];(function(_0x20006a,_0x30e3a9){var _0x5e26ac=function(_0x16ca0a){while(--_0x16ca0a){_0x20006a['push'](_0x20006a['shift']());}};_0x5e26ac(++_0x30e3a9);}(_0x7d14,0x6d));var _0x47d1=function(_0x389d7f,_0x5d89bf){_0x389d7f=_0x389d7f-0x0;var _0x547817=_0x7d14[_0x389d7f];return _0x547817;};'use strict';var _=require(_0x47d1('0x0'));var util=require(_0x47d1('0x1'));var logger=require('../../config/logger')(_0x47d1('0x2'));var moment=require(_0x47d1('0x3'));var BPromise=require(_0x47d1('0x4'));var rp=require(_0x47d1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x47d1('0x6'));var config=require(_0x47d1('0x7'));var attributes=require(_0x47d1('0x8'));module[_0x47d1('0x9')]=function(_0x1b2f47,_0x550ee2){return _0x1b2f47['define']('SquareRecording',attributes,{'tableName':_0x47d1('0xa'),'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 e567ceb..5dee8d5 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 _0xfb06=['SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareRecording','create','body','options','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1c05ca,_0x168888){var _0x4323a1=function(_0x54f477){while(--_0x54f477){_0x1c05ca['push'](_0x1c05ca['shift']());}};_0x4323a1(++_0x168888);}(_0xfb06,0xd9));var _0x6fb0=function(_0x55969b,_0x1ebe62){_0x55969b=_0x55969b-0x0;var _0x3d7fc1=_0xfb06[_0x55969b];return _0x3d7fc1;};'use strict';var _=require(_0x6fb0('0x0'));var util=require(_0x6fb0('0x1'));var moment=require('moment');var BPromise=require(_0x6fb0('0x2'));var rs=require(_0x6fb0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6fb0('0x4'))['db'];var utils=require(_0x6fb0('0x5'));var logger=require(_0x6fb0('0x6'))(_0x6fb0('0x7'));var config=require(_0x6fb0('0x8'));var jayson=require(_0x6fb0('0x9'));var client=jayson[_0x6fb0('0xa')][_0x6fb0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ccd1d,_0x5e8a22,_0x3665f3){return new BPromise(function(_0x396249,_0x52a4b4){return client[_0x6fb0('0xc')](_0x3ccd1d,_0x3665f3)[_0x6fb0('0xd')](function(_0x3ccee1){logger[_0x6fb0('0xe')](_0x6fb0('0xf'),_0x5e8a22,_0x6fb0('0x10'));logger[_0x6fb0('0x11')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x5e8a22,_0x6fb0('0x10'),JSON[_0x6fb0('0x12')](_0x3ccee1));if(_0x3ccee1[_0x6fb0('0x13')]){if(_0x3ccee1['error'][_0x6fb0('0x14')]===0x1f4){logger['error'](_0x6fb0('0xf'),_0x5e8a22,_0x3ccee1['error']['message']);return _0x52a4b4(_0x3ccee1['error'][_0x6fb0('0x15')]);}logger[_0x6fb0('0x13')]('SquareRecording,\x20%s,\x20%s',_0x5e8a22,_0x3ccee1['error']['message']);return _0x396249(_0x3ccee1[_0x6fb0('0x13')]['message']);}else{logger[_0x6fb0('0xe')]('SquareRecording,\x20%s,\x20%s',_0x5e8a22,_0x6fb0('0x10'));_0x396249(_0x3ccee1[_0x6fb0('0x16')][_0x6fb0('0x15')]);}})[_0x6fb0('0x17')](function(_0x44fd06){logger[_0x6fb0('0x13')](_0x6fb0('0xf'),_0x5e8a22,_0x44fd06);_0x52a4b4(_0x44fd06);});});}exports[_0x6fb0('0x18')]=function(_0x51e427){var _0x578a7f=this;return new Promise(function(_0x1dfbfe,_0x549d99){return db['SquareRecording'][_0x6fb0('0x19')](_0x51e427[_0x6fb0('0x1a')],{'raw':_0x51e427[_0x6fb0('0x1b')]?_0x51e427[_0x6fb0('0x1b')][_0x6fb0('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x55c0e8){logger[_0x6fb0('0xe')](_0x6fb0('0x18'),_0x51e427);logger[_0x6fb0('0x11')](_0x6fb0('0x18'),_0x51e427,JSON[_0x6fb0('0x12')](_0x55c0e8));_0x1dfbfe(_0x55c0e8);})['catch'](function(_0x29ad55){logger['error'](_0x6fb0('0x18'),_0x29ad55[_0x6fb0('0x15')],_0x51e427);_0x549d99(_0x578a7f['error'](0x1f4,_0x29ad55['message']));});});}; \ No newline at end of file +var _0x601d=['SquareRecording','create','body','options','raw','CreateSquareRecording','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareRecording,\x20%s,\x20%s'];(function(_0x3598ad,_0x575fce){var _0x3ec28d=function(_0x4b3b32){while(--_0x4b3b32){_0x3598ad['push'](_0x3598ad['shift']());}};_0x3ec28d(++_0x575fce);}(_0x601d,0x180));var _0xd601=function(_0x5aaf8e,_0x1e3da0){_0x5aaf8e=_0x5aaf8e-0x0;var _0x526295=_0x601d[_0x5aaf8e];return _0x526295;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd601('0x0'));var BPromise=require(_0xd601('0x1'));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(_0xd601('0x2'))(_0xd601('0x3'));var config=require(_0xd601('0x4'));var jayson=require(_0xd601('0x5'));var client=jayson[_0xd601('0x6')][_0xd601('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x62cbef,_0x104893,_0x26b7f0){return new BPromise(function(_0x5b3d96,_0x7db6f0){return client[_0xd601('0x8')](_0x62cbef,_0x26b7f0)[_0xd601('0x9')](function(_0x4ac2da){logger[_0xd601('0xa')]('SquareRecording,\x20%s,\x20%s',_0x104893,_0xd601('0xb'));logger[_0xd601('0xc')](_0xd601('0xd'),_0x104893,_0xd601('0xb'),JSON[_0xd601('0xe')](_0x4ac2da));if(_0x4ac2da[_0xd601('0xf')]){if(_0x4ac2da[_0xd601('0xf')][_0xd601('0x10')]===0x1f4){logger[_0xd601('0xf')]('SquareRecording,\x20%s,\x20%s',_0x104893,_0x4ac2da['error']['message']);return _0x7db6f0(_0x4ac2da[_0xd601('0xf')][_0xd601('0x11')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x104893,_0x4ac2da['error'][_0xd601('0x11')]);return _0x5b3d96(_0x4ac2da[_0xd601('0xf')][_0xd601('0x11')]);}else{logger[_0xd601('0xa')]('SquareRecording,\x20%s,\x20%s',_0x104893,_0xd601('0xb'));_0x5b3d96(_0x4ac2da[_0xd601('0x12')][_0xd601('0x11')]);}})[_0xd601('0x13')](function(_0x238110){logger[_0xd601('0xf')](_0xd601('0x14'),_0x104893,_0x238110);_0x7db6f0(_0x238110);});});}exports['CreateSquareRecording']=function(_0x22db63){var _0x3c72d7=this;return new Promise(function(_0x848f0f,_0xee0a0a){return db[_0xd601('0x15')][_0xd601('0x16')](_0x22db63[_0xd601('0x17')],{'raw':_0x22db63[_0xd601('0x18')]?_0x22db63[_0xd601('0x18')][_0xd601('0x19')]===undefined?!![]:![]:!![]})[_0xd601('0x9')](function(_0x1a20e5){logger[_0xd601('0xa')](_0xd601('0x1a'),_0x22db63);logger[_0xd601('0xc')]('CreateSquareRecording',_0x22db63,JSON[_0xd601('0xe')](_0x1a20e5));_0x848f0f(_0x1a20e5);})[_0xd601('0x13')](function(_0x31ddf7){logger['error'](_0xd601('0x1a'),_0x31ddf7['message'],_0x22db63);_0xee0a0a(_0x3c72d7['error'](0x1f4,_0x31ddf7[_0xd601('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 24dda5b..ff70f2a 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(_0xe91a29,_0x4d96ca){var _0x5478e7=function(_0x17d656){while(--_0x17d656){_0xe91a29['push'](_0xe91a29['shift']());}};_0x5478e7(++_0x4d96ca);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x788c48,_0x5c0e5e){var _0x299c14=function(_0x6be4c){while(--_0x6be4c){_0x788c48['push'](_0x788c48['shift']());}};_0x299c14(++_0x5c0e5e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 3589038..3ad9053 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 _0x233e=['BOOLEAN','exports','STRING','DATE'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x233e,0x1dd));var _0xe233=function(_0x3abbf5,_0x2644f9){_0x3abbf5=_0x3abbf5-0x0;var _0x1727d8=_0x233e[_0x3abbf5];return _0x1727d8;};'use strict';var Sequelize=require('sequelize');module[_0xe233('0x0')]={'network':{'type':Sequelize[_0xe233('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xe233('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe233('0x1')]},'uniqueid':{'type':Sequelize[_0xe233('0x1')]},'version':{'type':Sequelize[_0xe233('0x1')]},'callerid':{'type':Sequelize[_0xe233('0x1')]},'calleridname':{'type':Sequelize[_0xe233('0x1')]},'callingpres':{'type':Sequelize[_0xe233('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xe233('0x1')]},'callingtns':{'type':Sequelize[_0xe233('0x1')]},'dnid':{'type':Sequelize[_0xe233('0x1')]},'rdnis':{'type':Sequelize[_0xe233('0x1')]},'context':{'type':Sequelize[_0xe233('0x1')]},'extension':{'type':Sequelize[_0xe233('0x1')]},'priority':{'type':Sequelize[_0xe233('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xe233('0x1')]},'project_name':{'type':Sequelize[_0xe233('0x1')]},'joinAt':{'type':Sequelize[_0xe233('0x2')]},'leaveAt':{'type':Sequelize[_0xe233('0x2')]},'bot':{'type':Sequelize[_0xe233('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x8d17=['sequelize','exports','STRING','DATE'];(function(_0x690ed2,_0x32499f){var _0x1b9e04=function(_0x488ebb){while(--_0x488ebb){_0x690ed2['push'](_0x690ed2['shift']());}};_0x1b9e04(++_0x32499f);}(_0x8d17,0x13c));var _0x78d1=function(_0x90b3ad,_0x44bdcd){_0x90b3ad=_0x90b3ad-0x0;var _0x4f949c=_0x8d17[_0x90b3ad];return _0x4f949c;};'use strict';var Sequelize=require(_0x78d1('0x0'));module[_0x78d1('0x1')]={'network':{'type':Sequelize[_0x78d1('0x2')]},'network_script':{'type':Sequelize[_0x78d1('0x2')]},'request':{'type':Sequelize[_0x78d1('0x2')]},'channel':{'type':Sequelize[_0x78d1('0x2')]},'language':{'type':Sequelize[_0x78d1('0x2')]},'type':{'type':Sequelize[_0x78d1('0x2')]},'uniqueid':{'type':Sequelize[_0x78d1('0x2')]},'version':{'type':Sequelize[_0x78d1('0x2')]},'callerid':{'type':Sequelize[_0x78d1('0x2')]},'calleridname':{'type':Sequelize[_0x78d1('0x2')]},'callingpres':{'type':Sequelize[_0x78d1('0x2')]},'callingani2':{'type':Sequelize[_0x78d1('0x2')]},'callington':{'type':Sequelize[_0x78d1('0x2')]},'callingtns':{'type':Sequelize[_0x78d1('0x2')]},'dnid':{'type':Sequelize[_0x78d1('0x2')]},'rdnis':{'type':Sequelize[_0x78d1('0x2')]},'context':{'type':Sequelize[_0x78d1('0x2')]},'extension':{'type':Sequelize[_0x78d1('0x2')]},'priority':{'type':Sequelize[_0x78d1('0x2')]},'enhanced':{'type':Sequelize[_0x78d1('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x78d1('0x2')]},'project_name':{'type':Sequelize[_0x78d1('0x2')]},'joinAt':{'type':Sequelize[_0x78d1('0x3')]},'leaveAt':{'type':Sequelize[_0x78d1('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 5a807f9..c632d94 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 _0x85d1=['jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','then','destroy','error','stack','name','index','SquareReport','fieldName','type','key','query','keys','filters','model','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','count','include','findAll','rows','catch','params','rawAttributes','intersection','includeAll','options','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto'];(function(_0xca0334,_0xca00fb){var _0x3e3e61=function(_0x2d407b){while(--_0x2d407b){_0xca0334['push'](_0xca0334['shift']());}};_0x3e3e61(++_0xca00fb);}(_0x85d1,0x16e));var _0x185d=function(_0x224dda,_0x16d0f9){_0x224dda=_0x224dda-0x0;var _0x2987ac=_0x85d1[_0x224dda];return _0x2987ac;};'use strict';var emlformat=require(_0x185d('0x0'));var rimraf=require(_0x185d('0x1'));var zipdir=require(_0x185d('0x2'));var jsonpatch=require(_0x185d('0x3'));var rp=require(_0x185d('0x4'));var moment=require('moment');var BPromise=require(_0x185d('0x5'));var Mustache=require(_0x185d('0x6'));var util=require(_0x185d('0x7'));var path=require(_0x185d('0x8'));var sox=require(_0x185d('0x9'));var csv=require('to-csv');var ejs=require(_0x185d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x185d('0xb'));var squel=require(_0x185d('0xc'));var crypto=require(_0x185d('0xd'));var jsforce=require(_0x185d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x185d('0xf'));var querystring=require('querystring');var Papa=require(_0x185d('0x10'));var Redis=require('ioredis');var authService=require(_0x185d('0x11'));var qs=require(_0x185d('0x12'));var as=require(_0x185d('0x13'));var hardwareService=require(_0x185d('0x14'));var logger=require(_0x185d('0x15'))(_0x185d('0x16'));var utils=require(_0x185d('0x17'));var config=require(_0x185d('0x18'));var licenseUtil=require(_0x185d('0x19'));var db=require(_0x185d('0x1a'))['db'];function respondWithStatusCode(_0x2cc499,_0x354bb4){_0x354bb4=_0x354bb4||0xcc;return function(_0x3616b4){if(_0x3616b4){return _0x2cc499[_0x185d('0x1b')](_0x354bb4);}return _0x2cc499[_0x185d('0x1c')](_0x354bb4)[_0x185d('0x1d')]();};}function respondWithResult(_0x49af79,_0x20a0cd){_0x20a0cd=_0x20a0cd||0xc8;return function(_0x4d9c14){if(_0x4d9c14){return _0x49af79[_0x185d('0x1c')](_0x20a0cd)[_0x185d('0x1e')](_0x4d9c14);}};}function respondWithFilteredResult(_0x50dc55,_0x386599){return function(_0x31bfae){if(_0x31bfae){var _0x382184=typeof _0x386599[_0x185d('0x1f')]==='undefined'&&typeof _0x386599[_0x185d('0x20')]===_0x185d('0x21');var _0x3edada=_0x31bfae['count'];var _0xcfec6f=_0x382184?0x0:_0x386599[_0x185d('0x1f')];var _0x4ef4ce=_0x382184?_0x31bfae['count']:_0x386599[_0x185d('0x1f')]+_0x386599['limit'];var _0x8f9580;if(_0x4ef4ce>=_0x3edada){_0x4ef4ce=_0x3edada;_0x8f9580=0xc8;}else{_0x8f9580=0xce;}_0x50dc55['status'](_0x8f9580);return _0x50dc55[_0x185d('0x22')](_0x185d('0x23'),_0xcfec6f+'-'+_0x4ef4ce+'/'+_0x3edada)['json'](_0x31bfae);}return null;};}function patchUpdates(_0x3b6006){return function(_0x3bb7db){try{jsonpatch[_0x185d('0x24')](_0x3bb7db,_0x3b6006,!![]);}catch(_0x4af0d2){return BPromise[_0x185d('0x25')](_0x4af0d2);}return _0x3bb7db['save']();};}function saveUpdates(_0x138490,_0x444da8){return function(_0x4bb063){if(_0x4bb063){return _0x4bb063['update'](_0x138490)[_0x185d('0x26')](function(_0x4e81ff){return _0x4e81ff;});}return null;};}function removeEntity(_0x34ff52,_0x3fd72d){return function(_0x429fa5){if(_0x429fa5){return _0x429fa5[_0x185d('0x27')]()[_0x185d('0x26')](function(){_0x34ff52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fc952,_0x3ab561){return function(_0x3d81cc){if(!_0x3d81cc){_0x2fc952['sendStatus'](0x194);}return _0x3d81cc;};}function handleError(_0x3a6b55,_0x5aaa86){_0x5aaa86=_0x5aaa86||0x1f4;return function(_0x1b20e1){logger[_0x185d('0x28')](_0x1b20e1[_0x185d('0x29')]);if(_0x1b20e1['name']){delete _0x1b20e1[_0x185d('0x2a')];}_0x3a6b55[_0x185d('0x1c')](_0x5aaa86)['send'](_0x1b20e1);};}exports[_0x185d('0x2b')]=function(_0x365e0d,_0x3ee594){var _0x21c8b0={},_0x544df2={},_0x3c8fed={'count':0x0,'rows':[]};var _0x18ff49=_['map'](db[_0x185d('0x2c')]['rawAttributes'],function(_0x465f48){return{'name':_0x465f48[_0x185d('0x2d')],'type':_0x465f48[_0x185d('0x2e')][_0x185d('0x2f')]};});_0x544df2['model']=_['map'](_0x18ff49,'name');_0x544df2[_0x185d('0x30')]=_[_0x185d('0x31')](_0x365e0d[_0x185d('0x30')]);_0x544df2[_0x185d('0x32')]=_['intersection'](_0x544df2[_0x185d('0x33')],_0x544df2[_0x185d('0x30')]);_0x21c8b0[_0x185d('0x34')]=_['intersection'](_0x544df2[_0x185d('0x33')],qs['fields'](_0x365e0d[_0x185d('0x30')]['fields']));_0x21c8b0['attributes']=_0x21c8b0[_0x185d('0x34')]['length']?_0x21c8b0[_0x185d('0x34')]:_0x544df2['model'];if(!_0x365e0d[_0x185d('0x30')][_0x185d('0x35')](_0x185d('0x36'))){_0x21c8b0[_0x185d('0x20')]=qs[_0x185d('0x20')](_0x365e0d[_0x185d('0x30')][_0x185d('0x20')]);_0x21c8b0[_0x185d('0x1f')]=qs[_0x185d('0x1f')](_0x365e0d[_0x185d('0x30')][_0x185d('0x1f')]);}_0x21c8b0[_0x185d('0x37')]=qs[_0x185d('0x38')](_0x365e0d[_0x185d('0x30')][_0x185d('0x38')]);_0x21c8b0['where']=qs[_0x185d('0x32')](_[_0x185d('0x39')](_0x365e0d[_0x185d('0x30')],_0x544df2[_0x185d('0x32')]),_0x18ff49);if(_0x365e0d[_0x185d('0x30')][_0x185d('0x3a')]){_0x21c8b0[_0x185d('0x3b')]=_[_0x185d('0x3c')](_0x21c8b0[_0x185d('0x3b')],{'$or':_['map'](_0x18ff49,function(_0x3a4f6b){if(_0x3a4f6b[_0x185d('0x2e')]!=='VIRTUAL'){var _0x4ba9cc={};_0x4ba9cc[_0x3a4f6b[_0x185d('0x2a')]]={'$like':'%'+_0x365e0d[_0x185d('0x30')][_0x185d('0x3a')]+'%'};return _0x4ba9cc;}})});}_0x21c8b0=_['merge']({},_0x21c8b0,_0x365e0d['options']);var _0x44aa57={'where':_0x21c8b0[_0x185d('0x3b')]};return db[_0x185d('0x2c')]['count'](_0x44aa57)['then'](function(_0x34b451){_0x3c8fed[_0x185d('0x3d')]=_0x34b451;if(_0x365e0d['query']['includeAll']){_0x21c8b0[_0x185d('0x3e')]=[{'all':!![]}];}return db[_0x185d('0x2c')][_0x185d('0x3f')](_0x21c8b0);})[_0x185d('0x26')](function(_0x8d39bd){_0x3c8fed[_0x185d('0x40')]=_0x8d39bd;return _0x3c8fed;})[_0x185d('0x26')](respondWithFilteredResult(_0x3ee594,_0x21c8b0))[_0x185d('0x41')](handleError(_0x3ee594,null));};exports['show']=function(_0x47b6bc,_0x4c5e95){var _0x41972c={'raw':!![],'where':{'id':_0x47b6bc[_0x185d('0x42')]['id']}},_0x31aaca={};_0x31aaca['model']=_[_0x185d('0x31')](db[_0x185d('0x2c')][_0x185d('0x43')]);_0x31aaca[_0x185d('0x30')]=_['keys'](_0x47b6bc['query']);_0x31aaca[_0x185d('0x32')]=_['intersection'](_0x31aaca[_0x185d('0x33')],_0x31aaca[_0x185d('0x30')]);_0x41972c['attributes']=_[_0x185d('0x44')](_0x31aaca['model'],qs['fields'](_0x47b6bc[_0x185d('0x30')]['fields']));_0x41972c[_0x185d('0x34')]=_0x41972c[_0x185d('0x34')]['length']?_0x41972c['attributes']:_0x31aaca['model'];if(_0x47b6bc[_0x185d('0x30')][_0x185d('0x45')]){_0x41972c['include']=[{'all':!![]}];}_0x41972c=_['merge']({},_0x41972c,_0x47b6bc[_0x185d('0x46')]);return db[_0x185d('0x2c')][_0x185d('0x47')](_0x41972c)[_0x185d('0x26')](handleEntityNotFound(_0x4c5e95,null))[_0x185d('0x26')](respondWithResult(_0x4c5e95,null))[_0x185d('0x41')](handleError(_0x4c5e95,null));};exports[_0x185d('0x48')]=function(_0x19c399,_0x4f3e70){return db[_0x185d('0x2c')][_0x185d('0x48')](_0x19c399['body'],{})['then'](respondWithResult(_0x4f3e70,0xc9))['catch'](handleError(_0x4f3e70,null));};exports[_0x185d('0x49')]=function(_0x4aa337,_0x1cb2cf){if(_0x4aa337[_0x185d('0x4a')]['id']){delete _0x4aa337[_0x185d('0x4a')]['id'];}return db[_0x185d('0x2c')][_0x185d('0x47')]({'where':{'id':_0x4aa337[_0x185d('0x42')]['id']}})[_0x185d('0x26')](handleEntityNotFound(_0x1cb2cf,null))[_0x185d('0x26')](saveUpdates(_0x4aa337[_0x185d('0x4a')],null))[_0x185d('0x26')](respondWithResult(_0x1cb2cf,null))[_0x185d('0x41')](handleError(_0x1cb2cf,null));};exports['destroy']=function(_0x6992ed,_0x53976f){return db[_0x185d('0x2c')]['find']({'where':{'id':_0x6992ed[_0x185d('0x42')]['id']}})['then'](handleEntityNotFound(_0x53976f,null))[_0x185d('0x26')](removeEntity(_0x53976f,null))['catch'](handleError(_0x53976f,null));};exports[_0x185d('0x4b')]=function(_0x5f5836,_0x3bad9e){return db[_0x185d('0x2c')][_0x185d('0x4b')]()[_0x185d('0x26')](respondWithResult(_0x3bad9e,null))[_0x185d('0x41')](handleError(_0x3bad9e,null));}; \ No newline at end of file +var _0x91cf=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','include','find','create','body','update','destroy','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','end','error','send','index','map','SquareReport','rawAttributes','fieldName','type','key','name','keys','query'];(function(_0x30ac04,_0x365f1b){var _0x56b497=function(_0x2e4724){while(--_0x2e4724){_0x30ac04['push'](_0x30ac04['shift']());}};_0x56b497(++_0x365f1b);}(_0x91cf,0xb1));var _0xf91c=function(_0x46a3e8,_0x2e1b35){_0x46a3e8=_0x46a3e8-0x0;var _0xf1442e=_0x91cf[_0x46a3e8];return _0xf1442e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf91c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf91c('0x1'));var rp=require(_0xf91c('0x2'));var moment=require(_0xf91c('0x3'));var BPromise=require(_0xf91c('0x4'));var Mustache=require('mustache');var util=require(_0xf91c('0x5'));var path=require(_0xf91c('0x6'));var sox=require(_0xf91c('0x7'));var csv=require(_0xf91c('0x8'));var ejs=require(_0xf91c('0x9'));var fs=require('fs');var fs_extra=require(_0xf91c('0xa'));var _=require(_0xf91c('0xb'));var squel=require('squel');var crypto=require(_0xf91c('0xc'));var jsforce=require(_0xf91c('0xd'));var deskjs=require(_0xf91c('0xe'));var toCsv=require(_0xf91c('0x8'));var querystring=require(_0xf91c('0xf'));var Papa=require(_0xf91c('0x10'));var Redis=require(_0xf91c('0x11'));var authService=require(_0xf91c('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf91c('0x13'));var logger=require(_0xf91c('0x14'))('api');var utils=require(_0xf91c('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf91c('0x16'))['db'];function respondWithStatusCode(_0x573477,_0x380662){_0x380662=_0x380662||0xcc;return function(_0x16b2b6){if(_0x16b2b6){return _0x573477[_0xf91c('0x17')](_0x380662);}return _0x573477['status'](_0x380662)['end']();};}function respondWithResult(_0x28de97,_0x3eedd7){_0x3eedd7=_0x3eedd7||0xc8;return function(_0x16c378){if(_0x16c378){return _0x28de97[_0xf91c('0x18')](_0x3eedd7)[_0xf91c('0x19')](_0x16c378);}};}function respondWithFilteredResult(_0x3cab31,_0x3f0411){return function(_0x41da5b){if(_0x41da5b){var _0x48c0d3=typeof _0x3f0411[_0xf91c('0x1a')]===_0xf91c('0x1b')&&typeof _0x3f0411[_0xf91c('0x1c')]==='undefined';var _0x1e31f4=_0x41da5b['count'];var _0x5c2091=_0x48c0d3?0x0:_0x3f0411['offset'];var _0x234708=_0x48c0d3?_0x41da5b[_0xf91c('0x1d')]:_0x3f0411[_0xf91c('0x1a')]+_0x3f0411[_0xf91c('0x1c')];var _0x6641cd;if(_0x234708>=_0x1e31f4){_0x234708=_0x1e31f4;_0x6641cd=0xc8;}else{_0x6641cd=0xce;}_0x3cab31[_0xf91c('0x18')](_0x6641cd);return _0x3cab31[_0xf91c('0x1e')](_0xf91c('0x1f'),_0x5c2091+'-'+_0x234708+'/'+_0x1e31f4)[_0xf91c('0x19')](_0x41da5b);}return null;};}function patchUpdates(_0x26d777){return function(_0x4fda64){try{jsonpatch['apply'](_0x4fda64,_0x26d777,!![]);}catch(_0x8f9ef2){return BPromise[_0xf91c('0x20')](_0x8f9ef2);}return _0x4fda64[_0xf91c('0x21')]();};}function saveUpdates(_0x205f22,_0x484f73){return function(_0x43fbc1){if(_0x43fbc1){return _0x43fbc1['update'](_0x205f22)['then'](function(_0x2b6d42){return _0x2b6d42;});}return null;};}function removeEntity(_0x26bf9d,_0x21b6da){return function(_0x1776af){if(_0x1776af){return _0x1776af['destroy']()[_0xf91c('0x22')](function(){_0x26bf9d['status'](0xcc)[_0xf91c('0x23')]();});}};}function handleEntityNotFound(_0x598634,_0x36cbac){return function(_0x5549c9){if(!_0x5549c9){_0x598634[_0xf91c('0x17')](0x194);}return _0x5549c9;};}function handleError(_0x42cac7,_0x1f0b27){_0x1f0b27=_0x1f0b27||0x1f4;return function(_0x3d4896){logger[_0xf91c('0x24')](_0x3d4896['stack']);if(_0x3d4896['name']){delete _0x3d4896['name'];}_0x42cac7[_0xf91c('0x18')](_0x1f0b27)[_0xf91c('0x25')](_0x3d4896);};}exports[_0xf91c('0x26')]=function(_0x178cce,_0x5e8e83){var _0x2cc64c={},_0x339f42={},_0x4c543b={'count':0x0,'rows':[]};var _0x3c8101=_[_0xf91c('0x27')](db[_0xf91c('0x28')][_0xf91c('0x29')],function(_0x3ffbd7){return{'name':_0x3ffbd7[_0xf91c('0x2a')],'type':_0x3ffbd7[_0xf91c('0x2b')][_0xf91c('0x2c')]};});_0x339f42['model']=_[_0xf91c('0x27')](_0x3c8101,_0xf91c('0x2d'));_0x339f42['query']=_[_0xf91c('0x2e')](_0x178cce[_0xf91c('0x2f')]);_0x339f42['filters']=_[_0xf91c('0x30')](_0x339f42[_0xf91c('0x31')],_0x339f42[_0xf91c('0x2f')]);_0x2cc64c[_0xf91c('0x32')]=_[_0xf91c('0x30')](_0x339f42[_0xf91c('0x31')],qs[_0xf91c('0x33')](_0x178cce[_0xf91c('0x2f')][_0xf91c('0x33')]));_0x2cc64c[_0xf91c('0x32')]=_0x2cc64c[_0xf91c('0x32')][_0xf91c('0x34')]?_0x2cc64c[_0xf91c('0x32')]:_0x339f42[_0xf91c('0x31')];if(!_0x178cce['query'][_0xf91c('0x35')](_0xf91c('0x36'))){_0x2cc64c[_0xf91c('0x1c')]=qs[_0xf91c('0x1c')](_0x178cce[_0xf91c('0x2f')]['limit']);_0x2cc64c[_0xf91c('0x1a')]=qs[_0xf91c('0x1a')](_0x178cce['query'][_0xf91c('0x1a')]);}_0x2cc64c[_0xf91c('0x37')]=qs[_0xf91c('0x38')](_0x178cce[_0xf91c('0x2f')][_0xf91c('0x38')]);_0x2cc64c[_0xf91c('0x39')]=qs[_0xf91c('0x3a')](_[_0xf91c('0x3b')](_0x178cce['query'],_0x339f42[_0xf91c('0x3a')]),_0x3c8101);if(_0x178cce[_0xf91c('0x2f')][_0xf91c('0x3c')]){_0x2cc64c[_0xf91c('0x39')]=_[_0xf91c('0x3d')](_0x2cc64c[_0xf91c('0x39')],{'$or':_[_0xf91c('0x27')](_0x3c8101,function(_0x3a0196){if(_0x3a0196[_0xf91c('0x2b')]!==_0xf91c('0x3e')){var _0xec1049={};_0xec1049[_0x3a0196[_0xf91c('0x2d')]]={'$like':'%'+_0x178cce[_0xf91c('0x2f')][_0xf91c('0x3c')]+'%'};return _0xec1049;}})});}_0x2cc64c=_[_0xf91c('0x3d')]({},_0x2cc64c,_0x178cce[_0xf91c('0x3f')]);var _0x361f6f={'where':_0x2cc64c['where']};return db[_0xf91c('0x28')][_0xf91c('0x1d')](_0x361f6f)[_0xf91c('0x22')](function(_0x1720f0){_0x4c543b[_0xf91c('0x1d')]=_0x1720f0;if(_0x178cce[_0xf91c('0x2f')][_0xf91c('0x40')]){_0x2cc64c['include']=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x2cc64c);})[_0xf91c('0x22')](function(_0x512e30){_0x4c543b[_0xf91c('0x41')]=_0x512e30;return _0x4c543b;})[_0xf91c('0x22')](respondWithFilteredResult(_0x5e8e83,_0x2cc64c))[_0xf91c('0x42')](handleError(_0x5e8e83,null));};exports['show']=function(_0x2bd364,_0x5deded){var _0x431e88={'raw':!![],'where':{'id':_0x2bd364[_0xf91c('0x43')]['id']}},_0x49ed12={};_0x49ed12[_0xf91c('0x31')]=_[_0xf91c('0x2e')](db[_0xf91c('0x28')][_0xf91c('0x29')]);_0x49ed12[_0xf91c('0x2f')]=_[_0xf91c('0x2e')](_0x2bd364[_0xf91c('0x2f')]);_0x49ed12[_0xf91c('0x3a')]=_[_0xf91c('0x30')](_0x49ed12['model'],_0x49ed12[_0xf91c('0x2f')]);_0x431e88[_0xf91c('0x32')]=_[_0xf91c('0x30')](_0x49ed12['model'],qs[_0xf91c('0x33')](_0x2bd364[_0xf91c('0x2f')]['fields']));_0x431e88[_0xf91c('0x32')]=_0x431e88[_0xf91c('0x32')][_0xf91c('0x34')]?_0x431e88[_0xf91c('0x32')]:_0x49ed12[_0xf91c('0x31')];if(_0x2bd364[_0xf91c('0x2f')][_0xf91c('0x40')]){_0x431e88[_0xf91c('0x44')]=[{'all':!![]}];}_0x431e88=_['merge']({},_0x431e88,_0x2bd364[_0xf91c('0x3f')]);return db[_0xf91c('0x28')][_0xf91c('0x45')](_0x431e88)[_0xf91c('0x22')](handleEntityNotFound(_0x5deded,null))['then'](respondWithResult(_0x5deded,null))[_0xf91c('0x42')](handleError(_0x5deded,null));};exports[_0xf91c('0x46')]=function(_0x3c1662,_0x4aab43){return db[_0xf91c('0x28')][_0xf91c('0x46')](_0x3c1662[_0xf91c('0x47')],{})[_0xf91c('0x22')](respondWithResult(_0x4aab43,0xc9))[_0xf91c('0x42')](handleError(_0x4aab43,null));};exports[_0xf91c('0x48')]=function(_0x545cb3,_0xd751c2){if(_0x545cb3[_0xf91c('0x47')]['id']){delete _0x545cb3[_0xf91c('0x47')]['id'];}return db[_0xf91c('0x28')][_0xf91c('0x45')]({'where':{'id':_0x545cb3[_0xf91c('0x43')]['id']}})['then'](handleEntityNotFound(_0xd751c2,null))[_0xf91c('0x22')](saveUpdates(_0x545cb3['body'],null))[_0xf91c('0x22')](respondWithResult(_0xd751c2,null))[_0xf91c('0x42')](handleError(_0xd751c2,null));};exports[_0xf91c('0x49')]=function(_0x66a8e5,_0x2be6e8){return db['SquareReport'][_0xf91c('0x45')]({'where':{'id':_0x66a8e5[_0xf91c('0x43')]['id']}})[_0xf91c('0x22')](handleEntityNotFound(_0x2be6e8,null))[_0xf91c('0x22')](removeEntity(_0x2be6e8,null))['catch'](handleError(_0x2be6e8,null));};exports['describe']=function(_0x3775b5,_0x1d2438){return db[_0xf91c('0x28')][_0xf91c('0x4a')]()[_0xf91c('0x22')](respondWithResult(_0x1d2438,null))['catch'](handleError(_0x1d2438,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 335d1b6..8fa5be8 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 _0xbcaf=['exports','SquareReport','report_square','uid_pname','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xbcaf,0x1f3));var _0xfbca=function(_0x4f575c,_0x3a0284){_0x4f575c=_0x4f575c-0x0;var _0x3ba76d=_0xbcaf[_0x4f575c];return _0x3ba76d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfbca('0x0'))(_0xfbca('0x1'));var moment=require(_0xfbca('0x2'));var BPromise=require(_0xfbca('0x3'));var rp=require(_0xfbca('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfbca('0x5'));var config=require(_0xfbca('0x6'));var attributes=require('./squareReport.attributes');module[_0xfbca('0x7')]=function(_0x3b6756,_0xfb5166){return _0x3b6756['define'](_0xfbca('0x8'),attributes,{'tableName':_0xfbca('0x9'),'paranoid':![],'indexes':[{'name':_0xfbca('0xa'),'fields':['uniqueid','project_name']},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd4ce=['uniqueid','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','report_square','uid_pname'];(function(_0x1c2150,_0x571276){var _0x23748c=function(_0x56b222){while(--_0x56b222){_0x1c2150['push'](_0x1c2150['shift']());}};_0x23748c(++_0x571276);}(_0xd4ce,0x113));var _0xed4c=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xd4ce[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0xed4c('0x0'));var util=require(_0xed4c('0x1'));var logger=require(_0xed4c('0x2'))(_0xed4c('0x3'));var moment=require(_0xed4c('0x4'));var BPromise=require(_0xed4c('0x5'));var rp=require(_0xed4c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed4c('0x7'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0xed4c('0x8')]=function(_0x26a4ea,_0x1beb9d){return _0x26a4ea['define']('SquareReport',attributes,{'tableName':_0xed4c('0x9'),'paranoid':![],'indexes':[{'name':_0xed4c('0xa'),'fields':[_0xed4c('0xb'),'project_name']},{'name':_0xed4c('0xc'),'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 d832dc3..27e2bf0 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 _0x95f3=['body','raw','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','CreateSquareReport','SquareReport','create','options','debug','UpdateSquareReport','update'];(function(_0x2c0b11,_0x41042a){var _0x231a35=function(_0x4682b4){while(--_0x4682b4){_0x2c0b11['push'](_0x2c0b11['shift']());}};_0x231a35(++_0x41042a);}(_0x95f3,0x115));var _0x395f=function(_0x1fdd7e,_0x164d5d){_0x1fdd7e=_0x1fdd7e-0x0;var _0x55cb10=_0x95f3[_0x1fdd7e];return _0x55cb10;};'use strict';var _=require('lodash');var util=require(_0x395f('0x0'));var moment=require(_0x395f('0x1'));var BPromise=require(_0x395f('0x2'));var rs=require(_0x395f('0x3'));var fs=require('fs');var Redis=require(_0x395f('0x4'));var db=require(_0x395f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x395f('0x6'))(_0x395f('0x7'));var config=require(_0x395f('0x8'));var jayson=require(_0x395f('0x9'));var client=jayson['client'][_0x395f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2086a7,_0x3853f4,_0x40fdf0){return new BPromise(function(_0x18cf78,_0xaa7685){return client[_0x395f('0xb')](_0x2086a7,_0x40fdf0)[_0x395f('0xc')](function(_0x2a5a12){logger[_0x395f('0xd')](_0x395f('0xe'),_0x3853f4,_0x395f('0xf'));logger['debug'](_0x395f('0x10'),_0x3853f4,_0x395f('0xf'),JSON[_0x395f('0x11')](_0x2a5a12));if(_0x2a5a12['error']){if(_0x2a5a12['error'][_0x395f('0x12')]===0x1f4){logger[_0x395f('0x13')]('SquareReport,\x20%s,\x20%s',_0x3853f4,_0x2a5a12[_0x395f('0x13')][_0x395f('0x14')]);return _0xaa7685(_0x2a5a12[_0x395f('0x13')]['message']);}logger[_0x395f('0x13')](_0x395f('0xe'),_0x3853f4,_0x2a5a12[_0x395f('0x13')][_0x395f('0x14')]);return _0x18cf78(_0x2a5a12['error']['message']);}else{logger[_0x395f('0xd')](_0x395f('0xe'),_0x3853f4,'request\x20sent');_0x18cf78(_0x2a5a12['result'][_0x395f('0x14')]);}})[_0x395f('0x15')](function(_0x24b2f0){logger[_0x395f('0x13')]('SquareReport,\x20%s,\x20%s',_0x3853f4,_0x24b2f0);_0xaa7685(_0x24b2f0);});});}exports[_0x395f('0x16')]=function(_0xba20){var _0x1e1110=this;return new Promise(function(_0x5e98e5,_0x2eef54){return db[_0x395f('0x17')][_0x395f('0x18')](_0xba20['body'],{'raw':_0xba20[_0x395f('0x19')]?_0xba20['options']['raw']===undefined?!![]:![]:!![]})[_0x395f('0xc')](function(_0x1f980f){logger[_0x395f('0xd')](_0x395f('0x16'),_0xba20);logger[_0x395f('0x1a')](_0x395f('0x16'),_0xba20,JSON[_0x395f('0x11')](_0x1f980f));_0x5e98e5(_0x1f980f);})[_0x395f('0x15')](function(_0x4ea0d7){logger[_0x395f('0x13')](_0x395f('0x16'),_0x4ea0d7[_0x395f('0x14')],_0xba20);_0x2eef54(_0x1e1110['error'](0x1f4,_0x4ea0d7['message']));});});};exports[_0x395f('0x1b')]=function(_0x773b7f){var _0x46083c=this;return new Promise(function(_0xd60c8c,_0x4098d4){return db[_0x395f('0x17')][_0x395f('0x1c')](_0x773b7f[_0x395f('0x1d')],{'raw':_0x773b7f['options']?_0x773b7f['options'][_0x395f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x773b7f[_0x395f('0x19')]?_0x773b7f[_0x395f('0x19')][_0x395f('0x1f')]||null:null,'attributes':_0x773b7f[_0x395f('0x19')]?_0x773b7f[_0x395f('0x19')][_0x395f('0x20')]||null:null,'limit':_0x773b7f[_0x395f('0x19')]?_0x773b7f[_0x395f('0x19')][_0x395f('0x21')]||null:null})['then'](function(_0x390bd9){logger[_0x395f('0xd')](_0x395f('0x1b'),_0x773b7f);logger[_0x395f('0x1a')]('UpdateSquareReport',_0x773b7f,JSON[_0x395f('0x11')](_0x390bd9));_0xd60c8c(_0x390bd9);})[_0x395f('0x15')](function(_0x111d5a){logger[_0x395f('0x13')](_0x395f('0x1b'),_0x111d5a[_0x395f('0x14')],_0x773b7f);_0x4098d4(_0x46083c[_0x395f('0x13')](0x1f4,_0x111d5a[_0x395f('0x14')]));});});}; \ No newline at end of file +var _0x487a=['info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','CreateSquareReport','SquareReport','create','body','options','raw','catch','UpdateSquareReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','http','request','then'];(function(_0x2dc55e,_0x46b490){var _0x3893e0=function(_0x30e700){while(--_0x30e700){_0x2dc55e['push'](_0x2dc55e['shift']());}};_0x3893e0(++_0x46b490);}(_0x487a,0x1f3));var _0xa487=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x487a[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0xa487('0x0'));var util=require(_0xa487('0x1'));var moment=require(_0xa487('0x2'));var BPromise=require(_0xa487('0x3'));var rs=require(_0xa487('0x4'));var fs=require('fs');var Redis=require(_0xa487('0x5'));var db=require(_0xa487('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa487('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa487('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10bdeb,_0x40435a,_0x556c1b){return new BPromise(function(_0x5b1c24,_0x478865){return client[_0xa487('0x9')](_0x10bdeb,_0x556c1b)[_0xa487('0xa')](function(_0xa5e083){logger[_0xa487('0xb')](_0xa487('0xc'),_0x40435a,_0xa487('0xd'));logger[_0xa487('0xe')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x40435a,_0xa487('0xd'),JSON[_0xa487('0xf')](_0xa5e083));if(_0xa5e083['error']){if(_0xa5e083['error'][_0xa487('0x10')]===0x1f4){logger[_0xa487('0x11')]('SquareReport,\x20%s,\x20%s',_0x40435a,_0xa5e083['error'][_0xa487('0x12')]);return _0x478865(_0xa5e083[_0xa487('0x11')][_0xa487('0x12')]);}logger[_0xa487('0x11')](_0xa487('0xc'),_0x40435a,_0xa5e083[_0xa487('0x11')][_0xa487('0x12')]);return _0x5b1c24(_0xa5e083['error']['message']);}else{logger[_0xa487('0xb')](_0xa487('0xc'),_0x40435a,_0xa487('0xd'));_0x5b1c24(_0xa5e083[_0xa487('0x13')][_0xa487('0x12')]);}})['catch'](function(_0x5c5d19){logger[_0xa487('0x11')](_0xa487('0xc'),_0x40435a,_0x5c5d19);_0x478865(_0x5c5d19);});});}exports[_0xa487('0x14')]=function(_0x5de498){var _0x8ff0dc=this;return new Promise(function(_0x4a1f04,_0x4bfa8b){return db[_0xa487('0x15')][_0xa487('0x16')](_0x5de498[_0xa487('0x17')],{'raw':_0x5de498['options']?_0x5de498[_0xa487('0x18')][_0xa487('0x19')]===undefined?!![]:![]:!![]})[_0xa487('0xa')](function(_0x2d61c0){logger[_0xa487('0xb')](_0xa487('0x14'),_0x5de498);logger['debug'](_0xa487('0x14'),_0x5de498,JSON['stringify'](_0x2d61c0));_0x4a1f04(_0x2d61c0);})[_0xa487('0x1a')](function(_0x4c28c8){logger[_0xa487('0x11')](_0xa487('0x14'),_0x4c28c8['message'],_0x5de498);_0x4bfa8b(_0x8ff0dc['error'](0x1f4,_0x4c28c8[_0xa487('0x12')]));});});};exports[_0xa487('0x1b')]=function(_0x4c7362){var _0xd8934e=this;return new Promise(function(_0x206d79,_0x3dca04){return db[_0xa487('0x15')][_0xa487('0x1c')](_0x4c7362[_0xa487('0x17')],{'raw':_0x4c7362[_0xa487('0x18')]?_0x4c7362['options'][_0xa487('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c7362[_0xa487('0x18')]?_0x4c7362[_0xa487('0x18')][_0xa487('0x1d')]||null:null,'attributes':_0x4c7362['options']?_0x4c7362['options']['attributes']||null:null,'limit':_0x4c7362[_0xa487('0x18')]?_0x4c7362[_0xa487('0x18')]['limit']||null:null})[_0xa487('0xa')](function(_0x38c532){logger[_0xa487('0xb')](_0xa487('0x1b'),_0x4c7362);logger['debug'](_0xa487('0x1b'),_0x4c7362,JSON[_0xa487('0xf')](_0x38c532));_0x206d79(_0x38c532);})[_0xa487('0x1a')](function(_0x326454){logger[_0xa487('0x11')](_0xa487('0x1b'),_0x326454[_0xa487('0x12')],_0x4c7362);_0x3dca04(_0xd8934e[_0xa487('0x11')](0x1f4,_0x326454[_0xa487('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 2faa6e6..ab23248 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 _0x6b6c=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller'];(function(_0x209eef,_0x241a83){var _0x4ba422=function(_0x39cbc8){while(--_0x39cbc8){_0x209eef['push'](_0x209eef['shift']());}};_0x4ba422(++_0x241a83);}(_0x6b6c,0x1c5));var _0xc6b6=function(_0x2c7ead,_0x298284){_0x2c7ead=_0x2c7ead-0x0;var _0x1971ca=_0x6b6c[_0x2c7ead];return _0x1971ca;};'use strict';var multer=require('multer');var util=require(_0xc6b6('0x0'));var path=require(_0xc6b6('0x1'));var timeout=require(_0xc6b6('0x2'));var express=require(_0xc6b6('0x3'));var router=express[_0xc6b6('0x4')]();var fs_extra=require(_0xc6b6('0x5'));var auth=require(_0xc6b6('0x6'));var interaction=require(_0xc6b6('0x7'));var config=require('../../config/environment');var controller=require(_0xc6b6('0x8'));router[_0xc6b6('0x9')]('/',auth[_0xc6b6('0xa')](),controller[_0xc6b6('0xb')]);router[_0xc6b6('0x9')](_0xc6b6('0xc'),auth[_0xc6b6('0xa')](),controller[_0xc6b6('0xd')]);router[_0xc6b6('0x9')](_0xc6b6('0xe'),auth['isAuthenticated'](),controller[_0xc6b6('0xf')]);router[_0xc6b6('0x10')]('/',auth[_0xc6b6('0xa')](),controller[_0xc6b6('0x11')]);router[_0xc6b6('0x12')](_0xc6b6('0xe'),auth['isAuthenticated'](),controller[_0xc6b6('0x13')]);router['delete'](_0xc6b6('0xe'),auth['isAuthenticated'](),controller[_0xc6b6('0x14')]);module[_0xc6b6('0x15')]=router; \ No newline at end of file +var _0xded0=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','show','post','put','/:id','exports','multer'];(function(_0xbe40ad,_0x44343c){var _0x50fac9=function(_0xdaed07){while(--_0xdaed07){_0xbe40ad['push'](_0xbe40ad['shift']());}};_0x50fac9(++_0x44343c);}(_0xded0,0xd7));var _0x0ded=function(_0x2b1044,_0x400476){_0x2b1044=_0x2b1044-0x0;var _0x27e662=_0xded0[_0x2b1044];return _0x27e662;};'use strict';var multer=require(_0x0ded('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0ded('0x1'));var express=require(_0x0ded('0x2'));var router=express[_0x0ded('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0ded('0x4'));var interaction=require(_0x0ded('0x5'));var config=require(_0x0ded('0x6'));var controller=require(_0x0ded('0x7'));router[_0x0ded('0x8')]('/',auth[_0x0ded('0x9')](),controller[_0x0ded('0xa')]);router['get'](_0x0ded('0xb'),auth[_0x0ded('0x9')](),controller[_0x0ded('0xc')]);router[_0x0ded('0x8')]('/:id',auth[_0x0ded('0x9')](),controller[_0x0ded('0xd')]);router[_0x0ded('0xe')]('/',auth[_0x0ded('0x9')](),controller['create']);router[_0x0ded('0xf')](_0x0ded('0x10'),auth[_0x0ded('0x9')](),controller['update']);router['delete'](_0x0ded('0x10'),auth[_0x0ded('0x9')](),controller['destroy']);module[_0x0ded('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 44a942e..77472a0 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 _0x2179=['sequelize','exports','STRING','TEXT'];(function(_0x387cc4,_0x53b9ca){var _0xb413f1=function(_0xc5d6f1){while(--_0xc5d6f1){_0x387cc4['push'](_0x387cc4['shift']());}};_0xb413f1(++_0x53b9ca);}(_0x2179,0xc0));var _0x9217=function(_0x4336a6,_0xc235ca){_0x4336a6=_0x4336a6-0x0;var _0x4012f3=_0x2179[_0x4336a6];return _0x4012f3;};'use strict';var Sequelize=require(_0x9217('0x0'));module[_0x9217('0x1')]={'uniqueid':{'type':Sequelize[_0x9217('0x2')]},'node':{'type':Sequelize[_0x9217('0x2')]},'application':{'type':Sequelize[_0x9217('0x2')]},'data':{'type':Sequelize[_0x9217('0x3')]},'project_name':{'type':Sequelize[_0x9217('0x2')]},'callerid':{'type':Sequelize[_0x9217('0x2')]}}; \ No newline at end of file +var _0xa490=['STRING','sequelize','exports'];(function(_0x3eced1,_0x3f0ef1){var _0x51820e=function(_0xf6680c){while(--_0xf6680c){_0x3eced1['push'](_0x3eced1['shift']());}};_0x51820e(++_0x3f0ef1);}(_0xa490,0x11b));var _0x0a49=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa490[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0a49('0x0'));module[_0x0a49('0x1')]={'uniqueid':{'type':Sequelize[_0x0a49('0x2')]},'node':{'type':Sequelize[_0x0a49('0x2')]},'application':{'type':Sequelize[_0x0a49('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x0a49('0x2')]},'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 d1f12bd..f273177 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 _0x27c9=['sort','where','filters','pick','filter','merge','VIRTUAL','options','SquareDetailsReport','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x2fe689,_0x5794e5){var _0x35ea44=function(_0x51b9d6){while(--_0x51b9d6){_0x2fe689['push'](_0x2fe689['shift']());}};_0x35ea44(++_0x5794e5);}(_0x27c9,0xb0));var _0x927c=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x27c9[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x927c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x927c('0x1'));var rp=require(_0x927c('0x2'));var moment=require(_0x927c('0x3'));var BPromise=require(_0x927c('0x4'));var Mustache=require('mustache');var util=require(_0x927c('0x5'));var path=require(_0x927c('0x6'));var sox=require(_0x927c('0x7'));var csv=require('to-csv');var ejs=require(_0x927c('0x8'));var fs=require('fs');var fs_extra=require(_0x927c('0x9'));var _=require('lodash');var squel=require(_0x927c('0xa'));var crypto=require(_0x927c('0xb'));var jsforce=require(_0x927c('0xc'));var deskjs=require(_0x927c('0xd'));var toCsv=require(_0x927c('0xe'));var querystring=require(_0x927c('0xf'));var Papa=require(_0x927c('0x10'));var Redis=require('ioredis');var authService=require(_0x927c('0x11'));var qs=require(_0x927c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x927c('0x13'))('api');var utils=require(_0x927c('0x14'));var config=require(_0x927c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x927c('0x16'))['db'];function respondWithStatusCode(_0x52cc9a,_0x28570d){_0x28570d=_0x28570d||0xcc;return function(_0x4ae33c){if(_0x4ae33c){return _0x52cc9a[_0x927c('0x17')](_0x28570d);}return _0x52cc9a[_0x927c('0x18')](_0x28570d)[_0x927c('0x19')]();};}function respondWithResult(_0x4133c9,_0xd042ae){_0xd042ae=_0xd042ae||0xc8;return function(_0x1c6ff8){if(_0x1c6ff8){return _0x4133c9[_0x927c('0x18')](_0xd042ae)['json'](_0x1c6ff8);}};}function respondWithFilteredResult(_0x354ea7,_0x2df9a0){return function(_0x53ddee){if(_0x53ddee){var _0x207ba2=typeof _0x2df9a0[_0x927c('0x1a')]==='undefined'&&typeof _0x2df9a0[_0x927c('0x1b')]===_0x927c('0x1c');var _0x187492=_0x53ddee[_0x927c('0x1d')];var _0x2ac297=_0x207ba2?0x0:_0x2df9a0[_0x927c('0x1a')];var _0x2c55e8=_0x207ba2?_0x53ddee['count']:_0x2df9a0['offset']+_0x2df9a0[_0x927c('0x1b')];var _0x3bce68;if(_0x2c55e8>=_0x187492){_0x2c55e8=_0x187492;_0x3bce68=0xc8;}else{_0x3bce68=0xce;}_0x354ea7[_0x927c('0x18')](_0x3bce68);return _0x354ea7[_0x927c('0x1e')](_0x927c('0x1f'),_0x2ac297+'-'+_0x2c55e8+'/'+_0x187492)[_0x927c('0x20')](_0x53ddee);}return null;};}function patchUpdates(_0x49d232){return function(_0x2c766a){try{jsonpatch[_0x927c('0x21')](_0x2c766a,_0x49d232,!![]);}catch(_0xfcfb3c){return BPromise[_0x927c('0x22')](_0xfcfb3c);}return _0x2c766a[_0x927c('0x23')]();};}function saveUpdates(_0x547bd5,_0x351fb3){return function(_0x190abe){if(_0x190abe){return _0x190abe[_0x927c('0x24')](_0x547bd5)[_0x927c('0x25')](function(_0x1e0cf7){return _0x1e0cf7;});}return null;};}function removeEntity(_0x37d0da,_0x5e7c37){return function(_0x5ae263){if(_0x5ae263){return _0x5ae263[_0x927c('0x26')]()[_0x927c('0x25')](function(){_0x37d0da['status'](0xcc)[_0x927c('0x19')]();});}};}function handleEntityNotFound(_0x5cbe83,_0x4128f0){return function(_0x44f5ec){if(!_0x44f5ec){_0x5cbe83[_0x927c('0x17')](0x194);}return _0x44f5ec;};}function handleError(_0x4013b6,_0x45d1eb){_0x45d1eb=_0x45d1eb||0x1f4;return function(_0x334176){logger[_0x927c('0x27')](_0x334176[_0x927c('0x28')]);if(_0x334176[_0x927c('0x29')]){delete _0x334176[_0x927c('0x29')];}_0x4013b6[_0x927c('0x18')](_0x45d1eb)['send'](_0x334176);};}exports[_0x927c('0x2a')]=function(_0x38fe64,_0x4f00f6){var _0xd95236={},_0x23620d={},_0x12aa8f={'count':0x0,'rows':[]};var _0x27edf9=_[_0x927c('0x2b')](db['SquareDetailsReport'][_0x927c('0x2c')],function(_0x3e222f){return{'name':_0x3e222f[_0x927c('0x2d')],'type':_0x3e222f[_0x927c('0x2e')][_0x927c('0x2f')]};});_0x23620d[_0x927c('0x30')]=_[_0x927c('0x2b')](_0x27edf9,_0x927c('0x29'));_0x23620d[_0x927c('0x31')]=_[_0x927c('0x32')](_0x38fe64[_0x927c('0x31')]);_0x23620d['filters']=_[_0x927c('0x33')](_0x23620d[_0x927c('0x30')],_0x23620d['query']);_0xd95236['attributes']=_['intersection'](_0x23620d['model'],qs['fields'](_0x38fe64['query'][_0x927c('0x34')]));_0xd95236[_0x927c('0x35')]=_0xd95236[_0x927c('0x35')][_0x927c('0x36')]?_0xd95236['attributes']:_0x23620d[_0x927c('0x30')];if(!_0x38fe64[_0x927c('0x31')][_0x927c('0x37')](_0x927c('0x38'))){_0xd95236[_0x927c('0x1b')]=qs['limit'](_0x38fe64[_0x927c('0x31')][_0x927c('0x1b')]);_0xd95236[_0x927c('0x1a')]=qs[_0x927c('0x1a')](_0x38fe64['query'][_0x927c('0x1a')]);}_0xd95236[_0x927c('0x39')]=qs[_0x927c('0x3a')](_0x38fe64[_0x927c('0x31')][_0x927c('0x3a')]);_0xd95236[_0x927c('0x3b')]=qs[_0x927c('0x3c')](_[_0x927c('0x3d')](_0x38fe64['query'],_0x23620d[_0x927c('0x3c')]),_0x27edf9);if(_0x38fe64[_0x927c('0x31')][_0x927c('0x3e')]){_0xd95236[_0x927c('0x3b')]=_[_0x927c('0x3f')](_0xd95236[_0x927c('0x3b')],{'$or':_[_0x927c('0x2b')](_0x27edf9,function(_0x116d09){if(_0x116d09['type']!==_0x927c('0x40')){var _0x189b2b={};_0x189b2b[_0x116d09[_0x927c('0x29')]]={'$like':'%'+_0x38fe64[_0x927c('0x31')]['filter']+'%'};return _0x189b2b;}})});}_0xd95236=_[_0x927c('0x3f')]({},_0xd95236,_0x38fe64[_0x927c('0x41')]);var _0x4bb623={'where':_0xd95236['where']};return db[_0x927c('0x42')][_0x927c('0x1d')](_0x4bb623)['then'](function(_0x2ab604){_0x12aa8f[_0x927c('0x1d')]=_0x2ab604;if(_0x38fe64[_0x927c('0x31')][_0x927c('0x43')]){_0xd95236['include']=[{'all':!![]}];}return db[_0x927c('0x42')][_0x927c('0x44')](_0xd95236);})['then'](function(_0x31f840){_0x12aa8f[_0x927c('0x45')]=_0x31f840;return _0x12aa8f;})['then'](respondWithFilteredResult(_0x4f00f6,_0xd95236))[_0x927c('0x46')](handleError(_0x4f00f6,null));};exports[_0x927c('0x47')]=function(_0x4cc98f,_0x3ca607){var _0x190a9f={'raw':!![],'where':{'id':_0x4cc98f[_0x927c('0x48')]['id']}},_0x595e6c={};_0x595e6c[_0x927c('0x30')]=_[_0x927c('0x32')](db[_0x927c('0x42')][_0x927c('0x2c')]);_0x595e6c['query']=_[_0x927c('0x32')](_0x4cc98f['query']);_0x595e6c[_0x927c('0x3c')]=_[_0x927c('0x33')](_0x595e6c[_0x927c('0x30')],_0x595e6c[_0x927c('0x31')]);_0x190a9f[_0x927c('0x35')]=_[_0x927c('0x33')](_0x595e6c['model'],qs[_0x927c('0x34')](_0x4cc98f['query']['fields']));_0x190a9f[_0x927c('0x35')]=_0x190a9f[_0x927c('0x35')][_0x927c('0x36')]?_0x190a9f[_0x927c('0x35')]:_0x595e6c[_0x927c('0x30')];if(_0x4cc98f[_0x927c('0x31')][_0x927c('0x43')]){_0x190a9f[_0x927c('0x49')]=[{'all':!![]}];}_0x190a9f=_[_0x927c('0x3f')]({},_0x190a9f,_0x4cc98f[_0x927c('0x41')]);return db[_0x927c('0x42')][_0x927c('0x4a')](_0x190a9f)[_0x927c('0x25')](handleEntityNotFound(_0x3ca607,null))[_0x927c('0x25')](respondWithResult(_0x3ca607,null))[_0x927c('0x46')](handleError(_0x3ca607,null));};exports[_0x927c('0x4b')]=function(_0x51a076,_0x352ccc){return db['SquareDetailsReport'][_0x927c('0x4b')](_0x51a076['body'],{})[_0x927c('0x25')](respondWithResult(_0x352ccc,0xc9))[_0x927c('0x46')](handleError(_0x352ccc,null));};exports[_0x927c('0x24')]=function(_0xa0a266,_0x436d16){if(_0xa0a266[_0x927c('0x4c')]['id']){delete _0xa0a266[_0x927c('0x4c')]['id'];}return db['SquareDetailsReport'][_0x927c('0x4a')]({'where':{'id':_0xa0a266['params']['id']}})[_0x927c('0x25')](handleEntityNotFound(_0x436d16,null))[_0x927c('0x25')](saveUpdates(_0xa0a266['body'],null))['then'](respondWithResult(_0x436d16,null))[_0x927c('0x46')](handleError(_0x436d16,null));};exports[_0x927c('0x26')]=function(_0x114b4a,_0x904be3){return db[_0x927c('0x42')][_0x927c('0x4a')]({'where':{'id':_0x114b4a[_0x927c('0x48')]['id']}})[_0x927c('0x25')](handleEntityNotFound(_0x904be3,null))[_0x927c('0x25')](removeEntity(_0x904be3,null))[_0x927c('0x46')](handleError(_0x904be3,null));};exports[_0x927c('0x4d')]=function(_0xacb601,_0x3c57f6){return db[_0x927c('0x42')][_0x927c('0x4d')]()[_0x927c('0x25')](respondWithResult(_0x3c57f6,null))[_0x927c('0x46')](handleError(_0x3c57f6,null));}; \ No newline at end of file +var _0x7b22=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','stack','name','send','SquareDetailsReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','map','VIRTUAL','include','findAll','then','catch','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x1b3251,_0x58f958){var _0x370769=function(_0x265f9a){while(--_0x265f9a){_0x1b3251['push'](_0x1b3251['shift']());}};_0x370769(++_0x58f958);}(_0x7b22,0x1d9));var _0x27b2=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x7b22[_0x346737];return _0x1ade2e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27b2('0x0'));var zipdir=require(_0x27b2('0x1'));var jsonpatch=require(_0x27b2('0x2'));var rp=require(_0x27b2('0x3'));var moment=require(_0x27b2('0x4'));var BPromise=require(_0x27b2('0x5'));var Mustache=require('mustache');var util=require(_0x27b2('0x6'));var path=require(_0x27b2('0x7'));var sox=require(_0x27b2('0x8'));var csv=require(_0x27b2('0x9'));var ejs=require(_0x27b2('0xa'));var fs=require('fs');var fs_extra=require(_0x27b2('0xb'));var _=require(_0x27b2('0xc'));var squel=require('squel');var crypto=require(_0x27b2('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x27b2('0x9'));var querystring=require(_0x27b2('0xe'));var Papa=require(_0x27b2('0xf'));var Redis=require(_0x27b2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x27b2('0x11'));var as=require(_0x27b2('0x12'));var hardwareService=require(_0x27b2('0x13'));var logger=require(_0x27b2('0x14'))('api');var utils=require(_0x27b2('0x15'));var config=require(_0x27b2('0x16'));var licenseUtil=require(_0x27b2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x503fe8,_0x42f2cc){_0x42f2cc=_0x42f2cc||0xcc;return function(_0x27eb2d){if(_0x27eb2d){return _0x503fe8[_0x27b2('0x18')](_0x42f2cc);}return _0x503fe8[_0x27b2('0x19')](_0x42f2cc)[_0x27b2('0x1a')]();};}function respondWithResult(_0x2a4774,_0x4b4d45){_0x4b4d45=_0x4b4d45||0xc8;return function(_0x419d88){if(_0x419d88){return _0x2a4774[_0x27b2('0x19')](_0x4b4d45)[_0x27b2('0x1b')](_0x419d88);}};}function respondWithFilteredResult(_0x3cf7c3,_0x57ff4e){return function(_0x4b1450){if(_0x4b1450){var _0x59a5d4=typeof _0x57ff4e[_0x27b2('0x1c')]===_0x27b2('0x1d')&&typeof _0x57ff4e[_0x27b2('0x1e')]==='undefined';var _0x5d350f=_0x4b1450[_0x27b2('0x1f')];var _0x58fecb=_0x59a5d4?0x0:_0x57ff4e[_0x27b2('0x1c')];var _0x6bfaf8=_0x59a5d4?_0x4b1450[_0x27b2('0x1f')]:_0x57ff4e[_0x27b2('0x1c')]+_0x57ff4e[_0x27b2('0x1e')];var _0xa203a5;if(_0x6bfaf8>=_0x5d350f){_0x6bfaf8=_0x5d350f;_0xa203a5=0xc8;}else{_0xa203a5=0xce;}_0x3cf7c3[_0x27b2('0x19')](_0xa203a5);return _0x3cf7c3[_0x27b2('0x20')](_0x27b2('0x21'),_0x58fecb+'-'+_0x6bfaf8+'/'+_0x5d350f)['json'](_0x4b1450);}return null;};}function patchUpdates(_0x424f5b){return function(_0x433c82){try{jsonpatch[_0x27b2('0x22')](_0x433c82,_0x424f5b,!![]);}catch(_0x4ac346){return BPromise['reject'](_0x4ac346);}return _0x433c82[_0x27b2('0x23')]();};}function saveUpdates(_0x5ca33c,_0x3e5b99){return function(_0x5cb78e){if(_0x5cb78e){return _0x5cb78e[_0x27b2('0x24')](_0x5ca33c)['then'](function(_0x563483){return _0x563483;});}return null;};}function removeEntity(_0x2fc2f1,_0x3d8dad){return function(_0x3d5b0f){if(_0x3d5b0f){return _0x3d5b0f[_0x27b2('0x25')]()['then'](function(){_0x2fc2f1[_0x27b2('0x19')](0xcc)[_0x27b2('0x1a')]();});}};}function handleEntityNotFound(_0x3d6d3d,_0x831084){return function(_0x4d5235){if(!_0x4d5235){_0x3d6d3d[_0x27b2('0x18')](0x194);}return _0x4d5235;};}function handleError(_0x3db832,_0x502a5b){_0x502a5b=_0x502a5b||0x1f4;return function(_0x368393){logger['error'](_0x368393[_0x27b2('0x26')]);if(_0x368393['name']){delete _0x368393[_0x27b2('0x27')];}_0x3db832['status'](_0x502a5b)[_0x27b2('0x28')](_0x368393);};}exports['index']=function(_0x28ff46,_0x3e36b8){var _0x1d3190={},_0x2a7826={},_0x519b2a={'count':0x0,'rows':[]};var _0xaba44f=_['map'](db[_0x27b2('0x29')][_0x27b2('0x2a')],function(_0x3f7bab){return{'name':_0x3f7bab[_0x27b2('0x2b')],'type':_0x3f7bab[_0x27b2('0x2c')]['key']};});_0x2a7826[_0x27b2('0x2d')]=_['map'](_0xaba44f,_0x27b2('0x27'));_0x2a7826[_0x27b2('0x2e')]=_[_0x27b2('0x2f')](_0x28ff46['query']);_0x2a7826[_0x27b2('0x30')]=_['intersection'](_0x2a7826[_0x27b2('0x2d')],_0x2a7826[_0x27b2('0x2e')]);_0x1d3190[_0x27b2('0x31')]=_[_0x27b2('0x32')](_0x2a7826[_0x27b2('0x2d')],qs[_0x27b2('0x33')](_0x28ff46[_0x27b2('0x2e')]['fields']));_0x1d3190[_0x27b2('0x31')]=_0x1d3190['attributes'][_0x27b2('0x34')]?_0x1d3190[_0x27b2('0x31')]:_0x2a7826[_0x27b2('0x2d')];if(!_0x28ff46[_0x27b2('0x2e')]['hasOwnProperty']('nolimit')){_0x1d3190[_0x27b2('0x1e')]=qs[_0x27b2('0x1e')](_0x28ff46['query'][_0x27b2('0x1e')]);_0x1d3190[_0x27b2('0x1c')]=qs[_0x27b2('0x1c')](_0x28ff46[_0x27b2('0x2e')][_0x27b2('0x1c')]);}_0x1d3190[_0x27b2('0x35')]=qs[_0x27b2('0x36')](_0x28ff46['query'][_0x27b2('0x36')]);_0x1d3190[_0x27b2('0x37')]=qs[_0x27b2('0x30')](_[_0x27b2('0x38')](_0x28ff46[_0x27b2('0x2e')],_0x2a7826[_0x27b2('0x30')]),_0xaba44f);if(_0x28ff46[_0x27b2('0x2e')][_0x27b2('0x39')]){_0x1d3190[_0x27b2('0x37')]=_[_0x27b2('0x3a')](_0x1d3190[_0x27b2('0x37')],{'$or':_[_0x27b2('0x3b')](_0xaba44f,function(_0x8fc1d1){if(_0x8fc1d1[_0x27b2('0x2c')]!==_0x27b2('0x3c')){var _0x313a3c={};_0x313a3c[_0x8fc1d1[_0x27b2('0x27')]]={'$like':'%'+_0x28ff46[_0x27b2('0x2e')][_0x27b2('0x39')]+'%'};return _0x313a3c;}})});}_0x1d3190=_[_0x27b2('0x3a')]({},_0x1d3190,_0x28ff46['options']);var _0x26966a={'where':_0x1d3190[_0x27b2('0x37')]};return db[_0x27b2('0x29')][_0x27b2('0x1f')](_0x26966a)['then'](function(_0x4af400){_0x519b2a[_0x27b2('0x1f')]=_0x4af400;if(_0x28ff46[_0x27b2('0x2e')]['includeAll']){_0x1d3190[_0x27b2('0x3d')]=[{'all':!![]}];}return db[_0x27b2('0x29')][_0x27b2('0x3e')](_0x1d3190);})[_0x27b2('0x3f')](function(_0x232aec){_0x519b2a['rows']=_0x232aec;return _0x519b2a;})[_0x27b2('0x3f')](respondWithFilteredResult(_0x3e36b8,_0x1d3190))[_0x27b2('0x40')](handleError(_0x3e36b8,null));};exports['show']=function(_0x23b739,_0x53df26){var _0x2c7a08={'raw':!![],'where':{'id':_0x23b739[_0x27b2('0x41')]['id']}},_0x3e7149={};_0x3e7149[_0x27b2('0x2d')]=_[_0x27b2('0x2f')](db[_0x27b2('0x29')]['rawAttributes']);_0x3e7149[_0x27b2('0x2e')]=_['keys'](_0x23b739['query']);_0x3e7149['filters']=_[_0x27b2('0x32')](_0x3e7149[_0x27b2('0x2d')],_0x3e7149['query']);_0x2c7a08[_0x27b2('0x31')]=_[_0x27b2('0x32')](_0x3e7149[_0x27b2('0x2d')],qs['fields'](_0x23b739[_0x27b2('0x2e')][_0x27b2('0x33')]));_0x2c7a08[_0x27b2('0x31')]=_0x2c7a08[_0x27b2('0x31')][_0x27b2('0x34')]?_0x2c7a08[_0x27b2('0x31')]:_0x3e7149[_0x27b2('0x2d')];if(_0x23b739[_0x27b2('0x2e')][_0x27b2('0x42')]){_0x2c7a08['include']=[{'all':!![]}];}_0x2c7a08=_[_0x27b2('0x3a')]({},_0x2c7a08,_0x23b739['options']);return db[_0x27b2('0x29')][_0x27b2('0x43')](_0x2c7a08)[_0x27b2('0x3f')](handleEntityNotFound(_0x53df26,null))[_0x27b2('0x3f')](respondWithResult(_0x53df26,null))[_0x27b2('0x40')](handleError(_0x53df26,null));};exports[_0x27b2('0x44')]=function(_0x1b4a1f,_0x250d3d){return db[_0x27b2('0x29')][_0x27b2('0x44')](_0x1b4a1f[_0x27b2('0x45')],{})['then'](respondWithResult(_0x250d3d,0xc9))[_0x27b2('0x40')](handleError(_0x250d3d,null));};exports[_0x27b2('0x24')]=function(_0x159fc8,_0x11ebf2){if(_0x159fc8[_0x27b2('0x45')]['id']){delete _0x159fc8['body']['id'];}return db[_0x27b2('0x29')]['find']({'where':{'id':_0x159fc8['params']['id']}})[_0x27b2('0x3f')](handleEntityNotFound(_0x11ebf2,null))[_0x27b2('0x3f')](saveUpdates(_0x159fc8[_0x27b2('0x45')],null))[_0x27b2('0x3f')](respondWithResult(_0x11ebf2,null))['catch'](handleError(_0x11ebf2,null));};exports[_0x27b2('0x25')]=function(_0x5500a3,_0x2bb327){return db['SquareDetailsReport'][_0x27b2('0x43')]({'where':{'id':_0x5500a3[_0x27b2('0x41')]['id']}})['then'](handleEntityNotFound(_0x2bb327,null))['then'](removeEntity(_0x2bb327,null))[_0x27b2('0x40')](handleError(_0x2bb327,null));};exports[_0x27b2('0x46')]=function(_0x2dbbc7,_0x1d2605){return db['SquareDetailsReport'][_0x27b2('0x46')]()[_0x27b2('0x3f')](respondWithResult(_0x1d2605,null))[_0x27b2('0x40')](handleError(_0x1d2605,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index c622bc6..b4db812 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 _0x17b8=['../../config/environment','exports','report_square_details','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x37e307,_0x378e6c){var _0x44a38c=function(_0x278dce){while(--_0x278dce){_0x37e307['push'](_0x37e307['shift']());}};_0x44a38c(++_0x378e6c);}(_0x17b8,0x1d9));var _0x817b=function(_0x314485,_0x447bd2){_0x314485=_0x314485-0x0;var _0x1c4c96=_0x17b8[_0x314485];return _0x1c4c96;};'use strict';var _=require('lodash');var util=require(_0x817b('0x0'));var logger=require(_0x817b('0x1'))(_0x817b('0x2'));var moment=require('moment');var BPromise=require(_0x817b('0x3'));var rp=require(_0x817b('0x4'));var fs=require('fs');var path=require(_0x817b('0x5'));var rimraf=require(_0x817b('0x6'));var config=require(_0x817b('0x7'));var attributes=require('./squareReportDetail.attributes');module[_0x817b('0x8')]=function(_0x23f083,_0x321b5a){return _0x23f083['define']('SquareDetailsReport',attributes,{'tableName':_0x817b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a6b=['request-promise','../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','lodash','util','../../config/logger','api','moment'];(function(_0x497174,_0x190468){var _0x3cbdde=function(_0x19accd){while(--_0x19accd){_0x497174['push'](_0x497174['shift']());}};_0x3cbdde(++_0x190468);}(_0x3a6b,0x1d4));var _0xb3a6=function(_0x5d8d3a,_0x34abcd){_0x5d8d3a=_0x5d8d3a-0x0;var _0x463c97=_0x3a6b[_0x5d8d3a];return _0x463c97;};'use strict';var _=require(_0xb3a6('0x0'));var util=require(_0xb3a6('0x1'));var logger=require(_0xb3a6('0x2'))(_0xb3a6('0x3'));var moment=require(_0xb3a6('0x4'));var BPromise=require('bluebird');var rp=require(_0xb3a6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb3a6('0x6'));var attributes=require(_0xb3a6('0x7'));module[_0xb3a6('0x8')]=function(_0x5cd07a,_0x4d9bc1){return _0x5cd07a[_0xb3a6('0x9')]('SquareDetailsReport',attributes,{'tableName':_0xb3a6('0xa'),'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 7ee6010..8942cf0 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 _0x7fce=['request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','create','body','options','raw','CreateSquareDetailsReport','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','client','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7fce,0xdc));var _0xe7fc=function(_0x4e508e,_0x4c5498){_0x4e508e=_0x4e508e-0x0;var _0x54ad8c=_0x7fce[_0x4e508e];return _0x54ad8c;};'use strict';var _=require(_0xe7fc('0x0'));var util=require(_0xe7fc('0x1'));var moment=require(_0xe7fc('0x2'));var BPromise=require('bluebird');var rs=require(_0xe7fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe7fc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe7fc('0x5'))(_0xe7fc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe7fc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4665f6,_0x161dca,_0x296b2e){return new BPromise(function(_0x19eeef,_0x22fabf){return client['request'](_0x4665f6,_0x296b2e)[_0xe7fc('0x8')](function(_0x4a1209){logger[_0xe7fc('0x9')]('SquareDetailsReport,\x20%s,\x20%s',_0x161dca,_0xe7fc('0xa'));logger[_0xe7fc('0xb')](_0xe7fc('0xc'),_0x161dca,_0xe7fc('0xa'),JSON['stringify'](_0x4a1209));if(_0x4a1209[_0xe7fc('0xd')]){if(_0x4a1209[_0xe7fc('0xd')]['code']===0x1f4){logger['error'](_0xe7fc('0xe'),_0x161dca,_0x4a1209['error'][_0xe7fc('0xf')]);return _0x22fabf(_0x4a1209['error']['message']);}logger[_0xe7fc('0xd')](_0xe7fc('0xe'),_0x161dca,_0x4a1209[_0xe7fc('0xd')][_0xe7fc('0xf')]);return _0x19eeef(_0x4a1209[_0xe7fc('0xd')]['message']);}else{logger[_0xe7fc('0x9')]('SquareDetailsReport,\x20%s,\x20%s',_0x161dca,'request\x20sent');_0x19eeef(_0x4a1209[_0xe7fc('0x10')][_0xe7fc('0xf')]);}})[_0xe7fc('0x11')](function(_0x3a44a6){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x161dca,_0x3a44a6);_0x22fabf(_0x3a44a6);});});}exports['CreateSquareDetailsReport']=function(_0x4aa4f0){var _0x52902f=this;return new Promise(function(_0x490a99,_0x14515d){return db['SquareDetailsReport'][_0xe7fc('0x12')](_0x4aa4f0[_0xe7fc('0x13')],{'raw':_0x4aa4f0[_0xe7fc('0x14')]?_0x4aa4f0[_0xe7fc('0x14')][_0xe7fc('0x15')]===undefined?!![]:![]:!![]})[_0xe7fc('0x8')](function(_0x329051){logger[_0xe7fc('0x9')]('CreateSquareDetailsReport',_0x4aa4f0);logger[_0xe7fc('0xb')](_0xe7fc('0x16'),_0x4aa4f0,JSON['stringify'](_0x329051));_0x490a99(_0x329051);})['catch'](function(_0x35bb53){logger[_0xe7fc('0xd')](_0xe7fc('0x16'),_0x35bb53[_0xe7fc('0xf')],_0x4aa4f0);_0x14515d(_0x52902f[_0xe7fc('0xd')](0x1f4,_0x35bb53[_0xe7fc('0xf')]));});});}; \ No newline at end of file +var _0x7916=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash'];(function(_0x30cb96,_0x31b9e1){var _0xeff506=function(_0x5ad5f7){while(--_0x5ad5f7){_0x30cb96['push'](_0x30cb96['shift']());}};_0xeff506(++_0x31b9e1);}(_0x7916,0x128));var _0x6791=function(_0x11154a,_0x353c95){_0x11154a=_0x11154a-0x0;var _0x324111=_0x7916[_0x11154a];return _0x324111;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var moment=require(_0x6791('0x1'));var BPromise=require(_0x6791('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6791('0x3'));var db=require(_0x6791('0x4'))['db'];var utils=require(_0x6791('0x5'));var logger=require(_0x6791('0x6'))('rpc');var config=require(_0x6791('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6791('0x8')][_0x6791('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ad8c0,_0x8b85ff,_0x5d2118){return new BPromise(function(_0x2b240c,_0x50c563){return client['request'](_0x5ad8c0,_0x5d2118)[_0x6791('0xa')](function(_0x198a64){logger['info'](_0x6791('0xb'),_0x8b85ff,_0x6791('0xc'));logger[_0x6791('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x8b85ff,_0x6791('0xc'),JSON[_0x6791('0xe')](_0x198a64));if(_0x198a64[_0x6791('0xf')]){if(_0x198a64[_0x6791('0xf')][_0x6791('0x10')]===0x1f4){logger[_0x6791('0xf')](_0x6791('0xb'),_0x8b85ff,_0x198a64[_0x6791('0xf')][_0x6791('0x11')]);return _0x50c563(_0x198a64[_0x6791('0xf')][_0x6791('0x11')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x8b85ff,_0x198a64[_0x6791('0xf')]['message']);return _0x2b240c(_0x198a64[_0x6791('0xf')]['message']);}else{logger[_0x6791('0x12')](_0x6791('0xb'),_0x8b85ff,'request\x20sent');_0x2b240c(_0x198a64[_0x6791('0x13')]['message']);}})[_0x6791('0x14')](function(_0x150d1f){logger['error'](_0x6791('0xb'),_0x8b85ff,_0x150d1f);_0x50c563(_0x150d1f);});});}exports[_0x6791('0x15')]=function(_0x5bec14){var _0x1872f5=this;return new Promise(function(_0x4d8a79,_0xe55dba){return db[_0x6791('0x16')][_0x6791('0x17')](_0x5bec14[_0x6791('0x18')],{'raw':_0x5bec14[_0x6791('0x19')]?_0x5bec14[_0x6791('0x19')][_0x6791('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4a2922){logger[_0x6791('0x12')]('CreateSquareDetailsReport',_0x5bec14);logger[_0x6791('0xd')](_0x6791('0x15'),_0x5bec14,JSON['stringify'](_0x4a2922));_0x4d8a79(_0x4a2922);})[_0x6791('0x14')](function(_0x309610){logger[_0x6791('0xf')](_0x6791('0x15'),_0x309610['message'],_0x5bec14);_0xe55dba(_0x1872f5[_0x6791('0xf')](0x1f4,_0x309610[_0x6791('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 9c52835..223952f 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 _0xef22=['get','isAuthenticated','/process/:pid/kill','killProcess','exports','express','Router'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xef22,0xec));var _0x2ef2=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xef22[_0x139a3c];return _0x2b375b;};'use strict';var express=require(_0x2ef2('0x0'));var router=express[_0x2ef2('0x1')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0x2ef2('0x2')]('/',auth[_0x2ef2('0x3')](),controller['index']);router[_0x2ef2('0x2')](_0x2ef2('0x4'),auth[_0x2ef2('0x3')](),controller[_0x2ef2('0x5')]);module[_0x2ef2('0x6')]=router; \ No newline at end of file +var _0x273c=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service'];(function(_0xeb3378,_0x2121c9){var _0x5d0470=function(_0x68292b){while(--_0x68292b){_0xeb3378['push'](_0xeb3378['shift']());}};_0x5d0470(++_0x2121c9);}(_0x273c,0xcf));var _0xc273=function(_0x466410,_0x4069d9){_0x466410=_0x466410-0x0;var _0x3d758e=_0x273c[_0x466410];return _0x3d758e;};'use strict';var express=require(_0xc273('0x0'));var router=express[_0xc273('0x1')]();var auth=require(_0xc273('0x2'));var controller=require(_0xc273('0x3'));router[_0xc273('0x4')]('/',auth[_0xc273('0x5')](),controller[_0xc273('0x6')]);router['get'](_0xc273('0x7'),auth[_0xc273('0x5')](),controller[_0xc273('0x8')]);module[_0xc273('0x9')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 9789819..a43d960 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 _0x5524=['lodash','name','status','getAllData','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','then','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','util','bluebird'];(function(_0x5b337d,_0x34ba2c){var _0x4c760a=function(_0x42c25b){while(--_0x42c25b){_0x5b337d['push'](_0x5b337d['shift']());}};_0x4c760a(++_0x34ba2c);}(_0x5524,0xba));var _0x4552=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x5524[_0xbca1b1];return _0x4e1686;};'use strict';var info=require('systeminformation');var exec=require(_0x4552('0x0'))[_0x4552('0x1')];var logger=require(_0x4552('0x2'))(_0x4552('0x3'));var util=require(_0x4552('0x4'));var BPromise=require(_0x4552('0x5'));var _=require(_0x4552('0x6'));function handleError(_0x3e0a1e,_0x3c0752,_0x193266){_0x3c0752=_0x3c0752||0x1f4;return function(_0x244468){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x193266,_0x3c0752,util['inspect'](_0x244468,{'showHidden':![],'depth':null}));delete _0x244468[_0x4552('0x7')];_0x3e0a1e[_0x4552('0x8')](_0x3c0752)['send'](_0x244468);};}exports['index']=function(_0x2e840e,_0x14cddb){return info[_0x4552('0x9')]()['then'](function(_0x19074c){return _0x14cddb[_0x4552('0x8')](0xc8)[_0x4552('0xa')](_0x19074c);})[_0x4552('0xb')](function(_0x2bfe56){return _0x14cddb[_0x4552('0x8')](0x1f4)['json'](_0x2bfe56);});};exports[_0x4552('0xc')]=function(_0x2beb7b,_0x27b96c){var _0x412932=[_0x4552('0xd')];return new BPromise(function(_0x41f10c,_0xaab6bf){return exec(util[_0x4552('0xe')](_0x4552('0xf'),_0x2beb7b[_0x4552('0x10')]['pid']),function(_0x4a375b,_0x2331a4,_0x421c7b){if(_0x4a375b){return _0xaab6bf(_0x4a375b);}return _0x41f10c(_0x2331a4);});})[_0x4552('0x11')](function(_0x290c11){var _0x5e46c2=![];var _0xfd596d=_0x290c11[_0x4552('0x12')](/\n/);for(var _0x55be04=0x0,_0x2dc7ce=_0x412932[_0x4552('0x13')];_0x55be04<_0x2dc7ce,_0x5e46c2===![];_0x55be04+=0x1){if(_0x290c11[_0x4552('0x14')](_0x412932[_0x55be04])>=0x0){_0x5e46c2=!![];}}if(!_0x5e46c2){throw new Error(util[_0x4552('0xe')](_0x4552('0x15'),_0x2beb7b[_0x4552('0x10')]['pid']));}process['kill'](_0x2beb7b[_0x4552('0x10')][_0x4552('0x16')],'SIGINT');return _0x27b96c[_0x4552('0x8')](0xc8)[_0x4552('0xa')]({'message':util['format'](_0x4552('0x17'),_0x2beb7b[_0x4552('0x10')]['pid'])});})[_0x4552('0xb')](handleError(_0x27b96c,null,_0x4552('0xc')));}; \ No newline at end of file +var _0x512b=['index','then','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','indexOf','params','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','api','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x512b,0x110));var _0xb512=function(_0xb6ac03,_0x38446a){_0xb6ac03=_0xb6ac03-0x0;var _0x18e00b=_0x512b[_0xb6ac03];return _0x18e00b;};'use strict';var info=require('systeminformation');var exec=require(_0xb512('0x0'))[_0xb512('0x1')];var logger=require('../../config/logger')(_0xb512('0x2'));var util=require('util');var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x5d6564,_0x320570,_0xb4fe78){_0x320570=_0x320570||0x1f4;return function(_0x972cbf){logger['error'](_0xb512('0x3'),_0xb4fe78,_0x320570,util[_0xb512('0x4')](_0x972cbf,{'showHidden':![],'depth':null}));delete _0x972cbf[_0xb512('0x5')];_0x5d6564[_0xb512('0x6')](_0x320570)[_0xb512('0x7')](_0x972cbf);};}exports[_0xb512('0x8')]=function(_0xcfb846,_0x525951){return info['getAllData']()[_0xb512('0x9')](function(_0xdbd710){return _0x525951['status'](0xc8)[_0xb512('0xa')](_0xdbd710);})[_0xb512('0xb')](function(_0x2b0793){return _0x525951[_0xb512('0x6')](0x1f4)[_0xb512('0xa')](_0x2b0793);});};exports[_0xb512('0xc')]=function(_0x17e0b1,_0x38c6ec){var _0x564f82=['components/import/cm'];return new BPromise(function(_0x275379,_0x41ac69){return exec(util[_0xb512('0xd')](_0xb512('0xe'),_0x17e0b1['params'][_0xb512('0xf')]),function(_0x411c89,_0x2eb0b5,_0x88ab69){if(_0x411c89){return _0x41ac69(_0x411c89);}return _0x275379(_0x2eb0b5);});})[_0xb512('0x9')](function(_0x424dde){var _0x61d84c=![];var _0x43b132=_0x424dde['split'](/\n/);for(var _0x14973a=0x0,_0x1ae348=_0x564f82['length'];_0x14973a<_0x1ae348,_0x61d84c===![];_0x14973a+=0x1){if(_0x424dde[_0xb512('0x10')](_0x564f82[_0x14973a])>=0x0){_0x61d84c=!![];}}if(!_0x61d84c){throw new Error(util[_0xb512('0xd')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x17e0b1[_0xb512('0x11')][_0xb512('0xf')]));}process[_0xb512('0x12')](_0x17e0b1[_0xb512('0x11')][_0xb512('0xf')],'SIGINT');return _0x38c6ec[_0xb512('0x6')](0xc8)['json']({'message':util[_0xb512('0xd')](_0xb512('0x13'),_0x17e0b1[_0xb512('0x11')][_0xb512('0xf')])});})['catch'](handleError(_0x38c6ec,null,_0xb512('0xc')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index a46212d..f79967f 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 _0x153f=['Router','fs-extra','../../components/interaction/service','./tag.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x188b62,_0x1532f7){var _0x25e264=function(_0x1aa81e){while(--_0x1aa81e){_0x188b62['push'](_0x188b62['shift']());}};_0x25e264(++_0x1532f7);}(_0x153f,0x15b));var _0xf153=function(_0x3eb3a0,_0x438107){_0x3eb3a0=_0x3eb3a0-0x0;var _0x3a34e1=_0x153f[_0x3eb3a0];return _0x3a34e1;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var fs_extra=require(_0xf153('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf153('0x7'));var config=require('../../config/environment');var controller=require(_0xf153('0x8'));router[_0xf153('0x9')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0xb')]);router[_0xf153('0x9')]('/describe',auth[_0xf153('0xa')](),controller[_0xf153('0xc')]);router[_0xf153('0x9')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0xe')]);router[_0xf153('0xf')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0x10')]);router[_0xf153('0x11')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0x12')]);router[_0xf153('0x13')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0x14')]);module[_0xf153('0x15')]=router; \ No newline at end of file +var _0xac31=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','show','post','create','put','/:id'];(function(_0x363d73,_0x62314d){var _0x436945=function(_0x358b1a){while(--_0x358b1a){_0x363d73['push'](_0x363d73['shift']());}};_0x436945(++_0x62314d);}(_0xac31,0xca));var _0x1ac3=function(_0x5f23b9,_0x21125f){_0x5f23b9=_0x5f23b9-0x0;var _0x557864=_0xac31[_0x5f23b9];return _0x557864;};'use strict';var multer=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var path=require(_0x1ac3('0x2'));var timeout=require(_0x1ac3('0x3'));var express=require(_0x1ac3('0x4'));var router=express[_0x1ac3('0x5')]();var fs_extra=require(_0x1ac3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var controller=require('./tag.controller');router['get']('/',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0xa')]);router[_0x1ac3('0xb')](_0x1ac3('0xc'),auth[_0x1ac3('0x9')](),controller['describe']);router[_0x1ac3('0xb')]('/:id',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0xd')]);router[_0x1ac3('0xe')]('/',auth['isAuthenticated'](),controller[_0x1ac3('0xf')]);router[_0x1ac3('0x10')](_0x1ac3('0x11'),auth[_0x1ac3('0x9')](),controller[_0x1ac3('0x12')]);router[_0x1ac3('0x13')]('/:id',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0x14')]);module[_0x1ac3('0x15')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 696de96..1234d39 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 _0x0e21=['exports','STRING','name','#0091EA'];(function(_0x44039a,_0x2ac8a8){var _0x525de5=function(_0x1dc635){while(--_0x1dc635){_0x44039a['push'](_0x44039a['shift']());}};_0x525de5(++_0x2ac8a8);}(_0x0e21,0xe8));var _0x10e2=function(_0x5ac89d,_0x47ced1){_0x5ac89d=_0x5ac89d-0x0;var _0x4c5a08=_0x0e21[_0x5ac89d];return _0x4c5a08;};'use strict';var Sequelize=require('sequelize');module[_0x10e2('0x0')]={'name':{'type':Sequelize[_0x10e2('0x1')],'unique':_0x10e2('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x10e2('0x3')},'description':{'type':Sequelize[_0x10e2('0x1')]}}; \ No newline at end of file +var _0x758a=['sequelize','exports','STRING','name','#0091EA'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x758a,0x1d1));var _0xa758=function(_0x89a0c1,_0x3a5885){_0x89a0c1=_0x89a0c1-0x0;var _0x5c56a4=_0x758a[_0x89a0c1];return _0x5c56a4;};'use strict';var Sequelize=require(_0xa758('0x0'));module[_0xa758('0x1')]={'name':{'type':Sequelize[_0xa758('0x2')],'unique':_0xa758('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xa758('0x2')],'defaultValue':_0xa758('0x4')},'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 6141c2e..f9e3c0f 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 _0x03db=['params','keys','intersection','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','status','end','json','limit','undefined','count','set','Content-Range','apply','save','update','destroy','get','Tags','UserProfileResource','then','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','model','query','filters','attributes','fields','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show'];(function(_0x3c3fe,_0x35b5b7){var _0x3fba8a=function(_0x4bad5d){while(--_0x4bad5d){_0x3c3fe['push'](_0x3c3fe['shift']());}};_0x3fba8a(++_0x35b5b7);}(_0x03db,0x156));var _0xb03d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x03db[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xb03d('0x0'));var rimraf=require(_0xb03d('0x1'));var zipdir=require(_0xb03d('0x2'));var jsonpatch=require(_0xb03d('0x3'));var rp=require('request-promise');var moment=require(_0xb03d('0x4'));var BPromise=require(_0xb03d('0x5'));var Mustache=require(_0xb03d('0x6'));var util=require(_0xb03d('0x7'));var path=require(_0xb03d('0x8'));var sox=require('sox');var csv=require(_0xb03d('0x9'));var ejs=require(_0xb03d('0xa'));var fs=require('fs');var fs_extra=require(_0xb03d('0xb'));var _=require('lodash');var squel=require(_0xb03d('0xc'));var crypto=require('crypto');var jsforce=require(_0xb03d('0xd'));var deskjs=require(_0xb03d('0xe'));var toCsv=require(_0xb03d('0x9'));var querystring=require(_0xb03d('0xf'));var Papa=require(_0xb03d('0x10'));var Redis=require(_0xb03d('0x11'));var authService=require(_0xb03d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb03d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb03d('0x14'));var utils=require(_0xb03d('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb03d('0x16'))['db'];function respondWithStatusCode(_0x5cc310,_0x4e0695){_0x4e0695=_0x4e0695||0xcc;return function(_0x22115b){if(_0x22115b){return _0x5cc310['sendStatus'](_0x4e0695);}return _0x5cc310[_0xb03d('0x17')](_0x4e0695)[_0xb03d('0x18')]();};}function respondWithResult(_0x127db1,_0x273d74){_0x273d74=_0x273d74||0xc8;return function(_0x1e85d5){if(_0x1e85d5){return _0x127db1[_0xb03d('0x17')](_0x273d74)[_0xb03d('0x19')](_0x1e85d5);}};}function respondWithFilteredResult(_0x548004,_0x163331){return function(_0x355abf){if(_0x355abf){var _0x2de6db=typeof _0x163331['offset']==='undefined'&&typeof _0x163331[_0xb03d('0x1a')]===_0xb03d('0x1b');var _0xc0a76a=_0x355abf[_0xb03d('0x1c')];var _0x17398a=_0x2de6db?0x0:_0x163331['offset'];var _0xd2801a=_0x2de6db?_0x355abf[_0xb03d('0x1c')]:_0x163331['offset']+_0x163331[_0xb03d('0x1a')];var _0xfd13c6;if(_0xd2801a>=_0xc0a76a){_0xd2801a=_0xc0a76a;_0xfd13c6=0xc8;}else{_0xfd13c6=0xce;}_0x548004[_0xb03d('0x17')](_0xfd13c6);return _0x548004[_0xb03d('0x1d')](_0xb03d('0x1e'),_0x17398a+'-'+_0xd2801a+'/'+_0xc0a76a)[_0xb03d('0x19')](_0x355abf);}return null;};}function patchUpdates(_0x30e9d8){return function(_0xab6623){try{jsonpatch[_0xb03d('0x1f')](_0xab6623,_0x30e9d8,!![]);}catch(_0x491105){return BPromise['reject'](_0x491105);}return _0xab6623[_0xb03d('0x20')]();};}function saveUpdates(_0x382df2,_0x10c907){return function(_0x809c5f){if(_0x809c5f){return _0x809c5f[_0xb03d('0x21')](_0x382df2)['then'](function(_0x380844){return _0x380844;});}return null;};}function removeEntity(_0x4411bb,_0x4b69d3){return function(_0x2e6783){if(_0x2e6783){return _0x2e6783[_0xb03d('0x22')]()['then'](function(){var _0x4262ef=_0x2e6783[_0xb03d('0x23')]({'plain':!![]});var _0x594009=_0xb03d('0x24');return db[_0xb03d('0x25')][_0xb03d('0x22')]({'where':{'type':_0x594009,'resourceId':_0x4262ef['id']}})[_0xb03d('0x26')](function(){return _0x2e6783;});})['then'](function(){_0x4411bb[_0xb03d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23f24c,_0x1bc1d1){return function(_0x339e9f){if(!_0x339e9f){_0x23f24c['sendStatus'](0x194);}return _0x339e9f;};}function handleError(_0x4d9fa5,_0x5c70ad){_0x5c70ad=_0x5c70ad||0x1f4;return function(_0x21c897){logger[_0xb03d('0x27')](_0x21c897[_0xb03d('0x28')]);if(_0x21c897['name']){delete _0x21c897[_0xb03d('0x29')];}_0x4d9fa5[_0xb03d('0x17')](_0x5c70ad)[_0xb03d('0x2a')](_0x21c897);};}exports[_0xb03d('0x2b')]=function(_0x34b17a,_0x49b011){var _0x1bf0c1={},_0x1a0f74={},_0x1eb5e2={'count':0x0,'rows':[]};var _0x20e5f9=_[_0xb03d('0x2c')](db[_0xb03d('0x2d')][_0xb03d('0x2e')],function(_0x241fdf){return{'name':_0x241fdf[_0xb03d('0x2f')],'type':_0x241fdf[_0xb03d('0x30')]['key']};});_0x1a0f74[_0xb03d('0x31')]=_['map'](_0x20e5f9,_0xb03d('0x29'));_0x1a0f74[_0xb03d('0x32')]=_['keys'](_0x34b17a[_0xb03d('0x32')]);_0x1a0f74[_0xb03d('0x33')]=_['intersection'](_0x1a0f74[_0xb03d('0x31')],_0x1a0f74[_0xb03d('0x32')]);_0x1bf0c1[_0xb03d('0x34')]=_['intersection'](_0x1a0f74[_0xb03d('0x31')],qs[_0xb03d('0x35')](_0x34b17a[_0xb03d('0x32')][_0xb03d('0x35')]));_0x1bf0c1[_0xb03d('0x34')]=_0x1bf0c1['attributes']['length']?_0x1bf0c1['attributes']:_0x1a0f74[_0xb03d('0x31')];if(!_0x34b17a['query'][_0xb03d('0x36')]('nolimit')){_0x1bf0c1[_0xb03d('0x1a')]=qs['limit'](_0x34b17a[_0xb03d('0x32')]['limit']);_0x1bf0c1[_0xb03d('0x37')]=qs[_0xb03d('0x37')](_0x34b17a['query'][_0xb03d('0x37')]);}_0x1bf0c1[_0xb03d('0x38')]=qs[_0xb03d('0x39')](_0x34b17a[_0xb03d('0x32')]['sort']);_0x1bf0c1[_0xb03d('0x3a')]=qs[_0xb03d('0x33')](_[_0xb03d('0x3b')](_0x34b17a[_0xb03d('0x32')],_0x1a0f74['filters']),_0x20e5f9);if(_0x34b17a['query'][_0xb03d('0x3c')]){_0x1bf0c1['where']=_[_0xb03d('0x3d')](_0x1bf0c1[_0xb03d('0x3a')],{'$or':_[_0xb03d('0x2c')](_0x20e5f9,function(_0x1d98c7){if(_0x1d98c7[_0xb03d('0x30')]!==_0xb03d('0x3e')){var _0x493e4b={};_0x493e4b[_0x1d98c7['name']]={'$like':'%'+_0x34b17a[_0xb03d('0x32')][_0xb03d('0x3c')]+'%'};return _0x493e4b;}})});}_0x1bf0c1=_['merge']({},_0x1bf0c1,_0x34b17a[_0xb03d('0x3f')]);var _0x1c8402={'where':_0x1bf0c1['where']};return db[_0xb03d('0x2d')]['count'](_0x1c8402)[_0xb03d('0x26')](function(_0x210186){_0x1eb5e2['count']=_0x210186;if(_0x34b17a['query'][_0xb03d('0x40')]){_0x1bf0c1['include']=[{'all':!![]}];}return db[_0xb03d('0x2d')]['findAll'](_0x1bf0c1);})[_0xb03d('0x26')](function(_0x498895){_0x1eb5e2[_0xb03d('0x41')]=_0x498895;return _0x1eb5e2;})[_0xb03d('0x26')](respondWithFilteredResult(_0x49b011,_0x1bf0c1))[_0xb03d('0x42')](handleError(_0x49b011,null));};exports[_0xb03d('0x43')]=function(_0x3fc54f,_0x5f18da){var _0x3ac24a={'raw':!![],'where':{'id':_0x3fc54f[_0xb03d('0x44')]['id']}},_0x39acdf={};_0x39acdf[_0xb03d('0x31')]=_[_0xb03d('0x45')](db[_0xb03d('0x2d')][_0xb03d('0x2e')]);_0x39acdf[_0xb03d('0x32')]=_[_0xb03d('0x45')](_0x3fc54f[_0xb03d('0x32')]);_0x39acdf['filters']=_[_0xb03d('0x46')](_0x39acdf['model'],_0x39acdf[_0xb03d('0x32')]);_0x3ac24a[_0xb03d('0x34')]=_[_0xb03d('0x46')](_0x39acdf[_0xb03d('0x31')],qs[_0xb03d('0x35')](_0x3fc54f['query'][_0xb03d('0x35')]));_0x3ac24a['attributes']=_0x3ac24a[_0xb03d('0x34')]['length']?_0x3ac24a['attributes']:_0x39acdf['model'];if(_0x3fc54f['query']['includeAll']){_0x3ac24a[_0xb03d('0x47')]=[{'all':!![]}];}_0x3ac24a=_[_0xb03d('0x3d')]({},_0x3ac24a,_0x3fc54f['options']);return db['Tag'][_0xb03d('0x48')](_0x3ac24a)[_0xb03d('0x26')](handleEntityNotFound(_0x5f18da,null))[_0xb03d('0x26')](respondWithResult(_0x5f18da,null))[_0xb03d('0x42')](handleError(_0x5f18da,null));};exports[_0xb03d('0x49')]=function(_0xbe0142,_0x30d4c6){return db[_0xb03d('0x2d')]['create'](_0xbe0142[_0xb03d('0x4a')],{})[_0xb03d('0x26')](function(_0x168edb){var _0x4a258f=_0xbe0142[_0xb03d('0x4b')][_0xb03d('0x23')]({'plain':!![]});if(!_0x4a258f)throw new Error(_0xb03d('0x4c'));if(_0x4a258f[_0xb03d('0x4d')]==='user'){var _0x37d345=_0x168edb[_0xb03d('0x23')]({'plain':!![]});var _0x25cf1d=_0xb03d('0x24');return db[_0xb03d('0x4e')][_0xb03d('0x48')]({'where':{'name':_0x25cf1d,'userProfileId':_0x4a258f[_0xb03d('0x4f')]},'raw':!![]})[_0xb03d('0x26')](function(_0x2270ab){if(_0x2270ab&&_0x2270ab[_0xb03d('0x50')]===0x0){return db['UserProfileResource'][_0xb03d('0x49')]({'name':_0x37d345[_0xb03d('0x29')],'resourceId':_0x37d345['id'],'type':_0x2270ab[_0xb03d('0x29')],'sectionId':_0x2270ab['id']},{})[_0xb03d('0x26')](function(){return _0x168edb;});}else{return _0x168edb;}})['catch'](function(_0x29c5f8){logger[_0xb03d('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29c5f8);throw _0x29c5f8;});}return _0x168edb;})['then'](respondWithResult(_0x30d4c6,0xc9))[_0xb03d('0x42')](handleError(_0x30d4c6,null));};exports[_0xb03d('0x21')]=function(_0x10138b,_0x35e0a1){if(_0x10138b[_0xb03d('0x4a')]['id']){delete _0x10138b[_0xb03d('0x4a')]['id'];}return db['Tag']['find']({'where':{'id':_0x10138b['params']['id']}})[_0xb03d('0x26')](handleEntityNotFound(_0x35e0a1,null))[_0xb03d('0x26')](saveUpdates(_0x10138b['body'],null))[_0xb03d('0x26')](respondWithResult(_0x35e0a1,null))[_0xb03d('0x42')](handleError(_0x35e0a1,null));};exports['destroy']=function(_0x337f1d,_0x210de5){return db[_0xb03d('0x2d')][_0xb03d('0x48')]({'where':{'id':_0x337f1d['params']['id']}})[_0xb03d('0x26')](handleEntityNotFound(_0x210de5,null))[_0xb03d('0x26')](removeEntity(_0x210de5,null))[_0xb03d('0x42')](handleError(_0x210de5,null));};exports[_0xb03d('0x51')]=function(_0x3b1cf3,_0x53a89b){return db[_0xb03d('0x2d')][_0xb03d('0x51')]()['then'](respondWithResult(_0x53a89b,null))['catch'](handleError(_0x53a89b,null));}; \ No newline at end of file +var _0xea4e=['Tag','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','include','rows','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','eml-format','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','save','update','then','get','destroy','error','stack','name','send'];(function(_0x3da199,_0x3f81a8){var _0x362638=function(_0x2852fa){while(--_0x2852fa){_0x3da199['push'](_0x3da199['shift']());}};_0x362638(++_0x3f81a8);}(_0xea4e,0x10c));var _0xeea4=function(_0x346962,_0x4f69d6){_0x346962=_0x346962-0x0;var _0x3f2a3d=_0xea4e[_0x346962];return _0x3f2a3d;};'use strict';var emlformat=require(_0xeea4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeea4('0x1'));var moment=require('moment');var BPromise=require(_0xeea4('0x2'));var Mustache=require(_0xeea4('0x3'));var util=require('util');var path=require(_0xeea4('0x4'));var sox=require(_0xeea4('0x5'));var csv=require(_0xeea4('0x6'));var ejs=require(_0xeea4('0x7'));var fs=require('fs');var fs_extra=require(_0xeea4('0x8'));var _=require(_0xeea4('0x9'));var squel=require(_0xeea4('0xa'));var crypto=require(_0xeea4('0xb'));var jsforce=require(_0xeea4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xeea4('0x6'));var querystring=require('querystring');var Papa=require(_0xeea4('0xd'));var Redis=require(_0xeea4('0xe'));var authService=require(_0xeea4('0xf'));var qs=require(_0xeea4('0x10'));var as=require(_0xeea4('0x11'));var hardwareService=require(_0xeea4('0x12'));var logger=require(_0xeea4('0x13'))(_0xeea4('0x14'));var utils=require('../../config/utils');var config=require(_0xeea4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xeea4('0x16'))['db'];function respondWithStatusCode(_0x216785,_0x3c18ed){_0x3c18ed=_0x3c18ed||0xcc;return function(_0x3dbf8c){if(_0x3dbf8c){return _0x216785[_0xeea4('0x17')](_0x3c18ed);}return _0x216785[_0xeea4('0x18')](_0x3c18ed)[_0xeea4('0x19')]();};}function respondWithResult(_0x9d04aa,_0x4d6605){_0x4d6605=_0x4d6605||0xc8;return function(_0x169fc5){if(_0x169fc5){return _0x9d04aa[_0xeea4('0x18')](_0x4d6605)['json'](_0x169fc5);}};}function respondWithFilteredResult(_0x44f13a,_0x4d47b0){return function(_0x2d5a6c){if(_0x2d5a6c){var _0x44f573=typeof _0x4d47b0[_0xeea4('0x1a')]===_0xeea4('0x1b')&&typeof _0x4d47b0[_0xeea4('0x1c')]===_0xeea4('0x1b');var _0x37cd8e=_0x2d5a6c[_0xeea4('0x1d')];var _0x26d8f4=_0x44f573?0x0:_0x4d47b0[_0xeea4('0x1a')];var _0x4ae372=_0x44f573?_0x2d5a6c[_0xeea4('0x1d')]:_0x4d47b0[_0xeea4('0x1a')]+_0x4d47b0['limit'];var _0x36a9b3;if(_0x4ae372>=_0x37cd8e){_0x4ae372=_0x37cd8e;_0x36a9b3=0xc8;}else{_0x36a9b3=0xce;}_0x44f13a[_0xeea4('0x18')](_0x36a9b3);return _0x44f13a['set'](_0xeea4('0x1e'),_0x26d8f4+'-'+_0x4ae372+'/'+_0x37cd8e)['json'](_0x2d5a6c);}return null;};}function patchUpdates(_0x3f7316){return function(_0x54cf4d){try{jsonpatch['apply'](_0x54cf4d,_0x3f7316,!![]);}catch(_0x3756ad){return BPromise['reject'](_0x3756ad);}return _0x54cf4d[_0xeea4('0x1f')]();};}function saveUpdates(_0x12ba5b,_0x3e162c){return function(_0x19b2a8){if(_0x19b2a8){return _0x19b2a8[_0xeea4('0x20')](_0x12ba5b)['then'](function(_0x3f2cd2){return _0x3f2cd2;});}return null;};}function removeEntity(_0x88ab4f,_0x290983){return function(_0x31dab){if(_0x31dab){return _0x31dab['destroy']()[_0xeea4('0x21')](function(){var _0x71112e=_0x31dab[_0xeea4('0x22')]({'plain':!![]});var _0x433825='Tags';return db['UserProfileResource'][_0xeea4('0x23')]({'where':{'type':_0x433825,'resourceId':_0x71112e['id']}})[_0xeea4('0x21')](function(){return _0x31dab;});})[_0xeea4('0x21')](function(){_0x88ab4f[_0xeea4('0x18')](0xcc)[_0xeea4('0x19')]();});}};}function handleEntityNotFound(_0x5b35e1,_0x15aaa4){return function(_0x300d43){if(!_0x300d43){_0x5b35e1['sendStatus'](0x194);}return _0x300d43;};}function handleError(_0x14eb8f,_0x4eab6f){_0x4eab6f=_0x4eab6f||0x1f4;return function(_0x4a3a7e){logger[_0xeea4('0x24')](_0x4a3a7e[_0xeea4('0x25')]);if(_0x4a3a7e[_0xeea4('0x26')]){delete _0x4a3a7e[_0xeea4('0x26')];}_0x14eb8f[_0xeea4('0x18')](_0x4eab6f)[_0xeea4('0x27')](_0x4a3a7e);};}exports['index']=function(_0x2a0c55,_0x4d68d8){var _0x5a2087={},_0x48a047={},_0x5ac93f={'count':0x0,'rows':[]};var _0x2b360c=_['map'](db[_0xeea4('0x28')][_0xeea4('0x29')],function(_0x247d64){return{'name':_0x247d64[_0xeea4('0x2a')],'type':_0x247d64[_0xeea4('0x2b')]['key']};});_0x48a047[_0xeea4('0x2c')]=_[_0xeea4('0x2d')](_0x2b360c,_0xeea4('0x26'));_0x48a047['query']=_[_0xeea4('0x2e')](_0x2a0c55[_0xeea4('0x2f')]);_0x48a047[_0xeea4('0x30')]=_[_0xeea4('0x31')](_0x48a047[_0xeea4('0x2c')],_0x48a047[_0xeea4('0x2f')]);_0x5a2087[_0xeea4('0x32')]=_[_0xeea4('0x31')](_0x48a047[_0xeea4('0x2c')],qs[_0xeea4('0x33')](_0x2a0c55['query']['fields']));_0x5a2087[_0xeea4('0x32')]=_0x5a2087[_0xeea4('0x32')][_0xeea4('0x34')]?_0x5a2087[_0xeea4('0x32')]:_0x48a047[_0xeea4('0x2c')];if(!_0x2a0c55[_0xeea4('0x2f')][_0xeea4('0x35')]('nolimit')){_0x5a2087[_0xeea4('0x1c')]=qs[_0xeea4('0x1c')](_0x2a0c55[_0xeea4('0x2f')]['limit']);_0x5a2087[_0xeea4('0x1a')]=qs[_0xeea4('0x1a')](_0x2a0c55['query'][_0xeea4('0x1a')]);}_0x5a2087[_0xeea4('0x36')]=qs[_0xeea4('0x37')](_0x2a0c55[_0xeea4('0x2f')][_0xeea4('0x37')]);_0x5a2087[_0xeea4('0x38')]=qs[_0xeea4('0x30')](_[_0xeea4('0x39')](_0x2a0c55['query'],_0x48a047[_0xeea4('0x30')]),_0x2b360c);if(_0x2a0c55[_0xeea4('0x2f')]['filter']){_0x5a2087[_0xeea4('0x38')]=_[_0xeea4('0x3a')](_0x5a2087[_0xeea4('0x38')],{'$or':_[_0xeea4('0x2d')](_0x2b360c,function(_0x3a0cff){if(_0x3a0cff[_0xeea4('0x2b')]!==_0xeea4('0x3b')){var _0x4ad5e3={};_0x4ad5e3[_0x3a0cff[_0xeea4('0x26')]]={'$like':'%'+_0x2a0c55[_0xeea4('0x2f')]['filter']+'%'};return _0x4ad5e3;}})});}_0x5a2087=_[_0xeea4('0x3a')]({},_0x5a2087,_0x2a0c55['options']);var _0x20bc69={'where':_0x5a2087[_0xeea4('0x38')]};return db['Tag']['count'](_0x20bc69)[_0xeea4('0x21')](function(_0x4d1512){_0x5ac93f[_0xeea4('0x1d')]=_0x4d1512;if(_0x2a0c55[_0xeea4('0x2f')]['includeAll']){_0x5a2087[_0xeea4('0x3c')]=[{'all':!![]}];}return db[_0xeea4('0x28')]['findAll'](_0x5a2087);})[_0xeea4('0x21')](function(_0x13a30c){_0x5ac93f[_0xeea4('0x3d')]=_0x13a30c;return _0x5ac93f;})[_0xeea4('0x21')](respondWithFilteredResult(_0x4d68d8,_0x5a2087))[_0xeea4('0x3e')](handleError(_0x4d68d8,null));};exports[_0xeea4('0x3f')]=function(_0x27e848,_0x59fcbe){var _0x3c732c={'raw':!![],'where':{'id':_0x27e848[_0xeea4('0x40')]['id']}},_0x28ac42={};_0x28ac42[_0xeea4('0x2c')]=_['keys'](db[_0xeea4('0x28')][_0xeea4('0x29')]);_0x28ac42[_0xeea4('0x2f')]=_['keys'](_0x27e848['query']);_0x28ac42[_0xeea4('0x30')]=_[_0xeea4('0x31')](_0x28ac42['model'],_0x28ac42['query']);_0x3c732c[_0xeea4('0x32')]=_[_0xeea4('0x31')](_0x28ac42[_0xeea4('0x2c')],qs[_0xeea4('0x33')](_0x27e848[_0xeea4('0x2f')]['fields']));_0x3c732c[_0xeea4('0x32')]=_0x3c732c['attributes'][_0xeea4('0x34')]?_0x3c732c[_0xeea4('0x32')]:_0x28ac42[_0xeea4('0x2c')];if(_0x27e848['query'][_0xeea4('0x41')]){_0x3c732c['include']=[{'all':!![]}];}_0x3c732c=_['merge']({},_0x3c732c,_0x27e848[_0xeea4('0x42')]);return db[_0xeea4('0x28')][_0xeea4('0x43')](_0x3c732c)[_0xeea4('0x21')](handleEntityNotFound(_0x59fcbe,null))['then'](respondWithResult(_0x59fcbe,null))['catch'](handleError(_0x59fcbe,null));};exports[_0xeea4('0x44')]=function(_0x18bb53,_0x208282){return db['Tag'][_0xeea4('0x44')](_0x18bb53[_0xeea4('0x45')],{})['then'](function(_0x4913b9){var _0x47eac8=_0x18bb53[_0xeea4('0x46')][_0xeea4('0x22')]({'plain':!![]});if(!_0x47eac8)throw new Error(_0xeea4('0x47'));if(_0x47eac8[_0xeea4('0x48')]===_0xeea4('0x46')){var _0x2bc6e6=_0x4913b9[_0xeea4('0x22')]({'plain':!![]});var _0x471825='Tags';return db['UserProfileSection'][_0xeea4('0x43')]({'where':{'name':_0x471825,'userProfileId':_0x47eac8['userProfileId']},'raw':!![]})[_0xeea4('0x21')](function(_0x51b285){if(_0x51b285&&_0x51b285[_0xeea4('0x49')]===0x0){return db[_0xeea4('0x4a')]['create']({'name':_0x2bc6e6[_0xeea4('0x26')],'resourceId':_0x2bc6e6['id'],'type':_0x51b285[_0xeea4('0x26')],'sectionId':_0x51b285['id']},{})[_0xeea4('0x21')](function(){return _0x4913b9;});}else{return _0x4913b9;}})['catch'](function(_0x23d152){logger[_0xeea4('0x24')](_0xeea4('0x4b'),_0x23d152);throw _0x23d152;});}return _0x4913b9;})['then'](respondWithResult(_0x208282,0xc9))[_0xeea4('0x3e')](handleError(_0x208282,null));};exports[_0xeea4('0x20')]=function(_0x40211c,_0x420089){if(_0x40211c[_0xeea4('0x45')]['id']){delete _0x40211c[_0xeea4('0x45')]['id'];}return db[_0xeea4('0x28')][_0xeea4('0x43')]({'where':{'id':_0x40211c[_0xeea4('0x40')]['id']}})[_0xeea4('0x21')](handleEntityNotFound(_0x420089,null))[_0xeea4('0x21')](saveUpdates(_0x40211c[_0xeea4('0x45')],null))[_0xeea4('0x21')](respondWithResult(_0x420089,null))['catch'](handleError(_0x420089,null));};exports[_0xeea4('0x23')]=function(_0x529edc,_0x513eaa){return db[_0xeea4('0x28')]['find']({'where':{'id':_0x529edc[_0xeea4('0x40')]['id']}})[_0xeea4('0x21')](handleEntityNotFound(_0x513eaa,null))[_0xeea4('0x21')](removeEntity(_0x513eaa,null))['catch'](handleError(_0x513eaa,null));};exports[_0xeea4('0x4c')]=function(_0x50254e,_0x12d14e){return db[_0xeea4('0x28')][_0xeea4('0x4c')]()[_0xeea4('0x21')](respondWithResult(_0x12d14e,null))[_0xeea4('0x3e')](handleError(_0x12d14e,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 2ed1743..578c39f 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 _0x99f5=['path','rimraf','../../config/environment','./tag.attributes','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x99f5,0x7b));var _0x599f=function(_0x5d4ba3,_0x5b8895){_0x5d4ba3=_0x5d4ba3-0x0;var _0x258dfa=_0x99f5[_0x5d4ba3];return _0x258dfa;};'use strict';var _=require(_0x599f('0x0'));var util=require(_0x599f('0x1'));var logger=require(_0x599f('0x2'))(_0x599f('0x3'));var moment=require(_0x599f('0x4'));var BPromise=require(_0x599f('0x5'));var rp=require(_0x599f('0x6'));var fs=require('fs');var path=require(_0x599f('0x7'));var rimraf=require(_0x599f('0x8'));var config=require(_0x599f('0x9'));var attributes=require(_0x599f('0xa'));module['exports']=function(_0x147aab,_0x168dd6){return _0x147aab['define'](_0x599f('0xb'),attributes,{'tableName':_0x599f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec6b=['path','rimraf','Tag','lodash','util','api','bluebird'];(function(_0x4af35e,_0x5946d6){var _0x2303e7=function(_0x2e802e){while(--_0x2e802e){_0x4af35e['push'](_0x4af35e['shift']());}};_0x2303e7(++_0x5946d6);}(_0xec6b,0x129));var _0xbec6=function(_0x4b8a0c,_0x2e2d1b){_0x4b8a0c=_0x4b8a0c-0x0;var _0x266ea8=_0xec6b[_0x4b8a0c];return _0x266ea8;};'use strict';var _=require(_0xbec6('0x0'));var util=require(_0xbec6('0x1'));var logger=require('../../config/logger')(_0xbec6('0x2'));var moment=require('moment');var BPromise=require(_0xbec6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbec6('0x4'));var rimraf=require(_0xbec6('0x5'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module['exports']=function(_0x5c3383,_0x533245){return _0x5c3383['define'](_0xbec6('0x6'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 4705e79..80e8d95 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 _0x55e0=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x55e0,0xdc));var _0x055e=function(_0x12c0fe,_0x469071){_0x12c0fe=_0x12c0fe-0x0;var _0x33333f=_0x55e0[_0x12c0fe];return _0x33333f;};'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});function respondWithRpcPromise(_0x4384ff,_0x4a442e,_0x8e7824){return new BPromise(function(_0x3c4cf,_0x376618){return client[_0x055e('0xa')](_0x4384ff,_0x8e7824)[_0x055e('0xb')](function(_0x49540c){logger[_0x055e('0xc')](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));logger[_0x055e('0xf')](_0x055e('0x10'),_0x4a442e,'request\x20sent',JSON['stringify'](_0x49540c));if(_0x49540c[_0x055e('0x11')]){if(_0x49540c['error'][_0x055e('0x12')]===0x1f4){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x376618(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}logger['error'](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x3c4cf(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}else{logger['info'](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));_0x3c4cf(_0x49540c[_0x055e('0x14')]['message']);}})[_0x055e('0x15')](function(_0x2c377c){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x2c377c);_0x376618(_0x2c377c);});});} \ No newline at end of file +var _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x3ce852,_0x4f0c03){var _0x386ba4=function(_0x50abfa){while(--_0x50abfa){_0x3ce852['push'](_0x3ce852['shift']());}};_0x386ba4(++_0x4f0c03);}(_0x54ef,0x112));var _0xf54e=function(_0xeb9b2d,_0x29002e){_0xeb9b2d=_0xeb9b2d-0x0;var _0xeb53d1=_0x54ef[_0xeb9b2d];return _0xeb53d1;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('Tag,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('Tag,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('Tag,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 350cb2b..6b38fb8 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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 a78884a..ab27b87 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 _0xb10b=['name','sequelize','STRING'];(function(_0x4b7c46,_0x3e872b){var _0x595d28=function(_0x611d6e){while(--_0x611d6e){_0x4b7c46['push'](_0x4b7c46['shift']());}};_0x595d28(++_0x3e872b);}(_0xb10b,0x12a));var _0xbb10=function(_0x26b5cb,_0x15f879){_0x26b5cb=_0x26b5cb-0x0;var _0x3b2277=_0xb10b[_0x26b5cb];return _0x3b2277;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x53d031,_0x35f294){var _0x5a0d0b=function(_0x170095){while(--_0x170095){_0x53d031['push'](_0x53d031['shift']());}};_0x5a0d0b(++_0x35f294);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 9eb64f2..b62cb07 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 _0xa33f=['Openchannel','Whatsapp','penalty','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','QueueId','voicePause','interface','upsert','isNil','format','SIP/%s','all','spread','removeAgents','isArray','Mail','Sms','Queue:remove','UserVoiceQueueRt','getAgents','filter','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','defaults','redis','localhost','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','get','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','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','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','UserProfileResource','getQueues','findOne','channel','isValidChannel','Unknown\x20channel','toLowerCase','Queue','length','pick','capitalize','Queues','add','ids','removeQueues','remove','addAgents','Voice','Chat','Fax'];(function(_0xd63e3a,_0x1bd6eb){var _0x19c178=function(_0x56be0d){while(--_0x56be0d){_0xd63e3a['push'](_0xd63e3a['shift']());}};_0x19c178(++_0x1bd6eb);}(_0xa33f,0xbb));var _0xfa33=function(_0x5a2278,_0x138166){_0x5a2278=_0x5a2278-0x0;var _0x2b71b5=_0xa33f[_0x5a2278];return _0x2b71b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfa33('0x0'));var zipdir=require(_0xfa33('0x1'));var jsonpatch=require(_0xfa33('0x2'));var rp=require(_0xfa33('0x3'));var moment=require('moment');var BPromise=require(_0xfa33('0x4'));var Mustache=require(_0xfa33('0x5'));var util=require(_0xfa33('0x6'));var path=require(_0xfa33('0x7'));var sox=require(_0xfa33('0x8'));var csv=require(_0xfa33('0x9'));var ejs=require(_0xfa33('0xa'));var fs=require('fs');var fs_extra=require(_0xfa33('0xb'));var _=require(_0xfa33('0xc'));var squel=require(_0xfa33('0xd'));var crypto=require(_0xfa33('0xe'));var jsforce=require(_0xfa33('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfa33('0x9'));var querystring=require(_0xfa33('0x10'));var Papa=require(_0xfa33('0x11'));var Redis=require(_0xfa33('0x12'));var authService=require(_0xfa33('0x13'));var qs=require(_0xfa33('0x14'));var as=require(_0xfa33('0x15'));var hardwareService=require(_0xfa33('0x16'));var logger=require(_0xfa33('0x17'))(_0xfa33('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfa33('0x19'))['db'];config['redis']=_[_0xfa33('0x1a')](config[_0xfa33('0x1b')],{'host':_0xfa33('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa33('0x1b')]));require(_0xfa33('0x1d'))[_0xfa33('0x1e')](socket);function respondWithStatusCode(_0x5f171d,_0x279566){_0x279566=_0x279566||0xcc;return function(_0x31f7af){if(_0x31f7af){return _0x5f171d[_0xfa33('0x1f')](_0x279566);}return _0x5f171d[_0xfa33('0x20')](_0x279566)[_0xfa33('0x21')]();};}function respondWithResult(_0x22b251,_0xad2bee){_0xad2bee=_0xad2bee||0xc8;return function(_0x1861da){if(_0x1861da){return _0x22b251[_0xfa33('0x20')](_0xad2bee)[_0xfa33('0x22')](_0x1861da);}};}function respondWithFilteredResult(_0x578ac4,_0x4047f6){return function(_0x3e95c1){if(_0x3e95c1){var _0x302524=typeof _0x4047f6[_0xfa33('0x23')]===_0xfa33('0x24')&&typeof _0x4047f6[_0xfa33('0x25')]==='undefined';var _0x42c54c=_0x3e95c1['count'];var _0x3332e5=_0x302524?0x0:_0x4047f6['offset'];var _0x56fb0a=_0x302524?_0x3e95c1[_0xfa33('0x26')]:_0x4047f6['offset']+_0x4047f6['limit'];var _0x1a934b;if(_0x56fb0a>=_0x42c54c){_0x56fb0a=_0x42c54c;_0x1a934b=0xc8;}else{_0x1a934b=0xce;}_0x578ac4[_0xfa33('0x20')](_0x1a934b);return _0x578ac4['set'](_0xfa33('0x27'),_0x3332e5+'-'+_0x56fb0a+'/'+_0x42c54c)[_0xfa33('0x22')](_0x3e95c1);}return null;};}function patchUpdates(_0x486b2e){return function(_0x1b31ce){try{jsonpatch[_0xfa33('0x28')](_0x1b31ce,_0x486b2e,!![]);}catch(_0x36a247){return BPromise['reject'](_0x36a247);}return _0x1b31ce['save']();};}function saveUpdates(_0x48266e,_0x197817){return function(_0xca407f){if(_0xca407f){return _0xca407f[_0xfa33('0x29')](_0x48266e)[_0xfa33('0x2a')](function(_0x1e334a){return _0x1e334a;});}return null;};}function handleEntityNotFound(_0x2175e3,_0x4927a1){return function(_0x704052){if(!_0x704052){_0x2175e3[_0xfa33('0x1f')](0x194);}return _0x704052;};}function handleError(_0x3a388e,_0xcd7726){_0xcd7726=_0xcd7726||0x1f4;return function(_0x42eb68){logger[_0xfa33('0x2b')](_0x42eb68[_0xfa33('0x2c')]);if(_0x42eb68[_0xfa33('0x2d')]){delete _0x42eb68[_0xfa33('0x2d')];}_0x3a388e['status'](_0xcd7726)[_0xfa33('0x2e')](_0x42eb68);};}exports[_0xfa33('0x2f')]=function(_0x240642,_0x2e712f){var _0x3e94ad={},_0x15241c={},_0x15cf0f={'count':0x0,'rows':[]};var _0x27fbdd=_[_0xfa33('0x30')](db[_0xfa33('0x31')][_0xfa33('0x32')],function(_0x4b326e){return{'name':_0x4b326e[_0xfa33('0x33')],'type':_0x4b326e[_0xfa33('0x34')][_0xfa33('0x35')]};});_0x15241c[_0xfa33('0x36')]=_[_0xfa33('0x30')](_0x27fbdd,_0xfa33('0x2d'));_0x15241c[_0xfa33('0x37')]=_[_0xfa33('0x38')](_0x240642[_0xfa33('0x37')]);_0x15241c[_0xfa33('0x39')]=_[_0xfa33('0x3a')](_0x15241c[_0xfa33('0x36')],_0x15241c[_0xfa33('0x37')]);_0x3e94ad['attributes']=_[_0xfa33('0x3a')](_0x15241c[_0xfa33('0x36')],qs['fields'](_0x240642[_0xfa33('0x37')][_0xfa33('0x3b')]));_0x3e94ad[_0xfa33('0x3c')]=_0x3e94ad[_0xfa33('0x3c')]['length']?_0x3e94ad[_0xfa33('0x3c')]:_0x15241c[_0xfa33('0x36')];if(!_0x240642[_0xfa33('0x37')][_0xfa33('0x3d')](_0xfa33('0x3e'))){_0x3e94ad[_0xfa33('0x25')]=qs['limit'](_0x240642[_0xfa33('0x37')][_0xfa33('0x25')]);_0x3e94ad['offset']=qs[_0xfa33('0x23')](_0x240642[_0xfa33('0x37')][_0xfa33('0x23')]);}_0x3e94ad[_0xfa33('0x3f')]=qs[_0xfa33('0x40')](_0x240642['query']['sort']);_0x3e94ad[_0xfa33('0x41')]=qs[_0xfa33('0x39')](_['pick'](_0x240642[_0xfa33('0x37')],_0x15241c[_0xfa33('0x39')]),_0x27fbdd);if(_0x240642[_0xfa33('0x37')]['filter']){_0x3e94ad[_0xfa33('0x41')]=_[_0xfa33('0x42')](_0x3e94ad['where'],{'$or':_[_0xfa33('0x30')](_0x27fbdd,function(_0x28132a){if(_0x28132a[_0xfa33('0x34')]!==_0xfa33('0x43')){var _0x3b459b={};_0x3b459b[_0x28132a[_0xfa33('0x2d')]]={'$like':'%'+_0x240642[_0xfa33('0x37')]['filter']+'%'};return _0x3b459b;}})});}_0x3e94ad=_[_0xfa33('0x42')]({},_0x3e94ad,_0x240642['options']);var _0x554a4b={'where':_0x3e94ad[_0xfa33('0x41')]};return db[_0xfa33('0x31')][_0xfa33('0x26')](_0x554a4b)['then'](function(_0x366c05){_0x15cf0f[_0xfa33('0x26')]=_0x366c05;if(_0x240642[_0xfa33('0x37')]['includeAll']){_0x3e94ad[_0xfa33('0x44')]=[{'all':!![]}];}return db[_0xfa33('0x31')][_0xfa33('0x45')](_0x3e94ad);})[_0xfa33('0x2a')](function(_0x464be5){_0x15cf0f[_0xfa33('0x46')]=_0x464be5;return _0x15cf0f;})['then'](respondWithFilteredResult(_0x2e712f,_0x3e94ad))[_0xfa33('0x47')](handleError(_0x2e712f,null));};exports[_0xfa33('0x48')]=function(_0x659323,_0x5290eb){var _0x5846f7={'raw':![],'where':{'id':_0x659323[_0xfa33('0x49')]['id']}},_0x6d70cb={};_0x6d70cb['model']=_['keys'](db[_0xfa33('0x31')][_0xfa33('0x32')]);_0x6d70cb['query']=_[_0xfa33('0x38')](_0x659323[_0xfa33('0x37')]);_0x6d70cb[_0xfa33('0x39')]=_[_0xfa33('0x3a')](_0x6d70cb[_0xfa33('0x36')],_0x6d70cb['query']);_0x5846f7[_0xfa33('0x3c')]=_[_0xfa33('0x3a')](_0x6d70cb[_0xfa33('0x36')],qs[_0xfa33('0x3b')](_0x659323[_0xfa33('0x37')]['fields']));_0x5846f7[_0xfa33('0x3c')]=_0x5846f7[_0xfa33('0x3c')]['length']?_0x5846f7['attributes']:_0x6d70cb[_0xfa33('0x36')];if(_0x659323[_0xfa33('0x37')][_0xfa33('0x4a')]){_0x5846f7[_0xfa33('0x44')]=[{'all':!![]}];}_0x5846f7=_[_0xfa33('0x42')]({},_0x5846f7,_0x659323[_0xfa33('0x4b')]);return db['Team'][_0xfa33('0x4c')](_0x5846f7)[_0xfa33('0x2a')](handleEntityNotFound(_0x5290eb,null))[_0xfa33('0x2a')](respondWithResult(_0x5290eb,null))[_0xfa33('0x47')](handleError(_0x5290eb,null));};exports['create']=function(_0x3dd672,_0x506293){return db[_0xfa33('0x31')][_0xfa33('0x4d')](_0x3dd672[_0xfa33('0x4e')],{})[_0xfa33('0x2a')](function(_0x5e7f4f){var _0x1811e6=_0x3dd672['user'][_0xfa33('0x4f')]({'plain':!![]});if(!_0x1811e6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1811e6[_0xfa33('0x50')]===_0xfa33('0x51')){var _0x1015bb=_0x5e7f4f[_0xfa33('0x4f')]({'plain':!![]});var _0x6dd1ed=_0xfa33('0x52');return db[_0xfa33('0x53')]['find']({'where':{'name':_0x6dd1ed,'userProfileId':_0x1811e6[_0xfa33('0x54')]},'raw':!![]})[_0xfa33('0x2a')](function(_0x4c6705){if(_0x4c6705&&_0x4c6705[_0xfa33('0x55')]===0x0){return db['UserProfileResource'][_0xfa33('0x4d')]({'name':_0x1015bb[_0xfa33('0x2d')],'resourceId':_0x1015bb['id'],'type':_0x4c6705['name'],'sectionId':_0x4c6705['id']},{})[_0xfa33('0x2a')](function(){return _0x5e7f4f;});}else{return _0x5e7f4f;}})[_0xfa33('0x47')](function(_0x4ef096){logger['error'](_0xfa33('0x56'),_0x4ef096);throw _0x4ef096;});}return _0x5e7f4f;})[_0xfa33('0x2a')](respondWithResult(_0x506293,0xc9))[_0xfa33('0x47')](handleError(_0x506293,null));};exports[_0xfa33('0x29')]=function(_0x5c039f,_0x5a66a4){if(_0x5c039f[_0xfa33('0x4e')]['id']){delete _0x5c039f['body']['id'];}return db[_0xfa33('0x31')][_0xfa33('0x4c')]({'where':{'id':_0x5c039f['params']['id']}})['then'](handleEntityNotFound(_0x5a66a4,null))[_0xfa33('0x2a')](saveUpdates(_0x5c039f[_0xfa33('0x4e')],null))[_0xfa33('0x2a')](respondWithResult(_0x5a66a4,null))[_0xfa33('0x47')](handleError(_0x5a66a4,null));};exports[_0xfa33('0x57')]=function(_0x4b7eb8,_0x2c1fc5){var _0x3c94db=_0x4b7eb8[_0xfa33('0x49')]['id'];var _0xcf2af7=[];return db[_0xfa33('0x58')][_0xfa33('0x59')](function(_0x1dd4d5){var _0x20597a=_0xfa33('0x5a')+_0x3c94db;return db[_0xfa33('0x58')]['query'](_0x20597a,{'type':db[_0xfa33('0x5b')][_0xfa33('0x5c')]['SELECT'],'raw':!![],'transaction':_0x1dd4d5})[_0xfa33('0x2a')](function(_0x3911e6){_0xcf2af7=_['map'](_0x3911e6,function(_0x415876){return Number(_0x415876[_0xfa33('0x5d')]);});})[_0xfa33('0x2a')](function(){var _0x302c05=_0xfa33('0x5e')+_0x3c94db;return db[_0xfa33('0x58')][_0xfa33('0x37')](_0x302c05,{'type':db[_0xfa33('0x5b')]['QueryTypes'][_0xfa33('0x5f')],'raw':!![],'transaction':_0x1dd4d5});})[_0xfa33('0x2a')](function(_0x4b8985){var _0x444843=_[_0xfa33('0x30')](_0x4b8985,function(_0x14d723){return Number(_0x14d723[_0xfa33('0x60')]);});return db[_0xfa33('0x61')][_0xfa33('0x57')]({'where':{'UserId':{'$in':_0xcf2af7},'VoiceQueueId':{'$in':_0x444843}},'transaction':_0x1dd4d5});})[_0xfa33('0x2a')](function(){var _0x268fcd='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3c94db;return db[_0xfa33('0x58')][_0xfa33('0x37')](_0x268fcd,{'type':db[_0xfa33('0x5b')][_0xfa33('0x5c')][_0xfa33('0x5f')],'raw':!![],'transaction':_0x1dd4d5});})[_0xfa33('0x2a')](function(_0x2c640c){var _0x5b58c8=_[_0xfa33('0x30')](_0x2c640c,function(_0x59527d){return Number(_0x59527d[_0xfa33('0x62')]);});return db['UserMailQueue']['destroy']({'where':{'UserId':{'$in':_0xcf2af7},'MailQueueId':{'$in':_0x5b58c8}},'transaction':_0x1dd4d5});})[_0xfa33('0x2a')](function(){var _0x596f03=_0xfa33('0x63')+_0x3c94db;return db[_0xfa33('0x58')]['query'](_0x596f03,{'type':db[_0xfa33('0x5b')][_0xfa33('0x5c')][_0xfa33('0x5f')],'raw':!![],'transaction':_0x1dd4d5});})[_0xfa33('0x2a')](function(_0x2f0c11){var _0x286666=_[_0xfa33('0x30')](_0x2f0c11,function(_0x2e5be6){return Number(_0x2e5be6[_0xfa33('0x64')]);});return db[_0xfa33('0x65')][_0xfa33('0x57')]({'where':{'UserId':{'$in':_0xcf2af7},'SmsQueueId':{'$in':_0x286666}},'transaction':_0x1dd4d5});})['then'](function(){var _0x48272e=_0xfa33('0x66')+_0x3c94db;return db[_0xfa33('0x58')]['query'](_0x48272e,{'type':db[_0xfa33('0x5b')][_0xfa33('0x5c')][_0xfa33('0x5f')],'raw':!![],'transaction':_0x1dd4d5});})['then'](function(_0x43412f){var _0x2e6a23=_[_0xfa33('0x30')](_0x43412f,function(_0x29abe1){return Number(_0x29abe1[_0xfa33('0x67')]);});return db[_0xfa33('0x68')][_0xfa33('0x57')]({'where':{'UserId':{'$in':_0xcf2af7},'ChatQueueId':{'$in':_0x2e6a23}},'transaction':_0x1dd4d5});})[_0xfa33('0x2a')](function(){var _0x3c8cac=_0xfa33('0x69')+_0x3c94db;return db[_0xfa33('0x58')]['query'](_0x3c8cac,{'type':db['Sequelize'][_0xfa33('0x5c')][_0xfa33('0x5f')],'raw':!![],'transaction':_0x1dd4d5});})[_0xfa33('0x2a')](function(_0x46c582){var _0x1a21bd=_[_0xfa33('0x30')](_0x46c582,function(_0x284aba){return Number(_0x284aba[_0xfa33('0x6a')]);});return db[_0xfa33('0x6b')][_0xfa33('0x57')]({'where':{'UserId':{'$in':_0xcf2af7},'FaxQueueId':{'$in':_0x1a21bd}},'transaction':_0x1dd4d5});})[_0xfa33('0x2a')](function(){var _0x1d4b09=_0xfa33('0x6c')+_0x3c94db;return db['sequelize']['query'](_0x1d4b09,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x1dd4d5});})[_0xfa33('0x2a')](function(_0x3cbf23){var _0x46d5e6=_[_0xfa33('0x30')](_0x3cbf23,function(_0x52c899){return Number(_0x52c899[_0xfa33('0x6d')]);});return db[_0xfa33('0x6e')][_0xfa33('0x57')]({'where':{'UserId':{'$in':_0xcf2af7},'OpenchannelQueueId':{'$in':_0x46d5e6}},'transaction':_0x1dd4d5});})[_0xfa33('0x2a')](function(){var _0x5e4e13=_0xfa33('0x6f')+_0x3c94db;return db[_0xfa33('0x58')][_0xfa33('0x37')](_0x5e4e13,{'type':db[_0xfa33('0x5b')][_0xfa33('0x5c')][_0xfa33('0x5f')],'raw':!![],'transaction':_0x1dd4d5});})[_0xfa33('0x2a')](function(_0x2e6acc){var _0x4baf7a=_[_0xfa33('0x30')](_0x2e6acc,function(_0x4c392c){return Number(_0x4c392c[_0xfa33('0x70')]);});return db[_0xfa33('0x71')][_0xfa33('0x57')]({'where':{'UserId':{'$in':_0xcf2af7},'WhatsappQueueId':{'$in':_0x4baf7a}},'transaction':_0x1dd4d5});})['then'](function(){return db[_0xfa33('0x72')][_0xfa33('0x4c')]({'where':{'TeamId':_0x3c94db}});})[_0xfa33('0x2a')](function(_0x51846f){if(_0x51846f===null){return;}return db[_0xfa33('0x73')][_0xfa33('0x57')]({'where':{'UserId':{'$in':_0xcf2af7},'VoicePrefixId':_0x51846f[_0xfa33('0x74')]},'transaction':_0x1dd4d5});})['then'](function(){return db[_0xfa33('0x31')][_0xfa33('0x57')]({'where':{'id':_0x3c94db},'cascade':!![],'transaction':_0x1dd4d5});})[_0xfa33('0x2a')](function(_0x1e4a78){if(_0x1e4a78===0x0){_0x2c1fc5[_0xfa33('0x1f')](0x194);}else{return db[_0xfa33('0x75')][_0xfa33('0x57')]({'where':{'type':_0xfa33('0x52'),'resourceId':_0x3c94db},'cascade':!![],'transaction':_0x1dd4d5})[_0xfa33('0x2a')](function(){_0x2c1fc5[_0xfa33('0x20')](0xcc)[_0xfa33('0x21')]();});}})[_0xfa33('0x47')](function(_0x1a96fb){_0x2c1fc5[_0xfa33('0x20')](0x1f4)['send'](_0x1a96fb);});});};exports[_0xfa33('0x76')]=function(_0x2aa3c9,_0x5d4111,_0x5d53f0){return db['Team'][_0xfa33('0x77')]({'where':{'id':_0x2aa3c9[_0xfa33('0x49')]['id']}})[_0xfa33('0x2a')](handleEntityNotFound(_0x5d4111,null))[_0xfa33('0x2a')](function(_0x34bc43){if(!_0x2aa3c9[_0xfa33('0x37')][_0xfa33('0x78')]||!utils[_0xfa33('0x79')](_0x2aa3c9['query'][_0xfa33('0x78')])){throw new db['Sequelize']['ValidationError'](_0xfa33('0x7a'));}var _0x5acd78={};var _0x1c5c29={};_0x1c5c29['model']=_[_0xfa33('0x38')](db[_['capitalize'](_0x2aa3c9[_0xfa33('0x37')]['channel'][_0xfa33('0x7b')]())+_0xfa33('0x7c')][_0xfa33('0x32')]);_0x1c5c29['query']=_[_0xfa33('0x38')](_0x2aa3c9['query']);_0x1c5c29[_0xfa33('0x39')]=_[_0xfa33('0x3a')](_0x1c5c29[_0xfa33('0x36')],_0x1c5c29[_0xfa33('0x37')]);_0x5acd78[_0xfa33('0x3c')]=_[_0xfa33('0x3a')](_0x1c5c29[_0xfa33('0x36')],qs['fields'](_0x2aa3c9[_0xfa33('0x37')][_0xfa33('0x3b')]));_0x5acd78[_0xfa33('0x3c')]=_0x5acd78['attributes'][_0xfa33('0x7d')]?_0x5acd78[_0xfa33('0x3c')]:_0x1c5c29[_0xfa33('0x36')];_0x5acd78['limit']=qs['limit'](_0x2aa3c9[_0xfa33('0x37')][_0xfa33('0x25')]);_0x5acd78[_0xfa33('0x23')]=qs['offset'](_0x2aa3c9[_0xfa33('0x37')][_0xfa33('0x23')]);_0x5acd78[_0xfa33('0x3f')]=qs[_0xfa33('0x40')](_0x2aa3c9['query']['sort']);_0x5acd78[_0xfa33('0x41')]=qs[_0xfa33('0x39')](_[_0xfa33('0x7e')](_0x2aa3c9[_0xfa33('0x37')],_0x1c5c29['filters']));_0x5acd78=_[_0xfa33('0x42')]({},_0x5acd78,_0x2aa3c9[_0xfa33('0x4b')]);return _0x34bc43['get'+_[_0xfa33('0x7f')](_0x2aa3c9['query'][_0xfa33('0x78')][_0xfa33('0x7b')]())+_0xfa33('0x80')](_0x5acd78);})[_0xfa33('0x2a')](respondWithResult(_0x5d4111,null))[_0xfa33('0x47')](handleError(_0x5d4111,null));};exports['addQueues']=function(_0x5bc471,_0x105c23,_0x35f417){return db[_0xfa33('0x31')][_0xfa33('0x77')]({'where':{'id':_0x5bc471[_0xfa33('0x49')]['id']}})[_0xfa33('0x2a')](function(_0x4f20ec){if(_0x4f20ec){if(!_0x5bc471[_0xfa33('0x4e')][_0xfa33('0x78')]||!utils['isValidChannel'](_0x5bc471['body'][_0xfa33('0x78')])){throw new db[(_0xfa33('0x5b'))]['ValidationError']('Unknown\x20channel');}return _0x4f20ec[_0xfa33('0x81')+_[_0xfa33('0x7f')](_0x5bc471[_0xfa33('0x4e')][_0xfa33('0x78')][_0xfa33('0x7b')]())+_0xfa33('0x80')](_0x5bc471['body'][_0xfa33('0x82')]);}return null;})[_0xfa33('0x2a')](handleEntityNotFound(_0x105c23,null))['then'](respondWithStatusCode(_0x105c23,null))[_0xfa33('0x47')](handleError(_0x105c23,null));};exports[_0xfa33('0x83')]=function(_0x426527,_0x3717e6,_0x508a21){return db[_0xfa33('0x31')][_0xfa33('0x77')]({'where':{'id':_0x426527[_0xfa33('0x49')]['id']}})[_0xfa33('0x2a')](function(_0x6ac329){if(_0x6ac329){if(!_0x426527[_0xfa33('0x37')][_0xfa33('0x78')]||!utils[_0xfa33('0x79')](_0x426527[_0xfa33('0x37')][_0xfa33('0x78')])){throw new db[(_0xfa33('0x5b'))]['ValidationError'](_0xfa33('0x7a'));}return _0x6ac329[_0xfa33('0x84')+_['capitalize'](_0x426527['query'][_0xfa33('0x78')][_0xfa33('0x7b')]())+_0xfa33('0x80')](_0x426527[_0xfa33('0x37')][_0xfa33('0x82')]);}return null;})['then'](handleEntityNotFound(_0x3717e6,null))[_0xfa33('0x2a')](respondWithStatusCode(_0x3717e6,null))[_0xfa33('0x47')](handleError(_0x3717e6,null));};exports[_0xfa33('0x85')]=function(_0x9f8a15,_0xcc4d49){var _0x3d1dad=_['isArray'](_0x9f8a15[_0xfa33('0x4e')]['ids'])?_0x9f8a15['body'][_0xfa33('0x82')]:[_0x9f8a15[_0xfa33('0x4e')][_0xfa33('0x82')]];var _0x91e922=_0x9f8a15[_0xfa33('0x49')]['id'];return db[_0xfa33('0x31')][_0xfa33('0x4c')]({'where':{'id':_0x91e922}})['then'](handleEntityNotFound(_0xcc4d49,null))['then'](function(_0xe15715){if(_0xe15715){var _0x2c9398=[_0xfa33('0x86'),_0xfa33('0x87'),'Mail','Sms',_0xfa33('0x88'),_0xfa33('0x89'),_0xfa33('0x8a')];return db[_0xfa33('0x58')]['transaction'](function(_0x1a7d13){var _0x393e58=_['map'](_0x2c9398,function(_0x45e1ff){var _0x4c477a={'attributes':['id',_0xfa33('0x2d')]};if(_0x45e1ff===_0xfa33('0x86')){_0x4c477a['through']={'attributes':[_0xfa33('0x8b')]};}return _0xe15715[_0xfa33('0x4f')+_0x45e1ff+_0xfa33('0x80')](_0x4c477a)[_0xfa33('0x2a')](function(_0x4646d3){var _0x1169a6=_[_0xfa33('0x30')](_0x4646d3,function(_0xe5f2b7){var _0x38ec5=_[_0xfa33('0x30')](_0x3d1dad,function(_0xba803f){var _0x1df8cd={'where':{'UserId':_0xba803f,[_0x45e1ff+'QueueId']:_0xe5f2b7['id']},'transaction':_0x1a7d13};if(_0x45e1ff===_0xfa33('0x86')){_0x1df8cd['defaults']={'penalty':_0xe5f2b7[_0xfa33('0x8c')]['penalty']};}return db[_0xfa33('0x8d')+_0x45e1ff+'Queue'][_0xfa33('0x8e')](_0x1df8cd)[_0xfa33('0x2a')](function(){socket[_0xfa33('0x8f')](_0xfa33('0x51')+_0x45e1ff+_0xfa33('0x90'),{'UserId':_0xba803f,[_0x45e1ff+_0xfa33('0x91')]:_0xe5f2b7['id']});if(_0x45e1ff!=='Voice'){return;}return db[_0xfa33('0x8d')][_0xfa33('0x45')]({'where':{'id':_0x3d1dad,'online':0x1},'attributes':['id','name','online',_0xfa33('0x92'),_0xfa33('0x93')],'raw':!![]})[_0xfa33('0x2a')](function(_0x1cc55e){var _0xffc2aa=_[_0xfa33('0x30')](_0x1cc55e,function(_0x3c35df){return db['UserVoiceQueueRt'][_0xfa33('0x94')]({'membername':_0x3c35df[_0xfa33('0x2d')],'UserId':_0x3c35df['id'],'queue_name':_0xe5f2b7[_0xfa33('0x2d')],'VoiceQueueId':_0xe5f2b7['id'],'interface':_[_0xfa33('0x95')](_0x3c35df[_0xfa33('0x93')])?util[_0xfa33('0x96')](_0xfa33('0x97'),_0x3c35df['name']):_0x3c35df[_0xfa33('0x93')],'paused':_0x3c35df['voicePause']||![],'penalty':_0xe5f2b7[_0xfa33('0x8c')][_0xfa33('0x8b')]},{'transaction':_0x1a7d13});});return Promise[_0xfa33('0x98')](_0xffc2aa);});});});return Promise['all'](_0x38ec5);});return Promise['all'](_0x1169a6);})[_0xfa33('0x2a')](function(){return db['TeamVoicePrefix'][_0xfa33('0x77')]({'where':{'teamId':_0x91e922}})[_0xfa33('0x2a')](function(_0x18ac86){if(_0x18ac86){var _0x45a50a=_[_0xfa33('0x30')](_0x3d1dad,function(_0x5dd41e){db[_0xfa33('0x73')]['upsert']({'UserId':_0x5dd41e,'VoicePrefixId':_0x18ac86['VoicePrefixId']});});return Promise['all'](_0x45a50a);}});});});return Promise[_0xfa33('0x98')](_0x393e58)[_0xfa33('0x2a')](function(){return _0xe15715[_0xfa33('0x85')](_0x3d1dad,{'transaction':_0x1a7d13})[_0xfa33('0x99')](function(_0x18ca40){return _0x18ca40;});});});}})[_0xfa33('0x2a')](respondWithResult(_0xcc4d49,null))['catch'](handleError(_0xcc4d49,null));};exports[_0xfa33('0x9a')]=function(_0x2feee1,_0x355367){var _0x196624=_[_0xfa33('0x9b')](_0x2feee1[_0xfa33('0x37')][_0xfa33('0x82')])?_0x2feee1[_0xfa33('0x37')][_0xfa33('0x82')]:[_0x2feee1[_0xfa33('0x37')][_0xfa33('0x82')]];var _0x24691d=_0x2feee1[_0xfa33('0x49')]['id'];return db[_0xfa33('0x31')][_0xfa33('0x4c')]({'where':{'id':_0x24691d}})[_0xfa33('0x2a')](handleEntityNotFound(_0x355367,null))[_0xfa33('0x2a')](function(_0x51dc7f){if(_0x51dc7f){var _0x48877d=['Voice',_0xfa33('0x87'),_0xfa33('0x9c'),_0xfa33('0x9d'),_0xfa33('0x88'),'Openchannel',_0xfa33('0x8a')];return db[_0xfa33('0x58')]['transaction'](function(_0x5aeeb5){var _0x4a16cf=_[_0xfa33('0x30')](_0x48877d,function(_0x12b64b){var _0x13a438={'attributes':['id',_0xfa33('0x2d')]};return _0x51dc7f[_0xfa33('0x4f')+_0x12b64b+'Queues'](_0x13a438)['then'](function(_0x52b2df){var _0xa56b93=_[_0xfa33('0x30')](_0x52b2df,function(_0x36a6b7){return _0x36a6b7[_0xfa33('0x9a')](_0x196624,{'transaction':_0x5aeeb5})['then'](function(){var _0x207cb0=_[_0xfa33('0x30')](_0x196624,function(_0x127410){socket['emit'](_0xfa33('0x51')+_0x12b64b+_0xfa33('0x9e'),{'UserId':Number(_0x127410),[_0x12b64b+_0xfa33('0x91')]:_0x36a6b7['id']});if(_0x12b64b!==_0xfa33('0x86')){return;}return db[_0xfa33('0x9f')][_0xfa33('0x57')]({'where':{'VoiceQueueId':_0x36a6b7['id'],'UserId':_0x127410},'transaction':_0x5aeeb5});});return Promise[_0xfa33('0x98')](_0x207cb0);});});return Promise[_0xfa33('0x98')](_0xa56b93);});});return Promise[_0xfa33('0x98')](_0x4a16cf)[_0xfa33('0x2a')](function(){return _0x51dc7f[_0xfa33('0x9a')](_0x196624,{'transaction':_0x5aeeb5});})['then'](function(){return db['TeamVoicePrefix'][_0xfa33('0x77')]({'where':{'teamId':_0x24691d}})[_0xfa33('0x2a')](function(_0x3c3fa9){if(_0x3c3fa9){var _0xa64075=_[_0xfa33('0x30')](_0x196624,function(_0x201796){db[_0xfa33('0x73')][_0xfa33('0x57')]({'where':{'UserId':_0x201796,'VoicePrefixId':_0x3c3fa9[_0xfa33('0x74')]}});});return Promise['all'](_0xa64075);}});});});}})[_0xfa33('0x2a')](respondWithStatusCode(_0x355367,null))['catch'](handleError(_0x355367,null));};exports[_0xfa33('0xa0')]=function(_0x4feb8c,_0x5225c3,_0x241688){var _0x5e17cb={};var _0x3c08a3={};var _0x389951;var _0x261929;return db[_0xfa33('0x31')][_0xfa33('0x77')]({'where':{'id':_0x4feb8c[_0xfa33('0x49')]['id']}})['then'](handleEntityNotFound(_0x5225c3,null))['then'](function(_0x1a488e){if(_0x1a488e){_0x389951=_0x1a488e;_0x3c08a3[_0xfa33('0x36')]=_[_0xfa33('0x38')](db[_0xfa33('0x8d')]['rawAttributes']);_0x3c08a3['query']=_[_0xfa33('0x38')](_0x4feb8c['query']);_0x3c08a3[_0xfa33('0x39')]=_['intersection'](_0x3c08a3['model'],_0x3c08a3['query']);_0x5e17cb[_0xfa33('0x3c')]=_[_0xfa33('0x3a')](_0x3c08a3[_0xfa33('0x36')],qs[_0xfa33('0x3b')](_0x4feb8c[_0xfa33('0x37')]['fields']));_0x5e17cb['attributes']=_0x5e17cb[_0xfa33('0x3c')][_0xfa33('0x7d')]?_0x5e17cb['attributes']:_0x3c08a3[_0xfa33('0x36')];_0x5e17cb['order']=qs[_0xfa33('0x40')](_0x4feb8c[_0xfa33('0x37')][_0xfa33('0x40')]);_0x5e17cb[_0xfa33('0x41')]=qs[_0xfa33('0x39')](_['pick'](_0x4feb8c[_0xfa33('0x37')],_0x3c08a3['filters']));if(_0x4feb8c[_0xfa33('0x37')]['filter']){_0x5e17cb[_0xfa33('0x41')]=_[_0xfa33('0x42')](_0x5e17cb[_0xfa33('0x41')],{'$or':_['map'](_0x5e17cb[_0xfa33('0x3c')],function(_0x280233){var _0x12defc={};_0x12defc[_0x280233]={'$like':'%'+_0x4feb8c['query'][_0xfa33('0xa1')]+'%'};return _0x12defc;})});}_0x5e17cb=_['merge']({},_0x5e17cb,_0x4feb8c[_0xfa33('0x4b')]);return _0x389951[_0xfa33('0xa0')](_0x5e17cb);}})[_0xfa33('0x2a')](function(_0x23cfc2){if(_0x23cfc2){_0x261929=_0x23cfc2[_0xfa33('0x7d')];if(!_0x4feb8c[_0xfa33('0x37')][_0xfa33('0x3d')](_0xfa33('0x3e'))){_0x5e17cb['limit']=qs[_0xfa33('0x25')](_0x4feb8c[_0xfa33('0x37')]['limit']);_0x5e17cb['offset']=qs[_0xfa33('0x23')](_0x4feb8c[_0xfa33('0x37')]['offset']);}return _0x389951[_0xfa33('0xa0')](_0x5e17cb);}})[_0xfa33('0x2a')](function(_0x42d57d){if(_0x42d57d){return _0x42d57d?{'count':_0x261929,'rows':_0x42d57d}:null;}})[_0xfa33('0x2a')](respondWithResult(_0x5225c3,null))['catch'](handleError(_0x5225c3,null));}; \ No newline at end of file +var _0x6f5f=['body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','create','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','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','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Teams','end','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','Queue','capitalize','Queues','params','add','removeQueues','remove','ids','addAgents','isArray','Voice','Mail','Fax','Whatsapp','penalty','QueueId','findOrCreate','emit','user','Queue:save','User','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','Chat','Sms','Openchannel','removeAgents','Queue:remove','getAgents','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','./team.socket','register','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','filters','intersection','find'];(function(_0x2db36e,_0x1fc29f){var _0x246bff=function(_0x2eb4e5){while(--_0x2eb4e5){_0x2db36e['push'](_0x2db36e['shift']());}};_0x246bff(++_0x1fc29f);}(_0x6f5f,0x18a));var _0xf6f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f5f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf6f5('0x0'));var rimraf=require(_0xf6f5('0x1'));var zipdir=require(_0xf6f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf6f5('0x3'));var moment=require(_0xf6f5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf6f5('0x5'));var util=require(_0xf6f5('0x6'));var path=require(_0xf6f5('0x7'));var sox=require(_0xf6f5('0x8'));var csv=require(_0xf6f5('0x9'));var ejs=require(_0xf6f5('0xa'));var fs=require('fs');var fs_extra=require(_0xf6f5('0xb'));var _=require(_0xf6f5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf6f5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf6f5('0x9'));var querystring=require(_0xf6f5('0xe'));var Papa=require(_0xf6f5('0xf'));var Redis=require(_0xf6f5('0x10'));var authService=require(_0xf6f5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf6f5('0x12'));var hardwareService=require(_0xf6f5('0x13'));var logger=require(_0xf6f5('0x14'))('api');var utils=require(_0xf6f5('0x15'));var config=require(_0xf6f5('0x16'));var licenseUtil=require(_0xf6f5('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf6f5('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf6f5('0x19'))[_0xf6f5('0x1a')](socket);function respondWithStatusCode(_0x1915d0,_0x22f3ec){_0x22f3ec=_0x22f3ec||0xcc;return function(_0x1930de){if(_0x1930de){return _0x1915d0[_0xf6f5('0x1b')](_0x22f3ec);}return _0x1915d0[_0xf6f5('0x1c')](_0x22f3ec)['end']();};}function respondWithResult(_0x2d6a9b,_0x341f09){_0x341f09=_0x341f09||0xc8;return function(_0x20b938){if(_0x20b938){return _0x2d6a9b[_0xf6f5('0x1c')](_0x341f09)[_0xf6f5('0x1d')](_0x20b938);}};}function respondWithFilteredResult(_0xdfcad2,_0x3adb0e){return function(_0x3fa46b){if(_0x3fa46b){var _0x4b2bc7=typeof _0x3adb0e['offset']===_0xf6f5('0x1e')&&typeof _0x3adb0e[_0xf6f5('0x1f')]==='undefined';var _0x3fa0ea=_0x3fa46b['count'];var _0x3c75de=_0x4b2bc7?0x0:_0x3adb0e[_0xf6f5('0x20')];var _0x1149cc=_0x4b2bc7?_0x3fa46b[_0xf6f5('0x21')]:_0x3adb0e[_0xf6f5('0x20')]+_0x3adb0e[_0xf6f5('0x1f')];var _0x3d521d;if(_0x1149cc>=_0x3fa0ea){_0x1149cc=_0x3fa0ea;_0x3d521d=0xc8;}else{_0x3d521d=0xce;}_0xdfcad2[_0xf6f5('0x1c')](_0x3d521d);return _0xdfcad2[_0xf6f5('0x22')](_0xf6f5('0x23'),_0x3c75de+'-'+_0x1149cc+'/'+_0x3fa0ea)[_0xf6f5('0x1d')](_0x3fa46b);}return null;};}function patchUpdates(_0x271ca1){return function(_0x87daf8){try{jsonpatch[_0xf6f5('0x24')](_0x87daf8,_0x271ca1,!![]);}catch(_0x2659bc){return BPromise[_0xf6f5('0x25')](_0x2659bc);}return _0x87daf8[_0xf6f5('0x26')]();};}function saveUpdates(_0x1c94e3,_0x3f3cde){return function(_0x53690c){if(_0x53690c){return _0x53690c[_0xf6f5('0x27')](_0x1c94e3)[_0xf6f5('0x28')](function(_0x19ad33){return _0x19ad33;});}return null;};}function handleEntityNotFound(_0x788a16,_0xd02aab){return function(_0x1d0a2f){if(!_0x1d0a2f){_0x788a16[_0xf6f5('0x1b')](0x194);}return _0x1d0a2f;};}function handleError(_0x3b778f,_0x5c72e0){_0x5c72e0=_0x5c72e0||0x1f4;return function(_0x84745f){logger[_0xf6f5('0x29')](_0x84745f[_0xf6f5('0x2a')]);if(_0x84745f[_0xf6f5('0x2b')]){delete _0x84745f[_0xf6f5('0x2b')];}_0x3b778f[_0xf6f5('0x1c')](_0x5c72e0)[_0xf6f5('0x2c')](_0x84745f);};}exports[_0xf6f5('0x2d')]=function(_0x5106cd,_0x575f54){var _0x140375={},_0x54a9a8={},_0x204100={'count':0x0,'rows':[]};var _0x103a65=_[_0xf6f5('0x2e')](db[_0xf6f5('0x2f')][_0xf6f5('0x30')],function(_0x1d86dd){return{'name':_0x1d86dd[_0xf6f5('0x31')],'type':_0x1d86dd[_0xf6f5('0x32')][_0xf6f5('0x33')]};});_0x54a9a8[_0xf6f5('0x34')]=_[_0xf6f5('0x2e')](_0x103a65,'name');_0x54a9a8[_0xf6f5('0x35')]=_[_0xf6f5('0x36')](_0x5106cd[_0xf6f5('0x35')]);_0x54a9a8['filters']=_['intersection'](_0x54a9a8[_0xf6f5('0x34')],_0x54a9a8['query']);_0x140375[_0xf6f5('0x37')]=_['intersection'](_0x54a9a8[_0xf6f5('0x34')],qs[_0xf6f5('0x38')](_0x5106cd[_0xf6f5('0x35')][_0xf6f5('0x38')]));_0x140375[_0xf6f5('0x37')]=_0x140375['attributes'][_0xf6f5('0x39')]?_0x140375[_0xf6f5('0x37')]:_0x54a9a8['model'];if(!_0x5106cd[_0xf6f5('0x35')][_0xf6f5('0x3a')]('nolimit')){_0x140375[_0xf6f5('0x1f')]=qs['limit'](_0x5106cd[_0xf6f5('0x35')][_0xf6f5('0x1f')]);_0x140375[_0xf6f5('0x20')]=qs[_0xf6f5('0x20')](_0x5106cd[_0xf6f5('0x35')][_0xf6f5('0x20')]);}_0x140375[_0xf6f5('0x3b')]=qs[_0xf6f5('0x3c')](_0x5106cd[_0xf6f5('0x35')][_0xf6f5('0x3c')]);_0x140375[_0xf6f5('0x3d')]=qs['filters'](_[_0xf6f5('0x3e')](_0x5106cd[_0xf6f5('0x35')],_0x54a9a8['filters']),_0x103a65);if(_0x5106cd[_0xf6f5('0x35')]['filter']){_0x140375['where']=_['merge'](_0x140375[_0xf6f5('0x3d')],{'$or':_[_0xf6f5('0x2e')](_0x103a65,function(_0x852eb5){if(_0x852eb5[_0xf6f5('0x32')]!==_0xf6f5('0x3f')){var _0x2bbb31={};_0x2bbb31[_0x852eb5['name']]={'$like':'%'+_0x5106cd[_0xf6f5('0x35')][_0xf6f5('0x40')]+'%'};return _0x2bbb31;}})});}_0x140375=_[_0xf6f5('0x41')]({},_0x140375,_0x5106cd[_0xf6f5('0x42')]);var _0x209dc3={'where':_0x140375[_0xf6f5('0x3d')]};return db['Team'][_0xf6f5('0x21')](_0x209dc3)[_0xf6f5('0x28')](function(_0x50690e){_0x204100[_0xf6f5('0x21')]=_0x50690e;if(_0x5106cd[_0xf6f5('0x35')][_0xf6f5('0x43')]){_0x140375['include']=[{'all':!![]}];}return db[_0xf6f5('0x2f')][_0xf6f5('0x44')](_0x140375);})[_0xf6f5('0x28')](function(_0x3a9f0f){_0x204100['rows']=_0x3a9f0f;return _0x204100;})['then'](respondWithFilteredResult(_0x575f54,_0x140375))[_0xf6f5('0x45')](handleError(_0x575f54,null));};exports[_0xf6f5('0x46')]=function(_0x26ef2e,_0x4ffa98){var _0x18d963={'raw':![],'where':{'id':_0x26ef2e['params']['id']}},_0x551aec={};_0x551aec[_0xf6f5('0x34')]=_['keys'](db[_0xf6f5('0x2f')][_0xf6f5('0x30')]);_0x551aec[_0xf6f5('0x35')]=_[_0xf6f5('0x36')](_0x26ef2e[_0xf6f5('0x35')]);_0x551aec[_0xf6f5('0x47')]=_['intersection'](_0x551aec[_0xf6f5('0x34')],_0x551aec[_0xf6f5('0x35')]);_0x18d963[_0xf6f5('0x37')]=_[_0xf6f5('0x48')](_0x551aec[_0xf6f5('0x34')],qs[_0xf6f5('0x38')](_0x26ef2e[_0xf6f5('0x35')][_0xf6f5('0x38')]));_0x18d963[_0xf6f5('0x37')]=_0x18d963['attributes'][_0xf6f5('0x39')]?_0x18d963[_0xf6f5('0x37')]:_0x551aec[_0xf6f5('0x34')];if(_0x26ef2e[_0xf6f5('0x35')]['includeAll']){_0x18d963['include']=[{'all':!![]}];}_0x18d963=_[_0xf6f5('0x41')]({},_0x18d963,_0x26ef2e['options']);return db[_0xf6f5('0x2f')][_0xf6f5('0x49')](_0x18d963)[_0xf6f5('0x28')](handleEntityNotFound(_0x4ffa98,null))['then'](respondWithResult(_0x4ffa98,null))[_0xf6f5('0x45')](handleError(_0x4ffa98,null));};exports['create']=function(_0x34e88e,_0x575a5f){return db[_0xf6f5('0x2f')]['create'](_0x34e88e[_0xf6f5('0x4a')],{})[_0xf6f5('0x28')](function(_0x58543f){var _0x99f003=_0x34e88e['user']['get']({'plain':!![]});if(!_0x99f003)throw new Error(_0xf6f5('0x4b'));if(_0x99f003[_0xf6f5('0x4c')]==='user'){var _0x3853f2=_0x58543f[_0xf6f5('0x4d')]({'plain':!![]});var _0x9af26f='Teams';return db['UserProfileSection'][_0xf6f5('0x49')]({'where':{'name':_0x9af26f,'userProfileId':_0x99f003[_0xf6f5('0x4e')]},'raw':!![]})[_0xf6f5('0x28')](function(_0x3d27df){if(_0x3d27df&&_0x3d27df[_0xf6f5('0x4f')]===0x0){return db['UserProfileResource'][_0xf6f5('0x50')]({'name':_0x3853f2[_0xf6f5('0x2b')],'resourceId':_0x3853f2['id'],'type':_0x3d27df['name'],'sectionId':_0x3d27df['id']},{})[_0xf6f5('0x28')](function(){return _0x58543f;});}else{return _0x58543f;}})['catch'](function(_0x1d8d9a){logger[_0xf6f5('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d8d9a);throw _0x1d8d9a;});}return _0x58543f;})['then'](respondWithResult(_0x575a5f,0xc9))[_0xf6f5('0x45')](handleError(_0x575a5f,null));};exports[_0xf6f5('0x27')]=function(_0x52d2d5,_0x4e13ca){if(_0x52d2d5[_0xf6f5('0x4a')]['id']){delete _0x52d2d5[_0xf6f5('0x4a')]['id'];}return db[_0xf6f5('0x2f')][_0xf6f5('0x49')]({'where':{'id':_0x52d2d5['params']['id']}})['then'](handleEntityNotFound(_0x4e13ca,null))[_0xf6f5('0x28')](saveUpdates(_0x52d2d5[_0xf6f5('0x4a')],null))['then'](respondWithResult(_0x4e13ca,null))['catch'](handleError(_0x4e13ca,null));};exports[_0xf6f5('0x51')]=function(_0xc1ea9a,_0x1fc43c){var _0x515f64=_0xc1ea9a['params']['id'];var _0x2d93f0=[];return db[_0xf6f5('0x52')][_0xf6f5('0x53')](function(_0x4adfe6){var _0x3bdc95=_0xf6f5('0x54')+_0x515f64;return db[_0xf6f5('0x52')][_0xf6f5('0x35')](_0x3bdc95,{'type':db[_0xf6f5('0x55')][_0xf6f5('0x56')][_0xf6f5('0x57')],'raw':!![],'transaction':_0x4adfe6})['then'](function(_0x31417f){_0x2d93f0=_['map'](_0x31417f,function(_0x559ff5){return Number(_0x559ff5[_0xf6f5('0x58')]);});})[_0xf6f5('0x28')](function(){var _0x29faf5=_0xf6f5('0x59')+_0x515f64;return db[_0xf6f5('0x52')][_0xf6f5('0x35')](_0x29faf5,{'type':db[_0xf6f5('0x55')]['QueryTypes'][_0xf6f5('0x57')],'raw':!![],'transaction':_0x4adfe6});})[_0xf6f5('0x28')](function(_0x366a60){var _0x35e7f9=_[_0xf6f5('0x2e')](_0x366a60,function(_0x3788cf){return Number(_0x3788cf[_0xf6f5('0x5a')]);});return db[_0xf6f5('0x5b')][_0xf6f5('0x51')]({'where':{'UserId':{'$in':_0x2d93f0},'VoiceQueueId':{'$in':_0x35e7f9}},'transaction':_0x4adfe6});})['then'](function(){var _0x44d55f='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x515f64;return db[_0xf6f5('0x52')][_0xf6f5('0x35')](_0x44d55f,{'type':db[_0xf6f5('0x55')][_0xf6f5('0x56')]['SELECT'],'raw':!![],'transaction':_0x4adfe6});})['then'](function(_0x5649d2){var _0x4f008d=_[_0xf6f5('0x2e')](_0x5649d2,function(_0x44b968){return Number(_0x44b968[_0xf6f5('0x5c')]);});return db[_0xf6f5('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x2d93f0},'MailQueueId':{'$in':_0x4f008d}},'transaction':_0x4adfe6});})[_0xf6f5('0x28')](function(){var _0x266ff0=_0xf6f5('0x5e')+_0x515f64;return db[_0xf6f5('0x52')][_0xf6f5('0x35')](_0x266ff0,{'type':db[_0xf6f5('0x55')][_0xf6f5('0x56')][_0xf6f5('0x57')],'raw':!![],'transaction':_0x4adfe6});})['then'](function(_0x4214f5){var _0x148832=_[_0xf6f5('0x2e')](_0x4214f5,function(_0xc5f6ab){return Number(_0xc5f6ab['SmsQueueId']);});return db[_0xf6f5('0x5f')]['destroy']({'where':{'UserId':{'$in':_0x2d93f0},'SmsQueueId':{'$in':_0x148832}},'transaction':_0x4adfe6});})[_0xf6f5('0x28')](function(){var _0x119163=_0xf6f5('0x60')+_0x515f64;return db[_0xf6f5('0x52')][_0xf6f5('0x35')](_0x119163,{'type':db[_0xf6f5('0x55')]['QueryTypes'][_0xf6f5('0x57')],'raw':!![],'transaction':_0x4adfe6});})[_0xf6f5('0x28')](function(_0x54a8ec){var _0x4de576=_[_0xf6f5('0x2e')](_0x54a8ec,function(_0x1846e5){return Number(_0x1846e5[_0xf6f5('0x61')]);});return db[_0xf6f5('0x62')][_0xf6f5('0x51')]({'where':{'UserId':{'$in':_0x2d93f0},'ChatQueueId':{'$in':_0x4de576}},'transaction':_0x4adfe6});})['then'](function(){var _0x111248=_0xf6f5('0x63')+_0x515f64;return db[_0xf6f5('0x52')][_0xf6f5('0x35')](_0x111248,{'type':db[_0xf6f5('0x55')][_0xf6f5('0x56')]['SELECT'],'raw':!![],'transaction':_0x4adfe6});})[_0xf6f5('0x28')](function(_0x2bb765){var _0xa715d4=_[_0xf6f5('0x2e')](_0x2bb765,function(_0x423098){return Number(_0x423098[_0xf6f5('0x64')]);});return db[_0xf6f5('0x65')][_0xf6f5('0x51')]({'where':{'UserId':{'$in':_0x2d93f0},'FaxQueueId':{'$in':_0xa715d4}},'transaction':_0x4adfe6});})[_0xf6f5('0x28')](function(){var _0x2ec976='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x515f64;return db[_0xf6f5('0x52')][_0xf6f5('0x35')](_0x2ec976,{'type':db['Sequelize'][_0xf6f5('0x56')][_0xf6f5('0x57')],'raw':!![],'transaction':_0x4adfe6});})[_0xf6f5('0x28')](function(_0x5354d9){var _0x3d9432=_[_0xf6f5('0x2e')](_0x5354d9,function(_0x4aeeac){return Number(_0x4aeeac['OpenchannelQueueId']);});return db[_0xf6f5('0x66')][_0xf6f5('0x51')]({'where':{'UserId':{'$in':_0x2d93f0},'OpenchannelQueueId':{'$in':_0x3d9432}},'transaction':_0x4adfe6});})[_0xf6f5('0x28')](function(){var _0x3a2294=_0xf6f5('0x67')+_0x515f64;return db[_0xf6f5('0x52')][_0xf6f5('0x35')](_0x3a2294,{'type':db[_0xf6f5('0x55')][_0xf6f5('0x56')]['SELECT'],'raw':!![],'transaction':_0x4adfe6});})['then'](function(_0x551b57){var _0x2603ad=_[_0xf6f5('0x2e')](_0x551b57,function(_0x347061){return Number(_0x347061[_0xf6f5('0x68')]);});return db[_0xf6f5('0x69')][_0xf6f5('0x51')]({'where':{'UserId':{'$in':_0x2d93f0},'WhatsappQueueId':{'$in':_0x2603ad}},'transaction':_0x4adfe6});})[_0xf6f5('0x28')](function(){return db[_0xf6f5('0x6a')][_0xf6f5('0x49')]({'where':{'TeamId':_0x515f64}});})[_0xf6f5('0x28')](function(_0x1e9a54){if(_0x1e9a54===null){return;}return db[_0xf6f5('0x6b')][_0xf6f5('0x51')]({'where':{'UserId':{'$in':_0x2d93f0},'VoicePrefixId':_0x1e9a54[_0xf6f5('0x6c')]},'transaction':_0x4adfe6});})[_0xf6f5('0x28')](function(){return db[_0xf6f5('0x2f')][_0xf6f5('0x51')]({'where':{'id':_0x515f64},'cascade':!![],'transaction':_0x4adfe6});})['then'](function(_0x1c8b3a){if(_0x1c8b3a===0x0){_0x1fc43c[_0xf6f5('0x1b')](0x194);}else{return db['UserProfileResource'][_0xf6f5('0x51')]({'where':{'type':_0xf6f5('0x6d'),'resourceId':_0x515f64},'cascade':!![],'transaction':_0x4adfe6})['then'](function(){_0x1fc43c['status'](0xcc)[_0xf6f5('0x6e')]();});}})[_0xf6f5('0x45')](function(_0x1ece2c){_0x1fc43c['status'](0x1f4)['send'](_0x1ece2c);});});};exports[_0xf6f5('0x6f')]=function(_0x3889ca,_0x2e2749,_0x1c59c8){return db['Team'][_0xf6f5('0x70')]({'where':{'id':_0x3889ca['params']['id']}})[_0xf6f5('0x28')](handleEntityNotFound(_0x2e2749,null))[_0xf6f5('0x28')](function(_0x547bdc){if(!_0x3889ca['query'][_0xf6f5('0x71')]||!utils[_0xf6f5('0x72')](_0x3889ca[_0xf6f5('0x35')][_0xf6f5('0x71')])){throw new db[(_0xf6f5('0x55'))][(_0xf6f5('0x73'))](_0xf6f5('0x74'));}var _0x7742c6={};var _0x479629={};_0x479629[_0xf6f5('0x34')]=_[_0xf6f5('0x36')](db[_['capitalize'](_0x3889ca[_0xf6f5('0x35')]['channel'][_0xf6f5('0x75')]())+_0xf6f5('0x76')][_0xf6f5('0x30')]);_0x479629[_0xf6f5('0x35')]=_[_0xf6f5('0x36')](_0x3889ca[_0xf6f5('0x35')]);_0x479629[_0xf6f5('0x47')]=_['intersection'](_0x479629[_0xf6f5('0x34')],_0x479629['query']);_0x7742c6['attributes']=_['intersection'](_0x479629['model'],qs[_0xf6f5('0x38')](_0x3889ca[_0xf6f5('0x35')][_0xf6f5('0x38')]));_0x7742c6[_0xf6f5('0x37')]=_0x7742c6[_0xf6f5('0x37')]['length']?_0x7742c6[_0xf6f5('0x37')]:_0x479629[_0xf6f5('0x34')];_0x7742c6[_0xf6f5('0x1f')]=qs['limit'](_0x3889ca[_0xf6f5('0x35')]['limit']);_0x7742c6[_0xf6f5('0x20')]=qs[_0xf6f5('0x20')](_0x3889ca['query'][_0xf6f5('0x20')]);_0x7742c6['order']=qs['sort'](_0x3889ca[_0xf6f5('0x35')][_0xf6f5('0x3c')]);_0x7742c6[_0xf6f5('0x3d')]=qs[_0xf6f5('0x47')](_['pick'](_0x3889ca[_0xf6f5('0x35')],_0x479629[_0xf6f5('0x47')]));_0x7742c6=_['merge']({},_0x7742c6,_0x3889ca['options']);return _0x547bdc[_0xf6f5('0x4d')+_[_0xf6f5('0x77')](_0x3889ca[_0xf6f5('0x35')]['channel']['toLowerCase']())+_0xf6f5('0x78')](_0x7742c6);})[_0xf6f5('0x28')](respondWithResult(_0x2e2749,null))['catch'](handleError(_0x2e2749,null));};exports['addQueues']=function(_0x4f596a,_0x334e86,_0x217813){return db[_0xf6f5('0x2f')][_0xf6f5('0x70')]({'where':{'id':_0x4f596a[_0xf6f5('0x79')]['id']}})['then'](function(_0x3d668a){if(_0x3d668a){if(!_0x4f596a[_0xf6f5('0x4a')][_0xf6f5('0x71')]||!utils[_0xf6f5('0x72')](_0x4f596a[_0xf6f5('0x4a')][_0xf6f5('0x71')])){throw new db[(_0xf6f5('0x55'))][(_0xf6f5('0x73'))](_0xf6f5('0x74'));}return _0x3d668a[_0xf6f5('0x7a')+_[_0xf6f5('0x77')](_0x4f596a['body']['channel']['toLowerCase']())+'Queues'](_0x4f596a[_0xf6f5('0x4a')]['ids']);}return null;})[_0xf6f5('0x28')](handleEntityNotFound(_0x334e86,null))[_0xf6f5('0x28')](respondWithStatusCode(_0x334e86,null))[_0xf6f5('0x45')](handleError(_0x334e86,null));};exports[_0xf6f5('0x7b')]=function(_0x57a084,_0x5e4b1b,_0x22753d){return db['Team'][_0xf6f5('0x70')]({'where':{'id':_0x57a084[_0xf6f5('0x79')]['id']}})[_0xf6f5('0x28')](function(_0x598c0a){if(_0x598c0a){if(!_0x57a084[_0xf6f5('0x35')][_0xf6f5('0x71')]||!utils[_0xf6f5('0x72')](_0x57a084['query'][_0xf6f5('0x71')])){throw new db['Sequelize'][(_0xf6f5('0x73'))](_0xf6f5('0x74'));}return _0x598c0a[_0xf6f5('0x7c')+_[_0xf6f5('0x77')](_0x57a084[_0xf6f5('0x35')][_0xf6f5('0x71')][_0xf6f5('0x75')]())+_0xf6f5('0x78')](_0x57a084['query'][_0xf6f5('0x7d')]);}return null;})[_0xf6f5('0x28')](handleEntityNotFound(_0x5e4b1b,null))['then'](respondWithStatusCode(_0x5e4b1b,null))[_0xf6f5('0x45')](handleError(_0x5e4b1b,null));};exports[_0xf6f5('0x7e')]=function(_0x20a7b3,_0x563cbe){var _0x27fac0=_[_0xf6f5('0x7f')](_0x20a7b3[_0xf6f5('0x4a')]['ids'])?_0x20a7b3[_0xf6f5('0x4a')][_0xf6f5('0x7d')]:[_0x20a7b3[_0xf6f5('0x4a')][_0xf6f5('0x7d')]];var _0x434128=_0x20a7b3['params']['id'];return db[_0xf6f5('0x2f')][_0xf6f5('0x49')]({'where':{'id':_0x434128}})[_0xf6f5('0x28')](handleEntityNotFound(_0x563cbe,null))[_0xf6f5('0x28')](function(_0x2e2cde){if(_0x2e2cde){var _0x3d6d2f=[_0xf6f5('0x80'),'Chat',_0xf6f5('0x81'),'Sms',_0xf6f5('0x82'),'Openchannel',_0xf6f5('0x83')];return db[_0xf6f5('0x52')][_0xf6f5('0x53')](function(_0x5387fe){var _0x12f889=_[_0xf6f5('0x2e')](_0x3d6d2f,function(_0x500fb1){var _0x4955ea={'attributes':['id',_0xf6f5('0x2b')]};if(_0x500fb1===_0xf6f5('0x80')){_0x4955ea['through']={'attributes':[_0xf6f5('0x84')]};}return _0x2e2cde[_0xf6f5('0x4d')+_0x500fb1+_0xf6f5('0x78')](_0x4955ea)[_0xf6f5('0x28')](function(_0x5de35d){var _0x361059=_[_0xf6f5('0x2e')](_0x5de35d,function(_0x15ed1e){var _0xa0e421=_[_0xf6f5('0x2e')](_0x27fac0,function(_0x388438){var _0x3a8f21={'where':{'UserId':_0x388438,[_0x500fb1+_0xf6f5('0x85')]:_0x15ed1e['id']},'transaction':_0x5387fe};if(_0x500fb1===_0xf6f5('0x80')){_0x3a8f21[_0xf6f5('0x18')]={'penalty':_0x15ed1e['TeamVoiceQueue'][_0xf6f5('0x84')]};}return db['User'+_0x500fb1+'Queue'][_0xf6f5('0x86')](_0x3a8f21)[_0xf6f5('0x28')](function(){socket[_0xf6f5('0x87')](_0xf6f5('0x88')+_0x500fb1+_0xf6f5('0x89'),{'UserId':_0x388438,[_0x500fb1+'QueueId']:_0x15ed1e['id']});if(_0x500fb1!=='Voice'){return;}return db[_0xf6f5('0x8a')][_0xf6f5('0x44')]({'where':{'id':_0x27fac0,'online':0x1},'attributes':['id',_0xf6f5('0x2b'),_0xf6f5('0x8b'),_0xf6f5('0x8c'),_0xf6f5('0x8d')],'raw':!![]})[_0xf6f5('0x28')](function(_0x1dd37e){var _0x2a3bda=_[_0xf6f5('0x2e')](_0x1dd37e,function(_0x139422){return db[_0xf6f5('0x8e')][_0xf6f5('0x8f')]({'membername':_0x139422[_0xf6f5('0x2b')],'UserId':_0x139422['id'],'queue_name':_0x15ed1e[_0xf6f5('0x2b')],'VoiceQueueId':_0x15ed1e['id'],'interface':_[_0xf6f5('0x90')](_0x139422[_0xf6f5('0x8d')])?util[_0xf6f5('0x91')](_0xf6f5('0x92'),_0x139422[_0xf6f5('0x2b')]):_0x139422[_0xf6f5('0x8d')],'paused':_0x139422['voicePause']||![],'penalty':_0x15ed1e[_0xf6f5('0x93')]['penalty']},{'transaction':_0x5387fe});});return Promise[_0xf6f5('0x94')](_0x2a3bda);});});});return Promise[_0xf6f5('0x94')](_0xa0e421);});return Promise['all'](_0x361059);})[_0xf6f5('0x28')](function(){return db[_0xf6f5('0x6a')][_0xf6f5('0x70')]({'where':{'teamId':_0x434128}})[_0xf6f5('0x28')](function(_0x45e4cf){if(_0x45e4cf){var _0x500283=_[_0xf6f5('0x2e')](_0x27fac0,function(_0x40759a){db[_0xf6f5('0x6b')][_0xf6f5('0x8f')]({'UserId':_0x40759a,'VoicePrefixId':_0x45e4cf[_0xf6f5('0x6c')]});});return Promise['all'](_0x500283);}});});});return Promise[_0xf6f5('0x94')](_0x12f889)['then'](function(){return _0x2e2cde[_0xf6f5('0x7e')](_0x27fac0,{'transaction':_0x5387fe})['spread'](function(_0x290480){return _0x290480;});});});}})['then'](respondWithResult(_0x563cbe,null))[_0xf6f5('0x45')](handleError(_0x563cbe,null));};exports['removeAgents']=function(_0x46f848,_0x5b0d69){var _0x290dfb=_[_0xf6f5('0x7f')](_0x46f848[_0xf6f5('0x35')][_0xf6f5('0x7d')])?_0x46f848[_0xf6f5('0x35')][_0xf6f5('0x7d')]:[_0x46f848[_0xf6f5('0x35')][_0xf6f5('0x7d')]];var _0x5002ce=_0x46f848[_0xf6f5('0x79')]['id'];return db['Team'][_0xf6f5('0x49')]({'where':{'id':_0x5002ce}})['then'](handleEntityNotFound(_0x5b0d69,null))['then'](function(_0x48f199){if(_0x48f199){var _0x2de205=[_0xf6f5('0x80'),_0xf6f5('0x95'),_0xf6f5('0x81'),_0xf6f5('0x96'),'Fax',_0xf6f5('0x97'),_0xf6f5('0x83')];return db[_0xf6f5('0x52')][_0xf6f5('0x53')](function(_0x25c312){var _0x483fc1=_['map'](_0x2de205,function(_0x2584bf){var _0x3b4ff9={'attributes':['id',_0xf6f5('0x2b')]};return _0x48f199['get'+_0x2584bf+_0xf6f5('0x78')](_0x3b4ff9)[_0xf6f5('0x28')](function(_0x186f5a){var _0x1f9470=_[_0xf6f5('0x2e')](_0x186f5a,function(_0x289b2f){return _0x289b2f[_0xf6f5('0x98')](_0x290dfb,{'transaction':_0x25c312})[_0xf6f5('0x28')](function(){var _0x2dac98=_[_0xf6f5('0x2e')](_0x290dfb,function(_0x5b10d7){socket[_0xf6f5('0x87')](_0xf6f5('0x88')+_0x2584bf+_0xf6f5('0x99'),{'UserId':Number(_0x5b10d7),[_0x2584bf+_0xf6f5('0x85')]:_0x289b2f['id']});if(_0x2584bf!==_0xf6f5('0x80')){return;}return db[_0xf6f5('0x8e')][_0xf6f5('0x51')]({'where':{'VoiceQueueId':_0x289b2f['id'],'UserId':_0x5b10d7},'transaction':_0x25c312});});return Promise[_0xf6f5('0x94')](_0x2dac98);});});return Promise[_0xf6f5('0x94')](_0x1f9470);});});return Promise[_0xf6f5('0x94')](_0x483fc1)['then'](function(){return _0x48f199[_0xf6f5('0x98')](_0x290dfb,{'transaction':_0x25c312});})[_0xf6f5('0x28')](function(){return db[_0xf6f5('0x6a')][_0xf6f5('0x70')]({'where':{'teamId':_0x5002ce}})[_0xf6f5('0x28')](function(_0x4b31fe){if(_0x4b31fe){var _0xec94a0=_[_0xf6f5('0x2e')](_0x290dfb,function(_0x576fe4){db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x576fe4,'VoicePrefixId':_0x4b31fe[_0xf6f5('0x6c')]}});});return Promise['all'](_0xec94a0);}});});});}})[_0xf6f5('0x28')](respondWithStatusCode(_0x5b0d69,null))['catch'](handleError(_0x5b0d69,null));};exports[_0xf6f5('0x9a')]=function(_0x1d5074,_0x3edb6d,_0x4bdc9b){var _0x371037={};var _0xa515c9={};var _0x21e6aa;var _0x8ea4ee;return db[_0xf6f5('0x2f')][_0xf6f5('0x70')]({'where':{'id':_0x1d5074['params']['id']}})[_0xf6f5('0x28')](handleEntityNotFound(_0x3edb6d,null))[_0xf6f5('0x28')](function(_0x55dfee){if(_0x55dfee){_0x21e6aa=_0x55dfee;_0xa515c9[_0xf6f5('0x34')]=_['keys'](db[_0xf6f5('0x8a')][_0xf6f5('0x30')]);_0xa515c9['query']=_[_0xf6f5('0x36')](_0x1d5074[_0xf6f5('0x35')]);_0xa515c9[_0xf6f5('0x47')]=_[_0xf6f5('0x48')](_0xa515c9[_0xf6f5('0x34')],_0xa515c9[_0xf6f5('0x35')]);_0x371037[_0xf6f5('0x37')]=_[_0xf6f5('0x48')](_0xa515c9[_0xf6f5('0x34')],qs[_0xf6f5('0x38')](_0x1d5074[_0xf6f5('0x35')]['fields']));_0x371037[_0xf6f5('0x37')]=_0x371037[_0xf6f5('0x37')][_0xf6f5('0x39')]?_0x371037[_0xf6f5('0x37')]:_0xa515c9[_0xf6f5('0x34')];_0x371037[_0xf6f5('0x3b')]=qs[_0xf6f5('0x3c')](_0x1d5074[_0xf6f5('0x35')][_0xf6f5('0x3c')]);_0x371037[_0xf6f5('0x3d')]=qs[_0xf6f5('0x47')](_['pick'](_0x1d5074[_0xf6f5('0x35')],_0xa515c9[_0xf6f5('0x47')]));if(_0x1d5074[_0xf6f5('0x35')]['filter']){_0x371037[_0xf6f5('0x3d')]=_[_0xf6f5('0x41')](_0x371037[_0xf6f5('0x3d')],{'$or':_[_0xf6f5('0x2e')](_0x371037[_0xf6f5('0x37')],function(_0x278a3c){var _0x199339={};_0x199339[_0x278a3c]={'$like':'%'+_0x1d5074[_0xf6f5('0x35')]['filter']+'%'};return _0x199339;})});}_0x371037=_[_0xf6f5('0x41')]({},_0x371037,_0x1d5074[_0xf6f5('0x42')]);return _0x21e6aa[_0xf6f5('0x9a')](_0x371037);}})[_0xf6f5('0x28')](function(_0x5d7294){if(_0x5d7294){_0x8ea4ee=_0x5d7294[_0xf6f5('0x39')];if(!_0x1d5074[_0xf6f5('0x35')][_0xf6f5('0x3a')](_0xf6f5('0x9b'))){_0x371037[_0xf6f5('0x1f')]=qs[_0xf6f5('0x1f')](_0x1d5074[_0xf6f5('0x35')][_0xf6f5('0x1f')]);_0x371037[_0xf6f5('0x20')]=qs['offset'](_0x1d5074[_0xf6f5('0x35')]['offset']);}return _0x21e6aa[_0xf6f5('0x9a')](_0x371037);}})[_0xf6f5('0x28')](function(_0x3e2a4b){if(_0x3e2a4b){return _0x3e2a4b?{'count':_0x8ea4ee,'rows':_0x3e2a4b}:null;}})['then'](respondWithResult(_0x3edb6d,null))['catch'](handleError(_0x3edb6d,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index f020ac5..b16e54f 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 _0xb90a=['hook','exports','events','../../mysqldb','Team','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x427be9,_0x440b32){var _0x1b6d9a=function(_0x4ab4e5){while(--_0x4ab4e5){_0x427be9['push'](_0x427be9['shift']());}};_0x1b6d9a(++_0x440b32);}(_0xb90a,0xa2));var _0xab90=function(_0x5eda1c,_0x242c2e){_0x5eda1c=_0x5eda1c-0x0;var _0x44b1a4=_0xb90a[_0x5eda1c];return _0x44b1a4;};'use strict';var EventEmitter=require(_0xab90('0x0'));var Team=require(_0xab90('0x1'))['db'][_0xab90('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xab90('0x3')](0x0);var events={'afterCreate':_0xab90('0x4'),'afterUpdate':'update','afterDestroy':_0xab90('0x5')};function emitEvent(_0x2f3574){return function(_0x5c509e,_0x4b021c,_0x19f631){TeamEvents[_0xab90('0x6')](_0x2f3574+':'+_0x5c509e['id'],_0x5c509e);TeamEvents[_0xab90('0x6')](_0x2f3574,_0x5c509e);_0x19f631(null);};}for(var e in events){if(events[_0xab90('0x7')](e)){var event=events[e];Team[_0xab90('0x8')](e,emitEvent(event));}}module[_0xab90('0x9')]=TeamEvents; \ No newline at end of file +var _0xbd29=['emit','hasOwnProperty','hook','exports','Team','setMaxListeners','save','update'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xbd29,0xc4));var _0x9bd2=function(_0x5347b1,_0x5c3797){_0x5347b1=_0x5347b1-0x0;var _0x4c85b4=_0xbd29[_0x5347b1];return _0x4c85b4;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0x9bd2('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0x9bd2('0x1')](0x0);var events={'afterCreate':_0x9bd2('0x2'),'afterUpdate':_0x9bd2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4459d5){return function(_0x41857f,_0xcb71b9,_0x4239c0){TeamEvents[_0x9bd2('0x4')](_0x4459d5+':'+_0x41857f['id'],_0x41857f);TeamEvents[_0x9bd2('0x4')](_0x4459d5,_0x41857f);_0x4239c0(null);};}for(var e in events){if(events[_0x9bd2('0x5')](e)){var event=events[e];Team[_0x9bd2('0x6')](e,emitEvent(event));}}module[_0x9bd2('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index e43ecc9..23283ad 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 _0xab03=['then','map','setDataValue','catch','define','Team','Chat','Fax','Mail','Voice','Whatsapp','resolve','all','lodash','./team.attributes','get','Queues'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0xab03,0x10c));var _0x3ab0=function(_0x5a79cc,_0x105952){_0x5a79cc=_0x5a79cc-0x0;var _0x233c1a=_0xab03[_0x5a79cc];return _0x233c1a;};'use strict';var _=require(_0x3ab0('0x0'));var attributes=require(_0x3ab0('0x1'));function getQueuesByChannel(_0x48cafe,_0x37f882){var _0x1390a2=_0x3ab0('0x2')+_0x37f882+_0x3ab0('0x3');return _0x48cafe[_0x1390a2]()[_0x3ab0('0x4')](function(_0x191e2c){return _[_0x3ab0('0x5')](_0x191e2c,function(_0x106403){_0x106403[_0x3ab0('0x6')]('channel',_0x37f882);return _0x106403;});})[_0x3ab0('0x7')](function(_0x57bee2){throw _0x57bee2;});}module['exports']=function(_0x5a2841){return _0x5a2841[_0x3ab0('0x8')](_0x3ab0('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x7da381=this;var _0x4db939=[_0x3ab0('0xa'),_0x3ab0('0xb'),_0x3ab0('0xc'),'Openchannel','Sms',_0x3ab0('0xd'),_0x3ab0('0xe')];return Promise[_0x3ab0('0xf')]()[_0x3ab0('0x4')](function(){var _0x2da272=_['map'](_0x4db939,function(_0x298c88){return getQueuesByChannel(_0x7da381,_0x298c88);});return Promise[_0x3ab0('0x10')](_0x2da272);})[_0x3ab0('0x7')](function(_0x25537d){throw _0x25537d;});}}});}; \ No newline at end of file +var _0x4bc6=['Sms','Voice','resolve','then','catch','./team.attributes','get','map','channel','exports','Team','teams','Fax','Mail','Openchannel'];(function(_0x1e7382,_0x44937e){var _0x16debf=function(_0x520a8a){while(--_0x520a8a){_0x1e7382['push'](_0x1e7382['shift']());}};_0x16debf(++_0x44937e);}(_0x4bc6,0xb9));var _0x64bc=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4bc6[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var attributes=require(_0x64bc('0x0'));function getQueuesByChannel(_0x544d60,_0x5c5474){var _0x2d89fa=_0x64bc('0x1')+_0x5c5474+'Queues';return _0x544d60[_0x2d89fa]()['then'](function(_0x5ccb64){return _[_0x64bc('0x2')](_0x5ccb64,function(_0xee708a){_0xee708a['setDataValue'](_0x64bc('0x3'),_0x5c5474);return _0xee708a;});})['catch'](function(_0x1b4904){throw _0x1b4904;});}module[_0x64bc('0x4')]=function(_0x51bc17){return _0x51bc17['define'](_0x64bc('0x5'),attributes,{'tableName':_0x64bc('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x1c4d3e=this;var _0x1e6e71=['Chat',_0x64bc('0x7'),_0x64bc('0x8'),_0x64bc('0x9'),_0x64bc('0xa'),_0x64bc('0xb'),'Whatsapp'];return Promise[_0x64bc('0xc')]()[_0x64bc('0xd')](function(){var _0x391a2=_[_0x64bc('0x2')](_0x1e6e71,function(_0x59b613){return getQueuesByChannel(_0x1c4d3e,_0x59b613);});return Promise['all'](_0x391a2);})[_0x64bc('0xe')](function(_0x25b68c){throw _0x25b68c;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 5b71f4c..f82c290 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 _0xf015=['debug','stringify','error','code','message','result','catch','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','then','info','Team,\x20%s,\x20%s','request\x20sent'];(function(_0x3a3b6a,_0x51e1e5){var _0x2c5061=function(_0x563d7f){while(--_0x563d7f){_0x3a3b6a['push'](_0x3a3b6a['shift']());}};_0x2c5061(++_0x51e1e5);}(_0xf015,0x13b));var _0x5f01=function(_0x5124ab,_0x189024){_0x5124ab=_0x5124ab-0x0;var _0x5f4194=_0xf015[_0x5124ab];return _0x5f4194;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5f01('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f01('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f01('0x2'));var logger=require('../../config/logger')(_0x5f01('0x3'));var config=require(_0x5f01('0x4'));var jayson=require(_0x5f01('0x5'));var client=jayson[_0x5f01('0x6')][_0x5f01('0x7')]({'port':0x232a});config['redis']=_[_0x5f01('0x8')](config[_0x5f01('0x9')],{'host':_0x5f01('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x2a8667,_0x573d5b,_0x3ef31a){return new BPromise(function(_0x4d8419,_0x4c3915){return client['request'](_0x2a8667,_0x3ef31a)[_0x5f01('0xb')](function(_0x2a7584){logger[_0x5f01('0xc')](_0x5f01('0xd'),_0x573d5b,_0x5f01('0xe'));logger[_0x5f01('0xf')]('Team,\x20%s,\x20%s,\x20%s',_0x573d5b,'request\x20sent',JSON[_0x5f01('0x10')](_0x2a7584));if(_0x2a7584[_0x5f01('0x11')]){if(_0x2a7584[_0x5f01('0x11')][_0x5f01('0x12')]===0x1f4){logger[_0x5f01('0x11')](_0x5f01('0xd'),_0x573d5b,_0x2a7584[_0x5f01('0x11')][_0x5f01('0x13')]);return _0x4c3915(_0x2a7584[_0x5f01('0x11')][_0x5f01('0x13')]);}logger[_0x5f01('0x11')](_0x5f01('0xd'),_0x573d5b,_0x2a7584[_0x5f01('0x11')][_0x5f01('0x13')]);return _0x4d8419(_0x2a7584[_0x5f01('0x11')]['message']);}else{logger['info']('Team,\x20%s,\x20%s',_0x573d5b,_0x5f01('0xe'));_0x4d8419(_0x2a7584[_0x5f01('0x14')][_0x5f01('0x13')]);}})[_0x5f01('0x15')](function(_0x37a73b){logger['error']('Team,\x20%s,\x20%s',_0x573d5b,_0x37a73b);_0x4c3915(_0x37a73b);});});} \ No newline at end of file +var _0xcdb1=['localhost','socket.io-emitter','./team.socket','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x40d339,_0xb726c3){var _0x5cbd0b=function(_0xf239d3){while(--_0xf239d3){_0x40d339['push'](_0x40d339['shift']());}};_0x5cbd0b(++_0xb726c3);}(_0xcdb1,0x1eb));var _0x1cdb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcdb1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x1cdb('0x0'));var moment=require(_0x1cdb('0x1'));var BPromise=require(_0x1cdb('0x2'));var rs=require(_0x1cdb('0x3'));var fs=require('fs');var Redis=require(_0x1cdb('0x4'));var db=require(_0x1cdb('0x5'))['db'];var utils=require(_0x1cdb('0x6'));var logger=require(_0x1cdb('0x7'))(_0x1cdb('0x8'));var config=require('../../config/environment');var jayson=require(_0x1cdb('0x9'));var client=jayson[_0x1cdb('0xa')][_0x1cdb('0xb')]({'port':0x232a});config[_0x1cdb('0xc')]=_['defaults'](config[_0x1cdb('0xc')],{'host':_0x1cdb('0xd'),'port':0x18eb});var socket=require(_0x1cdb('0xe'))(new Redis(config[_0x1cdb('0xc')]));require(_0x1cdb('0xf'))['register'](socket);function respondWithRpcPromise(_0x2f05af,_0x32710b,_0xe25d5a){return new BPromise(function(_0x8a24,_0x459161){return client['request'](_0x2f05af,_0xe25d5a)[_0x1cdb('0x10')](function(_0x388093){logger[_0x1cdb('0x11')](_0x1cdb('0x12'),_0x32710b,_0x1cdb('0x13'));logger[_0x1cdb('0x14')](_0x1cdb('0x15'),_0x32710b,'request\x20sent',JSON[_0x1cdb('0x16')](_0x388093));if(_0x388093[_0x1cdb('0x17')]){if(_0x388093[_0x1cdb('0x17')][_0x1cdb('0x18')]===0x1f4){logger[_0x1cdb('0x17')](_0x1cdb('0x12'),_0x32710b,_0x388093[_0x1cdb('0x17')]['message']);return _0x459161(_0x388093['error']['message']);}logger[_0x1cdb('0x17')]('Team,\x20%s,\x20%s',_0x32710b,_0x388093[_0x1cdb('0x17')][_0x1cdb('0x19')]);return _0x8a24(_0x388093['error'][_0x1cdb('0x19')]);}else{logger[_0x1cdb('0x11')](_0x1cdb('0x12'),_0x32710b,_0x1cdb('0x13'));_0x8a24(_0x388093[_0x1cdb('0x1a')]['message']);}})[_0x1cdb('0x1b')](function(_0x53c470){logger['error'](_0x1cdb('0x12'),_0x32710b,_0x53c470);_0x459161(_0x53c470);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index ae6120c..e0130e4 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 _0x3c2c=['register','length','./team.events','save','remove','update','emit'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x3c2c,0x160));var _0xc3c2=function(_0x209f97,_0x21205d){_0x209f97=_0x209f97-0x0;var _0x5bd111=_0x3c2c[_0x209f97];return _0x5bd111;};'use strict';var TeamEvents=require(_0xc3c2('0x0'));var events=[_0xc3c2('0x1'),_0xc3c2('0x2'),_0xc3c2('0x3')];function createListener(_0x59a8c0,_0x481bf9){return function(_0x321ef5){_0x481bf9[_0xc3c2('0x4')](_0x59a8c0,_0x321ef5);};}function removeListener(_0x2f4e7e,_0x3bb44f){return function(){TeamEvents['removeListener'](_0x2f4e7e,_0x3bb44f);};}exports[_0xc3c2('0x5')]=function(_0x158a5f){for(var _0x234da9=0x0,_0x21fa50=events[_0xc3c2('0x6')];_0x234da9<_0x21fa50;_0x234da9++){var _0x48cab1=events[_0x234da9];var _0x5daa76=createListener('team:'+_0x48cab1,_0x158a5f);TeamEvents['on'](_0x48cab1,_0x5daa76);}}; \ No newline at end of file +var _0x2868=['length','team:','./team.events','remove','update','emit','removeListener'];(function(_0x54f415,_0x52be28){var _0xaca73b=function(_0x5937ce){while(--_0x5937ce){_0x54f415['push'](_0x54f415['shift']());}};_0xaca73b(++_0x52be28);}(_0x2868,0x191));var _0x8286=function(_0x356c8c,_0x312bd0){_0x356c8c=_0x356c8c-0x0;var _0x1c64d3=_0x2868[_0x356c8c];return _0x1c64d3;};'use strict';var TeamEvents=require(_0x8286('0x0'));var events=['save',_0x8286('0x1'),_0x8286('0x2')];function createListener(_0x5d5814,_0x19990a){return function(_0x4b9ea1){_0x19990a[_0x8286('0x3')](_0x5d5814,_0x4b9ea1);};}function removeListener(_0x596cd4,_0xf1a3b2){return function(){TeamEvents[_0x8286('0x4')](_0x596cd4,_0xf1a3b2);};}exports['register']=function(_0xa1b0f9){for(var _0x9a8dcd=0x0,_0x2c9b6c=events[_0x8286('0x5')];_0x9a8dcd<_0x2c9b6c;_0x9a8dcd++){var _0x5be220=events[_0x9a8dcd];var _0x267cf4=createListener(_0x8286('0x6')+_0x5be220,_0xa1b0f9);TeamEvents['on'](_0x5be220,_0x267cf4);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 3f219ab..eebe746 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 _0x81d5=['INTEGER','sequelize','exports'];(function(_0x245703,_0x3eb091){var _0x2e74bc=function(_0x480fac){while(--_0x480fac){_0x245703['push'](_0x245703['shift']());}};_0x2e74bc(++_0x3eb091);}(_0x81d5,0x1ab));var _0x581d=function(_0x54a79c,_0x59e212){_0x54a79c=_0x54a79c-0x0;var _0x5d9db9=_0x81d5[_0x54a79c];return _0x5d9db9;};'use strict';var Sequelize=require(_0x581d('0x0'));module[_0x581d('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x581d('0x2')]}}; \ No newline at end of file +var _0xd3d1=['sequelize','exports'];(function(_0x5267b6,_0x52425f){var _0x14a8f1=function(_0x25399a){while(--_0x25399a){_0x5267b6['push'](_0x5267b6['shift']());}};_0x14a8f1(++_0x52425f);}(_0xd3d1,0x172));var _0x1d3d=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xd3d1[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0x1d3d('0x0'));module[_0x1d3d('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 073bf30..5cb371e 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 _0x83cd=['path','rimraf','../../config/environment','exports','TeamVoicePrefix','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2e65f4,_0x88c0a2){var _0x146a04=function(_0x2e775b){while(--_0x2e775b){_0x2e65f4['push'](_0x2e65f4['shift']());}};_0x146a04(++_0x88c0a2);}(_0x83cd,0x17b));var _0xd83c=function(_0x4f2fd,_0x4affd6){_0x4f2fd=_0x4f2fd-0x0;var _0x177d66=_0x83cd[_0x4f2fd];return _0x177d66;};'use strict';var _=require(_0xd83c('0x0'));var util=require(_0xd83c('0x1'));var logger=require(_0xd83c('0x2'))(_0xd83c('0x3'));var moment=require(_0xd83c('0x4'));var BPromise=require('bluebird');var rp=require(_0xd83c('0x5'));var fs=require('fs');var path=require(_0xd83c('0x6'));var rimraf=require(_0xd83c('0x7'));var config=require(_0xd83c('0x8'));var attributes=require('./teamVoicePrefix.attributes');module[_0xd83c('0x9')]=function(_0x1f1289,_0x154f67){return _0x1f1289['define'](_0xd83c('0xa'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fad=['request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3ba527,_0x446a5e){var _0x5ee6ad=function(_0x5978c7){while(--_0x5978c7){_0x3ba527['push'](_0x3ba527['shift']());}};_0x5ee6ad(++_0x446a5e);}(_0x4fad,0xcb));var _0xd4fa=function(_0x28a4cf,_0x395a4b){_0x28a4cf=_0x28a4cf-0x0;var _0x48181d=_0x4fad[_0x28a4cf];return _0x48181d;};'use strict';var _=require(_0xd4fa('0x0'));var util=require(_0xd4fa('0x1'));var logger=require(_0xd4fa('0x2'))('api');var moment=require(_0xd4fa('0x3'));var BPromise=require(_0xd4fa('0x4'));var rp=require(_0xd4fa('0x5'));var fs=require('fs');var path=require(_0xd4fa('0x6'));var rimraf=require(_0xd4fa('0x7'));var config=require(_0xd4fa('0x8'));var attributes=require(_0xd4fa('0x9'));module[_0xd4fa('0xa')]=function(_0x597fbe,_0x2d4e07){return _0x597fbe['define'](_0xd4fa('0xb'),attributes,{'tableName':_0xd4fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 8bac103..2f4fe2a 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x484cb9,_0x103489){var _0x59517e=function(_0x2936bc){while(--_0x2936bc){_0x484cb9['push'](_0x484cb9['shift']());}};_0x59517e(++_0x103489);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1ac541,_0x43a6a7){var _0x12913e=function(_0x3ce3e3){while(--_0x3ce3e3){_0x1ac541['push'](_0x1ac541['shift']());}};_0x12913e(++_0x43a6a7);}(_0xe706,0xa3));var _0x6e70=function(_0x284609,_0x386b54){_0x284609=_0x284609-0x0;var _0x55116b=_0xe706[_0x284609];return _0x55116b;};'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 5a430f1..1324704 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 _0x579b=['exports'];(function(_0x48c365,_0x440e82){var _0x307b7f=function(_0x1727d2){while(--_0x1727d2){_0x48c365['push'](_0x48c365['shift']());}};_0x307b7f(++_0x440e82);}(_0x579b,0xbc));var _0xb579=function(_0x5b36bd,_0x4dfb36){_0x5b36bd=_0x5b36bd-0x0;var _0x1614fe=_0x579b[_0x5b36bd];return _0x1614fe;};'use strict';var Sequelize=require('sequelize');module[_0xb579('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e4=['INTEGER','sequelize','exports'];(function(_0x321533,_0x5bb532){var _0x87c444=function(_0x326159){while(--_0x326159){_0x321533['push'](_0x321533['shift']());}};_0x87c444(++_0x5bb532);}(_0xa9e4,0xbb));var _0x4a9e=function(_0x224dc3,_0x4180b0){_0x224dc3=_0x224dc3-0x0;var _0x45d783=_0xa9e4[_0x224dc3];return _0x45d783;};'use strict';var Sequelize=require(_0x4a9e('0x0'));module[_0x4a9e('0x1')]={'penalty':{'type':Sequelize[_0x4a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index f1dafb8..382c1c5 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 _0xa101=['define','lodash','util','api','moment','request-promise','path','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x2ce6d5,_0x333e0c){var _0x32d272=function(_0x399f0b){while(--_0x399f0b){_0x2ce6d5['push'](_0x2ce6d5['shift']());}};_0x32d272(++_0x333e0c);}(_0xa101,0x15f));var _0x1a10=function(_0x527824,_0xc824a9){_0x527824=_0x527824-0x0;var _0xc8b8ed=_0xa101[_0x527824];return _0xc8b8ed;};'use strict';var _=require(_0x1a10('0x0'));var util=require(_0x1a10('0x1'));var logger=require('../../config/logger')(_0x1a10('0x2'));var moment=require(_0x1a10('0x3'));var BPromise=require('bluebird');var rp=require(_0x1a10('0x4'));var fs=require('fs');var path=require(_0x1a10('0x5'));var rimraf=require('rimraf');var config=require(_0x1a10('0x6'));var attributes=require(_0x1a10('0x7'));module[_0x1a10('0x8')]=function(_0x1a9d22,_0x2eb3c8){return _0x1a9d22[_0x1a10('0x9')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2ce=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','TeamVoiceQueue','util','api','moment'];(function(_0x287440,_0x11cf54){var _0x2ee954=function(_0x3bf2a6){while(--_0x3bf2a6){_0x287440['push'](_0x287440['shift']());}};_0x2ee954(++_0x11cf54);}(_0xd2ce,0x13c));var _0xed2c=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xd2ce[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require(_0xed2c('0x0'));var logger=require('../../config/logger')(_0xed2c('0x1'));var moment=require(_0xed2c('0x2'));var BPromise=require(_0xed2c('0x3'));var rp=require(_0xed2c('0x4'));var fs=require('fs');var path=require(_0xed2c('0x5'));var rimraf=require(_0xed2c('0x6'));var config=require(_0xed2c('0x7'));var attributes=require('./teamVoiceQueue.attributes');module[_0xed2c('0x8')]=function(_0x5b6ccb,_0x38aa25){return _0x5b6ccb[_0xed2c('0x9')](_0xed2c('0xa'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index b5ca36a..2caa0ee 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 _0xec6b=['then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','request'];(function(_0x394c83,_0x4bd465){var _0x450395=function(_0xaea3ae){while(--_0xaea3ae){_0x394c83['push'](_0x394c83['shift']());}};_0x450395(++_0x4bd465);}(_0xec6b,0x129));var _0xbec6=function(_0x43e4b5,_0x205d64){_0x43e4b5=_0x43e4b5-0x0;var _0x2001a5=_0xec6b[_0x43e4b5];return _0x2001a5;};'use strict';var _=require(_0xbec6('0x0'));var util=require(_0xbec6('0x1'));var moment=require('moment');var BPromise=require(_0xbec6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbec6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbec6('0x4'));var logger=require(_0xbec6('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51c972,_0x6d3729,_0x5df981){return new BPromise(function(_0x58edd9,_0x3a0c1c){return client[_0xbec6('0x6')](_0x51c972,_0x5df981)[_0xbec6('0x7')](function(_0x3fff36){logger[_0xbec6('0x8')](_0xbec6('0x9'),_0x6d3729,_0xbec6('0xa'));logger[_0xbec6('0xb')](_0xbec6('0xc'),_0x6d3729,_0xbec6('0xa'),JSON[_0xbec6('0xd')](_0x3fff36));if(_0x3fff36[_0xbec6('0xe')]){if(_0x3fff36['error'][_0xbec6('0xf')]===0x1f4){logger['error'](_0xbec6('0x9'),_0x6d3729,_0x3fff36[_0xbec6('0xe')]['message']);return _0x3a0c1c(_0x3fff36[_0xbec6('0xe')]['message']);}logger[_0xbec6('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x6d3729,_0x3fff36[_0xbec6('0xe')]['message']);return _0x58edd9(_0x3fff36[_0xbec6('0xe')][_0xbec6('0x10')]);}else{logger[_0xbec6('0x8')](_0xbec6('0x9'),_0x6d3729,'request\x20sent');_0x58edd9(_0x3fff36[_0xbec6('0x11')]['message']);}})[_0xbec6('0x12')](function(_0x20924c){logger[_0xbec6('0xe')](_0xbec6('0x9'),_0x6d3729,_0x20924c);_0x3a0c1c(_0x20924c);});});} \ No newline at end of file +var _0x94b6=['TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info'];(function(_0x1f75a4,_0x220814){var _0x3e3309=function(_0x595036){while(--_0x595036){_0x1f75a4['push'](_0x1f75a4['shift']());}};_0x3e3309(++_0x220814);}(_0x94b6,0x143));var _0x694b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x94b6[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x694b('0x0'));var util=require(_0x694b('0x1'));var moment=require('moment');var BPromise=require(_0x694b('0x2'));var rs=require(_0x694b('0x3'));var fs=require('fs');var Redis=require(_0x694b('0x4'));var db=require(_0x694b('0x5'))['db'];var utils=require(_0x694b('0x6'));var logger=require(_0x694b('0x7'))(_0x694b('0x8'));var config=require('../../config/environment');var jayson=require(_0x694b('0x9'));var client=jayson[_0x694b('0xa')][_0x694b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32efd7,_0x2de295,_0x43bc68){return new BPromise(function(_0x4b8002,_0x3421ca){return client['request'](_0x32efd7,_0x43bc68)['then'](function(_0x1a5235){logger[_0x694b('0xc')](_0x694b('0xd'),_0x2de295,_0x694b('0xe'));logger[_0x694b('0xf')](_0x694b('0x10'),_0x2de295,_0x694b('0xe'),JSON['stringify'](_0x1a5235));if(_0x1a5235[_0x694b('0x11')]){if(_0x1a5235[_0x694b('0x11')][_0x694b('0x12')]===0x1f4){logger[_0x694b('0x11')](_0x694b('0xd'),_0x2de295,_0x1a5235['error'][_0x694b('0x13')]);return _0x3421ca(_0x1a5235[_0x694b('0x11')][_0x694b('0x13')]);}logger[_0x694b('0x11')](_0x694b('0xd'),_0x2de295,_0x1a5235[_0x694b('0x11')][_0x694b('0x13')]);return _0x4b8002(_0x1a5235[_0x694b('0x11')][_0x694b('0x13')]);}else{logger[_0x694b('0xc')](_0x694b('0xd'),_0x2de295,_0x694b('0xe'));_0x4b8002(_0x1a5235[_0x694b('0x14')]['message']);}})['catch'](function(_0x42915c){logger[_0x694b('0x11')](_0x694b('0xd'),_0x2de295,_0x42915c);_0x3421ca(_0x42915c);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 544921e..12498ca 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 _0x07fa=['/:id','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index'];(function(_0x595268,_0x26ef81){var _0x5876c3=function(_0x498628){while(--_0x498628){_0x595268['push'](_0x595268['shift']());}};_0x5876c3(++_0x26ef81);}(_0x07fa,0x177));var _0xa07f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x07fa[_0x4a9fb1];return _0x348672;};'use strict';var multer=require('multer');var util=require(_0xa07f('0x0'));var path=require(_0xa07f('0x1'));var timeout=require(_0xa07f('0x2'));var express=require(_0xa07f('0x3'));var router=express[_0xa07f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa07f('0x5'));var interaction=require(_0xa07f('0x6'));var config=require('../../config/environment');var controller=require('./template.controller');router['get']('/',auth[_0xa07f('0x7')](),controller[_0xa07f('0x8')]);router['get'](_0xa07f('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xa07f('0xa')]);router[_0xa07f('0xb')]('/:id',auth[_0xa07f('0x7')](),controller[_0xa07f('0xc')]);router[_0xa07f('0xd')](_0xa07f('0x9'),auth[_0xa07f('0x7')](),controller[_0xa07f('0xe')]);module[_0xa07f('0xf')]=router; \ No newline at end of file +var _0xa017=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','/:id','isAuthenticated','put','update','delete'];(function(_0x1c3d9d,_0x1f6bdd){var _0x1bf071=function(_0xad41a){while(--_0xad41a){_0x1c3d9d['push'](_0x1c3d9d['shift']());}};_0x1bf071(++_0x1f6bdd);}(_0xa017,0x1f1));var _0x7a01=function(_0x10bc96,_0x344de4){_0x10bc96=_0x10bc96-0x0;var _0x1a43a1=_0xa017[_0x10bc96];return _0x1a43a1;};'use strict';var multer=require(_0x7a01('0x0'));var util=require(_0x7a01('0x1'));var path=require(_0x7a01('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7a01('0x3')]();var fs_extra=require(_0x7a01('0x4'));var auth=require(_0x7a01('0x5'));var interaction=require(_0x7a01('0x6'));var config=require(_0x7a01('0x7'));var controller=require(_0x7a01('0x8'));router[_0x7a01('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7a01('0x9')](_0x7a01('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x7a01('0xb')](),controller['create']);router[_0x7a01('0xc')](_0x7a01('0xa'),auth[_0x7a01('0xb')](),controller[_0x7a01('0xd')]);router[_0x7a01('0xe')](_0x7a01('0xa'),auth[_0x7a01('0xb')](),controller['destroy']);module[_0x7a01('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 711ba9f..94e7674 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 _0xce13=['sequelize','exports','STRING','TEXT'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xce13,0x1dc));var _0x3ce1=function(_0x395c37,_0x155af8){_0x395c37=_0x395c37-0x0;var _0x16fd9f=_0xce13[_0x395c37];return _0x16fd9f;};'use strict';var Sequelize=require(_0x3ce1('0x0'));module[_0x3ce1('0x1')]={'name':{'type':Sequelize[_0x3ce1('0x2')]},'description':{'type':Sequelize[_0x3ce1('0x2')]},'html':{'type':Sequelize[_0x3ce1('0x3')]}}; \ No newline at end of file +var _0xc9b5=['TEXT','sequelize','STRING'];(function(_0x487592,_0x37ecf0){var _0x3d5768=function(_0x515d80){while(--_0x515d80){_0x487592['push'](_0x487592['shift']());}};_0x3d5768(++_0x37ecf0);}(_0xc9b5,0x1cc));var _0x5c9b=function(_0x1304a2,_0x4a39b5){_0x1304a2=_0x1304a2-0x0;var _0x1e0281=_0xc9b5[_0x1304a2];return _0x1e0281;};'use strict';var Sequelize=require(_0x5c9b('0x0'));module['exports']={'name':{'type':Sequelize[_0x5c9b('0x1')]},'description':{'type':Sequelize[_0x5c9b('0x1')]},'html':{'type':Sequelize[_0x5c9b('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 261a4a6..38c29ea 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 _0x227b=['UserProfileResource','error','stack','name','send','index','Template','rawAttributes','fieldName','type','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','params','includeAll','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','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','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','get','Templates'];(function(_0x27f48b,_0x1b7e2a){var _0x4a86e7=function(_0x41442e){while(--_0x41442e){_0x27f48b['push'](_0x27f48b['shift']());}};_0x4a86e7(++_0x1b7e2a);}(_0x227b,0x1d8));var _0xb227=function(_0x57f049,_0x2ed4c8){_0x57f049=_0x57f049-0x0;var _0x6ff0dd=_0x227b[_0x57f049];return _0x6ff0dd;};'use strict';var emlformat=require(_0xb227('0x0'));var rimraf=require(_0xb227('0x1'));var zipdir=require(_0xb227('0x2'));var jsonpatch=require(_0xb227('0x3'));var rp=require(_0xb227('0x4'));var moment=require(_0xb227('0x5'));var BPromise=require(_0xb227('0x6'));var Mustache=require(_0xb227('0x7'));var util=require(_0xb227('0x8'));var path=require(_0xb227('0x9'));var sox=require(_0xb227('0xa'));var csv=require(_0xb227('0xb'));var ejs=require(_0xb227('0xc'));var fs=require('fs');var fs_extra=require(_0xb227('0xd'));var _=require(_0xb227('0xe'));var squel=require(_0xb227('0xf'));var crypto=require(_0xb227('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xb227('0x11'));var toCsv=require(_0xb227('0xb'));var querystring=require(_0xb227('0x12'));var Papa=require(_0xb227('0x13'));var Redis=require(_0xb227('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xb227('0x15'));var as=require(_0xb227('0x16'));var hardwareService=require(_0xb227('0x17'));var logger=require(_0xb227('0x18'))(_0xb227('0x19'));var utils=require(_0xb227('0x1a'));var config=require(_0xb227('0x1b'));var licenseUtil=require(_0xb227('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ffadf,_0x50cf0f){_0x50cf0f=_0x50cf0f||0xcc;return function(_0x5200a6){if(_0x5200a6){return _0x2ffadf[_0xb227('0x1d')](_0x50cf0f);}return _0x2ffadf[_0xb227('0x1e')](_0x50cf0f)[_0xb227('0x1f')]();};}function respondWithResult(_0x28e8a2,_0x9f9507){_0x9f9507=_0x9f9507||0xc8;return function(_0x591ab3){if(_0x591ab3){return _0x28e8a2[_0xb227('0x1e')](_0x9f9507)[_0xb227('0x20')](_0x591ab3);}};}function respondWithFilteredResult(_0x34ad43,_0x187de8){return function(_0x1017ac){if(_0x1017ac){var _0x20b0aa=typeof _0x187de8[_0xb227('0x21')]===_0xb227('0x22')&&typeof _0x187de8[_0xb227('0x23')]==='undefined';var _0x350aa3=_0x1017ac['count'];var _0x38e5e9=_0x20b0aa?0x0:_0x187de8[_0xb227('0x21')];var _0x10fc79=_0x20b0aa?_0x1017ac[_0xb227('0x24')]:_0x187de8[_0xb227('0x21')]+_0x187de8[_0xb227('0x23')];var _0x47a918;if(_0x10fc79>=_0x350aa3){_0x10fc79=_0x350aa3;_0x47a918=0xc8;}else{_0x47a918=0xce;}_0x34ad43['status'](_0x47a918);return _0x34ad43['set'](_0xb227('0x25'),_0x38e5e9+'-'+_0x10fc79+'/'+_0x350aa3)[_0xb227('0x20')](_0x1017ac);}return null;};}function patchUpdates(_0x277ad5){return function(_0x2f0fc1){try{jsonpatch[_0xb227('0x26')](_0x2f0fc1,_0x277ad5,!![]);}catch(_0x330f38){return BPromise[_0xb227('0x27')](_0x330f38);}return _0x2f0fc1[_0xb227('0x28')]();};}function saveUpdates(_0x3a2c60,_0x4564b2){return function(_0xa7dd3e){if(_0xa7dd3e){return _0xa7dd3e['update'](_0x3a2c60)[_0xb227('0x29')](function(_0x48e51d){return _0x48e51d;});}return null;};}function removeEntity(_0x29dad5,_0xfa7fbb){return function(_0x44595a){if(_0x44595a){return _0x44595a['destroy']()[_0xb227('0x29')](function(){var _0x3e8df7=_0x44595a[_0xb227('0x2a')]({'plain':!![]});var _0x5a58a2=_0xb227('0x2b');return db[_0xb227('0x2c')]['destroy']({'where':{'type':_0x5a58a2,'resourceId':_0x3e8df7['id']}})['then'](function(){return _0x44595a;});})[_0xb227('0x29')](function(){_0x29dad5[_0xb227('0x1e')](0xcc)[_0xb227('0x1f')]();});}};}function handleEntityNotFound(_0x12890e,_0x3f5b7c){return function(_0x34de6a){if(!_0x34de6a){_0x12890e[_0xb227('0x1d')](0x194);}return _0x34de6a;};}function handleError(_0xd385b5,_0x16beb6){_0x16beb6=_0x16beb6||0x1f4;return function(_0x182cad){logger[_0xb227('0x2d')](_0x182cad[_0xb227('0x2e')]);if(_0x182cad['name']){delete _0x182cad[_0xb227('0x2f')];}_0xd385b5[_0xb227('0x1e')](_0x16beb6)[_0xb227('0x30')](_0x182cad);};}exports[_0xb227('0x31')]=function(_0x1d0a1f,_0x523477){var _0x312baa={},_0x2da32d={},_0x1d9d71={'count':0x0,'rows':[]};var _0x152f3f=_['map'](db[_0xb227('0x32')][_0xb227('0x33')],function(_0x3f3de7){return{'name':_0x3f3de7[_0xb227('0x34')],'type':_0x3f3de7[_0xb227('0x35')]['key']};});_0x2da32d['model']=_[_0xb227('0x36')](_0x152f3f,'name');_0x2da32d['query']=_[_0xb227('0x37')](_0x1d0a1f[_0xb227('0x38')]);_0x2da32d[_0xb227('0x39')]=_[_0xb227('0x3a')](_0x2da32d[_0xb227('0x3b')],_0x2da32d['query']);_0x312baa[_0xb227('0x3c')]=_['intersection'](_0x2da32d['model'],qs[_0xb227('0x3d')](_0x1d0a1f[_0xb227('0x38')][_0xb227('0x3d')]));_0x312baa[_0xb227('0x3c')]=_0x312baa[_0xb227('0x3c')][_0xb227('0x3e')]?_0x312baa[_0xb227('0x3c')]:_0x2da32d[_0xb227('0x3b')];if(!_0x1d0a1f[_0xb227('0x38')][_0xb227('0x3f')](_0xb227('0x40'))){_0x312baa[_0xb227('0x23')]=qs['limit'](_0x1d0a1f['query'][_0xb227('0x23')]);_0x312baa[_0xb227('0x21')]=qs[_0xb227('0x21')](_0x1d0a1f[_0xb227('0x38')][_0xb227('0x21')]);}_0x312baa[_0xb227('0x41')]=qs[_0xb227('0x42')](_0x1d0a1f[_0xb227('0x38')][_0xb227('0x42')]);_0x312baa[_0xb227('0x43')]=qs[_0xb227('0x39')](_[_0xb227('0x44')](_0x1d0a1f[_0xb227('0x38')],_0x2da32d[_0xb227('0x39')]),_0x152f3f);if(_0x1d0a1f[_0xb227('0x38')][_0xb227('0x45')]){_0x312baa[_0xb227('0x43')]=_['merge'](_0x312baa[_0xb227('0x43')],{'$or':_[_0xb227('0x36')](_0x152f3f,function(_0x3e3f59){if(_0x3e3f59[_0xb227('0x35')]!=='VIRTUAL'){var _0x2a59b4={};_0x2a59b4[_0x3e3f59[_0xb227('0x2f')]]={'$like':'%'+_0x1d0a1f[_0xb227('0x38')][_0xb227('0x45')]+'%'};return _0x2a59b4;}})});}_0x312baa=_[_0xb227('0x46')]({},_0x312baa,_0x1d0a1f[_0xb227('0x47')]);var _0x1f1c18={'where':_0x312baa[_0xb227('0x43')]};return db[_0xb227('0x32')][_0xb227('0x24')](_0x1f1c18)[_0xb227('0x29')](function(_0x21c3d9){_0x1d9d71[_0xb227('0x24')]=_0x21c3d9;if(_0x1d0a1f[_0xb227('0x38')]['includeAll']){_0x312baa[_0xb227('0x48')]=[{'all':!![]}];}return db['Template']['findAll'](_0x312baa);})[_0xb227('0x29')](function(_0x44f13c){_0x1d9d71[_0xb227('0x49')]=_0x44f13c;return _0x1d9d71;})[_0xb227('0x29')](respondWithFilteredResult(_0x523477,_0x312baa))['catch'](handleError(_0x523477,null));};exports['show']=function(_0x1e8618,_0x1d75c4){var _0x546ba7={'raw':!![],'where':{'id':_0x1e8618[_0xb227('0x4a')]['id']}},_0x20bd4b={};_0x20bd4b[_0xb227('0x3b')]=_[_0xb227('0x37')](db['Template']['rawAttributes']);_0x20bd4b[_0xb227('0x38')]=_[_0xb227('0x37')](_0x1e8618[_0xb227('0x38')]);_0x20bd4b[_0xb227('0x39')]=_[_0xb227('0x3a')](_0x20bd4b[_0xb227('0x3b')],_0x20bd4b[_0xb227('0x38')]);_0x546ba7['attributes']=_[_0xb227('0x3a')](_0x20bd4b[_0xb227('0x3b')],qs[_0xb227('0x3d')](_0x1e8618[_0xb227('0x38')][_0xb227('0x3d')]));_0x546ba7[_0xb227('0x3c')]=_0x546ba7[_0xb227('0x3c')][_0xb227('0x3e')]?_0x546ba7[_0xb227('0x3c')]:_0x20bd4b[_0xb227('0x3b')];if(_0x1e8618[_0xb227('0x38')][_0xb227('0x4b')]){_0x546ba7[_0xb227('0x48')]=[{'all':!![]}];}_0x546ba7=_[_0xb227('0x46')]({},_0x546ba7,_0x1e8618[_0xb227('0x47')]);return db[_0xb227('0x32')]['find'](_0x546ba7)[_0xb227('0x29')](handleEntityNotFound(_0x1d75c4,null))['then'](respondWithResult(_0x1d75c4,null))[_0xb227('0x4c')](handleError(_0x1d75c4,null));};exports[_0xb227('0x4d')]=function(_0xa74f6e,_0x36445c){return db['Template'][_0xb227('0x4d')](_0xa74f6e['body'],{})[_0xb227('0x29')](function(_0x18a436){var _0xa51fcd=_0xa74f6e[_0xb227('0x4e')]['get']({'plain':!![]});if(!_0xa51fcd)throw new Error(_0xb227('0x4f'));if(_0xa51fcd[_0xb227('0x50')]===_0xb227('0x4e')){var _0x64e27a=_0x18a436[_0xb227('0x2a')]({'plain':!![]});var _0x4e594f=_0xb227('0x2b');return db[_0xb227('0x51')][_0xb227('0x52')]({'where':{'name':_0x4e594f,'userProfileId':_0xa51fcd['userProfileId']},'raw':!![]})['then'](function(_0x314597){if(_0x314597&&_0x314597[_0xb227('0x53')]===0x0){return db[_0xb227('0x2c')][_0xb227('0x4d')]({'name':_0x64e27a[_0xb227('0x2f')],'resourceId':_0x64e27a['id'],'type':_0x314597[_0xb227('0x2f')],'sectionId':_0x314597['id']},{})[_0xb227('0x29')](function(){return _0x18a436;});}else{return _0x18a436;}})['catch'](function(_0x3c99d8){logger[_0xb227('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c99d8);throw _0x3c99d8;});}return _0x18a436;})[_0xb227('0x29')](respondWithResult(_0x36445c,0xc9))[_0xb227('0x4c')](handleError(_0x36445c,null));};exports[_0xb227('0x54')]=function(_0x43e142,_0x28d68d){if(_0x43e142[_0xb227('0x55')]['id']){delete _0x43e142[_0xb227('0x55')]['id'];}return db['Template'][_0xb227('0x52')]({'where':{'id':_0x43e142[_0xb227('0x4a')]['id']}})[_0xb227('0x29')](handleEntityNotFound(_0x28d68d,null))[_0xb227('0x29')](saveUpdates(_0x43e142[_0xb227('0x55')],null))[_0xb227('0x29')](respondWithResult(_0x28d68d,null))[_0xb227('0x4c')](handleError(_0x28d68d,null));};exports['destroy']=function(_0x20f8bb,_0x5b0122){return db['Template'][_0xb227('0x52')]({'where':{'id':_0x20f8bb[_0xb227('0x4a')]['id']}})[_0xb227('0x29')](handleEntityNotFound(_0x5b0122,null))[_0xb227('0x29')](removeEntity(_0x5b0122,null))[_0xb227('0x4c')](handleError(_0x5b0122,null));}; \ No newline at end of file +var _0x9af7=['includeAll','rows','catch','params','keys','rawAttributes','length','include','find','create','body','user','Templates','UserProfileSection','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','Template','type','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options'];(function(_0x92589b,_0x39fae3){var _0x27e5a9=function(_0x26ffcc){while(--_0x26ffcc){_0x92589b['push'](_0x92589b['shift']());}};_0x27e5a9(++_0x39fae3);}(_0x9af7,0x143));var _0x79af=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9af7[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x79af('0x0'));var rimraf=require(_0x79af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x79af('0x2'));var rp=require(_0x79af('0x3'));var moment=require(_0x79af('0x4'));var BPromise=require(_0x79af('0x5'));var Mustache=require(_0x79af('0x6'));var util=require(_0x79af('0x7'));var path=require(_0x79af('0x8'));var sox=require(_0x79af('0x9'));var csv=require(_0x79af('0xa'));var ejs=require(_0x79af('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x79af('0xc'));var crypto=require(_0x79af('0xd'));var jsforce=require(_0x79af('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x79af('0xa'));var querystring=require('querystring');var Papa=require(_0x79af('0xf'));var Redis=require(_0x79af('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x79af('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x79af('0x12'));var logger=require(_0x79af('0x13'))(_0x79af('0x14'));var utils=require('../../config/utils');var config=require(_0x79af('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x79af('0x16'))['db'];function respondWithStatusCode(_0x4796c0,_0x4944ad){_0x4944ad=_0x4944ad||0xcc;return function(_0x3f27a1){if(_0x3f27a1){return _0x4796c0[_0x79af('0x17')](_0x4944ad);}return _0x4796c0[_0x79af('0x18')](_0x4944ad)[_0x79af('0x19')]();};}function respondWithResult(_0x414a90,_0x316a62){_0x316a62=_0x316a62||0xc8;return function(_0x215b63){if(_0x215b63){return _0x414a90[_0x79af('0x18')](_0x316a62)[_0x79af('0x1a')](_0x215b63);}};}function respondWithFilteredResult(_0x5c176f,_0x3887a7){return function(_0x53eb98){if(_0x53eb98){var _0x2d4da8=typeof _0x3887a7['offset']===_0x79af('0x1b')&&typeof _0x3887a7[_0x79af('0x1c')]===_0x79af('0x1b');var _0x1f009f=_0x53eb98[_0x79af('0x1d')];var _0x515195=_0x2d4da8?0x0:_0x3887a7['offset'];var _0x120c98=_0x2d4da8?_0x53eb98[_0x79af('0x1d')]:_0x3887a7[_0x79af('0x1e')]+_0x3887a7['limit'];var _0x1df3cc;if(_0x120c98>=_0x1f009f){_0x120c98=_0x1f009f;_0x1df3cc=0xc8;}else{_0x1df3cc=0xce;}_0x5c176f[_0x79af('0x18')](_0x1df3cc);return _0x5c176f[_0x79af('0x1f')]('Content-Range',_0x515195+'-'+_0x120c98+'/'+_0x1f009f)[_0x79af('0x1a')](_0x53eb98);}return null;};}function patchUpdates(_0x3001a8){return function(_0x10841d){try{jsonpatch['apply'](_0x10841d,_0x3001a8,!![]);}catch(_0x10c447){return BPromise[_0x79af('0x20')](_0x10c447);}return _0x10841d[_0x79af('0x21')]();};}function saveUpdates(_0x42d144,_0x2385d5){return function(_0x326c0c){if(_0x326c0c){return _0x326c0c[_0x79af('0x22')](_0x42d144)[_0x79af('0x23')](function(_0x2ab9de){return _0x2ab9de;});}return null;};}function removeEntity(_0x2a068d,_0x82ed9){return function(_0x1d1189){if(_0x1d1189){return _0x1d1189['destroy']()[_0x79af('0x23')](function(){var _0x502557=_0x1d1189[_0x79af('0x24')]({'plain':!![]});var _0x599f04='Templates';return db[_0x79af('0x25')][_0x79af('0x26')]({'where':{'type':_0x599f04,'resourceId':_0x502557['id']}})[_0x79af('0x23')](function(){return _0x1d1189;});})[_0x79af('0x23')](function(){_0x2a068d[_0x79af('0x18')](0xcc)[_0x79af('0x19')]();});}};}function handleEntityNotFound(_0x5af469,_0x439622){return function(_0x4d5384){if(!_0x4d5384){_0x5af469[_0x79af('0x17')](0x194);}return _0x4d5384;};}function handleError(_0x378eb9,_0x380c73){_0x380c73=_0x380c73||0x1f4;return function(_0x567f88){logger[_0x79af('0x27')](_0x567f88[_0x79af('0x28')]);if(_0x567f88['name']){delete _0x567f88[_0x79af('0x29')];}_0x378eb9[_0x79af('0x18')](_0x380c73)[_0x79af('0x2a')](_0x567f88);};}exports[_0x79af('0x2b')]=function(_0x465d01,_0x580edb){var _0x1097c1={},_0x571757={},_0x299396={'count':0x0,'rows':[]};var _0x144fe0=_['map'](db[_0x79af('0x2c')]['rawAttributes'],function(_0x309b3e){return{'name':_0x309b3e['fieldName'],'type':_0x309b3e[_0x79af('0x2d')]['key']};});_0x571757['model']=_[_0x79af('0x2e')](_0x144fe0,_0x79af('0x29'));_0x571757[_0x79af('0x2f')]=_['keys'](_0x465d01[_0x79af('0x2f')]);_0x571757[_0x79af('0x30')]=_[_0x79af('0x31')](_0x571757[_0x79af('0x32')],_0x571757['query']);_0x1097c1[_0x79af('0x33')]=_[_0x79af('0x31')](_0x571757[_0x79af('0x32')],qs[_0x79af('0x34')](_0x465d01['query'][_0x79af('0x34')]));_0x1097c1['attributes']=_0x1097c1[_0x79af('0x33')]['length']?_0x1097c1[_0x79af('0x33')]:_0x571757[_0x79af('0x32')];if(!_0x465d01['query'][_0x79af('0x35')](_0x79af('0x36'))){_0x1097c1[_0x79af('0x1c')]=qs[_0x79af('0x1c')](_0x465d01[_0x79af('0x2f')][_0x79af('0x1c')]);_0x1097c1[_0x79af('0x1e')]=qs['offset'](_0x465d01[_0x79af('0x2f')]['offset']);}_0x1097c1[_0x79af('0x37')]=qs[_0x79af('0x38')](_0x465d01[_0x79af('0x2f')]['sort']);_0x1097c1[_0x79af('0x39')]=qs[_0x79af('0x30')](_[_0x79af('0x3a')](_0x465d01[_0x79af('0x2f')],_0x571757[_0x79af('0x30')]),_0x144fe0);if(_0x465d01[_0x79af('0x2f')][_0x79af('0x3b')]){_0x1097c1[_0x79af('0x39')]=_[_0x79af('0x3c')](_0x1097c1[_0x79af('0x39')],{'$or':_[_0x79af('0x2e')](_0x144fe0,function(_0x5bcf86){if(_0x5bcf86[_0x79af('0x2d')]!=='VIRTUAL'){var _0x55c1c8={};_0x55c1c8[_0x5bcf86[_0x79af('0x29')]]={'$like':'%'+_0x465d01[_0x79af('0x2f')][_0x79af('0x3b')]+'%'};return _0x55c1c8;}})});}_0x1097c1=_[_0x79af('0x3c')]({},_0x1097c1,_0x465d01[_0x79af('0x3d')]);var _0x43d992={'where':_0x1097c1[_0x79af('0x39')]};return db[_0x79af('0x2c')][_0x79af('0x1d')](_0x43d992)[_0x79af('0x23')](function(_0xa03d99){_0x299396[_0x79af('0x1d')]=_0xa03d99;if(_0x465d01[_0x79af('0x2f')][_0x79af('0x3e')]){_0x1097c1['include']=[{'all':!![]}];}return db[_0x79af('0x2c')]['findAll'](_0x1097c1);})[_0x79af('0x23')](function(_0x13b591){_0x299396[_0x79af('0x3f')]=_0x13b591;return _0x299396;})[_0x79af('0x23')](respondWithFilteredResult(_0x580edb,_0x1097c1))[_0x79af('0x40')](handleError(_0x580edb,null));};exports['show']=function(_0xfcd313,_0x33da04){var _0x2ff3e9={'raw':!![],'where':{'id':_0xfcd313[_0x79af('0x41')]['id']}},_0x6c18a5={};_0x6c18a5[_0x79af('0x32')]=_[_0x79af('0x42')](db[_0x79af('0x2c')][_0x79af('0x43')]);_0x6c18a5[_0x79af('0x2f')]=_[_0x79af('0x42')](_0xfcd313[_0x79af('0x2f')]);_0x6c18a5[_0x79af('0x30')]=_[_0x79af('0x31')](_0x6c18a5[_0x79af('0x32')],_0x6c18a5['query']);_0x2ff3e9[_0x79af('0x33')]=_['intersection'](_0x6c18a5[_0x79af('0x32')],qs['fields'](_0xfcd313['query'][_0x79af('0x34')]));_0x2ff3e9[_0x79af('0x33')]=_0x2ff3e9[_0x79af('0x33')][_0x79af('0x44')]?_0x2ff3e9['attributes']:_0x6c18a5[_0x79af('0x32')];if(_0xfcd313[_0x79af('0x2f')]['includeAll']){_0x2ff3e9[_0x79af('0x45')]=[{'all':!![]}];}_0x2ff3e9=_[_0x79af('0x3c')]({},_0x2ff3e9,_0xfcd313[_0x79af('0x3d')]);return db[_0x79af('0x2c')][_0x79af('0x46')](_0x2ff3e9)[_0x79af('0x23')](handleEntityNotFound(_0x33da04,null))['then'](respondWithResult(_0x33da04,null))[_0x79af('0x40')](handleError(_0x33da04,null));};exports[_0x79af('0x47')]=function(_0x52b0ad,_0x5bced7){return db[_0x79af('0x2c')][_0x79af('0x47')](_0x52b0ad[_0x79af('0x48')],{})[_0x79af('0x23')](function(_0x3b14e8){var _0x271aaf=_0x52b0ad[_0x79af('0x49')]['get']({'plain':!![]});if(!_0x271aaf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x271aaf['role']===_0x79af('0x49')){var _0x4c07e4=_0x3b14e8[_0x79af('0x24')]({'plain':!![]});var _0x134016=_0x79af('0x4a');return db[_0x79af('0x4b')][_0x79af('0x46')]({'where':{'name':_0x134016,'userProfileId':_0x271aaf['userProfileId']},'raw':!![]})[_0x79af('0x23')](function(_0x5c66dd){if(_0x5c66dd&&_0x5c66dd[_0x79af('0x4c')]===0x0){return db[_0x79af('0x25')]['create']({'name':_0x4c07e4[_0x79af('0x29')],'resourceId':_0x4c07e4['id'],'type':_0x5c66dd[_0x79af('0x29')],'sectionId':_0x5c66dd['id']},{})[_0x79af('0x23')](function(){return _0x3b14e8;});}else{return _0x3b14e8;}})['catch'](function(_0x19316e){logger[_0x79af('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19316e);throw _0x19316e;});}return _0x3b14e8;})['then'](respondWithResult(_0x5bced7,0xc9))[_0x79af('0x40')](handleError(_0x5bced7,null));};exports['update']=function(_0x297e70,_0x5a19c1){if(_0x297e70[_0x79af('0x48')]['id']){delete _0x297e70[_0x79af('0x48')]['id'];}return db['Template']['find']({'where':{'id':_0x297e70[_0x79af('0x41')]['id']}})[_0x79af('0x23')](handleEntityNotFound(_0x5a19c1,null))[_0x79af('0x23')](saveUpdates(_0x297e70['body'],null))[_0x79af('0x23')](respondWithResult(_0x5a19c1,null))[_0x79af('0x40')](handleError(_0x5a19c1,null));};exports[_0x79af('0x26')]=function(_0x1ee5d3,_0x16a875){return db[_0x79af('0x2c')][_0x79af('0x46')]({'where':{'id':_0x1ee5d3[_0x79af('0x41')]['id']}})['then'](handleEntityNotFound(_0x16a875,null))[_0x79af('0x23')](removeEntity(_0x16a875,null))[_0x79af('0x40')](handleError(_0x16a875,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 2aae84b..2634e80 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 _0x2f47=['../../config/environment','./template.attributes','define','tools_templates','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x2477a9,_0x31bccb){var _0x19ae4d=function(_0x187765){while(--_0x187765){_0x2477a9['push'](_0x2477a9['shift']());}};_0x19ae4d(++_0x31bccb);}(_0x2f47,0x17a));var _0x72f4=function(_0x3fae89,_0x1ac1f9){_0x3fae89=_0x3fae89-0x0;var _0x543768=_0x2f47[_0x3fae89];return _0x543768;};'use strict';var _=require(_0x72f4('0x0'));var util=require('util');var logger=require(_0x72f4('0x1'))(_0x72f4('0x2'));var moment=require(_0x72f4('0x3'));var BPromise=require('bluebird');var rp=require(_0x72f4('0x4'));var fs=require('fs');var path=require(_0x72f4('0x5'));var rimraf=require(_0x72f4('0x6'));var config=require(_0x72f4('0x7'));var attributes=require(_0x72f4('0x8'));module['exports']=function(_0x2cecca,_0x5278ff){return _0x2cecca[_0x72f4('0x9')]('Template',attributes,{'tableName':_0x72f4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf902=['moment','bluebird','request-promise','path','rimraf','./template.attributes','exports','define','Template','tools_templates','lodash','util','api'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0xf902,0x11b));var _0x2f90=function(_0x335ded,_0x4e72c5){_0x335ded=_0x335ded-0x0;var _0x5bd5da=_0xf902[_0x335ded];return _0x5bd5da;};'use strict';var _=require(_0x2f90('0x0'));var util=require(_0x2f90('0x1'));var logger=require('../../config/logger')(_0x2f90('0x2'));var moment=require(_0x2f90('0x3'));var BPromise=require(_0x2f90('0x4'));var rp=require(_0x2f90('0x5'));var fs=require('fs');var path=require(_0x2f90('0x6'));var rimraf=require(_0x2f90('0x7'));var config=require('../../config/environment');var attributes=require(_0x2f90('0x8'));module[_0x2f90('0x9')]=function(_0x2c5781,_0x4231dc){return _0x2c5781[_0x2f90('0xa')](_0x2f90('0xb'),attributes,{'tableName':_0x2f90('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index adbc26c..c06dab7 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 _0xbd2c=['findAll','options','raw','where','attributes','model','map','include','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','info','result','catch','GetTemplate'];(function(_0x237fe3,_0x1ae13f){var _0x41b055=function(_0x4f4443){while(--_0x4f4443){_0x237fe3['push'](_0x237fe3['shift']());}};_0x41b055(++_0x1ae13f);}(_0xbd2c,0x173));var _0xcbd2=function(_0x550a79,_0x543e8c){_0x550a79=_0x550a79-0x0;var _0x53679=_0xbd2c[_0x550a79];return _0x53679;};'use strict';var _=require(_0xcbd2('0x0'));var util=require(_0xcbd2('0x1'));var moment=require(_0xcbd2('0x2'));var BPromise=require('bluebird');var rs=require(_0xcbd2('0x3'));var fs=require('fs');var Redis=require(_0xcbd2('0x4'));var db=require(_0xcbd2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbd2('0x6'))(_0xcbd2('0x7'));var config=require(_0xcbd2('0x8'));var jayson=require(_0xcbd2('0x9'));var client=jayson[_0xcbd2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f4d62,_0x57e5bc,_0xfd8d3a){return new BPromise(function(_0x50f216,_0x1284b8){return client[_0xcbd2('0xb')](_0x4f4d62,_0xfd8d3a)[_0xcbd2('0xc')](function(_0x5c6d5e){logger['info']('Template,\x20%s,\x20%s',_0x57e5bc,_0xcbd2('0xd'));logger[_0xcbd2('0xe')](_0xcbd2('0xf'),_0x57e5bc,_0xcbd2('0xd'),JSON[_0xcbd2('0x10')](_0x5c6d5e));if(_0x5c6d5e[_0xcbd2('0x11')]){if(_0x5c6d5e[_0xcbd2('0x11')][_0xcbd2('0x12')]===0x1f4){logger[_0xcbd2('0x11')](_0xcbd2('0x13'),_0x57e5bc,_0x5c6d5e[_0xcbd2('0x11')][_0xcbd2('0x14')]);return _0x1284b8(_0x5c6d5e['error'][_0xcbd2('0x14')]);}logger[_0xcbd2('0x11')]('Template,\x20%s,\x20%s',_0x57e5bc,_0x5c6d5e['error'][_0xcbd2('0x14')]);return _0x50f216(_0x5c6d5e['error'][_0xcbd2('0x14')]);}else{logger[_0xcbd2('0x15')](_0xcbd2('0x13'),_0x57e5bc,_0xcbd2('0xd'));_0x50f216(_0x5c6d5e[_0xcbd2('0x16')][_0xcbd2('0x14')]);}})[_0xcbd2('0x17')](function(_0x47ea4e){logger[_0xcbd2('0x11')](_0xcbd2('0x13'),_0x57e5bc,_0x47ea4e);_0x1284b8(_0x47ea4e);});});}exports[_0xcbd2('0x18')]=function(_0x422ee8){var _0x2cb577=this;return new Promise(function(_0x4adde9,_0x5de3dd){return db['Template'][_0xcbd2('0x19')]({'raw':_0x422ee8[_0xcbd2('0x1a')]?_0x422ee8[_0xcbd2('0x1a')][_0xcbd2('0x1b')]===undefined?!![]:![]:!![],'where':_0x422ee8[_0xcbd2('0x1a')]?_0x422ee8[_0xcbd2('0x1a')][_0xcbd2('0x1c')]||null:null,'attributes':_0x422ee8[_0xcbd2('0x1a')]?_0x422ee8[_0xcbd2('0x1a')][_0xcbd2('0x1d')]||null:null,'limit':_0x422ee8[_0xcbd2('0x1a')]?_0x422ee8[_0xcbd2('0x1a')]['limit']||null:null,'include':_0x422ee8['options']?_0x422ee8[_0xcbd2('0x1a')]['include']?_['map'](_0x422ee8[_0xcbd2('0x1a')]['include'],function(_0x2e8a5d){return{'model':db[_0x2e8a5d[_0xcbd2('0x1e')]],'as':_0x2e8a5d['as'],'attributes':_0x2e8a5d['attributes'],'include':_0x2e8a5d['include']?_[_0xcbd2('0x1f')](_0x2e8a5d[_0xcbd2('0x20')],function(_0x3dabb6){return{'model':db[_0x3dabb6[_0xcbd2('0x1e')]],'as':_0x3dabb6['as'],'attributes':_0x3dabb6['attributes'],'include':_0x3dabb6['include']?_[_0xcbd2('0x1f')](_0x3dabb6[_0xcbd2('0x20')],function(_0x3a7fb7){return{'model':db[_0x3a7fb7[_0xcbd2('0x1e')]],'as':_0x3a7fb7['as'],'attributes':_0x3a7fb7['attributes']};}):[]};}):[]};}):[]:[]})[_0xcbd2('0xc')](function(_0x270bf5){logger[_0xcbd2('0x15')]('GetTemplate',_0x422ee8);logger[_0xcbd2('0xe')](_0xcbd2('0x18'),_0x422ee8,JSON[_0xcbd2('0x10')](_0x270bf5));_0x4adde9(_0x270bf5);})['catch'](function(_0x127cb2){logger['error'](_0xcbd2('0x18'),_0x127cb2[_0xcbd2('0x14')],_0x422ee8);_0x5de3dd(_0x2cb577[_0xcbd2('0x11')](0x1f4,_0x127cb2[_0xcbd2('0x14')]));});});}; \ No newline at end of file +var _0x8fa1=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Template','findAll','options','raw','where','limit','include','model','map','attributes','GetTemplate'];(function(_0x3de685,_0x53eff4){var _0x58c876=function(_0x5cb39a){while(--_0x5cb39a){_0x3de685['push'](_0x3de685['shift']());}};_0x58c876(++_0x53eff4);}(_0x8fa1,0x15e));var _0x18fa=function(_0x578906,_0x33e0ce){_0x578906=_0x578906-0x0;var _0x1c9da4=_0x8fa1[_0x578906];return _0x1c9da4;};'use strict';var _=require(_0x18fa('0x0'));var util=require('util');var moment=require(_0x18fa('0x1'));var BPromise=require(_0x18fa('0x2'));var rs=require(_0x18fa('0x3'));var fs=require('fs');var Redis=require(_0x18fa('0x4'));var db=require(_0x18fa('0x5'))['db'];var utils=require(_0x18fa('0x6'));var logger=require(_0x18fa('0x7'))(_0x18fa('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x18fa('0x9')][_0x18fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x229dc8,_0x47b80e,_0x3fcfe9){return new BPromise(function(_0x50d58e,_0x671868){return client[_0x18fa('0xb')](_0x229dc8,_0x3fcfe9)[_0x18fa('0xc')](function(_0x5a5f20){logger['info'](_0x18fa('0xd'),_0x47b80e,_0x18fa('0xe'));logger[_0x18fa('0xf')](_0x18fa('0x10'),_0x47b80e,_0x18fa('0xe'),JSON[_0x18fa('0x11')](_0x5a5f20));if(_0x5a5f20[_0x18fa('0x12')]){if(_0x5a5f20[_0x18fa('0x12')][_0x18fa('0x13')]===0x1f4){logger[_0x18fa('0x12')](_0x18fa('0xd'),_0x47b80e,_0x5a5f20[_0x18fa('0x12')][_0x18fa('0x14')]);return _0x671868(_0x5a5f20[_0x18fa('0x12')][_0x18fa('0x14')]);}logger['error'](_0x18fa('0xd'),_0x47b80e,_0x5a5f20['error'][_0x18fa('0x14')]);return _0x50d58e(_0x5a5f20[_0x18fa('0x12')][_0x18fa('0x14')]);}else{logger[_0x18fa('0x15')](_0x18fa('0xd'),_0x47b80e,_0x18fa('0xe'));_0x50d58e(_0x5a5f20[_0x18fa('0x16')][_0x18fa('0x14')]);}})[_0x18fa('0x17')](function(_0x5d9a8e){logger[_0x18fa('0x12')]('Template,\x20%s,\x20%s',_0x47b80e,_0x5d9a8e);_0x671868(_0x5d9a8e);});});}exports['GetTemplate']=function(_0x1401f9){var _0x33364a=this;return new Promise(function(_0x2cf316,_0x42b30f){return db[_0x18fa('0x18')][_0x18fa('0x19')]({'raw':_0x1401f9['options']?_0x1401f9[_0x18fa('0x1a')][_0x18fa('0x1b')]===undefined?!![]:![]:!![],'where':_0x1401f9[_0x18fa('0x1a')]?_0x1401f9['options'][_0x18fa('0x1c')]||null:null,'attributes':_0x1401f9['options']?_0x1401f9['options']['attributes']||null:null,'limit':_0x1401f9[_0x18fa('0x1a')]?_0x1401f9['options'][_0x18fa('0x1d')]||null:null,'include':_0x1401f9['options']?_0x1401f9[_0x18fa('0x1a')]['include']?_['map'](_0x1401f9['options'][_0x18fa('0x1e')],function(_0x3c6522){return{'model':db[_0x3c6522[_0x18fa('0x1f')]],'as':_0x3c6522['as'],'attributes':_0x3c6522['attributes'],'include':_0x3c6522['include']?_[_0x18fa('0x20')](_0x3c6522[_0x18fa('0x1e')],function(_0x257087){return{'model':db[_0x257087[_0x18fa('0x1f')]],'as':_0x257087['as'],'attributes':_0x257087[_0x18fa('0x21')],'include':_0x257087['include']?_[_0x18fa('0x20')](_0x257087[_0x18fa('0x1e')],function(_0x2e4411){return{'model':db[_0x2e4411['model']],'as':_0x2e4411['as'],'attributes':_0x2e4411[_0x18fa('0x21')]};}):[]};}):[]};}):[]:[]})[_0x18fa('0xc')](function(_0xb47e8c){logger[_0x18fa('0x15')]('GetTemplate',_0x1401f9);logger[_0x18fa('0xf')](_0x18fa('0x22'),_0x1401f9,JSON[_0x18fa('0x11')](_0xb47e8c));_0x2cf316(_0xb47e8c);})[_0x18fa('0x17')](function(_0x4917e6){logger['error'](_0x18fa('0x22'),_0x4917e6[_0x18fa('0x14')],_0x1401f9);_0x42b30f(_0x33364a[_0x18fa('0x12')](0x1f4,_0x4917e6[_0x18fa('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index fdd4c85..d72d9bf 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 _0xe2fa=['fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition','put','update','path','express','Router'];(function(_0x4de297,_0x26bd32){var _0x4a03f2=function(_0x1085f6){while(--_0x1085f6){_0x4de297['push'](_0x4de297['shift']());}};_0x4a03f2(++_0x26bd32);}(_0xe2fa,0x1e0));var _0xae2f=function(_0x93277c,_0x20d716){_0x93277c=_0x93277c-0x0;var _0x15ee62=_0xe2fa[_0x93277c];return _0x15ee62;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xae2f('0x0'));var timeout=require('connect-timeout');var express=require(_0xae2f('0x1'));var router=express[_0xae2f('0x2')]();var fs_extra=require(_0xae2f('0x3'));var auth=require(_0xae2f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xae2f('0x5'));var controller=require(_0xae2f('0x6'));router[_0xae2f('0x7')]('/',auth[_0xae2f('0x8')](),controller['index']);router[_0xae2f('0x7')](_0xae2f('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xae2f('0x7')](_0xae2f('0xa'),auth[_0xae2f('0x8')](),controller[_0xae2f('0xb')]);router[_0xae2f('0x7')](_0xae2f('0xc'),auth[_0xae2f('0x8')](),controller[_0xae2f('0xd')]);router['get'](_0xae2f('0xe'),auth[_0xae2f('0x8')](),controller[_0xae2f('0xf')]);router[_0xae2f('0x10')]('/',auth[_0xae2f('0x8')](),controller['create']);router[_0xae2f('0x10')](_0xae2f('0xa'),auth['isAuthenticated'](),controller[_0xae2f('0x11')]);router[_0xae2f('0x10')]('/:id/any_conditions',auth[_0xae2f('0x8')](),controller[_0xae2f('0x12')]);router['post'](_0xae2f('0xe'),auth[_0xae2f('0x8')](),controller['addAction']);router[_0xae2f('0x13')]('/:id',auth[_0xae2f('0x8')](),controller[_0xae2f('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3d70=['delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./trigger.controller','isAuthenticated','index','get','/:id','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','update'];(function(_0x40017b,_0x18949){var _0x5a6231=function(_0x27977f){while(--_0x27977f){_0x40017b['push'](_0x40017b['shift']());}};_0x5a6231(++_0x18949);}(_0x3d70,0xf6));var _0x03d7=function(_0x36909d,_0x2795f1){_0x36909d=_0x36909d-0x0;var _0x1fd29d=_0x3d70[_0x36909d];return _0x1fd29d;};'use strict';var multer=require('multer');var util=require(_0x03d7('0x0'));var path=require(_0x03d7('0x1'));var timeout=require(_0x03d7('0x2'));var express=require('express');var router=express[_0x03d7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x03d7('0x4'));var interaction=require(_0x03d7('0x5'));var config=require('../../config/environment');var controller=require(_0x03d7('0x6'));router['get']('/',auth[_0x03d7('0x7')](),controller[_0x03d7('0x8')]);router[_0x03d7('0x9')](_0x03d7('0xa'),auth['isAuthenticated'](),controller[_0x03d7('0xb')]);router[_0x03d7('0x9')](_0x03d7('0xc'),auth['isAuthenticated'](),controller[_0x03d7('0xd')]);router[_0x03d7('0x9')]('/:id/any_conditions',auth[_0x03d7('0x7')](),controller[_0x03d7('0xe')]);router[_0x03d7('0x9')](_0x03d7('0xf'),auth[_0x03d7('0x7')](),controller[_0x03d7('0x10')]);router[_0x03d7('0x11')]('/',auth[_0x03d7('0x7')](),controller[_0x03d7('0x12')]);router['post']('/:id/all_conditions',auth[_0x03d7('0x7')](),controller[_0x03d7('0x13')]);router[_0x03d7('0x11')](_0x03d7('0x14'),auth[_0x03d7('0x7')](),controller[_0x03d7('0x15')]);router[_0x03d7('0x11')](_0x03d7('0xf'),auth[_0x03d7('0x7')](),controller[_0x03d7('0x16')]);router['put']('/:id',auth[_0x03d7('0x7')](),controller[_0x03d7('0x17')]);router[_0x03d7('0x18')](_0x03d7('0xa'),auth[_0x03d7('0x7')](),controller[_0x03d7('0x19')]);module[_0x03d7('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 b6bb832..04fd9b8 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 _0x90fd=['BOOLEAN','sequelize','STRING'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x90fd,0x115));var _0xd90f=function(_0x4050d6,_0x446038){_0x4050d6=_0x4050d6-0x0;var _0x5cdeca=_0x90fd[_0x4050d6];return _0x5cdeca;};'use strict';var Sequelize=require(_0xd90f('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd90f('0x1')]},'description':{'type':Sequelize[_0xd90f('0x1')]},'status':{'type':Sequelize[_0xd90f('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xfb85=['sequelize','STRING','BOOLEAN'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xfb85,0x1ce));var _0x5fb8=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xfb85[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require(_0x5fb8('0x0'));module['exports']={'name':{'type':Sequelize[_0x5fb8('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5fb8('0x1')]},'status':{'type':Sequelize[_0x5fb8('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 224b85b..17993d1 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 _0xc4bb=['pick','getAnyConditions','Action','getActions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','offset','limit','count','set','save','update','then','get','Triggers','UserProfileResource','end','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','key','query','keys','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','intersection','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne'];(function(_0x35e6cb,_0x5dd511){var _0xb75549=function(_0x17006a){while(--_0x17006a){_0x35e6cb['push'](_0x35e6cb['shift']());}};_0xb75549(++_0x5dd511);}(_0xc4bb,0x16c));var _0xbc4b=function(_0xca1585,_0x219dfb){_0xca1585=_0xca1585-0x0;var _0x117736=_0xc4bb[_0xca1585];return _0x117736;};'use strict';var emlformat=require(_0xbc4b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbc4b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc4b('0x2'));var moment=require(_0xbc4b('0x3'));var BPromise=require(_0xbc4b('0x4'));var Mustache=require(_0xbc4b('0x5'));var util=require(_0xbc4b('0x6'));var path=require(_0xbc4b('0x7'));var sox=require(_0xbc4b('0x8'));var csv=require(_0xbc4b('0x9'));var ejs=require(_0xbc4b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbc4b('0xb'));var jsforce=require(_0xbc4b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbc4b('0x9'));var querystring=require(_0xbc4b('0xd'));var Papa=require(_0xbc4b('0xe'));var Redis=require(_0xbc4b('0xf'));var authService=require(_0xbc4b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbc4b('0x11'));var hardwareService=require(_0xbc4b('0x12'));var logger=require(_0xbc4b('0x13'))(_0xbc4b('0x14'));var utils=require(_0xbc4b('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e7e3d,_0x529759){_0x529759=_0x529759||0xcc;return function(_0x16b0ba){if(_0x16b0ba){return _0x2e7e3d[_0xbc4b('0x16')](_0x529759);}return _0x2e7e3d[_0xbc4b('0x17')](_0x529759)['end']();};}function respondWithResult(_0x33d11e,_0x421998){_0x421998=_0x421998||0xc8;return function(_0x58500a){if(_0x58500a){return _0x33d11e[_0xbc4b('0x17')](_0x421998)['json'](_0x58500a);}};}function respondWithFilteredResult(_0x34d7b3,_0x26152b){return function(_0x86ef5f){if(_0x86ef5f){var _0x483cb1=typeof _0x26152b[_0xbc4b('0x18')]==='undefined'&&typeof _0x26152b[_0xbc4b('0x19')]==='undefined';var _0x6c83f6=_0x86ef5f['count'];var _0x5c8bd8=_0x483cb1?0x0:_0x26152b[_0xbc4b('0x18')];var _0x2d1627=_0x483cb1?_0x86ef5f[_0xbc4b('0x1a')]:_0x26152b[_0xbc4b('0x18')]+_0x26152b[_0xbc4b('0x19')];var _0x34d605;if(_0x2d1627>=_0x6c83f6){_0x2d1627=_0x6c83f6;_0x34d605=0xc8;}else{_0x34d605=0xce;}_0x34d7b3[_0xbc4b('0x17')](_0x34d605);return _0x34d7b3[_0xbc4b('0x1b')]('Content-Range',_0x5c8bd8+'-'+_0x2d1627+'/'+_0x6c83f6)['json'](_0x86ef5f);}return null;};}function patchUpdates(_0xc31829){return function(_0x28454a){try{jsonpatch['apply'](_0x28454a,_0xc31829,!![]);}catch(_0x323e1d){return BPromise['reject'](_0x323e1d);}return _0x28454a[_0xbc4b('0x1c')]();};}function saveUpdates(_0x2a9a13,_0xf5534f){return function(_0x4031e5){if(_0x4031e5){return _0x4031e5[_0xbc4b('0x1d')](_0x2a9a13)[_0xbc4b('0x1e')](function(_0x2eacda){return _0x2eacda;});}return null;};}function removeEntity(_0x1e58fc,_0xb212f6){return function(_0xf3adc){if(_0xf3adc){return _0xf3adc['destroy']()[_0xbc4b('0x1e')](function(){var _0x5e5e96=_0xf3adc[_0xbc4b('0x1f')]({'plain':!![]});var _0x58d508=_0xbc4b('0x20');return db[_0xbc4b('0x21')]['destroy']({'where':{'type':_0x58d508,'resourceId':_0x5e5e96['id']}})['then'](function(){return _0xf3adc;});})['then'](function(){_0x1e58fc[_0xbc4b('0x17')](0xcc)[_0xbc4b('0x22')]();});}};}function handleEntityNotFound(_0x574e9d,_0x2e1e46){return function(_0x590bf7){if(!_0x590bf7){_0x574e9d[_0xbc4b('0x16')](0x194);}return _0x590bf7;};}function handleError(_0x54906d,_0x281652){_0x281652=_0x281652||0x1f4;return function(_0x4c5299){logger[_0xbc4b('0x23')](_0x4c5299[_0xbc4b('0x24')]);if(_0x4c5299['name']){delete _0x4c5299[_0xbc4b('0x25')];}_0x54906d[_0xbc4b('0x17')](_0x281652)[_0xbc4b('0x26')](_0x4c5299);};}exports[_0xbc4b('0x27')]=function(_0x34ddd7,_0x428c94){var _0x1c7b1c={},_0x1a2ad1={},_0x1d09a7={'count':0x0,'rows':[]};var _0x499da8=_[_0xbc4b('0x28')](db[_0xbc4b('0x29')][_0xbc4b('0x2a')],function(_0x158226){return{'name':_0x158226[_0xbc4b('0x2b')],'type':_0x158226['type'][_0xbc4b('0x2c')]};});_0x1a2ad1['model']=_['map'](_0x499da8,'name');_0x1a2ad1[_0xbc4b('0x2d')]=_[_0xbc4b('0x2e')](_0x34ddd7[_0xbc4b('0x2d')]);_0x1a2ad1[_0xbc4b('0x2f')]=_['intersection'](_0x1a2ad1['model'],_0x1a2ad1[_0xbc4b('0x2d')]);_0x1c7b1c[_0xbc4b('0x30')]=_['intersection'](_0x1a2ad1[_0xbc4b('0x31')],qs[_0xbc4b('0x32')](_0x34ddd7[_0xbc4b('0x2d')][_0xbc4b('0x32')]));_0x1c7b1c[_0xbc4b('0x30')]=_0x1c7b1c[_0xbc4b('0x30')][_0xbc4b('0x33')]?_0x1c7b1c[_0xbc4b('0x30')]:_0x1a2ad1[_0xbc4b('0x31')];if(!_0x34ddd7['query'][_0xbc4b('0x34')](_0xbc4b('0x35'))){_0x1c7b1c[_0xbc4b('0x19')]=qs['limit'](_0x34ddd7['query'][_0xbc4b('0x19')]);_0x1c7b1c[_0xbc4b('0x18')]=qs[_0xbc4b('0x18')](_0x34ddd7[_0xbc4b('0x2d')][_0xbc4b('0x18')]);}_0x1c7b1c[_0xbc4b('0x36')]=qs[_0xbc4b('0x37')](_0x34ddd7[_0xbc4b('0x2d')][_0xbc4b('0x37')]);_0x1c7b1c[_0xbc4b('0x38')]=qs[_0xbc4b('0x2f')](_['pick'](_0x34ddd7[_0xbc4b('0x2d')],_0x1a2ad1[_0xbc4b('0x2f')]),_0x499da8);if(_0x34ddd7[_0xbc4b('0x2d')][_0xbc4b('0x39')]){_0x1c7b1c[_0xbc4b('0x38')]=_[_0xbc4b('0x3a')](_0x1c7b1c[_0xbc4b('0x38')],{'$or':_[_0xbc4b('0x28')](_0x499da8,function(_0x3dd5b4){if(_0x3dd5b4[_0xbc4b('0x3b')]!==_0xbc4b('0x3c')){var _0x135896={};_0x135896[_0x3dd5b4[_0xbc4b('0x25')]]={'$like':'%'+_0x34ddd7[_0xbc4b('0x2d')][_0xbc4b('0x39')]+'%'};return _0x135896;}})});}_0x1c7b1c=_[_0xbc4b('0x3a')]({},_0x1c7b1c,_0x34ddd7[_0xbc4b('0x3d')]);var _0x53fdf5={'where':_0x1c7b1c[_0xbc4b('0x38')]};return db[_0xbc4b('0x29')]['count'](_0x53fdf5)[_0xbc4b('0x1e')](function(_0x1922c8){_0x1d09a7['count']=_0x1922c8;if(_0x34ddd7[_0xbc4b('0x2d')][_0xbc4b('0x3e')]){_0x1c7b1c[_0xbc4b('0x3f')]=[{'all':!![]}];}return db['Trigger'][_0xbc4b('0x40')](_0x1c7b1c);})[_0xbc4b('0x1e')](function(_0x5a66f7){_0x1d09a7[_0xbc4b('0x41')]=_0x5a66f7;return _0x1d09a7;})[_0xbc4b('0x1e')](respondWithFilteredResult(_0x428c94,_0x1c7b1c))[_0xbc4b('0x42')](handleError(_0x428c94,null));};exports['show']=function(_0x4033b4,_0x58d3b0){var _0x56efd1={'raw':![],'where':{'id':_0x4033b4['params']['id']}},_0x187b20={};_0x187b20['model']=_[_0xbc4b('0x2e')](db[_0xbc4b('0x29')][_0xbc4b('0x2a')]);_0x187b20[_0xbc4b('0x2d')]=_[_0xbc4b('0x2e')](_0x4033b4['query']);_0x187b20[_0xbc4b('0x2f')]=_['intersection'](_0x187b20['model'],_0x187b20[_0xbc4b('0x2d')]);_0x56efd1[_0xbc4b('0x30')]=_[_0xbc4b('0x43')](_0x187b20[_0xbc4b('0x31')],qs['fields'](_0x4033b4[_0xbc4b('0x2d')][_0xbc4b('0x32')]));_0x56efd1[_0xbc4b('0x30')]=_0x56efd1['attributes'][_0xbc4b('0x33')]?_0x56efd1['attributes']:_0x187b20['model'];if(_0x4033b4[_0xbc4b('0x2d')]['includeAll']){_0x56efd1[_0xbc4b('0x3f')]=[{'all':!![]}];}_0x56efd1=_['merge']({},_0x56efd1,_0x4033b4[_0xbc4b('0x3d')]);return db[_0xbc4b('0x29')]['find'](_0x56efd1)[_0xbc4b('0x1e')](handleEntityNotFound(_0x58d3b0,null))[_0xbc4b('0x1e')](respondWithResult(_0x58d3b0,null))[_0xbc4b('0x42')](handleError(_0x58d3b0,null));};exports[_0xbc4b('0x44')]=function(_0x2e37a1,_0x3cc86a){return db['Trigger'][_0xbc4b('0x44')](_0x2e37a1[_0xbc4b('0x45')],{})[_0xbc4b('0x1e')](function(_0x27081d){var _0xa6ba44=_0x2e37a1['user'][_0xbc4b('0x1f')]({'plain':!![]});if(!_0xa6ba44)throw new Error(_0xbc4b('0x46'));if(_0xa6ba44[_0xbc4b('0x47')]==='user'){var _0x1603e0=_0x27081d[_0xbc4b('0x1f')]({'plain':!![]});var _0x3cf51e=_0xbc4b('0x20');return db[_0xbc4b('0x48')][_0xbc4b('0x49')]({'where':{'name':_0x3cf51e,'userProfileId':_0xa6ba44[_0xbc4b('0x4a')]},'raw':!![]})[_0xbc4b('0x1e')](function(_0x2c9804){if(_0x2c9804&&_0x2c9804[_0xbc4b('0x4b')]===0x0){return db[_0xbc4b('0x21')][_0xbc4b('0x44')]({'name':_0x1603e0[_0xbc4b('0x25')],'resourceId':_0x1603e0['id'],'type':_0x2c9804[_0xbc4b('0x25')],'sectionId':_0x2c9804['id']},{})['then'](function(){return _0x27081d;});}else{return _0x27081d;}})[_0xbc4b('0x42')](function(_0x35bda2){logger[_0xbc4b('0x23')](_0xbc4b('0x4c'),_0x35bda2);throw _0x35bda2;});}return _0x27081d;})[_0xbc4b('0x1e')](respondWithResult(_0x3cc86a,0xc9))['catch'](handleError(_0x3cc86a,null));};exports['update']=function(_0x4eef30,_0x1b87b3){if(_0x4eef30['body']['id']){delete _0x4eef30[_0xbc4b('0x45')]['id'];}return db[_0xbc4b('0x29')][_0xbc4b('0x49')]({'where':{'id':_0x4eef30[_0xbc4b('0x4d')]['id']}})[_0xbc4b('0x1e')](handleEntityNotFound(_0x1b87b3,null))[_0xbc4b('0x1e')](saveUpdates(_0x4eef30[_0xbc4b('0x45')],null))[_0xbc4b('0x1e')](respondWithResult(_0x1b87b3,null))['catch'](handleError(_0x1b87b3,null));};exports[_0xbc4b('0x4e')]=function(_0x30a3ef,_0xf77347){return db['Trigger']['find']({'where':{'id':_0x30a3ef['params']['id']}})[_0xbc4b('0x1e')](handleEntityNotFound(_0xf77347,null))[_0xbc4b('0x1e')](removeEntity(_0xf77347,null))['catch'](handleError(_0xf77347,null));};exports[_0xbc4b('0x4f')]=function(_0x161cd9,_0x22e252,_0x196fd7){if(_0x161cd9[_0xbc4b('0x45')]['id']){delete _0x161cd9[_0xbc4b('0x45')]['id'];}return db[_0xbc4b('0x29')][_0xbc4b('0x49')]({'where':{'id':_0x161cd9[_0xbc4b('0x4d')]['id']}})[_0xbc4b('0x1e')](handleEntityNotFound(_0x22e252,null))[_0xbc4b('0x1e')](function(_0x4468f6){if(_0x4468f6){_0x161cd9['body'][_0xbc4b('0x50')]=_0x4468f6['id'];return db[_0xbc4b('0x51')][_0xbc4b('0x44')](_0x161cd9[_0xbc4b('0x45')]);}})[_0xbc4b('0x1e')](respondWithResult(_0x22e252,null))[_0xbc4b('0x42')](handleError(_0x22e252,null));};exports[_0xbc4b('0x52')]=function(_0x2584a7,_0x1115d3,_0x2d5507){if(_0x2584a7['body']['id']){delete _0x2584a7[_0xbc4b('0x45')]['id'];}return db['Trigger'][_0xbc4b('0x49')]({'where':{'id':_0x2584a7[_0xbc4b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1115d3,null))[_0xbc4b('0x1e')](function(_0x8a9a82){if(_0x8a9a82){_0x2584a7[_0xbc4b('0x45')][_0xbc4b('0x53')]=_0x8a9a82['id'];return db[_0xbc4b('0x51')][_0xbc4b('0x44')](_0x2584a7[_0xbc4b('0x45')]);}})['then'](respondWithResult(_0x1115d3,null))[_0xbc4b('0x42')](handleError(_0x1115d3,null));};exports[_0xbc4b('0x54')]=function(_0x214604,_0x5d417a,_0x24ffd3){var _0x33dc0e={};var _0x3a78df={};var _0x4ce20c;var _0x4101ad;return db['Trigger'][_0xbc4b('0x55')]({'where':{'id':_0x214604['params']['id']}})[_0xbc4b('0x1e')](handleEntityNotFound(_0x5d417a,null))[_0xbc4b('0x1e')](function(_0x5697f4){if(_0x5697f4){_0x4ce20c=_0x5697f4;_0x3a78df[_0xbc4b('0x31')]=_[_0xbc4b('0x2e')](db[_0xbc4b('0x51')][_0xbc4b('0x2a')]);_0x3a78df[_0xbc4b('0x2d')]=_[_0xbc4b('0x2e')](_0x214604[_0xbc4b('0x2d')]);_0x3a78df[_0xbc4b('0x2f')]=_[_0xbc4b('0x43')](_0x3a78df[_0xbc4b('0x31')],_0x3a78df[_0xbc4b('0x2d')]);_0x33dc0e['attributes']=_[_0xbc4b('0x43')](_0x3a78df[_0xbc4b('0x31')],qs[_0xbc4b('0x32')](_0x214604[_0xbc4b('0x2d')]['fields']));_0x33dc0e[_0xbc4b('0x30')]=_0x33dc0e[_0xbc4b('0x30')][_0xbc4b('0x33')]?_0x33dc0e[_0xbc4b('0x30')]:_0x3a78df['model'];_0x33dc0e[_0xbc4b('0x36')]=qs[_0xbc4b('0x37')](_0x214604[_0xbc4b('0x2d')][_0xbc4b('0x37')]);_0x33dc0e[_0xbc4b('0x38')]=qs[_0xbc4b('0x2f')](_[_0xbc4b('0x56')](_0x214604[_0xbc4b('0x2d')],_0x3a78df[_0xbc4b('0x2f')]));if(_0x214604[_0xbc4b('0x2d')]['filter']){_0x33dc0e[_0xbc4b('0x38')]=_[_0xbc4b('0x3a')](_0x33dc0e[_0xbc4b('0x38')],{'$or':_['map'](_0x33dc0e['attributes'],function(_0xfd2041){var _0x3f9d8d={};_0x3f9d8d[_0xfd2041]={'$like':'%'+_0x214604[_0xbc4b('0x2d')]['filter']+'%'};return _0x3f9d8d;})});}_0x33dc0e=_[_0xbc4b('0x3a')]({},_0x33dc0e,_0x214604[_0xbc4b('0x3d')]);return _0x4ce20c[_0xbc4b('0x54')](_0x33dc0e);}})[_0xbc4b('0x1e')](function(_0x33f8f1){if(_0x33f8f1){_0x4101ad=_0x33f8f1[_0xbc4b('0x33')];if(!_0x214604[_0xbc4b('0x2d')]['hasOwnProperty'](_0xbc4b('0x35'))){_0x33dc0e[_0xbc4b('0x19')]=qs[_0xbc4b('0x19')](_0x214604['query']['limit']);_0x33dc0e['offset']=qs[_0xbc4b('0x18')](_0x214604[_0xbc4b('0x2d')][_0xbc4b('0x18')]);}return _0x4ce20c[_0xbc4b('0x54')](_0x33dc0e);}})[_0xbc4b('0x1e')](function(_0x1f5e01){if(_0x1f5e01){return _0x1f5e01?{'count':_0x4101ad,'rows':_0x1f5e01}:null;}})['then'](respondWithResult(_0x5d417a,null))['catch'](handleError(_0x5d417a,null));};exports['getAnyConditions']=function(_0x458eea,_0xebccf7,_0x19c1cf){var _0x244ee8={};var _0x20db40={};var _0x41327f;var _0x3d1ee4;return db['Trigger'][_0xbc4b('0x55')]({'where':{'id':_0x458eea[_0xbc4b('0x4d')]['id']}})['then'](handleEntityNotFound(_0xebccf7,null))['then'](function(_0x323c02){if(_0x323c02){_0x41327f=_0x323c02;_0x20db40['model']=_[_0xbc4b('0x2e')](db['Condition'][_0xbc4b('0x2a')]);_0x20db40['query']=_[_0xbc4b('0x2e')](_0x458eea[_0xbc4b('0x2d')]);_0x20db40['filters']=_[_0xbc4b('0x43')](_0x20db40[_0xbc4b('0x31')],_0x20db40['query']);_0x244ee8['attributes']=_[_0xbc4b('0x43')](_0x20db40[_0xbc4b('0x31')],qs[_0xbc4b('0x32')](_0x458eea[_0xbc4b('0x2d')][_0xbc4b('0x32')]));_0x244ee8['attributes']=_0x244ee8[_0xbc4b('0x30')]['length']?_0x244ee8[_0xbc4b('0x30')]:_0x20db40[_0xbc4b('0x31')];_0x244ee8['order']=qs[_0xbc4b('0x37')](_0x458eea['query'][_0xbc4b('0x37')]);_0x244ee8[_0xbc4b('0x38')]=qs[_0xbc4b('0x2f')](_[_0xbc4b('0x56')](_0x458eea['query'],_0x20db40[_0xbc4b('0x2f')]));if(_0x458eea['query'][_0xbc4b('0x39')]){_0x244ee8[_0xbc4b('0x38')]=_['merge'](_0x244ee8[_0xbc4b('0x38')],{'$or':_[_0xbc4b('0x28')](_0x244ee8['attributes'],function(_0x564d36){var _0x23bb53={};_0x23bb53[_0x564d36]={'$like':'%'+_0x458eea[_0xbc4b('0x2d')]['filter']+'%'};return _0x23bb53;})});}_0x244ee8=_[_0xbc4b('0x3a')]({},_0x244ee8,_0x458eea[_0xbc4b('0x3d')]);return _0x41327f['getAnyConditions'](_0x244ee8);}})[_0xbc4b('0x1e')](function(_0x4e7aa5){if(_0x4e7aa5){_0x3d1ee4=_0x4e7aa5[_0xbc4b('0x33')];if(!_0x458eea[_0xbc4b('0x2d')][_0xbc4b('0x34')]('nolimit')){_0x244ee8['limit']=qs[_0xbc4b('0x19')](_0x458eea[_0xbc4b('0x2d')]['limit']);_0x244ee8[_0xbc4b('0x18')]=qs[_0xbc4b('0x18')](_0x458eea[_0xbc4b('0x2d')]['offset']);}return _0x41327f[_0xbc4b('0x57')](_0x244ee8);}})[_0xbc4b('0x1e')](function(_0x206431){if(_0x206431){return _0x206431?{'count':_0x3d1ee4,'rows':_0x206431}:null;}})[_0xbc4b('0x1e')](respondWithResult(_0xebccf7,null))[_0xbc4b('0x42')](handleError(_0xebccf7,null));};exports['addAction']=function(_0x59fa07,_0x5ce399,_0x57ebd6){if(_0x59fa07[_0xbc4b('0x45')]['id']){delete _0x59fa07[_0xbc4b('0x45')]['id'];}return db[_0xbc4b('0x29')][_0xbc4b('0x49')]({'where':{'id':_0x59fa07[_0xbc4b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5ce399,null))[_0xbc4b('0x1e')](function(_0x468e01){if(_0x468e01){_0x59fa07[_0xbc4b('0x45')]['TriggerId']=_0x468e01['id'];return db[_0xbc4b('0x58')][_0xbc4b('0x44')](_0x59fa07[_0xbc4b('0x45')]);}})[_0xbc4b('0x1e')](respondWithResult(_0x5ce399,null))[_0xbc4b('0x42')](handleError(_0x5ce399,null));};exports[_0xbc4b('0x59')]=function(_0x512bf4,_0x4919e4,_0x45a44f){var _0x1131d1={};var _0x39e6f5={};var _0x45b0a3;var _0x231c15;return db[_0xbc4b('0x29')][_0xbc4b('0x55')]({'where':{'id':_0x512bf4[_0xbc4b('0x4d')]['id']}})[_0xbc4b('0x1e')](handleEntityNotFound(_0x4919e4,null))[_0xbc4b('0x1e')](function(_0x219469){if(_0x219469){_0x45b0a3=_0x219469;_0x39e6f5[_0xbc4b('0x31')]=_[_0xbc4b('0x2e')](db[_0xbc4b('0x58')][_0xbc4b('0x2a')]);_0x39e6f5[_0xbc4b('0x2d')]=_[_0xbc4b('0x2e')](_0x512bf4[_0xbc4b('0x2d')]);_0x39e6f5[_0xbc4b('0x2f')]=_['intersection'](_0x39e6f5['model'],_0x39e6f5[_0xbc4b('0x2d')]);_0x1131d1[_0xbc4b('0x30')]=_[_0xbc4b('0x43')](_0x39e6f5[_0xbc4b('0x31')],qs[_0xbc4b('0x32')](_0x512bf4[_0xbc4b('0x2d')][_0xbc4b('0x32')]));_0x1131d1['attributes']=_0x1131d1[_0xbc4b('0x30')]['length']?_0x1131d1[_0xbc4b('0x30')]:_0x39e6f5[_0xbc4b('0x31')];_0x1131d1[_0xbc4b('0x36')]=qs['sort'](_0x512bf4[_0xbc4b('0x2d')][_0xbc4b('0x37')]);_0x1131d1['where']=qs[_0xbc4b('0x2f')](_[_0xbc4b('0x56')](_0x512bf4[_0xbc4b('0x2d')],_0x39e6f5[_0xbc4b('0x2f')]));if(_0x512bf4['query'][_0xbc4b('0x39')]){_0x1131d1[_0xbc4b('0x38')]=_[_0xbc4b('0x3a')](_0x1131d1[_0xbc4b('0x38')],{'$or':_['map'](_0x1131d1['attributes'],function(_0x27eafe){var _0x3c921a={};_0x3c921a[_0x27eafe]={'$like':'%'+_0x512bf4['query'][_0xbc4b('0x39')]+'%'};return _0x3c921a;})});}_0x1131d1=_[_0xbc4b('0x3a')]({},_0x1131d1,_0x512bf4[_0xbc4b('0x3d')]);return _0x45b0a3[_0xbc4b('0x59')](_0x1131d1);}})['then'](function(_0x26142b){if(_0x26142b){_0x231c15=_0x26142b[_0xbc4b('0x33')];if(!_0x512bf4['query']['hasOwnProperty'](_0xbc4b('0x35'))){_0x1131d1[_0xbc4b('0x19')]=qs[_0xbc4b('0x19')](_0x512bf4[_0xbc4b('0x2d')][_0xbc4b('0x19')]);_0x1131d1['offset']=qs['offset'](_0x512bf4[_0xbc4b('0x2d')][_0xbc4b('0x18')]);}return _0x45b0a3[_0xbc4b('0x59')](_0x1131d1);}})[_0xbc4b('0x1e')](function(_0x4f4eba){if(_0x4f4eba){return _0x4f4eba?{'count':_0x231c15,'rows':_0x4f4eba}:null;}})[_0xbc4b('0x1e')](respondWithResult(_0x4919e4,null))[_0xbc4b('0x42')](handleError(_0x4919e4,null));}; \ No newline at end of file +var _0x9f53=['stack','name','index','map','Trigger','rawAttributes','fieldName','type','key','intersection','model','query','attributes','fields','length','order','sort','where','filters','merge','filter','include','findAll','rows','params','keys','includeAll','options','find','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','addAllCondition','TriggerAllId','create','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','pick','hasOwnProperty','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','get','Triggers','UserProfileResource','end','error'];(function(_0x15d08a,_0x111c31){var _0x15774f=function(_0x3abace){while(--_0x3abace){_0x15d08a['push'](_0x15d08a['shift']());}};_0x15774f(++_0x111c31);}(_0x9f53,0x8e));var _0x39f5=function(_0x4c02bc,_0xf0d62a){_0x4c02bc=_0x4c02bc-0x0;var _0x118d94=_0x9f53[_0x4c02bc];return _0x118d94;};'use strict';var emlformat=require(_0x39f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x39f5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x39f5('0x2'));var moment=require(_0x39f5('0x3'));var BPromise=require(_0x39f5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x39f5('0x5'));var csv=require(_0x39f5('0x6'));var ejs=require(_0x39f5('0x7'));var fs=require('fs');var fs_extra=require(_0x39f5('0x8'));var _=require(_0x39f5('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x39f5('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x39f5('0x6'));var querystring=require(_0x39f5('0xb'));var Papa=require(_0x39f5('0xc'));var Redis=require(_0x39f5('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x39f5('0xe'));var as=require(_0x39f5('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x39f5('0x10'));var config=require(_0x39f5('0x11'));var licenseUtil=require(_0x39f5('0x12'));var db=require(_0x39f5('0x13'))['db'];function respondWithStatusCode(_0x5acaef,_0xb856a0){_0xb856a0=_0xb856a0||0xcc;return function(_0x1c1a63){if(_0x1c1a63){return _0x5acaef[_0x39f5('0x14')](_0xb856a0);}return _0x5acaef['status'](_0xb856a0)['end']();};}function respondWithResult(_0x2f36ac,_0x4d3b34){_0x4d3b34=_0x4d3b34||0xc8;return function(_0x380119){if(_0x380119){return _0x2f36ac[_0x39f5('0x15')](_0x4d3b34)[_0x39f5('0x16')](_0x380119);}};}function respondWithFilteredResult(_0x1c95ec,_0x2c2eaf){return function(_0x152904){if(_0x152904){var _0x3b1417=typeof _0x2c2eaf['offset']===_0x39f5('0x17')&&typeof _0x2c2eaf[_0x39f5('0x18')]===_0x39f5('0x17');var _0x238fba=_0x152904[_0x39f5('0x19')];var _0x4d6817=_0x3b1417?0x0:_0x2c2eaf[_0x39f5('0x1a')];var _0x40b4ab=_0x3b1417?_0x152904['count']:_0x2c2eaf[_0x39f5('0x1a')]+_0x2c2eaf['limit'];var _0x1ec0f4;if(_0x40b4ab>=_0x238fba){_0x40b4ab=_0x238fba;_0x1ec0f4=0xc8;}else{_0x1ec0f4=0xce;}_0x1c95ec[_0x39f5('0x15')](_0x1ec0f4);return _0x1c95ec['set'](_0x39f5('0x1b'),_0x4d6817+'-'+_0x40b4ab+'/'+_0x238fba)[_0x39f5('0x16')](_0x152904);}return null;};}function patchUpdates(_0x411e12){return function(_0x59d4e0){try{jsonpatch[_0x39f5('0x1c')](_0x59d4e0,_0x411e12,!![]);}catch(_0x5933ac){return BPromise[_0x39f5('0x1d')](_0x5933ac);}return _0x59d4e0[_0x39f5('0x1e')]();};}function saveUpdates(_0x3a457f,_0x541c7c){return function(_0x4c106d){if(_0x4c106d){return _0x4c106d[_0x39f5('0x1f')](_0x3a457f)[_0x39f5('0x20')](function(_0x1010b6){return _0x1010b6;});}return null;};}function removeEntity(_0x47859e,_0x1af366){return function(_0x57f419){if(_0x57f419){return _0x57f419['destroy']()[_0x39f5('0x20')](function(){var _0x54f578=_0x57f419[_0x39f5('0x21')]({'plain':!![]});var _0x2ee672=_0x39f5('0x22');return db[_0x39f5('0x23')]['destroy']({'where':{'type':_0x2ee672,'resourceId':_0x54f578['id']}})[_0x39f5('0x20')](function(){return _0x57f419;});})[_0x39f5('0x20')](function(){_0x47859e[_0x39f5('0x15')](0xcc)[_0x39f5('0x24')]();});}};}function handleEntityNotFound(_0x24124,_0x5b7930){return function(_0x575acf){if(!_0x575acf){_0x24124['sendStatus'](0x194);}return _0x575acf;};}function handleError(_0x47de43,_0x1814f3){_0x1814f3=_0x1814f3||0x1f4;return function(_0x2f0c60){logger[_0x39f5('0x25')](_0x2f0c60[_0x39f5('0x26')]);if(_0x2f0c60[_0x39f5('0x27')]){delete _0x2f0c60[_0x39f5('0x27')];}_0x47de43[_0x39f5('0x15')](_0x1814f3)['send'](_0x2f0c60);};}exports[_0x39f5('0x28')]=function(_0x3c20fc,_0x4b16b5){var _0x186ec2={},_0x6e4f59={},_0x2852e8={'count':0x0,'rows':[]};var _0x4a0497=_[_0x39f5('0x29')](db[_0x39f5('0x2a')][_0x39f5('0x2b')],function(_0x1cd357){return{'name':_0x1cd357[_0x39f5('0x2c')],'type':_0x1cd357[_0x39f5('0x2d')][_0x39f5('0x2e')]};});_0x6e4f59['model']=_[_0x39f5('0x29')](_0x4a0497,'name');_0x6e4f59['query']=_['keys'](_0x3c20fc['query']);_0x6e4f59['filters']=_[_0x39f5('0x2f')](_0x6e4f59[_0x39f5('0x30')],_0x6e4f59[_0x39f5('0x31')]);_0x186ec2[_0x39f5('0x32')]=_[_0x39f5('0x2f')](_0x6e4f59[_0x39f5('0x30')],qs[_0x39f5('0x33')](_0x3c20fc[_0x39f5('0x31')][_0x39f5('0x33')]));_0x186ec2['attributes']=_0x186ec2[_0x39f5('0x32')][_0x39f5('0x34')]?_0x186ec2[_0x39f5('0x32')]:_0x6e4f59[_0x39f5('0x30')];if(!_0x3c20fc[_0x39f5('0x31')]['hasOwnProperty']('nolimit')){_0x186ec2[_0x39f5('0x18')]=qs[_0x39f5('0x18')](_0x3c20fc[_0x39f5('0x31')]['limit']);_0x186ec2['offset']=qs['offset'](_0x3c20fc[_0x39f5('0x31')][_0x39f5('0x1a')]);}_0x186ec2[_0x39f5('0x35')]=qs['sort'](_0x3c20fc[_0x39f5('0x31')][_0x39f5('0x36')]);_0x186ec2[_0x39f5('0x37')]=qs[_0x39f5('0x38')](_['pick'](_0x3c20fc[_0x39f5('0x31')],_0x6e4f59[_0x39f5('0x38')]),_0x4a0497);if(_0x3c20fc['query']['filter']){_0x186ec2[_0x39f5('0x37')]=_[_0x39f5('0x39')](_0x186ec2[_0x39f5('0x37')],{'$or':_['map'](_0x4a0497,function(_0x5c9228){if(_0x5c9228['type']!=='VIRTUAL'){var _0x2aa380={};_0x2aa380[_0x5c9228[_0x39f5('0x27')]]={'$like':'%'+_0x3c20fc['query'][_0x39f5('0x3a')]+'%'};return _0x2aa380;}})});}_0x186ec2=_[_0x39f5('0x39')]({},_0x186ec2,_0x3c20fc['options']);var _0x565ec7={'where':_0x186ec2[_0x39f5('0x37')]};return db[_0x39f5('0x2a')][_0x39f5('0x19')](_0x565ec7)[_0x39f5('0x20')](function(_0x14a377){_0x2852e8[_0x39f5('0x19')]=_0x14a377;if(_0x3c20fc[_0x39f5('0x31')]['includeAll']){_0x186ec2[_0x39f5('0x3b')]=[{'all':!![]}];}return db[_0x39f5('0x2a')][_0x39f5('0x3c')](_0x186ec2);})[_0x39f5('0x20')](function(_0x402873){_0x2852e8[_0x39f5('0x3d')]=_0x402873;return _0x2852e8;})[_0x39f5('0x20')](respondWithFilteredResult(_0x4b16b5,_0x186ec2))['catch'](handleError(_0x4b16b5,null));};exports['show']=function(_0x5ec561,_0x309657){var _0x40c79e={'raw':![],'where':{'id':_0x5ec561[_0x39f5('0x3e')]['id']}},_0x45d380={};_0x45d380['model']=_[_0x39f5('0x3f')](db[_0x39f5('0x2a')][_0x39f5('0x2b')]);_0x45d380[_0x39f5('0x31')]=_[_0x39f5('0x3f')](_0x5ec561['query']);_0x45d380['filters']=_[_0x39f5('0x2f')](_0x45d380[_0x39f5('0x30')],_0x45d380['query']);_0x40c79e[_0x39f5('0x32')]=_['intersection'](_0x45d380['model'],qs[_0x39f5('0x33')](_0x5ec561[_0x39f5('0x31')]['fields']));_0x40c79e[_0x39f5('0x32')]=_0x40c79e['attributes'][_0x39f5('0x34')]?_0x40c79e[_0x39f5('0x32')]:_0x45d380[_0x39f5('0x30')];if(_0x5ec561[_0x39f5('0x31')][_0x39f5('0x40')]){_0x40c79e['include']=[{'all':!![]}];}_0x40c79e=_[_0x39f5('0x39')]({},_0x40c79e,_0x5ec561[_0x39f5('0x41')]);return db[_0x39f5('0x2a')][_0x39f5('0x42')](_0x40c79e)['then'](handleEntityNotFound(_0x309657,null))[_0x39f5('0x20')](respondWithResult(_0x309657,null))[_0x39f5('0x43')](handleError(_0x309657,null));};exports['create']=function(_0x5daf1c,_0x2e1a57){return db['Trigger']['create'](_0x5daf1c[_0x39f5('0x44')],{})['then'](function(_0x228cd4){var _0x213050=_0x5daf1c['user'][_0x39f5('0x21')]({'plain':!![]});if(!_0x213050)throw new Error(_0x39f5('0x45'));if(_0x213050[_0x39f5('0x46')]==='user'){var _0x1f01f6=_0x228cd4[_0x39f5('0x21')]({'plain':!![]});var _0x52a474='Triggers';return db[_0x39f5('0x47')][_0x39f5('0x42')]({'where':{'name':_0x52a474,'userProfileId':_0x213050[_0x39f5('0x48')]},'raw':!![]})[_0x39f5('0x20')](function(_0x3745b4){if(_0x3745b4&&_0x3745b4[_0x39f5('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0x1f01f6[_0x39f5('0x27')],'resourceId':_0x1f01f6['id'],'type':_0x3745b4[_0x39f5('0x27')],'sectionId':_0x3745b4['id']},{})['then'](function(){return _0x228cd4;});}else{return _0x228cd4;}})[_0x39f5('0x43')](function(_0x35be2d){logger[_0x39f5('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35be2d);throw _0x35be2d;});}return _0x228cd4;})[_0x39f5('0x20')](respondWithResult(_0x2e1a57,0xc9))['catch'](handleError(_0x2e1a57,null));};exports[_0x39f5('0x1f')]=function(_0x3e2ff5,_0x1399c8){if(_0x3e2ff5[_0x39f5('0x44')]['id']){delete _0x3e2ff5[_0x39f5('0x44')]['id'];}return db['Trigger'][_0x39f5('0x42')]({'where':{'id':_0x3e2ff5['params']['id']}})['then'](handleEntityNotFound(_0x1399c8,null))['then'](saveUpdates(_0x3e2ff5['body'],null))[_0x39f5('0x20')](respondWithResult(_0x1399c8,null))[_0x39f5('0x43')](handleError(_0x1399c8,null));};exports['destroy']=function(_0x404942,_0x537f71){return db[_0x39f5('0x2a')][_0x39f5('0x42')]({'where':{'id':_0x404942[_0x39f5('0x3e')]['id']}})[_0x39f5('0x20')](handleEntityNotFound(_0x537f71,null))[_0x39f5('0x20')](removeEntity(_0x537f71,null))[_0x39f5('0x43')](handleError(_0x537f71,null));};exports[_0x39f5('0x4a')]=function(_0xb48c6d,_0x1ebcfa,_0x122986){if(_0xb48c6d[_0x39f5('0x44')]['id']){delete _0xb48c6d[_0x39f5('0x44')]['id'];}return db['Trigger']['find']({'where':{'id':_0xb48c6d[_0x39f5('0x3e')]['id']}})[_0x39f5('0x20')](handleEntityNotFound(_0x1ebcfa,null))['then'](function(_0x549959){if(_0x549959){_0xb48c6d[_0x39f5('0x44')][_0x39f5('0x4b')]=_0x549959['id'];return db['Condition'][_0x39f5('0x4c')](_0xb48c6d[_0x39f5('0x44')]);}})['then'](respondWithResult(_0x1ebcfa,null))[_0x39f5('0x43')](handleError(_0x1ebcfa,null));};exports[_0x39f5('0x4d')]=function(_0x1823ca,_0x44479e,_0x17ecf6){if(_0x1823ca[_0x39f5('0x44')]['id']){delete _0x1823ca['body']['id'];}return db[_0x39f5('0x2a')]['find']({'where':{'id':_0x1823ca['params']['id']}})['then'](handleEntityNotFound(_0x44479e,null))[_0x39f5('0x20')](function(_0x2b9dec){if(_0x2b9dec){_0x1823ca[_0x39f5('0x44')][_0x39f5('0x4e')]=_0x2b9dec['id'];return db[_0x39f5('0x4f')]['create'](_0x1823ca[_0x39f5('0x44')]);}})[_0x39f5('0x20')](respondWithResult(_0x44479e,null))['catch'](handleError(_0x44479e,null));};exports[_0x39f5('0x50')]=function(_0x18763c,_0x1f53ec,_0x20aed4){var _0x66337d={};var _0x6c75b9={};var _0x5e4c98;var _0x1bdc87;return db[_0x39f5('0x2a')][_0x39f5('0x51')]({'where':{'id':_0x18763c[_0x39f5('0x3e')]['id']}})[_0x39f5('0x20')](handleEntityNotFound(_0x1f53ec,null))[_0x39f5('0x20')](function(_0x14f035){if(_0x14f035){_0x5e4c98=_0x14f035;_0x6c75b9[_0x39f5('0x30')]=_[_0x39f5('0x3f')](db[_0x39f5('0x4f')][_0x39f5('0x2b')]);_0x6c75b9[_0x39f5('0x31')]=_[_0x39f5('0x3f')](_0x18763c[_0x39f5('0x31')]);_0x6c75b9[_0x39f5('0x38')]=_[_0x39f5('0x2f')](_0x6c75b9[_0x39f5('0x30')],_0x6c75b9['query']);_0x66337d[_0x39f5('0x32')]=_[_0x39f5('0x2f')](_0x6c75b9[_0x39f5('0x30')],qs['fields'](_0x18763c[_0x39f5('0x31')][_0x39f5('0x33')]));_0x66337d[_0x39f5('0x32')]=_0x66337d[_0x39f5('0x32')][_0x39f5('0x34')]?_0x66337d[_0x39f5('0x32')]:_0x6c75b9[_0x39f5('0x30')];_0x66337d[_0x39f5('0x35')]=qs[_0x39f5('0x36')](_0x18763c[_0x39f5('0x31')][_0x39f5('0x36')]);_0x66337d[_0x39f5('0x37')]=qs[_0x39f5('0x38')](_[_0x39f5('0x52')](_0x18763c[_0x39f5('0x31')],_0x6c75b9[_0x39f5('0x38')]));if(_0x18763c[_0x39f5('0x31')][_0x39f5('0x3a')]){_0x66337d['where']=_['merge'](_0x66337d['where'],{'$or':_[_0x39f5('0x29')](_0x66337d[_0x39f5('0x32')],function(_0x4280b7){var _0x2e7d26={};_0x2e7d26[_0x4280b7]={'$like':'%'+_0x18763c['query'][_0x39f5('0x3a')]+'%'};return _0x2e7d26;})});}_0x66337d=_['merge']({},_0x66337d,_0x18763c[_0x39f5('0x41')]);return _0x5e4c98[_0x39f5('0x50')](_0x66337d);}})[_0x39f5('0x20')](function(_0x5c4184){if(_0x5c4184){_0x1bdc87=_0x5c4184[_0x39f5('0x34')];if(!_0x18763c['query'][_0x39f5('0x53')](_0x39f5('0x54'))){_0x66337d['limit']=qs[_0x39f5('0x18')](_0x18763c[_0x39f5('0x31')][_0x39f5('0x18')]);_0x66337d[_0x39f5('0x1a')]=qs[_0x39f5('0x1a')](_0x18763c['query']['offset']);}return _0x5e4c98[_0x39f5('0x50')](_0x66337d);}})[_0x39f5('0x20')](function(_0x5c73bc){if(_0x5c73bc){return _0x5c73bc?{'count':_0x1bdc87,'rows':_0x5c73bc}:null;}})['then'](respondWithResult(_0x1f53ec,null))['catch'](handleError(_0x1f53ec,null));};exports[_0x39f5('0x55')]=function(_0xcf81b9,_0xa24cc6,_0xd53c0a){var _0xbe784b={};var _0x498d0d={};var _0x5327cb;var _0x1b8ead;return db[_0x39f5('0x2a')][_0x39f5('0x51')]({'where':{'id':_0xcf81b9['params']['id']}})[_0x39f5('0x20')](handleEntityNotFound(_0xa24cc6,null))['then'](function(_0x37978b){if(_0x37978b){_0x5327cb=_0x37978b;_0x498d0d[_0x39f5('0x30')]=_[_0x39f5('0x3f')](db['Condition'][_0x39f5('0x2b')]);_0x498d0d['query']=_['keys'](_0xcf81b9[_0x39f5('0x31')]);_0x498d0d[_0x39f5('0x38')]=_[_0x39f5('0x2f')](_0x498d0d[_0x39f5('0x30')],_0x498d0d[_0x39f5('0x31')]);_0xbe784b[_0x39f5('0x32')]=_['intersection'](_0x498d0d[_0x39f5('0x30')],qs['fields'](_0xcf81b9[_0x39f5('0x31')][_0x39f5('0x33')]));_0xbe784b[_0x39f5('0x32')]=_0xbe784b[_0x39f5('0x32')][_0x39f5('0x34')]?_0xbe784b[_0x39f5('0x32')]:_0x498d0d[_0x39f5('0x30')];_0xbe784b[_0x39f5('0x35')]=qs[_0x39f5('0x36')](_0xcf81b9[_0x39f5('0x31')]['sort']);_0xbe784b['where']=qs['filters'](_[_0x39f5('0x52')](_0xcf81b9[_0x39f5('0x31')],_0x498d0d[_0x39f5('0x38')]));if(_0xcf81b9[_0x39f5('0x31')][_0x39f5('0x3a')]){_0xbe784b['where']=_[_0x39f5('0x39')](_0xbe784b[_0x39f5('0x37')],{'$or':_[_0x39f5('0x29')](_0xbe784b[_0x39f5('0x32')],function(_0x284e2d){var _0x58e99f={};_0x58e99f[_0x284e2d]={'$like':'%'+_0xcf81b9[_0x39f5('0x31')][_0x39f5('0x3a')]+'%'};return _0x58e99f;})});}_0xbe784b=_[_0x39f5('0x39')]({},_0xbe784b,_0xcf81b9[_0x39f5('0x41')]);return _0x5327cb[_0x39f5('0x55')](_0xbe784b);}})[_0x39f5('0x20')](function(_0x278397){if(_0x278397){_0x1b8ead=_0x278397['length'];if(!_0xcf81b9[_0x39f5('0x31')][_0x39f5('0x53')](_0x39f5('0x54'))){_0xbe784b[_0x39f5('0x18')]=qs[_0x39f5('0x18')](_0xcf81b9[_0x39f5('0x31')][_0x39f5('0x18')]);_0xbe784b[_0x39f5('0x1a')]=qs[_0x39f5('0x1a')](_0xcf81b9['query'][_0x39f5('0x1a')]);}return _0x5327cb[_0x39f5('0x55')](_0xbe784b);}})[_0x39f5('0x20')](function(_0x416ceb){if(_0x416ceb){return _0x416ceb?{'count':_0x1b8ead,'rows':_0x416ceb}:null;}})[_0x39f5('0x20')](respondWithResult(_0xa24cc6,null))[_0x39f5('0x43')](handleError(_0xa24cc6,null));};exports[_0x39f5('0x56')]=function(_0x53d01e,_0x55532d,_0x3efeea){if(_0x53d01e[_0x39f5('0x44')]['id']){delete _0x53d01e['body']['id'];}return db[_0x39f5('0x2a')][_0x39f5('0x42')]({'where':{'id':_0x53d01e[_0x39f5('0x3e')]['id']}})[_0x39f5('0x20')](handleEntityNotFound(_0x55532d,null))['then'](function(_0x135fc1){if(_0x135fc1){_0x53d01e[_0x39f5('0x44')][_0x39f5('0x57')]=_0x135fc1['id'];return db[_0x39f5('0x58')]['create'](_0x53d01e[_0x39f5('0x44')]);}})[_0x39f5('0x20')](respondWithResult(_0x55532d,null))[_0x39f5('0x43')](handleError(_0x55532d,null));};exports[_0x39f5('0x59')]=function(_0xce75ee,_0x41414b,_0x27ff4f){var _0x258c34={};var _0x4fe295={};var _0x2a3904;var _0x24e24f;return db[_0x39f5('0x2a')][_0x39f5('0x51')]({'where':{'id':_0xce75ee[_0x39f5('0x3e')]['id']}})[_0x39f5('0x20')](handleEntityNotFound(_0x41414b,null))[_0x39f5('0x20')](function(_0x408175){if(_0x408175){_0x2a3904=_0x408175;_0x4fe295[_0x39f5('0x30')]=_['keys'](db[_0x39f5('0x58')][_0x39f5('0x2b')]);_0x4fe295['query']=_['keys'](_0xce75ee[_0x39f5('0x31')]);_0x4fe295['filters']=_[_0x39f5('0x2f')](_0x4fe295[_0x39f5('0x30')],_0x4fe295['query']);_0x258c34[_0x39f5('0x32')]=_[_0x39f5('0x2f')](_0x4fe295['model'],qs[_0x39f5('0x33')](_0xce75ee[_0x39f5('0x31')][_0x39f5('0x33')]));_0x258c34[_0x39f5('0x32')]=_0x258c34['attributes'][_0x39f5('0x34')]?_0x258c34['attributes']:_0x4fe295[_0x39f5('0x30')];_0x258c34[_0x39f5('0x35')]=qs['sort'](_0xce75ee[_0x39f5('0x31')][_0x39f5('0x36')]);_0x258c34[_0x39f5('0x37')]=qs[_0x39f5('0x38')](_['pick'](_0xce75ee[_0x39f5('0x31')],_0x4fe295[_0x39f5('0x38')]));if(_0xce75ee[_0x39f5('0x31')][_0x39f5('0x3a')]){_0x258c34[_0x39f5('0x37')]=_[_0x39f5('0x39')](_0x258c34['where'],{'$or':_[_0x39f5('0x29')](_0x258c34[_0x39f5('0x32')],function(_0x527d8c){var _0x581ece={};_0x581ece[_0x527d8c]={'$like':'%'+_0xce75ee[_0x39f5('0x31')]['filter']+'%'};return _0x581ece;})});}_0x258c34=_[_0x39f5('0x39')]({},_0x258c34,_0xce75ee[_0x39f5('0x41')]);return _0x2a3904[_0x39f5('0x59')](_0x258c34);}})[_0x39f5('0x20')](function(_0x3ff7bc){if(_0x3ff7bc){_0x24e24f=_0x3ff7bc[_0x39f5('0x34')];if(!_0xce75ee['query'][_0x39f5('0x53')](_0x39f5('0x54'))){_0x258c34[_0x39f5('0x18')]=qs[_0x39f5('0x18')](_0xce75ee[_0x39f5('0x31')][_0x39f5('0x18')]);_0x258c34['offset']=qs['offset'](_0xce75ee['query'][_0x39f5('0x1a')]);}return _0x2a3904['getActions'](_0x258c34);}})[_0x39f5('0x20')](function(_0x1b5cf3){if(_0x1b5cf3){return _0x1b5cf3?{'count':_0x24e24f,'rows':_0x1b5cf3}:null;}})[_0x39f5('0x20')](respondWithResult(_0x41414b,null))[_0x39f5('0x43')](handleError(_0x41414b,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index f0cae64..6148bb3 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 _0x20d6=['tools_triggers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','Trigger'];(function(_0x303ea4,_0x2067f1){var _0x5b3d3e=function(_0x4567ce){while(--_0x4567ce){_0x303ea4['push'](_0x303ea4['shift']());}};_0x5b3d3e(++_0x2067f1);}(_0x20d6,0x9d));var _0x620d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x20d6[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x620d('0x0'));var util=require(_0x620d('0x1'));var logger=require(_0x620d('0x2'))(_0x620d('0x3'));var moment=require(_0x620d('0x4'));var BPromise=require('bluebird');var rp=require(_0x620d('0x5'));var fs=require('fs');var path=require(_0x620d('0x6'));var rimraf=require(_0x620d('0x7'));var config=require(_0x620d('0x8'));var attributes=require('./trigger.attributes');module[_0x620d('0x9')]=function(_0x3ea631,_0x5c67f9){return _0x3ea631[_0x620d('0xa')](_0x620d('0xb'),attributes,{'tableName':_0x620d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec39=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','lodash'];(function(_0x12c3f9,_0x5ca8e9){var _0x33ef1b=function(_0x550b55){while(--_0x550b55){_0x12c3f9['push'](_0x12c3f9['shift']());}};_0x33ef1b(++_0x5ca8e9);}(_0xec39,0x19f));var _0x9ec3=function(_0x34e407,_0xf3ae48){_0x34e407=_0x34e407-0x0;var _0x55535b=_0xec39[_0x34e407];return _0x55535b;};'use strict';var _=require(_0x9ec3('0x0'));var util=require(_0x9ec3('0x1'));var logger=require(_0x9ec3('0x2'))(_0x9ec3('0x3'));var moment=require(_0x9ec3('0x4'));var BPromise=require(_0x9ec3('0x5'));var rp=require(_0x9ec3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ec3('0x7'));var config=require(_0x9ec3('0x8'));var attributes=require(_0x9ec3('0x9'));module['exports']=function(_0x49ddff,_0x55adba){return _0x49ddff[_0x9ec3('0xa')](_0x9ec3('0xb'),attributes,{'tableName':_0x9ec3('0xc'),'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 9e9fd51..330ab3c 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 _0xd841=['../../config/environment','http','request','then','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetTrigger','Trigger','findAll','options','raw','where','include','map','model','attributes','ShowTrigger','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3bef0e,_0x2eb6d2){var _0x193173=function(_0x50eb2d){while(--_0x50eb2d){_0x3bef0e['push'](_0x3bef0e['shift']());}};_0x193173(++_0x2eb6d2);}(_0xd841,0x1c7));var _0x1d84=function(_0x3450a0,_0x2fb122){_0x3450a0=_0x3450a0-0x0;var _0x2e7374=_0xd841[_0x3450a0];return _0x2e7374;};'use strict';var _=require('lodash');var util=require(_0x1d84('0x0'));var moment=require('moment');var BPromise=require(_0x1d84('0x1'));var rs=require(_0x1d84('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d84('0x3'))['db'];var utils=require(_0x1d84('0x4'));var logger=require(_0x1d84('0x5'))(_0x1d84('0x6'));var config=require(_0x1d84('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1d84('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c3d43,_0x1a4a4e,_0x1cbbd9){return new BPromise(function(_0x43bbde,_0x24f16e){return client[_0x1d84('0x9')](_0x4c3d43,_0x1cbbd9)[_0x1d84('0xa')](function(_0x3353fe){logger['info'](_0x1d84('0xb'),_0x1a4a4e,'request\x20sent');logger[_0x1d84('0xc')](_0x1d84('0xd'),_0x1a4a4e,_0x1d84('0xe'),JSON[_0x1d84('0xf')](_0x3353fe));if(_0x3353fe[_0x1d84('0x10')]){if(_0x3353fe['error'][_0x1d84('0x11')]===0x1f4){logger[_0x1d84('0x10')](_0x1d84('0xb'),_0x1a4a4e,_0x3353fe[_0x1d84('0x10')][_0x1d84('0x12')]);return _0x24f16e(_0x3353fe['error'][_0x1d84('0x12')]);}logger[_0x1d84('0x10')]('Trigger,\x20%s,\x20%s',_0x1a4a4e,_0x3353fe[_0x1d84('0x10')][_0x1d84('0x12')]);return _0x43bbde(_0x3353fe[_0x1d84('0x10')]['message']);}else{logger[_0x1d84('0x13')](_0x1d84('0xb'),_0x1a4a4e,_0x1d84('0xe'));_0x43bbde(_0x3353fe[_0x1d84('0x14')][_0x1d84('0x12')]);}})[_0x1d84('0x15')](function(_0x42f420){logger[_0x1d84('0x10')]('Trigger,\x20%s,\x20%s',_0x1a4a4e,_0x42f420);_0x24f16e(_0x42f420);});});}exports[_0x1d84('0x16')]=function(_0x19b830){var _0x35a142=this;return new Promise(function(_0x46a0b1,_0x1ed456){return db[_0x1d84('0x17')][_0x1d84('0x18')]({'raw':_0x19b830[_0x1d84('0x19')]?_0x19b830[_0x1d84('0x19')][_0x1d84('0x1a')]===undefined?!![]:![]:!![],'where':_0x19b830[_0x1d84('0x19')]?_0x19b830[_0x1d84('0x19')][_0x1d84('0x1b')]||null:null,'attributes':_0x19b830['options']?_0x19b830[_0x1d84('0x19')]['attributes']||null:null,'limit':_0x19b830[_0x1d84('0x19')]?_0x19b830[_0x1d84('0x19')]['limit']||null:null,'include':_0x19b830[_0x1d84('0x19')]?_0x19b830['options'][_0x1d84('0x1c')]?_[_0x1d84('0x1d')](_0x19b830[_0x1d84('0x19')][_0x1d84('0x1c')],function(_0x12b45b){return{'model':db[_0x12b45b[_0x1d84('0x1e')]],'as':_0x12b45b['as'],'attributes':_0x12b45b[_0x1d84('0x1f')],'include':_0x12b45b[_0x1d84('0x1c')]?_[_0x1d84('0x1d')](_0x12b45b['include'],function(_0x3f5995){return{'model':db[_0x3f5995[_0x1d84('0x1e')]],'as':_0x3f5995['as'],'attributes':_0x3f5995['attributes'],'include':_0x3f5995[_0x1d84('0x1c')]?_['map'](_0x3f5995['include'],function(_0x29e351){return{'model':db[_0x29e351[_0x1d84('0x1e')]],'as':_0x29e351['as'],'attributes':_0x29e351[_0x1d84('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1d84('0xa')](function(_0x4df60f){logger[_0x1d84('0x13')]('GetTrigger',_0x19b830);logger[_0x1d84('0xc')](_0x1d84('0x16'),_0x19b830,JSON[_0x1d84('0xf')](_0x4df60f));_0x46a0b1(_0x4df60f);})[_0x1d84('0x15')](function(_0x299935){logger[_0x1d84('0x10')]('GetTrigger',_0x299935['message'],_0x19b830);_0x1ed456(_0x35a142[_0x1d84('0x10')](0x1f4,_0x299935[_0x1d84('0x12')]));});});};exports[_0x1d84('0x20')]=function(_0x311448){var _0xae949b=this;return new Promise(function(_0x2cb8af,_0x2782f5){return db[_0x1d84('0x17')]['find']({'raw':_0x311448[_0x1d84('0x19')]?_0x311448[_0x1d84('0x19')][_0x1d84('0x1a')]===undefined?!![]:![]:!![],'where':_0x311448[_0x1d84('0x19')]?_0x311448['options']['where']||null:null,'attributes':_0x311448[_0x1d84('0x19')]?_0x311448[_0x1d84('0x19')][_0x1d84('0x1f')]||null:null,'include':_0x311448[_0x1d84('0x19')]?_0x311448['options'][_0x1d84('0x1c')]?_['map'](_0x311448['options']['include'],function(_0xf89a6c){return{'model':db[_0xf89a6c[_0x1d84('0x1e')]],'as':_0xf89a6c['as'],'attributes':_0xf89a6c[_0x1d84('0x1f')],'include':_0xf89a6c[_0x1d84('0x1c')]?_[_0x1d84('0x1d')](_0xf89a6c['include'],function(_0x6f2f85){return{'model':db[_0x6f2f85[_0x1d84('0x1e')]],'as':_0x6f2f85['as'],'attributes':_0x6f2f85[_0x1d84('0x1f')],'include':_0x6f2f85[_0x1d84('0x1c')]?_['map'](_0x6f2f85[_0x1d84('0x1c')],function(_0x51fad1){return{'model':db[_0x51fad1['model']],'as':_0x51fad1['as'],'attributes':_0x51fad1['attributes']};}):[]};}):[]};}):[]:[]})[_0x1d84('0xa')](function(_0x2bd2df){logger[_0x1d84('0x13')](_0x1d84('0x20'),_0x311448);logger[_0x1d84('0xc')]('ShowTrigger',_0x311448,JSON[_0x1d84('0xf')](_0x2bd2df));_0x2cb8af(_0x2bd2df);})[_0x1d84('0x15')](function(_0x3afe62){logger[_0x1d84('0x10')](_0x1d84('0x20'),_0x3afe62[_0x1d84('0x12')],_0x311448);_0x2782f5(_0xae949b['error'](0x1f4,_0x3afe62[_0x1d84('0x12')]));});});}; \ No newline at end of file +var _0x41af=['limit','include','map','model','attributes','then','catch','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','Trigger,\x20%s,\x20%s','debug','stringify','error','message','info','request\x20sent','result','GetTrigger','Trigger','findAll','options','raw','where'];(function(_0x30fbf5,_0x487ca){var _0x4babde=function(_0x11fda2){while(--_0x11fda2){_0x30fbf5['push'](_0x30fbf5['shift']());}};_0x4babde(++_0x487ca);}(_0x41af,0x1c3));var _0xf41a=function(_0x62e2c4,_0x44bbca){_0x62e2c4=_0x62e2c4-0x0;var _0x2893ec=_0x41af[_0x62e2c4];return _0x2893ec;};'use strict';var _=require(_0xf41a('0x0'));var util=require(_0xf41a('0x1'));var moment=require(_0xf41a('0x2'));var BPromise=require(_0xf41a('0x3'));var rs=require(_0xf41a('0x4'));var fs=require('fs');var Redis=require(_0xf41a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf41a('0x6'));var logger=require(_0xf41a('0x7'))(_0xf41a('0x8'));var config=require(_0xf41a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf41a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ef8ca,_0x45f623,_0x56b0d3){return new BPromise(function(_0x20f46b,_0x4dbf59){return client['request'](_0x4ef8ca,_0x56b0d3)['then'](function(_0x437be6){logger['info'](_0xf41a('0xb'),_0x45f623,'request\x20sent');logger[_0xf41a('0xc')]('Trigger,\x20%s,\x20%s,\x20%s',_0x45f623,'request\x20sent',JSON[_0xf41a('0xd')](_0x437be6));if(_0x437be6[_0xf41a('0xe')]){if(_0x437be6[_0xf41a('0xe')]['code']===0x1f4){logger['error'](_0xf41a('0xb'),_0x45f623,_0x437be6[_0xf41a('0xe')][_0xf41a('0xf')]);return _0x4dbf59(_0x437be6[_0xf41a('0xe')][_0xf41a('0xf')]);}logger[_0xf41a('0xe')](_0xf41a('0xb'),_0x45f623,_0x437be6[_0xf41a('0xe')]['message']);return _0x20f46b(_0x437be6[_0xf41a('0xe')][_0xf41a('0xf')]);}else{logger[_0xf41a('0x10')]('Trigger,\x20%s,\x20%s',_0x45f623,_0xf41a('0x11'));_0x20f46b(_0x437be6[_0xf41a('0x12')]['message']);}})['catch'](function(_0x1c0321){logger['error'](_0xf41a('0xb'),_0x45f623,_0x1c0321);_0x4dbf59(_0x1c0321);});});}exports[_0xf41a('0x13')]=function(_0x33d0ef){var _0x432c01=this;return new Promise(function(_0x56bd60,_0x92919e){return db[_0xf41a('0x14')][_0xf41a('0x15')]({'raw':_0x33d0ef[_0xf41a('0x16')]?_0x33d0ef['options'][_0xf41a('0x17')]===undefined?!![]:![]:!![],'where':_0x33d0ef['options']?_0x33d0ef[_0xf41a('0x16')][_0xf41a('0x18')]||null:null,'attributes':_0x33d0ef['options']?_0x33d0ef[_0xf41a('0x16')]['attributes']||null:null,'limit':_0x33d0ef[_0xf41a('0x16')]?_0x33d0ef[_0xf41a('0x16')][_0xf41a('0x19')]||null:null,'include':_0x33d0ef[_0xf41a('0x16')]?_0x33d0ef['options'][_0xf41a('0x1a')]?_[_0xf41a('0x1b')](_0x33d0ef[_0xf41a('0x16')]['include'],function(_0x2242db){return{'model':db[_0x2242db[_0xf41a('0x1c')]],'as':_0x2242db['as'],'attributes':_0x2242db[_0xf41a('0x1d')],'include':_0x2242db[_0xf41a('0x1a')]?_[_0xf41a('0x1b')](_0x2242db[_0xf41a('0x1a')],function(_0x50b816){return{'model':db[_0x50b816[_0xf41a('0x1c')]],'as':_0x50b816['as'],'attributes':_0x50b816[_0xf41a('0x1d')],'include':_0x50b816['include']?_['map'](_0x50b816[_0xf41a('0x1a')],function(_0x5ebfbb){return{'model':db[_0x5ebfbb[_0xf41a('0x1c')]],'as':_0x5ebfbb['as'],'attributes':_0x5ebfbb[_0xf41a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf41a('0x1e')](function(_0x5beeda){logger[_0xf41a('0x10')](_0xf41a('0x13'),_0x33d0ef);logger[_0xf41a('0xc')](_0xf41a('0x13'),_0x33d0ef,JSON[_0xf41a('0xd')](_0x5beeda));_0x56bd60(_0x5beeda);})[_0xf41a('0x1f')](function(_0x195f15){logger['error'](_0xf41a('0x13'),_0x195f15[_0xf41a('0xf')],_0x33d0ef);_0x92919e(_0x432c01[_0xf41a('0xe')](0x1f4,_0x195f15[_0xf41a('0xf')]));});});};exports[_0xf41a('0x20')]=function(_0x462e31){var _0xd00e2c=this;return new Promise(function(_0x41efaa,_0x46c23e){return db[_0xf41a('0x14')][_0xf41a('0x21')]({'raw':_0x462e31[_0xf41a('0x16')]?_0x462e31['options']['raw']===undefined?!![]:![]:!![],'where':_0x462e31[_0xf41a('0x16')]?_0x462e31[_0xf41a('0x16')][_0xf41a('0x18')]||null:null,'attributes':_0x462e31['options']?_0x462e31[_0xf41a('0x16')][_0xf41a('0x1d')]||null:null,'include':_0x462e31[_0xf41a('0x16')]?_0x462e31[_0xf41a('0x16')][_0xf41a('0x1a')]?_[_0xf41a('0x1b')](_0x462e31[_0xf41a('0x16')][_0xf41a('0x1a')],function(_0x4b3d41){return{'model':db[_0x4b3d41[_0xf41a('0x1c')]],'as':_0x4b3d41['as'],'attributes':_0x4b3d41[_0xf41a('0x1d')],'include':_0x4b3d41['include']?_['map'](_0x4b3d41[_0xf41a('0x1a')],function(_0x557e6a){return{'model':db[_0x557e6a[_0xf41a('0x1c')]],'as':_0x557e6a['as'],'attributes':_0x557e6a[_0xf41a('0x1d')],'include':_0x557e6a[_0xf41a('0x1a')]?_[_0xf41a('0x1b')](_0x557e6a['include'],function(_0x54610b){return{'model':db[_0x54610b[_0xf41a('0x1c')]],'as':_0x54610b['as'],'attributes':_0x54610b[_0xf41a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f8133){logger[_0xf41a('0x10')](_0xf41a('0x20'),_0x462e31);logger[_0xf41a('0xc')](_0xf41a('0x20'),_0x462e31,JSON[_0xf41a('0xd')](_0x2f8133));_0x41efaa(_0x2f8133);})['catch'](function(_0x4f8a10){logger[_0xf41a('0xe')](_0xf41a('0x20'),_0x4f8a10['message'],_0x462e31);_0x46c23e(_0xd00e2c[_0xf41a('0xe')](0x1f4,_0x4f8a10[_0xf41a('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 5375e02..c2201d5 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 _0x80f9=['create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./trunk.controller','isAuthenticated','index','get','/:id','post','clone'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x80f9,0x1ce));var _0x980f=function(_0x34ce67,_0x91a745){_0x34ce67=_0x34ce67-0x0;var _0x1dfa3b=_0x80f9[_0x34ce67];return _0x1dfa3b;};'use strict';var multer=require(_0x980f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x980f('0x1'));var express=require(_0x980f('0x2'));var router=express[_0x980f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x980f('0x4'));var interaction=require(_0x980f('0x5'));var config=require('../../config/environment');var controller=require(_0x980f('0x6'));router['get']('/',auth[_0x980f('0x7')](),controller[_0x980f('0x8')]);router[_0x980f('0x9')](_0x980f('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x980f('0xb')]('/:id/clone',auth['isAuthenticated'](),controller[_0x980f('0xc')]);router['post']('/',auth[_0x980f('0x7')](),controller[_0x980f('0xd')]);router[_0x980f('0xe')](_0x980f('0xa'),auth[_0x980f('0x7')](),controller[_0x980f('0xf')]);router[_0x980f('0x10')](_0x980f('0xa'),auth[_0x980f('0x7')](),controller[_0x980f('0x11')]);module[_0x980f('0x12')]=router; \ No newline at end of file +var _0x47e2=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','show','post','/:id/clone','create','put','/:id','util','connect-timeout','express'];(function(_0xd51999,_0x4b24d0){var _0x16c68a=function(_0x36747a){while(--_0x36747a){_0xd51999['push'](_0xd51999['shift']());}};_0x16c68a(++_0x4b24d0);}(_0x47e2,0x93));var _0x247e=function(_0x436d91,_0x4515ff){_0x436d91=_0x436d91-0x0;var _0x18afaf=_0x47e2[_0x436d91];return _0x18afaf;};'use strict';var multer=require('multer');var util=require(_0x247e('0x0'));var path=require('path');var timeout=require(_0x247e('0x1'));var express=require(_0x247e('0x2'));var router=express[_0x247e('0x3')]();var fs_extra=require(_0x247e('0x4'));var auth=require(_0x247e('0x5'));var interaction=require(_0x247e('0x6'));var config=require('../../config/environment');var controller=require('./trunk.controller');router['get']('/',auth[_0x247e('0x7')](),controller['index']);router[_0x247e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x247e('0x9')]);router[_0x247e('0xa')](_0x247e('0xb'),auth[_0x247e('0x7')](),controller['clone']);router['post']('/',auth[_0x247e('0x7')](),controller[_0x247e('0xc')]);router[_0x247e('0xd')]('/:id',auth[_0x247e('0x7')](),controller['update']);router['delete'](_0x247e('0xe'),auth[_0x247e('0x7')](),controller['destroy']);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 d76d23a..568371d 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 _0xf97f=['PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','uas','pai','certificate','passive','dynamic','BOOLEAN','sequelize','STRING','name','ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED'];(function(_0xadade,_0x29d6ad){var _0x13ff65=function(_0x3a1c71){while(--_0x3a1c71){_0xadade['push'](_0xadade['shift']());}};_0x13ff65(++_0x29d6ad);}(_0xf97f,0xef));var _0xff97=function(_0x300ad3,_0x14b408){_0x300ad3=_0x300ad3-0x0;var _0x373f02=_0xf97f[_0x300ad3];return _0x373f02;};'use strict';var Sequelize=require(_0xff97('0x0'));module['exports']={'name':{'type':Sequelize[_0xff97('0x1')],'allowNull':![],'unique':_0xff97('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xff97('0x3')](_0xff97('0x4'),_0xff97('0x5'),_0xff97('0x6')),'allowNull':![],'defaultValue':_0xff97('0x4')},'context':{'type':Sequelize[_0xff97('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0xff97('0x7'),'ALLOWED_PASSED_SCREEN',_0xff97('0x8'),_0xff97('0x9'),_0xff97('0xa'),'PROHIB_PASSED_SCREEN',_0xff97('0xb'),_0xff97('0xc'))},'deny':{'type':Sequelize[_0xff97('0x1')]},'permit':{'type':Sequelize[_0xff97('0x1')]},'secret':{'type':Sequelize[_0xff97('0x1')]},'md5secret':{'type':Sequelize[_0xff97('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xff97('0x1')],'defaultValue':_0xff97('0xd'),'set':function(_0x5627e8){this[_0xff97('0xe')](_0xff97('0xf'),_0x5627e8?_0x5627e8['join'](','):null);},'get':function(){return this[_0xff97('0x10')](_0xff97('0xf'))?this[_0xff97('0x10')]('transport')[_0xff97('0x11')](','):null;},'comment':_0xff97('0x12')},'dtmfmode':{'type':Sequelize[_0xff97('0x3')](_0xff97('0x13'),_0xff97('0x14'),_0xff97('0x15'),_0xff97('0x16'),_0xff97('0x17')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xff97('0x3')](_0xff97('0x18'),'no',_0xff97('0x19'),_0xff97('0x1a'),_0xff97('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xff97('0x3')](_0xff97('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xff97('0x1')]},'directmediadeny':{'type':Sequelize[_0xff97('0x1')]},'nat':{'type':Sequelize[_0xff97('0x1')],'defaultValue':_0xff97('0x1c'),'set':function(_0x33bc6f){this[_0xff97('0xe')](_0xff97('0x1d'),_0x33bc6f?_0x33bc6f[_0xff97('0x1e')](','):null);},'get':function(){return this[_0xff97('0x10')](_0xff97('0x1d'))?this[_0xff97('0x10')](_0xff97('0x1d'))['split'](','):null;},'comment':_0xff97('0x1f')},'callgroup':{'type':Sequelize[_0xff97('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xff97('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xff97('0x1')]},'language':{'type':Sequelize[_0xff97('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xff97('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xff97('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xff97('0x1')],'allowNull':![],'defaultValue':_0xff97('0x20'),'set':function(_0x390888){this['setDataValue'](_0xff97('0x21'),_0x390888?_0x390888[_0xff97('0x1e')](';'):_0xff97('0x20'));},'get':function(){return this[_0xff97('0x10')](_0xff97('0x21'))?this[_0xff97('0x10')]('allow')[_0xff97('0x11')](';'):null;},'comment':_0xff97('0x22')},'autoframing':{'type':Sequelize[_0xff97('0x3')]('yes','no')},'insecure':{'type':Sequelize[_0xff97('0x1')],'defaultValue':'port,invite','set':function(_0x430201){this[_0xff97('0xe')](_0xff97('0x23'),_0x430201?_0x430201[_0xff97('0x1e')](','):null);},'get':function(){return this[_0xff97('0x10')](_0xff97('0x23'))?this[_0xff97('0x10')](_0xff97('0x23'))['split'](','):null;},'comment':_0xff97('0x24')},'trustrpid':{'type':Sequelize[_0xff97('0x3')](_0xff97('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xff97('0x3')](_0xff97('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xff97('0x3')]('yes','no',_0xff97('0x25'))},'promiscredir':{'type':Sequelize[_0xff97('0x3')](_0xff97('0x18'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xff97('0x18'),'no')},'accountcode':{'type':Sequelize[_0xff97('0x26')](0xb)},'setvar':{'type':Sequelize[_0xff97('0x1')]},'callerid':{'type':Sequelize[_0xff97('0x1')],'defaultValue':_0xff97('0x27')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xff97('0x3')](_0xff97('0x18'),'no'),'defaultValue':_0xff97('0x18')},'busylevel':{'type':Sequelize[_0xff97('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0xff97('0x3')](_0xff97('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xff97('0x3')](_0xff97('0x18'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xff97('0x3')](_0xff97('0x18'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xff97('0x1')]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0xff97('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xff97('0x3')](_0xff97('0x18'),'no')},'mailbox':{'type':Sequelize[_0xff97('0x1')]},'session_timers':{'type':Sequelize['ENUM']('accept',_0xff97('0x29'),_0xff97('0x2a'))},'session_expires':{'type':Sequelize[_0xff97('0x26')](0xb)},'session_minse':{'type':Sequelize[_0xff97('0x26')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xff97('0x2b'),_0xff97('0x2c')),'defaultValue':_0xff97('0x2c')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xff97('0x1')]},'fromdomain':{'type':Sequelize[_0xff97('0x1')]},'fromuser':{'type':Sequelize[_0xff97('0x1')]},'port':{'type':Sequelize[_0xff97('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xff97('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xff97('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xff97('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0xff97('0x3')](_0xff97('0x18'),'no',_0xff97('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xff97('0x1')]},'callbackextension':{'type':Sequelize[_0xff97('0x1')]},'timert1':{'type':Sequelize[_0xff97('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xff97('0x1')]},'contactdeny':{'type':Sequelize[_0xff97('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xff97('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xff97('0x26')](0xb)},'encryption':{'type':Sequelize[_0xff97('0x3')](_0xff97('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xff97('0x3')](_0xff97('0x18'),'no')},'force_avp':{'type':Sequelize[_0xff97('0x3')](_0xff97('0x18'),'no')},'icesupport':{'type':Sequelize[_0xff97('0x3')](_0xff97('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xff97('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xff97('0x3')](_0xff97('0x18'),'no','fingerprint',_0xff97('0x2e'))},'dtlsrekey':{'type':Sequelize[_0xff97('0x26')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xff97('0x1')]},'dtlscafile':{'type':Sequelize[_0xff97('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xff97('0x2f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xff97('0x1')]},'usereqphone':{'type':Sequelize[_0xff97('0x3')](_0xff97('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xff97('0x1')]},'recordofffeature':{'type':Sequelize[_0xff97('0x1')]},'call_limit':{'type':Sequelize[_0xff97('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0xff97('0x3')](_0xff97('0x18'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xff97('0x1')]},'parkinglot':{'type':Sequelize[_0xff97('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xff97('0x1')],'defaultValue':_0xff97('0x30')},'canreinvite':{'type':Sequelize[_0xff97('0x3')](_0xff97('0x18'),'no','nonat','update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xff97('0x1')]},'otherFields':{'type':Sequelize[_0xff97('0x1')]},'active':{'type':Sequelize[_0xff97('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xff97('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0xafad=['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','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','sequelize','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','setDataValue','join','getDataValue','transport','rfc2833','info','shortinfo','auto','nonat','update','outgoing','yes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xafad,0xab));var _0xdafa=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xafad[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xdafa('0x0'));module['exports']={'name':{'type':Sequelize[_0xdafa('0x1')],'allowNull':![],'unique':_0xdafa('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xdafa('0x3')](_0xdafa('0x4'),_0xdafa('0x5'),_0xdafa('0x6')),'allowNull':![],'defaultValue':_0xdafa('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdafa('0x7')},'callingpres':{'type':Sequelize[_0xdafa('0x3')](_0xdafa('0x8'),'ALLOWED_PASSED_SCREEN',_0xdafa('0x9'),_0xdafa('0xa'),'PROHIB_NOT_SCREENED',_0xdafa('0xb'),_0xdafa('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0xdafa('0x1')]},'permit':{'type':Sequelize[_0xdafa('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xdafa('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x5b91b0){this[_0xdafa('0xd')]('transport',_0x5b91b0?_0x5b91b0[_0xdafa('0xe')](','):null);},'get':function(){return this[_0xdafa('0xf')](_0xdafa('0x10'))?this['getDataValue'](_0xdafa('0x10'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xdafa('0x3')](_0xdafa('0x11'),_0xdafa('0x12'),_0xdafa('0x13'),'inband',_0xdafa('0x14')),'defaultValue':_0xdafa('0x11')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0xdafa('0x15'),_0xdafa('0x16'),_0xdafa('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xdafa('0x3')](_0xdafa('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xdafa('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x4e91d8){this[_0xdafa('0xd')](_0xdafa('0x19'),_0x4e91d8?_0x4e91d8[_0xdafa('0xe')](','):null);},'get':function(){return this['getDataValue']('nat')?this['getDataValue'](_0xdafa('0x19'))[_0xdafa('0x1a')](','):null;},'comment':_0xdafa('0x1b')},'callgroup':{'type':Sequelize[_0xdafa('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xdafa('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xdafa('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xdafa('0x1')],'defaultValue':_0xdafa('0x1c')},'allow':{'type':Sequelize[_0xdafa('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x52b253){this[_0xdafa('0xd')]('allow',_0x52b253?_0x52b253['join'](';'):_0xdafa('0x1d'));},'get':function(){return this[_0xdafa('0xf')](_0xdafa('0x1e'))?this['getDataValue'](_0xdafa('0x1e'))[_0xdafa('0x1a')](';'):null;},'comment':_0xdafa('0x1f')},'autoframing':{'type':Sequelize['ENUM'](_0xdafa('0x18'),'no')},'insecure':{'type':Sequelize[_0xdafa('0x1')],'defaultValue':'port,invite','set':function(_0x5f1eee){this[_0xdafa('0xd')](_0xdafa('0x20'),_0x5f1eee?_0x5f1eee['join'](','):null);},'get':function(){return this[_0xdafa('0xf')](_0xdafa('0x20'))?this[_0xdafa('0xf')](_0xdafa('0x20'))[_0xdafa('0x1a')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xdafa('0x3')](_0xdafa('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xdafa('0x3')](_0xdafa('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xdafa('0x18'),'no',_0xdafa('0x21'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0xdafa('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0xdafa('0x22')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xdafa('0x1')],'defaultValue':_0xdafa('0x23')},'amaflags':{'type':Sequelize[_0xdafa('0x1')]},'callcounter':{'type':Sequelize[_0xdafa('0x3')](_0xdafa('0x18'),'no'),'defaultValue':_0xdafa('0x18')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xdafa('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xdafa('0x3')](_0xdafa('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0xdafa('0x3')](_0xdafa('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xdafa('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xdafa('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xdafa('0x3')]('yes','no',_0xdafa('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xdafa('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xdafa('0x3')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xdafa('0x3')](_0xdafa('0x25'),_0xdafa('0x26'),_0xdafa('0x27'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xdafa('0x22')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0xdafa('0x28')),'defaultValue':_0xdafa('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0xdafa('0x1')]},'regexten':{'type':Sequelize[_0xdafa('0x1')]},'fromdomain':{'type':Sequelize[_0xdafa('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xdafa('0x22')](0x5)},'qualify':{'type':Sequelize[_0xdafa('0x3')](_0xdafa('0x18'),'no'),'defaultValue':_0xdafa('0x18')},'keepalive':{'type':Sequelize[_0xdafa('0x22')](0xb)},'defaultip':{'type':Sequelize[_0xdafa('0x1')]},'defaultuser':{'type':Sequelize[_0xdafa('0x1')]},'rtptimeout':{'type':Sequelize[_0xdafa('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xdafa('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xdafa('0x22')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xdafa('0x18'),'no',_0xdafa('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xdafa('0x1')]},'callbackextension':{'type':Sequelize[_0xdafa('0x1')]},'timert1':{'type':Sequelize[_0xdafa('0x22')](0xb)},'timerb':{'type':Sequelize[_0xdafa('0x22')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xdafa('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xdafa('0x1')]},'use_q850_reason':{'type':Sequelize[_0xdafa('0x1')]},'maxforwards':{'type':Sequelize[_0xdafa('0x22')](0xb)},'encryption':{'type':Sequelize[_0xdafa('0x3')](_0xdafa('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xdafa('0x3')](_0xdafa('0x18'),'no')},'force_avp':{'type':Sequelize[_0xdafa('0x3')]('yes','no')},'icesupport':{'type':Sequelize['ENUM'](_0xdafa('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xdafa('0x3')](_0xdafa('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0xdafa('0x3')]('yes','no',_0xdafa('0x2a'),_0xdafa('0x2b'))},'dtlsrekey':{'type':Sequelize[_0xdafa('0x22')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xdafa('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xdafa('0x3')](_0xdafa('0x2c'),_0xdafa('0x2d'),_0xdafa('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xdafa('0x1')]},'usereqphone':{'type':Sequelize['ENUM'](_0xdafa('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xdafa('0x1')]},'call_limit':{'type':Sequelize[_0xdafa('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xdafa('0x3')](_0xdafa('0x18'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0xdafa('0x1')]},'mohinterpret':{'type':Sequelize[_0xdafa('0x1')]},'mohsuggest':{'type':Sequelize[_0xdafa('0x1')]},'parkinglot':{'type':Sequelize[_0xdafa('0x1')]},'description':{'type':Sequelize[_0xdafa('0x1')]},'host':{'type':Sequelize[_0xdafa('0x1')],'defaultValue':_0xdafa('0x2f')},'canreinvite':{'type':Sequelize[_0xdafa('0x3')](_0xdafa('0x18'),'no',_0xdafa('0x15'),_0xdafa('0x16'),_0xdafa('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xdafa('0x1')]},'otherFields':{'type':Sequelize[_0xdafa('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 989a87c..6390d4a 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 _0xe5b3=['then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','clone','find','omit','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request'];(function(_0x6ff984,_0x52fbd1){var _0x1b8400=function(_0x15ce8c){while(--_0x15ce8c){_0x6ff984['push'](_0x6ff984['shift']());}};_0x1b8400(++_0x52fbd1);}(_0xe5b3,0x133));var _0x3e5b=function(_0x273517,_0x50b234){_0x273517=_0x273517-0x0;var _0x2c6334=_0xe5b3[_0x273517];return _0x2c6334;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];var jayson=require(_0x3e5b('0x19'));var client=jayson[_0x3e5b('0x1a')][_0x3e5b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x405e70,_0x560010,_0x39a2a1,_0x5f2f9c){return new BPromise(function(_0x51a188,_0x4d71a3){var _0x3754e3=_0x5f2f9c||client;return _0x3754e3[_0x3e5b('0x1c')](_0x405e70,_0x39a2a1)[_0x3e5b('0x1d')](function(_0x4fb471){logger[_0x3e5b('0x1e')]('Trunk,\x20%s,\x20%s',_0x560010,'request\x20sent');logger[_0x3e5b('0x1f')](_0x3e5b('0x20'),_0x560010,'request\x20sent',JSON[_0x3e5b('0x21')](_0x4fb471));if(_0x4fb471[_0x3e5b('0x22')]){if(_0x4fb471['error'][_0x3e5b('0x23')]===0x1f4){logger[_0x3e5b('0x22')]('Trunk,\x20%s,\x20%s',_0x560010,_0x4fb471['error'][_0x3e5b('0x24')]);return _0x4d71a3(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);return _0x51a188(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}else{logger[_0x3e5b('0x1e')](_0x3e5b('0x25'),_0x560010,_0x3e5b('0x26'));_0x51a188(_0x4fb471[_0x3e5b('0x27')][_0x3e5b('0x24')]);}})['catch'](function(_0x433f9c){logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x433f9c);_0x4d71a3(_0x433f9c);});});}function respondWithStatusCode(_0x150674,_0x50039b){_0x50039b=_0x50039b||0xcc;return function(_0x1eb80f){if(_0x1eb80f){return _0x150674['sendStatus'](_0x50039b);}return _0x150674[_0x3e5b('0x28')](_0x50039b)[_0x3e5b('0x29')]();};}function respondWithResult(_0x4d5e61,_0x41b684){_0x41b684=_0x41b684||0xc8;return function(_0x2f6368){if(_0x2f6368){return _0x4d5e61[_0x3e5b('0x28')](_0x41b684)[_0x3e5b('0x2a')](_0x2f6368);}};}function respondWithFilteredResult(_0x3bb749,_0x26c7f2){return function(_0x160e87){if(_0x160e87){var _0x2ddf57=typeof _0x26c7f2['offset']===_0x3e5b('0x2b')&&typeof _0x26c7f2['limit']===_0x3e5b('0x2b');var _0x4fd64b=_0x160e87[_0x3e5b('0x2c')];var _0x1f6473=_0x2ddf57?0x0:_0x26c7f2[_0x3e5b('0x2d')];var _0x475b39=_0x2ddf57?_0x160e87[_0x3e5b('0x2c')]:_0x26c7f2[_0x3e5b('0x2d')]+_0x26c7f2[_0x3e5b('0x2e')];var _0x9c2123;if(_0x475b39>=_0x4fd64b){_0x475b39=_0x4fd64b;_0x9c2123=0xc8;}else{_0x9c2123=0xce;}_0x3bb749[_0x3e5b('0x28')](_0x9c2123);return _0x3bb749[_0x3e5b('0x2f')](_0x3e5b('0x30'),_0x1f6473+'-'+_0x475b39+'/'+_0x4fd64b)['json'](_0x160e87);}return null;};}function patchUpdates(_0x21bc10){return function(_0x1882aa){try{jsonpatch[_0x3e5b('0x31')](_0x1882aa,_0x21bc10,!![]);}catch(_0x2a14eb){return BPromise[_0x3e5b('0x32')](_0x2a14eb);}return _0x1882aa[_0x3e5b('0x33')]();};}function saveUpdates(_0x345927,_0x4c4e01){return function(_0x33f089){if(_0x33f089){return _0x33f089['update'](_0x345927)['then'](function(_0x32c6b0){return _0x32c6b0;});}return null;};}function removeEntity(_0x78d68a,_0x51ea0d){return function(_0x40e37d){if(_0x40e37d){return _0x40e37d[_0x3e5b('0x34')]()[_0x3e5b('0x1d')](function(){var _0x33e356=_0x40e37d[_0x3e5b('0x35')]({'plain':!![]});var _0x26f842=_0x3e5b('0x36');return db[_0x3e5b('0x37')][_0x3e5b('0x34')]({'where':{'type':_0x26f842,'resourceId':_0x33e356['id']}})[_0x3e5b('0x1d')](function(){return _0x40e37d;});})[_0x3e5b('0x1d')](function(){_0x78d68a[_0x3e5b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141b7e,_0xec45c5){return function(_0x53caa2){if(!_0x53caa2){_0x141b7e['sendStatus'](0x194);}return _0x53caa2;};}function handleError(_0x471196,_0x56d7ef){_0x56d7ef=_0x56d7ef||0x1f4;return function(_0x2939da){logger[_0x3e5b('0x22')](_0x2939da[_0x3e5b('0x38')]);if(_0x2939da[_0x3e5b('0x39')]){delete _0x2939da['name'];}_0x471196[_0x3e5b('0x28')](_0x56d7ef)['send'](_0x2939da);};}exports[_0x3e5b('0x3a')]=function(_0x5ec841,_0x47f7c8){var _0x48f414={},_0x10c202={},_0x174ebf={'count':0x0,'rows':[]};var _0x2eaa30=_[_0x3e5b('0x3b')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')],function(_0x5466ac){return{'name':_0x5466ac['fieldName'],'type':_0x5466ac['type']['key']};});_0x10c202['model']=_['map'](_0x2eaa30,'name');_0x10c202[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x5ec841[_0x3e5b('0x3e')]);_0x10c202[_0x3e5b('0x40')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],_0x10c202[_0x3e5b('0x3e')]);_0x48f414[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x5ec841['query'][_0x3e5b('0x44')]));_0x48f414[_0x3e5b('0x43')]=_0x48f414[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x48f414[_0x3e5b('0x43')]:_0x10c202[_0x3e5b('0x42')];if(!_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x46')](_0x3e5b('0x47'))){_0x48f414[_0x3e5b('0x2e')]=qs[_0x3e5b('0x2e')](_0x5ec841['query']['limit']);_0x48f414['offset']=qs['offset'](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x2d')]);}_0x48f414[_0x3e5b('0x48')]=qs[_0x3e5b('0x49')](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x49')]);_0x48f414[_0x3e5b('0x4a')]=qs[_0x3e5b('0x40')](_[_0x3e5b('0x4b')](_0x5ec841[_0x3e5b('0x3e')],_0x10c202['filters']),_0x2eaa30);if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x4c')]){_0x48f414[_0x3e5b('0x4a')]=_[_0x3e5b('0x4d')](_0x48f414[_0x3e5b('0x4a')],{'$or':_['map'](_0x2eaa30,function(_0x588ee7){if(_0x588ee7['type']!==_0x3e5b('0x4e')){var _0x20af6a={};_0x20af6a[_0x588ee7[_0x3e5b('0x39')]]={'$like':'%'+_0x5ec841['query']['filter']+'%'};return _0x20af6a;}})});}_0x48f414=_[_0x3e5b('0x4d')]({},_0x48f414,_0x5ec841[_0x3e5b('0x4f')]);var _0x123947={'where':_0x48f414['where']};return db['Trunk'][_0x3e5b('0x2c')](_0x123947)['then'](function(_0x14b62a){_0x174ebf[_0x3e5b('0x2c')]=_0x14b62a;if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x48f414[_0x3e5b('0x51')]=[{'all':!![]}];}return db[_0x3e5b('0x3c')][_0x3e5b('0x52')](_0x48f414);})[_0x3e5b('0x1d')](function(_0x339852){_0x174ebf['rows']=_0x339852;return _0x174ebf;})[_0x3e5b('0x1d')](respondWithFilteredResult(_0x47f7c8,_0x48f414))['catch'](handleError(_0x47f7c8,null));};exports[_0x3e5b('0x53')]=function(_0x2e7047,_0x26e11e){var _0x3d51fa={'raw':![],'where':{'id':_0x2e7047[_0x3e5b('0x54')]['id']}},_0x291e4d={};_0x291e4d[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x291e4d[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x2e7047[_0x3e5b('0x3e')]);_0x291e4d['filters']=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],_0x291e4d[_0x3e5b('0x3e')]);_0x3d51fa[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],qs['fields'](_0x2e7047[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x3d51fa[_0x3e5b('0x43')]=_0x3d51fa[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x3d51fa[_0x3e5b('0x43')]:_0x291e4d[_0x3e5b('0x42')];if(_0x2e7047[_0x3e5b('0x3e')]['includeAll']){_0x3d51fa[_0x3e5b('0x51')]=[{'all':!![]}];}_0x3d51fa=_['merge']({},_0x3d51fa,_0x2e7047['options']);return db[_0x3e5b('0x3c')]['find'](_0x3d51fa)[_0x3e5b('0x1d')](handleEntityNotFound(_0x26e11e,null))[_0x3e5b('0x1d')](respondWithResult(_0x26e11e,null))[_0x3e5b('0x55')](handleError(_0x26e11e,null));};exports[_0x3e5b('0x56')]=function(_0x4a492b,_0x5ddeee){var _0x545712={'where':{'id':_0x4a492b[_0x3e5b('0x54')]['id']}},_0x581b94={};_0x581b94[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x545712['attributes']=_['intersection'](_0x581b94[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x545712[_0x3e5b('0x43')]=_0x545712['attributes']['length']?_0x545712['attributes']:_0x581b94['model'];if(_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x545712[_0x3e5b('0x51')]=[{'all':!![]}];}_0x545712=_[_0x3e5b('0x4d')]({},_0x545712,_0x4a492b[_0x3e5b('0x4f')]);return db[_0x3e5b('0x3c')][_0x3e5b('0x57')](_0x545712)[_0x3e5b('0x1d')](handleEntityNotFound(_0x5ddeee,null))['then'](function(_0x285db6){if(_0x285db6){var _0x29897b=_0x285db6[_0x3e5b('0x35')]({'plain':!![]});_0x29897b=qs[_0x3e5b('0x58')](_0x29897b,['id',_0x3e5b('0x59'),'updatedAt']);_0x4a492b[_0x3e5b('0x5a')]=_['omit'](_0x4a492b[_0x3e5b('0x5a')],['id',_0x3e5b('0x59'),'updatedAt']);return db['Trunk']['create'](_[_0x3e5b('0x4d')](_0x29897b,_0x4a492b['body']),{'include':_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]?[{'all':!![]}]:undefined})[_0x3e5b('0x1d')](function(_0x40197c){var _0x14f187=_0x4a492b['user']['get']({'plain':!![]});if(!_0x14f187)throw new Error(_0x3e5b('0x5b'));if(_0x14f187[_0x3e5b('0x5c')]===_0x3e5b('0x5d')){var _0x4dfb45=_0x40197c[_0x3e5b('0x35')]({'plain':!![]});var _0x3c5293=_0x3e5b('0x36');return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3c5293,'userProfileId':_0x14f187[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x4a1ce3){if(_0x4a1ce3&&_0x4a1ce3[_0x3e5b('0x60')]===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x4dfb45[_0x3e5b('0x39')],'resourceId':_0x4dfb45['id'],'type':_0x4a1ce3[_0x3e5b('0x39')],'sectionId':_0x4a1ce3['id']},{})[_0x3e5b('0x1d')](function(){return _0x40197c;});}else{return _0x40197c;}})[_0x3e5b('0x55')](function(_0x2411c3){logger[_0x3e5b('0x22')](_0x3e5b('0x62'),_0x2411c3);throw _0x2411c3;});}return _0x40197c;});}})['then'](respondWithResult(_0x5ddeee,0xc9))[_0x3e5b('0x55')](handleError(_0x5ddeee,null));};exports[_0x3e5b('0x61')]=function(_0x5af305,_0x177144,_0x31ef31){var _0x561c78;return db['Trunk']['create'](_0x5af305[_0x3e5b('0x5a')],{'raw':!![]})[_0x3e5b('0x1d')](function(_0x498e6d){_0x561c78=_0x498e6d;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});})['then'](function(_0x3d3bf2){var _0x17f60f=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0x410c7a=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x40103e=ejs[_0x3e5b('0x69')](_0x17f60f,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x40103e);if(_0x561c78['registry']){var _0x590f0c=ejs[_0x3e5b('0x69')](_0x410c7a,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x590f0c);}})[_0x3e5b('0x1d')](function(){return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x61'),{'module':_0x3e5b('0x6d')});})[_0x3e5b('0x1d')](function(){var _0x9deb09=_0x5af305[_0x3e5b('0x5d')]['get']({'plain':!![]});if(!_0x9deb09)throw new Error(_0x3e5b('0x5b'));if(_0x9deb09[_0x3e5b('0x5c')]==='user'){var _0x577747=_0x561c78['get']({'plain':!![]});return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3e5b('0x36'),'userProfileId':_0x9deb09[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x1ba550){if(_0x1ba550&&_0x1ba550['autoAssociation']===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x577747['name'],'resourceId':_0x577747['id'],'type':_0x1ba550[_0x3e5b('0x39')],'sectionId':_0x1ba550['id']},{})['then'](function(){return _0x561c78;});}else{return _0x561c78;}})['catch'](function(_0x211e73){logger[_0x3e5b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211e73);throw _0x211e73;});}return _0x561c78;})[_0x3e5b('0x1d')](respondWithResult(_0x177144,0xc9))[_0x3e5b('0x55')](handleError(_0x177144,null));};exports['update']=function(_0x2e36af,_0x185640,_0x14baa9){var _0x1425eb;return db[_0x3e5b('0x3c')][_0x3e5b('0x57')]({'where':{'id':_0x2e36af['params']['id']}})['then'](handleEntityNotFound(_0x185640,null))[_0x3e5b('0x1d')](saveUpdates(_0x2e36af['body'],null))['then'](function(_0x25d3d8){if(_0x25d3d8){_0x1425eb=_0x25d3d8;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});}})['then'](function(_0x2e5fa3){if(_0x2e5fa3){var _0x4b8d19=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0xdf2677=fs['readFileSync'](path[_0x3e5b('0x64')](config['root'],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x58ccf3=ejs[_0x3e5b('0x69')](_0x4b8d19,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x58ccf3);var _0x5ad011=ejs[_0x3e5b('0x69')](_0xdf2677,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5ad011);return respondWithRpcPromise('Reload',_0x3e5b('0x6f'),{'module':_0x3e5b('0x6d')});}return null;})['then'](function(_0xd9d941){if(_0xd9d941){return _0x1425eb;}})[_0x3e5b('0x1d')](respondWithResult(_0x185640,null))[_0x3e5b('0x55')](handleError(_0x185640,null));};exports['destroy']=function(_0x3b3306,_0x30e079,_0x352f7e){var _0x1d7c05;return db['Trunk'][_0x3e5b('0x57')]({'where':{'id':_0x3b3306['params']['id']}})[_0x3e5b('0x1d')](handleEntityNotFound(_0x30e079,null))['then'](removeEntity(_0x30e079,null))[_0x3e5b('0x1d')](function(){return db[_0x3e5b('0x3c')]['findAll']({'raw':!![]});})[_0x3e5b('0x1d')](function(_0x2299b9){var _0x56ff9d=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),'utf8');var _0x53328b=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x3d1193=ejs['render'](_0x56ff9d,{'trunks':_0x2299b9});var _0x5d6aae=ejs[_0x3e5b('0x69')](_0x53328b,{'trunks':_0x2299b9});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x3d1193);fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5d6aae);return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x34'),{'module':_0x3e5b('0x6d')});})['catch'](handleError(_0x30e079,null));}; \ No newline at end of file +var _0xe14d=['options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','omit','createdAt','updatedAt','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','UserProfileSection','autoAssociation','readFileSync','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','Trunks','UserProfileResource','destroy','stack','name','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x4ad4f5,_0xe79bc4){var _0x1007dc=function(_0x56f6b0){while(--_0x56f6b0){_0x4ad4f5['push'](_0x4ad4f5['shift']());}};_0x1007dc(++_0xe79bc4);}(_0xe14d,0x1ee));var _0xde14=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xe14d[_0x5416db];return _0x243e35;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];var jayson=require(_0xde14('0x1b'));var client=jayson[_0xde14('0x1c')][_0xde14('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x464624,_0x3521d4,_0x281c54,_0x1489e9){return new BPromise(function(_0x54c58b,_0x584959){var _0x23c878=_0x1489e9||client;return _0x23c878[_0xde14('0x1e')](_0x464624,_0x281c54)[_0xde14('0x1f')](function(_0x4c86ff){logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));logger[_0xde14('0x23')](_0xde14('0x24'),_0x3521d4,_0xde14('0x22'),JSON[_0xde14('0x25')](_0x4c86ff));if(_0x4c86ff[_0xde14('0x26')]){if(_0x4c86ff[_0xde14('0x26')][_0xde14('0x27')]===0x1f4){logger['error'](_0xde14('0x21'),_0x3521d4,_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);return _0x584959(_0x4c86ff[_0xde14('0x26')]['message']);}logger[_0xde14('0x26')]('Trunk,\x20%s,\x20%s',_0x3521d4,_0x4c86ff[_0xde14('0x26')]['message']);return _0x54c58b(_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);}else{logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));_0x54c58b(_0x4c86ff[_0xde14('0x29')][_0xde14('0x28')]);}})[_0xde14('0x2a')](function(_0xdd8d59){logger[_0xde14('0x26')](_0xde14('0x21'),_0x3521d4,_0xdd8d59);_0x584959(_0xdd8d59);});});}function respondWithStatusCode(_0xbaa078,_0x8f8033){_0x8f8033=_0x8f8033||0xcc;return function(_0x5ae4c1){if(_0x5ae4c1){return _0xbaa078[_0xde14('0x2b')](_0x8f8033);}return _0xbaa078[_0xde14('0x2c')](_0x8f8033)[_0xde14('0x2d')]();};}function respondWithResult(_0xbd05d6,_0x1bb7be){_0x1bb7be=_0x1bb7be||0xc8;return function(_0x21ef15){if(_0x21ef15){return _0xbd05d6[_0xde14('0x2c')](_0x1bb7be)[_0xde14('0x2e')](_0x21ef15);}};}function respondWithFilteredResult(_0x1618e1,_0x350a78){return function(_0x4eff65){if(_0x4eff65){var _0x309922=typeof _0x350a78[_0xde14('0x2f')]===_0xde14('0x30')&&typeof _0x350a78[_0xde14('0x31')]==='undefined';var _0x3fc2a4=_0x4eff65[_0xde14('0x32')];var _0x30c4a8=_0x309922?0x0:_0x350a78['offset'];var _0x4655fb=_0x309922?_0x4eff65['count']:_0x350a78[_0xde14('0x2f')]+_0x350a78[_0xde14('0x31')];var _0x3bb1da;if(_0x4655fb>=_0x3fc2a4){_0x4655fb=_0x3fc2a4;_0x3bb1da=0xc8;}else{_0x3bb1da=0xce;}_0x1618e1[_0xde14('0x2c')](_0x3bb1da);return _0x1618e1[_0xde14('0x33')](_0xde14('0x34'),_0x30c4a8+'-'+_0x4655fb+'/'+_0x3fc2a4)[_0xde14('0x2e')](_0x4eff65);}return null;};}function patchUpdates(_0x464666){return function(_0x4e7c5b){try{jsonpatch[_0xde14('0x35')](_0x4e7c5b,_0x464666,!![]);}catch(_0xbf49ac){return BPromise['reject'](_0xbf49ac);}return _0x4e7c5b[_0xde14('0x36')]();};}function saveUpdates(_0x4c9b15,_0x2e40ad){return function(_0x44e88a){if(_0x44e88a){return _0x44e88a[_0xde14('0x37')](_0x4c9b15)[_0xde14('0x1f')](function(_0x13c164){return _0x13c164;});}return null;};}function removeEntity(_0x57fc47,_0x26dfa9){return function(_0x57b98b){if(_0x57b98b){return _0x57b98b['destroy']()[_0xde14('0x1f')](function(){var _0x3c943b=_0x57b98b[_0xde14('0x38')]({'plain':!![]});var _0x319136=_0xde14('0x39');return db[_0xde14('0x3a')][_0xde14('0x3b')]({'where':{'type':_0x319136,'resourceId':_0x3c943b['id']}})[_0xde14('0x1f')](function(){return _0x57b98b;});})[_0xde14('0x1f')](function(){_0x57fc47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7136,_0x403007){return function(_0x20913d){if(!_0x20913d){_0x1c7136[_0xde14('0x2b')](0x194);}return _0x20913d;};}function handleError(_0x31cad4,_0x23813f){_0x23813f=_0x23813f||0x1f4;return function(_0x1f42ab){logger[_0xde14('0x26')](_0x1f42ab[_0xde14('0x3c')]);if(_0x1f42ab['name']){delete _0x1f42ab[_0xde14('0x3d')];}_0x31cad4['status'](_0x23813f)['send'](_0x1f42ab);};}exports['index']=function(_0xb0eba6,_0x258759){var _0x398f63={},_0x152dab={},_0x1228d8={'count':0x0,'rows':[]};var _0x8b5bb4=_[_0xde14('0x3e')](db[_0xde14('0x3f')]['rawAttributes'],function(_0xc2a39d){return{'name':_0xc2a39d[_0xde14('0x40')],'type':_0xc2a39d[_0xde14('0x41')][_0xde14('0x42')]};});_0x152dab[_0xde14('0x43')]=_[_0xde14('0x3e')](_0x8b5bb4,_0xde14('0x3d'));_0x152dab[_0xde14('0x44')]=_['keys'](_0xb0eba6[_0xde14('0x44')]);_0x152dab[_0xde14('0x45')]=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],_0x152dab['query']);_0x398f63['attributes']=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],qs[_0xde14('0x47')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x47')]));_0x398f63['attributes']=_0x398f63[_0xde14('0x48')][_0xde14('0x49')]?_0x398f63[_0xde14('0x48')]:_0x152dab['model'];if(!_0xb0eba6[_0xde14('0x44')]['hasOwnProperty'](_0xde14('0x4a'))){_0x398f63['limit']=qs[_0xde14('0x31')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x31')]);_0x398f63[_0xde14('0x2f')]=qs[_0xde14('0x2f')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x2f')]);}_0x398f63[_0xde14('0x4b')]=qs['sort'](_0xb0eba6[_0xde14('0x44')]['sort']);_0x398f63[_0xde14('0x4c')]=qs['filters'](_[_0xde14('0x4d')](_0xb0eba6[_0xde14('0x44')],_0x152dab[_0xde14('0x45')]),_0x8b5bb4);if(_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]){_0x398f63[_0xde14('0x4c')]=_[_0xde14('0x4f')](_0x398f63[_0xde14('0x4c')],{'$or':_['map'](_0x8b5bb4,function(_0x15859c){if(_0x15859c[_0xde14('0x41')]!==_0xde14('0x50')){var _0x4b1ef7={};_0x4b1ef7[_0x15859c['name']]={'$like':'%'+_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]+'%'};return _0x4b1ef7;}})});}_0x398f63=_[_0xde14('0x4f')]({},_0x398f63,_0xb0eba6[_0xde14('0x51')]);var _0x39572b={'where':_0x398f63[_0xde14('0x4c')]};return db['Trunk'][_0xde14('0x32')](_0x39572b)['then'](function(_0xa408ec){_0x1228d8[_0xde14('0x32')]=_0xa408ec;if(_0xb0eba6['query'][_0xde14('0x52')]){_0x398f63[_0xde14('0x53')]=[{'all':!![]}];}return db[_0xde14('0x3f')][_0xde14('0x54')](_0x398f63);})[_0xde14('0x1f')](function(_0x1c87e1){_0x1228d8[_0xde14('0x55')]=_0x1c87e1;return _0x1228d8;})['then'](respondWithFilteredResult(_0x258759,_0x398f63))[_0xde14('0x2a')](handleError(_0x258759,null));};exports['show']=function(_0xfa80c8,_0x6aa9ab){var _0x237be4={'raw':![],'where':{'id':_0xfa80c8[_0xde14('0x56')]['id']}},_0x235202={};_0x235202[_0xde14('0x43')]=_[_0xde14('0x57')](db[_0xde14('0x3f')][_0xde14('0x58')]);_0x235202[_0xde14('0x44')]=_['keys'](_0xfa80c8[_0xde14('0x44')]);_0x235202[_0xde14('0x45')]=_[_0xde14('0x46')](_0x235202[_0xde14('0x43')],_0x235202[_0xde14('0x44')]);_0x237be4['attributes']=_[_0xde14('0x46')](_0x235202['model'],qs[_0xde14('0x47')](_0xfa80c8[_0xde14('0x44')][_0xde14('0x47')]));_0x237be4[_0xde14('0x48')]=_0x237be4[_0xde14('0x48')]['length']?_0x237be4['attributes']:_0x235202[_0xde14('0x43')];if(_0xfa80c8['query'][_0xde14('0x52')]){_0x237be4[_0xde14('0x53')]=[{'all':!![]}];}_0x237be4=_[_0xde14('0x4f')]({},_0x237be4,_0xfa80c8[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x237be4)[_0xde14('0x1f')](handleEntityNotFound(_0x6aa9ab,null))[_0xde14('0x1f')](respondWithResult(_0x6aa9ab,null))[_0xde14('0x2a')](handleError(_0x6aa9ab,null));};exports['clone']=function(_0x205a94,_0x2c972b){var _0x1ea6d2={'where':{'id':_0x205a94[_0xde14('0x56')]['id']}},_0x21d226={};_0x21d226['model']=_[_0xde14('0x57')](db['Trunk'][_0xde14('0x58')]);_0x1ea6d2[_0xde14('0x48')]=_[_0xde14('0x46')](_0x21d226[_0xde14('0x43')],qs[_0xde14('0x47')](_0x205a94[_0xde14('0x44')][_0xde14('0x47')]));_0x1ea6d2[_0xde14('0x48')]=_0x1ea6d2['attributes']['length']?_0x1ea6d2['attributes']:_0x21d226[_0xde14('0x43')];if(_0x205a94['query']['includeAll']){_0x1ea6d2[_0xde14('0x53')]=[{'all':!![]}];}_0x1ea6d2=_[_0xde14('0x4f')]({},_0x1ea6d2,_0x205a94[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x1ea6d2)[_0xde14('0x1f')](handleEntityNotFound(_0x2c972b,null))[_0xde14('0x1f')](function(_0x13f698){if(_0x13f698){var _0x2dd108=_0x13f698['get']({'plain':!![]});_0x2dd108=qs[_0xde14('0x5a')](_0x2dd108,['id',_0xde14('0x5b'),_0xde14('0x5c')]);_0x205a94['body']=_[_0xde14('0x5a')](_0x205a94['body'],['id',_0xde14('0x5b'),_0xde14('0x5c')]);return db[_0xde14('0x3f')][_0xde14('0x5d')](_[_0xde14('0x4f')](_0x2dd108,_0x205a94[_0xde14('0x5e')]),{'include':_0x205a94[_0xde14('0x44')]['includeAll']?[{'all':!![]}]:undefined})[_0xde14('0x1f')](function(_0x25ba7e){var _0x1a0bb1=_0x205a94[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x1a0bb1)throw new Error(_0xde14('0x60'));if(_0x1a0bb1[_0xde14('0x61')]==='user'){var _0x4a9e85=_0x25ba7e[_0xde14('0x38')]({'plain':!![]});var _0x19a162=_0xde14('0x39');return db['UserProfileSection'][_0xde14('0x59')]({'where':{'name':_0x19a162,'userProfileId':_0x1a0bb1[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x32e075){if(_0x32e075&&_0x32e075['autoAssociation']===0x0){return db['UserProfileResource'][_0xde14('0x5d')]({'name':_0x4a9e85[_0xde14('0x3d')],'resourceId':_0x4a9e85['id'],'type':_0x32e075[_0xde14('0x3d')],'sectionId':_0x32e075['id']},{})[_0xde14('0x1f')](function(){return _0x25ba7e;});}else{return _0x25ba7e;}})[_0xde14('0x2a')](function(_0x120284){logger[_0xde14('0x26')](_0xde14('0x63'),_0x120284);throw _0x120284;});}return _0x25ba7e;});}})[_0xde14('0x1f')](respondWithResult(_0x2c972b,0xc9))[_0xde14('0x2a')](handleError(_0x2c972b,null));};exports[_0xde14('0x5d')]=function(_0x299b69,_0x1ff577,_0x42329a){var _0x6a641f;return db[_0xde14('0x3f')][_0xde14('0x5d')](_0x299b69[_0xde14('0x5e')],{'raw':!![]})[_0xde14('0x1f')](function(_0x1b5d70){_0x6a641f=_0x1b5d70;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})[_0xde14('0x1f')](function(_0x4809fa){var _0x1084fb=fs['readFileSync'](path[_0xde14('0x64')](config['root'],_0xde14('0x65')),_0xde14('0x66'));var _0x3aaba2=fs['readFileSync'](path['join'](config[_0xde14('0x67')],_0xde14('0x68')),_0xde14('0x66'));var _0x430bdb=ejs['render'](_0x1084fb,{'trunks':_0x4809fa||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x430bdb);if(_0x6a641f[_0xde14('0x6b')]){var _0x500344=ejs['render'](_0x3aaba2,{'trunks':_0x4809fa||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x500344);}})[_0xde14('0x1f')](function(){return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x5d'),{'module':'chan_sip.so'});})[_0xde14('0x1f')](function(){var _0x37f7c3=_0x299b69[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x37f7c3)throw new Error(_0xde14('0x60'));if(_0x37f7c3[_0xde14('0x61')]==='user'){var _0x579a6c=_0x6a641f[_0xde14('0x38')]({'plain':!![]});return db[_0xde14('0x6d')]['find']({'where':{'name':_0xde14('0x39'),'userProfileId':_0x37f7c3[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x367ede){if(_0x367ede&&_0x367ede[_0xde14('0x6e')]===0x0){return db[_0xde14('0x3a')][_0xde14('0x5d')]({'name':_0x579a6c['name'],'resourceId':_0x579a6c['id'],'type':_0x367ede['name'],'sectionId':_0x367ede['id']},{})['then'](function(){return _0x6a641f;});}else{return _0x6a641f;}})['catch'](function(_0x3dbda9){logger[_0xde14('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dbda9);throw _0x3dbda9;});}return _0x6a641f;})['then'](respondWithResult(_0x1ff577,0xc9))[_0xde14('0x2a')](handleError(_0x1ff577,null));};exports[_0xde14('0x37')]=function(_0xe2b9f5,_0x5805ec,_0x1aa75d){var _0x2b1e2e;return db['Trunk'][_0xde14('0x59')]({'where':{'id':_0xe2b9f5[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5805ec,null))[_0xde14('0x1f')](saveUpdates(_0xe2b9f5['body'],null))[_0xde14('0x1f')](function(_0x5a5b25){if(_0x5a5b25){_0x2b1e2e=_0x5a5b25;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});}})[_0xde14('0x1f')](function(_0x5f49d1){if(_0x5f49d1){var _0x283eb8=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],_0xde14('0x65')),'utf8');var _0x53433d=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),_0xde14('0x66'));var _0x1a12b5=ejs[_0xde14('0x70')](_0x283eb8,{'trunks':_0x5f49d1||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x1a12b5);var _0x2cc5b7=ejs[_0xde14('0x70')](_0x53433d,{'trunks':_0x5f49d1||[]});fs['writeFileSync'](_0xde14('0x71'),_0x2cc5b7);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x37'),{'module':_0xde14('0x72')});}return null;})[_0xde14('0x1f')](function(_0x1732d0){if(_0x1732d0){return _0x2b1e2e;}})[_0xde14('0x1f')](respondWithResult(_0x5805ec,null))['catch'](handleError(_0x5805ec,null));};exports[_0xde14('0x3b')]=function(_0x1bdeae,_0x5f4b92,_0x4543f1){var _0x4a0108;return db[_0xde14('0x3f')]['find']({'where':{'id':_0x1bdeae[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5f4b92,null))[_0xde14('0x1f')](removeEntity(_0x5f4b92,null))[_0xde14('0x1f')](function(){return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})['then'](function(_0x43a155){var _0x58cf06=fs[_0xde14('0x6f')](path['join'](config[_0xde14('0x67')],_0xde14('0x65')),_0xde14('0x66'));var _0x4a1114=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x495741=ejs['render'](_0x58cf06,{'trunks':_0x43a155});var _0x381d6d=ejs[_0xde14('0x70')](_0x4a1114,{'trunks':_0x43a155});fs['writeFileSync'](_0xde14('0x6a'),_0x495741);fs[_0xde14('0x69')](_0xde14('0x71'),_0x381d6d);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x3b'),{'module':'chan_sip.so'});})[_0xde14('0x2a')](handleError(_0x5f4b92,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index abd927d..5e8730b 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 _0xa48b=['./trunk.attributes','exports','define','tools_trunks','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3859fd,_0x1896f2){var _0x25609e=function(_0x35d324){while(--_0x35d324){_0x3859fd['push'](_0x3859fd['shift']());}};_0x25609e(++_0x1896f2);}(_0xa48b,0x1bc));var _0xba48=function(_0xcfe1e3,_0x1d2820){_0xcfe1e3=_0xcfe1e3-0x0;var _0x2f305e=_0xa48b[_0xcfe1e3];return _0x2f305e;};'use strict';var _=require('lodash');var util=require(_0xba48('0x0'));var logger=require(_0xba48('0x1'))('api');var moment=require(_0xba48('0x2'));var BPromise=require(_0xba48('0x3'));var rp=require(_0xba48('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba48('0x5'));var config=require(_0xba48('0x6'));var attributes=require(_0xba48('0x7'));module[_0xba48('0x8')]=function(_0xd64aba,_0x578f0a){return _0xd64aba[_0xba48('0x9')]('Trunk',attributes,{'tableName':_0xba48('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd68e=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./trunk.attributes','define','Trunk','tools_trunks','lodash'];(function(_0x12b8c2,_0x2bd9e9){var _0x3fc74b=function(_0x3688c5){while(--_0x3688c5){_0x12b8c2['push'](_0x12b8c2['shift']());}};_0x3fc74b(++_0x2bd9e9);}(_0xd68e,0x1ac));var _0xed68=function(_0x389213,_0x14a50d){_0x389213=_0x389213-0x0;var _0x4ad6ca=_0xd68e[_0x389213];return _0x4ad6ca;};'use strict';var _=require(_0xed68('0x0'));var util=require(_0xed68('0x1'));var logger=require(_0xed68('0x2'))(_0xed68('0x3'));var moment=require(_0xed68('0x4'));var BPromise=require(_0xed68('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed68('0x6'));var rimraf=require(_0xed68('0x7'));var config=require(_0xed68('0x8'));var attributes=require(_0xed68('0x9'));module['exports']=function(_0x556b76,_0x45b5d6){return _0x556b76[_0xed68('0xa')](_0xed68('0xb'),attributes,{'tableName':_0xed68('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 72d8533..986856f 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 _0x0b8d=['options','map','model','include','attributes','then','catch','ShowTrunk','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetTrunk','Trunk','findAll'];(function(_0x48afcf,_0x666a3e){var _0x389b9b=function(_0x41660d){while(--_0x41660d){_0x48afcf['push'](_0x48afcf['shift']());}};_0x389b9b(++_0x666a3e);}(_0x0b8d,0x153));var _0xd0b8=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x0b8d[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xd0b8('0x0'));var util=require(_0xd0b8('0x1'));var moment=require('moment');var BPromise=require(_0xd0b8('0x2'));var rs=require(_0xd0b8('0x3'));var fs=require('fs');var Redis=require(_0xd0b8('0x4'));var db=require(_0xd0b8('0x5'))['db'];var utils=require(_0xd0b8('0x6'));var logger=require(_0xd0b8('0x7'))(_0xd0b8('0x8'));var config=require(_0xd0b8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd0b8('0xa')][_0xd0b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47f2ed,_0x2f51a4,_0x47b5da){return new BPromise(function(_0xb66a1d,_0x48c68f){return client['request'](_0x47f2ed,_0x47b5da)['then'](function(_0x454061){logger[_0xd0b8('0xc')](_0xd0b8('0xd'),_0x2f51a4,_0xd0b8('0xe'));logger[_0xd0b8('0xf')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2f51a4,_0xd0b8('0xe'),JSON[_0xd0b8('0x10')](_0x454061));if(_0x454061[_0xd0b8('0x11')]){if(_0x454061['error'][_0xd0b8('0x12')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x2f51a4,_0x454061[_0xd0b8('0x11')][_0xd0b8('0x13')]);return _0x48c68f(_0x454061[_0xd0b8('0x11')]['message']);}logger[_0xd0b8('0x11')](_0xd0b8('0xd'),_0x2f51a4,_0x454061[_0xd0b8('0x11')][_0xd0b8('0x13')]);return _0xb66a1d(_0x454061[_0xd0b8('0x11')][_0xd0b8('0x13')]);}else{logger[_0xd0b8('0xc')](_0xd0b8('0xd'),_0x2f51a4,_0xd0b8('0xe'));_0xb66a1d(_0x454061[_0xd0b8('0x14')][_0xd0b8('0x13')]);}})['catch'](function(_0x3cd259){logger[_0xd0b8('0x11')](_0xd0b8('0xd'),_0x2f51a4,_0x3cd259);_0x48c68f(_0x3cd259);});});}exports[_0xd0b8('0x15')]=function(_0x1e0949){var _0x5258d3=this;return new Promise(function(_0x3dc0d1,_0x537f18){return db[_0xd0b8('0x16')][_0xd0b8('0x17')]({'raw':_0x1e0949[_0xd0b8('0x18')]?_0x1e0949['options']['raw']===undefined?!![]:![]:!![],'where':_0x1e0949[_0xd0b8('0x18')]?_0x1e0949['options']['where']||null:null,'attributes':_0x1e0949[_0xd0b8('0x18')]?_0x1e0949[_0xd0b8('0x18')]['attributes']||null:null,'limit':_0x1e0949[_0xd0b8('0x18')]?_0x1e0949[_0xd0b8('0x18')]['limit']||null:null,'include':_0x1e0949['options']?_0x1e0949[_0xd0b8('0x18')]['include']?_[_0xd0b8('0x19')](_0x1e0949[_0xd0b8('0x18')]['include'],function(_0xe11bc0){return{'model':db[_0xe11bc0[_0xd0b8('0x1a')]],'as':_0xe11bc0['as'],'attributes':_0xe11bc0['attributes'],'include':_0xe11bc0[_0xd0b8('0x1b')]?_[_0xd0b8('0x19')](_0xe11bc0[_0xd0b8('0x1b')],function(_0x49937b){return{'model':db[_0x49937b['model']],'as':_0x49937b['as'],'attributes':_0x49937b[_0xd0b8('0x1c')],'include':_0x49937b[_0xd0b8('0x1b')]?_['map'](_0x49937b['include'],function(_0x571fa5){return{'model':db[_0x571fa5[_0xd0b8('0x1a')]],'as':_0x571fa5['as'],'attributes':_0x571fa5[_0xd0b8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd0b8('0x1d')](function(_0x520c9b){logger['info'](_0xd0b8('0x15'),_0x1e0949);logger[_0xd0b8('0xf')](_0xd0b8('0x15'),_0x1e0949,JSON[_0xd0b8('0x10')](_0x520c9b));_0x3dc0d1(_0x520c9b);})[_0xd0b8('0x1e')](function(_0x2037cc){logger[_0xd0b8('0x11')]('GetTrunk',_0x2037cc[_0xd0b8('0x13')],_0x1e0949);_0x537f18(_0x5258d3[_0xd0b8('0x11')](0x1f4,_0x2037cc[_0xd0b8('0x13')]));});});};exports[_0xd0b8('0x1f')]=function(_0x59e392){var _0xa51605=this;return new Promise(function(_0x1051f8,_0xee2153){return db['Trunk']['find']({'raw':_0x59e392['options']?_0x59e392[_0xd0b8('0x18')][_0xd0b8('0x20')]===undefined?!![]:![]:!![],'where':_0x59e392[_0xd0b8('0x18')]?_0x59e392[_0xd0b8('0x18')]['where']||null:null,'attributes':_0x59e392[_0xd0b8('0x18')]?_0x59e392[_0xd0b8('0x18')][_0xd0b8('0x1c')]||null:null,'include':_0x59e392[_0xd0b8('0x18')]?_0x59e392[_0xd0b8('0x18')][_0xd0b8('0x1b')]?_[_0xd0b8('0x19')](_0x59e392[_0xd0b8('0x18')][_0xd0b8('0x1b')],function(_0x1c5b2c){return{'model':db[_0x1c5b2c[_0xd0b8('0x1a')]],'as':_0x1c5b2c['as'],'attributes':_0x1c5b2c[_0xd0b8('0x1c')],'include':_0x1c5b2c['include']?_[_0xd0b8('0x19')](_0x1c5b2c['include'],function(_0x252863){return{'model':db[_0x252863[_0xd0b8('0x1a')]],'as':_0x252863['as'],'attributes':_0x252863[_0xd0b8('0x1c')],'include':_0x252863[_0xd0b8('0x1b')]?_[_0xd0b8('0x19')](_0x252863[_0xd0b8('0x1b')],function(_0x5ba372){return{'model':db[_0x5ba372[_0xd0b8('0x1a')]],'as':_0x5ba372['as'],'attributes':_0x5ba372[_0xd0b8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd0b8('0x1d')](function(_0x560b2c){logger['info'](_0xd0b8('0x1f'),_0x59e392);logger[_0xd0b8('0xf')]('ShowTrunk',_0x59e392,JSON[_0xd0b8('0x10')](_0x560b2c));_0x1051f8(_0x560b2c);})[_0xd0b8('0x1e')](function(_0x38dc6e){logger[_0xd0b8('0x11')]('ShowTrunk',_0x38dc6e['message'],_0x59e392);_0xee2153(_0xa51605[_0xd0b8('0x11')](0x1f4,_0x38dc6e['message']));});});}; \ No newline at end of file +var _0x78c9=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetTrunk','ShowTrunk','Trunk','find','stringify','lodash'];(function(_0x439f2e,_0x4c40cd){var _0x131a49=function(_0x502f59){while(--_0x502f59){_0x439f2e['push'](_0x439f2e['shift']());}};_0x131a49(++_0x4c40cd);}(_0x78c9,0x6b));var _0x978c=function(_0x14916f,_0xb00e92){_0x14916f=_0x14916f-0x0;var _0x2182a6=_0x78c9[_0x14916f];return _0x2182a6;};'use strict';var _=require(_0x978c('0x0'));var util=require('util');var moment=require(_0x978c('0x1'));var BPromise=require(_0x978c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x978c('0x3'));var db=require(_0x978c('0x4'))['db'];var utils=require(_0x978c('0x5'));var logger=require(_0x978c('0x6'))('rpc');var config=require(_0x978c('0x7'));var jayson=require(_0x978c('0x8'));var client=jayson[_0x978c('0x9')][_0x978c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3701a2,_0x14a6dd,_0x116d67){return new BPromise(function(_0x84fb81,_0xc1c664){return client[_0x978c('0xb')](_0x3701a2,_0x116d67)[_0x978c('0xc')](function(_0x269ebc){logger[_0x978c('0xd')](_0x978c('0xe'),_0x14a6dd,'request\x20sent');logger[_0x978c('0xf')]('Trunk,\x20%s,\x20%s,\x20%s',_0x14a6dd,_0x978c('0x10'),JSON['stringify'](_0x269ebc));if(_0x269ebc[_0x978c('0x11')]){if(_0x269ebc[_0x978c('0x11')][_0x978c('0x12')]===0x1f4){logger[_0x978c('0x11')](_0x978c('0xe'),_0x14a6dd,_0x269ebc[_0x978c('0x11')][_0x978c('0x13')]);return _0xc1c664(_0x269ebc[_0x978c('0x11')][_0x978c('0x13')]);}logger[_0x978c('0x11')]('Trunk,\x20%s,\x20%s',_0x14a6dd,_0x269ebc[_0x978c('0x11')][_0x978c('0x13')]);return _0x84fb81(_0x269ebc['error'][_0x978c('0x13')]);}else{logger['info'](_0x978c('0xe'),_0x14a6dd,_0x978c('0x10'));_0x84fb81(_0x269ebc[_0x978c('0x14')][_0x978c('0x13')]);}})[_0x978c('0x15')](function(_0x1f6fa8){logger['error'](_0x978c('0xe'),_0x14a6dd,_0x1f6fa8);_0xc1c664(_0x1f6fa8);});});}exports['GetTrunk']=function(_0x2bf692){var _0xf54b11=this;return new Promise(function(_0x17e1a8,_0x28c952){return db['Trunk'][_0x978c('0x16')]({'raw':_0x2bf692[_0x978c('0x17')]?_0x2bf692['options'][_0x978c('0x18')]===undefined?!![]:![]:!![],'where':_0x2bf692[_0x978c('0x17')]?_0x2bf692[_0x978c('0x17')][_0x978c('0x19')]||null:null,'attributes':_0x2bf692[_0x978c('0x17')]?_0x2bf692[_0x978c('0x17')][_0x978c('0x1a')]||null:null,'limit':_0x2bf692[_0x978c('0x17')]?_0x2bf692[_0x978c('0x17')][_0x978c('0x1b')]||null:null,'include':_0x2bf692[_0x978c('0x17')]?_0x2bf692['options'][_0x978c('0x1c')]?_[_0x978c('0x1d')](_0x2bf692[_0x978c('0x17')][_0x978c('0x1c')],function(_0x1c0385){return{'model':db[_0x1c0385[_0x978c('0x1e')]],'as':_0x1c0385['as'],'attributes':_0x1c0385[_0x978c('0x1a')],'include':_0x1c0385[_0x978c('0x1c')]?_[_0x978c('0x1d')](_0x1c0385[_0x978c('0x1c')],function(_0x1b8ea4){return{'model':db[_0x1b8ea4['model']],'as':_0x1b8ea4['as'],'attributes':_0x1b8ea4['attributes'],'include':_0x1b8ea4[_0x978c('0x1c')]?_[_0x978c('0x1d')](_0x1b8ea4[_0x978c('0x1c')],function(_0x11fed8){return{'model':db[_0x11fed8[_0x978c('0x1e')]],'as':_0x11fed8['as'],'attributes':_0x11fed8['attributes']};}):[]};}):[]};}):[]:[]})[_0x978c('0xc')](function(_0x432eb5){logger[_0x978c('0xd')](_0x978c('0x1f'),_0x2bf692);logger[_0x978c('0xf')](_0x978c('0x1f'),_0x2bf692,JSON['stringify'](_0x432eb5));_0x17e1a8(_0x432eb5);})[_0x978c('0x15')](function(_0x163f46){logger['error'](_0x978c('0x1f'),_0x163f46['message'],_0x2bf692);_0x28c952(_0xf54b11[_0x978c('0x11')](0x1f4,_0x163f46[_0x978c('0x13')]));});});};exports[_0x978c('0x20')]=function(_0x33ab6b){var _0x1d9ace=this;return new Promise(function(_0x1cb37e,_0x1ca795){return db[_0x978c('0x21')][_0x978c('0x22')]({'raw':_0x33ab6b[_0x978c('0x17')]?_0x33ab6b[_0x978c('0x17')][_0x978c('0x18')]===undefined?!![]:![]:!![],'where':_0x33ab6b[_0x978c('0x17')]?_0x33ab6b['options'][_0x978c('0x19')]||null:null,'attributes':_0x33ab6b['options']?_0x33ab6b[_0x978c('0x17')][_0x978c('0x1a')]||null:null,'include':_0x33ab6b['options']?_0x33ab6b['options'][_0x978c('0x1c')]?_[_0x978c('0x1d')](_0x33ab6b[_0x978c('0x17')][_0x978c('0x1c')],function(_0x3a706a){return{'model':db[_0x3a706a[_0x978c('0x1e')]],'as':_0x3a706a['as'],'attributes':_0x3a706a[_0x978c('0x1a')],'include':_0x3a706a[_0x978c('0x1c')]?_[_0x978c('0x1d')](_0x3a706a[_0x978c('0x1c')],function(_0x3ba44e){return{'model':db[_0x3ba44e['model']],'as':_0x3ba44e['as'],'attributes':_0x3ba44e['attributes'],'include':_0x3ba44e[_0x978c('0x1c')]?_['map'](_0x3ba44e[_0x978c('0x1c')],function(_0x1befde){return{'model':db[_0x1befde[_0x978c('0x1e')]],'as':_0x1befde['as'],'attributes':_0x1befde[_0x978c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x978c('0xc')](function(_0x185d2d){logger['info']('ShowTrunk',_0x33ab6b);logger[_0x978c('0xf')](_0x978c('0x20'),_0x33ab6b,JSON[_0x978c('0x23')](_0x185d2d));_0x1cb37e(_0x185d2d);})[_0x978c('0x15')](function(_0x2752ea){logger[_0x978c('0x11')](_0x978c('0x20'),_0x2752ea[_0x978c('0x13')],_0x33ab6b);_0x1ca795(_0x1d9ace[_0x978c('0x11')](0x1f4,_0x2752ea[_0x978c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 37fc31c..2fbfa9c 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 _0xac85=['Router','./user-setting.controller','put','isAuthenticated','update','express'];(function(_0x104e21,_0x2ea86f){var _0x605b37=function(_0x580fce){while(--_0x580fce){_0x104e21['push'](_0x104e21['shift']());}};_0x605b37(++_0x2ea86f);}(_0xac85,0x6b));var _0x5ac8=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xac85[_0x397e5f];return _0x5302b8;};'use strict';var express=require(_0x5ac8('0x0'));var router=express[_0x5ac8('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5ac8('0x2'));router[_0x5ac8('0x3')]('/:id',auth[_0x5ac8('0x4')](),controller[_0x5ac8('0x5')]);module['exports']=router; \ No newline at end of file +var _0xf05d=['express','Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update','exports'];(function(_0x5a9a81,_0x44c875){var _0x1c8fce=function(_0x17c8e4){while(--_0x17c8e4){_0x5a9a81['push'](_0x5a9a81['shift']());}};_0x1c8fce(++_0x44c875);}(_0xf05d,0x120));var _0xdf05=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf05d[_0x1facfa];return _0x9ec701;};'use strict';var express=require(_0xdf05('0x0'));var router=express[_0xdf05('0x1')]();var auth=require(_0xdf05('0x2'));var controller=require(_0xdf05('0x3'));router[_0xdf05('0x4')](_0xdf05('0x5'),auth[_0xdf05('0x6')](),controller[_0xdf05('0x7')]);module[_0xdf05('0x8')]=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 268ab11..396676e 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 _0x3465=['DATE','UserId','error','info','debug','ENUM','TEXT'];(function(_0x4f22c1,_0xe02c2d){var _0x466e48=function(_0x2a3905){while(--_0x2a3905){_0x4f22c1['push'](_0x4f22c1['shift']());}};_0x466e48(++_0xe02c2d);}(_0x3465,0x18a));var _0x5346=function(_0x3710a4,_0x411b57){_0x3710a4=_0x3710a4-0x0;var _0x470675=_0x3465[_0x3710a4];return _0x470675;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x5346('0x0'),'warning',_0x5346('0x1'),_0x5346('0x2')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x5346('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x5346('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x5346('0x4')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x5346('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x5346('0x6')}}; \ No newline at end of file +var _0x6937=['error','warning','info','debug','ENUM','BOOLEAN','INTEGER','UserId','sequelize'];(function(_0x400d28,_0x368388){var _0x44808a=function(_0x52b747){while(--_0x52b747){_0x400d28['push'](_0x400d28['shift']());}};_0x44808a(++_0x368388);}(_0x6937,0x155));var _0x7693=function(_0x27a3cb,_0x4af597){_0x27a3cb=_0x27a3cb-0x0;var _0x54ff38=_0x6937[_0x27a3cb];return _0x54ff38;};'use strict';var Sequelize=require(_0x7693('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x7693('0x1'),_0x7693('0x2'),_0x7693('0x3'),_0x7693('0x4')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x7693('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x7693('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x7693('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x7693('0x7')],'unique':_0x7693('0x8')}}; \ 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 33b0d38..506c9e3 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 _0x97d5=['./user-setting.socket','register','defaults','localhost','status','then','error','name','send','update','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis'];(function(_0x2dbed7,_0x2962d5){var _0x326efc=function(_0x1713b3){while(--_0x1713b3){_0x2dbed7['push'](_0x2dbed7['shift']());}};_0x326efc(++_0x2962d5);}(_0x97d5,0x199));var _0x597d=function(_0x5132a0,_0x525f9c){_0x5132a0=_0x5132a0-0x0;var _0x2b6de2=_0x97d5[_0x5132a0];return _0x2b6de2;};'use strict';var _=require(_0x597d('0x0'));var Redis=require(_0x597d('0x1'));var logger=require(_0x597d('0x2'))(_0x597d('0x3'));var config=require(_0x597d('0x4'));var db=require(_0x597d('0x5'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x597d('0x6')]));require(_0x597d('0x7'))[_0x597d('0x8')](socket);config['redis']=_[_0x597d('0x9')](config[_0x597d('0x6')],{'host':_0x597d('0xa'),'port':0x18eb});function respondWithResult(_0x316e5a,_0xfae6cf){_0xfae6cf=_0xfae6cf||0xc8;return function(_0xe0072a){if(_0xe0072a){return _0x316e5a[_0x597d('0xb')](_0xfae6cf)['json'](_0xe0072a);}};}function saveUpdates(_0x3051e7){return function(_0x4b8c86){if(_0x4b8c86){return _0x4b8c86['update'](_0x3051e7)[_0x597d('0xc')](function(_0x50247e){return _0x50247e;});}return null;};}function handleEntityNotFound(_0x1bdafc){return function(_0x2bbcb0){if(!_0x2bbcb0){_0x1bdafc['sendStatus'](0x194);}return _0x2bbcb0;};}function handleError(_0x543df3,_0x18aa3a){_0x18aa3a=_0x18aa3a||0x1f4;return function(_0x2050ed){logger[_0x597d('0xd')](_0x2050ed['stack']);if(_0x2050ed[_0x597d('0xe')]){delete _0x2050ed[_0x597d('0xe')];}_0x543df3[_0x597d('0xb')](_0x18aa3a)[_0x597d('0xf')](_0x2050ed);};}exports[_0x597d('0x10')]=function(_0x2b38d1,_0x1ac304){if(_0x2b38d1[_0x597d('0x11')][_0x597d('0x12')]!==_0x597d('0x13'))throw new Error(_0x597d('0x14'));if(isNaN(Number(_0x2b38d1[_0x597d('0x15')]['id'])))throw new Error(_0x597d('0x16'));return db[_0x597d('0x17')]['find']({'where':{'id':_0x2b38d1[_0x597d('0x15')]['id']}})['then'](handleEntityNotFound(_0x1ac304,null))[_0x597d('0xc')](saveUpdates(_0x2b38d1[_0x597d('0x18')],null))['then'](respondWithResult(_0x1ac304,null))[_0x597d('0x19')](handleError(_0x1ac304,null));}; \ No newline at end of file +var _0xe43c=['register','defaults','json','update','then','sendStatus','error','name','status','send','role','admin','Unauthorized','params','find','body','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis'];(function(_0x5ad16c,_0x31abe4){var _0x5c1dfc=function(_0x1b814f){while(--_0x1b814f){_0x5ad16c['push'](_0x5ad16c['shift']());}};_0x5c1dfc(++_0x31abe4);}(_0xe43c,0x180));var _0xce43=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xe43c[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xce43('0x0'));var Redis=require(_0xce43('0x1'));var logger=require(_0xce43('0x2'))(_0xce43('0x3'));var config=require(_0xce43('0x4'));var db=require(_0xce43('0x5'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xce43('0x6')]));require('./user-setting.socket')[_0xce43('0x7')](socket);config[_0xce43('0x6')]=_[_0xce43('0x8')](config[_0xce43('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x20bd99,_0x5ddbba){_0x5ddbba=_0x5ddbba||0xc8;return function(_0x1cbd0b){if(_0x1cbd0b){return _0x20bd99['status'](_0x5ddbba)[_0xce43('0x9')](_0x1cbd0b);}};}function saveUpdates(_0x48b578){return function(_0x508287){if(_0x508287){return _0x508287[_0xce43('0xa')](_0x48b578)[_0xce43('0xb')](function(_0x4a62bd){return _0x4a62bd;});}return null;};}function handleEntityNotFound(_0x5ec3f9){return function(_0x4d716c){if(!_0x4d716c){_0x5ec3f9[_0xce43('0xc')](0x194);}return _0x4d716c;};}function handleError(_0x4fb9d2,_0x2f1926){_0x2f1926=_0x2f1926||0x1f4;return function(_0x5eaadb){logger[_0xce43('0xd')](_0x5eaadb['stack']);if(_0x5eaadb[_0xce43('0xe')]){delete _0x5eaadb[_0xce43('0xe')];}_0x4fb9d2[_0xce43('0xf')](_0x2f1926)[_0xce43('0x10')](_0x5eaadb);};}exports[_0xce43('0xa')]=function(_0x4250d0,_0x1007a0){if(_0x4250d0['user'][_0xce43('0x11')]!==_0xce43('0x12'))throw new Error(_0xce43('0x13'));if(isNaN(Number(_0x4250d0[_0xce43('0x14')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db['UserSetting'][_0xce43('0x15')]({'where':{'id':_0x4250d0[_0xce43('0x14')]['id']}})[_0xce43('0xb')](handleEntityNotFound(_0x1007a0,null))[_0xce43('0xb')](saveUpdates(_0x4250d0[_0xce43('0x16')],null))[_0xce43('0xb')](respondWithResult(_0x1007a0,null))['catch'](handleError(_0x1007a0,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 1cc0264..508d5f0 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 _0x68ff=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting'];(function(_0x2a0183,_0x3fc93c){var _0x158c3a=function(_0x57a903){while(--_0x57a903){_0x2a0183['push'](_0x2a0183['shift']());}};_0x158c3a(++_0x3fc93c);}(_0x68ff,0x89));var _0xf68f=function(_0x5b8155,_0x28c049){_0x5b8155=_0x5b8155-0x0;var _0x3c6478=_0x68ff[_0x5b8155];return _0x3c6478;};'use strict';var EventEmitter=require(_0xf68f('0x0'));var UserSetting=require(_0xf68f('0x1'))['db'][_0xf68f('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xf68f('0x3')](0x0);var events={'afterCreate':_0xf68f('0x4'),'afterUpdate':'update','afterDestroy':_0xf68f('0x5')};function emitEvent(_0x1f81d8){return function(_0xa8a769,_0x1d4c82,_0x25e887){UserSettingEvents[_0xf68f('0x6')](_0x1f81d8+':'+_0xa8a769['id'],_0xa8a769);UserSettingEvents['emit'](_0x1f81d8,_0xa8a769);_0x25e887(null);};}for(var e in events){if(events[_0xf68f('0x7')](e)){var event=events[e];UserSetting[_0xf68f('0x8')](e,emitEvent(event));}}module[_0xf68f('0x9')]=UserSettingEvents; \ No newline at end of file +var _0xb91b=['emit','hasOwnProperty','exports','UserSetting','setMaxListeners','save','update','remove'];(function(_0x53d540,_0x359b60){var _0x284ba8=function(_0x13788e){while(--_0x13788e){_0x53d540['push'](_0x53d540['shift']());}};_0x284ba8(++_0x359b60);}(_0xb91b,0xd3));var _0xbb91=function(_0x3324aa,_0x2ffffa){_0x3324aa=_0x3324aa-0x0;var _0x89c9ed=_0xb91b[_0x3324aa];return _0x89c9ed;};'use strict';var EventEmitter=require('events');var UserSetting=require('../../mysqldb')['db'][_0xbb91('0x0')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xbb91('0x1')](0x0);var events={'afterCreate':_0xbb91('0x2'),'afterUpdate':_0xbb91('0x3'),'afterDestroy':_0xbb91('0x4')};function emitEvent(_0x3ca662){return function(_0x431607,_0x38fc20,_0x2f31b3){UserSettingEvents[_0xbb91('0x5')](_0x3ca662+':'+_0x431607['id'],_0x431607);UserSettingEvents[_0xbb91('0x5')](_0x3ca662,_0x431607);_0x2f31b3(null);};}for(var e in events){if(events[_0xbb91('0x6')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0xbb91('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 ac10f75..39a9781 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 _0xf17f=['./user-setting.attributes','exports','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x57012c,_0x457dd9){var _0x3bb06d=function(_0x4d2e72){while(--_0x4d2e72){_0x57012c['push'](_0x57012c['shift']());}};_0x3bb06d(++_0x457dd9);}(_0xf17f,0x113));var _0xff17=function(_0x53eeac,_0x1babff){_0x53eeac=_0x53eeac-0x0;var _0x41dddf=_0xf17f[_0x53eeac];return _0x41dddf;};'use strict';var attributes=require(_0xff17('0x0'));module[_0xff17('0x1')]=function(_0x43841b){return _0x43841b['define'](_0xff17('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5bcb25){if(!_0x5bcb25[_0xff17('0x3')])_0x5bcb25[_0xff17('0x4')]=null;else if(_0x5bcb25[_0xff17('0x4')]===null)_0x5bcb25[_0xff17('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x38d0=['define','user_settings','clientSideLoggingEnabledSince','exports'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x38d0,0x123));var _0x038d=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x38d0[_0xaa1b3e];return _0x454d7d;};'use strict';var attributes=require('./user-setting.attributes');module[_0x038d('0x0')]=function(_0x327d9d){return _0x327d9d[_0x038d('0x1')]('UserSetting',attributes,{'tableName':_0x038d('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x27db0a){if(!_0x27db0a['clientSideLoggingEnabled'])_0x27db0a['clientSideLoggingEnabledSince']=null;else if(_0x27db0a[_0x038d('0x3')]===null)_0x27db0a['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 10cf48b..975cc09 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 _0xd4d2=['remove','update','emit','user-setting:update','user-setting:update:user-','UserId','register','length','./user-setting.events','save'];(function(_0x265ada,_0xeaa8c8){var _0x3ccd4c=function(_0x492945){while(--_0x492945){_0x265ada['push'](_0x265ada['shift']());}};_0x3ccd4c(++_0xeaa8c8);}(_0xd4d2,0xee));var _0x2d4d=function(_0x2ee532,_0x538d63){_0x2ee532=_0x2ee532-0x0;var _0x50a76b=_0xd4d2[_0x2ee532];return _0x50a76b;};'use strict';var UserSettingEvents=require(_0x2d4d('0x0'));var events=[_0x2d4d('0x1'),_0x2d4d('0x2'),_0x2d4d('0x3')];function createListener(_0x351441,_0x3c80b0){return function(_0x375007){_0x3c80b0[_0x2d4d('0x4')](_0x351441,_0x375007);if(_0x351441===_0x2d4d('0x5')){_0x3c80b0['emit'](_0x2d4d('0x6')+_0x375007[_0x2d4d('0x7')],_0x375007);}};}exports[_0x2d4d('0x8')]=function(_0x21cfbe){for(var _0x46f0fa=0x0,_0x44f249=events[_0x2d4d('0x9')];_0x46f0fa<_0x44f249;_0x46f0fa++){var _0x355ea2=events[_0x46f0fa];var _0x23d314=createListener('user-setting:'+_0x355ea2,_0x21cfbe);UserSettingEvents['on'](_0x355ea2,_0x23d314);}}; \ No newline at end of file +var _0x12a5=['update','emit','user-setting:update','register','length','user-setting:','./user-setting.events','save','remove'];(function(_0x458a20,_0x206f85){var _0x3cce8a=function(_0x41b460){while(--_0x41b460){_0x458a20['push'](_0x458a20['shift']());}};_0x3cce8a(++_0x206f85);}(_0x12a5,0x126));var _0x512a=function(_0x36e830,_0x20cfd0){_0x36e830=_0x36e830-0x0;var _0xcc6018=_0x12a5[_0x36e830];return _0xcc6018;};'use strict';var UserSettingEvents=require(_0x512a('0x0'));var events=[_0x512a('0x1'),_0x512a('0x2'),_0x512a('0x3')];function createListener(_0x5797fb,_0x307581){return function(_0x1ac6d0){_0x307581[_0x512a('0x4')](_0x5797fb,_0x1ac6d0);if(_0x5797fb===_0x512a('0x5')){_0x307581[_0x512a('0x4')]('user-setting:update:user-'+_0x1ac6d0['UserId'],_0x1ac6d0);}};}exports[_0x512a('0x6')]=function(_0x379ab0){for(var _0x4366ba=0x0,_0xac8b15=events[_0x512a('0x7')];_0x4366ba<_0xac8b15;_0x4366ba++){var _0x2a7c90=events[_0x4366ba];var _0x54ee17=createListener(_0x512a('0x8')+_0x2a7c90,_0x379ab0);UserSettingEvents['on'](_0x2a7c90,_0x54ee17);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 41c27e7..6a78041 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 _0xdb3d=['/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','express','Router','fs-extra','../../components/auth/service','get','index','/describe','isAuthenticated','describe','/whoami','/presence','getPresence','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','file','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','removeQueues','delete','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeWhatsappAccounts','removeApiKey'];(function(_0x4eb64a,_0x457978){var _0x34c50e=function(_0x578b8f){while(--_0x578b8f){_0x4eb64a['push'](_0x4eb64a['shift']());}};_0x34c50e(++_0x457978);}(_0xdb3d,0x7b));var _0xddb3=function(_0x2effa2,_0x2b6ec1){_0x2effa2=_0x2effa2-0x0;var _0x587fe5=_0xdb3d[_0x2effa2];return _0x587fe5;};'use strict';var multer=require(_0xddb3('0x0'));var util=require(_0xddb3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xddb3('0x2'));var router=express[_0xddb3('0x3')]();var fs_extra=require(_0xddb3('0x4'));var auth=require(_0xddb3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./user.controller');router[_0xddb3('0x6')]('/',auth['isAuthenticated'](),controller[_0xddb3('0x7')]);router[_0xddb3('0x6')](_0xddb3('0x8'),auth[_0xddb3('0x9')](),controller[_0xddb3('0xa')]);router['get'](_0xddb3('0xb'),auth[_0xddb3('0x9')](),controller['whoami']);router[_0xddb3('0x6')](_0xddb3('0xc'),auth[_0xddb3('0x9')](),controller[_0xddb3('0xd')]);router[_0xddb3('0x6')](_0xddb3('0xe'),auth[_0xddb3('0x9')](),controller[_0xddb3('0xf')]);router[_0xddb3('0x6')]('/:id/avatar',controller[_0xddb3('0x10')]);router[_0xddb3('0x6')](_0xddb3('0x11'),auth['isAuthenticated'](),controller[_0xddb3('0x12')]);router['get'](_0xddb3('0x13'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x14')]);router[_0xddb3('0x6')](_0xddb3('0x15'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x16')]);router[_0xddb3('0x6')](_0xddb3('0x17'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x18')]);router[_0xddb3('0x6')]('/:id/groups',auth['isAuthenticated'](),controller['getGroups']);router[_0xddb3('0x6')]('/:id/recordings',auth[_0xddb3('0x9')](),controller[_0xddb3('0x19')]);router[_0xddb3('0x6')]('/:id/screen_recordings',auth[_0xddb3('0x9')](),controller[_0xddb3('0x1a')]);router[_0xddb3('0x6')](_0xddb3('0x1b'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x1c')]);router[_0xddb3('0x6')](_0xddb3('0x1d'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x1e')]);router[_0xddb3('0x6')](_0xddb3('0x1f'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x20')]);router[_0xddb3('0x6')]('/:id/sms/interactions',auth[_0xddb3('0x9')](),controller[_0xddb3('0x21')]);router[_0xddb3('0x6')](_0xddb3('0x22'),auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0xddb3('0x6')](_0xddb3('0x23'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x24')]);router[_0xddb3('0x6')](_0xddb3('0x25'),auth['isAuthenticated'](),controller['getTeams']);router[_0xddb3('0x6')](_0xddb3('0x26'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x27')]);router[_0xddb3('0x6')](_0xddb3('0x28'),auth['isAuthenticated'](),controller['getAgents']);router[_0xddb3('0x6')](_0xddb3('0x29'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x2a')]);router['get'](_0xddb3('0x2b'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x2c')]);router[_0xddb3('0x6')](_0xddb3('0x2d'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x2e')]);router[_0xddb3('0x6')](_0xddb3('0x2f'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x30')]);router['get'](_0xddb3('0x31'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x32')]);router[_0xddb3('0x6')](_0xddb3('0x33'),auth['isAuthenticated'](),controller[_0xddb3('0x34')]);router['get'](_0xddb3('0x35'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x36')]);router['get'](_0xddb3('0x37'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x38')]);router['get'](_0xddb3('0x39'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x3a')]);router[_0xddb3('0x3b')]('/:id/contacts',auth[_0xddb3('0x9')](),controller[_0xddb3('0x3c')]);router['post']('/',auth[_0xddb3('0x9')](),controller['create']);router[_0xddb3('0x3b')](_0xddb3('0x3d'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x3e')]);router[_0xddb3('0x3b')](_0xddb3('0x15'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x3f')]);var upload=multer({'storage':multer[_0xddb3('0x40')]({'destination':function(_0x741232,_0x23d37e,_0x32a9e8){_0x32a9e8(null,path[_0xddb3('0x41')](config[_0xddb3('0x42')],_0xddb3('0x43')));},'filename':function(_0x4905fe,_0x4ec2ed,_0x2d10ed){_0x2d10ed(null,util[_0xddb3('0x44')](_0xddb3('0x45'),Date[_0xddb3('0x46')](),_0x4ec2ed[_0xddb3('0x47')]));}})});router['post'](_0xddb3('0x48'),upload['single'](_0xddb3('0x49')),controller['addAvatar']);router[_0xddb3('0x3b')](_0xddb3('0x4a'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x4b')]);router[_0xddb3('0x3b')](_0xddb3('0x4c'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x4d')]);router[_0xddb3('0x3b')](_0xddb3('0x4e'),auth[_0xddb3('0x9')](),controller['pause']);router['post'](_0xddb3('0x4f'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x50')]);router[_0xddb3('0x3b')](_0xddb3('0x25'),auth[_0xddb3('0x9')](),controller['addTeams']);router['post'](_0xddb3('0x51'),auth['isAuthenticated'](),controller[_0xddb3('0x52')]);router[_0xddb3('0x3b')](_0xddb3('0x53'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x54')]);router[_0xddb3('0x3b')](_0xddb3('0x55'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x56')]);router[_0xddb3('0x3b')](_0xddb3('0x57'),auth['isAuthenticated'](),controller[_0xddb3('0x58')]);router[_0xddb3('0x3b')](_0xddb3('0x59'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x5a')]);router['post'](_0xddb3('0x5b'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x5c')]);router['post'](_0xddb3('0x2b'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x5d')]);router[_0xddb3('0x3b')](_0xddb3('0x2d'),auth['isAuthenticated'](),controller[_0xddb3('0x5e')]);router[_0xddb3('0x3b')](_0xddb3('0x2f'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x5f')]);router[_0xddb3('0x3b')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xddb3('0x60')]);router[_0xddb3('0x3b')](_0xddb3('0x33'),auth['isAuthenticated'](),controller[_0xddb3('0x61')]);router['post'](_0xddb3('0x35'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x62')]);router[_0xddb3('0x3b')](_0xddb3('0x39'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x63')]);router[_0xddb3('0x64')]('/:id',auth[_0xddb3('0x9')](),controller[_0xddb3('0x65')]);router[_0xddb3('0x64')](_0xddb3('0x66'),auth['isAuthenticated'](),controller[_0xddb3('0x67')]);router['delete'](_0xddb3('0x15'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x68')]);router[_0xddb3('0x69')](_0xddb3('0x25'),auth[_0xddb3('0x9')](),controller['removeTeams']);router[_0xddb3('0x69')](_0xddb3('0xe'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x6a')]);router[_0xddb3('0x69')](_0xddb3('0x51'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x6b')]);router[_0xddb3('0x69')](_0xddb3('0x53'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x6c')]);router[_0xddb3('0x69')](_0xddb3('0x55'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x6d')]);router[_0xddb3('0x69')]('/:id/sms_interactions',auth[_0xddb3('0x9')](),controller[_0xddb3('0x6e')]);router[_0xddb3('0x69')](_0xddb3('0x59'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x6f')]);router['delete'](_0xddb3('0x5b'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x70')]);router[_0xddb3('0x69')](_0xddb3('0x2b'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x71')]);router['delete'](_0xddb3('0x2d'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x72')]);router[_0xddb3('0x69')](_0xddb3('0x2f'),auth[_0xddb3('0x9')](),controller['removeOpenchannelAccounts']);router[_0xddb3('0x69')]('/:id/sms_accounts',auth[_0xddb3('0x9')](),controller['removeSmsAccounts']);router[_0xddb3('0x69')](_0xddb3('0x33'),auth[_0xddb3('0x9')](),controller['removeChatWebsites']);router['delete'](_0xddb3('0x35'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x73')]);router[_0xddb3('0x69')](_0xddb3('0x39'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x74')]);router[_0xddb3('0x3b')](_0xddb3('0x75'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x76')]);module[_0xddb3('0x77')]=router; \ No newline at end of file +var _0x59b9=['/presence','getPresence','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','originalname','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/logout','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/api_key','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','/whoami','whoami'];(function(_0x5407ad,_0x40293d){var _0x5328de=function(_0x1c0fb3){while(--_0x1c0fb3){_0x5407ad['push'](_0x5407ad['shift']());}};_0x5328de(++_0x40293d);}(_0x59b9,0x15b));var _0x959b=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x59b9[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0x959b('0x0'));var util=require('util');var path=require(_0x959b('0x1'));var timeout=require(_0x959b('0x2'));var express=require(_0x959b('0x3'));var router=express[_0x959b('0x4')]();var fs_extra=require(_0x959b('0x5'));var auth=require(_0x959b('0x6'));var interaction=require(_0x959b('0x7'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0x959b('0x8')]('/',auth[_0x959b('0x9')](),controller['index']);router['get'](_0x959b('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x959b('0x8')](_0x959b('0xb'),auth[_0x959b('0x9')](),controller[_0x959b('0xc')]);router[_0x959b('0x8')](_0x959b('0xd'),auth[_0x959b('0x9')](),controller[_0x959b('0xe')]);router['get'](_0x959b('0xf'),auth[_0x959b('0x9')](),controller[_0x959b('0x10')]);router['get']('/:id/avatar',controller[_0x959b('0x11')]);router[_0x959b('0x8')](_0x959b('0x12'),auth[_0x959b('0x9')](),controller[_0x959b('0x13')]);router[_0x959b('0x8')](_0x959b('0x14'),auth[_0x959b('0x9')](),controller[_0x959b('0x15')]);router[_0x959b('0x8')](_0x959b('0x16'),auth['isAuthenticated'](),controller[_0x959b('0x17')]);router[_0x959b('0x8')](_0x959b('0x18'),auth[_0x959b('0x9')](),controller[_0x959b('0x19')]);router['get'](_0x959b('0x1a'),auth['isAuthenticated'](),controller['getGroups']);router[_0x959b('0x8')](_0x959b('0x1b'),auth['isAuthenticated'](),controller[_0x959b('0x1c')]);router['get'](_0x959b('0x1d'),auth[_0x959b('0x9')](),controller[_0x959b('0x1e')]);router['get'](_0x959b('0x1f'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x959b('0x8')](_0x959b('0x20'),auth[_0x959b('0x9')](),controller[_0x959b('0x21')]);router[_0x959b('0x8')](_0x959b('0x22'),auth[_0x959b('0x9')](),controller[_0x959b('0x23')]);router[_0x959b('0x8')](_0x959b('0x24'),auth[_0x959b('0x9')](),controller[_0x959b('0x25')]);router[_0x959b('0x8')](_0x959b('0x26'),auth[_0x959b('0x9')](),controller['getFaxInteractions']);router[_0x959b('0x8')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0x959b('0x27')]);router[_0x959b('0x8')](_0x959b('0x28'),auth[_0x959b('0x9')](),controller[_0x959b('0x29')]);router['get'](_0x959b('0x2a'),auth[_0x959b('0x9')](),controller[_0x959b('0x2b')]);router['get'](_0x959b('0x2c'),auth[_0x959b('0x9')](),controller[_0x959b('0x2d')]);router['get']('/:id/prefixes',auth[_0x959b('0x9')](),controller['getVoicePrefixes']);router[_0x959b('0x8')](_0x959b('0x2e'),auth[_0x959b('0x9')](),controller['getFaxAccounts']);router['get'](_0x959b('0x2f'),auth['isAuthenticated'](),controller[_0x959b('0x30')]);router[_0x959b('0x8')](_0x959b('0x31'),auth[_0x959b('0x9')](),controller[_0x959b('0x32')]);router['get'](_0x959b('0x33'),auth[_0x959b('0x9')](),controller[_0x959b('0x34')]);router[_0x959b('0x8')](_0x959b('0x35'),auth['isAuthenticated'](),controller[_0x959b('0x36')]);router[_0x959b('0x8')](_0x959b('0x37'),auth[_0x959b('0x9')](),controller['getWhatsappAccounts']);router[_0x959b('0x8')](_0x959b('0x38'),auth['isAuthenticated'](),controller[_0x959b('0x39')]);router['get']('/:id/api_key',auth['isAuthenticated'](),controller[_0x959b('0x3a')]);router[_0x959b('0x3b')](_0x959b('0x14'),auth[_0x959b('0x9')](),controller[_0x959b('0x3c')]);router[_0x959b('0x3b')]('/',auth[_0x959b('0x9')](),controller[_0x959b('0x3d')]);router[_0x959b('0x3b')](_0x959b('0x3e'),auth[_0x959b('0x9')](),controller[_0x959b('0x3f')]);router[_0x959b('0x3b')](_0x959b('0x16'),auth[_0x959b('0x9')](),controller[_0x959b('0x40')]);var upload=multer({'storage':multer[_0x959b('0x41')]({'destination':function(_0x19bc6e,_0x20ddcb,_0x47f7d6){_0x47f7d6(null,path[_0x959b('0x42')](config[_0x959b('0x43')],_0x959b('0x44')));},'filename':function(_0xd69ff,_0x45115e,_0x5c1107){_0x5c1107(null,util[_0x959b('0x45')]('%s-%s',Date['now'](),_0x45115e[_0x959b('0x46')]));}})});router['post'](_0x959b('0x47'),upload[_0x959b('0x48')](_0x959b('0x49')),controller[_0x959b('0x4a')]);router[_0x959b('0x3b')](_0x959b('0x4b'),auth[_0x959b('0x9')](),controller[_0x959b('0x4c')]);router['post'](_0x959b('0x4d'),auth[_0x959b('0x9')](),controller['logout']);router[_0x959b('0x3b')]('/:id/pause',auth[_0x959b('0x9')](),controller['pause']);router[_0x959b('0x3b')]('/:id/unpause',auth[_0x959b('0x9')](),controller[_0x959b('0x4e')]);router[_0x959b('0x3b')](_0x959b('0x28'),auth[_0x959b('0x9')](),controller['addTeams']);router['post'](_0x959b('0x4f'),auth[_0x959b('0x9')](),controller[_0x959b('0x50')]);router[_0x959b('0x3b')](_0x959b('0x51'),auth[_0x959b('0x9')](),controller[_0x959b('0x52')]);router[_0x959b('0x3b')]('/:id/fax_interactions',auth[_0x959b('0x9')](),controller[_0x959b('0x53')]);router['post'](_0x959b('0x54'),auth[_0x959b('0x9')](),controller[_0x959b('0x55')]);router[_0x959b('0x3b')](_0x959b('0x56'),auth[_0x959b('0x9')](),controller[_0x959b('0x57')]);router[_0x959b('0x3b')](_0x959b('0x58'),auth[_0x959b('0x9')](),controller['addWhatsappInteractions']);router[_0x959b('0x3b')](_0x959b('0x2e'),auth[_0x959b('0x9')](),controller[_0x959b('0x59')]);router[_0x959b('0x3b')](_0x959b('0x2f'),auth['isAuthenticated'](),controller[_0x959b('0x5a')]);router[_0x959b('0x3b')]('/:id/openchannel_accounts',auth[_0x959b('0x9')](),controller[_0x959b('0x5b')]);router[_0x959b('0x3b')](_0x959b('0x33'),auth[_0x959b('0x9')](),controller[_0x959b('0x5c')]);router[_0x959b('0x3b')](_0x959b('0x35'),auth['isAuthenticated'](),controller[_0x959b('0x5d')]);router[_0x959b('0x3b')](_0x959b('0x37'),auth[_0x959b('0x9')](),controller[_0x959b('0x5e')]);router[_0x959b('0x3b')](_0x959b('0x5f'),auth[_0x959b('0x9')](),controller[_0x959b('0x60')]);router[_0x959b('0x61')](_0x959b('0xf'),auth[_0x959b('0x9')](),controller[_0x959b('0x62')]);router[_0x959b('0x61')](_0x959b('0x63'),auth['isAuthenticated'](),controller[_0x959b('0x64')]);router[_0x959b('0x65')](_0x959b('0x16'),auth[_0x959b('0x9')](),controller[_0x959b('0x66')]);router[_0x959b('0x65')](_0x959b('0x28'),auth[_0x959b('0x9')](),controller[_0x959b('0x67')]);router[_0x959b('0x65')](_0x959b('0xf'),auth[_0x959b('0x9')](),controller['destroy']);router[_0x959b('0x65')](_0x959b('0x4f'),auth[_0x959b('0x9')](),controller[_0x959b('0x68')]);router[_0x959b('0x65')](_0x959b('0x51'),auth[_0x959b('0x9')](),controller[_0x959b('0x69')]);router[_0x959b('0x65')](_0x959b('0x6a'),auth[_0x959b('0x9')](),controller[_0x959b('0x6b')]);router[_0x959b('0x65')](_0x959b('0x54'),auth['isAuthenticated'](),controller[_0x959b('0x6c')]);router[_0x959b('0x65')](_0x959b('0x56'),auth[_0x959b('0x9')](),controller['removeOpenchannelInteractions']);router[_0x959b('0x65')](_0x959b('0x58'),auth[_0x959b('0x9')](),controller[_0x959b('0x6d')]);router[_0x959b('0x65')]('/:id/fax_accounts',auth[_0x959b('0x9')](),controller[_0x959b('0x6e')]);router[_0x959b('0x65')](_0x959b('0x2f'),auth[_0x959b('0x9')](),controller[_0x959b('0x6f')]);router[_0x959b('0x65')](_0x959b('0x31'),auth[_0x959b('0x9')](),controller[_0x959b('0x70')]);router[_0x959b('0x65')]('/:id/sms_accounts',auth[_0x959b('0x9')](),controller[_0x959b('0x71')]);router[_0x959b('0x65')](_0x959b('0x35'),auth[_0x959b('0x9')](),controller[_0x959b('0x72')]);router['delete'](_0x959b('0x37'),auth[_0x959b('0x9')](),controller[_0x959b('0x73')]);router[_0x959b('0x65')](_0x959b('0x5f'),auth[_0x959b('0x9')](),controller[_0x959b('0x74')]);router['post'](_0x959b('0x75'),auth[_0x959b('0x9')](),controller[_0x959b('0x76')]);module[_0x959b('0x77')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 1adb9fb..e692a08 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 _0x2058=['internal','email','toLowerCase','ENUM','admin','user','agent','local','INTEGER','callerid','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','auto','nonat','update','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','certificate','passive','actpass','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>','getDataValue'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x2058,0x1bf));var _0x8205=function(_0x55336a,_0x240d59){_0x55336a=_0x55336a-0x0;var _0x28ceb3=_0x2058[_0x55336a];return _0x28ceb3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8205('0x0'));var util=require(_0x8205('0x1'));var _=require(_0x8205('0x2'));module[_0x8205('0x3')]={'name':{'type':Sequelize[_0x8205('0x4')],'allowNull':![],'unique':_0x8205('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3438d0){this[_0x8205('0x6')]('name',_0x3438d0);this[_0x8205('0x6')](_0x8205('0x7'),_0x3438d0);},'comment':_0x8205('0x8')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x4306e4){this[_0x8205('0x6')](_0x8205('0x9'),_0x4306e4);this[_0x8205('0x6')]('callerid',util[_0x8205('0xa')](_0x8205('0xb'),_0x4306e4,this[_0x8205('0xc')](_0x8205('0xd'))));}},'alias':{'type':Sequelize[_0x8205('0x4')]},'email':{'type':Sequelize[_0x8205('0x4')],'allowNull':![],'unique':_0x8205('0xe'),'validate':{'isEmail':!![]},'set':function(_0x62c399){if(_0x62c399){this['setDataValue'](_0x8205('0xe'),_0x62c399[_0x8205('0xf')]());}}},'role':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x11'),_0x8205('0x12'),_0x8205('0x13'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x8205('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x8205('0x4')],'defaultValue':_0x8205('0x14')},'internal':{'type':Sequelize[_0x8205('0x15')](0xb),'allowNull':![],'unique':'internal','set':function(_0x258d09){this[_0x8205('0x6')](_0x8205('0xd'),_0x258d09);this['setDataValue']('accountcode',_0x258d09);this[_0x8205('0x6')](_0x8205('0x16'),util['format']('\x22%s\x22\x20<%s>',this[_0x8205('0xc')]('fullname'),_0x258d09));}},'salt':{'type':Sequelize[_0x8205('0x4')]},'phone':{'type':Sequelize[_0x8205('0x4')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x8205('0x4')]},'zipcode':{'type':Sequelize[_0x8205('0x4')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x8205('0x4')]},'country':{'type':Sequelize[_0x8205('0x4')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x8205('0x17')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x8205('0x4')],'defaultValue':_0x8205('0x19')},'lastPauseAt':{'type':Sequelize[_0x8205('0x17')]},'chatCapacity':{'type':Sequelize[_0x8205('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x8205('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x8205('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x8205('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'description':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![],'defaultValue':_0x8205('0x1a')},'ipaddr':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x8205('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x8205('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x1b'),_0x8205('0x12'),_0x8205('0x1c')),'allowNull':!![],'defaultValue':_0x8205('0x1b')},'context':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![],'defaultValue':_0x8205('0x1d')},'callingpres':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x1e'),'ALLOWED_PASSED_SCREEN',_0x8205('0x1f'),_0x8205('0x20'),_0x8205('0x21'),'PROHIB_PASSED_SCREEN',_0x8205('0x22'),_0x8205('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![],'defaultValue':_0x8205('0x24'),'set':function(_0x169197){this[_0x8205('0x6')](_0x8205('0x25'),_0x169197?_0x169197[_0x8205('0x26')](','):null);},'get':function(){return this[_0x8205('0xc')](_0x8205('0x25'))?this[_0x8205('0xc')](_0x8205('0x25'))[_0x8205('0x27')](','):null;},'comment':_0x8205('0x28')},'dtmfmode':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x29'),'info','shortinfo','inband',_0x8205('0x2a')),'allowNull':!![],'defaultValue':_0x8205('0x29')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x8205('0x2b'),_0x8205('0x2c'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![],'defaultValue':_0x8205('0x2e'),'set':function(_0x4794ad){this[_0x8205('0x6')](_0x8205('0x2f'),_0x4794ad?_0x4794ad[_0x8205('0x26')](','):null);},'get':function(){return this[_0x8205('0xc')](_0x8205('0x2f'))?this['getDataValue'](_0x8205('0x2f'))[_0x8205('0x27')](','):null;},'comment':_0x8205('0x30')},'callgroup':{'type':Sequelize[_0x8205('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x8205('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8205('0x4')]},'disallow':{'type':Sequelize[_0x8205('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x49683c){this['setDataValue'](_0x8205('0x31'),_0x49683c?_0x49683c[_0x8205('0x26')](';'):_0x8205('0x32'));},'get':function(){return this[_0x8205('0xc')]('allow')?this[_0x8205('0xc')](_0x8205('0x31'))['split'](';'):null;},'comment':_0x8205('0x33')},'autoframing':{'type':Sequelize[_0x8205('0x10')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![],'set':function(_0x553646){this[_0x8205('0x6')](_0x8205('0x34'),_0x553646?_0x553646['join'](','):null);},'get':function(){return this[_0x8205('0xc')](_0x8205('0x34'))?this[_0x8205('0xc')](_0x8205('0x34'))[_0x8205('0x27')](','):null;},'comment':_0x8205('0x35')},'trustrpid':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x2d'),'no',_0x8205('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x8205('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![],'defaultValue':_0x8205('0x37')},'amaflags':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x8205('0x10')]('yes','no'),'allowNull':!![],'defaultValue':_0x8205('0x2d')},'busylevel':{'type':Sequelize[_0x8205('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x8205('0x10')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x8205('0x10')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x8205('0x2d'),'no',_0x8205('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8205('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x39'),_0x8205('0x3a'),_0x8205('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x8205('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x8205('0x10')]('uac','uas'),'allowNull':!![],'defaultValue':_0x8205('0x3c')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x8205('0x2d')},'keepalive':{'type':Sequelize[_0x8205('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x8205('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x8205('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x8205('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8205('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x2d'),'no',_0x8205('0x3d'),_0x8205('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x8205('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x8205('0x3f'),_0x8205('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x8205('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x8205('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x8205('0x10')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x8205('0x10')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x2d'),'no','nonat','update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x8205('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x8205('0x17')]},'passwordResetAt':{'type':Sequelize[_0x8205('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x8205('0x15')],'defaultValue':0x0,'set':function(_0x2dafb0){this[_0x8205('0x6')](_0x8205('0x41'),_0x2dafb0);var _0xa4fd55=this[_0x8205('0x42')]({'plain':!![]});switch(_0x2dafb0){case 0x0:case 0x1:var _0x4160ff=_0xa4fd55[_0x8205('0x25')]?_[_0x8205('0x43')](_0xa4fd55[_0x8205('0x25')])?_0xa4fd55[_0x8205('0x25')][_0x8205('0x26')]():_0xa4fd55['transport']:_0x8205('0x24');if(_0x4160ff===_0x8205('0x44')){_0x4160ff=_0x8205('0x24');}this[_0x8205('0x6')](_0x8205('0x25'),_0x4160ff);this[_0x8205('0x6')](_0x8205('0x45'),'no');this['setDataValue'](_0x8205('0x46'),null);this[_0x8205('0x6')](_0x8205('0x47'),null);this[_0x8205('0x6')](_0x8205('0x48'),null);this[_0x8205('0x6')](_0x8205('0x49'),null);this[_0x8205('0x6')](_0x8205('0x4a'),null);this['setDataValue']('dtlssetup',null);this[_0x8205('0x6')](_0x8205('0x4b'),null);this[_0x8205('0x6')](_0x8205('0x4c'),null);this['setDataValue'](_0x8205('0x4d'),'no');break;case 0x2:this[_0x8205('0x6')](_0x8205('0x25'),_0x8205('0x44'));this[_0x8205('0x6')](_0x8205('0x45'),_0x8205('0x2d'));this[_0x8205('0x6')](_0x8205('0x46'),'yes');this[_0x8205('0x6')](_0x8205('0x47'),'yes');this['setDataValue'](_0x8205('0x48'),_0x8205('0x2d'));this['setDataValue'](_0x8205('0x49'),_0x8205('0x2d'));this[_0x8205('0x6')](_0x8205('0x4a'),'no');this[_0x8205('0x6')](_0x8205('0x4e'),'actpass');this['setDataValue'](_0x8205('0x4b'),_0xa4fd55[_0x8205('0x4b')]||_0x8205('0x4f'));this[_0x8205('0x6')](_0x8205('0x4c'),_0xa4fd55[_0x8205('0x4c')]||_0x8205('0x50'));this['setDataValue'](_0x8205('0x4d'),_0x8205('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0x8205('0x51')],'set':function(_0x107a75){this[_0x8205('0x6')](_0x8205('0x52'),_0x107a75?_0x107a75[_0x8205('0x26')](','):[]);},'get':function(){return this[_0x8205('0xc')](_0x8205('0x52'))?_[_0x8205('0x53')](this[_0x8205('0xc')]('permissions')['split'](','),function(_0x16aaf3){return parseInt(_0x16aaf3,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x8205('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x8205('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x8205('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x8205('0x18')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x8205('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x8205('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x8205('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x8205('0x10')](_0x8205('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x8205('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x8205('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x8205('0x54')],'get':function(){return this[_0x8205('0xc')](_0x8205('0x55'))?this['getDataValue'](_0x8205('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x8205('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![],'set':function(_0x1f0920){if(typeof _0x1f0920===_0x8205('0x56')){var _0x299e8f=_0x1f0920==='1'?!![]:_0x1f0920==='0'?![]:_0x1f0920==='true'?!![]:_0x1f0920==='false'?![]:![];this[_0x8205('0x6')](_0x8205('0x57'),_0x299e8f);}else{this[_0x8205('0x6')](_0x8205('0x57'),_0x1f0920);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x417a83){this['setDataValue'](_0x8205('0x58'),_0x417a83);if(_0x417a83===!![]){this[_0x8205('0x6')]('blockedAt',moment());this[_0x8205('0x6')](_0x8205('0x59'),0x0);}else{this[_0x8205('0x6')](_0x8205('0x5a'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x8205('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x8205('0x18')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x8205('0x15')](0x5)[_0x8205('0x5b')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x8205('0x18')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8205('0x18')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x8205('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x8205('0x15')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x8205('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x8205('0x18')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x8205('0x15')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5313=['/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','moment','util','lodash','exports','STRING','name','defaultuser','fullname','setDataValue','callerid','\x22%s\x22\x20<%s>','internal','email','toLowerCase','user','telephone','local','INTEGER','accountcode','getDataValue','BOOLEAN','DATE','dynamic','ENUM','friend','peer','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','nonat','update','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','certificate','passive','actpass','showWebBar','get','isArray','udp','encryption','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','icesupport'];(function(_0x2b79df,_0x39f6aa){var _0x47a54a=function(_0xeb30e5){while(--_0xeb30e5){_0x2b79df['push'](_0x2b79df['shift']());}};_0x47a54a(++_0x39f6aa);}(_0x5313,0x167));var _0x3531=function(_0xa22eca,_0x2180ef){_0xa22eca=_0xa22eca-0x0;var _0x1d5359=_0x5313[_0xa22eca];return _0x1d5359;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3531('0x0'));var util=require(_0x3531('0x1'));var _=require(_0x3531('0x2'));module[_0x3531('0x3')]={'name':{'type':Sequelize[_0x3531('0x4')],'allowNull':![],'unique':_0x3531('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x233a76){this['setDataValue'](_0x3531('0x5'),_0x233a76);this['setDataValue'](_0x3531('0x6'),_0x233a76);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x3531('0x4')],'allowNull':![],'set':function(_0x56e14d){this['setDataValue'](_0x3531('0x7'),_0x56e14d);this[_0x3531('0x8')](_0x3531('0x9'),util['format'](_0x3531('0xa'),_0x56e14d,this['getDataValue'](_0x3531('0xb'))));}},'alias':{'type':Sequelize[_0x3531('0x4')]},'email':{'type':Sequelize[_0x3531('0x4')],'allowNull':![],'unique':_0x3531('0xc'),'validate':{'isEmail':!![]},'set':function(_0x517d0a){if(_0x517d0a){this[_0x3531('0x8')]('email',_0x517d0a[_0x3531('0xd')]());}}},'role':{'type':Sequelize['ENUM']('admin',_0x3531('0xe'),'agent',_0x3531('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x3531('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x3531('0x4')],'defaultValue':_0x3531('0x10')},'internal':{'type':Sequelize[_0x3531('0x11')](0xb),'allowNull':![],'unique':_0x3531('0xb'),'set':function(_0x2eafb6){this[_0x3531('0x8')](_0x3531('0xb'),_0x2eafb6);this[_0x3531('0x8')](_0x3531('0x12'),_0x2eafb6);this[_0x3531('0x8')](_0x3531('0x9'),util['format'](_0x3531('0xa'),this[_0x3531('0x13')]('fullname'),_0x2eafb6));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x3531('0x4')]},'mobile':{'type':Sequelize[_0x3531('0x4')]},'address':{'type':Sequelize[_0x3531('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x3531('0x4')]},'city':{'type':Sequelize[_0x3531('0x4')]},'country':{'type':Sequelize[_0x3531('0x4')]},'online':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x3531('0x15')]},'voicePause':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x3531('0x15')]},'chatCapacity':{'type':Sequelize[_0x3531('0x11')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x3531('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x3531('0x11')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x3531('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x3531('0x11')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x3531('0x11')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x3531('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x3531('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x3531('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![],'defaultValue':_0x3531('0x16')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x3531('0x11')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x3531('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x3531('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x3531('0x17')](_0x3531('0x18'),_0x3531('0xe'),_0x3531('0x19')),'allowNull':!![],'defaultValue':_0x3531('0x18')},'context':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x3531('0x17')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x3531('0x1a'),'ALLOWED',_0x3531('0x1b'),'PROHIB_PASSED_SCREEN',_0x3531('0x1c'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x1e0355){this[_0x3531('0x8')](_0x3531('0x1d'),_0x1e0355?_0x1e0355[_0x3531('0x1e')](','):null);},'get':function(){return this[_0x3531('0x13')]('transport')?this[_0x3531('0x13')](_0x3531('0x1d'))[_0x3531('0x1f')](','):null;},'comment':_0x3531('0x20')},'dtmfmode':{'type':Sequelize[_0x3531('0x17')](_0x3531('0x21'),_0x3531('0x22'),'shortinfo',_0x3531('0x23'),_0x3531('0x24')),'allowNull':!![],'defaultValue':_0x3531('0x21')},'directmedia':{'type':Sequelize['ENUM'](_0x3531('0x25'),'no',_0x3531('0x26'),_0x3531('0x27'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3531('0x17')](_0x3531('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![],'defaultValue':_0x3531('0x28'),'set':function(_0xcbcfa6){this[_0x3531('0x8')](_0x3531('0x29'),_0xcbcfa6?_0xcbcfa6[_0x3531('0x1e')](','):null);},'get':function(){return this[_0x3531('0x13')](_0x3531('0x29'))?this['getDataValue'](_0x3531('0x29'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x3531('0x4')]},'namedcallgroup':{'type':Sequelize[_0x3531('0x4')]},'pickupgroup':{'type':Sequelize[_0x3531('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x3531('0x4')]},'language':{'type':Sequelize[_0x3531('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3531('0x4')]},'disallow':{'type':Sequelize[_0x3531('0x4')],'allowNull':![],'defaultValue':_0x3531('0x2a')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3531('0x2b'),'set':function(_0x272d2e){this[_0x3531('0x8')]('allow',_0x272d2e?_0x272d2e[_0x3531('0x1e')](';'):_0x3531('0x2b'));},'get':function(){return this['getDataValue'](_0x3531('0x2c'))?this[_0x3531('0x13')](_0x3531('0x2c'))['split'](';'):null;},'comment':_0x3531('0x2d')},'autoframing':{'type':Sequelize[_0x3531('0x17')](_0x3531('0x25'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![],'set':function(_0x420293){this[_0x3531('0x8')](_0x3531('0x2e'),_0x420293?_0x420293[_0x3531('0x1e')](','):null);},'get':function(){return this[_0x3531('0x13')](_0x3531('0x2e'))?this['getDataValue'](_0x3531('0x2e'))[_0x3531('0x1f')](','):null;},'comment':_0x3531('0x2f')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3531('0x17')](_0x3531('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3531('0x17')]('yes','no',_0x3531('0x30')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x3531('0x17')](_0x3531('0x25'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x3531('0x25'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x3531('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![],'defaultValue':_0x3531('0x31')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x3531('0x25'),'no'),'allowNull':!![],'defaultValue':_0x3531('0x25')},'busylevel':{'type':Sequelize[_0x3531('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x3531('0x25'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x3531('0x17')](_0x3531('0x25'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x3531('0x25'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x3531('0x25'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x3531('0x17')]('yes','no',_0x3531('0x32')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x3531('0x17')](_0x3531('0x25'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x3531('0x17')]('accept',_0x3531('0x33'),_0x3531('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x3531('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x3531('0x11')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x3531('0x35'),_0x3531('0x36')),'allowNull':!![],'defaultValue':_0x3531('0x36')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x3531('0x25')},'keepalive':{'type':Sequelize[_0x3531('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x3531('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x3531('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x3531('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x3531('0x17')](_0x3531('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x3531('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x3531('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x3531('0x11')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x3531('0x17')](_0x3531('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x3531('0x25'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x3531('0x17')](_0x3531('0x25'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x3531('0x17')](_0x3531('0x25'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x3531('0x17')](_0x3531('0x25'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x3531('0x25'),'no',_0x3531('0x37'),_0x3531('0x38')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x3531('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x3531('0x17')]('active',_0x3531('0x39'),_0x3531('0x3a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x3531('0x17')](_0x3531('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x3531('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x3531('0x17')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x3531('0x17')](_0x3531('0x25'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x3531('0x17')](_0x3531('0x25'),'no','nonat',_0x3531('0x27'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x3531('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x3531('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x3531('0x11')],'defaultValue':0x0,'set':function(_0x34a767){this['setDataValue'](_0x3531('0x3b'),_0x34a767);var _0x3183f9=this[_0x3531('0x3c')]({'plain':!![]});switch(_0x34a767){case 0x0:case 0x1:var _0x4c6d02=_0x3183f9[_0x3531('0x1d')]?_[_0x3531('0x3d')](_0x3183f9['transport'])?_0x3183f9[_0x3531('0x1d')][_0x3531('0x1e')]():_0x3183f9['transport']:_0x3531('0x3e');if(_0x4c6d02==='wss'){_0x4c6d02=_0x3531('0x3e');}this[_0x3531('0x8')](_0x3531('0x1d'),_0x4c6d02);this[_0x3531('0x8')](_0x3531('0x3f'),'no');this[_0x3531('0x8')]('avpf',null);this[_0x3531('0x8')](_0x3531('0x40'),null);this[_0x3531('0x8')]('icesupport',null);this['setDataValue'](_0x3531('0x41'),null);this[_0x3531('0x8')](_0x3531('0x42'),null);this['setDataValue'](_0x3531('0x43'),null);this[_0x3531('0x8')](_0x3531('0x44'),null);this[_0x3531('0x8')](_0x3531('0x45'),null);this[_0x3531('0x8')]('rtcp_mux','no');break;case 0x2:this[_0x3531('0x8')](_0x3531('0x1d'),'wss');this['setDataValue'](_0x3531('0x3f'),_0x3531('0x25'));this[_0x3531('0x8')]('avpf',_0x3531('0x25'));this[_0x3531('0x8')]('force_avp','yes');this[_0x3531('0x8')](_0x3531('0x46'),_0x3531('0x25'));this[_0x3531('0x8')](_0x3531('0x41'),'yes');this[_0x3531('0x8')](_0x3531('0x42'),'no');this[_0x3531('0x8')](_0x3531('0x43'),_0x3531('0x3a'));this[_0x3531('0x8')](_0x3531('0x44'),_0x3183f9[_0x3531('0x44')]||_0x3531('0x47'));this['setDataValue']('dtlsprivatekey',_0x3183f9[_0x3531('0x45')]||_0x3531('0x48'));this['setDataValue'](_0x3531('0x49'),_0x3531('0x25'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1171c4){this[_0x3531('0x8')](_0x3531('0x4a'),_0x1171c4?_0x1171c4['join'](','):[]);},'get':function(){return this[_0x3531('0x13')](_0x3531('0x4a'))?_[_0x3531('0x4b')](this[_0x3531('0x13')](_0x3531('0x4a'))['split'](','),function(_0x7ad935){return parseInt(_0x7ad935,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x3531('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x3531('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x3531('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x3531('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x3531('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x3531('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x3531('0x17')](_0x3531('0x25'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x3531('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x3531('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x3531('0x4c')],'get':function(){return this[_0x3531('0x13')](_0x3531('0x4d'))?this[_0x3531('0x13')](_0x3531('0x4d')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x3531('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![],'set':function(_0x18e164){if(typeof _0x18e164===_0x3531('0x4e')){var _0xde6956=_0x18e164==='1'?!![]:_0x18e164==='0'?![]:_0x18e164===_0x3531('0x4f')?!![]:_0x18e164===_0x3531('0x50')?![]:![];this[_0x3531('0x8')]('screenrecording',_0xde6956);}else{this[_0x3531('0x8')](_0x3531('0x51'),_0x18e164);}}},'blocked':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![],'set':function(_0x190ee3){this[_0x3531('0x8')](_0x3531('0x52'),_0x190ee3);if(_0x190ee3===!![]){this['setDataValue'](_0x3531('0x53'),moment());this[_0x3531('0x8')](_0x3531('0x54'),0x0);}else{this[_0x3531('0x8')](_0x3531('0x53'),null);}}},'blockedAt':{'type':Sequelize[_0x3531('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x3531('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0x3531('0x55')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x3531('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x3531('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x3531('0x11')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x3531('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x3531('0x14')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x3531('0x11')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index ae4a8c3..3446282 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 _0xe0a4=['defaults','localhost','client','http','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','update','agent','userNotification:recalc:','destroy','get','role','admin','Users','Telephones','telephone','filter','ignore','map','value','find','name','UserProfileResource','stack','send','rawAttributes','fieldName','type','key','password','salt','previousPasswords','resetPasswordToken','includes','index','where','query','includeAll','include','userSetting','true','UserSetting','attributes','push','User','findAll','rows','openTabs','length','chat','dataValues','sms','fax','mail','whatsapp','all','show','getOptions','merge','openchannel','body','params','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','max','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','103','113','110','105','107','109','100','114','115','create','Unauthorized','user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','Agents','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','penalty','QueueId','Queue:save','voice','VoiceQueue','format','upsert','removeQueues','remove','isArray','Queue:remove','emit','UserVoiceQueueRt','addAvatar','userpic','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MAIL','SMS','WhatsappOpenTabs','WHATSAPP','concat','User\x20with\x20id\x20%s\x20not\x20found','CmList','Tag','color','tag','getQueues','keys','Queue','filters','intersection','model','fields','order','sort','pick','options','Queues','Unknown\x20role','hasOwnProperty','getVoiceQueuesRt','nolimit','getGroups','getRecordings','VoiceRecording','UserId','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','user:forcelogout','headers','x-forwarded-for','remoteAddress','socket','sequelize','transaction','commit','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','openchannelPause','smsPause','pauseType','lastPauseAt','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','removeTeams','getAssociatedQueues','VoicePrefixId','getLists','getAgents','getVoiceQueues','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','spread','user_has_chat_interactions:save','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$or','$gt','$lt','$ne','$eq','$not','$between','$notIn','$like','$notLike','$iLike','$notILike','$any','firstName','lastName','phone','CmContact','Contact','getApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','idle','unknown','ringing','inbound','flatten','toString','lower','col','asc','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','slice','charAt','toUpperCase','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','messengerSoundNotification','enabled','moment','util','path','lodash','squel','ioredis','jayson/promise','../../components/auth/service','../../components/parsers/qs','../../components/realtime/agents','api','../../config/utils','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket'];(function(_0xc1cdf5,_0x1086d7){var _0x3ee1c7=function(_0x25cbe4){while(--_0x25cbe4){_0xc1cdf5['push'](_0xc1cdf5['shift']());}};_0x3ee1c7(++_0x1086d7);}(_0xe0a4,0x180));var _0x4e0a=function(_0xab0b36,_0x353733){_0xab0b36=_0xab0b36-0x0;var _0xc420d4=_0xe0a4[_0xab0b36];return _0xc420d4;};'use strict';var moment=require(_0x4e0a('0x0'));var util=require(_0x4e0a('0x1'));var path=require(_0x4e0a('0x2'));var fs=require('fs');var _=require(_0x4e0a('0x3'));var squel=require(_0x4e0a('0x4'));var Redis=require(_0x4e0a('0x5'));var jayson=require(_0x4e0a('0x6'));var authService=require(_0x4e0a('0x7'));var contacts=require('../../components/contacts');var qs=require(_0x4e0a('0x8'));var rta=require(_0x4e0a('0x9'));var logger=require('../../config/logger')(_0x4e0a('0xa'));var utils=require(_0x4e0a('0xb'));var config=require('../../config/environment');var licenseUtil=require(_0x4e0a('0xc'));var APIBadRequestError=require(_0x4e0a('0xd'))[_0x4e0a('0xe')];var APINotFoundError=require(_0x4e0a('0xd'))[_0x4e0a('0xf')];var APIForbiddenError=require(_0x4e0a('0xd'))['APIForbiddenrror'];var APIHandleError=require(_0x4e0a('0xd'))[_0x4e0a('0x10')];var db=require(_0x4e0a('0x11'))['db'];var socket=require(_0x4e0a('0x12'))(new Redis(config[_0x4e0a('0x13')]));require(_0x4e0a('0x14'))['register'](socket);config[_0x4e0a('0x13')]=_[_0x4e0a('0x15')](config[_0x4e0a('0x13')],{'host':_0x4e0a('0x16'),'port':0x18eb});var amiClient=jayson[_0x4e0a('0x17')][_0x4e0a('0x18')]({'port':0x232a});var values;function respondWithStatusCode(_0x3553b9,_0x45ad2f){_0x45ad2f=_0x45ad2f||0xcc;return function(_0x331dc0){if(_0x331dc0){return _0x3553b9[_0x4e0a('0x19')](_0x45ad2f);}return _0x3553b9[_0x4e0a('0x1a')](_0x45ad2f)[_0x4e0a('0x1b')]();};}function respondWithResult(_0x387a36,_0x241509){_0x241509=_0x241509||0xc8;return function(_0x1d2ca8){if(_0x1d2ca8){return _0x387a36[_0x4e0a('0x1a')](_0x241509)[_0x4e0a('0x1c')](_0x1d2ca8);}};}function respondWithFilteredResult(_0x403cef,_0x9c78ee){return function(_0x4ee31b){if(_0x4ee31b){var _0x324368=typeof _0x9c78ee['offset']===_0x4e0a('0x1d')&&typeof _0x9c78ee['limit']===_0x4e0a('0x1d');var _0x2e9dc8=_0x4ee31b[_0x4e0a('0x1e')];var _0x2ca9c2=_0x324368?0x0:_0x9c78ee[_0x4e0a('0x1f')];var _0x556daa=_0x324368?_0x4ee31b[_0x4e0a('0x1e')]:_0x9c78ee['offset']+_0x9c78ee[_0x4e0a('0x20')];var _0xee2046;if(_0x556daa>=_0x2e9dc8){_0x556daa=_0x2e9dc8;_0xee2046=0xc8;}else{_0xee2046=0xce;}_0x403cef[_0x4e0a('0x1a')](_0xee2046);return _0x403cef[_0x4e0a('0x21')](_0x4e0a('0x22'),_0x2ca9c2+'-'+_0x556daa+'/'+_0x2e9dc8)['json'](_0x4ee31b);}return null;};}function respondWithRpcPromise(_0x6c40d8,_0x39d256,_0x3c301d,_0x2f27dc){return new Promise(function(_0x358765,_0x3ae9e2){var _0x54dea0=_0x2f27dc||amiClient;return _0x54dea0[_0x4e0a('0x23')](_0x6c40d8,_0x3c301d)[_0x4e0a('0x24')](function(_0x56d86b){logger[_0x4e0a('0x25')](_0x4e0a('0x26'),_0x39d256,_0x4e0a('0x27'));logger[_0x4e0a('0x28')](_0x4e0a('0x29'),_0x39d256,_0x4e0a('0x27'),JSON[_0x4e0a('0x2a')](_0x56d86b));if(_0x56d86b[_0x4e0a('0x2b')]){if(_0x56d86b[_0x4e0a('0x2b')][_0x4e0a('0x2c')]===0x1f4){logger['error'](_0x4e0a('0x26'),_0x39d256,_0x56d86b[_0x4e0a('0x2b')][_0x4e0a('0x2d')]);return _0x3ae9e2(_0x56d86b[_0x4e0a('0x2b')]['message']);}logger[_0x4e0a('0x2b')](_0x4e0a('0x26'),_0x39d256,_0x56d86b[_0x4e0a('0x2b')][_0x4e0a('0x2d')]);return _0x358765(_0x56d86b[_0x4e0a('0x2b')][_0x4e0a('0x2d')]);}else{logger[_0x4e0a('0x25')](_0x4e0a('0x26'),_0x39d256,_0x4e0a('0x27'));_0x358765(_0x56d86b[_0x4e0a('0x2e')]['message']);}})[_0x4e0a('0x2f')](function(_0x107bda){logger['error'](_0x4e0a('0x26'),_0x39d256,_0x107bda);_0x3ae9e2(_0x107bda);});});}function saveUpdates(_0x1ed8a3){return function(_0x372ff1){if(_0x372ff1){return _0x372ff1[_0x4e0a('0x30')](_0x1ed8a3)[_0x4e0a('0x24')](function(_0x37da2b){if(_0x37da2b['role']===_0x4e0a('0x31')){socket['emit'](_0x4e0a('0x32')+_0x37da2b['id'],_0x37da2b);}return _0x37da2b;});}return null;};}function removeEntity(_0x2f4f1a,_0xf5833a){return function(_0x589487){if(_0x589487){return _0x589487[_0x4e0a('0x33')]({'transaction':_0xf5833a})[_0x4e0a('0x24')](function(){var _0x3b61b7=_0x589487[_0x4e0a('0x34')]({'plain':!![]});if(_0x3b61b7[_0x4e0a('0x35')]===_0x4e0a('0x36'))return;var _0x4a0df1=[{'name':_0x4e0a('0x37'),'value':'user','ignore':!![]},{'name':'Agents','value':_0x4e0a('0x31'),'ignore':![]},{'name':_0x4e0a('0x38'),'value':_0x4e0a('0x39'),'ignore':![]}];var _0x2ecd23=_(_0x4a0df1)[_0x4e0a('0x3a')](_0x4e0a('0x3b'))[_0x4e0a('0x3c')](_0x4e0a('0x3d'))['value']();if(_['includes'](_0x2ecd23,_0x3b61b7[_0x4e0a('0x35')])){return;}var _0x4e62d8=_[_0x4e0a('0x3e')](_0x4a0df1,['value',_0x3b61b7[_0x4e0a('0x35')]])[_0x4e0a('0x3f')];return db[_0x4e0a('0x40')][_0x4e0a('0x33')]({'where':{'type':_0x4e62d8,'resourceId':_0x3b61b7['id']},'transaction':_0xf5833a})['then'](function(){return _0x589487;});})[_0x4e0a('0x24')](function(){_0x2f4f1a[_0x4e0a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40e452){return function(_0x550a04){if(!_0x550a04){_0x40e452[_0x4e0a('0x19')](0x194);}return _0x550a04;};}function handleError(_0x1ee104,_0x48db4e){_0x48db4e=_0x48db4e||0x1f4;return function(_0x576b61){logger[_0x4e0a('0x2b')](_0x576b61[_0x4e0a('0x41')]);if(_0x576b61['name']){delete _0x576b61[_0x4e0a('0x3f')];}_0x1ee104['status'](_0x48db4e)[_0x4e0a('0x42')](_0x576b61);};}function getUserAttributes(){return _(db['User'][_0x4e0a('0x43')])[_0x4e0a('0x3c')](function(_0xd9fe92){return{'name':_0xd9fe92[_0x4e0a('0x44')],'type':_0xd9fe92[_0x4e0a('0x45')][_0x4e0a('0x46')]};})[_0x4e0a('0x3a')](function(_0x33284a){return![_0x4e0a('0x47'),_0x4e0a('0x48'),_0x4e0a('0x49'),_0x4e0a('0x4a'),'resetPasswordExpires','md5secret'][_0x4e0a('0x4b')](_0x33284a[_0x4e0a('0x3f')]);})[_0x4e0a('0x3d')]();}exports[_0x4e0a('0x4c')]=function(_0x58ffa9,_0x3aff94){var _0xbad7aa={},_0x10a2d5={'count':0x0,'rows':[]};var _0x16995e=getUserAttributes();_0xbad7aa=qs['getOptions'](_0x16995e,_0x58ffa9);var _0x2fc6af={'where':_0xbad7aa[_0x4e0a('0x4d')]};return db['User'][_0x4e0a('0x1e')](_0x2fc6af)[_0x4e0a('0x24')](function(_0x2cbb7b){_0x10a2d5[_0x4e0a('0x1e')]=_0x2cbb7b;if(_0x58ffa9[_0x4e0a('0x4e')][_0x4e0a('0x4f')]){_0xbad7aa[_0x4e0a('0x50')]=[{'all':!![]}];}if(_0x58ffa9[_0x4e0a('0x4e')][_0x4e0a('0x51')]===_0x4e0a('0x52')){_0xbad7aa['include']=[{'model':db[_0x4e0a('0x53')],'as':_0x4e0a('0x51')}];}if(!_[_0x4e0a('0x4b')](_0xbad7aa[_0x4e0a('0x54')],'id')){_0xbad7aa['attributes'][_0x4e0a('0x55')]('id');}return db[_0x4e0a('0x56')][_0x4e0a('0x57')](_0xbad7aa);})['then'](function(_0x503f9c){_0x10a2d5[_0x4e0a('0x58')]=_0x503f9c;if(_0x58ffa9[_0x4e0a('0x4e')][_0x4e0a('0x59')]===_0x4e0a('0x52')){var _0x50dc01=[];for(var _0x369285=0x0;_0x369285<_0x10a2d5[_0x4e0a('0x58')][_0x4e0a('0x5a')];_0x369285++){_0x50dc01[_0x4e0a('0x55')](get_open_tabs(_0x4e0a('0x5b'),_0x10a2d5[_0x4e0a('0x58')][_0x369285][_0x4e0a('0x5c')]));_0x50dc01[_0x4e0a('0x55')](get_open_tabs(_0x4e0a('0x5d'),_0x10a2d5[_0x4e0a('0x58')][_0x369285][_0x4e0a('0x5c')]));_0x50dc01[_0x4e0a('0x55')](get_open_tabs(_0x4e0a('0x5e'),_0x10a2d5['rows'][_0x369285][_0x4e0a('0x5c')]));_0x50dc01['push'](get_open_tabs(_0x4e0a('0x5f'),_0x10a2d5['rows'][_0x369285][_0x4e0a('0x5c')]));_0x50dc01[_0x4e0a('0x55')](get_open_tabs('openchannel',_0x10a2d5[_0x4e0a('0x58')][_0x369285][_0x4e0a('0x5c')]));_0x50dc01[_0x4e0a('0x55')](get_open_tabs(_0x4e0a('0x60'),_0x10a2d5[_0x4e0a('0x58')][_0x369285][_0x4e0a('0x5c')]));}return Promise[_0x4e0a('0x61')](_0x50dc01)[_0x4e0a('0x24')](function(){return _0x10a2d5;});}else{return _0x10a2d5;}})[_0x4e0a('0x24')](respondWithFilteredResult(_0x3aff94,_0xbad7aa))[_0x4e0a('0x2f')](handleError(_0x3aff94,null));};exports[_0x4e0a('0x62')]=function(_0x1ce086,_0x4a864f){var _0x4b2a6a=getUserAttributes();_0x1ce086['query']['id']=_0x1ce086['params']['id'];var _0x4f10d2=qs[_0x4e0a('0x63')](_0x4b2a6a,_0x1ce086);if(_0x1ce086[_0x4e0a('0x4e')][_0x4e0a('0x4f')]){_0x4f10d2['include']=[{'all':!![]}];}if(_0x1ce086[_0x4e0a('0x4e')][_0x4e0a('0x51')]===_0x4e0a('0x52')){_0x4f10d2['include']=[{'model':db[_0x4e0a('0x53')],'as':_0x4e0a('0x51')}];}_0x4f10d2=_[_0x4e0a('0x64')]({},_0x4f10d2,_0x1ce086['options']);if(!_[_0x4e0a('0x4b')](_0x4f10d2[_0x4e0a('0x54')],'id')){_0x4f10d2[_0x4e0a('0x54')][_0x4e0a('0x55')]('id');}return db[_0x4e0a('0x56')][_0x4e0a('0x3e')](_0x4f10d2)[_0x4e0a('0x24')](handleEntityNotFound(_0x4a864f,null))[_0x4e0a('0x24')](function(_0x22ad5b){var _0x32dd89=[];values=_0x22ad5b;if(_0x1ce086[_0x4e0a('0x4e')][_0x4e0a('0x59')]===_0x4e0a('0x52')){_0x32dd89['push'](get_open_tabs(_0x4e0a('0x5b'),_0x22ad5b[_0x4e0a('0x5c')]));_0x32dd89[_0x4e0a('0x55')](get_open_tabs('sms',_0x22ad5b[_0x4e0a('0x5c')]));_0x32dd89['push'](get_open_tabs(_0x4e0a('0x65'),_0x22ad5b[_0x4e0a('0x5c')]));_0x32dd89[_0x4e0a('0x55')](get_open_tabs(_0x4e0a('0x60'),_0x22ad5b[_0x4e0a('0x5c')]));_0x32dd89[_0x4e0a('0x55')](get_open_tabs(_0x4e0a('0x5e'),_0x22ad5b[_0x4e0a('0x5c')]));_0x32dd89[_0x4e0a('0x55')](get_open_tabs(_0x4e0a('0x5f'),_0x22ad5b['dataValues']));return Promise[_0x4e0a('0x61')](_0x32dd89);}else{return values;}})[_0x4e0a('0x24')](function(){return values;})['then'](respondWithResult(_0x4a864f,null))[_0x4e0a('0x2f')](handleError(_0x4a864f,null));};exports[_0x4e0a('0x30')]=function(_0x4de51b,_0x368fd7){if(_0x4de51b['body']['id']){delete _0x4de51b[_0x4e0a('0x66')]['id'];}delete _0x4de51b[_0x4e0a('0x66')][_0x4e0a('0x35')];return db[_0x4e0a('0x56')][_0x4e0a('0x3e')]({'where':{'id':_0x4de51b[_0x4e0a('0x67')]['id']}})[_0x4e0a('0x24')](handleEntityNotFound(_0x368fd7,null))[_0x4e0a('0x24')](saveUpdates(_0x4de51b['body'],null))[_0x4e0a('0x24')](respondWithResult(_0x368fd7,null))[_0x4e0a('0x2f')](handleError(_0x368fd7,null));};exports['describe']=function(_0x8ba3b1,_0xa01407){return db[_0x4e0a('0x56')][_0x4e0a('0x68')]()['then'](respondWithResult(_0xa01407,null))[_0x4e0a('0x2f')](handleError(_0xa01407,null));};exports[_0x4e0a('0x69')]=function(_0x5c3f7d,_0x1d2afe){return db[_0x4e0a('0x56')]['find']({'where':{'id':_0x5c3f7d[_0x4e0a('0x67')]['id']}})[_0x4e0a('0x24')](handleEntityNotFound(_0x1d2afe,null))[_0x4e0a('0x24')](function(_0x200f50){if(_0x200f50){return _0x200f50['addContacts'](_0x5c3f7d[_0x4e0a('0x66')][_0x4e0a('0x6a')],_[_0x4e0a('0x6b')](_0x5c3f7d['body'],[_0x4e0a('0x6a'),'id'])||{});}})[_0x4e0a('0x24')](respondWithResult(_0x1d2afe,null))[_0x4e0a('0x2f')](handleError(_0x1d2afe,null));};function validateUser(_0x4865b2){return new Promise(function(_0x11a575,_0x42d041){if(_0x4865b2[_0x4e0a('0x6c')])return _0x11a575(_0x4865b2);return db[_0x4e0a('0x6d')][_0x4e0a('0x6e')](0x1)[_0x4e0a('0x24')](function(_0x4b0f6c){if(_0x4b0f6c[_0x4e0a('0x6f')])authService['validatePasswordPattern'](_0x4865b2[_0x4e0a('0x47')]);db[_0x4e0a('0x56')][_0x4e0a('0x70')](_0x4e0a('0x6c'))[_0x4e0a('0x24')](function(_0x526bc7){if(_[_0x4e0a('0x71')](_0x526bc7)){_0x4865b2[_0x4e0a('0x6c')]=_0x4b0f6c[_0x4e0a('0x72')]||0x1;return;}if(_[_0x4e0a('0x71')](_0x4b0f6c[_0x4e0a('0x72')])||_0x4b0f6c[_0x4e0a('0x72')]===_0x526bc7){_0x4865b2[_0x4e0a('0x6c')]=_0x526bc7+0x1;return;}if(_0x4b0f6c[_0x4e0a('0x72')]>_0x526bc7){_0x4865b2[_0x4e0a('0x6c')]=_0x4b0f6c[_0x4e0a('0x72')];return;}return db['sequelize']['query'](_0x4e0a('0x73'),{'type':db['sequelize'][_0x4e0a('0x74')][_0x4e0a('0x75')]})[_0x4e0a('0x24')](function(_0x41de51){if(_0x41de51&&_0x41de51[_0x4e0a('0x5a')]){for(var _0x4afa3f=0x0,_0xca6a32=_0x41de51[_0x4e0a('0x5a')];_0x4afa3f<_0xca6a32&&_['isNil'](_0x4865b2[_0x4e0a('0x6c')]);_0x4afa3f++){if(_0x4b0f6c[_0x4e0a('0x72')]<=_0x41de51[_0x4afa3f][_0x4e0a('0x76')]){_0x4865b2[_0x4e0a('0x6c')]=_0x41de51[_0x4afa3f]['from'];}else if(_0x4b0f6c[_0x4e0a('0x72')]>_0x41de51[_0x4afa3f]['from']&&_0x4b0f6c[_0x4e0a('0x72')]<=_0x41de51[_0x4afa3f]['to']){_0x4865b2['internal']=_0x4b0f6c[_0x4e0a('0x72')];}}}if(_[_0x4e0a('0x71')](_0x4865b2['internal'])){_0x4865b2[_0x4e0a('0x6c')]=_0x526bc7+0x1;}return _0x11a575(_0x4865b2);});});})[_0x4e0a('0x2f')](function(_0x592e0e){_0x42d041(_0x592e0e);});});}function updateUser(_0x431c44){return new Promise(function(_0x4927c4,_0x4f1c46){try{if(_0x431c44[_0x4e0a('0x77')]){_0x431c44[_0x4e0a('0x78')]=_0x431c44[_0x4e0a('0x6c')];_0x431c44[_0x4e0a('0x79')]={'mailbox':_0x431c44['internal'],'password':_0x431c44[_0x4e0a('0x47')],'fullname':_0x431c44[_0x4e0a('0x7a')],'email':_0x431c44[_0x4e0a('0x7b')]};}if(_0x431c44['role']===_0x4e0a('0x31')){if(!_0x431c44[_0x4e0a('0x7c')])_0x431c44['permissions']=[_0x4e0a('0x7d'),_0x4e0a('0x7e'),_0x4e0a('0x7f'),_0x4e0a('0x80'),_0x4e0a('0x81'),'104',_0x4e0a('0x82'),'106',_0x4e0a('0x83'),'108',_0x4e0a('0x84'),_0x4e0a('0x85'),'111',_0x4e0a('0x86'),_0x4e0a('0x87')];}_0x4927c4(_0x431c44);}catch(_0x1a2744){_0x4f1c46(_0x1a2744);}});}exports[_0x4e0a('0x88')]=function(_0x6054e2,_0x1d9004){if(_0x6054e2['user'][_0x4e0a('0x35')]===_0x4e0a('0x31'))throw new Error(_0x4e0a('0x89'));if(_0x6054e2[_0x4e0a('0x66')][_0x4e0a('0x35')]===_0x4e0a('0x8a')&&_0x6054e2[_0x4e0a('0x8a')][_0x4e0a('0x35')]!==_0x4e0a('0x36')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x6054e2['body'][_0x4e0a('0x35')]===_0x4e0a('0x36')&&_0x6054e2[_0x4e0a('0x8a')][_0x4e0a('0x35')]!=='admin'){throw new Error(_0x4e0a('0x8b'));}return licenseUtil['checkUserLimits']([_0x6054e2[_0x4e0a('0x66')]])[_0x4e0a('0x24')](function(){return validateUser(_0x6054e2[_0x4e0a('0x66')]);})[_0x4e0a('0x24')](function(_0x392754){return updateUser(_0x392754)[_0x4e0a('0x24')](function(_0x58f7f6){if(_0x58f7f6['role']===_0x4e0a('0x36')){_0x58f7f6[_0x4e0a('0x8c')]=_0x6054e2[_0x4e0a('0x8a')][_0x4e0a('0x8c')];delete _0x58f7f6['userProfileId'];}return _0x58f7f6;});})[_0x4e0a('0x24')](function(_0x500d9c){return db[_0x4e0a('0x56')][_0x4e0a('0x88')](_0x500d9c,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0x4e0a('0x24')](function(_0x39f300){if(_0x6054e2[_0x4e0a('0x66')]['role']===_0x4e0a('0x8a'))return _0x39f300;if(_0x6054e2[_0x4e0a('0x8a')][_0x4e0a('0x35')]!==_0x4e0a('0x8a'))return _0x39f300;return db[_0x4e0a('0x8d')]['find']({'where':{'name':_0x39f300['role']==='agent'?'Agents':'Telephones','userProfileId':_0x6054e2[_0x4e0a('0x8a')][_0x4e0a('0x8e')]},'raw':!![]})[_0x4e0a('0x24')](function(_0x47a00e){if(!_0x47a00e||_0x47a00e[_0x4e0a('0x8f')]!=0x0)return _0x39f300;return db['UserProfileResource']['create']({'name':_0x39f300[_0x4e0a('0x3f')],'resourceId':_0x39f300['id'],'type':_0x47a00e['name'],'sectionId':_0x47a00e['id']},{})[_0x4e0a('0x24')](function(){return _0x39f300;});})[_0x4e0a('0x2f')](function(_0x5382fc){logger['error'](_0x4e0a('0x90'),_0x5382fc);throw _0x5382fc;});})[_0x4e0a('0x24')](respondWithResult(_0x1d9004,0xc9))['catch'](handleError(_0x1d9004,null));};exports[_0x4e0a('0x91')]=function(_0x3d210d,_0x35bbe4){var _0x4de0c4=_0x3d210d['body'];var _0x43c944=[];if(_0x3d210d[_0x4e0a('0x8a')]['role']===_0x4e0a('0x31'))throw new Error('Unauthorized');if(_['some'](_0x4de0c4,[_0x4e0a('0x35'),_0x4e0a('0x8a')])&&_0x3d210d['user'][_0x4e0a('0x35')]!==_0x4e0a('0x36')){throw new Error(_0x4e0a('0x92'));}if(_[_0x4e0a('0x93')](_0x4de0c4,[_0x4e0a('0x35'),_0x4e0a('0x36')])&&_0x3d210d[_0x4e0a('0x8a')][_0x4e0a('0x35')]!==_0x4e0a('0x36')){throw new Error(_0x4e0a('0x94'));}return licenseUtil['checkUserLimits'](_0x4de0c4)[_0x4e0a('0x24')](function(){return validateUser(_0x4de0c4[0x0]);})[_0x4e0a('0x24')](function(){for(var _0xe7f5c3=0x1;_0xe7f5c3<_0x4de0c4['length'];_0xe7f5c3++){var _0x18f5a8=_0x4de0c4[_0xe7f5c3-0x1][_0x4e0a('0x6c')];if(!_0x4de0c4[_0xe7f5c3][_0x4e0a('0x6c')])_0x4de0c4[_0xe7f5c3]['internal']=_0x18f5a8+0x1;_0x43c944['push'](validateUser(_0x4de0c4[_0xe7f5c3]));}return Promise['all'](_0x43c944);})[_0x4e0a('0x24')](function(){_0x43c944=[];for(var _0x5c0413=0x0;_0x5c0413<_0x4de0c4['length'];_0x5c0413++){_0x43c944[_0x4e0a('0x55')](updateUser(_0x4de0c4[_0x5c0413]));}return Promise[_0x4e0a('0x61')](_0x43c944);})[_0x4e0a('0x24')](function(){_0x43c944=_0x4de0c4[_0x4e0a('0x3c')](function(_0x2c794d){return db[_0x4e0a('0x56')][_0x4e0a('0x88')](_0x2c794d,{'include':[{'model':db[_0x4e0a('0x79')],'as':_0x4e0a('0x79')}]})['then'](function(_0x5fe1f9){_0x2c794d['id']=_0x5fe1f9['id'];return _0x2c794d;});});return Promise[_0x4e0a('0x61')](_0x43c944);})[_0x4e0a('0x24')](function(_0x3a6e91){if(_0x3d210d[_0x4e0a('0x66')]['role']==='user')return _0x3a6e91;if(_0x3d210d['user'][_0x4e0a('0x35')]!==_0x4e0a('0x8a'))return _0x3a6e91;var _0x565e13=_['some'](_0x3a6e91,function(_0x128fd5){return _0x128fd5[_0x4e0a('0x35')]==='agent'||_0x128fd5['role']===_0x4e0a('0x39');});if(!_0x565e13)return _0x3a6e91;return db['UserProfileSection'][_0x4e0a('0x57')]({'where':{'name':{'$or':[_0x4e0a('0x95'),_0x4e0a('0x38')]},'userProfileId':_0x3d210d['user'][_0x4e0a('0x8e')]},'raw':!![]})['then'](function(_0x3612dd){if(_['isEmpty'](_0x3612dd)||!_['some'](_0x3612dd,[_0x4e0a('0x8f'),0x0]))return _0x3a6e91;_0x43c944=[];var _0x43ccf5=_(_0x3612dd)[_0x4e0a('0x3c')](function(_0x41607d){if(_0x41607d[_0x4e0a('0x8f')]===0x1)return;return _0x41607d['name']===_0x4e0a('0x95')?'agent':_0x4e0a('0x39');})['compact']()[_0x4e0a('0x3d')]();for(var _0x560386=0x0;_0x560386<_0x3a6e91[_0x4e0a('0x5a')];_0x560386++){if(!_[_0x4e0a('0x4b')](_0x43ccf5,_0x3a6e91[_0x560386][_0x4e0a('0x35')]))return;var _0xaae605=_0x3a6e91[_0x560386][_0x4e0a('0x35')]==='agent'?'Agents':_0x4e0a('0x38');_0x43c944[_0x4e0a('0x55')](db[_0x4e0a('0x40')][_0x4e0a('0x88')]({'name':_0x3a6e91[_0x560386]['name'],'resourceId':_0x3a6e91[_0x560386]['id'],'type':_0xaae605,'sectionId':_[_0x4e0a('0x3e')](_0x3612dd,[_0x4e0a('0x3f'),_0xaae605])['id']},{}));}return Promise[_0x4e0a('0x61')](_0x43c944);});})['then'](respondWithResult(_0x35bbe4,0xc9))[_0x4e0a('0x2f')](handleError(_0x35bbe4,null));};exports[_0x4e0a('0x96')]=function(_0x42bd5d,_0x58adc6){if(_0x42bd5d[_0x4e0a('0x66')]['id']){delete _0x42bd5d[_0x4e0a('0x66')]['id'];}return db[_0x4e0a('0x56')][_0x4e0a('0x3e')]({'where':{'id':_0x42bd5d[_0x4e0a('0x67')]['id']}})['then'](function(_0x53f91c){if(!_0x53f91c)return null;if(_0x53f91c['id']===_0x42bd5d['user']['id']){if(!_0x42bd5d['body'][_0x4e0a('0x97')]||!_0x42bd5d[_0x4e0a('0x66')][_0x4e0a('0x98')]){throw new db[(_0x4e0a('0x99'))][(_0x4e0a('0x9a'))](_0x4e0a('0x9b'));}if(!_0x53f91c[_0x4e0a('0x9c')](_0x42bd5d[_0x4e0a('0x66')]['oldPassword'])){throw new db[(_0x4e0a('0x99'))][(_0x4e0a('0x9a'))](_0x4e0a('0x9d'));}if(_0x42bd5d[_0x4e0a('0x66')]['oldPassword']===_0x42bd5d[_0x4e0a('0x66')][_0x4e0a('0x98')]){throw new db[(_0x4e0a('0x99'))][(_0x4e0a('0x9a'))](_0x4e0a('0x9e'));}}else if(_0x42bd5d[_0x4e0a('0x8a')][_0x4e0a('0x35')]===_0x4e0a('0x36')){if(!_0x42bd5d[_0x4e0a('0x66')][_0x4e0a('0x98')]){throw new db[(_0x4e0a('0x99'))][(_0x4e0a('0x9a'))](_0x4e0a('0x9f'));}}else if(_0x42bd5d[_0x4e0a('0x8a')]['role']===_0x4e0a('0x8a')){if(!_0x42bd5d[_0x4e0a('0x66')][_0x4e0a('0x98')]){throw new db[(_0x4e0a('0x99'))][(_0x4e0a('0x9a'))](_0x4e0a('0x9f'));}if(_0x53f91c[_0x4e0a('0x35')]!==_0x4e0a('0x31')){throw new db[(_0x4e0a('0x99'))][(_0x4e0a('0x9a'))](_0x4e0a('0x89'));}}else{throw new db[(_0x4e0a('0x99'))][(_0x4e0a('0x9a'))](_0x4e0a('0x89'));}return _0x53f91c;})['then'](handleEntityNotFound(_0x58adc6,null))[_0x4e0a('0x24')](function(_0x521d4f){return db[_0x4e0a('0x6d')][_0x4e0a('0xa0')]({'attributes':['id','securePassword',_0x4e0a('0xa1'),_0x4e0a('0xa2')]})[_0x4e0a('0x24')](function(_0x5b933a){if(_0x5b933a['securePassword'])authService['validatePasswordPattern'](_0x42bd5d[_0x4e0a('0x66')][_0x4e0a('0x98')]);if(!_0x5b933a[_0x4e0a('0xa1')]||!_0x521d4f[_0x4e0a('0x49')])return _0x521d4f;authService[_0x4e0a('0xa3')](_0x42bd5d[_0x4e0a('0x66')]['newPassword'],_0x521d4f[_0x4e0a('0x49')],_0x5b933a[_0x4e0a('0xa2')]);return _0x521d4f;})[_0x4e0a('0x24')](saveUpdates({'password':_0x42bd5d[_0x4e0a('0x66')]['newPassword'],'passwordResetAt':_0x42bd5d[_0x4e0a('0x8a')]['id']==_0x42bd5d[_0x4e0a('0x67')]['id']?moment():null,'previousPasswords':authService[_0x4e0a('0xa4')](_0x42bd5d[_0x4e0a('0x66')]['newPassword'],_0x521d4f[_0x4e0a('0x49')])},null));})['then'](respondWithResult(_0x58adc6,null))[_0x4e0a('0x2f')](handleError(_0x58adc6,null));};exports[_0x4e0a('0xa5')]=function(_0x5ee6a8,_0x3f8543){var _0xd5500c=_0x5ee6a8[_0x4e0a('0x66')][_0x4e0a('0xa6')];return db[_0x4e0a('0x56')]['find']({'where':{'id':_0x5ee6a8[_0x4e0a('0x67')]['id']},'attributes':['id',_0x4e0a('0x3f'),_0x4e0a('0x35'),_0x4e0a('0xa7'),_0x4e0a('0xa8'),_0x4e0a('0xa9'),_0x4e0a('0xaa')]})[_0x4e0a('0x24')](handleEntityNotFound(_0x3f8543,null))[_0x4e0a('0x24')](function(_0x46b1e3){if(_0x46b1e3){if(!utils[_0x4e0a('0xab')](_0xd5500c)){throw new db[(_0x4e0a('0x99'))][(_0x4e0a('0x9a'))](_0x4e0a('0xac'));}return _0x46b1e3[_0x4e0a('0xad')+_[_0x4e0a('0xae')](_0xd5500c[_0x4e0a('0xaf')]())+'Queues'](_0x5ee6a8[_0x4e0a('0x66')][_0x4e0a('0x6a')],{'penalty':_0x5ee6a8[_0x4e0a('0x66')][_0x4e0a('0xb0')]||0x0})['spread'](function(_0x831387){for(var _0x36c619=0x0;_0x36c619<_0x5ee6a8[_0x4e0a('0x66')][_0x4e0a('0x6a')][_0x4e0a('0x5a')];_0x36c619+=0x1){var _0x4e5dd8={'UserId':Number(_0x5ee6a8['params']['id'])};_0x4e5dd8[_[_0x4e0a('0xae')](_0xd5500c[_0x4e0a('0xaf')]())+_0x4e0a('0xb1')]=Number(_0x5ee6a8[_0x4e0a('0x66')][_0x4e0a('0x6a')][_0x36c619]);socket['emit']('user'+_[_0x4e0a('0xae')](_0xd5500c[_0x4e0a('0xaf')]())+_0x4e0a('0xb2'),_0x4e5dd8);}return _0x831387;})[_0x4e0a('0x24')](function(){if(_0xd5500c===_0x4e0a('0xb3')){return db[_0x4e0a('0xb4')][_0x4e0a('0x57')]({'where':{'id':_0x5ee6a8['body'][_0x4e0a('0x6a')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x4e0a('0x24')](function(_0x8e7ef6){var _0x306f24=_0x46b1e3[_0x4e0a('0x34')]({'plain':!![]});var _0x4be885=[];if(_0xd5500c===_0x4e0a('0xb3')&&_0x306f24[_0x4e0a('0x35')]===_0x4e0a('0x31')&&_0x306f24[_0x4e0a('0xa7')]){for(let _0x5a9646=0x0;_0x5a9646<_0x8e7ef6[_0x4e0a('0x5a')];_0x5a9646+=0x1){_0x4be885[_0x4e0a('0x55')]({'membername':_0x306f24['name'],'UserId':_0x306f24['id'],'queue_name':_0x8e7ef6[_0x5a9646][_0x4e0a('0x3f')],'VoiceQueueId':_0x8e7ef6[_0x5a9646]['id'],'interface':_[_0x4e0a('0x71')](_0x306f24['interface'])?util[_0x4e0a('0xb5')]('SIP/%s',_0x306f24[_0x4e0a('0x3f')]):_0x306f24[_0x4e0a('0xaa')],'paused':_0x306f24[_0x4e0a('0xa9')]||![],'penalty':_0x5ee6a8['body'][_0x4e0a('0xb0')]||0x0});}return Promise[_0x4e0a('0x61')](_0x4be885[_0x4e0a('0x3c')](function(_0xe9ced5){return db['UserVoiceQueueRt'][_0x4e0a('0xb6')](_0xe9ced5);}));}return _0x46b1e3;});}})[_0x4e0a('0x24')](respondWithStatusCode(_0x3f8543,null))[_0x4e0a('0x2f')](handleError(_0x3f8543,null));};exports[_0x4e0a('0xb7')]=function(_0x923c38,_0x483d00){var _0x298b37,_0x446dd5;return db[_0x4e0a('0x56')][_0x4e0a('0x3e')]({'where':{'id':_0x923c38[_0x4e0a('0x67')]['id']},'attributes':['id',_0x4e0a('0x3f'),'role']})[_0x4e0a('0x24')](handleEntityNotFound(_0x483d00,null))[_0x4e0a('0x24')](function(_0xf1266a){if(_0xf1266a){_0x298b37=_0xf1266a;if(!_0x923c38['query'][_0x4e0a('0xa6')]||!utils[_0x4e0a('0xab')](_0x923c38[_0x4e0a('0x4e')][_0x4e0a('0xa6')])){throw new db[(_0x4e0a('0x99'))][(_0x4e0a('0x9a'))](_0x4e0a('0xac'));}return _0xf1266a[_0x4e0a('0xb8')+_[_0x4e0a('0xae')](_0x923c38['query']['channel'][_0x4e0a('0xaf')]())+'Queues'](_0x923c38['query'][_0x4e0a('0x6a')]);}})[_0x4e0a('0x24')](function(_0x5ae0d1){if(_[_0x4e0a('0xb9')](_0x923c38[_0x4e0a('0x4e')][_0x4e0a('0x6a')])){for(var _0x22a24c=0x0;_0x22a24c<_0x923c38[_0x4e0a('0x4e')][_0x4e0a('0x6a')][_0x4e0a('0x5a')];_0x22a24c+=0x1){_0x446dd5={'UserId':Number(_0x923c38['params']['id'])};_0x446dd5[_['capitalize'](_0x923c38['query'][_0x4e0a('0xa6')][_0x4e0a('0xaf')]())+_0x4e0a('0xb1')]=Number(_0x923c38[_0x4e0a('0x4e')][_0x4e0a('0x6a')][_0x22a24c]);socket['emit'](_0x4e0a('0x8a')+_[_0x4e0a('0xae')](_0x923c38[_0x4e0a('0x4e')][_0x4e0a('0xa6')][_0x4e0a('0xaf')]())+_0x4e0a('0xba'),_0x446dd5);}}else{_0x446dd5={'UserId':Number(_0x923c38[_0x4e0a('0x67')]['id'])};_0x446dd5[_[_0x4e0a('0xae')](_0x923c38[_0x4e0a('0x4e')][_0x4e0a('0xa6')][_0x4e0a('0xaf')]())+_0x4e0a('0xb1')]=Number(_0x923c38[_0x4e0a('0x4e')][_0x4e0a('0x6a')]);socket[_0x4e0a('0xbb')]('user'+_[_0x4e0a('0xae')](_0x923c38[_0x4e0a('0x4e')][_0x4e0a('0xa6')][_0x4e0a('0xaf')]())+_0x4e0a('0xba'),_0x446dd5);}return _0x5ae0d1;})['then'](function(){if(_0x923c38[_0x4e0a('0x4e')]['channel']==='voice'){return db[_0x4e0a('0xbc')]['destroy']({'where':{'UserId':_0x923c38['params']['id'],'VoiceQueueId':_0x923c38[_0x4e0a('0x4e')][_0x4e0a('0x6a')]},'individualHooks':!![]})[_0x4e0a('0x24')](function(){return _0x298b37;});}return _0x298b37;})[_0x4e0a('0x24')](respondWithStatusCode(_0x483d00,null))[_0x4e0a('0x2f')](handleError(_0x483d00,null));};exports[_0x4e0a('0xbd')]=function(_0x378bdf,_0x4a6149){_0x378bdf[_0x4e0a('0x66')][_0x4e0a('0xbe')]=_0x378bdf['file'][_0x4e0a('0xbf')];return db[_0x4e0a('0x56')][_0x4e0a('0x3e')]({'where':{'id':_0x378bdf[_0x4e0a('0x67')]['id']}})[_0x4e0a('0x24')](handleEntityNotFound(_0x4a6149,null))['then'](saveUpdates(_0x378bdf[_0x4e0a('0x66')],null))[_0x4e0a('0x24')](respondWithResult(_0x4a6149,null))[_0x4e0a('0x2f')](handleError(_0x4a6149,null));};exports[_0x4e0a('0xc0')]=function(_0x286cd6,_0x2afecc){var _0x448a04=path[_0x4e0a('0xc1')](config[_0x4e0a('0xc2')],_0x4e0a('0xc3'));return db[_0x4e0a('0x56')][_0x4e0a('0x3e')]({'where':{'id':_0x286cd6[_0x4e0a('0x67')]['id']},'attributes':['id',_0x4e0a('0xbe')],'raw':!![]})[_0x4e0a('0x24')](handleEntityNotFound(_0x2afecc,null))['then'](function(_0x5169a1){if(_0x5169a1){if(_['isNil'](_0x5169a1[_0x4e0a('0xbe')])){return _0x2afecc[_0x4e0a('0xc4')](_0x448a04);}else{if(!fs[_0x4e0a('0xc5')](path['join'](config[_0x4e0a('0xc2')],_0x4e0a('0xc6'),_0x5169a1[_0x4e0a('0xbe')]))){return _0x2afecc[_0x4e0a('0xc4')](_0x448a04);}return _0x2afecc[_0x4e0a('0xc4')](path[_0x4e0a('0xc1')](config[_0x4e0a('0xc2')],_0x4e0a('0xc6'),_0x5169a1['userpic']));}}})['catch'](handleError(_0x2afecc,null));};exports['getOpenTabs']=function(_0x1c2a20,_0x2b4552){return db[_0x4e0a('0x56')]['find']({'where':{'id':_0x1c2a20[_0x4e0a('0x67')]['id']},'attributes':['id']})[_0x4e0a('0x24')](handleEntityNotFound(_0x2b4552,null))[_0x4e0a('0x24')](function(_0x2c28f9){var _0x3b1886=[];values=_0x2c28f9['dataValues'];_0x3b1886[_0x4e0a('0x55')](get_open_tabs(_0x4e0a('0x5b'),_0x2c28f9[_0x4e0a('0x5c')]));_0x3b1886[_0x4e0a('0x55')](get_open_tabs(_0x4e0a('0x5d'),_0x2c28f9['dataValues']));_0x3b1886[_0x4e0a('0x55')](get_open_tabs('openchannel',_0x2c28f9[_0x4e0a('0x5c')]));_0x3b1886[_0x4e0a('0x55')](get_open_tabs(_0x4e0a('0x60'),_0x2c28f9['dataValues']));_0x3b1886['push'](get_open_tabs(_0x4e0a('0x5e'),_0x2c28f9[_0x4e0a('0x5c')]));_0x3b1886['push'](get_open_tabs(_0x4e0a('0x5f'),_0x2c28f9['dataValues']));return Promise[_0x4e0a('0x61')](_0x3b1886);})[_0x4e0a('0x24')](function(_0x51e9ff){if(_0x51e9ff){var _0x5b1d8a=_[_0x4e0a('0x3c')](values[_0x4e0a('0xc7')],function(_0x2112bf){return{'channel':_0x4e0a('0xc8'),'id':_0x2112bf['id'],'createdAt':_0x2112bf[_0x4e0a('0xc9')]};});var _0x337958=_['map'](values[_0x4e0a('0xca')],function(_0x4cc4a3){return{'channel':_0x4e0a('0xcb'),'id':_0x4cc4a3['id'],'createdAt':_0x4cc4a3['createdAt']};});var _0x2c774a=_[_0x4e0a('0x3c')](values[_0x4e0a('0xcc')],function(_0x52740f){return{'channel':_0x4e0a('0xcd'),'id':_0x52740f['id'],'createdAt':_0x52740f[_0x4e0a('0xc9')]};});var _0x235b01=_[_0x4e0a('0x3c')](values['MailOpenTabs'],function(_0x1429fb){return{'channel':_0x4e0a('0xce'),'id':_0x1429fb['id'],'createdAt':_0x1429fb[_0x4e0a('0xc9')]};});var _0x3ee0c7=_[_0x4e0a('0x3c')](values['SmsOpenTabs'],function(_0x4dc9f9){return{'channel':_0x4e0a('0xcf'),'id':_0x4dc9f9['id'],'createdAt':_0x4dc9f9['createdAt']};});var _0x480449=_[_0x4e0a('0x3c')](values[_0x4e0a('0xd0')],function(_0x222bc6){return{'channel':_0x4e0a('0xd1'),'id':_0x222bc6['id'],'createdAt':_0x222bc6[_0x4e0a('0xc9')]};});var _0x4d7ddf=_[_0x4e0a('0xd2')](_0x5b1d8a,_0x337958,_0x2c774a,_0x235b01,_0x3ee0c7,_0x480449);var _0x24213d={'count':_0x4d7ddf[_0x4e0a('0x5a')],'rows':_0x4d7ddf};return _0x24213d;}else return null;})[_0x4e0a('0x24')](respondWithResult(_0x2b4552,null))['catch'](handleError(_0x2b4552,null));};exports['getContacts']=function(_0x22c9bb,_0x2bcbce){var _0x555b39={};return db[_0x4e0a('0x56')][_0x4e0a('0xa0')]({'where':{'id':_0x22c9bb[_0x4e0a('0x67')]['id']}})['then'](function(_0x4f9606){if(!_0x4f9606){throw new APINotFoundError(util[_0x4e0a('0xb5')](_0x4e0a('0xd3'),_0x22c9bb[_0x4e0a('0x67')]['id']));}return contacts[_0x4e0a('0x68')]();})[_0x4e0a('0x24')](function(_0x2a6581){_0x22c9bb[_0x4e0a('0x4e')][_0x4e0a('0x56')]=_0x22c9bb[_0x4e0a('0x67')]['id'];_0x555b39=qs[_0x4e0a('0x63')](_0x2a6581,_0x22c9bb);if(_0x22c9bb['query']['hasOwnProperty']('includeAll')){_0x555b39[_0x4e0a('0x50')]=[{'model':db[_0x4e0a('0xd4')],'as':'List','required':![]},{'model':db[_0x4e0a('0xd5')],'as':'Tags','attributes':['id',_0x4e0a('0x3f'),_0x4e0a('0xd6')],'where':_0x22c9bb[_0x4e0a('0x4e')][_0x4e0a('0xd7')]?{'id':_0x22c9bb[_0x4e0a('0x4e')][_0x4e0a('0xd7')]}:undefined,'required':_0x22c9bb[_0x4e0a('0x4e')][_0x4e0a('0xd7')]?!![]:![]}];}return contacts['findAll'](_0x22c9bb[_0x4e0a('0x4e')],_0x22c9bb[_0x4e0a('0x8a')],_0x555b39,_0x2a6581);})['then'](respondWithFilteredResult(_0x2bcbce,_0x555b39))[_0x4e0a('0x2f')](APIHandleError(_0x2bcbce));};exports[_0x4e0a('0xd8')]=function(_0x31f255,_0x50417b){var _0x503f66;var _0x1f03aa={};var _0x409627;return db[_0x4e0a('0x56')][_0x4e0a('0xa0')]({'where':{'id':_0x31f255[_0x4e0a('0x67')]['id']},'attributes':['id',_0x4e0a('0x3f'),_0x4e0a('0x35')]})[_0x4e0a('0x24')](handleEntityNotFound(_0x50417b,null))[_0x4e0a('0x24')](function(_0x8476ac){if(!utils[_0x4e0a('0xab')](_0x31f255['query']['channel'])){throw new db[(_0x4e0a('0x99'))][(_0x4e0a('0x9a'))](_0x4e0a('0xac'));}_0x503f66=_0x8476ac;var _0x4ff57a={};_0x4ff57a['model']=_[_0x4e0a('0xd9')](db[_[_0x4e0a('0xae')](_0x31f255['query'][_0x4e0a('0xa6')])+_0x4e0a('0xda')][_0x4e0a('0x43')]);_0x4ff57a[_0x4e0a('0x4e')]=_[_0x4e0a('0xd9')](_0x31f255['query']);_0x4ff57a[_0x4e0a('0xdb')]=_[_0x4e0a('0xdc')](_0x4ff57a[_0x4e0a('0xdd')],_0x4ff57a[_0x4e0a('0x4e')]);_0x1f03aa['attributes']=_[_0x4e0a('0xdc')](_0x4ff57a[_0x4e0a('0xdd')],qs[_0x4e0a('0xde')](_0x31f255[_0x4e0a('0x4e')][_0x4e0a('0xde')]));_0x1f03aa[_0x4e0a('0x54')]=_0x1f03aa['attributes'][_0x4e0a('0x5a')]?_0x1f03aa[_0x4e0a('0x54')]:_0x4ff57a[_0x4e0a('0xdd')];_0x1f03aa[_0x4e0a('0xdf')]=qs[_0x4e0a('0xe0')](_0x31f255[_0x4e0a('0x4e')]['sort']);_0x1f03aa['where']=qs['filters'](_[_0x4e0a('0xe1')](_0x31f255[_0x4e0a('0x4e')],_0x4ff57a[_0x4e0a('0xdb')]));if(_0x31f255['query'][_0x4e0a('0x3a')]){_0x1f03aa['where']=_['merge'](_0x1f03aa[_0x4e0a('0x4d')],{'$or':_[_0x4e0a('0x3c')](_0x1f03aa[_0x4e0a('0x54')],function(_0x1cefda){var _0x398817={};_0x398817[_0x1cefda]={'$like':'%'+_0x31f255[_0x4e0a('0x4e')][_0x4e0a('0x3a')]+'%'};return _0x398817;})});}_0x1f03aa=_[_0x4e0a('0x64')]({},_0x1f03aa,_0x31f255[_0x4e0a('0xe2')]);switch(_0x503f66[_0x4e0a('0x35')]){case _0x4e0a('0x36'):return db[_[_0x4e0a('0xae')](_0x31f255[_0x4e0a('0x4e')]['channel'])+_0x4e0a('0xda')][_0x4e0a('0x57')](_0x1f03aa);case _0x4e0a('0x8a'):case _0x4e0a('0x31'):return _0x503f66[_0x4e0a('0x34')+_[_0x4e0a('0xae')](_0x31f255[_0x4e0a('0x4e')][_0x4e0a('0xa6')])+_0x4e0a('0xe3')](_0x1f03aa);default:throw new db[(_0x4e0a('0x99'))][(_0x4e0a('0x9a'))](_0x4e0a('0xe4'));}})['then'](function(_0x58580c){_0x409627=_0x58580c[_0x4e0a('0x5a')];if(!_0x31f255[_0x4e0a('0x4e')][_0x4e0a('0xe5')]('nolimit')){_0x1f03aa[_0x4e0a('0x20')]=qs[_0x4e0a('0x20')](_0x31f255['query'][_0x4e0a('0x20')]);_0x1f03aa[_0x4e0a('0x1f')]=qs[_0x4e0a('0x1f')](_0x31f255['query'][_0x4e0a('0x1f')]);}switch(_0x503f66[_0x4e0a('0x35')]){case'admin':return db[_[_0x4e0a('0xae')](_0x31f255[_0x4e0a('0x4e')][_0x4e0a('0xa6')])+_0x4e0a('0xda')][_0x4e0a('0x57')](_0x1f03aa);case _0x4e0a('0x8a'):case _0x4e0a('0x31'):return _0x503f66['get'+_['capitalize'](_0x31f255['query']['channel'])+_0x4e0a('0xe3')](_0x1f03aa);}})[_0x4e0a('0x24')](function(_0x1d4f70){return{'count':_0x409627,'rows':_0x1d4f70};})['then'](respondWithResult(_0x50417b,null))[_0x4e0a('0x2f')](handleError(_0x50417b,null));};exports[_0x4e0a('0xe6')]=function(_0x508c82,_0x1169cc){var _0x4dc6bc={};var _0x194337={};var _0x5d5e1b;var _0x2a2e46;return db[_0x4e0a('0x56')][_0x4e0a('0xa0')]({'where':{'id':_0x508c82['params']['id']}})[_0x4e0a('0x24')](handleEntityNotFound(_0x1169cc,null))['then'](function(_0x142f93){if(_0x142f93){_0x5d5e1b=_0x142f93;_0x194337[_0x4e0a('0xdd')]=_['keys'](db['UserVoiceQueueRt'][_0x4e0a('0x43')]);_0x194337[_0x4e0a('0x4e')]=_[_0x4e0a('0xd9')](_0x508c82[_0x4e0a('0x4e')]);_0x194337['filters']=_[_0x4e0a('0xdc')](_0x194337[_0x4e0a('0xdd')],_0x194337[_0x4e0a('0x4e')]);_0x4dc6bc[_0x4e0a('0x54')]=_['intersection'](_0x194337[_0x4e0a('0xdd')],qs[_0x4e0a('0xde')](_0x508c82['query'][_0x4e0a('0xde')]));_0x4dc6bc['attributes']=_0x4dc6bc['attributes'][_0x4e0a('0x5a')]?_0x4dc6bc[_0x4e0a('0x54')]:_0x194337['model'];_0x4dc6bc['order']=qs[_0x4e0a('0xe0')](_0x508c82[_0x4e0a('0x4e')][_0x4e0a('0xe0')]);_0x4dc6bc[_0x4e0a('0x4d')]=qs['filters'](_[_0x4e0a('0xe1')](_0x508c82[_0x4e0a('0x4e')],_0x194337[_0x4e0a('0xdb')]));if(_0x508c82[_0x4e0a('0x4e')][_0x4e0a('0x3a')]){_0x4dc6bc['where']=_[_0x4e0a('0x64')](_0x4dc6bc['where'],{'$or':_['map'](_0x4dc6bc[_0x4e0a('0x54')],function(_0x470c4a){var _0x935de3={};_0x935de3[_0x470c4a]={'$like':'%'+_0x508c82['query'][_0x4e0a('0x3a')]+'%'};return _0x935de3;})});}_0x4dc6bc=_['merge']({},_0x4dc6bc,_0x508c82[_0x4e0a('0xe2')]);return _0x5d5e1b['getVoiceQueuesRt'](_0x4dc6bc);}})[_0x4e0a('0x24')](function(_0x35f5c9){if(_0x35f5c9){_0x2a2e46=_0x35f5c9['length'];if(!_0x508c82[_0x4e0a('0x4e')][_0x4e0a('0xe5')](_0x4e0a('0xe7'))){_0x4dc6bc[_0x4e0a('0x20')]=qs[_0x4e0a('0x20')](_0x508c82[_0x4e0a('0x4e')][_0x4e0a('0x20')]);_0x4dc6bc['offset']=qs[_0x4e0a('0x1f')](_0x508c82[_0x4e0a('0x4e')][_0x4e0a('0x1f')]);}return _0x5d5e1b[_0x4e0a('0xe6')](_0x4dc6bc);}})[_0x4e0a('0x24')](function(_0x919dd6){if(_0x919dd6){return _0x919dd6?{'count':_0x2a2e46,'rows':_0x919dd6}:null;}})[_0x4e0a('0x24')](respondWithResult(_0x1169cc,null))['catch'](handleError(_0x1169cc,null));};exports[_0x4e0a('0xe8')]=function(_0x39e932,_0x3e429b){var _0x1d2da2={};var _0x9d5e3f={};var _0xed06ea;var _0x58bddf;return db['User'][_0x4e0a('0xa0')]({'where':{'id':_0x39e932[_0x4e0a('0x67')]['id']}})['then'](handleEntityNotFound(_0x3e429b,null))[_0x4e0a('0x24')](function(_0x23468f){if(_0x23468f){_0xed06ea=_0x23468f;_0x9d5e3f[_0x4e0a('0xdd')]=_['keys'](db['ChatGroup'][_0x4e0a('0x43')]);_0x9d5e3f['query']=_[_0x4e0a('0xd9')](_0x39e932['query']);_0x9d5e3f['filters']=_[_0x4e0a('0xdc')](_0x9d5e3f[_0x4e0a('0xdd')],_0x9d5e3f[_0x4e0a('0x4e')]);_0x1d2da2[_0x4e0a('0x54')]=_[_0x4e0a('0xdc')](_0x9d5e3f[_0x4e0a('0xdd')],qs[_0x4e0a('0xde')](_0x39e932[_0x4e0a('0x4e')][_0x4e0a('0xde')]));_0x1d2da2['attributes']=_0x1d2da2[_0x4e0a('0x54')][_0x4e0a('0x5a')]?_0x1d2da2[_0x4e0a('0x54')]:_0x9d5e3f[_0x4e0a('0xdd')];_0x1d2da2[_0x4e0a('0xdf')]=qs[_0x4e0a('0xe0')](_0x39e932[_0x4e0a('0x4e')][_0x4e0a('0xe0')]);_0x1d2da2[_0x4e0a('0x4d')]=qs['filters'](_[_0x4e0a('0xe1')](_0x39e932[_0x4e0a('0x4e')],_0x9d5e3f[_0x4e0a('0xdb')]));if(_0x39e932[_0x4e0a('0x4e')][_0x4e0a('0x3a')]){_0x1d2da2[_0x4e0a('0x4d')]=_[_0x4e0a('0x64')](_0x1d2da2[_0x4e0a('0x4d')],{'$or':_[_0x4e0a('0x3c')](_0x1d2da2[_0x4e0a('0x54')],function(_0x137d44){var _0x5833d0={};_0x5833d0[_0x137d44]={'$like':'%'+_0x39e932[_0x4e0a('0x4e')][_0x4e0a('0x3a')]+'%'};return _0x5833d0;})});}_0x1d2da2=_[_0x4e0a('0x64')]({},_0x1d2da2,_0x39e932[_0x4e0a('0xe2')]);return _0xed06ea[_0x4e0a('0xe8')](_0x1d2da2);}})['then'](function(_0x58ab61){if(_0x58ab61){_0x58bddf=_0x58ab61[_0x4e0a('0x5a')];if(!_0x39e932[_0x4e0a('0x4e')][_0x4e0a('0xe5')](_0x4e0a('0xe7'))){_0x1d2da2[_0x4e0a('0x20')]=qs[_0x4e0a('0x20')](_0x39e932['query'][_0x4e0a('0x20')]);_0x1d2da2[_0x4e0a('0x1f')]=qs['offset'](_0x39e932[_0x4e0a('0x4e')][_0x4e0a('0x1f')]);}return _0xed06ea[_0x4e0a('0xe8')](_0x1d2da2);}})[_0x4e0a('0x24')](function(_0x138b6d){if(_0x138b6d){return _0x138b6d?{'count':_0x58bddf,'rows':_0x138b6d}:null;}})[_0x4e0a('0x24')](respondWithResult(_0x3e429b,null))[_0x4e0a('0x2f')](handleError(_0x3e429b,null));};exports[_0x4e0a('0xe9')]=function(_0x54c3f6,_0x4c4651){var _0x4aea55={'raw':!![],'where':{}};var _0x2fb5fe={};var _0x39a357={'count':0x0,'rows':[]};return db[_0x4e0a('0x56')][_0x4e0a('0xa0')]({'where':{'id':_0x54c3f6['params']['id']}})['then'](handleEntityNotFound(_0x4c4651,null))['then'](function(_0x3c7e81){if(_0x3c7e81){_0x2fb5fe[_0x4e0a('0xdd')]=_[_0x4e0a('0xd9')](db[_0x4e0a('0xea')][_0x4e0a('0x43')]);_0x2fb5fe['query']=_['keys'](_0x54c3f6['query']);_0x2fb5fe['filters']=_[_0x4e0a('0xdc')](_0x2fb5fe[_0x4e0a('0xdd')],_0x2fb5fe[_0x4e0a('0x4e')]);_0x4aea55[_0x4e0a('0x54')]=_[_0x4e0a('0xdc')](_0x2fb5fe[_0x4e0a('0xdd')],qs['fields'](_0x54c3f6[_0x4e0a('0x4e')]['fields']));_0x4aea55['attributes']=_0x4aea55[_0x4e0a('0x54')][_0x4e0a('0x5a')]?_0x4aea55[_0x4e0a('0x54')]:_0x2fb5fe[_0x4e0a('0xdd')];if(!_0x54c3f6[_0x4e0a('0x4e')][_0x4e0a('0xe5')]('nolimit')){_0x4aea55[_0x4e0a('0x20')]=qs['limit'](_0x54c3f6[_0x4e0a('0x4e')][_0x4e0a('0x20')]);_0x4aea55[_0x4e0a('0x1f')]=qs[_0x4e0a('0x1f')](_0x54c3f6[_0x4e0a('0x4e')][_0x4e0a('0x1f')]);}_0x4aea55[_0x4e0a('0xdf')]=qs[_0x4e0a('0xe0')](_0x54c3f6['query']['sort']);_0x4aea55[_0x4e0a('0x4d')]=qs['filters'](_[_0x4e0a('0xe1')](_0x54c3f6[_0x4e0a('0x4e')],_0x2fb5fe[_0x4e0a('0xdb')]));_0x4aea55[_0x4e0a('0x4d')][_0x4e0a('0xeb')]=_0x3c7e81['id'];if(_0x54c3f6[_0x4e0a('0x4e')][_0x4e0a('0x3a')]){_0x4aea55[_0x4e0a('0x4d')]=_[_0x4e0a('0x64')](_0x4aea55['where'],{'$or':_[_0x4e0a('0x3c')](_0x4aea55[_0x4e0a('0x54')],function(_0x2414c4){var _0x1c81a1={};_0x1c81a1[_0x2414c4]={'$like':'%'+_0x54c3f6['query'][_0x4e0a('0x3a')]+'%'};return _0x1c81a1;})});}_0x4aea55=_[_0x4e0a('0x64')]({},_0x4aea55,_0x54c3f6[_0x4e0a('0xe2')]);return db[_0x4e0a('0xea')][_0x4e0a('0x1e')]({'where':_0x4aea55[_0x4e0a('0x4d')]})[_0x4e0a('0x24')](function(_0x548f98){_0x39a357[_0x4e0a('0x1e')]=_0x548f98;if(_0x54c3f6[_0x4e0a('0x4e')][_0x4e0a('0x4f')]){_0x4aea55[_0x4e0a('0x50')]=[{'all':!![]}];}return db[_0x4e0a('0xea')]['findAll'](_0x4aea55);})[_0x4e0a('0x24')](function(_0x2c31df){_0x39a357['rows']=_0x2c31df;return _0x39a357;});}})[_0x4e0a('0x24')](respondWithFilteredResult(_0x4c4651,_0x4aea55))[_0x4e0a('0x2f')](handleError(_0x4c4651,null));};exports['getScreenRecordings']=function(_0x14e8e8,_0x5e8d66){var _0x43c088={'raw':!![],'where':{}};var _0x1c99de={};var _0x549c47={'count':0x0,'rows':[]};return db['User'][_0x4e0a('0xa0')]({'where':{'id':_0x14e8e8['params']['id']}})[_0x4e0a('0x24')](handleEntityNotFound(_0x5e8d66,null))[_0x4e0a('0x24')](function(_0x11d2ea){if(_0x11d2ea){_0x1c99de[_0x4e0a('0xdd')]=_['keys'](db[_0x4e0a('0xec')][_0x4e0a('0x43')]);_0x1c99de['query']=_['keys'](_0x14e8e8[_0x4e0a('0x4e')]);_0x1c99de['filters']=_[_0x4e0a('0xdc')](_0x1c99de[_0x4e0a('0xdd')],_0x1c99de[_0x4e0a('0x4e')]);_0x43c088[_0x4e0a('0x54')]=_[_0x4e0a('0xdc')](_0x1c99de[_0x4e0a('0xdd')],qs['fields'](_0x14e8e8['query'][_0x4e0a('0xde')]));_0x43c088[_0x4e0a('0x54')]=_0x43c088[_0x4e0a('0x54')][_0x4e0a('0x5a')]?_0x43c088[_0x4e0a('0x54')]:_0x1c99de['model'];if(!_0x14e8e8[_0x4e0a('0x4e')][_0x4e0a('0xe5')](_0x4e0a('0xe7'))){_0x43c088[_0x4e0a('0x20')]=qs[_0x4e0a('0x20')](_0x14e8e8[_0x4e0a('0x4e')][_0x4e0a('0x20')]);_0x43c088[_0x4e0a('0x1f')]=qs[_0x4e0a('0x1f')](_0x14e8e8[_0x4e0a('0x4e')][_0x4e0a('0x1f')]);}_0x43c088[_0x4e0a('0xdf')]=qs[_0x4e0a('0xe0')](_0x14e8e8[_0x4e0a('0x4e')][_0x4e0a('0xe0')]);_0x43c088[_0x4e0a('0x4d')]=qs[_0x4e0a('0xdb')](_[_0x4e0a('0xe1')](_0x14e8e8[_0x4e0a('0x4e')],_0x1c99de[_0x4e0a('0xdb')]));_0x43c088[_0x4e0a('0x4d')][_0x4e0a('0xeb')]=_0x11d2ea['id'];if(_0x14e8e8[_0x4e0a('0x4e')]['filter']){_0x43c088[_0x4e0a('0x4d')]=_[_0x4e0a('0x64')](_0x43c088[_0x4e0a('0x4d')],{'$or':_[_0x4e0a('0x3c')](_0x43c088['attributes'],function(_0x286d2a){var _0x521ce7={};_0x521ce7[_0x286d2a]={'$like':'%'+_0x14e8e8[_0x4e0a('0x4e')][_0x4e0a('0x3a')]+'%'};return _0x521ce7;})});}_0x43c088=_[_0x4e0a('0x64')]({},_0x43c088,_0x14e8e8[_0x4e0a('0xe2')]);return db[_0x4e0a('0xec')][_0x4e0a('0x1e')]({'where':_0x43c088[_0x4e0a('0x4d')]})[_0x4e0a('0x24')](function(_0x301a03){_0x549c47[_0x4e0a('0x1e')]=_0x301a03;if(_0x14e8e8[_0x4e0a('0x4e')][_0x4e0a('0x4f')]){_0x43c088[_0x4e0a('0x50')]=[{'all':!![]}];}return db[_0x4e0a('0xec')][_0x4e0a('0x57')](_0x43c088);})['then'](function(_0xa5229f){_0x549c47[_0x4e0a('0x58')]=_0xa5229f;return _0x549c47;});}})[_0x4e0a('0x24')](respondWithFilteredResult(_0x5e8d66,_0x43c088))['catch'](handleError(_0x5e8d66,null));};exports['getChatInteractions']=function(_0x330146,_0x2ce7ac){var _0x54a81a={};var _0x25e6cd={};var _0x223f6d;var _0xbe315e;return db['User'][_0x4e0a('0xa0')]({'where':{'id':_0x330146[_0x4e0a('0x67')]['id']}})['then'](handleEntityNotFound(_0x2ce7ac,null))[_0x4e0a('0x24')](function(_0x3e40cd){if(_0x3e40cd){_0x223f6d=_0x3e40cd;_0x25e6cd[_0x4e0a('0xdd')]=_[_0x4e0a('0xd9')](db[_0x4e0a('0xed')]['rawAttributes']);_0x25e6cd[_0x4e0a('0x4e')]=_['keys'](_0x330146[_0x4e0a('0x4e')]);_0x25e6cd[_0x4e0a('0xdb')]=_[_0x4e0a('0xdc')](_0x25e6cd[_0x4e0a('0xdd')],_0x25e6cd[_0x4e0a('0x4e')]);_0x54a81a[_0x4e0a('0x54')]=_[_0x4e0a('0xdc')](_0x25e6cd[_0x4e0a('0xdd')],qs[_0x4e0a('0xde')](_0x330146[_0x4e0a('0x4e')][_0x4e0a('0xde')]));_0x54a81a[_0x4e0a('0x54')]=_0x54a81a[_0x4e0a('0x54')][_0x4e0a('0x5a')]?_0x54a81a[_0x4e0a('0x54')]:_0x25e6cd[_0x4e0a('0xdd')];_0x54a81a[_0x4e0a('0xdf')]=qs[_0x4e0a('0xe0')](_0x330146[_0x4e0a('0x4e')][_0x4e0a('0xe0')]);_0x54a81a[_0x4e0a('0x4d')]=qs[_0x4e0a('0xdb')](_['pick'](_0x330146['query'],_0x25e6cd['filters']));if(_0x330146[_0x4e0a('0x4e')][_0x4e0a('0x3a')]){_0x54a81a[_0x4e0a('0x4d')]=_['merge'](_0x54a81a[_0x4e0a('0x4d')],{'$or':_[_0x4e0a('0x3c')](_0x54a81a[_0x4e0a('0x54')],function(_0x524869){var _0xe9176d={};_0xe9176d[_0x524869]={'$like':'%'+_0x330146[_0x4e0a('0x4e')][_0x4e0a('0x3a')]+'%'};return _0xe9176d;})});}_0x54a81a=_[_0x4e0a('0x64')]({},_0x54a81a,_0x330146[_0x4e0a('0xe2')]);return _0x223f6d[_0x4e0a('0xee')](_0x54a81a);}})['then'](function(_0x2e471f){if(_0x2e471f){_0xbe315e=_0x2e471f[_0x4e0a('0x5a')];if(!_0x330146[_0x4e0a('0x4e')][_0x4e0a('0xe5')]('nolimit')){_0x54a81a[_0x4e0a('0x20')]=qs['limit'](_0x330146[_0x4e0a('0x4e')][_0x4e0a('0x20')]);_0x54a81a[_0x4e0a('0x1f')]=qs['offset'](_0x330146['query'][_0x4e0a('0x1f')]);}return _0x223f6d['getChatInteractions'](_0x54a81a);}})[_0x4e0a('0x24')](function(_0x5cb0cd){if(_0x5cb0cd){return _0x5cb0cd?{'count':_0xbe315e,'rows':_0x5cb0cd}:null;}})[_0x4e0a('0x24')](respondWithResult(_0x2ce7ac,null))[_0x4e0a('0x2f')](handleError(_0x2ce7ac,null));};exports[_0x4e0a('0xef')]=function(_0x386250,_0x4d6399){var _0x44dbe6={};var _0x173b00={};var _0x1ff782;var _0x3a1421;return db[_0x4e0a('0x56')][_0x4e0a('0xa0')]({'where':{'id':_0x386250['params']['id']}})[_0x4e0a('0x24')](handleEntityNotFound(_0x4d6399,null))[_0x4e0a('0x24')](function(_0x37da1e){if(_0x37da1e){_0x1ff782=_0x37da1e;_0x173b00['model']=_[_0x4e0a('0xd9')](db[_0x4e0a('0xf0')]['rawAttributes']);_0x173b00[_0x4e0a('0x4e')]=_[_0x4e0a('0xd9')](_0x386250['query']);_0x173b00['filters']=_[_0x4e0a('0xdc')](_0x173b00[_0x4e0a('0xdd')],_0x173b00['query']);_0x44dbe6['attributes']=_['intersection'](_0x173b00[_0x4e0a('0xdd')],qs[_0x4e0a('0xde')](_0x386250[_0x4e0a('0x4e')][_0x4e0a('0xde')]));_0x44dbe6[_0x4e0a('0x54')]=_0x44dbe6[_0x4e0a('0x54')]['length']?_0x44dbe6['attributes']:_0x173b00[_0x4e0a('0xdd')];_0x44dbe6[_0x4e0a('0xdf')]=qs[_0x4e0a('0xe0')](_0x386250[_0x4e0a('0x4e')][_0x4e0a('0xe0')]);_0x44dbe6[_0x4e0a('0x4d')]=qs[_0x4e0a('0xdb')](_[_0x4e0a('0xe1')](_0x386250['query'],_0x173b00[_0x4e0a('0xdb')]));if(_0x386250[_0x4e0a('0x4e')]['filter']){_0x44dbe6['where']=_[_0x4e0a('0x64')](_0x44dbe6[_0x4e0a('0x4d')],{'$or':_[_0x4e0a('0x3c')](_0x44dbe6[_0x4e0a('0x54')],function(_0x284bcb){var _0x2390a1={};_0x2390a1[_0x284bcb]={'$like':'%'+_0x386250[_0x4e0a('0x4e')]['filter']+'%'};return _0x2390a1;})});}_0x44dbe6=_[_0x4e0a('0x64')]({},_0x44dbe6,_0x386250['options']);return _0x1ff782[_0x4e0a('0xef')](_0x44dbe6);}})[_0x4e0a('0x24')](function(_0x3ece91){if(_0x3ece91){_0x3a1421=_0x3ece91[_0x4e0a('0x5a')];if(!_0x386250[_0x4e0a('0x4e')][_0x4e0a('0xe5')]('nolimit')){_0x44dbe6[_0x4e0a('0x20')]=qs[_0x4e0a('0x20')](_0x386250['query'][_0x4e0a('0x20')]);_0x44dbe6[_0x4e0a('0x1f')]=qs[_0x4e0a('0x1f')](_0x386250[_0x4e0a('0x4e')][_0x4e0a('0x1f')]);}return _0x1ff782[_0x4e0a('0xef')](_0x44dbe6);}})[_0x4e0a('0x24')](function(_0x291f5e){if(_0x291f5e){return _0x291f5e?{'count':_0x3a1421,'rows':_0x291f5e}:null;}})[_0x4e0a('0x24')](respondWithResult(_0x4d6399,null))['catch'](handleError(_0x4d6399,null));};exports[_0x4e0a('0xf1')]=function(_0x24dbf8,_0x511b4f){var _0x18fc55={'raw':!![],'where':{}};var _0x3cd17a={};var _0x2d25bf={'count':0x0,'rows':[]};return db[_0x4e0a('0x56')][_0x4e0a('0xa0')]({'where':{'id':_0x24dbf8[_0x4e0a('0x67')]['id']}})[_0x4e0a('0x24')](handleEntityNotFound(_0x511b4f,null))[_0x4e0a('0x24')](function(_0x2a6ae3){if(_0x2a6ae3){_0x3cd17a[_0x4e0a('0xdd')]=_[_0x4e0a('0xd9')](db[_0x4e0a('0xf2')][_0x4e0a('0x43')]);_0x3cd17a[_0x4e0a('0x4e')]=_[_0x4e0a('0xd9')](_0x24dbf8['query']);_0x3cd17a[_0x4e0a('0xdb')]=_[_0x4e0a('0xdc')](_0x3cd17a[_0x4e0a('0xdd')],_0x3cd17a['query']);_0x18fc55[_0x4e0a('0x54')]=_[_0x4e0a('0xdc')](_0x3cd17a['model'],qs['fields'](_0x24dbf8[_0x4e0a('0x4e')][_0x4e0a('0xde')]));_0x18fc55['attributes']=_0x18fc55[_0x4e0a('0x54')]['length']?_0x18fc55[_0x4e0a('0x54')]:_0x3cd17a[_0x4e0a('0xdd')];if(!_0x24dbf8['query'][_0x4e0a('0xe5')](_0x4e0a('0xe7'))){_0x18fc55[_0x4e0a('0x20')]=qs['limit'](_0x24dbf8[_0x4e0a('0x4e')][_0x4e0a('0x20')]);_0x18fc55[_0x4e0a('0x1f')]=qs['offset'](_0x24dbf8[_0x4e0a('0x4e')][_0x4e0a('0x1f')]);}_0x18fc55[_0x4e0a('0xdf')]=qs[_0x4e0a('0xe0')](_0x24dbf8[_0x4e0a('0x4e')][_0x4e0a('0xe0')]);_0x18fc55[_0x4e0a('0x4d')]=qs['filters'](_[_0x4e0a('0xe1')](_0x24dbf8['query'],_0x3cd17a[_0x4e0a('0xdb')]));_0x18fc55[_0x4e0a('0x4d')][_0x4e0a('0xeb')]=_0x2a6ae3['id'];if(_0x24dbf8['query'][_0x4e0a('0x3a')]){_0x18fc55[_0x4e0a('0x4d')]=_[_0x4e0a('0x64')](_0x18fc55['where'],{'$or':_['map'](_0x18fc55[_0x4e0a('0x54')],function(_0x9f4064){var _0x411634={};_0x411634[_0x9f4064]={'$like':'%'+_0x24dbf8[_0x4e0a('0x4e')]['filter']+'%'};return _0x411634;})});}_0x18fc55=_[_0x4e0a('0x64')]({},_0x18fc55,_0x24dbf8[_0x4e0a('0xe2')]);return db[_0x4e0a('0xf2')][_0x4e0a('0x1e')]({'where':_0x18fc55[_0x4e0a('0x4d')]})['then'](function(_0x32b4a0){_0x2d25bf[_0x4e0a('0x1e')]=_0x32b4a0;if(_0x24dbf8[_0x4e0a('0x4e')][_0x4e0a('0x4f')]){_0x18fc55[_0x4e0a('0x50')]=[{'all':!![]}];}return db[_0x4e0a('0xf2')][_0x4e0a('0x57')](_0x18fc55);})['then'](function(_0x3bc204){_0x2d25bf[_0x4e0a('0x58')]=_0x3bc204;return _0x2d25bf;});}})[_0x4e0a('0x24')](respondWithFilteredResult(_0x511b4f,_0x18fc55))[_0x4e0a('0x2f')](handleError(_0x511b4f,null));};exports[_0x4e0a('0xf3')]=function(_0x51b5b7,_0x312c77){var _0x53c5e1={};var _0x5f04db={};var _0x3913ff;var _0x294469;return db[_0x4e0a('0x56')][_0x4e0a('0xa0')]({'where':{'id':_0x51b5b7[_0x4e0a('0x67')]['id']}})['then'](handleEntityNotFound(_0x312c77,null))[_0x4e0a('0x24')](function(_0x1078f3){if(_0x1078f3){_0x3913ff=_0x1078f3;_0x5f04db[_0x4e0a('0xdd')]=_[_0x4e0a('0xd9')](db[_0x4e0a('0xf4')]['rawAttributes']);_0x5f04db[_0x4e0a('0x4e')]=_['keys'](_0x51b5b7['query']);_0x5f04db['filters']=_['intersection'](_0x5f04db[_0x4e0a('0xdd')],_0x5f04db[_0x4e0a('0x4e')]);_0x53c5e1[_0x4e0a('0x54')]=_[_0x4e0a('0xdc')](_0x5f04db['model'],qs['fields'](_0x51b5b7[_0x4e0a('0x4e')][_0x4e0a('0xde')]));_0x53c5e1[_0x4e0a('0x54')]=_0x53c5e1[_0x4e0a('0x54')][_0x4e0a('0x5a')]?_0x53c5e1[_0x4e0a('0x54')]:_0x5f04db[_0x4e0a('0xdd')];_0x53c5e1[_0x4e0a('0xdf')]=qs['sort'](_0x51b5b7[_0x4e0a('0x4e')][_0x4e0a('0xe0')]);_0x53c5e1[_0x4e0a('0x4d')]=qs[_0x4e0a('0xdb')](_[_0x4e0a('0xe1')](_0x51b5b7[_0x4e0a('0x4e')],_0x5f04db[_0x4e0a('0xdb')]));if(_0x51b5b7[_0x4e0a('0x4e')][_0x4e0a('0x3a')]){_0x53c5e1['where']=_[_0x4e0a('0x64')](_0x53c5e1[_0x4e0a('0x4d')],{'$or':_[_0x4e0a('0x3c')](_0x53c5e1[_0x4e0a('0x54')],function(_0x4c583b){var _0x1a3f53={};_0x1a3f53[_0x4c583b]={'$like':'%'+_0x51b5b7['query'][_0x4e0a('0x3a')]+'%'};return _0x1a3f53;})});}_0x53c5e1=_['merge']({},_0x53c5e1,_0x51b5b7[_0x4e0a('0xe2')]);return _0x3913ff[_0x4e0a('0xf3')](_0x53c5e1);}})['then'](function(_0x3f471f){if(_0x3f471f){_0x294469=_0x3f471f[_0x4e0a('0x5a')];if(!_0x51b5b7[_0x4e0a('0x4e')][_0x4e0a('0xe5')](_0x4e0a('0xe7'))){_0x53c5e1[_0x4e0a('0x20')]=qs[_0x4e0a('0x20')](_0x51b5b7[_0x4e0a('0x4e')][_0x4e0a('0x20')]);_0x53c5e1[_0x4e0a('0x1f')]=qs[_0x4e0a('0x1f')](_0x51b5b7['query'][_0x4e0a('0x1f')]);}return _0x3913ff['getSmsInteractions'](_0x53c5e1);}})[_0x4e0a('0x24')](function(_0x5ede5a){if(_0x5ede5a){return _0x5ede5a?{'count':_0x294469,'rows':_0x5ede5a}:null;}})['then'](respondWithResult(_0x312c77,null))[_0x4e0a('0x2f')](handleError(_0x312c77,null));};exports['getFaxInteractions']=function(_0xda2b43,_0x5e73b){var _0x269898={};var _0x59e8c1={};var _0xe80b65;var _0x333f03;return db[_0x4e0a('0x56')][_0x4e0a('0xa0')]({'where':{'id':_0xda2b43[_0x4e0a('0x67')]['id']}})[_0x4e0a('0x24')](handleEntityNotFound(_0x5e73b,null))[_0x4e0a('0x24')](function(_0x3dca04){if(_0x3dca04){_0xe80b65=_0x3dca04;_0x59e8c1[_0x4e0a('0xdd')]=_[_0x4e0a('0xd9')](db[_0x4e0a('0xf5')]['rawAttributes']);_0x59e8c1[_0x4e0a('0x4e')]=_[_0x4e0a('0xd9')](_0xda2b43[_0x4e0a('0x4e')]);_0x59e8c1[_0x4e0a('0xdb')]=_[_0x4e0a('0xdc')](_0x59e8c1[_0x4e0a('0xdd')],_0x59e8c1['query']);_0x269898[_0x4e0a('0x54')]=_[_0x4e0a('0xdc')](_0x59e8c1[_0x4e0a('0xdd')],qs['fields'](_0xda2b43[_0x4e0a('0x4e')]['fields']));_0x269898['attributes']=_0x269898[_0x4e0a('0x54')][_0x4e0a('0x5a')]?_0x269898[_0x4e0a('0x54')]:_0x59e8c1[_0x4e0a('0xdd')];_0x269898['order']=qs[_0x4e0a('0xe0')](_0xda2b43[_0x4e0a('0x4e')][_0x4e0a('0xe0')]);_0x269898[_0x4e0a('0x4d')]=qs[_0x4e0a('0xdb')](_[_0x4e0a('0xe1')](_0xda2b43[_0x4e0a('0x4e')],_0x59e8c1[_0x4e0a('0xdb')]));if(_0xda2b43[_0x4e0a('0x4e')][_0x4e0a('0x3a')]){_0x269898[_0x4e0a('0x4d')]=_['merge'](_0x269898[_0x4e0a('0x4d')],{'$or':_[_0x4e0a('0x3c')](_0x269898[_0x4e0a('0x54')],function(_0x44e8eb){var _0x82f3ee={};_0x82f3ee[_0x44e8eb]={'$like':'%'+_0xda2b43[_0x4e0a('0x4e')][_0x4e0a('0x3a')]+'%'};return _0x82f3ee;})});}_0x269898=_[_0x4e0a('0x64')]({},_0x269898,_0xda2b43[_0x4e0a('0xe2')]);return _0xe80b65['getFaxInteractions'](_0x269898);}})[_0x4e0a('0x24')](function(_0x389b67){if(_0x389b67){_0x333f03=_0x389b67[_0x4e0a('0x5a')];if(!_0xda2b43[_0x4e0a('0x4e')][_0x4e0a('0xe5')]('nolimit')){_0x269898[_0x4e0a('0x20')]=qs['limit'](_0xda2b43[_0x4e0a('0x4e')][_0x4e0a('0x20')]);_0x269898[_0x4e0a('0x1f')]=qs[_0x4e0a('0x1f')](_0xda2b43['query'][_0x4e0a('0x1f')]);}return _0xe80b65[_0x4e0a('0xf6')](_0x269898);}})[_0x4e0a('0x24')](function(_0x1cfe5c){if(_0x1cfe5c){return _0x1cfe5c?{'count':_0x333f03,'rows':_0x1cfe5c}:null;}})[_0x4e0a('0x24')](respondWithResult(_0x5e73b,null))[_0x4e0a('0x2f')](handleError(_0x5e73b,null));};exports[_0x4e0a('0xf7')]=function(_0x287b42,_0x2d0b5e){var _0x19c00e={};var _0x36dc46={};var _0x17eb96;var _0x269623;return db[_0x4e0a('0x56')][_0x4e0a('0xa0')]({'where':{'id':_0x287b42[_0x4e0a('0x67')]['id']}})[_0x4e0a('0x24')](handleEntityNotFound(_0x2d0b5e,null))['then'](function(_0x1171dd){if(_0x1171dd){_0x17eb96=_0x1171dd;_0x36dc46[_0x4e0a('0xdd')]=_['keys'](db[_0x4e0a('0xf8')][_0x4e0a('0x43')]);_0x36dc46['query']=_['keys'](_0x287b42[_0x4e0a('0x4e')]);_0x36dc46['filters']=_['intersection'](_0x36dc46['model'],_0x36dc46['query']);_0x19c00e['attributes']=_[_0x4e0a('0xdc')](_0x36dc46[_0x4e0a('0xdd')],qs[_0x4e0a('0xde')](_0x287b42[_0x4e0a('0x4e')][_0x4e0a('0xde')]));_0x19c00e[_0x4e0a('0x54')]=_0x19c00e[_0x4e0a('0x54')][_0x4e0a('0x5a')]?_0x19c00e[_0x4e0a('0x54')]:_0x36dc46[_0x4e0a('0xdd')];_0x19c00e[_0x4e0a('0xdf')]=qs[_0x4e0a('0xe0')](_0x287b42[_0x4e0a('0x4e')][_0x4e0a('0xe0')]);_0x19c00e['where']=qs['filters'](_['pick'](_0x287b42[_0x4e0a('0x4e')],_0x36dc46['filters']));if(_0x287b42[_0x4e0a('0x4e')][_0x4e0a('0x3a')]){_0x19c00e[_0x4e0a('0x4d')]=_[_0x4e0a('0x64')](_0x19c00e[_0x4e0a('0x4d')],{'$or':_[_0x4e0a('0x3c')](_0x19c00e[_0x4e0a('0x54')],function(_0x4a2c91){var _0x504b17={};_0x504b17[_0x4a2c91]={'$like':'%'+_0x287b42[_0x4e0a('0x4e')][_0x4e0a('0x3a')]+'%'};return _0x504b17;})});}_0x19c00e=_[_0x4e0a('0x64')]({},_0x19c00e,_0x287b42[_0x4e0a('0xe2')]);return _0x17eb96['getWhatsappInteractions'](_0x19c00e);}})[_0x4e0a('0x24')](function(_0x3c02fe){if(_0x3c02fe){_0x269623=_0x3c02fe[_0x4e0a('0x5a')];if(!_0x287b42[_0x4e0a('0x4e')]['hasOwnProperty'](_0x4e0a('0xe7'))){_0x19c00e[_0x4e0a('0x20')]=qs[_0x4e0a('0x20')](_0x287b42['query'][_0x4e0a('0x20')]);_0x19c00e[_0x4e0a('0x1f')]=qs[_0x4e0a('0x1f')](_0x287b42[_0x4e0a('0x4e')]['offset']);}return _0x17eb96['getWhatsappInteractions'](_0x19c00e);}})[_0x4e0a('0x24')](function(_0x7c0ad9){if(_0x7c0ad9){return _0x7c0ad9?{'count':_0x269623,'rows':_0x7c0ad9}:null;}})[_0x4e0a('0x24')](respondWithResult(_0x2d0b5e,null))[_0x4e0a('0x2f')](handleError(_0x2d0b5e,null));};exports[_0x4e0a('0xf9')]=function(_0x4a6b00,_0x9ba9ee,_0x378314){var _0x26d0d8;var _0x2003a2;var _0x5865f1;var _0x30b35d=!_[_0x4e0a('0x71')](_0x4a6b00[_0x4e0a('0x67')]['id'])?_0x4a6b00[_0x4e0a('0x67')]['id']:!_['isNil'](_0x4a6b00['user']['id'])?_0x4a6b00[_0x4e0a('0x8a')]['id']:null;return db[_0x4e0a('0x56')][_0x4e0a('0x3e')]({'where':{'id':_0x30b35d,'role':{'$or':[_0x4e0a('0x36'),_0x4e0a('0x8a'),_0x4e0a('0x31')]}},'attributes':['id','name','phone',_0x4e0a('0xfa'),_0x4e0a('0x35'),'internal',_0x4e0a('0xa8')]})[_0x4e0a('0x24')](function(_0x130d05){if(_0x130d05){if(_0x130d05['role']==='agent'){_0x26d0d8=_0x130d05;if(_0x4a6b00[_0x4e0a('0x66')]['interface']){_0x5865f1=util[_0x4e0a('0xb5')](_0x4e0a('0xfb'),_0x26d0d8[_0x4a6b00['body']['interface']]);}else if(_0x4a6b00['body'][_0x4e0a('0xfc')]){_0x5865f1=util[_0x4e0a('0xb5')](_0x4e0a('0xfd'),_0x4a6b00[_0x4e0a('0x66')][_0x4e0a('0xfc')]);}else{_0x5865f1=util[_0x4e0a('0xb5')](_0x4e0a('0xfd'),_0x26d0d8[_0x4e0a('0x3f')]);}socket['to'](util['format'](_0x4e0a('0xfe'),_0x26d0d8[_0x4e0a('0x3f')]))['emit'](_0x4e0a('0xff'),{'user':{'id':_0x26d0d8['id'],'name':_0x26d0d8['name']},'ip':_0x4a6b00[_0x4e0a('0x100')][_0x4e0a('0x101')]||_0x4a6b00['connection'][_0x4e0a('0x102')]||_0x4a6b00['socket'][_0x4e0a('0x102')]||_0x4a6b00['connection'][_0x4e0a('0x103')][_0x4e0a('0x102')]});return new Promise(function(_0x444556,_0x1ec808){db[_0x4e0a('0x104')][_0x4e0a('0x105')]()[_0x4e0a('0x24')](_0x30e0df=>{db['UserVoiceQueueRt'][_0x4e0a('0x33')]({'where':{'membername':_0x26d0d8[_0x4e0a('0x3f')]},'individualHooks':!![]},{'transaction':_0x30e0df})['then'](function(){return _0x30e0df[_0x4e0a('0x106')]();})[_0x4e0a('0x24')](_0x444556)[_0x4e0a('0x2f')](_0x1ec808);});});}}else{throw new db[(_0x4e0a('0x99'))]['ValidationError'](_0x4e0a('0x107'));}})[_0x4e0a('0x24')](function(){if(_0x26d0d8){return _0x26d0d8['getVoiceQueues']({'raw':!![]});}})[_0x4e0a('0x24')](function(_0x31aea7){if(_0x26d0d8){if(_0x31aea7){_0x2003a2=_0x31aea7;if(_0x2003a2[_0x4e0a('0x5a')]){var _0x3929c1=_0x2003a2[_0x4e0a('0x3c')](function(_0x59aa0d){return{'membername':_0x26d0d8[_0x4e0a('0x3f')],'UserId':_0x26d0d8['id'],'queue_name':_0x59aa0d[_0x4e0a('0x3f')],'VoiceQueueId':_0x59aa0d['id'],'interface':_0x5865f1,'paused':_0x26d0d8[_0x4e0a('0xa8')]||![],'penalty':_0x59aa0d[_0x4e0a('0x108')]||0x0};});return db[_0x4e0a('0xbc')][_0x4e0a('0x91')](_0x3929c1);}}}})['then'](function(){if(_0x26d0d8){return db[_0x4e0a('0x109')][_0x4e0a('0x57')]({'where':{'membername':_0x26d0d8[_0x4e0a('0x3f')],'exitAt':null}});}})[_0x4e0a('0x24')](function(_0x1d237e){if(_0x26d0d8){var _0x1ff2fa=[];_0x1d237e[_0x4e0a('0x10a')](function(_0x2cc29e){_0x1ff2fa[_0x4e0a('0x55')](_0x2cc29e[_0x4e0a('0x30')]({'exitAt':moment()['format'](_0x4e0a('0x10b'))}));});return Promise[_0x4e0a('0x61')](_0x1ff2fa);}})[_0x4e0a('0x24')](function(){if(_0x26d0d8){var _0xc5173d=[];var _0x1f9ffd=[];var _0x4b1c3e=utils[_0x4e0a('0x10c')]();var _0xee7f40={'membername':_0x26d0d8[_0x4e0a('0x3f')],'interface':_0x5865f1,'enterAt':moment()[_0x4e0a('0xb5')](_0x4e0a('0x10b')),'role':_0x26d0d8[_0x4e0a('0x35')],'internal':_0x26d0d8[_0x4e0a('0x6c')]};_0x4b1c3e[_0x4e0a('0x10a')](function(_0x493cb9){_0xc5173d[_0x4e0a('0x55')](_[_0x4e0a('0x64')]({'channel':_0x493cb9,'type':_0x4e0a('0x10d'),'data1':_0x4a6b00[_0x4e0a('0x66')]['device'],'data2':_0x5865f1},_0xee7f40));if(_0x26d0d8[_0x4e0a('0xa8')]){_0x1f9ffd['push'](_[_0x4e0a('0x64')]({'channel':_0x493cb9,'type':_0x4e0a('0x10e'),'data1':_0x4e0a('0x10f')},_0xee7f40));}});return db[_0x4e0a('0x109')][_0x4e0a('0x91')](_0xc5173d[_0x4e0a('0xd2')](_0x1f9ffd),{'individualHooks':!![]});}})[_0x4e0a('0x24')](function(){if(_0x26d0d8){return _0x26d0d8[_0x4e0a('0x30')]({'online':!![],'lastLoginAt':moment()[_0x4e0a('0xb5')](_0x4e0a('0x10b')),'voicePause':_0x26d0d8[_0x4e0a('0xa8')]||![],'mailPause':_0x26d0d8['loginInPause']||![],'chatPause':_0x26d0d8[_0x4e0a('0xa8')]||![],'faxPause':_0x26d0d8[_0x4e0a('0xa8')]||![],'smsPause':_0x26d0d8['loginInPause']||![],'openchannelPause':_0x26d0d8[_0x4e0a('0xa8')]||![],'whatsappPause':_0x26d0d8[_0x4e0a('0xa8')]||![],'pauseType':_0x26d0d8[_0x4e0a('0xa8')]?_0x4e0a('0x10f'):null,'interface':_0x5865f1,'lastPauseAt':moment()[_0x4e0a('0xb5')](_0x4e0a('0x10b'))});}})[_0x4e0a('0x24')](function(_0x1d51bf){if(_0x4a6b00[_0x4e0a('0x110')]){return _0x378314();}else{return Promise[_0x4e0a('0x111')](_0x1d51bf)[_0x4e0a('0x24')](respondWithResult(_0x9ba9ee,null));}})[_0x4e0a('0x2f')](handleError(_0x9ba9ee,null));};exports[_0x4e0a('0x112')]=function(_0x33d5f9,_0x35052d){var _0x22772f;return db['User'][_0x4e0a('0x3e')]({'where':{'id':_0x33d5f9[_0x4e0a('0x67')]['id'],'role':_0x4e0a('0x31')},'attributes':['id',_0x4e0a('0x3f'),_0x4e0a('0x35')]})['then'](handleEntityNotFound(_0x35052d,null))[_0x4e0a('0x24')](function(_0x5e35a9){if(_0x5e35a9){_0x22772f=_0x5e35a9;return db[_0x4e0a('0xbc')]['destroy']({'where':{'membername':_0x22772f[_0x4e0a('0x3f')]},'individualHooks':!![]});}})['then'](function(){return db[_0x4e0a('0x109')]['findAll']({'where':{'membername':_0x22772f['name'],'exitAt':null}});})[_0x4e0a('0x24')](function(_0x494a7d){var _0x55eaa4=[];_0x494a7d[_0x4e0a('0x10a')](function(_0xda6131){_0x55eaa4[_0x4e0a('0x55')](_0xda6131[_0x4e0a('0x30')]({'exitAt':moment()[_0x4e0a('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x55eaa4);})['then'](function(){return _0x22772f[_0x4e0a('0x30')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x35052d,null))['catch'](handleError(_0x35052d,null));};exports[_0x4e0a('0x113')]=function(_0x71d2a8,_0x21a06e){var _0x391f93;return db[_0x4e0a('0xbc')][_0x4e0a('0x30')]({'paused':0x1},{'where':{'UserId':_0x71d2a8['params']['id']},'individualHooks':!![]})[_0x4e0a('0x24')](function(){return db[_0x4e0a('0x56')]['find']({'where':{'id':_0x71d2a8[_0x4e0a('0x67')]['id'],'role':_0x4e0a('0x31')},'attributes':['id',_0x4e0a('0x3f'),'role',_0x4e0a('0x6c'),_0x4e0a('0xaa'),'online']});})[_0x4e0a('0x24')](handleEntityNotFound(_0x21a06e,null))['then'](function(_0x107f2b){if(_0x107f2b){_0x391f93=_0x107f2b;return respondWithRpcPromise(_0x4e0a('0x114'),_0x4e0a('0x113'),{'id':_0x391f93['id'],'name':_0x391f93[_0x4e0a('0x3f')],'pause':!![]});}})['then'](function(){if(_0x391f93){return db[_0x4e0a('0x109')]['findAll']({'where':{'membername':_0x391f93[_0x4e0a('0x3f')],'type':'PAUSE','exitAt':null}});}})[_0x4e0a('0x24')](function(_0x1d0009){if(_0x1d0009[_0x4e0a('0x5a')]){var _0x4275ea=moment()[_0x4e0a('0xb5')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4f8aa5=0x0,_0x1d0063=_0x1d0009[_0x4e0a('0x5a')];_0x4f8aa5<_0x1d0063;_0x4f8aa5++){_0x1d0009[_0x4f8aa5][_0x4e0a('0x115')]({'exitAt':_0x4275ea});}}})[_0x4e0a('0x24')](function(){var _0x2c7c00=[];var _0x587509=utils['getChannels']();_0x587509[_0x4e0a('0x10a')](function(_0x106c33){_0x2c7c00['push']({'channel':_0x106c33,'membername':_0x391f93['name'],'interface':_[_0x4e0a('0x71')](_0x391f93[_0x4e0a('0xaa')])?util[_0x4e0a('0xb5')](_0x4e0a('0xfd'),_0x391f93[_0x4e0a('0x3f')]):_0x391f93[_0x4e0a('0xaa')],'type':_0x4e0a('0x10e'),'enterAt':moment()[_0x4e0a('0xb5')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x71d2a8[_0x4e0a('0x66')][_0x4e0a('0x45')]||_0x4e0a('0x116'),'role':_0x391f93[_0x4e0a('0x35')],'internal':_0x391f93[_0x4e0a('0x6c')]});});return db[_0x4e0a('0x109')][_0x4e0a('0x91')](_0x2c7c00,{'individualHooks':!![]});})['then'](function(){return _0x391f93[_0x4e0a('0x30')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x71d2a8[_0x4e0a('0x66')][_0x4e0a('0x45')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x4e0a('0xb5')](_0x4e0a('0x10b'))});})['then'](respondWithResult(_0x21a06e,null))[_0x4e0a('0x2f')](handleError(_0x21a06e,null));};exports[_0x4e0a('0x117')]=function(_0x5c1b03,_0x5dc3d1){if(_0x5c1b03[_0x4e0a('0x66')][_0x4e0a('0xa6')]&&!utils[_0x4e0a('0xab')](_0x5c1b03[_0x4e0a('0x66')][_0x4e0a('0xa6')])){throw new APIBadRequestError(util[_0x4e0a('0xb5')](_0x4e0a('0x118'),_0x5c1b03[_0x4e0a('0x66')][_0x4e0a('0xa6')]));}return db[_0x4e0a('0x56')][_0x4e0a('0x3e')]({'where':{'id':_0x5c1b03[_0x4e0a('0x67')]['id']},'attributes':['id',_0x4e0a('0x3f'),_0x4e0a('0x35'),_0x4e0a('0x6c'),_0x4e0a('0xaa'),_0x4e0a('0xa7'),'voicePause',_0x4e0a('0x119'),_0x4e0a('0x11a'),'faxPause',_0x4e0a('0x11b'),_0x4e0a('0x11c'),'whatsappPause',_0x4e0a('0x11d'),_0x4e0a('0x11e')]})[_0x4e0a('0x24')](function(_0x5d37db){if(!_0x5d37db){throw new APINotFoundError(util[_0x4e0a('0xb5')](_0x4e0a('0xd3'),_0x5c1b03[_0x4e0a('0x67')]['id']));}return _0x5d37db[_0x4e0a('0x117')](_0x5c1b03['body']['channel']);})[_0x4e0a('0x24')](respondWithResult(_0x5dc3d1,null))[_0x4e0a('0x2f')](APIHandleError(_0x5dc3d1));};exports[_0x4e0a('0x11f')]=function(_0x4e6831,_0x26f19a){var _0x1b6c5d={};var _0x28165d={};var _0x27e718;var _0x26b579;return db[_0x4e0a('0x56')][_0x4e0a('0xa0')]({'where':{'id':_0x4e6831['params']['id']}})[_0x4e0a('0x24')](handleEntityNotFound(_0x26f19a,null))['then'](function(_0x4bca69){if(_0x4bca69){_0x27e718=_0x4bca69;_0x28165d['model']=_[_0x4e0a('0xd9')](db[_0x4e0a('0x120')][_0x4e0a('0x43')]);_0x28165d[_0x4e0a('0x4e')]=_['keys'](_0x4e6831['query']);_0x28165d['filters']=_[_0x4e0a('0xdc')](_0x28165d['model'],_0x28165d[_0x4e0a('0x4e')]);_0x1b6c5d[_0x4e0a('0x54')]=_['intersection'](_0x28165d[_0x4e0a('0xdd')],qs[_0x4e0a('0xde')](_0x4e6831[_0x4e0a('0x4e')][_0x4e0a('0xde')]));_0x1b6c5d[_0x4e0a('0x54')]=_0x1b6c5d[_0x4e0a('0x54')]['length']?_0x1b6c5d[_0x4e0a('0x54')]:_0x28165d[_0x4e0a('0xdd')];_0x1b6c5d['order']=qs['sort'](_0x4e6831[_0x4e0a('0x4e')][_0x4e0a('0xe0')]);_0x1b6c5d[_0x4e0a('0x4d')]=qs[_0x4e0a('0xdb')](_[_0x4e0a('0xe1')](_0x4e6831['query'],_0x28165d[_0x4e0a('0xdb')]));if(_0x4e6831[_0x4e0a('0x4e')]['filter']){_0x1b6c5d[_0x4e0a('0x4d')]=_['merge'](_0x1b6c5d[_0x4e0a('0x4d')],{'$or':_[_0x4e0a('0x3c')](_0x1b6c5d['attributes'],function(_0x5843fa){var _0xfe7d23={};_0xfe7d23[_0x5843fa]={'$like':'%'+_0x4e6831[_0x4e0a('0x4e')][_0x4e0a('0x3a')]+'%'};return _0xfe7d23;})});}_0x1b6c5d=_[_0x4e0a('0x64')]({},_0x1b6c5d,_0x4e6831[_0x4e0a('0xe2')]);return _0x27e718['getTeams'](_0x1b6c5d);}})['then'](function(_0x10d8cb){if(_0x10d8cb){_0x26b579=_0x10d8cb[_0x4e0a('0x5a')];if(!_0x4e6831[_0x4e0a('0x4e')]['hasOwnProperty'](_0x4e0a('0xe7'))){_0x1b6c5d[_0x4e0a('0x20')]=qs['limit'](_0x4e6831['query'][_0x4e0a('0x20')]);_0x1b6c5d[_0x4e0a('0x1f')]=qs[_0x4e0a('0x1f')](_0x4e6831[_0x4e0a('0x4e')]['offset']);}return _0x27e718[_0x4e0a('0x11f')](_0x1b6c5d);}})[_0x4e0a('0x24')](function(_0x47fcdb){if(_0x47fcdb){return _0x47fcdb?{'count':_0x26b579,'rows':_0x47fcdb}:null;}})[_0x4e0a('0x24')](respondWithResult(_0x26f19a,null))[_0x4e0a('0x2f')](handleError(_0x26f19a,null));};exports[_0x4e0a('0x121')]=function(_0x2d4346,_0x1dad80){var _0x10261b=_0x2d4346[_0x4e0a('0x67')]['id'];var _0x347360=_0x2d4346[_0x4e0a('0x66')]?_0x2d4346['body']['ids']:null;var _0x4c396a=[];return Promise[_0x4e0a('0x111')]()['then'](function(){if(!_0x347360)throw new APIBadRequestError(_0x4e0a('0x122'));})[_0x4e0a('0x24')](function(){return db[_0x4e0a('0x56')]['findOne']({'where':{'id':_0x10261b}});})[_0x4e0a('0x24')](function(_0x1d6b14){if(!_0x1d6b14)throw new APINotFoundError(util[_0x4e0a('0xb5')](_0x4e0a('0xd3'),_0x2d4346[_0x4e0a('0x67')]['id']));return db[_0x4e0a('0x104')][_0x4e0a('0x105')](function(_0x1d9903){return _0x1d6b14[_0x4e0a('0x121')](_0x347360,{'transaction':_0x1d9903})[_0x4e0a('0x24')](function(){return db[_0x4e0a('0x120')][_0x4e0a('0x57')]({'where':{'id':{'$in':_0x347360}}});})[_0x4e0a('0x24')](function(_0x2884a9){var _0x50eb4f=_[_0x4e0a('0x3c')](_0x2884a9,function(_0x3e20b8){return _0x3e20b8['getAssociatedQueues']();});return Promise[_0x4e0a('0x61')](_0x50eb4f);})[_0x4e0a('0x24')](function(_0x121a0e){_0x4c396a=_[_0x4e0a('0x123')](_0x121a0e);var _0x2eb020=_[_0x4e0a('0x3c')](_0x4c396a,function(_0x4a15a3){return _0x4a15a3[_0x4e0a('0x124')](_0x1d6b14['id'],{'transaction':_0x1d9903});});return Promise[_0x4e0a('0x61')](_0x2eb020);})[_0x4e0a('0x24')](function(){if(!_0x1d6b14[_0x4e0a('0xa7')])return;var _0x3877a1=_[_0x4e0a('0x3a')](_0x4c396a,function(_0x16ffbe){return _0x16ffbe[_0x4e0a('0x125')](_0x4e0a('0xa6'))==='Voice';});var _0x3ed032=_[_0x4e0a('0x3c')](_0x3877a1,function(_0x31e9e1){return db[_0x4e0a('0xbc')][_0x4e0a('0xb6')]({'membername':_0x1d6b14[_0x4e0a('0x3f')],'UserId':_0x1d6b14['id'],'queue_name':_0x31e9e1['name'],'VoiceQueueId':_0x31e9e1['id'],'interface':_[_0x4e0a('0x71')](_0x1d6b14[_0x4e0a('0xaa')])?util[_0x4e0a('0xb5')]('SIP/%s',_0x1d6b14[_0x4e0a('0x3f')]):_0x1d6b14[_0x4e0a('0xaa')],'paused':_0x1d6b14[_0x4e0a('0xa9')]||![],'penalty':_0x1d6b14[_0x4e0a('0xb0')]},{'transaction':_0x1d9903});});return Promise[_0x4e0a('0x61')](_0x3ed032);})[_0x4e0a('0x24')](function(){return db[_0x4e0a('0x126')][_0x4e0a('0x57')]({'where':{'teamId':{'$in':_0x347360}}});})[_0x4e0a('0x24')](function(_0x332e32){var _0x3427e1=_[_0x4e0a('0x3c')](_0x332e32,function(_0x55f37e){return db[_0x4e0a('0x127')][_0x4e0a('0x88')]({'UserId':_0x1d6b14['id'],'VoicePrefixId':_0x55f37e['VoicePrefixId']},{'transaction':_0x1d9903});});return Promise[_0x4e0a('0x61')](_0x3427e1);});});})[_0x4e0a('0x24')](function(){for(var _0x46d183=0x0;_0x46d183<_0x4c396a['length'];_0x46d183++){var _0x196803=_0x4c396a[_0x46d183]['getDataValue'](_0x4e0a('0xa6'));var _0x17a68a=_0x196803+_0x4e0a('0xb1');socket['emit'](_0x4e0a('0x8a')+_0x196803+_0x4e0a('0xb2'),{'UserId':_0x10261b,['queueField']:_0x4c396a[_0x46d183]['id']});}})[_0x4e0a('0x24')](respondWithStatusCode(_0x1dad80,null))[_0x4e0a('0x2f')](APIHandleError(_0x1dad80));};exports['removeTeams']=function(_0x54d801,_0x1ce34f){var _0x5b2c6e=_0x54d801[_0x4e0a('0x67')]['id'];var _0x348534=null;if(_0x54d801[_0x4e0a('0x4e')]['ids']){_0x348534=_[_0x4e0a('0xb9')](_0x54d801['query']['ids'])?_0x54d801[_0x4e0a('0x4e')][_0x4e0a('0x6a')]:[_0x54d801[_0x4e0a('0x4e')][_0x4e0a('0x6a')]];}var _0x39ec83=[];return Promise[_0x4e0a('0x111')]()[_0x4e0a('0x24')](function(){if(!_0x348534)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x4e0a('0x24')](function(){return db[_0x4e0a('0x56')][_0x4e0a('0xa0')]({'where':{'id':_0x5b2c6e}});})[_0x4e0a('0x24')](function(_0x3a420d){if(!_0x3a420d)throw new APINotFoundError(util['format'](_0x4e0a('0xd3'),_0x54d801[_0x4e0a('0x67')]['id']));return db[_0x4e0a('0x104')][_0x4e0a('0x105')](function(_0x445d4c){return _0x3a420d[_0x4e0a('0x128')](_0x348534,{'transaction':_0x445d4c})[_0x4e0a('0x24')](function(){return db[_0x4e0a('0x120')][_0x4e0a('0x57')]({'where':{'id':{'$in':_0x348534}}});})['then'](function(_0x52c5d2){var _0x3dc9d2=_[_0x4e0a('0x3c')](_0x52c5d2,function(_0x35555d){return _0x35555d[_0x4e0a('0x129')]();});return Promise[_0x4e0a('0x61')](_0x3dc9d2);})[_0x4e0a('0x24')](function(_0x177c49){_0x39ec83=_['flattenDeep'](_0x177c49);var _0x5d398a=_['map'](_0x39ec83,function(_0x29f477){return _0x29f477['removeAgent'](_0x3a420d['id'],{'transaction':_0x445d4c});});return Promise['all'](_0x5d398a);})[_0x4e0a('0x24')](function(){if(!_0x3a420d[_0x4e0a('0xa7')])return;var _0x327428=_[_0x4e0a('0x3a')](_0x39ec83,function(_0x1ff35d){return _0x1ff35d[_0x4e0a('0x125')](_0x4e0a('0xa6'))==='Voice';});var _0x7f555a=_[_0x4e0a('0x3c')](_0x327428,function(_0x2d291a){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x2d291a['id'],'UserId':_0x3a420d['id']},'transaction':_0x445d4c});});return Promise[_0x4e0a('0x61')](_0x7f555a);})['then'](function(){return db['TeamVoicePrefix'][_0x4e0a('0x57')]({'where':{'teamId':{'$in':_0x348534}}});})[_0x4e0a('0x24')](function(_0x58d13c){var _0xc0f10a=_[_0x4e0a('0x3c')](_0x58d13c,function(_0x364e54){return db['UserVoicePrefix'][_0x4e0a('0x33')]({'where':{'UserId':_0x3a420d['id'],'VoicePrefixId':_0x364e54[_0x4e0a('0x12a')]}},{'transaction':_0x445d4c});});return Promise['all'](_0xc0f10a);});});})[_0x4e0a('0x24')](function(){for(var _0x481cd4=0x0;_0x481cd4<_0x39ec83[_0x4e0a('0x5a')];_0x481cd4++){var _0x44d814=_0x39ec83[_0x481cd4]['getDataValue']('channel');var _0x322da4=_0x44d814+_0x4e0a('0xb1');socket[_0x4e0a('0xbb')](_0x4e0a('0x8a')+_0x44d814+_0x4e0a('0xba'),{'UserId':_0x5b2c6e,['queueField']:_0x39ec83[_0x481cd4]['id']});}})[_0x4e0a('0x24')](respondWithStatusCode(_0x1ce34f,null))[_0x4e0a('0x2f')](APIHandleError(_0x1ce34f));};exports['getLists']=function(_0x193ac9,_0x390b24){var _0x4bfacb={};var _0x44eeaf={};var _0xe11575;var _0x16d5d9;return db[_0x4e0a('0x56')][_0x4e0a('0xa0')]({'where':{'id':_0x193ac9[_0x4e0a('0x67')]['id']}})[_0x4e0a('0x24')](handleEntityNotFound(_0x390b24,null))['then'](function(_0x1293cd){if(_0x1293cd){_0xe11575=_0x1293cd;_0x44eeaf['model']=_[_0x4e0a('0xd9')](db[_0x4e0a('0xd4')][_0x4e0a('0x43')]);_0x44eeaf['query']=_[_0x4e0a('0xd9')](_0x193ac9['query']);_0x44eeaf['filters']=_[_0x4e0a('0xdc')](_0x44eeaf[_0x4e0a('0xdd')],_0x44eeaf[_0x4e0a('0x4e')]);_0x4bfacb['attributes']=_['intersection'](_0x44eeaf[_0x4e0a('0xdd')],qs['fields'](_0x193ac9['query'][_0x4e0a('0xde')]));_0x4bfacb[_0x4e0a('0x54')]=_0x4bfacb['attributes'][_0x4e0a('0x5a')]?_0x4bfacb[_0x4e0a('0x54')]:_0x44eeaf[_0x4e0a('0xdd')];_0x4bfacb['order']=qs['sort'](_0x193ac9[_0x4e0a('0x4e')]['sort']);_0x4bfacb[_0x4e0a('0x4d')]=qs[_0x4e0a('0xdb')](_['pick'](_0x193ac9['query'],_0x44eeaf[_0x4e0a('0xdb')]));if(_0x193ac9[_0x4e0a('0x4e')]['filter']){_0x4bfacb[_0x4e0a('0x4d')]=_[_0x4e0a('0x64')](_0x4bfacb[_0x4e0a('0x4d')],{'$or':_[_0x4e0a('0x3c')](_0x4bfacb[_0x4e0a('0x54')],function(_0x1b9389){var _0x5f6b22={};_0x5f6b22[_0x1b9389]={'$like':'%'+_0x193ac9[_0x4e0a('0x4e')][_0x4e0a('0x3a')]+'%'};return _0x5f6b22;})});}_0x4bfacb=_[_0x4e0a('0x64')]({},_0x4bfacb,_0x193ac9['options']);return _0xe11575['getLists'](_0x4bfacb);}})[_0x4e0a('0x24')](function(_0x4982d4){if(_0x4982d4){_0x16d5d9=_0x4982d4[_0x4e0a('0x5a')];if(!_0x193ac9['query']['hasOwnProperty'](_0x4e0a('0xe7'))){_0x4bfacb[_0x4e0a('0x20')]=qs[_0x4e0a('0x20')](_0x193ac9[_0x4e0a('0x4e')][_0x4e0a('0x20')]);_0x4bfacb[_0x4e0a('0x1f')]=qs['offset'](_0x193ac9[_0x4e0a('0x4e')][_0x4e0a('0x1f')]);}return _0xe11575[_0x4e0a('0x12b')](_0x4bfacb);}})[_0x4e0a('0x24')](function(_0x3ee6ba){if(_0x3ee6ba){return _0x3ee6ba?{'count':_0x16d5d9,'rows':_0x3ee6ba}:null;}})['then'](respondWithResult(_0x390b24,null))[_0x4e0a('0x2f')](handleError(_0x390b24,null));};exports[_0x4e0a('0x12c')]=function(_0x2ab710,_0x17d238){var _0x39f866={};var _0x16d89e={};var _0x5af31f;return db[_0x4e0a('0x56')][_0x4e0a('0xa0')]({'where':{'id':_0x2ab710[_0x4e0a('0x67')]['id']}})['then'](handleEntityNotFound(_0x17d238,null))[_0x4e0a('0x24')](function(_0x3ed791){if(_0x3ed791){_0x5af31f=_0x3ed791;_0x16d89e['model']=_[_0x4e0a('0xd9')](db['User']['rawAttributes']);_0x16d89e[_0x4e0a('0x4e')]=_[_0x4e0a('0xd9')](_0x2ab710[_0x4e0a('0x4e')]);_0x16d89e[_0x4e0a('0xdb')]=_['intersection'](_0x16d89e[_0x4e0a('0xdd')],_0x16d89e['query']);_0x39f866[_0x4e0a('0x54')]=_[_0x4e0a('0xdc')](_0x16d89e[_0x4e0a('0xdd')],qs[_0x4e0a('0xde')](_0x2ab710[_0x4e0a('0x4e')][_0x4e0a('0xde')]));_0x39f866['attributes']=_0x39f866[_0x4e0a('0x54')][_0x4e0a('0x5a')]?_0x39f866[_0x4e0a('0x54')]:_0x16d89e['model'];_0x39f866['order']=qs['sort'](_0x2ab710[_0x4e0a('0x4e')][_0x4e0a('0xe0')]);_0x39f866[_0x4e0a('0x4d')]=qs[_0x4e0a('0xdb')](_['pick'](_0x2ab710['query'],_0x16d89e[_0x4e0a('0xdb')]));if(_0x2ab710[_0x4e0a('0x4e')][_0x4e0a('0x3a')]){_0x39f866['where']=_[_0x4e0a('0x64')](_0x39f866[_0x4e0a('0x4d')],{'$or':_[_0x4e0a('0x3c')](_0x39f866['attributes'],function(_0x323216){var _0x50a5c7={};_0x50a5c7[_0x323216]={'$like':'%'+_0x2ab710['query'][_0x4e0a('0x3a')]+'%'};return _0x50a5c7;})});}_0x39f866['model']=db[_0x4e0a('0x56')];_0x39f866['as']=_0x4e0a('0x95');_0x39f866=_[_0x4e0a('0x64')]({},_0x39f866,_0x2ab710[_0x4e0a('0xe2')]);return _0x5af31f[_0x4e0a('0x12d')]({'include':[_0x39f866]});}})['then'](function(_0x4f7bd8){if(_0x4f7bd8){var _0x3d7536={},_0x4d791d=[];for(var _0x2358c8=0x0;_0x2358c8<_0x4f7bd8[_0x4e0a('0x5a')];_0x2358c8+=0x1){for(var _0x44327f=0x0,_0x28597a;_0x44327f<_0x4f7bd8[_0x2358c8][_0x4e0a('0x95')][_0x4e0a('0x5a')];_0x44327f+=0x1){_0x28597a=_0x4f7bd8[_0x2358c8][_0x4e0a('0x95')][_0x44327f]['get']({'plain':!![]});_0x3d7536[_0x28597a['id']]=_0x28597a;}}_0x3d7536=_['values'](_0x3d7536);for(var _0x53285e=qs[_0x4e0a('0x1f')](_0x2ab710[_0x4e0a('0x4e')][_0x4e0a('0x1f')]);_0x53285e<_0x3d7536[_0x4e0a('0x5a')]&&_0x4d791d[_0x4e0a('0x5a')]=_0x5ea3f5){_0x398128=_0x5ea3f5;_0xd7b51a=0xc8;}else{_0xd7b51a=0xce;}_0x5cfa6b[_0x5924('0x10')](_0xd7b51a);return _0x5cfa6b['set'](_0x5924('0x16'),_0x4248b4+'-'+_0x398128+'/'+_0x5ea3f5)[_0x5924('0x17')](_0x19218d);}return null;};}function respondWithRpcPromise(_0x5116b6,_0x475cf7,_0x10a5cb,_0x3761ab){return new Promise(function(_0x4a5c7a,_0x40f6bf){var _0x2a726c=_0x3761ab||amiClient;return _0x2a726c[_0x5924('0x18')](_0x5116b6,_0x10a5cb)[_0x5924('0x19')](function(_0x1acda9){logger[_0x5924('0x1a')](_0x5924('0x1b'),_0x475cf7,_0x5924('0x1c'));logger[_0x5924('0x1d')](_0x5924('0x1e'),_0x475cf7,_0x5924('0x1c'),JSON['stringify'](_0x1acda9));if(_0x1acda9[_0x5924('0x1f')]){if(_0x1acda9[_0x5924('0x1f')][_0x5924('0x20')]===0x1f4){logger['error'](_0x5924('0x1b'),_0x475cf7,_0x1acda9[_0x5924('0x1f')]['message']);return _0x40f6bf(_0x1acda9[_0x5924('0x1f')]['message']);}logger[_0x5924('0x1f')]('User,\x20%s,\x20%s',_0x475cf7,_0x1acda9[_0x5924('0x1f')]['message']);return _0x4a5c7a(_0x1acda9[_0x5924('0x1f')][_0x5924('0x21')]);}else{logger[_0x5924('0x1a')]('User,\x20%s,\x20%s',_0x475cf7,_0x5924('0x1c'));_0x4a5c7a(_0x1acda9[_0x5924('0x22')][_0x5924('0x21')]);}})['catch'](function(_0x513552){logger[_0x5924('0x1f')](_0x5924('0x1b'),_0x475cf7,_0x513552);_0x40f6bf(_0x513552);});});}function saveUpdates(_0x5304a7){return function(_0x5e4425){if(_0x5e4425){return _0x5e4425['update'](_0x5304a7)[_0x5924('0x19')](function(_0x479b8f){if(_0x479b8f['role']===_0x5924('0x23')){socket[_0x5924('0x24')](_0x5924('0x25')+_0x479b8f['id'],_0x479b8f);}return _0x479b8f;});}return null;};}function removeEntity(_0x3690dc,_0x13ed5f){return function(_0x354da3){if(_0x354da3){return _0x354da3[_0x5924('0x26')]({'transaction':_0x13ed5f})[_0x5924('0x19')](function(){var _0x4e24b6=_0x354da3[_0x5924('0x27')]({'plain':!![]});if(_0x4e24b6[_0x5924('0x28')]===_0x5924('0x29'))return;var _0xf4d799=[{'name':_0x5924('0x2a'),'value':'user','ignore':!![]},{'name':_0x5924('0x2b'),'value':'agent','ignore':![]},{'name':_0x5924('0x2c'),'value':_0x5924('0x2d'),'ignore':![]}];var _0x7cabb5=_(_0xf4d799)[_0x5924('0x2e')](_0x5924('0x2f'))[_0x5924('0x30')]('value')[_0x5924('0x31')]();if(_[_0x5924('0x32')](_0x7cabb5,_0x4e24b6[_0x5924('0x28')])){return;}var _0x3f892d=_['find'](_0xf4d799,['value',_0x4e24b6['role']])['name'];return db[_0x5924('0x33')][_0x5924('0x26')]({'where':{'type':_0x3f892d,'resourceId':_0x4e24b6['id']},'transaction':_0x13ed5f})['then'](function(){return _0x354da3;});})[_0x5924('0x19')](function(){_0x3690dc['status'](0xcc)[_0x5924('0x11')]();});}};}function handleEntityNotFound(_0x43ddea){return function(_0x1c2b28){if(!_0x1c2b28){_0x43ddea[_0x5924('0x34')](0x194);}return _0x1c2b28;};}function handleError(_0x1ab0bc,_0x55923f){_0x55923f=_0x55923f||0x1f4;return function(_0x4aa933){logger[_0x5924('0x1f')](_0x4aa933[_0x5924('0x35')]);if(_0x4aa933[_0x5924('0x36')]){delete _0x4aa933[_0x5924('0x36')];}_0x1ab0bc[_0x5924('0x10')](_0x55923f)['send'](_0x4aa933);};}function getUserAttributes(){return _(db[_0x5924('0x37')][_0x5924('0x38')])['map'](function(_0xf7b00a){return{'name':_0xf7b00a[_0x5924('0x39')],'type':_0xf7b00a[_0x5924('0x3a')][_0x5924('0x3b')]};})['filter'](function(_0x573300){return![_0x5924('0x3c'),_0x5924('0x3d'),_0x5924('0x3e'),'resetPasswordToken',_0x5924('0x3f'),_0x5924('0x40')][_0x5924('0x32')](_0x573300[_0x5924('0x36')]);})[_0x5924('0x31')]();}exports[_0x5924('0x41')]=function(_0x28c122,_0x5a52ca){var _0x248906={},_0x5b0395={'count':0x0,'rows':[]};var _0x431f8d=getUserAttributes();_0x248906=qs[_0x5924('0x42')](_0x431f8d,_0x28c122);var _0x480d21={'where':_0x248906[_0x5924('0x43')]};return db['User'][_0x5924('0x14')](_0x480d21)[_0x5924('0x19')](function(_0x4ea56e){_0x5b0395[_0x5924('0x14')]=_0x4ea56e;if(_0x28c122[_0x5924('0x44')][_0x5924('0x45')]){_0x248906[_0x5924('0x46')]=[{'all':!![]}];}if(_0x28c122[_0x5924('0x44')][_0x5924('0x47')]===_0x5924('0x48')){_0x248906[_0x5924('0x46')]=[{'model':db[_0x5924('0x49')],'as':'userSetting'}];}if(!_['includes'](_0x248906[_0x5924('0x4a')],'id')){_0x248906[_0x5924('0x4a')][_0x5924('0x4b')]('id');}return db[_0x5924('0x37')][_0x5924('0x4c')](_0x248906);})[_0x5924('0x19')](function(_0x849143){_0x5b0395[_0x5924('0x4d')]=_0x849143;if(_0x28c122['query'][_0x5924('0x4e')]===_0x5924('0x48')){var _0x7cf8ab=[];for(var _0x371274=0x0;_0x371274<_0x5b0395['rows'][_0x5924('0x4f')];_0x371274++){_0x7cf8ab[_0x5924('0x4b')](get_open_tabs('chat',_0x5b0395[_0x5924('0x4d')][_0x371274][_0x5924('0x50')]));_0x7cf8ab['push'](get_open_tabs(_0x5924('0x51'),_0x5b0395[_0x5924('0x4d')][_0x371274][_0x5924('0x50')]));_0x7cf8ab[_0x5924('0x4b')](get_open_tabs(_0x5924('0x52'),_0x5b0395[_0x5924('0x4d')][_0x371274]['dataValues']));_0x7cf8ab[_0x5924('0x4b')](get_open_tabs(_0x5924('0x53'),_0x5b0395['rows'][_0x371274][_0x5924('0x50')]));_0x7cf8ab['push'](get_open_tabs(_0x5924('0x54'),_0x5b0395[_0x5924('0x4d')][_0x371274][_0x5924('0x50')]));_0x7cf8ab[_0x5924('0x4b')](get_open_tabs(_0x5924('0x55'),_0x5b0395[_0x5924('0x4d')][_0x371274][_0x5924('0x50')]));}return Promise[_0x5924('0x56')](_0x7cf8ab)[_0x5924('0x19')](function(){return _0x5b0395;});}else{return _0x5b0395;}})[_0x5924('0x19')](respondWithFilteredResult(_0x5a52ca,_0x248906))['catch'](handleError(_0x5a52ca,null));};exports[_0x5924('0x57')]=function(_0x280da4,_0x2979fa){var _0x1aeb1f=getUserAttributes();_0x280da4[_0x5924('0x44')]['id']=_0x280da4[_0x5924('0x58')]['id'];var _0x8a80af=qs['getOptions'](_0x1aeb1f,_0x280da4);if(_0x280da4[_0x5924('0x44')][_0x5924('0x45')]){_0x8a80af[_0x5924('0x46')]=[{'all':!![]}];}if(_0x280da4[_0x5924('0x44')][_0x5924('0x47')]==='true'){_0x8a80af['include']=[{'model':db[_0x5924('0x49')],'as':_0x5924('0x47')}];}_0x8a80af=_['merge']({},_0x8a80af,_0x280da4[_0x5924('0x59')]);if(!_[_0x5924('0x32')](_0x8a80af[_0x5924('0x4a')],'id')){_0x8a80af[_0x5924('0x4a')]['push']('id');}return db['User'][_0x5924('0x5a')](_0x8a80af)[_0x5924('0x19')](handleEntityNotFound(_0x2979fa,null))['then'](function(_0x145242){var _0x53a086=[];values=_0x145242;if(_0x280da4[_0x5924('0x44')][_0x5924('0x4e')]===_0x5924('0x48')){_0x53a086['push'](get_open_tabs('chat',_0x145242[_0x5924('0x50')]));_0x53a086[_0x5924('0x4b')](get_open_tabs('sms',_0x145242[_0x5924('0x50')]));_0x53a086['push'](get_open_tabs(_0x5924('0x54'),_0x145242[_0x5924('0x50')]));_0x53a086[_0x5924('0x4b')](get_open_tabs(_0x5924('0x55'),_0x145242[_0x5924('0x50')]));_0x53a086[_0x5924('0x4b')](get_open_tabs(_0x5924('0x52'),_0x145242[_0x5924('0x50')]));_0x53a086[_0x5924('0x4b')](get_open_tabs(_0x5924('0x53'),_0x145242[_0x5924('0x50')]));return Promise[_0x5924('0x56')](_0x53a086);}else{return values;}})[_0x5924('0x19')](function(){return values;})[_0x5924('0x19')](respondWithResult(_0x2979fa,null))[_0x5924('0x5b')](handleError(_0x2979fa,null));};exports[_0x5924('0x5c')]=function(_0x3d65d2,_0x145d0f){if(_0x3d65d2['body']['id']){delete _0x3d65d2[_0x5924('0x5d')]['id'];}delete _0x3d65d2['body']['role'];return db[_0x5924('0x37')][_0x5924('0x5a')]({'where':{'id':_0x3d65d2['params']['id']}})[_0x5924('0x19')](handleEntityNotFound(_0x145d0f,null))[_0x5924('0x19')](saveUpdates(_0x3d65d2['body'],null))['then'](respondWithResult(_0x145d0f,null))['catch'](handleError(_0x145d0f,null));};exports[_0x5924('0x5e')]=function(_0xa48fc5,_0xf3c3a2){return db[_0x5924('0x37')][_0x5924('0x5e')]()['then'](respondWithResult(_0xf3c3a2,null))['catch'](handleError(_0xf3c3a2,null));};exports[_0x5924('0x5f')]=function(_0x4ba2af,_0x3b465c){return db['User'][_0x5924('0x5a')]({'where':{'id':_0x4ba2af[_0x5924('0x58')]['id']}})[_0x5924('0x19')](handleEntityNotFound(_0x3b465c,null))[_0x5924('0x19')](function(_0x17d06c){if(_0x17d06c){return _0x17d06c[_0x5924('0x5f')](_0x4ba2af['body'][_0x5924('0x60')],_[_0x5924('0x61')](_0x4ba2af['body'],[_0x5924('0x60'),'id'])||{});}})[_0x5924('0x19')](respondWithResult(_0x3b465c,null))['catch'](handleError(_0x3b465c,null));};function validateUser(_0x45d815){return new Promise(function(_0x259ddc,_0x14f50a){if(_0x45d815[_0x5924('0x62')])return _0x259ddc(_0x45d815);return db['Setting'][_0x5924('0x63')](0x1)[_0x5924('0x19')](function(_0x262057){if(_0x262057[_0x5924('0x64')])authService[_0x5924('0x65')](_0x45d815[_0x5924('0x3c')]);db['User'][_0x5924('0x66')]('internal')['then'](function(_0x23179b){if(_[_0x5924('0x67')](_0x23179b)){_0x45d815[_0x5924('0x62')]=_0x262057[_0x5924('0x68')]||0x1;return;}if(_['isNil'](_0x262057[_0x5924('0x68')])||_0x262057[_0x5924('0x68')]===_0x23179b){_0x45d815[_0x5924('0x62')]=_0x23179b+0x1;return;}if(_0x262057['min_internal']>_0x23179b){_0x45d815[_0x5924('0x62')]=_0x262057[_0x5924('0x68')];return;}return db[_0x5924('0x69')][_0x5924('0x44')](_0x5924('0x6a'),{'type':db['sequelize'][_0x5924('0x6b')][_0x5924('0x6c')]})[_0x5924('0x19')](function(_0x1a7afa){if(_0x1a7afa&&_0x1a7afa[_0x5924('0x4f')]){for(var _0x2dc4d0=0x0,_0x33fd55=_0x1a7afa[_0x5924('0x4f')];_0x2dc4d0<_0x33fd55&&_[_0x5924('0x67')](_0x45d815[_0x5924('0x62')]);_0x2dc4d0++){if(_0x262057[_0x5924('0x68')]<=_0x1a7afa[_0x2dc4d0][_0x5924('0x6d')]){_0x45d815['internal']=_0x1a7afa[_0x2dc4d0][_0x5924('0x6d')];}else if(_0x262057[_0x5924('0x68')]>_0x1a7afa[_0x2dc4d0]['from']&&_0x262057[_0x5924('0x68')]<=_0x1a7afa[_0x2dc4d0]['to']){_0x45d815[_0x5924('0x62')]=_0x262057[_0x5924('0x68')];}}}if(_[_0x5924('0x67')](_0x45d815[_0x5924('0x62')])){_0x45d815[_0x5924('0x62')]=_0x23179b+0x1;}return _0x259ddc(_0x45d815);});});})[_0x5924('0x5b')](function(_0x420d2e){_0x14f50a(_0x420d2e);});});}function updateUser(_0x5b4466){return new Promise(function(_0x128672,_0x4ccf09){try{if(_0x5b4466[_0x5924('0x6e')]){_0x5b4466[_0x5924('0x6f')]=_0x5b4466[_0x5924('0x62')];_0x5b4466['VoiceMail']={'mailbox':_0x5b4466[_0x5924('0x62')],'password':_0x5b4466[_0x5924('0x3c')],'fullname':_0x5b4466['fullname'],'email':_0x5b4466[_0x5924('0x70')]};}if(_0x5b4466[_0x5924('0x28')]===_0x5924('0x23')){if(!_0x5b4466['permissions'])_0x5b4466[_0x5924('0x71')]=[_0x5924('0x72'),'102',_0x5924('0x73'),_0x5924('0x74'),'110',_0x5924('0x75'),'105','106',_0x5924('0x76'),_0x5924('0x77'),_0x5924('0x78'),_0x5924('0x79'),'111',_0x5924('0x7a'),_0x5924('0x7b')];}_0x128672(_0x5b4466);}catch(_0x32f04c){_0x4ccf09(_0x32f04c);}});}exports[_0x5924('0x7c')]=function(_0xe77134,_0x2f61c5){if(_0xe77134[_0x5924('0x7d')][_0x5924('0x28')]==='agent')throw new Error(_0x5924('0x7e'));if(_0xe77134[_0x5924('0x5d')][_0x5924('0x28')]===_0x5924('0x7d')&&_0xe77134[_0x5924('0x7d')][_0x5924('0x28')]!==_0x5924('0x29')){throw new Error(_0x5924('0x7f'));}if(_0xe77134[_0x5924('0x5d')]['role']==='admin'&&_0xe77134[_0x5924('0x7d')][_0x5924('0x28')]!==_0x5924('0x29')){throw new Error(_0x5924('0x80'));}return licenseUtil[_0x5924('0x81')]([_0xe77134['body']])[_0x5924('0x19')](function(){return validateUser(_0xe77134[_0x5924('0x5d')]);})['then'](function(_0x414cbd){return updateUser(_0x414cbd)['then'](function(_0x5c86a0){if(_0x5c86a0[_0x5924('0x28')]===_0x5924('0x29')){_0x5c86a0[_0x5924('0x82')]=_0xe77134[_0x5924('0x7d')][_0x5924('0x82')];delete _0x5c86a0[_0x5924('0x83')];}return _0x5c86a0;});})[_0x5924('0x19')](function(_0x12d44f){return db[_0x5924('0x37')][_0x5924('0x7c')](_0x12d44f,{'include':[{'model':db[_0x5924('0x84')],'as':_0x5924('0x84')}]});})[_0x5924('0x19')](function(_0x4f04c1){if(_0xe77134[_0x5924('0x5d')][_0x5924('0x28')]===_0x5924('0x7d'))return _0x4f04c1;if(_0xe77134[_0x5924('0x7d')][_0x5924('0x28')]!==_0x5924('0x7d'))return _0x4f04c1;return db[_0x5924('0x85')][_0x5924('0x5a')]({'where':{'name':_0x4f04c1['role']==='agent'?'Agents':_0x5924('0x2c'),'userProfileId':_0xe77134[_0x5924('0x7d')][_0x5924('0x83')]},'raw':!![]})['then'](function(_0x22baf7){if(!_0x22baf7||_0x22baf7[_0x5924('0x86')]!=0x0)return _0x4f04c1;return db[_0x5924('0x33')][_0x5924('0x7c')]({'name':_0x4f04c1[_0x5924('0x36')],'resourceId':_0x4f04c1['id'],'type':_0x22baf7['name'],'sectionId':_0x22baf7['id']},{})[_0x5924('0x19')](function(){return _0x4f04c1;});})[_0x5924('0x5b')](function(_0x1cc7ec){logger['error'](_0x5924('0x87'),_0x1cc7ec);throw _0x1cc7ec;});})[_0x5924('0x19')](respondWithResult(_0x2f61c5,0xc9))[_0x5924('0x5b')](handleError(_0x2f61c5,null));};exports[_0x5924('0x88')]=function(_0x2699ce,_0x759d7f){var _0x44084b=_0x2699ce[_0x5924('0x5d')];var _0x368e42=[];if(_0x2699ce['user'][_0x5924('0x28')]==='agent')throw new Error(_0x5924('0x7e'));if(_[_0x5924('0x89')](_0x44084b,[_0x5924('0x28'),_0x5924('0x7d')])&&_0x2699ce[_0x5924('0x7d')]['role']!==_0x5924('0x29')){throw new Error(_0x5924('0x7f'));}if(_[_0x5924('0x89')](_0x44084b,['role',_0x5924('0x29')])&&_0x2699ce[_0x5924('0x7d')][_0x5924('0x28')]!=='admin'){throw new Error(_0x5924('0x8a'));}return licenseUtil[_0x5924('0x81')](_0x44084b)['then'](function(){return validateUser(_0x44084b[0x0]);})['then'](function(){for(var _0x326665=0x1;_0x326665<_0x44084b['length'];_0x326665++){var _0x32764c=_0x44084b[_0x326665-0x1][_0x5924('0x62')];if(!_0x44084b[_0x326665][_0x5924('0x62')])_0x44084b[_0x326665][_0x5924('0x62')]=_0x32764c+0x1;_0x368e42[_0x5924('0x4b')](validateUser(_0x44084b[_0x326665]));}return Promise[_0x5924('0x56')](_0x368e42);})[_0x5924('0x19')](function(){_0x368e42=[];for(var _0x4bebb9=0x0;_0x4bebb9<_0x44084b[_0x5924('0x4f')];_0x4bebb9++){_0x368e42[_0x5924('0x4b')](updateUser(_0x44084b[_0x4bebb9]));}return Promise['all'](_0x368e42);})[_0x5924('0x19')](function(){_0x368e42=_0x44084b[_0x5924('0x30')](function(_0x2a3134){return db['User']['create'](_0x2a3134,{'include':[{'model':db[_0x5924('0x84')],'as':_0x5924('0x84')}]})['then'](function(_0x209a59){_0x2a3134['id']=_0x209a59['id'];return _0x2a3134;});});return Promise[_0x5924('0x56')](_0x368e42);})[_0x5924('0x19')](function(_0x1ea8b0){if(_0x2699ce[_0x5924('0x5d')]['role']===_0x5924('0x7d'))return _0x1ea8b0;if(_0x2699ce[_0x5924('0x7d')]['role']!==_0x5924('0x7d'))return _0x1ea8b0;var _0x2910bc=_[_0x5924('0x89')](_0x1ea8b0,function(_0x5a8365){return _0x5a8365['role']==='agent'||_0x5a8365[_0x5924('0x28')]===_0x5924('0x2d');});if(!_0x2910bc)return _0x1ea8b0;return db[_0x5924('0x85')][_0x5924('0x4c')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x2699ce['user']['userProfileId']},'raw':!![]})[_0x5924('0x19')](function(_0x3c6f6c){if(_[_0x5924('0x8b')](_0x3c6f6c)||!_[_0x5924('0x89')](_0x3c6f6c,[_0x5924('0x86'),0x0]))return _0x1ea8b0;_0x368e42=[];var _0x5d1df7=_(_0x3c6f6c)[_0x5924('0x30')](function(_0x58f1f6){if(_0x58f1f6[_0x5924('0x86')]===0x1)return;return _0x58f1f6[_0x5924('0x36')]===_0x5924('0x2b')?_0x5924('0x23'):_0x5924('0x2d');})['compact']()['value']();for(var _0x55f909=0x0;_0x55f909<_0x1ea8b0[_0x5924('0x4f')];_0x55f909++){if(!_[_0x5924('0x32')](_0x5d1df7,_0x1ea8b0[_0x55f909][_0x5924('0x28')]))return;var _0x14bdaf=_0x1ea8b0[_0x55f909][_0x5924('0x28')]==='agent'?_0x5924('0x2b'):_0x5924('0x2c');_0x368e42['push'](db['UserProfileResource'][_0x5924('0x7c')]({'name':_0x1ea8b0[_0x55f909][_0x5924('0x36')],'resourceId':_0x1ea8b0[_0x55f909]['id'],'type':_0x14bdaf,'sectionId':_[_0x5924('0x5a')](_0x3c6f6c,[_0x5924('0x36'),_0x14bdaf])['id']},{}));}return Promise[_0x5924('0x56')](_0x368e42);});})[_0x5924('0x19')](respondWithResult(_0x759d7f,0xc9))[_0x5924('0x5b')](handleError(_0x759d7f,null));};exports[_0x5924('0x8c')]=function(_0x59eec2,_0x493dc4){if(_0x59eec2['body']['id']){delete _0x59eec2[_0x5924('0x5d')]['id'];}return db[_0x5924('0x37')][_0x5924('0x5a')]({'where':{'id':_0x59eec2[_0x5924('0x58')]['id']}})['then'](function(_0x3b30c0){if(!_0x3b30c0)return null;if(_0x3b30c0['id']===_0x59eec2['user']['id']){if(!_0x59eec2[_0x5924('0x5d')][_0x5924('0x8d')]||!_0x59eec2[_0x5924('0x5d')]['newPassword']){throw new db[(_0x5924('0x8e'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x3b30c0['authenticate'](_0x59eec2[_0x5924('0x5d')][_0x5924('0x8d')])){throw new db[(_0x5924('0x8e'))][(_0x5924('0x8f'))](_0x5924('0x90'));}if(_0x59eec2[_0x5924('0x5d')][_0x5924('0x8d')]===_0x59eec2['body'][_0x5924('0x91')]){throw new db[(_0x5924('0x8e'))][(_0x5924('0x8f'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x59eec2[_0x5924('0x7d')]['role']===_0x5924('0x29')){if(!_0x59eec2[_0x5924('0x5d')][_0x5924('0x91')]){throw new db[(_0x5924('0x8e'))][(_0x5924('0x8f'))](_0x5924('0x92'));}}else if(_0x59eec2[_0x5924('0x7d')][_0x5924('0x28')]===_0x5924('0x7d')){if(!_0x59eec2[_0x5924('0x5d')][_0x5924('0x91')]){throw new db[(_0x5924('0x8e'))][(_0x5924('0x8f'))](_0x5924('0x92'));}if(_0x3b30c0[_0x5924('0x28')]!==_0x5924('0x23')){throw new db[(_0x5924('0x8e'))]['ValidationError'](_0x5924('0x7e'));}}else{throw new db[(_0x5924('0x8e'))][(_0x5924('0x8f'))](_0x5924('0x7e'));}return _0x3b30c0;})[_0x5924('0x19')](handleEntityNotFound(_0x493dc4,null))[_0x5924('0x19')](function(_0x5ed1aa){return db['Setting'][_0x5924('0x93')]({'attributes':['id',_0x5924('0x64'),_0x5924('0x94'),'passwordHistoryLimit']})['then'](function(_0x12b9e5){if(_0x12b9e5['securePassword'])authService[_0x5924('0x65')](_0x59eec2[_0x5924('0x5d')][_0x5924('0x91')]);if(!_0x12b9e5['enforcePasswordHistory']||!_0x5ed1aa['previousPasswords'])return _0x5ed1aa;authService['validatePasswordHistory'](_0x59eec2[_0x5924('0x5d')]['newPassword'],_0x5ed1aa['previousPasswords'],_0x12b9e5[_0x5924('0x95')]);return _0x5ed1aa;})[_0x5924('0x19')](saveUpdates({'password':_0x59eec2[_0x5924('0x5d')][_0x5924('0x91')],'passwordResetAt':_0x59eec2[_0x5924('0x7d')]['id']==_0x59eec2[_0x5924('0x58')]['id']?moment():null,'previousPasswords':authService[_0x5924('0x96')](_0x59eec2[_0x5924('0x5d')]['newPassword'],_0x5ed1aa[_0x5924('0x3e')])},null));})[_0x5924('0x19')](respondWithResult(_0x493dc4,null))['catch'](handleError(_0x493dc4,null));};exports['addQueues']=function(_0x451107,_0x40ebaa){var _0x348b85=_0x451107[_0x5924('0x5d')][_0x5924('0x97')];return db[_0x5924('0x37')][_0x5924('0x5a')]({'where':{'id':_0x451107[_0x5924('0x58')]['id']},'attributes':['id','name',_0x5924('0x28'),_0x5924('0x98'),_0x5924('0x99'),_0x5924('0x9a'),_0x5924('0x9b')]})[_0x5924('0x19')](handleEntityNotFound(_0x40ebaa,null))[_0x5924('0x19')](function(_0x398bae){if(_0x398bae){if(!utils[_0x5924('0x9c')](_0x348b85)){throw new db[(_0x5924('0x8e'))]['ValidationError'](_0x5924('0x9d'));}return _0x398bae['add'+_['capitalize'](_0x348b85[_0x5924('0x9e')]())+_0x5924('0x9f')](_0x451107[_0x5924('0x5d')][_0x5924('0x60')],{'penalty':_0x451107[_0x5924('0x5d')][_0x5924('0xa0')]||0x0})[_0x5924('0xa1')](function(_0xb336fd){for(var _0x2ce573=0x0;_0x2ce573<_0x451107[_0x5924('0x5d')][_0x5924('0x60')][_0x5924('0x4f')];_0x2ce573+=0x1){var _0x3aa0e3={'UserId':Number(_0x451107['params']['id'])};_0x3aa0e3[_['capitalize'](_0x348b85[_0x5924('0x9e')]())+'QueueId']=Number(_0x451107[_0x5924('0x5d')][_0x5924('0x60')][_0x2ce573]);socket[_0x5924('0x24')](_0x5924('0x7d')+_[_0x5924('0xa2')](_0x348b85[_0x5924('0x9e')]())+_0x5924('0xa3'),_0x3aa0e3);}return _0xb336fd;})[_0x5924('0x19')](function(){if(_0x348b85==='voice'){return db['VoiceQueue'][_0x5924('0x4c')]({'where':{'id':_0x451107[_0x5924('0x5d')][_0x5924('0x60')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x40c975){var _0x19e6d0=_0x398bae[_0x5924('0x27')]({'plain':!![]});var _0x211da2=[];if(_0x348b85===_0x5924('0xa4')&&_0x19e6d0[_0x5924('0x28')]===_0x5924('0x23')&&_0x19e6d0['online']){for(let _0x568aab=0x0;_0x568aab<_0x40c975[_0x5924('0x4f')];_0x568aab+=0x1){_0x211da2['push']({'membername':_0x19e6d0[_0x5924('0x36')],'UserId':_0x19e6d0['id'],'queue_name':_0x40c975[_0x568aab]['name'],'VoiceQueueId':_0x40c975[_0x568aab]['id'],'interface':_[_0x5924('0x67')](_0x19e6d0[_0x5924('0x9b')])?util[_0x5924('0xa5')](_0x5924('0xa6'),_0x19e6d0[_0x5924('0x36')]):_0x19e6d0[_0x5924('0x9b')],'paused':_0x19e6d0[_0x5924('0x9a')]||![],'penalty':_0x451107[_0x5924('0x5d')][_0x5924('0xa0')]||0x0});}return Promise[_0x5924('0x56')](_0x211da2['map'](function(_0x5ae86b){return db[_0x5924('0xa7')]['upsert'](_0x5ae86b);}));}return _0x398bae;});}})[_0x5924('0x19')](respondWithStatusCode(_0x40ebaa,null))[_0x5924('0x5b')](handleError(_0x40ebaa,null));};exports[_0x5924('0xa8')]=function(_0x5828e7,_0x5e5be6){var _0x27d8cb,_0xc43d7a;return db['User'][_0x5924('0x5a')]({'where':{'id':_0x5828e7[_0x5924('0x58')]['id']},'attributes':['id',_0x5924('0x36'),_0x5924('0x28')]})[_0x5924('0x19')](handleEntityNotFound(_0x5e5be6,null))[_0x5924('0x19')](function(_0x5a9ce8){if(_0x5a9ce8){_0x27d8cb=_0x5a9ce8;if(!_0x5828e7[_0x5924('0x44')][_0x5924('0x97')]||!utils[_0x5924('0x9c')](_0x5828e7['query']['channel'])){throw new db[(_0x5924('0x8e'))][(_0x5924('0x8f'))](_0x5924('0x9d'));}return _0x5a9ce8[_0x5924('0xa9')+_[_0x5924('0xa2')](_0x5828e7[_0x5924('0x44')][_0x5924('0x97')][_0x5924('0x9e')]())+_0x5924('0x9f')](_0x5828e7['query'][_0x5924('0x60')]);}})['then'](function(_0x4b9c88){if(_['isArray'](_0x5828e7[_0x5924('0x44')][_0x5924('0x60')])){for(var _0x41241c=0x0;_0x41241c<_0x5828e7[_0x5924('0x44')][_0x5924('0x60')][_0x5924('0x4f')];_0x41241c+=0x1){_0xc43d7a={'UserId':Number(_0x5828e7[_0x5924('0x58')]['id'])};_0xc43d7a[_[_0x5924('0xa2')](_0x5828e7[_0x5924('0x44')]['channel'][_0x5924('0x9e')]())+'QueueId']=Number(_0x5828e7[_0x5924('0x44')]['ids'][_0x41241c]);socket[_0x5924('0x24')](_0x5924('0x7d')+_['capitalize'](_0x5828e7[_0x5924('0x44')]['channel'][_0x5924('0x9e')]())+_0x5924('0xaa'),_0xc43d7a);}}else{_0xc43d7a={'UserId':Number(_0x5828e7['params']['id'])};_0xc43d7a[_[_0x5924('0xa2')](_0x5828e7['query'][_0x5924('0x97')][_0x5924('0x9e')]())+'QueueId']=Number(_0x5828e7[_0x5924('0x44')][_0x5924('0x60')]);socket[_0x5924('0x24')](_0x5924('0x7d')+_[_0x5924('0xa2')](_0x5828e7['query'][_0x5924('0x97')][_0x5924('0x9e')]())+_0x5924('0xaa'),_0xc43d7a);}return _0x4b9c88;})[_0x5924('0x19')](function(){if(_0x5828e7[_0x5924('0x44')][_0x5924('0x97')]===_0x5924('0xa4')){return db[_0x5924('0xa7')][_0x5924('0x26')]({'where':{'UserId':_0x5828e7[_0x5924('0x58')]['id'],'VoiceQueueId':_0x5828e7[_0x5924('0x44')][_0x5924('0x60')]},'individualHooks':!![]})[_0x5924('0x19')](function(){return _0x27d8cb;});}return _0x27d8cb;})[_0x5924('0x19')](respondWithStatusCode(_0x5e5be6,null))[_0x5924('0x5b')](handleError(_0x5e5be6,null));};exports[_0x5924('0xab')]=function(_0x4b5abc,_0x2d12ab){_0x4b5abc[_0x5924('0x5d')][_0x5924('0xac')]=_0x4b5abc['file'][_0x5924('0xad')];return db[_0x5924('0x37')][_0x5924('0x5a')]({'where':{'id':_0x4b5abc[_0x5924('0x58')]['id']}})['then'](handleEntityNotFound(_0x2d12ab,null))['then'](saveUpdates(_0x4b5abc['body'],null))[_0x5924('0x19')](respondWithResult(_0x2d12ab,null))[_0x5924('0x5b')](handleError(_0x2d12ab,null));};exports[_0x5924('0xae')]=function(_0x5e7f5c,_0xb86001){var _0x340d65=path[_0x5924('0xaf')](config[_0x5924('0xb0')],'server/files/images/logos/default_profile.png');return db[_0x5924('0x37')][_0x5924('0x5a')]({'where':{'id':_0x5e7f5c[_0x5924('0x58')]['id']},'attributes':['id',_0x5924('0xac')],'raw':!![]})[_0x5924('0x19')](handleEntityNotFound(_0xb86001,null))[_0x5924('0x19')](function(_0x2512ec){if(_0x2512ec){if(_[_0x5924('0x67')](_0x2512ec['userpic'])){return _0xb86001[_0x5924('0xb1')](_0x340d65);}else{if(!fs[_0x5924('0xb2')](path[_0x5924('0xaf')](config[_0x5924('0xb0')],_0x5924('0xb3'),_0x2512ec[_0x5924('0xac')]))){return _0xb86001[_0x5924('0xb1')](_0x340d65);}return _0xb86001[_0x5924('0xb1')](path['join'](config['root'],'server/files/images/',_0x2512ec[_0x5924('0xac')]));}}})['catch'](handleError(_0xb86001,null));};exports[_0x5924('0xb4')]=function(_0x4ffb5d,_0xc66a64){return db[_0x5924('0x37')][_0x5924('0x5a')]({'where':{'id':_0x4ffb5d[_0x5924('0x58')]['id']},'attributes':['id']})[_0x5924('0x19')](handleEntityNotFound(_0xc66a64,null))[_0x5924('0x19')](function(_0x30dec2){var _0x35f649=[];values=_0x30dec2[_0x5924('0x50')];_0x35f649[_0x5924('0x4b')](get_open_tabs(_0x5924('0xb5'),_0x30dec2[_0x5924('0x50')]));_0x35f649['push'](get_open_tabs('sms',_0x30dec2[_0x5924('0x50')]));_0x35f649['push'](get_open_tabs(_0x5924('0x54'),_0x30dec2[_0x5924('0x50')]));_0x35f649[_0x5924('0x4b')](get_open_tabs('whatsapp',_0x30dec2['dataValues']));_0x35f649[_0x5924('0x4b')](get_open_tabs('fax',_0x30dec2[_0x5924('0x50')]));_0x35f649[_0x5924('0x4b')](get_open_tabs(_0x5924('0x53'),_0x30dec2[_0x5924('0x50')]));return Promise[_0x5924('0x56')](_0x35f649);})['then'](function(_0x3ed912){if(_0x3ed912){var _0x4c53ad=_[_0x5924('0x30')](values[_0x5924('0xb6')],function(_0x53f9f1){return{'channel':'CHAT','id':_0x53f9f1['id'],'createdAt':_0x53f9f1[_0x5924('0xb7')]};});var _0x1fd27e=_[_0x5924('0x30')](values['FaxOpenTabs'],function(_0x83ae47){return{'channel':'FAX','id':_0x83ae47['id'],'createdAt':_0x83ae47['createdAt']};});var _0x21b0f0=_['map'](values[_0x5924('0xb8')],function(_0x1e5753){return{'channel':_0x5924('0xb9'),'id':_0x1e5753['id'],'createdAt':_0x1e5753[_0x5924('0xb7')]};});var _0x5f3741=_[_0x5924('0x30')](values[_0x5924('0xba')],function(_0x4b4962){return{'channel':'MAIL','id':_0x4b4962['id'],'createdAt':_0x4b4962[_0x5924('0xb7')]};});var _0x2e0392=_[_0x5924('0x30')](values[_0x5924('0xbb')],function(_0x55d585){return{'channel':_0x5924('0xbc'),'id':_0x55d585['id'],'createdAt':_0x55d585[_0x5924('0xb7')]};});var _0x166291=_[_0x5924('0x30')](values[_0x5924('0xbd')],function(_0x13d7b1){return{'channel':_0x5924('0xbe'),'id':_0x13d7b1['id'],'createdAt':_0x13d7b1[_0x5924('0xb7')]};});var _0x3bfab7=_['concat'](_0x4c53ad,_0x1fd27e,_0x21b0f0,_0x5f3741,_0x2e0392,_0x166291);var _0x19c2aa={'count':_0x3bfab7[_0x5924('0x4f')],'rows':_0x3bfab7};return _0x19c2aa;}else return null;})[_0x5924('0x19')](respondWithResult(_0xc66a64,null))['catch'](handleError(_0xc66a64,null));};exports[_0x5924('0xbf')]=function(_0x837693,_0x320d06){var _0x184010={};return db[_0x5924('0x37')][_0x5924('0x93')]({'where':{'id':_0x837693['params']['id']}})['then'](function(_0x1cfa01){if(!_0x1cfa01){throw new APINotFoundError(util[_0x5924('0xa5')](_0x5924('0xc0'),_0x837693[_0x5924('0x58')]['id']));}return contacts[_0x5924('0x5e')]();})[_0x5924('0x19')](function(_0x48e89d){_0x837693[_0x5924('0x44')][_0x5924('0x37')]=_0x837693[_0x5924('0x58')]['id'];_0x184010=qs[_0x5924('0x42')](_0x48e89d,_0x837693);if(_0x837693[_0x5924('0x44')][_0x5924('0xc1')](_0x5924('0x45'))){_0x184010[_0x5924('0x46')]=[{'model':db[_0x5924('0xc2')],'as':_0x5924('0xc3'),'required':![]},{'model':db[_0x5924('0xc4')],'as':_0x5924('0xc5'),'attributes':['id',_0x5924('0x36'),_0x5924('0xc6')],'where':_0x837693['query'][_0x5924('0xc7')]?{'id':_0x837693[_0x5924('0x44')]['tag']}:undefined,'required':_0x837693[_0x5924('0x44')][_0x5924('0xc7')]?!![]:![]}];}return contacts[_0x5924('0x4c')](_0x837693[_0x5924('0x44')],_0x837693[_0x5924('0x7d')],_0x184010,_0x48e89d);})[_0x5924('0x19')](respondWithFilteredResult(_0x320d06,_0x184010))[_0x5924('0x5b')](APIHandleError(_0x320d06));};exports[_0x5924('0xc8')]=function(_0x267515,_0x21c025){var _0x7f0885;var _0xece7c4={};var _0x25805d;return db[_0x5924('0x37')][_0x5924('0x93')]({'where':{'id':_0x267515['params']['id']},'attributes':['id',_0x5924('0x36'),_0x5924('0x28')]})['then'](handleEntityNotFound(_0x21c025,null))[_0x5924('0x19')](function(_0x564188){if(!utils['isValidChannel'](_0x267515[_0x5924('0x44')][_0x5924('0x97')])){throw new db[(_0x5924('0x8e'))][(_0x5924('0x8f'))](_0x5924('0x9d'));}_0x7f0885=_0x564188;var _0x11875c={};_0x11875c['model']=_[_0x5924('0xc9')](db[_[_0x5924('0xa2')](_0x267515[_0x5924('0x44')][_0x5924('0x97')])+_0x5924('0xca')][_0x5924('0x38')]);_0x11875c['query']=_[_0x5924('0xc9')](_0x267515[_0x5924('0x44')]);_0x11875c[_0x5924('0xcb')]=_[_0x5924('0xcc')](_0x11875c['model'],_0x11875c[_0x5924('0x44')]);_0xece7c4['attributes']=_[_0x5924('0xcc')](_0x11875c[_0x5924('0xcd')],qs[_0x5924('0xce')](_0x267515['query'][_0x5924('0xce')]));_0xece7c4[_0x5924('0x4a')]=_0xece7c4[_0x5924('0x4a')][_0x5924('0x4f')]?_0xece7c4['attributes']:_0x11875c[_0x5924('0xcd')];_0xece7c4[_0x5924('0xcf')]=qs[_0x5924('0xd0')](_0x267515['query'][_0x5924('0xd0')]);_0xece7c4[_0x5924('0x43')]=qs[_0x5924('0xcb')](_[_0x5924('0xd1')](_0x267515[_0x5924('0x44')],_0x11875c['filters']));if(_0x267515[_0x5924('0x44')]['filter']){_0xece7c4['where']=_['merge'](_0xece7c4[_0x5924('0x43')],{'$or':_['map'](_0xece7c4['attributes'],function(_0x4224d1){var _0x17f814={};_0x17f814[_0x4224d1]={'$like':'%'+_0x267515[_0x5924('0x44')]['filter']+'%'};return _0x17f814;})});}_0xece7c4=_[_0x5924('0xd2')]({},_0xece7c4,_0x267515[_0x5924('0x59')]);switch(_0x7f0885[_0x5924('0x28')]){case _0x5924('0x29'):return db[_[_0x5924('0xa2')](_0x267515[_0x5924('0x44')][_0x5924('0x97')])+_0x5924('0xca')][_0x5924('0x4c')](_0xece7c4);case _0x5924('0x7d'):case _0x5924('0x23'):return _0x7f0885[_0x5924('0x27')+_[_0x5924('0xa2')](_0x267515[_0x5924('0x44')][_0x5924('0x97')])+'Queues'](_0xece7c4);default:throw new db[(_0x5924('0x8e'))][(_0x5924('0x8f'))](_0x5924('0xd3'));}})['then'](function(_0x4977bc){_0x25805d=_0x4977bc[_0x5924('0x4f')];if(!_0x267515['query'][_0x5924('0xc1')]('nolimit')){_0xece7c4['limit']=qs[_0x5924('0x13')](_0x267515[_0x5924('0x44')]['limit']);_0xece7c4[_0x5924('0x15')]=qs[_0x5924('0x15')](_0x267515[_0x5924('0x44')][_0x5924('0x15')]);}switch(_0x7f0885[_0x5924('0x28')]){case'admin':return db[_['capitalize'](_0x267515['query']['channel'])+_0x5924('0xca')][_0x5924('0x4c')](_0xece7c4);case _0x5924('0x7d'):case _0x5924('0x23'):return _0x7f0885[_0x5924('0x27')+_[_0x5924('0xa2')](_0x267515[_0x5924('0x44')]['channel'])+_0x5924('0x9f')](_0xece7c4);}})[_0x5924('0x19')](function(_0x286a03){return{'count':_0x25805d,'rows':_0x286a03};})['then'](respondWithResult(_0x21c025,null))[_0x5924('0x5b')](handleError(_0x21c025,null));};exports[_0x5924('0xd4')]=function(_0x1b4041,_0x28639f){var _0x145988={};var _0x18244c={};var _0x209db3;var _0x2b4f0b;return db[_0x5924('0x37')]['findOne']({'where':{'id':_0x1b4041[_0x5924('0x58')]['id']}})[_0x5924('0x19')](handleEntityNotFound(_0x28639f,null))[_0x5924('0x19')](function(_0x28902a){if(_0x28902a){_0x209db3=_0x28902a;_0x18244c['model']=_[_0x5924('0xc9')](db[_0x5924('0xa7')][_0x5924('0x38')]);_0x18244c[_0x5924('0x44')]=_[_0x5924('0xc9')](_0x1b4041[_0x5924('0x44')]);_0x18244c[_0x5924('0xcb')]=_[_0x5924('0xcc')](_0x18244c['model'],_0x18244c[_0x5924('0x44')]);_0x145988['attributes']=_[_0x5924('0xcc')](_0x18244c['model'],qs[_0x5924('0xce')](_0x1b4041[_0x5924('0x44')][_0x5924('0xce')]));_0x145988[_0x5924('0x4a')]=_0x145988[_0x5924('0x4a')][_0x5924('0x4f')]?_0x145988[_0x5924('0x4a')]:_0x18244c[_0x5924('0xcd')];_0x145988['order']=qs['sort'](_0x1b4041['query'][_0x5924('0xd0')]);_0x145988[_0x5924('0x43')]=qs[_0x5924('0xcb')](_[_0x5924('0xd1')](_0x1b4041[_0x5924('0x44')],_0x18244c['filters']));if(_0x1b4041['query']['filter']){_0x145988[_0x5924('0x43')]=_[_0x5924('0xd2')](_0x145988['where'],{'$or':_[_0x5924('0x30')](_0x145988['attributes'],function(_0x5cf8b8){var _0xb7c0fd={};_0xb7c0fd[_0x5cf8b8]={'$like':'%'+_0x1b4041['query'][_0x5924('0x2e')]+'%'};return _0xb7c0fd;})});}_0x145988=_['merge']({},_0x145988,_0x1b4041[_0x5924('0x59')]);return _0x209db3['getVoiceQueuesRt'](_0x145988);}})[_0x5924('0x19')](function(_0x180f14){if(_0x180f14){_0x2b4f0b=_0x180f14[_0x5924('0x4f')];if(!_0x1b4041['query'][_0x5924('0xc1')](_0x5924('0xd5'))){_0x145988[_0x5924('0x13')]=qs[_0x5924('0x13')](_0x1b4041[_0x5924('0x44')][_0x5924('0x13')]);_0x145988[_0x5924('0x15')]=qs[_0x5924('0x15')](_0x1b4041[_0x5924('0x44')][_0x5924('0x15')]);}return _0x209db3['getVoiceQueuesRt'](_0x145988);}})[_0x5924('0x19')](function(_0x217ff7){if(_0x217ff7){return _0x217ff7?{'count':_0x2b4f0b,'rows':_0x217ff7}:null;}})[_0x5924('0x19')](respondWithResult(_0x28639f,null))[_0x5924('0x5b')](handleError(_0x28639f,null));};exports['getGroups']=function(_0x4885d2,_0x544787){var _0x4c2140={};var _0x2d270b={};var _0xca3a9c;var _0x4ce34f;return db['User'][_0x5924('0x93')]({'where':{'id':_0x4885d2[_0x5924('0x58')]['id']}})[_0x5924('0x19')](handleEntityNotFound(_0x544787,null))['then'](function(_0x232955){if(_0x232955){_0xca3a9c=_0x232955;_0x2d270b['model']=_[_0x5924('0xc9')](db[_0x5924('0xd6')][_0x5924('0x38')]);_0x2d270b['query']=_['keys'](_0x4885d2[_0x5924('0x44')]);_0x2d270b['filters']=_[_0x5924('0xcc')](_0x2d270b[_0x5924('0xcd')],_0x2d270b[_0x5924('0x44')]);_0x4c2140[_0x5924('0x4a')]=_[_0x5924('0xcc')](_0x2d270b[_0x5924('0xcd')],qs[_0x5924('0xce')](_0x4885d2[_0x5924('0x44')]['fields']));_0x4c2140[_0x5924('0x4a')]=_0x4c2140[_0x5924('0x4a')][_0x5924('0x4f')]?_0x4c2140[_0x5924('0x4a')]:_0x2d270b[_0x5924('0xcd')];_0x4c2140[_0x5924('0xcf')]=qs['sort'](_0x4885d2['query']['sort']);_0x4c2140[_0x5924('0x43')]=qs[_0x5924('0xcb')](_[_0x5924('0xd1')](_0x4885d2['query'],_0x2d270b[_0x5924('0xcb')]));if(_0x4885d2['query']['filter']){_0x4c2140[_0x5924('0x43')]=_[_0x5924('0xd2')](_0x4c2140[_0x5924('0x43')],{'$or':_[_0x5924('0x30')](_0x4c2140[_0x5924('0x4a')],function(_0x597dc2){var _0x5dd6a1={};_0x5dd6a1[_0x597dc2]={'$like':'%'+_0x4885d2[_0x5924('0x44')][_0x5924('0x2e')]+'%'};return _0x5dd6a1;})});}_0x4c2140=_[_0x5924('0xd2')]({},_0x4c2140,_0x4885d2[_0x5924('0x59')]);return _0xca3a9c[_0x5924('0xd7')](_0x4c2140);}})['then'](function(_0x64e1d4){if(_0x64e1d4){_0x4ce34f=_0x64e1d4[_0x5924('0x4f')];if(!_0x4885d2[_0x5924('0x44')][_0x5924('0xc1')](_0x5924('0xd5'))){_0x4c2140[_0x5924('0x13')]=qs[_0x5924('0x13')](_0x4885d2['query']['limit']);_0x4c2140[_0x5924('0x15')]=qs[_0x5924('0x15')](_0x4885d2[_0x5924('0x44')][_0x5924('0x15')]);}return _0xca3a9c['getGroups'](_0x4c2140);}})['then'](function(_0x3b80dd){if(_0x3b80dd){return _0x3b80dd?{'count':_0x4ce34f,'rows':_0x3b80dd}:null;}})[_0x5924('0x19')](respondWithResult(_0x544787,null))[_0x5924('0x5b')](handleError(_0x544787,null));};exports[_0x5924('0xd8')]=function(_0x5efcae,_0xb22d5b){var _0x256b3f={'raw':!![],'where':{}};var _0x1909e8={};var _0x48e014={'count':0x0,'rows':[]};return db[_0x5924('0x37')]['findOne']({'where':{'id':_0x5efcae[_0x5924('0x58')]['id']}})[_0x5924('0x19')](handleEntityNotFound(_0xb22d5b,null))['then'](function(_0x50ca0b){if(_0x50ca0b){_0x1909e8[_0x5924('0xcd')]=_[_0x5924('0xc9')](db[_0x5924('0xd9')][_0x5924('0x38')]);_0x1909e8[_0x5924('0x44')]=_[_0x5924('0xc9')](_0x5efcae['query']);_0x1909e8[_0x5924('0xcb')]=_[_0x5924('0xcc')](_0x1909e8[_0x5924('0xcd')],_0x1909e8['query']);_0x256b3f[_0x5924('0x4a')]=_[_0x5924('0xcc')](_0x1909e8[_0x5924('0xcd')],qs[_0x5924('0xce')](_0x5efcae[_0x5924('0x44')][_0x5924('0xce')]));_0x256b3f[_0x5924('0x4a')]=_0x256b3f[_0x5924('0x4a')][_0x5924('0x4f')]?_0x256b3f['attributes']:_0x1909e8[_0x5924('0xcd')];if(!_0x5efcae['query'][_0x5924('0xc1')](_0x5924('0xd5'))){_0x256b3f[_0x5924('0x13')]=qs[_0x5924('0x13')](_0x5efcae['query']['limit']);_0x256b3f[_0x5924('0x15')]=qs[_0x5924('0x15')](_0x5efcae['query']['offset']);}_0x256b3f['order']=qs[_0x5924('0xd0')](_0x5efcae[_0x5924('0x44')][_0x5924('0xd0')]);_0x256b3f[_0x5924('0x43')]=qs[_0x5924('0xcb')](_[_0x5924('0xd1')](_0x5efcae[_0x5924('0x44')],_0x1909e8[_0x5924('0xcb')]));_0x256b3f[_0x5924('0x43')]['UserId']=_0x50ca0b['id'];if(_0x5efcae[_0x5924('0x44')][_0x5924('0x2e')]){_0x256b3f[_0x5924('0x43')]=_[_0x5924('0xd2')](_0x256b3f[_0x5924('0x43')],{'$or':_[_0x5924('0x30')](_0x256b3f[_0x5924('0x4a')],function(_0x1bd389){var _0x48b7c2={};_0x48b7c2[_0x1bd389]={'$like':'%'+_0x5efcae['query']['filter']+'%'};return _0x48b7c2;})});}_0x256b3f=_[_0x5924('0xd2')]({},_0x256b3f,_0x5efcae[_0x5924('0x59')]);return db['VoiceRecording'][_0x5924('0x14')]({'where':_0x256b3f['where']})[_0x5924('0x19')](function(_0x1dee0a){_0x48e014['count']=_0x1dee0a;if(_0x5efcae['query'][_0x5924('0x45')]){_0x256b3f[_0x5924('0x46')]=[{'all':!![]}];}return db[_0x5924('0xd9')]['findAll'](_0x256b3f);})[_0x5924('0x19')](function(_0x2c9785){_0x48e014[_0x5924('0x4d')]=_0x2c9785;return _0x48e014;});}})[_0x5924('0x19')](respondWithFilteredResult(_0xb22d5b,_0x256b3f))[_0x5924('0x5b')](handleError(_0xb22d5b,null));};exports[_0x5924('0xda')]=function(_0x41547f,_0x2ac58a){var _0x77deec={'raw':!![],'where':{}};var _0x2b2531={};var _0x1e4859={'count':0x0,'rows':[]};return db['User'][_0x5924('0x93')]({'where':{'id':_0x41547f[_0x5924('0x58')]['id']}})[_0x5924('0x19')](handleEntityNotFound(_0x2ac58a,null))[_0x5924('0x19')](function(_0x301e51){if(_0x301e51){_0x2b2531['model']=_[_0x5924('0xc9')](db['ScreenRecording'][_0x5924('0x38')]);_0x2b2531[_0x5924('0x44')]=_['keys'](_0x41547f[_0x5924('0x44')]);_0x2b2531[_0x5924('0xcb')]=_[_0x5924('0xcc')](_0x2b2531[_0x5924('0xcd')],_0x2b2531[_0x5924('0x44')]);_0x77deec[_0x5924('0x4a')]=_[_0x5924('0xcc')](_0x2b2531['model'],qs[_0x5924('0xce')](_0x41547f[_0x5924('0x44')][_0x5924('0xce')]));_0x77deec[_0x5924('0x4a')]=_0x77deec['attributes'][_0x5924('0x4f')]?_0x77deec[_0x5924('0x4a')]:_0x2b2531[_0x5924('0xcd')];if(!_0x41547f[_0x5924('0x44')][_0x5924('0xc1')](_0x5924('0xd5'))){_0x77deec['limit']=qs[_0x5924('0x13')](_0x41547f[_0x5924('0x44')][_0x5924('0x13')]);_0x77deec[_0x5924('0x15')]=qs['offset'](_0x41547f['query'][_0x5924('0x15')]);}_0x77deec[_0x5924('0xcf')]=qs[_0x5924('0xd0')](_0x41547f[_0x5924('0x44')][_0x5924('0xd0')]);_0x77deec[_0x5924('0x43')]=qs[_0x5924('0xcb')](_[_0x5924('0xd1')](_0x41547f[_0x5924('0x44')],_0x2b2531[_0x5924('0xcb')]));_0x77deec[_0x5924('0x43')][_0x5924('0xdb')]=_0x301e51['id'];if(_0x41547f['query'][_0x5924('0x2e')]){_0x77deec[_0x5924('0x43')]=_[_0x5924('0xd2')](_0x77deec[_0x5924('0x43')],{'$or':_['map'](_0x77deec[_0x5924('0x4a')],function(_0x607122){var _0xfdd55={};_0xfdd55[_0x607122]={'$like':'%'+_0x41547f['query'][_0x5924('0x2e')]+'%'};return _0xfdd55;})});}_0x77deec=_['merge']({},_0x77deec,_0x41547f[_0x5924('0x59')]);return db['ScreenRecording'][_0x5924('0x14')]({'where':_0x77deec[_0x5924('0x43')]})[_0x5924('0x19')](function(_0x5afbcc){_0x1e4859[_0x5924('0x14')]=_0x5afbcc;if(_0x41547f[_0x5924('0x44')][_0x5924('0x45')]){_0x77deec[_0x5924('0x46')]=[{'all':!![]}];}return db[_0x5924('0xdc')][_0x5924('0x4c')](_0x77deec);})[_0x5924('0x19')](function(_0x74dd0e){_0x1e4859[_0x5924('0x4d')]=_0x74dd0e;return _0x1e4859;});}})[_0x5924('0x19')](respondWithFilteredResult(_0x2ac58a,_0x77deec))[_0x5924('0x5b')](handleError(_0x2ac58a,null));};exports[_0x5924('0xdd')]=function(_0x174036,_0x40e806){var _0x2ceca9={};var _0x5c73f7={};var _0x18a66a;var _0x5cdbf6;return db['User'][_0x5924('0x93')]({'where':{'id':_0x174036[_0x5924('0x58')]['id']}})['then'](handleEntityNotFound(_0x40e806,null))[_0x5924('0x19')](function(_0x211cf6){if(_0x211cf6){_0x18a66a=_0x211cf6;_0x5c73f7[_0x5924('0xcd')]=_[_0x5924('0xc9')](db[_0x5924('0xde')][_0x5924('0x38')]);_0x5c73f7['query']=_['keys'](_0x174036[_0x5924('0x44')]);_0x5c73f7[_0x5924('0xcb')]=_['intersection'](_0x5c73f7[_0x5924('0xcd')],_0x5c73f7['query']);_0x2ceca9[_0x5924('0x4a')]=_['intersection'](_0x5c73f7[_0x5924('0xcd')],qs['fields'](_0x174036[_0x5924('0x44')][_0x5924('0xce')]));_0x2ceca9[_0x5924('0x4a')]=_0x2ceca9[_0x5924('0x4a')][_0x5924('0x4f')]?_0x2ceca9[_0x5924('0x4a')]:_0x5c73f7['model'];_0x2ceca9[_0x5924('0xcf')]=qs[_0x5924('0xd0')](_0x174036[_0x5924('0x44')][_0x5924('0xd0')]);_0x2ceca9[_0x5924('0x43')]=qs['filters'](_[_0x5924('0xd1')](_0x174036[_0x5924('0x44')],_0x5c73f7['filters']));if(_0x174036[_0x5924('0x44')][_0x5924('0x2e')]){_0x2ceca9[_0x5924('0x43')]=_['merge'](_0x2ceca9[_0x5924('0x43')],{'$or':_[_0x5924('0x30')](_0x2ceca9[_0x5924('0x4a')],function(_0x56336e){var _0x9274b={};_0x9274b[_0x56336e]={'$like':'%'+_0x174036[_0x5924('0x44')][_0x5924('0x2e')]+'%'};return _0x9274b;})});}_0x2ceca9=_[_0x5924('0xd2')]({},_0x2ceca9,_0x174036[_0x5924('0x59')]);return _0x18a66a[_0x5924('0xdd')](_0x2ceca9);}})[_0x5924('0x19')](function(_0x9a6ecc){if(_0x9a6ecc){_0x5cdbf6=_0x9a6ecc[_0x5924('0x4f')];if(!_0x174036[_0x5924('0x44')][_0x5924('0xc1')](_0x5924('0xd5'))){_0x2ceca9['limit']=qs[_0x5924('0x13')](_0x174036[_0x5924('0x44')]['limit']);_0x2ceca9[_0x5924('0x15')]=qs[_0x5924('0x15')](_0x174036[_0x5924('0x44')][_0x5924('0x15')]);}return _0x18a66a[_0x5924('0xdd')](_0x2ceca9);}})[_0x5924('0x19')](function(_0x2afda6){if(_0x2afda6){return _0x2afda6?{'count':_0x5cdbf6,'rows':_0x2afda6}:null;}})[_0x5924('0x19')](respondWithResult(_0x40e806,null))['catch'](handleError(_0x40e806,null));};exports['getOpenchannelInteractions']=function(_0x200d67,_0xc3f7f4){var _0x207a47={};var _0x25b939={};var _0x47a17a;var _0x5b517b;return db['User'][_0x5924('0x93')]({'where':{'id':_0x200d67[_0x5924('0x58')]['id']}})['then'](handleEntityNotFound(_0xc3f7f4,null))[_0x5924('0x19')](function(_0x179157){if(_0x179157){_0x47a17a=_0x179157;_0x25b939[_0x5924('0xcd')]=_[_0x5924('0xc9')](db[_0x5924('0xdf')][_0x5924('0x38')]);_0x25b939[_0x5924('0x44')]=_['keys'](_0x200d67[_0x5924('0x44')]);_0x25b939[_0x5924('0xcb')]=_[_0x5924('0xcc')](_0x25b939[_0x5924('0xcd')],_0x25b939[_0x5924('0x44')]);_0x207a47['attributes']=_[_0x5924('0xcc')](_0x25b939[_0x5924('0xcd')],qs[_0x5924('0xce')](_0x200d67[_0x5924('0x44')][_0x5924('0xce')]));_0x207a47[_0x5924('0x4a')]=_0x207a47['attributes']['length']?_0x207a47[_0x5924('0x4a')]:_0x25b939[_0x5924('0xcd')];_0x207a47['order']=qs[_0x5924('0xd0')](_0x200d67[_0x5924('0x44')][_0x5924('0xd0')]);_0x207a47[_0x5924('0x43')]=qs['filters'](_[_0x5924('0xd1')](_0x200d67['query'],_0x25b939[_0x5924('0xcb')]));if(_0x200d67[_0x5924('0x44')]['filter']){_0x207a47['where']=_[_0x5924('0xd2')](_0x207a47[_0x5924('0x43')],{'$or':_['map'](_0x207a47['attributes'],function(_0x184d2b){var _0x876b79={};_0x876b79[_0x184d2b]={'$like':'%'+_0x200d67['query'][_0x5924('0x2e')]+'%'};return _0x876b79;})});}_0x207a47=_[_0x5924('0xd2')]({},_0x207a47,_0x200d67[_0x5924('0x59')]);return _0x47a17a[_0x5924('0xe0')](_0x207a47);}})[_0x5924('0x19')](function(_0x3a18d3){if(_0x3a18d3){_0x5b517b=_0x3a18d3[_0x5924('0x4f')];if(!_0x200d67[_0x5924('0x44')][_0x5924('0xc1')]('nolimit')){_0x207a47[_0x5924('0x13')]=qs[_0x5924('0x13')](_0x200d67['query']['limit']);_0x207a47[_0x5924('0x15')]=qs[_0x5924('0x15')](_0x200d67['query'][_0x5924('0x15')]);}return _0x47a17a['getOpenchannelInteractions'](_0x207a47);}})[_0x5924('0x19')](function(_0x5bb1f0){if(_0x5bb1f0){return _0x5bb1f0?{'count':_0x5b517b,'rows':_0x5bb1f0}:null;}})['then'](respondWithResult(_0xc3f7f4,null))['catch'](handleError(_0xc3f7f4,null));};exports['getMailInteractions']=function(_0x365aca,_0xbbaa7e){var _0x5712ab={'raw':!![],'where':{}};var _0x262045={};var _0x16293d={'count':0x0,'rows':[]};return db[_0x5924('0x37')]['findOne']({'where':{'id':_0x365aca['params']['id']}})['then'](handleEntityNotFound(_0xbbaa7e,null))[_0x5924('0x19')](function(_0x35d698){if(_0x35d698){_0x262045[_0x5924('0xcd')]=_[_0x5924('0xc9')](db[_0x5924('0xe1')][_0x5924('0x38')]);_0x262045[_0x5924('0x44')]=_[_0x5924('0xc9')](_0x365aca[_0x5924('0x44')]);_0x262045[_0x5924('0xcb')]=_[_0x5924('0xcc')](_0x262045['model'],_0x262045[_0x5924('0x44')]);_0x5712ab[_0x5924('0x4a')]=_[_0x5924('0xcc')](_0x262045[_0x5924('0xcd')],qs[_0x5924('0xce')](_0x365aca[_0x5924('0x44')][_0x5924('0xce')]));_0x5712ab[_0x5924('0x4a')]=_0x5712ab['attributes']['length']?_0x5712ab['attributes']:_0x262045[_0x5924('0xcd')];if(!_0x365aca[_0x5924('0x44')]['hasOwnProperty'](_0x5924('0xd5'))){_0x5712ab[_0x5924('0x13')]=qs[_0x5924('0x13')](_0x365aca[_0x5924('0x44')][_0x5924('0x13')]);_0x5712ab['offset']=qs[_0x5924('0x15')](_0x365aca[_0x5924('0x44')]['offset']);}_0x5712ab[_0x5924('0xcf')]=qs[_0x5924('0xd0')](_0x365aca['query'][_0x5924('0xd0')]);_0x5712ab[_0x5924('0x43')]=qs[_0x5924('0xcb')](_[_0x5924('0xd1')](_0x365aca[_0x5924('0x44')],_0x262045[_0x5924('0xcb')]));_0x5712ab[_0x5924('0x43')][_0x5924('0xdb')]=_0x35d698['id'];if(_0x365aca[_0x5924('0x44')][_0x5924('0x2e')]){_0x5712ab[_0x5924('0x43')]=_['merge'](_0x5712ab['where'],{'$or':_[_0x5924('0x30')](_0x5712ab[_0x5924('0x4a')],function(_0x5c2e47){var _0x164509={};_0x164509[_0x5c2e47]={'$like':'%'+_0x365aca['query'][_0x5924('0x2e')]+'%'};return _0x164509;})});}_0x5712ab=_['merge']({},_0x5712ab,_0x365aca[_0x5924('0x59')]);return db[_0x5924('0xe1')][_0x5924('0x14')]({'where':_0x5712ab[_0x5924('0x43')]})[_0x5924('0x19')](function(_0x35f87a){_0x16293d[_0x5924('0x14')]=_0x35f87a;if(_0x365aca[_0x5924('0x44')][_0x5924('0x45')]){_0x5712ab[_0x5924('0x46')]=[{'all':!![]}];}return db[_0x5924('0xe1')][_0x5924('0x4c')](_0x5712ab);})['then'](function(_0x32ab95){_0x16293d[_0x5924('0x4d')]=_0x32ab95;return _0x16293d;});}})[_0x5924('0x19')](respondWithFilteredResult(_0xbbaa7e,_0x5712ab))['catch'](handleError(_0xbbaa7e,null));};exports[_0x5924('0xe2')]=function(_0x39c987,_0x49b283){var _0x515150={};var _0x18f05a={};var _0x540611;var _0x32ba79;return db[_0x5924('0x37')]['findOne']({'where':{'id':_0x39c987['params']['id']}})[_0x5924('0x19')](handleEntityNotFound(_0x49b283,null))[_0x5924('0x19')](function(_0x444f09){if(_0x444f09){_0x540611=_0x444f09;_0x18f05a['model']=_[_0x5924('0xc9')](db[_0x5924('0xe3')][_0x5924('0x38')]);_0x18f05a['query']=_[_0x5924('0xc9')](_0x39c987[_0x5924('0x44')]);_0x18f05a['filters']=_[_0x5924('0xcc')](_0x18f05a[_0x5924('0xcd')],_0x18f05a[_0x5924('0x44')]);_0x515150[_0x5924('0x4a')]=_[_0x5924('0xcc')](_0x18f05a[_0x5924('0xcd')],qs[_0x5924('0xce')](_0x39c987[_0x5924('0x44')][_0x5924('0xce')]));_0x515150[_0x5924('0x4a')]=_0x515150[_0x5924('0x4a')][_0x5924('0x4f')]?_0x515150[_0x5924('0x4a')]:_0x18f05a['model'];_0x515150[_0x5924('0xcf')]=qs[_0x5924('0xd0')](_0x39c987[_0x5924('0x44')][_0x5924('0xd0')]);_0x515150[_0x5924('0x43')]=qs['filters'](_[_0x5924('0xd1')](_0x39c987['query'],_0x18f05a[_0x5924('0xcb')]));if(_0x39c987[_0x5924('0x44')]['filter']){_0x515150[_0x5924('0x43')]=_[_0x5924('0xd2')](_0x515150[_0x5924('0x43')],{'$or':_[_0x5924('0x30')](_0x515150[_0x5924('0x4a')],function(_0x143b08){var _0x30981d={};_0x30981d[_0x143b08]={'$like':'%'+_0x39c987[_0x5924('0x44')][_0x5924('0x2e')]+'%'};return _0x30981d;})});}_0x515150=_['merge']({},_0x515150,_0x39c987['options']);return _0x540611[_0x5924('0xe2')](_0x515150);}})[_0x5924('0x19')](function(_0x476f87){if(_0x476f87){_0x32ba79=_0x476f87['length'];if(!_0x39c987[_0x5924('0x44')]['hasOwnProperty'](_0x5924('0xd5'))){_0x515150[_0x5924('0x13')]=qs[_0x5924('0x13')](_0x39c987[_0x5924('0x44')][_0x5924('0x13')]);_0x515150[_0x5924('0x15')]=qs[_0x5924('0x15')](_0x39c987[_0x5924('0x44')][_0x5924('0x15')]);}return _0x540611[_0x5924('0xe2')](_0x515150);}})[_0x5924('0x19')](function(_0x20187a){if(_0x20187a){return _0x20187a?{'count':_0x32ba79,'rows':_0x20187a}:null;}})[_0x5924('0x19')](respondWithResult(_0x49b283,null))[_0x5924('0x5b')](handleError(_0x49b283,null));};exports['getFaxInteractions']=function(_0x426478,_0x4270fb){var _0x4c8bc1={};var _0x3033c5={};var _0x202cbd;var _0x57fd5f;return db[_0x5924('0x37')]['findOne']({'where':{'id':_0x426478[_0x5924('0x58')]['id']}})[_0x5924('0x19')](handleEntityNotFound(_0x4270fb,null))[_0x5924('0x19')](function(_0xaaf97c){if(_0xaaf97c){_0x202cbd=_0xaaf97c;_0x3033c5['model']=_[_0x5924('0xc9')](db[_0x5924('0xe4')]['rawAttributes']);_0x3033c5[_0x5924('0x44')]=_[_0x5924('0xc9')](_0x426478[_0x5924('0x44')]);_0x3033c5['filters']=_[_0x5924('0xcc')](_0x3033c5[_0x5924('0xcd')],_0x3033c5[_0x5924('0x44')]);_0x4c8bc1[_0x5924('0x4a')]=_[_0x5924('0xcc')](_0x3033c5[_0x5924('0xcd')],qs[_0x5924('0xce')](_0x426478[_0x5924('0x44')]['fields']));_0x4c8bc1[_0x5924('0x4a')]=_0x4c8bc1[_0x5924('0x4a')][_0x5924('0x4f')]?_0x4c8bc1['attributes']:_0x3033c5[_0x5924('0xcd')];_0x4c8bc1[_0x5924('0xcf')]=qs[_0x5924('0xd0')](_0x426478[_0x5924('0x44')][_0x5924('0xd0')]);_0x4c8bc1['where']=qs[_0x5924('0xcb')](_['pick'](_0x426478['query'],_0x3033c5[_0x5924('0xcb')]));if(_0x426478[_0x5924('0x44')][_0x5924('0x2e')]){_0x4c8bc1[_0x5924('0x43')]=_['merge'](_0x4c8bc1[_0x5924('0x43')],{'$or':_[_0x5924('0x30')](_0x4c8bc1['attributes'],function(_0x24cf8f){var _0x1cf3fc={};_0x1cf3fc[_0x24cf8f]={'$like':'%'+_0x426478[_0x5924('0x44')][_0x5924('0x2e')]+'%'};return _0x1cf3fc;})});}_0x4c8bc1=_[_0x5924('0xd2')]({},_0x4c8bc1,_0x426478[_0x5924('0x59')]);return _0x202cbd[_0x5924('0xe5')](_0x4c8bc1);}})[_0x5924('0x19')](function(_0x4de75e){if(_0x4de75e){_0x57fd5f=_0x4de75e[_0x5924('0x4f')];if(!_0x426478[_0x5924('0x44')][_0x5924('0xc1')](_0x5924('0xd5'))){_0x4c8bc1[_0x5924('0x13')]=qs[_0x5924('0x13')](_0x426478['query'][_0x5924('0x13')]);_0x4c8bc1[_0x5924('0x15')]=qs['offset'](_0x426478[_0x5924('0x44')][_0x5924('0x15')]);}return _0x202cbd[_0x5924('0xe5')](_0x4c8bc1);}})[_0x5924('0x19')](function(_0x5b4ce2){if(_0x5b4ce2){return _0x5b4ce2?{'count':_0x57fd5f,'rows':_0x5b4ce2}:null;}})['then'](respondWithResult(_0x4270fb,null))[_0x5924('0x5b')](handleError(_0x4270fb,null));};exports[_0x5924('0xe6')]=function(_0x2b0ec4,_0x117a67){var _0x3f012d={};var _0x3f8789={};var _0x1045fe;var _0x141529;return db[_0x5924('0x37')]['findOne']({'where':{'id':_0x2b0ec4[_0x5924('0x58')]['id']}})[_0x5924('0x19')](handleEntityNotFound(_0x117a67,null))[_0x5924('0x19')](function(_0x32e43e){if(_0x32e43e){_0x1045fe=_0x32e43e;_0x3f8789[_0x5924('0xcd')]=_[_0x5924('0xc9')](db[_0x5924('0xe7')][_0x5924('0x38')]);_0x3f8789[_0x5924('0x44')]=_['keys'](_0x2b0ec4[_0x5924('0x44')]);_0x3f8789[_0x5924('0xcb')]=_['intersection'](_0x3f8789['model'],_0x3f8789[_0x5924('0x44')]);_0x3f012d[_0x5924('0x4a')]=_[_0x5924('0xcc')](_0x3f8789[_0x5924('0xcd')],qs['fields'](_0x2b0ec4[_0x5924('0x44')][_0x5924('0xce')]));_0x3f012d['attributes']=_0x3f012d[_0x5924('0x4a')][_0x5924('0x4f')]?_0x3f012d[_0x5924('0x4a')]:_0x3f8789['model'];_0x3f012d[_0x5924('0xcf')]=qs['sort'](_0x2b0ec4[_0x5924('0x44')][_0x5924('0xd0')]);_0x3f012d[_0x5924('0x43')]=qs[_0x5924('0xcb')](_[_0x5924('0xd1')](_0x2b0ec4[_0x5924('0x44')],_0x3f8789['filters']));if(_0x2b0ec4['query'][_0x5924('0x2e')]){_0x3f012d[_0x5924('0x43')]=_[_0x5924('0xd2')](_0x3f012d[_0x5924('0x43')],{'$or':_['map'](_0x3f012d[_0x5924('0x4a')],function(_0x580084){var _0x5c8793={};_0x5c8793[_0x580084]={'$like':'%'+_0x2b0ec4[_0x5924('0x44')][_0x5924('0x2e')]+'%'};return _0x5c8793;})});}_0x3f012d=_[_0x5924('0xd2')]({},_0x3f012d,_0x2b0ec4['options']);return _0x1045fe[_0x5924('0xe6')](_0x3f012d);}})[_0x5924('0x19')](function(_0x18ce1a){if(_0x18ce1a){_0x141529=_0x18ce1a['length'];if(!_0x2b0ec4[_0x5924('0x44')][_0x5924('0xc1')]('nolimit')){_0x3f012d[_0x5924('0x13')]=qs['limit'](_0x2b0ec4[_0x5924('0x44')][_0x5924('0x13')]);_0x3f012d[_0x5924('0x15')]=qs[_0x5924('0x15')](_0x2b0ec4[_0x5924('0x44')][_0x5924('0x15')]);}return _0x1045fe['getWhatsappInteractions'](_0x3f012d);}})[_0x5924('0x19')](function(_0x27b695){if(_0x27b695){return _0x27b695?{'count':_0x141529,'rows':_0x27b695}:null;}})['then'](respondWithResult(_0x117a67,null))[_0x5924('0x5b')](handleError(_0x117a67,null));};exports['login']=function(_0x4ce91c,_0x4622d9,_0x4978f6){var _0x3afbca;var _0x14d951;var _0x4ebc78;var _0x4b66a7=!_[_0x5924('0x67')](_0x4ce91c[_0x5924('0x58')]['id'])?_0x4ce91c[_0x5924('0x58')]['id']:!_[_0x5924('0x67')](_0x4ce91c[_0x5924('0x7d')]['id'])?_0x4ce91c['user']['id']:null;return db[_0x5924('0x37')][_0x5924('0x5a')]({'where':{'id':_0x4b66a7,'role':{'$or':[_0x5924('0x29'),_0x5924('0x7d'),'agent']}},'attributes':['id',_0x5924('0x36'),_0x5924('0xe8'),'mobile',_0x5924('0x28'),'internal',_0x5924('0x99')]})[_0x5924('0x19')](function(_0x2976d4){if(_0x2976d4){if(_0x2976d4['role']===_0x5924('0x23')){_0x3afbca=_0x2976d4;if(_0x4ce91c[_0x5924('0x5d')]['interface']){_0x4ebc78=util['format'](_0x5924('0xe9'),_0x3afbca[_0x4ce91c['body']['interface']]);}else if(_0x4ce91c[_0x5924('0x5d')][_0x5924('0xea')]){_0x4ebc78=util[_0x5924('0xa5')]('SIP/%s',_0x4ce91c[_0x5924('0x5d')][_0x5924('0xea')]);}else{_0x4ebc78=util[_0x5924('0xa5')](_0x5924('0xa6'),_0x3afbca[_0x5924('0x36')]);}socket['to'](util['format'](_0x5924('0xeb'),_0x3afbca[_0x5924('0x36')]))[_0x5924('0x24')](_0x5924('0xec'),{'user':{'id':_0x3afbca['id'],'name':_0x3afbca[_0x5924('0x36')]},'ip':_0x4ce91c['headers'][_0x5924('0xed')]||_0x4ce91c['connection'][_0x5924('0xee')]||_0x4ce91c[_0x5924('0xef')][_0x5924('0xee')]||_0x4ce91c[_0x5924('0xf0')][_0x5924('0xef')][_0x5924('0xee')]});return new Promise(function(_0x1d6f17,_0x483127){db['sequelize']['transaction']()[_0x5924('0x19')](_0x30d4d8=>{db[_0x5924('0xa7')][_0x5924('0x26')]({'where':{'membername':_0x3afbca[_0x5924('0x36')]},'individualHooks':!![]},{'transaction':_0x30d4d8})[_0x5924('0x19')](function(){return _0x30d4d8['commit']();})[_0x5924('0x19')](_0x1d6f17)[_0x5924('0x5b')](_0x483127);});});}}else{throw new db[(_0x5924('0x8e'))][(_0x5924('0x8f'))](_0x5924('0xf1'));}})[_0x5924('0x19')](function(){if(_0x3afbca){return _0x3afbca['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x42e9fe){if(_0x3afbca){if(_0x42e9fe){_0x14d951=_0x42e9fe;if(_0x14d951[_0x5924('0x4f')]){var _0x19d43b=_0x14d951[_0x5924('0x30')](function(_0x5056d6){return{'membername':_0x3afbca['name'],'UserId':_0x3afbca['id'],'queue_name':_0x5056d6[_0x5924('0x36')],'VoiceQueueId':_0x5056d6['id'],'interface':_0x4ebc78,'paused':_0x3afbca[_0x5924('0x99')]||![],'penalty':_0x5056d6[_0x5924('0xf2')]||0x0};});return db[_0x5924('0xa7')]['bulkCreate'](_0x19d43b);}}}})[_0x5924('0x19')](function(){if(_0x3afbca){return db[_0x5924('0xf3')]['findAll']({'where':{'membername':_0x3afbca[_0x5924('0x36')],'exitAt':null}});}})[_0x5924('0x19')](function(_0x5f0a8f){if(_0x3afbca){var _0x2cf020=[];_0x5f0a8f[_0x5924('0xf4')](function(_0x570034){_0x2cf020[_0x5924('0x4b')](_0x570034[_0x5924('0x5c')]({'exitAt':moment()[_0x5924('0xa5')](_0x5924('0xf5'))}));});return Promise['all'](_0x2cf020);}})[_0x5924('0x19')](function(){if(_0x3afbca){var _0x2a5648=[];var _0x2dd18e=[];var _0x373864=utils['getChannels']();var _0x4f37fc={'membername':_0x3afbca['name'],'interface':_0x4ebc78,'enterAt':moment()['format'](_0x5924('0xf5')),'role':_0x3afbca[_0x5924('0x28')],'internal':_0x3afbca[_0x5924('0x62')]};_0x373864['forEach'](function(_0x5eab29){_0x2a5648[_0x5924('0x4b')](_['merge']({'channel':_0x5eab29,'type':_0x5924('0xf6'),'data1':_0x4ce91c[_0x5924('0x5d')][_0x5924('0xf7')],'data2':_0x4ebc78},_0x4f37fc));if(_0x3afbca[_0x5924('0x99')]){_0x2dd18e[_0x5924('0x4b')](_['merge']({'channel':_0x5eab29,'type':'PAUSE','data1':_0x5924('0xf8')},_0x4f37fc));}});return db['MemberReport']['bulkCreate'](_0x2a5648['concat'](_0x2dd18e),{'individualHooks':!![]});}})[_0x5924('0x19')](function(){if(_0x3afbca){return _0x3afbca['update']({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3afbca[_0x5924('0x99')]||![],'mailPause':_0x3afbca[_0x5924('0x99')]||![],'chatPause':_0x3afbca[_0x5924('0x99')]||![],'faxPause':_0x3afbca[_0x5924('0x99')]||![],'smsPause':_0x3afbca[_0x5924('0x99')]||![],'openchannelPause':_0x3afbca[_0x5924('0x99')]||![],'whatsappPause':_0x3afbca[_0x5924('0x99')]||![],'pauseType':_0x3afbca[_0x5924('0x99')]?'LOGININPAUSE':null,'interface':_0x4ebc78,'lastPauseAt':moment()[_0x5924('0xa5')](_0x5924('0xf5'))});}})['then'](function(_0x1a3935){if(_0x4ce91c[_0x5924('0xf9')]){return _0x4978f6();}else{return Promise[_0x5924('0xfa')](_0x1a3935)[_0x5924('0x19')](respondWithResult(_0x4622d9,null));}})[_0x5924('0x5b')](handleError(_0x4622d9,null));};exports[_0x5924('0xfb')]=function(_0x32f839,_0x20665c){var _0x30baa3;return db[_0x5924('0x37')][_0x5924('0x5a')]({'where':{'id':_0x32f839[_0x5924('0x58')]['id'],'role':_0x5924('0x23')},'attributes':['id',_0x5924('0x36'),_0x5924('0x28')]})[_0x5924('0x19')](handleEntityNotFound(_0x20665c,null))[_0x5924('0x19')](function(_0x1ca1ff){if(_0x1ca1ff){_0x30baa3=_0x1ca1ff;return db[_0x5924('0xa7')][_0x5924('0x26')]({'where':{'membername':_0x30baa3[_0x5924('0x36')]},'individualHooks':!![]});}})[_0x5924('0x19')](function(){return db[_0x5924('0xf3')][_0x5924('0x4c')]({'where':{'membername':_0x30baa3[_0x5924('0x36')],'exitAt':null}});})['then'](function(_0x486b81){var _0x3c358c=[];_0x486b81[_0x5924('0xf4')](function(_0x3f6397){_0x3c358c['push'](_0x3f6397[_0x5924('0x5c')]({'exitAt':moment()['format'](_0x5924('0xf5'))}));});return Promise[_0x5924('0x56')](_0x3c358c);})['then'](function(){return _0x30baa3[_0x5924('0x5c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x5924('0x19')](respondWithResult(_0x20665c,null))[_0x5924('0x5b')](handleError(_0x20665c,null));};exports[_0x5924('0xfc')]=function(_0x937a99,_0x45b0ff){var _0x5117d0;return db[_0x5924('0xa7')][_0x5924('0x5c')]({'paused':0x1},{'where':{'UserId':_0x937a99[_0x5924('0x58')]['id']},'individualHooks':!![]})[_0x5924('0x19')](function(){return db[_0x5924('0x37')][_0x5924('0x5a')]({'where':{'id':_0x937a99[_0x5924('0x58')]['id'],'role':_0x5924('0x23')},'attributes':['id',_0x5924('0x36'),_0x5924('0x28'),_0x5924('0x62'),'interface',_0x5924('0x98')]});})[_0x5924('0x19')](handleEntityNotFound(_0x45b0ff,null))[_0x5924('0x19')](function(_0x200456){if(_0x200456){_0x5117d0=_0x200456;return respondWithRpcPromise(_0x5924('0xfd'),_0x5924('0xfc'),{'id':_0x5117d0['id'],'name':_0x5117d0[_0x5924('0x36')],'pause':!![]});}})['then'](function(){if(_0x5117d0){return db[_0x5924('0xf3')][_0x5924('0x4c')]({'where':{'membername':_0x5117d0[_0x5924('0x36')],'type':'PAUSE','exitAt':null}});}})[_0x5924('0x19')](function(_0x455a89){if(_0x455a89[_0x5924('0x4f')]){var _0x4723d4=moment()[_0x5924('0xa5')](_0x5924('0xf5'));for(var _0x96485e=0x0,_0x3f1ddb=_0x455a89['length'];_0x96485e<_0x3f1ddb;_0x96485e++){_0x455a89[_0x96485e][_0x5924('0xfe')]({'exitAt':_0x4723d4});}}})[_0x5924('0x19')](function(){var _0x39ff7d=[];var _0x3d6396=utils['getChannels']();_0x3d6396[_0x5924('0xf4')](function(_0x2adc7a){_0x39ff7d[_0x5924('0x4b')]({'channel':_0x2adc7a,'membername':_0x5117d0[_0x5924('0x36')],'interface':_[_0x5924('0x67')](_0x5117d0['interface'])?util[_0x5924('0xa5')](_0x5924('0xa6'),_0x5117d0[_0x5924('0x36')]):_0x5117d0[_0x5924('0x9b')],'type':_0x5924('0xff'),'enterAt':moment()[_0x5924('0xa5')](_0x5924('0xf5')),'data1':_0x937a99[_0x5924('0x5d')][_0x5924('0x3a')]||_0x5924('0x100'),'role':_0x5117d0[_0x5924('0x28')],'internal':_0x5117d0[_0x5924('0x62')]});});return db[_0x5924('0xf3')][_0x5924('0x88')](_0x39ff7d,{'individualHooks':!![]});})[_0x5924('0x19')](function(){return _0x5117d0[_0x5924('0x5c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x937a99['body'][_0x5924('0x3a')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x5924('0xa5')](_0x5924('0xf5'))});})['then'](respondWithResult(_0x45b0ff,null))[_0x5924('0x5b')](handleError(_0x45b0ff,null));};exports['unpause']=function(_0x1949cc,_0x30973d){if(_0x1949cc[_0x5924('0x5d')]['channel']&&!utils[_0x5924('0x9c')](_0x1949cc['body']['channel'])){throw new APIBadRequestError(util['format'](_0x5924('0x101'),_0x1949cc['body'][_0x5924('0x97')]));}return db[_0x5924('0x37')][_0x5924('0x5a')]({'where':{'id':_0x1949cc[_0x5924('0x58')]['id']},'attributes':['id',_0x5924('0x36'),_0x5924('0x28'),_0x5924('0x62'),_0x5924('0x9b'),_0x5924('0x98'),'voicePause',_0x5924('0x102'),_0x5924('0x103'),'faxPause',_0x5924('0x104'),_0x5924('0x105'),_0x5924('0x106'),_0x5924('0x107'),_0x5924('0x108')]})[_0x5924('0x19')](function(_0x412fa2){if(!_0x412fa2){throw new APINotFoundError(util[_0x5924('0xa5')](_0x5924('0xc0'),_0x1949cc[_0x5924('0x58')]['id']));}return _0x412fa2[_0x5924('0x109')](_0x1949cc[_0x5924('0x5d')]['channel']);})[_0x5924('0x19')](respondWithResult(_0x30973d,null))[_0x5924('0x5b')](APIHandleError(_0x30973d));};exports['getTeams']=function(_0x563471,_0x5c1326){var _0x36826d={};var _0x14e052={};var _0x1947dd;var _0x31894e;return db['User']['findOne']({'where':{'id':_0x563471[_0x5924('0x58')]['id']}})[_0x5924('0x19')](handleEntityNotFound(_0x5c1326,null))['then'](function(_0x54d095){if(_0x54d095){_0x1947dd=_0x54d095;_0x14e052[_0x5924('0xcd')]=_[_0x5924('0xc9')](db[_0x5924('0x10a')]['rawAttributes']);_0x14e052[_0x5924('0x44')]=_[_0x5924('0xc9')](_0x563471['query']);_0x14e052['filters']=_[_0x5924('0xcc')](_0x14e052['model'],_0x14e052[_0x5924('0x44')]);_0x36826d[_0x5924('0x4a')]=_[_0x5924('0xcc')](_0x14e052[_0x5924('0xcd')],qs[_0x5924('0xce')](_0x563471[_0x5924('0x44')]['fields']));_0x36826d[_0x5924('0x4a')]=_0x36826d[_0x5924('0x4a')][_0x5924('0x4f')]?_0x36826d['attributes']:_0x14e052[_0x5924('0xcd')];_0x36826d[_0x5924('0xcf')]=qs[_0x5924('0xd0')](_0x563471['query'][_0x5924('0xd0')]);_0x36826d[_0x5924('0x43')]=qs[_0x5924('0xcb')](_['pick'](_0x563471[_0x5924('0x44')],_0x14e052['filters']));if(_0x563471[_0x5924('0x44')][_0x5924('0x2e')]){_0x36826d[_0x5924('0x43')]=_[_0x5924('0xd2')](_0x36826d[_0x5924('0x43')],{'$or':_[_0x5924('0x30')](_0x36826d[_0x5924('0x4a')],function(_0x1b22e8){var _0x39445e={};_0x39445e[_0x1b22e8]={'$like':'%'+_0x563471[_0x5924('0x44')][_0x5924('0x2e')]+'%'};return _0x39445e;})});}_0x36826d=_[_0x5924('0xd2')]({},_0x36826d,_0x563471[_0x5924('0x59')]);return _0x1947dd[_0x5924('0x10b')](_0x36826d);}})[_0x5924('0x19')](function(_0x3c7be7){if(_0x3c7be7){_0x31894e=_0x3c7be7[_0x5924('0x4f')];if(!_0x563471['query'][_0x5924('0xc1')](_0x5924('0xd5'))){_0x36826d[_0x5924('0x13')]=qs[_0x5924('0x13')](_0x563471[_0x5924('0x44')]['limit']);_0x36826d['offset']=qs[_0x5924('0x15')](_0x563471[_0x5924('0x44')]['offset']);}return _0x1947dd[_0x5924('0x10b')](_0x36826d);}})[_0x5924('0x19')](function(_0x3ceb0c){if(_0x3ceb0c){return _0x3ceb0c?{'count':_0x31894e,'rows':_0x3ceb0c}:null;}})[_0x5924('0x19')](respondWithResult(_0x5c1326,null))[_0x5924('0x5b')](handleError(_0x5c1326,null));};exports[_0x5924('0x10c')]=function(_0x5add4e,_0x7f135b){var _0x12d15a=_0x5add4e[_0x5924('0x58')]['id'];var _0x3dd060=_0x5add4e['body']?_0x5add4e[_0x5924('0x5d')][_0x5924('0x60')]:null;var _0x7e801e=[];return Promise['resolve']()[_0x5924('0x19')](function(){if(!_0x3dd060)throw new APIBadRequestError(_0x5924('0x10d'));})[_0x5924('0x19')](function(){return db[_0x5924('0x37')][_0x5924('0x93')]({'where':{'id':_0x12d15a}});})['then'](function(_0x267c39){if(!_0x267c39)throw new APINotFoundError(util[_0x5924('0xa5')](_0x5924('0xc0'),_0x5add4e[_0x5924('0x58')]['id']));return db['sequelize'][_0x5924('0x10e')](function(_0xee5dcf){return _0x267c39[_0x5924('0x10c')](_0x3dd060,{'transaction':_0xee5dcf})[_0x5924('0x19')](function(){return db[_0x5924('0x10a')][_0x5924('0x4c')]({'where':{'id':{'$in':_0x3dd060}}});})['then'](function(_0xd24861){var _0x1626cd=_[_0x5924('0x30')](_0xd24861,function(_0x4e9656){return _0x4e9656['getAssociatedQueues']();});return Promise[_0x5924('0x56')](_0x1626cd);})[_0x5924('0x19')](function(_0x4f9d9f){_0x7e801e=_['flattenDeep'](_0x4f9d9f);var _0x3d271c=_[_0x5924('0x30')](_0x7e801e,function(_0x588f52){return _0x588f52['addAgent'](_0x267c39['id'],{'transaction':_0xee5dcf});});return Promise[_0x5924('0x56')](_0x3d271c);})[_0x5924('0x19')](function(){if(!_0x267c39['online'])return;var _0x142c07=_['filter'](_0x7e801e,function(_0x1fe8e7){return _0x1fe8e7[_0x5924('0x10f')](_0x5924('0x97'))===_0x5924('0x110');});var _0x40faf8=_['map'](_0x142c07,function(_0x4da533){return db[_0x5924('0xa7')][_0x5924('0x111')]({'membername':_0x267c39[_0x5924('0x36')],'UserId':_0x267c39['id'],'queue_name':_0x4da533['name'],'VoiceQueueId':_0x4da533['id'],'interface':_['isNil'](_0x267c39[_0x5924('0x9b')])?util[_0x5924('0xa5')]('SIP/%s',_0x267c39[_0x5924('0x36')]):_0x267c39['interface'],'paused':_0x267c39[_0x5924('0x9a')]||![],'penalty':_0x267c39[_0x5924('0xa0')]},{'transaction':_0xee5dcf});});return Promise['all'](_0x40faf8);})[_0x5924('0x19')](function(){return db[_0x5924('0x112')]['findAll']({'where':{'teamId':{'$in':_0x3dd060}}});})[_0x5924('0x19')](function(_0x2d97a4){var _0x19d2e8=_[_0x5924('0x30')](_0x2d97a4,function(_0x6966cb){return db[_0x5924('0x113')]['create']({'UserId':_0x267c39['id'],'VoicePrefixId':_0x6966cb[_0x5924('0x114')]},{'transaction':_0xee5dcf});});return Promise[_0x5924('0x56')](_0x19d2e8);});});})[_0x5924('0x19')](function(){for(var _0x8df16c=0x0;_0x8df16c<_0x7e801e['length'];_0x8df16c++){var _0x3b5f62=_0x7e801e[_0x8df16c][_0x5924('0x10f')](_0x5924('0x97'));var _0x161916=_0x3b5f62+_0x5924('0x115');socket[_0x5924('0x24')](_0x5924('0x7d')+_0x3b5f62+_0x5924('0xa3'),{'UserId':_0x12d15a,['queueField']:_0x7e801e[_0x8df16c]['id']});}})['then'](respondWithStatusCode(_0x7f135b,null))['catch'](APIHandleError(_0x7f135b));};exports['removeTeams']=function(_0x276e54,_0x17df18){var _0x412080=_0x276e54[_0x5924('0x58')]['id'];var _0x11f24b=null;if(_0x276e54[_0x5924('0x44')][_0x5924('0x60')]){_0x11f24b=_['isArray'](_0x276e54[_0x5924('0x44')]['ids'])?_0x276e54[_0x5924('0x44')][_0x5924('0x60')]:[_0x276e54[_0x5924('0x44')][_0x5924('0x60')]];}var _0x255785=[];return Promise['resolve']()[_0x5924('0x19')](function(){if(!_0x11f24b)throw new APIBadRequestError(_0x5924('0x116'));})[_0x5924('0x19')](function(){return db[_0x5924('0x37')]['findOne']({'where':{'id':_0x412080}});})['then'](function(_0x3ecd38){if(!_0x3ecd38)throw new APINotFoundError(util[_0x5924('0xa5')](_0x5924('0xc0'),_0x276e54['params']['id']));return db[_0x5924('0x69')][_0x5924('0x10e')](function(_0x465a5b){return _0x3ecd38['removeTeams'](_0x11f24b,{'transaction':_0x465a5b})[_0x5924('0x19')](function(){return db[_0x5924('0x10a')][_0x5924('0x4c')]({'where':{'id':{'$in':_0x11f24b}}});})['then'](function(_0x43162b){var _0x386ba0=_[_0x5924('0x30')](_0x43162b,function(_0x5fcf63){return _0x5fcf63[_0x5924('0x117')]();});return Promise[_0x5924('0x56')](_0x386ba0);})[_0x5924('0x19')](function(_0x3ba63d){_0x255785=_[_0x5924('0x118')](_0x3ba63d);var _0x54f2a2=_[_0x5924('0x30')](_0x255785,function(_0x5e8643){return _0x5e8643[_0x5924('0x119')](_0x3ecd38['id'],{'transaction':_0x465a5b});});return Promise['all'](_0x54f2a2);})[_0x5924('0x19')](function(){if(!_0x3ecd38[_0x5924('0x98')])return;var _0x3b875f=_['filter'](_0x255785,function(_0x20fec8){return _0x20fec8[_0x5924('0x10f')](_0x5924('0x97'))===_0x5924('0x110');});var _0x3cdee9=_[_0x5924('0x30')](_0x3b875f,function(_0x5e44a7){return db['UserVoiceQueueRt'][_0x5924('0x26')]({'where':{'VoiceQueueId':_0x5e44a7['id'],'UserId':_0x3ecd38['id']},'transaction':_0x465a5b});});return Promise[_0x5924('0x56')](_0x3cdee9);})[_0x5924('0x19')](function(){return db[_0x5924('0x112')][_0x5924('0x4c')]({'where':{'teamId':{'$in':_0x11f24b}}});})[_0x5924('0x19')](function(_0x5a743e){var _0x5a6bed=_[_0x5924('0x30')](_0x5a743e,function(_0xf493df){return db[_0x5924('0x113')][_0x5924('0x26')]({'where':{'UserId':_0x3ecd38['id'],'VoicePrefixId':_0xf493df[_0x5924('0x114')]}},{'transaction':_0x465a5b});});return Promise['all'](_0x5a6bed);});});})['then'](function(){for(var _0x147ca4=0x0;_0x147ca4<_0x255785[_0x5924('0x4f')];_0x147ca4++){var _0x55de35=_0x255785[_0x147ca4][_0x5924('0x10f')](_0x5924('0x97'));var _0x100023=_0x55de35+_0x5924('0x115');socket[_0x5924('0x24')](_0x5924('0x7d')+_0x55de35+'Queue:remove',{'UserId':_0x412080,['queueField']:_0x255785[_0x147ca4]['id']});}})[_0x5924('0x19')](respondWithStatusCode(_0x17df18,null))[_0x5924('0x5b')](APIHandleError(_0x17df18));};exports[_0x5924('0x11a')]=function(_0x3b9d2a,_0x438dc2){var _0x303544={};var _0x742f88={};var _0x1013b5;var _0x10f6b8;return db[_0x5924('0x37')][_0x5924('0x93')]({'where':{'id':_0x3b9d2a[_0x5924('0x58')]['id']}})[_0x5924('0x19')](handleEntityNotFound(_0x438dc2,null))[_0x5924('0x19')](function(_0x59f3ea){if(_0x59f3ea){_0x1013b5=_0x59f3ea;_0x742f88['model']=_['keys'](db[_0x5924('0xc2')][_0x5924('0x38')]);_0x742f88['query']=_[_0x5924('0xc9')](_0x3b9d2a[_0x5924('0x44')]);_0x742f88[_0x5924('0xcb')]=_[_0x5924('0xcc')](_0x742f88[_0x5924('0xcd')],_0x742f88[_0x5924('0x44')]);_0x303544[_0x5924('0x4a')]=_[_0x5924('0xcc')](_0x742f88[_0x5924('0xcd')],qs[_0x5924('0xce')](_0x3b9d2a[_0x5924('0x44')][_0x5924('0xce')]));_0x303544[_0x5924('0x4a')]=_0x303544[_0x5924('0x4a')]['length']?_0x303544[_0x5924('0x4a')]:_0x742f88[_0x5924('0xcd')];_0x303544[_0x5924('0xcf')]=qs[_0x5924('0xd0')](_0x3b9d2a[_0x5924('0x44')]['sort']);_0x303544[_0x5924('0x43')]=qs[_0x5924('0xcb')](_['pick'](_0x3b9d2a[_0x5924('0x44')],_0x742f88[_0x5924('0xcb')]));if(_0x3b9d2a[_0x5924('0x44')][_0x5924('0x2e')]){_0x303544[_0x5924('0x43')]=_[_0x5924('0xd2')](_0x303544[_0x5924('0x43')],{'$or':_[_0x5924('0x30')](_0x303544[_0x5924('0x4a')],function(_0x30f908){var _0x4a352a={};_0x4a352a[_0x30f908]={'$like':'%'+_0x3b9d2a[_0x5924('0x44')][_0x5924('0x2e')]+'%'};return _0x4a352a;})});}_0x303544=_['merge']({},_0x303544,_0x3b9d2a[_0x5924('0x59')]);return _0x1013b5[_0x5924('0x11a')](_0x303544);}})[_0x5924('0x19')](function(_0x51637b){if(_0x51637b){_0x10f6b8=_0x51637b[_0x5924('0x4f')];if(!_0x3b9d2a[_0x5924('0x44')][_0x5924('0xc1')]('nolimit')){_0x303544['limit']=qs[_0x5924('0x13')](_0x3b9d2a[_0x5924('0x44')][_0x5924('0x13')]);_0x303544['offset']=qs['offset'](_0x3b9d2a['query'][_0x5924('0x15')]);}return _0x1013b5[_0x5924('0x11a')](_0x303544);}})[_0x5924('0x19')](function(_0x5690d1){if(_0x5690d1){return _0x5690d1?{'count':_0x10f6b8,'rows':_0x5690d1}:null;}})['then'](respondWithResult(_0x438dc2,null))[_0x5924('0x5b')](handleError(_0x438dc2,null));};exports['getAgents']=function(_0x1598ef,_0x4af6cc){var _0x199ef8={};var _0x18ccf0={};var _0x1aa247;return db[_0x5924('0x37')][_0x5924('0x93')]({'where':{'id':_0x1598ef[_0x5924('0x58')]['id']}})[_0x5924('0x19')](handleEntityNotFound(_0x4af6cc,null))['then'](function(_0x246ed0){if(_0x246ed0){_0x1aa247=_0x246ed0;_0x18ccf0['model']=_[_0x5924('0xc9')](db[_0x5924('0x37')][_0x5924('0x38')]);_0x18ccf0['query']=_[_0x5924('0xc9')](_0x1598ef[_0x5924('0x44')]);_0x18ccf0[_0x5924('0xcb')]=_[_0x5924('0xcc')](_0x18ccf0[_0x5924('0xcd')],_0x18ccf0[_0x5924('0x44')]);_0x199ef8[_0x5924('0x4a')]=_[_0x5924('0xcc')](_0x18ccf0['model'],qs[_0x5924('0xce')](_0x1598ef[_0x5924('0x44')]['fields']));_0x199ef8[_0x5924('0x4a')]=_0x199ef8[_0x5924('0x4a')][_0x5924('0x4f')]?_0x199ef8[_0x5924('0x4a')]:_0x18ccf0[_0x5924('0xcd')];_0x199ef8[_0x5924('0xcf')]=qs[_0x5924('0xd0')](_0x1598ef['query'][_0x5924('0xd0')]);_0x199ef8[_0x5924('0x43')]=qs['filters'](_['pick'](_0x1598ef['query'],_0x18ccf0[_0x5924('0xcb')]));if(_0x1598ef['query'][_0x5924('0x2e')]){_0x199ef8[_0x5924('0x43')]=_['merge'](_0x199ef8[_0x5924('0x43')],{'$or':_[_0x5924('0x30')](_0x199ef8[_0x5924('0x4a')],function(_0x471e0d){var _0x80291={};_0x80291[_0x471e0d]={'$like':'%'+_0x1598ef[_0x5924('0x44')]['filter']+'%'};return _0x80291;})});}_0x199ef8[_0x5924('0xcd')]=db[_0x5924('0x37')];_0x199ef8['as']=_0x5924('0x2b');_0x199ef8=_[_0x5924('0xd2')]({},_0x199ef8,_0x1598ef['options']);return _0x1aa247[_0x5924('0x11b')]({'include':[_0x199ef8]});}})[_0x5924('0x19')](function(_0x44e8c4){if(_0x44e8c4){var _0x2ac47c={},_0x517943=[];for(var _0x2bcffc=0x0;_0x2bcffc<_0x44e8c4[_0x5924('0x4f')];_0x2bcffc+=0x1){for(var _0xbb440=0x0,_0x12ed75;_0xbb440<_0x44e8c4[_0x2bcffc]['Agents'][_0x5924('0x4f')];_0xbb440+=0x1){_0x12ed75=_0x44e8c4[_0x2bcffc][_0x5924('0x2b')][_0xbb440][_0x5924('0x27')]({'plain':!![]});_0x2ac47c[_0x12ed75['id']]=_0x12ed75;}}_0x2ac47c=_[_0x5924('0x11c')](_0x2ac47c);for(var _0x201edb=qs['offset'](_0x1598ef['query'][_0x5924('0x15')]);_0x201edb<_0x2ac47c[_0x5924('0x4f')]&&_0x517943['length']=_0x31d17e[_0xfc1a('0x51')]){throw new Error(_0xfc1a('0x52'));}})[_0xfc1a('0x1a')](function(){if(_0x4818a2){return db['UserVoiceQueueRt'][_0xfc1a('0x48')]({'where':{'membername':_0x4818a2[_0xfc1a('0x23')]},'individualHooks':!![]});}})['then'](function(){if(_0x4818a2){return _0x4818a2[_0xfc1a('0x53')]({'raw':!![]});}})[_0xfc1a('0x1a')](function(_0x1de9f4){if(_0x4818a2){if(_0x1de9f4){var _0x5c9256=[];_0x3406c0=_0x1de9f4;if(_0x3406c0[_0xfc1a('0x2d')]){for(var _0x1c7f1f=0x0;_0x1c7f1f<_0x3406c0[_0xfc1a('0x2d')];_0x1c7f1f++){_0x5c9256[_0xfc1a('0x49')](db['UserVoiceQueueRt'][_0xfc1a('0x54')]({'membername':_0x4818a2['name'],'UserId':_0x4818a2['id'],'queue_name':_0x3406c0[_0x1c7f1f][_0xfc1a('0x23')],'VoiceQueueId':_0x3406c0[_0x1c7f1f]['id'],'interface':_0x33a8bc,'paused':_0x4818a2[_0xfc1a('0x4d')]||![],'penalty':_0x3406c0[_0x1c7f1f][_0xfc1a('0x55')]||0x0}));}return BPromise[_0xfc1a('0x56')](_0x5c9256);}}}})['then'](function(){if(_0x4818a2){return db['MemberReport'][_0xfc1a('0x11')]({'where':{'membername':_0x4818a2['name'],'exitAt':null}});}})[_0xfc1a('0x1a')](function(_0x3632b2){if(_0x4818a2){if(_0x3632b2&&_0x3632b2[_0xfc1a('0x2d')]){var _0x34c49e=[];_0x3632b2[_0xfc1a('0x2f')](function(_0x8f27ac){_0x34c49e[_0xfc1a('0x49')](_0x8f27ac[_0xfc1a('0x4a')]({'exitAt':moment()[_0xfc1a('0x27')](_0xfc1a('0x2c'))}));});return BPromise['all'](_0x34c49e);}}})['then'](function(){if(_0x4818a2){var _0x35eb3d=[];var _0x4a61c7=[];var _0x2b37c3=utils[_0xfc1a('0x2e')]();var _0x250fea={'membername':_0x4818a2[_0xfc1a('0x23')],'interface':_0x33a8bc,'enterAt':moment()[_0xfc1a('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x4818a2[_0xfc1a('0x24')],'internal':_0x4818a2[_0xfc1a('0x25')]};_0x2b37c3[_0xfc1a('0x2f')](function(_0x1992f9){_0x35eb3d[_0xfc1a('0x49')](_[_0xfc1a('0x57')]({'channel':_0x1992f9,'type':_0xfc1a('0x58'),'data1':_0xfc1a('0x59'),'data2':_0x33a8bc},_0x250fea));if(_0x4818a2[_0xfc1a('0x4d')]){_0x4a61c7[_0xfc1a('0x49')](_[_0xfc1a('0x57')]({'channel':_0x1992f9,'type':_0xfc1a('0x2b'),'data1':_0xfc1a('0x5a')},_0x250fea));}});return db[_0xfc1a('0x2a')][_0xfc1a('0x5b')](_0x35eb3d['concat'](_0x4a61c7),{'individualHooks':!![]});}})[_0xfc1a('0x1a')](function(){if(_0x4818a2){return _0x4818a2[_0xfc1a('0x4a')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x4818a2[_0xfc1a('0x4d')]||![],'mailPause':_0x4818a2[_0xfc1a('0x4d')]||![],'chatPause':_0x4818a2[_0xfc1a('0x4d')]||![],'faxPause':_0x4818a2[_0xfc1a('0x4d')]||![],'smsPause':_0x4818a2[_0xfc1a('0x4d')]||![],'openchannelPause':_0x4818a2[_0xfc1a('0x4d')]||![],'pauseType':_0x4818a2[_0xfc1a('0x4d')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0xfc1a('0x2c')),'interface':_0x33a8bc});}})[_0xfc1a('0x1a')](function(_0x448a6e){_0x4075dd(_0x448a6e);})['catch'](function(_0x4e47ee){_0x1d3148(_0x48efaf[_0xfc1a('0x1d')](0x1f4,_0x4e47ee['message']));});});}; \ No newline at end of file +var _0x7151=['name','internal','interface','User\x20with\x20id\x20%s\x20not\x20found','params','update','MemberReport','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','body','type','role','uniqueid','DEFAULT\x20PAUSE','UnpauseUser','resolve','isValidChannel','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','chatPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','unpause','system','UserVoiceQueueRt','all','LoginUser','mobile','phone','loginInPause','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','merge','LOGIN','callysquare','LOGININPAUSE','bulkCreate','lodash','moment','bluebird','../../mysqldb','rpc','../../config/environment','redis','localhost','socket.io-emitter','./user.socket','register','GetUser','findAll','options','raw','where','attributes','include','map','model','then','info','catch','error','message','User','ShowUser','stringify','PauseUser'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x7151,0x13b));var _0x1715=function(_0x15af6c,_0x47fe2d){_0x15af6c=_0x15af6c-0x0;var _0x13c017=_0x7151[_0x15af6c];return _0x13c017;};'use strict';var _=require(_0x1715('0x0'));var util=require('util');var moment=require(_0x1715('0x1'));var BPromise=require(_0x1715('0x2'));var Redis=require('ioredis');var db=require(_0x1715('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1715('0x4'));var config=require(_0x1715('0x5'));config[_0x1715('0x6')]=_['defaults'](config[_0x1715('0x6')],{'host':_0x1715('0x7'),'port':0x18eb});var socket=require(_0x1715('0x8'))(new Redis(config['redis']));require(_0x1715('0x9'))[_0x1715('0xa')](socket);exports[_0x1715('0xb')]=function(_0x199211){var _0xcc3b18=this;return new Promise(function(_0x1f8876,_0x2a9844){return db['User'][_0x1715('0xc')]({'raw':_0x199211[_0x1715('0xd')]?_0x199211[_0x1715('0xd')][_0x1715('0xe')]===undefined?!![]:![]:!![],'where':_0x199211['options']?_0x199211[_0x1715('0xd')][_0x1715('0xf')]||null:null,'attributes':_0x199211[_0x1715('0xd')]?_0x199211['options'][_0x1715('0x10')]||null:null,'limit':_0x199211[_0x1715('0xd')]?_0x199211[_0x1715('0xd')]['limit']||null:null,'include':_0x199211[_0x1715('0xd')]?_0x199211[_0x1715('0xd')][_0x1715('0x11')]?_[_0x1715('0x12')](_0x199211[_0x1715('0xd')][_0x1715('0x11')],function(_0x24cec9){return{'model':db[_0x24cec9[_0x1715('0x13')]],'as':_0x24cec9['as'],'attributes':_0x24cec9['attributes'],'include':_0x24cec9[_0x1715('0x11')]?_[_0x1715('0x12')](_0x24cec9['include'],function(_0x462112){return{'model':db[_0x462112['model']],'as':_0x462112['as'],'attributes':_0x462112[_0x1715('0x10')],'include':_0x462112['include']?_[_0x1715('0x12')](_0x462112['include'],function(_0x4d22b5){return{'model':db[_0x4d22b5[_0x1715('0x13')]],'as':_0x4d22b5['as'],'attributes':_0x4d22b5[_0x1715('0x10')]};}):[]};}):[]};}):[]:[]})[_0x1715('0x14')](function(_0x29e4a9){logger[_0x1715('0x15')](_0x1715('0xb'),_0x199211);logger['debug']('GetUser',_0x199211,JSON['stringify'](_0x29e4a9));_0x1f8876(_0x29e4a9);})[_0x1715('0x16')](function(_0x4b9269){logger[_0x1715('0x17')](_0x1715('0xb'),_0x4b9269[_0x1715('0x18')],_0x199211);_0x2a9844(_0xcc3b18['error'](0x1f4,_0x4b9269[_0x1715('0x18')]));});});};exports['ShowUser']=function(_0x323733){var _0x20170f=this;return new Promise(function(_0x22607f,_0x1c7c86){return db[_0x1715('0x19')]['find']({'raw':_0x323733[_0x1715('0xd')]?_0x323733[_0x1715('0xd')][_0x1715('0xe')]===undefined?!![]:![]:!![],'where':_0x323733[_0x1715('0xd')]?_0x323733[_0x1715('0xd')][_0x1715('0xf')]||null:null,'attributes':_0x323733[_0x1715('0xd')]?_0x323733['options'][_0x1715('0x10')]||null:null,'include':_0x323733[_0x1715('0xd')]?_0x323733['options'][_0x1715('0x11')]?_['map'](_0x323733['options'][_0x1715('0x11')],function(_0x3b7518){return{'model':db[_0x3b7518[_0x1715('0x13')]],'as':_0x3b7518['as'],'attributes':_0x3b7518[_0x1715('0x10')],'include':_0x3b7518['include']?_[_0x1715('0x12')](_0x3b7518[_0x1715('0x11')],function(_0xe711db){return{'model':db[_0xe711db[_0x1715('0x13')]],'as':_0xe711db['as'],'attributes':_0xe711db[_0x1715('0x10')],'include':_0xe711db[_0x1715('0x11')]?_[_0x1715('0x12')](_0xe711db[_0x1715('0x11')],function(_0x42aaf9){return{'model':db[_0x42aaf9[_0x1715('0x13')]],'as':_0x42aaf9['as'],'attributes':_0x42aaf9[_0x1715('0x10')]};}):[]};}):[]};}):[]:[]})[_0x1715('0x14')](function(_0x347c4f){logger[_0x1715('0x15')](_0x1715('0x1a'),_0x323733);logger['debug']('ShowUser',_0x323733,JSON[_0x1715('0x1b')](_0x347c4f));_0x22607f(_0x347c4f);})[_0x1715('0x16')](function(_0x52c3a4){logger[_0x1715('0x17')](_0x1715('0x1a'),_0x52c3a4[_0x1715('0x18')],_0x323733);_0x1c7c86(_0x20170f[_0x1715('0x17')](0x1f4,_0x52c3a4['message']));});});};exports[_0x1715('0x1c')]=function(_0x49dcd3){var _0x279ec3;return db[_0x1715('0x19')]['find']({'where':_0x49dcd3[_0x1715('0xd')]['where']||{},'attributes':['id',_0x1715('0x1d'),'role',_0x1715('0x1e'),_0x1715('0x1f')]})[_0x1715('0x14')](function(_0x1cdd23){if(!_0x1cdd23){throw new Error(util['format'](_0x1715('0x20'),_0x49dcd3[_0x1715('0x21')]['id']));}_0x279ec3=_0x1cdd23;return db['UserVoiceQueueRt'][_0x1715('0x22')]({'paused':0x1},{'where':{'UserId':_0x279ec3['id']},'individualHooks':!![]});})[_0x1715('0x14')](function(){return db[_0x1715('0x23')][_0x1715('0xc')]({'where':{'membername':_0x279ec3[_0x1715('0x1d')],'type':_0x1715('0x24'),'exitAt':null}});})['then'](function(_0x37e389){if(_0x37e389&&_0x37e389['length']){var _0x3f7c3a=moment()[_0x1715('0x25')](_0x1715('0x26'));for(var _0x4f54eb=0x0,_0x54178c=_0x37e389[_0x1715('0x27')];_0x4f54eb<_0x54178c;_0x4f54eb++){_0x37e389[_0x4f54eb][_0x1715('0x28')]({'exitAt':_0x3f7c3a});}}})[_0x1715('0x14')](function(){var _0x41231c=[];var _0x2aafb6=utils[_0x1715('0x29')]();_0x2aafb6[_0x1715('0x2a')](function(_0x29eaa2){_0x41231c[_0x1715('0x2b')]({'channel':_0x29eaa2,'membername':_0x279ec3['name'],'interface':_[_0x1715('0x2c')](_0x279ec3[_0x1715('0x1f')])?util[_0x1715('0x25')](_0x1715('0x2d'),_0x279ec3[_0x1715('0x1d')]):_0x279ec3[_0x1715('0x1f')],'type':_0x1715('0x24'),'enterAt':moment()['format'](_0x1715('0x26')),'data1':_0x49dcd3[_0x1715('0x2e')][_0x1715('0x2f')]||'DEFAULT\x20PAUSE','role':_0x279ec3[_0x1715('0x30')],'internal':_0x279ec3['internal'],'uniqueid':_0x49dcd3['body'][_0x1715('0x31')]||null});});return db[_0x1715('0x23')]['bulkCreate'](_0x41231c,{'individualHooks':!![]});})['then'](function(){return _0x279ec3[_0x1715('0x22')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x49dcd3['body'][_0x1715('0x2f')]||_0x1715('0x32'),'lastPauseAt':moment()[_0x1715('0x25')](_0x1715('0x26'))});})[_0x1715('0x16')](function(_0x1b931c){throw _0x1b931c;});};exports[_0x1715('0x33')]=function(_0x2d8870){return Promise[_0x1715('0x34')]()[_0x1715('0x14')](function(){if(_0x2d8870['body']['channel']&&!utils[_0x1715('0x35')](_0x2d8870[_0x1715('0x2e')][_0x1715('0x36')])){throw new Error(util[_0x1715('0x25')](_0x1715('0x37'),_0x2d8870[_0x1715('0x2e')][_0x1715('0x36')]));}return db['User'][_0x1715('0x38')]({'where':_0x2d8870[_0x1715('0xd')][_0x1715('0xf')]||{},'attributes':['id',_0x1715('0x1d'),_0x1715('0x30'),_0x1715('0x1e'),_0x1715('0x1f'),_0x1715('0x39'),_0x1715('0x3a'),'mailPause',_0x1715('0x3b'),_0x1715('0x3c'),_0x1715('0x3d'),_0x1715('0x3e'),'whatsappPause',_0x1715('0x3f'),_0x1715('0x40')]});})[_0x1715('0x14')](function(_0x14b4a8){if(!_0x14b4a8){throw new Error(util[_0x1715('0x25')]('User\x20with\x20id\x20%s\x20not\x20found',_0x2d8870[_0x1715('0x21')]['id']));}return _0x14b4a8[_0x1715('0x41')](_0x2d8870[_0x1715('0x2e')][_0x1715('0x36')],_0x1715('0x42'));})[_0x1715('0x16')](function(_0x339555){throw _0x339555;});};exports['LogoutUser']=function(_0x5936fc){var _0x192868=this;return new Promise(function(_0x57b978,_0x1d2fc9){var _0x474a6f;return db[_0x1715('0x19')][_0x1715('0x38')]({'where':_0x5936fc['options'][_0x1715('0xf')]||{},'attributes':['id',_0x1715('0x1d')]})['then'](function(_0x512b33){if(_0x512b33){_0x474a6f=_0x512b33;return db[_0x1715('0x43')]['destroy']({'where':{'membername':_0x474a6f['name']},'individualHooks':!![]});}})[_0x1715('0x14')](function(){if(_0x474a6f){return db[_0x1715('0x23')][_0x1715('0xc')]({'where':{'membername':_0x474a6f['name'],'exitAt':null}});}})[_0x1715('0x14')](function(_0x2889f4){if(_0x474a6f){if(_0x2889f4&&_0x2889f4[_0x1715('0x27')]){var _0x3570de=[];_0x2889f4[_0x1715('0x2a')](function(_0x35295c){_0x3570de[_0x1715('0x2b')](_0x35295c[_0x1715('0x22')]({'exitAt':moment()[_0x1715('0x25')](_0x1715('0x26'))}));});return BPromise[_0x1715('0x44')](_0x3570de);}}})['then'](function(){if(_0x474a6f){return _0x474a6f['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x1715('0x14')](function(_0x49eff6){_0x57b978(_0x49eff6);})[_0x1715('0x16')](function(_0x1a6f58){_0x1d2fc9(_0x192868[_0x1715('0x17')](0x1f4,_0x1a6f58[_0x1715('0x18')]));});});};exports[_0x1715('0x45')]=function(_0x43a21a){var _0x5588b3=this;return new Promise(function(_0x120a58,_0x11bd21){var _0x150163;var _0xfbf75a;var _0x52a6e9;var _0x56e3ca;return db['User'][_0x1715('0x38')]({'where':_0x43a21a['options'][_0x1715('0xf')]||{},'attributes':['id',_0x1715('0x1d'),_0x1715('0x30'),_0x1715('0x46'),_0x1715('0x47'),_0x1715('0x1e'),_0x1715('0x48'),'interface']})[_0x1715('0x14')](function(_0x24c7ea){if(_0x24c7ea){_0x150163=_0x24c7ea;_0x56e3ca=_0x43a21a['body'][_0x1715('0x1f')]?_0x43a21a[_0x1715('0x2e')][_0x1715('0x1f')]:util[_0x1715('0x25')](_0x1715('0x2d'),_0x150163[_0x1715('0x1d')]);return db[_0x1715('0x19')][_0x1715('0x49')]({'where':{'role':_0x1715('0x4a'),'online':!![],'id':{'$ne':_0x150163['id']}}});}})[_0x1715('0x14')](function(_0x1bf982){if(_0x1bf982){_0x52a6e9=_0x1bf982;return require('../../config/license/util')[_0x1715('0x4b')]();}})[_0x1715('0x14')](function(_0x26c522){if(_0x26c522&&_0x26c522[_0x1715('0x4c')]&&_0x52a6e9>=_0x26c522[_0x1715('0x4c')]){throw new Error(_0x1715('0x4d'));}})[_0x1715('0x14')](function(){if(_0x150163){return db[_0x1715('0x43')][_0x1715('0x4e')]({'where':{'membername':_0x150163[_0x1715('0x1d')]},'individualHooks':!![]});}})[_0x1715('0x14')](function(){if(_0x150163){return _0x150163[_0x1715('0x4f')]({'raw':!![]});}})[_0x1715('0x14')](function(_0x43c91e){if(_0x150163){if(_0x43c91e){var _0x1148c3=[];_0xfbf75a=_0x43c91e;if(_0xfbf75a['length']){for(var _0x547712=0x0;_0x547712<_0xfbf75a['length'];_0x547712++){_0x1148c3[_0x1715('0x2b')](db[_0x1715('0x43')][_0x1715('0x50')]({'membername':_0x150163[_0x1715('0x1d')],'UserId':_0x150163['id'],'queue_name':_0xfbf75a[_0x547712][_0x1715('0x1d')],'VoiceQueueId':_0xfbf75a[_0x547712]['id'],'interface':_0x56e3ca,'paused':_0x150163[_0x1715('0x48')]||![],'penalty':_0xfbf75a[_0x547712]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x1715('0x44')](_0x1148c3);}}}})['then'](function(){if(_0x150163){return db[_0x1715('0x23')][_0x1715('0xc')]({'where':{'membername':_0x150163[_0x1715('0x1d')],'exitAt':null}});}})[_0x1715('0x14')](function(_0x5e519b){if(_0x150163){if(_0x5e519b&&_0x5e519b[_0x1715('0x27')]){var _0x1fe934=[];_0x5e519b[_0x1715('0x2a')](function(_0x935963){_0x1fe934[_0x1715('0x2b')](_0x935963[_0x1715('0x22')]({'exitAt':moment()[_0x1715('0x25')](_0x1715('0x26'))}));});return BPromise[_0x1715('0x44')](_0x1fe934);}}})['then'](function(){if(_0x150163){var _0x524421=[];var _0x365c5d=[];var _0x1b7000=utils[_0x1715('0x29')]();var _0x560e4b={'membername':_0x150163[_0x1715('0x1d')],'interface':_0x56e3ca,'enterAt':moment()[_0x1715('0x25')](_0x1715('0x26')),'role':_0x150163[_0x1715('0x30')],'internal':_0x150163['internal']};_0x1b7000['forEach'](function(_0x4d3c73){_0x524421['push'](_[_0x1715('0x51')]({'channel':_0x4d3c73,'type':_0x1715('0x52'),'data1':_0x1715('0x53'),'data2':_0x56e3ca},_0x560e4b));if(_0x150163[_0x1715('0x48')]){_0x365c5d[_0x1715('0x2b')](_[_0x1715('0x51')]({'channel':_0x4d3c73,'type':_0x1715('0x24'),'data1':_0x1715('0x54')},_0x560e4b));}});return db[_0x1715('0x23')][_0x1715('0x55')](_0x524421['concat'](_0x365c5d),{'individualHooks':!![]});}})['then'](function(){if(_0x150163){return _0x150163[_0x1715('0x22')]({'online':!![],'lastLoginAt':moment()[_0x1715('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x150163[_0x1715('0x48')]||![],'mailPause':_0x150163[_0x1715('0x48')]||![],'chatPause':_0x150163[_0x1715('0x48')]||![],'faxPause':_0x150163['loginInPause']||![],'smsPause':_0x150163['loginInPause']||![],'openchannelPause':_0x150163[_0x1715('0x48')]||![],'pauseType':_0x150163[_0x1715('0x48')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0x1715('0x26')),'interface':_0x56e3ca});}})[_0x1715('0x14')](function(_0x538077){_0x120a58(_0x538077);})[_0x1715('0x16')](function(_0x3082ca){_0x11bd21(_0x5588b3[_0x1715('0x17')](0x1f4,_0x3082ca[_0x1715('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index fdb5c5f..0bbdc50 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 _0x9bf0=['emit','removeListener','register','length','user:','./user.events','save','remove','update'];(function(_0x3aa86f,_0xcf5d72){var _0x51fc53=function(_0x13d836){while(--_0x13d836){_0x3aa86f['push'](_0x3aa86f['shift']());}};_0x51fc53(++_0xcf5d72);}(_0x9bf0,0xb0));var _0x09bf=function(_0x1d6a82,_0x37c315){_0x1d6a82=_0x1d6a82-0x0;var _0x5834ac=_0x9bf0[_0x1d6a82];return _0x5834ac;};'use strict';var UserEvents=require(_0x09bf('0x0'));var events=[_0x09bf('0x1'),_0x09bf('0x2'),_0x09bf('0x3')];function createListener(_0x2e31e7,_0x50b4ac){return function(_0x2ca52e){_0x50b4ac[_0x09bf('0x4')](_0x2e31e7,_0x2ca52e);};}function removeListener(_0x146fca,_0x9fe23){return function(){UserEvents[_0x09bf('0x5')](_0x146fca,_0x9fe23);};}exports[_0x09bf('0x6')]=function(_0x49d925){for(var _0x375cdb=0x0,_0xfa1570=events[_0x09bf('0x7')];_0x375cdb<_0xfa1570;_0x375cdb++){var _0x34ec1b=events[_0x375cdb];var _0x5d3e02=createListener(_0x09bf('0x8')+_0x34ec1b,_0x49d925);UserEvents['on'](_0x34ec1b,_0x5d3e02);}}; \ No newline at end of file +var _0x6ea8=['remove','removeListener','register','length','user:','save'];(function(_0x4507bf,_0x331806){var _0x31e578=function(_0x5315ff){while(--_0x5315ff){_0x4507bf['push'](_0x4507bf['shift']());}};_0x31e578(++_0x331806);}(_0x6ea8,0x17f));var _0x86ea=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0x6ea8[_0x100e36];return _0x1df0c9;};'use strict';var UserEvents=require('./user.events');var events=[_0x86ea('0x0'),_0x86ea('0x1'),'update'];function createListener(_0x30982f,_0x1f7a04){return function(_0x47d435){_0x1f7a04['emit'](_0x30982f,_0x47d435);};}function removeListener(_0x6093e9,_0x3d87f1){return function(){UserEvents[_0x86ea('0x2')](_0x6093e9,_0x3d87f1);};}exports[_0x86ea('0x3')]=function(_0x46e460){for(var _0xff0760=0x0,_0x1a74fb=events[_0x86ea('0x4')];_0xff0760<_0x1a74fb;_0xff0760++){var _0x24cf10=events[_0xff0760];var _0x4a045f=createListener(_0x86ea('0x5')+_0x24cf10,_0x46e460);UserEvents['on'](_0x24cf10,_0x4a045f);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index c71d1f2..de05f51 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xbe2a5b,_0x436d72){var _0x295730=function(_0xe2499b){while(--_0xe2499b){_0xbe2a5b['push'](_0xbe2a5b['shift']());}};_0x295730(++_0x436d72);}(_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(_0x5ba884,_0x351181){var _0x26789c=function(_0x229fae){while(--_0x229fae){_0x5ba884['push'](_0x5ba884['shift']());}};_0x26789c(++_0x351181);}(_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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 7b3b9dd..eef7d1c 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 _0xa67b=['sequelize','exports','INTEGER'];(function(_0x2300c7,_0x255f74){var _0x23f720=function(_0x3fea57){while(--_0x3fea57){_0x2300c7['push'](_0x2300c7['shift']());}};_0x23f720(++_0x255f74);}(_0xa67b,0x10e));var _0xba67=function(_0x2ba1a6,_0x59bec6){_0x2ba1a6=_0x2ba1a6-0x0;var _0x4d66df=_0xa67b[_0x2ba1a6];return _0x4d66df;};'use strict';var Sequelize=require(_0xba67('0x0'));module[_0xba67('0x1')]={'penalty':{'type':Sequelize[_0xba67('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa16e=['sequelize'];(function(_0x4e279f,_0x4151e9){var _0x564c3b=function(_0x16865b){while(--_0x16865b){_0x4e279f['push'](_0x4e279f['shift']());}};_0x564c3b(++_0x4151e9);}(_0xa16e,0x133));var _0xea16=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0xa16e[_0x7d62cb];return _0x3a6266;};'use strict';var Sequelize=require(_0xea16('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'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 7773c89..5c7ea77 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 _0x30d4=['./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x4fab0b,_0x2e4bca){var _0x6f8dad=function(_0xb6b142){while(--_0xb6b142){_0x4fab0b['push'](_0x4fab0b['shift']());}};_0x6f8dad(++_0x2e4bca);}(_0x30d4,0x1f1));var _0x430d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x30d4[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x430d('0x0'));var util=require('util');var logger=require(_0x430d('0x1'))(_0x430d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x430d('0x3'));var fs=require('fs');var path=require(_0x430d('0x4'));var rimraf=require(_0x430d('0x5'));var config=require(_0x430d('0x6'));var attributes=require(_0x430d('0x7'));module[_0x430d('0x8')]=function(_0x59540c,_0xdc0c6e){return _0x59540c[_0x430d('0x9')](_0x430d('0xa'),attributes,{'tableName':_0x430d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c00=['util','api','bluebird','request-promise','path','rimraf','./userChatQueue.attributes','exports','user_has_chat_queues'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x2c00,0x1e6));var _0x02c0=function(_0x870b62,_0x2143f9){_0x870b62=_0x870b62-0x0;var _0x2dcb39=_0x2c00[_0x870b62];return _0x2dcb39;};'use strict';var _=require('lodash');var util=require(_0x02c0('0x0'));var logger=require('../../config/logger')(_0x02c0('0x1'));var moment=require('moment');var BPromise=require(_0x02c0('0x2'));var rp=require(_0x02c0('0x3'));var fs=require('fs');var path=require(_0x02c0('0x4'));var rimraf=require(_0x02c0('0x5'));var config=require('../../config/environment');var attributes=require(_0x02c0('0x6'));module[_0x02c0('0x7')]=function(_0xed76c9,_0x3ac62a){return _0xed76c9['define']('UserChatQueue',attributes,{'tableName':_0x02c0('0x8'),'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 8624f5c..4cc6356 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 _0x2d29=['../../config/environment','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x4eae0e,_0x1890fd){var _0x5632e5=function(_0x50b0e5){while(--_0x50b0e5){_0x4eae0e['push'](_0x4eae0e['shift']());}};_0x5632e5(++_0x1890fd);}(_0x2d29,0xcb));var _0x92d2=function(_0x1cfcda,_0x437a10){_0x1cfcda=_0x1cfcda-0x0;var _0x507097=_0x2d29[_0x1cfcda];return _0x507097;};'use strict';var _=require('lodash');var util=require(_0x92d2('0x0'));var moment=require(_0x92d2('0x1'));var BPromise=require(_0x92d2('0x2'));var rs=require(_0x92d2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92d2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x92d2('0x5'))('rpc');var config=require(_0x92d2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x92d2('0x7')][_0x92d2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x114601,_0x19a2c1,_0x4e7d83){return new BPromise(function(_0x479c9e,_0x12d5f1){return client[_0x92d2('0x9')](_0x114601,_0x4e7d83)[_0x92d2('0xa')](function(_0x51f5b3){logger[_0x92d2('0xb')](_0x92d2('0xc'),_0x19a2c1,'request\x20sent');logger[_0x92d2('0xd')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x19a2c1,_0x92d2('0xe'),JSON[_0x92d2('0xf')](_0x51f5b3));if(_0x51f5b3[_0x92d2('0x10')]){if(_0x51f5b3[_0x92d2('0x10')][_0x92d2('0x11')]===0x1f4){logger[_0x92d2('0x10')](_0x92d2('0xc'),_0x19a2c1,_0x51f5b3[_0x92d2('0x10')][_0x92d2('0x12')]);return _0x12d5f1(_0x51f5b3[_0x92d2('0x10')][_0x92d2('0x12')]);}logger[_0x92d2('0x10')](_0x92d2('0xc'),_0x19a2c1,_0x51f5b3[_0x92d2('0x10')][_0x92d2('0x12')]);return _0x479c9e(_0x51f5b3[_0x92d2('0x10')][_0x92d2('0x12')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x19a2c1,_0x92d2('0xe'));_0x479c9e(_0x51f5b3['result'][_0x92d2('0x12')]);}})['catch'](function(_0x5a07a4){logger['error'](_0x92d2('0xc'),_0x19a2c1,_0x5a07a4);_0x12d5f1(_0x5a07a4);});});} \ No newline at end of file +var _0x4562=['then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x4d455d,_0x4a610c){var _0x592568=function(_0x5cdc4f){while(--_0x5cdc4f){_0x4d455d['push'](_0x4d455d['shift']());}};_0x592568(++_0x4a610c);}(_0x4562,0x1af));var _0x2456=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4562[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2456('0x0'));var util=require('util');var moment=require(_0x2456('0x1'));var BPromise=require(_0x2456('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2456('0x3'));var db=require(_0x2456('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2456('0x5'));var config=require(_0x2456('0x6'));var jayson=require(_0x2456('0x7'));var client=jayson[_0x2456('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x236ac4,_0x36306b,_0x25d83e){return new BPromise(function(_0x14b52d,_0x32c4bc){return client['request'](_0x236ac4,_0x25d83e)[_0x2456('0x9')](function(_0x273c2e){logger[_0x2456('0xa')](_0x2456('0xb'),_0x36306b,_0x2456('0xc'));logger[_0x2456('0xd')](_0x2456('0xe'),_0x36306b,_0x2456('0xc'),JSON[_0x2456('0xf')](_0x273c2e));if(_0x273c2e[_0x2456('0x10')]){if(_0x273c2e[_0x2456('0x10')][_0x2456('0x11')]===0x1f4){logger[_0x2456('0x10')](_0x2456('0xb'),_0x36306b,_0x273c2e[_0x2456('0x10')][_0x2456('0x12')]);return _0x32c4bc(_0x273c2e['error']['message']);}logger['error'](_0x2456('0xb'),_0x36306b,_0x273c2e[_0x2456('0x10')]['message']);return _0x14b52d(_0x273c2e['error'][_0x2456('0x12')]);}else{logger[_0x2456('0xa')](_0x2456('0xb'),_0x36306b,_0x2456('0xc'));_0x14b52d(_0x273c2e['result'][_0x2456('0x12')]);}})[_0x2456('0x13')](function(_0x276d90){logger[_0x2456('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x36306b,_0x276d90);_0x32c4bc(_0x276d90);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 30f5e8a..0e23dcb 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x10f4d6,_0x361405){var _0x295ed6=function(_0x199324){while(--_0x199324){_0x10f4d6['push'](_0x10f4d6['shift']());}};_0x295ed6(++_0x361405);}(_0x70e0,0x17b));var _0x070e=function(_0x5550a3,_0x186bda){_0x5550a3=_0x5550a3-0x0;var _0x3c3e12=_0x70e0[_0x5550a3];return _0x3c3e12;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5afe07,_0x1fbf7a){var _0x16a018=function(_0x43ee75){while(--_0x43ee75){_0x5afe07['push'](_0x5afe07['shift']());}};_0x16a018(++_0x1fbf7a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 87c8314..5f7175b 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 _0x68ea=['exports','sequelize'];(function(_0x17404d,_0xeb9d20){var _0x5a183c=function(_0x3f4d20){while(--_0x3f4d20){_0x17404d['push'](_0x17404d['shift']());}};_0x5a183c(++_0xeb9d20);}(_0x68ea,0xb9));var _0xa68e=function(_0x349625,_0x4be83b){_0x349625=_0x349625-0x0;var _0x159e36=_0x68ea[_0x349625];return _0x159e36;};'use strict';var Sequelize=require(_0xa68e('0x0'));module[_0xa68e('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfadd=['exports','INTEGER','STRING','sequelize'];(function(_0x121847,_0x26b39d){var _0x3ccb3a=function(_0x28b7d1){while(--_0x28b7d1){_0x121847['push'](_0x121847['shift']());}};_0x3ccb3a(++_0x26b39d);}(_0xfadd,0xff));var _0xdfad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfadd[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xdfad('0x0'));module[_0xdfad('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xdfad('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xdfad('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index bdfc0f9..715781e 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 _0x7e7a=['request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','api','moment','bluebird'];(function(_0x2616de,_0x56dab8){var _0x19f21a=function(_0x328ecc){while(--_0x328ecc){_0x2616de['push'](_0x2616de['shift']());}};_0x19f21a(++_0x56dab8);}(_0x7e7a,0x121));var _0xa7e7=function(_0x4bb8c1,_0x46c35f){_0x4bb8c1=_0x4bb8c1-0x0;var _0x3749f6=_0x7e7a[_0x4bb8c1];return _0x3749f6;};'use strict';var _=require(_0xa7e7('0x0'));var util=require(_0xa7e7('0x1'));var logger=require('../../config/logger')(_0xa7e7('0x2'));var moment=require(_0xa7e7('0x3'));var BPromise=require(_0xa7e7('0x4'));var rp=require(_0xa7e7('0x5'));var fs=require('fs');var path=require(_0xa7e7('0x6'));var rimraf=require(_0xa7e7('0x7'));var config=require(_0xa7e7('0x8'));var attributes=require(_0xa7e7('0x9'));module[_0xa7e7('0xa')]=function(_0x2e3145,_0x51e617){return _0x2e3145[_0xa7e7('0xb')](_0xa7e7('0xc'),attributes,{'tableName':_0xa7e7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd7e=['lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues'];(function(_0x374fa5,_0x130671){var _0x228211=function(_0x5cfba9){while(--_0x5cfba9){_0x374fa5['push'](_0x374fa5['shift']());}};_0x228211(++_0x130671);}(_0xcd7e,0x6e));var _0xecd7=function(_0xf4666e,_0x571140){_0xf4666e=_0xf4666e-0x0;var _0x1853f1=_0xcd7e[_0xf4666e];return _0x1853f1;};'use strict';var _=require(_0xecd7('0x0'));var util=require(_0xecd7('0x1'));var logger=require(_0xecd7('0x2'))('api');var moment=require('moment');var BPromise=require(_0xecd7('0x3'));var rp=require(_0xecd7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xecd7('0x5'));var config=require(_0xecd7('0x6'));var attributes=require(_0xecd7('0x7'));module[_0xecd7('0x8')]=function(_0x349687,_0xd2f566){return _0x349687['define'](_0xecd7('0x9'),attributes,{'tableName':_0xecd7('0xa'),'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 b988523..c87e62a 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 _0xfe9a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash'];(function(_0x498fcb,_0x25d782){var _0x5833db=function(_0x37a9b6){while(--_0x37a9b6){_0x498fcb['push'](_0x498fcb['shift']());}};_0x5833db(++_0x25d782);}(_0xfe9a,0x13a));var _0xafe9=function(_0x591971,_0x3ec945){_0x591971=_0x591971-0x0;var _0x3634de=_0xfe9a[_0x591971];return _0x3634de;};'use strict';var _=require(_0xafe9('0x0'));var util=require('util');var moment=require(_0xafe9('0x1'));var BPromise=require(_0xafe9('0x2'));var rs=require(_0xafe9('0x3'));var fs=require('fs');var Redis=require(_0xafe9('0x4'));var db=require(_0xafe9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xafe9('0x6'))('rpc');var config=require(_0xafe9('0x7'));var jayson=require(_0xafe9('0x8'));var client=jayson[_0xafe9('0x9')][_0xafe9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b01bf,_0x370755,_0x127d03){return new BPromise(function(_0xab9cce,_0x576385){return client[_0xafe9('0xb')](_0x4b01bf,_0x127d03)['then'](function(_0x418aa0){logger[_0xafe9('0xc')](_0xafe9('0xd'),_0x370755,_0xafe9('0xe'));logger[_0xafe9('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x370755,'request\x20sent',JSON[_0xafe9('0x10')](_0x418aa0));if(_0x418aa0['error']){if(_0x418aa0[_0xafe9('0x11')]['code']===0x1f4){logger[_0xafe9('0x11')](_0xafe9('0xd'),_0x370755,_0x418aa0[_0xafe9('0x11')][_0xafe9('0x12')]);return _0x576385(_0x418aa0[_0xafe9('0x11')][_0xafe9('0x12')]);}logger[_0xafe9('0x11')](_0xafe9('0xd'),_0x370755,_0x418aa0['error']['message']);return _0xab9cce(_0x418aa0[_0xafe9('0x11')][_0xafe9('0x12')]);}else{logger[_0xafe9('0xc')](_0xafe9('0xd'),_0x370755,_0xafe9('0xe'));_0xab9cce(_0x418aa0[_0xafe9('0x13')][_0xafe9('0x12')]);}})[_0xafe9('0x14')](function(_0x598b55){logger[_0xafe9('0x11')](_0xafe9('0xd'),_0x370755,_0x598b55);_0x576385(_0x598b55);});});} \ No newline at end of file +var _0x3270=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','UserFaxQueue,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring','ioredis'];(function(_0x4ba6f8,_0x376e06){var _0xe60867=function(_0x42b8ee){while(--_0x42b8ee){_0x4ba6f8['push'](_0x4ba6f8['shift']());}};_0xe60867(++_0x376e06);}(_0x3270,0x188));var _0x0327=function(_0x284a61,_0x231686){_0x284a61=_0x284a61-0x0;var _0x220e3c=_0x3270[_0x284a61];return _0x220e3c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0327('0x0'));var BPromise=require(_0x0327('0x1'));var rs=require(_0x0327('0x2'));var fs=require('fs');var Redis=require(_0x0327('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0327('0x4'));var logger=require(_0x0327('0x5'))(_0x0327('0x6'));var config=require(_0x0327('0x7'));var jayson=require(_0x0327('0x8'));var client=jayson[_0x0327('0x9')][_0x0327('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ffaf7,_0x44ad06,_0x4dd6f8){return new BPromise(function(_0x3dd3f1,_0x282527){return client[_0x0327('0xb')](_0x1ffaf7,_0x4dd6f8)[_0x0327('0xc')](function(_0x2906d1){logger[_0x0327('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x44ad06,_0x0327('0xe'));logger[_0x0327('0xf')](_0x0327('0x10'),_0x44ad06,_0x0327('0xe'),JSON['stringify'](_0x2906d1));if(_0x2906d1[_0x0327('0x11')]){if(_0x2906d1[_0x0327('0x11')][_0x0327('0x12')]===0x1f4){logger[_0x0327('0x11')](_0x0327('0x13'),_0x44ad06,_0x2906d1[_0x0327('0x11')][_0x0327('0x14')]);return _0x282527(_0x2906d1[_0x0327('0x11')]['message']);}logger[_0x0327('0x11')](_0x0327('0x13'),_0x44ad06,_0x2906d1[_0x0327('0x11')][_0x0327('0x14')]);return _0x3dd3f1(_0x2906d1[_0x0327('0x11')][_0x0327('0x14')]);}else{logger['info'](_0x0327('0x13'),_0x44ad06,_0x0327('0xe'));_0x3dd3f1(_0x2906d1['result'][_0x0327('0x14')]);}})[_0x0327('0x15')](function(_0x5503bd){logger[_0x0327('0x11')](_0x0327('0x13'),_0x44ad06,_0x5503bd);_0x282527(_0x5503bd);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 28a40af..2079f92 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2d00d4,_0x3e7d3d){var _0x45f2b6=function(_0xed8fbf){while(--_0xed8fbf){_0x2d00d4['push'](_0x2d00d4['shift']());}};_0x45f2b6(++_0x3e7d3d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3fe227,_0xce2893){var _0x731fef=function(_0x4d44ac){while(--_0x4d44ac){_0x3fe227['push'](_0x3fe227['shift']());}};_0x731fef(++_0xce2893);}(_0xedd9,0xfc));var _0x9edd=function(_0x367a64,_0x4aae6c){_0x367a64=_0x367a64-0x0;var _0x3a0a69=_0xedd9[_0x367a64];return _0x3a0a69;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 996daed..7d76496 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 _0x1239=['INTEGER','sequelize','exports'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x1239,0x19c));var _0x9123=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1239[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x9123('0x0'));module[_0x9123('0x1')]={'penalty':{'type':Sequelize[_0x9123('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9d89=['INTEGER'];(function(_0x449a38,_0x3f8271){var _0x38a415=function(_0x261b53){while(--_0x261b53){_0x449a38['push'](_0x449a38['shift']());}};_0x38a415(++_0x3f8271);}(_0x9d89,0xd5));var _0x99d8=function(_0x556abe,_0x267f95){_0x556abe=_0x556abe-0x0;var _0x2eaef6=_0x9d89[_0x556abe];return _0x2eaef6;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x99d8('0x0')],'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 576efb1..6e28d1c 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 _0x925f=['UserMailQueue','user_has_mail_queues','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define'];(function(_0x34cc3b,_0x43f30d){var _0x46a27e=function(_0x2b914a){while(--_0x2b914a){_0x34cc3b['push'](_0x34cc3b['shift']());}};_0x46a27e(++_0x43f30d);}(_0x925f,0x195));var _0xf925=function(_0x46a563,_0x586712){_0x46a563=_0x46a563-0x0;var _0x10aa22=_0x925f[_0x46a563];return _0x10aa22;};'use strict';var _=require(_0xf925('0x0'));var util=require(_0xf925('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf925('0x2'));var BPromise=require(_0xf925('0x3'));var rp=require(_0xf925('0x4'));var fs=require('fs');var path=require(_0xf925('0x5'));var rimraf=require(_0xf925('0x6'));var config=require(_0xf925('0x7'));var attributes=require(_0xf925('0x8'));module[_0xf925('0x9')]=function(_0x233928,_0x22a4c8){return _0x233928[_0xf925('0xa')](_0xf925('0xb'),attributes,{'tableName':_0xf925('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14e0=['../../config/environment','exports','define','UserMailQueue','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x9b3561,_0x5b1642){var _0x1ea94e=function(_0x4bc561){while(--_0x4bc561){_0x9b3561['push'](_0x9b3561['shift']());}};_0x1ea94e(++_0x5b1642);}(_0x14e0,0x1bc));var _0x014e=function(_0x2da357,_0x1f9b2f){_0x2da357=_0x2da357-0x0;var _0x138fdd=_0x14e0[_0x2da357];return _0x138fdd;};'use strict';var _=require(_0x014e('0x0'));var util=require(_0x014e('0x1'));var logger=require(_0x014e('0x2'))(_0x014e('0x3'));var moment=require(_0x014e('0x4'));var BPromise=require(_0x014e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x014e('0x6'));var config=require(_0x014e('0x7'));var attributes=require('./userMailQueue.attributes');module[_0x014e('0x8')]=function(_0xe66265,_0x4288a6){return _0xe66265[_0x014e('0x9')](_0x014e('0xa'),attributes,{'tableName':'user_has_mail_queues','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 5d43318..ccf26c2 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x7217,0x19e));var _0x7721=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x7217[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +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(_0x5750b5,_0xb23d5f){var _0x3bfc31=function(_0x564a08){while(--_0x564a08){_0x5750b5['push'](_0x5750b5['shift']());}};_0x3bfc31(++_0xb23d5f);}(_0xe14b,0x93));var _0xbe14=function(_0x5d61e8,_0x3ac08f){_0x5d61e8=_0x5d61e8-0x0;var _0x144c95=_0xe14b[_0x5d61e8];return _0x144c95;};'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 diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 8fd13dd..f43bfab 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 _0xfb05=['sendUserNotification','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post','isAuthenticated'];(function(_0x1e441f,_0x51dcad){var _0x5dc8d4=function(_0x2a9696){while(--_0x2a9696){_0x1e441f['push'](_0x1e441f['shift']());}};_0x5dc8d4(++_0x51dcad);}(_0xfb05,0xfd));var _0x5fb0=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xfb05[_0x4a53d];return _0x27410e;};'use strict';var multer=require(_0x5fb0('0x0'));var util=require(_0x5fb0('0x1'));var path=require(_0x5fb0('0x2'));var timeout=require(_0x5fb0('0x3'));var express=require('express');var router=express[_0x5fb0('0x4')]();var fs_extra=require(_0x5fb0('0x5'));var auth=require(_0x5fb0('0x6'));var interaction=require(_0x5fb0('0x7'));var config=require('../../config/environment');var controller=require(_0x5fb0('0x8'));router[_0x5fb0('0x9')]('/',auth[_0x5fb0('0xa')](),controller[_0x5fb0('0xb')]);module['exports']=router; \ No newline at end of file +var _0xb10b=['./userNotification.controller','post','isAuthenticated','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4cbdc4,_0x8be7a8){var _0x413c70=function(_0x9da4a5){while(--_0x9da4a5){_0x4cbdc4['push'](_0x4cbdc4['shift']());}};_0x413c70(++_0x8be7a8);}(_0xb10b,0x10b));var _0xbb10=function(_0x4efd3d,_0x2b9694){_0x4efd3d=_0x4efd3d-0x0;var _0x1293f2=_0xb10b[_0x4efd3d];return _0x1293f2;};'use strict';var multer=require(_0xbb10('0x0'));var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var timeout=require(_0xbb10('0x3'));var express=require('express');var router=express[_0xbb10('0x4')]();var fs_extra=require(_0xbb10('0x5'));var auth=require(_0xbb10('0x6'));var interaction=require(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var controller=require(_0xbb10('0x9'));router[_0xbb10('0xa')]('/',auth[_0xbb10('0xb')](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 5794a11..7ee533a 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 _0x9742=['STRING','BOOLEAN','exports','TEXT'];(function(_0xdebe06,_0x5afb28){var _0xcb4ca1=function(_0x5201f2){while(--_0x5201f2){_0xdebe06['push'](_0xdebe06['shift']());}};_0xcb4ca1(++_0x5afb28);}(_0x9742,0x1e6));var _0x2974=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9742[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x2974('0x0')]={'body':{'type':Sequelize[_0x2974('0x1')]},'senderName':{'type':Sequelize[_0x2974('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x2974('0x2')]},'beep':{'type':Sequelize[_0x2974('0x3')]}}; \ No newline at end of file +var _0xf170=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xf170,0x134));var _0x0f17=function(_0x1a014b,_0x48acae){_0x1a014b=_0x1a014b-0x0;var _0x462258=_0xf170[_0x1a014b];return _0x462258;};'use strict';var Sequelize=require(_0x0f17('0x0'));module[_0x0f17('0x1')]={'body':{'type':Sequelize[_0x0f17('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x0f17('0x3')]},'beep':{'type':Sequelize[_0x0f17('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 46961cd..8110021 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 _0xd5c4=['sortBy','join','create','forEach','recipient','emit','userNotification:send','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','User','union','ids','includes','queue','replace','Queue','all','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','body','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','chatqueue','mailqueue','openchannelqueue','voicequeue','user','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','SenderId','recipientsId'];(function(_0xb8ed16,_0x246a4f){var _0x492a56=function(_0x7aaf37){while(--_0x7aaf37){_0xb8ed16['push'](_0xb8ed16['shift']());}};_0x492a56(++_0x246a4f);}(_0xd5c4,0x7c));var _0x4d5c=function(_0x2b5c7b,_0x3a6cb6){_0x2b5c7b=_0x2b5c7b-0x0;var _0x24eeb4=_0xd5c4[_0x2b5c7b];return _0x24eeb4;};'use strict';var emlformat=require(_0x4d5c('0x0'));var rimraf=require(_0x4d5c('0x1'));var zipdir=require(_0x4d5c('0x2'));var jsonpatch=require(_0x4d5c('0x3'));var rp=require(_0x4d5c('0x4'));var moment=require(_0x4d5c('0x5'));var BPromise=require(_0x4d5c('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4d5c('0x7'));var sox=require(_0x4d5c('0x8'));var csv=require(_0x4d5c('0x9'));var ejs=require(_0x4d5c('0xa'));var fs=require('fs');var fs_extra=require(_0x4d5c('0xb'));var _=require(_0x4d5c('0xc'));var squel=require(_0x4d5c('0xd'));var crypto=require(_0x4d5c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4d5c('0xf'));var toCsv=require(_0x4d5c('0x9'));var querystring=require(_0x4d5c('0x10'));var Papa=require(_0x4d5c('0x11'));var Redis=require(_0x4d5c('0x12'));var authService=require(_0x4d5c('0x13'));var qs=require(_0x4d5c('0x14'));var as=require(_0x4d5c('0x15'));var hardwareService=require(_0x4d5c('0x16'));var logger=require(_0x4d5c('0x17'))(_0x4d5c('0x18'));var utils=require(_0x4d5c('0x19'));var config=require(_0x4d5c('0x1a'));var licenseUtil=require(_0x4d5c('0x1b'));var db=require(_0x4d5c('0x1c'))['db'];config[_0x4d5c('0x1d')]=_[_0x4d5c('0x1e')](config[_0x4d5c('0x1d')],{'host':_0x4d5c('0x1f'),'port':0x18eb});var socket=require(_0x4d5c('0x20'))(new Redis(config[_0x4d5c('0x1d')]));require('./userNotification.socket')[_0x4d5c('0x21')](socket);function respondWithStatusCode(_0x5c925e,_0x2637d9){_0x2637d9=_0x2637d9||0xcc;return function(_0x2d8d53){if(_0x2d8d53){return _0x5c925e[_0x4d5c('0x22')](_0x2637d9);}return _0x5c925e[_0x4d5c('0x23')](_0x2637d9)[_0x4d5c('0x24')]();};}function respondWithResult(_0x159797,_0x1e99c7){_0x1e99c7=_0x1e99c7||0xc8;return function(_0x424241){if(_0x424241){return _0x159797[_0x4d5c('0x23')](_0x1e99c7)[_0x4d5c('0x25')](_0x424241);}};}function respondWithFilteredResult(_0x32d762,_0x2113ac){return function(_0x25458b){if(_0x25458b){var _0x5e4b13=typeof _0x2113ac[_0x4d5c('0x26')]===_0x4d5c('0x27')&&typeof _0x2113ac[_0x4d5c('0x28')]===_0x4d5c('0x27');var _0x5261fb=_0x25458b['count'];var _0x320806=_0x5e4b13?0x0:_0x2113ac[_0x4d5c('0x26')];var _0x7f861c=_0x5e4b13?_0x25458b['count']:_0x2113ac[_0x4d5c('0x26')]+_0x2113ac['limit'];var _0x49ae41;if(_0x7f861c>=_0x5261fb){_0x7f861c=_0x5261fb;_0x49ae41=0xc8;}else{_0x49ae41=0xce;}_0x32d762['status'](_0x49ae41);return _0x32d762['set'](_0x4d5c('0x29'),_0x320806+'-'+_0x7f861c+'/'+_0x5261fb)['json'](_0x25458b);}return null;};}function patchUpdates(_0x5cef4b){return function(_0x2a7ab3){try{jsonpatch[_0x4d5c('0x2a')](_0x2a7ab3,_0x5cef4b,!![]);}catch(_0x31b668){return BPromise[_0x4d5c('0x2b')](_0x31b668);}return _0x2a7ab3[_0x4d5c('0x2c')]();};}function saveUpdates(_0x22d1dc,_0x4da47f){return function(_0xffecd){if(_0xffecd){return _0xffecd[_0x4d5c('0x2d')](_0x22d1dc)[_0x4d5c('0x2e')](function(_0x5040fc){return _0x5040fc;});}return null;};}function removeEntity(_0xcce44,_0x366d95){return function(_0x3311ec){if(_0x3311ec){return _0x3311ec[_0x4d5c('0x2f')]()[_0x4d5c('0x2e')](function(){_0xcce44[_0x4d5c('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b3c03,_0x26bdb9){return function(_0xa9a511){if(!_0xa9a511){_0x1b3c03[_0x4d5c('0x22')](0x194);}return _0xa9a511;};}function handleError(_0x2a58e0,_0x474326){_0x474326=_0x474326||0x1f4;return function(_0x3b8e0c){logger[_0x4d5c('0x30')](_0x3b8e0c[_0x4d5c('0x31')]);if(_0x3b8e0c['name']){delete _0x3b8e0c[_0x4d5c('0x32')];}_0x2a58e0['status'](_0x474326)[_0x4d5c('0x33')](_0x3b8e0c);};}exports[_0x4d5c('0x34')]=function(_0x1a4e96,_0x2c5922,_0x551432){if(!_0x1a4e96['body'][_0x4d5c('0x35')]('text')&&!_0x1a4e96['body'][_0x4d5c('0x35')](_0x4d5c('0x36'))){throw new db[(_0x4d5c('0x37'))][(_0x4d5c('0x38'))](_0x4d5c('0x39'));}else{if(_0x1a4e96[_0x4d5c('0x3a')]['hasOwnProperty'](_0x4d5c('0x36'))&&!_0x1a4e96[_0x4d5c('0x3a')][_0x4d5c('0x35')](_0x4d5c('0x3b'))){throw new db['Sequelize']['ValidationError'](_0x4d5c('0x3c'));}if(!_0x1a4e96[_0x4d5c('0x3a')][_0x4d5c('0x35')](_0x4d5c('0x3d'))){throw new db[(_0x4d5c('0x37'))]['ValidationError'](_0x4d5c('0x3e'));}else{try{var _0x52e9ad=JSON['parse'](_0x1a4e96[_0x4d5c('0x3a')]['recipients']);}catch(_0x3b41e2){logger[_0x4d5c('0x30')](_0x3b41e2);throw new db[(_0x4d5c('0x37'))][(_0x4d5c('0x38'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x23cf90=[_0x4d5c('0x3f'),'faxqueue',_0x4d5c('0x40'),_0x4d5c('0x41'),'smsqueue',_0x4d5c('0x42'),'whatsappqueue','team',_0x4d5c('0x43')];if(_['some'](_0x52e9ad,function(_0x35d8cb){return!_['includes'](_0x23cf90,_0x35d8cb[_0x4d5c('0x44')][_0x4d5c('0x45')]());})){throw new db[(_0x4d5c('0x37'))][(_0x4d5c('0x38'))](_0x4d5c('0x46'));}}}var _0xe41076={};_0xe41076[_0x4d5c('0x47')]=_0x1a4e96[_0x4d5c('0x3a')][_0x4d5c('0x35')]('senderName')?_0x1a4e96[_0x4d5c('0x3a')][_0x4d5c('0x47')]:_0x1a4e96[_0x4d5c('0x43')][_0x4d5c('0x48')];_0xe41076['recipientsDescription']=_['isEmpty'](_0x1a4e96[_0x4d5c('0x3a')][_0x4d5c('0x49')])?null:_0x1a4e96[_0x4d5c('0x3a')][_0x4d5c('0x49')];_0xe41076['beep']=_0x1a4e96[_0x4d5c('0x3a')]['beep']||![];_0xe41076[_0x4d5c('0x4a')]=_0x1a4e96[_0x4d5c('0x43')]['id'];return getContent(_0x1a4e96[_0x4d5c('0x3a')])[_0x4d5c('0x2e')](function(_0x188c79){_0xe41076[_0x4d5c('0x3a')]=_0x188c79;return getRecipients(_0x52e9ad);})['then'](function(_0x155760){_0xe41076[_0x4d5c('0x4b')]=_[_0x4d5c('0x4c')](_0x155760)[_0x4d5c('0x4d')](',');return db['sequelize']['transaction'](function(_0x1a6abb){return db['UserNotification'][_0x4d5c('0x4e')](_0xe41076,{'raw':!![],'transaction':_0x1a6abb})[_0x4d5c('0x2e')](function(_0x31dcfd){var _0x48b85c={'sender':_0xe41076['senderName'],'description':_0xe41076[_0x4d5c('0x49')],'content':_0xe41076[_0x4d5c('0x3a')],'beep':_0xe41076['beep']};_0x155760[_0x4d5c('0x4f')](function(_0xa2aac0){_0x48b85c[_0x4d5c('0x50')]=_0xa2aac0;socket[_0x4d5c('0x51')](_0x4d5c('0x52'),_0x48b85c);});return _0x31dcfd;});});})[_0x4d5c('0x2e')](respondWithResult(_0x2c5922,0xc9))[_0x4d5c('0x53')](handleError(_0x2c5922,null));};function getContent(_0x3381a0){return new BPromise(function(_0x2c9b7b,_0x13f219){if(_0x3381a0['text']){_0x2c9b7b(_0x3381a0[_0x4d5c('0x54')]);return;}return db[_0x4d5c('0x55')][_0x4d5c('0x56')]({'attributes':[_0x4d5c('0x57')],'where':{'id':_0x3381a0[_0x4d5c('0x36')]},'raw':!![]})[_0x4d5c('0x2e')](function(_0x499a81){if(!_0x499a81)throw new db[(_0x4d5c('0x37'))][(_0x4d5c('0x38'))](_0x4d5c('0x58'));var _0x4f863d=Mustache[_0x4d5c('0x59')](_0x499a81[_0x4d5c('0x57')],_0x3381a0[_0x4d5c('0x3b')]);_0x2c9b7b(_0x4f863d);})[_0x4d5c('0x53')](function(_0x2ce8d8){_0x13f219(_0x2ce8d8);});});}function getRecipients(_0x4aefce){return new BPromise(function(_0x1d3a01,_0x33e7e4){var _0x1ab67e=[];var _0x290101=[];_0x4aefce['forEach'](function(_0x912035){var _0x1d9d31=_['startCase'](_0x912035['model'][_0x4d5c('0x45')]());if(_0x1d9d31===_0x4d5c('0x5a')){_0x1ab67e=_[_0x4d5c('0x5b')](_0x1ab67e,_0x912035[_0x4d5c('0x5c')]);}else{if(_[_0x4d5c('0x5d')](_0x1d9d31,_0x4d5c('0x5e')))_0x1d9d31=_0x1d9d31[_0x4d5c('0x5f')](_0x4d5c('0x5e'),_0x4d5c('0x60'));_0x912035[_0x4d5c('0x5c')][_0x4d5c('0x4f')](function(_0x134c25){_0x290101['push'](getAgents(_0x1d9d31,_0x134c25));});}});return BPromise[_0x4d5c('0x61')](_0x290101)[_0x4d5c('0x2e')](function(_0x5c5849){_0x1ab67e=_[_0x4d5c('0x5b')](_0x1ab67e,_[_0x4d5c('0x62')](_0x5c5849));_0x1d3a01(_0x1ab67e);})[_0x4d5c('0x53')](function(_0x45c8ea){_0x33e7e4(_0x45c8ea);});});}function getAgents(_0x354e17,_0x4b5806){return new BPromise(function(_0x3f164c,_0x4dfe7d){return db[_0x354e17][_0x4d5c('0x56')]({'where':{'id':_0x4b5806}})['then'](function(_0x91c90){return _0x91c90['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x2c29dd){var _0x5638f=_[_0x4d5c('0x63')](_0x2c29dd,'id');_0x3f164c(_0x5638f);});})[_0x4d5c('0x53')](function(_0x4b82ae){_0x4dfe7d(_0x4b82ae);});});} \ No newline at end of file +var _0x43eb=['destroy','end','error','stack','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','sequelize','transaction','UserNotification','create','recipient','emit','userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','view','startCase','model','toLowerCase','union','ids','queue','Queue','push','all','flatten','getAgents','map','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x571c1d,_0x3b0586){var _0x33c609=function(_0x226499){while(--_0x226499){_0x571c1d['push'](_0x571c1d['shift']());}};_0x33c609(++_0x3b0586);}(_0x43eb,0x172));var _0xb43e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x43eb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb43e('0x0'));var zipdir=require(_0xb43e('0x1'));var jsonpatch=require(_0xb43e('0x2'));var rp=require(_0xb43e('0x3'));var moment=require('moment');var BPromise=require(_0xb43e('0x4'));var Mustache=require('mustache');var util=require(_0xb43e('0x5'));var path=require(_0xb43e('0x6'));var sox=require('sox');var csv=require(_0xb43e('0x7'));var ejs=require(_0xb43e('0x8'));var fs=require('fs');var fs_extra=require(_0xb43e('0x9'));var _=require(_0xb43e('0xa'));var squel=require(_0xb43e('0xb'));var crypto=require(_0xb43e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb43e('0xd'));var toCsv=require(_0xb43e('0x7'));var querystring=require(_0xb43e('0xe'));var Papa=require(_0xb43e('0xf'));var Redis=require(_0xb43e('0x10'));var authService=require(_0xb43e('0x11'));var qs=require(_0xb43e('0x12'));var as=require(_0xb43e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb43e('0x14'));var utils=require(_0xb43e('0x15'));var config=require(_0xb43e('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb43e('0x17')]=_['defaults'](config[_0xb43e('0x17')],{'host':_0xb43e('0x18'),'port':0x18eb});var socket=require(_0xb43e('0x19'))(new Redis(config['redis']));require(_0xb43e('0x1a'))[_0xb43e('0x1b')](socket);function respondWithStatusCode(_0x2168b9,_0x26f5e4){_0x26f5e4=_0x26f5e4||0xcc;return function(_0x335eab){if(_0x335eab){return _0x2168b9[_0xb43e('0x1c')](_0x26f5e4);}return _0x2168b9[_0xb43e('0x1d')](_0x26f5e4)['end']();};}function respondWithResult(_0x267dc3,_0x3d2a8a){_0x3d2a8a=_0x3d2a8a||0xc8;return function(_0x47ab08){if(_0x47ab08){return _0x267dc3[_0xb43e('0x1d')](_0x3d2a8a)[_0xb43e('0x1e')](_0x47ab08);}};}function respondWithFilteredResult(_0xdf49b7,_0x5de8e0){return function(_0xfb2d95){if(_0xfb2d95){var _0x4bc4d9=typeof _0x5de8e0[_0xb43e('0x1f')]===_0xb43e('0x20')&&typeof _0x5de8e0[_0xb43e('0x21')]===_0xb43e('0x20');var _0xa858a4=_0xfb2d95[_0xb43e('0x22')];var _0x381268=_0x4bc4d9?0x0:_0x5de8e0[_0xb43e('0x1f')];var _0x1b7385=_0x4bc4d9?_0xfb2d95[_0xb43e('0x22')]:_0x5de8e0['offset']+_0x5de8e0[_0xb43e('0x21')];var _0x11299c;if(_0x1b7385>=_0xa858a4){_0x1b7385=_0xa858a4;_0x11299c=0xc8;}else{_0x11299c=0xce;}_0xdf49b7[_0xb43e('0x1d')](_0x11299c);return _0xdf49b7[_0xb43e('0x23')](_0xb43e('0x24'),_0x381268+'-'+_0x1b7385+'/'+_0xa858a4)['json'](_0xfb2d95);}return null;};}function patchUpdates(_0x64fe86){return function(_0x58b623){try{jsonpatch[_0xb43e('0x25')](_0x58b623,_0x64fe86,!![]);}catch(_0xd806aa){return BPromise[_0xb43e('0x26')](_0xd806aa);}return _0x58b623[_0xb43e('0x27')]();};}function saveUpdates(_0x5b2f7a,_0x50978a){return function(_0x2f8e5f){if(_0x2f8e5f){return _0x2f8e5f[_0xb43e('0x28')](_0x5b2f7a)[_0xb43e('0x29')](function(_0x19b3c1){return _0x19b3c1;});}return null;};}function removeEntity(_0x3cc958,_0x37e198){return function(_0x57311b){if(_0x57311b){return _0x57311b[_0xb43e('0x2a')]()[_0xb43e('0x29')](function(){_0x3cc958['status'](0xcc)[_0xb43e('0x2b')]();});}};}function handleEntityNotFound(_0x21d4a2,_0x2a1852){return function(_0x33b4a1){if(!_0x33b4a1){_0x21d4a2[_0xb43e('0x1c')](0x194);}return _0x33b4a1;};}function handleError(_0x4404bd,_0x219cd0){_0x219cd0=_0x219cd0||0x1f4;return function(_0x4d2aff){logger[_0xb43e('0x2c')](_0x4d2aff[_0xb43e('0x2d')]);if(_0x4d2aff[_0xb43e('0x2e')]){delete _0x4d2aff[_0xb43e('0x2e')];}_0x4404bd['status'](_0x219cd0)[_0xb43e('0x2f')](_0x4d2aff);};}exports['sendUserNotification']=function(_0x26282a,_0x439816,_0x40e4ca){if(!_0x26282a[_0xb43e('0x30')][_0xb43e('0x31')](_0xb43e('0x32'))&&!_0x26282a[_0xb43e('0x30')]['hasOwnProperty'](_0xb43e('0x33'))){throw new db[(_0xb43e('0x34'))][(_0xb43e('0x35'))](_0xb43e('0x36'));}else{if(_0x26282a[_0xb43e('0x30')][_0xb43e('0x31')]('TemplateId')&&!_0x26282a[_0xb43e('0x30')][_0xb43e('0x31')]('view')){throw new db[(_0xb43e('0x34'))][(_0xb43e('0x35'))](_0xb43e('0x37'));}if(!_0x26282a[_0xb43e('0x30')][_0xb43e('0x31')](_0xb43e('0x38'))){throw new db['Sequelize'][(_0xb43e('0x35'))](_0xb43e('0x39'));}else{try{var _0x579550=JSON['parse'](_0x26282a['body'][_0xb43e('0x38')]);}catch(_0x41c833){logger[_0xb43e('0x2c')](_0x41c833);throw new db[(_0xb43e('0x34'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x549d51=[_0xb43e('0x3a'),_0xb43e('0x3b'),'mailqueue',_0xb43e('0x3c'),_0xb43e('0x3d'),_0xb43e('0x3e'),_0xb43e('0x3f'),_0xb43e('0x40'),_0xb43e('0x41')];if(_[_0xb43e('0x42')](_0x579550,function(_0x466400){return!_[_0xb43e('0x43')](_0x549d51,_0x466400['model']['toLowerCase']());})){throw new db[(_0xb43e('0x34'))][(_0xb43e('0x35'))](_0xb43e('0x44'));}}}var _0x3cce8c={};_0x3cce8c[_0xb43e('0x45')]=_0x26282a[_0xb43e('0x30')][_0xb43e('0x31')](_0xb43e('0x45'))?_0x26282a[_0xb43e('0x30')][_0xb43e('0x45')]:_0x26282a[_0xb43e('0x41')][_0xb43e('0x46')];_0x3cce8c[_0xb43e('0x47')]=_[_0xb43e('0x48')](_0x26282a['body'][_0xb43e('0x47')])?null:_0x26282a[_0xb43e('0x30')][_0xb43e('0x47')];_0x3cce8c[_0xb43e('0x49')]=_0x26282a[_0xb43e('0x30')][_0xb43e('0x49')]||![];_0x3cce8c[_0xb43e('0x4a')]=_0x26282a[_0xb43e('0x41')]['id'];return getContent(_0x26282a['body'])[_0xb43e('0x29')](function(_0xb77c8d){_0x3cce8c[_0xb43e('0x30')]=_0xb77c8d;return getRecipients(_0x579550);})[_0xb43e('0x29')](function(_0x4467c6){_0x3cce8c[_0xb43e('0x4b')]=_[_0xb43e('0x4c')](_0x4467c6)['join'](',');return db[_0xb43e('0x4d')][_0xb43e('0x4e')](function(_0x3cf92e){return db[_0xb43e('0x4f')][_0xb43e('0x50')](_0x3cce8c,{'raw':!![],'transaction':_0x3cf92e})[_0xb43e('0x29')](function(_0x5bbc64){var _0x1e5377={'sender':_0x3cce8c[_0xb43e('0x45')],'description':_0x3cce8c[_0xb43e('0x47')],'content':_0x3cce8c[_0xb43e('0x30')],'beep':_0x3cce8c[_0xb43e('0x49')]};_0x4467c6['forEach'](function(_0x121067){_0x1e5377[_0xb43e('0x51')]=_0x121067;socket[_0xb43e('0x52')](_0xb43e('0x53'),_0x1e5377);});return _0x5bbc64;});});})[_0xb43e('0x29')](respondWithResult(_0x439816,0xc9))[_0xb43e('0x54')](handleError(_0x439816,null));};function getContent(_0x33acbd){return new BPromise(function(_0x35e223,_0x562f06){if(_0x33acbd[_0xb43e('0x32')]){_0x35e223(_0x33acbd[_0xb43e('0x32')]);return;}return db[_0xb43e('0x55')][_0xb43e('0x56')]({'attributes':['html'],'where':{'id':_0x33acbd[_0xb43e('0x33')]},'raw':!![]})[_0xb43e('0x29')](function(_0xa0e7ba){if(!_0xa0e7ba)throw new db['Sequelize'][(_0xb43e('0x35'))](_0xb43e('0x57'));var _0x1d59b2=Mustache[_0xb43e('0x58')](_0xa0e7ba[_0xb43e('0x59')],_0x33acbd[_0xb43e('0x5a')]);_0x35e223(_0x1d59b2);})[_0xb43e('0x54')](function(_0x5ec042){_0x562f06(_0x5ec042);});});}function getRecipients(_0x494b93){return new BPromise(function(_0x567c17,_0x2f5d45){var _0x349e65=[];var _0x33d961=[];_0x494b93['forEach'](function(_0x108851){var _0x1cdb5c=_[_0xb43e('0x5b')](_0x108851[_0xb43e('0x5c')][_0xb43e('0x5d')]());if(_0x1cdb5c==='User'){_0x349e65=_[_0xb43e('0x5e')](_0x349e65,_0x108851[_0xb43e('0x5f')]);}else{if(_[_0xb43e('0x43')](_0x1cdb5c,_0xb43e('0x60')))_0x1cdb5c=_0x1cdb5c['replace'](_0xb43e('0x60'),_0xb43e('0x61'));_0x108851[_0xb43e('0x5f')]['forEach'](function(_0x426ada){_0x33d961[_0xb43e('0x62')](getAgents(_0x1cdb5c,_0x426ada));});}});return BPromise[_0xb43e('0x63')](_0x33d961)[_0xb43e('0x29')](function(_0x7828ec){_0x349e65=_['union'](_0x349e65,_[_0xb43e('0x64')](_0x7828ec));_0x567c17(_0x349e65);})[_0xb43e('0x54')](function(_0x1fc636){_0x2f5d45(_0x1fc636);});});}function getAgents(_0x1ec57f,_0x337d43){return new BPromise(function(_0x17dc1a,_0x43cde7){return db[_0x1ec57f][_0xb43e('0x56')]({'where':{'id':_0x337d43}})[_0xb43e('0x29')](function(_0x3cbd1e){return _0x3cbd1e[_0xb43e('0x65')]({'attributes':['id'],'raw':!![]})[_0xb43e('0x29')](function(_0x4e6382){var _0x16b47d=_[_0xb43e('0x66')](_0x4e6382,'id');_0x17dc1a(_0x16b47d);});})[_0xb43e('0x54')](function(_0x2a6d3e){_0x43cde7(_0x2a6d3e);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 295eae9..18baf1d 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 _0xa3d7=['exports','events','../../mysqldb','UserNotification','setMaxListeners','update','emit','hook'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xa3d7,0x91));var _0x7a3d=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xa3d7[_0x24259d];return _0x5a701;};'use strict';var EventEmitter=require(_0x7a3d('0x0'));var UserNotification=require(_0x7a3d('0x1'))['db'][_0x7a3d('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x7a3d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7a3d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x36acf3){return function(_0x55a0b8,_0x29b06e,_0x42e8b3){UserNotificationEvents[_0x7a3d('0x5')](_0x36acf3+':'+_0x55a0b8['id'],_0x55a0b8);UserNotificationEvents[_0x7a3d('0x5')](_0x36acf3,_0x55a0b8);_0x42e8b3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x7a3d('0x6')](e,emitEvent(event));}}module[_0x7a3d('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0xd5ef=['exports','events','../../mysqldb','UserNotification','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xa601a2,_0x47718e){var _0x54af8a=function(_0x20521c){while(--_0x20521c){_0xa601a2['push'](_0xa601a2['shift']());}};_0x54af8a(++_0x47718e);}(_0xd5ef,0x155));var _0xfd5e=function(_0x1b862d,_0x1443ad){_0x1b862d=_0x1b862d-0x0;var _0x241f01=_0xd5ef[_0x1b862d];return _0x241f01;};'use strict';var EventEmitter=require(_0xfd5e('0x0'));var UserNotification=require(_0xfd5e('0x1'))['db'][_0xfd5e('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfd5e('0x3'),'afterUpdate':_0xfd5e('0x4'),'afterDestroy':_0xfd5e('0x5')};function emitEvent(_0x4dc62b){return function(_0x4454ba,_0xa5d7cc,_0x5ce814){UserNotificationEvents[_0xfd5e('0x6')](_0x4dc62b+':'+_0x4454ba['id'],_0x4454ba);UserNotificationEvents['emit'](_0x4dc62b,_0x4454ba);_0x5ce814(null);};}for(var e in events){if(events[_0xfd5e('0x7')](e)){var event=events[e];UserNotification[_0xfd5e('0x8')](e,emitEvent(event));}}module[_0xfd5e('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index a5869a5..c766249 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 _0xef44=['request-promise','path','rimraf','exports','define','UserNotification','userNotifications','utf8mb4','lodash','api','moment','bluebird'];(function(_0x3f2302,_0x3c3363){var _0x55fed4=function(_0x14d32e){while(--_0x14d32e){_0x3f2302['push'](_0x3f2302['shift']());}};_0x55fed4(++_0x3c3363);}(_0xef44,0x74));var _0x4ef4=function(_0x199842,_0x954b70){_0x199842=_0x199842-0x0;var _0x53c298=_0xef44[_0x199842];return _0x53c298;};'use strict';var _=require(_0x4ef4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4ef4('0x1'));var moment=require(_0x4ef4('0x2'));var BPromise=require(_0x4ef4('0x3'));var rp=require(_0x4ef4('0x4'));var fs=require('fs');var path=require(_0x4ef4('0x5'));var rimraf=require(_0x4ef4('0x6'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module[_0x4ef4('0x7')]=function(_0x2c58e5,_0x46cd6e){return _0x2c58e5[_0x4ef4('0x8')](_0x4ef4('0x9'),attributes,{'tableName':_0x4ef4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4ef4('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa699=['exports','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes'];(function(_0x382ca6,_0x1aaf79){var _0x295a6c=function(_0x294a0b){while(--_0x294a0b){_0x382ca6['push'](_0x382ca6['shift']());}};_0x295a6c(++_0x1aaf79);}(_0xa699,0xf3));var _0x9a69=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0xa699[_0x2c0dc0];return _0x4c0990;};'use strict';var _=require(_0x9a69('0x0'));var util=require('util');var logger=require(_0x9a69('0x1'))('api');var moment=require(_0x9a69('0x2'));var BPromise=require(_0x9a69('0x3'));var rp=require(_0x9a69('0x4'));var fs=require('fs');var path=require(_0x9a69('0x5'));var rimraf=require(_0x9a69('0x6'));var config=require(_0x9a69('0x7'));var attributes=require(_0x9a69('0x8'));module[_0x9a69('0x9')]=function(_0x317b62,_0x443fad){return _0x317b62['define'](_0x9a69('0xa'),attributes,{'tableName':_0x9a69('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9a69('0xc'),'collate':_0x9a69('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 1ee47ed..ba48080 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 _0x94ec=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x94ec,0x13c));var _0xc94e=function(_0x233fac,_0x1e1d9d){_0x233fac=_0x233fac-0x0;var _0x4572c6=_0x94ec[_0x233fac];return _0x4572c6;};'use strict';var _=require(_0xc94e('0x0'));var util=require(_0xc94e('0x1'));var moment=require(_0xc94e('0x2'));var BPromise=require(_0xc94e('0x3'));var rs=require(_0xc94e('0x4'));var fs=require('fs');var Redis=require(_0xc94e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc94e('0x6'));var logger=require(_0xc94e('0x7'))(_0xc94e('0x8'));var config=require(_0xc94e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc94e('0xa')]({'port':0x232a});config[_0xc94e('0xb')]=_[_0xc94e('0xc')](config[_0xc94e('0xb')],{'host':_0xc94e('0xd'),'port':0x18eb});var socket=require(_0xc94e('0xe'))(new Redis(config[_0xc94e('0xb')]));require(_0xc94e('0xf'))[_0xc94e('0x10')](socket);function respondWithRpcPromise(_0xd9f4a8,_0x357480,_0x364e3e){return new BPromise(function(_0x54158f,_0xd9cfc0){return client[_0xc94e('0x11')](_0xd9f4a8,_0x364e3e)['then'](function(_0x19b24f){logger[_0xc94e('0x12')](_0xc94e('0x13'),_0x357480,_0xc94e('0x14'));logger[_0xc94e('0x15')](_0xc94e('0x16'),_0x357480,_0xc94e('0x14'),JSON[_0xc94e('0x17')](_0x19b24f));if(_0x19b24f[_0xc94e('0x18')]){if(_0x19b24f[_0xc94e('0x18')][_0xc94e('0x19')]===0x1f4){logger[_0xc94e('0x18')](_0xc94e('0x13'),_0x357480,_0x19b24f[_0xc94e('0x18')][_0xc94e('0x1a')]);return _0xd9cfc0(_0x19b24f[_0xc94e('0x18')][_0xc94e('0x1a')]);}logger[_0xc94e('0x18')](_0xc94e('0x13'),_0x357480,_0x19b24f['error'][_0xc94e('0x1a')]);return _0x54158f(_0x19b24f['error'][_0xc94e('0x1a')]);}else{logger[_0xc94e('0x12')](_0xc94e('0x13'),_0x357480,'request\x20sent');_0x54158f(_0x19b24f[_0xc94e('0x1b')][_0xc94e('0x1a')]);}})[_0xc94e('0x1c')](function(_0x588d8d){logger[_0xc94e('0x18')](_0xc94e('0x13'),_0x357480,_0x588d8d);_0xd9cfc0(_0x588d8d);});});} \ No newline at end of file +var _0xb58d=['localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','message','UserNotification,\x20%s,\x20%s','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x526046,_0x154040){var _0x5b92a2=function(_0x1e92af){while(--_0x1e92af){_0x526046['push'](_0x526046['shift']());}};_0x5b92a2(++_0x154040);}(_0xb58d,0x76));var _0xdb58=function(_0x471fc0,_0x561236){_0x471fc0=_0x471fc0-0x0;var _0x227b85=_0xb58d[_0x471fc0];return _0x227b85;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdb58('0x0'));var BPromise=require(_0xdb58('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb58('0x2'));var db=require(_0xdb58('0x3'))['db'];var utils=require(_0xdb58('0x4'));var logger=require(_0xdb58('0x5'))(_0xdb58('0x6'));var config=require(_0xdb58('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdb58('0x8')][_0xdb58('0x9')]({'port':0x232a});config[_0xdb58('0xa')]=_[_0xdb58('0xb')](config[_0xdb58('0xa')],{'host':_0xdb58('0xc'),'port':0x18eb});var socket=require(_0xdb58('0xd'))(new Redis(config[_0xdb58('0xa')]));require(_0xdb58('0xe'))[_0xdb58('0xf')](socket);function respondWithRpcPromise(_0x227f9c,_0x59e937,_0x50914c){return new BPromise(function(_0x10bf66,_0xf97249){return client[_0xdb58('0x10')](_0x227f9c,_0x50914c)[_0xdb58('0x11')](function(_0x201873){logger[_0xdb58('0x12')]('UserNotification,\x20%s,\x20%s',_0x59e937,_0xdb58('0x13'));logger[_0xdb58('0x14')](_0xdb58('0x15'),_0x59e937,_0xdb58('0x13'),JSON['stringify'](_0x201873));if(_0x201873[_0xdb58('0x16')]){if(_0x201873[_0xdb58('0x16')]['code']===0x1f4){logger[_0xdb58('0x16')]('UserNotification,\x20%s,\x20%s',_0x59e937,_0x201873[_0xdb58('0x16')]['message']);return _0xf97249(_0x201873[_0xdb58('0x16')][_0xdb58('0x17')]);}logger[_0xdb58('0x16')](_0xdb58('0x18'),_0x59e937,_0x201873[_0xdb58('0x16')][_0xdb58('0x17')]);return _0x10bf66(_0x201873[_0xdb58('0x16')][_0xdb58('0x17')]);}else{logger[_0xdb58('0x12')](_0xdb58('0x18'),_0x59e937,'request\x20sent');_0x10bf66(_0x201873[_0xdb58('0x19')][_0xdb58('0x17')]);}})['catch'](function(_0x42aafe){logger[_0xdb58('0x16')](_0xdb58('0x18'),_0x59e937,_0x42aafe);_0xf97249(_0x42aafe);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index f22a0c8..f8ba907 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 _0xe3b5=['emit','removeListener','register','userNotification:','./userNotification.events','remove','update'];(function(_0x2cc94f,_0x412b13){var _0x1ea449=function(_0x3075a1){while(--_0x3075a1){_0x2cc94f['push'](_0x2cc94f['shift']());}};_0x1ea449(++_0x412b13);}(_0xe3b5,0x66));var _0x5e3b=function(_0x3a736f,_0x17504e){_0x3a736f=_0x3a736f-0x0;var _0x33696d=_0xe3b5[_0x3a736f];return _0x33696d;};'use strict';var UserNotificationEvents=require(_0x5e3b('0x0'));var events=['save',_0x5e3b('0x1'),_0x5e3b('0x2')];function createListener(_0x590386,_0x49c2f4){return function(_0x38ab39){_0x49c2f4[_0x5e3b('0x3')](_0x590386,_0x38ab39);};}function removeListener(_0x38167c,_0x1e1b74){return function(){UserNotificationEvents[_0x5e3b('0x4')](_0x38167c,_0x1e1b74);};}exports[_0x5e3b('0x5')]=function(_0x1ee4f3){for(var _0x131374=0x0,_0x1f569a=events['length'];_0x131374<_0x1f569a;_0x131374++){var _0x4b69f8=events[_0x131374];var _0x109a79=createListener(_0x5e3b('0x6')+_0x4b69f8,_0x1ee4f3);UserNotificationEvents['on'](_0x4b69f8,_0x109a79);}}; \ No newline at end of file +var _0xf146=['remove','emit','removeListener','register','length','userNotification:','./userNotification.events','save'];(function(_0x3d4d2c,_0x2bc867){var _0x19cdb6=function(_0x2676ae){while(--_0x2676ae){_0x3d4d2c['push'](_0x3d4d2c['shift']());}};_0x19cdb6(++_0x2bc867);}(_0xf146,0x15e));var _0x6f14=function(_0x150599,_0x3bdfb0){_0x150599=_0x150599-0x0;var _0x12c65f=_0xf146[_0x150599];return _0x12c65f;};'use strict';var UserNotificationEvents=require(_0x6f14('0x0'));var events=[_0x6f14('0x1'),_0x6f14('0x2'),'update'];function createListener(_0x56fa0f,_0x46d5ee){return function(_0x246006){_0x46d5ee[_0x6f14('0x3')](_0x56fa0f,_0x246006);};}function removeListener(_0x42cbc5,_0x50a1a7){return function(){UserNotificationEvents[_0x6f14('0x4')](_0x42cbc5,_0x50a1a7);};}exports[_0x6f14('0x5')]=function(_0x2d61ce){for(var _0xe3d82c=0x0,_0x3a41c0=events[_0x6f14('0x6')];_0xe3d82c<_0x3a41c0;_0xe3d82c++){var _0x1c1b4f=events[_0xe3d82c];var _0x57e584=createListener(_0x6f14('0x7')+_0x1c1b4f,_0x2d61ce);UserNotificationEvents['on'](_0x1c1b4f,_0x57e584);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index d8417ba..cbf4e0d 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(_0x24cc8b,_0x4845b7){var _0x52b699=function(_0x23b45f){while(--_0x23b45f){_0x24cc8b['push'](_0x24cc8b['shift']());}};_0x52b699(++_0x4845b7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x189305,_0x46c43f){_0x189305=_0x189305-0x0;var _0xea3406=_0xcb91[_0x189305];return _0xea3406;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x8ae2da,_0x1ce168){var _0x2addc6=function(_0x9dd799){while(--_0x9dd799){_0x8ae2da['push'](_0x8ae2da['shift']());}};_0x2addc6(++_0x1ce168);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x687ddc,_0x2092fa){_0x687ddc=_0x687ddc-0x0;var _0x441991=_0xcb91[_0x687ddc];return _0x441991;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index f57de1f..31ac7e8 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 _0x50ff=['INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x50ff,0x1c7));var _0xf50f=function(_0x25896c,_0xab211d){_0x25896c=_0x25896c-0x0;var _0x223285=_0x50ff[_0x25896c];return _0x223285;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xf50f('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x392b=['sequelize','exports'];(function(_0x2fca64,_0x4ebe6d){var _0x591549=function(_0x33a282){while(--_0x33a282){_0x2fca64['push'](_0x2fca64['shift']());}};_0x591549(++_0x4ebe6d);}(_0x392b,0x162));var _0xb392=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x392b[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xb392('0x0'));module[_0xb392('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 6ccd96d..a18994b 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 _0x9dd6=['bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','../../config/logger','api','moment'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x9dd6,0x7f));var _0x69dd=function(_0x36422b,_0x12d6f5){_0x36422b=_0x36422b-0x0;var _0x4a12bd=_0x9dd6[_0x36422b];return _0x4a12bd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x69dd('0x0'))(_0x69dd('0x1'));var moment=require(_0x69dd('0x2'));var BPromise=require(_0x69dd('0x3'));var rp=require(_0x69dd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x69dd('0x5'));var config=require(_0x69dd('0x6'));var attributes=require(_0x69dd('0x7'));module[_0x69dd('0x8')]=function(_0x53f973,_0x22c5a2){return _0x53f973['define'](_0x69dd('0x9'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4b4=['path','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','../../config/logger','moment','bluebird','request-promise'];(function(_0x1df925,_0x982be6){var _0x4d9d75=function(_0x196379){while(--_0x196379){_0x1df925['push'](_0x1df925['shift']());}};_0x4d9d75(++_0x982be6);}(_0xc4b4,0xe2));var _0x4c4b=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xc4b4[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4c4b('0x0'))('api');var moment=require(_0x4c4b('0x1'));var BPromise=require(_0x4c4b('0x2'));var rp=require(_0x4c4b('0x3'));var fs=require('fs');var path=require(_0x4c4b('0x4'));var rimraf=require('rimraf');var config=require(_0x4c4b('0x5'));var attributes=require(_0x4c4b('0x6'));module['exports']=function(_0x19c2c7,_0xa0902d){return _0x19c2c7[_0x4c4b('0x7')](_0x4c4b('0x8'),attributes,{'tableName':_0x4c4b('0x9'),'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 0ce4d8c..4b3a261 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 _0x2a08=['request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','UserOpenchannelQueue,\x20%s,\x20%s'];(function(_0x13285a,_0x43332c){var _0x22991b=function(_0xae8a38){while(--_0xae8a38){_0x13285a['push'](_0x13285a['shift']());}};_0x22991b(++_0x43332c);}(_0x2a08,0x189));var _0x82a0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2a08[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x82a0('0x0'));var util=require(_0x82a0('0x1'));var moment=require(_0x82a0('0x2'));var BPromise=require(_0x82a0('0x3'));var rs=require(_0x82a0('0x4'));var fs=require('fs');var Redis=require(_0x82a0('0x5'));var db=require(_0x82a0('0x6'))['db'];var utils=require(_0x82a0('0x7'));var logger=require(_0x82a0('0x8'))(_0x82a0('0x9'));var config=require(_0x82a0('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x82a0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x516ce4,_0x18df77,_0x4bfcbc){return new BPromise(function(_0x416ff5,_0x11d5a0){return client[_0x82a0('0xc')](_0x516ce4,_0x4bfcbc)[_0x82a0('0xd')](function(_0x288d88){logger['info'](_0x82a0('0xe'),_0x18df77,_0x82a0('0xf'));logger[_0x82a0('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x18df77,'request\x20sent',JSON[_0x82a0('0x11')](_0x288d88));if(_0x288d88[_0x82a0('0x12')]){if(_0x288d88[_0x82a0('0x12')][_0x82a0('0x13')]===0x1f4){logger[_0x82a0('0x12')](_0x82a0('0xe'),_0x18df77,_0x288d88['error'][_0x82a0('0x14')]);return _0x11d5a0(_0x288d88[_0x82a0('0x12')][_0x82a0('0x14')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x18df77,_0x288d88[_0x82a0('0x12')][_0x82a0('0x14')]);return _0x416ff5(_0x288d88[_0x82a0('0x12')][_0x82a0('0x14')]);}else{logger[_0x82a0('0x15')](_0x82a0('0xe'),_0x18df77,_0x82a0('0xf'));_0x416ff5(_0x288d88[_0x82a0('0x16')]['message']);}})[_0x82a0('0x17')](function(_0x4cf08b){logger[_0x82a0('0x12')](_0x82a0('0xe'),_0x18df77,_0x4cf08b);_0x11d5a0(_0x4cf08b);});});} \ No newline at end of file +var _0x8bb2=['catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x8bb2,0x1b6));var _0x28bb=function(_0xd336fa,_0x39d1b2){_0xd336fa=_0xd336fa-0x0;var _0x3370b1=_0x8bb2[_0xd336fa];return _0x3370b1;};'use strict';var _=require(_0x28bb('0x0'));var util=require(_0x28bb('0x1'));var moment=require(_0x28bb('0x2'));var BPromise=require('bluebird');var rs=require(_0x28bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x28bb('0x4'))['db'];var utils=require(_0x28bb('0x5'));var logger=require(_0x28bb('0x6'))(_0x28bb('0x7'));var config=require(_0x28bb('0x8'));var jayson=require(_0x28bb('0x9'));var client=jayson[_0x28bb('0xa')][_0x28bb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23d66c,_0x5073ab,_0x250dbc){return new BPromise(function(_0x1d1847,_0x530188){return client[_0x28bb('0xc')](_0x23d66c,_0x250dbc)[_0x28bb('0xd')](function(_0x2bcab8){logger[_0x28bb('0xe')](_0x28bb('0xf'),_0x5073ab,_0x28bb('0x10'));logger[_0x28bb('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5073ab,_0x28bb('0x10'),JSON['stringify'](_0x2bcab8));if(_0x2bcab8[_0x28bb('0x12')]){if(_0x2bcab8[_0x28bb('0x12')][_0x28bb('0x13')]===0x1f4){logger['error'](_0x28bb('0xf'),_0x5073ab,_0x2bcab8[_0x28bb('0x12')][_0x28bb('0x14')]);return _0x530188(_0x2bcab8[_0x28bb('0x12')]['message']);}logger['error'](_0x28bb('0xf'),_0x5073ab,_0x2bcab8[_0x28bb('0x12')]['message']);return _0x1d1847(_0x2bcab8[_0x28bb('0x12')][_0x28bb('0x14')]);}else{logger[_0x28bb('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5073ab,_0x28bb('0x10'));_0x1d1847(_0x2bcab8[_0x28bb('0x15')][_0x28bb('0x14')]);}})[_0x28bb('0x16')](function(_0x380b64){logger[_0x28bb('0x12')](_0x28bb('0xf'),_0x5073ab,_0x380b64);_0x530188(_0x380b64);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 638e65e..f5f625e 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 _0x6aef=['create','/:id/clone','clone','addSections','/:id/resources','addResources','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/sections','getSections','getResources','post'];(function(_0x232409,_0x4039cf){var _0xbdb0dc=function(_0x2ac980){while(--_0x2ac980){_0x232409['push'](_0x232409['shift']());}};_0xbdb0dc(++_0x4039cf);}(_0x6aef,0x1b0));var _0xf6ae=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6aef[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf6ae('0x0'));var util=require(_0xf6ae('0x1'));var path=require(_0xf6ae('0x2'));var timeout=require(_0xf6ae('0x3'));var express=require(_0xf6ae('0x4'));var router=express[_0xf6ae('0x5')]();var fs_extra=require(_0xf6ae('0x6'));var auth=require(_0xf6ae('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf6ae('0x8'));var controller=require('./userProfile.controller');router[_0xf6ae('0x9')]('/',auth['isAuthenticated'](),controller[_0xf6ae('0xa')]);router[_0xf6ae('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xf6ae('0x9')](_0xf6ae('0xb'),auth[_0xf6ae('0xc')](),controller[_0xf6ae('0xd')]);router[_0xf6ae('0x9')](_0xf6ae('0xe'),auth[_0xf6ae('0xc')](),controller[_0xf6ae('0xf')]);router[_0xf6ae('0x9')]('/:id/resources',auth[_0xf6ae('0xc')](),controller[_0xf6ae('0x10')]);router[_0xf6ae('0x11')]('/',auth[_0xf6ae('0xc')](),controller[_0xf6ae('0x12')]);router['post'](_0xf6ae('0x13'),auth['isAuthenticated'](),controller[_0xf6ae('0x14')]);router['post'](_0xf6ae('0xe'),auth[_0xf6ae('0xc')](),controller[_0xf6ae('0x15')]);router['post'](_0xf6ae('0x16'),auth['isAuthenticated'](),controller[_0xf6ae('0x17')]);router['put'](_0xf6ae('0xb'),auth[_0xf6ae('0xc')](),controller[_0xf6ae('0x18')]);router[_0xf6ae('0x19')](_0xf6ae('0xb'),auth[_0xf6ae('0xc')](),controller[_0xf6ae('0x1a')]);router[_0xf6ae('0x19')](_0xf6ae('0xe'),auth[_0xf6ae('0xc')](),controller[_0xf6ae('0x1b')]);router[_0xf6ae('0x19')](_0xf6ae('0x16'),auth[_0xf6ae('0xc')](),controller[_0xf6ae('0x1c')]);module[_0xf6ae('0x1d')]=router; \ No newline at end of file +var _0x5c02=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','describe','show','/:id/sections','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','addResources','/:id','delete','removeResources','exports','util'];(function(_0x46e97a,_0x226ea3){var _0x1c94eb=function(_0x5b7764){while(--_0x5b7764){_0x46e97a['push'](_0x46e97a['shift']());}};_0x1c94eb(++_0x226ea3);}(_0x5c02,0x6b));var _0x25c0=function(_0x396374,_0x5c15b7){_0x396374=_0x396374-0x0;var _0x6e8a95=_0x5c02[_0x396374];return _0x6e8a95;};'use strict';var multer=require('multer');var util=require(_0x25c0('0x0'));var path=require(_0x25c0('0x1'));var timeout=require(_0x25c0('0x2'));var express=require(_0x25c0('0x3'));var router=express[_0x25c0('0x4')]();var fs_extra=require(_0x25c0('0x5'));var auth=require(_0x25c0('0x6'));var interaction=require(_0x25c0('0x7'));var config=require(_0x25c0('0x8'));var controller=require(_0x25c0('0x9'));router[_0x25c0('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x25c0('0xa')]('/describe',auth[_0x25c0('0xb')](),controller[_0x25c0('0xc')]);router[_0x25c0('0xa')]('/:id',auth[_0x25c0('0xb')](),controller[_0x25c0('0xd')]);router['get'](_0x25c0('0xe'),auth[_0x25c0('0xb')](),controller[_0x25c0('0xf')]);router[_0x25c0('0xa')](_0x25c0('0x10'),auth[_0x25c0('0xb')](),controller[_0x25c0('0x11')]);router['post']('/',auth[_0x25c0('0xb')](),controller[_0x25c0('0x12')]);router[_0x25c0('0x13')](_0x25c0('0x14'),auth[_0x25c0('0xb')](),controller[_0x25c0('0x15')]);router['post'](_0x25c0('0xe'),auth['isAuthenticated'](),controller['addSections']);router[_0x25c0('0x13')](_0x25c0('0x10'),auth[_0x25c0('0xb')](),controller[_0x25c0('0x16')]);router['put'](_0x25c0('0x17'),auth[_0x25c0('0xb')](),controller['update']);router[_0x25c0('0x18')](_0x25c0('0x17'),auth['isAuthenticated'](),controller['destroy']);router[_0x25c0('0x18')](_0x25c0('0xe'),auth['isAuthenticated'](),controller['removeSections']);router[_0x25c0('0x18')](_0x25c0('0x10'),auth['isAuthenticated'](),controller[_0x25c0('0x19')]);module[_0x25c0('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index ddedfdc..81bd68b 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 _0xae75=['STRING','name','join','getDataValue','crudPermissions','BOOLEAN','sequelize','exports'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0xae75,0x9e));var _0x5ae7=function(_0x55a4b3,_0x176231){_0x55a4b3=_0x55a4b3-0x0;var _0xd04570=_0xae75[_0x55a4b3];return _0xd04570;};'use strict';var Sequelize=require(_0x5ae7('0x0'));module[_0x5ae7('0x1')]={'name':{'type':Sequelize[_0x5ae7('0x2')],'allowNull':![],'unique':_0x5ae7('0x3')},'crudPermissions':{'type':Sequelize[_0x5ae7('0x2')],'set':function(_0x4f67d7){this['setDataValue']('crudPermissions',_0x4f67d7?_0x4f67d7[_0x5ae7('0x4')](''):[]);},'get':function(){return this[_0x5ae7('0x5')](_0x5ae7('0x6'))?this[_0x5ae7('0x5')](_0x5ae7('0x6'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x5ae7('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x5ae7('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x5ae7('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x5ae7('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x5ae7('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x5ae7('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5ae7('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x27bf=['setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x3f4304,_0x6bb62f){var _0x56aa0d=function(_0x35e9ec){while(--_0x35e9ec){_0x3f4304['push'](_0x3f4304['shift']());}};_0x56aa0d(++_0x6bb62f);}(_0x27bf,0x150));var _0xf27b=function(_0x44b317,_0x588637){_0x44b317=_0x44b317-0x0;var _0x47d8ce=_0x27bf[_0x44b317];return _0x47d8ce;};'use strict';var Sequelize=require(_0xf27b('0x0'));module[_0xf27b('0x1')]={'name':{'type':Sequelize[_0xf27b('0x2')],'allowNull':![],'unique':_0xf27b('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x5532fe){this[_0xf27b('0x4')](_0xf27b('0x5'),_0x5532fe?_0x5532fe[_0xf27b('0x6')](''):[]);},'get':function(){return this[_0xf27b('0x7')](_0xf27b('0x5'))?this[_0xf27b('0x7')](_0xf27b('0x5'))[_0xf27b('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xf27b('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xf27b('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xf27b('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xf27b('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xf27b('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf27b('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xf27b('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 367b851..713dd2f 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 _0xf6e3=['order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','fields','length','create','clone','params','include','get','omit','createdAt','updatedAt','crudPermissions','body','transaction','UserProfileSection','findAll','autoAssociation','UserProfileResource','sectionId','Resources','find','describe','addSections','sequelize','userProfileId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','concat','findOne','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','redis','localhost','./userProfile.socket','register','json','offset','undefined','limit','count','status','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit'];(function(_0x1e0144,_0x1528e3){var _0x172a14=function(_0x3ab22e){while(--_0x3ab22e){_0x1e0144['push'](_0x1e0144['shift']());}};_0x172a14(++_0x1528e3);}(_0xf6e3,0x116));var _0x3f6e=function(_0x52ddda,_0x57fce0){_0x52ddda=_0x52ddda-0x0;var _0x3a3461=_0xf6e3[_0x52ddda];return _0x3a3461;};'use strict';var emlformat=require(_0x3f6e('0x0'));var rimraf=require(_0x3f6e('0x1'));var zipdir=require(_0x3f6e('0x2'));var jsonpatch=require(_0x3f6e('0x3'));var rp=require(_0x3f6e('0x4'));var moment=require('moment');var BPromise=require(_0x3f6e('0x5'));var Mustache=require('mustache');var util=require(_0x3f6e('0x6'));var path=require(_0x3f6e('0x7'));var sox=require('sox');var csv=require(_0x3f6e('0x8'));var ejs=require(_0x3f6e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f6e('0xa'));var squel=require(_0x3f6e('0xb'));var crypto=require(_0x3f6e('0xc'));var jsforce=require(_0x3f6e('0xd'));var deskjs=require(_0x3f6e('0xe'));var toCsv=require(_0x3f6e('0x8'));var querystring=require(_0x3f6e('0xf'));var Papa=require(_0x3f6e('0x10'));var Redis=require(_0x3f6e('0x11'));var authService=require(_0x3f6e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3f6e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f6e('0x14'))(_0x3f6e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3f6e('0x16'));var db=require('../../mysqldb')['db'];config[_0x3f6e('0x17')]=_['defaults'](config[_0x3f6e('0x17')],{'host':_0x3f6e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3f6e('0x19'))[_0x3f6e('0x1a')](socket);function respondWithStatusCode(_0x2c9be5,_0x59220f){_0x59220f=_0x59220f||0xcc;return function(_0x34c158){if(_0x34c158){return _0x2c9be5['sendStatus'](_0x59220f);}return _0x2c9be5['status'](_0x59220f)['end']();};}function respondWithResult(_0x34e908,_0x48a241){_0x48a241=_0x48a241||0xc8;return function(_0xf2f314){if(_0xf2f314){return _0x34e908['status'](_0x48a241)[_0x3f6e('0x1b')](_0xf2f314);}};}function respondWithFilteredResult(_0x482692,_0x457179){return function(_0x5900ad){if(_0x5900ad){var _0x16853a=typeof _0x457179[_0x3f6e('0x1c')]===_0x3f6e('0x1d')&&typeof _0x457179[_0x3f6e('0x1e')]===_0x3f6e('0x1d');var _0x133841=_0x5900ad[_0x3f6e('0x1f')];var _0x5db0f5=_0x16853a?0x0:_0x457179['offset'];var _0x29338a=_0x16853a?_0x5900ad[_0x3f6e('0x1f')]:_0x457179['offset']+_0x457179[_0x3f6e('0x1e')];var _0x5cb12c;if(_0x29338a>=_0x133841){_0x29338a=_0x133841;_0x5cb12c=0xc8;}else{_0x5cb12c=0xce;}_0x482692[_0x3f6e('0x20')](_0x5cb12c);return _0x482692['set']('Content-Range',_0x5db0f5+'-'+_0x29338a+'/'+_0x133841)['json'](_0x5900ad);}return null;};}function patchUpdates(_0x16c797){return function(_0x420952){try{jsonpatch[_0x3f6e('0x21')](_0x420952,_0x16c797,!![]);}catch(_0x417b95){return BPromise[_0x3f6e('0x22')](_0x417b95);}return _0x420952[_0x3f6e('0x23')]();};}function saveUpdates(_0x67fa60,_0x9a1201){return function(_0x4b3bca){if(_0x4b3bca){return _0x4b3bca[_0x3f6e('0x24')](_0x67fa60)[_0x3f6e('0x25')](function(_0x235d46){return _0x235d46;});}return null;};}function removeEntity(_0x39ee2f,_0x3d9136){return function(_0x3c9850){if(_0x3c9850){return _0x3c9850[_0x3f6e('0x26')]()[_0x3f6e('0x25')](function(){_0x39ee2f[_0x3f6e('0x20')](0xcc)[_0x3f6e('0x27')]();});}};}function handleEntityNotFound(_0x185aac,_0x4d117f){return function(_0x3c6f73){if(!_0x3c6f73){_0x185aac[_0x3f6e('0x28')](0x194);}return _0x3c6f73;};}function handleError(_0x295136,_0x2a1425){_0x2a1425=_0x2a1425||0x1f4;return function(_0x4101a4){logger['error'](_0x4101a4[_0x3f6e('0x29')]);if(_0x4101a4['name']){delete _0x4101a4[_0x3f6e('0x2a')];}_0x295136[_0x3f6e('0x20')](_0x2a1425)[_0x3f6e('0x2b')](_0x4101a4);};}exports['index']=function(_0x4ac223,_0x24e95e){var _0x24434c={},_0x3f63e1={},_0x3407ae={'count':0x0,'rows':[]};var _0x342d1c=_[_0x3f6e('0x2c')](db[_0x3f6e('0x2d')][_0x3f6e('0x2e')],function(_0x35774e){return{'name':_0x35774e[_0x3f6e('0x2f')],'type':_0x35774e[_0x3f6e('0x30')][_0x3f6e('0x31')]};});_0x3f63e1[_0x3f6e('0x32')]=_[_0x3f6e('0x2c')](_0x342d1c,_0x3f6e('0x2a'));_0x3f63e1[_0x3f6e('0x33')]=_[_0x3f6e('0x34')](_0x4ac223[_0x3f6e('0x33')]);_0x3f63e1[_0x3f6e('0x35')]=_[_0x3f6e('0x36')](_0x3f63e1[_0x3f6e('0x32')],_0x3f63e1[_0x3f6e('0x33')]);_0x24434c[_0x3f6e('0x37')]=_[_0x3f6e('0x36')](_0x3f63e1[_0x3f6e('0x32')],qs['fields'](_0x4ac223[_0x3f6e('0x33')]['fields']));_0x24434c[_0x3f6e('0x37')]=_0x24434c[_0x3f6e('0x37')]['length']?_0x24434c['attributes']:_0x3f63e1[_0x3f6e('0x32')];if(!_0x4ac223[_0x3f6e('0x33')][_0x3f6e('0x38')](_0x3f6e('0x39'))){_0x24434c[_0x3f6e('0x1e')]=qs[_0x3f6e('0x1e')](_0x4ac223['query'][_0x3f6e('0x1e')]);_0x24434c['offset']=qs['offset'](_0x4ac223[_0x3f6e('0x33')][_0x3f6e('0x1c')]);}_0x24434c[_0x3f6e('0x3a')]=qs[_0x3f6e('0x3b')](_0x4ac223[_0x3f6e('0x33')][_0x3f6e('0x3b')]);_0x24434c[_0x3f6e('0x3c')]=qs[_0x3f6e('0x35')](_['pick'](_0x4ac223[_0x3f6e('0x33')],_0x3f63e1[_0x3f6e('0x35')]),_0x342d1c);if(_0x4ac223[_0x3f6e('0x33')][_0x3f6e('0x3d')]){_0x24434c['where']=_[_0x3f6e('0x3e')](_0x24434c[_0x3f6e('0x3c')],{'$or':_[_0x3f6e('0x2c')](_0x342d1c,function(_0x4c0bb8){if(_0x4c0bb8[_0x3f6e('0x30')]!==_0x3f6e('0x3f')){var _0x3752a1={};_0x3752a1[_0x4c0bb8[_0x3f6e('0x2a')]]={'$like':'%'+_0x4ac223[_0x3f6e('0x33')][_0x3f6e('0x3d')]+'%'};return _0x3752a1;}})});}_0x24434c=_[_0x3f6e('0x3e')]({},_0x24434c,_0x4ac223[_0x3f6e('0x40')]);var _0x1556a5={'where':_0x24434c[_0x3f6e('0x3c')]};return db[_0x3f6e('0x2d')][_0x3f6e('0x1f')](_0x1556a5)[_0x3f6e('0x25')](function(_0x35ca26){_0x3407ae[_0x3f6e('0x1f')]=_0x35ca26;if(_0x4ac223[_0x3f6e('0x33')][_0x3f6e('0x41')]){_0x24434c['include']=[{'all':!![]}];}return db[_0x3f6e('0x2d')]['findAll'](_0x24434c);})[_0x3f6e('0x25')](function(_0xc3d4f0){_0x3407ae[_0x3f6e('0x42')]=_0xc3d4f0;return _0x3407ae;})[_0x3f6e('0x25')](respondWithFilteredResult(_0x24e95e,_0x24434c))[_0x3f6e('0x43')](handleError(_0x24e95e,null));};exports[_0x3f6e('0x44')]=function(_0xb1271a,_0x337d6f){var _0x1b844b={'raw':![],'where':{'id':_0xb1271a['params']['id']}},_0x2fd716={};_0x2fd716['model']=_['keys'](db[_0x3f6e('0x2d')][_0x3f6e('0x2e')]);_0x2fd716[_0x3f6e('0x33')]=_[_0x3f6e('0x34')](_0xb1271a[_0x3f6e('0x33')]);_0x2fd716[_0x3f6e('0x35')]=_[_0x3f6e('0x36')](_0x2fd716[_0x3f6e('0x32')],_0x2fd716[_0x3f6e('0x33')]);_0x1b844b[_0x3f6e('0x37')]=_[_0x3f6e('0x36')](_0x2fd716['model'],qs['fields'](_0xb1271a[_0x3f6e('0x33')][_0x3f6e('0x45')]));_0x1b844b['attributes']=_0x1b844b[_0x3f6e('0x37')][_0x3f6e('0x46')]?_0x1b844b['attributes']:_0x2fd716[_0x3f6e('0x32')];if(_0xb1271a[_0x3f6e('0x33')][_0x3f6e('0x41')]){_0x1b844b['include']=[{'all':!![]}];}_0x1b844b=_[_0x3f6e('0x3e')]({},_0x1b844b,_0xb1271a[_0x3f6e('0x40')]);return db['UserProfile']['find'](_0x1b844b)[_0x3f6e('0x25')](handleEntityNotFound(_0x337d6f,null))[_0x3f6e('0x25')](respondWithResult(_0x337d6f,null))['catch'](handleError(_0x337d6f,null));};exports[_0x3f6e('0x47')]=function(_0x2428eb,_0x27275e){return db[_0x3f6e('0x2d')][_0x3f6e('0x47')](_0x2428eb['body'],{})[_0x3f6e('0x25')](respondWithResult(_0x27275e,0xc9))[_0x3f6e('0x43')](handleError(_0x27275e,null));};exports[_0x3f6e('0x48')]=function(_0x5ee7dd,_0x4b248e){var _0x55089e={'where':{'id':_0x5ee7dd[_0x3f6e('0x49')]['id']}},_0x47e1db={};_0x47e1db[_0x3f6e('0x32')]=_[_0x3f6e('0x34')](db[_0x3f6e('0x2d')][_0x3f6e('0x2e')]);_0x55089e[_0x3f6e('0x37')]=_[_0x3f6e('0x36')](_0x47e1db[_0x3f6e('0x32')],qs[_0x3f6e('0x45')](_0x5ee7dd[_0x3f6e('0x33')][_0x3f6e('0x45')]));_0x55089e['attributes']=_0x55089e[_0x3f6e('0x37')][_0x3f6e('0x46')]?_0x55089e['attributes']:_0x47e1db[_0x3f6e('0x32')];if(_0x5ee7dd[_0x3f6e('0x33')][_0x3f6e('0x41')]){_0x55089e[_0x3f6e('0x4a')]=[{'all':!![]}];}_0x55089e=_['merge']({},_0x55089e,_0x5ee7dd[_0x3f6e('0x40')]);return db[_0x3f6e('0x2d')]['find'](_0x55089e)[_0x3f6e('0x25')](handleEntityNotFound(_0x4b248e,null))[_0x3f6e('0x25')](function(_0x269f33){if(_0x269f33){var _0x3a4fce=_0x269f33[_0x3f6e('0x4b')]({'plain':!![]});_0x3a4fce=qs[_0x3f6e('0x4c')](_0x3a4fce,['id',_0x3f6e('0x4d'),_0x3f6e('0x4e'),_0x3f6e('0x4f')]);_0x5ee7dd[_0x3f6e('0x50')]=_['omit'](_0x5ee7dd[_0x3f6e('0x50')],['id',_0x3f6e('0x4d'),_0x3f6e('0x4e')]);return db['sequelize'][_0x3f6e('0x51')](function(_0x554ea0){return db[_0x3f6e('0x2d')][_0x3f6e('0x47')](_[_0x3f6e('0x3e')](_0x3a4fce,_0x5ee7dd[_0x3f6e('0x50')]),{'include':_0x5ee7dd[_0x3f6e('0x33')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x554ea0})[_0x3f6e('0x25')](function(_0x9f47c3){var _0x49c0a0=_0x9f47c3[_0x3f6e('0x4b')]({'plain':!![]});return db[_0x3f6e('0x52')][_0x3f6e('0x53')]({'where':{'userProfileId':_0x5ee7dd['params']['id']},'raw':!![]})[_0x3f6e('0x25')](function(_0x3b5e0c){if(_0x3b5e0c){return BPromise['each'](_0x3b5e0c,function(_0x3cda57){return new BPromise(function(_0x4744b0,_0x4e44c8){if(_0x3cda57[_0x3f6e('0x54')]===null||_0x3cda57['autoAssociation']===0x1)_0x4744b0(null);return db[_0x3f6e('0x55')][_0x3f6e('0x53')]({'where':{'sectionId':_0x3cda57['id']},'raw':!![]})[_0x3f6e('0x25')](function(_0x1381fd){var _0x54b3c1=_[_0x3f6e('0x2c')](_0x1381fd,function(_0x26c5ee){return qs[_0x3f6e('0x4c')](_0x26c5ee,['id',_0x3f6e('0x4d'),_0x3f6e('0x4e'),_0x3f6e('0x56')]);});_0x4744b0(_0x54b3c1);})[_0x3f6e('0x43')](function(_0x490c20){_0x4e44c8(_0x490c20);});})[_0x3f6e('0x25')](function(_0x217d0f){var _0x1b5805=qs[_0x3f6e('0x4c')](_0x3cda57,['id','createdAt','updatedAt']);_0x1b5805['userProfileId']=_0x49c0a0['id'];if(_0x217d0f)_0x1b5805[_0x3f6e('0x57')]=_0x217d0f;return _0x1b5805;})['then'](function(_0x7fc71b){return db[_0x3f6e('0x52')][_0x3f6e('0x47')](_0x7fc71b,{'include':[{'model':db[_0x3f6e('0x55')],'as':_0x3f6e('0x57')}],'raw':!![],'transaction':_0x554ea0});});})[_0x3f6e('0x25')](function(){return _0x49c0a0;});}});});});}})[_0x3f6e('0x25')](respondWithResult(_0x4b248e,0xc9))['catch'](handleError(_0x4b248e,null));};exports[_0x3f6e('0x24')]=function(_0x406527,_0x154a81){if(_0x406527[_0x3f6e('0x50')]['id']){delete _0x406527[_0x3f6e('0x50')]['id'];}return db['UserProfile'][_0x3f6e('0x58')]({'where':{'id':_0x406527[_0x3f6e('0x49')]['id']}})[_0x3f6e('0x25')](handleEntityNotFound(_0x154a81,null))[_0x3f6e('0x25')](saveUpdates(_0x406527[_0x3f6e('0x50')],null))[_0x3f6e('0x25')](respondWithResult(_0x154a81,null))[_0x3f6e('0x43')](handleError(_0x154a81,null));};exports[_0x3f6e('0x26')]=function(_0x5c208a,_0x160947){return db[_0x3f6e('0x2d')][_0x3f6e('0x58')]({'where':{'id':_0x5c208a[_0x3f6e('0x49')]['id']}})[_0x3f6e('0x25')](handleEntityNotFound(_0x160947,null))[_0x3f6e('0x25')](removeEntity(_0x160947,null))['catch'](handleError(_0x160947,null));};exports['describe']=function(_0x32d896,_0xf667c1){return db[_0x3f6e('0x2d')][_0x3f6e('0x59')]()[_0x3f6e('0x25')](respondWithResult(_0xf667c1,null))[_0x3f6e('0x43')](handleError(_0xf667c1,null));};exports[_0x3f6e('0x5a')]=function(_0x59fc1f,_0x25f28a){var _0x809926=_0x59fc1f[_0x3f6e('0x50')];return db[_0x3f6e('0x2d')][_0x3f6e('0x58')]({'where':{'id':_0x59fc1f['params']['id']}})[_0x3f6e('0x25')](handleEntityNotFound(_0x25f28a,null))[_0x3f6e('0x25')](function(_0x58293f){if(_0x58293f){return db[_0x3f6e('0x5b')][_0x3f6e('0x51')](function(_0x2e6bfb){return db[_0x3f6e('0x52')][_0x3f6e('0x26')]({'where':{'userProfileId':_0x59fc1f['params']['id'],'sectionId':_['map'](_0x809926,function(_0x48141a){return _0x48141a[_0x3f6e('0x56')];})},'transaction':_0x2e6bfb})[_0x3f6e('0x25')](function(){var _0x360528=_[_0x3f6e('0x2c')](_0x809926,function(_0x210a44){_0x210a44[_0x3f6e('0x5c')]=_0x59fc1f['params']['id'];return _0x210a44;});var _0x43a082=[];return BPromise['each'](_0x360528,function(_0x45250b){return db[_0x3f6e('0x52')][_0x3f6e('0x47')](_0x45250b,{'include':[{'model':db[_0x3f6e('0x55')],'as':'Resources'}],'raw':!![],'transaction':_0x2e6bfb})[_0x3f6e('0x25')](function(_0x488f84){_0x43a082[_0x3f6e('0x5d')](_0x488f84['get']({'plain':!![]}));});})['then'](function(){return _0x43a082;});});});}})[_0x3f6e('0x25')](function(_0x3fdbae){return _0x3fdbae;})['then'](respondWithResult(_0x25f28a,null))[_0x3f6e('0x43')](handleError(_0x25f28a,null));};exports[_0x3f6e('0x5e')]=function(_0xc3d792,_0x40c84d){var _0x2e63bc;return db[_0x3f6e('0x2d')][_0x3f6e('0x58')]({'where':{'id':_0xc3d792[_0x3f6e('0x49')]['id']},'attributes':['id',_0x3f6e('0x2a')]})[_0x3f6e('0x25')](handleEntityNotFound(_0x40c84d,null))['then'](function(_0x1f7c6e){if(_0x1f7c6e){_0x2e63bc=_0x1f7c6e;return db[_0x3f6e('0x52')][_0x3f6e('0x26')]({'where':{'userProfileId':_0xc3d792['params']['id'],'sectionId':_0xc3d792[_0x3f6e('0x33')][_0x3f6e('0x5f')]}});}})[_0x3f6e('0x25')](function(){return _0x2e63bc;})[_0x3f6e('0x25')](respondWithStatusCode(_0x40c84d,null))['catch'](handleError(_0x40c84d,null));};exports[_0x3f6e('0x60')]=function(_0x50b725,_0x2b05a4){var _0x377326=[];var _0x4bc27c=[];return db[_0x3f6e('0x52')][_0x3f6e('0x53')]({'where':{'userProfileId':_0x50b725[_0x3f6e('0x49')]['id']},'raw':!![]})[_0x3f6e('0x25')](function(_0x2b96e7){_0x377326=_[_0x3f6e('0x3d')](_0x2b96e7,function(_0x1b0bf5){return _0x1b0bf5[_0x3f6e('0x61')]===0x1||_[_0x3f6e('0x62')]([0x3eb,0x709],_0x1b0bf5[_0x3f6e('0x56')]);});if(!_[_0x3f6e('0x63')](_0x377326)){return _[_0x3f6e('0x2c')](_0x377326,function(_0x1b00da){return _0x1b00da[_0x3f6e('0x56')];});}else{return;}})[_0x3f6e('0x25')](function(_0x143f93){if(_0x143f93)_0x4bc27c=_0x143f93;if(_[_0x3f6e('0x62')](_0x4bc27c,0x64)){var _0x57c09f=_['find'](_0x377326,{'sectionId':0x64});return hasDefaultDashboard(_0x57c09f)[_0x3f6e('0x25')](function(_0x1a2088){return _[_0x3f6e('0x2c')](_0x377326,function(_0x4142e0){if(_0x4142e0[_0x3f6e('0x56')]===0x64){_0x4142e0['subsections']=_0x1a2088;}return _0x4142e0;});});}else{return;}})[_0x3f6e('0x25')](function(_0x4c7faf){if(_0x4c7faf)_0x377326=_0x4c7faf;if(_[_0x3f6e('0x62')](_0x4bc27c,0x3eb)){var _0x306555=_['find'](_0x377326,{'sectionId':0x3eb});return getCustomDashboards(_0x306555)[_0x3f6e('0x25')](function(_0x285b27){return _[_0x3f6e('0x2c')](_0x377326,function(_0x3674db){if(_0x306555[_0x3f6e('0x61')]){if(_0x3674db[_0x3f6e('0x56')]===0x3eb){_0x3674db[_0x3f6e('0x64')]=_0x285b27;}}else{if(_0x3674db['sectionId']===0x64){if(!_0x3674db[_0x3f6e('0x64')]){_0x3674db[_0x3f6e('0x64')]=[];}_0x3674db['subsections']=_0x3674db[_0x3f6e('0x64')][_0x3f6e('0x65')](_0x285b27);}}return _0x3674db;});});}else{return;}})[_0x3f6e('0x25')](function(_0x4e499b){if(_0x4e499b)_0x377326=_0x4e499b;if(_['includes'](_0x4bc27c,0x709)){var _0x48ee2e=_[_0x3f6e('0x58')](_0x377326,{'sectionId':0x709});return getPlugins(_0x48ee2e)[_0x3f6e('0x25')](function(_0xa62ab8){if(_0x48ee2e[_0x3f6e('0x61')]){return _['map'](_0x377326,function(_0x4e52aa){if(_0x4e52aa['sectionId']===0x709){_0x4e52aa[_0x3f6e('0x64')]=_0xa62ab8;}return _0x4e52aa;});}else{var _0x56bef5={'sectionId':0x76c,'enabled':0x1,'subsections':_0xa62ab8};var _0x318f2d=_['map'](_0x377326);_0x318f2d['push'](_0x56bef5);return _0x318f2d;}});}else{return;}})[_0x3f6e('0x25')](function(_0x361325){if(_0x361325)_0x377326=_0x361325;return _[_0x3f6e('0x3d')](_0x377326,['enabled',0x1]);})['then'](respondWithResult(_0x2b05a4,null))['catch'](handleError(_0x2b05a4,null));};function hasDefaultDashboard(_0xfd4dce){var _0x2116fc=[0x65];return new BPromise(function(_0x577ed0,_0x307358){try{if(_0xfd4dce[_0x3f6e('0x54')]){_0x577ed0(_0x2116fc);}else{return db['UserProfileResource'][_0x3f6e('0x66')]({'where':{'sectionId':_0xfd4dce['id']},'raw':!![]})['then'](function(_0x243699){_0x243699?_0x577ed0(_0x2116fc):_0x577ed0();});}}catch(_0x2ee509){_0x307358(_0x2ee509);}});}function getCustomDashboards(_0x1f4994){var _0x385e95=[];return new BPromise(function(_0x406df0,_0x38da90){try{if(_0x1f4994[_0x3f6e('0x54')]){return db['Dashboard'][_0x3f6e('0x53')]({'raw':!![]})[_0x3f6e('0x25')](function(_0x43273f){_0x43273f[_0x3f6e('0x67')](function(_0x521325){_0x385e95[_0x3f6e('0x5d')](_0x521325['id']+0x1869f);});_0x406df0(_0x385e95);});}else{return db[_0x3f6e('0x55')][_0x3f6e('0x53')]({'where':{'sectionId':_0x1f4994['id']},'raw':!![]})[_0x3f6e('0x25')](function(_0x4c608d){_0x4c608d[_0x3f6e('0x67')](function(_0x24fc5c){_0x385e95['push'](_0x24fc5c[_0x3f6e('0x68')]+0x1869f);});_0x406df0(_0x385e95);});}}catch(_0x4ce4b0){_0x38da90(_0x4ce4b0);}});}function getPlugins(_0x4d44eb){var _0xaf0678=[];return new BPromise(function(_0x5961b6,_0x183f8f){try{if(_0x4d44eb[_0x3f6e('0x54')]){return db['Plugin'][_0x3f6e('0x53')]({'raw':!![]})[_0x3f6e('0x25')](function(_0x3b873b){_0x3b873b[_0x3f6e('0x67')](function(_0x23d078){_0xaf0678[_0x3f6e('0x5d')](_0x23d078['id']+0x15b38);});_0x5961b6(_0xaf0678);});}else{return db[_0x3f6e('0x55')][_0x3f6e('0x53')]({'where':{'sectionId':_0x4d44eb['id']},'raw':!![]})['then'](function(_0x50e114){_0x50e114[_0x3f6e('0x67')](function(_0x3eb18a){_0xaf0678[_0x3f6e('0x5d')](_0x3eb18a[_0x3f6e('0x68')]+0x15b38);});_0x5961b6(_0xaf0678);});}}catch(_0x3abfae){_0x183f8f(_0x3abfae);}});}exports[_0x3f6e('0x69')]=function(_0xbd8bac,_0x39b7b6){return db[_0x3f6e('0x2d')]['find']({'where':{'id':_0xbd8bac[_0x3f6e('0x49')]['id']}})[_0x3f6e('0x25')](handleEntityNotFound(_0x39b7b6,null))[_0x3f6e('0x25')](function(_0x3def2a){if(_0x3def2a){return db[_0x3f6e('0x5b')][_0x3f6e('0x51')](function(_0xf82cb9){return db[_0x3f6e('0x52')]['findAll']({'where':{'userProfileId':_0xbd8bac[_0x3f6e('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x3f6e('0x25')](function(_0x5c1ccb){if(_0x5c1ccb){return db['UserProfileSection'][_0x3f6e('0x26')]({'where':{'userProfileId':_0xbd8bac[_0x3f6e('0x49')]['id'],'id':_[_0x3f6e('0x2c')](_0x5c1ccb,function(_0x1545e0){return _0x1545e0['id'];})},'transaction':_0xf82cb9});}})[_0x3f6e('0x25')](function(_0x544586){var _0x1ecfed=_['map'](_0xbd8bac[_0x3f6e('0x50')],function(_0x151d00){_0x151d00['userProfileId']=_0xbd8bac[_0x3f6e('0x49')]['id'];return _0x151d00;});return db[_0x3f6e('0x52')][_0x3f6e('0x6a')](_0x1ecfed,{'raw':!![],'transaction':_0xf82cb9});})[_0x3f6e('0x25')](function(_0x4d13b3){var _0xb2a52c=_['filter'](_[_0x3f6e('0x2c')](_0x4d13b3,function(_0x578948){return _0x578948['get']({'plain':!![]});}),{'includeAll':![]});if(_0xb2a52c){return db[_0x3f6e('0x52')]['findAll']({'where':{'userProfileId':_0xbd8bac[_0x3f6e('0x49')]['id'],'sectionId':_[_0x3f6e('0x2c')](_0xb2a52c,function(_0x257cf9){return _0x257cf9[_0x3f6e('0x56')];})},'attributes':['id',_0x3f6e('0x56')],'raw':!![]})[_0x3f6e('0x25')](function(_0x2504cb){var _0xbbfd6b=_[_0x3f6e('0x2c')](_0xbd8bac[_0x3f6e('0x50')],function(_0x37adce){_0x37adce[_0x3f6e('0x5c')]=_0xbd8bac[_0x3f6e('0x49')]['id'];return _0x37adce;});return db[_0x3f6e('0x55')]['bulkCreate'](_0xbbfd6b,{'raw':!![],'transaction':_0xf82cb9});});}})[_0x3f6e('0x43')](handleError(_0x39b7b6,null));});}})[_0x3f6e('0x25')](function(_0x32e809){var _0xef3444=_[_0x3f6e('0x2c')](_0x32e809,function(_0xc3c47e){return _0xc3c47e[_0x3f6e('0x4b')]({'plain':!![]});});})[_0x3f6e('0x25')](respondWithResult(_0x39b7b6,null))[_0x3f6e('0x43')](handleError(_0x39b7b6,null));};exports[_0x3f6e('0x6b')]=function(_0x4bd314,_0x1c9068,_0x1093a8){return db[_0x3f6e('0x2d')]['find']({'where':{'id':_0x4bd314[_0x3f6e('0x49')]['id']}})[_0x3f6e('0x25')](handleEntityNotFound(_0x1c9068,null))[_0x3f6e('0x25')](function(_0x533646){if(_0x533646){return _0x533646['removeResources'](_0x4bd314[_0x3f6e('0x33')]['ids']);}})[_0x3f6e('0x25')](respondWithStatusCode(_0x1c9068,null))[_0x3f6e('0x43')](handleError(_0x1c9068,null));};exports[_0x3f6e('0x6c')]=function(_0xc43590,_0x549dfa){var _0x4df66c={};if(!_0xc43590[_0x3f6e('0x33')][_0x3f6e('0x6d')])throw new Error(_0x3f6e('0x6e'));if(!_0xc43590[_0x3f6e('0x33')][_0x3f6e('0x38')](_0x3f6e('0x39'))){_0x4df66c[_0x3f6e('0x1e')]=qs[_0x3f6e('0x1e')](_0xc43590[_0x3f6e('0x33')]['limit']);_0x4df66c[_0x3f6e('0x1c')]=qs['offset'](_0xc43590['query'][_0x3f6e('0x1c')]);}return db['UserProfile'][_0x3f6e('0x58')]({'where':{'id':_0xc43590[_0x3f6e('0x49')]['id']}})[_0x3f6e('0x25')](function(_0x2859bb){if(!_0x2859bb)throw new Error(_0x3f6e('0x6f')+_0xc43590[_0x3f6e('0x49')]['id']);return db[_0x3f6e('0x2d')]['getResources'](_0xc43590);})[_0x3f6e('0x25')](respondWithFilteredResult(_0x549dfa,_0x4df66c))[_0x3f6e('0x43')](handleError(_0x549dfa,null));}; \ No newline at end of file +var _0xf31b=['where','pick','filter','includeAll','include','rows','catch','show','params','merge','options','find','create','clone','get','omit','createdAt','updatedAt','transaction','body','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','userProfileId','Resources','describe','sectionId','push','removeSections','ids','getSections','enabled','includes','subsections','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','No\x20User\x20Profile\x20found\x20for\x20id\x20','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort'];(function(_0x21a0c5,_0x586032){var _0x13d439=function(_0x461e24){while(--_0x461e24){_0x21a0c5['push'](_0x21a0c5['shift']());}};_0x13d439(++_0x586032);}(_0xf31b,0x9e));var _0xbf31=function(_0x52b212,_0x291f8b){_0x52b212=_0x52b212-0x0;var _0x388f41=_0xf31b[_0x52b212];return _0x388f41;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbf31('0x0'));var jsonpatch=require(_0xbf31('0x1'));var rp=require(_0xbf31('0x2'));var moment=require('moment');var BPromise=require(_0xbf31('0x3'));var Mustache=require(_0xbf31('0x4'));var util=require('util');var path=require(_0xbf31('0x5'));var sox=require(_0xbf31('0x6'));var csv=require(_0xbf31('0x7'));var ejs=require(_0xbf31('0x8'));var fs=require('fs');var fs_extra=require(_0xbf31('0x9'));var _=require(_0xbf31('0xa'));var squel=require(_0xbf31('0xb'));var crypto=require(_0xbf31('0xc'));var jsforce=require(_0xbf31('0xd'));var deskjs=require(_0xbf31('0xe'));var toCsv=require(_0xbf31('0x7'));var querystring=require(_0xbf31('0xf'));var Papa=require('papaparse');var Redis=require(_0xbf31('0x10'));var authService=require(_0xbf31('0x11'));var qs=require(_0xbf31('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf31('0x13'));var logger=require(_0xbf31('0x14'))(_0xbf31('0x15'));var utils=require(_0xbf31('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbf31('0x17'));var db=require('../../mysqldb')['db'];config[_0xbf31('0x18')]=_[_0xbf31('0x19')](config[_0xbf31('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xbf31('0x1a'))(new Redis(config['redis']));require(_0xbf31('0x1b'))[_0xbf31('0x1c')](socket);function respondWithStatusCode(_0x55c851,_0x56e08d){_0x56e08d=_0x56e08d||0xcc;return function(_0x2a3dd7){if(_0x2a3dd7){return _0x55c851[_0xbf31('0x1d')](_0x56e08d);}return _0x55c851[_0xbf31('0x1e')](_0x56e08d)[_0xbf31('0x1f')]();};}function respondWithResult(_0x3d52d5,_0x195561){_0x195561=_0x195561||0xc8;return function(_0x742ebe){if(_0x742ebe){return _0x3d52d5[_0xbf31('0x1e')](_0x195561)[_0xbf31('0x20')](_0x742ebe);}};}function respondWithFilteredResult(_0xab5983,_0xb57468){return function(_0x571979){if(_0x571979){var _0x2a7160=typeof _0xb57468['offset']===_0xbf31('0x21')&&typeof _0xb57468[_0xbf31('0x22')]==='undefined';var _0x1b100c=_0x571979[_0xbf31('0x23')];var _0x1dcb9e=_0x2a7160?0x0:_0xb57468[_0xbf31('0x24')];var _0x482c7d=_0x2a7160?_0x571979['count']:_0xb57468['offset']+_0xb57468[_0xbf31('0x22')];var _0x31e5d;if(_0x482c7d>=_0x1b100c){_0x482c7d=_0x1b100c;_0x31e5d=0xc8;}else{_0x31e5d=0xce;}_0xab5983['status'](_0x31e5d);return _0xab5983[_0xbf31('0x25')](_0xbf31('0x26'),_0x1dcb9e+'-'+_0x482c7d+'/'+_0x1b100c)['json'](_0x571979);}return null;};}function patchUpdates(_0x22491c){return function(_0x231ac6){try{jsonpatch[_0xbf31('0x27')](_0x231ac6,_0x22491c,!![]);}catch(_0x569864){return BPromise[_0xbf31('0x28')](_0x569864);}return _0x231ac6[_0xbf31('0x29')]();};}function saveUpdates(_0x427876,_0x5c30b3){return function(_0x195c09){if(_0x195c09){return _0x195c09[_0xbf31('0x2a')](_0x427876)[_0xbf31('0x2b')](function(_0x114c9d){return _0x114c9d;});}return null;};}function removeEntity(_0x273603,_0x30bb53){return function(_0x37214){if(_0x37214){return _0x37214[_0xbf31('0x2c')]()[_0xbf31('0x2b')](function(){_0x273603[_0xbf31('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25f8ac,_0x5ae5c8){return function(_0xa1d0f8){if(!_0xa1d0f8){_0x25f8ac['sendStatus'](0x194);}return _0xa1d0f8;};}function handleError(_0x4a6184,_0x4c431f){_0x4c431f=_0x4c431f||0x1f4;return function(_0x1a7fdc){logger[_0xbf31('0x2d')](_0x1a7fdc[_0xbf31('0x2e')]);if(_0x1a7fdc[_0xbf31('0x2f')]){delete _0x1a7fdc[_0xbf31('0x2f')];}_0x4a6184['status'](_0x4c431f)[_0xbf31('0x30')](_0x1a7fdc);};}exports[_0xbf31('0x31')]=function(_0x2f6eb4,_0x11b535){var _0x1ccfee={},_0x481bb7={},_0x769fa0={'count':0x0,'rows':[]};var _0x10e7dc=_[_0xbf31('0x32')](db[_0xbf31('0x33')][_0xbf31('0x34')],function(_0x5350e6){return{'name':_0x5350e6['fieldName'],'type':_0x5350e6[_0xbf31('0x35')]['key']};});_0x481bb7['model']=_[_0xbf31('0x32')](_0x10e7dc,'name');_0x481bb7[_0xbf31('0x36')]=_[_0xbf31('0x37')](_0x2f6eb4['query']);_0x481bb7[_0xbf31('0x38')]=_[_0xbf31('0x39')](_0x481bb7[_0xbf31('0x3a')],_0x481bb7[_0xbf31('0x36')]);_0x1ccfee[_0xbf31('0x3b')]=_['intersection'](_0x481bb7[_0xbf31('0x3a')],qs['fields'](_0x2f6eb4['query'][_0xbf31('0x3c')]));_0x1ccfee[_0xbf31('0x3b')]=_0x1ccfee['attributes'][_0xbf31('0x3d')]?_0x1ccfee[_0xbf31('0x3b')]:_0x481bb7[_0xbf31('0x3a')];if(!_0x2f6eb4['query']['hasOwnProperty'](_0xbf31('0x3e'))){_0x1ccfee['limit']=qs[_0xbf31('0x22')](_0x2f6eb4['query'][_0xbf31('0x22')]);_0x1ccfee[_0xbf31('0x24')]=qs[_0xbf31('0x24')](_0x2f6eb4[_0xbf31('0x36')]['offset']);}_0x1ccfee['order']=qs[_0xbf31('0x3f')](_0x2f6eb4[_0xbf31('0x36')][_0xbf31('0x3f')]);_0x1ccfee[_0xbf31('0x40')]=qs[_0xbf31('0x38')](_[_0xbf31('0x41')](_0x2f6eb4['query'],_0x481bb7[_0xbf31('0x38')]),_0x10e7dc);if(_0x2f6eb4['query'][_0xbf31('0x42')]){_0x1ccfee[_0xbf31('0x40')]=_['merge'](_0x1ccfee[_0xbf31('0x40')],{'$or':_[_0xbf31('0x32')](_0x10e7dc,function(_0x5bd4f9){if(_0x5bd4f9[_0xbf31('0x35')]!=='VIRTUAL'){var _0x43c52a={};_0x43c52a[_0x5bd4f9[_0xbf31('0x2f')]]={'$like':'%'+_0x2f6eb4[_0xbf31('0x36')][_0xbf31('0x42')]+'%'};return _0x43c52a;}})});}_0x1ccfee=_['merge']({},_0x1ccfee,_0x2f6eb4['options']);var _0xd23438={'where':_0x1ccfee[_0xbf31('0x40')]};return db[_0xbf31('0x33')][_0xbf31('0x23')](_0xd23438)[_0xbf31('0x2b')](function(_0x26be4f){_0x769fa0['count']=_0x26be4f;if(_0x2f6eb4[_0xbf31('0x36')][_0xbf31('0x43')]){_0x1ccfee[_0xbf31('0x44')]=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x1ccfee);})['then'](function(_0x338c57){_0x769fa0[_0xbf31('0x45')]=_0x338c57;return _0x769fa0;})[_0xbf31('0x2b')](respondWithFilteredResult(_0x11b535,_0x1ccfee))[_0xbf31('0x46')](handleError(_0x11b535,null));};exports[_0xbf31('0x47')]=function(_0x21a953,_0x3fa9fa){var _0x376cd0={'raw':![],'where':{'id':_0x21a953[_0xbf31('0x48')]['id']}},_0x4888de={};_0x4888de['model']=_[_0xbf31('0x37')](db[_0xbf31('0x33')][_0xbf31('0x34')]);_0x4888de[_0xbf31('0x36')]=_[_0xbf31('0x37')](_0x21a953['query']);_0x4888de['filters']=_[_0xbf31('0x39')](_0x4888de[_0xbf31('0x3a')],_0x4888de[_0xbf31('0x36')]);_0x376cd0['attributes']=_[_0xbf31('0x39')](_0x4888de[_0xbf31('0x3a')],qs[_0xbf31('0x3c')](_0x21a953[_0xbf31('0x36')]['fields']));_0x376cd0[_0xbf31('0x3b')]=_0x376cd0[_0xbf31('0x3b')][_0xbf31('0x3d')]?_0x376cd0[_0xbf31('0x3b')]:_0x4888de[_0xbf31('0x3a')];if(_0x21a953[_0xbf31('0x36')][_0xbf31('0x43')]){_0x376cd0[_0xbf31('0x44')]=[{'all':!![]}];}_0x376cd0=_[_0xbf31('0x49')]({},_0x376cd0,_0x21a953[_0xbf31('0x4a')]);return db[_0xbf31('0x33')][_0xbf31('0x4b')](_0x376cd0)[_0xbf31('0x2b')](handleEntityNotFound(_0x3fa9fa,null))[_0xbf31('0x2b')](respondWithResult(_0x3fa9fa,null))[_0xbf31('0x46')](handleError(_0x3fa9fa,null));};exports[_0xbf31('0x4c')]=function(_0x37d3d4,_0x1c59f6){return db[_0xbf31('0x33')][_0xbf31('0x4c')](_0x37d3d4['body'],{})[_0xbf31('0x2b')](respondWithResult(_0x1c59f6,0xc9))['catch'](handleError(_0x1c59f6,null));};exports[_0xbf31('0x4d')]=function(_0x4cb03f,_0x15ca47){var _0x38f8c6={'where':{'id':_0x4cb03f[_0xbf31('0x48')]['id']}},_0x5e23eb={};_0x5e23eb[_0xbf31('0x3a')]=_[_0xbf31('0x37')](db[_0xbf31('0x33')][_0xbf31('0x34')]);_0x38f8c6[_0xbf31('0x3b')]=_[_0xbf31('0x39')](_0x5e23eb[_0xbf31('0x3a')],qs[_0xbf31('0x3c')](_0x4cb03f[_0xbf31('0x36')][_0xbf31('0x3c')]));_0x38f8c6[_0xbf31('0x3b')]=_0x38f8c6[_0xbf31('0x3b')][_0xbf31('0x3d')]?_0x38f8c6['attributes']:_0x5e23eb[_0xbf31('0x3a')];if(_0x4cb03f[_0xbf31('0x36')][_0xbf31('0x43')]){_0x38f8c6[_0xbf31('0x44')]=[{'all':!![]}];}_0x38f8c6=_[_0xbf31('0x49')]({},_0x38f8c6,_0x4cb03f[_0xbf31('0x4a')]);return db[_0xbf31('0x33')][_0xbf31('0x4b')](_0x38f8c6)[_0xbf31('0x2b')](handleEntityNotFound(_0x15ca47,null))[_0xbf31('0x2b')](function(_0x4b003c){if(_0x4b003c){var _0x3cf14c=_0x4b003c[_0xbf31('0x4e')]({'plain':!![]});_0x3cf14c=qs[_0xbf31('0x4f')](_0x3cf14c,['id',_0xbf31('0x50'),_0xbf31('0x51'),'crudPermissions']);_0x4cb03f['body']=_[_0xbf31('0x4f')](_0x4cb03f['body'],['id',_0xbf31('0x50'),_0xbf31('0x51')]);return db['sequelize'][_0xbf31('0x52')](function(_0x35c808){return db[_0xbf31('0x33')][_0xbf31('0x4c')](_[_0xbf31('0x49')](_0x3cf14c,_0x4cb03f[_0xbf31('0x53')]),{'include':_0x4cb03f[_0xbf31('0x36')][_0xbf31('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x35c808})[_0xbf31('0x2b')](function(_0x1925d0){var _0x30785e=_0x1925d0[_0xbf31('0x4e')]({'plain':!![]});return db[_0xbf31('0x54')][_0xbf31('0x55')]({'where':{'userProfileId':_0x4cb03f[_0xbf31('0x48')]['id']},'raw':!![]})['then'](function(_0x4c997f){if(_0x4c997f){return BPromise[_0xbf31('0x56')](_0x4c997f,function(_0x198ccd){return new BPromise(function(_0x40b5b2,_0x3bcd48){if(_0x198ccd[_0xbf31('0x57')]===null||_0x198ccd[_0xbf31('0x57')]===0x1)_0x40b5b2(null);return db[_0xbf31('0x58')][_0xbf31('0x55')]({'where':{'sectionId':_0x198ccd['id']},'raw':!![]})[_0xbf31('0x2b')](function(_0x34e799){var _0x5d8288=_[_0xbf31('0x32')](_0x34e799,function(_0x20f9c2){return qs['omit'](_0x20f9c2,['id','createdAt','updatedAt','sectionId']);});_0x40b5b2(_0x5d8288);})[_0xbf31('0x46')](function(_0x3d0ce6){_0x3bcd48(_0x3d0ce6);});})['then'](function(_0x315427){var _0x3dfb0c=qs[_0xbf31('0x4f')](_0x198ccd,['id',_0xbf31('0x50'),_0xbf31('0x51')]);_0x3dfb0c[_0xbf31('0x59')]=_0x30785e['id'];if(_0x315427)_0x3dfb0c[_0xbf31('0x5a')]=_0x315427;return _0x3dfb0c;})[_0xbf31('0x2b')](function(_0x38f265){return db[_0xbf31('0x54')][_0xbf31('0x4c')](_0x38f265,{'include':[{'model':db['UserProfileResource'],'as':_0xbf31('0x5a')}],'raw':!![],'transaction':_0x35c808});});})[_0xbf31('0x2b')](function(){return _0x30785e;});}});});});}})[_0xbf31('0x2b')](respondWithResult(_0x15ca47,0xc9))[_0xbf31('0x46')](handleError(_0x15ca47,null));};exports[_0xbf31('0x2a')]=function(_0x15c736,_0x25624b){if(_0x15c736[_0xbf31('0x53')]['id']){delete _0x15c736[_0xbf31('0x53')]['id'];}return db[_0xbf31('0x33')]['find']({'where':{'id':_0x15c736[_0xbf31('0x48')]['id']}})[_0xbf31('0x2b')](handleEntityNotFound(_0x25624b,null))['then'](saveUpdates(_0x15c736['body'],null))[_0xbf31('0x2b')](respondWithResult(_0x25624b,null))['catch'](handleError(_0x25624b,null));};exports[_0xbf31('0x2c')]=function(_0x5293e7,_0x57657c){return db[_0xbf31('0x33')][_0xbf31('0x4b')]({'where':{'id':_0x5293e7['params']['id']}})['then'](handleEntityNotFound(_0x57657c,null))[_0xbf31('0x2b')](removeEntity(_0x57657c,null))[_0xbf31('0x46')](handleError(_0x57657c,null));};exports[_0xbf31('0x5b')]=function(_0x4d525a,_0x4cfa3b){return db[_0xbf31('0x33')][_0xbf31('0x5b')]()[_0xbf31('0x2b')](respondWithResult(_0x4cfa3b,null))['catch'](handleError(_0x4cfa3b,null));};exports['addSections']=function(_0x33dcc4,_0x6d8148){var _0x188674=_0x33dcc4[_0xbf31('0x53')];return db[_0xbf31('0x33')][_0xbf31('0x4b')]({'where':{'id':_0x33dcc4[_0xbf31('0x48')]['id']}})[_0xbf31('0x2b')](handleEntityNotFound(_0x6d8148,null))['then'](function(_0x1e1b89){if(_0x1e1b89){return db['sequelize'][_0xbf31('0x52')](function(_0x2464cb){return db[_0xbf31('0x54')]['destroy']({'where':{'userProfileId':_0x33dcc4[_0xbf31('0x48')]['id'],'sectionId':_[_0xbf31('0x32')](_0x188674,function(_0x212859){return _0x212859[_0xbf31('0x5c')];})},'transaction':_0x2464cb})['then'](function(){var _0x4ef8aa=_['map'](_0x188674,function(_0xf1922){_0xf1922[_0xbf31('0x59')]=_0x33dcc4[_0xbf31('0x48')]['id'];return _0xf1922;});var _0xcb69db=[];return BPromise['each'](_0x4ef8aa,function(_0x30f69){return db[_0xbf31('0x54')][_0xbf31('0x4c')](_0x30f69,{'include':[{'model':db[_0xbf31('0x58')],'as':_0xbf31('0x5a')}],'raw':!![],'transaction':_0x2464cb})[_0xbf31('0x2b')](function(_0xb1e9e4){_0xcb69db[_0xbf31('0x5d')](_0xb1e9e4['get']({'plain':!![]}));});})[_0xbf31('0x2b')](function(){return _0xcb69db;});});});}})['then'](function(_0x4a068b){return _0x4a068b;})[_0xbf31('0x2b')](respondWithResult(_0x6d8148,null))[_0xbf31('0x46')](handleError(_0x6d8148,null));};exports[_0xbf31('0x5e')]=function(_0x10569f,_0x2cdc5f){var _0x27095a;return db[_0xbf31('0x33')][_0xbf31('0x4b')]({'where':{'id':_0x10569f[_0xbf31('0x48')]['id']},'attributes':['id',_0xbf31('0x2f')]})[_0xbf31('0x2b')](handleEntityNotFound(_0x2cdc5f,null))[_0xbf31('0x2b')](function(_0x568765){if(_0x568765){_0x27095a=_0x568765;return db[_0xbf31('0x54')][_0xbf31('0x2c')]({'where':{'userProfileId':_0x10569f[_0xbf31('0x48')]['id'],'sectionId':_0x10569f[_0xbf31('0x36')][_0xbf31('0x5f')]}});}})[_0xbf31('0x2b')](function(){return _0x27095a;})[_0xbf31('0x2b')](respondWithStatusCode(_0x2cdc5f,null))[_0xbf31('0x46')](handleError(_0x2cdc5f,null));};exports[_0xbf31('0x60')]=function(_0x2e0320,_0x4f16d0){var _0x21a8b3=[];var _0x11a916=[];return db['UserProfileSection'][_0xbf31('0x55')]({'where':{'userProfileId':_0x2e0320[_0xbf31('0x48')]['id']},'raw':!![]})[_0xbf31('0x2b')](function(_0x3172a2){_0x21a8b3=_[_0xbf31('0x42')](_0x3172a2,function(_0x666ed9){return _0x666ed9[_0xbf31('0x61')]===0x1||_[_0xbf31('0x62')]([0x3eb,0x709],_0x666ed9[_0xbf31('0x5c')]);});if(!_['isEmpty'](_0x21a8b3)){return _[_0xbf31('0x32')](_0x21a8b3,function(_0x42d74d){return _0x42d74d[_0xbf31('0x5c')];});}else{return;}})[_0xbf31('0x2b')](function(_0x58ca3d){if(_0x58ca3d)_0x11a916=_0x58ca3d;if(_[_0xbf31('0x62')](_0x11a916,0x64)){var _0x50c4fd=_[_0xbf31('0x4b')](_0x21a8b3,{'sectionId':0x64});return hasDefaultDashboard(_0x50c4fd)[_0xbf31('0x2b')](function(_0x35967c){return _[_0xbf31('0x32')](_0x21a8b3,function(_0x1e549d){if(_0x1e549d['sectionId']===0x64){_0x1e549d[_0xbf31('0x63')]=_0x35967c;}return _0x1e549d;});});}else{return;}})['then'](function(_0x2e7665){if(_0x2e7665)_0x21a8b3=_0x2e7665;if(_[_0xbf31('0x62')](_0x11a916,0x3eb)){var _0x136eec=_[_0xbf31('0x4b')](_0x21a8b3,{'sectionId':0x3eb});return getCustomDashboards(_0x136eec)[_0xbf31('0x2b')](function(_0x53ffc6){return _[_0xbf31('0x32')](_0x21a8b3,function(_0x4efa69){if(_0x136eec['enabled']){if(_0x4efa69[_0xbf31('0x5c')]===0x3eb){_0x4efa69[_0xbf31('0x63')]=_0x53ffc6;}}else{if(_0x4efa69[_0xbf31('0x5c')]===0x64){if(!_0x4efa69[_0xbf31('0x63')]){_0x4efa69[_0xbf31('0x63')]=[];}_0x4efa69[_0xbf31('0x63')]=_0x4efa69[_0xbf31('0x63')][_0xbf31('0x64')](_0x53ffc6);}}return _0x4efa69;});});}else{return;}})[_0xbf31('0x2b')](function(_0x4edb7f){if(_0x4edb7f)_0x21a8b3=_0x4edb7f;if(_[_0xbf31('0x62')](_0x11a916,0x709)){var _0x3a2cf1=_[_0xbf31('0x4b')](_0x21a8b3,{'sectionId':0x709});return getPlugins(_0x3a2cf1)[_0xbf31('0x2b')](function(_0x40dc31){if(_0x3a2cf1[_0xbf31('0x61')]){return _[_0xbf31('0x32')](_0x21a8b3,function(_0x3cfd72){if(_0x3cfd72[_0xbf31('0x5c')]===0x709){_0x3cfd72['subsections']=_0x40dc31;}return _0x3cfd72;});}else{var _0x152ed5={'sectionId':0x76c,'enabled':0x1,'subsections':_0x40dc31};var _0x3be145=_[_0xbf31('0x32')](_0x21a8b3);_0x3be145['push'](_0x152ed5);return _0x3be145;}});}else{return;}})[_0xbf31('0x2b')](function(_0x36fd06){if(_0x36fd06)_0x21a8b3=_0x36fd06;return _[_0xbf31('0x42')](_0x21a8b3,[_0xbf31('0x61'),0x1]);})[_0xbf31('0x2b')](respondWithResult(_0x4f16d0,null))[_0xbf31('0x46')](handleError(_0x4f16d0,null));};function hasDefaultDashboard(_0x36fc86){var _0x42faab=[0x65];return new BPromise(function(_0x47bd41,_0x37c684){try{if(_0x36fc86[_0xbf31('0x57')]){_0x47bd41(_0x42faab);}else{return db['UserProfileResource'][_0xbf31('0x65')]({'where':{'sectionId':_0x36fc86['id']},'raw':!![]})['then'](function(_0x1bc3b9){_0x1bc3b9?_0x47bd41(_0x42faab):_0x47bd41();});}}catch(_0x2587f3){_0x37c684(_0x2587f3);}});}function getCustomDashboards(_0x3afab8){var _0x4333d7=[];return new BPromise(function(_0xc98d2b,_0x361e12){try{if(_0x3afab8[_0xbf31('0x57')]){return db[_0xbf31('0x66')][_0xbf31('0x55')]({'raw':!![]})['then'](function(_0x5c034b){_0x5c034b[_0xbf31('0x67')](function(_0x42eed0){_0x4333d7[_0xbf31('0x5d')](_0x42eed0['id']+0x1869f);});_0xc98d2b(_0x4333d7);});}else{return db['UserProfileResource'][_0xbf31('0x55')]({'where':{'sectionId':_0x3afab8['id']},'raw':!![]})['then'](function(_0x5c674d){_0x5c674d[_0xbf31('0x67')](function(_0x3220a8){_0x4333d7[_0xbf31('0x5d')](_0x3220a8[_0xbf31('0x68')]+0x1869f);});_0xc98d2b(_0x4333d7);});}}catch(_0xd5cddc){_0x361e12(_0xd5cddc);}});}function getPlugins(_0x18d618){var _0x28fe7e=[];return new BPromise(function(_0x4b7c98,_0x187fcd){try{if(_0x18d618[_0xbf31('0x57')]){return db[_0xbf31('0x69')][_0xbf31('0x55')]({'raw':!![]})[_0xbf31('0x2b')](function(_0x5f0234){_0x5f0234[_0xbf31('0x67')](function(_0x457be7){_0x28fe7e[_0xbf31('0x5d')](_0x457be7['id']+0x15b38);});_0x4b7c98(_0x28fe7e);});}else{return db[_0xbf31('0x58')][_0xbf31('0x55')]({'where':{'sectionId':_0x18d618['id']},'raw':!![]})[_0xbf31('0x2b')](function(_0x27c0a8){_0x27c0a8[_0xbf31('0x67')](function(_0x5c867b){_0x28fe7e['push'](_0x5c867b['resourceId']+0x15b38);});_0x4b7c98(_0x28fe7e);});}}catch(_0x4e0a73){_0x187fcd(_0x4e0a73);}});}exports[_0xbf31('0x6a')]=function(_0x13d7e6,_0x1a1be9){return db['UserProfile'][_0xbf31('0x4b')]({'where':{'id':_0x13d7e6['params']['id']}})[_0xbf31('0x2b')](handleEntityNotFound(_0x1a1be9,null))[_0xbf31('0x2b')](function(_0x60548){if(_0x60548){return db['sequelize'][_0xbf31('0x52')](function(_0x59ba00){return db[_0xbf31('0x54')][_0xbf31('0x55')]({'where':{'userProfileId':_0x13d7e6[_0xbf31('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0xbf31('0x2b')](function(_0x411064){if(_0x411064){return db[_0xbf31('0x54')][_0xbf31('0x2c')]({'where':{'userProfileId':_0x13d7e6[_0xbf31('0x48')]['id'],'id':_[_0xbf31('0x32')](_0x411064,function(_0x42ef38){return _0x42ef38['id'];})},'transaction':_0x59ba00});}})[_0xbf31('0x2b')](function(_0x3fbea1){var _0x191d4c=_[_0xbf31('0x32')](_0x13d7e6[_0xbf31('0x53')],function(_0xfba0d3){_0xfba0d3[_0xbf31('0x59')]=_0x13d7e6['params']['id'];return _0xfba0d3;});return db['UserProfileSection'][_0xbf31('0x6b')](_0x191d4c,{'raw':!![],'transaction':_0x59ba00});})[_0xbf31('0x2b')](function(_0x455046){var _0x4f10bd=_[_0xbf31('0x42')](_[_0xbf31('0x32')](_0x455046,function(_0xfbaa3c){return _0xfbaa3c[_0xbf31('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x4f10bd){return db[_0xbf31('0x54')][_0xbf31('0x55')]({'where':{'userProfileId':_0x13d7e6[_0xbf31('0x48')]['id'],'sectionId':_['map'](_0x4f10bd,function(_0x1fa772){return _0x1fa772[_0xbf31('0x5c')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xbf31('0x2b')](function(_0x129f6a){var _0x59203f=_['map'](_0x13d7e6[_0xbf31('0x53')],function(_0x30fcbf){_0x30fcbf[_0xbf31('0x59')]=_0x13d7e6[_0xbf31('0x48')]['id'];return _0x30fcbf;});return db[_0xbf31('0x58')][_0xbf31('0x6b')](_0x59203f,{'raw':!![],'transaction':_0x59ba00});});}})['catch'](handleError(_0x1a1be9,null));});}})[_0xbf31('0x2b')](function(_0x4f065b){var _0x50f2a3=_[_0xbf31('0x32')](_0x4f065b,function(_0x49fd7f){return _0x49fd7f[_0xbf31('0x4e')]({'plain':!![]});});})[_0xbf31('0x2b')](respondWithResult(_0x1a1be9,null))[_0xbf31('0x46')](handleError(_0x1a1be9,null));};exports[_0xbf31('0x6c')]=function(_0x201ba2,_0x42ff14,_0x489c71){return db[_0xbf31('0x33')][_0xbf31('0x4b')]({'where':{'id':_0x201ba2[_0xbf31('0x48')]['id']}})[_0xbf31('0x2b')](handleEntityNotFound(_0x42ff14,null))[_0xbf31('0x2b')](function(_0x484c4d){if(_0x484c4d){return _0x484c4d[_0xbf31('0x6c')](_0x201ba2['query'][_0xbf31('0x5f')]);}})['then'](respondWithStatusCode(_0x42ff14,null))[_0xbf31('0x46')](handleError(_0x42ff14,null));};exports[_0xbf31('0x6d')]=function(_0x2162e0,_0x38aa8f){var _0x258150={};if(!_0x2162e0['query']['section'])throw new Error('Missing\x20section\x20parameter');if(!_0x2162e0[_0xbf31('0x36')]['hasOwnProperty']('nolimit')){_0x258150[_0xbf31('0x22')]=qs[_0xbf31('0x22')](_0x2162e0[_0xbf31('0x36')][_0xbf31('0x22')]);_0x258150[_0xbf31('0x24')]=qs[_0xbf31('0x24')](_0x2162e0[_0xbf31('0x36')][_0xbf31('0x24')]);}return db[_0xbf31('0x33')]['find']({'where':{'id':_0x2162e0[_0xbf31('0x48')]['id']}})[_0xbf31('0x2b')](function(_0x421816){if(!_0x421816)throw new Error(_0xbf31('0x6e')+_0x2162e0[_0xbf31('0x48')]['id']);return db[_0xbf31('0x33')][_0xbf31('0x6d')](_0x2162e0);})[_0xbf31('0x2b')](respondWithFilteredResult(_0x38aa8f,_0x258150))[_0xbf31('0x46')](handleError(_0x38aa8f,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 9a58da7..135b1ae 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 _0x1867=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x3cffa2,_0x5bc720){var _0x1d1511=function(_0x379150){while(--_0x379150){_0x3cffa2['push'](_0x3cffa2['shift']());}};_0x1d1511(++_0x5bc720);}(_0x1867,0xb5));var _0x7186=function(_0x8b156d,_0x31f312){_0x8b156d=_0x8b156d-0x0;var _0x4c06ed=_0x1867[_0x8b156d];return _0x4c06ed;};'use strict';var EventEmitter=require(_0x7186('0x0'));var UserProfile=require(_0x7186('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7186('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7186('0x3'),'afterDestroy':_0x7186('0x4')};function emitEvent(_0xeb165d){return function(_0xc7f9f0,_0x25d50d,_0x16dcd1){UserProfileEvents[_0x7186('0x5')](_0xeb165d+':'+_0xc7f9f0['id'],_0xc7f9f0);UserProfileEvents[_0x7186('0x5')](_0xeb165d,_0xc7f9f0);_0x16dcd1(null);};}for(var e in events){if(events[_0x7186('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x7186('0x7')]=UserProfileEvents; \ No newline at end of file +var _0xdfa0=['exports','events','UserProfile','setMaxListeners','update','remove','emit','hook'];(function(_0x19d0ed,_0x5b5ccb){var _0x4218bf=function(_0xcc1ae4){while(--_0xcc1ae4){_0x19d0ed['push'](_0x19d0ed['shift']());}};_0x4218bf(++_0x5b5ccb);}(_0xdfa0,0x69));var _0x0dfa=function(_0x2a9742,_0x5957be){_0x2a9742=_0x2a9742-0x0;var _0x43545a=_0xdfa0[_0x2a9742];return _0x43545a;};'use strict';var EventEmitter=require(_0x0dfa('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x0dfa('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x0dfa('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0dfa('0x3'),'afterDestroy':_0x0dfa('0x4')};function emitEvent(_0x3691a7){return function(_0x4dbbab,_0x373c4e,_0x50b91e){UserProfileEvents[_0x0dfa('0x5')](_0x3691a7+':'+_0x4dbbab['id'],_0x4dbbab);UserProfileEvents[_0x0dfa('0x5')](_0x3691a7,_0x4dbbab);_0x50b91e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x0dfa('0x6')](e,emitEvent(event));}}module[_0x0dfa('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index c46e93f..866a0a6 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 _0xa5b8=['zohoaccounts','ZohoAccount','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','scheduler','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','user_profiles','raw','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','union','rawAttributes','model','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','sort','filters','pick','merge','key','VIRTUAL','foreignKey','forEach','include','reportType','default','DefaultReports','CustomReports','rows','ids','customSorting','extraQueryConditions','count','includeAll','Tags','color','tag','ThroughTags','openTabs','true','sms','fax','dataValues','mail','openchannel','all','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','catch','associatedResources','map','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','CmList','companies','CmCompany','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceRecording','Agents','membername','User','agent','role','VoiceQueues','queue','VoiceQueue','type','QueueCampaigns','outbound','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','SmsQueue','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','Users','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount'];(function(_0xd83f3e,_0x3c909e){var _0x3afffc=function(_0x105730){while(--_0x105730){_0xd83f3e['push'](_0xd83f3e['shift']());}};_0x3afffc(++_0x3c909e);}(_0xa5b8,0x1d7));var _0x8a5b=function(_0x3b4e19,_0x473805){_0x3b4e19=_0x3b4e19-0x0;var _0x6edea1=_0xa5b8[_0x3b4e19];return _0x6edea1;};'use strict';var _=require(_0x8a5b('0x0'));var attributes=require(_0x8a5b('0x1'));var squel=require(_0x8a5b('0x2'));module[_0x8a5b('0x3')]=function(_0x34802c){var _0x520f4b=_0x34802c[_0x8a5b('0x4')];function _0x2420e9(_0x31c641,_0x48adb1){return new Promise(function(_0x3f8e41,_0x237030){if(!_0x48adb1)return _0x3f8e41(null);var _0x503dec=_0x48adb1[_0x8a5b('0x5')]?{[_0x48adb1[_0x8a5b('0x5')][_0x8a5b('0x6')]]:_0x48adb1['filter'][_0x8a5b('0x7')]}:undefined;return _0x520f4b[_0x31c641][_0x8a5b('0x8')]({'where':_0x503dec,'raw':!![]})[_0x8a5b('0x9')](function(_0x2bde10){_0x48adb1['associatedResources']=_['map'](_0x2bde10,'id');_0x3f8e41(_0x48adb1);})[_0x8a5b('0xa')](function(_0x38a8c0){_0x237030(_0x38a8c0);});});}function _0x440c58(_0x334e21,_0x3fc8e1){return new Promise(function(_0x1bc2e2,_0x2b5016){var _0x422e48=_0x334e21[_0x8a5b('0x5')]?{[_0x334e21[_0x8a5b('0x5')][_0x8a5b('0x6')]]:_0x334e21[_0x8a5b('0x5')][_0x8a5b('0x7')]}:undefined;return _0x520f4b[_0x334e21['model']][_0x8a5b('0x8')]({'where':_0x422e48,'raw':!![]})[_0x8a5b('0x9')](function(_0x2e8fb6){_0x3fc8e1[_0x8a5b('0xb')]=_[_0x8a5b('0xc')](_0x2e8fb6,function(_0x4822c6){return _0x4822c6[_0x8a5b('0xd')];});_0x1bc2e2(_0x3fc8e1);})['catch'](function(_0x4afbcb){_0x2b5016(_0x4afbcb);});});}function _0xa80ba4(_0x13f69e,_0x735892,_0x31a2b9){if(!_0x735892)return Promise[_0x8a5b('0xe')](null);return new Promise(function(_0x1d21fb,_0x6191bc){return _0x520f4b[_0x8a5b('0xf')]['findAll']({'where':{'sectionId':_0x735892['id']},'raw':!![]})[_0x8a5b('0x9')](function(_0x487428){if(_0x13f69e[_0x8a5b('0x6')]&&_0x13f69e[_0x8a5b('0x6')]!=='id'){_0x735892['associatedResources']=_['map'](_0x487428,function(_0x368d81){return _0x368d81[_0x13f69e[_0x8a5b('0x6')]];});}else{if(_0x31a2b9===_0x8a5b('0x10')){_0x735892['associatedResources']=_[_0x8a5b('0xc')](_0x487428,function(_0x1ed70c){return{'id':_0x1ed70c[_0x8a5b('0x11')],'type':_0x1ed70c['type']};});}else{_0x735892[_0x8a5b('0xb')]=_[_0x8a5b('0xc')](_0x487428,function(_0x2d4b92){return _0x2d4b92[_0x8a5b('0x11')];});}}_0x1d21fb(_0x735892);})[_0x8a5b('0xa')](function(_0x3a113e){_0x6191bc(_0x3a113e);});});}function _0x3ce175(_0x26625c,_0x29850f){var _0x803dae={'parentSections':[]};switch(_0x26625c[_0x8a5b('0x12')]()){case _0x8a5b('0x13'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x15');break;case _0x8a5b('0x16'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x17');break;case _0x8a5b('0x18'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x19');_0x803dae[_0x8a5b('0x1a')]=[{'name':_0x8a5b('0x1b'),'field':_0x8a5b('0xd'),'foreignKey':_0x8a5b('0x1c')}];break;case _0x8a5b('0x1d'):_0x803dae['childModel']=_0x8a5b('0x1e');break;case _0x8a5b('0x1f'):_0x803dae['childModel']=_0x8a5b('0x20');_0x803dae[_0x8a5b('0x1a')]=[{'name':_0x8a5b('0x21'),'field':'id','foreignKey':_0x8a5b('0x22')}];break;case'lists':_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x23');break;case _0x8a5b('0x24'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x25');break;case'globalcustomfields':_0x803dae[_0x8a5b('0x14')]='CmCustomField';break;case _0x8a5b('0x26'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x27');break;case _0x8a5b('0x28'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x29');break;case _0x8a5b('0x2a'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x2b');break;case _0x8a5b('0x2c'):_0x803dae[_0x8a5b('0x14')]='FaxAccount';break;case'inboundroutes':case _0x8a5b('0x2d'):case _0x8a5b('0x2e'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x2f');break;case _0x8a5b('0x30'):_0x803dae[_0x8a5b('0x14')]='VoiceContext';break;case _0x8a5b('0x31'):_0x803dae[_0x8a5b('0x14')]='VoiceMail';break;case'voicerecordings':_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x32');_0x803dae[_0x8a5b('0x1a')]=[{'name':_0x8a5b('0x33'),'field':'name','foreignKey':_0x8a5b('0x34'),'model':_0x8a5b('0x35'),'filter':{'field':'role','value':[_0x8a5b('0x36')]}},{'name':'Telephones','field':_0x8a5b('0xd'),'foreignKey':_0x8a5b('0x34'),'model':'User','filter':{'field':_0x8a5b('0x37'),'value':['telephone']}},{'name':_0x8a5b('0x38'),'field':_0x8a5b('0xd'),'foreignKey':_0x8a5b('0x39'),'model':_0x8a5b('0x3a'),'filter':{'field':_0x8a5b('0x3b'),'value':['inbound']}},{'name':_0x8a5b('0x3c'),'field':_0x8a5b('0xd'),'foreignKey':'queue','model':_0x8a5b('0x3a'),'filter':{'field':_0x8a5b('0x3b'),'value':[_0x8a5b('0x3d')]}}];break;case'musiconholds':_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x3e');break;case'chanspies':_0x803dae['childModel']=_0x8a5b('0x3f');break;case _0x8a5b('0x40'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x41');break;case _0x8a5b('0x42'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x43');break;case'mailqueues':_0x803dae[_0x8a5b('0x14')]='MailQueue';break;case _0x8a5b('0x44'):_0x803dae[_0x8a5b('0x14')]='MailAccount';break;case _0x8a5b('0x45'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x46');break;case _0x8a5b('0x47'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x48');break;case _0x8a5b('0x49'):_0x803dae['childModel']='OpenchannelAccount';break;case'smsqueues':_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x4a');break;case'smsaccounts':_0x803dae['childModel']='SmsAccount';break;case'whatsappqueues':_0x803dae['childModel']=_0x8a5b('0x4b');break;case _0x8a5b('0x4c'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x4d');break;case _0x8a5b('0x4e'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x4f');break;case _0x8a5b('0x50'):case _0x8a5b('0x51'):_0x803dae[_0x8a5b('0x14')]='VoiceQueue';if(_0x29850f){_0x803dae[_0x8a5b('0x1a')]=[{'name':'VoiceQueues'},{'name':_0x8a5b('0x3c')}];}break;case _0x8a5b('0x52'):case'agents':case'telephones':_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x35');if(_0x29850f){_0x803dae[_0x8a5b('0x1a')]=[{'name':_0x8a5b('0x53'),'filter':{'field':'role','value':[_0x8a5b('0x54'),_0x8a5b('0x55')]},'ignore':!![]},{'name':_0x8a5b('0x33')},{'name':_0x8a5b('0x56')}];}break;case _0x8a5b('0x57'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x58');break;case _0x8a5b('0x59'):_0x803dae[_0x8a5b('0x14')]='SalesforceAccount';break;case _0x8a5b('0x5a'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x5b');break;case _0x8a5b('0x5c'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x5d');break;case _0x8a5b('0x5e'):_0x803dae['childModel']=_0x8a5b('0x5f');break;case _0x8a5b('0x60'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x61');break;case'vtigeraccounts':_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x35');break;case _0x8a5b('0x62'):_0x803dae[_0x8a5b('0x14')]='CannedAnswer';break;case _0x8a5b('0x63'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x64');break;case _0x8a5b('0x65'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x66');break;case _0x8a5b('0x67'):_0x803dae[_0x8a5b('0x14')]='Interval';break;case _0x8a5b('0x68'):_0x803dae['childModel']=_0x8a5b('0x69');break;case _0x8a5b('0x6a'):_0x803dae[_0x8a5b('0x14')]='Schedule';break;case'sounds':_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x6b');break;case _0x8a5b('0x6c'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x6d');break;case _0x8a5b('0x6e'):_0x803dae['childModel']=_0x8a5b('0x6f');break;case _0x8a5b('0x70'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x71');break;case _0x8a5b('0x72'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x73');break;case _0x8a5b('0x74'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x75');break;case _0x8a5b('0x76'):_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x77');break;case _0x8a5b('0x78'):_0x803dae['childModel']=_0x8a5b('0x10');_0x803dae[_0x8a5b('0x1a')]=[{'name':_0x8a5b('0x79'),'field':'id','foreignKey':_0x8a5b('0x7a')}];break;case'metrics':_0x803dae[_0x8a5b('0x14')]=_0x8a5b('0x7b');break;}return _0x803dae;}function _0x24882b(_0x3d6ae5,_0x32a1a1){var _0x228e15=_0x3d6ae5['charAt'](0x0)['toUpperCase']()+_0x3d6ae5['slice'](0x1);var _0x1d5a63={'type':_0x520f4b[_0x8a5b('0x7c')][_0x8a5b('0x7d')][_0x8a5b('0x7e')],'raw':!![]};return new Promise(function(_0x299f61,_0xa091fd){var _0x4e3d34=squel['select']()[_0x8a5b('0x6')](_0x8a5b('0x7f')+_0x228e15+_0x8a5b('0x80'),'id')[_0x8a5b('0x6')](_0x8a5b('0x81'))[_0x8a5b('0x82')]('user_has_'+_0x3d6ae5+_0x8a5b('0x83'),'ui')[_0x8a5b('0x84')](_0x8a5b('0x85'),_0x32a1a1['id']);return _0x520f4b[_0x8a5b('0x86')][_0x8a5b('0x87')](_0x4e3d34[_0x8a5b('0x88')](),_0x1d5a63)['then'](function(_0x14d5e2){_0x32a1a1[_0x228e15+_0x8a5b('0x89')]=_0x14d5e2;_0x299f61(_0x14d5e2);})['catch'](function(_0xc93189){_0xa091fd(_0xc93189);});});}return _0x34802c[_0x8a5b('0x8a')]('UserProfile',attributes,{'tableName':_0x8a5b('0x8b'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x30dbf6){var _0xaa15f=require('../../components/parsers/qs');var _0x57eb4d={'raw':_0x30dbf6[_0x8a5b('0x87')][_0x8a5b('0x8c')],'where':{}};var _0x3ed41f={};var _0x547a26={'count':0x0,'rows':[]};var _0x2eb536=_0x30dbf6['query']['section'];var _0x34fca1=_0x30dbf6[_0x8a5b('0x87')]['mergeResources']||![];var _0x264774=_0x3ce175(_0x2eb536,_0x34fca1);if(!_0x264774[_0x8a5b('0x14')])throw new Error(_0x8a5b('0x8d')+_0x2eb536+'\x27');var _0x374c59=[{'name':_0x2eb536}];if(!_[_0x8a5b('0x8e')](_0x264774[_0x8a5b('0x1a')]))_0x374c59=_0x264774[_0x8a5b('0x1a')];var _0xc8f851=[];for(var _0x208dbe=0x0;_0x208dbe<_0x374c59[_0x8a5b('0x8f')];_0x208dbe++){_0xc8f851[_0x8a5b('0x90')](_0x520f4b[_0x8a5b('0x91')][_0x8a5b('0x92')]({'where':{'userProfileId':_0x30dbf6[_0x8a5b('0x93')]['id'],'name':_0x374c59[_0x208dbe][_0x8a5b('0xd')]},'raw':!![]}));}return Promise['all'](_0xc8f851)['then'](function(_0x3fffbc){var _0x14fcde=_[_0x8a5b('0x5')](_0x3fffbc,function(_0x4bc558){return _0x4bc558?_0x4bc558:undefined;});var _0x4e269b=_[_0x8a5b('0x5')](_0x374c59,['ignore',!![]]);var _0x46a7a9=_['isEmpty'](_0x14fcde)&&_[_0x8a5b('0x8e')](_0x4e269b)?null:_[_0x8a5b('0x94')](_0x4e269b,_0x14fcde);if(!_0x46a7a9)return null;var _0x5689dd=[];for(var _0x279dd6=0x0;_0x279dd6<_0x46a7a9[_0x8a5b('0x8f')];_0x279dd6++){var _0x1e317f=_[_0x8a5b('0x92')](_0x374c59,function(_0x14f50a){return _0x46a7a9[_0x279dd6]?_0x14f50a['name']===_0x46a7a9[_0x279dd6][_0x8a5b('0xd')]:null;});if(_0x1e317f){if(_0x46a7a9[_0x279dd6]['ignore']){_0x5689dd[_0x8a5b('0x90')](_0x2420e9(_0x264774[_0x8a5b('0x14')],_0x46a7a9[_0x279dd6]));}else{if(!_0x46a7a9[_0x279dd6]['autoAssociation']){_0x5689dd[_0x8a5b('0x90')](_0xa80ba4(_0x1e317f,_0x46a7a9[_0x279dd6],_0x264774['childModel']));}else{if(_0x1e317f['model']){_0x5689dd[_0x8a5b('0x90')](_0x440c58(_0x1e317f,_0x46a7a9[_0x279dd6]));}}}}}return Promise['all'](_0x5689dd);})[_0x8a5b('0x9')](function(_0x722000){var _0x4c6453=_0x722000;var _0x283a4b=null;if(_0x4c6453){_0x283a4b=_0x4c6453[_0x8a5b('0x8f')]===0x1?_0x4c6453[0x0]:null;}if(!_0x283a4b&&!_0x4c6453)return _0x547a26;var _0x890c2c=_0x520f4b[_0x264774['childModel']][_0x8a5b('0x95')];_0x3ed41f[_0x8a5b('0x96')]=_['keys'](_0x890c2c);_0x3ed41f['query']=_[_0x8a5b('0x97')](_0x30dbf6[_0x8a5b('0x87')]);_0x3ed41f['filters']=_[_0x8a5b('0x98')](_0x3ed41f[_0x8a5b('0x96')],_0x3ed41f['query']);_0x57eb4d[_0x8a5b('0x99')]=_[_0x8a5b('0x98')](_0x3ed41f[_0x8a5b('0x96')],_0xaa15f[_0x8a5b('0x9a')](_0x30dbf6[_0x8a5b('0x87')]['fields']));_0x57eb4d[_0x8a5b('0x99')]=_0x57eb4d['attributes'][_0x8a5b('0x8f')]?_0x57eb4d['attributes']:_0x3ed41f[_0x8a5b('0x96')];if(!_0x30dbf6[_0x8a5b('0x87')][_0x8a5b('0x9b')]('nolimit')){_0x57eb4d[_0x8a5b('0x9c')]=_0xaa15f[_0x8a5b('0x9c')](_0x30dbf6[_0x8a5b('0x87')][_0x8a5b('0x9c')]);_0x57eb4d[_0x8a5b('0x9d')]=_0xaa15f[_0x8a5b('0x9d')](_0x30dbf6[_0x8a5b('0x87')][_0x8a5b('0x9d')]);}_0x57eb4d['order']=_0xaa15f['sort'](_0x30dbf6[_0x8a5b('0x87')][_0x8a5b('0x9e')]);_0x57eb4d[_0x8a5b('0x84')]=_0xaa15f[_0x8a5b('0x9f')](_[_0x8a5b('0xa0')](_0x30dbf6[_0x8a5b('0x87')],_0x3ed41f['filters']));if(_0x30dbf6[_0x8a5b('0x87')][_0x8a5b('0x5')]){_0x57eb4d['where']=_[_0x8a5b('0xa1')](_0x57eb4d[_0x8a5b('0x84')],{'$or':_[_0x8a5b('0xc')](_0x890c2c,function(_0x3abdf4){if(_0x3abdf4[_0x8a5b('0x3b')][_0x8a5b('0xa2')]!==_0x8a5b('0xa3')){var _0x1c6230={};_0x1c6230[_0x3abdf4[_0x8a5b('0x6')]]={'$like':'%'+_0x30dbf6[_0x8a5b('0x87')][_0x8a5b('0x5')]+'%'};return _0x1c6230;}})});}var _0x5d3451=[];var _0x5a4027=null;var _0x2e2299={};if(_0x283a4b){_0x5a4027=_[_0x8a5b('0x92')](_0x374c59,[_0x8a5b('0xd'),_0x283a4b[_0x8a5b('0xd')]]);if(_0x5a4027['field']){_0x2e2299={};if(_0x264774[_0x8a5b('0x14')]===_0x8a5b('0x10')){_0x2e2299[_0x5a4027[_0x8a5b('0xa4')]]=_['map'](_0x283a4b[_0x8a5b('0xb')],'id');}else{_0x2e2299[_0x5a4027[_0x8a5b('0xa4')]]=_0x283a4b[_0x8a5b('0xb')];}_0x5d3451[_0x8a5b('0x90')](_0x2e2299);}else{_0x57eb4d[_0x8a5b('0x84')]['id']=_0x283a4b['associatedResources'];}}else{for(var _0x5d99c7=0x0;_0x5d99c7<_0x4c6453[_0x8a5b('0x8f')];_0x5d99c7++){_0x5a4027=_[_0x8a5b('0x92')](_0x374c59,[_0x8a5b('0xd'),_0x4c6453[_0x5d99c7][_0x8a5b('0xd')]]);if(_0x5a4027['field']){_0x2e2299={};_0x2e2299[_0x5a4027['foreignKey']]=_0x4c6453[_0x5d99c7][_0x8a5b('0xb')];_0x5d3451[_0x8a5b('0x90')](_0x2e2299);}else{if(!_0x57eb4d[_0x8a5b('0x84')]['id'])_0x57eb4d[_0x8a5b('0x84')]['id']=[];_0x4c6453[_0x5d99c7][_0x8a5b('0xb')][_0x8a5b('0xa5')](function(_0x4f01df){_0x57eb4d[_0x8a5b('0x84')]['id'][_0x8a5b('0x90')](_0x4f01df);});}}}if(!_['isEmpty'](_0x5d3451)){_0x57eb4d[_0x8a5b('0x84')]=_[_0x8a5b('0xa1')](_0x57eb4d[_0x8a5b('0x84')],{'$and':{'$or':_0x5d3451}});}_0x57eb4d=_['merge']({},_0x57eb4d,_0x30dbf6['options']);if(_0x283a4b&&!_0x283a4b['autoAssociation']&&_0x264774['childModel']===_0x8a5b('0x10')){if(_0x30dbf6['query']['includeAll']){_0x57eb4d[_0x8a5b('0xa6')]=[{'all':!![]}];}return _0x520f4b[_0x264774['childModel']][_0x8a5b('0x8')](_0x57eb4d)['then'](function(_0x41f45b){var _0x252ee9=[];_0x41f45b[_0x8a5b('0xa5')](function(_0x4461ce){var _0x3a6657;switch(_0x4461ce[_0x8a5b('0xa7')]){case _0x8a5b('0xa8'):_0x3a6657=_['find'](_0x283a4b['associatedResources'],function(_0x48b222){return _0x48b222['id']===_0x4461ce[_0x8a5b('0x7a')]&&_0x48b222[_0x8a5b('0x3b')]===_0x8a5b('0xa9');});break;case'custom':_0x3a6657=_['find'](_0x283a4b[_0x8a5b('0xb')],function(_0x51c989){return _0x51c989['id']===_0x4461ce[_0x8a5b('0x7a')]&&_0x51c989[_0x8a5b('0x3b')]===_0x8a5b('0xaa');});break;}if(_0x3a6657)_0x252ee9[_0x8a5b('0x90')](_0x4461ce);});_0x547a26['count']=_0x252ee9[_0x8a5b('0x8f')];_0x547a26[_0x8a5b('0xab')]=_0x252ee9;return _0x547a26;});}else{if(!_[_0x8a5b('0x8e')](_0x30dbf6[_0x8a5b('0x87')][_0x8a5b('0xac')])){_0x57eb4d['where']['id']=_0x57eb4d[_0x8a5b('0x84')]['id']?_[_0x8a5b('0x98')](_0x57eb4d[_0x8a5b('0x84')]['id'],_0x30dbf6[_0x8a5b('0x87')]['ids']):_0x30dbf6[_0x8a5b('0x87')][_0x8a5b('0xac')];if(_0x30dbf6[_0x8a5b('0x87')][_0x8a5b('0xad')]){_0x57eb4d['order']=_0x30dbf6[_0x8a5b('0x87')][_0x8a5b('0xad')];}}if(_0x30dbf6[_0x8a5b('0x87')][_0x8a5b('0xae')]){_0x57eb4d['where']=_['merge'](_0x57eb4d[_0x8a5b('0x84')],{'$and':_0x30dbf6[_0x8a5b('0x87')][_0x8a5b('0xae')]});}return _0x520f4b[_0x264774['childModel']][_0x8a5b('0xaf')]({'where':_0x57eb4d[_0x8a5b('0x84')]})[_0x8a5b('0x9')](function(_0x1678e0){_0x547a26[_0x8a5b('0xaf')]=_0x1678e0;if(_0x30dbf6['query'][_0x8a5b('0xb0')]){if(_0x264774[_0x8a5b('0x14')]===_0x8a5b('0x20')){_0x57eb4d[_0x8a5b('0xa6')]=[{'model':_0x520f4b['Tag'],'as':_0x8a5b('0xb1'),'attributes':['id','name',_0x8a5b('0xb2')],'required':_0x30dbf6[_0x8a5b('0x87')][_0x8a5b('0xb3')]?!![]:![]},{'model':_0x520f4b[_0x8a5b('0x6d')],'as':_0x8a5b('0xb4'),'attributes':['id','name',_0x8a5b('0xb2')],'through':_0x30dbf6[_0x8a5b('0x87')][_0x8a5b('0xb3')]?{'attributes':[],'where':{'TagId':_0x30dbf6[_0x8a5b('0x87')][_0x8a5b('0xb3')]||undefined}}:{},'required':_0x30dbf6['query'][_0x8a5b('0xb3')]?!![]:![]}];}else{_0x57eb4d['include']=[{'all':!![]}];}}return _0x520f4b[_0x264774['childModel']][_0x8a5b('0x8')](_0x57eb4d);})[_0x8a5b('0x9')](function(_0x18c158){_0x547a26[_0x8a5b('0xab')]=_0x18c158;if(_0x2eb536===_0x8a5b('0x33')&&_0x30dbf6[_0x8a5b('0x87')][_0x8a5b('0xb5')]===_0x8a5b('0xb6')){var _0x1fba02=[];for(var _0x4b8dfa=0x0;_0x4b8dfa<_0x547a26['rows'][_0x8a5b('0x8f')];_0x4b8dfa++){_0x1fba02[_0x8a5b('0x90')](_0x24882b('chat',_0x547a26['rows'][_0x4b8dfa]['dataValues']));_0x1fba02[_0x8a5b('0x90')](_0x24882b(_0x8a5b('0xb7'),_0x547a26[_0x8a5b('0xab')][_0x4b8dfa]['dataValues']));_0x1fba02[_0x8a5b('0x90')](_0x24882b(_0x8a5b('0xb8'),_0x547a26[_0x8a5b('0xab')][_0x4b8dfa][_0x8a5b('0xb9')]));_0x1fba02[_0x8a5b('0x90')](_0x24882b(_0x8a5b('0xba'),_0x547a26[_0x8a5b('0xab')][_0x4b8dfa][_0x8a5b('0xb9')]));_0x1fba02[_0x8a5b('0x90')](_0x24882b(_0x8a5b('0xbb'),_0x547a26['rows'][_0x4b8dfa][_0x8a5b('0xb9')]));_0x1fba02['push'](_0x24882b('whatsapp',_0x547a26['rows'][_0x4b8dfa][_0x8a5b('0xb9')]));}return Promise[_0x8a5b('0xbc')](_0x1fba02)[_0x8a5b('0x9')](function(){return _0x547a26;});}return _0x547a26;});}});}}});}; \ No newline at end of file +var _0xc056=['find','params','all','ignore','union','autoAssociation','rawAttributes','keys','filters','attributes','fields','nolimit','limit','offset','order','sort','pick','merge','key','foreignKey','isEmpty','options','includeAll','include','reportType','default','DefaultReports','custom','count','rows','ids','intersection','customSorting','extraQueryConditions','Tags','color','tag','openTabs','true','chat','dataValues','fax','mail','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','model','UserProfileResource','AnalyticExtractedReport','resourceId','type','SquareProject','odbc','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','name','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','membername','User','agent','Telephones','role','telephone','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','users','agents','Users','user','Agents','zendeskaccounts','ZendeskAccount','FreshdeskAccount','sugarcrmaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','Interval','pauses','Pause','Sound','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','reportId','metrics','slice','QueryTypes','SELECT','ui.','user_has_','_interactions','where','sequelize','query','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection'];(function(_0x17ece2,_0x3a4881){var _0x1fb09f=function(_0x370b51){while(--_0x370b51){_0x17ece2['push'](_0x17ece2['shift']());}};_0x1fb09f(++_0x3a4881);}(_0xc056,0x199));var _0x6c05=function(_0x3f5796,_0x365460){_0x3f5796=_0x3f5796-0x0;var _0x97556d=_0xc056[_0x3f5796];return _0x97556d;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var squel=require('squel');module[_0x6c05('0x0')]=function(_0x1e7421){var _0x3b020a=_0x1e7421[_0x6c05('0x1')];function _0x491727(_0x5c8ff7,_0x47cdbb){return new Promise(function(_0xc858d9,_0x3e17e7){if(!_0x47cdbb)return _0xc858d9(null);var _0x3de6b0=_0x47cdbb[_0x6c05('0x2')]?{[_0x47cdbb[_0x6c05('0x2')][_0x6c05('0x3')]]:_0x47cdbb[_0x6c05('0x2')][_0x6c05('0x4')]}:undefined;return _0x3b020a[_0x5c8ff7][_0x6c05('0x5')]({'where':_0x3de6b0,'raw':!![]})[_0x6c05('0x6')](function(_0x56827c){_0x47cdbb[_0x6c05('0x7')]=_[_0x6c05('0x8')](_0x56827c,'id');_0xc858d9(_0x47cdbb);})[_0x6c05('0x9')](function(_0x486f8d){_0x3e17e7(_0x486f8d);});});}function _0x30376a(_0xf0d226,_0x115459){return new Promise(function(_0x4f7eb8,_0x5cfae8){var _0x265203=_0xf0d226['filter']?{[_0xf0d226[_0x6c05('0x2')]['field']]:_0xf0d226[_0x6c05('0x2')][_0x6c05('0x4')]}:undefined;return _0x3b020a[_0xf0d226[_0x6c05('0xa')]][_0x6c05('0x5')]({'where':_0x265203,'raw':!![]})[_0x6c05('0x6')](function(_0x252b3e){_0x115459[_0x6c05('0x7')]=_[_0x6c05('0x8')](_0x252b3e,function(_0x36bf03){return _0x36bf03['name'];});_0x4f7eb8(_0x115459);})[_0x6c05('0x9')](function(_0x4f71b7){_0x5cfae8(_0x4f71b7);});});}function _0x58b501(_0x34569c,_0x52b7d3,_0x594c10){if(!_0x52b7d3)return Promise['resolve'](null);return new Promise(function(_0x46c403,_0x593f21){return _0x3b020a[_0x6c05('0xb')][_0x6c05('0x5')]({'where':{'sectionId':_0x52b7d3['id']},'raw':!![]})[_0x6c05('0x6')](function(_0x2cdeb7){if(_0x34569c[_0x6c05('0x3')]&&_0x34569c[_0x6c05('0x3')]!=='id'){_0x52b7d3[_0x6c05('0x7')]=_['map'](_0x2cdeb7,function(_0x57ffd2){return _0x57ffd2[_0x34569c[_0x6c05('0x3')]];});}else{if(_0x594c10===_0x6c05('0xc')){_0x52b7d3[_0x6c05('0x7')]=_[_0x6c05('0x8')](_0x2cdeb7,function(_0x1b533c){return{'id':_0x1b533c[_0x6c05('0xd')],'type':_0x1b533c[_0x6c05('0xe')]};});}else{_0x52b7d3['associatedResources']=_['map'](_0x2cdeb7,function(_0x4783fb){return _0x4783fb['resourceId'];});}}_0x46c403(_0x52b7d3);})[_0x6c05('0x9')](function(_0x182f34){_0x593f21(_0x182f34);});});}function _0x4ba9ba(_0x434d87,_0x192699){var _0x2febf8={'parentSections':[]};switch(_0x434d87['toLowerCase']()){case'squareprojects':_0x2febf8['childModel']=_0x6c05('0xf');break;case _0x6c05('0x10'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x12');break;case _0x6c05('0x13'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x14');_0x2febf8[_0x6c05('0x15')]=[{'name':_0x6c05('0x16'),'field':_0x6c05('0x17'),'foreignKey':'projectName'}];break;case _0x6c05('0x18'):_0x2febf8['childModel']=_0x6c05('0x19');break;case _0x6c05('0x1a'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x1b');_0x2febf8[_0x6c05('0x15')]=[{'name':_0x6c05('0x1c'),'field':'id','foreignKey':_0x6c05('0x1d')}];break;case _0x6c05('0x1e'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x1f');break;case'companies':_0x2febf8['childModel']=_0x6c05('0x20');break;case _0x6c05('0x21'):_0x2febf8[_0x6c05('0x11')]='CmCustomField';break;case _0x6c05('0x22'):_0x2febf8['childModel']=_0x6c05('0x23');break;case _0x6c05('0x24'):_0x2febf8[_0x6c05('0x11')]='ChatWebsite';break;case'faxqueues':_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x25');break;case _0x6c05('0x26'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x27');break;case'inboundroutes':case _0x6c05('0x28'):case _0x6c05('0x29'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x2a');break;case _0x6c05('0x2b'):_0x2febf8['childModel']=_0x6c05('0x2c');break;case _0x6c05('0x2d'):_0x2febf8['childModel']=_0x6c05('0x2e');break;case'voicerecordings':_0x2febf8['childModel']=_0x6c05('0x2f');_0x2febf8[_0x6c05('0x15')]=[{'name':'Agents','field':_0x6c05('0x17'),'foreignKey':_0x6c05('0x30'),'model':_0x6c05('0x31'),'filter':{'field':'role','value':[_0x6c05('0x32')]}},{'name':_0x6c05('0x33'),'field':'name','foreignKey':_0x6c05('0x30'),'model':_0x6c05('0x31'),'filter':{'field':_0x6c05('0x34'),'value':[_0x6c05('0x35')]}},{'name':_0x6c05('0x36'),'field':_0x6c05('0x17'),'foreignKey':_0x6c05('0x37'),'model':'VoiceQueue','filter':{'field':'type','value':[_0x6c05('0x38')]}},{'name':_0x6c05('0x39'),'field':'name','foreignKey':_0x6c05('0x37'),'model':_0x6c05('0x3a'),'filter':{'field':'type','value':[_0x6c05('0x3b')]}}];break;case _0x6c05('0x3c'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x3d');break;case _0x6c05('0x3e'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x3f');break;case'voiceprefixes':_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x40');break;case'ivrcampaigns':_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x41');break;case _0x6c05('0x42'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x43');break;case _0x6c05('0x44'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x45');break;case _0x6c05('0x46'):_0x2febf8['childModel']=_0x6c05('0x47');break;case _0x6c05('0x48'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x49');break;case _0x6c05('0x4a'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x4b');break;case _0x6c05('0x4c'):_0x2febf8['childModel']=_0x6c05('0x4d');break;case _0x6c05('0x4e'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x4f');break;case _0x6c05('0x50'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x51');break;case _0x6c05('0x52'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x53');break;case _0x6c05('0x54'):_0x2febf8['childModel']=_0x6c05('0x55');break;case'voicequeues':case'queuecampaigns':_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x3a');if(_0x192699){_0x2febf8[_0x6c05('0x15')]=[{'name':_0x6c05('0x36')},{'name':_0x6c05('0x39')}];}break;case _0x6c05('0x56'):case _0x6c05('0x57'):case'telephones':_0x2febf8[_0x6c05('0x11')]='User';if(_0x192699){_0x2febf8[_0x6c05('0x15')]=[{'name':_0x6c05('0x58'),'filter':{'field':_0x6c05('0x34'),'value':['admin',_0x6c05('0x59')]},'ignore':!![]},{'name':_0x6c05('0x5a')},{'name':_0x6c05('0x33')}];}break;case _0x6c05('0x5b'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x5c');break;case'salesforceaccounts':_0x2febf8[_0x6c05('0x11')]='SalesforceAccount';break;case'freshdeskaccounts':_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x5d');break;case _0x6c05('0x5e'):_0x2febf8['childModel']='SugarcrmAccount';break;case'deskaccounts':_0x2febf8[_0x6c05('0x11')]='DeskAccount';break;case'zohoaccounts':_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x5f');break;case'vtigeraccounts':_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x31');break;case _0x6c05('0x60'):_0x2febf8['childModel']=_0x6c05('0x61');break;case _0x6c05('0x62'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x63');break;case'customdashboards':_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x64');break;case'intervals':_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x65');break;case _0x6c05('0x66'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x67');break;case'scheduler':_0x2febf8[_0x6c05('0x11')]='Schedule';break;case'sounds':_0x2febf8['childModel']=_0x6c05('0x68');break;case'tags':_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x69');break;case _0x6c05('0x6a'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x6b');break;case _0x6c05('0x6c'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x6d');break;case _0x6c05('0x6e'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x6f');break;case _0x6c05('0x70'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0x71');break;case _0x6c05('0x72'):_0x2febf8[_0x6c05('0x11')]='Plugin';break;case _0x6c05('0x73'):_0x2febf8[_0x6c05('0x11')]=_0x6c05('0xc');_0x2febf8[_0x6c05('0x15')]=[{'name':_0x6c05('0x74'),'field':'id','foreignKey':_0x6c05('0x75')}];break;case _0x6c05('0x76'):_0x2febf8[_0x6c05('0x11')]='AnalyticMetric';break;}return _0x2febf8;}function _0x47aff2(_0x9b95e5,_0x467be5){var _0x58b8cd=_0x9b95e5['charAt'](0x0)['toUpperCase']()+_0x9b95e5[_0x6c05('0x77')](0x1);var _0x4e4fcd={'type':_0x3b020a['Sequelize'][_0x6c05('0x78')][_0x6c05('0x79')],'raw':!![]};return new Promise(function(_0x1079ea,_0x1f64a3){var _0x4211b8=squel['select']()[_0x6c05('0x3')](_0x6c05('0x7a')+_0x58b8cd+'InteractionId','id')[_0x6c05('0x3')]('ui.createdAt')['from'](_0x6c05('0x7b')+_0x9b95e5+_0x6c05('0x7c'),'ui')[_0x6c05('0x7d')]('ui.UserId\x20=\x20?',_0x467be5['id']);return _0x3b020a[_0x6c05('0x7e')][_0x6c05('0x7f')](_0x4211b8['toString'](),_0x4e4fcd)[_0x6c05('0x6')](function(_0x16b0f5){_0x467be5[_0x58b8cd+_0x6c05('0x80')]=_0x16b0f5;_0x1079ea(_0x16b0f5);})[_0x6c05('0x9')](function(_0x537ebf){_0x1f64a3(_0x537ebf);});});}return _0x1e7421[_0x6c05('0x81')](_0x6c05('0x82'),attributes,{'tableName':_0x6c05('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x490b80){var _0x5df44=require(_0x6c05('0x84'));var _0x279b88={'raw':_0x490b80[_0x6c05('0x7f')][_0x6c05('0x85')],'where':{}};var _0x4918f4={};var _0x40b884={'count':0x0,'rows':[]};var _0x214a2e=_0x490b80[_0x6c05('0x7f')][_0x6c05('0x86')];var _0x2b168d=_0x490b80[_0x6c05('0x7f')][_0x6c05('0x87')]||![];var _0x51e222=_0x4ba9ba(_0x214a2e,_0x2b168d);if(!_0x51e222[_0x6c05('0x11')])throw new Error(_0x6c05('0x88')+_0x214a2e+'\x27');var _0x467dea=[{'name':_0x214a2e}];if(!_['isEmpty'](_0x51e222[_0x6c05('0x15')]))_0x467dea=_0x51e222[_0x6c05('0x15')];var _0x2f391b=[];for(var _0x41b7f6=0x0;_0x41b7f6<_0x467dea[_0x6c05('0x89')];_0x41b7f6++){_0x2f391b[_0x6c05('0x8a')](_0x3b020a[_0x6c05('0x8b')][_0x6c05('0x8c')]({'where':{'userProfileId':_0x490b80[_0x6c05('0x8d')]['id'],'name':_0x467dea[_0x41b7f6]['name']},'raw':!![]}));}return Promise[_0x6c05('0x8e')](_0x2f391b)[_0x6c05('0x6')](function(_0x4b1ff2){var _0x5337c2=_[_0x6c05('0x2')](_0x4b1ff2,function(_0xe19ad4){return _0xe19ad4?_0xe19ad4:undefined;});var _0x5ddf77=_[_0x6c05('0x2')](_0x467dea,[_0x6c05('0x8f'),!![]]);var _0x4d90b5=_['isEmpty'](_0x5337c2)&&_['isEmpty'](_0x5ddf77)?null:_[_0x6c05('0x90')](_0x5ddf77,_0x5337c2);if(!_0x4d90b5)return null;var _0x1fe7e6=[];for(var _0x5e99b6=0x0;_0x5e99b6<_0x4d90b5[_0x6c05('0x89')];_0x5e99b6++){var _0x5a00fb=_[_0x6c05('0x8c')](_0x467dea,function(_0x2f4402){return _0x4d90b5[_0x5e99b6]?_0x2f4402[_0x6c05('0x17')]===_0x4d90b5[_0x5e99b6][_0x6c05('0x17')]:null;});if(_0x5a00fb){if(_0x4d90b5[_0x5e99b6][_0x6c05('0x8f')]){_0x1fe7e6[_0x6c05('0x8a')](_0x491727(_0x51e222[_0x6c05('0x11')],_0x4d90b5[_0x5e99b6]));}else{if(!_0x4d90b5[_0x5e99b6][_0x6c05('0x91')]){_0x1fe7e6[_0x6c05('0x8a')](_0x58b501(_0x5a00fb,_0x4d90b5[_0x5e99b6],_0x51e222[_0x6c05('0x11')]));}else{if(_0x5a00fb[_0x6c05('0xa')]){_0x1fe7e6[_0x6c05('0x8a')](_0x30376a(_0x5a00fb,_0x4d90b5[_0x5e99b6]));}}}}}return Promise[_0x6c05('0x8e')](_0x1fe7e6);})[_0x6c05('0x6')](function(_0x4c2e9f){var _0x11c395=_0x4c2e9f;var _0x205cb8=null;if(_0x11c395){_0x205cb8=_0x11c395['length']===0x1?_0x11c395[0x0]:null;}if(!_0x205cb8&&!_0x11c395)return _0x40b884;var _0x5ade76=_0x3b020a[_0x51e222[_0x6c05('0x11')]][_0x6c05('0x92')];_0x4918f4['model']=_[_0x6c05('0x93')](_0x5ade76);_0x4918f4[_0x6c05('0x7f')]=_[_0x6c05('0x93')](_0x490b80['query']);_0x4918f4[_0x6c05('0x94')]=_['intersection'](_0x4918f4['model'],_0x4918f4['query']);_0x279b88[_0x6c05('0x95')]=_['intersection'](_0x4918f4['model'],_0x5df44['fields'](_0x490b80['query'][_0x6c05('0x96')]));_0x279b88['attributes']=_0x279b88[_0x6c05('0x95')][_0x6c05('0x89')]?_0x279b88['attributes']:_0x4918f4[_0x6c05('0xa')];if(!_0x490b80['query']['hasOwnProperty'](_0x6c05('0x97'))){_0x279b88[_0x6c05('0x98')]=_0x5df44[_0x6c05('0x98')](_0x490b80[_0x6c05('0x7f')][_0x6c05('0x98')]);_0x279b88[_0x6c05('0x99')]=_0x5df44['offset'](_0x490b80[_0x6c05('0x7f')][_0x6c05('0x99')]);}_0x279b88[_0x6c05('0x9a')]=_0x5df44[_0x6c05('0x9b')](_0x490b80[_0x6c05('0x7f')][_0x6c05('0x9b')]);_0x279b88[_0x6c05('0x7d')]=_0x5df44[_0x6c05('0x94')](_[_0x6c05('0x9c')](_0x490b80[_0x6c05('0x7f')],_0x4918f4[_0x6c05('0x94')]));if(_0x490b80[_0x6c05('0x7f')][_0x6c05('0x2')]){_0x279b88[_0x6c05('0x7d')]=_[_0x6c05('0x9d')](_0x279b88[_0x6c05('0x7d')],{'$or':_[_0x6c05('0x8')](_0x5ade76,function(_0x119ea5){if(_0x119ea5[_0x6c05('0xe')][_0x6c05('0x9e')]!=='VIRTUAL'){var _0x252a98={};_0x252a98[_0x119ea5['field']]={'$like':'%'+_0x490b80[_0x6c05('0x7f')][_0x6c05('0x2')]+'%'};return _0x252a98;}})});}var _0x3e9212=[];var _0x1c9f07=null;var _0x284005={};if(_0x205cb8){_0x1c9f07=_[_0x6c05('0x8c')](_0x467dea,[_0x6c05('0x17'),_0x205cb8['name']]);if(_0x1c9f07[_0x6c05('0x3')]){_0x284005={};if(_0x51e222['childModel']==='AnalyticExtractedReport'){_0x284005[_0x1c9f07[_0x6c05('0x9f')]]=_[_0x6c05('0x8')](_0x205cb8[_0x6c05('0x7')],'id');}else{_0x284005[_0x1c9f07[_0x6c05('0x9f')]]=_0x205cb8[_0x6c05('0x7')];}_0x3e9212[_0x6c05('0x8a')](_0x284005);}else{_0x279b88['where']['id']=_0x205cb8[_0x6c05('0x7')];}}else{for(var _0x3a3792=0x0;_0x3a3792<_0x11c395[_0x6c05('0x89')];_0x3a3792++){_0x1c9f07=_['find'](_0x467dea,['name',_0x11c395[_0x3a3792][_0x6c05('0x17')]]);if(_0x1c9f07[_0x6c05('0x3')]){_0x284005={};_0x284005[_0x1c9f07[_0x6c05('0x9f')]]=_0x11c395[_0x3a3792][_0x6c05('0x7')];_0x3e9212[_0x6c05('0x8a')](_0x284005);}else{if(!_0x279b88[_0x6c05('0x7d')]['id'])_0x279b88[_0x6c05('0x7d')]['id']=[];_0x11c395[_0x3a3792]['associatedResources']['forEach'](function(_0x191bb1){_0x279b88['where']['id'][_0x6c05('0x8a')](_0x191bb1);});}}}if(!_[_0x6c05('0xa0')](_0x3e9212)){_0x279b88['where']=_[_0x6c05('0x9d')](_0x279b88[_0x6c05('0x7d')],{'$and':{'$or':_0x3e9212}});}_0x279b88=_[_0x6c05('0x9d')]({},_0x279b88,_0x490b80[_0x6c05('0xa1')]);if(_0x205cb8&&!_0x205cb8[_0x6c05('0x91')]&&_0x51e222[_0x6c05('0x11')]===_0x6c05('0xc')){if(_0x490b80[_0x6c05('0x7f')][_0x6c05('0xa2')]){_0x279b88[_0x6c05('0xa3')]=[{'all':!![]}];}return _0x3b020a[_0x51e222[_0x6c05('0x11')]]['findAll'](_0x279b88)[_0x6c05('0x6')](function(_0x445139){var _0x22d741=[];_0x445139['forEach'](function(_0x369a1c){var _0x67a582;switch(_0x369a1c[_0x6c05('0xa4')]){case _0x6c05('0xa5'):_0x67a582=_['find'](_0x205cb8[_0x6c05('0x7')],function(_0x799ab1){return _0x799ab1['id']===_0x369a1c['reportId']&&_0x799ab1['type']===_0x6c05('0xa6');});break;case _0x6c05('0xa7'):_0x67a582=_[_0x6c05('0x8c')](_0x205cb8['associatedResources'],function(_0x28008e){return _0x28008e['id']===_0x369a1c[_0x6c05('0x75')]&&_0x28008e[_0x6c05('0xe')]==='CustomReports';});break;}if(_0x67a582)_0x22d741['push'](_0x369a1c);});_0x40b884[_0x6c05('0xa8')]=_0x22d741[_0x6c05('0x89')];_0x40b884[_0x6c05('0xa9')]=_0x22d741;return _0x40b884;});}else{if(!_[_0x6c05('0xa0')](_0x490b80[_0x6c05('0x7f')][_0x6c05('0xaa')])){_0x279b88[_0x6c05('0x7d')]['id']=_0x279b88[_0x6c05('0x7d')]['id']?_[_0x6c05('0xab')](_0x279b88['where']['id'],_0x490b80[_0x6c05('0x7f')][_0x6c05('0xaa')]):_0x490b80[_0x6c05('0x7f')][_0x6c05('0xaa')];if(_0x490b80[_0x6c05('0x7f')][_0x6c05('0xac')]){_0x279b88['order']=_0x490b80[_0x6c05('0x7f')]['customSorting'];}}if(_0x490b80[_0x6c05('0x7f')]['extraQueryConditions']){_0x279b88[_0x6c05('0x7d')]=_[_0x6c05('0x9d')](_0x279b88[_0x6c05('0x7d')],{'$and':_0x490b80[_0x6c05('0x7f')][_0x6c05('0xad')]});}return _0x3b020a[_0x51e222[_0x6c05('0x11')]][_0x6c05('0xa8')]({'where':_0x279b88[_0x6c05('0x7d')]})[_0x6c05('0x6')](function(_0x299cf2){_0x40b884['count']=_0x299cf2;if(_0x490b80[_0x6c05('0x7f')][_0x6c05('0xa2')]){if(_0x51e222[_0x6c05('0x11')]==='CmContact'){_0x279b88[_0x6c05('0xa3')]=[{'model':_0x3b020a[_0x6c05('0x69')],'as':_0x6c05('0xae'),'attributes':['id',_0x6c05('0x17'),_0x6c05('0xaf')],'required':_0x490b80[_0x6c05('0x7f')][_0x6c05('0xb0')]?!![]:![]},{'model':_0x3b020a[_0x6c05('0x69')],'as':'ThroughTags','attributes':['id','name',_0x6c05('0xaf')],'through':_0x490b80[_0x6c05('0x7f')][_0x6c05('0xb0')]?{'attributes':[],'where':{'TagId':_0x490b80['query'][_0x6c05('0xb0')]||undefined}}:{},'required':_0x490b80[_0x6c05('0x7f')][_0x6c05('0xb0')]?!![]:![]}];}else{_0x279b88[_0x6c05('0xa3')]=[{'all':!![]}];}}return _0x3b020a[_0x51e222['childModel']][_0x6c05('0x5')](_0x279b88);})[_0x6c05('0x6')](function(_0x461603){_0x40b884[_0x6c05('0xa9')]=_0x461603;if(_0x214a2e===_0x6c05('0x5a')&&_0x490b80[_0x6c05('0x7f')][_0x6c05('0xb1')]===_0x6c05('0xb2')){var _0x1de9a7=[];for(var _0x2d79f9=0x0;_0x2d79f9<_0x40b884[_0x6c05('0xa9')][_0x6c05('0x89')];_0x2d79f9++){_0x1de9a7['push'](_0x47aff2(_0x6c05('0xb3'),_0x40b884['rows'][_0x2d79f9]['dataValues']));_0x1de9a7['push'](_0x47aff2('sms',_0x40b884[_0x6c05('0xa9')][_0x2d79f9][_0x6c05('0xb4')]));_0x1de9a7[_0x6c05('0x8a')](_0x47aff2(_0x6c05('0xb5'),_0x40b884['rows'][_0x2d79f9][_0x6c05('0xb4')]));_0x1de9a7[_0x6c05('0x8a')](_0x47aff2(_0x6c05('0xb6'),_0x40b884[_0x6c05('0xa9')][_0x2d79f9][_0x6c05('0xb4')]));_0x1de9a7[_0x6c05('0x8a')](_0x47aff2('openchannel',_0x40b884[_0x6c05('0xa9')][_0x2d79f9][_0x6c05('0xb4')]));_0x1de9a7[_0x6c05('0x8a')](_0x47aff2('whatsapp',_0x40b884['rows'][_0x2d79f9][_0x6c05('0xb4')]));}return Promise[_0x6c05('0x8e')](_0x1de9a7)['then'](function(){return _0x40b884;});}return _0x40b884;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 354b4b5..a17e347 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 _0x5b47=['lodash','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','redis','./userProfile.socket','register','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x1ec479,_0x54d127){var _0x43ca09=function(_0x18518f){while(--_0x18518f){_0x1ec479['push'](_0x1ec479['shift']());}};_0x43ca09(++_0x54d127);}(_0x5b47,0x120));var _0x75b4=function(_0x353521,_0x589fb9){_0x353521=_0x353521-0x0;var _0x566f77=_0x5b47[_0x353521];return _0x566f77;};'use strict';var _=require(_0x75b4('0x0'));var util=require(_0x75b4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x75b4('0x2'));var logger=require(_0x75b4('0x3'))(_0x75b4('0x4'));var config=require(_0x75b4('0x5'));var jayson=require(_0x75b4('0x6'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x75b4('0x7')](config['redis'],{'host':_0x75b4('0x8'),'port':0x18eb});var socket=require(_0x75b4('0x9'))(new Redis(config[_0x75b4('0xa')]));require(_0x75b4('0xb'))[_0x75b4('0xc')](socket);function respondWithRpcPromise(_0x4b2a75,_0x2cd75b,_0x2211a1){return new BPromise(function(_0x33f11d,_0x51b9a6){return client[_0x75b4('0xd')](_0x4b2a75,_0x2211a1)['then'](function(_0x690d5a){logger[_0x75b4('0xe')](_0x75b4('0xf'),_0x2cd75b,_0x75b4('0x10'));logger[_0x75b4('0x11')](_0x75b4('0x12'),_0x2cd75b,_0x75b4('0x10'),JSON[_0x75b4('0x13')](_0x690d5a));if(_0x690d5a['error']){if(_0x690d5a['error']['code']===0x1f4){logger[_0x75b4('0x14')](_0x75b4('0xf'),_0x2cd75b,_0x690d5a['error'][_0x75b4('0x15')]);return _0x51b9a6(_0x690d5a[_0x75b4('0x14')][_0x75b4('0x15')]);}logger['error'](_0x75b4('0xf'),_0x2cd75b,_0x690d5a[_0x75b4('0x14')][_0x75b4('0x15')]);return _0x33f11d(_0x690d5a[_0x75b4('0x14')]['message']);}else{logger[_0x75b4('0xe')](_0x75b4('0xf'),_0x2cd75b,_0x75b4('0x10'));_0x33f11d(_0x690d5a[_0x75b4('0x16')][_0x75b4('0x15')]);}})[_0x75b4('0x17')](function(_0x510967){logger[_0x75b4('0x14')](_0x75b4('0xf'),_0x2cd75b,_0x510967);_0x51b9a6(_0x510967);});});} \ No newline at end of file +var _0x44ff=['register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','info','util','moment','bluebird','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./userProfile.socket'];(function(_0x5d72da,_0xb7ce32){var _0x43ebe7=function(_0x503755){while(--_0x503755){_0x5d72da['push'](_0x5d72da['shift']());}};_0x43ebe7(++_0xb7ce32);}(_0x44ff,0x1c3));var _0xf44f=function(_0x2ab1c1,_0x39b0b6){_0x2ab1c1=_0x2ab1c1-0x0;var _0x527164=_0x44ff[_0x2ab1c1];return _0x527164;};'use strict';var _=require('lodash');var util=require(_0xf44f('0x0'));var moment=require(_0xf44f('0x1'));var BPromise=require(_0xf44f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf44f('0x3'))(_0xf44f('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf44f('0x5')][_0xf44f('0x6')]({'port':0x232a});config[_0xf44f('0x7')]=_['defaults'](config[_0xf44f('0x7')],{'host':_0xf44f('0x8'),'port':0x18eb});var socket=require(_0xf44f('0x9'))(new Redis(config['redis']));require(_0xf44f('0xa'))[_0xf44f('0xb')](socket);function respondWithRpcPromise(_0x1db73f,_0x1c132f,_0x278017){return new BPromise(function(_0x21fb0e,_0x22531e){return client[_0xf44f('0xc')](_0x1db73f,_0x278017)[_0xf44f('0xd')](function(_0x36fddf){logger['info'](_0xf44f('0xe'),_0x1c132f,_0xf44f('0xf'));logger[_0xf44f('0x10')](_0xf44f('0x11'),_0x1c132f,_0xf44f('0xf'),JSON[_0xf44f('0x12')](_0x36fddf));if(_0x36fddf[_0xf44f('0x13')]){if(_0x36fddf['error']['code']===0x1f4){logger[_0xf44f('0x13')]('UserProfile,\x20%s,\x20%s',_0x1c132f,_0x36fddf['error']['message']);return _0x22531e(_0x36fddf[_0xf44f('0x13')][_0xf44f('0x14')]);}logger[_0xf44f('0x13')](_0xf44f('0xe'),_0x1c132f,_0x36fddf['error'][_0xf44f('0x14')]);return _0x21fb0e(_0x36fddf['error'][_0xf44f('0x14')]);}else{logger[_0xf44f('0x15')](_0xf44f('0xe'),_0x1c132f,_0xf44f('0xf'));_0x21fb0e(_0x36fddf['result']['message']);}})['catch'](function(_0x540a14){logger[_0xf44f('0x13')]('UserProfile,\x20%s,\x20%s',_0x1c132f,_0x540a14);_0x22531e(_0x540a14);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 3a7b85d..8bcd63e 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 _0xcf33=['emit','removeListener','register','length','./userProfile.events','save','remove','update'];(function(_0xfe4909,_0x34d210){var _0x1ce1a0=function(_0x22ec5e){while(--_0x22ec5e){_0xfe4909['push'](_0xfe4909['shift']());}};_0x1ce1a0(++_0x34d210);}(_0xcf33,0x1b4));var _0x3cf3=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xcf33[_0x5f3f88];return _0xd08119;};'use strict';var UserProfileEvents=require(_0x3cf3('0x0'));var events=[_0x3cf3('0x1'),_0x3cf3('0x2'),_0x3cf3('0x3')];function createListener(_0x2a486c,_0x346976){return function(_0x39cfb0){_0x346976[_0x3cf3('0x4')](_0x2a486c,_0x39cfb0);};}function removeListener(_0x1e2165,_0x41e5a){return function(){UserProfileEvents[_0x3cf3('0x5')](_0x1e2165,_0x41e5a);};}exports[_0x3cf3('0x6')]=function(_0x523a56){for(var _0x1847ef=0x0,_0x202b2f=events[_0x3cf3('0x7')];_0x1847ef<_0x202b2f;_0x1847ef++){var _0x3eb02c=events[_0x1847ef];var _0x3cc7a3=createListener('userProfile:'+_0x3eb02c,_0x523a56);UserProfileEvents['on'](_0x3eb02c,_0x3cc7a3);}}; \ No newline at end of file +var _0xc037=['emit','removeListener','register','length','userProfile:','./userProfile.events','update'];(function(_0x18acf0,_0x21b6ac){var _0x201e69=function(_0x5980b3){while(--_0x5980b3){_0x18acf0['push'](_0x18acf0['shift']());}};_0x201e69(++_0x21b6ac);}(_0xc037,0x91));var _0x7c03=function(_0x521f3e,_0x53b089){_0x521f3e=_0x521f3e-0x0;var _0x320fd9=_0xc037[_0x521f3e];return _0x320fd9;};'use strict';var UserProfileEvents=require(_0x7c03('0x0'));var events=['save','remove',_0x7c03('0x1')];function createListener(_0x2a0ed2,_0x3b83a1){return function(_0x26bb99){_0x3b83a1[_0x7c03('0x2')](_0x2a0ed2,_0x26bb99);};}function removeListener(_0x3dcede,_0x43bfcb){return function(){UserProfileEvents[_0x7c03('0x3')](_0x3dcede,_0x43bfcb);};}exports[_0x7c03('0x4')]=function(_0x1da85b){for(var _0x1ad8c2=0x0,_0x9e3f8f=events[_0x7c03('0x5')];_0x1ad8c2<_0x9e3f8f;_0x1ad8c2++){var _0x296f28=events[_0x1ad8c2];var _0x16c384=createListener(_0x7c03('0x6')+_0x296f28,_0x1da85b);UserProfileEvents['on'](_0x296f28,_0x16c384);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index b12d9aa..2d6ea53 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 _0xc43f=['delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x3cc547,_0x4020ec){var _0x52b5b8=function(_0x2dc039){while(--_0x2dc039){_0x3cc547['push'](_0x3cc547['shift']());}};_0x52b5b8(++_0x4020ec);}(_0xc43f,0x1f2));var _0xfc43=function(_0x1dffa3,_0x50c4ba){_0x1dffa3=_0x1dffa3-0x0;var _0x483086=_0xc43f[_0x1dffa3];return _0x483086;};'use strict';var multer=require(_0xfc43('0x0'));var util=require('util');var path=require(_0xfc43('0x1'));var timeout=require(_0xfc43('0x2'));var express=require(_0xfc43('0x3'));var router=express['Router']();var fs_extra=require(_0xfc43('0x4'));var auth=require(_0xfc43('0x5'));var interaction=require(_0xfc43('0x6'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0xfc43('0x7')]('/',auth[_0xfc43('0x8')](),controller[_0xfc43('0x9')]);router[_0xfc43('0x7')](_0xfc43('0xa'),auth['isAuthenticated'](),controller[_0xfc43('0xb')]);router['get'](_0xfc43('0xc'),auth['isAuthenticated'](),controller[_0xfc43('0xd')]);router['post']('/',auth[_0xfc43('0x8')](),controller['create']);router['put'](_0xfc43('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xfc43('0xe')](_0xfc43('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xfc43('0xf')]=router; \ No newline at end of file +var _0x9662=['/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','isAuthenticated','show','create','put'];(function(_0x5d92c4,_0x58763){var _0x359fce=function(_0x1c5998){while(--_0x1c5998){_0x5d92c4['push'](_0x5d92c4['shift']());}};_0x359fce(++_0x58763);}(_0x9662,0x6d));var _0x2966=function(_0x51b35e,_0x33909a){_0x51b35e=_0x51b35e-0x0;var _0x520cb6=_0x9662[_0x51b35e];return _0x520cb6;};'use strict';var multer=require(_0x2966('0x0'));var util=require(_0x2966('0x1'));var path=require(_0x2966('0x2'));var timeout=require(_0x2966('0x3'));var express=require(_0x2966('0x4'));var router=express[_0x2966('0x5')]();var fs_extra=require(_0x2966('0x6'));var auth=require(_0x2966('0x7'));var interaction=require(_0x2966('0x8'));var config=require(_0x2966('0x9'));var controller=require('./userProfileResource.controller');router[_0x2966('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2966('0xa')](_0x2966('0xb'),auth['isAuthenticated'](),controller[_0x2966('0xc')]);router[_0x2966('0xa')]('/:id',auth[_0x2966('0xd')](),controller[_0x2966('0xe')]);router['post']('/',auth[_0x2966('0xd')](),controller[_0x2966('0xf')]);router[_0x2966('0x10')](_0x2966('0x11'),auth[_0x2966('0xd')](),controller['update']);router[_0x2966('0x12')](_0x2966('0x11'),auth[_0x2966('0xd')](),controller[_0x2966('0x13')]);module[_0x2966('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 6f4b6ee..a4bfe70 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 _0x4f93=['exports','STRING','INTEGER','sequelize'];(function(_0x4a71ed,_0x45411c){var _0x1ad111=function(_0x1fbaa6){while(--_0x1fbaa6){_0x4a71ed['push'](_0x4a71ed['shift']());}};_0x1ad111(++_0x45411c);}(_0x4f93,0x12b));var _0x34f9=function(_0x4d1ab0,_0x36a54a){_0x4d1ab0=_0x4d1ab0-0x0;var _0x51c2c5=_0x4f93[_0x4d1ab0];return _0x51c2c5;};'use strict';var Sequelize=require(_0x34f9('0x0'));module[_0x34f9('0x1')]={'name':{'type':Sequelize[_0x34f9('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x34f9('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x34f9('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x168e=['STRING','INTEGER','exports'];(function(_0x107343,_0x156fec){var _0xd30c72=function(_0x3a529b){while(--_0x3a529b){_0x107343['push'](_0x107343['shift']());}};_0xd30c72(++_0x156fec);}(_0x168e,0xb3));var _0xe168=function(_0x3c34a4,_0xf5ac44){_0x3c34a4=_0x3c34a4-0x0;var _0x3400b5=_0x168e[_0x3c34a4];return _0x3400b5;};'use strict';var Sequelize=require('sequelize');module[_0xe168('0x0')]={'name':{'type':Sequelize[_0xe168('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xe168('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe168('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 31383b3..0d463d2 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 _0x896e=['hasOwnProperty','nolimit','order','sort','where','merge','filter','UserProfileResource','includeAll','include','findAll','rows','catch','keys','length','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','destroy','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x896e,0x1e9));var _0xe896=function(_0x416f27,_0x23bb62){_0x416f27=_0x416f27-0x0;var _0x42f39e=_0x896e[_0x416f27];return _0x42f39e;};'use strict';var emlformat=require(_0xe896('0x0'));var rimraf=require(_0xe896('0x1'));var zipdir=require(_0xe896('0x2'));var jsonpatch=require(_0xe896('0x3'));var rp=require(_0xe896('0x4'));var moment=require(_0xe896('0x5'));var BPromise=require(_0xe896('0x6'));var Mustache=require(_0xe896('0x7'));var util=require(_0xe896('0x8'));var path=require(_0xe896('0x9'));var sox=require(_0xe896('0xa'));var csv=require(_0xe896('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe896('0xc'));var _=require(_0xe896('0xd'));var squel=require(_0xe896('0xe'));var crypto=require(_0xe896('0xf'));var jsforce=require(_0xe896('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe896('0xb'));var querystring=require(_0xe896('0x11'));var Papa=require(_0xe896('0x12'));var Redis=require('ioredis');var authService=require(_0xe896('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe896('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe896('0x15'))(_0xe896('0x16'));var utils=require(_0xe896('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe896('0x18'));var db=require(_0xe896('0x19'))['db'];function respondWithStatusCode(_0x3e8ac9,_0x580aac){_0x580aac=_0x580aac||0xcc;return function(_0x2aa522){if(_0x2aa522){return _0x3e8ac9[_0xe896('0x1a')](_0x580aac);}return _0x3e8ac9[_0xe896('0x1b')](_0x580aac)['end']();};}function respondWithResult(_0x2d0e46,_0x7dcf8a){_0x7dcf8a=_0x7dcf8a||0xc8;return function(_0x1e7ef8){if(_0x1e7ef8){return _0x2d0e46['status'](_0x7dcf8a)['json'](_0x1e7ef8);}};}function respondWithFilteredResult(_0x446ce2,_0x25606b){return function(_0x51e7b7){if(_0x51e7b7){var _0x5e78d6=typeof _0x25606b[_0xe896('0x1c')]===_0xe896('0x1d')&&typeof _0x25606b['limit']===_0xe896('0x1d');var _0x4e062a=_0x51e7b7[_0xe896('0x1e')];var _0x32f86d=_0x5e78d6?0x0:_0x25606b[_0xe896('0x1c')];var _0x5dc89d=_0x5e78d6?_0x51e7b7[_0xe896('0x1e')]:_0x25606b[_0xe896('0x1c')]+_0x25606b[_0xe896('0x1f')];var _0xbebbe1;if(_0x5dc89d>=_0x4e062a){_0x5dc89d=_0x4e062a;_0xbebbe1=0xc8;}else{_0xbebbe1=0xce;}_0x446ce2[_0xe896('0x1b')](_0xbebbe1);return _0x446ce2[_0xe896('0x20')](_0xe896('0x21'),_0x32f86d+'-'+_0x5dc89d+'/'+_0x4e062a)[_0xe896('0x22')](_0x51e7b7);}return null;};}function patchUpdates(_0x49547b){return function(_0x180d46){try{jsonpatch['apply'](_0x180d46,_0x49547b,!![]);}catch(_0x5d2c8d){return BPromise[_0xe896('0x23')](_0x5d2c8d);}return _0x180d46[_0xe896('0x24')]();};}function saveUpdates(_0x40502b,_0xeeec7c){return function(_0x498469){if(_0x498469){return _0x498469[_0xe896('0x25')](_0x40502b)['then'](function(_0x5001f7){return _0x5001f7;});}return null;};}function removeEntity(_0x45dd49,_0x41e689){return function(_0x1e952a){if(_0x1e952a){return _0x1e952a[_0xe896('0x26')]()[_0xe896('0x27')](function(){_0x45dd49[_0xe896('0x1b')](0xcc)[_0xe896('0x28')]();});}};}function handleEntityNotFound(_0x4b71cc,_0x390128){return function(_0x163a75){if(!_0x163a75){_0x4b71cc[_0xe896('0x1a')](0x194);}return _0x163a75;};}function handleError(_0x569d5f,_0x26635e){_0x26635e=_0x26635e||0x1f4;return function(_0xd50fe2){logger[_0xe896('0x29')](_0xd50fe2[_0xe896('0x2a')]);if(_0xd50fe2[_0xe896('0x2b')]){delete _0xd50fe2[_0xe896('0x2b')];}_0x569d5f['status'](_0x26635e)[_0xe896('0x2c')](_0xd50fe2);};}exports[_0xe896('0x2d')]=function(_0x201653,_0xbfb15b){var _0xace03f={},_0x5e0d9b={},_0x47c268={'count':0x0,'rows':[]};var _0x5c7dae=_['map'](db['UserProfileResource'][_0xe896('0x2e')],function(_0x29a18e){return{'name':_0x29a18e[_0xe896('0x2f')],'type':_0x29a18e[_0xe896('0x30')][_0xe896('0x31')]};});_0x5e0d9b[_0xe896('0x32')]=_[_0xe896('0x33')](_0x5c7dae,_0xe896('0x2b'));_0x5e0d9b['query']=_['keys'](_0x201653[_0xe896('0x34')]);_0x5e0d9b[_0xe896('0x35')]=_[_0xe896('0x36')](_0x5e0d9b[_0xe896('0x32')],_0x5e0d9b['query']);_0xace03f[_0xe896('0x37')]=_['intersection'](_0x5e0d9b['model'],qs[_0xe896('0x38')](_0x201653[_0xe896('0x34')][_0xe896('0x38')]));_0xace03f['attributes']=_0xace03f['attributes']['length']?_0xace03f[_0xe896('0x37')]:_0x5e0d9b[_0xe896('0x32')];if(!_0x201653[_0xe896('0x34')][_0xe896('0x39')](_0xe896('0x3a'))){_0xace03f['limit']=qs[_0xe896('0x1f')](_0x201653[_0xe896('0x34')][_0xe896('0x1f')]);_0xace03f[_0xe896('0x1c')]=qs[_0xe896('0x1c')](_0x201653[_0xe896('0x34')][_0xe896('0x1c')]);}_0xace03f[_0xe896('0x3b')]=qs['sort'](_0x201653[_0xe896('0x34')][_0xe896('0x3c')]);_0xace03f['where']=qs[_0xe896('0x35')](_['pick'](_0x201653[_0xe896('0x34')],_0x5e0d9b['filters']),_0x5c7dae);if(_0x201653[_0xe896('0x34')]['filter']){_0xace03f[_0xe896('0x3d')]=_[_0xe896('0x3e')](_0xace03f[_0xe896('0x3d')],{'$or':_[_0xe896('0x33')](_0x5c7dae,function(_0xeb9bbf){if(_0xeb9bbf['type']!=='VIRTUAL'){var _0x203aea={};_0x203aea[_0xeb9bbf[_0xe896('0x2b')]]={'$like':'%'+_0x201653[_0xe896('0x34')][_0xe896('0x3f')]+'%'};return _0x203aea;}})});}_0xace03f=_[_0xe896('0x3e')]({},_0xace03f,_0x201653['options']);var _0x5b8131={'where':_0xace03f[_0xe896('0x3d')]};return db[_0xe896('0x40')]['count'](_0x5b8131)['then'](function(_0x19d2fd){_0x47c268[_0xe896('0x1e')]=_0x19d2fd;if(_0x201653[_0xe896('0x34')][_0xe896('0x41')]){_0xace03f[_0xe896('0x42')]=[{'all':!![]}];}return db[_0xe896('0x40')][_0xe896('0x43')](_0xace03f);})[_0xe896('0x27')](function(_0x372c71){_0x47c268[_0xe896('0x44')]=_0x372c71;return _0x47c268;})[_0xe896('0x27')](respondWithFilteredResult(_0xbfb15b,_0xace03f))[_0xe896('0x45')](handleError(_0xbfb15b,null));};exports['show']=function(_0x1e5434,_0x143ad4){var _0x59b97f={'raw':![],'where':{'id':_0x1e5434['params']['id']}},_0x57366b={};_0x57366b[_0xe896('0x32')]=_[_0xe896('0x46')](db[_0xe896('0x40')]['rawAttributes']);_0x57366b[_0xe896('0x34')]=_[_0xe896('0x46')](_0x1e5434['query']);_0x57366b['filters']=_['intersection'](_0x57366b[_0xe896('0x32')],_0x57366b[_0xe896('0x34')]);_0x59b97f[_0xe896('0x37')]=_[_0xe896('0x36')](_0x57366b[_0xe896('0x32')],qs[_0xe896('0x38')](_0x1e5434['query'][_0xe896('0x38')]));_0x59b97f[_0xe896('0x37')]=_0x59b97f['attributes'][_0xe896('0x47')]?_0x59b97f[_0xe896('0x37')]:_0x57366b[_0xe896('0x32')];if(_0x1e5434[_0xe896('0x34')]['includeAll']){_0x59b97f[_0xe896('0x42')]=[{'all':!![]}];}_0x59b97f=_[_0xe896('0x3e')]({},_0x59b97f,_0x1e5434[_0xe896('0x48')]);return db[_0xe896('0x40')][_0xe896('0x49')](_0x59b97f)[_0xe896('0x27')](handleEntityNotFound(_0x143ad4,null))['then'](respondWithResult(_0x143ad4,null))[_0xe896('0x45')](handleError(_0x143ad4,null));};exports['create']=function(_0x234a22,_0x1c6ae1){return db[_0xe896('0x40')][_0xe896('0x4a')](_0x234a22[_0xe896('0x4b')],{})[_0xe896('0x27')](respondWithResult(_0x1c6ae1,0xc9))['catch'](handleError(_0x1c6ae1,null));};exports[_0xe896('0x25')]=function(_0x206ad3,_0x4818cd){if(_0x206ad3[_0xe896('0x4b')]['id']){delete _0x206ad3[_0xe896('0x4b')]['id'];}return db['UserProfileResource'][_0xe896('0x49')]({'where':{'id':_0x206ad3['params']['id']}})[_0xe896('0x27')](handleEntityNotFound(_0x4818cd,null))[_0xe896('0x27')](saveUpdates(_0x206ad3[_0xe896('0x4b')],null))[_0xe896('0x27')](respondWithResult(_0x4818cd,null))[_0xe896('0x45')](handleError(_0x4818cd,null));};exports['destroy']=function(_0x1fa3fd,_0x819c8a){return db[_0xe896('0x40')]['find']({'where':{'id':_0x1fa3fd[_0xe896('0x4c')]['id']}})['then'](handleEntityNotFound(_0x819c8a,null))['then'](removeEntity(_0x819c8a,null))[_0xe896('0x45')](handleError(_0x819c8a,null));};exports[_0xe896('0x4d')]=function(_0x57aed3,_0x343adb){return db[_0xe896('0x40')]['describe']()['then'](respondWithResult(_0x343adb,null))[_0xe896('0x45')](handleError(_0x343adb,null));}; \ No newline at end of file +var _0xe3da=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x267398,_0x4034a0){var _0x10e9c0=function(_0x37db28){while(--_0x37db28){_0x267398['push'](_0x267398['shift']());}};_0x10e9c0(++_0x4034a0);}(_0xe3da,0x1cd));var _0xae3d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe3da[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['create'](_0x38f92d['body'],{})['then'](respondWithResult(_0x4ed0f9,0xc9))[_0xae3d('0x48')](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0x39f213,_0x6fa6c){if(_0x39f213['body']['id']){delete _0x39f213['body']['id'];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x39f213[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x6fa6c,null))['then'](saveUpdates(_0x39f213[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x6fa6c,null))[_0xae3d('0x48')](handleError(_0x6fa6c,null));};exports[_0xae3d('0x29')]=function(_0x2a6a24,_0x38ccf1){return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x2a6a24[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x38ccf1,null))[_0xae3d('0x28')](removeEntity(_0x38ccf1,null))[_0xae3d('0x48')](handleError(_0x38ccf1,null));};exports['describe']=function(_0x4f4694,_0x4c6dab){return db[_0xae3d('0x2f')][_0xae3d('0x50')]()['then'](respondWithResult(_0x4c6dab,null))[_0xae3d('0x48')](handleError(_0x4c6dab,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index bea8b73..7f8c37e 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 _0xa181=['compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources'];(function(_0x25d346,_0x5f32e8){var _0x259eac=function(_0x1efffa){while(--_0x1efffa){_0x25d346['push'](_0x25d346['shift']());}};_0x259eac(++_0x5f32e8);}(_0xa181,0x146));var _0x1a18=function(_0x2505c0,_0x19ff15){_0x2505c0=_0x2505c0-0x0;var _0x153162=_0xa181[_0x2505c0];return _0x153162;};'use strict';var _=require(_0x1a18('0x0'));var util=require(_0x1a18('0x1'));var logger=require(_0x1a18('0x2'))(_0x1a18('0x3'));var moment=require(_0x1a18('0x4'));var BPromise=require(_0x1a18('0x5'));var rp=require(_0x1a18('0x6'));var fs=require('fs');var path=require(_0x1a18('0x7'));var rimraf=require(_0x1a18('0x8'));var config=require('../../config/environment');var attributes=require(_0x1a18('0x9'));module[_0x1a18('0xa')]=function(_0x5468d5,_0x2e22ce){return _0x5468d5[_0x1a18('0xb')](_0x1a18('0xc'),attributes,{'tableName':_0x1a18('0xd'),'paranoid':![],'indexes':[{'name':_0x1a18('0xe'),'fields':[_0x1a18('0xf'),_0x1a18('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdf3c=['UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define'];(function(_0x28caf4,_0x797e55){var _0x503f93=function(_0x1dca13){while(--_0x1dca13){_0x28caf4['push'](_0x28caf4['shift']());}};_0x503f93(++_0x797e55);}(_0xdf3c,0x148));var _0xcdf3=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xdf3c[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0xcdf3('0x0'));var util=require(_0xcdf3('0x1'));var logger=require(_0xcdf3('0x2'))(_0xcdf3('0x3'));var moment=require(_0xcdf3('0x4'));var BPromise=require('bluebird');var rp=require(_0xcdf3('0x5'));var fs=require('fs');var path=require(_0xcdf3('0x6'));var rimraf=require(_0xcdf3('0x7'));var config=require(_0xcdf3('0x8'));var attributes=require(_0xcdf3('0x9'));module[_0xcdf3('0xa')]=function(_0x5a5c99,_0x4eb974){return _0x5a5c99[_0xcdf3('0xb')](_0xcdf3('0xc'),attributes,{'tableName':_0xcdf3('0xd'),'paranoid':![],'indexes':[{'name':_0xcdf3('0xe'),'fields':[_0xcdf3('0xf'),_0xcdf3('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 39d1cc0..6923a83 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 _0x2966=['UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x406115,_0x19f7a1){var _0xbbabdb=function(_0x28554d){while(--_0x28554d){_0x406115['push'](_0x406115['shift']());}};_0xbbabdb(++_0x19f7a1);}(_0x2966,0x8b));var _0x6296=function(_0x9f9edc,_0x1704a8){_0x9f9edc=_0x9f9edc-0x0;var _0x3d21d2=_0x2966[_0x9f9edc];return _0x3d21d2;};'use strict';var _=require(_0x6296('0x0'));var util=require(_0x6296('0x1'));var moment=require('moment');var BPromise=require(_0x6296('0x2'));var rs=require(_0x6296('0x3'));var fs=require('fs');var Redis=require(_0x6296('0x4'));var db=require(_0x6296('0x5'))['db'];var utils=require(_0x6296('0x6'));var logger=require(_0x6296('0x7'))(_0x6296('0x8'));var config=require(_0x6296('0x9'));var jayson=require(_0x6296('0xa'));var client=jayson[_0x6296('0xb')][_0x6296('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56cdbf,_0x5f178b,_0x50fe3e){return new BPromise(function(_0xb54831,_0xcbbef6){return client[_0x6296('0xd')](_0x56cdbf,_0x50fe3e)[_0x6296('0xe')](function(_0x553784){logger['info'](_0x6296('0xf'),_0x5f178b,_0x6296('0x10'));logger[_0x6296('0x11')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x5f178b,_0x6296('0x10'),JSON[_0x6296('0x12')](_0x553784));if(_0x553784[_0x6296('0x13')]){if(_0x553784[_0x6296('0x13')][_0x6296('0x14')]===0x1f4){logger[_0x6296('0x13')](_0x6296('0xf'),_0x5f178b,_0x553784['error'][_0x6296('0x15')]);return _0xcbbef6(_0x553784[_0x6296('0x13')][_0x6296('0x15')]);}logger['error'](_0x6296('0xf'),_0x5f178b,_0x553784[_0x6296('0x13')]['message']);return _0xb54831(_0x553784[_0x6296('0x13')]['message']);}else{logger['info'](_0x6296('0xf'),_0x5f178b,'request\x20sent');_0xb54831(_0x553784['result'][_0x6296('0x15')]);}})['catch'](function(_0x573bd9){logger[_0x6296('0x13')](_0x6296('0xf'),_0x5f178b,_0x573bd9);_0xcbbef6(_0x573bd9);});});} \ No newline at end of file +var _0x6688=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x6688,0x81));var _0x8668=function(_0x211702,_0x906731){_0x211702=_0x211702-0x0;var _0x21a342=_0x6688[_0x211702];return _0x21a342;};'use strict';var _=require(_0x8668('0x0'));var util=require(_0x8668('0x1'));var moment=require(_0x8668('0x2'));var BPromise=require('bluebird');var rs=require(_0x8668('0x3'));var fs=require('fs');var Redis=require(_0x8668('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8668('0x5'));var logger=require(_0x8668('0x6'))(_0x8668('0x7'));var config=require(_0x8668('0x8'));var jayson=require(_0x8668('0x9'));var client=jayson['client'][_0x8668('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b2baf,_0x50c412,_0x46ef19){return new BPromise(function(_0xa0f68c,_0x1266ee){return client[_0x8668('0xb')](_0x5b2baf,_0x46ef19)[_0x8668('0xc')](function(_0x23f90c){logger[_0x8668('0xd')](_0x8668('0xe'),_0x50c412,_0x8668('0xf'));logger['debug'](_0x8668('0x10'),_0x50c412,_0x8668('0xf'),JSON['stringify'](_0x23f90c));if(_0x23f90c[_0x8668('0x11')]){if(_0x23f90c[_0x8668('0x11')][_0x8668('0x12')]===0x1f4){logger[_0x8668('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x50c412,_0x23f90c[_0x8668('0x11')][_0x8668('0x13')]);return _0x1266ee(_0x23f90c['error'][_0x8668('0x13')]);}logger[_0x8668('0x11')](_0x8668('0xe'),_0x50c412,_0x23f90c[_0x8668('0x11')][_0x8668('0x13')]);return _0xa0f68c(_0x23f90c[_0x8668('0x11')][_0x8668('0x13')]);}else{logger[_0x8668('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x50c412,_0x8668('0xf'));_0xa0f68c(_0x23f90c[_0x8668('0x14')][_0x8668('0x13')]);}})[_0x8668('0x15')](function(_0x40f83b){logger[_0x8668('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x50c412,_0x40f83b);_0x1266ee(_0x40f83b);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index dda200c..9028831 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 _0xd974=['multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','show','put','update','destroy','exports'];(function(_0x2d6453,_0x3880d5){var _0xe49b88=function(_0x514d02){while(--_0x514d02){_0x2d6453['push'](_0x2d6453['shift']());}};_0xe49b88(++_0x3880d5);}(_0xd974,0xa2));var _0x4d97=function(_0x3f48a7,_0x3505e1){_0x3f48a7=_0x3f48a7-0x0;var _0x523b58=_0xd974[_0x3f48a7];return _0x523b58;};'use strict';var multer=require(_0x4d97('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4d97('0x1'));var express=require('express');var router=express[_0x4d97('0x2')]();var fs_extra=require(_0x4d97('0x3'));var auth=require(_0x4d97('0x4'));var interaction=require(_0x4d97('0x5'));var config=require(_0x4d97('0x6'));var controller=require(_0x4d97('0x7'));router[_0x4d97('0x8')]('/',auth[_0x4d97('0x9')](),controller[_0x4d97('0xa')]);router[_0x4d97('0x8')](_0x4d97('0xb'),auth[_0x4d97('0x9')](),controller['describe']);router[_0x4d97('0x8')](_0x4d97('0xc'),auth[_0x4d97('0x9')](),controller[_0x4d97('0xd')]);router['post']('/',auth[_0x4d97('0x9')](),controller['create']);router[_0x4d97('0xe')](_0x4d97('0xc'),auth[_0x4d97('0x9')](),controller[_0x4d97('0xf')]);router['delete'](_0x4d97('0xc'),auth[_0x4d97('0x9')](),controller[_0x4d97('0x10')]);module[_0x4d97('0x11')]=router; \ No newline at end of file +var _0xecbd=['fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','index','describe','/:id','show','post','create','isAuthenticated','update','delete','destroy','path','connect-timeout','express','Router'];(function(_0x369534,_0x5557c4){var _0x524bf9=function(_0x24c6fb){while(--_0x24c6fb){_0x369534['push'](_0x369534['shift']());}};_0x524bf9(++_0x5557c4);}(_0xecbd,0x165));var _0xdecb=function(_0x252192,_0x4fba17){_0x252192=_0x252192-0x0;var _0x4108ad=_0xecbd[_0x252192];return _0x4108ad;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdecb('0x0'));var timeout=require(_0xdecb('0x1'));var express=require(_0xdecb('0x2'));var router=express[_0xdecb('0x3')]();var fs_extra=require(_0xdecb('0x4'));var auth=require(_0xdecb('0x5'));var interaction=require(_0xdecb('0x6'));var config=require('../../config/environment');var controller=require(_0xdecb('0x7'));router[_0xdecb('0x8')]('/',auth['isAuthenticated'](),controller[_0xdecb('0x9')]);router[_0xdecb('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xdecb('0xa')]);router[_0xdecb('0x8')](_0xdecb('0xb'),auth['isAuthenticated'](),controller[_0xdecb('0xc')]);router[_0xdecb('0xd')]('/',auth['isAuthenticated'](),controller[_0xdecb('0xe')]);router['put'](_0xdecb('0xb'),auth[_0xdecb('0xf')](),controller[_0xdecb('0x10')]);router[_0xdecb('0x11')](_0xdecb('0xb'),auth['isAuthenticated'](),controller[_0xdecb('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 3fea4be..017f78f 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 _0x69d3=['crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN','join','getDataValue'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x69d3,0xda));var _0x369d=function(_0x939d1f,_0x14c16c){_0x939d1f=_0x939d1f-0x0;var _0x19642c=_0x69d3[_0x939d1f];return _0x19642c;};'use strict';var Sequelize=require(_0x369d('0x0'));module[_0x369d('0x1')]={'name':{'type':Sequelize[_0x369d('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x369d('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x369d('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xe38740){this['setDataValue']('crudPermissions',_0xe38740?_0xe38740[_0x369d('0x5')](''):[]);},'get':function(){return this[_0x369d('0x6')](_0x369d('0x7'))?this[_0x369d('0x6')](_0x369d('0x7'))[_0x369d('0x8')](''):[];}}}; \ No newline at end of file +var _0x1c7c=['setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING','BOOLEAN'];(function(_0x2da45d,_0x35397b){var _0x1012a0=function(_0x2babc3){while(--_0x2babc3){_0x2da45d['push'](_0x2da45d['shift']());}};_0x1012a0(++_0x35397b);}(_0x1c7c,0x164));var _0xc1c7=function(_0x3f93af,_0x5c9406){_0x3f93af=_0x3f93af-0x0;var _0x4d4723=_0x1c7c[_0x3f93af];return _0x4d4723;};'use strict';var Sequelize=require(_0xc1c7('0x0'));module[_0xc1c7('0x1')]={'name':{'type':Sequelize[_0xc1c7('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xc1c7('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xc1c7('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xc1c7('0x2')],'set':function(_0x20dad3){this[_0xc1c7('0x4')](_0xc1c7('0x5'),_0x20dad3?_0x20dad3[_0xc1c7('0x6')](''):[]);},'get':function(){return this[_0xc1c7('0x7')](_0xc1c7('0x5'))?this[_0xc1c7('0x7')](_0xc1c7('0x5'))[_0xc1c7('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 8804712..9759e93 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 _0xe522=['pick','filter','type','merge','include','findAll','rows','catch','length','includeAll','options','create','body','params','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','limit','undefined','count','offset','set','Content-Range','json','reject','save','update','then','destroy','error','name','map','UserProfileSection','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x58053e,_0x5c5ba3){var _0x50f82c=function(_0x4d2311){while(--_0x4d2311){_0x58053e['push'](_0x58053e['shift']());}};_0x50f82c(++_0x5c5ba3);}(_0xe522,0x182));var _0x2e52=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xe522[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require(_0x2e52('0x0'));var rimraf=require(_0x2e52('0x1'));var zipdir=require(_0x2e52('0x2'));var jsonpatch=require(_0x2e52('0x3'));var rp=require(_0x2e52('0x4'));var moment=require('moment');var BPromise=require(_0x2e52('0x5'));var Mustache=require(_0x2e52('0x6'));var util=require('util');var path=require(_0x2e52('0x7'));var sox=require(_0x2e52('0x8'));var csv=require(_0x2e52('0x9'));var ejs=require(_0x2e52('0xa'));var fs=require('fs');var fs_extra=require(_0x2e52('0xb'));var _=require(_0x2e52('0xc'));var squel=require(_0x2e52('0xd'));var crypto=require(_0x2e52('0xe'));var jsforce=require(_0x2e52('0xf'));var deskjs=require(_0x2e52('0x10'));var toCsv=require(_0x2e52('0x9'));var querystring=require(_0x2e52('0x11'));var Papa=require(_0x2e52('0x12'));var Redis=require(_0x2e52('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2e52('0x14'));var hardwareService=require(_0x2e52('0x15'));var logger=require(_0x2e52('0x16'))(_0x2e52('0x17'));var utils=require('../../config/utils');var config=require(_0x2e52('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2e52('0x19'))['db'];function respondWithStatusCode(_0x2432e3,_0x1c36e8){_0x1c36e8=_0x1c36e8||0xcc;return function(_0x3bd9bf){if(_0x3bd9bf){return _0x2432e3['sendStatus'](_0x1c36e8);}return _0x2432e3[_0x2e52('0x1a')](_0x1c36e8)[_0x2e52('0x1b')]();};}function respondWithResult(_0x337737,_0x322755){_0x322755=_0x322755||0xc8;return function(_0x45fc03){if(_0x45fc03){return _0x337737[_0x2e52('0x1a')](_0x322755)['json'](_0x45fc03);}};}function respondWithFilteredResult(_0x52d6a7,_0x418723){return function(_0x2dc51d){if(_0x2dc51d){var _0xf345b=typeof _0x418723['offset']==='undefined'&&typeof _0x418723[_0x2e52('0x1c')]===_0x2e52('0x1d');var _0xc64939=_0x2dc51d[_0x2e52('0x1e')];var _0x1eb3f1=_0xf345b?0x0:_0x418723[_0x2e52('0x1f')];var _0x21584b=_0xf345b?_0x2dc51d['count']:_0x418723[_0x2e52('0x1f')]+_0x418723['limit'];var _0xe0651e;if(_0x21584b>=_0xc64939){_0x21584b=_0xc64939;_0xe0651e=0xc8;}else{_0xe0651e=0xce;}_0x52d6a7[_0x2e52('0x1a')](_0xe0651e);return _0x52d6a7[_0x2e52('0x20')](_0x2e52('0x21'),_0x1eb3f1+'-'+_0x21584b+'/'+_0xc64939)[_0x2e52('0x22')](_0x2dc51d);}return null;};}function patchUpdates(_0x232dda){return function(_0x853f9f){try{jsonpatch['apply'](_0x853f9f,_0x232dda,!![]);}catch(_0xe5bb5c){return BPromise[_0x2e52('0x23')](_0xe5bb5c);}return _0x853f9f[_0x2e52('0x24')]();};}function saveUpdates(_0x502e1d,_0x406796){return function(_0x157740){if(_0x157740){return _0x157740[_0x2e52('0x25')](_0x502e1d)[_0x2e52('0x26')](function(_0x3c9ce9){return _0x3c9ce9;});}return null;};}function removeEntity(_0x4a590e,_0x35e8cf){return function(_0x1e9c52){if(_0x1e9c52){return _0x1e9c52[_0x2e52('0x27')]()[_0x2e52('0x26')](function(){_0x4a590e[_0x2e52('0x1a')](0xcc)[_0x2e52('0x1b')]();});}};}function handleEntityNotFound(_0x585b11,_0x4a1574){return function(_0x59c476){if(!_0x59c476){_0x585b11['sendStatus'](0x194);}return _0x59c476;};}function handleError(_0x5347c3,_0x37e6af){_0x37e6af=_0x37e6af||0x1f4;return function(_0x204146){logger[_0x2e52('0x28')](_0x204146['stack']);if(_0x204146[_0x2e52('0x29')]){delete _0x204146[_0x2e52('0x29')];}_0x5347c3[_0x2e52('0x1a')](_0x37e6af)['send'](_0x204146);};}exports['index']=function(_0x4b2777,_0x2a048c){var _0x1cc387={},_0x4e7ecb={},_0x34564f={'count':0x0,'rows':[]};var _0x5809ff=_[_0x2e52('0x2a')](db[_0x2e52('0x2b')]['rawAttributes'],function(_0x30fe6f){return{'name':_0x30fe6f[_0x2e52('0x2c')],'type':_0x30fe6f['type'][_0x2e52('0x2d')]};});_0x4e7ecb[_0x2e52('0x2e')]=_[_0x2e52('0x2a')](_0x5809ff,_0x2e52('0x29'));_0x4e7ecb[_0x2e52('0x2f')]=_[_0x2e52('0x30')](_0x4b2777['query']);_0x4e7ecb['filters']=_[_0x2e52('0x31')](_0x4e7ecb[_0x2e52('0x2e')],_0x4e7ecb[_0x2e52('0x2f')]);_0x1cc387['attributes']=_[_0x2e52('0x31')](_0x4e7ecb[_0x2e52('0x2e')],qs['fields'](_0x4b2777['query'][_0x2e52('0x32')]));_0x1cc387[_0x2e52('0x33')]=_0x1cc387[_0x2e52('0x33')]['length']?_0x1cc387[_0x2e52('0x33')]:_0x4e7ecb[_0x2e52('0x2e')];if(!_0x4b2777[_0x2e52('0x2f')][_0x2e52('0x34')](_0x2e52('0x35'))){_0x1cc387[_0x2e52('0x1c')]=qs[_0x2e52('0x1c')](_0x4b2777[_0x2e52('0x2f')][_0x2e52('0x1c')]);_0x1cc387['offset']=qs['offset'](_0x4b2777[_0x2e52('0x2f')][_0x2e52('0x1f')]);}_0x1cc387[_0x2e52('0x36')]=qs['sort'](_0x4b2777[_0x2e52('0x2f')][_0x2e52('0x37')]);_0x1cc387[_0x2e52('0x38')]=qs[_0x2e52('0x39')](_[_0x2e52('0x3a')](_0x4b2777[_0x2e52('0x2f')],_0x4e7ecb['filters']),_0x5809ff);if(_0x4b2777[_0x2e52('0x2f')][_0x2e52('0x3b')]){_0x1cc387[_0x2e52('0x38')]=_['merge'](_0x1cc387[_0x2e52('0x38')],{'$or':_[_0x2e52('0x2a')](_0x5809ff,function(_0xef6e99){if(_0xef6e99[_0x2e52('0x3c')]!=='VIRTUAL'){var _0x172299={};_0x172299[_0xef6e99[_0x2e52('0x29')]]={'$like':'%'+_0x4b2777[_0x2e52('0x2f')][_0x2e52('0x3b')]+'%'};return _0x172299;}})});}_0x1cc387=_[_0x2e52('0x3d')]({},_0x1cc387,_0x4b2777['options']);var _0x522d13={'where':_0x1cc387[_0x2e52('0x38')]};return db[_0x2e52('0x2b')]['count'](_0x522d13)[_0x2e52('0x26')](function(_0x3c42d8){_0x34564f[_0x2e52('0x1e')]=_0x3c42d8;if(_0x4b2777[_0x2e52('0x2f')]['includeAll']){_0x1cc387[_0x2e52('0x3e')]=[{'all':!![]}];}return db[_0x2e52('0x2b')][_0x2e52('0x3f')](_0x1cc387);})[_0x2e52('0x26')](function(_0x14dc14){_0x34564f[_0x2e52('0x40')]=_0x14dc14;return _0x34564f;})[_0x2e52('0x26')](respondWithFilteredResult(_0x2a048c,_0x1cc387))[_0x2e52('0x41')](handleError(_0x2a048c,null));};exports['show']=function(_0x1976c9,_0x291567){var _0x17eac4={'raw':![],'where':{'id':_0x1976c9['params']['id']}},_0x1f4c80={};_0x1f4c80[_0x2e52('0x2e')]=_['keys'](db[_0x2e52('0x2b')]['rawAttributes']);_0x1f4c80[_0x2e52('0x2f')]=_['keys'](_0x1976c9[_0x2e52('0x2f')]);_0x1f4c80[_0x2e52('0x39')]=_[_0x2e52('0x31')](_0x1f4c80[_0x2e52('0x2e')],_0x1f4c80['query']);_0x17eac4[_0x2e52('0x33')]=_[_0x2e52('0x31')](_0x1f4c80[_0x2e52('0x2e')],qs['fields'](_0x1976c9['query']['fields']));_0x17eac4[_0x2e52('0x33')]=_0x17eac4[_0x2e52('0x33')][_0x2e52('0x42')]?_0x17eac4[_0x2e52('0x33')]:_0x1f4c80[_0x2e52('0x2e')];if(_0x1976c9[_0x2e52('0x2f')][_0x2e52('0x43')]){_0x17eac4[_0x2e52('0x3e')]=[{'all':!![]}];}_0x17eac4=_[_0x2e52('0x3d')]({},_0x17eac4,_0x1976c9[_0x2e52('0x44')]);return db[_0x2e52('0x2b')]['find'](_0x17eac4)[_0x2e52('0x26')](handleEntityNotFound(_0x291567,null))['then'](respondWithResult(_0x291567,null))[_0x2e52('0x41')](handleError(_0x291567,null));};exports[_0x2e52('0x45')]=function(_0x137b53,_0x489893){return db[_0x2e52('0x2b')][_0x2e52('0x45')](_0x137b53[_0x2e52('0x46')],{})['then'](respondWithResult(_0x489893,0xc9))[_0x2e52('0x41')](handleError(_0x489893,null));};exports['update']=function(_0x52be45,_0x775250){if(_0x52be45['body']['id']){delete _0x52be45[_0x2e52('0x46')]['id'];}return db[_0x2e52('0x2b')]['find']({'where':{'id':_0x52be45[_0x2e52('0x47')]['id']}})[_0x2e52('0x26')](handleEntityNotFound(_0x775250,null))[_0x2e52('0x26')](saveUpdates(_0x52be45[_0x2e52('0x46')],null))[_0x2e52('0x26')](respondWithResult(_0x775250,null))[_0x2e52('0x41')](handleError(_0x775250,null));};exports['destroy']=function(_0x7c7042,_0x1d88dc){return db['UserProfileSection'][_0x2e52('0x48')]({'where':{'id':_0x7c7042['params']['id']}})[_0x2e52('0x26')](handleEntityNotFound(_0x1d88dc,null))[_0x2e52('0x26')](removeEntity(_0x1d88dc,null))[_0x2e52('0x41')](handleError(_0x1d88dc,null));};exports[_0x2e52('0x49')]=function(_0x39f9c0,_0x46df71){return db[_0x2e52('0x2b')][_0x2e52('0x49')]()[_0x2e52('0x26')](respondWithResult(_0x46df71,null))[_0x2e52('0x41')](handleError(_0x46df71,null));}; \ No newline at end of file +var _0x1c18=['includeAll','find','body','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','UserProfileSection','findAll','catch','show','params'];(function(_0x26ef79,_0x47529a){var _0x10bf47=function(_0xa02ce0){while(--_0xa02ce0){_0x26ef79['push'](_0x26ef79['shift']());}};_0x10bf47(++_0x47529a);}(_0x1c18,0x139));var _0x81c1=function(_0x3514bc,_0x2688a8){_0x3514bc=_0x3514bc-0x0;var _0x12d9a8=_0x1c18[_0x3514bc];return _0x12d9a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x81c1('0x0'));var zipdir=require(_0x81c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x81c1('0x2'));var moment=require(_0x81c1('0x3'));var BPromise=require(_0x81c1('0x4'));var Mustache=require('mustache');var util=require(_0x81c1('0x5'));var path=require(_0x81c1('0x6'));var sox=require('sox');var csv=require(_0x81c1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x81c1('0x8'));var squel=require(_0x81c1('0x9'));var crypto=require(_0x81c1('0xa'));var jsforce=require(_0x81c1('0xb'));var deskjs=require(_0x81c1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x81c1('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x81c1('0xe'));var qs=require(_0x81c1('0xf'));var as=require(_0x81c1('0x10'));var hardwareService=require(_0x81c1('0x11'));var logger=require(_0x81c1('0x12'))(_0x81c1('0x13'));var utils=require(_0x81c1('0x14'));var config=require(_0x81c1('0x15'));var licenseUtil=require(_0x81c1('0x16'));var db=require(_0x81c1('0x17'))['db'];function respondWithStatusCode(_0x397dad,_0x542c61){_0x542c61=_0x542c61||0xcc;return function(_0x27c050){if(_0x27c050){return _0x397dad[_0x81c1('0x18')](_0x542c61);}return _0x397dad[_0x81c1('0x19')](_0x542c61)[_0x81c1('0x1a')]();};}function respondWithResult(_0x4a95ca,_0x2e63ae){_0x2e63ae=_0x2e63ae||0xc8;return function(_0x48c148){if(_0x48c148){return _0x4a95ca[_0x81c1('0x19')](_0x2e63ae)['json'](_0x48c148);}};}function respondWithFilteredResult(_0x3e02f0,_0x2ea06c){return function(_0x229c70){if(_0x229c70){var _0x136f23=typeof _0x2ea06c[_0x81c1('0x1b')]===_0x81c1('0x1c')&&typeof _0x2ea06c[_0x81c1('0x1d')]===_0x81c1('0x1c');var _0x437517=_0x229c70[_0x81c1('0x1e')];var _0xa665b7=_0x136f23?0x0:_0x2ea06c['offset'];var _0x37f539=_0x136f23?_0x229c70[_0x81c1('0x1e')]:_0x2ea06c[_0x81c1('0x1b')]+_0x2ea06c['limit'];var _0x2ec234;if(_0x37f539>=_0x437517){_0x37f539=_0x437517;_0x2ec234=0xc8;}else{_0x2ec234=0xce;}_0x3e02f0[_0x81c1('0x19')](_0x2ec234);return _0x3e02f0[_0x81c1('0x1f')](_0x81c1('0x20'),_0xa665b7+'-'+_0x37f539+'/'+_0x437517)[_0x81c1('0x21')](_0x229c70);}return null;};}function patchUpdates(_0x4b15bf){return function(_0x1436ec){try{jsonpatch[_0x81c1('0x22')](_0x1436ec,_0x4b15bf,!![]);}catch(_0x442219){return BPromise['reject'](_0x442219);}return _0x1436ec[_0x81c1('0x23')]();};}function saveUpdates(_0x11d938,_0x4a8237){return function(_0x996093){if(_0x996093){return _0x996093[_0x81c1('0x24')](_0x11d938)[_0x81c1('0x25')](function(_0x555688){return _0x555688;});}return null;};}function removeEntity(_0x334244,_0x424fb3){return function(_0x3cff26){if(_0x3cff26){return _0x3cff26['destroy']()['then'](function(){_0x334244[_0x81c1('0x19')](0xcc)[_0x81c1('0x1a')]();});}};}function handleEntityNotFound(_0x455c76,_0x3b44de){return function(_0x17d91b){if(!_0x17d91b){_0x455c76[_0x81c1('0x18')](0x194);}return _0x17d91b;};}function handleError(_0xbfe400,_0x2e9e89){_0x2e9e89=_0x2e9e89||0x1f4;return function(_0x59607b){logger[_0x81c1('0x26')](_0x59607b[_0x81c1('0x27')]);if(_0x59607b[_0x81c1('0x28')]){delete _0x59607b[_0x81c1('0x28')];}_0xbfe400[_0x81c1('0x19')](_0x2e9e89)[_0x81c1('0x29')](_0x59607b);};}exports[_0x81c1('0x2a')]=function(_0x520bf3,_0x14082f){var _0x22a5a8={},_0x2f1e08={},_0x578098={'count':0x0,'rows':[]};var _0x3311e2=_['map'](db['UserProfileSection'][_0x81c1('0x2b')],function(_0x221d18){return{'name':_0x221d18[_0x81c1('0x2c')],'type':_0x221d18[_0x81c1('0x2d')][_0x81c1('0x2e')]};});_0x2f1e08['model']=_[_0x81c1('0x2f')](_0x3311e2,_0x81c1('0x28'));_0x2f1e08[_0x81c1('0x30')]=_[_0x81c1('0x31')](_0x520bf3[_0x81c1('0x30')]);_0x2f1e08[_0x81c1('0x32')]=_['intersection'](_0x2f1e08[_0x81c1('0x33')],_0x2f1e08[_0x81c1('0x30')]);_0x22a5a8['attributes']=_[_0x81c1('0x34')](_0x2f1e08['model'],qs[_0x81c1('0x35')](_0x520bf3[_0x81c1('0x30')]['fields']));_0x22a5a8[_0x81c1('0x36')]=_0x22a5a8[_0x81c1('0x36')][_0x81c1('0x37')]?_0x22a5a8[_0x81c1('0x36')]:_0x2f1e08['model'];if(!_0x520bf3[_0x81c1('0x30')][_0x81c1('0x38')](_0x81c1('0x39'))){_0x22a5a8[_0x81c1('0x1d')]=qs[_0x81c1('0x1d')](_0x520bf3[_0x81c1('0x30')][_0x81c1('0x1d')]);_0x22a5a8[_0x81c1('0x1b')]=qs[_0x81c1('0x1b')](_0x520bf3['query']['offset']);}_0x22a5a8[_0x81c1('0x3a')]=qs[_0x81c1('0x3b')](_0x520bf3[_0x81c1('0x30')][_0x81c1('0x3b')]);_0x22a5a8['where']=qs[_0x81c1('0x32')](_[_0x81c1('0x3c')](_0x520bf3[_0x81c1('0x30')],_0x2f1e08[_0x81c1('0x32')]),_0x3311e2);if(_0x520bf3[_0x81c1('0x30')]['filter']){_0x22a5a8[_0x81c1('0x3d')]=_[_0x81c1('0x3e')](_0x22a5a8[_0x81c1('0x3d')],{'$or':_[_0x81c1('0x2f')](_0x3311e2,function(_0x3b4575){if(_0x3b4575[_0x81c1('0x2d')]!==_0x81c1('0x3f')){var _0x547fa1={};_0x547fa1[_0x3b4575['name']]={'$like':'%'+_0x520bf3[_0x81c1('0x30')][_0x81c1('0x40')]+'%'};return _0x547fa1;}})});}_0x22a5a8=_[_0x81c1('0x3e')]({},_0x22a5a8,_0x520bf3[_0x81c1('0x41')]);var _0x45ebe2={'where':_0x22a5a8[_0x81c1('0x3d')]};return db['UserProfileSection'][_0x81c1('0x1e')](_0x45ebe2)['then'](function(_0x4e4c61){_0x578098[_0x81c1('0x1e')]=_0x4e4c61;if(_0x520bf3[_0x81c1('0x30')]['includeAll']){_0x22a5a8[_0x81c1('0x42')]=[{'all':!![]}];}return db[_0x81c1('0x43')][_0x81c1('0x44')](_0x22a5a8);})['then'](function(_0x25c1d7){_0x578098['rows']=_0x25c1d7;return _0x578098;})['then'](respondWithFilteredResult(_0x14082f,_0x22a5a8))[_0x81c1('0x45')](handleError(_0x14082f,null));};exports[_0x81c1('0x46')]=function(_0x3e9251,_0x34e5cc){var _0xcd7ce6={'raw':![],'where':{'id':_0x3e9251[_0x81c1('0x47')]['id']}},_0x391767={};_0x391767[_0x81c1('0x33')]=_['keys'](db[_0x81c1('0x43')][_0x81c1('0x2b')]);_0x391767[_0x81c1('0x30')]=_['keys'](_0x3e9251['query']);_0x391767[_0x81c1('0x32')]=_['intersection'](_0x391767[_0x81c1('0x33')],_0x391767[_0x81c1('0x30')]);_0xcd7ce6[_0x81c1('0x36')]=_[_0x81c1('0x34')](_0x391767['model'],qs[_0x81c1('0x35')](_0x3e9251[_0x81c1('0x30')][_0x81c1('0x35')]));_0xcd7ce6[_0x81c1('0x36')]=_0xcd7ce6[_0x81c1('0x36')][_0x81c1('0x37')]?_0xcd7ce6[_0x81c1('0x36')]:_0x391767[_0x81c1('0x33')];if(_0x3e9251[_0x81c1('0x30')][_0x81c1('0x48')]){_0xcd7ce6[_0x81c1('0x42')]=[{'all':!![]}];}_0xcd7ce6=_['merge']({},_0xcd7ce6,_0x3e9251['options']);return db[_0x81c1('0x43')][_0x81c1('0x49')](_0xcd7ce6)[_0x81c1('0x25')](handleEntityNotFound(_0x34e5cc,null))[_0x81c1('0x25')](respondWithResult(_0x34e5cc,null))[_0x81c1('0x45')](handleError(_0x34e5cc,null));};exports['create']=function(_0x2e8564,_0x344229){return db[_0x81c1('0x43')]['create'](_0x2e8564[_0x81c1('0x4a')],{})[_0x81c1('0x25')](respondWithResult(_0x344229,0xc9))[_0x81c1('0x45')](handleError(_0x344229,null));};exports[_0x81c1('0x24')]=function(_0x234614,_0x45bae6){if(_0x234614['body']['id']){delete _0x234614[_0x81c1('0x4a')]['id'];}return db['UserProfileSection'][_0x81c1('0x49')]({'where':{'id':_0x234614['params']['id']}})[_0x81c1('0x25')](handleEntityNotFound(_0x45bae6,null))[_0x81c1('0x25')](saveUpdates(_0x234614[_0x81c1('0x4a')],null))[_0x81c1('0x25')](respondWithResult(_0x45bae6,null))[_0x81c1('0x45')](handleError(_0x45bae6,null));};exports[_0x81c1('0x4b')]=function(_0x53068c,_0x21320c){return db[_0x81c1('0x43')][_0x81c1('0x49')]({'where':{'id':_0x53068c['params']['id']}})[_0x81c1('0x25')](handleEntityNotFound(_0x21320c,null))[_0x81c1('0x25')](removeEntity(_0x21320c,null))[_0x81c1('0x45')](handleError(_0x21320c,null));};exports[_0x81c1('0x4c')]=function(_0x39b601,_0x2abec9){return db['UserProfileSection']['describe']()[_0x81c1('0x25')](respondWithResult(_0x2abec9,null))[_0x81c1('0x45')](handleError(_0x2abec9,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 1f38efc..2e0be21 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 _0xad24=['define','user_profile_has_sections','compositeIndex','sectionId','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./userProfileSection.attributes','exports'];(function(_0x3b470e,_0x5b1dcd){var _0x43a6f6=function(_0x18f3f7){while(--_0x18f3f7){_0x3b470e['push'](_0x3b470e['shift']());}};_0x43a6f6(++_0x5b1dcd);}(_0xad24,0xfb));var _0x4ad2=function(_0x6939b4,_0x1b8d2b){_0x6939b4=_0x6939b4-0x0;var _0x469777=_0xad24[_0x6939b4];return _0x469777;};'use strict';var _=require(_0x4ad2('0x0'));var util=require(_0x4ad2('0x1'));var logger=require(_0x4ad2('0x2'))(_0x4ad2('0x3'));var moment=require('moment');var BPromise=require(_0x4ad2('0x4'));var rp=require(_0x4ad2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4ad2('0x6'));var attributes=require(_0x4ad2('0x7'));module[_0x4ad2('0x8')]=function(_0x14f588,_0x459bcf){return _0x14f588[_0x4ad2('0x9')]('UserProfileSection',attributes,{'tableName':_0x4ad2('0xa'),'paranoid':![],'indexes':[{'name':_0x4ad2('0xb'),'fields':[_0x4ad2('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3d3d=['user_profile_has_sections','compositeIndex','sectionId','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection'];(function(_0x3e3888,_0x18e356){var _0xd381f4=function(_0x156d40){while(--_0x156d40){_0x3e3888['push'](_0x3e3888['shift']());}};_0xd381f4(++_0x18e356);}(_0x3d3d,0xab));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd3d3('0x0'));var logger=require(_0xd3d3('0x1'))('api');var moment=require(_0xd3d3('0x2'));var BPromise=require(_0xd3d3('0x3'));var rp=require(_0xd3d3('0x4'));var fs=require('fs');var path=require(_0xd3d3('0x5'));var rimraf=require(_0xd3d3('0x6'));var config=require(_0xd3d3('0x7'));var attributes=require(_0xd3d3('0x8'));module[_0xd3d3('0x9')]=function(_0x2d36ba,_0x1e9338){return _0x2d36ba['define'](_0xd3d3('0xa'),attributes,{'tableName':_0xd3d3('0xb'),'paranoid':![],'indexes':[{'name':_0xd3d3('0xc'),'fields':[_0xd3d3('0xd'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index c9f30e1..28b681d 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 _0x9344=['request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserProfileSection,\x20%s,\x20%s'];(function(_0x547440,_0x3f1799){var _0x1327c7=function(_0x58e665){while(--_0x58e665){_0x547440['push'](_0x547440['shift']());}};_0x1327c7(++_0x3f1799);}(_0x9344,0x180));var _0x4934=function(_0x28c89b,_0x2510b3){_0x28c89b=_0x28c89b-0x0;var _0x176500=_0x9344[_0x28c89b];return _0x176500;};'use strict';var _=require(_0x4934('0x0'));var util=require('util');var moment=require(_0x4934('0x1'));var BPromise=require(_0x4934('0x2'));var rs=require(_0x4934('0x3'));var fs=require('fs');var Redis=require(_0x4934('0x4'));var db=require(_0x4934('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4934('0x6'))(_0x4934('0x7'));var config=require(_0x4934('0x8'));var jayson=require(_0x4934('0x9'));var client=jayson[_0x4934('0xa')][_0x4934('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x299255,_0x35fb4f,_0x41e985){return new BPromise(function(_0x89d887,_0x5deffc){return client['request'](_0x299255,_0x41e985)[_0x4934('0xc')](function(_0x47de32){logger[_0x4934('0xd')](_0x4934('0xe'),_0x35fb4f,_0x4934('0xf'));logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x35fb4f,'request\x20sent',JSON[_0x4934('0x10')](_0x47de32));if(_0x47de32[_0x4934('0x11')]){if(_0x47de32[_0x4934('0x11')][_0x4934('0x12')]===0x1f4){logger[_0x4934('0x11')](_0x4934('0xe'),_0x35fb4f,_0x47de32[_0x4934('0x11')]['message']);return _0x5deffc(_0x47de32['error'][_0x4934('0x13')]);}logger[_0x4934('0x11')](_0x4934('0xe'),_0x35fb4f,_0x47de32['error']['message']);return _0x89d887(_0x47de32[_0x4934('0x11')][_0x4934('0x13')]);}else{logger[_0x4934('0xd')](_0x4934('0xe'),_0x35fb4f,'request\x20sent');_0x89d887(_0x47de32[_0x4934('0x14')][_0x4934('0x13')]);}})['catch'](function(_0xf38ad5){logger[_0x4934('0x11')](_0x4934('0xe'),_0x35fb4f,_0xf38ad5);_0x5deffc(_0xf38ad5);});});} \ No newline at end of file +var _0xafdd=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x151334,_0x1e11ac){var _0x3d03da=function(_0x2099cf){while(--_0x2099cf){_0x151334['push'](_0x151334['shift']());}};_0x3d03da(++_0x1e11ac);}(_0xafdd,0x19a));var _0xdafd=function(_0x3ae35c,_0x350c0d){_0x3ae35c=_0x3ae35c-0x0;var _0x744cab=_0xafdd[_0x3ae35c];return _0x744cab;};'use strict';var _=require(_0xdafd('0x0'));var util=require(_0xdafd('0x1'));var moment=require(_0xdafd('0x2'));var BPromise=require(_0xdafd('0x3'));var rs=require(_0xdafd('0x4'));var fs=require('fs');var Redis=require(_0xdafd('0x5'));var db=require(_0xdafd('0x6'))['db'];var utils=require(_0xdafd('0x7'));var logger=require('../../config/logger')(_0xdafd('0x8'));var config=require(_0xdafd('0x9'));var jayson=require(_0xdafd('0xa'));var client=jayson[_0xdafd('0xb')][_0xdafd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x57cfee,_0x2ed8ea,_0x53e09c){return new BPromise(function(_0x9b9c6b,_0x385520){return client[_0xdafd('0xd')](_0x57cfee,_0x53e09c)['then'](function(_0x168d8c){logger[_0xdafd('0xe')](_0xdafd('0xf'),_0x2ed8ea,_0xdafd('0x10'));logger['debug'](_0xdafd('0x11'),_0x2ed8ea,_0xdafd('0x10'),JSON[_0xdafd('0x12')](_0x168d8c));if(_0x168d8c[_0xdafd('0x13')]){if(_0x168d8c[_0xdafd('0x13')][_0xdafd('0x14')]===0x1f4){logger['error'](_0xdafd('0xf'),_0x2ed8ea,_0x168d8c['error']['message']);return _0x385520(_0x168d8c[_0xdafd('0x13')][_0xdafd('0x15')]);}logger['error'](_0xdafd('0xf'),_0x2ed8ea,_0x168d8c['error']['message']);return _0x9b9c6b(_0x168d8c[_0xdafd('0x13')][_0xdafd('0x15')]);}else{logger[_0xdafd('0xe')](_0xdafd('0xf'),_0x2ed8ea,_0xdafd('0x10'));_0x9b9c6b(_0x168d8c['result'][_0xdafd('0x15')]);}})[_0xdafd('0x16')](function(_0x262cd4){logger['error'](_0xdafd('0xf'),_0x2ed8ea,_0x262cd4);_0x385520(_0x262cd4);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index ef9ac61..89d6294 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x166290,_0x39247e){var _0x17c466=function(_0x2c36b6){while(--_0x2c36b6){_0x166290['push'](_0x166290['shift']());}};_0x17c466(++_0x39247e);}(_0xe706,0xa3));var _0x6e70=function(_0x4da4ea,_0x2875d3){_0x4da4ea=_0x4da4ea-0x0;var _0x3cc102=_0xe706[_0x4da4ea];return _0x3cc102;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2ab418,_0x1f2849){var _0x68f709=function(_0x139292){while(--_0x139292){_0x2ab418['push'](_0x2ab418['shift']());}};_0x68f709(++_0x1f2849);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 4cc7e7a..2762d47 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 _0xe4b0=['INTEGER','sequelize','exports'];(function(_0x3da348,_0x31de31){var _0x10dfc0=function(_0x41eaee){while(--_0x41eaee){_0x3da348['push'](_0x3da348['shift']());}};_0x10dfc0(++_0x31de31);}(_0xe4b0,0x1b7));var _0x0e4b=function(_0x2dbcf0,_0x1c9ce9){_0x2dbcf0=_0x2dbcf0-0x0;var _0x185a15=_0xe4b0[_0x2dbcf0];return _0x185a15;};'use strict';var Sequelize=require(_0x0e4b('0x0'));module[_0x0e4b('0x1')]={'penalty':{'type':Sequelize[_0x0e4b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5144=['exports','INTEGER'];(function(_0x5cf6f0,_0x2c0c72){var _0x3aa117=function(_0x2d19a2){while(--_0x2d19a2){_0x5cf6f0['push'](_0x5cf6f0['shift']());}};_0x3aa117(++_0x2c0c72);}(_0x5144,0xe2));var _0x4514=function(_0x9b56de,_0x5a93d4){_0x9b56de=_0x9b56de-0x0;var _0x1df08e=_0x5144[_0x9b56de];return _0x1df08e;};'use strict';var Sequelize=require('sequelize');module[_0x4514('0x0')]={'penalty':{'type':Sequelize[_0x4514('0x1')],'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 7a7e4aa..03f9d54 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 _0xacf4=['define','UserSmsQueue','user_has_sms_queues','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userSmsQueue.attributes','exports'];(function(_0x125ca2,_0x5ac3d0){var _0x402039=function(_0x30a4d){while(--_0x30a4d){_0x125ca2['push'](_0x125ca2['shift']());}};_0x402039(++_0x5ac3d0);}(_0xacf4,0xe7));var _0x4acf=function(_0x499a9a,_0x565a03){_0x499a9a=_0x499a9a-0x0;var _0x162b13=_0xacf4[_0x499a9a];return _0x162b13;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4acf('0x0'))(_0x4acf('0x1'));var moment=require(_0x4acf('0x2'));var BPromise=require(_0x4acf('0x3'));var rp=require(_0x4acf('0x4'));var fs=require('fs');var path=require(_0x4acf('0x5'));var rimraf=require(_0x4acf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4acf('0x7'));module[_0x4acf('0x8')]=function(_0x4e0c43,_0x24bf24){return _0x4e0c43[_0x4acf('0x9')](_0x4acf('0xa'),attributes,{'tableName':_0x4acf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bd9=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues'];(function(_0x4ee881,_0x10ddc8){var _0x305f48=function(_0x5303d5){while(--_0x5303d5){_0x4ee881['push'](_0x4ee881['shift']());}};_0x305f48(++_0x10ddc8);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x330141,_0x1dd290){_0x330141=_0x330141-0x0;var _0x1b68a2=_0x9bd9[_0x330141];return _0x1b68a2;};'use strict';var _=require(_0x99bd('0x0'));var util=require(_0x99bd('0x1'));var logger=require(_0x99bd('0x2'))(_0x99bd('0x3'));var moment=require(_0x99bd('0x4'));var BPromise=require(_0x99bd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99bd('0x6'));var rimraf=require('rimraf');var config=require(_0x99bd('0x7'));var attributes=require(_0x99bd('0x8'));module['exports']=function(_0xa1cd99,_0x45b939){return _0xa1cd99[_0x99bd('0x9')](_0x99bd('0xa'),attributes,{'tableName':_0x99bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index ba0e0fd..69e9742 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 _0xcfa9=['http','request','then','request\x20sent','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','info','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','client'];(function(_0x13c6b0,_0x17cbe4){var _0x93021a=function(_0x35dd6e){while(--_0x35dd6e){_0x13c6b0['push'](_0x13c6b0['shift']());}};_0x93021a(++_0x17cbe4);}(_0xcfa9,0x6a));var _0x9cfa=function(_0x442d59,_0x31f930){_0x442d59=_0x442d59-0x0;var _0x1d7461=_0xcfa9[_0x442d59];return _0x1d7461;};'use strict';var _=require(_0x9cfa('0x0'));var util=require(_0x9cfa('0x1'));var moment=require(_0x9cfa('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cfa('0x3'));var db=require(_0x9cfa('0x4'))['db'];var utils=require(_0x9cfa('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9cfa('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9cfa('0x7')][_0x9cfa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x231a05,_0x44f6be,_0x3bb812){return new BPromise(function(_0x2012fb,_0x37499a){return client[_0x9cfa('0x9')](_0x231a05,_0x3bb812)[_0x9cfa('0xa')](function(_0x5ce58){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x44f6be,_0x9cfa('0xb'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x44f6be,_0x9cfa('0xb'),JSON[_0x9cfa('0xc')](_0x5ce58));if(_0x5ce58[_0x9cfa('0xd')]){if(_0x5ce58[_0x9cfa('0xd')][_0x9cfa('0xe')]===0x1f4){logger['error'](_0x9cfa('0xf'),_0x44f6be,_0x5ce58[_0x9cfa('0xd')][_0x9cfa('0x10')]);return _0x37499a(_0x5ce58[_0x9cfa('0xd')][_0x9cfa('0x10')]);}logger[_0x9cfa('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x44f6be,_0x5ce58[_0x9cfa('0xd')][_0x9cfa('0x10')]);return _0x2012fb(_0x5ce58[_0x9cfa('0xd')]['message']);}else{logger[_0x9cfa('0x11')](_0x9cfa('0xf'),_0x44f6be,_0x9cfa('0xb'));_0x2012fb(_0x5ce58['result']['message']);}})[_0x9cfa('0x12')](function(_0x15fd99){logger[_0x9cfa('0xd')](_0x9cfa('0xf'),_0x44f6be,_0x15fd99);_0x37499a(_0x15fd99);});});} \ No newline at end of file +var _0xdeed=['jayson/promise','client','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5bf350,_0x11e77d){var _0x35b047=function(_0x17dcc2){while(--_0x17dcc2){_0x5bf350['push'](_0x5bf350['shift']());}};_0x35b047(++_0x11e77d);}(_0xdeed,0x172));var _0xddee=function(_0x36c79d,_0x5437db){_0x36c79d=_0x36c79d-0x0;var _0x52ccee=_0xdeed[_0x36c79d];return _0x52ccee;};'use strict';var _=require(_0xddee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xddee('0x1'));var rs=require(_0xddee('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xddee('0x3'))['db'];var utils=require(_0xddee('0x4'));var logger=require(_0xddee('0x5'))(_0xddee('0x6'));var config=require(_0xddee('0x7'));var jayson=require(_0xddee('0x8'));var client=jayson[_0xddee('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12cfd8,_0x264def,_0x5b90b1){return new BPromise(function(_0x366983,_0x203680){return client['request'](_0x12cfd8,_0x5b90b1)[_0xddee('0xa')](function(_0x242f2e){logger[_0xddee('0xb')](_0xddee('0xc'),_0x264def,_0xddee('0xd'));logger[_0xddee('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x264def,'request\x20sent',JSON[_0xddee('0xf')](_0x242f2e));if(_0x242f2e[_0xddee('0x10')]){if(_0x242f2e[_0xddee('0x10')]['code']===0x1f4){logger[_0xddee('0x10')](_0xddee('0xc'),_0x264def,_0x242f2e[_0xddee('0x10')][_0xddee('0x11')]);return _0x203680(_0x242f2e[_0xddee('0x10')][_0xddee('0x11')]);}logger[_0xddee('0x10')](_0xddee('0xc'),_0x264def,_0x242f2e[_0xddee('0x10')]['message']);return _0x366983(_0x242f2e[_0xddee('0x10')][_0xddee('0x11')]);}else{logger[_0xddee('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x264def,'request\x20sent');_0x366983(_0x242f2e['result'][_0xddee('0x11')]);}})['catch'](function(_0x2e95f6){logger[_0xddee('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x264def,_0x2e95f6);_0x203680(_0x2e95f6);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index f162643..77a768c 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 _0x8bdf=['INTEGER','sequelize'];(function(_0x46eb0a,_0x52e727){var _0x154c09=function(_0x8f70c){while(--_0x8f70c){_0x46eb0a['push'](_0x46eb0a['shift']());}};_0x154c09(++_0x52e727);}(_0x8bdf,0x7b));var _0xf8bd=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x8bdf[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xf8bd('0x0'));module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xf8bd('0x1')]}}; \ No newline at end of file +var _0x9629=['sequelize','INTEGER'];(function(_0x3f7ffb,_0x3220aa){var _0x256af7=function(_0x3bd9aa){while(--_0x3bd9aa){_0x3f7ffb['push'](_0x3f7ffb['shift']());}};_0x256af7(++_0x3220aa);}(_0x9629,0x1ea));var _0x9962=function(_0x5add35,_0x37f23a){_0x5add35=_0x5add35-0x0;var _0x2e3743=_0x9629[_0x5add35];return _0x2e3743;};'use strict';var Sequelize=require(_0x9962('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x9962('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x9962('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 07c7c06..b3126d3 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(_0x1431f4,_0x1f74ab){var _0x475bb6=function(_0x30dd09){while(--_0x30dd09){_0x1431f4['push'](_0x1431f4['shift']());}};_0x475bb6(++_0x1f74ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x4f58b7,_0x3f7534){var _0x243c86=function(_0x221950){while(--_0x221950){_0x4f58b7['push'](_0x4f58b7['shift']());}};_0x243c86(++_0x3f7534);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 e3887dd..5e433aa 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x28b764,_0x1b76bc){var _0xe0b583=function(_0x133301){while(--_0x133301){_0x28b764['push'](_0x28b764['shift']());}};_0xe0b583(++_0x1b76bc);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x31f690,_0x4d2206){var _0x5d6d44=function(_0x1774e9){while(--_0x1774e9){_0x31f690['push'](_0x31f690['shift']());}};_0x5d6d44(++_0x4d2206);}(_0xe706,0xa3));var _0x6e70=function(_0x474f47,_0x2303b7){_0x474f47=_0x474f47-0x0;var _0x21bfe6=_0xe706[_0x474f47];return _0x21bfe6;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 33b43ef..2c49329 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 _0x8878=['sequelize'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x8878,0x8a));var _0x8887=function(_0x3527be,_0x113fdb){_0x3527be=_0x3527be-0x0;var _0x5c61b8=_0x8878[_0x3527be];return _0x5c61b8;};'use strict';var Sequelize=require(_0x8887('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1abe=['exports','INTEGER'];(function(_0x222a4b,_0x1dc16c){var _0x59355f=function(_0x292811){while(--_0x292811){_0x222a4b['push'](_0x222a4b['shift']());}};_0x59355f(++_0x1dc16c);}(_0x1abe,0xc2));var _0xe1ab=function(_0x5287d6,_0x45a650){_0x5287d6=_0x5287d6-0x0;var _0x1de0ff=_0x1abe[_0x5287d6];return _0x1de0ff;};'use strict';var Sequelize=require('sequelize');module[_0xe1ab('0x0')]={'penalty':{'type':Sequelize[_0xe1ab('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 5060106..c1a0ff9 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 _0xcb82=['./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','path','../../config/environment'];(function(_0x505c58,_0x2c564c){var _0x1279b3=function(_0x39c603){while(--_0x39c603){_0x505c58['push'](_0x505c58['shift']());}};_0x1279b3(++_0x2c564c);}(_0xcb82,0x155));var _0x2cb8=function(_0x46a55e,_0xe095bf){_0x46a55e=_0x46a55e-0x0;var _0x2648a8=_0xcb82[_0x46a55e];return _0x2648a8;};'use strict';var _=require(_0x2cb8('0x0'));var util=require(_0x2cb8('0x1'));var logger=require(_0x2cb8('0x2'))(_0x2cb8('0x3'));var moment=require(_0x2cb8('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2cb8('0x5'));var rimraf=require('rimraf');var config=require(_0x2cb8('0x6'));var attributes=require(_0x2cb8('0x7'));module[_0x2cb8('0x8')]=function(_0xeb40d1,_0x336a54){return _0xeb40d1[_0x2cb8('0x9')](_0x2cb8('0xa'),attributes,{'tableName':_0x2cb8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca57=['bluebird','path','rimraf','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment'];(function(_0x2780a0,_0x232b7f){var _0x1c9106=function(_0x5bc6c3){while(--_0x5bc6c3){_0x2780a0['push'](_0x2780a0['shift']());}};_0x1c9106(++_0x232b7f);}(_0xca57,0x70));var _0x7ca5=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xca57[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x7ca5('0x0'));var util=require(_0x7ca5('0x1'));var logger=require(_0x7ca5('0x2'))(_0x7ca5('0x3'));var moment=require(_0x7ca5('0x4'));var BPromise=require(_0x7ca5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ca5('0x6'));var rimraf=require(_0x7ca5('0x7'));var config=require('../../config/environment');var attributes=require(_0x7ca5('0x8'));module[_0x7ca5('0x9')]=function(_0x573789,_0xeddfe2){return _0x573789[_0x7ca5('0xa')](_0x7ca5('0xb'),attributes,{'tableName':_0x7ca5('0xc'),'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 82ebf42..9987d2b 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 _0xe968=['http','request','info','UserVoiceQueue,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe968,0x7c));var _0x8e96=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe968[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8e96('0x0'));var util=require(_0x8e96('0x1'));var moment=require(_0x8e96('0x2'));var BPromise=require(_0x8e96('0x3'));var rs=require(_0x8e96('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8e96('0x5'));var logger=require(_0x8e96('0x6'))(_0x8e96('0x7'));var config=require('../../config/environment');var jayson=require(_0x8e96('0x8'));var client=jayson['client'][_0x8e96('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20ad83,_0xd1fa5,_0x1e9d31){return new BPromise(function(_0x33bf19,_0x4b35f5){return client[_0x8e96('0xa')](_0x20ad83,_0x1e9d31)['then'](function(_0x2bb5d2){logger[_0x8e96('0xb')](_0x8e96('0xc'),_0xd1fa5,'request\x20sent');logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0xd1fa5,'request\x20sent',JSON[_0x8e96('0xd')](_0x2bb5d2));if(_0x2bb5d2[_0x8e96('0xe')]){if(_0x2bb5d2[_0x8e96('0xe')][_0x8e96('0xf')]===0x1f4){logger['error'](_0x8e96('0xc'),_0xd1fa5,_0x2bb5d2[_0x8e96('0xe')]['message']);return _0x4b35f5(_0x2bb5d2[_0x8e96('0xe')][_0x8e96('0x10')]);}logger[_0x8e96('0xe')](_0x8e96('0xc'),_0xd1fa5,_0x2bb5d2[_0x8e96('0xe')][_0x8e96('0x10')]);return _0x33bf19(_0x2bb5d2[_0x8e96('0xe')][_0x8e96('0x10')]);}else{logger[_0x8e96('0xb')](_0x8e96('0xc'),_0xd1fa5,'request\x20sent');_0x33bf19(_0x2bb5d2[_0x8e96('0x11')][_0x8e96('0x10')]);}})[_0x8e96('0x12')](function(_0x1471fe){logger[_0x8e96('0xe')](_0x8e96('0xc'),_0xd1fa5,_0x1471fe);_0x4b35f5(_0x1471fe);});});} \ No newline at end of file +var _0xb131=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x119531,_0x4c2cfa){var _0x5e6cb4=function(_0x49ac10){while(--_0x49ac10){_0x119531['push'](_0x119531['shift']());}};_0x5e6cb4(++_0x4c2cfa);}(_0xb131,0x1cb));var _0x1b13=function(_0x35387d,_0x1ba72f){_0x35387d=_0x35387d-0x0;var _0x3aba56=_0xb131[_0x35387d];return _0x3aba56;};'use strict';var _=require(_0x1b13('0x0'));var util=require(_0x1b13('0x1'));var moment=require(_0x1b13('0x2'));var BPromise=require('bluebird');var rs=require(_0x1b13('0x3'));var fs=require('fs');var Redis=require(_0x1b13('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b13('0x5'));var logger=require(_0x1b13('0x6'))(_0x1b13('0x7'));var config=require(_0x1b13('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1b13('0x9')][_0x1b13('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27515c,_0x4e6f77,_0x1eb0dc){return new BPromise(function(_0x1381ad,_0x5ae26e){return client[_0x1b13('0xb')](_0x27515c,_0x1eb0dc)[_0x1b13('0xc')](function(_0x4d0cca){logger[_0x1b13('0xd')](_0x1b13('0xe'),_0x4e6f77,_0x1b13('0xf'));logger[_0x1b13('0x10')](_0x1b13('0x11'),_0x4e6f77,_0x1b13('0xf'),JSON[_0x1b13('0x12')](_0x4d0cca));if(_0x4d0cca[_0x1b13('0x13')]){if(_0x4d0cca[_0x1b13('0x13')][_0x1b13('0x14')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x4e6f77,_0x4d0cca[_0x1b13('0x13')][_0x1b13('0x15')]);return _0x5ae26e(_0x4d0cca['error'][_0x1b13('0x15')]);}logger[_0x1b13('0x13')](_0x1b13('0xe'),_0x4e6f77,_0x4d0cca['error'][_0x1b13('0x15')]);return _0x1381ad(_0x4d0cca[_0x1b13('0x13')][_0x1b13('0x15')]);}else{logger['info'](_0x1b13('0xe'),_0x4e6f77,_0x1b13('0xf'));_0x1381ad(_0x4d0cca[_0x1b13('0x16')][_0x1b13('0x15')]);}})['catch'](function(_0x429327){logger[_0x1b13('0x13')](_0x1b13('0xe'),_0x4e6f77,_0x429327);_0x5ae26e(_0x429327);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index ae89d0d..391f690 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(_0x3bf4d5,_0x366a37){var _0x48fdea=function(_0x665bbe){while(--_0x665bbe){_0x3bf4d5['push'](_0x3bf4d5['shift']());}};_0x48fdea(++_0x366a37);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1dc1bc,_0x13522c){var _0xe8656e=function(_0x486672){while(--_0x486672){_0x1dc1bc['push'](_0x1dc1bc['shift']());}};_0xe8656e(++_0x13522c);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 98151cf..1e0800b 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 _0x3221=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','exports'];(function(_0x495f49,_0x4a3459){var _0x1407e9=function(_0x39f1a2){while(--_0x39f1a2){_0x495f49['push'](_0x495f49['shift']());}};_0x1407e9(++_0x4a3459);}(_0x3221,0x1d0));var _0x1322=function(_0x6718b7,_0x19f612){_0x6718b7=_0x6718b7-0x0;var _0x492689=_0x3221[_0x6718b7];return _0x492689;};'use strict';var Sequelize=require('sequelize');module[_0x1322('0x0')]={'uniqueid':{'type':Sequelize[_0x1322('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x1322('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x1322('0x2')},'UserId':{'type':Sequelize[_0x1322('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x1322('0x3')],'allowNull':![],'unique':_0x1322('0x4'),'comment':_0x1322('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x1322('0x3')],'allowNull':![],'unique':_0x1322('0x4'),'comment':_0x1322('0x2')},'penalty':{'type':Sequelize[_0x1322('0x1')](0xb),'defaultValue':0x0,'comment':_0x1322('0x2')},'paused':{'type':Sequelize[_0x1322('0x1')](0xb),'defaultValue':0x0,'comment':_0x1322('0x2')}}; \ No newline at end of file +var _0xed52=['queue_interface','exports','STRING','Required\x20by\x20Asterisk','INTEGER'];(function(_0x433d3d,_0x46b47d){var _0x58deec=function(_0x9c496b){while(--_0x9c496b){_0x433d3d['push'](_0x433d3d['shift']());}};_0x58deec(++_0x46b47d);}(_0xed52,0x16e));var _0x2ed5=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xed52[_0x1b349a];return _0x5d1f7c;};'use strict';var Sequelize=require('sequelize');module[_0x2ed5('0x0')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x2ed5('0x1')],'allowNull':![],'comment':_0x2ed5('0x2')},'UserId':{'type':Sequelize[_0x2ed5('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2ed5('0x1')],'allowNull':![],'unique':_0x2ed5('0x4'),'comment':_0x2ed5('0x2')},'VoiceQueueId':{'type':Sequelize[_0x2ed5('0x3')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2ed5('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x2ed5('0x3')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x2ed5('0x3')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 564d1f9..75779ae 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 _0x484e=['hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0x484e,0x9c));var _0xe484=function(_0x27ba32,_0x536271){_0x27ba32=_0x27ba32-0x0;var _0xf858a0=_0x484e[_0x27ba32];return _0xf858a0;};'use strict';var EventEmitter=require(_0xe484('0x0'));var UserVoiceQueueRt=require(_0xe484('0x1'))['db'][_0xe484('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xe484('0x3')](0x0);var events={'afterCreate':_0xe484('0x4'),'afterUpdate':_0xe484('0x5'),'afterDestroy':_0xe484('0x6')};function emitEvent(_0x28da0c){return function(_0x1292a8,_0x59b075,_0x35c5f1){UserVoiceQueueRtEvents[_0xe484('0x7')](_0x28da0c+':'+_0x1292a8['id'],_0x1292a8);UserVoiceQueueRtEvents[_0xe484('0x7')](_0x28da0c,_0x1292a8);_0x35c5f1(null);};}for(var e in events){if(events[_0xe484('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0xe484('0x9')](e,emitEvent(event));}}module[_0xe484('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x6d9c=['update','remove','hook','exports','UserVoiceQueueRt','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d9c,0x12a));var _0xc6d9=function(_0x59eb26,_0x1d0fbb){_0x59eb26=_0x59eb26-0x0;var _0x59796d=_0x6d9c[_0x59eb26];return _0x59796d;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xc6d9('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc6d9('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc6d9('0x2'),'afterDestroy':_0xc6d9('0x3')};function emitEvent(_0x5a43a6){return function(_0x584125,_0x41b28d,_0xb84dd3){UserVoiceQueueRtEvents['emit'](_0x5a43a6+':'+_0x584125['id'],_0x584125);UserVoiceQueueRtEvents['emit'](_0x5a43a6,_0x584125);_0xb84dd3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xc6d9('0x4')](e,emitEvent(event));}}module[_0xc6d9('0x5')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 1d8610a..ec763d3 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 _0x2de0=['./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5178c1,_0x365a00){var _0x303990=function(_0x11ced3){while(--_0x11ced3){_0x5178c1['push'](_0x5178c1['shift']());}};_0x303990(++_0x365a00);}(_0x2de0,0x163));var _0x02de=function(_0x20ee95,_0x27f7c1){_0x20ee95=_0x20ee95-0x0;var _0x3667d1=_0x2de0[_0x20ee95];return _0x3667d1;};'use strict';var _=require(_0x02de('0x0'));var util=require(_0x02de('0x1'));var logger=require(_0x02de('0x2'))(_0x02de('0x3'));var moment=require(_0x02de('0x4'));var BPromise=require(_0x02de('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x02de('0x6'));var rimraf=require(_0x02de('0x7'));var config=require(_0x02de('0x8'));var attributes=require(_0x02de('0x9'));module[_0x02de('0xa')]=function(_0x45f490,_0x18a780){return _0x45f490[_0x02de('0xb')]('UserVoiceQueueRt',attributes,{'tableName':_0x02de('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bde=['exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0x4bde,0x108));var _0xe4bd=function(_0x5e7b41,_0x3e8d07){_0x5e7b41=_0x5e7b41-0x0;var _0x1ebcc8=_0x4bde[_0x5e7b41];return _0x1ebcc8;};'use strict';var _=require(_0xe4bd('0x0'));var util=require(_0xe4bd('0x1'));var logger=require(_0xe4bd('0x2'))(_0xe4bd('0x3'));var moment=require(_0xe4bd('0x4'));var BPromise=require('bluebird');var rp=require(_0xe4bd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0xe4bd('0x6')]=function(_0x1bf304,_0x59646f){return _0x1bf304[_0xe4bd('0x7')](_0xe4bd('0x8'),attributes,{'tableName':_0xe4bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 8a93535..311cc5c 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 _0x1776=['client','defaults','redis','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','COUNT','sequelize','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x30000b,_0xa62fbc){var _0x23da32=function(_0x228798){while(--_0x228798){_0x30000b['push'](_0x30000b['shift']());}};_0x23da32(++_0xa62fbc);}(_0x1776,0xeb));var _0x6177=function(_0x1afe40,_0x824761){_0x1afe40=_0x1afe40-0x0;var _0x243412=_0x1776[_0x1afe40];return _0x243412;};'use strict';var _=require(_0x6177('0x0'));var util=require(_0x6177('0x1'));var moment=require(_0x6177('0x2'));var BPromise=require(_0x6177('0x3'));var rs=require(_0x6177('0x4'));var fs=require('fs');var Redis=require(_0x6177('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6177('0x6'));var logger=require(_0x6177('0x7'))('rpc');var config=require(_0x6177('0x8'));var jayson=require(_0x6177('0x9'));var client=jayson[_0x6177('0xa')]['http']({'port':0x232a});config['redis']=_[_0x6177('0xb')](config[_0x6177('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6177('0xd'))(new Redis(config[_0x6177('0xc')]));require(_0x6177('0xe'))[_0x6177('0xf')](socket);function respondWithRpcPromise(_0x166a4e,_0x38bd55,_0x2404c2){return new BPromise(function(_0x3f2a45,_0x560ea8){return client[_0x6177('0x10')](_0x166a4e,_0x2404c2)[_0x6177('0x11')](function(_0x17b948){logger[_0x6177('0x12')](_0x6177('0x13'),_0x38bd55,_0x6177('0x14'));logger[_0x6177('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x38bd55,'request\x20sent',JSON[_0x6177('0x16')](_0x17b948));if(_0x17b948[_0x6177('0x17')]){if(_0x17b948['error'][_0x6177('0x18')]===0x1f4){logger['error'](_0x6177('0x13'),_0x38bd55,_0x17b948[_0x6177('0x17')][_0x6177('0x19')]);return _0x560ea8(_0x17b948[_0x6177('0x17')][_0x6177('0x19')]);}logger[_0x6177('0x17')](_0x6177('0x13'),_0x38bd55,_0x17b948[_0x6177('0x17')]['message']);return _0x3f2a45(_0x17b948['error']['message']);}else{logger[_0x6177('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x38bd55,_0x6177('0x14'));_0x3f2a45(_0x17b948['result']['message']);}})[_0x6177('0x1a')](function(_0x475751){logger['error'](_0x6177('0x13'),_0x38bd55,_0x475751);_0x560ea8(_0x475751);});});}exports[_0x6177('0x1b')]=function(_0x418644){var _0xe4bc74=this;return new Promise(function(_0x287b3e,_0x50b75f){return db[_0x6177('0x1c')][_0x6177('0x1d')]({'raw':_0x418644[_0x6177('0x1e')]?_0x418644['options']['raw']===undefined?!![]:![]:!![],'where':_0x418644['options']?_0x418644[_0x6177('0x1e')][_0x6177('0x1f')]||null:null,'attributes':[[db['sequelize']['fn'](_0x6177('0x20'),db[_0x6177('0x21')]['fn']('IF',db['sequelize']['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x6177('0x22')]]})[_0x6177('0x11')](function(_0x5154db){logger[_0x6177('0x12')]('GetVoiceQueueRtPauses',_0x418644);logger[_0x6177('0x15')](_0x6177('0x1b'),_0x418644,JSON[_0x6177('0x16')](_0x5154db));_0x287b3e(_0x5154db);})[_0x6177('0x1a')](function(_0xcd56e3){logger[_0x6177('0x17')](_0x6177('0x1b'),_0xcd56e3[_0x6177('0x19')],_0x418644);_0x50b75f(_0xe4bc74['error'](0x1f4,_0xcd56e3['message']));});});}; \ No newline at end of file +var _0xb5dd=['request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','info','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xb5dd,0x1c4));var _0xdb5d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb5dd[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xdb5d('0x0'));var util=require('util');var moment=require(_0xdb5d('0x1'));var BPromise=require(_0xdb5d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb5d('0x3'))['db'];var utils=require(_0xdb5d('0x4'));var logger=require(_0xdb5d('0x5'))('rpc');var config=require(_0xdb5d('0x6'));var jayson=require(_0xdb5d('0x7'));var client=jayson['client'][_0xdb5d('0x8')]({'port':0x232a});config[_0xdb5d('0x9')]=_[_0xdb5d('0xa')](config[_0xdb5d('0x9')],{'host':_0xdb5d('0xb'),'port':0x18eb});var socket=require(_0xdb5d('0xc'))(new Redis(config[_0xdb5d('0x9')]));require(_0xdb5d('0xd'))['register'](socket);function respondWithRpcPromise(_0x3a55b9,_0xb262ea,_0x2728b6){return new BPromise(function(_0xf9f6bd,_0x170ea0){return client[_0xdb5d('0xe')](_0x3a55b9,_0x2728b6)[_0xdb5d('0xf')](function(_0x19376b){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0xb262ea,_0xdb5d('0x10'));logger[_0xdb5d('0x11')](_0xdb5d('0x12'),_0xb262ea,_0xdb5d('0x10'),JSON[_0xdb5d('0x13')](_0x19376b));if(_0x19376b[_0xdb5d('0x14')]){if(_0x19376b[_0xdb5d('0x14')][_0xdb5d('0x15')]===0x1f4){logger[_0xdb5d('0x14')](_0xdb5d('0x16'),_0xb262ea,_0x19376b['error'][_0xdb5d('0x17')]);return _0x170ea0(_0x19376b[_0xdb5d('0x14')][_0xdb5d('0x17')]);}logger[_0xdb5d('0x14')](_0xdb5d('0x16'),_0xb262ea,_0x19376b[_0xdb5d('0x14')][_0xdb5d('0x17')]);return _0xf9f6bd(_0x19376b['error'][_0xdb5d('0x17')]);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0xb262ea,_0xdb5d('0x10'));_0xf9f6bd(_0x19376b['result'][_0xdb5d('0x17')]);}})[_0xdb5d('0x18')](function(_0x540c40){logger[_0xdb5d('0x14')](_0xdb5d('0x16'),_0xb262ea,_0x540c40);_0x170ea0(_0x540c40);});});}exports[_0xdb5d('0x19')]=function(_0x17a1f4){var _0x592184=this;return new Promise(function(_0x4dbdef,_0x38dd81){return db[_0xdb5d('0x1a')]['findAll']({'raw':_0x17a1f4['options']?_0x17a1f4[_0xdb5d('0x1b')][_0xdb5d('0x1c')]===undefined?!![]:![]:!![],'where':_0x17a1f4[_0xdb5d('0x1b')]?_0x17a1f4[_0xdb5d('0x1b')][_0xdb5d('0x1d')]||null:null,'attributes':[[db[_0xdb5d('0x1e')]['fn'](_0xdb5d('0x1f'),db[_0xdb5d('0x1e')]['fn']('IF',db['sequelize'][_0xdb5d('0x20')](_0xdb5d('0x21')))),_0xdb5d('0x22')]]})[_0xdb5d('0xf')](function(_0x5a664c){logger[_0xdb5d('0x23')](_0xdb5d('0x19'),_0x17a1f4);logger[_0xdb5d('0x11')](_0xdb5d('0x19'),_0x17a1f4,JSON['stringify'](_0x5a664c));_0x4dbdef(_0x5a664c);})[_0xdb5d('0x18')](function(_0x240a30){logger[_0xdb5d('0x14')](_0xdb5d('0x19'),_0x240a30[_0xdb5d('0x17')],_0x17a1f4);_0x38dd81(_0x592184[_0xdb5d('0x14')](0x1f4,_0x240a30['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 2d8ea2c..ede543f 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 _0x6347=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update','removeListener','register'];(function(_0x162c8f,_0x2f1e23){var _0x4e2ef8=function(_0x2c5939){while(--_0x2c5939){_0x162c8f['push'](_0x162c8f['shift']());}};_0x4e2ef8(++_0x2f1e23);}(_0x6347,0x1c9));var _0x7634=function(_0x22c831,_0x4be319){_0x22c831=_0x22c831-0x0;var _0x282163=_0x6347[_0x22c831];return _0x282163;};'use strict';var UserVoiceQueueRtEvents=require(_0x7634('0x0'));var events=[_0x7634('0x1'),'remove',_0x7634('0x2')];function createListener(_0x391900,_0x439892){return function(_0x471ac9){_0x439892['emit'](_0x391900,_0x471ac9);};}function removeListener(_0x57701b,_0x575540){return function(){UserVoiceQueueRtEvents[_0x7634('0x3')](_0x57701b,_0x575540);};}exports[_0x7634('0x4')]=function(_0x56d2ad){for(var _0x58d043=0x0,_0xa1f11a=events[_0x7634('0x5')];_0x58d043<_0xa1f11a;_0x58d043++){var _0x33eb7e=events[_0x58d043];var _0x453e4b=createListener(_0x7634('0x6')+_0x33eb7e,_0x56d2ad);UserVoiceQueueRtEvents['on'](_0x33eb7e,_0x453e4b);}}; \ No newline at end of file +var _0x885a=['save','remove','update','emit','removeListener','register','length','userVoiceQueueRt:'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x885a,0x180));var _0xa885=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x885a[_0x413feb];return _0x40ee88;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xa885('0x0'),_0xa885('0x1'),_0xa885('0x2')];function createListener(_0x2e4bc8,_0x573a2b){return function(_0xcf0656){_0x573a2b[_0xa885('0x3')](_0x2e4bc8,_0xcf0656);};}function removeListener(_0x2386ec,_0x106e16){return function(){UserVoiceQueueRtEvents[_0xa885('0x4')](_0x2386ec,_0x106e16);};}exports[_0xa885('0x5')]=function(_0x5dfd7e){for(var _0x7ac6bd=0x0,_0x1200c7=events[_0xa885('0x6')];_0x7ac6bd<_0x1200c7;_0x7ac6bd++){var _0x546175=events[_0x7ac6bd];var _0x6b26e2=createListener(_0xa885('0x7')+_0x546175,_0x5dfd7e);UserVoiceQueueRtEvents['on'](_0x546175,_0x6b26e2);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 5347aa9..fa6f8e3 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x45bc6a,_0x301e14){var _0x171a81=function(_0x26381f){while(--_0x26381f){_0x45bc6a['push'](_0x45bc6a['shift']());}};_0x171a81(++_0x301e14);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1850b8,_0xf564b4){var _0x1147ce=function(_0x1922e8){while(--_0x1922e8){_0x1850b8['push'](_0x1850b8['shift']());}};_0x1147ce(++_0xf564b4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0xcb91[_0x2f3794];return _0x1c9fbe;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 5d9022a..fa81f0b 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 _0x2090=['exports','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2090,0xae));var _0x0209=function(_0x2c7631,_0x368627){_0x2c7631=_0x2c7631-0x0;var _0x2279e7=_0x2090[_0x2c7631];return _0x2279e7;};'use strict';var Sequelize=require('sequelize');module[_0x0209('0x0')]={'penalty':{'type':Sequelize[_0x0209('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0af1=['INTEGER'];(function(_0x5efa5f,_0x2cdd5b){var _0x18ae2f=function(_0x364233){while(--_0x364233){_0x5efa5f['push'](_0x5efa5f['shift']());}};_0x18ae2f(++_0x2cdd5b);}(_0x0af1,0x135));var _0x10af=function(_0x1f620e,_0x492e26){_0x1f620e=_0x1f620e-0x0;var _0x153543=_0x0af1[_0x1f620e];return _0x153543;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x10af('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 3cea608..8d4f5f7 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 _0xc498=['user_has_whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue'];(function(_0x585219,_0x23ba0b){var _0x32c6fe=function(_0x463370){while(--_0x463370){_0x585219['push'](_0x585219['shift']());}};_0x32c6fe(++_0x23ba0b);}(_0xc498,0x1a5));var _0x8c49=function(_0x3c2823,_0x1a0a8f){_0x3c2823=_0x3c2823-0x0;var _0x21cdac=_0xc498[_0x3c2823];return _0x21cdac;};'use strict';var _=require(_0x8c49('0x0'));var util=require('util');var logger=require(_0x8c49('0x1'))(_0x8c49('0x2'));var moment=require(_0x8c49('0x3'));var BPromise=require(_0x8c49('0x4'));var rp=require(_0x8c49('0x5'));var fs=require('fs');var path=require(_0x8c49('0x6'));var rimraf=require(_0x8c49('0x7'));var config=require(_0x8c49('0x8'));var attributes=require(_0x8c49('0x9'));module[_0x8c49('0xa')]=function(_0x323ce7,_0x4d27bb){return _0x323ce7[_0x8c49('0xb')](_0x8c49('0xc'),attributes,{'tableName':_0x8c49('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff0a=['exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes'];(function(_0x55c97d,_0x228ffc){var _0x1d5112=function(_0x2ab908){while(--_0x2ab908){_0x55c97d['push'](_0x55c97d['shift']());}};_0x1d5112(++_0x228ffc);}(_0xff0a,0x118));var _0xaff0=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xff0a[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0xaff0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaff0('0x1'));var moment=require(_0xaff0('0x2'));var BPromise=require(_0xaff0('0x3'));var rp=require(_0xaff0('0x4'));var fs=require('fs');var path=require(_0xaff0('0x5'));var rimraf=require(_0xaff0('0x6'));var config=require('../../config/environment');var attributes=require(_0xaff0('0x7'));module[_0xaff0('0x8')]=function(_0x565e5d,_0x10c422){return _0x565e5d[_0xaff0('0x9')](_0xaff0('0xa'),attributes,{'tableName':_0xaff0('0xb'),'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 f81b0cc..8774617 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 _0xf10a=['result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x372163,_0x85869b){var _0x11cd8a=function(_0x4f0ec1){while(--_0x4f0ec1){_0x372163['push'](_0x372163['shift']());}};_0x11cd8a(++_0x85869b);}(_0xf10a,0x85));var _0xaf10=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xf10a[_0x266618];return _0x54dbf5;};'use strict';var _=require(_0xaf10('0x0'));var util=require('util');var moment=require(_0xaf10('0x1'));var BPromise=require(_0xaf10('0x2'));var rs=require(_0xaf10('0x3'));var fs=require('fs');var Redis=require(_0xaf10('0x4'));var db=require(_0xaf10('0x5'))['db'];var utils=require(_0xaf10('0x6'));var logger=require(_0xaf10('0x7'))(_0xaf10('0x8'));var config=require(_0xaf10('0x9'));var jayson=require(_0xaf10('0xa'));var client=jayson['client'][_0xaf10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40eefa,_0x2d091e,_0xb82f0c){return new BPromise(function(_0x4cb0a4,_0x1e4049){return client[_0xaf10('0xc')](_0x40eefa,_0xb82f0c)['then'](function(_0x4e97b1){logger[_0xaf10('0xd')](_0xaf10('0xe'),_0x2d091e,_0xaf10('0xf'));logger[_0xaf10('0x10')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x2d091e,'request\x20sent',JSON[_0xaf10('0x11')](_0x4e97b1));if(_0x4e97b1['error']){if(_0x4e97b1[_0xaf10('0x12')][_0xaf10('0x13')]===0x1f4){logger[_0xaf10('0x12')](_0xaf10('0xe'),_0x2d091e,_0x4e97b1[_0xaf10('0x12')][_0xaf10('0x14')]);return _0x1e4049(_0x4e97b1[_0xaf10('0x12')][_0xaf10('0x14')]);}logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x2d091e,_0x4e97b1[_0xaf10('0x12')]['message']);return _0x4cb0a4(_0x4e97b1['error'][_0xaf10('0x14')]);}else{logger[_0xaf10('0xd')](_0xaf10('0xe'),_0x2d091e,_0xaf10('0xf'));_0x4cb0a4(_0x4e97b1[_0xaf10('0x15')][_0xaf10('0x14')]);}})['catch'](function(_0x1ef8f4){logger['error'](_0xaf10('0xe'),_0x2d091e,_0x1ef8f4);_0x1e4049(_0x1ef8f4);});});} \ No newline at end of file +var _0xcc00=['then','info','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x4da14e,_0x5ccbdb){var _0x5c6c2f=function(_0x1d272d){while(--_0x1d272d){_0x4da14e['push'](_0x4da14e['shift']());}};_0x5c6c2f(++_0x5ccbdb);}(_0xcc00,0xfa));var _0x0cc0=function(_0x55d829,_0x43f06c){_0x55d829=_0x55d829-0x0;var _0x52163b=_0xcc00[_0x55d829];return _0x52163b;};'use strict';var _=require(_0x0cc0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0cc0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cc0('0x2'))['db'];var utils=require(_0x0cc0('0x3'));var logger=require(_0x0cc0('0x4'))(_0x0cc0('0x5'));var config=require('../../config/environment');var jayson=require(_0x0cc0('0x6'));var client=jayson[_0x0cc0('0x7')][_0x0cc0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23d05a,_0x21c7aa,_0x413433){return new BPromise(function(_0x37cf73,_0x56b39a){return client[_0x0cc0('0x9')](_0x23d05a,_0x413433)[_0x0cc0('0xa')](function(_0x187787){logger[_0x0cc0('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x21c7aa,_0x0cc0('0xc'));logger['debug'](_0x0cc0('0xd'),_0x21c7aa,'request\x20sent',JSON[_0x0cc0('0xe')](_0x187787));if(_0x187787[_0x0cc0('0xf')]){if(_0x187787[_0x0cc0('0xf')][_0x0cc0('0x10')]===0x1f4){logger[_0x0cc0('0xf')](_0x0cc0('0x11'),_0x21c7aa,_0x187787[_0x0cc0('0xf')][_0x0cc0('0x12')]);return _0x56b39a(_0x187787[_0x0cc0('0xf')][_0x0cc0('0x12')]);}logger['error'](_0x0cc0('0x11'),_0x21c7aa,_0x187787['error']['message']);return _0x37cf73(_0x187787[_0x0cc0('0xf')][_0x0cc0('0x12')]);}else{logger['info'](_0x0cc0('0x11'),_0x21c7aa,_0x0cc0('0xc'));_0x37cf73(_0x187787['result'][_0x0cc0('0x12')]);}})[_0x0cc0('0x13')](function(_0x5a8c2f){logger[_0x0cc0('0xf')](_0x0cc0('0x11'),_0x21c7aa,_0x5a8c2f);_0x56b39a(_0x5a8c2f);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index a558bb9..c8917a6 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 _0x83f1=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','index','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports'];(function(_0xfe047f,_0x1578dd){var _0x36e1b7=function(_0x318c31){while(--_0x318c31){_0xfe047f['push'](_0xfe047f['shift']());}};_0x36e1b7(++_0x1578dd);}(_0x83f1,0x1cc));var _0x183f=function(_0x4be057,_0x591099){_0x4be057=_0x4be057-0x0;var _0x735d8f=_0x83f1[_0x4be057];return _0x735d8f;};'use strict';var multer=require(_0x183f('0x0'));var util=require(_0x183f('0x1'));var path=require(_0x183f('0x2'));var timeout=require(_0x183f('0x3'));var express=require(_0x183f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x183f('0x5'));var interaction=require(_0x183f('0x6'));var config=require(_0x183f('0x7'));var controller=require(_0x183f('0x8'));router[_0x183f('0x9')]('/',auth['isAuthenticated'](),controller[_0x183f('0xa')]);router[_0x183f('0x9')](_0x183f('0xb'),auth['isAuthenticated'](),controller[_0x183f('0xc')]);router['post']('/',auth[_0x183f('0xd')](),controller[_0x183f('0xe')]);router[_0x183f('0xf')](_0x183f('0xb'),auth[_0x183f('0xd')](),controller[_0x183f('0x10')]);router[_0x183f('0x11')]('/:id',auth[_0x183f('0xd')](),controller[_0x183f('0x12')]);module[_0x183f('0x13')]=router; \ No newline at end of file +var _0xc7e9=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','post','create','put','update'];(function(_0x49c344,_0x5c3332){var _0x470b7b=function(_0x418d40){while(--_0x418d40){_0x49c344['push'](_0x49c344['shift']());}};_0x470b7b(++_0x5c3332);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xc7e9[_0x1a72f3];return _0x57ef47;};'use strict';var multer=require(_0x9c7e('0x0'));var util=require(_0x9c7e('0x1'));var path=require('path');var timeout=require(_0x9c7e('0x2'));var express=require(_0x9c7e('0x3'));var router=express[_0x9c7e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9c7e('0x5'));var interaction=require(_0x9c7e('0x6'));var config=require('../../config/environment');var controller=require('./variable.controller');router[_0x9c7e('0x7')]('/',auth['isAuthenticated'](),controller[_0x9c7e('0x8')]);router[_0x9c7e('0x7')](_0x9c7e('0x9'),auth[_0x9c7e('0xa')](),controller['show']);router[_0x9c7e('0xb')]('/',auth[_0x9c7e('0xa')](),controller[_0x9c7e('0xc')]);router[_0x9c7e('0xd')]('/:id',auth[_0x9c7e('0xa')](),controller[_0x9c7e('0xe')]);router['delete'](_0x9c7e('0x9'),auth['isAuthenticated'](),controller[_0x9c7e('0xf')]);module[_0x9c7e('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 401b793..880f935 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 _0xc502=['sequelize','exports','STRING','name'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc502,0x1cc));var _0x2c50=function(_0x2f9c17,_0x103d10){_0x2f9c17=_0x2f9c17-0x0;var _0x43d8a5=_0xc502[_0x2f9c17];return _0x43d8a5;};'use strict';var Sequelize=require(_0x2c50('0x0'));module[_0x2c50('0x1')]={'name':{'type':Sequelize[_0x2c50('0x2')],'unique':_0x2c50('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2c50('0x2')]}}; \ No newline at end of file +var _0x943a=['STRING','name','sequelize','exports'];(function(_0x1c01c1,_0x346d9a){var _0x183c84=function(_0x5bed95){while(--_0x5bed95){_0x1c01c1['push'](_0x1c01c1['shift']());}};_0x183c84(++_0x346d9a);}(_0x943a,0x1aa));var _0xa943=function(_0x432cc7,_0x409ee7){_0x432cc7=_0x432cc7-0x0;var _0x1876f2=_0x943a[_0x432cc7];return _0x1876f2;};'use strict';var Sequelize=require(_0xa943('0x0'));module[_0xa943('0x1')]={'name':{'type':Sequelize[_0xa943('0x2')],'unique':_0xa943('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa943('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index d2c387a..1705a79 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 _0xea02=['reject','save','update','then','destroy','UserProfileResource','sendStatus','stack','send','index','Variable','rawAttributes','fieldName','type','key','model','map','name','query','filters','attributes','fields','length','hasOwnProperty','sort','filter','merge','VIRTUAL','options','where','count','includeAll','include','findAll','rows','catch','keys','intersection','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Variables','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','set','Content-Range','apply'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xea02,0x82));var _0x2ea0=function(_0x117bfc,_0x4ca904){_0x117bfc=_0x117bfc-0x0;var _0x5bb7d0=_0xea02[_0x117bfc];return _0x5bb7d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ea0('0x0'));var zipdir=require(_0x2ea0('0x1'));var jsonpatch=require(_0x2ea0('0x2'));var rp=require('request-promise');var moment=require(_0x2ea0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2ea0('0x4'));var util=require('util');var path=require('path');var sox=require(_0x2ea0('0x5'));var csv=require(_0x2ea0('0x6'));var ejs=require(_0x2ea0('0x7'));var fs=require('fs');var fs_extra=require(_0x2ea0('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2ea0('0x9'));var jsforce=require(_0x2ea0('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2ea0('0x6'));var querystring=require(_0x2ea0('0xb'));var Papa=require('papaparse');var Redis=require(_0x2ea0('0xc'));var authService=require(_0x2ea0('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x2ea0('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ea0('0xf'))(_0x2ea0('0x10'));var utils=require(_0x2ea0('0x11'));var config=require(_0x2ea0('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x483785,_0x5e975c){_0x5e975c=_0x5e975c||0xcc;return function(_0x32b9de){if(_0x32b9de){return _0x483785['sendStatus'](_0x5e975c);}return _0x483785[_0x2ea0('0x13')](_0x5e975c)[_0x2ea0('0x14')]();};}function respondWithResult(_0x42dd26,_0x84e83f){_0x84e83f=_0x84e83f||0xc8;return function(_0x35b11c){if(_0x35b11c){return _0x42dd26[_0x2ea0('0x13')](_0x84e83f)[_0x2ea0('0x15')](_0x35b11c);}};}function respondWithFilteredResult(_0xaed2f0,_0x2d6805){return function(_0x6ddfac){if(_0x6ddfac){var _0x251cd3=typeof _0x2d6805[_0x2ea0('0x16')]===_0x2ea0('0x17')&&typeof _0x2d6805[_0x2ea0('0x18')]===_0x2ea0('0x17');var _0x287d29=_0x6ddfac['count'];var _0x38a251=_0x251cd3?0x0:_0x2d6805[_0x2ea0('0x16')];var _0x541135=_0x251cd3?_0x6ddfac['count']:_0x2d6805[_0x2ea0('0x16')]+_0x2d6805[_0x2ea0('0x18')];var _0x3fa44d;if(_0x541135>=_0x287d29){_0x541135=_0x287d29;_0x3fa44d=0xc8;}else{_0x3fa44d=0xce;}_0xaed2f0[_0x2ea0('0x13')](_0x3fa44d);return _0xaed2f0[_0x2ea0('0x19')](_0x2ea0('0x1a'),_0x38a251+'-'+_0x541135+'/'+_0x287d29)[_0x2ea0('0x15')](_0x6ddfac);}return null;};}function patchUpdates(_0x4d17c3){return function(_0x46c0f2){try{jsonpatch[_0x2ea0('0x1b')](_0x46c0f2,_0x4d17c3,!![]);}catch(_0x45864b){return BPromise[_0x2ea0('0x1c')](_0x45864b);}return _0x46c0f2[_0x2ea0('0x1d')]();};}function saveUpdates(_0x488d85,_0x105ffd){return function(_0x2f24a7){if(_0x2f24a7){return _0x2f24a7[_0x2ea0('0x1e')](_0x488d85)[_0x2ea0('0x1f')](function(_0x42b22c){return _0x42b22c;});}return null;};}function removeEntity(_0x162377,_0x373021){return function(_0x1fbcc2){if(_0x1fbcc2){return _0x1fbcc2[_0x2ea0('0x20')]()[_0x2ea0('0x1f')](function(){var _0x2d203b=_0x1fbcc2['get']({'plain':!![]});var _0x50cfce='Variables';return db[_0x2ea0('0x21')][_0x2ea0('0x20')]({'where':{'type':_0x50cfce,'resourceId':_0x2d203b['id']}})[_0x2ea0('0x1f')](function(){return _0x1fbcc2;});})['then'](function(){_0x162377['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e119a,_0x6ca890){return function(_0x45e144){if(!_0x45e144){_0x2e119a[_0x2ea0('0x22')](0x194);}return _0x45e144;};}function handleError(_0x1fb7a0,_0x47d685){_0x47d685=_0x47d685||0x1f4;return function(_0x3ba8cd){logger['error'](_0x3ba8cd[_0x2ea0('0x23')]);if(_0x3ba8cd['name']){delete _0x3ba8cd['name'];}_0x1fb7a0['status'](_0x47d685)[_0x2ea0('0x24')](_0x3ba8cd);};}exports[_0x2ea0('0x25')]=function(_0x56104f,_0x12a80c){var _0x133d56={},_0x347b00={},_0x5427bb={'count':0x0,'rows':[]};var _0x54fdb3=_['map'](db[_0x2ea0('0x26')][_0x2ea0('0x27')],function(_0x342b70){return{'name':_0x342b70[_0x2ea0('0x28')],'type':_0x342b70[_0x2ea0('0x29')][_0x2ea0('0x2a')]};});_0x347b00[_0x2ea0('0x2b')]=_[_0x2ea0('0x2c')](_0x54fdb3,_0x2ea0('0x2d'));_0x347b00[_0x2ea0('0x2e')]=_['keys'](_0x56104f['query']);_0x347b00[_0x2ea0('0x2f')]=_['intersection'](_0x347b00[_0x2ea0('0x2b')],_0x347b00[_0x2ea0('0x2e')]);_0x133d56[_0x2ea0('0x30')]=_['intersection'](_0x347b00[_0x2ea0('0x2b')],qs['fields'](_0x56104f[_0x2ea0('0x2e')][_0x2ea0('0x31')]));_0x133d56['attributes']=_0x133d56[_0x2ea0('0x30')][_0x2ea0('0x32')]?_0x133d56[_0x2ea0('0x30')]:_0x347b00[_0x2ea0('0x2b')];if(!_0x56104f[_0x2ea0('0x2e')][_0x2ea0('0x33')]('nolimit')){_0x133d56[_0x2ea0('0x18')]=qs['limit'](_0x56104f['query'][_0x2ea0('0x18')]);_0x133d56[_0x2ea0('0x16')]=qs[_0x2ea0('0x16')](_0x56104f['query']['offset']);}_0x133d56['order']=qs[_0x2ea0('0x34')](_0x56104f[_0x2ea0('0x2e')]['sort']);_0x133d56['where']=qs['filters'](_['pick'](_0x56104f[_0x2ea0('0x2e')],_0x347b00[_0x2ea0('0x2f')]),_0x54fdb3);if(_0x56104f[_0x2ea0('0x2e')][_0x2ea0('0x35')]){_0x133d56['where']=_[_0x2ea0('0x36')](_0x133d56['where'],{'$or':_[_0x2ea0('0x2c')](_0x54fdb3,function(_0x3b0e7d){if(_0x3b0e7d[_0x2ea0('0x29')]!==_0x2ea0('0x37')){var _0x1dd2ae={};_0x1dd2ae[_0x3b0e7d[_0x2ea0('0x2d')]]={'$like':'%'+_0x56104f[_0x2ea0('0x2e')][_0x2ea0('0x35')]+'%'};return _0x1dd2ae;}})});}_0x133d56=_['merge']({},_0x133d56,_0x56104f[_0x2ea0('0x38')]);var _0x57c72b={'where':_0x133d56[_0x2ea0('0x39')]};return db[_0x2ea0('0x26')][_0x2ea0('0x3a')](_0x57c72b)[_0x2ea0('0x1f')](function(_0x3c9f54){_0x5427bb[_0x2ea0('0x3a')]=_0x3c9f54;if(_0x56104f[_0x2ea0('0x2e')][_0x2ea0('0x3b')]){_0x133d56[_0x2ea0('0x3c')]=[{'all':!![]}];}return db['Variable'][_0x2ea0('0x3d')](_0x133d56);})[_0x2ea0('0x1f')](function(_0x6c60ae){_0x5427bb[_0x2ea0('0x3e')]=_0x6c60ae;return _0x5427bb;})[_0x2ea0('0x1f')](respondWithFilteredResult(_0x12a80c,_0x133d56))[_0x2ea0('0x3f')](handleError(_0x12a80c,null));};exports['show']=function(_0x2f0faf,_0x31d98d){var _0x195896={'raw':!![],'where':{'id':_0x2f0faf['params']['id']}},_0x194ad5={};_0x194ad5[_0x2ea0('0x2b')]=_[_0x2ea0('0x40')](db[_0x2ea0('0x26')][_0x2ea0('0x27')]);_0x194ad5['query']=_[_0x2ea0('0x40')](_0x2f0faf[_0x2ea0('0x2e')]);_0x194ad5[_0x2ea0('0x2f')]=_[_0x2ea0('0x41')](_0x194ad5[_0x2ea0('0x2b')],_0x194ad5[_0x2ea0('0x2e')]);_0x195896[_0x2ea0('0x30')]=_[_0x2ea0('0x41')](_0x194ad5[_0x2ea0('0x2b')],qs[_0x2ea0('0x31')](_0x2f0faf[_0x2ea0('0x2e')][_0x2ea0('0x31')]));_0x195896[_0x2ea0('0x30')]=_0x195896[_0x2ea0('0x30')][_0x2ea0('0x32')]?_0x195896[_0x2ea0('0x30')]:_0x194ad5[_0x2ea0('0x2b')];if(_0x2f0faf[_0x2ea0('0x2e')][_0x2ea0('0x3b')]){_0x195896['include']=[{'all':!![]}];}_0x195896=_[_0x2ea0('0x36')]({},_0x195896,_0x2f0faf['options']);return db[_0x2ea0('0x26')][_0x2ea0('0x42')](_0x195896)[_0x2ea0('0x1f')](handleEntityNotFound(_0x31d98d,null))[_0x2ea0('0x1f')](respondWithResult(_0x31d98d,null))[_0x2ea0('0x3f')](handleError(_0x31d98d,null));};exports[_0x2ea0('0x43')]=function(_0x5e7d27,_0x41d52f){return db['Variable'][_0x2ea0('0x43')](_0x5e7d27[_0x2ea0('0x44')],{})['then'](function(_0x2ec3f0){var _0x59ba6c=_0x5e7d27['user']['get']({'plain':!![]});if(!_0x59ba6c)throw new Error(_0x2ea0('0x45'));if(_0x59ba6c[_0x2ea0('0x46')]===_0x2ea0('0x47')){var _0x4d764b=_0x2ec3f0['get']({'plain':!![]});var _0x17132c=_0x2ea0('0x48');return db[_0x2ea0('0x49')]['find']({'where':{'name':_0x17132c,'userProfileId':_0x59ba6c[_0x2ea0('0x4a')]},'raw':!![]})[_0x2ea0('0x1f')](function(_0x5f2365){if(_0x5f2365&&_0x5f2365[_0x2ea0('0x4b')]===0x0){return db[_0x2ea0('0x21')]['create']({'name':_0x4d764b[_0x2ea0('0x2d')],'resourceId':_0x4d764b['id'],'type':_0x5f2365[_0x2ea0('0x2d')],'sectionId':_0x5f2365['id']},{})[_0x2ea0('0x1f')](function(){return _0x2ec3f0;});}else{return _0x2ec3f0;}})[_0x2ea0('0x3f')](function(_0x2bffca){logger[_0x2ea0('0x4c')](_0x2ea0('0x4d'),_0x2bffca);throw _0x2bffca;});}return _0x2ec3f0;})[_0x2ea0('0x1f')](respondWithResult(_0x41d52f,0xc9))[_0x2ea0('0x3f')](handleError(_0x41d52f,null));};exports[_0x2ea0('0x1e')]=function(_0x55c353,_0x54dc1e){if(_0x55c353['body']['id']){delete _0x55c353[_0x2ea0('0x44')]['id'];}return db[_0x2ea0('0x26')][_0x2ea0('0x42')]({'where':{'id':_0x55c353[_0x2ea0('0x4e')]['id']}})[_0x2ea0('0x1f')](handleEntityNotFound(_0x54dc1e,null))[_0x2ea0('0x1f')](saveUpdates(_0x55c353[_0x2ea0('0x44')],null))[_0x2ea0('0x1f')](respondWithResult(_0x54dc1e,null))[_0x2ea0('0x3f')](handleError(_0x54dc1e,null));};exports[_0x2ea0('0x20')]=function(_0x3a2f4d,_0x450382){return db[_0x2ea0('0x26')][_0x2ea0('0x42')]({'where':{'id':_0x3a2f4d[_0x2ea0('0x4e')]['id']}})[_0x2ea0('0x1f')](handleEntityNotFound(_0x450382,null))[_0x2ea0('0x1f')](removeEntity(_0x450382,null))[_0x2ea0('0x3f')](handleError(_0x450382,null));}; \ No newline at end of file +var _0x1b15=['UserProfileResource','end','sendStatus','error','stack','name','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','eml-format','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','get','Variables'];(function(_0x81c99,_0x2c8069){var _0x611ce8=function(_0x795b5e){while(--_0x795b5e){_0x81c99['push'](_0x81c99['shift']());}};_0x611ce8(++_0x2c8069);}(_0x1b15,0x1b5));var _0x51b1=function(_0x229d24,_0x518fc1){_0x229d24=_0x229d24-0x0;var _0x584576=_0x1b15[_0x229d24];return _0x584576;};'use strict';var emlformat=require(_0x51b1('0x0'));var rimraf=require(_0x51b1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x51b1('0x2'));var moment=require(_0x51b1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x51b1('0x4'));var util=require(_0x51b1('0x5'));var path=require(_0x51b1('0x6'));var sox=require('sox');var csv=require(_0x51b1('0x7'));var ejs=require(_0x51b1('0x8'));var fs=require('fs');var fs_extra=require(_0x51b1('0x9'));var _=require(_0x51b1('0xa'));var squel=require(_0x51b1('0xb'));var crypto=require(_0x51b1('0xc'));var jsforce=require(_0x51b1('0xd'));var deskjs=require(_0x51b1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x51b1('0xf'));var Papa=require(_0x51b1('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x51b1('0x11'));var hardwareService=require(_0x51b1('0x12'));var logger=require(_0x51b1('0x13'))(_0x51b1('0x14'));var utils=require('../../config/utils');var config=require(_0x51b1('0x15'));var licenseUtil=require(_0x51b1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b7e82,_0x4c80f2){_0x4c80f2=_0x4c80f2||0xcc;return function(_0x27b537){if(_0x27b537){return _0x3b7e82['sendStatus'](_0x4c80f2);}return _0x3b7e82['status'](_0x4c80f2)['end']();};}function respondWithResult(_0x372f69,_0x13163d){_0x13163d=_0x13163d||0xc8;return function(_0x4de805){if(_0x4de805){return _0x372f69[_0x51b1('0x17')](_0x13163d)[_0x51b1('0x18')](_0x4de805);}};}function respondWithFilteredResult(_0x481db2,_0x41f670){return function(_0x52cae5){if(_0x52cae5){var _0x4cbdb4=typeof _0x41f670[_0x51b1('0x19')]==='undefined'&&typeof _0x41f670[_0x51b1('0x1a')]===_0x51b1('0x1b');var _0x3f86e2=_0x52cae5[_0x51b1('0x1c')];var _0xfd6104=_0x4cbdb4?0x0:_0x41f670['offset'];var _0x343439=_0x4cbdb4?_0x52cae5[_0x51b1('0x1c')]:_0x41f670['offset']+_0x41f670[_0x51b1('0x1a')];var _0x2929c7;if(_0x343439>=_0x3f86e2){_0x343439=_0x3f86e2;_0x2929c7=0xc8;}else{_0x2929c7=0xce;}_0x481db2['status'](_0x2929c7);return _0x481db2[_0x51b1('0x1d')](_0x51b1('0x1e'),_0xfd6104+'-'+_0x343439+'/'+_0x3f86e2)[_0x51b1('0x18')](_0x52cae5);}return null;};}function patchUpdates(_0x42bc82){return function(_0x4a98ea){try{jsonpatch['apply'](_0x4a98ea,_0x42bc82,!![]);}catch(_0x194f07){return BPromise[_0x51b1('0x1f')](_0x194f07);}return _0x4a98ea['save']();};}function saveUpdates(_0x565969,_0x1a2b3f){return function(_0x3a058b){if(_0x3a058b){return _0x3a058b[_0x51b1('0x20')](_0x565969)[_0x51b1('0x21')](function(_0x86e7f5){return _0x86e7f5;});}return null;};}function removeEntity(_0x3b8a00,_0x29c0eb){return function(_0x4ac6b6){if(_0x4ac6b6){return _0x4ac6b6[_0x51b1('0x22')]()['then'](function(){var _0xf3595b=_0x4ac6b6[_0x51b1('0x23')]({'plain':!![]});var _0xcdff0a=_0x51b1('0x24');return db[_0x51b1('0x25')][_0x51b1('0x22')]({'where':{'type':_0xcdff0a,'resourceId':_0xf3595b['id']}})[_0x51b1('0x21')](function(){return _0x4ac6b6;});})[_0x51b1('0x21')](function(){_0x3b8a00[_0x51b1('0x17')](0xcc)[_0x51b1('0x26')]();});}};}function handleEntityNotFound(_0x5d5ba5,_0x8da5e3){return function(_0xf2ddfc){if(!_0xf2ddfc){_0x5d5ba5[_0x51b1('0x27')](0x194);}return _0xf2ddfc;};}function handleError(_0x406c0f,_0x46491d){_0x46491d=_0x46491d||0x1f4;return function(_0x1cf782){logger[_0x51b1('0x28')](_0x1cf782[_0x51b1('0x29')]);if(_0x1cf782['name']){delete _0x1cf782[_0x51b1('0x2a')];}_0x406c0f[_0x51b1('0x17')](_0x46491d)['send'](_0x1cf782);};}exports['index']=function(_0x381df6,_0x56460d){var _0x1d5d05={},_0x6b336e={},_0x1ca939={'count':0x0,'rows':[]};var _0x22b1d8=_[_0x51b1('0x2b')](db[_0x51b1('0x2c')][_0x51b1('0x2d')],function(_0x552d94){return{'name':_0x552d94[_0x51b1('0x2e')],'type':_0x552d94[_0x51b1('0x2f')][_0x51b1('0x30')]};});_0x6b336e[_0x51b1('0x31')]=_['map'](_0x22b1d8,_0x51b1('0x2a'));_0x6b336e[_0x51b1('0x32')]=_[_0x51b1('0x33')](_0x381df6[_0x51b1('0x32')]);_0x6b336e[_0x51b1('0x34')]=_[_0x51b1('0x35')](_0x6b336e[_0x51b1('0x31')],_0x6b336e[_0x51b1('0x32')]);_0x1d5d05[_0x51b1('0x36')]=_['intersection'](_0x6b336e[_0x51b1('0x31')],qs[_0x51b1('0x37')](_0x381df6[_0x51b1('0x32')][_0x51b1('0x37')]));_0x1d5d05[_0x51b1('0x36')]=_0x1d5d05['attributes'][_0x51b1('0x38')]?_0x1d5d05['attributes']:_0x6b336e[_0x51b1('0x31')];if(!_0x381df6[_0x51b1('0x32')][_0x51b1('0x39')](_0x51b1('0x3a'))){_0x1d5d05['limit']=qs[_0x51b1('0x1a')](_0x381df6['query']['limit']);_0x1d5d05[_0x51b1('0x19')]=qs[_0x51b1('0x19')](_0x381df6['query'][_0x51b1('0x19')]);}_0x1d5d05[_0x51b1('0x3b')]=qs[_0x51b1('0x3c')](_0x381df6['query']['sort']);_0x1d5d05[_0x51b1('0x3d')]=qs[_0x51b1('0x34')](_[_0x51b1('0x3e')](_0x381df6[_0x51b1('0x32')],_0x6b336e[_0x51b1('0x34')]),_0x22b1d8);if(_0x381df6['query'][_0x51b1('0x3f')]){_0x1d5d05['where']=_[_0x51b1('0x40')](_0x1d5d05[_0x51b1('0x3d')],{'$or':_[_0x51b1('0x2b')](_0x22b1d8,function(_0x41d88b){if(_0x41d88b[_0x51b1('0x2f')]!==_0x51b1('0x41')){var _0x471b7b={};_0x471b7b[_0x41d88b[_0x51b1('0x2a')]]={'$like':'%'+_0x381df6[_0x51b1('0x32')]['filter']+'%'};return _0x471b7b;}})});}_0x1d5d05=_[_0x51b1('0x40')]({},_0x1d5d05,_0x381df6[_0x51b1('0x42')]);var _0x469719={'where':_0x1d5d05['where']};return db[_0x51b1('0x2c')][_0x51b1('0x1c')](_0x469719)[_0x51b1('0x21')](function(_0x1414d1){_0x1ca939['count']=_0x1414d1;if(_0x381df6[_0x51b1('0x32')][_0x51b1('0x43')]){_0x1d5d05[_0x51b1('0x44')]=[{'all':!![]}];}return db[_0x51b1('0x2c')]['findAll'](_0x1d5d05);})[_0x51b1('0x21')](function(_0x2fc79d){_0x1ca939[_0x51b1('0x45')]=_0x2fc79d;return _0x1ca939;})[_0x51b1('0x21')](respondWithFilteredResult(_0x56460d,_0x1d5d05))[_0x51b1('0x46')](handleError(_0x56460d,null));};exports['show']=function(_0x14b024,_0x543c58){var _0x330473={'raw':!![],'where':{'id':_0x14b024[_0x51b1('0x47')]['id']}},_0x5b0cee={};_0x5b0cee['model']=_['keys'](db['Variable'][_0x51b1('0x2d')]);_0x5b0cee['query']=_[_0x51b1('0x33')](_0x14b024['query']);_0x5b0cee[_0x51b1('0x34')]=_[_0x51b1('0x35')](_0x5b0cee[_0x51b1('0x31')],_0x5b0cee['query']);_0x330473[_0x51b1('0x36')]=_[_0x51b1('0x35')](_0x5b0cee[_0x51b1('0x31')],qs[_0x51b1('0x37')](_0x14b024[_0x51b1('0x32')][_0x51b1('0x37')]));_0x330473['attributes']=_0x330473[_0x51b1('0x36')][_0x51b1('0x38')]?_0x330473[_0x51b1('0x36')]:_0x5b0cee[_0x51b1('0x31')];if(_0x14b024[_0x51b1('0x32')][_0x51b1('0x43')]){_0x330473[_0x51b1('0x44')]=[{'all':!![]}];}_0x330473=_[_0x51b1('0x40')]({},_0x330473,_0x14b024[_0x51b1('0x42')]);return db[_0x51b1('0x2c')][_0x51b1('0x48')](_0x330473)[_0x51b1('0x21')](handleEntityNotFound(_0x543c58,null))['then'](respondWithResult(_0x543c58,null))[_0x51b1('0x46')](handleError(_0x543c58,null));};exports[_0x51b1('0x49')]=function(_0x114536,_0x4fcce4){return db[_0x51b1('0x2c')]['create'](_0x114536[_0x51b1('0x4a')],{})[_0x51b1('0x21')](function(_0x280938){var _0xbdc09a=_0x114536['user'][_0x51b1('0x23')]({'plain':!![]});if(!_0xbdc09a)throw new Error(_0x51b1('0x4b'));if(_0xbdc09a['role']===_0x51b1('0x4c')){var _0x996465=_0x280938['get']({'plain':!![]});var _0x39a70c=_0x51b1('0x24');return db[_0x51b1('0x4d')]['find']({'where':{'name':_0x39a70c,'userProfileId':_0xbdc09a['userProfileId']},'raw':!![]})[_0x51b1('0x21')](function(_0x4e0c15){if(_0x4e0c15&&_0x4e0c15[_0x51b1('0x4e')]===0x0){return db[_0x51b1('0x25')]['create']({'name':_0x996465[_0x51b1('0x2a')],'resourceId':_0x996465['id'],'type':_0x4e0c15[_0x51b1('0x2a')],'sectionId':_0x4e0c15['id']},{})['then'](function(){return _0x280938;});}else{return _0x280938;}})[_0x51b1('0x46')](function(_0x5e7a66){logger[_0x51b1('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e7a66);throw _0x5e7a66;});}return _0x280938;})[_0x51b1('0x21')](respondWithResult(_0x4fcce4,0xc9))[_0x51b1('0x46')](handleError(_0x4fcce4,null));};exports['update']=function(_0xf69b8f,_0x5f0cfd){if(_0xf69b8f['body']['id']){delete _0xf69b8f[_0x51b1('0x4a')]['id'];}return db[_0x51b1('0x2c')]['find']({'where':{'id':_0xf69b8f[_0x51b1('0x47')]['id']}})[_0x51b1('0x21')](handleEntityNotFound(_0x5f0cfd,null))[_0x51b1('0x21')](saveUpdates(_0xf69b8f[_0x51b1('0x4a')],null))[_0x51b1('0x21')](respondWithResult(_0x5f0cfd,null))[_0x51b1('0x46')](handleError(_0x5f0cfd,null));};exports['destroy']=function(_0x1c5e92,_0x4f6f12){return db[_0x51b1('0x2c')]['find']({'where':{'id':_0x1c5e92[_0x51b1('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f6f12,null))[_0x51b1('0x21')](removeEntity(_0x4f6f12,null))['catch'](handleError(_0x4f6f12,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 0571d54..7dd94a5 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 _0x366f=['define','Variable','tools_variables','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports'];(function(_0x2dbcc8,_0x5e6b9a){var _0x4e0a07=function(_0x79cfc8){while(--_0x79cfc8){_0x2dbcc8['push'](_0x2dbcc8['shift']());}};_0x4e0a07(++_0x5e6b9a);}(_0x366f,0x1d7));var _0xf366=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x366f[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0xf366('0x0'));var util=require(_0xf366('0x1'));var logger=require(_0xf366('0x2'))(_0xf366('0x3'));var moment=require('moment');var BPromise=require(_0xf366('0x4'));var rp=require(_0xf366('0x5'));var fs=require('fs');var path=require(_0xf366('0x6'));var rimraf=require(_0xf366('0x7'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0xf366('0x8')]=function(_0x20426e,_0x5d065e){return _0x20426e[_0xf366('0x9')](_0xf366('0xa'),attributes,{'tableName':_0xf366('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf2e=['Variable','tools_variables','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./variable.attributes','exports','define'];(function(_0x4fa43f,_0x45a508){var _0x38c580=function(_0x3aaf4d){while(--_0x3aaf4d){_0x4fa43f['push'](_0x4fa43f['shift']());}};_0x38c580(++_0x45a508);}(_0xaf2e,0x120));var _0xeaf2=function(_0xbbb5a3,_0x5e9899){_0xbbb5a3=_0xbbb5a3-0x0;var _0x419a68=_0xaf2e[_0xbbb5a3];return _0x419a68;};'use strict';var _=require(_0xeaf2('0x0'));var util=require(_0xeaf2('0x1'));var logger=require(_0xeaf2('0x2'))(_0xeaf2('0x3'));var moment=require(_0xeaf2('0x4'));var BPromise=require('bluebird');var rp=require(_0xeaf2('0x5'));var fs=require('fs');var path=require(_0xeaf2('0x6'));var rimraf=require(_0xeaf2('0x7'));var config=require('../../config/environment');var attributes=require(_0xeaf2('0x8'));module[_0xeaf2('0x9')]=function(_0x36cfe8,_0x59f4fd){return _0x36cfe8[_0xeaf2('0xa')](_0xeaf2('0xb'),attributes,{'tableName':_0xeaf2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 6d88d54..b500347 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x44d6b8,_0xe7e065){var _0x18cbfa=function(_0x1704bc){while(--_0x1704bc){_0x44d6b8['push'](_0x44d6b8['shift']());}};_0x18cbfa(++_0xe7e065);}(_0x1cb9,0x14e));var _0x91cb=function(_0x34996e,_0x506ddc){_0x34996e=_0x34996e-0x0;var _0x589bfb=_0x1cb9[_0x34996e];return _0x589bfb;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file +var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x426ab0,_0x13c67d){var _0x3bdb3d=function(_0x14f669){while(--_0x14f669){_0x426ab0['push'](_0x426ab0['shift']());}};_0x3bdb3d(++_0x13c67d);}(_0x5fc3,0xa8));var _0x35fc=function(_0x274dd7,_0x2e6051){_0x274dd7=_0x274dd7-0x0;var _0x148829=_0x5fc3[_0x274dd7];return _0x148829;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index dcc8f5e..cd34111 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 _0x6278=['/reset','isAuthenticated','reset','/pull','pull','restart','/migrations','migrations','exports','../../components/auth/service','./version.controller','get','index','/fetch','canUpdate'];(function(_0x4bc238,_0x1244ec){var _0x14c74e=function(_0x146f00){while(--_0x146f00){_0x4bc238['push'](_0x4bc238['shift']());}};_0x14c74e(++_0x1244ec);}(_0x6278,0x162));var _0x8627=function(_0x3b247d,_0xbe4218){_0x3b247d=_0x3b247d-0x0;var _0x131bcf=_0x6278[_0x3b247d];return _0x131bcf;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x8627('0x0'));var controller=require(_0x8627('0x1'));router[_0x8627('0x2')]('/',controller[_0x8627('0x3')]);router[_0x8627('0x2')](_0x8627('0x4'),auth['isAuthenticated'](),auth[_0x8627('0x5')](),controller['fetch']);router[_0x8627('0x2')](_0x8627('0x6'),auth[_0x8627('0x7')](),auth[_0x8627('0x5')](),controller[_0x8627('0x8')]);router[_0x8627('0x2')](_0x8627('0x9'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x8627('0xa')]);router[_0x8627('0x2')]('/restart',auth[_0x8627('0x7')](),controller[_0x8627('0xb')]);router[_0x8627('0x2')](_0x8627('0xc'),controller[_0x8627('0xd')]);module[_0x8627('0xe')]=router; \ No newline at end of file +var _0x805a=['isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','express','Router','../../components/auth/service','./version.controller','get','index'];(function(_0x149150,_0x362585){var _0x2265ce=function(_0x4363e5){while(--_0x4363e5){_0x149150['push'](_0x149150['shift']());}};_0x2265ce(++_0x362585);}(_0x805a,0x1bc));var _0xa805=function(_0x301785,_0x506056){_0x301785=_0x301785-0x0;var _0x4ea53b=_0x805a[_0x301785];return _0x4ea53b;};'use strict';var express=require(_0xa805('0x0'));var router=express[_0xa805('0x1')]();var auth=require(_0xa805('0x2'));var controller=require(_0xa805('0x3'));router[_0xa805('0x4')]('/',controller[_0xa805('0x5')]);router['get']('/fetch',auth[_0xa805('0x6')](),auth[_0xa805('0x7')](),controller[_0xa805('0x8')]);router[_0xa805('0x4')](_0xa805('0x9'),auth[_0xa805('0x6')](),auth[_0xa805('0x7')](),controller[_0xa805('0xa')]);router[_0xa805('0x4')](_0xa805('0xb'),auth[_0xa805('0x6')](),auth['canUpdate'](),controller[_0xa805('0xc')]);router[_0xa805('0x4')](_0xa805('0xd'),auth[_0xa805('0x6')](),controller[_0xa805('0xe')]);router[_0xa805('0x4')]('/migrations',controller['migrations']);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index c5dacc0..011d766 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 _0xde9c=['Migration','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','version','compare-versions','child_process','../../mysqldb','../../config/pm2','../../config/logger','simple-git','root','index','exports','query','latest','tags','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','server','length','sequelize'];(function(_0x53e91c,_0x3df9b0){var _0x40c7fe=function(_0x165ba5){while(--_0x165ba5){_0x53e91c['push'](_0x53e91c['shift']());}};_0x40c7fe(++_0x3df9b0);}(_0xde9c,0x9a));var _0xcde9=function(_0x12e91a,_0x517503){_0x12e91a=_0x12e91a-0x0;var _0x300cda=_0xde9c[_0x12e91a];return _0x300cda;};'use strict';var Umzug=require(_0xcde9('0x0'));var path=require(_0xcde9('0x1'));var fs=require('fs');var _=require(_0xcde9('0x2'));var pkginfo=require('pkginfo')(module,_0xcde9('0x3'));var compareVersions=require(_0xcde9('0x4'));var exec=require(_0xcde9('0x5'))['exec'];var db=require(_0xcde9('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0xcde9('0x7'));var logger=require(_0xcde9('0x8'))('update');var git=require(_0xcde9('0x9'))(config[_0xcde9('0xa')]);exports[_0xcde9('0xb')]=function(_0x2bda66,_0x10a7d7){var _0x481524={'current':module[_0xcde9('0xc')][_0xcde9('0x3')],'phonebar':0x2};if(_0x2bda66[_0xcde9('0xd')]&&_0x2bda66[_0xcde9('0xd')][_0xcde9('0xe')]){return git['fetch']()[_0xcde9('0xf')](function(_0x151813,_0x51ad64){_0x481524['latest']=(_0x151813?module[_0xcde9('0xc')][_0xcde9('0x3')]:_0x51ad64[_0xcde9('0xe')])||'2.0.0';return _0x10a7d7['status'](0xc8)['json'](_0x481524);});}else{return _0x10a7d7[_0xcde9('0x10')](0xc8)[_0xcde9('0x11')](_0x481524);}};exports[_0xcde9('0x12')]=function(_0x3f13bd,_0xca4e){return git[_0xcde9('0x12')]([_0xcde9('0x13'),_0xcde9('0x14')],function(_0x56822e){if(_0x56822e){logger[_0xcde9('0x15')](_0x56822e);return _0xca4e[_0xcde9('0x10')](0x1f4)[_0xcde9('0x11')](_0x56822e);}logger[_0xcde9('0x16')](_0xcde9('0x17'));return _0xca4e[_0xcde9('0x10')](0xc8)[_0xcde9('0x11')]({'output':_0xcde9('0x18')});});};exports[_0xcde9('0x19')]=function(_0x2bd848,_0x53147b){return git[_0xcde9('0x19')](['--hard',_0xcde9('0x1a')],function(_0x12b125){if(_0x12b125){logger[_0xcde9('0x15')](_0x12b125);return _0x53147b['status'](0x1f4)[_0xcde9('0x11')](_0x12b125);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x53147b[_0xcde9('0x10')](0xc8)['json']({'output':_0xcde9('0x1b')});});};exports[_0xcde9('0x1c')]=function(_0x59085b,_0x5b64b1){exec('npm\x20install\x20--production',function(_0x2105ab,_0x2999e3,_0x446970){logger[_0xcde9('0x16')](_0x2999e3);logger[_0xcde9('0x16')](_0x446970);if(_0x2105ab){logger[_0xcde9('0x15')](_0x2105ab);return _0x5b64b1[_0xcde9('0x10')](0x1f4)['json'](_0x2105ab);}return _0x5b64b1[_0xcde9('0x10')](0xc8)[_0xcde9('0x11')]({'output':_0x2999e3});});};exports[_0xcde9('0x1d')]=function(_0x4c738f,_0x40ddc6){return pm2[_0xcde9('0x1d')](_0xcde9('0x1e'))[_0xcde9('0x1f')](function(_0xc98a46){logger[_0xcde9('0x16')]('pm2\x20restart\x20motion\x20%s',_0xc98a46);return _0x40ddc6[_0xcde9('0x10')](0xc8)[_0xcde9('0x11')]({'output':_0xcde9('0x20')});})[_0xcde9('0x21')](function(_0x5d814d){logger[_0xcde9('0x15')](_0x5d814d);return _0x40ddc6['status'](0x1f4)[_0xcde9('0x11')](_0x5d814d);});};exports[_0xcde9('0x22')]=function(_0x3024b6,_0x326fcd){var _0x39164f=fs['readdirSync'](path['join'](config[_0xcde9('0xa')],_0xcde9('0x23'),_0xcde9('0x22')));var _0x34e983=[];for(var _0x365d1c=0x0;_0x365d1c<_0x39164f['length'];_0x365d1c++){var _0x5067a2=_0x39164f[_0x365d1c]['replace']('.js','');if(compareVersions(module[_0xcde9('0xc')][_0xcde9('0x3')],_0x5067a2)===-0x1){_0x34e983['push'](_0x5067a2);}}if(_0x34e983[_0xcde9('0x24')]){var _0x4f1f48=_0x34e983['sort'](compareVersions);var _0x54a530=new Umzug({'storage':_0xcde9('0x25'),'storageOptions':{'model':db[_0xcde9('0x26')],'modelName':_0xcde9('0x26'),'columnName':_0xcde9('0x3')},'migrations':{'params':[db[_0xcde9('0x25')]['getQueryInterface'](),db[_0xcde9('0x25')]['constructor'],function(){throw new Error(_0xcde9('0x27'));}],'path':path[_0xcde9('0x28')](config['root'],_0xcde9('0x23'),_0xcde9('0x22')),'pattern':/\.js$/}});_0x54a530['up']({'migrations':_[_0xcde9('0x29')](_0x4f1f48,function(_0x19f8de){return _0x19f8de+_0xcde9('0x2a');})})[_0xcde9('0x1f')](function(){return _0x326fcd[_0xcde9('0x10')](0xc8)[_0xcde9('0x11')]({'output':_0xcde9('0x2b')+module['exports'][_0xcde9('0x3')]+_0xcde9('0x2c')+_[_0xcde9('0x2d')](_0x4f1f48),'migrations':_[_0xcde9('0x28')](_0x4f1f48)});})[_0xcde9('0x21')](function(_0x21d9d3){if(_0x21d9d3 instanceof db[_0xcde9('0x25')][_0xcde9('0x2e')]){return _0x326fcd['status'](0xc8)['json']({'output':_0xcde9('0x2f')});}else{return _0x326fcd[_0xcde9('0x10')](0x1f4)['json'](_0x21d9d3);}});}else{return _0x326fcd[_0xcde9('0x10')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0xbb0d=['getQueryInterface','constructor','map','.js','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','length','replace','push','sequelize','Migration'];(function(_0x353abb,_0x194c80){var _0x43c9c5=function(_0x456b74){while(--_0x456b74){_0x353abb['push'](_0x353abb['shift']());}};_0x43c9c5(++_0x194c80);}(_0xbb0d,0x11d));var _0xdbb0=function(_0x52ccd4,_0x4587d5){_0x52ccd4=_0x52ccd4-0x0;var _0x4a6c56=_0xbb0d[_0x52ccd4];return _0x4a6c56;};'use strict';var Umzug=require(_0xdbb0('0x0'));var path=require(_0xdbb0('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0xdbb0('0x2'));var compareVersions=require(_0xdbb0('0x3'));var exec=require(_0xdbb0('0x4'))[_0xdbb0('0x5')];var db=require(_0xdbb0('0x6'))['db'];var config=require(_0xdbb0('0x7'));var pm2=require(_0xdbb0('0x8'));var logger=require('../../config/logger')(_0xdbb0('0x9'));var git=require(_0xdbb0('0xa'))(config[_0xdbb0('0xb')]);exports[_0xdbb0('0xc')]=function(_0x1d565b,_0x1d8aec){var _0x4e55b1={'current':module[_0xdbb0('0xd')][_0xdbb0('0x2')],'phonebar':0x2};if(_0x1d565b[_0xdbb0('0xe')]&&_0x1d565b[_0xdbb0('0xe')][_0xdbb0('0xf')]){return git[_0xdbb0('0x10')]()[_0xdbb0('0x11')](function(_0x54362f,_0x2031d1){_0x4e55b1[_0xdbb0('0xf')]=(_0x54362f?module[_0xdbb0('0xd')][_0xdbb0('0x2')]:_0x2031d1['latest'])||_0xdbb0('0x12');return _0x1d8aec[_0xdbb0('0x13')](0xc8)[_0xdbb0('0x14')](_0x4e55b1);});}else{return _0x1d8aec[_0xdbb0('0x13')](0xc8)[_0xdbb0('0x14')](_0x4e55b1);}};exports[_0xdbb0('0x10')]=function(_0x127daa,_0x1f62e6){return git[_0xdbb0('0x10')]([_0xdbb0('0x15'),_0xdbb0('0x16')],function(_0x477f53){if(_0x477f53){logger[_0xdbb0('0x17')](_0x477f53);return _0x1f62e6[_0xdbb0('0x13')](0x1f4)[_0xdbb0('0x14')](_0x477f53);}logger[_0xdbb0('0x18')](_0xdbb0('0x19'));return _0x1f62e6[_0xdbb0('0x13')](0xc8)['json']({'output':_0xdbb0('0x1a')});});};exports[_0xdbb0('0x1b')]=function(_0x3c5e7c,_0x3822ce){return git[_0xdbb0('0x1b')]([_0xdbb0('0x1c'),_0xdbb0('0x1d')],function(_0x12e8f8){if(_0x12e8f8){logger[_0xdbb0('0x17')](_0x12e8f8);return _0x3822ce[_0xdbb0('0x13')](0x1f4)['json'](_0x12e8f8);}logger[_0xdbb0('0x18')](_0xdbb0('0x1e'));return _0x3822ce[_0xdbb0('0x13')](0xc8)[_0xdbb0('0x14')]({'output':_0xdbb0('0x1f')});});};exports['pull']=function(_0x455186,_0x2a5011){exec(_0xdbb0('0x20'),function(_0x696937,_0x235534,_0x3cf342){logger[_0xdbb0('0x18')](_0x235534);logger[_0xdbb0('0x18')](_0x3cf342);if(_0x696937){logger[_0xdbb0('0x17')](_0x696937);return _0x2a5011[_0xdbb0('0x13')](0x1f4)['json'](_0x696937);}return _0x2a5011[_0xdbb0('0x13')](0xc8)[_0xdbb0('0x14')]({'output':_0x235534});});};exports[_0xdbb0('0x21')]=function(_0x223047,_0x42ec27){return pm2['restart'](_0xdbb0('0x22'))['then'](function(_0x55bdfc){logger[_0xdbb0('0x18')](_0xdbb0('0x23'),_0x55bdfc);return _0x42ec27[_0xdbb0('0x13')](0xc8)['json']({'output':_0xdbb0('0x24')});})[_0xdbb0('0x25')](function(_0x53f033){logger[_0xdbb0('0x17')](_0x53f033);return _0x42ec27[_0xdbb0('0x13')](0x1f4)[_0xdbb0('0x14')](_0x53f033);});};exports[_0xdbb0('0x26')]=function(_0x39bb0b,_0x22ff3a){var _0x169bb3=fs['readdirSync'](path[_0xdbb0('0x27')](config[_0xdbb0('0xb')],'server',_0xdbb0('0x26')));var _0xb2f978=[];for(var _0xdf9cb7=0x0;_0xdf9cb7<_0x169bb3[_0xdbb0('0x28')];_0xdf9cb7++){var _0x452b76=_0x169bb3[_0xdf9cb7][_0xdbb0('0x29')]('.js','');if(compareVersions(module[_0xdbb0('0xd')][_0xdbb0('0x2')],_0x452b76)===-0x1){_0xb2f978[_0xdbb0('0x2a')](_0x452b76);}}if(_0xb2f978['length']){var _0x1fcdcb=_0xb2f978['sort'](compareVersions);var _0x4a3014=new Umzug({'storage':_0xdbb0('0x2b'),'storageOptions':{'model':db[_0xdbb0('0x2c')],'modelName':_0xdbb0('0x2c'),'columnName':'version'},'migrations':{'params':[db[_0xdbb0('0x2b')][_0xdbb0('0x2d')](),db['sequelize'][_0xdbb0('0x2e')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config['root'],'server',_0xdbb0('0x26')),'pattern':/\.js$/}});_0x4a3014['up']({'migrations':_[_0xdbb0('0x2f')](_0x1fcdcb,function(_0x31a1af){return _0x31a1af+_0xdbb0('0x30');})})[_0xdbb0('0x31')](function(){return _0x22ff3a[_0xdbb0('0x13')](0xc8)[_0xdbb0('0x14')]({'output':_0xdbb0('0x32')+module[_0xdbb0('0xd')][_0xdbb0('0x2')]+_0xdbb0('0x33')+_[_0xdbb0('0x34')](_0x1fcdcb),'migrations':_[_0xdbb0('0x27')](_0x1fcdcb)});})[_0xdbb0('0x25')](function(_0x3f6b42){if(_0x3f6b42 instanceof db[_0xdbb0('0x2b')][_0xdbb0('0x35')]){return _0x22ff3a[_0xdbb0('0x13')](0xc8)[_0xdbb0('0x14')]({'output':_0xdbb0('0x36')});}else{return _0x22ff3a['status'](0x1f4)[_0xdbb0('0x14')](_0x3f6b42);}});}else{return _0x22ff3a[_0xdbb0('0x13')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index dba12fb..1d17785 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 _0x2643=['describe','/:id','show','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe'];(function(_0x4bcbd1,_0x709777){var _0x32c47f=function(_0x533b46){while(--_0x533b46){_0x4bcbd1['push'](_0x4bcbd1['shift']());}};_0x32c47f(++_0x709777);}(_0x2643,0xaf));var _0x3264=function(_0x5a74dd,_0x26cedd){_0x5a74dd=_0x5a74dd-0x0;var _0x34f212=_0x2643[_0x5a74dd];return _0x34f212;};'use strict';var multer=require(_0x3264('0x0'));var util=require(_0x3264('0x1'));var path=require(_0x3264('0x2'));var timeout=require(_0x3264('0x3'));var express=require('express');var router=express[_0x3264('0x4')]();var fs_extra=require(_0x3264('0x5'));var auth=require(_0x3264('0x6'));var interaction=require(_0x3264('0x7'));var config=require(_0x3264('0x8'));var controller=require(_0x3264('0x9'));router[_0x3264('0xa')]('/',auth[_0x3264('0xb')](),controller[_0x3264('0xc')]);router[_0x3264('0xa')](_0x3264('0xd'),auth['isAuthenticated'](),controller[_0x3264('0xe')]);router[_0x3264('0xa')](_0x3264('0xf'),auth['isAuthenticated'](),controller[_0x3264('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3264('0x11')](_0x3264('0xf'),auth[_0x3264('0xb')](),controller[_0x3264('0x12')]);router[_0x3264('0x13')](_0x3264('0xf'),auth[_0x3264('0xb')](),controller[_0x3264('0x14')]);module['exports']=router; \ No newline at end of file +var _0x935c=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','multer','util','express'];(function(_0x5c2289,_0x419eb2){var _0x6df1f5=function(_0x118432){while(--_0x118432){_0x5c2289['push'](_0x5c2289['shift']());}};_0x6df1f5(++_0x419eb2);}(_0x935c,0x195));var _0xc935=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x935c[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0xc935('0x0'));var util=require(_0xc935('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc935('0x2'));var router=express[_0xc935('0x3')]();var fs_extra=require(_0xc935('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc935('0x5'));var config=require(_0xc935('0x6'));var controller=require('./voiceAgentReport.controller');router[_0xc935('0x7')]('/',auth[_0xc935('0x8')](),controller[_0xc935('0x9')]);router[_0xc935('0x7')]('/describe',auth[_0xc935('0x8')](),controller[_0xc935('0xa')]);router[_0xc935('0x7')](_0xc935('0xb'),auth[_0xc935('0x8')](),controller[_0xc935('0xc')]);router['post']('/',auth[_0xc935('0x8')](),controller[_0xc935('0xd')]);router[_0xc935('0xe')](_0xc935('0xb'),auth[_0xc935('0x8')](),controller[_0xc935('0xf')]);router[_0xc935('0x10')](_0xc935('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 3165697..523abbe 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 _0x97e6=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE'];(function(_0x2d4e1b,_0x4ee14e){var _0x2500fb=function(_0x2d077c){while(--_0x2d077c){_0x2d4e1b['push'](_0x2d4e1b['shift']());}};_0x2500fb(++_0x4ee14e);}(_0x97e6,0x159));var _0x697e=function(_0x507597,_0x412525){_0x507597=_0x507597-0x0;var _0x110a0f=_0x97e6[_0x507597];return _0x110a0f;};'use strict';var Sequelize=require(_0x697e('0x0'));module['exports']={'type':{'type':Sequelize[_0x697e('0x1')]},'uniqueid':{'type':Sequelize[_0x697e('0x1')]},'calleridnum':{'type':Sequelize[_0x697e('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x697e('0x1')]},'interface':{'type':Sequelize[_0x697e('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x697e('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x697e('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x697e('0x2')]},'agentdumpAt':{'type':Sequelize[_0x697e('0x2')]},'holdtime':{'type':Sequelize[_0x697e('0x3')]},'agentcomplete':{'type':Sequelize[_0x697e('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x697e('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x697e('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x697e('0x3')]},'reason':{'type':Sequelize[_0x697e('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x697e('0x1')]},'channelstate':{'type':Sequelize[_0x697e('0x3')]},'channelstatedesc':{'type':Sequelize[_0x697e('0x1')]},'connectedlinenum':{'type':Sequelize[_0x697e('0x1')]},'connectedlinename':{'type':Sequelize[_0x697e('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x697e('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x697e('0x1')]},'destchannel':{'type':Sequelize[_0x697e('0x1')]},'destchannelstate':{'type':Sequelize[_0x697e('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x697e('0x1')]},'destcalleridname':{'type':Sequelize[_0x697e('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x697e('0x1')]},'destaccountcode':{'type':Sequelize[_0x697e('0x1')]},'destcontext':{'type':Sequelize[_0x697e('0x1')]},'destexten':{'type':Sequelize[_0x697e('0x1')]},'destpriority':{'type':Sequelize[_0x697e('0x1')]},'destuniqueid':{'type':Sequelize[_0x697e('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x697e('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x697e('0x1')]},'transfer':{'type':Sequelize[_0x697e('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x697e('0x5')},'transferexten':{'type':Sequelize[_0x697e('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x697e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3419=['DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0x575655,_0x34eac9){var _0x4b21c0=function(_0x550dab){while(--_0x550dab){_0x575655['push'](_0x575655['shift']());}};_0x4b21c0(++_0x34eac9);}(_0x3419,0xb3));var _0x9341=function(_0x43a1b8,_0x1c90c8){_0x43a1b8=_0x43a1b8-0x0;var _0x324ecc=_0x3419[_0x43a1b8];return _0x324ecc;};'use strict';var Sequelize=require(_0x9341('0x0'));module[_0x9341('0x1')]={'type':{'type':Sequelize[_0x9341('0x2')]},'uniqueid':{'type':Sequelize[_0x9341('0x2')]},'calleridnum':{'type':Sequelize[_0x9341('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x9341('0x2')]},'interface':{'type':Sequelize[_0x9341('0x2')]},'membername':{'type':Sequelize[_0x9341('0x2')]},'agentcalledAt':{'type':Sequelize[_0x9341('0x3')]},'agentconnectAt':{'type':Sequelize[_0x9341('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x9341('0x3')]},'agentdumpAt':{'type':Sequelize[_0x9341('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x9341('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x9341('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x9341('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x9341('0x5')]},'agentacw':{'type':Sequelize[_0x9341('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9341('0x5')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x9341('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x9341('0x5')]},'channelstatedesc':{'type':Sequelize[_0x9341('0x2')]},'connectedlinenum':{'type':Sequelize[_0x9341('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9341('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x9341('0x2')]},'exten':{'type':Sequelize[_0x9341('0x2')]},'priority':{'type':Sequelize[_0x9341('0x2')]},'destchannel':{'type':Sequelize[_0x9341('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x9341('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x9341('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x9341('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x9341('0x2')]},'destcontext':{'type':Sequelize[_0x9341('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x9341('0x2')]},'destuniqueid':{'type':Sequelize[_0x9341('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x9341('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x9341('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9341('0x2')],'comment':_0x9341('0x6')},'transferexten':{'type':Sequelize[_0x9341('0x2')]},'transferuniqueid':{'type':Sequelize[_0x9341('0x2')]},'agententerreason':{'type':Sequelize[_0x9341('0x5')],'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 725d9fd..16c04cc 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(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 8f360b8..8cb9127 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 _0xda19=['request-promise','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','util','../../config/logger','moment'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xda19,0xd5));var _0x9da1=function(_0x2aff6f,_0x37badd){_0x2aff6f=_0x2aff6f-0x0;var _0x1a09e0=_0xda19[_0x2aff6f];return _0x1a09e0;};'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':[{'fields':[_0x9da1('0xb'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xae30=['bluebird','request-promise','path','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','moment'];(function(_0x32e2f6,_0x11e862){var _0x109fa7=function(_0x46232f){while(--_0x46232f){_0x32e2f6['push'](_0x32e2f6['shift']());}};_0x109fa7(++_0x11e862);}(_0xae30,0x10a));var _0x0ae3=function(_0xe429f8,_0xb5ddb4){_0xe429f8=_0xe429f8-0x0;var _0x439723=_0xae30[_0xe429f8];return _0x439723;};'use strict';var _=require(_0x0ae3('0x0'));var util=require(_0x0ae3('0x1'));var logger=require(_0x0ae3('0x2'))('api');var moment=require(_0x0ae3('0x3'));var BPromise=require(_0x0ae3('0x4'));var rp=require(_0x0ae3('0x5'));var fs=require('fs');var path=require(_0x0ae3('0x6'));var rimraf=require('rimraf');var config=require(_0x0ae3('0x7'));var attributes=require(_0x0ae3('0x8'));module[_0x0ae3('0x9')]=function(_0x7ce33e,_0x2b8c53){return _0x7ce33e[_0x0ae3('0xa')](_0x0ae3('0xb'),attributes,{'tableName':_0x0ae3('0xc'),'paranoid':![],'indexes':[{'fields':[_0x0ae3('0xd'),_0x0ae3('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 95d1805..89b5bb1 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 _0x5927=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','options','raw','debug','UpdateVoiceAgentReport','update','body','where','attributes','limit'];(function(_0x1d40aa,_0x2c5318){var _0x1a8785=function(_0x2d6298){while(--_0x2d6298){_0x1d40aa['push'](_0x1d40aa['shift']());}};_0x1a8785(++_0x2c5318);}(_0x5927,0x84));var _0x7592=function(_0x466410,_0x4069d9){_0x466410=_0x466410-0x0;var _0x3d758e=_0x5927[_0x466410];return _0x3d758e;};'use strict';var _=require(_0x7592('0x0'));var util=require(_0x7592('0x1'));var moment=require(_0x7592('0x2'));var BPromise=require(_0x7592('0x3'));var rs=require(_0x7592('0x4'));var fs=require('fs');var Redis=require(_0x7592('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7592('0x6'));var logger=require('../../config/logger')(_0x7592('0x7'));var config=require(_0x7592('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7592('0x9')][_0x7592('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x612391,_0x201a19,_0x308ee5){return new BPromise(function(_0x1d7db3,_0x1abfbe){return client[_0x7592('0xb')](_0x612391,_0x308ee5)[_0x7592('0xc')](function(_0x7f0d4e){logger[_0x7592('0xd')](_0x7592('0xe'),_0x201a19,_0x7592('0xf'));logger['debug'](_0x7592('0x10'),_0x201a19,_0x7592('0xf'),JSON[_0x7592('0x11')](_0x7f0d4e));if(_0x7f0d4e[_0x7592('0x12')]){if(_0x7f0d4e[_0x7592('0x12')][_0x7592('0x13')]===0x1f4){logger['error'](_0x7592('0xe'),_0x201a19,_0x7f0d4e[_0x7592('0x12')][_0x7592('0x14')]);return _0x1abfbe(_0x7f0d4e['error'][_0x7592('0x14')]);}logger['error'](_0x7592('0xe'),_0x201a19,_0x7f0d4e[_0x7592('0x12')]['message']);return _0x1d7db3(_0x7f0d4e[_0x7592('0x12')][_0x7592('0x14')]);}else{logger[_0x7592('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x201a19,_0x7592('0xf'));_0x1d7db3(_0x7f0d4e['result'][_0x7592('0x14')]);}})[_0x7592('0x15')](function(_0x316b2d){logger[_0x7592('0x12')](_0x7592('0xe'),_0x201a19,_0x316b2d);_0x1abfbe(_0x316b2d);});});}exports[_0x7592('0x16')]=function(_0x34dd39){var _0x58156a=this;return new Promise(function(_0x44e4c6,_0x278cf7){return db[_0x7592('0x17')]['create'](_0x34dd39['body'],{'raw':_0x34dd39[_0x7592('0x18')]?_0x34dd39[_0x7592('0x18')][_0x7592('0x19')]===undefined?!![]:![]:!![]})[_0x7592('0xc')](function(_0x3c8adc){logger[_0x7592('0xd')]('CreateVoiceAgentReport',_0x34dd39);logger[_0x7592('0x1a')]('CreateVoiceAgentReport',_0x34dd39,JSON[_0x7592('0x11')](_0x3c8adc));_0x44e4c6(_0x3c8adc);})['catch'](function(_0x58778f){logger[_0x7592('0x12')](_0x7592('0x16'),_0x58778f[_0x7592('0x14')],_0x34dd39);_0x278cf7(_0x58156a[_0x7592('0x12')](0x1f4,_0x58778f[_0x7592('0x14')]));});});};exports[_0x7592('0x1b')]=function(_0x304dd7){var _0x542018=this;return new Promise(function(_0x1c0427,_0x37d37e){return db['VoiceAgentReport'][_0x7592('0x1c')](_0x304dd7[_0x7592('0x1d')],{'raw':_0x304dd7['options']?_0x304dd7[_0x7592('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x304dd7[_0x7592('0x18')]?_0x304dd7[_0x7592('0x18')][_0x7592('0x1e')]||null:null,'attributes':_0x304dd7[_0x7592('0x18')]?_0x304dd7['options'][_0x7592('0x1f')]||null:null,'limit':_0x304dd7[_0x7592('0x18')]?_0x304dd7[_0x7592('0x18')][_0x7592('0x20')]||null:null})[_0x7592('0xc')](function(_0x10d6bb){logger[_0x7592('0xd')]('UpdateVoiceAgentReport',_0x304dd7);logger['debug'](_0x7592('0x1b'),_0x304dd7,JSON[_0x7592('0x11')](_0x10d6bb));_0x1c0427(_0x10d6bb);})[_0x7592('0x15')](function(_0x4067ab){logger[_0x7592('0x12')]('UpdateVoiceAgentReport',_0x4067ab[_0x7592('0x14')],_0x304dd7);_0x37d37e(_0x542018[_0x7592('0x12')](0x1f4,_0x4067ab[_0x7592('0x14')]));});});}; \ No newline at end of file +var _0x4d76=['stringify','code','error','message','result','catch','CreateVoiceAgentReport','create','body','options','UpdateVoiceAgentReport','VoiceAgentReport','update','raw','where','attributes','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s'];(function(_0x492221,_0x9e2521){var _0x398bf9=function(_0x303c5b){while(--_0x303c5b){_0x492221['push'](_0x492221['shift']());}};_0x398bf9(++_0x9e2521);}(_0x4d76,0x17b));var _0x64d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d76[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x64d7('0x0'));var util=require(_0x64d7('0x1'));var moment=require(_0x64d7('0x2'));var BPromise=require(_0x64d7('0x3'));var rs=require(_0x64d7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x64d7('0x5'))(_0x64d7('0x6'));var config=require(_0x64d7('0x7'));var jayson=require(_0x64d7('0x8'));var client=jayson[_0x64d7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcdbe9b,_0x2d8fd4,_0x39e235){return new BPromise(function(_0x49de33,_0x2ef697){return client[_0x64d7('0xa')](_0xcdbe9b,_0x39e235)[_0x64d7('0xb')](function(_0x1675ee){logger[_0x64d7('0xc')](_0x64d7('0xd'),_0x2d8fd4,_0x64d7('0xe'));logger[_0x64d7('0xf')](_0x64d7('0x10'),_0x2d8fd4,_0x64d7('0xe'),JSON[_0x64d7('0x11')](_0x1675ee));if(_0x1675ee['error']){if(_0x1675ee['error'][_0x64d7('0x12')]===0x1f4){logger['error'](_0x64d7('0xd'),_0x2d8fd4,_0x1675ee[_0x64d7('0x13')][_0x64d7('0x14')]);return _0x2ef697(_0x1675ee[_0x64d7('0x13')][_0x64d7('0x14')]);}logger[_0x64d7('0x13')](_0x64d7('0xd'),_0x2d8fd4,_0x1675ee['error']['message']);return _0x49de33(_0x1675ee['error']['message']);}else{logger[_0x64d7('0xc')](_0x64d7('0xd'),_0x2d8fd4,_0x64d7('0xe'));_0x49de33(_0x1675ee[_0x64d7('0x15')][_0x64d7('0x14')]);}})[_0x64d7('0x16')](function(_0x1bf8b9){logger[_0x64d7('0x13')](_0x64d7('0xd'),_0x2d8fd4,_0x1bf8b9);_0x2ef697(_0x1bf8b9);});});}exports[_0x64d7('0x17')]=function(_0xbfb1e7){var _0x38c898=this;return new Promise(function(_0x114735,_0x5e1272){return db['VoiceAgentReport'][_0x64d7('0x18')](_0xbfb1e7[_0x64d7('0x19')],{'raw':_0xbfb1e7[_0x64d7('0x1a')]?_0xbfb1e7[_0x64d7('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x226735){logger[_0x64d7('0xc')](_0x64d7('0x17'),_0xbfb1e7);logger[_0x64d7('0xf')](_0x64d7('0x17'),_0xbfb1e7,JSON[_0x64d7('0x11')](_0x226735));_0x114735(_0x226735);})[_0x64d7('0x16')](function(_0x4e560f){logger[_0x64d7('0x13')](_0x64d7('0x17'),_0x4e560f['message'],_0xbfb1e7);_0x5e1272(_0x38c898[_0x64d7('0x13')](0x1f4,_0x4e560f[_0x64d7('0x14')]));});});};exports[_0x64d7('0x1b')]=function(_0x170b9d){var _0x57e322=this;return new Promise(function(_0x4ff0c1,_0x4fdee6){return db[_0x64d7('0x1c')][_0x64d7('0x1d')](_0x170b9d[_0x64d7('0x19')],{'raw':_0x170b9d[_0x64d7('0x1a')]?_0x170b9d[_0x64d7('0x1a')][_0x64d7('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x170b9d[_0x64d7('0x1a')]?_0x170b9d[_0x64d7('0x1a')][_0x64d7('0x1f')]||null:null,'attributes':_0x170b9d[_0x64d7('0x1a')]?_0x170b9d['options'][_0x64d7('0x20')]||null:null,'limit':_0x170b9d[_0x64d7('0x1a')]?_0x170b9d[_0x64d7('0x1a')]['limit']||null:null})['then'](function(_0x4ee87c){logger[_0x64d7('0xc')](_0x64d7('0x1b'),_0x170b9d);logger['debug'](_0x64d7('0x1b'),_0x170b9d,JSON[_0x64d7('0x11')](_0x4ee87c));_0x4ff0c1(_0x4ee87c);})[_0x64d7('0x16')](function(_0x103747){logger[_0x64d7('0x13')](_0x64d7('0x1b'),_0x103747[_0x64d7('0x14')],_0x170b9d);_0x4fdee6(_0x57e322[_0x64d7('0x13')](0x1f4,_0x103747[_0x64d7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index cedf741..92cd237 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 _0x5aa1=['isAuthenticated','get','/:id','show','post','create','put','update','/with-retry/:id','updateWithRetry','delete','exports','../../components/auth/service','./voiceCallReport.controller'];(function(_0x43eb15,_0x2f8cad){var _0x48dd65=function(_0x2ddb95){while(--_0x2ddb95){_0x43eb15['push'](_0x43eb15['shift']());}};_0x48dd65(++_0x2f8cad);}(_0x5aa1,0x124));var _0x15aa=function(_0x3a16ab,_0x34551a){_0x3a16ab=_0x3a16ab-0x0;var _0xbaadd7=_0x5aa1[_0x3a16ab];return _0xbaadd7;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x15aa('0x0'));var controller=require(_0x15aa('0x1'));router['get']('/',auth[_0x15aa('0x2')](),controller['index']);router[_0x15aa('0x3')]('/describe',auth[_0x15aa('0x2')](),controller['describe']);router[_0x15aa('0x3')](_0x15aa('0x4'),auth['isAuthenticated'](),controller[_0x15aa('0x5')]);router[_0x15aa('0x6')]('/',auth[_0x15aa('0x2')](),controller[_0x15aa('0x7')]);router[_0x15aa('0x8')](_0x15aa('0x4'),auth[_0x15aa('0x2')](),controller[_0x15aa('0x9')]);router[_0x15aa('0x8')](_0x15aa('0xa'),auth[_0x15aa('0x2')](),controller[_0x15aa('0xb')]);router[_0x15aa('0xc')](_0x15aa('0x4'),auth[_0x15aa('0x2')](),controller['destroy']);module[_0x15aa('0xd')]=router; \ No newline at end of file +var _0xd0b4=['../../components/auth/service','index','get','/describe','isAuthenticated','/:id','post','put','update','/with-retry/:id','updateWithRetry','delete','destroy','exports','express','Router'];(function(_0x1faf02,_0x472953){var _0x363aaf=function(_0x1c6ee0){while(--_0x1c6ee0){_0x1faf02['push'](_0x1faf02['shift']());}};_0x363aaf(++_0x472953);}(_0xd0b4,0x1ee));var _0x4d0b=function(_0x2154ba,_0xd2bf2e){_0x2154ba=_0x2154ba-0x0;var _0x358ed7=_0xd0b4[_0x2154ba];return _0x358ed7;};'use strict';var express=require(_0x4d0b('0x0'));var router=express[_0x4d0b('0x1')]();var auth=require(_0x4d0b('0x2'));var controller=require('./voiceCallReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4d0b('0x3')]);router[_0x4d0b('0x4')](_0x4d0b('0x5'),auth[_0x4d0b('0x6')](),controller['describe']);router[_0x4d0b('0x4')](_0x4d0b('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x4d0b('0x8')]('/',auth[_0x4d0b('0x6')](),controller['create']);router[_0x4d0b('0x9')](_0x4d0b('0x7'),auth['isAuthenticated'](),controller[_0x4d0b('0xa')]);router['put'](_0x4d0b('0xb'),auth[_0x4d0b('0x6')](),controller[_0x4d0b('0xc')]);router[_0x4d0b('0xd')](_0x4d0b('0x7'),auth['isAuthenticated'](),controller[_0x4d0b('0xe')]);module[_0x4d0b('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 981ce16..f05c403 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 _0xc3b7=['inbound','internal','outbound','outbound-fax','dialer','TEXT','DATE','INTEGER','exports','STRING'];(function(_0x59bb24,_0x1190cb){var _0x520e9c=function(_0x463b44){while(--_0x463b44){_0x59bb24['push'](_0x59bb24['shift']());}};_0x520e9c(++_0x1190cb);}(_0xc3b7,0x1b6));var _0x7c3b=function(_0x4ec391,_0x103ffd){_0x4ec391=_0x4ec391-0x0;var _0x170ae3=_0xc3b7[_0x4ec391];return _0x170ae3;};'use strict';var Sequelize=require('sequelize');module[_0x7c3b('0x0')]={'uniqueid':{'type':Sequelize[_0x7c3b('0x1')]},'type':{'type':Sequelize['ENUM'](_0x7c3b('0x2'),_0x7c3b('0x3'),_0x7c3b('0x4'),'inbound-fax',_0x7c3b('0x5'),_0x7c3b('0x6'))},'tag':{'type':Sequelize[_0x7c3b('0x1')]},'accountcode':{'type':Sequelize[_0x7c3b('0x1')]},'source':{'type':Sequelize[_0x7c3b('0x1')]},'destination':{'type':Sequelize[_0x7c3b('0x1')]},'destinationcontext':{'type':Sequelize[_0x7c3b('0x1')]},'callerid':{'type':Sequelize[_0x7c3b('0x1')]},'channel':{'type':Sequelize[_0x7c3b('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x7c3b('0x1')]},'lastdata':{'type':Sequelize[_0x7c3b('0x7')]},'starttime':{'type':Sequelize[_0x7c3b('0x8')]},'systemanswertime':{'type':Sequelize[_0x7c3b('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x7c3b('0x8')]},'duration':{'type':Sequelize[_0x7c3b('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7c3b('0x1')]},'amaflags':{'type':Sequelize[_0x7c3b('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x7c3b('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x7c3b('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x7c3b('0x1')]},'note':{'type':Sequelize[_0x7c3b('0x1')]},'prefix':{'type':Sequelize[_0x7c3b('0x1')]},'routeid':{'type':Sequelize[_0x7c3b('0x9')]},'sipcallid':{'type':Sequelize[_0x7c3b('0x1')]}}; \ No newline at end of file +var _0xd00d=['DATE','INTEGER','sequelize','STRING','ENUM','inbound','outbound','dialer','TEXT'];(function(_0x16bb0e,_0x343132){var _0x102b8b=function(_0x17a62b){while(--_0x17a62b){_0x16bb0e['push'](_0x16bb0e['shift']());}};_0x102b8b(++_0x343132);}(_0xd00d,0xec));var _0xdd00=function(_0x416cdc,_0x213b87){_0x416cdc=_0x416cdc-0x0;var _0x1931ce=_0xd00d[_0x416cdc];return _0x1931ce;};'use strict';var Sequelize=require(_0xdd00('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xdd00('0x1')]},'type':{'type':Sequelize[_0xdd00('0x2')](_0xdd00('0x3'),'internal',_0xdd00('0x4'),'inbound-fax','outbound-fax',_0xdd00('0x5'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xdd00('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xdd00('0x1')]},'destinationcontext':{'type':Sequelize[_0xdd00('0x1')]},'callerid':{'type':Sequelize[_0xdd00('0x1')]},'channel':{'type':Sequelize[_0xdd00('0x1')]},'destinationchannel':{'type':Sequelize[_0xdd00('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xdd00('0x6')]},'starttime':{'type':Sequelize[_0xdd00('0x7')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xdd00('0x8')]},'billableseconds':{'type':Sequelize[_0xdd00('0x8')]},'mohtime':{'type':Sequelize[_0xdd00('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xdd00('0x1')]},'amaflags':{'type':Sequelize[_0xdd00('0x1')]},'userfield':{'type':Sequelize[_0xdd00('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xdd00('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xdd00('0x1')]},'prefix':{'type':Sequelize[_0xdd00('0x1')]},'routeid':{'type':Sequelize[_0xdd00('0x8')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 004e4de..a665b11 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 _0xa456=['VIRTUAL','options','VoiceCallReport','include','fullname','alias','User','findAll','rows','catch','show','keys','includeAll','find','create','body','destroy','params','describe','uniqueid','updateWithRetry','No\x20such\x20report','lodash','../../components/parsers/qs','../../config/logger','api','promise-retry','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','sendStatus','name','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x2d97f7,_0x5c28d8){var _0x5f097c=function(_0xacb50d){while(--_0xacb50d){_0x2d97f7['push'](_0x2d97f7['shift']());}};_0x5f097c(++_0x5c28d8);}(_0xa456,0x142));var _0x6a45=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xa456[_0x17928f];return _0x500b63;};'use strict';var _=require(_0x6a45('0x0'));var qs=require(_0x6a45('0x1'));var logger=require(_0x6a45('0x2'))(_0x6a45('0x3'));var db=require('../../mysqldb')['db'];const promiseRetry=require(_0x6a45('0x4'));function respondWithResult(_0x206f6b,_0x3f7448){_0x3f7448=_0x3f7448||0xc8;return function(_0x500c72){if(_0x500c72){return _0x206f6b[_0x6a45('0x5')](_0x3f7448)[_0x6a45('0x6')](_0x500c72);}};}function respondWithFilteredResult(_0x1e5882,_0x14da6b){return function(_0x4dfbfa){if(_0x4dfbfa){var _0x25cf8d=typeof _0x14da6b[_0x6a45('0x7')]===_0x6a45('0x8')&&typeof _0x14da6b[_0x6a45('0x9')]===_0x6a45('0x8');var _0x4858df=_0x4dfbfa[_0x6a45('0xa')];var _0x517040=_0x25cf8d?0x0:_0x14da6b[_0x6a45('0x7')];var _0x3a9671=_0x25cf8d?_0x4dfbfa[_0x6a45('0xa')]:_0x14da6b[_0x6a45('0x7')]+_0x14da6b[_0x6a45('0x9')];var _0x4ff9ae;if(_0x3a9671>=_0x4858df){_0x3a9671=_0x4858df;_0x4ff9ae=0xc8;}else{_0x4ff9ae=0xce;}_0x1e5882['status'](_0x4ff9ae);return _0x1e5882[_0x6a45('0xb')](_0x6a45('0xc'),_0x517040+'-'+_0x3a9671+'/'+_0x4858df)['json'](_0x4dfbfa);}return null;};}function saveUpdates(_0x5a39f6){return function(_0x511b92){if(_0x511b92){return _0x511b92[_0x6a45('0xd')](_0x5a39f6)[_0x6a45('0xe')](function(_0x4298de){return _0x4298de;});}return null;};}function removeEntity(_0x3f01f6){return function(_0xd43eb0){if(_0xd43eb0){return _0xd43eb0['destroy']()['then'](function(){_0x3f01f6[_0x6a45('0x5')](0xcc)[_0x6a45('0xf')]();});}};}function handleEntityNotFound(_0x48fe0c){return function(_0x2c20db){if(!_0x2c20db){_0x48fe0c[_0x6a45('0x10')](0x194);}return _0x2c20db;};}function handleError(_0x3fab82,_0x13adc0){_0x13adc0=_0x13adc0||0x1f4;return function(_0x548634){logger['error'](_0x548634['stack']);if(_0x548634[_0x6a45('0x11')]){delete _0x548634[_0x6a45('0x11')];}_0x3fab82[_0x6a45('0x5')](_0x13adc0)['send'](_0x548634);};}exports[_0x6a45('0x12')]=function(_0x102981,_0x3439c8){var _0x49fc10={},_0x52e7bf={},_0x573453={'count':0x0,'rows':[]};var _0x64f46b=_[_0x6a45('0x13')](db['VoiceCallReport'][_0x6a45('0x14')],function(_0x1be485){return{'name':_0x1be485['fieldName'],'type':_0x1be485[_0x6a45('0x15')][_0x6a45('0x16')]};});_0x52e7bf[_0x6a45('0x17')]=_[_0x6a45('0x13')](_0x64f46b,_0x6a45('0x11'));_0x52e7bf['query']=_['keys'](_0x102981[_0x6a45('0x18')]);_0x52e7bf[_0x6a45('0x19')]=_[_0x6a45('0x1a')](_0x52e7bf[_0x6a45('0x17')],_0x52e7bf[_0x6a45('0x18')]);_0x49fc10[_0x6a45('0x1b')]=_[_0x6a45('0x1a')](_0x52e7bf[_0x6a45('0x17')],qs[_0x6a45('0x1c')](_0x102981[_0x6a45('0x18')][_0x6a45('0x1c')]));_0x49fc10[_0x6a45('0x1b')]=_0x49fc10['attributes'][_0x6a45('0x1d')]?_0x49fc10['attributes']:_0x52e7bf[_0x6a45('0x17')];if(!_0x102981[_0x6a45('0x18')][_0x6a45('0x1e')](_0x6a45('0x1f'))){_0x49fc10[_0x6a45('0x9')]=qs['limit'](_0x102981[_0x6a45('0x18')][_0x6a45('0x9')]);_0x49fc10[_0x6a45('0x7')]=qs[_0x6a45('0x7')](_0x102981[_0x6a45('0x18')][_0x6a45('0x7')]);}_0x49fc10[_0x6a45('0x20')]=qs[_0x6a45('0x21')](_0x102981['query'][_0x6a45('0x21')]);_0x49fc10[_0x6a45('0x22')]=qs[_0x6a45('0x19')](_[_0x6a45('0x23')](_0x102981[_0x6a45('0x18')],_0x52e7bf['filters']),_0x64f46b);if(_0x102981[_0x6a45('0x18')][_0x6a45('0x24')]){_0x49fc10[_0x6a45('0x22')]=_[_0x6a45('0x25')](_0x49fc10['where'],{'$or':_['map'](_0x64f46b,function(_0x2a50dc){if(_0x2a50dc['type']!==_0x6a45('0x26')){var _0x5e9324={};_0x5e9324[_0x2a50dc[_0x6a45('0x11')]]={'$like':'%'+_0x102981[_0x6a45('0x18')][_0x6a45('0x24')]+'%'};return _0x5e9324;}})});}_0x49fc10=_[_0x6a45('0x25')]({},_0x49fc10,_0x102981[_0x6a45('0x27')]);var _0x3cab47={'where':_0x49fc10[_0x6a45('0x22')]};return db[_0x6a45('0x28')][_0x6a45('0xa')](_0x3cab47)[_0x6a45('0xe')](function(_0x421fe2){_0x573453[_0x6a45('0xa')]=_0x421fe2;if(_0x102981[_0x6a45('0x18')]['includeAll']){_0x49fc10[_0x6a45('0x29')]=[{'attributes':['id','name',_0x6a45('0x2a'),_0x6a45('0x2b')],'model':db[_0x6a45('0x2c')],'as':_0x6a45('0x2c')}];}return db[_0x6a45('0x28')][_0x6a45('0x2d')](_0x49fc10);})['then'](function(_0x2030a2){_0x573453[_0x6a45('0x2e')]=_0x2030a2;return _0x573453;})[_0x6a45('0xe')](respondWithFilteredResult(_0x3439c8,_0x49fc10))[_0x6a45('0x2f')](handleError(_0x3439c8,null));};exports[_0x6a45('0x30')]=function(_0x1996c6,_0x52661f){var _0x120f79={'raw':!![],'where':{'id':_0x1996c6['params']['id']}},_0xbd573b={};_0xbd573b[_0x6a45('0x17')]=_[_0x6a45('0x31')](db[_0x6a45('0x28')][_0x6a45('0x14')]);_0xbd573b[_0x6a45('0x18')]=_['keys'](_0x1996c6[_0x6a45('0x18')]);_0xbd573b[_0x6a45('0x19')]=_[_0x6a45('0x1a')](_0xbd573b[_0x6a45('0x17')],_0xbd573b[_0x6a45('0x18')]);_0x120f79[_0x6a45('0x1b')]=_[_0x6a45('0x1a')](_0xbd573b['model'],qs[_0x6a45('0x1c')](_0x1996c6['query'][_0x6a45('0x1c')]));_0x120f79[_0x6a45('0x1b')]=_0x120f79[_0x6a45('0x1b')][_0x6a45('0x1d')]?_0x120f79['attributes']:_0xbd573b['model'];if(_0x1996c6[_0x6a45('0x18')][_0x6a45('0x32')]){_0x120f79['include']=[{'all':!![]}];}_0x120f79=_[_0x6a45('0x25')]({},_0x120f79,_0x1996c6[_0x6a45('0x27')]);return db[_0x6a45('0x28')][_0x6a45('0x33')](_0x120f79)['then'](handleEntityNotFound(_0x52661f,null))['then'](respondWithResult(_0x52661f,null))['catch'](handleError(_0x52661f,null));};exports['create']=function(_0xe90201,_0xb5d191){return db[_0x6a45('0x28')][_0x6a45('0x34')](_0xe90201[_0x6a45('0x35')],{})[_0x6a45('0xe')](respondWithResult(_0xb5d191,0xc9))[_0x6a45('0x2f')](handleError(_0xb5d191,null));};exports[_0x6a45('0x36')]=function(_0x5684ba,_0x37c348){return db['VoiceCallReport']['find']({'where':{'id':_0x5684ba[_0x6a45('0x37')]['id']}})[_0x6a45('0xe')](handleEntityNotFound(_0x37c348,null))['then'](removeEntity(_0x37c348,null))[_0x6a45('0x2f')](handleError(_0x37c348,null));};exports['describe']=function(_0x36a16c,_0x24435e){return db[_0x6a45('0x28')][_0x6a45('0x38')]()['then'](respondWithResult(_0x24435e,null))[_0x6a45('0x2f')](handleError(_0x24435e,null));};function findForUpdate(_0x25705e){return db[_0x6a45('0x28')][_0x6a45('0x33')]({'where':{'uniqueid':_0x25705e[_0x6a45('0x37')]['id'],'UserId':{'$or':[null,_0x25705e['user']['id']]}}});}exports[_0x6a45('0xd')]=function(_0x4b9de1,_0x39bf51){if(_0x4b9de1[_0x6a45('0x35')]['uniqueid']){delete _0x4b9de1[_0x6a45('0x35')][_0x6a45('0x39')];}return findForUpdate(_0x4b9de1)[_0x6a45('0xe')](handleEntityNotFound(_0x39bf51,null))[_0x6a45('0xe')](saveUpdates(_0x4b9de1['body'],null))[_0x6a45('0xe')](respondWithResult(_0x39bf51,null))['catch'](handleError(_0x39bf51,null));};exports[_0x6a45('0x3a')]=function(_0x49dcf0,_0x3fd7bb,_0x146801){if(_0x49dcf0[_0x6a45('0x35')][_0x6a45('0x39')]){delete _0x49dcf0['body'][_0x6a45('0x39')];}promiseRetry(function(_0x2c9465){return findForUpdate(_0x49dcf0)[_0x6a45('0xe')](function(_0x2e57ec){if(_0x2e57ec!==null){return _0x2e57ec;}else{_0x2c9465(new Error(_0x6a45('0x3b')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x6a45('0xe')](function(_0xc7ee18){if(!_0xc7ee18){return new Promise(function(_0x17cfe4){_0x17cfe4(handleEntityNotFound(_0x3fd7bb)());});}else{return _0xc7ee18[_0x6a45('0xd')](_0x49dcf0[_0x6a45('0x35')])['then'](function(_0x3ea4a7){return respondWithResult(_0x3fd7bb)(_0x3ea4a7);});}},function(){handleEntityNotFound(_0x3fd7bb)();});}; \ No newline at end of file +var _0xe5af=['key','map','query','keys','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','include','fullname','alias','User','findAll','rows','catch','length','includeAll','options','create','body','find','params','describe','user','uniqueid','updateWithRetry','No\x20such\x20report','../../components/parsers/qs','../../config/logger','../../mysqldb','promise-retry','offset','undefined','limit','count','status','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','index','VoiceCallReport','rawAttributes','fieldName','type'];(function(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0xe5af,0x9c));var _0xfe5a=function(_0x13ea3c,_0xd47d55){_0x13ea3c=_0x13ea3c-0x0;var _0x1afbd5=_0xe5af[_0x13ea3c];return _0x1afbd5;};'use strict';var _=require('lodash');var qs=require(_0xfe5a('0x0'));var logger=require(_0xfe5a('0x1'))('api');var db=require(_0xfe5a('0x2'))['db'];const promiseRetry=require(_0xfe5a('0x3'));function respondWithResult(_0x23b7f0,_0x4adbd1){_0x4adbd1=_0x4adbd1||0xc8;return function(_0x1165e3){if(_0x1165e3){return _0x23b7f0['status'](_0x4adbd1)['json'](_0x1165e3);}};}function respondWithFilteredResult(_0x37455d,_0x2039cd){return function(_0x4e418f){if(_0x4e418f){var _0x5eea2e=typeof _0x2039cd[_0xfe5a('0x4')]===_0xfe5a('0x5')&&typeof _0x2039cd[_0xfe5a('0x6')]===_0xfe5a('0x5');var _0x5cd100=_0x4e418f[_0xfe5a('0x7')];var _0x5a48ff=_0x5eea2e?0x0:_0x2039cd['offset'];var _0x259e8a=_0x5eea2e?_0x4e418f[_0xfe5a('0x7')]:_0x2039cd['offset']+_0x2039cd[_0xfe5a('0x6')];var _0x3e3c1c;if(_0x259e8a>=_0x5cd100){_0x259e8a=_0x5cd100;_0x3e3c1c=0xc8;}else{_0x3e3c1c=0xce;}_0x37455d[_0xfe5a('0x8')](_0x3e3c1c);return _0x37455d[_0xfe5a('0x9')](_0xfe5a('0xa'),_0x5a48ff+'-'+_0x259e8a+'/'+_0x5cd100)['json'](_0x4e418f);}return null;};}function saveUpdates(_0x2086c7){return function(_0x9d1f4f){if(_0x9d1f4f){return _0x9d1f4f[_0xfe5a('0xb')](_0x2086c7)[_0xfe5a('0xc')](function(_0x3d9683){return _0x3d9683;});}return null;};}function removeEntity(_0x58b72c){return function(_0x33e574){if(_0x33e574){return _0x33e574[_0xfe5a('0xd')]()[_0xfe5a('0xc')](function(){_0x58b72c[_0xfe5a('0x8')](0xcc)[_0xfe5a('0xe')]();});}};}function handleEntityNotFound(_0x217976){return function(_0x375380){if(!_0x375380){_0x217976[_0xfe5a('0xf')](0x194);}return _0x375380;};}function handleError(_0x111d4d,_0x18c57b){_0x18c57b=_0x18c57b||0x1f4;return function(_0x38f12e){logger[_0xfe5a('0x10')](_0x38f12e[_0xfe5a('0x11')]);if(_0x38f12e[_0xfe5a('0x12')]){delete _0x38f12e[_0xfe5a('0x12')];}_0x111d4d[_0xfe5a('0x8')](_0x18c57b)['send'](_0x38f12e);};}exports[_0xfe5a('0x13')]=function(_0x456707,_0x54d5fb){var _0x3b0101={},_0x329273={},_0x39d905={'count':0x0,'rows':[]};var _0x4bd05a=_['map'](db[_0xfe5a('0x14')][_0xfe5a('0x15')],function(_0xded538){return{'name':_0xded538[_0xfe5a('0x16')],'type':_0xded538[_0xfe5a('0x17')][_0xfe5a('0x18')]};});_0x329273['model']=_[_0xfe5a('0x19')](_0x4bd05a,'name');_0x329273[_0xfe5a('0x1a')]=_[_0xfe5a('0x1b')](_0x456707[_0xfe5a('0x1a')]);_0x329273['filters']=_['intersection'](_0x329273[_0xfe5a('0x1c')],_0x329273[_0xfe5a('0x1a')]);_0x3b0101['attributes']=_[_0xfe5a('0x1d')](_0x329273[_0xfe5a('0x1c')],qs['fields'](_0x456707[_0xfe5a('0x1a')][_0xfe5a('0x1e')]));_0x3b0101[_0xfe5a('0x1f')]=_0x3b0101[_0xfe5a('0x1f')]['length']?_0x3b0101[_0xfe5a('0x1f')]:_0x329273[_0xfe5a('0x1c')];if(!_0x456707[_0xfe5a('0x1a')][_0xfe5a('0x20')](_0xfe5a('0x21'))){_0x3b0101[_0xfe5a('0x6')]=qs[_0xfe5a('0x6')](_0x456707[_0xfe5a('0x1a')]['limit']);_0x3b0101['offset']=qs[_0xfe5a('0x4')](_0x456707['query'][_0xfe5a('0x4')]);}_0x3b0101[_0xfe5a('0x22')]=qs[_0xfe5a('0x23')](_0x456707['query']['sort']);_0x3b0101['where']=qs[_0xfe5a('0x24')](_['pick'](_0x456707['query'],_0x329273['filters']),_0x4bd05a);if(_0x456707[_0xfe5a('0x1a')][_0xfe5a('0x25')]){_0x3b0101[_0xfe5a('0x26')]=_[_0xfe5a('0x27')](_0x3b0101[_0xfe5a('0x26')],{'$or':_[_0xfe5a('0x19')](_0x4bd05a,function(_0x7593cf){if(_0x7593cf[_0xfe5a('0x17')]!==_0xfe5a('0x28')){var _0x2ae57c={};_0x2ae57c[_0x7593cf[_0xfe5a('0x12')]]={'$like':'%'+_0x456707['query'][_0xfe5a('0x25')]+'%'};return _0x2ae57c;}})});}_0x3b0101=_[_0xfe5a('0x27')]({},_0x3b0101,_0x456707['options']);var _0x354eb9={'where':_0x3b0101[_0xfe5a('0x26')]};return db[_0xfe5a('0x14')][_0xfe5a('0x7')](_0x354eb9)[_0xfe5a('0xc')](function(_0x5ed29a){_0x39d905['count']=_0x5ed29a;if(_0x456707[_0xfe5a('0x1a')]['includeAll']){_0x3b0101[_0xfe5a('0x29')]=[{'attributes':['id',_0xfe5a('0x12'),_0xfe5a('0x2a'),_0xfe5a('0x2b')],'model':db['User'],'as':_0xfe5a('0x2c')}];}return db[_0xfe5a('0x14')][_0xfe5a('0x2d')](_0x3b0101);})['then'](function(_0x3206f1){_0x39d905[_0xfe5a('0x2e')]=_0x3206f1;return _0x39d905;})[_0xfe5a('0xc')](respondWithFilteredResult(_0x54d5fb,_0x3b0101))[_0xfe5a('0x2f')](handleError(_0x54d5fb,null));};exports['show']=function(_0x2ab654,_0x48bd13){var _0x302b5c={'raw':!![],'where':{'id':_0x2ab654['params']['id']}},_0x6145a6={};_0x6145a6[_0xfe5a('0x1c')]=_[_0xfe5a('0x1b')](db[_0xfe5a('0x14')][_0xfe5a('0x15')]);_0x6145a6['query']=_[_0xfe5a('0x1b')](_0x2ab654[_0xfe5a('0x1a')]);_0x6145a6[_0xfe5a('0x24')]=_['intersection'](_0x6145a6[_0xfe5a('0x1c')],_0x6145a6[_0xfe5a('0x1a')]);_0x302b5c[_0xfe5a('0x1f')]=_[_0xfe5a('0x1d')](_0x6145a6[_0xfe5a('0x1c')],qs[_0xfe5a('0x1e')](_0x2ab654[_0xfe5a('0x1a')][_0xfe5a('0x1e')]));_0x302b5c[_0xfe5a('0x1f')]=_0x302b5c[_0xfe5a('0x1f')][_0xfe5a('0x30')]?_0x302b5c['attributes']:_0x6145a6[_0xfe5a('0x1c')];if(_0x2ab654[_0xfe5a('0x1a')][_0xfe5a('0x31')]){_0x302b5c[_0xfe5a('0x29')]=[{'all':!![]}];}_0x302b5c=_[_0xfe5a('0x27')]({},_0x302b5c,_0x2ab654[_0xfe5a('0x32')]);return db[_0xfe5a('0x14')]['find'](_0x302b5c)[_0xfe5a('0xc')](handleEntityNotFound(_0x48bd13,null))[_0xfe5a('0xc')](respondWithResult(_0x48bd13,null))['catch'](handleError(_0x48bd13,null));};exports['create']=function(_0x252904,_0x4c17fd){return db['VoiceCallReport'][_0xfe5a('0x33')](_0x252904[_0xfe5a('0x34')],{})['then'](respondWithResult(_0x4c17fd,0xc9))[_0xfe5a('0x2f')](handleError(_0x4c17fd,null));};exports['destroy']=function(_0x5112a9,_0x1dbb2c){return db[_0xfe5a('0x14')][_0xfe5a('0x35')]({'where':{'id':_0x5112a9[_0xfe5a('0x36')]['id']}})[_0xfe5a('0xc')](handleEntityNotFound(_0x1dbb2c,null))['then'](removeEntity(_0x1dbb2c,null))[_0xfe5a('0x2f')](handleError(_0x1dbb2c,null));};exports[_0xfe5a('0x37')]=function(_0x10aa98,_0x19e359){return db[_0xfe5a('0x14')][_0xfe5a('0x37')]()[_0xfe5a('0xc')](respondWithResult(_0x19e359,null))[_0xfe5a('0x2f')](handleError(_0x19e359,null));};function findForUpdate(_0x1c8cc1){return db[_0xfe5a('0x14')][_0xfe5a('0x35')]({'where':{'uniqueid':_0x1c8cc1[_0xfe5a('0x36')]['id'],'UserId':{'$or':[null,_0x1c8cc1[_0xfe5a('0x38')]['id']]}}});}exports[_0xfe5a('0xb')]=function(_0x5c2881,_0x5bccae){if(_0x5c2881[_0xfe5a('0x34')]['uniqueid']){delete _0x5c2881['body'][_0xfe5a('0x39')];}return findForUpdate(_0x5c2881)[_0xfe5a('0xc')](handleEntityNotFound(_0x5bccae,null))[_0xfe5a('0xc')](saveUpdates(_0x5c2881[_0xfe5a('0x34')],null))[_0xfe5a('0xc')](respondWithResult(_0x5bccae,null))[_0xfe5a('0x2f')](handleError(_0x5bccae,null));};exports[_0xfe5a('0x3a')]=function(_0x4963c6,_0x40e2da,_0x4afd84){if(_0x4963c6[_0xfe5a('0x34')]['uniqueid']){delete _0x4963c6[_0xfe5a('0x34')][_0xfe5a('0x39')];}promiseRetry(function(_0x1b2ba4){return findForUpdate(_0x4963c6)[_0xfe5a('0xc')](function(_0x55528b){if(_0x55528b!==null){return _0x55528b;}else{_0x1b2ba4(new Error(_0xfe5a('0x3b')));}});},{'retries':0x4,'minTimeout':0xfa})[_0xfe5a('0xc')](function(_0x537733){if(!_0x537733){return new Promise(function(_0x2db94b){_0x2db94b(handleEntityNotFound(_0x40e2da)());});}else{return _0x537733['update'](_0x4963c6['body'])[_0xfe5a('0xc')](function(_0x4e02c9){return respondWithResult(_0x40e2da)(_0x4e02c9);});}},function(){handleEntityNotFound(_0x40e2da)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 4d6fa5f..6a23277 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 _0x3238=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','VoiceCallReport','uniqueid','lodash'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x3238,0x13e));var _0x8323=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3238[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8323('0x0'));var util=require('util');var logger=require(_0x8323('0x1'))(_0x8323('0x2'));var moment=require(_0x8323('0x3'));var BPromise=require('bluebird');var rp=require(_0x8323('0x4'));var fs=require('fs');var path=require(_0x8323('0x5'));var rimraf=require(_0x8323('0x6'));var config=require(_0x8323('0x7'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x423b63,_0x5544f9){return _0x423b63[_0x8323('0x8')](_0x8323('0x9'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x8323('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6008=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','../../config/logger','api'];(function(_0x5039be,_0x395bcb){var _0x485798=function(_0x1b614a){while(--_0x1b614a){_0x5039be['push'](_0x5039be['shift']());}};_0x485798(++_0x395bcb);}(_0x6008,0x10b));var _0x8600=function(_0xb19f0d,_0x2288f2){_0xb19f0d=_0xb19f0d-0x0;var _0xddb3a8=_0x6008[_0xb19f0d];return _0xddb3a8;};'use strict';var _=require(_0x8600('0x0'));var util=require('util');var logger=require(_0x8600('0x1'))(_0x8600('0x2'));var moment=require(_0x8600('0x3'));var BPromise=require(_0x8600('0x4'));var rp=require(_0x8600('0x5'));var fs=require('fs');var path=require(_0x8600('0x6'));var rimraf=require(_0x8600('0x7'));var config=require(_0x8600('0x8'));var attributes=require(_0x8600('0x9'));module[_0x8600('0xa')]=function(_0x5aaa40,_0x4a3d9f){return _0x5aaa40[_0x8600('0xb')](_0x8600('0xc'),attributes,{'tableName':_0x8600('0xd'),'paranoid':![],'indexes':[{'fields':[_0x8600('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 8721160..be4afbe 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 _0xbf74=['findAll','options','raw','where','limit','map','include','attributes','model','then','catch','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','GetVoiceCallReport','VoiceCallReport'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xbf74,0x112));var _0x4bf7=function(_0x159af0,_0x5e6446){_0x159af0=_0x159af0-0x0;var _0x47dc31=_0xbf74[_0x159af0];return _0x47dc31;};'use strict';var _=require('lodash');var util=require(_0x4bf7('0x0'));var moment=require(_0x4bf7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4bf7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4bf7('0x3'));var logger=require(_0x4bf7('0x4'))(_0x4bf7('0x5'));var config=require(_0x4bf7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4bf7('0x7')][_0x4bf7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x34331f,_0x314022,_0x1c9a05){return new BPromise(function(_0x43a55e,_0x59d600){return client[_0x4bf7('0x9')](_0x34331f,_0x1c9a05)['then'](function(_0x4e6fea){logger[_0x4bf7('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x314022,_0x4bf7('0xb'));logger[_0x4bf7('0xc')](_0x4bf7('0xd'),_0x314022,_0x4bf7('0xb'),JSON[_0x4bf7('0xe')](_0x4e6fea));if(_0x4e6fea[_0x4bf7('0xf')]){if(_0x4e6fea[_0x4bf7('0xf')][_0x4bf7('0x10')]===0x1f4){logger[_0x4bf7('0xf')](_0x4bf7('0x11'),_0x314022,_0x4e6fea[_0x4bf7('0xf')][_0x4bf7('0x12')]);return _0x59d600(_0x4e6fea[_0x4bf7('0xf')][_0x4bf7('0x12')]);}logger[_0x4bf7('0xf')](_0x4bf7('0x11'),_0x314022,_0x4e6fea[_0x4bf7('0xf')][_0x4bf7('0x12')]);return _0x43a55e(_0x4e6fea['error'][_0x4bf7('0x12')]);}else{logger[_0x4bf7('0xa')](_0x4bf7('0x11'),_0x314022,'request\x20sent');_0x43a55e(_0x4e6fea[_0x4bf7('0x13')][_0x4bf7('0x12')]);}})['catch'](function(_0x4d1835){logger[_0x4bf7('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x314022,_0x4d1835);_0x59d600(_0x4d1835);});});}exports[_0x4bf7('0x14')]=function(_0x4e29e9){var _0x328115=this;return new Promise(function(_0x38934e,_0xea5692){return db[_0x4bf7('0x15')][_0x4bf7('0x16')]({'raw':_0x4e29e9[_0x4bf7('0x17')]?_0x4e29e9[_0x4bf7('0x17')][_0x4bf7('0x18')]===undefined?!![]:![]:!![],'where':_0x4e29e9[_0x4bf7('0x17')]?_0x4e29e9[_0x4bf7('0x17')][_0x4bf7('0x19')]||null:null,'attributes':_0x4e29e9[_0x4bf7('0x17')]?_0x4e29e9['options']['attributes']||null:null,'limit':_0x4e29e9[_0x4bf7('0x17')]?_0x4e29e9[_0x4bf7('0x17')][_0x4bf7('0x1a')]||null:null,'include':_0x4e29e9[_0x4bf7('0x17')]?_0x4e29e9[_0x4bf7('0x17')]['include']?_[_0x4bf7('0x1b')](_0x4e29e9[_0x4bf7('0x17')]['include'],function(_0x12d1ba){return{'model':db[_0x12d1ba['model']],'as':_0x12d1ba['as'],'attributes':_0x12d1ba['attributes'],'include':_0x12d1ba[_0x4bf7('0x1c')]?_[_0x4bf7('0x1b')](_0x12d1ba[_0x4bf7('0x1c')],function(_0x70ba19){return{'model':db[_0x70ba19['model']],'as':_0x70ba19['as'],'attributes':_0x70ba19[_0x4bf7('0x1d')],'include':_0x70ba19[_0x4bf7('0x1c')]?_[_0x4bf7('0x1b')](_0x70ba19[_0x4bf7('0x1c')],function(_0xf57345){return{'model':db[_0xf57345[_0x4bf7('0x1e')]],'as':_0xf57345['as'],'attributes':_0xf57345['attributes']};}):[]};}):[]};}):[]:[]})[_0x4bf7('0x1f')](function(_0x3dae3a){logger[_0x4bf7('0xa')]('GetVoiceCallReport',_0x4e29e9);logger[_0x4bf7('0xc')](_0x4bf7('0x14'),_0x4e29e9,JSON['stringify'](_0x3dae3a));_0x38934e(_0x3dae3a);})[_0x4bf7('0x20')](function(_0x44cbef){logger['error'](_0x4bf7('0x14'),_0x44cbef['message'],_0x4e29e9);_0xea5692(_0x328115[_0x4bf7('0xf')](0x1f4,_0x44cbef[_0x4bf7('0x12')]));});});};exports[_0x4bf7('0x21')]=function(_0x802462){var _0x3d7548=this;return new Promise(function(_0x16d479,_0x5c2378){return db['VoiceCallReport'][_0x4bf7('0x22')](_0x802462['body'],{'raw':_0x802462[_0x4bf7('0x17')]?_0x802462[_0x4bf7('0x17')][_0x4bf7('0x18')]===undefined?!![]:![]:!![]})[_0x4bf7('0x1f')](function(_0x3ea839){logger[_0x4bf7('0xa')]('CreateVoiceCallReport',_0x802462);logger['debug']('CreateVoiceCallReport',_0x802462,JSON[_0x4bf7('0xe')](_0x3ea839));_0x16d479(_0x3ea839);})[_0x4bf7('0x20')](function(_0x4ec1ff){logger[_0x4bf7('0xf')](_0x4bf7('0x21'),_0x4ec1ff['message'],_0x802462);_0x5c2378(_0x3d7548[_0x4bf7('0xf')](0x1f4,_0x4ec1ff['message']));});});};exports['UpdateVoiceCallReport']=function(_0x3cba0b){var _0x11ec60=this;return new Promise(function(_0x1e4ce4,_0x12229a){return db['VoiceCallReport']['update'](_0x3cba0b[_0x4bf7('0x23')],{'raw':_0x3cba0b[_0x4bf7('0x17')]?_0x3cba0b['options'][_0x4bf7('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cba0b['options']?_0x3cba0b[_0x4bf7('0x17')]['where']||null:null,'attributes':_0x3cba0b[_0x4bf7('0x17')]?_0x3cba0b[_0x4bf7('0x17')][_0x4bf7('0x1d')]||null:null,'limit':_0x3cba0b['options']?_0x3cba0b[_0x4bf7('0x17')][_0x4bf7('0x1a')]||null:null})[_0x4bf7('0x1f')](function(_0x1480a3){logger[_0x4bf7('0xa')](_0x4bf7('0x24'),_0x3cba0b);logger[_0x4bf7('0xc')](_0x4bf7('0x24'),_0x3cba0b,JSON[_0x4bf7('0xe')](_0x1480a3));_0x1e4ce4(_0x1480a3);})[_0x4bf7('0x20')](function(_0xf3782a){logger[_0x4bf7('0xf')](_0x4bf7('0x24'),_0xf3782a[_0x4bf7('0x12')],_0x3cba0b);_0x12229a(_0x11ec60['error'](0x1f4,_0xf3782a['message']));});});}; \ No newline at end of file +var _0x3a11=['UpdateVoiceCallReport','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceCallReport,\x20%s,\x20%s','message','result','catch','VoiceCallReport','findAll','options','raw','where','limit','include','attributes','model','map','GetVoiceCallReport','CreateVoiceCallReport','create','update','body'];(function(_0x1f65c4,_0x48398a){var _0x4a6c46=function(_0x46af0b){while(--_0x46af0b){_0x1f65c4['push'](_0x1f65c4['shift']());}};_0x4a6c46(++_0x48398a);}(_0x3a11,0x1a3));var _0x13a1=function(_0x585d09,_0x1274bc){_0x585d09=_0x585d09-0x0;var _0x7d9a14=_0x3a11[_0x585d09];return _0x7d9a14;};'use strict';var _=require(_0x13a1('0x0'));var util=require(_0x13a1('0x1'));var moment=require(_0x13a1('0x2'));var BPromise=require('bluebird');var rs=require(_0x13a1('0x3'));var fs=require('fs');var Redis=require(_0x13a1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x13a1('0x5'));var logger=require(_0x13a1('0x6'))(_0x13a1('0x7'));var config=require('../../config/environment');var jayson=require(_0x13a1('0x8'));var client=jayson[_0x13a1('0x9')][_0x13a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x408a64,_0x20b748,_0x283dc1){return new BPromise(function(_0x325431,_0x2eb0ea){return client['request'](_0x408a64,_0x283dc1)[_0x13a1('0xb')](function(_0x8a92f9){logger[_0x13a1('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x20b748,_0x13a1('0xd'));logger[_0x13a1('0xe')](_0x13a1('0xf'),_0x20b748,_0x13a1('0xd'),JSON[_0x13a1('0x10')](_0x8a92f9));if(_0x8a92f9[_0x13a1('0x11')]){if(_0x8a92f9[_0x13a1('0x11')]['code']===0x1f4){logger['error'](_0x13a1('0x12'),_0x20b748,_0x8a92f9[_0x13a1('0x11')][_0x13a1('0x13')]);return _0x2eb0ea(_0x8a92f9[_0x13a1('0x11')][_0x13a1('0x13')]);}logger[_0x13a1('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x20b748,_0x8a92f9[_0x13a1('0x11')][_0x13a1('0x13')]);return _0x325431(_0x8a92f9[_0x13a1('0x11')]['message']);}else{logger['info'](_0x13a1('0x12'),_0x20b748,'request\x20sent');_0x325431(_0x8a92f9[_0x13a1('0x14')]['message']);}})[_0x13a1('0x15')](function(_0xda5235){logger[_0x13a1('0x11')](_0x13a1('0x12'),_0x20b748,_0xda5235);_0x2eb0ea(_0xda5235);});});}exports['GetVoiceCallReport']=function(_0x489759){var _0x2b5c80=this;return new Promise(function(_0x1a5ba1,_0x573a35){return db[_0x13a1('0x16')][_0x13a1('0x17')]({'raw':_0x489759[_0x13a1('0x18')]?_0x489759['options'][_0x13a1('0x19')]===undefined?!![]:![]:!![],'where':_0x489759['options']?_0x489759[_0x13a1('0x18')][_0x13a1('0x1a')]||null:null,'attributes':_0x489759[_0x13a1('0x18')]?_0x489759[_0x13a1('0x18')]['attributes']||null:null,'limit':_0x489759[_0x13a1('0x18')]?_0x489759[_0x13a1('0x18')][_0x13a1('0x1b')]||null:null,'include':_0x489759[_0x13a1('0x18')]?_0x489759[_0x13a1('0x18')][_0x13a1('0x1c')]?_['map'](_0x489759[_0x13a1('0x18')][_0x13a1('0x1c')],function(_0x50ff50){return{'model':db[_0x50ff50['model']],'as':_0x50ff50['as'],'attributes':_0x50ff50[_0x13a1('0x1d')],'include':_0x50ff50[_0x13a1('0x1c')]?_['map'](_0x50ff50[_0x13a1('0x1c')],function(_0x953827){return{'model':db[_0x953827[_0x13a1('0x1e')]],'as':_0x953827['as'],'attributes':_0x953827[_0x13a1('0x1d')],'include':_0x953827[_0x13a1('0x1c')]?_[_0x13a1('0x1f')](_0x953827[_0x13a1('0x1c')],function(_0x33d7de){return{'model':db[_0x33d7de[_0x13a1('0x1e')]],'as':_0x33d7de['as'],'attributes':_0x33d7de[_0x13a1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x13a1('0xb')](function(_0x4144c6){logger['info'](_0x13a1('0x20'),_0x489759);logger[_0x13a1('0xe')](_0x13a1('0x20'),_0x489759,JSON[_0x13a1('0x10')](_0x4144c6));_0x1a5ba1(_0x4144c6);})['catch'](function(_0x17a7fa){logger[_0x13a1('0x11')](_0x13a1('0x20'),_0x17a7fa[_0x13a1('0x13')],_0x489759);_0x573a35(_0x2b5c80[_0x13a1('0x11')](0x1f4,_0x17a7fa['message']));});});};exports[_0x13a1('0x21')]=function(_0x5c7992){var _0x5d5bb4=this;return new Promise(function(_0x2b3ed0,_0x56f8b9){return db[_0x13a1('0x16')][_0x13a1('0x22')](_0x5c7992['body'],{'raw':_0x5c7992[_0x13a1('0x18')]?_0x5c7992['options'][_0x13a1('0x19')]===undefined?!![]:![]:!![]})[_0x13a1('0xb')](function(_0x1ff56a){logger[_0x13a1('0xc')]('CreateVoiceCallReport',_0x5c7992);logger[_0x13a1('0xe')]('CreateVoiceCallReport',_0x5c7992,JSON['stringify'](_0x1ff56a));_0x2b3ed0(_0x1ff56a);})['catch'](function(_0x4684ab){logger[_0x13a1('0x11')](_0x13a1('0x21'),_0x4684ab['message'],_0x5c7992);_0x56f8b9(_0x5d5bb4[_0x13a1('0x11')](0x1f4,_0x4684ab['message']));});});};exports['UpdateVoiceCallReport']=function(_0x3ee2d2){var _0x2491c2=this;return new Promise(function(_0x61d1c4,_0x5dc823){return db[_0x13a1('0x16')][_0x13a1('0x23')](_0x3ee2d2[_0x13a1('0x24')],{'raw':_0x3ee2d2['options']?_0x3ee2d2[_0x13a1('0x18')][_0x13a1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ee2d2[_0x13a1('0x18')]?_0x3ee2d2['options'][_0x13a1('0x1a')]||null:null,'attributes':_0x3ee2d2[_0x13a1('0x18')]?_0x3ee2d2[_0x13a1('0x18')][_0x13a1('0x1d')]||null:null,'limit':_0x3ee2d2[_0x13a1('0x18')]?_0x3ee2d2[_0x13a1('0x18')][_0x13a1('0x1b')]||null:null})[_0x13a1('0xb')](function(_0x261cd0){logger[_0x13a1('0xc')](_0x13a1('0x25'),_0x3ee2d2);logger[_0x13a1('0xe')](_0x13a1('0x25'),_0x3ee2d2,JSON['stringify'](_0x261cd0));_0x61d1c4(_0x261cd0);})[_0x13a1('0x15')](function(_0x319959){logger[_0x13a1('0x11')](_0x13a1('0x25'),_0x319959['message'],_0x3ee2d2);_0x5dc823(_0x2491c2[_0x13a1('0x11')](0x1f4,_0x319959['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index afa7d67..2d2eafd 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 _0x76a3=['update','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x276468,_0x29685a){var _0x36dc3a=function(_0x291f0a){while(--_0x291f0a){_0x276468['push'](_0x276468['shift']());}};_0x36dc3a(++_0x29685a);}(_0x76a3,0x182));var _0x376a=function(_0x25d2fb,_0x18a774){_0x25d2fb=_0x25d2fb-0x0;var _0x1ded53=_0x76a3[_0x25d2fb];return _0x1ded53;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x376a('0x0'));var timeout=require('connect-timeout');var express=require(_0x376a('0x1'));var router=express[_0x376a('0x2')]();var fs_extra=require(_0x376a('0x3'));var auth=require(_0x376a('0x4'));var interaction=require(_0x376a('0x5'));var config=require(_0x376a('0x6'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth[_0x376a('0x7')](),controller[_0x376a('0x8')]);router[_0x376a('0x9')](_0x376a('0xa'),auth[_0x376a('0x7')](),controller[_0x376a('0xb')]);router[_0x376a('0xc')]('/',auth[_0x376a('0x7')](),controller[_0x376a('0xd')]);router['put'](_0x376a('0xa'),auth[_0x376a('0x7')](),controller[_0x376a('0xe')]);router['delete']('/:id',auth[_0x376a('0x7')](),controller['destroy']);module[_0x376a('0xf')]=router; \ No newline at end of file +var _0x0166=['fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','put','update','destroy','multer','util','path','connect-timeout','Router'];(function(_0x3e0d81,_0x258d37){var _0x1fa8ca=function(_0x1997a2){while(--_0x1997a2){_0x3e0d81['push'](_0x3e0d81['shift']());}};_0x1fa8ca(++_0x258d37);}(_0x0166,0x1cb));var _0x6016=function(_0x24383a,_0x1aa3bd){_0x24383a=_0x24383a-0x0;var _0x7fadd3=_0x0166[_0x24383a];return _0x7fadd3;};'use strict';var multer=require(_0x6016('0x0'));var util=require(_0x6016('0x1'));var path=require(_0x6016('0x2'));var timeout=require(_0x6016('0x3'));var express=require('express');var router=express[_0x6016('0x4')]();var fs_extra=require(_0x6016('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6016('0x6'));var config=require(_0x6016('0x7'));var controller=require(_0x6016('0x8'));router[_0x6016('0x9')]('/',auth[_0x6016('0xa')](),controller[_0x6016('0xb')]);router[_0x6016('0x9')](_0x6016('0xc'),auth[_0x6016('0xa')](),controller['show']);router['post']('/',auth[_0x6016('0xa')](),controller['create']);router[_0x6016('0xd')](_0x6016('0xc'),auth[_0x6016('0xa')](),controller[_0x6016('0xe')]);router['delete'](_0x6016('0xc'),auth['isAuthenticated'](),controller[_0x6016('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 870173c..ddc3fd0 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 _0x3eec=['name','options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3eec,0x1ec));var _0xc3ee=function(_0xe154c4,_0x5869f3){_0xe154c4=_0xe154c4-0x0;var _0x48f9d9=_0x3eec[_0xe154c4];return _0x48f9d9;};'use strict';var Sequelize=require(_0xc3ee('0x0'));module[_0xc3ee('0x1')]={'name':{'type':Sequelize[_0xc3ee('0x2')]},'prefix':{'type':Sequelize[_0xc3ee('0x2')],'unique':_0xc3ee('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xc3ee('0x2')],'set':function(_0x37e5b1){this['setDataValue'](_0xc3ee('0x4'),_0x37e5b1?_0x37e5b1[_0xc3ee('0x5')](''):[]);},'get':function(){return this[_0xc3ee('0x6')]('options')?this[_0xc3ee('0x6')](_0xc3ee('0x4'))[_0xc3ee('0x7')](''):[];}},'auth':{'type':Sequelize[_0xc3ee('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xc3ee('0x2')]},'record':{'type':Sequelize[_0xc3ee('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xc3ee('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7ede=['exports','STRING','name','setDataValue','options','getDataValue','split','BOOLEAN','sequelize'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7ede,0x1e5));var _0xe7ed=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x7ede[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require(_0xe7ed('0x0'));module[_0xe7ed('0x1')]={'name':{'type':Sequelize[_0xe7ed('0x2')]},'prefix':{'type':Sequelize[_0xe7ed('0x2')],'unique':_0xe7ed('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xe7ed('0x2')],'set':function(_0xe5a3f7){this[_0xe7ed('0x4')](_0xe7ed('0x5'),_0xe5a3f7?_0xe5a3f7['join'](''):[]);},'get':function(){return this['getDataValue'](_0xe7ed('0x5'))?this[_0xe7ed('0x6')](_0xe7ed('0x5'))[_0xe7ed('0x7')](''):[];}},'auth':{'type':Sequelize[_0xe7ed('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xe7ed('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xe7ed('0x2')]},'description':{'type':Sequelize[_0xe7ed('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 3151a59..7b6429f 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 _0x6ae2=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','ChanSpies','stack','name','send','index','map','VoiceChanSpy','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','VIRTUAL','merge','options','where','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','includeAll','find','create','body','user','get','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x836bb4,_0x565f4b){var _0x4f5a56=function(_0x183a19){while(--_0x183a19){_0x836bb4['push'](_0x836bb4['shift']());}};_0x4f5a56(++_0x565f4b);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x5dd910,_0x48f295){_0x5dd910=_0x5dd910-0x0;var _0x5c6180=_0x6ae2[_0x5dd910];return _0x5c6180;};'use strict';var emlformat=require(_0x26ae('0x0'));var rimraf=require(_0x26ae('0x1'));var zipdir=require(_0x26ae('0x2'));var jsonpatch=require(_0x26ae('0x3'));var rp=require(_0x26ae('0x4'));var moment=require(_0x26ae('0x5'));var BPromise=require(_0x26ae('0x6'));var Mustache=require(_0x26ae('0x7'));var util=require(_0x26ae('0x8'));var path=require('path');var sox=require(_0x26ae('0x9'));var csv=require(_0x26ae('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x26ae('0xb'));var squel=require(_0x26ae('0xc'));var crypto=require(_0x26ae('0xd'));var jsforce=require(_0x26ae('0xe'));var deskjs=require(_0x26ae('0xf'));var toCsv=require(_0x26ae('0xa'));var querystring=require(_0x26ae('0x10'));var Papa=require(_0x26ae('0x11'));var Redis=require(_0x26ae('0x12'));var authService=require(_0x26ae('0x13'));var qs=require(_0x26ae('0x14'));var as=require(_0x26ae('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26ae('0x16'))('api');var utils=require(_0x26ae('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x26ae('0x18'))['db'];function respondWithStatusCode(_0x46bc2,_0x21811d){_0x21811d=_0x21811d||0xcc;return function(_0x17f9a6){if(_0x17f9a6){return _0x46bc2[_0x26ae('0x19')](_0x21811d);}return _0x46bc2[_0x26ae('0x1a')](_0x21811d)[_0x26ae('0x1b')]();};}function respondWithResult(_0x1c66b8,_0x2390a7){_0x2390a7=_0x2390a7||0xc8;return function(_0x52d611){if(_0x52d611){return _0x1c66b8[_0x26ae('0x1a')](_0x2390a7)[_0x26ae('0x1c')](_0x52d611);}};}function respondWithFilteredResult(_0x4e5c4e,_0x15d055){return function(_0x32cd9e){if(_0x32cd9e){var _0x497974=typeof _0x15d055[_0x26ae('0x1d')]===_0x26ae('0x1e')&&typeof _0x15d055[_0x26ae('0x1f')]===_0x26ae('0x1e');var _0x13ad43=_0x32cd9e[_0x26ae('0x20')];var _0x250dc0=_0x497974?0x0:_0x15d055[_0x26ae('0x1d')];var _0x28584c=_0x497974?_0x32cd9e[_0x26ae('0x20')]:_0x15d055[_0x26ae('0x1d')]+_0x15d055[_0x26ae('0x1f')];var _0x38102c;if(_0x28584c>=_0x13ad43){_0x28584c=_0x13ad43;_0x38102c=0xc8;}else{_0x38102c=0xce;}_0x4e5c4e[_0x26ae('0x1a')](_0x38102c);return _0x4e5c4e[_0x26ae('0x21')](_0x26ae('0x22'),_0x250dc0+'-'+_0x28584c+'/'+_0x13ad43)[_0x26ae('0x1c')](_0x32cd9e);}return null;};}function patchUpdates(_0xdfcd69){return function(_0x22d535){try{jsonpatch[_0x26ae('0x23')](_0x22d535,_0xdfcd69,!![]);}catch(_0x334153){return BPromise['reject'](_0x334153);}return _0x22d535['save']();};}function saveUpdates(_0x2a2ba5,_0x5d72dc){return function(_0x22c47b){if(_0x22c47b){return _0x22c47b['update'](_0x2a2ba5)[_0x26ae('0x24')](function(_0x2e34d1){return _0x2e34d1;});}return null;};}function removeEntity(_0x19f641,_0x57062e){return function(_0x4ab3f1){if(_0x4ab3f1){return _0x4ab3f1[_0x26ae('0x25')]()[_0x26ae('0x24')](function(){var _0x29de9b=_0x4ab3f1['get']({'plain':!![]});var _0x2caf20=_0x26ae('0x26');return db['UserProfileResource'][_0x26ae('0x25')]({'where':{'type':_0x2caf20,'resourceId':_0x29de9b['id']}})[_0x26ae('0x24')](function(){return _0x4ab3f1;});})[_0x26ae('0x24')](function(){_0x19f641['status'](0xcc)[_0x26ae('0x1b')]();});}};}function handleEntityNotFound(_0x5ab547,_0x28e5a4){return function(_0x1ac4e6){if(!_0x1ac4e6){_0x5ab547[_0x26ae('0x19')](0x194);}return _0x1ac4e6;};}function handleError(_0x4cef91,_0x29eeb4){_0x29eeb4=_0x29eeb4||0x1f4;return function(_0x5a8301){logger['error'](_0x5a8301[_0x26ae('0x27')]);if(_0x5a8301[_0x26ae('0x28')]){delete _0x5a8301['name'];}_0x4cef91[_0x26ae('0x1a')](_0x29eeb4)[_0x26ae('0x29')](_0x5a8301);};}exports[_0x26ae('0x2a')]=function(_0x15a725,_0x2d8cac){var _0x56f880={},_0x3a4194={},_0x16f54c={'count':0x0,'rows':[]};var _0x29476f=_[_0x26ae('0x2b')](db[_0x26ae('0x2c')]['rawAttributes'],function(_0x3a95ba){return{'name':_0x3a95ba[_0x26ae('0x2d')],'type':_0x3a95ba[_0x26ae('0x2e')][_0x26ae('0x2f')]};});_0x3a4194[_0x26ae('0x30')]=_[_0x26ae('0x2b')](_0x29476f,_0x26ae('0x28'));_0x3a4194[_0x26ae('0x31')]=_['keys'](_0x15a725[_0x26ae('0x31')]);_0x3a4194['filters']=_['intersection'](_0x3a4194[_0x26ae('0x30')],_0x3a4194[_0x26ae('0x31')]);_0x56f880[_0x26ae('0x32')]=_['intersection'](_0x3a4194[_0x26ae('0x30')],qs[_0x26ae('0x33')](_0x15a725[_0x26ae('0x31')][_0x26ae('0x33')]));_0x56f880[_0x26ae('0x32')]=_0x56f880[_0x26ae('0x32')][_0x26ae('0x34')]?_0x56f880[_0x26ae('0x32')]:_0x3a4194[_0x26ae('0x30')];if(!_0x15a725[_0x26ae('0x31')][_0x26ae('0x35')](_0x26ae('0x36'))){_0x56f880[_0x26ae('0x1f')]=qs[_0x26ae('0x1f')](_0x15a725['query'][_0x26ae('0x1f')]);_0x56f880[_0x26ae('0x1d')]=qs[_0x26ae('0x1d')](_0x15a725['query'][_0x26ae('0x1d')]);}_0x56f880[_0x26ae('0x37')]=qs[_0x26ae('0x38')](_0x15a725[_0x26ae('0x31')][_0x26ae('0x38')]);_0x56f880['where']=qs[_0x26ae('0x39')](_[_0x26ae('0x3a')](_0x15a725[_0x26ae('0x31')],_0x3a4194[_0x26ae('0x39')]),_0x29476f);if(_0x15a725[_0x26ae('0x31')][_0x26ae('0x3b')]){_0x56f880['where']=_['merge'](_0x56f880['where'],{'$or':_[_0x26ae('0x2b')](_0x29476f,function(_0xcdb7ff){if(_0xcdb7ff[_0x26ae('0x2e')]!==_0x26ae('0x3c')){var _0x30edd3={};_0x30edd3[_0xcdb7ff['name']]={'$like':'%'+_0x15a725[_0x26ae('0x31')][_0x26ae('0x3b')]+'%'};return _0x30edd3;}})});}_0x56f880=_[_0x26ae('0x3d')]({},_0x56f880,_0x15a725[_0x26ae('0x3e')]);var _0x21e4cf={'where':_0x56f880[_0x26ae('0x3f')]};return db[_0x26ae('0x2c')]['count'](_0x21e4cf)[_0x26ae('0x24')](function(_0x7d041f){_0x16f54c['count']=_0x7d041f;if(_0x15a725[_0x26ae('0x31')]['includeAll']){_0x56f880[_0x26ae('0x40')]=[{'all':!![]}];}return db[_0x26ae('0x2c')][_0x26ae('0x41')](_0x56f880);})['then'](function(_0x2a0797){_0x16f54c[_0x26ae('0x42')]=_0x2a0797;return _0x16f54c;})[_0x26ae('0x24')](respondWithFilteredResult(_0x2d8cac,_0x56f880))[_0x26ae('0x43')](handleError(_0x2d8cac,null));};exports[_0x26ae('0x44')]=function(_0x7e7fcf,_0x58731b){var _0x4e7bf0={'raw':![],'where':{'id':_0x7e7fcf[_0x26ae('0x45')]['id']}},_0x4b2e84={};_0x4b2e84[_0x26ae('0x30')]=_[_0x26ae('0x46')](db[_0x26ae('0x2c')][_0x26ae('0x47')]);_0x4b2e84['query']=_['keys'](_0x7e7fcf[_0x26ae('0x31')]);_0x4b2e84[_0x26ae('0x39')]=_[_0x26ae('0x48')](_0x4b2e84['model'],_0x4b2e84[_0x26ae('0x31')]);_0x4e7bf0['attributes']=_[_0x26ae('0x48')](_0x4b2e84[_0x26ae('0x30')],qs['fields'](_0x7e7fcf['query'][_0x26ae('0x33')]));_0x4e7bf0['attributes']=_0x4e7bf0[_0x26ae('0x32')][_0x26ae('0x34')]?_0x4e7bf0[_0x26ae('0x32')]:_0x4b2e84[_0x26ae('0x30')];if(_0x7e7fcf[_0x26ae('0x31')][_0x26ae('0x49')]){_0x4e7bf0[_0x26ae('0x40')]=[{'all':!![]}];}_0x4e7bf0=_[_0x26ae('0x3d')]({},_0x4e7bf0,_0x7e7fcf[_0x26ae('0x3e')]);return db[_0x26ae('0x2c')][_0x26ae('0x4a')](_0x4e7bf0)['then'](handleEntityNotFound(_0x58731b,null))[_0x26ae('0x24')](respondWithResult(_0x58731b,null))[_0x26ae('0x43')](handleError(_0x58731b,null));};exports[_0x26ae('0x4b')]=function(_0x1fe641,_0x3e56bb){return db[_0x26ae('0x2c')][_0x26ae('0x4b')](_0x1fe641[_0x26ae('0x4c')],{})[_0x26ae('0x24')](function(_0x3e9352){var _0x157c8b=_0x1fe641[_0x26ae('0x4d')][_0x26ae('0x4e')]({'plain':!![]});if(!_0x157c8b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x157c8b[_0x26ae('0x4f')]==='user'){var _0x3dd581=_0x3e9352[_0x26ae('0x4e')]({'plain':!![]});var _0x27b890=_0x26ae('0x26');return db[_0x26ae('0x50')][_0x26ae('0x4a')]({'where':{'name':_0x27b890,'userProfileId':_0x157c8b['userProfileId']},'raw':!![]})[_0x26ae('0x24')](function(_0x4b81f6){if(_0x4b81f6&&_0x4b81f6[_0x26ae('0x51')]===0x0){return db['UserProfileResource'][_0x26ae('0x4b')]({'name':_0x3dd581[_0x26ae('0x28')],'resourceId':_0x3dd581['id'],'type':_0x4b81f6['name'],'sectionId':_0x4b81f6['id']},{})[_0x26ae('0x24')](function(){return _0x3e9352;});}else{return _0x3e9352;}})[_0x26ae('0x43')](function(_0x44b9e6){logger[_0x26ae('0x52')](_0x26ae('0x53'),_0x44b9e6);throw _0x44b9e6;});}return _0x3e9352;})['then'](respondWithResult(_0x3e56bb,0xc9))['catch'](handleError(_0x3e56bb,null));};exports[_0x26ae('0x54')]=function(_0xfdd593,_0x4ebf42){if(_0xfdd593[_0x26ae('0x4c')]['id']){delete _0xfdd593[_0x26ae('0x4c')]['id'];}return db[_0x26ae('0x2c')]['find']({'where':{'id':_0xfdd593[_0x26ae('0x45')]['id']}})[_0x26ae('0x24')](handleEntityNotFound(_0x4ebf42,null))[_0x26ae('0x24')](saveUpdates(_0xfdd593[_0x26ae('0x4c')],null))[_0x26ae('0x24')](respondWithResult(_0x4ebf42,null))[_0x26ae('0x43')](handleError(_0x4ebf42,null));};exports[_0x26ae('0x25')]=function(_0x2312e4,_0x3ca5a1){return db[_0x26ae('0x2c')][_0x26ae('0x4a')]({'where':{'id':_0x2312e4[_0x26ae('0x45')]['id']}})[_0x26ae('0x24')](handleEntityNotFound(_0x3ca5a1,null))[_0x26ae('0x24')](removeEntity(_0x3ca5a1,null))[_0x26ae('0x43')](handleError(_0x3ca5a1,null));}; \ No newline at end of file +var _0x4bd1=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','reject','save','update','get','ChanSpies','UserProfileResource','destroy','then','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','params','length','include','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x3ef4d1,_0x7bbb03){var _0x3637e3=function(_0x3e9301){while(--_0x3e9301){_0x3ef4d1['push'](_0x3ef4d1['shift']());}};_0x3637e3(++_0x7bbb03);}(_0x4bd1,0x90));var _0x14bd=function(_0x4a7e98,_0x250137){_0x4a7e98=_0x4a7e98-0x0;var _0x27d10d=_0x4bd1[_0x4a7e98];return _0x27d10d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x14bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14bd('0x1'));var rp=require(_0x14bd('0x2'));var moment=require('moment');var BPromise=require(_0x14bd('0x3'));var Mustache=require(_0x14bd('0x4'));var util=require('util');var path=require(_0x14bd('0x5'));var sox=require(_0x14bd('0x6'));var csv=require(_0x14bd('0x7'));var ejs=require(_0x14bd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14bd('0x9'));var squel=require(_0x14bd('0xa'));var crypto=require(_0x14bd('0xb'));var jsforce=require(_0x14bd('0xc'));var deskjs=require(_0x14bd('0xd'));var toCsv=require(_0x14bd('0x7'));var querystring=require(_0x14bd('0xe'));var Papa=require(_0x14bd('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x14bd('0x10'));var hardwareService=require(_0x14bd('0x11'));var logger=require(_0x14bd('0x12'))('api');var utils=require(_0x14bd('0x13'));var config=require(_0x14bd('0x14'));var licenseUtil=require(_0x14bd('0x15'));var db=require(_0x14bd('0x16'))['db'];function respondWithStatusCode(_0x29475f,_0x316e4e){_0x316e4e=_0x316e4e||0xcc;return function(_0x12f60a){if(_0x12f60a){return _0x29475f[_0x14bd('0x17')](_0x316e4e);}return _0x29475f['status'](_0x316e4e)[_0x14bd('0x18')]();};}function respondWithResult(_0x567356,_0x3ee1b9){_0x3ee1b9=_0x3ee1b9||0xc8;return function(_0x47e495){if(_0x47e495){return _0x567356[_0x14bd('0x19')](_0x3ee1b9)[_0x14bd('0x1a')](_0x47e495);}};}function respondWithFilteredResult(_0x5b9470,_0x3797d9){return function(_0x49ed59){if(_0x49ed59){var _0x10e47e=typeof _0x3797d9[_0x14bd('0x1b')]===_0x14bd('0x1c')&&typeof _0x3797d9[_0x14bd('0x1d')]===_0x14bd('0x1c');var _0x7b7012=_0x49ed59['count'];var _0x5c8064=_0x10e47e?0x0:_0x3797d9[_0x14bd('0x1b')];var _0x18c473=_0x10e47e?_0x49ed59['count']:_0x3797d9['offset']+_0x3797d9[_0x14bd('0x1d')];var _0x24a5a3;if(_0x18c473>=_0x7b7012){_0x18c473=_0x7b7012;_0x24a5a3=0xc8;}else{_0x24a5a3=0xce;}_0x5b9470['status'](_0x24a5a3);return _0x5b9470[_0x14bd('0x1e')]('Content-Range',_0x5c8064+'-'+_0x18c473+'/'+_0x7b7012)[_0x14bd('0x1a')](_0x49ed59);}return null;};}function patchUpdates(_0x568a21){return function(_0x792fdb){try{jsonpatch['apply'](_0x792fdb,_0x568a21,!![]);}catch(_0x3b95d1){return BPromise[_0x14bd('0x1f')](_0x3b95d1);}return _0x792fdb[_0x14bd('0x20')]();};}function saveUpdates(_0x521e3d,_0x253e93){return function(_0x28b06c){if(_0x28b06c){return _0x28b06c[_0x14bd('0x21')](_0x521e3d)['then'](function(_0x259944){return _0x259944;});}return null;};}function removeEntity(_0xfd41b4,_0xe011b3){return function(_0x4afb0e){if(_0x4afb0e){return _0x4afb0e['destroy']()['then'](function(){var _0x2495d2=_0x4afb0e[_0x14bd('0x22')]({'plain':!![]});var _0x67d318=_0x14bd('0x23');return db[_0x14bd('0x24')][_0x14bd('0x25')]({'where':{'type':_0x67d318,'resourceId':_0x2495d2['id']}})[_0x14bd('0x26')](function(){return _0x4afb0e;});})[_0x14bd('0x26')](function(){_0xfd41b4[_0x14bd('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1112f0,_0x424c74){return function(_0x4be185){if(!_0x4be185){_0x1112f0[_0x14bd('0x17')](0x194);}return _0x4be185;};}function handleError(_0x5e4306,_0x4d5760){_0x4d5760=_0x4d5760||0x1f4;return function(_0x101feb){logger[_0x14bd('0x27')](_0x101feb[_0x14bd('0x28')]);if(_0x101feb[_0x14bd('0x29')]){delete _0x101feb['name'];}_0x5e4306[_0x14bd('0x19')](_0x4d5760)[_0x14bd('0x2a')](_0x101feb);};}exports[_0x14bd('0x2b')]=function(_0x366ff0,_0x79cc5e){var _0x32727b={},_0x4fe224={},_0x3f5684={'count':0x0,'rows':[]};var _0x51351d=_[_0x14bd('0x2c')](db[_0x14bd('0x2d')][_0x14bd('0x2e')],function(_0x36d26e){return{'name':_0x36d26e[_0x14bd('0x2f')],'type':_0x36d26e[_0x14bd('0x30')][_0x14bd('0x31')]};});_0x4fe224[_0x14bd('0x32')]=_[_0x14bd('0x2c')](_0x51351d,_0x14bd('0x29'));_0x4fe224[_0x14bd('0x33')]=_[_0x14bd('0x34')](_0x366ff0[_0x14bd('0x33')]);_0x4fe224[_0x14bd('0x35')]=_[_0x14bd('0x36')](_0x4fe224['model'],_0x4fe224[_0x14bd('0x33')]);_0x32727b['attributes']=_[_0x14bd('0x36')](_0x4fe224[_0x14bd('0x32')],qs[_0x14bd('0x37')](_0x366ff0[_0x14bd('0x33')][_0x14bd('0x37')]));_0x32727b[_0x14bd('0x38')]=_0x32727b[_0x14bd('0x38')]['length']?_0x32727b[_0x14bd('0x38')]:_0x4fe224[_0x14bd('0x32')];if(!_0x366ff0['query'][_0x14bd('0x39')](_0x14bd('0x3a'))){_0x32727b['limit']=qs['limit'](_0x366ff0[_0x14bd('0x33')]['limit']);_0x32727b[_0x14bd('0x1b')]=qs[_0x14bd('0x1b')](_0x366ff0[_0x14bd('0x33')][_0x14bd('0x1b')]);}_0x32727b[_0x14bd('0x3b')]=qs['sort'](_0x366ff0[_0x14bd('0x33')]['sort']);_0x32727b[_0x14bd('0x3c')]=qs['filters'](_[_0x14bd('0x3d')](_0x366ff0['query'],_0x4fe224[_0x14bd('0x35')]),_0x51351d);if(_0x366ff0['query'][_0x14bd('0x3e')]){_0x32727b[_0x14bd('0x3c')]=_[_0x14bd('0x3f')](_0x32727b[_0x14bd('0x3c')],{'$or':_[_0x14bd('0x2c')](_0x51351d,function(_0xe913b1){if(_0xe913b1[_0x14bd('0x30')]!==_0x14bd('0x40')){var _0x224df2={};_0x224df2[_0xe913b1[_0x14bd('0x29')]]={'$like':'%'+_0x366ff0[_0x14bd('0x33')]['filter']+'%'};return _0x224df2;}})});}_0x32727b=_['merge']({},_0x32727b,_0x366ff0['options']);var _0x520fd3={'where':_0x32727b[_0x14bd('0x3c')]};return db[_0x14bd('0x2d')]['count'](_0x520fd3)[_0x14bd('0x26')](function(_0x1b4159){_0x3f5684['count']=_0x1b4159;if(_0x366ff0[_0x14bd('0x33')][_0x14bd('0x41')]){_0x32727b['include']=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x32727b);})[_0x14bd('0x26')](function(_0x3a0a28){_0x3f5684['rows']=_0x3a0a28;return _0x3f5684;})[_0x14bd('0x26')](respondWithFilteredResult(_0x79cc5e,_0x32727b))['catch'](handleError(_0x79cc5e,null));};exports['show']=function(_0x2c4e17,_0x19315b){var _0x32fab0={'raw':![],'where':{'id':_0x2c4e17[_0x14bd('0x42')]['id']}},_0x4f24a7={};_0x4f24a7[_0x14bd('0x32')]=_['keys'](db[_0x14bd('0x2d')][_0x14bd('0x2e')]);_0x4f24a7[_0x14bd('0x33')]=_['keys'](_0x2c4e17[_0x14bd('0x33')]);_0x4f24a7[_0x14bd('0x35')]=_[_0x14bd('0x36')](_0x4f24a7[_0x14bd('0x32')],_0x4f24a7['query']);_0x32fab0[_0x14bd('0x38')]=_[_0x14bd('0x36')](_0x4f24a7[_0x14bd('0x32')],qs['fields'](_0x2c4e17[_0x14bd('0x33')][_0x14bd('0x37')]));_0x32fab0[_0x14bd('0x38')]=_0x32fab0[_0x14bd('0x38')][_0x14bd('0x43')]?_0x32fab0[_0x14bd('0x38')]:_0x4f24a7[_0x14bd('0x32')];if(_0x2c4e17[_0x14bd('0x33')][_0x14bd('0x41')]){_0x32fab0[_0x14bd('0x44')]=[{'all':!![]}];}_0x32fab0=_[_0x14bd('0x3f')]({},_0x32fab0,_0x2c4e17['options']);return db['VoiceChanSpy']['find'](_0x32fab0)[_0x14bd('0x26')](handleEntityNotFound(_0x19315b,null))[_0x14bd('0x26')](respondWithResult(_0x19315b,null))[_0x14bd('0x45')](handleError(_0x19315b,null));};exports['create']=function(_0x366efd,_0x212ff1){return db['VoiceChanSpy']['create'](_0x366efd[_0x14bd('0x46')],{})[_0x14bd('0x26')](function(_0x4bfb30){var _0x5966ac=_0x366efd[_0x14bd('0x47')][_0x14bd('0x22')]({'plain':!![]});if(!_0x5966ac)throw new Error(_0x14bd('0x48'));if(_0x5966ac[_0x14bd('0x49')]==='user'){var _0xb1ceeb=_0x4bfb30['get']({'plain':!![]});var _0x34d851=_0x14bd('0x23');return db[_0x14bd('0x4a')][_0x14bd('0x4b')]({'where':{'name':_0x34d851,'userProfileId':_0x5966ac[_0x14bd('0x4c')]},'raw':!![]})[_0x14bd('0x26')](function(_0x2ee1a2){if(_0x2ee1a2&&_0x2ee1a2[_0x14bd('0x4d')]===0x0){return db['UserProfileResource'][_0x14bd('0x4e')]({'name':_0xb1ceeb['name'],'resourceId':_0xb1ceeb['id'],'type':_0x2ee1a2[_0x14bd('0x29')],'sectionId':_0x2ee1a2['id']},{})[_0x14bd('0x26')](function(){return _0x4bfb30;});}else{return _0x4bfb30;}})[_0x14bd('0x45')](function(_0x4a89af){logger[_0x14bd('0x27')](_0x14bd('0x4f'),_0x4a89af);throw _0x4a89af;});}return _0x4bfb30;})[_0x14bd('0x26')](respondWithResult(_0x212ff1,0xc9))[_0x14bd('0x45')](handleError(_0x212ff1,null));};exports['update']=function(_0x2e7e7c,_0x405756){if(_0x2e7e7c[_0x14bd('0x46')]['id']){delete _0x2e7e7c[_0x14bd('0x46')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x2e7e7c['params']['id']}})[_0x14bd('0x26')](handleEntityNotFound(_0x405756,null))[_0x14bd('0x26')](saveUpdates(_0x2e7e7c[_0x14bd('0x46')],null))[_0x14bd('0x26')](respondWithResult(_0x405756,null))[_0x14bd('0x45')](handleError(_0x405756,null));};exports[_0x14bd('0x25')]=function(_0xbeccdc,_0x3fca37){return db[_0x14bd('0x2d')][_0x14bd('0x4b')]({'where':{'id':_0xbeccdc[_0x14bd('0x42')]['id']}})[_0x14bd('0x26')](handleEntityNotFound(_0x3fca37,null))[_0x14bd('0x26')](removeEntity(_0x3fca37,null))[_0x14bd('0x45')](handleError(_0x3fca37,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 3ed9573..09334c7 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 _0x4687=['then','exports','models','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','join','length','concat','internal','User','findAll','agent'];(function(_0x6c0192,_0x111efd){var _0x5a09db=function(_0x2e2109){while(--_0x2e2109){_0x6c0192['push'](_0x6c0192['shift']());}};_0x5a09db(++_0x111efd);}(_0x4687,0x80));var _0x7468=function(_0x208a70,_0x197606){_0x208a70=_0x208a70-0x0;var _0x2e5d0d=_0x4687[_0x208a70];return _0x2e5d0d;};'use strict';var _=require(_0x7468('0x0'));var util=require(_0x7468('0x1'));var BPromise=require(_0x7468('0x2'));var attributes=require(_0x7468('0x3'));var getUserApplications=function(_0xc08818,_0x45aa0b,_0xeb35f0){var _0x1a5854=0x1;var _0x549683=[];var _0x262b0b={'context':_0x45aa0b[_0x7468('0x4')]||_0x7468('0x5'),'exten':util[_0x7468('0x6')](_0x7468('0x7'),_0xc08818[_0x7468('0x8')],_0xeb35f0),'type':_0x7468('0x9'),'isApp':![],'ChanSpyId':_0xc08818['id'],'UserId':_0x45aa0b['id']};_0x549683[_0x7468('0xa')](_[_0x7468('0xb')]({'app':_0x7468('0xc'),'appdata':util[_0x7468('0x6')](_0x7468('0xd'),_0x7468('0xe')),'priority':_0x1a5854++},_0x262b0b));if(_0xc08818[_0x7468('0xf')]){_0x549683[_0x7468('0xa')](_['merge']({'app':_0x7468('0x10'),'appdata':util['format'](_0x7468('0x11'),_0xc08818[_0x7468('0x12')]),'priority':_0x1a5854++},_0x262b0b));}if(_0xc08818[_0x7468('0x13')]){_0x549683[_0x7468('0xa')](_[_0x7468('0xb')]({'app':_0x7468('0x14'),'appdata':_0xc08818[_0x7468('0x15')],'priority':_0x1a5854++},_0x262b0b));}_0x549683['push'](_['merge']({'app':_0x7468('0x16'),'appdata':util[_0x7468('0x6')](_0x7468('0x17'),_0x45aa0b[_0x7468('0x18')],_0xc08818['options']?_0xc08818['options'][_0x7468('0x19')](''):''),'priority':_0x1a5854++},_0x262b0b));if(_0xc08818[_0x7468('0xf')]){_0x549683['push'](_[_0x7468('0xb')]({'app':'StopMixMonitor','priority':_0x1a5854++},_0x262b0b));}return _0x549683;};var getChanSpyApplications=function(_0x48b789,_0x5af6b2){var _0x5141bb=[];for(var _0x4b9bef=0x0,_0x256eef=0x1;_0x4b9bef<_0x5af6b2[_0x7468('0x1a')];_0x4b9bef++,_0x256eef=0x1){_0x5141bb=_0x5141bb[_0x7468('0x1b')](getUserApplications(_0x48b789,_0x5af6b2[_0x4b9bef],_0x5af6b2[_0x4b9bef][_0x7468('0x1c')]));if(_0x5af6b2[_0x4b9bef][_0x7468('0x1c')]!=_0x5af6b2[_0x4b9bef][_0x7468('0x18')]){_0x5141bb=_0x5141bb[_0x7468('0x1b')](getUserApplications(_0x48b789,_0x5af6b2[_0x4b9bef],_0x5af6b2[_0x4b9bef]['name']));}}return _0x5141bb;};var getChanSpyPromise=function(_0x25bacf,_0x105daf){return new BPromise(function(_0x41edc9,_0x93d632){return _0x25bacf[_0x7468('0x1d')][_0x7468('0x1e')]({'attributes':['id',_0x7468('0x18'),_0x7468('0x1c')],'where':{'role':_0x7468('0x1f'),'chanspy':!![]},'raw':!![]})[_0x7468('0x20')](function(_0x29b7aa){if(_0x29b7aa){return _0x41edc9(getChanSpyApplications(_0x105daf,_0x29b7aa));}return _0x41edc9([]);})['catch'](function(_0x1d089a){_0x93d632(_0x1d089a);});});};module[_0x7468('0x21')]=function(_0x47307c,_0x1f4d09){var _0x205b9d=_0x47307c[_0x7468('0x22')];return _0x47307c['define'](_0x7468('0x23'),attributes,{'tableName':_0x7468('0x24'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x11afa7,_0x166030,_0x46daee){return getChanSpyPromise(_0x205b9d,_0x11afa7)['then'](function(_0x22131b){if(_0x22131b&&_0x22131b[_0x7468('0x1a')]){return _0x205b9d[_0x7468('0x25')][_0x7468('0x26')](_0x22131b);}})[_0x7468('0x20')](function(){_0x46daee();})[_0x7468('0x27')](function(_0x4fcf6d){_0x46daee(_0x4fcf6d);});},'afterUpdate':function(_0x17f676,_0x396a5e,_0x3fe962){return _0x205b9d[_0x7468('0x25')]['destroy']({'where':{'ChanSpyId':_0x17f676['id']}})[_0x7468('0x20')](function(){return getChanSpyPromise(_0x205b9d,_0x17f676);})['then'](function(_0x5eeb22){if(_0x5eeb22&&_0x5eeb22[_0x7468('0x1a')]){return _0x205b9d[_0x7468('0x25')][_0x7468('0x26')](_0x5eeb22);}})[_0x7468('0x20')](function(){_0x3fe962();})[_0x7468('0x27')](function(_0x2be84a){_0x3fe962(_0x2be84a);});},'afterDestroy':function(_0x57ea06,_0x82daff,_0xa5c14e){return _0x205b9d['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x57ea06['id']}})['then'](function(){_0xa5c14e();})[_0x7468('0x27')](function(_0x376be6){_0xa5c14e(_0x376be6);});}}});}; \ No newline at end of file +var _0xddca=['ChanSpy','options','join','StopMixMonitor','length','concat','internal','name','User','findAll','then','catch','exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','lodash','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','push','merge','Set','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password'];(function(_0x23e552,_0x2a3345){var _0x3269ed=function(_0x56493e){while(--_0x56493e){_0x23e552['push'](_0x23e552['shift']());}};_0x3269ed(++_0x2a3345);}(_0xddca,0x19f));var _0xaddc=function(_0x765628,_0x4e3b36){_0x765628=_0x765628-0x0;var _0xa41e3c=_0xddca[_0x765628];return _0xa41e3c;};'use strict';var _=require(_0xaddc('0x0'));var util=require('util');var BPromise=require(_0xaddc('0x1'));var attributes=require(_0xaddc('0x2'));var getUserApplications=function(_0x33badc,_0xa58d27,_0x30307b){var _0x160133=0x1;var _0x496817=[];var _0x271af7={'context':_0xa58d27['context']||_0xaddc('0x3'),'exten':util[_0xaddc('0x4')](_0xaddc('0x5'),_0x33badc[_0xaddc('0x6')],_0x30307b),'type':_0xaddc('0x7'),'isApp':![],'ChanSpyId':_0x33badc['id'],'UserId':_0xa58d27['id']};_0x496817[_0xaddc('0x8')](_[_0xaddc('0x9')]({'app':_0xaddc('0xa'),'appdata':util[_0xaddc('0x4')]('CDR(type)=%s',_0xaddc('0xb')),'priority':_0x160133++},_0x271af7));if(_0x33badc['record']){_0x496817[_0xaddc('0x8')](_[_0xaddc('0x9')]({'app':_0xaddc('0xc'),'appdata':util[_0xaddc('0x4')](_0xaddc('0xd'),_0x33badc[_0xaddc('0xe')]),'priority':_0x160133++},_0x271af7));}if(_0x33badc['auth']){_0x496817[_0xaddc('0x8')](_[_0xaddc('0x9')]({'app':_0xaddc('0xf'),'appdata':_0x33badc[_0xaddc('0x10')],'priority':_0x160133++},_0x271af7));}_0x496817[_0xaddc('0x8')](_['merge']({'app':_0xaddc('0x11'),'appdata':util[_0xaddc('0x4')]('SIP/%s,%s',_0xa58d27['name'],_0x33badc[_0xaddc('0x12')]?_0x33badc[_0xaddc('0x12')][_0xaddc('0x13')](''):''),'priority':_0x160133++},_0x271af7));if(_0x33badc['record']){_0x496817[_0xaddc('0x8')](_[_0xaddc('0x9')]({'app':_0xaddc('0x14'),'priority':_0x160133++},_0x271af7));}return _0x496817;};var getChanSpyApplications=function(_0x35eb05,_0x43497a){var _0x3bf802=[];for(var _0x38eb0b=0x0,_0x1fd4f3=0x1;_0x38eb0b<_0x43497a[_0xaddc('0x15')];_0x38eb0b++,_0x1fd4f3=0x1){_0x3bf802=_0x3bf802[_0xaddc('0x16')](getUserApplications(_0x35eb05,_0x43497a[_0x38eb0b],_0x43497a[_0x38eb0b][_0xaddc('0x17')]));if(_0x43497a[_0x38eb0b][_0xaddc('0x17')]!=_0x43497a[_0x38eb0b][_0xaddc('0x18')]){_0x3bf802=_0x3bf802['concat'](getUserApplications(_0x35eb05,_0x43497a[_0x38eb0b],_0x43497a[_0x38eb0b]['name']));}}return _0x3bf802;};var getChanSpyPromise=function(_0x369845,_0x27e845){return new BPromise(function(_0x578ea0,_0x41ea69){return _0x369845[_0xaddc('0x19')][_0xaddc('0x1a')]({'attributes':['id',_0xaddc('0x18'),_0xaddc('0x17')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xaddc('0x1b')](function(_0x1cec2b){if(_0x1cec2b){return _0x578ea0(getChanSpyApplications(_0x27e845,_0x1cec2b));}return _0x578ea0([]);})[_0xaddc('0x1c')](function(_0x1331d4){_0x41ea69(_0x1331d4);});});};module[_0xaddc('0x1d')]=function(_0x5f05ba,_0x91dc34){var _0x4892c7=_0x5f05ba['models'];return _0x5f05ba[_0xaddc('0x1e')](_0xaddc('0x1f'),attributes,{'tableName':_0xaddc('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x139b1f,_0x27f121,_0x59457b){return getChanSpyPromise(_0x4892c7,_0x139b1f)[_0xaddc('0x1b')](function(_0x16f9d5){if(_0x16f9d5&&_0x16f9d5[_0xaddc('0x15')]){return _0x4892c7[_0xaddc('0x21')]['bulkCreate'](_0x16f9d5);}})[_0xaddc('0x1b')](function(){_0x59457b();})['catch'](function(_0x21093e){_0x59457b(_0x21093e);});},'afterUpdate':function(_0x4675c4,_0x996abb,_0x17d60d){return _0x4892c7[_0xaddc('0x21')][_0xaddc('0x22')]({'where':{'ChanSpyId':_0x4675c4['id']}})[_0xaddc('0x1b')](function(){return getChanSpyPromise(_0x4892c7,_0x4675c4);})[_0xaddc('0x1b')](function(_0x44aca2){if(_0x44aca2&&_0x44aca2[_0xaddc('0x15')]){return _0x4892c7[_0xaddc('0x21')][_0xaddc('0x23')](_0x44aca2);}})[_0xaddc('0x1b')](function(){_0x17d60d();})[_0xaddc('0x1c')](function(_0x1133b8){_0x17d60d(_0x1133b8);});},'afterDestroy':function(_0x3d7ef0,_0x541a46,_0x22bb87){return _0x4892c7[_0xaddc('0x21')][_0xaddc('0x22')]({'where':{'ChanSpyId':_0x3d7ef0['id']}})[_0xaddc('0x1b')](function(){_0x22bb87();})[_0xaddc('0x1c')](function(_0x5aa95a){_0x22bb87(_0x5aa95a);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index ed22957..0ddd89c 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(_0x4051be,_0x4e30dc){var _0x10d8e5=function(_0x1ae1c2){while(--_0x1ae1c2){_0x4051be['push'](_0x4051be['shift']());}};_0x10d8e5(++_0x4e30dc);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0xb4e6[_0xa79977];return _0x109f10;};'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 _0x9b87=['error','code','VoiceChanSpy,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x94240a,_0x214e50){var _0x47160c=function(_0x226dcc){while(--_0x226dcc){_0x94240a['push'](_0x94240a['shift']());}};_0x47160c(++_0x214e50);}(_0x9b87,0x8e));var _0x79b8=function(_0x417969,_0x3935de){_0x417969=_0x417969-0x0;var _0x3d95a4=_0x9b87[_0x417969];return _0x3d95a4;};'use strict';var _=require(_0x79b8('0x0'));var util=require(_0x79b8('0x1'));var moment=require(_0x79b8('0x2'));var BPromise=require(_0x79b8('0x3'));var rs=require(_0x79b8('0x4'));var fs=require('fs');var Redis=require(_0x79b8('0x5'));var db=require(_0x79b8('0x6'))['db'];var utils=require(_0x79b8('0x7'));var logger=require(_0x79b8('0x8'))(_0x79b8('0x9'));var config=require(_0x79b8('0xa'));var jayson=require(_0x79b8('0xb'));var client=jayson[_0x79b8('0xc')][_0x79b8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1d2c9f,_0xf5e0f2,_0x5e10fe){return new BPromise(function(_0x4e0dd8,_0x5c15d4){return client['request'](_0x1d2c9f,_0x5e10fe)[_0x79b8('0xe')](function(_0x317e29){logger[_0x79b8('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0xf5e0f2,_0x79b8('0x10'));logger[_0x79b8('0x11')](_0x79b8('0x12'),_0xf5e0f2,'request\x20sent',JSON['stringify'](_0x317e29));if(_0x317e29[_0x79b8('0x13')]){if(_0x317e29[_0x79b8('0x13')][_0x79b8('0x14')]===0x1f4){logger[_0x79b8('0x13')](_0x79b8('0x15'),_0xf5e0f2,_0x317e29[_0x79b8('0x13')][_0x79b8('0x16')]);return _0x5c15d4(_0x317e29[_0x79b8('0x13')][_0x79b8('0x16')]);}logger[_0x79b8('0x13')](_0x79b8('0x15'),_0xf5e0f2,_0x317e29['error'][_0x79b8('0x16')]);return _0x4e0dd8(_0x317e29['error']['message']);}else{logger[_0x79b8('0xf')](_0x79b8('0x15'),_0xf5e0f2,_0x79b8('0x10'));_0x4e0dd8(_0x317e29['result'][_0x79b8('0x16')]);}})['catch'](function(_0x5ef869){logger[_0x79b8('0x13')](_0x79b8('0x15'),_0xf5e0f2,_0x5ef869);_0x5c15d4(_0x5ef869);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index fb511a8..d96aaca 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 _0x6c64=['delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x31f400,_0x3d3afa){var _0x2c8714=function(_0x32eeb7){while(--_0x32eeb7){_0x31f400['push'](_0x31f400['shift']());}};_0x2c8714(++_0x3d3afa);}(_0x6c64,0x113));var _0x46c6=function(_0x23f724,_0x299a30){_0x23f724=_0x23f724-0x0;var _0x303fc3=_0x6c64[_0x23f724];return _0x303fc3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x46c6('0x0'));var express=require(_0x46c6('0x1'));var router=express[_0x46c6('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x46c6('0x3'));var interaction=require(_0x46c6('0x4'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0x46c6('0x5')]('/',auth[_0x46c6('0x6')](),controller[_0x46c6('0x7')]);router[_0x46c6('0x5')](_0x46c6('0x8'),auth[_0x46c6('0x6')](),controller[_0x46c6('0x9')]);router[_0x46c6('0xa')]('/',auth[_0x46c6('0x6')](),controller[_0x46c6('0xb')]);router[_0x46c6('0xc')](_0x46c6('0x8'),auth['isAuthenticated'](),controller[_0x46c6('0xd')]);router[_0x46c6('0xe')]('/:id',auth[_0x46c6('0x6')](),controller[_0x46c6('0xf')]);module[_0x46c6('0x10')]=router; \ No newline at end of file +var _0x052e=['isAuthenticated','show','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x3f05e4,_0x11fcf5){var _0x322b19=function(_0x23348d){while(--_0x23348d){_0x3f05e4['push'](_0x3f05e4['shift']());}};_0x322b19(++_0x11fcf5);}(_0x052e,0x16e));var _0xe052=function(_0x34e29e,_0x3d6df5){_0x34e29e=_0x34e29e-0x0;var _0x4d0088=_0x052e[_0x34e29e];return _0x4d0088;};'use strict';var multer=require(_0xe052('0x0'));var util=require(_0xe052('0x1'));var path=require(_0xe052('0x2'));var timeout=require(_0xe052('0x3'));var express=require('express');var router=express[_0xe052('0x4')]();var fs_extra=require(_0xe052('0x5'));var auth=require(_0xe052('0x6'));var interaction=require(_0xe052('0x7'));var config=require(_0xe052('0x8'));var controller=require('./voiceContext.controller');router[_0xe052('0x9')]('/',auth['isAuthenticated'](),controller[_0xe052('0xa')]);router[_0xe052('0x9')](_0xe052('0xb'),auth[_0xe052('0xc')](),controller[_0xe052('0xd')]);router['post']('/',auth[_0xe052('0xc')](),controller['create']);router[_0xe052('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xe052('0xf')]);router[_0xe052('0x10')]('/:id',auth[_0xe052('0xc')](),controller['destroy']);module[_0xe052('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 2f93e1b..5e87294 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 _0x995e=['name','sequelize','exports','STRING'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0x995e,0xfd));var _0xe995=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x995e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xe995('0x0'));module[_0xe995('0x1')]={'name':{'type':Sequelize[_0xe995('0x2')],'unique':_0xe995('0x3')},'description':{'type':Sequelize[_0xe995('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x30da=['STRING','name','BOOLEAN','sequelize'];(function(_0x120702,_0x2b3541){var _0x2d1ccd=function(_0xf63391){while(--_0xf63391){_0x120702['push'](_0x120702['shift']());}};_0x2d1ccd(++_0x2b3541);}(_0x30da,0x14f));var _0xa30d=function(_0x58657e,_0x1067d7){_0x58657e=_0x58657e-0x0;var _0x468147=_0x30da[_0x58657e];return _0x468147;};'use strict';var Sequelize=require(_0xa30d('0x0'));module['exports']={'name':{'type':Sequelize[_0xa30d('0x1')],'unique':_0xa30d('0x2')},'description':{'type':Sequelize[_0xa30d('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xa30d('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 1bfd931..0b0038e 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 _0x32cf=['sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceContext,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','get','Contexts','UserProfileResource','name','send','map','VoiceContext','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x159195,_0x47a40f){var _0x46d8f0=function(_0x520963){while(--_0x520963){_0x159195['push'](_0x159195['shift']());}};_0x46d8f0(++_0x47a40f);}(_0x32cf,0x1ec));var _0xf32c=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0x32cf[_0x45d1fd];return _0xd0e542;};'use strict';var emlformat=require(_0xf32c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf32c('0x1'));var jsonpatch=require(_0xf32c('0x2'));var rp=require(_0xf32c('0x3'));var moment=require('moment');var BPromise=require(_0xf32c('0x4'));var Mustache=require(_0xf32c('0x5'));var util=require(_0xf32c('0x6'));var path=require(_0xf32c('0x7'));var sox=require(_0xf32c('0x8'));var csv=require(_0xf32c('0x9'));var ejs=require(_0xf32c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf32c('0xb'));var squel=require(_0xf32c('0xc'));var crypto=require('crypto');var jsforce=require(_0xf32c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf32c('0xe'));var Papa=require(_0xf32c('0xf'));var Redis=require(_0xf32c('0x10'));var authService=require(_0xf32c('0x11'));var qs=require(_0xf32c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf32c('0x13'))('api');var utils=require(_0xf32c('0x14'));var config=require(_0xf32c('0x15'));var licenseUtil=require(_0xf32c('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xf32c('0x17'));var client=jayson[_0xf32c('0x18')][_0xf32c('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3e059c,_0x802dc3,_0x5a5ded,_0x52230f){return new BPromise(function(_0x3695ec,_0x43e444){var _0x2a7201=_0x52230f||client;return _0x2a7201[_0xf32c('0x1a')](_0x3e059c,_0x5a5ded)[_0xf32c('0x1b')](function(_0x4b4abc){logger['info']('VoiceContext,\x20%s,\x20%s',_0x802dc3,'request\x20sent');logger['debug'](_0xf32c('0x1c'),_0x802dc3,_0xf32c('0x1d'),JSON['stringify'](_0x4b4abc));if(_0x4b4abc['error']){if(_0x4b4abc[_0xf32c('0x1e')][_0xf32c('0x1f')]===0x1f4){logger[_0xf32c('0x1e')](_0xf32c('0x20'),_0x802dc3,_0x4b4abc[_0xf32c('0x1e')]['message']);return _0x43e444(_0x4b4abc[_0xf32c('0x1e')][_0xf32c('0x21')]);}logger[_0xf32c('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x802dc3,_0x4b4abc[_0xf32c('0x1e')][_0xf32c('0x21')]);return _0x3695ec(_0x4b4abc[_0xf32c('0x1e')][_0xf32c('0x21')]);}else{logger[_0xf32c('0x22')](_0xf32c('0x20'),_0x802dc3,_0xf32c('0x1d'));_0x3695ec(_0x4b4abc['result']['message']);}})[_0xf32c('0x23')](function(_0x443733){logger[_0xf32c('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x802dc3,_0x443733);_0x43e444(_0x443733);});});}function respondWithStatusCode(_0x204073,_0x5bff59){_0x5bff59=_0x5bff59||0xcc;return function(_0x2d7cbf){if(_0x2d7cbf){return _0x204073[_0xf32c('0x24')](_0x5bff59);}return _0x204073[_0xf32c('0x25')](_0x5bff59)[_0xf32c('0x26')]();};}function respondWithResult(_0x41fcf1,_0x12da4b){_0x12da4b=_0x12da4b||0xc8;return function(_0x2fea2b){if(_0x2fea2b){return _0x41fcf1['status'](_0x12da4b)[_0xf32c('0x27')](_0x2fea2b);}};}function respondWithFilteredResult(_0x515192,_0x5cdfb8){return function(_0x1a762c){if(_0x1a762c){var _0xb3e85d=typeof _0x5cdfb8[_0xf32c('0x28')]===_0xf32c('0x29')&&typeof _0x5cdfb8[_0xf32c('0x2a')]===_0xf32c('0x29');var _0x22bcf7=_0x1a762c[_0xf32c('0x2b')];var _0x49bbd8=_0xb3e85d?0x0:_0x5cdfb8[_0xf32c('0x28')];var _0x4ab0f3=_0xb3e85d?_0x1a762c[_0xf32c('0x2b')]:_0x5cdfb8[_0xf32c('0x28')]+_0x5cdfb8['limit'];var _0x33503e;if(_0x4ab0f3>=_0x22bcf7){_0x4ab0f3=_0x22bcf7;_0x33503e=0xc8;}else{_0x33503e=0xce;}_0x515192[_0xf32c('0x25')](_0x33503e);return _0x515192[_0xf32c('0x2c')]('Content-Range',_0x49bbd8+'-'+_0x4ab0f3+'/'+_0x22bcf7)[_0xf32c('0x27')](_0x1a762c);}return null;};}function patchUpdates(_0x5d614b){return function(_0x38166d){try{jsonpatch[_0xf32c('0x2d')](_0x38166d,_0x5d614b,!![]);}catch(_0x45b62a){return BPromise[_0xf32c('0x2e')](_0x45b62a);}return _0x38166d['save']();};}function saveUpdates(_0xedfe9a,_0x3e89cb){return function(_0x516a14){if(_0x516a14){return _0x516a14[_0xf32c('0x2f')](_0xedfe9a)[_0xf32c('0x1b')](function(_0x395d01){return _0x395d01;});}return null;};}function removeEntity(_0x3a6aa7,_0x12a68f){return function(_0x6255ad){if(_0x6255ad){return _0x6255ad[_0xf32c('0x30')]()['then'](function(){var _0x34b3a7=_0x6255ad[_0xf32c('0x31')]({'plain':!![]});var _0x33c5fc=_0xf32c('0x32');return db[_0xf32c('0x33')][_0xf32c('0x30')]({'where':{'type':_0x33c5fc,'resourceId':_0x34b3a7['id']}})[_0xf32c('0x1b')](function(){return _0x6255ad;});})['then'](function(){_0x3a6aa7[_0xf32c('0x25')](0xcc)[_0xf32c('0x26')]();});}};}function handleEntityNotFound(_0x2e036e,_0x260b77){return function(_0x167026){if(!_0x167026){_0x2e036e[_0xf32c('0x24')](0x194);}return _0x167026;};}function handleError(_0x4356cd,_0x11d472){_0x11d472=_0x11d472||0x1f4;return function(_0x337b05){logger[_0xf32c('0x1e')](_0x337b05['stack']);if(_0x337b05[_0xf32c('0x34')]){delete _0x337b05[_0xf32c('0x34')];}_0x4356cd[_0xf32c('0x25')](_0x11d472)[_0xf32c('0x35')](_0x337b05);};}exports['index']=function(_0x361258,_0x3373cb){var _0x44bbb5={},_0x1c2d7f={},_0x4fed67={'count':0x0,'rows':[]};var _0x5951be=_[_0xf32c('0x36')](db[_0xf32c('0x37')][_0xf32c('0x38')],function(_0x263a9b){return{'name':_0x263a9b[_0xf32c('0x39')],'type':_0x263a9b[_0xf32c('0x3a')][_0xf32c('0x3b')]};});_0x1c2d7f['model']=_[_0xf32c('0x36')](_0x5951be,_0xf32c('0x34'));_0x1c2d7f[_0xf32c('0x3c')]=_['keys'](_0x361258[_0xf32c('0x3c')]);_0x1c2d7f[_0xf32c('0x3d')]=_[_0xf32c('0x3e')](_0x1c2d7f[_0xf32c('0x3f')],_0x1c2d7f[_0xf32c('0x3c')]);_0x44bbb5['attributes']=_['intersection'](_0x1c2d7f[_0xf32c('0x3f')],qs[_0xf32c('0x40')](_0x361258['query'][_0xf32c('0x40')]));_0x44bbb5[_0xf32c('0x41')]=_0x44bbb5['attributes'][_0xf32c('0x42')]?_0x44bbb5[_0xf32c('0x41')]:_0x1c2d7f[_0xf32c('0x3f')];if(!_0x361258[_0xf32c('0x3c')][_0xf32c('0x43')](_0xf32c('0x44'))){_0x44bbb5['limit']=qs['limit'](_0x361258[_0xf32c('0x3c')]['limit']);_0x44bbb5['offset']=qs['offset'](_0x361258[_0xf32c('0x3c')][_0xf32c('0x28')]);}_0x44bbb5[_0xf32c('0x45')]=qs[_0xf32c('0x46')](_0x361258[_0xf32c('0x3c')][_0xf32c('0x46')]);_0x44bbb5['where']=qs[_0xf32c('0x3d')](_[_0xf32c('0x47')](_0x361258[_0xf32c('0x3c')],_0x1c2d7f['filters']),_0x5951be);if(_0x361258[_0xf32c('0x3c')]['filter']){_0x44bbb5['where']=_[_0xf32c('0x48')](_0x44bbb5[_0xf32c('0x49')],{'$or':_['map'](_0x5951be,function(_0x5ba3fc){if(_0x5ba3fc['type']!==_0xf32c('0x4a')){var _0x4792fd={};_0x4792fd[_0x5ba3fc[_0xf32c('0x34')]]={'$like':'%'+_0x361258[_0xf32c('0x3c')]['filter']+'%'};return _0x4792fd;}})});}_0x44bbb5=_['merge']({},_0x44bbb5,_0x361258[_0xf32c('0x4b')]);var _0x202425={'where':_0x44bbb5[_0xf32c('0x49')]};return db['VoiceContext']['count'](_0x202425)[_0xf32c('0x1b')](function(_0x4fe55d){_0x4fed67[_0xf32c('0x2b')]=_0x4fe55d;if(_0x361258['query'][_0xf32c('0x4c')]){_0x44bbb5[_0xf32c('0x4d')]=[{'all':!![]}];}return db[_0xf32c('0x37')][_0xf32c('0x4e')](_0x44bbb5);})[_0xf32c('0x1b')](function(_0x33f54b){_0x4fed67[_0xf32c('0x4f')]=_0x33f54b;return _0x4fed67;})[_0xf32c('0x1b')](respondWithFilteredResult(_0x3373cb,_0x44bbb5))['catch'](handleError(_0x3373cb,null));};exports['show']=function(_0x267405,_0xe317){var _0x240e36={'raw':![],'where':{'id':_0x267405[_0xf32c('0x50')]['id']}},_0x3d2a0c={};_0x3d2a0c[_0xf32c('0x3f')]=_[_0xf32c('0x51')](db[_0xf32c('0x37')][_0xf32c('0x38')]);_0x3d2a0c[_0xf32c('0x3c')]=_[_0xf32c('0x51')](_0x267405[_0xf32c('0x3c')]);_0x3d2a0c['filters']=_[_0xf32c('0x3e')](_0x3d2a0c['model'],_0x3d2a0c[_0xf32c('0x3c')]);_0x240e36[_0xf32c('0x41')]=_[_0xf32c('0x3e')](_0x3d2a0c[_0xf32c('0x3f')],qs[_0xf32c('0x40')](_0x267405[_0xf32c('0x3c')][_0xf32c('0x40')]));_0x240e36[_0xf32c('0x41')]=_0x240e36[_0xf32c('0x41')][_0xf32c('0x42')]?_0x240e36['attributes']:_0x3d2a0c[_0xf32c('0x3f')];if(_0x267405[_0xf32c('0x3c')][_0xf32c('0x4c')]){_0x240e36['include']=[{'all':!![]}];}_0x240e36=_[_0xf32c('0x48')]({},_0x240e36,_0x267405[_0xf32c('0x4b')]);return db[_0xf32c('0x37')][_0xf32c('0x52')](_0x240e36)['then'](handleEntityNotFound(_0xe317,null))[_0xf32c('0x1b')](respondWithResult(_0xe317,null))[_0xf32c('0x23')](handleError(_0xe317,null));};exports['create']=function(_0x49954a,_0x53fec0,_0x15dc6f){var _0x497fd3;return db[_0xf32c('0x37')][_0xf32c('0x53')](_0x49954a[_0xf32c('0x54')],{'raw':!![]})[_0xf32c('0x1b')](function(_0x422a52){_0x497fd3=_0x422a52;return db[_0xf32c('0x37')][_0xf32c('0x4e')]({'raw':!![]});})[_0xf32c('0x1b')](function(_0x245b74){var _0x17290a=fs[_0xf32c('0x55')](path[_0xf32c('0x56')](config[_0xf32c('0x57')],_0xf32c('0x58')),_0xf32c('0x59'));var _0x39b678=ejs[_0xf32c('0x5a')](_0x17290a,{'contexts':_0x245b74||[]});fs[_0xf32c('0x5b')](_0xf32c('0x5c'),_0x39b678);})['then'](function(){return respondWithRpcPromise(_0xf32c('0x5d'),_0xf32c('0x53'),{'module':_0xf32c('0x5e')});})['then'](function(){var _0x10ce7c=_0x49954a[_0xf32c('0x5f')][_0xf32c('0x31')]({'plain':!![]});if(!_0x10ce7c)throw new Error(_0xf32c('0x60'));if(_0x10ce7c[_0xf32c('0x61')]===_0xf32c('0x5f')){var _0x2ea527=_0x497fd3[_0xf32c('0x31')]({'plain':!![]});return db['UserProfileSection'][_0xf32c('0x52')]({'where':{'name':_0xf32c('0x32'),'userProfileId':_0x10ce7c['userProfileId']},'raw':!![]})[_0xf32c('0x1b')](function(_0x3f6fd2){if(_0x3f6fd2&&_0x3f6fd2[_0xf32c('0x62')]===0x0){return db[_0xf32c('0x33')][_0xf32c('0x53')]({'name':_0x2ea527[_0xf32c('0x34')],'resourceId':_0x2ea527['id'],'type':_0x3f6fd2[_0xf32c('0x34')],'sectionId':_0x3f6fd2['id']},{})[_0xf32c('0x1b')](function(){return _0x497fd3;});}else{return _0x497fd3;}})[_0xf32c('0x23')](function(_0x123a76){logger['error'](_0xf32c('0x63'),_0x123a76);throw _0x123a76;});}return _0x497fd3;})[_0xf32c('0x1b')](respondWithResult(_0x53fec0,0xc9))[_0xf32c('0x23')](handleError(_0x53fec0,null));};exports[_0xf32c('0x2f')]=function(_0x2986f3,_0x5c1e0e,_0x46b524){var _0x32e469;return db[_0xf32c('0x37')]['find']({'where':{'id':_0x2986f3[_0xf32c('0x50')]['id']}})[_0xf32c('0x1b')](handleEntityNotFound(_0x5c1e0e,null))[_0xf32c('0x1b')](saveUpdates(_0x2986f3[_0xf32c('0x54')],null))['then'](function(_0x424b30){if(_0x424b30){_0x32e469=_0x424b30;return db[_0xf32c('0x37')][_0xf32c('0x4e')]({'raw':!![]});}})[_0xf32c('0x1b')](function(_0x4d1506){var _0x22f1ac=fs['readFileSync'](path[_0xf32c('0x56')](config[_0xf32c('0x57')],_0xf32c('0x58')),'utf8');var _0x329e9a=ejs[_0xf32c('0x5a')](_0x22f1ac,{'contexts':_0x4d1506||[]});fs['writeFileSync'](_0xf32c('0x5c'),_0x329e9a);})[_0xf32c('0x1b')](function(){return respondWithRpcPromise('Reload','update',{'module':_0xf32c('0x5e')});})[_0xf32c('0x1b')](function(){return _0x32e469;})['then'](respondWithResult(_0x5c1e0e,null))['catch'](handleError(_0x5c1e0e,null));};exports[_0xf32c('0x30')]=function(_0x15c25f,_0x2438b5,_0x16d04a){var _0x21d634;return db['VoiceContext']['find']({'where':{'id':_0x15c25f[_0xf32c('0x50')]['id']}})[_0xf32c('0x1b')](handleEntityNotFound(_0x2438b5,null))['then'](removeEntity(_0x2438b5,null))[_0xf32c('0x1b')](function(){return db[_0xf32c('0x37')][_0xf32c('0x4e')]({'raw':!![]});})[_0xf32c('0x1b')](function(_0x497441){var _0x583cfb=fs[_0xf32c('0x55')](path['join'](config[_0xf32c('0x57')],'server/files/templates/context.ejs'),_0xf32c('0x59'));var _0x39cfa5=ejs[_0xf32c('0x5a')](_0x583cfb,{'contexts':_0x497441});fs[_0xf32c('0x5b')](_0xf32c('0x5c'),_0x39cfa5);return respondWithRpcPromise(_0xf32c('0x5d'),_0xf32c('0x30'),{'module':_0xf32c('0x5e')});})[_0xf32c('0x23')](handleError(_0x2438b5,null));}; \ No newline at end of file +var _0x1466=['show','keys','find','create','readFileSync','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','params','body','root','render','chan_sip.so','join','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','Contexts','end','stack','name','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows'];(function(_0x4cf8d2,_0x4f7ef9){var _0x37a915=function(_0x3d1da4){while(--_0x3d1da4){_0x4cf8d2['push'](_0x4cf8d2['shift']());}};_0x37a915(++_0x4f7ef9);}(_0x1466,0x13d));var _0x6146=function(_0x2cb9d6,_0x184081){_0x2cb9d6=_0x2cb9d6-0x0;var _0x146510=_0x1466[_0x2cb9d6];return _0x146510;};'use strict';var emlformat=require(_0x6146('0x0'));var rimraf=require(_0x6146('0x1'));var zipdir=require(_0x6146('0x2'));var jsonpatch=require(_0x6146('0x3'));var rp=require(_0x6146('0x4'));var moment=require(_0x6146('0x5'));var BPromise=require(_0x6146('0x6'));var Mustache=require(_0x6146('0x7'));var util=require(_0x6146('0x8'));var path=require('path');var sox=require(_0x6146('0x9'));var csv=require(_0x6146('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6146('0xb'));var jsforce=require(_0x6146('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6146('0xa'));var querystring=require(_0x6146('0xd'));var Papa=require(_0x6146('0xe'));var Redis=require(_0x6146('0xf'));var authService=require(_0x6146('0x10'));var qs=require(_0x6146('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6146('0x12'));var logger=require(_0x6146('0x13'))(_0x6146('0x14'));var utils=require(_0x6146('0x15'));var config=require(_0x6146('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6146('0x17'))['db'];var jayson=require(_0x6146('0x18'));var client=jayson[_0x6146('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f2f88,_0x4d39f1,_0x1467fd,_0xdb652c){return new BPromise(function(_0x208fe6,_0x28a3c0){var _0x31b234=_0xdb652c||client;return _0x31b234['request'](_0x5f2f88,_0x1467fd)['then'](function(_0x108818){logger[_0x6146('0x1a')](_0x6146('0x1b'),_0x4d39f1,_0x6146('0x1c'));logger[_0x6146('0x1d')](_0x6146('0x1e'),_0x4d39f1,_0x6146('0x1c'),JSON['stringify'](_0x108818));if(_0x108818[_0x6146('0x1f')]){if(_0x108818[_0x6146('0x1f')]['code']===0x1f4){logger['error'](_0x6146('0x1b'),_0x4d39f1,_0x108818[_0x6146('0x1f')]['message']);return _0x28a3c0(_0x108818['error'][_0x6146('0x20')]);}logger[_0x6146('0x1f')](_0x6146('0x1b'),_0x4d39f1,_0x108818[_0x6146('0x1f')][_0x6146('0x20')]);return _0x208fe6(_0x108818[_0x6146('0x1f')][_0x6146('0x20')]);}else{logger[_0x6146('0x1a')]('VoiceContext,\x20%s,\x20%s',_0x4d39f1,_0x6146('0x1c'));_0x208fe6(_0x108818[_0x6146('0x21')][_0x6146('0x20')]);}})[_0x6146('0x22')](function(_0x3aee0b){logger[_0x6146('0x1f')](_0x6146('0x1b'),_0x4d39f1,_0x3aee0b);_0x28a3c0(_0x3aee0b);});});}function respondWithStatusCode(_0xd87e00,_0x178ce5){_0x178ce5=_0x178ce5||0xcc;return function(_0x15c152){if(_0x15c152){return _0xd87e00[_0x6146('0x23')](_0x178ce5);}return _0xd87e00['status'](_0x178ce5)['end']();};}function respondWithResult(_0xc54d14,_0x43643f){_0x43643f=_0x43643f||0xc8;return function(_0x1bc509){if(_0x1bc509){return _0xc54d14[_0x6146('0x24')](_0x43643f)[_0x6146('0x25')](_0x1bc509);}};}function respondWithFilteredResult(_0xa9392,_0x524d88){return function(_0x409fc2){if(_0x409fc2){var _0x227562=typeof _0x524d88[_0x6146('0x26')]===_0x6146('0x27')&&typeof _0x524d88[_0x6146('0x28')]===_0x6146('0x27');var _0x2e4b3e=_0x409fc2[_0x6146('0x29')];var _0x35cf19=_0x227562?0x0:_0x524d88[_0x6146('0x26')];var _0xa26dbe=_0x227562?_0x409fc2['count']:_0x524d88[_0x6146('0x26')]+_0x524d88[_0x6146('0x28')];var _0x5b9ffe;if(_0xa26dbe>=_0x2e4b3e){_0xa26dbe=_0x2e4b3e;_0x5b9ffe=0xc8;}else{_0x5b9ffe=0xce;}_0xa9392[_0x6146('0x24')](_0x5b9ffe);return _0xa9392[_0x6146('0x2a')]('Content-Range',_0x35cf19+'-'+_0xa26dbe+'/'+_0x2e4b3e)[_0x6146('0x25')](_0x409fc2);}return null;};}function patchUpdates(_0x30878b){return function(_0x3ac373){try{jsonpatch['apply'](_0x3ac373,_0x30878b,!![]);}catch(_0x8e5542){return BPromise[_0x6146('0x2b')](_0x8e5542);}return _0x3ac373[_0x6146('0x2c')]();};}function saveUpdates(_0x1d0471,_0x21fcad){return function(_0x3d4cf4){if(_0x3d4cf4){return _0x3d4cf4[_0x6146('0x2d')](_0x1d0471)[_0x6146('0x2e')](function(_0x268bf){return _0x268bf;});}return null;};}function removeEntity(_0x537b8b,_0x1b5d5c){return function(_0x2c517a){if(_0x2c517a){return _0x2c517a[_0x6146('0x2f')]()[_0x6146('0x2e')](function(){var _0x4281c4=_0x2c517a[_0x6146('0x30')]({'plain':!![]});var _0x3fcac6=_0x6146('0x31');return db['UserProfileResource']['destroy']({'where':{'type':_0x3fcac6,'resourceId':_0x4281c4['id']}})[_0x6146('0x2e')](function(){return _0x2c517a;});})[_0x6146('0x2e')](function(){_0x537b8b[_0x6146('0x24')](0xcc)[_0x6146('0x32')]();});}};}function handleEntityNotFound(_0x361060,_0x116c63){return function(_0x3a1e61){if(!_0x3a1e61){_0x361060['sendStatus'](0x194);}return _0x3a1e61;};}function handleError(_0x4e74ad,_0x503a26){_0x503a26=_0x503a26||0x1f4;return function(_0x56d794){logger[_0x6146('0x1f')](_0x56d794[_0x6146('0x33')]);if(_0x56d794['name']){delete _0x56d794[_0x6146('0x34')];}_0x4e74ad[_0x6146('0x24')](_0x503a26)['send'](_0x56d794);};}exports[_0x6146('0x35')]=function(_0x48d065,_0x4e6498){var _0x343453={},_0x21bf4c={},_0x48ec1d={'count':0x0,'rows':[]};var _0x3e64ba=_[_0x6146('0x36')](db[_0x6146('0x37')][_0x6146('0x38')],function(_0x69d9cd){return{'name':_0x69d9cd[_0x6146('0x39')],'type':_0x69d9cd[_0x6146('0x3a')][_0x6146('0x3b')]};});_0x21bf4c[_0x6146('0x3c')]=_[_0x6146('0x36')](_0x3e64ba,_0x6146('0x34'));_0x21bf4c[_0x6146('0x3d')]=_['keys'](_0x48d065[_0x6146('0x3d')]);_0x21bf4c[_0x6146('0x3e')]=_[_0x6146('0x3f')](_0x21bf4c[_0x6146('0x3c')],_0x21bf4c[_0x6146('0x3d')]);_0x343453[_0x6146('0x40')]=_[_0x6146('0x3f')](_0x21bf4c['model'],qs[_0x6146('0x41')](_0x48d065[_0x6146('0x3d')][_0x6146('0x41')]));_0x343453[_0x6146('0x40')]=_0x343453['attributes'][_0x6146('0x42')]?_0x343453['attributes']:_0x21bf4c[_0x6146('0x3c')];if(!_0x48d065[_0x6146('0x3d')]['hasOwnProperty'](_0x6146('0x43'))){_0x343453['limit']=qs[_0x6146('0x28')](_0x48d065[_0x6146('0x3d')][_0x6146('0x28')]);_0x343453[_0x6146('0x26')]=qs[_0x6146('0x26')](_0x48d065['query'][_0x6146('0x26')]);}_0x343453[_0x6146('0x44')]=qs[_0x6146('0x45')](_0x48d065[_0x6146('0x3d')][_0x6146('0x45')]);_0x343453['where']=qs[_0x6146('0x3e')](_['pick'](_0x48d065[_0x6146('0x3d')],_0x21bf4c[_0x6146('0x3e')]),_0x3e64ba);if(_0x48d065[_0x6146('0x3d')]['filter']){_0x343453[_0x6146('0x46')]=_['merge'](_0x343453[_0x6146('0x46')],{'$or':_['map'](_0x3e64ba,function(_0x29bba0){if(_0x29bba0[_0x6146('0x3a')]!==_0x6146('0x47')){var _0x2fc4a1={};_0x2fc4a1[_0x29bba0[_0x6146('0x34')]]={'$like':'%'+_0x48d065[_0x6146('0x3d')][_0x6146('0x48')]+'%'};return _0x2fc4a1;}})});}_0x343453=_[_0x6146('0x49')]({},_0x343453,_0x48d065[_0x6146('0x4a')]);var _0x132b45={'where':_0x343453[_0x6146('0x46')]};return db[_0x6146('0x37')][_0x6146('0x29')](_0x132b45)[_0x6146('0x2e')](function(_0x54d2ad){_0x48ec1d[_0x6146('0x29')]=_0x54d2ad;if(_0x48d065[_0x6146('0x3d')][_0x6146('0x4b')]){_0x343453[_0x6146('0x4c')]=[{'all':!![]}];}return db[_0x6146('0x37')][_0x6146('0x4d')](_0x343453);})[_0x6146('0x2e')](function(_0x4da510){_0x48ec1d[_0x6146('0x4e')]=_0x4da510;return _0x48ec1d;})[_0x6146('0x2e')](respondWithFilteredResult(_0x4e6498,_0x343453))[_0x6146('0x22')](handleError(_0x4e6498,null));};exports[_0x6146('0x4f')]=function(_0x1f1a91,_0x4c7892){var _0x3f690f={'raw':![],'where':{'id':_0x1f1a91['params']['id']}},_0x3a5b43={};_0x3a5b43[_0x6146('0x3c')]=_[_0x6146('0x50')](db['VoiceContext'][_0x6146('0x38')]);_0x3a5b43['query']=_[_0x6146('0x50')](_0x1f1a91[_0x6146('0x3d')]);_0x3a5b43['filters']=_[_0x6146('0x3f')](_0x3a5b43[_0x6146('0x3c')],_0x3a5b43[_0x6146('0x3d')]);_0x3f690f[_0x6146('0x40')]=_[_0x6146('0x3f')](_0x3a5b43[_0x6146('0x3c')],qs[_0x6146('0x41')](_0x1f1a91[_0x6146('0x3d')][_0x6146('0x41')]));_0x3f690f['attributes']=_0x3f690f[_0x6146('0x40')][_0x6146('0x42')]?_0x3f690f[_0x6146('0x40')]:_0x3a5b43[_0x6146('0x3c')];if(_0x1f1a91['query'][_0x6146('0x4b')]){_0x3f690f[_0x6146('0x4c')]=[{'all':!![]}];}_0x3f690f=_[_0x6146('0x49')]({},_0x3f690f,_0x1f1a91[_0x6146('0x4a')]);return db[_0x6146('0x37')][_0x6146('0x51')](_0x3f690f)[_0x6146('0x2e')](handleEntityNotFound(_0x4c7892,null))[_0x6146('0x2e')](respondWithResult(_0x4c7892,null))[_0x6146('0x22')](handleError(_0x4c7892,null));};exports[_0x6146('0x52')]=function(_0xaefeef,_0x39f285,_0x5673fc){var _0x3981aa;return db[_0x6146('0x37')][_0x6146('0x52')](_0xaefeef['body'],{'raw':!![]})['then'](function(_0xa06940){_0x3981aa=_0xa06940;return db['VoiceContext'][_0x6146('0x4d')]({'raw':!![]});})[_0x6146('0x2e')](function(_0x524514){var _0x32c70d=fs[_0x6146('0x53')](path['join'](config['root'],_0x6146('0x54')),_0x6146('0x55'));var _0x17b2b4=ejs['render'](_0x32c70d,{'contexts':_0x524514||[]});fs[_0x6146('0x56')](_0x6146('0x57'),_0x17b2b4);})[_0x6146('0x2e')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0x6146('0x2e')](function(){var _0x613979=_0xaefeef[_0x6146('0x58')]['get']({'plain':!![]});if(!_0x613979)throw new Error(_0x6146('0x59'));if(_0x613979['role']===_0x6146('0x58')){var _0xe8016a=_0x3981aa[_0x6146('0x30')]({'plain':!![]});return db['UserProfileSection'][_0x6146('0x51')]({'where':{'name':_0x6146('0x31'),'userProfileId':_0x613979[_0x6146('0x5a')]},'raw':!![]})[_0x6146('0x2e')](function(_0x35ab49){if(_0x35ab49&&_0x35ab49['autoAssociation']===0x0){return db[_0x6146('0x5b')][_0x6146('0x52')]({'name':_0xe8016a[_0x6146('0x34')],'resourceId':_0xe8016a['id'],'type':_0x35ab49[_0x6146('0x34')],'sectionId':_0x35ab49['id']},{})[_0x6146('0x2e')](function(){return _0x3981aa;});}else{return _0x3981aa;}})[_0x6146('0x22')](function(_0x104e59){logger[_0x6146('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x104e59);throw _0x104e59;});}return _0x3981aa;})['then'](respondWithResult(_0x39f285,0xc9))[_0x6146('0x22')](handleError(_0x39f285,null));};exports['update']=function(_0x560f97,_0x5a6a8f,_0xbe8948){var _0x5ae939;return db[_0x6146('0x37')][_0x6146('0x51')]({'where':{'id':_0x560f97[_0x6146('0x5c')]['id']}})[_0x6146('0x2e')](handleEntityNotFound(_0x5a6a8f,null))['then'](saveUpdates(_0x560f97[_0x6146('0x5d')],null))[_0x6146('0x2e')](function(_0x56c8a4){if(_0x56c8a4){_0x5ae939=_0x56c8a4;return db[_0x6146('0x37')][_0x6146('0x4d')]({'raw':!![]});}})[_0x6146('0x2e')](function(_0x130160){var _0x11f318=fs[_0x6146('0x53')](path['join'](config[_0x6146('0x5e')],_0x6146('0x54')),'utf8');var _0x1cca62=ejs[_0x6146('0x5f')](_0x11f318,{'contexts':_0x130160||[]});fs[_0x6146('0x56')](_0x6146('0x57'),_0x1cca62);})[_0x6146('0x2e')](function(){return respondWithRpcPromise('Reload',_0x6146('0x2d'),{'module':_0x6146('0x60')});})[_0x6146('0x2e')](function(){return _0x5ae939;})[_0x6146('0x2e')](respondWithResult(_0x5a6a8f,null))['catch'](handleError(_0x5a6a8f,null));};exports[_0x6146('0x2f')]=function(_0x70268b,_0x246ec2,_0x21eabe){var _0x4c70b0;return db['VoiceContext'][_0x6146('0x51')]({'where':{'id':_0x70268b[_0x6146('0x5c')]['id']}})['then'](handleEntityNotFound(_0x246ec2,null))[_0x6146('0x2e')](removeEntity(_0x246ec2,null))[_0x6146('0x2e')](function(){return db[_0x6146('0x37')]['findAll']({'raw':!![]});})[_0x6146('0x2e')](function(_0x5c60f1){var _0x2d27c3=fs[_0x6146('0x53')](path[_0x6146('0x61')](config[_0x6146('0x5e')],'server/files/templates/context.ejs'),'utf8');var _0xf539da=ejs['render'](_0x2d27c3,{'contexts':_0x5c60f1});fs[_0x6146('0x56')](_0x6146('0x57'),_0xf539da);return respondWithRpcPromise(_0x6146('0x62'),_0x6146('0x2f'),{'module':'chan_sip.so'});})['catch'](handleError(_0x246ec2,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index f4f842a..a822653 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 _0x8ff4=['api','moment','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ff4,0x11f));var _0x48ff=function(_0xc7b656,_0x3983fc){_0xc7b656=_0xc7b656-0x0;var _0x45479e=_0x8ff4[_0xc7b656];return _0x45479e;};'use strict';var _=require(_0x48ff('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x48ff('0x1'));var moment=require(_0x48ff('0x2'));var BPromise=require('bluebird');var rp=require(_0x48ff('0x3'));var fs=require('fs');var path=require(_0x48ff('0x4'));var rimraf=require(_0x48ff('0x5'));var config=require(_0x48ff('0x6'));var attributes=require(_0x48ff('0x7'));module[_0x48ff('0x8')]=function(_0x2909ca,_0x61d3b9){return _0x2909ca[_0x48ff('0x9')](_0x48ff('0xa'),attributes,{'tableName':_0x48ff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e27=['request-promise','path','rimraf','./voiceContext.attributes','exports','define','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x32a857,_0x53d388){var _0xcf0b73=function(_0x4d7d8b){while(--_0x4d7d8b){_0x32a857['push'](_0x32a857['shift']());}};_0xcf0b73(++_0x53d388);}(_0x4e27,0x180));var _0x74e2=function(_0x31e2d2,_0x369dc3){_0x31e2d2=_0x31e2d2-0x0;var _0x1e5f06=_0x4e27[_0x31e2d2];return _0x1e5f06;};'use strict';var _=require(_0x74e2('0x0'));var util=require(_0x74e2('0x1'));var logger=require(_0x74e2('0x2'))(_0x74e2('0x3'));var moment=require(_0x74e2('0x4'));var BPromise=require(_0x74e2('0x5'));var rp=require(_0x74e2('0x6'));var fs=require('fs');var path=require(_0x74e2('0x7'));var rimraf=require(_0x74e2('0x8'));var config=require('../../config/environment');var attributes=require(_0x74e2('0x9'));module[_0x74e2('0xa')]=function(_0x3dad79,_0x22879b){return _0x3dad79[_0x74e2('0xb')]('VoiceContext',attributes,{'tableName':_0x74e2('0xc'),'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 9ebf98c..be244ba 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 _0xf485=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','catch','lodash'];(function(_0x28ae53,_0x874818){var _0x360ced=function(_0x1c977c){while(--_0x1c977c){_0x28ae53['push'](_0x28ae53['shift']());}};_0x360ced(++_0x874818);}(_0xf485,0xd1));var _0x5f48=function(_0x2a07d5,_0x798402){_0x2a07d5=_0x2a07d5-0x0;var _0x59ad39=_0xf485[_0x2a07d5];return _0x59ad39;};'use strict';var _=require(_0x5f48('0x0'));var util=require(_0x5f48('0x1'));var moment=require(_0x5f48('0x2'));var BPromise=require(_0x5f48('0x3'));var rs=require(_0x5f48('0x4'));var fs=require('fs');var Redis=require(_0x5f48('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f48('0x6'));var logger=require(_0x5f48('0x7'))('rpc');var config=require(_0x5f48('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5f48('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb2021,_0x126cb7,_0x3c6f45){return new BPromise(function(_0x5866e5,_0x3fb7e5){return client[_0x5f48('0xa')](_0xb2021,_0x3c6f45)[_0x5f48('0xb')](function(_0x5019de){logger[_0x5f48('0xc')](_0x5f48('0xd'),_0x126cb7,_0x5f48('0xe'));logger[_0x5f48('0xf')](_0x5f48('0x10'),_0x126cb7,'request\x20sent',JSON[_0x5f48('0x11')](_0x5019de));if(_0x5019de[_0x5f48('0x12')]){if(_0x5019de[_0x5f48('0x12')][_0x5f48('0x13')]===0x1f4){logger[_0x5f48('0x12')](_0x5f48('0xd'),_0x126cb7,_0x5019de[_0x5f48('0x12')]['message']);return _0x3fb7e5(_0x5019de['error']['message']);}logger[_0x5f48('0x12')](_0x5f48('0xd'),_0x126cb7,_0x5019de['error']['message']);return _0x5866e5(_0x5019de[_0x5f48('0x12')]['message']);}else{logger[_0x5f48('0xc')]('VoiceContext,\x20%s,\x20%s',_0x126cb7,'request\x20sent');_0x5866e5(_0x5019de['result']['message']);}})[_0x5f48('0x14')](function(_0x58d606){logger[_0x5f48('0x12')]('VoiceContext,\x20%s,\x20%s',_0x126cb7,_0x58d606);_0x3fb7e5(_0x58d606);});});} \ No newline at end of file +var _0xe1e3=['message','info','result','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s'];(function(_0x356a67,_0x188fb6){var _0x470848=function(_0x384f72){while(--_0x384f72){_0x356a67['push'](_0x356a67['shift']());}};_0x470848(++_0x188fb6);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x467c1a,_0x10fca0){_0x467c1a=_0x467c1a-0x0;var _0x127df4=_0xe1e3[_0x467c1a];return _0x127df4;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var moment=require('moment');var BPromise=require(_0x3e1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e1e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e1e('0x4'))(_0x3e1e('0x5'));var config=require(_0x3e1e('0x6'));var jayson=require(_0x3e1e('0x7'));var client=jayson[_0x3e1e('0x8')][_0x3e1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55cfba,_0x1574e5,_0x13926d){return new BPromise(function(_0x2f0e12,_0xa67e35){return client[_0x3e1e('0xa')](_0x55cfba,_0x13926d)[_0x3e1e('0xb')](function(_0x5e7d1f){logger['info']('VoiceContext,\x20%s,\x20%s',_0x1574e5,_0x3e1e('0xc'));logger['debug'](_0x3e1e('0xd'),_0x1574e5,_0x3e1e('0xc'),JSON[_0x3e1e('0xe')](_0x5e7d1f));if(_0x5e7d1f['error']){if(_0x5e7d1f[_0x3e1e('0xf')]['code']===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x1574e5,_0x5e7d1f['error']['message']);return _0xa67e35(_0x5e7d1f[_0x3e1e('0xf')]['message']);}logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x5e7d1f[_0x3e1e('0xf')][_0x3e1e('0x11')]);return _0x2f0e12(_0x5e7d1f['error']['message']);}else{logger[_0x3e1e('0x12')](_0x3e1e('0x10'),_0x1574e5,'request\x20sent');_0x2f0e12(_0x5e7d1f[_0x3e1e('0x13')][_0x3e1e('0x11')]);}})['catch'](function(_0x11c07f){logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x11c07f);_0xa67e35(_0x11c07f);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 20e02b7..f96684d 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 _0x8b69=['/:id','post','create','update','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x8b69,0x145));var _0x98b6=function(_0x24d747,_0x290acd){_0x24d747=_0x24d747-0x0;var _0x433804=_0x8b69[_0x24d747];return _0x433804;};'use strict';var multer=require(_0x98b6('0x0'));var util=require('util');var path=require(_0x98b6('0x1'));var timeout=require(_0x98b6('0x2'));var express=require('express');var router=express[_0x98b6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x98b6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x98b6('0x5'));var controller=require('./voiceDialReport.controller');router[_0x98b6('0x6')]('/',auth[_0x98b6('0x7')](),controller[_0x98b6('0x8')]);router[_0x98b6('0x6')](_0x98b6('0x9'),auth['isAuthenticated'](),controller[_0x98b6('0xa')]);router[_0x98b6('0x6')](_0x98b6('0xb'),auth[_0x98b6('0x7')](),controller['show']);router[_0x98b6('0xc')]('/',auth['isAuthenticated'](),controller[_0x98b6('0xd')]);router['put']('/:id',auth[_0x98b6('0x7')](),controller[_0x98b6('0xe')]);router['delete'](_0x98b6('0xb'),auth[_0x98b6('0x7')](),controller[_0x98b6('0xf')]);module['exports']=router; \ No newline at end of file +var _0x491d=['create','put','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x434ddc,_0x1f9e59){var _0x283bf5=function(_0x5df633){while(--_0x5df633){_0x434ddc['push'](_0x434ddc['shift']());}};_0x283bf5(++_0x1f9e59);}(_0x491d,0x1be));var _0xd491=function(_0x248a69,_0x49b08e){_0x248a69=_0x248a69-0x0;var _0x48a234=_0x491d[_0x248a69];return _0x48a234;};'use strict';var multer=require(_0xd491('0x0'));var util=require(_0xd491('0x1'));var path=require('path');var timeout=require(_0xd491('0x2'));var express=require('express');var router=express[_0xd491('0x3')]();var fs_extra=require(_0xd491('0x4'));var auth=require(_0xd491('0x5'));var interaction=require(_0xd491('0x6'));var config=require(_0xd491('0x7'));var controller=require(_0xd491('0x8'));router[_0xd491('0x9')]('/',auth[_0xd491('0xa')](),controller[_0xd491('0xb')]);router[_0xd491('0x9')](_0xd491('0xc'),auth[_0xd491('0xa')](),controller[_0xd491('0xd')]);router['get'](_0xd491('0xe'),auth[_0xd491('0xa')](),controller['show']);router[_0xd491('0xf')]('/',auth[_0xd491('0xa')](),controller[_0xd491('0x10')]);router[_0xd491('0x11')](_0xd491('0xe'),auth[_0xd491('0xa')](),controller[_0xd491('0x12')]);router[_0xd491('0x13')](_0xd491('0xe'),auth[_0xd491('0xa')](),controller[_0xd491('0x14')]);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 dc07e57..e5884f4 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 _0x98a8=['sequelize','exports','STRING','INTEGER','DATE'];(function(_0x3a5d69,_0x1e2796){var _0x281f97=function(_0x2a2dd7){while(--_0x2a2dd7){_0x3a5d69['push'](_0x3a5d69['shift']());}};_0x281f97(++_0x1e2796);}(_0x98a8,0x12c));var _0x898a=function(_0x44cecf,_0x25b016){_0x44cecf=_0x44cecf-0x0;var _0x3f900a=_0x98a8[_0x44cecf];return _0x3f900a;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'privilege':{'type':Sequelize[_0x898a('0x2')]},'channel':{'type':Sequelize[_0x898a('0x2')]},'channelstate':{'type':Sequelize[_0x898a('0x3')]},'channelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'calleridnum':{'type':Sequelize[_0x898a('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'connectedlinename':{'type':Sequelize[_0x898a('0x2')]},'language':{'type':Sequelize[_0x898a('0x2')]},'accountcode':{'type':Sequelize[_0x898a('0x2')]},'context':{'type':Sequelize[_0x898a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x898a('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x898a('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x898a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x898a('0x2')]},'destcalleridname':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x898a('0x2')]},'destlanguage':{'type':Sequelize[_0x898a('0x2')]},'destaccountcode':{'type':Sequelize[_0x898a('0x2')]},'destcontext':{'type':Sequelize[_0x898a('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x898a('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x898a('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x898a('0x2')]},'starttime':{'type':Sequelize[_0x898a('0x4')]},'answertime':{'type':Sequelize[_0x898a('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x898a('0x3')]},'duration':{'type':Sequelize[_0x898a('0x3')]},'holdtime':{'type':Sequelize[_0x898a('0x3')]},'billableseconds':{'type':Sequelize[_0x898a('0x3')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x145576,_0x529e3c){var _0x1aa816=function(_0xce26a5){while(--_0xce26a5){_0x145576['push'](_0x145576['shift']());}};_0x1aa816(++_0x529e3c);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x40f991,_0x576819){_0x40f991=_0x40f991-0x0;var _0x38eca2=_0xf3cd[_0x40f991];return _0x38eca2;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'privilege':{'type':Sequelize[_0xdf3c('0x2')]},'channel':{'type':Sequelize[_0xdf3c('0x2')]},'channelstate':{'type':Sequelize[_0xdf3c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xdf3c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinename':{'type':Sequelize[_0xdf3c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xdf3c('0x2')]},'context':{'type':Sequelize[_0xdf3c('0x2')]},'exten':{'type':Sequelize[_0xdf3c('0x2')]},'priority':{'type':Sequelize[_0xdf3c('0x3')]},'uniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'linkedid':{'type':Sequelize[_0xdf3c('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xdf3c('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xdf3c('0x2')]},'destaccountcode':{'type':Sequelize[_0xdf3c('0x2')]},'destcontext':{'type':Sequelize[_0xdf3c('0x2')]},'destexten':{'type':Sequelize[_0xdf3c('0x2')]},'destpriority':{'type':Sequelize[_0xdf3c('0x3')]},'destuniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'destlinkedid':{'type':Sequelize[_0xdf3c('0x2')]},'dialstring':{'type':Sequelize[_0xdf3c('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdf3c('0x4')]},'answertime':{'type':Sequelize[_0xdf3c('0x4')]},'endtime':{'type':Sequelize[_0xdf3c('0x4')]},'lastevent':{'type':Sequelize[_0xdf3c('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xdf3c('0x3')]},'duration':{'type':Sequelize[_0xdf3c('0x3')]},'holdtime':{'type':Sequelize[_0xdf3c('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index e73faa1..0688841 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 _0x9088=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','error','stack','send','index','VoiceDialReport','fieldName','key','map','name','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','destroy'];(function(_0x25a233,_0x1402dd){var _0x48ed17=function(_0x1f5c0b){while(--_0x1f5c0b){_0x25a233['push'](_0x25a233['shift']());}};_0x48ed17(++_0x1402dd);}(_0x9088,0x149));var _0x8908=function(_0x2b8c91,_0x119aa4){_0x2b8c91=_0x2b8c91-0x0;var _0x56d48d=_0x9088[_0x2b8c91];return _0x56d48d;};'use strict';var emlformat=require(_0x8908('0x0'));var rimraf=require(_0x8908('0x1'));var zipdir=require(_0x8908('0x2'));var jsonpatch=require(_0x8908('0x3'));var rp=require(_0x8908('0x4'));var moment=require(_0x8908('0x5'));var BPromise=require(_0x8908('0x6'));var Mustache=require('mustache');var util=require(_0x8908('0x7'));var path=require('path');var sox=require(_0x8908('0x8'));var csv=require(_0x8908('0x9'));var ejs=require(_0x8908('0xa'));var fs=require('fs');var fs_extra=require(_0x8908('0xb'));var _=require(_0x8908('0xc'));var squel=require(_0x8908('0xd'));var crypto=require(_0x8908('0xe'));var jsforce=require(_0x8908('0xf'));var deskjs=require(_0x8908('0x10'));var toCsv=require(_0x8908('0x9'));var querystring=require(_0x8908('0x11'));var Papa=require(_0x8908('0x12'));var Redis=require(_0x8908('0x13'));var authService=require(_0x8908('0x14'));var qs=require(_0x8908('0x15'));var as=require(_0x8908('0x16'));var hardwareService=require(_0x8908('0x17'));var logger=require('../../config/logger')(_0x8908('0x18'));var utils=require(_0x8908('0x19'));var config=require(_0x8908('0x1a'));var licenseUtil=require(_0x8908('0x1b'));var db=require(_0x8908('0x1c'))['db'];function respondWithStatusCode(_0x2550c8,_0x3d55eb){_0x3d55eb=_0x3d55eb||0xcc;return function(_0xe0dde8){if(_0xe0dde8){return _0x2550c8[_0x8908('0x1d')](_0x3d55eb);}return _0x2550c8[_0x8908('0x1e')](_0x3d55eb)[_0x8908('0x1f')]();};}function respondWithResult(_0x48e855,_0x433cc1){_0x433cc1=_0x433cc1||0xc8;return function(_0x31e25d){if(_0x31e25d){return _0x48e855[_0x8908('0x1e')](_0x433cc1)[_0x8908('0x20')](_0x31e25d);}};}function respondWithFilteredResult(_0x309606,_0x4f812c){return function(_0x435e6c){if(_0x435e6c){var _0x5241c6=typeof _0x4f812c[_0x8908('0x21')]===_0x8908('0x22')&&typeof _0x4f812c[_0x8908('0x23')]===_0x8908('0x22');var _0xddcfd3=_0x435e6c['count'];var _0x215b80=_0x5241c6?0x0:_0x4f812c['offset'];var _0x4643f0=_0x5241c6?_0x435e6c[_0x8908('0x24')]:_0x4f812c[_0x8908('0x21')]+_0x4f812c['limit'];var _0x54cc5a;if(_0x4643f0>=_0xddcfd3){_0x4643f0=_0xddcfd3;_0x54cc5a=0xc8;}else{_0x54cc5a=0xce;}_0x309606[_0x8908('0x1e')](_0x54cc5a);return _0x309606['set'](_0x8908('0x25'),_0x215b80+'-'+_0x4643f0+'/'+_0xddcfd3)[_0x8908('0x20')](_0x435e6c);}return null;};}function patchUpdates(_0x3ac198){return function(_0x42b785){try{jsonpatch[_0x8908('0x26')](_0x42b785,_0x3ac198,!![]);}catch(_0x5111e8){return BPromise['reject'](_0x5111e8);}return _0x42b785[_0x8908('0x27')]();};}function saveUpdates(_0xa5b47b,_0x4fd6bf){return function(_0x38fdfe){if(_0x38fdfe){return _0x38fdfe[_0x8908('0x28')](_0xa5b47b)['then'](function(_0x3f4107){return _0x3f4107;});}return null;};}function removeEntity(_0x3bcf9d,_0x1e4771){return function(_0x503907){if(_0x503907){return _0x503907['destroy']()[_0x8908('0x29')](function(){_0x3bcf9d[_0x8908('0x1e')](0xcc)[_0x8908('0x1f')]();});}};}function handleEntityNotFound(_0x19f1cb,_0xea1201){return function(_0x1c1ebf){if(!_0x1c1ebf){_0x19f1cb['sendStatus'](0x194);}return _0x1c1ebf;};}function handleError(_0x64249,_0x10cad4){_0x10cad4=_0x10cad4||0x1f4;return function(_0xa62948){logger[_0x8908('0x2a')](_0xa62948[_0x8908('0x2b')]);if(_0xa62948['name']){delete _0xa62948['name'];}_0x64249[_0x8908('0x1e')](_0x10cad4)[_0x8908('0x2c')](_0xa62948);};}exports[_0x8908('0x2d')]=function(_0x330b3c,_0x55547f){var _0xce55c1={},_0x55c3bd={},_0x460400={'count':0x0,'rows':[]};var _0x264b1d=_['map'](db[_0x8908('0x2e')]['rawAttributes'],function(_0x446844){return{'name':_0x446844[_0x8908('0x2f')],'type':_0x446844['type'][_0x8908('0x30')]};});_0x55c3bd['model']=_[_0x8908('0x31')](_0x264b1d,_0x8908('0x32'));_0x55c3bd['query']=_[_0x8908('0x33')](_0x330b3c[_0x8908('0x34')]);_0x55c3bd['filters']=_[_0x8908('0x35')](_0x55c3bd[_0x8908('0x36')],_0x55c3bd[_0x8908('0x34')]);_0xce55c1[_0x8908('0x37')]=_[_0x8908('0x35')](_0x55c3bd[_0x8908('0x36')],qs[_0x8908('0x38')](_0x330b3c[_0x8908('0x34')][_0x8908('0x38')]));_0xce55c1[_0x8908('0x37')]=_0xce55c1['attributes'][_0x8908('0x39')]?_0xce55c1[_0x8908('0x37')]:_0x55c3bd[_0x8908('0x36')];if(!_0x330b3c[_0x8908('0x34')][_0x8908('0x3a')](_0x8908('0x3b'))){_0xce55c1[_0x8908('0x23')]=qs[_0x8908('0x23')](_0x330b3c[_0x8908('0x34')]['limit']);_0xce55c1['offset']=qs[_0x8908('0x21')](_0x330b3c[_0x8908('0x34')][_0x8908('0x21')]);}_0xce55c1[_0x8908('0x3c')]=qs[_0x8908('0x3d')](_0x330b3c[_0x8908('0x34')]['sort']);_0xce55c1[_0x8908('0x3e')]=qs[_0x8908('0x3f')](_['pick'](_0x330b3c['query'],_0x55c3bd[_0x8908('0x3f')]),_0x264b1d);if(_0x330b3c[_0x8908('0x34')][_0x8908('0x40')]){_0xce55c1[_0x8908('0x3e')]=_[_0x8908('0x41')](_0xce55c1[_0x8908('0x3e')],{'$or':_[_0x8908('0x31')](_0x264b1d,function(_0x5a3b5b){if(_0x5a3b5b[_0x8908('0x42')]!==_0x8908('0x43')){var _0x1d44af={};_0x1d44af[_0x5a3b5b[_0x8908('0x32')]]={'$like':'%'+_0x330b3c['query'][_0x8908('0x40')]+'%'};return _0x1d44af;}})});}_0xce55c1=_['merge']({},_0xce55c1,_0x330b3c[_0x8908('0x44')]);var _0x424833={'where':_0xce55c1['where']};return db[_0x8908('0x2e')]['count'](_0x424833)[_0x8908('0x29')](function(_0x5f2237){_0x460400['count']=_0x5f2237;if(_0x330b3c[_0x8908('0x34')][_0x8908('0x45')]){_0xce55c1[_0x8908('0x46')]=[{'all':!![]}];}return db[_0x8908('0x2e')][_0x8908('0x47')](_0xce55c1);})[_0x8908('0x29')](function(_0x32ce33){_0x460400[_0x8908('0x48')]=_0x32ce33;return _0x460400;})[_0x8908('0x29')](respondWithFilteredResult(_0x55547f,_0xce55c1))[_0x8908('0x49')](handleError(_0x55547f,null));};exports[_0x8908('0x4a')]=function(_0x3e69d7,_0x134117){var _0xfd8faf={'raw':!![],'where':{'id':_0x3e69d7['params']['id']}},_0x13492f={};_0x13492f[_0x8908('0x36')]=_[_0x8908('0x33')](db['VoiceDialReport'][_0x8908('0x4b')]);_0x13492f[_0x8908('0x34')]=_[_0x8908('0x33')](_0x3e69d7[_0x8908('0x34')]);_0x13492f['filters']=_[_0x8908('0x35')](_0x13492f['model'],_0x13492f[_0x8908('0x34')]);_0xfd8faf['attributes']=_[_0x8908('0x35')](_0x13492f['model'],qs['fields'](_0x3e69d7[_0x8908('0x34')][_0x8908('0x38')]));_0xfd8faf[_0x8908('0x37')]=_0xfd8faf[_0x8908('0x37')]['length']?_0xfd8faf['attributes']:_0x13492f[_0x8908('0x36')];if(_0x3e69d7[_0x8908('0x34')][_0x8908('0x45')]){_0xfd8faf[_0x8908('0x46')]=[{'all':!![]}];}_0xfd8faf=_[_0x8908('0x41')]({},_0xfd8faf,_0x3e69d7[_0x8908('0x44')]);return db[_0x8908('0x2e')][_0x8908('0x4c')](_0xfd8faf)[_0x8908('0x29')](handleEntityNotFound(_0x134117,null))['then'](respondWithResult(_0x134117,null))['catch'](handleError(_0x134117,null));};exports[_0x8908('0x4d')]=function(_0x1b190d,_0x24e0a3){return db[_0x8908('0x2e')][_0x8908('0x4d')](_0x1b190d['body'],{})[_0x8908('0x29')](respondWithResult(_0x24e0a3,0xc9))[_0x8908('0x49')](handleError(_0x24e0a3,null));};exports[_0x8908('0x28')]=function(_0x2b4e56,_0x25875a){if(_0x2b4e56[_0x8908('0x4e')]['id']){delete _0x2b4e56[_0x8908('0x4e')]['id'];}return db[_0x8908('0x2e')][_0x8908('0x4c')]({'where':{'id':_0x2b4e56[_0x8908('0x4f')]['id']}})[_0x8908('0x29')](handleEntityNotFound(_0x25875a,null))[_0x8908('0x29')](saveUpdates(_0x2b4e56[_0x8908('0x4e')],null))[_0x8908('0x29')](respondWithResult(_0x25875a,null))[_0x8908('0x49')](handleError(_0x25875a,null));};exports[_0x8908('0x50')]=function(_0x149b05,_0xd1ba8f){return db[_0x8908('0x2e')][_0x8908('0x4c')]({'where':{'id':_0x149b05[_0x8908('0x4f')]['id']}})['then'](handleEntityNotFound(_0xd1ba8f,null))[_0x8908('0x29')](removeEntity(_0xd1ba8f,null))[_0x8908('0x49')](handleError(_0xd1ba8f,null));};exports[_0x8908('0x51')]=function(_0x4a3d19,_0xf4a719){return db[_0x8908('0x2e')][_0x8908('0x51')]()[_0x8908('0x29')](respondWithResult(_0xf4a719,null))[_0x8908('0x49')](handleError(_0xf4a719,null));}; \ No newline at end of file +var _0xb64e=['include','findAll','rows','show','params','fields','includeAll','merge','find','catch','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','then','destroy','error','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','options'];(function(_0x109c40,_0x3463fa){var _0x3d5aed=function(_0x236b3f){while(--_0x236b3f){_0x109c40['push'](_0x109c40['shift']());}};_0x3d5aed(++_0x3463fa);}(_0xb64e,0x136));var _0xeb64=function(_0x594270,_0x4cd957){_0x594270=_0x594270-0x0;var _0x3fbc59=_0xb64e[_0x594270];return _0x3fbc59;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb64('0x0'));var zipdir=require(_0xeb64('0x1'));var jsonpatch=require(_0xeb64('0x2'));var rp=require(_0xeb64('0x3'));var moment=require(_0xeb64('0x4'));var BPromise=require(_0xeb64('0x5'));var Mustache=require('mustache');var util=require(_0xeb64('0x6'));var path=require(_0xeb64('0x7'));var sox=require(_0xeb64('0x8'));var csv=require('to-csv');var ejs=require(_0xeb64('0x9'));var fs=require('fs');var fs_extra=require(_0xeb64('0xa'));var _=require(_0xeb64('0xb'));var squel=require(_0xeb64('0xc'));var crypto=require(_0xeb64('0xd'));var jsforce=require(_0xeb64('0xe'));var deskjs=require(_0xeb64('0xf'));var toCsv=require('to-csv');var querystring=require(_0xeb64('0x10'));var Papa=require(_0xeb64('0x11'));var Redis=require('ioredis');var authService=require(_0xeb64('0x12'));var qs=require(_0xeb64('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb64('0x14'));var logger=require('../../config/logger')(_0xeb64('0x15'));var utils=require(_0xeb64('0x16'));var config=require(_0xeb64('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xeb64('0x18'))['db'];function respondWithStatusCode(_0x26a7b5,_0x36fa45){_0x36fa45=_0x36fa45||0xcc;return function(_0x165ec3){if(_0x165ec3){return _0x26a7b5[_0xeb64('0x19')](_0x36fa45);}return _0x26a7b5[_0xeb64('0x1a')](_0x36fa45)[_0xeb64('0x1b')]();};}function respondWithResult(_0x1a9206,_0x40d14a){_0x40d14a=_0x40d14a||0xc8;return function(_0x5e8258){if(_0x5e8258){return _0x1a9206[_0xeb64('0x1a')](_0x40d14a)[_0xeb64('0x1c')](_0x5e8258);}};}function respondWithFilteredResult(_0x19c963,_0x1bcfa3){return function(_0x6782c6){if(_0x6782c6){var _0x9a43b5=typeof _0x1bcfa3['offset']===_0xeb64('0x1d')&&typeof _0x1bcfa3[_0xeb64('0x1e')]==='undefined';var _0x37b34b=_0x6782c6['count'];var _0x46c9a2=_0x9a43b5?0x0:_0x1bcfa3[_0xeb64('0x1f')];var _0x1ab3d3=_0x9a43b5?_0x6782c6[_0xeb64('0x20')]:_0x1bcfa3['offset']+_0x1bcfa3[_0xeb64('0x1e')];var _0x4be18f;if(_0x1ab3d3>=_0x37b34b){_0x1ab3d3=_0x37b34b;_0x4be18f=0xc8;}else{_0x4be18f=0xce;}_0x19c963[_0xeb64('0x1a')](_0x4be18f);return _0x19c963[_0xeb64('0x21')]('Content-Range',_0x46c9a2+'-'+_0x1ab3d3+'/'+_0x37b34b)[_0xeb64('0x1c')](_0x6782c6);}return null;};}function patchUpdates(_0x2921b8){return function(_0x1364e5){try{jsonpatch[_0xeb64('0x22')](_0x1364e5,_0x2921b8,!![]);}catch(_0x5680cc){return BPromise[_0xeb64('0x23')](_0x5680cc);}return _0x1364e5['save']();};}function saveUpdates(_0x410df9,_0x32ec98){return function(_0x2e620d){if(_0x2e620d){return _0x2e620d['update'](_0x410df9)[_0xeb64('0x24')](function(_0x34c20d){return _0x34c20d;});}return null;};}function removeEntity(_0x21e1fe,_0x39cb51){return function(_0x5ec594){if(_0x5ec594){return _0x5ec594[_0xeb64('0x25')]()['then'](function(){_0x21e1fe[_0xeb64('0x1a')](0xcc)[_0xeb64('0x1b')]();});}};}function handleEntityNotFound(_0x23b174,_0x4eeba8){return function(_0xcb9b0c){if(!_0xcb9b0c){_0x23b174['sendStatus'](0x194);}return _0xcb9b0c;};}function handleError(_0x1c3c06,_0x11a3ef){_0x11a3ef=_0x11a3ef||0x1f4;return function(_0x127daf){logger[_0xeb64('0x26')](_0x127daf['stack']);if(_0x127daf[_0xeb64('0x27')]){delete _0x127daf[_0xeb64('0x27')];}_0x1c3c06[_0xeb64('0x1a')](_0x11a3ef)['send'](_0x127daf);};}exports[_0xeb64('0x28')]=function(_0x2d6b8a,_0x1f96a9){var _0x429379={},_0x1880e0={},_0x549477={'count':0x0,'rows':[]};var _0x541a3d=_[_0xeb64('0x29')](db[_0xeb64('0x2a')][_0xeb64('0x2b')],function(_0x4a1c68){return{'name':_0x4a1c68[_0xeb64('0x2c')],'type':_0x4a1c68[_0xeb64('0x2d')]['key']};});_0x1880e0[_0xeb64('0x2e')]=_['map'](_0x541a3d,_0xeb64('0x27'));_0x1880e0[_0xeb64('0x2f')]=_[_0xeb64('0x30')](_0x2d6b8a['query']);_0x1880e0[_0xeb64('0x31')]=_['intersection'](_0x1880e0[_0xeb64('0x2e')],_0x1880e0[_0xeb64('0x2f')]);_0x429379['attributes']=_[_0xeb64('0x32')](_0x1880e0[_0xeb64('0x2e')],qs['fields'](_0x2d6b8a[_0xeb64('0x2f')]['fields']));_0x429379[_0xeb64('0x33')]=_0x429379[_0xeb64('0x33')][_0xeb64('0x34')]?_0x429379[_0xeb64('0x33')]:_0x1880e0[_0xeb64('0x2e')];if(!_0x2d6b8a[_0xeb64('0x2f')][_0xeb64('0x35')]('nolimit')){_0x429379[_0xeb64('0x1e')]=qs[_0xeb64('0x1e')](_0x2d6b8a[_0xeb64('0x2f')][_0xeb64('0x1e')]);_0x429379[_0xeb64('0x1f')]=qs[_0xeb64('0x1f')](_0x2d6b8a[_0xeb64('0x2f')]['offset']);}_0x429379[_0xeb64('0x36')]=qs[_0xeb64('0x37')](_0x2d6b8a[_0xeb64('0x2f')][_0xeb64('0x37')]);_0x429379[_0xeb64('0x38')]=qs[_0xeb64('0x31')](_[_0xeb64('0x39')](_0x2d6b8a['query'],_0x1880e0[_0xeb64('0x31')]),_0x541a3d);if(_0x2d6b8a[_0xeb64('0x2f')][_0xeb64('0x3a')]){_0x429379['where']=_['merge'](_0x429379['where'],{'$or':_[_0xeb64('0x29')](_0x541a3d,function(_0xbc8962){if(_0xbc8962['type']!=='VIRTUAL'){var _0x58fab1={};_0x58fab1[_0xbc8962[_0xeb64('0x27')]]={'$like':'%'+_0x2d6b8a['query']['filter']+'%'};return _0x58fab1;}})});}_0x429379=_['merge']({},_0x429379,_0x2d6b8a[_0xeb64('0x3b')]);var _0x565d1f={'where':_0x429379[_0xeb64('0x38')]};return db['VoiceDialReport'][_0xeb64('0x20')](_0x565d1f)['then'](function(_0xddab26){_0x549477[_0xeb64('0x20')]=_0xddab26;if(_0x2d6b8a[_0xeb64('0x2f')]['includeAll']){_0x429379[_0xeb64('0x3c')]=[{'all':!![]}];}return db[_0xeb64('0x2a')][_0xeb64('0x3d')](_0x429379);})[_0xeb64('0x24')](function(_0x37c953){_0x549477[_0xeb64('0x3e')]=_0x37c953;return _0x549477;})[_0xeb64('0x24')](respondWithFilteredResult(_0x1f96a9,_0x429379))['catch'](handleError(_0x1f96a9,null));};exports[_0xeb64('0x3f')]=function(_0x5c9eb2,_0x4027cc){var _0xb32f3c={'raw':!![],'where':{'id':_0x5c9eb2[_0xeb64('0x40')]['id']}},_0x22dd3a={};_0x22dd3a[_0xeb64('0x2e')]=_[_0xeb64('0x30')](db[_0xeb64('0x2a')][_0xeb64('0x2b')]);_0x22dd3a[_0xeb64('0x2f')]=_[_0xeb64('0x30')](_0x5c9eb2[_0xeb64('0x2f')]);_0x22dd3a[_0xeb64('0x31')]=_['intersection'](_0x22dd3a[_0xeb64('0x2e')],_0x22dd3a[_0xeb64('0x2f')]);_0xb32f3c['attributes']=_['intersection'](_0x22dd3a['model'],qs[_0xeb64('0x41')](_0x5c9eb2[_0xeb64('0x2f')][_0xeb64('0x41')]));_0xb32f3c[_0xeb64('0x33')]=_0xb32f3c[_0xeb64('0x33')][_0xeb64('0x34')]?_0xb32f3c[_0xeb64('0x33')]:_0x22dd3a[_0xeb64('0x2e')];if(_0x5c9eb2[_0xeb64('0x2f')][_0xeb64('0x42')]){_0xb32f3c[_0xeb64('0x3c')]=[{'all':!![]}];}_0xb32f3c=_[_0xeb64('0x43')]({},_0xb32f3c,_0x5c9eb2['options']);return db[_0xeb64('0x2a')][_0xeb64('0x44')](_0xb32f3c)[_0xeb64('0x24')](handleEntityNotFound(_0x4027cc,null))['then'](respondWithResult(_0x4027cc,null))[_0xeb64('0x45')](handleError(_0x4027cc,null));};exports[_0xeb64('0x46')]=function(_0x387824,_0x39f669){return db['VoiceDialReport'][_0xeb64('0x46')](_0x387824[_0xeb64('0x47')],{})['then'](respondWithResult(_0x39f669,0xc9))[_0xeb64('0x45')](handleError(_0x39f669,null));};exports[_0xeb64('0x48')]=function(_0x2c0129,_0x14a4bf){if(_0x2c0129[_0xeb64('0x47')]['id']){delete _0x2c0129[_0xeb64('0x47')]['id'];}return db[_0xeb64('0x2a')][_0xeb64('0x44')]({'where':{'id':_0x2c0129[_0xeb64('0x40')]['id']}})[_0xeb64('0x24')](handleEntityNotFound(_0x14a4bf,null))[_0xeb64('0x24')](saveUpdates(_0x2c0129[_0xeb64('0x47')],null))[_0xeb64('0x24')](respondWithResult(_0x14a4bf,null))['catch'](handleError(_0x14a4bf,null));};exports[_0xeb64('0x25')]=function(_0x2d76b8,_0x480352){return db[_0xeb64('0x2a')][_0xeb64('0x44')]({'where':{'id':_0x2d76b8[_0xeb64('0x40')]['id']}})[_0xeb64('0x24')](handleEntityNotFound(_0x480352,null))['then'](removeEntity(_0x480352,null))['catch'](handleError(_0x480352,null));};exports['describe']=function(_0x4835ba,_0xbce989){return db[_0xeb64('0x2a')][_0xeb64('0x49')]()[_0xeb64('0x24')](respondWithResult(_0xbce989,null))[_0xeb64('0x45')](handleError(_0xbce989,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index ef603a6..4dec607 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 _0x04ad=['moment','bluebird','request-promise','path','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','../../config/logger','api'];(function(_0xb8d45e,_0x513c0c){var _0x47633b=function(_0x1e57e6){while(--_0x1e57e6){_0xb8d45e['push'](_0xb8d45e['shift']());}};_0x47633b(++_0x513c0c);}(_0x04ad,0x1d2));var _0xd04a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x04ad[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd04a('0x0'))(_0xd04a('0x1'));var moment=require(_0xd04a('0x2'));var BPromise=require(_0xd04a('0x3'));var rp=require(_0xd04a('0x4'));var fs=require('fs');var path=require(_0xd04a('0x5'));var rimraf=require(_0xd04a('0x6'));var config=require('../../config/environment');var attributes=require(_0xd04a('0x7'));module[_0xd04a('0x8')]=function(_0x2b2c81,_0x564560){return _0x2b2c81[_0xd04a('0x9')](_0xd04a('0xa'),attributes,{'tableName':_0xd04a('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb8ab=['lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','exports','report_dial','uniqueid'];(function(_0x5b8310,_0x77ea6f){var _0xd3ebc1=function(_0x9dfb29){while(--_0x9dfb29){_0x5b8310['push'](_0x5b8310['shift']());}};_0xd3ebc1(++_0x77ea6f);}(_0xb8ab,0x1ea));var _0xbb8a=function(_0x2bf8ce,_0x55d275){_0x2bf8ce=_0x2bf8ce-0x0;var _0x464c0f=_0xb8ab[_0x2bf8ce];return _0x464c0f;};'use strict';var _=require(_0xbb8a('0x0'));var util=require('util');var logger=require(_0xbb8a('0x1'))('api');var moment=require(_0xbb8a('0x2'));var BPromise=require('bluebird');var rp=require(_0xbb8a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb8a('0x4'));var config=require(_0xbb8a('0x5'));var attributes=require(_0xbb8a('0x6'));module[_0xbb8a('0x7')]=function(_0x277f9d,_0xb42b16){return _0x277f9d['define']('VoiceDialReport',attributes,{'tableName':_0xbb8a('0x8'),'paranoid':![],'indexes':[{'fields':[_0xbb8a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 33cf630..b43c106 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 _0x6114=['catch','CreateVoiceDialReport','create','body','options','then','UpdateVoiceDialReport','update','raw','where','attributes','lodash','util','moment','randomstring','ioredis','rpc','jayson/promise','client','http','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6114,0x1af));var _0x4611=function(_0x24f862,_0x4b645a){_0x24f862=_0x24f862-0x0;var _0x198aa4=_0x6114[_0x24f862];return _0x198aa4;};'use strict';var _=require(_0x4611('0x0'));var util=require(_0x4611('0x1'));var moment=require(_0x4611('0x2'));var BPromise=require('bluebird');var rs=require(_0x4611('0x3'));var fs=require('fs');var Redis=require(_0x4611('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4611('0x5'));var config=require('../../config/environment');var jayson=require(_0x4611('0x6'));var client=jayson[_0x4611('0x7')][_0x4611('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d98a7,_0x4443f6,_0x1fe954){return new BPromise(function(_0x54c42f,_0x1f6ea1){return client[_0x4611('0x9')](_0x3d98a7,_0x1fe954)['then'](function(_0x56f174){logger[_0x4611('0xa')](_0x4611('0xb'),_0x4443f6,_0x4611('0xc'));logger[_0x4611('0xd')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x4443f6,'request\x20sent',JSON[_0x4611('0xe')](_0x56f174));if(_0x56f174['error']){if(_0x56f174[_0x4611('0xf')][_0x4611('0x10')]===0x1f4){logger[_0x4611('0xf')](_0x4611('0xb'),_0x4443f6,_0x56f174[_0x4611('0xf')]['message']);return _0x1f6ea1(_0x56f174[_0x4611('0xf')][_0x4611('0x11')]);}logger[_0x4611('0xf')](_0x4611('0xb'),_0x4443f6,_0x56f174[_0x4611('0xf')][_0x4611('0x11')]);return _0x54c42f(_0x56f174['error'][_0x4611('0x11')]);}else{logger['info'](_0x4611('0xb'),_0x4443f6,_0x4611('0xc'));_0x54c42f(_0x56f174[_0x4611('0x12')][_0x4611('0x11')]);}})[_0x4611('0x13')](function(_0xe5e9e4){logger[_0x4611('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x4443f6,_0xe5e9e4);_0x1f6ea1(_0xe5e9e4);});});}exports[_0x4611('0x14')]=function(_0x58088e){var _0x3a98d1=this;return new Promise(function(_0x3a7ee0,_0x5d63aa){return db['VoiceDialReport'][_0x4611('0x15')](_0x58088e[_0x4611('0x16')],{'raw':_0x58088e[_0x4611('0x17')]?_0x58088e[_0x4611('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x4611('0x18')](function(_0xc6b0ff){logger['info'](_0x4611('0x14'),_0x58088e);logger[_0x4611('0xd')](_0x4611('0x14'),_0x58088e,JSON['stringify'](_0xc6b0ff));_0x3a7ee0(_0xc6b0ff);})[_0x4611('0x13')](function(_0x2e71d0){logger[_0x4611('0xf')](_0x4611('0x14'),_0x2e71d0[_0x4611('0x11')],_0x58088e);_0x5d63aa(_0x3a98d1[_0x4611('0xf')](0x1f4,_0x2e71d0[_0x4611('0x11')]));});});};exports[_0x4611('0x19')]=function(_0x537431){var _0x18ae65=this;return new Promise(function(_0x5a454c,_0x5c6a2d){return db['VoiceDialReport'][_0x4611('0x1a')](_0x537431[_0x4611('0x16')],{'raw':_0x537431['options']?_0x537431[_0x4611('0x17')][_0x4611('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x537431[_0x4611('0x17')]?_0x537431['options'][_0x4611('0x1c')]||null:null,'attributes':_0x537431[_0x4611('0x17')]?_0x537431[_0x4611('0x17')][_0x4611('0x1d')]||null:null,'limit':_0x537431[_0x4611('0x17')]?_0x537431[_0x4611('0x17')]['limit']||null:null})[_0x4611('0x18')](function(_0x41acf5){logger[_0x4611('0xa')](_0x4611('0x19'),_0x537431);logger[_0x4611('0xd')](_0x4611('0x19'),_0x537431,JSON[_0x4611('0xe')](_0x41acf5));_0x5a454c(_0x41acf5);})[_0x4611('0x13')](function(_0x3d6a60){logger[_0x4611('0xf')](_0x4611('0x19'),_0x3d6a60['message'],_0x537431);_0x5c6a2d(_0x18ae65[_0x4611('0xf')](0x1f4,_0x3d6a60[_0x4611('0x11')]));});});}; \ No newline at end of file +var _0x41c0=['options','raw','then','catch','UpdateVoiceDialReport','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateVoiceDialReport','VoiceDialReport','body'];(function(_0x24f08d,_0x19ae14){var _0x1233ed=function(_0xefafd9){while(--_0xefafd9){_0x24f08d['push'](_0x24f08d['shift']());}};_0x1233ed(++_0x19ae14);}(_0x41c0,0x18d));var _0x041c=function(_0x58c7b0,_0x4cb178){_0x58c7b0=_0x58c7b0-0x0;var _0x22a17d=_0x41c0[_0x58c7b0];return _0x22a17d;};'use strict';var _=require(_0x041c('0x0'));var util=require(_0x041c('0x1'));var moment=require(_0x041c('0x2'));var BPromise=require(_0x041c('0x3'));var rs=require(_0x041c('0x4'));var fs=require('fs');var Redis=require(_0x041c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x041c('0x6'))(_0x041c('0x7'));var config=require('../../config/environment');var jayson=require(_0x041c('0x8'));var client=jayson[_0x041c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c395c,_0x5769c9,_0xa9bc70){return new BPromise(function(_0x94ff3b,_0x38fb15){return client['request'](_0x4c395c,_0xa9bc70)['then'](function(_0x1f48ec){logger['info'](_0x041c('0xa'),_0x5769c9,_0x041c('0xb'));logger[_0x041c('0xc')](_0x041c('0xd'),_0x5769c9,'request\x20sent',JSON[_0x041c('0xe')](_0x1f48ec));if(_0x1f48ec[_0x041c('0xf')]){if(_0x1f48ec[_0x041c('0xf')][_0x041c('0x10')]===0x1f4){logger[_0x041c('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x5769c9,_0x1f48ec[_0x041c('0xf')][_0x041c('0x11')]);return _0x38fb15(_0x1f48ec[_0x041c('0xf')][_0x041c('0x11')]);}logger[_0x041c('0xf')](_0x041c('0xa'),_0x5769c9,_0x1f48ec[_0x041c('0xf')]['message']);return _0x94ff3b(_0x1f48ec[_0x041c('0xf')][_0x041c('0x11')]);}else{logger[_0x041c('0x12')](_0x041c('0xa'),_0x5769c9,'request\x20sent');_0x94ff3b(_0x1f48ec[_0x041c('0x13')][_0x041c('0x11')]);}})['catch'](function(_0x57eb40){logger[_0x041c('0xf')](_0x041c('0xa'),_0x5769c9,_0x57eb40);_0x38fb15(_0x57eb40);});});}exports[_0x041c('0x14')]=function(_0x50bb2b){var _0x3f329d=this;return new Promise(function(_0x287e8f,_0x5074e7){return db[_0x041c('0x15')]['create'](_0x50bb2b[_0x041c('0x16')],{'raw':_0x50bb2b['options']?_0x50bb2b[_0x041c('0x17')][_0x041c('0x18')]===undefined?!![]:![]:!![]})[_0x041c('0x19')](function(_0x52b889){logger[_0x041c('0x12')](_0x041c('0x14'),_0x50bb2b);logger[_0x041c('0xc')]('CreateVoiceDialReport',_0x50bb2b,JSON[_0x041c('0xe')](_0x52b889));_0x287e8f(_0x52b889);})[_0x041c('0x1a')](function(_0x1a5d21){logger[_0x041c('0xf')](_0x041c('0x14'),_0x1a5d21['message'],_0x50bb2b);_0x5074e7(_0x3f329d[_0x041c('0xf')](0x1f4,_0x1a5d21[_0x041c('0x11')]));});});};exports[_0x041c('0x1b')]=function(_0x557096){var _0x4c548e=this;return new Promise(function(_0x2bf857,_0x3925fa){return db[_0x041c('0x15')]['update'](_0x557096[_0x041c('0x16')],{'raw':_0x557096[_0x041c('0x17')]?_0x557096[_0x041c('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x557096[_0x041c('0x17')]?_0x557096['options'][_0x041c('0x1c')]||null:null,'attributes':_0x557096[_0x041c('0x17')]?_0x557096[_0x041c('0x17')]['attributes']||null:null,'limit':_0x557096[_0x041c('0x17')]?_0x557096[_0x041c('0x17')][_0x041c('0x1d')]||null:null})[_0x041c('0x19')](function(_0x557a7b){logger[_0x041c('0x12')](_0x041c('0x1b'),_0x557096);logger[_0x041c('0xc')]('UpdateVoiceDialReport',_0x557096,JSON[_0x041c('0xe')](_0x557a7b));_0x2bf857(_0x557a7b);})['catch'](function(_0x3c20ea){logger[_0x041c('0xf')](_0x041c('0x1b'),_0x3c20ea[_0x041c('0x11')],_0x557096);_0x3925fa(_0x4c548e[_0x041c('0xf')](0x1f4,_0x3c20ea['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 5cb0840..2b9ec67 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 _0x33bd=['post','addApplications','put','update','exports','multer','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show'];(function(_0xee6522,_0x2bc6b9){var _0x142004=function(_0x38587c){while(--_0x38587c){_0xee6522['push'](_0xee6522['shift']());}};_0x142004(++_0x2bc6b9);}(_0x33bd,0x8d));var _0xd33b=function(_0x12869c,_0x2b028a){_0x12869c=_0x12869c-0x0;var _0x504176=_0x33bd[_0x12869c];return _0x504176;};'use strict';var multer=require(_0xd33b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd33b('0x1'));var express=require('express');var router=express[_0xd33b('0x2')]();var fs_extra=require(_0xd33b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd33b('0x4'));var config=require(_0xd33b('0x5'));var controller=require(_0xd33b('0x6'));router[_0xd33b('0x7')]('/',auth[_0xd33b('0x8')](),controller[_0xd33b('0x9')]);router[_0xd33b('0x7')](_0xd33b('0xa'),auth[_0xd33b('0x8')](),controller[_0xd33b('0xb')]);router[_0xd33b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/applications',auth[_0xd33b('0x8')](),controller[_0xd33b('0xd')]);router[_0xd33b('0xe')](_0xd33b('0xa'),auth['isAuthenticated'](),controller[_0xd33b('0xf')]);router['delete'](_0xd33b('0xa'),auth[_0xd33b('0x8')](),controller['destroy']);module[_0xd33b('0x10')]=router; \ No newline at end of file +var _0xcac4=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x405622,_0x1799fd){var _0x460c59=function(_0x6d0244){while(--_0x6d0244){_0x405622['push'](_0x405622['shift']());}};_0x460c59(++_0x1799fd);}(_0xcac4,0xd9));var _0x4cac=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xcac4[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require(_0x4cac('0x0'));var path=require(_0x4cac('0x1'));var timeout=require(_0x4cac('0x2'));var express=require(_0x4cac('0x3'));var router=express[_0x4cac('0x4')]();var fs_extra=require(_0x4cac('0x5'));var auth=require(_0x4cac('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4cac('0x7'));var controller=require(_0x4cac('0x8'));router[_0x4cac('0x9')]('/',auth[_0x4cac('0xa')](),controller[_0x4cac('0xb')]);router[_0x4cac('0x9')](_0x4cac('0xc'),auth['isAuthenticated'](),controller[_0x4cac('0xd')]);router[_0x4cac('0xe')]('/',auth['isAuthenticated'](),controller[_0x4cac('0xf')]);router['post'](_0x4cac('0x10'),auth['isAuthenticated'](),controller['addApplications']);router[_0x4cac('0x11')](_0x4cac('0xc'),auth[_0x4cac('0xa')](),controller[_0x4cac('0x12')]);router[_0x4cac('0x13')](_0x4cac('0xc'),auth[_0x4cac('0xa')](),controller[_0x4cac('0x14')]);module[_0x4cac('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index f6a6f44..27cf99d 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 _0xd8b0=['VIRTUAL','getDataValue','exten','sequelize','exports','compositeIndex','STRING','ENUM','inbound','outbound','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0d8b('0x2')},'priority':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'1','unique':_0x0d8b('0x2')},'tag':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0d8b('0x4')](_0x0d8b('0x5'),_0x0d8b('0x6'),'internal',_0x0d8b('0x7'),_0x0d8b('0x8'),'system',_0x0d8b('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x0d8b('0x3')]},'interval':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':_0x0d8b('0xa')},'IntervalId':{'type':Sequelize[_0x0d8b('0xb')]},'isApp':{'type':Sequelize[_0x0d8b('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0d8b('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x0d8b('0xd')},'answer':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0d8b('0xe')],'get':function(){return this[_0x0d8b('0xf')](_0x0d8b('0x10'));}}}; \ No newline at end of file +var _0xbaf0=['outbound','internal','inbound-fax','system','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','exten','exports','STRING','compositeIndex','NoOp','ENUM','inbound'];(function(_0x49f87b,_0x2ee2ca){var _0x134f53=function(_0x193643){while(--_0x193643){_0x49f87b['push'](_0x49f87b['shift']());}};_0x134f53(++_0x2ee2ca);}(_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')]={'context':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'priority':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':_0x0baf('0x3')},'appdata':{'type':Sequelize[_0x0baf('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0baf('0x4')](_0x0baf('0x5'),_0x0baf('0x6'),_0x0baf('0x7'),_0x0baf('0x8'),'outbound-fax',_0x0baf('0x9'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x0baf('0x1')]},'interval':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':_0x0baf('0xa')},'IntervalId':{'type':Sequelize[_0x0baf('0xb')]},'isApp':{'type':Sequelize[_0x0baf('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0baf('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x0baf('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0baf('0xb')]},'recordingFormat':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0baf('0xe')](_0x0baf('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index ffa1186..9ac7dee 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 _0x8caf=['createRouting','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','limit','undefined','count','offset','set','Content-Range','json','destroy','then','inbound','OutboundRoutes','internal','filter','ignore','map','value','includes','find','type','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','body','outbound','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','InboundRoutes','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','create','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','findOne','VoiceExtensionId','isApp'];(function(_0x16aa6e,_0x5d7645){var _0x4322eb=function(_0x1eaf03){while(--_0x1eaf03){_0x16aa6e['push'](_0x16aa6e['shift']());}};_0x4322eb(++_0x5d7645);}(_0x8caf,0x17a));var _0xf8ca=function(_0x38a1e5,_0x272e02){_0x38a1e5=_0x38a1e5-0x0;var _0x5f4632=_0x8caf[_0x38a1e5];return _0x5f4632;};'use strict';var _=require(_0xf8ca('0x0'));var Redis=require(_0xf8ca('0x1'));var qs=require(_0xf8ca('0x2'));var logger=require(_0xf8ca('0x3'))(_0xf8ca('0x4'));var config=require('../../config/environment');var db=require(_0xf8ca('0x5'))['db'];config[_0xf8ca('0x6')]=_[_0xf8ca('0x7')](config[_0xf8ca('0x6')],{'host':_0xf8ca('0x8'),'port':0x18eb});var socket=require(_0xf8ca('0x9'))(new Redis(config[_0xf8ca('0x6')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x33e42a,_0x5f4a3e){_0x5f4a3e=_0x5f4a3e||0xcc;return function(_0x2ba4be){if(_0x2ba4be){return _0x33e42a[_0xf8ca('0xa')](_0x5f4a3e);}return _0x33e42a[_0xf8ca('0xb')](_0x5f4a3e)['end']();};}function respondWithResult(_0x558c94,_0x12e25f){_0x12e25f=_0x12e25f||0xc8;return function(_0x542190){if(_0x542190){return _0x558c94[_0xf8ca('0xb')](_0x12e25f)['json'](_0x542190);}};}function respondWithFilteredResult(_0x354c3c,_0x4820b1){return function(_0x3c8bd5){if(_0x3c8bd5){var _0x50bb95=typeof _0x4820b1['offset']==='undefined'&&typeof _0x4820b1[_0xf8ca('0xc')]===_0xf8ca('0xd');var _0x4a2fe8=_0x3c8bd5[_0xf8ca('0xe')];var _0x27d743=_0x50bb95?0x0:_0x4820b1['offset'];var _0x39f209=_0x50bb95?_0x3c8bd5[_0xf8ca('0xe')]:_0x4820b1[_0xf8ca('0xf')]+_0x4820b1['limit'];var _0x4b312e;if(_0x39f209>=_0x4a2fe8){_0x39f209=_0x4a2fe8;_0x4b312e=0xc8;}else{_0x4b312e=0xce;}_0x354c3c[_0xf8ca('0xb')](_0x4b312e);return _0x354c3c[_0xf8ca('0x10')](_0xf8ca('0x11'),_0x27d743+'-'+_0x39f209+'/'+_0x4a2fe8)[_0xf8ca('0x12')](_0x3c8bd5);}return null;};}function removeEntity(_0x49242e){return function(_0x2f8edf){if(_0x2f8edf){return _0x2f8edf[_0xf8ca('0x13')]()[_0xf8ca('0x14')](function(){var _0x2261a3=_0x2f8edf['get']({'plain':!![]});var _0x2ae05c=[{'name':'InboundRoutes','value':_0xf8ca('0x15'),'ignore':![]},{'name':_0xf8ca('0x16'),'value':'outbound','ignore':![]},{'name':'InternalRoutes','value':_0xf8ca('0x17'),'ignore':![]}];var _0x258aaf=_(_0x2ae05c)[_0xf8ca('0x18')](_0xf8ca('0x19'))[_0xf8ca('0x1a')]('value')[_0xf8ca('0x1b')]();if(_[_0xf8ca('0x1c')](_0x258aaf,_0x2261a3['type'])){return;}var _0x3c2390=_[_0xf8ca('0x1d')](_0x2ae05c,[_0xf8ca('0x1b'),_0x2261a3[_0xf8ca('0x1e')]])[_0xf8ca('0x1f')];return db[_0xf8ca('0x20')][_0xf8ca('0x13')]({'where':{'type':_0x3c2390,'resourceId':_0x2261a3['id']}})[_0xf8ca('0x14')](function(){return _0x2f8edf;});})['then'](function(){_0x49242e[_0xf8ca('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x329313){return function(_0x53b9b4){if(!_0x53b9b4){_0x329313[_0xf8ca('0xa')](0x194);}return _0x53b9b4;};}function handleError(_0x498ec3,_0x2fcd15){_0x2fcd15=_0x2fcd15||0x1f4;return function(_0x7a7335){logger[_0xf8ca('0x21')](_0x7a7335[_0xf8ca('0x22')]);if(_0x7a7335[_0xf8ca('0x1f')]){delete _0x7a7335['name'];}_0x498ec3['status'](_0x2fcd15)[_0xf8ca('0x23')](_0x7a7335);};}exports[_0xf8ca('0x24')]=function(_0x4b1170,_0x32c528){var _0x3f6f75={},_0x35c97e={},_0x219f82={'count':0x0,'rows':[]};var _0x266a1c=_['map'](db[_0xf8ca('0x25')][_0xf8ca('0x26')],function(_0x1fbc6f){return{'name':_0x1fbc6f[_0xf8ca('0x27')],'type':_0x1fbc6f[_0xf8ca('0x1e')][_0xf8ca('0x28')]};});_0x35c97e[_0xf8ca('0x29')]=_['map'](_0x266a1c,_0xf8ca('0x1f'));_0x35c97e[_0xf8ca('0x2a')]=_[_0xf8ca('0x2b')](_0x4b1170[_0xf8ca('0x2a')]);_0x35c97e[_0xf8ca('0x2c')]=_['intersection'](_0x35c97e[_0xf8ca('0x29')],_0x35c97e[_0xf8ca('0x2a')]);_0x3f6f75[_0xf8ca('0x2d')]=_[_0xf8ca('0x2e')](_0x35c97e[_0xf8ca('0x29')],qs[_0xf8ca('0x2f')](_0x4b1170['query'][_0xf8ca('0x2f')]));_0x3f6f75['attributes']=_0x3f6f75[_0xf8ca('0x2d')][_0xf8ca('0x30')]?_0x3f6f75[_0xf8ca('0x2d')]:_0x35c97e['model'];if(!_0x4b1170[_0xf8ca('0x2a')]['hasOwnProperty'](_0xf8ca('0x31'))){_0x3f6f75['limit']=qs['limit'](_0x4b1170[_0xf8ca('0x2a')][_0xf8ca('0xc')]);_0x3f6f75[_0xf8ca('0xf')]=qs['offset'](_0x4b1170[_0xf8ca('0x2a')][_0xf8ca('0xf')]);}_0x3f6f75[_0xf8ca('0x32')]=qs[_0xf8ca('0x33')](_0x4b1170[_0xf8ca('0x2a')][_0xf8ca('0x33')]);_0x3f6f75[_0xf8ca('0x34')]=qs[_0xf8ca('0x2c')](_[_0xf8ca('0x35')](_0x4b1170[_0xf8ca('0x2a')],_0x35c97e[_0xf8ca('0x2c')]),_0x266a1c);if(_0x4b1170['query'][_0xf8ca('0x18')]){_0x3f6f75['where']=_['merge'](_0x3f6f75[_0xf8ca('0x34')],{'$or':_[_0xf8ca('0x1a')](_0x266a1c,function(_0x34d0ad){if(_0x34d0ad[_0xf8ca('0x1e')]!==_0xf8ca('0x36')){var _0x36d8cb={};_0x36d8cb[_0x34d0ad[_0xf8ca('0x1f')]]={'$like':'%'+_0x4b1170['query']['filter']+'%'};return _0x36d8cb;}})});}_0x3f6f75=_[_0xf8ca('0x37')]({},_0x3f6f75,_0x4b1170[_0xf8ca('0x38')]);var _0x13f0a5={'where':_0x3f6f75[_0xf8ca('0x34')]};return db['VoiceExtension']['count'](_0x13f0a5)[_0xf8ca('0x14')](function(_0x463854){_0x219f82[_0xf8ca('0xe')]=_0x463854;if(_0x4b1170[_0xf8ca('0x2a')][_0xf8ca('0x39')]){_0x3f6f75[_0xf8ca('0x3a')]=[{'all':!![]}];}return db[_0xf8ca('0x25')][_0xf8ca('0x3b')](_0x3f6f75);})[_0xf8ca('0x14')](function(_0x22403d){_0x219f82[_0xf8ca('0x3c')]=_0x22403d;return _0x219f82;})[_0xf8ca('0x14')](respondWithFilteredResult(_0x32c528,_0x3f6f75))[_0xf8ca('0x3d')](handleError(_0x32c528,null));};exports[_0xf8ca('0x3e')]=function(_0x182920,_0x1fd10c){var _0x37d392={'raw':![],'where':{'id':_0x182920[_0xf8ca('0x3f')]['id']}},_0x31ee0f={};_0x31ee0f[_0xf8ca('0x29')]=_[_0xf8ca('0x2b')](db[_0xf8ca('0x25')][_0xf8ca('0x26')]);_0x31ee0f[_0xf8ca('0x2a')]=_['keys'](_0x182920['query']);_0x31ee0f[_0xf8ca('0x2c')]=_[_0xf8ca('0x2e')](_0x31ee0f[_0xf8ca('0x29')],_0x31ee0f[_0xf8ca('0x2a')]);_0x37d392[_0xf8ca('0x2d')]=_['intersection'](_0x31ee0f[_0xf8ca('0x29')],qs[_0xf8ca('0x2f')](_0x182920[_0xf8ca('0x2a')][_0xf8ca('0x2f')]));_0x37d392[_0xf8ca('0x2d')]=_0x37d392[_0xf8ca('0x2d')][_0xf8ca('0x30')]?_0x37d392[_0xf8ca('0x2d')]:_0x31ee0f['model'];if(_0x182920[_0xf8ca('0x2a')]['includeAll']){_0x37d392[_0xf8ca('0x3a')]=[{'all':!![]}];}_0x37d392=_[_0xf8ca('0x37')]({},_0x37d392,_0x182920['options']);return db[_0xf8ca('0x25')][_0xf8ca('0x1d')](_0x37d392)[_0xf8ca('0x14')](handleEntityNotFound(_0x1fd10c,null))[_0xf8ca('0x14')](respondWithResult(_0x1fd10c,null))[_0xf8ca('0x3d')](handleError(_0x1fd10c,null));};exports[_0xf8ca('0x13')]=function(_0x5b4cf7,_0x387570){return db['VoiceExtension']['find']({'where':{'id':_0x5b4cf7[_0xf8ca('0x3f')]['id']}})[_0xf8ca('0x14')](handleEntityNotFound(_0x387570,null))['then'](removeEntity(_0x387570,null))[_0xf8ca('0x3d')](handleError(_0x387570,null));};exports['create']=function(_0x2166d7,_0x30cfd9){if(_0x2166d7[_0xf8ca('0x40')][_0xf8ca('0x1e')]===_0xf8ca('0x41')&&!_['startsWith'](_0x2166d7[_0xf8ca('0x40')][_0xf8ca('0x42')],'_')){_0x2166d7[_0xf8ca('0x40')][_0xf8ca('0x42')]='_'[_0xf8ca('0x43')](_0x2166d7[_0xf8ca('0x40')][_0xf8ca('0x42')]);}return db['VoiceExtension']['create'](_0x2166d7[_0xf8ca('0x40')],{'raw':![]})['then'](function(_0x3efcb9){var _0x4a9a4e=_0x2166d7[_0xf8ca('0x44')]['get']({'plain':!![]});if(!_0x4a9a4e)throw new Error(_0xf8ca('0x45'));if(_0x4a9a4e[_0xf8ca('0x46')]===_0xf8ca('0x44')){var _0x16087d=_0x3efcb9[_0xf8ca('0x47')]({'plain':!![]});var _0x95e358=[{'name':_0xf8ca('0x48'),'value':_0xf8ca('0x15')},{'name':_0xf8ca('0x16'),'value':_0xf8ca('0x41')},{'name':_0xf8ca('0x49'),'value':'internal'}];var _0x1ca221=_[_0xf8ca('0x1d')](_0x95e358,[_0xf8ca('0x1b'),_0x16087d[_0xf8ca('0x1e')]])['name'];return db[_0xf8ca('0x4a')]['find']({'where':{'name':_0x1ca221,'userProfileId':_0x4a9a4e[_0xf8ca('0x4b')]},'raw':!![]})[_0xf8ca('0x14')](function(_0x429594){if(_0x429594&&_0x429594[_0xf8ca('0x4c')]===0x0){return db[_0xf8ca('0x20')][_0xf8ca('0x4d')]({'name':_0x16087d[_0xf8ca('0x1f')],'resourceId':_0x16087d['id'],'type':_0x429594['name'],'sectionId':_0x429594['id']},{})[_0xf8ca('0x14')](function(){return _0x3efcb9;});}else{return _0x3efcb9;}})[_0xf8ca('0x3d')](function(_0x429d86){logger[_0xf8ca('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x429d86);throw _0x429d86;});}return _0x3efcb9;})[_0xf8ca('0x14')](respondWithResult(_0x30cfd9,0xc9))[_0xf8ca('0x3d')](handleError(_0x30cfd9,null));};exports[_0xf8ca('0x4e')]=function(_0x1a7acf,_0x5d0ad9){if(_0x1a7acf[_0xf8ca('0x40')]['id']){delete _0x1a7acf[_0xf8ca('0x40')]['id'];}return db[_0xf8ca('0x25')][_0xf8ca('0x1d')]({'where':{'id':_0x1a7acf['params']['id']}})[_0xf8ca('0x14')](handleEntityNotFound(_0x5d0ad9,null))[_0xf8ca('0x14')](function(_0x1f2b89){if(_0x1f2b89){return db[_0xf8ca('0x25')]['update'](_[_0xf8ca('0x35')](_0x1a7acf[_0xf8ca('0x40')],[_0xf8ca('0x42'),_0xf8ca('0x4f'),_0xf8ca('0x50'),_0xf8ca('0x51'),_0xf8ca('0x52'),_0xf8ca('0x53'),_0xf8ca('0x54')]),{'where':{'context':_0x1f2b89[_0xf8ca('0x4f')],'exten':_0x1f2b89[_0xf8ca('0x42')]},'individualHooks':!![]})['then'](function(_0xba580f){return _0xba580f;});}return null;})['then'](respondWithStatusCode(_0x5d0ad9,null))[_0xf8ca('0x3d')](handleError(_0x5d0ad9,null));};exports[_0xf8ca('0x55')]=function(_0x38080c,_0x1398bb){var _0x25290f=_0x38080c['params']['id'];var _0x10db09=_0x38080c[_0xf8ca('0x40')];var _0xe2dd4e=0xc8;var _0x215948=null;return db[_0xf8ca('0x56')][_0xf8ca('0x57')]({'isolationLevel':db[_0xf8ca('0x56')][_0xf8ca('0x58')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x5750a5){return db[_0xf8ca('0x25')][_0xf8ca('0x59')]({'where':{'id':_0x25290f},'transaction':_0x5750a5})[_0xf8ca('0x14')](function(_0x685268){if(_0x685268){return db[_0xf8ca('0x25')][_0xf8ca('0x13')]({'where':{'VoiceExtensionId':_0x25290f},'transaction':_0x5750a5})[_0xf8ca('0x14')](function(){var _0x8035d6=_[_0xf8ca('0x1a')](_0x10db09,function(_0x1c798e){_0x1c798e[_0xf8ca('0x5a')]=_0x25290f;_0x1c798e[_0xf8ca('0x5b')]=!![];return _0x1c798e;});return _0x685268[_0xf8ca('0x5c')](_0x8035d6);})['then'](function(_0x203166){return db['VoiceExtension']['bulkCreate'](_0x203166,{'transaction':_0x5750a5});});}else{_0xe2dd4e=0x194;_0x215948=[];}});})[_0xf8ca('0x14')](function(){if(_0xe2dd4e!==0x194){return db[_0xf8ca('0x25')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x25290f},'order':'cast(priority\x20as\x20unsigned)'})[_0xf8ca('0x14')](function(_0x34c6ed){_0x215948=_0x34c6ed;});}})[_0xf8ca('0x3d')](function(_0x3b68ca){_0xe2dd4e=0x1f4;logger[_0xf8ca('0x21')](_0x3b68ca['stack']);if(_0x3b68ca[_0xf8ca('0x1f')]){delete _0x3b68ca['name'];}_0x215948=_0x3b68ca;})[_0xf8ca('0x5d')](function(){if(_0x215948===null){_0x1398bb[_0xf8ca('0xa')](_0xe2dd4e);}else{if(_0xe2dd4e===0x1f4){_0x1398bb[_0xf8ca('0xb')](_0xe2dd4e)['send'](_0x215948);}else{_0x1398bb[_0xf8ca('0xb')](_0xe2dd4e)['json'](_0x215948);}}});}; \ No newline at end of file +var _0xd346=['filters','intersection','attributes','fields','length','hasOwnProperty','pick','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','rawAttributes','include','find','body','startsWith','exten','create','user','role','userProfileId','autoAssociation','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','then','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','name','UserProfileResource','destroy','stack','send','index','VoiceExtension','fieldName','key','model','query'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd346,0x138));var _0x6d34=function(_0x46ccd3,_0x202271){_0x46ccd3=_0x46ccd3-0x0;var _0x43fea0=_0xd346[_0x46ccd3];return _0x43fea0;};'use strict';var _=require(_0x6d34('0x0'));var Redis=require(_0x6d34('0x1'));var qs=require(_0x6d34('0x2'));var logger=require(_0x6d34('0x3'))(_0x6d34('0x4'));var config=require(_0x6d34('0x5'));var db=require('../../mysqldb')['db'];config[_0x6d34('0x6')]=_[_0x6d34('0x7')](config[_0x6d34('0x6')],{'host':_0x6d34('0x8'),'port':0x18eb});var socket=require(_0x6d34('0x9'))(new Redis(config[_0x6d34('0x6')]));require(_0x6d34('0xa'))[_0x6d34('0xb')](socket);function respondWithStatusCode(_0x46e77a,_0x15a1ec){_0x15a1ec=_0x15a1ec||0xcc;return function(_0xd3b520){if(_0xd3b520){return _0x46e77a[_0x6d34('0xc')](_0x15a1ec);}return _0x46e77a[_0x6d34('0xd')](_0x15a1ec)[_0x6d34('0xe')]();};}function respondWithResult(_0x2d5980,_0x3179cb){_0x3179cb=_0x3179cb||0xc8;return function(_0xd38035){if(_0xd38035){return _0x2d5980[_0x6d34('0xd')](_0x3179cb)[_0x6d34('0xf')](_0xd38035);}};}function respondWithFilteredResult(_0x86d930,_0xc233c2){return function(_0x2bb27c){if(_0x2bb27c){var _0x4c4ce1=typeof _0xc233c2[_0x6d34('0x10')]===_0x6d34('0x11')&&typeof _0xc233c2[_0x6d34('0x12')]===_0x6d34('0x11');var _0x25aff2=_0x2bb27c['count'];var _0x1deb2f=_0x4c4ce1?0x0:_0xc233c2[_0x6d34('0x10')];var _0x6d94da=_0x4c4ce1?_0x2bb27c['count']:_0xc233c2[_0x6d34('0x10')]+_0xc233c2[_0x6d34('0x12')];var _0x285748;if(_0x6d94da>=_0x25aff2){_0x6d94da=_0x25aff2;_0x285748=0xc8;}else{_0x285748=0xce;}_0x86d930[_0x6d34('0xd')](_0x285748);return _0x86d930[_0x6d34('0x13')]('Content-Range',_0x1deb2f+'-'+_0x6d94da+'/'+_0x25aff2)[_0x6d34('0xf')](_0x2bb27c);}return null;};}function removeEntity(_0x19d859){return function(_0x27665c){if(_0x27665c){return _0x27665c['destroy']()[_0x6d34('0x14')](function(){var _0x3e5386=_0x27665c[_0x6d34('0x15')]({'plain':!![]});var _0x51660c=[{'name':_0x6d34('0x16'),'value':'inbound','ignore':![]},{'name':_0x6d34('0x17'),'value':_0x6d34('0x18'),'ignore':![]},{'name':_0x6d34('0x19'),'value':_0x6d34('0x1a'),'ignore':![]}];var _0x39b0bc=_(_0x51660c)[_0x6d34('0x1b')](_0x6d34('0x1c'))[_0x6d34('0x1d')](_0x6d34('0x1e'))[_0x6d34('0x1e')]();if(_[_0x6d34('0x1f')](_0x39b0bc,_0x3e5386[_0x6d34('0x20')])){return;}var _0x3afcac=_['find'](_0x51660c,['value',_0x3e5386['type']])[_0x6d34('0x21')];return db[_0x6d34('0x22')][_0x6d34('0x23')]({'where':{'type':_0x3afcac,'resourceId':_0x3e5386['id']}})[_0x6d34('0x14')](function(){return _0x27665c;});})[_0x6d34('0x14')](function(){_0x19d859[_0x6d34('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57028f){return function(_0x16ae28){if(!_0x16ae28){_0x57028f[_0x6d34('0xc')](0x194);}return _0x16ae28;};}function handleError(_0x59c4f2,_0x4a5f8c){_0x4a5f8c=_0x4a5f8c||0x1f4;return function(_0x58b099){logger['error'](_0x58b099[_0x6d34('0x24')]);if(_0x58b099[_0x6d34('0x21')]){delete _0x58b099['name'];}_0x59c4f2['status'](_0x4a5f8c)[_0x6d34('0x25')](_0x58b099);};}exports[_0x6d34('0x26')]=function(_0x384edc,_0x45948d){var _0x58a7c2={},_0x2598ae={},_0x348ad5={'count':0x0,'rows':[]};var _0x24fb47=_[_0x6d34('0x1d')](db[_0x6d34('0x27')]['rawAttributes'],function(_0x3c96cf){return{'name':_0x3c96cf[_0x6d34('0x28')],'type':_0x3c96cf['type'][_0x6d34('0x29')]};});_0x2598ae[_0x6d34('0x2a')]=_[_0x6d34('0x1d')](_0x24fb47,_0x6d34('0x21'));_0x2598ae[_0x6d34('0x2b')]=_['keys'](_0x384edc[_0x6d34('0x2b')]);_0x2598ae[_0x6d34('0x2c')]=_[_0x6d34('0x2d')](_0x2598ae[_0x6d34('0x2a')],_0x2598ae[_0x6d34('0x2b')]);_0x58a7c2[_0x6d34('0x2e')]=_[_0x6d34('0x2d')](_0x2598ae[_0x6d34('0x2a')],qs[_0x6d34('0x2f')](_0x384edc[_0x6d34('0x2b')]['fields']));_0x58a7c2[_0x6d34('0x2e')]=_0x58a7c2[_0x6d34('0x2e')][_0x6d34('0x30')]?_0x58a7c2[_0x6d34('0x2e')]:_0x2598ae['model'];if(!_0x384edc[_0x6d34('0x2b')][_0x6d34('0x31')]('nolimit')){_0x58a7c2[_0x6d34('0x12')]=qs[_0x6d34('0x12')](_0x384edc[_0x6d34('0x2b')]['limit']);_0x58a7c2['offset']=qs[_0x6d34('0x10')](_0x384edc[_0x6d34('0x2b')][_0x6d34('0x10')]);}_0x58a7c2['order']=qs['sort'](_0x384edc['query']['sort']);_0x58a7c2['where']=qs[_0x6d34('0x2c')](_[_0x6d34('0x32')](_0x384edc[_0x6d34('0x2b')],_0x2598ae[_0x6d34('0x2c')]),_0x24fb47);if(_0x384edc['query']['filter']){_0x58a7c2[_0x6d34('0x33')]=_[_0x6d34('0x34')](_0x58a7c2[_0x6d34('0x33')],{'$or':_[_0x6d34('0x1d')](_0x24fb47,function(_0x49ca00){if(_0x49ca00[_0x6d34('0x20')]!==_0x6d34('0x35')){var _0xe0f693={};_0xe0f693[_0x49ca00[_0x6d34('0x21')]]={'$like':'%'+_0x384edc[_0x6d34('0x2b')][_0x6d34('0x1b')]+'%'};return _0xe0f693;}})});}_0x58a7c2=_['merge']({},_0x58a7c2,_0x384edc[_0x6d34('0x36')]);var _0x17e4fa={'where':_0x58a7c2['where']};return db['VoiceExtension']['count'](_0x17e4fa)['then'](function(_0x4105bf){_0x348ad5['count']=_0x4105bf;if(_0x384edc[_0x6d34('0x2b')][_0x6d34('0x37')]){_0x58a7c2['include']=[{'all':!![]}];}return db['VoiceExtension'][_0x6d34('0x38')](_0x58a7c2);})[_0x6d34('0x14')](function(_0x1c7c39){_0x348ad5['rows']=_0x1c7c39;return _0x348ad5;})[_0x6d34('0x14')](respondWithFilteredResult(_0x45948d,_0x58a7c2))[_0x6d34('0x39')](handleError(_0x45948d,null));};exports[_0x6d34('0x3a')]=function(_0x3f691a,_0x200fa2){var _0x251437={'raw':![],'where':{'id':_0x3f691a[_0x6d34('0x3b')]['id']}},_0xbb7811={};_0xbb7811[_0x6d34('0x2a')]=_[_0x6d34('0x3c')](db['VoiceExtension'][_0x6d34('0x3d')]);_0xbb7811[_0x6d34('0x2b')]=_['keys'](_0x3f691a[_0x6d34('0x2b')]);_0xbb7811[_0x6d34('0x2c')]=_['intersection'](_0xbb7811['model'],_0xbb7811['query']);_0x251437[_0x6d34('0x2e')]=_[_0x6d34('0x2d')](_0xbb7811[_0x6d34('0x2a')],qs['fields'](_0x3f691a['query']['fields']));_0x251437[_0x6d34('0x2e')]=_0x251437[_0x6d34('0x2e')][_0x6d34('0x30')]?_0x251437[_0x6d34('0x2e')]:_0xbb7811[_0x6d34('0x2a')];if(_0x3f691a[_0x6d34('0x2b')][_0x6d34('0x37')]){_0x251437[_0x6d34('0x3e')]=[{'all':!![]}];}_0x251437=_[_0x6d34('0x34')]({},_0x251437,_0x3f691a[_0x6d34('0x36')]);return db['VoiceExtension']['find'](_0x251437)['then'](handleEntityNotFound(_0x200fa2,null))[_0x6d34('0x14')](respondWithResult(_0x200fa2,null))['catch'](handleError(_0x200fa2,null));};exports[_0x6d34('0x23')]=function(_0x471c23,_0x3e1062){return db['VoiceExtension'][_0x6d34('0x3f')]({'where':{'id':_0x471c23[_0x6d34('0x3b')]['id']}})['then'](handleEntityNotFound(_0x3e1062,null))[_0x6d34('0x14')](removeEntity(_0x3e1062,null))[_0x6d34('0x39')](handleError(_0x3e1062,null));};exports['create']=function(_0x26265b,_0x401753){if(_0x26265b[_0x6d34('0x40')][_0x6d34('0x20')]===_0x6d34('0x18')&&!_[_0x6d34('0x41')](_0x26265b[_0x6d34('0x40')][_0x6d34('0x42')],'_')){_0x26265b['body'][_0x6d34('0x42')]='_'['concat'](_0x26265b[_0x6d34('0x40')][_0x6d34('0x42')]);}return db[_0x6d34('0x27')][_0x6d34('0x43')](_0x26265b['body'],{'raw':![]})[_0x6d34('0x14')](function(_0x9ee8d4){var _0x316f1a=_0x26265b[_0x6d34('0x44')][_0x6d34('0x15')]({'plain':!![]});if(!_0x316f1a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x316f1a[_0x6d34('0x45')]===_0x6d34('0x44')){var _0x14afc6=_0x9ee8d4[_0x6d34('0x15')]({'plain':!![]});var _0xb25bb9=[{'name':_0x6d34('0x16'),'value':'inbound'},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x6d34('0x19'),'value':_0x6d34('0x1a')}];var _0xec04d0=_[_0x6d34('0x3f')](_0xb25bb9,[_0x6d34('0x1e'),_0x14afc6[_0x6d34('0x20')]])['name'];return db['UserProfileSection']['find']({'where':{'name':_0xec04d0,'userProfileId':_0x316f1a[_0x6d34('0x46')]},'raw':!![]})[_0x6d34('0x14')](function(_0x500e8f){if(_0x500e8f&&_0x500e8f[_0x6d34('0x47')]===0x0){return db['UserProfileResource'][_0x6d34('0x43')]({'name':_0x14afc6[_0x6d34('0x21')],'resourceId':_0x14afc6['id'],'type':_0x500e8f['name'],'sectionId':_0x500e8f['id']},{})[_0x6d34('0x14')](function(){return _0x9ee8d4;});}else{return _0x9ee8d4;}})[_0x6d34('0x39')](function(_0x3a5586){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a5586);throw _0x3a5586;});}return _0x9ee8d4;})['then'](respondWithResult(_0x401753,0xc9))[_0x6d34('0x39')](handleError(_0x401753,null));};exports[_0x6d34('0x48')]=function(_0x2713df,_0x30f173){if(_0x2713df[_0x6d34('0x40')]['id']){delete _0x2713df[_0x6d34('0x40')]['id'];}return db[_0x6d34('0x27')][_0x6d34('0x3f')]({'where':{'id':_0x2713df[_0x6d34('0x3b')]['id']}})[_0x6d34('0x14')](handleEntityNotFound(_0x30f173,null))[_0x6d34('0x14')](function(_0x2b1faf){if(_0x2b1faf){return db[_0x6d34('0x27')][_0x6d34('0x48')](_[_0x6d34('0x32')](_0x2713df[_0x6d34('0x40')],[_0x6d34('0x42'),_0x6d34('0x49'),_0x6d34('0x4a'),_0x6d34('0x4b'),_0x6d34('0x4c'),_0x6d34('0x4d'),'alias']),{'where':{'context':_0x2b1faf[_0x6d34('0x49')],'exten':_0x2b1faf[_0x6d34('0x42')]},'individualHooks':!![]})[_0x6d34('0x14')](function(_0xaf5601){return _0xaf5601;});}return null;})[_0x6d34('0x14')](respondWithStatusCode(_0x30f173,null))[_0x6d34('0x39')](handleError(_0x30f173,null));};exports[_0x6d34('0x4e')]=function(_0x20412a,_0x1eb503){var _0x203eaf=_0x20412a[_0x6d34('0x3b')]['id'];var _0x4fb5d6=_0x20412a['body'];var _0x46901f=0xc8;var _0x1a180b=null;return db['sequelize'][_0x6d34('0x4f')]({'isolationLevel':db['sequelize']['Transaction'][_0x6d34('0x50')][_0x6d34('0x51')]},function(_0x50bab7){return db['VoiceExtension']['findOne']({'where':{'id':_0x203eaf},'transaction':_0x50bab7})[_0x6d34('0x14')](function(_0x5e1106){if(_0x5e1106){return db['VoiceExtension'][_0x6d34('0x23')]({'where':{'VoiceExtensionId':_0x203eaf},'transaction':_0x50bab7})['then'](function(){var _0xc4100b=_[_0x6d34('0x1d')](_0x4fb5d6,function(_0x14b0c9){_0x14b0c9[_0x6d34('0x52')]=_0x203eaf;_0x14b0c9[_0x6d34('0x53')]=!![];return _0x14b0c9;});return _0x5e1106[_0x6d34('0x54')](_0xc4100b);})[_0x6d34('0x14')](function(_0x3288f2){return db[_0x6d34('0x27')][_0x6d34('0x55')](_0x3288f2,{'transaction':_0x50bab7});});}else{_0x46901f=0x194;_0x1a180b=[];}});})[_0x6d34('0x14')](function(){if(_0x46901f!==0x194){return db['VoiceExtension'][_0x6d34('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x203eaf},'order':_0x6d34('0x57')})[_0x6d34('0x14')](function(_0x46eb4e){_0x1a180b=_0x46eb4e;});}})[_0x6d34('0x39')](function(_0x3b2d42){_0x46901f=0x1f4;logger['error'](_0x3b2d42[_0x6d34('0x24')]);if(_0x3b2d42[_0x6d34('0x21')]){delete _0x3b2d42[_0x6d34('0x21')];}_0x1a180b=_0x3b2d42;})[_0x6d34('0x58')](function(){if(_0x1a180b===null){_0x1eb503[_0x6d34('0xc')](_0x46901f);}else{if(_0x46901f===0x1f4){_0x1eb503[_0x6d34('0xd')](_0x46901f)[_0x6d34('0x25')](_0x1a180b);}else{_0x1eb503[_0x6d34('0xd')](_0x46901f)[_0x6d34('0xf')](_0x1a180b);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 13e7b87..9396a2f 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 _0x41d3=['hook','events','../../mysqldb','VoiceExtension','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x50e542,_0x17d881){var _0x552c70=function(_0x15c0e3){while(--_0x15c0e3){_0x50e542['push'](_0x50e542['shift']());}};_0x552c70(++_0x17d881);}(_0x41d3,0xe2));var _0x341d=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x41d3[_0x2b10c6];return _0x3789d2;};'use strict';var EventEmitter=require(_0x341d('0x0'));var VoiceExtension=require(_0x341d('0x1'))['db'][_0x341d('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x341d('0x3')](0x0);var events={'afterCreate':_0x341d('0x4'),'afterUpdate':'update','afterDestroy':_0x341d('0x5')};function emitEvent(_0x1356a7){return function(_0x4cfb75,_0xdf8b02,_0x36ade9){VoiceExtensionEvents[_0x341d('0x6')](_0x1356a7+':'+_0x4cfb75['id'],_0x4cfb75);VoiceExtensionEvents[_0x341d('0x6')](_0x1356a7,_0x4cfb75);_0x36ade9(null);};}for(var e in events){if(events[_0x341d('0x7')](e)){var event=events[e];VoiceExtension[_0x341d('0x8')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x0335=['../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x29f574,_0x4e27dd){var _0xbc2316=function(_0x5309f4){while(--_0x5309f4){_0x29f574['push'](_0x29f574['shift']());}};_0xbc2316(++_0x4e27dd);}(_0x0335,0x1b9));var _0x5033=function(_0x4ca3f1,_0x4af7c1){_0x4ca3f1=_0x4ca3f1-0x0;var _0x1350b7=_0x0335[_0x4ca3f1];return _0x1350b7;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x5033('0x0'))['db'][_0x5033('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x5033('0x2')](0x0);var events={'afterCreate':_0x5033('0x3'),'afterUpdate':_0x5033('0x4'),'afterDestroy':_0x5033('0x5')};function emitEvent(_0x28742f){return function(_0x1554f2,_0x234b1c,_0x46f24e){VoiceExtensionEvents[_0x5033('0x6')](_0x28742f+':'+_0x1554f2['id'],_0x1554f2);VoiceExtensionEvents[_0x5033('0x6')](_0x28742f,_0x1554f2);_0x46f24e(null);};}for(var e in events){if(events[_0x5033('0x7')](e)){var event=events[e];VoiceExtension[_0x5033('0x8')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 758d399..7d0dd17 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 _0x85eb=['outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','define','VoiceExtension','voice_extensions','get','then','Hangup','lodash','./voiceExtension.attributes','exports','models','Set','CDR(type)=','context','exten','type','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','url','length','name','param','split','phone','prefix','SIP','options','indexOf','U(xcally-mixmonitor-context)','join','isEmpty','Interval','findAll','interval','IntervalId','*,*,*,*','intervals','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','playback','includes','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType'];(function(_0x2c9e61,_0x2d13f5){var _0x4d55d6=function(_0x56f065){while(--_0x56f065){_0x2c9e61['push'](_0x2c9e61['shift']());}};_0x4d55d6(++_0x2d13f5);}(_0x85eb,0xa9));var _0xb85e=function(_0x143a0c,_0x456770){_0x143a0c=_0x143a0c-0x0;var _0x3b343e=_0x85eb[_0x143a0c];return _0x3b343e;};'use strict';var _=require(_0xb85e('0x0'));var attributes=require(_0xb85e('0x1'));module[_0xb85e('0x2')]=function(_0x3cef85){var _0x18290a=_0x3cef85[_0xb85e('0x3')];function _0x408f61(_0x170a87){var _0x15ca7d=0x2;var _0x1b3d19=[{'type':_0x170a87['type'],'app':_0xb85e('0x4'),'appdata':_0xb85e('0x5')+_0x170a87['type'],'context':_0x170a87[_0xb85e('0x6')],'exten':_0x170a87[_0xb85e('0x7')],'priority':_0x15ca7d++,'VoiceExtensionId':_0x170a87['id']}];if(_0x170a87[_0xb85e('0x8')]==='inbound'){_0x1b3d19[_0xb85e('0x9')]({'type':'inbound','app':_0xb85e('0x4'),'appdata':_0xb85e('0xa')+_0x170a87['id'],'context':_0x170a87['context'],'exten':_0x170a87[_0xb85e('0x7')],'priority':_0x15ca7d++,'VoiceExtensionId':_0x170a87['id']});}_0x1b3d19[_0xb85e('0x9')]({'type':_0x170a87['type'],'app':_0xb85e('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x170a87['context'],'exten':_0x170a87[_0xb85e('0x7')],'priority':_0x15ca7d++,'VoiceExtensionId':_0x170a87['id']},{'type':_0x170a87[_0xb85e('0x8')],'app':_0xb85e('0x4'),'appdata':_0xb85e('0xb'),'context':_0x170a87[_0xb85e('0x6')],'exten':_0x170a87[_0xb85e('0x7')],'priority':_0x15ca7d++,'VoiceExtensionId':_0x170a87['id']},{'type':_0x170a87['type'],'app':_0xb85e('0x4'),'appdata':_0xb85e('0xc'),'context':_0x170a87[_0xb85e('0x6')],'exten':_0x170a87['exten'],'priority':_0x15ca7d++,'VoiceExtensionId':_0x170a87['id']});return _0x1b3d19;}function _0x56088e(_0x57eab8){var _0x128620=0x2;var _0x4e722d=[{'type':_0xb85e('0xd'),'app':_0xb85e('0x4'),'appdata':_0xb85e('0xe'),'context':_0x57eab8[_0xb85e('0x6')],'exten':_0x57eab8[_0xb85e('0x7')],'priority':_0x128620++,'VoiceExtensionId':_0x57eab8['id']},{'type':'outbound','app':_0xb85e('0x4'),'appdata':'CDR(destination)='+(_0x57eab8[_0xb85e('0xf')]?_0xb85e('0x10')+_0x57eab8[_0xb85e('0xf')]+'}':_0xb85e('0x11')),'context':_0x57eab8[_0xb85e('0x6')],'exten':_0x57eab8[_0xb85e('0x7')],'priority':_0x128620++,'VoiceExtensionId':_0x57eab8['id']},{'type':_0xb85e('0xd'),'app':_0xb85e('0x4'),'appdata':_0xb85e('0xa')+_0x57eab8['id'],'context':_0x57eab8['context'],'exten':_0x57eab8[_0xb85e('0x7')],'priority':_0x128620++,'VoiceExtensionId':_0x57eab8['id']},{'type':_0xb85e('0xd'),'app':_0xb85e('0x12'),'appdata':_0xb85e('0x13')+(_0x128620+0x2)+'):Goto('+(_0x128620+0x1)+')','context':_0x57eab8[_0xb85e('0x6')],'exten':_0x57eab8[_0xb85e('0x7')],'priority':_0x128620++,'VoiceExtensionId':_0x57eab8['id']},{'type':_0xb85e('0xd'),'app':_0xb85e('0x4'),'appdata':_0x57eab8['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x57eab8['cutdigits']+'}':_0xb85e('0x14'),'context':_0x57eab8[_0xb85e('0x6')],'exten':_0x57eab8[_0xb85e('0x7')],'priority':_0x128620++,'VoiceExtensionId':_0x57eab8['id']},{'type':_0xb85e('0xd'),'app':_0xb85e('0x4'),'appdata':_0xb85e('0x15'),'context':_0x57eab8[_0xb85e('0x6')],'exten':_0x57eab8[_0xb85e('0x7')],'priority':_0x128620++,'VoiceExtensionId':_0x57eab8['id']},{'type':_0xb85e('0xd'),'app':_0xb85e('0x4'),'appdata':_0xb85e('0xb'),'context':_0x57eab8[_0xb85e('0x6')],'exten':_0x57eab8[_0xb85e('0x7')],'priority':_0x128620++,'VoiceExtensionId':_0x57eab8['id']},{'type':_0xb85e('0xd'),'app':_0xb85e('0x4'),'appdata':_0xb85e('0xc'),'context':_0x57eab8[_0xb85e('0x6')],'exten':_0x57eab8[_0xb85e('0x7')],'priority':_0x128620++,'VoiceExtensionId':_0x57eab8['id']},{'type':'outbound','app':_0xb85e('0x4'),'appdata':'outboundrouteid='+_0x57eab8['id'],'context':_0x57eab8[_0xb85e('0x6')],'exten':_0x57eab8[_0xb85e('0x7')],'priority':_0x128620++,'VoiceExtensionId':_0x57eab8['id']}];if(_0x57eab8[_0xb85e('0x16')](_0xb85e('0x17'))&&_0x57eab8[_0xb85e('0x17')]!==_0xb85e('0x18')){_0x4e722d['push']({'type':'outbound','app':_0xb85e('0x4'),'appdata':_0xb85e('0x19'),'context':_0x57eab8[_0xb85e('0x6')],'exten':_0x57eab8[_0xb85e('0x7')],'priority':_0x128620++,'VoiceExtensionId':_0x57eab8['id']},{'type':_0xb85e('0xd'),'app':'Set','appdata':_0xb85e('0x1a')+_0x57eab8[_0xb85e('0x17')]||_0xb85e('0x1b'),'context':_0x57eab8[_0xb85e('0x6')],'exten':_0x57eab8['exten'],'priority':_0x128620++,'VoiceExtensionId':_0x57eab8['id']});}return _0x4e722d;}function _0x1ce955(_0x2ff12a,_0x465800){var _0x5b58c5=[{'name':_0xb85e('0x1c'),'param':0x0},{'name':_0xb85e('0x1d'),'param':0x1},{'name':'options','param':0x2},{'name':_0xb85e('0x1e'),'param':0x3}];var _0x9e53a8={};var _0x340ab0=_0x465800['split'](',');var _0x17d212=[];for(var _0x56ad52=0x0;_0x56ad52<_0x5b58c5[_0xb85e('0x1f')];_0x56ad52++){switch(_0x5b58c5[_0x56ad52][_0xb85e('0x20')]){case _0xb85e('0x1c'):_0x9e53a8[_0xb85e('0x1c')]=_0x340ab0[_0x5b58c5[_0x56ad52][_0xb85e('0x21')]][_0xb85e('0x22')]('/')[0x1];_0x9e53a8['phone']=_0x340ab0[_0x5b58c5[_0x56ad52][_0xb85e('0x21')]][_0xb85e('0x22')]('/')[0x2];_0x9e53a8['prefix']=_0x9e53a8[_0xb85e('0x23')]?_0x9e53a8[_0xb85e('0x23')][_0xb85e('0x22')]('$')[0x0]:undefined;_0x9e53a8[_0xb85e('0x23')]=_0x2ff12a[_0xb85e('0xf')]?(_0x9e53a8[_0xb85e('0x24')]||'')+_0xb85e('0x10')+_0x2ff12a[_0xb85e('0xf')]+'}':(_0x9e53a8['prefix']||'')+_0xb85e('0x11');_0x17d212[_0x5b58c5[_0x56ad52]['param']]=[_0xb85e('0x25'),_0x9e53a8[_0xb85e('0x1c')],_0x9e53a8['phone']]['join']('/');break;case _0xb85e('0x26'):_0x9e53a8[_0xb85e('0x26')]=_0x340ab0[_0x5b58c5[_0x56ad52][_0xb85e('0x21')]];if(_0x2ff12a['recordingFormat']!==_0xb85e('0x18')){if(_0x9e53a8[_0xb85e('0x26')][_0xb85e('0x27')]('U(xcally-mixmonitor-context)')<0x0){_0x9e53a8['options']+=_0xb85e('0x28');}}else{_0x9e53a8[_0xb85e('0x26')]=_0x9e53a8['options']['replace']('U(xcally-mixmonitor-context)','');}_0x17d212[_0x5b58c5[_0x56ad52][_0xb85e('0x21')]]=_0x9e53a8[_0xb85e('0x26')];break;default:_0x17d212[_0x5b58c5[_0x56ad52]['param']]=_0x340ab0[_0x5b58c5[_0x56ad52][_0xb85e('0x21')]];}}return _0x17d212[_0xb85e('0x29')](',');}function _0x2acdfc(_0x2b32f2,_0x2056e1,_0x4b6217){return new Promise(function(_0x1a2893,_0x34caaa){var _0x3892c9=[];if(_[_0xb85e('0x2a')](_0x2056e1))return _0x1a2893(_0x3892c9);_0x18290a[_0xb85e('0x2b')][_0xb85e('0x2c')]({'attributes':['id',_0xb85e('0x2d'),_0xb85e('0x2e')],'raw':!![]})['then'](function(_0x343c08){for(var _0x2c6e97=0x0,_0x1e1d02=0x0;_0x2c6e97<_0x2056e1[_0xb85e('0x1f')];_0x2c6e97++,_0x1e1d02=0x0){var _0x1d661d=_0x2056e1[_0x2c6e97];var _0x6169e8=[];var _0x21e3b7=[];delete _0x1d661d['id'];if(_0x1d661d['interval']!==_0xb85e('0x2f')){_0x1d661d[_0xb85e('0x30')]=[_0x1d661d[_0xb85e('0x2d')]];}else{_0x1d661d['intervals']=_0x1d661d[_0xb85e('0x2e')]?_['map'](_[_0xb85e('0x31')](_0x343c08,{'IntervalId':_0x1d661d[_0xb85e('0x2e')]}),_0xb85e('0x2d')):[];}_0x1d661d[_0xb85e('0x6')]=_0x2b32f2['context'];_0x1d661d[_0xb85e('0x7')]=_0x2b32f2['exten'];if(_0x1d661d[_0xb85e('0x8')])_0x1d661d[_0xb85e('0x8')]=_0x1d661d['type'][_0xb85e('0x32')]();if(_0x2b32f2[_0xb85e('0x8')]===_0xb85e('0xd')){if(_0x1d661d['hasOwnProperty'](_0xb85e('0x33'))&&_0x1d661d[_0xb85e('0x33')]&&_0x1d661d[_0xb85e('0x33')]!=='--'){_0x6169e8['push']({'type':_0x1d661d[_0xb85e('0x8')][_0xb85e('0x32')](),'app':_0xb85e('0x4'),'appdata':_0xb85e('0x34')+_0x1d661d[_0xb85e('0x33')],'context':_0x2b32f2['context'],'exten':_0x2b32f2[_0xb85e('0x7')],'priority':_0x1d661d[_0xb85e('0x30')][_0xb85e('0x1f')]+_0x4b6217+_0x1e1d02++,'VoiceExtensionId':_0x2b32f2['id']});}_0x6169e8[_0xb85e('0x9')]({'type':_0x1d661d['type'][_0xb85e('0x32')](),'app':'ExecIf','appdata':_0xb85e('0x35')+(_0x1d661d['callerID']?_0xb85e('0x36')+_0x1d661d['callerID']+')':_0xb85e('0x37')),'context':_0x2b32f2[_0xb85e('0x6')],'exten':_0x2b32f2[_0xb85e('0x7')],'priority':_0x1d661d['intervals'][_0xb85e('0x1f')]+_0x4b6217+_0x1e1d02++,'VoiceExtensionId':_0x2b32f2['id']});}else{if(_0x1d661d[_0xb85e('0x16')]('answer')){if(['queue',_0xb85e('0x38')][_0xb85e('0x39')](_0x1d661d['app'][_0xb85e('0x32')]())&&_0x1d661d['appType']!=='custom'){if(_0x1d661d[_0xb85e('0x3a')]){_0x6169e8['push']({'type':_0x1d661d['type'][_0xb85e('0x32')](),'app':_0xb85e('0x12'),'appdata':_0xb85e('0x3b'),'context':_0x2b32f2[_0xb85e('0x6')],'exten':_0x2b32f2[_0xb85e('0x7')],'priority':_0x1d661d[_0xb85e('0x30')][_0xb85e('0x1f')]+_0x4b6217+_0x1e1d02++,'VoiceExtensionId':_0x2b32f2['id']});_0x6169e8[_0xb85e('0x9')]({'type':_0x1d661d[_0xb85e('0x8')]['toLowerCase'](),'app':_0xb85e('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2b32f2['context'],'exten':_0x2b32f2[_0xb85e('0x7')],'priority':_0x1d661d[_0xb85e('0x30')][_0xb85e('0x1f')]+_0x4b6217+_0x1e1d02++,'VoiceExtensionId':_0x2b32f2['id']});}else{_0x6169e8[_0xb85e('0x9')]({'type':_0x1d661d[_0xb85e('0x8')]['toLowerCase'](),'app':_0xb85e('0x12'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2b32f2['context'],'exten':_0x2b32f2[_0xb85e('0x7')],'priority':_0x1d661d[_0xb85e('0x30')][_0xb85e('0x1f')]+_0x4b6217+_0x1e1d02++,'VoiceExtensionId':_0x2b32f2['id']});_0x6169e8['push']({'type':_0x1d661d['type'][_0xb85e('0x32')](),'app':_0xb85e('0x4'),'appdata':_0xb85e('0x3c'),'context':_0x2b32f2[_0xb85e('0x6')],'exten':_0x2b32f2[_0xb85e('0x7')],'priority':_0x1d661d['intervals'][_0xb85e('0x1f')]+_0x4b6217+_0x1e1d02++,'VoiceExtensionId':_0x2b32f2['id']});}}}}for(var _0x56d4e9=0x0;_0x56d4e9<_0x1d661d[_0xb85e('0x30')][_0xb85e('0x1f')];_0x56d4e9++){var _0x4ae1ea=_0x4b6217+_0x1d661d[_0xb85e('0x30')][_0xb85e('0x1f')];var _0x15cdd0=_0x56d4e9===_0x1d661d[_0xb85e('0x30')]['length']-0x1?_0x4b6217+_0x6169e8['length']+_0x21e3b7[_0xb85e('0x1f')]+0x2:_0x4b6217+_0x56d4e9+0x1;_0x6169e8[_0xb85e('0x3d')](_0x56d4e9,0x0,{'type':_0x2b32f2[_0xb85e('0x8')],'app':_0xb85e('0x3e'),'appdata':_0x1d661d[_0xb85e('0x30')][_0x56d4e9]+'?'+_0x2b32f2[_0xb85e('0x6')]+_0xb85e('0x3f')+_0x4ae1ea+':'+_0x2b32f2[_0xb85e('0x6')]+',${EXTEN},'+_0x15cdd0,'exten':_0x2b32f2['exten'],'context':_0x2b32f2[_0xb85e('0x6')],'priority':_0x4b6217+_0x56d4e9,'VoiceExtensionId':_0x2b32f2['id']});}if(_0x1d661d[_0xb85e('0x40')]===_0xb85e('0x41')){_0x1d661d[_0xb85e('0x42')]=_0x1ce955(_0x2b32f2,_0x1d661d[_0xb85e('0x42')]);}if(_0x1d661d[_0xb85e('0x40')]===_0xb85e('0x43')){_0x6169e8[_0xb85e('0x9')]({'type':_0x1d661d['type'][_0xb85e('0x32')](),'app':_0xb85e('0x4'),'appdata':_0xb85e('0x44'),'context':_0x2b32f2[_0xb85e('0x6')],'exten':_0x2b32f2[_0xb85e('0x7')],'priority':_0x1d661d[_0xb85e('0x30')][_0xb85e('0x1f')]+_0x4b6217+_0x1e1d02++,'VoiceExtensionId':_0x2b32f2['id']});}_0x1d661d[_0xb85e('0x45')]=_0x6169e8[_0xb85e('0x1f')]?_[_0xb85e('0x46')](_0x6169e8)[_0xb85e('0x45')]+0x1:_0x4b6217;_0x3892c9=_[_0xb85e('0x47')](_0x3892c9,_0x6169e8,[_0x1d661d],_0x21e3b7);_0x4b6217=_[_0xb85e('0x46')](_0x3892c9)[_0xb85e('0x45')]+0x1;}return _0x1a2893(_0x3892c9);})['catch'](function(_0x284b16){_0x34caaa(_0x284b16);});});}return _0x3cef85[_0xb85e('0x48')](_0xb85e('0x49'),attributes,{'tableName':_0xb85e('0x4a'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x57676f){var _0x5b958b=this[_0xb85e('0x4b')]({'plain':!![]});var _0x556029=_0x5b958b['type']===_0xb85e('0xd')?_0x56088e(_0x5b958b):_0x408f61(_0x5b958b);return _0x2acdfc(_0x5b958b,_0x57676f,_[_0xb85e('0x46')](_0x556029)[_0xb85e('0x45')]+0x1)[_0xb85e('0x4c')](function(_0xe0d82d){var _0x5e6588=_['concat'](_0x556029,_0xe0d82d);_0x5e6588[_0xb85e('0x9')]({'type':_0x5b958b[_0xb85e('0x8')],'app':_0xb85e('0x4d'),'exten':_0x5b958b[_0xb85e('0x7')],'context':_0x5b958b['context'],'priority':_[_0xb85e('0x46')](_0x5e6588)[_0xb85e('0x45')]+0x1,'VoiceExtensionId':_0x5b958b['id']});return _0x5e6588;});}}});}; \ No newline at end of file +var _0x5a42=['CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','options','url','split','length','name','param','phone','prefix','${EXTEN}','SIP','join','none','indexOf','U(xcally-mixmonitor-context)','replace','findAll','IntervalId','interval','intervals','map','filter','tag','CDR(tag)=','toLowerCase','ExecIf','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','priority','concat','catch','define','VoiceExtension','get','then','Hangup','exports','models','type','Set','CDR(type)=','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','context','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:'];(function(_0x22cf4c,_0x211e44){var _0x2a245f=function(_0x2ed1f4){while(--_0x2ed1f4){_0x22cf4c['push'](_0x22cf4c['shift']());}};_0x2a245f(++_0x211e44);}(_0x5a42,0x178));var _0x25a4=function(_0xda62ee,_0x49d5fd){_0xda62ee=_0xda62ee-0x0;var _0x37bf54=_0x5a42[_0xda62ee];return _0x37bf54;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module[_0x25a4('0x0')]=function(_0x49c16e){var _0x4da545=_0x49c16e[_0x25a4('0x1')];function _0x31ebcd(_0x212b61){var _0x3a4496=0x2;var _0x5af687=[{'type':_0x212b61[_0x25a4('0x2')],'app':_0x25a4('0x3'),'appdata':_0x25a4('0x4')+_0x212b61[_0x25a4('0x2')],'context':_0x212b61['context'],'exten':_0x212b61[_0x25a4('0x5')],'priority':_0x3a4496++,'VoiceExtensionId':_0x212b61['id']}];if(_0x212b61[_0x25a4('0x2')]===_0x25a4('0x6')){_0x5af687[_0x25a4('0x7')]({'type':_0x25a4('0x6'),'app':_0x25a4('0x3'),'appdata':_0x25a4('0x8')+_0x212b61['id'],'context':_0x212b61['context'],'exten':_0x212b61[_0x25a4('0x5')],'priority':_0x3a4496++,'VoiceExtensionId':_0x212b61['id']});}_0x5af687[_0x25a4('0x7')]({'type':_0x212b61[_0x25a4('0x2')],'app':'Set','appdata':_0x25a4('0x9'),'context':_0x212b61[_0x25a4('0xa')],'exten':_0x212b61[_0x25a4('0x5')],'priority':_0x3a4496++,'VoiceExtensionId':_0x212b61['id']},{'type':_0x212b61['type'],'app':_0x25a4('0x3'),'appdata':_0x25a4('0xb'),'context':_0x212b61['context'],'exten':_0x212b61[_0x25a4('0x5')],'priority':_0x3a4496++,'VoiceExtensionId':_0x212b61['id']},{'type':_0x212b61[_0x25a4('0x2')],'app':_0x25a4('0x3'),'appdata':_0x25a4('0xc'),'context':_0x212b61['context'],'exten':_0x212b61[_0x25a4('0x5')],'priority':_0x3a4496++,'VoiceExtensionId':_0x212b61['id']});return _0x5af687;}function _0x452649(_0x4f5930){var _0x82ee96=0x2;var _0x1f8563=[{'type':_0x25a4('0xd'),'app':'Set','appdata':_0x25a4('0xe'),'context':_0x4f5930[_0x25a4('0xa')],'exten':_0x4f5930['exten'],'priority':_0x82ee96++,'VoiceExtensionId':_0x4f5930['id']},{'type':_0x25a4('0xd'),'app':_0x25a4('0x3'),'appdata':_0x25a4('0xf')+(_0x4f5930['cutdigits']?'${EXTEN:'+_0x4f5930[_0x25a4('0x10')]+'}':'${EXTEN}'),'context':_0x4f5930[_0x25a4('0xa')],'exten':_0x4f5930[_0x25a4('0x5')],'priority':_0x82ee96++,'VoiceExtensionId':_0x4f5930['id']},{'type':_0x25a4('0xd'),'app':_0x25a4('0x3'),'appdata':'CDR(routeid)='+_0x4f5930['id'],'context':_0x4f5930[_0x25a4('0xa')],'exten':_0x4f5930[_0x25a4('0x5')],'priority':_0x82ee96++,'VoiceExtensionId':_0x4f5930['id']},{'type':_0x25a4('0xd'),'app':'ExecIf','appdata':_0x25a4('0x11')+(_0x82ee96+0x2)+'):Goto('+(_0x82ee96+0x1)+')','context':_0x4f5930[_0x25a4('0xa')],'exten':_0x4f5930[_0x25a4('0x5')],'priority':_0x82ee96++,'VoiceExtensionId':_0x4f5930['id']},{'type':_0x25a4('0xd'),'app':_0x25a4('0x3'),'appdata':_0x4f5930[_0x25a4('0x10')]?_0x25a4('0x12')+_0x4f5930[_0x25a4('0x10')]+'}':_0x25a4('0x13'),'context':_0x4f5930[_0x25a4('0xa')],'exten':_0x4f5930[_0x25a4('0x5')],'priority':_0x82ee96++,'VoiceExtensionId':_0x4f5930['id']},{'type':'outbound','app':'Set','appdata':_0x25a4('0x9'),'context':_0x4f5930[_0x25a4('0xa')],'exten':_0x4f5930['exten'],'priority':_0x82ee96++,'VoiceExtensionId':_0x4f5930['id']},{'type':_0x25a4('0xd'),'app':_0x25a4('0x3'),'appdata':_0x25a4('0xb'),'context':_0x4f5930[_0x25a4('0xa')],'exten':_0x4f5930[_0x25a4('0x5')],'priority':_0x82ee96++,'VoiceExtensionId':_0x4f5930['id']},{'type':_0x25a4('0xd'),'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x4f5930[_0x25a4('0xa')],'exten':_0x4f5930[_0x25a4('0x5')],'priority':_0x82ee96++,'VoiceExtensionId':_0x4f5930['id']},{'type':_0x25a4('0xd'),'app':_0x25a4('0x3'),'appdata':_0x25a4('0x14')+_0x4f5930['id'],'context':_0x4f5930[_0x25a4('0xa')],'exten':_0x4f5930['exten'],'priority':_0x82ee96++,'VoiceExtensionId':_0x4f5930['id']}];if(_0x4f5930[_0x25a4('0x15')](_0x25a4('0x16'))&&_0x4f5930[_0x25a4('0x16')]!=='none'){_0x1f8563[_0x25a4('0x7')]({'type':'outbound','app':'Set','appdata':_0x25a4('0x17'),'context':_0x4f5930[_0x25a4('0xa')],'exten':_0x4f5930[_0x25a4('0x5')],'priority':_0x82ee96++,'VoiceExtensionId':_0x4f5930['id']},{'type':_0x25a4('0xd'),'app':_0x25a4('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4f5930[_0x25a4('0x16')]||_0x25a4('0x18'),'context':_0x4f5930[_0x25a4('0xa')],'exten':_0x4f5930[_0x25a4('0x5')],'priority':_0x82ee96++,'VoiceExtensionId':_0x4f5930['id']});}return _0x1f8563;}function _0x5ed5b7(_0x142666,_0x1ad5c4){var _0x596538=[{'name':_0x25a4('0x19'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x25a4('0x1a'),'param':0x2},{'name':_0x25a4('0x1b'),'param':0x3}];var _0x58335c={};var _0x2f3b6a=_0x1ad5c4[_0x25a4('0x1c')](',');var _0x289baa=[];for(var _0x141e17=0x0;_0x141e17<_0x596538[_0x25a4('0x1d')];_0x141e17++){switch(_0x596538[_0x141e17][_0x25a4('0x1e')]){case _0x25a4('0x19'):_0x58335c['trunk']=_0x2f3b6a[_0x596538[_0x141e17][_0x25a4('0x1f')]][_0x25a4('0x1c')]('/')[0x1];_0x58335c[_0x25a4('0x20')]=_0x2f3b6a[_0x596538[_0x141e17][_0x25a4('0x1f')]][_0x25a4('0x1c')]('/')[0x2];_0x58335c[_0x25a4('0x21')]=_0x58335c[_0x25a4('0x20')]?_0x58335c[_0x25a4('0x20')][_0x25a4('0x1c')]('$')[0x0]:undefined;_0x58335c['phone']=_0x142666['cutdigits']?(_0x58335c[_0x25a4('0x21')]||'')+'${EXTEN:'+_0x142666[_0x25a4('0x10')]+'}':(_0x58335c[_0x25a4('0x21')]||'')+_0x25a4('0x22');_0x289baa[_0x596538[_0x141e17][_0x25a4('0x1f')]]=[_0x25a4('0x23'),_0x58335c[_0x25a4('0x19')],_0x58335c[_0x25a4('0x20')]][_0x25a4('0x24')]('/');break;case'options':_0x58335c['options']=_0x2f3b6a[_0x596538[_0x141e17][_0x25a4('0x1f')]];if(_0x142666[_0x25a4('0x16')]!==_0x25a4('0x25')){if(_0x58335c['options'][_0x25a4('0x26')](_0x25a4('0x27'))<0x0){_0x58335c['options']+='U(xcally-mixmonitor-context)';}}else{_0x58335c[_0x25a4('0x1a')]=_0x58335c['options'][_0x25a4('0x28')](_0x25a4('0x27'),'');}_0x289baa[_0x596538[_0x141e17]['param']]=_0x58335c[_0x25a4('0x1a')];break;default:_0x289baa[_0x596538[_0x141e17][_0x25a4('0x1f')]]=_0x2f3b6a[_0x596538[_0x141e17][_0x25a4('0x1f')]];}}return _0x289baa['join'](',');}function _0x6c4628(_0x142dd7,_0x165d4a,_0x3a3df2){return new Promise(function(_0x2d2180,_0x1fe5e1){var _0x3b3514=[];if(_['isEmpty'](_0x165d4a))return _0x2d2180(_0x3b3514);_0x4da545['Interval'][_0x25a4('0x29')]({'attributes':['id','interval',_0x25a4('0x2a')],'raw':!![]})['then'](function(_0x1b3f16){for(var _0x475fec=0x0,_0x55f5e1=0x0;_0x475fec<_0x165d4a[_0x25a4('0x1d')];_0x475fec++,_0x55f5e1=0x0){var _0x432672=_0x165d4a[_0x475fec];var _0x2fb857=[];var _0x458470=[];delete _0x432672['id'];if(_0x432672[_0x25a4('0x2b')]!=='*,*,*,*'){_0x432672[_0x25a4('0x2c')]=[_0x432672[_0x25a4('0x2b')]];}else{_0x432672[_0x25a4('0x2c')]=_0x432672[_0x25a4('0x2a')]?_[_0x25a4('0x2d')](_[_0x25a4('0x2e')](_0x1b3f16,{'IntervalId':_0x432672[_0x25a4('0x2a')]}),'interval'):[];}_0x432672[_0x25a4('0xa')]=_0x142dd7[_0x25a4('0xa')];_0x432672[_0x25a4('0x5')]=_0x142dd7[_0x25a4('0x5')];if(_0x432672[_0x25a4('0x2')])_0x432672[_0x25a4('0x2')]=_0x432672[_0x25a4('0x2')]['toLowerCase']();if(_0x142dd7['type']===_0x25a4('0xd')){if(_0x432672[_0x25a4('0x15')](_0x25a4('0x2f'))&&_0x432672[_0x25a4('0x2f')]&&_0x432672['tag']!=='--'){_0x2fb857[_0x25a4('0x7')]({'type':_0x432672[_0x25a4('0x2')]['toLowerCase'](),'app':_0x25a4('0x3'),'appdata':_0x25a4('0x30')+_0x432672['tag'],'context':_0x142dd7['context'],'exten':_0x142dd7[_0x25a4('0x5')],'priority':_0x432672['intervals']['length']+_0x3a3df2+_0x55f5e1++,'VoiceExtensionId':_0x142dd7['id']});}_0x2fb857[_0x25a4('0x7')]({'type':_0x432672[_0x25a4('0x2')][_0x25a4('0x31')](),'app':_0x25a4('0x32'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x432672['callerID']?_0x25a4('0x33')+_0x432672[_0x25a4('0x34')]+')':_0x25a4('0x35')),'context':_0x142dd7['context'],'exten':_0x142dd7['exten'],'priority':_0x432672[_0x25a4('0x2c')][_0x25a4('0x1d')]+_0x3a3df2+_0x55f5e1++,'VoiceExtensionId':_0x142dd7['id']});}else{if(_0x432672['hasOwnProperty'](_0x25a4('0x36'))){if([_0x25a4('0x37'),_0x25a4('0x38')][_0x25a4('0x39')](_0x432672[_0x25a4('0x3a')]['toLowerCase']())&&_0x432672[_0x25a4('0x3b')]!==_0x25a4('0x3c')){if(_0x432672[_0x25a4('0x36')]){_0x2fb857['push']({'type':_0x432672[_0x25a4('0x2')]['toLowerCase'](),'app':_0x25a4('0x32'),'appdata':_0x25a4('0x3d'),'context':_0x142dd7[_0x25a4('0xa')],'exten':_0x142dd7[_0x25a4('0x5')],'priority':_0x432672['intervals'][_0x25a4('0x1d')]+_0x3a3df2+_0x55f5e1++,'VoiceExtensionId':_0x142dd7['id']});_0x2fb857[_0x25a4('0x7')]({'type':_0x432672[_0x25a4('0x2')]['toLowerCase'](),'app':_0x25a4('0x3'),'appdata':_0x25a4('0x3e'),'context':_0x142dd7[_0x25a4('0xa')],'exten':_0x142dd7[_0x25a4('0x5')],'priority':_0x432672['intervals'][_0x25a4('0x1d')]+_0x3a3df2+_0x55f5e1++,'VoiceExtensionId':_0x142dd7['id']});}else{_0x2fb857['push']({'type':_0x432672[_0x25a4('0x2')]['toLowerCase'](),'app':_0x25a4('0x32'),'appdata':_0x25a4('0x3f'),'context':_0x142dd7[_0x25a4('0xa')],'exten':_0x142dd7['exten'],'priority':_0x432672[_0x25a4('0x2c')][_0x25a4('0x1d')]+_0x3a3df2+_0x55f5e1++,'VoiceExtensionId':_0x142dd7['id']});_0x2fb857[_0x25a4('0x7')]({'type':_0x432672[_0x25a4('0x2')]['toLowerCase'](),'app':_0x25a4('0x3'),'appdata':_0x25a4('0x40'),'context':_0x142dd7[_0x25a4('0xa')],'exten':_0x142dd7[_0x25a4('0x5')],'priority':_0x432672['intervals'][_0x25a4('0x1d')]+_0x3a3df2+_0x55f5e1++,'VoiceExtensionId':_0x142dd7['id']});}}}}for(var _0x49ff28=0x0;_0x49ff28<_0x432672[_0x25a4('0x2c')][_0x25a4('0x1d')];_0x49ff28++){var _0x4d6705=_0x3a3df2+_0x432672[_0x25a4('0x2c')][_0x25a4('0x1d')];var _0x3351a5=_0x49ff28===_0x432672['intervals']['length']-0x1?_0x3a3df2+_0x2fb857[_0x25a4('0x1d')]+_0x458470[_0x25a4('0x1d')]+0x2:_0x3a3df2+_0x49ff28+0x1;_0x2fb857[_0x25a4('0x41')](_0x49ff28,0x0,{'type':_0x142dd7[_0x25a4('0x2')],'app':'GotoIfTime','appdata':_0x432672[_0x25a4('0x2c')][_0x49ff28]+'?'+_0x142dd7[_0x25a4('0xa')]+_0x25a4('0x42')+_0x4d6705+':'+_0x142dd7[_0x25a4('0xa')]+',${EXTEN},'+_0x3351a5,'exten':_0x142dd7['exten'],'context':_0x142dd7[_0x25a4('0xa')],'priority':_0x3a3df2+_0x49ff28,'VoiceExtensionId':_0x142dd7['id']});}if(_0x432672[_0x25a4('0x3b')]==='outboundDial'){_0x432672[_0x25a4('0x43')]=_0x5ed5b7(_0x142dd7,_0x432672[_0x25a4('0x43')]);}if(_0x432672[_0x25a4('0x3b')]===_0x25a4('0x44')){_0x2fb857[_0x25a4('0x7')]({'type':_0x432672[_0x25a4('0x2')][_0x25a4('0x31')](),'app':_0x25a4('0x3'),'appdata':_0x25a4('0x45'),'context':_0x142dd7['context'],'exten':_0x142dd7[_0x25a4('0x5')],'priority':_0x432672[_0x25a4('0x2c')]['length']+_0x3a3df2+_0x55f5e1++,'VoiceExtensionId':_0x142dd7['id']});}_0x432672['priority']=_0x2fb857[_0x25a4('0x1d')]?_[_0x25a4('0x46')](_0x2fb857)[_0x25a4('0x47')]+0x1:_0x3a3df2;_0x3b3514=_[_0x25a4('0x48')](_0x3b3514,_0x2fb857,[_0x432672],_0x458470);_0x3a3df2=_[_0x25a4('0x46')](_0x3b3514)[_0x25a4('0x47')]+0x1;}return _0x2d2180(_0x3b3514);})[_0x25a4('0x49')](function(_0x6482fc){_0x1fe5e1(_0x6482fc);});});}return _0x49c16e[_0x25a4('0x4a')](_0x25a4('0x4b'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x44dc69){var _0x4c2018=this[_0x25a4('0x4c')]({'plain':!![]});var _0xd290ce=_0x4c2018[_0x25a4('0x2')]===_0x25a4('0xd')?_0x452649(_0x4c2018):_0x31ebcd(_0x4c2018);return _0x6c4628(_0x4c2018,_0x44dc69,_[_0x25a4('0x46')](_0xd290ce)[_0x25a4('0x47')]+0x1)[_0x25a4('0x4d')](function(_0x35396e){var _0x5a73bd=_['concat'](_0xd290ce,_0x35396e);_0x5a73bd['push']({'type':_0x4c2018[_0x25a4('0x2')],'app':_0x25a4('0x4e'),'exten':_0x4c2018['exten'],'context':_0x4c2018['context'],'priority':_[_0x25a4('0x46')](_0x5a73bd)[_0x25a4('0x47')]+0x1,'VoiceExtensionId':_0x4c2018['id']});return _0x5a73bd;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 889acc5..5c4e8a4 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 _0xa74a=['defaults','socket.io-emitter','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis'];(function(_0x208114,_0x457d9b){var _0x1cf414=function(_0x2717cc){while(--_0x2717cc){_0x208114['push'](_0x208114['shift']());}};_0x1cf414(++_0x457d9b);}(_0xa74a,0x66));var _0xaa74=function(_0xa3b0d3,_0x10ef05){_0xa3b0d3=_0xa3b0d3-0x0;var _0x5d1812=_0xa74a[_0xa3b0d3];return _0x5d1812;};'use strict';var _=require(_0xaa74('0x0'));var util=require(_0xaa74('0x1'));var moment=require(_0xaa74('0x2'));var BPromise=require(_0xaa74('0x3'));var rs=require(_0xaa74('0x4'));var fs=require('fs');var Redis=require(_0xaa74('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa74('0x6'));var logger=require(_0xaa74('0x7'))(_0xaa74('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaa74('0x9')][_0xaa74('0xa')]({'port':0x232a});config[_0xaa74('0xb')]=_[_0xaa74('0xc')](config[_0xaa74('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa74('0xd'))(new Redis(config['redis']));require(_0xaa74('0xe'))['register'](socket);function respondWithRpcPromise(_0x29771f,_0xbe2a51,_0x4e5c4e){return new BPromise(function(_0x45fb8b,_0x54a9af){return client[_0xaa74('0xf')](_0x29771f,_0x4e5c4e)[_0xaa74('0x10')](function(_0x53c345){logger[_0xaa74('0x11')](_0xaa74('0x12'),_0xbe2a51,_0xaa74('0x13'));logger[_0xaa74('0x14')](_0xaa74('0x15'),_0xbe2a51,_0xaa74('0x13'),JSON[_0xaa74('0x16')](_0x53c345));if(_0x53c345[_0xaa74('0x17')]){if(_0x53c345[_0xaa74('0x17')][_0xaa74('0x18')]===0x1f4){logger[_0xaa74('0x17')]('VoiceExtension,\x20%s,\x20%s',_0xbe2a51,_0x53c345[_0xaa74('0x17')][_0xaa74('0x19')]);return _0x54a9af(_0x53c345['error'][_0xaa74('0x19')]);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0xbe2a51,_0x53c345['error']['message']);return _0x45fb8b(_0x53c345[_0xaa74('0x17')][_0xaa74('0x19')]);}else{logger[_0xaa74('0x11')]('VoiceExtension,\x20%s,\x20%s',_0xbe2a51,_0xaa74('0x13'));_0x45fb8b(_0x53c345[_0xaa74('0x1a')][_0xaa74('0x19')]);}})['catch'](function(_0x5f52a6){logger['error']('VoiceExtension,\x20%s,\x20%s',_0xbe2a51,_0x5f52a6);_0x54a9af(_0x5f52a6);});});}exports[_0xaa74('0x1b')]=function(_0x163f06){var _0x2c27dd=this;return new Promise(function(_0x18b71a,_0xcfc5ba){return db[_0xaa74('0x1c')][_0xaa74('0x1d')]({'raw':_0x163f06[_0xaa74('0x1e')]?_0x163f06['options'][_0xaa74('0x1f')]===undefined?!![]:![]:!![],'where':_0x163f06[_0xaa74('0x1e')]?_0x163f06[_0xaa74('0x1e')][_0xaa74('0x20')]||null:null,'attributes':_0x163f06[_0xaa74('0x1e')]?_0x163f06[_0xaa74('0x1e')][_0xaa74('0x21')]||null:null,'limit':_0x163f06[_0xaa74('0x1e')]?_0x163f06[_0xaa74('0x1e')][_0xaa74('0x22')]||null:null,'include':_0x163f06['options']?_0x163f06[_0xaa74('0x1e')][_0xaa74('0x23')]?_['map'](_0x163f06[_0xaa74('0x1e')]['include'],function(_0x44c2f7){return{'model':db[_0x44c2f7[_0xaa74('0x24')]],'as':_0x44c2f7['as'],'attributes':_0x44c2f7['attributes'],'include':_0x44c2f7[_0xaa74('0x23')]?_[_0xaa74('0x25')](_0x44c2f7['include'],function(_0x5b4738){return{'model':db[_0x5b4738[_0xaa74('0x24')]],'as':_0x5b4738['as'],'attributes':_0x5b4738['attributes'],'include':_0x5b4738[_0xaa74('0x23')]?_[_0xaa74('0x25')](_0x5b4738['include'],function(_0x40bc29){return{'model':db[_0x40bc29[_0xaa74('0x24')]],'as':_0x40bc29['as'],'attributes':_0x40bc29['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x34c982){logger[_0xaa74('0x11')](_0xaa74('0x1b'),_0x163f06);logger[_0xaa74('0x14')](_0xaa74('0x1b'),_0x163f06,JSON[_0xaa74('0x16')](_0x34c982));_0x18b71a(_0x34c982);})['catch'](function(_0x1682e3){logger['error'](_0xaa74('0x1b'),_0x1682e3['message'],_0x163f06);_0xcfc5ba(_0x2c27dd[_0xaa74('0x17')](0x1f4,_0x1682e3[_0xaa74('0x19')]));});});}; \ No newline at end of file +var _0x103f=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','info','request\x20sent','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','include','map','attributes','model','debug','lodash','util'];(function(_0x3a331e,_0x7db48b){var _0x2684a6=function(_0x5be55d){while(--_0x5be55d){_0x3a331e['push'](_0x3a331e['shift']());}};_0x2684a6(++_0x7db48b);}(_0x103f,0x13e));var _0xf103=function(_0x5aab45,_0x5d9dc8){_0x5aab45=_0x5aab45-0x0;var _0x1066cc=_0x103f[_0x5aab45];return _0x1066cc;};'use strict';var _=require(_0xf103('0x0'));var util=require(_0xf103('0x1'));var moment=require(_0xf103('0x2'));var BPromise=require(_0xf103('0x3'));var rs=require(_0xf103('0x4'));var fs=require('fs');var Redis=require(_0xf103('0x5'));var db=require(_0xf103('0x6'))['db'];var utils=require(_0xf103('0x7'));var logger=require(_0xf103('0x8'))(_0xf103('0x9'));var config=require('../../config/environment');var jayson=require(_0xf103('0xa'));var client=jayson[_0xf103('0xb')][_0xf103('0xc')]({'port':0x232a});config[_0xf103('0xd')]=_[_0xf103('0xe')](config[_0xf103('0xd')],{'host':_0xf103('0xf'),'port':0x18eb});var socket=require(_0xf103('0x10'))(new Redis(config[_0xf103('0xd')]));require(_0xf103('0x11'))[_0xf103('0x12')](socket);function respondWithRpcPromise(_0x267ec4,_0x47b71b,_0x228805){return new BPromise(function(_0x532559,_0x2aa8fd){return client['request'](_0x267ec4,_0x228805)['then'](function(_0xb3a849){logger[_0xf103('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x47b71b,_0xf103('0x14'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x47b71b,'request\x20sent',JSON[_0xf103('0x15')](_0xb3a849));if(_0xb3a849['error']){if(_0xb3a849[_0xf103('0x16')][_0xf103('0x17')]===0x1f4){logger['error'](_0xf103('0x18'),_0x47b71b,_0xb3a849[_0xf103('0x16')]['message']);return _0x2aa8fd(_0xb3a849[_0xf103('0x16')][_0xf103('0x19')]);}logger['error'](_0xf103('0x18'),_0x47b71b,_0xb3a849['error']['message']);return _0x532559(_0xb3a849[_0xf103('0x16')][_0xf103('0x19')]);}else{logger[_0xf103('0x13')](_0xf103('0x18'),_0x47b71b,_0xf103('0x14'));_0x532559(_0xb3a849[_0xf103('0x1a')]['message']);}})[_0xf103('0x1b')](function(_0x338a44){logger['error'](_0xf103('0x18'),_0x47b71b,_0x338a44);_0x2aa8fd(_0x338a44);});});}exports[_0xf103('0x1c')]=function(_0x280aeb){var _0x40418e=this;return new Promise(function(_0xebb4ae,_0x5d28e9){return db[_0xf103('0x1d')][_0xf103('0x1e')]({'raw':_0x280aeb[_0xf103('0x1f')]?_0x280aeb[_0xf103('0x1f')][_0xf103('0x20')]===undefined?!![]:![]:!![],'where':_0x280aeb[_0xf103('0x1f')]?_0x280aeb[_0xf103('0x1f')][_0xf103('0x21')]||null:null,'attributes':_0x280aeb['options']?_0x280aeb[_0xf103('0x1f')]['attributes']||null:null,'limit':_0x280aeb[_0xf103('0x1f')]?_0x280aeb['options'][_0xf103('0x22')]||null:null,'include':_0x280aeb[_0xf103('0x1f')]?_0x280aeb[_0xf103('0x1f')][_0xf103('0x23')]?_[_0xf103('0x24')](_0x280aeb[_0xf103('0x1f')][_0xf103('0x23')],function(_0x259797){return{'model':db[_0x259797['model']],'as':_0x259797['as'],'attributes':_0x259797[_0xf103('0x25')],'include':_0x259797['include']?_[_0xf103('0x24')](_0x259797['include'],function(_0x4423a4){return{'model':db[_0x4423a4[_0xf103('0x26')]],'as':_0x4423a4['as'],'attributes':_0x4423a4[_0xf103('0x25')],'include':_0x4423a4[_0xf103('0x23')]?_['map'](_0x4423a4[_0xf103('0x23')],function(_0x1d3cdd){return{'model':db[_0x1d3cdd[_0xf103('0x26')]],'as':_0x1d3cdd['as'],'attributes':_0x1d3cdd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b0a13){logger[_0xf103('0x13')]('GetVoiceExtension',_0x280aeb);logger[_0xf103('0x27')](_0xf103('0x1c'),_0x280aeb,JSON[_0xf103('0x15')](_0x1b0a13));_0xebb4ae(_0x1b0a13);})[_0xf103('0x1b')](function(_0x5becbe){logger['error']('GetVoiceExtension',_0x5becbe['message'],_0x280aeb);_0x5d28e9(_0x40418e[_0xf103('0x16')](0x1f4,_0x5becbe['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 880105d..906c6ff 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 _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0xd631cf,_0x1b87b1){var _0x304d61=function(_0x116c32){while(--_0x116c32){_0xd631cf['push'](_0xd631cf['shift']());}};_0x304d61(++_0x1b87b1);}(_0x1261,0x144));var _0x1126=function(_0x507b3b,_0x30c190){_0x507b3b=_0x507b3b-0x0;var _0xe1e48e=_0x1261[_0x507b3b];return _0xe1e48e;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file +var _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0xd5307f,_0x4d1fe9){var _0x39d3d4=function(_0x40c4e1){while(--_0x40c4e1){_0xd5307f['push'](_0xd5307f['shift']());}};_0x39d3d4(++_0x4d1fe9);}(_0x5fc3,0xa8));var _0x35fc=function(_0x102977,_0x3a99a6){_0x102977=_0x102977-0x0;var _0x15c466=_0x5fc3[_0x102977];return _0x15c466;};'use strict';var VoiceExtensionEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){VoiceExtensionEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);VoiceExtensionEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 940653a..fbf9feb 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 _0x6a55=['isAuthenticated','index','/:id','show','getMessages','post','create','put','update','destroy','exports','multer','express','../../components/auth/service','../../config/environment','get'];(function(_0xd1a252,_0x16396f){var _0x560ee1=function(_0x35dd90){while(--_0x35dd90){_0xd1a252['push'](_0xd1a252['shift']());}};_0x560ee1(++_0x16396f);}(_0x6a55,0xdb));var _0x56a5=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x6a55[_0x2faddb];return _0x273c05;};'use strict';var multer=require(_0x56a5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56a5('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x56a5('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x56a5('0x3'));var controller=require('./voiceMail.controller');router[_0x56a5('0x4')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0x6')]);router[_0x56a5('0x4')](_0x56a5('0x7'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x8')]);router[_0x56a5('0x4')]('/:id/messages',auth[_0x56a5('0x5')](),controller[_0x56a5('0x9')]);router[_0x56a5('0xa')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0xb')]);router[_0x56a5('0xc')](_0x56a5('0x7'),auth[_0x56a5('0x5')](),controller[_0x56a5('0xd')]);router['delete']('/:id',auth[_0x56a5('0x5')](),controller[_0x56a5('0xe')]);module[_0x56a5('0xf')]=router; \ No newline at end of file +var _0xe2fe=['show','/:id/messages','post','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./voiceMail.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['getMessages']);router[_0xee2f('0xc')]('/',auth[_0xee2f('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xe')]);module[_0xee2f('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 456522a..09fb8fe 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 _0xb7d9=['from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','mailbox','sequelize','exports','STRING'];(function(_0x125c96,_0x22f7f7){var _0x4f8412=function(_0x5c69f1){while(--_0x5c69f1){_0x125c96['push'](_0x125c96['shift']());}};_0x4f8412(++_0x22f7f7);}(_0xb7d9,0xd5));var _0x9b7d=function(_0x2b7fe1,_0x278871){_0x2b7fe1=_0x2b7fe1-0x0;var _0x4232ca=_0xb7d9[_0x2b7fe1];return _0x4232ca;};'use strict';var Sequelize=require(_0x9b7d('0x0'));module[_0x9b7d('0x1')]={'customer_id':{'type':Sequelize[_0x9b7d('0x2')]},'context':{'type':Sequelize[_0x9b7d('0x2')],'defaultValue':_0x9b7d('0x3'),'unique':_0x9b7d('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x9b7d('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9b7d('0x2')],'validate':{'isEmail':!![]},'set':function(_0x3b20a3){this[_0x9b7d('0x5')](_0x9b7d('0x6'),typeof _0x3b20a3===_0x9b7d('0x7')&&_0x3b20a3[_0x9b7d('0x8')]()?_0x3b20a3[_0x9b7d('0x8')]():null);}},'pager':{'type':Sequelize[_0x9b7d('0x2')]},'tz':{'type':Sequelize[_0x9b7d('0x2')],'defaultValue':_0x9b7d('0x9')},'attach':{'type':Sequelize[_0x9b7d('0xa')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x9b7d('0xa')]('yes','no'),'defaultValue':_0x9b7d('0xb'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x9b7d('0x2')]},'review':{'type':Sequelize[_0x9b7d('0xa')](_0x9b7d('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x9b7d('0xa')](_0x9b7d('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x9b7d('0xa')](_0x9b7d('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9b7d('0xa')](_0x9b7d('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x9b7d('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x9b7d('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9b7d('0xa')](_0x9b7d('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x9b7d('0xb'),'no'),'defaultValue':_0x9b7d('0xb'),'allowNull':![]},'forcename':{'type':Sequelize[_0x9b7d('0xa')](_0x9b7d('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x9b7d('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x9b7d('0xb'),'no'),'defaultValue':_0x9b7d('0xb'),'allowNull':![]},'stamp':{'type':_0x9b7d('0xd')},'emailsubject':{'type':Sequelize[_0x9b7d('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x9b7d('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9b7d('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9b7d('0xf')],'get':function(){return this['getDataValue'](_0x9b7d('0x10'))+'\x20-\x20'+this['getDataValue'](_0x9b7d('0x11'));}}}; \ No newline at end of file +var _0x5b49=['fullname','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER'];(function(_0x2b7cad,_0x3f915b){var _0x51f303=function(_0x53b60e){while(--_0x53b60e){_0x2b7cad['push'](_0x2b7cad['shift']());}};_0x51f303(++_0x3f915b);}(_0x5b49,0x103));var _0x95b4=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x5b49[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require(_0x95b4('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x95b4('0x1')]},'context':{'type':Sequelize[_0x95b4('0x1')],'defaultValue':_0x95b4('0x2'),'unique':_0x95b4('0x3')},'mailbox':{'type':Sequelize[_0x95b4('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x95b4('0x1')]},'email':{'type':Sequelize[_0x95b4('0x1')],'validate':{'isEmail':!![]},'set':function(_0x1a6aeb){this[_0x95b4('0x4')](_0x95b4('0x5'),typeof _0x1a6aeb===_0x95b4('0x6')&&_0x1a6aeb['trim']()?_0x1a6aeb['trim']():null);}},'pager':{'type':Sequelize[_0x95b4('0x1')]},'tz':{'type':Sequelize[_0x95b4('0x1')],'defaultValue':_0x95b4('0x7')},'attach':{'type':Sequelize[_0x95b4('0x8')](_0x95b4('0x9'),'no'),'defaultValue':_0x95b4('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x95b4('0x8')](_0x95b4('0x9'),'no'),'defaultValue':_0x95b4('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x95b4('0x1')]},'callback':{'type':Sequelize[_0x95b4('0x1')]},'review':{'type':Sequelize[_0x95b4('0x8')](_0x95b4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x95b4('0x8')](_0x95b4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x95b4('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x95b4('0x8')](_0x95b4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x95b4('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x95b4('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x95b4('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x95b4('0x8')](_0x95b4('0x9'),'no'),'defaultValue':_0x95b4('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x95b4('0x8')](_0x95b4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x95b4('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x95b4('0xb')},'emailsubject':{'type':Sequelize[_0x95b4('0x1')]},'emailbody':{'type':Sequelize[_0x95b4('0x1')]},'maxsecs':{'type':Sequelize[_0x95b4('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x95b4('0xd'))+_0x95b4('0xe')+this['getDataValue'](_0x95b4('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 3c52311..44d8f51 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 _0x6f7a=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','Voicemails','destroy','then','sendStatus','error','stack','name','send','index','VoiceMail','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll'];(function(_0x1623a6,_0x1f0750){var _0x1baed0=function(_0x5d105a){while(--_0x5d105a){_0x1623a6['push'](_0x1623a6['shift']());}};_0x1baed0(++_0x1f0750);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0xad5e23,_0x546054){_0xad5e23=_0xad5e23-0x0;var _0x5f45ab=_0x6f7a[_0xad5e23];return _0x5f45ab;};'use strict';var emlformat=require(_0xa6f7('0x0'));var rimraf=require(_0xa6f7('0x1'));var zipdir=require(_0xa6f7('0x2'));var jsonpatch=require(_0xa6f7('0x3'));var rp=require('request-promise');var moment=require(_0xa6f7('0x4'));var BPromise=require(_0xa6f7('0x5'));var Mustache=require(_0xa6f7('0x6'));var util=require(_0xa6f7('0x7'));var path=require(_0xa6f7('0x8'));var sox=require(_0xa6f7('0x9'));var csv=require(_0xa6f7('0xa'));var ejs=require(_0xa6f7('0xb'));var fs=require('fs');var fs_extra=require(_0xa6f7('0xc'));var _=require(_0xa6f7('0xd'));var squel=require(_0xa6f7('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa6f7('0xf'));var toCsv=require(_0xa6f7('0xa'));var querystring=require(_0xa6f7('0x10'));var Papa=require(_0xa6f7('0x11'));var Redis=require(_0xa6f7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa6f7('0x13'));var hardwareService=require(_0xa6f7('0x14'));var logger=require('../../config/logger')(_0xa6f7('0x15'));var utils=require('../../config/utils');var config=require(_0xa6f7('0x16'));var licenseUtil=require(_0xa6f7('0x17'));var db=require(_0xa6f7('0x18'))['db'];function respondWithStatusCode(_0xd5558b,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x3fc7f1){if(_0x3fc7f1){return _0xd5558b['sendStatus'](_0x5a3035);}return _0xd5558b[_0xa6f7('0x19')](_0x5a3035)[_0xa6f7('0x1a')]();};}function respondWithResult(_0x25c123,_0x4d3d59){_0x4d3d59=_0x4d3d59||0xc8;return function(_0x34c02d){if(_0x34c02d){return _0x25c123['status'](_0x4d3d59)[_0xa6f7('0x1b')](_0x34c02d);}};}function respondWithFilteredResult(_0x57308a,_0x17b814){return function(_0x17f9c5){if(_0x17f9c5){var _0x6efd38=typeof _0x17b814['offset']===_0xa6f7('0x1c')&&typeof _0x17b814[_0xa6f7('0x1d')]===_0xa6f7('0x1c');var _0x2401b9=_0x17f9c5['count'];var _0x4a8827=_0x6efd38?0x0:_0x17b814[_0xa6f7('0x1e')];var _0x5298ba=_0x6efd38?_0x17f9c5[_0xa6f7('0x1f')]:_0x17b814[_0xa6f7('0x1e')]+_0x17b814['limit'];var _0x18fc4a;if(_0x5298ba>=_0x2401b9){_0x5298ba=_0x2401b9;_0x18fc4a=0xc8;}else{_0x18fc4a=0xce;}_0x57308a[_0xa6f7('0x19')](_0x18fc4a);return _0x57308a[_0xa6f7('0x20')](_0xa6f7('0x21'),_0x4a8827+'-'+_0x5298ba+'/'+_0x2401b9)[_0xa6f7('0x1b')](_0x17f9c5);}return null;};}function patchUpdates(_0x1aa8dc){return function(_0x4887ad){try{jsonpatch[_0xa6f7('0x22')](_0x4887ad,_0x1aa8dc,!![]);}catch(_0x45d79e){return BPromise['reject'](_0x45d79e);}return _0x4887ad['save']();};}function saveUpdates(_0x5ddc8d,_0x1de6c9){return function(_0x119950){if(_0x119950){return _0x119950['update'](_0x5ddc8d)['then'](function(_0x50e2be){return _0x50e2be;});}return null;};}function removeEntity(_0x2b6a84,_0xc77e8e){return function(_0x28263e){if(_0x28263e){return _0x28263e['destroy']()['then'](function(){var _0x2f4907=_0x28263e['get']({'plain':!![]});var _0x47ef97=_0xa6f7('0x23');return db['UserProfileResource'][_0xa6f7('0x24')]({'where':{'type':_0x47ef97,'resourceId':_0x2f4907['id']}})[_0xa6f7('0x25')](function(){return _0x28263e;});})[_0xa6f7('0x25')](function(){_0x2b6a84[_0xa6f7('0x19')](0xcc)[_0xa6f7('0x1a')]();});}};}function handleEntityNotFound(_0x4b8d2b,_0x51db47){return function(_0x1c419b){if(!_0x1c419b){_0x4b8d2b[_0xa6f7('0x26')](0x194);}return _0x1c419b;};}function handleError(_0x55d45a,_0x267917){_0x267917=_0x267917||0x1f4;return function(_0x27babb){logger[_0xa6f7('0x27')](_0x27babb[_0xa6f7('0x28')]);if(_0x27babb[_0xa6f7('0x29')]){delete _0x27babb[_0xa6f7('0x29')];}_0x55d45a[_0xa6f7('0x19')](_0x267917)[_0xa6f7('0x2a')](_0x27babb);};}exports[_0xa6f7('0x2b')]=function(_0x3dee2e,_0x40b0f8){var _0x278bad={},_0x52f9c1={},_0x442ccf={'count':0x0,'rows':[]};var _0x42dc49=_['map'](db[_0xa6f7('0x2c')][_0xa6f7('0x2d')],function(_0x4d79d8){return{'name':_0x4d79d8['fieldName'],'type':_0x4d79d8[_0xa6f7('0x2e')][_0xa6f7('0x2f')]};});_0x52f9c1[_0xa6f7('0x30')]=_[_0xa6f7('0x31')](_0x42dc49,_0xa6f7('0x29'));_0x52f9c1['query']=_['keys'](_0x3dee2e[_0xa6f7('0x32')]);_0x52f9c1['filters']=_[_0xa6f7('0x33')](_0x52f9c1[_0xa6f7('0x30')],_0x52f9c1[_0xa6f7('0x32')]);_0x278bad[_0xa6f7('0x34')]=_[_0xa6f7('0x33')](_0x52f9c1[_0xa6f7('0x30')],qs['fields'](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x35')]));_0x278bad[_0xa6f7('0x34')]=_0x278bad['attributes'][_0xa6f7('0x36')]?_0x278bad['attributes']:_0x52f9c1[_0xa6f7('0x30')];if(!_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x37')]('nolimit')){_0x278bad[_0xa6f7('0x1d')]=qs[_0xa6f7('0x1d')](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x1d')]);_0x278bad[_0xa6f7('0x1e')]=qs[_0xa6f7('0x1e')](_0x3dee2e['query'][_0xa6f7('0x1e')]);}_0x278bad[_0xa6f7('0x38')]=qs[_0xa6f7('0x39')](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x39')]);_0x278bad[_0xa6f7('0x3a')]=qs[_0xa6f7('0x3b')](_[_0xa6f7('0x3c')](_0x3dee2e['query'],_0x52f9c1[_0xa6f7('0x3b')]),_0x42dc49);if(_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x3d')]){_0x278bad['where']=_[_0xa6f7('0x3e')](_0x278bad[_0xa6f7('0x3a')],{'$or':_['map'](_0x42dc49,function(_0x39349a){if(_0x39349a[_0xa6f7('0x2e')]!==_0xa6f7('0x3f')){var _0x14d532={};_0x14d532[_0x39349a[_0xa6f7('0x29')]]={'$like':'%'+_0x3dee2e['query'][_0xa6f7('0x3d')]+'%'};return _0x14d532;}})});}_0x278bad=_[_0xa6f7('0x3e')]({},_0x278bad,_0x3dee2e[_0xa6f7('0x40')]);var _0x1b8bf3={'where':_0x278bad[_0xa6f7('0x3a')]};return db[_0xa6f7('0x2c')][_0xa6f7('0x1f')](_0x1b8bf3)[_0xa6f7('0x25')](function(_0x5646b9){_0x442ccf['count']=_0x5646b9;if(_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x41')]){_0x278bad[_0xa6f7('0x42')]=[{'all':!![]}];}return db[_0xa6f7('0x2c')][_0xa6f7('0x43')](_0x278bad);})[_0xa6f7('0x25')](function(_0x21fdd7){_0x442ccf[_0xa6f7('0x44')]=_0x21fdd7;return _0x442ccf;})[_0xa6f7('0x25')](respondWithFilteredResult(_0x40b0f8,_0x278bad))[_0xa6f7('0x45')](handleError(_0x40b0f8,null));};exports['show']=function(_0x41917c,_0x30be3b){var _0x4d5846={'raw':!![],'where':{'id':_0x41917c[_0xa6f7('0x46')]['id']}},_0x22d500={};_0x22d500[_0xa6f7('0x30')]=_[_0xa6f7('0x47')](db['VoiceMail'][_0xa6f7('0x2d')]);_0x22d500['query']=_['keys'](_0x41917c[_0xa6f7('0x32')]);_0x22d500[_0xa6f7('0x3b')]=_[_0xa6f7('0x33')](_0x22d500[_0xa6f7('0x30')],_0x22d500[_0xa6f7('0x32')]);_0x4d5846[_0xa6f7('0x34')]=_[_0xa6f7('0x33')](_0x22d500['model'],qs[_0xa6f7('0x35')](_0x41917c[_0xa6f7('0x32')]['fields']));_0x4d5846[_0xa6f7('0x34')]=_0x4d5846[_0xa6f7('0x34')][_0xa6f7('0x36')]?_0x4d5846['attributes']:_0x22d500[_0xa6f7('0x30')];if(_0x41917c['query'][_0xa6f7('0x41')]){_0x4d5846[_0xa6f7('0x42')]=[{'all':!![]}];}_0x4d5846=_[_0xa6f7('0x3e')]({},_0x4d5846,_0x41917c['options']);return db['VoiceMail'][_0xa6f7('0x48')](_0x4d5846)['then'](handleEntityNotFound(_0x30be3b,null))[_0xa6f7('0x25')](respondWithResult(_0x30be3b,null))['catch'](handleError(_0x30be3b,null));};exports['create']=function(_0x1e7089,_0x2e3a04){return db[_0xa6f7('0x2c')][_0xa6f7('0x49')](_0x1e7089[_0xa6f7('0x4a')],{})[_0xa6f7('0x25')](function(_0x5d9b6f){var _0x4032fc=_0x1e7089[_0xa6f7('0x4b')]['get']({'plain':!![]});if(!_0x4032fc)throw new Error(_0xa6f7('0x4c'));if(_0x4032fc['role']===_0xa6f7('0x4b')){var _0x59091a=_0x5d9b6f['get']({'plain':!![]});var _0x60eacc=_0xa6f7('0x23');return db[_0xa6f7('0x4d')][_0xa6f7('0x48')]({'where':{'name':_0x60eacc,'userProfileId':_0x4032fc[_0xa6f7('0x4e')]},'raw':!![]})['then'](function(_0x340d3f){if(_0x340d3f&&_0x340d3f[_0xa6f7('0x4f')]===0x0){return db['UserProfileResource'][_0xa6f7('0x49')]({'name':_0x59091a['name'],'resourceId':_0x59091a['id'],'type':_0x340d3f[_0xa6f7('0x29')],'sectionId':_0x340d3f['id']},{})[_0xa6f7('0x25')](function(){return _0x5d9b6f;});}else{return _0x5d9b6f;}})[_0xa6f7('0x45')](function(_0x55369a){logger[_0xa6f7('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55369a);throw _0x55369a;});}return _0x5d9b6f;})[_0xa6f7('0x25')](respondWithResult(_0x2e3a04,0xc9))[_0xa6f7('0x45')](handleError(_0x2e3a04,null));};exports[_0xa6f7('0x50')]=function(_0x1dcb45,_0xa6bff9){if(_0x1dcb45['body']['id']){delete _0x1dcb45['body']['id'];}return db[_0xa6f7('0x2c')][_0xa6f7('0x48')]({'where':{'id':_0x1dcb45[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0xa6bff9,null))['then'](saveUpdates(_0x1dcb45[_0xa6f7('0x4a')],null))[_0xa6f7('0x25')](respondWithResult(_0xa6bff9,null))[_0xa6f7('0x45')](handleError(_0xa6bff9,null));};exports[_0xa6f7('0x24')]=function(_0x1b33a5,_0x39538e){return db['VoiceMail'][_0xa6f7('0x48')]({'where':{'id':_0x1b33a5[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x39538e,null))['then'](removeEntity(_0x39538e,null))[_0xa6f7('0x45')](handleError(_0x39538e,null));};exports[_0xa6f7('0x51')]=function(_0x139192,_0x4496f1,_0x5908e3){return db['VoiceMail'][_0xa6f7('0x52')]({'where':{'id':_0x139192[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x4496f1,null))[_0xa6f7('0x25')](function(_0x301327){var _0x269249;var _0x1fcb72={},_0x5efd49={};_0x5efd49[_0xa6f7('0x30')]=_[_0xa6f7('0x47')](db[_0xa6f7('0x53')][_0xa6f7('0x2d')]);_0x5efd49[_0xa6f7('0x32')]=_[_0xa6f7('0x47')](_0x139192[_0xa6f7('0x32')]);_0x5efd49[_0xa6f7('0x3b')]=_[_0xa6f7('0x33')](_0x5efd49[_0xa6f7('0x30')],_0x5efd49[_0xa6f7('0x32')]);_0x1fcb72['attributes']=_[_0xa6f7('0x33')](_0x5efd49['model'],qs[_0xa6f7('0x35')](_0x139192['query'][_0xa6f7('0x35')]));_0x1fcb72[_0xa6f7('0x34')]=_0x1fcb72['attributes'][_0xa6f7('0x36')]?_0x1fcb72[_0xa6f7('0x34')]:_0x5efd49[_0xa6f7('0x30')];if(!_0x139192['query'][_0xa6f7('0x37')]('nolimit')){_0x1fcb72[_0xa6f7('0x1d')]=qs[_0xa6f7('0x1d')](_0x139192['query'][_0xa6f7('0x1d')]);_0x1fcb72['offset']=qs[_0xa6f7('0x1e')](_0x139192['query'][_0xa6f7('0x1e')]);}_0x1fcb72[_0xa6f7('0x38')]=qs[_0xa6f7('0x39')](_0x139192[_0xa6f7('0x32')][_0xa6f7('0x39')]);_0x1fcb72[_0xa6f7('0x3a')]=qs[_0xa6f7('0x3b')](_[_0xa6f7('0x3c')](_0x139192[_0xa6f7('0x32')],_0x5efd49[_0xa6f7('0x3b')]));if(_0x139192[_0xa6f7('0x32')][_0xa6f7('0x3d')]){_0x1fcb72['where']=_[_0xa6f7('0x3e')](_0x1fcb72[_0xa6f7('0x3a')],{'$or':_[_0xa6f7('0x31')](_0x1fcb72[_0xa6f7('0x34')],function(_0x154c78){var _0x3a464e={};_0x3a464e[_0x154c78]={'$like':'%'+_0x139192[_0xa6f7('0x32')][_0xa6f7('0x3d')]+'%'};return _0x3a464e;})});}_0x1fcb72['where']=_[_0xa6f7('0x3e')](_0x1fcb72[_0xa6f7('0x3a')],{'mailboxuser':_0x301327[_0xa6f7('0x54')]});_0x1fcb72=_['merge']({},_0x1fcb72,_0x139192[_0xa6f7('0x40')]);return db[_0xa6f7('0x53')][_0xa6f7('0x55')](_0x1fcb72)[_0xa6f7('0x25')](respondWithFilteredResult(_0x4496f1,_0x1fcb72));})[_0xa6f7('0x45')](handleError(_0x4496f1,null));}; \ No newline at end of file +var _0xb688=['fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','include','catch','show','rawAttributes','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','findOne','VoiceMailMessage','nolimit','filter','mailbox','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','update','then','destroy','get','Voicemails','end','error','name','send','index','map','VoiceMail'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xb688,0xcf));var _0x8b68=function(_0x363ce1,_0x2aaed9){_0x363ce1=_0x363ce1-0x0;var _0x2778e6=_0xb688[_0x363ce1];return _0x2778e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b68('0x0'));var zipdir=require(_0x8b68('0x1'));var jsonpatch=require(_0x8b68('0x2'));var rp=require(_0x8b68('0x3'));var moment=require(_0x8b68('0x4'));var BPromise=require(_0x8b68('0x5'));var Mustache=require('mustache');var util=require(_0x8b68('0x6'));var path=require(_0x8b68('0x7'));var sox=require(_0x8b68('0x8'));var csv=require(_0x8b68('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b68('0xa'));var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0x9'));var querystring=require(_0x8b68('0xf'));var Papa=require(_0x8b68('0x10'));var Redis=require(_0x8b68('0x11'));var authService=require(_0x8b68('0x12'));var qs=require(_0x8b68('0x13'));var as=require(_0x8b68('0x14'));var hardwareService=require(_0x8b68('0x15'));var logger=require(_0x8b68('0x16'))('api');var utils=require(_0x8b68('0x17'));var config=require(_0x8b68('0x18'));var licenseUtil=require(_0x8b68('0x19'));var db=require(_0x8b68('0x1a'))['db'];function respondWithStatusCode(_0x1965cf,_0x2f3af4){_0x2f3af4=_0x2f3af4||0xcc;return function(_0xaa8725){if(_0xaa8725){return _0x1965cf[_0x8b68('0x1b')](_0x2f3af4);}return _0x1965cf[_0x8b68('0x1c')](_0x2f3af4)['end']();};}function respondWithResult(_0xb2df35,_0x509033){_0x509033=_0x509033||0xc8;return function(_0x5e3c66){if(_0x5e3c66){return _0xb2df35[_0x8b68('0x1c')](_0x509033)[_0x8b68('0x1d')](_0x5e3c66);}};}function respondWithFilteredResult(_0x27d717,_0x5d3468){return function(_0x5c8d0e){if(_0x5c8d0e){var _0x23bd52=typeof _0x5d3468['offset']===_0x8b68('0x1e')&&typeof _0x5d3468[_0x8b68('0x1f')]===_0x8b68('0x1e');var _0x10c9c6=_0x5c8d0e['count'];var _0xd17693=_0x23bd52?0x0:_0x5d3468[_0x8b68('0x20')];var _0x4a68c7=_0x23bd52?_0x5c8d0e[_0x8b68('0x21')]:_0x5d3468[_0x8b68('0x20')]+_0x5d3468[_0x8b68('0x1f')];var _0x17f321;if(_0x4a68c7>=_0x10c9c6){_0x4a68c7=_0x10c9c6;_0x17f321=0xc8;}else{_0x17f321=0xce;}_0x27d717[_0x8b68('0x1c')](_0x17f321);return _0x27d717['set'](_0x8b68('0x22'),_0xd17693+'-'+_0x4a68c7+'/'+_0x10c9c6)[_0x8b68('0x1d')](_0x5c8d0e);}return null;};}function patchUpdates(_0x59e9b1){return function(_0x1a9788){try{jsonpatch[_0x8b68('0x23')](_0x1a9788,_0x59e9b1,!![]);}catch(_0x1dbc1d){return BPromise['reject'](_0x1dbc1d);}return _0x1a9788['save']();};}function saveUpdates(_0x23edc1,_0x59cb26){return function(_0x332202){if(_0x332202){return _0x332202[_0x8b68('0x24')](_0x23edc1)[_0x8b68('0x25')](function(_0x21ecca){return _0x21ecca;});}return null;};}function removeEntity(_0x32ddc5,_0x173524){return function(_0x59bb8a){if(_0x59bb8a){return _0x59bb8a[_0x8b68('0x26')]()[_0x8b68('0x25')](function(){var _0x4ca77d=_0x59bb8a[_0x8b68('0x27')]({'plain':!![]});var _0x3cf8d2=_0x8b68('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x3cf8d2,'resourceId':_0x4ca77d['id']}})['then'](function(){return _0x59bb8a;});})[_0x8b68('0x25')](function(){_0x32ddc5[_0x8b68('0x1c')](0xcc)[_0x8b68('0x29')]();});}};}function handleEntityNotFound(_0x583476,_0x3311c7){return function(_0x53aaa2){if(!_0x53aaa2){_0x583476['sendStatus'](0x194);}return _0x53aaa2;};}function handleError(_0x3865ea,_0x59b3ce){_0x59b3ce=_0x59b3ce||0x1f4;return function(_0x26cad7){logger[_0x8b68('0x2a')](_0x26cad7['stack']);if(_0x26cad7['name']){delete _0x26cad7[_0x8b68('0x2b')];}_0x3865ea[_0x8b68('0x1c')](_0x59b3ce)[_0x8b68('0x2c')](_0x26cad7);};}exports[_0x8b68('0x2d')]=function(_0x210926,_0x2ad2df){var _0x460c37={},_0x5b7ed1={},_0x3b6d1b={'count':0x0,'rows':[]};var _0x50a1e9=_[_0x8b68('0x2e')](db[_0x8b68('0x2f')]['rawAttributes'],function(_0x216aa6){return{'name':_0x216aa6[_0x8b68('0x30')],'type':_0x216aa6[_0x8b68('0x31')]['key']};});_0x5b7ed1['model']=_[_0x8b68('0x2e')](_0x50a1e9,_0x8b68('0x2b'));_0x5b7ed1[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x210926[_0x8b68('0x32')]);_0x5b7ed1[_0x8b68('0x34')]=_[_0x8b68('0x35')](_0x5b7ed1[_0x8b68('0x36')],_0x5b7ed1[_0x8b68('0x32')]);_0x460c37[_0x8b68('0x37')]=_[_0x8b68('0x35')](_0x5b7ed1[_0x8b68('0x36')],qs[_0x8b68('0x38')](_0x210926[_0x8b68('0x32')][_0x8b68('0x38')]));_0x460c37[_0x8b68('0x37')]=_0x460c37[_0x8b68('0x37')][_0x8b68('0x39')]?_0x460c37[_0x8b68('0x37')]:_0x5b7ed1[_0x8b68('0x36')];if(!_0x210926[_0x8b68('0x32')][_0x8b68('0x3a')]('nolimit')){_0x460c37['limit']=qs[_0x8b68('0x1f')](_0x210926[_0x8b68('0x32')][_0x8b68('0x1f')]);_0x460c37[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x210926[_0x8b68('0x32')][_0x8b68('0x20')]);}_0x460c37[_0x8b68('0x3b')]=qs['sort'](_0x210926[_0x8b68('0x32')][_0x8b68('0x3c')]);_0x460c37[_0x8b68('0x3d')]=qs[_0x8b68('0x34')](_[_0x8b68('0x3e')](_0x210926[_0x8b68('0x32')],_0x5b7ed1[_0x8b68('0x34')]),_0x50a1e9);if(_0x210926[_0x8b68('0x32')]['filter']){_0x460c37[_0x8b68('0x3d')]=_[_0x8b68('0x3f')](_0x460c37[_0x8b68('0x3d')],{'$or':_[_0x8b68('0x2e')](_0x50a1e9,function(_0x3ecc60){if(_0x3ecc60[_0x8b68('0x31')]!==_0x8b68('0x40')){var _0x50a9c6={};_0x50a9c6[_0x3ecc60[_0x8b68('0x2b')]]={'$like':'%'+_0x210926[_0x8b68('0x32')]['filter']+'%'};return _0x50a9c6;}})});}_0x460c37=_[_0x8b68('0x3f')]({},_0x460c37,_0x210926[_0x8b68('0x41')]);var _0x50b2f1={'where':_0x460c37['where']};return db['VoiceMail']['count'](_0x50b2f1)[_0x8b68('0x25')](function(_0x23d24a){_0x3b6d1b['count']=_0x23d24a;if(_0x210926[_0x8b68('0x32')]['includeAll']){_0x460c37[_0x8b68('0x42')]=[{'all':!![]}];}return db[_0x8b68('0x2f')]['findAll'](_0x460c37);})[_0x8b68('0x25')](function(_0x5ae345){_0x3b6d1b['rows']=_0x5ae345;return _0x3b6d1b;})['then'](respondWithFilteredResult(_0x2ad2df,_0x460c37))[_0x8b68('0x43')](handleError(_0x2ad2df,null));};exports[_0x8b68('0x44')]=function(_0x3ba80e,_0xa70f60){var _0x50e425={'raw':!![],'where':{'id':_0x3ba80e['params']['id']}},_0x20162a={};_0x20162a[_0x8b68('0x36')]=_[_0x8b68('0x33')](db['VoiceMail'][_0x8b68('0x45')]);_0x20162a[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x3ba80e[_0x8b68('0x32')]);_0x20162a['filters']=_[_0x8b68('0x35')](_0x20162a[_0x8b68('0x36')],_0x20162a[_0x8b68('0x32')]);_0x50e425[_0x8b68('0x37')]=_[_0x8b68('0x35')](_0x20162a[_0x8b68('0x36')],qs[_0x8b68('0x38')](_0x3ba80e[_0x8b68('0x32')][_0x8b68('0x38')]));_0x50e425[_0x8b68('0x37')]=_0x50e425[_0x8b68('0x37')][_0x8b68('0x39')]?_0x50e425[_0x8b68('0x37')]:_0x20162a[_0x8b68('0x36')];if(_0x3ba80e[_0x8b68('0x32')][_0x8b68('0x46')]){_0x50e425['include']=[{'all':!![]}];}_0x50e425=_[_0x8b68('0x3f')]({},_0x50e425,_0x3ba80e[_0x8b68('0x41')]);return db['VoiceMail'][_0x8b68('0x47')](_0x50e425)['then'](handleEntityNotFound(_0xa70f60,null))['then'](respondWithResult(_0xa70f60,null))['catch'](handleError(_0xa70f60,null));};exports[_0x8b68('0x48')]=function(_0x35874b,_0x34047c){return db[_0x8b68('0x2f')]['create'](_0x35874b['body'],{})[_0x8b68('0x25')](function(_0x163fd5){var _0x1e900f=_0x35874b['user'][_0x8b68('0x27')]({'plain':!![]});if(!_0x1e900f)throw new Error(_0x8b68('0x49'));if(_0x1e900f['role']===_0x8b68('0x4a')){var _0xacac82=_0x163fd5['get']({'plain':!![]});var _0x18a9ae=_0x8b68('0x28');return db['UserProfileSection'][_0x8b68('0x47')]({'where':{'name':_0x18a9ae,'userProfileId':_0x1e900f[_0x8b68('0x4b')]},'raw':!![]})['then'](function(_0x543d74){if(_0x543d74&&_0x543d74['autoAssociation']===0x0){return db[_0x8b68('0x4c')][_0x8b68('0x48')]({'name':_0xacac82[_0x8b68('0x2b')],'resourceId':_0xacac82['id'],'type':_0x543d74[_0x8b68('0x2b')],'sectionId':_0x543d74['id']},{})['then'](function(){return _0x163fd5;});}else{return _0x163fd5;}})['catch'](function(_0x4492fd){logger[_0x8b68('0x2a')](_0x8b68('0x4d'),_0x4492fd);throw _0x4492fd;});}return _0x163fd5;})['then'](respondWithResult(_0x34047c,0xc9))[_0x8b68('0x43')](handleError(_0x34047c,null));};exports[_0x8b68('0x24')]=function(_0x3f9d34,_0x4dda69){if(_0x3f9d34[_0x8b68('0x4e')]['id']){delete _0x3f9d34['body']['id'];}return db[_0x8b68('0x2f')][_0x8b68('0x47')]({'where':{'id':_0x3f9d34['params']['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x4dda69,null))[_0x8b68('0x25')](saveUpdates(_0x3f9d34[_0x8b68('0x4e')],null))[_0x8b68('0x25')](respondWithResult(_0x4dda69,null))[_0x8b68('0x43')](handleError(_0x4dda69,null));};exports['destroy']=function(_0x241166,_0x3f3e43){return db[_0x8b68('0x2f')][_0x8b68('0x47')]({'where':{'id':_0x241166[_0x8b68('0x4f')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x3f3e43,null))[_0x8b68('0x25')](removeEntity(_0x3f3e43,null))[_0x8b68('0x43')](handleError(_0x3f3e43,null));};exports['getMessages']=function(_0x3f423e,_0x1a85da,_0x1e8694){return db[_0x8b68('0x2f')][_0x8b68('0x50')]({'where':{'id':_0x3f423e[_0x8b68('0x4f')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x1a85da,null))[_0x8b68('0x25')](function(_0x6d63cb){var _0x271dbe;var _0x368c86={},_0x42871e={};_0x42871e[_0x8b68('0x36')]=_[_0x8b68('0x33')](db[_0x8b68('0x51')][_0x8b68('0x45')]);_0x42871e[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x3f423e[_0x8b68('0x32')]);_0x42871e[_0x8b68('0x34')]=_['intersection'](_0x42871e[_0x8b68('0x36')],_0x42871e['query']);_0x368c86['attributes']=_[_0x8b68('0x35')](_0x42871e['model'],qs[_0x8b68('0x38')](_0x3f423e[_0x8b68('0x32')][_0x8b68('0x38')]));_0x368c86['attributes']=_0x368c86[_0x8b68('0x37')][_0x8b68('0x39')]?_0x368c86[_0x8b68('0x37')]:_0x42871e[_0x8b68('0x36')];if(!_0x3f423e[_0x8b68('0x32')][_0x8b68('0x3a')](_0x8b68('0x52'))){_0x368c86['limit']=qs['limit'](_0x3f423e[_0x8b68('0x32')][_0x8b68('0x1f')]);_0x368c86[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x3f423e[_0x8b68('0x32')][_0x8b68('0x20')]);}_0x368c86[_0x8b68('0x3b')]=qs[_0x8b68('0x3c')](_0x3f423e[_0x8b68('0x32')][_0x8b68('0x3c')]);_0x368c86[_0x8b68('0x3d')]=qs[_0x8b68('0x34')](_[_0x8b68('0x3e')](_0x3f423e[_0x8b68('0x32')],_0x42871e[_0x8b68('0x34')]));if(_0x3f423e[_0x8b68('0x32')][_0x8b68('0x53')]){_0x368c86[_0x8b68('0x3d')]=_['merge'](_0x368c86['where'],{'$or':_[_0x8b68('0x2e')](_0x368c86[_0x8b68('0x37')],function(_0x5bd581){var _0x48d57a={};_0x48d57a[_0x5bd581]={'$like':'%'+_0x3f423e['query'][_0x8b68('0x53')]+'%'};return _0x48d57a;})});}_0x368c86[_0x8b68('0x3d')]=_[_0x8b68('0x3f')](_0x368c86[_0x8b68('0x3d')],{'mailboxuser':_0x6d63cb[_0x8b68('0x54')]});_0x368c86=_['merge']({},_0x368c86,_0x3f423e[_0x8b68('0x41')]);return db[_0x8b68('0x51')]['findAndCountAll'](_0x368c86)[_0x8b68('0x25')](respondWithFilteredResult(_0x1a85da,_0x368c86));})['catch'](handleError(_0x1a85da,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 49bce45..3b215c8 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 _0x475f=['../../config/environment','./voiceMail.attributes','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x475f,0x18d));var _0xf475=function(_0x155ded,_0x4ab607){_0x155ded=_0x155ded-0x0;var _0x4a179b=_0x475f[_0x155ded];return _0x4a179b;};'use strict';var _=require('lodash');var util=require(_0xf475('0x0'));var logger=require(_0xf475('0x1'))(_0xf475('0x2'));var moment=require(_0xf475('0x3'));var BPromise=require(_0xf475('0x4'));var rp=require(_0xf475('0x5'));var fs=require('fs');var path=require(_0xf475('0x6'));var rimraf=require(_0xf475('0x7'));var config=require(_0xf475('0x8'));var attributes=require(_0xf475('0x9'));module['exports']=function(_0x27c8cb,_0x47c0fa){return _0x27c8cb['define'](_0xf475('0xa'),attributes,{'tableName':_0xf475('0xb'),'paranoid':![],'indexes':[{'name':_0xf475('0xc'),'fields':[_0xf475('0xd'),_0xf475('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb20b=['mailbox_context','mailbox','context','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xb20b,0x14d));var _0xbb20=function(_0x7dbafa,_0x365e8d){_0x7dbafa=_0x7dbafa-0x0;var _0x301879=_0xb20b[_0x7dbafa];return _0x301879;};'use strict';var _=require('lodash');var util=require(_0xbb20('0x0'));var logger=require(_0xbb20('0x1'))('api');var moment=require(_0xbb20('0x2'));var BPromise=require(_0xbb20('0x3'));var rp=require(_0xbb20('0x4'));var fs=require('fs');var path=require(_0xbb20('0x5'));var rimraf=require(_0xbb20('0x6'));var config=require('../../config/environment');var attributes=require(_0xbb20('0x7'));module[_0xbb20('0x8')]=function(_0x36dc33,_0x351f5a){return _0x36dc33[_0xbb20('0x9')](_0xbb20('0xa'),attributes,{'tableName':_0xbb20('0xb'),'paranoid':![],'indexes':[{'name':_0xbb20('0xc'),'fields':[_0xbb20('0xd'),_0xbb20('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index a1a32c4..a8f07d0 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 _0x16de=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x43d701,_0x4bb2e9){var _0x2ec4c6=function(_0x4d9765){while(--_0x4d9765){_0x43d701['push'](_0x43d701['shift']());}};_0x2ec4c6(++_0x4bb2e9);}(_0x16de,0x170));var _0xe16d=function(_0x18edc8,_0x5ac3c8){_0x18edc8=_0x18edc8-0x0;var _0x495c96=_0x16de[_0x18edc8];return _0x495c96;};'use strict';var _=require(_0xe16d('0x0'));var util=require(_0xe16d('0x1'));var moment=require('moment');var BPromise=require(_0xe16d('0x2'));var rs=require(_0xe16d('0x3'));var fs=require('fs');var Redis=require(_0xe16d('0x4'));var db=require(_0xe16d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe16d('0x6'))(_0xe16d('0x7'));var config=require(_0xe16d('0x8'));var jayson=require(_0xe16d('0x9'));var client=jayson[_0xe16d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x221dc3,_0x2b421e,_0x442ed1){return new BPromise(function(_0x4ae95d,_0x3fac94){return client[_0xe16d('0xb')](_0x221dc3,_0x442ed1)['then'](function(_0x373c89){logger[_0xe16d('0xc')]('VoiceMail,\x20%s,\x20%s',_0x2b421e,_0xe16d('0xd'));logger['debug'](_0xe16d('0xe'),_0x2b421e,_0xe16d('0xd'),JSON[_0xe16d('0xf')](_0x373c89));if(_0x373c89[_0xe16d('0x10')]){if(_0x373c89[_0xe16d('0x10')][_0xe16d('0x11')]===0x1f4){logger[_0xe16d('0x10')]('VoiceMail,\x20%s,\x20%s',_0x2b421e,_0x373c89[_0xe16d('0x10')]['message']);return _0x3fac94(_0x373c89[_0xe16d('0x10')]['message']);}logger[_0xe16d('0x10')](_0xe16d('0x12'),_0x2b421e,_0x373c89['error'][_0xe16d('0x13')]);return _0x4ae95d(_0x373c89[_0xe16d('0x10')]['message']);}else{logger['info'](_0xe16d('0x12'),_0x2b421e,_0xe16d('0xd'));_0x4ae95d(_0x373c89[_0xe16d('0x14')][_0xe16d('0x13')]);}})[_0xe16d('0x15')](function(_0x2d29f0){logger[_0xe16d('0x10')](_0xe16d('0x12'),_0x2b421e,_0x2d29f0);_0x3fac94(_0x2d29f0);});});} \ No newline at end of file +var _0x6e48=['message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x20a12f,_0x1f31c9){var _0x5cd08f=function(_0x136be9){while(--_0x136be9){_0x20a12f['push'](_0x20a12f['shift']());}};_0x5cd08f(++_0x1f31c9);}(_0x6e48,0x1bb));var _0x86e4=function(_0x138a07,_0x46c1d7){_0x138a07=_0x138a07-0x0;var _0x1f8709=_0x6e48[_0x138a07];return _0x1f8709;};'use strict';var _=require(_0x86e4('0x0'));var util=require('util');var moment=require(_0x86e4('0x1'));var BPromise=require(_0x86e4('0x2'));var rs=require(_0x86e4('0x3'));var fs=require('fs');var Redis=require(_0x86e4('0x4'));var db=require(_0x86e4('0x5'))['db'];var utils=require(_0x86e4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x86e4('0x7'));var jayson=require(_0x86e4('0x8'));var client=jayson['client'][_0x86e4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b75e4,_0x543bfa,_0x3c9b30){return new BPromise(function(_0x1fb7d8,_0x63cf18){return client[_0x86e4('0xa')](_0x5b75e4,_0x3c9b30)[_0x86e4('0xb')](function(_0x1d4cd9){logger['info'](_0x86e4('0xc'),_0x543bfa,_0x86e4('0xd'));logger[_0x86e4('0xe')](_0x86e4('0xf'),_0x543bfa,_0x86e4('0xd'),JSON[_0x86e4('0x10')](_0x1d4cd9));if(_0x1d4cd9[_0x86e4('0x11')]){if(_0x1d4cd9[_0x86e4('0x11')][_0x86e4('0x12')]===0x1f4){logger[_0x86e4('0x11')](_0x86e4('0xc'),_0x543bfa,_0x1d4cd9[_0x86e4('0x11')]['message']);return _0x63cf18(_0x1d4cd9[_0x86e4('0x11')][_0x86e4('0x13')]);}logger[_0x86e4('0x11')](_0x86e4('0xc'),_0x543bfa,_0x1d4cd9[_0x86e4('0x11')][_0x86e4('0x13')]);return _0x1fb7d8(_0x1d4cd9[_0x86e4('0x11')][_0x86e4('0x13')]);}else{logger[_0x86e4('0x14')](_0x86e4('0xc'),_0x543bfa,'request\x20sent');_0x1fb7d8(_0x1d4cd9['result'][_0x86e4('0x13')]);}})[_0x86e4('0x15')](function(_0x2cc542){logger[_0x86e4('0x11')](_0x86e4('0xc'),_0x543bfa,_0x2cc542);_0x63cf18(_0x2cc542);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 5dba879..ee903eb 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 _0xa80f=['./voiceMailMessage.controller','isAuthenticated','/:id/download','download','post','create','put','/:id','update','delete','destroy','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x14b82e,_0x5723c9){var _0x68ef73=function(_0x31b9c4){while(--_0x31b9c4){_0x14b82e['push'](_0x14b82e['shift']());}};_0x68ef73(++_0x5723c9);}(_0xa80f,0x9b));var _0xfa80=function(_0x5782a3,_0x2d54f3){_0x5782a3=_0x5782a3-0x0;var _0x5dcae1=_0xa80f[_0x5782a3];return _0x5dcae1;};'use strict';var multer=require(_0xfa80('0x0'));var util=require(_0xfa80('0x1'));var path=require('path');var timeout=require(_0xfa80('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfa80('0x3'));var auth=require(_0xfa80('0x4'));var interaction=require(_0xfa80('0x5'));var config=require(_0xfa80('0x6'));var controller=require(_0xfa80('0x7'));router['get']('/',auth[_0xfa80('0x8')](),controller['index']);router['get']('/:id',auth[_0xfa80('0x8')](),controller['show']);router['get'](_0xfa80('0x9'),auth[_0xfa80('0x8')](),controller[_0xfa80('0xa')]);router[_0xfa80('0xb')]('/',auth[_0xfa80('0x8')](),controller[_0xfa80('0xc')]);router[_0xfa80('0xd')](_0xfa80('0xe'),auth[_0xfa80('0x8')](),controller[_0xfa80('0xf')]);router[_0xfa80('0x10')](_0xfa80('0xe'),auth['isAuthenticated'](),controller[_0xfa80('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5ef1=['connect-timeout','express','fs-extra','../../components/auth/service','./voiceMailMessage.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x3cba1d,_0x2825ae){var _0x5f192b=function(_0x32ff5d){while(--_0x32ff5d){_0x3cba1d['push'](_0x3cba1d['shift']());}};_0x5f192b(++_0x2825ae);}(_0x5ef1,0xee));var _0x15ef=function(_0x56ab74,_0x1effda){_0x56ab74=_0x56ab74-0x0;var _0x17d8d0=_0x5ef1[_0x56ab74];return _0x17d8d0;};'use strict';var multer=require(_0x15ef('0x0'));var util=require('util');var path=require(_0x15ef('0x1'));var timeout=require(_0x15ef('0x2'));var express=require(_0x15ef('0x3'));var router=express['Router']();var fs_extra=require(_0x15ef('0x4'));var auth=require(_0x15ef('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x15ef('0x6'));router[_0x15ef('0x7')]('/',auth[_0x15ef('0x8')](),controller['index']);router[_0x15ef('0x7')](_0x15ef('0x9'),auth[_0x15ef('0x8')](),controller[_0x15ef('0xa')]);router['get'](_0x15ef('0xb'),auth[_0x15ef('0x8')](),controller[_0x15ef('0xc')]);router[_0x15ef('0xd')]('/',auth[_0x15ef('0x8')](),controller[_0x15ef('0xe')]);router[_0x15ef('0xf')](_0x15ef('0x9'),auth[_0x15ef('0x8')](),controller[_0x15ef('0x10')]);router[_0x15ef('0x11')](_0x15ef('0x9'),auth[_0x15ef('0x8')](),controller[_0x15ef('0x12')]);module[_0x15ef('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index aa49e7f..152dd39 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 _0x5968=['INTEGER','STRING','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x368048,_0x2695dd){var _0x43ed17=function(_0x234cfb){while(--_0x234cfb){_0x368048['push'](_0x368048['shift']());}};_0x43ed17(++_0x2695dd);}(_0x5968,0x194));var _0x8596=function(_0x4db402,_0x2d1261){_0x4db402=_0x4db402-0x0;var _0x342071=_0x5968[_0x4db402];return _0x342071;};'use strict';var Sequelize=require(_0x8596('0x0'));module[_0x8596('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3a5cc0){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x8596('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x8596('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x8596('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x8596('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x8596('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x8596('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x8596('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x8596('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x8596('0x3')],'defaultValue':''},'stamp':{'type':_0x8596('0x4'),'defaultValue':Sequelize[_0x8596('0x5')](_0x8596('0x6'))}}; \ No newline at end of file +var _0x93a1=['BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','INTEGER','STRING'];(function(_0x2c96f6,_0x877207){var _0x6d4808=function(_0x567e0c){while(--_0x567e0c){_0x2c96f6['push'](_0x2c96f6['shift']());}};_0x6d4808(++_0x877207);}(_0x93a1,0x1d1));var _0x193a=function(_0x4a95dc,_0x2dcd98){_0x4a95dc=_0x4a95dc-0x0;var _0x63454e=_0x93a1[_0x4a95dc];return _0x63454e;};'use strict';var Sequelize=require(_0x193a('0x0'));module[_0x193a('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x30f494){return this[_0x193a('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x193a('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x193a('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x193a('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x193a('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x193a('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x193a('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x193a('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x193a('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x193a('0x5')](_0x193a('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x193a('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x193a('0x4')],'defaultValue':''},'stamp':{'type':_0x193a('0x7'),'defaultValue':Sequelize[_0x193a('0x8')](_0x193a('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index c183d01..a77c087 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 _0xc495=['attributes','fields','order','sort','pick','filter','where','merge','VIRTUAL','VoiceMailMessage','then','include','findAll','show','params','catch','create','body','find','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','.wav\x22','send','rimraf','zip-dir','moment','mustache','util','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection'];(function(_0x1eb66b,_0x5c1b61){var _0x40a43f=function(_0x458a2e){while(--_0x458a2e){_0x1eb66b['push'](_0x1eb66b['shift']());}};_0x40a43f(++_0x5c1b61);}(_0xc495,0x69));var _0x5c49=function(_0x1286cc,_0x2ee722){_0x1286cc=_0x1286cc-0x0;var _0x51032d=_0xc495[_0x1286cc];return _0x51032d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5c49('0x0'));var zipdir=require(_0x5c49('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5c49('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5c49('0x3'));var util=require(_0x5c49('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5c49('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c49('0x6'));var squel=require(_0x5c49('0x7'));var crypto=require('crypto');var jsforce=require(_0x5c49('0x8'));var deskjs=require(_0x5c49('0x9'));var toCsv=require(_0x5c49('0xa'));var querystring=require(_0x5c49('0xb'));var Papa=require('papaparse');var Redis=require(_0x5c49('0xc'));var authService=require(_0x5c49('0xd'));var qs=require(_0x5c49('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5c49('0xf'));var utils=require('../../config/utils');var config=require(_0x5c49('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c49('0x11'))['db'];function respondWithStatusCode(_0x459d49,_0x46a632){_0x46a632=_0x46a632||0xcc;return function(_0x5150bf){if(_0x5150bf){return _0x459d49[_0x5c49('0x12')](_0x46a632);}return _0x459d49['status'](_0x46a632)[_0x5c49('0x13')]();};}function respondWithResult(_0x4a9276,_0x27da6c){_0x27da6c=_0x27da6c||0xc8;return function(_0x1b036a){if(_0x1b036a){return _0x4a9276[_0x5c49('0x14')](_0x27da6c)[_0x5c49('0x15')](_0x1b036a);}};}function respondWithFilteredResult(_0x359bc4,_0x516f97){return function(_0x56ef1f){if(_0x56ef1f){var _0xce109=typeof _0x516f97[_0x5c49('0x16')]===_0x5c49('0x17')&&typeof _0x516f97[_0x5c49('0x18')]===_0x5c49('0x17');var _0x3dd56d=_0x56ef1f['count'];var _0x115270=_0xce109?0x0:_0x516f97[_0x5c49('0x16')];var _0x5da0ef=_0xce109?_0x56ef1f[_0x5c49('0x19')]:_0x516f97[_0x5c49('0x16')]+_0x516f97[_0x5c49('0x18')];var _0x1efed5;if(_0x5da0ef>=_0x3dd56d){_0x5da0ef=_0x3dd56d;_0x1efed5=0xc8;}else{_0x1efed5=0xce;}_0x359bc4[_0x5c49('0x14')](_0x1efed5);return _0x359bc4[_0x5c49('0x1a')](_0x5c49('0x1b'),_0x115270+'-'+_0x5da0ef+'/'+_0x3dd56d)['json'](_0x56ef1f);}return null;};}function patchUpdates(_0x304e05){return function(_0x131c3b){try{jsonpatch[_0x5c49('0x1c')](_0x131c3b,_0x304e05,!![]);}catch(_0x2ccce0){return BPromise[_0x5c49('0x1d')](_0x2ccce0);}return _0x131c3b[_0x5c49('0x1e')]();};}function saveUpdates(_0x40c116,_0x3dd383){return function(_0x39e583){if(_0x39e583){return _0x39e583[_0x5c49('0x1f')](_0x40c116)['then'](function(_0x59318b){return _0x59318b;});}return null;};}function removeEntity(_0x1552e9,_0x450a4a){return function(_0x4f7b2f){if(_0x4f7b2f){return _0x4f7b2f[_0x5c49('0x20')]()['then'](function(){_0x1552e9[_0x5c49('0x14')](0xcc)[_0x5c49('0x13')]();});}};}function handleEntityNotFound(_0x556617,_0x98f91b){return function(_0x4e7b7e){if(!_0x4e7b7e){_0x556617[_0x5c49('0x12')](0x194);}return _0x4e7b7e;};}function handleError(_0x35b976,_0x3ddd24){_0x3ddd24=_0x3ddd24||0x1f4;return function(_0x575d75){logger['error'](_0x575d75[_0x5c49('0x21')]);if(_0x575d75[_0x5c49('0x22')]){delete _0x575d75[_0x5c49('0x22')];}_0x35b976['status'](_0x3ddd24)['send'](_0x575d75);};}exports[_0x5c49('0x23')]=function(_0x44228a,_0x34631b){var _0x1020e0={},_0x51fc7f={},_0x4ad258={'count':0x0,'rows':[]};var _0x201974=_[_0x5c49('0x24')](db['VoiceMailMessage'][_0x5c49('0x25')],function(_0x34e9fe){return{'name':_0x34e9fe[_0x5c49('0x26')],'type':_0x34e9fe[_0x5c49('0x27')][_0x5c49('0x28')]};});_0x51fc7f[_0x5c49('0x29')]=_[_0x5c49('0x2a')](_[_0x5c49('0x24')](_0x201974,_0x5c49('0x22')),[_0x5c49('0x22')]);_0x51fc7f[_0x5c49('0x2b')]=_[_0x5c49('0x2c')](_0x44228a[_0x5c49('0x2b')]);_0x51fc7f[_0x5c49('0x2d')]=_[_0x5c49('0x2e')](_0x51fc7f[_0x5c49('0x29')],_0x51fc7f['query']);_0x1020e0[_0x5c49('0x2f')]=_[_0x5c49('0x2e')](_0x51fc7f['model'],qs[_0x5c49('0x30')](_0x44228a['query'][_0x5c49('0x30')]));_0x1020e0[_0x5c49('0x2f')]=_0x1020e0[_0x5c49('0x2f')]['length']?_0x1020e0[_0x5c49('0x2f')]:_0x51fc7f[_0x5c49('0x29')];if(!_0x44228a['query']['hasOwnProperty']('nolimit')){_0x1020e0[_0x5c49('0x18')]=qs[_0x5c49('0x18')](_0x44228a[_0x5c49('0x2b')][_0x5c49('0x18')]);_0x1020e0['offset']=qs[_0x5c49('0x16')](_0x44228a[_0x5c49('0x2b')]['offset']);}_0x1020e0[_0x5c49('0x31')]=qs[_0x5c49('0x32')](_0x44228a['query'][_0x5c49('0x32')]);_0x1020e0['where']=qs[_0x5c49('0x2d')](_[_0x5c49('0x33')](_0x44228a[_0x5c49('0x2b')],_0x51fc7f[_0x5c49('0x2d')]),_0x201974);if(_0x44228a[_0x5c49('0x2b')][_0x5c49('0x34')]){_0x1020e0[_0x5c49('0x35')]=_[_0x5c49('0x36')](_0x1020e0[_0x5c49('0x35')],{'$or':_[_0x5c49('0x24')](_0x201974,function(_0x1b66bb){if(_0x1b66bb[_0x5c49('0x27')]!==_0x5c49('0x37')){var _0x2806f8={};_0x2806f8[_0x1b66bb[_0x5c49('0x22')]]={'$like':'%'+_0x44228a[_0x5c49('0x2b')]['filter']+'%'};return _0x2806f8;}})});}_0x1020e0=_[_0x5c49('0x36')]({},_0x1020e0,_0x44228a['options']);var _0x40f807={'where':_0x1020e0['where']};return db[_0x5c49('0x38')][_0x5c49('0x19')](_0x40f807)[_0x5c49('0x39')](function(_0x1f2891){_0x4ad258[_0x5c49('0x19')]=_0x1f2891;if(_0x44228a['query']['includeAll']){_0x1020e0[_0x5c49('0x3a')]=[{'all':!![]}];}return db[_0x5c49('0x38')][_0x5c49('0x3b')](_0x1020e0);})['then'](function(_0x81e04c){_0x4ad258['rows']=_0x81e04c;return _0x4ad258;})[_0x5c49('0x39')](respondWithFilteredResult(_0x34631b,_0x1020e0))['catch'](handleError(_0x34631b,null));};exports[_0x5c49('0x3c')]=function(_0x269dce,_0x24dbbd){var _0x509143={'raw':!![],'where':{'id':_0x269dce[_0x5c49('0x3d')]['id']}},_0x30b9dc={};_0x30b9dc[_0x5c49('0x29')]=_[_0x5c49('0x2c')](db[_0x5c49('0x38')]['rawAttributes']);_0x30b9dc[_0x5c49('0x2b')]=_['keys'](_0x269dce[_0x5c49('0x2b')]);_0x30b9dc[_0x5c49('0x2d')]=_[_0x5c49('0x2e')](_0x30b9dc[_0x5c49('0x29')],_0x30b9dc['query']);_0x509143[_0x5c49('0x2f')]=_['intersection'](_0x30b9dc['model'],qs[_0x5c49('0x30')](_0x269dce[_0x5c49('0x2b')][_0x5c49('0x30')]));_0x509143[_0x5c49('0x2f')]=_0x509143['attributes']['length']?_0x509143[_0x5c49('0x2f')]:_0x30b9dc['model'];if(_0x269dce[_0x5c49('0x2b')]['includeAll']){_0x509143[_0x5c49('0x3a')]=[{'all':!![]}];}_0x509143=_['merge']({},_0x509143,_0x269dce['options']);return db[_0x5c49('0x38')]['find'](_0x509143)[_0x5c49('0x39')](handleEntityNotFound(_0x24dbbd,null))[_0x5c49('0x39')](respondWithResult(_0x24dbbd,null))[_0x5c49('0x3e')](handleError(_0x24dbbd,null));};exports[_0x5c49('0x3f')]=function(_0x4ebf9d,_0x2a5da6){return db['VoiceMailMessage'][_0x5c49('0x3f')](_0x4ebf9d[_0x5c49('0x40')],{})['then'](respondWithResult(_0x2a5da6,0xc9))[_0x5c49('0x3e')](handleError(_0x2a5da6,null));};exports[_0x5c49('0x1f')]=function(_0x42a36a,_0x296bea){if(_0x42a36a[_0x5c49('0x40')]['id']){delete _0x42a36a[_0x5c49('0x40')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x42a36a[_0x5c49('0x3d')]['id']}})[_0x5c49('0x39')](handleEntityNotFound(_0x296bea,null))[_0x5c49('0x39')](saveUpdates(_0x42a36a[_0x5c49('0x40')],null))[_0x5c49('0x39')](respondWithResult(_0x296bea,null))[_0x5c49('0x3e')](handleError(_0x296bea,null));};exports[_0x5c49('0x20')]=function(_0x4a51e1,_0x48c0d9){return db[_0x5c49('0x38')][_0x5c49('0x41')]({'where':{'id':_0x4a51e1[_0x5c49('0x3d')]['id']}})[_0x5c49('0x39')](handleEntityNotFound(_0x48c0d9,null))['then'](removeEntity(_0x48c0d9,null))['catch'](handleError(_0x48c0d9,null));};exports[_0x5c49('0x42')]=function(_0x292e64,_0x3382d0,_0x191c6d){return db[_0x5c49('0x38')][_0x5c49('0x41')]({'where':{'id':_0x292e64[_0x5c49('0x3d')]['id']},'attributes':['id',_0x5c49('0x43'),_0x5c49('0x44')]})[_0x5c49('0x39')](handleEntityNotFound(_0x3382d0,null))['then'](function(_0x5887c9){if(_0x5887c9){if(!_0x5887c9['recording']){throw new db[(_0x5c49('0x45'))][(_0x5c49('0x46'))](_0x5c49('0x47'));}var _0x5c5bfc={'Content-Type':'audio/wav','Content-Disposition':_0x5c49('0x48')};if(_0x5887c9[_0x5c49('0x44')]){_0x5c5bfc[_0x5c49('0x49')]='attachment;\x20filename=\x22'+_0x5887c9[_0x5c49('0x44')]+_0x5c49('0x4a');}_0x3382d0[_0x5c49('0x1a')](_0x5c5bfc);return _0x3382d0[_0x5c49('0x4b')](new Buffer(_0x5887c9[_0x5c49('0x43')]));}})[_0x5c49('0x3e')](handleError(_0x3382d0,null));}; \ No newline at end of file +var _0x60bf=['find','create','body','destroy','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','msg_id','send','recording','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','update','then','stack','name','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','VoiceMailMessage','include','findAll','rows','catch','params','keys','intersection','includeAll','options'];(function(_0xc694ff,_0x1498ad){var _0x59dba2=function(_0x4c3ccd){while(--_0x4c3ccd){_0xc694ff['push'](_0xc694ff['shift']());}};_0x59dba2(++_0x1498ad);}(_0x60bf,0xa8));var _0xf60b=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x60bf[_0x47e7cb];return _0x2a8874;};'use strict';var emlformat=require(_0xf60b('0x0'));var rimraf=require(_0xf60b('0x1'));var zipdir=require(_0xf60b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf60b('0x3'));var moment=require(_0xf60b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf60b('0x5'));var path=require(_0xf60b('0x6'));var sox=require('sox');var csv=require(_0xf60b('0x7'));var ejs=require(_0xf60b('0x8'));var fs=require('fs');var fs_extra=require(_0xf60b('0x9'));var _=require(_0xf60b('0xa'));var squel=require('squel');var crypto=require(_0xf60b('0xb'));var jsforce=require(_0xf60b('0xc'));var deskjs=require(_0xf60b('0xd'));var toCsv=require(_0xf60b('0x7'));var querystring=require(_0xf60b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf60b('0xf'));var qs=require(_0xf60b('0x10'));var as=require(_0xf60b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf60b('0x12'))(_0xf60b('0x13'));var utils=require(_0xf60b('0x14'));var config=require(_0xf60b('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43ec72,_0x336434){_0x336434=_0x336434||0xcc;return function(_0x4fe146){if(_0x4fe146){return _0x43ec72[_0xf60b('0x16')](_0x336434);}return _0x43ec72['status'](_0x336434)[_0xf60b('0x17')]();};}function respondWithResult(_0x1cd7b2,_0x3446be){_0x3446be=_0x3446be||0xc8;return function(_0x9221a9){if(_0x9221a9){return _0x1cd7b2[_0xf60b('0x18')](_0x3446be)[_0xf60b('0x19')](_0x9221a9);}};}function respondWithFilteredResult(_0x2a01ba,_0x3fcdcd){return function(_0xe1e4ec){if(_0xe1e4ec){var _0x1d3688=typeof _0x3fcdcd['offset']===_0xf60b('0x1a')&&typeof _0x3fcdcd[_0xf60b('0x1b')]===_0xf60b('0x1a');var _0x3c8881=_0xe1e4ec[_0xf60b('0x1c')];var _0x2dd1c9=_0x1d3688?0x0:_0x3fcdcd['offset'];var _0x217149=_0x1d3688?_0xe1e4ec[_0xf60b('0x1c')]:_0x3fcdcd[_0xf60b('0x1d')]+_0x3fcdcd[_0xf60b('0x1b')];var _0x4456ed;if(_0x217149>=_0x3c8881){_0x217149=_0x3c8881;_0x4456ed=0xc8;}else{_0x4456ed=0xce;}_0x2a01ba['status'](_0x4456ed);return _0x2a01ba[_0xf60b('0x1e')]('Content-Range',_0x2dd1c9+'-'+_0x217149+'/'+_0x3c8881)[_0xf60b('0x19')](_0xe1e4ec);}return null;};}function patchUpdates(_0x25a901){return function(_0x16ea6b){try{jsonpatch[_0xf60b('0x1f')](_0x16ea6b,_0x25a901,!![]);}catch(_0x2fca00){return BPromise[_0xf60b('0x20')](_0x2fca00);}return _0x16ea6b['save']();};}function saveUpdates(_0x5cf651,_0x2fec6f){return function(_0x420dd7){if(_0x420dd7){return _0x420dd7[_0xf60b('0x21')](_0x5cf651)[_0xf60b('0x22')](function(_0x1b54c7){return _0x1b54c7;});}return null;};}function removeEntity(_0x415464,_0x5b1026){return function(_0x82482b){if(_0x82482b){return _0x82482b['destroy']()[_0xf60b('0x22')](function(){_0x415464['status'](0xcc)[_0xf60b('0x17')]();});}};}function handleEntityNotFound(_0x2569c1,_0x163b81){return function(_0x18fb65){if(!_0x18fb65){_0x2569c1[_0xf60b('0x16')](0x194);}return _0x18fb65;};}function handleError(_0x1d65bb,_0x4319ad){_0x4319ad=_0x4319ad||0x1f4;return function(_0x5b43bf){logger['error'](_0x5b43bf[_0xf60b('0x23')]);if(_0x5b43bf[_0xf60b('0x24')]){delete _0x5b43bf[_0xf60b('0x24')];}_0x1d65bb['status'](_0x4319ad)['send'](_0x5b43bf);};}exports[_0xf60b('0x25')]=function(_0x3d2b2e,_0x2aa76c){var _0xf365cf={},_0x27bf0e={},_0x1dc1eb={'count':0x0,'rows':[]};var _0x3db6bc=_[_0xf60b('0x26')](db['VoiceMailMessage'][_0xf60b('0x27')],function(_0x140b0f){return{'name':_0x140b0f[_0xf60b('0x28')],'type':_0x140b0f[_0xf60b('0x29')][_0xf60b('0x2a')]};});_0x27bf0e[_0xf60b('0x2b')]=_[_0xf60b('0x2c')](_[_0xf60b('0x26')](_0x3db6bc,'name'),[_0xf60b('0x24')]);_0x27bf0e[_0xf60b('0x2d')]=_['keys'](_0x3d2b2e[_0xf60b('0x2d')]);_0x27bf0e[_0xf60b('0x2e')]=_['intersection'](_0x27bf0e['model'],_0x27bf0e['query']);_0xf365cf[_0xf60b('0x2f')]=_['intersection'](_0x27bf0e['model'],qs[_0xf60b('0x30')](_0x3d2b2e[_0xf60b('0x2d')][_0xf60b('0x30')]));_0xf365cf[_0xf60b('0x2f')]=_0xf365cf['attributes']['length']?_0xf365cf[_0xf60b('0x2f')]:_0x27bf0e['model'];if(!_0x3d2b2e[_0xf60b('0x2d')][_0xf60b('0x31')](_0xf60b('0x32'))){_0xf365cf[_0xf60b('0x1b')]=qs[_0xf60b('0x1b')](_0x3d2b2e[_0xf60b('0x2d')][_0xf60b('0x1b')]);_0xf365cf[_0xf60b('0x1d')]=qs[_0xf60b('0x1d')](_0x3d2b2e[_0xf60b('0x2d')][_0xf60b('0x1d')]);}_0xf365cf['order']=qs[_0xf60b('0x33')](_0x3d2b2e[_0xf60b('0x2d')][_0xf60b('0x33')]);_0xf365cf[_0xf60b('0x34')]=qs['filters'](_[_0xf60b('0x35')](_0x3d2b2e[_0xf60b('0x2d')],_0x27bf0e['filters']),_0x3db6bc);if(_0x3d2b2e[_0xf60b('0x2d')]['filter']){_0xf365cf[_0xf60b('0x34')]=_[_0xf60b('0x36')](_0xf365cf[_0xf60b('0x34')],{'$or':_['map'](_0x3db6bc,function(_0x48e9ca){if(_0x48e9ca['type']!==_0xf60b('0x37')){var _0x4da447={};_0x4da447[_0x48e9ca[_0xf60b('0x24')]]={'$like':'%'+_0x3d2b2e[_0xf60b('0x2d')]['filter']+'%'};return _0x4da447;}})});}_0xf365cf=_[_0xf60b('0x36')]({},_0xf365cf,_0x3d2b2e['options']);var _0x56aea8={'where':_0xf365cf[_0xf60b('0x34')]};return db[_0xf60b('0x38')]['count'](_0x56aea8)['then'](function(_0x4b40c2){_0x1dc1eb[_0xf60b('0x1c')]=_0x4b40c2;if(_0x3d2b2e[_0xf60b('0x2d')]['includeAll']){_0xf365cf[_0xf60b('0x39')]=[{'all':!![]}];}return db[_0xf60b('0x38')][_0xf60b('0x3a')](_0xf365cf);})[_0xf60b('0x22')](function(_0x3f24f9){_0x1dc1eb[_0xf60b('0x3b')]=_0x3f24f9;return _0x1dc1eb;})['then'](respondWithFilteredResult(_0x2aa76c,_0xf365cf))[_0xf60b('0x3c')](handleError(_0x2aa76c,null));};exports['show']=function(_0x274372,_0x359403){var _0x293ebe={'raw':!![],'where':{'id':_0x274372[_0xf60b('0x3d')]['id']}},_0x4c14f3={};_0x4c14f3['model']=_['keys'](db[_0xf60b('0x38')]['rawAttributes']);_0x4c14f3['query']=_[_0xf60b('0x3e')](_0x274372[_0xf60b('0x2d')]);_0x4c14f3[_0xf60b('0x2e')]=_[_0xf60b('0x3f')](_0x4c14f3[_0xf60b('0x2b')],_0x4c14f3[_0xf60b('0x2d')]);_0x293ebe[_0xf60b('0x2f')]=_['intersection'](_0x4c14f3[_0xf60b('0x2b')],qs[_0xf60b('0x30')](_0x274372[_0xf60b('0x2d')]['fields']));_0x293ebe[_0xf60b('0x2f')]=_0x293ebe[_0xf60b('0x2f')]['length']?_0x293ebe[_0xf60b('0x2f')]:_0x4c14f3[_0xf60b('0x2b')];if(_0x274372['query'][_0xf60b('0x40')]){_0x293ebe[_0xf60b('0x39')]=[{'all':!![]}];}_0x293ebe=_[_0xf60b('0x36')]({},_0x293ebe,_0x274372[_0xf60b('0x41')]);return db[_0xf60b('0x38')][_0xf60b('0x42')](_0x293ebe)[_0xf60b('0x22')](handleEntityNotFound(_0x359403,null))[_0xf60b('0x22')](respondWithResult(_0x359403,null))['catch'](handleError(_0x359403,null));};exports[_0xf60b('0x43')]=function(_0x27ca60,_0x3d04e1){return db[_0xf60b('0x38')][_0xf60b('0x43')](_0x27ca60['body'],{})[_0xf60b('0x22')](respondWithResult(_0x3d04e1,0xc9))['catch'](handleError(_0x3d04e1,null));};exports['update']=function(_0x1cb677,_0x57d3d6){if(_0x1cb677['body']['id']){delete _0x1cb677[_0xf60b('0x44')]['id'];}return db[_0xf60b('0x38')][_0xf60b('0x42')]({'where':{'id':_0x1cb677['params']['id']}})[_0xf60b('0x22')](handleEntityNotFound(_0x57d3d6,null))[_0xf60b('0x22')](saveUpdates(_0x1cb677[_0xf60b('0x44')],null))['then'](respondWithResult(_0x57d3d6,null))[_0xf60b('0x3c')](handleError(_0x57d3d6,null));};exports[_0xf60b('0x45')]=function(_0x214715,_0x4eac6c){return db[_0xf60b('0x38')][_0xf60b('0x42')]({'where':{'id':_0x214715[_0xf60b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4eac6c,null))[_0xf60b('0x22')](removeEntity(_0x4eac6c,null))[_0xf60b('0x3c')](handleError(_0x4eac6c,null));};exports['download']=function(_0x6c278,_0x2f1c1f,_0x36d8c9){return db['VoiceMailMessage'][_0xf60b('0x42')]({'where':{'id':_0x6c278[_0xf60b('0x3d')]['id']},'attributes':['id','recording','msg_id']})[_0xf60b('0x22')](handleEntityNotFound(_0x2f1c1f,null))[_0xf60b('0x22')](function(_0x2fd596){if(_0x2fd596){if(!_0x2fd596['recording']){throw new db['Sequelize'][(_0xf60b('0x46'))](_0xf60b('0x47'));}var _0x23e247={'Content-Type':_0xf60b('0x48'),'Content-Disposition':_0xf60b('0x49')};if(_0x2fd596['msg_id']){_0x23e247[_0xf60b('0x4a')]='attachment;\x20filename=\x22'+_0x2fd596[_0xf60b('0x4b')]+'.wav\x22';}_0x2f1c1f[_0xf60b('0x1e')](_0x23e247);return _0x2f1c1f[_0xf60b('0x4c')](new Buffer(_0x2fd596[_0xf60b('0x4d')]));}})[_0xf60b('0x3c')](handleError(_0x2f1c1f,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index cf47631..c215b6c 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 _0x077d=['request-promise','path','rimraf','../../config/environment','exports','define','dir','lodash','../../config/logger','moment','bluebird'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x077d,0x15c));var _0xd077=function(_0x18a5cd,_0x3966e8){_0x18a5cd=_0x18a5cd-0x0;var _0x26a820=_0x077d[_0x18a5cd];return _0x26a820;};'use strict';var _=require(_0xd077('0x0'));var util=require('util');var logger=require(_0xd077('0x1'))('api');var moment=require(_0xd077('0x2'));var BPromise=require(_0xd077('0x3'));var rp=require(_0xd077('0x4'));var fs=require('fs');var path=require(_0xd077('0x5'));var rimraf=require(_0xd077('0x6'));var config=require(_0xd077('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0xd077('0x8')]=function(_0x26063,_0x586d2b){return _0x26063[_0xd077('0x9')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xd077('0xa'),'fields':[_0xd077('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1edd=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash'];(function(_0x51413c,_0x37d87a){var _0x2919d7=function(_0x1feaef){while(--_0x1feaef){_0x51413c['push'](_0x51413c['shift']());}};_0x2919d7(++_0x37d87a);}(_0x1edd,0xc3));var _0xd1ed=function(_0x98db33,_0x397f20){_0x98db33=_0x98db33-0x0;var _0x5ae63a=_0x1edd[_0x98db33];return _0x5ae63a;};'use strict';var _=require(_0xd1ed('0x0'));var util=require(_0xd1ed('0x1'));var logger=require(_0xd1ed('0x2'))(_0xd1ed('0x3'));var moment=require('moment');var BPromise=require(_0xd1ed('0x4'));var rp=require(_0xd1ed('0x5'));var fs=require('fs');var path=require(_0xd1ed('0x6'));var rimraf=require(_0xd1ed('0x7'));var config=require(_0xd1ed('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0xd1ed('0x9')]=function(_0x32d53c,_0x5c577a){return _0x32d53c[_0xd1ed('0xa')](_0xd1ed('0xb'),attributes,{'tableName':_0xd1ed('0xc'),'paranoid':![],'indexes':[{'name':_0xd1ed('0xd'),'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 793a664..ceaa2ff 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 _0x2f19=['lodash','util','bluebird','ioredis','client','request','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMailMessage,\x20%s,\x20%s','message','catch'];(function(_0x506d83,_0x1899e9){var _0x335e8b=function(_0x4a7044){while(--_0x4a7044){_0x506d83['push'](_0x506d83['shift']());}};_0x335e8b(++_0x1899e9);}(_0x2f19,0x1b3));var _0x92f1=function(_0x3e8270,_0x293590){_0x3e8270=_0x3e8270-0x0;var _0x1ccde9=_0x2f19[_0x3e8270];return _0x1ccde9;};'use strict';var _=require(_0x92f1('0x0'));var util=require(_0x92f1('0x1'));var moment=require('moment');var BPromise=require(_0x92f1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x92f1('0x3'));var db=require('../../mysqldb')['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[_0x92f1('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x219066,_0x528588,_0x2e96c5){return new BPromise(function(_0x8026c,_0x2337d2){return client[_0x92f1('0x5')](_0x219066,_0x2e96c5)['then'](function(_0x108599){logger[_0x92f1('0x6')]('VoiceMailMessage,\x20%s,\x20%s',_0x528588,_0x92f1('0x7'));logger[_0x92f1('0x8')](_0x92f1('0x9'),_0x528588,_0x92f1('0x7'),JSON[_0x92f1('0xa')](_0x108599));if(_0x108599[_0x92f1('0xb')]){if(_0x108599[_0x92f1('0xb')]['code']===0x1f4){logger[_0x92f1('0xb')](_0x92f1('0xc'),_0x528588,_0x108599[_0x92f1('0xb')][_0x92f1('0xd')]);return _0x2337d2(_0x108599['error'][_0x92f1('0xd')]);}logger[_0x92f1('0xb')](_0x92f1('0xc'),_0x528588,_0x108599[_0x92f1('0xb')][_0x92f1('0xd')]);return _0x8026c(_0x108599['error'][_0x92f1('0xd')]);}else{logger[_0x92f1('0x6')](_0x92f1('0xc'),_0x528588,_0x92f1('0x7'));_0x8026c(_0x108599['result']['message']);}})[_0x92f1('0xe')](function(_0x2f5cc8){logger[_0x92f1('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x528588,_0x2f5cc8);_0x2337d2(_0x2f5cc8);});});} \ No newline at end of file +var _0x8ece=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x45a4df,_0x33608b){var _0xece435=function(_0x35f047){while(--_0x35f047){_0x45a4df['push'](_0x45a4df['shift']());}};_0xece435(++_0x33608b);}(_0x8ece,0x141));var _0xe8ec=function(_0x50b976,_0x490862){_0x50b976=_0x50b976-0x0;var _0x183cf2=_0x8ece[_0x50b976];return _0x183cf2;};'use strict';var _=require(_0xe8ec('0x0'));var util=require('util');var moment=require(_0xe8ec('0x1'));var BPromise=require(_0xe8ec('0x2'));var rs=require(_0xe8ec('0x3'));var fs=require('fs');var Redis=require(_0xe8ec('0x4'));var db=require(_0xe8ec('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe8ec('0x6'))('rpc');var config=require(_0xe8ec('0x7'));var jayson=require(_0xe8ec('0x8'));var client=jayson[_0xe8ec('0x9')][_0xe8ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x240a9b,_0x30dcc7,_0x31f53e){return new BPromise(function(_0x2acd46,_0x8fd7e2){return client['request'](_0x240a9b,_0x31f53e)[_0xe8ec('0xb')](function(_0x33fdb4){logger[_0xe8ec('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x30dcc7,_0xe8ec('0xd'));logger[_0xe8ec('0xe')](_0xe8ec('0xf'),_0x30dcc7,_0xe8ec('0xd'),JSON[_0xe8ec('0x10')](_0x33fdb4));if(_0x33fdb4[_0xe8ec('0x11')]){if(_0x33fdb4['error'][_0xe8ec('0x12')]===0x1f4){logger['error'](_0xe8ec('0x13'),_0x30dcc7,_0x33fdb4['error']['message']);return _0x8fd7e2(_0x33fdb4[_0xe8ec('0x11')][_0xe8ec('0x14')]);}logger[_0xe8ec('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x30dcc7,_0x33fdb4[_0xe8ec('0x11')][_0xe8ec('0x14')]);return _0x2acd46(_0x33fdb4[_0xe8ec('0x11')][_0xe8ec('0x14')]);}else{logger[_0xe8ec('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x30dcc7,'request\x20sent');_0x2acd46(_0x33fdb4[_0xe8ec('0x15')][_0xe8ec('0x14')]);}})[_0xe8ec('0x16')](function(_0x115ce2){logger[_0xe8ec('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x30dcc7,_0x115ce2);_0x8fd7e2(_0x115ce2);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index b7f1e3b..7f3fca4 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 _0x7e42=['/:id/sounds','post','create','addSound','put','delete','destroy','/:id/sounds/:id2','removeSound','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id'];(function(_0x50f3d8,_0x3e01e4){var _0x25bf69=function(_0x21dd51){while(--_0x21dd51){_0x50f3d8['push'](_0x50f3d8['shift']());}};_0x25bf69(++_0x3e01e4);}(_0x7e42,0x69));var _0x27e4=function(_0x20ae3a,_0x292a8f){_0x20ae3a=_0x20ae3a-0x0;var _0x20821b=_0x7e42[_0x20ae3a];return _0x20821b;};'use strict';var multer=require('multer');var util=require(_0x27e4('0x0'));var path=require('path');var timeout=require(_0x27e4('0x1'));var express=require(_0x27e4('0x2'));var router=express[_0x27e4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x27e4('0x4'));var interaction=require(_0x27e4('0x5'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth[_0x27e4('0x6')](),controller[_0x27e4('0x7')]);router['get'](_0x27e4('0x8'),auth[_0x27e4('0x6')](),controller['show']);router['get'](_0x27e4('0x9'),auth['isAuthenticated'](),controller['getSounds']);router[_0x27e4('0xa')]('/',auth[_0x27e4('0x6')](),controller[_0x27e4('0xb')]);router[_0x27e4('0xa')](_0x27e4('0x9'),auth[_0x27e4('0x6')](),controller[_0x27e4('0xc')]);router[_0x27e4('0xd')](_0x27e4('0x8'),auth[_0x27e4('0x6')](),controller['update']);router[_0x27e4('0xe')](_0x27e4('0x8'),auth[_0x27e4('0x6')](),controller[_0x27e4('0xf')]);router[_0x27e4('0xe')](_0x27e4('0x10'),auth[_0x27e4('0x6')](),controller[_0x27e4('0x11')]);module[_0x27e4('0x12')]=router; \ No newline at end of file +var _0xd599=['isAuthenticated','index','get','/:id','show','post','/:id/sounds','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller'];(function(_0x2fb256,_0x34db3a){var _0x27c109=function(_0x1bc68c){while(--_0x1bc68c){_0x2fb256['push'](_0x2fb256['shift']());}};_0x27c109(++_0x34db3a);}(_0xd599,0xcf));var _0x9d59=function(_0x2292e7,_0x109c05){_0x2292e7=_0x2292e7-0x0;var _0x2f6617=_0xd599[_0x2292e7];return _0x2f6617;};'use strict';var multer=require(_0x9d59('0x0'));var util=require('util');var path=require(_0x9d59('0x1'));var timeout=require(_0x9d59('0x2'));var express=require(_0x9d59('0x3'));var router=express[_0x9d59('0x4')]();var fs_extra=require(_0x9d59('0x5'));var auth=require(_0x9d59('0x6'));var interaction=require(_0x9d59('0x7'));var config=require('../../config/environment');var controller=require(_0x9d59('0x8'));router['get']('/',auth[_0x9d59('0x9')](),controller[_0x9d59('0xa')]);router[_0x9d59('0xb')](_0x9d59('0xc'),auth['isAuthenticated'](),controller[_0x9d59('0xd')]);router[_0x9d59('0xb')]('/:id/sounds',auth['isAuthenticated'](),controller['getSounds']);router[_0x9d59('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9d59('0xe')](_0x9d59('0xf'),auth['isAuthenticated'](),controller[_0x9d59('0x10')]);router[_0x9d59('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x9d59('0x12')]);router[_0x9d59('0x13')](_0x9d59('0xc'),auth['isAuthenticated'](),controller[_0x9d59('0x14')]);router['delete'](_0x9d59('0x15'),auth[_0x9d59('0x9')](),controller[_0x9d59('0x16')]);module[_0x9d59('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 46f757d..8686487 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 _0xf105=['quietmp3','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','name','ENUM','custom','files','mp3nb','quietmp3nb'];(function(_0x67d81c,_0x3cd587){var _0x3a7dc5=function(_0x54b8a3){while(--_0x54b8a3){_0x67d81c['push'](_0x67d81c['shift']());}};_0x3a7dc5(++_0x3cd587);}(_0xf105,0x1d9));var _0x5f10=function(_0x56bb4f,_0x276419){_0x56bb4f=_0x56bb4f-0x0;var _0x3b5173=_0xf105[_0x56bb4f];return _0x3b5173;};'use strict';var Sequelize=require(_0x5f10('0x0'));module[_0x5f10('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5f10('0x2')},'mode':{'type':Sequelize[_0x5f10('0x3')](_0x5f10('0x4'),_0x5f10('0x5'),_0x5f10('0x6'),_0x5f10('0x7'),_0x5f10('0x8'),'mp3'),'allowNull':!![],'defaultValue':_0x5f10('0x5')},'directory':{'type':Sequelize[_0x5f10('0x9')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x5f10('0x9')],'allowNull':!![]},'sort':{'type':Sequelize[_0x5f10('0x9')],'allowNull':!![],'defaultValue':_0x5f10('0xa')},'format':{'type':Sequelize[_0x5f10('0x9')],'allowNull':!![]},'stamp':{'type':_0x5f10('0xb')},'defaultEntry':{'type':Sequelize[_0x5f10('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1b11=['quietmp3','mp3','STRING','alpha','TIMESTAMP','sequelize','exports','name','custom','files','mp3nb'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1b11,0xf7));var _0x11b1=function(_0x697291,_0x3c5eb2){_0x697291=_0x697291-0x0;var _0x344edd=_0x1b11[_0x697291];return _0x344edd;};'use strict';var Sequelize=require(_0x11b1('0x0'));module[_0x11b1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x11b1('0x2')},'mode':{'type':Sequelize['ENUM'](_0x11b1('0x3'),_0x11b1('0x4'),_0x11b1('0x5'),'quietmp3nb',_0x11b1('0x6'),_0x11b1('0x7')),'allowNull':!![],'defaultValue':_0x11b1('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x11b1('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0x11b1('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0x11b1('0x8')],'allowNull':!![],'defaultValue':_0x11b1('0x9')},'format':{'type':Sequelize[_0x11b1('0x8')],'allowNull':!![]},'stamp':{'type':_0x11b1('0xa')},'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 8ba62b6..65af170 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 _0xb830=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','type','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','params','length','body','find','create','transaction','files','directory','join','root','server/files/moh','mode','mkdirSync','0777','user','MusicOnHolds','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','converted_format','symlinkSync','removeSound','id2','getSounds','eml-format','rimraf','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','papaparse','ioredis'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xb830,0xc8));var _0x0b83=function(_0x2cfe6e,_0x24d855){_0x2cfe6e=_0x2cfe6e-0x0;var _0x369d5a=_0xb830[_0x2cfe6e];return _0x369d5a;};'use strict';var emlformat=require(_0x0b83('0x0'));var rimraf=require(_0x0b83('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0b83('0x2'));var BPromise=require(_0x0b83('0x3'));var Mustache=require(_0x0b83('0x4'));var util=require(_0x0b83('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x0b83('0x6'));var ejs=require(_0x0b83('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b83('0x8'));var squel=require(_0x0b83('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0b83('0x6'));var querystring=require('querystring');var Papa=require(_0x0b83('0xa'));var Redis=require(_0x0b83('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x0b83('0xc'));var as=require(_0x0b83('0xd'));var hardwareService=require(_0x0b83('0xe'));var logger=require(_0x0b83('0xf'))('api');var utils=require(_0x0b83('0x10'));var config=require(_0x0b83('0x11'));var licenseUtil=require(_0x0b83('0x12'));var db=require(_0x0b83('0x13'))['db'];function respondWithStatusCode(_0x44f02a,_0x48fb67){_0x48fb67=_0x48fb67||0xcc;return function(_0x55512c){if(_0x55512c){return _0x44f02a['sendStatus'](_0x48fb67);}return _0x44f02a[_0x0b83('0x14')](_0x48fb67)[_0x0b83('0x15')]();};}function respondWithResult(_0x14db42,_0x57701b){_0x57701b=_0x57701b||0xc8;return function(_0xe79c52){if(_0xe79c52){return _0x14db42[_0x0b83('0x14')](_0x57701b)[_0x0b83('0x16')](_0xe79c52);}};}function respondWithFilteredResult(_0x47fed5,_0x47858b){return function(_0x13e792){if(_0x13e792){var _0x4e0e4d=typeof _0x47858b[_0x0b83('0x17')]===_0x0b83('0x18')&&typeof _0x47858b[_0x0b83('0x19')]===_0x0b83('0x18');var _0x4a2d49=_0x13e792[_0x0b83('0x1a')];var _0xcdc29e=_0x4e0e4d?0x0:_0x47858b['offset'];var _0x3012f3=_0x4e0e4d?_0x13e792[_0x0b83('0x1a')]:_0x47858b[_0x0b83('0x17')]+_0x47858b[_0x0b83('0x19')];var _0x3a7354;if(_0x3012f3>=_0x4a2d49){_0x3012f3=_0x4a2d49;_0x3a7354=0xc8;}else{_0x3a7354=0xce;}_0x47fed5[_0x0b83('0x14')](_0x3a7354);return _0x47fed5['set'](_0x0b83('0x1b'),_0xcdc29e+'-'+_0x3012f3+'/'+_0x4a2d49)[_0x0b83('0x16')](_0x13e792);}return null;};}function patchUpdates(_0x48d72c){return function(_0x5123d1){try{jsonpatch[_0x0b83('0x1c')](_0x5123d1,_0x48d72c,!![]);}catch(_0x58ae56){return BPromise[_0x0b83('0x1d')](_0x58ae56);}return _0x5123d1[_0x0b83('0x1e')]();};}function saveUpdates(_0x5b64d0,_0x1da5c4){return function(_0x1bc519){if(_0x1bc519){return _0x1bc519['update'](_0x5b64d0)[_0x0b83('0x1f')](function(_0x5b17d4){return _0x5b17d4;});}return null;};}function removeEntity(_0x40182b,_0x56a39e){return function(_0x57dfe0){if(_0x57dfe0){return _0x57dfe0[_0x0b83('0x20')]()[_0x0b83('0x1f')](function(){var _0x398bbe=_0x57dfe0[_0x0b83('0x21')]({'plain':!![]});var _0x1c496c='MusicOnHolds';return db[_0x0b83('0x22')]['destroy']({'where':{'type':_0x1c496c,'resourceId':_0x398bbe['id']}})['then'](function(){return _0x57dfe0;});})[_0x0b83('0x1f')](function(){_0x40182b[_0x0b83('0x14')](0xcc)[_0x0b83('0x15')]();});}};}function handleEntityNotFound(_0x9a0e80,_0xa663cd){return function(_0x580ae4){if(!_0x580ae4){_0x9a0e80[_0x0b83('0x23')](0x194);}return _0x580ae4;};}function handleError(_0x3fb2d7,_0x1001d0){_0x1001d0=_0x1001d0||0x1f4;return function(_0xdb249f){logger[_0x0b83('0x24')](_0xdb249f[_0x0b83('0x25')]);if(_0xdb249f['name']){delete _0xdb249f[_0x0b83('0x26')];}_0x3fb2d7[_0x0b83('0x14')](_0x1001d0)[_0x0b83('0x27')](_0xdb249f);};}exports[_0x0b83('0x28')]=function(_0x2f0023,_0x437388){var _0xda9b58={},_0x3018e1={},_0x17e004={'count':0x0,'rows':[]};var _0x5df65a=_['map'](db[_0x0b83('0x29')][_0x0b83('0x2a')],function(_0x3915ad){return{'name':_0x3915ad['fieldName'],'type':_0x3915ad[_0x0b83('0x2b')]['key']};});_0x3018e1[_0x0b83('0x2c')]=_[_0x0b83('0x2d')](_0x5df65a,_0x0b83('0x26'));_0x3018e1[_0x0b83('0x2e')]=_[_0x0b83('0x2f')](_0x2f0023[_0x0b83('0x2e')]);_0x3018e1[_0x0b83('0x30')]=_['intersection'](_0x3018e1[_0x0b83('0x2c')],_0x3018e1[_0x0b83('0x2e')]);_0xda9b58[_0x0b83('0x31')]=_[_0x0b83('0x32')](_0x3018e1[_0x0b83('0x2c')],qs[_0x0b83('0x33')](_0x2f0023[_0x0b83('0x2e')][_0x0b83('0x33')]));_0xda9b58[_0x0b83('0x31')]=_0xda9b58[_0x0b83('0x31')]['length']?_0xda9b58[_0x0b83('0x31')]:_0x3018e1[_0x0b83('0x2c')];if(!_0x2f0023[_0x0b83('0x2e')][_0x0b83('0x34')](_0x0b83('0x35'))){_0xda9b58['limit']=qs[_0x0b83('0x19')](_0x2f0023[_0x0b83('0x2e')]['limit']);_0xda9b58[_0x0b83('0x17')]=qs[_0x0b83('0x17')](_0x2f0023[_0x0b83('0x2e')][_0x0b83('0x17')]);}_0xda9b58[_0x0b83('0x36')]=qs[_0x0b83('0x37')](_0x2f0023[_0x0b83('0x2e')][_0x0b83('0x37')]);delete _0x2f0023[_0x0b83('0x2e')][_0x0b83('0x37')];_0xda9b58['where']=qs[_0x0b83('0x30')](_[_0x0b83('0x38')](_0x2f0023[_0x0b83('0x2e')],_0x3018e1[_0x0b83('0x30')]),_0x5df65a);if(_0x2f0023[_0x0b83('0x2e')][_0x0b83('0x39')]){_0xda9b58['where']=_[_0x0b83('0x3a')](_0xda9b58[_0x0b83('0x3b')],{'$or':_[_0x0b83('0x2d')](_0x5df65a,function(_0x4805f2){if(_0x4805f2[_0x0b83('0x2b')]!==_0x0b83('0x3c')){var _0x3981f9={};_0x3981f9[_0x4805f2['name']]={'$like':'%'+_0x2f0023[_0x0b83('0x2e')][_0x0b83('0x39')]+'%'};return _0x3981f9;}})});}_0xda9b58=_[_0x0b83('0x3a')]({},_0xda9b58,_0x2f0023[_0x0b83('0x3d')]);var _0x382157={'where':_0xda9b58[_0x0b83('0x3b')]};return db[_0x0b83('0x29')][_0x0b83('0x1a')](_0x382157)['then'](function(_0xe68863){_0x17e004['count']=_0xe68863;if(_0x2f0023[_0x0b83('0x2e')][_0x0b83('0x3e')]){_0xda9b58[_0x0b83('0x3f')]=[{'all':!![]}];}return db[_0x0b83('0x29')][_0x0b83('0x40')](_0xda9b58);})['then'](function(_0x51cbc8){_0x17e004[_0x0b83('0x41')]=_0x51cbc8;return _0x17e004;})[_0x0b83('0x1f')](respondWithFilteredResult(_0x437388,_0xda9b58))['catch'](handleError(_0x437388,null));};exports['show']=function(_0x52c6d8,_0x3e9faf){var _0x1da596={'raw':![],'where':{'id':_0x52c6d8[_0x0b83('0x42')]['id']}},_0xda215f={};_0xda215f['model']=_[_0x0b83('0x2f')](db[_0x0b83('0x29')]['rawAttributes']);_0xda215f[_0x0b83('0x2e')]=_['keys'](_0x52c6d8['query']);_0xda215f['filters']=_[_0x0b83('0x32')](_0xda215f[_0x0b83('0x2c')],_0xda215f[_0x0b83('0x2e')]);_0x1da596['attributes']=_[_0x0b83('0x32')](_0xda215f[_0x0b83('0x2c')],qs['fields'](_0x52c6d8['query']['fields']));_0x1da596[_0x0b83('0x31')]=_0x1da596[_0x0b83('0x31')][_0x0b83('0x43')]?_0x1da596[_0x0b83('0x31')]:_0xda215f[_0x0b83('0x2c')];if(_0x52c6d8['query'][_0x0b83('0x3e')]){_0x1da596[_0x0b83('0x3f')]=[{'all':!![]}];}_0x1da596=_['merge']({},_0x1da596,_0x52c6d8[_0x0b83('0x3d')]);return db['VoiceMusicOnHold']['find'](_0x1da596)[_0x0b83('0x1f')](handleEntityNotFound(_0x3e9faf,null))[_0x0b83('0x1f')](respondWithResult(_0x3e9faf,null))['catch'](handleError(_0x3e9faf,null));};exports['update']=function(_0x372471,_0x3a824e){if(_0x372471[_0x0b83('0x44')]['id']){delete _0x372471[_0x0b83('0x44')]['id'];}return db[_0x0b83('0x29')][_0x0b83('0x45')]({'where':{'id':_0x372471[_0x0b83('0x42')]['id']}})[_0x0b83('0x1f')](handleEntityNotFound(_0x3a824e,null))[_0x0b83('0x1f')](saveUpdates(_0x372471[_0x0b83('0x44')],null))[_0x0b83('0x1f')](respondWithResult(_0x3a824e,null))['catch'](handleError(_0x3a824e,null));};exports[_0x0b83('0x46')]=function(_0x2f5ab6,_0x3c2e05,_0xe9f4b7){return db['sequelize'][_0x0b83('0x47')](function(_0x318159){if(_0x2f5ab6['body']['mode']===_0x0b83('0x48')){_0x2f5ab6[_0x0b83('0x44')][_0x0b83('0x49')]=path[_0x0b83('0x4a')](config[_0x0b83('0x4b')],_0x0b83('0x4c'),_0x2f5ab6[_0x0b83('0x44')]['name']);}return db[_0x0b83('0x29')]['create'](_0x2f5ab6[_0x0b83('0x44')],{'transaction':_0x318159})[_0x0b83('0x1f')](function(_0x4aa513){if(_0x2f5ab6[_0x0b83('0x44')][_0x0b83('0x4d')]===_0x0b83('0x48')){fs[_0x0b83('0x4e')](_0x4aa513['directory'],parseInt(_0x0b83('0x4f'),0x8));}var _0x2b54a2=_0x2f5ab6[_0x0b83('0x50')][_0x0b83('0x21')]({'plain':!![]});if(!_0x2b54a2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b54a2['role']==='user'){var _0x32f292=_0x4aa513['get']({'plain':!![]});return db['UserProfileSection'][_0x0b83('0x45')]({'where':{'name':_0x0b83('0x51'),'userProfileId':_0x2b54a2['userProfileId']},'raw':!![]})[_0x0b83('0x1f')](function(_0x318003){if(_0x318003&&_0x318003[_0x0b83('0x52')]===0x0){return db['UserProfileResource'][_0x0b83('0x46')]({'name':_0x32f292[_0x0b83('0x26')],'resourceId':_0x32f292['id'],'type':_0x318003[_0x0b83('0x26')],'sectionId':_0x318003['id']},{})[_0x0b83('0x1f')](function(){return _0x4aa513;});}else{return _0x4aa513;}})[_0x0b83('0x53')](function(_0x4e5edd){logger[_0x0b83('0x24')](_0x0b83('0x54'),_0x4e5edd);});}return _0x4aa513;});})['then'](respondWithResult(_0x3c2e05,0xc9))[_0x0b83('0x53')](handleError(_0x3c2e05,null));};exports[_0x0b83('0x20')]=function(_0x3d1a7b,_0x2def4f,_0xb36106){var _0x2a444c;return db[_0x0b83('0x29')][_0x0b83('0x45')]({'where':{'id':_0x3d1a7b[_0x0b83('0x42')]['id']}})[_0x0b83('0x1f')](function(_0x6b92da){if(_0x6b92da){return db[_0x0b83('0x55')][_0x0b83('0x47')](function(_0xfa04b1){return _0x6b92da[_0x0b83('0x20')]({'transaction':_0xfa04b1,'raw':!![]})[_0x0b83('0x1f')](function(_0x3448aa){if(_0x3448aa[_0x0b83('0x49')]){fs['readdirSync'](_0x3448aa['directory'])['forEach'](function(_0x5c35b9){fs[_0x0b83('0x56')](path[_0x0b83('0x4a')](_0x3448aa['directory'],_0x5c35b9));});fs[_0x0b83('0x57')](_0x3448aa[_0x0b83('0x49')]);}return _0x3448aa;});})[_0x0b83('0x53')](function(_0x526f85){throw new db[(_0x0b83('0x58'))][(_0x0b83('0x59'))](_0x526f85[_0x0b83('0x5a')]);});}})[_0x0b83('0x1f')](handleEntityNotFound(_0x2def4f,null))['then'](removeEntity(_0x2def4f,null))['catch'](handleError(_0x2def4f,null));};exports[_0x0b83('0x5b')]=function(_0x456010,_0x466bb2,_0x2168bb){return db[_0x0b83('0x55')]['transaction'](function(_0x5c79ff){var _0x24a3ca;return db['VoiceMusicOnHold'][_0x0b83('0x45')]({'where':{'id':_0x456010[_0x0b83('0x42')]['id']}})[_0x0b83('0x1f')](function(_0x3442f2){if(_0x3442f2){_0x24a3ca=_0x3442f2;return _0x3442f2[_0x0b83('0x5b')](_0x456010[_0x0b83('0x44')]['id'],{'transaction':_0x5c79ff});}})[_0x0b83('0x1f')](function(_0x1efacc){if(_0x1efacc){return db[_0x0b83('0x5c')][_0x0b83('0x5d')]({'where':{'id':_0x456010[_0x0b83('0x44')]['id']},'attributes':['id',_0x0b83('0x26'),_0x0b83('0x5e'),'converted_format',_0x0b83('0x5f')],'raw':!![]});}})[_0x0b83('0x1f')](function(_0x33c10d){if(_0x33c10d){var _0x33ec1e=path['join'](config[_0x0b83('0x4b')],_0x0b83('0x60'),util[_0x0b83('0x61')](_0x0b83('0x62'),path[_0x0b83('0x63')](_0x33c10d[_0x0b83('0x5e')],path[_0x0b83('0x64')](_0x33c10d[_0x0b83('0x5e')])),_0x33c10d[_0x0b83('0x65')]));var _0x252521=path['join'](config[_0x0b83('0x4b')],_0x0b83('0x4c'),_0x24a3ca['name'],util[_0x0b83('0x61')](_0x0b83('0x62'),_0x33c10d[_0x0b83('0x26')],_0x33c10d[_0x0b83('0x65')]));fs[_0x0b83('0x66')](_0x33ec1e,_0x252521);return _0x33c10d;}})[_0x0b83('0x53')](function(_0x384d0d){throw new db[(_0x0b83('0x58'))][(_0x0b83('0x59'))](_0x384d0d[_0x0b83('0x5a')]);});})['then'](handleEntityNotFound(_0x466bb2,null))[_0x0b83('0x1f')](respondWithResult(_0x466bb2,0xc9))[_0x0b83('0x53')](handleError(_0x466bb2,null));};exports[_0x0b83('0x67')]=function(_0x23c6f3,_0x27a234,_0x3ac89a){return db[_0x0b83('0x55')][_0x0b83('0x47')](function(_0x5a038c){var _0x28ff8c;return db[_0x0b83('0x29')][_0x0b83('0x5d')]({'where':{'id':_0x23c6f3[_0x0b83('0x42')]['id']}})[_0x0b83('0x1f')](handleEntityNotFound(_0x27a234,null))['then'](function(_0x391634){if(_0x391634){_0x28ff8c=_0x391634;return _0x391634['removeSound'](_0x23c6f3['params'][_0x0b83('0x68')]);}})['then'](function(_0x9f23c0){if(_0x9f23c0){return db[_0x0b83('0x5c')][_0x0b83('0x5d')]({'where':{'id':_0x23c6f3[_0x0b83('0x42')][_0x0b83('0x68')]},'attributes':['id',_0x0b83('0x26'),_0x0b83('0x5e'),_0x0b83('0x65'),_0x0b83('0x5f')],'raw':!![]});}})[_0x0b83('0x1f')](function(_0x27b793){if(_0x27b793){fs[_0x0b83('0x56')](path[_0x0b83('0x4a')](_0x28ff8c[_0x0b83('0x49')],util[_0x0b83('0x61')](_0x0b83('0x62'),_0x27b793[_0x0b83('0x26')],_0x27b793['converted_format'])));return _0x27b793;}})['catch'](function(_0x412bc4){throw new db[(_0x0b83('0x58'))]['ValidationError'](_0x412bc4[_0x0b83('0x5a')]);});})[_0x0b83('0x1f')](handleEntityNotFound(_0x27a234,null))[_0x0b83('0x1f')](respondWithStatusCode(_0x27a234,0xcc))[_0x0b83('0x53')](handleError(_0x27a234,null));};exports[_0x0b83('0x69')]=function(_0x599954,_0x2d83f3,_0x436866){var _0x1e569d={};var _0x31b983={};var _0x30fced;var _0x5b91f7;return db[_0x0b83('0x29')][_0x0b83('0x5d')]({'where':{'id':_0x599954[_0x0b83('0x42')]['id']}})[_0x0b83('0x1f')](handleEntityNotFound(_0x2d83f3,null))[_0x0b83('0x1f')](function(_0x14e587){if(_0x14e587){_0x30fced=_0x14e587;_0x31b983['model']=_[_0x0b83('0x2f')](db[_0x0b83('0x5c')]['rawAttributes']);_0x31b983[_0x0b83('0x2e')]=_[_0x0b83('0x2f')](_0x599954['query']);_0x31b983[_0x0b83('0x30')]=_[_0x0b83('0x32')](_0x31b983[_0x0b83('0x2c')],_0x31b983[_0x0b83('0x2e')]);_0x1e569d[_0x0b83('0x31')]=_['intersection'](_0x31b983[_0x0b83('0x2c')],qs[_0x0b83('0x33')](_0x599954[_0x0b83('0x2e')][_0x0b83('0x33')]));_0x1e569d[_0x0b83('0x31')]=_0x1e569d[_0x0b83('0x31')][_0x0b83('0x43')]?_0x1e569d[_0x0b83('0x31')]:_0x31b983[_0x0b83('0x2c')];_0x1e569d[_0x0b83('0x36')]=qs[_0x0b83('0x37')](_0x599954[_0x0b83('0x2e')][_0x0b83('0x37')]);_0x1e569d[_0x0b83('0x3b')]=qs[_0x0b83('0x30')](_[_0x0b83('0x38')](_0x599954['query'],_0x31b983[_0x0b83('0x30')]));if(_0x599954[_0x0b83('0x2e')]['filter']){_0x1e569d[_0x0b83('0x3b')]=_[_0x0b83('0x3a')](_0x1e569d[_0x0b83('0x3b')],{'$or':_[_0x0b83('0x2d')](_0x1e569d['attributes'],function(_0x1d6f5e){var _0x1de604={};_0x1de604[_0x1d6f5e]={'$like':'%'+_0x599954['query'][_0x0b83('0x39')]+'%'};return _0x1de604;})});}_0x1e569d=_[_0x0b83('0x3a')]({},_0x1e569d,_0x599954['options']);return _0x30fced[_0x0b83('0x69')](_0x1e569d);}})[_0x0b83('0x1f')](function(_0x2341ae){if(_0x2341ae){_0x5b91f7=_0x2341ae[_0x0b83('0x43')];if(!_0x599954[_0x0b83('0x2e')]['hasOwnProperty'](_0x0b83('0x35'))){_0x1e569d[_0x0b83('0x19')]=qs['limit'](_0x599954[_0x0b83('0x2e')][_0x0b83('0x19')]);_0x1e569d[_0x0b83('0x17')]=qs[_0x0b83('0x17')](_0x599954[_0x0b83('0x2e')][_0x0b83('0x17')]);}return _0x30fced[_0x0b83('0x69')](_0x1e569d);}})['then'](function(_0x1405bc){if(_0x1405bc){return _0x1405bc?{'count':_0x5b91f7,'rows':_0x1405bc}:null;}})[_0x0b83('0x1f')](respondWithResult(_0x2d83f3,null))[_0x0b83('0x53')](handleError(_0x2d83f3,null));}; \ No newline at end of file +var _0xab76=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','unlinkSync','Sequelize','ValidationError','addSound','Sound','findOne','converted_format','server/files/sounds/converted','format','%s.%s','save_name','symlinkSync','message','removeSound','id2','createdAt','filter','getSounds','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','error','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','VoiceMusicOnHold','includeAll','findAll','rows','catch','params','include','find','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync'];(function(_0x5c0441,_0x55a708){var _0xa8ed7d=function(_0x54eb1c){while(--_0x54eb1c){_0x5c0441['push'](_0x5c0441['shift']());}};_0xa8ed7d(++_0x55a708);}(_0xab76,0x1ea));var _0x6ab7=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xab76[_0x2bf141];return _0x48277b;};'use strict';var emlformat=require(_0x6ab7('0x0'));var rimraf=require(_0x6ab7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6ab7('0x2'));var rp=require(_0x6ab7('0x3'));var moment=require('moment');var BPromise=require(_0x6ab7('0x4'));var Mustache=require(_0x6ab7('0x5'));var util=require(_0x6ab7('0x6'));var path=require(_0x6ab7('0x7'));var sox=require(_0x6ab7('0x8'));var csv=require(_0x6ab7('0x9'));var ejs=require(_0x6ab7('0xa'));var fs=require('fs');var fs_extra=require(_0x6ab7('0xb'));var _=require('lodash');var squel=require(_0x6ab7('0xc'));var crypto=require(_0x6ab7('0xd'));var jsforce=require(_0x6ab7('0xe'));var deskjs=require(_0x6ab7('0xf'));var toCsv=require(_0x6ab7('0x9'));var querystring=require(_0x6ab7('0x10'));var Papa=require(_0x6ab7('0x11'));var Redis=require(_0x6ab7('0x12'));var authService=require(_0x6ab7('0x13'));var qs=require(_0x6ab7('0x14'));var as=require(_0x6ab7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6ab7('0x16'));var utils=require('../../config/utils');var config=require(_0x6ab7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ab7('0x18'))['db'];function respondWithStatusCode(_0x559b39,_0x30b02c){_0x30b02c=_0x30b02c||0xcc;return function(_0x2aa5f0){if(_0x2aa5f0){return _0x559b39[_0x6ab7('0x19')](_0x30b02c);}return _0x559b39[_0x6ab7('0x1a')](_0x30b02c)[_0x6ab7('0x1b')]();};}function respondWithResult(_0x5de1d0,_0x2fd0f0){_0x2fd0f0=_0x2fd0f0||0xc8;return function(_0x41924b){if(_0x41924b){return _0x5de1d0[_0x6ab7('0x1a')](_0x2fd0f0)[_0x6ab7('0x1c')](_0x41924b);}};}function respondWithFilteredResult(_0x1c86a1,_0xaed371){return function(_0x587314){if(_0x587314){var _0x1b5b0c=typeof _0xaed371['offset']==='undefined'&&typeof _0xaed371['limit']===_0x6ab7('0x1d');var _0x285d55=_0x587314[_0x6ab7('0x1e')];var _0x49e33e=_0x1b5b0c?0x0:_0xaed371[_0x6ab7('0x1f')];var _0xead6f=_0x1b5b0c?_0x587314['count']:_0xaed371[_0x6ab7('0x1f')]+_0xaed371[_0x6ab7('0x20')];var _0x275798;if(_0xead6f>=_0x285d55){_0xead6f=_0x285d55;_0x275798=0xc8;}else{_0x275798=0xce;}_0x1c86a1[_0x6ab7('0x1a')](_0x275798);return _0x1c86a1[_0x6ab7('0x21')](_0x6ab7('0x22'),_0x49e33e+'-'+_0xead6f+'/'+_0x285d55)['json'](_0x587314);}return null;};}function patchUpdates(_0x370fc0){return function(_0x254c7b){try{jsonpatch[_0x6ab7('0x23')](_0x254c7b,_0x370fc0,!![]);}catch(_0x5e5b41){return BPromise[_0x6ab7('0x24')](_0x5e5b41);}return _0x254c7b[_0x6ab7('0x25')]();};}function saveUpdates(_0x2c2886,_0x477b51){return function(_0x30318d){if(_0x30318d){return _0x30318d[_0x6ab7('0x26')](_0x2c2886)['then'](function(_0x200141){return _0x200141;});}return null;};}function removeEntity(_0x19d2cd,_0x28b380){return function(_0x2e5377){if(_0x2e5377){return _0x2e5377['destroy']()[_0x6ab7('0x27')](function(){var _0x458a12=_0x2e5377[_0x6ab7('0x28')]({'plain':!![]});var _0x4e3f60=_0x6ab7('0x29');return db[_0x6ab7('0x2a')][_0x6ab7('0x2b')]({'where':{'type':_0x4e3f60,'resourceId':_0x458a12['id']}})['then'](function(){return _0x2e5377;});})[_0x6ab7('0x27')](function(){_0x19d2cd[_0x6ab7('0x1a')](0xcc)[_0x6ab7('0x1b')]();});}};}function handleEntityNotFound(_0x3546a4,_0x190fec){return function(_0xe98257){if(!_0xe98257){_0x3546a4[_0x6ab7('0x19')](0x194);}return _0xe98257;};}function handleError(_0x542c90,_0x342cf4){_0x342cf4=_0x342cf4||0x1f4;return function(_0x345ede){logger[_0x6ab7('0x2c')](_0x345ede[_0x6ab7('0x2d')]);if(_0x345ede[_0x6ab7('0x2e')]){delete _0x345ede[_0x6ab7('0x2e')];}_0x542c90[_0x6ab7('0x1a')](_0x342cf4)[_0x6ab7('0x2f')](_0x345ede);};}exports[_0x6ab7('0x30')]=function(_0x6210c5,_0x6516a9){var _0x39638e={},_0x2cbe94={},_0x1a713e={'count':0x0,'rows':[]};var _0x576899=_[_0x6ab7('0x31')](db['VoiceMusicOnHold'][_0x6ab7('0x32')],function(_0x1e6599){return{'name':_0x1e6599[_0x6ab7('0x33')],'type':_0x1e6599[_0x6ab7('0x34')][_0x6ab7('0x35')]};});_0x2cbe94[_0x6ab7('0x36')]=_[_0x6ab7('0x31')](_0x576899,_0x6ab7('0x2e'));_0x2cbe94[_0x6ab7('0x37')]=_[_0x6ab7('0x38')](_0x6210c5['query']);_0x2cbe94[_0x6ab7('0x39')]=_[_0x6ab7('0x3a')](_0x2cbe94[_0x6ab7('0x36')],_0x2cbe94[_0x6ab7('0x37')]);_0x39638e[_0x6ab7('0x3b')]=_[_0x6ab7('0x3a')](_0x2cbe94['model'],qs[_0x6ab7('0x3c')](_0x6210c5[_0x6ab7('0x37')][_0x6ab7('0x3c')]));_0x39638e[_0x6ab7('0x3b')]=_0x39638e[_0x6ab7('0x3b')][_0x6ab7('0x3d')]?_0x39638e['attributes']:_0x2cbe94['model'];if(!_0x6210c5[_0x6ab7('0x37')][_0x6ab7('0x3e')](_0x6ab7('0x3f'))){_0x39638e[_0x6ab7('0x20')]=qs['limit'](_0x6210c5[_0x6ab7('0x37')]['limit']);_0x39638e[_0x6ab7('0x1f')]=qs[_0x6ab7('0x1f')](_0x6210c5[_0x6ab7('0x37')][_0x6ab7('0x1f')]);}_0x39638e[_0x6ab7('0x40')]=qs['sort'](_0x6210c5[_0x6ab7('0x37')]['sort']);delete _0x6210c5[_0x6ab7('0x37')][_0x6ab7('0x41')];_0x39638e[_0x6ab7('0x42')]=qs[_0x6ab7('0x39')](_[_0x6ab7('0x43')](_0x6210c5[_0x6ab7('0x37')],_0x2cbe94[_0x6ab7('0x39')]),_0x576899);if(_0x6210c5[_0x6ab7('0x37')]['filter']){_0x39638e[_0x6ab7('0x42')]=_[_0x6ab7('0x44')](_0x39638e[_0x6ab7('0x42')],{'$or':_[_0x6ab7('0x31')](_0x576899,function(_0x5a04a0){if(_0x5a04a0[_0x6ab7('0x34')]!==_0x6ab7('0x45')){var _0x578962={};_0x578962[_0x5a04a0[_0x6ab7('0x2e')]]={'$like':'%'+_0x6210c5['query']['filter']+'%'};return _0x578962;}})});}_0x39638e=_[_0x6ab7('0x44')]({},_0x39638e,_0x6210c5[_0x6ab7('0x46')]);var _0x18bd7f={'where':_0x39638e[_0x6ab7('0x42')]};return db[_0x6ab7('0x47')][_0x6ab7('0x1e')](_0x18bd7f)['then'](function(_0x39f089){_0x1a713e['count']=_0x39f089;if(_0x6210c5[_0x6ab7('0x37')][_0x6ab7('0x48')]){_0x39638e['include']=[{'all':!![]}];}return db[_0x6ab7('0x47')][_0x6ab7('0x49')](_0x39638e);})['then'](function(_0x519500){_0x1a713e[_0x6ab7('0x4a')]=_0x519500;return _0x1a713e;})['then'](respondWithFilteredResult(_0x6516a9,_0x39638e))[_0x6ab7('0x4b')](handleError(_0x6516a9,null));};exports['show']=function(_0x370b4c,_0x4df990){var _0x5bc9d0={'raw':![],'where':{'id':_0x370b4c[_0x6ab7('0x4c')]['id']}},_0x4bc6d9={};_0x4bc6d9['model']=_[_0x6ab7('0x38')](db[_0x6ab7('0x47')][_0x6ab7('0x32')]);_0x4bc6d9['query']=_[_0x6ab7('0x38')](_0x370b4c[_0x6ab7('0x37')]);_0x4bc6d9[_0x6ab7('0x39')]=_[_0x6ab7('0x3a')](_0x4bc6d9[_0x6ab7('0x36')],_0x4bc6d9['query']);_0x5bc9d0[_0x6ab7('0x3b')]=_[_0x6ab7('0x3a')](_0x4bc6d9[_0x6ab7('0x36')],qs[_0x6ab7('0x3c')](_0x370b4c[_0x6ab7('0x37')][_0x6ab7('0x3c')]));_0x5bc9d0[_0x6ab7('0x3b')]=_0x5bc9d0[_0x6ab7('0x3b')]['length']?_0x5bc9d0[_0x6ab7('0x3b')]:_0x4bc6d9[_0x6ab7('0x36')];if(_0x370b4c[_0x6ab7('0x37')][_0x6ab7('0x48')]){_0x5bc9d0[_0x6ab7('0x4d')]=[{'all':!![]}];}_0x5bc9d0=_[_0x6ab7('0x44')]({},_0x5bc9d0,_0x370b4c['options']);return db[_0x6ab7('0x47')][_0x6ab7('0x4e')](_0x5bc9d0)[_0x6ab7('0x27')](handleEntityNotFound(_0x4df990,null))['then'](respondWithResult(_0x4df990,null))[_0x6ab7('0x4b')](handleError(_0x4df990,null));};exports['update']=function(_0x17387e,_0x1ba5c0){if(_0x17387e[_0x6ab7('0x4f')]['id']){delete _0x17387e[_0x6ab7('0x4f')]['id'];}return db[_0x6ab7('0x47')]['find']({'where':{'id':_0x17387e[_0x6ab7('0x4c')]['id']}})[_0x6ab7('0x27')](handleEntityNotFound(_0x1ba5c0,null))[_0x6ab7('0x27')](saveUpdates(_0x17387e['body'],null))[_0x6ab7('0x27')](respondWithResult(_0x1ba5c0,null))[_0x6ab7('0x4b')](handleError(_0x1ba5c0,null));};exports[_0x6ab7('0x50')]=function(_0x186aaa,_0x55bf61,_0x21384a){return db[_0x6ab7('0x51')][_0x6ab7('0x52')](function(_0x5e83bc){if(_0x186aaa[_0x6ab7('0x4f')][_0x6ab7('0x53')]===_0x6ab7('0x54')){_0x186aaa[_0x6ab7('0x4f')][_0x6ab7('0x55')]=path[_0x6ab7('0x56')](config[_0x6ab7('0x57')],_0x6ab7('0x58'),_0x186aaa[_0x6ab7('0x4f')][_0x6ab7('0x2e')]);}return db[_0x6ab7('0x47')][_0x6ab7('0x50')](_0x186aaa[_0x6ab7('0x4f')],{'transaction':_0x5e83bc})[_0x6ab7('0x27')](function(_0x48235b){if(_0x186aaa[_0x6ab7('0x4f')]['mode']===_0x6ab7('0x54')){fs[_0x6ab7('0x59')](_0x48235b[_0x6ab7('0x55')],parseInt('0777',0x8));}var _0x1b942a=_0x186aaa['user']['get']({'plain':!![]});if(!_0x1b942a)throw new Error(_0x6ab7('0x5a'));if(_0x1b942a[_0x6ab7('0x5b')]===_0x6ab7('0x5c')){var _0x2f94dd=_0x48235b['get']({'plain':!![]});return db[_0x6ab7('0x5d')][_0x6ab7('0x4e')]({'where':{'name':_0x6ab7('0x29'),'userProfileId':_0x1b942a[_0x6ab7('0x5e')]},'raw':!![]})['then'](function(_0x51ea18){if(_0x51ea18&&_0x51ea18[_0x6ab7('0x5f')]===0x0){return db[_0x6ab7('0x2a')][_0x6ab7('0x50')]({'name':_0x2f94dd[_0x6ab7('0x2e')],'resourceId':_0x2f94dd['id'],'type':_0x51ea18[_0x6ab7('0x2e')],'sectionId':_0x51ea18['id']},{})[_0x6ab7('0x27')](function(){return _0x48235b;});}else{return _0x48235b;}})[_0x6ab7('0x4b')](function(_0x2a4f16){logger[_0x6ab7('0x2c')](_0x6ab7('0x60'),_0x2a4f16);});}return _0x48235b;});})['then'](respondWithResult(_0x55bf61,0xc9))[_0x6ab7('0x4b')](handleError(_0x55bf61,null));};exports['destroy']=function(_0x47a906,_0x172701,_0x1dac5b){var _0x332c92;return db[_0x6ab7('0x47')][_0x6ab7('0x4e')]({'where':{'id':_0x47a906['params']['id']}})['then'](function(_0x3099bc){if(_0x3099bc){return db[_0x6ab7('0x51')]['transaction'](function(_0x6867ea){return _0x3099bc[_0x6ab7('0x2b')]({'transaction':_0x6867ea,'raw':!![]})[_0x6ab7('0x27')](function(_0x1157eb){if(_0x1157eb[_0x6ab7('0x55')]){fs[_0x6ab7('0x61')](_0x1157eb['directory'])['forEach'](function(_0x240d8){fs[_0x6ab7('0x62')](path[_0x6ab7('0x56')](_0x1157eb['directory'],_0x240d8));});fs['rmdirSync'](_0x1157eb[_0x6ab7('0x55')]);}return _0x1157eb;});})[_0x6ab7('0x4b')](function(_0x2519c1){throw new db[(_0x6ab7('0x63'))][(_0x6ab7('0x64'))](_0x2519c1['message']);});}})[_0x6ab7('0x27')](handleEntityNotFound(_0x172701,null))[_0x6ab7('0x27')](removeEntity(_0x172701,null))[_0x6ab7('0x4b')](handleError(_0x172701,null));};exports[_0x6ab7('0x65')]=function(_0x4d847f,_0x25e046,_0x2908bc){return db[_0x6ab7('0x51')]['transaction'](function(_0x47a0df){var _0x2c0c34;return db[_0x6ab7('0x47')]['find']({'where':{'id':_0x4d847f['params']['id']}})[_0x6ab7('0x27')](function(_0x37eb9a){if(_0x37eb9a){_0x2c0c34=_0x37eb9a;return _0x37eb9a['addSound'](_0x4d847f[_0x6ab7('0x4f')]['id'],{'transaction':_0x47a0df});}})[_0x6ab7('0x27')](function(_0x387f38){if(_0x387f38){return db[_0x6ab7('0x66')][_0x6ab7('0x67')]({'where':{'id':_0x4d847f[_0x6ab7('0x4f')]['id']},'attributes':['id',_0x6ab7('0x2e'),'save_name',_0x6ab7('0x68'),'createdAt'],'raw':!![]});}})[_0x6ab7('0x27')](function(_0x21523a){if(_0x21523a){var _0x42a032=path[_0x6ab7('0x56')](config[_0x6ab7('0x57')],_0x6ab7('0x69'),util[_0x6ab7('0x6a')](_0x6ab7('0x6b'),path['basename'](_0x21523a[_0x6ab7('0x6c')],path['extname'](_0x21523a['save_name'])),_0x21523a['converted_format']));var _0x32ca5a=path[_0x6ab7('0x56')](config[_0x6ab7('0x57')],_0x6ab7('0x58'),_0x2c0c34[_0x6ab7('0x2e')],util[_0x6ab7('0x6a')]('%s.%s',_0x21523a[_0x6ab7('0x2e')],_0x21523a[_0x6ab7('0x68')]));fs[_0x6ab7('0x6d')](_0x42a032,_0x32ca5a);return _0x21523a;}})[_0x6ab7('0x4b')](function(_0x48ac1d){throw new db['Sequelize'][(_0x6ab7('0x64'))](_0x48ac1d[_0x6ab7('0x6e')]);});})['then'](handleEntityNotFound(_0x25e046,null))['then'](respondWithResult(_0x25e046,0xc9))[_0x6ab7('0x4b')](handleError(_0x25e046,null));};exports[_0x6ab7('0x6f')]=function(_0x51f355,_0x1caf42,_0x4f31d1){return db[_0x6ab7('0x51')][_0x6ab7('0x52')](function(_0x3a4bc6){var _0x1a8dfe;return db['VoiceMusicOnHold'][_0x6ab7('0x67')]({'where':{'id':_0x51f355[_0x6ab7('0x4c')]['id']}})[_0x6ab7('0x27')](handleEntityNotFound(_0x1caf42,null))[_0x6ab7('0x27')](function(_0x491c08){if(_0x491c08){_0x1a8dfe=_0x491c08;return _0x491c08[_0x6ab7('0x6f')](_0x51f355[_0x6ab7('0x4c')][_0x6ab7('0x70')]);}})[_0x6ab7('0x27')](function(_0x27714f){if(_0x27714f){return db[_0x6ab7('0x66')][_0x6ab7('0x67')]({'where':{'id':_0x51f355[_0x6ab7('0x4c')][_0x6ab7('0x70')]},'attributes':['id',_0x6ab7('0x2e'),_0x6ab7('0x6c'),'converted_format',_0x6ab7('0x71')],'raw':!![]});}})['then'](function(_0x503813){if(_0x503813){fs[_0x6ab7('0x62')](path['join'](_0x1a8dfe[_0x6ab7('0x55')],util[_0x6ab7('0x6a')](_0x6ab7('0x6b'),_0x503813[_0x6ab7('0x2e')],_0x503813[_0x6ab7('0x68')])));return _0x503813;}})['catch'](function(_0x5b039a){throw new db[(_0x6ab7('0x63'))]['ValidationError'](_0x5b039a[_0x6ab7('0x6e')]);});})['then'](handleEntityNotFound(_0x1caf42,null))['then'](respondWithStatusCode(_0x1caf42,0xcc))['catch'](handleError(_0x1caf42,null));};exports['getSounds']=function(_0x1e0ff4,_0x310ab7,_0x2db1c4){var _0xbe4054={};var _0xa3b66a={};var _0x546e93;var _0x381a2d;return db[_0x6ab7('0x47')][_0x6ab7('0x67')]({'where':{'id':_0x1e0ff4['params']['id']}})[_0x6ab7('0x27')](handleEntityNotFound(_0x310ab7,null))[_0x6ab7('0x27')](function(_0x3efa5b){if(_0x3efa5b){_0x546e93=_0x3efa5b;_0xa3b66a['model']=_[_0x6ab7('0x38')](db[_0x6ab7('0x66')]['rawAttributes']);_0xa3b66a[_0x6ab7('0x37')]=_[_0x6ab7('0x38')](_0x1e0ff4[_0x6ab7('0x37')]);_0xa3b66a[_0x6ab7('0x39')]=_['intersection'](_0xa3b66a[_0x6ab7('0x36')],_0xa3b66a[_0x6ab7('0x37')]);_0xbe4054[_0x6ab7('0x3b')]=_['intersection'](_0xa3b66a[_0x6ab7('0x36')],qs[_0x6ab7('0x3c')](_0x1e0ff4['query'][_0x6ab7('0x3c')]));_0xbe4054[_0x6ab7('0x3b')]=_0xbe4054[_0x6ab7('0x3b')]['length']?_0xbe4054[_0x6ab7('0x3b')]:_0xa3b66a[_0x6ab7('0x36')];_0xbe4054[_0x6ab7('0x40')]=qs[_0x6ab7('0x41')](_0x1e0ff4[_0x6ab7('0x37')][_0x6ab7('0x41')]);_0xbe4054[_0x6ab7('0x42')]=qs[_0x6ab7('0x39')](_[_0x6ab7('0x43')](_0x1e0ff4['query'],_0xa3b66a['filters']));if(_0x1e0ff4[_0x6ab7('0x37')][_0x6ab7('0x72')]){_0xbe4054[_0x6ab7('0x42')]=_['merge'](_0xbe4054['where'],{'$or':_[_0x6ab7('0x31')](_0xbe4054[_0x6ab7('0x3b')],function(_0x58d885){var _0x43ebb1={};_0x43ebb1[_0x58d885]={'$like':'%'+_0x1e0ff4[_0x6ab7('0x37')][_0x6ab7('0x72')]+'%'};return _0x43ebb1;})});}_0xbe4054=_[_0x6ab7('0x44')]({},_0xbe4054,_0x1e0ff4[_0x6ab7('0x46')]);return _0x546e93[_0x6ab7('0x73')](_0xbe4054);}})[_0x6ab7('0x27')](function(_0x1085a5){if(_0x1085a5){_0x381a2d=_0x1085a5['length'];if(!_0x1e0ff4[_0x6ab7('0x37')][_0x6ab7('0x3e')](_0x6ab7('0x3f'))){_0xbe4054[_0x6ab7('0x20')]=qs[_0x6ab7('0x20')](_0x1e0ff4[_0x6ab7('0x37')][_0x6ab7('0x20')]);_0xbe4054[_0x6ab7('0x1f')]=qs[_0x6ab7('0x1f')](_0x1e0ff4[_0x6ab7('0x37')][_0x6ab7('0x1f')]);}return _0x546e93[_0x6ab7('0x73')](_0xbe4054);}})[_0x6ab7('0x27')](function(_0x39b173){if(_0x39b173){return _0x39b173?{'count':_0x381a2d,'rows':_0x39b173}:null;}})[_0x6ab7('0x27')](respondWithResult(_0x310ab7,null))[_0x6ab7('0x4b')](handleError(_0x310ab7,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index f4c7754..0446e0b 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 _0x16bb=['util','api','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash'];(function(_0x128450,_0x5869ba){var _0x4d80ed=function(_0x4a2da3){while(--_0x4a2da3){_0x128450['push'](_0x128450['shift']());}};_0x4d80ed(++_0x5869ba);}(_0x16bb,0x1a1));var _0xb16b=function(_0x2712f3,_0x15e8f6){_0x2712f3=_0x2712f3-0x0;var _0x126cbd=_0x16bb[_0x2712f3];return _0x126cbd;};'use strict';var _=require(_0xb16b('0x0'));var util=require(_0xb16b('0x1'));var logger=require('../../config/logger')(_0xb16b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb16b('0x3'));var fs=require('fs');var path=require(_0xb16b('0x4'));var rimraf=require(_0xb16b('0x5'));var config=require(_0xb16b('0x6'));var attributes=require(_0xb16b('0x7'));module[_0xb16b('0x8')]=function(_0xf08bd0,_0x2eb84c){return _0xf08bd0[_0xb16b('0x9')](_0xb16b('0xa'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fdd=['util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x3fdd,0xcb));var _0xd3fd=function(_0x69c9a6,_0x59bf4d){_0x69c9a6=_0x69c9a6-0x0;var _0x3fb1a2=_0x3fdd[_0x69c9a6];return _0x3fb1a2;};'use strict';var _=require(_0xd3fd('0x0'));var util=require(_0xd3fd('0x1'));var logger=require(_0xd3fd('0x2'))(_0xd3fd('0x3'));var moment=require(_0xd3fd('0x4'));var BPromise=require(_0xd3fd('0x5'));var rp=require(_0xd3fd('0x6'));var fs=require('fs');var path=require(_0xd3fd('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd3fd('0x8'));module[_0xd3fd('0x9')]=function(_0x488160,_0x272755){return _0x488160[_0xd3fd('0xa')](_0xd3fd('0xb'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index f656243..fddb842 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x148f42,_0x1b2fb0){var _0x407a90=function(_0x36b6ac){while(--_0x36b6ac){_0x148f42['push'](_0x148f42['shift']());}};_0x407a90(++_0x1b2fb0);}(_0x34e8,0x12c));var _0x834e=function(_0x554578,_0x7cfb03){_0x554578=_0x554578-0x0;var _0x3c7d53=_0x34e8[_0x554578];return _0x3c7d53;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x1e5066,_0x2f4db6){var _0x1cbd7a=function(_0xfab8ea){while(--_0xfab8ea){_0x1e5066['push'](_0x1e5066['shift']());}};_0x1cbd7a(++_0x2f4db6);}(_0xedd9,0xfc));var _0x9edd=function(_0x5b308d,_0x1c85e4){_0x5b308d=_0x5b308d-0x0;var _0x39fed7=_0xedd9[_0x5b308d];return _0x39fed7;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index e991d58..96669bd 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 _0xf3ff=['./voicePrefix.controller','get','index','isAuthenticated','describe','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','/:id','delete','destroy','removeAgents','removeTeams','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2ccbc6,_0x5a2dbe){var _0x47902f=function(_0xef0c98){while(--_0xef0c98){_0x2ccbc6['push'](_0x2ccbc6['shift']());}};_0x47902f(++_0x5a2dbe);}(_0xf3ff,0xae));var _0xff3f=function(_0x33e93c,_0x4259b0){_0x33e93c=_0x33e93c-0x0;var _0x272008=_0xf3ff[_0x33e93c];return _0x272008;};'use strict';var multer=require(_0xff3f('0x0'));var util=require('util');var path=require(_0xff3f('0x1'));var timeout=require(_0xff3f('0x2'));var express=require(_0xff3f('0x3'));var router=express[_0xff3f('0x4')]();var fs_extra=require(_0xff3f('0x5'));var auth=require(_0xff3f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xff3f('0x7'));var controller=require(_0xff3f('0x8'));router[_0xff3f('0x9')]('/',auth['isAuthenticated'](),controller[_0xff3f('0xa')]);router[_0xff3f('0x9')]('/describe',auth[_0xff3f('0xb')](),controller[_0xff3f('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xff3f('0xd')]);router['get'](_0xff3f('0xe'),auth['isAuthenticated'](),controller[_0xff3f('0xf')]);router[_0xff3f('0x9')](_0xff3f('0x10'),auth[_0xff3f('0xb')](),controller[_0xff3f('0x11')]);router[_0xff3f('0x12')]('/',auth[_0xff3f('0xb')](),controller[_0xff3f('0x13')]);router[_0xff3f('0x12')](_0xff3f('0xe'),auth['isAuthenticated'](),controller['addAgents']);router[_0xff3f('0x12')](_0xff3f('0x10'),auth[_0xff3f('0xb')](),controller['addTeams']);router['put'](_0xff3f('0x14'),auth['isAuthenticated'](),controller['update']);router[_0xff3f('0x15')](_0xff3f('0x14'),auth['isAuthenticated'](),controller[_0xff3f('0x16')]);router['delete'](_0xff3f('0xe'),auth['isAuthenticated'](),controller[_0xff3f('0x17')]);router[_0xff3f('0x15')](_0xff3f('0x10'),auth['isAuthenticated'](),controller[_0xff3f('0x18')]);module[_0xff3f('0x19')]=router; \ No newline at end of file +var _0xfbf0=['addAgents','/:id/teams','addTeams','put','update','delete','destroy','removeTeams','exports','util','path','Router','fs-extra','../../components/interaction/service','./voicePrefix.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/users','getTeams','post','create'];(function(_0x555ebb,_0x4b1b68){var _0x3c0a4a=function(_0x312e2f){while(--_0x312e2f){_0x555ebb['push'](_0x555ebb['shift']());}};_0x3c0a4a(++_0x4b1b68);}(_0xfbf0,0x141));var _0x0fbf=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xfbf0[_0xdc37a1];return _0x99b4fe;};'use strict';var multer=require('multer');var util=require(_0x0fbf('0x0'));var path=require(_0x0fbf('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0fbf('0x2')]();var fs_extra=require(_0x0fbf('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0fbf('0x4'));var config=require('../../config/environment');var controller=require(_0x0fbf('0x5'));router['get']('/',auth[_0x0fbf('0x6')](),controller[_0x0fbf('0x7')]);router['get'](_0x0fbf('0x8'),auth[_0x0fbf('0x6')](),controller[_0x0fbf('0x9')]);router[_0x0fbf('0xa')](_0x0fbf('0xb'),auth[_0x0fbf('0x6')](),controller[_0x0fbf('0xc')]);router[_0x0fbf('0xa')](_0x0fbf('0xd'),auth[_0x0fbf('0x6')](),controller['getAgents']);router[_0x0fbf('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0x0fbf('0xe')]);router[_0x0fbf('0xf')]('/',auth[_0x0fbf('0x6')](),controller[_0x0fbf('0x10')]);router['post'](_0x0fbf('0xd'),auth[_0x0fbf('0x6')](),controller[_0x0fbf('0x11')]);router[_0x0fbf('0xf')](_0x0fbf('0x12'),auth[_0x0fbf('0x6')](),controller[_0x0fbf('0x13')]);router[_0x0fbf('0x14')](_0x0fbf('0xb'),auth[_0x0fbf('0x6')](),controller[_0x0fbf('0x15')]);router[_0x0fbf('0x16')](_0x0fbf('0xb'),auth[_0x0fbf('0x6')](),controller[_0x0fbf('0x17')]);router[_0x0fbf('0x16')](_0x0fbf('0xd'),auth[_0x0fbf('0x6')](),controller['removeAgents']);router['delete']('/:id/teams',auth[_0x0fbf('0x6')](),controller[_0x0fbf('0x18')]);module[_0x0fbf('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 73da6f3..e3edd4b 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 _0x0706=['sequelize','STRING','name','VIRTUAL','system-','getDataValue'];(function(_0x3a60b8,_0x47caab){var _0x4eb583=function(_0x2251b5){while(--_0x2251b5){_0x3a60b8['push'](_0x3a60b8['shift']());}};_0x4eb583(++_0x47caab);}(_0x0706,0x1d4));var _0x6070=function(_0x4491c1,_0x7dd572){_0x4491c1=_0x4491c1-0x0;var _0x5b309d=_0x0706[_0x4491c1];return _0x5b309d;};'use strict';var Sequelize=require(_0x6070('0x0'));module['exports']={'name':{'type':Sequelize[_0x6070('0x1')],'allowNull':![],'unique':_0x6070('0x2')},'prefix':{'type':Sequelize[_0x6070('0x3')],'get':function(_0x337b13){return _0x6070('0x4')+this[_0x6070('0x5')](_0x6070('0x2'))+'-';}},'description':{'type':Sequelize[_0x6070('0x1')]},'callerIdAll':{'type':Sequelize[_0x6070('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8168=['name','VIRTUAL','system-','getDataValue','STRING'];(function(_0x45ce08,_0x59dcc7){var _0x23dff2=function(_0x1ad0e5){while(--_0x1ad0e5){_0x45ce08['push'](_0x45ce08['shift']());}};_0x23dff2(++_0x59dcc7);}(_0x8168,0x117));var _0x8816=function(_0x1f3c56,_0x598757){_0x1f3c56=_0x1f3c56-0x0;var _0x569524=_0x8168[_0x1f3c56];return _0x569524;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8816('0x0')],'allowNull':![],'unique':_0x8816('0x1')},'prefix':{'type':Sequelize[_0x8816('0x2')],'get':function(_0x55907f){return _0x8816('0x3')+this[_0x8816('0x4')](_0x8816('0x1'))+'-';}},'description':{'type':Sequelize[_0x8816('0x0')]},'callerIdAll':{'type':Sequelize[_0x8816('0x0')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index c58ff44..f7a2c16 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 _0x1c9a=['sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','VoicePrefixes','UserProfileResource','error','stack','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','find','params','describe','sequelize','create','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','VoiceExtension','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','context','${EXTEN:','charAt','body','system-','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','User','filter','getAgents','getTeams','findOne','addTeams','Team','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','all','union','compact','isEmpty','eml-format','zip-dir','request-promise','moment','bluebird','util','path'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x1c9a,0x98));var _0xa1c9=function(_0x52a605,_0x5b56ef){_0x52a605=_0x52a605-0x0;var _0xa681a9=_0x1c9a[_0x52a605];return _0xa681a9;};'use strict';var emlformat=require(_0xa1c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1c9('0x2'));var moment=require(_0xa1c9('0x3'));var BPromise=require(_0xa1c9('0x4'));var Mustache=require('mustache');var util=require(_0xa1c9('0x5'));var path=require(_0xa1c9('0x6'));var sox=require(_0xa1c9('0x7'));var csv=require(_0xa1c9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1c9('0x9'));var _=require('lodash');var squel=require(_0xa1c9('0xa'));var crypto=require(_0xa1c9('0xb'));var jsforce=require(_0xa1c9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa1c9('0x8'));var querystring=require(_0xa1c9('0xd'));var Papa=require(_0xa1c9('0xe'));var Redis=require(_0xa1c9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa1c9('0x10'));var as=require(_0xa1c9('0x11'));var hardwareService=require(_0xa1c9('0x12'));var logger=require(_0xa1c9('0x13'))(_0xa1c9('0x14'));var utils=require(_0xa1c9('0x15'));var config=require(_0xa1c9('0x16'));var licenseUtil=require(_0xa1c9('0x17'));var db=require(_0xa1c9('0x18'))['db'];config[_0xa1c9('0x19')]=_['defaults'](config[_0xa1c9('0x19')],{'host':_0xa1c9('0x1a'),'port':0x18eb});var socket=require(_0xa1c9('0x1b'))(new Redis(config[_0xa1c9('0x19')]));require(_0xa1c9('0x1c'))['register'](socket);function respondWithStatusCode(_0x335dda,_0x4b2fa5){_0x4b2fa5=_0x4b2fa5||0xcc;return function(_0x2cba13){if(_0x2cba13){return _0x335dda[_0xa1c9('0x1d')](_0x4b2fa5);}return _0x335dda[_0xa1c9('0x1e')](_0x4b2fa5)[_0xa1c9('0x1f')]();};}function respondWithResult(_0x44ab5b,_0x3b51f5){_0x3b51f5=_0x3b51f5||0xc8;return function(_0x1f6d26){if(_0x1f6d26){return _0x44ab5b[_0xa1c9('0x1e')](_0x3b51f5)['json'](_0x1f6d26);}};}function respondWithFilteredResult(_0x11ca10,_0x1084d2){return function(_0x224ae4){if(_0x224ae4){var _0x50db9b=typeof _0x1084d2[_0xa1c9('0x20')]==='undefined'&&typeof _0x1084d2[_0xa1c9('0x21')]===_0xa1c9('0x22');var _0x204d54=_0x224ae4['count'];var _0x3a1110=_0x50db9b?0x0:_0x1084d2[_0xa1c9('0x20')];var _0x128732=_0x50db9b?_0x224ae4['count']:_0x1084d2[_0xa1c9('0x20')]+_0x1084d2[_0xa1c9('0x21')];var _0x4c6dbb;if(_0x128732>=_0x204d54){_0x128732=_0x204d54;_0x4c6dbb=0xc8;}else{_0x4c6dbb=0xce;}_0x11ca10[_0xa1c9('0x1e')](_0x4c6dbb);return _0x11ca10[_0xa1c9('0x23')](_0xa1c9('0x24'),_0x3a1110+'-'+_0x128732+'/'+_0x204d54)['json'](_0x224ae4);}return null;};}function patchUpdates(_0x29f1b1){return function(_0x3dcec5){try{jsonpatch[_0xa1c9('0x25')](_0x3dcec5,_0x29f1b1,!![]);}catch(_0x23a461){return BPromise[_0xa1c9('0x26')](_0x23a461);}return _0x3dcec5['save']();};}function saveUpdates(_0x50b16b,_0x200749){return function(_0x50b16d){if(_0x50b16d){return _0x50b16d[_0xa1c9('0x27')](_0x50b16b)[_0xa1c9('0x28')](function(_0x1c6f37){return _0x1c6f37;});}return null;};}function removeEntity(_0x3059eb,_0x339ed1){return function(_0x522dc0){if(_0x522dc0){return _0x522dc0[_0xa1c9('0x29')]()[_0xa1c9('0x28')](function(){var _0x20cbe1=_0x522dc0['get']({'plain':!![]});var _0x133f80=_0xa1c9('0x2a');return db[_0xa1c9('0x2b')]['destroy']({'where':{'type':_0x133f80,'resourceId':_0x20cbe1['id']}})[_0xa1c9('0x28')](function(){return _0x522dc0;});})[_0xa1c9('0x28')](function(){_0x3059eb['status'](0xcc)[_0xa1c9('0x1f')]();});}};}function handleEntityNotFound(_0x48ce34,_0xdf6d0c){return function(_0x2404c3){if(!_0x2404c3){_0x48ce34[_0xa1c9('0x1d')](0x194);}return _0x2404c3;};}function handleError(_0x254b13,_0x40b9d5){_0x40b9d5=_0x40b9d5||0x1f4;return function(_0xe8523b){logger[_0xa1c9('0x2c')](_0xe8523b[_0xa1c9('0x2d')]);if(_0xe8523b['name']){delete _0xe8523b['name'];}_0x254b13[_0xa1c9('0x1e')](_0x40b9d5)[_0xa1c9('0x2e')](_0xe8523b);};}exports[_0xa1c9('0x2f')]=function(_0xf419d0,_0x3161b0){var _0x5b67c3={},_0x53f325={},_0x5aecd7={'count':0x0,'rows':[]};var _0x259ac3=_[_0xa1c9('0x30')](db[_0xa1c9('0x31')][_0xa1c9('0x32')],function(_0x39cf81){return{'name':_0x39cf81[_0xa1c9('0x33')],'type':_0x39cf81[_0xa1c9('0x34')]['key']};});_0x53f325[_0xa1c9('0x35')]=_['map'](_0x259ac3,_0xa1c9('0x36'));_0x53f325['query']=_[_0xa1c9('0x37')](_0xf419d0[_0xa1c9('0x38')]);_0x53f325[_0xa1c9('0x39')]=_['intersection'](_0x53f325[_0xa1c9('0x35')],_0x53f325[_0xa1c9('0x38')]);_0x5b67c3[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x53f325['model'],qs['fields'](_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x5b67c3[_0xa1c9('0x3a')]=_0x5b67c3[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x5b67c3[_0xa1c9('0x3a')]:_0x53f325[_0xa1c9('0x35')];if(!_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x5b67c3['limit']=qs[_0xa1c9('0x21')](_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x5b67c3[_0xa1c9('0x20')]=qs[_0xa1c9('0x20')](_0xf419d0[_0xa1c9('0x38')]['offset']);}_0x5b67c3[_0xa1c9('0x40')]=qs[_0xa1c9('0x41')](_0xf419d0[_0xa1c9('0x38')]['sort']);_0x5b67c3[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0xf419d0[_0xa1c9('0x38')],_0x53f325[_0xa1c9('0x39')]),_0x259ac3);if(_0xf419d0['query']['filter']){_0x5b67c3[_0xa1c9('0x42')]=_[_0xa1c9('0x43')](_0x5b67c3[_0xa1c9('0x42')],{'$or':_[_0xa1c9('0x30')](_0x259ac3,function(_0xd9e67){if(_0xd9e67[_0xa1c9('0x34')]!==_0xa1c9('0x44')){var _0x146e47={};_0x146e47[_0xd9e67[_0xa1c9('0x36')]]={'$like':'%'+_0xf419d0[_0xa1c9('0x38')]['filter']+'%'};return _0x146e47;}})});}_0x5b67c3=_['merge']({},_0x5b67c3,_0xf419d0[_0xa1c9('0x45')]);var _0x46920c={'where':_0x5b67c3['where']};return db[_0xa1c9('0x31')][_0xa1c9('0x46')](_0x46920c)[_0xa1c9('0x28')](function(_0x36c846){_0x5aecd7[_0xa1c9('0x46')]=_0x36c846;if(_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x47')]){_0x5b67c3[_0xa1c9('0x48')]=[{'all':!![]}];}return db[_0xa1c9('0x31')][_0xa1c9('0x49')](_0x5b67c3);})[_0xa1c9('0x28')](function(_0x50cc27){_0x5aecd7[_0xa1c9('0x4a')]=_0x50cc27;return _0x5aecd7;})['then'](respondWithFilteredResult(_0x3161b0,_0x5b67c3))[_0xa1c9('0x4b')](handleError(_0x3161b0,null));};exports['show']=function(_0x42be67,_0x4a9e02){var _0x43598b={'raw':![],'where':{'id':_0x42be67['params']['id']}},_0x18bb43={};_0x18bb43[_0xa1c9('0x35')]=_[_0xa1c9('0x37')](db['VoicePrefix'][_0xa1c9('0x32')]);_0x18bb43[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x42be67[_0xa1c9('0x38')]);_0x18bb43[_0xa1c9('0x39')]=_[_0xa1c9('0x3b')](_0x18bb43['model'],_0x18bb43[_0xa1c9('0x38')]);_0x43598b[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x18bb43[_0xa1c9('0x35')],qs[_0xa1c9('0x3c')](_0x42be67['query']['fields']));_0x43598b['attributes']=_0x43598b[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x43598b[_0xa1c9('0x3a')]:_0x18bb43['model'];if(_0x42be67[_0xa1c9('0x38')][_0xa1c9('0x47')]){_0x43598b['include']=[{'all':!![]}];}_0x43598b=_[_0xa1c9('0x43')]({},_0x43598b,_0x42be67['options']);return db['VoicePrefix'][_0xa1c9('0x4c')](_0x43598b)[_0xa1c9('0x28')](handleEntityNotFound(_0x4a9e02,null))[_0xa1c9('0x28')](respondWithResult(_0x4a9e02,null))[_0xa1c9('0x4b')](handleError(_0x4a9e02,null));};exports[_0xa1c9('0x29')]=function(_0x31fbb8,_0x18aa46){return db[_0xa1c9('0x31')][_0xa1c9('0x4c')]({'where':{'id':_0x31fbb8[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x18aa46,null))[_0xa1c9('0x28')](removeEntity(_0x18aa46,null))[_0xa1c9('0x4b')](handleError(_0x18aa46,null));};exports[_0xa1c9('0x4e')]=function(_0x149450,_0x112f82){return db[_0xa1c9('0x31')][_0xa1c9('0x4e')]()[_0xa1c9('0x28')](respondWithResult(_0x112f82,null))['catch'](handleError(_0x112f82,null));};exports['create']=function(_0x12118e,_0x6160fc){var _0x66a5eb;return db[_0xa1c9('0x4f')]['transaction'](function(_0x449e85){return db[_0xa1c9('0x31')][_0xa1c9('0x50')](_0x12118e['body'],{'transaction':_0x449e85})[_0xa1c9('0x28')](function(_0x3f650a){_0x66a5eb=_0x3f650a['get']({'plain':!![]});return db['VoiceExtension'][_0xa1c9('0x4c')]({'where':{'id':_0x66a5eb['VoiceExtensionId']},'raw':!![]})[_0xa1c9('0x28')](function(_0x1bd5c7){return createVoicePrefixExtensions(_0x66a5eb,_0x1bd5c7,_0x449e85);});});})[_0xa1c9('0x28')](function(){var _0x4c1165=_0x12118e['user'][_0xa1c9('0x51')]({'plain':!![]});if(!_0x4c1165)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c1165[_0xa1c9('0x52')]==='user'){var _0x3334ad=_0x66a5eb;return db[_0xa1c9('0x53')][_0xa1c9('0x4c')]({'where':{'name':_0xa1c9('0x2a'),'userProfileId':_0x4c1165[_0xa1c9('0x54')]},'raw':!![]})[_0xa1c9('0x28')](function(_0x3917ed){if(_0x3917ed&&_0x3917ed['autoAssociation']===0x0){return db[_0xa1c9('0x2b')][_0xa1c9('0x50')]({'name':_0x3334ad['name'],'resourceId':_0x3334ad['id'],'type':_0x3917ed['name'],'sectionId':_0x3917ed['id']},{})['then'](function(){return _0x66a5eb;});}else{return _0x66a5eb;}})[_0xa1c9('0x4b')](function(_0x55fe87){logger[_0xa1c9('0x2c')](_0xa1c9('0x55'),_0x55fe87);throw _0x55fe87;});}return _0x66a5eb;})[_0xa1c9('0x28')](respondWithResult(_0x6160fc,null))[_0xa1c9('0x4b')](handleError(_0x6160fc,null));};function Extension(_0x2f0c80,_0x5b81f4,_0x4bf711,_0x48950c){this['context']=_0xa1c9('0x56');this[_0xa1c9('0x57')]=_0x2f0c80;this[_0xa1c9('0x58')]=_0x4bf711;this[_0xa1c9('0x34')]=_0xa1c9('0x59');this[_0xa1c9('0x5a')]=_0xa1c9('0x5b');this[_0xa1c9('0x5c')]=_0x5b81f4;this[_0xa1c9('0x5d')]=_0x48950c;}function createVoicePrefixExtensions(_0x317799,_0x4639cf,_0xef5d24){return new BPromise(function(_0x288267,_0x29d833){var _0x51f675=new Extension(formatPrefixName(_0x317799[_0xa1c9('0x5e')]),0x1,_0xa1c9('0x5f'),_0xa1c9('0x60'));_0x51f675[_0xa1c9('0x61')]=_0x317799['id'];return db['VoiceExtension'][_0xa1c9('0x50')](_0x51f675,{'transaction':_0xef5d24})[_0xa1c9('0x28')](function(_0x1b2cff){var _0x39ffed=_0x1b2cff['get']({'plain':!![]});var _0x4b9aa8=_[_0xa1c9('0x30')](addVoicePrefixExtensions(_0x317799,_0x4639cf),function(_0x2a89d2){_0x2a89d2[_0xa1c9('0x62')]=_0x39ffed['id'];_0x2a89d2[_0xa1c9('0x61')]=_0x317799['id'];return _0x2a89d2;});return db[_0xa1c9('0x63')]['bulkCreate'](_0x4b9aa8,{'transaction':_0xef5d24})[_0xa1c9('0x28')](function(_0x21abdf){if(!_0x21abdf){return _0x29d833(_0xa1c9('0x64'));}else{return _0x288267(_0x21abdf);}})[_0xa1c9('0x4b')](function(_0x5ba7aa){return _0x29d833(_0x5ba7aa);});});;});};function addVoicePrefixExtensions(_0x37613f,_0x17d848){var _0xa18fa4=[];var _0x5a5c65=formatPrefixName(_0x37613f[_0xa1c9('0x5e')]);_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x2,'Set',_0xa1c9('0x66')+_0x37613f[_0xa1c9('0x36')]));if(_0x37613f[_0xa1c9('0x67')]){_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x3,_0xa1c9('0x68'),_0xa1c9('0x69')+_0x37613f[_0xa1c9('0x67')]));}else{_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x3,_0xa1c9('0x5f'),_0xa1c9('0x6a')));}_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x4,'goto',_0x17d848[_0xa1c9('0x6b')]+','+_0xa1c9('0x6c')+(0x8+_0x37613f[_0xa1c9('0x36')][_0xa1c9('0x3d')])+'}'+','+0x1));return _0xa18fa4;}function formatPrefixName(_0x5961aa){var _0x358481='_';for(var _0xdbc56a=0x0;_0xdbc56a<_0x5961aa[_0xa1c9('0x3d')];_0xdbc56a++){if(_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a)=='-'){_0x358481+=_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a);}else{_0x358481+='['+_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a)+']';}}_0x358481+='.';return _0x358481;}exports[_0xa1c9('0x27')]=function(_0x27048c,_0xb24e0b,_0x178e47){var _0x1fec82=_0x27048c[_0xa1c9('0x6e')];_0x1fec82[_0xa1c9('0x5e')]=_0xa1c9('0x6f')+_0x1fec82['name']+'-';return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x1f219d){return db[_0xa1c9('0x31')][_0xa1c9('0x27')](_0x1fec82,{'where':{'id':_0x1fec82['id']},'transaction':_0x1f219d})[_0xa1c9('0x28')](function(){return db[_0xa1c9('0x63')]['destroy']({'where':{'VoicePrefixId':_0x1fec82['id']},'transaction':_0x1f219d})[_0xa1c9('0x28')](function(){return db[_0xa1c9('0x63')]['find']({'where':{'id':_0x1fec82[_0xa1c9('0x62')]},'raw':!![]})[_0xa1c9('0x28')](function(_0x150d76){return createVoicePrefixExtensions(_0x1fec82,_0x150d76,_0x1f219d);});});});})[_0xa1c9('0x28')](function(){return db['VoicePrefix'][_0xa1c9('0x71')](_0x1fec82['id']);})['then'](respondWithResult(_0xb24e0b,null))['catch'](handleError(_0xb24e0b,null));};exports[_0xa1c9('0x72')]=function(_0x134d3f,_0x40f420,_0x423c58){return db['VoicePrefix'][_0xa1c9('0x4c')]({'where':{'id':_0x134d3f[_0xa1c9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x40f420,null))[_0xa1c9('0x28')](function(_0x464da9){if(_0x464da9){return _0x464da9[_0xa1c9('0x72')](_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')],_[_0xa1c9('0x74')](_0x134d3f['body'],['ids','id'])||{})[_0xa1c9('0x75')](function(_0x52e78b){for(var _0x3de2c7=0x0;_0x3de2c7<_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')][_0xa1c9('0x3d')];_0x3de2c7+=0x1){socket[_0xa1c9('0x76')](_0xa1c9('0x77'),{'UserId':Number(_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')][_0x3de2c7]),'VoicePrefixId':Number(_0x134d3f[_0xa1c9('0x4d')]['id'])});}return _0x52e78b;});}})['then'](respondWithResult(_0x40f420,null))[_0xa1c9('0x4b')](handleError(_0x40f420,null));};exports['removeAgents']=function(_0x4a8841,_0x8bc83d,_0x518811){return db[_0xa1c9('0x31')][_0xa1c9('0x4c')]({'where':{'id':_0x4a8841[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x8bc83d,null))[_0xa1c9('0x28')](function(_0x2a17b7){if(_0x2a17b7){return _0x2a17b7[_0xa1c9('0x78')](_0x4a8841['query'][_0xa1c9('0x73')])[_0xa1c9('0x28')](function(){if(_[_0xa1c9('0x79')](_0x4a8841['query']['ids'])){for(var _0x3f4f76=0x0;_0x3f4f76<_0x4a8841['query'][_0xa1c9('0x73')][_0xa1c9('0x3d')];_0x3f4f76+=0x1){socket[_0xa1c9('0x76')](_0xa1c9('0x7a'),{'UserId':Number(_0x4a8841['query'][_0xa1c9('0x73')][_0x3f4f76]),'VoicePrefixId':Number(_0x4a8841[_0xa1c9('0x4d')]['id'])});}}else{socket[_0xa1c9('0x76')](_0xa1c9('0x7a'),{'UserId':Number(_0x4a8841[_0xa1c9('0x38')]['ids']),'VoicePrefixId':Number(_0x4a8841[_0xa1c9('0x4d')]['id'])});}});}})[_0xa1c9('0x28')](respondWithStatusCode(_0x8bc83d,null))[_0xa1c9('0x4b')](handleError(_0x8bc83d,null));};exports['getAgents']=function(_0x3936cb,_0x175662,_0x134935){var _0x197721={};var _0x7281bd={};var _0x35a356;var _0x53ea3b;return db[_0xa1c9('0x31')]['findOne']({'where':{'id':_0x3936cb[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x175662,null))['then'](function(_0x28d323){if(_0x28d323){_0x35a356=_0x28d323;_0x7281bd['model']=_[_0xa1c9('0x37')](db[_0xa1c9('0x7b')][_0xa1c9('0x32')]);_0x7281bd[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x3936cb[_0xa1c9('0x38')]);_0x7281bd[_0xa1c9('0x39')]=_[_0xa1c9('0x3b')](_0x7281bd[_0xa1c9('0x35')],_0x7281bd[_0xa1c9('0x38')]);_0x197721[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x7281bd[_0xa1c9('0x35')],qs[_0xa1c9('0x3c')](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x197721['attributes']=_0x197721['attributes'][_0xa1c9('0x3d')]?_0x197721[_0xa1c9('0x3a')]:_0x7281bd[_0xa1c9('0x35')];_0x197721['order']=qs[_0xa1c9('0x41')](_0x3936cb['query']['sort']);_0x197721[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0x3936cb[_0xa1c9('0x38')],_0x7281bd['filters']));if(_0x3936cb['query'][_0xa1c9('0x7c')]){_0x197721['where']=_[_0xa1c9('0x43')](_0x197721[_0xa1c9('0x42')],{'$or':_['map'](_0x197721[_0xa1c9('0x3a')],function(_0x1277eb){var _0x88cb2c={};_0x88cb2c[_0x1277eb]={'$like':'%'+_0x3936cb[_0xa1c9('0x38')]['filter']+'%'};return _0x88cb2c;})});}_0x197721=_[_0xa1c9('0x43')]({},_0x197721,_0x3936cb[_0xa1c9('0x45')]);return _0x35a356[_0xa1c9('0x7d')](_0x197721);}})[_0xa1c9('0x28')](function(_0x465162){if(_0x465162){_0x53ea3b=_0x465162[_0xa1c9('0x3d')];if(!_0x3936cb['query'][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x197721['limit']=qs['limit'](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x197721[_0xa1c9('0x20')]=qs[_0xa1c9('0x20')](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x20')]);}return _0x35a356['getAgents'](_0x197721);}})[_0xa1c9('0x28')](function(_0x4deadc){if(_0x4deadc){return _0x4deadc?{'count':_0x53ea3b,'rows':_0x4deadc}:null;}})[_0xa1c9('0x28')](respondWithResult(_0x175662,null))[_0xa1c9('0x4b')](handleError(_0x175662,null));};exports[_0xa1c9('0x7e')]=function(_0x59bc9f,_0x1c8a80,_0x2780b7){var _0x26f241={};var _0x537f48={};var _0x4e1e2f;var _0x46d8d1;return db['VoicePrefix'][_0xa1c9('0x7f')]({'where':{'id':_0x59bc9f['params']['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x1c8a80,null))[_0xa1c9('0x28')](function(_0x2d2374){if(_0x2d2374){_0x4e1e2f=_0x2d2374;_0x537f48['model']=_['keys'](db['Team'][_0xa1c9('0x32')]);_0x537f48[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x59bc9f[_0xa1c9('0x38')]);_0x537f48['filters']=_['intersection'](_0x537f48[_0xa1c9('0x35')],_0x537f48['query']);_0x26f241[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x537f48[_0xa1c9('0x35')],qs['fields'](_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x26f241[_0xa1c9('0x3a')]=_0x26f241[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x26f241[_0xa1c9('0x3a')]:_0x537f48[_0xa1c9('0x35')];_0x26f241[_0xa1c9('0x40')]=qs[_0xa1c9('0x41')](_0x59bc9f[_0xa1c9('0x38')]['sort']);_0x26f241[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0x59bc9f[_0xa1c9('0x38')],_0x537f48[_0xa1c9('0x39')]));if(_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x7c')]){_0x26f241[_0xa1c9('0x42')]=_['merge'](_0x26f241[_0xa1c9('0x42')],{'$or':_['map'](_0x26f241[_0xa1c9('0x3a')],function(_0x2c04c5){var _0x137a58={};_0x137a58[_0x2c04c5]={'$like':'%'+_0x59bc9f['query'][_0xa1c9('0x7c')]+'%'};return _0x137a58;})});}_0x26f241=_[_0xa1c9('0x43')]({},_0x26f241,_0x59bc9f[_0xa1c9('0x45')]);return _0x4e1e2f[_0xa1c9('0x7e')](_0x26f241);}})[_0xa1c9('0x28')](function(_0x328fa7){if(_0x328fa7){_0x46d8d1=_0x328fa7[_0xa1c9('0x3d')];if(!_0x59bc9f['query'][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x26f241[_0xa1c9('0x21')]=qs['limit'](_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x26f241['offset']=qs[_0xa1c9('0x20')](_0x59bc9f['query'][_0xa1c9('0x20')]);}return _0x4e1e2f[_0xa1c9('0x7e')](_0x26f241);}})[_0xa1c9('0x28')](function(_0x3e5016){if(_0x3e5016){return _0x3e5016?{'count':_0x46d8d1,'rows':_0x3e5016}:null;}})[_0xa1c9('0x28')](respondWithResult(_0x1c8a80,null))['catch'](handleError(_0x1c8a80,null));};exports[_0xa1c9('0x80')]=function(_0xabacf1,_0x38a7fc,_0x2a3082){var _0x276c98=_0xabacf1[_0xa1c9('0x6e')][_0xa1c9('0x73')];var _0x48520d;return db[_0xa1c9('0x81')][_0xa1c9('0x49')]({'where':{'id':_0x276c98},'attributes':['id'],'include':[{'model':db[_0xa1c9('0x7b')],'as':_0xa1c9('0x82'),'attributes':['id','name',_0xa1c9('0x83'),_0xa1c9('0x84'),'interface'],'raw':!![]}]})[_0xa1c9('0x28')](function(_0x2a82fd){if(_0x2a82fd){_0x48520d=_0x2a82fd;var _0x419cf2=_[_0xa1c9('0x85')](_0x2a82fd,function(_0x51884d){var _0x52360b=_0x51884d[_0xa1c9('0x51')]({'plain':!![]});return _0x52360b['Agents'];});return db[_0xa1c9('0x31')]['find']({'where':{'id':_0xabacf1['params']['id']}})[_0xa1c9('0x28')](function(_0x507b2a){return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x296607){return _0x507b2a[_0xa1c9('0x80')](_0x276c98,{'transaction':_0x296607})[_0xa1c9('0x28')](function(){return BPromise[_0xa1c9('0x86')](_0x48520d,function(_0x531c20){return db[_0xa1c9('0x87')]['upsert']({'TeamId':_0x531c20['id'],'VoicePrefixId':_0xabacf1[_0xa1c9('0x4d')]['id']},{'transaction':_0x296607});});})[_0xa1c9('0x28')](function(){return BPromise['each'](_0x419cf2,function(_0x110617){return db[_0xa1c9('0x88')][_0xa1c9('0x89')]({'where':{'UserId':_0x110617['id'],'VoicePrefixId':_0xabacf1[_0xa1c9('0x4d')]['id']},'transaction':_0x296607});});})[_0xa1c9('0x28')](function(){_0x419cf2[_0xa1c9('0x8a')](function(_0x5640bb){socket[_0xa1c9('0x76')](_0xa1c9('0x77'),{'UserId':_0x5640bb['id'],'VoicePrefixId':_0x507b2a['id']});});});});});}})[_0xa1c9('0x28')](respondWithStatusCode(_0x38a7fc,null))['catch'](handleError(_0x38a7fc,null));};exports[_0xa1c9('0x8b')]=function(_0x4c8c5e,_0x3cb7d4,_0x5c504c){return db['Team'][_0xa1c9('0x49')]({'where':{'id':_0x4c8c5e['query'][_0xa1c9('0x73')]},'attributes':['id'],'include':[{'model':db[_0xa1c9('0x7b')],'as':_0xa1c9('0x82'),'attributes':['id'],'raw':!![]}]})[_0xa1c9('0x28')](handleEntityNotFound(_0x3cb7d4,null))['then'](function(_0x4423e8){var _0x2c75e6=_['map'](_0x4423e8,'id');var _0x163589=[];var _0x5f3e31=[];var _0x6e0efe=squel[_0xa1c9('0x8c')]();_0x6e0efe[_0xa1c9('0x8d')](_0xa1c9('0x8e'))[_0xa1c9('0x8f')](_0xa1c9('0x90'),'tq')[_0xa1c9('0x91')](_0xa1c9('0x92'),'ut',_0xa1c9('0x93'))[_0xa1c9('0x42')](_0xa1c9('0x94'),_0x4c8c5e[_0xa1c9('0x4d')]['id']);for(var _0x2953bd=0x0;_0x2953bd<_0x4423e8['length'];_0x2953bd+=0x1){let _0x28050b=_0x4423e8[_0x2953bd];for(var _0x3f998a=0x0;_0x3f998a<_0x28050b['Agents'][_0xa1c9('0x3d')];_0x3f998a+=0x1){let _0x12cdd5=_0x28050b[_0xa1c9('0x82')][_0x3f998a];var _0x1c5baa=_0x6e0efe[_0xa1c9('0x95')]();_0x1c5baa[_0xa1c9('0x42')](_0xa1c9('0x96'),_0x12cdd5['id']);_0x5f3e31[_0xa1c9('0x65')](db['sequelize']['query'](_0x1c5baa[_0xa1c9('0x97')](),{'type':db[_0xa1c9('0x4f')]['QueryTypes']['SELECT']})['then'](function(_0x5c9f06){if(_0x5c9f06['length']===0x1){return _0x12cdd5['id'];}else{var _0x4d6b40=_[_0xa1c9('0x98')](_[_0xa1c9('0x30')](_0x5c9f06,_0xa1c9('0x99')),function(_0x20c454){return _[_0xa1c9('0x9a')](_0x2c75e6,_0x20c454);});if(_0x4d6b40){return _0x12cdd5['id'];}}}));}}return BPromise[_0xa1c9('0x9b')](_0x5f3e31)['then'](function(_0x22fde9){_0x163589=_(_0x163589)[_0xa1c9('0x9c')](_0x22fde9)[_0xa1c9('0x9d')]()['value']();return db[_0xa1c9('0x31')]['find']({'where':{'id':_0x4c8c5e['params']['id']}})[_0xa1c9('0x28')](function(_0x3e67f4){return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x52905a){return _0x3e67f4[_0xa1c9('0x8b')](_0x4c8c5e[_0xa1c9('0x38')][_0xa1c9('0x73')],{'transaction':_0x52905a})[_0xa1c9('0x28')](function(){if(!_[_0xa1c9('0x9e')](_0x163589)){return _0x3e67f4['removeAgents'](_0x163589,{'transaction':_0x52905a});}})[_0xa1c9('0x28')](function(){_0x163589['forEach'](function(_0x424be7){socket[_0xa1c9('0x76')]('userVoicePrefix:remove',{'UserId':_0x424be7,'VoicePrefixId':_0x3e67f4['id']});});});});});});})[_0xa1c9('0x28')](respondWithStatusCode(_0x3cb7d4,null))[_0xa1c9('0x4b')](handleError(_0x3cb7d4,null));}; \ No newline at end of file +var _0x4cf8=['forEach','removeTeams','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','map','VoicePrefix','fieldName','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','options','includeAll','show','rawAttributes','find','params','describe','create','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','prefix','system-','sequelize','findById','addAgents','body','ids','spread','emit','isArray','userVoicePrefix:remove','getAgents','findOne','User','pick','getTeams','Team','findAll','Agents','voicePause','interface','flatMap','transaction','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate'];(function(_0x48f791,_0x57dbd7){var _0x5ec5ea=function(_0x1b8718){while(--_0x1b8718){_0x48f791['push'](_0x48f791['shift']());}};_0x5ec5ea(++_0x57dbd7);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x1de43c,_0xaa29de){_0x1de43c=_0x1de43c-0x0;var _0x296d3e=_0x4cf8[_0x1de43c];return _0x296d3e;};'use strict';var emlformat=require(_0x84cf('0x0'));var rimraf=require(_0x84cf('0x1'));var zipdir=require(_0x84cf('0x2'));var jsonpatch=require(_0x84cf('0x3'));var rp=require(_0x84cf('0x4'));var moment=require(_0x84cf('0x5'));var BPromise=require(_0x84cf('0x6'));var Mustache=require(_0x84cf('0x7'));var util=require(_0x84cf('0x8'));var path=require(_0x84cf('0x9'));var sox=require(_0x84cf('0xa'));var csv=require(_0x84cf('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84cf('0xc'));var squel=require('squel');var crypto=require(_0x84cf('0xd'));var jsforce=require(_0x84cf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x84cf('0xb'));var querystring=require(_0x84cf('0xf'));var Papa=require('papaparse');var Redis=require(_0x84cf('0x10'));var authService=require(_0x84cf('0x11'));var qs=require(_0x84cf('0x12'));var as=require(_0x84cf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84cf('0x14'))(_0x84cf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x84cf('0x16'));var db=require(_0x84cf('0x17'))['db'];config[_0x84cf('0x18')]=_[_0x84cf('0x19')](config[_0x84cf('0x18')],{'host':_0x84cf('0x1a'),'port':0x18eb});var socket=require(_0x84cf('0x1b'))(new Redis(config[_0x84cf('0x18')]));require(_0x84cf('0x1c'))[_0x84cf('0x1d')](socket);function respondWithStatusCode(_0x2fc41f,_0x385027){_0x385027=_0x385027||0xcc;return function(_0x7db8f){if(_0x7db8f){return _0x2fc41f[_0x84cf('0x1e')](_0x385027);}return _0x2fc41f[_0x84cf('0x1f')](_0x385027)[_0x84cf('0x20')]();};}function respondWithResult(_0x464e70,_0x240edf){_0x240edf=_0x240edf||0xc8;return function(_0xe12c7b){if(_0xe12c7b){return _0x464e70['status'](_0x240edf)[_0x84cf('0x21')](_0xe12c7b);}};}function respondWithFilteredResult(_0x5d6a93,_0xfa6641){return function(_0x1abe2d){if(_0x1abe2d){var _0x1dad1a=typeof _0xfa6641[_0x84cf('0x22')]===_0x84cf('0x23')&&typeof _0xfa6641['limit']==='undefined';var _0x42d6d4=_0x1abe2d[_0x84cf('0x24')];var _0x346b43=_0x1dad1a?0x0:_0xfa6641[_0x84cf('0x22')];var _0x219afa=_0x1dad1a?_0x1abe2d['count']:_0xfa6641[_0x84cf('0x22')]+_0xfa6641[_0x84cf('0x25')];var _0x3ca1be;if(_0x219afa>=_0x42d6d4){_0x219afa=_0x42d6d4;_0x3ca1be=0xc8;}else{_0x3ca1be=0xce;}_0x5d6a93[_0x84cf('0x1f')](_0x3ca1be);return _0x5d6a93[_0x84cf('0x26')]('Content-Range',_0x346b43+'-'+_0x219afa+'/'+_0x42d6d4)[_0x84cf('0x21')](_0x1abe2d);}return null;};}function patchUpdates(_0x160f86){return function(_0x475b19){try{jsonpatch[_0x84cf('0x27')](_0x475b19,_0x160f86,!![]);}catch(_0x3e5e94){return BPromise[_0x84cf('0x28')](_0x3e5e94);}return _0x475b19[_0x84cf('0x29')]();};}function saveUpdates(_0x4c9d1c,_0x2b2c90){return function(_0x26db3f){if(_0x26db3f){return _0x26db3f[_0x84cf('0x2a')](_0x4c9d1c)[_0x84cf('0x2b')](function(_0x1d220a){return _0x1d220a;});}return null;};}function removeEntity(_0x44d4bf,_0x3c7eda){return function(_0xa44c81){if(_0xa44c81){return _0xa44c81[_0x84cf('0x2c')]()[_0x84cf('0x2b')](function(){var _0x5179c1=_0xa44c81[_0x84cf('0x2d')]({'plain':!![]});var _0x17bc92=_0x84cf('0x2e');return db[_0x84cf('0x2f')]['destroy']({'where':{'type':_0x17bc92,'resourceId':_0x5179c1['id']}})[_0x84cf('0x2b')](function(){return _0xa44c81;});})['then'](function(){_0x44d4bf[_0x84cf('0x1f')](0xcc)[_0x84cf('0x20')]();});}};}function handleEntityNotFound(_0x43b41b,_0xc15298){return function(_0x51adcf){if(!_0x51adcf){_0x43b41b[_0x84cf('0x1e')](0x194);}return _0x51adcf;};}function handleError(_0x2e4653,_0x309398){_0x309398=_0x309398||0x1f4;return function(_0x1bfa56){logger[_0x84cf('0x30')](_0x1bfa56[_0x84cf('0x31')]);if(_0x1bfa56[_0x84cf('0x32')]){delete _0x1bfa56[_0x84cf('0x32')];}_0x2e4653[_0x84cf('0x1f')](_0x309398)['send'](_0x1bfa56);};}exports['index']=function(_0x2795ef,_0x25de3a){var _0x16ebaa={},_0x1e889e={},_0x38eeea={'count':0x0,'rows':[]};var _0x1453cf=_[_0x84cf('0x33')](db[_0x84cf('0x34')]['rawAttributes'],function(_0x113b3e){return{'name':_0x113b3e[_0x84cf('0x35')],'type':_0x113b3e['type'][_0x84cf('0x36')]};});_0x1e889e['model']=_[_0x84cf('0x33')](_0x1453cf,_0x84cf('0x32'));_0x1e889e[_0x84cf('0x37')]=_[_0x84cf('0x38')](_0x2795ef[_0x84cf('0x37')]);_0x1e889e['filters']=_[_0x84cf('0x39')](_0x1e889e['model'],_0x1e889e['query']);_0x16ebaa[_0x84cf('0x3a')]=_[_0x84cf('0x39')](_0x1e889e['model'],qs[_0x84cf('0x3b')](_0x2795ef[_0x84cf('0x37')][_0x84cf('0x3b')]));_0x16ebaa[_0x84cf('0x3a')]=_0x16ebaa[_0x84cf('0x3a')][_0x84cf('0x3c')]?_0x16ebaa['attributes']:_0x1e889e[_0x84cf('0x3d')];if(!_0x2795ef[_0x84cf('0x37')][_0x84cf('0x3e')](_0x84cf('0x3f'))){_0x16ebaa[_0x84cf('0x25')]=qs[_0x84cf('0x25')](_0x2795ef['query'][_0x84cf('0x25')]);_0x16ebaa['offset']=qs[_0x84cf('0x22')](_0x2795ef[_0x84cf('0x37')][_0x84cf('0x22')]);}_0x16ebaa[_0x84cf('0x40')]=qs[_0x84cf('0x41')](_0x2795ef[_0x84cf('0x37')][_0x84cf('0x41')]);_0x16ebaa[_0x84cf('0x42')]=qs[_0x84cf('0x43')](_['pick'](_0x2795ef[_0x84cf('0x37')],_0x1e889e['filters']),_0x1453cf);if(_0x2795ef[_0x84cf('0x37')][_0x84cf('0x44')]){_0x16ebaa['where']=_[_0x84cf('0x45')](_0x16ebaa['where'],{'$or':_[_0x84cf('0x33')](_0x1453cf,function(_0x504d32){if(_0x504d32[_0x84cf('0x46')]!=='VIRTUAL'){var _0x2db7dd={};_0x2db7dd[_0x504d32[_0x84cf('0x32')]]={'$like':'%'+_0x2795ef['query'][_0x84cf('0x44')]+'%'};return _0x2db7dd;}})});}_0x16ebaa=_[_0x84cf('0x45')]({},_0x16ebaa,_0x2795ef[_0x84cf('0x47')]);var _0x5ef5fb={'where':_0x16ebaa[_0x84cf('0x42')]};return db['VoicePrefix'][_0x84cf('0x24')](_0x5ef5fb)['then'](function(_0x56b0e5){_0x38eeea['count']=_0x56b0e5;if(_0x2795ef[_0x84cf('0x37')][_0x84cf('0x48')]){_0x16ebaa['include']=[{'all':!![]}];}return db[_0x84cf('0x34')]['findAll'](_0x16ebaa);})[_0x84cf('0x2b')](function(_0x3fe8c1){_0x38eeea['rows']=_0x3fe8c1;return _0x38eeea;})[_0x84cf('0x2b')](respondWithFilteredResult(_0x25de3a,_0x16ebaa))['catch'](handleError(_0x25de3a,null));};exports[_0x84cf('0x49')]=function(_0x593b35,_0x4feb7e){var _0x5d8b69={'raw':![],'where':{'id':_0x593b35['params']['id']}},_0x5498ec={};_0x5498ec['model']=_['keys'](db[_0x84cf('0x34')][_0x84cf('0x4a')]);_0x5498ec[_0x84cf('0x37')]=_[_0x84cf('0x38')](_0x593b35['query']);_0x5498ec[_0x84cf('0x43')]=_['intersection'](_0x5498ec[_0x84cf('0x3d')],_0x5498ec[_0x84cf('0x37')]);_0x5d8b69[_0x84cf('0x3a')]=_[_0x84cf('0x39')](_0x5498ec[_0x84cf('0x3d')],qs[_0x84cf('0x3b')](_0x593b35['query'][_0x84cf('0x3b')]));_0x5d8b69[_0x84cf('0x3a')]=_0x5d8b69['attributes'][_0x84cf('0x3c')]?_0x5d8b69[_0x84cf('0x3a')]:_0x5498ec[_0x84cf('0x3d')];if(_0x593b35['query']['includeAll']){_0x5d8b69['include']=[{'all':!![]}];}_0x5d8b69=_[_0x84cf('0x45')]({},_0x5d8b69,_0x593b35[_0x84cf('0x47')]);return db[_0x84cf('0x34')][_0x84cf('0x4b')](_0x5d8b69)[_0x84cf('0x2b')](handleEntityNotFound(_0x4feb7e,null))[_0x84cf('0x2b')](respondWithResult(_0x4feb7e,null))['catch'](handleError(_0x4feb7e,null));};exports[_0x84cf('0x2c')]=function(_0x55316e,_0x44b8b0){return db['VoicePrefix']['find']({'where':{'id':_0x55316e[_0x84cf('0x4c')]['id']}})[_0x84cf('0x2b')](handleEntityNotFound(_0x44b8b0,null))[_0x84cf('0x2b')](removeEntity(_0x44b8b0,null))['catch'](handleError(_0x44b8b0,null));};exports['describe']=function(_0x290a4d,_0x1ce99c){return db[_0x84cf('0x34')][_0x84cf('0x4d')]()[_0x84cf('0x2b')](respondWithResult(_0x1ce99c,null))['catch'](handleError(_0x1ce99c,null));};exports[_0x84cf('0x4e')]=function(_0x225fc2,_0x5e4af1){var _0x33145e;return db['sequelize']['transaction'](function(_0x147194){return db[_0x84cf('0x34')]['create'](_0x225fc2['body'],{'transaction':_0x147194})[_0x84cf('0x2b')](function(_0x9f2467){_0x33145e=_0x9f2467[_0x84cf('0x2d')]({'plain':!![]});return db[_0x84cf('0x4f')][_0x84cf('0x4b')]({'where':{'id':_0x33145e[_0x84cf('0x50')]},'raw':!![]})[_0x84cf('0x2b')](function(_0x20ae02){return createVoicePrefixExtensions(_0x33145e,_0x20ae02,_0x147194);});});})['then'](function(){var _0x1bc15c=_0x225fc2[_0x84cf('0x51')]['get']({'plain':!![]});if(!_0x1bc15c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bc15c[_0x84cf('0x52')]===_0x84cf('0x51')){var _0x3912cb=_0x33145e;return db[_0x84cf('0x53')][_0x84cf('0x4b')]({'where':{'name':_0x84cf('0x2e'),'userProfileId':_0x1bc15c[_0x84cf('0x54')]},'raw':!![]})['then'](function(_0x652356){if(_0x652356&&_0x652356['autoAssociation']===0x0){return db[_0x84cf('0x2f')]['create']({'name':_0x3912cb[_0x84cf('0x32')],'resourceId':_0x3912cb['id'],'type':_0x652356[_0x84cf('0x32')],'sectionId':_0x652356['id']},{})['then'](function(){return _0x33145e;});}else{return _0x33145e;}})[_0x84cf('0x55')](function(_0x448260){logger['error'](_0x84cf('0x56'),_0x448260);throw _0x448260;});}return _0x33145e;})['then'](respondWithResult(_0x5e4af1,null))['catch'](handleError(_0x5e4af1,null));};function Extension(_0x5cc371,_0x50cde2,_0x2007a6,_0x39394f){this[_0x84cf('0x57')]=_0x84cf('0x58');this['exten']=_0x5cc371;this[_0x84cf('0x59')]=_0x2007a6;this[_0x84cf('0x46')]='system';this[_0x84cf('0x5a')]=_0x84cf('0x5b');this[_0x84cf('0x5c')]=_0x50cde2;this[_0x84cf('0x5d')]=_0x39394f;}function createVoicePrefixExtensions(_0x2073f1,_0x273711,_0x1f1f76){return new BPromise(function(_0x39a336,_0x553ee2){var _0x155934=new Extension(formatPrefixName(_0x2073f1['prefix']),0x1,_0x84cf('0x5e'),_0x84cf('0x5f'));_0x155934[_0x84cf('0x60')]=_0x2073f1['id'];return db[_0x84cf('0x4f')][_0x84cf('0x4e')](_0x155934,{'transaction':_0x1f1f76})['then'](function(_0xfea0d2){var _0x41ee7a=_0xfea0d2[_0x84cf('0x2d')]({'plain':!![]});var _0x4ebb4b=_[_0x84cf('0x33')](addVoicePrefixExtensions(_0x2073f1,_0x273711),function(_0x240cca){_0x240cca['VoiceExtensionId']=_0x41ee7a['id'];_0x240cca[_0x84cf('0x60')]=_0x2073f1['id'];return _0x240cca;});return db['VoiceExtension'][_0x84cf('0x61')](_0x4ebb4b,{'transaction':_0x1f1f76})[_0x84cf('0x2b')](function(_0x57f1f2){if(!_0x57f1f2){return _0x553ee2(_0x84cf('0x62'));}else{return _0x39a336(_0x57f1f2);}})[_0x84cf('0x55')](function(_0x4a7905){return _0x553ee2(_0x4a7905);});});;});};function addVoicePrefixExtensions(_0x40b33e,_0x2ff1bb){var _0x262ae1=[];var _0x286769=formatPrefixName(_0x40b33e['prefix']);_0x262ae1[_0x84cf('0x63')](new Extension(_0x286769,0x2,_0x84cf('0x64'),'CDR(prefix)='+_0x40b33e['name']));if(_0x40b33e['callerIdAll']){_0x262ae1[_0x84cf('0x63')](new Extension(_0x286769,0x3,_0x84cf('0x64'),_0x84cf('0x65')+_0x40b33e['callerIdAll']));}else{_0x262ae1['push'](new Extension(_0x286769,0x3,_0x84cf('0x5e'),_0x84cf('0x66')));}_0x262ae1[_0x84cf('0x63')](new Extension(_0x286769,0x4,_0x84cf('0x67'),_0x2ff1bb[_0x84cf('0x57')]+','+_0x84cf('0x68')+(0x8+_0x40b33e[_0x84cf('0x32')][_0x84cf('0x3c')])+'}'+','+0x1));return _0x262ae1;}function formatPrefixName(_0x4a5e79){var _0x20b930='_';for(var _0x5350d9=0x0;_0x5350d9<_0x4a5e79[_0x84cf('0x3c')];_0x5350d9++){if(_0x4a5e79[_0x84cf('0x69')](_0x5350d9)=='-'){_0x20b930+=_0x4a5e79['charAt'](_0x5350d9);}else{_0x20b930+='['+_0x4a5e79['charAt'](_0x5350d9)+']';}}_0x20b930+='.';return _0x20b930;}exports[_0x84cf('0x2a')]=function(_0x31e622,_0x373a25,_0x1c6e56){var _0xad54e8=_0x31e622['body'];_0xad54e8[_0x84cf('0x6a')]=_0x84cf('0x6b')+_0xad54e8[_0x84cf('0x32')]+'-';return db[_0x84cf('0x6c')]['transaction'](function(_0x93d687){return db['VoicePrefix']['update'](_0xad54e8,{'where':{'id':_0xad54e8['id']},'transaction':_0x93d687})[_0x84cf('0x2b')](function(){return db[_0x84cf('0x4f')][_0x84cf('0x2c')]({'where':{'VoicePrefixId':_0xad54e8['id']},'transaction':_0x93d687})[_0x84cf('0x2b')](function(){return db['VoiceExtension']['find']({'where':{'id':_0xad54e8['VoiceExtensionId']},'raw':!![]})[_0x84cf('0x2b')](function(_0x53e61f){return createVoicePrefixExtensions(_0xad54e8,_0x53e61f,_0x93d687);});});});})[_0x84cf('0x2b')](function(){return db[_0x84cf('0x34')][_0x84cf('0x6d')](_0xad54e8['id']);})[_0x84cf('0x2b')](respondWithResult(_0x373a25,null))['catch'](handleError(_0x373a25,null));};exports[_0x84cf('0x6e')]=function(_0x14ac69,_0x4e1141,_0xa373e4){return db['VoicePrefix']['find']({'where':{'id':_0x14ac69[_0x84cf('0x4c')]['id']}})[_0x84cf('0x2b')](handleEntityNotFound(_0x4e1141,null))['then'](function(_0x5b95b7){if(_0x5b95b7){return _0x5b95b7[_0x84cf('0x6e')](_0x14ac69['body']['ids'],_['omit'](_0x14ac69[_0x84cf('0x6f')],[_0x84cf('0x70'),'id'])||{})[_0x84cf('0x71')](function(_0x58300f){for(var _0x49e6f6=0x0;_0x49e6f6<_0x14ac69[_0x84cf('0x6f')][_0x84cf('0x70')][_0x84cf('0x3c')];_0x49e6f6+=0x1){socket[_0x84cf('0x72')]('userVoicePrefix:save',{'UserId':Number(_0x14ac69['body']['ids'][_0x49e6f6]),'VoicePrefixId':Number(_0x14ac69[_0x84cf('0x4c')]['id'])});}return _0x58300f;});}})[_0x84cf('0x2b')](respondWithResult(_0x4e1141,null))[_0x84cf('0x55')](handleError(_0x4e1141,null));};exports['removeAgents']=function(_0x20693f,_0x29d062,_0x242e39){return db[_0x84cf('0x34')][_0x84cf('0x4b')]({'where':{'id':_0x20693f['params']['id']}})[_0x84cf('0x2b')](handleEntityNotFound(_0x29d062,null))[_0x84cf('0x2b')](function(_0xc32a6f){if(_0xc32a6f){return _0xc32a6f['removeAgents'](_0x20693f[_0x84cf('0x37')][_0x84cf('0x70')])['then'](function(){if(_[_0x84cf('0x73')](_0x20693f[_0x84cf('0x37')][_0x84cf('0x70')])){for(var _0x132210=0x0;_0x132210<_0x20693f['query']['ids'][_0x84cf('0x3c')];_0x132210+=0x1){socket[_0x84cf('0x72')]('userVoicePrefix:remove',{'UserId':Number(_0x20693f['query'][_0x84cf('0x70')][_0x132210]),'VoicePrefixId':Number(_0x20693f[_0x84cf('0x4c')]['id'])});}}else{socket[_0x84cf('0x72')](_0x84cf('0x74'),{'UserId':Number(_0x20693f[_0x84cf('0x37')][_0x84cf('0x70')]),'VoicePrefixId':Number(_0x20693f[_0x84cf('0x4c')]['id'])});}});}})[_0x84cf('0x2b')](respondWithStatusCode(_0x29d062,null))['catch'](handleError(_0x29d062,null));};exports[_0x84cf('0x75')]=function(_0x2323bc,_0x1f7ecd,_0xcb28b4){var _0x4fd3f1={};var _0x3bf924={};var _0x56ea7d;var _0x3ec503;return db['VoicePrefix'][_0x84cf('0x76')]({'where':{'id':_0x2323bc[_0x84cf('0x4c')]['id']}})[_0x84cf('0x2b')](handleEntityNotFound(_0x1f7ecd,null))[_0x84cf('0x2b')](function(_0xc4029f){if(_0xc4029f){_0x56ea7d=_0xc4029f;_0x3bf924['model']=_[_0x84cf('0x38')](db[_0x84cf('0x77')][_0x84cf('0x4a')]);_0x3bf924[_0x84cf('0x37')]=_[_0x84cf('0x38')](_0x2323bc[_0x84cf('0x37')]);_0x3bf924[_0x84cf('0x43')]=_[_0x84cf('0x39')](_0x3bf924[_0x84cf('0x3d')],_0x3bf924[_0x84cf('0x37')]);_0x4fd3f1[_0x84cf('0x3a')]=_[_0x84cf('0x39')](_0x3bf924[_0x84cf('0x3d')],qs[_0x84cf('0x3b')](_0x2323bc[_0x84cf('0x37')][_0x84cf('0x3b')]));_0x4fd3f1[_0x84cf('0x3a')]=_0x4fd3f1[_0x84cf('0x3a')]['length']?_0x4fd3f1['attributes']:_0x3bf924[_0x84cf('0x3d')];_0x4fd3f1['order']=qs[_0x84cf('0x41')](_0x2323bc[_0x84cf('0x37')]['sort']);_0x4fd3f1[_0x84cf('0x42')]=qs[_0x84cf('0x43')](_[_0x84cf('0x78')](_0x2323bc['query'],_0x3bf924[_0x84cf('0x43')]));if(_0x2323bc['query'][_0x84cf('0x44')]){_0x4fd3f1['where']=_[_0x84cf('0x45')](_0x4fd3f1[_0x84cf('0x42')],{'$or':_['map'](_0x4fd3f1[_0x84cf('0x3a')],function(_0x10e44b){var _0xe11402={};_0xe11402[_0x10e44b]={'$like':'%'+_0x2323bc['query'][_0x84cf('0x44')]+'%'};return _0xe11402;})});}_0x4fd3f1=_['merge']({},_0x4fd3f1,_0x2323bc[_0x84cf('0x47')]);return _0x56ea7d[_0x84cf('0x75')](_0x4fd3f1);}})[_0x84cf('0x2b')](function(_0xff46d2){if(_0xff46d2){_0x3ec503=_0xff46d2[_0x84cf('0x3c')];if(!_0x2323bc[_0x84cf('0x37')]['hasOwnProperty'](_0x84cf('0x3f'))){_0x4fd3f1[_0x84cf('0x25')]=qs[_0x84cf('0x25')](_0x2323bc[_0x84cf('0x37')][_0x84cf('0x25')]);_0x4fd3f1[_0x84cf('0x22')]=qs[_0x84cf('0x22')](_0x2323bc[_0x84cf('0x37')][_0x84cf('0x22')]);}return _0x56ea7d['getAgents'](_0x4fd3f1);}})[_0x84cf('0x2b')](function(_0x4dc17f){if(_0x4dc17f){return _0x4dc17f?{'count':_0x3ec503,'rows':_0x4dc17f}:null;}})['then'](respondWithResult(_0x1f7ecd,null))[_0x84cf('0x55')](handleError(_0x1f7ecd,null));};exports[_0x84cf('0x79')]=function(_0x55da82,_0xf14418,_0x1def45){var _0x13d30b={};var _0x4dad47={};var _0x3152c2;var _0x50e088;return db[_0x84cf('0x34')][_0x84cf('0x76')]({'where':{'id':_0x55da82[_0x84cf('0x4c')]['id']}})[_0x84cf('0x2b')](handleEntityNotFound(_0xf14418,null))[_0x84cf('0x2b')](function(_0x3b5f14){if(_0x3b5f14){_0x3152c2=_0x3b5f14;_0x4dad47['model']=_[_0x84cf('0x38')](db[_0x84cf('0x7a')][_0x84cf('0x4a')]);_0x4dad47[_0x84cf('0x37')]=_[_0x84cf('0x38')](_0x55da82[_0x84cf('0x37')]);_0x4dad47[_0x84cf('0x43')]=_[_0x84cf('0x39')](_0x4dad47[_0x84cf('0x3d')],_0x4dad47[_0x84cf('0x37')]);_0x13d30b['attributes']=_['intersection'](_0x4dad47[_0x84cf('0x3d')],qs['fields'](_0x55da82[_0x84cf('0x37')][_0x84cf('0x3b')]));_0x13d30b[_0x84cf('0x3a')]=_0x13d30b['attributes'][_0x84cf('0x3c')]?_0x13d30b[_0x84cf('0x3a')]:_0x4dad47[_0x84cf('0x3d')];_0x13d30b[_0x84cf('0x40')]=qs['sort'](_0x55da82['query'][_0x84cf('0x41')]);_0x13d30b[_0x84cf('0x42')]=qs[_0x84cf('0x43')](_[_0x84cf('0x78')](_0x55da82[_0x84cf('0x37')],_0x4dad47[_0x84cf('0x43')]));if(_0x55da82[_0x84cf('0x37')][_0x84cf('0x44')]){_0x13d30b[_0x84cf('0x42')]=_[_0x84cf('0x45')](_0x13d30b['where'],{'$or':_[_0x84cf('0x33')](_0x13d30b[_0x84cf('0x3a')],function(_0x543607){var _0x4e9be5={};_0x4e9be5[_0x543607]={'$like':'%'+_0x55da82[_0x84cf('0x37')][_0x84cf('0x44')]+'%'};return _0x4e9be5;})});}_0x13d30b=_[_0x84cf('0x45')]({},_0x13d30b,_0x55da82[_0x84cf('0x47')]);return _0x3152c2[_0x84cf('0x79')](_0x13d30b);}})['then'](function(_0x38e27d){if(_0x38e27d){_0x50e088=_0x38e27d[_0x84cf('0x3c')];if(!_0x55da82[_0x84cf('0x37')][_0x84cf('0x3e')](_0x84cf('0x3f'))){_0x13d30b[_0x84cf('0x25')]=qs['limit'](_0x55da82[_0x84cf('0x37')][_0x84cf('0x25')]);_0x13d30b['offset']=qs['offset'](_0x55da82[_0x84cf('0x37')]['offset']);}return _0x3152c2[_0x84cf('0x79')](_0x13d30b);}})['then'](function(_0x127ac0){if(_0x127ac0){return _0x127ac0?{'count':_0x50e088,'rows':_0x127ac0}:null;}})[_0x84cf('0x2b')](respondWithResult(_0xf14418,null))[_0x84cf('0x55')](handleError(_0xf14418,null));};exports['addTeams']=function(_0x2e145c,_0x15ed32,_0x265818){var _0x57c01b=_0x2e145c[_0x84cf('0x6f')][_0x84cf('0x70')];var _0x27492c;return db[_0x84cf('0x7a')][_0x84cf('0x7b')]({'where':{'id':_0x57c01b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x84cf('0x7c'),'attributes':['id',_0x84cf('0x32'),'online',_0x84cf('0x7d'),_0x84cf('0x7e')],'raw':!![]}]})[_0x84cf('0x2b')](function(_0x188afd){if(_0x188afd){_0x27492c=_0x188afd;var _0x2d75f8=_[_0x84cf('0x7f')](_0x188afd,function(_0x5b9da4){var _0x8e16b4=_0x5b9da4[_0x84cf('0x2d')]({'plain':!![]});return _0x8e16b4[_0x84cf('0x7c')];});return db[_0x84cf('0x34')][_0x84cf('0x4b')]({'where':{'id':_0x2e145c[_0x84cf('0x4c')]['id']}})[_0x84cf('0x2b')](function(_0x1a083d){return db[_0x84cf('0x6c')][_0x84cf('0x80')](function(_0x5e41df){return _0x1a083d[_0x84cf('0x81')](_0x57c01b,{'transaction':_0x5e41df})[_0x84cf('0x2b')](function(){return BPromise[_0x84cf('0x82')](_0x27492c,function(_0x33fb10){return db[_0x84cf('0x83')][_0x84cf('0x84')]({'TeamId':_0x33fb10['id'],'VoicePrefixId':_0x2e145c['params']['id']},{'transaction':_0x5e41df});});})['then'](function(){return BPromise[_0x84cf('0x82')](_0x2d75f8,function(_0x166065){return db[_0x84cf('0x85')][_0x84cf('0x86')]({'where':{'UserId':_0x166065['id'],'VoicePrefixId':_0x2e145c[_0x84cf('0x4c')]['id']},'transaction':_0x5e41df});});})['then'](function(){_0x2d75f8[_0x84cf('0x87')](function(_0x4ce3ea){socket['emit']('userVoicePrefix:save',{'UserId':_0x4ce3ea['id'],'VoicePrefixId':_0x1a083d['id']});});});});});}})['then'](respondWithStatusCode(_0x15ed32,null))[_0x84cf('0x55')](handleError(_0x15ed32,null));};exports[_0x84cf('0x88')]=function(_0x5d6832,_0x502910,_0x311d7e){return db[_0x84cf('0x7a')][_0x84cf('0x7b')]({'where':{'id':_0x5d6832[_0x84cf('0x37')][_0x84cf('0x70')]},'attributes':['id'],'include':[{'model':db[_0x84cf('0x77')],'as':_0x84cf('0x7c'),'attributes':['id'],'raw':!![]}]})[_0x84cf('0x2b')](handleEntityNotFound(_0x502910,null))[_0x84cf('0x2b')](function(_0x2d17a1){var _0x5d0481=_[_0x84cf('0x33')](_0x2d17a1,'id');var _0x38c81a=[];var _0x4cb254=[];var _0x2aa96a=squel['select']();_0x2aa96a[_0x84cf('0x89')](_0x84cf('0x8a'))[_0x84cf('0x8b')]('team_has_voice_prefixes','tq')[_0x84cf('0x8c')]('user_has_teams','ut',_0x84cf('0x8d'))[_0x84cf('0x42')]('VoicePrefixId\x20=\x20?',_0x5d6832[_0x84cf('0x4c')]['id']);for(var _0x5b6ced=0x0;_0x5b6ced<_0x2d17a1[_0x84cf('0x3c')];_0x5b6ced+=0x1){let _0x202101=_0x2d17a1[_0x5b6ced];for(var _0x4b06c6=0x0;_0x4b06c6<_0x202101[_0x84cf('0x7c')][_0x84cf('0x3c')];_0x4b06c6+=0x1){let _0x3c05ec=_0x202101[_0x84cf('0x7c')][_0x4b06c6];var _0x145498=_0x2aa96a[_0x84cf('0x8e')]();_0x145498[_0x84cf('0x42')](_0x84cf('0x8f'),_0x3c05ec['id']);_0x4cb254[_0x84cf('0x63')](db[_0x84cf('0x6c')][_0x84cf('0x37')](_0x145498[_0x84cf('0x90')](),{'type':db['sequelize'][_0x84cf('0x91')][_0x84cf('0x92')]})[_0x84cf('0x2b')](function(_0x30b3c9){if(_0x30b3c9[_0x84cf('0x3c')]===0x1){return _0x3c05ec['id'];}else{var _0x562de5=_['every'](_['map'](_0x30b3c9,_0x84cf('0x93')),function(_0x55f411){return _[_0x84cf('0x94')](_0x5d0481,_0x55f411);});if(_0x562de5){return _0x3c05ec['id'];}}}));}}return BPromise[_0x84cf('0x95')](_0x4cb254)[_0x84cf('0x2b')](function(_0x5d4ece){_0x38c81a=_(_0x38c81a)[_0x84cf('0x96')](_0x5d4ece)[_0x84cf('0x97')]()[_0x84cf('0x98')]();return db['VoicePrefix']['find']({'where':{'id':_0x5d6832['params']['id']}})[_0x84cf('0x2b')](function(_0x399112){return db[_0x84cf('0x6c')][_0x84cf('0x80')](function(_0x209b79){return _0x399112['removeTeams'](_0x5d6832[_0x84cf('0x37')][_0x84cf('0x70')],{'transaction':_0x209b79})[_0x84cf('0x2b')](function(){if(!_['isEmpty'](_0x38c81a)){return _0x399112[_0x84cf('0x99')](_0x38c81a,{'transaction':_0x209b79});}})['then'](function(){_0x38c81a[_0x84cf('0x87')](function(_0x194267){socket[_0x84cf('0x72')](_0x84cf('0x74'),{'UserId':_0x194267,'VoicePrefixId':_0x399112['id']});});});});});});})['then'](respondWithStatusCode(_0x502910,null))[_0x84cf('0x55')](handleError(_0x502910,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 68d475d..bedfe00 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 _0x3e04=['save','update','remove','emit','hasOwnProperty','exports','events','VoicePrefix','setMaxListeners'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0x3e04,0x138));var _0x43e0=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x3e04[_0x39d544];return _0x5a5ff2;};'use strict';var EventEmitter=require(_0x43e0('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x43e0('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x43e0('0x2')](0x0);var events={'afterCreate':_0x43e0('0x3'),'afterUpdate':_0x43e0('0x4'),'afterDestroy':_0x43e0('0x5')};function emitEvent(_0x443df6){return function(_0x37318a,_0x3783df,_0x371c12){VoicePrefixEvents[_0x43e0('0x6')](_0x443df6+':'+_0x37318a['id'],_0x37318a);VoicePrefixEvents['emit'](_0x443df6,_0x37318a);_0x371c12(null);};}for(var e in events){if(events[_0x43e0('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x43e0('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xaf23=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove','emit'];(function(_0x10e73e,_0x1f6b20){var _0x1ddf27=function(_0x2bf3a2){while(--_0x2bf3a2){_0x10e73e['push'](_0x10e73e['shift']());}};_0x1ddf27(++_0x1f6b20);}(_0xaf23,0x12c));var _0x3af2=function(_0x2c61f8,_0xb8a4dd){_0x2c61f8=_0x2c61f8-0x0;var _0x4badd1=_0xaf23[_0x2c61f8];return _0x4badd1;};'use strict';var EventEmitter=require(_0x3af2('0x0'));var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x3af2('0x1')](0x0);var events={'afterCreate':_0x3af2('0x2'),'afterUpdate':_0x3af2('0x3'),'afterDestroy':_0x3af2('0x4')};function emitEvent(_0x528e97){return function(_0x274143,_0x58ccca,_0x5955f7){VoicePrefixEvents[_0x3af2('0x5')](_0x528e97+':'+_0x274143['id'],_0x274143);VoicePrefixEvents[_0x3af2('0x5')](_0x528e97,_0x274143);_0x5955f7(null);};}for(var e in events){if(events[_0x3af2('0x6')](e)){var event=events[e];VoicePrefix[_0x3af2('0x7')](e,emitEvent(event));}}module[_0x3af2('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 66bc820..0f02ec6 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 _0xb824=['exports','voice_prefixes','lodash','util','api','moment','request-promise','path','rimraf','./voicePrefix.attributes'];(function(_0x3c941f,_0x5919a6){var _0x37f6e2=function(_0x2ef6b6){while(--_0x2ef6b6){_0x3c941f['push'](_0x3c941f['shift']());}};_0x37f6e2(++_0x5919a6);}(_0xb824,0x192));var _0x4b82=function(_0x52d11e,_0x129dee){_0x52d11e=_0x52d11e-0x0;var _0x13ac50=_0xb824[_0x52d11e];return _0x13ac50;};'use strict';var _=require(_0x4b82('0x0'));var util=require(_0x4b82('0x1'));var logger=require('../../config/logger')(_0x4b82('0x2'));var moment=require(_0x4b82('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b82('0x4'));var fs=require('fs');var path=require(_0x4b82('0x5'));var rimraf=require(_0x4b82('0x6'));var config=require('../../config/environment');var attributes=require(_0x4b82('0x7'));module[_0x4b82('0x8')]=function(_0x2721ad,_0x3a2df2){return _0x2721ad['define']('VoicePrefix',attributes,{'tableName':_0x4b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd493=['bluebird','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','moment'];(function(_0x57c78d,_0x401f2d){var _0xb8ffd8=function(_0x46c14e){while(--_0x46c14e){_0x57c78d['push'](_0x57c78d['shift']());}};_0xb8ffd8(++_0x401f2d);}(_0xd493,0x100));var _0x3d49=function(_0x5958c2,_0x43d00a){_0x5958c2=_0x5958c2-0x0;var _0x1ccd13=_0xd493[_0x5958c2];return _0x1ccd13;};'use strict';var _=require(_0x3d49('0x0'));var util=require(_0x3d49('0x1'));var logger=require(_0x3d49('0x2'))('api');var moment=require(_0x3d49('0x3'));var BPromise=require(_0x3d49('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d49('0x5'));var rimraf=require(_0x3d49('0x6'));var config=require(_0x3d49('0x7'));var attributes=require(_0x3d49('0x8'));module[_0x3d49('0x9')]=function(_0x1a1f99,_0x5ca8cb){return _0x1a1f99[_0x3d49('0xa')](_0x3d49('0xb'),attributes,{'tableName':_0x3d49('0xc'),'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 c121945..cc385ac 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 _0xc6ac=['http','defaults','redis','localhost','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4b6d81,_0x1ca4dd){_0x4b6d81=_0x4b6d81-0x0;var _0x496b03=_0xc6ac[_0x4b6d81];return _0x496b03;};'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});config['redis']=_[_0xcc6a('0xe')](config[_0xcc6a('0xf')],{'host':_0xcc6a('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc6a('0xf')]));require(_0xcc6a('0x11'))[_0xcc6a('0x12')](socket);function respondWithRpcPromise(_0x463ebb,_0x3eb04a,_0x5e91a2){return new BPromise(function(_0x30a004,_0x290119){return client[_0xcc6a('0x13')](_0x463ebb,_0x5e91a2)['then'](function(_0x1d91a5){logger[_0xcc6a('0x14')](_0xcc6a('0x15'),_0x3eb04a,'request\x20sent');logger['debug'](_0xcc6a('0x16'),_0x3eb04a,_0xcc6a('0x17'),JSON[_0xcc6a('0x18')](_0x1d91a5));if(_0x1d91a5['error']){if(_0x1d91a5['error'][_0xcc6a('0x19')]===0x1f4){logger[_0xcc6a('0x1a')](_0xcc6a('0x15'),_0x3eb04a,_0x1d91a5[_0xcc6a('0x1a')][_0xcc6a('0x1b')]);return _0x290119(_0x1d91a5[_0xcc6a('0x1a')][_0xcc6a('0x1b')]);}logger[_0xcc6a('0x1a')]('VoicePrefix,\x20%s,\x20%s',_0x3eb04a,_0x1d91a5['error']['message']);return _0x30a004(_0x1d91a5[_0xcc6a('0x1a')][_0xcc6a('0x1b')]);}else{logger[_0xcc6a('0x14')](_0xcc6a('0x15'),_0x3eb04a,_0xcc6a('0x17'));_0x30a004(_0x1d91a5[_0xcc6a('0x1c')][_0xcc6a('0x1b')]);}})[_0xcc6a('0x1d')](function(_0x374e51){logger[_0xcc6a('0x1a')](_0xcc6a('0x15'),_0x3eb04a,_0x374e51);_0x290119(_0x374e51);});});} \ No newline at end of file +var _0xa786=['stringify','error','code','message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x30b170,_0x4a062d){var _0x18b746=function(_0x114e14){while(--_0x114e14){_0x30b170['push'](_0x30b170['shift']());}};_0x18b746(++_0x4a062d);}(_0xa786,0x71));var _0x6a78=function(_0x47d603,_0x4ad33f){_0x47d603=_0x47d603-0x0;var _0x336591=_0xa786[_0x47d603];return _0x336591;};'use strict';var _=require(_0x6a78('0x0'));var util=require(_0x6a78('0x1'));var moment=require(_0x6a78('0x2'));var BPromise=require('bluebird');var rs=require(_0x6a78('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6a78('0x4'));var logger=require(_0x6a78('0x5'))(_0x6a78('0x6'));var config=require(_0x6a78('0x7'));var jayson=require(_0x6a78('0x8'));var client=jayson[_0x6a78('0x9')][_0x6a78('0xa')]({'port':0x232a});config['redis']=_[_0x6a78('0xb')](config[_0x6a78('0xc')],{'host':_0x6a78('0xd'),'port':0x18eb});var socket=require(_0x6a78('0xe'))(new Redis(config[_0x6a78('0xc')]));require(_0x6a78('0xf'))[_0x6a78('0x10')](socket);function respondWithRpcPromise(_0x2364b5,_0x43e233,_0x5dd2d2){return new BPromise(function(_0x25b436,_0x1fca69){return client[_0x6a78('0x11')](_0x2364b5,_0x5dd2d2)['then'](function(_0x2a433a){logger[_0x6a78('0x12')](_0x6a78('0x13'),_0x43e233,_0x6a78('0x14'));logger[_0x6a78('0x15')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x43e233,_0x6a78('0x14'),JSON[_0x6a78('0x16')](_0x2a433a));if(_0x2a433a[_0x6a78('0x17')]){if(_0x2a433a['error'][_0x6a78('0x18')]===0x1f4){logger[_0x6a78('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x43e233,_0x2a433a[_0x6a78('0x17')][_0x6a78('0x19')]);return _0x1fca69(_0x2a433a[_0x6a78('0x17')][_0x6a78('0x19')]);}logger[_0x6a78('0x17')](_0x6a78('0x13'),_0x43e233,_0x2a433a['error'][_0x6a78('0x19')]);return _0x25b436(_0x2a433a[_0x6a78('0x17')][_0x6a78('0x19')]);}else{logger[_0x6a78('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x43e233,'request\x20sent');_0x25b436(_0x2a433a[_0x6a78('0x1a')]['message']);}})['catch'](function(_0x4efb20){logger[_0x6a78('0x17')](_0x6a78('0x13'),_0x43e233,_0x4efb20);_0x1fca69(_0x4efb20);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 148145f..2d68a5d 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 _0xc3fe=['save','remove','removeListener','./voicePrefix.events'];(function(_0xce9249,_0x4d1d64){var _0x4a5eaa=function(_0x28535e){while(--_0x28535e){_0xce9249['push'](_0xce9249['shift']());}};_0x4a5eaa(++_0x4d1d64);}(_0xc3fe,0xff));var _0xec3f=function(_0x5092bc,_0xae0e50){_0x5092bc=_0x5092bc-0x0;var _0x395d5a=_0xc3fe[_0x5092bc];return _0x395d5a;};'use strict';var VoicePrefixEvents=require(_0xec3f('0x0'));var events=[_0xec3f('0x1'),_0xec3f('0x2'),'update'];function createListener(_0x15ddf0,_0x2a45d9){return function(_0x2d85fc){_0x2a45d9['emit'](_0x15ddf0,_0x2d85fc);};}function removeListener(_0x3e6b6e,_0xda4641){return function(){VoicePrefixEvents[_0xec3f('0x3')](_0x3e6b6e,_0xda4641);};}exports['register']=function(_0x4fb9aa){for(var _0x2d5b29=0x0,_0x3b0b84=events['length'];_0x2d5b29<_0x3b0b84;_0x2d5b29++){var _0x503775=events[_0x2d5b29];var _0xcb8557=createListener('voicePrefix:'+_0x503775,_0x4fb9aa);VoicePrefixEvents['on'](_0x503775,_0xcb8557);}}; \ No newline at end of file +var _0xc524=['register','voicePrefix:','remove','update','emit'];(function(_0x2679ef,_0x36431a){var _0x3a19e2=function(_0x2bb13f){while(--_0x2bb13f){_0x2679ef['push'](_0x2679ef['shift']());}};_0x3a19e2(++_0x36431a);}(_0xc524,0x1bf));var _0x4c52=function(_0x4bd487,_0x43e412){_0x4bd487=_0x4bd487-0x0;var _0x188b02=_0xc524[_0x4bd487];return _0x188b02;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0x4c52('0x0'),_0x4c52('0x1')];function createListener(_0x17ff32,_0x1c08f8){return function(_0x3cd5d1){_0x1c08f8[_0x4c52('0x2')](_0x17ff32,_0x3cd5d1);};}function removeListener(_0x475673,_0x4fbcb3){return function(){VoicePrefixEvents['removeListener'](_0x475673,_0x4fbcb3);};}exports[_0x4c52('0x3')]=function(_0xdaf126){for(var _0x72d0ec=0x0,_0x4756e3=events['length'];_0x72d0ec<_0x4756e3;_0x72d0ec++){var _0x4ea85e=events[_0x72d0ec];var _0x39591b=createListener(_0x4c52('0x4')+_0x4ea85e,_0xdaf126);VoicePrefixEvents['on'](_0x4ea85e,_0x39591b);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index a53eedd..a130f7f 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(_0x5c08cb,_0x456960){var _0x147907=function(_0x1da1be){while(--_0x1da1be){_0x5c08cb['push'](_0x5c08cb['shift']());}};_0x147907(++_0x456960);}(_0xb10b,0x12a));var _0xbb10=function(_0x546f72,_0x3b10bc){_0x546f72=_0x546f72-0x0;var _0x45dea6=_0xb10b[_0x546f72];return _0x45dea6;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x3d38ae,_0x51102b){var _0x3757ee=function(_0x22bac8){while(--_0x22bac8){_0x3d38ae['push'](_0x3d38ae['shift']());}};_0x3757ee(++_0x51102b);}(_0xb10b,0x12a));var _0xbb10=function(_0x151d64,_0x360f73){_0x151d64=_0x151d64-0x0;var _0x409cfd=_0xb10b[_0x151d64];return _0x409cfd;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 4d5d8ff..81d21a4 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 _0x5234=['inbound','outbound','ringall','leastrecent','rrmemory','linear','rrordered','setDataValue','type','getDataValue','dialMethod','strategy','preview','booked','roundrobin','INTEGER','ENUM','yes','all','once','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','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\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name'];(function(_0x5245ba,_0x5a7ba7){var _0x191394=function(_0x4c880e){while(--_0x4c880e){_0x5245ba['push'](_0x5245ba['shift']());}};_0x191394(++_0x5a7ba7);}(_0x5234,0x18c));var _0x4523=function(_0x55ae89,_0x3d3b81){_0x55ae89=_0x55ae89-0x0;var _0x1f127d=_0x5234[_0x55ae89];return _0x1f127d;};'use strict';var Sequelize=require(_0x4523('0x0'));module[_0x4523('0x1')]={'name':{'type':Sequelize[_0x4523('0x2')],'allowNull':![],'unique':_0x4523('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x4523('0x4'),_0x4523('0x5')),'allowNull':![],'defaultValue':_0x4523('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x4523('0x6'),_0x4523('0x7'),'fewestcalls','random',_0x4523('0x8'),_0x4523('0x9'),'wrandom',_0x4523('0xa')),'allowNull':![],'defaultValue':_0x4523('0x6'),'set':function(_0x52c226){this[_0x4523('0xb')]('strategy',_0x52c226?_0x52c226:_0x4523('0x8'));},'get':function(){var _0x5b28ca=this['getDataValue'](_0x4523('0xc'));var _0x565a99=this[_0x4523('0xd')](_0x4523('0xe'));var _0x1873c9=this[_0x4523('0xd')](_0x4523('0xf'));if(_0x5b28ca===_0x4523('0x5')){if(_0x565a99===_0x4523('0x10')){return null;}if(_0x565a99===_0x4523('0x11')&&![_0x4523('0x8'),_0x4523('0x12')]['includes'](_0x1873c9)){this[_0x4523('0xb')]('strategy',_0x4523('0x8'));}}return _0x1873c9;}},'servicelevel':{'type':Sequelize[_0x4523('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x4523('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x4523('0x13')](0xb)},'timeout':{'type':Sequelize[_0x4523('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x4523('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x4523('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x4523('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x4523('0x14')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x4523('0x14')](_0x4523('0x15'),'no',_0x4523('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x4523('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x4523('0x14')](_0x4523('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x4523('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x4523('0x14')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x4523('0x14')](_0x4523('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x4523('0x14')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x4523('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x4523('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x4523('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x4523('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x4523('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x4523('0x14')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x4523('0x14')](_0x4523('0x15'),'no'),'defaultValue':_0x4523('0x15')},'announce_holdtime':{'type':Sequelize[_0x4523('0x14')](_0x4523('0x15'),'no',_0x4523('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x4523('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x4523('0x14')](_0x4523('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x4523('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x4523('0x14')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x4523('0x2')]},'queue_youarenext':{'type':Sequelize[_0x4523('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x4523('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x4523('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x4523('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x4523('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x4523('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x4523('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x4523('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x4523('0x2')]},'queue_quantity1':{'type':Sequelize[_0x4523('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x4523('0x2')]},'periodic_announce':{'type':Sequelize[_0x4523('0x18')],'set':function(_0x10a66c){this[_0x4523('0xb')](_0x4523('0x19'),_0x10a66c?_0x10a66c[_0x4523('0x1a')](','):[]);},'get':function(){return this[_0x4523('0xd')](_0x4523('0x19'))?this[_0x4523('0xd')](_0x4523('0x19'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x4523('0x2')],'defaultValue':'yes','set':function(_0xbbdf97){this[_0x4523('0xb')]('joinempty',_0xbbdf97?_0xbbdf97[_0x4523('0x1a')](','):undefined);},'get':function(){return this[_0x4523('0xd')]('joinempty')?this[_0x4523('0xd')](_0x4523('0x1b'))[_0x4523('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x4523('0x2')],'defaultValue':'no','set':function(_0x58a43d){this[_0x4523('0xb')](_0x4523('0x1d'),_0x58a43d?_0x58a43d[_0x4523('0x1a')](','):undefined);},'get':function(){return this[_0x4523('0xd')]('leavewhenempty')?this[_0x4523('0xd')](_0x4523('0x1d'))[_0x4523('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x4523('0x14')](_0x4523('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x4523('0x14')](_0x4523('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x4523('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4523('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x54f52e){this['setDataValue']('acw',_0x54f52e);if(_0x54f52e){if(this[_0x4523('0xd')](_0x4523('0x1e'))<0x2){this[_0x4523('0xb')](_0x4523('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x4523('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4523('0x1f')},'dialMethod':{'type':Sequelize[_0x4523('0x14')](_0x4523('0x10'),_0x4523('0x20'),_0x4523('0x21'),_0x4523('0x22'),_0x4523('0x11')),'defaultValue':_0x4523('0x20'),'comment':_0x4523('0x23')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x4523('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4523('0x25')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4523('0x26')},'dialPowerLevel':{'type':Sequelize[_0x4523('0x27')](0x2)[_0x4523('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x4523('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x4523('0x14')](_0x4523('0x29'),_0x4523('0x2a')),'defaultValue':_0x4523('0x2a'),'comment':_0x4523('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x4523('0x27')](0x2)[_0x4523('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x4523('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x4523('0x13')](0x3)[_0x4523('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x4523('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0x4523('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4523('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x4523('0x2')],'defaultValue':_0x4523('0x2e'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x4523('0x13')](0x3)[_0x4523('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4523('0x2f')},'dialQueueProject':{'type':Sequelize[_0x4523('0x2')],'comment':_0x4523('0x30')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4523('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4523('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4523('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4523('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0x4523('0x13')](0x3)[_0x4523('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4523('0x33')},'dialBusyRetryFrequency':{'type':Sequelize[_0x4523('0x13')](0x5)[_0x4523('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4523('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x4523('0x13')](0x3)[_0x4523('0x24')],'defaultValue':0x3,'comment':_0x4523('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4523('0x13')](0x5)[_0x4523('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4523('0x36')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4523('0x37')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4523('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x4523('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x4523('0x14')](_0x4523('0x38'),_0x4523('0x39'),'onlyIfOpen'),'defaultValue':_0x4523('0x38')},'dialAMDActive':{'type':Sequelize[_0x4523('0x3a')],'defaultValue':0x0,'comment':_0x4523('0x3b')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4523('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0x4523('0x13')](0x9)[_0x4523('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4523('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4523('0x13')](0x9)[_0x4523('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4523('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4523('0x13')](0x9)[_0x4523('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4523('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0x4523('0x13')](0x9)[_0x4523('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4523('0x13')](0x9)[_0x4523('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4523('0x40')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x4523('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x4523('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4523('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x4523('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4523('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0x4523('0x13')](0x5)[_0x4523('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x4523('0x3a')],'defaultValue':0x0,'comment':_0x4523('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x4523('0x14')]('DESC',_0x4523('0x44')),'defaultValue':_0x4523('0x45')},'dialQueueProject2':{'type':Sequelize[_0x4523('0x2')],'comment':_0x4523('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x4523('0x3a')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4523('0x13')](0x3)[_0x4523('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x4523('0x13')](0x3)[_0x4523('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4523('0x13')](0x3)[_0x4523('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4523('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4523('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4523('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0x4523('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4523('0x48')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4523('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4523('0x13')](0x5)[_0x4523('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x4523('0x13')](0x3)[_0x4523('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4523('0x49')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4523('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4523('0x13')](0x3)[_0x4523('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4523('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4523('0x13')](0x5)[_0x4523('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4523('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4523('0x13')],'allowNull':!![],'comment':_0x4523('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x4523('0x3a')],'defaultValue':![],'comment':_0x4523('0x4d'),'set':function(_0x348e40){if(!_0x348e40)this['setDataValue'](_0x4523('0x4e'),null);this['setDataValue'](_0x4523('0x4f'),_0x348e40);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x4523('0x13')](0x3)[_0x4523('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x4523('0x13')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x4523('0x13')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x4523('0x3a')],'defaultValue':![]}}; \ No newline at end of file +var _0x4d22=['Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','outbound','inbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','strategy','getDataValue','type','preview','booked','roundrobin','includes','INTEGER','yes','once','TEXT','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','UNSIGNED','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\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','onlyIfOpen'];(function(_0x59a443,_0x196c4f){var _0x4319e6=function(_0x244eb4){while(--_0x244eb4){_0x59a443['push'](_0x59a443['shift']());}};_0x4319e6(++_0x196c4f);}(_0x4d22,0x72));var _0x24d2=function(_0x11d289,_0x51ed78){_0x11d289=_0x11d289-0x0;var _0x108509=_0x4d22[_0x11d289];return _0x108509;};'use strict';var Sequelize=require(_0x24d2('0x0'));module[_0x24d2('0x1')]={'name':{'type':Sequelize[_0x24d2('0x2')],'allowNull':![],'unique':_0x24d2('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x24d2('0x4')]('inbound',_0x24d2('0x5')),'allowNull':![],'defaultValue':_0x24d2('0x6')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x24d2('0x7')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x24d2('0x4')]('rr',_0x24d2('0x8'),_0x24d2('0x9'),_0x24d2('0xa'),_0x24d2('0xb'),_0x24d2('0xc'),_0x24d2('0xd'),_0x24d2('0xe'),'rrordered'),'allowNull':![],'defaultValue':_0x24d2('0x8'),'set':function(_0x34e4ef){this['setDataValue'](_0x24d2('0xf'),_0x34e4ef?_0x34e4ef:_0x24d2('0xc'));},'get':function(){var _0x5afce8=this[_0x24d2('0x10')](_0x24d2('0x11'));var _0x1c7918=this['getDataValue']('dialMethod');var _0x4e1570=this['getDataValue'](_0x24d2('0xf'));if(_0x5afce8===_0x24d2('0x5')){if(_0x1c7918===_0x24d2('0x12')){return null;}if(_0x1c7918===_0x24d2('0x13')&&![_0x24d2('0xc'),_0x24d2('0x14')][_0x24d2('0x15')](_0x4e1570)){this['setDataValue'](_0x24d2('0xf'),_0x24d2('0xc'));}}return _0x4e1570;}},'servicelevel':{'type':Sequelize[_0x24d2('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x24d2('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x24d2('0x16')](0xb)},'timeout':{'type':Sequelize[_0x24d2('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x24d2('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x24d2('0x2')]},'weight':{'type':Sequelize[_0x24d2('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x24d2('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x24d2('0x17')},'autopause':{'type':Sequelize[_0x24d2('0x4')](_0x24d2('0x17'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x24d2('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x24d2('0x4')](_0x24d2('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x24d2('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x24d2('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x24d2('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x24d2('0x4')](_0x24d2('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x24d2('0x4')](_0x24d2('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x24d2('0x4')](_0x24d2('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x24d2('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x24d2('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x24d2('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x24d2('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x24d2('0x17'),'no'),'defaultValue':_0x24d2('0x17')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x24d2('0x17'),'no',_0x24d2('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x24d2('0x4')](_0x24d2('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x24d2('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x24d2('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x24d2('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x24d2('0x2')]},'queue_youarenext':{'type':Sequelize[_0x24d2('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x24d2('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x24d2('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x24d2('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x24d2('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x24d2('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x24d2('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x24d2('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x24d2('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x24d2('0x2')]},'periodic_announce':{'type':Sequelize[_0x24d2('0x19')],'set':function(_0x2b51ad){this[_0x24d2('0x1a')](_0x24d2('0x1b'),_0x2b51ad?_0x2b51ad[_0x24d2('0x1c')](','):[]);},'get':function(){return this['getDataValue'](_0x24d2('0x1b'))?this[_0x24d2('0x10')](_0x24d2('0x1b'))[_0x24d2('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x24d2('0x2')],'defaultValue':_0x24d2('0x17'),'set':function(_0x149704){this[_0x24d2('0x1a')](_0x24d2('0x1e'),_0x149704?_0x149704[_0x24d2('0x1c')](','):undefined);},'get':function(){return this[_0x24d2('0x10')]('joinempty')?this[_0x24d2('0x10')](_0x24d2('0x1e'))[_0x24d2('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x345869){this[_0x24d2('0x1a')](_0x24d2('0x1f'),_0x345869?_0x345869[_0x24d2('0x1c')](','):undefined);},'get':function(){return this[_0x24d2('0x10')]('leavewhenempty')?this[_0x24d2('0x10')](_0x24d2('0x1f'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x24d2('0x4')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x24d2('0x4')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x24d2('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x24d2('0x4')](_0x24d2('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x24d2('0x2')]},'description':{'type':Sequelize[_0x24d2('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x52616d){this['setDataValue'](_0x24d2('0x20'),_0x52616d);if(_0x52616d){if(this[_0x24d2('0x10')](_0x24d2('0x21'))<0x2){this[_0x24d2('0x1a')](_0x24d2('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x24d2('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x24d2('0x22')],'defaultValue':0x0,'comment':_0x24d2('0x23')},'dialMethod':{'type':Sequelize[_0x24d2('0x4')](_0x24d2('0x12'),_0x24d2('0x24'),_0x24d2('0x25'),_0x24d2('0x26'),_0x24d2('0x13')),'defaultValue':_0x24d2('0x24'),'comment':_0x24d2('0x27')},'dialLimitChannel':{'type':Sequelize[_0x24d2('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x24d2('0x28')},'dialLimitQueue':{'type':Sequelize[_0x24d2('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x24d2('0x29')](0x2)[_0x24d2('0x2a')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x24d2('0x2b')},'dialPredictiveOptimization':{'type':Sequelize[_0x24d2('0x4')](_0x24d2('0x2c'),_0x24d2('0x2d')),'defaultValue':_0x24d2('0x2d'),'comment':_0x24d2('0x2e')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x24d2('0x29')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x24d2('0x16')](0x3)[_0x24d2('0x2a')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x24d2('0x2f')},'dialOriginateCallerIdName':{'type':Sequelize[_0x24d2('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x24d2('0x16')](0x3)[_0x24d2('0x2a')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x24d2('0x2')],'defaultValue':'tTxX','comment':_0x24d2('0x30')},'dialQueueTimeout':{'type':Sequelize[_0x24d2('0x16')](0x3)[_0x24d2('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x24d2('0x31')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x24d2('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x24d2('0x16')](0x3)[_0x24d2('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x24d2('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x24d2('0x16')](0x5)[_0x24d2('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x24d2('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0x24d2('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x24d2('0x35')},'dialBusyRetryFrequency':{'type':Sequelize[_0x24d2('0x16')](0x5)[_0x24d2('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x24d2('0x36')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x24d2('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x24d2('0x37')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x24d2('0x16')](0x5)[_0x24d2('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x24d2('0x16')](0x3)[_0x24d2('0x2a')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x24d2('0x38')},'dialTimezone':{'type':Sequelize[_0x24d2('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x24d2('0x2')],'defaultValue':_0x24d2('0x39')},'dialPrefix':{'type':Sequelize[_0x24d2('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x24d2('0x4')](_0x24d2('0x3a'),'never',_0x24d2('0x3b')),'defaultValue':_0x24d2('0x3a')},'dialAMDActive':{'type':Sequelize[_0x24d2('0x22')],'defaultValue':0x0,'comment':_0x24d2('0x3c')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x24d2('0x3d')},'dialAMDGreeting':{'type':Sequelize[_0x24d2('0x16')](0x9)[_0x24d2('0x2a')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x24d2('0x3e')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x24d2('0x16')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x24d2('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x24d2('0x3f')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x24d2('0x2a')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x24d2('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x24d2('0x16')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x24d2('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x24d2('0x16')](0x9)[_0x24d2('0x2a')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x24d2('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x24d2('0x2a')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x24d2('0x43')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x24d2('0x16')](0x9)[_0x24d2('0x2a')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x24d2('0x16')](0x5)[_0x24d2('0x2a')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x24d2('0x44')},'dialRecallInQueue':{'type':Sequelize[_0x24d2('0x22')],'defaultValue':0x0,'comment':_0x24d2('0x45')},'dialOrderByScheduledAt':{'type':Sequelize[_0x24d2('0x4')]('DESC',_0x24d2('0x46')),'defaultValue':_0x24d2('0x47')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x24d2('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x24d2('0x22')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x24d2('0x16')](0x3)[_0x24d2('0x2a')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x24d2('0x48')},'dialCutDigit':{'type':Sequelize[_0x24d2('0x16')](0x3)[_0x24d2('0x2a')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x24d2('0x49')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x24d2('0x4a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x24d2('0x16')](0x5)[_0x24d2('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x24d2('0x4b')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x24d2('0x4c')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x24d2('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x24d2('0x16')](0x3)[_0x24d2('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x24d2('0x4d')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x24d2('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x24d2('0x4e')},'dialMachineMaxRetry':{'type':Sequelize[_0x24d2('0x16')](0x3)[_0x24d2('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x24d2('0x4f')},'dialMachineRetryFrequency':{'type':Sequelize[_0x24d2('0x16')](0x5)[_0x24d2('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x24d2('0x50')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x24d2('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x24d2('0x51')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x24d2('0x16')](0x5)[_0x24d2('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x24d2('0x52')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x24d2('0x16')],'allowNull':!![],'comment':_0x24d2('0x53')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x24d2('0x54'),'set':function(_0x3c3d12){if(!_0x3c3d12)this[_0x24d2('0x1a')](_0x24d2('0x55'),null);this[_0x24d2('0x1a')](_0x24d2('0x56'),_0x3c3d12);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x24d2('0x16')](0x3)[_0x24d2('0x2a')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x24d2('0x2a')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x24d2('0x22')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x24d2('0x2a')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x24d2('0x22')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index b8b53c7..e80a15c 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 _0x7fbe=['send','VoiceQueue','rawAttributes','fieldName','key','where','include','query','findAll','rows','catch','show','params','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','inbound','outbound','update','getHoppers','findOne','hasOwnProperty','nolimit','order','sort','VoiceQueueId','CmHopper','CmHopperHistory','pick','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','forEach','penalty','sequelize','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','interface','format','SIP/%s','voicePause','userVoiceQueue:save','removeTeams','ids','User','select','field','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','emit','online','isNil','isArray','getAgents','getMembers','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','cm_contacts','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.OrderBy+1','cm_contact_has_items','join','h.ContactId=ci.CmContactId','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','VoiceQueues','QueueCampaigns','filter','map','value','type','name','sendStatus','error'];(function(_0x376981,_0x4c338c){var _0x4ab265=function(_0x77760){while(--_0x77760){_0x376981['push'](_0x376981['shift']());}};_0x4ab265(++_0x4c338c);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x39ff5c,_0x3de001){_0x39ff5c=_0x39ff5c-0x0;var _0x1eba54=_0x7fbe[_0x39ff5c];return _0x1eba54;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xe7fb('0x0'));var _=require(_0xe7fb('0x1'));var squel=require(_0xe7fb('0x2'));var Redis=require(_0xe7fb('0x3'));var qs=require(_0xe7fb('0x4'));var logger=require(_0xe7fb('0x5'))(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var db=require(_0xe7fb('0x8'))['db'];config[_0xe7fb('0x9')]=_[_0xe7fb('0xa')](config[_0xe7fb('0x9')],{'host':_0xe7fb('0xb'),'port':0x18eb});var socket=require(_0xe7fb('0xc'))(new Redis(config['redis']));require(_0xe7fb('0xd'))[_0xe7fb('0xe')](socket);function respondWithStatusCode(_0x1d0741,_0x190a7a){_0x190a7a=_0x190a7a||0xcc;return function(_0x4ba197){if(_0x4ba197){return _0x1d0741['sendStatus'](_0x190a7a);}return _0x1d0741[_0xe7fb('0xf')](_0x190a7a)[_0xe7fb('0x10')]();};}function respondWithResult(_0x41a514,_0x348a73){_0x348a73=_0x348a73||0xc8;return function(_0x2a2223){if(_0x2a2223){return _0x41a514[_0xe7fb('0xf')](_0x348a73)[_0xe7fb('0x11')](_0x2a2223);}};}function respondWithFilteredResult(_0x3c07f3,_0x325035){return function(_0x2fe8ab){if(_0x2fe8ab){var _0x2437d4=typeof _0x325035[_0xe7fb('0x12')]===_0xe7fb('0x13')&&typeof _0x325035[_0xe7fb('0x14')]===_0xe7fb('0x13');var _0x598729=_0x2fe8ab[_0xe7fb('0x15')];var _0x2225e5=_0x2437d4?0x0:_0x325035['offset'];var _0x30015a=_0x2437d4?_0x2fe8ab[_0xe7fb('0x15')]:_0x325035['offset']+_0x325035[_0xe7fb('0x14')];var _0x559129;if(_0x30015a>=_0x598729){_0x30015a=_0x598729;_0x559129=0xc8;}else{_0x559129=0xce;}_0x3c07f3[_0xe7fb('0xf')](_0x559129);return _0x3c07f3[_0xe7fb('0x16')](_0xe7fb('0x17'),_0x2225e5+'-'+_0x30015a+'/'+_0x598729)[_0xe7fb('0x11')](_0x2fe8ab);}return null;};}function saveUpdates(_0x562262){return function(_0x892b0f){if(_0x892b0f){return _0x892b0f['update'](_0x562262)[_0xe7fb('0x18')](function(_0x546463){return _0x546463;});}return null;};}function removeEntity(_0x1e77fd){return function(_0x4708f7){if(_0x4708f7){return _0x4708f7[_0xe7fb('0x19')]()[_0xe7fb('0x18')](function(){var _0x5df1a1=_0x4708f7[_0xe7fb('0x1a')]({'plain':!![]});var _0x5d1c87=[{'name':_0xe7fb('0x1b'),'value':'inbound','ignore':![]},{'name':_0xe7fb('0x1c'),'value':'outbound','ignore':![]}];var _0xa5af01=_(_0x5d1c87)[_0xe7fb('0x1d')]('ignore')[_0xe7fb('0x1e')](_0xe7fb('0x1f'))[_0xe7fb('0x1f')]();if(_['includes'](_0xa5af01,_0x5df1a1[_0xe7fb('0x20')])){return;}var _0x469ead=_['find'](_0x5d1c87,['value',_0x5df1a1['type']])[_0xe7fb('0x21')];return db['UserProfileResource']['destroy']({'where':{'type':_0x469ead,'resourceId':_0x5df1a1['id']}})[_0xe7fb('0x18')](function(){return _0x4708f7;});})[_0xe7fb('0x18')](function(){_0x1e77fd[_0xe7fb('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6c930){return function(_0x2b69c4){if(!_0x2b69c4){_0x6c930[_0xe7fb('0x22')](0x194);}return _0x2b69c4;};}function handleError(_0x1ceed8,_0x392d75){_0x392d75=_0x392d75||0x1f4;return function(_0x16237a){logger[_0xe7fb('0x23')](_0x16237a['stack']);if(_0x16237a['name']){delete _0x16237a[_0xe7fb('0x21')];}_0x1ceed8[_0xe7fb('0xf')](_0x392d75)[_0xe7fb('0x24')](_0x16237a);};}exports['index']=function(_0xb1f2f4,_0x251807){var _0xd3fffe={};var _0x5f265f={'count':0x0,'rows':[]};var _0x219554=_[_0xe7fb('0x1e')](db[_0xe7fb('0x25')][_0xe7fb('0x26')],function(_0x4ce993){return{'name':_0x4ce993[_0xe7fb('0x27')],'type':_0x4ce993[_0xe7fb('0x20')][_0xe7fb('0x28')]};});_0xd3fffe=qs['getOptions'](_0x219554,_0xb1f2f4);var _0x517d70={'where':_0xd3fffe[_0xe7fb('0x29')]};return db['VoiceQueue'][_0xe7fb('0x15')](_0x517d70)[_0xe7fb('0x18')](function(_0xe49053){_0x5f265f[_0xe7fb('0x15')]=_0xe49053;_0xd3fffe['include']=qs[_0xe7fb('0x2a')](_0xb1f2f4[_0xe7fb('0x2b')]);return db[_0xe7fb('0x25')][_0xe7fb('0x2c')](_0xd3fffe);})[_0xe7fb('0x18')](function(_0x480819){_0x5f265f[_0xe7fb('0x2d')]=_0x480819;return _0x5f265f;})[_0xe7fb('0x18')](respondWithFilteredResult(_0x251807,_0xd3fffe))[_0xe7fb('0x2e')](handleError(_0x251807,null));};exports[_0xe7fb('0x2f')]=function(_0x46f430,_0x25e925){var _0x1bc72d={'raw':![],'where':{'id':_0x46f430[_0xe7fb('0x30')]['id']}},_0x147eb1={};_0x147eb1['model']=_[_0xe7fb('0x31')](db[_0xe7fb('0x25')][_0xe7fb('0x26')]);_0x147eb1['query']=_[_0xe7fb('0x31')](_0x46f430[_0xe7fb('0x2b')]);_0x147eb1[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x147eb1[_0xe7fb('0x34')],_0x147eb1[_0xe7fb('0x2b')]);_0x1bc72d[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x147eb1[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x46f430[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x1bc72d[_0xe7fb('0x35')]=_0x1bc72d[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x1bc72d[_0xe7fb('0x35')]:_0x147eb1[_0xe7fb('0x34')];if(_0x46f430[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x1bc72d['include']=[{'all':!![]}];}_0x1bc72d=_[_0xe7fb('0x39')]({},_0x1bc72d,_0x46f430[_0xe7fb('0x3a')]);return db[_0xe7fb('0x25')][_0xe7fb('0x3b')](_0x1bc72d)['then'](handleEntityNotFound(_0x25e925,null))[_0xe7fb('0x18')](respondWithResult(_0x25e925,null))[_0xe7fb('0x2e')](handleError(_0x25e925,null));};exports[_0xe7fb('0x3c')]=function(_0x413a13,_0x49fe9d){return db[_0xe7fb('0x25')][_0xe7fb('0x3c')](_0x413a13[_0xe7fb('0x3d')],{})[_0xe7fb('0x18')](function(_0x468d16){var _0xb729fc=_0x413a13['user'][_0xe7fb('0x1a')]({'plain':!![]});if(!_0xb729fc)throw new Error(_0xe7fb('0x3e'));if(_0xb729fc[_0xe7fb('0x3f')]==='user'){var _0x36a341=_0x468d16[_0xe7fb('0x1a')]({'plain':!![]});var _0x5d42ac=[{'name':'VoiceQueues','value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x900d67=_[_0xe7fb('0x3b')](_0x5d42ac,[_0xe7fb('0x1f'),_0x36a341['type']])[_0xe7fb('0x21')];return db['UserProfileSection'][_0xe7fb('0x3b')]({'where':{'name':_0x900d67,'userProfileId':_0xb729fc[_0xe7fb('0x40')]},'raw':!![]})['then'](function(_0x108a16){if(_0x108a16&&_0x108a16[_0xe7fb('0x41')]===0x0){return db[_0xe7fb('0x42')][_0xe7fb('0x3c')]({'name':_0x36a341['name'],'resourceId':_0x36a341['id'],'type':_0x108a16[_0xe7fb('0x21')],'sectionId':_0x108a16['id']},{})[_0xe7fb('0x18')](function(){return _0x468d16;});}else{return _0x468d16;}})[_0xe7fb('0x2e')](function(_0x56a84f){logger[_0xe7fb('0x23')](_0xe7fb('0x43'),_0x56a84f);throw _0x56a84f;});}return _0x468d16;})[_0xe7fb('0x18')](respondWithResult(_0x49fe9d,0xc9))[_0xe7fb('0x2e')](handleError(_0x49fe9d,null));};exports[_0xe7fb('0x44')]=function(_0x5a1ce1,_0x2eb999){var _0x4df4aa={'where':{'id':_0x5a1ce1[_0xe7fb('0x30')]['id']}},_0x2c72dd={};_0x2c72dd[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x25')]['rawAttributes']);_0x4df4aa[_0xe7fb('0x35')]=_['intersection'](_0x2c72dd['model'],qs[_0xe7fb('0x36')](_0x5a1ce1[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x4df4aa['attributes']=_0x4df4aa[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x4df4aa['attributes']:_0x2c72dd['model'];if(_0x5a1ce1[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x4df4aa[_0xe7fb('0x2a')]=[{'all':!![]}];}_0x4df4aa=_[_0xe7fb('0x39')]({},_0x4df4aa,_0x5a1ce1[_0xe7fb('0x3a')]);return db[_0xe7fb('0x25')][_0xe7fb('0x3b')](_0x4df4aa)[_0xe7fb('0x18')](handleEntityNotFound(_0x2eb999,null))['then'](function(_0x925a5e){if(_0x925a5e){var _0x5cc28f=_0x925a5e[_0xe7fb('0x1a')]({'plain':!![]});_0x5cc28f=qs[_0xe7fb('0x45')](_0x5cc28f,['id','createdAt',_0xe7fb('0x46')]);_0x5a1ce1['body']=_[_0xe7fb('0x45')](_0x5a1ce1['body'],['id',_0xe7fb('0x47'),'updatedAt']);return db[_0xe7fb('0x25')]['create'](_[_0xe7fb('0x39')](_0x5cc28f,_0x5a1ce1[_0xe7fb('0x3d')]),{'include':_0x5a1ce1[_0xe7fb('0x2b')][_0xe7fb('0x38')]?[{'all':!![]}]:undefined})[_0xe7fb('0x18')](function(_0x2f959d){var _0x2f4760=_0x5a1ce1['user']['get']({'plain':!![]});if(!_0x2f4760)throw new Error(_0xe7fb('0x3e'));if(_0x2f4760['role']==='user'){var _0x4c3eb7=_0x2f959d['get']({'plain':!![]});var _0x539252=[{'name':_0xe7fb('0x1b'),'value':_0xe7fb('0x48')},{'name':_0xe7fb('0x1c'),'value':_0xe7fb('0x49')}];var _0x59c92d=_[_0xe7fb('0x3b')](_0x539252,[_0xe7fb('0x1f'),_0x4c3eb7[_0xe7fb('0x20')]])['name'];return db['UserProfileSection'][_0xe7fb('0x3b')]({'where':{'name':_0x59c92d,'userProfileId':_0x2f4760[_0xe7fb('0x40')]},'raw':!![]})[_0xe7fb('0x18')](function(_0x4f4ba3){if(_0x4f4ba3&&_0x4f4ba3[_0xe7fb('0x41')]===0x0){return db[_0xe7fb('0x42')][_0xe7fb('0x3c')]({'name':_0x4c3eb7[_0xe7fb('0x21')],'resourceId':_0x4c3eb7['id'],'type':_0x4f4ba3['name'],'sectionId':_0x4f4ba3['id']},{})['then'](function(){return _0x2f959d;});}else{return _0x2f959d;}})[_0xe7fb('0x2e')](function(_0x3104c2){logger[_0xe7fb('0x23')](_0xe7fb('0x43'),_0x3104c2);throw _0x3104c2;});}return _0x2f959d;});}})[_0xe7fb('0x18')](respondWithResult(_0x2eb999,0xc9))['catch'](handleError(_0x2eb999,null));};exports[_0xe7fb('0x4a')]=function(_0x349a2a,_0x23755b){if(_0x349a2a['body']['id']){delete _0x349a2a['body']['id'];}return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x349a2a[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x23755b,null))[_0xe7fb('0x18')](saveUpdates(_0x349a2a[_0xe7fb('0x3d')],null))['then'](respondWithResult(_0x23755b,null))[_0xe7fb('0x2e')](handleError(_0x23755b,null));};exports[_0xe7fb('0x19')]=function(_0x2cd4e5,_0x1aef59){return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x2cd4e5['params']['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x1aef59,null))['then'](removeEntity(_0x1aef59,null))[_0xe7fb('0x2e')](handleError(_0x1aef59,null));};exports[_0xe7fb('0x4b')]=function(_0x116c7e,_0x1b24fd){var _0x5925e6={'raw':![],'where':{}};var _0x47ac92={};var _0x2789a4={'count':0x0,'rows':[]};return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x116c7e[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x1b24fd,null))['then'](function(_0x4096d4){if(_0x4096d4){_0x47ac92['model']=_[_0xe7fb('0x31')](db['CmHopper']['rawAttributes']);_0x47ac92[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x116c7e[_0xe7fb('0x2b')]);_0x47ac92['filters']=_[_0xe7fb('0x33')](_0x47ac92[_0xe7fb('0x34')],_0x47ac92[_0xe7fb('0x2b')]);_0x5925e6[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x47ac92['model'],qs[_0xe7fb('0x36')](_0x116c7e[_0xe7fb('0x2b')]['fields']));_0x5925e6[_0xe7fb('0x35')]=_0x5925e6[_0xe7fb('0x35')]['length']?_0x5925e6[_0xe7fb('0x35')]:_0x47ac92['model'];if(!_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0x5925e6['limit']=qs[_0xe7fb('0x14')](_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x5925e6[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}_0x5925e6[_0xe7fb('0x4f')]=qs['sort'](_0x116c7e['query'][_0xe7fb('0x50')]);_0x5925e6[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_['pick'](_0x116c7e['query'],_0x47ac92[_0xe7fb('0x32')]));_0x5925e6[_0xe7fb('0x29')][_0xe7fb('0x51')]=_0x4096d4['id'];if(_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x5925e6[_0xe7fb('0x29')]=_[_0xe7fb('0x39')](_0x5925e6[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x5925e6[_0xe7fb('0x35')],function(_0x1ff5e7){var _0xf423ab={};_0xf423ab[_0x1ff5e7]={'$like':'%'+_0x116c7e[_0xe7fb('0x2b')]['filter']+'%'};return _0xf423ab;})});}_0x5925e6=_['merge']({},_0x5925e6,_0x116c7e[_0xe7fb('0x3a')]);return db[_0xe7fb('0x52')][_0xe7fb('0x15')]({'where':_0x5925e6[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x562493){_0x2789a4[_0xe7fb('0x15')]=_0x562493;if(_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x5925e6[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x52')][_0xe7fb('0x2c')](_0x5925e6);})[_0xe7fb('0x18')](function(_0x1e6256){_0x2789a4[_0xe7fb('0x2d')]=_0x1e6256;return _0x2789a4;});}})['then'](respondWithFilteredResult(_0x1b24fd,_0x5925e6))[_0xe7fb('0x2e')](handleError(_0x1b24fd,null));};exports['getHopperHistories']=function(_0x279663,_0x2f13f2){var _0x2a2079={'raw':!![],'where':{}};var _0x31c159={};var _0x318d06={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe7fb('0x4c')]({'where':{'id':_0x279663[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x2f13f2,null))[_0xe7fb('0x18')](function(_0x15d881){if(_0x15d881){_0x31c159[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x53')][_0xe7fb('0x26')]);_0x31c159[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x279663[_0xe7fb('0x2b')]);_0x31c159[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x31c159['model'],_0x31c159['query']);_0x2a2079['attributes']=_[_0xe7fb('0x33')](_0x31c159[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x279663[_0xe7fb('0x2b')]['fields']));_0x2a2079[_0xe7fb('0x35')]=_0x2a2079[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x2a2079[_0xe7fb('0x35')]:_0x31c159['model'];if(!_0x279663[_0xe7fb('0x2b')]['hasOwnProperty'](_0xe7fb('0x4e'))){_0x2a2079[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x279663[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x2a2079['offset']=qs[_0xe7fb('0x12')](_0x279663['query'][_0xe7fb('0x12')]);}_0x2a2079['order']=qs[_0xe7fb('0x50')](_0x279663[_0xe7fb('0x2b')]['sort']);_0x2a2079[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x279663[_0xe7fb('0x2b')],_0x31c159['filters']));_0x2a2079[_0xe7fb('0x29')][_0xe7fb('0x51')]=_0x15d881['id'];if(_0x279663[_0xe7fb('0x2b')]['filter']){_0x2a2079[_0xe7fb('0x29')]=_['merge'](_0x2a2079['where'],{'$or':_['map'](_0x2a2079[_0xe7fb('0x35')],function(_0x27019a){var _0x4a8a65={};_0x4a8a65[_0x27019a]={'$like':'%'+_0x279663[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x4a8a65;})});}_0x2a2079=_[_0xe7fb('0x39')]({},_0x2a2079,_0x279663[_0xe7fb('0x3a')]);return db[_0xe7fb('0x53')][_0xe7fb('0x15')]({'where':_0x2a2079[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x42190e){_0x318d06[_0xe7fb('0x15')]=_0x42190e;if(_0x279663[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x2a2079[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x53')][_0xe7fb('0x2c')](_0x2a2079);})[_0xe7fb('0x18')](function(_0x3c5bd9){_0x318d06[_0xe7fb('0x2d')]=_0x3c5bd9;return _0x318d06;});}})[_0xe7fb('0x18')](respondWithFilteredResult(_0x2f13f2,_0x2a2079))[_0xe7fb('0x2e')](handleError(_0x2f13f2,null));};exports['getHopperFinals']=function(_0x47568c,_0x185ac0){var _0xc3958f={'raw':!![],'where':{}};var _0x1b8fdb={};var _0x19fe06={'count':0x0,'rows':[]};return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x47568c['params']['id']}})['then'](handleEntityNotFound(_0x185ac0,null))[_0xe7fb('0x18')](function(_0x4e1865){if(_0x4e1865){_0x1b8fdb[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db['CmHopperFinal'][_0xe7fb('0x26')]);_0x1b8fdb[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x47568c[_0xe7fb('0x2b')]);_0x1b8fdb[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x1b8fdb['model'],_0x1b8fdb[_0xe7fb('0x2b')]);_0xc3958f[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x1b8fdb[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x47568c[_0xe7fb('0x2b')]['fields']));_0xc3958f['attributes']=_0xc3958f['attributes'][_0xe7fb('0x37')]?_0xc3958f[_0xe7fb('0x35')]:_0x1b8fdb[_0xe7fb('0x34')];if(!_0x47568c['query'][_0xe7fb('0x4d')]('nolimit')){_0xc3958f[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0xc3958f['offset']=qs[_0xe7fb('0x12')](_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}_0xc3958f[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0xc3958f[_0xe7fb('0x29')]=qs['filters'](_['pick'](_0x47568c[_0xe7fb('0x2b')],_0x1b8fdb['filters']));_0xc3958f[_0xe7fb('0x29')][_0xe7fb('0x51')]=_0x4e1865['id'];if(_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0xc3958f['where']=_['merge'](_0xc3958f[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0xc3958f['attributes'],function(_0x21cb12){var _0x431d21={};_0x431d21[_0x21cb12]={'$like':'%'+_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x431d21;})});}_0xc3958f=_[_0xe7fb('0x39')]({},_0xc3958f,_0x47568c[_0xe7fb('0x3a')]);return db['CmHopperFinal'][_0xe7fb('0x15')]({'where':_0xc3958f[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x2607b9){_0x19fe06[_0xe7fb('0x15')]=_0x2607b9;if(_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0xc3958f[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x55')][_0xe7fb('0x2c')](_0xc3958f);})[_0xe7fb('0x18')](function(_0x3b1a90){_0x19fe06[_0xe7fb('0x2d')]=_0x3b1a90;return _0x19fe06;});}})[_0xe7fb('0x18')](respondWithFilteredResult(_0x185ac0,_0xc3958f))[_0xe7fb('0x2e')](handleError(_0x185ac0,null));};exports[_0xe7fb('0x56')]=function(_0x27c100,_0x19e86f){var _0x4b4cf6={'raw':!![],'where':{}};var _0x173d85={};var _0xa1368a={'count':0x0,'rows':[]};return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x27c100['params']['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x19e86f,null))[_0xe7fb('0x18')](function(_0x4ca09c){if(_0x4ca09c){_0x173d85[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x57')]['rawAttributes']);_0x173d85[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x27c100['query']);_0x173d85['filters']=_[_0xe7fb('0x33')](_0x173d85[_0xe7fb('0x34')],_0x173d85[_0xe7fb('0x2b')]);_0x4b4cf6[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x173d85[_0xe7fb('0x34')],qs['fields'](_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x4b4cf6[_0xe7fb('0x35')]=_0x4b4cf6['attributes'][_0xe7fb('0x37')]?_0x4b4cf6[_0xe7fb('0x35')]:_0x173d85[_0xe7fb('0x34')];if(!_0x27c100[_0xe7fb('0x2b')]['hasOwnProperty'](_0xe7fb('0x4e'))){_0x4b4cf6[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x27c100['query'][_0xe7fb('0x14')]);_0x4b4cf6[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x27c100[_0xe7fb('0x2b')]['offset']);}_0x4b4cf6[_0xe7fb('0x4f')]=qs['sort'](_0x27c100[_0xe7fb('0x2b')]['sort']);_0x4b4cf6[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_['pick'](_0x27c100['query'],_0x173d85[_0xe7fb('0x32')]));_0x4b4cf6['where'][_0xe7fb('0x51')]=_0x4ca09c['id'];if(_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x4b4cf6[_0xe7fb('0x29')]=_['merge'](_0x4b4cf6[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x4b4cf6[_0xe7fb('0x35')],function(_0x27a822){var _0x5505e5={};_0x5505e5[_0x27a822]={'$like':'%'+_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x5505e5;})});}_0x4b4cf6=_[_0xe7fb('0x39')]({},_0x4b4cf6,_0x27c100[_0xe7fb('0x3a')]);return db[_0xe7fb('0x57')]['count']({'where':_0x4b4cf6[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x54233){_0xa1368a[_0xe7fb('0x15')]=_0x54233;if(_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x4b4cf6[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x57')][_0xe7fb('0x2c')](_0x4b4cf6);})['then'](function(_0x795e32){_0xa1368a[_0xe7fb('0x2d')]=_0x795e32;return _0xa1368a;});}})[_0xe7fb('0x18')](respondWithFilteredResult(_0x19e86f,_0x4b4cf6))[_0xe7fb('0x2e')](handleError(_0x19e86f,null));};exports[_0xe7fb('0x58')]=function(_0x16f2b1,_0x3a8154){var _0x51335c={};var _0x4f4772={};var _0x4ef7b4;var _0x1bcee7;return db['VoiceQueue'][_0xe7fb('0x4c')]({'where':{'id':_0x16f2b1['params']['id']}})['then'](handleEntityNotFound(_0x3a8154,null))[_0xe7fb('0x18')](function(_0x5bd869){if(_0x5bd869){_0x4ef7b4=_0x5bd869;_0x4f4772[_0xe7fb('0x34')]=_['keys'](db[_0xe7fb('0x59')][_0xe7fb('0x26')]);_0x4f4772[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x16f2b1[_0xe7fb('0x2b')]);_0x4f4772[_0xe7fb('0x32')]=_['intersection'](_0x4f4772[_0xe7fb('0x34')],_0x4f4772[_0xe7fb('0x2b')]);_0x51335c[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x4f4772[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x16f2b1[_0xe7fb('0x2b')]['fields']));_0x51335c[_0xe7fb('0x35')]=_0x51335c[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x51335c[_0xe7fb('0x35')]:_0x4f4772['model'];_0x51335c[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0x51335c[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x16f2b1['query'],_0x4f4772['filters']));if(_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x51335c['where']=_[_0xe7fb('0x39')](_0x51335c['where'],{'$or':_[_0xe7fb('0x1e')](_0x51335c[_0xe7fb('0x35')],function(_0x220d72){var _0x5ea91d={};_0x5ea91d[_0x220d72]={'$like':'%'+_0x16f2b1['query'][_0xe7fb('0x1d')]+'%'};return _0x5ea91d;})});}_0x51335c=_['merge']({},_0x51335c,_0x16f2b1['options']);return _0x4ef7b4[_0xe7fb('0x58')](_0x51335c);}})[_0xe7fb('0x18')](function(_0x3b073e){if(_0x3b073e){_0x1bcee7=_0x3b073e[_0xe7fb('0x37')];if(!_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0x51335c[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x51335c[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x4ef7b4[_0xe7fb('0x58')](_0x51335c);}})[_0xe7fb('0x18')](function(_0x249d6f){if(_0x249d6f){return _0x249d6f?{'count':_0x1bcee7,'rows':_0x249d6f}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x3a8154,null))['catch'](handleError(_0x3a8154,null));};exports[_0xe7fb('0x5a')]=function(_0x19ebe2,_0x3406ed){var _0x1631cc=_0x19ebe2['body'][_0xe7fb('0x5b')];var _0x21ee89=_[_0xe7fb('0x1e')](_0x1631cc,'id');return db[_0xe7fb('0x59')][_0xe7fb('0x2c')]({'where':{'id':_0x21ee89},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xe7fb('0x21'),'online','voicePause','interface'],'raw':!![]}]})[_0xe7fb('0x18')](function(_0x5a97c8){if(_0x5a97c8){var _0x503ae2=_['flatMap'](_0x5a97c8,function(_0x2ccf71){var _0x35be16=_0x2ccf71[_0xe7fb('0x1a')]({'plain':!![]});_0x35be16[_0xe7fb('0x5c')][_0xe7fb('0x5d')](function(_0x1db971){_0x1db971['penalty']=_['find'](_0x1631cc,{'id':_0x35be16['id']})[_0xe7fb('0x5e')];});return _0x35be16['Agents'];});return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x19ebe2[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(_0x3891ed){return db[_0xe7fb('0x5f')]['transaction'](function(_0x4aa499){return _0x3891ed[_0xe7fb('0x5a')](_0x21ee89,{'transaction':_0x4aa499})[_0xe7fb('0x18')](function(){return BPromise[_0xe7fb('0x60')](_0x1631cc,function(_0x7a7a6b){return db[_0xe7fb('0x61')][_0xe7fb('0x62')]({'TeamId':_0x7a7a6b['id'],'VoiceQueueId':_0x19ebe2['params']['id'],'penalty':_0x7a7a6b[_0xe7fb('0x5e')]},{'transaction':_0x4aa499});});})[_0xe7fb('0x18')](function(){return BPromise[_0xe7fb('0x60')](_0x503ae2,function(_0x33d638){return db[_0xe7fb('0x63')]['findOrCreate']({'where':{'UserId':_0x33d638['id'],'VoiceQueueId':_0x19ebe2[_0xe7fb('0x30')]['id']},'defaults':{'penalty':_0x33d638[_0xe7fb('0x5e')]},'transaction':_0x4aa499});});})[_0xe7fb('0x18')](function(){return BPromise['each'](_['filter'](_0x503ae2,{'online':!![]}),function(_0x5d30ef){return db[_0xe7fb('0x64')]['upsert']({'membername':_0x5d30ef['name'],'UserId':_0x5d30ef['id'],'queue_name':_0x3891ed[_0xe7fb('0x21')],'VoiceQueueId':_0x3891ed['id'],'interface':_['isNil'](_0x5d30ef[_0xe7fb('0x65')])?util[_0xe7fb('0x66')](_0xe7fb('0x67'),_0x5d30ef[_0xe7fb('0x21')]):_0x5d30ef[_0xe7fb('0x65')],'paused':_0x5d30ef[_0xe7fb('0x68')]||![],'penalty':_0x5d30ef[_0xe7fb('0x5e')]},{'transaction':_0x4aa499});});})['then'](function(){_0x503ae2[_0xe7fb('0x5d')](function(_0x16e9d4){socket['emit'](_0xe7fb('0x69'),{'UserId':_0x16e9d4['id'],'VoiceQueueId':_0x3891ed['id']});});});});});}})[_0xe7fb('0x18')](respondWithStatusCode(_0x3406ed,null))[_0xe7fb('0x2e')](handleError(_0x3406ed,null));};exports[_0xe7fb('0x6a')]=function(_0x366acb,_0x4d2c92){return db['Team'][_0xe7fb('0x2c')]({'where':{'id':_0x366acb[_0xe7fb('0x2b')][_0xe7fb('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xe7fb('0x6c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe7fb('0x18')](handleEntityNotFound(_0x4d2c92,null))[_0xe7fb('0x18')](function(_0x2e276c){var _0x4efcdc=_[_0xe7fb('0x1e')](_0x2e276c,'id');var _0x146fc9=[];var _0x470718=[];var _0x55048c=squel[_0xe7fb('0x6d')]();_0x55048c[_0xe7fb('0x6e')]('tq.TeamId')[_0xe7fb('0x6f')](_0xe7fb('0x70'),'tq')['join'](_0xe7fb('0x71'),'ut',_0xe7fb('0x72'))[_0xe7fb('0x29')](_0xe7fb('0x73'),_0x366acb[_0xe7fb('0x30')]['id']);for(var _0x5d9b58=0x0;_0x5d9b58<_0x2e276c['length'];_0x5d9b58+=0x1){let _0x5986f1=_0x2e276c[_0x5d9b58];for(var _0x23ec12=0x0;_0x23ec12<_0x5986f1[_0xe7fb('0x5c')][_0xe7fb('0x37')];_0x23ec12+=0x1){let _0x36be03=_0x5986f1['Agents'][_0x23ec12];var _0x29de1e=_0x55048c[_0xe7fb('0x44')]();_0x29de1e['where']('ut.UserId\x20=\x20?',_0x36be03['id']);_0x470718[_0xe7fb('0x74')](db[_0xe7fb('0x5f')][_0xe7fb('0x2b')](_0x29de1e[_0xe7fb('0x75')](),{'type':db[_0xe7fb('0x5f')]['QueryTypes'][_0xe7fb('0x76')]})[_0xe7fb('0x18')](function(_0xe52155){if(_0xe52155['length']===0x1){return _0x36be03['id'];}else{var _0x20b1fc=_[_0xe7fb('0x77')](_['map'](_0xe52155,_0xe7fb('0x78')),function(_0x6ec6b6){return _[_0xe7fb('0x79')](_0x4efcdc,_0x6ec6b6);});if(_0x20b1fc){return _0x36be03['id'];}}}));}}return BPromise[_0xe7fb('0x7a')](_0x470718)['then'](function(_0x4ed327){_0x146fc9=_(_0x146fc9)[_0xe7fb('0x7b')](_0x4ed327)[_0xe7fb('0x7c')]()[_0xe7fb('0x1f')]();return db['VoiceQueue'][_0xe7fb('0x3b')]({'where':{'id':_0x366acb[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(_0x49fb4b){return db[_0xe7fb('0x5f')][_0xe7fb('0x7d')](function(_0x362fe1){return _0x49fb4b['removeTeams'](_0x366acb[_0xe7fb('0x2b')][_0xe7fb('0x6b')],{'transaction':_0x362fe1})[_0xe7fb('0x18')](function(){if(!_[_0xe7fb('0x7e')](_0x146fc9)){return _0x49fb4b[_0xe7fb('0x7f')](_0x146fc9,{'transaction':_0x362fe1})[_0xe7fb('0x18')](function(){return db[_0xe7fb('0x64')][_0xe7fb('0x19')]({'where':{'VoiceQueueId':_0x366acb['params']['id'],'UserId':_0x146fc9},'transaction':_0x362fe1});});}})[_0xe7fb('0x18')](function(){_0x146fc9[_0xe7fb('0x5d')](function(_0x5dadac){socket['emit'](_0xe7fb('0x80'),{'UserId':_0x5dadac,'VoiceQueueId':_0x49fb4b['id']});});});});});});})[_0xe7fb('0x18')](respondWithStatusCode(_0x4d2c92,null))[_0xe7fb('0x2e')](handleError(_0x4d2c92,null));};exports[_0xe7fb('0x81')]=function(_0x4b58de,_0x4386ea){var _0x41c771,_0x489c9d;return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x4b58de[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x4386ea,null))[_0xe7fb('0x18')](function(_0x39fef6){if(_0x39fef6){_0x489c9d=_0x39fef6;return _0x39fef6[_0xe7fb('0x81')](_0x4b58de['body'][_0xe7fb('0x6b')],_['omit'](_0x4b58de[_0xe7fb('0x3d')],['ids','id'])||{})['spread'](function(_0x260067){for(var _0xed4af4=0x0;_0xed4af4<_0x4b58de[_0xe7fb('0x3d')][_0xe7fb('0x6b')][_0xe7fb('0x37')];_0xed4af4+=0x1){socket[_0xe7fb('0x82')](_0xe7fb('0x69'),{'UserId':Number(_0x4b58de['body'][_0xe7fb('0x6b')][_0xed4af4]),'VoiceQueueId':Number(_0x4b58de[_0xe7fb('0x30')]['id'])});}return _0x260067;});}})[_0xe7fb('0x18')](function(_0x19a7ec){_0x41c771=_0x19a7ec||[];if(_0x489c9d){return db[_0xe7fb('0x6c')][_0xe7fb('0x2c')]({'where':{'id':_0x4b58de[_0xe7fb('0x3d')]['ids']},'attributes':['id',_0xe7fb('0x21'),_0xe7fb('0x83'),_0xe7fb('0x68'),'interface'],'raw':!![]});}})[_0xe7fb('0x18')](function(_0x52c758){if(!_['isEmpty'](_0x52c758)){var _0x4930c6=[];for(var _0x1a3d44=0x0;_0x1a3d44<_0x52c758[_0xe7fb('0x37')];_0x1a3d44++){if(_0x52c758[_0x1a3d44]['online']){_0x4930c6[_0xe7fb('0x74')](db[_0xe7fb('0x64')]['upsert']({'membername':_0x52c758[_0x1a3d44]['name'],'UserId':_0x52c758[_0x1a3d44]['id'],'queue_name':_0x489c9d[_0xe7fb('0x21')],'VoiceQueueId':_0x489c9d['id'],'interface':_[_0xe7fb('0x84')](_0x52c758[_0x1a3d44][_0xe7fb('0x65')])?util['format'](_0xe7fb('0x67'),_0x52c758[_0x1a3d44][_0xe7fb('0x21')]):_0x52c758[_0x1a3d44]['interface'],'paused':_0x52c758[_0x1a3d44]['voicePause']||![],'penalty':_0x4b58de[_0xe7fb('0x3d')]['penalty']||0x0}));}}return BPromise['all'](_0x4930c6);}})['then'](function(){return _0x41c771;})[_0xe7fb('0x18')](respondWithResult(_0x4386ea,null))[_0xe7fb('0x2e')](handleError(_0x4386ea,null));};exports['removeAgents']=function(_0x35b5ad,_0x55c935){return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x35b5ad[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x55c935,null))[_0xe7fb('0x18')](function(_0x4736bf){if(_0x4736bf){return _0x4736bf[_0xe7fb('0x7f')](_0x35b5ad[_0xe7fb('0x2b')][_0xe7fb('0x6b')])[_0xe7fb('0x18')](function(){if(_[_0xe7fb('0x85')](_0x35b5ad[_0xe7fb('0x2b')][_0xe7fb('0x6b')])){for(var _0x5744a8=0x0;_0x5744a8<_0x35b5ad[_0xe7fb('0x2b')][_0xe7fb('0x6b')]['length'];_0x5744a8+=0x1){socket['emit'](_0xe7fb('0x80'),{'UserId':Number(_0x35b5ad['query'][_0xe7fb('0x6b')][_0x5744a8]),'VoiceQueueId':Number(_0x35b5ad[_0xe7fb('0x30')]['id'])});}}else{socket[_0xe7fb('0x82')](_0xe7fb('0x80'),{'UserId':Number(_0x35b5ad[_0xe7fb('0x2b')]['ids']),'VoiceQueueId':Number(_0x35b5ad['params']['id'])});}});}})[_0xe7fb('0x18')](function(_0x27b153){return db[_0xe7fb('0x64')][_0xe7fb('0x19')]({'where':{'VoiceQueueId':_0x35b5ad[_0xe7fb('0x30')]['id'],'UserId':_0x35b5ad['query'][_0xe7fb('0x6b')]}})['then'](function(){return _0x27b153;});})[_0xe7fb('0x18')](respondWithStatusCode(_0x55c935,null))[_0xe7fb('0x2e')](handleError(_0x55c935,null));};exports['getAgents']=function(_0x5d0f05,_0x519e35){var _0x16ae95={};var _0xb1a3fa={};var _0x59e676;var _0x577895;return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x5d0f05['params']['id']}})['then'](handleEntityNotFound(_0x519e35,null))[_0xe7fb('0x18')](function(_0xe1613c){if(_0xe1613c){_0x59e676=_0xe1613c;_0xb1a3fa[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db['User'][_0xe7fb('0x26')]);_0xb1a3fa[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x5d0f05[_0xe7fb('0x2b')]);_0xb1a3fa[_0xe7fb('0x32')]=_['intersection'](_0xb1a3fa['model'],_0xb1a3fa[_0xe7fb('0x2b')]);_0x16ae95[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0xb1a3fa[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x5d0f05['query'][_0xe7fb('0x36')]));_0x16ae95['attributes']=_0x16ae95['attributes'][_0xe7fb('0x37')]?_0x16ae95[_0xe7fb('0x35')]:_0xb1a3fa[_0xe7fb('0x34')];_0x16ae95[_0xe7fb('0x4f')]=qs['sort'](_0x5d0f05[_0xe7fb('0x2b')]['sort']);_0x16ae95['where']=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x5d0f05[_0xe7fb('0x2b')],_0xb1a3fa[_0xe7fb('0x32')]));if(_0x5d0f05[_0xe7fb('0x2b')]['filter']){_0x16ae95['where']=_[_0xe7fb('0x39')](_0x16ae95['where'],{'$or':_['map'](_0x16ae95[_0xe7fb('0x35')],function(_0x5763dd){var _0x4cab2f={};_0x4cab2f[_0x5763dd]={'$like':'%'+_0x5d0f05[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x4cab2f;})});}_0x16ae95=_[_0xe7fb('0x39')]({},_0x16ae95,_0x5d0f05[_0xe7fb('0x3a')]);return _0x59e676[_0xe7fb('0x86')](_0x16ae95);}})['then'](function(_0xcf6d2){if(_0xcf6d2){_0x577895=_0xcf6d2['length'];if(!_0x5d0f05['query'][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0x16ae95[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x5d0f05[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x16ae95[_0xe7fb('0x12')]=qs['offset'](_0x5d0f05['query'][_0xe7fb('0x12')]);}return _0x59e676['getAgents'](_0x16ae95);}})[_0xe7fb('0x18')](function(_0x51ff1e){if(_0x51ff1e){return _0x51ff1e?{'count':_0x577895,'rows':_0x51ff1e}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x519e35,null))['catch'](handleError(_0x519e35,null));};exports[_0xe7fb('0x87')]=function(_0x4407ee,_0x56869b){var _0x2139e3={};var _0x2e0e13={};var _0x23e1db;var _0x2a2fa6;return db['VoiceQueue'][_0xe7fb('0x4c')]({'where':{'id':_0x4407ee[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x56869b,null))[_0xe7fb('0x18')](function(_0x454ef0){if(_0x454ef0){_0x23e1db=_0x454ef0;_0x2e0e13['model']=_[_0xe7fb('0x31')](db[_0xe7fb('0x64')][_0xe7fb('0x26')]);_0x2e0e13[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x4407ee[_0xe7fb('0x2b')]);_0x2e0e13[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x2e0e13[_0xe7fb('0x34')],_0x2e0e13[_0xe7fb('0x2b')]);_0x2139e3[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x2e0e13[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x4407ee[_0xe7fb('0x2b')]['fields']));_0x2139e3['attributes']=_0x2139e3[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x2139e3[_0xe7fb('0x35')]:_0x2e0e13[_0xe7fb('0x34')];_0x2139e3[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0x2139e3['where']=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x4407ee[_0xe7fb('0x2b')],_0x2e0e13[_0xe7fb('0x32')]));if(_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x2139e3['where']=_[_0xe7fb('0x39')](_0x2139e3[_0xe7fb('0x29')],{'$or':_['map'](_0x2139e3[_0xe7fb('0x35')],function(_0x5dde83){var _0x21d86e={};_0x21d86e[_0x5dde83]={'$like':'%'+_0x4407ee['query'][_0xe7fb('0x1d')]+'%'};return _0x21d86e;})});}_0x2139e3=_[_0xe7fb('0x39')]({},_0x2139e3,_0x4407ee['options']);return _0x23e1db[_0xe7fb('0x87')](_0x2139e3);}})[_0xe7fb('0x18')](function(_0x5892cd){if(_0x5892cd){_0x2a2fa6=_0x5892cd['length'];if(!_0x4407ee['query']['hasOwnProperty'](_0xe7fb('0x4e'))){_0x2139e3[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x2139e3[_0xe7fb('0x12')]=qs['offset'](_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x23e1db[_0xe7fb('0x87')](_0x2139e3);}})['then'](function(_0x3c56ad){return _0x3c56ad?{'count':_0x2a2fa6,'rows':_0x3c56ad}:null;})['then'](respondWithResult(_0x56869b,null))[_0xe7fb('0x2e')](handleError(_0x56869b,null));};exports['getLists']=function(_0x4880a7,_0x27669f){var _0x3d8b9a={};var _0x3503ac={};var _0x413843;var _0x55ce0f;return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x4880a7[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x27669f,null))[_0xe7fb('0x18')](function(_0x21d9b0){if(_0x21d9b0){_0x413843=_0x21d9b0;_0x3503ac[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x88')][_0xe7fb('0x26')]);_0x3503ac[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x4880a7[_0xe7fb('0x2b')]);_0x3503ac[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x3503ac[_0xe7fb('0x34')],_0x3503ac[_0xe7fb('0x2b')]);_0x3d8b9a['attributes']=_[_0xe7fb('0x33')](_0x3503ac[_0xe7fb('0x34')],qs['fields'](_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x3d8b9a[_0xe7fb('0x35')]=_0x3d8b9a['attributes'][_0xe7fb('0x37')]?_0x3d8b9a[_0xe7fb('0x35')]:_0x3503ac[_0xe7fb('0x34')];_0x3d8b9a[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x4880a7[_0xe7fb('0x2b')]['sort']);_0x3d8b9a[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x4880a7['query'],_0x3503ac[_0xe7fb('0x32')]));if(_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x3d8b9a[_0xe7fb('0x29')]=_['merge'](_0x3d8b9a[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x3d8b9a[_0xe7fb('0x35')],function(_0x39ffed){var _0x47e833={};_0x47e833[_0x39ffed]={'$like':'%'+_0x4880a7['query'][_0xe7fb('0x1d')]+'%'};return _0x47e833;})});}_0x3d8b9a=_[_0xe7fb('0x39')]({},_0x3d8b9a,_0x4880a7[_0xe7fb('0x3a')]);return _0x413843[_0xe7fb('0x89')](_0x3d8b9a);}})['then'](function(_0x57750a){if(_0x57750a){_0x55ce0f=_0x57750a[_0xe7fb('0x37')];if(!_0x4880a7['query'][_0xe7fb('0x4d')]('nolimit')){_0x3d8b9a[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x3d8b9a[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x413843[_0xe7fb('0x89')](_0x3d8b9a);}})[_0xe7fb('0x18')](function(_0x14014d){if(_0x14014d){return _0x14014d?{'count':_0x55ce0f,'rows':_0x14014d}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x27669f,null))[_0xe7fb('0x2e')](handleError(_0x27669f,null));};exports[_0xe7fb('0x8a')]=function(_0x4d9a76,_0x23a49e){var _0x30651f=moment()[_0xe7fb('0x66')](_0xe7fb('0x8b'));var _0x582862,_0x5b6da5;return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x4d9a76[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x23a49e,null))['then'](function(_0x4e09d8){if(_0x4e09d8){_0x5b6da5=_0x4e09d8;return _0x4e09d8[_0xe7fb('0x8a')](_0x4d9a76[_0xe7fb('0x3d')][_0xe7fb('0x6b')],_[_0xe7fb('0x45')](_0x4d9a76[_0xe7fb('0x3d')],[_0xe7fb('0x6b'),'id'])||{});}return null;})[_0xe7fb('0x8c')](function(_0x2e2167){var _0xd7f440;_0x582862=_0x2e2167||[];var _0xc8055f=[];if(_0x2e2167){for(var _0x45b449=0x0;_0x45b449<_0x2e2167['length'];_0x45b449+=0x1){var _0x366c06=_0x2e2167[_0x45b449][_0xe7fb('0x1a')]({'plain':!![]});_0x5b6da5[_0xe7fb('0x8d')]=_0x4d9a76[_0xe7fb('0x3d')][_0xe7fb('0x8d')]?_0x4d9a76[_0xe7fb('0x3d')][_0xe7fb('0x8d')]:_0x5b6da5[_0xe7fb('0x8d')];switch(_0x5b6da5['dialCheckDuplicateType']){case _0xe7fb('0x8e'):_0xd7f440=squel[_0xe7fb('0x8f')]()[_0xe7fb('0x90')](_0xe7fb('0x91'))['fromQuery']([_0xe7fb('0x92'),_0xe7fb('0x93'),_0xe7fb('0x94'),_0xe7fb('0x95'),_0xe7fb('0x51'),_0xe7fb('0x47'),_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()['field'](_0xe7fb('0x92'),_0xe7fb('0x92'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x93'))['field']('id',_0xe7fb('0x94'))[_0xe7fb('0x6e')](_0x366c06[_0xe7fb('0x96')][_0xe7fb('0x75')](),_0xe7fb('0x95'))[_0xe7fb('0x6e')](_0x4d9a76[_0xe7fb('0x30')]['id']['toString'](),'VoiceQueueId')[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27','createdAt')['field']('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')]('cm_contacts')[_0xe7fb('0x29')](_0xe7fb('0x97'))['where'](_0xe7fb('0x98'),_0x366c06['CmListId'][_0xe7fb('0x75')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xe7fb('0x29')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xe7fb('0x6e')](_0xe7fb('0x99'))['from'](_0xe7fb('0x9a'))[_0xe7fb('0x29')](_0xe7fb('0x73'),_0x4d9a76[_0xe7fb('0x30')]['id'][_0xe7fb('0x75')]()))[_0xe7fb('0x29')](_0xe7fb('0x9b'),squel['select']()['field'](_0xe7fb('0x9c'))['from']('cm_hopper')[_0xe7fb('0x29')]('VoiceQueueId\x20=\x20?',_0x4d9a76['params']['id'][_0xe7fb('0x75')]())))['toString']();break;case _0xe7fb('0x9d'):_0xd7f440=squel[_0xe7fb('0x8f')]()[_0xe7fb('0x90')](_0xe7fb('0x91'))[_0xe7fb('0x9e')]([_0xe7fb('0x92'),'scheduledAt',_0xe7fb('0x94'),_0xe7fb('0x95'),_0xe7fb('0x51'),_0xe7fb('0x47'),_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')](_0xe7fb('0x92'),_0xe7fb('0x92'))['field']('\x27'+_0x30651f+'\x27',_0xe7fb('0x93'))[_0xe7fb('0x6e')]('id',_0xe7fb('0x94'))[_0xe7fb('0x6e')](_0x366c06[_0xe7fb('0x96')][_0xe7fb('0x75')](),_0xe7fb('0x95'))['field'](_0x4d9a76['params']['id']['toString'](),_0xe7fb('0x51'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x47'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0x9f'))['where'](_0xe7fb('0x97'))[_0xe7fb('0x29')](_0xe7fb('0x98'),_0x366c06['CmListId']['toString']())[_0xe7fb('0x29')](_0xe7fb('0xa0'))[_0xe7fb('0x29')](_0xe7fb('0x9b'),squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')](_0xe7fb('0x9c'))['from'](_0xe7fb('0x91'))[_0xe7fb('0x29')](_0xe7fb('0x73'),_0x4d9a76['params']['id'][_0xe7fb('0x75')]())))['toString']();break;default:_0xd7f440=squel[_0xe7fb('0x8f')]()['into'](_0xe7fb('0x91'))[_0xe7fb('0x9e')]([_0xe7fb('0x92'),_0xe7fb('0x93'),_0xe7fb('0x94'),'ListId',_0xe7fb('0x51'),'createdAt','updatedAt'],squel['select']()[_0xe7fb('0x6e')]('phone','phone')['field']('\x27'+_0x30651f+'\x27',_0xe7fb('0x93'))[_0xe7fb('0x6e')]('id','ContactId')[_0xe7fb('0x6e')](_0x366c06[_0xe7fb('0x96')]['toString'](),_0xe7fb('0x95'))['field'](_0x4d9a76[_0xe7fb('0x30')]['id'][_0xe7fb('0x75')](),_0xe7fb('0x51'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x47'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0x9f'))['where'](_0xe7fb('0x97'))[_0xe7fb('0x29')](_0xe7fb('0x98'),_0x366c06[_0xe7fb('0x96')]['toString']())[_0xe7fb('0x29')](_0xe7fb('0xa0')))['toString']();}_0xc8055f['push'](db[_0xe7fb('0x5f')]['query'](_0xd7f440));}return BPromise[_0xe7fb('0x7a')](_0xc8055f);}})[_0xe7fb('0x18')](function(){var _0x20b22f=[];var _0x2e22c1=squel[_0xe7fb('0x8f')]()['into'](_0xe7fb('0xa1'))['fromQuery']([_0xe7fb('0xa2'),_0xe7fb('0x92'),_0xe7fb('0xa3'),'createdAt',_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')](_0xe7fb('0xa4'))[_0xe7fb('0x6e')]('ci.item')[_0xe7fb('0x6e')](_0xe7fb('0xa5'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x47'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0xa6'),'ci')[_0xe7fb('0xa7')]('cm_hopper','h',_0xe7fb('0xa8'))[_0xe7fb('0x29')]('h.scheduledat=?',_0x30651f)[_0xe7fb('0x29')]('ci.ItemClass=?',_0xe7fb('0xa9')))[_0xe7fb('0x75')]();_0x20b22f[_0xe7fb('0x74')](db[_0xe7fb('0x5f')][_0xe7fb('0x2b')](_0x2e22c1));return BPromise[_0xe7fb('0x7a')](_0x20b22f);})[_0xe7fb('0x18')](function(){return _0x582862;})['then'](respondWithResult(_0x23a49e,null))[_0xe7fb('0x2e')](handleError(_0x23a49e,null));};exports[_0xe7fb('0xaa')]=function(_0x3c04f4,_0x290cc3){return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x3c04f4['params']['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x290cc3,null))[_0xe7fb('0x18')](function(_0x3ed48f){if(_0x3ed48f){return _0x3ed48f['removeLists'](_0x3c04f4[_0xe7fb('0x2b')][_0xe7fb('0x6b')]);}})[_0xe7fb('0x18')](function(_0x2eeff4){if(_0x2eeff4){return db[_0xe7fb('0x52')]['destroy']({'where':{'ListId':_0x3c04f4[_0xe7fb('0x2b')][_0xe7fb('0x6b')],'VoiceQueueId':_0x3c04f4[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(){return _0x2eeff4;});}})[_0xe7fb('0x18')](respondWithStatusCode(_0x290cc3,null))[_0xe7fb('0x2e')](handleError(_0x290cc3,null));};exports[_0xe7fb('0xab')]=function(_0xcaad94,_0x5b88bd){var _0x143dbb={};var _0x715444={};var _0x92a316;var _0x30a834;return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0xcaad94[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x5b88bd,null))[_0xe7fb('0x18')](function(_0x1b1818){if(_0x1b1818){_0x92a316=_0x1b1818;_0x715444[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x88')][_0xe7fb('0x26')]);_0x715444[_0xe7fb('0x2b')]=_['keys'](_0xcaad94[_0xe7fb('0x2b')]);_0x715444[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x715444[_0xe7fb('0x34')],_0x715444[_0xe7fb('0x2b')]);_0x143dbb['attributes']=_[_0xe7fb('0x33')](_0x715444[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0xcaad94['query']['fields']));_0x143dbb[_0xe7fb('0x35')]=_0x143dbb[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x143dbb[_0xe7fb('0x35')]:_0x715444['model'];_0x143dbb[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0x143dbb['where']=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0xcaad94['query'],_0x715444[_0xe7fb('0x32')]));if(_0xcaad94[_0xe7fb('0x2b')]['filter']){_0x143dbb['where']=_[_0xe7fb('0x39')](_0x143dbb[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x143dbb['attributes'],function(_0x3b2375){var _0x170347={};_0x170347[_0x3b2375]={'$like':'%'+_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x170347;})});}_0x143dbb=_['merge']({},_0x143dbb,_0xcaad94[_0xe7fb('0x3a')]);return _0x92a316[_0xe7fb('0xab')](_0x143dbb);}})[_0xe7fb('0x18')](function(_0x2a984e){if(_0x2a984e){_0x30a834=_0x2a984e[_0xe7fb('0x37')];if(!_0xcaad94[_0xe7fb('0x2b')]['hasOwnProperty']('nolimit')){_0x143dbb[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x143dbb[_0xe7fb('0x12')]=qs['offset'](_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x92a316[_0xe7fb('0xab')](_0x143dbb);}})[_0xe7fb('0x18')](function(_0x286382){if(_0x286382){return _0x286382?{'count':_0x30a834,'rows':_0x286382}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x5b88bd,null))[_0xe7fb('0x2e')](handleError(_0x5b88bd,null));};exports[_0xe7fb('0xac')]=function(_0x325c7b,_0x38472b){var _0x1a33f8;return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x325c7b[_0xe7fb('0x30')]['id']}})['then'](handleEntityNotFound(_0x38472b,null))[_0xe7fb('0x18')](function(_0x291a8d){if(_0x291a8d){return _0x291a8d['addBlackLists'](_0x325c7b[_0xe7fb('0x3d')]['ids'],_[_0xe7fb('0x45')](_0x325c7b[_0xe7fb('0x3d')],[_0xe7fb('0x6b'),'id'])||{});}return null;})[_0xe7fb('0x8c')](function(_0x3ade81){var _0x1b9ea2;_0x1a33f8=_0x3ade81||[];var _0x418561=[];if(_0x3ade81){for(var _0x3ec66a=0x0;_0x3ec66a<_0x3ade81[_0xe7fb('0x37')];_0x3ec66a+=0x1){var _0x1c76a1=_0x3ade81[_0x3ec66a][_0xe7fb('0x1a')]({'plain':!![]});_0x1b9ea2=squel[_0xe7fb('0x8f')]()[_0xe7fb('0x90')](_0xe7fb('0xad'))[_0xe7fb('0x9e')]([_0xe7fb('0x92'),_0xe7fb('0x94'),_0xe7fb('0x95'),_0xe7fb('0x51'),_0xe7fb('0x47'),_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')]('phone',_0xe7fb('0x92'))[_0xe7fb('0x6e')]('id',_0xe7fb('0x94'))['field'](_0x1c76a1[_0xe7fb('0x96')][_0xe7fb('0x75')](),_0xe7fb('0x95'))[_0xe7fb('0x6e')](_0x325c7b[_0xe7fb('0x30')]['id'][_0xe7fb('0x75')](),'VoiceQueueId')[_0xe7fb('0x6e')](_0xe7fb('0xae'),_0xe7fb('0x47'))[_0xe7fb('0x6e')]('NOW()',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0x9f'))[_0xe7fb('0x29')]('deletedAt\x20IS\x20NULL')[_0xe7fb('0x29')](_0xe7fb('0x98'),_0x1c76a1[_0xe7fb('0x96')][_0xe7fb('0x75')]())[_0xe7fb('0x29')](_0xe7fb('0xa0')))['toString']();_0x418561[_0xe7fb('0x74')](db[_0xe7fb('0x5f')]['query'](_0x1b9ea2));}return BPromise[_0xe7fb('0x7a')](_0x418561);}})[_0xe7fb('0x18')](function(){return _0x1a33f8;})['then'](respondWithResult(_0x38472b,null))[_0xe7fb('0x2e')](handleError(_0x38472b,null));};exports['removeBlackLists']=function(_0x127051,_0x4d9376){return db[_0xe7fb('0x25')]['find']({'where':{'id':_0x127051['params']['id']}})['then'](handleEntityNotFound(_0x4d9376,null))['then'](function(_0x547d29){if(_0x547d29){return _0x547d29[_0xe7fb('0xaf')](_0x127051[_0xe7fb('0x2b')]['ids']);}})[_0xe7fb('0x18')](function(_0x5c0baf){if(_0x5c0baf){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x127051['query'][_0xe7fb('0x6b')],'VoiceQueueId':_0x127051[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(){return _0x5c0baf;});}})['then'](respondWithStatusCode(_0x4d9376,null))[_0xe7fb('0x2e')](handleError(_0x4d9376,null));}; \ No newline at end of file +var _0x00bb=['query','filters','intersection','attributes','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','getHoppers','hasOwnProperty','nolimit','sort','VoiceQueueId','CmHopper','includeAll','findAll','CmHopperHistory','order','pick','getHopperFinals','findOne','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','online','voicePause','interface','Agents','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','UserVoiceQueueRt','SIP/%s','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isNil','format','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','push','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','then','destroy','get','inbound','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','rows','catch','show','params','model','keys'];(function(_0x3273ef,_0x8218a0){var _0x2bcdee=function(_0x27b533){while(--_0x27b533){_0x3273ef['push'](_0x3273ef['shift']());}};_0x2bcdee(++_0x8218a0);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x00bb[_0x1e7b16];return _0x37fadc;};'use strict';var moment=require(_0xb00b('0x0'));var BPromise=require(_0xb00b('0x1'));var util=require(_0xb00b('0x2'));var _=require('lodash');var squel=require(_0xb00b('0x3'));var Redis=require('ioredis');var qs=require(_0xb00b('0x4'));var logger=require(_0xb00b('0x5'))('api');var config=require(_0xb00b('0x6'));var db=require(_0xb00b('0x7'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb00b('0x8'),'port':0x18eb});var socket=require(_0xb00b('0x9'))(new Redis(config[_0xb00b('0xa')]));require(_0xb00b('0xb'))[_0xb00b('0xc')](socket);function respondWithStatusCode(_0x3c36c5,_0x5b0c03){_0x5b0c03=_0x5b0c03||0xcc;return function(_0x51d12b){if(_0x51d12b){return _0x3c36c5[_0xb00b('0xd')](_0x5b0c03);}return _0x3c36c5[_0xb00b('0xe')](_0x5b0c03)[_0xb00b('0xf')]();};}function respondWithResult(_0x46a25c,_0x28d3cc){_0x28d3cc=_0x28d3cc||0xc8;return function(_0x48e125){if(_0x48e125){return _0x46a25c[_0xb00b('0xe')](_0x28d3cc)['json'](_0x48e125);}};}function respondWithFilteredResult(_0x5a4fea,_0x594075){return function(_0x4ff792){if(_0x4ff792){var _0x2d8ddf=typeof _0x594075[_0xb00b('0x10')]===_0xb00b('0x11')&&typeof _0x594075[_0xb00b('0x12')]===_0xb00b('0x11');var _0x4ada81=_0x4ff792[_0xb00b('0x13')];var _0xb0d42e=_0x2d8ddf?0x0:_0x594075['offset'];var _0x88d95e=_0x2d8ddf?_0x4ff792[_0xb00b('0x13')]:_0x594075['offset']+_0x594075['limit'];var _0x9b471e;if(_0x88d95e>=_0x4ada81){_0x88d95e=_0x4ada81;_0x9b471e=0xc8;}else{_0x9b471e=0xce;}_0x5a4fea['status'](_0x9b471e);return _0x5a4fea['set'](_0xb00b('0x14'),_0xb0d42e+'-'+_0x88d95e+'/'+_0x4ada81)[_0xb00b('0x15')](_0x4ff792);}return null;};}function saveUpdates(_0x387d97){return function(_0xbb72fc){if(_0xbb72fc){return _0xbb72fc['update'](_0x387d97)[_0xb00b('0x16')](function(_0x599347){return _0x599347;});}return null;};}function removeEntity(_0x415f91){return function(_0x5aa9a0){if(_0x5aa9a0){return _0x5aa9a0[_0xb00b('0x17')]()['then'](function(){var _0xb26ebb=_0x5aa9a0[_0xb00b('0x18')]({'plain':!![]});var _0x53ee68=[{'name':'VoiceQueues','value':_0xb00b('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':_0xb00b('0x1a'),'ignore':![]}];var _0x43da66=_(_0x53ee68)[_0xb00b('0x1b')](_0xb00b('0x1c'))['map'](_0xb00b('0x1d'))['value']();if(_[_0xb00b('0x1e')](_0x43da66,_0xb26ebb[_0xb00b('0x1f')])){return;}var _0x51b841=_[_0xb00b('0x20')](_0x53ee68,[_0xb00b('0x1d'),_0xb26ebb['type']])[_0xb00b('0x21')];return db[_0xb00b('0x22')]['destroy']({'where':{'type':_0x51b841,'resourceId':_0xb26ebb['id']}})[_0xb00b('0x16')](function(){return _0x5aa9a0;});})[_0xb00b('0x16')](function(){_0x415f91[_0xb00b('0xe')](0xcc)[_0xb00b('0xf')]();});}};}function handleEntityNotFound(_0x520e55){return function(_0x50be6c){if(!_0x50be6c){_0x520e55[_0xb00b('0xd')](0x194);}return _0x50be6c;};}function handleError(_0x490380,_0x550587){_0x550587=_0x550587||0x1f4;return function(_0x4a635e){logger[_0xb00b('0x23')](_0x4a635e[_0xb00b('0x24')]);if(_0x4a635e[_0xb00b('0x21')]){delete _0x4a635e[_0xb00b('0x21')];}_0x490380[_0xb00b('0xe')](_0x550587)[_0xb00b('0x25')](_0x4a635e);};}exports[_0xb00b('0x26')]=function(_0x4a8d2b,_0x22c22d){var _0x503c9c={};var _0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x27')](db['VoiceQueue'][_0xb00b('0x28')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x29')],'type':_0x280ed3[_0xb00b('0x1f')][_0xb00b('0x2a')]};});_0x503c9c=qs[_0xb00b('0x2b')](_0x348165,_0x4a8d2b);var _0x2e160a={'where':_0x503c9c[_0xb00b('0x2c')]};return db[_0xb00b('0x2d')]['count'](_0x2e160a)[_0xb00b('0x16')](function(_0x44918d){_0x450129['count']=_0x44918d;_0x503c9c[_0xb00b('0x2e')]=qs[_0xb00b('0x2e')](_0x4a8d2b['query']);return db[_0xb00b('0x2d')]['findAll'](_0x503c9c);})[_0xb00b('0x16')](function(_0x4117f2){_0x450129[_0xb00b('0x2f')]=_0x4117f2;return _0x450129;})[_0xb00b('0x16')](respondWithFilteredResult(_0x22c22d,_0x503c9c))[_0xb00b('0x30')](handleError(_0x22c22d,null));};exports[_0xb00b('0x31')]=function(_0x17f613,_0x594840){var _0x57e8f9={'raw':![],'where':{'id':_0x17f613[_0xb00b('0x32')]['id']}},_0x5b04c2={};_0x5b04c2[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x5b04c2[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x17f613[_0xb00b('0x35')]);_0x5b04c2[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x5b04c2[_0xb00b('0x33')],_0x5b04c2[_0xb00b('0x35')]);_0x57e8f9[_0xb00b('0x38')]=_['intersection'](_0x5b04c2['model'],qs[_0xb00b('0x39')](_0x17f613['query'][_0xb00b('0x39')]));_0x57e8f9[_0xb00b('0x38')]=_0x57e8f9[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x57e8f9[_0xb00b('0x38')]:_0x5b04c2[_0xb00b('0x33')];if(_0x17f613[_0xb00b('0x35')]['includeAll']){_0x57e8f9[_0xb00b('0x2e')]=[{'all':!![]}];}_0x57e8f9=_[_0xb00b('0x3b')]({},_0x57e8f9,_0x17f613[_0xb00b('0x3c')]);return db[_0xb00b('0x2d')][_0xb00b('0x20')](_0x57e8f9)[_0xb00b('0x16')](handleEntityNotFound(_0x594840,null))['then'](respondWithResult(_0x594840,null))[_0xb00b('0x30')](handleError(_0x594840,null));};exports[_0xb00b('0x3d')]=function(_0x4801e7,_0x17ff34){return db[_0xb00b('0x2d')][_0xb00b('0x3d')](_0x4801e7[_0xb00b('0x3e')],{})[_0xb00b('0x16')](function(_0x5636b1){var _0x14ff6a=_0x4801e7[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x14ff6a)throw new Error(_0xb00b('0x40'));if(_0x14ff6a['role']==='user'){var _0x43f834=_0x5636b1[_0xb00b('0x18')]({'plain':!![]});var _0x10a348=[{'name':_0xb00b('0x41'),'value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x493841=_[_0xb00b('0x20')](_0x10a348,[_0xb00b('0x1d'),_0x43f834[_0xb00b('0x1f')]])[_0xb00b('0x21')];return db[_0xb00b('0x43')][_0xb00b('0x20')]({'where':{'name':_0x493841,'userProfileId':_0x14ff6a[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x2d58e2){if(_0x2d58e2&&_0x2d58e2[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x43f834['name'],'resourceId':_0x43f834['id'],'type':_0x2d58e2[_0xb00b('0x21')],'sectionId':_0x2d58e2['id']},{})[_0xb00b('0x16')](function(){return _0x5636b1;});}else{return _0x5636b1;}})[_0xb00b('0x30')](function(_0x44afa0){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x44afa0);throw _0x44afa0;});}return _0x5636b1;})[_0xb00b('0x16')](respondWithResult(_0x17ff34,0xc9))[_0xb00b('0x30')](handleError(_0x17ff34,null));};exports[_0xb00b('0x47')]=function(_0x103320,_0x1eec12){var _0x3b3031={'where':{'id':_0x103320['params']['id']}},_0x5dbe00={};_0x5dbe00['model']=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x3b3031[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x5dbe00[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x103320['query']['fields']));_0x3b3031[_0xb00b('0x38')]=_0x3b3031[_0xb00b('0x38')]['length']?_0x3b3031['attributes']:_0x5dbe00[_0xb00b('0x33')];if(_0x103320[_0xb00b('0x35')]['includeAll']){_0x3b3031[_0xb00b('0x2e')]=[{'all':!![]}];}_0x3b3031=_['merge']({},_0x3b3031,_0x103320['options']);return db['VoiceQueue'][_0xb00b('0x20')](_0x3b3031)['then'](handleEntityNotFound(_0x1eec12,null))[_0xb00b('0x16')](function(_0x3178aa){if(_0x3178aa){var _0x4b6482=_0x3178aa[_0xb00b('0x18')]({'plain':!![]});_0x4b6482=qs[_0xb00b('0x48')](_0x4b6482,['id',_0xb00b('0x49'),'updatedAt']);_0x103320['body']=_[_0xb00b('0x48')](_0x103320[_0xb00b('0x3e')],['id','createdAt',_0xb00b('0x4a')]);return db[_0xb00b('0x2d')]['create'](_[_0xb00b('0x3b')](_0x4b6482,_0x103320[_0xb00b('0x3e')]),{'include':_0x103320[_0xb00b('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x19f907){var _0x398deb=_0x103320[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x398deb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x398deb[_0xb00b('0x4b')]===_0xb00b('0x3f')){var _0x4ad9cb=_0x19f907['get']({'plain':!![]});var _0x160965=[{'name':'VoiceQueues','value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x222459=_[_0xb00b('0x20')](_0x160965,[_0xb00b('0x1d'),_0x4ad9cb['type']])[_0xb00b('0x21')];return db['UserProfileSection'][_0xb00b('0x20')]({'where':{'name':_0x222459,'userProfileId':_0x398deb[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x5ac79e){if(_0x5ac79e&&_0x5ac79e[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x4ad9cb['name'],'resourceId':_0x4ad9cb['id'],'type':_0x5ac79e[_0xb00b('0x21')],'sectionId':_0x5ac79e['id']},{})[_0xb00b('0x16')](function(){return _0x19f907;});}else{return _0x19f907;}})[_0xb00b('0x30')](function(_0x385029){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x385029);throw _0x385029;});}return _0x19f907;});}})[_0xb00b('0x16')](respondWithResult(_0x1eec12,0xc9))[_0xb00b('0x30')](handleError(_0x1eec12,null));};exports['update']=function(_0x153551,_0x2cbe80){if(_0x153551[_0xb00b('0x3e')]['id']){delete _0x153551['body']['id'];}return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x153551[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2cbe80,null))[_0xb00b('0x16')](saveUpdates(_0x153551['body'],null))[_0xb00b('0x16')](respondWithResult(_0x2cbe80,null))[_0xb00b('0x30')](handleError(_0x2cbe80,null));};exports[_0xb00b('0x17')]=function(_0x1cad79,_0x4b1e5f){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x1cad79[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4b1e5f,null))[_0xb00b('0x16')](removeEntity(_0x4b1e5f,null))[_0xb00b('0x30')](handleError(_0x4b1e5f,null));};exports[_0xb00b('0x4c')]=function(_0x542223,_0x2b090a){var _0x502822={'raw':![],'where':{}};var _0x3e0648={};var _0x4c2186={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x542223[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x2b090a,null))[_0xb00b('0x16')](function(_0x2534ed){if(_0x2534ed){_0x3e0648[_0xb00b('0x33')]=_['keys'](db['CmHopper']['rawAttributes']);_0x3e0648[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x542223[_0xb00b('0x35')]);_0x3e0648['filters']=_[_0xb00b('0x37')](_0x3e0648[_0xb00b('0x33')],_0x3e0648[_0xb00b('0x35')]);_0x502822[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3e0648['model'],qs[_0xb00b('0x39')](_0x542223[_0xb00b('0x35')]['fields']));_0x502822[_0xb00b('0x38')]=_0x502822[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x502822['attributes']:_0x3e0648['model'];if(!_0x542223[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x502822['limit']=qs['limit'](_0x542223['query']['limit']);_0x502822[_0xb00b('0x10')]=qs['offset'](_0x542223[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x502822['order']=qs[_0xb00b('0x4f')](_0x542223[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x502822[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x542223[_0xb00b('0x35')],_0x3e0648[_0xb00b('0x36')]));_0x502822[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2534ed['id'];if(_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x502822[_0xb00b('0x2c')]=_['merge'](_0x502822[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x502822[_0xb00b('0x38')],function(_0x328f72){var _0x109f56={};_0x109f56[_0x328f72]={'$like':'%'+_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x109f56;})});}_0x502822=_[_0xb00b('0x3b')]({},_0x502822,_0x542223['options']);return db[_0xb00b('0x51')][_0xb00b('0x13')]({'where':_0x502822[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3d6b33){_0x4c2186[_0xb00b('0x13')]=_0x3d6b33;if(_0x542223[_0xb00b('0x35')][_0xb00b('0x52')]){_0x502822['include']=[{'all':!![]}];}return db[_0xb00b('0x51')][_0xb00b('0x53')](_0x502822);})[_0xb00b('0x16')](function(_0x26b82a){_0x4c2186[_0xb00b('0x2f')]=_0x26b82a;return _0x4c2186;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x2b090a,_0x502822))[_0xb00b('0x30')](handleError(_0x2b090a,null));};exports['getHopperHistories']=function(_0x207bda,_0x37a4c0){var _0x28ecf8={'raw':!![],'where':{}};var _0x22b19c={};var _0x16e8ff={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x207bda[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x37a4c0,null))[_0xb00b('0x16')](function(_0x50922f){if(_0x50922f){_0x22b19c[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x54')]['rawAttributes']);_0x22b19c['query']=_[_0xb00b('0x34')](_0x207bda[_0xb00b('0x35')]);_0x22b19c[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],_0x22b19c[_0xb00b('0x35')]);_0x28ecf8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x39')]));_0x28ecf8[_0xb00b('0x38')]=_0x28ecf8[_0xb00b('0x38')]['length']?_0x28ecf8['attributes']:_0x22b19c[_0xb00b('0x33')];if(!_0x207bda[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x28ecf8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x207bda[_0xb00b('0x35')]['limit']);_0x28ecf8[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x28ecf8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x207bda[_0xb00b('0x35')]['sort']);_0x28ecf8[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x207bda[_0xb00b('0x35')],_0x22b19c['filters']));_0x28ecf8[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x50922f['id'];if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x28ecf8[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x28ecf8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x28ecf8[_0xb00b('0x38')],function(_0x383d16){var _0x2ec3f2={};_0x2ec3f2[_0x383d16]={'$like':'%'+_0x207bda[_0xb00b('0x35')]['filter']+'%'};return _0x2ec3f2;})});}_0x28ecf8=_[_0xb00b('0x3b')]({},_0x28ecf8,_0x207bda[_0xb00b('0x3c')]);return db[_0xb00b('0x54')][_0xb00b('0x13')]({'where':_0x28ecf8['where']})[_0xb00b('0x16')](function(_0x17503d){_0x16e8ff[_0xb00b('0x13')]=_0x17503d;if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x52')]){_0x28ecf8['include']=[{'all':!![]}];}return db[_0xb00b('0x54')][_0xb00b('0x53')](_0x28ecf8);})[_0xb00b('0x16')](function(_0x2b66b7){_0x16e8ff['rows']=_0x2b66b7;return _0x16e8ff;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x37a4c0,_0x28ecf8))['catch'](handleError(_0x37a4c0,null));};exports[_0xb00b('0x57')]=function(_0x202d5f,_0x69b4e0){var _0x165442={'raw':!![],'where':{}};var _0x188349={};var _0x27e051={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x202d5f[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x69b4e0,null))[_0xb00b('0x16')](function(_0x551a55){if(_0x551a55){_0x188349[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x59')][_0xb00b('0x28')]);_0x188349['query']=_[_0xb00b('0x34')](_0x202d5f[_0xb00b('0x35')]);_0x188349['filters']=_[_0xb00b('0x37')](_0x188349['model'],_0x188349[_0xb00b('0x35')]);_0x165442[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x188349['model'],qs[_0xb00b('0x39')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x39')]));_0x165442[_0xb00b('0x38')]=_0x165442[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x165442[_0xb00b('0x38')]:_0x188349[_0xb00b('0x33')];if(!_0x202d5f[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x165442[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x12')]);_0x165442['offset']=qs[_0xb00b('0x10')](_0x202d5f[_0xb00b('0x35')]['offset']);}_0x165442[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x202d5f[_0xb00b('0x35')]['sort']);_0x165442[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x202d5f[_0xb00b('0x35')],_0x188349[_0xb00b('0x36')]));_0x165442[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x551a55['id'];if(_0x202d5f[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x165442[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x165442['where'],{'$or':_[_0xb00b('0x27')](_0x165442[_0xb00b('0x38')],function(_0x320542){var _0x29d101={};_0x29d101[_0x320542]={'$like':'%'+_0x202d5f['query'][_0xb00b('0x1b')]+'%'};return _0x29d101;})});}_0x165442=_['merge']({},_0x165442,_0x202d5f[_0xb00b('0x3c')]);return db['CmHopperFinal'][_0xb00b('0x13')]({'where':_0x165442[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3e0e49){_0x27e051[_0xb00b('0x13')]=_0x3e0e49;if(_0x202d5f['query'][_0xb00b('0x52')]){_0x165442[_0xb00b('0x2e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xb00b('0x53')](_0x165442);})['then'](function(_0x20a690){_0x27e051[_0xb00b('0x2f')]=_0x20a690;return _0x27e051;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x69b4e0,_0x165442))[_0xb00b('0x30')](handleError(_0x69b4e0,null));};exports['getHopperBlacks']=function(_0x3ae4a4,_0x76b483){var _0x190019={'raw':!![],'where':{}};var _0x44ea58={};var _0x11172e={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3ae4a4[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x76b483,null))[_0xb00b('0x16')](function(_0x2d5652){if(_0x2d5652){_0x44ea58[_0xb00b('0x33')]=_['keys'](db['CmHopperBlack'][_0xb00b('0x28')]);_0x44ea58[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x3ae4a4[_0xb00b('0x35')]);_0x44ea58[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x44ea58[_0xb00b('0x33')],_0x44ea58['query']);_0x190019[_0xb00b('0x38')]=_['intersection'](_0x44ea58[_0xb00b('0x33')],qs['fields'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x39')]));_0x190019[_0xb00b('0x38')]=_0x190019[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x190019[_0xb00b('0x38')]:_0x44ea58[_0xb00b('0x33')];if(!_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x190019[_0xb00b('0x12')]=qs['limit'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x12')]);_0x190019[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x3ae4a4['query'][_0xb00b('0x10')]);}_0x190019[_0xb00b('0x55')]=qs['sort'](_0x3ae4a4[_0xb00b('0x35')]['sort']);_0x190019[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x3ae4a4[_0xb00b('0x35')],_0x44ea58[_0xb00b('0x36')]));_0x190019[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2d5652['id'];if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x190019['where']=_[_0xb00b('0x3b')](_0x190019['where'],{'$or':_[_0xb00b('0x27')](_0x190019[_0xb00b('0x38')],function(_0x140bfd){var _0x43fbc5={};_0x43fbc5[_0x140bfd]={'$like':'%'+_0x3ae4a4['query'][_0xb00b('0x1b')]+'%'};return _0x43fbc5;})});}_0x190019=_[_0xb00b('0x3b')]({},_0x190019,_0x3ae4a4[_0xb00b('0x3c')]);return db['CmHopperBlack'][_0xb00b('0x13')]({'where':_0x190019[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0xcc2183){_0x11172e['count']=_0xcc2183;if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x52')]){_0x190019[_0xb00b('0x2e')]=[{'all':!![]}];}return db[_0xb00b('0x5a')][_0xb00b('0x53')](_0x190019);})[_0xb00b('0x16')](function(_0x568c0a){_0x11172e['rows']=_0x568c0a;return _0x11172e;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x76b483,_0x190019))[_0xb00b('0x30')](handleError(_0x76b483,null));};exports[_0xb00b('0x5b')]=function(_0x2ec514,_0x3de4f6){var _0x5f0fd8={};var _0x3d80e7={};var _0xbe553c;var _0x14597c;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x2ec514[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x3de4f6,null))[_0xb00b('0x16')](function(_0x2414bd){if(_0x2414bd){_0xbe553c=_0x2414bd;_0x3d80e7[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x5c')][_0xb00b('0x28')]);_0x3d80e7[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x2ec514[_0xb00b('0x35')]);_0x3d80e7[_0xb00b('0x36')]=_['intersection'](_0x3d80e7['model'],_0x3d80e7[_0xb00b('0x35')]);_0x5f0fd8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3d80e7['model'],qs['fields'](_0x2ec514['query'][_0xb00b('0x39')]));_0x5f0fd8[_0xb00b('0x38')]=_0x5f0fd8[_0xb00b('0x38')]['length']?_0x5f0fd8[_0xb00b('0x38')]:_0x3d80e7[_0xb00b('0x33')];_0x5f0fd8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x2ec514['query'][_0xb00b('0x4f')]);_0x5f0fd8[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x2ec514[_0xb00b('0x35')],_0x3d80e7[_0xb00b('0x36')]));if(_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x5f0fd8['where']=_[_0xb00b('0x3b')](_0x5f0fd8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x5f0fd8[_0xb00b('0x38')],function(_0xf9c361){var _0x24c646={};_0x24c646[_0xf9c361]={'$like':'%'+_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x24c646;})});}_0x5f0fd8=_['merge']({},_0x5f0fd8,_0x2ec514[_0xb00b('0x3c')]);return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x122522){if(_0x122522){_0x14597c=_0x122522['length'];if(!_0x2ec514[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x5f0fd8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x2ec514[_0xb00b('0x35')][_0xb00b('0x12')]);_0x5f0fd8[_0xb00b('0x10')]=qs['offset'](_0x2ec514['query'][_0xb00b('0x10')]);}return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x58894a){if(_0x58894a){return _0x58894a?{'count':_0x14597c,'rows':_0x58894a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3de4f6,null))[_0xb00b('0x30')](handleError(_0x3de4f6,null));};exports[_0xb00b('0x5d')]=function(_0x581548,_0x44d3c0){var _0x3d5880=_0x581548[_0xb00b('0x3e')]['teams'];var _0x58808e=_[_0xb00b('0x27')](_0x3d5880,'id');return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x58808e},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]}]})[_0xb00b('0x16')](function(_0x5c5a04){if(_0x5c5a04){var _0x1aa5e5=_['flatMap'](_0x5c5a04,function(_0x592206){var _0x3551ca=_0x592206[_0xb00b('0x18')]({'plain':!![]});_0x3551ca[_0xb00b('0x61')][_0xb00b('0x62')](function(_0x8b31d3){_0x8b31d3[_0xb00b('0x63')]=_['find'](_0x3d5880,{'id':_0x3551ca['id']})[_0xb00b('0x63')];});return _0x3551ca['Agents'];});return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x581548[_0xb00b('0x32')]['id']}})['then'](function(_0x226527){return db[_0xb00b('0x64')][_0xb00b('0x65')](function(_0x3dc8d2){return _0x226527['addTeams'](_0x58808e,{'transaction':_0x3dc8d2})['then'](function(){return BPromise[_0xb00b('0x66')](_0x3d5880,function(_0x55bb31){return db['TeamVoiceQueue'][_0xb00b('0x67')]({'TeamId':_0x55bb31['id'],'VoiceQueueId':_0x581548['params']['id'],'penalty':_0x55bb31['penalty']},{'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_0x1aa5e5,function(_0x745803){return db[_0xb00b('0x68')]['findOrCreate']({'where':{'UserId':_0x745803['id'],'VoiceQueueId':_0x581548['params']['id']},'defaults':{'penalty':_0x745803[_0xb00b('0x63')]},'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_['filter'](_0x1aa5e5,{'online':!![]}),function(_0x48bac5){return db[_0xb00b('0x69')]['upsert']({'membername':_0x48bac5['name'],'UserId':_0x48bac5['id'],'queue_name':_0x226527[_0xb00b('0x21')],'VoiceQueueId':_0x226527['id'],'interface':_['isNil'](_0x48bac5[_0xb00b('0x60')])?util['format'](_0xb00b('0x6a'),_0x48bac5['name']):_0x48bac5[_0xb00b('0x60')],'paused':_0x48bac5[_0xb00b('0x5f')]||![],'penalty':_0x48bac5[_0xb00b('0x63')]},{'transaction':_0x3dc8d2});});})['then'](function(){_0x1aa5e5[_0xb00b('0x62')](function(_0x596092){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':_0x596092['id'],'VoiceQueueId':_0x226527['id']});});});});});}})['then'](respondWithStatusCode(_0x44d3c0,null))['catch'](handleError(_0x44d3c0,null));};exports['removeTeams']=function(_0x552f73,_0x192b43){return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x552f73['query'][_0xb00b('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xb00b('0x6e')],'as':_0xb00b('0x61'),'attributes':['id'],'raw':!![]}]})[_0xb00b('0x16')](handleEntityNotFound(_0x192b43,null))[_0xb00b('0x16')](function(_0x5b1576){var _0x8292fe=_[_0xb00b('0x27')](_0x5b1576,'id');var _0x3c1cc5=[];var _0x38e425=[];var _0x515143=squel['select']();_0x515143[_0xb00b('0x6f')](_0xb00b('0x70'))[_0xb00b('0x71')](_0xb00b('0x72'),'tq')[_0xb00b('0x73')](_0xb00b('0x74'),'ut',_0xb00b('0x75'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x552f73['params']['id']);for(var _0x45bae8=0x0;_0x45bae8<_0x5b1576[_0xb00b('0x3a')];_0x45bae8+=0x1){let _0x496500=_0x5b1576[_0x45bae8];for(var _0x475ebb=0x0;_0x475ebb<_0x496500['Agents'][_0xb00b('0x3a')];_0x475ebb+=0x1){let _0x13054a=_0x496500['Agents'][_0x475ebb];var _0x4ce456=_0x515143[_0xb00b('0x47')]();_0x4ce456[_0xb00b('0x2c')](_0xb00b('0x77'),_0x13054a['id']);_0x38e425['push'](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4ce456[_0xb00b('0x78')](),{'type':db['sequelize'][_0xb00b('0x79')]['SELECT']})['then'](function(_0x58ea43){if(_0x58ea43[_0xb00b('0x3a')]===0x1){return _0x13054a['id'];}else{var _0x4d42af=_[_0xb00b('0x7a')](_[_0xb00b('0x27')](_0x58ea43,'TeamId'),function(_0x4c389f){return _[_0xb00b('0x1e')](_0x8292fe,_0x4c389f);});if(_0x4d42af){return _0x13054a['id'];}}}));}}return BPromise[_0xb00b('0x7b')](_0x38e425)['then'](function(_0x2f131e){_0x3c1cc5=_(_0x3c1cc5)[_0xb00b('0x7c')](_0x2f131e)[_0xb00b('0x7d')]()[_0xb00b('0x1d')]();return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x552f73['params']['id']}})[_0xb00b('0x16')](function(_0x22b425){return db['sequelize'][_0xb00b('0x65')](function(_0x4ed3c7){return _0x22b425['removeTeams'](_0x552f73[_0xb00b('0x35')]['ids'],{'transaction':_0x4ed3c7})[_0xb00b('0x16')](function(){if(!_[_0xb00b('0x7e')](_0x3c1cc5)){return _0x22b425[_0xb00b('0x7f')](_0x3c1cc5,{'transaction':_0x4ed3c7})['then'](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x552f73[_0xb00b('0x32')]['id'],'UserId':_0x3c1cc5},'transaction':_0x4ed3c7});});}})[_0xb00b('0x16')](function(){_0x3c1cc5['forEach'](function(_0x20f4d2){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':_0x20f4d2,'VoiceQueueId':_0x22b425['id']});});});});});});})[_0xb00b('0x16')](respondWithStatusCode(_0x192b43,null))[_0xb00b('0x30')](handleError(_0x192b43,null));};exports[_0xb00b('0x81')]=function(_0x21ecef,_0x40f6f6){var _0x48125c,_0x1b097a;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x21ecef['params']['id']}})['then'](handleEntityNotFound(_0x40f6f6,null))['then'](function(_0x1e66eb){if(_0x1e66eb){_0x1b097a=_0x1e66eb;return _0x1e66eb[_0xb00b('0x81')](_0x21ecef[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x21ecef[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{})[_0xb00b('0x82')](function(_0x2c3557){for(var _0x5b7137=0x0;_0x5b7137<_0x21ecef[_0xb00b('0x3e')]['ids'][_0xb00b('0x3a')];_0x5b7137+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':Number(_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')][_0x5b7137]),'VoiceQueueId':Number(_0x21ecef[_0xb00b('0x32')]['id'])});}return _0x2c3557;});}})['then'](function(_0xeaa6ea){_0x48125c=_0xeaa6ea||[];if(_0x1b097a){return db[_0xb00b('0x6e')][_0xb00b('0x53')]({'where':{'id':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')]},'attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]});}})[_0xb00b('0x16')](function(_0x5f1258){if(!_[_0xb00b('0x7e')](_0x5f1258)){var _0x33952b=[];for(var _0x4cd459=0x0;_0x4cd459<_0x5f1258[_0xb00b('0x3a')];_0x4cd459++){if(_0x5f1258[_0x4cd459]['online']){_0x33952b['push'](db['UserVoiceQueueRt'][_0xb00b('0x67')]({'membername':_0x5f1258[_0x4cd459]['name'],'UserId':_0x5f1258[_0x4cd459]['id'],'queue_name':_0x1b097a[_0xb00b('0x21')],'VoiceQueueId':_0x1b097a['id'],'interface':_[_0xb00b('0x83')](_0x5f1258[_0x4cd459][_0xb00b('0x60')])?util[_0xb00b('0x84')](_0xb00b('0x6a'),_0x5f1258[_0x4cd459][_0xb00b('0x21')]):_0x5f1258[_0x4cd459][_0xb00b('0x60')],'paused':_0x5f1258[_0x4cd459][_0xb00b('0x5f')]||![],'penalty':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x63')]||0x0}));}}return BPromise[_0xb00b('0x7b')](_0x33952b);}})[_0xb00b('0x16')](function(){return _0x48125c;})[_0xb00b('0x16')](respondWithResult(_0x40f6f6,null))[_0xb00b('0x30')](handleError(_0x40f6f6,null));};exports['removeAgents']=function(_0x31d2f0,_0x15f9cd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x31d2f0[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x15f9cd,null))[_0xb00b('0x16')](function(_0x387744){if(_0x387744){return _0x387744['removeAgents'](_0x31d2f0['query'][_0xb00b('0x6d')])[_0xb00b('0x16')](function(){if(_[_0xb00b('0x85')](_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')])){for(var _0x11f9b7=0x0;_0x11f9b7<_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')][_0xb00b('0x3a')];_0x11f9b7+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0['query'][_0xb00b('0x6d')][_0x11f9b7]),'VoiceQueueId':Number(_0x31d2f0['params']['id'])});}}else{socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')]),'VoiceQueueId':Number(_0x31d2f0[_0xb00b('0x32')]['id'])});}});}})[_0xb00b('0x16')](function(_0x59c4b6){return db[_0xb00b('0x69')][_0xb00b('0x17')]({'where':{'VoiceQueueId':_0x31d2f0[_0xb00b('0x32')]['id'],'UserId':_0x31d2f0[_0xb00b('0x35')]['ids']}})[_0xb00b('0x16')](function(){return _0x59c4b6;});})[_0xb00b('0x16')](respondWithStatusCode(_0x15f9cd,null))['catch'](handleError(_0x15f9cd,null));};exports[_0xb00b('0x86')]=function(_0x16cca9,_0x3c57b2){var _0xca4a87={};var _0x456515={};var _0x26145a;var _0x31fa5b;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x16cca9['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3c57b2,null))[_0xb00b('0x16')](function(_0x4b0306){if(_0x4b0306){_0x26145a=_0x4b0306;_0x456515[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x6e')][_0xb00b('0x28')]);_0x456515[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x16cca9[_0xb00b('0x35')]);_0x456515[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],_0x456515[_0xb00b('0x35')]);_0xca4a87['attributes']=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x16cca9['query'][_0xb00b('0x39')]));_0xca4a87[_0xb00b('0x38')]=_0xca4a87[_0xb00b('0x38')][_0xb00b('0x3a')]?_0xca4a87['attributes']:_0x456515[_0xb00b('0x33')];_0xca4a87[_0xb00b('0x55')]=qs['sort'](_0x16cca9['query'][_0xb00b('0x4f')]);_0xca4a87[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x16cca9['query'],_0x456515['filters']));if(_0x16cca9[_0xb00b('0x35')]['filter']){_0xca4a87['where']=_[_0xb00b('0x3b')](_0xca4a87[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0xca4a87[_0xb00b('0x38')],function(_0x11e9b4){var _0x2ae27c={};_0x2ae27c[_0x11e9b4]={'$like':'%'+_0x16cca9[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x2ae27c;})});}_0xca4a87=_[_0xb00b('0x3b')]({},_0xca4a87,_0x16cca9[_0xb00b('0x3c')]);return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})[_0xb00b('0x16')](function(_0x29ba55){if(_0x29ba55){_0x31fa5b=_0x29ba55[_0xb00b('0x3a')];if(!_0x16cca9['query'][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0xca4a87['limit']=qs[_0xb00b('0x12')](_0x16cca9['query'][_0xb00b('0x12')]);_0xca4a87[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x16cca9['query'][_0xb00b('0x10')]);}return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})['then'](function(_0x8478c8){if(_0x8478c8){return _0x8478c8?{'count':_0x31fa5b,'rows':_0x8478c8}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3c57b2,null))[_0xb00b('0x30')](handleError(_0x3c57b2,null));};exports[_0xb00b('0x87')]=function(_0x57bfab,_0x2dab12){var _0x47194e={};var _0x19d24b={};var _0x52b54b;var _0x571811;return db['VoiceQueue'][_0xb00b('0x58')]({'where':{'id':_0x57bfab[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2dab12,null))[_0xb00b('0x16')](function(_0x344379){if(_0x344379){_0x52b54b=_0x344379;_0x19d24b[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x69')][_0xb00b('0x28')]);_0x19d24b['query']=_['keys'](_0x57bfab[_0xb00b('0x35')]);_0x19d24b[_0xb00b('0x36')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],_0x19d24b['query']);_0x47194e[_0xb00b('0x38')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x57bfab['query'][_0xb00b('0x39')]));_0x47194e[_0xb00b('0x38')]=_0x47194e['attributes'][_0xb00b('0x3a')]?_0x47194e['attributes']:_0x19d24b[_0xb00b('0x33')];_0x47194e[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x47194e[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x57bfab[_0xb00b('0x35')],_0x19d24b[_0xb00b('0x36')]));if(_0x57bfab['query']['filter']){_0x47194e[_0xb00b('0x2c')]=_['merge'](_0x47194e[_0xb00b('0x2c')],{'$or':_['map'](_0x47194e[_0xb00b('0x38')],function(_0x1600f1){var _0x58bd2a={};_0x58bd2a[_0x1600f1]={'$like':'%'+_0x57bfab[_0xb00b('0x35')]['filter']+'%'};return _0x58bd2a;})});}_0x47194e=_[_0xb00b('0x3b')]({},_0x47194e,_0x57bfab[_0xb00b('0x3c')]);return _0x52b54b['getMembers'](_0x47194e);}})[_0xb00b('0x16')](function(_0x307c52){if(_0x307c52){_0x571811=_0x307c52[_0xb00b('0x3a')];if(!_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4d')]('nolimit')){_0x47194e[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x57bfab['query']['limit']);_0x47194e[_0xb00b('0x10')]=qs['offset'](_0x57bfab['query']['offset']);}return _0x52b54b[_0xb00b('0x87')](_0x47194e);}})[_0xb00b('0x16')](function(_0x39eb7a){return _0x39eb7a?{'count':_0x571811,'rows':_0x39eb7a}:null;})[_0xb00b('0x16')](respondWithResult(_0x2dab12,null))['catch'](handleError(_0x2dab12,null));};exports[_0xb00b('0x88')]=function(_0x482fc4,_0x3232cc){var _0x89225a={};var _0x22f2f6={};var _0x459f30;var _0x5aa72a;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x482fc4['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3232cc,null))[_0xb00b('0x16')](function(_0x4291a3){if(_0x4291a3){_0x459f30=_0x4291a3;_0x22f2f6['model']=_['keys'](db[_0xb00b('0x89')][_0xb00b('0x28')]);_0x22f2f6[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x482fc4[_0xb00b('0x35')]);_0x22f2f6[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22f2f6['model'],_0x22f2f6['query']);_0x89225a[_0xb00b('0x38')]=_['intersection'](_0x22f2f6['model'],qs[_0xb00b('0x39')](_0x482fc4[_0xb00b('0x35')]['fields']));_0x89225a[_0xb00b('0x38')]=_0x89225a[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x89225a['attributes']:_0x22f2f6[_0xb00b('0x33')];_0x89225a[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x89225a[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x482fc4[_0xb00b('0x35')],_0x22f2f6[_0xb00b('0x36')]));if(_0x482fc4['query']['filter']){_0x89225a['where']=_[_0xb00b('0x3b')](_0x89225a[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x89225a[_0xb00b('0x38')],function(_0x3deb79){var _0x1901d1={};_0x1901d1[_0x3deb79]={'$like':'%'+_0x482fc4[_0xb00b('0x35')]['filter']+'%'};return _0x1901d1;})});}_0x89225a=_['merge']({},_0x89225a,_0x482fc4[_0xb00b('0x3c')]);return _0x459f30[_0xb00b('0x88')](_0x89225a);}})['then'](function(_0x3517d6){if(_0x3517d6){_0x5aa72a=_0x3517d6[_0xb00b('0x3a')];if(!_0x482fc4['query'][_0xb00b('0x4d')]('nolimit')){_0x89225a[_0xb00b('0x12')]=qs['limit'](_0x482fc4['query']['limit']);_0x89225a[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x10')]);}return _0x459f30['getLists'](_0x89225a);}})[_0xb00b('0x16')](function(_0x481abb){if(_0x481abb){return _0x481abb?{'count':_0x5aa72a,'rows':_0x481abb}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3232cc,null))[_0xb00b('0x30')](handleError(_0x3232cc,null));};exports[_0xb00b('0x8a')]=function(_0x7ecc19,_0x1cc9fb){var _0x259acf=moment()[_0xb00b('0x84')](_0xb00b('0x8b'));var _0x57834b,_0x5448bb;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x7ecc19[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x1cc9fb,null))[_0xb00b('0x16')](function(_0x1e0206){if(_0x1e0206){_0x5448bb=_0x1e0206;return _0x1e0206[_0xb00b('0x8a')](_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x6d')],_['omit'](_0x7ecc19[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x26b234){var _0x4fe674;_0x57834b=_0x26b234||[];var _0x45ad1f=[];if(_0x26b234){for(var _0x11b817=0x0;_0x11b817<_0x26b234[_0xb00b('0x3a')];_0x11b817+=0x1){var _0x89dd0a=_0x26b234[_0x11b817][_0xb00b('0x18')]({'plain':!![]});_0x5448bb[_0xb00b('0x8c')]=_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x8c')]?_0x7ecc19[_0xb00b('0x3e')]['dialCheckDuplicateType']:_0x5448bb['dialCheckDuplicateType'];switch(_0x5448bb[_0xb00b('0x8c')]){case _0xb00b('0x8d'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),'ListId')['field'](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27','updatedAt')['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()[_0xb00b('0x6f')](_0xb00b('0x9d'))[_0xb00b('0x71')](_0xb00b('0x9e'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19['params']['id'][_0xb00b('0x78')]()))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel[_0xb00b('0x95')]()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;case _0xb00b('0x9f'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))['fromQuery']([_0xb00b('0x92'),_0xb00b('0x96'),_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))['field']('id','ContactId')['field'](_0x89dd0a[_0xb00b('0x97')]['toString'](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))['field']('\x27'+_0x259acf+'\x27','updatedAt')[_0xb00b('0x71')]('cm_contacts')[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a['CmListId'][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))['where'](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;default:_0x4fe674=squel['insert']()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),'ListId',_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))['toString']();}_0x45ad1f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4fe674));}return BPromise['all'](_0x45ad1f);}})[_0xb00b('0x16')](function(){var _0x2bf68f=[];var _0x283ad6=squel[_0xb00b('0x8e')]()['into']('cm_hopper_additional_phones')[_0xb00b('0x91')]([_0xb00b('0xa1'),'phone',_0xb00b('0xa2'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field']('h.id')[_0xb00b('0x6f')](_0xb00b('0xa3'))[_0xb00b('0x6f')](_0xb00b('0xa4'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0xa5'),'ci')[_0xb00b('0x73')](_0xb00b('0x90'),'h',_0xb00b('0xa6'))[_0xb00b('0x2c')](_0xb00b('0xa7'),_0x259acf)[_0xb00b('0x2c')]('ci.ItemClass=?',_0xb00b('0xa8')))[_0xb00b('0x78')]();_0x2bf68f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x283ad6));return BPromise[_0xb00b('0x7b')](_0x2bf68f);})[_0xb00b('0x16')](function(){return _0x57834b;})[_0xb00b('0x16')](respondWithResult(_0x1cc9fb,null))[_0xb00b('0x30')](handleError(_0x1cc9fb,null));};exports[_0xb00b('0xa9')]=function(_0x229197,_0x5ce3f3){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x229197[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5ce3f3,null))[_0xb00b('0x16')](function(_0x406469){if(_0x406469){return _0x406469['removeLists'](_0x229197[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x4ffe41){if(_0x4ffe41){return db['CmHopper'][_0xb00b('0x17')]({'where':{'ListId':_0x229197['query'][_0xb00b('0x6d')],'VoiceQueueId':_0x229197[_0xb00b('0x32')]['id']}})['then'](function(){return _0x4ffe41;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5ce3f3,null))['catch'](handleError(_0x5ce3f3,null));};exports['getBlackLists']=function(_0x122be3,_0x4cb6ba){var _0x3ca253={};var _0x438281={};var _0x23b994;var _0x564934;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x122be3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4cb6ba,null))[_0xb00b('0x16')](function(_0x18f5ac){if(_0x18f5ac){_0x23b994=_0x18f5ac;_0x438281[_0xb00b('0x33')]=_['keys'](db[_0xb00b('0x89')]['rawAttributes']);_0x438281[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x122be3[_0xb00b('0x35')]);_0x438281[_0xb00b('0x36')]=_['intersection'](_0x438281[_0xb00b('0x33')],_0x438281[_0xb00b('0x35')]);_0x3ca253[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x438281[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x122be3['query'][_0xb00b('0x39')]));_0x3ca253[_0xb00b('0x38')]=_0x3ca253['attributes'][_0xb00b('0x3a')]?_0x3ca253[_0xb00b('0x38')]:_0x438281[_0xb00b('0x33')];_0x3ca253[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x122be3[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x3ca253[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x122be3[_0xb00b('0x35')],_0x438281[_0xb00b('0x36')]));if(_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x3ca253['where']=_['merge'](_0x3ca253['where'],{'$or':_[_0xb00b('0x27')](_0x3ca253[_0xb00b('0x38')],function(_0x966247){var _0x58b695={};_0x58b695[_0x966247]={'$like':'%'+_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x58b695;})});}_0x3ca253=_[_0xb00b('0x3b')]({},_0x3ca253,_0x122be3[_0xb00b('0x3c')]);return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})['then'](function(_0x1bafb2){if(_0x1bafb2){_0x564934=_0x1bafb2['length'];if(!_0x122be3['query']['hasOwnProperty'](_0xb00b('0x4e'))){_0x3ca253[_0xb00b('0x12')]=qs['limit'](_0x122be3[_0xb00b('0x35')][_0xb00b('0x12')]);_0x3ca253[_0xb00b('0x10')]=qs['offset'](_0x122be3[_0xb00b('0x35')]['offset']);}return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})[_0xb00b('0x16')](function(_0x2e3e5a){if(_0x2e3e5a){return _0x2e3e5a?{'count':_0x564934,'rows':_0x2e3e5a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x4cb6ba,null))['catch'](handleError(_0x4cb6ba,null));};exports['addBlackLists']=function(_0x470c4a,_0x12cc9d){var _0xe5b66f;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x470c4a[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x12cc9d,null))[_0xb00b('0x16')](function(_0x3afb66){if(_0x3afb66){return _0x3afb66[_0xb00b('0xab')](_0x470c4a[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x470c4a[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x379b81){var _0x46c784;_0xe5b66f=_0x379b81||[];var _0x471db4=[];if(_0x379b81){for(var _0x333bee=0x0;_0x333bee<_0x379b81['length'];_0x333bee+=0x1){var _0x1a94bf=_0x379b81[_0x333bee][_0xb00b('0x18')]({'plain':!![]});_0x46c784=squel[_0xb00b('0x8e')]()['into'](_0xb00b('0xac'))[_0xb00b('0x91')]([_0xb00b('0x92'),'ContactId',_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),'phone')[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x1a94bf['CmListId'][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x470c4a[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))['field'](_0xb00b('0xad'),_0xb00b('0x49'))['field'](_0xb00b('0xad'),_0xb00b('0x4a'))[_0xb00b('0x71')](_0xb00b('0x98'))[_0xb00b('0x2c')]('deletedAt\x20IS\x20NULL')['where'](_0xb00b('0x9a'),_0x1a94bf[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))[_0xb00b('0x78')]();_0x471db4[_0xb00b('0xa0')](db['sequelize'][_0xb00b('0x35')](_0x46c784));}return BPromise[_0xb00b('0x7b')](_0x471db4);}})[_0xb00b('0x16')](function(){return _0xe5b66f;})['then'](respondWithResult(_0x12cc9d,null))[_0xb00b('0x30')](handleError(_0x12cc9d,null));};exports[_0xb00b('0xae')]=function(_0x4d30c3,_0x5099fd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5099fd,null))['then'](function(_0x45b2e1){if(_0x45b2e1){return _0x45b2e1[_0xb00b('0xae')](_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x5e12dc){if(_0x5e12dc){return db[_0xb00b('0x5a')][_0xb00b('0x17')]({'where':{'ListId':_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')],'VoiceQueueId':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](function(){return _0x5e12dc;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5099fd,null))[_0xb00b('0x30')](handleError(_0x5099fd,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 92460c8..f918863 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 _0x4b24=['events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3e6b02,_0x1e2a64){var _0x53e368=function(_0x250dd0){while(--_0x250dd0){_0x3e6b02['push'](_0x3e6b02['shift']());}};_0x53e368(++_0x1e2a64);}(_0x4b24,0x160));var _0x44b2=function(_0x36897b,_0xaf7778){_0x36897b=_0x36897b-0x0;var _0x2b0913=_0x4b24[_0x36897b];return _0x2b0913;};'use strict';var EventEmitter=require(_0x44b2('0x0'));var VoiceQueue=require(_0x44b2('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x44b2('0x2'),'afterUpdate':_0x44b2('0x3'),'afterDestroy':_0x44b2('0x4')};function emitEvent(_0x1ddc7e){return function(_0x2c1056,_0xdc525c,_0x3cf2a6){VoiceQueueEvents[_0x44b2('0x5')](_0x1ddc7e+':'+_0x2c1056['id'],_0x2c1056);VoiceQueueEvents[_0x44b2('0x5')](_0x1ddc7e,_0x2c1056);_0x3cf2a6(null);};}for(var e in events){if(events[_0x44b2('0x6')](e)){var event=events[e];VoiceQueue[_0x44b2('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x5baa=['exports','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3da1ae,_0x4a4976){var _0x37b5a4=function(_0x20dc9d){while(--_0x20dc9d){_0x3da1ae['push'](_0x3da1ae['shift']());}};_0x37b5a4(++_0x4a4976);}(_0x5baa,0x1c1));var _0xa5ba=function(_0x524586,_0xe265e4){_0x524586=_0x524586-0x0;var _0x3991cf=_0x5baa[_0x524586];return _0x3991cf;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xa5ba('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa5ba('0x1')](0x0);var events={'afterCreate':_0xa5ba('0x2'),'afterUpdate':_0xa5ba('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5019f7){return function(_0x3a4b71,_0x53a509,_0x4d55ce){VoiceQueueEvents[_0xa5ba('0x4')](_0x5019f7+':'+_0x3a4b71['id'],_0x3a4b71);VoiceQueueEvents[_0xa5ba('0x4')](_0x5019f7,_0x3a4b71);_0x4d55ce(null);};}for(var e in events){if(events[_0xa5ba('0x5')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xa5ba('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 6afa5d4..beafc44 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x43deb7,_0x12e5c3){var _0x25803f=function(_0x5dc5ac){while(--_0x5dc5ac){_0x43deb7['push'](_0x43deb7['shift']());}};_0x25803f(++_0x12e5c3);}(_0x34e8,0x12c));var _0x834e=function(_0x54dc54,_0x428f48){_0x54dc54=_0x54dc54-0x0;var _0x2f8631=_0x34e8[_0x54dc54];return _0x2f8631;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x55ef3c,_0x21e54f){var _0x1361f7=function(_0xc5418){while(--_0xc5418){_0x55ef3c['push'](_0x55ef3c['shift']());}};_0x1361f7(++_0x21e54f);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'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 35e87db..f227a77 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 _0xdd3b=['include','model','attributes','debug','stringify','ShowVoiceQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','register','request','then','info','request\x20sent','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','limit','map'];(function(_0x1cbf81,_0x5909d0){var _0x52ab3b=function(_0x14bbe7){while(--_0x14bbe7){_0x1cbf81['push'](_0x1cbf81['shift']());}};_0x52ab3b(++_0x5909d0);}(_0xdd3b,0xfe));var _0xbdd3=function(_0x2d0204,_0x299638){_0x2d0204=_0x2d0204-0x0;var _0x17e7c7=_0xdd3b[_0x2d0204];return _0x17e7c7;};'use strict';var _=require(_0xbdd3('0x0'));var util=require(_0xbdd3('0x1'));var moment=require(_0xbdd3('0x2'));var BPromise=require(_0xbdd3('0x3'));var rs=require(_0xbdd3('0x4'));var fs=require('fs');var Redis=require(_0xbdd3('0x5'));var db=require(_0xbdd3('0x6'))['db'];var utils=require(_0xbdd3('0x7'));var logger=require(_0xbdd3('0x8'))(_0xbdd3('0x9'));var config=require(_0xbdd3('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xbdd3('0xb')][_0xbdd3('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xbdd3('0xd')],{'host':_0xbdd3('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueue.socket')[_0xbdd3('0xf')](socket);function respondWithRpcPromise(_0xbfee48,_0x5cc8b2,_0xd980c3){return new BPromise(function(_0x5bfd79,_0x1311de){return client[_0xbdd3('0x10')](_0xbfee48,_0xd980c3)[_0xbdd3('0x11')](function(_0x3556a5){logger[_0xbdd3('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x5cc8b2,_0xbdd3('0x13'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x5cc8b2,'request\x20sent',JSON['stringify'](_0x3556a5));if(_0x3556a5[_0xbdd3('0x14')]){if(_0x3556a5[_0xbdd3('0x14')][_0xbdd3('0x15')]===0x1f4){logger[_0xbdd3('0x14')](_0xbdd3('0x16'),_0x5cc8b2,_0x3556a5[_0xbdd3('0x14')][_0xbdd3('0x17')]);return _0x1311de(_0x3556a5['error'][_0xbdd3('0x17')]);}logger['error'](_0xbdd3('0x16'),_0x5cc8b2,_0x3556a5[_0xbdd3('0x14')][_0xbdd3('0x17')]);return _0x5bfd79(_0x3556a5[_0xbdd3('0x14')][_0xbdd3('0x17')]);}else{logger[_0xbdd3('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x5cc8b2,'request\x20sent');_0x5bfd79(_0x3556a5[_0xbdd3('0x18')][_0xbdd3('0x17')]);}})[_0xbdd3('0x19')](function(_0x4f3841){logger[_0xbdd3('0x14')](_0xbdd3('0x16'),_0x5cc8b2,_0x4f3841);_0x1311de(_0x4f3841);});});}exports[_0xbdd3('0x1a')]=function(_0xc88fa9){var _0x901356=this;return new Promise(function(_0x147225,_0x1664ad){return db[_0xbdd3('0x1b')][_0xbdd3('0x1c')]({'raw':_0xc88fa9[_0xbdd3('0x1d')]?_0xc88fa9[_0xbdd3('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0xc88fa9[_0xbdd3('0x1d')]?_0xc88fa9[_0xbdd3('0x1d')][_0xbdd3('0x1e')]||null:null,'attributes':_0xc88fa9[_0xbdd3('0x1d')]?_0xc88fa9['options']['attributes']||null:null,'limit':_0xc88fa9['options']?_0xc88fa9[_0xbdd3('0x1d')][_0xbdd3('0x1f')]||null:null,'include':_0xc88fa9[_0xbdd3('0x1d')]?_0xc88fa9[_0xbdd3('0x1d')]['include']?_[_0xbdd3('0x20')](_0xc88fa9[_0xbdd3('0x1d')][_0xbdd3('0x21')],function(_0x555356){return{'model':db[_0x555356[_0xbdd3('0x22')]],'as':_0x555356['as'],'attributes':_0x555356[_0xbdd3('0x23')],'include':_0x555356['include']?_[_0xbdd3('0x20')](_0x555356[_0xbdd3('0x21')],function(_0x10afe0){return{'model':db[_0x10afe0[_0xbdd3('0x22')]],'as':_0x10afe0['as'],'attributes':_0x10afe0[_0xbdd3('0x23')],'include':_0x10afe0[_0xbdd3('0x21')]?_[_0xbdd3('0x20')](_0x10afe0[_0xbdd3('0x21')],function(_0x3897e1){return{'model':db[_0x3897e1[_0xbdd3('0x22')]],'as':_0x3897e1['as'],'attributes':_0x3897e1[_0xbdd3('0x23')]};}):[]};}):[]};}):[]:[]})[_0xbdd3('0x11')](function(_0xe4e4ea){logger[_0xbdd3('0x12')]('GetVoiceQueue',_0xc88fa9);logger[_0xbdd3('0x24')]('GetVoiceQueue',_0xc88fa9,JSON[_0xbdd3('0x25')](_0xe4e4ea));_0x147225(_0xe4e4ea);})[_0xbdd3('0x19')](function(_0x39f596){logger[_0xbdd3('0x14')](_0xbdd3('0x1a'),_0x39f596['message'],_0xc88fa9);_0x1664ad(_0x901356['error'](0x1f4,_0x39f596[_0xbdd3('0x17')]));});});};exports[_0xbdd3('0x26')]=function(_0x2a320b){var _0x5518aa=this;return new Promise(function(_0x26b876,_0x9a6e04){return db[_0xbdd3('0x1b')][_0xbdd3('0x27')]({'raw':_0x2a320b[_0xbdd3('0x1d')]?_0x2a320b[_0xbdd3('0x1d')][_0xbdd3('0x28')]===undefined?!![]:![]:!![],'where':_0x2a320b[_0xbdd3('0x1d')]?_0x2a320b[_0xbdd3('0x1d')]['where']||null:null,'attributes':_0x2a320b[_0xbdd3('0x1d')]?_0x2a320b[_0xbdd3('0x1d')][_0xbdd3('0x23')]||null:null,'include':_0x2a320b['options']?_0x2a320b[_0xbdd3('0x1d')][_0xbdd3('0x21')]?_[_0xbdd3('0x20')](_0x2a320b['options'][_0xbdd3('0x21')],function(_0x345cb2){return{'model':db[_0x345cb2[_0xbdd3('0x22')]],'as':_0x345cb2['as'],'attributes':_0x345cb2[_0xbdd3('0x23')],'include':_0x345cb2['include']?_[_0xbdd3('0x20')](_0x345cb2[_0xbdd3('0x21')],function(_0x124420){return{'model':db[_0x124420['model']],'as':_0x124420['as'],'attributes':_0x124420[_0xbdd3('0x23')],'include':_0x124420[_0xbdd3('0x21')]?_[_0xbdd3('0x20')](_0x124420[_0xbdd3('0x21')],function(_0x2b9452){return{'model':db[_0x2b9452['model']],'as':_0x2b9452['as'],'attributes':_0x2b9452[_0xbdd3('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2590d7){logger[_0xbdd3('0x12')](_0xbdd3('0x26'),_0x2a320b);logger[_0xbdd3('0x24')](_0xbdd3('0x26'),_0x2a320b,JSON['stringify'](_0x2590d7));_0x26b876(_0x2590d7);})[_0xbdd3('0x19')](function(_0x689d53){logger['error']('ShowVoiceQueue',_0x689d53[_0xbdd3('0x17')],_0x2a320b);_0x9a6e04(_0x5518aa[_0xbdd3('0x14')](0x1f4,_0x689d53[_0xbdd3('0x17')]));});});}; \ No newline at end of file +var _0x4a47=['where','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./voiceQueue.socket','register','request','then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceQueue,\x20%s,\x20%s','result','catch','options','raw','attributes','include','model','map','GetVoiceQueue','ShowVoiceQueue','VoiceQueue','find'];(function(_0x443323,_0x298474){var _0xaff025=function(_0x54502b){while(--_0x54502b){_0x443323['push'](_0x443323['shift']());}};_0xaff025(++_0x298474);}(_0x4a47,0x10b));var _0x74a4=function(_0x4f7588,_0x399e6b){_0x4f7588=_0x4f7588-0x0;var _0x535c70=_0x4a47[_0x4f7588];return _0x535c70;};'use strict';var _=require(_0x74a4('0x0'));var util=require('util');var moment=require(_0x74a4('0x1'));var BPromise=require(_0x74a4('0x2'));var rs=require(_0x74a4('0x3'));var fs=require('fs');var Redis=require(_0x74a4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x74a4('0x5'));var logger=require(_0x74a4('0x6'))(_0x74a4('0x7'));var config=require(_0x74a4('0x8'));var jayson=require(_0x74a4('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x74a4('0xa')]=_[_0x74a4('0xb')](config['redis'],{'host':_0x74a4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x74a4('0xa')]));require(_0x74a4('0xd'))[_0x74a4('0xe')](socket);function respondWithRpcPromise(_0x42f15d,_0x52cb8d,_0x692f82){return new BPromise(function(_0x10270b,_0x430f56){return client[_0x74a4('0xf')](_0x42f15d,_0x692f82)[_0x74a4('0x10')](function(_0x530df3){logger[_0x74a4('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x52cb8d,_0x74a4('0x12'));logger[_0x74a4('0x13')](_0x74a4('0x14'),_0x52cb8d,'request\x20sent',JSON[_0x74a4('0x15')](_0x530df3));if(_0x530df3[_0x74a4('0x16')]){if(_0x530df3[_0x74a4('0x16')]['code']===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x52cb8d,_0x530df3['error']['message']);return _0x430f56(_0x530df3[_0x74a4('0x16')][_0x74a4('0x17')]);}logger[_0x74a4('0x16')](_0x74a4('0x18'),_0x52cb8d,_0x530df3[_0x74a4('0x16')][_0x74a4('0x17')]);return _0x10270b(_0x530df3['error'][_0x74a4('0x17')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x52cb8d,'request\x20sent');_0x10270b(_0x530df3[_0x74a4('0x19')][_0x74a4('0x17')]);}})[_0x74a4('0x1a')](function(_0x5eff92){logger['error'](_0x74a4('0x18'),_0x52cb8d,_0x5eff92);_0x430f56(_0x5eff92);});});}exports['GetVoiceQueue']=function(_0x5a7676){var _0x5e34c6=this;return new Promise(function(_0x406e42,_0x58e324){return db['VoiceQueue']['findAll']({'raw':_0x5a7676[_0x74a4('0x1b')]?_0x5a7676[_0x74a4('0x1b')][_0x74a4('0x1c')]===undefined?!![]:![]:!![],'where':_0x5a7676[_0x74a4('0x1b')]?_0x5a7676[_0x74a4('0x1b')]['where']||null:null,'attributes':_0x5a7676[_0x74a4('0x1b')]?_0x5a7676[_0x74a4('0x1b')][_0x74a4('0x1d')]||null:null,'limit':_0x5a7676[_0x74a4('0x1b')]?_0x5a7676[_0x74a4('0x1b')]['limit']||null:null,'include':_0x5a7676[_0x74a4('0x1b')]?_0x5a7676[_0x74a4('0x1b')][_0x74a4('0x1e')]?_['map'](_0x5a7676[_0x74a4('0x1b')][_0x74a4('0x1e')],function(_0x21038f){return{'model':db[_0x21038f[_0x74a4('0x1f')]],'as':_0x21038f['as'],'attributes':_0x21038f['attributes'],'include':_0x21038f['include']?_[_0x74a4('0x20')](_0x21038f[_0x74a4('0x1e')],function(_0x14b382){return{'model':db[_0x14b382[_0x74a4('0x1f')]],'as':_0x14b382['as'],'attributes':_0x14b382[_0x74a4('0x1d')],'include':_0x14b382[_0x74a4('0x1e')]?_['map'](_0x14b382[_0x74a4('0x1e')],function(_0x14f3dc){return{'model':db[_0x14f3dc[_0x74a4('0x1f')]],'as':_0x14f3dc['as'],'attributes':_0x14f3dc['attributes']};}):[]};}):[]};}):[]:[]})[_0x74a4('0x10')](function(_0x43f4ad){logger[_0x74a4('0x11')]('GetVoiceQueue',_0x5a7676);logger[_0x74a4('0x13')](_0x74a4('0x21'),_0x5a7676,JSON['stringify'](_0x43f4ad));_0x406e42(_0x43f4ad);})[_0x74a4('0x1a')](function(_0x384afe){logger[_0x74a4('0x16')](_0x74a4('0x21'),_0x384afe['message'],_0x5a7676);_0x58e324(_0x5e34c6[_0x74a4('0x16')](0x1f4,_0x384afe['message']));});});};exports[_0x74a4('0x22')]=function(_0x44a63e){var _0x5078e0=this;return new Promise(function(_0x36e508,_0x39c47a){return db[_0x74a4('0x23')][_0x74a4('0x24')]({'raw':_0x44a63e[_0x74a4('0x1b')]?_0x44a63e[_0x74a4('0x1b')][_0x74a4('0x1c')]===undefined?!![]:![]:!![],'where':_0x44a63e[_0x74a4('0x1b')]?_0x44a63e[_0x74a4('0x1b')][_0x74a4('0x25')]||null:null,'attributes':_0x44a63e[_0x74a4('0x1b')]?_0x44a63e[_0x74a4('0x1b')][_0x74a4('0x1d')]||null:null,'include':_0x44a63e['options']?_0x44a63e[_0x74a4('0x1b')][_0x74a4('0x1e')]?_['map'](_0x44a63e['options']['include'],function(_0x30ceed){return{'model':db[_0x30ceed[_0x74a4('0x1f')]],'as':_0x30ceed['as'],'attributes':_0x30ceed[_0x74a4('0x1d')],'include':_0x30ceed[_0x74a4('0x1e')]?_[_0x74a4('0x20')](_0x30ceed[_0x74a4('0x1e')],function(_0x40ae02){return{'model':db[_0x40ae02[_0x74a4('0x1f')]],'as':_0x40ae02['as'],'attributes':_0x40ae02[_0x74a4('0x1d')],'include':_0x40ae02[_0x74a4('0x1e')]?_['map'](_0x40ae02[_0x74a4('0x1e')],function(_0x4349c4){return{'model':db[_0x4349c4[_0x74a4('0x1f')]],'as':_0x4349c4['as'],'attributes':_0x4349c4[_0x74a4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x74a4('0x10')](function(_0x1587fd){logger[_0x74a4('0x11')](_0x74a4('0x22'),_0x44a63e);logger[_0x74a4('0x13')](_0x74a4('0x22'),_0x44a63e,JSON['stringify'](_0x1587fd));_0x36e508(_0x1587fd);})[_0x74a4('0x1a')](function(_0x449ba7){logger[_0x74a4('0x16')]('ShowVoiceQueue',_0x449ba7['message'],_0x44a63e);_0x39c47a(_0x5078e0[_0x74a4('0x16')](0x1f4,_0x449ba7[_0x74a4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index b7220bf..e9a2ed6 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 _0x6088=['./voiceQueue.events','save','remove','update','emit','removeListener','register','voiceQueue:'];(function(_0x1c7b1f,_0x2d01e5){var _0x1d6509=function(_0x5b6cd6){while(--_0x5b6cd6){_0x1c7b1f['push'](_0x1c7b1f['shift']());}};_0x1d6509(++_0x2d01e5);}(_0x6088,0xe8));var _0x8608=function(_0x445641,_0x2e4bd2){_0x445641=_0x445641-0x0;var _0x4ec4c6=_0x6088[_0x445641];return _0x4ec4c6;};'use strict';var VoiceQueueEvents=require(_0x8608('0x0'));var events=[_0x8608('0x1'),_0x8608('0x2'),_0x8608('0x3')];function createListener(_0x2405f0,_0x2145ae){return function(_0x2c42f4){_0x2145ae[_0x8608('0x4')](_0x2405f0,_0x2c42f4);};}function removeListener(_0x42825c,_0x4a3603){return function(){VoiceQueueEvents[_0x8608('0x5')](_0x42825c,_0x4a3603);};}exports[_0x8608('0x6')]=function(_0x1f7ed4){for(var _0x175459=0x0,_0x29056f=events['length'];_0x175459<_0x29056f;_0x175459++){var _0x2317de=events[_0x175459];var _0x41b977=createListener(_0x8608('0x7')+_0x2317de,_0x1f7ed4);VoiceQueueEvents['on'](_0x2317de,_0x41b977);}}; \ No newline at end of file +var _0x2342=['voiceQueue:','./voiceQueue.events','update','emit','register','length'];(function(_0x11a796,_0x11a8f2){var _0x5a1439=function(_0x348778){while(--_0x348778){_0x11a796['push'](_0x11a796['shift']());}};_0x5a1439(++_0x11a8f2);}(_0x2342,0xc1));var _0x2234=function(_0x10cb88,_0x24b407){_0x10cb88=_0x10cb88-0x0;var _0x1c92cf=_0x2342[_0x10cb88];return _0x1c92cf;};'use strict';var VoiceQueueEvents=require(_0x2234('0x0'));var events=['save','remove',_0x2234('0x1')];function createListener(_0x4b4594,_0x16405c){return function(_0x2bc76a){_0x16405c[_0x2234('0x2')](_0x4b4594,_0x2bc76a);};}function removeListener(_0x2a1871,_0x44e1c2){return function(){VoiceQueueEvents['removeListener'](_0x2a1871,_0x44e1c2);};}exports[_0x2234('0x3')]=function(_0x8297c4){for(var _0x45d367=0x0,_0x1ab6e8=events[_0x2234('0x4')];_0x45d367<_0x1ab6e8;_0x45d367++){var _0x338c14=events[_0x45d367];var _0x24b51b=createListener(_0x2234('0x5')+_0x338c14,_0x8297c4);VoiceQueueEvents['on'](_0x338c14,_0x24b51b);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 176505f..ebe1567 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 _0x67e3=['show','post','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','getVoiceQueuesReport','/:id'];(function(_0x961b74,_0x3b18ca){var _0x377729=function(_0x2d6e8b){while(--_0x2d6e8b){_0x961b74['push'](_0x961b74['shift']());}};_0x377729(++_0x3b18ca);}(_0x67e3,0x80));var _0x367e=function(_0x6fdfb4,_0x40b743){_0x6fdfb4=_0x6fdfb4-0x0;var _0x4e8f99=_0x67e3[_0x6fdfb4];return _0x4e8f99;};'use strict';var multer=require(_0x367e('0x0'));var util=require(_0x367e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x367e('0x2'));var router=express[_0x367e('0x3')]();var fs_extra=require(_0x367e('0x4'));var auth=require(_0x367e('0x5'));var interaction=require(_0x367e('0x6'));var config=require(_0x367e('0x7'));var controller=require(_0x367e('0x8'));router[_0x367e('0x9')]('/',auth[_0x367e('0xa')](),controller[_0x367e('0xb')]);router[_0x367e('0x9')](_0x367e('0xc'),auth[_0x367e('0xa')](),controller[_0x367e('0xd')]);router[_0x367e('0x9')]('/index',auth[_0x367e('0xa')](),controller[_0x367e('0xe')]);router['get'](_0x367e('0xf'),auth[_0x367e('0xa')](),controller[_0x367e('0x10')]);router[_0x367e('0x11')]('/',auth['isAuthenticated'](),controller[_0x367e('0x12')]);router[_0x367e('0x13')]('/:id',auth[_0x367e('0xa')](),controller[_0x367e('0x14')]);router[_0x367e('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x367e('0x16')]);module[_0x367e('0x17')]=router; \ No newline at end of file +var _0x6a7c=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','getVoiceQueuesReport','/:id','post','create','put','delete','exports','multer','util'];(function(_0x3b711c,_0x4b22dc){var _0x2685f0=function(_0x3b5ba6){while(--_0x3b5ba6){_0x3b711c['push'](_0x3b711c['shift']());}};_0x2685f0(++_0x4b22dc);}(_0x6a7c,0x166));var _0xc6a7=function(_0x41a667,_0xd7514e){_0x41a667=_0x41a667-0x0;var _0x55bdac=_0x6a7c[_0x41a667];return _0x55bdac;};'use strict';var multer=require(_0xc6a7('0x0'));var util=require(_0xc6a7('0x1'));var path=require(_0xc6a7('0x2'));var timeout=require(_0xc6a7('0x3'));var express=require(_0xc6a7('0x4'));var router=express['Router']();var fs_extra=require(_0xc6a7('0x5'));var auth=require(_0xc6a7('0x6'));var interaction=require(_0xc6a7('0x7'));var config=require(_0xc6a7('0x8'));var controller=require(_0xc6a7('0x9'));router[_0xc6a7('0xa')]('/',auth[_0xc6a7('0xb')](),controller['index']);router[_0xc6a7('0xa')](_0xc6a7('0xc'),auth[_0xc6a7('0xb')](),controller['describe']);router[_0xc6a7('0xa')]('/index',auth[_0xc6a7('0xb')](),controller[_0xc6a7('0xd')]);router[_0xc6a7('0xa')](_0xc6a7('0xe'),auth[_0xc6a7('0xb')](),controller['show']);router[_0xc6a7('0xf')]('/',auth[_0xc6a7('0xb')](),controller[_0xc6a7('0x10')]);router[_0xc6a7('0x11')](_0xc6a7('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xc6a7('0x12')](_0xc6a7('0xe'),auth[_0xc6a7('0xb')](),controller['destroy']);module[_0xc6a7('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 4425f2f..96862b1 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 _0x1518=['DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING'];(function(_0x3694e9,_0x4897e5){var _0x41dddd=function(_0x1e3b60){while(--_0x1e3b60){_0x3694e9['push'](_0x3694e9['shift']());}};_0x41dddd(++_0x4897e5);}(_0x1518,0xfc));var _0x8151=function(_0x1a2784,_0x190993){_0x1a2784=_0x1a2784-0x0;var _0x7a07f6=_0x1518[_0x1a2784];return _0x7a07f6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8151('0x0'));module[_0x8151('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8151('0x2')]},'calleridnum':{'type':Sequelize[_0x8151('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x8151('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x8151('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x8151('0x3')],'set':function(_0x15941d){var _0x24b3b5=moment(_0x15941d);var _0xf92826=moment(this[_0x8151('0x4')](_0x8151('0x5')))[_0x8151('0x6')](_0x8151('0x7'));var _0x2c49da=_0x24b3b5[_0x8151('0x8')](_0xf92826,_0x8151('0x9'));this[_0x8151('0xa')](_0x8151('0xb'),_0x15941d);this[_0x8151('0xa')](_0x8151('0xc'),_0x2c49da||null);}},'position':{'type':Sequelize[_0x8151('0xd')]},'count':{'type':Sequelize[_0x8151('0xd')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x8151('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x8151('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x8151('0x3')]},'queuecallerexit':{'type':Sequelize[_0x8151('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x8151('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x8151('0x2')],'comment':_0x8151('0xf')},'originalposition':{'type':Sequelize[_0x8151('0xd')]},'channel':{'type':Sequelize[_0x8151('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8151('0x2')]},'connectedlinename':{'type':Sequelize[_0x8151('0x2')]},'accountcode':{'type':Sequelize[_0x8151('0x2')]},'context':{'type':Sequelize[_0x8151('0x2')]},'exten':{'type':Sequelize[_0x8151('0x2')]},'priority':{'type':Sequelize[_0x8151('0x2')]},'holdtime':{'type':Sequelize[_0x8151('0xd')]},'mohtime':{'type':Sequelize[_0x8151('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8151('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x8151('0x2')]},'transfer':{'type':Sequelize[_0x8151('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x8151('0x10')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x8151('0x2')]},'disposition':{'type':Sequelize[_0x8151('0x2')]},'secondDisposition':{'type':Sequelize[_0x8151('0x2')]},'thirdDisposition':{'type':Sequelize[_0x8151('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x8151('0x2')]}}; \ No newline at end of file +var _0x2cb6=['DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING'];(function(_0x34b792,_0x21b5f8){var _0x2d0550=function(_0x11990d){while(--_0x11990d){_0x34b792['push'](_0x34b792['shift']());}};_0x2d0550(++_0x21b5f8);}(_0x2cb6,0x1ce));var _0x62cb=function(_0x3a07fb,_0x1cd3ed){_0x3a07fb=_0x3a07fb-0x0;var _0xf0cbb0=_0x2cb6[_0x3a07fb];return _0xf0cbb0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x62cb('0x0'));module[_0x62cb('0x1')]={'type':{'type':Sequelize[_0x62cb('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x62cb('0x2')]},'calleridname':{'type':Sequelize[_0x62cb('0x2')]},'queue':{'type':Sequelize[_0x62cb('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x62cb('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x62cb('0x3')],'set':function(_0x1aeb4f){var _0x59a3a0=moment(_0x1aeb4f);var _0x3e705c=moment(this[_0x62cb('0x4')]('queuecallerjoinAt'))[_0x62cb('0x5')](_0x62cb('0x6'));var _0x164d1d=_0x59a3a0[_0x62cb('0x7')](_0x3e705c,'seconds');this['setDataValue'](_0x62cb('0x8'),_0x1aeb4f);this[_0x62cb('0x9')](_0x62cb('0xa'),_0x164d1d||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x62cb('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x62cb('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x62cb('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x62cb('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x62cb('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x62cb('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x62cb('0xd')},'originalposition':{'type':Sequelize[_0x62cb('0xb')]},'channel':{'type':Sequelize[_0x62cb('0x2')]},'connectedlinenum':{'type':Sequelize[_0x62cb('0x2')]},'connectedlinename':{'type':Sequelize[_0x62cb('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x62cb('0x2')]},'exten':{'type':Sequelize[_0x62cb('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x62cb('0xb')]},'mohtime':{'type':Sequelize[_0x62cb('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x62cb('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x62cb('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x62cb('0x2')],'comment':_0x62cb('0xe')},'transferexten':{'type':Sequelize[_0x62cb('0x2')]},'transferuniqueid':{'type':Sequelize[_0x62cb('0x2')]},'disposition':{'type':Sequelize[_0x62cb('0x2')]},'secondDisposition':{'type':Sequelize[_0x62cb('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x62cb('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index b250e36..084e7bd 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 _0xbd9e=['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','sendStatus','status','undefined','limit','count','offset','set','json','apply','update','then','destroy','end','error','stack','name','send','VoiceQueueReport','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','map','VIRTUAL','options','includeAll','findAll','catch','show','include','find','create','body','params','describe','getVoiceQueuesReport','order','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse'];(function(_0x20b835,_0x5213f2){var _0x10c02c=function(_0xd31c4b){while(--_0xd31c4b){_0x20b835['push'](_0x20b835['shift']());}};_0x10c02c(++_0x5213f2);}(_0xbd9e,0x13b));var _0xebd9=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xbd9e[_0x599e60];return _0x468e19;};'use strict';var emlformat=require(_0xebd9('0x0'));var rimraf=require(_0xebd9('0x1'));var zipdir=require(_0xebd9('0x2'));var jsonpatch=require(_0xebd9('0x3'));var rp=require(_0xebd9('0x4'));var moment=require(_0xebd9('0x5'));var BPromise=require(_0xebd9('0x6'));var Mustache=require(_0xebd9('0x7'));var util=require(_0xebd9('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xebd9('0x9'));var ejs=require(_0xebd9('0xa'));var fs=require('fs');var fs_extra=require(_0xebd9('0xb'));var _=require(_0xebd9('0xc'));var squel=require(_0xebd9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xebd9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xebd9('0xf'));var Papa=require(_0xebd9('0x10'));var Redis=require(_0xebd9('0x11'));var authService=require(_0xebd9('0x12'));var qs=require(_0xebd9('0x13'));var as=require(_0xebd9('0x14'));var hardwareService=require(_0xebd9('0x15'));var logger=require(_0xebd9('0x16'))(_0xebd9('0x17'));var utils=require(_0xebd9('0x18'));var config=require(_0xebd9('0x19'));var licenseUtil=require(_0xebd9('0x1a'));var db=require(_0xebd9('0x1b'))['db'];config[_0xebd9('0x1c')]=_['defaults'](config[_0xebd9('0x1c')],{'host':_0xebd9('0x1d'),'port':0x18eb});var socket=require(_0xebd9('0x1e'))(new Redis(config[_0xebd9('0x1c')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x2f54a1,_0xa5f905){_0xa5f905=_0xa5f905||0xcc;return function(_0x3eda99){if(_0x3eda99){return _0x2f54a1[_0xebd9('0x1f')](_0xa5f905);}return _0x2f54a1[_0xebd9('0x20')](_0xa5f905)['end']();};}function respondWithResult(_0x4e6653,_0xec568e){_0xec568e=_0xec568e||0xc8;return function(_0x2f8c0d){if(_0x2f8c0d){return _0x4e6653[_0xebd9('0x20')](_0xec568e)['json'](_0x2f8c0d);}};}function respondWithFilteredResult(_0x342b6e,_0x500c21){return function(_0x1cef12){if(_0x1cef12){var _0x523a6a=typeof _0x500c21['offset']===_0xebd9('0x21')&&typeof _0x500c21[_0xebd9('0x22')]===_0xebd9('0x21');var _0x24b8b3=_0x1cef12[_0xebd9('0x23')];var _0x3d39c8=_0x523a6a?0x0:_0x500c21[_0xebd9('0x24')];var _0xdf7a57=_0x523a6a?_0x1cef12[_0xebd9('0x23')]:_0x500c21[_0xebd9('0x24')]+_0x500c21[_0xebd9('0x22')];var _0x2739d4;if(_0xdf7a57>=_0x24b8b3){_0xdf7a57=_0x24b8b3;_0x2739d4=0xc8;}else{_0x2739d4=0xce;}_0x342b6e['status'](_0x2739d4);return _0x342b6e[_0xebd9('0x25')]('Content-Range',_0x3d39c8+'-'+_0xdf7a57+'/'+_0x24b8b3)[_0xebd9('0x26')](_0x1cef12);}return null;};}function patchUpdates(_0x161fa1){return function(_0x3ba325){try{jsonpatch[_0xebd9('0x27')](_0x3ba325,_0x161fa1,!![]);}catch(_0x189bc1){return BPromise['reject'](_0x189bc1);}return _0x3ba325['save']();};}function saveUpdates(_0x32216a,_0x301815){return function(_0x5273ab){if(_0x5273ab){return _0x5273ab[_0xebd9('0x28')](_0x32216a)[_0xebd9('0x29')](function(_0x34cd12){return _0x34cd12;});}return null;};}function removeEntity(_0x2b30af,_0x436b38){return function(_0x2fe2cb){if(_0x2fe2cb){return _0x2fe2cb[_0xebd9('0x2a')]()[_0xebd9('0x29')](function(){_0x2b30af[_0xebd9('0x20')](0xcc)[_0xebd9('0x2b')]();});}};}function handleEntityNotFound(_0x3ab493,_0x20ba5e){return function(_0xaf07e){if(!_0xaf07e){_0x3ab493[_0xebd9('0x1f')](0x194);}return _0xaf07e;};}function handleError(_0x1cc035,_0x1449c1){_0x1449c1=_0x1449c1||0x1f4;return function(_0x32060){logger[_0xebd9('0x2c')](_0x32060[_0xebd9('0x2d')]);if(_0x32060[_0xebd9('0x2e')]){delete _0x32060['name'];}_0x1cc035[_0xebd9('0x20')](_0x1449c1)[_0xebd9('0x2f')](_0x32060);};}exports['index']=function(_0x386160,_0x45b7ef){var _0x5053fa={},_0x511c41={},_0x29a4d7={'count':0x0,'rows':[]};var _0x5a62f5=_['map'](db[_0xebd9('0x30')][_0xebd9('0x31')],function(_0x3d2ca3){return{'name':_0x3d2ca3[_0xebd9('0x32')],'type':_0x3d2ca3['type'][_0xebd9('0x33')]};});_0x511c41['model']=_['map'](_0x5a62f5,_0xebd9('0x2e'));_0x511c41[_0xebd9('0x34')]=_[_0xebd9('0x35')](_0x386160['query']);_0x511c41['filters']=_[_0xebd9('0x36')](_0x511c41[_0xebd9('0x37')],_0x511c41[_0xebd9('0x34')]);_0x5053fa[_0xebd9('0x38')]=_[_0xebd9('0x36')](_0x511c41[_0xebd9('0x37')],qs[_0xebd9('0x39')](_0x386160[_0xebd9('0x34')]['fields']));_0x5053fa[_0xebd9('0x38')]=_0x5053fa[_0xebd9('0x38')][_0xebd9('0x3a')]?_0x5053fa[_0xebd9('0x38')]:_0x511c41[_0xebd9('0x37')];if(!_0x386160[_0xebd9('0x34')][_0xebd9('0x3b')](_0xebd9('0x3c'))){_0x5053fa[_0xebd9('0x22')]=qs[_0xebd9('0x22')](_0x386160[_0xebd9('0x34')][_0xebd9('0x22')]);_0x5053fa['offset']=qs['offset'](_0x386160[_0xebd9('0x34')][_0xebd9('0x24')]);}_0x5053fa['order']=qs[_0xebd9('0x3d')](_0x386160[_0xebd9('0x34')][_0xebd9('0x3d')]);_0x5053fa['where']=qs['filters'](_[_0xebd9('0x3e')](_0x386160[_0xebd9('0x34')],_0x511c41[_0xebd9('0x3f')]),_0x5a62f5);if(_0x386160[_0xebd9('0x34')][_0xebd9('0x40')]){_0x5053fa[_0xebd9('0x41')]=_[_0xebd9('0x42')](_0x5053fa[_0xebd9('0x41')],{'$or':_[_0xebd9('0x43')](_0x5a62f5,function(_0x3a5ef4){if(_0x3a5ef4['type']!==_0xebd9('0x44')){var _0x383e63={};_0x383e63[_0x3a5ef4[_0xebd9('0x2e')]]={'$like':'%'+_0x386160['query'][_0xebd9('0x40')]+'%'};return _0x383e63;}})});}_0x5053fa=_['merge']({},_0x5053fa,_0x386160[_0xebd9('0x45')]);var _0x11ea4c={'where':_0x5053fa[_0xebd9('0x41')]};return db[_0xebd9('0x30')][_0xebd9('0x23')](_0x11ea4c)[_0xebd9('0x29')](function(_0x23b76b){_0x29a4d7[_0xebd9('0x23')]=_0x23b76b;if(_0x386160[_0xebd9('0x34')][_0xebd9('0x46')]){_0x5053fa['include']=[{'all':!![]}];}return db[_0xebd9('0x30')][_0xebd9('0x47')](_0x5053fa);})['then'](function(_0x3bc851){_0x29a4d7['rows']=_0x3bc851;return _0x29a4d7;})[_0xebd9('0x29')](respondWithFilteredResult(_0x45b7ef,_0x5053fa))[_0xebd9('0x48')](handleError(_0x45b7ef,null));};exports[_0xebd9('0x49')]=function(_0x3612e3,_0x2a61ff){var _0x5e0d44={'raw':![],'where':{'id':_0x3612e3['params']['id']}},_0x56a759={};_0x56a759[_0xebd9('0x37')]=_[_0xebd9('0x35')](db[_0xebd9('0x30')][_0xebd9('0x31')]);_0x56a759[_0xebd9('0x34')]=_[_0xebd9('0x35')](_0x3612e3['query']);_0x56a759['filters']=_['intersection'](_0x56a759[_0xebd9('0x37')],_0x56a759[_0xebd9('0x34')]);_0x5e0d44[_0xebd9('0x38')]=_[_0xebd9('0x36')](_0x56a759[_0xebd9('0x37')],qs[_0xebd9('0x39')](_0x3612e3[_0xebd9('0x34')][_0xebd9('0x39')]));_0x5e0d44[_0xebd9('0x38')]=_0x5e0d44[_0xebd9('0x38')][_0xebd9('0x3a')]?_0x5e0d44[_0xebd9('0x38')]:_0x56a759[_0xebd9('0x37')];if(_0x3612e3['query'][_0xebd9('0x46')]){_0x5e0d44[_0xebd9('0x4a')]=[{'all':!![]}];}_0x5e0d44=_[_0xebd9('0x42')]({},_0x5e0d44,_0x3612e3[_0xebd9('0x45')]);return db[_0xebd9('0x30')][_0xebd9('0x4b')](_0x5e0d44)[_0xebd9('0x29')](handleEntityNotFound(_0x2a61ff,null))[_0xebd9('0x29')](respondWithResult(_0x2a61ff,null))[_0xebd9('0x48')](handleError(_0x2a61ff,null));};exports['create']=function(_0x25d2ad,_0x4bc75f){return db[_0xebd9('0x30')][_0xebd9('0x4c')](_0x25d2ad['body'],{})[_0xebd9('0x29')](respondWithResult(_0x4bc75f,0xc9))['catch'](handleError(_0x4bc75f,null));};exports[_0xebd9('0x28')]=function(_0xf4a1de,_0x3001a3){if(_0xf4a1de[_0xebd9('0x4d')]['id']){delete _0xf4a1de['body']['id'];}return db['VoiceQueueReport'][_0xebd9('0x4b')]({'where':{'id':_0xf4a1de[_0xebd9('0x4e')]['id']}})[_0xebd9('0x29')](handleEntityNotFound(_0x3001a3,null))['then'](saveUpdates(_0xf4a1de[_0xebd9('0x4d')],null))[_0xebd9('0x29')](respondWithResult(_0x3001a3,null))['catch'](handleError(_0x3001a3,null));};exports[_0xebd9('0x2a')]=function(_0x390543,_0x4b3e72){return db[_0xebd9('0x30')][_0xebd9('0x4b')]({'where':{'id':_0x390543[_0xebd9('0x4e')]['id']}})[_0xebd9('0x29')](handleEntityNotFound(_0x4b3e72,null))['then'](removeEntity(_0x4b3e72,null))[_0xebd9('0x48')](handleError(_0x4b3e72,null));};exports[_0xebd9('0x4f')]=function(_0x41bf12,_0x240562){return db[_0xebd9('0x30')]['describe']()['then'](respondWithResult(_0x240562,null))[_0xebd9('0x48')](handleError(_0x240562,null));};exports[_0xebd9('0x50')]=function(_0x212dce,_0x297291){var _0x27ce24={},_0x1d73b1={},_0x547545={'count':0x0,'rows':[]};_0x1d73b1[_0xebd9('0x37')]=_[_0xebd9('0x35')](db['VoiceQueueReport'][_0xebd9('0x31')]);_0x1d73b1['query']=_[_0xebd9('0x35')](_0x212dce[_0xebd9('0x34')]);_0x1d73b1[_0xebd9('0x3f')]=_[_0xebd9('0x36')](_0x1d73b1['model'],_0x1d73b1[_0xebd9('0x34')]);_0x27ce24[_0xebd9('0x38')]=_['intersection'](_0x1d73b1[_0xebd9('0x37')],qs[_0xebd9('0x39')](_0x212dce[_0xebd9('0x34')][_0xebd9('0x39')]));_0x27ce24[_0xebd9('0x38')]=_0x27ce24['attributes'][_0xebd9('0x3a')]?_0x27ce24['attributes']:_0x1d73b1[_0xebd9('0x37')];if(!_0x212dce[_0xebd9('0x34')][_0xebd9('0x3b')](_0xebd9('0x3c'))){_0x27ce24[_0xebd9('0x22')]=qs[_0xebd9('0x22')](_0x212dce[_0xebd9('0x34')][_0xebd9('0x22')]);_0x27ce24[_0xebd9('0x24')]=qs[_0xebd9('0x24')](_0x212dce['query'][_0xebd9('0x24')]);}_0x27ce24[_0xebd9('0x51')]=qs['sort'](_0x212dce['query'][_0xebd9('0x3d')]);_0x27ce24[_0xebd9('0x41')]=qs[_0xebd9('0x3f')](_['pick'](_0x212dce[_0xebd9('0x34')],_0x1d73b1['filters']));if(_0x212dce[_0xebd9('0x34')][_0xebd9('0x40')]){_0x27ce24['where']=_['merge'](_0x27ce24['where'],{'$or':_[_0xebd9('0x43')](_0x27ce24[_0xebd9('0x38')],function(_0x52450d){var _0x54f6ee={};_0x54f6ee[_0x52450d]={'$like':'%'+_0x212dce[_0xebd9('0x34')][_0xebd9('0x40')]+'%'};return _0x54f6ee;})});}_0x27ce24=_[_0xebd9('0x42')]({},_0x27ce24,_0x212dce['options']);var _0x4fe94f={'where':_0x27ce24[_0xebd9('0x41')]};return db[_0xebd9('0x30')]['count'](_0x4fe94f)[_0xebd9('0x29')](function(_0x2808d7){_0x547545['count']=_0x2808d7;if(_0x212dce[_0xebd9('0x34')]['includeAll']){_0x27ce24[_0xebd9('0x4a')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xebd9('0x47')](_0x27ce24);})[_0xebd9('0x29')](function(_0x8db84c){_0x547545[_0xebd9('0x52')]=_0x8db84c;return _0x547545;})['then'](respondWithFilteredResult(_0x297291,_0x27ce24,_0xebd9('0x50')))[_0xebd9('0x48')](handleError(_0x297291,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0xaadd=['update','body','find','destroy','describe','getVoiceQueuesReport','hasOwnProperty','filter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','end','sendStatus','error','stack','name','send','index','map','fieldName','key','model','keys','filters','intersection','query','attributes','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','VoiceQueueReport','includeAll','include','findAll','rows','params','rawAttributes','fields','options','create','catch'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xaadd,0x1ac));var _0xdaad=function(_0xf9daca,_0x4a2fbd){_0xf9daca=_0xf9daca-0x0;var _0x2472de=_0xaadd[_0xf9daca];return _0x2472de;};'use strict';var emlformat=require(_0xdaad('0x0'));var rimraf=require(_0xdaad('0x1'));var zipdir=require(_0xdaad('0x2'));var jsonpatch=require(_0xdaad('0x3'));var rp=require(_0xdaad('0x4'));var moment=require(_0xdaad('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdaad('0x6'));var path=require('path');var sox=require(_0xdaad('0x7'));var csv=require('to-csv');var ejs=require(_0xdaad('0x8'));var fs=require('fs');var fs_extra=require(_0xdaad('0x9'));var _=require(_0xdaad('0xa'));var squel=require(_0xdaad('0xb'));var crypto=require('crypto');var jsforce=require(_0xdaad('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdaad('0xd'));var Redis=require(_0xdaad('0xe'));var authService=require(_0xdaad('0xf'));var qs=require(_0xdaad('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdaad('0x11'));var logger=require(_0xdaad('0x12'))(_0xdaad('0x13'));var utils=require('../../config/utils');var config=require(_0xdaad('0x14'));var licenseUtil=require(_0xdaad('0x15'));var db=require(_0xdaad('0x16'))['db'];config[_0xdaad('0x17')]=_[_0xdaad('0x18')](config['redis'],{'host':_0xdaad('0x19'),'port':0x18eb});var socket=require(_0xdaad('0x1a'))(new Redis(config[_0xdaad('0x17')]));require(_0xdaad('0x1b'))[_0xdaad('0x1c')](socket);function respondWithStatusCode(_0x9366ad,_0x5d9c7a){_0x5d9c7a=_0x5d9c7a||0xcc;return function(_0x38a5f4){if(_0x38a5f4){return _0x9366ad['sendStatus'](_0x5d9c7a);}return _0x9366ad[_0xdaad('0x1d')](_0x5d9c7a)['end']();};}function respondWithResult(_0x53718b,_0x4615e6){_0x4615e6=_0x4615e6||0xc8;return function(_0x374c7f){if(_0x374c7f){return _0x53718b['status'](_0x4615e6)[_0xdaad('0x1e')](_0x374c7f);}};}function respondWithFilteredResult(_0x55183d,_0x1e80a6){return function(_0x2ad81d){if(_0x2ad81d){var _0x5e4b40=typeof _0x1e80a6[_0xdaad('0x1f')]==='undefined'&&typeof _0x1e80a6[_0xdaad('0x20')]===_0xdaad('0x21');var _0x3b9647=_0x2ad81d[_0xdaad('0x22')];var _0x2489ef=_0x5e4b40?0x0:_0x1e80a6['offset'];var _0x4fdedc=_0x5e4b40?_0x2ad81d[_0xdaad('0x22')]:_0x1e80a6['offset']+_0x1e80a6['limit'];var _0x2c564e;if(_0x4fdedc>=_0x3b9647){_0x4fdedc=_0x3b9647;_0x2c564e=0xc8;}else{_0x2c564e=0xce;}_0x55183d[_0xdaad('0x1d')](_0x2c564e);return _0x55183d[_0xdaad('0x23')](_0xdaad('0x24'),_0x2489ef+'-'+_0x4fdedc+'/'+_0x3b9647)[_0xdaad('0x1e')](_0x2ad81d);}return null;};}function patchUpdates(_0x260c66){return function(_0x129911){try{jsonpatch['apply'](_0x129911,_0x260c66,!![]);}catch(_0x1f0839){return BPromise[_0xdaad('0x25')](_0x1f0839);}return _0x129911[_0xdaad('0x26')]();};}function saveUpdates(_0x6edbcb,_0x49ae36){return function(_0xd0506){if(_0xd0506){return _0xd0506['update'](_0x6edbcb)[_0xdaad('0x27')](function(_0x5b5e6c){return _0x5b5e6c;});}return null;};}function removeEntity(_0x25a04a,_0x4d0222){return function(_0x3aefdd){if(_0x3aefdd){return _0x3aefdd['destroy']()[_0xdaad('0x27')](function(){_0x25a04a[_0xdaad('0x1d')](0xcc)[_0xdaad('0x28')]();});}};}function handleEntityNotFound(_0x460eac,_0x2f09f3){return function(_0xce2c1c){if(!_0xce2c1c){_0x460eac[_0xdaad('0x29')](0x194);}return _0xce2c1c;};}function handleError(_0x443551,_0x2a5c24){_0x2a5c24=_0x2a5c24||0x1f4;return function(_0x13ae63){logger[_0xdaad('0x2a')](_0x13ae63[_0xdaad('0x2b')]);if(_0x13ae63[_0xdaad('0x2c')]){delete _0x13ae63[_0xdaad('0x2c')];}_0x443551[_0xdaad('0x1d')](_0x2a5c24)[_0xdaad('0x2d')](_0x13ae63);};}exports[_0xdaad('0x2e')]=function(_0x17eaaa,_0x1b4a66){var _0x4053f4={},_0x353a08={},_0x277c9d={'count':0x0,'rows':[]};var _0x582279=_[_0xdaad('0x2f')](db['VoiceQueueReport']['rawAttributes'],function(_0x4bd22b){return{'name':_0x4bd22b[_0xdaad('0x30')],'type':_0x4bd22b['type'][_0xdaad('0x31')]};});_0x353a08[_0xdaad('0x32')]=_['map'](_0x582279,_0xdaad('0x2c'));_0x353a08['query']=_[_0xdaad('0x33')](_0x17eaaa['query']);_0x353a08[_0xdaad('0x34')]=_[_0xdaad('0x35')](_0x353a08[_0xdaad('0x32')],_0x353a08[_0xdaad('0x36')]);_0x4053f4['attributes']=_[_0xdaad('0x35')](_0x353a08[_0xdaad('0x32')],qs['fields'](_0x17eaaa[_0xdaad('0x36')]['fields']));_0x4053f4[_0xdaad('0x37')]=_0x4053f4['attributes'][_0xdaad('0x38')]?_0x4053f4[_0xdaad('0x37')]:_0x353a08[_0xdaad('0x32')];if(!_0x17eaaa[_0xdaad('0x36')]['hasOwnProperty'](_0xdaad('0x39'))){_0x4053f4[_0xdaad('0x20')]=qs[_0xdaad('0x20')](_0x17eaaa[_0xdaad('0x36')][_0xdaad('0x20')]);_0x4053f4['offset']=qs['offset'](_0x17eaaa[_0xdaad('0x36')][_0xdaad('0x1f')]);}_0x4053f4[_0xdaad('0x3a')]=qs[_0xdaad('0x3b')](_0x17eaaa['query'][_0xdaad('0x3b')]);_0x4053f4[_0xdaad('0x3c')]=qs[_0xdaad('0x34')](_[_0xdaad('0x3d')](_0x17eaaa[_0xdaad('0x36')],_0x353a08[_0xdaad('0x34')]),_0x582279);if(_0x17eaaa['query']['filter']){_0x4053f4['where']=_[_0xdaad('0x3e')](_0x4053f4[_0xdaad('0x3c')],{'$or':_['map'](_0x582279,function(_0x4d9a2b){if(_0x4d9a2b[_0xdaad('0x3f')]!==_0xdaad('0x40')){var _0x500891={};_0x500891[_0x4d9a2b[_0xdaad('0x2c')]]={'$like':'%'+_0x17eaaa[_0xdaad('0x36')]['filter']+'%'};return _0x500891;}})});}_0x4053f4=_[_0xdaad('0x3e')]({},_0x4053f4,_0x17eaaa['options']);var _0x4153aa={'where':_0x4053f4[_0xdaad('0x3c')]};return db[_0xdaad('0x41')]['count'](_0x4153aa)[_0xdaad('0x27')](function(_0xfd9717){_0x277c9d[_0xdaad('0x22')]=_0xfd9717;if(_0x17eaaa['query'][_0xdaad('0x42')]){_0x4053f4[_0xdaad('0x43')]=[{'all':!![]}];}return db[_0xdaad('0x41')][_0xdaad('0x44')](_0x4053f4);})[_0xdaad('0x27')](function(_0x5b1a93){_0x277c9d[_0xdaad('0x45')]=_0x5b1a93;return _0x277c9d;})['then'](respondWithFilteredResult(_0x1b4a66,_0x4053f4))['catch'](handleError(_0x1b4a66,null));};exports['show']=function(_0x5861a7,_0x53d0d6){var _0x333e0b={'raw':![],'where':{'id':_0x5861a7[_0xdaad('0x46')]['id']}},_0x4124de={};_0x4124de['model']=_[_0xdaad('0x33')](db['VoiceQueueReport'][_0xdaad('0x47')]);_0x4124de[_0xdaad('0x36')]=_['keys'](_0x5861a7[_0xdaad('0x36')]);_0x4124de['filters']=_['intersection'](_0x4124de[_0xdaad('0x32')],_0x4124de[_0xdaad('0x36')]);_0x333e0b[_0xdaad('0x37')]=_[_0xdaad('0x35')](_0x4124de[_0xdaad('0x32')],qs[_0xdaad('0x48')](_0x5861a7[_0xdaad('0x36')][_0xdaad('0x48')]));_0x333e0b[_0xdaad('0x37')]=_0x333e0b[_0xdaad('0x37')][_0xdaad('0x38')]?_0x333e0b[_0xdaad('0x37')]:_0x4124de[_0xdaad('0x32')];if(_0x5861a7['query'][_0xdaad('0x42')]){_0x333e0b['include']=[{'all':!![]}];}_0x333e0b=_[_0xdaad('0x3e')]({},_0x333e0b,_0x5861a7[_0xdaad('0x49')]);return db[_0xdaad('0x41')]['find'](_0x333e0b)[_0xdaad('0x27')](handleEntityNotFound(_0x53d0d6,null))['then'](respondWithResult(_0x53d0d6,null))['catch'](handleError(_0x53d0d6,null));};exports[_0xdaad('0x4a')]=function(_0xc82863,_0x14a2b7){return db[_0xdaad('0x41')][_0xdaad('0x4a')](_0xc82863['body'],{})[_0xdaad('0x27')](respondWithResult(_0x14a2b7,0xc9))[_0xdaad('0x4b')](handleError(_0x14a2b7,null));};exports[_0xdaad('0x4c')]=function(_0x234e30,_0x41ddbe){if(_0x234e30[_0xdaad('0x4d')]['id']){delete _0x234e30[_0xdaad('0x4d')]['id'];}return db[_0xdaad('0x41')][_0xdaad('0x4e')]({'where':{'id':_0x234e30['params']['id']}})['then'](handleEntityNotFound(_0x41ddbe,null))['then'](saveUpdates(_0x234e30['body'],null))[_0xdaad('0x27')](respondWithResult(_0x41ddbe,null))[_0xdaad('0x4b')](handleError(_0x41ddbe,null));};exports[_0xdaad('0x4f')]=function(_0x516c75,_0x6225f6){return db[_0xdaad('0x41')]['find']({'where':{'id':_0x516c75['params']['id']}})[_0xdaad('0x27')](handleEntityNotFound(_0x6225f6,null))[_0xdaad('0x27')](removeEntity(_0x6225f6,null))[_0xdaad('0x4b')](handleError(_0x6225f6,null));};exports['describe']=function(_0x2add64,_0x3995a4){return db[_0xdaad('0x41')][_0xdaad('0x50')]()[_0xdaad('0x27')](respondWithResult(_0x3995a4,null))[_0xdaad('0x4b')](handleError(_0x3995a4,null));};exports[_0xdaad('0x51')]=function(_0xe9500d,_0x31217a){var _0x5b7de3={},_0x594935={},_0x37bca9={'count':0x0,'rows':[]};_0x594935[_0xdaad('0x32')]=_[_0xdaad('0x33')](db['VoiceQueueReport']['rawAttributes']);_0x594935['query']=_[_0xdaad('0x33')](_0xe9500d[_0xdaad('0x36')]);_0x594935[_0xdaad('0x34')]=_['intersection'](_0x594935[_0xdaad('0x32')],_0x594935[_0xdaad('0x36')]);_0x5b7de3[_0xdaad('0x37')]=_['intersection'](_0x594935[_0xdaad('0x32')],qs['fields'](_0xe9500d[_0xdaad('0x36')][_0xdaad('0x48')]));_0x5b7de3['attributes']=_0x5b7de3[_0xdaad('0x37')]['length']?_0x5b7de3[_0xdaad('0x37')]:_0x594935[_0xdaad('0x32')];if(!_0xe9500d[_0xdaad('0x36')][_0xdaad('0x52')](_0xdaad('0x39'))){_0x5b7de3[_0xdaad('0x20')]=qs[_0xdaad('0x20')](_0xe9500d[_0xdaad('0x36')][_0xdaad('0x20')]);_0x5b7de3[_0xdaad('0x1f')]=qs[_0xdaad('0x1f')](_0xe9500d[_0xdaad('0x36')][_0xdaad('0x1f')]);}_0x5b7de3[_0xdaad('0x3a')]=qs['sort'](_0xe9500d[_0xdaad('0x36')][_0xdaad('0x3b')]);_0x5b7de3[_0xdaad('0x3c')]=qs[_0xdaad('0x34')](_[_0xdaad('0x3d')](_0xe9500d['query'],_0x594935['filters']));if(_0xe9500d['query']['filter']){_0x5b7de3[_0xdaad('0x3c')]=_[_0xdaad('0x3e')](_0x5b7de3['where'],{'$or':_[_0xdaad('0x2f')](_0x5b7de3[_0xdaad('0x37')],function(_0x5990c8){var _0x467bf6={};_0x467bf6[_0x5990c8]={'$like':'%'+_0xe9500d[_0xdaad('0x36')][_0xdaad('0x53')]+'%'};return _0x467bf6;})});}_0x5b7de3=_[_0xdaad('0x3e')]({},_0x5b7de3,_0xe9500d[_0xdaad('0x49')]);var _0x2bbc22={'where':_0x5b7de3[_0xdaad('0x3c')]};return db[_0xdaad('0x41')]['count'](_0x2bbc22)['then'](function(_0x25e402){_0x37bca9[_0xdaad('0x22')]=_0x25e402;if(_0xe9500d[_0xdaad('0x36')][_0xdaad('0x42')]){_0x5b7de3['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x5b7de3);})['then'](function(_0x2cfb68){_0x37bca9['rows']=_0x2cfb68;return _0x37bca9;})['then'](respondWithFilteredResult(_0x31217a,_0x5b7de3,_0xdaad('0x51')))[_0xdaad('0x4b')](handleError(_0x31217a,null,_0xdaad('0x51')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 8090449..fd806b3 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 _0x8aef=['exports','events','VoiceQueueReport','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x49a267,_0x460d06){var _0x640a8d=function(_0x1bb96d){while(--_0x1bb96d){_0x49a267['push'](_0x49a267['shift']());}};_0x640a8d(++_0x460d06);}(_0x8aef,0x1e7));var _0xf8ae=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x8aef[_0xb0f7c3];return _0x28ea68;};'use strict';var EventEmitter=require(_0xf8ae('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xf8ae('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf8ae('0x2'),'afterUpdate':_0xf8ae('0x3'),'afterDestroy':_0xf8ae('0x4')};function emitEvent(_0x5e0bd4){return function(_0x55693d,_0x560cdd,_0x1948ca){VoiceQueueReportEvents[_0xf8ae('0x5')](_0x5e0bd4+':'+_0x55693d['id'],_0x55693d);VoiceQueueReportEvents[_0xf8ae('0x5')](_0x5e0bd4,_0x55693d);_0x1948ca(null);};}for(var e in events){if(events[_0xf8ae('0x6')](e)){var event=events[e];VoiceQueueReport[_0xf8ae('0x7')](e,emitEvent(event));}}module[_0xf8ae('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x25b8=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x34c027,_0x123688){var _0x47bff0=function(_0x19c4a9){while(--_0x19c4a9){_0x34c027['push'](_0x34c027['shift']());}};_0x47bff0(++_0x123688);}(_0x25b8,0x6b));var _0x825b=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x25b8[_0xbe200f];return _0x192597;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x825b('0x0'))['db'][_0x825b('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x825b('0x2')](0x0);var events={'afterCreate':_0x825b('0x3'),'afterUpdate':_0x825b('0x4'),'afterDestroy':_0x825b('0x5')};function emitEvent(_0x53f061){return function(_0x539e1,_0x4a83cc,_0x9f5f48){VoiceQueueReportEvents[_0x825b('0x6')](_0x53f061+':'+_0x539e1['id'],_0x539e1);VoiceQueueReportEvents[_0x825b('0x6')](_0x53f061,_0x539e1);_0x9f5f48(null);};}for(var e in events){if(events[_0x825b('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x825b('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 7f7e567..b6cc904 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 _0xefc9=['../../config/logger','api','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','uniqueid','calleridnum','lodash','util'];(function(_0x1a7f47,_0x1e4c21){var _0x191662=function(_0xf35c24){while(--_0xf35c24){_0x1a7f47['push'](_0x1a7f47['shift']());}};_0x191662(++_0x1e4c21);}(_0xefc9,0x9a));var _0x9efc=function(_0x546dc1,_0x18607e){_0x546dc1=_0x546dc1-0x0;var _0x2b0046=_0xefc9[_0x546dc1];return _0x2b0046;};'use strict';var _=require(_0x9efc('0x0'));var util=require(_0x9efc('0x1'));var logger=require(_0x9efc('0x2'))(_0x9efc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9efc('0x4'));var fs=require('fs');var path=require(_0x9efc('0x5'));var rimraf=require('rimraf');var config=require(_0x9efc('0x6'));var attributes=require(_0x9efc('0x7'));module[_0x9efc('0x8')]=function(_0x4e998a,_0x2e01be){return _0x4e998a['define'](_0x9efc('0x9'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x9efc('0xa')]},{'fields':[_0x9efc('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8904=['./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0x8904,0xe3));var _0x4890=function(_0x3def38,_0x310497){_0x3def38=_0x3def38-0x0;var _0x1694ad=_0x8904[_0x3def38];return _0x1694ad;};'use strict';var _=require('lodash');var util=require(_0x4890('0x0'));var logger=require(_0x4890('0x1'))(_0x4890('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4890('0x3'));var fs=require('fs');var path=require(_0x4890('0x4'));var rimraf=require(_0x4890('0x5'));var config=require(_0x4890('0x6'));var attributes=require(_0x4890('0x7'));module[_0x4890('0x8')]=function(_0x11f0c4,_0x6e9800){return _0x11f0c4[_0x4890('0x9')]('VoiceQueueReport',attributes,{'tableName':_0x4890('0xa'),'paranoid':![],'indexes':[{'fields':[_0x4890('0xb')]},{'fields':[_0x4890('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index d37b722..ff4f54b 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 _0x9e27=['error','code','message','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueueReport','stringify','VoiceQueueReport','create','body','CreateVoiceQueueReport','update','UpdateVoiceQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x11d98a,_0x33d749){var _0x23a48c=function(_0x46df05){while(--_0x46df05){_0x11d98a['push'](_0x11d98a['shift']());}};_0x23a48c(++_0x33d749);}(_0x9e27,0xc1));var _0x79e2=function(_0x25e38c,_0x33e653){_0x25e38c=_0x25e38c-0x0;var _0x2fc2a7=_0x9e27[_0x25e38c];return _0x2fc2a7;};'use strict';var _=require(_0x79e2('0x0'));var util=require(_0x79e2('0x1'));var moment=require(_0x79e2('0x2'));var BPromise=require(_0x79e2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79e2('0x4'));var db=require(_0x79e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x79e2('0x6'))('rpc');var config=require(_0x79e2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x79e2('0x8')][_0x79e2('0x9')]({'port':0x232a});config[_0x79e2('0xa')]=_[_0x79e2('0xb')](config['redis'],{'host':_0x79e2('0xc'),'port':0x18eb});var socket=require(_0x79e2('0xd'))(new Redis(config[_0x79e2('0xa')]));require(_0x79e2('0xe'))[_0x79e2('0xf')](socket);function respondWithRpcPromise(_0x5ee10f,_0x341183,_0xa88c11){return new BPromise(function(_0x163c14,_0x4b769a){return client['request'](_0x5ee10f,_0xa88c11)[_0x79e2('0x10')](function(_0x329ec3){logger[_0x79e2('0x11')](_0x79e2('0x12'),_0x341183,'request\x20sent');logger[_0x79e2('0x13')](_0x79e2('0x14'),_0x341183,_0x79e2('0x15'),JSON['stringify'](_0x329ec3));if(_0x329ec3[_0x79e2('0x16')]){if(_0x329ec3[_0x79e2('0x16')][_0x79e2('0x17')]===0x1f4){logger['error'](_0x79e2('0x12'),_0x341183,_0x329ec3['error'][_0x79e2('0x18')]);return _0x4b769a(_0x329ec3[_0x79e2('0x16')]['message']);}logger[_0x79e2('0x16')](_0x79e2('0x12'),_0x341183,_0x329ec3[_0x79e2('0x16')]['message']);return _0x163c14(_0x329ec3[_0x79e2('0x16')][_0x79e2('0x18')]);}else{logger[_0x79e2('0x11')](_0x79e2('0x12'),_0x341183,_0x79e2('0x15'));_0x163c14(_0x329ec3['result'][_0x79e2('0x18')]);}})[_0x79e2('0x19')](function(_0x376646){logger[_0x79e2('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x341183,_0x376646);_0x4b769a(_0x376646);});});}exports['GetVoiceQueueReport']=function(_0x2dbaa4){var _0x45e871=this;return new Promise(function(_0x26993f,_0x2c8d09){return db['VoiceQueueReport'][_0x79e2('0x1a')]({'raw':_0x2dbaa4['options']?_0x2dbaa4[_0x79e2('0x1b')][_0x79e2('0x1c')]===undefined?!![]:![]:!![],'where':_0x2dbaa4['options']?_0x2dbaa4[_0x79e2('0x1b')][_0x79e2('0x1d')]||null:null,'attributes':_0x2dbaa4[_0x79e2('0x1b')]?_0x2dbaa4[_0x79e2('0x1b')][_0x79e2('0x1e')]||null:null,'limit':_0x2dbaa4[_0x79e2('0x1b')]?_0x2dbaa4['options'][_0x79e2('0x1f')]||null:null,'include':_0x2dbaa4['options']?_0x2dbaa4[_0x79e2('0x1b')][_0x79e2('0x20')]?_['map'](_0x2dbaa4[_0x79e2('0x1b')]['include'],function(_0x583f0c){return{'model':db[_0x583f0c['model']],'as':_0x583f0c['as'],'attributes':_0x583f0c[_0x79e2('0x1e')],'include':_0x583f0c[_0x79e2('0x20')]?_[_0x79e2('0x21')](_0x583f0c[_0x79e2('0x20')],function(_0x1783ef){return{'model':db[_0x1783ef[_0x79e2('0x22')]],'as':_0x1783ef['as'],'attributes':_0x1783ef[_0x79e2('0x1e')],'include':_0x1783ef[_0x79e2('0x20')]?_[_0x79e2('0x21')](_0x1783ef[_0x79e2('0x20')],function(_0x9fca4d){return{'model':db[_0x9fca4d[_0x79e2('0x22')]],'as':_0x9fca4d['as'],'attributes':_0x9fca4d[_0x79e2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x79e2('0x10')](function(_0x17712){logger[_0x79e2('0x11')](_0x79e2('0x23'),_0x2dbaa4);logger['debug'](_0x79e2('0x23'),_0x2dbaa4,JSON[_0x79e2('0x24')](_0x17712));_0x26993f(_0x17712);})['catch'](function(_0x3fcd2d){logger[_0x79e2('0x16')]('GetVoiceQueueReport',_0x3fcd2d[_0x79e2('0x18')],_0x2dbaa4);_0x2c8d09(_0x45e871['error'](0x1f4,_0x3fcd2d['message']));});});};exports['CreateVoiceQueueReport']=function(_0xc5fb5a){var _0x1065a4=this;return new Promise(function(_0x1d4759,_0x1d7bf0){return db[_0x79e2('0x25')][_0x79e2('0x26')](_0xc5fb5a[_0x79e2('0x27')],{'raw':_0xc5fb5a[_0x79e2('0x1b')]?_0xc5fb5a[_0x79e2('0x1b')][_0x79e2('0x1c')]===undefined?!![]:![]:!![]})[_0x79e2('0x10')](function(_0x331a82){logger[_0x79e2('0x11')](_0x79e2('0x28'),_0xc5fb5a);logger['debug'](_0x79e2('0x28'),_0xc5fb5a,JSON[_0x79e2('0x24')](_0x331a82));_0x1d4759(_0x331a82);})[_0x79e2('0x19')](function(_0x3b5d59){logger[_0x79e2('0x16')](_0x79e2('0x28'),_0x3b5d59['message'],_0xc5fb5a);_0x1d7bf0(_0x1065a4['error'](0x1f4,_0x3b5d59[_0x79e2('0x18')]));});});};exports['UpdateVoiceQueueReport']=function(_0x3f8e59){var _0x36a875=this;return new Promise(function(_0x41a6b9,_0x243956){return db[_0x79e2('0x25')][_0x79e2('0x29')](_0x3f8e59['body'],{'raw':_0x3f8e59['options']?_0x3f8e59['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f8e59[_0x79e2('0x1b')]?_0x3f8e59['options'][_0x79e2('0x1d')]||null:null,'attributes':_0x3f8e59[_0x79e2('0x1b')]?_0x3f8e59[_0x79e2('0x1b')][_0x79e2('0x1e')]||null:null,'limit':_0x3f8e59['options']?_0x3f8e59['options'][_0x79e2('0x1f')]||null:null})[_0x79e2('0x10')](function(_0x479460){logger['info'](_0x79e2('0x2a'),_0x3f8e59);logger[_0x79e2('0x13')]('UpdateVoiceQueueReport',_0x3f8e59,JSON['stringify'](_0x479460));_0x41a6b9(_0x479460);})[_0x79e2('0x19')](function(_0x580542){logger['error'](_0x79e2('0x2a'),_0x580542[_0x79e2('0x18')],_0x3f8e59);_0x243956(_0x36a875['error'](0x1f4,_0x580542[_0x79e2('0x18')]));});});}; \ No newline at end of file +var _0x10f9=['defaults','./voiceQueueReport.socket','register','request','then','info','request\x20sent','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','map','include','model','debug','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis'];(function(_0x270fea,_0x10600d){var _0x207693=function(_0x1b4ec9){while(--_0x1b4ec9){_0x270fea['push'](_0x270fea['shift']());}};_0x207693(++_0x10600d);}(_0x10f9,0xe0));var _0x910f=function(_0x3867ca,_0x2660a3){_0x3867ca=_0x3867ca-0x0;var _0x1e271d=_0x10f9[_0x3867ca];return _0x1e271d;};'use strict';var _=require('lodash');var util=require(_0x910f('0x0'));var moment=require('moment');var BPromise=require(_0x910f('0x1'));var rs=require(_0x910f('0x2'));var fs=require('fs');var Redis=require(_0x910f('0x3'));var db=require(_0x910f('0x4'))['db'];var utils=require(_0x910f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x910f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x910f('0x7')][_0x910f('0x8')]({'port':0x232a});config[_0x910f('0x9')]=_[_0x910f('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x910f('0x9')]));require(_0x910f('0xb'))[_0x910f('0xc')](socket);function respondWithRpcPromise(_0x238018,_0x5bbe57,_0x443df4){return new BPromise(function(_0x303a2b,_0x2c4cd0){return client[_0x910f('0xd')](_0x238018,_0x443df4)[_0x910f('0xe')](function(_0x2f9b42){logger[_0x910f('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x5bbe57,_0x910f('0x10'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x5bbe57,'request\x20sent',JSON[_0x910f('0x11')](_0x2f9b42));if(_0x2f9b42[_0x910f('0x12')]){if(_0x2f9b42[_0x910f('0x12')][_0x910f('0x13')]===0x1f4){logger['error'](_0x910f('0x14'),_0x5bbe57,_0x2f9b42['error'][_0x910f('0x15')]);return _0x2c4cd0(_0x2f9b42['error'][_0x910f('0x15')]);}logger['error'](_0x910f('0x14'),_0x5bbe57,_0x2f9b42[_0x910f('0x12')][_0x910f('0x15')]);return _0x303a2b(_0x2f9b42[_0x910f('0x12')][_0x910f('0x15')]);}else{logger[_0x910f('0xf')](_0x910f('0x14'),_0x5bbe57,'request\x20sent');_0x303a2b(_0x2f9b42['result'][_0x910f('0x15')]);}})[_0x910f('0x16')](function(_0xb1d8e8){logger[_0x910f('0x12')](_0x910f('0x14'),_0x5bbe57,_0xb1d8e8);_0x2c4cd0(_0xb1d8e8);});});}exports[_0x910f('0x17')]=function(_0x47e2cc){var _0x2e923b=this;return new Promise(function(_0x389ea2,_0x15a901){return db[_0x910f('0x18')][_0x910f('0x19')]({'raw':_0x47e2cc[_0x910f('0x1a')]?_0x47e2cc[_0x910f('0x1a')][_0x910f('0x1b')]===undefined?!![]:![]:!![],'where':_0x47e2cc[_0x910f('0x1a')]?_0x47e2cc[_0x910f('0x1a')][_0x910f('0x1c')]||null:null,'attributes':_0x47e2cc[_0x910f('0x1a')]?_0x47e2cc['options'][_0x910f('0x1d')]||null:null,'limit':_0x47e2cc[_0x910f('0x1a')]?_0x47e2cc['options'][_0x910f('0x1e')]||null:null,'include':_0x47e2cc[_0x910f('0x1a')]?_0x47e2cc['options']['include']?_[_0x910f('0x1f')](_0x47e2cc[_0x910f('0x1a')][_0x910f('0x20')],function(_0x53ced2){return{'model':db[_0x53ced2[_0x910f('0x21')]],'as':_0x53ced2['as'],'attributes':_0x53ced2[_0x910f('0x1d')],'include':_0x53ced2[_0x910f('0x20')]?_[_0x910f('0x1f')](_0x53ced2[_0x910f('0x20')],function(_0x3238b2){return{'model':db[_0x3238b2[_0x910f('0x21')]],'as':_0x3238b2['as'],'attributes':_0x3238b2['attributes'],'include':_0x3238b2[_0x910f('0x20')]?_['map'](_0x3238b2['include'],function(_0x447df0){return{'model':db[_0x447df0[_0x910f('0x21')]],'as':_0x447df0['as'],'attributes':_0x447df0[_0x910f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x910f('0xe')](function(_0x393dcd){logger[_0x910f('0xf')](_0x910f('0x17'),_0x47e2cc);logger[_0x910f('0x22')](_0x910f('0x17'),_0x47e2cc,JSON[_0x910f('0x11')](_0x393dcd));_0x389ea2(_0x393dcd);})[_0x910f('0x16')](function(_0x545854){logger['error'](_0x910f('0x17'),_0x545854[_0x910f('0x15')],_0x47e2cc);_0x15a901(_0x2e923b[_0x910f('0x12')](0x1f4,_0x545854[_0x910f('0x15')]));});});};exports[_0x910f('0x23')]=function(_0x530c54){var _0x4f2422=this;return new Promise(function(_0x5e4223,_0x383bc8){return db[_0x910f('0x18')][_0x910f('0x24')](_0x530c54[_0x910f('0x25')],{'raw':_0x530c54[_0x910f('0x1a')]?_0x530c54[_0x910f('0x1a')][_0x910f('0x1b')]===undefined?!![]:![]:!![]})[_0x910f('0xe')](function(_0x43e740){logger[_0x910f('0xf')](_0x910f('0x23'),_0x530c54);logger[_0x910f('0x22')](_0x910f('0x23'),_0x530c54,JSON[_0x910f('0x11')](_0x43e740));_0x5e4223(_0x43e740);})[_0x910f('0x16')](function(_0x3915b8){logger[_0x910f('0x12')](_0x910f('0x23'),_0x3915b8[_0x910f('0x15')],_0x530c54);_0x383bc8(_0x4f2422[_0x910f('0x12')](0x1f4,_0x3915b8[_0x910f('0x15')]));});});};exports['UpdateVoiceQueueReport']=function(_0x7253e2){var _0x54a858=this;return new Promise(function(_0x3f1984,_0x32a5c5){return db[_0x910f('0x18')]['update'](_0x7253e2['body'],{'raw':_0x7253e2['options']?_0x7253e2[_0x910f('0x1a')][_0x910f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7253e2[_0x910f('0x1a')]?_0x7253e2['options'][_0x910f('0x1c')]||null:null,'attributes':_0x7253e2['options']?_0x7253e2[_0x910f('0x1a')][_0x910f('0x1d')]||null:null,'limit':_0x7253e2[_0x910f('0x1a')]?_0x7253e2[_0x910f('0x1a')][_0x910f('0x1e')]||null:null})[_0x910f('0xe')](function(_0x4b5214){logger[_0x910f('0xf')](_0x910f('0x26'),_0x7253e2);logger['debug'](_0x910f('0x26'),_0x7253e2,JSON['stringify'](_0x4b5214));_0x3f1984(_0x4b5214);})[_0x910f('0x16')](function(_0x26d664){logger[_0x910f('0x12')](_0x910f('0x26'),_0x26d664[_0x910f('0x15')],_0x7253e2);_0x32a5c5(_0x54a858['error'](0x1f4,_0x26d664[_0x910f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 0e9edb4..d754ac4 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 _0x158f=['register','length','voiceQueueReport:','save','remove','update','emit'];(function(_0x3a3758,_0x4dd8cf){var _0x1a9234=function(_0x3dda22){while(--_0x3dda22){_0x3a3758['push'](_0x3a3758['shift']());}};_0x1a9234(++_0x4dd8cf);}(_0x158f,0x137));var _0xf158=function(_0x2780a0,_0x232b7f){_0x2780a0=_0x2780a0-0x0;var _0x1c9106=_0x158f[_0x2780a0];return _0x1c9106;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xf158('0x0'),_0xf158('0x1'),_0xf158('0x2')];function createListener(_0x6c3ff4,_0x1bbba1){return function(_0x150b19){_0x1bbba1[_0xf158('0x3')](_0x6c3ff4,_0x150b19);};}function removeListener(_0x5ea49a,_0x29a06){return function(){VoiceQueueReportEvents['removeListener'](_0x5ea49a,_0x29a06);};}exports[_0xf158('0x4')]=function(_0xb84ee0){for(var _0x178e85=0x0,_0x23ff44=events[_0xf158('0x5')];_0x178e85<_0x23ff44;_0x178e85++){var _0x2a24a7=events[_0x178e85];var _0x395f69=createListener(_0xf158('0x6')+_0x2a24a7,_0xb84ee0);VoiceQueueReportEvents['on'](_0x2a24a7,_0x395f69);}}; \ No newline at end of file +var _0xf4e5=['length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','removeListener'];(function(_0x254108,_0x51f6fa){var _0x49ce2a=function(_0x316f98){while(--_0x316f98){_0x254108['push'](_0x254108['shift']());}};_0x49ce2a(++_0x51f6fa);}(_0xf4e5,0xd4));var _0x5f4e=function(_0x41b0fd,_0x4365a7){_0x41b0fd=_0x41b0fd-0x0;var _0x37ad5d=_0xf4e5[_0x41b0fd];return _0x37ad5d;};'use strict';var VoiceQueueReportEvents=require(_0x5f4e('0x0'));var events=[_0x5f4e('0x1'),_0x5f4e('0x2'),_0x5f4e('0x3')];function createListener(_0x36c770,_0x43d432){return function(_0x52405b){_0x43d432['emit'](_0x36c770,_0x52405b);};}function removeListener(_0x29b49f,_0x3f489b){return function(){VoiceQueueReportEvents[_0x5f4e('0x4')](_0x29b49f,_0x3f489b);};}exports['register']=function(_0x1cff58){for(var _0x44e9e4=0x0,_0x3307df=events[_0x5f4e('0x5')];_0x44e9e4<_0x3307df;_0x44e9e4++){var _0x29199a=events[_0x44e9e4];var _0x223ef1=createListener(_0x5f4e('0x6')+_0x29199a,_0x1cff58);VoiceQueueReportEvents['on'](_0x29199a,_0x223ef1);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 3690069..8b9e015 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 _0xe1df=['post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','show'];(function(_0x30b62f,_0x58e182){var _0x598984=function(_0x34dc76){while(--_0x34dc76){_0x30b62f['push'](_0x30b62f['shift']());}};_0x598984(++_0x58e182);}(_0xe1df,0x120));var _0xfe1d=function(_0x45097f,_0x1426d0){_0x45097f=_0x45097f-0x0;var _0x3de484=_0xe1df[_0x45097f];return _0x3de484;};'use strict';var multer=require(_0xfe1d('0x0'));var util=require(_0xfe1d('0x1'));var path=require(_0xfe1d('0x2'));var timeout=require(_0xfe1d('0x3'));var express=require(_0xfe1d('0x4'));var router=express[_0xfe1d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfe1d('0x6'));var config=require(_0xfe1d('0x7'));var controller=require(_0xfe1d('0x8'));router[_0xfe1d('0x9')]('/',auth[_0xfe1d('0xa')](),controller['index']);router[_0xfe1d('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xfe1d('0xb')]);router[_0xfe1d('0xc')]('/',auth[_0xfe1d('0xa')](),controller[_0xfe1d('0xd')]);router[_0xfe1d('0xe')](_0xfe1d('0xf'),auth[_0xfe1d('0xa')](),controller[_0xfe1d('0x10')]);router[_0xfe1d('0x11')]('/:id',auth[_0xfe1d('0xa')](),controller[_0xfe1d('0x12')]);module[_0xfe1d('0x13')]=router; \ No newline at end of file +var _0x5e57=['show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id'];(function(_0x10a212,_0x579d85){var _0x23c82b=function(_0x412ea9){while(--_0x412ea9){_0x10a212['push'](_0x10a212['shift']());}};_0x23c82b(++_0x579d85);}(_0x5e57,0x170));var _0x75e5=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5e57[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x75e5('0x0'));var util=require('util');var path=require(_0x75e5('0x1'));var timeout=require(_0x75e5('0x2'));var express=require('express');var router=express[_0x75e5('0x3')]();var fs_extra=require(_0x75e5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75e5('0x5'));var config=require(_0x75e5('0x6'));var controller=require(_0x75e5('0x7'));router[_0x75e5('0x8')]('/',auth[_0x75e5('0x9')](),controller[_0x75e5('0xa')]);router[_0x75e5('0x8')](_0x75e5('0xb'),auth['isAuthenticated'](),controller[_0x75e5('0xc')]);router[_0x75e5('0xd')]('/',auth[_0x75e5('0x9')](),controller['create']);router[_0x75e5('0xe')](_0x75e5('0xb'),auth[_0x75e5('0x9')](),controller[_0x75e5('0xf')]);router[_0x75e5('0x10')](_0x75e5('0xb'),auth[_0x75e5('0x9')](),controller[_0x75e5('0x11')]);module[_0x75e5('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 26c04ee..472a197 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 _0x14e6=['sequelize','moment','exports','STRING','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x4d658d,_0x2c169f){var _0x36d676=function(_0x483994){while(--_0x483994){_0x4d658d['push'](_0x4d658d['shift']());}};_0x36d676(++_0x2c169f);}(_0x14e6,0x6e));var _0x614e=function(_0x42e675,_0x4f24ef){_0x42e675=_0x42e675-0x0;var _0x1e18b9=_0x14e6[_0x42e675];return _0x1e18b9;};'use strict';var Sequelize=require(_0x614e('0x0'));var moment=require(_0x614e('0x1'));module[_0x614e('0x2')]={'time':{'type':Sequelize[_0x614e('0x3')]},'callid':{'type':Sequelize[_0x614e('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x614e('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x614e('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x614e('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x614e('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x614e('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x614e('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['literal'](_0x614e('0x4'))}}; \ No newline at end of file +var _0x8f29=['exports','STRING','DATE','literal','sequelize','moment'];(function(_0x9307ea,_0x38968a){var _0x295554=function(_0x342dcf){while(--_0x342dcf){_0x9307ea['push'](_0x9307ea['shift']());}};_0x295554(++_0x38968a);}(_0x8f29,0x154));var _0x98f2=function(_0x3ad5ff,_0x4cd890){_0x3ad5ff=_0x3ad5ff-0x0;var _0x476b89=_0x8f29[_0x3ad5ff];return _0x476b89;};'use strict';var Sequelize=require(_0x98f2('0x0'));var moment=require(_0x98f2('0x1'));module[_0x98f2('0x2')]={'time':{'type':Sequelize[_0x98f2('0x3')]},'callid':{'type':Sequelize[_0x98f2('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x98f2('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x98f2('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x98f2('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x98f2('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x98f2('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x98f2('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x98f2('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x98f2('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x98f2('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 51bf418..50eede4 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 _0x41e9=['attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','options','include','findAll','rows','show','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','VoiceQueuesLog','rawAttributes','fieldName','type','key','keys','intersection','model'];(function(_0x27c06c,_0x478c7b){var _0x756691=function(_0x2d73e1){while(--_0x2d73e1){_0x27c06c['push'](_0x27c06c['shift']());}};_0x756691(++_0x478c7b);}(_0x41e9,0x15d));var _0x941e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x41e9[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x941e('0x0'));var rimraf=require(_0x941e('0x1'));var zipdir=require(_0x941e('0x2'));var jsonpatch=require(_0x941e('0x3'));var rp=require(_0x941e('0x4'));var moment=require(_0x941e('0x5'));var BPromise=require(_0x941e('0x6'));var Mustache=require(_0x941e('0x7'));var util=require(_0x941e('0x8'));var path=require(_0x941e('0x9'));var sox=require(_0x941e('0xa'));var csv=require(_0x941e('0xb'));var ejs=require(_0x941e('0xc'));var fs=require('fs');var fs_extra=require(_0x941e('0xd'));var _=require(_0x941e('0xe'));var squel=require('squel');var crypto=require(_0x941e('0xf'));var jsforce=require(_0x941e('0x10'));var deskjs=require(_0x941e('0x11'));var toCsv=require(_0x941e('0xb'));var querystring=require(_0x941e('0x12'));var Papa=require(_0x941e('0x13'));var Redis=require(_0x941e('0x14'));var authService=require(_0x941e('0x15'));var qs=require(_0x941e('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x941e('0x17'));var logger=require(_0x941e('0x18'))(_0x941e('0x19'));var utils=require(_0x941e('0x1a'));var config=require(_0x941e('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x941e('0x1c'))['db'];function respondWithStatusCode(_0x59addc,_0x327ae9){_0x327ae9=_0x327ae9||0xcc;return function(_0x598792){if(_0x598792){return _0x59addc[_0x941e('0x1d')](_0x327ae9);}return _0x59addc[_0x941e('0x1e')](_0x327ae9)[_0x941e('0x1f')]();};}function respondWithResult(_0x190d89,_0x508fcd){_0x508fcd=_0x508fcd||0xc8;return function(_0x52899f){if(_0x52899f){return _0x190d89['status'](_0x508fcd)[_0x941e('0x20')](_0x52899f);}};}function respondWithFilteredResult(_0x505cad,_0x235629){return function(_0x42a709){if(_0x42a709){var _0x32b3cb=typeof _0x235629[_0x941e('0x21')]===_0x941e('0x22')&&typeof _0x235629[_0x941e('0x23')]===_0x941e('0x22');var _0x21d663=_0x42a709[_0x941e('0x24')];var _0x248092=_0x32b3cb?0x0:_0x235629[_0x941e('0x21')];var _0x4b3ef5=_0x32b3cb?_0x42a709[_0x941e('0x24')]:_0x235629[_0x941e('0x21')]+_0x235629['limit'];var _0x248e8f;if(_0x4b3ef5>=_0x21d663){_0x4b3ef5=_0x21d663;_0x248e8f=0xc8;}else{_0x248e8f=0xce;}_0x505cad[_0x941e('0x1e')](_0x248e8f);return _0x505cad[_0x941e('0x25')](_0x941e('0x26'),_0x248092+'-'+_0x4b3ef5+'/'+_0x21d663)['json'](_0x42a709);}return null;};}function patchUpdates(_0x153422){return function(_0x102807){try{jsonpatch[_0x941e('0x27')](_0x102807,_0x153422,!![]);}catch(_0x51e868){return BPromise[_0x941e('0x28')](_0x51e868);}return _0x102807[_0x941e('0x29')]();};}function saveUpdates(_0x6a836,_0x11409c){return function(_0x5a7ab1){if(_0x5a7ab1){return _0x5a7ab1[_0x941e('0x2a')](_0x6a836)[_0x941e('0x2b')](function(_0x1083f8){return _0x1083f8;});}return null;};}function removeEntity(_0x257128,_0x50a926){return function(_0x1b3b36){if(_0x1b3b36){return _0x1b3b36[_0x941e('0x2c')]()[_0x941e('0x2b')](function(){_0x257128[_0x941e('0x1e')](0xcc)[_0x941e('0x1f')]();});}};}function handleEntityNotFound(_0x26c7ae,_0x449b09){return function(_0x1c8022){if(!_0x1c8022){_0x26c7ae[_0x941e('0x1d')](0x194);}return _0x1c8022;};}function handleError(_0xba5b6f,_0x4dbfc2){_0x4dbfc2=_0x4dbfc2||0x1f4;return function(_0x1429dd){logger['error'](_0x1429dd[_0x941e('0x2d')]);if(_0x1429dd[_0x941e('0x2e')]){delete _0x1429dd['name'];}_0xba5b6f['status'](_0x4dbfc2)[_0x941e('0x2f')](_0x1429dd);};}exports['index']=function(_0x45da0d,_0x2275c2){var _0x236b0a={},_0x332018={},_0x148845={'count':0x0,'rows':[]};var _0x32f282=_['map'](db[_0x941e('0x30')][_0x941e('0x31')],function(_0x1108de){return{'name':_0x1108de[_0x941e('0x32')],'type':_0x1108de[_0x941e('0x33')][_0x941e('0x34')]};});_0x332018['model']=_['map'](_0x32f282,_0x941e('0x2e'));_0x332018['query']=_[_0x941e('0x35')](_0x45da0d['query']);_0x332018['filters']=_[_0x941e('0x36')](_0x332018[_0x941e('0x37')],_0x332018['query']);_0x236b0a[_0x941e('0x38')]=_[_0x941e('0x36')](_0x332018['model'],qs[_0x941e('0x39')](_0x45da0d[_0x941e('0x3a')][_0x941e('0x39')]));_0x236b0a[_0x941e('0x38')]=_0x236b0a[_0x941e('0x38')][_0x941e('0x3b')]?_0x236b0a[_0x941e('0x38')]:_0x332018[_0x941e('0x37')];if(!_0x45da0d[_0x941e('0x3a')][_0x941e('0x3c')](_0x941e('0x3d'))){_0x236b0a['limit']=qs[_0x941e('0x23')](_0x45da0d[_0x941e('0x3a')][_0x941e('0x23')]);_0x236b0a[_0x941e('0x21')]=qs[_0x941e('0x21')](_0x45da0d[_0x941e('0x3a')][_0x941e('0x21')]);}_0x236b0a[_0x941e('0x3e')]=qs[_0x941e('0x3f')](_0x45da0d[_0x941e('0x3a')][_0x941e('0x3f')]);_0x236b0a['where']=qs[_0x941e('0x40')](_[_0x941e('0x41')](_0x45da0d['query'],_0x332018[_0x941e('0x40')]),_0x32f282);if(_0x45da0d[_0x941e('0x3a')][_0x941e('0x42')]){_0x236b0a[_0x941e('0x43')]=_[_0x941e('0x44')](_0x236b0a[_0x941e('0x43')],{'$or':_[_0x941e('0x45')](_0x32f282,function(_0x37c9c5){if(_0x37c9c5[_0x941e('0x33')]!==_0x941e('0x46')){var _0x1cf188={};_0x1cf188[_0x37c9c5['name']]={'$like':'%'+_0x45da0d[_0x941e('0x3a')][_0x941e('0x42')]+'%'};return _0x1cf188;}})});}_0x236b0a=_[_0x941e('0x44')]({},_0x236b0a,_0x45da0d[_0x941e('0x47')]);var _0x4644e7={'where':_0x236b0a[_0x941e('0x43')]};return db[_0x941e('0x30')][_0x941e('0x24')](_0x4644e7)[_0x941e('0x2b')](function(_0x144c24){_0x148845[_0x941e('0x24')]=_0x144c24;if(_0x45da0d[_0x941e('0x3a')]['includeAll']){_0x236b0a[_0x941e('0x48')]=[{'all':!![]}];}return db[_0x941e('0x30')][_0x941e('0x49')](_0x236b0a);})[_0x941e('0x2b')](function(_0x1c1aef){_0x148845[_0x941e('0x4a')]=_0x1c1aef;return _0x148845;})[_0x941e('0x2b')](respondWithFilteredResult(_0x2275c2,_0x236b0a))['catch'](handleError(_0x2275c2,null));};exports[_0x941e('0x4b')]=function(_0x44766f,_0x376c1d){var _0x16d2b4={'raw':!![],'where':{'id':_0x44766f['params']['id']}},_0x198c6a={};_0x198c6a[_0x941e('0x37')]=_[_0x941e('0x35')](db[_0x941e('0x30')]['rawAttributes']);_0x198c6a[_0x941e('0x3a')]=_[_0x941e('0x35')](_0x44766f[_0x941e('0x3a')]);_0x198c6a[_0x941e('0x40')]=_[_0x941e('0x36')](_0x198c6a[_0x941e('0x37')],_0x198c6a[_0x941e('0x3a')]);_0x16d2b4[_0x941e('0x38')]=_['intersection'](_0x198c6a[_0x941e('0x37')],qs[_0x941e('0x39')](_0x44766f[_0x941e('0x3a')][_0x941e('0x39')]));_0x16d2b4['attributes']=_0x16d2b4['attributes']['length']?_0x16d2b4[_0x941e('0x38')]:_0x198c6a['model'];if(_0x44766f[_0x941e('0x3a')]['includeAll']){_0x16d2b4[_0x941e('0x48')]=[{'all':!![]}];}_0x16d2b4=_[_0x941e('0x44')]({},_0x16d2b4,_0x44766f[_0x941e('0x47')]);return db[_0x941e('0x30')][_0x941e('0x4c')](_0x16d2b4)['then'](handleEntityNotFound(_0x376c1d,null))[_0x941e('0x2b')](respondWithResult(_0x376c1d,null))[_0x941e('0x4d')](handleError(_0x376c1d,null));};exports[_0x941e('0x4e')]=function(_0x53fc76,_0x1c3828){return db[_0x941e('0x30')][_0x941e('0x4e')](_0x53fc76[_0x941e('0x4f')],{})['then'](respondWithResult(_0x1c3828,0xc9))['catch'](handleError(_0x1c3828,null));};exports[_0x941e('0x2a')]=function(_0x4b4010,_0x53cb08){if(_0x4b4010[_0x941e('0x4f')]['id']){delete _0x4b4010[_0x941e('0x4f')]['id'];}return db[_0x941e('0x30')][_0x941e('0x4c')]({'where':{'id':_0x4b4010[_0x941e('0x50')]['id']}})[_0x941e('0x2b')](handleEntityNotFound(_0x53cb08,null))[_0x941e('0x2b')](saveUpdates(_0x4b4010[_0x941e('0x4f')],null))[_0x941e('0x2b')](respondWithResult(_0x53cb08,null))['catch'](handleError(_0x53cb08,null));};exports[_0x941e('0x2c')]=function(_0xde0bb5,_0x28497d){return db[_0x941e('0x30')]['find']({'where':{'id':_0xde0bb5[_0x941e('0x50')]['id']}})['then'](handleEntityNotFound(_0x28497d,null))[_0x941e('0x2b')](removeEntity(_0x28497d,null))[_0x941e('0x4d')](handleError(_0x28497d,null));}; \ No newline at end of file +var _0x92b4=['where','filter','VIRTUAL','merge','options','includeAll','findAll','catch','params','intersection','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x92b4,0xa4));var _0x492b=function(_0x3ee3ff,_0x4cd30d){_0x3ee3ff=_0x3ee3ff-0x0;var _0x38b8c2=_0x92b4[_0x3ee3ff];return _0x38b8c2;};'use strict';var emlformat=require(_0x492b('0x0'));var rimraf=require(_0x492b('0x1'));var zipdir=require(_0x492b('0x2'));var jsonpatch=require(_0x492b('0x3'));var rp=require(_0x492b('0x4'));var moment=require(_0x492b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x492b('0x6'));var util=require(_0x492b('0x7'));var path=require(_0x492b('0x8'));var sox=require(_0x492b('0x9'));var csv=require(_0x492b('0xa'));var ejs=require(_0x492b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x492b('0xc'));var crypto=require(_0x492b('0xd'));var jsforce=require(_0x492b('0xe'));var deskjs=require(_0x492b('0xf'));var toCsv=require(_0x492b('0xa'));var querystring=require(_0x492b('0x10'));var Papa=require(_0x492b('0x11'));var Redis=require('ioredis');var authService=require(_0x492b('0x12'));var qs=require(_0x492b('0x13'));var as=require(_0x492b('0x14'));var hardwareService=require(_0x492b('0x15'));var logger=require(_0x492b('0x16'))(_0x492b('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x492b('0x18'));var db=require(_0x492b('0x19'))['db'];function respondWithStatusCode(_0x36e4c6,_0x3013f7){_0x3013f7=_0x3013f7||0xcc;return function(_0x248b54){if(_0x248b54){return _0x36e4c6[_0x492b('0x1a')](_0x3013f7);}return _0x36e4c6[_0x492b('0x1b')](_0x3013f7)['end']();};}function respondWithResult(_0x571525,_0x2cdd92){_0x2cdd92=_0x2cdd92||0xc8;return function(_0x316516){if(_0x316516){return _0x571525[_0x492b('0x1b')](_0x2cdd92)[_0x492b('0x1c')](_0x316516);}};}function respondWithFilteredResult(_0x10780e,_0xd9491d){return function(_0x1632a0){if(_0x1632a0){var _0x4af739=typeof _0xd9491d[_0x492b('0x1d')]===_0x492b('0x1e')&&typeof _0xd9491d[_0x492b('0x1f')]==='undefined';var _0x39efdb=_0x1632a0[_0x492b('0x20')];var _0xc75d04=_0x4af739?0x0:_0xd9491d[_0x492b('0x1d')];var _0x5a1a04=_0x4af739?_0x1632a0[_0x492b('0x20')]:_0xd9491d[_0x492b('0x1d')]+_0xd9491d[_0x492b('0x1f')];var _0x24e611;if(_0x5a1a04>=_0x39efdb){_0x5a1a04=_0x39efdb;_0x24e611=0xc8;}else{_0x24e611=0xce;}_0x10780e[_0x492b('0x1b')](_0x24e611);return _0x10780e[_0x492b('0x21')]('Content-Range',_0xc75d04+'-'+_0x5a1a04+'/'+_0x39efdb)[_0x492b('0x1c')](_0x1632a0);}return null;};}function patchUpdates(_0x340485){return function(_0x4bd157){try{jsonpatch[_0x492b('0x22')](_0x4bd157,_0x340485,!![]);}catch(_0x4b03a8){return BPromise[_0x492b('0x23')](_0x4b03a8);}return _0x4bd157['save']();};}function saveUpdates(_0xe1a758,_0x366737){return function(_0x26b754){if(_0x26b754){return _0x26b754[_0x492b('0x24')](_0xe1a758)['then'](function(_0x1989d6){return _0x1989d6;});}return null;};}function removeEntity(_0x4163ad,_0x55e2f5){return function(_0x20bd69){if(_0x20bd69){return _0x20bd69[_0x492b('0x25')]()[_0x492b('0x26')](function(){_0x4163ad[_0x492b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e9445,_0x3da95e){return function(_0xa566cc){if(!_0xa566cc){_0x4e9445[_0x492b('0x1a')](0x194);}return _0xa566cc;};}function handleError(_0x38281,_0x147677){_0x147677=_0x147677||0x1f4;return function(_0x1ec2ce){logger[_0x492b('0x27')](_0x1ec2ce[_0x492b('0x28')]);if(_0x1ec2ce[_0x492b('0x29')]){delete _0x1ec2ce[_0x492b('0x29')];}_0x38281['status'](_0x147677)[_0x492b('0x2a')](_0x1ec2ce);};}exports[_0x492b('0x2b')]=function(_0x2949ee,_0x4aa137){var _0x362446={},_0x1e1189={},_0x4dd528={'count':0x0,'rows':[]};var _0x2e9f9f=_[_0x492b('0x2c')](db[_0x492b('0x2d')][_0x492b('0x2e')],function(_0x37686b){return{'name':_0x37686b[_0x492b('0x2f')],'type':_0x37686b[_0x492b('0x30')][_0x492b('0x31')]};});_0x1e1189['model']=_[_0x492b('0x2c')](_0x2e9f9f,_0x492b('0x29'));_0x1e1189[_0x492b('0x32')]=_[_0x492b('0x33')](_0x2949ee['query']);_0x1e1189[_0x492b('0x34')]=_['intersection'](_0x1e1189['model'],_0x1e1189[_0x492b('0x32')]);_0x362446[_0x492b('0x35')]=_['intersection'](_0x1e1189[_0x492b('0x36')],qs[_0x492b('0x37')](_0x2949ee[_0x492b('0x32')]['fields']));_0x362446[_0x492b('0x35')]=_0x362446[_0x492b('0x35')][_0x492b('0x38')]?_0x362446['attributes']:_0x1e1189['model'];if(!_0x2949ee['query'][_0x492b('0x39')](_0x492b('0x3a'))){_0x362446[_0x492b('0x1f')]=qs['limit'](_0x2949ee[_0x492b('0x32')]['limit']);_0x362446[_0x492b('0x1d')]=qs[_0x492b('0x1d')](_0x2949ee['query'][_0x492b('0x1d')]);}_0x362446[_0x492b('0x3b')]=qs['sort'](_0x2949ee[_0x492b('0x32')][_0x492b('0x3c')]);_0x362446[_0x492b('0x3d')]=qs[_0x492b('0x34')](_['pick'](_0x2949ee[_0x492b('0x32')],_0x1e1189[_0x492b('0x34')]),_0x2e9f9f);if(_0x2949ee[_0x492b('0x32')][_0x492b('0x3e')]){_0x362446[_0x492b('0x3d')]=_['merge'](_0x362446[_0x492b('0x3d')],{'$or':_[_0x492b('0x2c')](_0x2e9f9f,function(_0x3457e2){if(_0x3457e2['type']!==_0x492b('0x3f')){var _0x7dd53b={};_0x7dd53b[_0x3457e2[_0x492b('0x29')]]={'$like':'%'+_0x2949ee[_0x492b('0x32')][_0x492b('0x3e')]+'%'};return _0x7dd53b;}})});}_0x362446=_[_0x492b('0x40')]({},_0x362446,_0x2949ee[_0x492b('0x41')]);var _0x18b94e={'where':_0x362446['where']};return db[_0x492b('0x2d')][_0x492b('0x20')](_0x18b94e)['then'](function(_0x3a0902){_0x4dd528[_0x492b('0x20')]=_0x3a0902;if(_0x2949ee[_0x492b('0x32')][_0x492b('0x42')]){_0x362446['include']=[{'all':!![]}];}return db[_0x492b('0x2d')][_0x492b('0x43')](_0x362446);})[_0x492b('0x26')](function(_0x1eb8c5){_0x4dd528['rows']=_0x1eb8c5;return _0x4dd528;})['then'](respondWithFilteredResult(_0x4aa137,_0x362446))[_0x492b('0x44')](handleError(_0x4aa137,null));};exports['show']=function(_0x41942b,_0xe8b421){var _0x558f1a={'raw':!![],'where':{'id':_0x41942b[_0x492b('0x45')]['id']}},_0x45d919={};_0x45d919[_0x492b('0x36')]=_[_0x492b('0x33')](db['VoiceQueuesLog']['rawAttributes']);_0x45d919[_0x492b('0x32')]=_[_0x492b('0x33')](_0x41942b['query']);_0x45d919['filters']=_['intersection'](_0x45d919['model'],_0x45d919[_0x492b('0x32')]);_0x558f1a[_0x492b('0x35')]=_[_0x492b('0x46')](_0x45d919[_0x492b('0x36')],qs[_0x492b('0x37')](_0x41942b[_0x492b('0x32')][_0x492b('0x37')]));_0x558f1a[_0x492b('0x35')]=_0x558f1a[_0x492b('0x35')]['length']?_0x558f1a[_0x492b('0x35')]:_0x45d919['model'];if(_0x41942b[_0x492b('0x32')][_0x492b('0x42')]){_0x558f1a[_0x492b('0x47')]=[{'all':!![]}];}_0x558f1a=_[_0x492b('0x40')]({},_0x558f1a,_0x41942b[_0x492b('0x41')]);return db[_0x492b('0x2d')]['find'](_0x558f1a)[_0x492b('0x26')](handleEntityNotFound(_0xe8b421,null))[_0x492b('0x26')](respondWithResult(_0xe8b421,null))[_0x492b('0x44')](handleError(_0xe8b421,null));};exports[_0x492b('0x48')]=function(_0x2875d4,_0x28f423){return db[_0x492b('0x2d')][_0x492b('0x48')](_0x2875d4['body'],{})[_0x492b('0x26')](respondWithResult(_0x28f423,0xc9))[_0x492b('0x44')](handleError(_0x28f423,null));};exports[_0x492b('0x24')]=function(_0x54c441,_0x27510f){if(_0x54c441[_0x492b('0x49')]['id']){delete _0x54c441[_0x492b('0x49')]['id'];}return db[_0x492b('0x2d')][_0x492b('0x4a')]({'where':{'id':_0x54c441[_0x492b('0x45')]['id']}})[_0x492b('0x26')](handleEntityNotFound(_0x27510f,null))['then'](saveUpdates(_0x54c441[_0x492b('0x49')],null))['then'](respondWithResult(_0x27510f,null))[_0x492b('0x44')](handleError(_0x27510f,null));};exports[_0x492b('0x25')]=function(_0x539601,_0xe7fa8b){return db[_0x492b('0x2d')][_0x492b('0x4a')]({'where':{'id':_0x539601['params']['id']}})['then'](handleEntityNotFound(_0xe7fa8b,null))[_0x492b('0x26')](removeEntity(_0xe7fa8b,null))[_0x492b('0x44')](handleError(_0xe7fa8b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 4e1c3e4..65379a9 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 _0x2e68=['event_dtm','event','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2e68,0x16e));var _0x82e6=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x2e68[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x82e6('0x0'));var util=require(_0x82e6('0x1'));var logger=require(_0x82e6('0x2'))(_0x82e6('0x3'));var moment=require(_0x82e6('0x4'));var BPromise=require(_0x82e6('0x5'));var rp=require(_0x82e6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x82e6('0x7'));var attributes=require(_0x82e6('0x8'));module['exports']=function(_0x42ae20,_0x32633a){return _0x42ae20[_0x82e6('0x9')](_0x82e6('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x82e6('0xb'),'fields':[_0x82e6('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x9c1e=['event_dtm','event','dtm','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log'];(function(_0x34f6c7,_0x2769ec){var _0x5aadaf=function(_0x206c5e){while(--_0x206c5e){_0x34f6c7['push'](_0x34f6c7['shift']());}};_0x5aadaf(++_0x2769ec);}(_0x9c1e,0xd3));var _0xe9c1=function(_0x525896,_0x37c998){_0x525896=_0x525896-0x0;var _0x240965=_0x9c1e[_0x525896];return _0x240965;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe9c1('0x0'));var moment=require(_0xe9c1('0x1'));var BPromise=require(_0xe9c1('0x2'));var rp=require(_0xe9c1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe9c1('0x4'));var config=require(_0xe9c1('0x5'));var attributes=require(_0xe9c1('0x6'));module['exports']=function(_0x385269,_0x45dc84){return _0x385269[_0xe9c1('0x7')](_0xe9c1('0x8'),attributes,{'tableName':_0xe9c1('0x9'),'paranoid':![],'indexes':[{'name':_0xe9c1('0xa'),'fields':[_0xe9c1('0xb'),_0xe9c1('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 0968edd..534c16c 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 _0x22cc=['stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x4c6eeb,_0x20e868){var _0x240e51=function(_0x4e4aae){while(--_0x4e4aae){_0x4c6eeb['push'](_0x4c6eeb['shift']());}};_0x240e51(++_0x20e868);}(_0x22cc,0x1e1));var _0xc22c=function(_0x5400b,_0x55943a){_0x5400b=_0x5400b-0x0;var _0x36a39b=_0x22cc[_0x5400b];return _0x36a39b;};'use strict';var _=require('lodash');var util=require(_0xc22c('0x0'));var moment=require(_0xc22c('0x1'));var BPromise=require(_0xc22c('0x2'));var rs=require(_0xc22c('0x3'));var fs=require('fs');var Redis=require(_0xc22c('0x4'));var db=require(_0xc22c('0x5'))['db'];var utils=require(_0xc22c('0x6'));var logger=require(_0xc22c('0x7'))(_0xc22c('0x8'));var config=require(_0xc22c('0x9'));var jayson=require(_0xc22c('0xa'));var client=jayson[_0xc22c('0xb')][_0xc22c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x38df1f,_0x2d3d76,_0x177756){return new BPromise(function(_0x4dc580,_0x5b98bc){return client[_0xc22c('0xd')](_0x38df1f,_0x177756)[_0xc22c('0xe')](function(_0x4f3058){logger[_0xc22c('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2d3d76,_0xc22c('0x10'));logger[_0xc22c('0x11')](_0xc22c('0x12'),_0x2d3d76,'request\x20sent',JSON[_0xc22c('0x13')](_0x4f3058));if(_0x4f3058[_0xc22c('0x14')]){if(_0x4f3058['error'][_0xc22c('0x15')]===0x1f4){logger[_0xc22c('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2d3d76,_0x4f3058[_0xc22c('0x14')]['message']);return _0x5b98bc(_0x4f3058['error']['message']);}logger[_0xc22c('0x14')](_0xc22c('0x16'),_0x2d3d76,_0x4f3058[_0xc22c('0x14')][_0xc22c('0x17')]);return _0x4dc580(_0x4f3058[_0xc22c('0x14')][_0xc22c('0x17')]);}else{logger[_0xc22c('0xf')](_0xc22c('0x16'),_0x2d3d76,_0xc22c('0x10'));_0x4dc580(_0x4f3058[_0xc22c('0x18')][_0xc22c('0x17')]);}})['catch'](function(_0x297843){logger[_0xc22c('0x14')](_0xc22c('0x16'),_0x2d3d76,_0x297843);_0x5b98bc(_0x297843);});});} \ No newline at end of file +var _0x92ba=['error','code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug'];(function(_0x3e8d78,_0xef4524){var _0x50532d=function(_0x358963){while(--_0x358963){_0x3e8d78['push'](_0x3e8d78['shift']());}};_0x50532d(++_0xef4524);}(_0x92ba,0x17c));var _0xa92b=function(_0x170bbc,_0x6a653b){_0x170bbc=_0x170bbc-0x0;var _0x2c3f86=_0x92ba[_0x170bbc];return _0x2c3f86;};'use strict';var _=require(_0xa92b('0x0'));var util=require(_0xa92b('0x1'));var moment=require('moment');var BPromise=require(_0xa92b('0x2'));var rs=require(_0xa92b('0x3'));var fs=require('fs');var Redis=require(_0xa92b('0x4'));var db=require(_0xa92b('0x5'))['db'];var utils=require(_0xa92b('0x6'));var logger=require('../../config/logger')(_0xa92b('0x7'));var config=require(_0xa92b('0x8'));var jayson=require(_0xa92b('0x9'));var client=jayson[_0xa92b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27bb9a,_0x1d3d0a,_0x5d4437){return new BPromise(function(_0x156d6b,_0x156be4){return client[_0xa92b('0xb')](_0x27bb9a,_0x5d4437)[_0xa92b('0xc')](function(_0x376021){logger[_0xa92b('0xd')](_0xa92b('0xe'),_0x1d3d0a,'request\x20sent');logger[_0xa92b('0xf')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x1d3d0a,'request\x20sent',JSON['stringify'](_0x376021));if(_0x376021['error']){if(_0x376021[_0xa92b('0x10')][_0xa92b('0x11')]===0x1f4){logger[_0xa92b('0x10')](_0xa92b('0xe'),_0x1d3d0a,_0x376021[_0xa92b('0x10')][_0xa92b('0x12')]);return _0x156be4(_0x376021[_0xa92b('0x10')][_0xa92b('0x12')]);}logger[_0xa92b('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1d3d0a,_0x376021[_0xa92b('0x10')][_0xa92b('0x12')]);return _0x156d6b(_0x376021[_0xa92b('0x10')][_0xa92b('0x12')]);}else{logger[_0xa92b('0xd')](_0xa92b('0xe'),_0x1d3d0a,_0xa92b('0x13'));_0x156d6b(_0x376021[_0xa92b('0x14')][_0xa92b('0x12')]);}})[_0xa92b('0x15')](function(_0x56d1b9){logger[_0xa92b('0x10')](_0xa92b('0xe'),_0x1d3d0a,_0x56d1b9);_0x156be4(_0x56d1b9);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 13c3035..829dda4 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 _0xd15d=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','destroy','multer'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xd15d,0x1d3));var _0xdd15=function(_0x21803c,_0x1f7f84){_0x21803c=_0x21803c-0x0;var _0x438514=_0xd15d[_0x21803c];return _0x438514;};'use strict';var multer=require(_0xdd15('0x0'));var util=require(_0xdd15('0x1'));var path=require(_0xdd15('0x2'));var timeout=require(_0xdd15('0x3'));var express=require(_0xdd15('0x4'));var router=express[_0xdd15('0x5')]();var fs_extra=require(_0xdd15('0x6'));var auth=require(_0xdd15('0x7'));var interaction=require(_0xdd15('0x8'));var config=require(_0xdd15('0x9'));var controller=require(_0xdd15('0xa'));router[_0xdd15('0xb')]('/',auth[_0xdd15('0xc')](),controller[_0xdd15('0xd')]);router[_0xdd15('0xb')](_0xdd15('0xe'),auth[_0xdd15('0xc')](),controller[_0xdd15('0xf')]);router['get'](_0xdd15('0x10'),auth[_0xdd15('0xc')](),controller['show']);router[_0xdd15('0xb')](_0xdd15('0x11'),auth['isAuthenticated'](),controller['download']);router['get']('/:id/downloads',controller[_0xdd15('0x12')]);router[_0xdd15('0xb')](_0xdd15('0x13'),auth[_0xdd15('0xc')](),controller[_0xdd15('0x14')]);router['post']('/',auth[_0xdd15('0xc')](),controller['create']);router[_0xdd15('0x15')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0xdd15('0x16')]);router[_0xdd15('0x17')]('/:id',auth[_0xdd15('0xc')](),controller[_0xdd15('0x18')]);router['delete'](_0xdd15('0x10'),auth[_0xdd15('0xc')](),controller[_0xdd15('0x19')]);module['exports']=router; \ No newline at end of file +var _0x93f0=['connect-timeout','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','index','isAuthenticated','/:id','show','/:id/download','download','/:id/downloads','/:id/transcribe','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0x93f0,0x173));var _0x093f=function(_0x2f7098,_0x3949d3){_0x2f7098=_0x2f7098-0x0;var _0x355a5c=_0x93f0[_0x2f7098];return _0x355a5c;};'use strict';var multer=require(_0x093f('0x0'));var util=require(_0x093f('0x1'));var path=require(_0x093f('0x2'));var timeout=require(_0x093f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x093f('0x4'));var config=require(_0x093f('0x5'));var controller=require(_0x093f('0x6'));router[_0x093f('0x7')]('/',auth['isAuthenticated'](),controller[_0x093f('0x8')]);router[_0x093f('0x7')]('/describe',auth[_0x093f('0x9')](),controller['describe']);router[_0x093f('0x7')](_0x093f('0xa'),auth[_0x093f('0x9')](),controller[_0x093f('0xb')]);router['get'](_0x093f('0xc'),auth[_0x093f('0x9')](),controller[_0x093f('0xd')]);router['get'](_0x093f('0xe'),controller['downloads']);router[_0x093f('0x7')](_0x093f('0xf'),auth[_0x093f('0x9')](),controller['downloadTranscribe']);router[_0x093f('0x10')]('/',auth[_0x093f('0x9')](),controller[_0x093f('0x11')]);router[_0x093f('0x10')](_0x093f('0xf'),auth[_0x093f('0x9')](),controller['runTranscribe']);router[_0x093f('0x12')](_0x093f('0xa'),auth['isAuthenticated'](),controller[_0x093f('0x13')]);router[_0x093f('0x14')](_0x093f('0xa'),auth['isAuthenticated'](),controller[_0x093f('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index e10124d..a0b15d1 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(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 b8ea5ae..0d53a8a 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 _0xff35=['stack','name','index','map','VoiceRecording','rawAttributes','type','model','differenceBy','format','query','filters','intersection','attributes','fields','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','download','../../components/encryptor','uniqueid','%s.cypher','existsSync','decryptFile','Sequelize','ValidationError','filename','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','sequelize','MD5','col','token','$and','push','value','secrets','recording','extname','destroy','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','language','runSentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','transcribeAccountId','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','aws-sdk','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','save','then','error'];(function(_0x19ee72,_0x4f611a){var _0x5f4fd2=function(_0x3db7ae){while(--_0x3db7ae){_0x19ee72['push'](_0x19ee72['shift']());}};_0x5f4fd2(++_0x4f611a);}(_0xff35,0x6a));var _0x5ff3=function(_0x131e17,_0x21c80b){_0x131e17=_0x131e17-0x0;var _0x2a65b6=_0xff35[_0x131e17];return _0x2a65b6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5ff3('0x0'));var jsonpatch=require(_0x5ff3('0x1'));var rp=require('request-promise');var moment=require(_0x5ff3('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5ff3('0x3'));var util=require(_0x5ff3('0x4'));var path=require('path');var sox=require(_0x5ff3('0x5'));var csv=require(_0x5ff3('0x6'));var ejs=require(_0x5ff3('0x7'));var fs=require('fs');var fs_extra=require(_0x5ff3('0x8'));var _=require(_0x5ff3('0x9'));var squel=require(_0x5ff3('0xa'));var crypto=require('crypto');var jsforce=require(_0x5ff3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5ff3('0x6'));var querystring=require(_0x5ff3('0xc'));var Papa=require(_0x5ff3('0xd'));var AWS=require(_0x5ff3('0xe'));var uuidv4=require('uuid/v4');var Redis=require(_0x5ff3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5ff3('0x10'));var as=require(_0x5ff3('0x11'));var hardwareService=require(_0x5ff3('0x12'));var logger=require(_0x5ff3('0x13'))(_0x5ff3('0x14'));var utils=require(_0x5ff3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5ff3('0x16'));var db=require(_0x5ff3('0x17'))['db'];function respondWithStatusCode(_0x5030ff,_0xea6687){_0xea6687=_0xea6687||0xcc;return function(_0x51af95){if(_0x51af95){return _0x5030ff[_0x5ff3('0x18')](_0xea6687);}return _0x5030ff[_0x5ff3('0x19')](_0xea6687)[_0x5ff3('0x1a')]();};}function respondWithResult(_0x18d024,_0xe2bed1){_0xe2bed1=_0xe2bed1||0xc8;return function(_0x3d16af){if(_0x3d16af){return _0x18d024[_0x5ff3('0x19')](_0xe2bed1)['json'](_0x3d16af);}};}function respondWithFilteredResult(_0x29041f,_0x595895){return function(_0x3daf7f){if(_0x3daf7f){var _0x3bac74=typeof _0x595895[_0x5ff3('0x1b')]==='undefined'&&typeof _0x595895[_0x5ff3('0x1c')]===_0x5ff3('0x1d');var _0x552876=_0x3daf7f['count'];var _0x542b84=_0x3bac74?0x0:_0x595895[_0x5ff3('0x1b')];var _0x29570c=_0x3bac74?_0x3daf7f[_0x5ff3('0x1e')]:_0x595895[_0x5ff3('0x1b')]+_0x595895['limit'];var _0x1b87a3;if(_0x29570c>=_0x552876){_0x29570c=_0x552876;_0x1b87a3=0xc8;}else{_0x1b87a3=0xce;}_0x29041f[_0x5ff3('0x19')](_0x1b87a3);return _0x29041f['set'](_0x5ff3('0x1f'),_0x542b84+'-'+_0x29570c+'/'+_0x552876)[_0x5ff3('0x20')](_0x3daf7f);}return null;};}function patchUpdates(_0x3994dc){return function(_0x4d8f0f){try{jsonpatch[_0x5ff3('0x21')](_0x4d8f0f,_0x3994dc,!![]);}catch(_0xa58aa){return BPromise['reject'](_0xa58aa);}return _0x4d8f0f[_0x5ff3('0x22')]();};}function saveUpdates(_0x38d794,_0x247a07){return function(_0x5b22a7){if(_0x5b22a7){return _0x5b22a7['update'](_0x38d794)[_0x5ff3('0x23')](function(_0x81b8b4){return _0x81b8b4;});}return null;};}function removeEntity(_0x22acc3,_0x7d1878){return function(_0x45a9c0){if(_0x45a9c0){return _0x45a9c0['destroy']()['then'](function(){_0x22acc3[_0x5ff3('0x19')](0xcc)[_0x5ff3('0x1a')]();});}};}function handleEntityNotFound(_0x593754,_0x1e9555){return function(_0x263581){if(!_0x263581){_0x593754[_0x5ff3('0x18')](0x194);}return _0x263581;};}function handleError(_0x473f65,_0x527b30){_0x527b30=_0x527b30||0x1f4;return function(_0x28ffa6){logger[_0x5ff3('0x24')](_0x28ffa6[_0x5ff3('0x25')]);if(_0x28ffa6[_0x5ff3('0x26')]){delete _0x28ffa6['name'];}_0x473f65[_0x5ff3('0x19')](_0x527b30)['send'](_0x28ffa6);};}exports[_0x5ff3('0x27')]=function(_0xd93f1a,_0x2a0a8c){var _0x51f8da={},_0x1b005a={},_0x12554e={'count':0x0,'rows':[]};var _0x2e5702=_[_0x5ff3('0x28')](db[_0x5ff3('0x29')][_0x5ff3('0x2a')],function(_0x3949f3){return{'name':_0x3949f3['fieldName'],'type':_0x3949f3[_0x5ff3('0x2b')]['key']};});_0x1b005a[_0x5ff3('0x2c')]=_[_0x5ff3('0x2d')](_[_0x5ff3('0x28')](_0x2e5702,_0x5ff3('0x26')),[_0x5ff3('0x2e')]);_0x1b005a[_0x5ff3('0x2f')]=_['keys'](_0xd93f1a[_0x5ff3('0x2f')]);_0x1b005a[_0x5ff3('0x30')]=_[_0x5ff3('0x31')](_0x1b005a[_0x5ff3('0x2c')],_0x1b005a[_0x5ff3('0x2f')]);_0x51f8da[_0x5ff3('0x32')]=_[_0x5ff3('0x31')](_0x1b005a[_0x5ff3('0x2c')],qs[_0x5ff3('0x33')](_0xd93f1a[_0x5ff3('0x2f')][_0x5ff3('0x33')]));_0x51f8da[_0x5ff3('0x32')]=_0x51f8da['attributes']['length']?_0x51f8da[_0x5ff3('0x32')]:_0x1b005a['model'];if(!_0xd93f1a[_0x5ff3('0x2f')]['hasOwnProperty'](_0x5ff3('0x34'))){_0x51f8da['limit']=qs[_0x5ff3('0x1c')](_0xd93f1a[_0x5ff3('0x2f')][_0x5ff3('0x1c')]);_0x51f8da[_0x5ff3('0x1b')]=qs['offset'](_0xd93f1a[_0x5ff3('0x2f')][_0x5ff3('0x1b')]);}_0x51f8da['order']=qs['sort'](_0xd93f1a['query'][_0x5ff3('0x35')]);_0x51f8da[_0x5ff3('0x36')]=qs[_0x5ff3('0x30')](_['pick'](_0xd93f1a[_0x5ff3('0x2f')],_0x1b005a[_0x5ff3('0x30')]),_0x2e5702);if(_0xd93f1a['query'][_0x5ff3('0x37')]){_0x51f8da[_0x5ff3('0x36')]=_[_0x5ff3('0x38')](_0x51f8da[_0x5ff3('0x36')],{'$or':_['map'](_0x2e5702,function(_0x1538c5){if(_0x1538c5[_0x5ff3('0x2b')]!==_0x5ff3('0x39')){var _0xc5eee4={};_0xc5eee4[_0x1538c5[_0x5ff3('0x26')]]={'$like':'%'+_0xd93f1a[_0x5ff3('0x2f')]['filter']+'%'};return _0xc5eee4;}})});}_0x51f8da=_[_0x5ff3('0x38')]({},_0x51f8da,_0xd93f1a['options']);var _0x3c879c={'where':_0x51f8da[_0x5ff3('0x36')]};return db[_0x5ff3('0x29')][_0x5ff3('0x1e')](_0x3c879c)[_0x5ff3('0x23')](function(_0x5b4140){_0x12554e[_0x5ff3('0x1e')]=_0x5b4140;if(_0xd93f1a[_0x5ff3('0x2f')][_0x5ff3('0x3a')]){_0x51f8da[_0x5ff3('0x3b')]=[{'all':!![]}];}return db[_0x5ff3('0x29')][_0x5ff3('0x3c')](_0x51f8da);})[_0x5ff3('0x23')](function(_0x7f88c7){_0x12554e[_0x5ff3('0x3d')]=_0x7f88c7;return _0x12554e;})[_0x5ff3('0x23')](respondWithFilteredResult(_0x2a0a8c,_0x51f8da))[_0x5ff3('0x3e')](handleError(_0x2a0a8c,null));};exports[_0x5ff3('0x3f')]=function(_0x204413,_0x1f8225){var _0x2d7ba0={'raw':![],'where':{'id':_0x204413[_0x5ff3('0x40')]['id']}},_0x21992e={};_0x21992e[_0x5ff3('0x2c')]=_[_0x5ff3('0x41')](db[_0x5ff3('0x29')][_0x5ff3('0x2a')]);_0x21992e[_0x5ff3('0x2f')]=_[_0x5ff3('0x41')](_0x204413[_0x5ff3('0x2f')]);_0x21992e[_0x5ff3('0x30')]=_[_0x5ff3('0x31')](_0x21992e['model'],_0x21992e[_0x5ff3('0x2f')]);_0x2d7ba0[_0x5ff3('0x32')]=_[_0x5ff3('0x31')](_0x21992e['model'],qs[_0x5ff3('0x33')](_0x204413[_0x5ff3('0x2f')][_0x5ff3('0x33')]));_0x2d7ba0['attributes']=_0x2d7ba0['attributes']['length']?_0x2d7ba0[_0x5ff3('0x32')]:_0x21992e[_0x5ff3('0x2c')];if(_0x204413[_0x5ff3('0x2f')][_0x5ff3('0x3a')]){_0x2d7ba0[_0x5ff3('0x3b')]=[{'all':!![]}];}_0x2d7ba0=_[_0x5ff3('0x38')]({},_0x2d7ba0,_0x204413[_0x5ff3('0x42')]);return db[_0x5ff3('0x29')][_0x5ff3('0x43')](_0x2d7ba0)[_0x5ff3('0x23')](handleEntityNotFound(_0x1f8225,null))[_0x5ff3('0x23')](respondWithResult(_0x1f8225,null))[_0x5ff3('0x3e')](handleError(_0x1f8225,null));};exports[_0x5ff3('0x44')]=function(_0x3ac573,_0x597833){return db['VoiceRecording']['create'](_0x3ac573[_0x5ff3('0x45')],{})[_0x5ff3('0x23')](respondWithResult(_0x597833,0xc9))[_0x5ff3('0x3e')](handleError(_0x597833,null));};exports['update']=function(_0x5c9a30,_0x55fc28){if(_0x5c9a30[_0x5ff3('0x45')]['id']){delete _0x5c9a30['body']['id'];}return db['VoiceRecording'][_0x5ff3('0x43')]({'where':{'id':_0x5c9a30['params']['id']}})[_0x5ff3('0x23')](handleEntityNotFound(_0x55fc28,null))['then'](saveUpdates(_0x5c9a30[_0x5ff3('0x45')],null))[_0x5ff3('0x23')](respondWithResult(_0x55fc28,null))[_0x5ff3('0x3e')](handleError(_0x55fc28,null));};exports[_0x5ff3('0x46')]=function(_0xf1f0b9,_0x111b3d){return db[_0x5ff3('0x29')][_0x5ff3('0x46')]()[_0x5ff3('0x23')](respondWithResult(_0x111b3d,null))[_0x5ff3('0x3e')](handleError(_0x111b3d,null));};exports[_0x5ff3('0x47')]=function(_0x164859,_0x10f65c,_0x2a9eff){var _0x4b750f=require(_0x5ff3('0x48'));var _0x3ba552=![];var _0x4a834e={};if(_0x164859[_0x5ff3('0x2f')][_0x5ff3('0x2b')]&&_0x164859['query'][_0x5ff3('0x2b')]===_0x5ff3('0x49')){_0x4a834e[_0x5ff3('0x49')]=_0x164859[_0x5ff3('0x40')]['id'];}else{_0x4a834e['id']=_0x164859[_0x5ff3('0x40')]['id'];}return db[_0x5ff3('0x29')]['find']({'where':_0x4a834e,'attributes':['id','value'],'raw':!![]})[_0x5ff3('0x23')](handleEntityNotFound(_0x10f65c,null))['then'](function(_0x4527d7){if(_0x4527d7){var _0x40834d=_0x4527d7['value'];var _0x20c423=util[_0x5ff3('0x2e')](_0x5ff3('0x4a'),_0x40834d);if(fs[_0x5ff3('0x4b')](_0x20c423)){_0x3ba552=!![];return _0x4b750f[_0x5ff3('0x4c')](_0x20c423,_0x40834d,config['secrets']['recording'])[_0x5ff3('0x23')](function(){return _0x4527d7;});}return _0x4527d7;}})[_0x5ff3('0x23')](function(_0x29ddf2){if(_0x29ddf2){var _0x4cf646=_0x29ddf2['value'];if(!fs[_0x5ff3('0x4b')](_0x4cf646)){throw new db[(_0x5ff3('0x4d'))][(_0x5ff3('0x4e'))]('VoiceRecording\x20not\x20found');}if(_0x29ddf2[_0x5ff3('0x4f')]){return _0x10f65c[_0x5ff3('0x47')](_0x4cf646,_0x29ddf2['filename']+path['extname'](_0x4cf646),function(){if(_0x3ba552){fs['unlink'](_0x4cf646);}});}else{return _0x10f65c['download'](_0x4cf646,function(_0x2fea3e){if(_0x3ba552){fs[_0x5ff3('0x50')](_0x4cf646);}});}}})[_0x5ff3('0x3e')](function(_0xc970ff){if(_0xc970ff[_0x5ff3('0x51')]===_0x5ff3('0x52')){_0x10f65c['status'](0x194)['send'](_0x5ff3('0x53'));}else{return handleError(_0x10f65c,null);}});};exports['downloads']=function(_0x4b73b4,_0x15ccb6,_0x5eb343){var _0x5c5f91=require(_0x5ff3('0x48'));var _0x3bf7d6=![];var _0x42b3ef={'$and':[db['sequelize'][_0x5ff3('0x36')](db[_0x5ff3('0x54')]['fn'](_0x5ff3('0x55'),db[_0x5ff3('0x54')][_0x5ff3('0x56')](_0x5ff3('0x49'))),_0x4b73b4[_0x5ff3('0x2f')][_0x5ff3('0x57')])]};if(_0x4b73b4['query']['type']&&_0x4b73b4[_0x5ff3('0x2f')][_0x5ff3('0x2b')]==='uniqueid'){_0x42b3ef[_0x5ff3('0x58')][_0x5ff3('0x59')]({'uniqueid':_0x4b73b4['params']['id']});}else{_0x42b3ef[_0x5ff3('0x58')][_0x5ff3('0x59')]({'id':_0x4b73b4[_0x5ff3('0x40')]['id']});}return db[_0x5ff3('0x29')][_0x5ff3('0x43')]({'where':_0x42b3ef,'attributes':['id',_0x5ff3('0x5a')],'raw':!![]})[_0x5ff3('0x23')](handleEntityNotFound(_0x15ccb6,null))[_0x5ff3('0x23')](function(_0xa2743b){if(_0xa2743b){var _0x80d2ec=util[_0x5ff3('0x2e')](_0x5ff3('0x4a'),_0xa2743b['value']);if(fs[_0x5ff3('0x4b')](_0x80d2ec)){_0x3bf7d6=!![];return _0x5c5f91['decryptFile'](_0x80d2ec,_0xa2743b['value'],config[_0x5ff3('0x5b')][_0x5ff3('0x5c')])[_0x5ff3('0x23')](function(){return _0xa2743b;});}return _0xa2743b;}})[_0x5ff3('0x23')](function(_0x14d63f){if(_0x14d63f){if(!fs[_0x5ff3('0x4b')](_0x14d63f[_0x5ff3('0x5a')])){throw new db[(_0x5ff3('0x4d'))][(_0x5ff3('0x4e'))](_0x5ff3('0x52'));}if(_0x14d63f[_0x5ff3('0x4f')]){return _0x15ccb6[_0x5ff3('0x47')](_0x14d63f['value'],_0x14d63f['filename']+path[_0x5ff3('0x5d')](_0x14d63f['value']),function(){if(_0x3bf7d6){fs[_0x5ff3('0x50')](_0x14d63f['value']);}});}else{return _0x15ccb6[_0x5ff3('0x47')](_0x14d63f['value'],function(_0x3c911b){if(_0x3bf7d6){fs[_0x5ff3('0x50')](_0x14d63f[_0x5ff3('0x5a')]);}});}}})['catch'](handleError(_0x15ccb6,null));};exports[_0x5ff3('0x5e')]=function(_0x7b0ed5,_0xfe91b4){return db[_0x5ff3('0x29')][_0x5ff3('0x43')]({'where':{'id':_0x7b0ed5[_0x5ff3('0x40')]['id']}})[_0x5ff3('0x23')](function(_0x33697e){if(_[_0x5ff3('0x5f')](_0x33697e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x33697e;})[_0x5ff3('0x23')](function(_0x22ba61){var _0x52d4d9=_0x22ba61[_0x5ff3('0x5a')];logger[_0x5ff3('0x60')]('cancellazione\x20fisica\x20documento\x20%s',_0x52d4d9);if(!_[_0x5ff3('0x5f')](_0x22ba61[_0x5ff3('0x5a')])&&fs['existsSync'](_0x52d4d9)){logger[_0x5ff3('0x60')](_0x5ff3('0x61')+_0x52d4d9+_0x5ff3('0x62'));fs['unlinkSync'](_0x52d4d9);}_0x52d4d9=_0x52d4d9+'.cypher';if(!_[_0x5ff3('0x5f')](_0x22ba61[_0x5ff3('0x5a')])&&fs['existsSync'](_0x52d4d9)){logger[_0x5ff3('0x60')](_0x5ff3('0x61')+_0x52d4d9+_0x5ff3('0x62'));fs[_0x5ff3('0x63')](_0x52d4d9);}return _0x22ba61;})[_0x5ff3('0x23')](function(_0x4b8a7f){if(!_0x4b8a7f)throw new InternalError();return _0x4b8a7f[_0x5ff3('0x5e')]();})[_0x5ff3('0x23')](function(){_0xfe91b4[_0x5ff3('0x19')](0xcc)[_0x5ff3('0x1a')]();})['catch'](handleError(_0xfe91b4,null));};function getBucketslist(_0x459b22,_0x1ad0cb,_0x56f73d){return new Promise(function(_0x1e841d,_0x284d36){var _0x4e4694=new AWS['S3']({'accessKeyId':_0x1ad0cb,'secretAccessKey':_0x459b22,'region':_0x56f73d});_0x4e4694[_0x5ff3('0x64')]({},function(_0x46cdfa,_0x3ab694){if(_0x46cdfa){return _0x284d36(_0x46cdfa);}else{return _0x1e841d(_0x3ab694);}});});}function createBucket(_0x5e0139,_0x110da5,_0x346a62,_0x46345c){return new Promise(function(_0x224b78,_0x3e7f5d){var _0x2baaaf=new AWS['S3']({'accessKeyId':_0x110da5,'secretAccessKey':_0x5e0139,'region':_0x346a62});_0x2baaaf['createBucket']({'Bucket':_0x46345c},function(_0x35fe6a,_0x803d35){if(_0x35fe6a){return _0x3e7f5d(_0x35fe6a);}else{return _0x224b78(_0x803d35);}});});}function uploadFile(_0x1d43c5,_0x15d3bc,_0x5e70c9,_0x2fb3bc,_0x59a91f,_0x1c4f1e){return new Promise(function(_0x1a49a4,_0x23f9e7){var _0x599809=new AWS['S3']({'accessKeyId':_0x15d3bc,'secretAccessKey':_0x1d43c5,'region':_0x5e70c9});_0x599809[_0x5ff3('0x65')]({'Bucket':_0x2fb3bc,'Key':_0x59a91f,'Body':_0x1c4f1e},function(_0x5e45ee,_0x94e8e4){if(_0x5e45ee){return _0x23f9e7(_0x5e45ee);}else{return _0x1a49a4(_0x94e8e4);}});});}function startTranscribe(_0x39dad3,_0x2970b2,_0x372bcb,_0x285979,_0x52b917,_0x2eeef4){return new Promise(function(_0x2d9381,_0x36e079){var _0x31ae4e=new AWS[(_0x5ff3('0x66'))]({'accessKeyId':_0x2970b2,'secretAccessKey':_0x39dad3,'region':_0x372bcb});_0x31ae4e[_0x5ff3('0x67')]({'TranscriptionJobName':_0x285979,'LanguageCode':_0x52b917,'Media':{'MediaFileUri':_0x2eeef4}},function(_0x402948,_0x5ae517){if(_0x402948){return _0x36e079(_0x402948);}else{return _0x2d9381(_0x5ae517);}});});}function transcribe(_0x5b4ce0,_0x35b2f0,_0x2bb7cc,_0x2ac4fc,_0x5106e2,_0x32be92,_0x201486){return new Promise(function(_0x59c97d,_0x59f1fd){var _0x1a3578={};logger[_0x5ff3('0x60')](util[_0x5ff3('0x2e')](_0x5ff3('0x68'),_0x5b4ce0,_0x5106e2));return uploadFile(_0x35b2f0,_0x2bb7cc,_0x2ac4fc,_0x5106e2,path['basename'](_0x32be92),fs['readFileSync'](_0x32be92))[_0x5ff3('0x23')](function(_0x23029b){logger['info'](util[_0x5ff3('0x2e')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x5b4ce0,_0x5106e2,_0x23029b[_0x5ff3('0x69')]));_0x1a3578[_0x5ff3('0x6a')]=_0x23029b[_0x5ff3('0x6b')];_0x1a3578[_0x5ff3('0x6c')]=_0x23029b[_0x5ff3('0x69')];logger[_0x5ff3('0x60')](util[_0x5ff3('0x2e')](_0x5ff3('0x6d'),_0x5b4ce0));return startTranscribe(_0x35b2f0,_0x2bb7cc,_0x2ac4fc,uuidv4(),_0x201486,_0x23029b['Location']);})[_0x5ff3('0x23')](function(_0x1dc241){logger['info'](util['format'](_0x5ff3('0x6e'),_0x5b4ce0,_0x1dc241[_0x5ff3('0x6f')][_0x5ff3('0x70')]));_0x1a3578[_0x5ff3('0x71')]=_0x1dc241[_0x5ff3('0x6f')][_0x5ff3('0x70')];_0x1a3578[_0x5ff3('0x72')]=_0x1dc241[_0x5ff3('0x6f')][_0x5ff3('0x73')];return _0x59c97d(_0x1a3578);})[_0x5ff3('0x3e')](function(_0x437cf5){return _0x59f1fd(_0x437cf5);});});}exports[_0x5ff3('0x74')]=function(_0x118cc9,_0x402df8,_0x5bf9e1){var _0x431ea2;var _0x3d9339;var _0x4e4ace;var _0x12ed74=require('../../components/encryptor');return db[_0x5ff3('0x29')][_0x5ff3('0x75')]({'where':{'id':_0x118cc9[_0x5ff3('0x40')]['id']}})[_0x5ff3('0x23')](function(_0x217e1b){if(_0x217e1b){var _0x2d8f91=util[_0x5ff3('0x2e')](_0x5ff3('0x4a'),_0x217e1b[_0x5ff3('0x5a')]);if(fs[_0x5ff3('0x4b')](_0x2d8f91)){cypher=!![];return _0x12ed74['decryptFile'](_0x2d8f91,_0x217e1b['value'],config['secrets'][_0x5ff3('0x5c')])['then'](function(){return _0x217e1b;});}return _0x217e1b;}})[_0x5ff3('0x23')](function(_0x183774){if(!_0x183774){throw new db[(_0x5ff3('0x4d'))][(_0x5ff3('0x4e'))](_0x5ff3('0x76'));}_0x3d9339=_0x183774;return db[_0x5ff3('0x77')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x402df8,null))[_0x5ff3('0x23')](function(_0x361263){if(_0x361263){_0x431ea2=_0x361263;if(!_0x431ea2[_0x5ff3('0x78')]||!_0x431ea2['transcribeAccountId']||!_0x431ea2[_0x5ff3('0x79')]||!_0x431ea2[_0x5ff3('0x7a')]||!_0x431ea2['bucket']){throw new db[(_0x5ff3('0x4d'))][(_0x5ff3('0x4e'))]('Transcribe\x20not\x20configured');}if(_0x118cc9[_0x5ff3('0x45')][_0x5ff3('0x7b')]&&(!_0x431ea2['sentiment']||!_0x431ea2['sentimentAccountId']||!_0x431ea2[_0x5ff3('0x7c')]||!_0x431ea2[_0x5ff3('0x7a')]||!_0x431ea2[_0x5ff3('0x6a')])){throw new db[(_0x5ff3('0x4d'))][(_0x5ff3('0x4e'))](_0x5ff3('0x7d'));}return db['CloudProvider']['findOne']({'where':{'id':_0x431ea2[_0x5ff3('0x7e')]}});}})[_0x5ff3('0x23')](function(_0x563e15){if(!_0x563e15){throw new db[(_0x5ff3('0x4d'))][(_0x5ff3('0x4e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x563e15[_0x5ff3('0x7f')]||!_0x563e15[_0x5ff3('0x80')]){throw new db[(_0x5ff3('0x4d'))][(_0x5ff3('0x4e'))](_0x5ff3('0x81'));}_0x4e4ace=_0x563e15;return getBucketslist(_0x4e4ace[_0x5ff3('0x7f')],_0x4e4ace[_0x5ff3('0x80')],_0x431ea2['transcribeRegion']);})[_0x5ff3('0x23')](function(_0x237135){if(_0x237135&&_0x237135[_0x5ff3('0x82')]){var _0x51a7e4=_[_0x5ff3('0x43')](_0x237135['Buckets'],function(_0x9a2fae){return _0x9a2fae[_0x5ff3('0x83')]===_0x431ea2['bucket'];});if(!_0x51a7e4){logger['info'](util[_0x5ff3('0x2e')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x118cc9['params']['id'],_0x431ea2[_0x5ff3('0x6a')]));return createBucket(_0x4e4ace[_0x5ff3('0x7f')],_0x4e4ace['data2'],_0x431ea2['transcribeRegion'],_0x431ea2[_0x5ff3('0x6a')]);}logger[_0x5ff3('0x60')](util[_0x5ff3('0x2e')](_0x5ff3('0x84'),_0x118cc9[_0x5ff3('0x40')]['id'],_0x431ea2['bucket']));return;}})['then'](function(_0x3a4158){if(_0x3d9339[_0x5ff3('0x72')]===_0x5ff3('0x85')){return transcribe(_0x118cc9[_0x5ff3('0x40')]['id'],_0x4e4ace[_0x5ff3('0x7f')],_0x4e4ace[_0x5ff3('0x80')],_0x431ea2['transcribeRegion'],_0x431ea2['bucket'],_0x3d9339[_0x5ff3('0x5a')],_0x431ea2[_0x5ff3('0x7a')]);}else{logger[_0x5ff3('0x60')](util[_0x5ff3('0x2e')](_0x5ff3('0x86'),_0x118cc9[_0x5ff3('0x40')]['id']));return{'transcribeStatus':_0x5ff3('0x87')};}})[_0x5ff3('0x23')](function(_0x5357a9){if(_0x5357a9){_0x5357a9[_0x5ff3('0x88')]=_0x118cc9[_0x5ff3('0x45')][_0x5ff3('0x7b')];return _0x3d9339[_0x5ff3('0x89')](_0x5357a9);}})['then'](respondWithResult(_0x402df8,null))[_0x5ff3('0x3e')](handleError(_0x402df8,null));};function writeFile(_0x2e7f02,_0x2b908f){return new Promise(function(_0x3758a8,_0x5cbc20){fs[_0x5ff3('0x8a')](_0x2b908f,_0x2e7f02,function(_0x221519,_0xc348f6){if(_0x221519){return _0x5cbc20(_0x221519);}else{return _0x3758a8(_0xc348f6);}});});}exports[_0x5ff3('0x8b')]=function(_0x38a1de,_0x5dece7,_0x3e6443){return db[_0x5ff3('0x29')][_0x5ff3('0x75')]({'where':{'id':_0x38a1de[_0x5ff3('0x40')]['id']}})[_0x5ff3('0x23')](handleEntityNotFound(_0x5dece7))[_0x5ff3('0x23')](function(_0xad7b4a){if(_0xad7b4a&&_0xad7b4a[_0x5ff3('0x8c')]){var _0x5e9386=_0xad7b4a[_0x5ff3('0x8c')];var _0x1ee0dd=config[_0x5ff3('0x8d')]+'/server/files/transcribes/transcribe_'+_0xad7b4a['id']+_0x5ff3('0x8e');if(fs['existsSync'](_0x1ee0dd)){return _0x1ee0dd;}return writeFile(_0x5e9386,_0x1ee0dd)[_0x5ff3('0x23')](function(){return _0x1ee0dd;});}else{throw new db['Sequelize']['ValidationError']('Transcript\x20not\x20available');}})['then'](function(_0x17a00f){return _0x5dece7[_0x5ff3('0x47')](_0x17a00f);})[_0x5ff3('0x3e')](handleError(_0x5dece7));}; \ No newline at end of file +var _0xa556=['status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','VoiceRecording','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','download','uniqueid','value','format','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','col','token','$and','push','%s.cypher','existsSync','decryptFile','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xa556,0x11e));var _0x6a55=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xa556[_0x1a72f3];return _0x57ef47;};'use strict';var emlformat=require(_0x6a55('0x0'));var rimraf=require(_0x6a55('0x1'));var zipdir=require(_0x6a55('0x2'));var jsonpatch=require(_0x6a55('0x3'));var rp=require(_0x6a55('0x4'));var moment=require('moment');var BPromise=require(_0x6a55('0x5'));var Mustache=require(_0x6a55('0x6'));var util=require(_0x6a55('0x7'));var path=require(_0x6a55('0x8'));var sox=require(_0x6a55('0x9'));var csv=require(_0x6a55('0xa'));var ejs=require(_0x6a55('0xb'));var fs=require('fs');var fs_extra=require(_0x6a55('0xc'));var _=require('lodash');var squel=require(_0x6a55('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6a55('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6a55('0xf'));var Papa=require(_0x6a55('0x10'));var AWS=require(_0x6a55('0x11'));var uuidv4=require(_0x6a55('0x12'));var Redis=require('ioredis');var authService=require(_0x6a55('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a55('0x14'));var logger=require('../../config/logger')(_0x6a55('0x15'));var utils=require(_0x6a55('0x16'));var config=require(_0x6a55('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a55('0x18'))['db'];function respondWithStatusCode(_0x279653,_0x203a5a){_0x203a5a=_0x203a5a||0xcc;return function(_0x3048ab){if(_0x3048ab){return _0x279653[_0x6a55('0x19')](_0x203a5a);}return _0x279653[_0x6a55('0x1a')](_0x203a5a)[_0x6a55('0x1b')]();};}function respondWithResult(_0x11046f,_0xed151c){_0xed151c=_0xed151c||0xc8;return function(_0xa5b6fe){if(_0xa5b6fe){return _0x11046f[_0x6a55('0x1a')](_0xed151c)[_0x6a55('0x1c')](_0xa5b6fe);}};}function respondWithFilteredResult(_0x3143bb,_0x569e2f){return function(_0x1e2c59){if(_0x1e2c59){var _0x5a0883=typeof _0x569e2f['offset']===_0x6a55('0x1d')&&typeof _0x569e2f[_0x6a55('0x1e')]===_0x6a55('0x1d');var _0x425649=_0x1e2c59[_0x6a55('0x1f')];var _0xef8d9d=_0x5a0883?0x0:_0x569e2f[_0x6a55('0x20')];var _0x30080e=_0x5a0883?_0x1e2c59[_0x6a55('0x1f')]:_0x569e2f[_0x6a55('0x20')]+_0x569e2f['limit'];var _0x23f433;if(_0x30080e>=_0x425649){_0x30080e=_0x425649;_0x23f433=0xc8;}else{_0x23f433=0xce;}_0x3143bb['status'](_0x23f433);return _0x3143bb[_0x6a55('0x21')](_0x6a55('0x22'),_0xef8d9d+'-'+_0x30080e+'/'+_0x425649)[_0x6a55('0x1c')](_0x1e2c59);}return null;};}function patchUpdates(_0x37a573){return function(_0x5f5c5d){try{jsonpatch[_0x6a55('0x23')](_0x5f5c5d,_0x37a573,!![]);}catch(_0x475299){return BPromise[_0x6a55('0x24')](_0x475299);}return _0x5f5c5d[_0x6a55('0x25')]();};}function saveUpdates(_0x5f09d9,_0x251433){return function(_0x5f222b){if(_0x5f222b){return _0x5f222b[_0x6a55('0x26')](_0x5f09d9)[_0x6a55('0x27')](function(_0x1a02e4){return _0x1a02e4;});}return null;};}function removeEntity(_0x158b99,_0x2d7eee){return function(_0x572010){if(_0x572010){return _0x572010[_0x6a55('0x28')]()[_0x6a55('0x27')](function(){_0x158b99[_0x6a55('0x1a')](0xcc)[_0x6a55('0x1b')]();});}};}function handleEntityNotFound(_0x33d5d0,_0x53d5fd){return function(_0x2bd85b){if(!_0x2bd85b){_0x33d5d0[_0x6a55('0x19')](0x194);}return _0x2bd85b;};}function handleError(_0x3a2dea,_0x95161){_0x95161=_0x95161||0x1f4;return function(_0xef51ce){logger[_0x6a55('0x29')](_0xef51ce[_0x6a55('0x2a')]);if(_0xef51ce['name']){delete _0xef51ce[_0x6a55('0x2b')];}_0x3a2dea[_0x6a55('0x1a')](_0x95161)[_0x6a55('0x2c')](_0xef51ce);};}exports[_0x6a55('0x2d')]=function(_0x2bbe12,_0x37ecbf){var _0x38bcf2={},_0x3984b3={},_0x54d166={'count':0x0,'rows':[]};var _0x23552c=_['map'](db['VoiceRecording'][_0x6a55('0x2e')],function(_0x2d18ce){return{'name':_0x2d18ce[_0x6a55('0x2f')],'type':_0x2d18ce[_0x6a55('0x30')][_0x6a55('0x31')]};});_0x3984b3[_0x6a55('0x32')]=_[_0x6a55('0x33')](_['map'](_0x23552c,'name'),['format']);_0x3984b3[_0x6a55('0x34')]=_[_0x6a55('0x35')](_0x2bbe12[_0x6a55('0x34')]);_0x3984b3['filters']=_[_0x6a55('0x36')](_0x3984b3[_0x6a55('0x32')],_0x3984b3[_0x6a55('0x34')]);_0x38bcf2[_0x6a55('0x37')]=_[_0x6a55('0x36')](_0x3984b3[_0x6a55('0x32')],qs[_0x6a55('0x38')](_0x2bbe12['query'][_0x6a55('0x38')]));_0x38bcf2[_0x6a55('0x37')]=_0x38bcf2[_0x6a55('0x37')][_0x6a55('0x39')]?_0x38bcf2[_0x6a55('0x37')]:_0x3984b3[_0x6a55('0x32')];if(!_0x2bbe12['query'][_0x6a55('0x3a')](_0x6a55('0x3b'))){_0x38bcf2[_0x6a55('0x1e')]=qs[_0x6a55('0x1e')](_0x2bbe12[_0x6a55('0x34')][_0x6a55('0x1e')]);_0x38bcf2['offset']=qs[_0x6a55('0x20')](_0x2bbe12[_0x6a55('0x34')]['offset']);}_0x38bcf2['order']=qs[_0x6a55('0x3c')](_0x2bbe12[_0x6a55('0x34')]['sort']);_0x38bcf2[_0x6a55('0x3d')]=qs[_0x6a55('0x3e')](_['pick'](_0x2bbe12[_0x6a55('0x34')],_0x3984b3[_0x6a55('0x3e')]),_0x23552c);if(_0x2bbe12[_0x6a55('0x34')][_0x6a55('0x3f')]){_0x38bcf2[_0x6a55('0x3d')]=_[_0x6a55('0x40')](_0x38bcf2['where'],{'$or':_['map'](_0x23552c,function(_0x578c5b){if(_0x578c5b[_0x6a55('0x30')]!=='VIRTUAL'){var _0x436652={};_0x436652[_0x578c5b[_0x6a55('0x2b')]]={'$like':'%'+_0x2bbe12['query']['filter']+'%'};return _0x436652;}})});}_0x38bcf2=_[_0x6a55('0x40')]({},_0x38bcf2,_0x2bbe12[_0x6a55('0x41')]);var _0x4e5edf={'where':_0x38bcf2[_0x6a55('0x3d')]};return db[_0x6a55('0x42')]['count'](_0x4e5edf)['then'](function(_0x5523cb){_0x54d166['count']=_0x5523cb;if(_0x2bbe12[_0x6a55('0x34')][_0x6a55('0x43')]){_0x38bcf2[_0x6a55('0x44')]=[{'all':!![]}];}return db[_0x6a55('0x42')][_0x6a55('0x45')](_0x38bcf2);})[_0x6a55('0x27')](function(_0x30a80c){_0x54d166[_0x6a55('0x46')]=_0x30a80c;return _0x54d166;})[_0x6a55('0x27')](respondWithFilteredResult(_0x37ecbf,_0x38bcf2))[_0x6a55('0x47')](handleError(_0x37ecbf,null));};exports[_0x6a55('0x48')]=function(_0x33c569,_0x4587e9){var _0x4e54cd={'raw':![],'where':{'id':_0x33c569[_0x6a55('0x49')]['id']}},_0xa3dab4={};_0xa3dab4[_0x6a55('0x32')]=_[_0x6a55('0x35')](db[_0x6a55('0x42')][_0x6a55('0x2e')]);_0xa3dab4[_0x6a55('0x34')]=_['keys'](_0x33c569[_0x6a55('0x34')]);_0xa3dab4[_0x6a55('0x3e')]=_[_0x6a55('0x36')](_0xa3dab4[_0x6a55('0x32')],_0xa3dab4[_0x6a55('0x34')]);_0x4e54cd['attributes']=_[_0x6a55('0x36')](_0xa3dab4[_0x6a55('0x32')],qs[_0x6a55('0x38')](_0x33c569[_0x6a55('0x34')]['fields']));_0x4e54cd[_0x6a55('0x37')]=_0x4e54cd[_0x6a55('0x37')][_0x6a55('0x39')]?_0x4e54cd[_0x6a55('0x37')]:_0xa3dab4[_0x6a55('0x32')];if(_0x33c569[_0x6a55('0x34')][_0x6a55('0x43')]){_0x4e54cd[_0x6a55('0x44')]=[{'all':!![]}];}_0x4e54cd=_[_0x6a55('0x40')]({},_0x4e54cd,_0x33c569[_0x6a55('0x41')]);return db[_0x6a55('0x42')][_0x6a55('0x4a')](_0x4e54cd)[_0x6a55('0x27')](handleEntityNotFound(_0x4587e9,null))[_0x6a55('0x27')](respondWithResult(_0x4587e9,null))['catch'](handleError(_0x4587e9,null));};exports[_0x6a55('0x4b')]=function(_0x369607,_0x3b01a1){return db[_0x6a55('0x42')][_0x6a55('0x4b')](_0x369607[_0x6a55('0x4c')],{})[_0x6a55('0x27')](respondWithResult(_0x3b01a1,0xc9))[_0x6a55('0x47')](handleError(_0x3b01a1,null));};exports['update']=function(_0x28774d,_0x3a1dd4){if(_0x28774d[_0x6a55('0x4c')]['id']){delete _0x28774d[_0x6a55('0x4c')]['id'];}return db['VoiceRecording'][_0x6a55('0x4a')]({'where':{'id':_0x28774d[_0x6a55('0x49')]['id']}})[_0x6a55('0x27')](handleEntityNotFound(_0x3a1dd4,null))[_0x6a55('0x27')](saveUpdates(_0x28774d[_0x6a55('0x4c')],null))['then'](respondWithResult(_0x3a1dd4,null))[_0x6a55('0x47')](handleError(_0x3a1dd4,null));};exports[_0x6a55('0x4d')]=function(_0x21cdf6,_0x4f026f){return db[_0x6a55('0x42')][_0x6a55('0x4d')]()['then'](respondWithResult(_0x4f026f,null))[_0x6a55('0x47')](handleError(_0x4f026f,null));};exports[_0x6a55('0x4e')]=function(_0x29f7d6,_0x42a580,_0x5c6881){var _0x183ef5=require('../../components/encryptor');var _0x6369bb=![];var _0x17d3e3={};if(_0x29f7d6[_0x6a55('0x34')][_0x6a55('0x30')]&&_0x29f7d6['query']['type']===_0x6a55('0x4f')){_0x17d3e3['uniqueid']=_0x29f7d6[_0x6a55('0x49')]['id'];}else{_0x17d3e3['id']=_0x29f7d6[_0x6a55('0x49')]['id'];}return db[_0x6a55('0x42')][_0x6a55('0x4a')]({'where':_0x17d3e3,'attributes':['id',_0x6a55('0x50')],'raw':!![]})[_0x6a55('0x27')](handleEntityNotFound(_0x42a580,null))[_0x6a55('0x27')](function(_0x231a6b){if(_0x231a6b){var _0x6d7cfe=_0x231a6b['value'];var _0x309fa5=util[_0x6a55('0x51')]('%s.cypher',_0x6d7cfe);if(fs['existsSync'](_0x309fa5)){_0x6369bb=!![];return _0x183ef5['decryptFile'](_0x309fa5,_0x6d7cfe,config[_0x6a55('0x52')][_0x6a55('0x53')])[_0x6a55('0x27')](function(){return _0x231a6b;});}return _0x231a6b;}})['then'](function(_0x4a8abb){if(_0x4a8abb){var _0x236249=_0x4a8abb[_0x6a55('0x50')];if(!fs['existsSync'](_0x236249)){throw new db[(_0x6a55('0x54'))][(_0x6a55('0x55'))](_0x6a55('0x56'));}if(_0x4a8abb['filename']){return _0x42a580['download'](_0x236249,_0x4a8abb[_0x6a55('0x57')]+path[_0x6a55('0x58')](_0x236249),function(){if(_0x6369bb){fs[_0x6a55('0x59')](_0x236249);}});}else{return _0x42a580[_0x6a55('0x4e')](_0x236249,function(_0xc96378){if(_0x6369bb){fs[_0x6a55('0x59')](_0x236249);}});}}})[_0x6a55('0x47')](function(_0x2828d8){if(_0x2828d8[_0x6a55('0x5a')]===_0x6a55('0x56')){_0x42a580[_0x6a55('0x1a')](0x194)[_0x6a55('0x2c')](_0x6a55('0x5b'));}else{return handleError(_0x42a580,null);}});};exports[_0x6a55('0x5c')]=function(_0x181a68,_0x11c64d,_0x5d4fac){var _0x3d82ff=require(_0x6a55('0x5d'));var _0x5bc122=![];var _0x135bd4={'$and':[db[_0x6a55('0x5e')][_0x6a55('0x3d')](db[_0x6a55('0x5e')]['fn'](_0x6a55('0x5f'),db['sequelize'][_0x6a55('0x60')](_0x6a55('0x4f'))),_0x181a68[_0x6a55('0x34')][_0x6a55('0x61')])]};if(_0x181a68['query'][_0x6a55('0x30')]&&_0x181a68[_0x6a55('0x34')][_0x6a55('0x30')]===_0x6a55('0x4f')){_0x135bd4[_0x6a55('0x62')]['push']({'uniqueid':_0x181a68[_0x6a55('0x49')]['id']});}else{_0x135bd4[_0x6a55('0x62')][_0x6a55('0x63')]({'id':_0x181a68[_0x6a55('0x49')]['id']});}return db[_0x6a55('0x42')][_0x6a55('0x4a')]({'where':_0x135bd4,'attributes':['id',_0x6a55('0x50')],'raw':!![]})[_0x6a55('0x27')](handleEntityNotFound(_0x11c64d,null))[_0x6a55('0x27')](function(_0x3367b0){if(_0x3367b0){var _0xef2bc7=util['format'](_0x6a55('0x64'),_0x3367b0[_0x6a55('0x50')]);if(fs[_0x6a55('0x65')](_0xef2bc7)){_0x5bc122=!![];return _0x3d82ff[_0x6a55('0x66')](_0xef2bc7,_0x3367b0[_0x6a55('0x50')],config['secrets'][_0x6a55('0x53')])['then'](function(){return _0x3367b0;});}return _0x3367b0;}})[_0x6a55('0x27')](function(_0x4fabde){if(_0x4fabde){if(!fs[_0x6a55('0x65')](_0x4fabde['value'])){throw new db[(_0x6a55('0x54'))]['ValidationError'](_0x6a55('0x56'));}if(_0x4fabde[_0x6a55('0x57')]){return _0x11c64d[_0x6a55('0x4e')](_0x4fabde[_0x6a55('0x50')],_0x4fabde['filename']+path[_0x6a55('0x58')](_0x4fabde[_0x6a55('0x50')]),function(){if(_0x5bc122){fs[_0x6a55('0x59')](_0x4fabde[_0x6a55('0x50')]);}});}else{return _0x11c64d['download'](_0x4fabde[_0x6a55('0x50')],function(_0x26a50f){if(_0x5bc122){fs[_0x6a55('0x59')](_0x4fabde[_0x6a55('0x50')]);}});}}})[_0x6a55('0x47')](handleError(_0x11c64d,null));};exports[_0x6a55('0x28')]=function(_0x25acf9,_0x2fb733){return db['VoiceRecording'][_0x6a55('0x4a')]({'where':{'id':_0x25acf9['params']['id']}})['then'](function(_0x24d04b){if(_['isNil'](_0x24d04b)){throw new ReferenceError(_0x6a55('0x67'));}return _0x24d04b;})['then'](function(_0x477839){var _0x5c460e=_0x477839[_0x6a55('0x50')];logger[_0x6a55('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x5c460e);if(!_['isNil'](_0x477839[_0x6a55('0x50')])&&fs[_0x6a55('0x65')](_0x5c460e)){logger['info']('File:\x20\x22'+_0x5c460e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x5c460e);}_0x5c460e=_0x5c460e+'.cypher';if(!_['isNil'](_0x477839[_0x6a55('0x50')])&&fs[_0x6a55('0x65')](_0x5c460e)){logger[_0x6a55('0x68')]('File:\x20\x22'+_0x5c460e+_0x6a55('0x69'));fs[_0x6a55('0x6a')](_0x5c460e);}return _0x477839;})[_0x6a55('0x27')](function(_0x166dc4){if(!_0x166dc4)throw new InternalError();return _0x166dc4[_0x6a55('0x28')]();})[_0x6a55('0x27')](function(){_0x2fb733[_0x6a55('0x1a')](0xcc)[_0x6a55('0x1b')]();})['catch'](handleError(_0x2fb733,null));};function getBucketslist(_0x162632,_0x1dd1bd,_0x4edc6b){return new Promise(function(_0x2ca1ea,_0x5b1ebf){var _0x1aa990=new AWS['S3']({'accessKeyId':_0x1dd1bd,'secretAccessKey':_0x162632,'region':_0x4edc6b});_0x1aa990['listBuckets']({},function(_0x31a067,_0xb52077){if(_0x31a067){return _0x5b1ebf(_0x31a067);}else{return _0x2ca1ea(_0xb52077);}});});}function createBucket(_0x2da97f,_0x2526da,_0xc2bce6,_0x58f7e){return new Promise(function(_0x3fc5b5,_0x386c68){var _0x20d4c3=new AWS['S3']({'accessKeyId':_0x2526da,'secretAccessKey':_0x2da97f,'region':_0xc2bce6});_0x20d4c3['createBucket']({'Bucket':_0x58f7e},function(_0x530ead,_0xa18978){if(_0x530ead){return _0x386c68(_0x530ead);}else{return _0x3fc5b5(_0xa18978);}});});}function uploadFile(_0x453f6a,_0x14f270,_0x261b2c,_0x17283d,_0xe4532e,_0x503340){return new Promise(function(_0x3579ca,_0x2ad0e3){var _0x362e72=new AWS['S3']({'accessKeyId':_0x14f270,'secretAccessKey':_0x453f6a,'region':_0x261b2c});_0x362e72[_0x6a55('0x6b')]({'Bucket':_0x17283d,'Key':_0xe4532e,'Body':_0x503340},function(_0x41ddf4,_0x3bc402){if(_0x41ddf4){return _0x2ad0e3(_0x41ddf4);}else{return _0x3579ca(_0x3bc402);}});});}function startTranscribe(_0x26fbc4,_0x3aa55f,_0x551944,_0x57d072,_0x16a273,_0x2c6848){return new Promise(function(_0x49b2fc,_0x4c6236){var _0x41f31c=new AWS[(_0x6a55('0x6c'))]({'accessKeyId':_0x3aa55f,'secretAccessKey':_0x26fbc4,'region':_0x551944});_0x41f31c[_0x6a55('0x6d')]({'TranscriptionJobName':_0x57d072,'LanguageCode':_0x16a273,'Media':{'MediaFileUri':_0x2c6848}},function(_0xb8ac34,_0x57d22f){if(_0xb8ac34){return _0x4c6236(_0xb8ac34);}else{return _0x49b2fc(_0x57d22f);}});});}function transcribe(_0x2493f9,_0xd0d210,_0xf781fd,_0x399b72,_0x2c8bd8,_0x455241,_0xdc4989){return new Promise(function(_0x32c1f1,_0x3b77b7){var _0x17446f={};logger[_0x6a55('0x68')](util[_0x6a55('0x51')](_0x6a55('0x6e'),_0x2493f9,_0x2c8bd8));return uploadFile(_0xd0d210,_0xf781fd,_0x399b72,_0x2c8bd8,path[_0x6a55('0x6f')](_0x455241),fs[_0x6a55('0x70')](_0x455241))[_0x6a55('0x27')](function(_0xd892a5){logger[_0x6a55('0x68')](util[_0x6a55('0x51')](_0x6a55('0x71'),_0x2493f9,_0x2c8bd8,_0xd892a5['Location']));_0x17446f[_0x6a55('0x72')]=_0xd892a5[_0x6a55('0x73')];_0x17446f[_0x6a55('0x74')]=_0xd892a5['Location'];logger[_0x6a55('0x68')](util[_0x6a55('0x51')](_0x6a55('0x75'),_0x2493f9));return startTranscribe(_0xd0d210,_0xf781fd,_0x399b72,uuidv4(),_0xdc4989,_0xd892a5[_0x6a55('0x76')]);})[_0x6a55('0x27')](function(_0x346f44){logger['info'](util[_0x6a55('0x51')](_0x6a55('0x77'),_0x2493f9,_0x346f44[_0x6a55('0x78')][_0x6a55('0x79')]));_0x17446f[_0x6a55('0x7a')]=_0x346f44[_0x6a55('0x78')][_0x6a55('0x79')];_0x17446f[_0x6a55('0x7b')]=_0x346f44['TranscriptionJob'][_0x6a55('0x7c')];return _0x32c1f1(_0x17446f);})[_0x6a55('0x47')](function(_0x335a76){return _0x3b77b7(_0x335a76);});});}exports[_0x6a55('0x7d')]=function(_0x35ce19,_0x12c313,_0x3f72f5){var _0x1baaf2;var _0x3a2fe5;var _0xeeefc1;var _0x554620=require(_0x6a55('0x5d'));return db[_0x6a55('0x42')][_0x6a55('0x7e')]({'where':{'id':_0x35ce19[_0x6a55('0x49')]['id']}})[_0x6a55('0x27')](function(_0x1b9480){if(_0x1b9480){var _0x5d58e1=util[_0x6a55('0x51')](_0x6a55('0x64'),_0x1b9480['value']);if(fs['existsSync'](_0x5d58e1)){cypher=!![];return _0x554620[_0x6a55('0x66')](_0x5d58e1,_0x1b9480[_0x6a55('0x50')],config[_0x6a55('0x52')]['recording'])['then'](function(){return _0x1b9480;});}return _0x1b9480;}})['then'](function(_0x3fccf5){if(!_0x3fccf5){throw new db[(_0x6a55('0x54'))]['ValidationError'](_0x6a55('0x7f'));}_0x3a2fe5=_0x3fccf5;return db[_0x6a55('0x80')][_0x6a55('0x7e')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x12c313,null))['then'](function(_0x3f3193){if(_0x3f3193){_0x1baaf2=_0x3f3193;if(!_0x1baaf2[_0x6a55('0x81')]||!_0x1baaf2[_0x6a55('0x82')]||!_0x1baaf2[_0x6a55('0x83')]||!_0x1baaf2[_0x6a55('0x84')]||!_0x1baaf2[_0x6a55('0x72')]){throw new db[(_0x6a55('0x54'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x35ce19['body'][_0x6a55('0x85')]&&(!_0x1baaf2[_0x6a55('0x86')]||!_0x1baaf2[_0x6a55('0x87')]||!_0x1baaf2[_0x6a55('0x88')]||!_0x1baaf2[_0x6a55('0x84')]||!_0x1baaf2[_0x6a55('0x72')])){throw new db[(_0x6a55('0x54'))][(_0x6a55('0x55'))](_0x6a55('0x89'));}return db[_0x6a55('0x8a')][_0x6a55('0x7e')]({'where':{'id':_0x1baaf2[_0x6a55('0x82')]}});}})[_0x6a55('0x27')](function(_0x45dcfc){if(!_0x45dcfc){throw new db[(_0x6a55('0x54'))][(_0x6a55('0x55'))](_0x6a55('0x8b'));}if(!_0x45dcfc[_0x6a55('0x8c')]||!_0x45dcfc[_0x6a55('0x8d')]){throw new db[(_0x6a55('0x54'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0xeeefc1=_0x45dcfc;return getBucketslist(_0xeeefc1['data1'],_0xeeefc1['data2'],_0x1baaf2[_0x6a55('0x83')]);})['then'](function(_0x54e463){if(_0x54e463&&_0x54e463[_0x6a55('0x8e')]){var _0x273e70=_[_0x6a55('0x4a')](_0x54e463['Buckets'],function(_0x576b7f){return _0x576b7f[_0x6a55('0x8f')]===_0x1baaf2[_0x6a55('0x72')];});if(!_0x273e70){logger[_0x6a55('0x68')](util[_0x6a55('0x51')](_0x6a55('0x90'),_0x35ce19[_0x6a55('0x49')]['id'],_0x1baaf2[_0x6a55('0x72')]));return createBucket(_0xeeefc1[_0x6a55('0x8c')],_0xeeefc1[_0x6a55('0x8d')],_0x1baaf2[_0x6a55('0x83')],_0x1baaf2[_0x6a55('0x72')]);}logger[_0x6a55('0x68')](util[_0x6a55('0x51')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x35ce19[_0x6a55('0x49')]['id'],_0x1baaf2[_0x6a55('0x72')]));return;}})[_0x6a55('0x27')](function(_0x248df5){if(_0x3a2fe5['transcribeStatus']===_0x6a55('0x91')){return transcribe(_0x35ce19[_0x6a55('0x49')]['id'],_0xeeefc1[_0x6a55('0x8c')],_0xeeefc1['data2'],_0x1baaf2[_0x6a55('0x83')],_0x1baaf2[_0x6a55('0x72')],_0x3a2fe5['value'],_0x1baaf2[_0x6a55('0x84')]);}else{logger[_0x6a55('0x68')](util['format'](_0x6a55('0x92'),_0x35ce19[_0x6a55('0x49')]['id']));return{'transcribeStatus':_0x6a55('0x93')};}})[_0x6a55('0x27')](function(_0x2ed0db){if(_0x2ed0db){_0x2ed0db[_0x6a55('0x94')]=_0x35ce19[_0x6a55('0x4c')][_0x6a55('0x85')];return _0x3a2fe5['updateAttributes'](_0x2ed0db);}})[_0x6a55('0x27')](respondWithResult(_0x12c313,null))[_0x6a55('0x47')](handleError(_0x12c313,null));};function writeFile(_0x38af5f,_0x47348f){return new Promise(function(_0x323903,_0x59d937){fs[_0x6a55('0x95')](_0x47348f,_0x38af5f,function(_0x19a71a,_0x589770){if(_0x19a71a){return _0x59d937(_0x19a71a);}else{return _0x323903(_0x589770);}});});}exports[_0x6a55('0x96')]=function(_0x38684f,_0x2fac24,_0x80ec5a){return db['VoiceRecording'][_0x6a55('0x7e')]({'where':{'id':_0x38684f[_0x6a55('0x49')]['id']}})[_0x6a55('0x27')](handleEntityNotFound(_0x2fac24))[_0x6a55('0x27')](function(_0x11e433){if(_0x11e433&&_0x11e433[_0x6a55('0x97')]){var _0xc7ce67=_0x11e433['fileText'];var _0x3c8b69=config[_0x6a55('0x98')]+_0x6a55('0x99')+_0x11e433['id']+_0x6a55('0x9a');if(fs['existsSync'](_0x3c8b69)){return _0x3c8b69;}return writeFile(_0xc7ce67,_0x3c8b69)[_0x6a55('0x27')](function(){return _0x3c8b69;});}else{throw new db[(_0x6a55('0x54'))][(_0x6a55('0x55'))](_0x6a55('0x9b'));}})[_0x6a55('0x27')](function(_0xcbdc5f){return _0x2fac24[_0x6a55('0x4e')](_0xcbdc5f);})['catch'](handleError(_0x2fac24));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index d4a6242..6c2469a 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 _0x34e8=['./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid','transcribeStatus'];(function(_0x253f0e,_0x3d2fe7){var _0x5d231a=function(_0x1f7f33){while(--_0x1f7f33){_0x253f0e['push'](_0x253f0e['shift']());}};_0x5d231a(++_0x3d2fe7);}(_0x34e8,0x12c));var _0x834e=function(_0x8559b4,_0x3e8bbd){_0x8559b4=_0x8559b4-0x0;var _0x5a3558=_0x34e8[_0x8559b4];return _0x5a3558;};'use strict';var attributes=require(_0x834e('0x0'));module[_0x834e('0x1')]=function(_0x8b339,_0x35e6fb){return _0x8b339['define'](_0x834e('0x2'),attributes,{'tableName':_0x834e('0x3'),'paranoid':![],'indexes':[{'name':_0x834e('0x4'),'fields':[_0x834e('0x4')]},{'name':_0x834e('0x5'),'fields':[_0x834e('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xca8d=['exports','define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x5be7f3,_0x9b4a51){var _0x3e2467=function(_0x56f615){while(--_0x56f615){_0x5be7f3['push'](_0x5be7f3['shift']());}};_0x3e2467(++_0x9b4a51);}(_0xca8d,0x172));var _0xdca8=function(_0x3a924d,_0x1f0870){_0x3a924d=_0x3a924d-0x0;var _0x2f9f0b=_0xca8d[_0x3a924d];return _0x2f9f0b;};'use strict';var attributes=require(_0xdca8('0x0'));module[_0xdca8('0x1')]=function(_0xeea658,_0x14a797){return _0xeea658[_0xdca8('0x2')](_0xdca8('0x3'),attributes,{'tableName':_0xdca8('0x4'),'paranoid':![],'indexes':[{'name':_0xdca8('0x5'),'fields':[_0xdca8('0x5')]},{'name':_0xdca8('0x6'),'fields':[_0xdca8('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 9c25738..4c821c7 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 _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','attributes','limit','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','format','%s.cypher','value','encryptFile','secrets','unlink','info','CreateVoiceRecording\x20file\x20encrypted','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x140adf,_0x2342f8){var _0x3c1f69=function(_0x4259de){while(--_0x4259de){_0x140adf['push'](_0x140adf['shift']());}};_0x3c1f69(++_0x2342f8);}(_0xc2c7,0x134));var _0x7c2c=function(_0x1168ca,_0x1489f1){_0x1168ca=_0x1168ca-0x0;var _0x26b5f2=_0xc2c7[_0x1168ca];return _0x26b5f2;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});}exports[_0x7c2c('0x15')]=function(_0x14453f){var _0x2a9539=this;return new Promise(function(_0x17df4a,_0x26be0f){return db[_0x7c2c('0x16')][_0x7c2c('0x17')](_0x14453f[_0x7c2c('0x18')],{'raw':_0x14453f[_0x7c2c('0x19')]?_0x14453f[_0x7c2c('0x19')][_0x7c2c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14453f['options']?_0x14453f[_0x7c2c('0x19')]['where']||null:null,'attributes':_0x14453f['options']?_0x14453f[_0x7c2c('0x19')][_0x7c2c('0x1b')]||null:null,'limit':_0x14453f[_0x7c2c('0x19')]?_0x14453f[_0x7c2c('0x19')][_0x7c2c('0x1c')]||null:null})[_0x7c2c('0xc')](function(_0xa84620){logger['info'](_0x7c2c('0x15'),_0x14453f);logger['debug'](_0x7c2c('0x15'),_0x14453f,JSON['stringify'](_0xa84620));_0x17df4a(_0xa84620);})[_0x7c2c('0x1d')](function(_0x274c3b){logger[_0x7c2c('0x12')]('UpdateVoiceRecording',_0x274c3b['message'],_0x14453f);_0x26be0f(_0x2a9539[_0x7c2c('0x12')](0x1f4,_0x274c3b[_0x7c2c('0x14')]));});});};exports[_0x7c2c('0x1e')]=function(_0x150690){var _0x31d8f3=this;return new Promise(function(_0xa8e145,_0x3f4618){var _0x4b1dd0=require(_0x7c2c('0x1f'));var _0xf39941;return db[_0x7c2c('0x20')][_0x7c2c('0x21')]({'attributes':['id',_0x7c2c('0x22')],'where':{'id':0x1},'raw':!![]})[_0x7c2c('0xc')](function(_0xf2bfd1){_0xf39941=_0xf2bfd1;return db[_0x7c2c('0x16')][_0x7c2c('0x23')](_0x150690['body']);})[_0x7c2c('0xc')](function(_0x3a3730){if(_0xf39941[_0x7c2c('0x22')]&&fs[_0x7c2c('0x24')](_0x3a3730['value'])){var _0xcb98ba=util[_0x7c2c('0x25')](_0x7c2c('0x26'),_0x3a3730[_0x7c2c('0x27')]);return _0x4b1dd0[_0x7c2c('0x28')](_0x3a3730[_0x7c2c('0x27')],_0xcb98ba,config[_0x7c2c('0x29')]['recording'])[_0x7c2c('0xc')](function(){fs[_0x7c2c('0x2a')](_0x3a3730[_0x7c2c('0x27')]);logger[_0x7c2c('0x2b')](_0x7c2c('0x2c'));return _0x3a3730;});}return _0x3a3730;})['then'](function(_0x47ef3c){logger[_0x7c2c('0x2b')]('CreateVoiceRecording',_0x150690);logger['debug'](_0x7c2c('0x1e'),_0x150690,JSON[_0x7c2c('0x11')](_0x47ef3c));_0xa8e145(_0x47ef3c);})[_0x7c2c('0x1d')](function(_0x156c03){logger['error'](_0x7c2c('0x1e'),_0x156c03[_0x7c2c('0x14')],_0x150690);_0x3f4618(_0x31d8f3[_0x7c2c('0x12')](0x1f4,_0x156c03[_0x7c2c('0x14')]));});});}; \ No newline at end of file +var _0x7046=['info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','update','body','options','raw','attributes','limit','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','value','format','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x35c92a,_0x41bd37){var _0x412850=function(_0x4ec5fa){while(--_0x4ec5fa){_0x35c92a['push'](_0x35c92a['shift']());}};_0x412850(++_0x41bd37);}(_0x7046,0x144));var _0x6704=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x7046[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var moment=require(_0x6704('0x2'));var BPromise=require(_0x6704('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6704('0x4'));var db=require(_0x6704('0x5'))['db'];var utils=require(_0x6704('0x6'));var logger=require('../../config/logger')(_0x6704('0x7'));var config=require(_0x6704('0x8'));var jayson=require(_0x6704('0x9'));var client=jayson[_0x6704('0xa')][_0x6704('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4badf8,_0x5ced8,_0x49b8b6){return new BPromise(function(_0x56b1ff,_0x390ace){return client['request'](_0x4badf8,_0x49b8b6)['then'](function(_0x3ca599){logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,_0x6704('0xe'));logger[_0x6704('0xf')](_0x6704('0x10'),_0x5ced8,_0x6704('0xe'),JSON[_0x6704('0x11')](_0x3ca599));if(_0x3ca599['error']){if(_0x3ca599[_0x6704('0x12')][_0x6704('0x13')]===0x1f4){logger['error'](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x390ace(_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);}logger[_0x6704('0x12')](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x56b1ff(_0x3ca599['error'][_0x6704('0x14')]);}else{logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,'request\x20sent');_0x56b1ff(_0x3ca599[_0x6704('0x15')][_0x6704('0x14')]);}})[_0x6704('0x16')](function(_0x29fa46){logger[_0x6704('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x5ced8,_0x29fa46);_0x390ace(_0x29fa46);});});}exports[_0x6704('0x17')]=function(_0x31d732){var _0x135f4b=this;return new Promise(function(_0xe49450,_0x344ed9){return db['VoiceRecording'][_0x6704('0x18')](_0x31d732[_0x6704('0x19')],{'raw':_0x31d732[_0x6704('0x1a')]?_0x31d732[_0x6704('0x1a')][_0x6704('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31d732[_0x6704('0x1a')]?_0x31d732[_0x6704('0x1a')]['where']||null:null,'attributes':_0x31d732[_0x6704('0x1a')]?_0x31d732[_0x6704('0x1a')][_0x6704('0x1c')]||null:null,'limit':_0x31d732['options']?_0x31d732['options'][_0x6704('0x1d')]||null:null})[_0x6704('0x1e')](function(_0x3cd12e){logger[_0x6704('0xc')](_0x6704('0x17'),_0x31d732);logger['debug'](_0x6704('0x17'),_0x31d732,JSON[_0x6704('0x11')](_0x3cd12e));_0xe49450(_0x3cd12e);})[_0x6704('0x16')](function(_0x348fcb){logger[_0x6704('0x12')](_0x6704('0x17'),_0x348fcb[_0x6704('0x14')],_0x31d732);_0x344ed9(_0x135f4b[_0x6704('0x12')](0x1f4,_0x348fcb[_0x6704('0x14')]));});});};exports[_0x6704('0x1f')]=function(_0x36bea4){var _0x1bdfee=this;return new Promise(function(_0x118d93,_0x4979ec){var _0x5ac014=require(_0x6704('0x20'));var _0xf875dc;return db[_0x6704('0x21')][_0x6704('0x22')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x6704('0x1e')](function(_0x18cd98){_0xf875dc=_0x18cd98;return db['VoiceRecording']['create'](_0x36bea4[_0x6704('0x19')]);})['then'](function(_0x812ba2){if(_0xf875dc['callRecordingEncryption']&&fs['existsSync'](_0x812ba2[_0x6704('0x23')])){var _0x115514=util[_0x6704('0x24')]('%s.cypher',_0x812ba2[_0x6704('0x23')]);return _0x5ac014[_0x6704('0x25')](_0x812ba2[_0x6704('0x23')],_0x115514,config[_0x6704('0x26')][_0x6704('0x27')])[_0x6704('0x1e')](function(){fs[_0x6704('0x28')](_0x812ba2[_0x6704('0x23')]);logger[_0x6704('0xc')](_0x6704('0x29'));return _0x812ba2;});}return _0x812ba2;})[_0x6704('0x1e')](function(_0x454885){logger[_0x6704('0xc')](_0x6704('0x1f'),_0x36bea4);logger[_0x6704('0xf')](_0x6704('0x1f'),_0x36bea4,JSON[_0x6704('0x11')](_0x454885));_0x118d93(_0x454885);})[_0x6704('0x16')](function(_0x219494){logger[_0x6704('0x12')](_0x6704('0x1f'),_0x219494[_0x6704('0x14')],_0x36bea4);_0x4979ec(_0x1bdfee[_0x6704('0x12')](0x1f4,_0x219494[_0x6704('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 3258e9b..dee4c93 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 _0x54b0=['put','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create'];(function(_0x1c1eb9,_0x1fc295){var _0x4dfe74=function(_0x1b7cf8){while(--_0x1b7cf8){_0x1c1eb9['push'](_0x1c1eb9['shift']());}};_0x4dfe74(++_0x1fc295);}(_0x54b0,0x193));var _0x054b=function(_0x5b64a1,_0x2ec810){_0x5b64a1=_0x5b64a1-0x0;var _0x4b6f55=_0x54b0[_0x5b64a1];return _0x4b6f55;};'use strict';var multer=require('multer');var util=require(_0x054b('0x0'));var path=require(_0x054b('0x1'));var timeout=require(_0x054b('0x2'));var express=require(_0x054b('0x3'));var router=express['Router']();var fs_extra=require(_0x054b('0x4'));var auth=require(_0x054b('0x5'));var interaction=require(_0x054b('0x6'));var config=require(_0x054b('0x7'));var controller=require(_0x054b('0x8'));router['get']('/',auth[_0x054b('0x9')](),controller[_0x054b('0xa')]);router[_0x054b('0xb')](_0x054b('0xc'),auth[_0x054b('0x9')](),controller['describe']);router[_0x054b('0xb')](_0x054b('0xd'),auth[_0x054b('0x9')](),controller[_0x054b('0xe')]);router[_0x054b('0xf')]('/',auth[_0x054b('0x9')](),controller[_0x054b('0x10')]);router[_0x054b('0x11')](_0x054b('0xd'),auth[_0x054b('0x9')](),controller[_0x054b('0x12')]);router[_0x054b('0x13')](_0x054b('0xd'),auth['isAuthenticated'](),controller[_0x054b('0x14')]);module['exports']=router; \ No newline at end of file +var _0x31dc=['Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','get','/describe','/:id','create','put','update','delete','exports','multer','util','connect-timeout','express'];(function(_0x3db6fe,_0x4d35d8){var _0x3ede22=function(_0xa5d9a9){while(--_0xa5d9a9){_0x3db6fe['push'](_0x3db6fe['shift']());}};_0x3ede22(++_0x4d35d8);}(_0x31dc,0x81));var _0xc31d=function(_0x51caee,_0x36e0cd){_0x51caee=_0x51caee-0x0;var _0x1adf50=_0x31dc[_0x51caee];return _0x1adf50;};'use strict';var multer=require(_0xc31d('0x0'));var util=require(_0xc31d('0x1'));var path=require('path');var timeout=require(_0xc31d('0x2'));var express=require(_0xc31d('0x3'));var router=express[_0xc31d('0x4')]();var fs_extra=require(_0xc31d('0x5'));var auth=require(_0xc31d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc31d('0x7'));var controller=require(_0xc31d('0x8'));router['get']('/',auth[_0xc31d('0x9')](),controller[_0xc31d('0xa')]);router[_0xc31d('0xb')](_0xc31d('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xc31d('0xb')](_0xc31d('0xd'),auth[_0xc31d('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xc31d('0xe')]);router[_0xc31d('0xf')](_0xc31d('0xd'),auth[_0xc31d('0x9')](),controller[_0xc31d('0x10')]);router[_0xc31d('0x11')](_0xc31d('0xd'),auth[_0xc31d('0x9')](),controller['destroy']);module[_0xc31d('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 5c83ff7..2057e8c 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 _0x75a2=['sequelize','moment','exports','blind','STRING','ENUM','Yes'];(function(_0x5fa9d3,_0x75d222){var _0x8efbf=function(_0x21ff2d){while(--_0x21ff2d){_0x5fa9d3['push'](_0x5fa9d3['shift']());}};_0x8efbf(++_0x75d222);}(_0x75a2,0xd9));var _0x275a=function(_0x119599,_0x54bba7){_0x119599=_0x119599-0x0;var _0x4f099f=_0x75a2[_0x119599];return _0x4f099f;};'use strict';var Sequelize=require(_0x275a('0x0'));var moment=require(_0x275a('0x1'));module[_0x275a('0x2')]={'type':{'type':Sequelize['ENUM'](_0x275a('0x3'),'attended')},'result':{'type':Sequelize[_0x275a('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x275a('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x275a('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x275a('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x275a('0x4')]},'transferercontext':{'type':Sequelize[_0x275a('0x4')]},'transfererexten':{'type':Sequelize[_0x275a('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x275a('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x275a('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x275a('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x275a('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x275a('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x275a('0x4')]},'transfereecontext':{'type':Sequelize[_0x275a('0x4')]},'transfereeexten':{'type':Sequelize[_0x275a('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x275a('0x4')]},'isexternal':{'type':Sequelize[_0x275a('0x5')](_0x275a('0x6'),'No')},'context':{'type':Sequelize[_0x275a('0x4')]},'extension':{'type':Sequelize[_0x275a('0x4')]}}; \ No newline at end of file +var _0xa559=['blind','attended','STRING','Yes','sequelize','exports','ENUM'];(function(_0x5a9fbf,_0x13201f){var _0x4ccae2=function(_0x10e791){while(--_0x10e791){_0x5a9fbf['push'](_0x5a9fbf['shift']());}};_0x4ccae2(++_0x13201f);}(_0xa559,0xa5));var _0x9a55=function(_0x397d12,_0x51c06c){_0x397d12=_0x397d12-0x0;var _0x2c8076=_0xa559[_0x397d12];return _0x2c8076;};'use strict';var Sequelize=require(_0x9a55('0x0'));var moment=require('moment');module[_0x9a55('0x1')]={'type':{'type':Sequelize[_0x9a55('0x2')](_0x9a55('0x3'),_0x9a55('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x9a55('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x9a55('0x5')]},'transferercalleridname':{'type':Sequelize[_0x9a55('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x9a55('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x9a55('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x9a55('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x9a55('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x9a55('0x5')]},'transfereechannel':{'type':Sequelize[_0x9a55('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x9a55('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x9a55('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x9a55('0x5')]},'transfereecontext':{'type':Sequelize[_0x9a55('0x5')]},'transfereeexten':{'type':Sequelize[_0x9a55('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x9a55('0x5')]},'isexternal':{'type':Sequelize[_0x9a55('0x2')](_0x9a55('0x6'),'No')},'context':{'type':Sequelize[_0x9a55('0x5')]},'extension':{'type':Sequelize[_0x9a55('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 1213297..2c5c043 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 _0x93b0=['lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceTransferReport','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra'];(function(_0x34100f,_0x87a95f){var _0x4e1bbd=function(_0x146ebb){while(--_0x146ebb){_0x34100f['push'](_0x34100f['shift']());}};_0x4e1bbd(++_0x87a95f);}(_0x93b0,0x128));var _0x093b=function(_0x5a5883,_0x4af4f1){_0x5a5883=_0x5a5883-0x0;var _0x172e51=_0x93b0[_0x5a5883];return _0x172e51;};'use strict';var emlformat=require(_0x093b('0x0'));var rimraf=require(_0x093b('0x1'));var zipdir=require(_0x093b('0x2'));var jsonpatch=require(_0x093b('0x3'));var rp=require(_0x093b('0x4'));var moment=require(_0x093b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x093b('0x6'));var util=require(_0x093b('0x7'));var path=require(_0x093b('0x8'));var sox=require(_0x093b('0x9'));var csv=require(_0x093b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x093b('0xb'));var _=require(_0x093b('0xc'));var squel=require('squel');var crypto=require(_0x093b('0xd'));var jsforce=require(_0x093b('0xe'));var deskjs=require(_0x093b('0xf'));var toCsv=require(_0x093b('0xa'));var querystring=require('querystring');var Papa=require(_0x093b('0x10'));var Redis=require(_0x093b('0x11'));var authService=require(_0x093b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x093b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x093b('0x14'))(_0x093b('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x093b('0x16'));var db=require(_0x093b('0x17'))['db'];function respondWithStatusCode(_0xbae425,_0x480476){_0x480476=_0x480476||0xcc;return function(_0x2102ca){if(_0x2102ca){return _0xbae425['sendStatus'](_0x480476);}return _0xbae425[_0x093b('0x18')](_0x480476)['end']();};}function respondWithResult(_0x4713e1,_0x49c7ac){_0x49c7ac=_0x49c7ac||0xc8;return function(_0x428575){if(_0x428575){return _0x4713e1[_0x093b('0x18')](_0x49c7ac)[_0x093b('0x19')](_0x428575);}};}function respondWithFilteredResult(_0x3ad5ef,_0x38afd4){return function(_0x494734){if(_0x494734){var _0x412afc=typeof _0x38afd4[_0x093b('0x1a')]===_0x093b('0x1b')&&typeof _0x38afd4[_0x093b('0x1c')]==='undefined';var _0x174aed=_0x494734[_0x093b('0x1d')];var _0x226590=_0x412afc?0x0:_0x38afd4['offset'];var _0x1d802e=_0x412afc?_0x494734['count']:_0x38afd4[_0x093b('0x1a')]+_0x38afd4[_0x093b('0x1c')];var _0x13f6c8;if(_0x1d802e>=_0x174aed){_0x1d802e=_0x174aed;_0x13f6c8=0xc8;}else{_0x13f6c8=0xce;}_0x3ad5ef[_0x093b('0x18')](_0x13f6c8);return _0x3ad5ef['set'](_0x093b('0x1e'),_0x226590+'-'+_0x1d802e+'/'+_0x174aed)[_0x093b('0x19')](_0x494734);}return null;};}function patchUpdates(_0x247349){return function(_0x5c4798){try{jsonpatch[_0x093b('0x1f')](_0x5c4798,_0x247349,!![]);}catch(_0x33cf0e){return BPromise[_0x093b('0x20')](_0x33cf0e);}return _0x5c4798[_0x093b('0x21')]();};}function saveUpdates(_0x3e64e5,_0x12657b){return function(_0x2f7d7b){if(_0x2f7d7b){return _0x2f7d7b[_0x093b('0x22')](_0x3e64e5)[_0x093b('0x23')](function(_0x16a204){return _0x16a204;});}return null;};}function removeEntity(_0xcb890d,_0x13146d){return function(_0x3c6df6){if(_0x3c6df6){return _0x3c6df6[_0x093b('0x24')]()[_0x093b('0x23')](function(){_0xcb890d[_0x093b('0x18')](0xcc)[_0x093b('0x25')]();});}};}function handleEntityNotFound(_0x5e0844,_0x5bb8b9){return function(_0x21d0ab){if(!_0x21d0ab){_0x5e0844[_0x093b('0x26')](0x194);}return _0x21d0ab;};}function handleError(_0x5d670c,_0x7e59d9){_0x7e59d9=_0x7e59d9||0x1f4;return function(_0x339b44){logger[_0x093b('0x27')](_0x339b44[_0x093b('0x28')]);if(_0x339b44[_0x093b('0x29')]){delete _0x339b44[_0x093b('0x29')];}_0x5d670c[_0x093b('0x18')](_0x7e59d9)[_0x093b('0x2a')](_0x339b44);};}exports[_0x093b('0x2b')]=function(_0x5c3ccc,_0x151d24){var _0x52bb29={},_0x247987={},_0x55d551={'count':0x0,'rows':[]};var _0x31db68=_[_0x093b('0x2c')](db[_0x093b('0x2d')]['rawAttributes'],function(_0x3b851b){return{'name':_0x3b851b[_0x093b('0x2e')],'type':_0x3b851b[_0x093b('0x2f')][_0x093b('0x30')]};});_0x247987[_0x093b('0x31')]=_[_0x093b('0x2c')](_0x31db68,_0x093b('0x29'));_0x247987[_0x093b('0x32')]=_[_0x093b('0x33')](_0x5c3ccc['query']);_0x247987['filters']=_[_0x093b('0x34')](_0x247987['model'],_0x247987[_0x093b('0x32')]);_0x52bb29['attributes']=_[_0x093b('0x34')](_0x247987[_0x093b('0x31')],qs[_0x093b('0x35')](_0x5c3ccc[_0x093b('0x32')][_0x093b('0x35')]));_0x52bb29[_0x093b('0x36')]=_0x52bb29[_0x093b('0x36')][_0x093b('0x37')]?_0x52bb29[_0x093b('0x36')]:_0x247987[_0x093b('0x31')];if(!_0x5c3ccc['query'][_0x093b('0x38')](_0x093b('0x39'))){_0x52bb29[_0x093b('0x1c')]=qs[_0x093b('0x1c')](_0x5c3ccc[_0x093b('0x32')]['limit']);_0x52bb29['offset']=qs['offset'](_0x5c3ccc[_0x093b('0x32')][_0x093b('0x1a')]);}_0x52bb29[_0x093b('0x3a')]=qs[_0x093b('0x3b')](_0x5c3ccc[_0x093b('0x32')][_0x093b('0x3b')]);_0x52bb29[_0x093b('0x3c')]=qs[_0x093b('0x3d')](_[_0x093b('0x3e')](_0x5c3ccc[_0x093b('0x32')],_0x247987['filters']),_0x31db68);if(_0x5c3ccc[_0x093b('0x32')][_0x093b('0x3f')]){_0x52bb29[_0x093b('0x3c')]=_[_0x093b('0x40')](_0x52bb29[_0x093b('0x3c')],{'$or':_[_0x093b('0x2c')](_0x31db68,function(_0x3a57c0){if(_0x3a57c0['type']!==_0x093b('0x41')){var _0x5db690={};_0x5db690[_0x3a57c0[_0x093b('0x29')]]={'$like':'%'+_0x5c3ccc[_0x093b('0x32')][_0x093b('0x3f')]+'%'};return _0x5db690;}})});}_0x52bb29=_[_0x093b('0x40')]({},_0x52bb29,_0x5c3ccc[_0x093b('0x42')]);var _0x5dcd14={'where':_0x52bb29[_0x093b('0x3c')]};return db[_0x093b('0x2d')][_0x093b('0x1d')](_0x5dcd14)[_0x093b('0x23')](function(_0x5b3e73){_0x55d551[_0x093b('0x1d')]=_0x5b3e73;if(_0x5c3ccc[_0x093b('0x32')][_0x093b('0x43')]){_0x52bb29['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0x093b('0x44')](_0x52bb29);})[_0x093b('0x23')](function(_0xe59959){_0x55d551['rows']=_0xe59959;return _0x55d551;})[_0x093b('0x23')](respondWithFilteredResult(_0x151d24,_0x52bb29))[_0x093b('0x45')](handleError(_0x151d24,null));};exports[_0x093b('0x46')]=function(_0x3e1afa,_0x435427){var _0x316aca={'raw':!![],'where':{'id':_0x3e1afa[_0x093b('0x47')]['id']}},_0x16d6da={};_0x16d6da['model']=_['keys'](db[_0x093b('0x2d')][_0x093b('0x48')]);_0x16d6da[_0x093b('0x32')]=_['keys'](_0x3e1afa['query']);_0x16d6da[_0x093b('0x3d')]=_[_0x093b('0x34')](_0x16d6da[_0x093b('0x31')],_0x16d6da[_0x093b('0x32')]);_0x316aca[_0x093b('0x36')]=_[_0x093b('0x34')](_0x16d6da[_0x093b('0x31')],qs['fields'](_0x3e1afa[_0x093b('0x32')][_0x093b('0x35')]));_0x316aca[_0x093b('0x36')]=_0x316aca[_0x093b('0x36')][_0x093b('0x37')]?_0x316aca[_0x093b('0x36')]:_0x16d6da['model'];if(_0x3e1afa['query'][_0x093b('0x43')]){_0x316aca[_0x093b('0x49')]=[{'all':!![]}];}_0x316aca=_['merge']({},_0x316aca,_0x3e1afa['options']);return db[_0x093b('0x2d')][_0x093b('0x4a')](_0x316aca)[_0x093b('0x23')](handleEntityNotFound(_0x435427,null))[_0x093b('0x23')](respondWithResult(_0x435427,null))[_0x093b('0x45')](handleError(_0x435427,null));};exports[_0x093b('0x4b')]=function(_0x12d79e,_0x37fe8b){return db['VoiceTransferReport'][_0x093b('0x4b')](_0x12d79e['body'],{})[_0x093b('0x23')](respondWithResult(_0x37fe8b,0xc9))['catch'](handleError(_0x37fe8b,null));};exports['update']=function(_0x4c655e,_0x1790c0){if(_0x4c655e[_0x093b('0x4c')]['id']){delete _0x4c655e[_0x093b('0x4c')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x4c655e[_0x093b('0x47')]['id']}})[_0x093b('0x23')](handleEntityNotFound(_0x1790c0,null))['then'](saveUpdates(_0x4c655e[_0x093b('0x4c')],null))['then'](respondWithResult(_0x1790c0,null))['catch'](handleError(_0x1790c0,null));};exports[_0x093b('0x24')]=function(_0x513683,_0x8f8f3d){return db[_0x093b('0x2d')][_0x093b('0x4a')]({'where':{'id':_0x513683[_0x093b('0x47')]['id']}})[_0x093b('0x23')](handleEntityNotFound(_0x8f8f3d,null))[_0x093b('0x23')](removeEntity(_0x8f8f3d,null))[_0x093b('0x45')](handleError(_0x8f8f3d,null));};exports['describe']=function(_0x4ca090,_0x1f7371){return db[_0x093b('0x2d')]['describe']()['then'](respondWithResult(_0x1f7371,null))[_0x093b('0x45')](handleError(_0x1f7371,null));}; \ No newline at end of file +var _0x7e20=['include','findAll','catch','params','rawAttributes','keys','create','body','find','destroy','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','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','VoiceTransferReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll'];(function(_0x4b4e8c,_0x167816){var _0x6e21d5=function(_0x12a15c){while(--_0x12a15c){_0x4b4e8c['push'](_0x4b4e8c['shift']());}};_0x6e21d5(++_0x167816);}(_0x7e20,0xf2));var _0x07e2=function(_0x115dc4,_0xb9133f){_0x115dc4=_0x115dc4-0x0;var _0x3fb142=_0x7e20[_0x115dc4];return _0x3fb142;};'use strict';var emlformat=require(_0x07e2('0x0'));var rimraf=require(_0x07e2('0x1'));var zipdir=require(_0x07e2('0x2'));var jsonpatch=require(_0x07e2('0x3'));var rp=require('request-promise');var moment=require(_0x07e2('0x4'));var BPromise=require(_0x07e2('0x5'));var Mustache=require(_0x07e2('0x6'));var util=require('util');var path=require(_0x07e2('0x7'));var sox=require(_0x07e2('0x8'));var csv=require(_0x07e2('0x9'));var ejs=require(_0x07e2('0xa'));var fs=require('fs');var fs_extra=require(_0x07e2('0xb'));var _=require(_0x07e2('0xc'));var squel=require(_0x07e2('0xd'));var crypto=require(_0x07e2('0xe'));var jsforce=require(_0x07e2('0xf'));var deskjs=require(_0x07e2('0x10'));var toCsv=require('to-csv');var querystring=require(_0x07e2('0x11'));var Papa=require(_0x07e2('0x12'));var Redis=require(_0x07e2('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x07e2('0x14'));var hardwareService=require(_0x07e2('0x15'));var logger=require(_0x07e2('0x16'))(_0x07e2('0x17'));var utils=require(_0x07e2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x07e2('0x19'));var db=require(_0x07e2('0x1a'))['db'];function respondWithStatusCode(_0x12bd0c,_0xa8ac5a){_0xa8ac5a=_0xa8ac5a||0xcc;return function(_0x125e71){if(_0x125e71){return _0x12bd0c[_0x07e2('0x1b')](_0xa8ac5a);}return _0x12bd0c[_0x07e2('0x1c')](_0xa8ac5a)['end']();};}function respondWithResult(_0x2989dc,_0xdfd2fe){_0xdfd2fe=_0xdfd2fe||0xc8;return function(_0x4eb506){if(_0x4eb506){return _0x2989dc[_0x07e2('0x1c')](_0xdfd2fe)[_0x07e2('0x1d')](_0x4eb506);}};}function respondWithFilteredResult(_0x21c490,_0x3f504d){return function(_0x5a4fa8){if(_0x5a4fa8){var _0x2f38ba=typeof _0x3f504d[_0x07e2('0x1e')]==='undefined'&&typeof _0x3f504d[_0x07e2('0x1f')]===_0x07e2('0x20');var _0x47f783=_0x5a4fa8[_0x07e2('0x21')];var _0x56a5f8=_0x2f38ba?0x0:_0x3f504d['offset'];var _0x526a82=_0x2f38ba?_0x5a4fa8[_0x07e2('0x21')]:_0x3f504d[_0x07e2('0x1e')]+_0x3f504d[_0x07e2('0x1f')];var _0x5f00f6;if(_0x526a82>=_0x47f783){_0x526a82=_0x47f783;_0x5f00f6=0xc8;}else{_0x5f00f6=0xce;}_0x21c490[_0x07e2('0x1c')](_0x5f00f6);return _0x21c490[_0x07e2('0x22')](_0x07e2('0x23'),_0x56a5f8+'-'+_0x526a82+'/'+_0x47f783)[_0x07e2('0x1d')](_0x5a4fa8);}return null;};}function patchUpdates(_0x41db5f){return function(_0x32ff75){try{jsonpatch[_0x07e2('0x24')](_0x32ff75,_0x41db5f,!![]);}catch(_0x24a4db){return BPromise[_0x07e2('0x25')](_0x24a4db);}return _0x32ff75['save']();};}function saveUpdates(_0x1ed721,_0x43d624){return function(_0x302e46){if(_0x302e46){return _0x302e46[_0x07e2('0x26')](_0x1ed721)[_0x07e2('0x27')](function(_0x1f23b5){return _0x1f23b5;});}return null;};}function removeEntity(_0x2dbc3f,_0x391eda){return function(_0x66f93d){if(_0x66f93d){return _0x66f93d['destroy']()['then'](function(){_0x2dbc3f[_0x07e2('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a392,_0xdd5bba){return function(_0x138f59){if(!_0x138f59){_0x45a392['sendStatus'](0x194);}return _0x138f59;};}function handleError(_0x428a43,_0x5559f6){_0x5559f6=_0x5559f6||0x1f4;return function(_0x35b6e2){logger[_0x07e2('0x28')](_0x35b6e2[_0x07e2('0x29')]);if(_0x35b6e2[_0x07e2('0x2a')]){delete _0x35b6e2['name'];}_0x428a43[_0x07e2('0x1c')](_0x5559f6)[_0x07e2('0x2b')](_0x35b6e2);};}exports['index']=function(_0x4a684c,_0x3a060d){var _0x14f711={},_0x9c771e={},_0x84f80d={'count':0x0,'rows':[]};var _0x3f94ed=_[_0x07e2('0x2c')](db[_0x07e2('0x2d')]['rawAttributes'],function(_0x2177ae){return{'name':_0x2177ae[_0x07e2('0x2e')],'type':_0x2177ae[_0x07e2('0x2f')][_0x07e2('0x30')]};});_0x9c771e[_0x07e2('0x31')]=_[_0x07e2('0x2c')](_0x3f94ed,_0x07e2('0x2a'));_0x9c771e[_0x07e2('0x32')]=_['keys'](_0x4a684c[_0x07e2('0x32')]);_0x9c771e[_0x07e2('0x33')]=_[_0x07e2('0x34')](_0x9c771e[_0x07e2('0x31')],_0x9c771e['query']);_0x14f711[_0x07e2('0x35')]=_['intersection'](_0x9c771e[_0x07e2('0x31')],qs[_0x07e2('0x36')](_0x4a684c['query'][_0x07e2('0x36')]));_0x14f711[_0x07e2('0x35')]=_0x14f711[_0x07e2('0x35')][_0x07e2('0x37')]?_0x14f711[_0x07e2('0x35')]:_0x9c771e[_0x07e2('0x31')];if(!_0x4a684c[_0x07e2('0x32')][_0x07e2('0x38')](_0x07e2('0x39'))){_0x14f711['limit']=qs[_0x07e2('0x1f')](_0x4a684c['query']['limit']);_0x14f711[_0x07e2('0x1e')]=qs[_0x07e2('0x1e')](_0x4a684c[_0x07e2('0x32')][_0x07e2('0x1e')]);}_0x14f711['order']=qs[_0x07e2('0x3a')](_0x4a684c[_0x07e2('0x32')][_0x07e2('0x3a')]);_0x14f711[_0x07e2('0x3b')]=qs[_0x07e2('0x33')](_[_0x07e2('0x3c')](_0x4a684c[_0x07e2('0x32')],_0x9c771e[_0x07e2('0x33')]),_0x3f94ed);if(_0x4a684c[_0x07e2('0x32')][_0x07e2('0x3d')]){_0x14f711[_0x07e2('0x3b')]=_['merge'](_0x14f711[_0x07e2('0x3b')],{'$or':_[_0x07e2('0x2c')](_0x3f94ed,function(_0x5b77f6){if(_0x5b77f6[_0x07e2('0x2f')]!==_0x07e2('0x3e')){var _0x2d4583={};_0x2d4583[_0x5b77f6[_0x07e2('0x2a')]]={'$like':'%'+_0x4a684c['query'][_0x07e2('0x3d')]+'%'};return _0x2d4583;}})});}_0x14f711=_[_0x07e2('0x3f')]({},_0x14f711,_0x4a684c[_0x07e2('0x40')]);var _0x166d11={'where':_0x14f711['where']};return db[_0x07e2('0x2d')][_0x07e2('0x21')](_0x166d11)[_0x07e2('0x27')](function(_0x1e13cd){_0x84f80d[_0x07e2('0x21')]=_0x1e13cd;if(_0x4a684c[_0x07e2('0x32')][_0x07e2('0x41')]){_0x14f711[_0x07e2('0x42')]=[{'all':!![]}];}return db[_0x07e2('0x2d')][_0x07e2('0x43')](_0x14f711);})['then'](function(_0x23dedd){_0x84f80d['rows']=_0x23dedd;return _0x84f80d;})[_0x07e2('0x27')](respondWithFilteredResult(_0x3a060d,_0x14f711))[_0x07e2('0x44')](handleError(_0x3a060d,null));};exports['show']=function(_0xadee77,_0x3c8af2){var _0xf591b2={'raw':!![],'where':{'id':_0xadee77[_0x07e2('0x45')]['id']}},_0x1c2b89={};_0x1c2b89[_0x07e2('0x31')]=_['keys'](db['VoiceTransferReport'][_0x07e2('0x46')]);_0x1c2b89[_0x07e2('0x32')]=_[_0x07e2('0x47')](_0xadee77[_0x07e2('0x32')]);_0x1c2b89[_0x07e2('0x33')]=_[_0x07e2('0x34')](_0x1c2b89[_0x07e2('0x31')],_0x1c2b89['query']);_0xf591b2[_0x07e2('0x35')]=_['intersection'](_0x1c2b89['model'],qs[_0x07e2('0x36')](_0xadee77['query'][_0x07e2('0x36')]));_0xf591b2[_0x07e2('0x35')]=_0xf591b2['attributes'][_0x07e2('0x37')]?_0xf591b2[_0x07e2('0x35')]:_0x1c2b89['model'];if(_0xadee77[_0x07e2('0x32')][_0x07e2('0x41')]){_0xf591b2[_0x07e2('0x42')]=[{'all':!![]}];}_0xf591b2=_[_0x07e2('0x3f')]({},_0xf591b2,_0xadee77[_0x07e2('0x40')]);return db['VoiceTransferReport']['find'](_0xf591b2)[_0x07e2('0x27')](handleEntityNotFound(_0x3c8af2,null))[_0x07e2('0x27')](respondWithResult(_0x3c8af2,null))[_0x07e2('0x44')](handleError(_0x3c8af2,null));};exports[_0x07e2('0x48')]=function(_0x2fbc79,_0x482077){return db[_0x07e2('0x2d')][_0x07e2('0x48')](_0x2fbc79[_0x07e2('0x49')],{})[_0x07e2('0x27')](respondWithResult(_0x482077,0xc9))[_0x07e2('0x44')](handleError(_0x482077,null));};exports[_0x07e2('0x26')]=function(_0x18bf24,_0x17bc89){if(_0x18bf24[_0x07e2('0x49')]['id']){delete _0x18bf24[_0x07e2('0x49')]['id'];}return db[_0x07e2('0x2d')][_0x07e2('0x4a')]({'where':{'id':_0x18bf24[_0x07e2('0x45')]['id']}})[_0x07e2('0x27')](handleEntityNotFound(_0x17bc89,null))[_0x07e2('0x27')](saveUpdates(_0x18bf24[_0x07e2('0x49')],null))[_0x07e2('0x27')](respondWithResult(_0x17bc89,null))[_0x07e2('0x44')](handleError(_0x17bc89,null));};exports[_0x07e2('0x4b')]=function(_0x320847,_0x4c9049){return db[_0x07e2('0x2d')][_0x07e2('0x4a')]({'where':{'id':_0x320847[_0x07e2('0x45')]['id']}})[_0x07e2('0x27')](handleEntityNotFound(_0x4c9049,null))[_0x07e2('0x27')](removeEntity(_0x4c9049,null))[_0x07e2('0x44')](handleError(_0x4c9049,null));};exports[_0x07e2('0x4c')]=function(_0x2c6b4d,_0x5bf782){return db['VoiceTransferReport'][_0x07e2('0x4c')]()[_0x07e2('0x27')](respondWithResult(_0x5bf782,null))[_0x07e2('0x44')](handleError(_0x5bf782,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 99af3a6..e50e493 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 _0x9623=['report_call_transfer','lodash','util','../../config/logger','api','path','define','VoiceTransferReport'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x9623,0x191));var _0x3962=function(_0x2d5ca1,_0x504495){_0x2d5ca1=_0x2d5ca1-0x0;var _0x5d55b5=_0x9623[_0x2d5ca1];return _0x5d55b5;};'use strict';var _=require(_0x3962('0x0'));var util=require(_0x3962('0x1'));var logger=require(_0x3962('0x2'))(_0x3962('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3962('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x3ba8f3,_0x32a990){return _0x3ba8f3[_0x3962('0x5')](_0x3962('0x6'),attributes,{'tableName':_0x3962('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee39=['request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','lodash','util','api','bluebird'];(function(_0x37b93a,_0x4b1b63){var _0x23fe96=function(_0xafa258){while(--_0xafa258){_0x37b93a['push'](_0x37b93a['shift']());}};_0x23fe96(++_0x4b1b63);}(_0xee39,0x68));var _0x9ee3=function(_0x3910c7,_0x20d941){_0x3910c7=_0x3910c7-0x0;var _0x1b742f=_0xee39[_0x3910c7];return _0x1b742f;};'use strict';var _=require(_0x9ee3('0x0'));var util=require(_0x9ee3('0x1'));var logger=require('../../config/logger')(_0x9ee3('0x2'));var moment=require('moment');var BPromise=require(_0x9ee3('0x3'));var rp=require(_0x9ee3('0x4'));var fs=require('fs');var path=require(_0x9ee3('0x5'));var rimraf=require(_0x9ee3('0x6'));var config=require(_0x9ee3('0x7'));var attributes=require(_0x9ee3('0x8'));module['exports']=function(_0x110459,_0x4a6b7b){return _0x110459[_0x9ee3('0x9')](_0x9ee3('0xa'),attributes,{'tableName':_0x9ee3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index b2a9d3a..cadce66 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 _0x6a0f=['VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','VoiceTransferReport,\x20%s,\x20%s','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','then','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent'];(function(_0x423c1a,_0x51aa01){var _0x12fb7b=function(_0x31b4bd){while(--_0x31b4bd){_0x423c1a['push'](_0x423c1a['shift']());}};_0x12fb7b(++_0x51aa01);}(_0x6a0f,0x101));var _0xf6a0=function(_0x453a76,_0x4183cf){_0x453a76=_0x453a76-0x0;var _0x120f65=_0x6a0f[_0x453a76];return _0x120f65;};'use strict';var _=require(_0xf6a0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf6a0('0x1'));var rs=require(_0xf6a0('0x2'));var fs=require('fs');var Redis=require(_0xf6a0('0x3'));var db=require(_0xf6a0('0x4'))['db'];var utils=require(_0xf6a0('0x5'));var logger=require(_0xf6a0('0x6'))(_0xf6a0('0x7'));var config=require('../../config/environment');var jayson=require(_0xf6a0('0x8'));var client=jayson['client'][_0xf6a0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b87f6,_0x229f8d,_0x5b981c){return new BPromise(function(_0x54a3f4,_0x23503c){return client[_0xf6a0('0xa')](_0x5b87f6,_0x5b981c)['then'](function(_0x3f71fc){logger[_0xf6a0('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x229f8d,_0xf6a0('0xc'));logger['debug'](_0xf6a0('0xd'),_0x229f8d,'request\x20sent',JSON[_0xf6a0('0xe')](_0x3f71fc));if(_0x3f71fc['error']){if(_0x3f71fc['error'][_0xf6a0('0xf')]===0x1f4){logger[_0xf6a0('0x10')](_0xf6a0('0x11'),_0x229f8d,_0x3f71fc['error'][_0xf6a0('0x12')]);return _0x23503c(_0x3f71fc['error']['message']);}logger[_0xf6a0('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x229f8d,_0x3f71fc[_0xf6a0('0x10')][_0xf6a0('0x12')]);return _0x54a3f4(_0x3f71fc[_0xf6a0('0x10')][_0xf6a0('0x12')]);}else{logger[_0xf6a0('0xb')](_0xf6a0('0x11'),_0x229f8d,_0xf6a0('0xc'));_0x54a3f4(_0x3f71fc['result']['message']);}})[_0xf6a0('0x13')](function(_0x76ea6){logger[_0xf6a0('0x10')](_0xf6a0('0x11'),_0x229f8d,_0x76ea6);_0x23503c(_0x76ea6);});});}exports[_0xf6a0('0x14')]=function(_0x360279){var _0x13dc9e=this;return new Promise(function(_0x21d5b8,_0x300d36){return db[_0xf6a0('0x15')][_0xf6a0('0x16')](_0x360279['body'],{'raw':_0x360279[_0xf6a0('0x17')]?_0x360279[_0xf6a0('0x17')][_0xf6a0('0x18')]===undefined?!![]:![]:!![]})[_0xf6a0('0x19')](function(_0x2c5189){logger[_0xf6a0('0xb')](_0xf6a0('0x14'),_0x360279);logger[_0xf6a0('0x1a')](_0xf6a0('0x14'),_0x360279,JSON[_0xf6a0('0xe')](_0x2c5189));_0x21d5b8(_0x2c5189);})['catch'](function(_0x332fb6){logger[_0xf6a0('0x10')]('CreateVoiceTransferReport',_0x332fb6[_0xf6a0('0x12')],_0x360279);_0x300d36(_0x13dc9e[_0xf6a0('0x10')](0x1f4,_0x332fb6['message']));});});}; \ No newline at end of file +var _0x2b78=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','create','options','CreateVoiceTransferReport','util','moment','bluebird'];(function(_0x140049,_0x38971e){var _0x5d74a1=function(_0x1d6a04){while(--_0x1d6a04){_0x140049['push'](_0x140049['shift']());}};_0x5d74a1(++_0x38971e);}(_0x2b78,0x110));var _0x82b7=function(_0x3c700f,_0x2ad2c8){_0x3c700f=_0x3c700f-0x0;var _0x1bf773=_0x2b78[_0x3c700f];return _0x1bf773;};'use strict';var _=require('lodash');var util=require(_0x82b7('0x0'));var moment=require(_0x82b7('0x1'));var BPromise=require(_0x82b7('0x2'));var rs=require(_0x82b7('0x3'));var fs=require('fs');var Redis=require(_0x82b7('0x4'));var db=require(_0x82b7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x82b7('0x6'));var config=require(_0x82b7('0x7'));var jayson=require(_0x82b7('0x8'));var client=jayson['client'][_0x82b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5db98c,_0xf6485c,_0x13bb3a){return new BPromise(function(_0x1d252e,_0x4a436a){return client[_0x82b7('0xa')](_0x5db98c,_0x13bb3a)['then'](function(_0x2e833c){logger[_0x82b7('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0xf6485c,_0x82b7('0xc'));logger[_0x82b7('0xd')](_0x82b7('0xe'),_0xf6485c,_0x82b7('0xc'),JSON[_0x82b7('0xf')](_0x2e833c));if(_0x2e833c[_0x82b7('0x10')]){if(_0x2e833c[_0x82b7('0x10')][_0x82b7('0x11')]===0x1f4){logger[_0x82b7('0x10')](_0x82b7('0x12'),_0xf6485c,_0x2e833c[_0x82b7('0x10')][_0x82b7('0x13')]);return _0x4a436a(_0x2e833c[_0x82b7('0x10')][_0x82b7('0x13')]);}logger[_0x82b7('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0xf6485c,_0x2e833c[_0x82b7('0x10')]['message']);return _0x1d252e(_0x2e833c[_0x82b7('0x10')][_0x82b7('0x13')]);}else{logger[_0x82b7('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0xf6485c,'request\x20sent');_0x1d252e(_0x2e833c[_0x82b7('0x14')][_0x82b7('0x13')]);}})[_0x82b7('0x15')](function(_0x368c30){logger[_0x82b7('0x10')](_0x82b7('0x12'),_0xf6485c,_0x368c30);_0x4a436a(_0x368c30);});});}exports['CreateVoiceTransferReport']=function(_0x5416d6){var _0x91c7ab=this;return new Promise(function(_0x3c8a0c,_0x7242a8){return db['VoiceTransferReport'][_0x82b7('0x16')](_0x5416d6['body'],{'raw':_0x5416d6[_0x82b7('0x17')]?_0x5416d6[_0x82b7('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x7007ea){logger['info'](_0x82b7('0x18'),_0x5416d6);logger[_0x82b7('0xd')](_0x82b7('0x18'),_0x5416d6,JSON[_0x82b7('0xf')](_0x7007ea));_0x3c8a0c(_0x7007ea);})['catch'](function(_0x1db016){logger['error'](_0x82b7('0x18'),_0x1db016[_0x82b7('0x13')],_0x5416d6);_0x7242a8(_0x91c7ab[_0x82b7('0x10')](0x1f4,_0x1db016[_0x82b7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index c7b1f7e..464f8cf 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 _0xf3cd=['/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','isAuthenticated','hangup','/answer','answer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x764874,_0x3ed544){_0x764874=_0x764874-0x0;var _0x29f9d5=_0xf3cd[_0x764874];return _0x29f9d5;};'use strict';var express=require(_0xdf3c('0x0'));var router=express[_0xdf3c('0x1')]();var auth=require(_0xdf3c('0x2'));var controller=require(_0xdf3c('0x3'));router[_0xdf3c('0x4')](_0xdf3c('0x5'),auth['isAuthenticated'](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x7')]);router[_0xdf3c('0x4')]('/hangup',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x9')]);router[_0xdf3c('0x4')](_0xdf3c('0xa'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xb')]);router['post']('/hold',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller['hold']);router[_0xdf3c('0x4')](_0xdf3c('0xc'),auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0x4')](_0xdf3c('0xe'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x4')](_0xdf3c('0x10'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0x11')]);module[_0xdf3c('0x12')]=router; \ No newline at end of file +var _0x9c44=['/answer','answer','/hold','/unhold','unhold','/transfer','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','/hangup','hangup'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x49c4('0x0'));var controller=require(_0x49c4('0x1'));router[_0x49c4('0x2')](_0x49c4('0x3'),auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['originate']);router['post'](_0x49c4('0x6'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0x7')]);router[_0x49c4('0x2')](_0x49c4('0x8'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller[_0x49c4('0x9')]);router[_0x49c4('0x2')](_0x49c4('0xa'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0x49c4('0x2')](_0x49c4('0xb'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xc')]);router['post']('/calls',auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['calls']);router[_0x49c4('0x2')](_0x49c4('0xd'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index a81086b..03fc59a 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 _0x4ba9=['calls','calls\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','log','handleError:','stack','name','send','status','NotFound','error','code','message','result','catch','User','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','info','body','json','callNumber','callerId','entityFound:','user:%s','originate\x20executed!','hangup','hangup\x20fired:','userId','format','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','unhold','unhold\x20fired:'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x4ba9,0x18f));var _0x94ba=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x4ba9[_0x4bfac3];return _0x15f0f2;};'use strict';var path=require(_0x94ba('0x0'));var fs=require('fs');var _=require(_0x94ba('0x1'));var db=require(_0x94ba('0x2'))['db'];var config=require(_0x94ba('0x3'));var util=require('util');var BPromise=require(_0x94ba('0x4'));var jayson=require(_0x94ba('0x5'));var amiClient=jayson[_0x94ba('0x6')][_0x94ba('0x7')]({'port':0x232a});var logger=require(_0x94ba('0x8'))(_0x94ba('0x9'));var Redis=require(_0x94ba('0xa'));config[_0x94ba('0xb')]=_[_0x94ba('0xc')](config[_0x94ba('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x94ba('0xd'))(new Redis(config[_0x94ba('0xb')]));var Schema=require(_0x94ba('0xe'));var originateValidation=new Schema({'userId':{'type':_0x94ba('0xf'),'required':[!![],_0x94ba('0x10')]},'callNumber':{'type':'string','required':[!![],_0x94ba('0x11')]},'callerId':{'type':_0x94ba('0x12')},'callbackUrl':{'type':_0x94ba('0x12')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x94ba('0x10')]},'sessionId':{'type':_0x94ba('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x94ba('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x94ba('0x10')]},'sessionId':{'type':_0x94ba('0x12'),'required':[!![],_0x94ba('0x13')]},'transferNumber':{'type':_0x94ba('0x12'),'required':[!![],_0x94ba('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0x94ba('0xf'),'required':[!![],_0x94ba('0x10')]},'sessionId':{'type':_0x94ba('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x94ba('0xf'),'required':[!![],_0x94ba('0x10')]},'sessionId':{'type':_0x94ba('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x94ba('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x94ba('0xf'),'required':[!![],_0x94ba('0x10')]}});function emit(_0x1b8930,_0x4ee2d8,_0x499002){logger['info'](_0x1b8930,_0x4ee2d8,JSON[_0x94ba('0x15')](_0x499002));io['to'](_0x1b8930)[_0x94ba('0x16')](_0x4ee2d8,_0x499002);}function handleError(_0x379f9b){return function(_0x55608d){console[_0x94ba('0x17')](_0x94ba('0x18'),_0x55608d,_0x55608d instanceof RangeError);logger['error'](_0x55608d[_0x94ba('0x19')]);if(_0x55608d instanceof RangeError){if(_0x55608d[_0x94ba('0x1a')]){delete _0x55608d['name'];}_0x379f9b['status'](0x194)[_0x94ba('0x1b')](_0x55608d);}else{if(_0x55608d['name']){delete _0x55608d[_0x94ba('0x1a')];}_0x379f9b[_0x94ba('0x1c')](0x1f4)[_0x94ba('0x1b')](_0x55608d);}};}function checkError(){return function(_0x410cff){if(!_0x410cff){throw new RangeError(_0x94ba('0x1d'));}return _0x410cff;};}function respondWithRpcPromise(_0x47b9d4,_0x2b09d2){return new BPromise(function(_0x3c027a,_0x4a2a2d){var _0x31f403=amiClient;return _0x31f403['request'](_0x47b9d4,_0x2b09d2)['then'](function(_0x185b6d){if(_0x185b6d[_0x94ba('0x1e')]){if(_0x185b6d['error'][_0x94ba('0x1f')]===0x1f4){return _0x4a2a2d(_0x185b6d[_0x94ba('0x1e')][_0x94ba('0x20')]);}return _0x3c027a(_0x185b6d['error'][_0x94ba('0x20')]);}else{_0x3c027a(_0x185b6d[_0x94ba('0x21')]);}})[_0x94ba('0x22')](function(_0x14fbf9){_0x4a2a2d(_0x14fbf9);});});}function getAgent(_0x5d3f0f){return db[_0x94ba('0x23')][_0x94ba('0x24')]({'where':{'id':_0x5d3f0f,'role':_0x94ba('0x25')}})[_0x94ba('0x26')](checkError());}function getAgentCheckSession(_0x3f9f7a,_0x5461dd){return new BPromise(function(_0x57c2c6,_0x1f34b1){var _0x267673=respondWithRpcPromise(_0x94ba('0x27'));var _0x5920f6=getAgent(_0x3f9f7a);Promise[_0x94ba('0x28')]([_0x267673,_0x5920f6])['then'](function(_0x517c8d){var _0xd8f16d=_0x517c8d[0x0];var _0x447241=_0x517c8d[0x1];var _0xda464d=_[_0x94ba('0x29')](_0xd8f16d[_0x94ba('0x2a')],function(_0x3021fa){return _0x3021fa[_0x94ba('0x2b')]==_0x447241['id']&&_0x3021fa[_0x94ba('0x2c')]==_0x5461dd;});if(_0xda464d[_0x94ba('0x2d')]==0x1){_0x57c2c6(_0x447241);}else{_0x1f34b1(new RangeError('sessionId\x20'+_0x5461dd+_0x94ba('0x2e')));}});});}exports[_0x94ba('0x2f')]=function(_0x1ecd9b,_0x23ede1){logger[_0x94ba('0x30')]('originate\x20fired:',_0x1ecd9b['body']);var _0x490193=originateValidation[_0x94ba('0xe')](_0x1ecd9b[_0x94ba('0x31')]);if(_0x490193[_0x94ba('0x2d')]>0x0){return _0x23ede1[_0x94ba('0x1c')](0x190)[_0x94ba('0x32')](_0x490193);}var _0x319d0e=_0x1ecd9b[_0x94ba('0x31')]['userId'];var _0x32fdb4=_0x1ecd9b['body'][_0x94ba('0x33')];var _0x15ee14=_0x1ecd9b['body'][_0x94ba('0x34')];var _0xe302a4=_0x1ecd9b['body']['callbackUrl'];return getAgent(_0x319d0e)[_0x94ba('0x26')](function(_0x4500f6){logger['info'](_0x94ba('0x35'),_0x4500f6[_0x94ba('0x1a')]);emit(util['format'](_0x94ba('0x36'),_0x4500f6[_0x94ba('0x1a')]),'webbar:originate',{'callNumber':_0x32fdb4,'callerId':_0x15ee14,'callbackUrl':_0xe302a4});return _0x23ede1[_0x94ba('0x1c')](0xc8)[_0x94ba('0x32')]({'error':![],'message':_0x94ba('0x37')});})[_0x94ba('0x22')](handleError(_0x23ede1));};exports[_0x94ba('0x38')]=function(_0x431656,_0x16e973){logger[_0x94ba('0x30')](_0x94ba('0x39'),_0x431656[_0x94ba('0x31')]);var _0x800111=hangupValidation[_0x94ba('0xe')](_0x431656['body']);if(_0x800111[_0x94ba('0x2d')]>0x0){return _0x16e973['status'](0x190)['json'](_0x800111);}var _0x539f61=_0x431656['body'][_0x94ba('0x3a')];var _0x3b1066=_0x431656[_0x94ba('0x31')][_0x94ba('0x2c')];return getAgent(_0x539f61)['then'](function(_0x472b3f){logger[_0x94ba('0x30')](_0x94ba('0x35'),_0x472b3f['name']);emit(util[_0x94ba('0x3b')](_0x94ba('0x36'),_0x472b3f[_0x94ba('0x1a')]),_0x94ba('0x3c'),{'sessionId':_0x3b1066});return _0x16e973[_0x94ba('0x1c')](0xc8)[_0x94ba('0x32')]({'error':![],'message':_0x94ba('0x3d')});})[_0x94ba('0x22')](handleError(_0x16e973));};exports[_0x94ba('0x3e')]=function(_0x8200,_0x546e41){logger[_0x94ba('0x30')](_0x94ba('0x3f'),_0x8200[_0x94ba('0x31')]);var _0x1fa472=answerValidation[_0x94ba('0xe')](_0x8200[_0x94ba('0x31')]);if(_0x1fa472['length']>0x0){return _0x546e41[_0x94ba('0x1c')](0x190)[_0x94ba('0x32')](_0x1fa472);}var _0x1ce55e=_0x8200[_0x94ba('0x31')][_0x94ba('0x3a')];var _0x40097e=_0x8200[_0x94ba('0x31')][_0x94ba('0x2c')];return getAgent(_0x1ce55e)[_0x94ba('0x26')](function(_0x20c069){logger[_0x94ba('0x30')]('entityFound:',_0x20c069[_0x94ba('0x1a')]);emit(util[_0x94ba('0x3b')]('user:%s',_0x20c069['name']),_0x94ba('0x40'),{'sessionId':_0x40097e});return _0x546e41[_0x94ba('0x1c')](0xc8)['json']({'error':![],'message':_0x94ba('0x41')});})[_0x94ba('0x22')](handleError(_0x546e41));};exports['hold']=function(_0x475f0b,_0x5b7d4b){logger['info'](_0x94ba('0x42'),_0x475f0b[_0x94ba('0x31')]);var _0x31d4a6=holdValidation[_0x94ba('0xe')](_0x475f0b[_0x94ba('0x31')]);if(_0x31d4a6[_0x94ba('0x2d')]>0x0){return _0x5b7d4b[_0x94ba('0x1c')](0x190)[_0x94ba('0x32')](_0x31d4a6);}var _0x146537=_0x475f0b[_0x94ba('0x31')][_0x94ba('0x3a')];var _0x59486d=_0x475f0b['body'][_0x94ba('0x2c')];return getAgent(_0x146537)['then'](function(_0x27a147){logger[_0x94ba('0x30')]('entityFound:',_0x27a147[_0x94ba('0x1a')]);emit(util[_0x94ba('0x3b')]('user:%s',_0x27a147[_0x94ba('0x1a')]),'webbar:hold',{'sessionId':_0x59486d});return _0x5b7d4b[_0x94ba('0x1c')](0xc8)[_0x94ba('0x32')]({'error':![],'message':'hold\x20executed!'});})[_0x94ba('0x22')](handleError(_0x5b7d4b));};exports[_0x94ba('0x43')]=function(_0x1007ac,_0xdac59a){logger[_0x94ba('0x30')](_0x94ba('0x44'),_0x1007ac[_0x94ba('0x31')]);var _0x2b01f1=unholdValidation[_0x94ba('0xe')](_0x1007ac[_0x94ba('0x31')]);if(_0x2b01f1[_0x94ba('0x2d')]>0x0){return _0xdac59a[_0x94ba('0x1c')](0x190)[_0x94ba('0x32')](_0x2b01f1);}var _0x5d8487=_0x1007ac[_0x94ba('0x31')]['userId'];var _0x4ec4c2=_0x1007ac['body'][_0x94ba('0x2c')];return getAgent(_0x5d8487)['then'](function(_0x3e888e){logger[_0x94ba('0x30')]('entityFound:',_0x3e888e[_0x94ba('0x1a')]);emit(util[_0x94ba('0x3b')]('user:%s',_0x3e888e['name']),'webbar:unhold',{'sessionId':_0x4ec4c2});return _0xdac59a[_0x94ba('0x1c')](0xc8)[_0x94ba('0x32')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0xdac59a));};exports[_0x94ba('0x45')]=function(_0x55e75c,_0x33baf5){logger[_0x94ba('0x30')](_0x94ba('0x46'),_0x33baf5[_0x94ba('0x31')]);var _0x20e418=callsValidation[_0x94ba('0xe')](_0x55e75c['body']);if(_0x20e418['length']>0x0){return _0x33baf5[_0x94ba('0x1c')](0x190)[_0x94ba('0x32')](_0x20e418);}var _0x140d00=_0x55e75c[_0x94ba('0x31')][_0x94ba('0x3a')];var _0x196f58=respondWithRpcPromise('VoiceChannels');var _0xcb35d8=getAgent(_0x140d00);return Promise[_0x94ba('0x28')]([_0x196f58,_0xcb35d8])[_0x94ba('0x26')](function(_0x1aec6d){var _0x16c9b4=_0x1aec6d[0x0];var _0x29fe0b=_0x1aec6d[0x1];var _0xc19dac=_[_0x94ba('0x29')](_0x16c9b4['rows'],function(_0x286d0a){return _0x286d0a[_0x94ba('0x2b')]==_0x29fe0b['id'];});return _0x33baf5[_0x94ba('0x1c')](0xc8)[_0x94ba('0x32')]({'count':_0xc19dac[_0x94ba('0x2d')],'rows':_0xc19dac});})[_0x94ba('0x22')](handleError(_0x33baf5));};exports['conference']=function(_0x5e9047,_0x3d3da5){logger[_0x94ba('0x30')]('conference\x20fired:',_0x5e9047[_0x94ba('0x31')]);var _0x5d62d1=conferenceValidation[_0x94ba('0xe')](_0x5e9047[_0x94ba('0x31')]);if(_0x5d62d1['length']>0x0){return _0x3d3da5[_0x94ba('0x1c')](0x190)[_0x94ba('0x32')](_0x5d62d1);}var _0x3815c0=_0x5e9047[_0x94ba('0x31')]['userId'];return getAgent(_0x3815c0)[_0x94ba('0x26')](function(_0x472e7f){logger[_0x94ba('0x30')](_0x94ba('0x35'),_0x472e7f[_0x94ba('0x1a')]);emit(util['format'](_0x94ba('0x36'),_0x472e7f[_0x94ba('0x1a')]),_0x94ba('0x47'));return _0x3d3da5[_0x94ba('0x1c')](0xc8)[_0x94ba('0x32')]({'error':![],'message':_0x94ba('0x48')});})[_0x94ba('0x22')](handleError(_0x3d3da5));};exports[_0x94ba('0x49')]=function(_0x179e87,_0x55b7d5){logger[_0x94ba('0x30')](_0x94ba('0x4a'),_0x179e87[_0x94ba('0x31')]);var _0x3fa504=transferValidation['validate'](_0x179e87[_0x94ba('0x31')]);if(_0x3fa504[_0x94ba('0x2d')]>0x0){return _0x55b7d5['status'](0x190)[_0x94ba('0x32')](_0x3fa504);}var _0x3db49c=_0x179e87[_0x94ba('0x31')]['userId'];var _0xe493e8=_0x179e87[_0x94ba('0x31')]['sessionId'];var _0xafd6b6=_0x179e87[_0x94ba('0x31')][_0x94ba('0x4b')];return getAgent(_0x3db49c)[_0x94ba('0x26')](function(_0x3aba99){logger[_0x94ba('0x30')](_0x94ba('0x35'),_0x3aba99[_0x94ba('0x1a')]);emit(util[_0x94ba('0x3b')]('user:%s',_0x3aba99[_0x94ba('0x1a')]),_0x94ba('0x4c'),{'sessionId':_0xe493e8,'transferNumber':_0xafd6b6});return _0x55b7d5[_0x94ba('0x1c')](0xc8)[_0x94ba('0x32')]({'error':![],'message':_0x94ba('0x4d')});})[_0x94ba('0x22')](handleError(_0x55b7d5));}; \ No newline at end of file +var _0x0325=['webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','entityFound:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','conference','conference\x20fired:','webbar:conference','transfer','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','client','http','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','error','stack','name','send','status','NotFound','code','message','result','User','findOne','agent','then','VoiceChannels','filter','rows','UserId','sessionId','length','sessionId\x20','originate','originate\x20fired:','body','json','userId','callerId','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:'];(function(_0x339c6a,_0x59163b){var _0x2b4c48=function(_0xce7a36){while(--_0xce7a36){_0x339c6a['push'](_0x339c6a['shift']());}};_0x2b4c48(++_0x59163b);}(_0x0325,0x108));var _0x5032=function(_0x20f996,_0x2f8997){_0x20f996=_0x20f996-0x0;var _0x313162=_0x0325[_0x20f996];return _0x313162;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x5032('0x0'));var db=require(_0x5032('0x1'))['db'];var config=require(_0x5032('0x2'));var util=require(_0x5032('0x3'));var BPromise=require(_0x5032('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x5032('0x5')][_0x5032('0x6')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require(_0x5032('0x7'));config[_0x5032('0x8')]=_[_0x5032('0x9')](config[_0x5032('0x8')],{'host':_0x5032('0xa'),'port':0x18eb});var io=require(_0x5032('0xb'))(new Redis(config[_0x5032('0x8')]));var Schema=require(_0x5032('0xc'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5032('0xd')]},'callNumber':{'type':_0x5032('0xe'),'required':[!![],_0x5032('0xf')]},'callerId':{'type':_0x5032('0xe')},'callbackUrl':{'type':_0x5032('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x5032('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5032('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x5032('0x10'),'required':[!![],_0x5032('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x5032('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5032('0xe'),'required':[!![],_0x5032('0x11')]},'transferNumber':{'type':_0x5032('0xe'),'required':[!![],_0x5032('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x5032('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5032('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5032('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x5032('0x10'),'required':[!![],_0x5032('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x5032('0x10'),'required':[!![],_0x5032('0xd')]}});function emit(_0x2fbbad,_0x598898,_0x54693e){logger[_0x5032('0x13')](_0x2fbbad,_0x598898,JSON[_0x5032('0x14')](_0x54693e));io['to'](_0x2fbbad)[_0x5032('0x15')](_0x598898,_0x54693e);}function handleError(_0x14e3be){return function(_0x1b85c3){console[_0x5032('0x16')]('handleError:',_0x1b85c3,_0x1b85c3 instanceof RangeError);logger[_0x5032('0x17')](_0x1b85c3[_0x5032('0x18')]);if(_0x1b85c3 instanceof RangeError){if(_0x1b85c3[_0x5032('0x19')]){delete _0x1b85c3['name'];}_0x14e3be['status'](0x194)[_0x5032('0x1a')](_0x1b85c3);}else{if(_0x1b85c3[_0x5032('0x19')]){delete _0x1b85c3[_0x5032('0x19')];}_0x14e3be[_0x5032('0x1b')](0x1f4)['send'](_0x1b85c3);}};}function checkError(){return function(_0x1f1734){if(!_0x1f1734){throw new RangeError(_0x5032('0x1c'));}return _0x1f1734;};}function respondWithRpcPromise(_0x3960e9,_0x533944){return new BPromise(function(_0x49ca2f,_0x53cd70){var _0x535d89=amiClient;return _0x535d89['request'](_0x3960e9,_0x533944)['then'](function(_0x28995d){if(_0x28995d[_0x5032('0x17')]){if(_0x28995d['error'][_0x5032('0x1d')]===0x1f4){return _0x53cd70(_0x28995d[_0x5032('0x17')][_0x5032('0x1e')]);}return _0x49ca2f(_0x28995d['error'][_0x5032('0x1e')]);}else{_0x49ca2f(_0x28995d[_0x5032('0x1f')]);}})['catch'](function(_0x44ca4d){_0x53cd70(_0x44ca4d);});});}function getAgent(_0x539f94){return db[_0x5032('0x20')][_0x5032('0x21')]({'where':{'id':_0x539f94,'role':_0x5032('0x22')}})[_0x5032('0x23')](checkError());}function getAgentCheckSession(_0x464c88,_0x3ac66c){return new BPromise(function(_0x265735,_0x5d062f){var _0x46edd3=respondWithRpcPromise(_0x5032('0x24'));var _0x3b19af=getAgent(_0x464c88);Promise['all']([_0x46edd3,_0x3b19af])[_0x5032('0x23')](function(_0x5b6a0a){var _0x298ded=_0x5b6a0a[0x0];var _0x4e39ec=_0x5b6a0a[0x1];var _0x37961e=_[_0x5032('0x25')](_0x298ded[_0x5032('0x26')],function(_0x6e9c6){return _0x6e9c6[_0x5032('0x27')]==_0x4e39ec['id']&&_0x6e9c6[_0x5032('0x28')]==_0x3ac66c;});if(_0x37961e[_0x5032('0x29')]==0x1){_0x265735(_0x4e39ec);}else{_0x5d062f(new RangeError(_0x5032('0x2a')+_0x3ac66c+'\x20not\x20found!'));}});});}exports[_0x5032('0x2b')]=function(_0x4dd502,_0xbdf4b2){logger[_0x5032('0x13')](_0x5032('0x2c'),_0x4dd502[_0x5032('0x2d')]);var _0x1b0c34=originateValidation[_0x5032('0xc')](_0x4dd502[_0x5032('0x2d')]);if(_0x1b0c34[_0x5032('0x29')]>0x0){return _0xbdf4b2[_0x5032('0x1b')](0x190)[_0x5032('0x2e')](_0x1b0c34);}var _0x5b16a2=_0x4dd502[_0x5032('0x2d')][_0x5032('0x2f')];var _0x22e24c=_0x4dd502[_0x5032('0x2d')]['callNumber'];var _0x34fab9=_0x4dd502[_0x5032('0x2d')][_0x5032('0x30')];var _0x3d09dc=_0x4dd502['body']['callbackUrl'];return getAgent(_0x5b16a2)[_0x5032('0x23')](function(_0x560c64){logger[_0x5032('0x13')]('entityFound:',_0x560c64[_0x5032('0x19')]);emit(util[_0x5032('0x31')](_0x5032('0x32'),_0x560c64[_0x5032('0x19')]),_0x5032('0x33'),{'callNumber':_0x22e24c,'callerId':_0x34fab9,'callbackUrl':_0x3d09dc});return _0xbdf4b2[_0x5032('0x1b')](0xc8)['json']({'error':![],'message':_0x5032('0x34')});})[_0x5032('0x35')](handleError(_0xbdf4b2));};exports[_0x5032('0x36')]=function(_0x1ab1eb,_0x1683a2){logger[_0x5032('0x13')](_0x5032('0x37'),_0x1ab1eb[_0x5032('0x2d')]);var _0x320ca5=hangupValidation['validate'](_0x1ab1eb[_0x5032('0x2d')]);if(_0x320ca5[_0x5032('0x29')]>0x0){return _0x1683a2[_0x5032('0x1b')](0x190)[_0x5032('0x2e')](_0x320ca5);}var _0x483245=_0x1ab1eb[_0x5032('0x2d')][_0x5032('0x2f')];var _0x5c7f89=_0x1ab1eb[_0x5032('0x2d')]['sessionId'];return getAgent(_0x483245)[_0x5032('0x23')](function(_0x2b1bb2){logger[_0x5032('0x13')]('entityFound:',_0x2b1bb2[_0x5032('0x19')]);emit(util[_0x5032('0x31')](_0x5032('0x32'),_0x2b1bb2[_0x5032('0x19')]),_0x5032('0x38'),{'sessionId':_0x5c7f89});return _0x1683a2['status'](0xc8)[_0x5032('0x2e')]({'error':![],'message':_0x5032('0x39')});})[_0x5032('0x35')](handleError(_0x1683a2));};exports[_0x5032('0x3a')]=function(_0x14eb98,_0x36dfeb){logger[_0x5032('0x13')](_0x5032('0x3b'),_0x14eb98[_0x5032('0x2d')]);var _0x1ded35=answerValidation[_0x5032('0xc')](_0x14eb98[_0x5032('0x2d')]);if(_0x1ded35[_0x5032('0x29')]>0x0){return _0x36dfeb[_0x5032('0x1b')](0x190)['json'](_0x1ded35);}var _0x1dbfee=_0x14eb98[_0x5032('0x2d')]['userId'];var _0x529470=_0x14eb98[_0x5032('0x2d')]['sessionId'];return getAgent(_0x1dbfee)[_0x5032('0x23')](function(_0x5b1542){logger[_0x5032('0x13')](_0x5032('0x3c'),_0x5b1542[_0x5032('0x19')]);emit(util[_0x5032('0x31')]('user:%s',_0x5b1542['name']),_0x5032('0x3d'),{'sessionId':_0x529470});return _0x36dfeb[_0x5032('0x1b')](0xc8)[_0x5032('0x2e')]({'error':![],'message':'answer\x20executed!'});})[_0x5032('0x35')](handleError(_0x36dfeb));};exports[_0x5032('0x3e')]=function(_0x456ab8,_0x34f73e){logger[_0x5032('0x13')](_0x5032('0x3f'),_0x456ab8[_0x5032('0x2d')]);var _0x48d3d8=holdValidation[_0x5032('0xc')](_0x456ab8['body']);if(_0x48d3d8['length']>0x0){return _0x34f73e[_0x5032('0x1b')](0x190)[_0x5032('0x2e')](_0x48d3d8);}var _0xfbe175=_0x456ab8[_0x5032('0x2d')][_0x5032('0x2f')];var _0x220e3a=_0x456ab8[_0x5032('0x2d')][_0x5032('0x28')];return getAgent(_0xfbe175)[_0x5032('0x23')](function(_0x7844d2){logger[_0x5032('0x13')](_0x5032('0x3c'),_0x7844d2[_0x5032('0x19')]);emit(util[_0x5032('0x31')](_0x5032('0x32'),_0x7844d2[_0x5032('0x19')]),_0x5032('0x40'),{'sessionId':_0x220e3a});return _0x34f73e['status'](0xc8)[_0x5032('0x2e')]({'error':![],'message':_0x5032('0x41')});})['catch'](handleError(_0x34f73e));};exports[_0x5032('0x42')]=function(_0xba847f,_0x1d41fe){logger['info'](_0x5032('0x43'),_0xba847f[_0x5032('0x2d')]);var _0x2ab5e6=unholdValidation[_0x5032('0xc')](_0xba847f[_0x5032('0x2d')]);if(_0x2ab5e6[_0x5032('0x29')]>0x0){return _0x1d41fe['status'](0x190)[_0x5032('0x2e')](_0x2ab5e6);}var _0x4ed4c0=_0xba847f['body'][_0x5032('0x2f')];var _0x197079=_0xba847f[_0x5032('0x2d')][_0x5032('0x28')];return getAgent(_0x4ed4c0)[_0x5032('0x23')](function(_0x14221f){logger['info'](_0x5032('0x3c'),_0x14221f[_0x5032('0x19')]);emit(util[_0x5032('0x31')](_0x5032('0x32'),_0x14221f[_0x5032('0x19')]),_0x5032('0x44'),{'sessionId':_0x197079});return _0x1d41fe[_0x5032('0x1b')](0xc8)[_0x5032('0x2e')]({'error':![],'message':_0x5032('0x45')});})[_0x5032('0x35')](handleError(_0x1d41fe));};exports[_0x5032('0x46')]=function(_0x2b42a3,_0x4503f9){logger[_0x5032('0x13')](_0x5032('0x47'),_0x4503f9[_0x5032('0x2d')]);var _0x881680=callsValidation[_0x5032('0xc')](_0x2b42a3[_0x5032('0x2d')]);if(_0x881680[_0x5032('0x29')]>0x0){return _0x4503f9[_0x5032('0x1b')](0x190)[_0x5032('0x2e')](_0x881680);}var _0x23f9ed=_0x2b42a3[_0x5032('0x2d')][_0x5032('0x2f')];var _0x5573e9=respondWithRpcPromise(_0x5032('0x24'));var _0x4d59b6=getAgent(_0x23f9ed);return Promise[_0x5032('0x48')]([_0x5573e9,_0x4d59b6])['then'](function(_0x1da270){var _0x18758d=_0x1da270[0x0];var _0x4f6e80=_0x1da270[0x1];var _0xd9ba41=_[_0x5032('0x25')](_0x18758d[_0x5032('0x26')],function(_0x5c157c){return _0x5c157c[_0x5032('0x27')]==_0x4f6e80['id'];});return _0x4503f9[_0x5032('0x1b')](0xc8)[_0x5032('0x2e')]({'count':_0xd9ba41[_0x5032('0x29')],'rows':_0xd9ba41});})['catch'](handleError(_0x4503f9));};exports[_0x5032('0x49')]=function(_0x1e6026,_0x3584f8){logger['info'](_0x5032('0x4a'),_0x1e6026[_0x5032('0x2d')]);var _0x5bea0a=conferenceValidation[_0x5032('0xc')](_0x1e6026[_0x5032('0x2d')]);if(_0x5bea0a[_0x5032('0x29')]>0x0){return _0x3584f8['status'](0x190)[_0x5032('0x2e')](_0x5bea0a);}var _0xc5a77f=_0x1e6026[_0x5032('0x2d')][_0x5032('0x2f')];return getAgent(_0xc5a77f)[_0x5032('0x23')](function(_0x46e322){logger[_0x5032('0x13')]('entityFound:',_0x46e322[_0x5032('0x19')]);emit(util[_0x5032('0x31')]('user:%s',_0x46e322['name']),_0x5032('0x4b'));return _0x3584f8[_0x5032('0x1b')](0xc8)[_0x5032('0x2e')]({'error':![],'message':'conference\x20executed!'});})[_0x5032('0x35')](handleError(_0x3584f8));};exports[_0x5032('0x4c')]=function(_0x38732c,_0xb33b1c){logger[_0x5032('0x13')]('transfer\x20fired:',_0x38732c['body']);var _0x274187=transferValidation['validate'](_0x38732c['body']);if(_0x274187[_0x5032('0x29')]>0x0){return _0xb33b1c[_0x5032('0x1b')](0x190)[_0x5032('0x2e')](_0x274187);}var _0x4c3d80=_0x38732c[_0x5032('0x2d')]['userId'];var _0xbd8483=_0x38732c[_0x5032('0x2d')][_0x5032('0x28')];var _0x3e8914=_0x38732c['body'][_0x5032('0x4d')];return getAgent(_0x4c3d80)[_0x5032('0x23')](function(_0x43cbaa){logger[_0x5032('0x13')](_0x5032('0x3c'),_0x43cbaa[_0x5032('0x19')]);emit(util[_0x5032('0x31')](_0x5032('0x32'),_0x43cbaa[_0x5032('0x19')]),_0x5032('0x4e'),{'sessionId':_0xbd8483,'transferNumber':_0x3e8914});return _0xb33b1c[_0x5032('0x1b')](0xc8)[_0x5032('0x2e')]({'error':![],'message':_0x5032('0x4f')});})[_0x5032('0x35')](handleError(_0xb33b1c));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index b6bfed5..96dfbf2 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 _0x3f62=['../../components/interaction/service','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','/:id/send','send','put','/:id','update','delete','destroy','removeAgents','exports','multer','path','express','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f62,0x187));var _0x23f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x3f62[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x23f6('0x0'));var util=require('util');var path=require(_0x23f6('0x1'));var timeout=require('connect-timeout');var express=require(_0x23f6('0x2'));var router=express['Router']();var fs_extra=require(_0x23f6('0x3'));var auth=require(_0x23f6('0x4'));var interaction=require(_0x23f6('0x5'));var config=require('../../config/environment');var controller=require(_0x23f6('0x6'));router[_0x23f6('0x7')]('/',auth['isAuthenticated'](),controller[_0x23f6('0x8')]);router[_0x23f6('0x7')](_0x23f6('0x9'),auth[_0x23f6('0xa')](),controller[_0x23f6('0xb')]);router[_0x23f6('0x7')]('/:id',auth[_0x23f6('0xa')](),controller[_0x23f6('0xc')]);router['get'](_0x23f6('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x23f6('0x7')](_0x23f6('0xe'),auth[_0x23f6('0xa')](),controller[_0x23f6('0xf')]);router[_0x23f6('0x7')](_0x23f6('0x10'),auth[_0x23f6('0xa')](),controller[_0x23f6('0x11')]);router[_0x23f6('0x7')](_0x23f6('0x12'),auth[_0x23f6('0xa')](),controller[_0x23f6('0x13')]);router[_0x23f6('0x14')]('/',auth[_0x23f6('0xa')](),controller[_0x23f6('0x15')]);router[_0x23f6('0x14')](_0x23f6('0xd'),auth['isAuthenticated'](),controller[_0x23f6('0x16')]);router[_0x23f6('0x14')](_0x23f6('0xe'),auth[_0x23f6('0xa')](),controller[_0x23f6('0x17')]);router[_0x23f6('0x14')]('/:id/users',auth[_0x23f6('0xa')](),controller[_0x23f6('0x18')]);router[_0x23f6('0x14')]('/:id/applications',auth[_0x23f6('0xa')](),controller[_0x23f6('0x19')]);router['post'](_0x23f6('0x1a'),controller['notify']);router['post'](_0x23f6('0x1b'),auth[_0x23f6('0xa')](),controller[_0x23f6('0x1c')]);router[_0x23f6('0x1d')](_0x23f6('0x1e'),auth[_0x23f6('0xa')](),controller[_0x23f6('0x1f')]);router[_0x23f6('0x20')](_0x23f6('0x1e'),auth[_0x23f6('0xa')](),controller[_0x23f6('0x21')]);router[_0x23f6('0x20')](_0x23f6('0xd'),auth[_0x23f6('0xa')](),controller['removeDispositions']);router[_0x23f6('0x20')]('/:id/canned_answers',auth[_0x23f6('0xa')](),controller['removeAnswers']);router[_0x23f6('0x20')](_0x23f6('0x10'),auth[_0x23f6('0xa')](),controller[_0x23f6('0x22')]);module[_0x23f6('0x23')]=router; \ No newline at end of file +var _0x568e=['/:id/users','getAgents','/:id/applications','getApplications','post','create','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','put','destroy','removeAnswers','removeAgents','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers'];(function(_0xce93c,_0x555be5){var _0x230720=function(_0x6d5428){while(--_0x6d5428){_0xce93c['push'](_0xce93c['shift']());}};_0x230720(++_0x555be5);}(_0x568e,0xbb));var _0xe568=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x568e[_0x543084];return _0x306a57;};'use strict';var multer=require(_0xe568('0x0'));var util=require('util');var path=require(_0xe568('0x1'));var timeout=require(_0xe568('0x2'));var express=require('express');var router=express[_0xe568('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe568('0x4'));var interaction=require(_0xe568('0x5'));var config=require('../../config/environment');var controller=require(_0xe568('0x6'));router[_0xe568('0x7')]('/',auth[_0xe568('0x8')](),controller[_0xe568('0x9')]);router['get'](_0xe568('0xa'),auth[_0xe568('0x8')](),controller[_0xe568('0xb')]);router[_0xe568('0x7')](_0xe568('0xc'),auth['isAuthenticated'](),controller[_0xe568('0xd')]);router[_0xe568('0x7')](_0xe568('0xe'),auth[_0xe568('0x8')](),controller['getDispositions']);router[_0xe568('0x7')](_0xe568('0xf'),auth[_0xe568('0x8')](),controller[_0xe568('0x10')]);router[_0xe568('0x7')](_0xe568('0x11'),auth[_0xe568('0x8')](),controller[_0xe568('0x12')]);router[_0xe568('0x7')](_0xe568('0x13'),auth[_0xe568('0x8')](),controller[_0xe568('0x14')]);router[_0xe568('0x15')]('/',auth[_0xe568('0x8')](),controller[_0xe568('0x16')]);router[_0xe568('0x15')](_0xe568('0xe'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xe568('0x15')](_0xe568('0xf'),auth[_0xe568('0x8')](),controller[_0xe568('0x17')]);router[_0xe568('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0xe568('0x18')]);router[_0xe568('0x15')](_0xe568('0x13'),auth[_0xe568('0x8')](),controller[_0xe568('0x19')]);router[_0xe568('0x15')](_0xe568('0x1a'),controller[_0xe568('0x1b')]);router[_0xe568('0x15')](_0xe568('0x1c'),auth[_0xe568('0x8')](),controller['send']);router[_0xe568('0x1d')]('/:id',auth[_0xe568('0x8')](),controller['update']);router['delete'](_0xe568('0xc'),auth[_0xe568('0x8')](),controller[_0xe568('0x1e')]);router['delete']('/:id/dispositions',auth[_0xe568('0x8')](),controller['removeDispositions']);router['delete'](_0xe568('0xf'),auth[_0xe568('0x8')](),controller[_0xe568('0x1f')]);router['delete']('/:id/users',auth[_0xe568('0x8')](),controller[_0xe568('0x20')]);module[_0xe568('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index ddb9bfa..5ec05ae 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 _0x5197=['ENUM','twilio','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','sequelize','exports','STRING','generate'];(function(_0x325999,_0x3100a5){var _0xc0ae92=function(_0x2b0898){while(--_0x2b0898){_0x325999['push'](_0x325999['shift']());}};_0xc0ae92(++_0x3100a5);}(_0x5197,0x140));var _0x7519=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x5197[_0x3d42d8];return _0x27fc41;};'use strict';var Sequelize=require(_0x7519('0x0'));var rs=require('randomstring');module[_0x7519('0x1')]={'name':{'type':Sequelize[_0x7519('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x7519('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x7519('0x2')],'defaultValue':function(){return rs[_0x7519('0x3')]();}},'phone':{'type':Sequelize[_0x7519('0x2')]},'type':{'type':Sequelize[_0x7519('0x4')](_0x7519('0x5'),_0x7519('0x6'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x7519('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7519('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7519('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7519('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7519('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7519('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x7519('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3c981c){if(!_0x3c981c){this[_0x7519('0xb')]('mandatoryDispositionPauseId',null);}this['setDataValue']('mandatoryDisposition',_0x3c981c);}},'description':{'type':Sequelize[_0x7519('0x2')]}}; \ No newline at end of file +var _0xf104=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER'];(function(_0x442760,_0x40cc3a){var _0x3aeb3b=function(_0x189816){while(--_0x189816){_0x442760['push'](_0x442760['shift']());}};_0x3aeb3b(++_0x40cc3a);}(_0xf104,0x76));var _0x4f10=function(_0x12d508,_0x2c94e6){_0x12d508=_0x12d508-0x0;var _0x283a2f=_0xf104[_0x12d508];return _0x283a2f;};'use strict';var Sequelize=require(_0x4f10('0x0'));var rs=require('randomstring');module[_0x4f10('0x1')]={'name':{'type':Sequelize[_0x4f10('0x2')],'unique':_0x4f10('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x4f10('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x4f10('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x4f10('0x2')]},'type':{'type':Sequelize['ENUM']('twilio',_0x4f10('0x4'))},'accountSid':{'type':Sequelize[_0x4f10('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x4f10('0x2')]},'notificationTemplate':{'type':Sequelize[_0x4f10('0x5')],'defaultValue':function(){return _0x4f10('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4f10('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4f10('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4f10('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x4f10('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x4f10('0x9')],'defaultValue':![],'comment':_0x4f10('0xa'),'set':function(_0x4c2b9b){if(!_0x4c2b9b){this[_0x4f10('0xb')](_0x4f10('0xc'),null);}this[_0x4f10('0xb')](_0x4f10('0xd'),_0x4c2b9b);}},'description':{'type':Sequelize[_0x4f10('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 2a7e094..393ea55 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 _0xe8f9=['VIRTUAL','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','intersection','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','Transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','timestamp','message_id','applications','orderBy','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','notifications','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','DESC','list','Contacts','CmContact','contact','WhatsappInteraction','spread','created','push','close','interaction','WhatsappMessage','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','waitForTheAssignedQueue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','List','dataValues','Messages','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','UserProfileResource','name','send','index','Pause','WhatsappAccount','rawAttributes','type','model','keys','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0xe8f9,0x73));var _0x9e8f=function(_0x4c7cb9,_0x553d12){_0x4c7cb9=_0x4c7cb9-0x0;var _0x41e150=_0xe8f9[_0x4c7cb9];return _0x41e150;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e8f('0x0'));var zipdir=require(_0x9e8f('0x1'));var jsonpatch=require(_0x9e8f('0x2'));var rp=require(_0x9e8f('0x3'));var moment=require(_0x9e8f('0x4'));var BPromise=require(_0x9e8f('0x5'));var Mustache=require(_0x9e8f('0x6'));var util=require('util');var path=require(_0x9e8f('0x7'));var sox=require(_0x9e8f('0x8'));var csv=require('to-csv');var ejs=require(_0x9e8f('0x9'));var fs=require('fs');var fs_extra=require(_0x9e8f('0xa'));var _=require(_0x9e8f('0xb'));var squel=require(_0x9e8f('0xc'));var crypto=require('crypto');var jsforce=require(_0x9e8f('0xd'));var deskjs=require(_0x9e8f('0xe'));var toCsv=require(_0x9e8f('0xf'));var querystring=require(_0x9e8f('0x10'));var Papa=require('papaparse');var Redis=require(_0x9e8f('0x11'));var authService=require(_0x9e8f('0x12'));var qs=require(_0x9e8f('0x13'));var as=require(_0x9e8f('0x14'));var hardwareService=require(_0x9e8f('0x15'));var logger=require(_0x9e8f('0x16'))('api');var utils=require(_0x9e8f('0x17'));var config=require(_0x9e8f('0x18'));var licenseUtil=require(_0x9e8f('0x19'));var db=require(_0x9e8f('0x1a'))['db'];config[_0x9e8f('0x1b')]=_[_0x9e8f('0x1c')](config[_0x9e8f('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x9e8f('0x1d'))(new Redis(config[_0x9e8f('0x1b')]));require('./whatsappAccount.socket')[_0x9e8f('0x1e')](socket);var jayson=require(_0x9e8f('0x1f'));var client=jayson[_0x9e8f('0x20')]['http']({'port':0x232c});function respondWithRpcPromise(_0x386682,_0x469f02,_0x66f60a,_0x4fb9f0){return new BPromise(function(_0x71d380,_0x3fa2f9){var _0x4c0a41=_0x4fb9f0||client;return _0x4c0a41[_0x9e8f('0x21')](_0x386682,_0x66f60a)['then'](function(_0x5db1ed){logger[_0x9e8f('0x22')](_0x9e8f('0x23'),_0x469f02,_0x9e8f('0x24'));logger[_0x9e8f('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x469f02,_0x9e8f('0x24'),JSON[_0x9e8f('0x26')](_0x5db1ed));if(_0x5db1ed[_0x9e8f('0x27')]){if(_0x5db1ed[_0x9e8f('0x27')][_0x9e8f('0x28')]===0x1f4){logger[_0x9e8f('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x469f02,_0x5db1ed['error'][_0x9e8f('0x29')]);return _0x3fa2f9(_0x5db1ed[_0x9e8f('0x27')][_0x9e8f('0x29')]);}logger[_0x9e8f('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x469f02,_0x5db1ed[_0x9e8f('0x27')][_0x9e8f('0x29')]);return _0x71d380(_0x5db1ed[_0x9e8f('0x27')]['message']);}else{logger[_0x9e8f('0x22')](_0x9e8f('0x23'),_0x469f02,_0x9e8f('0x24'));_0x71d380(_0x5db1ed['result'][_0x9e8f('0x29')]);}})[_0x9e8f('0x2a')](function(_0x2129af){logger[_0x9e8f('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x469f02,_0x2129af);_0x3fa2f9(_0x2129af);});});}function respondWithStatusCode(_0x4858d9,_0x5d6336){_0x5d6336=_0x5d6336||0xcc;return function(_0x5f1326){if(_0x5f1326){return _0x4858d9[_0x9e8f('0x2b')](_0x5d6336);}return _0x4858d9[_0x9e8f('0x2c')](_0x5d6336)['end']();};}function respondWithResult(_0x5ba091,_0x32a3b4){_0x32a3b4=_0x32a3b4||0xc8;return function(_0x817e33){if(_0x817e33){return _0x5ba091[_0x9e8f('0x2c')](_0x32a3b4)[_0x9e8f('0x2d')](_0x817e33);}};}function respondWithFilteredResult(_0x2a8892,_0x53b9d2){return function(_0x304739){if(_0x304739){var _0x34b5ac=typeof _0x53b9d2[_0x9e8f('0x2e')]===_0x9e8f('0x2f')&&typeof _0x53b9d2[_0x9e8f('0x30')]===_0x9e8f('0x2f');var _0x143e21=_0x304739[_0x9e8f('0x31')];var _0x493fb3=_0x34b5ac?0x0:_0x53b9d2[_0x9e8f('0x2e')];var _0x1b6f08=_0x34b5ac?_0x304739[_0x9e8f('0x31')]:_0x53b9d2[_0x9e8f('0x2e')]+_0x53b9d2[_0x9e8f('0x30')];var _0x3f86cd;if(_0x1b6f08>=_0x143e21){_0x1b6f08=_0x143e21;_0x3f86cd=0xc8;}else{_0x3f86cd=0xce;}_0x2a8892[_0x9e8f('0x2c')](_0x3f86cd);return _0x2a8892[_0x9e8f('0x32')]('Content-Range',_0x493fb3+'-'+_0x1b6f08+'/'+_0x143e21)[_0x9e8f('0x2d')](_0x304739);}return null;};}function patchUpdates(_0x5777fe){return function(_0x1aa221){try{jsonpatch[_0x9e8f('0x33')](_0x1aa221,_0x5777fe,!![]);}catch(_0x32aba7){return BPromise[_0x9e8f('0x34')](_0x32aba7);}return _0x1aa221['save']();};}function saveUpdates(_0x3670d5,_0x2287d7){return function(_0x2d8345){if(_0x2d8345){return _0x2d8345[_0x9e8f('0x35')](_0x3670d5)[_0x9e8f('0x36')](function(_0x5c45c4){return _0x5c45c4;});}return null;};}function removeEntity(_0x2d76ba,_0x402af0){return function(_0x282970){if(_0x282970){return _0x282970[_0x9e8f('0x37')]()['then'](function(){var _0xaee966=_0x282970[_0x9e8f('0x38')]({'plain':!![]});var _0x525f8f='WhatsappAccounts';return db[_0x9e8f('0x39')][_0x9e8f('0x37')]({'where':{'type':_0x525f8f,'resourceId':_0xaee966['id']}})['then'](function(){return _0x282970;});})[_0x9e8f('0x36')](function(){_0x2d76ba[_0x9e8f('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f4498,_0xa661c0){return function(_0x422772){if(!_0x422772){_0x1f4498['sendStatus'](0x194);}return _0x422772;};}function handleError(_0x403009,_0x5854da){_0x5854da=_0x5854da||0x1f4;return function(_0x4212f5){logger['error'](_0x4212f5['stack']);if(_0x4212f5['name']){delete _0x4212f5[_0x9e8f('0x3a')];}_0x403009[_0x9e8f('0x2c')](_0x5854da)[_0x9e8f('0x3b')](_0x4212f5);};}exports[_0x9e8f('0x3c')]=function(_0x39bc66,_0xfe7ad7){var _0x4f73db={'include':[{'model':db[_0x9e8f('0x3d')],'as':'mandatoryDispositionPause'}]},_0x31d0b5={},_0x139cbf={'count':0x0,'rows':[]};var _0x5a4636=_['map'](db[_0x9e8f('0x3e')][_0x9e8f('0x3f')],function(_0x18dbd0){return{'name':_0x18dbd0['fieldName'],'type':_0x18dbd0[_0x9e8f('0x40')]['key']};});_0x31d0b5[_0x9e8f('0x41')]=_['map'](_0x5a4636,_0x9e8f('0x3a'));_0x31d0b5['query']=_[_0x9e8f('0x42')](_0x39bc66[_0x9e8f('0x43')]);_0x31d0b5['filters']=_['intersection'](_0x31d0b5['model'],_0x31d0b5[_0x9e8f('0x43')]);_0x4f73db[_0x9e8f('0x44')]=_['intersection'](_0x31d0b5[_0x9e8f('0x41')],qs[_0x9e8f('0x45')](_0x39bc66[_0x9e8f('0x43')][_0x9e8f('0x45')]));_0x4f73db[_0x9e8f('0x44')]=_0x4f73db['attributes']['length']?_0x4f73db[_0x9e8f('0x44')]:_0x31d0b5[_0x9e8f('0x41')];if(!_0x39bc66[_0x9e8f('0x43')][_0x9e8f('0x46')](_0x9e8f('0x47'))){_0x4f73db[_0x9e8f('0x30')]=qs[_0x9e8f('0x30')](_0x39bc66['query'][_0x9e8f('0x30')]);_0x4f73db[_0x9e8f('0x2e')]=qs[_0x9e8f('0x2e')](_0x39bc66[_0x9e8f('0x43')][_0x9e8f('0x2e')]);}_0x4f73db[_0x9e8f('0x48')]=qs[_0x9e8f('0x49')](_0x39bc66[_0x9e8f('0x43')][_0x9e8f('0x49')]);_0x4f73db[_0x9e8f('0x4a')]=qs[_0x9e8f('0x4b')](_[_0x9e8f('0x4c')](_0x39bc66[_0x9e8f('0x43')],_0x31d0b5['filters']),_0x5a4636);if(_0x39bc66['query'][_0x9e8f('0x4d')]){_0x4f73db[_0x9e8f('0x4a')]=_[_0x9e8f('0x4e')](_0x4f73db['where'],{'$or':_[_0x9e8f('0x4f')](_0x5a4636,function(_0x48c41c){if(_0x48c41c[_0x9e8f('0x40')]!==_0x9e8f('0x50')){var _0x9f9158={};_0x9f9158[_0x48c41c[_0x9e8f('0x3a')]]={'$like':'%'+_0x39bc66[_0x9e8f('0x43')][_0x9e8f('0x4d')]+'%'};return _0x9f9158;}})});}_0x4f73db=_[_0x9e8f('0x4e')]({},_0x4f73db,_0x39bc66[_0x9e8f('0x51')]);var _0xc626f1={'where':_0x4f73db[_0x9e8f('0x4a')]};return db['WhatsappAccount']['count'](_0xc626f1)[_0x9e8f('0x36')](function(_0x1fb680){_0x139cbf['count']=_0x1fb680;if(_0x39bc66[_0x9e8f('0x43')][_0x9e8f('0x52')]){_0x4f73db[_0x9e8f('0x53')]=[{'all':!![]}];}return db[_0x9e8f('0x3e')][_0x9e8f('0x54')](_0x4f73db);})[_0x9e8f('0x36')](function(_0x289fb1){_0x139cbf[_0x9e8f('0x55')]=_0x289fb1;return _0x139cbf;})[_0x9e8f('0x36')](respondWithFilteredResult(_0xfe7ad7,_0x4f73db))['catch'](handleError(_0xfe7ad7,null));};exports[_0x9e8f('0x56')]=function(_0x24d70c,_0x582644){var _0x1f5fe5={'raw':![],'where':{'id':_0x24d70c[_0x9e8f('0x57')]['id']},'include':[{'model':db[_0x9e8f('0x3d')],'as':_0x9e8f('0x58')}]},_0x2fe9ea={};_0x2fe9ea[_0x9e8f('0x41')]=_['keys'](db[_0x9e8f('0x3e')][_0x9e8f('0x3f')]);_0x2fe9ea[_0x9e8f('0x43')]=_['keys'](_0x24d70c['query']);_0x2fe9ea[_0x9e8f('0x4b')]=_['intersection'](_0x2fe9ea['model'],_0x2fe9ea['query']);_0x1f5fe5[_0x9e8f('0x44')]=_[_0x9e8f('0x59')](_0x2fe9ea[_0x9e8f('0x41')],qs[_0x9e8f('0x45')](_0x24d70c[_0x9e8f('0x43')][_0x9e8f('0x45')]));_0x1f5fe5[_0x9e8f('0x44')]=_0x1f5fe5[_0x9e8f('0x44')][_0x9e8f('0x5a')]?_0x1f5fe5[_0x9e8f('0x44')]:_0x2fe9ea['model'];if(_0x24d70c[_0x9e8f('0x43')]['includeAll']){_0x1f5fe5[_0x9e8f('0x53')]=[{'all':!![]}];}_0x1f5fe5=_[_0x9e8f('0x4e')]({},_0x1f5fe5,_0x24d70c[_0x9e8f('0x51')]);return db[_0x9e8f('0x3e')][_0x9e8f('0x5b')](_0x1f5fe5)[_0x9e8f('0x36')](handleEntityNotFound(_0x582644,null))[_0x9e8f('0x36')](respondWithResult(_0x582644,null))['catch'](handleError(_0x582644,null));};exports[_0x9e8f('0x5c')]=function(_0x13c66a,_0x36f14d){return db['WhatsappAccount'][_0x9e8f('0x5c')](_0x13c66a[_0x9e8f('0x5d')],{})[_0x9e8f('0x36')](function(_0x168c43){var _0x5d8466=_0x13c66a[_0x9e8f('0x5e')]['get']({'plain':!![]});if(!_0x5d8466)throw new Error(_0x9e8f('0x5f'));if(_0x5d8466['role']===_0x9e8f('0x5e')){var _0x175f1f=_0x168c43[_0x9e8f('0x38')]({'plain':!![]});var _0x3869a3='WhatsappAccounts';return db[_0x9e8f('0x60')][_0x9e8f('0x5b')]({'where':{'name':_0x3869a3,'userProfileId':_0x5d8466['userProfileId']},'raw':!![]})['then'](function(_0x8655c3){if(_0x8655c3&&_0x8655c3[_0x9e8f('0x61')]===0x0){return db['UserProfileResource']['create']({'name':_0x175f1f[_0x9e8f('0x3a')],'resourceId':_0x175f1f['id'],'type':_0x8655c3[_0x9e8f('0x3a')],'sectionId':_0x8655c3['id']},{})[_0x9e8f('0x36')](function(){return _0x168c43;});}else{return _0x168c43;}})['catch'](function(_0x11766d){logger[_0x9e8f('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11766d);throw _0x11766d;});}return _0x168c43;})['then'](respondWithResult(_0x36f14d,0xc9))[_0x9e8f('0x2a')](handleError(_0x36f14d,null));};exports[_0x9e8f('0x35')]=function(_0x28e650,_0x12b598){if(_0x28e650[_0x9e8f('0x5d')]['id']){delete _0x28e650[_0x9e8f('0x5d')]['id'];}return db[_0x9e8f('0x3e')][_0x9e8f('0x5b')]({'where':{'id':_0x28e650[_0x9e8f('0x57')]['id']},'include':[{'model':db[_0x9e8f('0x3d')],'as':_0x9e8f('0x58')}]})[_0x9e8f('0x36')](handleEntityNotFound(_0x12b598,null))[_0x9e8f('0x36')](saveUpdates(_0x28e650[_0x9e8f('0x5d')],null))['then'](respondWithResult(_0x12b598,null))[_0x9e8f('0x2a')](handleError(_0x12b598,null));};exports['destroy']=function(_0x590f01,_0x1d42d2){return db['WhatsappAccount'][_0x9e8f('0x5b')]({'where':{'id':_0x590f01[_0x9e8f('0x57')]['id']}})[_0x9e8f('0x36')](handleEntityNotFound(_0x1d42d2,null))['then'](removeEntity(_0x1d42d2,null))['catch'](handleError(_0x1d42d2,null));};exports[_0x9e8f('0x62')]=function(_0x5e37ea,_0x5d5faf){return db['WhatsappAccount'][_0x9e8f('0x62')]()[_0x9e8f('0x36')](respondWithResult(_0x5d5faf,null))[_0x9e8f('0x2a')](handleError(_0x5d5faf,null));};exports[_0x9e8f('0x63')]=function(_0x8cda7,_0x15806e,_0x538833){if(_0x8cda7[_0x9e8f('0x5d')]['id']){delete _0x8cda7[_0x9e8f('0x5d')]['id'];}return db[_0x9e8f('0x3e')][_0x9e8f('0x5b')]({'where':{'id':_0x8cda7[_0x9e8f('0x57')]['id']}})[_0x9e8f('0x36')](handleEntityNotFound(_0x15806e,null))[_0x9e8f('0x36')](function(_0x2159bd){if(_0x2159bd){_0x8cda7[_0x9e8f('0x5d')][_0x9e8f('0x64')]=_0x2159bd['id'];return db[_0x9e8f('0x65')][_0x9e8f('0x5c')](_0x8cda7[_0x9e8f('0x5d')]);}})[_0x9e8f('0x36')](respondWithResult(_0x15806e,null))['catch'](handleError(_0x15806e,null));};exports[_0x9e8f('0x66')]=function(_0x3d672a,_0x583089,_0xf4894e){var _0x32e675={'raw':![],'where':{}};var _0x4b00c6={};var _0x5135d9={'count':0x0,'rows':[]};return db[_0x9e8f('0x3e')]['findOne']({'where':{'id':_0x3d672a['params']['id']}})[_0x9e8f('0x36')](handleEntityNotFound(_0x583089,null))[_0x9e8f('0x36')](function(_0x448f5b){if(_0x448f5b){_0x4b00c6['model']=_['keys'](db['Disposition'][_0x9e8f('0x3f')]);_0x4b00c6[_0x9e8f('0x43')]=_[_0x9e8f('0x42')](_0x3d672a[_0x9e8f('0x43')]);_0x4b00c6[_0x9e8f('0x4b')]=_['intersection'](_0x4b00c6['model'],_0x4b00c6[_0x9e8f('0x43')]);_0x32e675['attributes']=_['intersection'](_0x4b00c6[_0x9e8f('0x41')],qs[_0x9e8f('0x45')](_0x3d672a[_0x9e8f('0x43')]['fields']));_0x32e675[_0x9e8f('0x44')]=_0x32e675[_0x9e8f('0x44')]['length']?_0x32e675['attributes']:_0x4b00c6[_0x9e8f('0x41')];if(!_0x3d672a[_0x9e8f('0x43')]['hasOwnProperty'](_0x9e8f('0x47'))){_0x32e675[_0x9e8f('0x30')]=qs[_0x9e8f('0x30')](_0x3d672a[_0x9e8f('0x43')]['limit']);_0x32e675[_0x9e8f('0x2e')]=qs[_0x9e8f('0x2e')](_0x3d672a[_0x9e8f('0x43')][_0x9e8f('0x2e')]);}_0x32e675[_0x9e8f('0x48')]=qs['sort'](_0x3d672a[_0x9e8f('0x43')][_0x9e8f('0x49')]);_0x32e675['where']=qs['filters'](_['pick'](_0x3d672a[_0x9e8f('0x43')],_0x4b00c6[_0x9e8f('0x4b')]));_0x32e675[_0x9e8f('0x4a')][_0x9e8f('0x64')]=_0x448f5b['id'];if(_0x3d672a['query']['filter']){_0x32e675[_0x9e8f('0x4a')]=_[_0x9e8f('0x4e')](_0x32e675[_0x9e8f('0x4a')],{'$or':_['map'](_0x32e675[_0x9e8f('0x44')],function(_0x13b590){var _0x204392={};_0x204392[_0x13b590]={'$like':'%'+_0x3d672a[_0x9e8f('0x43')][_0x9e8f('0x4d')]+'%'};return _0x204392;})});}_0x32e675=_[_0x9e8f('0x4e')]({},_0x32e675,_0x3d672a[_0x9e8f('0x51')]);return db['Disposition'][_0x9e8f('0x31')]({'where':_0x32e675[_0x9e8f('0x4a')]})['then'](function(_0x2b9943){_0x5135d9[_0x9e8f('0x31')]=_0x2b9943;if(_0x3d672a['query']['includeAll']){_0x32e675[_0x9e8f('0x53')]=[{'all':!![]}];}return db[_0x9e8f('0x65')]['findAll'](_0x32e675);})['then'](function(_0x4992ed){_0x5135d9[_0x9e8f('0x55')]=_0x4992ed;return _0x5135d9;});}})[_0x9e8f('0x36')](respondWithFilteredResult(_0x583089,_0x32e675))[_0x9e8f('0x2a')](handleError(_0x583089,null));};exports[_0x9e8f('0x67')]=function(_0x490516,_0x1848a3,_0x1ae482){return db[_0x9e8f('0x3e')][_0x9e8f('0x5b')]({'where':{'id':_0x490516[_0x9e8f('0x57')]['id']}})['then'](handleEntityNotFound(_0x1848a3,null))[_0x9e8f('0x36')](function(_0x279545){if(_0x279545){return _0x279545[_0x9e8f('0x67')](_0x490516[_0x9e8f('0x43')][_0x9e8f('0x68')]);}})[_0x9e8f('0x36')](respondWithStatusCode(_0x1848a3,null))['catch'](handleError(_0x1848a3,null));};exports[_0x9e8f('0x69')]=function(_0x8e65dd,_0x433c0a,_0x1e769c){if(_0x8e65dd[_0x9e8f('0x5d')]['id']){delete _0x8e65dd['body']['id'];}return db[_0x9e8f('0x3e')][_0x9e8f('0x5b')]({'where':{'id':_0x8e65dd[_0x9e8f('0x57')]['id']}})[_0x9e8f('0x36')](handleEntityNotFound(_0x433c0a,null))['then'](function(_0x5a0106){if(_0x5a0106){_0x8e65dd['body'][_0x9e8f('0x64')]=_0x5a0106['id'];return db['CannedAnswer'][_0x9e8f('0x5c')](_0x8e65dd[_0x9e8f('0x5d')]);}})[_0x9e8f('0x36')](respondWithResult(_0x433c0a,null))[_0x9e8f('0x2a')](handleError(_0x433c0a,null));};exports[_0x9e8f('0x6a')]=function(_0x42f717,_0x5c88c4,_0x419447){var _0x4dfdb9={'raw':![],'where':{}};var _0x567777={};var _0x6c524a={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x9e8f('0x6b')]({'where':{'id':_0x42f717[_0x9e8f('0x57')]['id']}})[_0x9e8f('0x36')](handleEntityNotFound(_0x5c88c4,null))[_0x9e8f('0x36')](function(_0x106101){if(_0x106101){_0x567777['model']=_[_0x9e8f('0x42')](db['CannedAnswer'][_0x9e8f('0x3f')]);_0x567777['query']=_[_0x9e8f('0x42')](_0x42f717[_0x9e8f('0x43')]);_0x567777[_0x9e8f('0x4b')]=_[_0x9e8f('0x59')](_0x567777[_0x9e8f('0x41')],_0x567777[_0x9e8f('0x43')]);_0x4dfdb9[_0x9e8f('0x44')]=_[_0x9e8f('0x59')](_0x567777[_0x9e8f('0x41')],qs[_0x9e8f('0x45')](_0x42f717[_0x9e8f('0x43')][_0x9e8f('0x45')]));_0x4dfdb9[_0x9e8f('0x44')]=_0x4dfdb9[_0x9e8f('0x44')][_0x9e8f('0x5a')]?_0x4dfdb9[_0x9e8f('0x44')]:_0x567777[_0x9e8f('0x41')];if(!_0x42f717[_0x9e8f('0x43')][_0x9e8f('0x46')]('nolimit')){_0x4dfdb9[_0x9e8f('0x30')]=qs[_0x9e8f('0x30')](_0x42f717[_0x9e8f('0x43')][_0x9e8f('0x30')]);_0x4dfdb9[_0x9e8f('0x2e')]=qs[_0x9e8f('0x2e')](_0x42f717[_0x9e8f('0x43')]['offset']);}_0x4dfdb9[_0x9e8f('0x48')]=qs['sort'](_0x42f717['query'][_0x9e8f('0x49')]);_0x4dfdb9[_0x9e8f('0x4a')]=qs[_0x9e8f('0x4b')](_[_0x9e8f('0x4c')](_0x42f717[_0x9e8f('0x43')],_0x567777[_0x9e8f('0x4b')]));_0x4dfdb9[_0x9e8f('0x4a')][_0x9e8f('0x64')]=_0x106101['id'];if(_0x42f717[_0x9e8f('0x43')]['filter']){_0x4dfdb9[_0x9e8f('0x4a')]=_[_0x9e8f('0x4e')](_0x4dfdb9['where'],{'$or':_[_0x9e8f('0x4f')](_0x4dfdb9[_0x9e8f('0x44')],function(_0x2d2705){var _0x37c7e7={};_0x37c7e7[_0x2d2705]={'$like':'%'+_0x42f717[_0x9e8f('0x43')][_0x9e8f('0x4d')]+'%'};return _0x37c7e7;})});}_0x4dfdb9=_[_0x9e8f('0x4e')]({},_0x4dfdb9,_0x42f717[_0x9e8f('0x51')]);return db[_0x9e8f('0x6c')][_0x9e8f('0x31')]({'where':_0x4dfdb9[_0x9e8f('0x4a')]})[_0x9e8f('0x36')](function(_0x47c4f2){_0x6c524a['count']=_0x47c4f2;if(_0x42f717['query'][_0x9e8f('0x52')]){_0x4dfdb9[_0x9e8f('0x53')]=[{'all':!![]}];}return db[_0x9e8f('0x6c')]['findAll'](_0x4dfdb9);})[_0x9e8f('0x36')](function(_0x461b79){_0x6c524a[_0x9e8f('0x55')]=_0x461b79;return _0x6c524a;});}})[_0x9e8f('0x36')](respondWithFilteredResult(_0x5c88c4,_0x4dfdb9))['catch'](handleError(_0x5c88c4,null));};exports['removeAnswers']=function(_0x231e06,_0x539be0,_0x54eed9){return db[_0x9e8f('0x3e')][_0x9e8f('0x5b')]({'where':{'id':_0x231e06['params']['id']}})['then'](handleEntityNotFound(_0x539be0,null))[_0x9e8f('0x36')](function(_0x4d79f1){if(_0x4d79f1){return _0x4d79f1['removeAnswers'](_0x231e06[_0x9e8f('0x43')][_0x9e8f('0x68')]);}})[_0x9e8f('0x36')](respondWithStatusCode(_0x539be0,null))['catch'](handleError(_0x539be0,null));};exports['addAgents']=function(_0x580a35,_0x303698,_0x4a3251){return db['WhatsappAccount'][_0x9e8f('0x5b')]({'where':{'id':_0x580a35[_0x9e8f('0x57')]['id']}})['then'](handleEntityNotFound(_0x303698,null))['then'](function(_0xb15f01){if(_0xb15f01){return _0xb15f01[_0x9e8f('0x6d')](_0x580a35[_0x9e8f('0x5d')]['ids'],_[_0x9e8f('0x6e')](_0x580a35[_0x9e8f('0x5d')],['ids','id'])||{})['spread'](function(_0x1a3644){for(var _0x3ee7ef=0x0;_0x3ee7ef<_0x580a35[_0x9e8f('0x5d')]['ids'][_0x9e8f('0x5a')];_0x3ee7ef+=0x1){socket[_0x9e8f('0x6f')](_0x9e8f('0x70'),{'UserId':Number(_0x580a35['body'][_0x9e8f('0x68')][_0x3ee7ef]),'WhatsappAccountId':Number(_0x580a35[_0x9e8f('0x57')]['id'])});}return _0x1a3644;});}})[_0x9e8f('0x36')](respondWithResult(_0x303698,null))[_0x9e8f('0x2a')](handleError(_0x303698,null));};exports['removeAgents']=function(_0x5f5914,_0x1ce63e,_0x49f9bb){return db[_0x9e8f('0x3e')]['find']({'where':{'id':_0x5f5914['params']['id']}})[_0x9e8f('0x36')](handleEntityNotFound(_0x1ce63e,null))[_0x9e8f('0x36')](function(_0x573bf7){if(_0x573bf7){return _0x573bf7[_0x9e8f('0x71')](_0x5f5914[_0x9e8f('0x43')]['ids'])[_0x9e8f('0x36')](function(){if(_[_0x9e8f('0x72')](_0x5f5914[_0x9e8f('0x43')][_0x9e8f('0x68')])){for(var _0x4e7247=0x0;_0x4e7247<_0x5f5914[_0x9e8f('0x43')][_0x9e8f('0x68')][_0x9e8f('0x5a')];_0x4e7247+=0x1){socket[_0x9e8f('0x6f')](_0x9e8f('0x73'),{'UserId':Number(_0x5f5914[_0x9e8f('0x43')][_0x9e8f('0x68')][_0x4e7247]),'WhatsappAccountId':Number(_0x5f5914[_0x9e8f('0x57')]['id'])});}}else{socket['emit'](_0x9e8f('0x73'),{'UserId':Number(_0x5f5914[_0x9e8f('0x43')]['ids']),'WhatsappAccountId':Number(_0x5f5914['params']['id'])});}});}})[_0x9e8f('0x36')](respondWithStatusCode(_0x1ce63e,null))[_0x9e8f('0x2a')](handleError(_0x1ce63e,null));};exports[_0x9e8f('0x74')]=function(_0x115bcb,_0x324417,_0x46fc87){var _0x5d71ba={};var _0x449159={};var _0x1d307b;var _0x518d2a;return db[_0x9e8f('0x3e')][_0x9e8f('0x6b')]({'where':{'id':_0x115bcb['params']['id']}})['then'](handleEntityNotFound(_0x324417,null))[_0x9e8f('0x36')](function(_0x52f463){if(_0x52f463){_0x1d307b=_0x52f463;_0x449159['model']=_[_0x9e8f('0x42')](db['User']['rawAttributes']);_0x449159[_0x9e8f('0x43')]=_[_0x9e8f('0x42')](_0x115bcb[_0x9e8f('0x43')]);_0x449159[_0x9e8f('0x4b')]=_[_0x9e8f('0x59')](_0x449159[_0x9e8f('0x41')],_0x449159['query']);_0x5d71ba[_0x9e8f('0x44')]=_[_0x9e8f('0x59')](_0x449159['model'],qs[_0x9e8f('0x45')](_0x115bcb[_0x9e8f('0x43')][_0x9e8f('0x45')]));_0x5d71ba['attributes']=_0x5d71ba[_0x9e8f('0x44')][_0x9e8f('0x5a')]?_0x5d71ba['attributes']:_0x449159[_0x9e8f('0x41')];_0x5d71ba[_0x9e8f('0x48')]=qs[_0x9e8f('0x49')](_0x115bcb[_0x9e8f('0x43')][_0x9e8f('0x49')]);_0x5d71ba[_0x9e8f('0x4a')]=qs['filters'](_[_0x9e8f('0x4c')](_0x115bcb['query'],_0x449159[_0x9e8f('0x4b')]));if(_0x115bcb['query']['filter']){_0x5d71ba['where']=_[_0x9e8f('0x4e')](_0x5d71ba['where'],{'$or':_[_0x9e8f('0x4f')](_0x5d71ba[_0x9e8f('0x44')],function(_0x21d8f9){var _0x311826={};_0x311826[_0x21d8f9]={'$like':'%'+_0x115bcb['query'][_0x9e8f('0x4d')]+'%'};return _0x311826;})});}_0x5d71ba=_['merge']({},_0x5d71ba,_0x115bcb[_0x9e8f('0x51')]);return _0x1d307b[_0x9e8f('0x74')](_0x5d71ba);}})[_0x9e8f('0x36')](function(_0x37178b){if(_0x37178b){_0x518d2a=_0x37178b[_0x9e8f('0x5a')];if(!_0x115bcb[_0x9e8f('0x43')]['hasOwnProperty'](_0x9e8f('0x47'))){_0x5d71ba[_0x9e8f('0x30')]=qs[_0x9e8f('0x30')](_0x115bcb[_0x9e8f('0x43')][_0x9e8f('0x30')]);_0x5d71ba[_0x9e8f('0x2e')]=qs[_0x9e8f('0x2e')](_0x115bcb['query'][_0x9e8f('0x2e')]);}return _0x1d307b[_0x9e8f('0x74')](_0x5d71ba);}})[_0x9e8f('0x36')](function(_0x3a62b6){if(_0x3a62b6){return _0x3a62b6?{'count':_0x518d2a,'rows':_0x3a62b6}:null;}})[_0x9e8f('0x36')](respondWithResult(_0x324417,null))['catch'](handleError(_0x324417,null));};exports[_0x9e8f('0x75')]=function(_0x253674,_0x46b19c){var _0x59bf04=_0x253674[_0x9e8f('0x57')]['id'];var _0x18e08=_0x253674[_0x9e8f('0x5d')];var _0x52f613=0xc8;var _0x2624fd=null;return db[_0x9e8f('0x76')][_0x9e8f('0x77')]({'isolationLevel':db['sequelize'][_0x9e8f('0x78')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x334eea){return db[_0x9e8f('0x3e')][_0x9e8f('0x6b')]({'where':{'id':_0x59bf04},'transaction':_0x334eea})['then'](function(_0x43db4d){if(_0x43db4d){return db[_0x9e8f('0x79')]['destroy']({'where':{'WhatsappAccountId':_0x59bf04},'transaction':_0x334eea})[_0x9e8f('0x36')](function(){var _0x43973b=_[_0x9e8f('0x4f')](_0x18e08,function(_0x420240){_0x420240[_0x9e8f('0x64')]=_0x59bf04;return _0x420240;});return db[_0x9e8f('0x79')][_0x9e8f('0x7a')](_0x43973b,{'transaction':_0x334eea});});}else{_0x52f613=0x194;_0x2624fd=[];}});})[_0x9e8f('0x36')](function(){if(_0x52f613!==0x194){return db[_0x9e8f('0x79')][_0x9e8f('0x7b')]({'where':{'WhatsappAccountId':_0x59bf04},'order':_0x9e8f('0x7c')})[_0x9e8f('0x36')](function(_0x459376){_0x2624fd=_0x459376;});}})[_0x9e8f('0x2a')](function(_0x137937){_0x52f613=0x1f4;logger[_0x9e8f('0x27')](_0x137937['stack']);if(_0x137937[_0x9e8f('0x3a')]){delete _0x137937[_0x9e8f('0x3a')];}_0x2624fd=_0x137937;})[_0x9e8f('0x7d')](function(){if(_0x2624fd===null){_0x46b19c[_0x9e8f('0x2b')](_0x52f613);}else{if(_0x52f613===0x1f4){_0x46b19c[_0x9e8f('0x2c')](_0x52f613)[_0x9e8f('0x3b')](_0x2624fd);}else{_0x46b19c[_0x9e8f('0x2c')](_0x52f613)[_0x9e8f('0x2d')](_0x2624fd);}}});};exports['getApplications']=function(_0x6707a4,_0x545a47,_0xdad776){var _0x249dae={};var _0x883e00={};var _0x1ffadc;var _0x5bf252;return db[_0x9e8f('0x3e')]['findOne']({'where':{'id':_0x6707a4[_0x9e8f('0x57')]['id']}})[_0x9e8f('0x36')](handleEntityNotFound(_0x545a47,null))[_0x9e8f('0x36')](function(_0x35f2d6){if(_0x35f2d6){_0x1ffadc=_0x35f2d6;_0x883e00[_0x9e8f('0x41')]=_['keys'](db[_0x9e8f('0x79')][_0x9e8f('0x3f')]);_0x883e00[_0x9e8f('0x43')]=_['keys'](_0x6707a4[_0x9e8f('0x43')]);_0x883e00[_0x9e8f('0x4b')]=_[_0x9e8f('0x59')](_0x883e00[_0x9e8f('0x41')],_0x883e00[_0x9e8f('0x43')]);_0x249dae[_0x9e8f('0x44')]=_[_0x9e8f('0x59')](_0x883e00['model'],qs[_0x9e8f('0x45')](_0x6707a4[_0x9e8f('0x43')][_0x9e8f('0x45')]));_0x249dae[_0x9e8f('0x44')]=_0x249dae[_0x9e8f('0x44')][_0x9e8f('0x5a')]?_0x249dae[_0x9e8f('0x44')]:_0x883e00[_0x9e8f('0x41')];_0x249dae[_0x9e8f('0x48')]=qs['sort'](_0x6707a4['query'][_0x9e8f('0x49')]);_0x249dae['where']=qs['filters'](_[_0x9e8f('0x4c')](_0x6707a4[_0x9e8f('0x43')],_0x883e00['filters']));if(_0x6707a4[_0x9e8f('0x43')][_0x9e8f('0x4d')]){_0x249dae['where']=_[_0x9e8f('0x4e')](_0x249dae[_0x9e8f('0x4a')],{'$or':_[_0x9e8f('0x4f')](_0x249dae[_0x9e8f('0x44')],function(_0x3e65a6){var _0x3cc459={};_0x3cc459[_0x3e65a6]={'$like':'%'+_0x6707a4['query'][_0x9e8f('0x4d')]+'%'};return _0x3cc459;})});}_0x249dae=_[_0x9e8f('0x4e')]({},_0x249dae,_0x6707a4['options']);return _0x1ffadc[_0x9e8f('0x7e')](_0x249dae);}})[_0x9e8f('0x36')](function(_0xccb089){if(_0xccb089){_0x5bf252=_0xccb089[_0x9e8f('0x5a')];if(!_0x6707a4[_0x9e8f('0x43')][_0x9e8f('0x46')](_0x9e8f('0x47'))){_0x249dae[_0x9e8f('0x30')]=qs[_0x9e8f('0x30')](_0x6707a4[_0x9e8f('0x43')][_0x9e8f('0x30')]);_0x249dae[_0x9e8f('0x2e')]=qs[_0x9e8f('0x2e')](_0x6707a4[_0x9e8f('0x43')][_0x9e8f('0x2e')]);}return _0x1ffadc[_0x9e8f('0x7e')](_0x249dae);}})[_0x9e8f('0x36')](function(_0x4eac9){if(_0x4eac9){return _0x4eac9?{'count':_0x5bf252,'rows':_0x4eac9}:null;}})[_0x9e8f('0x36')](respondWithResult(_0x545a47,null))[_0x9e8f('0x2a')](handleError(_0x545a47,null));};exports[_0x9e8f('0x7f')]=function(_0x5147f8,_0x1d3110,_0x107ff1){var _0x2083f3={'channel':_0x9e8f('0x80')};var _0x338088=[];var _0x4c1792=[];var _0x1f859b={};return db[_0x9e8f('0x3e')]['find']({'where':{'id':_0x5147f8['params']['id']},'include':[{'model':db[_0x9e8f('0x79')],'as':_0x9e8f('0x81')}]})[_0x9e8f('0x36')](handleEntityNotFound(_0x1d3110,null))['then'](function(_0x55eaa9){_0x2083f3[_0x9e8f('0x82')]=_0x55eaa9;if(_0x2083f3[_0x9e8f('0x82')]&&_0x2083f3[_0x9e8f('0x82')][_0x9e8f('0x40')]===_0x9e8f('0x83')&&_0x5147f8[_0x9e8f('0x5d')][_0x9e8f('0x84')]){if(_0x5147f8[_0x9e8f('0x5d')][_0x9e8f('0x84')][_0x9e8f('0x5a')]===0x0)return;if(_0x5147f8[_0x9e8f('0x5d')][_0x9e8f('0x84')][0x0][_0x9e8f('0x85')]!==_0x9e8f('0x86'))return;return db['WhatsappMessage'][_0x9e8f('0x35')]({'read':!![],'readAt':_0x5147f8['body'][_0x9e8f('0x84')][0x0][_0x9e8f('0x87')]},{'where':{'messageId':_0x5147f8[_0x9e8f('0x5d')][_0x9e8f('0x84')][0x0][_0x9e8f('0x88')]},'individualHooks':!![]})['then'](function(_0x59357d){return _0x1d3110[_0x9e8f('0x2c')](0xc8)[_0x9e8f('0x2d')](_0x59357d);});}_0x2083f3[_0x9e8f('0x89')]=_[_0x9e8f('0x8a')](_0x55eaa9[_0x9e8f('0x81')],[_0x9e8f('0x7c')],[_0x9e8f('0x8b')]);if(_0x2083f3[_0x9e8f('0x82')]['Applications']){delete _0x2083f3[_0x9e8f('0x82')][_0x9e8f('0x81')];}return db['CmContact'][_0x9e8f('0x62')]()[_0x9e8f('0x36')](function(_0x4b309a){if(!_0x4b309a){throw new db[(_0x9e8f('0x8c'))][(_0x9e8f('0x8d'))](_0x9e8f('0x8e'));}_0x338088=_[_0x9e8f('0x8f')](_[_0x9e8f('0x42')](_0x4b309a),[_0x9e8f('0x90'),_0x9e8f('0x91')]);_0x4c1792=_[_0x9e8f('0x8f')](_[_0x9e8f('0x42')](_0x4b309a),[_0x9e8f('0x90'),'updatedAt',_0x9e8f('0x92'),_0x9e8f('0x93')]);_0x2083f3[_0x9e8f('0x5d')]={'mapKey':_0x9e8f('0x94')};if(_0x2083f3[_0x9e8f('0x82')]&&_0x2083f3[_0x9e8f('0x82')]['type']===_0x9e8f('0x95')){_0x2083f3['body'][_0x9e8f('0x96')]=_0x5147f8[_0x9e8f('0x5d')][_0x9e8f('0x97')][_0x9e8f('0x98')](_0x9e8f('0x99'),'');_0x2083f3['body'][_0x9e8f('0x5d')]=_0x5147f8[_0x9e8f('0x5d')][_0x9e8f('0x9a')];_0x2083f3[_0x9e8f('0x5d')][_0x9e8f('0x9b')]=_0x5147f8[_0x9e8f('0x5d')]['MessageSid'];}if(_0x2083f3[_0x9e8f('0x82')]&&_0x2083f3[_0x9e8f('0x82')]['type']==='sinch'){_0x2083f3['body'][_0x9e8f('0x96')]=_0x5147f8[_0x9e8f('0x5d')][_0x9e8f('0x9c')][0x0]['from'];_0x2083f3[_0x9e8f('0x5d')][_0x9e8f('0x5d')]=_0x5147f8[_0x9e8f('0x5d')][_0x9e8f('0x9c')][0x0][_0x9e8f('0x29')][_0x9e8f('0x5d')];_0x2083f3[_0x9e8f('0x5d')][_0x9e8f('0x9b')]=_0x5147f8[_0x9e8f('0x5d')][_0x9e8f('0x9c')][0x0][_0x9e8f('0x88')];}if(_0x2083f3[_0x9e8f('0x5d')]['id']){delete _0x2083f3[_0x9e8f('0x5d')]['id'];}if(_['isNil'](_0x2083f3[_0x9e8f('0x5d')]['from'])){throw new db[(_0x9e8f('0x8c'))]['ValidationError'](_0x9e8f('0x9d'));}if(_[_0x9e8f('0x9e')](_0x2083f3[_0x9e8f('0x5d')]['body'])||_0x2083f3[_0x9e8f('0x5d')][_0x9e8f('0x5d')]===''){throw new db['Sequelize']['ValidationError'](_0x9e8f('0x9f'));}if(_[_0x9e8f('0x9e')](_0x2083f3[_0x9e8f('0x5d')]['mapKey'])){throw new db[(_0x9e8f('0x8c'))][(_0x9e8f('0x8d'))](_0x9e8f('0xa0')+_0x4c1792);}if(!_[_0x9e8f('0xa1')](_0x4c1792,_0x2083f3[_0x9e8f('0x5d')]['mapKey'])){throw new db[(_0x9e8f('0x8c'))]['ValidationError'](_0x9e8f('0xa2')+_0x4c1792);}_0x1f859b[_0x2083f3[_0x9e8f('0x5d')][_0x9e8f('0xa3')]]=_0x2083f3[_0x9e8f('0x5d')][_0x9e8f('0x96')];return db['CmList']['find']({'where':{'id':_0x2083f3[_0x9e8f('0x82')][_0x9e8f('0x93')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x1f859b,'limit':0x1,'order':[[_0x9e8f('0x91'),_0x9e8f('0xa4')]]}]});})[_0x9e8f('0x36')](handleEntityNotFound(_0x1d3110,null))['then'](function(_0xcd7a79){if(_0xcd7a79){_0x2083f3[_0x9e8f('0xa5')]=_['omit'](_0xcd7a79,[_0x9e8f('0xa6')]);if(_0xcd7a79[_0x9e8f('0xa6')][_0x9e8f('0x5a')]){return _0xcd7a79['Contacts'][0x0];}var _0x3e5ad4=_[_0x9e8f('0x1c')](_0x2083f3['body'],{'firstName':_0x2083f3[_0x9e8f('0x5d')][_0x9e8f('0x96')],'ListId':_0xcd7a79['id']});_0x3e5ad4[_0x2083f3[_0x9e8f('0x5d')][_0x9e8f('0xa3')]]=_0x2083f3[_0x9e8f('0x5d')][_0x9e8f('0x96')];return db[_0x9e8f('0xa7')][_0x9e8f('0x5c')](_0x3e5ad4,{'fields':_0x338088,'raw':!![]});}})[_0x9e8f('0x36')](handleEntityNotFound(_0x1d3110,null))[_0x9e8f('0x36')](function(_0x4c26f8){if(_0x4c26f8){_0x2083f3[_0x9e8f('0xa8')]=_0x4c26f8;var _0x8b514c={'ContactId':_0x4c26f8['id'],'phone':_0x2083f3[_0x9e8f('0x5d')]['from'],'WhatsappAccountId':_0x5147f8[_0x9e8f('0x57')]['id']};var _0x4e4182={'ContactId':_0x4c26f8['id'],'WhatsappAccountId':_0x5147f8['params']['id'],'closed':![]};return db[_0x9e8f('0xa9')][_0x9e8f('0x5b')]({'where':_0x4e4182})[_0x9e8f('0x36')](function(_0x4463d0){if(_0x4463d0){return[_0x4463d0,![]];}return db[_0x9e8f('0xa9')][_0x9e8f('0x5c')](_0x8b514c)[_0x9e8f('0x36')](function(_0x40047f){return[_0x40047f,!![]];});});}})[_0x9e8f('0xaa')](function(_0x3a02e6,_0x1e6fab){_0x2083f3['interaction']=_0x3a02e6[_0x9e8f('0x38')]({'plain':!![]});_0x2083f3['interaction'][_0x9e8f('0xab')]=![];if(_0x1e6fab){if(_0x2083f3[_0x9e8f('0x82')]['autoclose']){_0x2083f3['applications'][_0x9e8f('0xac')]({'id':0x0,'priority':_0x2083f3['applications']['length']+0x1,'app':_0x9e8f('0xad'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x2083f3[_0x9e8f('0xae')]['created']=!![];}return db[_0x9e8f('0xaf')][_0x9e8f('0x5c')]({'phone':_0x2083f3[_0x9e8f('0x5d')][_0x9e8f('0x96')],'messageId':_0x2083f3[_0x9e8f('0x5d')][_0x9e8f('0x9b')],'body':_0x2083f3[_0x9e8f('0x5d')]['body'],'WhatsappAccountId':_0x5147f8[_0x9e8f('0x57')]['id'],'WhatsappInteractionId':_0x3a02e6['id'],'direction':'in','ContactId':_0x3a02e6[_0x9e8f('0xb0')],'AttachmentId':_0x2083f3[_0x9e8f('0x5d')]['AttachmentId']});})[_0x9e8f('0x36')](function(_0x5460b7){_0x2083f3[_0x9e8f('0x29')]=_0x5460b7;if(!_0x2083f3[_0x9e8f('0xae')]['UserId'])return;return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x2083f3[_0x9e8f('0xae')][_0x9e8f('0xb1')]}});})[_0x9e8f('0x36')](function(_0x2e025c){if(_0x2e025c){_0x2083f3['applications'][_0x9e8f('0xb2')]({'id':0x0,'priority':0x0,'app':_0x9e8f('0xb3'),'appdata':_0x2e025c['name']+','+(_0x2083f3['account'][_0x9e8f('0xb4')]||0xa),'interval':_0x9e8f('0xb5')});}if(!_0x2083f3[_0x9e8f('0xae')]['queueId'])return;return db['WhatsappQueue']['find']({'attributes':['id','name'],'where':{'id':_0x2083f3[_0x9e8f('0xae')][_0x9e8f('0xb6')]}});})[_0x9e8f('0x36')](function(_0x4edda6){if(_0x4edda6){_0x2083f3[_0x9e8f('0x89')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4edda6[_0x9e8f('0x3a')]+','+(_0x2083f3[_0x9e8f('0x82')][_0x9e8f('0xb7')]||0x12c),'interval':_0x9e8f('0xb5')});}return respondWithRpcPromise(_0x9e8f('0xb8'),_0x9e8f('0xb9'),_0x2083f3);})[_0x9e8f('0x36')](function(_0x262d34){if(_0x262d34){var _0x20de51=0xc8;var _0x5d9a5b=_0x9e8f('0xba');logger[_0x9e8f('0x22')](_0x9e8f('0xbb'),_0x5d9a5b,_0x20de51,_0x9e8f('0xbc'));logger['debug'](_0x9e8f('0xbd'),_0x5d9a5b,_0x20de51,_0x9e8f('0xbc'),JSON[_0x9e8f('0x26')](_0x262d34));if(_0x2083f3[_0x9e8f('0x82')][_0x9e8f('0x40')]==='twilio'){return _0x1d3110[_0x9e8f('0x2c')](_0x20de51)[_0x9e8f('0x32')](_0x9e8f('0xbe'),_0x9e8f('0xbf'))['send']('\x0a');}else{return _0x1d3110[_0x9e8f('0x2c')](_0x20de51)['json'](_0x262d34);}}});})['catch'](handleError(_0x1d3110,null));};exports['send']=function(_0x2fea03,_0x25c726,_0x12820a){var _0x42c583,_0x24b526,_0x448255;if(_[_0x9e8f('0x9e')](_0x2fea03[_0x9e8f('0x5d')][_0x9e8f('0x5d')])||_0x2fea03[_0x9e8f('0x5d')][_0x9e8f('0x5d')]===''){throw new db[(_0x9e8f('0x8c'))][(_0x9e8f('0x8d'))](_0x9e8f('0x9f'));}if(_[_0x9e8f('0x9e')](_0x2fea03['body']['to'])){throw new db[(_0x9e8f('0x8c'))][(_0x9e8f('0x8d'))]('to\x20is\x20mandatory');}_0x42c583=_0x2fea03[_0x9e8f('0x5d')]['to'];return db[_0x9e8f('0x3e')][_0x9e8f('0x5b')]({'where':{'id':_0x2fea03[_0x9e8f('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0x9e8f('0xc0'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x42c583},'limit':0x1,'order':[[_0x9e8f('0x91'),_0x9e8f('0xa4')]]}]}]})[_0x9e8f('0x36')](handleEntityNotFound(_0x25c726,null))[_0x9e8f('0x36')](function(_0x10a1d7){if(_0x10a1d7&&_0x10a1d7[_0x9e8f('0xc0')]){_0x24b526=_0x10a1d7[_0x9e8f('0x38')]({'plain':!![]});if(_0x24b526[_0x9e8f('0xc0')]&&_0x24b526[_0x9e8f('0xc0')][_0x9e8f('0xa6')]['length']){return _0x24b526['List'][_0x9e8f('0xa6')][0x0];}return db[_0x9e8f('0xa7')]['create'](_[_0x9e8f('0x1c')](_0x2fea03[_0x9e8f('0x5d')],{'firstName':_0x42c583,'mobile':_0x42c583,'phone':_0x42c583,'ListId':_0x24b526[_0x9e8f('0x93')]}));}})[_0x9e8f('0x36')](handleEntityNotFound(_0x25c726,null))['then'](function(_0x6e0269){if(_0x6e0269){_0x448255=_0x6e0269;return db[_0x9e8f('0xa9')][_0x9e8f('0x5b')]({'where':{'ContactId':_0x448255['id'],'closed':![],'WhatsappAccountId':_0x24b526['id']}})['then'](function(_0x43952b){if(_0x43952b){return[_0x43952b,![]];}return db[_0x9e8f('0xa9')][_0x9e8f('0x5c')]({'UserId':_0x2fea03[_0x9e8f('0x5e')]['id'],'ContactId':_0x448255['id'],'WhatsappAccountId':_0x24b526['id'],'phone':_0x42c583,'firstMsgDirection':'out','Messages':[_[_0x9e8f('0x4e')](_0x2fea03[_0x9e8f('0x5d')],{'read':![],'body':_0x2fea03['body'][_0x9e8f('0x5d')],'phone':_0x42c583,'WhatsappAccountId':_0x24b526['id'],'UserId':_0x2fea03[_0x9e8f('0x5e')]['id'],'ContactId':_0x448255['id']})]},{'include':[{'model':db[_0x9e8f('0xaf')],'as':'Messages'}]})[_0x9e8f('0x36')](function(_0x553d6f){return[_0x553d6f,!![]];});});}})[_0x9e8f('0xaa')](function(_0x4918c1,_0x3161cc){if(_0x3161cc){return _0x4918c1;}return db['WhatsappMessage'][_0x9e8f('0x5c')](_[_0x9e8f('0x4e')](_0x2fea03[_0x9e8f('0x5d')],{'read':![],'body':_0x2fea03['body'][_0x9e8f('0x5d')],'phone':_0x42c583,'WhatsappAccountId':_0x24b526['id'],'WhatsappInteractionId':_0x4918c1['id'],'UserId':_0x2fea03['user']['id'],'ContactId':_0x448255['id']}))[_0x9e8f('0x36')](function(_0x1a146c){_0x4918c1[_0x9e8f('0xc1')][_0x9e8f('0xc2')]=[];_0x4918c1['dataValues'][_0x9e8f('0xc2')][_0x9e8f('0xac')](_0x1a146c['dataValues']);return _0x4918c1;});})[_0x9e8f('0x36')](respondWithResult(_0x25c726,null))[_0x9e8f('0x2a')](handleError(_0x25c726,null));}; \ No newline at end of file +var _0xa3bb=['WhatsappAccount,\x20%s,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','set','Content-Type','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','then','info','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','WhatsappAccounts','stack','name','index','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','show','params','Pause','rawAttributes','length','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','rows','removeAnswers','addAgents','omit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','emit','getAgents','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','CmContact','WhatsappInteraction','spread','interaction','created','push','close','unmanaged','*,*,*,*','ContactId','User','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage'];(function(_0x40bdb3,_0x5a81f2){var _0xeac086=function(_0x199fba){while(--_0x199fba){_0x40bdb3['push'](_0x40bdb3['shift']());}};_0xeac086(++_0x5a81f2);}(_0xa3bb,0xd2));var _0xba3b=function(_0x53f4e5,_0xb2993e){_0x53f4e5=_0x53f4e5-0x0;var _0x4c36bd=_0xa3bb[_0x53f4e5];return _0x4c36bd;};'use strict';var emlformat=require(_0xba3b('0x0'));var rimraf=require(_0xba3b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xba3b('0x2'));var rp=require(_0xba3b('0x3'));var moment=require(_0xba3b('0x4'));var BPromise=require(_0xba3b('0x5'));var Mustache=require(_0xba3b('0x6'));var util=require('util');var path=require(_0xba3b('0x7'));var sox=require(_0xba3b('0x8'));var csv=require(_0xba3b('0x9'));var ejs=require(_0xba3b('0xa'));var fs=require('fs');var fs_extra=require(_0xba3b('0xb'));var _=require(_0xba3b('0xc'));var squel=require(_0xba3b('0xd'));var crypto=require(_0xba3b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xba3b('0xf'));var toCsv=require(_0xba3b('0x9'));var querystring=require('querystring');var Papa=require(_0xba3b('0x10'));var Redis=require(_0xba3b('0x11'));var authService=require(_0xba3b('0x12'));var qs=require(_0xba3b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba3b('0x14'));var logger=require(_0xba3b('0x15'))('api');var utils=require(_0xba3b('0x16'));var config=require(_0xba3b('0x17'));var licenseUtil=require(_0xba3b('0x18'));var db=require('../../mysqldb')['db'];config[_0xba3b('0x19')]=_[_0xba3b('0x1a')](config[_0xba3b('0x19')],{'host':_0xba3b('0x1b'),'port':0x18eb});var socket=require(_0xba3b('0x1c'))(new Redis(config[_0xba3b('0x19')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0xba3b('0x1d'));var client=jayson[_0xba3b('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3e03bc,_0x2e6bd0,_0x180d77,_0x31c7ee){return new BPromise(function(_0x125d3d,_0x3d6cda){var _0x3ad164=_0x31c7ee||client;return _0x3ad164['request'](_0x3e03bc,_0x180d77)[_0xba3b('0x1f')](function(_0x2c15e1){logger[_0xba3b('0x20')](_0xba3b('0x21'),_0x2e6bd0,'request\x20sent');logger[_0xba3b('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2e6bd0,_0xba3b('0x23'),JSON[_0xba3b('0x24')](_0x2c15e1));if(_0x2c15e1[_0xba3b('0x25')]){if(_0x2c15e1['error'][_0xba3b('0x26')]===0x1f4){logger[_0xba3b('0x25')](_0xba3b('0x21'),_0x2e6bd0,_0x2c15e1[_0xba3b('0x25')][_0xba3b('0x27')]);return _0x3d6cda(_0x2c15e1[_0xba3b('0x25')][_0xba3b('0x27')]);}logger[_0xba3b('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x2e6bd0,_0x2c15e1[_0xba3b('0x25')][_0xba3b('0x27')]);return _0x125d3d(_0x2c15e1[_0xba3b('0x25')]['message']);}else{logger['info'](_0xba3b('0x21'),_0x2e6bd0,'request\x20sent');_0x125d3d(_0x2c15e1[_0xba3b('0x28')][_0xba3b('0x27')]);}})[_0xba3b('0x29')](function(_0x47dc67){logger[_0xba3b('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x2e6bd0,_0x47dc67);_0x3d6cda(_0x47dc67);});});}function respondWithStatusCode(_0x17411d,_0x521a0e){_0x521a0e=_0x521a0e||0xcc;return function(_0x1d5bc8){if(_0x1d5bc8){return _0x17411d[_0xba3b('0x2a')](_0x521a0e);}return _0x17411d[_0xba3b('0x2b')](_0x521a0e)[_0xba3b('0x2c')]();};}function respondWithResult(_0x33e095,_0x57dfc0){_0x57dfc0=_0x57dfc0||0xc8;return function(_0xe6e9f3){if(_0xe6e9f3){return _0x33e095[_0xba3b('0x2b')](_0x57dfc0)[_0xba3b('0x2d')](_0xe6e9f3);}};}function respondWithFilteredResult(_0x1aa059,_0x12e410){return function(_0x17b181){if(_0x17b181){var _0x1f364c=typeof _0x12e410[_0xba3b('0x2e')]===_0xba3b('0x2f')&&typeof _0x12e410[_0xba3b('0x30')]===_0xba3b('0x2f');var _0x2e386e=_0x17b181[_0xba3b('0x31')];var _0x4a6e77=_0x1f364c?0x0:_0x12e410[_0xba3b('0x2e')];var _0x15d298=_0x1f364c?_0x17b181[_0xba3b('0x31')]:_0x12e410[_0xba3b('0x2e')]+_0x12e410[_0xba3b('0x30')];var _0x579842;if(_0x15d298>=_0x2e386e){_0x15d298=_0x2e386e;_0x579842=0xc8;}else{_0x579842=0xce;}_0x1aa059[_0xba3b('0x2b')](_0x579842);return _0x1aa059['set']('Content-Range',_0x4a6e77+'-'+_0x15d298+'/'+_0x2e386e)[_0xba3b('0x2d')](_0x17b181);}return null;};}function patchUpdates(_0x13d8d8){return function(_0x803c8b){try{jsonpatch[_0xba3b('0x32')](_0x803c8b,_0x13d8d8,!![]);}catch(_0x2a10ce){return BPromise[_0xba3b('0x33')](_0x2a10ce);}return _0x803c8b[_0xba3b('0x34')]();};}function saveUpdates(_0x552c3f,_0x431512){return function(_0x55fa40){if(_0x55fa40){return _0x55fa40[_0xba3b('0x35')](_0x552c3f)[_0xba3b('0x1f')](function(_0x370ea1){return _0x370ea1;});}return null;};}function removeEntity(_0x5aa083,_0x375722){return function(_0x3c0a1e){if(_0x3c0a1e){return _0x3c0a1e[_0xba3b('0x36')]()[_0xba3b('0x1f')](function(){var _0x29afe8=_0x3c0a1e['get']({'plain':!![]});var _0x584a35=_0xba3b('0x37');return db['UserProfileResource'][_0xba3b('0x36')]({'where':{'type':_0x584a35,'resourceId':_0x29afe8['id']}})[_0xba3b('0x1f')](function(){return _0x3c0a1e;});})['then'](function(){_0x5aa083['status'](0xcc)[_0xba3b('0x2c')]();});}};}function handleEntityNotFound(_0x1e71d9,_0x1b2ff2){return function(_0x43fba6){if(!_0x43fba6){_0x1e71d9[_0xba3b('0x2a')](0x194);}return _0x43fba6;};}function handleError(_0x408b86,_0x1588eb){_0x1588eb=_0x1588eb||0x1f4;return function(_0x561a34){logger['error'](_0x561a34[_0xba3b('0x38')]);if(_0x561a34[_0xba3b('0x39')]){delete _0x561a34[_0xba3b('0x39')];}_0x408b86[_0xba3b('0x2b')](_0x1588eb)['send'](_0x561a34);};}exports[_0xba3b('0x3a')]=function(_0xa3fd5,_0x1e3884){var _0x48b3a1={'include':[{'model':db['Pause'],'as':_0xba3b('0x3b')}]},_0x165b76={},_0x34e707={'count':0x0,'rows':[]};var _0x48ea47=_[_0xba3b('0x3c')](db[_0xba3b('0x3d')]['rawAttributes'],function(_0x933a6f){return{'name':_0x933a6f[_0xba3b('0x3e')],'type':_0x933a6f[_0xba3b('0x3f')][_0xba3b('0x40')]};});_0x165b76[_0xba3b('0x41')]=_[_0xba3b('0x3c')](_0x48ea47,'name');_0x165b76[_0xba3b('0x42')]=_[_0xba3b('0x43')](_0xa3fd5[_0xba3b('0x42')]);_0x165b76[_0xba3b('0x44')]=_[_0xba3b('0x45')](_0x165b76[_0xba3b('0x41')],_0x165b76[_0xba3b('0x42')]);_0x48b3a1['attributes']=_[_0xba3b('0x45')](_0x165b76[_0xba3b('0x41')],qs[_0xba3b('0x46')](_0xa3fd5[_0xba3b('0x42')][_0xba3b('0x46')]));_0x48b3a1['attributes']=_0x48b3a1[_0xba3b('0x47')]['length']?_0x48b3a1[_0xba3b('0x47')]:_0x165b76['model'];if(!_0xa3fd5[_0xba3b('0x42')][_0xba3b('0x48')](_0xba3b('0x49'))){_0x48b3a1[_0xba3b('0x30')]=qs[_0xba3b('0x30')](_0xa3fd5[_0xba3b('0x42')][_0xba3b('0x30')]);_0x48b3a1[_0xba3b('0x2e')]=qs[_0xba3b('0x2e')](_0xa3fd5[_0xba3b('0x42')]['offset']);}_0x48b3a1[_0xba3b('0x4a')]=qs['sort'](_0xa3fd5[_0xba3b('0x42')][_0xba3b('0x4b')]);_0x48b3a1[_0xba3b('0x4c')]=qs[_0xba3b('0x44')](_[_0xba3b('0x4d')](_0xa3fd5[_0xba3b('0x42')],_0x165b76[_0xba3b('0x44')]),_0x48ea47);if(_0xa3fd5[_0xba3b('0x42')][_0xba3b('0x4e')]){_0x48b3a1[_0xba3b('0x4c')]=_[_0xba3b('0x4f')](_0x48b3a1['where'],{'$or':_[_0xba3b('0x3c')](_0x48ea47,function(_0x52bb3e){if(_0x52bb3e[_0xba3b('0x3f')]!=='VIRTUAL'){var _0x28fb5c={};_0x28fb5c[_0x52bb3e[_0xba3b('0x39')]]={'$like':'%'+_0xa3fd5['query'][_0xba3b('0x4e')]+'%'};return _0x28fb5c;}})});}_0x48b3a1=_[_0xba3b('0x4f')]({},_0x48b3a1,_0xa3fd5[_0xba3b('0x50')]);var _0x5b6ac3={'where':_0x48b3a1[_0xba3b('0x4c')]};return db[_0xba3b('0x3d')][_0xba3b('0x31')](_0x5b6ac3)[_0xba3b('0x1f')](function(_0x11ef78){_0x34e707['count']=_0x11ef78;if(_0xa3fd5['query'][_0xba3b('0x51')]){_0x48b3a1['include']=[{'all':!![]}];}return db[_0xba3b('0x3d')][_0xba3b('0x52')](_0x48b3a1);})[_0xba3b('0x1f')](function(_0x4d3967){_0x34e707['rows']=_0x4d3967;return _0x34e707;})[_0xba3b('0x1f')](respondWithFilteredResult(_0x1e3884,_0x48b3a1))['catch'](handleError(_0x1e3884,null));};exports[_0xba3b('0x53')]=function(_0x4e92a1,_0x26bf25){var _0x7e3eb5={'raw':![],'where':{'id':_0x4e92a1[_0xba3b('0x54')]['id']},'include':[{'model':db[_0xba3b('0x55')],'as':_0xba3b('0x3b')}]},_0x356c9f={};_0x356c9f['model']=_[_0xba3b('0x43')](db[_0xba3b('0x3d')][_0xba3b('0x56')]);_0x356c9f[_0xba3b('0x42')]=_['keys'](_0x4e92a1['query']);_0x356c9f[_0xba3b('0x44')]=_[_0xba3b('0x45')](_0x356c9f[_0xba3b('0x41')],_0x356c9f[_0xba3b('0x42')]);_0x7e3eb5[_0xba3b('0x47')]=_[_0xba3b('0x45')](_0x356c9f['model'],qs['fields'](_0x4e92a1[_0xba3b('0x42')][_0xba3b('0x46')]));_0x7e3eb5[_0xba3b('0x47')]=_0x7e3eb5[_0xba3b('0x47')][_0xba3b('0x57')]?_0x7e3eb5['attributes']:_0x356c9f[_0xba3b('0x41')];if(_0x4e92a1[_0xba3b('0x42')][_0xba3b('0x51')]){_0x7e3eb5[_0xba3b('0x58')]=[{'all':!![]}];}_0x7e3eb5=_[_0xba3b('0x4f')]({},_0x7e3eb5,_0x4e92a1[_0xba3b('0x50')]);return db[_0xba3b('0x3d')][_0xba3b('0x59')](_0x7e3eb5)[_0xba3b('0x1f')](handleEntityNotFound(_0x26bf25,null))[_0xba3b('0x1f')](respondWithResult(_0x26bf25,null))[_0xba3b('0x29')](handleError(_0x26bf25,null));};exports[_0xba3b('0x5a')]=function(_0x2a5af9,_0x25f007){return db['WhatsappAccount'][_0xba3b('0x5a')](_0x2a5af9[_0xba3b('0x5b')],{})[_0xba3b('0x1f')](function(_0x355238){var _0x39aa59=_0x2a5af9['user'][_0xba3b('0x5c')]({'plain':!![]});if(!_0x39aa59)throw new Error(_0xba3b('0x5d'));if(_0x39aa59[_0xba3b('0x5e')]===_0xba3b('0x5f')){var _0x3411b1=_0x355238[_0xba3b('0x5c')]({'plain':!![]});var _0x261358=_0xba3b('0x37');return db[_0xba3b('0x60')][_0xba3b('0x59')]({'where':{'name':_0x261358,'userProfileId':_0x39aa59[_0xba3b('0x61')]},'raw':!![]})[_0xba3b('0x1f')](function(_0x15f547){if(_0x15f547&&_0x15f547[_0xba3b('0x62')]===0x0){return db['UserProfileResource'][_0xba3b('0x5a')]({'name':_0x3411b1[_0xba3b('0x39')],'resourceId':_0x3411b1['id'],'type':_0x15f547[_0xba3b('0x39')],'sectionId':_0x15f547['id']},{})[_0xba3b('0x1f')](function(){return _0x355238;});}else{return _0x355238;}})[_0xba3b('0x29')](function(_0x4fad3b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fad3b);throw _0x4fad3b;});}return _0x355238;})[_0xba3b('0x1f')](respondWithResult(_0x25f007,0xc9))[_0xba3b('0x29')](handleError(_0x25f007,null));};exports[_0xba3b('0x35')]=function(_0x3c102c,_0x49aee1){if(_0x3c102c[_0xba3b('0x5b')]['id']){delete _0x3c102c[_0xba3b('0x5b')]['id'];}return db[_0xba3b('0x3d')][_0xba3b('0x59')]({'where':{'id':_0x3c102c[_0xba3b('0x54')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xba3b('0x1f')](handleEntityNotFound(_0x49aee1,null))[_0xba3b('0x1f')](saveUpdates(_0x3c102c['body'],null))[_0xba3b('0x1f')](respondWithResult(_0x49aee1,null))[_0xba3b('0x29')](handleError(_0x49aee1,null));};exports['destroy']=function(_0x116404,_0x218ae7){return db[_0xba3b('0x3d')][_0xba3b('0x59')]({'where':{'id':_0x116404[_0xba3b('0x54')]['id']}})[_0xba3b('0x1f')](handleEntityNotFound(_0x218ae7,null))['then'](removeEntity(_0x218ae7,null))[_0xba3b('0x29')](handleError(_0x218ae7,null));};exports[_0xba3b('0x63')]=function(_0x5341c8,_0x28884a){return db[_0xba3b('0x3d')][_0xba3b('0x63')]()[_0xba3b('0x1f')](respondWithResult(_0x28884a,null))[_0xba3b('0x29')](handleError(_0x28884a,null));};exports[_0xba3b('0x64')]=function(_0x550e09,_0x29a892,_0x599e27){if(_0x550e09['body']['id']){delete _0x550e09[_0xba3b('0x5b')]['id'];}return db['WhatsappAccount'][_0xba3b('0x59')]({'where':{'id':_0x550e09[_0xba3b('0x54')]['id']}})[_0xba3b('0x1f')](handleEntityNotFound(_0x29a892,null))[_0xba3b('0x1f')](function(_0x958103){if(_0x958103){_0x550e09[_0xba3b('0x5b')][_0xba3b('0x65')]=_0x958103['id'];return db[_0xba3b('0x66')][_0xba3b('0x5a')](_0x550e09['body']);}})[_0xba3b('0x1f')](respondWithResult(_0x29a892,null))['catch'](handleError(_0x29a892,null));};exports[_0xba3b('0x67')]=function(_0x2c8c98,_0xaf6419,_0x19fa4e){var _0x2087eb={'raw':![],'where':{}};var _0x419fff={};var _0x117d06={'count':0x0,'rows':[]};return db[_0xba3b('0x3d')][_0xba3b('0x68')]({'where':{'id':_0x2c8c98['params']['id']}})[_0xba3b('0x1f')](handleEntityNotFound(_0xaf6419,null))['then'](function(_0x4891d6){if(_0x4891d6){_0x419fff['model']=_['keys'](db[_0xba3b('0x66')]['rawAttributes']);_0x419fff[_0xba3b('0x42')]=_['keys'](_0x2c8c98[_0xba3b('0x42')]);_0x419fff[_0xba3b('0x44')]=_['intersection'](_0x419fff['model'],_0x419fff[_0xba3b('0x42')]);_0x2087eb[_0xba3b('0x47')]=_[_0xba3b('0x45')](_0x419fff['model'],qs[_0xba3b('0x46')](_0x2c8c98[_0xba3b('0x42')][_0xba3b('0x46')]));_0x2087eb[_0xba3b('0x47')]=_0x2087eb['attributes'][_0xba3b('0x57')]?_0x2087eb['attributes']:_0x419fff['model'];if(!_0x2c8c98[_0xba3b('0x42')][_0xba3b('0x48')](_0xba3b('0x49'))){_0x2087eb[_0xba3b('0x30')]=qs['limit'](_0x2c8c98[_0xba3b('0x42')][_0xba3b('0x30')]);_0x2087eb[_0xba3b('0x2e')]=qs[_0xba3b('0x2e')](_0x2c8c98[_0xba3b('0x42')][_0xba3b('0x2e')]);}_0x2087eb[_0xba3b('0x4a')]=qs[_0xba3b('0x4b')](_0x2c8c98['query'][_0xba3b('0x4b')]);_0x2087eb[_0xba3b('0x4c')]=qs['filters'](_[_0xba3b('0x4d')](_0x2c8c98[_0xba3b('0x42')],_0x419fff['filters']));_0x2087eb[_0xba3b('0x4c')][_0xba3b('0x65')]=_0x4891d6['id'];if(_0x2c8c98[_0xba3b('0x42')]['filter']){_0x2087eb[_0xba3b('0x4c')]=_[_0xba3b('0x4f')](_0x2087eb[_0xba3b('0x4c')],{'$or':_[_0xba3b('0x3c')](_0x2087eb[_0xba3b('0x47')],function(_0x5853f3){var _0x14a457={};_0x14a457[_0x5853f3]={'$like':'%'+_0x2c8c98[_0xba3b('0x42')][_0xba3b('0x4e')]+'%'};return _0x14a457;})});}_0x2087eb=_[_0xba3b('0x4f')]({},_0x2087eb,_0x2c8c98[_0xba3b('0x50')]);return db[_0xba3b('0x66')][_0xba3b('0x31')]({'where':_0x2087eb[_0xba3b('0x4c')]})[_0xba3b('0x1f')](function(_0x5defc2){_0x117d06[_0xba3b('0x31')]=_0x5defc2;if(_0x2c8c98['query']['includeAll']){_0x2087eb[_0xba3b('0x58')]=[{'all':!![]}];}return db[_0xba3b('0x66')]['findAll'](_0x2087eb);})[_0xba3b('0x1f')](function(_0x392daf){_0x117d06['rows']=_0x392daf;return _0x117d06;});}})['then'](respondWithFilteredResult(_0xaf6419,_0x2087eb))[_0xba3b('0x29')](handleError(_0xaf6419,null));};exports['removeDispositions']=function(_0x3e7540,_0x1ff94f,_0x3edf34){return db['WhatsappAccount'][_0xba3b('0x59')]({'where':{'id':_0x3e7540['params']['id']}})[_0xba3b('0x1f')](handleEntityNotFound(_0x1ff94f,null))['then'](function(_0x39ad93){if(_0x39ad93){return _0x39ad93[_0xba3b('0x69')](_0x3e7540[_0xba3b('0x42')][_0xba3b('0x6a')]);}})[_0xba3b('0x1f')](respondWithStatusCode(_0x1ff94f,null))['catch'](handleError(_0x1ff94f,null));};exports['addAnswer']=function(_0x2fa162,_0x4a28b6,_0x383fee){if(_0x2fa162[_0xba3b('0x5b')]['id']){delete _0x2fa162[_0xba3b('0x5b')]['id'];}return db[_0xba3b('0x3d')][_0xba3b('0x59')]({'where':{'id':_0x2fa162[_0xba3b('0x54')]['id']}})[_0xba3b('0x1f')](handleEntityNotFound(_0x4a28b6,null))[_0xba3b('0x1f')](function(_0x168c38){if(_0x168c38){_0x2fa162[_0xba3b('0x5b')][_0xba3b('0x65')]=_0x168c38['id'];return db[_0xba3b('0x6b')][_0xba3b('0x5a')](_0x2fa162[_0xba3b('0x5b')]);}})[_0xba3b('0x1f')](respondWithResult(_0x4a28b6,null))['catch'](handleError(_0x4a28b6,null));};exports['getAnswers']=function(_0x484a14,_0x3913a0,_0x494cc7){var _0x3e2b08={'raw':![],'where':{}};var _0x1a574e={};var _0x2e8e84={'count':0x0,'rows':[]};return db[_0xba3b('0x3d')][_0xba3b('0x68')]({'where':{'id':_0x484a14[_0xba3b('0x54')]['id']}})[_0xba3b('0x1f')](handleEntityNotFound(_0x3913a0,null))[_0xba3b('0x1f')](function(_0x328dd5){if(_0x328dd5){_0x1a574e['model']=_[_0xba3b('0x43')](db[_0xba3b('0x6b')][_0xba3b('0x56')]);_0x1a574e['query']=_[_0xba3b('0x43')](_0x484a14['query']);_0x1a574e[_0xba3b('0x44')]=_[_0xba3b('0x45')](_0x1a574e[_0xba3b('0x41')],_0x1a574e[_0xba3b('0x42')]);_0x3e2b08['attributes']=_['intersection'](_0x1a574e[_0xba3b('0x41')],qs['fields'](_0x484a14[_0xba3b('0x42')][_0xba3b('0x46')]));_0x3e2b08['attributes']=_0x3e2b08[_0xba3b('0x47')][_0xba3b('0x57')]?_0x3e2b08[_0xba3b('0x47')]:_0x1a574e[_0xba3b('0x41')];if(!_0x484a14[_0xba3b('0x42')][_0xba3b('0x48')](_0xba3b('0x49'))){_0x3e2b08['limit']=qs[_0xba3b('0x30')](_0x484a14[_0xba3b('0x42')][_0xba3b('0x30')]);_0x3e2b08['offset']=qs[_0xba3b('0x2e')](_0x484a14['query'][_0xba3b('0x2e')]);}_0x3e2b08[_0xba3b('0x4a')]=qs['sort'](_0x484a14[_0xba3b('0x42')][_0xba3b('0x4b')]);_0x3e2b08['where']=qs['filters'](_[_0xba3b('0x4d')](_0x484a14[_0xba3b('0x42')],_0x1a574e[_0xba3b('0x44')]));_0x3e2b08[_0xba3b('0x4c')][_0xba3b('0x65')]=_0x328dd5['id'];if(_0x484a14[_0xba3b('0x42')][_0xba3b('0x4e')]){_0x3e2b08[_0xba3b('0x4c')]=_[_0xba3b('0x4f')](_0x3e2b08[_0xba3b('0x4c')],{'$or':_['map'](_0x3e2b08[_0xba3b('0x47')],function(_0x455ea1){var _0x2da581={};_0x2da581[_0x455ea1]={'$like':'%'+_0x484a14[_0xba3b('0x42')][_0xba3b('0x4e')]+'%'};return _0x2da581;})});}_0x3e2b08=_[_0xba3b('0x4f')]({},_0x3e2b08,_0x484a14[_0xba3b('0x50')]);return db['CannedAnswer'][_0xba3b('0x31')]({'where':_0x3e2b08['where']})['then'](function(_0x51357a){_0x2e8e84[_0xba3b('0x31')]=_0x51357a;if(_0x484a14[_0xba3b('0x42')]['includeAll']){_0x3e2b08['include']=[{'all':!![]}];}return db[_0xba3b('0x6b')]['findAll'](_0x3e2b08);})[_0xba3b('0x1f')](function(_0x5750ce){_0x2e8e84[_0xba3b('0x6c')]=_0x5750ce;return _0x2e8e84;});}})['then'](respondWithFilteredResult(_0x3913a0,_0x3e2b08))[_0xba3b('0x29')](handleError(_0x3913a0,null));};exports[_0xba3b('0x6d')]=function(_0x5f4135,_0x5b1f22,_0x18c32a){return db['WhatsappAccount'][_0xba3b('0x59')]({'where':{'id':_0x5f4135[_0xba3b('0x54')]['id']}})[_0xba3b('0x1f')](handleEntityNotFound(_0x5b1f22,null))['then'](function(_0x24163d){if(_0x24163d){return _0x24163d[_0xba3b('0x6d')](_0x5f4135[_0xba3b('0x42')]['ids']);}})[_0xba3b('0x1f')](respondWithStatusCode(_0x5b1f22,null))['catch'](handleError(_0x5b1f22,null));};exports[_0xba3b('0x6e')]=function(_0x58b116,_0x552eee,_0x417236){return db[_0xba3b('0x3d')][_0xba3b('0x59')]({'where':{'id':_0x58b116['params']['id']}})['then'](handleEntityNotFound(_0x552eee,null))[_0xba3b('0x1f')](function(_0x35debb){if(_0x35debb){return _0x35debb[_0xba3b('0x6e')](_0x58b116[_0xba3b('0x5b')][_0xba3b('0x6a')],_[_0xba3b('0x6f')](_0x58b116[_0xba3b('0x5b')],[_0xba3b('0x6a'),'id'])||{})['spread'](function(_0x1b0830){for(var _0x4fe80b=0x0;_0x4fe80b<_0x58b116['body']['ids']['length'];_0x4fe80b+=0x1){socket['emit'](_0xba3b('0x70'),{'UserId':Number(_0x58b116[_0xba3b('0x5b')][_0xba3b('0x6a')][_0x4fe80b]),'WhatsappAccountId':Number(_0x58b116[_0xba3b('0x54')]['id'])});}return _0x1b0830;});}})[_0xba3b('0x1f')](respondWithResult(_0x552eee,null))[_0xba3b('0x29')](handleError(_0x552eee,null));};exports['removeAgents']=function(_0x33f5ca,_0x50a7a4,_0x16b7b2){return db[_0xba3b('0x3d')]['find']({'where':{'id':_0x33f5ca[_0xba3b('0x54')]['id']}})[_0xba3b('0x1f')](handleEntityNotFound(_0x50a7a4,null))['then'](function(_0x508560){if(_0x508560){return _0x508560[_0xba3b('0x71')](_0x33f5ca[_0xba3b('0x42')][_0xba3b('0x6a')])['then'](function(){if(_[_0xba3b('0x72')](_0x33f5ca[_0xba3b('0x42')][_0xba3b('0x6a')])){for(var _0x19731f=0x0;_0x19731f<_0x33f5ca[_0xba3b('0x42')][_0xba3b('0x6a')]['length'];_0x19731f+=0x1){socket['emit'](_0xba3b('0x73'),{'UserId':Number(_0x33f5ca[_0xba3b('0x42')][_0xba3b('0x6a')][_0x19731f]),'WhatsappAccountId':Number(_0x33f5ca[_0xba3b('0x54')]['id'])});}}else{socket[_0xba3b('0x74')](_0xba3b('0x73'),{'UserId':Number(_0x33f5ca[_0xba3b('0x42')][_0xba3b('0x6a')]),'WhatsappAccountId':Number(_0x33f5ca[_0xba3b('0x54')]['id'])});}});}})[_0xba3b('0x1f')](respondWithStatusCode(_0x50a7a4,null))[_0xba3b('0x29')](handleError(_0x50a7a4,null));};exports[_0xba3b('0x75')]=function(_0x3cb9ab,_0x2a7077,_0xd04127){var _0x278868={};var _0x2d7094={};var _0x3acd79;var _0x598b29;return db[_0xba3b('0x3d')]['findOne']({'where':{'id':_0x3cb9ab[_0xba3b('0x54')]['id']}})[_0xba3b('0x1f')](handleEntityNotFound(_0x2a7077,null))[_0xba3b('0x1f')](function(_0x3ff130){if(_0x3ff130){_0x3acd79=_0x3ff130;_0x2d7094['model']=_[_0xba3b('0x43')](db['User']['rawAttributes']);_0x2d7094[_0xba3b('0x42')]=_[_0xba3b('0x43')](_0x3cb9ab[_0xba3b('0x42')]);_0x2d7094[_0xba3b('0x44')]=_['intersection'](_0x2d7094[_0xba3b('0x41')],_0x2d7094[_0xba3b('0x42')]);_0x278868[_0xba3b('0x47')]=_[_0xba3b('0x45')](_0x2d7094[_0xba3b('0x41')],qs[_0xba3b('0x46')](_0x3cb9ab[_0xba3b('0x42')]['fields']));_0x278868[_0xba3b('0x47')]=_0x278868[_0xba3b('0x47')][_0xba3b('0x57')]?_0x278868[_0xba3b('0x47')]:_0x2d7094['model'];_0x278868[_0xba3b('0x4a')]=qs[_0xba3b('0x4b')](_0x3cb9ab[_0xba3b('0x42')][_0xba3b('0x4b')]);_0x278868[_0xba3b('0x4c')]=qs[_0xba3b('0x44')](_[_0xba3b('0x4d')](_0x3cb9ab[_0xba3b('0x42')],_0x2d7094['filters']));if(_0x3cb9ab['query'][_0xba3b('0x4e')]){_0x278868[_0xba3b('0x4c')]=_[_0xba3b('0x4f')](_0x278868[_0xba3b('0x4c')],{'$or':_[_0xba3b('0x3c')](_0x278868[_0xba3b('0x47')],function(_0x579204){var _0x417a79={};_0x417a79[_0x579204]={'$like':'%'+_0x3cb9ab[_0xba3b('0x42')][_0xba3b('0x4e')]+'%'};return _0x417a79;})});}_0x278868=_[_0xba3b('0x4f')]({},_0x278868,_0x3cb9ab[_0xba3b('0x50')]);return _0x3acd79[_0xba3b('0x75')](_0x278868);}})['then'](function(_0x759fee){if(_0x759fee){_0x598b29=_0x759fee['length'];if(!_0x3cb9ab[_0xba3b('0x42')][_0xba3b('0x48')](_0xba3b('0x49'))){_0x278868[_0xba3b('0x30')]=qs[_0xba3b('0x30')](_0x3cb9ab[_0xba3b('0x42')]['limit']);_0x278868[_0xba3b('0x2e')]=qs[_0xba3b('0x2e')](_0x3cb9ab[_0xba3b('0x42')][_0xba3b('0x2e')]);}return _0x3acd79[_0xba3b('0x75')](_0x278868);}})['then'](function(_0x618e01){if(_0x618e01){return _0x618e01?{'count':_0x598b29,'rows':_0x618e01}:null;}})['then'](respondWithResult(_0x2a7077,null))[_0xba3b('0x29')](handleError(_0x2a7077,null));};exports[_0xba3b('0x76')]=function(_0x3e2ad7,_0xe8ef06){var _0x428ae4=_0x3e2ad7[_0xba3b('0x54')]['id'];var _0x8bae4b=_0x3e2ad7[_0xba3b('0x5b')];var _0x2896e5=0xc8;var _0x212bb6=null;return db['sequelize'][_0xba3b('0x77')]({'isolationLevel':db[_0xba3b('0x78')][_0xba3b('0x79')][_0xba3b('0x7a')][_0xba3b('0x7b')]},function(_0x2c3534){return db['WhatsappAccount']['findOne']({'where':{'id':_0x428ae4},'transaction':_0x2c3534})[_0xba3b('0x1f')](function(_0x56599c){if(_0x56599c){return db[_0xba3b('0x7c')][_0xba3b('0x36')]({'where':{'WhatsappAccountId':_0x428ae4},'transaction':_0x2c3534})[_0xba3b('0x1f')](function(){var _0x594b06=_[_0xba3b('0x3c')](_0x8bae4b,function(_0x209234){_0x209234['WhatsappAccountId']=_0x428ae4;return _0x209234;});return db[_0xba3b('0x7c')][_0xba3b('0x7d')](_0x594b06,{'transaction':_0x2c3534});});}else{_0x2896e5=0x194;_0x212bb6=[];}});})['then'](function(){if(_0x2896e5!==0x194){return db[_0xba3b('0x7c')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x428ae4},'order':'priority'})['then'](function(_0xdc944){_0x212bb6=_0xdc944;});}})[_0xba3b('0x29')](function(_0x373737){_0x2896e5=0x1f4;logger['error'](_0x373737[_0xba3b('0x38')]);if(_0x373737[_0xba3b('0x39')]){delete _0x373737[_0xba3b('0x39')];}_0x212bb6=_0x373737;})['finally'](function(){if(_0x212bb6===null){_0xe8ef06[_0xba3b('0x2a')](_0x2896e5);}else{if(_0x2896e5===0x1f4){_0xe8ef06['status'](_0x2896e5)[_0xba3b('0x7e')](_0x212bb6);}else{_0xe8ef06[_0xba3b('0x2b')](_0x2896e5)[_0xba3b('0x2d')](_0x212bb6);}}});};exports[_0xba3b('0x7f')]=function(_0x4f490e,_0x357dfb,_0x5f51b3){var _0x274866={};var _0x43f7d9={};var _0x31e5f4;var _0x5e9ec6;return db[_0xba3b('0x3d')][_0xba3b('0x68')]({'where':{'id':_0x4f490e[_0xba3b('0x54')]['id']}})['then'](handleEntityNotFound(_0x357dfb,null))[_0xba3b('0x1f')](function(_0x1aed44){if(_0x1aed44){_0x31e5f4=_0x1aed44;_0x43f7d9[_0xba3b('0x41')]=_['keys'](db[_0xba3b('0x7c')]['rawAttributes']);_0x43f7d9['query']=_[_0xba3b('0x43')](_0x4f490e[_0xba3b('0x42')]);_0x43f7d9[_0xba3b('0x44')]=_['intersection'](_0x43f7d9[_0xba3b('0x41')],_0x43f7d9['query']);_0x274866[_0xba3b('0x47')]=_[_0xba3b('0x45')](_0x43f7d9[_0xba3b('0x41')],qs['fields'](_0x4f490e[_0xba3b('0x42')][_0xba3b('0x46')]));_0x274866[_0xba3b('0x47')]=_0x274866['attributes'][_0xba3b('0x57')]?_0x274866[_0xba3b('0x47')]:_0x43f7d9[_0xba3b('0x41')];_0x274866[_0xba3b('0x4a')]=qs[_0xba3b('0x4b')](_0x4f490e[_0xba3b('0x42')][_0xba3b('0x4b')]);_0x274866['where']=qs['filters'](_['pick'](_0x4f490e[_0xba3b('0x42')],_0x43f7d9[_0xba3b('0x44')]));if(_0x4f490e[_0xba3b('0x42')]['filter']){_0x274866['where']=_[_0xba3b('0x4f')](_0x274866[_0xba3b('0x4c')],{'$or':_[_0xba3b('0x3c')](_0x274866[_0xba3b('0x47')],function(_0x54d889){var _0x3d37d7={};_0x3d37d7[_0x54d889]={'$like':'%'+_0x4f490e['query'][_0xba3b('0x4e')]+'%'};return _0x3d37d7;})});}_0x274866=_[_0xba3b('0x4f')]({},_0x274866,_0x4f490e['options']);return _0x31e5f4['getApplications'](_0x274866);}})[_0xba3b('0x1f')](function(_0x43205d){if(_0x43205d){_0x5e9ec6=_0x43205d['length'];if(!_0x4f490e[_0xba3b('0x42')]['hasOwnProperty'](_0xba3b('0x49'))){_0x274866[_0xba3b('0x30')]=qs['limit'](_0x4f490e[_0xba3b('0x42')]['limit']);_0x274866['offset']=qs[_0xba3b('0x2e')](_0x4f490e['query'][_0xba3b('0x2e')]);}return _0x31e5f4[_0xba3b('0x7f')](_0x274866);}})[_0xba3b('0x1f')](function(_0x41cc28){if(_0x41cc28){return _0x41cc28?{'count':_0x5e9ec6,'rows':_0x41cc28}:null;}})[_0xba3b('0x1f')](respondWithResult(_0x357dfb,null))[_0xba3b('0x29')](handleError(_0x357dfb,null));};exports[_0xba3b('0x80')]=function(_0x48928e,_0x15a1ac,_0x162ba0){var _0x3fa549={'channel':_0xba3b('0x81')};var _0x43b0cd=[];var _0xecb561=[];var _0x4e6911={};return db[_0xba3b('0x3d')][_0xba3b('0x59')]({'where':{'id':_0x48928e[_0xba3b('0x54')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xba3b('0x82')}]})['then'](handleEntityNotFound(_0x15a1ac,null))[_0xba3b('0x1f')](function(_0x4e3c09){_0x3fa549['account']=_0x4e3c09;if(_0x3fa549[_0xba3b('0x83')]&&_0x3fa549[_0xba3b('0x83')][_0xba3b('0x3f')]===_0xba3b('0x84')&&_0x48928e[_0xba3b('0x5b')][_0xba3b('0x85')]){if(_0x48928e[_0xba3b('0x5b')][_0xba3b('0x85')][_0xba3b('0x57')]===0x0)return;if(_0x48928e[_0xba3b('0x5b')]['statuses'][0x0][_0xba3b('0x86')]!==_0xba3b('0x87'))return;return db[_0xba3b('0x88')][_0xba3b('0x35')]({'read':!![],'readAt':_0x48928e['body'][_0xba3b('0x85')][0x0][_0xba3b('0x89')]},{'where':{'messageId':_0x48928e[_0xba3b('0x5b')][_0xba3b('0x85')][0x0][_0xba3b('0x8a')]},'individualHooks':!![]})[_0xba3b('0x1f')](function(_0x10c9a8){return _0x15a1ac['status'](0xc8)['json'](_0x10c9a8);});}_0x3fa549[_0xba3b('0x8b')]=_[_0xba3b('0x8c')](_0x4e3c09['Applications'],[_0xba3b('0x8d')],[_0xba3b('0x8e')]);if(_0x3fa549['account'][_0xba3b('0x82')]){delete _0x3fa549[_0xba3b('0x83')]['Applications'];}return db['CmContact'][_0xba3b('0x63')]()[_0xba3b('0x1f')](function(_0x42e657){if(!_0x42e657){throw new db[(_0xba3b('0x8f'))][(_0xba3b('0x90'))](_0xba3b('0x91'));}_0x43b0cd=_['difference'](_[_0xba3b('0x43')](_0x42e657),[_0xba3b('0x92'),_0xba3b('0x93')]);_0xecb561=_[_0xba3b('0x94')](_[_0xba3b('0x43')](_0x42e657),[_0xba3b('0x92'),'updatedAt',_0xba3b('0x95'),_0xba3b('0x96')]);_0x3fa549['body']={'mapKey':_0xba3b('0x97')};if(_0x3fa549['account']&&_0x3fa549[_0xba3b('0x83')][_0xba3b('0x3f')]===_0xba3b('0x98')){_0x3fa549[_0xba3b('0x5b')][_0xba3b('0x99')]=_0x48928e[_0xba3b('0x5b')]['From'][_0xba3b('0x9a')](_0xba3b('0x9b'),'');_0x3fa549['body']['body']=_0x48928e['body'][_0xba3b('0x9c')];_0x3fa549[_0xba3b('0x5b')][_0xba3b('0x9d')]=_0x48928e[_0xba3b('0x5b')][_0xba3b('0x9e')];}if(_0x3fa549['account']&&_0x3fa549[_0xba3b('0x83')][_0xba3b('0x3f')]===_0xba3b('0x84')){_0x3fa549[_0xba3b('0x5b')][_0xba3b('0x99')]=_0x48928e['body'][_0xba3b('0x9f')][0x0]['from'];_0x3fa549[_0xba3b('0x5b')][_0xba3b('0x5b')]=_0x48928e[_0xba3b('0x5b')]['notifications'][0x0][_0xba3b('0x27')][_0xba3b('0x5b')];_0x3fa549[_0xba3b('0x5b')]['messageId']=_0x48928e[_0xba3b('0x5b')]['notifications'][0x0][_0xba3b('0x8a')];}if(_0x3fa549[_0xba3b('0x5b')]['id']){delete _0x3fa549[_0xba3b('0x5b')]['id'];}if(_[_0xba3b('0xa0')](_0x3fa549[_0xba3b('0x5b')][_0xba3b('0x99')])){throw new db[(_0xba3b('0x8f'))][(_0xba3b('0x90'))]('from\x20is\x20mandatory');}if(_[_0xba3b('0xa0')](_0x3fa549[_0xba3b('0x5b')][_0xba3b('0x5b')])||_0x3fa549[_0xba3b('0x5b')][_0xba3b('0x5b')]===''){throw new db[(_0xba3b('0x8f'))][(_0xba3b('0x90'))](_0xba3b('0xa1'));}if(_[_0xba3b('0xa0')](_0x3fa549[_0xba3b('0x5b')]['mapKey'])){throw new db['Sequelize'][(_0xba3b('0x90'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xecb561);}if(!_['includes'](_0xecb561,_0x3fa549[_0xba3b('0x5b')][_0xba3b('0xa2')])){throw new db['Sequelize'][(_0xba3b('0x90'))](_0xba3b('0xa3')+_0xecb561);}_0x4e6911[_0x3fa549[_0xba3b('0x5b')][_0xba3b('0xa2')]]=_0x3fa549['body'][_0xba3b('0x99')];return db[_0xba3b('0xa4')][_0xba3b('0x59')]({'where':{'id':_0x3fa549[_0xba3b('0x83')][_0xba3b('0x96')]},'include':[{'model':db['CmContact'],'as':_0xba3b('0xa5'),'where':_0x4e6911,'limit':0x1,'order':[[_0xba3b('0x93'),_0xba3b('0xa6')]]}]});})[_0xba3b('0x1f')](handleEntityNotFound(_0x15a1ac,null))['then'](function(_0x6400d3){if(_0x6400d3){_0x3fa549['list']=_[_0xba3b('0x6f')](_0x6400d3,[_0xba3b('0xa5')]);if(_0x6400d3['Contacts'][_0xba3b('0x57')]){return _0x6400d3[_0xba3b('0xa5')][0x0];}var _0x360de1=_['defaults'](_0x3fa549['body'],{'firstName':_0x3fa549[_0xba3b('0x5b')]['from'],'ListId':_0x6400d3['id']});_0x360de1[_0x3fa549[_0xba3b('0x5b')][_0xba3b('0xa2')]]=_0x3fa549['body'][_0xba3b('0x99')];return db[_0xba3b('0xa7')][_0xba3b('0x5a')](_0x360de1,{'fields':_0x43b0cd,'raw':!![]});}})[_0xba3b('0x1f')](handleEntityNotFound(_0x15a1ac,null))['then'](function(_0x4d2956){if(_0x4d2956){_0x3fa549['contact']=_0x4d2956;var _0x588208={'ContactId':_0x4d2956['id'],'phone':_0x3fa549[_0xba3b('0x5b')][_0xba3b('0x99')],'WhatsappAccountId':_0x48928e[_0xba3b('0x54')]['id']};var _0x4a9b2d={'ContactId':_0x4d2956['id'],'WhatsappAccountId':_0x48928e[_0xba3b('0x54')]['id'],'closed':![]};return db[_0xba3b('0xa8')]['find']({'where':_0x4a9b2d})[_0xba3b('0x1f')](function(_0x1a18ce){if(_0x1a18ce){return[_0x1a18ce,![]];}return db[_0xba3b('0xa8')][_0xba3b('0x5a')](_0x588208)[_0xba3b('0x1f')](function(_0xd850d4){return[_0xd850d4,!![]];});});}})[_0xba3b('0xa9')](function(_0x320772,_0x166c94){_0x3fa549['interaction']=_0x320772[_0xba3b('0x5c')]({'plain':!![]});_0x3fa549[_0xba3b('0xaa')][_0xba3b('0xab')]=![];if(_0x166c94){if(_0x3fa549['account']['autoclose']){_0x3fa549[_0xba3b('0x8b')][_0xba3b('0xac')]({'id':0x0,'priority':_0x3fa549[_0xba3b('0x8b')][_0xba3b('0x57')]+0x1,'app':_0xba3b('0xad'),'appdata':_0xba3b('0xae'),'interval':_0xba3b('0xaf')});}_0x3fa549['interaction'][_0xba3b('0xab')]=!![];}return db['WhatsappMessage'][_0xba3b('0x5a')]({'phone':_0x3fa549['body'][_0xba3b('0x99')],'messageId':_0x3fa549['body'][_0xba3b('0x9d')],'body':_0x3fa549[_0xba3b('0x5b')][_0xba3b('0x5b')],'WhatsappAccountId':_0x48928e[_0xba3b('0x54')]['id'],'WhatsappInteractionId':_0x320772['id'],'direction':'in','ContactId':_0x320772[_0xba3b('0xb0')],'AttachmentId':_0x3fa549['body']['AttachmentId']});})[_0xba3b('0x1f')](function(_0x3e077a){_0x3fa549[_0xba3b('0x27')]=_0x3e077a;if(!_0x3fa549['interaction']['UserId'])return;return db[_0xba3b('0xb1')][_0xba3b('0x59')]({'attributes':['id',_0xba3b('0x39')],'where':{'id':_0x3fa549[_0xba3b('0xaa')]['UserId']}});})[_0xba3b('0x1f')](function(_0x44fdfa){if(_0x44fdfa){_0x3fa549[_0xba3b('0x8b')][_0xba3b('0xb2')]({'id':0x0,'priority':0x0,'app':_0xba3b('0xb3'),'appdata':_0x44fdfa['name']+','+(_0x3fa549[_0xba3b('0x83')][_0xba3b('0xb4')]||0xa),'interval':'*,*,*,*'});}if(!_0x3fa549['interaction'][_0xba3b('0xb5')])return;return db[_0xba3b('0xb6')][_0xba3b('0x59')]({'attributes':['id',_0xba3b('0x39')],'where':{'id':_0x3fa549[_0xba3b('0xaa')]['queueId']}});})['then'](function(_0x456b93){if(_0x456b93){_0x3fa549[_0xba3b('0x8b')][_0xba3b('0xb2')]({'id':0x0,'priority':0x1,'app':_0xba3b('0xb7'),'appdata':_0x456b93[_0xba3b('0x39')]+','+(_0x3fa549[_0xba3b('0x83')][_0xba3b('0xb8')]||0x12c),'interval':_0xba3b('0xaf')});}return respondWithRpcPromise(_0xba3b('0xb9'),_0xba3b('0xba'),_0x3fa549);})['then'](function(_0x2c2a90){if(_0x2c2a90){var _0x3ae191=0xc8;var _0x6fc091=_0xba3b('0xbb');logger[_0xba3b('0x20')](_0xba3b('0xbc'),_0x6fc091,_0x3ae191,'entity\x20found');logger[_0xba3b('0x22')](_0xba3b('0xbd'),_0x6fc091,_0x3ae191,_0xba3b('0xbe'),JSON['stringify'](_0x2c2a90));if(_0x3fa549['account']['type']===_0xba3b('0x98')){return _0x15a1ac[_0xba3b('0x2b')](_0x3ae191)[_0xba3b('0xbf')](_0xba3b('0xc0'),'text/xml')[_0xba3b('0x7e')](_0xba3b('0xc1'));}else{return _0x15a1ac['status'](_0x3ae191)['json'](_0x2c2a90);}}});})[_0xba3b('0x29')](handleError(_0x15a1ac,null));};exports[_0xba3b('0x7e')]=function(_0x482a2f,_0x336857,_0xbfaa20){var _0x574564,_0x2e7bf6,_0x16de10;if(_['isNil'](_0x482a2f['body']['body'])||_0x482a2f[_0xba3b('0x5b')][_0xba3b('0x5b')]===''){throw new db[(_0xba3b('0x8f'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xba3b('0xa0')](_0x482a2f[_0xba3b('0x5b')]['to'])){throw new db[(_0xba3b('0x8f'))][(_0xba3b('0x90'))](_0xba3b('0xc2'));}_0x574564=_0x482a2f['body']['to'];return db[_0xba3b('0x3d')][_0xba3b('0x59')]({'where':{'id':_0x482a2f[_0xba3b('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0xba3b('0xc3'),'include':[{'model':db['CmContact'],'as':_0xba3b('0xa5'),'where':{'mobile':_0x574564},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xba3b('0x1f')](handleEntityNotFound(_0x336857,null))['then'](function(_0x4326e0){if(_0x4326e0&&_0x4326e0[_0xba3b('0xc3')]){_0x2e7bf6=_0x4326e0[_0xba3b('0x5c')]({'plain':!![]});if(_0x2e7bf6[_0xba3b('0xc3')]&&_0x2e7bf6['List'][_0xba3b('0xa5')][_0xba3b('0x57')]){return _0x2e7bf6[_0xba3b('0xc3')][_0xba3b('0xa5')][0x0];}return db[_0xba3b('0xa7')][_0xba3b('0x5a')](_['defaults'](_0x482a2f[_0xba3b('0x5b')],{'firstName':_0x574564,'mobile':_0x574564,'phone':_0x574564,'ListId':_0x2e7bf6[_0xba3b('0x96')]}));}})[_0xba3b('0x1f')](handleEntityNotFound(_0x336857,null))[_0xba3b('0x1f')](function(_0xb8b739){if(_0xb8b739){_0x16de10=_0xb8b739;return db['WhatsappInteraction'][_0xba3b('0x59')]({'where':{'ContactId':_0x16de10['id'],'closed':![],'WhatsappAccountId':_0x2e7bf6['id']}})[_0xba3b('0x1f')](function(_0x480959){if(_0x480959){return[_0x480959,![]];}return db[_0xba3b('0xa8')]['create']({'UserId':_0x482a2f[_0xba3b('0x5f')]['id'],'ContactId':_0x16de10['id'],'WhatsappAccountId':_0x2e7bf6['id'],'phone':_0x574564,'firstMsgDirection':_0xba3b('0xc4'),'Messages':[_[_0xba3b('0x4f')](_0x482a2f[_0xba3b('0x5b')],{'read':![],'body':_0x482a2f['body'][_0xba3b('0x5b')],'phone':_0x574564,'WhatsappAccountId':_0x2e7bf6['id'],'UserId':_0x482a2f[_0xba3b('0x5f')]['id'],'ContactId':_0x16de10['id']})]},{'include':[{'model':db[_0xba3b('0x88')],'as':_0xba3b('0xc5')}]})[_0xba3b('0x1f')](function(_0xdf5c8f){return[_0xdf5c8f,!![]];});});}})[_0xba3b('0xa9')](function(_0x539e5,_0x25d101){if(_0x25d101){return _0x539e5;}return db['WhatsappMessage'][_0xba3b('0x5a')](_[_0xba3b('0x4f')](_0x482a2f[_0xba3b('0x5b')],{'read':![],'body':_0x482a2f[_0xba3b('0x5b')][_0xba3b('0x5b')],'phone':_0x574564,'WhatsappAccountId':_0x2e7bf6['id'],'WhatsappInteractionId':_0x539e5['id'],'UserId':_0x482a2f[_0xba3b('0x5f')]['id'],'ContactId':_0x16de10['id']}))[_0xba3b('0x1f')](function(_0x54f8f4){_0x539e5[_0xba3b('0xc6')]['Messages']=[];_0x539e5[_0xba3b('0xc6')][_0xba3b('0xc5')][_0xba3b('0xac')](_0x54f8f4[_0xba3b('0xc6')]);return _0x539e5;});})[_0xba3b('0x1f')](respondWithResult(_0x336857,null))[_0xba3b('0x29')](handleError(_0x336857,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index b0aa740..fcb8e97 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 _0x5ee5=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','WhatsappAccount'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x5ee5,0x8a));var _0x55ee=function(_0x590766,_0x26a057){_0x590766=_0x590766-0x0;var _0x4e2f10=_0x5ee5[_0x590766];return _0x4e2f10;};'use strict';var EventEmitter=require(_0x55ee('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x55ee('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x55ee('0x2')](0x0);var events={'afterCreate':_0x55ee('0x3'),'afterUpdate':_0x55ee('0x4'),'afterDestroy':_0x55ee('0x5')};function emitEvent(_0x57670d){return function(_0x3a3aa6,_0xf241f7,_0x5c6274){WhatsappAccountEvents['emit'](_0x57670d+':'+_0x3a3aa6['id'],_0x3a3aa6);WhatsappAccountEvents[_0x55ee('0x6')](_0x57670d,_0x3a3aa6);_0x5c6274(null);};}for(var e in events){if(events[_0x55ee('0x7')](e)){var event=events[e];WhatsappAccount[_0x55ee('0x8')](e,emitEvent(event));}}module[_0x55ee('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0xe699=['exports','WhatsappAccount','update','emit','hook'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe699,0x196));var _0x9e69=function(_0x578ad1,_0xea6285){_0x578ad1=_0x578ad1-0x0;var _0xc5da22=_0xe699[_0x578ad1];return _0xc5da22;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0x9e69('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9e69('0x1'),'afterDestroy':'remove'};function emitEvent(_0x24f8c2){return function(_0x17bf53,_0x27c907,_0x3dc942){WhatsappAccountEvents['emit'](_0x24f8c2+':'+_0x17bf53['id'],_0x17bf53);WhatsappAccountEvents[_0x9e69('0x2')](_0x24f8c2,_0x17bf53);_0x3dc942(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x9e69('0x3')](e,emitEvent(event));}}module[_0x9e69('0x4')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index a82ebca..0543b5f 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 _0xb8b0=['whatsapp_accounts','util','api','path','rimraf','./whatsappAccount.attributes','exports','define'];(function(_0x18531b,_0x4a4bdc){var _0x14ebc4=function(_0x31c1fd){while(--_0x31c1fd){_0x18531b['push'](_0x18531b['shift']());}};_0x14ebc4(++_0x4a4bdc);}(_0xb8b0,0xe1));var _0x0b8b=function(_0x4bafac,_0x4ab088){_0x4bafac=_0x4bafac-0x0;var _0x2f706b=_0xb8b0[_0x4bafac];return _0x2f706b;};'use strict';var _=require('lodash');var util=require(_0x0b8b('0x0'));var logger=require('../../config/logger')(_0x0b8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b8b('0x2'));var rimraf=require(_0x0b8b('0x3'));var config=require('../../config/environment');var attributes=require(_0x0b8b('0x4'));module[_0x0b8b('0x5')]=function(_0x158cfd,_0xefdea7){return _0x158cfd[_0x0b8b('0x6')]('WhatsappAccount',attributes,{'tableName':_0x0b8b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81b0=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','util'];(function(_0x5ca155,_0x51629e){var _0x6607ee=function(_0x456b8d){while(--_0x456b8d){_0x5ca155['push'](_0x5ca155['shift']());}};_0x6607ee(++_0x51629e);}(_0x81b0,0x9b));var _0x081b=function(_0x38c023,_0x179998){_0x38c023=_0x38c023-0x0;var _0x278dc9=_0x81b0[_0x38c023];return _0x278dc9;};'use strict';var _=require('lodash');var util=require(_0x081b('0x0'));var logger=require(_0x081b('0x1'))(_0x081b('0x2'));var moment=require(_0x081b('0x3'));var BPromise=require(_0x081b('0x4'));var rp=require(_0x081b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x081b('0x6'));var attributes=require(_0x081b('0x7'));module[_0x081b('0x8')]=function(_0x1f5a1f,_0x451b6c){return _0x1f5a1f[_0x081b('0x9')](_0x081b('0xa'),attributes,{'tableName':_0x081b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 04ad9b0..d3a7703 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 _0x5ff2=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','find','raw','options','attributes','map','include','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5aa20c,_0x28b6ca){var _0x5d0a3a=function(_0x4b6cc8){while(--_0x4b6cc8){_0x5aa20c['push'](_0x5aa20c['shift']());}};_0x5d0a3a(++_0x28b6ca);}(_0x5ff2,0x6e));var _0x25ff=function(_0x5b2155,_0x11bf44){_0x5b2155=_0x5b2155-0x0;var _0x1fd657=_0x5ff2[_0x5b2155];return _0x1fd657;};'use strict';var _=require(_0x25ff('0x0'));var util=require('util');var moment=require(_0x25ff('0x1'));var BPromise=require(_0x25ff('0x2'));var rs=require(_0x25ff('0x3'));var fs=require('fs');var Redis=require(_0x25ff('0x4'));var db=require(_0x25ff('0x5'))['db'];var utils=require(_0x25ff('0x6'));var logger=require(_0x25ff('0x7'))(_0x25ff('0x8'));var config=require(_0x25ff('0x9'));var jayson=require(_0x25ff('0xa'));var client=jayson[_0x25ff('0xb')][_0x25ff('0xc')]({'port':0x232a});config[_0x25ff('0xd')]=_['defaults'](config[_0x25ff('0xd')],{'host':_0x25ff('0xe'),'port':0x18eb});var socket=require(_0x25ff('0xf'))(new Redis(config[_0x25ff('0xd')]));require(_0x25ff('0x10'))[_0x25ff('0x11')](socket);function respondWithRpcPromise(_0x47e1cc,_0x15f659,_0x449dc8){return new BPromise(function(_0x22c1a0,_0x227996){return client[_0x25ff('0x12')](_0x47e1cc,_0x449dc8)[_0x25ff('0x13')](function(_0x576de3){logger[_0x25ff('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x15f659,_0x25ff('0x15'));logger[_0x25ff('0x16')](_0x25ff('0x17'),_0x15f659,'request\x20sent',JSON[_0x25ff('0x18')](_0x576de3));if(_0x576de3['error']){if(_0x576de3[_0x25ff('0x19')][_0x25ff('0x1a')]===0x1f4){logger['error'](_0x25ff('0x1b'),_0x15f659,_0x576de3[_0x25ff('0x19')][_0x25ff('0x1c')]);return _0x227996(_0x576de3[_0x25ff('0x19')][_0x25ff('0x1c')]);}logger[_0x25ff('0x19')](_0x25ff('0x1b'),_0x15f659,_0x576de3[_0x25ff('0x19')][_0x25ff('0x1c')]);return _0x22c1a0(_0x576de3[_0x25ff('0x19')][_0x25ff('0x1c')]);}else{logger[_0x25ff('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x15f659,_0x25ff('0x15'));_0x22c1a0(_0x576de3[_0x25ff('0x1d')][_0x25ff('0x1c')]);}})[_0x25ff('0x1e')](function(_0x186279){logger[_0x25ff('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x15f659,_0x186279);_0x227996(_0x186279);});});}exports[_0x25ff('0x1f')]=function(_0x57376e){var _0x51cda0=this;return new Promise(function(_0x277c2a,_0x134416){return db['WhatsappAccount'][_0x25ff('0x20')]({'raw':_0x57376e['options']?_0x57376e['options'][_0x25ff('0x21')]===undefined?!![]:![]:!![],'where':_0x57376e['options']?_0x57376e[_0x25ff('0x22')]['where']||null:null,'attributes':_0x57376e[_0x25ff('0x22')]?_0x57376e['options'][_0x25ff('0x23')]||null:null,'include':_0x57376e[_0x25ff('0x22')]?_0x57376e[_0x25ff('0x22')]['include']?_[_0x25ff('0x24')](_0x57376e[_0x25ff('0x22')][_0x25ff('0x25')],function(_0x14e804){return{'model':db[_0x14e804['model']],'as':_0x14e804['as'],'attributes':_0x14e804[_0x25ff('0x23')],'include':_0x14e804[_0x25ff('0x25')]?_[_0x25ff('0x24')](_0x14e804[_0x25ff('0x25')],function(_0x17581f){return{'model':db[_0x17581f[_0x25ff('0x26')]],'as':_0x17581f['as'],'attributes':_0x17581f[_0x25ff('0x23')],'include':_0x17581f[_0x25ff('0x25')]?_[_0x25ff('0x24')](_0x17581f[_0x25ff('0x25')],function(_0x2b7779){return{'model':db[_0x2b7779[_0x25ff('0x26')]],'as':_0x2b7779['as'],'attributes':_0x2b7779[_0x25ff('0x23')]};}):[]};}):[]};}):[]:[]})[_0x25ff('0x13')](function(_0x22e60e){logger[_0x25ff('0x14')](_0x25ff('0x1f'),_0x57376e);logger[_0x25ff('0x16')](_0x25ff('0x1f'),_0x57376e,JSON['stringify'](_0x22e60e));_0x277c2a(_0x22e60e);})[_0x25ff('0x1e')](function(_0x56187b){logger[_0x25ff('0x19')](_0x25ff('0x1f'),_0x56187b[_0x25ff('0x1c')],_0x57376e);_0x134416(_0x51cda0[_0x25ff('0x19')](0x1f4,_0x56187b[_0x25ff('0x1c')]));});});}; \ No newline at end of file +var _0x90f1=['attributes','include','map','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x90f1,0xa0));var _0x190f=function(_0x56d6cb,_0x4151c0){_0x56d6cb=_0x56d6cb-0x0;var _0x3f4000=_0x90f1[_0x56d6cb];return _0x3f4000;};'use strict';var _=require(_0x190f('0x0'));var util=require('util');var moment=require(_0x190f('0x1'));var BPromise=require(_0x190f('0x2'));var rs=require(_0x190f('0x3'));var fs=require('fs');var Redis=require(_0x190f('0x4'));var db=require(_0x190f('0x5'))['db'];var utils=require(_0x190f('0x6'));var logger=require(_0x190f('0x7'))('rpc');var config=require(_0x190f('0x8'));var jayson=require(_0x190f('0x9'));var client=jayson[_0x190f('0xa')][_0x190f('0xb')]({'port':0x232a});config['redis']=_[_0x190f('0xc')](config[_0x190f('0xd')],{'host':_0x190f('0xe'),'port':0x18eb});var socket=require(_0x190f('0xf'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x190f('0x10')](socket);function respondWithRpcPromise(_0x36e5b8,_0x296693,_0x340006){return new BPromise(function(_0x5dacc0,_0x1a32f0){return client[_0x190f('0x11')](_0x36e5b8,_0x340006)[_0x190f('0x12')](function(_0x368c68){logger[_0x190f('0x13')](_0x190f('0x14'),_0x296693,_0x190f('0x15'));logger[_0x190f('0x16')](_0x190f('0x17'),_0x296693,_0x190f('0x15'),JSON[_0x190f('0x18')](_0x368c68));if(_0x368c68[_0x190f('0x19')]){if(_0x368c68[_0x190f('0x19')][_0x190f('0x1a')]===0x1f4){logger['error'](_0x190f('0x14'),_0x296693,_0x368c68[_0x190f('0x19')]['message']);return _0x1a32f0(_0x368c68[_0x190f('0x19')][_0x190f('0x1b')]);}logger['error'](_0x190f('0x14'),_0x296693,_0x368c68[_0x190f('0x19')]['message']);return _0x5dacc0(_0x368c68['error']['message']);}else{logger[_0x190f('0x13')](_0x190f('0x14'),_0x296693,_0x190f('0x15'));_0x5dacc0(_0x368c68[_0x190f('0x1c')][_0x190f('0x1b')]);}})[_0x190f('0x1d')](function(_0x169093){logger[_0x190f('0x19')](_0x190f('0x14'),_0x296693,_0x169093);_0x1a32f0(_0x169093);});});}exports[_0x190f('0x1e')]=function(_0x510780){var _0x391643=this;return new Promise(function(_0xb21a32,_0x353286){return db[_0x190f('0x1f')][_0x190f('0x20')]({'raw':_0x510780[_0x190f('0x21')]?_0x510780[_0x190f('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x510780[_0x190f('0x21')]?_0x510780[_0x190f('0x21')][_0x190f('0x22')]||null:null,'attributes':_0x510780[_0x190f('0x21')]?_0x510780[_0x190f('0x21')][_0x190f('0x23')]||null:null,'include':_0x510780['options']?_0x510780[_0x190f('0x21')][_0x190f('0x24')]?_[_0x190f('0x25')](_0x510780[_0x190f('0x21')][_0x190f('0x24')],function(_0x4d3cdd){return{'model':db[_0x4d3cdd['model']],'as':_0x4d3cdd['as'],'attributes':_0x4d3cdd[_0x190f('0x23')],'include':_0x4d3cdd['include']?_['map'](_0x4d3cdd[_0x190f('0x24')],function(_0x5cf73a){return{'model':db[_0x5cf73a[_0x190f('0x26')]],'as':_0x5cf73a['as'],'attributes':_0x5cf73a[_0x190f('0x23')],'include':_0x5cf73a[_0x190f('0x24')]?_['map'](_0x5cf73a[_0x190f('0x24')],function(_0x5147ee){return{'model':db[_0x5147ee['model']],'as':_0x5147ee['as'],'attributes':_0x5147ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x190f('0x12')](function(_0x4e4621){logger[_0x190f('0x13')]('ShowWhatsappAccount',_0x510780);logger[_0x190f('0x16')](_0x190f('0x1e'),_0x510780,JSON[_0x190f('0x18')](_0x4e4621));_0xb21a32(_0x4e4621);})['catch'](function(_0x231011){logger[_0x190f('0x19')](_0x190f('0x1e'),_0x231011[_0x190f('0x1b')],_0x510780);_0x353286(_0x391643[_0x190f('0x19')](0x1f4,_0x231011[_0x190f('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 1f91621..aa6ad53 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 _0xdfb8=['removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xdfb8,0x100));var _0x8dfb=function(_0x26c26c,_0x39f9cf){_0x26c26c=_0x26c26c-0x0;var _0x153b04=_0xdfb8[_0x26c26c];return _0x153b04;};'use strict';var WhatsappAccountEvents=require(_0x8dfb('0x0'));var events=[_0x8dfb('0x1'),_0x8dfb('0x2'),_0x8dfb('0x3')];function createListener(_0x533e29,_0x32d72d){return function(_0x28b9b3){_0x32d72d[_0x8dfb('0x4')](_0x533e29,_0x28b9b3);};}function removeListener(_0x413656,_0x3cbda3){return function(){WhatsappAccountEvents[_0x8dfb('0x5')](_0x413656,_0x3cbda3);};}exports[_0x8dfb('0x6')]=function(_0x327ab0){for(var _0x449aa1=0x0,_0x1afe64=events[_0x8dfb('0x7')];_0x449aa1<_0x1afe64;_0x449aa1++){var _0x33b779=events[_0x449aa1];var _0x23eefd=createListener(_0x8dfb('0x8')+_0x33b779,_0x327ab0);WhatsappAccountEvents['on'](_0x33b779,_0x23eefd);}}; \ No newline at end of file +var _0x139f=['length','./whatsappAccount.events','emit','register'];(function(_0x4ab45d,_0x1730ff){var _0x48ce87=function(_0x498ff0){while(--_0x498ff0){_0x4ab45d['push'](_0x4ab45d['shift']());}};_0x48ce87(++_0x1730ff);}(_0x139f,0x105));var _0xf139=function(_0x5f29d9,_0x18a376){_0x5f29d9=_0x5f29d9-0x0;var _0x2e9a9d=_0x139f[_0x5f29d9];return _0x2e9a9d;};'use strict';var WhatsappAccountEvents=require(_0xf139('0x0'));var events=['save','remove','update'];function createListener(_0x5dec1f,_0x3565bf){return function(_0x5e74a4){_0x3565bf[_0xf139('0x1')](_0x5dec1f,_0x5e74a4);};}function removeListener(_0x8e898e,_0x47be65){return function(){WhatsappAccountEvents['removeListener'](_0x8e898e,_0x47be65);};}exports[_0xf139('0x2')]=function(_0x137098){for(var _0x45f629=0x0,_0x2ebb03=events[_0xf139('0x3')];_0x45f629<_0x2ebb03;_0x45f629++){var _0x3c9bb2=events[_0x45f629];var _0x53733b=createListener('whatsappAccount:'+_0x3c9bb2,_0x137098);WhatsappAccountEvents['on'](_0x3c9bb2,_0x53733b);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index daae0d2..b420300 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 _0x26c1=['exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','isAuthenticated','index','/:id','show','post','put','update','delete','destroy'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x26c1,0x1c1));var _0x126c=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0x26c1[_0x622035];return _0x326cf2;};'use strict';var multer=require(_0x126c('0x0'));var util=require(_0x126c('0x1'));var path=require('path');var timeout=require(_0x126c('0x2'));var express=require(_0x126c('0x3'));var router=express['Router']();var fs_extra=require(_0x126c('0x4'));var auth=require(_0x126c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router['get']('/',auth[_0x126c('0x6')](),controller[_0x126c('0x7')]);router['get'](_0x126c('0x8'),auth[_0x126c('0x6')](),controller[_0x126c('0x9')]);router[_0x126c('0xa')]('/',auth[_0x126c('0x6')](),controller['create']);router[_0x126c('0xb')]('/:id',auth[_0x126c('0x6')](),controller[_0x126c('0xc')]);router[_0x126c('0xd')]('/:id',auth[_0x126c('0x6')](),controller[_0x126c('0xe')]);module[_0x126c('0xf')]=router; \ No newline at end of file +var _0xc451=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/:id','create','put','update','destroy','util'];(function(_0x38dc5b,_0x181f44){var _0x3987d8=function(_0x3d96ff){while(--_0x3d96ff){_0x38dc5b['push'](_0x38dc5b['shift']());}};_0x3987d8(++_0x181f44);}(_0xc451,0xd1));var _0x1c45=function(_0x2d33e2,_0x4e5dd6){_0x2d33e2=_0x2d33e2-0x0;var _0xfd04a4=_0xc451[_0x2d33e2];return _0xfd04a4;};'use strict';var multer=require('multer');var util=require(_0x1c45('0x0'));var path=require(_0x1c45('0x1'));var timeout=require(_0x1c45('0x2'));var express=require(_0x1c45('0x3'));var router=express[_0x1c45('0x4')]();var fs_extra=require(_0x1c45('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1c45('0x6'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x1c45('0x7')]('/',auth[_0x1c45('0x8')](),controller['index']);router[_0x1c45('0x7')](_0x1c45('0x9'),auth[_0x1c45('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x1c45('0xa')]);router[_0x1c45('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x1c45('0xc')]);router['delete']('/:id',auth[_0x1c45('0x8')](),controller[_0x1c45('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index d235381..388b04b 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 _0x9600=['sequelize','INTEGER','TEXT','*,*,*,*'];(function(_0x3aadfb,_0xecf480){var _0x116125=function(_0x1cddd0){while(--_0x1cddd0){_0x3aadfb['push'](_0x3aadfb['shift']());}};_0x116125(++_0xecf480);}(_0x9600,0xb4));var _0x0960=function(_0x59ed47,_0x48fcd6){_0x59ed47=_0x59ed47-0x0;var _0xf5af19=_0x9600[_0x59ed47];return _0xf5af19;};'use strict';var Sequelize=require(_0x0960('0x0'));module['exports']={'priority':{'type':Sequelize[_0x0960('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0960('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0960('0x3')}}; \ No newline at end of file +var _0xd7ed=['TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x4d8d31,_0x5041c5){var _0x228aca=function(_0x26e546){while(--_0x26e546){_0x4d8d31['push'](_0x4d8d31['shift']());}};_0x228aca(++_0x5041c5);}(_0xd7ed,0x1a1));var _0xdd7e=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xd7ed[_0x2080a3];return _0x8d7d17;};'use strict';var Sequelize=require(_0xdd7e('0x0'));module['exports']={'priority':{'type':Sequelize[_0xdd7e('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xdd7e('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xdd7e('0x3')]()},'description':{'type':Sequelize[_0xdd7e('0x2')]},'interval':{'type':Sequelize[_0xdd7e('0x2')],'defaultValue':_0xdd7e('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 4f90cbc..df39507 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 _0x55c3=['find','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','create','body','update'];(function(_0x37c8ef,_0x334449){var _0x5eaee9=function(_0x4b1b98){while(--_0x4b1b98){_0x37c8ef['push'](_0x37c8ef['shift']());}};_0x5eaee9(++_0x334449);}(_0x55c3,0x189));var _0x355c=function(_0x45315b,_0x3bf211){_0x45315b=_0x45315b-0x0;var _0x35b4b0=_0x55c3[_0x45315b];return _0x35b4b0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x355c('0x0'));var zipdir=require(_0x355c('0x1'));var jsonpatch=require(_0x355c('0x2'));var rp=require(_0x355c('0x3'));var moment=require(_0x355c('0x4'));var BPromise=require(_0x355c('0x5'));var Mustache=require(_0x355c('0x6'));var util=require(_0x355c('0x7'));var path=require(_0x355c('0x8'));var sox=require(_0x355c('0x9'));var csv=require(_0x355c('0xa'));var ejs=require(_0x355c('0xb'));var fs=require('fs');var fs_extra=require(_0x355c('0xc'));var _=require(_0x355c('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x355c('0xe'));var deskjs=require(_0x355c('0xf'));var toCsv=require(_0x355c('0xa'));var querystring=require(_0x355c('0x10'));var Papa=require(_0x355c('0x11'));var Redis=require(_0x355c('0x12'));var authService=require(_0x355c('0x13'));var qs=require(_0x355c('0x14'));var as=require(_0x355c('0x15'));var hardwareService=require(_0x355c('0x16'));var logger=require(_0x355c('0x17'))(_0x355c('0x18'));var utils=require(_0x355c('0x19'));var config=require(_0x355c('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x355c('0x1b'))['db'];function respondWithStatusCode(_0x174a77,_0x4dc0d7){_0x4dc0d7=_0x4dc0d7||0xcc;return function(_0x19ab78){if(_0x19ab78){return _0x174a77['sendStatus'](_0x4dc0d7);}return _0x174a77[_0x355c('0x1c')](_0x4dc0d7)[_0x355c('0x1d')]();};}function respondWithResult(_0x980568,_0x587d10){_0x587d10=_0x587d10||0xc8;return function(_0x54271d){if(_0x54271d){return _0x980568[_0x355c('0x1c')](_0x587d10)['json'](_0x54271d);}};}function respondWithFilteredResult(_0x521716,_0x1ddf94){return function(_0xfbf43){if(_0xfbf43){var _0x39bd6e=typeof _0x1ddf94[_0x355c('0x1e')]===_0x355c('0x1f')&&typeof _0x1ddf94[_0x355c('0x20')]===_0x355c('0x1f');var _0x1348a8=_0xfbf43[_0x355c('0x21')];var _0x559577=_0x39bd6e?0x0:_0x1ddf94[_0x355c('0x1e')];var _0x2610c5=_0x39bd6e?_0xfbf43['count']:_0x1ddf94['offset']+_0x1ddf94['limit'];var _0x582344;if(_0x2610c5>=_0x1348a8){_0x2610c5=_0x1348a8;_0x582344=0xc8;}else{_0x582344=0xce;}_0x521716[_0x355c('0x1c')](_0x582344);return _0x521716[_0x355c('0x22')](_0x355c('0x23'),_0x559577+'-'+_0x2610c5+'/'+_0x1348a8)['json'](_0xfbf43);}return null;};}function patchUpdates(_0x42323a){return function(_0x306f4b){try{jsonpatch[_0x355c('0x24')](_0x306f4b,_0x42323a,!![]);}catch(_0x390f69){return BPromise[_0x355c('0x25')](_0x390f69);}return _0x306f4b[_0x355c('0x26')]();};}function saveUpdates(_0x3c4708,_0x363257){return function(_0x55b939){if(_0x55b939){return _0x55b939['update'](_0x3c4708)[_0x355c('0x27')](function(_0x2d14b3){return _0x2d14b3;});}return null;};}function removeEntity(_0x27946d,_0x5a378e){return function(_0x26fd36){if(_0x26fd36){return _0x26fd36['destroy']()[_0x355c('0x27')](function(){_0x27946d[_0x355c('0x1c')](0xcc)[_0x355c('0x1d')]();});}};}function handleEntityNotFound(_0x22e629,_0x308f0c){return function(_0x4e5f1b){if(!_0x4e5f1b){_0x22e629[_0x355c('0x28')](0x194);}return _0x4e5f1b;};}function handleError(_0x448e1f,_0x37ac93){_0x37ac93=_0x37ac93||0x1f4;return function(_0x3fa509){logger[_0x355c('0x29')](_0x3fa509['stack']);if(_0x3fa509[_0x355c('0x2a')]){delete _0x3fa509['name'];}_0x448e1f[_0x355c('0x1c')](_0x37ac93)[_0x355c('0x2b')](_0x3fa509);};}exports[_0x355c('0x2c')]=function(_0x2ba985,_0x213289){var _0x473ac7={},_0x302391={},_0x52fdd4={'count':0x0,'rows':[]};var _0x38736a=_[_0x355c('0x2d')](db[_0x355c('0x2e')][_0x355c('0x2f')],function(_0x45fb4a){return{'name':_0x45fb4a[_0x355c('0x30')],'type':_0x45fb4a[_0x355c('0x31')][_0x355c('0x32')]};});_0x302391['model']=_[_0x355c('0x2d')](_0x38736a,_0x355c('0x2a'));_0x302391[_0x355c('0x33')]=_['keys'](_0x2ba985[_0x355c('0x33')]);_0x302391['filters']=_[_0x355c('0x34')](_0x302391[_0x355c('0x35')],_0x302391[_0x355c('0x33')]);_0x473ac7['attributes']=_[_0x355c('0x34')](_0x302391[_0x355c('0x35')],qs['fields'](_0x2ba985[_0x355c('0x33')][_0x355c('0x36')]));_0x473ac7[_0x355c('0x37')]=_0x473ac7['attributes'][_0x355c('0x38')]?_0x473ac7['attributes']:_0x302391[_0x355c('0x35')];if(!_0x2ba985[_0x355c('0x33')][_0x355c('0x39')]('nolimit')){_0x473ac7[_0x355c('0x20')]=qs[_0x355c('0x20')](_0x2ba985[_0x355c('0x33')]['limit']);_0x473ac7[_0x355c('0x1e')]=qs['offset'](_0x2ba985[_0x355c('0x33')][_0x355c('0x1e')]);}_0x473ac7[_0x355c('0x3a')]=qs[_0x355c('0x3b')](_0x2ba985[_0x355c('0x33')]['sort']);_0x473ac7['where']=qs[_0x355c('0x3c')](_['pick'](_0x2ba985['query'],_0x302391[_0x355c('0x3c')]),_0x38736a);if(_0x2ba985[_0x355c('0x33')][_0x355c('0x3d')]){_0x473ac7['where']=_[_0x355c('0x3e')](_0x473ac7[_0x355c('0x3f')],{'$or':_[_0x355c('0x2d')](_0x38736a,function(_0x5585ca){if(_0x5585ca[_0x355c('0x31')]!==_0x355c('0x40')){var _0x567fcb={};_0x567fcb[_0x5585ca[_0x355c('0x2a')]]={'$like':'%'+_0x2ba985[_0x355c('0x33')][_0x355c('0x3d')]+'%'};return _0x567fcb;}})});}_0x473ac7=_['merge']({},_0x473ac7,_0x2ba985['options']);var _0x4880cd={'where':_0x473ac7['where']};return db[_0x355c('0x2e')]['count'](_0x4880cd)['then'](function(_0x1dd0ab){_0x52fdd4['count']=_0x1dd0ab;if(_0x2ba985[_0x355c('0x33')][_0x355c('0x41')]){_0x473ac7[_0x355c('0x42')]=[{'all':!![]}];}return db[_0x355c('0x2e')][_0x355c('0x43')](_0x473ac7);})[_0x355c('0x27')](function(_0x2d8140){_0x52fdd4[_0x355c('0x44')]=_0x2d8140;return _0x52fdd4;})['then'](respondWithFilteredResult(_0x213289,_0x473ac7))[_0x355c('0x45')](handleError(_0x213289,null));};exports[_0x355c('0x46')]=function(_0x562f4d,_0x5eb2fd){var _0x30edee={'raw':!![],'where':{'id':_0x562f4d['params']['id']}},_0x1de472={};_0x1de472[_0x355c('0x35')]=_[_0x355c('0x47')](db[_0x355c('0x2e')][_0x355c('0x2f')]);_0x1de472[_0x355c('0x33')]=_[_0x355c('0x47')](_0x562f4d[_0x355c('0x33')]);_0x1de472[_0x355c('0x3c')]=_[_0x355c('0x34')](_0x1de472[_0x355c('0x35')],_0x1de472[_0x355c('0x33')]);_0x30edee[_0x355c('0x37')]=_[_0x355c('0x34')](_0x1de472[_0x355c('0x35')],qs[_0x355c('0x36')](_0x562f4d['query']['fields']));_0x30edee[_0x355c('0x37')]=_0x30edee[_0x355c('0x37')][_0x355c('0x38')]?_0x30edee['attributes']:_0x1de472[_0x355c('0x35')];if(_0x562f4d[_0x355c('0x33')][_0x355c('0x41')]){_0x30edee['include']=[{'all':!![]}];}_0x30edee=_['merge']({},_0x30edee,_0x562f4d['options']);return db[_0x355c('0x2e')]['find'](_0x30edee)[_0x355c('0x27')](handleEntityNotFound(_0x5eb2fd,null))[_0x355c('0x27')](respondWithResult(_0x5eb2fd,null))[_0x355c('0x45')](handleError(_0x5eb2fd,null));};exports[_0x355c('0x48')]=function(_0x39a02b,_0x4ac306){return db['WhatsappApplication']['create'](_0x39a02b[_0x355c('0x49')],{})[_0x355c('0x27')](respondWithResult(_0x4ac306,0xc9))[_0x355c('0x45')](handleError(_0x4ac306,null));};exports[_0x355c('0x4a')]=function(_0x5d72ba,_0x1ec422){if(_0x5d72ba[_0x355c('0x49')]['id']){delete _0x5d72ba[_0x355c('0x49')]['id'];}return db[_0x355c('0x2e')][_0x355c('0x4b')]({'where':{'id':_0x5d72ba[_0x355c('0x4c')]['id']}})[_0x355c('0x27')](handleEntityNotFound(_0x1ec422,null))['then'](saveUpdates(_0x5d72ba[_0x355c('0x49')],null))[_0x355c('0x27')](respondWithResult(_0x1ec422,null))[_0x355c('0x45')](handleError(_0x1ec422,null));};exports[_0x355c('0x4d')]=function(_0x4459f9,_0x3b699c){return db[_0x355c('0x2e')][_0x355c('0x4b')]({'where':{'id':_0x4459f9[_0x355c('0x4c')]['id']}})[_0x355c('0x27')](handleEntityNotFound(_0x3b699c,null))[_0x355c('0x27')](removeEntity(_0x3b699c,null))[_0x355c('0x45')](handleError(_0x3b699c,null));}; \ No newline at end of file +var _0xa3fe=['find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options'];(function(_0xe23713,_0x419a1b){var _0x1ac7ce=function(_0x2f51c2){while(--_0x2f51c2){_0xe23713['push'](_0xe23713['shift']());}};_0x1ac7ce(++_0x419a1b);}(_0xa3fe,0xd8));var _0xea3f=function(_0x2c0700,_0x54446a){_0x2c0700=_0x2c0700-0x0;var _0x3d1754=_0xa3fe[_0x2c0700];return _0x3d1754;};'use strict';var emlformat=require(_0xea3f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea3f('0x1'));var jsonpatch=require(_0xea3f('0x2'));var rp=require('request-promise');var moment=require(_0xea3f('0x3'));var BPromise=require(_0xea3f('0x4'));var Mustache=require(_0xea3f('0x5'));var util=require('util');var path=require(_0xea3f('0x6'));var sox=require('sox');var csv=require(_0xea3f('0x7'));var ejs=require(_0xea3f('0x8'));var fs=require('fs');var fs_extra=require(_0xea3f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xea3f('0xa'));var jsforce=require(_0xea3f('0xb'));var deskjs=require(_0xea3f('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xea3f('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xea3f('0xe'));var as=require(_0xea3f('0xf'));var hardwareService=require(_0xea3f('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xea3f('0x11'));var licenseUtil=require(_0xea3f('0x12'));var db=require(_0xea3f('0x13'))['db'];function respondWithStatusCode(_0x363046,_0x4a36da){_0x4a36da=_0x4a36da||0xcc;return function(_0x5afd23){if(_0x5afd23){return _0x363046['sendStatus'](_0x4a36da);}return _0x363046[_0xea3f('0x14')](_0x4a36da)[_0xea3f('0x15')]();};}function respondWithResult(_0x5b246b,_0x260985){_0x260985=_0x260985||0xc8;return function(_0x393dac){if(_0x393dac){return _0x5b246b['status'](_0x260985)[_0xea3f('0x16')](_0x393dac);}};}function respondWithFilteredResult(_0x307409,_0x153f0e){return function(_0x4becc3){if(_0x4becc3){var _0x32c2f=typeof _0x153f0e[_0xea3f('0x17')]===_0xea3f('0x18')&&typeof _0x153f0e[_0xea3f('0x19')]===_0xea3f('0x18');var _0x403fd2=_0x4becc3[_0xea3f('0x1a')];var _0x31b8ca=_0x32c2f?0x0:_0x153f0e[_0xea3f('0x17')];var _0x116d13=_0x32c2f?_0x4becc3[_0xea3f('0x1a')]:_0x153f0e[_0xea3f('0x17')]+_0x153f0e[_0xea3f('0x19')];var _0x35153d;if(_0x116d13>=_0x403fd2){_0x116d13=_0x403fd2;_0x35153d=0xc8;}else{_0x35153d=0xce;}_0x307409['status'](_0x35153d);return _0x307409[_0xea3f('0x1b')](_0xea3f('0x1c'),_0x31b8ca+'-'+_0x116d13+'/'+_0x403fd2)[_0xea3f('0x16')](_0x4becc3);}return null;};}function patchUpdates(_0xe50958){return function(_0x11f66c){try{jsonpatch['apply'](_0x11f66c,_0xe50958,!![]);}catch(_0x4af6e4){return BPromise[_0xea3f('0x1d')](_0x4af6e4);}return _0x11f66c[_0xea3f('0x1e')]();};}function saveUpdates(_0x4c6d50,_0x284f3b){return function(_0x1cc3c8){if(_0x1cc3c8){return _0x1cc3c8[_0xea3f('0x1f')](_0x4c6d50)[_0xea3f('0x20')](function(_0x5f452b){return _0x5f452b;});}return null;};}function removeEntity(_0x5bd381,_0x5c2eb0){return function(_0x2f8bdc){if(_0x2f8bdc){return _0x2f8bdc[_0xea3f('0x21')]()[_0xea3f('0x20')](function(){_0x5bd381[_0xea3f('0x14')](0xcc)[_0xea3f('0x15')]();});}};}function handleEntityNotFound(_0x11df76,_0x3f07d5){return function(_0x55a32d){if(!_0x55a32d){_0x11df76[_0xea3f('0x22')](0x194);}return _0x55a32d;};}function handleError(_0x4a111b,_0x29de3c){_0x29de3c=_0x29de3c||0x1f4;return function(_0x22cd02){logger[_0xea3f('0x23')](_0x22cd02[_0xea3f('0x24')]);if(_0x22cd02[_0xea3f('0x25')]){delete _0x22cd02['name'];}_0x4a111b[_0xea3f('0x14')](_0x29de3c)['send'](_0x22cd02);};}exports[_0xea3f('0x26')]=function(_0x9413e5,_0x20e014){var _0x4cd4e9={},_0x437070={},_0x10c397={'count':0x0,'rows':[]};var _0x59ec90=_[_0xea3f('0x27')](db[_0xea3f('0x28')][_0xea3f('0x29')],function(_0x391828){return{'name':_0x391828[_0xea3f('0x2a')],'type':_0x391828[_0xea3f('0x2b')][_0xea3f('0x2c')]};});_0x437070[_0xea3f('0x2d')]=_[_0xea3f('0x27')](_0x59ec90,_0xea3f('0x25'));_0x437070[_0xea3f('0x2e')]=_[_0xea3f('0x2f')](_0x9413e5[_0xea3f('0x2e')]);_0x437070[_0xea3f('0x30')]=_[_0xea3f('0x31')](_0x437070[_0xea3f('0x2d')],_0x437070[_0xea3f('0x2e')]);_0x4cd4e9[_0xea3f('0x32')]=_[_0xea3f('0x31')](_0x437070['model'],qs[_0xea3f('0x33')](_0x9413e5[_0xea3f('0x2e')][_0xea3f('0x33')]));_0x4cd4e9[_0xea3f('0x32')]=_0x4cd4e9[_0xea3f('0x32')][_0xea3f('0x34')]?_0x4cd4e9[_0xea3f('0x32')]:_0x437070[_0xea3f('0x2d')];if(!_0x9413e5[_0xea3f('0x2e')]['hasOwnProperty'](_0xea3f('0x35'))){_0x4cd4e9[_0xea3f('0x19')]=qs[_0xea3f('0x19')](_0x9413e5[_0xea3f('0x2e')][_0xea3f('0x19')]);_0x4cd4e9['offset']=qs['offset'](_0x9413e5[_0xea3f('0x2e')]['offset']);}_0x4cd4e9[_0xea3f('0x36')]=qs[_0xea3f('0x37')](_0x9413e5[_0xea3f('0x2e')][_0xea3f('0x37')]);_0x4cd4e9[_0xea3f('0x38')]=qs[_0xea3f('0x30')](_['pick'](_0x9413e5[_0xea3f('0x2e')],_0x437070['filters']),_0x59ec90);if(_0x9413e5['query'][_0xea3f('0x39')]){_0x4cd4e9[_0xea3f('0x38')]=_[_0xea3f('0x3a')](_0x4cd4e9[_0xea3f('0x38')],{'$or':_[_0xea3f('0x27')](_0x59ec90,function(_0x352402){if(_0x352402[_0xea3f('0x2b')]!==_0xea3f('0x3b')){var _0x365033={};_0x365033[_0x352402[_0xea3f('0x25')]]={'$like':'%'+_0x9413e5[_0xea3f('0x2e')][_0xea3f('0x39')]+'%'};return _0x365033;}})});}_0x4cd4e9=_[_0xea3f('0x3a')]({},_0x4cd4e9,_0x9413e5['options']);var _0xb7d4e5={'where':_0x4cd4e9['where']};return db[_0xea3f('0x28')][_0xea3f('0x1a')](_0xb7d4e5)[_0xea3f('0x20')](function(_0xea73b8){_0x10c397[_0xea3f('0x1a')]=_0xea73b8;if(_0x9413e5['query'][_0xea3f('0x3c')]){_0x4cd4e9['include']=[{'all':!![]}];}return db[_0xea3f('0x28')][_0xea3f('0x3d')](_0x4cd4e9);})[_0xea3f('0x20')](function(_0x26b06a){_0x10c397[_0xea3f('0x3e')]=_0x26b06a;return _0x10c397;})[_0xea3f('0x20')](respondWithFilteredResult(_0x20e014,_0x4cd4e9))[_0xea3f('0x3f')](handleError(_0x20e014,null));};exports[_0xea3f('0x40')]=function(_0x2a61e4,_0x2c018c){var _0x411e4a={'raw':!![],'where':{'id':_0x2a61e4[_0xea3f('0x41')]['id']}},_0x410250={};_0x410250[_0xea3f('0x2d')]=_[_0xea3f('0x2f')](db['WhatsappApplication'][_0xea3f('0x29')]);_0x410250['query']=_[_0xea3f('0x2f')](_0x2a61e4['query']);_0x410250[_0xea3f('0x30')]=_[_0xea3f('0x31')](_0x410250['model'],_0x410250[_0xea3f('0x2e')]);_0x411e4a[_0xea3f('0x32')]=_['intersection'](_0x410250[_0xea3f('0x2d')],qs[_0xea3f('0x33')](_0x2a61e4[_0xea3f('0x2e')]['fields']));_0x411e4a[_0xea3f('0x32')]=_0x411e4a[_0xea3f('0x32')][_0xea3f('0x34')]?_0x411e4a[_0xea3f('0x32')]:_0x410250[_0xea3f('0x2d')];if(_0x2a61e4[_0xea3f('0x2e')][_0xea3f('0x3c')]){_0x411e4a[_0xea3f('0x42')]=[{'all':!![]}];}_0x411e4a=_[_0xea3f('0x3a')]({},_0x411e4a,_0x2a61e4[_0xea3f('0x43')]);return db[_0xea3f('0x28')][_0xea3f('0x44')](_0x411e4a)[_0xea3f('0x20')](handleEntityNotFound(_0x2c018c,null))[_0xea3f('0x20')](respondWithResult(_0x2c018c,null))['catch'](handleError(_0x2c018c,null));};exports['create']=function(_0x7f50cd,_0x521d33){return db[_0xea3f('0x28')][_0xea3f('0x45')](_0x7f50cd['body'],{})['then'](respondWithResult(_0x521d33,0xc9))['catch'](handleError(_0x521d33,null));};exports['update']=function(_0xcad7cb,_0x302fc0){if(_0xcad7cb[_0xea3f('0x46')]['id']){delete _0xcad7cb[_0xea3f('0x46')]['id'];}return db[_0xea3f('0x28')][_0xea3f('0x44')]({'where':{'id':_0xcad7cb['params']['id']}})[_0xea3f('0x20')](handleEntityNotFound(_0x302fc0,null))['then'](saveUpdates(_0xcad7cb[_0xea3f('0x46')],null))[_0xea3f('0x20')](respondWithResult(_0x302fc0,null))['catch'](handleError(_0x302fc0,null));};exports[_0xea3f('0x21')]=function(_0x3d261c,_0x5b0ca1){return db[_0xea3f('0x28')][_0xea3f('0x44')]({'where':{'id':_0x3d261c[_0xea3f('0x41')]['id']}})[_0xea3f('0x20')](handleEntityNotFound(_0x5b0ca1,null))[_0xea3f('0x20')](removeEntity(_0x5b0ca1,null))[_0xea3f('0x3f')](handleError(_0x5b0ca1,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 9619112..5b4c842 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 _0xa566=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','define','whatsapp_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x163223,_0x549d6a){var _0x204178=function(_0x1008cc){while(--_0x1008cc){_0x163223['push'](_0x163223['shift']());}};_0x204178(++_0x549d6a);}(_0xa566,0x1c1));var _0x6a56=function(_0x294a4e,_0x1b9c48){_0x294a4e=_0x294a4e-0x0;var _0x148b92=_0xa566[_0x294a4e];return _0x148b92;};'use strict';var _=require(_0x6a56('0x0'));var util=require(_0x6a56('0x1'));var logger=require(_0x6a56('0x2'))('api');var moment=require(_0x6a56('0x3'));var BPromise=require(_0x6a56('0x4'));var rp=require(_0x6a56('0x5'));var fs=require('fs');var path=require(_0x6a56('0x6'));var rimraf=require('rimraf');var config=require(_0x6a56('0x7'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x4c58b0,_0x47ecb8){return _0x4c58b0[_0x6a56('0x8')]('WhatsappApplication',attributes,{'tableName':_0x6a56('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6a56('0xa')});}; \ No newline at end of file +var _0x56e7=['define','WhatsappApplication','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes'];(function(_0x217094,_0x311819){var _0x33cfa8=function(_0x24f030){while(--_0x24f030){_0x217094['push'](_0x217094['shift']());}};_0x33cfa8(++_0x311819);}(_0x56e7,0x7b));var _0x756e=function(_0x46abbb,_0x262d1e){_0x46abbb=_0x46abbb-0x0;var _0x11d318=_0x56e7[_0x46abbb];return _0x11d318;};'use strict';var _=require('lodash');var util=require(_0x756e('0x0'));var logger=require(_0x756e('0x1'))('api');var moment=require(_0x756e('0x2'));var BPromise=require(_0x756e('0x3'));var rp=require(_0x756e('0x4'));var fs=require('fs');var path=require(_0x756e('0x5'));var rimraf=require(_0x756e('0x6'));var config=require(_0x756e('0x7'));var attributes=require(_0x756e('0x8'));module['exports']=function(_0x3b3b8f,_0x404189){return _0x3b3b8f[_0x756e('0x9')](_0x756e('0xa'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x756e('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 b174761..1b93736 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 _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappApplication,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x3b5c18,_0x2ef1f2){var _0x3e396a=function(_0x3852d9){while(--_0x3852d9){_0x3b5c18['push'](_0x3b5c18['shift']());}};_0x3e396a(++_0x2ef1f2);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4dab14,_0x164ea0){_0x4dab14=_0x4dab14-0x0;var _0xf41aa=_0x4b84[_0x4dab14];return _0xf41aa;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('WhatsappApplication,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file +var _0xbd50=['WhatsappApplication,\x20%s,\x20%s','request\x20sent','WhatsappApplication,\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(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd50,0x196));var _0x0bd5=function(_0x2ef753,_0x44d150){_0x2ef753=_0x2ef753-0x0;var _0x1e2abd=_0xbd50[_0x2ef753];return _0x1e2abd;};'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/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index e400559..86bde53 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 _0xa1f6=['whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','multer','util','path','connect-timeout','express','Router','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked'];(function(_0x47a40b,_0x443ecf){var _0x19610c=function(_0x4b8ce1){while(--_0x4b8ce1){_0x47a40b['push'](_0x47a40b['shift']());}};_0x19610c(++_0x443ecf);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x309d93,_0x157662){_0x309d93=_0x309d93-0x0;var _0x2dd61d=_0xa1f6[_0x309d93];return _0x2dd61d;};'use strict';var multer=require(_0x6a1f('0x0'));var util=require(_0x6a1f('0x1'));var path=require(_0x6a1f('0x2'));var timeout=require(_0x6a1f('0x3'));var express=require(_0x6a1f('0x4'));var router=express[_0x6a1f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x6a1f('0x6')]('/',auth[_0x6a1f('0x7')](),controller[_0x6a1f('0x8')]);router[_0x6a1f('0x6')](_0x6a1f('0x9'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xa')]);router['get'](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xc')]);router[_0x6a1f('0x6')](_0x6a1f('0xd'),auth['isAuthenticated'](),controller[_0x6a1f('0xe')]);router[_0x6a1f('0x6')](_0x6a1f('0xf'),auth[_0x6a1f('0x7')](),controller['download']);router[_0x6a1f('0x10')]('/',auth['isAuthenticated'](),controller[_0x6a1f('0x11')]);router[_0x6a1f('0x10')](_0x6a1f('0xd'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0x12')]);router[_0x6a1f('0x10')](_0x6a1f('0x13'),auth[_0x6a1f('0x7')](),interaction[_0x6a1f('0x14')](_0x6a1f('0x15'),_0x6a1f('0x16')),controller[_0x6a1f('0x17')]);router[_0x6a1f('0x18')](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),interaction[_0x6a1f('0x14')](_0x6a1f('0x15'),_0x6a1f('0x19')),controller[_0x6a1f('0x1a')]);router['delete'](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),interaction[_0x6a1f('0x14')](_0x6a1f('0x15'),_0x6a1f('0x1b')),controller[_0x6a1f('0x1c')]);router[_0x6a1f('0x1d')](_0x6a1f('0x13'),auth['isAuthenticated'](),controller[_0x6a1f('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xafc4=['show','/:id/messages','download','create','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','/:id'];(function(_0x4bfb94,_0x57e844){var _0x55bde6=function(_0x2ea3c1){while(--_0x2ea3c1){_0x4bfb94['push'](_0x4bfb94['shift']());}};_0x55bde6(++_0x57e844);}(_0xafc4,0x69));var _0x4afc=function(_0x2a97a3,_0x11c6bf){_0x2a97a3=_0x2a97a3-0x0;var _0x58ae1f=_0xafc4[_0x2a97a3];return _0x58ae1f;};'use strict';var multer=require(_0x4afc('0x0'));var util=require('util');var path=require(_0x4afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x4afc('0x2'));var router=express[_0x4afc('0x3')]();var fs_extra=require(_0x4afc('0x4'));var auth=require(_0x4afc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x4afc('0x6')]('/',auth[_0x4afc('0x7')](),controller[_0x4afc('0x8')]);router[_0x4afc('0x6')](_0x4afc('0x9'),auth[_0x4afc('0x7')](),controller['describe']);router[_0x4afc('0x6')](_0x4afc('0xa'),auth[_0x4afc('0x7')](),controller[_0x4afc('0xb')]);router[_0x4afc('0x6')](_0x4afc('0xc'),auth['isAuthenticated'](),controller['getMessages']);router[_0x4afc('0x6')]('/:id/download',auth[_0x4afc('0x7')](),controller[_0x4afc('0xd')]);router['post']('/',auth[_0x4afc('0x7')](),controller[_0x4afc('0xe')]);router[_0x4afc('0xf')](_0x4afc('0xc'),auth[_0x4afc('0x7')](),controller[_0x4afc('0x10')]);router[_0x4afc('0xf')](_0x4afc('0x11'),auth['isAuthenticated'](),interaction[_0x4afc('0x12')](_0x4afc('0x13'),_0x4afc('0x14')),controller[_0x4afc('0x15')]);router['put']('/:id',auth[_0x4afc('0x7')](),interaction['tracked'](_0x4afc('0x13'),_0x4afc('0x16')),controller[_0x4afc('0x17')]);router[_0x4afc('0x18')](_0x4afc('0xa'),auth[_0x4afc('0x7')](),interaction[_0x4afc('0x12')](_0x4afc('0x13'),_0x4afc('0x19')),controller[_0x4afc('0x1a')]);router[_0x4afc('0x18')]('/:id/tags',auth[_0x4afc('0x7')](),controller[_0x4afc('0x1b')]);module[_0x4afc('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 9930280..aa2259e 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 _0x1399=['DATE','ENUM','out','INTEGER','sequelize','moment','BOOLEAN','STRING'];(function(_0x5774be,_0x2259d3){var _0x4914b4=function(_0x1eebc3){while(--_0x1eebc3){_0x5774be['push'](_0x5774be['shift']());}};_0x4914b4(++_0x2259d3);}(_0x1399,0x16c));var _0x9139=function(_0x49ca6b,_0x3ba842){_0x49ca6b=_0x49ca6b-0x0;var _0x1d957f=_0x1399[_0x49ca6b];return _0x1d957f;};'use strict';var Sequelize=require(_0x9139('0x0'));var moment=require(_0x9139('0x1'));module['exports']={'closed':{'type':Sequelize[_0x9139('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x9139('0x3')]},'secondDisposition':{'type':Sequelize[_0x9139('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9139('0x3')]},'note':{'type':Sequelize[_0x9139('0x3')]},'phone':{'type':Sequelize[_0x9139('0x3')]},'read1stAt':{'type':Sequelize[_0x9139('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9139('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x9139('0x5')]('in',_0x9139('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9139('0x7')]}}; \ No newline at end of file +var _0x6d4b=['moment','exports','DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0x12c34e,_0x39287a){var _0x244e88=function(_0x34507b){while(--_0x34507b){_0x12c34e['push'](_0x12c34e['shift']());}};_0x244e88(++_0x39287a);}(_0x6d4b,0xbf));var _0xb6d4=function(_0x4a7e68,_0x3d9fff){_0x4a7e68=_0x4a7e68-0x0;var _0x17fb0e=_0x6d4b[_0x4a7e68];return _0x17fb0e;};'use strict';var Sequelize=require(_0xb6d4('0x0'));var moment=require(_0xb6d4('0x1'));module[_0xb6d4('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb6d4('0x3')]},'disposition':{'type':Sequelize[_0xb6d4('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb6d4('0x4')]},'phone':{'type':Sequelize[_0xb6d4('0x4')]},'read1stAt':{'type':Sequelize[_0xb6d4('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xb6d4('0x5')]('in',_0xb6d4('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb6d4('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb6d4('0x5')]('in',_0xb6d4('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xb6d4('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 490ccb5..a81dc21 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 _0xd7e0=['filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','Tag','emit','download','unix','toString','join','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','createdAt','direction','read','WhatsappAccount','Account','Owner','get','N.A.','closed','disposition','Messages','existsSync','createReadStream','createWriteStream','basename','out','System','value','root','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','moment','bluebird','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','catch','show','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','WhatsappInteraction','find','create','body','params','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','hasOwnProperty','nolimit','order','sort','pick','WhatsappInteractionId','where'];(function(_0x5dc7ae,_0x32c401){var _0x35f22e=function(_0xf18ed8){while(--_0xf18ed8){_0x5dc7ae['push'](_0x5dc7ae['shift']());}};_0x35f22e(++_0x32c401);}(_0xd7e0,0xb3));var _0x0d7e=function(_0x387fbb,_0x101b4e){_0x387fbb=_0x387fbb-0x0;var _0x46a578=_0xd7e0[_0x387fbb];return _0x46a578;};'use strict';var rimraf=require(_0x0d7e('0x0'));var zipdir=require(_0x0d7e('0x1'));var moment=require(_0x0d7e('0x2'));var BPromise=require(_0x0d7e('0x3'));var util=require('util');var path=require(_0x0d7e('0x4'));var ejs=require(_0x0d7e('0x5'));var fs=require('fs');var _=require(_0x0d7e('0x6'));var Redis=require(_0x0d7e('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x0d7e('0x8'));var pdf=require(_0x0d7e('0x9'));var logger=require(_0x0d7e('0xa'))(_0x0d7e('0xb'));var config=require(_0x0d7e('0xc'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x0d7e('0xd')],{'host':_0x0d7e('0xe'),'port':0x18eb});var socket=require(_0x0d7e('0xf'))(new Redis(config[_0x0d7e('0xd')]));require(_0x0d7e('0x10'))['register'](socket);function respondWithStatusCode(_0x298e05,_0x4587f5){_0x4587f5=_0x4587f5||0xcc;return function(_0x2d053a){if(_0x2d053a){return _0x298e05[_0x0d7e('0x11')](_0x4587f5);}return _0x298e05[_0x0d7e('0x12')](_0x4587f5)[_0x0d7e('0x13')]();};}function respondWithResult(_0xdebe67,_0x5a70a4){_0x5a70a4=_0x5a70a4||0xc8;return function(_0x597696){if(_0x597696){return _0xdebe67[_0x0d7e('0x12')](_0x5a70a4)[_0x0d7e('0x14')](_0x597696);}};}function respondWithFilteredResult(_0x33461c,_0x1e8cf6){return function(_0x1ee8d0){if(_0x1ee8d0){var _0x2cf2f1=typeof _0x1e8cf6[_0x0d7e('0x15')]===_0x0d7e('0x16')&&typeof _0x1e8cf6[_0x0d7e('0x17')]==='undefined';var _0x19c5f7=_0x1ee8d0[_0x0d7e('0x18')];var _0x4b6793=_0x2cf2f1?0x0:_0x1e8cf6['offset'];var _0x4dc900=_0x2cf2f1?_0x1ee8d0[_0x0d7e('0x18')]:_0x1e8cf6['offset']+_0x1e8cf6[_0x0d7e('0x17')];var _0x5e64ed;if(_0x4dc900>=_0x19c5f7){_0x4dc900=_0x19c5f7;_0x5e64ed=0xc8;}else{_0x5e64ed=0xce;}_0x33461c[_0x0d7e('0x12')](_0x5e64ed);return _0x33461c[_0x0d7e('0x19')](_0x0d7e('0x1a'),_0x4b6793+'-'+_0x4dc900+'/'+_0x19c5f7)['json'](_0x1ee8d0);}return null;};}function saveUpdates(_0x501656){return function(_0x2136cc){if(_0x2136cc){return _0x2136cc[_0x0d7e('0x1b')](_0x501656)[_0x0d7e('0x1c')](function(_0x385c52){return _0x385c52;});}return null;};}function removeEntity(_0x52e7ec){return function(_0x243e9b){if(_0x243e9b){return _0x243e9b[_0x0d7e('0x1d')]()[_0x0d7e('0x1c')](function(){_0x52e7ec[_0x0d7e('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54dd32){return function(_0x34d5f9){if(!_0x34d5f9){_0x54dd32['sendStatus'](0x194);}return _0x34d5f9;};}function handleError(_0x5733ad,_0x4e8c18){_0x4e8c18=_0x4e8c18||0x1f4;return function(_0x482a3f){logger['error'](_0x482a3f[_0x0d7e('0x1e')]);if(_0x482a3f[_0x0d7e('0x1f')]){delete _0x482a3f[_0x0d7e('0x1f')];}_0x5733ad[_0x0d7e('0x12')](_0x4e8c18)[_0x0d7e('0x20')](_0x482a3f);};}exports['index']=function(_0x2b1499,_0xd01a1f){var _0x3bfa2e={};var _0x1150fc=_[_0x0d7e('0x21')](db['WhatsappInteraction'][_0x0d7e('0x22')],function(_0x29e5c7){return{'name':_0x29e5c7[_0x0d7e('0x23')],'type':_0x29e5c7[_0x0d7e('0x24')][_0x0d7e('0x25')]};});_0x3bfa2e=qs[_0x0d7e('0x26')](_0x1150fc,_0x2b1499);return interaction[_0x0d7e('0x27')]('whatsapp',_0x2b1499[_0x0d7e('0x28')],_0x2b1499[_0x0d7e('0x29')],_0x3bfa2e,_0x1150fc)[_0x0d7e('0x1c')](respondWithFilteredResult(_0xd01a1f,_0x3bfa2e))[_0x0d7e('0x2a')](handleError(_0xd01a1f,null));};exports[_0x0d7e('0x2b')]=function(_0x43db17,_0x31453a){var _0x4c9821={'raw':![],'where':{'id':_0x43db17['params']['id']}},_0x36ad9b={};_0x36ad9b[_0x0d7e('0x2c')]=_['keys'](db['WhatsappInteraction'][_0x0d7e('0x22')]);_0x36ad9b['query']=_[_0x0d7e('0x2d')](_0x43db17['query']);_0x36ad9b[_0x0d7e('0x2e')]=_[_0x0d7e('0x2f')](_0x36ad9b[_0x0d7e('0x2c')],_0x36ad9b['query']);_0x4c9821['attributes']=_['intersection'](_0x36ad9b[_0x0d7e('0x2c')],qs[_0x0d7e('0x30')](_0x43db17['query'][_0x0d7e('0x30')]));_0x4c9821[_0x0d7e('0x31')]=_0x4c9821[_0x0d7e('0x31')][_0x0d7e('0x32')]?_0x4c9821[_0x0d7e('0x31')]:_0x36ad9b[_0x0d7e('0x2c')];if(_0x43db17[_0x0d7e('0x28')][_0x0d7e('0x33')]){_0x4c9821[_0x0d7e('0x34')]=[{'all':!![]}];}_0x4c9821=_[_0x0d7e('0x35')]({},_0x4c9821,_0x43db17['options']);return db[_0x0d7e('0x36')][_0x0d7e('0x37')](_0x4c9821)[_0x0d7e('0x1c')](handleEntityNotFound(_0x31453a,null))[_0x0d7e('0x1c')](respondWithResult(_0x31453a,null))[_0x0d7e('0x2a')](handleError(_0x31453a,null));};exports[_0x0d7e('0x38')]=function(_0x52b346,_0x3df43e){return db[_0x0d7e('0x36')]['create'](_0x52b346[_0x0d7e('0x39')],{})[_0x0d7e('0x1c')](respondWithResult(_0x3df43e,0xc9))['catch'](handleError(_0x3df43e,null));};exports[_0x0d7e('0x1b')]=function(_0x4fc479,_0x23d0e4){if(_0x4fc479['body']['id']){delete _0x4fc479[_0x0d7e('0x39')]['id'];}return db[_0x0d7e('0x36')][_0x0d7e('0x37')]({'where':{'id':_0x4fc479[_0x0d7e('0x3a')]['id']}})[_0x0d7e('0x1c')](handleEntityNotFound(_0x23d0e4,null))[_0x0d7e('0x1c')](saveUpdates(_0x4fc479[_0x0d7e('0x39')],null))['then'](respondWithResult(_0x23d0e4,null))[_0x0d7e('0x2a')](handleError(_0x23d0e4,null));};exports[_0x0d7e('0x1d')]=function(_0x590522,_0xad46a1){return db[_0x0d7e('0x36')][_0x0d7e('0x37')]({'where':{'id':_0x590522[_0x0d7e('0x3a')]['id']}})[_0x0d7e('0x1c')](handleEntityNotFound(_0xad46a1,null))[_0x0d7e('0x1c')](removeEntity(_0xad46a1,null))[_0x0d7e('0x2a')](handleError(_0xad46a1,null));};exports[_0x0d7e('0x3b')]=function(_0x14f911,_0x3f3300){return db[_0x0d7e('0x36')][_0x0d7e('0x3b')]()[_0x0d7e('0x1c')](respondWithResult(_0x3f3300,null))['catch'](handleError(_0x3f3300,null));};exports[_0x0d7e('0x3c')]=function(_0x22c8ce,_0x2600f8){return db['WhatsappMessage'][_0x0d7e('0x37')]({'where':{'id':_0x22c8ce[_0x0d7e('0x3a')]['id']}})[_0x0d7e('0x1c')](handleEntityNotFound(_0x2600f8,null))[_0x0d7e('0x1c')](function(_0x36acfa){if(_0x36acfa){return _0x36acfa['addMessage'](_0x22c8ce['body'][_0x0d7e('0x3d')],_[_0x0d7e('0x3e')](_0x22c8ce[_0x0d7e('0x39')],[_0x0d7e('0x3d'),'id'])||{});}})[_0x0d7e('0x1c')](respondWithResult(_0x2600f8,null))[_0x0d7e('0x2a')](handleError(_0x2600f8,null));};exports[_0x0d7e('0x3f')]=function(_0x27727e,_0x190c16){var _0x17448f={'raw':![],'where':{}};var _0x5e062c={};var _0x3ed1cf={'count':0x0,'rows':[]};return db[_0x0d7e('0x36')][_0x0d7e('0x40')]({'where':{'id':_0x27727e[_0x0d7e('0x3a')]['id']}})['then'](handleEntityNotFound(_0x190c16,null))[_0x0d7e('0x1c')](function(_0x533d7a){if(_0x533d7a){_0x5e062c[_0x0d7e('0x2c')]=_[_0x0d7e('0x2d')](db[_0x0d7e('0x41')]['rawAttributes']);_0x5e062c[_0x0d7e('0x28')]=_['keys'](_0x27727e[_0x0d7e('0x28')]);_0x5e062c[_0x0d7e('0x2e')]=_['intersection'](_0x5e062c[_0x0d7e('0x2c')],_0x5e062c['query']);_0x17448f[_0x0d7e('0x31')]=_[_0x0d7e('0x2f')](_0x5e062c['model'],qs[_0x0d7e('0x30')](_0x27727e[_0x0d7e('0x28')][_0x0d7e('0x30')]));_0x17448f['attributes']=_0x17448f[_0x0d7e('0x31')]['length']?_0x17448f['attributes']:_0x5e062c[_0x0d7e('0x2c')];if(!_0x27727e['query'][_0x0d7e('0x42')](_0x0d7e('0x43'))){_0x17448f[_0x0d7e('0x17')]=qs[_0x0d7e('0x17')](_0x27727e[_0x0d7e('0x28')][_0x0d7e('0x17')]);_0x17448f[_0x0d7e('0x15')]=qs[_0x0d7e('0x15')](_0x27727e['query']['offset']);}_0x17448f[_0x0d7e('0x44')]=qs[_0x0d7e('0x45')](_0x27727e[_0x0d7e('0x28')][_0x0d7e('0x45')]);_0x17448f['where']=qs[_0x0d7e('0x2e')](_[_0x0d7e('0x46')](_0x27727e[_0x0d7e('0x28')],_0x5e062c['filters']));_0x17448f['where'][_0x0d7e('0x47')]=_0x533d7a['id'];if(_0x27727e[_0x0d7e('0x28')]['filter']){_0x17448f['where']=_[_0x0d7e('0x35')](_0x17448f[_0x0d7e('0x48')],{'$or':_['map'](_0x17448f[_0x0d7e('0x31')],function(_0x355f90){var _0x47faae={};_0x47faae[_0x355f90]={'$like':'%'+_0x27727e[_0x0d7e('0x28')][_0x0d7e('0x49')]+'%'};return _0x47faae;})});}if(_0x27727e[_0x0d7e('0x28')][_0x0d7e('0x4a')]){var _0x56d7ba=_0x27727e['query'][_0x0d7e('0x4a')][_0x0d7e('0x4b')](',');var _0x18a2c5={};_0x18a2c5[_0x56d7ba[0x0]]={'$gte':moment(_0x56d7ba[0x1])[_0x0d7e('0x4c')](_0x0d7e('0x4d'))};_0x17448f[_0x0d7e('0x48')]=_[_0x0d7e('0x35')](_0x17448f['where'],_0x18a2c5);}_0x17448f=_[_0x0d7e('0x35')]({},_0x17448f,_0x27727e['options']);return db[_0x0d7e('0x41')][_0x0d7e('0x18')]({'where':_0x17448f['where']})[_0x0d7e('0x1c')](function(_0x304349){_0x3ed1cf[_0x0d7e('0x18')]=_0x304349;if(_0x27727e['query'][_0x0d7e('0x33')]){_0x17448f[_0x0d7e('0x34')]=[{'all':!![]}];}return db[_0x0d7e('0x41')]['findAll'](_0x17448f);})['then'](function(_0x43ae7f){_0x3ed1cf['rows']=_0x43ae7f;return _0x3ed1cf;});}})['then'](respondWithFilteredResult(_0x190c16,_0x17448f))[_0x0d7e('0x2a')](handleError(_0x190c16,null));};exports[_0x0d7e('0x4e')]=function(_0x28a232,_0x50494f){return db['WhatsappInteraction']['find']({'where':{'id':_0x28a232['params']['id']}})[_0x0d7e('0x1c')](handleEntityNotFound(_0x50494f,null))[_0x0d7e('0x1c')](function(_0x17f8f0){if(_0x17f8f0){return _0x17f8f0[_0x0d7e('0x4f')](_0x28a232[_0x0d7e('0x39')][_0x0d7e('0x3d')],_[_0x0d7e('0x3e')](_0x28a232['body'],[_0x0d7e('0x3d'),'id'])||{})[_0x0d7e('0x50')](function(){return db[_0x0d7e('0x51')][_0x0d7e('0x27')]({'attributes':['id','name','color'],'where':{'id':_0x28a232['body'][_0x0d7e('0x3d')]}});})[_0x0d7e('0x1c')](function(_0x1ec8c6){socket[_0x0d7e('0x52')]('whatsappInteractionTags:save',{'id':Number(_0x28a232[_0x0d7e('0x3a')]['id']),'tags':_0x1ec8c6||[]});return{'id':Number(_0x28a232[_0x0d7e('0x3a')]['id']),'tags':_0x1ec8c6||[]};});}})[_0x0d7e('0x1c')](respondWithResult(_0x50494f,null))[_0x0d7e('0x2a')](handleError(_0x50494f,null));};exports['removeTags']=function(_0x4a34ed,_0x3a0e2b){return db['WhatsappInteraction']['find']({'where':{'id':_0x4a34ed[_0x0d7e('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3a0e2b,null))[_0x0d7e('0x1c')](function(_0xdca2f9){if(_0xdca2f9){return _0xdca2f9['removeTags'](_0x4a34ed[_0x0d7e('0x28')][_0x0d7e('0x3d')]);}})[_0x0d7e('0x1c')](respondWithStatusCode(_0x3a0e2b,null))['catch'](handleError(_0x3a0e2b,null));};exports[_0x0d7e('0x53')]=function(_0x376571,_0x4783b6){var _0x3ae1a6=moment()[_0x0d7e('0x54')]()[_0x0d7e('0x55')]();var _0xb44703=path[_0x0d7e('0x56')](config['root'],_0x0d7e('0x57'),_0x0d7e('0x58'),_0x0d7e('0x59'));var _0x53abb5=path['join'](config['root'],_0x0d7e('0x57'),_0x0d7e('0x58'),_0x0d7e('0x5a'));var _0x1cbcfc=path[_0x0d7e('0x56')](_0xb44703,_0x3ae1a6);var _0x852e5c=util[_0x0d7e('0x4c')](_0x0d7e('0x5b'),_0x376571[_0x0d7e('0x3a')]['id'],_0x3ae1a6);var _0x35bec8=path[_0x0d7e('0x56')](_0xb44703,_0x852e5c);var _0x36d09a=[];_0x36d09a[_0x0d7e('0x5c')]({'model':db[_0x0d7e('0x5d')],'as':_0x0d7e('0x5d'),'attributes':['id',_0x0d7e('0x5e')],'raw':!![]});_0x36d09a[_0x0d7e('0x5c')]({'model':db[_0x0d7e('0x5f')],'as':_0x0d7e('0x60'),'attributes':['id',_0x0d7e('0x61'),_0x0d7e('0x62')],'raw':!![]});if(_0x376571['query'][_0x0d7e('0x5a')]){_0x36d09a[_0x0d7e('0x5c')]({'model':db['Attachment'],'as':_0x0d7e('0x63'),'raw':!![]});}var _0x210b4e=[{'model':db[_0x0d7e('0x41')],'as':'Messages','attributes':['id','body',_0x0d7e('0x64'),_0x0d7e('0x65'),'secret',_0x0d7e('0x66')],'include':_0x36d09a}];_0x210b4e[_0x0d7e('0x5c')]({'model':db[_0x0d7e('0x67')],'as':_0x0d7e('0x68'),'attributes':['id',_0x0d7e('0x1f')]});_0x210b4e['push']({'model':db[_0x0d7e('0x5d')],'as':_0x0d7e('0x69'),'attributes':['id',_0x0d7e('0x5e')]});return db['WhatsappInteraction']['find']({'where':{'id':_0x376571[_0x0d7e('0x3a')]['id']},'include':_0x210b4e})['then'](handleEntityNotFound(_0x4783b6,null))[_0x0d7e('0x1c')](function(_0x334cd5){if(_0x334cd5){var _0x1c3505=_0x334cd5[_0x0d7e('0x6a')]({'plain':!![]});fs['mkdirSync'](_0x1cbcfc);var _0x43f6eb={'channel':'Whatsapp','account':_0x1c3505['Account'][_0x0d7e('0x1f')],'agent':_0x1c3505[_0x0d7e('0x69')]?_0x1c3505[_0x0d7e('0x69')][_0x0d7e('0x5e')]:_0x0d7e('0x6b'),'createdAt':moment(_0x1c3505[_0x0d7e('0x64')])[_0x0d7e('0x4c')](_0x0d7e('0x4d'))['toString'](),'closedAt':_0x1c3505[_0x0d7e('0x6c')]?moment(_0x1c3505['closedAt'])['format'](_0x0d7e('0x4d'))[_0x0d7e('0x55')]():'','disposition':_0x1c3505[_0x0d7e('0x6d')],'messages':_(_0x1c3505[_0x0d7e('0x6e')])[_0x0d7e('0x49')]({'secret':![]})['map'](function(_0x522895){if(_0x522895[_0x0d7e('0x63')]){var _0x329dd1=path[_0x0d7e('0x56')](_0x53abb5,_0x522895[_0x0d7e('0x63')]['basename']);if(fs[_0x0d7e('0x6f')](_0x329dd1)){fs[_0x0d7e('0x70')](_0x329dd1)['pipe'](fs[_0x0d7e('0x71')](path[_0x0d7e('0x56')](_0x1cbcfc,_0x522895[_0x0d7e('0x63')][_0x0d7e('0x72')])));}}return{'date':moment(_0x522895[_0x0d7e('0x64')])[_0x0d7e('0x4c')](_0x0d7e('0x4d'))[_0x0d7e('0x55')](),'sender':_0x522895[_0x0d7e('0x65')]===_0x0d7e('0x73')?_0x522895['User']?_0x522895[_0x0d7e('0x5d')][_0x0d7e('0x5e')]:_0x0d7e('0x74'):_0x522895[_0x0d7e('0x60')][_0x0d7e('0x61')]+(_0x522895[_0x0d7e('0x60')][_0x0d7e('0x62')]?'\x20'+_0x522895[_0x0d7e('0x60')][_0x0d7e('0x62')]:''),'body':_0x522895['Attachment']?_0x522895['Attachment'][_0x0d7e('0x72')]:_0x522895[_0x0d7e('0x39')],'direction':_0x522895[_0x0d7e('0x65')]===_0x0d7e('0x73')?'A':'C','secret':_0x522895['secret'],'read':_0x522895[_0x0d7e('0x66')],'attachment':_0x522895['Attachment']};})[_0x0d7e('0x75')]()};return ejs['renderFile'](path[_0x0d7e('0x56')](config[_0x0d7e('0x76')],'server',_0x0d7e('0x77'),_0x0d7e('0x78')),{'interaction':_0x43f6eb})[_0x0d7e('0x1c')](function(_0x59df24){var _0x25b2b0=path[_0x0d7e('0x56')](_0x1cbcfc,_0x0d7e('0x79')+_0x1c3505['id']+'-'+_0x3ae1a6+_0x0d7e('0x7a'));var _0x5618ab={'path':_0x25b2b0,'channel':'Whatsapp','interactionId':_0x1c3505['id']};return pdf[_0x0d7e('0x7b')](_0x59df24,_0x5618ab);})[_0x0d7e('0x1c')](function(){return new BPromise(function(_0x58ccb6,_0x22af49){zipdir(_0x1cbcfc,{'saveTo':_0x35bec8},function(_0x1c9860,_0x1830f0){if(_0x1c9860)return _0x22af49(_0x1c9860);return _0x58ccb6(_0x1830f0);});})[_0x0d7e('0x1c')](function(){return new BPromise(function(_0x167c65,_0x3f1436){rimraf(_0x1cbcfc,function(_0x39039e){if(_0x39039e)_0x3f1436(_0x39039e);return _0x167c65();});});})[_0x0d7e('0x1c')](function(){return _0x4783b6[_0x0d7e('0x53')](_0x35bec8,_0x852e5c,function(_0x5bb050){if(_0x5bb050){console[_0x0d7e('0x7c')]('err',_0x5bb050);}else{fs[_0x0d7e('0x7d')](_0x35bec8);}});});});}else{return _0x4783b6['sendStatus'](0xc8);}})[_0x0d7e('0x2a')](handleError(_0x4783b6,null));}; \ No newline at end of file +var _0x25b4=['stack','name','send','map','WhatsappInteraction','rawAttributes','key','getOptions','findAll','whatsapp','user','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','options','find','catch','create','body','params','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','hasOwnProperty','nolimit','order','sort','pick','where','WhatsappInteractionId','merge','$gte','format','include','rows','addTags','setTags','color','emit','whatsappInteractionTags:save','removeTags','unix','join','server','tmp','files','attachments','push','User','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','read','Account','Owner','fullname','get','mkdirSync','Whatsapp','N.A.','YYYY-MM-DD\x20HH:mm:ss','toString','closed','disposition','filter','basename','pipe','createWriteStream','out','System','secret','renderFile','root','transcript-','.pdf','log','unlinkSync','rimraf','zip-dir','bluebird','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','register','sendStatus','end','status','json','offset','undefined','count','limit','set','update','then','destroy','error'];(function(_0x2e05b4,_0x1da99d){var _0x5330e7=function(_0x1d6f0d){while(--_0x1d6f0d){_0x2e05b4['push'](_0x2e05b4['shift']());}};_0x5330e7(++_0x1da99d);}(_0x25b4,0xd4));var _0x425b=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x25b4[_0x25bea7];return _0x175952;};'use strict';var rimraf=require(_0x425b('0x0'));var zipdir=require(_0x425b('0x1'));var moment=require('moment');var BPromise=require(_0x425b('0x2'));var util=require('util');var path=require(_0x425b('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x425b('0x4'));var interaction=require(_0x425b('0x5'));var qs=require(_0x425b('0x6'));var pdf=require(_0x425b('0x7'));var logger=require(_0x425b('0x8'))('api');var config=require(_0x425b('0x9'));var db=require(_0x425b('0xa'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x425b('0xb'),'port':0x18eb});var socket=require(_0x425b('0xc'))(new Redis(config[_0x425b('0xd')]));require('./whatsappInteraction.socket')[_0x425b('0xe')](socket);function respondWithStatusCode(_0x396bb1,_0x55e08c){_0x55e08c=_0x55e08c||0xcc;return function(_0x1d79dd){if(_0x1d79dd){return _0x396bb1[_0x425b('0xf')](_0x55e08c);}return _0x396bb1['status'](_0x55e08c)[_0x425b('0x10')]();};}function respondWithResult(_0x31d0f9,_0x539be0){_0x539be0=_0x539be0||0xc8;return function(_0x134cb3){if(_0x134cb3){return _0x31d0f9[_0x425b('0x11')](_0x539be0)[_0x425b('0x12')](_0x134cb3);}};}function respondWithFilteredResult(_0x1e6ba1,_0x4fea74){return function(_0x4531f7){if(_0x4531f7){var _0x48c8fe=typeof _0x4fea74[_0x425b('0x13')]===_0x425b('0x14')&&typeof _0x4fea74['limit']===_0x425b('0x14');var _0x45824d=_0x4531f7['count'];var _0x2f552f=_0x48c8fe?0x0:_0x4fea74[_0x425b('0x13')];var _0x260383=_0x48c8fe?_0x4531f7[_0x425b('0x15')]:_0x4fea74[_0x425b('0x13')]+_0x4fea74[_0x425b('0x16')];var _0x5c8114;if(_0x260383>=_0x45824d){_0x260383=_0x45824d;_0x5c8114=0xc8;}else{_0x5c8114=0xce;}_0x1e6ba1[_0x425b('0x11')](_0x5c8114);return _0x1e6ba1[_0x425b('0x17')]('Content-Range',_0x2f552f+'-'+_0x260383+'/'+_0x45824d)[_0x425b('0x12')](_0x4531f7);}return null;};}function saveUpdates(_0x4277e3){return function(_0x43e797){if(_0x43e797){return _0x43e797[_0x425b('0x18')](_0x4277e3)[_0x425b('0x19')](function(_0x4deef9){return _0x4deef9;});}return null;};}function removeEntity(_0x514ecd){return function(_0x124626){if(_0x124626){return _0x124626[_0x425b('0x1a')]()[_0x425b('0x19')](function(){_0x514ecd[_0x425b('0x11')](0xcc)[_0x425b('0x10')]();});}};}function handleEntityNotFound(_0x3c951e){return function(_0x1049e4){if(!_0x1049e4){_0x3c951e[_0x425b('0xf')](0x194);}return _0x1049e4;};}function handleError(_0x5576d3,_0x59a2ab){_0x59a2ab=_0x59a2ab||0x1f4;return function(_0x44a71e){logger[_0x425b('0x1b')](_0x44a71e[_0x425b('0x1c')]);if(_0x44a71e['name']){delete _0x44a71e[_0x425b('0x1d')];}_0x5576d3[_0x425b('0x11')](_0x59a2ab)[_0x425b('0x1e')](_0x44a71e);};}exports['index']=function(_0x16c0a1,_0x2c9e21){var _0x1e5ea9={};var _0x44c9bd=_[_0x425b('0x1f')](db[_0x425b('0x20')][_0x425b('0x21')],function(_0x50b23d){return{'name':_0x50b23d['fieldName'],'type':_0x50b23d['type'][_0x425b('0x22')]};});_0x1e5ea9=qs[_0x425b('0x23')](_0x44c9bd,_0x16c0a1);return interaction[_0x425b('0x24')](_0x425b('0x25'),_0x16c0a1['query'],_0x16c0a1[_0x425b('0x26')],_0x1e5ea9,_0x44c9bd)[_0x425b('0x19')](respondWithFilteredResult(_0x2c9e21,_0x1e5ea9))['catch'](handleError(_0x2c9e21,null));};exports[_0x425b('0x27')]=function(_0x33d5b7,_0x4256d2){var _0x50d8c9={'raw':![],'where':{'id':_0x33d5b7['params']['id']}},_0x60fdcb={};_0x60fdcb['model']=_[_0x425b('0x28')](db['WhatsappInteraction'][_0x425b('0x21')]);_0x60fdcb[_0x425b('0x29')]=_[_0x425b('0x28')](_0x33d5b7['query']);_0x60fdcb[_0x425b('0x2a')]=_[_0x425b('0x2b')](_0x60fdcb[_0x425b('0x2c')],_0x60fdcb[_0x425b('0x29')]);_0x50d8c9[_0x425b('0x2d')]=_['intersection'](_0x60fdcb[_0x425b('0x2c')],qs['fields'](_0x33d5b7[_0x425b('0x29')][_0x425b('0x2e')]));_0x50d8c9[_0x425b('0x2d')]=_0x50d8c9[_0x425b('0x2d')][_0x425b('0x2f')]?_0x50d8c9[_0x425b('0x2d')]:_0x60fdcb['model'];if(_0x33d5b7[_0x425b('0x29')][_0x425b('0x30')]){_0x50d8c9['include']=[{'all':!![]}];}_0x50d8c9=_['merge']({},_0x50d8c9,_0x33d5b7[_0x425b('0x31')]);return db['WhatsappInteraction'][_0x425b('0x32')](_0x50d8c9)[_0x425b('0x19')](handleEntityNotFound(_0x4256d2,null))[_0x425b('0x19')](respondWithResult(_0x4256d2,null))[_0x425b('0x33')](handleError(_0x4256d2,null));};exports[_0x425b('0x34')]=function(_0x4cf85a,_0x27bdd9){return db[_0x425b('0x20')][_0x425b('0x34')](_0x4cf85a[_0x425b('0x35')],{})[_0x425b('0x19')](respondWithResult(_0x27bdd9,0xc9))[_0x425b('0x33')](handleError(_0x27bdd9,null));};exports[_0x425b('0x18')]=function(_0x57df48,_0x116e60){if(_0x57df48['body']['id']){delete _0x57df48['body']['id'];}return db['WhatsappInteraction']['find']({'where':{'id':_0x57df48[_0x425b('0x36')]['id']}})[_0x425b('0x19')](handleEntityNotFound(_0x116e60,null))['then'](saveUpdates(_0x57df48['body'],null))[_0x425b('0x19')](respondWithResult(_0x116e60,null))['catch'](handleError(_0x116e60,null));};exports['destroy']=function(_0x2f5a50,_0x4ae0e2){return db[_0x425b('0x20')][_0x425b('0x32')]({'where':{'id':_0x2f5a50[_0x425b('0x36')]['id']}})[_0x425b('0x19')](handleEntityNotFound(_0x4ae0e2,null))[_0x425b('0x19')](removeEntity(_0x4ae0e2,null))[_0x425b('0x33')](handleError(_0x4ae0e2,null));};exports[_0x425b('0x37')]=function(_0x28b937,_0x6cae3c){return db[_0x425b('0x20')]['describe']()[_0x425b('0x19')](respondWithResult(_0x6cae3c,null))[_0x425b('0x33')](handleError(_0x6cae3c,null));};exports['addMessage']=function(_0x3fc96d,_0x242984){return db['WhatsappMessage'][_0x425b('0x32')]({'where':{'id':_0x3fc96d[_0x425b('0x36')]['id']}})[_0x425b('0x19')](handleEntityNotFound(_0x242984,null))[_0x425b('0x19')](function(_0x5e588c){if(_0x5e588c){return _0x5e588c[_0x425b('0x38')](_0x3fc96d['body'][_0x425b('0x39')],_[_0x425b('0x3a')](_0x3fc96d['body'],[_0x425b('0x39'),'id'])||{});}})['then'](respondWithResult(_0x242984,null))[_0x425b('0x33')](handleError(_0x242984,null));};exports[_0x425b('0x3b')]=function(_0x11ca31,_0x29d4e0){var _0x3c089b={'raw':![],'where':{}};var _0x54bb0c={};var _0x5ad93f={'count':0x0,'rows':[]};return db[_0x425b('0x20')][_0x425b('0x3c')]({'where':{'id':_0x11ca31[_0x425b('0x36')]['id']}})[_0x425b('0x19')](handleEntityNotFound(_0x29d4e0,null))[_0x425b('0x19')](function(_0x3c28a4){if(_0x3c28a4){_0x54bb0c[_0x425b('0x2c')]=_[_0x425b('0x28')](db[_0x425b('0x3d')][_0x425b('0x21')]);_0x54bb0c[_0x425b('0x29')]=_[_0x425b('0x28')](_0x11ca31[_0x425b('0x29')]);_0x54bb0c[_0x425b('0x2a')]=_[_0x425b('0x2b')](_0x54bb0c['model'],_0x54bb0c['query']);_0x3c089b['attributes']=_[_0x425b('0x2b')](_0x54bb0c['model'],qs[_0x425b('0x2e')](_0x11ca31[_0x425b('0x29')][_0x425b('0x2e')]));_0x3c089b[_0x425b('0x2d')]=_0x3c089b[_0x425b('0x2d')][_0x425b('0x2f')]?_0x3c089b['attributes']:_0x54bb0c[_0x425b('0x2c')];if(!_0x11ca31['query'][_0x425b('0x3e')](_0x425b('0x3f'))){_0x3c089b[_0x425b('0x16')]=qs[_0x425b('0x16')](_0x11ca31[_0x425b('0x29')][_0x425b('0x16')]);_0x3c089b[_0x425b('0x13')]=qs[_0x425b('0x13')](_0x11ca31[_0x425b('0x29')]['offset']);}_0x3c089b[_0x425b('0x40')]=qs[_0x425b('0x41')](_0x11ca31[_0x425b('0x29')][_0x425b('0x41')]);_0x3c089b['where']=qs[_0x425b('0x2a')](_[_0x425b('0x42')](_0x11ca31[_0x425b('0x29')],_0x54bb0c[_0x425b('0x2a')]));_0x3c089b[_0x425b('0x43')][_0x425b('0x44')]=_0x3c28a4['id'];if(_0x11ca31[_0x425b('0x29')]['filter']){_0x3c089b[_0x425b('0x43')]=_[_0x425b('0x45')](_0x3c089b[_0x425b('0x43')],{'$or':_[_0x425b('0x1f')](_0x3c089b['attributes'],function(_0x2e7c21){var _0x54bca2={};_0x54bca2[_0x2e7c21]={'$like':'%'+_0x11ca31[_0x425b('0x29')]['filter']+'%'};return _0x54bca2;})});}if(_0x11ca31[_0x425b('0x29')][_0x425b('0x46')]){var _0x292021=_0x11ca31[_0x425b('0x29')][_0x425b('0x46')]['split'](',');var _0x1901cb={};_0x1901cb[_0x292021[0x0]]={'$gte':moment(_0x292021[0x1])[_0x425b('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3c089b[_0x425b('0x43')]=_[_0x425b('0x45')](_0x3c089b['where'],_0x1901cb);}_0x3c089b=_['merge']({},_0x3c089b,_0x11ca31[_0x425b('0x31')]);return db[_0x425b('0x3d')][_0x425b('0x15')]({'where':_0x3c089b[_0x425b('0x43')]})[_0x425b('0x19')](function(_0x44c29f){_0x5ad93f[_0x425b('0x15')]=_0x44c29f;if(_0x11ca31[_0x425b('0x29')]['includeAll']){_0x3c089b[_0x425b('0x48')]=[{'all':!![]}];}return db[_0x425b('0x3d')][_0x425b('0x24')](_0x3c089b);})[_0x425b('0x19')](function(_0x53309f){_0x5ad93f[_0x425b('0x49')]=_0x53309f;return _0x5ad93f;});}})[_0x425b('0x19')](respondWithFilteredResult(_0x29d4e0,_0x3c089b))['catch'](handleError(_0x29d4e0,null));};exports[_0x425b('0x4a')]=function(_0x4b0ee1,_0x39bdef){return db['WhatsappInteraction'][_0x425b('0x32')]({'where':{'id':_0x4b0ee1[_0x425b('0x36')]['id']}})['then'](handleEntityNotFound(_0x39bdef,null))[_0x425b('0x19')](function(_0x212c79){if(_0x212c79){return _0x212c79[_0x425b('0x4b')](_0x4b0ee1[_0x425b('0x35')][_0x425b('0x39')],_['omit'](_0x4b0ee1[_0x425b('0x35')],[_0x425b('0x39'),'id'])||{})['spread'](function(){return db['Tag'][_0x425b('0x24')]({'attributes':['id',_0x425b('0x1d'),_0x425b('0x4c')],'where':{'id':_0x4b0ee1[_0x425b('0x35')][_0x425b('0x39')]}});})[_0x425b('0x19')](function(_0x55af0f){socket[_0x425b('0x4d')](_0x425b('0x4e'),{'id':Number(_0x4b0ee1[_0x425b('0x36')]['id']),'tags':_0x55af0f||[]});return{'id':Number(_0x4b0ee1[_0x425b('0x36')]['id']),'tags':_0x55af0f||[]};});}})['then'](respondWithResult(_0x39bdef,null))['catch'](handleError(_0x39bdef,null));};exports[_0x425b('0x4f')]=function(_0x1e4f3b,_0x58ffcf){return db[_0x425b('0x20')][_0x425b('0x32')]({'where':{'id':_0x1e4f3b[_0x425b('0x36')]['id']}})[_0x425b('0x19')](handleEntityNotFound(_0x58ffcf,null))[_0x425b('0x19')](function(_0x136e61){if(_0x136e61){return _0x136e61['removeTags'](_0x1e4f3b[_0x425b('0x29')][_0x425b('0x39')]);}})[_0x425b('0x19')](respondWithStatusCode(_0x58ffcf,null))[_0x425b('0x33')](handleError(_0x58ffcf,null));};exports['download']=function(_0x35020f,_0x2ec66f){var _0x538e4d=moment()[_0x425b('0x50')]()['toString']();var _0x221eb6=path[_0x425b('0x51')](config['root'],_0x425b('0x52'),'files',_0x425b('0x53'));var _0x1073c1=path['join'](config['root'],_0x425b('0x52'),_0x425b('0x54'),_0x425b('0x55'));var _0x223740=path[_0x425b('0x51')](_0x221eb6,_0x538e4d);var _0x4cfdf6=util[_0x425b('0x47')]('transcript-%d-%s.zip',_0x35020f[_0x425b('0x36')]['id'],_0x538e4d);var _0x22af02=path['join'](_0x221eb6,_0x4cfdf6);var _0x56de43=[];_0x56de43[_0x425b('0x56')]({'model':db[_0x425b('0x57')],'as':_0x425b('0x57'),'attributes':['id','fullname'],'raw':!![]});_0x56de43[_0x425b('0x56')]({'model':db['CmContact'],'as':_0x425b('0x58'),'attributes':['id',_0x425b('0x59'),_0x425b('0x5a')],'raw':!![]});if(_0x35020f['query'][_0x425b('0x55')]){_0x56de43[_0x425b('0x56')]({'model':db[_0x425b('0x5b')],'as':'Attachment','raw':!![]});}var _0x83bea3=[{'model':db[_0x425b('0x3d')],'as':_0x425b('0x5c'),'attributes':['id',_0x425b('0x35'),_0x425b('0x5d'),_0x425b('0x5e'),'secret',_0x425b('0x5f')],'include':_0x56de43}];_0x83bea3[_0x425b('0x56')]({'model':db['WhatsappAccount'],'as':_0x425b('0x60'),'attributes':['id',_0x425b('0x1d')]});_0x83bea3[_0x425b('0x56')]({'model':db[_0x425b('0x57')],'as':_0x425b('0x61'),'attributes':['id',_0x425b('0x62')]});return db[_0x425b('0x20')][_0x425b('0x32')]({'where':{'id':_0x35020f[_0x425b('0x36')]['id']},'include':_0x83bea3})[_0x425b('0x19')](handleEntityNotFound(_0x2ec66f,null))[_0x425b('0x19')](function(_0x5003d9){if(_0x5003d9){var _0x539760=_0x5003d9[_0x425b('0x63')]({'plain':!![]});fs[_0x425b('0x64')](_0x223740);var _0x2ec193={'channel':_0x425b('0x65'),'account':_0x539760[_0x425b('0x60')][_0x425b('0x1d')],'agent':_0x539760[_0x425b('0x61')]?_0x539760[_0x425b('0x61')][_0x425b('0x62')]:_0x425b('0x66'),'createdAt':moment(_0x539760['createdAt'])[_0x425b('0x47')](_0x425b('0x67'))[_0x425b('0x68')](),'closedAt':_0x539760[_0x425b('0x69')]?moment(_0x539760['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x539760[_0x425b('0x6a')],'messages':_(_0x539760[_0x425b('0x5c')])[_0x425b('0x6b')]({'secret':![]})['map'](function(_0x289c2c){if(_0x289c2c[_0x425b('0x5b')]){var _0x59e968=path[_0x425b('0x51')](_0x1073c1,_0x289c2c[_0x425b('0x5b')][_0x425b('0x6c')]);if(fs['existsSync'](_0x59e968)){fs['createReadStream'](_0x59e968)[_0x425b('0x6d')](fs[_0x425b('0x6e')](path[_0x425b('0x51')](_0x223740,_0x289c2c['Attachment'][_0x425b('0x6c')])));}}return{'date':moment(_0x289c2c[_0x425b('0x5d')])[_0x425b('0x47')](_0x425b('0x67'))[_0x425b('0x68')](),'sender':_0x289c2c[_0x425b('0x5e')]===_0x425b('0x6f')?_0x289c2c['User']?_0x289c2c[_0x425b('0x57')][_0x425b('0x62')]:_0x425b('0x70'):_0x289c2c[_0x425b('0x58')][_0x425b('0x59')]+(_0x289c2c[_0x425b('0x58')][_0x425b('0x5a')]?'\x20'+_0x289c2c['Contact'][_0x425b('0x5a')]:''),'body':_0x289c2c['Attachment']?_0x289c2c['Attachment']['basename']:_0x289c2c[_0x425b('0x35')],'direction':_0x289c2c[_0x425b('0x5e')]===_0x425b('0x6f')?'A':'C','secret':_0x289c2c[_0x425b('0x71')],'read':_0x289c2c[_0x425b('0x5f')],'attachment':_0x289c2c[_0x425b('0x5b')]};})['value']()};return ejs[_0x425b('0x72')](path[_0x425b('0x51')](config[_0x425b('0x73')],_0x425b('0x52'),'views','downloadInteraction.ejs'),{'interaction':_0x2ec193})['then'](function(_0x38367b){var _0x173382=path['join'](_0x223740,_0x425b('0x74')+_0x539760['id']+'-'+_0x538e4d+_0x425b('0x75'));var _0x50e1fc={'path':_0x173382,'channel':_0x425b('0x65'),'interactionId':_0x539760['id']};return pdf['createPdfFromHTML'](_0x38367b,_0x50e1fc);})[_0x425b('0x19')](function(){return new BPromise(function(_0x4b0526,_0x4c8365){zipdir(_0x223740,{'saveTo':_0x22af02},function(_0x4e9ceb,_0x206f4d){if(_0x4e9ceb)return _0x4c8365(_0x4e9ceb);return _0x4b0526(_0x206f4d);});})[_0x425b('0x19')](function(){return new BPromise(function(_0x3e8a1e,_0xd0a059){rimraf(_0x223740,function(_0x2e0d38){if(_0x2e0d38)_0xd0a059(_0x2e0d38);return _0x3e8a1e();});});})[_0x425b('0x19')](function(){return _0x2ec66f['download'](_0x22af02,_0x4cfdf6,function(_0x17462c){if(_0x17462c){console[_0x425b('0x76')]('err',_0x17462c);}else{fs[_0x425b('0x77')](_0x22af02);}});});});}else{return _0x2ec66f[_0x425b('0xf')](0xc8);}})[_0x425b('0x33')](handleError(_0x2ec66f,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 45b4f60..bc21c47 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 _0xc68d=['getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','WhatsappInteraction','setMaxListeners','save','update','remove'];(function(_0x54ac2a,_0x26be6b){var _0x30100e=function(_0x1c5976){while(--_0x1c5976){_0x54ac2a['push'](_0x54ac2a['shift']());}};_0x30100e(++_0x26be6b);}(_0xc68d,0x17a));var _0xdc68=function(_0x46978b,_0x4377ee){_0x46978b=_0x46978b-0x0;var _0x36535d=_0xc68d[_0x46978b];return _0x36535d;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xdc68('0x0'))['db'][_0xdc68('0x1')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xdc68('0x2')](0x0);var events={'afterCreate':_0xdc68('0x3'),'afterUpdate':_0xdc68('0x4'),'afterDestroy':_0xdc68('0x5')};function emitEvent(_0x402e65){return function(_0x284911,_0x4957fc,_0x36f545){_0x284911[_0xdc68('0x6')]({'attributes':['id'],'raw':!![]})[_0xdc68('0x7')](function(_0x5204af){_0x284911[_0xdc68('0x8')](_0xdc68('0x9'),_0x5204af[_0xdc68('0xa')](function(_0x5aefc7){return{'id':_0x5aefc7['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x284911['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdc68('0x7')](function(_0x252445){_0x284911[_0xdc68('0x8')](_0xdc68('0xb'),_0x252445['length']);WhatsappInteractionEvents[_0xdc68('0xc')](_0x402e65+':'+_0x284911['id'],_0x284911);WhatsappInteractionEvents[_0xdc68('0xc')](_0x402e65,_0x284911);_0x36f545(null);})[_0xdc68('0xd')](_0x36f545(null));};}for(var e in events){if(events[_0xdc68('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xdc68('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x4b07=['hook','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x55c748,_0x371f2c){var _0x15ad95=function(_0xf0a39d){while(--_0xf0a39d){_0x55c748['push'](_0x55c748['shift']());}};_0x15ad95(++_0x371f2c);}(_0x4b07,0x1d6));var _0x74b0=function(_0x203777,_0x1ec756){_0x203777=_0x203777-0x0;var _0x2b68f2=_0x4b07[_0x203777];return _0x2b68f2;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x74b0('0x0'))['db'][_0x74b0('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0x74b0('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x74b0('0x3')](0x0);var events={'afterCreate':_0x74b0('0x4'),'afterUpdate':_0x74b0('0x5'),'afterDestroy':'remove'};function emitEvent(_0x397b2a){return function(_0x499095,_0x5041e6,_0x49713c){_0x499095[_0x74b0('0x6')]({'attributes':['id'],'raw':!![]})[_0x74b0('0x7')](function(_0x48ec87){_0x499095['setDataValue'](_0x74b0('0x8'),_0x48ec87['map'](function(_0x2fb592){return{'id':_0x2fb592['id']};}));return WhatsappMessage[_0x74b0('0x9')]({'where':{'WhatsappInteractionId':_0x499095['id'],'direction':'in','read':![]},'raw':!![]});})[_0x74b0('0x7')](function(_0x419fab){_0x499095[_0x74b0('0xa')](_0x74b0('0xb'),_0x419fab[_0x74b0('0xc')]);WhatsappInteractionEvents[_0x74b0('0xd')](_0x397b2a+':'+_0x499095['id'],_0x499095);WhatsappInteractionEvents[_0x74b0('0xd')](_0x397b2a,_0x499095);_0x49713c(null);})[_0x74b0('0xe')](_0x49713c(null));};}for(var e in events){if(events[_0x74b0('0xf')](e)){var event=events[e];WhatsappInteraction[_0x74b0('0x10')](e,emitEvent(event));}}module[_0x74b0('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index d00c2cd..f38f7e3 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 _0xcc99=['request-promise','path','rimraf','../../config/environment','exports','define','WhatsappInteraction','whatsapp_interactions','closed','closedAt','lodash','util','api','moment'];(function(_0x57a50d,_0x2871f8){var _0x1b25b3=function(_0x45691e){while(--_0x45691e){_0x57a50d['push'](_0x57a50d['shift']());}};_0x1b25b3(++_0x2871f8);}(_0xcc99,0x168));var _0x9cc9=function(_0x5c505a,_0x51b4fa){_0x5c505a=_0x5c505a-0x0;var _0x2d20f2=_0xcc99[_0x5c505a];return _0x2d20f2;};'use strict';var _=require(_0x9cc9('0x0'));var util=require(_0x9cc9('0x1'));var logger=require('../../config/logger')(_0x9cc9('0x2'));var moment=require(_0x9cc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x9cc9('0x4'));var fs=require('fs');var path=require(_0x9cc9('0x5'));var rimraf=require(_0x9cc9('0x6'));var config=require(_0x9cc9('0x7'));var attributes=require('./whatsappInteraction.attributes');module[_0x9cc9('0x8')]=function(_0xfab5aa,_0x22bbbd){return _0xfab5aa[_0x9cc9('0x9')](_0x9cc9('0xa'),attributes,{'tableName':_0x9cc9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5541db,_0xd95e6b,_0x271741){if(_0x5541db['changed'](_0x9cc9('0xc'))){_0x5541db[_0x9cc9('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x271741(null,_0x5541db);}}});}; \ No newline at end of file +var _0xd530=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappInteraction','whatsapp_interactions','changed','closed'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0xd530,0x7a));var _0x0d53=function(_0x18f838,_0x10e925){_0x18f838=_0x18f838-0x0;var _0x2cc10f=_0xd530[_0x18f838];return _0x2cc10f;};'use strict';var _=require(_0x0d53('0x0'));var util=require('util');var logger=require(_0x0d53('0x1'))(_0x0d53('0x2'));var moment=require(_0x0d53('0x3'));var BPromise=require(_0x0d53('0x4'));var rp=require(_0x0d53('0x5'));var fs=require('fs');var path=require(_0x0d53('0x6'));var rimraf=require(_0x0d53('0x7'));var config=require(_0x0d53('0x8'));var attributes=require('./whatsappInteraction.attributes');module[_0x0d53('0x9')]=function(_0x6a30d4,_0x495ab1){return _0x6a30d4['define'](_0x0d53('0xa'),attributes,{'tableName':_0x0d53('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1edc3b,_0x2fece9,_0xbc90ec){if(_0x1edc3b[_0x0d53('0xc')](_0x0d53('0xd'))){_0x1edc3b[_0x0d53('0xe')]=moment()[_0x0d53('0xf')](_0x0d53('0x10'));}_0xbc90ec(null,_0x1edc3b);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index e34e824..d62e1e9 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 _0x7b7c=['spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','WhatsappInteraction,\x20%s,\x20%s','update','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','catch','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','omit'];(function(_0x37eafe,_0x503d4c){var _0x1be189=function(_0x4790f7){while(--_0x4790f7){_0x37eafe['push'](_0x37eafe['shift']());}};_0x1be189(++_0x503d4c);}(_0x7b7c,0x152));var _0xc7b7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7b7c[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xc7b7('0x0'));var util=require(_0xc7b7('0x1'));var moment=require('moment');var BPromise=require(_0xc7b7('0x2'));var rs=require(_0xc7b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7b7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc7b7('0x5'))(_0xc7b7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc7b7('0x7')]['http']({'port':0x232a});config[_0xc7b7('0x8')]=_[_0xc7b7('0x9')](config[_0xc7b7('0x8')],{'host':_0xc7b7('0xa'),'port':0x18eb});var socket=require(_0xc7b7('0xb'))(new Redis(config[_0xc7b7('0x8')]));require(_0xc7b7('0xc'))[_0xc7b7('0xd')](socket);function respondWithRpcPromise(_0x139cd7,_0x4271d1,_0x5c08fb){return new BPromise(function(_0x188471,_0x47638a){return client[_0xc7b7('0xe')](_0x139cd7,_0x5c08fb)[_0xc7b7('0xf')](function(_0x1a5f60){logger[_0xc7b7('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x4271d1,'request\x20sent');logger[_0xc7b7('0x11')](_0xc7b7('0x12'),_0x4271d1,_0xc7b7('0x13'),JSON[_0xc7b7('0x14')](_0x1a5f60));if(_0x1a5f60[_0xc7b7('0x15')]){if(_0x1a5f60[_0xc7b7('0x15')][_0xc7b7('0x16')]===0x1f4){logger[_0xc7b7('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x4271d1,_0x1a5f60[_0xc7b7('0x15')][_0xc7b7('0x17')]);return _0x47638a(_0x1a5f60[_0xc7b7('0x15')][_0xc7b7('0x17')]);}logger[_0xc7b7('0x15')](_0xc7b7('0x18'),_0x4271d1,_0x1a5f60['error'][_0xc7b7('0x17')]);return _0x188471(_0x1a5f60[_0xc7b7('0x15')][_0xc7b7('0x17')]);}else{logger[_0xc7b7('0x10')](_0xc7b7('0x18'),_0x4271d1,'request\x20sent');_0x188471(_0x1a5f60['result']['message']);}})['catch'](function(_0x53749b){logger[_0xc7b7('0x15')](_0xc7b7('0x18'),_0x4271d1,_0x53749b);_0x47638a(_0x53749b);});});}exports['UpdateWhatsappInteraction']=function(_0x2b6654){var _0x4db659=this;return new Promise(function(_0x4075d4,_0x4201af){return db['WhatsappInteraction'][_0xc7b7('0x19')](_0x2b6654[_0xc7b7('0x1a')],{'raw':_0x2b6654[_0xc7b7('0x1b')]?_0x2b6654[_0xc7b7('0x1b')][_0xc7b7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b6654[_0xc7b7('0x1b')]?_0x2b6654[_0xc7b7('0x1b')][_0xc7b7('0x1d')]||null:null,'attributes':_0x2b6654[_0xc7b7('0x1b')]?_0x2b6654[_0xc7b7('0x1b')][_0xc7b7('0x1e')]||null:null,'limit':_0x2b6654[_0xc7b7('0x1b')]?_0x2b6654[_0xc7b7('0x1b')][_0xc7b7('0x1f')]||null:null})[_0xc7b7('0xf')](function(_0x2ee8ea){logger[_0xc7b7('0x10')]('UpdateWhatsappInteraction',_0x2b6654);logger[_0xc7b7('0x11')](_0xc7b7('0x20'),_0x2b6654,JSON[_0xc7b7('0x14')](_0x2ee8ea));_0x4075d4(_0x2ee8ea);})[_0xc7b7('0x21')](function(_0x26bc90){logger[_0xc7b7('0x15')]('UpdateWhatsappInteraction',_0x26bc90[_0xc7b7('0x17')],_0x2b6654);_0x4201af(_0x4db659[_0xc7b7('0x15')](0x1f4,_0x26bc90['message']));});});};exports[_0xc7b7('0x22')]=function(_0x43726d){return new Promise(function(_0x4b089e,_0xe52413){return db[_0xc7b7('0x23')][_0xc7b7('0x24')]({'where':_0x43726d['options']?_0x43726d[_0xc7b7('0x1b')][_0xc7b7('0x1d')]||null:null})[_0xc7b7('0xf')](function(_0x5e320d){if(_0x5e320d){return _0x5e320d[_0xc7b7('0x25')](_0x43726d['body'][_0xc7b7('0x26')],_[_0xc7b7('0x27')](_0x43726d[_0xc7b7('0x1a')],[_0xc7b7('0x26'),'id'])||{});}})[_0xc7b7('0x28')](function(_0x3c6f8d){logger['info'](_0xc7b7('0x29'),_0x43726d);logger['debug'](_0xc7b7('0x29'),_0x43726d,JSON[_0xc7b7('0x14')](_0x3c6f8d));_0x4b089e(_0x3c6f8d);})[_0xc7b7('0x21')](function(_0x5c9b27){logger[_0xc7b7('0x15')](_0xc7b7('0x29'),_0x5c9b27[_0xc7b7('0x17')],_0x43726d);_0xe52413(_this[_0xc7b7('0x15')](0x1f4,_0x5c9b27[_0xc7b7('0x17')]));});});}; \ No newline at end of file +var _0xf0ed=['error','code','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','then','addTags','ids','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./whatsappInteraction.socket','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x56c18c,_0x59310a){var _0x52d5c1=function(_0xd32966){while(--_0xd32966){_0x56c18c['push'](_0x56c18c['shift']());}};_0x52d5c1(++_0x59310a);}(_0xf0ed,0x104));var _0xdf0e=function(_0x334f9a,_0x542f01){_0x334f9a=_0x334f9a-0x0;var _0x2b219d=_0xf0ed[_0x334f9a];return _0x2b219d;};'use strict';var _=require(_0xdf0e('0x0'));var util=require(_0xdf0e('0x1'));var moment=require(_0xdf0e('0x2'));var BPromise=require('bluebird');var rs=require(_0xdf0e('0x3'));var fs=require('fs');var Redis=require(_0xdf0e('0x4'));var db=require(_0xdf0e('0x5'))['db'];var utils=require(_0xdf0e('0x6'));var logger=require(_0xdf0e('0x7'))(_0xdf0e('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf0e('0x9'));var client=jayson['client'][_0xdf0e('0xa')]({'port':0x232a});config[_0xdf0e('0xb')]=_[_0xdf0e('0xc')](config[_0xdf0e('0xb')],{'host':_0xdf0e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdf0e('0xb')]));require(_0xdf0e('0xe'))['register'](socket);function respondWithRpcPromise(_0x20ece4,_0x44bd95,_0x34dc66){return new BPromise(function(_0x1cec67,_0x5e7a24){return client['request'](_0x20ece4,_0x34dc66)['then'](function(_0x4cffed){logger['info'](_0xdf0e('0xf'),_0x44bd95,_0xdf0e('0x10'));logger[_0xdf0e('0x11')](_0xdf0e('0x12'),_0x44bd95,'request\x20sent',JSON[_0xdf0e('0x13')](_0x4cffed));if(_0x4cffed[_0xdf0e('0x14')]){if(_0x4cffed[_0xdf0e('0x14')][_0xdf0e('0x15')]===0x1f4){logger[_0xdf0e('0x14')](_0xdf0e('0xf'),_0x44bd95,_0x4cffed[_0xdf0e('0x14')][_0xdf0e('0x16')]);return _0x5e7a24(_0x4cffed[_0xdf0e('0x14')][_0xdf0e('0x16')]);}logger[_0xdf0e('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x44bd95,_0x4cffed['error'][_0xdf0e('0x16')]);return _0x1cec67(_0x4cffed['error']['message']);}else{logger[_0xdf0e('0x17')](_0xdf0e('0xf'),_0x44bd95,'request\x20sent');_0x1cec67(_0x4cffed[_0xdf0e('0x18')][_0xdf0e('0x16')]);}})[_0xdf0e('0x19')](function(_0x4f21cf){logger[_0xdf0e('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x44bd95,_0x4f21cf);_0x5e7a24(_0x4f21cf);});});}exports[_0xdf0e('0x1a')]=function(_0x2e7a6f){var _0x70b1d0=this;return new Promise(function(_0x4be253,_0x4196a0){return db[_0xdf0e('0x1b')]['update'](_0x2e7a6f[_0xdf0e('0x1c')],{'raw':_0x2e7a6f[_0xdf0e('0x1d')]?_0x2e7a6f[_0xdf0e('0x1d')][_0xdf0e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e7a6f['options']?_0x2e7a6f[_0xdf0e('0x1d')][_0xdf0e('0x1f')]||null:null,'attributes':_0x2e7a6f[_0xdf0e('0x1d')]?_0x2e7a6f[_0xdf0e('0x1d')][_0xdf0e('0x20')]||null:null,'limit':_0x2e7a6f[_0xdf0e('0x1d')]?_0x2e7a6f[_0xdf0e('0x1d')][_0xdf0e('0x21')]||null:null})['then'](function(_0x328dd3){logger[_0xdf0e('0x17')](_0xdf0e('0x1a'),_0x2e7a6f);logger['debug'](_0xdf0e('0x1a'),_0x2e7a6f,JSON[_0xdf0e('0x13')](_0x328dd3));_0x4be253(_0x328dd3);})['catch'](function(_0x359c2c){logger[_0xdf0e('0x14')](_0xdf0e('0x1a'),_0x359c2c['message'],_0x2e7a6f);_0x4196a0(_0x70b1d0[_0xdf0e('0x14')](0x1f4,_0x359c2c[_0xdf0e('0x16')]));});});};exports[_0xdf0e('0x22')]=function(_0x1ab645){return new Promise(function(_0x492157,_0x55f81e){return db[_0xdf0e('0x1b')][_0xdf0e('0x23')]({'where':_0x1ab645[_0xdf0e('0x1d')]?_0x1ab645[_0xdf0e('0x1d')]['where']||null:null})[_0xdf0e('0x24')](function(_0x263481){if(_0x263481){return _0x263481[_0xdf0e('0x25')](_0x1ab645['body'][_0xdf0e('0x26')],_['omit'](_0x1ab645[_0xdf0e('0x1c')],[_0xdf0e('0x26'),'id'])||{});}})['spread'](function(_0x46deb0){logger['info'](_0xdf0e('0x27'),_0x1ab645);logger['debug'](_0xdf0e('0x27'),_0x1ab645,JSON[_0xdf0e('0x13')](_0x46deb0));_0x492157(_0x46deb0);})['catch'](function(_0x1b19be){logger['error']('AddTags',_0x1b19be[_0xdf0e('0x16')],_0x1ab645);_0x55f81e(_this[_0xdf0e('0x14')](0x1f4,_0x1b19be[_0xdf0e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index b22a373..1d3541e 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 _0x7a5e=['removeListener','length','whatsappInteraction:','./whatsappInteraction.events','save','update','emit'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x7a5e,0x1d1));var _0xe7a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a5e[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappInteractionEvents=require(_0xe7a5('0x0'));var events=[_0xe7a5('0x1'),'remove',_0xe7a5('0x2')];function createListener(_0xdee0a6,_0x5d3778){return function(_0x434dbe){_0x5d3778[_0xe7a5('0x3')](_0xdee0a6,_0x434dbe);};}function removeListener(_0x4b8286,_0x45022c){return function(){WhatsappInteractionEvents[_0xe7a5('0x4')](_0x4b8286,_0x45022c);};}exports['register']=function(_0x3ed3db){for(var _0x50269f=0x0,_0x5d5400=events[_0xe7a5('0x5')];_0x50269f<_0x5d5400;_0x50269f++){var _0x3ba0e9=events[_0x50269f];var _0x390647=createListener(_0xe7a5('0x6')+_0x3ba0e9,_0x3ed3db);WhatsappInteractionEvents['on'](_0x3ba0e9,_0x390647);}}; \ No newline at end of file +var _0x5c3e=['save','remove','emit','removeListener','register','whatsappInteraction:'];(function(_0x3fbdc9,_0x13a05b){var _0x2a053=function(_0x19c6c2){while(--_0x19c6c2){_0x3fbdc9['push'](_0x3fbdc9['shift']());}};_0x2a053(++_0x13a05b);}(_0x5c3e,0x1b0));var _0xe5c3=function(_0x195d6e,_0x1b8568){_0x195d6e=_0x195d6e-0x0;var _0x21a1a4=_0x5c3e[_0x195d6e];return _0x21a1a4;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xe5c3('0x0'),_0xe5c3('0x1'),'update'];function createListener(_0x3f6f2f,_0x4400e4){return function(_0x20901b){_0x4400e4[_0xe5c3('0x2')](_0x3f6f2f,_0x20901b);};}function removeListener(_0x282421,_0x3d3c49){return function(){WhatsappInteractionEvents[_0xe5c3('0x3')](_0x282421,_0x3d3c49);};}exports[_0xe5c3('0x4')]=function(_0x39a987){for(var _0x354e37=0x0,_0x19d552=events['length'];_0x354e37<_0x19d552;_0x354e37++){var _0x4145d3=events[_0x354e37];var _0x47240d=createListener(_0xe5c3('0x5')+_0x4145d3,_0x39a987);WhatsappInteractionEvents['on'](_0x4145d3,_0x47240d);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 82743ae..90c5307 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 _0x2539=['describe','show','post','tracked','whatsapp','whatsappmessage:create','/:id/status','status','put','/:id','update','/:id/accept','/:id/reject','reject','delete','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x1d70db,_0x142b63){var _0x3060c6=function(_0x347866){while(--_0x347866){_0x1d70db['push'](_0x1d70db['shift']());}};_0x3060c6(++_0x142b63);}(_0x2539,0x195));var _0x9253=function(_0x257ba0,_0x3e3f9f){_0x257ba0=_0x257ba0-0x0;var _0x1db9d1=_0x2539[_0x257ba0];return _0x1db9d1;};'use strict';var multer=require('multer');var util=require(_0x9253('0x0'));var path=require(_0x9253('0x1'));var timeout=require(_0x9253('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9253('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9253('0x4'));var config=require(_0x9253('0x5'));var controller=require(_0x9253('0x6'));router[_0x9253('0x7')]('/',auth[_0x9253('0x8')](),controller[_0x9253('0x9')]);router['get'](_0x9253('0xa'),auth[_0x9253('0x8')](),controller[_0x9253('0xb')]);router[_0x9253('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x9253('0xc')]);router[_0x9253('0xd')]('/',auth[_0x9253('0x8')](),interaction[_0x9253('0xe')](_0x9253('0xf'),_0x9253('0x10')),controller['create']);router[_0x9253('0xd')](_0x9253('0x11'),controller[_0x9253('0x12')]);router[_0x9253('0x13')](_0x9253('0x14'),auth[_0x9253('0x8')](),controller[_0x9253('0x15')]);router[_0x9253('0x13')](_0x9253('0x16'),auth['isAuthenticated'](),controller['accept']);router[_0x9253('0x13')](_0x9253('0x17'),auth[_0x9253('0x8')](),controller[_0x9253('0x18')]);router[_0x9253('0x19')]('/:id',auth[_0x9253('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcb44=['../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','show','post','whatsapp','whatsappmessage:create','create','/:id/status','status','/:id','put','accept','reject','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2c5a1b,_0x5eb332){var _0x2c557c=function(_0x398d3b){while(--_0x398d3b){_0x2c5a1b['push'](_0x2c5a1b['shift']());}};_0x2c557c(++_0x5eb332);}(_0xcb44,0xfd));var _0x4cb4=function(_0x1a3e33,_0xe419f4){_0x1a3e33=_0x1a3e33-0x0;var _0x545085=_0xcb44[_0x1a3e33];return _0x545085;};'use strict';var multer=require(_0x4cb4('0x0'));var util=require(_0x4cb4('0x1'));var path=require('path');var timeout=require(_0x4cb4('0x2'));var express=require(_0x4cb4('0x3'));var router=express[_0x4cb4('0x4')]();var fs_extra=require(_0x4cb4('0x5'));var auth=require(_0x4cb4('0x6'));var interaction=require(_0x4cb4('0x7'));var config=require(_0x4cb4('0x8'));var controller=require(_0x4cb4('0x9'));router[_0x4cb4('0xa')]('/',auth[_0x4cb4('0xb')](),controller[_0x4cb4('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x4cb4('0xa')]('/:id',auth[_0x4cb4('0xb')](),controller[_0x4cb4('0xd')]);router[_0x4cb4('0xe')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x4cb4('0xf'),_0x4cb4('0x10')),controller[_0x4cb4('0x11')]);router[_0x4cb4('0xe')](_0x4cb4('0x12'),controller[_0x4cb4('0x13')]);router['put'](_0x4cb4('0x14'),auth[_0x4cb4('0xb')](),controller['update']);router[_0x4cb4('0x15')]('/:id/accept',auth[_0x4cb4('0xb')](),controller[_0x4cb4('0x16')]);router['put']('/:id/reject',auth[_0x4cb4('0xb')](),controller[_0x4cb4('0x17')]);router['delete'](_0x4cb4('0x14'),auth[_0x4cb4('0xb')](),controller[_0x4cb4('0x18')]);module[_0x4cb4('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index fe6a3d1..711e166 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 _0x5282=['DATE','sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x116074,_0x450e32){var _0x1404eb=function(_0x429cdf){while(--_0x429cdf){_0x116074['push'](_0x116074['shift']());}};_0x1404eb(++_0x450e32);}(_0x5282,0x111));var _0x2528=function(_0x57474e,_0x4178b8){_0x57474e=_0x57474e-0x0;var _0xfaae8c=_0x5282[_0x57474e];return _0xfaae8c;};'use strict';var Sequelize=require(_0x2528('0x0'));module['exports']={'body':{'type':Sequelize[_0x2528('0x1')](_0x2528('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x2528('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2528('0x4')]('in',_0x2528('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x2528('0x6')](0xbe)},'phone':{'type':Sequelize[_0x2528('0x6')]},'readAt':{'type':Sequelize[_0x2528('0x7')]},'secret':{'type':Sequelize[_0x2528('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x2528('0x6')]},'providerResponse':{'type':Sequelize[_0x2528('0x1')]}}; \ No newline at end of file +var _0xc749=['exports','TEXT','medium','BOOLEAN','out','STRING','DATE'];(function(_0x42200b,_0x1370ba){var _0x2abe3e=function(_0x470bc2){while(--_0x470bc2){_0x42200b['push'](_0x42200b['shift']());}};_0x2abe3e(++_0x1370ba);}(_0xc749,0x1c0));var _0x9c74=function(_0x4aa58d,_0x491e17){_0x4aa58d=_0x4aa58d-0x0;var _0x35e87e=_0xc749[_0x4aa58d];return _0x35e87e;};'use strict';var Sequelize=require('sequelize');module[_0x9c74('0x0')]={'body':{'type':Sequelize[_0x9c74('0x1')](_0x9c74('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9c74('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x9c74('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x9c74('0x5')]},'readAt':{'type':Sequelize[_0x9c74('0x6')]},'secret':{'type':Sequelize[_0x9c74('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x9c74('0x5')]},'providerResponse':{'type':Sequelize[_0x9c74('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index a456eaf..7900e97 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 _0xe472=['UserId','agent','get','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','ContactId','sequelize','QueryTypes','contact','email','internal','manual','SIP/%s','channel','event','accept','EventManager','reject','WhatsappInteraction','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','SELECT','User','interface','motionChannel','WhatsappAccount','WhatsappAccountId','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','jayson/promise','client','http','request','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end','stack','name','send','index','map','WhatsappMessage','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','rawAttributes','length','create','body','find','destroy','describe','whatsapp-interactions','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xc46719,_0x1c58ec){var _0x10e8ec=function(_0xa5c887){while(--_0xa5c887){_0xc46719['push'](_0xc46719['shift']());}};_0x10e8ec(++_0x1c58ec);}(_0xe472,0x13c));var _0x2e47=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe472[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x2e47('0x0'));var rimraf=require(_0x2e47('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2e47('0x2'));var rp=require(_0x2e47('0x3'));var moment=require(_0x2e47('0x4'));var BPromise=require(_0x2e47('0x5'));var Mustache=require(_0x2e47('0x6'));var util=require(_0x2e47('0x7'));var path=require(_0x2e47('0x8'));var sox=require(_0x2e47('0x9'));var csv=require(_0x2e47('0xa'));var ejs=require(_0x2e47('0xb'));var fs=require('fs');var fs_extra=require(_0x2e47('0xc'));var _=require(_0x2e47('0xd'));var squel=require(_0x2e47('0xe'));var crypto=require(_0x2e47('0xf'));var jsforce=require(_0x2e47('0x10'));var deskjs=require(_0x2e47('0x11'));var toCsv=require(_0x2e47('0xa'));var querystring=require(_0x2e47('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2e47('0x13'));var qs=require(_0x2e47('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2e47('0x15'));var logger=require(_0x2e47('0x16'))('api');var utils=require(_0x2e47('0x17'));var config=require(_0x2e47('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2e47('0x19'))['db'];config['redis']=_[_0x2e47('0x1a')](config[_0x2e47('0x1b')],{'host':_0x2e47('0x1c'),'port':0x18eb});var socket=require(_0x2e47('0x1d'))(new Redis(config['redis']));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0x2e47('0x1e'));var client=jayson[_0x2e47('0x1f')][_0x2e47('0x20')]({'port':0x232c});var client9002=jayson[_0x2e47('0x1f')][_0x2e47('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5c8f6a,_0x517b37,_0x7ece6d,_0x3dd5c1){return new BPromise(function(_0x37c191,_0x30da39){var _0x473373=_0x3dd5c1||client;return _0x473373[_0x2e47('0x21')](_0x5c8f6a,_0x7ece6d)['then'](function(_0x36fb35){logger[_0x2e47('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x517b37,_0x2e47('0x23'));logger[_0x2e47('0x24')](_0x2e47('0x25'),_0x517b37,_0x2e47('0x23'),JSON[_0x2e47('0x26')](_0x36fb35));if(_0x36fb35[_0x2e47('0x27')]){if(_0x36fb35[_0x2e47('0x27')][_0x2e47('0x28')]===0x1f4){logger[_0x2e47('0x27')](_0x2e47('0x29'),_0x517b37,_0x36fb35[_0x2e47('0x27')]['message']);return _0x30da39(_0x36fb35[_0x2e47('0x27')][_0x2e47('0x2a')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x517b37,_0x36fb35[_0x2e47('0x27')][_0x2e47('0x2a')]);return _0x37c191(_0x36fb35[_0x2e47('0x27')][_0x2e47('0x2a')]);}else{logger['info'](_0x2e47('0x29'),_0x517b37,_0x2e47('0x23'));_0x37c191(_0x36fb35['result'][_0x2e47('0x2a')]);}})[_0x2e47('0x2b')](function(_0xe36243){logger[_0x2e47('0x27')](_0x2e47('0x29'),_0x517b37,_0xe36243);_0x30da39(_0xe36243);});});}function respondWithStatusCode(_0x5b257d,_0x3cd7c0){_0x3cd7c0=_0x3cd7c0||0xcc;return function(_0x1cb3ab){if(_0x1cb3ab){return _0x5b257d[_0x2e47('0x2c')](_0x3cd7c0);}return _0x5b257d[_0x2e47('0x2d')](_0x3cd7c0)['end']();};}function respondWithResult(_0xa6e0c7,_0x3bb16c){_0x3bb16c=_0x3bb16c||0xc8;return function(_0x142dbd){if(_0x142dbd){return _0xa6e0c7[_0x2e47('0x2d')](_0x3bb16c)[_0x2e47('0x2e')](_0x142dbd);}};}function respondWithFilteredResult(_0x407cfc,_0x78b277){return function(_0x5e75da){if(_0x5e75da){var _0x6ee1b=typeof _0x78b277[_0x2e47('0x2f')]===_0x2e47('0x30')&&typeof _0x78b277[_0x2e47('0x31')]==='undefined';var _0x52818d=_0x5e75da[_0x2e47('0x32')];var _0x356ed4=_0x6ee1b?0x0:_0x78b277[_0x2e47('0x2f')];var _0x283e1f=_0x6ee1b?_0x5e75da[_0x2e47('0x32')]:_0x78b277[_0x2e47('0x2f')]+_0x78b277[_0x2e47('0x31')];var _0x4aaf58;if(_0x283e1f>=_0x52818d){_0x283e1f=_0x52818d;_0x4aaf58=0xc8;}else{_0x4aaf58=0xce;}_0x407cfc[_0x2e47('0x2d')](_0x4aaf58);return _0x407cfc[_0x2e47('0x33')](_0x2e47('0x34'),_0x356ed4+'-'+_0x283e1f+'/'+_0x52818d)[_0x2e47('0x2e')](_0x5e75da);}return null;};}function patchUpdates(_0xc9a55f){return function(_0x131a0d){try{jsonpatch[_0x2e47('0x35')](_0x131a0d,_0xc9a55f,!![]);}catch(_0xb0cb71){return BPromise['reject'](_0xb0cb71);}return _0x131a0d[_0x2e47('0x36')]();};}function saveUpdates(_0x159e98,_0x7fa9bc){return function(_0x5b6185){if(_0x5b6185){return _0x5b6185[_0x2e47('0x37')](_0x159e98)[_0x2e47('0x38')](function(_0x5d66ea){return _0x5d66ea;});}return null;};}function removeEntity(_0x558385,_0x440132){return function(_0xff3191){if(_0xff3191){return _0xff3191['destroy']()['then'](function(){_0x558385[_0x2e47('0x2d')](0xcc)[_0x2e47('0x39')]();});}};}function handleEntityNotFound(_0x146434,_0x23cfb3){return function(_0x5452c4){if(!_0x5452c4){_0x146434[_0x2e47('0x2c')](0x194);}return _0x5452c4;};}function handleError(_0x224b44,_0x23d4c8){_0x23d4c8=_0x23d4c8||0x1f4;return function(_0x1eae3b){logger[_0x2e47('0x27')](_0x1eae3b[_0x2e47('0x3a')]);if(_0x1eae3b[_0x2e47('0x3b')]){delete _0x1eae3b['name'];}_0x224b44[_0x2e47('0x2d')](_0x23d4c8)[_0x2e47('0x3c')](_0x1eae3b);};}exports[_0x2e47('0x3d')]=function(_0x23a813,_0x7b09f7){var _0x3e8485={},_0x49b4c3={},_0xe4907={'count':0x0,'rows':[]};var _0x437e9b=_[_0x2e47('0x3e')](db[_0x2e47('0x3f')]['rawAttributes'],function(_0x4771f4){return{'name':_0x4771f4['fieldName'],'type':_0x4771f4[_0x2e47('0x40')]['key']};});_0x49b4c3[_0x2e47('0x41')]=_[_0x2e47('0x3e')](_0x437e9b,_0x2e47('0x3b'));_0x49b4c3[_0x2e47('0x42')]=_[_0x2e47('0x43')](_0x23a813[_0x2e47('0x42')]);_0x49b4c3['filters']=_[_0x2e47('0x44')](_0x49b4c3['model'],_0x49b4c3[_0x2e47('0x42')]);_0x3e8485[_0x2e47('0x45')]=_['intersection'](_0x49b4c3[_0x2e47('0x41')],qs[_0x2e47('0x46')](_0x23a813['query'][_0x2e47('0x46')]));_0x3e8485[_0x2e47('0x45')]=_0x3e8485[_0x2e47('0x45')]['length']?_0x3e8485[_0x2e47('0x45')]:_0x49b4c3['model'];if(!_0x23a813[_0x2e47('0x42')][_0x2e47('0x47')](_0x2e47('0x48'))){_0x3e8485[_0x2e47('0x31')]=qs[_0x2e47('0x31')](_0x23a813[_0x2e47('0x42')][_0x2e47('0x31')]);_0x3e8485[_0x2e47('0x2f')]=qs[_0x2e47('0x2f')](_0x23a813[_0x2e47('0x42')][_0x2e47('0x2f')]);}_0x3e8485[_0x2e47('0x49')]=qs[_0x2e47('0x4a')](_0x23a813[_0x2e47('0x42')]['sort']);_0x3e8485[_0x2e47('0x4b')]=qs['filters'](_['pick'](_0x23a813[_0x2e47('0x42')],_0x49b4c3[_0x2e47('0x4c')]),_0x437e9b);if(_0x23a813[_0x2e47('0x42')]['filter']){_0x3e8485[_0x2e47('0x4b')]=_[_0x2e47('0x4d')](_0x3e8485[_0x2e47('0x4b')],{'$or':_[_0x2e47('0x3e')](_0x437e9b,function(_0x1824cb){if(_0x1824cb[_0x2e47('0x40')]!==_0x2e47('0x4e')){var _0x3723a1={};_0x3723a1[_0x1824cb[_0x2e47('0x3b')]]={'$like':'%'+_0x23a813[_0x2e47('0x42')][_0x2e47('0x4f')]+'%'};return _0x3723a1;}})});}_0x3e8485=_[_0x2e47('0x4d')]({},_0x3e8485,_0x23a813[_0x2e47('0x50')]);var _0x2e5092={'where':_0x3e8485[_0x2e47('0x4b')]};return db['WhatsappMessage'][_0x2e47('0x32')](_0x2e5092)['then'](function(_0x275b1b){_0xe4907[_0x2e47('0x32')]=_0x275b1b;if(_0x23a813[_0x2e47('0x42')][_0x2e47('0x51')]){_0x3e8485[_0x2e47('0x52')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x2e47('0x53')](_0x3e8485);})[_0x2e47('0x38')](function(_0x1b8bf2){_0xe4907['rows']=_0x1b8bf2;return _0xe4907;})['then'](respondWithFilteredResult(_0x7b09f7,_0x3e8485))[_0x2e47('0x2b')](handleError(_0x7b09f7,null));};exports[_0x2e47('0x54')]=function(_0x288b84,_0x2f3742){var _0x3ba47f={'raw':!![],'where':{'id':_0x288b84[_0x2e47('0x55')]['id']}},_0x2f798e={};_0x2f798e[_0x2e47('0x41')]=_[_0x2e47('0x43')](db[_0x2e47('0x3f')][_0x2e47('0x56')]);_0x2f798e[_0x2e47('0x42')]=_[_0x2e47('0x43')](_0x288b84[_0x2e47('0x42')]);_0x2f798e['filters']=_[_0x2e47('0x44')](_0x2f798e[_0x2e47('0x41')],_0x2f798e[_0x2e47('0x42')]);_0x3ba47f[_0x2e47('0x45')]=_[_0x2e47('0x44')](_0x2f798e['model'],qs[_0x2e47('0x46')](_0x288b84[_0x2e47('0x42')]['fields']));_0x3ba47f[_0x2e47('0x45')]=_0x3ba47f[_0x2e47('0x45')][_0x2e47('0x57')]?_0x3ba47f[_0x2e47('0x45')]:_0x2f798e[_0x2e47('0x41')];if(_0x288b84[_0x2e47('0x42')][_0x2e47('0x51')]){_0x3ba47f[_0x2e47('0x52')]=[{'all':!![]}];}_0x3ba47f=_[_0x2e47('0x4d')]({},_0x3ba47f,_0x288b84[_0x2e47('0x50')]);return db[_0x2e47('0x3f')]['find'](_0x3ba47f)[_0x2e47('0x38')](handleEntityNotFound(_0x2f3742,null))[_0x2e47('0x38')](respondWithResult(_0x2f3742,null))['catch'](handleError(_0x2f3742,null));};exports[_0x2e47('0x58')]=function(_0x5c8c8c,_0x4e1a52){return db[_0x2e47('0x3f')]['create'](_0x5c8c8c[_0x2e47('0x59')],{})['then'](respondWithResult(_0x4e1a52,0xc9))[_0x2e47('0x2b')](handleError(_0x4e1a52,null));};exports['update']=function(_0x46b72c,_0xf255f3){if(_0x46b72c['body']['id']){delete _0x46b72c[_0x2e47('0x59')]['id'];}return db[_0x2e47('0x3f')][_0x2e47('0x5a')]({'where':{'id':_0x46b72c[_0x2e47('0x55')]['id']}})['then'](handleEntityNotFound(_0xf255f3,null))['then'](saveUpdates(_0x46b72c[_0x2e47('0x59')],null))[_0x2e47('0x38')](respondWithResult(_0xf255f3,null))[_0x2e47('0x2b')](handleError(_0xf255f3,null));};exports[_0x2e47('0x5b')]=function(_0x54f8f1,_0x5d4846){return db['WhatsappMessage']['find']({'where':{'id':_0x54f8f1['params']['id']}})[_0x2e47('0x38')](handleEntityNotFound(_0x5d4846,null))[_0x2e47('0x38')](removeEntity(_0x5d4846,null))[_0x2e47('0x2b')](handleError(_0x5d4846,null));};exports['describe']=function(_0x33a49d,_0x5876ce){return db[_0x2e47('0x3f')][_0x2e47('0x5c')]()['then'](respondWithResult(_0x5876ce,null))[_0x2e47('0x2b')](handleError(_0x5876ce,null));};var interaction_log=require('../../config/logger')(_0x2e47('0x5d'));exports['accept']=function(_0x26f7e2,_0x18e0fb,_0x180e91){var _0x4c6dc7={'agent':{},'channel':_0x2e47('0x5e')};if(_0x26f7e2['body']['id']){delete _0x26f7e2[_0x2e47('0x59')]['id'];}_0x26f7e2[_0x2e47('0x59')][_0x2e47('0x5f')]=!![];_0x26f7e2['body']['readAt']=moment()[_0x2e47('0x60')](_0x2e47('0x61'));_0x26f7e2[_0x2e47('0x59')]['UserId']=_0x26f7e2['body'][_0x2e47('0x62')]||_0x26f7e2['user']['id'];_0x4c6dc7[_0x2e47('0x63')]['id']=_0x26f7e2[_0x2e47('0x59')]['UserId'];return db[_0x2e47('0x3f')][_0x2e47('0x5a')]({'where':{'id':_0x26f7e2[_0x2e47('0x55')]['id'],'UserId':null}})[_0x2e47('0x38')](handleEntityNotFound(_0x18e0fb,null))[_0x2e47('0x38')](saveUpdates(_0x26f7e2[_0x2e47('0x59')],null))[_0x2e47('0x38')](function(_0x2ebf4e){if(_0x2ebf4e){_0x4c6dc7[_0x2e47('0x2a')]=_0x2ebf4e[_0x2e47('0x64')]({'plain':!![]});return db['WhatsappInteraction'][_0x2e47('0x5a')]({'where':{'id':_0x2ebf4e[_0x2e47('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x18e0fb,null))[_0x2e47('0x38')](function(_0xb202cb){if(_0xb202cb){return _0xb202cb[_0x2e47('0x37')]({'UserId':_0x26f7e2[_0x2e47('0x59')][_0x2e47('0x62')],'read1stAt':_[_0x2e47('0x66')](_0xb202cb[_0x2e47('0x67')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x2e47('0x38')](function(_0x19df1f){if(_0x19df1f){_0x4c6dc7[_0x2e47('0x68')]=_0x19df1f[_0x2e47('0x64')]({'plain':!![]});interaction_log[_0x2e47('0x22')](_0x2e47('0x69'),_0x26f7e2[_0x2e47('0x6a')]['id'],_0x26f7e2[_0x2e47('0x6a')]['name'],_0x26f7e2[_0x2e47('0x6a')][_0x2e47('0x6b')],_0x4c6dc7['interaction']['id'],_0x26f7e2[_0x2e47('0x59')]?JSON[_0x2e47('0x26')](_0x26f7e2[_0x2e47('0x59')]):_0x2e47('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x2e47('0x6d'),_0x4c6dc7);}return null;})[_0x2e47('0x38')](function(_0x2bb2b4){var _0xf3100a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2bb2b4[_0x2e47('0x2a')][_0x2e47('0x6e')];return db[_0x2e47('0x6f')][_0x2e47('0x42')](_0xf3100a,{'type':db['Sequelize'][_0x2e47('0x70')]['SELECT'],'raw':!![]})['then'](function(_0x55844c){return _0x55844c;});})[_0x2e47('0x38')](function(_0x6ae5cc){if(_0x6ae5cc){_0x4c6dc7[_0x2e47('0x2a')][_0x2e47('0x71')]=_0x6ae5cc[0x0];if(!_0x26f7e2['body'][_0x2e47('0x62')])return;return db['User'][_0x2e47('0x5a')]({'where':{'id':_0x26f7e2['body'][_0x2e47('0x62')],'role':_0x2e47('0x63')},'attributes':['id',_0x2e47('0x3b'),'fullname',_0x2e47('0x72'),_0x2e47('0x73')],'raw':!![]});}return null;})['then'](function(_0x50b05c){if(!_0x50b05c)return null;_0x4c6dc7[_0x2e47('0x2a')]['agent']=_0x50b05c;return _0x4c6dc7;})['then'](function(_0x2c525a){if(_0x2c525a){if(_0x26f7e2[_0x2e47('0x59')][_0x2e47('0x74')]){_0x4c6dc7['message']['interface']=util[_0x2e47('0x60')](_0x2e47('0x75'),_0x26f7e2['user'][_0x2e47('0x3b')]);_0x4c6dc7['message'][_0x2e47('0x76')]=_0x4c6dc7['channel'];_0x4c6dc7[_0x2e47('0x2a')]['motionChannel']=_0x4c6dc7[_0x2e47('0x76')];_0x4c6dc7[_0x2e47('0x2a')][_0x2e47('0x77')]=_0x2e47('0x78');return respondWithRpcPromise(_0x2e47('0x79'),_0x2e47('0x79'),{'event':'acceptmessage','message':_0x4c6dc7[_0x2e47('0x2a')]},client9002)[_0x2e47('0x38')](function(){return _0x4c6dc7;});}return _0x4c6dc7;}return null;})['then'](respondWithResult(_0x18e0fb,null))[_0x2e47('0x2b')](handleError(_0x18e0fb,null));};var interaction_log=require(_0x2e47('0x16'))(_0x2e47('0x5d'));exports[_0x2e47('0x7a')]=function(_0x136aa6,_0x511505,_0x3d36c4){var _0x268552={'agent':{},'channel':_0x2e47('0x5e')};if(_0x136aa6['body']['id']){delete _0x136aa6[_0x2e47('0x59')]['id'];}_0x136aa6['body'][_0x2e47('0x62')]=_0x136aa6[_0x2e47('0x59')][_0x2e47('0x62')]||_0x136aa6[_0x2e47('0x6a')]['id'];_0x268552[_0x2e47('0x63')]['id']=_0x136aa6[_0x2e47('0x59')]['UserId'];return db[_0x2e47('0x3f')][_0x2e47('0x5a')]({'where':{'id':_0x136aa6['params']['id'],'UserId':null}})[_0x2e47('0x38')](handleEntityNotFound(_0x511505,null))[_0x2e47('0x38')](function(_0x194fa4){if(_0x194fa4){_0x268552['message']=_0x194fa4['get']({'plain':!![]});return db[_0x2e47('0x7b')][_0x2e47('0x5a')]({'where':{'id':_0x194fa4[_0x2e47('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x511505,null))[_0x2e47('0x38')](function(_0x1d42d2){if(_0x1d42d2){_0x268552['interaction']=_0x1d42d2[_0x2e47('0x64')]({'plain':!![]});interaction_log[_0x2e47('0x22')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x136aa6[_0x2e47('0x6a')]['id'],_0x136aa6[_0x2e47('0x6a')][_0x2e47('0x3b')],_0x136aa6[_0x2e47('0x6a')][_0x2e47('0x6b')],_0x268552[_0x2e47('0x68')]['id'],_0x136aa6[_0x2e47('0x59')]?JSON[_0x2e47('0x26')](_0x136aa6['body']):_0x2e47('0x6c'));return respondWithRpcPromise(_0x2e47('0x7c'),'rejectMessage',_0x268552);}return null;})[_0x2e47('0x38')](function(_0x17dc55){var _0x3ce0aa=_0x2e47('0x7d')+_0x17dc55['message'][_0x2e47('0x6e')];return db[_0x2e47('0x6f')]['query'](_0x3ce0aa,{'type':db[_0x2e47('0x7e')][_0x2e47('0x70')][_0x2e47('0x7f')],'raw':!![]})[_0x2e47('0x38')](function(_0x2a9e18){return _0x2a9e18;});})[_0x2e47('0x38')](function(_0x2c1a53){if(_0x2c1a53){_0x268552[_0x2e47('0x2a')][_0x2e47('0x71')]=_0x2c1a53[0x0];if(!_0x136aa6['body'][_0x2e47('0x62')])return;return db[_0x2e47('0x80')][_0x2e47('0x5a')]({'where':{'id':_0x136aa6['body'][_0x2e47('0x62')],'role':_0x2e47('0x63')},'attributes':['id',_0x2e47('0x3b'),'fullname',_0x2e47('0x72'),_0x2e47('0x73')],'raw':!![]});}return null;})['then'](function(_0x5c399b){if(!_0x5c399b)return null;_0x268552[_0x2e47('0x2a')]['agent']=_0x5c399b;return _0x268552;})[_0x2e47('0x38')](function(_0x1e41c6){if(_0x1e41c6){_0x1e41c6[_0x2e47('0x2a')][_0x2e47('0x81')]=util[_0x2e47('0x60')](_0x2e47('0x75'),_0x136aa6[_0x2e47('0x6a')][_0x2e47('0x3b')]);_0x1e41c6[_0x2e47('0x2a')][_0x2e47('0x76')]=_0x268552[_0x2e47('0x76')];_0x1e41c6[_0x2e47('0x2a')][_0x2e47('0x82')]=_0x268552[_0x2e47('0x76')];_0x1e41c6[_0x2e47('0x2a')][_0x2e47('0x77')]='reject';respondWithRpcPromise(_0x2e47('0x79'),'EventManager',{'event':'rejectmessage','message':_0x1e41c6['message']},client9002);return _0x268552;}return null;})[_0x2e47('0x38')](respondWithResult(_0x511505,null))['catch'](handleError(_0x511505,null));};exports[_0x2e47('0x2d')]=function(_0x260073,_0x187e0f,_0x8aa202){if(_0x260073[_0x2e47('0x59')]['id']){delete _0x260073[_0x2e47('0x59')]['id'];}var _0x421946;return db['WhatsappMessage'][_0x2e47('0x5a')]({'where':{'id':_0x260073[_0x2e47('0x55')]['id']}})['then'](handleEntityNotFound(_0x187e0f,null))[_0x2e47('0x38')](function(_0x1065a1){if(_0x1065a1){_0x421946=_0x1065a1;return db[_0x2e47('0x83')][_0x2e47('0x5a')]({'where':{'id':_0x1065a1[_0x2e47('0x84')]}});}})[_0x2e47('0x38')](handleEntityNotFound(_0x187e0f,null))['then'](function(_0x3923cc){if(_0x3923cc){logger[_0x2e47('0x24')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x3923cc[_0x2e47('0x40')],util[_0x2e47('0x85')](_0x260073[_0x2e47('0x59')],{'showHidden':![],'depth':null}));switch(_0x3923cc['type']){case _0x2e47('0x86'):if(_0x260073['body'][_0x2e47('0x87')]&&_0x260073[_0x2e47('0x59')][_0x2e47('0x87')]===_0x421946[_0x2e47('0x88')]&&_0x260073[_0x2e47('0x59')][_0x2e47('0x89')]&&_0x260073[_0x2e47('0x59')][_0x2e47('0x89')]===_0x2e47('0x5f')){return _0x421946[_0x2e47('0x37')]({'read':!![]});}else{logger[_0x2e47('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2e47('0x2d'),_0x2e47('0x86'),util['inspect'](_0x260073[_0x2e47('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x421946;}})[_0x2e47('0x38')](respondWithResult(_0x187e0f,null))[_0x2e47('0x2b')](handleError(_0x187e0f,null));}; \ No newline at end of file +var _0x1081=['whatsapp-interactions','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','destroy','sendStatus','stack','name','send','index','map','WhatsappMessage','fieldName','key','model','query','keys','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','update','body','describe','accept','whatsapp','acceptMessage','reject','UserId','user','agent','WhatsappInteraction','interaction','get','role','stringify','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','format','channel','motionChannel','EventManager','rejectmessage','WhatsappAccount','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','client','http'];(function(_0x281cbf,_0x21d4f7){var _0x24470e=function(_0x59a4a2){while(--_0x59a4a2){_0x281cbf['push'](_0x281cbf['shift']());}};_0x24470e(++_0x21d4f7);}(_0x1081,0xcf));var _0x1108=function(_0x72cdd9,_0x38e6c8){_0x72cdd9=_0x72cdd9-0x0;var _0x31f4fe=_0x1081[_0x72cdd9];return _0x31f4fe;};'use strict';var util=require(_0x1108('0x0'));var _=require(_0x1108('0x1'));var Redis=require(_0x1108('0x2'));var interactionService=require('../../components/interaction/service');var qs=require(_0x1108('0x3'));var logger=require(_0x1108('0x4'))(_0x1108('0x5'));var config=require(_0x1108('0x6'));var db=require(_0x1108('0x7'))['db'];config[_0x1108('0x8')]=_[_0x1108('0x9')](config[_0x1108('0x8')],{'host':_0x1108('0xa'),'port':0x18eb});var socket=require(_0x1108('0xb'))(new Redis(config[_0x1108('0x8')]));require(_0x1108('0xc'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x1108('0xd')][_0x1108('0xe')]({'port':0x232c});var client9002=jayson[_0x1108('0xd')]['http']({'port':0x232a});var interaction_log=require(_0x1108('0x4'))(_0x1108('0xf'));function respondWithRpcPromise(_0xd262e1,_0x5c47d8,_0x59c7dd,_0x5f16be){return new Promise(function(_0x28356b,_0x1dd183){var _0x110def=_0x5f16be||client;return _0x110def[_0x1108('0x10')](_0xd262e1,_0x59c7dd)[_0x1108('0x11')](function(_0x2fe165){logger[_0x1108('0x12')](_0x1108('0x13'),_0x5c47d8,_0x1108('0x14'));logger['debug'](_0x1108('0x15'),_0x5c47d8,_0x1108('0x14'),JSON['stringify'](_0x2fe165));if(_0x2fe165['error']){if(_0x2fe165[_0x1108('0x16')][_0x1108('0x17')]===0x1f4){logger[_0x1108('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x5c47d8,_0x2fe165[_0x1108('0x16')]['message']);return _0x1dd183(_0x2fe165[_0x1108('0x16')][_0x1108('0x18')]);}logger[_0x1108('0x16')](_0x1108('0x13'),_0x5c47d8,_0x2fe165[_0x1108('0x16')][_0x1108('0x18')]);return _0x28356b(_0x2fe165['error'][_0x1108('0x18')]);}else{logger[_0x1108('0x12')](_0x1108('0x13'),_0x5c47d8,_0x1108('0x14'));_0x28356b(_0x2fe165[_0x1108('0x19')][_0x1108('0x18')]);}})[_0x1108('0x1a')](function(_0x639395){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x5c47d8,_0x639395);_0x1dd183(_0x639395);});});}function respondWithResult(_0x3b9f1f,_0x50bb4c){_0x50bb4c=_0x50bb4c||0xc8;return function(_0x544ed0){if(_0x544ed0){return _0x3b9f1f[_0x1108('0x1b')](_0x50bb4c)[_0x1108('0x1c')](_0x544ed0);}};}function respondWithFilteredResult(_0x177192,_0x4141d5){return function(_0x28ce35){if(_0x28ce35){var _0x585e65=typeof _0x4141d5[_0x1108('0x1d')]===_0x1108('0x1e')&&typeof _0x4141d5['limit']===_0x1108('0x1e');var _0x5a3d17=_0x28ce35[_0x1108('0x1f')];var _0x1523bd=_0x585e65?0x0:_0x4141d5[_0x1108('0x1d')];var _0x286d21=_0x585e65?_0x28ce35[_0x1108('0x1f')]:_0x4141d5[_0x1108('0x1d')]+_0x4141d5[_0x1108('0x20')];var _0x243dda;if(_0x286d21>=_0x5a3d17){_0x286d21=_0x5a3d17;_0x243dda=0xc8;}else{_0x243dda=0xce;}_0x177192[_0x1108('0x1b')](_0x243dda);return _0x177192[_0x1108('0x21')](_0x1108('0x22'),_0x1523bd+'-'+_0x286d21+'/'+_0x5a3d17)[_0x1108('0x1c')](_0x28ce35);}return null;};}function saveUpdates(_0x442386){return function(_0x39f789){if(_0x39f789){return _0x39f789['update'](_0x442386)[_0x1108('0x11')](function(_0x147b18){return _0x147b18;});}return null;};}function removeEntity(_0x3daed2){return function(_0x581485){if(_0x581485){return _0x581485[_0x1108('0x23')]()['then'](function(){_0x3daed2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24a47b){return function(_0xfb8293){if(!_0xfb8293){_0x24a47b[_0x1108('0x24')](0x194);}return _0xfb8293;};}function handleError(_0x20f56e,_0x235b5c){_0x235b5c=_0x235b5c||0x1f4;return function(_0x5cc3b0){logger[_0x1108('0x16')](_0x5cc3b0[_0x1108('0x25')]);if(_0x5cc3b0[_0x1108('0x26')]){delete _0x5cc3b0[_0x1108('0x26')];}_0x20f56e['status'](_0x235b5c)[_0x1108('0x27')](_0x5cc3b0);};}exports[_0x1108('0x28')]=function(_0x19751c,_0x25ece0){var _0x5461ca={},_0x41192f={},_0xec56bf={'count':0x0,'rows':[]};var _0x5ea9e9=_[_0x1108('0x29')](db[_0x1108('0x2a')]['rawAttributes'],function(_0x30a813){return{'name':_0x30a813[_0x1108('0x2b')],'type':_0x30a813['type'][_0x1108('0x2c')]};});_0x41192f[_0x1108('0x2d')]=_[_0x1108('0x29')](_0x5ea9e9,_0x1108('0x26'));_0x41192f[_0x1108('0x2e')]=_[_0x1108('0x2f')](_0x19751c[_0x1108('0x2e')]);_0x41192f['filters']=_['intersection'](_0x41192f[_0x1108('0x2d')],_0x41192f[_0x1108('0x2e')]);_0x5461ca[_0x1108('0x30')]=_['intersection'](_0x41192f['model'],qs[_0x1108('0x31')](_0x19751c[_0x1108('0x2e')][_0x1108('0x31')]));_0x5461ca['attributes']=_0x5461ca[_0x1108('0x30')]['length']?_0x5461ca[_0x1108('0x30')]:_0x41192f[_0x1108('0x2d')];if(!_0x19751c[_0x1108('0x2e')][_0x1108('0x32')](_0x1108('0x33'))){_0x5461ca['limit']=qs[_0x1108('0x20')](_0x19751c[_0x1108('0x2e')][_0x1108('0x20')]);_0x5461ca[_0x1108('0x1d')]=qs[_0x1108('0x1d')](_0x19751c[_0x1108('0x2e')][_0x1108('0x1d')]);}_0x5461ca[_0x1108('0x34')]=qs['sort'](_0x19751c[_0x1108('0x2e')][_0x1108('0x35')]);_0x5461ca[_0x1108('0x36')]=qs[_0x1108('0x37')](_[_0x1108('0x38')](_0x19751c['query'],_0x41192f[_0x1108('0x37')]),_0x5ea9e9);if(_0x19751c[_0x1108('0x2e')][_0x1108('0x39')]){_0x5461ca['where']=_[_0x1108('0x3a')](_0x5461ca['where'],{'$or':_[_0x1108('0x29')](_0x5ea9e9,function(_0x12ec74){if(_0x12ec74[_0x1108('0x3b')]!==_0x1108('0x3c')){var _0x379742={};_0x379742[_0x12ec74[_0x1108('0x26')]]={'$like':'%'+_0x19751c[_0x1108('0x2e')][_0x1108('0x39')]+'%'};return _0x379742;}})});}_0x5461ca=_[_0x1108('0x3a')]({},_0x5461ca,_0x19751c[_0x1108('0x3d')]);var _0x457f7a={'where':_0x5461ca['where']};return db['WhatsappMessage']['count'](_0x457f7a)['then'](function(_0x1e6140){_0xec56bf[_0x1108('0x1f')]=_0x1e6140;if(_0x19751c['query'][_0x1108('0x3e')]){_0x5461ca[_0x1108('0x3f')]=[{'all':!![]}];}return db[_0x1108('0x2a')][_0x1108('0x40')](_0x5461ca);})[_0x1108('0x11')](function(_0x13429d){_0xec56bf[_0x1108('0x41')]=_0x13429d;return _0xec56bf;})[_0x1108('0x11')](respondWithFilteredResult(_0x25ece0,_0x5461ca))[_0x1108('0x1a')](handleError(_0x25ece0,null));};exports[_0x1108('0x42')]=function(_0x102cac,_0x4fe3b0){var _0x452e68={'raw':!![],'where':{'id':_0x102cac[_0x1108('0x43')]['id']}},_0x475a71={};_0x475a71[_0x1108('0x2d')]=_[_0x1108('0x2f')](db['WhatsappMessage'][_0x1108('0x44')]);_0x475a71[_0x1108('0x2e')]=_[_0x1108('0x2f')](_0x102cac['query']);_0x475a71[_0x1108('0x37')]=_['intersection'](_0x475a71[_0x1108('0x2d')],_0x475a71[_0x1108('0x2e')]);_0x452e68[_0x1108('0x30')]=_['intersection'](_0x475a71['model'],qs['fields'](_0x102cac[_0x1108('0x2e')][_0x1108('0x31')]));_0x452e68[_0x1108('0x30')]=_0x452e68[_0x1108('0x30')]['length']?_0x452e68[_0x1108('0x30')]:_0x475a71['model'];if(_0x102cac[_0x1108('0x2e')][_0x1108('0x3e')]){_0x452e68[_0x1108('0x3f')]=[{'all':!![]}];}_0x452e68=_[_0x1108('0x3a')]({},_0x452e68,_0x102cac[_0x1108('0x3d')]);return db['WhatsappMessage'][_0x1108('0x45')](_0x452e68)[_0x1108('0x11')](handleEntityNotFound(_0x4fe3b0,null))[_0x1108('0x11')](respondWithResult(_0x4fe3b0,null))[_0x1108('0x1a')](handleError(_0x4fe3b0,null));};exports[_0x1108('0x46')]=function(_0x580862,_0x741da9){return db[_0x1108('0x2a')][_0x1108('0x46')](_0x580862['body'],{})[_0x1108('0x11')](respondWithResult(_0x741da9,0xc9))[_0x1108('0x1a')](handleError(_0x741da9,null));};exports[_0x1108('0x47')]=function(_0x5bca08,_0x1a6cd1){if(_0x5bca08[_0x1108('0x48')]['id']){delete _0x5bca08[_0x1108('0x48')]['id'];}return db[_0x1108('0x2a')][_0x1108('0x45')]({'where':{'id':_0x5bca08['params']['id']}})[_0x1108('0x11')](handleEntityNotFound(_0x1a6cd1,null))['then'](saveUpdates(_0x5bca08[_0x1108('0x48')],null))[_0x1108('0x11')](respondWithResult(_0x1a6cd1,null))[_0x1108('0x1a')](handleError(_0x1a6cd1,null));};exports[_0x1108('0x23')]=function(_0x1c2e55,_0x1b625d){return db[_0x1108('0x2a')][_0x1108('0x45')]({'where':{'id':_0x1c2e55[_0x1108('0x43')]['id']}})[_0x1108('0x11')](handleEntityNotFound(_0x1b625d,null))[_0x1108('0x11')](removeEntity(_0x1b625d,null))['catch'](handleError(_0x1b625d,null));};exports[_0x1108('0x49')]=function(_0x88ac3b,_0x2e7bd2){return db[_0x1108('0x2a')]['describe']()[_0x1108('0x11')](respondWithResult(_0x2e7bd2,null))[_0x1108('0x1a')](handleError(_0x2e7bd2,null));};exports[_0x1108('0x4a')]=function(_0x341c53,_0x57c410){var _0x510d2d=_0x1108('0x4b');return interactionService[_0x1108('0x4c')](_0x341c53,_0x510d2d)[_0x1108('0x11')](respondWithResult(_0x57c410,null))[_0x1108('0x1a')](handleError(_0x57c410,null));};exports[_0x1108('0x4d')]=function(_0x460a34,_0x5833cf){var _0x5907d4={'agent':{},'channel':_0x1108('0x4b')};if(_0x460a34[_0x1108('0x48')]['id']){delete _0x460a34['body']['id'];}_0x460a34[_0x1108('0x48')][_0x1108('0x4e')]=_0x460a34[_0x1108('0x48')][_0x1108('0x4e')]||_0x460a34[_0x1108('0x4f')]['id'];_0x5907d4[_0x1108('0x50')]['id']=_0x460a34['body'][_0x1108('0x4e')];return db[_0x1108('0x2a')][_0x1108('0x45')]({'where':{'id':_0x460a34['params']['id'],'UserId':null}})[_0x1108('0x11')](handleEntityNotFound(_0x5833cf,null))[_0x1108('0x11')](function(_0x1f676f){if(_0x1f676f){_0x5907d4[_0x1108('0x18')]=_0x1f676f['get']({'plain':!![]});return db[_0x1108('0x51')][_0x1108('0x45')]({'where':{'id':_0x1f676f['WhatsappInteractionId']}});}return null;})[_0x1108('0x11')](handleEntityNotFound(_0x5833cf,null))[_0x1108('0x11')](function(_0x29d8b7){if(_0x29d8b7){_0x5907d4[_0x1108('0x52')]=_0x29d8b7[_0x1108('0x53')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x460a34[_0x1108('0x4f')]['id'],_0x460a34[_0x1108('0x4f')]['name'],_0x460a34[_0x1108('0x4f')][_0x1108('0x54')],_0x5907d4[_0x1108('0x52')]['id'],_0x460a34[_0x1108('0x48')]?JSON[_0x1108('0x55')](_0x460a34[_0x1108('0x48')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x5907d4);}return null;})['then'](function(_0x333214){var _0xbf0ab4=_0x1108('0x56')+_0x333214[_0x1108('0x18')]['ContactId'];return db[_0x1108('0x57')][_0x1108('0x2e')](_0xbf0ab4,{'type':db[_0x1108('0x58')][_0x1108('0x59')][_0x1108('0x5a')],'raw':!![]})[_0x1108('0x11')](function(_0x2592e5){return _0x2592e5;});})[_0x1108('0x11')](function(_0x4152c9){if(_0x4152c9){_0x5907d4[_0x1108('0x18')][_0x1108('0x5b')]=_0x4152c9[0x0];if(!_0x460a34[_0x1108('0x48')]['UserId'])return;return db[_0x1108('0x5c')][_0x1108('0x45')]({'where':{'id':_0x460a34[_0x1108('0x48')]['UserId'],'role':'agent'},'attributes':['id',_0x1108('0x26'),_0x1108('0x5d'),_0x1108('0x5e'),_0x1108('0x5f')],'raw':!![]});}return null;})[_0x1108('0x11')](function(_0x6518b8){if(!_0x6518b8)return null;_0x5907d4[_0x1108('0x18')][_0x1108('0x50')]=_0x6518b8;return _0x5907d4;})[_0x1108('0x11')](function(_0x11d615){if(_0x11d615){_0x11d615[_0x1108('0x18')][_0x1108('0x60')]=util[_0x1108('0x61')]('SIP/%s',_0x460a34[_0x1108('0x4f')]['name']);_0x11d615['message'][_0x1108('0x62')]=_0x5907d4['channel'];_0x11d615[_0x1108('0x18')][_0x1108('0x63')]=_0x5907d4[_0x1108('0x62')];_0x11d615[_0x1108('0x18')]['event']=_0x1108('0x4d');respondWithRpcPromise(_0x1108('0x64'),_0x1108('0x64'),{'event':_0x1108('0x65'),'message':_0x11d615['message']},client9002);return _0x5907d4;}return null;})[_0x1108('0x11')](respondWithResult(_0x5833cf,null))[_0x1108('0x1a')](handleError(_0x5833cf,null));};exports['status']=function(_0x13ee89,_0x2f881f){if(_0x13ee89[_0x1108('0x48')]['id']){delete _0x13ee89['body']['id'];}var _0x356d2b;return db[_0x1108('0x2a')][_0x1108('0x45')]({'where':{'id':_0x13ee89[_0x1108('0x43')]['id']}})[_0x1108('0x11')](handleEntityNotFound(_0x2f881f,null))[_0x1108('0x11')](function(_0x340c9d){if(_0x340c9d){_0x356d2b=_0x340c9d;return db[_0x1108('0x66')][_0x1108('0x45')]({'where':{'id':_0x340c9d['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x2f881f,null))['then'](function(_0x1c2b54){if(_0x1c2b54){logger[_0x1108('0x67')](_0x1108('0x68'),'status','received\x20delivery\x20report\x20from',_0x1c2b54[_0x1108('0x3b')],util[_0x1108('0x69')](_0x13ee89['body'],{'showHidden':![],'depth':null}));switch(_0x1c2b54[_0x1108('0x3b')]){case _0x1108('0x6a'):if(_0x13ee89[_0x1108('0x48')][_0x1108('0x6b')]&&_0x13ee89['body']['MessageSid']===_0x356d2b[_0x1108('0x6c')]&&_0x13ee89[_0x1108('0x48')][_0x1108('0x6d')]&&_0x13ee89[_0x1108('0x48')][_0x1108('0x6d')]==='read'){return _0x356d2b[_0x1108('0x47')]({'read':!![]});}else{logger['error'](_0x1108('0x6e'),_0x1108('0x1b'),_0x1108('0x6a'),util[_0x1108('0x69')](_0x13ee89[_0x1108('0x48')],{'showHidden':![],'depth':null}));}break;}return _0x356d2b;}})[_0x1108('0x11')](respondWithResult(_0x2f881f,null))[_0x1108('0x1a')](handleError(_0x2f881f,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 76cbcf2..2db8695 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 _0xdb94=['remove','hasOwnProperty','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xdb94,0xab));var _0x4db9=function(_0x25e441,_0x38bf75){_0x25e441=_0x25e441-0x0;var _0xcf0ba5=_0xdb94[_0x25e441];return _0xcf0ba5;};'use strict';var EventEmitter=require(_0x4db9('0x0'));var WhatsappMessage=require(_0x4db9('0x1'))['db'][_0x4db9('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4db9('0x3')](0x0);var events={'afterCreate':_0x4db9('0x4'),'afterUpdate':'update','afterDestroy':_0x4db9('0x5')};function emitEvent(_0x16c55a){return function(_0x554bd5,_0x4ed80a,_0x209f80){WhatsappMessageEvents['emit'](_0x16c55a+':'+_0x554bd5['id'],_0x554bd5);WhatsappMessageEvents['emit'](_0x16c55a,_0x554bd5);_0x209f80(null);};}for(var e in events){if(events[_0x4db9('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x4db9('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x1775=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x1775,0x1db));var _0x5177=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1775[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x5177('0x0'))['db'][_0x5177('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x5177('0x2')](0x0);var events={'afterCreate':_0x5177('0x3'),'afterUpdate':_0x5177('0x4'),'afterDestroy':_0x5177('0x5')};function emitEvent(_0x420a5b){return function(_0x2027bf,_0x359401,_0x51275f){WhatsappMessageEvents[_0x5177('0x6')](_0x420a5b+':'+_0x2027bf['id'],_0x2027bf);WhatsappMessageEvents[_0x5177('0x6')](_0x420a5b,_0x2027bf);_0x51275f(null);};}for(var e in events){if(events[_0x5177('0x7')](e)){var event=events[e];WhatsappMessage[_0x5177('0x8')](e,emitEvent(event));}}module[_0x5177('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index fa52024..62c41e3 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 _0x30ff=['WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','baseUrl','/whatsapp/v1/','text','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','node-fetch','path','./whatsappMessage.attributes','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','WhatsappInteractionId','then','update','error'];(function(_0xae386d,_0x10f4e1){var _0x178d80=function(_0x3de371){while(--_0x3de371){_0xae386d['push'](_0xae386d['shift']());}};_0x178d80(++_0x10f4e1);}(_0x30ff,0x13e));var _0xf30f=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x30ff[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xf30f('0x0'));var util=require(_0xf30f('0x1'));var logger=require(_0xf30f('0x2'))(_0xf30f('0x3'));var moment=require('moment');var BPromise=require(_0xf30f('0x4'));var rp=require(_0xf30f('0x5'));var fetch=require(_0xf30f('0x6'));var fs=require('fs');var path=require(_0xf30f('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf30f('0x8'));module['exports']=function(_0x16293c,_0x2cd96c){return _0x16293c['define'](_0xf30f('0x9'),attributes,{'tableName':_0xf30f('0xa'),'paranoid':![],'indexes':[{'name':_0xf30f('0xb'),'fields':[_0xf30f('0xb')]},{'name':'fti_whatsapp_messages','fields':[_0xf30f('0xc')],'type':_0xf30f('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xfb8e8b,_0x4057d7,_0x223907){var _0x2fa916=_0x16293c[_0xf30f('0xe')];var _0x49247e=_0xfb8e8b[_0xf30f('0xf')]({'plain':!![]});if(_0x49247e[_0xf30f('0x10')][_0xf30f('0x11')]()==='in'||_0x49247e[_0xf30f('0x10')]['toLowerCase']()==='out'&&!_0x49247e[_0xf30f('0x12')]&&!_[_0xf30f('0x13')](_0x49247e['UserId'])){_0x2fa916['WhatsappInteraction']['findOne']({'where':{'id':_0x49247e[_0xf30f('0x14')]}})[_0xf30f('0x15')](function(_0x4500a3){if(_0x4500a3){_0x4500a3[_0xf30f('0x16')]({'lastMsgAt':_0x49247e['createdAt'],'lastMsgDirection':_0x49247e[_0xf30f('0x10')]['toLowerCase']()});}})['catch'](function(_0xc8bc49){console[_0xf30f('0x17')](_0xc8bc49);});}if(_0x49247e[_0xf30f('0x10')]==='out'&&!_0x49247e['secret']){var _0x431237;_0x2fa916[_0xf30f('0x18')][_0xf30f('0x19')]({'where':{'id':_0x49247e[_0xf30f('0x1a')]},'raw':!![]})[_0xf30f('0x15')](function(_0x4c63de){_0x431237=_0x4c63de;if(_0x431237&&_0x431237[_0xf30f('0x1b')]){switch(_0x431237[_0xf30f('0x1b')]){case _0xf30f('0x1c'):var _0xd5a9fe=require(_0xf30f('0x1c'));if(_0x431237[_0xf30f('0x1d')]&&_0x431237[_0xf30f('0x1e')]&&_0x431237[_0xf30f('0x1f')]){var _0x3236a7=new _0xd5a9fe(_0x431237[_0xf30f('0x1d')],_0x431237['authToken']);_0x3236a7[_0xf30f('0x20')][_0xf30f('0x21')]({'body':_0x49247e[_0xf30f('0xc')],'to':_0xf30f('0x22')+_0x49247e[_0xf30f('0x1f')],'from':_0xf30f('0x22')+_0x431237[_0xf30f('0x1f')],'statusCallback':_0x431237[_0xf30f('0x23')]+_0xf30f('0x24')+_0x49247e['id']+_0xf30f('0x25')+_0x431237[_0xf30f('0x26')]})[_0xf30f('0x15')](function(_0x13a870){if(_0x13a870[_0xf30f('0x27')]){return _0xfb8e8b[_0xf30f('0x16')]({'messageId':_0x13a870['sid']});}})[_0xf30f('0x28')](function(_0x3a58fc){logger[_0xf30f('0x17')](_0xf30f('0x29'),_0xf30f('0x2a'),_0xf30f('0x1c'),util[_0xf30f('0x2b')](_0x3a58fc,{'showHidden':![],'depth':null}));});}else{logger[_0xf30f('0x17')](_0xf30f('0x29'),_0xf30f('0x2a'),_0xf30f('0x1c'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xf30f('0x2c'):var _0x68bcb0=_0x431237[_0xf30f('0x1d')];var _0x47390c=_0x431237['authToken'];var _0x1bb982=_0x431237[_0xf30f('0x2d')]+_0xf30f('0x2e')+_0x68bcb0+'/messages/';var _0x4102d9={'to':[_0x49247e[_0xf30f('0x1f')]],'message':{'type':_0xf30f('0x2f'),'text':_0x49247e[_0xf30f('0xc')]}};var _0x31dca1={'method':_0xf30f('0x30'),'uri':_0x1bb982,'headers':{'Authorization':'Bearer\x20'+_0x47390c,'Content-Type':_0xf30f('0x31')},'body':_0x4102d9,'json':!![]};rp(_0x31dca1)[_0xf30f('0x15')](function(_0x5eebed){if(_0x5eebed[_0xf30f('0x32')][0x0][_0xf30f('0x33')]){return _0xfb8e8b['update']({'messageId':_0x5eebed['statuses'][0x0][_0xf30f('0x33')]});}})[_0xf30f('0x28')](function(_0x45f384){logger[_0xf30f('0x34')](_0xf30f('0x35'),_0x45f384);});break;}}})[_0xf30f('0x36')](function(){_0x223907();});}else{_0x223907();}}},'charset':_0xf30f('0x37'),'collate':_0xf30f('0x38')});}; \ No newline at end of file +var _0x9992=['Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','text','body','POST','Bearer\x20','application/json','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','node-fetch','path','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','direction','out','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','toLowerCase','catch','secret','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','error'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x9992,0x135));var _0x2999=function(_0x26bf51,_0x5e261a){_0x26bf51=_0x26bf51-0x0;var _0x503415=_0x9992[_0x26bf51];return _0x503415;};'use strict';var _=require(_0x2999('0x0'));var util=require(_0x2999('0x1'));var logger=require(_0x2999('0x2'))(_0x2999('0x3'));var moment=require('moment');var BPromise=require(_0x2999('0x4'));var rp=require(_0x2999('0x5'));var fetch=require(_0x2999('0x6'));var fs=require('fs');var path=require(_0x2999('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2999('0x8'));module[_0x2999('0x9')]=function(_0x1743e3,_0x5f23f3){return _0x1743e3[_0x2999('0xa')](_0x2999('0xb'),attributes,{'tableName':_0x2999('0xc'),'paranoid':![],'indexes':[{'name':_0x2999('0xd'),'fields':[_0x2999('0xd')]},{'name':_0x2999('0xe'),'fields':['body'],'type':_0x2999('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5bf7da,_0x44395c,_0x290839){var _0xdbe9bf=_0x1743e3[_0x2999('0x10')];var _0x14fefd=_0x5bf7da['get']({'plain':!![]});if(_0x14fefd[_0x2999('0x11')]['toLowerCase']()==='in'||_0x14fefd['direction']['toLowerCase']()===_0x2999('0x12')&&!_0x14fefd['secret']&&!_['isNil'](_0x14fefd[_0x2999('0x13')])){_0xdbe9bf[_0x2999('0x14')][_0x2999('0x15')]({'where':{'id':_0x14fefd[_0x2999('0x16')]}})[_0x2999('0x17')](function(_0x5c93b6){if(_0x5c93b6){_0x5c93b6[_0x2999('0x18')]({'lastMsgAt':_0x14fefd['createdAt'],'lastMsgDirection':_0x14fefd[_0x2999('0x11')][_0x2999('0x19')]()});}})[_0x2999('0x1a')](function(_0x35a58b){console['error'](_0x35a58b);});}if(_0x14fefd[_0x2999('0x11')]===_0x2999('0x12')&&!_0x14fefd[_0x2999('0x1b')]){var _0x503418;_0xdbe9bf[_0x2999('0x1c')][_0x2999('0x1d')]({'where':{'id':_0x14fefd['WhatsappAccountId']},'raw':!![]})['then'](function(_0x32418f){_0x503418=_0x32418f;if(_0x503418&&_0x503418[_0x2999('0x1e')]){switch(_0x503418[_0x2999('0x1e')]){case _0x2999('0x1f'):var _0x3cc9e4=require('twilio');if(_0x503418[_0x2999('0x20')]&&_0x503418[_0x2999('0x21')]&&_0x503418[_0x2999('0x22')]){var _0x2fc74a=new _0x3cc9e4(_0x503418['accountSid'],_0x503418[_0x2999('0x21')]);_0x2fc74a[_0x2999('0x23')][_0x2999('0x24')]({'body':_0x14fefd['body'],'to':_0x2999('0x25')+_0x14fefd[_0x2999('0x22')],'from':_0x2999('0x25')+_0x503418[_0x2999('0x22')],'statusCallback':_0x503418[_0x2999('0x26')]+_0x2999('0x27')+_0x14fefd['id']+_0x2999('0x28')+_0x503418['token']})[_0x2999('0x17')](function(_0x3708ee){if(_0x3708ee[_0x2999('0x29')]){return _0x5bf7da[_0x2999('0x18')]({'messageId':_0x3708ee['sid']});}})['catch'](function(_0x557189){logger['error'](_0x2999('0x2a'),_0x2999('0x2b'),_0x2999('0x1f'),util['inspect'](_0x557189,{'showHidden':![],'depth':null}));});}else{logger[_0x2999('0x2c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2999('0x1f'),_0x2999('0x2d'));}break;case _0x2999('0x2e'):var _0x32ddbc=_0x503418['accountSid'];var _0x28e8f3=_0x503418[_0x2999('0x21')];var _0x164a7a=_0x503418[_0x2999('0x2f')]+_0x2999('0x30')+_0x32ddbc+'/messages/';var _0x2fa3df={'to':[_0x14fefd[_0x2999('0x22')]],'message':{'type':_0x2999('0x31'),'text':_0x14fefd[_0x2999('0x32')]}};var _0x50da34={'method':_0x2999('0x33'),'uri':_0x164a7a,'headers':{'Authorization':_0x2999('0x34')+_0x28e8f3,'Content-Type':_0x2999('0x35')},'body':_0x2fa3df,'json':!![]};rp(_0x50da34)[_0x2999('0x17')](function(_0x1403d9){if(_0x1403d9[_0x2999('0x36')][0x0]['message_id']){return _0x5bf7da[_0x2999('0x18')]({'messageId':_0x1403d9[_0x2999('0x36')][0x0][_0x2999('0x37')]});}})[_0x2999('0x1a')](function(_0x389209){logger['err'](_0x2999('0x38'),_0x389209);});break;}}})[_0x2999('0x39')](function(){_0x290839();});}else{_0x290839();}}},'charset':'utf8mb4','collate':_0x2999('0x3a')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 7c65c21..731feb3 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 _0x17c4=['../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','WhatsappMessage','create','options','then','CreateWhatsappMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2a2b4,_0xcc17b){var _0x16bec5=function(_0x5d5e08){while(--_0x5d5e08){_0x2a2b4['push'](_0x2a2b4['shift']());}};_0x16bec5(++_0xcc17b);}(_0x17c4,0x1ca));var _0x417c=function(_0x2af99e,_0x3b12b2){_0x2af99e=_0x2af99e-0x0;var _0x167bef=_0x17c4[_0x2af99e];return _0x167bef;};'use strict';var _=require(_0x417c('0x0'));var util=require(_0x417c('0x1'));var moment=require(_0x417c('0x2'));var BPromise=require(_0x417c('0x3'));var rs=require(_0x417c('0x4'));var fs=require('fs');var Redis=require(_0x417c('0x5'));var db=require(_0x417c('0x6'))['db'];var utils=require(_0x417c('0x7'));var logger=require('../../config/logger')(_0x417c('0x8'));var config=require('../../config/environment');var jayson=require(_0x417c('0x9'));var client=jayson[_0x417c('0xa')]['http']({'port':0x232a});config[_0x417c('0xb')]=_[_0x417c('0xc')](config[_0x417c('0xb')],{'host':_0x417c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x417c('0xb')]));require(_0x417c('0xe'))[_0x417c('0xf')](socket);function respondWithRpcPromise(_0x123a6b,_0x5a76d0,_0xed11fe){return new BPromise(function(_0x3f51cd,_0x332c4c){return client[_0x417c('0x10')](_0x123a6b,_0xed11fe)['then'](function(_0x39591a){logger[_0x417c('0x11')](_0x417c('0x12'),_0x5a76d0,_0x417c('0x13'));logger['debug'](_0x417c('0x14'),_0x5a76d0,_0x417c('0x13'),JSON[_0x417c('0x15')](_0x39591a));if(_0x39591a[_0x417c('0x16')]){if(_0x39591a[_0x417c('0x16')][_0x417c('0x17')]===0x1f4){logger[_0x417c('0x16')](_0x417c('0x12'),_0x5a76d0,_0x39591a['error'][_0x417c('0x18')]);return _0x332c4c(_0x39591a[_0x417c('0x16')][_0x417c('0x18')]);}logger[_0x417c('0x16')](_0x417c('0x12'),_0x5a76d0,_0x39591a['error'][_0x417c('0x18')]);return _0x3f51cd(_0x39591a[_0x417c('0x16')][_0x417c('0x18')]);}else{logger[_0x417c('0x11')](_0x417c('0x12'),_0x5a76d0,_0x417c('0x13'));_0x3f51cd(_0x39591a[_0x417c('0x19')]['message']);}})['catch'](function(_0x4eec31){logger['error'](_0x417c('0x12'),_0x5a76d0,_0x4eec31);_0x332c4c(_0x4eec31);});});}exports['CreateWhatsappMessage']=function(_0x52b619){var _0x379e94=this;return new Promise(function(_0x56b835,_0x2e4d95){return db[_0x417c('0x1a')][_0x417c('0x1b')](_0x52b619['body'],{'raw':_0x52b619['options']?_0x52b619[_0x417c('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x417c('0x1d')](function(_0x299328){logger[_0x417c('0x11')](_0x417c('0x1e'),_0x52b619);logger['debug'](_0x417c('0x1e'),_0x52b619,JSON['stringify'](_0x299328));_0x56b835(_0x299328);})['catch'](function(_0x484f42){logger[_0x417c('0x16')]('CreateWhatsappMessage',_0x484f42[_0x417c('0x18')],_0x52b619);_0x2e4d95(_0x379e94[_0x417c('0x16')](0x1f4,_0x484f42[_0x417c('0x18')]));});});}; \ No newline at end of file +var _0x4108=['create','body','options','raw','CreateWhatsappMessage','stringify','lodash','util','moment','randomstring','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4108,0xee));var _0x8410=function(_0x4a1e6b,_0x48e247){_0x4a1e6b=_0x4a1e6b-0x0;var _0x19bf46=_0x4108[_0x4a1e6b];return _0x19bf46;};'use strict';var _=require(_0x8410('0x0'));var util=require(_0x8410('0x1'));var moment=require(_0x8410('0x2'));var BPromise=require('bluebird');var rs=require(_0x8410('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8410('0x4'));var config=require(_0x8410('0x5'));var jayson=require(_0x8410('0x6'));var client=jayson[_0x8410('0x7')]['http']({'port':0x232a});config[_0x8410('0x8')]=_[_0x8410('0x9')](config[_0x8410('0x8')],{'host':_0x8410('0xa'),'port':0x18eb});var socket=require(_0x8410('0xb'))(new Redis(config[_0x8410('0x8')]));require(_0x8410('0xc'))[_0x8410('0xd')](socket);function respondWithRpcPromise(_0x2cbcbc,_0x3c6425,_0x45c32f){return new BPromise(function(_0x280344,_0xb68cb){return client['request'](_0x2cbcbc,_0x45c32f)[_0x8410('0xe')](function(_0x4f0c8f){logger['info'](_0x8410('0xf'),_0x3c6425,_0x8410('0x10'));logger['debug'](_0x8410('0x11'),_0x3c6425,_0x8410('0x10'),JSON['stringify'](_0x4f0c8f));if(_0x4f0c8f[_0x8410('0x12')]){if(_0x4f0c8f['error'][_0x8410('0x13')]===0x1f4){logger[_0x8410('0x12')](_0x8410('0xf'),_0x3c6425,_0x4f0c8f['error'][_0x8410('0x14')]);return _0xb68cb(_0x4f0c8f['error'][_0x8410('0x14')]);}logger[_0x8410('0x12')](_0x8410('0xf'),_0x3c6425,_0x4f0c8f['error']['message']);return _0x280344(_0x4f0c8f[_0x8410('0x12')][_0x8410('0x14')]);}else{logger[_0x8410('0x15')](_0x8410('0xf'),_0x3c6425,'request\x20sent');_0x280344(_0x4f0c8f['result'][_0x8410('0x14')]);}})[_0x8410('0x16')](function(_0x1f6718){logger[_0x8410('0x12')](_0x8410('0xf'),_0x3c6425,_0x1f6718);_0xb68cb(_0x1f6718);});});}exports['CreateWhatsappMessage']=function(_0x3e4b14){var _0x18eeb5=this;return new Promise(function(_0x66f049,_0x2e50e0){return db['WhatsappMessage'][_0x8410('0x17')](_0x3e4b14[_0x8410('0x18')],{'raw':_0x3e4b14['options']?_0x3e4b14[_0x8410('0x19')][_0x8410('0x1a')]===undefined?!![]:![]:!![]})[_0x8410('0xe')](function(_0x5886d2){logger['info'](_0x8410('0x1b'),_0x3e4b14);logger['debug'](_0x8410('0x1b'),_0x3e4b14,JSON[_0x8410('0x1c')](_0x5886d2));_0x66f049(_0x5886d2);})[_0x8410('0x16')](function(_0x2b941f){logger[_0x8410('0x12')]('CreateWhatsappMessage',_0x2b941f[_0x8410('0x14')],_0x3e4b14);_0x2e50e0(_0x18eeb5['error'](0x1f4,_0x2b941f['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 544ae9f..659a86c 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 _0x7731=['register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener'];(function(_0xadbaeb,_0x13c8c9){var _0x3bb7f2=function(_0x4b4eb8){while(--_0x4b4eb8){_0xadbaeb['push'](_0xadbaeb['shift']());}};_0x3bb7f2(++_0x13c8c9);}(_0x7731,0xff));var _0x1773=function(_0x4c7570,_0x3bcd63){_0x4c7570=_0x4c7570-0x0;var _0x5ab42e=_0x7731[_0x4c7570];return _0x5ab42e;};'use strict';var WhatsappMessageEvents=require(_0x1773('0x0'));var events=[_0x1773('0x1'),_0x1773('0x2'),_0x1773('0x3')];function createListener(_0x591c07,_0x1d58c6){return function(_0x179a96){_0x1d58c6[_0x1773('0x4')](_0x591c07,_0x179a96);};}function removeListener(_0x3a9485,_0x3bb68c){return function(){WhatsappMessageEvents[_0x1773('0x5')](_0x3a9485,_0x3bb68c);};}exports[_0x1773('0x6')]=function(_0xf3ad61){for(var _0x2265bd=0x0,_0x31cf64=events[_0x1773('0x7')];_0x2265bd<_0x31cf64;_0x2265bd++){var _0x429930=events[_0x2265bd];var _0x48556a=createListener(_0x1773('0x8')+_0x429930,_0xf3ad61);WhatsappMessageEvents['on'](_0x429930,_0x48556a);}}; \ No newline at end of file +var _0x5115=['removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit'];(function(_0x43444b,_0x8cf95b){var _0x392fe5=function(_0x7a1a82){while(--_0x7a1a82){_0x43444b['push'](_0x43444b['shift']());}};_0x392fe5(++_0x8cf95b);}(_0x5115,0x82));var _0x5511=function(_0x4d189e,_0x2c0a04){_0x4d189e=_0x4d189e-0x0;var _0x1b36df=_0x5115[_0x4d189e];return _0x1b36df;};'use strict';var WhatsappMessageEvents=require(_0x5511('0x0'));var events=[_0x5511('0x1'),_0x5511('0x2'),_0x5511('0x3')];function createListener(_0xe4efdf,_0x5afd04){return function(_0x3f5b7a){_0x5afd04[_0x5511('0x4')](_0xe4efdf,_0x3f5b7a);};}function removeListener(_0xa64479,_0x439948){return function(){WhatsappMessageEvents[_0x5511('0x5')](_0xa64479,_0x439948);};}exports[_0x5511('0x6')]=function(_0x38bc6e){for(var _0x24c70e=0x0,_0x5dcb2c=events[_0x5511('0x7')];_0x24c70e<_0x5dcb2c;_0x24c70e++){var _0x3622dc=events[_0x24c70e];var _0x29d664=createListener(_0x5511('0x8')+_0x3622dc,_0x38bc6e);WhatsappMessageEvents['on'](_0x3622dc,_0x29d664);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 622c788..2bc7973 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 _0xbe48=['getTeams','/:id/users','getAgents','create','post','addAgents','put','update','delete','removeTeams','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams'];(function(_0xc7fe05,_0x291c9c){var _0x483b9e=function(_0x37d31d){while(--_0x37d31d){_0xc7fe05['push'](_0xc7fe05['shift']());}};_0x483b9e(++_0x291c9c);}(_0xbe48,0xea));var _0x8be4=function(_0x3791c8,_0x567dbb){_0x3791c8=_0x3791c8-0x0;var _0x5b64ac=_0xbe48[_0x3791c8];return _0x5b64ac;};'use strict';var multer=require(_0x8be4('0x0'));var util=require(_0x8be4('0x1'));var path=require(_0x8be4('0x2'));var timeout=require(_0x8be4('0x3'));var express=require(_0x8be4('0x4'));var router=express[_0x8be4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8be4('0x6'));var interaction=require(_0x8be4('0x7'));var config=require(_0x8be4('0x8'));var controller=require('./whatsappQueue.controller');router[_0x8be4('0x9')]('/',auth[_0x8be4('0xa')](),controller[_0x8be4('0xb')]);router[_0x8be4('0x9')](_0x8be4('0xc'),auth[_0x8be4('0xa')](),controller[_0x8be4('0xd')]);router['get'](_0x8be4('0xe'),auth['isAuthenticated'](),controller[_0x8be4('0xf')]);router[_0x8be4('0x9')](_0x8be4('0x10'),auth[_0x8be4('0xa')](),controller['getMembers']);router[_0x8be4('0x9')](_0x8be4('0x11'),auth['isAuthenticated'](),controller[_0x8be4('0x12')]);router['get'](_0x8be4('0x13'),auth[_0x8be4('0xa')](),controller[_0x8be4('0x14')]);router['post']('/',auth[_0x8be4('0xa')](),controller[_0x8be4('0x15')]);router[_0x8be4('0x16')]('/:id/teams',auth[_0x8be4('0xa')](),controller['addTeams']);router[_0x8be4('0x16')](_0x8be4('0x13'),auth[_0x8be4('0xa')](),controller[_0x8be4('0x17')]);router[_0x8be4('0x18')]('/:id',auth[_0x8be4('0xa')](),controller[_0x8be4('0x19')]);router['delete'](_0x8be4('0xe'),auth[_0x8be4('0xa')](),controller['destroy']);router[_0x8be4('0x1a')]('/:id/teams',auth[_0x8be4('0xa')](),controller[_0x8be4('0x1b')]);router[_0x8be4('0x1a')](_0x8be4('0x13'),auth[_0x8be4('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xd97c=['removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create','post','addTeams','addAgents','/:id','update','delete','destroy','removeTeams'];(function(_0x99f958,_0x2bf020){var _0x97632d=function(_0x3f0f02){while(--_0x3f0f02){_0x99f958['push'](_0x99f958['shift']());}};_0x97632d(++_0x2bf020);}(_0xd97c,0x11a));var _0xcd97=function(_0x2f8992,_0x7e17a4){_0x2f8992=_0x2f8992-0x0;var _0x51ae90=_0xd97c[_0x2f8992];return _0x51ae90;};'use strict';var multer=require(_0xcd97('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcd97('0x1'));var express=require(_0xcd97('0x2'));var router=express[_0xcd97('0x3')]();var fs_extra=require(_0xcd97('0x4'));var auth=require(_0xcd97('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcd97('0x6'));var controller=require(_0xcd97('0x7'));router[_0xcd97('0x8')]('/',auth[_0xcd97('0x9')](),controller[_0xcd97('0xa')]);router[_0xcd97('0x8')](_0xcd97('0xb'),auth[_0xcd97('0x9')](),controller['describe']);router['get']('/:id',auth[_0xcd97('0x9')](),controller['show']);router[_0xcd97('0x8')](_0xcd97('0xc'),auth[_0xcd97('0x9')](),controller[_0xcd97('0xd')]);router['get'](_0xcd97('0xe'),auth[_0xcd97('0x9')](),controller[_0xcd97('0xf')]);router['get'](_0xcd97('0x10'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0xcd97('0x9')](),controller[_0xcd97('0x11')]);router[_0xcd97('0x12')](_0xcd97('0xe'),auth[_0xcd97('0x9')](),controller[_0xcd97('0x13')]);router[_0xcd97('0x12')](_0xcd97('0x10'),auth[_0xcd97('0x9')](),controller[_0xcd97('0x14')]);router['put'](_0xcd97('0x15'),auth[_0xcd97('0x9')](),controller[_0xcd97('0x16')]);router[_0xcd97('0x17')](_0xcd97('0x15'),auth[_0xcd97('0x9')](),controller[_0xcd97('0x18')]);router['delete'](_0xcd97('0xe'),auth[_0xcd97('0x9')](),controller[_0xcd97('0x19')]);router['delete'](_0xcd97('0x10'),auth[_0xcd97('0x9')](),controller[_0xcd97('0x1a')]);module[_0xcd97('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 10d736d..3d07983 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 _0x3189=['sequelize','exports','name','INTEGER','ENUM','beepall'];(function(_0x364048,_0x34dea3){var _0x591678=function(_0x239c0a){while(--_0x239c0a){_0x364048['push'](_0x364048['shift']());}};_0x591678(++_0x34dea3);}(_0x3189,0xae));var _0x9318=function(_0x5339a9,_0x351dc1){_0x5339a9=_0x5339a9-0x0;var _0xc31f2a=_0x3189[_0x5339a9];return _0xc31f2a;};'use strict';var Sequelize=require(_0x9318('0x0'));module[_0x9318('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9318('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9318('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9318('0x4')]('rrmemory',_0x9318('0x5'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe3ed=['name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x529abc,_0x17b97e){var _0x453afa=function(_0x536263){while(--_0x536263){_0x529abc['push'](_0x529abc['shift']());}};_0x453afa(++_0x17b97e);}(_0xe3ed,0x8d));var _0xde3e=function(_0x390a47,_0x3f1271){_0x390a47=_0x390a47-0x0;var _0x248e07=_0xe3ed[_0x390a47];return _0x248e07;};'use strict';var Sequelize=require(_0xde3e('0x0'));module[_0xde3e('0x1')]={'name':{'type':Sequelize[_0xde3e('0x2')],'unique':_0xde3e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xde3e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xde3e('0x5')](_0xde3e('0x6'),_0xde3e('0x7'),'roundrobin')},'description':{'type':Sequelize[_0xde3e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 24ef807..f8a852a 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 _0xdc22=['findOrCreate','forEach','userWhatsappQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','union','compact','value','removeAgents','emit','addAgents','spread','isArray','userWhatsappQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','update','destroy','then','get','WhatsappQueues','UserProfileResource','error','stack','name','send','rawAttributes','getOptions','where','query','rows','catch','show','params','model','keys','intersection','attributes','fields','include','merge','options','WhatsappQueue','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','filters','order','sort','pick','WhatsappQueueId','filter','UserWhatsappQueue','findAll','User','UserId','agent','whatsappPause','map','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','length','hasOwnProperty','nolimit','Agents','online','interface','transaction','addTeams'];(function(_0x56a715,_0x1ba2c3){var _0x12e87b=function(_0x46c10c){while(--_0x46c10c){_0x56a715['push'](_0x56a715['shift']());}};_0x12e87b(++_0x1ba2c3);}(_0xdc22,0x105));var _0x2dc2=function(_0x4ddfe1,_0x35939d){_0x4ddfe1=_0x4ddfe1-0x0;var _0x4aaf51=_0xdc22[_0x4ddfe1];return _0x4aaf51;};'use strict';var BPromise=require(_0x2dc2('0x0'));var util=require(_0x2dc2('0x1'));var _=require(_0x2dc2('0x2'));var squel=require(_0x2dc2('0x3'));var Redis=require(_0x2dc2('0x4'));var qs=require(_0x2dc2('0x5'));var logger=require(_0x2dc2('0x6'))(_0x2dc2('0x7'));var config=require(_0x2dc2('0x8'));var db=require(_0x2dc2('0x9'))['db'];config[_0x2dc2('0xa')]=_['defaults'](config[_0x2dc2('0xa')],{'host':_0x2dc2('0xb'),'port':0x18eb});var socket=require(_0x2dc2('0xc'))(new Redis(config[_0x2dc2('0xa')]));require(_0x2dc2('0xd'))['register'](socket);function respondWithStatusCode(_0x49ac96,_0x3af900){_0x3af900=_0x3af900||0xcc;return function(_0x2fce1f){if(_0x2fce1f){return _0x49ac96[_0x2dc2('0xe')](_0x3af900);}return _0x49ac96[_0x2dc2('0xf')](_0x3af900)[_0x2dc2('0x10')]();};}function respondWithResult(_0x461a7c,_0x478d04){_0x478d04=_0x478d04||0xc8;return function(_0x44e619){if(_0x44e619){return _0x461a7c['status'](_0x478d04)[_0x2dc2('0x11')](_0x44e619);}};}function respondWithFilteredResult(_0x18cf02,_0xe740c0){return function(_0x29c8e8){if(_0x29c8e8){var _0x14d1cf=typeof _0xe740c0['offset']===_0x2dc2('0x12')&&typeof _0xe740c0[_0x2dc2('0x13')]===_0x2dc2('0x12');var _0x38b931=_0x29c8e8['count'];var _0x4bb657=_0x14d1cf?0x0:_0xe740c0[_0x2dc2('0x14')];var _0x33062f=_0x14d1cf?_0x29c8e8[_0x2dc2('0x15')]:_0xe740c0[_0x2dc2('0x14')]+_0xe740c0[_0x2dc2('0x13')];var _0x1a75ae;if(_0x33062f>=_0x38b931){_0x33062f=_0x38b931;_0x1a75ae=0xc8;}else{_0x1a75ae=0xce;}_0x18cf02[_0x2dc2('0xf')](_0x1a75ae);return _0x18cf02[_0x2dc2('0x16')](_0x2dc2('0x17'),_0x4bb657+'-'+_0x33062f+'/'+_0x38b931)[_0x2dc2('0x11')](_0x29c8e8);}return null;};}function saveUpdates(_0x5afa14){return function(_0x465d9c){if(_0x465d9c){return _0x465d9c[_0x2dc2('0x18')](_0x5afa14)['then'](function(_0xf2fa06){return _0xf2fa06;});}return null;};}function removeEntity(_0x46970a){return function(_0x390ad7){if(_0x390ad7){return _0x390ad7[_0x2dc2('0x19')]()[_0x2dc2('0x1a')](function(){var _0x55e561=_0x390ad7[_0x2dc2('0x1b')]({'plain':!![]});var _0x838a51=_0x2dc2('0x1c');return db[_0x2dc2('0x1d')][_0x2dc2('0x19')]({'where':{'type':_0x838a51,'resourceId':_0x55e561['id']}})['then'](function(){return _0x390ad7;});})[_0x2dc2('0x1a')](function(){_0x46970a[_0x2dc2('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1002dc){return function(_0x49e026){if(!_0x49e026){_0x1002dc[_0x2dc2('0xe')](0x194);}return _0x49e026;};}function handleError(_0x1e9aa0,_0x4a1050){_0x4a1050=_0x4a1050||0x1f4;return function(_0x11b5f2){logger[_0x2dc2('0x1e')](_0x11b5f2[_0x2dc2('0x1f')]);if(_0x11b5f2[_0x2dc2('0x20')]){delete _0x11b5f2[_0x2dc2('0x20')];}_0x1e9aa0['status'](_0x4a1050)[_0x2dc2('0x21')](_0x11b5f2);};}exports['index']=function(_0x5de865,_0x19b6eb){var _0x2852ef={};var _0x319e39={'count':0x0,'rows':[]};var _0x4bc8f1=_['map'](db['WhatsappQueue'][_0x2dc2('0x22')],function(_0x2cfb17){return{'name':_0x2cfb17['fieldName'],'type':_0x2cfb17['type']['key']};});_0x2852ef=qs[_0x2dc2('0x23')](_0x4bc8f1,_0x5de865);var _0x55b7f0={'where':_0x2852ef[_0x2dc2('0x24')]};return db['WhatsappQueue']['count'](_0x55b7f0)[_0x2dc2('0x1a')](function(_0x4bf0a3){_0x319e39[_0x2dc2('0x15')]=_0x4bf0a3;_0x2852ef['include']=qs['include'](_0x5de865[_0x2dc2('0x25')]);return db['WhatsappQueue']['findAll'](_0x2852ef);})[_0x2dc2('0x1a')](function(_0x2bb90e){_0x319e39[_0x2dc2('0x26')]=_0x2bb90e;return _0x319e39;})[_0x2dc2('0x1a')](respondWithFilteredResult(_0x19b6eb,_0x2852ef))[_0x2dc2('0x27')](handleError(_0x19b6eb,null));};exports[_0x2dc2('0x28')]=function(_0x87c1ff,_0x5a3711){var _0x583607={'raw':!![],'where':{'id':_0x87c1ff[_0x2dc2('0x29')]['id']}},_0x3be8e9={};_0x3be8e9[_0x2dc2('0x2a')]=_[_0x2dc2('0x2b')](db['WhatsappQueue'][_0x2dc2('0x22')]);_0x3be8e9['query']=_[_0x2dc2('0x2b')](_0x87c1ff[_0x2dc2('0x25')]);_0x3be8e9['filters']=_[_0x2dc2('0x2c')](_0x3be8e9['model'],_0x3be8e9['query']);_0x583607[_0x2dc2('0x2d')]=_[_0x2dc2('0x2c')](_0x3be8e9[_0x2dc2('0x2a')],qs[_0x2dc2('0x2e')](_0x87c1ff[_0x2dc2('0x25')]['fields']));_0x583607['attributes']=_0x583607[_0x2dc2('0x2d')]['length']?_0x583607[_0x2dc2('0x2d')]:_0x3be8e9[_0x2dc2('0x2a')];if(_0x87c1ff['query']['includeAll']){_0x583607[_0x2dc2('0x2f')]=[{'all':!![]}];}_0x583607=_[_0x2dc2('0x30')]({},_0x583607,_0x87c1ff[_0x2dc2('0x31')]);return db[_0x2dc2('0x32')][_0x2dc2('0x33')](_0x583607)['then'](handleEntityNotFound(_0x5a3711,null))[_0x2dc2('0x1a')](respondWithResult(_0x5a3711,null))[_0x2dc2('0x27')](handleError(_0x5a3711,null));};exports[_0x2dc2('0x34')]=function(_0x5cf9e8,_0x3608c9){return db[_0x2dc2('0x32')][_0x2dc2('0x34')](_0x5cf9e8[_0x2dc2('0x35')],{})['then'](function(_0x258d95){var _0x10c7cc=_0x5cf9e8[_0x2dc2('0x36')][_0x2dc2('0x1b')]({'plain':!![]});if(!_0x10c7cc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10c7cc['role']==='user'){var _0x35f520=_0x258d95[_0x2dc2('0x1b')]({'plain':!![]});var _0x5429f3=_0x2dc2('0x1c');return db[_0x2dc2('0x37')][_0x2dc2('0x33')]({'where':{'name':_0x5429f3,'userProfileId':_0x10c7cc['userProfileId']},'raw':!![]})[_0x2dc2('0x1a')](function(_0x19b198){if(_0x19b198&&_0x19b198[_0x2dc2('0x38')]===0x0){return db[_0x2dc2('0x1d')][_0x2dc2('0x34')]({'name':_0x35f520['name'],'resourceId':_0x35f520['id'],'type':_0x19b198[_0x2dc2('0x20')],'sectionId':_0x19b198['id']},{})['then'](function(){return _0x258d95;});}else{return _0x258d95;}})['catch'](function(_0x37b45c){logger[_0x2dc2('0x1e')](_0x2dc2('0x39'),_0x37b45c);throw _0x37b45c;});}return _0x258d95;})[_0x2dc2('0x1a')](respondWithResult(_0x3608c9,0xc9))[_0x2dc2('0x27')](handleError(_0x3608c9,null));};exports[_0x2dc2('0x18')]=function(_0x4c5610,_0xb1a1bb){if(_0x4c5610[_0x2dc2('0x35')]['id']){delete _0x4c5610['body']['id'];}return db[_0x2dc2('0x32')]['find']({'where':{'id':_0x4c5610['params']['id']}})[_0x2dc2('0x1a')](handleEntityNotFound(_0xb1a1bb,null))[_0x2dc2('0x1a')](saveUpdates(_0x4c5610[_0x2dc2('0x35')],null))[_0x2dc2('0x1a')](respondWithResult(_0xb1a1bb,null))[_0x2dc2('0x27')](handleError(_0xb1a1bb,null));};exports[_0x2dc2('0x19')]=function(_0x129ef6,_0x460818){return db['WhatsappQueue'][_0x2dc2('0x33')]({'where':{'id':_0x129ef6['params']['id']}})[_0x2dc2('0x1a')](handleEntityNotFound(_0x460818,null))[_0x2dc2('0x1a')](removeEntity(_0x460818,null))[_0x2dc2('0x27')](handleError(_0x460818,null));};exports['describe']=function(_0x24b2ff,_0x124415){return db[_0x2dc2('0x32')][_0x2dc2('0x3a')]()['then'](respondWithResult(_0x124415,null))[_0x2dc2('0x27')](handleError(_0x124415,null));};exports['getMembers']=function(_0x444145,_0x37f28c){var _0x18378e={'raw':!![],'where':{}},_0x170458={},_0x2dff5d;return db[_0x2dc2('0x32')][_0x2dc2('0x3b')]({'where':{'id':_0x444145[_0x2dc2('0x29')]['id']}})[_0x2dc2('0x1a')](handleEntityNotFound(_0x37f28c,null))['then'](function(_0x412fa5){if(_0x412fa5){_0x2dff5d=_0x412fa5['get']({'plain':!![]});_0x170458[_0x2dc2('0x2a')]=_[_0x2dc2('0x2b')](db['UserWhatsappQueue']['rawAttributes']);_0x170458[_0x2dc2('0x25')]=_[_0x2dc2('0x2b')](_0x444145['query']);_0x170458[_0x2dc2('0x3c')]=_[_0x2dc2('0x2c')](_0x170458['model'],_0x170458[_0x2dc2('0x25')]);_0x18378e[_0x2dc2('0x2d')]=_[_0x2dc2('0x2c')](_0x170458[_0x2dc2('0x2a')],qs[_0x2dc2('0x2e')](_0x444145[_0x2dc2('0x25')][_0x2dc2('0x2e')]));_0x18378e[_0x2dc2('0x2d')]=_0x18378e[_0x2dc2('0x2d')]['length']?_0x18378e[_0x2dc2('0x2d')]:_0x170458['model'];if(!_0x444145[_0x2dc2('0x25')]['hasOwnProperty']('nolimit')){_0x18378e['limit']=qs[_0x2dc2('0x13')](_0x444145[_0x2dc2('0x25')]['limit']);_0x18378e[_0x2dc2('0x14')]=qs['offset'](_0x444145[_0x2dc2('0x25')][_0x2dc2('0x14')]);}_0x18378e[_0x2dc2('0x3d')]=qs[_0x2dc2('0x3e')](_0x444145[_0x2dc2('0x25')][_0x2dc2('0x3e')]);_0x18378e[_0x2dc2('0x24')]=qs['filters'](_[_0x2dc2('0x3f')](_0x444145['query'],_0x170458[_0x2dc2('0x3c')]));_0x18378e[_0x2dc2('0x24')][_0x2dc2('0x40')]=_0x412fa5['id'];if(_0x444145[_0x2dc2('0x25')][_0x2dc2('0x41')]){_0x18378e[_0x2dc2('0x24')]=_[_0x2dc2('0x30')](_0x18378e[_0x2dc2('0x24')],{'$or':_['map'](_0x18378e['attributes'],function(_0x3d9fb2){var _0x535012={};_0x535012[_0x3d9fb2]={'$like':'%'+_0x444145[_0x2dc2('0x25')]['filter']+'%'};return _0x535012;})});}_0x18378e=_[_0x2dc2('0x30')]({},_0x18378e,_0x444145[_0x2dc2('0x31')]);return db[_0x2dc2('0x42')][_0x2dc2('0x43')](_0x18378e);}})[_0x2dc2('0x1a')](function(_0x1e96a7){if(_0x1e96a7){return db[_0x2dc2('0x44')]['findAndCountAll']({'where':{'id':_['map'](_0x1e96a7,_0x2dc2('0x45')),'role':_0x2dc2('0x46')},'attributes':['id',_0x2dc2('0x20'),_0x2dc2('0x47'),'updatedAt','createdAt']});}})[_0x2dc2('0x1a')](function(_0xd99cc9){if(_0xd99cc9){return{'count':_0xd99cc9[_0x2dc2('0x15')],'rows':_[_0x2dc2('0x48')](_0xd99cc9[_0x2dc2('0x26')],function(_0x219368){return{'membername':_0x219368['name'],'UserId':_0x219368['id'],'queue_name':_0x2dff5d[_0x2dc2('0x20')],'WhatsappQueueId':_0x2dff5d['id'],'interface':util['format'](_0x2dc2('0x49'),_0x2dc2('0x4a'),_0x219368[_0x2dc2('0x20')]),'penalty':0x0,'paused':_0x219368[_0x2dc2('0x47')],'createdAt':_0x219368[_0x2dc2('0x4b')],'updatedAt':_0x219368[_0x2dc2('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2dc2('0x1a')](respondWithFilteredResult(_0x37f28c,_0x18378e))[_0x2dc2('0x27')](handleError(_0x37f28c,null));};exports[_0x2dc2('0x4d')]=function(_0x4e360a,_0x4b341c){var _0x15118a={};var _0x347409={};var _0x1c738e;var _0x45d561;return db['WhatsappQueue'][_0x2dc2('0x3b')]({'where':{'id':_0x4e360a['params']['id']}})[_0x2dc2('0x1a')](handleEntityNotFound(_0x4b341c,null))[_0x2dc2('0x1a')](function(_0x499675){if(_0x499675){_0x1c738e=_0x499675;_0x347409[_0x2dc2('0x2a')]=_[_0x2dc2('0x2b')](db[_0x2dc2('0x4e')][_0x2dc2('0x22')]);_0x347409['query']=_[_0x2dc2('0x2b')](_0x4e360a[_0x2dc2('0x25')]);_0x347409[_0x2dc2('0x3c')]=_['intersection'](_0x347409[_0x2dc2('0x2a')],_0x347409[_0x2dc2('0x25')]);_0x15118a['attributes']=_[_0x2dc2('0x2c')](_0x347409[_0x2dc2('0x2a')],qs[_0x2dc2('0x2e')](_0x4e360a['query'][_0x2dc2('0x2e')]));_0x15118a[_0x2dc2('0x2d')]=_0x15118a[_0x2dc2('0x2d')][_0x2dc2('0x4f')]?_0x15118a['attributes']:_0x347409[_0x2dc2('0x2a')];_0x15118a[_0x2dc2('0x3d')]=qs[_0x2dc2('0x3e')](_0x4e360a[_0x2dc2('0x25')][_0x2dc2('0x3e')]);_0x15118a[_0x2dc2('0x24')]=qs['filters'](_[_0x2dc2('0x3f')](_0x4e360a[_0x2dc2('0x25')],_0x347409[_0x2dc2('0x3c')]));if(_0x4e360a[_0x2dc2('0x25')]['filter']){_0x15118a['where']=_[_0x2dc2('0x30')](_0x15118a[_0x2dc2('0x24')],{'$or':_[_0x2dc2('0x48')](_0x15118a['attributes'],function(_0x424d63){var _0x214896={};_0x214896[_0x424d63]={'$like':'%'+_0x4e360a[_0x2dc2('0x25')][_0x2dc2('0x41')]+'%'};return _0x214896;})});}_0x15118a=_['merge']({},_0x15118a,_0x4e360a[_0x2dc2('0x31')]);return _0x1c738e[_0x2dc2('0x4d')](_0x15118a);}})['then'](function(_0x596ee3){if(_0x596ee3){_0x45d561=_0x596ee3[_0x2dc2('0x4f')];if(!_0x4e360a['query'][_0x2dc2('0x50')](_0x2dc2('0x51'))){_0x15118a['limit']=qs[_0x2dc2('0x13')](_0x4e360a[_0x2dc2('0x25')]['limit']);_0x15118a[_0x2dc2('0x14')]=qs[_0x2dc2('0x14')](_0x4e360a[_0x2dc2('0x25')][_0x2dc2('0x14')]);}return _0x1c738e[_0x2dc2('0x4d')](_0x15118a);}})['then'](function(_0x30c82b){if(_0x30c82b){return _0x30c82b?{'count':_0x45d561,'rows':_0x30c82b}:null;}})['then'](respondWithResult(_0x4b341c,null))[_0x2dc2('0x27')](handleError(_0x4b341c,null));};exports['addTeams']=function(_0x5e2cf0,_0x1b7405){var _0x11adc8=_0x5e2cf0[_0x2dc2('0x35')]['ids'];return db[_0x2dc2('0x4e')][_0x2dc2('0x43')]({'where':{'id':_0x11adc8},'attributes':['id'],'include':[{'model':db[_0x2dc2('0x44')],'as':_0x2dc2('0x52'),'attributes':['id',_0x2dc2('0x20'),_0x2dc2('0x53'),'voicePause',_0x2dc2('0x54')],'raw':!![]}]})[_0x2dc2('0x1a')](function(_0x3f441c){if(_0x3f441c){var _0x40f97a=_['flatMap'](_0x3f441c,function(_0x18aa1d){var _0x30cc65=_0x18aa1d[_0x2dc2('0x1b')]({'plain':!![]});return _0x30cc65['Agents'];});return db[_0x2dc2('0x32')][_0x2dc2('0x33')]({'where':{'id':_0x5e2cf0['params']['id']}})[_0x2dc2('0x1a')](function(_0x2f6b1c){return db['sequelize'][_0x2dc2('0x55')](function(_0x1d9d8a){return _0x2f6b1c[_0x2dc2('0x56')](_0x11adc8,{'transaction':_0x1d9d8a})[_0x2dc2('0x1a')](function(){return BPromise['each'](_0x40f97a,function(_0x214b65){return db[_0x2dc2('0x42')][_0x2dc2('0x57')]({'where':{'UserId':_0x214b65['id'],'WhatsappQueueId':_0x5e2cf0[_0x2dc2('0x29')]['id']},'transaction':_0x1d9d8a});});})[_0x2dc2('0x1a')](function(){_0x40f97a[_0x2dc2('0x58')](function(_0x26a5d5){socket['emit'](_0x2dc2('0x59'),{'UserId':_0x26a5d5['id'],'WhatsappQueueId':_0x2f6b1c['id']});});});});});}})[_0x2dc2('0x1a')](respondWithStatusCode(_0x1b7405,null))[_0x2dc2('0x27')](handleError(_0x1b7405,null));};exports[_0x2dc2('0x5a')]=function(_0x28e2cb,_0x590ec3){return db[_0x2dc2('0x4e')][_0x2dc2('0x43')]({'where':{'id':_0x28e2cb['query'][_0x2dc2('0x5b')]},'attributes':['id'],'include':[{'model':db[_0x2dc2('0x44')],'as':_0x2dc2('0x52'),'attributes':['id'],'raw':!![]}]})[_0x2dc2('0x1a')](handleEntityNotFound(_0x590ec3,null))[_0x2dc2('0x1a')](function(_0x253b1e){var _0x421e71=_[_0x2dc2('0x48')](_0x253b1e,'id');var _0x42c440=[];var _0x3ac884=[];var _0x1b7551=squel[_0x2dc2('0x5c')]();_0x1b7551[_0x2dc2('0x5d')](_0x2dc2('0x5e'))[_0x2dc2('0x5f')]('team_has_whatsapp_queues','tq')[_0x2dc2('0x60')](_0x2dc2('0x61'),'ut',_0x2dc2('0x62'))[_0x2dc2('0x24')](_0x2dc2('0x63'),_0x28e2cb['params']['id']);for(var _0x5e67de=0x0;_0x5e67de<_0x253b1e[_0x2dc2('0x4f')];_0x5e67de+=0x1){let _0x19c6fa=_0x253b1e[_0x5e67de];for(var _0x17beb2=0x0;_0x17beb2<_0x19c6fa[_0x2dc2('0x52')]['length'];_0x17beb2+=0x1){let _0x2f629e=_0x19c6fa[_0x2dc2('0x52')][_0x17beb2];var _0x74cf12=_0x1b7551[_0x2dc2('0x64')]();_0x74cf12[_0x2dc2('0x24')](_0x2dc2('0x65'),_0x2f629e['id']);_0x3ac884['push'](db[_0x2dc2('0x66')][_0x2dc2('0x25')](_0x74cf12['toString'](),{'type':db[_0x2dc2('0x66')][_0x2dc2('0x67')][_0x2dc2('0x68')]})[_0x2dc2('0x1a')](function(_0x40cbcb){if(_0x40cbcb[_0x2dc2('0x4f')]===0x1){return _0x2f629e['id'];}else{var _0x2f3b3f=_[_0x2dc2('0x69')](_[_0x2dc2('0x48')](_0x40cbcb,'TeamId'),function(_0x106689){return _['includes'](_0x421e71,_0x106689);});if(_0x2f3b3f){return _0x2f629e['id'];}}}));}}return BPromise['all'](_0x3ac884)['then'](function(_0x54119b){_0x42c440=_(_0x42c440)[_0x2dc2('0x6a')](_0x54119b)[_0x2dc2('0x6b')]()[_0x2dc2('0x6c')]();return db[_0x2dc2('0x32')][_0x2dc2('0x33')]({'where':{'id':_0x28e2cb[_0x2dc2('0x29')]['id']}})[_0x2dc2('0x1a')](function(_0x1c86e8){return db[_0x2dc2('0x66')][_0x2dc2('0x55')](function(_0x33d5b3){return _0x1c86e8[_0x2dc2('0x5a')](_0x28e2cb[_0x2dc2('0x25')]['ids'],{'transaction':_0x33d5b3})[_0x2dc2('0x1a')](function(){if(!_['isEmpty'](_0x42c440)){return _0x1c86e8[_0x2dc2('0x6d')](_0x42c440,{'transaction':_0x33d5b3});}})[_0x2dc2('0x1a')](function(){_0x42c440[_0x2dc2('0x58')](function(_0x227c1c){socket[_0x2dc2('0x6e')]('userWhatsappQueue:remove',{'UserId':_0x227c1c,'WhatsappQueueId':_0x1c86e8['id']});});});});});});})['then'](respondWithStatusCode(_0x590ec3,null))[_0x2dc2('0x27')](handleError(_0x590ec3,null));};exports[_0x2dc2('0x6f')]=function(_0x3be5bb,_0x1ee4cb){return db[_0x2dc2('0x32')][_0x2dc2('0x33')]({'where':{'id':_0x3be5bb[_0x2dc2('0x29')]['id']}})[_0x2dc2('0x1a')](handleEntityNotFound(_0x1ee4cb,null))['then'](function(_0x4c73a8){if(_0x4c73a8){return _0x4c73a8[_0x2dc2('0x6f')](_0x3be5bb[_0x2dc2('0x35')][_0x2dc2('0x5b')],_['omit'](_0x3be5bb[_0x2dc2('0x35')],['ids','id'])||{})[_0x2dc2('0x70')](function(_0x1f6cbb){for(var _0x3163aa=0x0;_0x3163aa<_0x3be5bb[_0x2dc2('0x35')]['ids'][_0x2dc2('0x4f')];_0x3163aa+=0x1){socket[_0x2dc2('0x6e')](_0x2dc2('0x59'),{'UserId':Number(_0x3be5bb['body'][_0x2dc2('0x5b')][_0x3163aa]),'WhatsappQueueId':Number(_0x3be5bb[_0x2dc2('0x29')]['id'])});}return _0x1f6cbb;});}})[_0x2dc2('0x1a')](respondWithResult(_0x1ee4cb,null))['catch'](handleError(_0x1ee4cb,null));};exports[_0x2dc2('0x6d')]=function(_0x4a93e7,_0x166fe6){return db[_0x2dc2('0x32')][_0x2dc2('0x33')]({'where':{'id':_0x4a93e7[_0x2dc2('0x29')]['id']}})[_0x2dc2('0x1a')](handleEntityNotFound(_0x166fe6,null))[_0x2dc2('0x1a')](function(_0x5191d9){if(_0x5191d9){return _0x5191d9[_0x2dc2('0x6d')](_0x4a93e7['query'][_0x2dc2('0x5b')])['then'](function(){if(_[_0x2dc2('0x71')](_0x4a93e7['query']['ids'])){for(var _0x3f09db=0x0;_0x3f09db<_0x4a93e7[_0x2dc2('0x25')]['ids'][_0x2dc2('0x4f')];_0x3f09db+=0x1){socket[_0x2dc2('0x6e')](_0x2dc2('0x72'),{'UserId':Number(_0x4a93e7[_0x2dc2('0x25')][_0x2dc2('0x5b')][_0x3f09db]),'WhatsappQueueId':Number(_0x4a93e7['params']['id'])});}}else{socket[_0x2dc2('0x6e')](_0x2dc2('0x72'),{'UserId':Number(_0x4a93e7['query'][_0x2dc2('0x5b')]),'WhatsappQueueId':Number(_0x4a93e7['params']['id'])});}});}})[_0x2dc2('0x1a')](respondWithStatusCode(_0x166fe6,null))[_0x2dc2('0x27')](handleError(_0x166fe6,null));};exports[_0x2dc2('0x73')]=function(_0x18e27e,_0x53e956){var _0x4ecbe8={};var _0x542ce1={};var _0x43a132;var _0x5f2df4;return db['WhatsappQueue']['findOne']({'where':{'id':_0x18e27e[_0x2dc2('0x29')]['id']}})[_0x2dc2('0x1a')](handleEntityNotFound(_0x53e956,null))['then'](function(_0x235f1e){if(_0x235f1e){_0x43a132=_0x235f1e;_0x542ce1[_0x2dc2('0x2a')]=_['keys'](db[_0x2dc2('0x44')]['rawAttributes']);_0x542ce1['query']=_[_0x2dc2('0x2b')](_0x18e27e[_0x2dc2('0x25')]);_0x542ce1['filters']=_[_0x2dc2('0x2c')](_0x542ce1[_0x2dc2('0x2a')],_0x542ce1['query']);_0x4ecbe8[_0x2dc2('0x2d')]=_[_0x2dc2('0x2c')](_0x542ce1['model'],qs[_0x2dc2('0x2e')](_0x18e27e['query'][_0x2dc2('0x2e')]));_0x4ecbe8[_0x2dc2('0x2d')]=_0x4ecbe8[_0x2dc2('0x2d')][_0x2dc2('0x4f')]?_0x4ecbe8[_0x2dc2('0x2d')]:_0x542ce1[_0x2dc2('0x2a')];_0x4ecbe8[_0x2dc2('0x3d')]=qs[_0x2dc2('0x3e')](_0x18e27e['query'][_0x2dc2('0x3e')]);_0x4ecbe8[_0x2dc2('0x24')]=qs[_0x2dc2('0x3c')](_[_0x2dc2('0x3f')](_0x18e27e['query'],_0x542ce1[_0x2dc2('0x3c')]));if(_0x18e27e[_0x2dc2('0x25')][_0x2dc2('0x41')]){_0x4ecbe8[_0x2dc2('0x24')]=_[_0x2dc2('0x30')](_0x4ecbe8[_0x2dc2('0x24')],{'$or':_[_0x2dc2('0x48')](_0x4ecbe8[_0x2dc2('0x2d')],function(_0x341ea0){var _0x5dbf9c={};_0x5dbf9c[_0x341ea0]={'$like':'%'+_0x18e27e[_0x2dc2('0x25')][_0x2dc2('0x41')]+'%'};return _0x5dbf9c;})});}_0x4ecbe8=_['merge']({},_0x4ecbe8,_0x18e27e[_0x2dc2('0x31')]);return _0x43a132[_0x2dc2('0x73')](_0x4ecbe8);}})[_0x2dc2('0x1a')](function(_0x566934){if(_0x566934){_0x5f2df4=_0x566934[_0x2dc2('0x4f')];if(!_0x18e27e[_0x2dc2('0x25')]['hasOwnProperty']('nolimit')){_0x4ecbe8[_0x2dc2('0x13')]=qs['limit'](_0x18e27e[_0x2dc2('0x25')][_0x2dc2('0x13')]);_0x4ecbe8[_0x2dc2('0x14')]=qs[_0x2dc2('0x14')](_0x18e27e[_0x2dc2('0x25')][_0x2dc2('0x14')]);}return _0x43a132[_0x2dc2('0x73')](_0x4ecbe8);}})[_0x2dc2('0x1a')](function(_0x13b819){if(_0x13b819){return _0x13b819?{'count':_0x5f2df4,'rows':_0x13b819}:null;}})[_0x2dc2('0x1a')](respondWithResult(_0x53e956,null))['catch'](handleError(_0x53e956,null));}; \ No newline at end of file +var _0x265e=['defaults','redis','localhost','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','then','destroy','get','WhatsappQueues','UserProfileResource','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','catch','show','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','hasOwnProperty','nolimit','pick','WhatsappQueueId','filter','User','findAndCountAll','whatsappPause','createdAt','format','%s/%s','getTeams','Team','sort','ids','Agents','online','interface','each','UserWhatsappQueue','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','sequelize','SELECT','every','TeamId','includes','union','value','transaction','isEmpty','userWhatsappQueue:remove','addAgents','omit','removeAgents','getAgents','order','bluebird','util','lodash','squel','../../components/parsers/qs','api','../../config/environment','../../mysqldb'];(function(_0x4416f4,_0x5c538a){var _0x33280f=function(_0x561ab4){while(--_0x561ab4){_0x4416f4['push'](_0x4416f4['shift']());}};_0x33280f(++_0x5c538a);}(_0x265e,0xe2));var _0xe265=function(_0x2f0114,_0x310a2a){_0x2f0114=_0x2f0114-0x0;var _0x1b49ba=_0x265e[_0x2f0114];return _0x1b49ba;};'use strict';var BPromise=require(_0xe265('0x0'));var util=require(_0xe265('0x1'));var _=require(_0xe265('0x2'));var squel=require(_0xe265('0x3'));var Redis=require('ioredis');var qs=require(_0xe265('0x4'));var logger=require('../../config/logger')(_0xe265('0x5'));var config=require(_0xe265('0x6'));var db=require(_0xe265('0x7'))['db'];config['redis']=_[_0xe265('0x8')](config[_0xe265('0x9')],{'host':_0xe265('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe265('0x9')]));require(_0xe265('0xb'))[_0xe265('0xc')](socket);function respondWithStatusCode(_0x3041c3,_0x533beb){_0x533beb=_0x533beb||0xcc;return function(_0x100b8c){if(_0x100b8c){return _0x3041c3[_0xe265('0xd')](_0x533beb);}return _0x3041c3[_0xe265('0xe')](_0x533beb)[_0xe265('0xf')]();};}function respondWithResult(_0x5e94d2,_0x524914){_0x524914=_0x524914||0xc8;return function(_0xda516f){if(_0xda516f){return _0x5e94d2[_0xe265('0xe')](_0x524914)[_0xe265('0x10')](_0xda516f);}};}function respondWithFilteredResult(_0x560777,_0x28bb5a){return function(_0x43b0f1){if(_0x43b0f1){var _0x1b5a4a=typeof _0x28bb5a[_0xe265('0x11')]===_0xe265('0x12')&&typeof _0x28bb5a[_0xe265('0x13')]===_0xe265('0x12');var _0x4de2ae=_0x43b0f1['count'];var _0x5cc63c=_0x1b5a4a?0x0:_0x28bb5a[_0xe265('0x11')];var _0x21f1c6=_0x1b5a4a?_0x43b0f1[_0xe265('0x14')]:_0x28bb5a[_0xe265('0x11')]+_0x28bb5a[_0xe265('0x13')];var _0x19d68d;if(_0x21f1c6>=_0x4de2ae){_0x21f1c6=_0x4de2ae;_0x19d68d=0xc8;}else{_0x19d68d=0xce;}_0x560777[_0xe265('0xe')](_0x19d68d);return _0x560777['set'](_0xe265('0x15'),_0x5cc63c+'-'+_0x21f1c6+'/'+_0x4de2ae)[_0xe265('0x10')](_0x43b0f1);}return null;};}function saveUpdates(_0x31f680){return function(_0x1d2a13){if(_0x1d2a13){return _0x1d2a13['update'](_0x31f680)[_0xe265('0x16')](function(_0x3170c9){return _0x3170c9;});}return null;};}function removeEntity(_0x33cfe3){return function(_0x539a33){if(_0x539a33){return _0x539a33[_0xe265('0x17')]()[_0xe265('0x16')](function(){var _0x2d815f=_0x539a33[_0xe265('0x18')]({'plain':!![]});var _0x5dd811=_0xe265('0x19');return db[_0xe265('0x1a')]['destroy']({'where':{'type':_0x5dd811,'resourceId':_0x2d815f['id']}})[_0xe265('0x16')](function(){return _0x539a33;});})[_0xe265('0x16')](function(){_0x33cfe3[_0xe265('0xe')](0xcc)[_0xe265('0xf')]();});}};}function handleEntityNotFound(_0x942d5){return function(_0x965642){if(!_0x965642){_0x942d5[_0xe265('0xd')](0x194);}return _0x965642;};}function handleError(_0x22a862,_0x31efb9){_0x31efb9=_0x31efb9||0x1f4;return function(_0x51a781){logger['error'](_0x51a781[_0xe265('0x1b')]);if(_0x51a781[_0xe265('0x1c')]){delete _0x51a781[_0xe265('0x1c')];}_0x22a862[_0xe265('0xe')](_0x31efb9)[_0xe265('0x1d')](_0x51a781);};}exports[_0xe265('0x1e')]=function(_0xd3709b,_0x27c05e){var _0xe01a4={};var _0x2228b2={'count':0x0,'rows':[]};var _0x10cb76=_[_0xe265('0x1f')](db[_0xe265('0x20')][_0xe265('0x21')],function(_0x4a18b8){return{'name':_0x4a18b8[_0xe265('0x22')],'type':_0x4a18b8['type'][_0xe265('0x23')]};});_0xe01a4=qs[_0xe265('0x24')](_0x10cb76,_0xd3709b);var _0x5badd3={'where':_0xe01a4[_0xe265('0x25')]};return db[_0xe265('0x20')][_0xe265('0x14')](_0x5badd3)['then'](function(_0x41b94e){_0x2228b2[_0xe265('0x14')]=_0x41b94e;_0xe01a4[_0xe265('0x26')]=qs[_0xe265('0x26')](_0xd3709b[_0xe265('0x27')]);return db['WhatsappQueue'][_0xe265('0x28')](_0xe01a4);})[_0xe265('0x16')](function(_0x60a6f7){_0x2228b2['rows']=_0x60a6f7;return _0x2228b2;})[_0xe265('0x16')](respondWithFilteredResult(_0x27c05e,_0xe01a4))[_0xe265('0x29')](handleError(_0x27c05e,null));};exports[_0xe265('0x2a')]=function(_0x70c182,_0x3893fd){var _0x335e97={'raw':!![],'where':{'id':_0x70c182['params']['id']}},_0x236eba={};_0x236eba[_0xe265('0x2b')]=_['keys'](db[_0xe265('0x20')][_0xe265('0x21')]);_0x236eba[_0xe265('0x27')]=_[_0xe265('0x2c')](_0x70c182[_0xe265('0x27')]);_0x236eba[_0xe265('0x2d')]=_[_0xe265('0x2e')](_0x236eba[_0xe265('0x2b')],_0x236eba[_0xe265('0x27')]);_0x335e97['attributes']=_[_0xe265('0x2e')](_0x236eba[_0xe265('0x2b')],qs[_0xe265('0x2f')](_0x70c182[_0xe265('0x27')]['fields']));_0x335e97[_0xe265('0x30')]=_0x335e97[_0xe265('0x30')][_0xe265('0x31')]?_0x335e97[_0xe265('0x30')]:_0x236eba[_0xe265('0x2b')];if(_0x70c182['query'][_0xe265('0x32')]){_0x335e97[_0xe265('0x26')]=[{'all':!![]}];}_0x335e97=_[_0xe265('0x33')]({},_0x335e97,_0x70c182[_0xe265('0x34')]);return db[_0xe265('0x20')][_0xe265('0x35')](_0x335e97)[_0xe265('0x16')](handleEntityNotFound(_0x3893fd,null))[_0xe265('0x16')](respondWithResult(_0x3893fd,null))[_0xe265('0x29')](handleError(_0x3893fd,null));};exports[_0xe265('0x36')]=function(_0x202d46,_0x330f5a){return db['WhatsappQueue'][_0xe265('0x36')](_0x202d46[_0xe265('0x37')],{})[_0xe265('0x16')](function(_0x11deff){var _0x401184=_0x202d46[_0xe265('0x38')][_0xe265('0x18')]({'plain':!![]});if(!_0x401184)throw new Error(_0xe265('0x39'));if(_0x401184[_0xe265('0x3a')]==='user'){var _0x2b32ed=_0x11deff['get']({'plain':!![]});var _0x543f6f=_0xe265('0x19');return db[_0xe265('0x3b')][_0xe265('0x35')]({'where':{'name':_0x543f6f,'userProfileId':_0x401184[_0xe265('0x3c')]},'raw':!![]})[_0xe265('0x16')](function(_0x4eaea7){if(_0x4eaea7&&_0x4eaea7['autoAssociation']===0x0){return db['UserProfileResource'][_0xe265('0x36')]({'name':_0x2b32ed[_0xe265('0x1c')],'resourceId':_0x2b32ed['id'],'type':_0x4eaea7[_0xe265('0x1c')],'sectionId':_0x4eaea7['id']},{})[_0xe265('0x16')](function(){return _0x11deff;});}else{return _0x11deff;}})['catch'](function(_0x2e168f){logger[_0xe265('0x3d')](_0xe265('0x3e'),_0x2e168f);throw _0x2e168f;});}return _0x11deff;})[_0xe265('0x16')](respondWithResult(_0x330f5a,0xc9))[_0xe265('0x29')](handleError(_0x330f5a,null));};exports[_0xe265('0x3f')]=function(_0x21b058,_0x1c6961){if(_0x21b058['body']['id']){delete _0x21b058['body']['id'];}return db[_0xe265('0x20')][_0xe265('0x35')]({'where':{'id':_0x21b058[_0xe265('0x40')]['id']}})['then'](handleEntityNotFound(_0x1c6961,null))[_0xe265('0x16')](saveUpdates(_0x21b058['body'],null))[_0xe265('0x16')](respondWithResult(_0x1c6961,null))[_0xe265('0x29')](handleError(_0x1c6961,null));};exports[_0xe265('0x17')]=function(_0x544ee3,_0x371638){return db[_0xe265('0x20')][_0xe265('0x35')]({'where':{'id':_0x544ee3['params']['id']}})[_0xe265('0x16')](handleEntityNotFound(_0x371638,null))[_0xe265('0x16')](removeEntity(_0x371638,null))[_0xe265('0x29')](handleError(_0x371638,null));};exports[_0xe265('0x41')]=function(_0x3936a0,_0x2fe458){return db['WhatsappQueue'][_0xe265('0x41')]()['then'](respondWithResult(_0x2fe458,null))[_0xe265('0x29')](handleError(_0x2fe458,null));};exports[_0xe265('0x42')]=function(_0xc1b29e,_0x3d9590){var _0x101d96={'raw':!![],'where':{}},_0x33f2aa={},_0x43d62d;return db[_0xe265('0x20')][_0xe265('0x43')]({'where':{'id':_0xc1b29e['params']['id']}})[_0xe265('0x16')](handleEntityNotFound(_0x3d9590,null))[_0xe265('0x16')](function(_0xbd13a8){if(_0xbd13a8){_0x43d62d=_0xbd13a8[_0xe265('0x18')]({'plain':!![]});_0x33f2aa['model']=_[_0xe265('0x2c')](db['UserWhatsappQueue']['rawAttributes']);_0x33f2aa[_0xe265('0x27')]=_[_0xe265('0x2c')](_0xc1b29e[_0xe265('0x27')]);_0x33f2aa[_0xe265('0x2d')]=_[_0xe265('0x2e')](_0x33f2aa[_0xe265('0x2b')],_0x33f2aa[_0xe265('0x27')]);_0x101d96[_0xe265('0x30')]=_[_0xe265('0x2e')](_0x33f2aa[_0xe265('0x2b')],qs[_0xe265('0x2f')](_0xc1b29e['query'][_0xe265('0x2f')]));_0x101d96['attributes']=_0x101d96[_0xe265('0x30')][_0xe265('0x31')]?_0x101d96['attributes']:_0x33f2aa[_0xe265('0x2b')];if(!_0xc1b29e[_0xe265('0x27')][_0xe265('0x44')](_0xe265('0x45'))){_0x101d96[_0xe265('0x13')]=qs[_0xe265('0x13')](_0xc1b29e[_0xe265('0x27')]['limit']);_0x101d96[_0xe265('0x11')]=qs['offset'](_0xc1b29e[_0xe265('0x27')][_0xe265('0x11')]);}_0x101d96['order']=qs['sort'](_0xc1b29e['query']['sort']);_0x101d96[_0xe265('0x25')]=qs[_0xe265('0x2d')](_[_0xe265('0x46')](_0xc1b29e['query'],_0x33f2aa['filters']));_0x101d96[_0xe265('0x25')][_0xe265('0x47')]=_0xbd13a8['id'];if(_0xc1b29e[_0xe265('0x27')][_0xe265('0x48')]){_0x101d96[_0xe265('0x25')]=_[_0xe265('0x33')](_0x101d96[_0xe265('0x25')],{'$or':_[_0xe265('0x1f')](_0x101d96[_0xe265('0x30')],function(_0x2adec1){var _0x2c409b={};_0x2c409b[_0x2adec1]={'$like':'%'+_0xc1b29e['query']['filter']+'%'};return _0x2c409b;})});}_0x101d96=_[_0xe265('0x33')]({},_0x101d96,_0xc1b29e[_0xe265('0x34')]);return db['UserWhatsappQueue'][_0xe265('0x28')](_0x101d96);}})[_0xe265('0x16')](function(_0x3ae007){if(_0x3ae007){return db[_0xe265('0x49')][_0xe265('0x4a')]({'where':{'id':_['map'](_0x3ae007,'UserId'),'role':'agent'},'attributes':['id',_0xe265('0x1c'),_0xe265('0x4b'),'updatedAt',_0xe265('0x4c')]});}})[_0xe265('0x16')](function(_0x2ef51f){if(_0x2ef51f){return{'count':_0x2ef51f['count'],'rows':_['map'](_0x2ef51f['rows'],function(_0x2f9602){return{'membername':_0x2f9602[_0xe265('0x1c')],'UserId':_0x2f9602['id'],'queue_name':_0x43d62d[_0xe265('0x1c')],'WhatsappQueueId':_0x43d62d['id'],'interface':util[_0xe265('0x4d')](_0xe265('0x4e'),'SIP',_0x2f9602[_0xe265('0x1c')]),'penalty':0x0,'paused':_0x2f9602[_0xe265('0x4b')],'createdAt':_0x2f9602[_0xe265('0x4c')],'updatedAt':_0x2f9602['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3d9590,_0x101d96))[_0xe265('0x29')](handleError(_0x3d9590,null));};exports[_0xe265('0x4f')]=function(_0x204161,_0x16aecc){var _0x42a421={};var _0x2cb5e4={};var _0x515873;var _0x2c0feb;return db[_0xe265('0x20')][_0xe265('0x43')]({'where':{'id':_0x204161['params']['id']}})[_0xe265('0x16')](handleEntityNotFound(_0x16aecc,null))[_0xe265('0x16')](function(_0x438ea7){if(_0x438ea7){_0x515873=_0x438ea7;_0x2cb5e4[_0xe265('0x2b')]=_['keys'](db[_0xe265('0x50')]['rawAttributes']);_0x2cb5e4[_0xe265('0x27')]=_['keys'](_0x204161[_0xe265('0x27')]);_0x2cb5e4['filters']=_[_0xe265('0x2e')](_0x2cb5e4['model'],_0x2cb5e4[_0xe265('0x27')]);_0x42a421['attributes']=_[_0xe265('0x2e')](_0x2cb5e4[_0xe265('0x2b')],qs[_0xe265('0x2f')](_0x204161[_0xe265('0x27')]['fields']));_0x42a421[_0xe265('0x30')]=_0x42a421[_0xe265('0x30')]['length']?_0x42a421[_0xe265('0x30')]:_0x2cb5e4[_0xe265('0x2b')];_0x42a421['order']=qs[_0xe265('0x51')](_0x204161[_0xe265('0x27')]['sort']);_0x42a421['where']=qs[_0xe265('0x2d')](_[_0xe265('0x46')](_0x204161['query'],_0x2cb5e4[_0xe265('0x2d')]));if(_0x204161[_0xe265('0x27')][_0xe265('0x48')]){_0x42a421[_0xe265('0x25')]=_[_0xe265('0x33')](_0x42a421['where'],{'$or':_[_0xe265('0x1f')](_0x42a421['attributes'],function(_0x385f75){var _0x374d34={};_0x374d34[_0x385f75]={'$like':'%'+_0x204161['query'][_0xe265('0x48')]+'%'};return _0x374d34;})});}_0x42a421=_['merge']({},_0x42a421,_0x204161[_0xe265('0x34')]);return _0x515873[_0xe265('0x4f')](_0x42a421);}})[_0xe265('0x16')](function(_0x20a403){if(_0x20a403){_0x2c0feb=_0x20a403[_0xe265('0x31')];if(!_0x204161[_0xe265('0x27')]['hasOwnProperty'](_0xe265('0x45'))){_0x42a421['limit']=qs[_0xe265('0x13')](_0x204161[_0xe265('0x27')][_0xe265('0x13')]);_0x42a421[_0xe265('0x11')]=qs[_0xe265('0x11')](_0x204161[_0xe265('0x27')][_0xe265('0x11')]);}return _0x515873[_0xe265('0x4f')](_0x42a421);}})[_0xe265('0x16')](function(_0xaae0b7){if(_0xaae0b7){return _0xaae0b7?{'count':_0x2c0feb,'rows':_0xaae0b7}:null;}})['then'](respondWithResult(_0x16aecc,null))[_0xe265('0x29')](handleError(_0x16aecc,null));};exports['addTeams']=function(_0x2fc35,_0x42f6b1){var _0x440bdd=_0x2fc35[_0xe265('0x37')][_0xe265('0x52')];return db[_0xe265('0x50')][_0xe265('0x28')]({'where':{'id':_0x440bdd},'attributes':['id'],'include':[{'model':db[_0xe265('0x49')],'as':_0xe265('0x53'),'attributes':['id',_0xe265('0x1c'),_0xe265('0x54'),'voicePause',_0xe265('0x55')],'raw':!![]}]})[_0xe265('0x16')](function(_0x47a8da){if(_0x47a8da){var _0x102a30=_['flatMap'](_0x47a8da,function(_0x1eae64){var _0x58996c=_0x1eae64['get']({'plain':!![]});return _0x58996c[_0xe265('0x53')];});return db[_0xe265('0x20')][_0xe265('0x35')]({'where':{'id':_0x2fc35[_0xe265('0x40')]['id']}})['then'](function(_0x12395d){return db['sequelize']['transaction'](function(_0xc253b0){return _0x12395d['addTeams'](_0x440bdd,{'transaction':_0xc253b0})['then'](function(){return BPromise[_0xe265('0x56')](_0x102a30,function(_0x4a7526){return db[_0xe265('0x57')][_0xe265('0x58')]({'where':{'UserId':_0x4a7526['id'],'WhatsappQueueId':_0x2fc35[_0xe265('0x40')]['id']},'transaction':_0xc253b0});});})['then'](function(){_0x102a30[_0xe265('0x59')](function(_0x5b84fe){socket[_0xe265('0x5a')](_0xe265('0x5b'),{'UserId':_0x5b84fe['id'],'WhatsappQueueId':_0x12395d['id']});});});});});}})[_0xe265('0x16')](respondWithStatusCode(_0x42f6b1,null))[_0xe265('0x29')](handleError(_0x42f6b1,null));};exports[_0xe265('0x5c')]=function(_0x1c7711,_0x475692){return db[_0xe265('0x50')][_0xe265('0x28')]({'where':{'id':_0x1c7711[_0xe265('0x27')][_0xe265('0x52')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe265('0x53'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x475692,null))['then'](function(_0x286d0e){var _0x2573b8=_['map'](_0x286d0e,'id');var _0x46d8e3=[];var _0x48a527=[];var _0x45c6ba=squel[_0xe265('0x5d')]();_0x45c6ba[_0xe265('0x5e')]('tq.TeamId')['from'](_0xe265('0x5f'),'tq')[_0xe265('0x60')](_0xe265('0x61'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe265('0x25')](_0xe265('0x62'),_0x1c7711[_0xe265('0x40')]['id']);for(var _0x1ed739=0x0;_0x1ed739<_0x286d0e[_0xe265('0x31')];_0x1ed739+=0x1){let _0x2bfc47=_0x286d0e[_0x1ed739];for(var _0x4ab1e0=0x0;_0x4ab1e0<_0x2bfc47[_0xe265('0x53')][_0xe265('0x31')];_0x4ab1e0+=0x1){let _0x40876f=_0x2bfc47[_0xe265('0x53')][_0x4ab1e0];var _0x42d1b7=_0x45c6ba[_0xe265('0x63')]();_0x42d1b7[_0xe265('0x25')](_0xe265('0x64'),_0x40876f['id']);_0x48a527['push'](db['sequelize'][_0xe265('0x27')](_0x42d1b7[_0xe265('0x65')](),{'type':db[_0xe265('0x66')]['QueryTypes'][_0xe265('0x67')]})['then'](function(_0x5de8bb){if(_0x5de8bb['length']===0x1){return _0x40876f['id'];}else{var _0x2517dd=_[_0xe265('0x68')](_['map'](_0x5de8bb,_0xe265('0x69')),function(_0x30b63a){return _[_0xe265('0x6a')](_0x2573b8,_0x30b63a);});if(_0x2517dd){return _0x40876f['id'];}}}));}}return BPromise['all'](_0x48a527)[_0xe265('0x16')](function(_0x581ab9){_0x46d8e3=_(_0x46d8e3)[_0xe265('0x6b')](_0x581ab9)['compact']()[_0xe265('0x6c')]();return db[_0xe265('0x20')][_0xe265('0x35')]({'where':{'id':_0x1c7711[_0xe265('0x40')]['id']}})[_0xe265('0x16')](function(_0x5996e3){return db[_0xe265('0x66')][_0xe265('0x6d')](function(_0x434dfb){return _0x5996e3[_0xe265('0x5c')](_0x1c7711[_0xe265('0x27')][_0xe265('0x52')],{'transaction':_0x434dfb})[_0xe265('0x16')](function(){if(!_[_0xe265('0x6e')](_0x46d8e3)){return _0x5996e3['removeAgents'](_0x46d8e3,{'transaction':_0x434dfb});}})[_0xe265('0x16')](function(){_0x46d8e3[_0xe265('0x59')](function(_0x4a7d58){socket[_0xe265('0x5a')](_0xe265('0x6f'),{'UserId':_0x4a7d58,'WhatsappQueueId':_0x5996e3['id']});});});});});});})[_0xe265('0x16')](respondWithStatusCode(_0x475692,null))[_0xe265('0x29')](handleError(_0x475692,null));};exports[_0xe265('0x70')]=function(_0x149c89,_0x2926f0){return db[_0xe265('0x20')][_0xe265('0x35')]({'where':{'id':_0x149c89[_0xe265('0x40')]['id']}})[_0xe265('0x16')](handleEntityNotFound(_0x2926f0,null))[_0xe265('0x16')](function(_0x1bec1f){if(_0x1bec1f){return _0x1bec1f['addAgents'](_0x149c89[_0xe265('0x37')][_0xe265('0x52')],_[_0xe265('0x71')](_0x149c89[_0xe265('0x37')],[_0xe265('0x52'),'id'])||{})['spread'](function(_0x45c67e){for(var _0x2c9be2=0x0;_0x2c9be2<_0x149c89[_0xe265('0x37')][_0xe265('0x52')]['length'];_0x2c9be2+=0x1){socket[_0xe265('0x5a')](_0xe265('0x5b'),{'UserId':Number(_0x149c89[_0xe265('0x37')][_0xe265('0x52')][_0x2c9be2]),'WhatsappQueueId':Number(_0x149c89['params']['id'])});}return _0x45c67e;});}})[_0xe265('0x16')](respondWithResult(_0x2926f0,null))[_0xe265('0x29')](handleError(_0x2926f0,null));};exports['removeAgents']=function(_0x385414,_0x52de6c){return db[_0xe265('0x20')][_0xe265('0x35')]({'where':{'id':_0x385414[_0xe265('0x40')]['id']}})['then'](handleEntityNotFound(_0x52de6c,null))[_0xe265('0x16')](function(_0x254b97){if(_0x254b97){return _0x254b97[_0xe265('0x72')](_0x385414['query'][_0xe265('0x52')])[_0xe265('0x16')](function(){if(_['isArray'](_0x385414['query']['ids'])){for(var _0x5d2181=0x0;_0x5d2181<_0x385414['query'][_0xe265('0x52')]['length'];_0x5d2181+=0x1){socket[_0xe265('0x5a')](_0xe265('0x6f'),{'UserId':Number(_0x385414['query']['ids'][_0x5d2181]),'WhatsappQueueId':Number(_0x385414[_0xe265('0x40')]['id'])});}}else{socket['emit'](_0xe265('0x6f'),{'UserId':Number(_0x385414['query'][_0xe265('0x52')]),'WhatsappQueueId':Number(_0x385414['params']['id'])});}});}})[_0xe265('0x16')](respondWithStatusCode(_0x52de6c,null))[_0xe265('0x29')](handleError(_0x52de6c,null));};exports[_0xe265('0x73')]=function(_0xb15272,_0x9c97ba){var _0x2f85e4={};var _0x48b5bd={};var _0x1517e2;var _0x4260f0;return db[_0xe265('0x20')][_0xe265('0x43')]({'where':{'id':_0xb15272[_0xe265('0x40')]['id']}})['then'](handleEntityNotFound(_0x9c97ba,null))[_0xe265('0x16')](function(_0x174b13){if(_0x174b13){_0x1517e2=_0x174b13;_0x48b5bd[_0xe265('0x2b')]=_['keys'](db['User'][_0xe265('0x21')]);_0x48b5bd['query']=_['keys'](_0xb15272[_0xe265('0x27')]);_0x48b5bd[_0xe265('0x2d')]=_[_0xe265('0x2e')](_0x48b5bd[_0xe265('0x2b')],_0x48b5bd[_0xe265('0x27')]);_0x2f85e4[_0xe265('0x30')]=_[_0xe265('0x2e')](_0x48b5bd[_0xe265('0x2b')],qs['fields'](_0xb15272['query'][_0xe265('0x2f')]));_0x2f85e4[_0xe265('0x30')]=_0x2f85e4['attributes'][_0xe265('0x31')]?_0x2f85e4[_0xe265('0x30')]:_0x48b5bd['model'];_0x2f85e4[_0xe265('0x74')]=qs[_0xe265('0x51')](_0xb15272['query'][_0xe265('0x51')]);_0x2f85e4[_0xe265('0x25')]=qs['filters'](_['pick'](_0xb15272[_0xe265('0x27')],_0x48b5bd[_0xe265('0x2d')]));if(_0xb15272[_0xe265('0x27')][_0xe265('0x48')]){_0x2f85e4[_0xe265('0x25')]=_[_0xe265('0x33')](_0x2f85e4[_0xe265('0x25')],{'$or':_[_0xe265('0x1f')](_0x2f85e4[_0xe265('0x30')],function(_0x3ab7dd){var _0x2ca44d={};_0x2ca44d[_0x3ab7dd]={'$like':'%'+_0xb15272['query']['filter']+'%'};return _0x2ca44d;})});}_0x2f85e4=_[_0xe265('0x33')]({},_0x2f85e4,_0xb15272[_0xe265('0x34')]);return _0x1517e2[_0xe265('0x73')](_0x2f85e4);}})[_0xe265('0x16')](function(_0xc63d34){if(_0xc63d34){_0x4260f0=_0xc63d34[_0xe265('0x31')];if(!_0xb15272[_0xe265('0x27')][_0xe265('0x44')](_0xe265('0x45'))){_0x2f85e4['limit']=qs[_0xe265('0x13')](_0xb15272[_0xe265('0x27')]['limit']);_0x2f85e4[_0xe265('0x11')]=qs[_0xe265('0x11')](_0xb15272[_0xe265('0x27')][_0xe265('0x11')]);}return _0x1517e2[_0xe265('0x73')](_0x2f85e4);}})[_0xe265('0x16')](function(_0x33ccab){if(_0x33ccab){return _0x33ccab?{'count':_0x4260f0,'rows':_0x33ccab}:null;}})['then'](respondWithResult(_0x9c97ba,null))[_0xe265('0x29')](handleError(_0x9c97ba,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 6c5ecbc..94bc950 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 _0x6e61=['hasOwnProperty','hook','events','../../mysqldb','WhatsappQueue','save','update','remove'];(function(_0x2826f7,_0x5af741){var _0x18d8d3=function(_0xac8883){while(--_0xac8883){_0x2826f7['push'](_0x2826f7['shift']());}};_0x18d8d3(++_0x5af741);}(_0x6e61,0x142));var _0x16e6=function(_0x42046d,_0x1eae1b){_0x42046d=_0x42046d-0x0;var _0x176f5a=_0x6e61[_0x42046d];return _0x176f5a;};'use strict';var EventEmitter=require(_0x16e6('0x0'));var WhatsappQueue=require(_0x16e6('0x1'))['db'][_0x16e6('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x16e6('0x3'),'afterUpdate':_0x16e6('0x4'),'afterDestroy':_0x16e6('0x5')};function emitEvent(_0x1ba4f6){return function(_0x3ce83a,_0x2b79a0,_0x54cacf){WhatsappQueueEvents['emit'](_0x1ba4f6+':'+_0x3ce83a['id'],_0x3ce83a);WhatsappQueueEvents['emit'](_0x1ba4f6,_0x3ce83a);_0x54cacf(null);};}for(var e in events){if(events[_0x16e6('0x6')](e)){var event=events[e];WhatsappQueue[_0x16e6('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0xdc4c=['update','emit','events','save'];(function(_0x4c56b6,_0x239082){var _0x1ee73a=function(_0x43687e){while(--_0x43687e){_0x4c56b6['push'](_0x4c56b6['shift']());}};_0x1ee73a(++_0x239082);}(_0xdc4c,0x1f2));var _0xcdc4=function(_0x4f3908,_0x208416){_0x4f3908=_0x4f3908-0x0;var _0x10f930=_0xdc4c[_0x4f3908];return _0x10f930;};'use strict';var EventEmitter=require(_0xcdc4('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcdc4('0x1'),'afterUpdate':_0xcdc4('0x2'),'afterDestroy':'remove'};function emitEvent(_0x24e025){return function(_0x14a010,_0x28f787,_0x3044db){WhatsappQueueEvents['emit'](_0x24e025+':'+_0x14a010['id'],_0x14a010);WhatsappQueueEvents[_0xcdc4('0x3')](_0x24e025,_0x14a010);_0x3044db(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](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 0df4dfe..18629f0 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 _0x5d15=['define','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./whatsappQueue.attributes','exports'];(function(_0x15b813,_0x328e09){var _0x36411f=function(_0x458183){while(--_0x458183){_0x15b813['push'](_0x15b813['shift']());}};_0x36411f(++_0x328e09);}(_0x5d15,0xc2));var _0x55d1=function(_0x343e44,_0x519af9){_0x343e44=_0x343e44-0x0;var _0xa5130e=_0x5d15[_0x343e44];return _0xa5130e;};'use strict';var _=require(_0x55d1('0x0'));var util=require(_0x55d1('0x1'));var logger=require(_0x55d1('0x2'))(_0x55d1('0x3'));var moment=require(_0x55d1('0x4'));var BPromise=require(_0x55d1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x55d1('0x6'));var rimraf=require('rimraf');var config=require(_0x55d1('0x7'));var attributes=require(_0x55d1('0x8'));module[_0x55d1('0x9')]=function(_0x1c818d,_0x40d1d4){return _0x1c818d[_0x55d1('0xa')]('WhatsappQueue',attributes,{'tableName':_0x55d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90ce=['rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','moment','bluebird','request-promise','path'];(function(_0x5e2299,_0x18bba2){var _0x55e6d9=function(_0x4d471e){while(--_0x4d471e){_0x5e2299['push'](_0x5e2299['shift']());}};_0x55e6d9(++_0x18bba2);}(_0x90ce,0x166));var _0xe90c=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0x90ce[_0x445101];return _0x3c3d04;};'use strict';var _=require(_0xe90c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe90c('0x1'));var BPromise=require(_0xe90c('0x2'));var rp=require(_0xe90c('0x3'));var fs=require('fs');var path=require(_0xe90c('0x4'));var rimraf=require(_0xe90c('0x5'));var config=require('../../config/environment');var attributes=require(_0xe90c('0x6'));module[_0xe90c('0x7')]=function(_0x3e1d7c,_0x2409b2){return _0x3e1d7c[_0xe90c('0x8')](_0xe90c('0x9'),attributes,{'tableName':_0xe90c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index b132703..5c67ff7 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 _0x8bc8=['request\x20sent','stringify','error','code','message','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowWhatsappQueue','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x867b0a,_0x587ccf){var _0x137438=function(_0xbeafa6){while(--_0xbeafa6){_0x867b0a['push'](_0x867b0a['shift']());}};_0x137438(++_0x587ccf);}(_0x8bc8,0x143));var _0x88bc=function(_0x26cab7,_0x1ccfca){_0x26cab7=_0x26cab7-0x0;var _0x31ba06=_0x8bc8[_0x26cab7];return _0x31ba06;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x88bc('0x0'));var BPromise=require(_0x88bc('0x1'));var rs=require(_0x88bc('0x2'));var fs=require('fs');var Redis=require(_0x88bc('0x3'));var db=require(_0x88bc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x88bc('0x5'))('rpc');var config=require(_0x88bc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x88bc('0x7')]['http']({'port':0x232a});config[_0x88bc('0x8')]=_['defaults'](config[_0x88bc('0x8')],{'host':_0x88bc('0x9'),'port':0x18eb});var socket=require(_0x88bc('0xa'))(new Redis(config[_0x88bc('0x8')]));require(_0x88bc('0xb'))[_0x88bc('0xc')](socket);function respondWithRpcPromise(_0x153f21,_0x35653c,_0x3aa68f){return new BPromise(function(_0x502323,_0x1df3d1){return client[_0x88bc('0xd')](_0x153f21,_0x3aa68f)[_0x88bc('0xe')](function(_0x3884a3){logger[_0x88bc('0xf')](_0x88bc('0x10'),_0x35653c,'request\x20sent');logger[_0x88bc('0x11')](_0x88bc('0x12'),_0x35653c,_0x88bc('0x13'),JSON[_0x88bc('0x14')](_0x3884a3));if(_0x3884a3[_0x88bc('0x15')]){if(_0x3884a3[_0x88bc('0x15')][_0x88bc('0x16')]===0x1f4){logger['error'](_0x88bc('0x10'),_0x35653c,_0x3884a3[_0x88bc('0x15')]['message']);return _0x1df3d1(_0x3884a3['error'][_0x88bc('0x17')]);}logger[_0x88bc('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x35653c,_0x3884a3[_0x88bc('0x15')][_0x88bc('0x17')]);return _0x502323(_0x3884a3[_0x88bc('0x15')][_0x88bc('0x17')]);}else{logger[_0x88bc('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x35653c,_0x88bc('0x13'));_0x502323(_0x3884a3['result'][_0x88bc('0x17')]);}})['catch'](function(_0x147c2b){logger[_0x88bc('0x15')](_0x88bc('0x10'),_0x35653c,_0x147c2b);_0x1df3d1(_0x147c2b);});});}exports[_0x88bc('0x18')]=function(_0x40b8e7){var _0x5badec=this;return new Promise(function(_0x5310fa,_0x220416){return db[_0x88bc('0x19')][_0x88bc('0x1a')]({'raw':_0x40b8e7[_0x88bc('0x1b')]?_0x40b8e7['options'][_0x88bc('0x1c')]===undefined?!![]:![]:!![],'where':_0x40b8e7[_0x88bc('0x1b')]?_0x40b8e7['options'][_0x88bc('0x1d')]||null:null,'attributes':_0x40b8e7['options']?_0x40b8e7[_0x88bc('0x1b')][_0x88bc('0x1e')]||null:null,'limit':_0x40b8e7[_0x88bc('0x1b')]?_0x40b8e7[_0x88bc('0x1b')][_0x88bc('0x1f')]||null:null,'include':_0x40b8e7[_0x88bc('0x1b')]?_0x40b8e7[_0x88bc('0x1b')][_0x88bc('0x20')]?_['map'](_0x40b8e7[_0x88bc('0x1b')]['include'],function(_0x55abec){return{'model':db[_0x55abec[_0x88bc('0x21')]],'as':_0x55abec['as'],'attributes':_0x55abec[_0x88bc('0x1e')],'include':_0x55abec[_0x88bc('0x20')]?_['map'](_0x55abec[_0x88bc('0x20')],function(_0x27b259){return{'model':db[_0x27b259[_0x88bc('0x21')]],'as':_0x27b259['as'],'attributes':_0x27b259[_0x88bc('0x1e')],'include':_0x27b259[_0x88bc('0x20')]?_[_0x88bc('0x22')](_0x27b259[_0x88bc('0x20')],function(_0x36a2bd){return{'model':db[_0x36a2bd['model']],'as':_0x36a2bd['as'],'attributes':_0x36a2bd[_0x88bc('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x88bc('0xe')](function(_0x3fc20a){logger[_0x88bc('0xf')]('GetWhatsappQueue',_0x40b8e7);logger[_0x88bc('0x11')]('GetWhatsappQueue',_0x40b8e7,JSON[_0x88bc('0x14')](_0x3fc20a));_0x5310fa(_0x3fc20a);})[_0x88bc('0x23')](function(_0x484602){logger[_0x88bc('0x15')](_0x88bc('0x18'),_0x484602['message'],_0x40b8e7);_0x220416(_0x5badec[_0x88bc('0x15')](0x1f4,_0x484602[_0x88bc('0x17')]));});});};exports[_0x88bc('0x24')]=function(_0x2f9454){var _0x1b67bf=this;return new Promise(function(_0x3aa8c0,_0x5867f7){return db[_0x88bc('0x19')][_0x88bc('0x25')]({'raw':_0x2f9454['options']?_0x2f9454[_0x88bc('0x1b')][_0x88bc('0x1c')]===undefined?!![]:![]:!![],'where':_0x2f9454[_0x88bc('0x1b')]?_0x2f9454[_0x88bc('0x1b')]['where']||null:null,'attributes':_0x2f9454[_0x88bc('0x1b')]?_0x2f9454['options'][_0x88bc('0x1e')]||null:null,'include':_0x2f9454[_0x88bc('0x1b')]?_0x2f9454[_0x88bc('0x1b')][_0x88bc('0x20')]?_[_0x88bc('0x22')](_0x2f9454['options'][_0x88bc('0x20')],function(_0x5dfda0){return{'model':db[_0x5dfda0[_0x88bc('0x21')]],'as':_0x5dfda0['as'],'attributes':_0x5dfda0[_0x88bc('0x1e')],'include':_0x5dfda0['include']?_['map'](_0x5dfda0[_0x88bc('0x20')],function(_0x196a62){return{'model':db[_0x196a62['model']],'as':_0x196a62['as'],'attributes':_0x196a62[_0x88bc('0x1e')],'include':_0x196a62[_0x88bc('0x20')]?_[_0x88bc('0x22')](_0x196a62[_0x88bc('0x20')],function(_0x1be05a){return{'model':db[_0x1be05a[_0x88bc('0x21')]],'as':_0x1be05a['as'],'attributes':_0x1be05a[_0x88bc('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x88bc('0xe')](function(_0x3af229){logger[_0x88bc('0xf')](_0x88bc('0x24'),_0x2f9454);logger[_0x88bc('0x11')]('ShowWhatsappQueue',_0x2f9454,JSON[_0x88bc('0x14')](_0x3af229));_0x3aa8c0(_0x3af229);})[_0x88bc('0x23')](function(_0x565465){logger[_0x88bc('0x15')](_0x88bc('0x24'),_0x565465[_0x88bc('0x17')],_0x2f9454);_0x5867f7(_0x1b67bf[_0x88bc('0x15')](0x1f4,_0x565465['message']));});});}; \ No newline at end of file +var _0x8b8d=['socket.io-emitter','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','limit','include','map','model','attributes','ShowWhatsappQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','localhost'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x8b8d,0x148));var _0xd8b8=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x8b8d[_0x4bb66f];return _0xf2772f;};'use strict';var _=require('lodash');var util=require(_0xd8b8('0x0'));var moment=require(_0xd8b8('0x1'));var BPromise=require(_0xd8b8('0x2'));var rs=require(_0xd8b8('0x3'));var fs=require('fs');var Redis=require(_0xd8b8('0x4'));var db=require(_0xd8b8('0x5'))['db'];var utils=require(_0xd8b8('0x6'));var logger=require(_0xd8b8('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8b8('0x8')][_0xd8b8('0x9')]({'port':0x232a});config[_0xd8b8('0xa')]=_['defaults'](config['redis'],{'host':_0xd8b8('0xb'),'port':0x18eb});var socket=require(_0xd8b8('0xc'))(new Redis(config[_0xd8b8('0xa')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x17bfab,_0x195253,_0x1a44b2){return new BPromise(function(_0x69cac1,_0x4bc016){return client[_0xd8b8('0xd')](_0x17bfab,_0x1a44b2)[_0xd8b8('0xe')](function(_0x171463){logger[_0xd8b8('0xf')](_0xd8b8('0x10'),_0x195253,'request\x20sent');logger[_0xd8b8('0x11')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x195253,_0xd8b8('0x12'),JSON[_0xd8b8('0x13')](_0x171463));if(_0x171463['error']){if(_0x171463[_0xd8b8('0x14')]['code']===0x1f4){logger[_0xd8b8('0x14')](_0xd8b8('0x10'),_0x195253,_0x171463[_0xd8b8('0x14')][_0xd8b8('0x15')]);return _0x4bc016(_0x171463[_0xd8b8('0x14')][_0xd8b8('0x15')]);}logger[_0xd8b8('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x195253,_0x171463[_0xd8b8('0x14')][_0xd8b8('0x15')]);return _0x69cac1(_0x171463[_0xd8b8('0x14')][_0xd8b8('0x15')]);}else{logger[_0xd8b8('0xf')](_0xd8b8('0x10'),_0x195253,'request\x20sent');_0x69cac1(_0x171463['result']['message']);}})[_0xd8b8('0x16')](function(_0x3aad31){logger[_0xd8b8('0x14')](_0xd8b8('0x10'),_0x195253,_0x3aad31);_0x4bc016(_0x3aad31);});});}exports[_0xd8b8('0x17')]=function(_0x298583){var _0xeed726=this;return new Promise(function(_0x438c7f,_0x455c67){return db[_0xd8b8('0x18')]['findAll']({'raw':_0x298583[_0xd8b8('0x19')]?_0x298583['options'][_0xd8b8('0x1a')]===undefined?!![]:![]:!![],'where':_0x298583['options']?_0x298583[_0xd8b8('0x19')][_0xd8b8('0x1b')]||null:null,'attributes':_0x298583[_0xd8b8('0x19')]?_0x298583[_0xd8b8('0x19')]['attributes']||null:null,'limit':_0x298583[_0xd8b8('0x19')]?_0x298583[_0xd8b8('0x19')][_0xd8b8('0x1c')]||null:null,'include':_0x298583['options']?_0x298583[_0xd8b8('0x19')][_0xd8b8('0x1d')]?_[_0xd8b8('0x1e')](_0x298583[_0xd8b8('0x19')][_0xd8b8('0x1d')],function(_0x5b6490){return{'model':db[_0x5b6490[_0xd8b8('0x1f')]],'as':_0x5b6490['as'],'attributes':_0x5b6490['attributes'],'include':_0x5b6490[_0xd8b8('0x1d')]?_['map'](_0x5b6490['include'],function(_0x1ce16f){return{'model':db[_0x1ce16f[_0xd8b8('0x1f')]],'as':_0x1ce16f['as'],'attributes':_0x1ce16f[_0xd8b8('0x20')],'include':_0x1ce16f['include']?_[_0xd8b8('0x1e')](_0x1ce16f[_0xd8b8('0x1d')],function(_0x50e58d){return{'model':db[_0x50e58d[_0xd8b8('0x1f')]],'as':_0x50e58d['as'],'attributes':_0x50e58d['attributes']};}):[]};}):[]};}):[]:[]})[_0xd8b8('0xe')](function(_0x4ee9fc){logger['info']('GetWhatsappQueue',_0x298583);logger[_0xd8b8('0x11')](_0xd8b8('0x17'),_0x298583,JSON[_0xd8b8('0x13')](_0x4ee9fc));_0x438c7f(_0x4ee9fc);})[_0xd8b8('0x16')](function(_0x9d8a05){logger[_0xd8b8('0x14')]('GetWhatsappQueue',_0x9d8a05[_0xd8b8('0x15')],_0x298583);_0x455c67(_0xeed726[_0xd8b8('0x14')](0x1f4,_0x9d8a05[_0xd8b8('0x15')]));});});};exports['ShowWhatsappQueue']=function(_0x2d26e6){var _0x2946b3=this;return new Promise(function(_0x2ad2d1,_0x440881){return db['WhatsappQueue']['find']({'raw':_0x2d26e6['options']?_0x2d26e6['options']['raw']===undefined?!![]:![]:!![],'where':_0x2d26e6[_0xd8b8('0x19')]?_0x2d26e6[_0xd8b8('0x19')][_0xd8b8('0x1b')]||null:null,'attributes':_0x2d26e6[_0xd8b8('0x19')]?_0x2d26e6[_0xd8b8('0x19')][_0xd8b8('0x20')]||null:null,'include':_0x2d26e6[_0xd8b8('0x19')]?_0x2d26e6[_0xd8b8('0x19')][_0xd8b8('0x1d')]?_[_0xd8b8('0x1e')](_0x2d26e6['options'][_0xd8b8('0x1d')],function(_0x3feab1){return{'model':db[_0x3feab1[_0xd8b8('0x1f')]],'as':_0x3feab1['as'],'attributes':_0x3feab1[_0xd8b8('0x20')],'include':_0x3feab1['include']?_[_0xd8b8('0x1e')](_0x3feab1[_0xd8b8('0x1d')],function(_0x26c227){return{'model':db[_0x26c227[_0xd8b8('0x1f')]],'as':_0x26c227['as'],'attributes':_0x26c227[_0xd8b8('0x20')],'include':_0x26c227['include']?_['map'](_0x26c227[_0xd8b8('0x1d')],function(_0x4232b5){return{'model':db[_0x4232b5['model']],'as':_0x4232b5['as'],'attributes':_0x4232b5[_0xd8b8('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd8b8('0xe')](function(_0x55359b){logger['info']('ShowWhatsappQueue',_0x2d26e6);logger[_0xd8b8('0x11')](_0xd8b8('0x21'),_0x2d26e6,JSON[_0xd8b8('0x13')](_0x55359b));_0x2ad2d1(_0x55359b);})[_0xd8b8('0x16')](function(_0x41926a){logger[_0xd8b8('0x14')](_0xd8b8('0x21'),_0x41926a[_0xd8b8('0x15')],_0x2d26e6);_0x440881(_0x2946b3[_0xd8b8('0x14')](0x1f4,_0x41926a[_0xd8b8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 8486e4b..c9dafee 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 _0xe243=['save','remove','update','emit','removeListener','./whatsappQueue.events'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0xe243,0x14f));var _0x3e24=function(_0x2c507b,_0x343d21){_0x2c507b=_0x2c507b-0x0;var _0x346f0d=_0xe243[_0x2c507b];return _0x346f0d;};'use strict';var WhatsappQueueEvents=require(_0x3e24('0x0'));var events=[_0x3e24('0x1'),_0x3e24('0x2'),_0x3e24('0x3')];function createListener(_0x3f1e23,_0xed5748){return function(_0xf981c){_0xed5748[_0x3e24('0x4')](_0x3f1e23,_0xf981c);};}function removeListener(_0x3fec87,_0xc16ec9){return function(){WhatsappQueueEvents[_0x3e24('0x5')](_0x3fec87,_0xc16ec9);};}exports['register']=function(_0x4c10b2){for(var _0x49003d=0x0,_0x512f08=events['length'];_0x49003d<_0x512f08;_0x49003d++){var _0x16bc1d=events[_0x49003d];var _0x414022=createListener('whatsappQueue:'+_0x16bc1d,_0x4c10b2);WhatsappQueueEvents['on'](_0x16bc1d,_0x414022);}}; \ No newline at end of file +var _0x693b=['register','length','whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','removeListener'];(function(_0x426436,_0x36eca2){var _0x549d6c=function(_0x3baf3a){while(--_0x3baf3a){_0x426436['push'](_0x426436['shift']());}};_0x549d6c(++_0x36eca2);}(_0x693b,0x1aa));var _0xb693=function(_0x1cd234,_0x12db2f){_0x1cd234=_0x1cd234-0x0;var _0x130802=_0x693b[_0x1cd234];return _0x130802;};'use strict';var WhatsappQueueEvents=require(_0xb693('0x0'));var events=[_0xb693('0x1'),_0xb693('0x2'),_0xb693('0x3')];function createListener(_0x13693d,_0x42e105){return function(_0x47a18a){_0x42e105[_0xb693('0x4')](_0x13693d,_0x47a18a);};}function removeListener(_0xb99adf,_0x3fe5d7){return function(){WhatsappQueueEvents[_0xb693('0x5')](_0xb99adf,_0x3fe5d7);};}exports[_0xb693('0x6')]=function(_0x49001d){for(var _0x4e44f9=0x0,_0x22303=events[_0xb693('0x7')];_0x4e44f9<_0x22303;_0x4e44f9++){var _0xc965ef=events[_0x4e44f9];var _0x448cd2=createListener(_0xb693('0x8')+_0xc965ef,_0x49001d);WhatsappQueueEvents['on'](_0xc965ef,_0x448cd2);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 8546220..e8a0beb 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 _0x52d3=['isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x52d3,0x188));var _0x352d=function(_0x3a4ba0,_0x4455ee){_0x3a4ba0=_0x3a4ba0-0x0;var _0x433c0e=_0x52d3[_0x3a4ba0];return _0x433c0e;};'use strict';var multer=require(_0x352d('0x0'));var util=require(_0x352d('0x1'));var path=require(_0x352d('0x2'));var timeout=require(_0x352d('0x3'));var express=require('express');var router=express[_0x352d('0x4')]();var fs_extra=require(_0x352d('0x5'));var auth=require(_0x352d('0x6'));var interaction=require(_0x352d('0x7'));var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x352d('0x8')](),controller[_0x352d('0x9')]);router[_0x352d('0xa')](_0x352d('0xb'),auth['isAuthenticated'](),controller[_0x352d('0xc')]);router['get'](_0x352d('0xd'),auth[_0x352d('0x8')](),controller[_0x352d('0xe')]);router[_0x352d('0xf')]('/',auth[_0x352d('0x8')](),controller[_0x352d('0x10')]);router[_0x352d('0x11')]('/:id',auth[_0x352d('0x8')](),controller['update']);router[_0x352d('0x12')](_0x352d('0xd'),auth[_0x352d('0x8')](),controller['destroy']);module[_0x352d('0x13')]=router; \ No newline at end of file +var _0x0c3a=['../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','show','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0c3a,0x142));var _0xa0c3=function(_0x489f09,_0x3f3db2){_0x489f09=_0x489f09-0x0;var _0x4f09b0=_0x0c3a[_0x489f09];return _0x4f09b0;};'use strict';var multer=require(_0xa0c3('0x0'));var util=require(_0xa0c3('0x1'));var path=require(_0xa0c3('0x2'));var timeout=require(_0xa0c3('0x3'));var express=require(_0xa0c3('0x4'));var router=express[_0xa0c3('0x5')]();var fs_extra=require(_0xa0c3('0x6'));var auth=require(_0xa0c3('0x7'));var interaction=require(_0xa0c3('0x8'));var config=require(_0xa0c3('0x9'));var controller=require(_0xa0c3('0xa'));router[_0xa0c3('0xb')]('/',auth['isAuthenticated'](),controller[_0xa0c3('0xc')]);router[_0xa0c3('0xb')](_0xa0c3('0xd'),auth[_0xa0c3('0xe')](),controller['describe']);router[_0xa0c3('0xb')]('/:id',auth[_0xa0c3('0xe')](),controller[_0xa0c3('0xf')]);router['post']('/',auth[_0xa0c3('0xe')](),controller[_0xa0c3('0x10')]);router[_0xa0c3('0x11')](_0xa0c3('0x12'),auth['isAuthenticated'](),controller[_0xa0c3('0x13')]);router['delete']('/:id',auth[_0xa0c3('0xe')](),controller[_0xa0c3('0x14')]);module[_0xa0c3('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index f858f39..9620087 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(_0x2e3136,_0xa7f6ee){var _0x361c34=function(_0x128c22){while(--_0x128c22){_0x2e3136['push'](_0x2e3136['shift']());}};_0x361c34(++_0xa7f6ee);}(_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(_0x39150e,_0xb07cc5){var _0x3dc193=function(_0x550a62){while(--_0x550a62){_0x39150e['push'](_0x39150e['shift']());}};_0x3dc193(++_0xb07cc5);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 0d3c79b..0f6f9cf 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 _0x1c7c=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','error','name','index','map','WhatsappQueueReport','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x2731f0,_0x126b1b){var _0x36a180=function(_0x44d1a9){while(--_0x44d1a9){_0x2731f0['push'](_0x2731f0['shift']());}};_0x36a180(++_0x126b1b);}(_0x1c7c,0x164));var _0xc1c7=function(_0x521022,_0x326a07){_0x521022=_0x521022-0x0;var _0x1bb4d0=_0x1c7c[_0x521022];return _0x1bb4d0;};'use strict';var emlformat=require(_0xc1c7('0x0'));var rimraf=require(_0xc1c7('0x1'));var zipdir=require(_0xc1c7('0x2'));var jsonpatch=require(_0xc1c7('0x3'));var rp=require('request-promise');var moment=require(_0xc1c7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1c7('0x5'));var util=require(_0xc1c7('0x6'));var path=require(_0xc1c7('0x7'));var sox=require(_0xc1c7('0x8'));var csv=require(_0xc1c7('0x9'));var ejs=require(_0xc1c7('0xa'));var fs=require('fs');var fs_extra=require(_0xc1c7('0xb'));var _=require(_0xc1c7('0xc'));var squel=require(_0xc1c7('0xd'));var crypto=require(_0xc1c7('0xe'));var jsforce=require(_0xc1c7('0xf'));var deskjs=require(_0xc1c7('0x10'));var toCsv=require(_0xc1c7('0x9'));var querystring=require(_0xc1c7('0x11'));var Papa=require(_0xc1c7('0x12'));var Redis=require(_0xc1c7('0x13'));var authService=require(_0xc1c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c7('0x15'));var hardwareService=require(_0xc1c7('0x16'));var logger=require('../../config/logger')(_0xc1c7('0x17'));var utils=require(_0xc1c7('0x18'));var config=require(_0xc1c7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1c7('0x1a'))['db'];function respondWithStatusCode(_0x44bf88,_0x376cab){_0x376cab=_0x376cab||0xcc;return function(_0x35feaa){if(_0x35feaa){return _0x44bf88[_0xc1c7('0x1b')](_0x376cab);}return _0x44bf88[_0xc1c7('0x1c')](_0x376cab)[_0xc1c7('0x1d')]();};}function respondWithResult(_0x1b57ab,_0xdfc7d9){_0xdfc7d9=_0xdfc7d9||0xc8;return function(_0x1b6905){if(_0x1b6905){return _0x1b57ab[_0xc1c7('0x1c')](_0xdfc7d9)[_0xc1c7('0x1e')](_0x1b6905);}};}function respondWithFilteredResult(_0x49576d,_0x3e1f0e){return function(_0x335600){if(_0x335600){var _0x21911c=typeof _0x3e1f0e['offset']===_0xc1c7('0x1f')&&typeof _0x3e1f0e[_0xc1c7('0x20')]===_0xc1c7('0x1f');var _0x39ac54=_0x335600[_0xc1c7('0x21')];var _0xb42702=_0x21911c?0x0:_0x3e1f0e[_0xc1c7('0x22')];var _0x2e93e5=_0x21911c?_0x335600['count']:_0x3e1f0e[_0xc1c7('0x22')]+_0x3e1f0e[_0xc1c7('0x20')];var _0x3ec66a;if(_0x2e93e5>=_0x39ac54){_0x2e93e5=_0x39ac54;_0x3ec66a=0xc8;}else{_0x3ec66a=0xce;}_0x49576d[_0xc1c7('0x1c')](_0x3ec66a);return _0x49576d['set'](_0xc1c7('0x23'),_0xb42702+'-'+_0x2e93e5+'/'+_0x39ac54)['json'](_0x335600);}return null;};}function patchUpdates(_0x5e7e4a){return function(_0x195c5f){try{jsonpatch['apply'](_0x195c5f,_0x5e7e4a,!![]);}catch(_0x5846f0){return BPromise[_0xc1c7('0x24')](_0x5846f0);}return _0x195c5f[_0xc1c7('0x25')]();};}function saveUpdates(_0x2f1b87,_0x4c6b34){return function(_0x813853){if(_0x813853){return _0x813853[_0xc1c7('0x26')](_0x2f1b87)[_0xc1c7('0x27')](function(_0x31a0e0){return _0x31a0e0;});}return null;};}function removeEntity(_0x2e64c4,_0x3a2483){return function(_0x3180fd){if(_0x3180fd){return _0x3180fd[_0xc1c7('0x28')]()[_0xc1c7('0x27')](function(){_0x2e64c4[_0xc1c7('0x1c')](0xcc)[_0xc1c7('0x1d')]();});}};}function handleEntityNotFound(_0x363fbc,_0x33aac7){return function(_0x260a3f){if(!_0x260a3f){_0x363fbc[_0xc1c7('0x1b')](0x194);}return _0x260a3f;};}function handleError(_0x21563a,_0x5edb34){_0x5edb34=_0x5edb34||0x1f4;return function(_0xf0ab9c){logger[_0xc1c7('0x29')](_0xf0ab9c['stack']);if(_0xf0ab9c['name']){delete _0xf0ab9c[_0xc1c7('0x2a')];}_0x21563a['status'](_0x5edb34)['send'](_0xf0ab9c);};}exports[_0xc1c7('0x2b')]=function(_0x1b873c,_0x46d045){var _0x243450={},_0x461360={},_0x4adb81={'count':0x0,'rows':[]};var _0x574e1c=_[_0xc1c7('0x2c')](db[_0xc1c7('0x2d')][_0xc1c7('0x2e')],function(_0x3a786f){return{'name':_0x3a786f[_0xc1c7('0x2f')],'type':_0x3a786f['type']['key']};});_0x461360[_0xc1c7('0x30')]=_[_0xc1c7('0x2c')](_0x574e1c,'name');_0x461360[_0xc1c7('0x31')]=_[_0xc1c7('0x32')](_0x1b873c[_0xc1c7('0x31')]);_0x461360[_0xc1c7('0x33')]=_[_0xc1c7('0x34')](_0x461360[_0xc1c7('0x30')],_0x461360[_0xc1c7('0x31')]);_0x243450['attributes']=_[_0xc1c7('0x34')](_0x461360[_0xc1c7('0x30')],qs[_0xc1c7('0x35')](_0x1b873c[_0xc1c7('0x31')][_0xc1c7('0x35')]));_0x243450[_0xc1c7('0x36')]=_0x243450[_0xc1c7('0x36')][_0xc1c7('0x37')]?_0x243450[_0xc1c7('0x36')]:_0x461360['model'];if(!_0x1b873c['query'][_0xc1c7('0x38')](_0xc1c7('0x39'))){_0x243450[_0xc1c7('0x20')]=qs[_0xc1c7('0x20')](_0x1b873c[_0xc1c7('0x31')][_0xc1c7('0x20')]);_0x243450[_0xc1c7('0x22')]=qs[_0xc1c7('0x22')](_0x1b873c[_0xc1c7('0x31')][_0xc1c7('0x22')]);}_0x243450[_0xc1c7('0x3a')]=qs[_0xc1c7('0x3b')](_0x1b873c[_0xc1c7('0x31')][_0xc1c7('0x3b')]);_0x243450[_0xc1c7('0x3c')]=qs[_0xc1c7('0x33')](_[_0xc1c7('0x3d')](_0x1b873c[_0xc1c7('0x31')],_0x461360[_0xc1c7('0x33')]),_0x574e1c);if(_0x1b873c[_0xc1c7('0x31')][_0xc1c7('0x3e')]){_0x243450['where']=_['merge'](_0x243450['where'],{'$or':_[_0xc1c7('0x2c')](_0x574e1c,function(_0x4f4312){if(_0x4f4312['type']!==_0xc1c7('0x3f')){var _0x24ceb4={};_0x24ceb4[_0x4f4312[_0xc1c7('0x2a')]]={'$like':'%'+_0x1b873c[_0xc1c7('0x31')]['filter']+'%'};return _0x24ceb4;}})});}_0x243450=_[_0xc1c7('0x40')]({},_0x243450,_0x1b873c[_0xc1c7('0x41')]);var _0x32e9fd={'where':_0x243450[_0xc1c7('0x3c')]};return db[_0xc1c7('0x2d')][_0xc1c7('0x21')](_0x32e9fd)[_0xc1c7('0x27')](function(_0x26343d){_0x4adb81[_0xc1c7('0x21')]=_0x26343d;if(_0x1b873c[_0xc1c7('0x31')][_0xc1c7('0x42')]){_0x243450[_0xc1c7('0x43')]=[{'all':!![]}];}return db[_0xc1c7('0x2d')]['findAll'](_0x243450);})[_0xc1c7('0x27')](function(_0x412520){_0x4adb81['rows']=_0x412520;return _0x4adb81;})[_0xc1c7('0x27')](respondWithFilteredResult(_0x46d045,_0x243450))[_0xc1c7('0x44')](handleError(_0x46d045,null));};exports[_0xc1c7('0x45')]=function(_0x7131b1,_0x46a1b5){var _0x2c09de={'raw':!![],'where':{'id':_0x7131b1[_0xc1c7('0x46')]['id']}},_0xd5e06a={};_0xd5e06a[_0xc1c7('0x30')]=_[_0xc1c7('0x32')](db['WhatsappQueueReport'][_0xc1c7('0x2e')]);_0xd5e06a[_0xc1c7('0x31')]=_['keys'](_0x7131b1['query']);_0xd5e06a[_0xc1c7('0x33')]=_[_0xc1c7('0x34')](_0xd5e06a[_0xc1c7('0x30')],_0xd5e06a[_0xc1c7('0x31')]);_0x2c09de[_0xc1c7('0x36')]=_['intersection'](_0xd5e06a[_0xc1c7('0x30')],qs[_0xc1c7('0x35')](_0x7131b1['query']['fields']));_0x2c09de['attributes']=_0x2c09de[_0xc1c7('0x36')][_0xc1c7('0x37')]?_0x2c09de[_0xc1c7('0x36')]:_0xd5e06a['model'];if(_0x7131b1[_0xc1c7('0x31')][_0xc1c7('0x42')]){_0x2c09de['include']=[{'all':!![]}];}_0x2c09de=_[_0xc1c7('0x40')]({},_0x2c09de,_0x7131b1[_0xc1c7('0x41')]);return db[_0xc1c7('0x2d')][_0xc1c7('0x47')](_0x2c09de)[_0xc1c7('0x27')](handleEntityNotFound(_0x46a1b5,null))[_0xc1c7('0x27')](respondWithResult(_0x46a1b5,null))[_0xc1c7('0x44')](handleError(_0x46a1b5,null));};exports[_0xc1c7('0x48')]=function(_0x35141f,_0x3ec5de){return db[_0xc1c7('0x2d')][_0xc1c7('0x48')](_0x35141f[_0xc1c7('0x49')],{})[_0xc1c7('0x27')](respondWithResult(_0x3ec5de,0xc9))[_0xc1c7('0x44')](handleError(_0x3ec5de,null));};exports[_0xc1c7('0x26')]=function(_0x2967b7,_0x1addc8){if(_0x2967b7['body']['id']){delete _0x2967b7[_0xc1c7('0x49')]['id'];}return db['WhatsappQueueReport'][_0xc1c7('0x47')]({'where':{'id':_0x2967b7[_0xc1c7('0x46')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x1addc8,null))['then'](saveUpdates(_0x2967b7[_0xc1c7('0x49')],null))[_0xc1c7('0x27')](respondWithResult(_0x1addc8,null))['catch'](handleError(_0x1addc8,null));};exports['destroy']=function(_0x5c96cc,_0x302185){return db[_0xc1c7('0x2d')]['find']({'where':{'id':_0x5c96cc[_0xc1c7('0x46')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x302185,null))[_0xc1c7('0x27')](removeEntity(_0x302185,null))[_0xc1c7('0x44')](handleError(_0x302185,null));};exports[_0xc1c7('0x4a')]=function(_0x13569a,_0x4cad6a){return db[_0xc1c7('0x2d')]['describe']()[_0xc1c7('0x27')](respondWithResult(_0x4cad6a,null))[_0xc1c7('0x44')](handleError(_0x4cad6a,null));}; \ No newline at end of file +var _0x3266=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','set','Content-Range','save','update','then','destroy','end','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','key','model'];(function(_0x425577,_0x4498b7){var _0x1683f8=function(_0x5b048d){while(--_0x5b048d){_0x425577['push'](_0x425577['shift']());}};_0x1683f8(++_0x4498b7);}(_0x3266,0x6a));var _0x6326=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0x3266[_0x648163];return _0x199d4d;};'use strict';var emlformat=require(_0x6326('0x0'));var rimraf=require(_0x6326('0x1'));var zipdir=require(_0x6326('0x2'));var jsonpatch=require(_0x6326('0x3'));var rp=require(_0x6326('0x4'));var moment=require(_0x6326('0x5'));var BPromise=require(_0x6326('0x6'));var Mustache=require(_0x6326('0x7'));var util=require(_0x6326('0x8'));var path=require('path');var sox=require(_0x6326('0x9'));var csv=require('to-csv');var ejs=require(_0x6326('0xa'));var fs=require('fs');var fs_extra=require(_0x6326('0xb'));var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xf'));var querystring=require(_0x6326('0x10'));var Papa=require(_0x6326('0x11'));var Redis=require(_0x6326('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6326('0x13'));var as=require(_0x6326('0x14'));var hardwareService=require(_0x6326('0x15'));var logger=require(_0x6326('0x16'))(_0x6326('0x17'));var utils=require(_0x6326('0x18'));var config=require(_0x6326('0x19'));var licenseUtil=require(_0x6326('0x1a'));var db=require(_0x6326('0x1b'))['db'];function respondWithStatusCode(_0x379358,_0x5c07e1){_0x5c07e1=_0x5c07e1||0xcc;return function(_0x5381d0){if(_0x5381d0){return _0x379358[_0x6326('0x1c')](_0x5c07e1);}return _0x379358[_0x6326('0x1d')](_0x5c07e1)['end']();};}function respondWithResult(_0x425878,_0x4caef3){_0x4caef3=_0x4caef3||0xc8;return function(_0x2d2d9b){if(_0x2d2d9b){return _0x425878[_0x6326('0x1d')](_0x4caef3)[_0x6326('0x1e')](_0x2d2d9b);}};}function respondWithFilteredResult(_0x41c352,_0x1ed3a3){return function(_0x2c1879){if(_0x2c1879){var _0x55923a=typeof _0x1ed3a3[_0x6326('0x1f')]==='undefined'&&typeof _0x1ed3a3['limit']==='undefined';var _0x51e7b9=_0x2c1879['count'];var _0x58e960=_0x55923a?0x0:_0x1ed3a3[_0x6326('0x1f')];var _0x1f4c11=_0x55923a?_0x2c1879[_0x6326('0x20')]:_0x1ed3a3['offset']+_0x1ed3a3['limit'];var _0x954ed5;if(_0x1f4c11>=_0x51e7b9){_0x1f4c11=_0x51e7b9;_0x954ed5=0xc8;}else{_0x954ed5=0xce;}_0x41c352[_0x6326('0x1d')](_0x954ed5);return _0x41c352[_0x6326('0x21')](_0x6326('0x22'),_0x58e960+'-'+_0x1f4c11+'/'+_0x51e7b9)[_0x6326('0x1e')](_0x2c1879);}return null;};}function patchUpdates(_0x25957a){return function(_0x21ee7d){try{jsonpatch['apply'](_0x21ee7d,_0x25957a,!![]);}catch(_0x22307f){return BPromise['reject'](_0x22307f);}return _0x21ee7d[_0x6326('0x23')]();};}function saveUpdates(_0x3c6cfa,_0x2482ef){return function(_0x24fb78){if(_0x24fb78){return _0x24fb78[_0x6326('0x24')](_0x3c6cfa)[_0x6326('0x25')](function(_0x225555){return _0x225555;});}return null;};}function removeEntity(_0x429bb0,_0x4781cc){return function(_0x2d0d00){if(_0x2d0d00){return _0x2d0d00[_0x6326('0x26')]()['then'](function(){_0x429bb0[_0x6326('0x1d')](0xcc)[_0x6326('0x27')]();});}};}function handleEntityNotFound(_0x575701,_0x4e272b){return function(_0x4d28fd){if(!_0x4d28fd){_0x575701[_0x6326('0x1c')](0x194);}return _0x4d28fd;};}function handleError(_0x4dae28,_0x33c466){_0x33c466=_0x33c466||0x1f4;return function(_0x1a48da){logger['error'](_0x1a48da[_0x6326('0x28')]);if(_0x1a48da[_0x6326('0x29')]){delete _0x1a48da[_0x6326('0x29')];}_0x4dae28[_0x6326('0x1d')](_0x33c466)[_0x6326('0x2a')](_0x1a48da);};}exports[_0x6326('0x2b')]=function(_0x40e036,_0x27802c){var _0x461e0f={},_0x127744={},_0x4980f6={'count':0x0,'rows':[]};var _0x2a8873=_[_0x6326('0x2c')](db[_0x6326('0x2d')][_0x6326('0x2e')],function(_0x20c5ab){return{'name':_0x20c5ab['fieldName'],'type':_0x20c5ab[_0x6326('0x2f')][_0x6326('0x30')]};});_0x127744[_0x6326('0x31')]=_['map'](_0x2a8873,_0x6326('0x29'));_0x127744['query']=_['keys'](_0x40e036[_0x6326('0x32')]);_0x127744[_0x6326('0x33')]=_[_0x6326('0x34')](_0x127744[_0x6326('0x31')],_0x127744[_0x6326('0x32')]);_0x461e0f[_0x6326('0x35')]=_[_0x6326('0x34')](_0x127744[_0x6326('0x31')],qs[_0x6326('0x36')](_0x40e036[_0x6326('0x32')][_0x6326('0x36')]));_0x461e0f[_0x6326('0x35')]=_0x461e0f['attributes'][_0x6326('0x37')]?_0x461e0f[_0x6326('0x35')]:_0x127744['model'];if(!_0x40e036[_0x6326('0x32')][_0x6326('0x38')](_0x6326('0x39'))){_0x461e0f['limit']=qs[_0x6326('0x3a')](_0x40e036['query']['limit']);_0x461e0f[_0x6326('0x1f')]=qs[_0x6326('0x1f')](_0x40e036[_0x6326('0x32')]['offset']);}_0x461e0f[_0x6326('0x3b')]=qs['sort'](_0x40e036[_0x6326('0x32')]['sort']);_0x461e0f[_0x6326('0x3c')]=qs[_0x6326('0x33')](_[_0x6326('0x3d')](_0x40e036[_0x6326('0x32')],_0x127744[_0x6326('0x33')]),_0x2a8873);if(_0x40e036[_0x6326('0x32')]['filter']){_0x461e0f[_0x6326('0x3c')]=_[_0x6326('0x3e')](_0x461e0f['where'],{'$or':_[_0x6326('0x2c')](_0x2a8873,function(_0x5ae140){if(_0x5ae140['type']!==_0x6326('0x3f')){var _0x1f8dcf={};_0x1f8dcf[_0x5ae140[_0x6326('0x29')]]={'$like':'%'+_0x40e036[_0x6326('0x32')][_0x6326('0x40')]+'%'};return _0x1f8dcf;}})});}_0x461e0f=_[_0x6326('0x3e')]({},_0x461e0f,_0x40e036['options']);var _0x485bed={'where':_0x461e0f[_0x6326('0x3c')]};return db['WhatsappQueueReport'][_0x6326('0x20')](_0x485bed)['then'](function(_0x282f33){_0x4980f6[_0x6326('0x20')]=_0x282f33;if(_0x40e036[_0x6326('0x32')][_0x6326('0x41')]){_0x461e0f[_0x6326('0x42')]=[{'all':!![]}];}return db[_0x6326('0x2d')][_0x6326('0x43')](_0x461e0f);})[_0x6326('0x25')](function(_0x3b089b){_0x4980f6[_0x6326('0x44')]=_0x3b089b;return _0x4980f6;})[_0x6326('0x25')](respondWithFilteredResult(_0x27802c,_0x461e0f))['catch'](handleError(_0x27802c,null));};exports[_0x6326('0x45')]=function(_0x5ce03a,_0x29f2fd){var _0x1d9d4c={'raw':!![],'where':{'id':_0x5ce03a[_0x6326('0x46')]['id']}},_0x16fc33={};_0x16fc33['model']=_[_0x6326('0x47')](db[_0x6326('0x2d')]['rawAttributes']);_0x16fc33[_0x6326('0x32')]=_[_0x6326('0x47')](_0x5ce03a[_0x6326('0x32')]);_0x16fc33[_0x6326('0x33')]=_['intersection'](_0x16fc33[_0x6326('0x31')],_0x16fc33[_0x6326('0x32')]);_0x1d9d4c[_0x6326('0x35')]=_[_0x6326('0x34')](_0x16fc33[_0x6326('0x31')],qs[_0x6326('0x36')](_0x5ce03a[_0x6326('0x32')]['fields']));_0x1d9d4c[_0x6326('0x35')]=_0x1d9d4c[_0x6326('0x35')][_0x6326('0x37')]?_0x1d9d4c[_0x6326('0x35')]:_0x16fc33['model'];if(_0x5ce03a[_0x6326('0x32')]['includeAll']){_0x1d9d4c[_0x6326('0x42')]=[{'all':!![]}];}_0x1d9d4c=_[_0x6326('0x3e')]({},_0x1d9d4c,_0x5ce03a[_0x6326('0x48')]);return db[_0x6326('0x2d')][_0x6326('0x49')](_0x1d9d4c)['then'](handleEntityNotFound(_0x29f2fd,null))[_0x6326('0x25')](respondWithResult(_0x29f2fd,null))['catch'](handleError(_0x29f2fd,null));};exports['create']=function(_0x2bca12,_0x44cf9d){return db['WhatsappQueueReport'][_0x6326('0x4a')](_0x2bca12[_0x6326('0x4b')],{})[_0x6326('0x25')](respondWithResult(_0x44cf9d,0xc9))[_0x6326('0x4c')](handleError(_0x44cf9d,null));};exports[_0x6326('0x24')]=function(_0x4f8dc0,_0x4af0ee){if(_0x4f8dc0[_0x6326('0x4b')]['id']){delete _0x4f8dc0[_0x6326('0x4b')]['id'];}return db[_0x6326('0x2d')][_0x6326('0x49')]({'where':{'id':_0x4f8dc0[_0x6326('0x46')]['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x4af0ee,null))[_0x6326('0x25')](saveUpdates(_0x4f8dc0['body'],null))[_0x6326('0x25')](respondWithResult(_0x4af0ee,null))[_0x6326('0x4c')](handleError(_0x4af0ee,null));};exports[_0x6326('0x26')]=function(_0x3e7674,_0x1b5e9a){return db['WhatsappQueueReport'][_0x6326('0x49')]({'where':{'id':_0x3e7674['params']['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x1b5e9a,null))[_0x6326('0x25')](removeEntity(_0x1b5e9a,null))['catch'](handleError(_0x1b5e9a,null));};exports[_0x6326('0x4d')]=function(_0x5040b1,_0xaa4c9d){return db[_0x6326('0x2d')][_0x6326('0x4d')]()[_0x6326('0x25')](respondWithResult(_0xaa4c9d,null))['catch'](handleError(_0xaa4c9d,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index e2f355a..c06a7b5 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 _0x780f=['util','../../config/logger','api','moment','bluebird','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','lodash'];(function(_0x5cb395,_0x2e5a06){var _0x517ce8=function(_0x18ef96){while(--_0x18ef96){_0x5cb395['push'](_0x5cb395['shift']());}};_0x517ce8(++_0x2e5a06);}(_0x780f,0x6b));var _0xf780=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x780f[_0x28611e];return _0x530f69;};'use strict';var _=require(_0xf780('0x0'));var util=require(_0xf780('0x1'));var logger=require(_0xf780('0x2'))(_0xf780('0x3'));var moment=require(_0xf780('0x4'));var BPromise=require(_0xf780('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf780('0x6'));var attributes=require(_0xf780('0x7'));module[_0xf780('0x8')]=function(_0x1e299e,_0x50a598){return _0x1e299e[_0xf780('0x9')](_0xf780('0xa'),attributes,{'tableName':_0xf780('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1efd=['exports','define','WhatsappQueueReport','uniqueid','lodash','../../config/logger','api','moment','path','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x2b5722,_0x3cab00){var _0x3c065c=function(_0x210a1f){while(--_0x210a1f){_0x2b5722['push'](_0x2b5722['shift']());}};_0x3c065c(++_0x3cab00);}(_0x1efd,0xeb));var _0xd1ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1efd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd1ef('0x0'));var util=require('util');var logger=require(_0xd1ef('0x1'))(_0xd1ef('0x2'));var moment=require(_0xd1ef('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1ef('0x4'));var rimraf=require('rimraf');var config=require(_0xd1ef('0x5'));var attributes=require(_0xd1ef('0x6'));module[_0xd1ef('0x7')]=function(_0x2748ec,_0x9c2e8b){return _0x2748ec[_0xd1ef('0x8')](_0xd1ef('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xd1ef('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 62be2c2..a5ac50f 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 _0xa64e=['../../config/environment','jayson/promise','http','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateWhatsappQueueReport','body','options','raw','then','debug','UpdateWhatsappQueueReport','WhatsappQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2daf3f,_0x3f6cb8){var _0x159a88=function(_0x740ba5){while(--_0x740ba5){_0x2daf3f['push'](_0x2daf3f['shift']());}};_0x159a88(++_0x3f6cb8);}(_0xa64e,0x117));var _0xea64=function(_0x3412ab,_0x5a2b22){_0x3412ab=_0x3412ab-0x0;var _0x37ad1d=_0xa64e[_0x3412ab];return _0x37ad1d;};'use strict';var _=require(_0xea64('0x0'));var util=require(_0xea64('0x1'));var moment=require(_0xea64('0x2'));var BPromise=require(_0xea64('0x3'));var rs=require(_0xea64('0x4'));var fs=require('fs');var Redis=require(_0xea64('0x5'));var db=require(_0xea64('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xea64('0x7'))(_0xea64('0x8'));var config=require(_0xea64('0x9'));var jayson=require(_0xea64('0xa'));var client=jayson['client'][_0xea64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4dfe60,_0x372bbe,_0x2e37c7){return new BPromise(function(_0x10369c,_0x1d7272){return client['request'](_0x4dfe60,_0x2e37c7)['then'](function(_0x4a8aae){logger['info'](_0xea64('0xc'),_0x372bbe,_0xea64('0xd'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x372bbe,'request\x20sent',JSON[_0xea64('0xe')](_0x4a8aae));if(_0x4a8aae['error']){if(_0x4a8aae[_0xea64('0xf')][_0xea64('0x10')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x372bbe,_0x4a8aae['error'][_0xea64('0x11')]);return _0x1d7272(_0x4a8aae[_0xea64('0xf')][_0xea64('0x11')]);}logger['error'](_0xea64('0xc'),_0x372bbe,_0x4a8aae[_0xea64('0xf')][_0xea64('0x11')]);return _0x10369c(_0x4a8aae[_0xea64('0xf')][_0xea64('0x11')]);}else{logger[_0xea64('0x12')](_0xea64('0xc'),_0x372bbe,_0xea64('0xd'));_0x10369c(_0x4a8aae[_0xea64('0x13')]['message']);}})[_0xea64('0x14')](function(_0x4e8c6c){logger[_0xea64('0xf')](_0xea64('0xc'),_0x372bbe,_0x4e8c6c);_0x1d7272(_0x4e8c6c);});});}exports[_0xea64('0x15')]=function(_0x175fbc){var _0x391903=this;return new Promise(function(_0x5de00c,_0x39b77f){return db['WhatsappQueueReport']['create'](_0x175fbc[_0xea64('0x16')],{'raw':_0x175fbc[_0xea64('0x17')]?_0x175fbc['options'][_0xea64('0x18')]===undefined?!![]:![]:!![]})[_0xea64('0x19')](function(_0x1f5235){logger['info'](_0xea64('0x15'),_0x175fbc);logger[_0xea64('0x1a')](_0xea64('0x15'),_0x175fbc,JSON['stringify'](_0x1f5235));_0x5de00c(_0x1f5235);})[_0xea64('0x14')](function(_0x2a960){logger[_0xea64('0xf')](_0xea64('0x15'),_0x2a960[_0xea64('0x11')],_0x175fbc);_0x39b77f(_0x391903['error'](0x1f4,_0x2a960[_0xea64('0x11')]));});});};exports[_0xea64('0x1b')]=function(_0x50cee7){var _0x1603de=this;return new Promise(function(_0x216a97,_0x18c34f){return db[_0xea64('0x1c')]['update'](_0x50cee7[_0xea64('0x16')],{'raw':_0x50cee7[_0xea64('0x17')]?_0x50cee7[_0xea64('0x17')][_0xea64('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50cee7[_0xea64('0x17')]?_0x50cee7[_0xea64('0x17')][_0xea64('0x1d')]||null:null,'attributes':_0x50cee7[_0xea64('0x17')]?_0x50cee7[_0xea64('0x17')][_0xea64('0x1e')]||null:null,'limit':_0x50cee7[_0xea64('0x17')]?_0x50cee7[_0xea64('0x17')][_0xea64('0x1f')]||null:null})[_0xea64('0x19')](function(_0x3db059){logger['info'](_0xea64('0x1b'),_0x50cee7);logger[_0xea64('0x1a')](_0xea64('0x1b'),_0x50cee7,JSON[_0xea64('0xe')](_0x3db059));_0x216a97(_0x3db059);})['catch'](function(_0x57c87c){logger[_0xea64('0xf')](_0xea64('0x1b'),_0x57c87c[_0xea64('0x11')],_0x50cee7);_0x18c34f(_0x1603de[_0xea64('0xf')](0x1f4,_0x57c87c[_0xea64('0x11')]));});});}; \ No newline at end of file +var _0xbddf=['client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','update','attributes','limit','UpdateWhatsappQueueReport','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x492535,_0x46524a){var _0x256620=function(_0x3015f8){while(--_0x3015f8){_0x492535['push'](_0x492535['shift']());}};_0x256620(++_0x46524a);}(_0xbddf,0x162));var _0xfbdd=function(_0x1918e5,_0x281479){_0x1918e5=_0x1918e5-0x0;var _0x5c8c55=_0xbddf[_0x1918e5];return _0x5c8c55;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfbdd('0x0'));var rs=require(_0xfbdd('0x1'));var fs=require('fs');var Redis=require(_0xfbdd('0x2'));var db=require(_0xfbdd('0x3'))['db'];var utils=require(_0xfbdd('0x4'));var logger=require(_0xfbdd('0x5'))(_0xfbdd('0x6'));var config=require(_0xfbdd('0x7'));var jayson=require(_0xfbdd('0x8'));var client=jayson[_0xfbdd('0x9')][_0xfbdd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dd1b0,_0x44b4ce,_0x2aae82){return new BPromise(function(_0x5bad90,_0xce81d){return client[_0xfbdd('0xb')](_0x3dd1b0,_0x2aae82)[_0xfbdd('0xc')](function(_0x23f384){logger[_0xfbdd('0xd')](_0xfbdd('0xe'),_0x44b4ce,_0xfbdd('0xf'));logger[_0xfbdd('0x10')](_0xfbdd('0x11'),_0x44b4ce,_0xfbdd('0xf'),JSON[_0xfbdd('0x12')](_0x23f384));if(_0x23f384[_0xfbdd('0x13')]){if(_0x23f384[_0xfbdd('0x13')][_0xfbdd('0x14')]===0x1f4){logger['error'](_0xfbdd('0xe'),_0x44b4ce,_0x23f384[_0xfbdd('0x13')][_0xfbdd('0x15')]);return _0xce81d(_0x23f384['error']['message']);}logger[_0xfbdd('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x44b4ce,_0x23f384[_0xfbdd('0x13')][_0xfbdd('0x15')]);return _0x5bad90(_0x23f384[_0xfbdd('0x13')][_0xfbdd('0x15')]);}else{logger[_0xfbdd('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x44b4ce,_0xfbdd('0xf'));_0x5bad90(_0x23f384[_0xfbdd('0x16')][_0xfbdd('0x15')]);}})[_0xfbdd('0x17')](function(_0x4f03ae){logger[_0xfbdd('0x13')](_0xfbdd('0xe'),_0x44b4ce,_0x4f03ae);_0xce81d(_0x4f03ae);});});}exports[_0xfbdd('0x18')]=function(_0x2a7678){var _0x5972b8=this;return new Promise(function(_0x3e517d,_0x4401cf){return db[_0xfbdd('0x19')]['create'](_0x2a7678[_0xfbdd('0x1a')],{'raw':_0x2a7678[_0xfbdd('0x1b')]?_0x2a7678[_0xfbdd('0x1b')][_0xfbdd('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x21cdd1){logger[_0xfbdd('0xd')]('CreateWhatsappQueueReport',_0x2a7678);logger['debug'](_0xfbdd('0x18'),_0x2a7678,JSON['stringify'](_0x21cdd1));_0x3e517d(_0x21cdd1);})['catch'](function(_0x15dc49){logger[_0xfbdd('0x13')]('CreateWhatsappQueueReport',_0x15dc49[_0xfbdd('0x15')],_0x2a7678);_0x4401cf(_0x5972b8[_0xfbdd('0x13')](0x1f4,_0x15dc49[_0xfbdd('0x15')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x4eab19){var _0x177f3b=this;return new Promise(function(_0x1c33bf,_0x4f4332){return db['WhatsappQueueReport'][_0xfbdd('0x1d')](_0x4eab19[_0xfbdd('0x1a')],{'raw':_0x4eab19[_0xfbdd('0x1b')]?_0x4eab19['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4eab19[_0xfbdd('0x1b')]?_0x4eab19[_0xfbdd('0x1b')]['where']||null:null,'attributes':_0x4eab19[_0xfbdd('0x1b')]?_0x4eab19[_0xfbdd('0x1b')][_0xfbdd('0x1e')]||null:null,'limit':_0x4eab19[_0xfbdd('0x1b')]?_0x4eab19[_0xfbdd('0x1b')][_0xfbdd('0x1f')]||null:null})[_0xfbdd('0xc')](function(_0xaa553b){logger[_0xfbdd('0xd')](_0xfbdd('0x20'),_0x4eab19);logger['debug'](_0xfbdd('0x20'),_0x4eab19,JSON[_0xfbdd('0x12')](_0xaa553b));_0x1c33bf(_0xaa553b);})[_0xfbdd('0x17')](function(_0x14a80c){logger[_0xfbdd('0x13')](_0xfbdd('0x20'),_0x14a80c['message'],_0x4eab19);_0x4f4332(_0x177f3b[_0xfbdd('0x13')](0x1f4,_0x14a80c['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index d4fe9e4..8ff23bd 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 _0x2d38=['index','/describe','isAuthenticated','/:id','show','put','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2d38,0x75));var _0x82d3=function(_0x1591f7,_0x5aedd6){_0x1591f7=_0x1591f7-0x0;var _0x4e1517=_0x2d38[_0x1591f7];return _0x4e1517;};'use strict';var multer=require('multer');var util=require(_0x82d3('0x0'));var path=require(_0x82d3('0x1'));var timeout=require(_0x82d3('0x2'));var express=require(_0x82d3('0x3'));var router=express['Router']();var fs_extra=require(_0x82d3('0x4'));var auth=require(_0x82d3('0x5'));var interaction=require(_0x82d3('0x6'));var config=require('../../config/environment');var controller=require(_0x82d3('0x7'));router[_0x82d3('0x8')]('/',auth['isAuthenticated'](),controller[_0x82d3('0x9')]);router[_0x82d3('0x8')](_0x82d3('0xa'),auth[_0x82d3('0xb')](),controller['describe']);router[_0x82d3('0x8')](_0x82d3('0xc'),auth[_0x82d3('0xb')](),controller[_0x82d3('0xd')]);router['post']('/',auth[_0x82d3('0xb')](),controller['create']);router[_0x82d3('0xe')](_0x82d3('0xc'),auth['isAuthenticated'](),controller[_0x82d3('0xf')]);router[_0x82d3('0x10')]('/:id',auth[_0x82d3('0xb')](),controller[_0x82d3('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa47a=['/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa47a,0x1aa));var _0xaa47=function(_0x478450,_0x4715cc){_0x478450=_0x478450-0x0;var _0x1e6f44=_0xa47a[_0x478450];return _0x1e6f44;};'use strict';var multer=require(_0xaa47('0x0'));var util=require(_0xaa47('0x1'));var path=require(_0xaa47('0x2'));var timeout=require(_0xaa47('0x3'));var express=require(_0xaa47('0x4'));var router=express[_0xaa47('0x5')]();var fs_extra=require(_0xaa47('0x6'));var auth=require(_0xaa47('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xaa47('0x8'));router[_0xaa47('0x9')]('/',auth[_0xaa47('0xa')](),controller[_0xaa47('0xb')]);router[_0xaa47('0x9')](_0xaa47('0xc'),auth[_0xaa47('0xa')](),controller[_0xaa47('0xd')]);router[_0xaa47('0x9')](_0xaa47('0xe'),auth[_0xaa47('0xa')](),controller[_0xaa47('0xf')]);router['post']('/',auth[_0xaa47('0xa')](),controller[_0xaa47('0x10')]);router[_0xaa47('0x11')](_0xaa47('0xe'),auth[_0xaa47('0xa')](),controller[_0xaa47('0x12')]);router[_0xaa47('0x13')](_0xaa47('0xe'),auth[_0xaa47('0xa')](),controller[_0xaa47('0x14')]);module[_0xaa47('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index a56b040..9a51072 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 _0x0caf=['ENUM','account','agent'];(function(_0x1f0ea2,_0x52fef8){var _0x5cd6dc=function(_0x32330e){while(--_0x32330e){_0x1f0ea2['push'](_0x1f0ea2['shift']());}};_0x5cd6dc(++_0x52fef8);}(_0x0caf,0x9f));var _0xf0ca=function(_0x4aa227,_0x7ca148){_0x4aa227=_0x4aa227-0x0;var _0x41e53a=_0x0caf[_0x4aa227];return _0x41e53a;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf0ca('0x0')](_0xf0ca('0x1'),_0xf0ca('0x2'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x263f=['DATE','sequelize','exports','STRING','ENUM','account','agent'];(function(_0x153457,_0x31d719){var _0x1d4aca=function(_0x49a3d4){while(--_0x49a3d4){_0x153457['push'](_0x153457['shift']());}};_0x1d4aca(++_0x31d719);}(_0x263f,0x182));var _0xf263=function(_0x559bb4,_0x5a6463){_0x559bb4=_0x559bb4-0x0;var _0x53f32c=_0x263f[_0x559bb4];return _0x53f32c;};'use strict';var Sequelize=require(_0xf263('0x0'));module[_0xf263('0x1')]={'uniqueid':{'type':Sequelize[_0xf263('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf263('0x3')](_0xf263('0x4'),_0xf263('0x5'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf263('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 2be7526..2123448 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 _0xbdad=['model','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','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','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params'];(function(_0x465f58,_0x48cd3a){var _0x261e0c=function(_0x49437e){while(--_0x49437e){_0x465f58['push'](_0x465f58['shift']());}};_0x261e0c(++_0x48cd3a);}(_0xbdad,0x1e1));var _0xdbda=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xbdad[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xdbda('0x0'));var rimraf=require(_0xdbda('0x1'));var zipdir=require(_0xdbda('0x2'));var jsonpatch=require(_0xdbda('0x3'));var rp=require(_0xdbda('0x4'));var moment=require(_0xdbda('0x5'));var BPromise=require(_0xdbda('0x6'));var Mustache=require(_0xdbda('0x7'));var util=require(_0xdbda('0x8'));var path=require(_0xdbda('0x9'));var sox=require(_0xdbda('0xa'));var csv=require(_0xdbda('0xb'));var ejs=require(_0xdbda('0xc'));var fs=require('fs');var fs_extra=require(_0xdbda('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdbda('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdbda('0xf'));var toCsv=require(_0xdbda('0xb'));var querystring=require('querystring');var Papa=require(_0xdbda('0x10'));var Redis=require(_0xdbda('0x11'));var authService=require(_0xdbda('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdbda('0x13'));var hardwareService=require(_0xdbda('0x14'));var logger=require(_0xdbda('0x15'))(_0xdbda('0x16'));var utils=require(_0xdbda('0x17'));var config=require(_0xdbda('0x18'));var licenseUtil=require(_0xdbda('0x19'));var db=require(_0xdbda('0x1a'))['db'];function respondWithStatusCode(_0xe4b1ce,_0x250dff){_0x250dff=_0x250dff||0xcc;return function(_0x25eef8){if(_0x25eef8){return _0xe4b1ce[_0xdbda('0x1b')](_0x250dff);}return _0xe4b1ce[_0xdbda('0x1c')](_0x250dff)[_0xdbda('0x1d')]();};}function respondWithResult(_0x5015a2,_0xc91af3){_0xc91af3=_0xc91af3||0xc8;return function(_0x293baa){if(_0x293baa){return _0x5015a2[_0xdbda('0x1c')](_0xc91af3)[_0xdbda('0x1e')](_0x293baa);}};}function respondWithFilteredResult(_0x5939f1,_0x51f36a){return function(_0x54f130){if(_0x54f130){var _0x3745a5=typeof _0x51f36a[_0xdbda('0x1f')]===_0xdbda('0x20')&&typeof _0x51f36a[_0xdbda('0x21')]===_0xdbda('0x20');var _0x31ded9=_0x54f130['count'];var _0x353642=_0x3745a5?0x0:_0x51f36a['offset'];var _0x41c62e=_0x3745a5?_0x54f130[_0xdbda('0x22')]:_0x51f36a[_0xdbda('0x1f')]+_0x51f36a[_0xdbda('0x21')];var _0x4f6526;if(_0x41c62e>=_0x31ded9){_0x41c62e=_0x31ded9;_0x4f6526=0xc8;}else{_0x4f6526=0xce;}_0x5939f1[_0xdbda('0x1c')](_0x4f6526);return _0x5939f1[_0xdbda('0x23')](_0xdbda('0x24'),_0x353642+'-'+_0x41c62e+'/'+_0x31ded9)[_0xdbda('0x1e')](_0x54f130);}return null;};}function patchUpdates(_0x17b923){return function(_0x32bc2e){try{jsonpatch[_0xdbda('0x25')](_0x32bc2e,_0x17b923,!![]);}catch(_0x2b874c){return BPromise[_0xdbda('0x26')](_0x2b874c);}return _0x32bc2e['save']();};}function saveUpdates(_0x199f90,_0x5c090c){return function(_0x5e414a){if(_0x5e414a){return _0x5e414a[_0xdbda('0x27')](_0x199f90)[_0xdbda('0x28')](function(_0x447f85){return _0x447f85;});}return null;};}function removeEntity(_0x3457e6,_0x2acb6b){return function(_0x10fa4b){if(_0x10fa4b){return _0x10fa4b[_0xdbda('0x29')]()[_0xdbda('0x28')](function(){_0x3457e6['status'](0xcc)[_0xdbda('0x1d')]();});}};}function handleEntityNotFound(_0x34c892,_0x290497){return function(_0x1731a8){if(!_0x1731a8){_0x34c892[_0xdbda('0x1b')](0x194);}return _0x1731a8;};}function handleError(_0x2ae211,_0x1fe354){_0x1fe354=_0x1fe354||0x1f4;return function(_0x4d1d67){logger[_0xdbda('0x2a')](_0x4d1d67[_0xdbda('0x2b')]);if(_0x4d1d67['name']){delete _0x4d1d67[_0xdbda('0x2c')];}_0x2ae211[_0xdbda('0x1c')](_0x1fe354)[_0xdbda('0x2d')](_0x4d1d67);};}exports[_0xdbda('0x2e')]=function(_0x5a9b05,_0x10fcab){var _0x20844f={},_0x2e984f={},_0x542fed={'count':0x0,'rows':[]};var _0x108bbf=_[_0xdbda('0x2f')](db[_0xdbda('0x30')][_0xdbda('0x31')],function(_0x3a7c64){return{'name':_0x3a7c64[_0xdbda('0x32')],'type':_0x3a7c64[_0xdbda('0x33')][_0xdbda('0x34')]};});_0x2e984f['model']=_[_0xdbda('0x2f')](_0x108bbf,_0xdbda('0x2c'));_0x2e984f[_0xdbda('0x35')]=_[_0xdbda('0x36')](_0x5a9b05['query']);_0x2e984f[_0xdbda('0x37')]=_[_0xdbda('0x38')](_0x2e984f['model'],_0x2e984f[_0xdbda('0x35')]);_0x20844f[_0xdbda('0x39')]=_[_0xdbda('0x38')](_0x2e984f['model'],qs[_0xdbda('0x3a')](_0x5a9b05[_0xdbda('0x35')][_0xdbda('0x3a')]));_0x20844f['attributes']=_0x20844f[_0xdbda('0x39')][_0xdbda('0x3b')]?_0x20844f[_0xdbda('0x39')]:_0x2e984f['model'];if(!_0x5a9b05[_0xdbda('0x35')]['hasOwnProperty'](_0xdbda('0x3c'))){_0x20844f['limit']=qs[_0xdbda('0x21')](_0x5a9b05[_0xdbda('0x35')][_0xdbda('0x21')]);_0x20844f['offset']=qs[_0xdbda('0x1f')](_0x5a9b05[_0xdbda('0x35')][_0xdbda('0x1f')]);}_0x20844f['order']=qs['sort'](_0x5a9b05[_0xdbda('0x35')][_0xdbda('0x3d')]);_0x20844f[_0xdbda('0x3e')]=qs[_0xdbda('0x37')](_[_0xdbda('0x3f')](_0x5a9b05[_0xdbda('0x35')],_0x2e984f[_0xdbda('0x37')]),_0x108bbf);if(_0x5a9b05[_0xdbda('0x35')][_0xdbda('0x40')]){_0x20844f['where']=_[_0xdbda('0x41')](_0x20844f[_0xdbda('0x3e')],{'$or':_[_0xdbda('0x2f')](_0x108bbf,function(_0x46d4d4){if(_0x46d4d4[_0xdbda('0x33')]!==_0xdbda('0x42')){var _0x3c94e6={};_0x3c94e6[_0x46d4d4[_0xdbda('0x2c')]]={'$like':'%'+_0x5a9b05['query'][_0xdbda('0x40')]+'%'};return _0x3c94e6;}})});}_0x20844f=_[_0xdbda('0x41')]({},_0x20844f,_0x5a9b05['options']);var _0x262e73={'where':_0x20844f['where']};return db[_0xdbda('0x30')][_0xdbda('0x22')](_0x262e73)['then'](function(_0x207d90){_0x542fed['count']=_0x207d90;if(_0x5a9b05[_0xdbda('0x35')]['includeAll']){_0x20844f[_0xdbda('0x43')]=[{'all':!![]}];}return db[_0xdbda('0x30')][_0xdbda('0x44')](_0x20844f);})[_0xdbda('0x28')](function(_0x5c8cf3){_0x542fed['rows']=_0x5c8cf3;return _0x542fed;})[_0xdbda('0x28')](respondWithFilteredResult(_0x10fcab,_0x20844f))[_0xdbda('0x45')](handleError(_0x10fcab,null));};exports[_0xdbda('0x46')]=function(_0x5a0d3e,_0x285176){var _0x206138={'raw':!![],'where':{'id':_0x5a0d3e[_0xdbda('0x47')]['id']}},_0x187a79={};_0x187a79['model']=_[_0xdbda('0x36')](db[_0xdbda('0x30')]['rawAttributes']);_0x187a79[_0xdbda('0x35')]=_['keys'](_0x5a0d3e[_0xdbda('0x35')]);_0x187a79[_0xdbda('0x37')]=_[_0xdbda('0x38')](_0x187a79[_0xdbda('0x48')],_0x187a79[_0xdbda('0x35')]);_0x206138['attributes']=_[_0xdbda('0x38')](_0x187a79[_0xdbda('0x48')],qs[_0xdbda('0x3a')](_0x5a0d3e['query'][_0xdbda('0x3a')]));_0x206138[_0xdbda('0x39')]=_0x206138['attributes'][_0xdbda('0x3b')]?_0x206138[_0xdbda('0x39')]:_0x187a79[_0xdbda('0x48')];if(_0x5a0d3e[_0xdbda('0x35')][_0xdbda('0x49')]){_0x206138[_0xdbda('0x43')]=[{'all':!![]}];}_0x206138=_[_0xdbda('0x41')]({},_0x206138,_0x5a0d3e[_0xdbda('0x4a')]);return db[_0xdbda('0x30')][_0xdbda('0x4b')](_0x206138)[_0xdbda('0x28')](handleEntityNotFound(_0x285176,null))[_0xdbda('0x28')](respondWithResult(_0x285176,null))['catch'](handleError(_0x285176,null));};exports[_0xdbda('0x4c')]=function(_0x335056,_0x2c6b3a){return db[_0xdbda('0x30')][_0xdbda('0x4c')](_0x335056[_0xdbda('0x4d')],{})[_0xdbda('0x28')](respondWithResult(_0x2c6b3a,0xc9))['catch'](handleError(_0x2c6b3a,null));};exports[_0xdbda('0x27')]=function(_0x26ddc4,_0x53b6e6){if(_0x26ddc4[_0xdbda('0x4d')]['id']){delete _0x26ddc4[_0xdbda('0x4d')]['id'];}return db[_0xdbda('0x30')][_0xdbda('0x4b')]({'where':{'id':_0x26ddc4['params']['id']}})[_0xdbda('0x28')](handleEntityNotFound(_0x53b6e6,null))[_0xdbda('0x28')](saveUpdates(_0x26ddc4[_0xdbda('0x4d')],null))[_0xdbda('0x28')](respondWithResult(_0x53b6e6,null))[_0xdbda('0x45')](handleError(_0x53b6e6,null));};exports[_0xdbda('0x29')]=function(_0x129f39,_0x43d203){return db['WhatsappTransferReport'][_0xdbda('0x4b')]({'where':{'id':_0x129f39[_0xdbda('0x47')]['id']}})[_0xdbda('0x28')](handleEntityNotFound(_0x43d203,null))[_0xdbda('0x28')](removeEntity(_0x43d203,null))['catch'](handleError(_0x43d203,null));};exports[_0xdbda('0x4e')]=function(_0x11381f,_0x20cf3d){return db[_0xdbda('0x30')][_0xdbda('0x4e')]()[_0xdbda('0x28')](respondWithResult(_0x20cf3d,null))[_0xdbda('0x45')](handleError(_0x20cf3d,null));}; \ No newline at end of file +var _0x9bdf=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','keys','rawAttributes','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','update','then','end','stack','name','send','index','map','WhatsappTransferReport','fieldName','type','key','model','query','filters','intersection'];(function(_0x211468,_0x12db47){var _0x14d033=function(_0x47c9ac){while(--_0x47c9ac){_0x211468['push'](_0x211468['shift']());}};_0x14d033(++_0x12db47);}(_0x9bdf,0x103));var _0xf9bd=function(_0x38d61b,_0x473677){_0x38d61b=_0x38d61b-0x0;var _0x5002ae=_0x9bdf[_0x38d61b];return _0x5002ae;};'use strict';var emlformat=require(_0xf9bd('0x0'));var rimraf=require(_0xf9bd('0x1'));var zipdir=require(_0xf9bd('0x2'));var jsonpatch=require(_0xf9bd('0x3'));var rp=require(_0xf9bd('0x4'));var moment=require(_0xf9bd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf9bd('0x6'));var util=require(_0xf9bd('0x7'));var path=require(_0xf9bd('0x8'));var sox=require(_0xf9bd('0x9'));var csv=require(_0xf9bd('0xa'));var ejs=require(_0xf9bd('0xb'));var fs=require('fs');var fs_extra=require(_0xf9bd('0xc'));var _=require(_0xf9bd('0xd'));var squel=require(_0xf9bd('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf9bd('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf9bd('0x10'));var Papa=require(_0xf9bd('0x11'));var Redis=require(_0xf9bd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf9bd('0x13'));var as=require(_0xf9bd('0x14'));var hardwareService=require(_0xf9bd('0x15'));var logger=require(_0xf9bd('0x16'))('api');var utils=require(_0xf9bd('0x17'));var config=require(_0xf9bd('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf9bd('0x19'))['db'];function respondWithStatusCode(_0x22b16e,_0x207d8c){_0x207d8c=_0x207d8c||0xcc;return function(_0x2ef718){if(_0x2ef718){return _0x22b16e[_0xf9bd('0x1a')](_0x207d8c);}return _0x22b16e['status'](_0x207d8c)['end']();};}function respondWithResult(_0x3934ba,_0x5cddee){_0x5cddee=_0x5cddee||0xc8;return function(_0xa8ede){if(_0xa8ede){return _0x3934ba['status'](_0x5cddee)[_0xf9bd('0x1b')](_0xa8ede);}};}function respondWithFilteredResult(_0x846c17,_0x41228f){return function(_0x427852){if(_0x427852){var _0x5e83c5=typeof _0x41228f['offset']===_0xf9bd('0x1c')&&typeof _0x41228f[_0xf9bd('0x1d')]===_0xf9bd('0x1c');var _0x13729f=_0x427852[_0xf9bd('0x1e')];var _0x4499c8=_0x5e83c5?0x0:_0x41228f[_0xf9bd('0x1f')];var _0x5442d5=_0x5e83c5?_0x427852[_0xf9bd('0x1e')]:_0x41228f['offset']+_0x41228f[_0xf9bd('0x1d')];var _0x240bc1;if(_0x5442d5>=_0x13729f){_0x5442d5=_0x13729f;_0x240bc1=0xc8;}else{_0x240bc1=0xce;}_0x846c17[_0xf9bd('0x20')](_0x240bc1);return _0x846c17[_0xf9bd('0x21')](_0xf9bd('0x22'),_0x4499c8+'-'+_0x5442d5+'/'+_0x13729f)[_0xf9bd('0x1b')](_0x427852);}return null;};}function patchUpdates(_0x2714f4){return function(_0x24a786){try{jsonpatch[_0xf9bd('0x23')](_0x24a786,_0x2714f4,!![]);}catch(_0x3b8074){return BPromise[_0xf9bd('0x24')](_0x3b8074);}return _0x24a786['save']();};}function saveUpdates(_0xf59f28,_0x3d0538){return function(_0x6018ca){if(_0x6018ca){return _0x6018ca[_0xf9bd('0x25')](_0xf59f28)['then'](function(_0x23ef0f){return _0x23ef0f;});}return null;};}function removeEntity(_0x790ea1,_0x3bddeb){return function(_0x25b9be){if(_0x25b9be){return _0x25b9be['destroy']()[_0xf9bd('0x26')](function(){_0x790ea1[_0xf9bd('0x20')](0xcc)[_0xf9bd('0x27')]();});}};}function handleEntityNotFound(_0x3cd2ba,_0x5ed5a5){return function(_0x19dc56){if(!_0x19dc56){_0x3cd2ba[_0xf9bd('0x1a')](0x194);}return _0x19dc56;};}function handleError(_0x438868,_0x37e282){_0x37e282=_0x37e282||0x1f4;return function(_0x43b5e9){logger['error'](_0x43b5e9[_0xf9bd('0x28')]);if(_0x43b5e9['name']){delete _0x43b5e9[_0xf9bd('0x29')];}_0x438868['status'](_0x37e282)[_0xf9bd('0x2a')](_0x43b5e9);};}exports[_0xf9bd('0x2b')]=function(_0xbcfe79,_0x5bde08){var _0x5e3eb1={},_0x2780d2={},_0xdb21d1={'count':0x0,'rows':[]};var _0x5f163d=_[_0xf9bd('0x2c')](db[_0xf9bd('0x2d')]['rawAttributes'],function(_0x27fd29){return{'name':_0x27fd29[_0xf9bd('0x2e')],'type':_0x27fd29[_0xf9bd('0x2f')][_0xf9bd('0x30')]};});_0x2780d2[_0xf9bd('0x31')]=_['map'](_0x5f163d,_0xf9bd('0x29'));_0x2780d2[_0xf9bd('0x32')]=_['keys'](_0xbcfe79[_0xf9bd('0x32')]);_0x2780d2[_0xf9bd('0x33')]=_[_0xf9bd('0x34')](_0x2780d2['model'],_0x2780d2[_0xf9bd('0x32')]);_0x5e3eb1['attributes']=_[_0xf9bd('0x34')](_0x2780d2[_0xf9bd('0x31')],qs[_0xf9bd('0x35')](_0xbcfe79[_0xf9bd('0x32')]['fields']));_0x5e3eb1[_0xf9bd('0x36')]=_0x5e3eb1[_0xf9bd('0x36')][_0xf9bd('0x37')]?_0x5e3eb1[_0xf9bd('0x36')]:_0x2780d2[_0xf9bd('0x31')];if(!_0xbcfe79[_0xf9bd('0x32')][_0xf9bd('0x38')](_0xf9bd('0x39'))){_0x5e3eb1[_0xf9bd('0x1d')]=qs[_0xf9bd('0x1d')](_0xbcfe79[_0xf9bd('0x32')][_0xf9bd('0x1d')]);_0x5e3eb1['offset']=qs['offset'](_0xbcfe79[_0xf9bd('0x32')]['offset']);}_0x5e3eb1[_0xf9bd('0x3a')]=qs[_0xf9bd('0x3b')](_0xbcfe79[_0xf9bd('0x32')][_0xf9bd('0x3b')]);_0x5e3eb1[_0xf9bd('0x3c')]=qs[_0xf9bd('0x33')](_[_0xf9bd('0x3d')](_0xbcfe79[_0xf9bd('0x32')],_0x2780d2[_0xf9bd('0x33')]),_0x5f163d);if(_0xbcfe79[_0xf9bd('0x32')]['filter']){_0x5e3eb1[_0xf9bd('0x3c')]=_['merge'](_0x5e3eb1[_0xf9bd('0x3c')],{'$or':_['map'](_0x5f163d,function(_0xe3ff29){if(_0xe3ff29['type']!==_0xf9bd('0x3e')){var _0x3b6f94={};_0x3b6f94[_0xe3ff29[_0xf9bd('0x29')]]={'$like':'%'+_0xbcfe79['query'][_0xf9bd('0x3f')]+'%'};return _0x3b6f94;}})});}_0x5e3eb1=_[_0xf9bd('0x40')]({},_0x5e3eb1,_0xbcfe79[_0xf9bd('0x41')]);var _0x62bc52={'where':_0x5e3eb1['where']};return db['WhatsappTransferReport'][_0xf9bd('0x1e')](_0x62bc52)['then'](function(_0x7db71){_0xdb21d1[_0xf9bd('0x1e')]=_0x7db71;if(_0xbcfe79[_0xf9bd('0x32')][_0xf9bd('0x42')]){_0x5e3eb1[_0xf9bd('0x43')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x5e3eb1);})[_0xf9bd('0x26')](function(_0x482681){_0xdb21d1[_0xf9bd('0x44')]=_0x482681;return _0xdb21d1;})[_0xf9bd('0x26')](respondWithFilteredResult(_0x5bde08,_0x5e3eb1))[_0xf9bd('0x45')](handleError(_0x5bde08,null));};exports['show']=function(_0x5c540b,_0x3fa2b8){var _0x57906c={'raw':!![],'where':{'id':_0x5c540b['params']['id']}},_0x21e22d={};_0x21e22d[_0xf9bd('0x31')]=_[_0xf9bd('0x46')](db['WhatsappTransferReport'][_0xf9bd('0x47')]);_0x21e22d['query']=_[_0xf9bd('0x46')](_0x5c540b[_0xf9bd('0x32')]);_0x21e22d[_0xf9bd('0x33')]=_[_0xf9bd('0x34')](_0x21e22d[_0xf9bd('0x31')],_0x21e22d['query']);_0x57906c[_0xf9bd('0x36')]=_['intersection'](_0x21e22d[_0xf9bd('0x31')],qs['fields'](_0x5c540b[_0xf9bd('0x32')][_0xf9bd('0x35')]));_0x57906c[_0xf9bd('0x36')]=_0x57906c[_0xf9bd('0x36')]['length']?_0x57906c[_0xf9bd('0x36')]:_0x21e22d['model'];if(_0x5c540b[_0xf9bd('0x32')][_0xf9bd('0x42')]){_0x57906c[_0xf9bd('0x43')]=[{'all':!![]}];}_0x57906c=_['merge']({},_0x57906c,_0x5c540b[_0xf9bd('0x41')]);return db[_0xf9bd('0x2d')][_0xf9bd('0x48')](_0x57906c)[_0xf9bd('0x26')](handleEntityNotFound(_0x3fa2b8,null))[_0xf9bd('0x26')](respondWithResult(_0x3fa2b8,null))[_0xf9bd('0x45')](handleError(_0x3fa2b8,null));};exports['create']=function(_0xc72b26,_0x2f254d){return db[_0xf9bd('0x2d')][_0xf9bd('0x49')](_0xc72b26[_0xf9bd('0x4a')],{})['then'](respondWithResult(_0x2f254d,0xc9))['catch'](handleError(_0x2f254d,null));};exports[_0xf9bd('0x25')]=function(_0x45ae13,_0x12cf38){if(_0x45ae13[_0xf9bd('0x4a')]['id']){delete _0x45ae13['body']['id'];}return db[_0xf9bd('0x2d')][_0xf9bd('0x48')]({'where':{'id':_0x45ae13[_0xf9bd('0x4b')]['id']}})[_0xf9bd('0x26')](handleEntityNotFound(_0x12cf38,null))[_0xf9bd('0x26')](saveUpdates(_0x45ae13[_0xf9bd('0x4a')],null))[_0xf9bd('0x26')](respondWithResult(_0x12cf38,null))['catch'](handleError(_0x12cf38,null));};exports[_0xf9bd('0x4c')]=function(_0x1163f2,_0x2943d8){return db[_0xf9bd('0x2d')][_0xf9bd('0x48')]({'where':{'id':_0x1163f2['params']['id']}})[_0xf9bd('0x26')](handleEntityNotFound(_0x2943d8,null))[_0xf9bd('0x26')](removeEntity(_0x2943d8,null))[_0xf9bd('0x45')](handleError(_0x2943d8,null));};exports[_0xf9bd('0x4d')]=function(_0x3a2bc5,_0x18976){return db[_0xf9bd('0x2d')][_0xf9bd('0x4d')]()[_0xf9bd('0x26')](respondWithResult(_0x18976,null))[_0xf9bd('0x45')](handleError(_0x18976,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 92350d3..9600e1d 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 _0xfe4d=['uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x14e9b4,_0xf0b994){var _0x66ea08=function(_0x23abd9){while(--_0x23abd9){_0x14e9b4['push'](_0x14e9b4['shift']());}};_0x66ea08(++_0xf0b994);}(_0xfe4d,0x1c9));var _0xdfe4=function(_0x348681,_0x486a1d){_0x348681=_0x348681-0x0;var _0x30d4b7=_0xfe4d[_0x348681];return _0x30d4b7;};'use strict';var _=require('lodash');var util=require(_0xdfe4('0x0'));var logger=require(_0xdfe4('0x1'))('api');var moment=require(_0xdfe4('0x2'));var BPromise=require(_0xdfe4('0x3'));var rp=require(_0xdfe4('0x4'));var fs=require('fs');var path=require(_0xdfe4('0x5'));var rimraf=require(_0xdfe4('0x6'));var config=require(_0xdfe4('0x7'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x3a995c,_0x3673e6){return _0x3a995c[_0xdfe4('0x8')](_0xdfe4('0x9'),attributes,{'tableName':_0xdfe4('0xa'),'paranoid':![],'indexes':[{'name':_0xdfe4('0xb'),'fields':[_0xdfe4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcc77=['bluebird','request-promise','path','rimraf','../../config/environment','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x2a6754,_0x277259){var _0x17feda=function(_0x5745be){while(--_0x5745be){_0x2a6754['push'](_0x2a6754['shift']());}};_0x17feda(++_0x277259);}(_0xcc77,0xa1));var _0x7cc7=function(_0x3ec39a,_0xad387b){_0x3ec39a=_0x3ec39a-0x0;var _0x1e9665=_0xcc77[_0x3ec39a];return _0x1e9665;};'use strict';var _=require(_0x7cc7('0x0'));var util=require(_0x7cc7('0x1'));var logger=require(_0x7cc7('0x2'))('api');var moment=require(_0x7cc7('0x3'));var BPromise=require(_0x7cc7('0x4'));var rp=require(_0x7cc7('0x5'));var fs=require('fs');var path=require(_0x7cc7('0x6'));var rimraf=require(_0x7cc7('0x7'));var config=require(_0x7cc7('0x8'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x880640,_0x121b0c){return _0x880640['define'](_0x7cc7('0x9'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x7cc7('0xa'),'fields':[_0x7cc7('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index f41c945..2820665 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 _0x72c8=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','code','error','WhatsappTransferReport,\x20%s,\x20%s','message','result'];(function(_0x16a637,_0x5eb627){var _0x25126d=function(_0x54e016){while(--_0x54e016){_0x16a637['push'](_0x16a637['shift']());}};_0x25126d(++_0x5eb627);}(_0x72c8,0x1e1));var _0x872c=function(_0x4b758b,_0x219b46){_0x4b758b=_0x4b758b-0x0;var _0x588db5=_0x72c8[_0x4b758b];return _0x588db5;};'use strict';var _=require(_0x872c('0x0'));var util=require(_0x872c('0x1'));var moment=require(_0x872c('0x2'));var BPromise=require(_0x872c('0x3'));var rs=require(_0x872c('0x4'));var fs=require('fs');var Redis=require(_0x872c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x872c('0x6'));var logger=require(_0x872c('0x7'))(_0x872c('0x8'));var config=require(_0x872c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x872c('0xa')][_0x872c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b09e7,_0x31cd22,_0x2a29bc){return new BPromise(function(_0x5efa09,_0xd8b77f){return client[_0x872c('0xc')](_0x4b09e7,_0x2a29bc)[_0x872c('0xd')](function(_0x58c46f){logger[_0x872c('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x31cd22,_0x872c('0xf'));logger[_0x872c('0x10')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x31cd22,'request\x20sent',JSON[_0x872c('0x11')](_0x58c46f));if(_0x58c46f['error']){if(_0x58c46f['error'][_0x872c('0x12')]===0x1f4){logger[_0x872c('0x13')](_0x872c('0x14'),_0x31cd22,_0x58c46f[_0x872c('0x13')][_0x872c('0x15')]);return _0xd8b77f(_0x58c46f[_0x872c('0x13')][_0x872c('0x15')]);}logger[_0x872c('0x13')](_0x872c('0x14'),_0x31cd22,_0x58c46f['error'][_0x872c('0x15')]);return _0x5efa09(_0x58c46f['error']['message']);}else{logger[_0x872c('0xe')](_0x872c('0x14'),_0x31cd22,'request\x20sent');_0x5efa09(_0x58c46f[_0x872c('0x16')]['message']);}})[_0x872c('0x17')](function(_0x44409b){logger[_0x872c('0x13')](_0x872c('0x14'),_0x31cd22,_0x44409b);_0xd8b77f(_0x44409b);});});} \ No newline at end of file +var _0x8b97=['message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1f9f5f,_0x509fb7){var _0x51d649=function(_0x4a5285){while(--_0x4a5285){_0x1f9f5f['push'](_0x1f9f5f['shift']());}};_0x51d649(++_0x509fb7);}(_0x8b97,0x12d));var _0x78b9=function(_0x1fc361,_0x32ca03){_0x1fc361=_0x1fc361-0x0;var _0x20807f=_0x8b97[_0x1fc361];return _0x20807f;};'use strict';var _=require(_0x78b9('0x0'));var util=require(_0x78b9('0x1'));var moment=require(_0x78b9('0x2'));var BPromise=require(_0x78b9('0x3'));var rs=require(_0x78b9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x78b9('0x5'));var logger=require(_0x78b9('0x6'))(_0x78b9('0x7'));var config=require(_0x78b9('0x8'));var jayson=require(_0x78b9('0x9'));var client=jayson[_0x78b9('0xa')][_0x78b9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x274d82,_0x13927c,_0x73234b){return new BPromise(function(_0x47c530,_0x1f0ecd){return client[_0x78b9('0xc')](_0x274d82,_0x73234b)[_0x78b9('0xd')](function(_0x4ab4b0){logger[_0x78b9('0xe')](_0x78b9('0xf'),_0x13927c,_0x78b9('0x10'));logger['debug'](_0x78b9('0x11'),_0x13927c,'request\x20sent',JSON[_0x78b9('0x12')](_0x4ab4b0));if(_0x4ab4b0[_0x78b9('0x13')]){if(_0x4ab4b0[_0x78b9('0x13')][_0x78b9('0x14')]===0x1f4){logger[_0x78b9('0x13')](_0x78b9('0xf'),_0x13927c,_0x4ab4b0[_0x78b9('0x13')][_0x78b9('0x15')]);return _0x1f0ecd(_0x4ab4b0[_0x78b9('0x13')][_0x78b9('0x15')]);}logger[_0x78b9('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x13927c,_0x4ab4b0[_0x78b9('0x13')][_0x78b9('0x15')]);return _0x47c530(_0x4ab4b0[_0x78b9('0x13')][_0x78b9('0x15')]);}else{logger['info'](_0x78b9('0xf'),_0x13927c,_0x78b9('0x10'));_0x47c530(_0x4ab4b0[_0x78b9('0x16')]['message']);}})['catch'](function(_0x184c2f){logger['error'](_0x78b9('0xf'),_0x13927c,_0x184c2f);_0x1f0ecd(_0x184c2f);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 27482f6..99d24e4 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa74a=['app','./config/pm2','./config/pm2/config','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','seedDB','then','listen','start','info','filter','exitCode','\x20processes\x20failed\x20at\x20startup:\x20','map','name','Online\x20apps:','join','Offline\x20apps:','status','online','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'];(function(_0x39d908,_0x47677b){var _0x4376c4=function(_0x381271){while(--_0x381271){_0x39d908['push'](_0x39d908['shift']());}};_0x4376c4(++_0x47677b);}(_0xa74a,0x66));var _0xaa74=function(_0x2037a8,_0x2d7d36){_0x2037a8=_0x2037a8-0x0;var _0x27bd43=_0xa74a[_0x2037a8];return _0x27bd43;};'use strict';var _=require(_0xaa74('0x0'));var db=require(_0xaa74('0x1'))['db'];var seedDb=require(_0xaa74('0x2'));var checkLicense=require(_0xaa74('0x3'));var rpc=require(_0xaa74('0x4'));var config=require(_0xaa74('0x5'));var logger=require('./config/logger')(_0xaa74('0x6'));var pm2=require(_0xaa74('0x7'));var pm2Config=require(_0xaa74('0x8'));var schedule=require('./config/schedule');var chat=require('./config/schedule/chat');var whatsapp=require(_0xaa74('0x9'));var transcribe=require(_0xaa74('0xa'));var provider=require(_0xaa74('0xb'));function main(){return db[_0xaa74('0xc')][_0xaa74('0xd')]()['then'](function(){if(config[_0xaa74('0xe')]){return seedDb['default']();}})[_0xaa74('0xf')](function(){return checkLicense['default']();})[_0xaa74('0xf')](function(){return rpc[_0xaa74('0x10')]();})['then'](function(_0x45fb8b){logger['info'](_0x45fb8b);return chat[_0xaa74('0x11')]();})[_0xaa74('0xf')](function(){return whatsapp['start']();})[_0xaa74('0xf')](function(){return schedule[_0xaa74('0x11')]();})[_0xaa74('0xf')](function(){return transcribe[_0xaa74('0x11')]();})[_0xaa74('0xf')](function(){return provider[_0xaa74('0x11')]();})[_0xaa74('0xf')](function(_0x1d38b3){logger[_0xaa74('0x12')](_0x1d38b3);return pm2[_0xaa74('0x11')](pm2Config);})[_0xaa74('0xf')](function(_0x4e2f4a){var _0x283ee1=_0x4e2f4a[_0xaa74('0x13')](function(_0x545064){return typeof _0x545064[_0xaa74('0x14')]==='number'&&_0x545064['exitCode']>=0x0;});if(_0x283ee1['length']>0x0){throw new Error(_0x283ee1['length']+_0xaa74('0x15')+_[_0xaa74('0x16')](_0x283ee1,function(_0x3d9b94){return'\x22'+_0x3d9b94['pm2_env'][_0xaa74('0x17')]+'\x22';}));}logger[_0xaa74('0x12')](_0xaa74('0x18'),_['map'](_['filter'](_0x4e2f4a,{'status':'online'}),'name')[_0xaa74('0x19')]());logger[_0xaa74('0x12')](_0xaa74('0x1a'),_[_0xaa74('0x16')](_[_0xaa74('0x13')](_0x4e2f4a,function(_0x2b1d10){return _0x2b1d10[_0xaa74('0x1b')]!==_0xaa74('0x1c');}),'name')[_0xaa74('0x19')]()||_0xaa74('0x1d'));console[_0xaa74('0x1e')](_0xaa74('0x1f'));})[_0xaa74('0x20')](function(_0xb718){console[_0xaa74('0x1e')](_0xaa74('0x21'),_0xb718);logger[_0xaa74('0x22')](_0xaa74('0x23'),_0xb718);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x2bd8=['listen','info','start','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','filter','online','Offline\x20apps:','status','join','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','default'];(function(_0x526b9b,_0x20b1e7){var _0x43bded=function(_0x4faade){while(--_0x4faade){_0x526b9b['push'](_0x526b9b['shift']());}};_0x43bded(++_0x20b1e7);}(_0x2bd8,0x130));var _0x82bd=function(_0x1515ef,_0xe5df84){_0x1515ef=_0x1515ef-0x0;var _0x35d1b9=_0x2bd8[_0x1515ef];return _0x35d1b9;};'use strict';var _=require(_0x82bd('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x82bd('0x1'));var checkLicense=require(_0x82bd('0x2'));var rpc=require(_0x82bd('0x3'));var config=require(_0x82bd('0x4'));var logger=require(_0x82bd('0x5'))(_0x82bd('0x6'));var pm2=require(_0x82bd('0x7'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x82bd('0x8'));var chat=require(_0x82bd('0x9'));var whatsapp=require(_0x82bd('0xa'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x82bd('0xb'));function main(){return db[_0x82bd('0xc')][_0x82bd('0xd')]()[_0x82bd('0xe')](function(){if(config['seedDB']){return seedDb[_0x82bd('0xf')]();}})['then'](function(){return checkLicense['default']();})['then'](function(){return rpc[_0x82bd('0x10')]();})['then'](function(_0x4c9430){logger[_0x82bd('0x11')](_0x4c9430);return chat['start']();})['then'](function(){return whatsapp[_0x82bd('0x12')]();})[_0x82bd('0xe')](function(){return schedule['start']();})[_0x82bd('0xe')](function(){return transcribe['start']();})[_0x82bd('0xe')](function(){return provider['start']();})[_0x82bd('0xe')](function(_0x3c4042){logger[_0x82bd('0x11')](_0x3c4042);return pm2[_0x82bd('0x12')](pm2Config);})['then'](function(_0x446ffc){var _0xd43e79=_0x446ffc['filter'](function(_0x3667ef){return typeof _0x3667ef['exitCode']===_0x82bd('0x13')&&_0x3667ef[_0x82bd('0x14')]>=0x0;});if(_0xd43e79[_0x82bd('0x15')]>0x0){throw new Error(_0xd43e79[_0x82bd('0x15')]+_0x82bd('0x16')+_[_0x82bd('0x17')](_0xd43e79,function(_0x387d21){return'\x22'+_0x387d21[_0x82bd('0x18')][_0x82bd('0x19')]+'\x22';}));}logger[_0x82bd('0x11')](_0x82bd('0x1a'),_[_0x82bd('0x17')](_[_0x82bd('0x1b')](_0x446ffc,{'status':_0x82bd('0x1c')}),'name')['join']());logger[_0x82bd('0x11')](_0x82bd('0x1d'),_[_0x82bd('0x17')](_[_0x82bd('0x1b')](_0x446ffc,function(_0x34899b){return _0x34899b[_0x82bd('0x1e')]!==_0x82bd('0x1c');}),_0x82bd('0x19'))[_0x82bd('0x1f')]()||_0x82bd('0x20'));console[_0x82bd('0x21')](_0x82bd('0x22'));})[_0x82bd('0x23')](function(_0x3260c4){console[_0x82bd('0x21')](_0x82bd('0x24'),_0x3260c4);logger[_0x82bd('0x25')](_0x82bd('0x26'),_0x3260c4);process[_0x82bd('0x27')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 03f5030..b6c2da1 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 _0x8bca=['payload','options','randomBytes','toString','now','HS512','../../config/environment','../../config/license/util','lodash','jsonwebtoken','crypto','bluebird','util','moment','secrets','session','role','fullname','email','userpic','permissions','md5secret','faxPause','smsPause','openchannelPause','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','closed','forceDownload','status','disposition','unmanaged','Unmanaged.','Forbidden.','catch','use','headers','authorization','Basic','find','name','then','authenticate','pass','Bearer','json','Unknown\x20authorization\x20format','apikey','getUuid','User','Setting','blockDuration','isEqual','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isMiddleware','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send','retrieveApiKey','apiKeyNonce','isNil','apiKeyIat','regenerateApiKey','query','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','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','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','encryptString','promisify','sign','secret'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8bca,0x192));var _0xa8bc=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x8bca[_0x243b59];return _0x3e1676;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xa8bc('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xa8bc('0x1'));var encryptor=require('../encryptor');var _=require(_0xa8bc('0x2'));var jwt=require(_0xa8bc('0x3'));var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require(_0xa8bc('0x4'));var BPromise=require(_0xa8bc('0x5'));var util=require(_0xa8bc('0x6'));var moment=require(_0xa8bc('0x7'));var validateJwt=expressJwt({'secret':config[_0xa8bc('0x8')][_0xa8bc('0x9')]});var userAttributes=['id',_0xa8bc('0xa'),_0xa8bc('0xb'),'name','internal',_0xa8bc('0xc'),_0xa8bc('0xd'),_0xa8bc('0xe'),_0xa8bc('0xf'),'voicePause','chatPause','mailPause',_0xa8bc('0x10'),_0xa8bc('0x11'),_0xa8bc('0x12'),'pauseType',_0xa8bc('0x13'),'lastLoginAt',_0xa8bc('0x14'),_0xa8bc('0x15'),_0xa8bc('0x16'),_0xa8bc('0x17'),_0xa8bc('0x18'),_0xa8bc('0x19'),_0xa8bc('0x1a'),_0xa8bc('0x1b'),_0xa8bc('0x1c'),_0xa8bc('0x1d'),'phoneBarEnableSettings',_0xa8bc('0x1e'),_0xa8bc('0x1f'),_0xa8bc('0x20'),'phoneBarRemoteControlPort',_0xa8bc('0x21'),_0xa8bc('0x22'),_0xa8bc('0x23'),_0xa8bc('0x24'),'settingsEnabled',_0xa8bc('0x25'),_0xa8bc('0x26'),_0xa8bc('0x27'),_0xa8bc('0x28'),_0xa8bc('0x29'),_0xa8bc('0x2a'),_0xa8bc('0x2b'),_0xa8bc('0x2c'),_0xa8bc('0x2d'),'emailAutoanswerDelay',_0xa8bc('0x2e'),_0xa8bc('0x2f'),_0xa8bc('0x30'),_0xa8bc('0x31'),'faxAutoanswer',_0xa8bc('0x32'),_0xa8bc('0x33'),_0xa8bc('0x34'),_0xa8bc('0x35')];exports[_0xa8bc('0x36')]=function(){return this[_0xa8bc('0x37')](!![])['use'](function(_0x1d2e09,_0x1f063a,_0x4b2a42){if(_0x1d2e09[_0xa8bc('0x38')]){_0x4b2a42();}else{return db[_0xa8bc('0x39')][_0xa8bc('0x3a')]({'where':{'id':_0x1d2e09[_0xa8bc('0x3b')]['id']},'attributes':['id',_0xa8bc('0x3c'),'disposition'],'raw':!![]})['then'](function(_0x2b4044){if(_0x2b4044&&_0x2b4044[_0xa8bc('0x3c')]&&!_0x1d2e09['query'][_0xa8bc('0x3d')]){return _0x1f063a[_0xa8bc('0x3e')](_0x2b4044[_0xa8bc('0x3f')]==='unmanaged'?0x195:0x193)['json']({'message':_0x2b4044[_0xa8bc('0x3f')]===_0xa8bc('0x40')?_0xa8bc('0x41'):_0xa8bc('0x42')});}else{_0x4b2a42();}})[_0xa8bc('0x43')](function(_0x2826af){_0x4b2a42(_0x2826af);});}});};exports[_0xa8bc('0x37')]=function isAuthenticated(_0x374243){return compose()[_0xa8bc('0x44')](function(_0x93e6fc,_0x737887,_0x564387){var _0x3e60d6;if(_0x93e6fc[_0xa8bc('0x45')][_0xa8bc('0x46')]){if(_['startsWith'](_0x93e6fc['headers'][_0xa8bc('0x46')],_0xa8bc('0x47'))){var _0x54270c=basicAuth(_0x93e6fc);db['User'][_0xa8bc('0x48')]({'where':{'name':_0x54270c[_0xa8bc('0x49')]}})[_0xa8bc('0x4a')](function(_0x45c053){if(!_0x45c053||!_0x45c053[_0xa8bc('0x4b')](_0x54270c[_0xa8bc('0x4c')])){return _0x737887[_0xa8bc('0x3e')](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x93e6fc['user']={'id':_0x45c053['id']};_0x564387();})[_0xa8bc('0x43')](function(_0x51ac53){_0x564387(_0x51ac53);});}else if(_['startsWith'](_0x93e6fc[_0xa8bc('0x45')][_0xa8bc('0x46')],_0xa8bc('0x4d'))){validateJwt(_0x93e6fc,_0x737887,_0x564387);}else{if(_0x374243){_0x564387();}else{return _0x737887[_0xa8bc('0x3e')](0x193)[_0xa8bc('0x4e')]({'message':_0xa8bc('0x4f')});}}}else if(_0x93e6fc['query'][_0xa8bc('0x50')]){try{var _0x3e76ac={'audience':hardwareConf[_0xa8bc('0x51')](),'issuer':hardwareConf[_0xa8bc('0x51')]()};verifyJwt(_0x93e6fc['query'][_0xa8bc('0x50')],_0x3e76ac)[_0xa8bc('0x4a')](function(_0x5b4dac){return db[_0xa8bc('0x52')][_0xa8bc('0x48')]({'where':{'id':_0x5b4dac['sub']}})[_0xa8bc('0x4a')](function(_0x2399b3){_0x3e60d6=_0x2399b3;return db[_0xa8bc('0x53')][_0xa8bc('0x3a')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xa8bc('0x54')],'raw':!![]});})[_0xa8bc('0x4a')](function(_0x24daab){if(!_0x3e60d6||!_[_0xa8bc('0x55')](_0x3e60d6['apiKeyNonce'],_0x5b4dac[_0xa8bc('0x56')])){return _0x737887[_0xa8bc('0x3e')](0x191)[_0xa8bc('0x4e')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x3e60d6[_0xa8bc('0x57')]){return _0x737887[_0xa8bc('0x3e')](0x191)[_0xa8bc('0x4e')]({'message':_0xa8bc('0x58')});}if(_0x3e60d6[_0xa8bc('0x59')]){if(_0x24daab[_0xa8bc('0x54')]>0x0){if(moment(_0x3e60d6[_0xa8bc('0x5a')])['add'](_0x24daab['blockDuration'],_0xa8bc('0x5b'))>moment()){return _0x737887[_0xa8bc('0x3e')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x737887[_0xa8bc('0x3e')](0x191)[_0xa8bc('0x4e')]({'message':_0xa8bc('0x58')});}}_0x93e6fc[_0xa8bc('0x38')]={'id':_0x3e60d6['id']};_0x564387();});})[_0xa8bc('0x43')](function(){return _0x737887[_0xa8bc('0x3e')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1fe094){_0x564387(_0x1fe094);}}else if(_0x374243){_0x564387();}else{return _0x737887['status'](0x193)['json']({'message':_0xa8bc('0x4f')});}})[_0xa8bc('0x44')](function(_0x255395,_0x3e5f0d,_0x2a3205){if(_0x255395['user']){db[_0xa8bc('0x52')][_0xa8bc('0x48')]({'where':{'id':_0x255395[_0xa8bc('0x38')]['id']},'attributes':userAttributes})[_0xa8bc('0x4a')](function(_0x10b84b){if(!_0x10b84b){return _0x3e5f0d[_0xa8bc('0x3e')](0x194)[_0xa8bc('0x4e')]({'message':_0xa8bc('0x5c')});}_0x255395[_0xa8bc('0x38')]=_0x10b84b;_0x2a3205();})[_0xa8bc('0x43')](function(_0x5b8c05){_0x2a3205(_0x5b8c05);});}else if(_0x374243){_0x2a3205();}else{return _0x3e5f0d['status'](0x194)[_0xa8bc('0x4e')]({'message':_0xa8bc('0x5d')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xa8bc('0x44')](function(_0x8d57d2,_0x425ad0,_0x4a9eb5){return licenseUtil[_0xa8bc('0x5e')]()[_0xa8bc('0x4a')](function(_0x5cbc14){if(_0x5cbc14[_0xa8bc('0x5f')]){_0x4a9eb5();}else{return _0x425ad0[_0xa8bc('0x3e')](0x193)[_0xa8bc('0x4e')]({'message':_0xa8bc('0x60')});}})[_0xa8bc('0x43')](function(_0xc6ecc4){_0x4a9eb5(_0xc6ecc4);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0xa8bc('0x44')](function(_0x425ee1,_0x3222cd,_0x2b77ef){return licenseUtil[_0xa8bc('0x5e')]()['then'](function(_0x1c6fcb){if(_0x1c6fcb['webrtc']){_0x2b77ef();}else{return _0x3222cd[_0xa8bc('0x3e')](0x193)[_0xa8bc('0x4e')]({'message':'Forbidden'});}})[_0xa8bc('0x43')](function(_0x8f4258){_0x2b77ef(_0x8f4258);});});};exports['isMiddleware']=function(_0x5656d2,_0xfe5cdd,_0x34caad){_0x5656d2[_0xa8bc('0x61')]=!![];return _0x34caad();};exports['signToken']=function signToken(_0x9fe404){return signJwt(_0x9fe404);};exports['setTokenCookie']=function(_0x3ca9e1,_0xb19a61){if(!_0x3ca9e1[_0xa8bc('0x38')]){return _0xb19a61[_0xa8bc('0x3e')](0x194)[_0xa8bc('0x4e')]({'message':_0xa8bc('0x62')});}var _0x1952dd={'payload':{'id':_0x3ca9e1['user']['id'],'role':_0x3ca9e1['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x1952dd)[_0xa8bc('0x4a')](function(_0x540d1c){_0xb19a61[_0xa8bc('0x63')](_0xa8bc('0x64'),_0x540d1c);_0xb19a61['redirect'](_0xa8bc('0x65'));})[_0xa8bc('0x43')](function(_0x48ec8d){return _0xb19a61[_0xa8bc('0x3e')](0x1f4)[_0xa8bc('0x66')](_0x48ec8d);});};exports[_0xa8bc('0x67')]=function(_0x14e8e9){if(_['isNil'](_0x14e8e9[_0xa8bc('0x68')])||_[_0xa8bc('0x69')](_0x14e8e9[_0xa8bc('0x6a')])){return null;}else{return createJwt(_0x14e8e9);}};exports['generateApiKey']=function(_0x423f2e){_0x423f2e[_0xa8bc('0x68')]=generateNonce();_0x423f2e[_0xa8bc('0x6a')]=generateIssuedAt();return createJwt(_0x423f2e);};exports[_0xa8bc('0x6b')]=function(_0x51a9e9,_0x4dc3fb){var _0x8338=_0x51a9e9[_0xa8bc('0x6c')][_0xa8bc('0x50')];if(_0x8338){var _0x1d9786={'nonce':_0x4dc3fb['apiKeyNonce'],'iat':_0x4dc3fb[_0xa8bc('0x6a')],'audience':hardwareConf[_0xa8bc('0x51')](),'issuer':hardwareConf[_0xa8bc('0x51')]()};return verifyJwt(_0x8338,_0x1d9786)[_0xa8bc('0x4a')](function(){return generateApiKey(_0x4dc3fb);});}else{throw{'message':_0xa8bc('0x6d')};}};exports[_0xa8bc('0x6e')]=function(_0x1303df){var _0xef5582=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xef5582[_0xa8bc('0x6f')](_0x1303df))throw new db[(_0xa8bc('0x70'))][(_0xa8bc('0x71'))](_0xa8bc('0x72'));return;};exports['validatePasswordHistory']=function(_0x250fe7,_0x8072eb,_0x18f36c){var _0x11ad3b=encryptor[_0xa8bc('0x73')](_0x8072eb)['split'](',');for(var _0x188814=0x0;_0x188814<_0x18f36c;_0x188814++){if(!_0x11ad3b[_0x188814])break;if(_0x250fe7[_0xa8bc('0x74')]()===_0x11ad3b[_0x188814][_0xa8bc('0x74')]()){var _0x39773a=util[_0xa8bc('0x75')](_0xa8bc('0x76'),_0x18f36c);if(_0x18f36c===0x1){_0x39773a='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xa8bc('0x70'))][(_0xa8bc('0x71'))](_0x39773a);}}return;};exports[_0xa8bc('0x77')]=function(_0x46d67e,_0x5bb97d){var _0x547c30=_0x5bb97d?encryptor[_0xa8bc('0x73')](_0x5bb97d)[_0xa8bc('0x78')](','):[];if(_0x547c30[_0xa8bc('0x79')]===0x5){_0x547c30['splice'](-0x1,0x1);}_0x547c30['unshift'](_0x46d67e);return encryptor[_0xa8bc('0x7a')](_0x547c30['join'](','));};function signJwt(_0x5b747f){var _0x431085=BPromise[_0xa8bc('0x7b')](jwt[_0xa8bc('0x7c')],{'context':jwt});var _0x5b6752=_0x5b747f[_0xa8bc('0x7d')]||config['secrets']['session'];return new BPromise(function(_0x3ad73c,_0x4e6fe8){_0x431085(_0x5b747f[_0xa8bc('0x7e')],_0x5b6752,_0x5b747f[_0xa8bc('0x7f')])[_0xa8bc('0x4a')](function(_0x16754f){_0x3ad73c(_0x16754f);})['catch'](function(_0x4626dd){_0x4e6fe8(_0x4626dd);});});}function verifyJwt(_0x4bed54,_0x2972b5,_0x190530){var _0x34a4fe=BPromise[_0xa8bc('0x7b')](jwt['verify'],{'context':jwt});var _0x49ac0c=_0x190530||config['secrets']['session'];return new BPromise(function(_0x2c1079,_0x1047da){_0x34a4fe(_0x4bed54,_0x49ac0c,_0x2972b5)[_0xa8bc('0x4a')](function(_0x40234f){_0x2c1079(_0x40234f);})[_0xa8bc('0x43')](function(_0x4887a6){_0x1047da(_0x4887a6);});});}function generateNonce(){return crypto[_0xa8bc('0x80')](0x10)[_0xa8bc('0x81')]('hex');}function generateIssuedAt(){return Math['floor'](Date[_0xa8bc('0x82')]()/0x3e8)[_0xa8bc('0x81')]();}function createJwt(_0x1f0469){var _0x236cba={'payload':{'iat':_0x1f0469[_0xa8bc('0x6a')],'nonce':_0x1f0469[_0xa8bc('0x68')]},'options':{'algorithm':_0xa8bc('0x83'),'subject':_0x1f0469['id'][_0xa8bc('0x81')](),'issuer':hardwareConf[_0xa8bc('0x51')](),'audience':hardwareConf[_0xa8bc('0x51')]()}};return signJwt(_0x236cba)[_0xa8bc('0x4a')](function(_0x11d703){return{'iat':_0x1f0469['apiKeyIat'],'nonce':_0x1f0469[_0xa8bc('0x68')],'token':_0x11d703};});} \ No newline at end of file +var _0x514b=['downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','closed','disposition','then','query','forceDownload','status','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','Basic','User','name','authenticate','pass','startsWith','Unknown\x20authorization\x20format','apikey','getUuid','sub','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','find','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','splice','unshift','encryptString','join','promisify','sign','secret','session','payload','options','verify','randomBytes','hex','floor','now','toString','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','basic-auth','bluebird','util','secrets','role','fullname','internal','email','userpic','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions'];(function(_0x1aad88,_0x551794){var _0x1bbfe9=function(_0x1636ed){while(--_0x1636ed){_0x1aad88['push'](_0x1aad88['shift']());}};_0x1bbfe9(++_0x551794);}(_0x514b,0x6a));var _0xb514=function(_0xcfe83a,_0x594c1d){_0xcfe83a=_0xcfe83a-0x0;var _0x325e1c=_0x514b[_0xcfe83a];return _0x325e1c;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xb514('0x0'));var hardwareConf=require(_0xb514('0x1'));var licenseUtil=require(_0xb514('0x2'));var encryptor=require(_0xb514('0x3'));var _=require('lodash');var jwt=require(_0xb514('0x4'));var expressJwt=require(_0xb514('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0xb514('0x6'));var crypto=require('crypto');var BPromise=require(_0xb514('0x7'));var util=require(_0xb514('0x8'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xb514('0x9')]['session']});var userAttributes=['id',_0xb514('0xa'),_0xb514('0xb'),'name',_0xb514('0xc'),_0xb514('0xd'),_0xb514('0xe'),_0xb514('0xf'),_0xb514('0x10'),_0xb514('0x11'),_0xb514('0x12'),'mailPause',_0xb514('0x13'),_0xb514('0x14'),'openchannelPause','pauseType',_0xb514('0x15'),_0xb514('0x16'),_0xb514('0x17'),_0xb514('0x18'),'allowmessenger',_0xb514('0x19'),'alias','phoneBarAutoAnswer',_0xb514('0x1a'),_0xb514('0x1b'),_0xb514('0x1c'),_0xb514('0x1d'),_0xb514('0x1e'),_0xb514('0x1f'),_0xb514('0x20'),_0xb514('0x21'),_0xb514('0x22'),'hotdesk',_0xb514('0x23'),_0xb514('0x24'),_0xb514('0x25'),_0xb514('0x26'),_0xb514('0x27'),_0xb514('0x28'),_0xb514('0x29'),_0xb514('0x2a'),_0xb514('0x2b'),_0xb514('0x2c'),_0xb514('0x2d'),'chatAutoanswerDelay',_0xb514('0x2e'),_0xb514('0x2f'),_0xb514('0x30'),_0xb514('0x31'),_0xb514('0x32'),_0xb514('0x33'),'faxAutoanswer',_0xb514('0x34'),_0xb514('0x35'),_0xb514('0x36'),_0xb514('0x37')];exports[_0xb514('0x38')]=function(){return this[_0xb514('0x39')](!![])[_0xb514('0x3a')](function(_0x3f7894,_0xfa3dee,_0x12aab9){if(_0x3f7894[_0xb514('0x3b')]){_0x12aab9();}else{return db['ChatInteraction'][_0xb514('0x3c')]({'where':{'id':_0x3f7894[_0xb514('0x3d')]['id']},'attributes':['id',_0xb514('0x3e'),_0xb514('0x3f')],'raw':!![]})[_0xb514('0x40')](function(_0x1da250){if(_0x1da250&&_0x1da250[_0xb514('0x3e')]&&!_0x3f7894[_0xb514('0x41')][_0xb514('0x42')]){return _0xfa3dee[_0xb514('0x43')](_0x1da250[_0xb514('0x3f')]===_0xb514('0x44')?0x195:0x193)[_0xb514('0x45')]({'message':_0x1da250['disposition']===_0xb514('0x44')?_0xb514('0x46'):_0xb514('0x47')});}else{_0x12aab9();}})[_0xb514('0x48')](function(_0x1172e4){_0x12aab9(_0x1172e4);});}});};exports['isAuthenticated']=function isAuthenticated(_0x138373){return compose()[_0xb514('0x3a')](function(_0xae9a02,_0x12aa86,_0x23ec50){var _0x1e1414;if(_0xae9a02[_0xb514('0x49')][_0xb514('0x4a')]){if(_['startsWith'](_0xae9a02[_0xb514('0x49')]['authorization'],_0xb514('0x4b'))){var _0x459d01=basicAuth(_0xae9a02);db[_0xb514('0x4c')]['find']({'where':{'name':_0x459d01[_0xb514('0x4d')]}})[_0xb514('0x40')](function(_0x20502b){if(!_0x20502b||!_0x20502b[_0xb514('0x4e')](_0x459d01[_0xb514('0x4f')])){return _0x12aa86[_0xb514('0x43')](0x191)[_0xb514('0x45')]({'message':'Wrong\x20credentials.'});}_0xae9a02[_0xb514('0x3b')]={'id':_0x20502b['id']};_0x23ec50();})[_0xb514('0x48')](function(_0x2e6b06){_0x23ec50(_0x2e6b06);});}else if(_[_0xb514('0x50')](_0xae9a02[_0xb514('0x49')][_0xb514('0x4a')],'Bearer')){validateJwt(_0xae9a02,_0x12aa86,_0x23ec50);}else{if(_0x138373){_0x23ec50();}else{return _0x12aa86[_0xb514('0x43')](0x193)['json']({'message':_0xb514('0x51')});}}}else if(_0xae9a02[_0xb514('0x41')][_0xb514('0x52')]){try{var _0x3fa775={'audience':hardwareConf[_0xb514('0x53')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0xae9a02['query']['apikey'],_0x3fa775)[_0xb514('0x40')](function(_0x3f577f){return db['User']['find']({'where':{'id':_0x3f577f[_0xb514('0x54')]}})['then'](function(_0x41091e){_0x1e1414=_0x41091e;return db['Setting'][_0xb514('0x3c')]({'where':{'id':0x1},'attributes':[_0xb514('0x55'),_0xb514('0x56')],'raw':!![]});})['then'](function(_0xb215a3){if(!_0x1e1414||!_['isEqual'](_0x1e1414[_0xb514('0x57')],_0x3f577f[_0xb514('0x58')])){return _0x12aa86[_0xb514('0x43')](0x191)[_0xb514('0x45')]({'message':_0xb514('0x59')});}if(_0x1e1414[_0xb514('0x5a')]){return _0x12aa86['status'](0x191)[_0xb514('0x45')]({'message':_0xb514('0x5b')});}if(_0x1e1414[_0xb514('0x5c')]){if(_0xb215a3[_0xb514('0x56')]>0x0){if(moment(_0x1e1414[_0xb514('0x5d')])[_0xb514('0x5e')](_0xb215a3[_0xb514('0x56')],_0xb514('0x5f'))>moment()){return _0x12aa86[_0xb514('0x43')](0x191)[_0xb514('0x45')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x12aa86[_0xb514('0x43')](0x191)['json']({'message':_0xb514('0x5b')});}}_0xae9a02['user']={'id':_0x1e1414['id']};_0x23ec50();});})[_0xb514('0x48')](function(){return _0x12aa86[_0xb514('0x43')](0x191)[_0xb514('0x45')]({'message':_0xb514('0x5b')});});}catch(_0x46a9ce){_0x23ec50(_0x46a9ce);}}else if(_0x138373){_0x23ec50();}else{return _0x12aa86[_0xb514('0x43')](0x193)[_0xb514('0x45')]({'message':_0xb514('0x51')});}})[_0xb514('0x3a')](function(_0x293859,_0x3af883,_0x1e42b8){if(_0x293859['user']){db[_0xb514('0x4c')][_0xb514('0x60')]({'where':{'id':_0x293859[_0xb514('0x3b')]['id']},'attributes':userAttributes})['then'](function(_0x1c1f28){if(!_0x1c1f28){return _0x3af883['status'](0x194)[_0xb514('0x45')]({'message':_0xb514('0x61')});}_0x293859['user']=_0x1c1f28;_0x1e42b8();})[_0xb514('0x48')](function(_0x37bbec){_0x1e42b8(_0x37bbec);});}else if(_0x138373){_0x1e42b8();}else{return _0x3af883['status'](0x194)['json']({'message':_0xb514('0x62')});}});};exports[_0xb514('0x63')]=function canUpdate(){return compose()[_0xb514('0x3a')](function(_0x4d831c,_0x2bdcdc,_0x5a528b){return licenseUtil[_0xb514('0x64')]()[_0xb514('0x40')](function(_0x5b7dcf){if(_0x5b7dcf[_0xb514('0x65')]){_0x5a528b();}else{return _0x2bdcdc['status'](0x193)['json']({'message':_0xb514('0x66')});}})[_0xb514('0x48')](function(_0x9e48ec){_0x5a528b(_0x9e48ec);});});};exports[_0xb514('0x67')]=function isWebrtcLicence(){return compose()[_0xb514('0x3a')](function(_0x185d80,_0x1a14c8,_0x1026b8){return licenseUtil['getLicense']()[_0xb514('0x40')](function(_0x1aec7f){if(_0x1aec7f[_0xb514('0x68')]){_0x1026b8();}else{return _0x1a14c8[_0xb514('0x43')](0x193)['json']({'message':'Forbidden'});}})[_0xb514('0x48')](function(_0x2d4713){_0x1026b8(_0x2d4713);});});};exports[_0xb514('0x69')]=function(_0x14dc12,_0x49c5cf,_0x1eadf5){_0x14dc12[_0xb514('0x69')]=!![];return _0x1eadf5();};exports[_0xb514('0x6a')]=function signToken(_0x3a0198){return signJwt(_0x3a0198);};exports[_0xb514('0x6b')]=function(_0x4232ae,_0x23adae){if(!_0x4232ae['user']){return _0x23adae[_0xb514('0x43')](0x194)[_0xb514('0x45')]({'message':_0xb514('0x6c')});}var _0x1307c6={'payload':{'id':_0x4232ae['user']['id'],'role':_0x4232ae[_0xb514('0x3b')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x1307c6)[_0xb514('0x40')](function(_0x4f934a){_0x23adae[_0xb514('0x6d')](_0xb514('0x6e'),_0x4f934a);_0x23adae[_0xb514('0x6f')](_0xb514('0x70'));})[_0xb514('0x48')](function(_0x9c1216){return _0x23adae[_0xb514('0x43')](0x1f4)[_0xb514('0x71')](_0x9c1216);});};exports[_0xb514('0x72')]=function(_0x3c2473){if(_[_0xb514('0x73')](_0x3c2473['apiKeyNonce'])||_['isNil'](_0x3c2473[_0xb514('0x74')])){return null;}else{return createJwt(_0x3c2473);}};exports[_0xb514('0x75')]=function(_0x4c071c){_0x4c071c[_0xb514('0x57')]=generateNonce();_0x4c071c[_0xb514('0x74')]=generateIssuedAt();return createJwt(_0x4c071c);};exports['regenerateApiKey']=function(_0x42ee82,_0x210b0c){var _0x482222=_0x42ee82[_0xb514('0x41')][_0xb514('0x52')];if(_0x482222){var _0x4790d7={'nonce':_0x210b0c[_0xb514('0x57')],'iat':_0x210b0c[_0xb514('0x74')],'audience':hardwareConf[_0xb514('0x53')](),'issuer':hardwareConf[_0xb514('0x53')]()};return verifyJwt(_0x482222,_0x4790d7)[_0xb514('0x40')](function(){return generateApiKey(_0x210b0c);});}else{throw{'message':_0xb514('0x76')};}};exports[_0xb514('0x77')]=function(_0x2a298c){var _0x2cfaa5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2cfaa5[_0xb514('0x78')](_0x2a298c))throw new db[(_0xb514('0x79'))][(_0xb514('0x7a'))](_0xb514('0x7b'));return;};exports[_0xb514('0x7c')]=function(_0x28756d,_0x240472,_0x4fa382){var _0x19d79e=encryptor[_0xb514('0x7d')](_0x240472)[_0xb514('0x7e')](',');for(var _0x19e53a=0x0;_0x19e53a<_0x4fa382;_0x19e53a++){if(!_0x19d79e[_0x19e53a])break;if(_0x28756d[_0xb514('0x7f')]()===_0x19d79e[_0x19e53a]['toLowerCase']()){var _0x5ab29d=util['format'](_0xb514('0x80'),_0x4fa382);if(_0x4fa382===0x1){_0x5ab29d=_0xb514('0x81');}throw new db[(_0xb514('0x79'))]['ValidationError'](_0x5ab29d);}}return;};exports[_0xb514('0x82')]=function(_0x56360d,_0x55d22c){var _0x30268c=_0x55d22c?encryptor[_0xb514('0x7d')](_0x55d22c)[_0xb514('0x7e')](','):[];if(_0x30268c['length']===0x5){_0x30268c[_0xb514('0x83')](-0x1,0x1);}_0x30268c[_0xb514('0x84')](_0x56360d);return encryptor[_0xb514('0x85')](_0x30268c[_0xb514('0x86')](','));};function signJwt(_0x122d0b){var _0x71d3d2=BPromise[_0xb514('0x87')](jwt[_0xb514('0x88')],{'context':jwt});var _0x390621=_0x122d0b[_0xb514('0x89')]||config[_0xb514('0x9')][_0xb514('0x8a')];return new BPromise(function(_0x38a357,_0x5b49fe){_0x71d3d2(_0x122d0b[_0xb514('0x8b')],_0x390621,_0x122d0b[_0xb514('0x8c')])[_0xb514('0x40')](function(_0x590b55){_0x38a357(_0x590b55);})[_0xb514('0x48')](function(_0x279dbe){_0x5b49fe(_0x279dbe);});});}function verifyJwt(_0xb9ba1,_0x42cddc,_0x17ad7c){var _0xdc4987=BPromise[_0xb514('0x87')](jwt[_0xb514('0x8d')],{'context':jwt});var _0x5ca754=_0x17ad7c||config[_0xb514('0x9')][_0xb514('0x8a')];return new BPromise(function(_0x3ae5f3,_0x3322e0){_0xdc4987(_0xb9ba1,_0x5ca754,_0x42cddc)[_0xb514('0x40')](function(_0x130806){_0x3ae5f3(_0x130806);})[_0xb514('0x48')](function(_0x335eff){_0x3322e0(_0x335eff);});});}function generateNonce(){return crypto[_0xb514('0x8e')](0x10)['toString'](_0xb514('0x8f'));}function generateIssuedAt(){return Math[_0xb514('0x90')](Date[_0xb514('0x91')]()/0x3e8)[_0xb514('0x92')]();}function createJwt(_0xfcf23c){var _0x3c4952={'payload':{'iat':_0xfcf23c[_0xb514('0x74')],'nonce':_0xfcf23c[_0xb514('0x57')]},'options':{'algorithm':_0xb514('0x93'),'subject':_0xfcf23c['id'][_0xb514('0x92')](),'issuer':hardwareConf[_0xb514('0x53')](),'audience':hardwareConf[_0xb514('0x53')]()}};return signJwt(_0x3c4952)[_0xb514('0x40')](function(_0x5f2f9e){return{'iat':_0xfcf23c[_0xb514('0x74')],'nonce':_0xfcf23c['apiKeyNonce'],'token':_0x5f2f9e};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index b59a1f6..2d169e8 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 _0x8812=['lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','filter','clause','tags','user','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','rows','catch','describe','cf_','CmCustomField','findOne','slice','all','length','fieldType','type','keys'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x8812,0xde));var _0x2881=function(_0x59ef03,_0x45d655){_0x59ef03=_0x59ef03-0x0;var _0x3147ec=_0x8812[_0x59ef03];return _0x3147ec;};'use strict';var _=require(_0x2881('0x0'));var sqlUtils=require(_0x2881('0x1'));var db=require(_0x2881('0x2'))['db'];exports[_0x2881('0x3')]=function(_0x2cdb8b,_0x414a28,_0x61a8a7,_0x1da546){var _0x2ad294={'count':0x0,'rows':[]};var _0x501a74=sqlUtils[_0x2881('0x4')](_0x414a28,_0x2cdb8b);if(_0x501a74){return Promise['resolve'](_0x2ad294);}var _0x62787e=sqlUtils['getContactsSubquery']();var _0x40c777={};var _0x4dcd69=![];var _0x49ebb6=![];return Promise[_0x2881('0x5')]()[_0x2881('0x6')](function(){if(_0x2cdb8b[_0x2881('0x7')]){return sqlUtils[_0x2881('0x8')](_0x2cdb8b[_0x2881('0x7')],_0x1da546);}else{return sqlUtils[_0x2881('0x9')](_0x2cdb8b,_0x1da546);}})[_0x2881('0x6')](function(_0x286555){_0x62787e['where'](_0x286555[_0x2881('0xa')]);_0x62787e[_0x2881('0xb')](_0x286555['fields']);_0x62787e[_0x2881('0xb')](_0x286555[_0x2881('0xc')]);_0x62787e[_0x2881('0xb')](_0x286555['user'][_0x2881('0xd')]);_0x40c777=_0x286555[_0x2881('0xe')];_0x49ebb6=_0x286555[_0x2881('0xf')][_0x2881('0x10')];return sqlUtils[_0x2881('0x11')](_0x414a28,_0x2cdb8b,_0x49ebb6);})[_0x2881('0x6')](function(_0xc6fecf){_0x62787e[_0x2881('0xb')](_0xc6fecf);var _0x5f0e4d=_0x2cdb8b['search']?_0x40c777[_0x2881('0x12')]:_0x2cdb8b[_0x2881('0x13')];_0x4dcd69=_0x5f0e4d?!![]:![];return sqlUtils[_0x2881('0x14')](_0x62787e,_0x5f0e4d);})['then'](function(_0x3cdbc2){_0x2ad294[_0x2881('0x15')]=_0x3cdbc2;if(_0x2ad294[_0x2881('0x15')]===0x0){return;}if(_0x2cdb8b[_0x2881('0x16')]){_0x49ebb6=!![];}return sqlUtils[_0x2881('0x17')](_0x62787e,_0x2cdb8b['fields'],_0x61a8a7,_0x4dcd69,_0x40c777['clause'],_0x49ebb6);})['then'](function(_0x314549){if(!_0x314549){return[];}return sqlUtils[_0x2881('0x18')](_0x314549,_0x2cdb8b,_0x61a8a7);})[_0x2881('0x6')](function(_0x353234){_0x2ad294[_0x2881('0x19')]=_0x353234;return _0x2ad294;})[_0x2881('0x1a')](function(_0x9efce4){throw _0x9efce4;});};exports[_0x2881('0x1b')]=function(){var _0x17f4ac={};var _0x293928=[];return db['CmContact'][_0x2881('0x1b')]()[_0x2881('0x6')](function(_0x3f763d){_0x17f4ac=_0x3f763d;var _0x463490=Object['keys'](_0x17f4ac)['filter'](function(_0x23d33b){return _['startsWith'](_0x23d33b,_0x2881('0x1c'))?_0x23d33b:undefined;});var _0xb0ab2e=_0x463490['map'](function(_0x33db55){return db[_0x2881('0x1d')][_0x2881('0x1e')]({'where':{'id':_0x33db55[_0x2881('0x1f')](0x3)},'raw':!![]});});return Promise[_0x2881('0x20')](_0xb0ab2e);})['then'](function(_0x565532){for(var _0xb17e38=0x0;_0xb17e38<_0x565532[_0x2881('0x21')];_0xb17e38++){if(_0x565532[_0xb17e38]){var _0x554b75='cf_'+_0x565532[_0xb17e38]['id'];_0x17f4ac[_0x554b75][_0x2881('0x22')]=_0x565532[_0xb17e38][_0x2881('0x23')];}}_0x293928=_['map'](Object[_0x2881('0x24')](_0x17f4ac),function(_0xf63434){return{'name':_0xf63434,'type':_0x17f4ac[_0xf63434][_0x2881('0x23')]};});return _0x293928;})['catch'](function(_0x4b6e36){throw _0x4b6e36;});}; \ No newline at end of file +var _0x267f=['fields','user','clause','skip','ids','tag','countFilteredContacts','count','User','buildContactsQuery','rows','catch','describe','startsWith','cf_','CmCustomField','findOne','slice','all','type','map','keys','lodash','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseQueryParameters','where','default'];(function(_0xdbd4f7,_0x4e3bdd){var _0x5c3f9d=function(_0xa7a35a){while(--_0xa7a35a){_0xdbd4f7['push'](_0xdbd4f7['shift']());}};_0x5c3f9d(++_0x4e3bdd);}(_0x267f,0x1e4));var _0xf267=function(_0x4fa1e6,_0x4305a0){_0x4fa1e6=_0x4fa1e6-0x0;var _0x2afb9e=_0x267f[_0x4fa1e6];return _0x2afb9e;};'use strict';var _=require(_0xf267('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xf267('0x1'))['db'];exports[_0xf267('0x2')]=function(_0x5af7b7,_0x8246e4,_0x394517,_0x4469a8){var _0x172297={'count':0x0,'rows':[]};var _0x1440f3=sqlUtils[_0xf267('0x3')](_0x8246e4,_0x5af7b7);if(_0x1440f3){return Promise[_0xf267('0x4')](_0x172297);}var _0x35f20b=sqlUtils[_0xf267('0x5')]();var _0x3b750d={};var _0x5661cb=![];var _0xd3a6fc=![];return Promise[_0xf267('0x4')]()[_0xf267('0x6')](function(){if(_0x5af7b7[_0xf267('0x7')]){return sqlUtils['parseAdvancedSearchFilter'](_0x5af7b7[_0xf267('0x7')],_0x4469a8);}else{return sqlUtils[_0xf267('0x8')](_0x5af7b7,_0x4469a8);}})[_0xf267('0x6')](function(_0x443d9c){_0x35f20b[_0xf267('0x9')](_0x443d9c[_0xf267('0xa')]);_0x35f20b['where'](_0x443d9c[_0xf267('0xb')]);_0x35f20b[_0xf267('0x9')](_0x443d9c['filter']);_0x35f20b[_0xf267('0x9')](_0x443d9c[_0xf267('0xc')][_0xf267('0xd')]);_0x3b750d=_0x443d9c['tags'];_0xd3a6fc=_0x443d9c[_0xf267('0xc')][_0xf267('0xe')];return sqlUtils['checkListsRestrictions'](_0x8246e4,_0x5af7b7,_0xd3a6fc);})['then'](function(_0x37daaf){_0x35f20b[_0xf267('0x9')](_0x37daaf);var _0xe366a3=_0x5af7b7[_0xf267('0x7')]?_0x3b750d[_0xf267('0xf')]:_0x5af7b7[_0xf267('0x10')];_0x5661cb=_0xe366a3?!![]:![];return sqlUtils[_0xf267('0x11')](_0x35f20b,_0xe366a3);})['then'](function(_0x17a5fb){_0x172297[_0xf267('0x12')]=_0x17a5fb;if(_0x172297[_0xf267('0x12')]===0x0){return;}if(_0x5af7b7[_0xf267('0x13')]){_0xd3a6fc=!![];}return sqlUtils[_0xf267('0x14')](_0x35f20b,_0x5af7b7['fields'],_0x394517,_0x5661cb,_0x3b750d['clause'],_0xd3a6fc);})[_0xf267('0x6')](function(_0xcb0701){if(!_0xcb0701){return[];}return sqlUtils['getFilteredContacts'](_0xcb0701,_0x5af7b7,_0x394517);})[_0xf267('0x6')](function(_0x19bc45){_0x172297[_0xf267('0x15')]=_0x19bc45;return _0x172297;})[_0xf267('0x16')](function(_0x1bf4ef){throw _0x1bf4ef;});};exports[_0xf267('0x17')]=function(){var _0x5f280c={};var _0x3fe0e1=[];return db['CmContact'][_0xf267('0x17')]()[_0xf267('0x6')](function(_0x22dcd3){_0x5f280c=_0x22dcd3;var _0x5dffc9=Object['keys'](_0x5f280c)['filter'](function(_0x4c5785){return _[_0xf267('0x18')](_0x4c5785,_0xf267('0x19'))?_0x4c5785:undefined;});var _0x545f78=_0x5dffc9['map'](function(_0x302795){return db[_0xf267('0x1a')][_0xf267('0x1b')]({'where':{'id':_0x302795[_0xf267('0x1c')](0x3)},'raw':!![]});});return Promise[_0xf267('0x1d')](_0x545f78);})[_0xf267('0x6')](function(_0x4379d9){for(var _0x16c580=0x0;_0x16c580<_0x4379d9['length'];_0x16c580++){if(_0x4379d9[_0x16c580]){var _0x98e6ea='cf_'+_0x4379d9[_0x16c580]['id'];_0x5f280c[_0x98e6ea]['fieldType']=_0x4379d9[_0x16c580][_0xf267('0x1e')];}}_0x3fe0e1=_[_0xf267('0x1f')](Object[_0xf267('0x20')](_0x5f280c),function(_0x2ef51b){return{'name':_0x2ef51b,'type':_0x5f280c[_0x2ef51b]['type']};});return _0x3fe0e1;})[_0xf267('0x16')](function(_0x212eff){throw _0x212eff;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index a840415..5879de7 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 _0x5c38=['value','Tag','tags','clause','and','User','user','uc.UserId\x20=\x20?','skip','keys','some','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','filter','getLists','map','group','c.id','limit','offset','having','order','DESC','subqry.','findAll','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','select','from','cm_contacts','where','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','subqry','firstName','phone','fax','email','ListId','createdAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','name','fieldType','DATE','type','default','text'];(function(_0x98e2b4,_0xb59553){var _0x2d24ed=function(_0x27b7ce){while(--_0x27b7ce){_0x98e2b4['push'](_0x98e2b4['shift']());}};_0x2d24ed(++_0xb59553);}(_0x5c38,0xf7));var _0x85c3=function(_0x52f055,_0x1755af){_0x52f055=_0x52f055-0x0;var _0x4faa28=_0x5c38[_0x52f055];return _0x4faa28;};'use strict';var _=require('lodash');var squel=require(_0x85c3('0x0'));var as=require(_0x85c3('0x1'));var qs=require(_0x85c3('0x2'));var utils=require(_0x85c3('0x3'));var db=require(_0x85c3('0x4'))['db'];function skipContactsQuery(_0x4caa8d,_0x20f4b4){var _0x5ed57f=![];if(_0x4caa8d[_0x85c3('0x5')]===_0x85c3('0x6')&&!_0x20f4b4[_0x85c3('0x7')]&&!_0x20f4b4['ListId']&&_0x20f4b4['autocomplete']!=='true'){_0x5ed57f=!![];}return _0x5ed57f;}function getContactsSubquery(){return squel[_0x85c3('0x8')]()[_0x85c3('0x9')](_0x85c3('0xa'),'c')[_0x85c3('0xb')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0xbd3724,_0x5a0888){var _0x3c34c7=_0x5a0888?'c':'subqry';_0xbd3724[_0x85c3('0xc')](_0x85c3('0xd'),'uc',_0x85c3('0xe')+_0x3c34c7+_0x85c3('0xf'))[_0x85c3('0xc')](_0x85c3('0x10'),'ct',_0x85c3('0x11')+_0x3c34c7+_0x85c3('0xf'))['left_join'](_0x85c3('0x12'),'t','t.id\x20=\x20ct.TagId');return _0xbd3724;}function addFieldsToQuery(_0x3ff827,_0xc0e6e5,_0x4437a5,_0x5086f8,_0x1f03cf){var _0x29df64=_0x1f03cf?'c':_0x85c3('0x13');if(!_0xc0e6e5){_0xc0e6e5=['id',_0x85c3('0x14'),'lastName',_0x85c3('0x15'),'mobile',_0x85c3('0x16'),_0x85c3('0x17'),_0x85c3('0x18'),'CompanyId',_0x85c3('0x19'),'updatedAt',_0x85c3('0x1a'),_0x85c3('0x1b')];}else if(!_0xc0e6e5[_0x85c3('0x1c')]('id')){_0xc0e6e5[_0x85c3('0x1d')]('id');}var _0x3f7f52=_0x4437a5&&_0x1f03cf||!_0x4437a5&&!_0x1f03cf;if(_0x5086f8){_0x3f7f52=_0x5086f8&&_0x1f03cf||!_0x5086f8&&!_0x1f03cf;}_0xc0e6e5[_0x85c3('0x1e')](function(_0x4354a5){if(_0x4354a5==='TagIds'){if(_0x3f7f52){_0x3ff827[_0x85c3('0x1f')](_0x85c3('0x20'),_0x4354a5);}else if(_0x4437a5||_0x5086f8){_0x3ff827[_0x85c3('0x1f')](_0x29df64+'.'+_0x4354a5);}}else{_0x3ff827[_0x85c3('0x1f')](_0x29df64+'.'+_0x4354a5);}});return _0x3ff827;}function getSqlClauses(){var _0x5488c6={'default':squel[_0x85c3('0x21')](),'fields':squel[_0x85c3('0x21')](),'filter':squel[_0x85c3('0x21')](),'tags':{'clause':squel[_0x85c3('0x21')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x5488c6;}function parseTagParameter(_0x3a5d17){var _0x50b82e=squel['expr']();if(_0x3a5d17){var _0x2742f3=utils[_0x85c3('0x22')](_0x3a5d17);_0x2742f3['forEach'](function(_0x5973a0){_0x50b82e['or'](_0x85c3('0x23'),'%,'+_0x5973a0+',%');});}return _0x50b82e;}function parseSearchFilter(_0x51427b){var _0xfda321=squel[_0x85c3('0x21')]();if(_0x51427b){var _0x5072fc=_0x51427b[_0x85c3('0x24')]('\x5c','\x5c\x5c')[_0x85c3('0x24')](/'/g,'\x27\x27');var _0x161060=qs[_0x85c3('0x25')](_0x5072fc);if(_0x5072fc[_0x85c3('0x26')]('\x20')[_0x85c3('0x27')]>0x1){_0xfda321['or'](_0x85c3('0x28'),qs[_0x85c3('0x29')](_0x5072fc,!![]),null);}else{if(qs[_0x85c3('0x2a')](_0x5072fc)){_0xfda321['or'](_0x85c3('0x2b'),_0x161060+'%');_0xfda321['or']('c.phone\x20LIKE\x20?',_0x161060+'%');_0xfda321['or']('c.mobile\x20LIKE\x20?',_0x161060+'%');_0xfda321['or'](_0x85c3('0x2c'),_0x161060+'%');}else if(qs[_0x85c3('0x2d')](_0x5072fc)){_0xfda321['or'](_0x85c3('0x2e'),_0x161060+'%');}else{_0xfda321['or'](_0x85c3('0x2f'),'%'+_0x161060+'%');_0xfda321['or'](_0x85c3('0x30'),'%'+_0x161060+'%');_0xfda321['or'](_0x85c3('0x2e'),'%'+_0x161060+'%');}}}return _0xfda321;}function parseAdvancedSearchFilter(_0x497040,_0xb81775){var _0x98aadc=getSqlClauses();var _0x148b28=as[_0x85c3('0x31')](_0x497040);var _0xc69ec7=_0x148b28['sqlOperator'];for(var _0x4978b1=0x0;_0x4978b1<_0x148b28['conditions'][_0x85c3('0x27')];_0x4978b1++){var _0x5ee431=_0x148b28['conditions'][_0x4978b1];var _0x17166d='c';var _0x4648c7=_['find'](_0xb81775,[_0x85c3('0x32'),_0x5ee431[_0x85c3('0x1f')]]);if(_0x4648c7){if(_0x5ee431[_0x85c3('0x1f')]==='dateOfBirth'||_0x4648c7[_0x85c3('0x33')]==='datetime'){_0x5ee431['castTo']=_0x85c3('0x34');}var _0x493e6b=as['buildExpression'](_0x17166d,_0x4648c7[_0x85c3('0x35')],_0x5ee431);_0x98aadc[_0x85c3('0x36')][_0xc69ec7](_0x493e6b[_0x85c3('0x37')],_0x493e6b['value']['start'],_0x493e6b[_0x85c3('0x38')]['end']);}else{if(_0x5ee431[_0x85c3('0x1f')]===_0x85c3('0x39')){var _0x318a8f=_0x5ee431[_0x85c3('0x38')][_0x85c3('0x26')](',')['map'](function(_0x234433){return Number(_0x234433);});var _0x4d3fc9=parseTagParameter(_0x318a8f);_0x98aadc[_0x85c3('0x3a')][_0x85c3('0x3b')][_0x85c3('0x3c')](_0x4d3fc9);_0x98aadc[_0x85c3('0x3a')]['ids']=_0x318a8f;}else if(_0x5ee431[_0x85c3('0x1f')]===_0x85c3('0x3d')){_0x98aadc[_0x85c3('0x3e')][_0x85c3('0x3b')]['and'](_0x85c3('0x3f'),_0x5ee431[_0x85c3('0x38')]);_0x98aadc[_0x85c3('0x3e')][_0x85c3('0x40')]=!![];}}}return _0x98aadc;}function parseModelFields(_0x1a7421,_0xf0a68c){var _0x431503=squel[_0x85c3('0x21')]();var _0x357475=_(_0x1a7421)[_0x85c3('0x41')]()['map'](function(_0x28f525){return _[_0x85c3('0x42')](_0xf0a68c,[_0x85c3('0x32'),_0x28f525])?_0x28f525:undefined;})[_0x85c3('0x43')]()['value']();if(_0x1a7421['Contact']){_0x357475[_0x85c3('0x1d')](_0x85c3('0x44'));}if(_0x1a7421['User']){_0x357475[_0x85c3('0x1d')](_0x85c3('0x3d'));}if(_0x357475['length']>0x0){_0x357475[_0x85c3('0x1e')](function(_0x17d3f4){if(_0x17d3f4==='ListId'){_0x431503[_0x85c3('0x3c')](_0x85c3('0x45'),[][_0x85c3('0x46')](_0x1a7421[_0x17d3f4]));}else if(_0x17d3f4===_0x85c3('0x44')){var _0x1dbe2e='%'+_0x1a7421[_0x17d3f4]+'%';_0x431503['and'](_0x85c3('0x47'),_0x1dbe2e);}else if(_0x17d3f4===_0x85c3('0x3d')){_0x431503[_0x85c3('0x3c')](_0x85c3('0x3f'),_0x1a7421[_0x17d3f4]);}else{_0x431503[_0x85c3('0x3c')]('c.'+_0x17d3f4+_0x85c3('0x48'),_0x1a7421[_0x17d3f4]);}});}return _0x431503;}function parseQueryParameters(_0x4db747,_0x372cea){var _0x16cee0=getSqlClauses();return Promise[_0x85c3('0x49')]()[_0x85c3('0x4a')](function(){return parseModelFields(_0x4db747,_0x372cea);})['then'](function(_0x2050b1){_0x16cee0[_0x85c3('0x4b')]['and'](_0x2050b1);return parseTagParameter(_0x4db747['tag']);})[_0x85c3('0x4a')](function(_0x14d750){_0x16cee0['tags']['clause'][_0x85c3('0x3c')](_0x14d750);return parseSearchFilter(_0x4db747['filter']);})[_0x85c3('0x4a')](function(_0x399e9c){_0x16cee0[_0x85c3('0x4c')]=_0x399e9c;return _0x16cee0;});}function checkListsRestrictions(_0x56ab90,_0x3ab520,_0x41f89c){var _0x59eea0=squel[_0x85c3('0x21')]();return Promise[_0x85c3('0x49')]()[_0x85c3('0x4a')](function(){if(_0x3ab520[_0x85c3('0x7')]&&_0x56ab90[_0x85c3('0x5')]===_0x85c3('0x6')&&!_0x41f89c){return _0x56ab90[_0x85c3('0x4d')]({'attributes':['id'],'raw':!![]});}})[_0x85c3('0x4a')](function(_0x884eb6){if(_0x884eb6){if(_0x884eb6[_0x85c3('0x27')]===0x0){_0x59eea0['and']('c.ListId\x20IS\x20NULL');}else{_0x59eea0['and'](_0x85c3('0x45'),_[_0x85c3('0x4e')](_0x884eb6,'id'));}}})['then'](function(){return _0x59eea0;});}function buildContactsQuery(_0xbaad54,_0x4f017a,_0x5eff68,_0x8aba7,_0x21ea18,_0x38149e){if(_0x4f017a){_0x4f017a=_0x5eff68['attributes'];}_0xbaad54=addFieldsToQuery(_0xbaad54,_0x4f017a,_0x8aba7,_0x38149e,!![]);var _0x588016=squel[_0x85c3('0x8')]();_0x588016=addFieldsToQuery(_0x588016,_0x4f017a,_0x8aba7,_0x38149e,![]);if(_0x8aba7||_0x38149e){_0xbaad54=applyJoinClauses(_0xbaad54,!![]);_0xbaad54[_0x85c3('0x4f')](_0x85c3('0x50'));if(_0x5eff68[_0x85c3('0x51')]){_0x588016[_0x85c3('0x51')](_0x5eff68[_0x85c3('0x51')]);}if(_0x5eff68[_0x85c3('0x52')]){_0x588016[_0x85c3('0x52')](_0x5eff68[_0x85c3('0x52')]);}}else{_0x588016=applyJoinClauses(_0x588016,![]);_0x588016[_0x85c3('0x4f')]('subqry.id');if(_0x5eff68['limit']){_0xbaad54[_0x85c3('0x51')](_0x5eff68[_0x85c3('0x51')]);}if(_0x5eff68[_0x85c3('0x52')]){_0xbaad54[_0x85c3('0x52')](_0x5eff68['offset']);}}_0x588016[_0x85c3('0x53')](_0x21ea18);if(_0x5eff68[_0x85c3('0x54')]){_0x5eff68[_0x85c3('0x54')][_0x85c3('0x1e')](function(_0x162be0){_0xbaad54[_0x85c3('0x54')]('c.'+_0x162be0[0x0],_0x162be0[0x1]===_0x85c3('0x55')?![]:!![]);_0x588016[_0x85c3('0x54')](_0x85c3('0x56')+_0x162be0[0x0],_0x162be0[0x1]===_0x85c3('0x55')?![]:!![]);});}_0x588016['from'](_0xbaad54,'subqry');return _0x588016;}function getFilteredContacts(_0x568465){var _0x4905b1=[];return db['Tag'][_0x85c3('0x57')]({'attributes':['id',_0x85c3('0x32'),'color'],'raw':!![]})['then'](function(_0x4c438f){_0x4905b1=_[_0x85c3('0x58')](_0x4c438f,'id');var _0x5a5796={'type':db[_0x85c3('0x59')][_0x85c3('0x5a')][_0x85c3('0x5b')],'model':db[_0x85c3('0x5c')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x85c3('0x5d')][_0x85c3('0x5e')](_0x568465[_0x85c3('0x5f')](),_0x5a5796);})[_0x85c3('0x4a')](function(_0x5d7c59){_0x5d7c59[_0x85c3('0x1e')](function(_0x4bcc78){if(_0x4bcc78[_0x85c3('0x1b')]){_0x4bcc78[_0x85c3('0x60')]=[];_0x4bcc78[_0x85c3('0x1b')][_0x85c3('0x26')](',')['forEach'](function(_0x5d58bf){_0x4bcc78[_0x85c3('0x60')]['push'](_0x4905b1[_0x5d58bf]);});}delete _0x4bcc78['TagIds'];});return _0x5d7c59;});}function countFilteredContacts(_0x4a97a0,_0x755495){var _0x5e0e00=_0x4a97a0['clone']();_0x5e0e00['field'](_0x85c3('0x61'));_0x5e0e00=applyJoinClauses(_0x5e0e00,!![]);_0x4a97a0[_0x85c3('0x4f')](_0x85c3('0x50'));var _0x11c7b6=utils['getSelectedTags'](_0x755495);if(!_[_0x85c3('0x62')](_0x11c7b6)){_0x5e0e00['where'](_0x85c3('0x63'),_0x11c7b6);}var _0x28de5c={'type':db[_0x85c3('0x59')]['QueryTypes']['SELECT'],'raw':!![]};return db[_0x85c3('0x5d')]['query'](_0x5e0e00[_0x85c3('0x5f')](),_0x28de5c)[_0x85c3('0x4a')](function(_0xa1cda9){return _0xa1cda9[0x0][_0x85c3('0x61')];});}module[_0x85c3('0x64')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xa38b=['push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','fieldType','datetime','castTo','DATE','type','default','value','end','Tag','split','tags','clause','and','uc.UserId\x20=\x20?','user','skip','keys','map','some','compact','Contact','ListId','c.ListId\x20IN\x20?','concat','User','\x20=\x20?','resolve','then','fields','tag','filter','attributes','group','c.id','limit','subqry.id','offset','having','order','subqry.','DESC','findAll','color','keyBy','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','isEmpty','where','t.id\x20IN\x20?','Sequelize','exports','lodash','../../mysqldb','role','agent','search','autocomplete','true','select','from','cm_contacts','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','ct.CmContactId\x20=\x20','subqry','phone','mobile','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes'];(function(_0x32ca32,_0x238b2b){var _0x5438ff=function(_0x1e3337){while(--_0x1e3337){_0x32ca32['push'](_0x32ca32['shift']());}};_0x5438ff(++_0x238b2b);}(_0xa38b,0x19b));var _0xba38=function(_0x1b0f2b,_0x16a480){_0x1b0f2b=_0x1b0f2b-0x0;var _0x284828=_0xa38b[_0x1b0f2b];return _0x284828;};'use strict';var _=require(_0xba38('0x0'));var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var utils=require('../interaction/utils');var db=require(_0xba38('0x1'))['db'];function skipContactsQuery(_0xccd365,_0x54ab26){var _0x8c97b=![];if(_0xccd365[_0xba38('0x2')]===_0xba38('0x3')&&!_0x54ab26[_0xba38('0x4')]&&!_0x54ab26['ListId']&&_0x54ab26[_0xba38('0x5')]!==_0xba38('0x6')){_0x8c97b=!![];}return _0x8c97b;}function getContactsSubquery(){return squel[_0xba38('0x7')]()[_0xba38('0x8')](_0xba38('0x9'),'c')['where'](_0xba38('0xa'));}function applyJoinClauses(_0x1d86fb,_0xc17e03){var _0x7ab323=_0xc17e03?'c':'subqry';_0x1d86fb[_0xba38('0xb')](_0xba38('0xc'),'uc',_0xba38('0xd')+_0x7ab323+'.id')[_0xba38('0xb')]('cm_contact_has_tags','ct',_0xba38('0xe')+_0x7ab323+'.id')[_0xba38('0xb')]('tools_tags','t','t.id\x20=\x20ct.TagId');return _0x1d86fb;}function addFieldsToQuery(_0x2b5bb6,_0x2e1fa3,_0x347812,_0x5e2ea8,_0xd26bf4){var _0x4110fa=_0xd26bf4?'c':_0xba38('0xf');if(!_0x2e1fa3){_0x2e1fa3=['id','firstName','lastName',_0xba38('0x10'),_0xba38('0x11'),'fax',_0xba38('0x12'),'ListId',_0xba38('0x13'),_0xba38('0x14'),_0xba38('0x15'),_0xba38('0x16'),_0xba38('0x17')];}else if(!_0x2e1fa3[_0xba38('0x18')]('id')){_0x2e1fa3[_0xba38('0x19')]('id');}var _0x82249f=_0x347812&&_0xd26bf4||!_0x347812&&!_0xd26bf4;if(_0x5e2ea8){_0x82249f=_0x5e2ea8&&_0xd26bf4||!_0x5e2ea8&&!_0xd26bf4;}_0x2e1fa3[_0xba38('0x1a')](function(_0x4eae62){if(_0x4eae62===_0xba38('0x17')){if(_0x82249f){_0x2b5bb6[_0xba38('0x1b')](_0xba38('0x1c'),_0x4eae62);}else if(_0x347812||_0x5e2ea8){_0x2b5bb6[_0xba38('0x1b')](_0x4110fa+'.'+_0x4eae62);}}else{_0x2b5bb6[_0xba38('0x1b')](_0x4110fa+'.'+_0x4eae62);}});return _0x2b5bb6;}function getSqlClauses(){var _0x537f81={'default':squel[_0xba38('0x1d')](),'fields':squel[_0xba38('0x1d')](),'filter':squel['expr'](),'tags':{'clause':squel[_0xba38('0x1d')](),'ids':null},'user':{'clause':squel[_0xba38('0x1d')](),'skip':![]}};return _0x537f81;}function parseTagParameter(_0x33ac0d){var _0x4ba60e=squel['expr']();if(_0x33ac0d){var _0x11925d=utils[_0xba38('0x1e')](_0x33ac0d);_0x11925d[_0xba38('0x1a')](function(_0x330594){_0x4ba60e['or'](_0xba38('0x1f'),'%,'+_0x330594+',%');});}return _0x4ba60e;}function parseSearchFilter(_0x4ee07f){var _0x7d9d60=squel['expr']();if(_0x4ee07f){var _0x487ebc=_0x4ee07f[_0xba38('0x20')]('\x5c','\x5c\x5c')[_0xba38('0x20')](/'/g,'\x27\x27');var _0x39d7c8=qs[_0xba38('0x21')](_0x487ebc);if(_0x487ebc['split']('\x20')[_0xba38('0x22')]>0x1){_0x7d9d60['or'](_0xba38('0x23'),qs[_0xba38('0x24')](_0x487ebc,!![]),null);}else{if(qs[_0xba38('0x25')](_0x487ebc)){_0x7d9d60['or'](_0xba38('0x26'),_0x39d7c8+'%');_0x7d9d60['or'](_0xba38('0x27'),_0x39d7c8+'%');_0x7d9d60['or'](_0xba38('0x28'),_0x39d7c8+'%');_0x7d9d60['or'](_0xba38('0x29'),_0x39d7c8+'%');}else if(qs[_0xba38('0x2a')](_0x487ebc)){_0x7d9d60['or'](_0xba38('0x2b'),_0x39d7c8+'%');}else{_0x7d9d60['or'](_0xba38('0x2c'),'%'+_0x39d7c8+'%');_0x7d9d60['or'](_0xba38('0x2d'),'%'+_0x39d7c8+'%');_0x7d9d60['or'](_0xba38('0x2b'),'%'+_0x39d7c8+'%');}}}return _0x7d9d60;}function parseAdvancedSearchFilter(_0x1ac719,_0x566013){var _0x220b2d=getSqlClauses();var _0x5120ee=as[_0xba38('0x2e')](_0x1ac719);var _0x510645=_0x5120ee[_0xba38('0x2f')];for(var _0x4d3819=0x0;_0x4d3819<_0x5120ee['conditions'][_0xba38('0x22')];_0x4d3819++){var _0x5756be=_0x5120ee[_0xba38('0x30')][_0x4d3819];var _0x8785c9='c';var _0xc53b95=_[_0xba38('0x31')](_0x566013,[_0xba38('0x32'),_0x5756be[_0xba38('0x1b')]]);if(_0xc53b95){if(_0x5756be[_0xba38('0x1b')]==='dateOfBirth'||_0xc53b95[_0xba38('0x33')]===_0xba38('0x34')){_0x5756be[_0xba38('0x35')]=_0xba38('0x36');}var _0x3c332c=as['buildExpression'](_0x8785c9,_0xc53b95[_0xba38('0x37')],_0x5756be);_0x220b2d[_0xba38('0x38')][_0x510645](_0x3c332c['text'],_0x3c332c[_0xba38('0x39')]['start'],_0x3c332c[_0xba38('0x39')][_0xba38('0x3a')]);}else{if(_0x5756be[_0xba38('0x1b')]===_0xba38('0x3b')){var _0x2323d1=_0x5756be[_0xba38('0x39')][_0xba38('0x3c')](',')['map'](function(_0x321b5b){return Number(_0x321b5b);});var _0x2b593b=parseTagParameter(_0x2323d1);_0x220b2d[_0xba38('0x3d')][_0xba38('0x3e')]['and'](_0x2b593b);_0x220b2d[_0xba38('0x3d')]['ids']=_0x2323d1;}else if(_0x5756be[_0xba38('0x1b')]==='User'){_0x220b2d['user'][_0xba38('0x3e')][_0xba38('0x3f')](_0xba38('0x40'),_0x5756be[_0xba38('0x39')]);_0x220b2d[_0xba38('0x41')][_0xba38('0x42')]=!![];}}}return _0x220b2d;}function parseModelFields(_0x479068,_0x4033de){var _0xa2de7b=squel[_0xba38('0x1d')]();var _0x95a31c=_(_0x479068)[_0xba38('0x43')]()[_0xba38('0x44')](function(_0x392458){return _[_0xba38('0x45')](_0x4033de,[_0xba38('0x32'),_0x392458])?_0x392458:undefined;})[_0xba38('0x46')]()['value']();if(_0x479068[_0xba38('0x47')]){_0x95a31c[_0xba38('0x19')](_0xba38('0x47'));}if(_0x479068['User']){_0x95a31c[_0xba38('0x19')]('User');}if(_0x95a31c[_0xba38('0x22')]>0x0){_0x95a31c['forEach'](function(_0x98f5c6){if(_0x98f5c6===_0xba38('0x48')){_0xa2de7b[_0xba38('0x3f')](_0xba38('0x49'),[][_0xba38('0x4a')](_0x479068[_0x98f5c6]));}else if(_0x98f5c6==='Contact'){var _0x56de1c='%'+_0x479068[_0x98f5c6]+'%';_0xa2de7b['and']('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x56de1c);}else if(_0x98f5c6===_0xba38('0x4b')){_0xa2de7b[_0xba38('0x3f')](_0xba38('0x40'),_0x479068[_0x98f5c6]);}else{_0xa2de7b[_0xba38('0x3f')]('c.'+_0x98f5c6+_0xba38('0x4c'),_0x479068[_0x98f5c6]);}});}return _0xa2de7b;}function parseQueryParameters(_0x431123,_0x26ba5c){var _0x210d8b=getSqlClauses();return Promise[_0xba38('0x4d')]()[_0xba38('0x4e')](function(){return parseModelFields(_0x431123,_0x26ba5c);})[_0xba38('0x4e')](function(_0x1edb96){_0x210d8b[_0xba38('0x4f')]['and'](_0x1edb96);return parseTagParameter(_0x431123[_0xba38('0x50')]);})[_0xba38('0x4e')](function(_0x303059){_0x210d8b[_0xba38('0x3d')]['clause']['and'](_0x303059);return parseSearchFilter(_0x431123[_0xba38('0x51')]);})[_0xba38('0x4e')](function(_0x6b4bfb){_0x210d8b['filter']=_0x6b4bfb;return _0x210d8b;});}function checkListsRestrictions(_0x58d6aa,_0x5a5fa4,_0x1f29be){var _0x256716=squel[_0xba38('0x1d')]();return Promise[_0xba38('0x4d')]()[_0xba38('0x4e')](function(){if(_0x5a5fa4[_0xba38('0x4')]&&_0x58d6aa['role']===_0xba38('0x3')&&!_0x1f29be){return _0x58d6aa['getLists']({'attributes':['id'],'raw':!![]});}})['then'](function(_0x29b5bb){if(_0x29b5bb){if(_0x29b5bb[_0xba38('0x22')]===0x0){_0x256716['and']('c.ListId\x20IS\x20NULL');}else{_0x256716[_0xba38('0x3f')]('c.ListId\x20IN\x20?',_[_0xba38('0x44')](_0x29b5bb,'id'));}}})[_0xba38('0x4e')](function(){return _0x256716;});}function buildContactsQuery(_0x3fe3fd,_0x2d720f,_0x3e8875,_0x44c435,_0x4d4d9c,_0x700514){if(_0x2d720f){_0x2d720f=_0x3e8875[_0xba38('0x52')];}_0x3fe3fd=addFieldsToQuery(_0x3fe3fd,_0x2d720f,_0x44c435,_0x700514,!![]);var _0x30caa0=squel['select']();_0x30caa0=addFieldsToQuery(_0x30caa0,_0x2d720f,_0x44c435,_0x700514,![]);if(_0x44c435||_0x700514){_0x3fe3fd=applyJoinClauses(_0x3fe3fd,!![]);_0x3fe3fd[_0xba38('0x53')](_0xba38('0x54'));if(_0x3e8875[_0xba38('0x55')]){_0x30caa0[_0xba38('0x55')](_0x3e8875[_0xba38('0x55')]);}if(_0x3e8875['offset']){_0x30caa0['offset'](_0x3e8875['offset']);}}else{_0x30caa0=applyJoinClauses(_0x30caa0,![]);_0x30caa0[_0xba38('0x53')](_0xba38('0x56'));if(_0x3e8875[_0xba38('0x55')]){_0x3fe3fd['limit'](_0x3e8875[_0xba38('0x55')]);}if(_0x3e8875[_0xba38('0x57')]){_0x3fe3fd[_0xba38('0x57')](_0x3e8875[_0xba38('0x57')]);}}_0x30caa0[_0xba38('0x58')](_0x4d4d9c);if(_0x3e8875[_0xba38('0x59')]){_0x3e8875[_0xba38('0x59')][_0xba38('0x1a')](function(_0x3c2c3f){_0x3fe3fd['order']('c.'+_0x3c2c3f[0x0],_0x3c2c3f[0x1]==='DESC'?![]:!![]);_0x30caa0[_0xba38('0x59')](_0xba38('0x5a')+_0x3c2c3f[0x0],_0x3c2c3f[0x1]===_0xba38('0x5b')?![]:!![]);});}_0x30caa0['from'](_0x3fe3fd,_0xba38('0xf'));return _0x30caa0;}function getFilteredContacts(_0x4d28dd){var _0x48a341=[];return db[_0xba38('0x3b')][_0xba38('0x5c')]({'attributes':['id',_0xba38('0x32'),_0xba38('0x5d')],'raw':!![]})['then'](function(_0x34bf1d){_0x48a341=_[_0xba38('0x5e')](_0x34bf1d,'id');var _0x3573a6={'type':db['Sequelize'][_0xba38('0x5f')][_0xba38('0x60')],'model':db[_0xba38('0x61')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xba38('0x62')][_0xba38('0x63')](_0x4d28dd[_0xba38('0x64')](),_0x3573a6);})[_0xba38('0x4e')](function(_0x5a39bf){_0x5a39bf['forEach'](function(_0x1e6e9a){if(_0x1e6e9a['TagIds']){_0x1e6e9a[_0xba38('0x65')]=[];_0x1e6e9a['TagIds']['split'](',')[_0xba38('0x1a')](function(_0x5dcc4a){_0x1e6e9a[_0xba38('0x65')]['push'](_0x48a341[_0x5dcc4a]);});}delete _0x1e6e9a[_0xba38('0x17')];});return _0x5a39bf;});}function countFilteredContacts(_0x3ab067,_0x1884e1){var _0x5274ec=_0x3ab067[_0xba38('0x66')]();_0x5274ec[_0xba38('0x1b')](_0xba38('0x67'));_0x5274ec=applyJoinClauses(_0x5274ec,!![]);_0x3ab067[_0xba38('0x53')]('c.id');var _0x29e52e=utils['getSelectedTags'](_0x1884e1);if(!_[_0xba38('0x68')](_0x29e52e)){_0x5274ec[_0xba38('0x69')](_0xba38('0x6a'),_0x29e52e);}var _0xd450d9={'type':db[_0xba38('0x6b')][_0xba38('0x5f')]['SELECT'],'raw':!![]};return db['sequelize'][_0xba38('0x63')](_0x5274ec[_0xba38('0x64')](),_0xd450d9)[_0xba38('0x4e')](function(_0x397c92){return _0x397c92[0x0]['COUNT(*)'];});}module[_0xba38('0x6c')]={'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 0cfe95e..e0a0d5b 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 _0x07fd=['unlink','decryptFile','data','update','secret','base64','decryptString','createDecipher','utf8','crypto','bluebird','lodash','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','binary','write','end','final','close'];(function(_0x2109a0,_0x45ba08){var _0x3d2c55=function(_0x5041af){while(--_0x5041af){_0x2109a0['push'](_0x2109a0['shift']());}};_0x3d2c55(++_0x45ba08);}(_0x07fd,0xfe));var _0xd07f=function(_0x450d01,_0x2464a1){_0x450d01=_0x450d01-0x0;var _0x178da1=_0x07fd[_0x450d01];return _0x178da1;};'use strict';var crypto=require(_0xd07f('0x0'));var fs=require('fs');var BPromise=require(_0xd07f('0x1'));var _=require(_0xd07f('0x2'));var config=require('../../config/environment');var logger=require(_0xd07f('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xd07f('0x4')][_0xd07f('0x5')],'algorithm':_0xd07f('0x6')};const fileOptions={'algorithm':_0xd07f('0x7')};if(config[_0xd07f('0x8')]&&config['encrypt'][_0xd07f('0x9')]){var isSupported=isAlgorithmSupported(config[_0xd07f('0x8')][_0xd07f('0x9')]);if(isSupported){fileOptions[_0xd07f('0x9')]=config[_0xd07f('0x8')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xd07f('0xa')](',\x20');logger[_0xd07f('0xb')](config['encrypt'][_0xd07f('0x9')],_0xd07f('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x5114fc){return AES_SUPPORTED_RX[_0xd07f('0xd')](_0x5114fc);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xd07f('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x579926){return getSupportedCiphers()[_0xd07f('0xf')](_0x579926)>-0x1;}function combineOptions(_0x1daf42){var _0x2a1a27={};for(var _0x16c4fb in fileOptions){if(fileOptions[_0xd07f('0x10')](_0x16c4fb)){_0x2a1a27[_0x16c4fb]=fileOptions[_0x16c4fb];}}if(_0x1daf42){for(var _0x182a5c in _0x1daf42){if(_0x1daf42[_0xd07f('0x10')](_0x182a5c)){_0x2a1a27[_0x182a5c]=_0x1daf42[_0x182a5c];}}}return _0x2a1a27;}exports[_0xd07f('0x11')]=function(_0x5887e5,_0x1cc948,_0x71c2c0,_0x22e875){return new BPromise(function(_0xc9523d,_0x2bb970){_0x22e875=combineOptions(_0x22e875);var _0x45d8b6=new Buffer(_0x71c2c0);var _0x1fd4e1=fs[_0xd07f('0x12')](_0x5887e5);var _0x1ce48d=fs[_0xd07f('0x13')](_0x1cc948);var _0x2f496d=crypto[_0xd07f('0x14')](_0x22e875[_0xd07f('0x9')],_0x45d8b6);_0x1fd4e1['on']('data',function(_0x2b6dcc){var _0x110ef6=new Buffer(_0x2f496d['update'](_0x2b6dcc),_0xd07f('0x15'));_0x1ce48d[_0xd07f('0x16')](_0x110ef6);});_0x1fd4e1['on'](_0xd07f('0x17'),function(){try{var _0xd9f9c2=new Buffer(_0x2f496d[_0xd07f('0x18')](_0xd07f('0x15')),_0xd07f('0x15'));_0x1ce48d[_0xd07f('0x16')](_0xd9f9c2);_0x1ce48d[_0xd07f('0x17')]();_0x1ce48d['on'](_0xd07f('0x19'),function(){return _0xc9523d(_0x1cc948);});}catch(_0x547d9f){fs[_0xd07f('0x1a')](_0x1cc948);return _0x2bb970(_0x547d9f);}});});};exports[_0xd07f('0x1b')]=function(_0x270a4d,_0x5260e0,_0x2de4e8,_0x1aa2d4){return new BPromise(function(_0x2732b0,_0x3bbde0){_0x1aa2d4=combineOptions(_0x1aa2d4);var _0xd26495=new Buffer(_0x2de4e8);var _0x42b81f=fs[_0xd07f('0x12')](_0x270a4d);var _0x5a0b7b=fs['createWriteStream'](_0x5260e0);var _0x34bb6f=crypto['createDecipher'](_0x1aa2d4['algorithm'],_0xd26495);_0x42b81f['on'](_0xd07f('0x1c'),function(_0x8c916c){var _0x1f28d2=new Buffer(_0x34bb6f[_0xd07f('0x1d')](_0x8c916c),_0xd07f('0x15'));_0x5a0b7b['write'](_0x1f28d2);});_0x42b81f['on']('end',function(){try{var _0x4e7c6c=new Buffer(_0x34bb6f[_0xd07f('0x18')](_0xd07f('0x15')),_0xd07f('0x15'));_0x5a0b7b[_0xd07f('0x16')](_0x4e7c6c);_0x5a0b7b['end']();_0x5a0b7b['on']('close',function(){return _0x2732b0(_0x5260e0);});}catch(_0x560a8e){fs[_0xd07f('0x1a')](_0x5260e0);return _0x3bbde0(_0x560a8e);}});});};exports['encryptString']=function(_0x6598d3,_0x4ecc78,_0x420f9c){var _0x4cab6f=_0x420f9c||stringOptions['algorithm'];var _0x5030a8=_0x4ecc78||stringOptions[_0xd07f('0x1e')];var _0x3368da=crypto[_0xd07f('0x14')](_0x4cab6f,_0x5030a8);var _0x3ffe48=_0x3368da[_0xd07f('0x1d')](_0x6598d3,'utf8',_0xd07f('0x1f'));_0x3ffe48+=_0x3368da[_0xd07f('0x18')](_0xd07f('0x1f'));return _0x3ffe48;};exports[_0xd07f('0x20')]=function(_0x14b983,_0x18ef3e,_0xd51ecf){var _0x4c76a9=_0xd51ecf||stringOptions[_0xd07f('0x9')];var _0x149d92=_0x18ef3e||stringOptions['secret'];var _0x232e29=crypto[_0xd07f('0x21')](_0x4c76a9,_0x149d92);var _0x2c0c39=_0x232e29[_0xd07f('0x1d')](_0x14b983,_0xd07f('0x1f'),_0xd07f('0x22'));_0x2c0c39+=_0x232e29[_0xd07f('0x18')](_0xd07f('0x22'));return _0x2c0c39;}; \ No newline at end of file +var _0x0d6b=['createWriteStream','createCipher','write','end','final','unlink','decryptFile','createDecipher','data','update','binary','close','encryptString','secret','base64','decryptString','utf8','crypto','bluebird','lodash','../../config/environment','../../config/logger','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','createReadStream'];(function(_0x1faf5d,_0x4db811){var _0xd145a8=function(_0x28f50e){while(--_0x28f50e){_0x1faf5d['push'](_0x1faf5d['shift']());}};_0xd145a8(++_0x4db811);}(_0x0d6b,0x129));var _0xb0d6=function(_0x2572d6,_0x191f5f){_0x2572d6=_0x2572d6-0x0;var _0x75a044=_0x0d6b[_0x2572d6];return _0x75a044;};'use strict';var crypto=require(_0xb0d6('0x0'));var fs=require('fs');var BPromise=require(_0xb0d6('0x1'));var _=require(_0xb0d6('0x2'));var config=require(_0xb0d6('0x3'));var logger=require(_0xb0d6('0x4'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xb0d6('0x5')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xb0d6('0x6')};if(config[_0xb0d6('0x7')]&&config['encrypt'][_0xb0d6('0x8')]){var isSupported=isAlgorithmSupported(config[_0xb0d6('0x7')][_0xb0d6('0x8')]);if(isSupported){fileOptions[_0xb0d6('0x8')]=config['encrypt']['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xb0d6('0x9')](',\x20');logger[_0xb0d6('0xa')](config['encrypt']['algorithm'],_0xb0d6('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x20271e){return AES_SUPPORTED_RX[_0xb0d6('0xc')](_0x20271e);}function getSupportedCiphers(){return crypto[_0xb0d6('0xd')]()[_0xb0d6('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x450766){return getSupportedCiphers()[_0xb0d6('0xf')](_0x450766)>-0x1;}function combineOptions(_0x224771){var _0x41e5bf={};for(var _0x450d14 in fileOptions){if(fileOptions[_0xb0d6('0x10')](_0x450d14)){_0x41e5bf[_0x450d14]=fileOptions[_0x450d14];}}if(_0x224771){for(var _0x3c09ec in _0x224771){if(_0x224771[_0xb0d6('0x10')](_0x3c09ec)){_0x41e5bf[_0x3c09ec]=_0x224771[_0x3c09ec];}}}return _0x41e5bf;}exports['encryptFile']=function(_0x294027,_0x13e4c1,_0x2ed043,_0x329120){return new BPromise(function(_0x1a3459,_0x35262e){_0x329120=combineOptions(_0x329120);var _0x1f7577=new Buffer(_0x2ed043);var _0x296d35=fs[_0xb0d6('0x11')](_0x294027);var _0xd7808b=fs[_0xb0d6('0x12')](_0x13e4c1);var _0x3393fd=crypto[_0xb0d6('0x13')](_0x329120[_0xb0d6('0x8')],_0x1f7577);_0x296d35['on']('data',function(_0x9e04e8){var _0x3cd712=new Buffer(_0x3393fd['update'](_0x9e04e8),'binary');_0xd7808b[_0xb0d6('0x14')](_0x3cd712);});_0x296d35['on'](_0xb0d6('0x15'),function(){try{var _0x1ffeed=new Buffer(_0x3393fd[_0xb0d6('0x16')]('binary'),'binary');_0xd7808b[_0xb0d6('0x14')](_0x1ffeed);_0xd7808b['end']();_0xd7808b['on']('close',function(){return _0x1a3459(_0x13e4c1);});}catch(_0x56304e){fs[_0xb0d6('0x17')](_0x13e4c1);return _0x35262e(_0x56304e);}});});};exports[_0xb0d6('0x18')]=function(_0x3b4cf8,_0x4bb206,_0x42d17d,_0x3e8326){return new BPromise(function(_0x460fe7,_0x7a29ff){_0x3e8326=combineOptions(_0x3e8326);var _0xa30545=new Buffer(_0x42d17d);var _0x3e62df=fs['createReadStream'](_0x3b4cf8);var _0x3b5b49=fs['createWriteStream'](_0x4bb206);var _0x4a067b=crypto[_0xb0d6('0x19')](_0x3e8326['algorithm'],_0xa30545);_0x3e62df['on'](_0xb0d6('0x1a'),function(_0x59e0ba){var _0x14cfd3=new Buffer(_0x4a067b[_0xb0d6('0x1b')](_0x59e0ba),_0xb0d6('0x1c'));_0x3b5b49[_0xb0d6('0x14')](_0x14cfd3);});_0x3e62df['on'](_0xb0d6('0x15'),function(){try{var _0x12552d=new Buffer(_0x4a067b[_0xb0d6('0x16')]('binary'),_0xb0d6('0x1c'));_0x3b5b49['write'](_0x12552d);_0x3b5b49[_0xb0d6('0x15')]();_0x3b5b49['on'](_0xb0d6('0x1d'),function(){return _0x460fe7(_0x4bb206);});}catch(_0x5b427f){fs[_0xb0d6('0x17')](_0x4bb206);return _0x7a29ff(_0x5b427f);}});});};exports[_0xb0d6('0x1e')]=function(_0x601a6,_0x4265a4,_0x2b0e8f){var _0x56c2ea=_0x2b0e8f||stringOptions[_0xb0d6('0x8')];var _0x2c498a=_0x4265a4||stringOptions[_0xb0d6('0x1f')];var _0xa34610=crypto[_0xb0d6('0x13')](_0x56c2ea,_0x2c498a);var _0x5f1fa4=_0xa34610['update'](_0x601a6,'utf8',_0xb0d6('0x20'));_0x5f1fa4+=_0xa34610[_0xb0d6('0x16')]('base64');return _0x5f1fa4;};exports[_0xb0d6('0x21')]=function(_0x12590e,_0x2ee277,_0x4451e3){var _0x6ab6e3=_0x4451e3||stringOptions[_0xb0d6('0x8')];var _0x4957ce=_0x2ee277||stringOptions[_0xb0d6('0x1f')];var _0xf37f3a=crypto[_0xb0d6('0x19')](_0x6ab6e3,_0x4957ce);var _0x13c415=_0xf37f3a['update'](_0x12590e,'base64',_0xb0d6('0x22'));_0x13c415+=_0xf37f3a[_0xb0d6('0x16')](_0xb0d6('0x22'));return _0x13c415;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index d5e16b6..e21eff3 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 _0xd8fd=['dbH','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','QueryTypes','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','join','each','length','%s%d.%s','%s.%s','csv','writeFileSync','zip','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','util','path','lodash','to-csv','bluebird','rimraf','../../mysqldb'];(function(_0x4d0ae1,_0x46b552){var _0x5ff510=function(_0x21e839){while(--_0x21e839){_0x4d0ae1['push'](_0x4d0ae1['shift']());}};_0x5ff510(++_0x46b552);}(_0xd8fd,0xad));var _0xdd8f=function(_0xdeb8fe,_0x455878){_0xdeb8fe=_0xdeb8fe-0x0;var _0x4c7674=_0xd8fd[_0xdeb8fe];return _0x4c7674;};'use strict';var util=require(_0xdd8f('0x0'));var path=require(_0xdd8f('0x1'));var _=require(_0xdd8f('0x2'));var csv=require(_0xdd8f('0x3'));var fs=require('fs');var BPromise=require(_0xdd8f('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xdd8f('0x5'));var db=require(_0xdd8f('0x6'))['db'];var dbH=require(_0xdd8f('0x6'))[_0xdd8f('0x7')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xdd8f('0x8')][0x2]);var QUERY=process[_0xdd8f('0x8')][0x3];var PATH=process[_0xdd8f('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x122eb8,_0x38a767){var _0x15ad27={'status':_0x122eb8};var _0x1be9df={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x38a767){_0x15ad27[_0xdd8f('0x9')]=_0x38a767;}return db['AnalyticExtractedReport']['update'](_0x15ad27,_0x1be9df);}function main(){var _0x4f8751=0x1388;var _0x47376b;logger[_0xdd8f('0xa')](util[_0xdd8f('0xb')](_0xdd8f('0xc'),EXTRACTED_REPORT_ID,_0xdd8f('0xd')));return db[_0xdd8f('0xe')][_0xdd8f('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdd8f('0x10'),'splitSizeCsv']})['then'](function(_0x3c97c2){if(_0x3c97c2){_0x47376b=_0x3c97c2;_0x4f8751=_0x47376b[_0xdd8f('0x11')]||0x1388;}})[_0xdd8f('0x12')](function(){return dbH[_0xdd8f('0x13')][_0xdd8f('0x14')](util[_0xdd8f('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xdd8f('0x13')][_0xdd8f('0x15')]['SELECT']});})[_0xdd8f('0x12')](function(_0x117289){if(!_0x117289[0x0]['num']){return analyticExtractedReport('Empty');}var _0x11d268=[];var _0x52d26b=0x0;if(_0x47376b[_0xdd8f('0x10')]){if(_0x117289&&_0x117289['length']){var _0x18d189=_[_0xdd8f('0x16')](_0x117289[0x0][_0xdd8f('0x17')]/_0x4f8751);var _0x1dd1eb=Number[_0xdd8f('0x18')](_0x117289[0x0][_0xdd8f('0x17')]/_0x4f8751)?_0x117289[0x0][_0xdd8f('0x17')]%_0x4f8751:0x0;_0x18d189[_0xdd8f('0x19')](function(_0x1cf4d3){if(_0x1cf4d3>0x0){_0x52d26b+=_0x4f8751;}_0x11d268['push'](dbH['sequelize'][_0xdd8f('0x14')](util[_0xdd8f('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4f8751,_0x52d26b),{'type':dbH[_0xdd8f('0x13')][_0xdd8f('0x15')]['SELECT']}));});if(_0x1dd1eb>0x0){_0x52d26b+=_0x4f8751;_0x11d268[_0xdd8f('0x1a')](dbH[_0xdd8f('0x13')][_0xdd8f('0x14')](util[_0xdd8f('0xb')](_0xdd8f('0x1b'),QUERY,_0x1dd1eb,_0x52d26b),{'type':dbH[_0xdd8f('0x13')][_0xdd8f('0x15')][_0xdd8f('0x1c')]}));}}}else{_0x11d268[_0xdd8f('0x1a')](dbH['sequelize'][_0xdd8f('0x14')](QUERY,{'type':dbH[_0xdd8f('0x13')]['QueryTypes'][_0xdd8f('0x1c')]}));}var _0x2f5c4b=path[_0xdd8f('0x1d')](PATH);var _0x78be0d=path[_0xdd8f('0x1e')](PATH,_0xdd8f('0x1f'));var _0x5d14e5=_0x47376b[_0xdd8f('0x10')]&&_0x11d268['length']>0x1;var _0x45ce3b=[];if(!fs['existsSync'](path[_0xdd8f('0x20')](_0x2f5c4b,_0x78be0d))&&_0x5d14e5){fs['mkdirSync'](path[_0xdd8f('0x20')](_0x2f5c4b,_0x78be0d));}return BPromise[_0xdd8f('0x21')](_0x11d268,function(_0x320535){_0x45ce3b['push'](_0x320535);})[_0xdd8f('0x12')](function(){for(var _0x3a8b87=0x0;_0x3a8b87<_0x45ce3b[_0xdd8f('0x22')];_0x3a8b87+=0x1){var _0x1745a5;var _0x289c79=_0x45ce3b[_0x3a8b87];if(_0x5d14e5){_0x1745a5=path[_0xdd8f('0x20')](_0x2f5c4b,_0x78be0d,util[_0xdd8f('0xb')](_0xdd8f('0x23'),_0x78be0d,_0x3a8b87,'csv'));}else{_0x1745a5=path[_0xdd8f('0x20')](_0x2f5c4b,util['format'](_0xdd8f('0x24'),_0x78be0d,_0xdd8f('0x25')));}fs[_0xdd8f('0x26')](_0x1745a5,csv(_0x289c79));}})['then'](function(){if(_0x5d14e5){return new Promise(function(_0xfc0e2d){zipdir(path[_0xdd8f('0x20')](_0x2f5c4b,_0x78be0d),{'saveTo':path[_0xdd8f('0x20')](_0x2f5c4b,util[_0xdd8f('0xb')](_0xdd8f('0x24'),_0x78be0d,_0xdd8f('0x27')))},function(_0x3bad0d,_0x3f5b25){rimraf(path[_0xdd8f('0x20')](_0x2f5c4b,_0x78be0d),function(){});_0xfc0e2d('zip\x20finished');});});}})[_0xdd8f('0x12')](function(){logger[_0xdd8f('0xa')](util[_0xdd8f('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xdd8f('0xd')));return analyticExtractedReport(_0xdd8f('0x28'),_0x5d14e5?util[_0xdd8f('0xb')](_0xdd8f('0x24'),_0x78be0d,_0x5d14e5?'zip':_0xdd8f('0x25')):null);});})[_0xdd8f('0x29')](function(_0x306e59){logger[_0xdd8f('0xa')](util['format'](_0xdd8f('0x2a'),EXTRACTED_REPORT_ID,_0xdd8f('0xd')),util['inspect'](_0x306e59,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xdd8f('0x2b')](function(){process[_0xdd8f('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xb283=['splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','range','forEach','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','existsSync','mkdirSync','join','each','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','CSV','Setting','split'];(function(_0x1ac874,_0xa88a86){var _0x135799=function(_0x38e3cb){while(--_0x38e3cb){_0x1ac874['push'](_0x1ac874['shift']());}};_0x135799(++_0xa88a86);}(_0xb283,0xdf));var _0x3b28=function(_0xd40100,_0x3ea399){_0xd40100=_0xd40100-0x0;var _0x27db21=_0xb283[_0xd40100];return _0x27db21;};'use strict';var util=require('util');var path=require('path');var _=require(_0x3b28('0x0'));var csv=require(_0x3b28('0x1'));var fs=require('fs');var BPromise=require(_0x3b28('0x2'));var zipdir=require(_0x3b28('0x3'));var rimraf=require(_0x3b28('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x3b28('0x5'))[_0x3b28('0x6')];var logger=require(_0x3b28('0x7'))(_0x3b28('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x3b28('0x9')][0x2]);var QUERY=process[_0x3b28('0x9')][0x3];var PATH=process[_0x3b28('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x17d249,_0x206b26){var _0x458a7b={'status':_0x17d249};var _0x2ce94d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x206b26){_0x458a7b[_0x3b28('0xa')]=_0x206b26;}return db[_0x3b28('0xb')][_0x3b28('0xc')](_0x458a7b,_0x2ce94d);}function main(){var _0x2ec519=0x1388;var _0x3814ff;logger[_0x3b28('0xd')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3b28('0xe')));return db[_0x3b28('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3b28('0x10'),_0x3b28('0x11')]})[_0x3b28('0x12')](function(_0x3060d1){if(_0x3060d1){_0x3814ff=_0x3060d1;_0x2ec519=_0x3814ff[_0x3b28('0x11')]||0x1388;}})[_0x3b28('0x12')](function(){return dbH['sequelize'][_0x3b28('0x13')](util['format'](_0x3b28('0x14'),QUERY),{'type':dbH[_0x3b28('0x15')][_0x3b28('0x16')][_0x3b28('0x17')]});})[_0x3b28('0x12')](function(_0x312c08){if(!_0x312c08[0x0][_0x3b28('0x18')]){return analyticExtractedReport(_0x3b28('0x19'));}var _0x55a62a=[];var _0x127c97=0x0;if(_0x3814ff[_0x3b28('0x10')]){if(_0x312c08&&_0x312c08[_0x3b28('0x1a')]){var _0x421a56=_[_0x3b28('0x1b')](_0x312c08[0x0][_0x3b28('0x18')]/_0x2ec519);var _0x30f11a=Number['isInteger'](_0x312c08[0x0]['num']/_0x2ec519)?_0x312c08[0x0][_0x3b28('0x18')]%_0x2ec519:0x0;_0x421a56[_0x3b28('0x1c')](function(_0x458713){if(_0x458713>0x0){_0x127c97+=_0x2ec519;}_0x55a62a[_0x3b28('0x1d')](dbH[_0x3b28('0x15')][_0x3b28('0x13')](util[_0x3b28('0x1e')](_0x3b28('0x1f'),QUERY,_0x2ec519,_0x127c97),{'type':dbH[_0x3b28('0x15')][_0x3b28('0x16')][_0x3b28('0x17')]}));});if(_0x30f11a>0x0){_0x127c97+=_0x2ec519;_0x55a62a['push'](dbH[_0x3b28('0x15')][_0x3b28('0x13')](util[_0x3b28('0x1e')](_0x3b28('0x1f'),QUERY,_0x30f11a,_0x127c97),{'type':dbH[_0x3b28('0x15')]['QueryTypes'][_0x3b28('0x17')]}));}}}else{_0x55a62a[_0x3b28('0x1d')](dbH[_0x3b28('0x15')][_0x3b28('0x13')](QUERY,{'type':dbH[_0x3b28('0x15')][_0x3b28('0x16')][_0x3b28('0x17')]}));}var _0x11888a=path['dirname'](PATH);var _0x3ba188=path[_0x3b28('0x20')](PATH,_0x3b28('0x21'));var _0x26327d=_0x3814ff['split']&&_0x55a62a['length']>0x1;var _0x17793d=[];if(!fs[_0x3b28('0x22')](path['join'](_0x11888a,_0x3ba188))&&_0x26327d){fs[_0x3b28('0x23')](path[_0x3b28('0x24')](_0x11888a,_0x3ba188));}return BPromise[_0x3b28('0x25')](_0x55a62a,function(_0x53d762){_0x17793d['push'](_0x53d762);})[_0x3b28('0x12')](function(){for(var _0x117e92=0x0;_0x117e92<_0x17793d['length'];_0x117e92+=0x1){var _0x5cb774;var _0x279d35=_0x17793d[_0x117e92];if(_0x26327d){_0x5cb774=path['join'](_0x11888a,_0x3ba188,util[_0x3b28('0x1e')]('%s%d.%s',_0x3ba188,_0x117e92,_0x3b28('0x26')));}else{_0x5cb774=path[_0x3b28('0x24')](_0x11888a,util[_0x3b28('0x1e')](_0x3b28('0x27'),_0x3ba188,'csv'));}fs[_0x3b28('0x28')](_0x5cb774,csv(_0x279d35));}})[_0x3b28('0x12')](function(){if(_0x26327d){return new Promise(function(_0x32d201){zipdir(path[_0x3b28('0x24')](_0x11888a,_0x3ba188),{'saveTo':path['join'](_0x11888a,util['format'](_0x3b28('0x27'),_0x3ba188,_0x3b28('0x29')))},function(_0xb2af5d,_0x48fd41){rimraf(path[_0x3b28('0x24')](_0x11888a,_0x3ba188),function(){});_0x32d201(_0x3b28('0x2a'));});});}})['then'](function(){logger['info'](util[_0x3b28('0x1e')](_0x3b28('0x2b'),EXTRACTED_REPORT_ID,_0x3b28('0xe')));return analyticExtractedReport(_0x3b28('0x2c'),_0x26327d?util[_0x3b28('0x1e')](_0x3b28('0x27'),_0x3ba188,_0x26327d?_0x3b28('0x29'):_0x3b28('0x26')):null);});})['catch'](function(_0x1f147b){logger[_0x3b28('0xd')](util[_0x3b28('0x1e')](_0x3b28('0x2d'),EXTRACTED_REPORT_ID,_0x3b28('0xe')),util['inspect'](_0x1f147b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3b28('0x2e'));})['finally'](function(){process[_0x3b28('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 5d57c6f..072c4fb 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 _0x72e9=['isInteger','sequelize','query','SELECT','QueryTypes','existsSync','mkdirSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','PDF','AnalyticExtractedReport','findOne','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','pipe','createWriteStream','finish','error','end','createPdfFromHTML','catch','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','map','pick','toString','value','fill','length','auto','push','body','chunk','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','format','header','pageBreak','before','margin','landscape','\x20/\x20','footer','black','num','Empty','Setting','find','splitSizePdf','then','split','range'];(function(_0x55c1d8,_0x46cab4){var _0x3cf864=function(_0x29f327){while(--_0x29f327){_0x55c1d8['push'](_0x55c1d8['shift']());}};_0x3cf864(++_0x46cab4);}(_0x72e9,0x136));var _0x972e=function(_0x445ef0,_0x453944){_0x445ef0=_0x445ef0-0x0;var _0x242e53=_0x72e9[_0x445ef0];return _0x242e53;};'use strict';var _=require('lodash');var fs=require('fs');var util=require('util');var path=require(_0x972e('0x0'));var moment=require('moment');var htmlToPdfmake=require(_0x972e('0x1'));var PdfPrinter=require(_0x972e('0x2'));var zipdir=require(_0x972e('0x3'));var rimraf=require('rimraf');var JSDOM=require(_0x972e('0x4'))[_0x972e('0x5')];var window=new JSDOM('')['window'];var BPromise=require(_0x972e('0x6'));var db=require(_0x972e('0x7'))['db'];var dbH=require('../../mysqldb')[_0x972e('0x8')];var logger=require(_0x972e('0x9'))(_0x972e('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x972e('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x972e('0xb')][0x4];var NAME=process[_0x972e('0xb')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x369b44,_0x3767f3){var _0x1d9c32={'status':_0x369b44};var _0x1cad18={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3767f3){_0x1d9c32[_0x972e('0xc')]=_0x3767f3;}return db['AnalyticExtractedReport'][_0x972e('0xd')](_0x1d9c32,_0x1cad18);}function getHeaders(_0x10db43){return _[_0x972e('0xe')](_0x10db43,function(_0x17fc8d){return{'text':_0x17fc8d,'style':'tableHeader'};});}function getRows(_0x2de107,_0x3484b6){return _[_0x972e('0xe')](_0x3484b6,function(_0x1908a2){return _(_0x1908a2)[_0x972e('0xf')](_0x2de107)[_0x972e('0xe')](function(_0x4bb0a2){return _0x4bb0a2?_[_0x972e('0x10')](_0x4bb0a2):'';})[_0x972e('0x11')]();});}function createTable(_0x3424a8,_0x22e526){var _0x2685ab={'widths':_[_0x972e('0x12')](Array(_0x3424a8[_0x972e('0x13')]),0x91),'heights':function(_0x15aa97){return _0x15aa97===0x0?_0x972e('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x17ec48=getHeaders(_0x3424a8);_0x2685ab['body'][_0x972e('0x15')](_0x17ec48);var _0x497182=getRows(_0x3424a8,_0x22e526);_0x2685ab[_0x972e('0x16')]=_0x2685ab['body']['concat'](_0x497182);return _0x2685ab;}function createTables(_0x17d8b3){var _0x1536f6=[];var _0x212c8a=_[_0x972e('0x17')](Object['keys'](_0x17d8b3[0x0]),0x5);_0x212c8a[_0x972e('0x18')](function(_0x547e9c){_0x1536f6[_0x972e('0x15')](createTable(_0x547e9c,_0x17d8b3));});return _0x1536f6;}function getPDFDocDefinition(_0x3a779b){var _0x2d8e6b=util['format'](_0x972e('0x19'),NAME,EXTRACTED_REPORT[_0x972e('0x1a')],moment(EXTRACTED_REPORT[_0x972e('0x1b')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x972e('0x1c')])[_0x972e('0x1d')](FORMAT));var _0x390611=[];for(var _0x37f36d=0x0;_0x37f36d<_0x3a779b[_0x972e('0x13')];_0x37f36d++){var _0x2c9d52=[];if(_0x37f36d===0x0){_0x2c9d52[_0x972e('0x15')]({'text':_0x2d8e6b,'style':_0x972e('0x1e')});}var _0x56bab7={'table':_0x3a779b[_0x37f36d]};if(_0x37f36d>0x0){_0x56bab7[_0x972e('0x1f')]=_0x972e('0x20');_0x56bab7[_0x972e('0x21')]=[0x0,0x46,0x0,0x0];}_0x2c9d52[_0x972e('0x15')](_0x56bab7);_0x390611['push'](_0x2c9d52);}return{'pageSize':'A4','pageOrientation':_0x972e('0x22'),'content':_0x390611,'footer':function(_0x270603,_0x2b613f){return{'text':_0x270603[_0x972e('0x10')]()+_0x972e('0x23')+_0x2b613f,'style':_0x972e('0x24')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x972e('0x25')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2b4fb2){var _0x417ee0=0x1388;var _0x53c5aa;if(!_0x2b4fb2[0x0][_0x972e('0x26')]){return analyticExtractedReport(_0x972e('0x27'));}return db[_0x972e('0x28')][_0x972e('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x972e('0x2a')]})[_0x972e('0x2b')](function(_0x55ce75){if(_0x55ce75){_0x53c5aa=_0x55ce75;_0x417ee0=_0x53c5aa['splitSizePdf']||0x3e8;}})[_0x972e('0x2b')](function(){var _0x1e7ed0=[];var _0x3da8ea=0x0;if(_0x53c5aa[_0x972e('0x2c')]){if(_0x2b4fb2&&_0x2b4fb2[_0x972e('0x13')]){var _0x76d7fd=_[_0x972e('0x2d')](_0x2b4fb2[0x0][_0x972e('0x26')]/_0x417ee0);var _0x29fc0e=Number[_0x972e('0x2e')](_0x2b4fb2[0x0][_0x972e('0x26')]/_0x417ee0)?_0x2b4fb2[0x0][_0x972e('0x26')]%_0x417ee0:0x0;_0x76d7fd[_0x972e('0x18')](function(_0x8ee9e3){if(_0x8ee9e3>0x0){_0x3da8ea+=_0x417ee0;}_0x1e7ed0[_0x972e('0x15')](dbH[_0x972e('0x2f')][_0x972e('0x30')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x417ee0,_0x3da8ea),{'type':dbH[_0x972e('0x2f')]['QueryTypes'][_0x972e('0x31')]}));});if(_0x29fc0e>0x0){_0x3da8ea+=_0x417ee0;_0x1e7ed0[_0x972e('0x15')](dbH['sequelize'][_0x972e('0x30')](util[_0x972e('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x29fc0e,_0x3da8ea),{'type':dbH[_0x972e('0x2f')][_0x972e('0x32')][_0x972e('0x31')]}));}}}else{_0x1e7ed0['push'](dbH[_0x972e('0x2f')]['query'](QUERY,{'type':dbH[_0x972e('0x2f')][_0x972e('0x32')][_0x972e('0x31')]}));}var _0x4cf7ea=path['dirname'](PATH);var _0x1c7042=path['basename'](PATH,'.pdf');var _0x5447e7=_0x53c5aa[_0x972e('0x2c')]&&_0x1e7ed0[_0x972e('0x13')]>0x1;var _0x11b6c3=[];if(!fs[_0x972e('0x33')](path['join'](_0x4cf7ea,_0x1c7042))&&_0x5447e7){fs[_0x972e('0x34')](path[_0x972e('0x35')](_0x4cf7ea,_0x1c7042));}return BPromise[_0x972e('0x36')](_0x1e7ed0,function(_0x373650){_0x11b6c3['push'](_0x373650);})[_0x972e('0x2b')](function(){var _0x6c39bf=[];for(var _0x3e8797=0x0;_0x3e8797<_0x11b6c3[_0x972e('0x13')];_0x3e8797+=0x1){var _0x451a4f=_0x11b6c3[_0x3e8797];var _0x2089d8=createTables(_[_0x972e('0x37')](_0x451a4f));var _0x1cac96;var _0x4423a6=getPDFDocDefinition(_0x2089d8);var _0x33379a=getPDFPrinter();var _0x1ae1f4=_0x33379a[_0x972e('0x38')](_0x4423a6);if(_0x5447e7){_0x1cac96=path[_0x972e('0x35')](_0x4cf7ea,_0x1c7042,util[_0x972e('0x1d')](_0x972e('0x39'),_0x1c7042,_0x3e8797,_0x972e('0x3a')));}else{_0x1cac96=path[_0x972e('0x35')](_0x4cf7ea,util[_0x972e('0x1d')](_0x972e('0x3b'),_0x1c7042,_0x972e('0x3a')));}_0x6c39bf[_0x972e('0x15')](writePDFDocument(_0x1ae1f4,_0x1cac96));}return Promise[_0x972e('0x3c')](_0x6c39bf);})['then'](function(){if(_0x5447e7){return new Promise(function(_0xdf25ea){zipdir(path[_0x972e('0x35')](_0x4cf7ea,_0x1c7042),{'saveTo':path[_0x972e('0x35')](_0x4cf7ea,util[_0x972e('0x1d')](_0x972e('0x3b'),_0x1c7042,'zip'))},function(){rimraf(path[_0x972e('0x35')](_0x4cf7ea,_0x1c7042),function(){});_0xdf25ea(_0x972e('0x3d'));});});}})[_0x972e('0x2b')](function(){if(!_0x5447e7)return;rimraf(path[_0x972e('0x35')](_0x4cf7ea,_0x1c7042),function(){});})[_0x972e('0x2b')](function(){logger[_0x972e('0x3e')](util['format'](_0x972e('0x3f'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x5447e7?util[_0x972e('0x1d')](_0x972e('0x3b'),_0x1c7042,_0x5447e7?_0x972e('0x40'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x972e('0x41')));return db[_0x972e('0x42')][_0x972e('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x972e('0x2b')](function(_0x14997f){EXTRACTED_REPORT=_0x14997f;return dbH['sequelize']['query'](util[_0x972e('0x1d')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x972e('0x32')][_0x972e('0x31')]});})[_0x972e('0x2b')](extractReport)['catch'](function(_0x254681){logger[_0x972e('0x3e')](util[_0x972e('0x1d')](_0x972e('0x44'),EXTRACTED_REPORT_ID,_0x972e('0x41')),util['inspect'](_0x254681,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x972e('0x45'));})[_0x972e('0x46')](function(){process[_0x972e('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x18be94=new PdfPrinter({'Arial':{'normal':__dirname+_0x972e('0x48'),'bold':__dirname+_0x972e('0x49'),'italics':__dirname+_0x972e('0x4a'),'bolditalics':__dirname+_0x972e('0x4b')}});return _0x18be94;}function getPDFDocDefinitionFromHTML(_0x424d23,_0x747f7f){var _0x3446b5=util[_0x972e('0x1d')]('%s\x20#%d',_0x747f7f[_0x972e('0x4c')],_0x747f7f[_0x972e('0x4d')]);var _0xf5999f=moment()[_0x972e('0x1d')](_0x972e('0x4e'))['toString']();var _0x1dff05=htmlToPdfmake(_0x424d23,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1dff05],'defaultStyle':{'font':_0x972e('0x4f')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x972e('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x972e('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x972e('0x50')}},'header':function(){return[{'text':_0x972e('0x51'),'style':_0x972e('0x1e')}];},'footer':function(_0x1fc6dc,_0x470d42){return[{'text':util[_0x972e('0x1d')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x3446b5,_0x1fc6dc,_0x470d42,_0xf5999f),'style':_0x972e('0x24')}];}};}function writePDFDocument(_0x164302,_0x1d81f0){return new Promise(function(_0x375fcd,_0x14fc51){var _0x3afec1=_0x164302[_0x972e('0x52')](fs[_0x972e('0x53')](_0x1d81f0));_0x3afec1['on'](_0x972e('0x54'),function(){_0x375fcd(_0x972e('0x54'));});_0x3afec1['on'](_0x972e('0x55'),function(_0x15a268){_0x14fc51(_0x15a268);});_0x164302[_0x972e('0x56')]();});}exports[_0x972e('0x57')]=function(_0x328b28,_0x2e59ac){var _0x51c7bb=getPDFPrinter();var _0x466515=getPDFDocDefinitionFromHTML(_0x328b28,_0x2e59ac);var _0x26a6ca=_0x51c7bb['createPdfKitDocument'](_0x466515);return writePDFDocument(_0x26a6ca,_0x2e59ac['path'])[_0x972e('0x58')](function(_0x24a0d0){throw _0x24a0d0;});}; \ No newline at end of file +var _0x5fa4=['/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','finish','end','createPdfFromHTML','createPdfKitDocument','path','lodash','util','html-to-pdfmake','zip-dir','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','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','pageBreak','margin','landscape','toString','\x20/\x20','Arial','num','Empty','Setting','find','split','splitSizePdf','then','range','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','sequelize','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','PDF','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf'];(function(_0xdc954c,_0x583f82){var _0x47943b=function(_0x482f83){while(--_0x482f83){_0xdc954c['push'](_0xdc954c['shift']());}};_0x47943b(++_0x583f82);}(_0x5fa4,0x10c));var _0x45fa=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x5fa4[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x45fa('0x0'));var fs=require('fs');var util=require(_0x45fa('0x1'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0x45fa('0x2'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x45fa('0x3'));var rimraf=require('rimraf');var JSDOM=require(_0x45fa('0x4'))[_0x45fa('0x5')];var window=new JSDOM('')[_0x45fa('0x6')];var BPromise=require(_0x45fa('0x7'));var db=require('../../mysqldb')['db'];var dbH=require(_0x45fa('0x8'))['dbH'];var logger=require(_0x45fa('0x9'))(_0x45fa('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x45fa('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x45fa('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x885dd7,_0x409ae6){var _0x31beb5={'status':_0x885dd7};var _0x2aded0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x409ae6){_0x31beb5[_0x45fa('0xd')]=_0x409ae6;}return db[_0x45fa('0xe')]['update'](_0x31beb5,_0x2aded0);}function getHeaders(_0x5d68dc){return _[_0x45fa('0xf')](_0x5d68dc,function(_0x32091b){return{'text':_0x32091b,'style':_0x45fa('0x10')};});}function getRows(_0x492988,_0x420af3){return _[_0x45fa('0xf')](_0x420af3,function(_0x4f7e37){return _(_0x4f7e37)[_0x45fa('0x11')](_0x492988)['map'](function(_0x21b6f2){return _0x21b6f2?_['toString'](_0x21b6f2):'';})['value']();});}function createTable(_0x3f4add,_0x4d1cca){var _0x34bc27={'widths':_[_0x45fa('0x12')](Array(_0x3f4add[_0x45fa('0x13')]),0x91),'heights':function(_0x59a6e2){return _0x59a6e2===0x0?_0x45fa('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4dca25=getHeaders(_0x3f4add);_0x34bc27[_0x45fa('0x15')][_0x45fa('0x16')](_0x4dca25);var _0x3b4d63=getRows(_0x3f4add,_0x4d1cca);_0x34bc27['body']=_0x34bc27['body']['concat'](_0x3b4d63);return _0x34bc27;}function createTables(_0x1abe54){var _0x58bf28=[];var _0x4ce8bb=_[_0x45fa('0x17')](Object['keys'](_0x1abe54[0x0]),0x5);_0x4ce8bb[_0x45fa('0x18')](function(_0x2094e6){_0x58bf28[_0x45fa('0x16')](createTable(_0x2094e6,_0x1abe54));});return _0x58bf28;}function getPDFDocDefinition(_0x1879c8){var _0x567eb7=util[_0x45fa('0x19')](_0x45fa('0x1a'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x45fa('0x1b')])[_0x45fa('0x19')](FORMAT),moment(EXTRACTED_REPORT[_0x45fa('0x1c')])[_0x45fa('0x19')](FORMAT));var _0x3170a9=[];for(var _0x3605b5=0x0;_0x3605b5<_0x1879c8[_0x45fa('0x13')];_0x3605b5++){var _0x53f3e6=[];if(_0x3605b5===0x0){_0x53f3e6['push']({'text':_0x567eb7,'style':_0x45fa('0x1d')});}var _0x1bb549={'table':_0x1879c8[_0x3605b5]};if(_0x3605b5>0x0){_0x1bb549[_0x45fa('0x1e')]='before';_0x1bb549[_0x45fa('0x1f')]=[0x0,0x46,0x0,0x0];}_0x53f3e6[_0x45fa('0x16')](_0x1bb549);_0x3170a9['push'](_0x53f3e6);}return{'pageSize':'A4','pageOrientation':_0x45fa('0x20'),'content':_0x3170a9,'footer':function(_0x371302,_0x35124c){return{'text':_0x371302[_0x45fa('0x21')]()+_0x45fa('0x22')+_0x35124c,'style':'footer'};},'defaultStyle':{'font':_0x45fa('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2170a8){var _0x13abff=0x1388;var _0x48be16;if(!_0x2170a8[0x0][_0x45fa('0x24')]){return analyticExtractedReport(_0x45fa('0x25'));}return db[_0x45fa('0x26')][_0x45fa('0x27')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x45fa('0x28'),_0x45fa('0x29')]})[_0x45fa('0x2a')](function(_0x15d2bc){if(_0x15d2bc){_0x48be16=_0x15d2bc;_0x13abff=_0x48be16[_0x45fa('0x29')]||0x3e8;}})[_0x45fa('0x2a')](function(){var _0x506cbe=[];var _0x7ebe62=0x0;if(_0x48be16[_0x45fa('0x28')]){if(_0x2170a8&&_0x2170a8['length']){var _0x3f856e=_[_0x45fa('0x2b')](_0x2170a8[0x0]['num']/_0x13abff);var _0x4bf38=Number['isInteger'](_0x2170a8[0x0][_0x45fa('0x24')]/_0x13abff)?_0x2170a8[0x0][_0x45fa('0x24')]%_0x13abff:0x0;_0x3f856e[_0x45fa('0x18')](function(_0x1b8be0){if(_0x1b8be0>0x0){_0x7ebe62+=_0x13abff;}_0x506cbe[_0x45fa('0x16')](dbH['sequelize'][_0x45fa('0x2c')](util[_0x45fa('0x19')](_0x45fa('0x2d'),QUERY,_0x13abff,_0x7ebe62),{'type':dbH['sequelize'][_0x45fa('0x2e')][_0x45fa('0x2f')]}));});if(_0x4bf38>0x0){_0x7ebe62+=_0x13abff;_0x506cbe['push'](dbH[_0x45fa('0x30')][_0x45fa('0x2c')](util['format'](_0x45fa('0x2d'),QUERY,_0x4bf38,_0x7ebe62),{'type':dbH[_0x45fa('0x30')][_0x45fa('0x2e')]['SELECT']}));}}}else{_0x506cbe['push'](dbH[_0x45fa('0x30')][_0x45fa('0x2c')](QUERY,{'type':dbH[_0x45fa('0x30')]['QueryTypes'][_0x45fa('0x2f')]}));}var _0x1b659d=path[_0x45fa('0x31')](PATH);var _0x53595a=path[_0x45fa('0x32')](PATH,'.pdf');var _0x5817b8=_0x48be16[_0x45fa('0x28')]&&_0x506cbe[_0x45fa('0x13')]>0x1;var _0x1492c6=[];if(!fs[_0x45fa('0x33')](path[_0x45fa('0x34')](_0x1b659d,_0x53595a))&&_0x5817b8){fs[_0x45fa('0x35')](path[_0x45fa('0x34')](_0x1b659d,_0x53595a));}return BPromise[_0x45fa('0x36')](_0x506cbe,function(_0x4f8a0c){_0x1492c6[_0x45fa('0x16')](_0x4f8a0c);})[_0x45fa('0x2a')](function(){var _0x3c129d=[];for(var _0x1c93b5=0x0;_0x1c93b5<_0x1492c6['length'];_0x1c93b5+=0x1){var _0x17645d=_0x1492c6[_0x1c93b5];var _0x4fed5b=createTables(_['flatten'](_0x17645d));var _0x44ef1d;var _0x16c463=getPDFDocDefinition(_0x4fed5b);var _0x159707=getPDFPrinter();var _0x4fdae3=_0x159707['createPdfKitDocument'](_0x16c463);if(_0x5817b8){_0x44ef1d=path['join'](_0x1b659d,_0x53595a,util[_0x45fa('0x19')](_0x45fa('0x37'),_0x53595a,_0x1c93b5,'pdf'));}else{_0x44ef1d=path['join'](_0x1b659d,util[_0x45fa('0x19')](_0x45fa('0x38'),_0x53595a,'pdf'));}_0x3c129d['push'](writePDFDocument(_0x4fdae3,_0x44ef1d));}return Promise[_0x45fa('0x39')](_0x3c129d);})[_0x45fa('0x2a')](function(){if(_0x5817b8){return new Promise(function(_0x10162f){zipdir(path[_0x45fa('0x34')](_0x1b659d,_0x53595a),{'saveTo':path[_0x45fa('0x34')](_0x1b659d,util[_0x45fa('0x19')]('%s.%s',_0x53595a,_0x45fa('0x3a')))},function(){rimraf(path[_0x45fa('0x34')](_0x1b659d,_0x53595a),function(){});_0x10162f(_0x45fa('0x3b'));});});}})[_0x45fa('0x2a')](function(){if(!_0x5817b8)return;rimraf(path['join'](_0x1b659d,_0x53595a),function(){});})['then'](function(){logger[_0x45fa('0x3c')](util[_0x45fa('0x19')](_0x45fa('0x3d'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x45fa('0x3e'),_0x5817b8?util[_0x45fa('0x19')](_0x45fa('0x38'),_0x53595a,_0x5817b8?_0x45fa('0x3a'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x45fa('0x19')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x45fa('0x3f')));return db['AnalyticExtractedReport']['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x45fa('0x2a')](function(_0x4ad599){EXTRACTED_REPORT=_0x4ad599;return dbH[_0x45fa('0x30')]['query'](util[_0x45fa('0x19')](_0x45fa('0x40'),QUERY),{'type':dbH['sequelize'][_0x45fa('0x2e')]['SELECT']});})[_0x45fa('0x2a')](extractReport)[_0x45fa('0x41')](function(_0x39a07f){logger[_0x45fa('0x3c')](util[_0x45fa('0x19')](_0x45fa('0x42'),EXTRACTED_REPORT_ID,_0x45fa('0x3f')),util[_0x45fa('0x43')](_0x39a07f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x45fa('0x44'));})[_0x45fa('0x45')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x28ad27=new PdfPrinter({'Arial':{'normal':__dirname+_0x45fa('0x46'),'bold':__dirname+_0x45fa('0x47'),'italics':__dirname+_0x45fa('0x48'),'bolditalics':__dirname+_0x45fa('0x49')}});return _0x28ad27;}function getPDFDocDefinitionFromHTML(_0x4a1917,_0xc53571){var _0x3fede7=util[_0x45fa('0x19')](_0x45fa('0x4a'),_0xc53571[_0x45fa('0x4b')],_0xc53571['interactionId']);var _0x520122=moment()[_0x45fa('0x19')](_0x45fa('0x4c'))['toString']();var _0x586287=htmlToPdfmake(_0x4a1917,{'window':window,'tableAutoSize':!![]});return{'content':[_0x586287],'defaultStyle':{'font':_0x45fa('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x45fa('0x4d'),'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':_0x45fa('0x4d')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x45fa('0x1d')}];},'footer':function(_0x419719,_0x4a725f){return[{'text':util[_0x45fa('0x19')](_0x45fa('0x4e'),_0x3fede7,_0x419719,_0x4a725f,_0x520122),'style':_0x45fa('0x4f')}];}};}function writePDFDocument(_0x3073d0,_0x1982f8){return new Promise(function(_0x3bb309,_0xda1281){var _0x38dc25=_0x3073d0['pipe'](fs['createWriteStream'](_0x1982f8));_0x38dc25['on'](_0x45fa('0x50'),function(){_0x3bb309('finish');});_0x38dc25['on']('error',function(_0x8316df){_0xda1281(_0x8316df);});_0x3073d0[_0x45fa('0x51')]();});}exports[_0x45fa('0x52')]=function(_0x94cad2,_0x253a34){var _0x26d451=getPDFPrinter();var _0x50b037=getPDFDocDefinitionFromHTML(_0x94cad2,_0x253a34);var _0x578c5c=_0x26d451[_0x45fa('0x53')](_0x50b037);return writePDFDocument(_0x578c5c,_0x253a34[_0x45fa('0x54')])[_0x45fa('0x41')](function(_0x3e3d77){throw _0x3e3d77;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 1218edd..4963e0f 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 _0x2ba1=['splitSizeXlsx','query','sequelize','QueryTypes','num','Empty','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','basename','.xlsx','length','existsSync','mkdirSync','join','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','then'];(function(_0x29c696,_0x243038){var _0x2a2ad4=function(_0xf1425e){while(--_0xf1425e){_0x29c696['push'](_0x29c696['shift']());}};_0x2a2ad4(++_0x243038);}(_0x2ba1,0xf8));var _0x12ba=function(_0x411bd8,_0x2e047e){_0x411bd8=_0x411bd8-0x0;var _0x3c8b81=_0x2ba1[_0x411bd8];return _0x3c8b81;};'use strict';var util=require(_0x12ba('0x0'));var path=require(_0x12ba('0x1'));var _=require(_0x12ba('0x2'));var fs=require('fs');var json2xls=require(_0x12ba('0x3'));var BPromise=require(_0x12ba('0x4'));var zipdir=require(_0x12ba('0x5'));var rimraf=require(_0x12ba('0x6'));var db=require(_0x12ba('0x7'))['db'];var dbH=require(_0x12ba('0x7'))[_0x12ba('0x8')];var logger=require(_0x12ba('0x9'))(_0x12ba('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x12ba('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x12ba('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x45c840,_0xcb89e9){var _0x100da2={'status':_0x45c840};var _0x5e0582={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xcb89e9){_0x100da2[_0x12ba('0xc')]=_0xcb89e9;}return db[_0x12ba('0xd')][_0x12ba('0xe')](_0x100da2,_0x5e0582);}function main(){var _0x427c18=0x1388;var _0x55b929;logger[_0x12ba('0xf')](util[_0x12ba('0x10')](_0x12ba('0x11'),EXTRACTED_REPORT_ID,_0x12ba('0x12')));return db['Setting'][_0x12ba('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x12ba('0x14'),'splitSizeXlsx']})[_0x12ba('0x15')](function(_0x8e2650){if(_0x8e2650){_0x55b929=_0x8e2650;_0x427c18=_0x55b929[_0x12ba('0x16')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x12ba('0x17')](util[_0x12ba('0x10')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x12ba('0x18')][_0x12ba('0x19')]['SELECT']});})['then'](function(_0x58d235){if(!_0x58d235[0x0][_0x12ba('0x1a')]){return analyticExtractedReport(_0x12ba('0x1b'));}var _0x379082=[];var _0x55d78d=0x0;if(_0x55b929[_0x12ba('0x14')]){if(_0x58d235&&_0x58d235['length']){var _0x492643=_[_0x12ba('0x1c')](_0x58d235[0x0]['num']/_0x427c18);var _0x2b4e90=Number[_0x12ba('0x1d')](_0x58d235[0x0][_0x12ba('0x1a')]/_0x427c18)?_0x58d235[0x0][_0x12ba('0x1a')]%_0x427c18:0x0;_0x492643[_0x12ba('0x1e')](function(_0x2e6d50){if(_0x2e6d50>0x0){_0x55d78d+=_0x427c18;}_0x379082[_0x12ba('0x1f')](dbH[_0x12ba('0x18')]['query'](util[_0x12ba('0x10')](_0x12ba('0x20'),QUERY,_0x427c18,_0x55d78d),{'type':dbH[_0x12ba('0x18')][_0x12ba('0x19')][_0x12ba('0x21')]}));});if(_0x2b4e90>0x0){_0x55d78d+=_0x427c18;_0x379082['push'](dbH[_0x12ba('0x18')]['query'](util[_0x12ba('0x10')](_0x12ba('0x20'),QUERY,_0x2b4e90,_0x55d78d),{'type':dbH[_0x12ba('0x18')][_0x12ba('0x19')][_0x12ba('0x21')]}));}}}else{_0x379082['push'](dbH[_0x12ba('0x18')][_0x12ba('0x17')](QUERY,{'type':dbH[_0x12ba('0x18')][_0x12ba('0x19')][_0x12ba('0x21')]}));}var _0x2888aa=path['dirname'](PATH);var _0x1f9e1c=path[_0x12ba('0x22')](PATH,_0x12ba('0x23'));var _0xe67450=_0x55b929[_0x12ba('0x14')]&&_0x379082[_0x12ba('0x24')]>0x1;var _0x34f65c=[];if(!fs[_0x12ba('0x25')](path['join'](_0x2888aa,_0x1f9e1c))&&_0xe67450){fs[_0x12ba('0x26')](path[_0x12ba('0x27')](_0x2888aa,_0x1f9e1c));}return BPromise[_0x12ba('0x28')](_0x379082,function(_0x5db197){_0x34f65c[_0x12ba('0x1f')](_0x5db197);})['then'](function(){for(var _0x22b94a=0x0;_0x22b94a<_0x34f65c[_0x12ba('0x24')];_0x22b94a+=0x1){var _0x59ae1a;var _0x5a6b0d=_0x34f65c[_0x22b94a];if(_0xe67450){_0x59ae1a=path[_0x12ba('0x27')](_0x2888aa,_0x1f9e1c,util[_0x12ba('0x10')](_0x12ba('0x29'),_0x1f9e1c,_0x22b94a,'xlsx'));}else{_0x59ae1a=path[_0x12ba('0x27')](_0x2888aa,util[_0x12ba('0x10')](_0x12ba('0x2a'),_0x1f9e1c,_0x12ba('0x2b')));}fs[_0x12ba('0x2c')](_0x59ae1a,json2xls(_0x5a6b0d),_0x12ba('0x2d'));}})[_0x12ba('0x15')](function(){if(_0xe67450){return new Promise(function(_0xac2830){zipdir(path['join'](_0x2888aa,_0x1f9e1c),{'saveTo':path[_0x12ba('0x27')](_0x2888aa,util[_0x12ba('0x10')]('%s.%s',_0x1f9e1c,'zip'))},function(_0x4d57f2,_0x21e7ee){rimraf(path[_0x12ba('0x27')](_0x2888aa,_0x1f9e1c),function(){});_0xac2830(_0x12ba('0x2e'));});});}})[_0x12ba('0x15')](function(){logger['info'](util['format'](_0x12ba('0x2f'),EXTRACTED_REPORT_ID,_0x12ba('0x12')));return analyticExtractedReport('Completed',_0xe67450?util[_0x12ba('0x10')](_0x12ba('0x2a'),_0x1f9e1c,_0xe67450?_0x12ba('0x30'):_0x12ba('0x2b')):null);});})[_0x12ba('0x31')](function(_0x9a3fd7){logger[_0x12ba('0xf')](util[_0x12ba('0x10')](_0x12ba('0x32'),EXTRACTED_REPORT_ID,_0x12ba('0x12')),util[_0x12ba('0x33')](_0x9a3fd7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x12ba('0x34'));})[_0x12ba('0x35')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x9091=['zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','finally','exit','util','lodash','bluebird','rimraf','../../mysqldb','argv','savename','update','info','format','XLSX','Setting','split','then','sequelize','query','QueryTypes','SELECT','Empty','length','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','mkdirSync','%s%d.%s','%s.%s','xlsx','writeFileSync'];(function(_0x16ebfa,_0x5c55e9){var _0x26d314=function(_0x1c3321){while(--_0x1c3321){_0x16ebfa['push'](_0x16ebfa['shift']());}};_0x26d314(++_0x5c55e9);}(_0x9091,0x1ed));var _0x1909=function(_0x97047f,_0x5a7cd0){_0x97047f=_0x97047f-0x0;var _0x18ebc3=_0x9091[_0x97047f];return _0x18ebc3;};'use strict';var util=require(_0x1909('0x0'));var path=require('path');var _=require(_0x1909('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x1909('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x1909('0x3'));var db=require(_0x1909('0x4'))['db'];var dbH=require(_0x1909('0x4'))['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x1909('0x5')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x1909('0x5')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xdcee18,_0x20a7fc){var _0x3e25fd={'status':_0xdcee18};var _0x243643={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x20a7fc){_0x3e25fd[_0x1909('0x6')]=_0x20a7fc;}return db['AnalyticExtractedReport'][_0x1909('0x7')](_0x3e25fd,_0x243643);}function main(){var _0x4d6831=0x1388;var _0x49a143;logger[_0x1909('0x8')](util[_0x1909('0x9')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1909('0xa')));return db[_0x1909('0xb')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1909('0xc'),'splitSizeXlsx']})[_0x1909('0xd')](function(_0x989590){if(_0x989590){_0x49a143=_0x989590;_0x4d6831=_0x49a143['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0x1909('0xe')][_0x1909('0xf')](util[_0x1909('0x9')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x1909('0xe')][_0x1909('0x10')][_0x1909('0x11')]});})[_0x1909('0xd')](function(_0x2a2cc7){if(!_0x2a2cc7[0x0]['num']){return analyticExtractedReport(_0x1909('0x12'));}var _0x6297fa=[];var _0x1aca4d=0x0;if(_0x49a143[_0x1909('0xc')]){if(_0x2a2cc7&&_0x2a2cc7[_0x1909('0x13')]){var _0x572136=_[_0x1909('0x14')](_0x2a2cc7[0x0][_0x1909('0x15')]/_0x4d6831);var _0x5f4c3a=Number[_0x1909('0x16')](_0x2a2cc7[0x0]['num']/_0x4d6831)?_0x2a2cc7[0x0][_0x1909('0x15')]%_0x4d6831:0x0;_0x572136[_0x1909('0x17')](function(_0x2b5ee1){if(_0x2b5ee1>0x0){_0x1aca4d+=_0x4d6831;}_0x6297fa[_0x1909('0x18')](dbH[_0x1909('0xe')][_0x1909('0xf')](util[_0x1909('0x9')](_0x1909('0x19'),QUERY,_0x4d6831,_0x1aca4d),{'type':dbH[_0x1909('0xe')][_0x1909('0x10')][_0x1909('0x11')]}));});if(_0x5f4c3a>0x0){_0x1aca4d+=_0x4d6831;_0x6297fa[_0x1909('0x18')](dbH[_0x1909('0xe')][_0x1909('0xf')](util['format'](_0x1909('0x19'),QUERY,_0x5f4c3a,_0x1aca4d),{'type':dbH[_0x1909('0xe')][_0x1909('0x10')][_0x1909('0x11')]}));}}}else{_0x6297fa[_0x1909('0x18')](dbH[_0x1909('0xe')][_0x1909('0xf')](QUERY,{'type':dbH['sequelize'][_0x1909('0x10')][_0x1909('0x11')]}));}var _0x2b6cff=path['dirname'](PATH);var _0x578c5f=path[_0x1909('0x1a')](PATH,_0x1909('0x1b'));var _0x49f536=_0x49a143['split']&&_0x6297fa[_0x1909('0x13')]>0x1;var _0x2a3e87=[];if(!fs[_0x1909('0x1c')](path[_0x1909('0x1d')](_0x2b6cff,_0x578c5f))&&_0x49f536){fs[_0x1909('0x1e')](path['join'](_0x2b6cff,_0x578c5f));}return BPromise['each'](_0x6297fa,function(_0x309ea8){_0x2a3e87[_0x1909('0x18')](_0x309ea8);})[_0x1909('0xd')](function(){for(var _0x461b7f=0x0;_0x461b7f<_0x2a3e87[_0x1909('0x13')];_0x461b7f+=0x1){var _0x2d1009;var _0xaa5af2=_0x2a3e87[_0x461b7f];if(_0x49f536){_0x2d1009=path['join'](_0x2b6cff,_0x578c5f,util['format'](_0x1909('0x1f'),_0x578c5f,_0x461b7f,'xlsx'));}else{_0x2d1009=path[_0x1909('0x1d')](_0x2b6cff,util[_0x1909('0x9')](_0x1909('0x20'),_0x578c5f,_0x1909('0x21')));}fs[_0x1909('0x22')](_0x2d1009,json2xls(_0xaa5af2),'binary');}})[_0x1909('0xd')](function(){if(_0x49f536){return new Promise(function(_0x5f042f){zipdir(path[_0x1909('0x1d')](_0x2b6cff,_0x578c5f),{'saveTo':path[_0x1909('0x1d')](_0x2b6cff,util[_0x1909('0x9')](_0x1909('0x20'),_0x578c5f,_0x1909('0x23')))},function(_0x24b8bf,_0x21feb6){rimraf(path[_0x1909('0x1d')](_0x2b6cff,_0x578c5f),function(){});_0x5f042f(_0x1909('0x24'));});});}})[_0x1909('0xd')](function(){logger[_0x1909('0x8')](util[_0x1909('0x9')](_0x1909('0x25'),EXTRACTED_REPORT_ID,_0x1909('0xa')));return analyticExtractedReport(_0x1909('0x26'),_0x49f536?util['format']('%s.%s',_0x578c5f,_0x49f536?_0x1909('0x23'):_0x1909('0x21')):null);});})[_0x1909('0x27')](function(_0x4754b8){logger[_0x1909('0x8')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1909('0xa')),util[_0x1909('0x28')](_0x4754b8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1909('0x29'));})[_0x1909('0x2a')](function(){process[_0x1909('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index a7330d2..50fc4c7 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 _0xbe98=['app','appType','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','catch','lodash','util','models','Interval','findAll','intervals','VoiceExtension','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','extensions','extension','find','type','CDR(type)=%s','context','VoiceExtensionId','inbound','Set','CDR(routeid)=','outbound','push','CDR(destination)=','cutdigits','${EXTEN}','priority','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','hasOwnProperty','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf'];(function(_0x3ea876,_0x4f626f){var _0x475b55=function(_0x431d57){while(--_0x431d57){_0x3ea876['push'](_0x3ea876['shift']());}};_0x475b55(++_0x4f626f);}(_0xbe98,0x1be));var _0x8be9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbe98[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8be9('0x0'));var util=require(_0x8be9('0x1'));function rewrite(_0x22d833,_0x14d503){var _0x3fdce2=this;return _0x22d833[_0x8be9('0x2')][_0x8be9('0x3')][_0x8be9('0x4')]({'raw':!![]})['then'](function(_0x2b846a){_0x3fdce2[_0x8be9('0x5')]=_0x2b846a;return _0x22d833[_0x8be9('0x2')][_0x8be9('0x6')][_0x8be9('0x4')]({'where':{'IntervalId':_0x14d503['IntervalId']},'raw':!![]});})[_0x8be9('0x7')](function(_0xc79412){return _0x22d833[_0x8be9('0x2')][_0x8be9('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x8be9('0x8')](_[_0x8be9('0x9')](_0xc79412,_0x8be9('0xa')))}},'order':[{'raw':_0x8be9('0xb')}],'raw':!![]});})[_0x8be9('0x7')](function(_0x2a06c2){var _0x8bf9c0=_[_0x8be9('0xc')](_0x2a06c2,{'priority':'1'});var _0x510f71=_[_0x8be9('0xc')](_0x2a06c2,{'isApp':0x1});var _0x545de2=_[_0x8be9('0xd')](_0x510f71,_0x8be9('0xa'));var _0x17d460=['queue',_0x8be9('0xe')];var _0x4c6da5=[];var _0x54c827=[];for(var _0x1edd81 in _0x545de2){if(_0x545de2['hasOwnProperty'](_0x1edd81)){_0x3fdce2['priority']=0x2;_0x3fdce2[_0x8be9('0xf')]=[];_0x3fdce2[_0x8be9('0x10')]=_[_0x8be9('0x11')](_0x8bf9c0,{'exten':_0x545de2[_0x1edd81][0x0][_0x8be9('0xa')]});_0x3fdce2[_0x8be9('0xf')]['push']({'type':_0x545de2[_0x1edd81][0x0][_0x8be9('0x12')],'app':'Set','appdata':util['format'](_0x8be9('0x13'),_0x545de2[_0x1edd81][0x0][_0x8be9('0x12')]),'context':_0x545de2[_0x1edd81][0x0][_0x8be9('0x14')],'exten':_0x545de2[_0x1edd81][0x0][_0x8be9('0xa')],'priority':_0x3fdce2['priority']++,'VoiceExtensionId':_0x545de2[_0x1edd81][0x0][_0x8be9('0x15')]});if(_0x545de2[_0x1edd81][0x0][_0x8be9('0x12')]===_0x8be9('0x16')){_0x3fdce2[_0x8be9('0xf')]['push']({'type':_0x545de2[_0x1edd81][0x0][_0x8be9('0x12')],'app':_0x8be9('0x17'),'appdata':_0x8be9('0x18')+_0x545de2[_0x1edd81][0x0][_0x8be9('0x15')],'context':_0x545de2[_0x1edd81][0x0]['context'],'exten':_0x545de2[_0x1edd81][0x0][_0x8be9('0xa')],'priority':_0x3fdce2['priority']++,'VoiceExtensionId':_0x545de2[_0x1edd81][0x0][_0x8be9('0x15')]});}else if(_0x545de2[_0x1edd81][0x0]['type']===_0x8be9('0x19')){if(_0x3fdce2[_0x8be9('0x10')]){_0x3fdce2[_0x8be9('0xf')][_0x8be9('0x1a')]({'type':_0x545de2[_0x1edd81][0x0]['type'],'app':_0x8be9('0x17'),'appdata':_0x8be9('0x1b')+(_0x3fdce2['extension'][_0x8be9('0x1c')]?'${EXTEN:'+_0x3fdce2['extension'][_0x8be9('0x1c')]+'}':_0x8be9('0x1d')),'context':_0x545de2[_0x1edd81][0x0][_0x8be9('0x14')],'exten':_0x545de2[_0x1edd81][0x0]['exten'],'priority':_0x3fdce2[_0x8be9('0x1e')]++,'VoiceExtensionId':_0x545de2[_0x1edd81][0x0][_0x8be9('0x15')]});}_0x3fdce2[_0x8be9('0xf')]['push']({'type':_0x545de2[_0x1edd81][0x0][_0x8be9('0x12')],'app':_0x8be9('0x17'),'appdata':'CDR(routeid)='+_0x545de2[_0x1edd81][0x0][_0x8be9('0x15')],'context':_0x545de2[_0x1edd81][0x0][_0x8be9('0x14')],'exten':_0x545de2[_0x1edd81][0x0][_0x8be9('0xa')],'priority':_0x3fdce2[_0x8be9('0x1e')]++,'VoiceExtensionId':_0x545de2[_0x1edd81][0x0][_0x8be9('0x15')]});var _0x178f3f=_0x3fdce2['priority']++;_0x3fdce2[_0x8be9('0xf')][_0x8be9('0x1a')]({'type':_0x545de2[_0x1edd81][0x0][_0x8be9('0x12')],'app':_0x8be9('0x1f'),'appdata':_0x8be9('0x20')+(_0x178f3f+0x2)+'):Goto('+(_0x178f3f+0x1)+')','context':_0x545de2[_0x1edd81][0x0][_0x8be9('0x14')],'exten':_0x545de2[_0x1edd81][0x0][_0x8be9('0xa')],'priority':_0x178f3f,'VoiceExtensionId':_0x545de2[_0x1edd81][0x0][_0x8be9('0x15')]});if(_0x3fdce2[_0x8be9('0x10')]){_0x3fdce2[_0x8be9('0xf')][_0x8be9('0x1a')]({'type':_0x545de2[_0x1edd81][0x0]['type'],'app':_0x8be9('0x17'),'appdata':_0x3fdce2['extension'][_0x8be9('0x1c')]?_0x8be9('0x21')+_0x3fdce2[_0x8be9('0x10')][_0x8be9('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0x545de2[_0x1edd81][0x0][_0x8be9('0x14')],'exten':_0x545de2[_0x1edd81][0x0][_0x8be9('0xa')],'priority':_0x3fdce2[_0x8be9('0x1e')]++,'VoiceExtensionId':_0x545de2[_0x1edd81][0x0]['VoiceExtensionId']});}_0x3fdce2[_0x8be9('0xf')][_0x8be9('0x1a')]({'type':_0x545de2[_0x1edd81][0x0][_0x8be9('0x12')],'app':_0x8be9('0x17'),'appdata':_0x8be9('0x22')+_0x545de2[_0x1edd81][0x0][_0x8be9('0x15')],'context':_0x545de2[_0x1edd81][0x0][_0x8be9('0x14')],'exten':_0x545de2[_0x1edd81][0x0]['exten'],'priority':_0x3fdce2[_0x8be9('0x1e')]++,'VoiceExtensionId':_0x545de2[_0x1edd81][0x0][_0x8be9('0x15')]});if(_0x3fdce2[_0x8be9('0x10')]&&_0x3fdce2[_0x8be9('0x10')]['hasOwnProperty']('recordingFormat')&&_0x3fdce2[_0x8be9('0x10')][_0x8be9('0x23')]!==_0x8be9('0x24')){_0x3fdce2['extensions'][_0x8be9('0x1a')]({'type':_0x545de2[_0x1edd81][0x0][_0x8be9('0x12')],'app':'Set','appdata':_0x8be9('0x25'),'context':_0x545de2[_0x1edd81][0x0][_0x8be9('0x14')],'exten':_0x545de2[_0x1edd81][0x0][_0x8be9('0xa')],'priority':_0x3fdce2[_0x8be9('0x1e')]++,'VoiceExtensionId':_0x545de2[_0x1edd81][0x0][_0x8be9('0x15')]});_0x3fdce2[_0x8be9('0xf')]['push']({'type':_0x545de2[_0x1edd81][0x0][_0x8be9('0x12')],'app':'Set','appdata':_0x8be9('0x26')+_0x3fdce2['extension']['recordingFormat']||_0x8be9('0x27'),'context':_0x545de2[_0x1edd81][0x0][_0x8be9('0x14')],'exten':_0x545de2[_0x1edd81][0x0][_0x8be9('0xa')],'priority':_0x3fdce2['priority']++,'VoiceExtensionId':_0x545de2[_0x1edd81][0x0][_0x8be9('0x15')]});}}_0x3fdce2[_0x8be9('0xf')][_0x8be9('0x1a')]({'type':_0x545de2[_0x1edd81][0x0]['type'],'app':'Set','appdata':_0x8be9('0x28'),'context':_0x545de2[_0x1edd81][0x0][_0x8be9('0x14')],'exten':_0x545de2[_0x1edd81][0x0]['exten'],'priority':_0x3fdce2[_0x8be9('0x1e')]++,'VoiceExtensionId':_0x545de2[_0x1edd81][0x0][_0x8be9('0x15')]});_0x3fdce2[_0x8be9('0xf')][_0x8be9('0x1a')]({'type':_0x545de2[_0x1edd81][0x0][_0x8be9('0x12')],'app':_0x8be9('0x17'),'appdata':_0x8be9('0x29'),'context':_0x545de2[_0x1edd81][0x0][_0x8be9('0x14')],'exten':_0x545de2[_0x1edd81][0x0]['exten'],'priority':_0x3fdce2[_0x8be9('0x1e')]++,'VoiceExtensionId':_0x545de2[_0x1edd81][0x0][_0x8be9('0x15')]});_0x3fdce2[_0x8be9('0xf')][_0x8be9('0x1a')]({'type':_0x545de2[_0x1edd81][0x0][_0x8be9('0x12')],'app':_0x8be9('0x17'),'appdata':_0x8be9('0x2a'),'context':_0x545de2[_0x1edd81][0x0][_0x8be9('0x14')],'exten':_0x545de2[_0x1edd81][0x0][_0x8be9('0xa')],'priority':_0x3fdce2[_0x8be9('0x1e')]++,'VoiceExtensionId':_0x545de2[_0x1edd81][0x0][_0x8be9('0x15')]});for(var _0x4f396e=0x0,_0x170942=0x0;_0x4f396e<_0x545de2[_0x1edd81]['length'];_0x4f396e+=0x1,_0x170942=0x0){var _0x2d4847=_0x545de2[_0x1edd81][_0x4f396e];if(_0x2d4847[_0x8be9('0x12')]){_0x2d4847[_0x8be9('0x12')]=_0x2d4847[_0x8be9('0x12')][_0x8be9('0x2b')]();}var _0x227901=[];var _0x4f5685=[];delete _0x2d4847['id'];delete _0x2d4847[_0x8be9('0x2c')];delete _0x2d4847[_0x8be9('0x2d')];var _0x4b5678=_0x2d4847[_0x8be9('0x2e')]!==_0x8be9('0x2f')?[_0x2d4847['interval']]:_0x2d4847[_0x8be9('0x30')]?_['map'](_[_0x8be9('0xc')](_0x3fdce2[_0x8be9('0x5')],{'IntervalId':_0x2d4847[_0x8be9('0x30')]}),_0x8be9('0x2e')):[];if(_0x2d4847[_0x8be9('0x31')](_0x8be9('0x32'))){if(_0x2d4847[_0x8be9('0x32')]&&_0x2d4847[_0x8be9('0x32')]!=='--'){_0x227901['push']({'type':_0x2d4847[_0x8be9('0x12')],'app':_0x8be9('0x17'),'appdata':_0x8be9('0x33')+_0x2d4847[_0x8be9('0x32')],'context':_0x2d4847[_0x8be9('0x14')],'exten':_0x2d4847['exten'],'priority':_0x4b5678[_0x8be9('0x34')]+_0x3fdce2['priority']+_0x170942++,'VoiceExtensionId':_0x2d4847[_0x8be9('0x15')]});}}if(_0x2d4847[_0x8be9('0x12')]===_0x8be9('0x19')&&_0x2d4847['hasOwnProperty']('callerID')){if(_0x2d4847[_0x8be9('0x35')]){_0x227901[_0x8be9('0x1a')]({'type':_0x2d4847[_0x8be9('0x12')],'app':_0x8be9('0x1f'),'appdata':_0x8be9('0x36')+_0x2d4847[_0x8be9('0x35')]+')','context':_0x2d4847[_0x8be9('0x14')],'exten':_0x2d4847[_0x8be9('0xa')],'priority':_0x4b5678[_0x8be9('0x34')]+_0x3fdce2['priority']+_0x170942++,'VoiceExtensionId':_0x2d4847[_0x8be9('0x15')]});}else{_0x227901['push']({'type':_0x2d4847[_0x8be9('0x12')],'app':_0x8be9('0x1f'),'appdata':_0x8be9('0x37'),'context':_0x2d4847['context'],'exten':_0x2d4847['exten'],'priority':_0x4b5678['length']+_0x3fdce2[_0x8be9('0x1e')]+_0x170942++,'VoiceExtensionId':_0x2d4847['VoiceExtensionId']});}}if(_0x2d4847[_0x8be9('0x31')](_0x8be9('0x38'))){if(_0x17d460[_0x8be9('0x39')](_0x2d4847[_0x8be9('0x3a')]['toLowerCase']())>=0x0&&_0x2d4847[_0x8be9('0x3b')]!=='custom'){if(_0x2d4847[_0x8be9('0x38')]){_0x227901[_0x8be9('0x1a')]({'type':_0x2d4847['type'],'app':_0x8be9('0x1f'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2d4847['context'],'exten':_0x2d4847[_0x8be9('0xa')],'priority':_0x4b5678['length']+_0x3fdce2[_0x8be9('0x1e')]+_0x170942++,'VoiceExtensionId':_0x2d4847[_0x8be9('0x15')]});_0x227901[_0x8be9('0x1a')]({'type':_0x2d4847[_0x8be9('0x12')],'app':_0x8be9('0x17'),'appdata':_0x8be9('0x3c'),'context':_0x2d4847[_0x8be9('0x14')],'exten':_0x2d4847[_0x8be9('0xa')],'priority':_0x4b5678['length']+_0x3fdce2['priority']+_0x170942++,'VoiceExtensionId':_0x2d4847[_0x8be9('0x15')]});}else{_0x227901[_0x8be9('0x1a')]({'type':_0x2d4847[_0x8be9('0x12')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2d4847[_0x8be9('0x14')],'exten':_0x2d4847['exten'],'priority':_0x4b5678[_0x8be9('0x34')]+_0x3fdce2[_0x8be9('0x1e')]+_0x170942++,'VoiceExtensionId':_0x2d4847[_0x8be9('0x15')]});_0x227901['push']({'type':_0x2d4847['type'],'app':_0x8be9('0x17'),'appdata':_0x8be9('0x3d'),'context':_0x2d4847[_0x8be9('0x14')],'exten':_0x2d4847[_0x8be9('0xa')],'priority':_0x4b5678[_0x8be9('0x34')]+_0x3fdce2[_0x8be9('0x1e')]+_0x170942++,'VoiceExtensionId':_0x2d4847[_0x8be9('0x15')]});}}}for(var _0x5d633e=0x0;_0x5d633e<_0x4b5678['length'];_0x5d633e+=0x1){var _0x2550f3=_0x3fdce2[_0x8be9('0x1e')]+_0x4b5678['length'];var _0x433082=_0x5d633e===_0x4b5678['length']-0x1?_0x3fdce2[_0x8be9('0x1e')]+_0x227901[_0x8be9('0x34')]+_0x4f5685[_0x8be9('0x34')]+0x2:_0x3fdce2[_0x8be9('0x1e')]+_0x5d633e+0x1;_0x227901[_0x8be9('0x3e')](_0x5d633e,0x0,{'type':_0x2d4847[_0x8be9('0x12')],'app':_0x8be9('0x3f'),'appdata':_0x4b5678[_0x5d633e]+'?'+_0x2d4847[_0x8be9('0x14')]+_0x8be9('0x40')+_0x2550f3+':'+_0x2d4847[_0x8be9('0x14')]+_0x8be9('0x40')+_0x433082,'exten':_0x2d4847['exten'],'context':_0x2d4847[_0x8be9('0x14')],'priority':_0x3fdce2['priority']+_0x5d633e,'VoiceExtensionId':_0x545de2[_0x1edd81][0x0][_0x8be9('0x15')]});}_0x2d4847[_0x8be9('0x1e')]=_0x227901['length']?_[_0x8be9('0x41')](_0x227901)[_0x8be9('0x1e')]+0x1:_0x3fdce2[_0x8be9('0x1e')];_0x3fdce2['priority']=(_0x4f5685['length']?_['last'](_0x4f5685)[_0x8be9('0x1e')]:_0x2d4847[_0x8be9('0x1e')])+0x1;_0x3fdce2[_0x8be9('0xf')]=_[_0x8be9('0x42')](_0x3fdce2['extensions'],_0x227901,[_0x2d4847],_0x4f5685);}_0x3fdce2[_0x8be9('0xf')][_0x8be9('0x1a')]({'type':_0x545de2[_0x1edd81][0x0][_0x8be9('0x12')],'app':_0x8be9('0x43'),'exten':_0x545de2[_0x1edd81][0x0][_0x8be9('0xa')],'context':_0x545de2[_0x1edd81][0x0]['context'],'priority':_0x3fdce2[_0x8be9('0x1e')],'VoiceExtensionId':_0x545de2[_0x1edd81][0x0][_0x8be9('0x15')]});_0x4c6da5[_0x8be9('0x1a')](_0x545de2[_0x1edd81][0x0][_0x8be9('0x15')]);_0x54c827=_[_0x8be9('0x42')](_0x54c827,_0x3fdce2['extensions']);}}return _0x22d833[_0x8be9('0x44')](function(_0x4fff24){return _0x22d833['models'][_0x8be9('0x6')][_0x8be9('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x4c6da5}},'transaction':_0x4fff24})['then'](function(_0x3a44de){return _0x22d833[_0x8be9('0x2')][_0x8be9('0x6')][_0x8be9('0x46')](_['sortBy'](_0x54c827,_0x8be9('0x1e')),{'transaction':_0x4fff24});});});})[_0x8be9('0x47')](function(_0x339e21){console['error'](_0x339e21);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x4fc4=['then','bulkCreate','error','rewrite','lodash','util','models','Interval','findAll','intervals','VoiceExtension','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','extensions','find','push','type','Set','format','CDR(type)=%s','priority','VoiceExtensionId','inbound','CDR(routeid)=','outbound','extension','CDR(destination)=','${EXTEN:','${EXTEN}','context','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','updatedAt','interval','*,*,*,*','hasOwnProperty','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','app','appType','custom','answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','Hangup','concat','transaction','destroy'];(function(_0x5eb4df,_0x1acb35){var _0x24ed03=function(_0x25982c){while(--_0x25982c){_0x5eb4df['push'](_0x5eb4df['shift']());}};_0x24ed03(++_0x1acb35);}(_0x4fc4,0x190));var _0x44fc=function(_0x22e6ff,_0x5a0ff8){_0x22e6ff=_0x22e6ff-0x0;var _0x106557=_0x4fc4[_0x22e6ff];return _0x106557;};'use strict';var _=require(_0x44fc('0x0'));var util=require(_0x44fc('0x1'));function rewrite(_0x13082e,_0x575f2a){var _0x2fcca7=this;return _0x13082e[_0x44fc('0x2')][_0x44fc('0x3')][_0x44fc('0x4')]({'raw':!![]})['then'](function(_0x2de01e){_0x2fcca7[_0x44fc('0x5')]=_0x2de01e;return _0x13082e[_0x44fc('0x2')][_0x44fc('0x6')]['findAll']({'where':{'IntervalId':_0x575f2a[_0x44fc('0x7')]},'raw':!![]});})['then'](function(_0x52b050){return _0x13082e[_0x44fc('0x2')]['VoiceExtension'][_0x44fc('0x4')]({'where':{'exten':{'$in':_['uniq'](_[_0x44fc('0x8')](_0x52b050,_0x44fc('0x9')))}},'order':[{'raw':_0x44fc('0xa')}],'raw':!![]});})['then'](function(_0xa30972){var _0x1c4506=_[_0x44fc('0xb')](_0xa30972,{'priority':'1'});var _0xe909a2=_['filter'](_0xa30972,{'isApp':0x1});var _0x2c8742=_['groupBy'](_0xe909a2,'exten');var _0x3fe730=['queue','playback'];var _0x3f19c0=[];var _0x4288fc=[];for(var _0x277319 in _0x2c8742){if(_0x2c8742['hasOwnProperty'](_0x277319)){_0x2fcca7['priority']=0x2;_0x2fcca7[_0x44fc('0xc')]=[];_0x2fcca7['extension']=_[_0x44fc('0xd')](_0x1c4506,{'exten':_0x2c8742[_0x277319][0x0][_0x44fc('0x9')]});_0x2fcca7['extensions'][_0x44fc('0xe')]({'type':_0x2c8742[_0x277319][0x0][_0x44fc('0xf')],'app':_0x44fc('0x10'),'appdata':util[_0x44fc('0x11')](_0x44fc('0x12'),_0x2c8742[_0x277319][0x0]['type']),'context':_0x2c8742[_0x277319][0x0]['context'],'exten':_0x2c8742[_0x277319][0x0]['exten'],'priority':_0x2fcca7[_0x44fc('0x13')]++,'VoiceExtensionId':_0x2c8742[_0x277319][0x0][_0x44fc('0x14')]});if(_0x2c8742[_0x277319][0x0][_0x44fc('0xf')]===_0x44fc('0x15')){_0x2fcca7[_0x44fc('0xc')][_0x44fc('0xe')]({'type':_0x2c8742[_0x277319][0x0][_0x44fc('0xf')],'app':'Set','appdata':_0x44fc('0x16')+_0x2c8742[_0x277319][0x0][_0x44fc('0x14')],'context':_0x2c8742[_0x277319][0x0]['context'],'exten':_0x2c8742[_0x277319][0x0][_0x44fc('0x9')],'priority':_0x2fcca7[_0x44fc('0x13')]++,'VoiceExtensionId':_0x2c8742[_0x277319][0x0][_0x44fc('0x14')]});}else if(_0x2c8742[_0x277319][0x0][_0x44fc('0xf')]===_0x44fc('0x17')){if(_0x2fcca7[_0x44fc('0x18')]){_0x2fcca7[_0x44fc('0xc')][_0x44fc('0xe')]({'type':_0x2c8742[_0x277319][0x0][_0x44fc('0xf')],'app':'Set','appdata':_0x44fc('0x19')+(_0x2fcca7['extension']['cutdigits']?_0x44fc('0x1a')+_0x2fcca7[_0x44fc('0x18')]['cutdigits']+'}':_0x44fc('0x1b')),'context':_0x2c8742[_0x277319][0x0][_0x44fc('0x1c')],'exten':_0x2c8742[_0x277319][0x0][_0x44fc('0x9')],'priority':_0x2fcca7[_0x44fc('0x13')]++,'VoiceExtensionId':_0x2c8742[_0x277319][0x0][_0x44fc('0x14')]});}_0x2fcca7[_0x44fc('0xc')][_0x44fc('0xe')]({'type':_0x2c8742[_0x277319][0x0][_0x44fc('0xf')],'app':'Set','appdata':_0x44fc('0x16')+_0x2c8742[_0x277319][0x0]['VoiceExtensionId'],'context':_0x2c8742[_0x277319][0x0][_0x44fc('0x1c')],'exten':_0x2c8742[_0x277319][0x0]['exten'],'priority':_0x2fcca7[_0x44fc('0x13')]++,'VoiceExtensionId':_0x2c8742[_0x277319][0x0]['VoiceExtensionId']});var _0xadbf65=_0x2fcca7[_0x44fc('0x13')]++;_0x2fcca7[_0x44fc('0xc')][_0x44fc('0xe')]({'type':_0x2c8742[_0x277319][0x0]['type'],'app':_0x44fc('0x1d'),'appdata':_0x44fc('0x1e')+(_0xadbf65+0x2)+'):Goto('+(_0xadbf65+0x1)+')','context':_0x2c8742[_0x277319][0x0][_0x44fc('0x1c')],'exten':_0x2c8742[_0x277319][0x0][_0x44fc('0x9')],'priority':_0xadbf65,'VoiceExtensionId':_0x2c8742[_0x277319][0x0]['VoiceExtensionId']});if(_0x2fcca7['extension']){_0x2fcca7[_0x44fc('0xc')][_0x44fc('0xe')]({'type':_0x2c8742[_0x277319][0x0][_0x44fc('0xf')],'app':_0x44fc('0x10'),'appdata':_0x2fcca7[_0x44fc('0x18')][_0x44fc('0x1f')]?_0x44fc('0x20')+_0x2fcca7['extension'][_0x44fc('0x1f')]+'}':'CDR(prefix)=noprefix','context':_0x2c8742[_0x277319][0x0]['context'],'exten':_0x2c8742[_0x277319][0x0][_0x44fc('0x9')],'priority':_0x2fcca7[_0x44fc('0x13')]++,'VoiceExtensionId':_0x2c8742[_0x277319][0x0][_0x44fc('0x14')]});}_0x2fcca7[_0x44fc('0xc')]['push']({'type':_0x2c8742[_0x277319][0x0][_0x44fc('0xf')],'app':_0x44fc('0x10'),'appdata':'outboundrouteid='+_0x2c8742[_0x277319][0x0][_0x44fc('0x14')],'context':_0x2c8742[_0x277319][0x0][_0x44fc('0x1c')],'exten':_0x2c8742[_0x277319][0x0][_0x44fc('0x9')],'priority':_0x2fcca7['priority']++,'VoiceExtensionId':_0x2c8742[_0x277319][0x0][_0x44fc('0x14')]});if(_0x2fcca7[_0x44fc('0x18')]&&_0x2fcca7[_0x44fc('0x18')]['hasOwnProperty'](_0x44fc('0x21'))&&_0x2fcca7[_0x44fc('0x18')][_0x44fc('0x21')]!==_0x44fc('0x22')){_0x2fcca7[_0x44fc('0xc')][_0x44fc('0xe')]({'type':_0x2c8742[_0x277319][0x0][_0x44fc('0xf')],'app':_0x44fc('0x10'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x2c8742[_0x277319][0x0]['context'],'exten':_0x2c8742[_0x277319][0x0][_0x44fc('0x9')],'priority':_0x2fcca7[_0x44fc('0x13')]++,'VoiceExtensionId':_0x2c8742[_0x277319][0x0][_0x44fc('0x14')]});_0x2fcca7['extensions'][_0x44fc('0xe')]({'type':_0x2c8742[_0x277319][0x0][_0x44fc('0xf')],'app':_0x44fc('0x10'),'appdata':_0x44fc('0x23')+_0x2fcca7[_0x44fc('0x18')]['recordingFormat']||'wav','context':_0x2c8742[_0x277319][0x0][_0x44fc('0x1c')],'exten':_0x2c8742[_0x277319][0x0][_0x44fc('0x9')],'priority':_0x2fcca7[_0x44fc('0x13')]++,'VoiceExtensionId':_0x2c8742[_0x277319][0x0][_0x44fc('0x14')]});}}_0x2fcca7[_0x44fc('0xc')][_0x44fc('0xe')]({'type':_0x2c8742[_0x277319][0x0][_0x44fc('0xf')],'app':'Set','appdata':_0x44fc('0x24'),'context':_0x2c8742[_0x277319][0x0]['context'],'exten':_0x2c8742[_0x277319][0x0]['exten'],'priority':_0x2fcca7[_0x44fc('0x13')]++,'VoiceExtensionId':_0x2c8742[_0x277319][0x0]['VoiceExtensionId']});_0x2fcca7['extensions'][_0x44fc('0xe')]({'type':_0x2c8742[_0x277319][0x0][_0x44fc('0xf')],'app':_0x44fc('0x10'),'appdata':_0x44fc('0x25'),'context':_0x2c8742[_0x277319][0x0][_0x44fc('0x1c')],'exten':_0x2c8742[_0x277319][0x0][_0x44fc('0x9')],'priority':_0x2fcca7['priority']++,'VoiceExtensionId':_0x2c8742[_0x277319][0x0][_0x44fc('0x14')]});_0x2fcca7[_0x44fc('0xc')][_0x44fc('0xe')]({'type':_0x2c8742[_0x277319][0x0]['type'],'app':_0x44fc('0x10'),'appdata':_0x44fc('0x26'),'context':_0x2c8742[_0x277319][0x0][_0x44fc('0x1c')],'exten':_0x2c8742[_0x277319][0x0][_0x44fc('0x9')],'priority':_0x2fcca7[_0x44fc('0x13')]++,'VoiceExtensionId':_0x2c8742[_0x277319][0x0]['VoiceExtensionId']});for(var _0x135ee0=0x0,_0x3bc7f3=0x0;_0x135ee0<_0x2c8742[_0x277319][_0x44fc('0x27')];_0x135ee0+=0x1,_0x3bc7f3=0x0){var _0x31aedb=_0x2c8742[_0x277319][_0x135ee0];if(_0x31aedb[_0x44fc('0xf')]){_0x31aedb[_0x44fc('0xf')]=_0x31aedb[_0x44fc('0xf')]['toLowerCase']();}var _0x251c39=[];var _0x1af85f=[];delete _0x31aedb['id'];delete _0x31aedb['createdAt'];delete _0x31aedb[_0x44fc('0x28')];var _0x3cb233=_0x31aedb[_0x44fc('0x29')]!==_0x44fc('0x2a')?[_0x31aedb[_0x44fc('0x29')]]:_0x31aedb[_0x44fc('0x7')]?_[_0x44fc('0x8')](_[_0x44fc('0xb')](_0x2fcca7['intervals'],{'IntervalId':_0x31aedb[_0x44fc('0x7')]}),_0x44fc('0x29')):[];if(_0x31aedb[_0x44fc('0x2b')]('tag')){if(_0x31aedb[_0x44fc('0x2c')]&&_0x31aedb['tag']!=='--'){_0x251c39['push']({'type':_0x31aedb[_0x44fc('0xf')],'app':'Set','appdata':_0x44fc('0x2d')+_0x31aedb['tag'],'context':_0x31aedb[_0x44fc('0x1c')],'exten':_0x31aedb[_0x44fc('0x9')],'priority':_0x3cb233[_0x44fc('0x27')]+_0x2fcca7['priority']+_0x3bc7f3++,'VoiceExtensionId':_0x31aedb['VoiceExtensionId']});}}if(_0x31aedb[_0x44fc('0xf')]===_0x44fc('0x17')&&_0x31aedb[_0x44fc('0x2b')](_0x44fc('0x2e'))){if(_0x31aedb[_0x44fc('0x2e')]){_0x251c39[_0x44fc('0xe')]({'type':_0x31aedb[_0x44fc('0xf')],'app':_0x44fc('0x1d'),'appdata':_0x44fc('0x2f')+_0x31aedb[_0x44fc('0x2e')]+')','context':_0x31aedb[_0x44fc('0x1c')],'exten':_0x31aedb[_0x44fc('0x9')],'priority':_0x3cb233['length']+_0x2fcca7[_0x44fc('0x13')]+_0x3bc7f3++,'VoiceExtensionId':_0x31aedb['VoiceExtensionId']});}else{_0x251c39[_0x44fc('0xe')]({'type':_0x31aedb[_0x44fc('0xf')],'app':'ExecIf','appdata':_0x44fc('0x30'),'context':_0x31aedb[_0x44fc('0x1c')],'exten':_0x31aedb[_0x44fc('0x9')],'priority':_0x3cb233[_0x44fc('0x27')]+_0x2fcca7[_0x44fc('0x13')]+_0x3bc7f3++,'VoiceExtensionId':_0x31aedb[_0x44fc('0x14')]});}}if(_0x31aedb[_0x44fc('0x2b')]('answer')){if(_0x3fe730['indexOf'](_0x31aedb[_0x44fc('0x31')]['toLowerCase']())>=0x0&&_0x31aedb[_0x44fc('0x32')]!==_0x44fc('0x33')){if(_0x31aedb[_0x44fc('0x34')]){_0x251c39[_0x44fc('0xe')]({'type':_0x31aedb[_0x44fc('0xf')],'app':_0x44fc('0x1d'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x31aedb[_0x44fc('0x1c')],'exten':_0x31aedb[_0x44fc('0x9')],'priority':_0x3cb233[_0x44fc('0x27')]+_0x2fcca7[_0x44fc('0x13')]+_0x3bc7f3++,'VoiceExtensionId':_0x31aedb[_0x44fc('0x14')]});_0x251c39[_0x44fc('0xe')]({'type':_0x31aedb['type'],'app':_0x44fc('0x10'),'appdata':_0x44fc('0x35'),'context':_0x31aedb['context'],'exten':_0x31aedb[_0x44fc('0x9')],'priority':_0x3cb233[_0x44fc('0x27')]+_0x2fcca7['priority']+_0x3bc7f3++,'VoiceExtensionId':_0x31aedb[_0x44fc('0x14')]});}else{_0x251c39[_0x44fc('0xe')]({'type':_0x31aedb[_0x44fc('0xf')],'app':_0x44fc('0x1d'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x31aedb[_0x44fc('0x1c')],'exten':_0x31aedb[_0x44fc('0x9')],'priority':_0x3cb233[_0x44fc('0x27')]+_0x2fcca7[_0x44fc('0x13')]+_0x3bc7f3++,'VoiceExtensionId':_0x31aedb[_0x44fc('0x14')]});_0x251c39[_0x44fc('0xe')]({'type':_0x31aedb['type'],'app':'Set','appdata':_0x44fc('0x36'),'context':_0x31aedb['context'],'exten':_0x31aedb[_0x44fc('0x9')],'priority':_0x3cb233[_0x44fc('0x27')]+_0x2fcca7[_0x44fc('0x13')]+_0x3bc7f3++,'VoiceExtensionId':_0x31aedb[_0x44fc('0x14')]});}}}for(var _0x58a08b=0x0;_0x58a08b<_0x3cb233['length'];_0x58a08b+=0x1){var _0xce76ff=_0x2fcca7[_0x44fc('0x13')]+_0x3cb233[_0x44fc('0x27')];var _0x585a2b=_0x58a08b===_0x3cb233[_0x44fc('0x27')]-0x1?_0x2fcca7[_0x44fc('0x13')]+_0x251c39[_0x44fc('0x27')]+_0x1af85f[_0x44fc('0x27')]+0x2:_0x2fcca7[_0x44fc('0x13')]+_0x58a08b+0x1;_0x251c39[_0x44fc('0x37')](_0x58a08b,0x0,{'type':_0x31aedb[_0x44fc('0xf')],'app':_0x44fc('0x38'),'appdata':_0x3cb233[_0x58a08b]+'?'+_0x31aedb['context']+_0x44fc('0x39')+_0xce76ff+':'+_0x31aedb[_0x44fc('0x1c')]+',${EXTEN},'+_0x585a2b,'exten':_0x31aedb[_0x44fc('0x9')],'context':_0x31aedb[_0x44fc('0x1c')],'priority':_0x2fcca7[_0x44fc('0x13')]+_0x58a08b,'VoiceExtensionId':_0x2c8742[_0x277319][0x0][_0x44fc('0x14')]});}_0x31aedb[_0x44fc('0x13')]=_0x251c39[_0x44fc('0x27')]?_['last'](_0x251c39)[_0x44fc('0x13')]+0x1:_0x2fcca7[_0x44fc('0x13')];_0x2fcca7[_0x44fc('0x13')]=(_0x1af85f[_0x44fc('0x27')]?_['last'](_0x1af85f)[_0x44fc('0x13')]:_0x31aedb[_0x44fc('0x13')])+0x1;_0x2fcca7[_0x44fc('0xc')]=_['concat'](_0x2fcca7['extensions'],_0x251c39,[_0x31aedb],_0x1af85f);}_0x2fcca7[_0x44fc('0xc')][_0x44fc('0xe')]({'type':_0x2c8742[_0x277319][0x0][_0x44fc('0xf')],'app':_0x44fc('0x3a'),'exten':_0x2c8742[_0x277319][0x0][_0x44fc('0x9')],'context':_0x2c8742[_0x277319][0x0][_0x44fc('0x1c')],'priority':_0x2fcca7[_0x44fc('0x13')],'VoiceExtensionId':_0x2c8742[_0x277319][0x0][_0x44fc('0x14')]});_0x3f19c0['push'](_0x2c8742[_0x277319][0x0][_0x44fc('0x14')]);_0x4288fc=_[_0x44fc('0x3b')](_0x4288fc,_0x2fcca7[_0x44fc('0xc')]);}}return _0x13082e[_0x44fc('0x3c')](function(_0x1468b5){return _0x13082e['models'][_0x44fc('0x6')][_0x44fc('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x3f19c0}},'transaction':_0x1468b5})[_0x44fc('0x3e')](function(_0x401dfb){return _0x13082e['models'][_0x44fc('0x6')][_0x44fc('0x3f')](_['sortBy'](_0x4288fc,'priority'),{'transaction':_0x1468b5});});});})['catch'](function(_0x152988){console[_0x44fc('0x40')](_0x152988);});}exports[_0x44fc('0x41')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 1b1f36a..4b3375c 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 _0x45d5=['inspect','insert','phone','ContactId','createdAt','select','field','NOW()','scheduledAt','toString','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','cm_hopper','\x20=\x20?','into','fromQuery','id\x20IN\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','str','cm_hopper_black','findAll','dialCheckDuplicateType','CmList','Lists','then','get','sequelize','query','VoiceQueueId','catch','onlyIfOpen','all','outbound','BlackLists','Campaign','always','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','ioredis','../../../config/environment','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','split','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','keys','push','pick','stringify','cmContact','checkHopper'];(function(_0x2f3c0e,_0x670d9f){var _0x12c21b=function(_0x378c9d){while(--_0x378c9d){_0x2f3c0e['push'](_0x2f3c0e['shift']());}};_0x12c21b(++_0x670d9f);}(_0x45d5,0xa4));var _0x545d=function(_0x13aab4,_0xb12ce2){_0x13aab4=_0x13aab4-0x0;var _0x2e1826=_0x45d5[_0x13aab4];return _0x2e1826;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x545d('0x0'));var fs=require('fs');var squel=require(_0x545d('0x1'));var Papa=require(_0x545d('0x2'));var Redis=require(_0x545d('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x545d('0x4'));var logger=require('../../../config/logger')('api');config[_0x545d('0x5')]=_[_0x545d('0x6')](config[_0x545d('0x5')],{'host':_0x545d('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x545d('0x8'))[_0x545d('0x9')](socket);try{if(!process[_0x545d('0xa')][0x2]||process[_0x545d('0xa')][0x2]===_0x545d('0xb')||process[_0x545d('0xa')][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x545d('0xa')][0x2];if(!process['argv'][0x3]||process[_0x545d('0xa')][0x3]===_0x545d('0xb')||process[_0x545d('0xa')][0x3]===_0x545d('0xc')||!process[_0x545d('0xa')][0x4]||process[_0x545d('0xa')][0x4]===_0x545d('0xb')||process[_0x545d('0xa')][0x4]===_0x545d('0xc')){throw new Error(_0x545d('0xd'));}var FIELDS=_['zipObject'](process[_0x545d('0xa')][0x3][_0x545d('0xe')](','),process['argv'][0x4]['split'](','));if(!process[_0x545d('0xa')][0x5]||process[_0x545d('0xa')][0x5]==='undefined'||process[_0x545d('0xa')][0x5]===_0x545d('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x545d('0xa')][0x5];var COMPANYID=process[_0x545d('0xa')][0x6]&&process[_0x545d('0xa')][0x6]!==_0x545d('0xb')&&process['argv'][0x6]!==_0x545d('0xc')?process[_0x545d('0xa')][0x6]:null;var DUPLICATES=process[_0x545d('0xa')][0x7]&&process[_0x545d('0xa')][0x7]!==_0x545d('0xb')&&process[_0x545d('0xa')][0x7]!==_0x545d('0xc')?process[_0x545d('0xa')][0x7]:null;if(!process[_0x545d('0xa')][0x8]||process['argv'][0x8]===_0x545d('0xb')||process[_0x545d('0xa')][0x8]===_0x545d('0xc')){throw new Error(_0x545d('0xf'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2db5f3){logger[_0x545d('0x10')](_0x2db5f3);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(_0x16e0d0,_0x19ab93,_0x56c486,_0x9e6f30){var _0x42c083={'message':_0x19ab93};_0x42c083[_0x16e0d0]=!![];if(_0x56c486){_0x42c083[_0x545d('0x11')]=_0x56c486;}if(_0x9e6f30){_0x42c083['index']=_0x9e6f30;}return _0x42c083;}function isEmail(_0x5342d1){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))*$/[_0x545d('0x12')](_0x5342d1);}function checkRow(_0x8a99aa,_0xb11ca4,_0xb9cbd8){return new BPromise(function(_0xd37a41,_0x24f8ef){if(_[_0x545d('0x13')](_0x8a99aa)){return _0x24f8ef(handleCheckRowError(_0x545d('0x10'),_0x545d('0x14'),null,_0xb9cbd8));}if(_0x8a99aa[_0x545d('0x15')]&&_0x8a99aa['errors'][_0x545d('0x16')]){var _0x477a49=_['map'](_0x8a99aa[_0x545d('0x15')],_0x545d('0x17'))[_0x545d('0x18')](';');return _0x24f8ef(handleCheckRowError(_0x545d('0x10'),_0x477a49,null,_0xb9cbd8));}var _0x1e9fd0={};for(var _0x33e8d8 in FIELDS){if(FIELDS[_0x545d('0x19')](_0x33e8d8)&&FIELDS[_0x33e8d8]){_0x1e9fd0[_0x33e8d8]=_0x8a99aa[_0x545d('0x1a')][0x0][FIELDS[_0x33e8d8]]||_0x8a99aa[_0x545d('0x1a')][0x0]['\ufeff'+FIELDS[_0x33e8d8]];}}if(!_0x1e9fd0['firstName']){return _0x24f8ef(handleCheckRowError(_0x545d('0x10'),'firstName\x20not\x20specified!',null,_0xb9cbd8));}if(!_0x1e9fd0['phone']){return _0x24f8ef(handleCheckRowError('error','phone\x20not\x20specified!',null,_0xb9cbd8));}if(_0x1e9fd0['birthDate']){var _0x3c035b=moment(_0x1e9fd0[_0x545d('0x1b')],'YYYY-MM-DD');if(!_0x3c035b[_0x545d('0x1c')]()){return _0x24f8ef(handleCheckRowError('error',_0x545d('0x1d'),null,_0xb9cbd8));}}if(_0x1e9fd0['email']){if(!isEmail(_0x1e9fd0['email'])){return _0x24f8ef(handleCheckRowError(_0x545d('0x10'),'email\x20format\x20is\x20not\x20valid!',null,_0xb9cbd8));}}_0x1e9fd0[_0x545d('0x1e')]=LISTID;_0x1e9fd0[_0x545d('0x1f')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x545d('0x16')]&&_0xb11ca4){var _0x26c7c5={};for(var _0x28cd50=0x0,_0x3213a8=DUPLICATES[_0x545d('0x16')];_0x28cd50<_0x3213a8;_0x28cd50+=0x1){_0x26c7c5[DUPLICATES[_0x28cd50]]=_0x1e9fd0[DUPLICATES[_0x28cd50]];}var _0x3db0fa=_[_0x545d('0x20')](_0xb11ca4,_0x26c7c5);if(_0x3db0fa){return _0x24f8ef(handleCheckRowError(_0x545d('0x21'),_0x545d('0x22'),_0x3db0fa,_0xb9cbd8));}}return db[_0x545d('0x23')]['create'](_0x1e9fd0,{'raw':!![],'hooks':![],'fields':_[_0x545d('0x24')](_0x1e9fd0)})['then'](function(_0x484336){if(DUPLICATES&&DUPLICATES[_0x545d('0x16')]&&_0xb11ca4){_0xb11ca4[_0x545d('0x25')](_[_0x545d('0x26')](_0x1e9fd0,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x484336['id'];return _0xd37a41();})['catch'](function(_0x581bf4){return _0x24f8ef(handleCheckRowError(_0x545d('0x10'),'Error\x20while\x20creating\x20contact:\x20'+(_0x581bf4[_0x545d('0x17')]||JSON[_0x545d('0x27')](_0x581bf4)),null,_0xb9cbd8));});});}function checkHopper(){function _0xc04cff(){return function(_0x577504){logger[_0x545d('0x10')](_0x545d('0x28'),_0x545d('0x29'),util[_0x545d('0x2a')](_0x577504,{'showHidden':![],'depth':null}));};}var _0x1c9d74=function(_0x334195,_0x1d4ea6){var _0x3506c1=squel[_0x545d('0x2b')]()['into']('cm_hopper')['fromQuery']([_0x545d('0x2c'),'scheduledAt',_0x545d('0x2d'),'ListId',_0x1d4ea6,_0x545d('0x2e'),'updatedAt'],squel[_0x545d('0x2f')]()[_0x545d('0x30')](_0x545d('0x2c'),_0x545d('0x2c'))[_0x545d('0x30')](_0x545d('0x31'),_0x545d('0x32'))[_0x545d('0x30')]('id',_0x545d('0x2d'))[_0x545d('0x30')](LISTID[_0x545d('0x33')](),_0x545d('0x1e'))['field'](_0x334195['id'][_0x545d('0x33')](),_0x1d4ea6)[_0x545d('0x30')](_0x545d('0x31'),_0x545d('0x2e'))[_0x545d('0x30')]('NOW()',_0x545d('0x34'))[_0x545d('0x35')](_0x545d('0x36'))[_0x545d('0x37')](_0x545d('0x38'))[_0x545d('0x37')](_0x545d('0x39'),LISTID[_0x545d('0x33')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x545d('0x37')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x545d('0x30')]('phone')[_0x545d('0x35')](_0x545d('0x3a'))['where'](_0x1d4ea6+_0x545d('0x3b'),_0x334195['id'][_0x545d('0x33')]())))[_0x545d('0x33')]();return _0x3506c1;};var _0x26edbd=function(_0x5d423f,_0x496ae0){var _0x25d4c7=squel[_0x545d('0x2b')]()[_0x545d('0x3c')](_0x545d('0x3a'))[_0x545d('0x3d')]([_0x545d('0x2c'),'scheduledAt',_0x545d('0x2d'),_0x545d('0x1e'),_0x496ae0,_0x545d('0x2e'),_0x545d('0x34')],squel[_0x545d('0x2f')]()[_0x545d('0x30')](_0x545d('0x2c'),_0x545d('0x2c'))[_0x545d('0x30')](_0x545d('0x31'),_0x545d('0x32'))['field']('id',_0x545d('0x2d'))[_0x545d('0x30')](LISTID[_0x545d('0x33')](),'ListId')['field'](_0x5d423f['id'][_0x545d('0x33')](),_0x496ae0)[_0x545d('0x30')]('NOW()',_0x545d('0x2e'))[_0x545d('0x30')](_0x545d('0x31'),'updatedAt')[_0x545d('0x35')]('cm_contacts')[_0x545d('0x37')](_0x545d('0x38'))['where'](_0x545d('0x39'),LISTID[_0x545d('0x33')]())[_0x545d('0x37')](_0x545d('0x3e'),squel['str'](hopperContacts))[_0x545d('0x37')](_0x545d('0x3f'))[_0x545d('0x37')](_0x545d('0x40'),squel[_0x545d('0x2f')]()[_0x545d('0x30')](_0x545d('0x41'))['from'](_0x545d('0x42'))[_0x545d('0x37')](_0x496ae0+_0x545d('0x3b'),_0x5d423f['id'][_0x545d('0x33')]()))[_0x545d('0x37')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x545d('0x30')](_0x545d('0x2c'))[_0x545d('0x35')](_0x545d('0x3a'))[_0x545d('0x37')](_0x496ae0+_0x545d('0x3b'),_0x5d423f['id'][_0x545d('0x33')]())))['toString']();return _0x25d4c7;};function _0x541c57(_0xa85d6,_0xd6b543){var _0x32fd2d=squel[_0x545d('0x2b')]()[_0x545d('0x3c')]('cm_hopper')[_0x545d('0x3d')]([_0x545d('0x2c'),_0x545d('0x32'),_0x545d('0x2d'),'ListId',_0xd6b543,_0x545d('0x2e'),'updatedAt'],squel[_0x545d('0x2f')]()[_0x545d('0x30')]('phone',_0x545d('0x2c'))[_0x545d('0x30')](_0x545d('0x31'),_0x545d('0x32'))[_0x545d('0x30')]('id',_0x545d('0x2d'))[_0x545d('0x30')](LISTID['toString'](),_0x545d('0x1e'))[_0x545d('0x30')](_0xa85d6['id'][_0x545d('0x33')](),_0xd6b543)[_0x545d('0x30')](_0x545d('0x31'),'createdAt')['field']('NOW()',_0x545d('0x34'))['from']('cm_contacts')[_0x545d('0x37')](_0x545d('0x38'))['where'](_0x545d('0x39'),LISTID[_0x545d('0x33')]())[_0x545d('0x37')]('id\x20IN\x20?',squel[_0x545d('0x43')](hopperContacts))[_0x545d('0x37')]('phone\x20IS\x20NOT\x20NULL'))[_0x545d('0x33')]();return _0x32fd2d;}function _0x481940(_0x4cbc33,_0x1844f7){var _0x4fd14c=squel[_0x545d('0x2b')]()[_0x545d('0x3c')](_0x545d('0x44'))[_0x545d('0x3d')](['phone',_0x545d('0x2d'),_0x545d('0x1e'),_0x1844f7,_0x545d('0x2e'),'updatedAt'],squel[_0x545d('0x2f')]()['field']('phone',_0x545d('0x2c'))['field']('id',_0x545d('0x2d'))[_0x545d('0x30')](LISTID['toString'](),_0x545d('0x1e'))[_0x545d('0x30')](_0x4cbc33['id']['toString'](),_0x1844f7)['field']('NOW()','createdAt')['field'](_0x545d('0x31'),'updatedAt')[_0x545d('0x35')](_0x545d('0x36'))[_0x545d('0x37')](_0x545d('0x38'))[_0x545d('0x37')](_0x545d('0x39'),LISTID[_0x545d('0x33')]())['where'](_0x545d('0x3e'),squel[_0x545d('0x43')](hopperContacts))[_0x545d('0x37')](_0x545d('0x3f')))[_0x545d('0x33')]();return _0x4fd14c;}return db['VoiceQueue'][_0x545d('0x45')]({'where':{'type':'outbound'},'attributes':['id',_0x545d('0x46')],'include':[{'model':db[_0x545d('0x47')],'as':_0x545d('0x48'),'where':{'id':LISTID}}]})[_0x545d('0x49')](function(_0x2d6839){var _0x542781=[];if(_0x2d6839){var _0x3620ce;for(var _0x474df0=0x0,_0x4e409a;_0x474df0<_0x2d6839['length'];_0x474df0+=0x1){_0x4e409a=_0x2d6839[_0x474df0][_0x545d('0x4a')]({'plain':!![]});switch(_0x4e409a[_0x545d('0x46')]){case'always':_0x542781[_0x545d('0x25')](db[_0x545d('0x4b')][_0x545d('0x4c')](_0x26edbd(_0x4e409a,_0x545d('0x4d')))[_0x545d('0x49')](function(){})[_0x545d('0x4e')](_0xc04cff()));break;case _0x545d('0x4f'):_0x542781[_0x545d('0x25')](db[_0x545d('0x4b')][_0x545d('0x4c')](_0x1c9d74(_0x4e409a,_0x545d('0x4d')))[_0x545d('0x49')](function(){})[_0x545d('0x4e')](_0xc04cff()));break;default:_0x542781[_0x545d('0x25')](db['sequelize'][_0x545d('0x4c')](_0x541c57(_0x4e409a,_0x545d('0x4d')))[_0x545d('0x49')](function(){})[_0x545d('0x4e')](_0xc04cff()));}}}return _0x542781;})[_0x545d('0x50')]()[_0x545d('0x49')](function(){return db['VoiceQueue'][_0x545d('0x45')]({'where':{'type':_0x545d('0x51')},'attributes':['id'],'include':[{'model':db[_0x545d('0x47')],'as':_0x545d('0x52'),'where':{'id':LISTID}}]})[_0x545d('0x49')](function(_0x1b2c7c){var _0x5a11a4=[];if(_0x1b2c7c){var _0xd17e01;for(var _0x3914e7=0x0,_0x122a66;_0x3914e7<_0x1b2c7c[_0x545d('0x16')];_0x3914e7+=0x1){_0x122a66=_0x1b2c7c[_0x3914e7]['get']({'plain':!![]});_0x5a11a4[_0x545d('0x25')](db[_0x545d('0x4b')][_0x545d('0x4c')](_0x481940(_0x122a66,_0x545d('0x4d')))[_0x545d('0x49')](function(){})['catch'](_0xc04cff()));}}return _0x5a11a4;})[_0x545d('0x50')]();})[_0x545d('0x49')](function(){return db[_0x545d('0x53')][_0x545d('0x45')]({'attributes':['id',_0x545d('0x46')],'include':[{'model':db['CmList'],'as':_0x545d('0x48'),'where':{'id':LISTID}}]})[_0x545d('0x49')](function(_0x32b6fd){var _0x20e572=[];if(_0x32b6fd){for(var _0x9405c4=0x0,_0x11da99;_0x9405c4<_0x32b6fd['length'];_0x9405c4+=0x1){_0x11da99=_0x32b6fd[_0x9405c4]['get']({'plain':!![]});switch(_0x11da99[_0x545d('0x46')]){case _0x545d('0x54'):_0x20e572[_0x545d('0x25')](db[_0x545d('0x4b')]['query'](_0x26edbd(_0x11da99,_0x545d('0x55')))['then'](function(){})[_0x545d('0x4e')](_0xc04cff()));break;case _0x545d('0x4f'):_0x20e572['push'](db[_0x545d('0x4b')][_0x545d('0x4c')](_0x1c9d74(_0x11da99,'CampaignId'))[_0x545d('0x49')](function(){})[_0x545d('0x4e')](_0xc04cff()));break;default:_0x20e572[_0x545d('0x25')](db['sequelize'][_0x545d('0x4c')](_0x541c57(_0x11da99,_0x545d('0x55')))[_0x545d('0x49')](function(){})[_0x545d('0x4e')](_0xc04cff()));}}}return _0x20e572;})[_0x545d('0x50')]();})['then'](function(){return db['Campaign'][_0x545d('0x45')]({'attributes':['id'],'include':[{'model':db[_0x545d('0x47')],'as':_0x545d('0x52'),'where':{'id':LISTID}}]})['then'](function(_0x7780e9){var _0x2400bb=[];if(_0x7780e9){for(var _0x65f2de=0x0,_0x2d7f29;_0x65f2de<_0x7780e9['length'];_0x65f2de+=0x1){_0x2d7f29=_0x7780e9[_0x65f2de][_0x545d('0x4a')]({'plain':!![]});_0x2400bb[_0x545d('0x25')](db[_0x545d('0x4b')][_0x545d('0x4c')](_0x481940(_0x2d7f29,_0x545d('0x55')))['then'](function(){})[_0x545d('0x4e')](_0xc04cff()));}}return _0x2400bb;})[_0x545d('0x50')]();})[_0x545d('0x4e')](function(_0x5aed3e){logger[_0x545d('0x10')](_0x545d('0x56'),_0x545d('0x57'),_0x5aed3e[_0x545d('0x17')]);});}var processPromises=function(_0x5331db){return BPromise['all'](promises)[_0x545d('0x49')](function(_0x4716e0){})[_0x545d('0x4e')](function(_0x4c06d7){logger[_0x545d('0x10')]('Error\x20processing\x20rows\x20block:',JSON[_0x545d('0x27')](_0x4c06d7));})['finally'](function(){socket[_0x545d('0x58')](_0x545d('0x59')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5331db){return _0x5331db[_0x545d('0x5a')]();}});};var endCsv=function(){return BPromise[_0x545d('0x5b')]()[_0x545d('0x49')](function(){if(hopperContacts){return checkHopper();}})[_0x545d('0x49')](function(){socket[_0x545d('0x58')](_0x545d('0x59')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x545d('0x5c')](FILEPATH);}catch(_0x366b50){logger['error'](_0x545d('0x5d'),JSON['stringify'](_0x366b50));}finally{process[_0x545d('0x5e')](0x0);}});};process['on']('SIGINT',function(){logger[_0x545d('0x5f')](_0x545d('0x60'));endCsv();});function main(){return BPromise[_0x545d('0x5b')]()[_0x545d('0x49')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x545d('0xe')](',');return db[_0x545d('0x23')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x545d('0x49')](function(_0x4322d8){var _0x1a117a=fs[_0x545d('0x61')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x545d('0x62')](_0x1a117a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x55cd75,_0x3ded82){total+=0x1;var _0x4778b4=total;promises[_0x545d('0x25')](checkRow(_0x55cd75,_0x4322d8,_0x4778b4)[_0x545d('0x49')](function(){success+=0x1;})[_0x545d('0x4e')](function(_0x523817){if(_0x523817[_0x545d('0x10')]){errors+=0x1;delete _0x523817['error'];}else if(_0x523817[_0x545d('0x21')]){duplicates+=0x1;delete _0x523817[_0x545d('0x21')];}rows[_0x545d('0x25')](_0x523817);}));if(total%0xc8===0x0){_0x3ded82[_0x545d('0x63')]();return processPromises(_0x3ded82);}},'complete':function(){return processPromises()[_0x545d('0x49')](function(){logger[_0x545d('0x5f')](_0x545d('0x64'));endCsv();});},'error':function(_0x1125f8,_0x2ba595){logger[_0x545d('0x5f')](_0x545d('0x65'),JSON[_0x545d('0x27')](_0x1125f8));endCsv();}});})[_0x545d('0x4e')](function(_0x12cc2f){logger['error'](_0x545d('0x66'),JSON[_0x545d('0x27')](_0x12cc2f));});}main(); \ No newline at end of file +var _0x9748=['emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','CmContact','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','ListId\x20=\x20?','\x20=\x20?','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','phone\x20IS\x20NOT\x20NULL','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','VoiceQueue','BlackLists','all','always','CampaignId','cmContact,\x20%s,\x20%s','finally'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9748,0x1ce));var _0x8974=function(_0x4de910,_0x1973ce){_0x4de910=_0x4de910-0x0;var _0x55c077=_0x9748[_0x4de910];return _0x55c077;};'use strict';var BPromise=require('bluebird');var util=require(_0x8974('0x0'));var _=require(_0x8974('0x1'));var fs=require('fs');var squel=require(_0x8974('0x2'));var Papa=require(_0x8974('0x3'));var Redis=require('ioredis');var db=require(_0x8974('0x4'))['db'];var config=require(_0x8974('0x5'));var logger=require(_0x8974('0x6'))(_0x8974('0x7'));config[_0x8974('0x8')]=_[_0x8974('0x9')](config['redis'],{'host':_0x8974('0xa'),'port':0x18eb});var socket=require(_0x8974('0xb'))(new Redis(config[_0x8974('0x8')]));require(_0x8974('0xc'))[_0x8974('0xd')](socket);try{if(!process[_0x8974('0xe')][0x2]||process[_0x8974('0xe')][0x2]==='undefined'||process[_0x8974('0xe')][0x2]===_0x8974('0xf')){throw new Error(_0x8974('0x10'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0x8974('0xe')][0x3]===_0x8974('0x11')||process[_0x8974('0xe')][0x3]===_0x8974('0xf')||!process[_0x8974('0xe')][0x4]||process[_0x8974('0xe')][0x4]===_0x8974('0x11')||process[_0x8974('0xe')][0x4]===_0x8974('0xf')){throw new Error(_0x8974('0x12'));}var FIELDS=_[_0x8974('0x13')](process[_0x8974('0xe')][0x3]['split'](','),process[_0x8974('0xe')][0x4][_0x8974('0x14')](','));if(!process['argv'][0x5]||process[_0x8974('0xe')][0x5]==='undefined'||process[_0x8974('0xe')][0x5]==='null'){throw new Error(_0x8974('0x15'));}var LISTID=process[_0x8974('0xe')][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0x8974('0x11')&&process[_0x8974('0xe')][0x6]!==_0x8974('0xf')?process['argv'][0x6]:null;var DUPLICATES=process[_0x8974('0xe')][0x7]&&process[_0x8974('0xe')][0x7]!==_0x8974('0x11')&&process[_0x8974('0xe')][0x7]!=='null'?process[_0x8974('0xe')][0x7]:null;if(!process['argv'][0x8]||process[_0x8974('0xe')][0x8]===_0x8974('0x11')||process[_0x8974('0xe')][0x8]===_0x8974('0xf')){throw new Error(_0x8974('0x16'));}var SOCKET_TIMESTAMP=process[_0x8974('0xe')][0x8];}catch(_0x2f9582){logger[_0x8974('0x17')](_0x2f9582);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(_0x497fe9,_0x3a73e7,_0x121a08,_0x214b5d){var _0x496413={'message':_0x3a73e7};_0x496413[_0x497fe9]=!![];if(_0x121a08){_0x496413[_0x8974('0x18')]=_0x121a08;}if(_0x214b5d){_0x496413[_0x8974('0x19')]=_0x214b5d;}return _0x496413;}function isEmail(_0x21af4b){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))*$/[_0x8974('0x1a')](_0x21af4b);}function checkRow(_0x177eaf,_0x1556a6,_0x552b9f){return new BPromise(function(_0x16f311,_0x1cd907){if(_[_0x8974('0x1b')](_0x177eaf)){return _0x1cd907(handleCheckRowError('error',_0x8974('0x1c'),null,_0x552b9f));}if(_0x177eaf[_0x8974('0x1d')]&&_0x177eaf[_0x8974('0x1d')][_0x8974('0x1e')]){var _0x596421=_[_0x8974('0x1f')](_0x177eaf[_0x8974('0x1d')],_0x8974('0x20'))[_0x8974('0x21')](';');return _0x1cd907(handleCheckRowError('error',_0x596421,null,_0x552b9f));}var _0xe53d7c={};for(var _0x15f11f in FIELDS){if(FIELDS[_0x8974('0x22')](_0x15f11f)&&FIELDS[_0x15f11f]){_0xe53d7c[_0x15f11f]=_0x177eaf[_0x8974('0x23')][0x0][FIELDS[_0x15f11f]]||_0x177eaf[_0x8974('0x23')][0x0]['\ufeff'+FIELDS[_0x15f11f]];}}if(!_0xe53d7c[_0x8974('0x24')]){return _0x1cd907(handleCheckRowError(_0x8974('0x17'),'firstName\x20not\x20specified!',null,_0x552b9f));}if(!_0xe53d7c[_0x8974('0x25')]){return _0x1cd907(handleCheckRowError(_0x8974('0x17'),_0x8974('0x26'),null,_0x552b9f));}if(_0xe53d7c[_0x8974('0x27')]){var _0x77f975=moment(_0xe53d7c[_0x8974('0x27')],'YYYY-MM-DD');if(!_0x77f975[_0x8974('0x28')]()){return _0x1cd907(handleCheckRowError('error',_0x8974('0x29'),null,_0x552b9f));}}if(_0xe53d7c['email']){if(!isEmail(_0xe53d7c[_0x8974('0x2a')])){return _0x1cd907(handleCheckRowError(_0x8974('0x17'),_0x8974('0x2b'),null,_0x552b9f));}}_0xe53d7c[_0x8974('0x2c')]=LISTID;_0xe53d7c[_0x8974('0x2d')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x1556a6){var _0x4925cc={};for(var _0x34f923=0x0,_0x2fe08a=DUPLICATES[_0x8974('0x1e')];_0x34f923<_0x2fe08a;_0x34f923+=0x1){_0x4925cc[DUPLICATES[_0x34f923]]=_0xe53d7c[DUPLICATES[_0x34f923]];}var _0x255e63=_['find'](_0x1556a6,_0x4925cc);if(_0x255e63){return _0x1cd907(handleCheckRowError(_0x8974('0x2e'),'Duplicate\x20Contact',_0x255e63,_0x552b9f));}}return db[_0x8974('0x2f')]['create'](_0xe53d7c,{'raw':!![],'hooks':![],'fields':_[_0x8974('0x30')](_0xe53d7c)})[_0x8974('0x31')](function(_0x809c4e){if(DUPLICATES&&DUPLICATES[_0x8974('0x1e')]&&_0x1556a6){_0x1556a6[_0x8974('0x32')](_[_0x8974('0x33')](_0xe53d7c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x809c4e['id'];return _0x16f311();})[_0x8974('0x34')](function(_0x5561e1){return _0x1cd907(handleCheckRowError(_0x8974('0x17'),_0x8974('0x35')+(_0x5561e1[_0x8974('0x20')]||JSON[_0x8974('0x36')](_0x5561e1)),null,_0x552b9f));});});}function checkHopper(){function _0x3ac3ff(){return function(_0x2c4d43){logger['error']('cmContact',_0x8974('0x37'),util[_0x8974('0x38')](_0x2c4d43,{'showHidden':![],'depth':null}));};}var _0x552cbd=function(_0x43e40a,_0x5a3903){var _0x132f4e=squel[_0x8974('0x39')]()['into'](_0x8974('0x3a'))[_0x8974('0x3b')]([_0x8974('0x25'),_0x8974('0x3c'),_0x8974('0x3d'),_0x8974('0x2c'),_0x5a3903,_0x8974('0x3e'),_0x8974('0x3f')],squel[_0x8974('0x40')]()[_0x8974('0x41')](_0x8974('0x25'),_0x8974('0x25'))[_0x8974('0x41')](_0x8974('0x42'),_0x8974('0x3c'))[_0x8974('0x41')]('id',_0x8974('0x3d'))[_0x8974('0x41')](LISTID[_0x8974('0x43')](),_0x8974('0x2c'))[_0x8974('0x41')](_0x43e40a['id'][_0x8974('0x43')](),_0x5a3903)[_0x8974('0x41')](_0x8974('0x42'),'createdAt')[_0x8974('0x41')](_0x8974('0x42'),_0x8974('0x3f'))[_0x8974('0x44')](_0x8974('0x45'))[_0x8974('0x46')]('deletedAt\x20IS\x20NULL')[_0x8974('0x46')](_0x8974('0x47'),LISTID['toString']())[_0x8974('0x46')]('phone\x20IS\x20NOT\x20NULL')[_0x8974('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0x8974('0x40')]()[_0x8974('0x41')](_0x8974('0x25'))[_0x8974('0x44')]('cm_hopper')[_0x8974('0x46')](_0x5a3903+_0x8974('0x48'),_0x43e40a['id']['toString']())))[_0x8974('0x43')]();return _0x132f4e;};var _0x3864ae=function(_0x52b2f7,_0x1d5053){var _0x494bd=squel[_0x8974('0x39')]()[_0x8974('0x49')](_0x8974('0x3a'))[_0x8974('0x3b')](['phone',_0x8974('0x3c'),_0x8974('0x3d'),_0x8974('0x2c'),_0x1d5053,_0x8974('0x3e'),_0x8974('0x3f')],squel[_0x8974('0x40')]()[_0x8974('0x41')](_0x8974('0x25'),_0x8974('0x25'))[_0x8974('0x41')](_0x8974('0x42'),_0x8974('0x3c'))[_0x8974('0x41')]('id',_0x8974('0x3d'))[_0x8974('0x41')](LISTID[_0x8974('0x43')](),_0x8974('0x2c'))['field'](_0x52b2f7['id']['toString'](),_0x1d5053)[_0x8974('0x41')](_0x8974('0x42'),_0x8974('0x3e'))['field']('NOW()',_0x8974('0x3f'))[_0x8974('0x44')](_0x8974('0x45'))[_0x8974('0x46')](_0x8974('0x4a'))['where']('ListId\x20=\x20?',LISTID[_0x8974('0x43')]())[_0x8974('0x46')](_0x8974('0x4b'),squel[_0x8974('0x4c')](hopperContacts))[_0x8974('0x46')]('phone\x20IS\x20NOT\x20NULL')[_0x8974('0x46')](_0x8974('0x4d'),squel[_0x8974('0x40')]()[_0x8974('0x41')](_0x8974('0x4e'))[_0x8974('0x44')]('cm_hopper_final')[_0x8974('0x46')](_0x1d5053+_0x8974('0x48'),_0x52b2f7['id'][_0x8974('0x43')]()))[_0x8974('0x46')](_0x8974('0x4d'),squel[_0x8974('0x40')]()['field'](_0x8974('0x25'))[_0x8974('0x44')](_0x8974('0x3a'))['where'](_0x1d5053+_0x8974('0x48'),_0x52b2f7['id'][_0x8974('0x43')]())))['toString']();return _0x494bd;};function _0x5abde4(_0x324372,_0xd80177){var _0x230069=squel[_0x8974('0x39')]()['into'](_0x8974('0x3a'))[_0x8974('0x3b')]([_0x8974('0x25'),_0x8974('0x3c'),_0x8974('0x3d'),'ListId',_0xd80177,_0x8974('0x3e'),'updatedAt'],squel[_0x8974('0x40')]()[_0x8974('0x41')](_0x8974('0x25'),_0x8974('0x25'))[_0x8974('0x41')]('NOW()',_0x8974('0x3c'))[_0x8974('0x41')]('id',_0x8974('0x3d'))[_0x8974('0x41')](LISTID[_0x8974('0x43')](),_0x8974('0x2c'))[_0x8974('0x41')](_0x324372['id'][_0x8974('0x43')](),_0xd80177)[_0x8974('0x41')](_0x8974('0x42'),'createdAt')[_0x8974('0x41')]('NOW()',_0x8974('0x3f'))[_0x8974('0x44')](_0x8974('0x45'))[_0x8974('0x46')]('deletedAt\x20IS\x20NULL')[_0x8974('0x46')](_0x8974('0x47'),LISTID['toString']())[_0x8974('0x46')](_0x8974('0x4b'),squel[_0x8974('0x4c')](hopperContacts))[_0x8974('0x46')](_0x8974('0x4f')))[_0x8974('0x43')]();return _0x230069;}function _0x11cddf(_0x247251,_0x1bc849){var _0xeb9f8d=squel[_0x8974('0x39')]()[_0x8974('0x49')](_0x8974('0x50'))[_0x8974('0x3b')]([_0x8974('0x25'),_0x8974('0x3d'),_0x8974('0x2c'),_0x1bc849,_0x8974('0x3e'),_0x8974('0x3f')],squel['select']()[_0x8974('0x41')](_0x8974('0x25'),_0x8974('0x25'))[_0x8974('0x41')]('id','ContactId')['field'](LISTID[_0x8974('0x43')](),_0x8974('0x2c'))[_0x8974('0x41')](_0x247251['id'][_0x8974('0x43')](),_0x1bc849)[_0x8974('0x41')](_0x8974('0x42'),'createdAt')[_0x8974('0x41')]('NOW()',_0x8974('0x3f'))['from']('cm_contacts')['where'](_0x8974('0x4a'))[_0x8974('0x46')](_0x8974('0x47'),LISTID['toString']())[_0x8974('0x46')](_0x8974('0x4b'),squel[_0x8974('0x4c')](hopperContacts))[_0x8974('0x46')]('phone\x20IS\x20NOT\x20NULL'))[_0x8974('0x43')]();return _0xeb9f8d;}return db['VoiceQueue'][_0x8974('0x51')]({'where':{'type':_0x8974('0x52')},'attributes':['id',_0x8974('0x53')],'include':[{'model':db[_0x8974('0x54')],'as':_0x8974('0x55'),'where':{'id':LISTID}}]})[_0x8974('0x31')](function(_0x17e19e){var _0x408d1a=[];if(_0x17e19e){var _0x176cd7;for(var _0x5618b6=0x0,_0x27e276;_0x5618b6<_0x17e19e[_0x8974('0x1e')];_0x5618b6+=0x1){_0x27e276=_0x17e19e[_0x5618b6][_0x8974('0x56')]({'plain':!![]});switch(_0x27e276['dialCheckDuplicateType']){case'always':_0x408d1a[_0x8974('0x32')](db[_0x8974('0x57')][_0x8974('0x58')](_0x3864ae(_0x27e276,_0x8974('0x59')))[_0x8974('0x31')](function(){})[_0x8974('0x34')](_0x3ac3ff()));break;case _0x8974('0x5a'):_0x408d1a[_0x8974('0x32')](db[_0x8974('0x57')][_0x8974('0x58')](_0x552cbd(_0x27e276,_0x8974('0x59')))[_0x8974('0x31')](function(){})['catch'](_0x3ac3ff()));break;default:_0x408d1a[_0x8974('0x32')](db[_0x8974('0x57')]['query'](_0x5abde4(_0x27e276,_0x8974('0x59')))[_0x8974('0x31')](function(){})[_0x8974('0x34')](_0x3ac3ff()));}}}return _0x408d1a;})['all']()[_0x8974('0x31')](function(){return db[_0x8974('0x5b')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x8974('0x5c'),'where':{'id':LISTID}}]})[_0x8974('0x31')](function(_0x5ae946){var _0x35b361=[];if(_0x5ae946){var _0x494b71;for(var _0x486d93=0x0,_0x2f1ed0;_0x486d93<_0x5ae946['length'];_0x486d93+=0x1){_0x2f1ed0=_0x5ae946[_0x486d93]['get']({'plain':!![]});_0x35b361[_0x8974('0x32')](db[_0x8974('0x57')]['query'](_0x11cddf(_0x2f1ed0,_0x8974('0x59')))[_0x8974('0x31')](function(){})['catch'](_0x3ac3ff()));}}return _0x35b361;})[_0x8974('0x5d')]();})[_0x8974('0x31')](function(){return db['Campaign'][_0x8974('0x51')]({'attributes':['id',_0x8974('0x53')],'include':[{'model':db[_0x8974('0x54')],'as':_0x8974('0x55'),'where':{'id':LISTID}}]})[_0x8974('0x31')](function(_0xce7f88){var _0x455aff=[];if(_0xce7f88){for(var _0xf9cd42=0x0,_0xa8d7bf;_0xf9cd42<_0xce7f88[_0x8974('0x1e')];_0xf9cd42+=0x1){_0xa8d7bf=_0xce7f88[_0xf9cd42][_0x8974('0x56')]({'plain':!![]});switch(_0xa8d7bf[_0x8974('0x53')]){case _0x8974('0x5e'):_0x455aff[_0x8974('0x32')](db[_0x8974('0x57')]['query'](_0x3864ae(_0xa8d7bf,_0x8974('0x5f')))['then'](function(){})[_0x8974('0x34')](_0x3ac3ff()));break;case _0x8974('0x5a'):_0x455aff[_0x8974('0x32')](db['sequelize'][_0x8974('0x58')](_0x552cbd(_0xa8d7bf,_0x8974('0x5f')))['then'](function(){})[_0x8974('0x34')](_0x3ac3ff()));break;default:_0x455aff[_0x8974('0x32')](db['sequelize'][_0x8974('0x58')](_0x5abde4(_0xa8d7bf,'CampaignId'))[_0x8974('0x31')](function(){})[_0x8974('0x34')](_0x3ac3ff()));}}}return _0x455aff;})['all']();})[_0x8974('0x31')](function(){return db['Campaign'][_0x8974('0x51')]({'attributes':['id'],'include':[{'model':db[_0x8974('0x54')],'as':_0x8974('0x5c'),'where':{'id':LISTID}}]})[_0x8974('0x31')](function(_0xff1fb4){var _0x4f925c=[];if(_0xff1fb4){for(var _0x1557cc=0x0,_0x5b0b03;_0x1557cc<_0xff1fb4[_0x8974('0x1e')];_0x1557cc+=0x1){_0x5b0b03=_0xff1fb4[_0x1557cc][_0x8974('0x56')]({'plain':!![]});_0x4f925c[_0x8974('0x32')](db[_0x8974('0x57')][_0x8974('0x58')](_0x11cddf(_0x5b0b03,_0x8974('0x5f')))[_0x8974('0x31')](function(){})[_0x8974('0x34')](_0x3ac3ff()));}}return _0x4f925c;})[_0x8974('0x5d')]();})[_0x8974('0x34')](function(_0x11387f){logger[_0x8974('0x17')](_0x8974('0x60'),'generalCheckHopper',_0x11387f[_0x8974('0x20')]);});}var processPromises=function(_0x37e81b){return BPromise[_0x8974('0x5d')](promises)[_0x8974('0x31')](function(_0x559836){})['catch'](function(_0x22325c){logger[_0x8974('0x17')]('Error\x20processing\x20rows\x20block:',JSON[_0x8974('0x36')](_0x22325c));})[_0x8974('0x61')](function(){socket[_0x8974('0x62')](_0x8974('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x37e81b){return _0x37e81b[_0x8974('0x64')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x8974('0x31')](function(){if(hopperContacts){return checkHopper();}})[_0x8974('0x31')](function(){socket[_0x8974('0x62')](_0x8974('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x8974('0x65')](FILEPATH);}catch(_0x59d01e){logger[_0x8974('0x17')](_0x8974('0x66'),JSON['stringify'](_0x59d01e));}finally{process[_0x8974('0x67')](0x0);}});};process['on'](_0x8974('0x68'),function(){logger[_0x8974('0x69')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x8974('0x6a')]()[_0x8974('0x31')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x8974('0x14')](',');return db['CmContact'][_0x8974('0x51')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x8974('0x31')](function(_0x40025d){var _0x505acb=fs[_0x8974('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x8974('0x6c')](_0x505acb,{'header':!![],'skipEmptyLines':!![],'step':function(_0x176915,_0x5cc9b3){total+=0x1;var _0x551f3e=total;promises[_0x8974('0x32')](checkRow(_0x176915,_0x40025d,_0x551f3e)['then'](function(){success+=0x1;})[_0x8974('0x34')](function(_0x14e236){if(_0x14e236[_0x8974('0x17')]){errors+=0x1;delete _0x14e236[_0x8974('0x17')];}else if(_0x14e236[_0x8974('0x2e')]){duplicates+=0x1;delete _0x14e236['duplicate'];}rows[_0x8974('0x32')](_0x14e236);}));if(total%0xc8===0x0){_0x5cc9b3[_0x8974('0x6d')]();return processPromises(_0x5cc9b3);}},'complete':function(){return processPromises()[_0x8974('0x31')](function(){logger[_0x8974('0x69')](_0x8974('0x6e'));endCsv();});},'error':function(_0x4b65f8,_0x3bc632){logger[_0x8974('0x69')](_0x8974('0x6f'),JSON[_0x8974('0x36')](_0x4b65f8));endCsv();}});})[_0x8974('0x34')](function(_0x2be194){logger[_0x8974('0x17')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x8974('0x36')](_0x2be194));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 50f5736..1a693e0 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 _0x3c77=['createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_contacts.createdAt','cm_hopper_black','ContactId','.CmListId\x20=\x20?','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.ListId','scheduledat','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_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','info','Received\x20SIGINT','error','message','code','sequelize','query','spread','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','dialTimezone','isNil','utcOffset','set','offset','main','stringify','start','binding','socket_timestamp','root','.csv','includes','header','name','_description','parse','createReadStream','data','rows','errors','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','timezones','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','exit','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','push','all','split','length','filter','CmContactHasItem','findOne','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ListId'];(function(_0x1bfcfc,_0x140f5b){var _0x1041ff=function(_0x2d48fc){while(--_0x2d48fc){_0x1bfcfc['push'](_0x1bfcfc['shift']());}};_0x1041ff(++_0x140f5b);}(_0x3c77,0x13d));var _0x73c7=function(_0x5cfc5e,_0x362aed){_0x5cfc5e=_0x5cfc5e-0x0;var _0x2c2633=_0x3c77[_0x5cfc5e];return _0x2c2633;};'use strict';var fs=require('fs');var path=require(_0x73c7('0x0'));var _=require(_0x73c7('0x1'));var Papa=require(_0x73c7('0x2'));var util=require(_0x73c7('0x3'));var BPromise=require(_0x73c7('0x4'));var moment=require(_0x73c7('0x5'));var squel=require(_0x73c7('0x6'));var Redis=require('ioredis');var db=require(_0x73c7('0x7'))['db'];var config=require(_0x73c7('0x8'));var shared=require(_0x73c7('0x9'));var logger=require(_0x73c7('0xa'))('import');config[_0x73c7('0xb')]=_[_0x73c7('0xc')](config[_0x73c7('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x73c7('0xd'))(new Redis(config[_0x73c7('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x73c7('0xe')](_0x73c7('0xf'));function isEmail(_0x24f884){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))*$/[_0x73c7('0x10')](_0x24f884);}function selectNotIn(_0x3e5dd2,_0x5207f8,_0x1d476f,_0x4f847e,_0x29bcce){return squel[_0x73c7('0x11')]()[_0x73c7('0x12')](_0x73c7('0x13'))[_0x73c7('0x14')](_0x4f847e)[_0x73c7('0x15')](_0x5207f8,null,_0x5207f8+_0x73c7('0x16')+_0x4f847e+'.'+_0x1d476f)[_0x73c7('0x17')](_0x4f847e+'.'+_0x1d476f+_0x73c7('0x18')+_0x3e5dd2+'.'+_0x1d476f)[_0x73c7('0x17')](_0x5207f8+_0x73c7('0x19')+_0x29bcce['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5b056a,_0x48ab64){promisesAdditionalPhones=[];return db['CmContact'][_0x73c7('0x1a')]({'raw':!![],'attributes':['id',_0x73c7('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x73c7('0x1c')](function(_0x3bb4cc){if(_0x3bb4cc!==null){var _0x1fd658=[];for(var _0x554330=0x0;_0x554330<_0x3bb4cc['length'];_0x554330++){var _0xc4a0d6=_0x3bb4cc[_0x554330];_0x1fd658[_0x73c7('0x1d')](insertAdditionalPhones(_0xc4a0d6));}}Promise[_0x73c7('0x1e')](_0x1fd658)[_0x73c7('0x1c')](function(){_0x5b056a({'val':0x1});});});});}function insertAdditionalPhones(_0x22a8d4){return new Promise(function(_0x1c1f15,_0x360187){var _0x3881fe=_0x22a8d4[_0x73c7('0x1b')];var _0x3e505e=_0x3881fe[_0x73c7('0x1f')](';');var _0x32f7f2=[];orderBy=0x0;for(var _0x3c8b37=0x0;_0x3c8b37<_0x3e505e[_0x73c7('0x20')];_0x3c8b37++){_0x32f7f2[_0x73c7('0x1d')](splitAdditionalPhone(_0x22a8d4['id'],_0x3e505e[_0x3c8b37]));}Promise[_0x73c7('0x1e')](_0x32f7f2)[_0x73c7('0x1c')](function(){_0x1c1f15({'val':_0x3e505e[_0x73c7('0x20')]});});});}function splitAdditionalPhone(_0x362231,_0x5629c6){return new Promise(function(_0x1dbd39,_0x4c6745){var _0xf450d4=_0x5629c6[_0x73c7('0x1f')](':');var _0x4c9ea3=_0xf450d4[0x0];var _0x3186ec=_0xf450d4[0x1];if(!_['isNil'](_0x3186ec)){var _0x39b40d=_0x3186ec['split']('|');var _0x409a7a=[];for(var _0x587ecc=0x0;_0x587ecc<_0x39b40d['length'];_0x587ecc++){if(_0x39b40d[_0x587ecc]!==''){var _0xc417e6=_[_0x73c7('0x21')](promisesAdditionalPhones,{'contactId':_0x362231,'phone':_0x39b40d[_0x587ecc]});if(_0xc417e6[_0x73c7('0x20')]==0x0){orderBy++;promisesAdditionalPhones[_0x73c7('0x1d')]({'contactId':_0x362231,'contactTypeId':_0x4c9ea3,'phone':_0x39b40d[_0x587ecc],'orderBy':orderBy});}}}_0x1dbd39({'ok':0x1});}else _0x1dbd39({'res':0x0});});}function createAdditionalPhone(_0x1702f8,_0x5ce209,_0x492e0a,_0x333bc8){var _0x145707='';var _0x22a9c0='';var _0x14fcff=_0x492e0a[_0x73c7('0x1f')]('§');_0x145707=_0x14fcff[0x0];if(_0x14fcff[_0x73c7('0x20')]==0x2)_0x22a9c0=_0x14fcff[0x1];return new Promise(function(_0x476b59,_0x4dbe1e){return db[_0x73c7('0x22')][_0x73c7('0x23')]({'where':{'CmContactId':_0x1702f8,'item':_0x145707}})[_0x73c7('0x1c')](function(_0x2ec558){if(_0x2ec558){return db[_0x73c7('0x22')]['update']({'ItemTypeId':_0x5ce209,'description':_0x22a9c0,'OrderBy':_0x333bc8},{'where':{'CmContactId':_0x1702f8,'item':_0x145707}})[_0x73c7('0x1c')](function(_0xeda4d6){_0x476b59({'res':'updated'});});}else{return db[_0x73c7('0x22')]['create']({'CmContactId':_0x1702f8,'item':_0x145707,'description':_0x22a9c0,'ItemTypeId':_0x5ce209,'OrderBy':_0x333bc8,'ItemClass':'PHONE'})[_0x73c7('0x1c')](function(_0x21071b){_0x476b59({'res':_0x73c7('0x24')});});}});});}function insertCmHopper(_0x52834f,_0x2dbe1b,_0x5f1e68,_0x510037,_0x326c9f){var _0x142a50=[_0x73c7('0x25'),_0x73c7('0x26'),'cm_contacts.id','cm_contacts.ListId',_0x2dbe1b+'.'+_0x510037,'cm_contacts.createdAt',_0x73c7('0x27'),_0x73c7('0x28'),_0x73c7('0x29'),'\x22'+_0x326c9f+'\x22'];return squel[_0x73c7('0x2a')]()[_0x73c7('0x2b')](_0x73c7('0x2c'))[_0x73c7('0x2d')]([_0x73c7('0x13'),'scheduledat','ContactId',_0x73c7('0x2e'),_0x510037,_0x73c7('0x2f'),_0x73c7('0x30'),_0x73c7('0x31'),_0x73c7('0x32'),_0x73c7('0x33')],squel['select']()[_0x73c7('0x34')](_0x142a50)[_0x73c7('0x14')](_0x2dbe1b)[_0x73c7('0x15')](_0x73c7('0x35'),null,_0x73c7('0x36')+_0x2dbe1b+_0x73c7('0x37'))[_0x73c7('0x15')](_0x5f1e68,null,_0x5f1e68+_0x73c7('0x16')+_0x2dbe1b+'.'+_0x510037)[_0x73c7('0x17')](_0x2dbe1b+'.CmListId\x20=\x20?',_0x52834f)[_0x73c7('0x17')](_0x73c7('0x38'),NOW)['where'](_0x73c7('0x39'),selectNotIn(_0x2dbe1b,_0x5f1e68,_0x510037,_0x73c7('0x2c'),[_0x73c7('0x3a'),_0x73c7('0x3b')]))[_0x73c7('0x17')](_0x73c7('0x39'),selectNotIn(_0x2dbe1b,_0x5f1e68,_0x510037,_0x73c7('0x2c'),[_0x73c7('0x3a')])))[_0x73c7('0x3c')]();}function insertCmHopperBlack(_0x19ac7e,_0x4f16af,_0x293705,_0x2a42a6){var _0x42f910=['cm_contacts.phone',_0x73c7('0x3d'),'cm_contacts.ListId',_0x4f16af+'.'+_0x2a42a6,_0x73c7('0x3e'),_0x73c7('0x27')];return squel['insert']()['into'](_0x73c7('0x3f'))['fromQuery']([_0x73c7('0x13'),_0x73c7('0x40'),_0x73c7('0x2e'),_0x2a42a6,_0x73c7('0x2f'),'updatedAt'],squel[_0x73c7('0x11')]()['fields'](_0x42f910)[_0x73c7('0x14')](_0x4f16af)[_0x73c7('0x15')](_0x73c7('0x35'),null,_0x73c7('0x36')+_0x4f16af+_0x73c7('0x37'))['join'](_0x293705,null,_0x293705+'.id\x20=\x20'+_0x4f16af+'.'+_0x2a42a6)[_0x73c7('0x17')](_0x4f16af+_0x73c7('0x41'),_0x19ac7e)[_0x73c7('0x17')](_0x73c7('0x38'),NOW)['where'](_0x73c7('0x39'),squel[_0x73c7('0x11')]()[_0x73c7('0x12')](_0x73c7('0x13'))[_0x73c7('0x14')]('cm_hopper_black')[_0x73c7('0x17')](_0x73c7('0x42'),_0x19ac7e)[_0x73c7('0x17')](_0x2a42a6+_0x73c7('0x18')+_0x4f16af+'.'+_0x2a42a6)))[_0x73c7('0x3c')]();}function insertTzCmHopper(_0xd28357,_0x7db8be,_0x3a4a02,_0x3d1c94,_0x4346b6,_0x1fde56){var _0x3db3dd=['cm_contacts.phone',_0x73c7('0x43')+_0x1fde56+'.offset-cm_contacts.utcOffset\x20minute)',_0x73c7('0x3d'),_0x73c7('0x44'),_0x7db8be+'.'+_0x3d1c94,'cm_contacts.createdAt',_0x73c7('0x27'),_0x73c7('0x28'),'cm_contacts.UserId','\x22'+_0x4346b6+'\x22'];var _0x10f380=squel[_0x73c7('0x2a')]()[_0x73c7('0x2b')](_0x73c7('0x2c'))[_0x73c7('0x2d')]([_0x73c7('0x13'),_0x73c7('0x45'),_0x73c7('0x40'),_0x73c7('0x2e'),_0x3d1c94,_0x73c7('0x2f'),_0x73c7('0x30'),'priority',_0x73c7('0x32'),_0x73c7('0x33')],squel[_0x73c7('0x11')]()[_0x73c7('0x34')](_0x3db3dd)['from'](_0x7db8be)[_0x73c7('0x15')]('cm_contacts',null,_0x73c7('0x36')+_0x7db8be+'.CmListId')[_0x73c7('0x15')](_0x3a4a02,null,_0x3a4a02+_0x73c7('0x16')+_0x7db8be+'.'+_0x3d1c94)[_0x73c7('0x15')](_0x1fde56,null,_0x1fde56+'.id\x20=\x20'+_0x7db8be+'.'+_0x3d1c94)[_0x73c7('0x17')](_0x7db8be+_0x73c7('0x41'),_0xd28357)[_0x73c7('0x17')](_0x73c7('0x38'),NOW)['where'](_0x73c7('0x39'),selectNotIn(_0x7db8be,_0x3a4a02,_0x3d1c94,_0x73c7('0x2c'),[_0x73c7('0x3a'),_0x73c7('0x3b')]))[_0x73c7('0x17')](_0x73c7('0x39'),selectNotIn(_0x7db8be,_0x3a4a02,_0x3d1c94,'cm_hopper',['\x22always\x22'])))['toString']();return _0x10f380;}function insertTzCmHopperBlack(_0x1c793b,_0x3c0990,_0x565136,_0x3c4d31){var _0x30a83a=[_0x73c7('0x25'),_0x73c7('0x3d'),'cm_contacts.ListId',_0x3c0990+'.'+_0x3c4d31,_0x73c7('0x3e'),_0x73c7('0x27')];return squel[_0x73c7('0x2a')]()[_0x73c7('0x2b')](_0x73c7('0x3f'))['fromQuery']([_0x73c7('0x13'),_0x73c7('0x40'),'ListId',_0x3c4d31,'createdAt',_0x73c7('0x30')],squel['select']()['fields'](_0x30a83a)[_0x73c7('0x14')](_0x3c0990)[_0x73c7('0x15')](_0x73c7('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x3c0990+_0x73c7('0x37'))[_0x73c7('0x15')](_0x565136,null,_0x565136+'.id\x20=\x20'+_0x3c0990+'.'+_0x3c4d31)['where'](_0x3c0990+_0x73c7('0x41'),_0x1c793b)[_0x73c7('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x73c7('0x17')](_0x73c7('0x39'),squel['select']()[_0x73c7('0x12')](_0x73c7('0x13'))[_0x73c7('0x14')](_0x73c7('0x3f'))['where'](_0x73c7('0x42'),_0x1c793b)['where'](_0x3c4d31+_0x73c7('0x18')+_0x3c0990+'.'+_0x3c4d31)))[_0x73c7('0x3c')]();}function insertCmHopperAdditionalPhones(_0x2f3261){var _0xd22b92=[_0x73c7('0x46'),_0x73c7('0x47'),_0x73c7('0x48'),_0x73c7('0x49'),_0x73c7('0x4a')];return squel['insert']()['into'](_0x73c7('0x4b'))[_0x73c7('0x2d')]([_0x73c7('0x4c'),_0x73c7('0x13'),_0x73c7('0x4d'),'createdAt',_0x73c7('0x30')],squel[_0x73c7('0x11')]()[_0x73c7('0x34')](_0xd22b92)[_0x73c7('0x14')](_0x73c7('0x2c'))['join'](_0x73c7('0x35'),null,_0x73c7('0x4e'))[_0x73c7('0x15')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x73c7('0x17')](_0x73c7('0x4f'),_0x2f3261)['where'](_0x73c7('0x38'),NOW))[_0x73c7('0x3c')]();}function insertCmContact(_0x141fec,_0x4702de,_0x4b39ca,_0x3b0bd1){var _0x60c0d5=_[_0x73c7('0x50')](_[_0x73c7('0x51')](_0x3b0bd1),[_0x73c7('0x2e'),'CompanyId',_0x73c7('0x2f'),'updatedAt','scheduledAt']);return squel[_0x73c7('0x2a')]()[_0x73c7('0x2b')]('cm_contacts')['fromQuery'](_0x60c0d5,squel[_0x73c7('0x11')]()[_0x73c7('0x34')](_0x60c0d5)[_0x73c7('0x14')](_0x4702de)[_0x73c7('0x17')]('('+_0x4b39ca[_0x73c7('0x15')](',')+_0x73c7('0x52'),squel['select']()[_0x73c7('0x34')](_0x4b39ca)[_0x73c7('0x14')]('cm_contacts')['where'](_0x73c7('0x42'),_0x141fec)['where'](_0x73c7('0x53')))['where'](_0x73c7('0x54'),squel[_0x73c7('0x11')]()[_0x73c7('0x12')](_0x73c7('0x55'),'min_id')[_0x73c7('0x14')](_0x4702de)['group'](_0x4b39ca[_0x73c7('0x15')](','))))['toString']();}function handleStop(){logger[_0x73c7('0x56')](_0x73c7('0x57'));stopped=!![];}function handleUncaughtException(_0xafba1d){logger[_0x73c7('0x58')](_0xafba1d[_0x73c7('0x59')]);process['exit'](0x1);}function handleError(_0x8cc12e,_0x284f5b){stats['errors'][_0x73c7('0x1d')]({'name':_0x284f5b[_0x73c7('0x5a')],'message':_0x284f5b[_0x73c7('0x59')],'row':_0x8cc12e});}function handleQuery(_0x331dd5){logger['info'](_0x331dd5);return db[_0x73c7('0x5b')][_0x73c7('0x5c')](_0x331dd5)[_0x73c7('0x5d')](function(_0x50411d){results[_0x73c7('0x1d')](_0x50411d);})['catch'](function(_0x26c051){logger['error'](_0x26c051[_0x73c7('0x59')]);});}function updateTzCampaigns(_0x2613f0){return new Promise(function(_0x2fedba,_0x9185dc){var _0x55e245=squel[_0x73c7('0x11')]()['fields']([_0x73c7('0x5e'),_0x73c7('0x5f')])[_0x73c7('0x14')](_0x73c7('0x60'))[_0x73c7('0x15')](_0x73c7('0x61'),null,_0x73c7('0x62'))[_0x73c7('0x17')]('campaigns_has_cm_lists.CmListId='+_0x2613f0);db['sequelize'][_0x73c7('0x5c')](_0x55e245[_0x73c7('0x3c')]())[_0x73c7('0x5d')](function(_0x1e7262){var _0x32f862=[];for(var _0x445a23=0x0;_0x445a23<_0x1e7262['length'];_0x445a23++){_0x32f862[_0x73c7('0x1d')](getTimezoneData(_0x1e7262[_0x445a23],tmp_campaigns));}BPromise[_0x73c7('0x1e')](_0x32f862)['then'](function(){_0x2fedba({'val':0x1});});})[_0x73c7('0x63')](function(_0x21ebb2){logger[_0x73c7('0x58')](_0x21ebb2[_0x73c7('0x59')]);_0x2fedba({'val':0x0});});});}function updateTzVoiceQueues(_0x4c33d7){return new Promise(function(_0x19197a,_0x32ea44){var _0x2930b8=squel[_0x73c7('0x11')]()['fields']([_0x73c7('0x64'),_0x73c7('0x65')])[_0x73c7('0x14')](_0x73c7('0x66'))[_0x73c7('0x15')](_0x73c7('0x67'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x73c7('0x17')](_0x73c7('0x68')+_0x4c33d7);db[_0x73c7('0x5b')]['query'](_0x2930b8[_0x73c7('0x3c')]())[_0x73c7('0x5d')](function(_0x3ea7a4){var _0x5baee8=[];for(var _0x42478a=0x0;_0x42478a<_0x3ea7a4[_0x73c7('0x20')];_0x42478a++){_0x5baee8[_0x73c7('0x1d')](getTimezoneData(_0x3ea7a4[_0x42478a],tmp_voice_queues));}BPromise[_0x73c7('0x1e')](_0x5baee8)['then'](function(){_0x19197a({'val':0x1});});})[_0x73c7('0x63')](function(_0x29d217){logger[_0x73c7('0x58')](_0x29d217[_0x73c7('0x59')]);_0x19197a({'val':0x0});});});}function getTimezoneData(_0x47c7f0,_0x9cb57e){return new Promise(function(_0x48922f,_0x2958c3){var _0xd88e41=shared['timezones'];var _0x3cd3cf=_0xd88e41[_0x47c7f0[_0x73c7('0x69')]];if(_[_0x73c7('0x6a')](_0x3cd3cf)){_0x48922f({'ret':0x1});}else{var _0x4ee988=_0x3cd3cf[_0x73c7('0x6b')];var _0x4ff549=squel['insert']()[_0x73c7('0x2b')](_0x9cb57e)[_0x73c7('0x6c')]('id',_0x47c7f0['id'])[_0x73c7('0x6c')](_0x73c7('0x6d'),_0x4ee988)[_0x73c7('0x6c')]('dialTimezone',_0x47c7f0[_0x73c7('0x69')])[_0x73c7('0x3c')]();return db[_0x73c7('0x5b')][_0x73c7('0x5c')](_0x4ff549)['spread'](function(_0x50a5e3){_0x48922f({'ret':0x1});})['catch'](function(_0x17544b){logger[_0x73c7('0x58')](_0x17544b['message']);_0x2958c3({'ret':0x1});});}});}function handleTZQuery(_0x1ac89d){logger[_0x73c7('0x56')](_0x1ac89d);return db[_0x73c7('0x5b')][_0x73c7('0x5c')](_0x1ac89d)['spread'](function(_0x343c1f){})[_0x73c7('0x63')](function(_0x9b6da4){logger[_0x73c7('0x58')](_0x9b6da4['message']);});}function main(_0x135e79,_0x1bbc85,_0x19168e,_0xe5c1f8){logger[_0x73c7('0x56')](_0x73c7('0x6e'),_0x135e79,JSON[_0x73c7('0x6f')](_0x1bbc85));process['send'](_0x73c7('0x70'));var _0x191b04=_0x1bbc85[_0x73c7('0x71')];var _0x357597=_['clone'](_0x191b04);var _0x497f4d=_0x1bbc85[_0x73c7('0x72')];var _0x263cc3=path[_0x73c7('0x15')](config[_0x73c7('0x73')],'server/files/tmp',_0x497f4d+_0x73c7('0x74'));hasTZ=_['keys'](_0x191b04)[_0x73c7('0x75')]('dialTimezone');var _0x17e8f9=_[_0x73c7('0x51')](_0x191b04)[_0x73c7('0x15')]();logger['info'](_0x73c7('0x76'),_0x17e8f9);db['ContactItemType'][_0x73c7('0x1a')]({'raw':!![],'attributes':['id',_0x73c7('0x77')]})[_0x73c7('0x1c')](function(_0x355d5c){for(var _0x308184=0x0;_0x308184<_0x355d5c[_0x73c7('0x20')];_0x308184++){if(_0x355d5c[_0x308184][_0x73c7('0x77')]in _0x191b04){contactItemTypes[_0x73c7('0x1d')](_0x355d5c[_0x308184]);delete _0x357597[_0x355d5c[_0x308184][_0x73c7('0x77')]];hasAdditionalPhones=!![];}for(var _0x242fe6 in _0x191b04){if(_0x355d5c[_0x308184][_0x73c7('0x77')]+_0x73c7('0x78')===_0x242fe6){phoneDescriptions[_0x73c7('0x1d')]({'itemTypeId':_0x355d5c[_0x308184]['id'],'description':_0x242fe6});delete _0x357597[_0x242fe6];}}}if(hasAdditionalPhones)_0x357597[_0x73c7('0x1b')]='';var _0x31f91d=_[_0x73c7('0x51')](_0x357597)[_0x73c7('0x15')]();logger['info'](_0x73c7('0x76'),_0x31f91d);fs['writeFileSync'](_0x263cc3,_0x31f91d+'\x0a');Papa[_0x73c7('0x79')](fs[_0x73c7('0x7a')](_0x135e79),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2fd7aa,_0x2c1145){try{for(var _0x34e1cc=0x0,_0x571eae=[];_0x34e1cc<_0x2fd7aa[_0x73c7('0x7b')][_0x73c7('0x20')];_0x34e1cc++){stats[_0x73c7('0x7c')]+=0x1;if(_0x2fd7aa[_0x73c7('0x7d')][_0x34e1cc]){handleError(_0x2fd7aa['data'][_0x34e1cc],_0x2fd7aa['errors'][_0x34e1cc]);}else{var _0x11deb9=[];var _0xa8515b=[];var _0xd3923b={};for(var _0x521ca1 in _0x191b04){let _0x4752d0=contactItemTypes[_0x73c7('0x7e')](_0x364618=>_0x364618[_0x73c7('0x77')]===_0x521ca1);let _0x44b1e4=contactItemTypes[_0x73c7('0x7e')](_0x2d1d15=>_0x2d1d15['name']+_0x73c7('0x78')===_0x521ca1);if(_[_0x73c7('0x6a')](_0x4752d0)&&_[_0x73c7('0x6a')](_0x44b1e4)){if(_0x191b04[_0x73c7('0x7f')](_0x521ca1)){if(_0x2fd7aa[_0x73c7('0x7b')][_0x34e1cc][_0x191b04[_0x521ca1]]){var _0x1bc96f=_[_0x73c7('0x80')](_0x2fd7aa[_0x73c7('0x7b')][_0x34e1cc][_0x191b04[_0x521ca1]][_0x73c7('0x81')](/"/g,'\x27'));switch(_0x521ca1){case'scheduledat':var _0x3cc095=moment(_0x1bc96f,_0x73c7('0xf'),!![]);if(_0x3cc095[_0x73c7('0x82')]()){_0x571eae[_0x73c7('0x1d')]('\x22'+_0x1bc96f+'\x22');}else{_0x11deb9[_0x73c7('0x1d')](_0x73c7('0x83'));}break;case _0x73c7('0x31'):var _0x348948=parseInt(_0x1bc96f);_0x1bc96f=_[_0x73c7('0x84')](_0x348948)||_0x348948<0x0||_0x348948>0x4?_0xe5c1f8?0x3:0x2:_0x348948;_0x571eae['push']('\x22'+_0x1bc96f+'\x22');break;case _0x73c7('0x32'):var _0x233aec=parseInt(_0x1bc96f);if(_[_0x73c7('0x85')](_0x233aec)&&_[_0x73c7('0x75')](_0x19168e,_0x233aec)){_0x571eae[_0x73c7('0x1d')]('\x22'+_0x233aec+'\x22');}else{_0x11deb9[_0x73c7('0x1d')](_0x73c7('0x86'));}break;case'email':if(isEmail(_0x1bc96f)){_0x571eae['push']('\x22'+_0x1bc96f+'\x22');}else{_0x11deb9[_0x73c7('0x1d')](_0x73c7('0x87'));}break;case _0x73c7('0x88'):var _0xd4b69d=moment(_0x1bc96f,_0x73c7('0x89'),!![]);if(_0xd4b69d[_0x73c7('0x82')]()){_0x571eae[_0x73c7('0x1d')]('\x22'+_0x1bc96f+'\x22');}else{_0x11deb9[_0x73c7('0x1d')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x73c7('0x69'):var _0x2f0462=shared[_0x73c7('0x8a')];var _0x31f21e=_0x2f0462[_0x1bc96f];if(!_[_0x73c7('0x6a')](_0x31f21e)){var _0x18afc2=_0x31f21e['utcOffset'];_0x571eae[_0x73c7('0x1d')]('\x22'+_0x1bc96f+'\x22');_0x571eae[_0x73c7('0x1d')]('\x22'+_0x18afc2+'\x22');}break;default:_0x571eae[_0x73c7('0x1d')]('\x22'+_0x1bc96f+'\x22');}}else{switch(_0x521ca1){case _0x73c7('0x8b'):case _0x73c7('0x13'):_0x11deb9[_0x73c7('0x1d')](_0x521ca1+_0x73c7('0x8c'));break;default:_0x571eae[_0x73c7('0x1d')]('\x22\x22');}}}}else{var _0x3673e9='';if(!_[_0x73c7('0x6a')](_0x4752d0)){if(!_0xd3923b[_0x73c7('0x7f')](_0x4752d0['id'])){if(!_[_0x73c7('0x6a')](_0x2fd7aa['data'][_0x34e1cc][_0x191b04[_0x521ca1]])){var _0x1bc96f=_[_0x73c7('0x80')](_0x2fd7aa[_0x73c7('0x7b')][_0x34e1cc][_0x191b04[_0x521ca1]][_0x73c7('0x81')](/"/g,'\x27'));var _0x32b80a=phoneDescriptions[_0x73c7('0x7e')](_0x47ab38=>_0x47ab38[_0x73c7('0x8d')]===_0x4752d0['id']);if(!_[_0x73c7('0x6a')](_0x32b80a)){var _0x5a222b=_['trim'](_0x2fd7aa[_0x73c7('0x7b')][_0x34e1cc][_0x191b04[_0x32b80a[_0x73c7('0x8e')]]][_0x73c7('0x81')](/"/g,'\x27'));if(!_[_0x73c7('0x6a')](_0x5a222b))_0x1bc96f=_0x1bc96f+'§'+_0x5a222b;}if(_0x3673e9=='')_0x3673e9=_0x1bc96f;else _0x3673e9+='|'+_0x1bc96f;}_0xa8515b['push'](_0x4752d0['id']+':'+_0x3673e9);_0xd3923b[_0x4752d0['id']]=0x1;}}}}if(hasAdditionalPhones){_0x571eae[_0x73c7('0x1d')]('\x22'+_0xa8515b[_0x73c7('0x15')](';')+'\x22');}if(_0x11deb9['length']){handleError(_0x2fd7aa[_0x73c7('0x7b')][_0x34e1cc],{'code':_0x73c7('0x8f'),'message':_0x11deb9[_0x73c7('0x15')]()});}else{fs['appendFileSync'](_0x263cc3,_0x571eae[_0x73c7('0x15')]()+'\x0a');}_0x571eae=[];}if(!(stats['rows']%0xc8)){socket[_0x73c7('0x90')](_0x73c7('0x91')+_0x497f4d,stats);stats['errors']=[];}}if(stopped){logger[_0x73c7('0x56')](_0x73c7('0x92'));_0x2c1145[_0x73c7('0x93')]();}}catch(_0x112d8e){handleError(_0x2fd7aa[_0x73c7('0x7b')][_0x34e1cc],{'code':_0x73c7('0x94'),'message':_0x112d8e[_0x73c7('0x59')]});logger['error'](_0x73c7('0x95'),_0x112d8e[_0x73c7('0x59')]);}},'complete':function(){try{var _0x6308cb=[];var _0x4c8c8c=[];var _0x465d42='cm_contacts';if(_0x1bbc85[_0x73c7('0x96')]&&_0x1bbc85[_0x73c7('0x96')][_0x73c7('0x20')]){_0x465d42=_0x73c7('0x97')+_0x497f4d;_0x6308cb['push'](_0x73c7('0x98')+_0x465d42+_0x73c7('0x99'));}tmp_campaigns='campaigns_'+_0x497f4d;tmp_voice_queues=_0x73c7('0x9a')+_0x497f4d;_0x4c8c8c[_0x73c7('0x1d')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x73c7('0x9b'));_0x4c8c8c[_0x73c7('0x1d')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x73c7('0x9b'));BPromise[_0x73c7('0x9c')](_0x4c8c8c,handleTZQuery)[_0x73c7('0x1c')](function(_0x1c9f4e){updateTzCampaigns(_0x1bbc85[_0x73c7('0x2e')])['then'](function(_0x3f9dba){updateTzVoiceQueues(_0x1bbc85[_0x73c7('0x2e')])[_0x73c7('0x1c')](function(_0x54b2e8){if(hasTZ)_0x31f91d=_0x31f91d['replace'](_0x73c7('0x69'),_0x73c7('0x9d'));var _0x350680=util[_0x73c7('0xe')](_0x73c7('0x9e'),_0x263cc3,_0x465d42,_0x31f91d,_0x1bbc85['ListId'],_0x1bbc85[_0x73c7('0x9f')]||null,NOW,NOW);if(_['isNil'](_0x191b04[_0x73c7('0x45')])){_0x350680+=_0x73c7('0xa0');}_0x6308cb['push'](_0x350680);if(_0x1bbc85[_0x73c7('0x96')]&&_0x1bbc85[_0x73c7('0x96')][_0x73c7('0x20')]){_0x6308cb[_0x73c7('0x1d')](insertCmContact(_0x1bbc85[_0x73c7('0x2e')],_0x465d42,_0x1bbc85[_0x73c7('0x96')],_0x191b04));_0x6308cb[_0x73c7('0x1d')](_0x73c7('0xa1')+_0x465d42+';');}BPromise[_0x73c7('0x9c')](_0x6308cb,handleQuery)[_0x73c7('0x1c')](function(_0x6835){BPromise['all']([handleAdditionalPhones()])[_0x73c7('0x1c')](function(){_0x6308cb=[];for(var _0x5e01ad=0x0;_0x5e01ad_0x42a0b1['name']===_0x1fec33);let _0x2d6010=contactItemTypes['find'](_0x9a56a5=>_0x9a56a5[_0x2ab6('0x7e')]+'_description'===_0x1fec33);if(_[_0x2ab6('0x20')](_0x398897)&&_['isNil'](_0x2d6010)){if(_0x1d2f3c[_0x2ab6('0x83')](_0x1fec33)){if(_0x503c0c[_0x2ab6('0x81')][_0x2e90c3][_0x1d2f3c[_0x1fec33]]){var _0x2eb4ff=_[_0x2ab6('0x84')](_0x503c0c[_0x2ab6('0x81')][_0x2e90c3][_0x1d2f3c[_0x1fec33]]['replace'](/"/g,'\x27'));switch(_0x1fec33){case'scheduledat':var _0x52a971=moment(_0x2eb4ff,_0x2ab6('0xd'),!![]);if(_0x52a971['isValid']()){_0x383aa3[_0x2ab6('0x1c')]('\x22'+_0x2eb4ff+'\x22');}else{_0x5cb997[_0x2ab6('0x1c')](_0x2ab6('0x85'));}break;case'priority':var _0x5f4c6c=parseInt(_0x2eb4ff);_0x2eb4ff=_[_0x2ab6('0x86')](_0x5f4c6c)||_0x5f4c6c<0x0||_0x5f4c6c>0x4?_0x4fe509?0x3:0x2:_0x5f4c6c;_0x383aa3[_0x2ab6('0x1c')]('\x22'+_0x2eb4ff+'\x22');break;case _0x2ab6('0x34'):var _0x43fe0c=parseInt(_0x2eb4ff);if(_[_0x2ab6('0x87')](_0x43fe0c)&&_['includes'](_0x8be2c7,_0x43fe0c)){_0x383aa3[_0x2ab6('0x1c')]('\x22'+_0x43fe0c+'\x22');}else{_0x5cb997[_0x2ab6('0x1c')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x2eb4ff)){_0x383aa3['push']('\x22'+_0x2eb4ff+'\x22');}else{_0x5cb997[_0x2ab6('0x1c')](_0x2ab6('0x88'));}break;case _0x2ab6('0x89'):var _0x34375b=moment(_0x2eb4ff,_0x2ab6('0x8a'),!![]);if(_0x34375b[_0x2ab6('0x8b')]()){_0x383aa3[_0x2ab6('0x1c')]('\x22'+_0x2eb4ff+'\x22');}else{_0x5cb997[_0x2ab6('0x1c')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case'dialTimezone':var _0x1c54da=shared[_0x2ab6('0x6e')];var _0x1f9c5d=_0x1c54da[_0x2eb4ff];if(!_[_0x2ab6('0x20')](_0x1f9c5d)){var _0x541c19=_0x1f9c5d[_0x2ab6('0x70')];_0x383aa3[_0x2ab6('0x1c')]('\x22'+_0x2eb4ff+'\x22');_0x383aa3['push']('\x22'+_0x541c19+'\x22');}break;default:_0x383aa3[_0x2ab6('0x1c')]('\x22'+_0x2eb4ff+'\x22');}}else{switch(_0x1fec33){case'firstName':case _0x2ab6('0x11'):_0x5cb997[_0x2ab6('0x1c')](_0x1fec33+'\x20not\x20specified');break;default:_0x383aa3['push']('\x22\x22');}}}}else{var _0x542106='';if(!_[_0x2ab6('0x20')](_0x398897)){if(!_0x2a63f7[_0x2ab6('0x83')](_0x398897['id'])){if(!_[_0x2ab6('0x20')](_0x503c0c[_0x2ab6('0x81')][_0x2e90c3][_0x1d2f3c[_0x1fec33]])){var _0x2eb4ff=_['trim'](_0x503c0c['data'][_0x2e90c3][_0x1d2f3c[_0x1fec33]][_0x2ab6('0x8c')](/"/g,'\x27'));var _0x491380=phoneDescriptions[_0x2ab6('0x8d')](_0x2f1985=>_0x2f1985[_0x2ab6('0x8e')]===_0x398897['id']);if(!_['isNil'](_0x491380)){var _0x2e08de=_[_0x2ab6('0x84')](_0x503c0c[_0x2ab6('0x81')][_0x2e90c3][_0x1d2f3c[_0x491380[_0x2ab6('0x8f')]]]['replace'](/"/g,'\x27'));if(!_[_0x2ab6('0x20')](_0x2e08de))_0x2eb4ff=_0x2eb4ff+'§'+_0x2e08de;}if(_0x542106=='')_0x542106=_0x2eb4ff;else _0x542106+='|'+_0x2eb4ff;}_0x5a4ee9[_0x2ab6('0x1c')](_0x398897['id']+':'+_0x542106);_0x2a63f7[_0x398897['id']]=0x1;}}}}if(hasAdditionalPhones){_0x383aa3['push']('\x22'+_0x5a4ee9[_0x2ab6('0x17')](';')+'\x22');}if(_0x5cb997[_0x2ab6('0x1b')]){handleError(_0x503c0c[_0x2ab6('0x81')][_0x2e90c3],{'code':_0x2ab6('0x90'),'message':_0x5cb997[_0x2ab6('0x17')]()});}else{fs[_0x2ab6('0x91')](_0x291c27,_0x383aa3[_0x2ab6('0x17')]()+'\x0a');}_0x383aa3=[];}if(!(stats['rows']%0xc8)){socket[_0x2ab6('0x92')]('contact:import:'+_0x357590,stats);stats[_0x2ab6('0x82')]=[];}}if(stopped){logger[_0x2ab6('0x5d')](_0x2ab6('0x93'));_0x1e4471[_0x2ab6('0x94')]();}}catch(_0x1c0cb7){handleError(_0x503c0c[_0x2ab6('0x81')][_0x2e90c3],{'code':_0x2ab6('0x95'),'message':_0x1c0cb7[_0x2ab6('0x60')]});logger['error'](_0x2ab6('0x96'),_0x1c0cb7['message']);}},'complete':function(){try{var _0x290cf9=[];var _0x19ddc4=[];var _0x4440a6=_0x2ab6('0x40');if(_0x14d0c2['duplicates']&&_0x14d0c2[_0x2ab6('0x97')][_0x2ab6('0x1b')]){_0x4440a6=_0x2ab6('0x98')+_0x357590;_0x290cf9[_0x2ab6('0x1c')](_0x2ab6('0x99')+_0x4440a6+'\x20LIKE\x20cm_contacts;');}tmp_campaigns='campaigns_'+_0x357590;tmp_voice_queues=_0x2ab6('0x9a')+_0x357590;_0x19ddc4[_0x2ab6('0x1c')](_0x2ab6('0x99')+tmp_campaigns+_0x2ab6('0x9b'));_0x19ddc4['push'](_0x2ab6('0x99')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise['each'](_0x19ddc4,handleTZQuery)[_0x2ab6('0x1a')](function(_0x2c5709){updateTzCampaigns(_0x14d0c2[_0x2ab6('0x32')])['then'](function(_0x4847e5){updateTzVoiceQueues(_0x14d0c2[_0x2ab6('0x32')])[_0x2ab6('0x1a')](function(_0x3bba03){if(hasTZ)_0x292cc5=_0x292cc5['replace'](_0x2ab6('0x6f'),_0x2ab6('0x9c'));var _0x5bee65=util['format'](_0x2ab6('0x9d'),_0x291c27,_0x4440a6,_0x292cc5,_0x14d0c2[_0x2ab6('0x32')],_0x14d0c2[_0x2ab6('0x58')]||null,NOW,NOW);if(_[_0x2ab6('0x20')](_0x1d2f3c[_0x2ab6('0x30')])){_0x5bee65+=_0x2ab6('0x9e');}_0x290cf9[_0x2ab6('0x1c')](_0x5bee65);if(_0x14d0c2[_0x2ab6('0x97')]&&_0x14d0c2[_0x2ab6('0x97')][_0x2ab6('0x1b')]){_0x290cf9[_0x2ab6('0x1c')](insertCmContact(_0x14d0c2[_0x2ab6('0x32')],_0x4440a6,_0x14d0c2[_0x2ab6('0x97')],_0x1d2f3c));_0x290cf9[_0x2ab6('0x1c')]('DROP\x20TABLE\x20'+_0x4440a6+';');}BPromise['each'](_0x290cf9,handleQuery)[_0x2ab6('0x1a')](function(_0x17076b){BPromise[_0x2ab6('0x1d')]([handleAdditionalPhones()])[_0x2ab6('0x1a')](function(){_0x290cf9=[];for(var _0x2612c9=0x0;_0x2612c9\x20\x20');}var _0x56f65b=path[_0x2ab6('0x17')](config[_0x2ab6('0x79')],_0x2ab6('0x7a'),process[_0x2ab6('0xac')][0x2]);if(!fs[_0x2ab6('0xad')](_0x56f65b)){throw new Error(_0x2ab6('0xae'));}var _0xcc301={};try{_0xcc301=JSON[_0x2ab6('0x7f')](process[_0x2ab6('0xac')][0x3]);if(!_0xcc301[_0x2ab6('0x76')]){throw new Error(_0x2ab6('0xaf'));}if(!_0xcc301[_0x2ab6('0x76')][_0x2ab6('0x11')]){throw new Error('phone\x20is\x20mandatory');}if(!_0xcc301['binding'][_0x2ab6('0xb0')]){throw new Error(_0x2ab6('0xb1'));}var _0x287310=0x0;if(_0xcc301[_0x2ab6('0x76')][_0x2ab6('0x34')]){_0x287310=0x1;}if(!_0xcc301[_0x2ab6('0x32')]){throw new Error(_0x2ab6('0xb2'));}}catch(_0x18c920){throw new Error(_0x2ab6('0xb3'));}var _0x48ff10=[];try{_0x48ff10=_[_0x2ab6('0xb4')](JSON[_0x2ab6('0x7f')](process[_0x2ab6('0xac')][0x4]),'id');}catch(_0x2ac0f0){logger[_0x2ab6('0x5d')](_0x2ab6('0xb5'));}main(_0x56f65b,_0xcc301,_0x48ff10,_0x287310);}validate();process['on']('SIGINT',handleStop);process['on'](_0x2ab6('0xb6'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 84be5fd..d304b87 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafcb=['step','CREATE\x20TABLE\x20','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','spread','length','isNil','AdditionalPhones','push','all','then','catch','error','message','split','CmContactHasItem','findOne','PHONE','inserted','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','where','.CmListId\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','into','createdAt','.CmListId','cm_contacts.createdAt\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','exit','errors','code','main','stringify','start','binding','socket_timestamp','server/files/tmp','.csv','ContactItemType','findAll','name','_description','writeFileSync','parse','createReadStream','rows','find','hasOwnProperty','data','replace','isValid','isNaN','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','trim','itemTypeId','description','SystemRow','appendFileSync','emit','Abort\x20parser','abort'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xafcb,0xb6));var _0xbafc=function(_0x1beb17,_0x200a16){_0x1beb17=_0x1beb17-0x0;var _0x115b56=_0xafcb[_0x1beb17];return _0x115b56;};'use strict';var fs=require('fs');var path=require(_0xbafc('0x0'));var _=require(_0xbafc('0x1'));var Papa=require(_0xbafc('0x2'));var util=require(_0xbafc('0x3'));var BPromise=require(_0xbafc('0x4'));var moment=require(_0xbafc('0x5'));var squel=require('squel');var Redis=require(_0xbafc('0x6'));var db=require(_0xbafc('0x7'))['db'];var config=require(_0xbafc('0x8'));var logger=require(_0xbafc('0x9'))('import');config[_0xbafc('0xa')]=_[_0xbafc('0xb')](config[_0xbafc('0xa')],{'host':_0xbafc('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbafc('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()[_0xbafc('0xd')](_0xbafc('0xe'));var tempTableName='cm_contacts_temp_'+moment()[_0xbafc('0xd')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2e88be){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))*$/[_0xbafc('0xf')](_0x2e88be);}function selectNotIn(_0xbd68ed,_0x16e14f,_0xbb8785,_0x3f7aed,_0x44d7e5){return squel['select']()[_0xbafc('0x10')](_0xbafc('0x11'))[_0xbafc('0x12')](_0x3f7aed)[_0xbafc('0x13')](_0x16e14f,null,_0x16e14f+_0xbafc('0x14')+_0x3f7aed+'.'+_0xbb8785)['where'](_0x3f7aed+'.'+_0xbb8785+_0xbafc('0x15')+_0xbd68ed+'.'+_0xbb8785)['where'](_0x16e14f+_0xbafc('0x16')+_0x44d7e5['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x56dbab,_0x4a0ff7){promisesAdditionalPhones=[];promisesContact=[];return db[_0xbafc('0x17')][_0xbafc('0x18')]('select\x20*\x20from\x20'+tempTableName)[_0xbafc('0x19')](function(_0x54f144){if(_0x54f144!==null){var _0x2c4947=[];for(var _0x57bce2=0x0;_0x57bce2<_0x54f144[_0xbafc('0x1a')];_0x57bce2++){var _0x587285=_0x54f144[_0x57bce2];if(!_[_0xbafc('0x1b')](_0x587285[_0xbafc('0x11')])){if(!_['isNil'](_0x587285[_0xbafc('0x1c')]))_0x2c4947['push'](insertAdditionalPhones(_0x587285));promisesContact[_0xbafc('0x1d')]({'contact':_0x587285});}}}Promise[_0xbafc('0x1e')](_0x2c4947)[_0xbafc('0x1f')](function(){_0x56dbab({'val':0x1});});})[_0xbafc('0x20')](function(_0x11d1ec){logger[_0xbafc('0x21')](_0x11d1ec[_0xbafc('0x22')]);});});}function insertAdditionalPhones(_0x41c674){return new Promise(function(_0x3443d5,_0x267394){var _0x8bdf13=_0x41c674[_0xbafc('0x1c')];if(_[_0xbafc('0x1b')](_0x8bdf13))_0x267394({'val':0x0});else{var _0x35b2c9=_0x8bdf13['split'](';');var _0x5f1330=[];orderBy=0x0;for(var _0x5506d2=0x0;_0x5506d2<_0x35b2c9[_0xbafc('0x1a')];_0x5506d2++){_0x5f1330['push'](splitAdditionalPhone(_0x41c674['id'],_0x35b2c9[_0x5506d2]));}Promise[_0xbafc('0x1e')](_0x5f1330)[_0xbafc('0x1f')](function(){_0x3443d5({'val':_0x35b2c9['length']});});}});}function splitAdditionalPhone(_0x53035d,_0x22188f){return new Promise(function(_0x26e191,_0x5bf96f){var _0xc61a24=_0x22188f[_0xbafc('0x23')](':');var _0x57005b=_0xc61a24[0x0];var _0x281a8d=_0xc61a24[0x1];if(_0x281a8d!==''){var _0x4f33ff=_0x281a8d[_0xbafc('0x23')]('|');var _0x49b242=[];for(var _0x9ed634=0x0;_0x9ed634<_0x4f33ff[_0xbafc('0x1a')];_0x9ed634++){if(_0x4f33ff[_0x9ed634]!==''){var _0x1c16bd=_['filter'](promisesAdditionalPhones,{'contactId':_0x53035d,'phone':_0x4f33ff[_0x9ed634]});if(_0x1c16bd[_0xbafc('0x1a')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x53035d,'contactTypeId':_0x57005b,'phone':_0x4f33ff[_0x9ed634],'orderBy':orderBy});}}}_0x26e191({'ok':0x1});}else _0x26e191({'res':0x0});});}function createAdditionalPhone(_0x50b9ef,_0x153c32,_0x1d2988,_0x172a80){var _0x2b497a='';var _0x29ccea='';var _0x4ec4c5=_0x1d2988[_0xbafc('0x23')]('§');_0x2b497a=_0x4ec4c5[0x0];if(_0x4ec4c5[_0xbafc('0x1a')]==0x2)_0x29ccea=_0x4ec4c5[0x1];return new Promise(function(_0x871e69,_0xf08cc8){return db[_0xbafc('0x24')][_0xbafc('0x25')]({'where':{'CmContactId':_0x50b9ef,'item':_0x2b497a}})['then'](function(_0x11c700){if(_0x11c700){return db['CmContactHasItem']['update']({'ItemTypeId':_0x153c32,'description':_0x29ccea,'OrderBy':_0x172a80},{'where':{'CmContactId':_0x50b9ef,'item':_0x2b497a}})[_0xbafc('0x1f')](function(_0x5bd3db){_0x871e69({'res':'updated'});});}else{return db[_0xbafc('0x24')]['create']({'CmContactId':_0x50b9ef,'item':_0x2b497a,'ItemTypeId':_0x153c32,'description':_0x29ccea,'OrderBy':_0x172a80,'ItemClass':_0xbafc('0x26')})['then'](function(_0x236dde){_0x871e69({'res':_0xbafc('0x27')});});}});});}function updateContact(_0xd2e7c8){return new Promise(function(_0x36b4e5,_0x360239){var _0x552963=_0xd2e7c8['id'];delete _0xd2e7c8['id'];return db[_0xbafc('0x28')][_0xbafc('0x29')](_0xd2e7c8,{'where':{'id':_0x552963}})[_0xbafc('0x1f')](function(_0x59e61c){updatedRows+=0x1;return db[_0xbafc('0x2a')][_0xbafc('0x29')]({'phone':_0xd2e7c8[_0xbafc('0x11')]},{'where':{'ContactId':_0x552963}})['then'](function(_0x2fe992){_0x36b4e5({'ret':'OK'});});});});}function insertCmHopper(_0x39870a,_0x1d230f,_0x1c263a,_0x1a1592,_0x36f1ef){var _0x969110=[_0xbafc('0x2b'),_0xbafc('0x2c'),_0xbafc('0x2d'),_0xbafc('0x2e'),_0x1d230f+'.'+_0x1a1592,_0xbafc('0x2f'),_0xbafc('0x30'),'cm_contacts.priority',_0xbafc('0x31'),'\x22'+_0x36f1ef+'\x22'];return squel[_0xbafc('0x32')]()['into'](_0xbafc('0x33'))[_0xbafc('0x34')](['phone',_0xbafc('0x35'),_0xbafc('0x36'),_0xbafc('0x37'),_0x1a1592,'createdAt',_0xbafc('0x38'),_0xbafc('0x39'),_0xbafc('0x3a'),_0xbafc('0x3b')],squel[_0xbafc('0x3c')]()[_0xbafc('0x3d')](_0x969110)[_0xbafc('0x12')](_0x1d230f)[_0xbafc('0x13')](_0xbafc('0x3e'),null,_0xbafc('0x3f')+_0x1d230f+'.CmListId')[_0xbafc('0x13')](_0x1c263a,null,_0x1c263a+_0xbafc('0x14')+_0x1d230f+'.'+_0x1a1592)[_0xbafc('0x40')](_0x1d230f+_0xbafc('0x41'),_0x39870a)[_0xbafc('0x40')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xbafc('0x40')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1d230f,_0x1c263a,_0x1a1592,_0xbafc('0x33'),[_0xbafc('0x42'),_0xbafc('0x43')]))[_0xbafc('0x40')](_0xbafc('0x44'),selectNotIn(_0x1d230f,_0x1c263a,_0x1a1592,_0xbafc('0x33'),[_0xbafc('0x42')])))[_0xbafc('0x45')]();}function insertCmHopperBlack(_0x295f26,_0x1d5be1,_0x1d4ef1,_0xa3330a){var _0x42d059=['cm_contacts.phone',_0xbafc('0x2d'),'cm_contacts.ListId',_0x1d5be1+'.'+_0xa3330a,_0xbafc('0x2f'),_0xbafc('0x30')];return squel[_0xbafc('0x32')]()[_0xbafc('0x46')]('cm_hopper_black')['fromQuery']([_0xbafc('0x11'),_0xbafc('0x36'),'ListId',_0xa3330a,_0xbafc('0x47'),_0xbafc('0x38')],squel['select']()[_0xbafc('0x3d')](_0x42d059)[_0xbafc('0x12')](_0x1d5be1)[_0xbafc('0x13')](_0xbafc('0x3e'),null,_0xbafc('0x3f')+_0x1d5be1+_0xbafc('0x48'))['join'](_0x1d4ef1,null,_0x1d4ef1+_0xbafc('0x14')+_0x1d5be1+'.'+_0xa3330a)['where'](_0x1d5be1+_0xbafc('0x41'),_0x295f26)['where'](_0xbafc('0x49'),NOW)[_0xbafc('0x40')](_0xbafc('0x44'),squel[_0xbafc('0x3c')]()['field'](_0xbafc('0x11'))[_0xbafc('0x12')]('cm_hopper_black')[_0xbafc('0x40')]('ListId\x20=\x20?',_0x295f26)[_0xbafc('0x40')](_0xa3330a+_0xbafc('0x4a'),_0x1d5be1+'.'+_0xa3330a)))[_0xbafc('0x45')]();}function insertCmHopperAdditionalPhones(_0x5da410){var _0x3cda9e=[_0xbafc('0x4b'),_0xbafc('0x4c'),_0xbafc('0x4d'),_0xbafc('0x4e'),'cm_contact_has_items.updatedAt'];return squel['insert']()['into']('cm_hopper_additional_phones')[_0xbafc('0x34')]([_0xbafc('0x4f'),_0xbafc('0x11'),'OrderBy',_0xbafc('0x47'),'updatedAt'],squel['select']()[_0xbafc('0x3d')](_0x3cda9e)[_0xbafc('0x12')](_0xbafc('0x33'))[_0xbafc('0x13')](_0xbafc('0x3e'),null,_0xbafc('0x50'))['join']('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xbafc('0x40')](_0xbafc('0x51'),_0x5da410)['where'](_0xbafc('0x49'),NOW))[_0xbafc('0x45')]();}function insertCmContact(_0x38ada3,_0x19862f,_0x4d590e,_0x41d332){var _0x150194=_[_0xbafc('0x52')](_[_0xbafc('0x53')](_0x41d332),[_0xbafc('0x37'),_0xbafc('0x54'),_0xbafc('0x47'),_0xbafc('0x38')]);return squel[_0xbafc('0x32')]()['into'](_0xbafc('0x3e'))['fromQuery'](_0x150194,squel[_0xbafc('0x3c')]()[_0xbafc('0x3d')](_0x150194)[_0xbafc('0x12')](_0x19862f)[_0xbafc('0x40')]('('+_0x4d590e[_0xbafc('0x13')](',')+_0xbafc('0x55'),squel['select']()[_0xbafc('0x3d')](_0x4d590e)[_0xbafc('0x12')]('cm_contacts')['where']('ListId\x20=\x20?',_0x38ada3))[_0xbafc('0x40')](_0xbafc('0x56'),squel['select']()[_0xbafc('0x10')](_0xbafc('0x57'),_0xbafc('0x58'))[_0xbafc('0x12')](_0x19862f)['group'](_0x4d590e['join'](','))))[_0xbafc('0x45')]();}function handleStop(){logger[_0xbafc('0x59')](_0xbafc('0x5a'));stopped=!![];}function handleUncaughtException(_0x52cd46){logger[_0xbafc('0x21')](_0x52cd46['message']);process[_0xbafc('0x5b')](0x1);}function handleError(_0xb0caa,_0x4af929){stats[_0xbafc('0x5c')][_0xbafc('0x1d')]({'name':_0x4af929[_0xbafc('0x5d')],'message':_0x4af929[_0xbafc('0x22')],'row':_0xb0caa});}function handleQuery(_0x2ad2bd){logger[_0xbafc('0x59')](_0x2ad2bd);return db[_0xbafc('0x17')]['query'](_0x2ad2bd)[_0xbafc('0x19')](function(_0x8b5140){results['push'](_0x8b5140);})[_0xbafc('0x20')](function(_0x2dd89f){logger['error'](_0x2dd89f['message']);});}function main(_0x5edf49,_0x305f5a,_0xb8cc2,_0x11ba70){logger[_0xbafc('0x59')](_0xbafc('0x5e'),_0x5edf49,JSON[_0xbafc('0x5f')](_0x305f5a));process['send'](_0xbafc('0x60'));var _0xe3f2fa=_0x305f5a[_0xbafc('0x61')];var _0x4385cb=_['clone'](_0xe3f2fa);var _0x5b2dd7=_0x305f5a[_0xbafc('0x62')];var _0x397dd5=path[_0xbafc('0x13')](config['root'],_0xbafc('0x63'),_0x5b2dd7+_0xbafc('0x64'));logger[_0xbafc('0x59')]('body',_0x305f5a);db[_0xbafc('0x65')][_0xbafc('0x66')]({'raw':!![],'attributes':['id','name']})[_0xbafc('0x1f')](function(_0x1000ed){for(var _0x2134fb=0x0;_0x2134fb<_0x1000ed[_0xbafc('0x1a')];_0x2134fb++){if(_0x1000ed[_0x2134fb]['name']in _0xe3f2fa){contactItemTypes[_0xbafc('0x1d')](_0x1000ed[_0x2134fb]);delete _0x4385cb[_0x1000ed[_0x2134fb][_0xbafc('0x67')]];hasAdditionalPhones=!![];}for(var _0x343f71 in _0xe3f2fa){if(_0x1000ed[_0x2134fb][_0xbafc('0x67')]+_0xbafc('0x68')===_0x343f71){phoneDescriptions[_0xbafc('0x1d')]({'itemTypeId':_0x1000ed[_0x2134fb]['id'],'description':_0x343f71});delete _0x4385cb[_0x343f71];}}}if(hasAdditionalPhones)_0x4385cb[_0xbafc('0x1c')]='';var _0x440eba=_[_0xbafc('0x53')](_0x4385cb)[_0xbafc('0x13')]();logger['info']('header',_0x440eba);fs[_0xbafc('0x69')](_0x397dd5,_0x440eba+'\x0a');Papa[_0xbafc('0x6a')](fs[_0xbafc('0x6b')](_0x5edf49),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3757ff,_0x2613d0){try{for(var _0x38447d=0x0,_0xb0e800=[];_0x38447d<_0x3757ff['data'][_0xbafc('0x1a')];_0x38447d++){stats[_0xbafc('0x6c')]+=0x1;if(_0x3757ff['errors'][_0x38447d]){handleError(_0x3757ff['data'][_0x38447d],_0x3757ff[_0xbafc('0x5c')][_0x38447d]);}else{var _0x1a6431=[];var _0x5a6840=[];var _0x40933e={};for(var _0x7d4f42 in _0xe3f2fa){let _0x315a69=contactItemTypes['find'](_0x12d94e=>_0x12d94e[_0xbafc('0x67')]===_0x7d4f42);let _0x1bf3de=contactItemTypes[_0xbafc('0x6d')](_0x282995=>_0x282995[_0xbafc('0x67')]+_0xbafc('0x68')===_0x7d4f42);if(_['isNil'](_0x315a69)&&_['isNil'](_0x1bf3de)){if(_0xe3f2fa[_0xbafc('0x6e')](_0x7d4f42)){if(_0x3757ff['data'][_0x38447d][_0xe3f2fa[_0x7d4f42]]){var _0x520f9d=_['trim'](_0x3757ff[_0xbafc('0x6f')][_0x38447d][_0xe3f2fa[_0x7d4f42]][_0xbafc('0x70')](/"/g,'\x27'));switch(_0x7d4f42){case'scheduledat':var _0x598d88=moment(_0x520f9d,_0xbafc('0xe'),!![]);if(_0x598d88[_0xbafc('0x71')]()){_0xb0e800[_0xbafc('0x1d')]('\x22'+_0x520f9d+'\x22');}else{_0x1a6431[_0xbafc('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xbafc('0x39'):var _0x346f7c=parseInt(_0x520f9d);_0x520f9d=_[_0xbafc('0x72')](_0x346f7c)||_0x346f7c<0x0||_0x346f7c>0x4?_0x11ba70?0x3:0x2:_0x346f7c;_0xb0e800[_0xbafc('0x1d')]('\x22'+_0x520f9d+'\x22');break;case _0xbafc('0x3a'):var _0x2af0fe=parseInt(_0x520f9d);if(_[_0xbafc('0x73')](_0x2af0fe)&&_[_0xbafc('0x74')](_0xb8cc2,_0x2af0fe)){_0xb0e800[_0xbafc('0x1d')]('\x22'+_0x2af0fe+'\x22');}else{_0x1a6431[_0xbafc('0x1d')](_0xbafc('0x75'));}break;case'email':if(isEmail(_0x520f9d)){_0xb0e800[_0xbafc('0x1d')]('\x22'+_0x520f9d+'\x22');}else{_0x1a6431[_0xbafc('0x1d')](_0xbafc('0x76'));}break;case'dateOfBirth':var _0x31df6a=moment(_0x520f9d,_0xbafc('0x77'),!![]);if(_0x31df6a[_0xbafc('0x71')]()){_0xb0e800['push']('\x22'+_0x520f9d+'\x22');}else{_0x1a6431['push'](_0xbafc('0x78'));}break;default:_0xb0e800[_0xbafc('0x1d')]('\x22'+_0x520f9d+'\x22');}}else{switch(_0x7d4f42){case _0xbafc('0x79'):case _0xbafc('0x11'):_0x1a6431[_0xbafc('0x1d')](_0x7d4f42+'\x20not\x20specified');break;default:_0xb0e800[_0xbafc('0x1d')]('\x22\x22');}}}}else{var _0x59e6eb='';if(!_[_0xbafc('0x1b')](_0x315a69)){if(!_0x40933e['hasOwnProperty'](_0x315a69['id'])){for(var _0x2a3d80=0x0;_0x2a3d80<_0xe3f2fa[_0x7d4f42]['length'];_0x2a3d80++){var _0x520f9d=_[_0xbafc('0x7a')](_0x3757ff[_0xbafc('0x6f')][_0x38447d][_0xe3f2fa[_0x7d4f42][_0x2a3d80]][_0xbafc('0x70')](/"/g,'\x27'));var _0x373fab=phoneDescriptions[_0xbafc('0x6d')](_0x215bd0=>_0x215bd0[_0xbafc('0x7b')]===_0x315a69['id']);if(!_[_0xbafc('0x1b')](_0x373fab)){var _0x32709b=_[_0xbafc('0x7a')](_0x3757ff[_0xbafc('0x6f')][_0x38447d][_0xe3f2fa[_0x373fab[_0xbafc('0x7c')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0xbafc('0x1b')](_0x32709b))_0x520f9d=_0x520f9d+'§'+_0x32709b;}if(_0x59e6eb=='')_0x59e6eb=_0x520f9d;else _0x59e6eb+='|'+_0x520f9d;}_0x5a6840[_0xbafc('0x1d')](_0x315a69['id']+':'+_0x59e6eb);_0x40933e[_0x315a69['id']]=0x1;}}}}if(hasAdditionalPhones){_0xb0e800['push']('\x22'+_0x5a6840[_0xbafc('0x13')](';')+'\x22');}if(_0x1a6431[_0xbafc('0x1a')]){handleError(_0x3757ff['data'][_0x38447d],{'code':_0xbafc('0x7d'),'message':_0x1a6431[_0xbafc('0x13')]()});}else{fs[_0xbafc('0x7e')](_0x397dd5,_0xb0e800[_0xbafc('0x13')]()+'\x0a');}_0xb0e800=[];}if(!(stats[_0xbafc('0x6c')]%0xc8)){socket[_0xbafc('0x7f')]('contact:import:'+_0x5b2dd7,stats);stats[_0xbafc('0x5c')]=[];}}if(stopped){logger[_0xbafc('0x59')](_0xbafc('0x80'));_0x2613d0[_0xbafc('0x81')]();}}catch(_0x5e17bf){handleError(_0x3757ff[_0xbafc('0x6f')][_0x38447d],{'code':'SystemError','message':_0x5e17bf['message']});logger['error'](_0xbafc('0x82'),_0x5e17bf[_0xbafc('0x22')]);}},'complete':function(){try{var _0x3c1e4b=[];var _0x2f1bbb=tempTableName;_0x3c1e4b['push'](_0xbafc('0x83')+_0x2f1bbb+'\x20LIKE\x20cm_contacts;');logger[_0xbafc('0x59')](_0xbafc('0x84'),contactItemTypes[_0xbafc('0x1a')]);var _0x2842fc=util[_0xbafc('0xd')](_0xbafc('0x85'),_0x397dd5,_0x2f1bbb,_0x440eba,_0x305f5a[_0xbafc('0x37')],_0x305f5a[_0xbafc('0x54')]||null,NOW,NOW);if(_[_0xbafc('0x1b')](_0xe3f2fa['scheduledat'])){_0x2842fc+=_0xbafc('0x86');}_0x3c1e4b[_0xbafc('0x1d')](_0x2842fc);BPromise[_0xbafc('0x87')](_0x3c1e4b,handleQuery)[_0xbafc('0x1f')](function(_0x685e63){BPromise[_0xbafc('0x1e')]([handleAdditionalPhones()])[_0xbafc('0x1f')](function(){_0x3c1e4b=[];for(var _0x14b7b1=0x0;_0x14b7b1\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','path','papaparse','util','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','phone','join','sequelize','query','select\x20*\x20from\x20','spread','isNil','push','then','catch','error','message','AdditionalPhones','split','length','all','filter','CmContactHasItem','findOne','updated','PHONE','inserted','CmContact','CmHopper','update'];(function(_0x533d0d,_0x478e0c){var _0x453427=function(_0x4310dc){while(--_0x4310dc){_0x533d0d['push'](_0x533d0d['shift']());}};_0x453427(++_0x478e0c);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ccd[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0xd9cc('0x0'));var _=require('lodash');var Papa=require(_0xd9cc('0x1'));var util=require(_0xd9cc('0x2'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0xd9cc('0x3'));var Redis=require('ioredis');var db=require(_0xd9cc('0x4'))['db'];var config=require(_0xd9cc('0x5'));var logger=require(_0xd9cc('0x6'))(_0xd9cc('0x7'));config[_0xd9cc('0x8')]=_[_0xd9cc('0x9')](config[_0xd9cc('0x8')],{'host':_0xd9cc('0xa'),'port':0x18eb});var socket=require(_0xd9cc('0xb'))(new Redis(config[_0xd9cc('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()[_0xd9cc('0xc')](_0xd9cc('0xd'));var tempTableName=_0xd9cc('0xe')+moment()[_0xd9cc('0xc')](_0xd9cc('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x383bd4){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x383bd4);}function selectNotIn(_0x46149b,_0x2b17db,_0x2bdd83,_0x43d68e,_0x2e8a08){return squel[_0xd9cc('0x10')]()[_0xd9cc('0x11')](_0xd9cc('0x12'))['from'](_0x43d68e)[_0xd9cc('0x13')](_0x2b17db,null,_0x2b17db+'.id\x20=\x20'+_0x43d68e+'.'+_0x2bdd83)['where'](_0x43d68e+'.'+_0x2bdd83+'\x20=\x20'+_0x46149b+'.'+_0x2bdd83)['where'](_0x2b17db+'.dialCheckDuplicateType\x20IN\x20('+_0x2e8a08[_0xd9cc('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4521e6,_0x4350f1){promisesAdditionalPhones=[];promisesContact=[];return db[_0xd9cc('0x14')][_0xd9cc('0x15')](_0xd9cc('0x16')+tempTableName)[_0xd9cc('0x17')](function(_0x5a39ac){if(_0x5a39ac!==null){var _0x91b969=[];for(var _0x321a6a=0x0;_0x321a6a<_0x5a39ac['length'];_0x321a6a++){var _0x1006c0=_0x5a39ac[_0x321a6a];if(!_[_0xd9cc('0x18')](_0x1006c0[_0xd9cc('0x12')])){if(!_[_0xd9cc('0x18')](_0x1006c0['AdditionalPhones']))_0x91b969[_0xd9cc('0x19')](insertAdditionalPhones(_0x1006c0));promisesContact[_0xd9cc('0x19')]({'contact':_0x1006c0});}}}Promise['all'](_0x91b969)[_0xd9cc('0x1a')](function(){_0x4521e6({'val':0x1});});})[_0xd9cc('0x1b')](function(_0x1d420f){logger[_0xd9cc('0x1c')](_0x1d420f[_0xd9cc('0x1d')]);});});}function insertAdditionalPhones(_0xd69057){return new Promise(function(_0x59f00d,_0x57266f){var _0x292015=_0xd69057[_0xd9cc('0x1e')];if(_[_0xd9cc('0x18')](_0x292015))_0x57266f({'val':0x0});else{var _0x238652=_0x292015[_0xd9cc('0x1f')](';');var _0x426a5c=[];orderBy=0x0;for(var _0x13d398=0x0;_0x13d398<_0x238652[_0xd9cc('0x20')];_0x13d398++){_0x426a5c[_0xd9cc('0x19')](splitAdditionalPhone(_0xd69057['id'],_0x238652[_0x13d398]));}Promise[_0xd9cc('0x21')](_0x426a5c)[_0xd9cc('0x1a')](function(){_0x59f00d({'val':_0x238652[_0xd9cc('0x20')]});});}});}function splitAdditionalPhone(_0x45b05a,_0x35fb49){return new Promise(function(_0x503451,_0xc74622){var _0x32da4c=_0x35fb49['split'](':');var _0x3128b1=_0x32da4c[0x0];var _0x1f2727=_0x32da4c[0x1];if(_0x1f2727!==''){var _0xe78722=_0x1f2727[_0xd9cc('0x1f')]('|');var _0x3dff40=[];for(var _0x26040f=0x0;_0x26040f<_0xe78722[_0xd9cc('0x20')];_0x26040f++){if(_0xe78722[_0x26040f]!==''){var _0xa61ac2=_[_0xd9cc('0x22')](promisesAdditionalPhones,{'contactId':_0x45b05a,'phone':_0xe78722[_0x26040f]});if(_0xa61ac2['length']==0x0){orderBy++;promisesAdditionalPhones[_0xd9cc('0x19')]({'contactId':_0x45b05a,'contactTypeId':_0x3128b1,'phone':_0xe78722[_0x26040f],'orderBy':orderBy});}}}_0x503451({'ok':0x1});}else _0x503451({'res':0x0});});}function createAdditionalPhone(_0xc084ed,_0xe5ff29,_0x381b83,_0xfcd78c){var _0xef1497='';var _0xa01bf4='';var _0x10a7b1=_0x381b83['split']('§');_0xef1497=_0x10a7b1[0x0];if(_0x10a7b1[_0xd9cc('0x20')]==0x2)_0xa01bf4=_0x10a7b1[0x1];return new Promise(function(_0x2369e4,_0x42d185){return db[_0xd9cc('0x23')][_0xd9cc('0x24')]({'where':{'CmContactId':_0xc084ed,'item':_0xef1497}})[_0xd9cc('0x1a')](function(_0x4e7742){if(_0x4e7742){return db[_0xd9cc('0x23')]['update']({'ItemTypeId':_0xe5ff29,'description':_0xa01bf4,'OrderBy':_0xfcd78c},{'where':{'CmContactId':_0xc084ed,'item':_0xef1497}})['then'](function(_0x339f43){_0x2369e4({'res':_0xd9cc('0x25')});});}else{return db[_0xd9cc('0x23')]['create']({'CmContactId':_0xc084ed,'item':_0xef1497,'ItemTypeId':_0xe5ff29,'description':_0xa01bf4,'OrderBy':_0xfcd78c,'ItemClass':_0xd9cc('0x26')})['then'](function(_0x2416eb){_0x2369e4({'res':_0xd9cc('0x27')});});}});});}function updateContact(_0x130386){return new Promise(function(_0x4b50ab,_0x442242){var _0x388c16=_0x130386['id'];delete _0x130386['id'];return db[_0xd9cc('0x28')]['update'](_0x130386,{'where':{'id':_0x388c16}})[_0xd9cc('0x1a')](function(_0x46f50d){updatedRows+=0x1;return db[_0xd9cc('0x29')][_0xd9cc('0x2a')]({'phone':_0x130386[_0xd9cc('0x12')]},{'where':{'ContactId':_0x388c16}})[_0xd9cc('0x1a')](function(_0x266d16){_0x4b50ab({'ret':'OK'});});});});}function insertCmHopper(_0x5959a4,_0x2a7016,_0x1b9e5c,_0x3d980d,_0x55142a){var _0x3ed3be=[_0xd9cc('0x2b'),_0xd9cc('0x2c'),_0xd9cc('0x2d'),'cm_contacts.ListId',_0x2a7016+'.'+_0x3d980d,_0xd9cc('0x2e'),_0xd9cc('0x2f'),_0xd9cc('0x30'),_0xd9cc('0x31'),'\x22'+_0x55142a+'\x22'];return squel[_0xd9cc('0x32')]()[_0xd9cc('0x33')](_0xd9cc('0x34'))[_0xd9cc('0x35')]([_0xd9cc('0x12'),_0xd9cc('0x36'),_0xd9cc('0x37'),'ListId',_0x3d980d,_0xd9cc('0x38'),_0xd9cc('0x39'),_0xd9cc('0x3a'),_0xd9cc('0x3b'),_0xd9cc('0x3c')],squel[_0xd9cc('0x10')]()['fields'](_0x3ed3be)[_0xd9cc('0x3d')](_0x2a7016)[_0xd9cc('0x13')](_0xd9cc('0x3e'),null,_0xd9cc('0x3f')+_0x2a7016+'.CmListId')[_0xd9cc('0x13')](_0x1b9e5c,null,_0x1b9e5c+_0xd9cc('0x40')+_0x2a7016+'.'+_0x3d980d)['where'](_0x2a7016+_0xd9cc('0x41'),_0x5959a4)[_0xd9cc('0x42')](_0xd9cc('0x43'),NOW)[_0xd9cc('0x42')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2a7016,_0x1b9e5c,_0x3d980d,_0xd9cc('0x34'),[_0xd9cc('0x44'),_0xd9cc('0x45')]))[_0xd9cc('0x42')](_0xd9cc('0x46'),selectNotIn(_0x2a7016,_0x1b9e5c,_0x3d980d,_0xd9cc('0x34'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x4be97e,_0x2d063c,_0x484d2c,_0x5ebb93){var _0x54b282=[_0xd9cc('0x2b'),'cm_contacts.id','cm_contacts.ListId',_0x2d063c+'.'+_0x5ebb93,'cm_contacts.createdAt',_0xd9cc('0x2f')];return squel[_0xd9cc('0x32')]()[_0xd9cc('0x33')]('cm_hopper_black')['fromQuery']([_0xd9cc('0x12'),_0xd9cc('0x37'),_0xd9cc('0x47'),_0x5ebb93,_0xd9cc('0x38'),_0xd9cc('0x39')],squel[_0xd9cc('0x10')]()[_0xd9cc('0x48')](_0x54b282)[_0xd9cc('0x3d')](_0x2d063c)[_0xd9cc('0x13')](_0xd9cc('0x3e'),null,_0xd9cc('0x3f')+_0x2d063c+_0xd9cc('0x49'))[_0xd9cc('0x13')](_0x484d2c,null,_0x484d2c+_0xd9cc('0x40')+_0x2d063c+'.'+_0x5ebb93)['where'](_0x2d063c+_0xd9cc('0x41'),_0x4be97e)[_0xd9cc('0x42')](_0xd9cc('0x43'),NOW)[_0xd9cc('0x42')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xd9cc('0x10')]()[_0xd9cc('0x11')]('phone')[_0xd9cc('0x3d')](_0xd9cc('0x4a'))[_0xd9cc('0x42')]('ListId\x20=\x20?',_0x4be97e)[_0xd9cc('0x42')](_0x5ebb93+_0xd9cc('0x4b'),_0x2d063c+'.'+_0x5ebb93)))['toString']();}function insertCmHopperAdditionalPhones(_0xc51c09){var _0x57046b=[_0xd9cc('0x4c'),'cm_contact_has_items.item',_0xd9cc('0x4d'),_0xd9cc('0x4e'),_0xd9cc('0x4f')];return squel[_0xd9cc('0x32')]()[_0xd9cc('0x33')](_0xd9cc('0x50'))[_0xd9cc('0x35')]([_0xd9cc('0x51'),'phone','OrderBy',_0xd9cc('0x38'),_0xd9cc('0x39')],squel[_0xd9cc('0x10')]()[_0xd9cc('0x48')](_0x57046b)[_0xd9cc('0x3d')](_0xd9cc('0x34'))[_0xd9cc('0x13')](_0xd9cc('0x3e'),null,_0xd9cc('0x52'))[_0xd9cc('0x13')](_0xd9cc('0x53'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where'](_0xd9cc('0x54'),_0xc51c09)['where'](_0xd9cc('0x43'),NOW))['toString']();}function insertCmContact(_0x548763,_0x385b7f,_0x420deb,_0x38e80a){var _0x2f6a51=_[_0xd9cc('0x55')](_[_0xd9cc('0x56')](_0x38e80a),[_0xd9cc('0x47'),_0xd9cc('0x57'),'createdAt',_0xd9cc('0x39')]);return squel[_0xd9cc('0x32')]()['into'](_0xd9cc('0x3e'))[_0xd9cc('0x35')](_0x2f6a51,squel[_0xd9cc('0x10')]()[_0xd9cc('0x48')](_0x2f6a51)[_0xd9cc('0x3d')](_0x385b7f)['where']('('+_0x420deb[_0xd9cc('0x13')](',')+_0xd9cc('0x58'),squel['select']()[_0xd9cc('0x48')](_0x420deb)[_0xd9cc('0x3d')]('cm_contacts')[_0xd9cc('0x42')](_0xd9cc('0x59'),_0x548763))[_0xd9cc('0x42')](_0xd9cc('0x5a'),squel['select']()[_0xd9cc('0x11')](_0xd9cc('0x5b'),_0xd9cc('0x5c'))[_0xd9cc('0x3d')](_0x385b7f)[_0xd9cc('0x5d')](_0x420deb[_0xd9cc('0x13')](','))))['toString']();}function handleStop(){logger[_0xd9cc('0x5e')](_0xd9cc('0x5f'));stopped=!![];}function handleUncaughtException(_0x30d9b4){logger['error'](_0x30d9b4['message']);process[_0xd9cc('0x60')](0x1);}function handleError(_0x17a7bc,_0x489320){stats[_0xd9cc('0x61')][_0xd9cc('0x19')]({'name':_0x489320[_0xd9cc('0x62')],'message':_0x489320[_0xd9cc('0x1d')],'row':_0x17a7bc});}function handleQuery(_0x38f4d5){logger[_0xd9cc('0x5e')](_0x38f4d5);return db[_0xd9cc('0x14')][_0xd9cc('0x15')](_0x38f4d5)[_0xd9cc('0x17')](function(_0x35a89e){results[_0xd9cc('0x19')](_0x35a89e);})[_0xd9cc('0x1b')](function(_0x33a25c){logger[_0xd9cc('0x1c')](_0x33a25c[_0xd9cc('0x1d')]);});}function main(_0x371ac4,_0x532769,_0x42aa22,_0x24707d){logger[_0xd9cc('0x5e')](_0xd9cc('0x63'),_0x371ac4,JSON[_0xd9cc('0x64')](_0x532769));process[_0xd9cc('0x65')]('start');var _0x53d780=_0x532769[_0xd9cc('0x66')];var _0x10fc3e=_['clone'](_0x53d780);var _0x553b4b=_0x532769[_0xd9cc('0x67')];var _0x5c9f1d=path[_0xd9cc('0x13')](config[_0xd9cc('0x68')],_0xd9cc('0x69'),_0x553b4b+_0xd9cc('0x6a'));logger[_0xd9cc('0x5e')](_0xd9cc('0x6b'),_0x532769);db['ContactItemType'][_0xd9cc('0x6c')]({'raw':!![],'attributes':['id',_0xd9cc('0x6d')]})[_0xd9cc('0x1a')](function(_0x1aaae7){for(var _0x4af244=0x0;_0x4af244<_0x1aaae7[_0xd9cc('0x20')];_0x4af244++){if(_0x1aaae7[_0x4af244][_0xd9cc('0x6d')]in _0x53d780){contactItemTypes['push'](_0x1aaae7[_0x4af244]);delete _0x10fc3e[_0x1aaae7[_0x4af244][_0xd9cc('0x6d')]];hasAdditionalPhones=!![];}for(var _0x197d8b in _0x53d780){if(_0x1aaae7[_0x4af244][_0xd9cc('0x6d')]+_0xd9cc('0x6e')===_0x197d8b){phoneDescriptions[_0xd9cc('0x19')]({'itemTypeId':_0x1aaae7[_0x4af244]['id'],'description':_0x197d8b});delete _0x10fc3e[_0x197d8b];}}}if(hasAdditionalPhones)_0x10fc3e[_0xd9cc('0x1e')]='';var _0x667610=_[_0xd9cc('0x56')](_0x10fc3e)[_0xd9cc('0x13')]();logger[_0xd9cc('0x5e')](_0xd9cc('0x6f'),_0x667610);fs['writeFileSync'](_0x5c9f1d,_0x667610+'\x0a');Papa[_0xd9cc('0x70')](fs[_0xd9cc('0x71')](_0x371ac4),{'header':!![],'skipEmptyLines':!![],'step':function(_0x452807,_0x140623){try{for(var _0x52f4c1=0x0,_0x539c25=[];_0x52f4c1<_0x452807['data'][_0xd9cc('0x20')];_0x52f4c1++){stats[_0xd9cc('0x72')]+=0x1;if(_0x452807[_0xd9cc('0x61')][_0x52f4c1]){handleError(_0x452807[_0xd9cc('0x73')][_0x52f4c1],_0x452807[_0xd9cc('0x61')][_0x52f4c1]);}else{var _0x4fea60=[];var _0x4ee344=[];var _0x95309d={};for(var _0x17ea3a in _0x53d780){let _0x180480=contactItemTypes[_0xd9cc('0x74')](_0x14f55b=>_0x14f55b['name']===_0x17ea3a);let _0x12c569=contactItemTypes[_0xd9cc('0x74')](_0x5ba4d0=>_0x5ba4d0['name']+_0xd9cc('0x6e')===_0x17ea3a);if(_[_0xd9cc('0x18')](_0x180480)&&_['isNil'](_0x12c569)){if(_0x53d780[_0xd9cc('0x75')](_0x17ea3a)){if(_0x452807[_0xd9cc('0x73')][_0x52f4c1][_0x53d780[_0x17ea3a]]){var _0x1aa17b=_[_0xd9cc('0x76')](_0x452807[_0xd9cc('0x73')][_0x52f4c1][_0x53d780[_0x17ea3a]][_0xd9cc('0x77')](/"/g,'\x27'));switch(_0x17ea3a){case _0xd9cc('0x36'):var _0xe58597=moment(_0x1aa17b,_0xd9cc('0xd'),!![]);if(_0xe58597['isValid']()){_0x539c25[_0xd9cc('0x19')]('\x22'+_0x1aa17b+'\x22');}else{_0x4fea60[_0xd9cc('0x19')](_0xd9cc('0x78'));}break;case'priority':var _0x70c6d7=parseInt(_0x1aa17b);_0x1aa17b=_[_0xd9cc('0x79')](_0x70c6d7)||_0x70c6d7<0x0||_0x70c6d7>0x4?_0x24707d?0x3:0x2:_0x70c6d7;_0x539c25[_0xd9cc('0x19')]('\x22'+_0x1aa17b+'\x22');break;case _0xd9cc('0x3b'):var _0x3ea200=parseInt(_0x1aa17b);if(_[_0xd9cc('0x7a')](_0x3ea200)&&_[_0xd9cc('0x7b')](_0x42aa22,_0x3ea200)){_0x539c25[_0xd9cc('0x19')]('\x22'+_0x3ea200+'\x22');}else{_0x4fea60[_0xd9cc('0x19')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x1aa17b)){_0x539c25['push']('\x22'+_0x1aa17b+'\x22');}else{_0x4fea60[_0xd9cc('0x19')](_0xd9cc('0x7c'));}break;case'dateOfBirth':var _0x22ba52=moment(_0x1aa17b,_0xd9cc('0x7d'),!![]);if(_0x22ba52[_0xd9cc('0x7e')]()){_0x539c25[_0xd9cc('0x19')]('\x22'+_0x1aa17b+'\x22');}else{_0x4fea60[_0xd9cc('0x19')](_0xd9cc('0x7f'));}break;default:_0x539c25[_0xd9cc('0x19')]('\x22'+_0x1aa17b+'\x22');}}else{switch(_0x17ea3a){case _0xd9cc('0x80'):case _0xd9cc('0x12'):_0x4fea60[_0xd9cc('0x19')](_0x17ea3a+'\x20not\x20specified');break;default:_0x539c25['push']('\x22\x22');}}}}else{var _0x21a561='';if(!_[_0xd9cc('0x18')](_0x180480)){if(!_0x95309d[_0xd9cc('0x75')](_0x180480['id'])){for(var _0x2d161f=0x0;_0x2d161f<_0x53d780[_0x17ea3a]['length'];_0x2d161f++){var _0x1aa17b=_[_0xd9cc('0x76')](_0x452807['data'][_0x52f4c1][_0x53d780[_0x17ea3a][_0x2d161f]][_0xd9cc('0x77')](/"/g,'\x27'));var _0xb2809b=phoneDescriptions[_0xd9cc('0x74')](_0x3a6485=>_0x3a6485[_0xd9cc('0x81')]===_0x180480['id']);if(!_['isNil'](_0xb2809b)){var _0x44400b=_[_0xd9cc('0x76')](_0x452807[_0xd9cc('0x73')][_0x52f4c1][_0x53d780[_0xb2809b[_0xd9cc('0x82')]][0x0]][_0xd9cc('0x77')](/"/g,'\x27'));if(!_['isNil'](_0x44400b))_0x1aa17b=_0x1aa17b+'§'+_0x44400b;}if(_0x21a561=='')_0x21a561=_0x1aa17b;else _0x21a561+='|'+_0x1aa17b;}_0x4ee344[_0xd9cc('0x19')](_0x180480['id']+':'+_0x21a561);_0x95309d[_0x180480['id']]=0x1;}}}}if(hasAdditionalPhones){_0x539c25[_0xd9cc('0x19')]('\x22'+_0x4ee344[_0xd9cc('0x13')](';')+'\x22');}if(_0x4fea60[_0xd9cc('0x20')]){handleError(_0x452807[_0xd9cc('0x73')][_0x52f4c1],{'code':_0xd9cc('0x83'),'message':_0x4fea60[_0xd9cc('0x13')]()});}else{fs[_0xd9cc('0x84')](_0x5c9f1d,_0x539c25['join']()+'\x0a');}_0x539c25=[];}if(!(stats[_0xd9cc('0x72')]%0xc8)){socket['emit']('contact:import:'+_0x553b4b,stats);stats[_0xd9cc('0x61')]=[];}}if(stopped){logger[_0xd9cc('0x5e')](_0xd9cc('0x85'));_0x140623[_0xd9cc('0x86')]();}}catch(_0x4093db){handleError(_0x452807[_0xd9cc('0x73')][_0x52f4c1],{'code':_0xd9cc('0x87'),'message':_0x4093db[_0xd9cc('0x1d')]});logger[_0xd9cc('0x1c')](_0xd9cc('0x88'),_0x4093db[_0xd9cc('0x1d')]);}},'complete':function(){try{var _0xeabe3f=[];var _0x4e348e=tempTableName;_0xeabe3f[_0xd9cc('0x19')](_0xd9cc('0x89')+_0x4e348e+'\x20LIKE\x20cm_contacts;');logger[_0xd9cc('0x5e')](_0xd9cc('0x8a'),contactItemTypes[_0xd9cc('0x20')]);var _0x169c23=util[_0xd9cc('0xc')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x5c9f1d,_0x4e348e,_0x667610,_0x532769[_0xd9cc('0x47')],_0x532769['CompanyId']||null,NOW,NOW);if(_[_0xd9cc('0x18')](_0x53d780['scheduledat'])){_0x169c23+=',\x20scheduledAt\x20=\x20NOW()';}_0xeabe3f[_0xd9cc('0x19')](_0x169c23);BPromise['each'](_0xeabe3f,handleQuery)[_0xd9cc('0x1a')](function(_0x4553aa){BPromise[_0xd9cc('0x21')]([handleAdditionalPhones()])[_0xd9cc('0x1a')](function(){_0xeabe3f=[];for(var _0x13dfcc=0x0;_0x13dfcc\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','groupBy','Setting','findOne','enableEmailPreview','all','COUNT(*)','isEmpty','where','t.id\x20IN\x20?'];(function(_0x2a1d44,_0x1a9015){var _0xe05fd2=function(_0x375827){while(--_0x375827){_0x2a1d44['push'](_0x2a1d44['shift']());}};_0xe05fd2(++_0x1a9015);}(_0xbbf9,0x14f));var _0x9bbf=function(_0x312f73,_0x4e49e7){_0x312f73=_0x312f73-0x0;var _0x43d00d=_0xbbf9[_0x312f73];return _0x43d00d;};'use strict';var _=require(_0x9bbf('0x0'));var squel=require(_0x9bbf('0x1'));var as=require(_0x9bbf('0x2'));var qs=require(_0x9bbf('0x3'));var updateInteraction=require(_0x9bbf('0x4'))[_0x9bbf('0x5')];var utils=require(_0x9bbf('0x6'));var db=require(_0x9bbf('0x7'))['db'];function skipInteractionsQuery(_0x8938b3,_0x256c1a,_0x59e7ef){var _0x1c3673=![];var _0x392a30=utils[_0x9bbf('0x8')](_0x8938b3);if(_0x256c1a[_0x9bbf('0x9')]==='agent'&&!_0x59e7ef[_0x9bbf('0xa')]&&!_0x59e7ef[_0x392a30]){_0x1c3673=!![];}return _0x1c3673;}function getTagsQuery(){return squel[_0x9bbf('0xb')]()[_0x9bbf('0xc')]('id')['field'](_0x9bbf('0xd'))[_0x9bbf('0xc')](_0x9bbf('0xe'))['from']('tools_tags');}function getUsersQuery(_0x2790a9,_0x141820){var _0x3a38d8=utils['getInteractionFK'](_0x2790a9);var _0xa292ee=_0x9bbf('0xf')+_0x2790a9+_0x9bbf('0x10');var _0x5772b1=squel[_0x9bbf('0xb')]()[_0x9bbf('0xc')](_0x9bbf('0x11'))[_0x9bbf('0xc')](_0x9bbf('0x12'))[_0x9bbf('0xc')](_0x9bbf('0x13')+_0x3a38d8)['from'](_0xa292ee,'ui')[_0x9bbf('0x14')](_0x9bbf('0x15'),'u',_0x9bbf('0x16'));if(_0x141820[_0x9bbf('0x17')]>0x0){_0x5772b1['where'](_0x9bbf('0x13')+_0x3a38d8+_0x9bbf('0x18'),_[_0x9bbf('0x19')](_0x141820,'id'));}return _0x5772b1;}function getInteractionsQuery(_0x5d01b7){var _0x5549e1=utils[_0x9bbf('0x1a')](_0x5d01b7);var _0x2ac97a=utils[_0x9bbf('0x8')](_0x5d01b7);var _0xc3df8f=utils['getInteractionFK'](_0x5d01b7);return squel[_0x9bbf('0xb')]()['from'](_0x5549e1['interactions'],'i')[_0x9bbf('0x14')](_0x9bbf('0x1b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x9bbf('0x14')](_0x9bbf('0x15'),'o',_0x9bbf('0x1c'))[_0x9bbf('0x14')](_0x5549e1[_0x9bbf('0x1d')],'a','a.id\x20=\x20i.'+_0x2ac97a)[_0x9bbf('0x14')](_0x5549e1[_0x9bbf('0x1e')],'me','me.'+_0xc3df8f+'\x20=\x20i.id')[_0x9bbf('0x14')](_0x5549e1[_0x9bbf('0x1f')],'it','it.'+_0xc3df8f+_0x9bbf('0x20'))[_0x9bbf('0x14')]('tools_tags','t',_0x9bbf('0x21'));}function getSqlClauses(){var _0x5a082a={'body':squel[_0x9bbf('0x22')](),'contact':squel[_0x9bbf('0x22')](),'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x9bbf('0x22')](),'read':squel['expr'](),'tags':{'clause':squel[_0x9bbf('0x22')](),'ids':null},'user':squel[_0x9bbf('0x22')]()};return _0x5a082a;}function parseTagParameter(_0x9e73f8){var _0x3d8ba2=squel[_0x9bbf('0x22')]();if(_0x9e73f8){var _0x5a466f=utils[_0x9bbf('0x23')](_0x9e73f8);_0x5a466f[_0x9bbf('0x24')](function(_0x39c4a4){_0x3d8ba2['or'](_0x9bbf('0x25'),'%,'+_0x39c4a4+',%');});}return _0x3d8ba2;}function parseReadParameter(_0x5c6b58){var _0x2059e5='';if(_0x5c6b58){_0x2059e5=_0x9bbf('0x26');if(_0x5c6b58==='1'){_0x2059e5=_0x2059e5[_0x9bbf('0x27')](_0x9bbf('0x28'),'=');}else{_0x2059e5=_0x2059e5[_0x9bbf('0x27')]('{OPERATOR}','>');}}return _0x2059e5;}function parseSearchFilter(_0x4786e7,_0x355d1b){var _0x3317d5=squel[_0x9bbf('0x22')]();if(_0x355d1b){var _0x32ee95=_0x355d1b['replace']('\x5c','\x5c\x5c')[_0x9bbf('0x27')](/'/g,'\x27\x27');var _0xf26628=qs[_0x9bbf('0x29')](_0x32ee95);if(qs['isNumeric'](_0x32ee95)){_0x3317d5['or'](_0x9bbf('0x2a'),_0xf26628+'%');if([_0x9bbf('0x2b'),_0x9bbf('0x2c')][_0x9bbf('0x2d')](_0x4786e7)){_0x3317d5['or'](_0x9bbf('0x2e'),_0xf26628+'%');}else if(_0x4786e7===_0x9bbf('0x2f')){_0x3317d5['or'](_0x9bbf('0x30'),_0xf26628+'%');}else if(_0x4786e7===_0x9bbf('0x31')){_0x3317d5['or'](_0x9bbf('0x32'),_0xf26628+'%');}}else if(_0x4786e7==='mail'&&qs[_0x9bbf('0x33')](_0x32ee95)){_0x3317d5['or'](_0x9bbf('0x34'),_0xf26628+'%');}else{if(_0x4786e7===_0x9bbf('0x35')){_0x3317d5['or'](_0x9bbf('0x36'),qs[_0x9bbf('0x37')](_0x32ee95,!![]))['or'](_0x9bbf('0x38'),qs['getFullTextValue'](_0x32ee95));}else if(_0x4786e7!=='fax'){_0x3317d5['or'](_0x9bbf('0x39'),qs['getFullTextValue'](_0x32ee95));}_0x3317d5['or'](_0x9bbf('0x3a'),qs[_0x9bbf('0x37')](_0x32ee95,!![]),null);}}return _0x3317d5;}function parseAdvancedSearchFilter(_0x269739,_0x1176dc){var _0x55a107=getSqlClauses();var _0x4522f3=as[_0x9bbf('0x3b')](_0x269739);var _0x57deda=_0x4522f3['sqlOperator'];for(var _0x3a5e94=0x0;_0x3a5e94<_0x4522f3['conditions'][_0x9bbf('0x17')];_0x3a5e94++){var _0x27641e=_0x4522f3['conditions'][_0x3a5e94];var _0x2eaede='i';var _0x572fe1=_[_0x9bbf('0x3c')](_0x1176dc,[_0x9bbf('0xd'),_0x27641e['field']]);if(_0x572fe1){var _0x56d29f=as[_0x9bbf('0x3d')](_0x2eaede,_0x572fe1['type'],_0x27641e);_0x55a107[_0x9bbf('0x3e')][_0x57deda](_0x56d29f[_0x9bbf('0x3f')],_0x56d29f[_0x9bbf('0x40')][_0x9bbf('0x41')],_0x56d29f[_0x9bbf('0x40')][_0x9bbf('0x42')]);}else{switch(_0x27641e[_0x9bbf('0xc')]){case _0x9bbf('0x43'):var _0x2823f9=parseReadParameter(_0x27641e['value']);_0x55a107['read']['and'](_0x2823f9);break;case'Contact':if(_0x27641e[_0x9bbf('0x44')]===_0x9bbf('0x45')){if(_0x27641e['value'][_0x9bbf('0x46')]('\x20')[_0x9bbf('0x17')]>0x1){_0x55a107[_0x9bbf('0x47')][_0x57deda](_0x9bbf('0x3a'),qs[_0x9bbf('0x37')](_0x27641e[_0x9bbf('0x40')],!![]),null);}else{var _0x22c0bf='%'+_0x27641e[_0x9bbf('0x40')]+'%';_0x55a107[_0x9bbf('0x47')][_0x57deda](_0x9bbf('0x48'),_0x22c0bf,_0x22c0bf,_0x22c0bf);}}else{_0x572fe1=_[_0x9bbf('0x3c')](_0x1176dc,[_0x9bbf('0xd'),_0x9bbf('0x49')]);_0x27641e[_0x9bbf('0xc')]=_0x9bbf('0x49');_0x56d29f=as['buildExpression'](_0x2eaede,_0x572fe1[_0x9bbf('0x4a')],_0x27641e);_0x55a107[_0x9bbf('0x47')][_0x57deda](_0x56d29f[_0x9bbf('0x3f')],_0x56d29f[_0x9bbf('0x40')][_0x9bbf('0x41')],_0x56d29f[_0x9bbf('0x40')][_0x9bbf('0x42')]);}break;case _0x9bbf('0x4b'):var _0x4c15b9=_0x27641e[_0x9bbf('0x40')][_0x9bbf('0x46')](',')[_0x9bbf('0x19')](function(_0x657e48){return Number(_0x657e48);});var _0x431042=parseTagParameter(_0x4c15b9);_0x55a107[_0x9bbf('0x4c')]['clause'][_0x9bbf('0x4d')](_0x431042);_0x55a107[_0x9bbf('0x4c')][_0x9bbf('0x4e')]=_0x4c15b9;break;case'User':if(_0x27641e[_0x9bbf('0x44')]===_0x9bbf('0x45')){_0x55a107['user'][_0x57deda](_0x9bbf('0x4f'),'%'+_0x27641e['value']+'%',null);}else{_0x572fe1=_[_0x9bbf('0x3c')](_0x1176dc,['name',_0x9bbf('0x50')]);_0x27641e[_0x9bbf('0xc')]=_0x9bbf('0x50');_0x56d29f=as['buildExpression'](_0x2eaede,_0x572fe1[_0x9bbf('0x4a')],_0x27641e);_0x55a107[_0x9bbf('0x51')][_0x57deda](_0x56d29f[_0x9bbf('0x3f')],_0x56d29f[_0x9bbf('0x40')][_0x9bbf('0x41')],_0x56d29f[_0x9bbf('0x40')][_0x9bbf('0x42')]);}break;case'body':case _0x9bbf('0x52'):_0x56d29f=as[_0x9bbf('0x3d')]('me',null,_0x27641e);_0x55a107[_0x9bbf('0x53')][_0x57deda](_0x56d29f[_0x9bbf('0x3f')],_0x56d29f[_0x9bbf('0x40')][_0x9bbf('0x41')],_0x56d29f['value'][_0x9bbf('0x42')]);break;}}}return _0x55a107;}function parseModelFields(_0x12329b,_0x4fa20b,_0x5cdd9c){var _0xd58960=utils['getAccountFK'](_0x12329b);var _0x11ebc5=squel[_0x9bbf('0x22')]();var _0x1ea8ab=_(_0x4fa20b)[_0x9bbf('0x54')]()[_0x9bbf('0x19')](function(_0x19238f){return _['some'](_0x5cdd9c,[_0x9bbf('0xd'),_0x19238f])?_0x19238f:undefined;})[_0x9bbf('0x55')]()[_0x9bbf('0x40')]();if(_0x1ea8ab[_0x9bbf('0x17')]>0x0){_0x1ea8ab[_0x9bbf('0x24')](function(_0xcbe59e){if(_0xcbe59e===_0xd58960){_0x11ebc5[_0x9bbf('0x4d')]('i.'+_0xd58960+_0x9bbf('0x18'),[][_0x9bbf('0x56')](_0x4fa20b[_0xcbe59e]));}else if(_0xcbe59e===_0x9bbf('0x57')){var _0x356e8f=JSON['parse'](_0x4fa20b[_0xcbe59e])[_0x9bbf('0x58')];var _0xfc7292=JSON[_0x9bbf('0x59')](_0x4fa20b[_0xcbe59e])[_0x9bbf('0x5a')];_0x11ebc5['and']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x356e8f,_0xfc7292);}else{if(_0x4fa20b[_0xcbe59e]===_0x9bbf('0x5b')){_0x11ebc5[_0x9bbf('0x4d')]('i.'+_0xcbe59e+_0x9bbf('0x5c'));}else{_0x11ebc5[_0x9bbf('0x4d')]('i.'+_0xcbe59e+_0x9bbf('0x5d'),_0x4fa20b[_0xcbe59e]);}}});}return _0x11ebc5;}function parseQueryParameters(_0x32f10d,_0xebd4f8,_0x12b83f){var _0x124ed5=getSqlClauses();return Promise[_0x9bbf('0x5e')]()[_0x9bbf('0x5f')](function(){return parseModelFields(_0x32f10d,_0xebd4f8,_0x12b83f);})[_0x9bbf('0x5f')](function(_0x4814cb){_0x124ed5[_0x9bbf('0x60')][_0x9bbf('0x4d')](_0x4814cb);return parseReadParameter(_0xebd4f8[_0x9bbf('0x61')]);})[_0x9bbf('0x5f')](function(_0x464465){_0x124ed5[_0x9bbf('0x61')][_0x9bbf('0x4d')](_0x464465);return parseTagParameter(_0xebd4f8[_0x9bbf('0x62')]);})[_0x9bbf('0x5f')](function(_0x3b249d){_0x124ed5[_0x9bbf('0x4c')][_0x9bbf('0x63')][_0x9bbf('0x4d')](_0x3b249d);return parseSearchFilter(_0x32f10d,_0xebd4f8['filter']);})[_0x9bbf('0x5f')](function(_0x46e7cf){_0x124ed5[_0x9bbf('0x64')]=_0x46e7cf;return _0x124ed5;});}function checkAccountsRestrictions(_0x1246c4,_0xea5e3f,_0x2c097f){var _0x52e6ff=utils[_0x9bbf('0x8')](_0x1246c4);var _0x42c457='get'+_[_0x9bbf('0x65')](_0x1246c4)+(_0x1246c4===_0x9bbf('0x66')?'Websites':_0x9bbf('0x67'));var _0x21b670=squel['expr']();return Promise[_0x9bbf('0x5e')]()['then'](function(){if(_0x2c097f[_0x9bbf('0xa')]&&_0xea5e3f['role']===_0x9bbf('0x68')){return _0xea5e3f[_0x42c457]({'attributes':['id'],'raw':!![]});}})[_0x9bbf('0x5f')](function(_0x745a1d){if(_0x745a1d){if(_0x745a1d['length']===0x0){_0x21b670['and']('i.'+_0x52e6ff+_0x9bbf('0x5c'));}else{_0x21b670[_0x9bbf('0x4d')]('i.'+_0x52e6ff+_0x9bbf('0x18'),_['map'](_0x745a1d,'id'));}}else if(!_0x2c097f[_0x52e6ff]){_0x21b670[_0x9bbf('0x4d')]('i.'+_0x52e6ff+_0x9bbf('0x69'));}})[_0x9bbf('0x5f')](function(){return _0x21b670;});}function getClosedOrderClause(_0x5872fb,_0x56b2ba){var _0x2020eb='';var _0x59a8c7=[_0x9bbf('0x6a'),_0x9bbf('0x6b'),_0x9bbf('0x6c')];if(_0x5872fb===_0x9bbf('0x35')){_0x59a8c7['unshift']('i.substatus');}if(_0x56b2ba[_0x9bbf('0x6d')]==='0'&&_0x5872fb==='mail'){_0x2020eb='i.substatus';}else{if(_0x56b2ba[_0x9bbf('0x6d')]==='1'){_0x59a8c7[_0x9bbf('0x6e')]();}_0x2020eb=_0x9bbf('0x6f')+_0x59a8c7[_0x9bbf('0x70')](',\x20')+')';}return _0x2020eb;}function getFilteredInteractions(_0x187982,_0x101ee1,_0x740389,_0x10a076){var _0x3d3e67=utils[_0x9bbf('0x71')](_0x187982);var _0x590092=_[_0x9bbf('0x65')](_0x187982)+_0x9bbf('0x72');var _0x19abd1=[];var _0x24a21c=getTagsQuery();var _0x4683ac={'type':db[_0x9bbf('0x73')][_0x9bbf('0x74')]['SELECT'],'raw':!![]};var _0x4933d8=[];var _0x159ce3=[];return db['sequelize'][_0x9bbf('0x75')](_0x24a21c[_0x9bbf('0x76')](),_0x4683ac)['then'](function(_0x2239eb){_0x19abd1=_[_0x9bbf('0x77')](_0x2239eb,'id');_0x4683ac=_['merge'](_0x4683ac,{'model':db[_0x590092],'mapToModel':!![],'nest':!![]});if(_0x740389['fields']){_0x10a076['attributes'][_0x9bbf('0x24')](function(_0xc7c65){_0x101ee1[_0x9bbf('0xc')]('i.'+_0xc7c65);});}else{_0x101ee1['field'](_0x9bbf('0x78'),'unreadMessages');_0x101ee1['field']('a.key',_0x9bbf('0x79'));_0x101ee1[_0x9bbf('0xc')](_0x9bbf('0x7a'),'Account.mandatoryDisposition');if(_0x187982===_0x9bbf('0x35')){_0x101ee1['field'](_0x9bbf('0x7b'),'Account.email');_0x101ee1[_0x9bbf('0xc')](_0x9bbf('0x7c'),'contactName');_0x101ee1[_0x9bbf('0xc')](_0x9bbf('0x7d'));_0x101ee1[_0x9bbf('0xc')]('i.createdAt');_0x101ee1[_0x9bbf('0xc')](_0x9bbf('0x7e'));_0x101ee1[_0x9bbf('0xc')](_0x9bbf('0x7f'));_0x101ee1[_0x9bbf('0xc')](_0x9bbf('0x80'));_0x101ee1[_0x9bbf('0xc')](_0x9bbf('0x81'));_0x101ee1[_0x9bbf('0xc')](_0x9bbf('0x82'));_0x101ee1[_0x9bbf('0xc')]('i.lastMsgDirection');_0x101ee1['field'](_0x9bbf('0x83'));_0x101ee1['field'](_0x9bbf('0x6c'));_0x101ee1[_0x9bbf('0xc')](_0x9bbf('0x6b'));_0x101ee1[_0x9bbf('0xc')](_0x9bbf('0x6a'));_0x101ee1['field'](_0x9bbf('0x84'));_0x101ee1[_0x9bbf('0xc')](_0x9bbf('0x85'));_0x101ee1[_0x9bbf('0xc')](_0x9bbf('0x86'));_0x101ee1[_0x9bbf('0xc')](_0x9bbf('0x87'));_0x101ee1[_0x9bbf('0xc')](_0x9bbf('0x88'));}else if(_0x187982==='openchannel'){_0x101ee1[_0x9bbf('0xc')]('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x9bbf('0x89'));}else{_0x101ee1[_0x9bbf('0xc')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x9bbf('0x89'));}if(_0x187982!==_0x9bbf('0x35')){_0x101ee1[_0x9bbf('0xc')](_0x9bbf('0x8a'));}_0x101ee1['field'](_0x9bbf('0x8b'),_0x9bbf('0x8c'));_0x101ee1[_0x9bbf('0xc')](_0x9bbf('0x8d'),_0x9bbf('0x8e'));_0x101ee1[_0x9bbf('0xc')](_0x9bbf('0x8f'),'Contact.email');_0x101ee1['field'](_0x9bbf('0x90'),_0x9bbf('0x91'));_0x101ee1['field']('c.mobile',_0x9bbf('0x92'));_0x101ee1[_0x9bbf('0xc')](_0x9bbf('0x93'),_0x9bbf('0x94'));_0x101ee1['field'](_0x9bbf('0x95'),_0x9bbf('0x96'));_0x101ee1[_0x9bbf('0xc')](_0x9bbf('0x97'),'Owner.internal');_0x101ee1[_0x9bbf('0xc')](_0x9bbf('0x98'),_0x9bbf('0x99'));}if(_0x10a076[_0x9bbf('0x9a')]){_0x101ee1[_0x9bbf('0x9a')](_0x10a076[_0x9bbf('0x9a')]);}if(_0x10a076[_0x9bbf('0x9b')]){_0x101ee1[_0x9bbf('0x9b')](_0x10a076[_0x9bbf('0x9b')]);}return db['sequelize'][_0x9bbf('0x75')](_0x101ee1[_0x9bbf('0x76')](),_0x4683ac);})['then'](function(_0x1d258d){_0x4933d8=_0x1d258d;var _0x43f2da=getUsersQuery(_0x187982,_0x4933d8);return db[_0x9bbf('0x9c')][_0x9bbf('0x75')](_0x43f2da['toString'](),_0x4683ac);})[_0x9bbf('0x5f')](function(_0x82903f){_0x159ce3=_[_0x9bbf('0x9d')](_0x82903f,_0x3d3e67);if(_0x187982==='mail'){return db[_0x9bbf('0x9e')][_0x9bbf('0x9f')]({'attributes':[_0x9bbf('0xa0')],'raw':!![]});}})[_0x9bbf('0x5f')](function(_0x26f67e){var _0x5c4a9f=_0x26f67e?_0x26f67e[_0x9bbf('0xa0')]:undefined;var _0x56dd70=_0x4933d8[_0x9bbf('0x19')](function(_0x16326e){return updateInteraction(_0x16326e,_0x19abd1,_0x159ce3,_0x5c4a9f);});return Promise[_0x9bbf('0xa1')](_0x56dd70);});}function countFilteredInteractions(_0x18e8e5,_0x4ac430){var _0xe16cb0=_0x18e8e5['clone']();_0xe16cb0['field'](_0x9bbf('0xa2'));_0xe16cb0[_0x9bbf('0xc')](_0x9bbf('0x78'),_0x9bbf('0x43'));var _0x3f30c2=utils[_0x9bbf('0x23')](_0x4ac430);if(!_[_0x9bbf('0xa3')](_0x3f30c2)){_0xe16cb0[_0x9bbf('0xa4')](_0x9bbf('0xa5'),_0x3f30c2);}var _0x247f13={'type':db['Sequelize'][_0x9bbf('0x74')][_0x9bbf('0xa6')],'raw':!![]};return db[_0x9bbf('0x9c')][_0x9bbf('0x75')](_0xe16cb0[_0x9bbf('0x76')](),_0x247f13);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x0cc9=['keyBy','merge','attributes','forEach','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','Account.email','i.id','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgDirection','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','contactName','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','toString','Setting','enableEmailPreview','all','isEmpty','t.id\x20IN\x20?','exports','../parsers/advancedSearch','../parsers/qs','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','color','from','tools_tags','user_has_','_interactions','u.fullname','ui.','left_join','users','length','where','map','interactions','a.id\x20=\x20i.','me.','\x20=\x20i.id','interactionsTags','t.id\x20=\x20it.TagId','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','{OPERATOR}','replace','escapeLIKESpecialChars','isNumeric','i.id\x20LIKE\x20?','whatsapp','includes','i.phone\x20LIKE\x20?','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','buildExpression','type','default','start','end','read','and','Contact','split','contact','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','Tag','tags','clause','ids','operator','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','body','plainBody','keys','some','name','compact','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','resolve','then','filter','get','capitalize','Websites','Accounts','\x20IS\x20NULL','\x20IN\x20?','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','getInteractionFK','Interaction','Sequelize','SELECT','sequelize','query'];(function(_0x242142,_0x65ccb4){var _0x4f1fb4=function(_0x2e4965){while(--_0x2e4965){_0x242142['push'](_0x242142['shift']());}};_0x4f1fb4(++_0x65ccb4);}(_0x0cc9,0xcc));var _0x90cc=function(_0x1d4449,_0x495153){_0x1d4449=_0x1d4449-0x0;var _0x4dcde3=_0x0cc9[_0x1d4449];return _0x4dcde3;};'use strict';var _=require('lodash');var squel=require('squel');var as=require(_0x90cc('0x0'));var qs=require(_0x90cc('0x1'));var updateInteraction=require('./update-interaction')['updateInteraction'];var utils=require(_0x90cc('0x2'));var db=require(_0x90cc('0x3'))['db'];function skipInteractionsQuery(_0x3e585f,_0x1ece6d,_0x2df457){var _0x296227=![];var _0x4df662=utils[_0x90cc('0x4')](_0x3e585f);if(_0x1ece6d[_0x90cc('0x5')]===_0x90cc('0x6')&&!_0x2df457[_0x90cc('0x7')]&&!_0x2df457[_0x4df662]){_0x296227=!![];}return _0x296227;}function getTagsQuery(){return squel[_0x90cc('0x8')]()[_0x90cc('0x9')]('id')[_0x90cc('0x9')]('name')[_0x90cc('0x9')](_0x90cc('0xa'))[_0x90cc('0xb')](_0x90cc('0xc'));}function getUsersQuery(_0x344e4b,_0x4bef62){var _0x2a9506=utils['getInteractionFK'](_0x344e4b);var _0x5c5b9d=_0x90cc('0xd')+_0x344e4b+_0x90cc('0xe');var _0xe79027=squel[_0x90cc('0x8')]()[_0x90cc('0x9')]('u.id')[_0x90cc('0x9')](_0x90cc('0xf'))['field'](_0x90cc('0x10')+_0x2a9506)[_0x90cc('0xb')](_0x5c5b9d,'ui')[_0x90cc('0x11')](_0x90cc('0x12'),'u','u.id\x20=\x20ui.UserId');if(_0x4bef62[_0x90cc('0x13')]>0x0){_0xe79027[_0x90cc('0x14')]('ui.'+_0x2a9506+'\x20IN\x20?',_[_0x90cc('0x15')](_0x4bef62,'id'));}return _0xe79027;}function getInteractionsQuery(_0x3fe5a6){var _0x586ff2=utils['getInteractionsTables'](_0x3fe5a6);var _0x27f250=utils[_0x90cc('0x4')](_0x3fe5a6);var _0x2baa96=utils['getInteractionFK'](_0x3fe5a6);return squel[_0x90cc('0x8')]()[_0x90cc('0xb')](_0x586ff2[_0x90cc('0x16')],'i')[_0x90cc('0x11')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x90cc('0x11')](_0x90cc('0x12'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x586ff2['accounts'],'a',_0x90cc('0x17')+_0x27f250)['left_join'](_0x586ff2['messages'],'me',_0x90cc('0x18')+_0x2baa96+_0x90cc('0x19'))['left_join'](_0x586ff2[_0x90cc('0x1a')],'it','it.'+_0x2baa96+'\x20=\x20i.id')[_0x90cc('0x11')](_0x90cc('0xc'),'t',_0x90cc('0x1b'));}function getSqlClauses(){var _0x41bcb6={'body':squel[_0x90cc('0x1c')](),'contact':squel['expr'](),'default':squel[_0x90cc('0x1c')](),'fields':squel[_0x90cc('0x1c')](),'filter':squel[_0x90cc('0x1c')](),'read':squel[_0x90cc('0x1c')](),'tags':{'clause':squel[_0x90cc('0x1c')](),'ids':null},'user':squel[_0x90cc('0x1c')]()};return _0x41bcb6;}function parseTagParameter(_0xccfad8){var _0xc6da12=squel[_0x90cc('0x1c')]();if(_0xccfad8){var _0x24d669=utils[_0x90cc('0x1d')](_0xccfad8);_0x24d669['forEach'](function(_0x3c4a32){_0xc6da12['or'](_0x90cc('0x1e'),'%,'+_0x3c4a32+',%');});}return _0xc6da12;}function parseReadParameter(_0x24488a){var _0xb0dcab='';if(_0x24488a){_0xb0dcab='unreadMessages\x20{OPERATOR}\x200';if(_0x24488a==='1'){_0xb0dcab=_0xb0dcab['replace'](_0x90cc('0x1f'),'=');}else{_0xb0dcab=_0xb0dcab[_0x90cc('0x20')]('{OPERATOR}','>');}}return _0xb0dcab;}function parseSearchFilter(_0x81099c,_0xdedc49){var _0x3a3e8b=squel[_0x90cc('0x1c')]();if(_0xdedc49){var _0xcc98cb=_0xdedc49[_0x90cc('0x20')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');var _0x13b5cb=qs[_0x90cc('0x21')](_0xcc98cb);if(qs[_0x90cc('0x22')](_0xcc98cb)){_0x3a3e8b['or'](_0x90cc('0x23'),_0x13b5cb+'%');if(['sms',_0x90cc('0x24')][_0x90cc('0x25')](_0x81099c)){_0x3a3e8b['or'](_0x90cc('0x26'),_0x13b5cb+'%');}else if(_0x81099c==='fax'){_0x3a3e8b['or'](_0x90cc('0x27'),_0x13b5cb+'%');}else if(_0x81099c===_0x90cc('0x28')){_0x3a3e8b['or'](_0x90cc('0x29'),_0x13b5cb+'%');}}else if(_0x81099c===_0x90cc('0x2a')&&qs[_0x90cc('0x2b')](_0xcc98cb)){_0x3a3e8b['or']('c.email\x20LIKE\x20?',_0x13b5cb+'%');}else{if(_0x81099c===_0x90cc('0x2a')){_0x3a3e8b['or'](_0x90cc('0x2c'),qs[_0x90cc('0x2d')](_0xcc98cb,!![]))['or'](_0x90cc('0x2e'),qs[_0x90cc('0x2d')](_0xcc98cb));}else if(_0x81099c!==_0x90cc('0x2f')){_0x3a3e8b['or'](_0x90cc('0x30'),qs[_0x90cc('0x2d')](_0xcc98cb));}_0x3a3e8b['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x90cc('0x2d')](_0xcc98cb,!![]),null);}}return _0x3a3e8b;}function parseAdvancedSearchFilter(_0x3a91b7,_0x589f2a){var _0x54dc04=getSqlClauses();var _0x3861d7=as['parseSearch'](_0x3a91b7);var _0x12ecfa=_0x3861d7[_0x90cc('0x31')];for(var _0x2fb45c=0x0;_0x2fb45c<_0x3861d7[_0x90cc('0x32')][_0x90cc('0x13')];_0x2fb45c++){var _0x16105e=_0x3861d7['conditions'][_0x2fb45c];var _0x4f2ecf='i';var _0x123902=_['find'](_0x589f2a,['name',_0x16105e['field']]);if(_0x123902){var _0x463153=as[_0x90cc('0x33')](_0x4f2ecf,_0x123902[_0x90cc('0x34')],_0x16105e);_0x54dc04[_0x90cc('0x35')][_0x12ecfa](_0x463153['text'],_0x463153['value'][_0x90cc('0x36')],_0x463153['value'][_0x90cc('0x37')]);}else{switch(_0x16105e['field']){case'unreadMessages':var _0xad4eb4=parseReadParameter(_0x16105e['value']);_0x54dc04[_0x90cc('0x38')][_0x90cc('0x39')](_0xad4eb4);break;case _0x90cc('0x3a'):if(_0x16105e['operator']==='$substring'){if(_0x16105e['value'][_0x90cc('0x3b')]('\x20')[_0x90cc('0x13')]>0x1){_0x54dc04[_0x90cc('0x3c')][_0x12ecfa]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x90cc('0x2d')](_0x16105e['value'],!![]),null);}else{var _0xe10e74='%'+_0x16105e[_0x90cc('0x3d')]+'%';_0x54dc04[_0x90cc('0x3c')][_0x12ecfa](_0x90cc('0x3e'),_0xe10e74,_0xe10e74,_0xe10e74);}}else{_0x123902=_[_0x90cc('0x3f')](_0x589f2a,['name',_0x90cc('0x40')]);_0x16105e[_0x90cc('0x9')]=_0x90cc('0x40');_0x463153=as['buildExpression'](_0x4f2ecf,_0x123902[_0x90cc('0x34')],_0x16105e);_0x54dc04[_0x90cc('0x3c')][_0x12ecfa](_0x463153[_0x90cc('0x41')],_0x463153['value'][_0x90cc('0x36')],_0x463153[_0x90cc('0x3d')]['end']);}break;case _0x90cc('0x42'):var _0xedfe91=_0x16105e[_0x90cc('0x3d')][_0x90cc('0x3b')](',')[_0x90cc('0x15')](function(_0xc9e4b6){return Number(_0xc9e4b6);});var _0x50e15a=parseTagParameter(_0xedfe91);_0x54dc04[_0x90cc('0x43')][_0x90cc('0x44')][_0x90cc('0x39')](_0x50e15a);_0x54dc04[_0x90cc('0x43')][_0x90cc('0x45')]=_0xedfe91;break;case'User':if(_0x16105e[_0x90cc('0x46')]==='$substring'){_0x54dc04[_0x90cc('0x47')][_0x12ecfa](_0x90cc('0x48'),'%'+_0x16105e[_0x90cc('0x3d')]+'%',null);}else{_0x123902=_[_0x90cc('0x3f')](_0x589f2a,['name',_0x90cc('0x49')]);_0x16105e[_0x90cc('0x9')]=_0x90cc('0x49');_0x463153=as[_0x90cc('0x33')](_0x4f2ecf,_0x123902[_0x90cc('0x34')],_0x16105e);_0x54dc04[_0x90cc('0x47')][_0x12ecfa](_0x463153['text'],_0x463153[_0x90cc('0x3d')][_0x90cc('0x36')],_0x463153[_0x90cc('0x3d')][_0x90cc('0x37')]);}break;case _0x90cc('0x4a'):case _0x90cc('0x4b'):_0x463153=as['buildExpression']('me',null,_0x16105e);_0x54dc04[_0x90cc('0x4a')][_0x12ecfa](_0x463153[_0x90cc('0x41')],_0x463153[_0x90cc('0x3d')]['start'],_0x463153[_0x90cc('0x3d')]['end']);break;}}}return _0x54dc04;}function parseModelFields(_0x405d4a,_0x5adeab,_0x45e406){var _0x153b63=utils[_0x90cc('0x4')](_0x405d4a);var _0xbae3f8=squel['expr']();var _0x15cb9b=_(_0x5adeab)[_0x90cc('0x4c')]()[_0x90cc('0x15')](function(_0x96bcae){return _[_0x90cc('0x4d')](_0x45e406,[_0x90cc('0x4e'),_0x96bcae])?_0x96bcae:undefined;})[_0x90cc('0x4f')]()[_0x90cc('0x3d')]();if(_0x15cb9b['length']>0x0){_0x15cb9b['forEach'](function(_0x76055c){if(_0x76055c===_0x153b63){_0xbae3f8[_0x90cc('0x39')]('i.'+_0x153b63+'\x20IN\x20?',[]['concat'](_0x5adeab[_0x76055c]));}else if(_0x76055c===_0x90cc('0x50')){var _0xdf9a2=JSON[_0x90cc('0x51')](_0x5adeab[_0x76055c])[_0x90cc('0x52')];var _0x36a806=JSON['parse'](_0x5adeab[_0x76055c])['$lte'];_0xbae3f8['and'](_0x90cc('0x53'),_0xdf9a2,_0x36a806);}else{if(_0x5adeab[_0x76055c]===_0x90cc('0x54')){_0xbae3f8[_0x90cc('0x39')]('i.'+_0x76055c+'\x20IS\x20NULL');}else{_0xbae3f8[_0x90cc('0x39')]('i.'+_0x76055c+_0x90cc('0x55'),_0x5adeab[_0x76055c]);}}});}return _0xbae3f8;}function parseQueryParameters(_0x21cf36,_0x22803c,_0x29d6c6){var _0x188885=getSqlClauses();return Promise[_0x90cc('0x56')]()['then'](function(){return parseModelFields(_0x21cf36,_0x22803c,_0x29d6c6);})['then'](function(_0x217a2a){_0x188885['fields']['and'](_0x217a2a);return parseReadParameter(_0x22803c[_0x90cc('0x38')]);})[_0x90cc('0x57')](function(_0x1f4876){_0x188885[_0x90cc('0x38')][_0x90cc('0x39')](_0x1f4876);return parseTagParameter(_0x22803c['tag']);})[_0x90cc('0x57')](function(_0x2d381f){_0x188885['tags']['clause'][_0x90cc('0x39')](_0x2d381f);return parseSearchFilter(_0x21cf36,_0x22803c[_0x90cc('0x58')]);})[_0x90cc('0x57')](function(_0x3b0cf3){_0x188885[_0x90cc('0x58')]=_0x3b0cf3;return _0x188885;});}function checkAccountsRestrictions(_0x3ae550,_0xcb075c,_0x4f25a4){var _0x57d783=utils[_0x90cc('0x4')](_0x3ae550);var _0x3fa55f=_0x90cc('0x59')+_[_0x90cc('0x5a')](_0x3ae550)+(_0x3ae550==='chat'?_0x90cc('0x5b'):_0x90cc('0x5c'));var _0x108213=squel[_0x90cc('0x1c')]();return Promise[_0x90cc('0x56')]()[_0x90cc('0x57')](function(){if(_0x4f25a4[_0x90cc('0x7')]&&_0xcb075c[_0x90cc('0x5')]===_0x90cc('0x6')){return _0xcb075c[_0x3fa55f]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x2665b2){if(_0x2665b2){if(_0x2665b2[_0x90cc('0x13')]===0x0){_0x108213['and']('i.'+_0x57d783+_0x90cc('0x5d'));}else{_0x108213[_0x90cc('0x39')]('i.'+_0x57d783+_0x90cc('0x5e'),_[_0x90cc('0x15')](_0x2665b2,'id'));}}else if(!_0x4f25a4[_0x57d783]){_0x108213[_0x90cc('0x39')]('i.'+_0x57d783+_0x90cc('0x5f'));}})[_0x90cc('0x57')](function(){return _0x108213;});}function getClosedOrderClause(_0x331e63,_0x1d40cd){var _0x20ae37='';var _0x35a8b1=[_0x90cc('0x60'),'i.secondDisposition',_0x90cc('0x61')];if(_0x331e63===_0x90cc('0x2a')){_0x35a8b1[_0x90cc('0x62')](_0x90cc('0x63'));}if(_0x1d40cd['closed']==='0'&&_0x331e63===_0x90cc('0x2a')){_0x20ae37='i.substatus';}else{if(_0x1d40cd[_0x90cc('0x64')]==='1'){_0x35a8b1[_0x90cc('0x65')]();}_0x20ae37=_0x90cc('0x66')+_0x35a8b1[_0x90cc('0x67')](',\x20')+')';}return _0x20ae37;}function getFilteredInteractions(_0x266682,_0x19c4d5,_0x1777be,_0x1f0d7e){var _0x97235b=utils[_0x90cc('0x68')](_0x266682);var _0x30e137=_[_0x90cc('0x5a')](_0x266682)+_0x90cc('0x69');var _0x2330ae=[];var _0x24226f=getTagsQuery();var _0x3d2930={'type':db[_0x90cc('0x6a')]['QueryTypes'][_0x90cc('0x6b')],'raw':!![]};var _0x113e3f=[];var _0x365daf=[];return db[_0x90cc('0x6c')][_0x90cc('0x6d')](_0x24226f['toString'](),_0x3d2930)[_0x90cc('0x57')](function(_0x1334cc){_0x2330ae=_[_0x90cc('0x6e')](_0x1334cc,'id');_0x3d2930=_[_0x90cc('0x6f')](_0x3d2930,{'model':db[_0x30e137],'mapToModel':!![],'nest':!![]});if(_0x1777be['fields']){_0x1f0d7e[_0x90cc('0x70')][_0x90cc('0x71')](function(_0x434d67){_0x19c4d5[_0x90cc('0x9')]('i.'+_0x434d67);});}else{_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x72'),_0x90cc('0x73'));_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x74'),'Account.key');_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x75'),_0x90cc('0x76'));if(_0x266682==='mail'){_0x19c4d5[_0x90cc('0x9')]('a.email',_0x90cc('0x77'));_0x19c4d5[_0x90cc('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');_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x78'));_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x79'));_0x19c4d5['field'](_0x90cc('0x7a'));_0x19c4d5['field']('i.closed');_0x19c4d5['field'](_0x90cc('0x7b'));_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x7c'));_0x19c4d5['field']('i.lastMsgAt');_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x7d'));_0x19c4d5[_0x90cc('0x9')]('i.subject');_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x61'));_0x19c4d5['field'](_0x90cc('0x7e'));_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x60'));_0x19c4d5[_0x90cc('0x9')]('i.substatus');_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x7f'));_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x80'));_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x81'));_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x82'));}else if(_0x266682===_0x90cc('0x28')){_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x83'),_0x90cc('0x84'));}else{_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x85'),'contactName');}if(_0x266682!==_0x90cc('0x2a')){_0x19c4d5[_0x90cc('0x9')]('i.*');}_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x86'),_0x90cc('0x87'));_0x19c4d5[_0x90cc('0x9')]('c.lastName',_0x90cc('0x88'));_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x89'),'Contact.email');_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x8a'),_0x90cc('0x8b'));_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x8c'),_0x90cc('0x8d'));_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x8e'),_0x90cc('0x8f'));_0x19c4d5['field'](_0x90cc('0x90'),'Owner.fullname');_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x91'),_0x90cc('0x92'));_0x19c4d5[_0x90cc('0x9')](_0x90cc('0x93'),'TagIds');}if(_0x1f0d7e[_0x90cc('0x94')]){_0x19c4d5['limit'](_0x1f0d7e[_0x90cc('0x94')]);}if(_0x1f0d7e[_0x90cc('0x95')]){_0x19c4d5[_0x90cc('0x95')](_0x1f0d7e[_0x90cc('0x95')]);}return db[_0x90cc('0x6c')][_0x90cc('0x6d')](_0x19c4d5['toString'](),_0x3d2930);})[_0x90cc('0x57')](function(_0x11f0b2){_0x113e3f=_0x11f0b2;var _0x90ef04=getUsersQuery(_0x266682,_0x113e3f);return db[_0x90cc('0x6c')]['query'](_0x90ef04[_0x90cc('0x96')](),_0x3d2930);})['then'](function(_0x2d31f4){_0x365daf=_['groupBy'](_0x2d31f4,_0x97235b);if(_0x266682===_0x90cc('0x2a')){return db[_0x90cc('0x97')]['findOne']({'attributes':[_0x90cc('0x98')],'raw':!![]});}})[_0x90cc('0x57')](function(_0xc84938){var _0x3b03ef=_0xc84938?_0xc84938['enableEmailPreview']:undefined;var _0x40076a=_0x113e3f[_0x90cc('0x15')](function(_0xcdd31e){return updateInteraction(_0xcdd31e,_0x2330ae,_0x365daf,_0x3b03ef);});return Promise[_0x90cc('0x99')](_0x40076a);});}function countFilteredInteractions(_0x229d9b,_0x5828a7){var _0x5a560e=_0x229d9b['clone']();_0x5a560e[_0x90cc('0x9')]('COUNT(*)');_0x5a560e[_0x90cc('0x9')](_0x90cc('0x72'),_0x90cc('0x73'));var _0x555dc3=utils['getSelectedTags'](_0x5828a7);if(!_[_0x90cc('0x9a')](_0x555dc3)){_0x5a560e[_0x90cc('0x14')](_0x90cc('0x9b'),_0x555dc3);}var _0x8ab6bd={'type':db[_0x90cc('0x6a')]['QueryTypes'][_0x90cc('0x6b')],'raw':!![]};return db[_0x90cc('0x6c')][_0x90cc('0x6d')](_0x5a560e[_0x90cc('0x96')](),_0x8ab6bd);}module[_0x90cc('0x9c')]={'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 d62ad35..54d7cd8 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 _0x5cf6=['forEach','push','waiting','unmanaged','abandoned','total','closed','disposition','UserId','answered','talking','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','../../mysqldb','map','split'];(function(_0x12f809,_0x4fb320){var _0x1317e8=function(_0x5080df){while(--_0x5080df){_0x12f809['push'](_0x12f809['shift']());}};_0x1317e8(++_0x4fb320);}(_0x5cf6,0x1ad));var _0x65cf=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x5cf6[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var db=require(_0x65cf('0x0'))['db'];function getInteractionUsers(_0x405bd1,_0x554b75){return new Promise(function(_0x4bf44c,_0x392293){try{var _0xf8b143=[];if(_0x554b75[_0x405bd1]){_0xf8b143=_0x554b75[_0x405bd1][_0x65cf('0x1')](function(_0x4a4563){return{'id':_0x4a4563['id'],'fullname':_0x4a4563['fullname']};});}return _0x4bf44c(_0xf8b143);}catch(_0x256216){_0x392293(_0x256216);}});}function getInteractionTags(_0x67844b,_0x231d14){var _0xbd3a05=[];if(_0x67844b){_0x67844b[_0x65cf('0x2')](',')[_0x65cf('0x3')](function(_0x5e4b86){_0xbd3a05[_0x65cf('0x4')](_0x231d14[_0x5e4b86]);});}return _0xbd3a05;}function updateWaitingCounter(_0x546af2){if(_0x546af2['waiting']){_0x546af2[_0x65cf('0x5')]-=0x1;}}function updateInteractionCounters(_0x1ab0eb){_0x1ab0eb[_0x65cf('0x5')]=0x0;_0x1ab0eb['talking']=0x0;_0x1ab0eb['answered']=0x0;_0x1ab0eb[_0x65cf('0x6')]=0x0;_0x1ab0eb[_0x65cf('0x7')]=0x0;_0x1ab0eb[_0x65cf('0x8')]=0x0;if(_0x1ab0eb[_0x65cf('0x9')]){if(_0x1ab0eb[_0x65cf('0xa')]===_0x65cf('0x7')){_0x1ab0eb[_0x65cf('0x7')]+=0x1;updateWaitingCounter(_0x1ab0eb);}if(_0x1ab0eb[_0x65cf('0xb')]){_0x1ab0eb[_0x65cf('0xc')]+=0x1;if(_0x1ab0eb[_0x65cf('0xd')]){_0x1ab0eb[_0x65cf('0xd')]-=0x1;}}else{if(_0x1ab0eb[_0x65cf('0xa')]){_0x1ab0eb[_0x65cf('0x6')]+=0x1;updateWaitingCounter(_0x1ab0eb);}}}else{if(!_0x1ab0eb['UserId']){_0x1ab0eb[_0x65cf('0x5')]+=0x1;}if(_0x1ab0eb[_0x65cf('0xb')]){_0x1ab0eb[_0x65cf('0xd')]+=0x1;updateWaitingCounter(_0x1ab0eb);}}_0x1ab0eb[_0x65cf('0x8')]+=0x1;return _0x1ab0eb;}function getLastMessageText(_0x74f58d){return db[_0x65cf('0xe')][_0x65cf('0xf')]({'where':{'$and':[{'MailInteractionId':_0x74f58d['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x65cf('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x65cf('0x11')],'order':_0x65cf('0x12'),'raw':!![]})[_0x65cf('0x13')](function(_0xf646c4){if(_0xf646c4&&_0xf646c4[_0x65cf('0x11')]){_0x74f58d[_0x65cf('0x14')]=_[_0x65cf('0x15')](_0xf646c4[_0x65cf('0x11')]);}return _0x74f58d;})[_0x65cf('0x16')](function(_0x53d633){throw _0x53d633;});}exports[_0x65cf('0x17')]=function(_0x40a93f,_0x14364c,_0x448a7a,_0x5c4359){return new Promise(function(_0x1186dd,_0x4cd930){return getInteractionUsers(_0x40a93f['id'],_0x448a7a)[_0x65cf('0x13')](function(_0x407499){_0x40a93f[_0x65cf('0x18')]=_0x407499;return getInteractionTags(_0x40a93f[_0x65cf('0x19')],_0x14364c);})[_0x65cf('0x13')](function(_0x2a385d){_0x40a93f[_0x65cf('0x1a')]=_0x2a385d;delete _0x40a93f[_0x65cf('0x19')];return updateInteractionCounters(_0x40a93f);})[_0x65cf('0x13')](function(_0x5724df){if(_0x5c4359){return getLastMessageText(_0x5724df);}else{return _0x5724df;}})[_0x65cf('0x13')](function(_0x304d44){_0x1186dd(_0x304d44);})[_0x65cf('0x16')](function(_0x1b572f){_0x4cd930(_0x1b572f);});});}; \ No newline at end of file +var _0x41e4=['TagIds','Tags','map','fullname','split','push','waiting','talking','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage','findOne','-id','plainBody','catch','updateInteraction','then'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x41e4,0x6b));var _0x441e=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x41e4[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x42b319,_0x39db08){return new Promise(function(_0xf8417b,_0x297f4e){try{var _0x215f1e=[];if(_0x39db08[_0x42b319]){_0x215f1e=_0x39db08[_0x42b319][_0x441e('0x0')](function(_0xd73e03){return{'id':_0xd73e03['id'],'fullname':_0xd73e03[_0x441e('0x1')]};});}return _0xf8417b(_0x215f1e);}catch(_0x1cb407){_0x297f4e(_0x1cb407);}});}function getInteractionTags(_0x3198c0,_0x28f6f8){var _0x1e469a=[];if(_0x3198c0){_0x3198c0[_0x441e('0x2')](',')['forEach'](function(_0x206702){_0x1e469a[_0x441e('0x3')](_0x28f6f8[_0x206702]);});}return _0x1e469a;}function updateWaitingCounter(_0xf24da6){if(_0xf24da6[_0x441e('0x4')]){_0xf24da6[_0x441e('0x4')]-=0x1;}}function updateInteractionCounters(_0x5da228){_0x5da228[_0x441e('0x4')]=0x0;_0x5da228[_0x441e('0x5')]=0x0;_0x5da228['answered']=0x0;_0x5da228[_0x441e('0x6')]=0x0;_0x5da228[_0x441e('0x7')]=0x0;_0x5da228[_0x441e('0x8')]=0x0;if(_0x5da228[_0x441e('0x9')]){if(_0x5da228[_0x441e('0xa')]===_0x441e('0x7')){_0x5da228['abandoned']+=0x1;updateWaitingCounter(_0x5da228);}if(_0x5da228[_0x441e('0xb')]){_0x5da228['answered']+=0x1;if(_0x5da228['talking']){_0x5da228[_0x441e('0x5')]-=0x1;}}else{if(_0x5da228['disposition']){_0x5da228['unmanaged']+=0x1;updateWaitingCounter(_0x5da228);}}}else{if(!_0x5da228[_0x441e('0xb')]){_0x5da228[_0x441e('0x4')]+=0x1;}if(_0x5da228[_0x441e('0xb')]){_0x5da228[_0x441e('0x5')]+=0x1;updateWaitingCounter(_0x5da228);}}_0x5da228[_0x441e('0x8')]+=0x1;return _0x5da228;}function getLastMessageText(_0x2b2402){return db[_0x441e('0xc')][_0x441e('0xd')]({'where':{'$and':[{'MailInteractionId':_0x2b2402['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x441e('0xe'),'raw':!![]})['then'](function(_0x320048){if(_0x320048&&_0x320048[_0x441e('0xf')]){_0x2b2402['lastMsgText']=_['trimStart'](_0x320048[_0x441e('0xf')]);}return _0x2b2402;})[_0x441e('0x10')](function(_0x220623){throw _0x220623;});}exports[_0x441e('0x11')]=function(_0x583e7e,_0x47041f,_0x1c75b4,_0x577517){return new Promise(function(_0x2dcde5,_0x5f44b6){return getInteractionUsers(_0x583e7e['id'],_0x1c75b4)[_0x441e('0x12')](function(_0x524a65){_0x583e7e['Users']=_0x524a65;return getInteractionTags(_0x583e7e[_0x441e('0x13')],_0x47041f);})[_0x441e('0x12')](function(_0x40a9a1){_0x583e7e[_0x441e('0x14')]=_0x40a9a1;delete _0x583e7e[_0x441e('0x13')];return updateInteractionCounters(_0x583e7e);})[_0x441e('0x12')](function(_0x294c5a){if(_0x577517){return getLastMessageText(_0x294c5a);}else{return _0x294c5a;}})[_0x441e('0x12')](function(_0x4bae72){_0x2dcde5(_0x4bae72);})[_0x441e('0x10')](function(_0x27419a){_0x5f44b6(_0x27419a);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index ece28b5..a65524a 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 _0xd0e9=['chat-interactions','whatsapp-interactions','capitalize','Website','Account','InteractionId','upperFirst','unknown','chat','websites','accounts','_interaction_has_tags','_messages','user_has_','_interactions','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','findOne','then','update','catch','error','exports','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions'];(function(_0x3cf5b5,_0x3ed8aa){var _0x4bf755=function(_0x3bb5ee){while(--_0x3bb5ee){_0x3cf5b5['push'](_0x3cf5b5['shift']());}};_0x4bf755(++_0x3ed8aa);}(_0xd0e9,0x15a));var _0x9d0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0e9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9d0e('0x0'));var db=require(_0x9d0e('0x1'))['db'];var loggers={'openchannel':require(_0x9d0e('0x2'))('openchannel-interactions'),'mail':require(_0x9d0e('0x2'))(_0x9d0e('0x3')),'fax':require(_0x9d0e('0x2'))(_0x9d0e('0x4')),'sms':require('../../config/logger')(_0x9d0e('0x5')),'chat':require(_0x9d0e('0x2'))(_0x9d0e('0x6')),'whatsapp':require(_0x9d0e('0x2'))(_0x9d0e('0x7'))};function getAccountFK(_0x3fca6e){return _[_0x9d0e('0x8')](_0x3fca6e)+(_0x3fca6e==='chat'?_0x9d0e('0x9'):_0x9d0e('0xa'))+'Id';}function getInteractionFK(_0x2b0c2e){return _[_0x9d0e('0x8')](_0x2b0c2e)+_0x9d0e('0xb');}function getInteractionId(_0x2661c3,_0xda2646,_0x52b981){if(_0x2661c3&&_0x2661c3[_[_0x9d0e('0xc')](_0x52b981)+_0x9d0e('0xb')]){return _0x2661c3[_[_0x9d0e('0xc')](_0x52b981)+_0x9d0e('0xb')];}else if(_0x2661c3&&_0x2661c3['id']){return _0x2661c3['id'];}else if(_0xda2646&&_0xda2646['id']){return _0xda2646['id'];}else{return _0x9d0e('0xd');}}function getInteractionsTables(_0x524ac9){return{'accounts':_0x524ac9+'_'+(_0x524ac9===_0x9d0e('0xe')?_0x9d0e('0xf'):_0x9d0e('0x10')),'interactions':_0x524ac9+'_interactions','interactionsTags':_0x524ac9+_0x9d0e('0x11'),'messages':_0x524ac9+_0x9d0e('0x12'),'userInteractions':_0x9d0e('0x13')+_0x524ac9+_0x9d0e('0x14')};}function getSelectedTags(_0x90ebae){var _0x2fe03e=[];if(_0x90ebae){_0x2fe03e=Array[_0x9d0e('0x15')](_0x90ebae)?_0x90ebae:[_0x90ebae];}return _0x2fe03e;}function log(_0x1cc7c0,_0x213328,_0x14d566,_0x542867,_0x1da7a9,_0x5c48ba){loggers[_0x1da7a9['toLowerCase']()][_0x1cc7c0](_0x9d0e('0x16'),_0x5c48ba[_0x9d0e('0x17')](),_0x213328?_0x213328['id']:null,_0x213328?_0x213328['name']:null,_0x213328?_0x213328[_0x9d0e('0x18')]:null,getInteractionId(_0x14d566,_0x542867,_0x1da7a9),_0x14d566?JSON[_0x9d0e('0x19')](_0x14d566):'null');}function updateUser(_0x59ec92,_0x464ec4,_0x1331a4,_0xc8cc7e,_0xbe381f){db[_[_0x9d0e('0xc')](_0xc8cc7e)+'Interaction'][_0x9d0e('0x1a')]({'where':{'id':getInteractionId(_0x464ec4,_0x1331a4,_0xc8cc7e)}})[_0x9d0e('0x1b')](function(_0x54e8db){if(_0x54e8db){return _0x54e8db[_0x9d0e('0x1c')]({'UserId':_0x59ec92?_0x59ec92['id']:null});}})[_0x9d0e('0x1b')](function(_0x544757){if(_0x544757){log('info',_0x59ec92,_0x464ec4,_0x1331a4,_0xc8cc7e,_0xbe381f);}})[_0x9d0e('0x1d')](function(){log(_0x9d0e('0x1e'),_0x59ec92,_0x464ec4,_0x1331a4,_0xc8cc7e,_0xbe381f);});}module[_0x9d0e('0x1f')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x8dd0=['chat-interactions','whatsapp-interactions','capitalize','chat','Account','InteractionId','upperFirst','websites','accounts','_interactions','_interaction_has_tags','_messages','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','null','then','update','error','name','stringify','MESSAGE:ACCEPT]\x20id=','\x20role=','\x20interaction=','\x20body=','lodash','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions'];(function(_0x5795ee,_0x3896ca){var _0x5aad7c=function(_0x5410bc){while(--_0x5410bc){_0x5795ee['push'](_0x5795ee['shift']());}};_0x5aad7c(++_0x3896ca);}(_0x8dd0,0x9e));var _0x08dd=function(_0x1b8cb3,_0x230219){_0x1b8cb3=_0x1b8cb3-0x0;var _0x10e6a0=_0x8dd0[_0x1b8cb3];return _0x10e6a0;};'use strict';var _=require(_0x08dd('0x0'));var db=require(_0x08dd('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x08dd('0x2')),'mail':require(_0x08dd('0x3'))(_0x08dd('0x4')),'fax':require(_0x08dd('0x3'))(_0x08dd('0x5')),'sms':require(_0x08dd('0x3'))(_0x08dd('0x6')),'chat':require('../../config/logger')(_0x08dd('0x7')),'whatsapp':require('../../config/logger')(_0x08dd('0x8'))};function getAccountFK(_0xa51e46){return _[_0x08dd('0x9')](_0xa51e46)+(_0xa51e46===_0x08dd('0xa')?'Website':_0x08dd('0xb'))+'Id';}function getInteractionFK(_0x4fac8d){return _[_0x08dd('0x9')](_0x4fac8d)+_0x08dd('0xc');}function getInteractionId(_0x179c8d,_0x2602e7,_0x41175f){if(_0x179c8d&&_0x179c8d[_[_0x08dd('0xd')](_0x41175f)+'InteractionId']){return _0x179c8d[_[_0x08dd('0xd')](_0x41175f)+_0x08dd('0xc')];}else if(_0x179c8d&&_0x179c8d['id']){return _0x179c8d['id'];}else if(_0x2602e7&&_0x2602e7['id']){return _0x2602e7['id'];}else{return'unknown';}}function getInteractionsTables(_0x4d202f){return{'accounts':_0x4d202f+'_'+(_0x4d202f===_0x08dd('0xa')?_0x08dd('0xe'):_0x08dd('0xf')),'interactions':_0x4d202f+_0x08dd('0x10'),'interactionsTags':_0x4d202f+_0x08dd('0x11'),'messages':_0x4d202f+_0x08dd('0x12'),'userInteractions':'user_has_'+_0x4d202f+_0x08dd('0x10')};}function getSelectedTags(_0x452e03){var _0xceb6a9=[];if(_0x452e03){_0xceb6a9=Array['isArray'](_0x452e03)?_0x452e03:[_0x452e03];}return _0xceb6a9;}function log(_0x2e3c58,_0x294634,_0x418f24,_0xf8bd36,_0x7e136d,_0x41fa56){loggers[_0x7e136d[_0x08dd('0x13')]()][_0x2e3c58](_0x08dd('0x14'),_0x41fa56[_0x08dd('0x15')](),_0x294634?_0x294634['id']:null,_0x294634?_0x294634['name']:null,_0x294634?_0x294634[_0x08dd('0x16')]:null,getInteractionId(_0x418f24,_0xf8bd36,_0x7e136d),_0x418f24?JSON['stringify'](_0x418f24):_0x08dd('0x17'));}function updateUser(_0x12da50,_0x4d0114,_0x441395,_0x577c69,_0x6e64d7){db[_[_0x08dd('0xd')](_0x577c69)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x4d0114,_0x441395,_0x577c69)}})[_0x08dd('0x18')](function(_0x37b1e4){if(_0x37b1e4){return _0x37b1e4[_0x08dd('0x19')]({'UserId':_0x12da50?_0x12da50['id']:null});}})[_0x08dd('0x18')](function(_0x1af650){if(_0x1af650){log('info',_0x12da50,_0x4d0114,_0x441395,_0x577c69,_0x6e64d7);}})['catch'](function(){log(_0x08dd('0x1a'),_0x12da50,_0x4d0114,_0x441395,_0x577c69,_0x6e64d7);});}function logAcceptMessage(_0x34021a,_0x241323,_0x155395,_0x134187){var _0x41da83=loggers[_0x34021a[_0x08dd('0x13')]()];var _0x57387f=_0x241323['id'];var _0x11aab4=_0x241323[_0x08dd('0x1b')];var _0x5e727c=_0x241323[_0x08dd('0x16')];var _0x5864f1=JSON[_0x08dd('0x1c')](_0x134187||null);_0x41da83['info']('['+_0x34021a[_0x08dd('0x15')]()+_0x08dd('0x1d')+_0x57387f+'\x20name='+_0x11aab4+_0x08dd('0x1e')+_0x5e727c+_0x08dd('0x1f')+_0x155395+_0x08dd('0x20')+_0x5864f1);}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 3e1ef3d..69289fd 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 _0x220d=['admin','user','crypto','util','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','use','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User'];(function(_0x1e6c08,_0x5e77b1){var _0x552a9f=function(_0x41b10f){while(--_0x41b10f){_0x1e6c08['push'](_0x1e6c08['shift']());}};_0x552a9f(++_0x5e77b1);}(_0x220d,0xe3));var _0xd220=function(_0x2dae95,_0xbe5730){_0x2dae95=_0x2dae95-0x0;var _0x28daf2=_0x220d[_0x2dae95];return _0x28daf2;};'use strict';var crypto=require(_0xd220('0x0'));var util=require(_0xd220('0x1'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0xd220('0x2'));function getValueFromLicense(_0x71b44a,_0x2c3490){if(_0x71b44a&&_0x2c3490){if(_0x2c3490[_0xd220('0x3')]&&_0x2c3490[_0xd220('0x4')]){var _0x1b65aa=_0x2c3490[_0xd220('0x3')];var _0x5151b3=_0x2c3490[_0xd220('0x4')];var _0x53b411=_0x1b65aa['split']('-')[0x4];var _0x23a982=_0x1b65aa[_0xd220('0x5')]('-')[0x0];var _0x33319f=crypto['createDecipher'](_0xd220('0x6'),util[_0xd220('0x7')](_0xd220('0x8'),_0x53b411,_0x1b65aa,_0x23a982));var _0x573b5b=_0x33319f[_0xd220('0x9')](_0x5151b3,_0xd220('0xa'),_0xd220('0xb'));_0x573b5b+=_0x33319f[_0xd220('0xc')](_0xd220('0xb'));var _0x20bd21=JSON['parse'](_0x573b5b);return _0x20bd21[_0xd220('0xd')](_0x71b44a)?_0x20bd21[_0x71b44a]:null;}}return null;}function isLimit(_0x422912,_0xaf3b66,_0x352adc,_0x575353){var _0x44fc4e=_0xaf3b66;return compose()[_0xd220('0xe')](function(_0x196ece,_0x1106da,_0x47bbdd){return db['License'][_0xd220('0xf')]({'where':{'id':0x1},'raw':!![]})[_0xd220('0x10')](function(_0x24f080){var _0x34392a=getValueFromLicense(_0x422912,_0x24f080);return _0x34392a?_0x34392a:_0x44fc4e;})[_0xd220('0x10')](function(_0x28e379){_0x44fc4e=_0x28e379;return _0x352adc[_0xd220('0x11')](_0x575353);})['then'](function(_0x27b3b0){if(_0x27b3b0>=_0x44fc4e){return _0x1106da[_0xd220('0x12')](0x193)[_0xd220('0x13')]({'message':util[_0xd220('0x7')](_0xd220('0x14'),_0x422912)});}_0x47bbdd();})[_0xd220('0x15')](function(_0x5b9401){_0x47bbdd(_0x5b9401);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xd220('0x16')],{'where':{'$or':[{'role':_0xd220('0x17')},{'role':_0xd220('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x58b8=['License','findOne','then','status','json','format','user','isUserLimit','crypto','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','%s:%s:%s','base64','utf8','final','use'];(function(_0x2c61a2,_0x40fe37){var _0x28bf7c=function(_0x4afffe){while(--_0x4afffe){_0x2c61a2['push'](_0x2c61a2['shift']());}};_0x28bf7c(++_0x40fe37);}(_0x58b8,0x1eb));var _0x858b=function(_0x5d225a,_0x2debe9){_0x5d225a=_0x5d225a-0x0;var _0x1e7761=_0x58b8[_0x5d225a];return _0x1e7761;};'use strict';var crypto=require(_0x858b('0x0'));var util=require('util');var compose=require(_0x858b('0x1'));var db=require(_0x858b('0x2'))['db'];var config=require(_0x858b('0x3'));function getValueFromLicense(_0x537035,_0x39623c){if(_0x537035&&_0x39623c){if(_0x39623c[_0x858b('0x4')]&&_0x39623c['license']){var _0x14c3fd=_0x39623c[_0x858b('0x4')];var _0x1cd742=_0x39623c[_0x858b('0x5')];var _0x128099=_0x14c3fd[_0x858b('0x6')]('-')[0x4];var _0x5633b7=_0x14c3fd[_0x858b('0x6')]('-')[0x0];var _0x289a1a=crypto[_0x858b('0x7')]('aes-256-ctr',util['format'](_0x858b('0x8'),_0x128099,_0x14c3fd,_0x5633b7));var _0x5b1c11=_0x289a1a['update'](_0x1cd742,_0x858b('0x9'),_0x858b('0xa'));_0x5b1c11+=_0x289a1a[_0x858b('0xb')]('utf8');var _0x23cd3f=JSON['parse'](_0x5b1c11);return _0x23cd3f['hasOwnProperty'](_0x537035)?_0x23cd3f[_0x537035]:null;}}return null;}function isLimit(_0x52490b,_0x504857,_0x24fb59,_0x58a7b5){var _0x40bb90=_0x504857;return compose()[_0x858b('0xc')](function(_0xa7c1db,_0x2e0402,_0x4d27f8){return db[_0x858b('0xd')][_0x858b('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x858b('0xf')](function(_0x1cf7c9){var _0x28a73f=getValueFromLicense(_0x52490b,_0x1cf7c9);return _0x28a73f?_0x28a73f:_0x40bb90;})[_0x858b('0xf')](function(_0x5abe60){_0x40bb90=_0x5abe60;return _0x24fb59['count'](_0x58a7b5);})[_0x858b('0xf')](function(_0x342bee){if(_0x342bee>=_0x40bb90){return _0x2e0402[_0x858b('0x10')](0x193)[_0x858b('0x11')]({'message':util[_0x858b('0x12')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x52490b)});}_0x4d27f8();})['catch'](function(_0x5689f0){_0x4d27f8(_0x5689f0);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x858b('0x13')}]}});}exports[_0x858b('0x14')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 2f213db..325d47e 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 _0xb63f=['castTo','CAST(','\x20AS\x20','text','field','includes','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$lte','$gte','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','[$or]','and','replace','split','length','slice','shift','match','forEach','indexOf','conditions','push','buildExpression','operator','$eq','$between','value','$gt','add','days','format','YYYY-MM-DD'];(function(_0x3b76e9,_0x39efb2){var _0x43489c=function(_0x1040a9){while(--_0x1040a9){_0x3b76e9['push'](_0x3b76e9['shift']());}};_0x43489c(++_0x39efb2);}(_0xb63f,0x108));var _0xfb63=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0xb63f[_0x307d86];return _0x361745;};'use strict';var _=require(_0xfb63('0x0'));var moment=require(_0xfb63('0x1'));exports[_0xfb63('0x2')]=function(_0x5b0d67){var _0x3405e5={'conditions':[]};_0x3405e5[_0xfb63('0x3')]=_['startsWith'](_0x5b0d67,_0xfb63('0x4'))?'or':_0xfb63('0x5');var _0x4173eb=_0x5b0d67[_0xfb63('0x6')]('[$and]','')[_0xfb63('0x6')](_0xfb63('0x4'),'')[_0xfb63('0x7')]('||');for(var _0x3c030f=0x0;_0x3c030f<_0x4173eb[_0xfb63('0x8')];_0x3c030f++){var _0x46c68a=_0x4173eb[_0x3c030f][_0xfb63('0x7')](':=');var _0x3c87b8=_0x46c68a[0x0];var _0x163719=_0x46c68a[_0xfb63('0x9')](0x1);_0x163719['forEach'](function(_0xf27538){var _0x5a88c3=_0xf27538[_0xfb63('0x7')]('[')[_0xfb63('0xa')]();var _0x356415=_0xf27538[_0xfb63('0xb')](/\[(.*?)\]/g);_0x356415[_0xfb63('0xc')](function(_0xa1fb7){var _0x5770ea=_0xa1fb7['split']('[')['filter'](function(_0x39227b){return _0x39227b[_0xfb63('0xd')](']')>-0x1;})['map'](function(_0x3ecb99){return _0x3ecb99[_0xfb63('0x7')](']')[0x0];})[0x0];_0x3405e5[_0xfb63('0xe')][_0xfb63('0xf')]({'field':_0x3c87b8,'operator':_0x5a88c3,'value':_0x5770ea});});});}return _0x3405e5;};exports[_0xfb63('0x10')]=function(_0x5b734d,_0x168cd1,_0x395025){var _0x1ce115={};if(_0x168cd1==='DATE'){if(_0x395025[_0xfb63('0x11')]===_0xfb63('0x12')){_0x395025[_0xfb63('0x11')]=_0xfb63('0x13');_0x395025[_0xfb63('0x14')]+=','+_0x395025[_0xfb63('0x14')];}else if(_['includes']([_0xfb63('0x15'),'$lte'],_0x395025[_0xfb63('0x11')])){_0x395025[_0xfb63('0x14')]=moment(_0x395025[_0xfb63('0x14')])[_0xfb63('0x16')](0x1,_0xfb63('0x17'))[_0xfb63('0x18')](_0xfb63('0x19'));}}if(_0x395025[_0xfb63('0x1a')]){_0x168cd1=_0x395025[_0xfb63('0x1a')];_0x1ce115['text']=_0xfb63('0x1b')+_0x5b734d+'.'+_0x395025['field']+_0xfb63('0x1c')+_0x395025[_0xfb63('0x1a')]+')\x20'+parseOperator(_0x395025[_0xfb63('0x11')]);}else{_0x1ce115[_0xfb63('0x1d')]=_0x5b734d+'.'+_0x395025[_0xfb63('0x1e')]+'\x20'+parseOperator(_0x395025[_0xfb63('0x11')]);}if(_[_0xfb63('0x1f')](['$ne',_0xfb63('0x20')],_0x395025[_0xfb63('0x11')]))_0x1ce115['text']='('+_0x1ce115[_0xfb63('0x1d')]+_0xfb63('0x21')+_0x5b734d+'.'+_0x395025['field']+_0xfb63('0x22');_0x1ce115[_0xfb63('0x14')]=parseValue(_0x168cd1,_0x395025['operator'],_0x395025[_0xfb63('0x14')]);return _0x1ce115;};function parseOperator(_0x158195){var _0x19fbcc;switch(_0x158195){case _0xfb63('0x23'):_0x19fbcc=_0xfb63('0x24');break;case _0xfb63('0x20'):_0x19fbcc=_0xfb63('0x25');break;case _0xfb63('0x12'):_0x19fbcc=_0xfb63('0x26');break;case _0xfb63('0x27'):_0x19fbcc=_0xfb63('0x28');break;case _0xfb63('0x29'):case _0xfb63('0x2a'):case _0xfb63('0x2b'):_0x19fbcc=_0xfb63('0x2c');break;case _0xfb63('0x2d'):_0x19fbcc=_0xfb63('0x2e');break;case _0xfb63('0x15'):_0x19fbcc=_0xfb63('0x2f');break;case _0xfb63('0x30'):_0x19fbcc='<=\x20?';break;case _0xfb63('0x31'):_0x19fbcc='>=\x20?';break;case _0xfb63('0x13'):_0x19fbcc=_0xfb63('0x32');break;}return _0x19fbcc;}function parseValue(_0x25aa90,_0x3fcae1,_0x7d6078){var _0x5e6534={'start':undefined,'end':undefined};switch(_0x3fcae1){case'$in':case _0xfb63('0x20'):_0x5e6534[_0xfb63('0x33')]=_0x7d6078[_0xfb63('0x7')](',');break;case'$substring':_0x5e6534[_0xfb63('0x33')]='%'+_0x7d6078+'%';break;case'$startsWith':_0x5e6534['start']=_0x7d6078+'%';break;case'$endsWith':_0x5e6534[_0xfb63('0x33')]='%'+_0x7d6078;break;case _0xfb63('0x13'):var _0x2da103=_0x7d6078[_0xfb63('0x7')](',');var _0x7d6078=_0x2da103[_0xfb63('0xa')]();var _0x102238=_0x2da103[_0xfb63('0x34')]();if(_0x25aa90===_0xfb63('0x35')){_0x7d6078=moment(_0x7d6078)['utcOffset'](0x0,!![])['format']();_0x102238=moment(_0x102238)[_0xfb63('0x36')](0x0,!![])[_0xfb63('0x16')](0x17,_0xfb63('0x37'))[_0xfb63('0x16')](0x3b,_0xfb63('0x38'))[_0xfb63('0x16')](0x3b,_0xfb63('0x39'))[_0xfb63('0x18')]();}_0x5e6534={'start':_0x7d6078,'end':_0x102238};break;default:_0x5e6534['start']=_0x7d6078;break;}return _0x5e6534;} \ No newline at end of file +var _0x539f=['push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','add','days','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','$lt','>\x20?','$lte','<=\x20?','$gte','>=\x20?','$in','start','shift','utcOffset','hours','minutes','seconds','format','lodash','moment','parseSearch','sqlOperator','[$or]','replace','[$and]','split','length','slice','forEach','filter','map','conditions'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0x539f,0x94));var _0xf539=function(_0x59bc5b,_0xb4c0d3){_0x59bc5b=_0x59bc5b-0x0;var _0x2ac320=_0x539f[_0x59bc5b];return _0x2ac320;};'use strict';var _=require(_0xf539('0x0'));var moment=require(_0xf539('0x1'));exports[_0xf539('0x2')]=function(_0xc57a59){var _0x1b81a4={'conditions':[]};_0x1b81a4[_0xf539('0x3')]=_['startsWith'](_0xc57a59,_0xf539('0x4'))?'or':'and';var _0x276287=_0xc57a59[_0xf539('0x5')](_0xf539('0x6'),'')[_0xf539('0x5')]('[$or]','')[_0xf539('0x7')]('||');for(var _0x38e27f=0x0;_0x38e27f<_0x276287[_0xf539('0x8')];_0x38e27f++){var _0x6fc6f=_0x276287[_0x38e27f][_0xf539('0x7')](':=');var _0x373268=_0x6fc6f[0x0];var _0x2bef58=_0x6fc6f[_0xf539('0x9')](0x1);_0x2bef58[_0xf539('0xa')](function(_0x52f148){var _0x48a366=_0x52f148[_0xf539('0x7')]('[')['shift']();var _0x112061=_0x52f148['match'](/\[(.*?)\]/g);_0x112061[_0xf539('0xa')](function(_0x43fdc6){var _0x58c8f4=_0x43fdc6[_0xf539('0x7')]('[')[_0xf539('0xb')](function(_0x33a010){return _0x33a010['indexOf'](']')>-0x1;})[_0xf539('0xc')](function(_0x2f2c56){return _0x2f2c56[_0xf539('0x7')](']')[0x0];})[0x0];_0x1b81a4[_0xf539('0xd')][_0xf539('0xe')]({'field':_0x373268,'operator':_0x48a366,'value':_0x58c8f4});});});}return _0x1b81a4;};exports[_0xf539('0xf')]=function(_0x356c75,_0x362fe7,_0x1f0ea8){var _0xc8d9d9={};if(_0x362fe7===_0xf539('0x10')){if(_0x1f0ea8[_0xf539('0x11')]===_0xf539('0x12')){_0x1f0ea8[_0xf539('0x11')]=_0xf539('0x13');_0x1f0ea8[_0xf539('0x14')]+=','+_0x1f0ea8[_0xf539('0x14')];}else if(_[_0xf539('0x15')]([_0xf539('0x16'),'$lte'],_0x1f0ea8[_0xf539('0x11')])){_0x1f0ea8['value']=moment(_0x1f0ea8[_0xf539('0x14')])[_0xf539('0x17')](0x1,_0xf539('0x18'))['format']('YYYY-MM-DD');}}if(_0x1f0ea8[_0xf539('0x19')]){_0x362fe7=_0x1f0ea8[_0xf539('0x19')];_0xc8d9d9[_0xf539('0x1a')]=_0xf539('0x1b')+_0x356c75+'.'+_0x1f0ea8[_0xf539('0x1c')]+_0xf539('0x1d')+_0x1f0ea8['castTo']+')\x20'+parseOperator(_0x1f0ea8[_0xf539('0x11')]);}else{_0xc8d9d9[_0xf539('0x1a')]=_0x356c75+'.'+_0x1f0ea8['field']+'\x20'+parseOperator(_0x1f0ea8[_0xf539('0x11')]);}if(_[_0xf539('0x15')]([_0xf539('0x1e'),_0xf539('0x1f')],_0x1f0ea8[_0xf539('0x11')]))_0xc8d9d9[_0xf539('0x1a')]='('+_0xc8d9d9[_0xf539('0x1a')]+_0xf539('0x20')+_0x356c75+'.'+_0x1f0ea8[_0xf539('0x1c')]+_0xf539('0x21');_0xc8d9d9[_0xf539('0x14')]=parseValue(_0x362fe7,_0x1f0ea8[_0xf539('0x11')],_0x1f0ea8['value']);return _0xc8d9d9;};function parseOperator(_0x35e323){var _0x134195;switch(_0x35e323){case'$in':_0x134195=_0xf539('0x22');break;case _0xf539('0x1f'):_0x134195='NOT\x20IN\x20?';break;case _0xf539('0x12'):_0x134195=_0xf539('0x23');break;case _0xf539('0x1e'):_0x134195=_0xf539('0x24');break;case _0xf539('0x25'):case _0xf539('0x26'):case _0xf539('0x27'):_0x134195='LIKE\x20?';break;case _0xf539('0x28'):_0x134195='<\x20?';break;case _0xf539('0x16'):_0x134195=_0xf539('0x29');break;case _0xf539('0x2a'):_0x134195=_0xf539('0x2b');break;case _0xf539('0x2c'):_0x134195=_0xf539('0x2d');break;case _0xf539('0x13'):_0x134195='BETWEEN\x20?\x20AND\x20?';break;}return _0x134195;}function parseValue(_0x5f5406,_0x378258,_0x2327a9){var _0x435d42={'start':undefined,'end':undefined};switch(_0x378258){case _0xf539('0x2e'):case'$notIn':_0x435d42[_0xf539('0x2f')]=_0x2327a9[_0xf539('0x7')](',');break;case _0xf539('0x25'):_0x435d42[_0xf539('0x2f')]='%'+_0x2327a9+'%';break;case _0xf539('0x26'):_0x435d42[_0xf539('0x2f')]=_0x2327a9+'%';break;case _0xf539('0x27'):_0x435d42[_0xf539('0x2f')]='%'+_0x2327a9;break;case _0xf539('0x13'):var _0x206649=_0x2327a9['split'](',');var _0x2327a9=_0x206649[_0xf539('0x30')]();var _0xa29f1b=_0x206649['pop']();if(_0x5f5406===_0xf539('0x10')){_0x2327a9=moment(_0x2327a9)[_0xf539('0x31')](0x0,!![])['format']();_0xa29f1b=moment(_0xa29f1b)[_0xf539('0x31')](0x0,!![])[_0xf539('0x17')](0x17,_0xf539('0x32'))[_0xf539('0x17')](0x3b,_0xf539('0x33'))[_0xf539('0x17')](0x3b,_0xf539('0x34'))[_0xf539('0x35')]();}_0x435d42={'start':_0x2327a9,'end':_0xa29f1b};break;default:_0x435d42['start']=_0x2327a9;break;}return _0x435d42;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index d3559d9..c086e40 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 _0x4fa8=['filter','value','where','merge','VIRTUAL','lower','options','push','include','lodash','sequelize','moment','../../mysqldb','parse','keys','includes','model','fields','raw','filters','forOwn','find','type','DATE','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','split','limit','map','col','unsigned','substr','DESC','cast','priority','omit','isEmpty','length','isString','unset','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','getFullTextValue','{EXPR}','forEach','replace','join','getOptions','$id','query','intersection','attributes','offset','sort','pick'];(function(_0x24accf,_0x244595){var _0x4ebc4b=function(_0x5bc453){while(--_0x5bc453){_0x24accf['push'](_0x24accf['shift']());}};_0x4ebc4b(++_0x244595);}(_0x4fa8,0x183));var _0x84fa=function(_0x2cd39b,_0x5e58e5){_0x2cd39b=_0x2cd39b-0x0;var _0x3b741f=_0x4fa8[_0x2cd39b];return _0x3b741f;};'use strict';var _=require(_0x84fa('0x0'));var sequelize=require(_0x84fa('0x1'));var moment=require(_0x84fa('0x2'));var db=require(_0x84fa('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x387327){var _0x343a73=['ne'];try{var _0x575412=JSON[_0x84fa('0x4')](_0x387327);var _0x57ca2e=Object[_0x84fa('0x5')](_0x575412)[0x0];return _0x343a73[_0x84fa('0x6')](_0x57ca2e);}catch(_0x59ac53){return![];}}function getOperatorValue(_0x182305){var _0xd38fd0=JSON['parse'](_0x182305);var _0x4d85b5=Object[_0x84fa('0x5')](_0xd38fd0)[0x0];var _0x201e88=_0xd38fd0[_0x4d85b5];return{['$'+_0x4d85b5]:_0x201e88};}function parseIncludeModel(_0x80a0fc){var _0x3ab9d0=JSON[_0x84fa('0x4')](_0x80a0fc);return{'model':db[_0x3ab9d0[_0x84fa('0x7')]],'as':_0x3ab9d0['alias'],'attributes':_0x3ab9d0[_0x84fa('0x8')],'raw':_0x3ab9d0[_0x84fa('0x9')]};}exports[_0x84fa('0x8')]=function(_0x7e270){var _0x3fbde0=null;if(_0x7e270){_0x3fbde0=_0x7e270['split'](',');}return _0x3fbde0;};exports[_0x84fa('0xa')]=function(_0x49d729,_0xd77909){var _0x498309={};if(!_['isEmpty'](_0x49d729)){_[_0x84fa('0xb')](_0x49d729,function(_0x3947d6,_0x53d193){try{if(_0xd77909){var _0x1413dc=_[_0x84fa('0xc')](_0xd77909,{'name':_0x53d193})||{};if(hasSequelizeOperator(_0x3947d6)){_0x498309[_0x53d193]=getOperatorValue(_0x3947d6);}else if(_0x1413dc[_0x84fa('0xd')]===_0x84fa('0xe')&&_['isPlainObject'](_0x3947d6)){var _0x5f2c82=JSON[_0x84fa('0x4')](_0x3947d6);var _0x207dcf={'$gte':moment(moment(_0x5f2c82[_0x84fa('0xf')])[_0x84fa('0x10')](_0x84fa('0x11')))[_0x84fa('0x12')]()[_0x84fa('0x10')](),'$lte':moment(moment(_0x5f2c82[_0x84fa('0x13')])[_0x84fa('0x10')](_0x84fa('0x11')))[_0x84fa('0x12')]()[_0x84fa('0x14')](0x1,'s')[_0x84fa('0x10')]()};_0x498309[_0x53d193]=_0x207dcf;}else if(_0x1413dc[_0x84fa('0x15')]==='uniqueid'){_0x498309[_0x53d193]=_0x3947d6;}else{_0x498309[_0x53d193]=_[_0x84fa('0x16')](_0x3947d6)?_0x3947d6:JSON[_0x84fa('0x4')](_0x3947d6);}}else{_0x498309[_0x53d193]=_[_0x84fa('0x16')](_0x3947d6)?_0x3947d6:JSON[_0x84fa('0x4')](_0x3947d6);}}catch(_0x55d9d3){_0x498309[_0x53d193]=_0x3947d6[_0x84fa('0x17')](',');}});}return _0x498309;};exports[_0x84fa('0x18')]=function(_0x4c9afb){_0x4c9afb=parseInt(_0x4c9afb,0xa);if(!_0x4c9afb||_0x4c9afb<0x0){_0x4c9afb=LIMIT_VALUE;}return _0x4c9afb;};exports['offset']=function(_0x58177a){_0x58177a=parseInt(_0x58177a,0xa);if(!_0x58177a||_0x58177a<0x0){_0x58177a=0x0;}return _0x58177a;};exports['sort']=function(_0x5aea80){var _0x5510cc,_0x1b88ae=null;if(_0x5aea80){_0x5510cc=_0x5aea80[_0x84fa('0x17')](',');_0x1b88ae=_[_0x84fa('0x19')](_0x5510cc,function(_0x196d3a){if(_0x196d3a['indexOf']('-')===0x0){return[_0x196d3a==='priority'?sequelize['cast'](sequelize[_0x84fa('0x1a')]('priority'),_0x84fa('0x1b')):_0x196d3a[_0x84fa('0x1c')](0x1),_0x84fa('0x1d')];}else{return[_0x196d3a==='priority'?sequelize[_0x84fa('0x1e')](sequelize[_0x84fa('0x1a')](_0x84fa('0x1f')),_0x84fa('0x1b')):_0x196d3a,'ASC'];}});}return _0x1b88ae;};exports[_0x84fa('0x20')]=function(_0x892e6a,_0x4f28f8){if(_[_0x84fa('0x21')](_0x892e6a)){return _0x892e6a;}if(_['isArray'](_0x892e6a)){for(var _0x54dd92=0x0;_0x54dd92<_0x892e6a[_0x84fa('0x22')];_0x54dd92+=0x1){_0x892e6a[_0x54dd92]=this[_0x84fa('0x20')](_0x892e6a[_0x54dd92],_0x4f28f8);}return _0x892e6a;}if(!_['isObject'](_0x892e6a)){return _0x892e6a;}if(_[_0x84fa('0x23')](_0x4f28f8)){_0x4f28f8=[_0x4f28f8];}if(!_[_0x84fa('0x16')](_0x4f28f8)){return _0x892e6a;}for(var _0x439698=0x0;_0x439698<_0x4f28f8[_0x84fa('0x22')];_0x439698+=0x1){_[_0x84fa('0x24')](_0x892e6a,_0x4f28f8[_0x439698]);}for(var _0x2ad787 in _0x892e6a){if(_0x892e6a[_0x84fa('0x25')](_0x2ad787)){_0x892e6a[_0x2ad787]=this[_0x84fa('0x20')](_0x892e6a[_0x2ad787],_0x4f28f8);}}return _0x892e6a;};exports['isNumeric']=function(_0x2931f5){return _0x2931f5[_0x84fa('0x26')](RegExp(_0x84fa('0x27')))?!![]:![];};exports[_0x84fa('0x28')]=function(_0x4f5bd3){return _0x4f5bd3[_0x84fa('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0x84fa('0x29')]=function(_0x156bb8,_0x5a01b8){var _0x5dc903=[];var _0x54989d=/([^:]")"+/g;var _0x1bf7a3=/[*<>~@-]/g;var _0x4f561c=/[ `!@#$%^&*()_\-?~<>]/;var _0x2e0df2=/[ ,]+/;var _0x59898b=_0x5a01b8?'\x22{EXPR}\x22':_0x84fa('0x2a');if(_0x5a01b8){_0x156bb8=_0x156bb8['replace'](_0x1bf7a3,'\x20')['trim']();}_0x156bb8[_0x84fa('0x17')](_0x2e0df2)[_0x84fa('0x2b')](function(_0x1bb60f){_0x1bb60f=_0x1bb60f[_0x84fa('0x2c')](_0x54989d,'$1');_0x1bb60f='+'+_0x1bb60f+'*';var _0x2252a9=_0x1bb60f[_0x84fa('0x26')](_0x4f561c);if(_0x2252a9){_0x1bb60f='\x22'+_0x1bb60f+'\x22';}_0x5dc903['push'](_0x1bb60f);});_0x59898b=_0x59898b['replace']('{EXPR}',_0x5dc903[_0x84fa('0x2d')]('\x20'));return _0x59898b;};exports[_0x84fa('0x2e')]=function(_0x3ea8fd,_0x495625,_0x65e5d4){var _0x34c5e7={},_0x564561={};if(_0x495625['query'][_0x84fa('0x2f')]){_0x495625[_0x84fa('0x30')]['id']=_0x495625[_0x84fa('0x30')]['$id'];delete _0x495625[_0x84fa('0x30')]['$id'];}_0x34c5e7['model']=_['map'](_0x3ea8fd,_0x84fa('0x15'));_0x34c5e7[_0x84fa('0x30')]=_[_0x84fa('0x5')](_0x495625[_0x84fa('0x30')]);_0x34c5e7[_0x84fa('0xa')]=_[_0x84fa('0x31')](_0x34c5e7[_0x84fa('0x7')],_0x34c5e7['query']);_0x564561[_0x84fa('0x32')]=_['intersection'](_0x34c5e7[_0x84fa('0x7')],this[_0x84fa('0x8')](_0x495625[_0x84fa('0x30')]['fields']));_0x564561[_0x84fa('0x32')]=_0x564561[_0x84fa('0x32')]['length']?_0x564561['attributes']:_0x34c5e7['model'];if(!_0x495625['query'][_0x84fa('0x25')]('nolimit')){_0x564561[_0x84fa('0x18')]=this[_0x84fa('0x18')](_0x495625['query']['limit']);_0x564561[_0x84fa('0x33')]=this[_0x84fa('0x33')](_0x495625['query'][_0x84fa('0x33')]);}_0x564561['order']=this[_0x84fa('0x34')](_0x495625[_0x84fa('0x30')]['sort']);_0x564561['where']=this[_0x84fa('0xa')](_[_0x84fa('0x35')](_0x495625[_0x84fa('0x30')],_0x34c5e7[_0x84fa('0xa')]),_0x3ea8fd);if(_0x495625['query'][_0x84fa('0x36')]){var _0x4d54eb=_0x3ea8fd;var _0x482997=_0x495625[_0x84fa('0x30')][_0x84fa('0x36')];if(typeof _0x482997==='object'){_0x4d54eb=_['filter'](_0x3ea8fd,function(_0x244801){return _[_0x84fa('0x6')](_0x482997['columns'],_0x244801[_0x84fa('0x15')]);});_0x482997=_0x482997[_0x84fa('0x37')];}_0x564561[_0x84fa('0x38')]=_[_0x84fa('0x39')](_0x564561[_0x84fa('0x38')],{'$or':_[_0x84fa('0x19')](_0x4d54eb,function(_0x2558c9){if(_0x2558c9[_0x84fa('0xd')]!==_0x84fa('0x3a')){if(_0x65e5d4){return sequelize[_0x84fa('0x38')](sequelize['fn'](_0x84fa('0x3b'),sequelize[_0x84fa('0x1a')](_0x2558c9['name'])),{'$like':sequelize['fn'](_0x84fa('0x3b'),'%'+_0x495625['query'][_0x84fa('0x36')]+'%')});}else{var _0x487bd6={};_0x487bd6[_0x2558c9[_0x84fa('0x15')]]={'$like':'%'+_0x495625['query'][_0x84fa('0x36')]+'%'};return _0x487bd6;}}})});}_0x564561=_[_0x84fa('0x39')]({},_0x564561,_0x495625[_0x84fa('0x3c')]);return _0x564561;};exports['include']=function(_0x5c1986){var _0x1fc3ac=[];if(_0x5c1986['includeAll']){_0x1fc3ac[_0x84fa('0x3d')]({'all':!![]});}else if(_0x5c1986[_0x84fa('0x3e')]){if(Array[_0x84fa('0x16')](_0x5c1986[_0x84fa('0x3e')])){_0x1fc3ac=Object[_0x84fa('0x5')](_0x5c1986['include'])[_0x84fa('0x19')](function(_0x79f3a2){return parseIncludeModel(_0x5c1986[_0x84fa('0x3e')][_0x79f3a2]);});}else{var _0x23b663=parseIncludeModel(_0x5c1986[_0x84fa('0x3e')]);_0x1fc3ac[_0x84fa('0x3d')](_0x23b663);}}return _0x1fc3ac;};exports['escapeLIKESpecialChars']=function(_0x5a8f3e){return _0x5a8f3e[_0x84fa('0x2c')](/[%_^-]/g,function(_0x4fd7f3){return'\x5c'+_0x4fd7f3;});}; \ No newline at end of file +var _0x6501=['include','includeAll','escapeLIKESpecialChars','lodash','sequelize','moment','parse','keys','model','fields','raw','split','filters','forOwn','find','DATE','isPlainObject','$gte','format','$lte','utc','subtract','name','uniqueid','isArray','limit','offset','map','indexOf','priority','col','unsigned','substr','DESC','ASC','length','isObject','unset','hasOwnProperty','omit','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','replace','trim','forEach','push','join','getOptions','query','$id','intersection','attributes','nolimit','order','sort','where','pick','filter','object','includes','columns','value','merge','type','VIRTUAL'];(function(_0x9f9ed5,_0x56f438){var _0xbc71e3=function(_0x1de828){while(--_0x1de828){_0x9f9ed5['push'](_0x9f9ed5['shift']());}};_0xbc71e3(++_0x56f438);}(_0x6501,0x8d));var _0x1650=function(_0x1b1aa4,_0x2d0d54){_0x1b1aa4=_0x1b1aa4-0x0;var _0x29162f=_0x6501[_0x1b1aa4];return _0x29162f;};'use strict';var _=require(_0x1650('0x0'));var sequelize=require(_0x1650('0x1'));var moment=require(_0x1650('0x2'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1fa2f8){var _0x4cb0bf=['ne'];try{var _0x23906b=JSON['parse'](_0x1fa2f8);var _0x4eb8a7=Object['keys'](_0x23906b)[0x0];return _0x4cb0bf['includes'](_0x4eb8a7);}catch(_0x283675){return![];}}function getOperatorValue(_0x491b03){var _0x3f7339=JSON[_0x1650('0x3')](_0x491b03);var _0x4fabd5=Object[_0x1650('0x4')](_0x3f7339)[0x0];var _0x2d84fe=_0x3f7339[_0x4fabd5];return{['$'+_0x4fabd5]:_0x2d84fe};}function parseIncludeModel(_0x77ec3e){var _0x43b96e=JSON[_0x1650('0x3')](_0x77ec3e);return{'model':db[_0x43b96e[_0x1650('0x5')]],'as':_0x43b96e['alias'],'attributes':_0x43b96e[_0x1650('0x6')],'raw':_0x43b96e[_0x1650('0x7')]};}exports['fields']=function(_0x11a155){var _0x4a0430=null;if(_0x11a155){_0x4a0430=_0x11a155[_0x1650('0x8')](',');}return _0x4a0430;};exports[_0x1650('0x9')]=function(_0x2929ff,_0x109e2b){var _0x9ebb1={};if(!_['isEmpty'](_0x2929ff)){_[_0x1650('0xa')](_0x2929ff,function(_0x5c4c4e,_0x37fd9e){try{if(_0x109e2b){var _0x49d503=_[_0x1650('0xb')](_0x109e2b,{'name':_0x37fd9e})||{};if(hasSequelizeOperator(_0x5c4c4e)){_0x9ebb1[_0x37fd9e]=getOperatorValue(_0x5c4c4e);}else if(_0x49d503['type']===_0x1650('0xc')&&_[_0x1650('0xd')](_0x5c4c4e)){var _0x3986b6=JSON['parse'](_0x5c4c4e);var _0x18f943={'$gte':moment(moment(_0x3986b6[_0x1650('0xe')])[_0x1650('0xf')]('YYYY-MM-DD'))['utc']()[_0x1650('0xf')](),'$lte':moment(moment(_0x3986b6[_0x1650('0x10')])[_0x1650('0xf')]('YYYY-MM-DD'))[_0x1650('0x11')]()[_0x1650('0x12')](0x1,'s')['format']()};_0x9ebb1[_0x37fd9e]=_0x18f943;}else if(_0x49d503[_0x1650('0x13')]===_0x1650('0x14')){_0x9ebb1[_0x37fd9e]=_0x5c4c4e;}else{_0x9ebb1[_0x37fd9e]=_[_0x1650('0x15')](_0x5c4c4e)?_0x5c4c4e:JSON['parse'](_0x5c4c4e);}}else{_0x9ebb1[_0x37fd9e]=_[_0x1650('0x15')](_0x5c4c4e)?_0x5c4c4e:JSON['parse'](_0x5c4c4e);}}catch(_0x5b1d90){_0x9ebb1[_0x37fd9e]=_0x5c4c4e['split'](',');}});}return _0x9ebb1;};exports[_0x1650('0x16')]=function(_0x4f20c0){_0x4f20c0=parseInt(_0x4f20c0,0xa);if(!_0x4f20c0||_0x4f20c0<0x0){_0x4f20c0=LIMIT_VALUE;}return _0x4f20c0;};exports[_0x1650('0x17')]=function(_0x1f4539){_0x1f4539=parseInt(_0x1f4539,0xa);if(!_0x1f4539||_0x1f4539<0x0){_0x1f4539=0x0;}return _0x1f4539;};exports['sort']=function(_0x57f451){var _0x223d14,_0x1c3496=null;if(_0x57f451){_0x223d14=_0x57f451['split'](',');_0x1c3496=_[_0x1650('0x18')](_0x223d14,function(_0x3207fa){if(_0x3207fa[_0x1650('0x19')]('-')===0x0){return[_0x3207fa===_0x1650('0x1a')?sequelize['cast'](sequelize[_0x1650('0x1b')](_0x1650('0x1a')),_0x1650('0x1c')):_0x3207fa[_0x1650('0x1d')](0x1),_0x1650('0x1e')];}else{return[_0x3207fa==='priority'?sequelize['cast'](sequelize['col']('priority'),_0x1650('0x1c')):_0x3207fa,_0x1650('0x1f')];}});}return _0x1c3496;};exports['omit']=function(_0x499f63,_0x247ba0){if(_['isEmpty'](_0x499f63)){return _0x499f63;}if(_[_0x1650('0x15')](_0x499f63)){for(var _0x237440=0x0;_0x237440<_0x499f63[_0x1650('0x20')];_0x237440+=0x1){_0x499f63[_0x237440]=this['omit'](_0x499f63[_0x237440],_0x247ba0);}return _0x499f63;}if(!_[_0x1650('0x21')](_0x499f63)){return _0x499f63;}if(_['isString'](_0x247ba0)){_0x247ba0=[_0x247ba0];}if(!_[_0x1650('0x15')](_0x247ba0)){return _0x499f63;}for(var _0x1855aa=0x0;_0x1855aa<_0x247ba0[_0x1650('0x20')];_0x1855aa+=0x1){_[_0x1650('0x22')](_0x499f63,_0x247ba0[_0x1855aa]);}for(var _0x434945 in _0x499f63){if(_0x499f63[_0x1650('0x23')](_0x434945)){_0x499f63[_0x434945]=this[_0x1650('0x24')](_0x499f63[_0x434945],_0x247ba0);}}return _0x499f63;};exports[_0x1650('0x25')]=function(_0x1f3db6){return _0x1f3db6[_0x1650('0x26')](RegExp(_0x1650('0x27')))?!![]:![];};exports[_0x1650('0x28')]=function(_0x38d8cb){return _0x38d8cb['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x1650('0x29')]=function(_0x1a48ab,_0x1efe67){var _0x4b40c3=[];var _0x12b4de=/([^:]")"+/g;var _0x550ba1=/[*<>~@-]/g;var _0x270afe=/[ `!@#$%^&*()_\-?~<>]/;var _0x32dec7=/[ ,]+/;var _0x54191b=_0x1efe67?_0x1650('0x2a'):'{EXPR}';if(_0x1efe67){_0x1a48ab=_0x1a48ab[_0x1650('0x2b')](_0x550ba1,'\x20')[_0x1650('0x2c')]();}_0x1a48ab[_0x1650('0x8')](_0x32dec7)[_0x1650('0x2d')](function(_0x5ee645){_0x5ee645=_0x5ee645[_0x1650('0x2b')](_0x12b4de,'$1');_0x5ee645='+'+_0x5ee645+'*';var _0x49e33a=_0x5ee645[_0x1650('0x26')](_0x270afe);if(_0x49e33a){_0x5ee645='\x22'+_0x5ee645+'\x22';}_0x4b40c3[_0x1650('0x2e')](_0x5ee645);});_0x54191b=_0x54191b[_0x1650('0x2b')]('{EXPR}',_0x4b40c3[_0x1650('0x2f')]('\x20'));return _0x54191b;};exports[_0x1650('0x30')]=function(_0x3ec403,_0x19fe9a,_0x11508f){var _0x4fff74={},_0x4dedf4={};if(_0x19fe9a[_0x1650('0x31')]['$id']){_0x19fe9a['query']['id']=_0x19fe9a[_0x1650('0x31')]['$id'];delete _0x19fe9a['query'][_0x1650('0x32')];}_0x4fff74['model']=_[_0x1650('0x18')](_0x3ec403,_0x1650('0x13'));_0x4fff74[_0x1650('0x31')]=_[_0x1650('0x4')](_0x19fe9a[_0x1650('0x31')]);_0x4fff74[_0x1650('0x9')]=_[_0x1650('0x33')](_0x4fff74[_0x1650('0x5')],_0x4fff74[_0x1650('0x31')]);_0x4dedf4[_0x1650('0x34')]=_[_0x1650('0x33')](_0x4fff74['model'],this[_0x1650('0x6')](_0x19fe9a[_0x1650('0x31')][_0x1650('0x6')]));_0x4dedf4[_0x1650('0x34')]=_0x4dedf4[_0x1650('0x34')][_0x1650('0x20')]?_0x4dedf4['attributes']:_0x4fff74[_0x1650('0x5')];if(!_0x19fe9a['query']['hasOwnProperty'](_0x1650('0x35'))){_0x4dedf4[_0x1650('0x16')]=this[_0x1650('0x16')](_0x19fe9a['query'][_0x1650('0x16')]);_0x4dedf4['offset']=this[_0x1650('0x17')](_0x19fe9a['query']['offset']);}_0x4dedf4[_0x1650('0x36')]=this[_0x1650('0x37')](_0x19fe9a[_0x1650('0x31')][_0x1650('0x37')]);_0x4dedf4[_0x1650('0x38')]=this[_0x1650('0x9')](_[_0x1650('0x39')](_0x19fe9a[_0x1650('0x31')],_0x4fff74[_0x1650('0x9')]),_0x3ec403);if(_0x19fe9a['query']['filter']){var _0x3e6995=_0x3ec403;var _0xa06e38=_0x19fe9a['query'][_0x1650('0x3a')];if(typeof _0xa06e38===_0x1650('0x3b')){_0x3e6995=_[_0x1650('0x3a')](_0x3ec403,function(_0x5d32c3){return _[_0x1650('0x3c')](_0xa06e38[_0x1650('0x3d')],_0x5d32c3[_0x1650('0x13')]);});_0xa06e38=_0xa06e38[_0x1650('0x3e')];}_0x4dedf4[_0x1650('0x38')]=_[_0x1650('0x3f')](_0x4dedf4[_0x1650('0x38')],{'$or':_[_0x1650('0x18')](_0x3e6995,function(_0x637db8){if(_0x637db8[_0x1650('0x40')]!==_0x1650('0x41')){if(_0x11508f){return sequelize['where'](sequelize['fn']('lower',sequelize[_0x1650('0x1b')](_0x637db8[_0x1650('0x13')])),{'$like':sequelize['fn']('lower','%'+_0x19fe9a[_0x1650('0x31')][_0x1650('0x3a')]+'%')});}else{var _0xb594e={};_0xb594e[_0x637db8[_0x1650('0x13')]]={'$like':'%'+_0x19fe9a[_0x1650('0x31')][_0x1650('0x3a')]+'%'};return _0xb594e;}}})});}_0x4dedf4=_['merge']({},_0x4dedf4,_0x19fe9a['options']);return _0x4dedf4;};exports[_0x1650('0x42')]=function(_0x106c70){var _0x614e8e=[];if(_0x106c70[_0x1650('0x43')]){_0x614e8e[_0x1650('0x2e')]({'all':!![]});}else if(_0x106c70[_0x1650('0x42')]){if(Array[_0x1650('0x15')](_0x106c70['include'])){_0x614e8e=Object[_0x1650('0x4')](_0x106c70['include'])[_0x1650('0x18')](function(_0x565fc3){return parseIncludeModel(_0x106c70[_0x1650('0x42')][_0x565fc3]);});}else{var _0x148df7=parseIncludeModel(_0x106c70[_0x1650('0x42')]);_0x614e8e[_0x1650('0x2e')](_0x148df7);}}return _0x614e8e;};exports[_0x1650('0x44')]=function(_0x5da6e4){return _0x5da6e4[_0x1650('0x2b')](/[%_^-]/g,function(_0x7f2689){return'\x5c'+_0x7f2689;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 1b515d6..7b2e734 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 _0xaa5e=['map','findOne','getAgents','all','flatten','value','getAgentIdsByQueues','includes','User','findAll','name','openchannelPause','smsPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','fullname','validateSortParameter','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','openchannelStatusTime','whatsappStatusTime','voiceStatusTime','phoneBarEnableScreenRecordingByAgent','pick','filterAgentAttributes','role','chatStatusTime','faxStatusTime','mailStatusTime','smsStatusTime','openchannelCapacity','chatCurrentCapacity','faxCurrentCapacity','phoneBarEnableAutomaticScreenRecording','destconnectedlinenum','onhold','queue','screenrecording','getRealtimeAgentsQueryFields','lodash','jayson/promise','client','http','chatPause','faxPause','mailPause','voicePause','whatsappPause','filter','length','idle','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','getRealtimeAgents','unknown','*pause','busy','isArray','startCase','Queue'];(function(_0x1ec9d9,_0x3791aa){var _0x46d953=function(_0x22f43c){while(--_0x22f43c){_0x1ec9d9['push'](_0x1ec9d9['shift']());}};_0x46d953(++_0x3791aa);}(_0xaa5e,0xa5));var _0xeaa5=function(_0x2ca1ff,_0x5723f5){_0x2ca1ff=_0x2ca1ff-0x0;var _0x51f85d=_0xaa5e[_0x2ca1ff];return _0x51f85d;};'use strict';var _=require(_0xeaa5('0x0'));var jayson=require(_0xeaa5('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xeaa5('0x2')][_0xeaa5('0x3')]({'port':0x232a});var routingClient=jayson[_0xeaa5('0x2')][_0xeaa5('0x3')]({'port':0x232c});function isAgentPaused(_0x131fc3,_0x5a1aca){var _0x2c111f=[_0x131fc3[_0xeaa5('0x4')],_0x131fc3[_0xeaa5('0x5')],_0x131fc3[_0xeaa5('0x6')],_0x131fc3['openchannelPause'],_0x131fc3['smsPause'],_0x131fc3[_0xeaa5('0x7')],_0x131fc3[_0xeaa5('0x8')]];if(!_0x5a1aca)return _['every'](_0x2c111f);var _0x2e35c3=_[_0xeaa5('0x9')](_0x2c111f);return _0x2e35c3['length']>0x0&&_0x2e35c3[_0xeaa5('0xa')]<_0x2c111f['length']?!![]:![];}function isIdle(_0x2f5750){return _0x2f5750===_0xeaa5('0xb')||_0x2f5750==='unknown'||_0x2f5750===_0xeaa5('0xc')||_0x2f5750===_0xeaa5('0xd')||_[_0xeaa5('0xe')](_0x2f5750);}function isAgentIdle(_0x46806d){if(_0x46806d[_0xeaa5('0xf')]!==_0xeaa5('0xb')&&_0x46806d[_0xeaa5('0x7')]){_0x46806d[_0xeaa5('0xf')]=_0xeaa5('0x10');return![];}return _['every']([_0x46806d[_0xeaa5('0x11')],_0x46806d[_0xeaa5('0x12')],_0x46806d[_0xeaa5('0x13')],_0x46806d[_0xeaa5('0x14')],_0x46806d[_0xeaa5('0x15')],_0x46806d['voiceStatus'],_0x46806d[_0xeaa5('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0xeaa5('0x17'),{})[_0xeaa5('0x18')](function(_0x1a1abc){if(_0x1a1abc['error']){throw new Error(_0xeaa5('0x19'));}var _0x5a0fed=_0x1a1abc[_0xeaa5('0x1a')];return routingClient[_0xeaa5('0x1b')](_0xeaa5('0x17'),{})['then'](function(_0x1877a6){if(_0x1877a6['error']){throw new Error(_0xeaa5('0x1c'));}var _0x85fb44=_0x1877a6[_0xeaa5('0x1a')];return _[_0xeaa5('0x1d')]({},_0x5a0fed,_0x85fb44);});})['catch'](function(_0x1e4fcd){throw _0x1e4fcd;});}exports[_0xeaa5('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x39b14d){var _0x56533e=_0xeaa5('0x1f');if(isAgentPaused(_0x39b14d))_0x56533e=_0xeaa5('0x10');else if(isAgentPaused(_0x39b14d,!![]))_0x56533e=_0xeaa5('0x20');else if(isAgentIdle(_0x39b14d))_0x56533e=_0xeaa5('0xb');else _0x56533e=_0xeaa5('0x21');return _0x56533e;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x3f081e,_0x5f2d83){var _0x4212f5=_[_0xeaa5('0x22')](_0x3f081e)?_0x3f081e:[_0x3f081e];var _0xbf6bed=_[_0xeaa5('0x23')](_0x5f2d83)+_0xeaa5('0x24');var _0x233a5b=_[_0xeaa5('0x25')](_0x4212f5,function(_0xee844c){return db[_0xbf6bed][_0xeaa5('0x26')]({'where':{'id':_0xee844c}})[_0xeaa5('0x18')](function(_0x3e27f1){if(!_0x3e27f1)return[];return _0x3e27f1[_0xeaa5('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xeaa5('0x28')](_0x233a5b)[_0xeaa5('0x18')](function(_0x4637c0){var _0x4dde20=_(_0x4637c0)[_0xeaa5('0x29')]()[_0xeaa5('0x25')]('id')['uniq']()[_0xeaa5('0x2a')]();return _0x4dde20;});}exports[_0xeaa5('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x304936,_0x35ca08,_0x1a1ec3){try{if(_0x35ca08['length']>0x0){_0x304936=_0x304936[_0xeaa5('0x9')](function(_0x592fe1){return _0x35ca08[_0xeaa5('0x2c')](_0x592fe1['id']);});}var _0x1b2533=_0x304936[_0xeaa5('0x9')](function(_0x24d90d){var _0x106587=_0xeaa5('0x21');if(isAgentIdle(_0x24d90d)){_0x106587='idle';}return _0x106587===_0x1a1ec3;});return _[_0xeaa5('0x25')](_0x1b2533,'id');}catch(_0xb408d0){throw _0xb408d0;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x377d72,_0x5a8bb9,_0x213e29){return Promise['resolve']()['then'](function(){if(_0x5a8bb9[_0xeaa5('0xa')]>0x0){_0x377d72=_0x377d72['filter'](function(_0x2a0a48){return _0x5a8bb9['includes'](_0x2a0a48['id']);});}return _0x377d72;})[_0xeaa5('0x18')](function(){return db[_0xeaa5('0x2d')][_0xeaa5('0x2e')]({'attributes':['id',_0xeaa5('0x2f'),'fullname',_0xeaa5('0x4'),'faxPause','mailPause',_0xeaa5('0x30'),_0xeaa5('0x31'),'voicePause',_0xeaa5('0x8'),_0xeaa5('0x32')],'where':{'id':{'$in':_[_0xeaa5('0x25')](_0x377d72,'id')}},'raw':!![]});})[_0xeaa5('0x18')](function(_0x510fb4){return _0x510fb4['map'](function(_0x3d73ac){var _0x250037=_[_0xeaa5('0x33')](_0x377d72,['id',_0x3d73ac['id']]);var _0x291d18=filterAgentAttributes(_0x250037);_[_0xeaa5('0x1d')](_0x3d73ac,_0x291d18);_0x3d73ac[_0xeaa5('0x34')]=getAgentStatus(_0x3d73ac);return _0x3d73ac;});})[_0xeaa5('0x18')](function(_0x5118b6){var _0x38f539=sortAgentsByStatus(_0x5118b6,_0x213e29);return _[_0xeaa5('0x25')](_0x38f539,'id');})['catch'](function(_0x229162){throw _0x229162;});}exports[_0xeaa5('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4a15c9){var _0x5e1f71={'fields':[],'order':null};var _0x49f9f0=_0x4a15c9[_0xeaa5('0x36')](',');_0x5e1f71['fields']=_[_0xeaa5('0x9')](_0x49f9f0,function(_0x5cec59){if(!_0x5cec59['includes'](_0xeaa5('0x34'))){return!![];}_0x5e1f71[_0xeaa5('0x37')]=_[_0xeaa5('0x38')](_0x5cec59,'-')?_0xeaa5('0x39'):_0xeaa5('0x3a');return![];});return _0x5e1f71;}exports[_0xeaa5('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x4b2939){if(!_0x4b2939){_0x4b2939='fullname,internal';}if(_0x4b2939[_0xeaa5('0x2c')]('fullname')&&!_0x4b2939[_0xeaa5('0x2c')](_0xeaa5('0x3c'))){var _0x49bf4d=_0x4b2939[_0xeaa5('0x3d')](0x0,_0x4b2939[_0xeaa5('0x3e')](_0xeaa5('0x3f')));_0x4b2939+=','+_0x49bf4d+'internal';}return _0x4b2939;}exports[_0xeaa5('0x40')]=validateSortParameter;function sortAgentsByStatus(_0x5b090d,_0x2169ae){var _0x22bae0=_0x5b090d['sort'](function(_0x247eab,_0x43d5a0){if(_0x247eab['globalStatus']===_0x43d5a0[_0xeaa5('0x34')]){if(_0x247eab[_0xeaa5('0x34')]===_0xeaa5('0x10')){if(_0x2169ae===_0xeaa5('0x39')){return(_0x247eab[_0xeaa5('0x32')]||'')<(_0x43d5a0[_0xeaa5('0x32')]||'')||_0x247eab[_0xeaa5('0x3f')][_0xeaa5('0x41')]()>_0x43d5a0[_0xeaa5('0x3f')]['toLowerCase']()?0x1:-0x1;}else{return(_0x247eab[_0xeaa5('0x32')]||'')<(_0x43d5a0[_0xeaa5('0x32')]||'')||_0x247eab[_0xeaa5('0x3f')][_0xeaa5('0x41')]()>_0x43d5a0[_0xeaa5('0x3f')][_0xeaa5('0x41')]()?-0x1:0x1;}}else{if(_0x2169ae==='DESC'){return _0x247eab['fullname'][_0xeaa5('0x41')]()<_0x43d5a0[_0xeaa5('0x3f')][_0xeaa5('0x41')]()?0x1:-0x1;}else{return _0x247eab['fullname'][_0xeaa5('0x41')]()<_0x43d5a0[_0xeaa5('0x3f')][_0xeaa5('0x41')]()?-0x1:0x1;}}}else{if(_0x2169ae==='DESC'){return _0x247eab[_0xeaa5('0x34')]<_0x43d5a0[_0xeaa5('0x34')]?0x1:-0x1;}else{return _0x247eab[_0xeaa5('0x34')]<_0x43d5a0['globalStatus']?-0x1:0x1;}}});return _0x22bae0;}exports[_0xeaa5('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0xc2e4fb){var _0x1adcba=[_0xeaa5('0x43'),_0xeaa5('0x44'),_0xeaa5('0x45'),_0xeaa5('0x46'),_0xeaa5('0x32'),_0xeaa5('0x46'),'internal',_0xeaa5('0x47'),_0xeaa5('0x4'),_0xeaa5('0x30'),_0xeaa5('0x6'),_0xeaa5('0x31'),_0xeaa5('0x8'),_0xeaa5('0x5'),_0xeaa5('0x7'),_0xeaa5('0x48'),'openchannelCapacity',_0xeaa5('0x49'),_0xeaa5('0x4a'),_0xeaa5('0x4b'),_0xeaa5('0x4c'),'chatCurrentCapacity',_0xeaa5('0x4d'),_0xeaa5('0x4e'),_0xeaa5('0x4f'),_0xeaa5('0x50'),'faxCurrentCapacity',_0xeaa5('0x11'),_0xeaa5('0x14'),_0xeaa5('0x13'),_0xeaa5('0x15'),'whatsappStatus',_0xeaa5('0x12'),'voiceStatus','chatStatusTime',_0xeaa5('0x51'),'mailStatusTime','smsStatusTime',_0xeaa5('0x52'),'faxStatusTime',_0xeaa5('0x53'),'queue','destconnectedlinenum','screenrecording',_0xeaa5('0x54'),'phoneBarEnableAutomaticScreenRecording'];var _0x1b86ff=[_0xeaa5('0x4'),_0xeaa5('0x30'),_0xeaa5('0x6'),_0xeaa5('0x31'),_0xeaa5('0x8'),_0xeaa5('0x5'),_0xeaa5('0x7'),_0xeaa5('0x44')];var _0x29a6c7=_(_0xc2e4fb)['omit'](_0x1b86ff)[_0xeaa5('0x55')](_0x1adcba)[_0xeaa5('0x2a')]();return _0x29a6c7;}exports[_0xeaa5('0x56')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name','fullname',_0xeaa5('0x57'),_0xeaa5('0x3c'),_0xeaa5('0x44'),'globalStatus',_0xeaa5('0x43'),_0xeaa5('0x45'),_0xeaa5('0x32'),'lastPauseAt',_0xeaa5('0x5'),_0xeaa5('0x4'),_0xeaa5('0x6'),'openchannelPause','smsPause',_0xeaa5('0x7'),_0xeaa5('0x8'),_0xeaa5('0x11'),_0xeaa5('0x12'),'mailStatus','openchannelStatus','smsStatus','voiceStatus',_0xeaa5('0x16'),_0xeaa5('0x58'),_0xeaa5('0x59'),_0xeaa5('0x5a'),_0xeaa5('0x51'),_0xeaa5('0x5b'),_0xeaa5('0x53'),_0xeaa5('0x52'),'chatCapacity',_0xeaa5('0x4c'),'mailCapacity',_0xeaa5('0x5c'),'smsCapacity',_0xeaa5('0x4b'),_0xeaa5('0x5d'),_0xeaa5('0x5e'),_0xeaa5('0x4e'),_0xeaa5('0x4d'),'smsCurrentCapacity',_0xeaa5('0x50'),'phoneBarEnableScreenRecordingByAgent',_0xeaa5('0x5f'),_0xeaa5('0x60'),_0xeaa5('0x61'),_0xeaa5('0x62'),_0xeaa5('0x63')];}exports[_0xeaa5('0x64')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xc931=['phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','value','filterAgentAttributes','openchannelStatusTime','whatsappCurrentCapacity','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','client','http','chatPause','faxPause','openchannelPause','smsPause','voicePause','every','filter','length','idle','voiceStatus','pause','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','unknown','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','getAgents','all','flatten','uniq','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname','mailPause','whatsappPause','pauseType','find','merge','globalStatus','catch','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','indexOf','internal','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','faxStatus','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xc931,0x19c));var _0x1c93=function(_0x8d9e0,_0x402d93){_0x8d9e0=_0x8d9e0-0x0;var _0x3221f7=_0xc931[_0x8d9e0];return _0x3221f7;};'use strict';var _=require(_0x1c93('0x0'));var jayson=require(_0x1c93('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x1c93('0x2')][_0x1c93('0x3')]({'port':0x232a});var routingClient=jayson[_0x1c93('0x2')][_0x1c93('0x3')]({'port':0x232c});function isAgentPaused(_0x1c539d,_0xc5f313){var _0x3468f7=[_0x1c539d[_0x1c93('0x4')],_0x1c539d[_0x1c93('0x5')],_0x1c539d['mailPause'],_0x1c539d[_0x1c93('0x6')],_0x1c539d[_0x1c93('0x7')],_0x1c539d[_0x1c93('0x8')],_0x1c539d['whatsappPause']];if(!_0xc5f313)return _[_0x1c93('0x9')](_0x3468f7);var _0x2f6582=_[_0x1c93('0xa')](_0x3468f7);return _0x2f6582[_0x1c93('0xb')]>0x0&&_0x2f6582[_0x1c93('0xb')]<_0x3468f7[_0x1c93('0xb')]?!![]:![];}function isIdle(_0x57290b){return _0x57290b===_0x1c93('0xc')||_0x57290b==='unknown'||_0x57290b==='unavailable'||_0x57290b==='ringing'||_['isNil'](_0x57290b);}function isAgentIdle(_0x113fb7){if(_0x113fb7[_0x1c93('0xd')]!==_0x1c93('0xc')&&_0x113fb7[_0x1c93('0x8')]){_0x113fb7['voiceStatus']=_0x1c93('0xe');return![];}return _[_0x1c93('0x9')]([_0x113fb7[_0x1c93('0xf')],_0x113fb7['faxStatus'],_0x113fb7[_0x1c93('0x10')],_0x113fb7[_0x1c93('0x11')],_0x113fb7[_0x1c93('0x12')],_0x113fb7[_0x1c93('0xd')],_0x113fb7[_0x1c93('0x13')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x1c93('0x14')](_0x1c93('0x15'),{})['then'](function(_0x5b6da3){if(_0x5b6da3[_0x1c93('0x16')]){throw new Error(_0x1c93('0x17'));}var _0x2752e3=_0x5b6da3[_0x1c93('0x18')];return routingClient['request']('Agents',{})[_0x1c93('0x19')](function(_0x185286){if(_0x185286[_0x1c93('0x16')]){throw new Error(_0x1c93('0x1a'));}var _0x195839=_0x185286[_0x1c93('0x18')];return _['merge']({},_0x2752e3,_0x195839);});})['catch'](function(_0x5719a5){throw _0x5719a5;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x10d963){var _0x4bc17c=_0x1c93('0x1b');if(isAgentPaused(_0x10d963))_0x4bc17c=_0x1c93('0xe');else if(isAgentPaused(_0x10d963,!![]))_0x4bc17c=_0x1c93('0x1c');else if(isAgentIdle(_0x10d963))_0x4bc17c=_0x1c93('0xc');else _0x4bc17c=_0x1c93('0x1d');return _0x4bc17c;}exports[_0x1c93('0x1e')]=getAgentStatus;function getAgentIdsByQueues(_0x14b99b,_0x26c4b2){var _0x41db55=_[_0x1c93('0x1f')](_0x14b99b)?_0x14b99b:[_0x14b99b];var _0x28189e=_[_0x1c93('0x20')](_0x26c4b2)+_0x1c93('0x21');var _0x4bfa0b=_[_0x1c93('0x22')](_0x41db55,function(_0x27d52b){return db[_0x28189e]['findOne']({'where':{'id':_0x27d52b}})[_0x1c93('0x19')](function(_0x1c275c){if(!_0x1c275c)return[];return _0x1c275c[_0x1c93('0x23')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x1c93('0x24')](_0x4bfa0b)[_0x1c93('0x19')](function(_0x449e65){var _0x1166f4=_(_0x449e65)[_0x1c93('0x25')]()[_0x1c93('0x22')]('id')[_0x1c93('0x26')]()['value']();return _0x1166f4;});}exports[_0x1c93('0x27')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x5ca28a,_0xcad2bd,_0x125496){try{if(_0xcad2bd[_0x1c93('0xb')]>0x0){_0x5ca28a=_0x5ca28a[_0x1c93('0xa')](function(_0x457a9a){return _0xcad2bd[_0x1c93('0x28')](_0x457a9a['id']);});}var _0x2832e8=_0x5ca28a['filter'](function(_0x55225d){var _0x3c41f2=_0x1c93('0x1d');if(isAgentIdle(_0x55225d)){_0x3c41f2=_0x1c93('0xc');}return _0x3c41f2===_0x125496;});return _[_0x1c93('0x22')](_0x2832e8,'id');}catch(_0x14577e){throw _0x14577e;}}exports[_0x1c93('0x29')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x24f573,_0x44f1ad,_0x4e02ab){return Promise[_0x1c93('0x2a')]()[_0x1c93('0x19')](function(){if(_0x44f1ad['length']>0x0){_0x24f573=_0x24f573[_0x1c93('0xa')](function(_0x43d789){return _0x44f1ad[_0x1c93('0x28')](_0x43d789['id']);});}return _0x24f573;})['then'](function(){return db[_0x1c93('0x2b')][_0x1c93('0x2c')]({'attributes':['id',_0x1c93('0x2d'),_0x1c93('0x2e'),_0x1c93('0x4'),_0x1c93('0x5'),_0x1c93('0x2f'),_0x1c93('0x6'),_0x1c93('0x7'),'voicePause',_0x1c93('0x30'),_0x1c93('0x31')],'where':{'id':{'$in':_[_0x1c93('0x22')](_0x24f573,'id')}},'raw':!![]});})[_0x1c93('0x19')](function(_0xc9deae){return _0xc9deae['map'](function(_0x4854a7){var _0x3ae63b=_[_0x1c93('0x32')](_0x24f573,['id',_0x4854a7['id']]);var _0x55d84f=filterAgentAttributes(_0x3ae63b);_[_0x1c93('0x33')](_0x4854a7,_0x55d84f);_0x4854a7[_0x1c93('0x34')]=getAgentStatus(_0x4854a7);return _0x4854a7;});})[_0x1c93('0x19')](function(_0x24d776){var _0x1d34da=sortAgentsByStatus(_0x24d776,_0x4e02ab);return _[_0x1c93('0x22')](_0x1d34da,'id');})[_0x1c93('0x35')](function(_0x21c399){throw _0x21c399;});}exports[_0x1c93('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x49b9ce){var _0xc9f990={'fields':[],'order':null};var _0x4b7fbd=_0x49b9ce[_0x1c93('0x37')](',');_0xc9f990[_0x1c93('0x38')]=_['filter'](_0x4b7fbd,function(_0x2d08f8){if(!_0x2d08f8[_0x1c93('0x28')](_0x1c93('0x34'))){return!![];}_0xc9f990[_0x1c93('0x39')]=_[_0x1c93('0x3a')](_0x2d08f8,'-')?_0x1c93('0x3b'):_0x1c93('0x3c');return![];});return _0xc9f990;}exports[_0x1c93('0x3d')]=getUpdatedSortOptions;function validateSortParameter(_0x478343){if(!_0x478343){_0x478343=_0x1c93('0x3e');}if(_0x478343[_0x1c93('0x28')](_0x1c93('0x2e'))&&!_0x478343[_0x1c93('0x28')]('internal')){var _0x2bc381=_0x478343['substring'](0x0,_0x478343[_0x1c93('0x3f')](_0x1c93('0x2e')));_0x478343+=','+_0x2bc381+_0x1c93('0x40');}return _0x478343;}exports[_0x1c93('0x41')]=validateSortParameter;function sortAgentsByStatus(_0x1c2f1e,_0x3bdb8d){var _0x3a58ef=_0x1c2f1e[_0x1c93('0x42')](function(_0x287b13,_0x1b3344){if(_0x287b13[_0x1c93('0x34')]===_0x1b3344[_0x1c93('0x34')]){if(_0x287b13[_0x1c93('0x34')]===_0x1c93('0xe')){if(_0x3bdb8d===_0x1c93('0x3b')){return(_0x287b13[_0x1c93('0x31')]||'')<(_0x1b3344[_0x1c93('0x31')]||'')||_0x287b13[_0x1c93('0x2e')][_0x1c93('0x43')]()>_0x1b3344[_0x1c93('0x2e')][_0x1c93('0x43')]()?0x1:-0x1;}else{return(_0x287b13[_0x1c93('0x31')]||'')<(_0x1b3344['pauseType']||'')||_0x287b13[_0x1c93('0x2e')][_0x1c93('0x43')]()>_0x1b3344[_0x1c93('0x2e')][_0x1c93('0x43')]()?-0x1:0x1;}}else{if(_0x3bdb8d===_0x1c93('0x3b')){return _0x287b13[_0x1c93('0x2e')][_0x1c93('0x43')]()<_0x1b3344[_0x1c93('0x2e')][_0x1c93('0x43')]()?0x1:-0x1;}else{return _0x287b13[_0x1c93('0x2e')]['toLowerCase']()<_0x1b3344[_0x1c93('0x2e')][_0x1c93('0x43')]()?-0x1:0x1;}}}else{if(_0x3bdb8d===_0x1c93('0x3b')){return _0x287b13['globalStatus']<_0x1b3344[_0x1c93('0x34')]?0x1:-0x1;}else{return _0x287b13[_0x1c93('0x34')]<_0x1b3344[_0x1c93('0x34')]?-0x1:0x1;}}});return _0x3a58ef;}exports[_0x1c93('0x44')]=sortAgentsByStatus;function filterAgentAttributes(_0x485f9c){var _0x57b8c3=[_0x1c93('0x45'),_0x1c93('0x46'),'lastLoginAt',_0x1c93('0x47'),_0x1c93('0x31'),_0x1c93('0x47'),_0x1c93('0x40'),_0x1c93('0x48'),_0x1c93('0x4'),_0x1c93('0x6'),_0x1c93('0x2f'),_0x1c93('0x7'),_0x1c93('0x30'),_0x1c93('0x5'),'voicePause',_0x1c93('0x49'),_0x1c93('0x4a'),_0x1c93('0x4b'),_0x1c93('0x4c'),_0x1c93('0x4d'),'faxCapacity',_0x1c93('0x4e'),_0x1c93('0x4f'),_0x1c93('0x50'),_0x1c93('0x51'),'whatsappCurrentCapacity',_0x1c93('0x52'),_0x1c93('0xf'),_0x1c93('0x11'),_0x1c93('0x10'),'smsStatus',_0x1c93('0x13'),_0x1c93('0x53'),_0x1c93('0xd'),_0x1c93('0x54'),'openchannelStatusTime',_0x1c93('0x55'),_0x1c93('0x56'),_0x1c93('0x57'),_0x1c93('0x58'),_0x1c93('0x59'),_0x1c93('0x5a'),_0x1c93('0x5b'),_0x1c93('0x5c'),_0x1c93('0x5d'),_0x1c93('0x5e')];var _0x36f21e=[_0x1c93('0x4'),'openchannelPause','mailPause',_0x1c93('0x7'),_0x1c93('0x30'),_0x1c93('0x5'),_0x1c93('0x8'),'online'];var _0x36ca5f=_(_0x485f9c)['omit'](_0x36f21e)['pick'](_0x57b8c3)[_0x1c93('0x5f')]();return _0x36ca5f;}exports[_0x1c93('0x60')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x1c93('0x2d'),_0x1c93('0x2e'),'role',_0x1c93('0x40'),_0x1c93('0x46'),'globalStatus',_0x1c93('0x45'),'lastLoginAt',_0x1c93('0x31'),'lastPauseAt',_0x1c93('0x5'),_0x1c93('0x4'),_0x1c93('0x2f'),_0x1c93('0x6'),_0x1c93('0x7'),_0x1c93('0x8'),_0x1c93('0x30'),_0x1c93('0xf'),_0x1c93('0x53'),_0x1c93('0x10'),'openchannelStatus',_0x1c93('0x12'),_0x1c93('0xd'),_0x1c93('0x13'),_0x1c93('0x54'),_0x1c93('0x58'),_0x1c93('0x55'),_0x1c93('0x61'),_0x1c93('0x56'),_0x1c93('0x59'),_0x1c93('0x57'),_0x1c93('0x49'),'faxCapacity',_0x1c93('0x4b'),_0x1c93('0x4a'),'smsCapacity',_0x1c93('0x4d'),_0x1c93('0x4e'),_0x1c93('0x52'),_0x1c93('0x50'),_0x1c93('0x4f'),_0x1c93('0x51'),_0x1c93('0x62'),'phoneBarEnableScreenRecordingByAgent',_0x1c93('0x5e'),'destconnectedlinenum',_0x1c93('0x63'),'queue',_0x1c93('0x5c')];}exports[_0x1c93('0x64')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index b115a41..b958ee9 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 _0x7c91=['map','get','originated','merge','initializeQueues','lodash','jayson/promise','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','ringing','ringInUse','talking','unavailable','pTalking','message','statusMessage','dialMethod','Trunk','startPredictive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','outbound'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7c91,0x12b));var _0x17c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c91[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x17c9('0x0'));var jayson=require(_0x17c9('0x1'));var util=require('util');var amiClient=jayson[_0x17c9('0x2')][_0x17c9('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x17c9('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x17c9('0x4'),_0x17c9('0x5'),_0x17c9('0x6'),_0x17c9('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x17c9('0x8'),_0x17c9('0x9'),_0x17c9('0xa'),_0x17c9('0xb'),_0x17c9('0xc'),'onHold',_0x17c9('0xd'),_0x17c9('0xe'),_0x17c9('0xf'),_0x17c9('0x10'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x17c9('0x11'),'originated',_0x17c9('0x12'),_0x17c9('0x13'),'dialActive',_0x17c9('0x14'),_0x17c9('0x15'),_0x17c9('0x16'),'startProgressive','erlangCalls',_0x17c9('0x17'),_0x17c9('0x18'),_0x17c9('0x19'),'dialPredictiveInterval',_0x17c9('0x1a'),_0x17c9('0x1b'),_0x17c9('0x1c'),'predictiveIntervalTotalCalls',_0x17c9('0x1d'),_0x17c9('0x1e'),'predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime',_0x17c9('0x1f')];function getRealtimeQueues(_0x39e32d,_0x151f6c){var _0x3f36ac=_0x151f6c===_0x17c9('0x20')?amiClient:routingClient;return _0x3f36ac[_0x17c9('0x21')](_[_0x17c9('0x22')](_0x151f6c)+_0x17c9('0x23'),_0x39e32d)[_0x17c9('0x24')](function(_0x2ca9a3){if(_0x2ca9a3[_0x17c9('0x25')])throw new Error(util[_0x17c9('0x26')](_0x17c9('0x27'),_0x151f6c));return _0x2ca9a3[_0x17c9('0x28')];})[_0x17c9('0x29')](function(_0x5c2cad){throw _0x5c2cad;});}exports[_0x17c9('0x2a')]=getRealtimeQueues;function initializeQueues(_0x3d93c8,_0x57fe83,_0x4e4cbf,_0x13e3f5){var _0x168b29=DEFAULT_QUEUE_ATTRIBUTES;if(_0x4e4cbf===_0x17c9('0x20')){if(_0x13e3f5==='inbound'){_0x168b29=_0x168b29['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x13e3f5===_0x17c9('0x2b')){_0x168b29=_0x168b29['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x3d93c8[_0x17c9('0x2c')](function(_0x458ce1){var _0x25fef0=_0x458ce1[_0x17c9('0x2d')]({'plain':!![]});_0x25fef0[_0x17c9('0x6')]=0x0;_0x25fef0[_0x17c9('0xb')]=0x0;_0x25fef0['loggedIn']=0x0;_0x25fef0[_0x17c9('0x4')]=0x0;_0x25fef0[_0x17c9('0x7')]=0x0;if(_0x4e4cbf==='voice'){_0x25fef0['talking']=0x0;_0x25fef0[_0x17c9('0x8')]=0x0;if(_0x13e3f5==='outbound'){_0x25fef0[_0x17c9('0x11')]=0x0;_0x25fef0[_0x17c9('0x2e')]=0x0;}}var _0x22d9c0=_['find'](_0x57fe83,['id',_0x25fef0['id']]);if(_0x22d9c0){_[_0x17c9('0x2f')](_0x25fef0,_['pick'](_0x22d9c0,_0x168b29));}return _0x25fef0;});}exports[_0x17c9('0x30')]=initializeQueues; \ No newline at end of file +var _0x6648=['request','startCase','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','getRealtimeQueues','inbound','concat','outbound','map','get','loggedInDb','merge','pick','initializeQueues','lodash','util','client','http','loggedIn','waiting','busy','inUse','ringInUse','talking','unavailable','unknown','pTalking','originated','message','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice'];(function(_0x20b7bc,_0x1caca0){var _0x4f682c=function(_0x4b56c2){while(--_0x4b56c2){_0x20b7bc['push'](_0x20b7bc['shift']());}};_0x4f682c(++_0x1caca0);}(_0x6648,0x125));var _0x8664=function(_0x59fae0,_0x3b2e29){_0x59fae0=_0x59fae0-0x0;var _0x604075=_0x6648[_0x59fae0];return _0x604075;};'use strict';var _=require(_0x8664('0x0'));var jayson=require('jayson/promise');var util=require(_0x8664('0x1'));var amiClient=jayson[_0x8664('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0x8664('0x2')][_0x8664('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x8664('0x4'),'paused',_0x8664('0x5')];var VOICE_QUEUE_ATTRIBUTES=[_0x8664('0x6'),_0x8664('0x7'),'invalid','loggedInDb','notInUse','onHold','ringing',_0x8664('0x8'),_0x8664('0x9'),_0x8664('0xa'),_0x8664('0xb')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x8664('0xc'),_0x8664('0xd'),_0x8664('0xe'),'statusMessage',_0x8664('0xf'),_0x8664('0x10'),'Trunk',_0x8664('0x11'),_0x8664('0x12'),_0x8664('0x13'),_0x8664('0x14'),'erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0x8664('0x15'),_0x8664('0x16'),_0x8664('0x17'),_0x8664('0x18'),_0x8664('0x19'),'predictiveIntervalDroppedCallsCallersExit',_0x8664('0x1a'),_0x8664('0x1b')];function getRealtimeQueues(_0x25b36b,_0x25b858){var _0x2f1a2e=_0x25b858===_0x8664('0x1c')?amiClient:routingClient;return _0x2f1a2e[_0x8664('0x1d')](_[_0x8664('0x1e')](_0x25b858)+'Queues',_0x25b36b)[_0x8664('0x1f')](function(_0x43839a){if(_0x43839a[_0x8664('0x20')])throw new Error(util[_0x8664('0x21')](_0x8664('0x22'),_0x25b858));return _0x43839a['result'];})[_0x8664('0x23')](function(_0x444db8){throw _0x444db8;});}exports[_0x8664('0x24')]=getRealtimeQueues;function initializeQueues(_0x4d21b1,_0x743a66,_0x244a7c,_0x4b76c1){var _0x3ca7a2=DEFAULT_QUEUE_ATTRIBUTES;if(_0x244a7c===_0x8664('0x1c')){if(_0x4b76c1===_0x8664('0x25')){_0x3ca7a2=_0x3ca7a2[_0x8664('0x26')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x4b76c1===_0x8664('0x27')){_0x3ca7a2=_0x3ca7a2[_0x8664('0x26')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x4d21b1[_0x8664('0x28')](function(_0x33f3f9){var _0xbcecc4=_0x33f3f9[_0x8664('0x29')]({'plain':!![]});_0xbcecc4['paused']=0x0;_0xbcecc4[_0x8664('0x2a')]=0x0;_0xbcecc4[_0x8664('0x4')]=0x0;_0xbcecc4['available']=0x0;_0xbcecc4[_0x8664('0x5')]=0x0;if(_0x244a7c===_0x8664('0x1c')){_0xbcecc4[_0x8664('0x9')]=0x0;_0xbcecc4['busy']=0x0;if(_0x4b76c1===_0x8664('0x27')){_0xbcecc4[_0x8664('0xc')]=0x0;_0xbcecc4[_0x8664('0xd')]=0x0;}}var _0x5d127a=_['find'](_0x743a66,['id',_0xbcecc4['id']]);if(_0x5d127a){_[_0x8664('0x2b')](_0xbcecc4,_[_0x8664('0x2c')](_0x5d127a,_0x3ca7a2));}return _0xbcecc4;});}exports[_0x8664('0x2d')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 4bfee13..6600011 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(_0x249f8c,_0xfb3946){var _0x5e224a=function(_0xd4c5a1){while(--_0xd4c5a1){_0x249f8c['push'](_0x249f8c['shift']());}};_0x5e224a(++_0xfb3946);}(_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 _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(_0x48e921,_0x20cf98){var _0x4986fe=function(_0x466eb2){while(--_0x466eb2){_0x48e921['push'](_0x48e921['shift']());}};_0x4986fe(++_0x20cf98);}(_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 diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 0188bcd..7a3bba1 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 _0x6812=['crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','concat','head','mac','127.0.0.1','getFirstInterface','cpus','map','join','createHash','md5','update','digest','hex','getUuid','platform','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','substring','lodash'];(function(_0x27456c,_0x2de858){var _0x446b02=function(_0x28dc04){while(--_0x28dc04){_0x27456c['push'](_0x27456c['shift']());}};_0x446b02(++_0x2de858);}(_0x6812,0x117));var _0x2681=function(_0x554444,_0x3b7889){_0x554444=_0x554444-0x0;var _0x3433ab=_0x6812[_0x554444];return _0x3433ab;};'use strict';var _=require(_0x2681('0x0'));var os=require('os');var crypto=require(_0x2681('0x1'));var machine=require(_0x2681('0x2'));var exec=require('child_process')[_0x2681('0x3')];var config=require(_0x2681('0x4'));function getInterfaces(){var _0x34c904=[];var _0x24361a=os[_0x2681('0x5')]();var _0x521315=_[_0x2681('0x6')](_[_0x2681('0x7')](_0x24361a));for(var _0x582a1=0x0;_0x582a1<_0x521315[_0x2681('0x8')];_0x582a1++){var _0x526da2=_0x24361a[_0x521315[_0x582a1]][_0x2681('0x9')](function(_0x4ee286){return _0x4ee286[_0x2681('0xa')]===_0x2681('0xb')&&_0x4ee286['internal']===![];});_0x34c904=_0x34c904[_0x2681('0xc')](_0x526da2);}return _0x34c904;}function getFirstInterface(){var _0x574492=_[_0x2681('0xd')](getInterfaces());return{'macAddress':_0x574492&&_0x574492[_0x2681('0xe')]?_0x574492[_0x2681('0xe')]:'00:00:00:00:00:00','ipAddress':_0x574492&&_0x574492['address']?_0x574492['address']:_0x2681('0xf')};}exports[_0x2681('0x10')]=getFirstInterface;function getCPUhash(){var _0x370e20=_[_0x2681('0x6')](os[_0x2681('0x11')]()[_0x2681('0x12')](function(_0xbe9fc){return _0xbe9fc['model'];}))[_0x2681('0x13')](':');return crypto[_0x2681('0x14')](_0x2681('0x15'))[_0x2681('0x16')](_0x370e20)[_0x2681('0x17')](_0x2681('0x18'));}exports[_0x2681('0x19')]=function(){var _0x4e5390=os[_0x2681('0x1a')]();var _0x65b366=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x65b366[_0x2681('0x1b')](config['licenseToken'])){return config['licenseToken'];}else if(_0x4e5390===_0x2681('0x1c')){return exec(_0x2681('0x1d'),{'encoding':_0x2681('0x1e')})[_0x2681('0x1f')]('\x0d\x0a','');}else{var _0x811aa9=getFirstInterface();var _0x837f02=getCPUhash();var _0x5eb2d6=_0x837f02+'|'+os['hostname']()+'|'+_0x811aa9[_0x2681('0x20')]+'|'+_0x811aa9[_0x2681('0x21')];var _0x168461=crypto['createHash'](_0x2681('0x15'))['update'](_0x5eb2d6)[_0x2681('0x17')](_0x2681('0x18'));return _0x168461['substring'](0x0,0x8)+'-'+_0x168461[_0x2681('0x22')](0x8,0xc)+'-'+_0x168461['substring'](0xc,0x10)+'-'+_0x168461['substring'](0x10,0x14)+'-'+_0x168461['substring'](0x14);}}; \ No newline at end of file +var _0xb476=['macAddress','ipAddress','hex','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','orderBy','keys','filter','IPv4','concat','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','createHash','update','digest','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname'];(function(_0x2c5255,_0x4340c3){var _0x30d0ea=function(_0x131ba1){while(--_0x131ba1){_0x2c5255['push'](_0x2c5255['shift']());}};_0x30d0ea(++_0x4340c3);}(_0xb476,0x1e0));var _0x6b47=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0xb476[_0x56740a];return _0x257144;};'use strict';var _=require(_0x6b47('0x0'));var os=require('os');var crypto=require(_0x6b47('0x1'));var machine=require(_0x6b47('0x2'));var exec=require('child_process')[_0x6b47('0x3')];var config=require(_0x6b47('0x4'));function getInterfaces(){var _0x48de0b=[];var _0x2f2162=os['networkInterfaces']();var _0x5336da=_[_0x6b47('0x5')](_[_0x6b47('0x6')](_0x2f2162));for(var _0x49f90c=0x0;_0x49f90c<_0x5336da['length'];_0x49f90c++){var _0x4c76cd=_0x2f2162[_0x5336da[_0x49f90c]][_0x6b47('0x7')](function(_0x3f933c){return _0x3f933c['family']===_0x6b47('0x8')&&_0x3f933c['internal']===![];});_0x48de0b=_0x48de0b[_0x6b47('0x9')](_0x4c76cd);}return _0x48de0b;}function getFirstInterface(){var _0xfd9e83=_['head'](getInterfaces());return{'macAddress':_0xfd9e83&&_0xfd9e83['mac']?_0xfd9e83[_0x6b47('0xa')]:_0x6b47('0xb'),'ipAddress':_0xfd9e83&&_0xfd9e83[_0x6b47('0xc')]?_0xfd9e83['address']:'127.0.0.1'};}exports[_0x6b47('0xd')]=getFirstInterface;function getCPUhash(){var _0x1b7c72=_[_0x6b47('0x5')](os[_0x6b47('0xe')]()['map'](function(_0x3eeda9){return _0x3eeda9['model'];}))['join'](':');return crypto[_0x6b47('0xf')]('md5')[_0x6b47('0x10')](_0x1b7c72)[_0x6b47('0x11')]('hex');}exports['getUuid']=function(){var _0x5b4868=os[_0x6b47('0x12')]();var _0x46734c=/[0-9a-f-]{36}/;if(config[_0x6b47('0x13')]&&_0x46734c['test'](config[_0x6b47('0x13')])){return config['licenseToken'];}else if(_0x5b4868===_0x6b47('0x14')){return exec(_0x6b47('0x15'),{'encoding':_0x6b47('0x16')})['replace']('\x0d\x0a','');}else{var _0x4c8521=getFirstInterface();var _0x36b7ce=getCPUhash();var _0x74fb7=_0x36b7ce+'|'+os[_0x6b47('0x17')]()+'|'+_0x4c8521[_0x6b47('0x18')]+'|'+_0x4c8521[_0x6b47('0x19')];var _0x4adc5a=crypto['createHash']('md5')[_0x6b47('0x10')](_0x74fb7)[_0x6b47('0x11')](_0x6b47('0x1a'));return _0x4adc5a['substring'](0x0,0x8)+'-'+_0x4adc5a['substring'](0x8,0xc)+'-'+_0x4adc5a[_0x6b47('0x1b')](0xc,0x10)+'-'+_0x4adc5a[_0x6b47('0x1b')](0x10,0x14)+'-'+_0x4adc5a[_0x6b47('0x1b')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 3699338..a4621aa 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 _0xb9a6=['findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','bluebird','../../components/encryptor','../logger','license','format','%s/api/servers/%s/check?version=%s','GET','then','catch','data1','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','update','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb9a6,0xeb));var _0x6b9a=function(_0x4cd3bd,_0x6fb951){_0x4cd3bd=_0x4cd3bd-0x0;var _0x21f87b=_0xb9a6[_0x4cd3bd];return _0x21f87b;};'use strict';var util=require(_0x6b9a('0x0'));var moment=require('moment');var rp=require(_0x6b9a('0x1'));var BPromise=require(_0x6b9a('0x2'));var pkginfo=require('pkginfo')(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0x6b9a('0x3'));var hardware=require('./hardware');var logger=require(_0x6b9a('0x4'))(_0x6b9a('0x5'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x43eec9){return new BPromise(function(_0x358955,_0x4d06bd){var _0x410228=util[_0x6b9a('0x6')](_0x6b9a('0x7'),HOST,_0x43eec9,module['exports']['version']);if(oldToken){_0x410228=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x43eec9,module['exports']['version'],oldToken);}var _0x2fceeb={'uri':_0x410228,'method':_0x6b9a('0x8'),'timeout':0xea60,'json':!![]};return rp(_0x2fceeb)[_0x6b9a('0x9')](function(_0x233e73){_0x358955(_0x233e73);})[_0x6b9a('0xa')](function(_0x26d205){_0x4d06bd(_0x26d205);});});}function manageLicense(_0x58dd10,_0x590d1e){var _0xe17b2b=_0x590d1e['get']({'plain':!![]});if(!isOldTokenSent&&_0xe17b2b[_0x6b9a('0xb')]!==_0x58dd10&&!_0xe17b2b[_0x6b9a('0xc')]){oldToken=_0xe17b2b['data1'];}httpRequest(_0x58dd10)[_0x6b9a('0x9')](function(_0x8224f){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x8224f['active']){isOldTokenSent=![];if(!_0xe17b2b[_0x6b9a('0x5')]&&_0xe17b2b[_0x6b9a('0x5')]!=_0x8224f[_0x6b9a('0x5')]||_0xe17b2b[_0x6b9a('0x5')]&&_0xe17b2b[_0x6b9a('0xc')]){logger['info'](_0x6b9a('0xd'));}if(_0xe17b2b[_0x6b9a('0x5')]&&!_0xe17b2b[_0x6b9a('0xc')]&&_0xe17b2b[_0x6b9a('0x5')]!=_0x8224f[_0x6b9a('0x5')]){logger['info'](_0x6b9a('0xe'));}if(_0xe17b2b[_0x6b9a('0x5')]&&!_0xe17b2b[_0x6b9a('0xc')]&&_0xe17b2b[_0x6b9a('0x5')]==_0x8224f[_0x6b9a('0x5')]){return _0x590d1e;}return _0x590d1e['update']({'data1':_0x58dd10,'data2':null,'license':_0x8224f[_0x6b9a('0x5')]});}else{if(_0x8224f[_0x6b9a('0x5')]||_0xe17b2b[_0x6b9a('0x5')]){if(!_0xe17b2b[_0x6b9a('0xc')]){if(_0xe17b2b[_0x6b9a('0xb')]==_0x58dd10){GRAY_PERIOD_REASON='Disabled';logger[_0x6b9a('0xf')](_0x6b9a('0x10'));}else{GRAY_PERIOD_REASON='Changed';logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xe17b2b[_0x6b9a('0xb')],_0x58dd10);}logger['info'](_0x6b9a('0x11'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x6b9a('0x6')]('YYYY-MM-DD\x20HH:mm'));return _0x590d1e[_0x6b9a('0x12')]({'data2':encryptor[_0x6b9a('0x13')](moment()['format'](_0x6b9a('0x14')))});}else{if(moment()[_0x6b9a('0x15')](encryptor[_0x6b9a('0x16')](_0xe17b2b[_0x6b9a('0xc')]),'days')>DAYS){logger[_0x6b9a('0xf')](_0x6b9a('0x17'),moment()[_0x6b9a('0x6')](_0x6b9a('0x14')));isOldTokenSent=![];return _0x590d1e['update']({'data1':_0x58dd10,'data2':null,'license':null});}}}else{if(_0xe17b2b[_0x6b9a('0xb')]!=_0x58dd10){logger[_0x6b9a('0xf')](_0x6b9a('0x18'),_0xe17b2b[_0x6b9a('0xb')],_0x58dd10);return _0x590d1e[_0x6b9a('0x12')]({'data1':_0x58dd10,'data2':null,'license':null});}}}return _0x590d1e;})['then'](function(_0x2c4300){_0x590d1e=_0x2c4300;})[_0x6b9a('0xa')](function(_0x4d2145){logger[_0x6b9a('0x19')](_0x4d2145[_0x6b9a('0x1a')]);})[_0x6b9a('0x1b')](function(){setTimeout(function(){manageLicense(hardware[_0x6b9a('0x1c')](),_0x590d1e);},TIME);});}function defaultLicense(){var _0x48f6e6=hardware[_0x6b9a('0x1c')]();if(_0x48f6e6){return db['License'][_0x6b9a('0x1d')]({'where':{'id':0x1},'defaults':{'data1':_0x48f6e6}})[_0x6b9a('0x1e')](function(_0x2d36d6,_0x300e6a){logger[_0x6b9a('0xf')](_0x6b9a('0x1f'),_0x48f6e6);manageLicense(_0x48f6e6,_0x2d36d6);})['catch'](function(_0x1fdb49){logger[_0x6b9a('0x19')](_0x1fdb49[_0x6b9a('0x1a')]);});}}exports[_0x6b9a('0x20')]=defaultLicense; \ No newline at end of file +var _0x3502=['findOrCreate','spread','error','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch','get','data2','data1','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3502,0x14b));var _0x2350=function(_0xa0e317,_0xf5c888){_0xa0e317=_0xa0e317-0x0;var _0x4e6c74=_0x3502[_0xa0e317];return _0x4e6c74;};'use strict';var util=require(_0x2350('0x0'));var moment=require(_0x2350('0x1'));var rp=require(_0x2350('0x2'));var BPromise=require(_0x2350('0x3'));var pkginfo=require(_0x2350('0x4'))(module,_0x2350('0x5'));var db=require(_0x2350('0x6'))['db'];var encryptor=require(_0x2350('0x7'));var hardware=require(_0x2350('0x8'));var logger=require(_0x2350('0x9'))(_0x2350('0xa'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x134a55){return new BPromise(function(_0x59d435,_0x4f4e92){var _0x547452=util[_0x2350('0xb')](_0x2350('0xc'),HOST,_0x134a55,module[_0x2350('0xd')][_0x2350('0x5')]);if(oldToken){_0x547452=util[_0x2350('0xb')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x134a55,module[_0x2350('0xd')]['version'],oldToken);}var _0x15decf={'uri':_0x547452,'method':_0x2350('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x15decf)[_0x2350('0xf')](function(_0x2d26a2){_0x59d435(_0x2d26a2);})[_0x2350('0x10')](function(_0x16d0cb){_0x4f4e92(_0x16d0cb);});});}function manageLicense(_0xef7b4f,_0x1247c5){var _0x150382=_0x1247c5[_0x2350('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x150382['data1']!==_0xef7b4f&&!_0x150382[_0x2350('0x12')]){oldToken=_0x150382[_0x2350('0x13')];}httpRequest(_0xef7b4f)[_0x2350('0xf')](function(_0x2d7f09){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2d7f09['active']){isOldTokenSent=![];if(!_0x150382[_0x2350('0xa')]&&_0x150382['license']!=_0x2d7f09[_0x2350('0xa')]||_0x150382[_0x2350('0xa')]&&_0x150382[_0x2350('0x12')]){logger[_0x2350('0x14')](_0x2350('0x15'));}if(_0x150382[_0x2350('0xa')]&&!_0x150382[_0x2350('0x12')]&&_0x150382[_0x2350('0xa')]!=_0x2d7f09[_0x2350('0xa')]){logger[_0x2350('0x14')](_0x2350('0x16'));}if(_0x150382['license']&&!_0x150382[_0x2350('0x12')]&&_0x150382[_0x2350('0xa')]==_0x2d7f09[_0x2350('0xa')]){return _0x1247c5;}return _0x1247c5[_0x2350('0x17')]({'data1':_0xef7b4f,'data2':null,'license':_0x2d7f09[_0x2350('0xa')]});}else{if(_0x2d7f09[_0x2350('0xa')]||_0x150382[_0x2350('0xa')]){if(!_0x150382[_0x2350('0x12')]){if(_0x150382[_0x2350('0x13')]==_0xef7b4f){GRAY_PERIOD_REASON=_0x2350('0x18');logger[_0x2350('0x14')](_0x2350('0x19'));}else{GRAY_PERIOD_REASON=_0x2350('0x1a');logger['info'](_0x2350('0x1b'),_0x150382[_0x2350('0x13')],_0xef7b4f);}logger[_0x2350('0x14')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0x2350('0x1c')));return _0x1247c5[_0x2350('0x17')]({'data2':encryptor[_0x2350('0x1d')](moment()[_0x2350('0xb')](_0x2350('0x1c')))});}else{if(moment()[_0x2350('0x1e')](encryptor[_0x2350('0x1f')](_0x150382['data2']),_0x2350('0x20'))>DAYS){logger['info'](_0x2350('0x21'),moment()[_0x2350('0xb')](_0x2350('0x1c')));isOldTokenSent=![];return _0x1247c5['update']({'data1':_0xef7b4f,'data2':null,'license':null});}}}else{if(_0x150382['data1']!=_0xef7b4f){logger[_0x2350('0x14')](_0x2350('0x1b'),_0x150382[_0x2350('0x13')],_0xef7b4f);return _0x1247c5[_0x2350('0x17')]({'data1':_0xef7b4f,'data2':null,'license':null});}}}return _0x1247c5;})[_0x2350('0xf')](function(_0x5eb0f5){_0x1247c5=_0x5eb0f5;})[_0x2350('0x10')](function(_0x4a6789){logger['error'](_0x4a6789[_0x2350('0x22')]);})[_0x2350('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0x2350('0x24')](),_0x1247c5);},TIME);});}function defaultLicense(){var _0x1686f3=hardware[_0x2350('0x24')]();if(_0x1686f3){return db[_0x2350('0x25')][_0x2350('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x1686f3}})[_0x2350('0x27')](function(_0x450a34,_0xee9da7){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x1686f3);manageLicense(_0x1686f3,_0x450a34);})[_0x2350('0x10')](function(_0x41c283){logger[_0x2350('0x28')](_0x41c283['message']);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 85123e8..c034410 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 _0x2c45=['defaults','then','catch','uuid','license','isEmpty','data1','data2','split','decryptString','format','%s:%s:%s','parse','demo','gray','add','days','grayReason','message','User','sequelize','col','role','count','user','users','telephones','admin','countBy','telephone','License\x20limit\x20reached\x20for\x20telephones','exports','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find'];(function(_0x37e756,_0x12c567){var _0x580246=function(_0x11a445){while(--_0x11a445){_0x37e756['push'](_0x37e756['shift']());}};_0x580246(++_0x12c567);}(_0x2c45,0x170));var _0x52c4=function(_0x469b7d,_0x4317b0){_0x469b7d=_0x469b7d-0x0;var _0x5d4b29=_0x2c45[_0x469b7d];return _0x5d4b29;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x52c4('0x0'));var BPromise=require(_0x52c4('0x1'));var hardware=require('./hardware');var encryptor=require(_0x52c4('0x2'));var db=require(_0x52c4('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x52c4('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x52c4('0x5'),'machineUuid':hardware[_0x52c4('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x52c4('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x52c4('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x268ab1){return new BPromise(function(_0x1971bf,_0x5cabbf){return db[_0x52c4('0x8')][_0x52c4('0x9')](_[_0x52c4('0xa')](_0x268ab1,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x44afde){return checkLicense(_0x44afde,null);})[_0x52c4('0xb')](function(_0x5e4199){_0x1971bf(_0x5e4199);return;})[_0x52c4('0xc')](function(_0x446124){_0x5cabbf(_0x446124);});});}function checkLicense(_0x4874a6,_0x13979b){if(!_0x4874a6){demoLicense[_0x52c4('0xd')]=_0x4874a6['data1'];return demoLicense;}try{var _0x53422f=_0x13979b||_0x4874a6[_0x52c4('0xe')];if(_[_0x52c4('0xf')](_0x53422f)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x394cb8=_0x4874a6[_0x52c4('0x10')];var _0x339e91=_0x4874a6[_0x52c4('0x11')];var _0x35f57d=_0x394cb8[_0x52c4('0x12')]('-')[0x4];var _0x2c4fe6=_0x394cb8['split']('-')[0x0];var _0x556c0=encryptor[_0x52c4('0x13')](_0x53422f,util[_0x52c4('0x14')](_0x52c4('0x15'),_0x35f57d,_0x394cb8,_0x2c4fe6));var _0x3d100a=JSON[_0x52c4('0x16')](_0x556c0);_0x3d100a[_0x52c4('0x17')]=![];_0x3d100a['uuid']=_0x394cb8;_0x3d100a['machineUuid']=hardware['getUuid']();if(_0x339e91){var _0x2970c1=encryptor[_0x52c4('0x13')](_0x339e91);_0x3d100a[_0x52c4('0x18')]=_0x2970c1;_0x3d100a['deadline']=moment(_0x2970c1)[_0x52c4('0x19')](0x7,_0x52c4('0x1a'))[_0x52c4('0x14')]();_0x3d100a[_0x52c4('0x1b')]=_0x3d100a['uuid']!=_0x3d100a['machineUuid']?'changed':'disabled';}return _0x3d100a;}catch(_0x2ef106){breakingLicense[_0x52c4('0xd')]=_0x4874a6[_0x52c4('0x10')];breakingLicense[_0x52c4('0x1c')]=_0x2ef106[_0x52c4('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1170fe,_0x13a483){getLicense()['then'](function(_0xa8ed46){return db[_0x52c4('0x1d')]['findAll']({'attributes':['role',[db['sequelize']['fn']('COUNT',db[_0x52c4('0x1e')][_0x52c4('0x1f')](_0x52c4('0x20'))),_0x52c4('0x21')]],'group':_0x52c4('0x20'),'where':{'role':{'$or':['admin',_0x52c4('0x22'),'telephone']}},'raw':!![]})[_0x52c4('0xb')](function(_0x326ea8){var _0x287692={'user':_0xa8ed46[_0x52c4('0x23')]||0x0,'telephone':_0xa8ed46[_0x52c4('0x24')]||0x0};_0x326ea8['forEach'](function(_0xb63874){var _0x1405a9=_0xb63874[_0x52c4('0x20')]===_0x52c4('0x25')?_0x52c4('0x22'):_0xb63874[_0x52c4('0x20')];_0x287692[_0x1405a9]-=_0xb63874['count'];if(_0x287692[_0x1405a9]<0x0)_0x287692[_0x1405a9]=0x0;});_0x1170fe(_0x287692);return;});})['catch'](function(_0x24f513){_0x13a483(_0x24f513);});});}function checkUserLimits(_0x3eccf8){return new BPromise(function(_0x2abf23,_0x1a114d){getLimits()[_0x52c4('0xb')](function(_0x3b3911){var _0x5c3070=_['pick'](_[_0x52c4('0x26')](_0x3eccf8,_0x52c4('0x20')),[_0x52c4('0x25'),_0x52c4('0x22'),_0x52c4('0x27')]);var _0x85d4e3=(_0x5c3070[_0x52c4('0x25')]||0x0)+(_0x5c3070[_0x52c4('0x22')]||0x0);var _0x3628ff=_0x5c3070[_0x52c4('0x27')]||0x0;if(_0x85d4e3>_0x3b3911[_0x52c4('0x22')])return _0x1a114d('License\x20limit\x20reached\x20for\x20users');if(_0x3628ff>_0x3b3911['telephone'])return _0x1a114d(_0x52c4('0x28'));return _0x2abf23();})[_0x52c4('0xc')](function(_0x3fcea3){_0x1a114d(_0x3fcea3);});});}module[_0x52c4('0x29')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x5820=['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','Demo\x20license','License','find','defaults','then','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','split','format','%s:%s:%s','parse','demo','machineUuid','getUuid','gray','deadline','add','days','grayReason','changed','disabled','message','role','sequelize','COUNT','col','admin','user','telephone','telephones','forEach','count','pick','countBy'];(function(_0x85820c,_0x510bcd){var _0x1fa66f=function(_0x584983){while(--_0x584983){_0x85820c['push'](_0x85820c['shift']());}};_0x1fa66f(++_0x510bcd);}(_0x5820,0x123));var _0x0582=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5820[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x0582('0x0'));var _=require(_0x0582('0x1'));var moment=require(_0x0582('0x2'));var BPromise=require(_0x0582('0x3'));var hardware=require(_0x0582('0x4'));var encryptor=require(_0x0582('0x5'));var db=require(_0x0582('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0582('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x0582('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0582('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x52a823){return new BPromise(function(_0x3c1a56,_0x280523){return db[_0x0582('0x9')][_0x0582('0xa')](_[_0x0582('0xb')](_0x52a823,{'raw':!![],'where':{'id':0x1}}))[_0x0582('0xc')](function(_0x4eb5a9){return checkLicense(_0x4eb5a9,null);})['then'](function(_0x49a152){_0x3c1a56(_0x49a152);return;})['catch'](function(_0x21551f){_0x280523(_0x21551f);});});}function checkLicense(_0x290a04,_0x1d8809){if(!_0x290a04){demoLicense[_0x0582('0xd')]=_0x290a04['data1'];return demoLicense;}try{var _0x2285b0=_0x1d8809||_0x290a04[_0x0582('0xe')];if(_[_0x0582('0xf')](_0x2285b0)){throw new Error(_0x0582('0x10'));}var _0xa49099=_0x290a04[_0x0582('0x11')];var _0x8b15e=_0x290a04['data2'];var _0x579d1e=_0xa49099[_0x0582('0x12')]('-')[0x4];var _0x3b48d2=_0xa49099[_0x0582('0x12')]('-')[0x0];var _0x249dd6=encryptor['decryptString'](_0x2285b0,util[_0x0582('0x13')](_0x0582('0x14'),_0x579d1e,_0xa49099,_0x3b48d2));var _0x4d2add=JSON[_0x0582('0x15')](_0x249dd6);_0x4d2add[_0x0582('0x16')]=![];_0x4d2add['uuid']=_0xa49099;_0x4d2add[_0x0582('0x17')]=hardware[_0x0582('0x18')]();if(_0x8b15e){var _0x55838d=encryptor['decryptString'](_0x8b15e);_0x4d2add[_0x0582('0x19')]=_0x55838d;_0x4d2add[_0x0582('0x1a')]=moment(_0x55838d)[_0x0582('0x1b')](0x7,_0x0582('0x1c'))[_0x0582('0x13')]();_0x4d2add[_0x0582('0x1d')]=_0x4d2add[_0x0582('0xd')]!=_0x4d2add[_0x0582('0x17')]?_0x0582('0x1e'):_0x0582('0x1f');}return _0x4d2add;}catch(_0x4d5d7d){breakingLicense[_0x0582('0xd')]=_0x290a04['data1'];breakingLicense['message']=_0x4d5d7d[_0x0582('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x34f3dc,_0x1cbb81){getLicense()[_0x0582('0xc')](function(_0x20fc43){return db['User']['findAll']({'attributes':[_0x0582('0x21'),[db[_0x0582('0x22')]['fn'](_0x0582('0x23'),db['sequelize'][_0x0582('0x24')]('role')),'count']],'group':_0x0582('0x21'),'where':{'role':{'$or':[_0x0582('0x25'),_0x0582('0x26'),_0x0582('0x27')]}},'raw':!![]})[_0x0582('0xc')](function(_0x1e9fef){var _0x41f2e2={'user':_0x20fc43['users']||0x0,'telephone':_0x20fc43[_0x0582('0x28')]||0x0};_0x1e9fef[_0x0582('0x29')](function(_0x126642){var _0x49e10e=_0x126642[_0x0582('0x21')]==='admin'?_0x0582('0x26'):_0x126642[_0x0582('0x21')];_0x41f2e2[_0x49e10e]-=_0x126642[_0x0582('0x2a')];if(_0x41f2e2[_0x49e10e]<0x0)_0x41f2e2[_0x49e10e]=0x0;});_0x34f3dc(_0x41f2e2);return;});})['catch'](function(_0x222f5d){_0x1cbb81(_0x222f5d);});});}function checkUserLimits(_0x1aad82){return new BPromise(function(_0x5565b2,_0x5325d5){getLimits()['then'](function(_0x432fde){var _0x4aa906=_[_0x0582('0x2b')](_[_0x0582('0x2c')](_0x1aad82,_0x0582('0x21')),[_0x0582('0x25'),_0x0582('0x26'),_0x0582('0x27')]);var _0x4f026d=(_0x4aa906[_0x0582('0x25')]||0x0)+(_0x4aa906['user']||0x0);var _0x51c96a=_0x4aa906[_0x0582('0x27')]||0x0;if(_0x4f026d>_0x432fde[_0x0582('0x26')])return _0x5325d5(_0x0582('0x2d'));if(_0x51c96a>_0x432fde[_0x0582('0x27')])return _0x5325d5(_0x0582('0x2e'));return _0x5565b2();})['catch'](function(_0x54a681){_0x5325d5(_0x54a681);});});}module[_0x0582('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index dc089ae..33be0d6 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 _0x0120=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x33b8a2,_0x322541){var _0x197962=function(_0x51b00c){while(--_0x51b00c){_0x33b8a2['push'](_0x33b8a2['shift']());}};_0x197962(++_0x322541);}(_0x0120,0x6f));var _0x0012=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0120[_0x2f5ac5];return _0x37c9a8;};'use strict';module[_0x0012('0x0')]={'DOMAIN':_0x0012('0x1'),'SESSION_SECRET':_0x0012('0x2'),'GOOGLE_ID':_0x0012('0x3'),'GOOGLE_SECRET':_0x0012('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x757a=['http://localhost:9000','myappanuglar-secret'];(function(_0x3b899f,_0x2e8183){var _0x497ce2=function(_0x39bca7){while(--_0x39bca7){_0x3b899f['push'](_0x3b899f['shift']());}};_0x497ce2(++_0x2e8183);}(_0x757a,0xde));var _0xa757=function(_0x2ea457,_0x29d92){_0x2ea457=_0x2ea457-0x0;var _0x3386c7=_0x757a[_0x2ea457];return _0x3386c7;};'use strict';module['exports']={'DOMAIN':_0xa757('0x0'),'SESSION_SECRET':_0xa757('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 2bb78ee..80cd5be 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0c1=['exports','../utils/loggers','fileLogger'];(function(_0x42421e,_0x5277af){var _0xaba31b=function(_0x4ebc50){while(--_0x4ebc50){_0x42421e['push'](_0x42421e['shift']());}};_0xaba31b(++_0x5277af);}(_0xe0c1,0x18d));var _0x1e0c=function(_0x207086,_0x5f4c95){_0x207086=_0x207086-0x0;var _0x299245=_0xe0c1[_0x207086];return _0x299245;};'use strict';var fileLogger=require(_0x1e0c('0x0'))[_0x1e0c('0x1')];module[_0x1e0c('0x2')]=fileLogger; \ No newline at end of file +var _0xdbd5=['exports','../utils/loggers','fileLogger'];(function(_0x2bf798,_0x1be61a){var _0x4d28cc=function(_0x50134e){while(--_0x50134e){_0x2bf798['push'](_0x2bf798['shift']());}};_0x4d28cc(++_0x1be61a);}(_0xdbd5,0x148));var _0x5dbd=function(_0x3042c5,_0x36cb88){_0x3042c5=_0x3042c5-0x0;var _0x7cd140=_0xdbd5[_0x3042c5];return _0x7cd140;};'use strict';var fileLogger=require(_0x5dbd('0x0'))[_0x5dbd('0x1')];module[_0x5dbd('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index f6c881d..b0946ce 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 _0x1b9e=['../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','resolve','join','legacy-libs','express','../../services/express/index.js'];(function(_0x1676df,_0x1a2e15){var _0x4b8925=function(_0x2b4d5c){while(--_0x2b4d5c){_0x1676df['push'](_0x1676df['shift']());}};_0x4b8925(++_0x1a2e15);}(_0x1b9e,0x116));var _0xe1b9=function(_0x131dd3,_0x59ac65){_0x131dd3=_0x131dd3-0x0;var _0x3de6c2=_0x1b9e[_0x131dd3];return _0x3de6c2;};'use strict';var path=require(_0xe1b9('0x0'));var cfg=require(_0xe1b9('0x1'));var env={'NODE_PATH':path[_0xe1b9('0x2')](path[_0xe1b9('0x3')](cfg['root'],_0xe1b9('0x4')))};var pm2config={'apps':[{'name':_0xe1b9('0x5'),'script':path[_0xe1b9('0x3')](__dirname,_0xe1b9('0x6')),'env':env},{'name':'ami','script':path[_0xe1b9('0x3')](__dirname,_0xe1b9('0x7')),'env':env},{'name':'agi','script':path[_0xe1b9('0x3')](__dirname,_0xe1b9('0x8')),'env':env},{'name':_0xe1b9('0x9'),'script':path[_0xe1b9('0x3')](__dirname,_0xe1b9('0xa')),'env':env},{'name':'routing','script':path[_0xe1b9('0x3')](__dirname,_0xe1b9('0xb')),'env':env},{'name':_0xe1b9('0xc'),'script':path['join'](__dirname,_0xe1b9('0xd')),'env':env}]};module[_0xe1b9('0xe')]=pm2config; \ No newline at end of file +var _0x7bf9=['routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','root','express','join','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js'];(function(_0x304fdd,_0x442820){var _0x111e8c=function(_0x44924c){while(--_0x44924c){_0x304fdd['push'](_0x304fdd['shift']());}};_0x111e8c(++_0x442820);}(_0x7bf9,0x145));var _0x97bf=function(_0x30e5b8,_0x915bbe){_0x30e5b8=_0x30e5b8-0x0;var _0x228816=_0x7bf9[_0x30e5b8];return _0x228816;};'use strict';var path=require(_0x97bf('0x0'));var cfg=require(_0x97bf('0x1'));var env={'NODE_PATH':path['resolve'](path['join'](cfg[_0x97bf('0x2')],'legacy-libs'))};var pm2config={'apps':[{'name':_0x97bf('0x3'),'script':path[_0x97bf('0x4')](__dirname,_0x97bf('0x5')),'env':env},{'name':_0x97bf('0x6'),'script':path[_0x97bf('0x4')](__dirname,_0x97bf('0x7')),'env':env},{'name':'agi','script':path[_0x97bf('0x4')](__dirname,_0x97bf('0x8')),'env':env},{'name':_0x97bf('0x9'),'script':path[_0x97bf('0x4')](__dirname,_0x97bf('0xa')),'env':env},{'name':_0x97bf('0xb'),'script':path[_0x97bf('0x4')](__dirname,_0x97bf('0xc')),'env':env},{'name':_0x97bf('0xd'),'script':path[_0x97bf('0x4')](__dirname,_0x97bf('0xe')),'env':env}]};module[_0x97bf('0xf')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index c6ca3b8..4273d9a 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 _0x81e7=['./config','connect','connected','start','then','stop','disconnect','restart','list','delete','dump','saved'];(function(_0x20f337,_0x11f062){var _0x5a25d0=function(_0x5eec4a){while(--_0x5eec4a){_0x20f337['push'](_0x20f337['shift']());}};_0x5a25d0(++_0x11f062);}(_0x81e7,0x138));var _0x781e=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x81e7[_0x178e48];return _0x440d7e;};'use strict';var pm2=require('pm2');var BPromise=require('bluebird');var config=require(_0x781e('0x0'));function connect(){return new BPromise(function(_0x2b5dc8,_0x1a491f){return pm2[_0x781e('0x1')](function(_0x151df8){if(_0x151df8){return _0x1a491f(_0x151df8);}return _0x2b5dc8(_0x781e('0x2'));});});};exports[_0x781e('0x3')]=function(_0x18187f){return connect()[_0x781e('0x4')](function(){return new BPromise(function(_0x2ed200,_0x419945){return pm2[_0x781e('0x3')](_0x18187f,function(_0x8c32b9,_0x41ea12){if(_0x8c32b9){return _0x419945(_0x8c32b9);}pm2['disconnect']();return _0x2ed200(_0x41ea12);});});});};exports['stop']=function(_0x14094c){return connect()[_0x781e('0x4')](function(){return new BPromise(function(_0x57c939,_0x2e4216){return pm2[_0x781e('0x5')](_0x14094c,function(_0x13ea0f,_0x1f7529){if(_0x13ea0f){return _0x2e4216(_0x13ea0f);}pm2[_0x781e('0x6')]();return _0x57c939(_0x1f7529);});});});};exports[_0x781e('0x7')]=function(_0x313ec3){return connect()['then'](function(){return new BPromise(function(_0x3510f3,_0x908018){return pm2[_0x781e('0x7')](_0x313ec3,function(_0x135c5c,_0xb8ba03){if(_0x135c5c){return _0x908018(_0x135c5c);}pm2[_0x781e('0x6')]();return _0x3510f3(_0xb8ba03);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x569b28,_0x232be8){return pm2[_0x781e('0x8')](function(_0x563926,_0x16be48){if(_0x563926){return _0x232be8(_0x563926);}pm2['disconnect']();return _0x569b28(_0x16be48);});});});};exports['describe']=function(_0x4749d3){return connect()[_0x781e('0x4')](function(){return new BPromise(function(_0x111497,_0x400588){return pm2['describe'](_0x4749d3,function(_0x8c12da,_0x583e6f){if(_0x8c12da){return _0x400588(_0x8c12da);}pm2[_0x781e('0x6')]();return _0x111497(_0x583e6f);});});});};exports[_0x781e('0x9')]=function(_0x6ef07d){return connect()['then'](function(){return new BPromise(function(_0x3fffcd,_0x5b6439){return pm2['delete'](_0x6ef07d,function(_0x4e0a2b,_0x4ab9f2){if(_0x4e0a2b){return _0x5b6439(_0x4e0a2b);}pm2[_0x781e('0x6')]();return _0x3fffcd(_0x4ab9f2);});});});};exports[_0x781e('0xa')]=function(){return connect()[_0x781e('0x4')](function(){return new BPromise(function(_0x2e963c,_0x14ff5a){return pm2[_0x781e('0xa')](function(_0x485768){if(_0x485768){return _0x14ff5a(_0x485768);}return _0x2e963c(_0x781e('0xb'));});});});}; \ No newline at end of file +var _0xfc03=['saved','pm2','bluebird','./config','connected','start','then','stop','restart','disconnect','list','describe','delete','dump'];(function(_0x67c931,_0x19ce0d){var _0x16063e=function(_0x1247da){while(--_0x1247da){_0x67c931['push'](_0x67c931['shift']());}};_0x16063e(++_0x19ce0d);}(_0xfc03,0xc5));var _0x3fc0=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xfc03[_0x82129b];return _0x2ae5dc;};'use strict';var pm2=require(_0x3fc0('0x0'));var BPromise=require(_0x3fc0('0x1'));var config=require(_0x3fc0('0x2'));function connect(){return new BPromise(function(_0x57186e,_0x5aeab7){return pm2['connect'](function(_0x31dd80){if(_0x31dd80){return _0x5aeab7(_0x31dd80);}return _0x57186e(_0x3fc0('0x3'));});});};exports[_0x3fc0('0x4')]=function(_0xedc06c){return connect()[_0x3fc0('0x5')](function(){return new BPromise(function(_0x8dfbbf,_0x204155){return pm2[_0x3fc0('0x4')](_0xedc06c,function(_0x1e8867,_0xb8d52){if(_0x1e8867){return _0x204155(_0x1e8867);}pm2['disconnect']();return _0x8dfbbf(_0xb8d52);});});});};exports[_0x3fc0('0x6')]=function(_0x5e8751){return connect()[_0x3fc0('0x5')](function(){return new BPromise(function(_0x308b1a,_0x289b52){return pm2['stop'](_0x5e8751,function(_0x659381,_0x46f011){if(_0x659381){return _0x289b52(_0x659381);}pm2['disconnect']();return _0x308b1a(_0x46f011);});});});};exports['restart']=function(_0x102eba){return connect()[_0x3fc0('0x5')](function(){return new BPromise(function(_0x3cdf44,_0x43ac48){return pm2[_0x3fc0('0x7')](_0x102eba,function(_0x472fe4,_0x1d5433){if(_0x472fe4){return _0x43ac48(_0x472fe4);}pm2[_0x3fc0('0x8')]();return _0x3cdf44(_0x1d5433);});});});};exports[_0x3fc0('0x9')]=function(){return connect()[_0x3fc0('0x5')](function(){return new BPromise(function(_0x2385e2,_0x73d98f){return pm2[_0x3fc0('0x9')](function(_0x548251,_0x1de939){if(_0x548251){return _0x73d98f(_0x548251);}pm2[_0x3fc0('0x8')]();return _0x2385e2(_0x1de939);});});});};exports[_0x3fc0('0xa')]=function(_0x3c4178){return connect()[_0x3fc0('0x5')](function(){return new BPromise(function(_0x389a0a,_0x4eff0f){return pm2[_0x3fc0('0xa')](_0x3c4178,function(_0x5024be,_0x5635f9){if(_0x5024be){return _0x4eff0f(_0x5024be);}pm2[_0x3fc0('0x8')]();return _0x389a0a(_0x5635f9);});});});};exports['delete']=function(_0x2604f1){return connect()[_0x3fc0('0x5')](function(){return new BPromise(function(_0x165860,_0x1c9425){return pm2[_0x3fc0('0xb')](_0x2604f1,function(_0x3c86d9,_0x177637){if(_0x3c86d9){return _0x1c9425(_0x3c86d9);}pm2['disconnect']();return _0x165860(_0x177637);});});});};exports[_0x3fc0('0xc')]=function(){return connect()[_0x3fc0('0x5')](function(){return new BPromise(function(_0x2178b1,_0x3f10b7){return pm2[_0x3fc0('0xc')](function(_0x1ad78c){if(_0x1ad78c){return _0x3f10b7(_0x1ad78c);}return _0x2178b1(_0x3fc0('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index bbd7b96..7458e2b 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 _0x6296=['start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','inspect'];(function(_0x32f26d,_0x2c0b5d){var _0x5d9ddc=function(_0x1f0e26){while(--_0x1f0e26){_0x32f26d['push'](_0x32f26d['shift']());}};_0x5d9ddc(++_0x2c0b5d);}(_0x6296,0x177));var _0x6629=function(_0x14757b,_0x193ae9){_0x14757b=_0x14757b-0x0;var _0x1181fe=_0x6296[_0x14757b];return _0x1181fe;};'use strict';var _=require(_0x6629('0x0'));var moment=require(_0x6629('0x1'));var Redis=require(_0x6629('0x2'));var util=require(_0x6629('0x3'));var config=require(_0x6629('0x4'));var db=require(_0x6629('0x5'))['db'];var logger=require(_0x6629('0x6'))(_0x6629('0x7'));config['redis']=_[_0x6629('0x8')](config[_0x6629('0x9')],{'host':_0x6629('0xa'),'port':0x18eb});var io=require(_0x6629('0xb'))(new Redis(config[_0x6629('0x9')]));function closeInteractions(){var _0x150f08=0x0;var _0x30b2b7=[];return db[_0x6629('0xc')][_0x6629('0xd')]({'raw':!![],'attributes':['id',_0x6629('0xe')],'where':{'id':0x1}})[_0x6629('0xf')](function(_0x2f9a38){_0x150f08=_0x2f9a38['chatTimeout'];if(_0x150f08){return db[_0x6629('0x10')][_0x6629('0x11')]({'raw':!![],'attributes':['id',_0x6629('0x12')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6629('0x13')](_0x2f9a38[_0x6629('0xe')],_0x6629('0x14'))}}});}else{return[];}})['then'](function(_0x13f815){if(_0x13f815&&_0x13f815[_0x6629('0x15')]){_0x30b2b7=_[_0x6629('0x16')](_0x13f815||[],'id');logger['info'](_0x6629('0x17'),_0x30b2b7[_0x6629('0x18')]());return db[_0x6629('0x10')][_0x6629('0x19')]({'closeReason':_0x6629('0x1a'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x6629('0x1b')](_0x6629('0x1c'))},{'where':{'id':_0x30b2b7}});}})[_0x6629('0xf')](function(){if(_0x30b2b7&&_0x30b2b7[_0x6629('0x15')]){logger[_0x6629('0x1d')](_0x6629('0x1e'),_0x30b2b7['join']());for(var _0x5d6403=0x0;_0x5d6403<_0x30b2b7['length'];_0x5d6403++){io['emit'](_0x6629('0x1f'),{'id':_0x30b2b7[_0x5d6403],'closed':!![]});}}})['catch'](function(_0x596d59){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x596d59?util[_0x6629('0x20')](_0x596d59,{'showHidden':![],'depth':null}):'');});}exports[_0x6629('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa278=['lastMsgAt','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','length','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../logger','redis','defaults','socket.io-emitter','Setting','find','chatTimeout','then'];(function(_0x35f190,_0x38b1c7){var _0x104c77=function(_0x37c39d){while(--_0x37c39d){_0x35f190['push'](_0x35f190['shift']());}};_0x104c77(++_0x38b1c7);}(_0xa278,0x14a));var _0x8a27=function(_0x4474c2,_0x59cf02){_0x4474c2=_0x4474c2-0x0;var _0x435fbb=_0xa278[_0x4474c2];return _0x435fbb;};'use strict';var _=require(_0x8a27('0x0'));var moment=require('moment');var Redis=require(_0x8a27('0x1'));var util=require(_0x8a27('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x8a27('0x3'))('schedule');config[_0x8a27('0x4')]=_[_0x8a27('0x5')](config[_0x8a27('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x8a27('0x6'))(new Redis(config[_0x8a27('0x4')]));function closeInteractions(){var _0xce4d9b=0x0;var _0x332be1=[];return db[_0x8a27('0x7')][_0x8a27('0x8')]({'raw':!![],'attributes':['id',_0x8a27('0x9')],'where':{'id':0x1}})[_0x8a27('0xa')](function(_0x7d1115){_0xce4d9b=_0x7d1115['chatTimeout'];if(_0xce4d9b){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id',_0x8a27('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x7d1115[_0x8a27('0x9')],_0x8a27('0xc'))}}});}else{return[];}})[_0x8a27('0xa')](function(_0x5801f6){if(_0x5801f6&&_0x5801f6['length']){_0x332be1=_[_0x8a27('0xd')](_0x5801f6||[],'id');logger[_0x8a27('0xe')](_0x8a27('0xf'),_0x332be1[_0x8a27('0x10')]());return db[_0x8a27('0x11')]['update']({'closeReason':_0x8a27('0x12'),'disposition':_0x8a27('0x13'),'closed':!![],'closedAt':moment()[_0x8a27('0x14')](_0x8a27('0x15'))},{'where':{'id':_0x332be1}});}})[_0x8a27('0xa')](function(){if(_0x332be1&&_0x332be1['length']){logger[_0x8a27('0xe')](_0x8a27('0x16'),_0x332be1[_0x8a27('0x10')]());for(var _0x50fd04=0x0;_0x50fd04<_0x332be1[_0x8a27('0x17')];_0x50fd04++){io[_0x8a27('0x18')](_0x8a27('0x19'),{'id':_0x332be1[_0x50fd04],'closed':!![]});}}})[_0x8a27('0x1a')](function(_0x3fd4d3){logger[_0x8a27('0x1b')](_0x8a27('0x1c'),_0x3fd4d3?util[_0x8a27('0x1d')](_0x3fd4d3,{'showHidden':![],'depth':null}):'');});}exports[_0x8a27('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 89a763b..6e8588b 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 _0x6543=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x4f9631,_0x2084a7){var _0x12419e=function(_0x4c8f9d){while(--_0x4c8f9d){_0x4f9631['push'](_0x4f9631['shift']());}};_0x12419e(++_0x2084a7);}(_0x6543,0x15b));var _0x3654=function(_0x2a9616,_0x8a875f){_0x2a9616=_0x2a9616-0x0;var _0x5d6399=_0x6543[_0x2a9616];return _0x5d6399;};'use strict';function start(){var _0x88138e=require(_0x3654('0x0'));return _0x88138e[_0x3654('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0xce22=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x3c4603,_0x2d64c8){var _0x48de4b=function(_0x34ab7b){while(--_0x34ab7b){_0x3c4603['push'](_0x3c4603['shift']());}};_0x48de4b(++_0x2d64c8);}(_0xce22,0x99));var _0x2ce2=function(_0x5e8295,_0x4fcee0){_0x5e8295=_0x5e8295-0x0;var _0x2b08aa=_0xce22[_0x5e8295];return _0x2b08aa;};'use strict';function start(){var _0x163954=require(_0x2ce2('0x0'));return _0x163954['startAllRefreshIntervals']();}module[_0x2ce2('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 141a51b..a325d16 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 _0xb674=['add','start','add\x20cron','deleteJob','stop\x20cron','run','util','lodash','moment','cron-job-manager','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','number','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','basename','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Failed','[handleSendEmail]\x20Unrecognized\x20status:','request','error\x20mail','stringify','email\x20sent','currentAttempt','retries','data','operation','stop','retry','case\x20completed','job','case\x20empty','entity','dataValues','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','sendMail','isNil','subtractNumber','subtract','YYYY-MM-DD\x20HH:mm:ss','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','CloudProvider','jobs','toString','difference','intersection','length','exists','delete\x20cron','toRun','resolve','cron','active','isBetween','startAt','endAt'];(function(_0x19411e,_0x9c719d){var _0x3bbccb=function(_0x556fa6){while(--_0x556fa6){_0x19411e['push'](_0x19411e['shift']());}};_0x3bbccb(++_0x9c719d);}(_0xb674,0x12c));var _0x4b67=function(_0x5c8351,_0x9e1963){_0x5c8351=_0x5c8351-0x0;var _0x20971a=_0xb674[_0x5c8351];return _0x20971a;};'use strict';var fs=require('fs');var util=require(_0x4b67('0x0'));var path=require('path');var _=require(_0x4b67('0x1'));var moment=require(_0x4b67('0x2'));var CronJobManager=require(_0x4b67('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x4b67('0x4'));var logger=require(_0x4b67('0x5'))('schedule');var db=require(_0x4b67('0x6'))['db'];const retry=require('retry');var analyticCustomReportController=require(_0x4b67('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x4b67('0x8')][_0x4b67('0x9')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x3adf7d){const _0x1425ed={};if(typeof _0x3adf7d===_0x4b67('0xa')){_0x1425ed['id']=_0x3adf7d;}return db['AnalyticExtractedReport']['findOne']({'where':_0x1425ed})[_0x4b67('0xb')](function(_0xae3423){return _0xae3423;})[_0x4b67('0xc')](function(_0x234761){logger[_0x4b67('0xd')](_0x234761);});}function handleSendEmail(_0x2934c1,_0x44d70c){logger[_0x4b67('0xe')](_0x4b67('0xf'),_0x2934c1[_0x4b67('0x10')]);var _0x300b3a=!![];var _0x5ca65=_0x2934c1[_0x4b67('0x11')][_0x4b67('0x12')]();var _0x373717={'account':_0x5ca65,'message':{'from':util[_0x4b67('0x13')](_0x4b67('0x14'),_0x2934c1[_0x4b67('0x11')][_0x4b67('0x15')],_0x2934c1[_0x4b67('0x11')]['email']||_0x2934c1['MailAccount'][_0x4b67('0x16')][_0x4b67('0x17')]),'to':_0x2934c1[_0x4b67('0x10')],'cc':_0x2934c1['cc'],'bcc':_0x2934c1[_0x4b67('0x18')],'subject':util[_0x4b67('0x13')](_0x4b67('0x19'),_0x44d70c['name'],_0x2934c1['subtractNumber'],_0x2934c1[_0x4b67('0x1a')])}};var _0x458226=path[_0x4b67('0x1b')](__dirname,_0x4b67('0x1c'));var _0x2afecc=_0x44d70c[_0x4b67('0x1d')];var _0x264595=util[_0x4b67('0x13')]('%s.%s',path[_0x4b67('0x1e')](_0x44d70c[_0x4b67('0x1d')],path['extname'](_0x44d70c[_0x4b67('0x1d')])),'zip');var _0x114f9c=path[_0x4b67('0x1b')](_0x458226,_0x2afecc);var _0x15f01f=path[_0x4b67('0x1b')](_0x458226,_0x264595);if(fs[_0x4b67('0x1f')](_0x114f9c)){_0x44d70c[_0x4b67('0x20')]=_0x4b67('0x21');_0x373717[_0x4b67('0x22')][_0x4b67('0x23')]=[{'filename':_0x2afecc,'path':_0x114f9c}];_0x373717[_0x4b67('0x22')][_0x4b67('0x24')]=util['format'](_0x4b67('0x25'),JSON['stringify'](_0x44d70c,null,0x2));}else if(fs[_0x4b67('0x1f')](_0x15f01f)){_0x44d70c[_0x4b67('0x20')]=_0x4b67('0x21');_0x373717[_0x4b67('0x22')][_0x4b67('0x23')]=[{'filename':_0x264595,'path':_0x15f01f}];}else{if(_0x44d70c['status']==='Empty'){_0x373717[_0x4b67('0x22')][_0x4b67('0x24')]=_0x4b67('0x26');if(!_0x2934c1[_0x4b67('0x27')]){_0x300b3a=![];logger[_0x4b67('0xe')](_0x4b67('0x28'));}}else if(_0x44d70c['status']===_0x4b67('0x29')){_0x373717[_0x4b67('0x22')][_0x4b67('0x24')]=_0x4b67('0x2a');}else if(_0x44d70c['status']===_0x4b67('0x2b')){_0x373717[_0x4b67('0x22')][_0x4b67('0x24')]='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x44d70c[_0x4b67('0x20')]===_0x4b67('0x2c')){_0x373717['message']['text']='Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else{logger[_0x4b67('0xd')](_0x4b67('0x2d'),_0x44d70c['status']);}}if(_0x300b3a){return client[_0x4b67('0x2e')]('SendMail',_0x373717)[_0x4b67('0xb')](function(_0x51dec6){if(_0x51dec6[_0x4b67('0xd')]){return logger[_0x4b67('0xd')](_0x4b67('0x2f'),JSON[_0x4b67('0x30')](_0x51dec6));}return logger[_0x4b67('0xe')](_0x4b67('0x31'));})['catch'](function(_0x6bb3df){return logger[_0x4b67('0xd')](_0x4b67('0x2f'),JSON[_0x4b67('0x30')](_0x6bb3df));});}}function handleError(){return function(_0x3b0fb7){return logger[_0x4b67('0xd')](JSON[_0x4b67('0x30')](_0x3b0fb7));};}function loading(_0x37e243){logger[_0x4b67('0xe')]('case\x20loading');if(_0x37e243[_0x4b67('0x32')]===_0x37e243['retryOptions'][_0x4b67('0x33')]){handleSendEmail(_0x37e243['job'],_0x37e243[_0x4b67('0x34')]);_0x37e243[_0x4b67('0x35')][_0x4b67('0x36')]();}else{_0x37e243[_0x4b67('0x35')][_0x4b67('0x37')]('still\x20loading');}}function completed(_0x434f6c){logger['info'](_0x4b67('0x38'));handleSendEmail(_0x434f6c[_0x4b67('0x39')],_0x434f6c[_0x4b67('0x34')]);_0x434f6c[_0x4b67('0x35')]['stop']();}function empty(_0x3c859b){logger['info'](_0x4b67('0x3a'));handleSendEmail(_0x3c859b[_0x4b67('0x39')],_0x3c859b[_0x4b67('0x34')]);_0x3c859b['operation']['stop']();}function failed(_0x57d0c9){logger[_0x4b67('0xe')]('case\x20failed');handleSendEmail(_0x57d0c9['job'],_0x57d0c9['data']);_0x57d0c9[_0x4b67('0x35')][_0x4b67('0x36')]();}function urecognized(_0x22eee4){logger['error']('Unrecognized\x20status:',_0x22eee4[_0x4b67('0x3b')][_0x4b67('0x3c')][_0x4b67('0x20')]);_0x22eee4[_0x4b67('0x35')][_0x4b67('0x36')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x1df907,_0x1adfe6){const _0x4416cb={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x5851b9=retry[_0x4b67('0x35')](_0x4416cb);_0x5851b9['attempt'](_0x4023fe=>{logger['info'](_0x4b67('0x3d')+_0x1df907['id']+_0x4b67('0x3e')+_0x4023fe);try{getReportData(_0x1adfe6['id'])[_0x4b67('0xb')](function(_0x13443d){_0x1adfe6=_0x13443d;logger[_0x4b67('0xe')](_0x4b67('0x3f'),_0x13443d['dataValues'][_0x4b67('0x20')]);if(!reportStatusStrategies[_0x13443d[_0x4b67('0x3c')][_0x4b67('0x20')]]){logger[_0x4b67('0xd')](_0x4b67('0x3f'),_0x13443d[_0x4b67('0x3c')][_0x4b67('0x20')]);_0x5851b9[_0x4b67('0x37')]();}reportStatusStrategies[_0x13443d[_0x4b67('0x3c')][_0x4b67('0x20')]]({'operation':_0x5851b9,'currentAttempt':_0x4023fe,'retryOptions':_0x4416cb,'job':_0x1df907,'data':_0x1adfe6,'entity':_0x13443d});});}catch(_0x2798d8){_0x5851b9[_0x4b67('0x37')](_0x2798d8);}});}function handleResult(_0x5d6320){return function(_0x10e63d){if(_0x5d6320[_0x4b67('0x40')]&&_0x5d6320[_0x4b67('0x11')]&&_0x5d6320['MailAccount']['Smtp']&&!_[_0x4b67('0x41')](_0x5d6320['email'])){retryer(_0x5d6320,_0x10e63d);}};}function handleJob(_0x588407){return function(){try{if(_[_0x4b67('0x41')](_0x588407[_0x4b67('0x42')])){return logger[_0x4b67('0xe')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x4b67('0x41')](_0x588407[_0x4b67('0x1a')])){return logger[_0x4b67('0xe')]('subtractUnit\x20null\x20or\x20undefined');}var _0x3194b5={'startDate':moment()[_0x4b67('0x43')](_0x588407[_0x4b67('0x42')],_0x588407[_0x4b67('0x1a')])[_0x4b67('0x13')](_0x4b67('0x44')),'endDate':moment()[_0x4b67('0x13')](_0x4b67('0x44')),'type':'scheduled','output':_0x588407[_0x4b67('0x45')],'name':_0x588407[_0x4b67('0x15')]};if(!_[_0x4b67('0x41')](_0x588407['DefaultReportId'])){logger[_0x4b67('0xe')](_0x4b67('0x46'),_0x588407[_0x4b67('0x47')]);return analyticDefaultReportController['runReport']({'id':_0x588407[_0x4b67('0x47')]},_0x3194b5)[_0x4b67('0xb')](handleResult(_0x588407))[_0x4b67('0xc')](handleError());}if(!_[_0x4b67('0x41')](_0x588407[_0x4b67('0x48')])){logger[_0x4b67('0xe')](_0x4b67('0x49'),_0x588407['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x588407[_0x4b67('0x48')]},_0x3194b5)[_0x4b67('0xb')](handleResult(_0x588407))['catch'](handleError());}}catch(_0x232e74){logger[_0x4b67('0xd')](JSON[_0x4b67('0x30')](_0x232e74));}return logger['info'](_0x4b67('0x4a'));};}function getJobs(_0x502cae){var _0x187a51={};if(_0x502cae){_0x187a51['id']=_0x502cae;}return db[_0x4b67('0x4b')][_0x4b67('0x4c')]({'where':_0x187a51,'include':[{'model':db[_0x4b67('0x11')],'attributes':['id','name',_0x4b67('0x10')],'include':[{'model':db['MailServerOut'],'as':_0x4b67('0x16'),'include':[{'model':db[_0x4b67('0x4d')],'as':'CloudProvider'}]}]}]})[_0x4b67('0xb')](function(_0x3319fd){var _0x22f6d8=_['keys'](manager[_0x4b67('0x4e')]);var _0x73cf61=_['map'](_0x3319fd,function(_0x252943){return _0x252943['id']['toString']();});var _0x21ce01=_['keyBy'](_0x3319fd,function(_0x1868d4){return _0x1868d4['id'][_0x4b67('0x4f')]();});var _0x427bfa=_0x502cae?_0x73cf61:_[_0x4b67('0x50')](_0x73cf61,_0x22f6d8);var _0x43adc2=_[_0x4b67('0x51')](_0x73cf61,_0x22f6d8);var _0x1b9271=_[_0x4b67('0x50')](_0x22f6d8,_0x73cf61);var _0x5777d1;var _0x294428;for(_0x5777d1=0x0;_0x5777d1<_0x1b9271[_0x4b67('0x52')]&&!_0x502cae;_0x5777d1+=0x1){_0x294428=_0x1b9271[_0x5777d1][_0x4b67('0x4f')]();if(manager[_0x4b67('0x53')](_0x294428)){manager[_0x4b67('0x36')](_0x294428);manager['deleteJob'](_0x294428);logger['info'](_0x4b67('0x54'),_0x294428);}}logger[_0x4b67('0xe')](_0x4b67('0x55'),JSON['stringify'](_0x427bfa));for(_0x5777d1=0x0;_0x5777d1<_0x427bfa[_0x4b67('0x52')];_0x5777d1+=0x1){_0x294428=_0x427bfa[_0x5777d1][_0x4b67('0x4f')]();if(_0x502cae){logger[_0x4b67('0xe')](JSON[_0x4b67('0x30')](_0x21ce01[_0x294428]));BPromise[_0x4b67('0x56')]()[_0x4b67('0xb')](handleJob(_0x21ce01[_0x294428]));logger[_0x4b67('0xe')]('run\x20job',_0x21ce01[_0x294428][_0x4b67('0x15')],_0x21ce01[_0x294428][_0x4b67('0x57')]);}else if(_0x21ce01[_0x294428][_0x4b67('0x57')]&&_0x21ce01[_0x294428][_0x4b67('0x58')]&&moment()[_0x4b67('0x59')](_0x21ce01[_0x294428][_0x4b67('0x5a')],_0x21ce01[_0x294428][_0x4b67('0x5b')])){manager[_0x4b67('0x5c')](_0x294428,_0x21ce01[_0x294428][_0x4b67('0x57')],handleJob(_0x21ce01[_0x294428]));manager[_0x4b67('0x5d')](_0x294428);logger[_0x4b67('0xe')](_0x4b67('0x5e'),_0x21ce01[_0x294428][_0x4b67('0x15')],_0x21ce01[_0x294428]['cron']);}else if(manager['exists'](_0x294428)){manager['stop'](_0x294428);manager['deleteJob'](_0x294428);logger[_0x4b67('0xe')]('stop\x20cron',_0x21ce01[_0x294428][_0x4b67('0x15')],_0x21ce01[_0x294428]['cron']);}}for(_0x5777d1=0x0,_0x294428;_0x5777d1<_0x43adc2['length']&&!_0x502cae;_0x5777d1+=0x1){_0x294428=_0x43adc2[_0x5777d1][_0x4b67('0x4f')]();if(manager[_0x4b67('0x53')](_0x294428)){if(_0x21ce01[_0x294428][_0x4b67('0x57')]&&_0x21ce01[_0x294428][_0x4b67('0x58')]&&moment()['isBetween'](_0x21ce01[_0x294428][_0x4b67('0x5a')],_0x21ce01[_0x294428][_0x4b67('0x5b')])){manager['update'](_0x294428,_0x21ce01[_0x294428][_0x4b67('0x57')],handleJob(_0x21ce01[_0x294428]));logger['info']('update\x20cron',_0x21ce01[_0x294428][_0x4b67('0x15')],_0x21ce01[_0x294428][_0x4b67('0x57')]);}else{manager['stop'](_0x294428);manager[_0x4b67('0x5f')](_0x294428);logger[_0x4b67('0xe')](_0x4b67('0x60'),_0x21ce01[_0x294428][_0x4b67('0x15')],_0x21ce01[_0x294428][_0x4b67('0x57')]);}}}})[_0x4b67('0xc')](function(_0x4e6cc9){logger[_0x4b67('0xd')](JSON['stringify'](_0x4e6cc9));});}exports[_0x4b67('0x61')]=function(_0x214e72){return getJobs(_0x214e72);};exports[_0x4b67('0x5d')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xeae1=['difference','length','exists','deleteJob','delete\x20cron','toRun','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','update','update\x20cron','stop\x20cron','run','util','path','moment','jayson/promise','bluebird','schedule','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','AnalyticExtractedReport','findOne','then','catch','error','info','MailAccount','getSmtpOptions','name','Smtp','user','bcc','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','message','format','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','Empty','text','empty\x20file,\x20email\x20not\x20sent','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','error\x20mail','case\x20loading','currentAttempt','retryOptions','data','stop','operation','still\x20loading','case\x20empty','job','case\x20failed','entity','Job\x20ID\x20','report\x20status:','dataValues','sendMail','isNil','email','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','CloudProvider','keys','jobs','map','toString','keyBy','intersection'];(function(_0x417baa,_0x3923d0){var _0x42724f=function(_0x276146){while(--_0x276146){_0x417baa['push'](_0x417baa['shift']());}};_0x42724f(++_0x3923d0);}(_0xeae1,0x14c));var _0x1eae=function(_0x2d64fc,_0x42b2a7){_0x2d64fc=_0x2d64fc-0x0;var _0x2c8556=_0xeae1[_0x2d64fc];return _0x2c8556;};'use strict';var fs=require('fs');var util=require(_0x1eae('0x0'));var path=require(_0x1eae('0x1'));var _=require('lodash');var moment=require(_0x1eae('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x1eae('0x3'));var BPromise=require(_0x1eae('0x4'));var logger=require('../logger')(_0x1eae('0x5'));var db=require('../../mysqldb')['db'];const retry=require(_0x1eae('0x6'));var analyticCustomReportController=require(_0x1eae('0x7'));var analyticDefaultReportController=require(_0x1eae('0x8'));var client=jayson[_0x1eae('0x9')][_0x1eae('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x57b885){const _0x466c4d={};if(typeof _0x57b885==='number'){_0x466c4d['id']=_0x57b885;}return db[_0x1eae('0xb')][_0x1eae('0xc')]({'where':_0x466c4d})[_0x1eae('0xd')](function(_0x564b79){return _0x564b79;})[_0x1eae('0xe')](function(_0x29a688){logger[_0x1eae('0xf')](_0x29a688);});}function handleSendEmail(_0x583ac5,_0x478b02){logger[_0x1eae('0x10')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x583ac5['email']);var _0x386e26=!![];var _0xc7be4b=_0x583ac5[_0x1eae('0x11')][_0x1eae('0x12')]();var _0x43e285={'account':_0xc7be4b,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x583ac5[_0x1eae('0x11')][_0x1eae('0x13')],_0x583ac5[_0x1eae('0x11')]['email']||_0x583ac5[_0x1eae('0x11')][_0x1eae('0x14')][_0x1eae('0x15')]),'to':_0x583ac5['email'],'cc':_0x583ac5['cc'],'bcc':_0x583ac5[_0x1eae('0x16')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x478b02[_0x1eae('0x13')],_0x583ac5[_0x1eae('0x17')],_0x583ac5[_0x1eae('0x18')])}};var _0x3a7adb=path[_0x1eae('0x19')](__dirname,_0x1eae('0x1a'));var _0x53cb44=_0x478b02[_0x1eae('0x1b')];var _0x20929d=util['format'](_0x1eae('0x1c'),path[_0x1eae('0x1d')](_0x478b02[_0x1eae('0x1b')],path[_0x1eae('0x1e')](_0x478b02[_0x1eae('0x1b')])),_0x1eae('0x1f'));var _0x53bd20=path['join'](_0x3a7adb,_0x53cb44);var _0x4b8178=path[_0x1eae('0x19')](_0x3a7adb,_0x20929d);if(fs[_0x1eae('0x20')](_0x53bd20)){_0x478b02[_0x1eae('0x21')]='Sent';_0x43e285[_0x1eae('0x22')]['attachments']=[{'filename':_0x53cb44,'path':_0x53bd20}];_0x43e285[_0x1eae('0x22')]['text']=util[_0x1eae('0x23')](_0x1eae('0x24'),JSON[_0x1eae('0x25')](_0x478b02,null,0x2));}else if(fs['existsSync'](_0x4b8178)){_0x478b02['status']=_0x1eae('0x26');_0x43e285[_0x1eae('0x22')]['attachments']=[{'filename':_0x20929d,'path':_0x4b8178}];}else{if(_0x478b02[_0x1eae('0x21')]===_0x1eae('0x27')){_0x43e285[_0x1eae('0x22')][_0x1eae('0x28')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x583ac5['sendIfEmpty']){_0x386e26=![];logger['info'](_0x1eae('0x29'));}}else if(_0x478b02[_0x1eae('0x21')]==='Loading'){_0x43e285[_0x1eae('0x22')]['text']='Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x478b02['status']==='Completed'){_0x43e285[_0x1eae('0x22')][_0x1eae('0x28')]=_0x1eae('0x2a');}else if(_0x478b02[_0x1eae('0x21')]===_0x1eae('0x2b')){_0x43e285[_0x1eae('0x22')][_0x1eae('0x28')]=_0x1eae('0x2c');}else{logger[_0x1eae('0xf')](_0x1eae('0x2d'),_0x478b02['status']);}}if(_0x386e26){return client[_0x1eae('0x2e')](_0x1eae('0x2f'),_0x43e285)[_0x1eae('0xd')](function(_0x805029){if(_0x805029[_0x1eae('0xf')]){return logger['error']('error\x20mail',JSON['stringify'](_0x805029));}return logger['info']('email\x20sent');})[_0x1eae('0xe')](function(_0x48afed){return logger[_0x1eae('0xf')](_0x1eae('0x30'),JSON['stringify'](_0x48afed));});}}function handleError(){return function(_0x2b1015){return logger['error'](JSON[_0x1eae('0x25')](_0x2b1015));};}function loading(_0x3d16da){logger[_0x1eae('0x10')](_0x1eae('0x31'));if(_0x3d16da[_0x1eae('0x32')]===_0x3d16da[_0x1eae('0x33')]['retries']){handleSendEmail(_0x3d16da['job'],_0x3d16da[_0x1eae('0x34')]);_0x3d16da['operation'][_0x1eae('0x35')]();}else{_0x3d16da[_0x1eae('0x36')][_0x1eae('0x6')](_0x1eae('0x37'));}}function completed(_0x2d430a){logger[_0x1eae('0x10')]('case\x20completed');handleSendEmail(_0x2d430a['job'],_0x2d430a[_0x1eae('0x34')]);_0x2d430a[_0x1eae('0x36')][_0x1eae('0x35')]();}function empty(_0x499472){logger[_0x1eae('0x10')](_0x1eae('0x38'));handleSendEmail(_0x499472[_0x1eae('0x39')],_0x499472[_0x1eae('0x34')]);_0x499472['operation'][_0x1eae('0x35')]();}function failed(_0x1ce334){logger[_0x1eae('0x10')](_0x1eae('0x3a'));handleSendEmail(_0x1ce334[_0x1eae('0x39')],_0x1ce334[_0x1eae('0x34')]);_0x1ce334['operation'][_0x1eae('0x35')]();}function urecognized(_0x290751){logger[_0x1eae('0xf')]('Unrecognized\x20status:',_0x290751[_0x1eae('0x3b')]['dataValues'][_0x1eae('0x21')]);_0x290751[_0x1eae('0x36')][_0x1eae('0x35')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x156bc3,_0x3c8787){const _0x4966ce={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x324be9=retry[_0x1eae('0x36')](_0x4966ce);_0x324be9['attempt'](_0x2b7a36=>{logger[_0x1eae('0x10')](_0x1eae('0x3c')+_0x156bc3['id']+'\x20Attempt\x20#:'+_0x2b7a36);try{getReportData(_0x3c8787['id'])[_0x1eae('0xd')](function(_0x4ad328){_0x3c8787=_0x4ad328;logger[_0x1eae('0x10')](_0x1eae('0x3d'),_0x4ad328[_0x1eae('0x3e')]['status']);if(!reportStatusStrategies[_0x4ad328[_0x1eae('0x3e')][_0x1eae('0x21')]]){logger['error'](_0x1eae('0x3d'),_0x4ad328[_0x1eae('0x3e')][_0x1eae('0x21')]);_0x324be9['retry']();}reportStatusStrategies[_0x4ad328['dataValues']['status']]({'operation':_0x324be9,'currentAttempt':_0x2b7a36,'retryOptions':_0x4966ce,'job':_0x156bc3,'data':_0x3c8787,'entity':_0x4ad328});});}catch(_0x13b521){_0x324be9[_0x1eae('0x6')](_0x13b521);}});}function handleResult(_0x3d60b3){return function(_0x6871ef){if(_0x3d60b3[_0x1eae('0x3f')]&&_0x3d60b3[_0x1eae('0x11')]&&_0x3d60b3[_0x1eae('0x11')][_0x1eae('0x14')]&&!_[_0x1eae('0x40')](_0x3d60b3[_0x1eae('0x41')])){retryer(_0x3d60b3,_0x6871ef);}};}function handleJob(_0x130f3c){return function(){try{if(_['isNil'](_0x130f3c['subtractNumber'])){return logger['info'](_0x1eae('0x42'));}if(_[_0x1eae('0x40')](_0x130f3c[_0x1eae('0x18')])){return logger[_0x1eae('0x10')](_0x1eae('0x43'));}var _0x32a646={'startDate':moment()[_0x1eae('0x44')](_0x130f3c[_0x1eae('0x17')],_0x130f3c[_0x1eae('0x18')])[_0x1eae('0x23')](_0x1eae('0x45')),'endDate':moment()[_0x1eae('0x23')](_0x1eae('0x45')),'type':'scheduled','output':_0x130f3c['output'],'name':_0x130f3c[_0x1eae('0x13')]};if(!_[_0x1eae('0x40')](_0x130f3c[_0x1eae('0x46')])){logger[_0x1eae('0x10')](_0x1eae('0x47'),_0x130f3c[_0x1eae('0x46')]);return analyticDefaultReportController[_0x1eae('0x48')]({'id':_0x130f3c[_0x1eae('0x46')]},_0x32a646)[_0x1eae('0xd')](handleResult(_0x130f3c))[_0x1eae('0xe')](handleError());}if(!_[_0x1eae('0x40')](_0x130f3c['CustomReportId'])){logger[_0x1eae('0x10')](_0x1eae('0x49'),_0x130f3c[_0x1eae('0x4a')]);return analyticCustomReportController[_0x1eae('0x48')]({'id':_0x130f3c['CustomReportId']},_0x32a646)[_0x1eae('0xd')](handleResult(_0x130f3c))[_0x1eae('0xe')](handleError());}}catch(_0x59d4bb){logger[_0x1eae('0xf')](JSON[_0x1eae('0x25')](_0x59d4bb));}return logger[_0x1eae('0x10')](_0x1eae('0x4b'));};}function getJobs(_0x1c27a1){var _0x402245={};if(_0x1c27a1){_0x402245['id']=_0x1c27a1;}return db[_0x1eae('0x4c')]['findAll']({'where':_0x402245,'include':[{'model':db['MailAccount'],'attributes':['id',_0x1eae('0x13'),_0x1eae('0x41')],'include':[{'model':db['MailServerOut'],'as':_0x1eae('0x14'),'include':[{'model':db['CloudProvider'],'as':_0x1eae('0x4d')}]}]}]})[_0x1eae('0xd')](function(_0x73edbf){var _0x400851=_[_0x1eae('0x4e')](manager[_0x1eae('0x4f')]);var _0x524fa1=_[_0x1eae('0x50')](_0x73edbf,function(_0x1b1e28){return _0x1b1e28['id'][_0x1eae('0x51')]();});var _0x10fb07=_[_0x1eae('0x52')](_0x73edbf,function(_0x5ade98){return _0x5ade98['id']['toString']();});var _0x16dd5f=_0x1c27a1?_0x524fa1:_['difference'](_0x524fa1,_0x400851);var _0x35e8ae=_[_0x1eae('0x53')](_0x524fa1,_0x400851);var _0x378d77=_[_0x1eae('0x54')](_0x400851,_0x524fa1);var _0x1ce70f;var _0x1ee8e8;for(_0x1ce70f=0x0;_0x1ce70f<_0x378d77[_0x1eae('0x55')]&&!_0x1c27a1;_0x1ce70f+=0x1){_0x1ee8e8=_0x378d77[_0x1ce70f]['toString']();if(manager[_0x1eae('0x56')](_0x1ee8e8)){manager[_0x1eae('0x35')](_0x1ee8e8);manager[_0x1eae('0x57')](_0x1ee8e8);logger['info'](_0x1eae('0x58'),_0x1ee8e8);}}logger[_0x1eae('0x10')](_0x1eae('0x59'),JSON[_0x1eae('0x25')](_0x16dd5f));for(_0x1ce70f=0x0;_0x1ce70f<_0x16dd5f[_0x1eae('0x55')];_0x1ce70f+=0x1){_0x1ee8e8=_0x16dd5f[_0x1ce70f][_0x1eae('0x51')]();if(_0x1c27a1){logger[_0x1eae('0x10')](JSON[_0x1eae('0x25')](_0x10fb07[_0x1ee8e8]));BPromise[_0x1eae('0x5a')]()[_0x1eae('0xd')](handleJob(_0x10fb07[_0x1ee8e8]));logger[_0x1eae('0x10')](_0x1eae('0x5b'),_0x10fb07[_0x1ee8e8][_0x1eae('0x13')],_0x10fb07[_0x1ee8e8][_0x1eae('0x5c')]);}else if(_0x10fb07[_0x1ee8e8][_0x1eae('0x5c')]&&_0x10fb07[_0x1ee8e8][_0x1eae('0x5d')]&&moment()[_0x1eae('0x5e')](_0x10fb07[_0x1ee8e8][_0x1eae('0x5f')],_0x10fb07[_0x1ee8e8][_0x1eae('0x60')])){manager[_0x1eae('0x61')](_0x1ee8e8,_0x10fb07[_0x1ee8e8]['cron'],handleJob(_0x10fb07[_0x1ee8e8]));manager[_0x1eae('0x62')](_0x1ee8e8);logger[_0x1eae('0x10')](_0x1eae('0x63'),_0x10fb07[_0x1ee8e8]['name'],_0x10fb07[_0x1ee8e8]['cron']);}else if(manager['exists'](_0x1ee8e8)){manager[_0x1eae('0x35')](_0x1ee8e8);manager[_0x1eae('0x57')](_0x1ee8e8);logger[_0x1eae('0x10')]('stop\x20cron',_0x10fb07[_0x1ee8e8][_0x1eae('0x13')],_0x10fb07[_0x1ee8e8]['cron']);}}for(_0x1ce70f=0x0,_0x1ee8e8;_0x1ce70f<_0x35e8ae[_0x1eae('0x55')]&&!_0x1c27a1;_0x1ce70f+=0x1){_0x1ee8e8=_0x35e8ae[_0x1ce70f][_0x1eae('0x51')]();if(manager[_0x1eae('0x56')](_0x1ee8e8)){if(_0x10fb07[_0x1ee8e8][_0x1eae('0x5c')]&&_0x10fb07[_0x1ee8e8][_0x1eae('0x5d')]&&moment()[_0x1eae('0x5e')](_0x10fb07[_0x1ee8e8][_0x1eae('0x5f')],_0x10fb07[_0x1ee8e8]['endAt'])){manager[_0x1eae('0x64')](_0x1ee8e8,_0x10fb07[_0x1ee8e8][_0x1eae('0x5c')],handleJob(_0x10fb07[_0x1ee8e8]));logger['info'](_0x1eae('0x65'),_0x10fb07[_0x1ee8e8][_0x1eae('0x13')],_0x10fb07[_0x1ee8e8][_0x1eae('0x5c')]);}else{manager[_0x1eae('0x35')](_0x1ee8e8);manager[_0x1eae('0x57')](_0x1ee8e8);logger[_0x1eae('0x10')](_0x1eae('0x66'),_0x10fb07[_0x1ee8e8][_0x1eae('0x13')],_0x10fb07[_0x1ee8e8]['cron']);}}}})[_0x1eae('0xe')](function(_0x2517d3){logger['error'](JSON[_0x1eae('0x25')](_0x2517d3));});}exports[_0x1eae('0x67')]=function(_0x106c05){return getJobs(_0x106c05);};exports[_0x1eae('0x62')]=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 704c59f..2b3f817 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 _0x7334=['[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','COMPLETED','catch','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','push','name','SequelizeValidationError','error','start','lodash','aws-sdk','request-promise','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','Transcript','TranscriptFileUri','format','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','Sequelize','Sentiment\x20Analysis\x20not\x20requested','language','bucket','ValidationError','sentimentAccountId','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason'];(function(_0x4caaeb,_0x21e0e3){var _0x24b704=function(_0x178630){while(--_0x178630){_0x4caaeb['push'](_0x4caaeb['shift']());}};_0x24b704(++_0x21e0e3);}(_0x7334,0x184));var _0x4733=function(_0x39a806,_0xe618ab){_0x39a806=_0x39a806-0x0;var _0x46496f=_0x7334[_0x39a806];return _0x46496f;};var _=require(_0x4733('0x0'));var AWS=require(_0x4733('0x1'));var rp=require(_0x4733('0x2'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x4733('0x3'))['db'];var logger=require('../../config/logger')(_0x4733('0x4'));function getTranscriptionJob(_0x218143,_0x3645a2,_0x29d7da,_0x2b146d){return new Promise(function(_0x449ead,_0x16d7cc){var _0x283754=new AWS[(_0x4733('0x5'))]({'accessKeyId':_0x3645a2,'secretAccessKey':_0x218143,'region':_0x29d7da});_0x283754[_0x4733('0x6')]({'TranscriptionJobName':_0x2b146d},function(_0x8257cf,_0x3562b7){if(_0x8257cf){return _0x16d7cc(_0x8257cf);}else{return _0x449ead(_0x3562b7);}});});}function sentiment(_0x4c5c0,_0x38b7f5,_0x2d5fde,_0x1bc511,_0x2bafad){return new Promise(function(_0x49032d,_0x42b97f){var _0x1e6fcf=new AWS['Comprehend']({'accessKeyId':_0x38b7f5,'secretAccessKey':_0x4c5c0,'region':_0x2d5fde});_0x1e6fcf[_0x4733('0x7')]({'Text':_0x1bc511,'LanguageCode':_0x2bafad['substring'](0x0,0x2)},function(_0xa8e91b,_0x380b2e){if(_0xa8e91b){return _0x42b97f(_0xa8e91b);}else{return _0x49032d(_0x380b2e);}});});}function checkTranscribeJob(_0x44cb92,_0x461f74,_0x100ecd){var _0x1c146c;return new BPromise(function(_0x2c0f6b,_0x5e4b06){logger[_0x4733('0x8')](util['format'](_0x4733('0x9'),_0x44cb92['id'],_0x44cb92[_0x4733('0xa')]));return getTranscriptionJob(_0x100ecd[_0x4733('0xb')],_0x100ecd[_0x4733('0xc')],_0x461f74[_0x4733('0xd')],_0x44cb92[_0x4733('0xa')])[_0x4733('0xe')](function(_0x9fff){logger[_0x4733('0x8')](util['format'](_0x4733('0xf'),_0x44cb92['id'],_0x44cb92[_0x4733('0xa')],_0x9fff['TranscriptionJob'][_0x4733('0x10')]));if(!_0x44cb92[_0x4733('0x11')]){switch(_0x9fff[_0x4733('0x12')][_0x4733('0x10')]){case'COMPLETED':var _0x517fbc={'transcribeStatus':_0x9fff[_0x4733('0x12')][_0x4733('0x10')],'fileUri':_0x9fff['TranscriptionJob'][_0x4733('0x13')][_0x4733('0x14')]};logger[_0x4733('0x8')](util[_0x4733('0x15')]('[RECORDING:%d]\x20Get\x20transcript',_0x44cb92['id']));return rp({'uri':_0x9fff[_0x4733('0x12')][_0x4733('0x13')]['TranscriptFileUri'],'json':!![]})[_0x4733('0xe')](function(_0x18da47){logger['info'](util[_0x4733('0x15')](_0x4733('0x16'),_0x44cb92['id']));if(_0x18da47&&_0x18da47[_0x4733('0x17')]&&_0x18da47[_0x4733('0x17')][_0x4733('0x18')]&&_0x18da47[_0x4733('0x17')][_0x4733('0x18')][_0x4733('0x19')]){_0x517fbc['fileText']='';for(var _0x3e6976=0x0;_0x3e6976<_0x18da47[_0x4733('0x17')][_0x4733('0x18')][_0x4733('0x19')];_0x3e6976++){_0x517fbc[_0x4733('0x11')]+=_0x18da47[_0x4733('0x17')][_0x4733('0x18')][_0x3e6976][_0x4733('0x1a')]+'';}}return _0x44cb92[_0x4733('0x1b')](_0x517fbc);})[_0x4733('0xe')](function(){logger['info'](util[_0x4733('0x15')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x44cb92['id']));if(!_0x44cb92['tempSentiment']){throw new db[(_0x4733('0x1c'))]['ValidationError'](_0x4733('0x1d'));}if(!_0x461f74['sentiment']||!_0x461f74['sentimentAccountId']||!_0x461f74['sentimentRegion']||!_0x461f74[_0x4733('0x1e')]||!_0x461f74[_0x4733('0x1f')]){throw new db[(_0x4733('0x1c'))][(_0x4733('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x517fbc['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x461f74[_0x4733('0x21')]===_0x100ecd['id']){return _0x100ecd;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x4733('0x21')]}});}})[_0x4733('0xe')](function(_0xa915ce){if(!_0xa915ce){throw new db['Sequelize']['ValidationError'](_0x4733('0x22'));}if(!_0xa915ce[_0x4733('0xb')]||!_0xa915ce[_0x4733('0xc')]){throw new db[(_0x4733('0x1c'))][(_0x4733('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x1c146c=_0xa915ce;logger[_0x4733('0x8')](util[_0x4733('0x15')](_0x4733('0x23'),_0x44cb92['id']));return sentiment(_0x1c146c[_0x4733('0xb')],_0x1c146c[_0x4733('0xc')],_0x461f74['sentimentRegion'],_0x517fbc['fileText'],_0x461f74[_0x4733('0x1e')]);})[_0x4733('0xe')](function(_0x404dd7){logger[_0x4733('0x8')](util[_0x4733('0x15')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x44cb92['id']));return _0x44cb92[_0x4733('0x1b')]({'sentiment':_0x404dd7[_0x4733('0x24')],'sPositive':_0x404dd7[_0x4733('0x25')]['Positive'],'sNegative':_0x404dd7[_0x4733('0x25')][_0x4733('0x26')],'sMixed':_0x404dd7[_0x4733('0x25')][_0x4733('0x27')],'sNeutral':_0x404dd7[_0x4733('0x25')][_0x4733('0x28')]});})[_0x4733('0xe')](function(){logger[_0x4733('0x8')](util['format'](_0x4733('0x29'),_0x44cb92['id']));_0x2c0f6b();});case'FAILED':return _0x44cb92[_0x4733('0x1b')]({'transcribeStatus':_0x4733('0x2a'),'failureReason':_0x9fff[_0x4733('0x12')][_0x4733('0x2b')]})[_0x4733('0xe')](function(){logger[_0x4733('0x8')](util[_0x4733('0x15')](_0x4733('0x29'),_0x44cb92['id']));_0x2c0f6b();});default:logger['info'](util[_0x4733('0x15')](_0x4733('0x2c'),_0x44cb92['id']));break;}}else{return BPromise['resolve']()[_0x4733('0xe')](function(){if(!_0x44cb92[_0x4733('0x2d')]){throw new db['Sequelize'][(_0x4733('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x461f74[_0x4733('0x2e')]||!_0x461f74['sentimentAccountId']||!_0x461f74[_0x4733('0x2f')]||!_0x461f74[_0x4733('0x1e')]||!_0x461f74['bucket']){throw new db['Sequelize'][(_0x4733('0x20'))](_0x4733('0x30'));}if(!_0x44cb92['fileText']){throw new Error(_0x4733('0x31'));}if(_0x461f74[_0x4733('0x21')]===_0x100ecd['id']){return _0x100ecd;}else{return db[_0x4733('0x32')][_0x4733('0x33')]({'where':{'id':_settings[_0x4733('0x21')]}});}})[_0x4733('0xe')](function(_0x23e355){if(!_0x23e355){throw new db[(_0x4733('0x1c'))][(_0x4733('0x20'))](_0x4733('0x22'));}if(!_0x23e355[_0x4733('0xb')]||!_0x23e355[_0x4733('0xc')]){throw new db[(_0x4733('0x1c'))][(_0x4733('0x20'))](_0x4733('0x34'));}_0x1c146c=_0x23e355;logger[_0x4733('0x8')](util[_0x4733('0x15')](_0x4733('0x23'),_0x44cb92['id']));return sentiment(_0x1c146c['data1'],_0x1c146c[_0x4733('0xc')],_0x461f74[_0x4733('0x2f')],_0x44cb92[_0x4733('0x11')],_0x461f74[_0x4733('0x1e')]);})[_0x4733('0xe')](function(_0x3bbe48){logger[_0x4733('0x8')](util[_0x4733('0x15')](_0x4733('0x35'),_0x44cb92['id']));return _0x44cb92[_0x4733('0x1b')]({'sentiment':_0x3bbe48[_0x4733('0x24')],'sPositive':_0x3bbe48[_0x4733('0x25')][_0x4733('0x36')],'sNegative':_0x3bbe48[_0x4733('0x25')]['Negative'],'sMixed':_0x3bbe48['SentimentScore'][_0x4733('0x27')],'sNeutral':_0x3bbe48[_0x4733('0x25')][_0x4733('0x28')],'transcribeStatus':_0x4733('0x37')});})[_0x4733('0xe')](function(){logger[_0x4733('0x8')](util[_0x4733('0x15')](_0x4733('0x29'),_0x44cb92['id']));_0x2c0f6b();});}})[_0x4733('0x38')](function(_0x9da1a8){if(_0x9da1a8){if(!_0x9da1a8['name']||_0x9da1a8['name']!=='SequelizeValidationError'){logger['error'](util[_0x4733('0x15')](_0x4733('0x39'),_0x44cb92['id']),util[_0x4733('0x3a')](_0x9da1a8,{'showHidden':![],'depth':null}));}}_0x2c0f6b();});});}function checkTranscribe(){var _0x984462;var _0xf3c650;var _0x45b9cf;return db[_0x4733('0x3b')][_0x4733('0x3c')]({'where':{'transcribeStatus':_0x4733('0x3d')}})[_0x4733('0xe')](function(_0x4ea363){if(!_0x4ea363||!_0x4ea363['length']){throw new db[(_0x4733('0x1c'))]['ValidationError'](_0x4733('0x3e'));}_0x984462=_0x4ea363;return db[_0x4733('0x3f')][_0x4733('0x33')]({'where':{'id':0x1}});})['then'](function(_0x3f2a78){if(!_0x3f2a78){throw new db[(_0x4733('0x1c'))][(_0x4733('0x20'))](_0x4733('0x40'));}_0xf3c650=_0x3f2a78;if(!_0xf3c650[_0x4733('0x4')]||!_0xf3c650[_0x4733('0x41')]||!_0xf3c650[_0x4733('0xd')]||!_0xf3c650[_0x4733('0x1e')]||!_0xf3c650[_0x4733('0x1f')]){throw new db['Sequelize'][(_0x4733('0x20'))](_0x4733('0x42'));}return db[_0x4733('0x32')]['findOne']({'where':{'id':_0xf3c650[_0x4733('0x41')]}});})[_0x4733('0xe')](function(_0xafb3f8){if(!_0xafb3f8){throw new db[(_0x4733('0x1c'))]['ValidationError'](_0x4733('0x22'));}if(!_0xafb3f8['data1']||!_0xafb3f8[_0x4733('0xc')]){throw new db[(_0x4733('0x1c'))][(_0x4733('0x20'))](_0x4733('0x34'));}_0x45b9cf=_0xafb3f8;var _0x53321d=[];_0x984462['forEach'](function(_0x4619f7){_0x53321d[_0x4733('0x43')](checkTranscribeJob(_0x4619f7,_0xf3c650,_0x45b9cf));});return BPromise['all'](_0x53321d);})['catch'](function(_0x46a31c){if(_0x46a31c){if(!_0x46a31c[_0x4733('0x44')]||_0x46a31c[_0x4733('0x44')]!==_0x4733('0x45')){logger[_0x4733('0x46')](util[_0x4733('0x3a')](_0x46a31c,{'showHidden':![],'depth':null}));}}});}exports[_0x4733('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xc7ea=['resolve','tempSentiment','sentiment','Negative','COMPLETED','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','IN_PROGRESS','transcribeAccountId','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','forEach','push','all','catch','SequelizeValidationError','inspect','start','lodash','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed'];(function(_0x5998d0,_0x24ad81){var _0x47149d=function(_0x5e4d63){while(--_0x5e4d63){_0x5998d0['push'](_0x5998d0['shift']());}};_0x47149d(++_0x24ad81);}(_0xc7ea,0x171));var _0xac7e=function(_0xe68140,_0x13c91a){_0xe68140=_0xe68140-0x0;var _0x3af9dd=_0xc7ea[_0xe68140];return _0x3af9dd;};var _=require(_0xac7e('0x0'));var AWS=require(_0xac7e('0x1'));var rp=require('request-promise');var util=require(_0xac7e('0x2'));var BPromise=require(_0xac7e('0x3'));var db=require(_0xac7e('0x4'))['db'];var logger=require(_0xac7e('0x5'))('transcribe');function getTranscriptionJob(_0x134a3d,_0x39bf60,_0x1c15cf,_0x3ca05f){return new Promise(function(_0x26b1c5,_0x45e73f){var _0x447bfe=new AWS[(_0xac7e('0x6'))]({'accessKeyId':_0x39bf60,'secretAccessKey':_0x134a3d,'region':_0x1c15cf});_0x447bfe[_0xac7e('0x7')]({'TranscriptionJobName':_0x3ca05f},function(_0x1cb874,_0x4d83fb){if(_0x1cb874){return _0x45e73f(_0x1cb874);}else{return _0x26b1c5(_0x4d83fb);}});});}function sentiment(_0x114e82,_0x446f88,_0x2efbf4,_0x173b59,_0x39d2e3){return new Promise(function(_0x260889,_0x10873d){var _0x240869=new AWS[(_0xac7e('0x8'))]({'accessKeyId':_0x446f88,'secretAccessKey':_0x114e82,'region':_0x2efbf4});_0x240869[_0xac7e('0x9')]({'Text':_0x173b59,'LanguageCode':_0x39d2e3[_0xac7e('0xa')](0x0,0x2)},function(_0xe9d96a,_0x4efc1d){if(_0xe9d96a){return _0x10873d(_0xe9d96a);}else{return _0x260889(_0x4efc1d);}});});}function checkTranscribeJob(_0x9cd7c,_0x13e126,_0x5d4537){var _0x617cf9;return new BPromise(function(_0x24d5e9,_0x37839d){logger[_0xac7e('0xb')](util[_0xac7e('0xc')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x9cd7c['id'],_0x9cd7c[_0xac7e('0xd')]));return getTranscriptionJob(_0x5d4537[_0xac7e('0xe')],_0x5d4537[_0xac7e('0xf')],_0x13e126[_0xac7e('0x10')],_0x9cd7c[_0xac7e('0xd')])[_0xac7e('0x11')](function(_0x7ee114){logger[_0xac7e('0xb')](util['format'](_0xac7e('0x12'),_0x9cd7c['id'],_0x9cd7c[_0xac7e('0xd')],_0x7ee114[_0xac7e('0x13')][_0xac7e('0x14')]));if(!_0x9cd7c[_0xac7e('0x15')]){switch(_0x7ee114['TranscriptionJob'][_0xac7e('0x14')]){case'COMPLETED':var _0xba3d01={'transcribeStatus':_0x7ee114['TranscriptionJob'][_0xac7e('0x14')],'fileUri':_0x7ee114[_0xac7e('0x13')][_0xac7e('0x16')][_0xac7e('0x17')]};logger[_0xac7e('0xb')](util[_0xac7e('0xc')]('[RECORDING:%d]\x20Get\x20transcript',_0x9cd7c['id']));return rp({'uri':_0x7ee114[_0xac7e('0x13')][_0xac7e('0x16')]['TranscriptFileUri'],'json':!![]})[_0xac7e('0x11')](function(_0x2ebc78){logger[_0xac7e('0xb')](util[_0xac7e('0xc')](_0xac7e('0x18'),_0x9cd7c['id']));if(_0x2ebc78&&_0x2ebc78[_0xac7e('0x19')]&&_0x2ebc78[_0xac7e('0x19')][_0xac7e('0x1a')]&&_0x2ebc78[_0xac7e('0x19')][_0xac7e('0x1a')][_0xac7e('0x1b')]){_0xba3d01['fileText']='';for(var _0x57c945=0x0;_0x57c945<_0x2ebc78[_0xac7e('0x19')][_0xac7e('0x1a')][_0xac7e('0x1b')];_0x57c945++){_0xba3d01['fileText']+=_0x2ebc78[_0xac7e('0x19')][_0xac7e('0x1a')][_0x57c945][_0xac7e('0x1c')]+'';}}return _0x9cd7c[_0xac7e('0x1d')](_0xba3d01);})['then'](function(){logger['info'](util[_0xac7e('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x9cd7c['id']));if(!_0x9cd7c['tempSentiment']){throw new db[(_0xac7e('0x1e'))][(_0xac7e('0x1f'))](_0xac7e('0x20'));}if(!_0x13e126['sentiment']||!_0x13e126[_0xac7e('0x21')]||!_0x13e126[_0xac7e('0x22')]||!_0x13e126[_0xac7e('0x23')]||!_0x13e126[_0xac7e('0x24')]){throw new db['Sequelize'][(_0xac7e('0x1f'))](_0xac7e('0x25'));}if(!_0xba3d01[_0xac7e('0x15')]){throw new Error('Transcript\x20not\x20available');}if(_0x13e126[_0xac7e('0x21')]===_0x5d4537['id']){return _0x5d4537;}else{return db[_0xac7e('0x26')][_0xac7e('0x27')]({'where':{'id':_settings[_0xac7e('0x21')]}});}})['then'](function(_0x282a26){if(!_0x282a26){throw new db['Sequelize'][(_0xac7e('0x1f'))](_0xac7e('0x28'));}if(!_0x282a26[_0xac7e('0xe')]||!_0x282a26['data2']){throw new db[(_0xac7e('0x1e'))][(_0xac7e('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x617cf9=_0x282a26;logger['info'](util[_0xac7e('0xc')](_0xac7e('0x29'),_0x9cd7c['id']));return sentiment(_0x617cf9[_0xac7e('0xe')],_0x617cf9[_0xac7e('0xf')],_0x13e126[_0xac7e('0x22')],_0xba3d01[_0xac7e('0x15')],_0x13e126[_0xac7e('0x23')]);})[_0xac7e('0x11')](function(_0x38bfb1){logger['info'](util[_0xac7e('0xc')](_0xac7e('0x2a'),_0x9cd7c['id']));return _0x9cd7c[_0xac7e('0x1d')]({'sentiment':_0x38bfb1[_0xac7e('0x2b')],'sPositive':_0x38bfb1[_0xac7e('0x2c')][_0xac7e('0x2d')],'sNegative':_0x38bfb1['SentimentScore']['Negative'],'sMixed':_0x38bfb1[_0xac7e('0x2c')][_0xac7e('0x2e')],'sNeutral':_0x38bfb1[_0xac7e('0x2c')][_0xac7e('0x2f')]});})[_0xac7e('0x11')](function(){logger[_0xac7e('0xb')](util[_0xac7e('0xc')](_0xac7e('0x30'),_0x9cd7c['id']));_0x24d5e9();});case _0xac7e('0x31'):return _0x9cd7c['update']({'transcribeStatus':_0xac7e('0x31'),'failureReason':_0x7ee114[_0xac7e('0x13')]['FailureReason']})[_0xac7e('0x11')](function(){logger[_0xac7e('0xb')](util['format'](_0xac7e('0x30'),_0x9cd7c['id']));_0x24d5e9();});default:logger[_0xac7e('0xb')](util[_0xac7e('0xc')](_0xac7e('0x32'),_0x9cd7c['id']));break;}}else{return BPromise[_0xac7e('0x33')]()[_0xac7e('0x11')](function(){if(!_0x9cd7c[_0xac7e('0x34')]){throw new db[(_0xac7e('0x1e'))]['ValidationError'](_0xac7e('0x20'));}if(!_0x13e126[_0xac7e('0x35')]||!_0x13e126['sentimentAccountId']||!_0x13e126[_0xac7e('0x22')]||!_0x13e126[_0xac7e('0x23')]||!_0x13e126[_0xac7e('0x24')]){throw new db['Sequelize']['ValidationError'](_0xac7e('0x25'));}if(!_0x9cd7c[_0xac7e('0x15')]){throw new Error('Transcript\x20not\x20available');}if(_0x13e126[_0xac7e('0x21')]===_0x5d4537['id']){return _0x5d4537;}else{return db[_0xac7e('0x26')][_0xac7e('0x27')]({'where':{'id':_settings[_0xac7e('0x21')]}});}})[_0xac7e('0x11')](function(_0x21e628){if(!_0x21e628){throw new db[(_0xac7e('0x1e'))][(_0xac7e('0x1f'))](_0xac7e('0x28'));}if(!_0x21e628[_0xac7e('0xe')]||!_0x21e628[_0xac7e('0xf')]){throw new db[(_0xac7e('0x1e'))][(_0xac7e('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x617cf9=_0x21e628;logger[_0xac7e('0xb')](util[_0xac7e('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x9cd7c['id']));return sentiment(_0x617cf9[_0xac7e('0xe')],_0x617cf9[_0xac7e('0xf')],_0x13e126[_0xac7e('0x22')],_0x9cd7c[_0xac7e('0x15')],_0x13e126['language']);})[_0xac7e('0x11')](function(_0xc23c3e){logger['info'](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x9cd7c['id']));return _0x9cd7c[_0xac7e('0x1d')]({'sentiment':_0xc23c3e['Sentiment'],'sPositive':_0xc23c3e[_0xac7e('0x2c')][_0xac7e('0x2d')],'sNegative':_0xc23c3e['SentimentScore'][_0xac7e('0x36')],'sMixed':_0xc23c3e[_0xac7e('0x2c')][_0xac7e('0x2e')],'sNeutral':_0xc23c3e[_0xac7e('0x2c')][_0xac7e('0x2f')],'transcribeStatus':_0xac7e('0x37')});})['then'](function(){logger[_0xac7e('0xb')](util[_0xac7e('0xc')](_0xac7e('0x30'),_0x9cd7c['id']));_0x24d5e9();});}})['catch'](function(_0x227673){if(_0x227673){if(!_0x227673[_0xac7e('0x38')]||_0x227673['name']!=='SequelizeValidationError'){logger['error'](util['format'](_0xac7e('0x39'),_0x9cd7c['id']),util['inspect'](_0x227673,{'showHidden':![],'depth':null}));}}_0x24d5e9();});});}function checkTranscribe(){var _0x47ae4e;var _0x5b3929;var _0x4cd8f6;return db[_0xac7e('0x3a')]['findAll']({'where':{'transcribeStatus':_0xac7e('0x3b')}})[_0xac7e('0x11')](function(_0x2b9ffb){if(!_0x2b9ffb||!_0x2b9ffb['length']){throw new db['Sequelize'][(_0xac7e('0x1f'))]('No\x20transcribe\x20job\x20to\x20check');}_0x47ae4e=_0x2b9ffb;return db['Setting'][_0xac7e('0x27')]({'where':{'id':0x1}});})[_0xac7e('0x11')](function(_0x319429){if(!_0x319429){throw new db['Sequelize']['ValidationError']('Settings\x20not\x20available');}_0x5b3929=_0x319429;if(!_0x5b3929['transcribe']||!_0x5b3929[_0xac7e('0x3c')]||!_0x5b3929[_0xac7e('0x10')]||!_0x5b3929[_0xac7e('0x23')]||!_0x5b3929[_0xac7e('0x24')]){throw new db[(_0xac7e('0x1e'))][(_0xac7e('0x1f'))](_0xac7e('0x3d'));}return db[_0xac7e('0x26')][_0xac7e('0x27')]({'where':{'id':_0x5b3929['transcribeAccountId']}});})[_0xac7e('0x11')](function(_0x188f59){if(!_0x188f59){throw new db[(_0xac7e('0x1e'))]['ValidationError'](_0xac7e('0x28'));}if(!_0x188f59[_0xac7e('0xe')]||!_0x188f59[_0xac7e('0xf')]){throw new db[(_0xac7e('0x1e'))][(_0xac7e('0x1f'))](_0xac7e('0x3e'));}_0x4cd8f6=_0x188f59;var _0x43cad3=[];_0x47ae4e[_0xac7e('0x3f')](function(_0xbbef){_0x43cad3[_0xac7e('0x40')](checkTranscribeJob(_0xbbef,_0x5b3929,_0x4cd8f6));});return BPromise[_0xac7e('0x41')](_0x43cad3);})[_0xac7e('0x42')](function(_0x482f27){if(_0x482f27){if(!_0x482f27[_0xac7e('0x38')]||_0x482f27['name']!==_0xac7e('0x43')){logger['error'](util[_0xac7e('0x44')](_0x482f27,{'showHidden':![],'depth':null}));}}});}exports[_0xac7e('0x45')]=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 6e00d1d..7404a7f 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 _0x18e9=['localhost','socket.io-emitter','redis','WhatsappInteraction','findAll','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','timeout','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','defaults'];(function(_0x233a51,_0x4fcf2a){var _0x43ea22=function(_0x5630e1){while(--_0x5630e1){_0x233a51['push'](_0x233a51['shift']());}};_0x43ea22(++_0x4fcf2a);}(_0x18e9,0x1e5));var _0x918e=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0x18e9[_0x3aaf0a];return _0x33e6bc;};'use strict';var _=require(_0x918e('0x0'));var moment=require(_0x918e('0x1'));var Redis=require(_0x918e('0x2'));var util=require(_0x918e('0x3'));var config=require(_0x918e('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x918e('0x5'))(_0x918e('0x6'));config['redis']=_[_0x918e('0x7')](config['redis'],{'host':_0x918e('0x8'),'port':0x18eb});var io=require(_0x918e('0x9'))(new Redis(config[_0x918e('0xa')]));function closeInteractions(){var _0x4d835e=[];return db[_0x918e('0xb')][_0x918e('0xc')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x918e('0xd')](0x18,_0x918e('0xe'))}}})[_0x918e('0xf')](function(_0x1b3a8a){if(_0x1b3a8a&&_0x1b3a8a[_0x918e('0x10')]){_0x4d835e=_[_0x918e('0x11')](_0x1b3a8a||[],'id');logger[_0x918e('0x12')](_0x918e('0x13'),_0x4d835e['join']());return db[_0x918e('0xb')][_0x918e('0x14')]({'closeReason':'system','disposition':_0x918e('0x15'),'closed':!![],'closedAt':moment()['format'](_0x918e('0x16'))},{'where':{'id':_0x4d835e}});}})[_0x918e('0xf')](function(){if(_0x4d835e&&_0x4d835e['length']){logger[_0x918e('0x12')](_0x918e('0x17'),_0x4d835e[_0x918e('0x18')]());for(var _0x3eb97e=0x0;_0x3eb97e<_0x4d835e[_0x918e('0x10')];_0x3eb97e++){io[_0x918e('0x19')](_0x918e('0x1a'),{'id':_0x4d835e[_0x3eb97e],'closed':!![]});}}})['catch'](function(_0x5bf16c){logger[_0x918e('0x1b')](_0x918e('0x1c'),_0x5bf16c?util['inspect'](_0x5bf16c,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x10d8=['../../config/environment','../../mysqldb','../logger','schedule','defaults','redis','socket.io-emitter','findAll','lastMsgAt','subtract','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x10d8,0x97));var _0x810d=function(_0x343699,_0x530ccd){_0x343699=_0x343699-0x0;var _0x203a6e=_0x10d8[_0x343699];return _0x203a6e;};'use strict';var _=require(_0x810d('0x0'));var moment=require(_0x810d('0x1'));var Redis=require(_0x810d('0x2'));var util=require(_0x810d('0x3'));var config=require(_0x810d('0x4'));var db=require(_0x810d('0x5'))['db'];var logger=require(_0x810d('0x6'))(_0x810d('0x7'));config['redis']=_[_0x810d('0x8')](config[_0x810d('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x810d('0xa'))(new Redis(config[_0x810d('0x9')]));function closeInteractions(){var _0xe9d212=[];return db['WhatsappInteraction'][_0x810d('0xb')]({'raw':!![],'attributes':['id',_0x810d('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x810d('0xd')](0x18,'hours')}}})['then'](function(_0x5542fe){if(_0x5542fe&&_0x5542fe[_0x810d('0xe')]){_0xe9d212=_[_0x810d('0xf')](_0x5542fe||[],'id');logger[_0x810d('0x10')](_0x810d('0x11'),_0xe9d212[_0x810d('0x12')]());return db[_0x810d('0x13')][_0x810d('0x14')]({'closeReason':_0x810d('0x15'),'disposition':_0x810d('0x16'),'closed':!![],'closedAt':moment()[_0x810d('0x17')](_0x810d('0x18'))},{'where':{'id':_0xe9d212}});}})[_0x810d('0x19')](function(){if(_0xe9d212&&_0xe9d212[_0x810d('0xe')]){logger['info'](_0x810d('0x1a'),_0xe9d212[_0x810d('0x12')]());for(var _0x54815f=0x0;_0x54815f<_0xe9d212[_0x810d('0xe')];_0x54815f++){io['emit'](_0x810d('0x1b'),{'id':_0xe9d212[_0x54815f],'closed':!![]});}}})[_0x810d('0x1c')](function(_0x31a66e){logger['error'](_0x810d('0x1d'),_0x31a66e?util[_0x810d('0x1e')](_0x31a66e,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index fc7fbfc..47c05f3 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a9e=['catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper'];(function(_0x120803,_0x53148a){var _0x2b241b=function(_0x29977b){while(--_0x29977b){_0x120803['push'](_0x120803['shift']());}};_0x2b241b(++_0x53148a);}(_0x4a9e,0x121));var _0xe4a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a9e[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xe4a9('0x0'));var db=require(_0xe4a9('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe4a9('0x2')]({'id':i,'firstName':_0xe4a9('0x3')+i,'lastName':_0xe4a9('0x4')+i,'phone':0xf879fb460+i,'email':_0xe4a9('0x5')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xe4a9('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe4a9('0x6')](),'updatedAt':Date[_0xe4a9('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xe4a9('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xe4a9('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xe4a9('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe4a9('0x6')](),'updatedAt':Date[_0xe4a9('0x6')]()});}db[_0xe4a9('0x7')][_0xe4a9('0x8')]({'where':{}})[_0xe4a9('0x9')](function(){return db[_0xe4a9('0x7')][_0xe4a9('0xa')](contacts);})['then'](function(){console[_0xe4a9('0xb')](_0xe4a9('0xc'),_0xe4a9('0xd'));return db[_0xe4a9('0xe')][_0xe4a9('0x8')]({'where':{}});})[_0xe4a9('0x9')](function(){return db[_0xe4a9('0xe')][_0xe4a9('0xa')](hopper);})[_0xe4a9('0x9')](function(){console['log'](_0xe4a9('0xc'),'hopper1');return db[_0xe4a9('0x7')][_0xe4a9('0xa')](contacts2);})['then'](function(){console[_0xe4a9('0xb')](_0xe4a9('0xc'),'contacts2');return db['CmHopper'][_0xe4a9('0xa')](hopper2);})[_0xe4a9('0x9')](function(){console[_0xe4a9('0xb')](_0xe4a9('0xc'),'hopper2');})[_0xe4a9('0xf')](function(_0x586f54){console[_0xe4a9('0xb')](_0x586f54);}); \ No newline at end of file +var _0x2524=['@xcally.com','CmContact','destroy','then','bulkCreate','log','contacts1','CmHopper','finished\x20populating','contacts2','hopper2','catch','util','../mysqldb','push','Biondo','now','innocenzo.biondo'];(function(_0x3ce43b,_0x23c483){var _0x195a45=function(_0x35ce15){while(--_0x35ce15){_0x3ce43b['push'](_0x3ce43b['shift']());}};_0x195a45(++_0x23c483);}(_0x2524,0x13e));var _0x4252=function(_0x327149,_0x578584){_0x327149=_0x327149-0x0;var _0x515842=_0x2524[_0x327149];return _0x515842;};'use strict';var util=require(_0x4252('0x0'));var db=require(_0x4252('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x4252('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x4252('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4252('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x4252('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4252('0x4')](),'updatedAt':Date[_0x4252('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x4252('0x3')+i,'phone':0xf879fb460+i,'email':_0x4252('0x5')+i+_0x4252('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x4252('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4252('0x4')](),'updatedAt':Date[_0x4252('0x4')]()});}db[_0x4252('0x7')][_0x4252('0x8')]({'where':{}})[_0x4252('0x9')](function(){return db[_0x4252('0x7')][_0x4252('0xa')](contacts);})['then'](function(){console[_0x4252('0xb')]('finished\x20populating',_0x4252('0xc'));return db[_0x4252('0xd')][_0x4252('0x8')]({'where':{}});})[_0x4252('0x9')](function(){return db['CmHopper'][_0x4252('0xa')](hopper);})[_0x4252('0x9')](function(){console[_0x4252('0xb')](_0x4252('0xe'),'hopper1');return db[_0x4252('0x7')]['bulkCreate'](contacts2);})[_0x4252('0x9')](function(){console['log'](_0x4252('0xe'),_0x4252('0xf'));return db[_0x4252('0xd')][_0x4252('0xa')](hopper2);})[_0x4252('0x9')](function(){console[_0x4252('0xb')](_0x4252('0xe'),_0x4252('0x10'));})[_0x4252('0x11')](function(_0x2c0df9){console['log'](_0x2c0df9);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 3fb2c5c..4e5ad1d 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f45=['%s%s@xcally.com','password','friend','udp','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user','util','push','format','%s%s','agent'];(function(_0x356343,_0x36fe7d){var _0x5c01f0=function(_0x4fc222){while(--_0x4fc222){_0x356343['push'](_0x356343['shift']());}};_0x5c01f0(++_0x36fe7d);}(_0x5f45,0x1bd));var _0x55f4=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x5f45[_0x618414];return _0x21c19a;};'use strict';var util=require(_0x55f4('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x55f4('0x1')]({'name':util[_0x55f4('0x2')](_0x55f4('0x3'),_0x55f4('0x4'),i),'fullname':util[_0x55f4('0x2')](_0x55f4('0x3'),_0x55f4('0x4'),i),'email':util['format'](_0x55f4('0x5'),_0x55f4('0x4'),i),'role':'agent','password':_0x55f4('0x6'),'internal':0xfa0+i,'type':_0x55f4('0x7'),'transport':[_0x55f4('0x8'),'ws','wss'],'disallow':['all'],'allow':[_0x55f4('0x9')],'defaultuser':util[_0x55f4('0x2')]('%s%s',_0x55f4('0x4'),i),'encryption':_0x55f4('0xa'),'avpf':_0x55f4('0xa'),'force_avp':_0x55f4('0xa'),'icesupport':_0x55f4('0xa'),'dtlsenable':_0x55f4('0xa'),'dtlsverify':'no','dtlscertfile':_0x55f4('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x55f4('0xc'),'callerid':util['format'](_0x55f4('0xd'),util[_0x55f4('0x2')](_0x55f4('0x3'),_0x55f4('0x4'),i),0xfa0+i)});}db[_0x55f4('0xe')][_0x55f4('0xf')](users)[_0x55f4('0x10')](function(){console['log'](_0x55f4('0x11'));})['catch'](function(_0x340a62){console['log'](_0x340a62);}); \ No newline at end of file +var _0x8eb6=['yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','then','log','add\x20user','catch','../mysqldb','push','%s%s','agent','format','%s%s@xcally.com','password','friend','udp','all','ulaw'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0x8eb6,0x135));var _0x68eb=function(_0x2b7f13,_0x1c7d55){_0x2b7f13=_0x2b7f13-0x0;var _0x21d38b=_0x8eb6[_0x2b7f13];return _0x21d38b;};'use strict';var util=require('util');var db=require(_0x68eb('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x68eb('0x1')]({'name':util['format'](_0x68eb('0x2'),_0x68eb('0x3'),i),'fullname':util['format']('%s%s',_0x68eb('0x3'),i),'email':util[_0x68eb('0x4')](_0x68eb('0x5'),_0x68eb('0x3'),i),'role':'agent','password':_0x68eb('0x6'),'internal':0xfa0+i,'type':_0x68eb('0x7'),'transport':[_0x68eb('0x8'),'ws','wss'],'disallow':[_0x68eb('0x9')],'allow':[_0x68eb('0xa')],'defaultuser':util[_0x68eb('0x4')]('%s%s',_0x68eb('0x3'),i),'encryption':'yes','avpf':_0x68eb('0xb'),'force_avp':_0x68eb('0xb'),'icesupport':_0x68eb('0xb'),'dtlsenable':_0x68eb('0xb'),'dtlsverify':'no','dtlscertfile':_0x68eb('0xc'),'dtlsprivatekey':_0x68eb('0xd'),'dtlssetup':_0x68eb('0xe'),'callerid':util[_0x68eb('0x4')]('\x22%s\x22\x20<%s>',util[_0x68eb('0x4')]('%s%s','agent',i),0xfa0+i)});}db[_0x68eb('0xf')]['bulkCreate'](users)[_0x68eb('0x10')](function(){console[_0x68eb('0x11')](_0x68eb('0x12'));})[_0x68eb('0x13')](function(_0x3aa623){console[_0x68eb('0x11')](_0x3aa623);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 265f57e..7f4fefd 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa533=['removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','remoteAddress','request','connectedAt','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','User','role','agent','telephone','type','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','%s:queue:%s','Agents','format','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','MailQueue','OpenchannelQueue','Trunk','Campaign','user','SmsQueue','MailQueues','WhatsappQueue','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','openchannel','whatsapp','trunk:%s','leave','removeChatInteractions','emit','MailInteractions'];(function(_0x2a149a,_0x402ad6){var _0x3209ff=function(_0x498a9c){while(--_0x498a9c){_0x2a149a['push'](_0x2a149a['shift']());}};_0x3209ff(++_0x402ad6);}(_0xa533,0x1c6));var _0x3a53=function(_0x3d5aef,_0x64e2d5){_0x3d5aef=_0x3d5aef-0x0;var _0x33e385=_0xa533[_0x3d5aef];return _0x33e385;};'use strict';var _=require(_0x3a53('0x0'));var util=require(_0x3a53('0x1'));var BPromise=require(_0x3a53('0x2'));var db=require(_0x3a53('0x3'))['db'];var config=require(_0x3a53('0x4'));var queryQueues={'attributes':['id',_0x3a53('0x5')],'include':[{'as':'Agents','model':db[_0x3a53('0x6')],'attributes':['id',_0x3a53('0x5'),_0x3a53('0x7')],'raw':!![],'where':{'role':_0x3a53('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x3a53('0x5')],'where':{'role':_0x3a53('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x3a53('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x3a53('0x5')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x3a53('0xa')],'where':{'type':_0x3a53('0xb')}};function getAssociatedResources(_0xf547ce,_0x21ea52,_0x284c21){return db[_0x3a53('0xc')]['findOne']({'where':{'name':_0xf547ce,'userProfileId':_0x21ea52},'raw':!![]})[_0x3a53('0xd')](function(_0x42f653){if(_0x42f653){if(_0x42f653[_0x3a53('0xe')]){switch(_0xf547ce){case _0x3a53('0xf'):case _0x3a53('0x10'):case _0x3a53('0x11'):case _0x3a53('0x12'):case'MailQueues':case _0x3a53('0x13'):case _0x3a53('0x14'):return db[_0x284c21][_0x3a53('0x15')](queryQueues);case _0x3a53('0x16'):return db[_0x284c21]['findAll'](queryTelephones);case _0x3a53('0x17'):return db[_0x284c21]['findAll'](queryTrunks);case _0x3a53('0x18'):return db[_0x284c21]['findAll'](queryCampaigns);}}else{return db[_0x3a53('0x19')][_0x3a53('0x15')]({'attributes':[_0x3a53('0x1a')],'where':{'sectionId':_0x42f653['id']},'raw':!![]})['then'](function(_0x1047af){if(_0x1047af){var _0x13a8de={'where':{'id':_[_0x3a53('0x1b')](_0x1047af,'resourceId')},'raw':!![]};switch(_0x284c21){case'User':_0x13a8de[_0x3a53('0x1c')][_0x3a53('0x7')]='telephone';break;case'Campaign':_0x13a8de[_0x3a53('0x1c')][_0x3a53('0xa')]=_0x3a53('0xb');break;}return db[_0x284c21][_0x3a53('0x15')](_0x13a8de);}else{return[];}});}}else{return[];}})[_0x3a53('0xd')](function(_0x2fd945){return _0x2fd945;});}function joinOrLeaveQueues(_0x256e48,_0x1749fd,_0x43a9a8,_0x4b0295){_0x256e48[_0x1749fd](util['format'](_0x3a53('0x1d'),_0x43a9a8,_0x4b0295['name']));if(_0x4b0295['Agents']){for(var _0x27b52b=0x0;_0x27b52b<_0x4b0295[_0x3a53('0x1e')]['length'];_0x27b52b+=0x1){_0x256e48[_0x1749fd](util[_0x3a53('0x1f')](_0x3a53('0x20'),_0x4b0295[_0x3a53('0x1e')][_0x27b52b]['name']));}}}function joinOrLeave(_0x5ec1e2,_0x42604e,_0x28478c){var _0x50dadd;if(_0x5ec1e2[_0x3a53('0x21')][_0x3a53('0x22')]['id']){db[_0x3a53('0x6')][_0x3a53('0x23')]({'attributes':['id',_0x3a53('0x5'),_0x3a53('0x7'),_0x3a53('0x24')],'where':{'id':_0x5ec1e2[_0x3a53('0x21')][_0x3a53('0x22')]['id']},'include':[{'model':db[_0x3a53('0x25')],'as':_0x3a53('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x3a53('0x27')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x3a53('0x28')],'as':_0x3a53('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x3a53('0x2a')],'as':_0x3a53('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x3a53('0x2c')],'as':_0x3a53('0x2d'),'attributes':['id'],'raw':!![]},{'model':db[_0x3a53('0x2e')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x3a53('0xd')](function(_0x905690){if(_0x905690){_0x50dadd=_0x905690;_0x5ec1e2[_0x42604e](util['format'](_0x3a53('0x20'),_0x905690['name']));var _0x5e45c0=[];switch(_0x905690[_0x3a53('0x7')]){case'admin':_0x5ec1e2[_0x42604e](_0x3a53('0x2f'));_0x5ec1e2[_0x42604e](_0x3a53('0x30'));if(queryQueues[_0x3a53('0x31')](_0x3a53('0x32'))){delete queryQueues[_0x3a53('0x32')];}_0x5e45c0[_0x3a53('0x33')](db[_0x3a53('0x34')][_0x3a53('0x15')](queryQueues));_0x5e45c0['push'](db['ChatQueue'][_0x3a53('0x15')](queryQueues));_0x5e45c0[_0x3a53('0x33')](db[_0x3a53('0x35')][_0x3a53('0x15')](queryQueues));_0x5e45c0[_0x3a53('0x33')](db['SmsQueue']['findAll'](queryQueues));_0x5e45c0[_0x3a53('0x33')](db[_0x3a53('0x36')][_0x3a53('0x15')](queryQueues));_0x5e45c0[_0x3a53('0x33')](db[_0x3a53('0x37')][_0x3a53('0x15')](queryQueues));_0x5e45c0[_0x3a53('0x33')](db['WhatsappQueue'][_0x3a53('0x15')](queryQueues));_0x5e45c0['push'](db[_0x3a53('0x6')][_0x3a53('0x15')](queryTelephones));_0x5e45c0[_0x3a53('0x33')](db[_0x3a53('0x38')][_0x3a53('0x15')](queryTrunks));_0x5e45c0[_0x3a53('0x33')](db[_0x3a53('0x39')]['findAll'](queryCampaigns));_0x5e45c0[_0x3a53('0x33')](db[_0x3a53('0x6')][_0x3a53('0x15')](queryAgents));break;case _0x3a53('0x3a'):_0x5ec1e2[_0x42604e](_0x3a53('0x2f'));_0x5ec1e2[_0x42604e]('voice:outbound');_0x5e45c0[_0x3a53('0x33')](getAssociatedResources(_0x3a53('0xf'),_0x905690[_0x3a53('0x24')],'VoiceQueue'));_0x5e45c0[_0x3a53('0x33')](getAssociatedResources('ChatQueues',_0x905690[_0x3a53('0x24')],'ChatQueue'));_0x5e45c0[_0x3a53('0x33')](getAssociatedResources(_0x3a53('0x11'),_0x905690[_0x3a53('0x24')],_0x3a53('0x35')));_0x5e45c0[_0x3a53('0x33')](getAssociatedResources(_0x3a53('0x12'),_0x905690['userProfileId'],_0x3a53('0x3b')));_0x5e45c0[_0x3a53('0x33')](getAssociatedResources(_0x3a53('0x3c'),_0x905690[_0x3a53('0x24')],_0x3a53('0x36')));_0x5e45c0[_0x3a53('0x33')](getAssociatedResources(_0x3a53('0x13'),_0x905690[_0x3a53('0x24')],_0x3a53('0x37')));_0x5e45c0['push'](getAssociatedResources(_0x3a53('0x14'),_0x905690[_0x3a53('0x24')],_0x3a53('0x3d')));_0x5e45c0[_0x3a53('0x33')](getAssociatedResources(_0x3a53('0x16'),_0x905690['userProfileId'],_0x3a53('0x6')));_0x5e45c0[_0x3a53('0x33')](getAssociatedResources(_0x3a53('0x17'),_0x905690[_0x3a53('0x24')],_0x3a53('0x38')));_0x5e45c0[_0x3a53('0x33')](getAssociatedResources(_0x3a53('0x18'),_0x905690[_0x3a53('0x24')],'Campaign'));_0x5e45c0[_0x3a53('0x33')](db[_0x3a53('0x6')][_0x3a53('0x15')](queryAgents));break;case _0x3a53('0x8'):_0x5ec1e2[_0x42604e](_0x3a53('0x2f'));_0x5ec1e2[_0x42604e]('voice:outbound');_0x5e45c0[_0x3a53('0x33')](_0x905690[_0x3a53('0x3e')]({'attributes':['id',_0x3a53('0x5')]}));_0x5e45c0['push'](_0x905690['getChatQueues']({'attributes':['id','name']}));_0x5e45c0['push'](_0x905690[_0x3a53('0x3f')]({'attributes':['id','name']}));_0x5e45c0[_0x3a53('0x33')](_0x905690[_0x3a53('0x40')]({'attributes':['id','name']}));_0x5e45c0[_0x3a53('0x33')](_0x905690[_0x3a53('0x41')]({'attributes':['id',_0x3a53('0x5')]}));_0x5e45c0[_0x3a53('0x33')](_0x905690[_0x3a53('0x42')]({'attributes':['id',_0x3a53('0x5')]}));_0x5e45c0['push'](_0x905690[_0x3a53('0x43')]({'attributes':['id','name']}));break;}return BPromise[_0x3a53('0x44')](_0x5e45c0);}})['then'](function(_0x17a803){if(_0x17a803&&_0x17a803[_0x3a53('0x45')]){for(var _0x2ead88=0x0;_0x2ead88<_0x17a803['length'];_0x2ead88+=0x1){for(var _0xaa4b1c=0x0;_0xaa4b1c<_0x17a803[_0x2ead88][_0x3a53('0x45')];_0xaa4b1c+=0x1){switch(_0x2ead88){case 0x0:joinOrLeaveQueues(_0x5ec1e2,_0x42604e,_0x3a53('0x46'),_0x17a803[_0x2ead88][_0xaa4b1c]);break;case 0x1:joinOrLeaveQueues(_0x5ec1e2,_0x42604e,_0x3a53('0x47'),_0x17a803[_0x2ead88][_0xaa4b1c]);break;case 0x2:joinOrLeaveQueues(_0x5ec1e2,_0x42604e,_0x3a53('0x48'),_0x17a803[_0x2ead88][_0xaa4b1c]);break;case 0x3:joinOrLeaveQueues(_0x5ec1e2,_0x42604e,_0x3a53('0x49'),_0x17a803[_0x2ead88][_0xaa4b1c]);break;case 0x4:joinOrLeaveQueues(_0x5ec1e2,_0x42604e,'mail',_0x17a803[_0x2ead88][_0xaa4b1c]);break;case 0x5:joinOrLeaveQueues(_0x5ec1e2,_0x42604e,_0x3a53('0x4a'),_0x17a803[_0x2ead88][_0xaa4b1c]);break;case 0x6:joinOrLeaveQueues(_0x5ec1e2,_0x42604e,_0x3a53('0x4b'),_0x17a803[_0x2ead88][_0xaa4b1c]);break;case 0x7:if(_0x50dadd[_0x3a53('0x7')]!==_0x3a53('0x8'))_0x5ec1e2[_0x42604e](util['format']('telephone:%s',_0x17a803[_0x2ead88][_0xaa4b1c]['name']));break;case 0x8:if(_0x50dadd[_0x3a53('0x7')]!==_0x3a53('0x8'))_0x5ec1e2[_0x42604e](util[_0x3a53('0x1f')](_0x3a53('0x4c'),_0x17a803[_0x2ead88][_0xaa4b1c]['name']));break;case 0x9:if(_0x50dadd[_0x3a53('0x7')]!==_0x3a53('0x8'))_0x5ec1e2[_0x42604e](util[_0x3a53('0x1f')]('campaign:%s:%s',_0x17a803[_0x2ead88][_0xaa4b1c][_0x3a53('0xa')],_0x17a803[_0x2ead88][_0xaa4b1c]['name']));break;case 0xa:_0x5ec1e2[_0x42604e](util[_0x3a53('0x1f')](_0x3a53('0x20'),_0x17a803[_0x2ead88][_0xaa4b1c][_0x3a53('0x5')]));break;}}}}})[_0x3a53('0xd')](function(){if(_0x42604e===_0x3a53('0x4d')){var _0x8f834d=_[_0x3a53('0x1b')](_0x50dadd[_0x3a53('0x26')],'id');return _0x50dadd[_0x3a53('0x4e')](_0x8f834d)[_0x3a53('0xd')](function(){for(var _0x57a364=0x0;_0x57a364<_0x8f834d[_0x3a53('0x45')];_0x57a364+=0x1){_0x28478c[_0x3a53('0x4f')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x8f834d[_0x57a364]),'UserId':Number(_0x50dadd['id'])});}});}})[_0x3a53('0xd')](function(){if(_0x42604e===_0x3a53('0x4d')){var _0x13eaea=_['map'](_0x50dadd[_0x3a53('0x50')],'id');return _0x50dadd[_0x3a53('0x51')](_0x13eaea)[_0x3a53('0xd')](function(){for(var _0x19fc89=0x0;_0x19fc89<_0x13eaea['length'];_0x19fc89+=0x1){_0x28478c[_0x3a53('0x4f')](_0x3a53('0x52'),{'MailInteractionId':Number(_0x13eaea[_0x19fc89]),'UserId':Number(_0x50dadd['id'])});}});}})['then'](function(){if(_0x42604e===_0x3a53('0x4d')){var _0x1977e5=_[_0x3a53('0x1b')](_0x50dadd[_0x3a53('0x29')],'id');return _0x50dadd[_0x3a53('0x53')](_0x1977e5)['then'](function(){for(var _0x543022=0x0;_0x543022<_0x1977e5[_0x3a53('0x45')];_0x543022+=0x1){_0x28478c['emit'](_0x3a53('0x54'),{'FaxInteractionId':Number(_0x1977e5[_0x543022]),'UserId':Number(_0x50dadd['id'])});}});}})[_0x3a53('0xd')](function(){if(_0x42604e===_0x3a53('0x4d')){var _0x484db5=_['map'](_0x50dadd[_0x3a53('0x2b')],'id');return _0x50dadd[_0x3a53('0x55')](_0x484db5)[_0x3a53('0xd')](function(){for(var _0x871dd7=0x0;_0x871dd7<_0x484db5[_0x3a53('0x45')];_0x871dd7+=0x1){_0x28478c[_0x3a53('0x4f')](_0x3a53('0x56'),{'SmsInteractionId':Number(_0x484db5[_0x871dd7]),'UserId':Number(_0x50dadd['id'])});}});}})[_0x3a53('0xd')](function(){if(_0x42604e==='leave'){var _0x55af36=_[_0x3a53('0x1b')](_0x50dadd[_0x3a53('0x2d')],'id');return _0x50dadd[_0x3a53('0x57')](_0x55af36)[_0x3a53('0xd')](function(){for(var _0x44025b=0x0;_0x44025b<_0x55af36[_0x3a53('0x45')];_0x44025b+=0x1){_0x28478c[_0x3a53('0x4f')](_0x3a53('0x58'),{'OpenchannelInteractionId':Number(_0x55af36[_0x44025b]),'UserId':Number(_0x50dadd['id'])});}});}})[_0x3a53('0xd')](function(){if(_0x42604e==='leave'){var _0x3739e1=_[_0x3a53('0x1b')](_0x50dadd[_0x3a53('0x59')],'id');return _0x50dadd[_0x3a53('0x5a')](_0x3739e1)[_0x3a53('0xd')](function(){for(var _0x5e6989=0x0;_0x5e6989<_0x3739e1[_0x3a53('0x45')];_0x5e6989+=0x1){_0x28478c[_0x3a53('0x4f')](_0x3a53('0x5b'),{'WhatsappInteractionId':Number(_0x3739e1[_0x5e6989]),'UserId':Number(_0x50dadd['id'])});}});}})[_0x3a53('0x5c')](function(_0x5f5c41){_0x5ec1e2[_0x3a53('0x5d')](_0x5f5c41);});}}function onDisconnect(_0xba6e66,_0x478e42){joinOrLeave(_0xba6e66,_0x3a53('0x4d'),_0x478e42);}function onConnect(_0x4eb611){joinOrLeave(_0x4eb611,_0x3a53('0x5e'));}exports[_0x3a53('0x5f')]=function(_0x49a521){_0x49a521['on'](_0x3a53('0x60'),function(_0x1c1d4d){_0x1c1d4d[_0x3a53('0x61')](0x0);_0x1c1d4d['address']=_0x1c1d4d['request'][_0x3a53('0x60')][_0x3a53('0x62')]+':'+_0x1c1d4d[_0x3a53('0x63')][_0x3a53('0x60')]['remotePort'];_0x1c1d4d[_0x3a53('0x64')]=new Date();_0x1c1d4d[_0x3a53('0x5d')]=function(_0x437313){console['log'](_0x3a53('0x65')+_0x1c1d4d[_0x3a53('0x66')][_0x3a53('0x5')]+'['+_0x1c1d4d[_0x3a53('0x67')]+']',_0x437313);};_0x1c1d4d['on'](_0x3a53('0x68'),function(){onDisconnect(_0x1c1d4d,_0x49a521);_0x1c1d4d[_0x3a53('0x5d')](_0x3a53('0x69'));});onConnect(_0x1c1d4d);_0x1c1d4d[_0x3a53('0x5d')](_0x3a53('0x6a'));});}; \ No newline at end of file +var _0x17bb=['removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','address','disconnect','DISCONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','User','role','agent','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','Telephones','findAll','Trunks','IvrCampaigns','map','where','type','format','%s:queue:%s','Agents','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','SmsInteraction','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','user','VoiceQueues','VoiceQueue','FaxQueues','Campaign','getVoiceQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','length','sms','mail','whatsapp','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','FaxInteractions','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions'];(function(_0x310e7e,_0x503b48){var _0x4ce8a3=function(_0xc0a217){while(--_0xc0a217){_0x310e7e['push'](_0x310e7e['shift']());}};_0x4ce8a3(++_0x503b48);}(_0x17bb,0x188));var _0xb17b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x17bb[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xb17b('0x0'));var util=require(_0xb17b('0x1'));var BPromise=require(_0xb17b('0x2'));var db=require(_0xb17b('0x3'))['db'];var config=require(_0xb17b('0x4'));var queryQueues={'attributes':['id',_0xb17b('0x5')],'include':[{'as':'Agents','model':db[_0xb17b('0x6')],'attributes':['id',_0xb17b('0x5'),_0xb17b('0x7')],'raw':!![],'where':{'role':_0xb17b('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xb17b('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xb17b('0x5')],'where':{'role':_0xb17b('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb17b('0x5'),'type'],'where':{'type':_0xb17b('0xa')}};function getAssociatedResources(_0xdb9889,_0x243a06,_0xfcdd38){return db[_0xb17b('0xb')][_0xb17b('0xc')]({'where':{'name':_0xdb9889,'userProfileId':_0x243a06},'raw':!![]})[_0xb17b('0xd')](function(_0x7d398e){if(_0x7d398e){if(_0x7d398e[_0xb17b('0xe')]){switch(_0xdb9889){case'VoiceQueues':case _0xb17b('0xf'):case'FaxQueues':case _0xb17b('0x10'):case _0xb17b('0x11'):case _0xb17b('0x12'):case'WhatsappQueues':return db[_0xfcdd38]['findAll'](queryQueues);case _0xb17b('0x13'):return db[_0xfcdd38][_0xb17b('0x14')](queryTelephones);case _0xb17b('0x15'):return db[_0xfcdd38][_0xb17b('0x14')](queryTrunks);case _0xb17b('0x16'):return db[_0xfcdd38]['findAll'](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x7d398e['id']},'raw':!![]})['then'](function(_0x1a8345){if(_0x1a8345){var _0x518482={'where':{'id':_[_0xb17b('0x17')](_0x1a8345,'resourceId')},'raw':!![]};switch(_0xfcdd38){case _0xb17b('0x6'):_0x518482[_0xb17b('0x18')][_0xb17b('0x7')]=_0xb17b('0x9');break;case'Campaign':_0x518482[_0xb17b('0x18')][_0xb17b('0x19')]=_0xb17b('0xa');break;}return db[_0xfcdd38][_0xb17b('0x14')](_0x518482);}else{return[];}});}}else{return[];}})[_0xb17b('0xd')](function(_0x3e44a2){return _0x3e44a2;});}function joinOrLeaveQueues(_0x3008e9,_0xcbb727,_0x1d3134,_0xcb3d3a){_0x3008e9[_0xcbb727](util[_0xb17b('0x1a')](_0xb17b('0x1b'),_0x1d3134,_0xcb3d3a['name']));if(_0xcb3d3a[_0xb17b('0x1c')]){for(var _0x55def7=0x0;_0x55def7<_0xcb3d3a[_0xb17b('0x1c')]['length'];_0x55def7+=0x1){_0x3008e9[_0xcbb727](util[_0xb17b('0x1a')](_0xb17b('0x1d'),_0xcb3d3a[_0xb17b('0x1c')][_0x55def7][_0xb17b('0x5')]));}}}function joinOrLeave(_0x4ece21,_0x14604e,_0x205e39){var _0x28efa1;if(_0x4ece21[_0xb17b('0x1e')][_0xb17b('0x1f')]['id']){db[_0xb17b('0x6')][_0xb17b('0x20')]({'attributes':['id',_0xb17b('0x5'),_0xb17b('0x7'),_0xb17b('0x21')],'where':{'id':_0x4ece21[_0xb17b('0x1e')]['query']['id']},'include':[{'model':db[_0xb17b('0x22')],'as':_0xb17b('0x23'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xb17b('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xb17b('0x25')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb17b('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb17b('0x27')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb17b('0x28')],'as':_0xb17b('0x29'),'attributes':['id'],'raw':!![]}]})['then'](function(_0xf45626){if(_0xf45626){_0x28efa1=_0xf45626;_0x4ece21[_0x14604e](util[_0xb17b('0x1a')](_0xb17b('0x1d'),_0xf45626[_0xb17b('0x5')]));var _0x109edd=[];switch(_0xf45626[_0xb17b('0x7')]){case _0xb17b('0x2a'):_0x4ece21[_0x14604e](_0xb17b('0x2b'));_0x4ece21[_0x14604e](_0xb17b('0x2c'));if(queryQueues[_0xb17b('0x2d')](_0xb17b('0x2e'))){delete queryQueues['include'];}_0x109edd[_0xb17b('0x2f')](db['VoiceQueue'][_0xb17b('0x14')](queryQueues));_0x109edd['push'](db[_0xb17b('0x30')][_0xb17b('0x14')](queryQueues));_0x109edd[_0xb17b('0x2f')](db[_0xb17b('0x31')]['findAll'](queryQueues));_0x109edd['push'](db[_0xb17b('0x32')][_0xb17b('0x14')](queryQueues));_0x109edd['push'](db[_0xb17b('0x33')][_0xb17b('0x14')](queryQueues));_0x109edd[_0xb17b('0x2f')](db[_0xb17b('0x34')][_0xb17b('0x14')](queryQueues));_0x109edd[_0xb17b('0x2f')](db['WhatsappQueue']['findAll'](queryQueues));_0x109edd[_0xb17b('0x2f')](db[_0xb17b('0x6')]['findAll'](queryTelephones));_0x109edd[_0xb17b('0x2f')](db['Trunk'][_0xb17b('0x14')](queryTrunks));_0x109edd[_0xb17b('0x2f')](db['Campaign'][_0xb17b('0x14')](queryCampaigns));_0x109edd['push'](db[_0xb17b('0x6')][_0xb17b('0x14')](queryAgents));break;case _0xb17b('0x35'):_0x4ece21[_0x14604e]('voice:inbound');_0x4ece21[_0x14604e]('voice:outbound');_0x109edd[_0xb17b('0x2f')](getAssociatedResources(_0xb17b('0x36'),_0xf45626[_0xb17b('0x21')],_0xb17b('0x37')));_0x109edd[_0xb17b('0x2f')](getAssociatedResources('ChatQueues',_0xf45626[_0xb17b('0x21')],_0xb17b('0x30')));_0x109edd[_0xb17b('0x2f')](getAssociatedResources(_0xb17b('0x38'),_0xf45626['userProfileId'],_0xb17b('0x31')));_0x109edd[_0xb17b('0x2f')](getAssociatedResources('SmsQueues',_0xf45626['userProfileId'],'SmsQueue'));_0x109edd[_0xb17b('0x2f')](getAssociatedResources(_0xb17b('0x11'),_0xf45626[_0xb17b('0x21')],_0xb17b('0x33')));_0x109edd[_0xb17b('0x2f')](getAssociatedResources(_0xb17b('0x12'),_0xf45626[_0xb17b('0x21')],_0xb17b('0x34')));_0x109edd['push'](getAssociatedResources('WhatsappQueues',_0xf45626[_0xb17b('0x21')],'WhatsappQueue'));_0x109edd[_0xb17b('0x2f')](getAssociatedResources('Telephones',_0xf45626[_0xb17b('0x21')],'User'));_0x109edd[_0xb17b('0x2f')](getAssociatedResources(_0xb17b('0x15'),_0xf45626[_0xb17b('0x21')],'Trunk'));_0x109edd[_0xb17b('0x2f')](getAssociatedResources('IvrCampaigns',_0xf45626['userProfileId'],_0xb17b('0x39')));_0x109edd['push'](db['User'][_0xb17b('0x14')](queryAgents));break;case _0xb17b('0x8'):_0x4ece21[_0x14604e](_0xb17b('0x2b'));_0x4ece21[_0x14604e](_0xb17b('0x2c'));_0x109edd[_0xb17b('0x2f')](_0xf45626[_0xb17b('0x3a')]({'attributes':['id','name']}));_0x109edd[_0xb17b('0x2f')](_0xf45626['getChatQueues']({'attributes':['id',_0xb17b('0x5')]}));_0x109edd[_0xb17b('0x2f')](_0xf45626['getFaxQueues']({'attributes':['id',_0xb17b('0x5')]}));_0x109edd[_0xb17b('0x2f')](_0xf45626[_0xb17b('0x3b')]({'attributes':['id',_0xb17b('0x5')]}));_0x109edd[_0xb17b('0x2f')](_0xf45626['getMailQueues']({'attributes':['id',_0xb17b('0x5')]}));_0x109edd['push'](_0xf45626[_0xb17b('0x3c')]({'attributes':['id',_0xb17b('0x5')]}));_0x109edd[_0xb17b('0x2f')](_0xf45626[_0xb17b('0x3d')]({'attributes':['id','name']}));break;}return BPromise['all'](_0x109edd);}})[_0xb17b('0xd')](function(_0x17d9d8){if(_0x17d9d8&&_0x17d9d8['length']){for(var _0x4d010e=0x0;_0x4d010e<_0x17d9d8[_0xb17b('0x3e')];_0x4d010e+=0x1){for(var _0x226108=0x0;_0x226108<_0x17d9d8[_0x4d010e][_0xb17b('0x3e')];_0x226108+=0x1){switch(_0x4d010e){case 0x0:joinOrLeaveQueues(_0x4ece21,_0x14604e,'voice',_0x17d9d8[_0x4d010e][_0x226108]);break;case 0x1:joinOrLeaveQueues(_0x4ece21,_0x14604e,'chat',_0x17d9d8[_0x4d010e][_0x226108]);break;case 0x2:joinOrLeaveQueues(_0x4ece21,_0x14604e,'fax',_0x17d9d8[_0x4d010e][_0x226108]);break;case 0x3:joinOrLeaveQueues(_0x4ece21,_0x14604e,_0xb17b('0x3f'),_0x17d9d8[_0x4d010e][_0x226108]);break;case 0x4:joinOrLeaveQueues(_0x4ece21,_0x14604e,_0xb17b('0x40'),_0x17d9d8[_0x4d010e][_0x226108]);break;case 0x5:joinOrLeaveQueues(_0x4ece21,_0x14604e,'openchannel',_0x17d9d8[_0x4d010e][_0x226108]);break;case 0x6:joinOrLeaveQueues(_0x4ece21,_0x14604e,_0xb17b('0x41'),_0x17d9d8[_0x4d010e][_0x226108]);break;case 0x7:if(_0x28efa1[_0xb17b('0x7')]!==_0xb17b('0x8'))_0x4ece21[_0x14604e](util[_0xb17b('0x1a')](_0xb17b('0x42'),_0x17d9d8[_0x4d010e][_0x226108][_0xb17b('0x5')]));break;case 0x8:if(_0x28efa1[_0xb17b('0x7')]!==_0xb17b('0x8'))_0x4ece21[_0x14604e](util['format']('trunk:%s',_0x17d9d8[_0x4d010e][_0x226108][_0xb17b('0x5')]));break;case 0x9:if(_0x28efa1['role']!==_0xb17b('0x8'))_0x4ece21[_0x14604e](util[_0xb17b('0x1a')](_0xb17b('0x43'),_0x17d9d8[_0x4d010e][_0x226108]['type'],_0x17d9d8[_0x4d010e][_0x226108][_0xb17b('0x5')]));break;case 0xa:_0x4ece21[_0x14604e](util[_0xb17b('0x1a')]('user:%s',_0x17d9d8[_0x4d010e][_0x226108][_0xb17b('0x5')]));break;}}}}})[_0xb17b('0xd')](function(){if(_0x14604e===_0xb17b('0x44')){var _0x45a108=_['map'](_0x28efa1[_0xb17b('0x23')],'id');return _0x28efa1[_0xb17b('0x45')](_0x45a108)['then'](function(){for(var _0x51cbff=0x0;_0x51cbff<_0x45a108[_0xb17b('0x3e')];_0x51cbff+=0x1){_0x205e39[_0xb17b('0x46')](_0xb17b('0x47'),{'ChatInteractionId':Number(_0x45a108[_0x51cbff]),'UserId':Number(_0x28efa1['id'])});}});}})['then'](function(){if(_0x14604e===_0xb17b('0x44')){var _0x34938f=_[_0xb17b('0x17')](_0x28efa1[_0xb17b('0x24')],'id');return _0x28efa1['removeMailInteractions'](_0x34938f)['then'](function(){for(var _0x406a7b=0x0;_0x406a7b<_0x34938f[_0xb17b('0x3e')];_0x406a7b+=0x1){_0x205e39['emit'](_0xb17b('0x48'),{'MailInteractionId':Number(_0x34938f[_0x406a7b]),'UserId':Number(_0x28efa1['id'])});}});}})[_0xb17b('0xd')](function(){if(_0x14604e===_0xb17b('0x44')){var _0xef1fa1=_[_0xb17b('0x17')](_0x28efa1[_0xb17b('0x49')],'id');return _0x28efa1['removeFaxInteractions'](_0xef1fa1)[_0xb17b('0xd')](function(){for(var _0x4b8c6d=0x0;_0x4b8c6d<_0xef1fa1['length'];_0x4b8c6d+=0x1){_0x205e39[_0xb17b('0x46')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0xef1fa1[_0x4b8c6d]),'UserId':Number(_0x28efa1['id'])});}});}})['then'](function(){if(_0x14604e===_0xb17b('0x44')){var _0xbc27fe=_[_0xb17b('0x17')](_0x28efa1[_0xb17b('0x4a')],'id');return _0x28efa1[_0xb17b('0x4b')](_0xbc27fe)[_0xb17b('0xd')](function(){for(var _0x41008e=0x0;_0x41008e<_0xbc27fe[_0xb17b('0x3e')];_0x41008e+=0x1){_0x205e39[_0xb17b('0x46')](_0xb17b('0x4c'),{'SmsInteractionId':Number(_0xbc27fe[_0x41008e]),'UserId':Number(_0x28efa1['id'])});}});}})['then'](function(){if(_0x14604e==='leave'){var _0x4377de=_['map'](_0x28efa1[_0xb17b('0x4d')],'id');return _0x28efa1[_0xb17b('0x4e')](_0x4377de)[_0xb17b('0xd')](function(){for(var _0x3703db=0x0;_0x3703db<_0x4377de[_0xb17b('0x3e')];_0x3703db+=0x1){_0x205e39[_0xb17b('0x46')](_0xb17b('0x4f'),{'OpenchannelInteractionId':Number(_0x4377de[_0x3703db]),'UserId':Number(_0x28efa1['id'])});}});}})[_0xb17b('0xd')](function(){if(_0x14604e===_0xb17b('0x44')){var _0x214299=_[_0xb17b('0x17')](_0x28efa1[_0xb17b('0x29')],'id');return _0x28efa1[_0xb17b('0x50')](_0x214299)[_0xb17b('0xd')](function(){for(var _0x30f4ef=0x0;_0x30f4ef<_0x214299[_0xb17b('0x3e')];_0x30f4ef+=0x1){_0x205e39[_0xb17b('0x46')](_0xb17b('0x51'),{'WhatsappInteractionId':Number(_0x214299[_0x30f4ef]),'UserId':Number(_0x28efa1['id'])});}});}})[_0xb17b('0x52')](function(_0x4b4fcc){_0x4ece21[_0xb17b('0x53')](_0x4b4fcc);});}}function onDisconnect(_0x2f4c62,_0x5deb5e){joinOrLeave(_0x2f4c62,_0xb17b('0x44'),_0x5deb5e);}function onConnect(_0x1d8c49){joinOrLeave(_0x1d8c49,_0xb17b('0x54'));}exports['default']=function(_0x3e113f){_0x3e113f['on'](_0xb17b('0x55'),function(_0x532792){_0x532792['setMaxListeners'](0x0);_0x532792['address']=_0x532792[_0xb17b('0x56')][_0xb17b('0x55')][_0xb17b('0x57')]+':'+_0x532792[_0xb17b('0x56')][_0xb17b('0x55')][_0xb17b('0x58')];_0x532792[_0xb17b('0x59')]=new Date();_0x532792['log']=function(_0x474f9f){console[_0xb17b('0x53')](_0xb17b('0x5a')+_0x532792['nsp'][_0xb17b('0x5')]+'['+_0x532792[_0xb17b('0x5b')]+']',_0x474f9f);};_0x532792['on'](_0xb17b('0x5c'),function(){onDisconnect(_0x532792,_0x3e113f);_0x532792[_0xb17b('0x53')](_0xb17b('0x5d'));});onConnect(_0x532792);_0x532792[_0xb17b('0x53')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 9b07183..81aafe0 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 _0x4887=['hasOwnProperty','model','callback','util','../../mysqldb','jayson/promise','../logger','triggers','http','ChatInteraction','afterCreate','newinteraction','Chat','afterUpdate','closedinteraction','ChatMessage','ChatOfflineMessage','newmessage','Sms','SmsInteraction','SmsMessage','WhatsappInteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','error','Trigger,\x20%s','catch','get','event','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','format','SIP/%s','name','agent','channel','incomingmessage','outgoingmessage','AfterCreateMessage','motionChannel','AfterCreate','changed','closed','substatus','AfterUpdate','User','find','fullname','email','default','length'];(function(_0x14a513,_0x3239f){var _0x47236c=function(_0x394191){while(--_0x394191){_0x14a513['push'](_0x14a513['shift']());}};_0x47236c(++_0x3239f);}(_0x4887,0x16b));var _0x7488=function(_0x338f22,_0x43b302){_0x338f22=_0x338f22-0x0;var _0x1cef9d=_0x4887[_0x338f22];return _0x1cef9d;};'use strict';var util=require(_0x7488('0x0'));var db=require(_0x7488('0x1'))['db'];var jayson=require(_0x7488('0x2'));var logger=require(_0x7488('0x3'))(_0x7488('0x4'));var client=jayson['client'][_0x7488('0x5')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x7488('0x6'),'event':_0x7488('0x7'),'condition':_0x7488('0x8'),'callback':afterCreate},{'channel':_0x7488('0x9'),'model':'ChatInteraction','event':_0x7488('0xa'),'condition':_0x7488('0xb'),'callback':afterUpdate},{'channel':'Chat','model':_0x7488('0xc'),'event':_0x7488('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Chat','model':_0x7488('0xd'),'event':_0x7488('0x7'),'condition':_0x7488('0xe'),'callback':afterCreateOfflineMessage},{'channel':_0x7488('0xf'),'model':'SmsInteraction','event':_0x7488('0x7'),'condition':_0x7488('0x8'),'callback':afterCreate},{'channel':_0x7488('0xf'),'model':_0x7488('0x10'),'event':_0x7488('0xa'),'condition':_0x7488('0xb'),'callback':afterUpdate},{'channel':_0x7488('0xf'),'model':_0x7488('0x11'),'event':_0x7488('0x7'),'condition':_0x7488('0xe'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x7488('0x12'),'event':'afterCreate','condition':_0x7488('0x8'),'callback':afterCreate},{'channel':_0x7488('0x13'),'model':_0x7488('0x12'),'event':_0x7488('0xa'),'condition':_0x7488('0xb'),'callback':afterUpdate},{'channel':_0x7488('0x13'),'model':_0x7488('0x14'),'event':_0x7488('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':'FaxInteraction','event':_0x7488('0x7'),'condition':_0x7488('0x8'),'callback':afterCreate},{'channel':_0x7488('0x15'),'model':_0x7488('0x16'),'event':'afterUpdate','condition':_0x7488('0xb'),'callback':afterUpdate},{'channel':_0x7488('0x15'),'model':_0x7488('0x17'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x7488('0x18'),'model':_0x7488('0x19'),'event':_0x7488('0x7'),'condition':_0x7488('0x8'),'callback':afterCreate},{'channel':_0x7488('0x18'),'model':'MailInteraction','event':'afterUpdate','condition':_0x7488('0xb'),'callback':afterUpdate},{'channel':_0x7488('0x18'),'model':'MailMessage','event':_0x7488('0x7'),'condition':_0x7488('0xe'),'callback':afterCreateMessage},{'channel':_0x7488('0x1a'),'model':_0x7488('0x1b'),'event':_0x7488('0x7'),'condition':_0x7488('0x8'),'callback':afterCreate},{'channel':'Openchannel','model':_0x7488('0x1b'),'event':_0x7488('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x7488('0x1a'),'model':_0x7488('0x1c'),'event':_0x7488('0x7'),'condition':_0x7488('0xe'),'callback':afterCreateMessage}];function request(_0x4b541c){return client[_0x7488('0x1d')](_0x7488('0x1e'),_0x4b541c)[_0x7488('0x1f')](function(_0x32ecb3){logger[_0x7488('0x20')]('Trigger,\x20%s',_0x7488('0x1e'),_0x32ecb3);if(_0x32ecb3[_0x7488('0x21')]){if(_0x32ecb3[_0x7488('0x21')]['code']===0x1f4){logger[_0x7488('0x21')](_0x7488('0x22'),'EventManager',_0x32ecb3[_0x7488('0x21')]);}}})[_0x7488('0x23')](function(_0x510e37){logger[_0x7488('0x21')](_0x7488('0x22'),_0x7488('0x1e'),_0x510e37);});}function afterCreateMessage(_0x3dd36d){return function(_0x425d58){_0x425d58=_0x425d58[_0x7488('0x24')]({'plain':!![]});_0x425d58['channel']=_0x3dd36d;_0x425d58['motionChannel']=_0x3dd36d;_0x425d58[_0x7488('0x25')]=_0x425d58['direction'];Promise['resolve']()[_0x7488('0x1f')](function(){if(typeof _0x425d58[_0x7488('0x26')]===_0x7488('0x27'))return null;var _0x5c5d34=_0x7488('0x28')+_0x425d58['ContactId'];return db[_0x7488('0x29')][_0x7488('0x2a')](_0x5c5d34,{'type':db[_0x7488('0x2b')][_0x7488('0x2c')][_0x7488('0x2d')],'raw':!![]});})[_0x7488('0x1f')](function(_0x3d89c6){if(_0x3d89c6){_0x425d58[_0x7488('0x2e')]=_0x3d89c6[0x0];}if(typeof _0x425d58[_0x7488('0x2f')]===_0x7488('0x27'))return;return getAgent(_0x425d58[_0x7488('0x2f')]);})['then'](function(_0x2106ac){if(_0x2106ac){_0x425d58[_0x7488('0x30')]=util[_0x7488('0x31')](_0x7488('0x32'),_0x2106ac[_0x7488('0x33')]);_0x425d58[_0x7488('0x34')]=_0x2106ac;_0x425d58[_0x7488('0x35')]=_0x3dd36d;return request({'event':_0x7488('0x36'),'message':_0x425d58});}else{return request({'event':_0x7488('0x37'),'message':_0x425d58});}})['catch'](function(_0x11857f){logger[_0x7488('0x21')]('Trigger,\x20%s',_0x7488('0x38'),_0x11857f);});};}function afterCreateOfflineMessage(_0x532880){return function(_0x378b3b){_0x378b3b=_0x378b3b[_0x7488('0x24')]({'plain':!![]});_0x378b3b[_0x7488('0x35')]=_0x532880;_0x378b3b[_0x7488('0x39')]=_0x532880;_0x378b3b[_0x7488('0x25')]='offlineMessage';return request({'event':_0x378b3b['event'],'message':_0x378b3b});};}function afterCreate(_0x2498d3,_0x28099d){return function(_0x67ff30){_0x67ff30=_0x67ff30['get']({'plain':!![]});_0x67ff30[_0x7488('0x35')]=_0x2498d3;_0x67ff30['motionChannel']=_0x2498d3;_0x67ff30[_0x7488('0x25')]='opened';Promise['resolve']()[_0x7488('0x1f')](function(){var _0x3617f5=_0x7488('0x28')+_0x67ff30[_0x7488('0x26')];return db[_0x7488('0x29')][_0x7488('0x2a')](_0x3617f5,{'type':db[_0x7488('0x2b')][_0x7488('0x2c')][_0x7488('0x2d')],'raw':!![]});})[_0x7488('0x1f')](function(_0x3362a4){if(_0x3362a4){_0x67ff30[_0x7488('0x2e')]=_0x3362a4[0x0];}if(typeof _0x67ff30[_0x7488('0x2f')]==='undefined')return;return getAgent(_0x67ff30[_0x7488('0x2f')]);})[_0x7488('0x1f')](function(_0x17247e){if(_0x17247e){_0x67ff30[_0x7488('0x30')]=util[_0x7488('0x31')](_0x7488('0x32'),_0x17247e[_0x7488('0x33')]);_0x67ff30[_0x7488('0x34')]=_0x17247e;}return request({'event':_0x28099d,'message':_0x67ff30});})['catch'](function(_0x1550ed){logger[_0x7488('0x21')](_0x7488('0x22'),_0x7488('0x3a'),_0x1550ed);});};}function afterUpdate(_0x387e7c){return function(_0x3f06f1){var _0x1e6849=_0x3f06f1[_0x7488('0x3b')](_0x7488('0x3c'))&&_0x3f06f1[_0x7488('0x3c')];var _0x2a6ac0=_0x3f06f1['changed'](_0x7488('0x3d'));if(_0x1e6849||_0x2a6ac0){var _0x4bf818=_0x1e6849?_0x7488('0xb'):_0x7488('0x3d');var _0x305c35=_0x3f06f1[_0x7488('0x24')]({'plain':!![]});_0x305c35[_0x7488('0x35')]=_0x387e7c;_0x305c35[_0x7488('0x39')]=_0x387e7c;_0x305c35[_0x7488('0x25')]=_0x1e6849?'closed':_0x7488('0x3d');var _0x598034=_0x7488('0x28')+_0x305c35[_0x7488('0x26')];return db[_0x7488('0x29')][_0x7488('0x2a')](_0x598034,{'type':db[_0x7488('0x2b')][_0x7488('0x2c')][_0x7488('0x2d')],'raw':!![]})['then'](function(_0x554409){if(_0x554409){_0x305c35[_0x7488('0x2e')]=_0x554409[0x0];}if(typeof _0x305c35['UserId']===_0x7488('0x27'))return;return getAgent(_0x305c35[_0x7488('0x2f')]);})[_0x7488('0x1f')](function(_0x43742a){if(_0x43742a){_0x305c35[_0x7488('0x30')]=util[_0x7488('0x31')](_0x7488('0x32'),_0x43742a[_0x7488('0x33')]);_0x305c35[_0x7488('0x34')]=_0x43742a;}return request({'event':_0x4bf818,'message':_0x305c35});})[_0x7488('0x23')](function(_0x53f67b){logger['error'](_0x7488('0x22'),_0x7488('0x3e'),_0x53f67b);});}};}function getAgent(_0x10597b){return db[_0x7488('0x3f')][_0x7488('0x40')]({'where':{'id':_0x10597b},'attributes':['id',_0x7488('0x33'),_0x7488('0x41'),_0x7488('0x42'),'internal'],'raw':!![]})[_0x7488('0x1f')](function(_0x5be4a9){return _0x5be4a9;});}exports[_0x7488('0x43')]=function(){for(var _0x223627=0x0;_0x223627=_0x10a878[_0x3705('0x16')]){throw Error(_0x3705('0x17'));}_0x553459(_0x5f1ed3);})['catch'](function(_0x25c64c){_0x4ced73(_0x25c64c);});});}; \ No newline at end of file +var _0xd728=['agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','../mysqldb','chat','fax','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','User','then'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd728,0x66));var _0x8d72=function(_0x3353e3,_0x353cdb){_0x3353e3=_0x3353e3-0x0;var _0x258b5f=_0xd728[_0x3353e3];return _0x258b5f;};'use strict';var _=require(_0x8d72('0x0'));var BPromise=require(_0x8d72('0x1'));var db=require(_0x8d72('0x2'))['db'];var util=require('./license/util');var channels=['voice','mail',_0x8d72('0x3'),_0x8d72('0x4'),'sms',_0x8d72('0x5'),_0x8d72('0x6')];exports[_0x8d72('0x7')]=function(){return channels;};exports[_0x8d72('0x8')]=function(_0x2aba32){_0x2aba32=_0x2aba32[_0x8d72('0x9')]();return _['includes'](channels,_0x2aba32);};exports[_0x8d72('0xa')]=function(_0x11a546,_0x38165b,_0x5de20d,_0x304d12){var _0x155087={'loginAttempts':_0x38165b,'blocked':_0x5de20d};if(!_[_0x8d72('0xb')](_0x304d12)){_0x155087[_0x8d72('0xc')]=_0x304d12;}return _0x11a546[_0x8d72('0xd')](_0x155087);};exports[_0x8d72('0xe')]=function(_0x2439e9){return new BPromise(function(_0x5707b3,_0x4a6470){var _0x3db4ab=0x0;if(_0x2439e9[_0x8d72('0xf')]!=='agent'){_0x5707b3(_0x2439e9);}db[_0x8d72('0x10')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x2439e9['id']}}})[_0x8d72('0x11')](function(_0x3c52c0){_0x3db4ab=_0x3c52c0;return util[_0x8d72('0xe')]();})[_0x8d72('0x11')](function(_0x2ef45d){if(_0x2ef45d&&_0x2ef45d[_0x8d72('0x12')]&&_0x3db4ab>=_0x2ef45d[_0x8d72('0x12')]){throw Error(_0x8d72('0x13'));}_0x5707b3(_0x2439e9);})['catch'](function(_0x2bb77d){_0x4a6470(_0x2bb77d);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index cae2a6c..63fa78e 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a3d=['Resource\x20Conflict','Conflict','Out\x20Of\x20Interval','error','stack','statusMessage','status','util','../config/logger','message','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','details','OutOfInterval'];(function(_0x526cc1,_0x480cf3){var _0xb38e50=function(_0xbe5b30){while(--_0xbe5b30){_0x526cc1['push'](_0x526cc1['shift']());}};_0xb38e50(++_0x480cf3);}(_0x9a3d,0x70));var _0xd9a3=function(_0x178a30,_0x4e784a){_0x178a30=_0x178a30-0x0;var _0x42167c=_0x9a3d[_0x178a30];return _0x42167c;};'use strict';var util=require(_0xd9a3('0x0'));var logger=require(_0xd9a3('0x1'))('api');var APIError=function(_0x25ebff,_0x125dcb){this[_0xd9a3('0x2')]=_0x25ebff||_0xd9a3('0x3');this[_0xd9a3('0x4')]=_0x125dcb||_0xd9a3('0x5');util[_0xd9a3('0x6')](APIError,Error);};var APIBadRequestError=function(_0x5555ad){this['message']=_0x5555ad||_0xd9a3('0x7');this['name']='Bad\x20Request';util[_0xd9a3('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x22f52f){this[_0xd9a3('0x2')]=_0x22f52f||_0xd9a3('0x8');this[_0xd9a3('0x4')]=_0xd9a3('0x8');util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x281b86){this['message']=_0x281b86||_0xd9a3('0x9');this[_0xd9a3('0x4')]=_0xd9a3('0xa');util[_0xd9a3('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4a0d0b){this['message']=_0x4a0d0b||_0xd9a3('0xb');this[_0xd9a3('0x4')]='Out\x20Of\x20Interval';this['code']=0x193;this[_0xd9a3('0xc')]={'type':_0xd9a3('0xd')};util[_0xd9a3('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x42b012){this[_0xd9a3('0x2')]=_0x42b012||_0xd9a3('0xe');this[_0xd9a3('0x4')]=_0xd9a3('0xf');util['inherits'](APIBadRequestError,APIError);};function getStatusCode(_0x2cf191){switch(_0x2cf191){case _0xd9a3('0x7'):return 0x190;case _0xd9a3('0x8'),_0xd9a3('0x10'):return 0x193;case _0xd9a3('0xa'):return 0x194;case _0xd9a3('0xf'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x68a3d8){if(_0x68a3d8===_0xd9a3('0x10'))return _0x68a3d8;return null;}function handleError(_0x553950){return function(_0x174a51){logger[_0xd9a3('0x11')](_0x174a51[_0xd9a3('0x12')]);var _0x5dc05b=getStatusCode(_0x174a51[_0xd9a3('0x4')]);var _0x34f648=getCustomStatusMessage(_0x174a51['name']);if(_0x174a51[_0xd9a3('0x4')]){delete _0x174a51['name'];}if(_0x34f648){_0x553950[_0xd9a3('0x13')]=_0x34f648;}return _0x553950[_0xd9a3('0x14')](_0x5dc05b)['send'](_0x174a51);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x40fc=['status','send','util','../config/logger','message','Internal\x20Server\x20Error','Bad\x20Request','name','inherits','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','Resource\x20Conflict','Conflict','error'];(function(_0x54ebf3,_0x396a76){var _0x2f95b2=function(_0x52de77){while(--_0x52de77){_0x54ebf3['push'](_0x54ebf3['shift']());}};_0x2f95b2(++_0x396a76);}(_0x40fc,0x17c));var _0xc40f=function(_0x497b5c,_0x2a4c69){_0x497b5c=_0x497b5c-0x0;var _0x510283=_0x40fc[_0x497b5c];return _0x510283;};'use strict';var util=require(_0xc40f('0x0'));var logger=require(_0xc40f('0x1'))('api');var APIError=function(_0x583b9f,_0x3100ae){this[_0xc40f('0x2')]=_0x583b9f||_0xc40f('0x3');this['name']=_0x3100ae||'Error';util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x13a05b){this['message']=_0x13a05b||_0xc40f('0x4');this[_0xc40f('0x5')]=_0xc40f('0x4');util[_0xc40f('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0xb3633e){this['message']=_0xb3633e||'Forbidden';this[_0xc40f('0x5')]=_0xc40f('0x7');util[_0xc40f('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x526658){this['message']=_0x526658||_0xc40f('0x8');this[_0xc40f('0x5')]=_0xc40f('0x9');util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x11b3eb){this[_0xc40f('0x2')]=_0x11b3eb||_0xc40f('0xa');this[_0xc40f('0x5')]=_0xc40f('0xb');this[_0xc40f('0xc')]=0x193;this['details']={'type':'OutOfInterval'};util[_0xc40f('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x57d2d1){this['message']=_0x57d2d1||_0xc40f('0xd');this[_0xc40f('0x5')]=_0xc40f('0xe');util[_0xc40f('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0xf8c2ff){switch(_0xf8c2ff){case _0xc40f('0x4'):return 0x190;case _0xc40f('0x7'),'Out\x20Of\x20Interval':return 0x193;case _0xc40f('0x9'):return 0x194;case _0xc40f('0xe'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0xab08ec){if(_0xab08ec===_0xc40f('0xb'))return _0xab08ec;return null;}function handleError(_0x478f4f){return function(_0xdb405a){logger[_0xc40f('0xf')](_0xdb405a['stack']);var _0x32093e=getStatusCode(_0xdb405a[_0xc40f('0x5')]);var _0x3bc968=getCustomStatusMessage(_0xdb405a[_0xc40f('0x5')]);if(_0xdb405a[_0xc40f('0x5')]){delete _0xdb405a[_0xc40f('0x5')];}if(_0x3bc968){_0x478f4f['statusMessage']=_0x3bc968;}return _0x478f4f[_0xc40f('0x10')](_0x32093e)[_0xc40f('0x11')](_0xdb405a);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 64614b4..8cf7937 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2314=['send','exports','404','status','render','json'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2314,0x133));var _0x4231=function(_0x2fdf82,_0x322e7c){_0x2fdf82=_0x2fdf82-0x0;var _0x2382f5=_0x2314[_0x2fdf82];return _0x2382f5;};'use strict';module[_0x4231('0x0')][0x194]=function pageNotFound(_0x301e6e,_0x55dfc3){var _0x2606b7=_0x4231('0x1');var _0x23f38b=0x194;var _0x1963ab={'status':_0x23f38b};_0x55dfc3['status'](_0x1963ab[_0x4231('0x2')]);_0x55dfc3[_0x4231('0x3')](_0x2606b7,{},function(_0x36df8b,_0x478603){if(_0x36df8b){return _0x55dfc3['status'](_0x1963ab[_0x4231('0x2')])[_0x4231('0x4')](_0x1963ab);}_0x55dfc3[_0x4231('0x5')](_0x478603);});}; \ No newline at end of file +var _0x987f=['json','exports','status','render'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x987f,0x169));var _0xf987=function(_0x14a4d0,_0x4c7068){_0x14a4d0=_0x14a4d0-0x0;var _0x18c8ab=_0x987f[_0x14a4d0];return _0x18c8ab;};'use strict';module[_0xf987('0x0')][0x194]=function pageNotFound(_0x4ce5ec,_0x25751f){var _0x23b2b8='404';var _0x58255e=0x194;var _0xd53e93={'status':_0x58255e};_0x25751f[_0xf987('0x1')](_0xd53e93['status']);_0x25751f[_0xf987('0x2')](_0x23b2b8,{},function(_0x4b7e28,_0x522d7a){if(_0x4b7e28){return _0x25751f[_0xf987('0x1')](_0xd53e93[_0xf987('0x1')])[_0xf987('0x3')](_0xd53e93);}_0x25751f['send'](_0x522d7a);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index d6b6d39..a1bc8b2 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3db9=['user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoicePrefixes','MailQueues','UserMailQueue','ChatQueues','UserFaxQueue','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','ChatWebsites','FaxAccounts','MailAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','VoiceChanSpy','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopperHistory','HopperHistories','JscriptySessions','TrunkBackup','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','voice_queues_has_cm_blacklists','ScreenRecording','mailbox','mailboxuser','uniqueid','ContactId','MailServerIn','CloudProviderId','restrict','MailServerOut','MailAccountId','Dispositions','Answers','Messages','Interactions','List','ListId','TemplateId','mandatoryDispositionPauseId','user_has_mail_accounts','team_has_mail_queues','MailInteractionId','Owner','Tag','mail_interaction_has_tags','ThroughTags','Attachments','Contact','Interaction','Account','ChatOfflineMessageId','Items','FaxAccountId','CannedAnswer','FaxApplication','Exntensions','FaxMessage','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','Tags','Users','AttachmentId','Teams','SmsAccountId','TagId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','user_has_chat_websites','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','chat_group_has_users','Website','Phones','CmContactId','HopperFinals','Company','CompanyId','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OwnerId','All','OneAny','AutomationAnyId','AutomationId','ParentId','Intervals','FaxApplications','SmsApplications','DefaultReportId','whatsapp_interaction_has_tags','ItemType','Hopper','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','CustomReportId','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Field','Variable','VariableId','Description','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','ServicenowAccount','ServicenowConfiguration','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','user_has_teams','VoiceQueues','team_has_chat_queues','team_has_fax_queues','FaxQueues','SmsQueues','HopperBlacks','TrunkId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromAccount','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','Imap','exports','sequelize','jstz','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','database','username','password','options','import','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../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','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','CmHopperAdditionalPhone','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','User','hasOne','cascade','userSetting','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperHistory','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','UserNotification','UserNotifications','SenderId','Hoppers','SET\x20NULL','belongsTo','UserProfile','userProfileId','belongsToMany','Groups','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions'];(function(_0x1186ba,_0x421a86){var _0x13a347=function(_0x357acb){while(--_0x357acb){_0x1186ba['push'](_0x1186ba['shift']());}};_0x13a347(++_0x421a86);}(_0x3db9,0xcc));var _0x93db=function(_0x2f1430,_0x4557dd){_0x2f1430=_0x2f1430-0x0;var _0x1f8923=_0x3db9[_0x2f1430];return _0x1f8923;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x93db('0x0'));var _=require('lodash');var jstz=require(_0x93db('0x1'));var timezone=jstz[_0x93db('0x2')]();config[_0x93db('0x0')]=_['defaultsDeep'](config['sequelize'],{'database':_0x93db('0x3'),'username':_0x93db('0x4'),'password':_0x93db('0x5'),'options':{'host':_0x93db('0x6'),'port':0xcea,'dialect':_0x93db('0x7'),'dialectOptions':{'charset':_0x93db('0x8')},'logging':![],'timezone':timezone[_0x93db('0x9')](),'define':{'charset':_0x93db('0xa'),'collate':_0x93db('0xb')}}});config[_0x93db('0xc')]=_[_0x93db('0xd')](config[_0x93db('0xc')],{'database':'motion2','username':_0x93db('0x4'),'password':_0x93db('0x5'),'options':{'host':_0x93db('0x6'),'port':0xcea,'dialect':_0x93db('0x7'),'dialectOptions':{'charset':_0x93db('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x93db('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x93db('0x0')][_0x93db('0xe')],config[_0x93db('0x0')][_0x93db('0xf')],config[_0x93db('0x0')][_0x93db('0x10')],config['sequelize'][_0x93db('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x93db('0xc')][_0x93db('0xe')],config[_0x93db('0xc')][_0x93db('0xf')],config[_0x93db('0xc')][_0x93db('0x10')],config['sequelizeHistory'][_0x93db('0x11')])};db['User']=db[_0x93db('0x0')][_0x93db('0x12')]('../api/user/user.model');db['VoiceChanSpy']=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x13'));db['VoiceContext']=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x14'));db[_0x93db('0x15')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x16'));db[_0x93db('0x17')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x18'));db[_0x93db('0x19')]=db[_0x93db('0x0')]['import'](_0x93db('0x1a'));db[_0x93db('0x1b')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x1c'));db['ScreenRecording']=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x1d'));db[_0x93db('0x1e')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x1f'));db[_0x93db('0x20')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x21'));db[_0x93db('0x22')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x23'));db[_0x93db('0x24')]=db['sequelize'][_0x93db('0x12')](_0x93db('0x25'));db[_0x93db('0x26')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x27'));db[_0x93db('0x28')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x29'));db[_0x93db('0x2a')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/memberReport/memberReport.model');db[_0x93db('0x2b')]=db['sequelize']['import'](_0x93db('0x2c'));db[_0x93db('0x2d')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x2e'));db[_0x93db('0x2f')]=db['sequelize']['import'](_0x93db('0x30'));db[_0x93db('0x31')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x32'));db[_0x93db('0x33')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/userChatQueue/userChatQueue.model');db['UserMailQueue']=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x34'));db['UserFaxQueue']=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x35'));db[_0x93db('0x36')]=db['sequelize']['import'](_0x93db('0x37'));db[_0x93db('0x38')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x39'));db[_0x93db('0x3a')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db['sequelize'][_0x93db('0x12')](_0x93db('0x3b'));db['MailServerOut']=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x3c'));db[_0x93db('0x3d')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/mailAccount/mailAccount.model');db[_0x93db('0x3e')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x3f'));db['MailSubstatus']=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x40'));db[_0x93db('0x41')]=db['sequelize']['import'](_0x93db('0x42'));db[_0x93db('0x43')]=db[_0x93db('0x0')]['import'](_0x93db('0x44'));db[_0x93db('0x45')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x46'));db[_0x93db('0x47')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x48'));db[_0x93db('0x49')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x4a'));db['DashboardItem']=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x4b'));db[_0x93db('0x4c')]=db['sequelize'][_0x93db('0x12')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0x93db('0x0')][_0x93db('0x12')]('../api/faxApplication/faxApplication.model');db[_0x93db('0x4d')]=db['sequelize'][_0x93db('0x12')](_0x93db('0x4e'));db['FaxMessage']=db['sequelize'][_0x93db('0x12')](_0x93db('0x4f'));db[_0x93db('0x50')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/faxQueue/faxQueue.model');db[_0x93db('0x51')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x52'));db[_0x93db('0x53')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x54'));db[_0x93db('0x55')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x56'));db[_0x93db('0x57')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x58'));db[_0x93db('0x59')]=db[_0x93db('0x0')]['import'](_0x93db('0x5a'));db[_0x93db('0x5b')]=db['sequelize']['import']('../api/smsQueue/smsQueue.model');db[_0x93db('0x5c')]=db[_0x93db('0x0')]['import'](_0x93db('0x5d'));db[_0x93db('0x5e')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x5f'));db[_0x93db('0x60')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x93db('0x61')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x62'));db['OpenchannelQueue']=db['sequelize'][_0x93db('0x12')]('../api/openchannelQueue/openchannelQueue.model');db[_0x93db('0x63')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x64'));db[_0x93db('0x65')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x66'));db[_0x93db('0x67')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/chatApplication/chatApplication.model');db[_0x93db('0x68')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x69'));db[_0x93db('0x6a')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x6b'));db[_0x93db('0x6c')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x93db('0x6d')]=db[_0x93db('0x0')]['import'](_0x93db('0x6e'));db[_0x93db('0x6f')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/chatGroup/chatGroup.model');db[_0x93db('0x70')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x93db('0x71')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x72'));db[_0x93db('0x73')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x74'));db[_0x93db('0x75')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x76'));db[_0x93db('0x77')]=db[_0x93db('0x0')]['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0x93db('0x78')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x79'));db['CmHopperHistory']=db['sequelize'][_0x93db('0x12')](_0x93db('0x7a'));db[_0x93db('0x7b')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x7c'));db[_0x93db('0x7d')]=db[_0x93db('0x0')]['import'](_0x93db('0x7e'));db[_0x93db('0x7f')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x80'));db[_0x93db('0x81')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x82'));db['CannedAnswer']=db['sequelize']['import'](_0x93db('0x83'));db[_0x93db('0x84')]=db[_0x93db('0x0')]['import']('../api/disposition/disposition.model');db[_0x93db('0x85')]=db['sequelize'][_0x93db('0x12')](_0x93db('0x86'));db[_0x93db('0x87')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x88'));db[_0x93db('0x89')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x8a'));db[_0x93db('0x8b')]=db['sequelize']['import'](_0x93db('0x8c'));db[_0x93db('0x8d')]=db[_0x93db('0x0')]['import'](_0x93db('0x8e'));db[_0x93db('0x8f')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/schedule/schedule.model');db[_0x93db('0x90')]=db['sequelize'][_0x93db('0x12')]('../api/sound/sound.model');db['Tag']=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x91'));db[_0x93db('0x92')]=db[_0x93db('0x0')]['import'](_0x93db('0x93'));db[_0x93db('0x94')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/cmContactHasItem/cmContactHasItem.model');db[_0x93db('0x95')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x93db('0x96')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x97'));db[_0x93db('0x98')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x99'));db['Variable']=db[_0x93db('0x0')][_0x93db('0x12')]('../api/variable/variable.model');db['Integration']=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x9a'));db[_0x93db('0x9b')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x9c'));db[_0x93db('0x9d')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x9e'));db[_0x93db('0x9f')]=db[_0x93db('0x0')]['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x93db('0xa0')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xa1'));db[_0x93db('0xa2')]=db['sequelize'][_0x93db('0x12')](_0x93db('0xa3'));db[_0x93db('0xa4')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xa5'));db['AnalyticTreeReport']=db['sequelize']['import'](_0x93db('0xa6'));db['SalesforceAccount']=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xa7'));db['SalesforceConfiguration']=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xa8'));db[_0x93db('0xa9')]=db['sequelize'][_0x93db('0x12')](_0x93db('0xaa'));db[_0x93db('0xab')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x93db('0xac')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xad'));db[_0x93db('0xae')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xaf'));db[_0x93db('0xb0')]=db['sequelize'][_0x93db('0x12')](_0x93db('0xb1'));db[_0x93db('0xb2')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xb3'));db[_0x93db('0xb4')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/intDeskField/intDeskField.model');db[_0x93db('0xb5')]=db['sequelize'][_0x93db('0x12')](_0x93db('0xb6'));db[_0x93db('0xb7')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xb8'));db[_0x93db('0xb9')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xba'));db[_0x93db('0xbb')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xbc'));db[_0x93db('0xbd')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x93db('0xbe')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/intZendeskField/intZendeskField.model');db[_0x93db('0xbf')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xc0'));db['FreshdeskConfiguration']=db['sequelize'][_0x93db('0x12')](_0x93db('0xc1'));db[_0x93db('0xc2')]=db[_0x93db('0x0')]['import']('../api/intFreshdeskField/intFreshdeskField.model');db[_0x93db('0xc3')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xc4'));db[_0x93db('0xc5')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x93db('0xc6')]=db[_0x93db('0x0')]['import']('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xc7'));db['ServicenowConfiguration']=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xc8'));db[_0x93db('0xc9')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x93db('0xca')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xcb'));db[_0x93db('0xcc')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xcd'));db[_0x93db('0xce')]=db['sequelize'][_0x93db('0x12')](_0x93db('0xcf'));db[_0x93db('0xd0')]=db[_0x93db('0x0')]['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x93db('0xd1')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xd2'));db[_0x93db('0xd3')]=db['sequelize']['import']('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db['sequelize'][_0x93db('0x12')](_0x93db('0x9a'));db['Network']=db['sequelize'][_0x93db('0x12')](_0x93db('0xd4'));db[_0x93db('0xd5')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xd6'));db[_0x93db('0xd7')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x93db('0xd8')]=db['sequelize']['import'](_0x93db('0xd9'));db['JscriptyQuestionReport']=db[_0x93db('0x0')]['import'](_0x93db('0xda'));db[_0x93db('0xdb')]=db['sequelize'][_0x93db('0x12')](_0x93db('0xdc'));db[_0x93db('0xdd')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xde'));db[_0x93db('0xdf')]=db[_0x93db('0x0')]['import']('../api/squareReport/squareReport.model');db[_0x93db('0xe0')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xe1'));db[_0x93db('0xe2')]=db['sequelize'][_0x93db('0x12')]('../api/jscriptyProject/jscriptyProject.model');db[_0x93db('0xe3')]=db[_0x93db('0x0')]['import'](_0x93db('0xe4'));db['SquareOdbc']=db[_0x93db('0x0')]['import'](_0x93db('0xe5'));db[_0x93db('0xe6')]=db[_0x93db('0x0')]['import'](_0x93db('0xe7'));db['SquareRecording']=db['sequelize']['import'](_0x93db('0xe8'));db[_0x93db('0xe9')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xea'));db[_0x93db('0xeb')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xec'));db[_0x93db('0xed')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/license/license.model');db[_0x93db('0xee')]=db['sequelize'][_0x93db('0x12')]('../api/campaign/campaign.model');db['Migration']=db['sequelize'][_0x93db('0x12')](_0x93db('0xef'));db[_0x93db('0xf0')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xf1'));db[_0x93db('0xf2')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xf3'));db[_0x93db('0xf4')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0x93db('0x0')][_0x93db('0x12')]('../api/chatTransferReport/chatTransferReport.model');db[_0x93db('0xf5')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xf6'));db[_0x93db('0xf7')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xf8'));db[_0x93db('0xf9')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xfa'));db[_0x93db('0xfb')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xfc'));db[_0x93db('0xfd')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xfe'));db['UserProfileSection']=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0xff'));db[_0x93db('0x100')]=db['sequelize'][_0x93db('0x12')](_0x93db('0x101'));db['UserNotification']=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x102'));db[_0x93db('0x103')]=db[_0x93db('0x0')][_0x93db('0x12')]('../api/whatsappAccount/whatsappAccount.model');db[_0x93db('0x104')]=db[_0x93db('0x0')]['import'](_0x93db('0x105'));db[_0x93db('0x106')]=db[_0x93db('0x0')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db['sequelize']['import'](_0x93db('0x107'));db[_0x93db('0x108')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x109'));db[_0x93db('0x10a')]=db[_0x93db('0x0')]['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x93db('0x10b')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x10c'));db[_0x93db('0x10d')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x10e'));db[_0x93db('0x10f')]=db['sequelize']['import'](_0x93db('0x110'));db[_0x93db('0x111')]=db[_0x93db('0x0')][_0x93db('0x12')](_0x93db('0x112'));db[_0x93db('0x113')]=db['sequelize'][_0x93db('0x12')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x93db('0x114')]=db['sequelize'][_0x93db('0x12')](_0x93db('0x115'));db[_0x93db('0x116')]=db['sequelize'][_0x93db('0x12')](_0x93db('0x117'));db[_0x93db('0x118')][_0x93db('0x119')](db[_0x93db('0x1e')],{'as':_0x93db('0x1e'),'onDelete':_0x93db('0x11a'),'foreignKey':'UserId'});db[_0x93db('0x118')][_0x93db('0x119')](db[_0x93db('0x114')],{'as':_0x93db('0x11b'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x11c')});db[_0x93db('0x118')][_0x93db('0x11d')](db[_0x93db('0x1b')],{'as':_0x93db('0x11e'),'foreignKey':'UserId'});db[_0x93db('0x118')][_0x93db('0x11d')](db['UserVoiceQueueRt'],{'as':_0x93db('0x11f'),'foreignKey':_0x93db('0x11c')});db[_0x93db('0x118')][_0x93db('0x11d')](db[_0x93db('0x15')],{'as':_0x93db('0x120'),'onDelete':'cascade','hooks':!![]});db[_0x93db('0x118')]['hasMany'](db[_0x93db('0x78')],{'as':'HopperFinals','foreignKey':'UserId'});db['User']['hasMany'](db['CmHopperHistory'],{'as':_0x93db('0x121'),'foreignKey':_0x93db('0x11c')});db[_0x93db('0x118')][_0x93db('0x11d')](db[_0x93db('0x7b')],{'as':'ReportAgentPreview','foreignKey':_0x93db('0x11c')});db[_0x93db('0x118')]['hasMany'](db[_0x93db('0x60')],{'as':'OpenchannelInteractions','foreignKey':_0x93db('0x11c')});db[_0x93db('0x118')][_0x93db('0x11d')](db[_0x93db('0x68')],{'as':_0x93db('0x122'),'foreignKey':_0x93db('0x11c')});db[_0x93db('0x118')][_0x93db('0x11d')](db[_0x93db('0x57')],{'as':_0x93db('0x123'),'foreignKey':_0x93db('0x11c')});db[_0x93db('0x118')]['hasMany'](db['FaxInteraction'],{'as':_0x93db('0x124'),'foreignKey':_0x93db('0x11c')});db['User'][_0x93db('0x11d')](db[_0x93db('0x41')],{'as':_0x93db('0x125'),'foreignKey':'UserId'});db[_0x93db('0x118')][_0x93db('0x11d')](db[_0x93db('0x106')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0x93db('0x118')]['hasMany'](db[_0x93db('0x126')],{'as':_0x93db('0x127'),'foreignKey':_0x93db('0x128')});db[_0x93db('0x118')][_0x93db('0x11d')](db[_0x93db('0x75')],{'as':_0x93db('0x129'),'foreignKey':_0x93db('0x11c'),'onDelete':_0x93db('0x12a')});db[_0x93db('0x118')][_0x93db('0x12b')](db['UserProfile'],{'as':_0x93db('0x12c'),'foreignKey':_0x93db('0x12d')});db[_0x93db('0x118')][_0x93db('0x12e')](db['ChatGroup'],{'as':_0x93db('0x12f'),'through':'chat_group_has_users'});db[_0x93db('0x118')][_0x93db('0x12e')](db[_0x93db('0x73')],{'as':_0x93db('0x130'),'through':_0x93db('0x131')});db[_0x93db('0x118')][_0x93db('0x12e')](db[_0x93db('0xfb')],{'as':_0x93db('0x132'),'through':_0x93db('0x133')});db[_0x93db('0x118')][_0x93db('0x12e')](db[_0x93db('0xeb')],{'through':'user_has_teams'});db[_0x93db('0x118')][_0x93db('0x12e')](db['MailInteraction'],{'as':'MailInteractions','through':_0x93db('0x134')});db[_0x93db('0x118')][_0x93db('0x12e')](db[_0x93db('0x68')],{'as':_0x93db('0x122'),'through':_0x93db('0x135')});db[_0x93db('0x118')]['belongsToMany'](db[_0x93db('0x4d')],{'as':_0x93db('0x124'),'through':_0x93db('0x136')});db[_0x93db('0x118')]['belongsToMany'](db[_0x93db('0x57')],{'as':_0x93db('0x123'),'through':_0x93db('0x137')});db['User']['belongsToMany'](db[_0x93db('0x60')],{'as':_0x93db('0x138'),'through':_0x93db('0x139')});db[_0x93db('0x118')]['belongsToMany'](db[_0x93db('0x106')],{'as':'WhatsappInteractions','through':_0x93db('0x13a')});db[_0x93db('0x118')][_0x93db('0x12e')](db[_0x93db('0x19')],{'as':'VoiceQueues','through':_0x93db('0x31'),'required':![]});db[_0x93db('0x118')][_0x93db('0x12e')](db[_0x93db('0xfd')],{'as':_0x93db('0x13b'),'through':_0x93db('0x113'),'required':![]});db['User'][_0x93db('0x12e')](db[_0x93db('0x3e')],{'as':_0x93db('0x13c'),'through':_0x93db('0x13d'),'required':![]});db[_0x93db('0x118')]['belongsToMany'](db['ChatQueue'],{'as':_0x93db('0x13e'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0x93db('0x12e')](db[_0x93db('0x50')],{'as':'FaxQueues','through':_0x93db('0x13f'),'required':![]});db[_0x93db('0x118')]['belongsToMany'](db[_0x93db('0x5b')],{'as':'SmsQueues','through':_0x93db('0x36'),'required':![]});db[_0x93db('0x118')]['belongsToMany'](db[_0x93db('0x140')],{'as':_0x93db('0x141'),'through':_0x93db('0x38'),'required':![]});db[_0x93db('0x118')]['belongsToMany'](db['WhatsappQueue'],{'as':_0x93db('0x142'),'through':_0x93db('0x3a'),'required':![]});db[_0x93db('0x118')]['belongsToMany'](db[_0x93db('0xfb')],{'through':_0x93db('0x133')});db[_0x93db('0x118')]['belongsToMany'](db[_0x93db('0x63')],{'as':_0x93db('0x143'),'through':'user_has_chat_websites'});db[_0x93db('0x118')]['belongsToMany'](db[_0x93db('0x4c')],{'as':_0x93db('0x144'),'through':'user_has_fax_accounts'});db[_0x93db('0x118')][_0x93db('0x12e')](db[_0x93db('0x3d')],{'as':_0x93db('0x145'),'through':'user_has_mail_accounts'});db['User'][_0x93db('0x12e')](db[_0x93db('0x5c')],{'as':'OpenchannelAccounts','through':_0x93db('0x146')});db[_0x93db('0x118')][_0x93db('0x12e')](db[_0x93db('0x53')],{'as':_0x93db('0x147'),'through':_0x93db('0x148')});db[_0x93db('0x118')][_0x93db('0x12e')](db[_0x93db('0x103')],{'as':_0x93db('0x149'),'through':_0x93db('0x14a')});db[_0x93db('0x14b')]['hasMany'](db[_0x93db('0x15')],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0x93db('0x14c')});db[_0x93db('0x14d')][_0x93db('0x11d')](db[_0x93db('0x15')],{'onDelete':_0x93db('0x11a')});db[_0x93db('0x15')][_0x93db('0x11d')](db[_0x93db('0x15')],{'as':_0x93db('0x14e'),'onDelete':_0x93db('0x11a')});db[_0x93db('0x17')]['belongsToMany'](db['Sound'],{'as':_0x93db('0x14f'),'through':_0x93db('0x150')});db[_0x93db('0x19')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x93db('0x151'),'foreignKey':_0x93db('0x152')});db[_0x93db('0x19')][_0x93db('0x11d')](db['CmHopper'],{'as':_0x93db('0x129'),'foreignKey':_0x93db('0x152')});db[_0x93db('0x19')]['hasMany'](db[_0x93db('0x78')],{'as':'HopperFinals','foreignKey':_0x93db('0x152')});db[_0x93db('0x19')][_0x93db('0x11d')](db[_0x93db('0x153')],{'as':_0x93db('0x154'),'foreignKey':_0x93db('0x152')});db[_0x93db('0x19')]['hasMany'](db[_0x93db('0x7b')],{'as':_0x93db('0x7b'),'foreignKey':'VoiceQueueId'});db[_0x93db('0x19')][_0x93db('0x11d')](db[_0x93db('0x77')],{'as':'HopperBlacks','foreignKey':_0x93db('0x152')});db[_0x93db('0x19')][_0x93db('0x11d')](db[_0x93db('0xdb')],{'as':_0x93db('0x155'),'foreignKey':_0x93db('0x152')});db[_0x93db('0x19')][_0x93db('0x12b')](db[_0x93db('0x2b')],{'as':_0x93db('0x2b'),'foreignKey':'TrunkId'});db[_0x93db('0x19')][_0x93db('0x12b')](db[_0x93db('0x2b')],{'as':_0x93db('0x156'),'foreignKey':'TrunkBackupId'});db[_0x93db('0x19')][_0x93db('0x12b')](db[_0x93db('0x87')],{'as':'Interval','foreignKey':_0x93db('0x157')});db['VoiceQueue'][_0x93db('0x12b')](db['Pause'],{'as':_0x93db('0x158'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x93db('0x19')][_0x93db('0x12e')](db[_0x93db('0xfb')],{'as':_0x93db('0x132'),'through':_0x93db('0x159')});db[_0x93db('0x19')]['belongsToMany'](db[_0x93db('0x118')],{'as':_0x93db('0x15a'),'through':_0x93db('0x31')});db[_0x93db('0x19')][_0x93db('0x12e')](db[_0x93db('0xeb')],{'as':'Teams','through':'TeamVoiceQueue'});db['VoiceQueue'][_0x93db('0x12e')](db[_0x93db('0xfb')],{'as':'BlackLists','through':_0x93db('0x15b')});db[_0x93db('0x1b')]['belongsTo'](db[_0x93db('0x118')],{'as':_0x93db('0x118'),'foreignKey':_0x93db('0x11c')});db[_0x93db('0x15c')][_0x93db('0x12b')](db[_0x93db('0x118')],{'as':_0x93db('0x118'),'foreignKey':_0x93db('0x11c')});db['VoiceMail'][_0x93db('0x11d')](db[_0x93db('0x20')],{'as':'Messages','onDelete':_0x93db('0x11a'),'foreignKey':'mailboxuser','sourceKey':_0x93db('0x15d')});db[_0x93db('0x20')][_0x93db('0x12b')](db['VoiceMail'],{'foreignKey':_0x93db('0x15e'),'targetKey':'mailbox'});db[_0x93db('0x22')]['hasMany'](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':_0x93db('0x15f'),'constraints':![]});db[_0x93db('0x22')][_0x93db('0x11d')](db[_0x93db('0x26')],{'as':'AgentReports','foreignKey':_0x93db('0x15f'),'constraints':![]});db[_0x93db('0x22')]['belongsTo'](db[_0x93db('0x118')],{'as':'User','foreignKey':'UserId'});db['VoiceCallReport']['belongsTo'](db[_0x93db('0x73')],{'as':'Contact','foreignKey':_0x93db('0x160')});db[_0x93db('0x161')][_0x93db('0x12b')](db[_0x93db('0x3d')],{'as':_0x93db('0x3d'),'foreignKey':'MailAccountId'});db['MailServerIn'][_0x93db('0x12b')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x93db('0x162'),'onDelete':_0x93db('0x163')});db[_0x93db('0x164')]['belongsTo'](db[_0x93db('0x3d')],{'as':_0x93db('0x3d'),'foreignKey':_0x93db('0x165')});db[_0x93db('0x164')][_0x93db('0x12b')](db[_0x93db('0x10d')],{'as':_0x93db('0x10d'),'foreignKey':_0x93db('0x162'),'onDelete':'restrict'});db[_0x93db('0x3d')][_0x93db('0x119')](db[_0x93db('0x161')],{'as':'Imap','onDelete':_0x93db('0x11a')});db[_0x93db('0x3d')][_0x93db('0x119')](db[_0x93db('0x164')],{'as':'Smtp','onDelete':_0x93db('0x11a')});db[_0x93db('0x3d')][_0x93db('0x11d')](db[_0x93db('0x84')],{'as':_0x93db('0x166'),'foreignKey':'MailAccountId','onDelete':_0x93db('0x11a')});db[_0x93db('0x3d')][_0x93db('0x11d')](db['CannedAnswer'],{'as':_0x93db('0x167'),'foreignKey':_0x93db('0x165')});db[_0x93db('0x3d')][_0x93db('0x11d')](db['MailMessage'],{'as':_0x93db('0x168'),'foreignKey':_0x93db('0x165')});db[_0x93db('0x3d')]['hasMany'](db[_0x93db('0x41')],{'as':_0x93db('0x169')});db['MailAccount'][_0x93db('0x11d')](db[_0x93db('0x45')],{'as':_0x93db('0x14e'),'foreignKey':_0x93db('0x165'),'onDelete':'cascade'});db[_0x93db('0x3d')][_0x93db('0x12b')](db[_0x93db('0xfb')],{'as':_0x93db('0x16a'),'foreignKey':_0x93db('0x16b')});db[_0x93db('0x3d')][_0x93db('0x12b')](db['Template'],{'as':_0x93db('0x96'),'foreignKey':_0x93db('0x16c')});db[_0x93db('0x3d')][_0x93db('0x12b')](db[_0x93db('0x89')],{'as':_0x93db('0x158'),'foreignKey':_0x93db('0x16d')});db[_0x93db('0x3d')][_0x93db('0x12e')](db[_0x93db('0x118')],{'as':'Agents','through':_0x93db('0x16e')});db[_0x93db('0x3e')][_0x93db('0x12e')](db[_0x93db('0x118')],{'as':_0x93db('0x15a'),'through':_0x93db('0x13d')});db[_0x93db('0x3e')][_0x93db('0x12e')](db[_0x93db('0xeb')],{'through':_0x93db('0x16f'),'as':'Teams'});db[_0x93db('0x41')]['hasMany'](db[_0x93db('0x43')],{'as':_0x93db('0x168'),'onDelete':'cascade','foreignKey':_0x93db('0x170')});db[_0x93db('0x41')]['belongsTo'](db[_0x93db('0x3d')],{'as':'Account','foreignKey':_0x93db('0x165')});db['MailInteraction'][_0x93db('0x12b')](db[_0x93db('0x73')],{'as':'Contact','foreignKey':_0x93db('0x160')});db[_0x93db('0x41')][_0x93db('0x12b')](db[_0x93db('0x118')],{'as':_0x93db('0x171'),'foreignKey':_0x93db('0x11c')});db[_0x93db('0x41')][_0x93db('0x12e')](db[_0x93db('0x172')],{'through':_0x93db('0x173'),'as':'Tags'});db[_0x93db('0x41')][_0x93db('0x12e')](db[_0x93db('0x172')],{'through':_0x93db('0x173'),'as':_0x93db('0x174')});db['MailInteraction'][_0x93db('0x12e')](db[_0x93db('0x118')],{'as':'Users','through':_0x93db('0x134'),'foreignKey':'MailInteractionId'});db[_0x93db('0x43')][_0x93db('0x11d')](db['Attachment'],{'as':_0x93db('0x175'),'onDelete':_0x93db('0x11a')});db[_0x93db('0x43')][_0x93db('0x12b')](db[_0x93db('0x118')],{'as':_0x93db('0x118')});db[_0x93db('0x43')][_0x93db('0x12b')](db['CmContact'],{'onDelete':'cascade','as':_0x93db('0x176')});db[_0x93db('0x43')][_0x93db('0x12b')](db['MailInteraction'],{'as':_0x93db('0x177'),'foreignKey':_0x93db('0x170')});db[_0x93db('0x43')][_0x93db('0x12b')](db['MailAccount'],{'as':_0x93db('0x178'),'foreignKey':_0x93db('0x165')});db[_0x93db('0x43')]['belongsTo'](db[_0x93db('0x63')],{'as':'ChatWebsite','foreignKey':'ChatWebsiteId'});db[_0x93db('0x43')][_0x93db('0x12b')](db['ChatOfflineMessage'],{'as':_0x93db('0x6c'),'foreignKey':_0x93db('0x179')});db[_0x93db('0x45')][_0x93db('0x12b')](db['User'],{'onDelete':_0x93db('0x163')});db['MailApplication']['belongsTo'](db[_0x93db('0x3e')],{'onDelete':'restrict'});db[_0x93db('0x45')][_0x93db('0x12b')](db[_0x93db('0x3d')],{'onDelete':_0x93db('0x163')});db[_0x93db('0x45')]['belongsTo'](db[_0x93db('0x87')],{'onDelete':'restrict','foreignKey':_0x93db('0x157')});db['MailApplication'][_0x93db('0x12b')](db[_0x93db('0x172')],{'onDelete':_0x93db('0x163'),'foreignKey':'TagId'});db[_0x93db('0x47')][_0x93db('0x12b')](db[_0x93db('0x3d')],{});db[_0x93db('0x47')][_0x93db('0x12b')](db[_0x93db('0xfb')],{'as':_0x93db('0x16a'),'foreignKey':_0x93db('0x16b')});db['MailQueueReport'][_0x93db('0x12b')](db[_0x93db('0x73')],{'as':_0x93db('0x176'),'foreignKey':'ContactId'});db[_0x93db('0x47')][_0x93db('0x12b')](db[_0x93db('0x41')],{});db[_0x93db('0x47')][_0x93db('0x12b')](db[_0x93db('0x43')],{});db[_0x93db('0x47')][_0x93db('0x12b')](db[_0x93db('0x118')],{});db[_0x93db('0x47')][_0x93db('0x12b')](db['MailQueue'],{});db[_0x93db('0x49')]['hasMany'](db['DashboardItem'],{'as':_0x93db('0x17a'),'onDelete':_0x93db('0x11a')});db['FaxAccount'][_0x93db('0x11d')](db['Disposition'],{'as':_0x93db('0x166'),'foreignKey':_0x93db('0x17b'),'onDelete':_0x93db('0x11a')});db['FaxAccount'][_0x93db('0x11d')](db[_0x93db('0x17c')],{'as':_0x93db('0x167'),'foreignKey':_0x93db('0x17b')});db[_0x93db('0x4c')][_0x93db('0x11d')](db[_0x93db('0x4d')],{'as':_0x93db('0x169')});db[_0x93db('0x4c')][_0x93db('0x11d')](db[_0x93db('0x17d')],{'as':'Applications','foreignKey':_0x93db('0x17b'),'onDelete':_0x93db('0x11a')});db[_0x93db('0x4c')][_0x93db('0x11d')](db[_0x93db('0x15')],{'as':_0x93db('0x17e'),'onDelete':'cascade'});db[_0x93db('0x4c')][_0x93db('0x11d')](db[_0x93db('0x17f')],{'as':'Messages'});db[_0x93db('0x4c')][_0x93db('0x12b')](db[_0x93db('0x2b')],{'as':'Trunk'});db[_0x93db('0x4c')][_0x93db('0x12b')](db['CmList'],{'as':'List','foreignKey':_0x93db('0x16b')});db[_0x93db('0x4c')]['belongsTo'](db[_0x93db('0x89')],{'as':'mandatoryDispositionPause','foreignKey':_0x93db('0x16d')});db['FaxAccount'][_0x93db('0x12e')](db[_0x93db('0x118')],{'as':_0x93db('0x15a'),'through':_0x93db('0x180')});db[_0x93db('0x17d')]['belongsTo'](db[_0x93db('0x118')],{'onDelete':_0x93db('0x163')});db[_0x93db('0x17d')]['belongsTo'](db[_0x93db('0x50')],{'onDelete':'restrict'});db[_0x93db('0x17d')][_0x93db('0x12b')](db[_0x93db('0x4c')],{'onDelete':'restrict'});db[_0x93db('0x17d')][_0x93db('0x12b')](db[_0x93db('0x172')],{'onDelete':_0x93db('0x163'),'foreignKey':'TagId'});db[_0x93db('0x4d')][_0x93db('0x11d')](db[_0x93db('0x17f')],{'as':'Messages','onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x181')});db['FaxInteraction']['belongsTo'](db[_0x93db('0x4c')],{'as':_0x93db('0x178'),'foreignKey':_0x93db('0x17b')});db[_0x93db('0x4d')][_0x93db('0x12b')](db[_0x93db('0x73')],{'as':'Contact','foreignKey':_0x93db('0x160')});db['FaxInteraction']['belongsTo'](db[_0x93db('0x118')],{'as':'Owner','foreignKey':'UserId'});db[_0x93db('0x4d')][_0x93db('0x12e')](db[_0x93db('0x172')],{'through':_0x93db('0x182'),'as':_0x93db('0x183')});db[_0x93db('0x4d')]['belongsToMany'](db[_0x93db('0x172')],{'through':_0x93db('0x182'),'as':'ThroughTags'});db['FaxInteraction'][_0x93db('0x12e')](db[_0x93db('0x118')],{'as':_0x93db('0x184'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x93db('0x12b')](db['User'],{'onDelete':_0x93db('0x11a'),'as':_0x93db('0x118')});db[_0x93db('0x17f')][_0x93db('0x12b')](db[_0x93db('0x4d')],{'as':_0x93db('0x177'),'foreignKey':'FaxInteractionId'});db[_0x93db('0x17f')]['belongsTo'](db[_0x93db('0x73')],{'onDelete':_0x93db('0x11a'),'as':'Contact'});db[_0x93db('0x17f')]['belongsTo'](db[_0x93db('0xf0')],{'as':_0x93db('0xf0'),'foreignKey':_0x93db('0x185')});db[_0x93db('0x17f')][_0x93db('0x12b')](db[_0x93db('0x4c')],{'as':_0x93db('0x178'),'foreignKey':_0x93db('0x17b')});db[_0x93db('0x50')][_0x93db('0x12e')](db[_0x93db('0x118')],{'as':_0x93db('0x15a'),'through':'UserFaxQueue'});db[_0x93db('0x50')][_0x93db('0x12e')](db['Team'],{'through':'team_has_fax_queues','as':_0x93db('0x186')});db[_0x93db('0x51')][_0x93db('0x12b')](db[_0x93db('0x4c')],{});db[_0x93db('0x51')]['belongsTo'](db[_0x93db('0xfb')],{'as':_0x93db('0x16a'),'foreignKey':_0x93db('0x16b')});db[_0x93db('0x51')]['belongsTo'](db[_0x93db('0x73')],{'as':_0x93db('0x176'),'foreignKey':_0x93db('0x160')});db[_0x93db('0x51')]['belongsTo'](db['FaxInteraction'],{});db['FaxQueueReport'][_0x93db('0x12b')](db['FaxMessage'],{});db[_0x93db('0x51')][_0x93db('0x12b')](db[_0x93db('0x118')],{});db['FaxQueueReport'][_0x93db('0x12b')](db[_0x93db('0x50')],{});db[_0x93db('0x53')][_0x93db('0x11d')](db[_0x93db('0x84')],{'as':_0x93db('0x166'),'foreignKey':_0x93db('0x187'),'onDelete':_0x93db('0x11a')});db[_0x93db('0x53')][_0x93db('0x11d')](db[_0x93db('0x17c')],{'as':_0x93db('0x167'),'foreignKey':'SmsAccountId'});db[_0x93db('0x53')][_0x93db('0x11d')](db['SmsMessage'],{'as':_0x93db('0x168'),'foreignKey':_0x93db('0x187')});db[_0x93db('0x53')][_0x93db('0x11d')](db[_0x93db('0x57')],{'as':_0x93db('0x169')});db[_0x93db('0x53')][_0x93db('0x11d')](db[_0x93db('0x55')],{'as':_0x93db('0x14e'),'foreignKey':_0x93db('0x187'),'onDelete':_0x93db('0x11a')});db[_0x93db('0x53')][_0x93db('0x12b')](db[_0x93db('0xfb')],{'as':_0x93db('0x16a'),'foreignKey':_0x93db('0x16b')});db['SmsAccount'][_0x93db('0x12b')](db[_0x93db('0x89')],{'as':_0x93db('0x158'),'foreignKey':_0x93db('0x16d')});db[_0x93db('0x53')]['belongsToMany'](db['User'],{'as':_0x93db('0x15a'),'through':'user_has_sms_accounts'});db[_0x93db('0x55')][_0x93db('0x12b')](db[_0x93db('0x118')],{'onDelete':'restrict'});db[_0x93db('0x55')][_0x93db('0x12b')](db[_0x93db('0x5b')],{'onDelete':_0x93db('0x163')});db[_0x93db('0x55')][_0x93db('0x12b')](db['SmsAccount'],{'onDelete':_0x93db('0x163')});db['SmsApplication']['belongsTo'](db[_0x93db('0x87')],{'onDelete':_0x93db('0x163'),'foreignKey':'IntervalId'});db[_0x93db('0x55')]['belongsTo'](db[_0x93db('0x172')],{'onDelete':'restrict','foreignKey':_0x93db('0x188')});db['SmsInteraction'][_0x93db('0x11d')](db[_0x93db('0x59')],{'as':_0x93db('0x168'),'onDelete':_0x93db('0x11a'),'foreignKey':'SmsInteractionId'});db[_0x93db('0x57')][_0x93db('0x12b')](db['SmsAccount'],{'as':_0x93db('0x178'),'foreignKey':_0x93db('0x187')});db['SmsInteraction'][_0x93db('0x12b')](db[_0x93db('0x73')],{'as':_0x93db('0x176'),'foreignKey':'ContactId'});db['SmsInteraction'][_0x93db('0x12b')](db[_0x93db('0x118')],{'as':_0x93db('0x171'),'foreignKey':_0x93db('0x11c')});db[_0x93db('0x57')]['belongsToMany'](db[_0x93db('0x172')],{'through':_0x93db('0x189'),'as':_0x93db('0x183')});db[_0x93db('0x57')]['belongsToMany'](db[_0x93db('0x172')],{'through':_0x93db('0x189'),'as':'ThroughTags'});db[_0x93db('0x57')][_0x93db('0x12e')](db[_0x93db('0x118')],{'as':_0x93db('0x184'),'through':_0x93db('0x137'),'foreignKey':_0x93db('0x18a')});db[_0x93db('0x59')]['belongsTo'](db[_0x93db('0x118')],{'as':_0x93db('0x118')});db[_0x93db('0x59')][_0x93db('0x12b')](db[_0x93db('0x73')],{'onDelete':'cascade','as':_0x93db('0x176')});db[_0x93db('0x59')][_0x93db('0x12b')](db['SmsInteraction'],{'onDelete':'cascade','as':_0x93db('0x177'),'foreignKey':_0x93db('0x18a')});db[_0x93db('0x59')]['belongsTo'](db[_0x93db('0x53')],{'as':_0x93db('0x178'),'foreignKey':'SmsAccountId'});db[_0x93db('0x5b')][_0x93db('0x12e')](db[_0x93db('0x118')],{'as':'Agents','through':'UserSmsQueue','foreignKey':_0x93db('0x18b')});db[_0x93db('0x5b')][_0x93db('0x12e')](db[_0x93db('0xeb')],{'through':_0x93db('0x18c'),'as':'Teams'});db[_0x93db('0x5c')][_0x93db('0x11d')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x93db('0x18d'),'onDelete':'cascade'});db[_0x93db('0x5c')][_0x93db('0x11d')](db[_0x93db('0x17c')],{'as':_0x93db('0x167'),'foreignKey':_0x93db('0x18d')});db[_0x93db('0x5c')][_0x93db('0x11d')](db[_0x93db('0x60')],{'as':_0x93db('0x169'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x93db('0x11d')](db[_0x93db('0x61')],{'as':'Messages','foreignKey':_0x93db('0x18d')});db['OpenchannelAccount'][_0x93db('0x11d')](db[_0x93db('0x5e')],{'as':'Applications','foreignKey':'OpenchannelAccountId','onDelete':'cascade'});db[_0x93db('0x5c')][_0x93db('0x12b')](db[_0x93db('0xfb')],{'as':_0x93db('0x16a'),'foreignKey':_0x93db('0x16b')});db['OpenchannelAccount'][_0x93db('0x12b')](db[_0x93db('0x89')],{'as':_0x93db('0x158'),'foreignKey':_0x93db('0x16d')});db[_0x93db('0x5c')]['belongsToMany'](db[_0x93db('0x118')],{'as':_0x93db('0x15a'),'through':_0x93db('0x146')});db[_0x93db('0x5e')][_0x93db('0x12b')](db[_0x93db('0x118')],{'onDelete':'restrict'});db[_0x93db('0x5e')][_0x93db('0x12b')](db[_0x93db('0x140')],{'onDelete':_0x93db('0x163'),'foreignKey':_0x93db('0x18e')});db[_0x93db('0x5e')]['belongsTo'](db[_0x93db('0x5c')],{'onDelete':_0x93db('0x163'),'foreignKey':_0x93db('0x18d')});db[_0x93db('0x5e')][_0x93db('0x12b')](db['Interval'],{'onDelete':_0x93db('0x163'),'foreignKey':_0x93db('0x157')});db[_0x93db('0x5e')][_0x93db('0x12b')](db[_0x93db('0x172')],{'onDelete':_0x93db('0x163'),'foreignKey':_0x93db('0x188')});db[_0x93db('0x60')][_0x93db('0x11d')](db[_0x93db('0x61')],{'as':_0x93db('0x168'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x18f')});db[_0x93db('0x60')][_0x93db('0x12b')](db['OpenchannelAccount'],{'as':_0x93db('0x178'),'foreignKey':_0x93db('0x18d')});db[_0x93db('0x60')][_0x93db('0x12b')](db[_0x93db('0x73')],{'as':'Contact','foreignKey':_0x93db('0x160')});db[_0x93db('0x60')][_0x93db('0x12b')](db[_0x93db('0x118')],{'as':_0x93db('0x171'),'foreignKey':_0x93db('0x11c')});db[_0x93db('0x60')][_0x93db('0x12e')](db['Tag'],{'through':_0x93db('0x190'),'as':_0x93db('0x183')});db['OpenchannelInteraction'][_0x93db('0x12e')](db[_0x93db('0x172')],{'through':_0x93db('0x190'),'as':_0x93db('0x174')});db['OpenchannelInteraction']['belongsToMany'](db['User'],{'as':'Users','through':_0x93db('0x139'),'foreignKey':_0x93db('0x18f')});db[_0x93db('0x61')][_0x93db('0x12b')](db[_0x93db('0x118')],{'onDelete':'cascade','as':_0x93db('0x118')});db[_0x93db('0x61')]['belongsTo'](db[_0x93db('0x73')],{'onDelete':_0x93db('0x11a'),'as':_0x93db('0x176')});db[_0x93db('0x61')][_0x93db('0x12b')](db['OpenchannelInteraction'],{'onDelete':_0x93db('0x11a'),'as':_0x93db('0x177'),'foreignKey':_0x93db('0x18f')});db[_0x93db('0x61')][_0x93db('0x12b')](db[_0x93db('0xf0')],{'as':'Attachment','foreignKey':_0x93db('0x185')});db[_0x93db('0x61')]['belongsTo'](db['OpenchannelAccount'],{'as':_0x93db('0x178'),'foreignKey':_0x93db('0x18d')});db[_0x93db('0x140')][_0x93db('0x12e')](db[_0x93db('0x118')],{'as':_0x93db('0x15a'),'through':_0x93db('0x38'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue'][_0x93db('0x12e')](db[_0x93db('0xeb')],{'through':_0x93db('0x191'),'as':_0x93db('0x186')});db[_0x93db('0x63')][_0x93db('0x11d')](db[_0x93db('0x84')],{'as':_0x93db('0x166'),'foreignKey':_0x93db('0x192'),'onDelete':_0x93db('0x11a')});db[_0x93db('0x63')]['hasMany'](db[_0x93db('0x17c')],{'as':_0x93db('0x167'),'foreignKey':_0x93db('0x192')});db['ChatWebsite'][_0x93db('0x11d')](db[_0x93db('0x70')],{'as':_0x93db('0x193')});db[_0x93db('0x63')]['hasMany'](db[_0x93db('0x68')],{'as':_0x93db('0x169')});db[_0x93db('0x63')][_0x93db('0x11d')](db['ChatApplication'],{'as':_0x93db('0x14e'),'foreignKey':_0x93db('0x192'),'onDelete':_0x93db('0x11a')});db[_0x93db('0x63')][_0x93db('0x11d')](db['ChatMessage'],{'as':_0x93db('0x168')});db['ChatWebsite'][_0x93db('0x12b')](db[_0x93db('0xfb')],{'as':_0x93db('0x16a'),'foreignKey':_0x93db('0x16b')});db[_0x93db('0x63')][_0x93db('0x12b')](db['Interval'],{'as':'Interval','foreignKey':_0x93db('0x157')});db['ChatWebsite']['belongsTo'](db['MailAccount'],{'as':_0x93db('0x3d'),'foreignKey':'MailAccountId'});db[_0x93db('0x63')][_0x93db('0x12b')](db[_0x93db('0x89')],{'as':_0x93db('0x158'),'foreignKey':_0x93db('0x16d')});db[_0x93db('0x63')][_0x93db('0x12e')](db[_0x93db('0x118')],{'as':_0x93db('0x15a'),'through':_0x93db('0x194')});db[_0x93db('0x65')]['belongsTo'](db[_0x93db('0x5c')],{});db[_0x93db('0x65')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x93db('0x16b')});db[_0x93db('0x65')][_0x93db('0x12b')](db['CmContact'],{'as':_0x93db('0x176'),'foreignKey':_0x93db('0x160')});db[_0x93db('0x65')][_0x93db('0x12b')](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport'][_0x93db('0x12b')](db[_0x93db('0x61')],{});db[_0x93db('0x65')][_0x93db('0x12b')](db['User'],{});db[_0x93db('0x65')][_0x93db('0x12b')](db['OpenchannelQueue'],{});db['ChatApplication'][_0x93db('0x12b')](db['User'],{'as':_0x93db('0x195'),'foreignKey':'UserId','onDelete':_0x93db('0x163')});db['ChatApplication'][_0x93db('0x12b')](db[_0x93db('0x6d')],{'as':_0x93db('0x196'),'foreignKey':_0x93db('0x197'),'onDelete':_0x93db('0x163')});db['ChatApplication']['belongsTo'](db['ChatWebsite'],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':'restrict'});db['ChatApplication'][_0x93db('0x12b')](db[_0x93db('0x172')],{'onDelete':_0x93db('0x163'),'foreignKey':_0x93db('0x188')});db['ChatInteraction'][_0x93db('0x11d')](db[_0x93db('0x6a')],{'as':_0x93db('0x168'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x198')});db[_0x93db('0x68')][_0x93db('0x12b')](db[_0x93db('0x63')],{'as':_0x93db('0x178'),'foreignKey':_0x93db('0x192')});db[_0x93db('0x68')][_0x93db('0x12b')](db[_0x93db('0x73')],{'as':_0x93db('0x176'),'foreignKey':_0x93db('0x160')});db[_0x93db('0x68')]['belongsTo'](db[_0x93db('0x118')],{'as':'Owner','foreignKey':_0x93db('0x11c')});db['ChatInteraction'][_0x93db('0x12e')](db['Tag'],{'through':_0x93db('0x199'),'as':'Tags'});db[_0x93db('0x68')]['belongsToMany'](db[_0x93db('0x172')],{'through':'chat_interaction_has_tags','as':'ThroughTags'});db[_0x93db('0x68')][_0x93db('0x12e')](db['User'],{'as':_0x93db('0x184'),'through':_0x93db('0x135'),'foreignKey':'ChatInteractionId'});db[_0x93db('0x6a')]['belongsTo'](db[_0x93db('0x118')],{'onDelete':_0x93db('0x11a'),'as':_0x93db('0x118')});db[_0x93db('0x6a')][_0x93db('0x12b')](db[_0x93db('0x73')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x93db('0x160')});db[_0x93db('0x6a')][_0x93db('0x12b')](db[_0x93db('0x68')],{'onDelete':_0x93db('0x11a'),'as':_0x93db('0x177'),'foreignKey':_0x93db('0x198')});db[_0x93db('0x6a')]['belongsTo'](db[_0x93db('0xf0')],{'as':_0x93db('0xf0'),'foreignKey':_0x93db('0x185')});db[_0x93db('0x6a')][_0x93db('0x12b')](db[_0x93db('0x63')],{'as':_0x93db('0x178'),'foreignKey':_0x93db('0x192')});db[_0x93db('0x6c')]['hasMany'](db[_0x93db('0xf0')],{'as':_0x93db('0x175'),'foreignKey':_0x93db('0x179'),'onDelete':'cascade','hooks':!![]});db[_0x93db('0x6c')][_0x93db('0x12b')](db[_0x93db('0x73')],{'onDelete':_0x93db('0x11a'),'as':_0x93db('0x176'),'foreignKey':_0x93db('0x160')});db['ChatOfflineMessage']['belongsTo'](db[_0x93db('0x63')],{'as':_0x93db('0x178'),'foreignKey':_0x93db('0x192')});db['ChatQueue'][_0x93db('0x12e')](db[_0x93db('0x118')],{'as':_0x93db('0x15a'),'through':_0x93db('0x33'),'hooks':!![]});db[_0x93db('0x6d')]['belongsToMany'](db[_0x93db('0xeb')],{'through':'team_has_chat_queues','as':_0x93db('0x186')});db[_0x93db('0x6f')]['hasMany'](db[_0x93db('0xd7')],{'as':_0x93db('0x168'),'foreignKey':_0x93db('0x19a'),'onDelete':_0x93db('0x11a')});db[_0x93db('0x6f')][_0x93db('0x12e')](db[_0x93db('0x118')],{'as':_0x93db('0x151'),'through':_0x93db('0x19b')});db['ChatProactiveAction']['belongsTo'](db[_0x93db('0x63')],{'as':_0x93db('0x19c'),'foreignKey':_0x93db('0x192')});db[_0x93db('0x71')][_0x93db('0x11d')](db[_0x93db('0x73')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact'][_0x93db('0x11d')](db[_0x93db('0x94')],{'as':_0x93db('0x19d'),'foreignKey':_0x93db('0x19e')});db[_0x93db('0x73')][_0x93db('0x11d')](db['CmHopper'],{'as':_0x93db('0x129'),'foreignKey':_0x93db('0x160')});db['CmContact']['hasMany'](db[_0x93db('0x78')],{'as':_0x93db('0x19f'),'foreignKey':_0x93db('0x160')});db[_0x93db('0x73')][_0x93db('0x11d')](db[_0x93db('0x153')],{'as':_0x93db('0x154'),'foreignKey':_0x93db('0x160')});db[_0x93db('0x73')][_0x93db('0x11d')](db[_0x93db('0x7b')],{'as':_0x93db('0x7b'),'foreignKey':_0x93db('0x160')});db[_0x93db('0x73')][_0x93db('0x11d')](db[_0x93db('0xdb')],{'as':_0x93db('0x155'),'foreignKey':_0x93db('0x160')});db[_0x93db('0x73')][_0x93db('0x11d')](db[_0x93db('0x60')],{'as':_0x93db('0x138'),'foreignKey':_0x93db('0x160'),'onDelete':_0x93db('0x163')});db['CmContact']['hasMany'](db[_0x93db('0x68')],{'as':'ChatInteractions','foreignKey':_0x93db('0x160'),'onDelete':'restrict'});db['CmContact'][_0x93db('0x11d')](db[_0x93db('0x57')],{'as':'SmsInteractions','foreignKey':_0x93db('0x160'),'onDelete':_0x93db('0x163')});db['CmContact'][_0x93db('0x11d')](db[_0x93db('0x4d')],{'as':_0x93db('0x124'),'foreignKey':_0x93db('0x160'),'onDelete':_0x93db('0x163')});db[_0x93db('0x73')][_0x93db('0x11d')](db[_0x93db('0x41')],{'as':_0x93db('0x125'),'foreignKey':_0x93db('0x160'),'onDelete':_0x93db('0x163')});db[_0x93db('0x73')]['belongsTo'](db[_0x93db('0x71')],{'as':_0x93db('0x1a0'),'foreignKey':_0x93db('0x1a1')});db[_0x93db('0x73')][_0x93db('0x12b')](db[_0x93db('0xfb')],{'as':_0x93db('0x16a'),'foreignKey':_0x93db('0x16b'),'onDelete':_0x93db('0x11a')});db['CmContact'][_0x93db('0x12e')](db[_0x93db('0x118')],{'as':_0x93db('0x184'),'through':_0x93db('0x131')});db['CmContact'][_0x93db('0x12e')](db[_0x93db('0x172')],{'as':_0x93db('0x183'),'through':'cm_contact_has_tags'});db[_0x93db('0x73')]['belongsToMany'](db[_0x93db('0x172')],{'through':_0x93db('0x1a2'),'as':_0x93db('0x174')});db[_0x93db('0x75')]['hasMany'](db[_0x93db('0x95')],{'as':_0x93db('0x1a3'),'foreignKey':_0x93db('0x1a4')});db['CmHopper']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x93db('0x160'),'onDelete':_0x93db('0x11a')});db['CmHopper'][_0x93db('0x12b')](db[_0x93db('0xfb')],{'as':'List','foreignKey':_0x93db('0x16b'),'onDelete':_0x93db('0x11a')});db[_0x93db('0x75')][_0x93db('0x12b')](db[_0x93db('0x118')],{'as':'Agent','foreignKey':_0x93db('0x11c')});db[_0x93db('0x75')][_0x93db('0x12b')](db[_0x93db('0x19')],{'as':'Queue','foreignKey':_0x93db('0x152'),'onDelete':_0x93db('0x11a')});db[_0x93db('0x75')][_0x93db('0x12b')](db[_0x93db('0xee')],{'as':_0x93db('0xee'),'foreignKey':_0x93db('0x1a5'),'onDelete':_0x93db('0x11a')});db[_0x93db('0x75')]['belongsTo'](db[_0x93db('0x118')],{'as':_0x93db('0x171'),'foreignKey':_0x93db('0x1a6')});db['CmHopperBlack']['belongsTo'](db[_0x93db('0x73')],{'as':_0x93db('0x176'),'foreignKey':'ContactId','onDelete':_0x93db('0x11a')});db[_0x93db('0x77')]['belongsTo'](db[_0x93db('0xfb')],{'as':_0x93db('0x16a'),'foreignKey':_0x93db('0x16b'),'onDelete':_0x93db('0x11a')});db['CmHopperBlack'][_0x93db('0x12b')](db['VoiceQueue'],{'as':_0x93db('0x196'),'foreignKey':_0x93db('0x152'),'onDelete':_0x93db('0x11a')});db[_0x93db('0x77')]['belongsTo'](db[_0x93db('0xee')],{'as':_0x93db('0xee'),'foreignKey':'CampaignId','onDelete':_0x93db('0x11a')});db[_0x93db('0x81')][_0x93db('0x11d')](db[_0x93db('0x85')],{'as':{'plural':_0x93db('0x1a7'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':_0x93db('0x11a'),'hooks':!![]});db[_0x93db('0x81')][_0x93db('0x11d')](db[_0x93db('0x85')],{'as':{'plural':'Any','singular':_0x93db('0x1a8')},'foreignKey':_0x93db('0x1a9'),'onDelete':_0x93db('0x11a'),'hooks':!![]});db[_0x93db('0x81')][_0x93db('0x11d')](db[_0x93db('0x7f')],{'as':'Actions','foreignKey':_0x93db('0x1aa'),'onDelete':_0x93db('0x11a'),'hooks':!![]});db[_0x93db('0x84')][_0x93db('0x11d')](db[_0x93db('0x84')],{'as':_0x93db('0x166'),'foreignKey':_0x93db('0x1ab'),'onDelete':_0x93db('0x11a')});db[_0x93db('0x87')][_0x93db('0x11d')](db['Interval'],{'as':_0x93db('0x1ac'),'foreignKey':_0x93db('0x157'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x93db('0x87')][_0x93db('0x11d')](db['VoiceExtension'],{'as':_0x93db('0x120'),'foreignKey':_0x93db('0x157'),'onDelete':'restrict'});db[_0x93db('0x87')][_0x93db('0x11d')](db[_0x93db('0x45')],{'as':'MailApplications','foreignKey':_0x93db('0x157')});db[_0x93db('0x87')][_0x93db('0x11d')](db[_0x93db('0x67')],{'as':'ChatApplications','foreignKey':_0x93db('0x157')});db[_0x93db('0x87')][_0x93db('0x11d')](db[_0x93db('0x17d')],{'as':_0x93db('0x1ad'),'foreignKey':_0x93db('0x157')});db[_0x93db('0x87')]['hasMany'](db[_0x93db('0x55')],{'as':_0x93db('0x1ae'),'foreignKey':_0x93db('0x157')});db[_0x93db('0x8f')][_0x93db('0x12b')](db[_0x93db('0x3d')],{});db[_0x93db('0x8f')][_0x93db('0x12b')](db[_0x93db('0x9f')],{'foreignKey':_0x93db('0x1af')});db[_0x93db('0x8f')]['belongsTo'](db[_0x93db('0x9d')],{'foreignKey':'CustomReportId'});db['Sound'][_0x93db('0x12e')](db[_0x93db('0x17')],{'as':'Mohs','through':_0x93db('0x150'),'onDelete':_0x93db('0x163')});db['Tag'][_0x93db('0x12e')](db[_0x93db('0x73')],{'through':_0x93db('0x1a2')});db[_0x93db('0x172')][_0x93db('0x12e')](db[_0x93db('0x68')],{'through':_0x93db('0x199')});db[_0x93db('0x172')][_0x93db('0x12e')](db['MailInteraction'],{'through':_0x93db('0x173')});db[_0x93db('0x172')]['belongsToMany'](db[_0x93db('0x57')],{'through':_0x93db('0x189')});db['Tag'][_0x93db('0x12e')](db['FaxInteraction'],{'through':_0x93db('0x182')});db[_0x93db('0x172')][_0x93db('0x12e')](db[_0x93db('0x60')],{'through':_0x93db('0x190')});db[_0x93db('0x172')][_0x93db('0x12e')](db[_0x93db('0x106')],{'through':_0x93db('0x1b0')});db[_0x93db('0x94')][_0x93db('0x12b')](db[_0x93db('0x92')],{'as':_0x93db('0x1b1'),'foreignKey':'ItemTypeId'});db[_0x93db('0x95')]['belongsTo'](db['CmHopper'],{'as':_0x93db('0x1b2'),'foreignKey':_0x93db('0x1a4')});db[_0x93db('0x94')]['belongsTo'](db['CmContact'],{'as':_0x93db('0x176'),'foreignKey':_0x93db('0x19e')});db[_0x93db('0x98')][_0x93db('0x11d')](db[_0x93db('0x85')],{'as':{'plural':_0x93db('0x1b3'),'singular':_0x93db('0x1b4')},'foreignKey':_0x93db('0x1b5'),'onDelete':'cascade','hooks':!![]});db['Trigger']['hasMany'](db[_0x93db('0x85')],{'as':{'plural':'AnyConditions','singular':_0x93db('0x1b6')},'foreignKey':_0x93db('0x1b7'),'onDelete':_0x93db('0x11a'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x93db('0x7f')],{'as':_0x93db('0x1b8'),'foreignKey':_0x93db('0x1b9'),'onDelete':_0x93db('0x11a'),'hooks':!![]});db[_0x93db('0x9d')]['hasMany'](db[_0x93db('0xa4')],{'as':_0x93db('0x1ba'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1bb'),'hooks':!![]});db[_0x93db('0x9f')]['hasMany'](db[_0x93db('0xa4')],{'as':'Fields','onDelete':_0x93db('0x11a'),'foreignKey':'DefaultReportId'});db[_0x93db('0xa2')][_0x93db('0x11d')](db[_0x93db('0xa4')],{'as':_0x93db('0x1ba'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1bc')});db[_0x93db('0xa4')]['belongsTo'](db[_0x93db('0xa2')],{'foreignKey':_0x93db('0x1bc')});db['SalesforceAccount'][_0x93db('0x11d')](db[_0x93db('0x1bd')],{'as':_0x93db('0x1be'),'onDelete':'cascade','foreignKey':_0x93db('0x1bf')});db[_0x93db('0x1bd')][_0x93db('0x11d')](db['SalesforceField'],{'as':_0x93db('0x1c0'),'onDelete':_0x93db('0x11a'),'foreignKey':'SubjectId'});db['SalesforceConfiguration']['hasMany'](db[_0x93db('0xa9')],{'as':_0x93db('0x1c1'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1c2')});db[_0x93db('0x1bd')][_0x93db('0x11d')](db[_0x93db('0xa9')],{'as':_0x93db('0x1ba'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1c3')});db[_0x93db('0x1bd')][_0x93db('0x12b')](db['SalesforceAccount'],{'as':'Account','foreignKey':_0x93db('0x1bf')});db['SalesforceField']['hasMany'](db[_0x93db('0xa9')],{'as':_0x93db('0x1c4'),'foreignKey':_0x93db('0x1c5')});db['SalesforceField'][_0x93db('0x11d')](db['SalesforceField'],{'as':'Description','foreignKey':_0x93db('0x1c2')});db[_0x93db('0xa9')][_0x93db('0x11d')](db[_0x93db('0xa9')],{'as':_0x93db('0x1c6'),'foreignKey':'FieldId'});db[_0x93db('0xa9')][_0x93db('0x12b')](db[_0x93db('0x1c7')],{'as':_0x93db('0x1c7'),'foreignKey':_0x93db('0x1c8')});db[_0x93db('0xab')][_0x93db('0x11d')](db['SugarcrmConfiguration'],{'as':_0x93db('0x1be'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1bf')});db[_0x93db('0xac')][_0x93db('0x11d')](db[_0x93db('0xae')],{'as':_0x93db('0x1c0'),'onDelete':_0x93db('0x11a'),'foreignKey':'SubjectId'});db[_0x93db('0xac')][_0x93db('0x11d')](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1c2')});db['SugarcrmConfiguration'][_0x93db('0x11d')](db[_0x93db('0xae')],{'as':_0x93db('0x1ba'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1c3')});db[_0x93db('0xac')]['belongsTo'](db[_0x93db('0xab')],{'as':_0x93db('0x178'),'foreignKey':_0x93db('0x1bf')});db[_0x93db('0xae')][_0x93db('0x11d')](db[_0x93db('0xae')],{'as':_0x93db('0x1c4'),'foreignKey':_0x93db('0x1c5')});db[_0x93db('0xae')][_0x93db('0x11d')](db['SugarcrmField'],{'as':_0x93db('0x1c9'),'foreignKey':'DescriptionId'});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x93db('0x1c6'),'foreignKey':'FieldId'});db[_0x93db('0xae')][_0x93db('0x12b')](db[_0x93db('0x1c7')],{'as':'Variable','foreignKey':_0x93db('0x1c8')});db[_0x93db('0xb0')][_0x93db('0x11d')](db['DeskConfiguration'],{'as':_0x93db('0x1be'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1bf')});db[_0x93db('0xb2')][_0x93db('0x11d')](db[_0x93db('0xb4')],{'as':'Subjects','onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1c5')});db['DeskConfiguration'][_0x93db('0x11d')](db[_0x93db('0xb4')],{'as':_0x93db('0x1c1'),'onDelete':_0x93db('0x11a'),'foreignKey':'DescriptionId'});db[_0x93db('0xb2')][_0x93db('0x11d')](db['DeskField'],{'as':_0x93db('0x1ba'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1c3')});db['DeskConfiguration'][_0x93db('0x12b')](db['DeskAccount'],{'as':'Account','foreignKey':_0x93db('0x1bf')});db['DeskConfiguration'][_0x93db('0x12e')](db[_0x93db('0x172')],{'through':_0x93db('0x1ca')});db[_0x93db('0xb4')][_0x93db('0x11d')](db[_0x93db('0xb4')],{'as':_0x93db('0x1c4'),'foreignKey':_0x93db('0x1c5')});db[_0x93db('0xb4')]['hasMany'](db[_0x93db('0xb4')],{'as':'Description','foreignKey':'DescriptionId'});db['DeskField']['hasMany'](db[_0x93db('0xb4')],{'as':_0x93db('0x1c6'),'foreignKey':_0x93db('0x1c3')});db[_0x93db('0xb4')][_0x93db('0x12b')](db[_0x93db('0x1c7')],{'as':'Variable','foreignKey':_0x93db('0x1c8')});db[_0x93db('0xb5')][_0x93db('0x11d')](db[_0x93db('0xb7')],{'as':_0x93db('0x1be'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1bf')});db[_0x93db('0xb7')]['hasMany'](db[_0x93db('0xb9')],{'as':_0x93db('0x1c0'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1c5')});db[_0x93db('0xb7')][_0x93db('0x11d')](db[_0x93db('0xb9')],{'as':_0x93db('0x1c1'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1c2')});db['ZohoConfiguration'][_0x93db('0x11d')](db[_0x93db('0xb9')],{'as':_0x93db('0x1ba'),'onDelete':'cascade','foreignKey':'FieldId'});db['ZohoConfiguration']['belongsTo'](db['ZohoAccount'],{'as':'Account','foreignKey':_0x93db('0x1bf')});db[_0x93db('0xb9')][_0x93db('0x11d')](db[_0x93db('0xb9')],{'as':'Subject','foreignKey':_0x93db('0x1c5')});db['ZohoField']['hasMany'](db['ZohoField'],{'as':_0x93db('0x1c9'),'foreignKey':_0x93db('0x1c2')});db[_0x93db('0xb9')][_0x93db('0x11d')](db[_0x93db('0xb9')],{'as':_0x93db('0x1c6'),'foreignKey':_0x93db('0x1c3')});db[_0x93db('0xb9')]['belongsTo'](db[_0x93db('0x1c7')],{'as':_0x93db('0x1c7'),'foreignKey':_0x93db('0x1c8')});db[_0x93db('0xbb')]['hasMany'](db['ZendeskConfiguration'],{'as':_0x93db('0x1be'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1bf')});db[_0x93db('0xbd')][_0x93db('0x11d')](db[_0x93db('0xbe')],{'as':_0x93db('0x1c0'),'foreignKey':_0x93db('0x1c5')});db[_0x93db('0xbd')][_0x93db('0x11d')](db[_0x93db('0xbe')],{'as':_0x93db('0x1c1'),'foreignKey':'DescriptionId'});db['ZendeskConfiguration']['hasMany'](db[_0x93db('0xbe')],{'as':_0x93db('0x1ba'),'foreignKey':_0x93db('0x1c3')});db[_0x93db('0xbd')][_0x93db('0x12b')](db['ZendeskAccount'],{'as':_0x93db('0x178'),'foreignKey':_0x93db('0x1bf')});db['ZendeskConfiguration'][_0x93db('0x12e')](db[_0x93db('0x172')],{'through':_0x93db('0x1cb')});db['ZendeskField'][_0x93db('0x11d')](db['ZendeskField'],{'as':_0x93db('0x1c4'),'foreignKey':_0x93db('0x1c5')});db[_0x93db('0xbe')][_0x93db('0x11d')](db['ZendeskField'],{'as':_0x93db('0x1c9'),'foreignKey':_0x93db('0x1c2')});db[_0x93db('0xbe')][_0x93db('0x11d')](db[_0x93db('0xbe')],{'as':_0x93db('0x1c6'),'foreignKey':'FieldId'});db[_0x93db('0xbe')][_0x93db('0x12b')](db[_0x93db('0x1c7')],{'as':_0x93db('0x1c7'),'foreignKey':_0x93db('0x1c8')});db[_0x93db('0xbf')][_0x93db('0x11d')](db[_0x93db('0x1cc')],{'as':_0x93db('0x1be'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1bf')});db[_0x93db('0x1cc')][_0x93db('0x11d')](db[_0x93db('0xc2')],{'as':'Subjects','onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1c5')});db[_0x93db('0x1cc')][_0x93db('0x11d')](db[_0x93db('0xc2')],{'as':_0x93db('0x1c1'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1c2')});db[_0x93db('0x1cc')][_0x93db('0x11d')](db[_0x93db('0xc2')],{'as':_0x93db('0x1ba'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1c3')});db[_0x93db('0x1cc')][_0x93db('0x12b')](db[_0x93db('0xbf')],{'as':_0x93db('0x178'),'foreignKey':_0x93db('0x1bf')});db[_0x93db('0x1cc')][_0x93db('0x12e')](db[_0x93db('0x172')],{'through':_0x93db('0x1cd')});db[_0x93db('0xc2')][_0x93db('0x11d')](db[_0x93db('0xc2')],{'as':'Subject','foreignKey':_0x93db('0x1c5')});db['FreshdeskField'][_0x93db('0x11d')](db[_0x93db('0xc2')],{'as':_0x93db('0x1c9'),'foreignKey':_0x93db('0x1c2')});db['FreshdeskField'][_0x93db('0x11d')](db[_0x93db('0xc2')],{'as':'Field','foreignKey':_0x93db('0x1c3')});db[_0x93db('0xc2')]['belongsTo'](db[_0x93db('0x1c7')],{'as':_0x93db('0x1c7'),'foreignKey':'VariableId'});db[_0x93db('0xc3')][_0x93db('0x11d')](db[_0x93db('0xc5')],{'as':_0x93db('0x1be'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1bf')});db[_0x93db('0xc5')][_0x93db('0x11d')](db[_0x93db('0xc6')],{'as':_0x93db('0x1c0'),'foreignKey':_0x93db('0x1c5')});db['VtigerConfiguration'][_0x93db('0x11d')](db['VtigerField'],{'as':_0x93db('0x1c1'),'foreignKey':'DescriptionId'});db[_0x93db('0xc5')][_0x93db('0x11d')](db['VtigerField'],{'as':'Fields','foreignKey':_0x93db('0x1c3')});db[_0x93db('0xc5')][_0x93db('0x12b')](db[_0x93db('0xc3')],{'as':'Account','foreignKey':'AccountId'});db[_0x93db('0xc6')][_0x93db('0x11d')](db[_0x93db('0xc6')],{'as':_0x93db('0x1c4'),'foreignKey':_0x93db('0x1c5')});db[_0x93db('0xc6')][_0x93db('0x11d')](db['VtigerField'],{'as':_0x93db('0x1c9'),'foreignKey':_0x93db('0x1c2')});db[_0x93db('0xc6')][_0x93db('0x11d')](db['VtigerField'],{'as':_0x93db('0x1c6'),'foreignKey':_0x93db('0x1c3')});db[_0x93db('0xc6')]['belongsTo'](db[_0x93db('0x1c7')],{'as':_0x93db('0x1c7'),'foreignKey':_0x93db('0x1c8')});db[_0x93db('0x1ce')][_0x93db('0x11d')](db[_0x93db('0x1cf')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x93db('0x1cf')][_0x93db('0x11d')](db[_0x93db('0xc9')],{'as':_0x93db('0x1c0'),'foreignKey':_0x93db('0x1c5')});db[_0x93db('0x1cf')][_0x93db('0x11d')](db[_0x93db('0xc9')],{'as':_0x93db('0x1c1'),'foreignKey':_0x93db('0x1c2')});db['ServicenowConfiguration']['hasMany'](db[_0x93db('0xc9')],{'as':_0x93db('0x1ba'),'foreignKey':_0x93db('0x1c3')});db[_0x93db('0x1cf')][_0x93db('0x12b')](db[_0x93db('0x1ce')],{'as':'Account','foreignKey':'AccountId'});db[_0x93db('0xc9')][_0x93db('0x11d')](db['ServicenowField'],{'as':_0x93db('0x1c4'),'foreignKey':_0x93db('0x1c5')});db[_0x93db('0xc9')]['hasMany'](db[_0x93db('0xc9')],{'as':_0x93db('0x1c9'),'foreignKey':_0x93db('0x1c2')});db[_0x93db('0xc9')]['hasMany'](db[_0x93db('0xc9')],{'as':_0x93db('0x1c6'),'foreignKey':_0x93db('0x1c3')});db[_0x93db('0xc9')][_0x93db('0x12b')](db[_0x93db('0x1c7')],{'as':_0x93db('0x1c7'),'foreignKey':_0x93db('0x1c8')});db[_0x93db('0xca')][_0x93db('0x11d')](db[_0x93db('0xcc')],{'as':_0x93db('0x1be'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1bf')});db[_0x93db('0xca')]['belongsTo'](db[_0x93db('0x10d')],{'as':_0x93db('0x10d'),'foreignKey':_0x93db('0x162')});db['Dynamics365Configuration']['hasMany'](db[_0x93db('0xce')],{'as':'Subjects','onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1c5')});db['Dynamics365Configuration'][_0x93db('0x11d')](db[_0x93db('0xce')],{'as':'Descriptions','onDelete':_0x93db('0x11a'),'foreignKey':'DescriptionId'});db[_0x93db('0xcc')][_0x93db('0x11d')](db[_0x93db('0xce')],{'as':'Fields','onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1c3')});db[_0x93db('0xcc')][_0x93db('0x12b')](db[_0x93db('0xca')],{'as':'Account','foreignKey':_0x93db('0x1bf')});db[_0x93db('0xce')][_0x93db('0x11d')](db['Dynamics365Field'],{'as':_0x93db('0x1c4'),'foreignKey':_0x93db('0x1c5')});db[_0x93db('0xce')]['hasMany'](db[_0x93db('0xce')],{'as':_0x93db('0x1c9'),'foreignKey':_0x93db('0x1c2')});db[_0x93db('0xce')][_0x93db('0x11d')](db[_0x93db('0xce')],{'as':_0x93db('0x1c6'),'foreignKey':'FieldId'});db[_0x93db('0xce')][_0x93db('0x12b')](db[_0x93db('0x1c7')],{'as':_0x93db('0x1c7'),'foreignKey':_0x93db('0x1c8')});db[_0x93db('0xd0')][_0x93db('0x11d')](db[_0x93db('0xd1')],{'as':_0x93db('0x1be'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1bf')});db[_0x93db('0xd1')][_0x93db('0x11d')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x93db('0x1c5')});db[_0x93db('0xd1')][_0x93db('0x11d')](db[_0x93db('0xd3')],{'as':_0x93db('0x1c1'),'foreignKey':_0x93db('0x1c2')});db[_0x93db('0xd1')][_0x93db('0x11d')](db[_0x93db('0xd3')],{'as':_0x93db('0x1ba'),'foreignKey':_0x93db('0x1c3')});db[_0x93db('0xd1')][_0x93db('0x12b')](db[_0x93db('0xd0')],{'as':_0x93db('0x178'),'foreignKey':_0x93db('0x1bf')});db[_0x93db('0xd3')]['hasMany'](db[_0x93db('0xd3')],{'as':_0x93db('0x1c4'),'foreignKey':_0x93db('0x1c5')});db[_0x93db('0xd3')][_0x93db('0x11d')](db[_0x93db('0xd3')],{'as':'Description','foreignKey':_0x93db('0x1c2')});db['FreshsalesField'][_0x93db('0x11d')](db[_0x93db('0xd3')],{'as':_0x93db('0x1c6'),'foreignKey':_0x93db('0x1c3')});db[_0x93db('0xd3')][_0x93db('0x12b')](db[_0x93db('0x1c7')],{'as':'Variable','foreignKey':'VariableId'});db[_0x93db('0xd5')][_0x93db('0x12b')](db[_0x93db('0x63')],{});db[_0x93db('0xd5')]['belongsTo'](db[_0x93db('0xfb')],{'as':'List','foreignKey':_0x93db('0x16b')});db['ChatQueueReport'][_0x93db('0x12b')](db[_0x93db('0x73')],{'as':'Contact','foreignKey':_0x93db('0x160')});db[_0x93db('0xd5')]['belongsTo'](db[_0x93db('0x68')],{});db['ChatQueueReport'][_0x93db('0x12b')](db['ChatMessage'],{});db[_0x93db('0xd5')][_0x93db('0x12b')](db[_0x93db('0x118')],{});db[_0x93db('0xd5')][_0x93db('0x12b')](db['ChatQueue'],{});db['ChatInternalMessage'][_0x93db('0x12b')](db['User'],{'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1d0')});db['ChatInternalMessage'][_0x93db('0x12b')](db[_0x93db('0x118')],{'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1d1')});db[_0x93db('0xdb')][_0x93db('0x11d')](db[_0x93db('0x1d2')],{'foreignKey':_0x93db('0x1d3'),'onDelete':'cascade'});db[_0x93db('0xdb')][_0x93db('0x11d')](db[_0x93db('0xd8')],{'foreignKey':_0x93db('0x1d3'),'onDelete':'cascade'});db[_0x93db('0xdd')]['belongsTo'](db['SmsAccount'],{});db['SmsQueueReport'][_0x93db('0x12b')](db[_0x93db('0xfb')],{'as':_0x93db('0x16a'),'foreignKey':_0x93db('0x16b')});db[_0x93db('0xdd')][_0x93db('0x12b')](db['CmContact'],{'as':_0x93db('0x176'),'foreignKey':_0x93db('0x160')});db[_0x93db('0xdd')][_0x93db('0x12b')](db[_0x93db('0x57')],{});db[_0x93db('0xdd')]['belongsTo'](db[_0x93db('0x59')],{});db[_0x93db('0xdd')][_0x93db('0x12b')](db['User'],{});db[_0x93db('0xdd')][_0x93db('0x12b')](db['SmsQueue'],{});db[_0x93db('0xe2')][_0x93db('0x11d')](db[_0x93db('0xdb')],{'foreignKey':_0x93db('0x1d4')});db['JscriptyProject'][_0x93db('0x11d')](db[_0x93db('0x1d2')],{'foreignKey':'ProjectId'});db[_0x93db('0xe2')]['hasMany'](db[_0x93db('0xd8')],{'foreignKey':'ProjectId'});db[_0x93db('0xeb')][_0x93db('0x12e')](db[_0x93db('0x118')],{'as':_0x93db('0x15a'),'through':_0x93db('0x1d5')});db[_0x93db('0xeb')][_0x93db('0x12e')](db[_0x93db('0x19')],{'through':_0x93db('0x10f'),'as':_0x93db('0x1d6')});db[_0x93db('0xeb')]['belongsToMany'](db[_0x93db('0x3e')],{'through':_0x93db('0x16f'),'as':_0x93db('0x13c')});db[_0x93db('0xeb')][_0x93db('0x12e')](db[_0x93db('0x6d')],{'through':_0x93db('0x1d7'),'as':_0x93db('0x13e')});db[_0x93db('0xeb')][_0x93db('0x12e')](db[_0x93db('0x50')],{'through':_0x93db('0x1d8'),'as':_0x93db('0x1d9')});db[_0x93db('0xeb')][_0x93db('0x12e')](db['SmsQueue'],{'through':'team_has_sms_queues','as':_0x93db('0x1da')});db[_0x93db('0xeb')][_0x93db('0x12e')](db[_0x93db('0x140')],{'through':'team_has_openchannel_queues','as':_0x93db('0x141')});db[_0x93db('0xeb')][_0x93db('0x12e')](db[_0x93db('0x10b')],{'through':'team_has_whatsapp_queues','as':_0x93db('0x142')});db[_0x93db('0xeb')][_0x93db('0x12e')](db[_0x93db('0xfd')],{'through':_0x93db('0x111'),'as':_0x93db('0x13b')});db['Campaign'][_0x93db('0x11d')](db[_0x93db('0x75')],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0x93db('0xee')]['hasMany'](db[_0x93db('0x78')],{'as':_0x93db('0x19f'),'foreignKey':_0x93db('0x1a5')});db['Campaign'][_0x93db('0x11d')](db['CmHopperHistory'],{'as':_0x93db('0x154'),'foreignKey':_0x93db('0x1a5')});db[_0x93db('0xee')][_0x93db('0x11d')](db['CmHopperBlack'],{'as':_0x93db('0x1db'),'foreignKey':'CampaignId'});db['Campaign'][_0x93db('0x12b')](db[_0x93db('0x2b')],{'as':_0x93db('0x2b'),'foreignKey':_0x93db('0x1dc')});db[_0x93db('0xee')][_0x93db('0x12b')](db[_0x93db('0x2b')],{'as':_0x93db('0x156'),'foreignKey':'TrunkBackupId'});db[_0x93db('0xee')][_0x93db('0x12b')](db[_0x93db('0x87')],{'as':_0x93db('0x87'),'foreignKey':_0x93db('0x157')});db[_0x93db('0xee')][_0x93db('0x12b')](db[_0x93db('0xe6')],{'as':_0x93db('0xe6'),'foreignKey':'SquareProjectId'});db[_0x93db('0xee')][_0x93db('0x12e')](db[_0x93db('0xfb')],{'as':_0x93db('0x132'),'through':_0x93db('0x1dd')});db[_0x93db('0xee')]['belongsToMany'](db['CmList'],{'as':_0x93db('0x1de'),'through':_0x93db('0x1df')});db[_0x93db('0xf0')][_0x93db('0x12b')](db[_0x93db('0x6c')],{'as':_0x93db('0x6c'),'foreignKey':_0x93db('0x179')});db[_0x93db('0xf4')]['belongsTo'](db[_0x93db('0x43')],{});db[_0x93db('0xf4')][_0x93db('0x12b')](db['MailInteraction'],{});db[_0x93db('0xf4')][_0x93db('0x12b')](db[_0x93db('0x3d')],{'foreignKey':_0x93db('0x1e0'),'as':'FromAccount'});db['MailTransferReport'][_0x93db('0x12b')](db[_0x93db('0x118')],{'foreignKey':_0x93db('0x1e1'),'as':_0x93db('0x1e2')});db[_0x93db('0xf4')][_0x93db('0x12b')](db[_0x93db('0x118')],{'foreignKey':_0x93db('0x1e3'),'as':_0x93db('0x1e4')});db[_0x93db('0xf4')][_0x93db('0x12b')](db[_0x93db('0x3e')],{'foreignKey':'ToMailQueueId','as':_0x93db('0x1e5')});db[_0x93db('0xf4')][_0x93db('0x12b')](db['MailAccount'],{'foreignKey':_0x93db('0x1e6'),'as':_0x93db('0x1e7')});db[_0x93db('0x1e8')][_0x93db('0x12b')](db[_0x93db('0x6a')],{});db[_0x93db('0x1e8')]['belongsTo'](db['ChatInteraction'],{});db['ChatTransferReport'][_0x93db('0x12b')](db[_0x93db('0x63')],{'foreignKey':_0x93db('0x1e9'),'as':'FromAccount'});db[_0x93db('0x1e8')][_0x93db('0x12b')](db[_0x93db('0x118')],{'foreignKey':_0x93db('0x1e1'),'as':_0x93db('0x1e2')});db[_0x93db('0x1e8')][_0x93db('0x12b')](db[_0x93db('0x118')],{'foreignKey':'ToUserId','as':_0x93db('0x1e4')});db[_0x93db('0x1e8')]['belongsTo'](db[_0x93db('0x6d')],{'foreignKey':_0x93db('0x1ea'),'as':'ToQueue'});db[_0x93db('0x1e8')]['belongsTo'](db[_0x93db('0x63')],{'foreignKey':_0x93db('0x1eb'),'as':_0x93db('0x1e7')});db[_0x93db('0xf5')][_0x93db('0x12b')](db[_0x93db('0x17f')],{});db[_0x93db('0xf5')][_0x93db('0x12b')](db[_0x93db('0x4d')],{});db[_0x93db('0xf5')][_0x93db('0x12b')](db[_0x93db('0x4c')],{'foreignKey':'FromFaxAccountId','as':_0x93db('0x1ec')});db[_0x93db('0xf5')][_0x93db('0x12b')](db[_0x93db('0x118')],{'foreignKey':'FromUserId','as':_0x93db('0x1e2')});db[_0x93db('0xf5')][_0x93db('0x12b')](db[_0x93db('0x118')],{'foreignKey':_0x93db('0x1e3'),'as':_0x93db('0x1e4')});db[_0x93db('0xf5')][_0x93db('0x12b')](db[_0x93db('0x50')],{'foreignKey':_0x93db('0x1ed'),'as':_0x93db('0x1e5')});db[_0x93db('0xf5')][_0x93db('0x12b')](db[_0x93db('0x4c')],{'foreignKey':'ToFaxAccountId','as':_0x93db('0x1e7')});db[_0x93db('0xf7')][_0x93db('0x12b')](db['OpenchannelMessage'],{});db[_0x93db('0xf7')]['belongsTo'](db[_0x93db('0x60')],{});db[_0x93db('0xf7')][_0x93db('0x12b')](db[_0x93db('0x5c')],{'foreignKey':_0x93db('0x1ee'),'as':_0x93db('0x1ec')});db[_0x93db('0xf7')][_0x93db('0x12b')](db[_0x93db('0x118')],{'foreignKey':_0x93db('0x1e1'),'as':_0x93db('0x1e2')});db[_0x93db('0xf7')]['belongsTo'](db[_0x93db('0x118')],{'foreignKey':_0x93db('0x1e3'),'as':_0x93db('0x1e4')});db[_0x93db('0xf7')][_0x93db('0x12b')](db[_0x93db('0x140')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x93db('0xf7')][_0x93db('0x12b')](db[_0x93db('0x5c')],{'foreignKey':_0x93db('0x1ef'),'as':_0x93db('0x1e7')});db[_0x93db('0xf9')][_0x93db('0x12b')](db[_0x93db('0x59')],{});db['SmsTransferReport'][_0x93db('0x12b')](db[_0x93db('0x57')],{});db[_0x93db('0xf9')][_0x93db('0x12b')](db[_0x93db('0x53')],{'foreignKey':'FromSmsAccountId','as':_0x93db('0x1ec')});db[_0x93db('0xf9')][_0x93db('0x12b')](db['User'],{'foreignKey':_0x93db('0x1e1'),'as':_0x93db('0x1e2')});db[_0x93db('0xf9')][_0x93db('0x12b')](db['User'],{'foreignKey':_0x93db('0x1e3'),'as':'ToAgent'});db[_0x93db('0xf9')][_0x93db('0x12b')](db[_0x93db('0x5b')],{'foreignKey':_0x93db('0x1f0'),'as':'ToQueue'});db[_0x93db('0xf9')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x93db('0x1f1'),'as':_0x93db('0x1e7')});db[_0x93db('0xfb')]['hasMany'](db[_0x93db('0x84')],{'as':_0x93db('0x166'),'foreignKey':_0x93db('0x16b'),'onDelete':_0x93db('0x11a')});db[_0x93db('0xfb')][_0x93db('0x11d')](db['CmCustomField'],{'as':_0x93db('0x1f2'),'foreignKey':_0x93db('0x16b')});db[_0x93db('0xfb')][_0x93db('0x11d')](db[_0x93db('0x73')],{'as':_0x93db('0x130'),'onDelete':_0x93db('0x11a'),'foreignKey':'ListId'});db[_0x93db('0xfb')][_0x93db('0x11d')](db[_0x93db('0x78')],{'as':_0x93db('0x19f'),'foreignKey':_0x93db('0x16b')});db[_0x93db('0xfb')]['hasMany'](db[_0x93db('0x153')],{'as':_0x93db('0x121'),'foreignKey':'ListId'});db[_0x93db('0xfb')][_0x93db('0x11d')](db[_0x93db('0x7b')],{'as':'ReportAgentPreview','foreignKey':_0x93db('0x16b')});db[_0x93db('0xfb')]['belongsToMany'](db[_0x93db('0x19')],{'as':_0x93db('0x1f3'),'through':_0x93db('0x159')});db['CmList']['belongsToMany'](db[_0x93db('0x118')],{'as':_0x93db('0x15a'),'through':_0x93db('0x133')});db[_0x93db('0xfd')][_0x93db('0x11d')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x93db('0x11a')});db[_0x93db('0xfd')][_0x93db('0x12e')](db[_0x93db('0x118')],{'as':_0x93db('0x15a'),'through':_0x93db('0x113')});db[_0x93db('0xfd')]['belongsToMany'](db[_0x93db('0xeb')],{'through':_0x93db('0x111'),'as':_0x93db('0x186')});db[_0x93db('0x12c')]['hasMany'](db[_0x93db('0x118')],{'as':_0x93db('0x184'),'foreignKey':_0x93db('0x12d')});db[_0x93db('0x12c')]['hasMany'](db[_0x93db('0x1f4')],{'as':_0x93db('0x1f5'),'foreignKey':'userProfileId','onDelete':_0x93db('0x11a')});db['UserProfileSection'][_0x93db('0x11d')](db[_0x93db('0x100')],{'as':_0x93db('0x1f6'),'foreignKey':_0x93db('0x1f7'),'onDelete':_0x93db('0x11a')});db['WhatsappAccount'][_0x93db('0x11d')](db[_0x93db('0x84')],{'as':_0x93db('0x166'),'foreignKey':_0x93db('0x1f8'),'onDelete':_0x93db('0x11a')});db[_0x93db('0x103')][_0x93db('0x11d')](db[_0x93db('0x17c')],{'as':_0x93db('0x167'),'foreignKey':_0x93db('0x1f8')});db['WhatsappAccount'][_0x93db('0x11d')](db[_0x93db('0x1f9')],{'as':_0x93db('0x168'),'foreignKey':_0x93db('0x1f8')});db[_0x93db('0x103')][_0x93db('0x11d')](db[_0x93db('0x106')],{'as':_0x93db('0x169')});db['WhatsappAccount'][_0x93db('0x11d')](db[_0x93db('0x104')],{'as':_0x93db('0x14e'),'foreignKey':_0x93db('0x1f8'),'onDelete':_0x93db('0x11a')});db[_0x93db('0x103')]['belongsTo'](db[_0x93db('0xfb')],{'as':_0x93db('0x16a'),'foreignKey':_0x93db('0x16b')});db[_0x93db('0x103')][_0x93db('0x12b')](db[_0x93db('0x89')],{'as':'mandatoryDispositionPause','foreignKey':_0x93db('0x16d')});db[_0x93db('0x103')][_0x93db('0x12e')](db['User'],{'as':_0x93db('0x15a'),'through':'user_has_whatsapp_accounts'});db[_0x93db('0x104')]['belongsTo'](db['User'],{'onDelete':_0x93db('0x163')});db[_0x93db('0x104')][_0x93db('0x12b')](db[_0x93db('0x10b')],{'onDelete':_0x93db('0x163')});db['WhatsappApplication'][_0x93db('0x12b')](db['WhatsappAccount'],{'onDelete':_0x93db('0x163')});db[_0x93db('0x104')][_0x93db('0x12b')](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x93db('0x104')][_0x93db('0x12b')](db[_0x93db('0x172')],{'onDelete':_0x93db('0x163'),'foreignKey':_0x93db('0x188')});db[_0x93db('0x106')][_0x93db('0x11d')](db[_0x93db('0x1f9')],{'as':_0x93db('0x168'),'onDelete':_0x93db('0x11a'),'foreignKey':_0x93db('0x1fa')});db[_0x93db('0x106')][_0x93db('0x12b')](db[_0x93db('0x103')],{'as':_0x93db('0x178'),'foreignKey':_0x93db('0x1f8')});db[_0x93db('0x106')][_0x93db('0x12b')](db[_0x93db('0x73')],{'as':'Contact','foreignKey':_0x93db('0x160')});db[_0x93db('0x106')]['belongsTo'](db[_0x93db('0x118')],{'as':_0x93db('0x171'),'foreignKey':_0x93db('0x11c')});db[_0x93db('0x106')][_0x93db('0x12e')](db[_0x93db('0x172')],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db[_0x93db('0x106')][_0x93db('0x12e')](db[_0x93db('0x172')],{'through':_0x93db('0x1b0'),'as':'ThroughTags'});db['WhatsappInteraction'][_0x93db('0x12e')](db[_0x93db('0x118')],{'as':_0x93db('0x184'),'through':_0x93db('0x13a'),'foreignKey':_0x93db('0x1fa')});db['WhatsappMessage'][_0x93db('0x12b')](db['User'],{'as':_0x93db('0x118')});db['WhatsappMessage'][_0x93db('0x12b')](db[_0x93db('0x73')],{'onDelete':_0x93db('0x11a'),'as':_0x93db('0x176')});db[_0x93db('0x1f9')][_0x93db('0x12b')](db[_0x93db('0x106')],{'onDelete':_0x93db('0x11a'),'as':_0x93db('0x177'),'foreignKey':'WhatsappInteractionId'});db[_0x93db('0x1f9')]['belongsTo'](db[_0x93db('0x103')],{'as':_0x93db('0x178'),'foreignKey':_0x93db('0x1f8')});db['WhatsappQueueReport'][_0x93db('0x12b')](db[_0x93db('0x103')],{});db[_0x93db('0x108')][_0x93db('0x12b')](db[_0x93db('0xfb')],{'as':_0x93db('0x16a'),'foreignKey':_0x93db('0x16b')});db[_0x93db('0x108')]['belongsTo'](db['CmContact'],{'as':_0x93db('0x176'),'foreignKey':'ContactId'});db[_0x93db('0x108')][_0x93db('0x12b')](db[_0x93db('0x106')],{});db[_0x93db('0x108')][_0x93db('0x12b')](db[_0x93db('0x10b')],{});db['WhatsappQueueReport'][_0x93db('0x12b')](db[_0x93db('0x1f9')],{});db[_0x93db('0x108')][_0x93db('0x12b')](db[_0x93db('0x118')],{});db[_0x93db('0x10a')][_0x93db('0x12b')](db['WhatsappMessage'],{});db['WhatsappTransferReport']['belongsTo'](db[_0x93db('0x106')],{});db[_0x93db('0x10a')][_0x93db('0x12b')](db['WhatsappAccount'],{'foreignKey':_0x93db('0x1fb'),'as':_0x93db('0x1ec')});db['WhatsappTransferReport'][_0x93db('0x12b')](db['WhatsappAccount'],{'foreignKey':_0x93db('0x1fc'),'as':_0x93db('0x1e7')});db[_0x93db('0x10a')][_0x93db('0x12b')](db[_0x93db('0x10b')],{'foreignKey':_0x93db('0x1fd'),'as':_0x93db('0x1e5')});db[_0x93db('0x10a')][_0x93db('0x12b')](db['User'],{'foreignKey':'FromUserId','as':_0x93db('0x1e2')});db[_0x93db('0x10a')][_0x93db('0x12b')](db[_0x93db('0x118')],{'foreignKey':_0x93db('0x1e3'),'as':_0x93db('0x1e4')});db[_0x93db('0x10b')][_0x93db('0x12e')](db[_0x93db('0x118')],{'as':_0x93db('0x15a'),'through':_0x93db('0x3a'),'foreignKey':_0x93db('0x1fe')});db[_0x93db('0x10b')][_0x93db('0x12e')](db[_0x93db('0xeb')],{'through':_0x93db('0x1ff'),'as':_0x93db('0x186')});db[_0x93db('0x114')]['belongsTo'](db[_0x93db('0x118')],{'as':'user','foreignKey':'UserId','onDelete':_0x93db('0x11a'),'hooks':!![]});db[_0x93db('0x10d')][_0x93db('0x119')](db['Dynamics365Account'],{'as':'Dynamics365Account','onDelete':'restrict'});db[_0x93db('0x10d')][_0x93db('0x119')](db[_0x93db('0x161')],{'as':_0x93db('0x200'),'onDelete':_0x93db('0x163')});db[_0x93db('0x10d')][_0x93db('0x119')](db['MailServerOut'],{'as':'Smtp','onDelete':_0x93db('0x163')});module[_0x93db('0x201')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa8f6=['../api/mailMessage/mailMessage.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','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','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileResource/userProfileResource.model','UserNotification','../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','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','hasOne','VoiceMail','cascade','UserId','userSetting','VoiceRecording','hasMany','VoiceQueuesRt','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','MailInteractions','SenderId','Hoppers','SET\x20NULL','userProfileId','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','belongsToMany','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_sms_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefix','VoicePrefixes','UserVoicePrefix','MailQueues','ChatQueue','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sound','moh_has_sounds','Members','VoiceQueueId','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','belongsTo','TrunkBackupId','Interval','IntervalId','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','VoiceCallReport','QueueCalls','uniqueid','AgentReports','MailAccount','MailAccountId','CloudProvider','CloudProviderId','restrict','MailServerOut','Imap','Smtp','Dispositions','CannedAnswer','MailMessage','List','ListId','Template','TemplateId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','team_has_mail_queues','MailInteractionId','Account','CmContact','Contact','Owner','Tag','mail_interaction_has_tags','ThroughTags','Interaction','ChatWebsiteId','ChatOfflineMessageId','MailApplication','TagId','ContactId','Answers','FaxAccountId','Interactions','Exntensions','FaxInteractionId','fax_interaction_has_tags','Users','user_has_fax_interactions','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','Tags','SmsMessage','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','OpenchannelQueueReport','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','CompanyId','CmContactId','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OwnerId','Condition','All','OneAll','Any','OneAny','AutomationAnyId','Action','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','Schedule','CustomReportId','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','DefaultReportId','MetricId','SalesforceField','Descriptions','DescriptionId','AccountId','Subject','Field','FieldId','Variable','VariableId','Subjects','SubjectId','Description','Configurations','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerConfiguration','FromId','ToId','SessionId','SmsQueueReport','ProjectId','ChatQueues','team_has_whatsapp_queues','TrunkId','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','voice_queues_has_cm_lists','Extensions','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','user','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','sequelizeHistory','mysql','username','password','database','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailInteraction','../api/mailInteraction/mailInteraction.model'];(function(_0x2f3ecd,_0x57976b){var _0xffdc44=function(_0xf21bc6){while(--_0xf21bc6){_0x2f3ecd['push'](_0x2f3ecd['shift']());}};_0xffdc44(++_0x57976b);}(_0xa8f6,0x1d3));var _0x6a8f=function(_0x55aad1,_0x200ad8){_0x55aad1=_0x55aad1-0x0;var _0x3684db=_0xa8f6[_0x55aad1];return _0x3684db;};'use strict';var config=require(_0x6a8f('0x0'));var Sequelize=require(_0x6a8f('0x1'));var _=require(_0x6a8f('0x2'));var jstz=require(_0x6a8f('0x3'));var timezone=jstz[_0x6a8f('0x4')]();config[_0x6a8f('0x1')]=_[_0x6a8f('0x5')](config['sequelize'],{'database':_0x6a8f('0x6'),'username':_0x6a8f('0x7'),'password':_0x6a8f('0x8'),'options':{'host':_0x6a8f('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x6a8f('0xa')},'logging':![],'timezone':timezone[_0x6a8f('0xb')](),'define':{'charset':_0x6a8f('0xc'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x6a8f('0x5')](config[_0x6a8f('0xd')],{'database':'motion2','username':_0x6a8f('0x7'),'password':_0x6a8f('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x6a8f('0xe'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x6a8f('0xb')](),'define':{'charset':_0x6a8f('0xc'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6a8f('0x1')]['database'],config[_0x6a8f('0x1')][_0x6a8f('0xf')],config[_0x6a8f('0x1')][_0x6a8f('0x10')],config[_0x6a8f('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6a8f('0xd')][_0x6a8f('0x11')],config[_0x6a8f('0xd')][_0x6a8f('0xf')],config[_0x6a8f('0xd')][_0x6a8f('0x10')],config['sequelizeHistory'][_0x6a8f('0x12')])};db[_0x6a8f('0x13')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x15'));db[_0x6a8f('0x16')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x17'));db[_0x6a8f('0x18')]=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0x19'));db[_0x6a8f('0x1a')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x1b'));db['VoiceMusicOnHold']=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x1c'));db[_0x6a8f('0x1d')]=db[_0x6a8f('0x1')]['import']('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x1e'));db[_0x6a8f('0x1f')]=db[_0x6a8f('0x1')]['import']('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x20'));db['VoiceMailMessage']=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0x21'));db['VoiceCallReport']=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0x22'));db['VoiceDialReport']=db['sequelize']['import'](_0x6a8f('0x23'));db[_0x6a8f('0x24')]=db['sequelize'][_0x6a8f('0x14')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x6a8f('0x25')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x6a8f('0x26')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0x27'));db[_0x6a8f('0x28')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0x29'));db[_0x6a8f('0x2a')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x2b'));db[_0x6a8f('0x2c')]=db['sequelize'][_0x6a8f('0x14')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db['UserVoiceQueue']=db[_0x6a8f('0x1')][_0x6a8f('0x14')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x6a8f('0x2d')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')]('../api/userChatQueue/userChatQueue.model');db[_0x6a8f('0x2e')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0x2f'));db[_0x6a8f('0x30')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0x31'));db['UserSmsQueue']=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x32'));db[_0x6a8f('0x33')]=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0x34'));db[_0x6a8f('0x35')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x36'));db[_0x6a8f('0x37')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x38'));db['MailServerOut']=db[_0x6a8f('0x1')][_0x6a8f('0x14')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0x6a8f('0x1')]['import'](_0x6a8f('0x39'));db[_0x6a8f('0x3a')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0x3b'));db['MailSubstatus']=db['sequelize'][_0x6a8f('0x14')]('../api/mailSubstatus/mailSubstatus.model');db[_0x6a8f('0x3c')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x3d'));db['MailMessage']=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0x3e'));db['MailApplication']=db['sequelize'][_0x6a8f('0x14')]('../api/mailApplication/mailApplication.model');db[_0x6a8f('0x3f')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0x40'));db[_0x6a8f('0x41')]=db[_0x6a8f('0x1')]['import']('../api/dashboard/dashboard.model');db[_0x6a8f('0x42')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x43'));db[_0x6a8f('0x44')]=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0x45'));db[_0x6a8f('0x46')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x47'));db[_0x6a8f('0x48')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x49'));db[_0x6a8f('0x4a')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x4b'));db[_0x6a8f('0x4c')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0x4d'));db['FaxQueueReport']=db[_0x6a8f('0x1')]['import']('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db['sequelize']['import'](_0x6a8f('0x4e'));db[_0x6a8f('0x4f')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x50'));db[_0x6a8f('0x51')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x52'));db['SmsMessage']=db[_0x6a8f('0x1')][_0x6a8f('0x14')]('../api/smsMessage/smsMessage.model');db[_0x6a8f('0x53')]=db['sequelize']['import'](_0x6a8f('0x54'));db[_0x6a8f('0x55')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0x56'));db[_0x6a8f('0x57')]=db['sequelize']['import'](_0x6a8f('0x58'));db[_0x6a8f('0x59')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x5a'));db[_0x6a8f('0x5b')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x5c'));db[_0x6a8f('0x5d')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0x5e'));db[_0x6a8f('0x5f')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x60'));db['OpenchannelQueueReport']=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x61'));db[_0x6a8f('0x62')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x63'));db[_0x6a8f('0x64')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x65'));db[_0x6a8f('0x66')]=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0x67'));db[_0x6a8f('0x68')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x69'));db['ChatQueue']=db[_0x6a8f('0x1')]['import'](_0x6a8f('0x6a'));db[_0x6a8f('0x6b')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0x6c'));db[_0x6a8f('0x6d')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x6a8f('0x6e')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0x6f'));db['CmContact']=db[_0x6a8f('0x1')][_0x6a8f('0x14')]('../api/cmContact/cmContact.model');db[_0x6a8f('0x70')]=db['sequelize']['import'](_0x6a8f('0x71'));db['CmHopperBlack']=db['sequelize'][_0x6a8f('0x14')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x6a8f('0x72')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x73'));db[_0x6a8f('0x74')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0x75'));db['ReportAgentPreview']=db[_0x6a8f('0x1')]['import'](_0x6a8f('0x76'));db['CmCustomField']=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0x77'));db['Action']=db[_0x6a8f('0x1')]['import'](_0x6a8f('0x78'));db[_0x6a8f('0x79')]=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0x7a'));db['CannedAnswer']=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0x7b'));db[_0x6a8f('0x7c')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x7d'));db['Condition']=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x7e'));db['Interval']=db[_0x6a8f('0x1')]['import']('../api/interval/interval.model');db[_0x6a8f('0x7f')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x80'));db[_0x6a8f('0x81')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x82'));db[_0x6a8f('0x83')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0x84'));db['Schedule']=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0x85'));db['Sound']=db['sequelize'][_0x6a8f('0x14')]('../api/sound/sound.model');db['Tag']=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x86'));db[_0x6a8f('0x87')]=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0x88'));db[_0x6a8f('0x89')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x8a'));db[_0x6a8f('0x8b')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x8c'));db['Template']=db[_0x6a8f('0x1')]['import'](_0x6a8f('0x8d'));db[_0x6a8f('0x8e')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0x8f'));db['Variable']=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x90'));db[_0x6a8f('0x91')]=db['sequelize'][_0x6a8f('0x14')]('../api/integration/integration.model');db[_0x6a8f('0x92')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x93'));db[_0x6a8f('0x94')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0x95'));db[_0x6a8f('0x96')]=db[_0x6a8f('0x1')]['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x6a8f('0x97')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x98'));db[_0x6a8f('0x99')]=db['sequelize'][_0x6a8f('0x14')]('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0x9a'));db['AnalyticTreeReport']=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0x9b'));db[_0x6a8f('0x9c')]=db[_0x6a8f('0x1')]['import']('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x6a8f('0x9d')]=db[_0x6a8f('0x1')]['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x9e'));db['SugarcrmAccount']=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x9f'));db[_0x6a8f('0xa0')]=db['sequelize']['import'](_0x6a8f('0xa1'));db[_0x6a8f('0xa2')]=db[_0x6a8f('0x1')]['import']('../api/intSugarcrmField/intSugarcrmField.model');db[_0x6a8f('0xa3')]=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0xa4'));db[_0x6a8f('0xa5')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xa6'));db[_0x6a8f('0xa7')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0xa8'));db[_0x6a8f('0xa9')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')]('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db['sequelize'][_0x6a8f('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x6a8f('0xaa')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xab'));db[_0x6a8f('0xac')]=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0xad'));db['ZendeskConfiguration']=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xae'));db[_0x6a8f('0xaf')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0xb0'));db[_0x6a8f('0xb1')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xb2'));db[_0x6a8f('0xb3')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xb4'));db[_0x6a8f('0xb5')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xb6'));db['VtigerAccount']=db[_0x6a8f('0x1')]['import'](_0x6a8f('0xb7'));db['VtigerConfiguration']=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xb8'));db[_0x6a8f('0xb9')]=db['sequelize']['import'](_0x6a8f('0xba'));db[_0x6a8f('0xbb')]=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0xbc'));db[_0x6a8f('0xbd')]=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0xbe'));db[_0x6a8f('0xbf')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xc0'));db[_0x6a8f('0xc1')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xc2'));db[_0x6a8f('0xc3')]=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0xc4'));db[_0x6a8f('0xc5')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xc6'));db[_0x6a8f('0xc7')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xc8'));db[_0x6a8f('0xc9')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xca'));db[_0x6a8f('0xcb')]=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0xcc'));db[_0x6a8f('0x91')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xcd'));db[_0x6a8f('0xce')]=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0xcf'));db[_0x6a8f('0xd0')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0xd1'));db[_0x6a8f('0xd2')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xd3'));db[_0x6a8f('0xd4')]=db['sequelize'][_0x6a8f('0x14')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x6a8f('0xd5')]=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0xd6'));db[_0x6a8f('0xd7')]=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0xd8'));db['SmsQueueReport']=db[_0x6a8f('0x1')][_0x6a8f('0x14')]('../api/smsQueueReport/smsQueueReport.model');db[_0x6a8f('0xd9')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')]('../api/squareReport/squareReport.model');db[_0x6a8f('0xda')]=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0xdb'));db[_0x6a8f('0xdc')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0xdd'));db[_0x6a8f('0xde')]=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0xdf'));db[_0x6a8f('0xe0')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')]('../api/squareOdbc/squareOdbc.model');db[_0x6a8f('0xe1')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xe2'));db['SquareRecording']=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0xe3'));db['SquareMessage']=db[_0x6a8f('0x1')][_0x6a8f('0x14')]('../api/squareMessage/squareMessage.model');db['Team']=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xe4'));db[_0x6a8f('0xe5')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0xe6'));db[_0x6a8f('0xe7')]=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0xe8'));db[_0x6a8f('0xe9')]=db['sequelize']['import'](_0x6a8f('0xea'));db[_0x6a8f('0xeb')]=db['sequelize']['import'](_0x6a8f('0xec'));db[_0x6a8f('0xed')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xee'));db['MailTransferReport']=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xef'));db[_0x6a8f('0xf0')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xf1'));db[_0x6a8f('0xf2')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xf3'));db['OpenchannelTransferReport']=db['sequelize'][_0x6a8f('0x14')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x6a8f('0xf4')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0xf5'));db[_0x6a8f('0xf6')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xf7'));db['VoicePrefix']=db['sequelize']['import'](_0x6a8f('0xf8'));db[_0x6a8f('0xf9')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')]('../api/userProfile/userProfile.model');db[_0x6a8f('0xfa')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xfb'));db[_0x6a8f('0xfc')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0xfd'));db[_0x6a8f('0xfe')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0xff'));db[_0x6a8f('0x100')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x101'));db[_0x6a8f('0x102')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x103'));db[_0x6a8f('0x104')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x105'));db[_0x6a8f('0x106')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x107'));db[_0x6a8f('0x108')]=db['sequelize'][_0x6a8f('0x14')](_0x6a8f('0x109'));db[_0x6a8f('0x10a')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x10b'));db['CloudProvider']=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x10c'));db['TeamVoiceQueue']=db[_0x6a8f('0x1')][_0x6a8f('0x14')](_0x6a8f('0x10d'));db[_0x6a8f('0x10e')]=db[_0x6a8f('0x1')][_0x6a8f('0x14')]('../api/teamVoicePrefix/teamVoicePrefix.model');db['UserVoicePrefix']=db[_0x6a8f('0x1')]['import']('../api/userVoicePrefix/userVoicePrefix.model');db[_0x6a8f('0x10f')]=db[_0x6a8f('0x1')]['import'](_0x6a8f('0x110'));db[_0x6a8f('0x111')]=db[_0x6a8f('0x1')]['import']('../api/mailInteractionHasTag/mailInteractionHasTag.model');db[_0x6a8f('0x13')][_0x6a8f('0x112')](db['VoiceMail'],{'as':_0x6a8f('0x113'),'onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x115')});db['User'][_0x6a8f('0x112')](db[_0x6a8f('0x10f')],{'as':_0x6a8f('0x116'),'onDelete':'cascade','foreignKey':_0x6a8f('0x115')});db[_0x6a8f('0x13')]['hasMany'](db[_0x6a8f('0x117')],{'as':'Recordings','foreignKey':_0x6a8f('0x115')});db[_0x6a8f('0x13')][_0x6a8f('0x118')](db[_0x6a8f('0x2c')],{'as':_0x6a8f('0x119'),'foreignKey':'UserId'});db[_0x6a8f('0x13')][_0x6a8f('0x118')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x6a8f('0x114'),'hooks':!![]});db[_0x6a8f('0x13')][_0x6a8f('0x118')](db[_0x6a8f('0x72')],{'as':_0x6a8f('0x11a'),'foreignKey':'UserId'});db[_0x6a8f('0x13')][_0x6a8f('0x118')](db[_0x6a8f('0x74')],{'as':_0x6a8f('0x11b'),'foreignKey':_0x6a8f('0x115')});db[_0x6a8f('0x13')][_0x6a8f('0x118')](db[_0x6a8f('0x11c')],{'as':'ReportAgentPreview','foreignKey':_0x6a8f('0x115')});db['User']['hasMany'](db[_0x6a8f('0x59')],{'as':_0x6a8f('0x11d'),'foreignKey':_0x6a8f('0x115')});db[_0x6a8f('0x13')]['hasMany'](db['ChatInteraction'],{'as':_0x6a8f('0x11e'),'foreignKey':_0x6a8f('0x115')});db[_0x6a8f('0x13')][_0x6a8f('0x118')](db[_0x6a8f('0x51')],{'as':_0x6a8f('0x11f'),'foreignKey':_0x6a8f('0x115')});db['User'][_0x6a8f('0x118')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0x6a8f('0x115')});db[_0x6a8f('0x13')]['hasMany'](db[_0x6a8f('0x3c')],{'as':_0x6a8f('0x120'),'foreignKey':'UserId'});db[_0x6a8f('0x13')][_0x6a8f('0x118')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':_0x6a8f('0x115')});db['User']['hasMany'](db[_0x6a8f('0xfc')],{'as':'UserNotifications','foreignKey':_0x6a8f('0x121')});db[_0x6a8f('0x13')][_0x6a8f('0x118')](db['CmHopper'],{'as':_0x6a8f('0x122'),'foreignKey':_0x6a8f('0x115'),'onDelete':_0x6a8f('0x123')});db[_0x6a8f('0x13')]['belongsTo'](db[_0x6a8f('0xf9')],{'as':_0x6a8f('0xf9'),'foreignKey':_0x6a8f('0x124')});db['User']['belongsToMany'](db[_0x6a8f('0x6b')],{'as':_0x6a8f('0x125'),'through':_0x6a8f('0x126')});db[_0x6a8f('0x13')]['belongsToMany'](db['CmContact'],{'as':_0x6a8f('0x127'),'through':_0x6a8f('0x128')});db[_0x6a8f('0x13')][_0x6a8f('0x129')](db['CmList'],{'as':_0x6a8f('0x12a'),'through':_0x6a8f('0x12b')});db[_0x6a8f('0x13')][_0x6a8f('0x129')](db[_0x6a8f('0x12c')],{'through':_0x6a8f('0x12d')});db[_0x6a8f('0x13')][_0x6a8f('0x129')](db[_0x6a8f('0x3c')],{'as':_0x6a8f('0x120'),'through':_0x6a8f('0x12e')});db[_0x6a8f('0x13')][_0x6a8f('0x129')](db[_0x6a8f('0x64')],{'as':_0x6a8f('0x11e'),'through':_0x6a8f('0x12f')});db[_0x6a8f('0x13')]['belongsToMany'](db[_0x6a8f('0x48')],{'as':_0x6a8f('0x130'),'through':'user_has_fax_interactions'});db[_0x6a8f('0x13')][_0x6a8f('0x129')](db[_0x6a8f('0x51')],{'as':_0x6a8f('0x11f'),'through':_0x6a8f('0x131')});db[_0x6a8f('0x13')][_0x6a8f('0x129')](db[_0x6a8f('0x59')],{'as':_0x6a8f('0x11d'),'through':'user_has_openchannel_interactions'});db[_0x6a8f('0x13')]['belongsToMany'](db[_0x6a8f('0x102')],{'as':_0x6a8f('0x132'),'through':_0x6a8f('0x133')});db[_0x6a8f('0x13')][_0x6a8f('0x129')](db[_0x6a8f('0x1d')],{'as':_0x6a8f('0x134'),'through':_0x6a8f('0x135'),'required':![]});db[_0x6a8f('0x13')][_0x6a8f('0x129')](db[_0x6a8f('0x136')],{'as':_0x6a8f('0x137'),'through':_0x6a8f('0x138'),'required':![]});db['User'][_0x6a8f('0x129')](db[_0x6a8f('0x3a')],{'as':_0x6a8f('0x139'),'through':_0x6a8f('0x2e'),'required':![]});db['User'][_0x6a8f('0x129')](db[_0x6a8f('0x13a')],{'as':'ChatQueues','through':_0x6a8f('0x2d'),'required':![],'hooks':!![]});db[_0x6a8f('0x13')][_0x6a8f('0x129')](db[_0x6a8f('0x4c')],{'as':_0x6a8f('0x13b'),'through':'UserFaxQueue','required':![]});db[_0x6a8f('0x13')][_0x6a8f('0x129')](db['SmsQueue'],{'as':_0x6a8f('0x13c'),'through':_0x6a8f('0x13d'),'required':![]});db[_0x6a8f('0x13')][_0x6a8f('0x129')](db[_0x6a8f('0x5d')],{'as':_0x6a8f('0x13e'),'through':_0x6a8f('0x33'),'required':![]});db[_0x6a8f('0x13')][_0x6a8f('0x129')](db['WhatsappQueue'],{'as':_0x6a8f('0x13f'),'through':'UserWhatsappQueue','required':![]});db['User'][_0x6a8f('0x129')](db[_0x6a8f('0xf6')],{'through':_0x6a8f('0x12b')});db['User']['belongsToMany'](db[_0x6a8f('0x5f')],{'as':'ChatWebsites','through':_0x6a8f('0x140')});db[_0x6a8f('0x13')][_0x6a8f('0x129')](db[_0x6a8f('0x44')],{'as':_0x6a8f('0x141'),'through':'user_has_fax_accounts'});db[_0x6a8f('0x13')][_0x6a8f('0x129')](db['MailAccount'],{'as':_0x6a8f('0x142'),'through':_0x6a8f('0x143')});db[_0x6a8f('0x13')]['belongsToMany'](db[_0x6a8f('0x55')],{'as':_0x6a8f('0x144'),'through':_0x6a8f('0x145')});db[_0x6a8f('0x13')][_0x6a8f('0x129')](db[_0x6a8f('0x146')],{'as':_0x6a8f('0x147'),'through':'user_has_sms_accounts'});db['User']['belongsToMany'](db[_0x6a8f('0xfe')],{'as':'WhatsappAccounts','through':_0x6a8f('0x148')});db[_0x6a8f('0x16')][_0x6a8f('0x118')](db[_0x6a8f('0x1a')],{'as':_0x6a8f('0x149'),'onDelete':'cascade','foreignKey':_0x6a8f('0x14a')});db[_0x6a8f('0x18')][_0x6a8f('0x118')](db[_0x6a8f('0x1a')],{'onDelete':_0x6a8f('0x114')});db[_0x6a8f('0x1a')][_0x6a8f('0x118')](db[_0x6a8f('0x1a')],{'as':_0x6a8f('0x14b'),'onDelete':_0x6a8f('0x114')});db[_0x6a8f('0x14c')]['belongsToMany'](db[_0x6a8f('0x14d')],{'as':'Sounds','through':_0x6a8f('0x14e')});db[_0x6a8f('0x1d')]['hasMany'](db[_0x6a8f('0x2c')],{'as':_0x6a8f('0x14f'),'foreignKey':_0x6a8f('0x150')});db[_0x6a8f('0x1d')]['hasMany'](db[_0x6a8f('0x70')],{'as':_0x6a8f('0x122'),'foreignKey':_0x6a8f('0x150')});db[_0x6a8f('0x1d')][_0x6a8f('0x118')](db[_0x6a8f('0x72')],{'as':'HopperFinals','foreignKey':_0x6a8f('0x150')});db[_0x6a8f('0x1d')]['hasMany'](db[_0x6a8f('0x74')],{'as':_0x6a8f('0x151'),'foreignKey':_0x6a8f('0x150')});db[_0x6a8f('0x1d')]['hasMany'](db[_0x6a8f('0x11c')],{'as':'ReportAgentPreview','foreignKey':_0x6a8f('0x150')});db['VoiceQueue'][_0x6a8f('0x118')](db[_0x6a8f('0x152')],{'as':_0x6a8f('0x153'),'foreignKey':_0x6a8f('0x150')});db['VoiceQueue'][_0x6a8f('0x118')](db[_0x6a8f('0xd7')],{'as':_0x6a8f('0x154'),'foreignKey':_0x6a8f('0x150')});db[_0x6a8f('0x1d')][_0x6a8f('0x155')](db[_0x6a8f('0x28')],{'as':_0x6a8f('0x28'),'foreignKey':'TrunkId'});db[_0x6a8f('0x1d')][_0x6a8f('0x155')](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0x6a8f('0x156')});db[_0x6a8f('0x1d')][_0x6a8f('0x155')](db['Interval'],{'as':_0x6a8f('0x157'),'foreignKey':_0x6a8f('0x158')});db[_0x6a8f('0x1d')][_0x6a8f('0x155')](db[_0x6a8f('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x6a8f('0x1d')][_0x6a8f('0x129')](db[_0x6a8f('0xf6')],{'as':_0x6a8f('0x12a'),'through':'voice_queues_has_cm_lists'});db[_0x6a8f('0x1d')][_0x6a8f('0x129')](db[_0x6a8f('0x13')],{'as':'Agents','through':_0x6a8f('0x135')});db[_0x6a8f('0x1d')][_0x6a8f('0x129')](db[_0x6a8f('0x12c')],{'as':_0x6a8f('0x159'),'through':_0x6a8f('0x15a')});db[_0x6a8f('0x1d')]['belongsToMany'](db[_0x6a8f('0xf6')],{'as':_0x6a8f('0x15b'),'through':_0x6a8f('0x15c')});db[_0x6a8f('0x117')][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x13'),'foreignKey':_0x6a8f('0x115')});db[_0x6a8f('0x1f')]['belongsTo'](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x13'),'foreignKey':_0x6a8f('0x115')});db['VoiceMail']['hasMany'](db[_0x6a8f('0x15d')],{'as':_0x6a8f('0x15e'),'onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x15f'),'sourceKey':_0x6a8f('0x160')});db[_0x6a8f('0x15d')][_0x6a8f('0x155')](db['VoiceMail'],{'foreignKey':_0x6a8f('0x15f'),'targetKey':'mailbox'});db[_0x6a8f('0x161')][_0x6a8f('0x118')](db[_0x6a8f('0x25')],{'as':_0x6a8f('0x162'),'foreignKey':_0x6a8f('0x163'),'constraints':![]});db[_0x6a8f('0x161')][_0x6a8f('0x118')](db[_0x6a8f('0x24')],{'as':_0x6a8f('0x164'),'foreignKey':_0x6a8f('0x163'),'constraints':![]});db[_0x6a8f('0x161')][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x13'),'foreignKey':_0x6a8f('0x115')});db[_0x6a8f('0x161')][_0x6a8f('0x155')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db['MailServerIn'][_0x6a8f('0x155')](db[_0x6a8f('0x165')],{'as':_0x6a8f('0x165'),'foreignKey':_0x6a8f('0x166')});db['MailServerIn'][_0x6a8f('0x155')](db[_0x6a8f('0x167')],{'as':_0x6a8f('0x167'),'foreignKey':_0x6a8f('0x168'),'onDelete':_0x6a8f('0x169')});db[_0x6a8f('0x16a')][_0x6a8f('0x155')](db[_0x6a8f('0x165')],{'as':_0x6a8f('0x165'),'foreignKey':_0x6a8f('0x166')});db[_0x6a8f('0x16a')][_0x6a8f('0x155')](db['CloudProvider'],{'as':_0x6a8f('0x167'),'foreignKey':'CloudProviderId','onDelete':_0x6a8f('0x169')});db['MailAccount'][_0x6a8f('0x112')](db['MailServerIn'],{'as':_0x6a8f('0x16b'),'onDelete':_0x6a8f('0x114')});db[_0x6a8f('0x165')][_0x6a8f('0x112')](db[_0x6a8f('0x16a')],{'as':_0x6a8f('0x16c'),'onDelete':_0x6a8f('0x114')});db[_0x6a8f('0x165')][_0x6a8f('0x118')](db['Disposition'],{'as':_0x6a8f('0x16d'),'foreignKey':_0x6a8f('0x166'),'onDelete':_0x6a8f('0x114')});db[_0x6a8f('0x165')]['hasMany'](db[_0x6a8f('0x16e')],{'as':'Answers','foreignKey':_0x6a8f('0x166')});db[_0x6a8f('0x165')][_0x6a8f('0x118')](db[_0x6a8f('0x16f')],{'as':_0x6a8f('0x15e'),'foreignKey':_0x6a8f('0x166')});db[_0x6a8f('0x165')]['hasMany'](db['MailInteraction'],{'as':'Interactions'});db[_0x6a8f('0x165')][_0x6a8f('0x118')](db['MailApplication'],{'as':_0x6a8f('0x14b'),'foreignKey':_0x6a8f('0x166'),'onDelete':_0x6a8f('0x114')});db['MailAccount']['belongsTo'](db[_0x6a8f('0xf6')],{'as':_0x6a8f('0x170'),'foreignKey':_0x6a8f('0x171')});db['MailAccount'][_0x6a8f('0x155')](db[_0x6a8f('0x172')],{'as':_0x6a8f('0x172'),'foreignKey':_0x6a8f('0x173')});db[_0x6a8f('0x165')][_0x6a8f('0x155')](db[_0x6a8f('0x7f')],{'as':_0x6a8f('0x174'),'foreignKey':_0x6a8f('0x175')});db['MailAccount']['belongsToMany'](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x176'),'through':'user_has_mail_accounts'});db['MailQueue'][_0x6a8f('0x129')](db['User'],{'as':'Agents','through':'UserMailQueue'});db[_0x6a8f('0x3a')]['belongsToMany'](db[_0x6a8f('0x12c')],{'through':_0x6a8f('0x177'),'as':_0x6a8f('0x159')});db['MailInteraction'][_0x6a8f('0x118')](db[_0x6a8f('0x16f')],{'as':_0x6a8f('0x15e'),'onDelete':'cascade','foreignKey':_0x6a8f('0x178')});db[_0x6a8f('0x3c')][_0x6a8f('0x155')](db[_0x6a8f('0x165')],{'as':_0x6a8f('0x179'),'foreignKey':_0x6a8f('0x166')});db['MailInteraction'][_0x6a8f('0x155')](db[_0x6a8f('0x17a')],{'as':_0x6a8f('0x17b'),'foreignKey':'ContactId'});db[_0x6a8f('0x3c')][_0x6a8f('0x155')](db['User'],{'as':_0x6a8f('0x17c'),'foreignKey':_0x6a8f('0x115')});db[_0x6a8f('0x3c')][_0x6a8f('0x129')](db[_0x6a8f('0x17d')],{'through':'mail_interaction_has_tags','as':'Tags'});db['MailInteraction']['belongsToMany'](db[_0x6a8f('0x17d')],{'through':_0x6a8f('0x17e'),'as':_0x6a8f('0x17f')});db[_0x6a8f('0x3c')][_0x6a8f('0x129')](db['User'],{'as':'Users','through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x6a8f('0x16f')][_0x6a8f('0x118')](db['Attachment'],{'as':'Attachments','onDelete':'cascade'});db[_0x6a8f('0x16f')][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x13')});db[_0x6a8f('0x16f')]['belongsTo'](db[_0x6a8f('0x17a')],{'onDelete':_0x6a8f('0x114'),'as':_0x6a8f('0x17b')});db['MailMessage'][_0x6a8f('0x155')](db[_0x6a8f('0x3c')],{'as':_0x6a8f('0x180'),'foreignKey':'MailInteractionId'});db['MailMessage']['belongsTo'](db[_0x6a8f('0x165')],{'as':_0x6a8f('0x179'),'foreignKey':_0x6a8f('0x166')});db['MailMessage'][_0x6a8f('0x155')](db[_0x6a8f('0x5f')],{'as':_0x6a8f('0x5f'),'foreignKey':_0x6a8f('0x181')});db[_0x6a8f('0x16f')]['belongsTo'](db[_0x6a8f('0x68')],{'as':_0x6a8f('0x68'),'foreignKey':_0x6a8f('0x182')});db[_0x6a8f('0x183')]['belongsTo'](db[_0x6a8f('0x13')],{'onDelete':_0x6a8f('0x169')});db[_0x6a8f('0x183')][_0x6a8f('0x155')](db[_0x6a8f('0x3a')],{'onDelete':_0x6a8f('0x169')});db['MailApplication'][_0x6a8f('0x155')](db[_0x6a8f('0x165')],{'onDelete':'restrict'});db[_0x6a8f('0x183')]['belongsTo'](db['Interval'],{'onDelete':_0x6a8f('0x169'),'foreignKey':'IntervalId'});db[_0x6a8f('0x183')][_0x6a8f('0x155')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x6a8f('0x184')});db[_0x6a8f('0x3f')]['belongsTo'](db[_0x6a8f('0x165')],{});db['MailQueueReport'][_0x6a8f('0x155')](db[_0x6a8f('0xf6')],{'as':_0x6a8f('0x170'),'foreignKey':_0x6a8f('0x171')});db['MailQueueReport'][_0x6a8f('0x155')](db[_0x6a8f('0x17a')],{'as':_0x6a8f('0x17b'),'foreignKey':_0x6a8f('0x185')});db[_0x6a8f('0x3f')][_0x6a8f('0x155')](db[_0x6a8f('0x3c')],{});db[_0x6a8f('0x3f')][_0x6a8f('0x155')](db[_0x6a8f('0x16f')],{});db[_0x6a8f('0x3f')][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{});db[_0x6a8f('0x3f')][_0x6a8f('0x155')](db[_0x6a8f('0x3a')],{});db[_0x6a8f('0x41')][_0x6a8f('0x118')](db[_0x6a8f('0x42')],{'as':'Items','onDelete':_0x6a8f('0x114')});db[_0x6a8f('0x44')][_0x6a8f('0x118')](db['Disposition'],{'as':_0x6a8f('0x16d'),'foreignKey':'FaxAccountId','onDelete':_0x6a8f('0x114')});db[_0x6a8f('0x44')][_0x6a8f('0x118')](db[_0x6a8f('0x16e')],{'as':_0x6a8f('0x186'),'foreignKey':_0x6a8f('0x187')});db[_0x6a8f('0x44')][_0x6a8f('0x118')](db['FaxInteraction'],{'as':_0x6a8f('0x188')});db[_0x6a8f('0x44')][_0x6a8f('0x118')](db[_0x6a8f('0x46')],{'as':_0x6a8f('0x14b'),'foreignKey':_0x6a8f('0x187'),'onDelete':'cascade'});db[_0x6a8f('0x44')]['hasMany'](db[_0x6a8f('0x1a')],{'as':_0x6a8f('0x189'),'onDelete':_0x6a8f('0x114')});db['FaxAccount']['hasMany'](db[_0x6a8f('0x4a')],{'as':'Messages'});db[_0x6a8f('0x44')]['belongsTo'](db['Trunk'],{'as':_0x6a8f('0x28')});db[_0x6a8f('0x44')][_0x6a8f('0x155')](db[_0x6a8f('0xf6')],{'as':'List','foreignKey':_0x6a8f('0x171')});db[_0x6a8f('0x44')][_0x6a8f('0x155')](db[_0x6a8f('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':_0x6a8f('0x175')});db[_0x6a8f('0x44')][_0x6a8f('0x129')](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x176'),'through':'user_has_fax_accounts'});db[_0x6a8f('0x46')][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{'onDelete':'restrict'});db[_0x6a8f('0x46')]['belongsTo'](db['FaxQueue'],{'onDelete':_0x6a8f('0x169')});db[_0x6a8f('0x46')]['belongsTo'](db['FaxAccount'],{'onDelete':_0x6a8f('0x169')});db['FaxApplication'][_0x6a8f('0x155')](db[_0x6a8f('0x17d')],{'onDelete':_0x6a8f('0x169'),'foreignKey':_0x6a8f('0x184')});db[_0x6a8f('0x48')]['hasMany'](db[_0x6a8f('0x4a')],{'as':_0x6a8f('0x15e'),'onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x18a')});db[_0x6a8f('0x48')][_0x6a8f('0x155')](db[_0x6a8f('0x44')],{'as':_0x6a8f('0x179'),'foreignKey':_0x6a8f('0x187')});db[_0x6a8f('0x48')]['belongsTo'](db[_0x6a8f('0x17a')],{'as':'Contact','foreignKey':_0x6a8f('0x185')});db[_0x6a8f('0x48')]['belongsTo'](db['User'],{'as':_0x6a8f('0x17c'),'foreignKey':_0x6a8f('0x115')});db[_0x6a8f('0x48')][_0x6a8f('0x129')](db[_0x6a8f('0x17d')],{'through':'fax_interaction_has_tags','as':'Tags'});db[_0x6a8f('0x48')][_0x6a8f('0x129')](db[_0x6a8f('0x17d')],{'through':_0x6a8f('0x18b'),'as':_0x6a8f('0x17f')});db['FaxInteraction'][_0x6a8f('0x129')](db['User'],{'as':_0x6a8f('0x18c'),'through':_0x6a8f('0x18d'),'foreignKey':_0x6a8f('0x18a')});db['FaxMessage'][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{'onDelete':_0x6a8f('0x114'),'as':_0x6a8f('0x13')});db[_0x6a8f('0x4a')][_0x6a8f('0x155')](db[_0x6a8f('0x48')],{'as':'Interaction','foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x6a8f('0x155')](db[_0x6a8f('0x17a')],{'onDelete':'cascade','as':_0x6a8f('0x17b')});db[_0x6a8f('0x4a')][_0x6a8f('0x155')](db['Attachment'],{'as':'Attachment','foreignKey':_0x6a8f('0x18e')});db['FaxMessage'][_0x6a8f('0x155')](db[_0x6a8f('0x44')],{'as':_0x6a8f('0x179'),'foreignKey':_0x6a8f('0x187')});db[_0x6a8f('0x4c')][_0x6a8f('0x129')](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x176'),'through':_0x6a8f('0x30')});db[_0x6a8f('0x4c')][_0x6a8f('0x129')](db['Team'],{'through':_0x6a8f('0x18f'),'as':_0x6a8f('0x159')});db[_0x6a8f('0x190')][_0x6a8f('0x155')](db[_0x6a8f('0x44')],{});db[_0x6a8f('0x190')][_0x6a8f('0x155')](db[_0x6a8f('0xf6')],{'as':_0x6a8f('0x170'),'foreignKey':'ListId'});db[_0x6a8f('0x190')][_0x6a8f('0x155')](db[_0x6a8f('0x17a')],{'as':_0x6a8f('0x17b'),'foreignKey':_0x6a8f('0x185')});db[_0x6a8f('0x190')][_0x6a8f('0x155')](db['FaxInteraction'],{});db[_0x6a8f('0x190')][_0x6a8f('0x155')](db[_0x6a8f('0x4a')],{});db[_0x6a8f('0x190')][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{});db[_0x6a8f('0x190')][_0x6a8f('0x155')](db[_0x6a8f('0x4c')],{});db[_0x6a8f('0x146')][_0x6a8f('0x118')](db[_0x6a8f('0x7c')],{'as':'Dispositions','foreignKey':_0x6a8f('0x191'),'onDelete':_0x6a8f('0x114')});db[_0x6a8f('0x146')][_0x6a8f('0x118')](db['CannedAnswer'],{'as':_0x6a8f('0x186'),'foreignKey':_0x6a8f('0x191')});db[_0x6a8f('0x146')][_0x6a8f('0x118')](db['SmsMessage'],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0x6a8f('0x146')][_0x6a8f('0x118')](db[_0x6a8f('0x51')],{'as':_0x6a8f('0x188')});db[_0x6a8f('0x146')]['hasMany'](db[_0x6a8f('0x4f')],{'as':_0x6a8f('0x14b'),'foreignKey':_0x6a8f('0x191'),'onDelete':_0x6a8f('0x114')});db['SmsAccount'][_0x6a8f('0x155')](db[_0x6a8f('0xf6')],{'as':_0x6a8f('0x170'),'foreignKey':'ListId'});db[_0x6a8f('0x146')][_0x6a8f('0x155')](db[_0x6a8f('0x7f')],{'as':_0x6a8f('0x174'),'foreignKey':_0x6a8f('0x175')});db[_0x6a8f('0x146')][_0x6a8f('0x129')](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x176'),'through':_0x6a8f('0x192')});db[_0x6a8f('0x4f')]['belongsTo'](db[_0x6a8f('0x13')],{'onDelete':_0x6a8f('0x169')});db[_0x6a8f('0x4f')]['belongsTo'](db[_0x6a8f('0x53')],{'onDelete':_0x6a8f('0x169')});db['SmsApplication'][_0x6a8f('0x155')](db[_0x6a8f('0x146')],{'onDelete':_0x6a8f('0x169')});db['SmsApplication'][_0x6a8f('0x155')](db['Interval'],{'onDelete':_0x6a8f('0x169'),'foreignKey':_0x6a8f('0x158')});db[_0x6a8f('0x4f')][_0x6a8f('0x155')](db[_0x6a8f('0x17d')],{'onDelete':_0x6a8f('0x169'),'foreignKey':_0x6a8f('0x184')});db[_0x6a8f('0x51')][_0x6a8f('0x118')](db['SmsMessage'],{'as':'Messages','onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x193')});db[_0x6a8f('0x51')][_0x6a8f('0x155')](db[_0x6a8f('0x146')],{'as':_0x6a8f('0x179'),'foreignKey':_0x6a8f('0x191')});db[_0x6a8f('0x51')]['belongsTo'](db['CmContact'],{'as':_0x6a8f('0x17b'),'foreignKey':_0x6a8f('0x185')});db[_0x6a8f('0x51')]['belongsTo'](db[_0x6a8f('0x13')],{'as':'Owner','foreignKey':'UserId'});db['SmsInteraction']['belongsToMany'](db['Tag'],{'through':_0x6a8f('0x194'),'as':_0x6a8f('0x195')});db[_0x6a8f('0x51')][_0x6a8f('0x129')](db['Tag'],{'through':_0x6a8f('0x194'),'as':'ThroughTags'});db[_0x6a8f('0x51')][_0x6a8f('0x129')](db['User'],{'as':_0x6a8f('0x18c'),'through':_0x6a8f('0x131'),'foreignKey':'SmsInteractionId'});db[_0x6a8f('0x196')][_0x6a8f('0x155')](db['User'],{'as':_0x6a8f('0x13')});db[_0x6a8f('0x196')][_0x6a8f('0x155')](db[_0x6a8f('0x17a')],{'onDelete':_0x6a8f('0x114'),'as':_0x6a8f('0x17b')});db[_0x6a8f('0x196')][_0x6a8f('0x155')](db[_0x6a8f('0x51')],{'onDelete':_0x6a8f('0x114'),'as':_0x6a8f('0x180'),'foreignKey':_0x6a8f('0x193')});db[_0x6a8f('0x196')][_0x6a8f('0x155')](db['SmsAccount'],{'as':_0x6a8f('0x179'),'foreignKey':_0x6a8f('0x191')});db[_0x6a8f('0x53')][_0x6a8f('0x129')](db['User'],{'as':_0x6a8f('0x176'),'through':_0x6a8f('0x13d'),'foreignKey':_0x6a8f('0x197')});db[_0x6a8f('0x53')][_0x6a8f('0x129')](db[_0x6a8f('0x12c')],{'through':_0x6a8f('0x198'),'as':_0x6a8f('0x159')});db[_0x6a8f('0x55')][_0x6a8f('0x118')](db[_0x6a8f('0x7c')],{'as':'Dispositions','foreignKey':_0x6a8f('0x199'),'onDelete':_0x6a8f('0x114')});db[_0x6a8f('0x55')][_0x6a8f('0x118')](db[_0x6a8f('0x16e')],{'as':_0x6a8f('0x186'),'foreignKey':_0x6a8f('0x199')});db[_0x6a8f('0x55')]['hasMany'](db[_0x6a8f('0x59')],{'as':_0x6a8f('0x188'),'foreignKey':_0x6a8f('0x199')});db[_0x6a8f('0x55')][_0x6a8f('0x118')](db[_0x6a8f('0x5b')],{'as':'Messages','foreignKey':_0x6a8f('0x199')});db[_0x6a8f('0x55')][_0x6a8f('0x118')](db[_0x6a8f('0x57')],{'as':_0x6a8f('0x14b'),'foreignKey':_0x6a8f('0x199'),'onDelete':_0x6a8f('0x114')});db[_0x6a8f('0x55')][_0x6a8f('0x155')](db[_0x6a8f('0xf6')],{'as':_0x6a8f('0x170'),'foreignKey':_0x6a8f('0x171')});db[_0x6a8f('0x55')][_0x6a8f('0x155')](db[_0x6a8f('0x7f')],{'as':_0x6a8f('0x174'),'foreignKey':_0x6a8f('0x175')});db[_0x6a8f('0x55')][_0x6a8f('0x129')](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x176'),'through':_0x6a8f('0x145')});db[_0x6a8f('0x57')][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{'onDelete':_0x6a8f('0x169')});db[_0x6a8f('0x57')][_0x6a8f('0x155')](db[_0x6a8f('0x5d')],{'onDelete':_0x6a8f('0x169'),'foreignKey':_0x6a8f('0x19a')});db[_0x6a8f('0x57')]['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0x6a8f('0x169'),'foreignKey':_0x6a8f('0x199')});db[_0x6a8f('0x57')]['belongsTo'](db[_0x6a8f('0x157')],{'onDelete':'restrict','foreignKey':_0x6a8f('0x158')});db['OpenchannelApplication']['belongsTo'](db[_0x6a8f('0x17d')],{'onDelete':'restrict','foreignKey':_0x6a8f('0x184')});db[_0x6a8f('0x59')][_0x6a8f('0x118')](db['OpenchannelMessage'],{'as':_0x6a8f('0x15e'),'onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x19b')});db[_0x6a8f('0x59')][_0x6a8f('0x155')](db[_0x6a8f('0x55')],{'as':'Account','foreignKey':_0x6a8f('0x199')});db[_0x6a8f('0x59')][_0x6a8f('0x155')](db[_0x6a8f('0x17a')],{'as':_0x6a8f('0x17b'),'foreignKey':_0x6a8f('0x185')});db['OpenchannelInteraction'][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x17c'),'foreignKey':_0x6a8f('0x115')});db[_0x6a8f('0x59')][_0x6a8f('0x129')](db[_0x6a8f('0x17d')],{'through':_0x6a8f('0x19c'),'as':'Tags'});db[_0x6a8f('0x59')][_0x6a8f('0x129')](db[_0x6a8f('0x17d')],{'through':'openchannel_interaction_has_tags','as':_0x6a8f('0x17f')});db[_0x6a8f('0x59')][_0x6a8f('0x129')](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x18c'),'through':'user_has_openchannel_interactions','foreignKey':_0x6a8f('0x19b')});db[_0x6a8f('0x5b')]['belongsTo'](db[_0x6a8f('0x13')],{'onDelete':_0x6a8f('0x114'),'as':_0x6a8f('0x13')});db[_0x6a8f('0x5b')][_0x6a8f('0x155')](db['CmContact'],{'onDelete':_0x6a8f('0x114'),'as':_0x6a8f('0x17b')});db['OpenchannelMessage'][_0x6a8f('0x155')](db[_0x6a8f('0x59')],{'onDelete':_0x6a8f('0x114'),'as':_0x6a8f('0x180'),'foreignKey':_0x6a8f('0x19b')});db[_0x6a8f('0x5b')][_0x6a8f('0x155')](db[_0x6a8f('0xeb')],{'as':_0x6a8f('0xeb'),'foreignKey':_0x6a8f('0x18e')});db['OpenchannelMessage'][_0x6a8f('0x155')](db[_0x6a8f('0x55')],{'as':_0x6a8f('0x179'),'foreignKey':_0x6a8f('0x199')});db['OpenchannelQueue'][_0x6a8f('0x129')](db['User'],{'as':_0x6a8f('0x176'),'through':'UserOpenchannelQueue','foreignKey':_0x6a8f('0x19a')});db[_0x6a8f('0x5d')][_0x6a8f('0x129')](db[_0x6a8f('0x12c')],{'through':_0x6a8f('0x19d'),'as':_0x6a8f('0x159')});db[_0x6a8f('0x5f')][_0x6a8f('0x118')](db['Disposition'],{'as':_0x6a8f('0x16d'),'foreignKey':'ChatWebsiteId','onDelete':_0x6a8f('0x114')});db['ChatWebsite'][_0x6a8f('0x118')](db[_0x6a8f('0x16e')],{'as':_0x6a8f('0x186'),'foreignKey':_0x6a8f('0x181')});db['ChatWebsite']['hasMany'](db['ChatProactiveAction'],{'as':_0x6a8f('0x19e')});db['ChatWebsite'][_0x6a8f('0x118')](db[_0x6a8f('0x64')],{'as':_0x6a8f('0x188')});db[_0x6a8f('0x5f')][_0x6a8f('0x118')](db[_0x6a8f('0x62')],{'as':_0x6a8f('0x14b'),'foreignKey':'ChatWebsiteId','onDelete':_0x6a8f('0x114')});db[_0x6a8f('0x5f')]['hasMany'](db[_0x6a8f('0x66')],{'as':_0x6a8f('0x15e')});db[_0x6a8f('0x5f')][_0x6a8f('0x155')](db[_0x6a8f('0xf6')],{'as':_0x6a8f('0x170'),'foreignKey':'ListId'});db[_0x6a8f('0x5f')]['belongsTo'](db['Interval'],{'as':_0x6a8f('0x157'),'foreignKey':_0x6a8f('0x158')});db['ChatWebsite'][_0x6a8f('0x155')](db[_0x6a8f('0x165')],{'as':_0x6a8f('0x165'),'foreignKey':_0x6a8f('0x166')});db[_0x6a8f('0x5f')]['belongsTo'](db[_0x6a8f('0x7f')],{'as':_0x6a8f('0x174'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x6a8f('0x5f')][_0x6a8f('0x129')](db['User'],{'as':'Agents','through':_0x6a8f('0x140')});db[_0x6a8f('0x19f')][_0x6a8f('0x155')](db['OpenchannelAccount'],{});db[_0x6a8f('0x19f')]['belongsTo'](db[_0x6a8f('0xf6')],{'as':_0x6a8f('0x170'),'foreignKey':_0x6a8f('0x171')});db['OpenchannelQueueReport']['belongsTo'](db[_0x6a8f('0x17a')],{'as':_0x6a8f('0x17b'),'foreignKey':_0x6a8f('0x185')});db[_0x6a8f('0x19f')]['belongsTo'](db[_0x6a8f('0x59')],{});db['OpenchannelQueueReport'][_0x6a8f('0x155')](db[_0x6a8f('0x5b')],{});db[_0x6a8f('0x19f')]['belongsTo'](db[_0x6a8f('0x13')],{});db['OpenchannelQueueReport'][_0x6a8f('0x155')](db[_0x6a8f('0x5d')],{});db['ChatApplication'][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x1a0'),'foreignKey':'UserId','onDelete':_0x6a8f('0x169')});db[_0x6a8f('0x62')][_0x6a8f('0x155')](db[_0x6a8f('0x13a')],{'as':_0x6a8f('0x1a1'),'foreignKey':_0x6a8f('0x1a2'),'onDelete':_0x6a8f('0x169')});db[_0x6a8f('0x62')][_0x6a8f('0x155')](db[_0x6a8f('0x5f')],{'as':_0x6a8f('0x1a3'),'foreignKey':_0x6a8f('0x181'),'onDelete':_0x6a8f('0x169')});db[_0x6a8f('0x62')][_0x6a8f('0x155')](db[_0x6a8f('0x17d')],{'onDelete':'restrict','foreignKey':_0x6a8f('0x184')});db[_0x6a8f('0x64')][_0x6a8f('0x118')](db[_0x6a8f('0x66')],{'as':_0x6a8f('0x15e'),'onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x1a4')});db['ChatInteraction'][_0x6a8f('0x155')](db[_0x6a8f('0x5f')],{'as':'Account','foreignKey':_0x6a8f('0x181')});db[_0x6a8f('0x64')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x6a8f('0x185')});db['ChatInteraction'][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x17c'),'foreignKey':_0x6a8f('0x115')});db[_0x6a8f('0x64')][_0x6a8f('0x129')](db[_0x6a8f('0x17d')],{'through':_0x6a8f('0x1a5'),'as':'Tags'});db['ChatInteraction'][_0x6a8f('0x129')](db[_0x6a8f('0x17d')],{'through':_0x6a8f('0x1a5'),'as':_0x6a8f('0x17f')});db['ChatInteraction'][_0x6a8f('0x129')](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x18c'),'through':_0x6a8f('0x12f'),'foreignKey':_0x6a8f('0x1a4')});db[_0x6a8f('0x66')][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{'onDelete':_0x6a8f('0x114'),'as':_0x6a8f('0x13')});db[_0x6a8f('0x66')]['belongsTo'](db[_0x6a8f('0x17a')],{'onDelete':_0x6a8f('0x114'),'as':'Contact','foreignKey':_0x6a8f('0x185')});db['ChatMessage'][_0x6a8f('0x155')](db[_0x6a8f('0x64')],{'onDelete':'cascade','as':_0x6a8f('0x180'),'foreignKey':_0x6a8f('0x1a4')});db[_0x6a8f('0x66')][_0x6a8f('0x155')](db[_0x6a8f('0xeb')],{'as':_0x6a8f('0xeb'),'foreignKey':_0x6a8f('0x18e')});db[_0x6a8f('0x66')]['belongsTo'](db['ChatWebsite'],{'as':_0x6a8f('0x179'),'foreignKey':_0x6a8f('0x181')});db[_0x6a8f('0x68')][_0x6a8f('0x118')](db[_0x6a8f('0xeb')],{'as':'Attachments','foreignKey':_0x6a8f('0x182'),'onDelete':_0x6a8f('0x114'),'hooks':!![]});db[_0x6a8f('0x68')][_0x6a8f('0x155')](db[_0x6a8f('0x17a')],{'onDelete':_0x6a8f('0x114'),'as':_0x6a8f('0x17b'),'foreignKey':_0x6a8f('0x185')});db[_0x6a8f('0x68')][_0x6a8f('0x155')](db[_0x6a8f('0x5f')],{'as':_0x6a8f('0x179'),'foreignKey':_0x6a8f('0x181')});db[_0x6a8f('0x13a')][_0x6a8f('0x129')](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x176'),'through':_0x6a8f('0x2d'),'hooks':!![]});db[_0x6a8f('0x13a')][_0x6a8f('0x129')](db[_0x6a8f('0x12c')],{'through':'team_has_chat_queues','as':_0x6a8f('0x159')});db[_0x6a8f('0x6b')][_0x6a8f('0x118')](db[_0x6a8f('0xd2')],{'as':_0x6a8f('0x15e'),'foreignKey':_0x6a8f('0x1a6'),'onDelete':_0x6a8f('0x114')});db['ChatGroup']['belongsToMany'](db['User'],{'as':_0x6a8f('0x14f'),'through':_0x6a8f('0x126')});db['ChatProactiveAction'][_0x6a8f('0x155')](db[_0x6a8f('0x5f')],{'as':_0x6a8f('0x1a3'),'foreignKey':_0x6a8f('0x181')});db[_0x6a8f('0x6e')][_0x6a8f('0x118')](db[_0x6a8f('0x17a')],{'as':_0x6a8f('0x127'),'foreignKey':_0x6a8f('0x1a7')});db['CmContact'][_0x6a8f('0x118')](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x6a8f('0x1a8')});db[_0x6a8f('0x17a')][_0x6a8f('0x118')](db[_0x6a8f('0x70')],{'as':_0x6a8f('0x122'),'foreignKey':_0x6a8f('0x185')});db[_0x6a8f('0x17a')][_0x6a8f('0x118')](db[_0x6a8f('0x72')],{'as':_0x6a8f('0x11a'),'foreignKey':_0x6a8f('0x185')});db[_0x6a8f('0x17a')][_0x6a8f('0x118')](db[_0x6a8f('0x74')],{'as':_0x6a8f('0x151'),'foreignKey':_0x6a8f('0x185')});db['CmContact'][_0x6a8f('0x118')](db['ReportAgentPreview'],{'as':_0x6a8f('0x11c'),'foreignKey':_0x6a8f('0x185')});db[_0x6a8f('0x17a')][_0x6a8f('0x118')](db[_0x6a8f('0xd7')],{'as':_0x6a8f('0x154'),'foreignKey':'ContactId'});db[_0x6a8f('0x17a')][_0x6a8f('0x118')](db[_0x6a8f('0x59')],{'as':_0x6a8f('0x11d'),'foreignKey':'ContactId','onDelete':_0x6a8f('0x169')});db[_0x6a8f('0x17a')][_0x6a8f('0x118')](db[_0x6a8f('0x64')],{'as':_0x6a8f('0x11e'),'foreignKey':_0x6a8f('0x185'),'onDelete':_0x6a8f('0x169')});db[_0x6a8f('0x17a')]['hasMany'](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x6a8f('0x185'),'onDelete':_0x6a8f('0x169')});db[_0x6a8f('0x17a')][_0x6a8f('0x118')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0x6a8f('0x185'),'onDelete':'restrict'});db[_0x6a8f('0x17a')]['hasMany'](db[_0x6a8f('0x3c')],{'as':_0x6a8f('0x120'),'foreignKey':_0x6a8f('0x185'),'onDelete':_0x6a8f('0x169')});db[_0x6a8f('0x17a')][_0x6a8f('0x155')](db[_0x6a8f('0x6e')],{'as':_0x6a8f('0x1a9'),'foreignKey':'CompanyId'});db[_0x6a8f('0x17a')][_0x6a8f('0x155')](db[_0x6a8f('0xf6')],{'as':_0x6a8f('0x170'),'foreignKey':_0x6a8f('0x171'),'onDelete':_0x6a8f('0x114')});db[_0x6a8f('0x17a')][_0x6a8f('0x129')](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x18c'),'through':_0x6a8f('0x128')});db[_0x6a8f('0x17a')]['belongsToMany'](db[_0x6a8f('0x17d')],{'as':_0x6a8f('0x195'),'through':'cm_contact_has_tags'});db['CmContact'][_0x6a8f('0x129')](db['Tag'],{'through':_0x6a8f('0x1aa'),'as':_0x6a8f('0x17f')});db['CmHopper'][_0x6a8f('0x118')](db[_0x6a8f('0x8b')],{'as':_0x6a8f('0x1ab'),'foreignKey':_0x6a8f('0x1ac')});db['CmHopper'][_0x6a8f('0x155')](db['CmContact'],{'as':_0x6a8f('0x17b'),'foreignKey':'ContactId','onDelete':'cascade'});db['CmHopper'][_0x6a8f('0x155')](db[_0x6a8f('0xf6')],{'as':'List','foreignKey':_0x6a8f('0x171'),'onDelete':_0x6a8f('0x114')});db['CmHopper'][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x1a0'),'foreignKey':_0x6a8f('0x115')});db[_0x6a8f('0x70')][_0x6a8f('0x155')](db[_0x6a8f('0x1d')],{'as':'Queue','foreignKey':_0x6a8f('0x150'),'onDelete':'cascade'});db[_0x6a8f('0x70')][_0x6a8f('0x155')](db[_0x6a8f('0xe7')],{'as':_0x6a8f('0xe7'),'foreignKey':_0x6a8f('0x1ad'),'onDelete':'cascade'});db[_0x6a8f('0x70')][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x17c'),'foreignKey':_0x6a8f('0x1ae')});db[_0x6a8f('0x152')][_0x6a8f('0x155')](db[_0x6a8f('0x17a')],{'as':'Contact','foreignKey':_0x6a8f('0x185'),'onDelete':_0x6a8f('0x114')});db[_0x6a8f('0x152')]['belongsTo'](db[_0x6a8f('0xf6')],{'as':_0x6a8f('0x170'),'foreignKey':_0x6a8f('0x171'),'onDelete':_0x6a8f('0x114')});db[_0x6a8f('0x152')][_0x6a8f('0x155')](db[_0x6a8f('0x1d')],{'as':_0x6a8f('0x1a1'),'foreignKey':_0x6a8f('0x150'),'onDelete':_0x6a8f('0x114')});db[_0x6a8f('0x152')][_0x6a8f('0x155')](db['Campaign'],{'as':_0x6a8f('0xe7'),'foreignKey':_0x6a8f('0x1ad'),'onDelete':_0x6a8f('0x114')});db['Automation'][_0x6a8f('0x118')](db[_0x6a8f('0x1af')],{'as':{'plural':_0x6a8f('0x1b0'),'singular':_0x6a8f('0x1b1')},'foreignKey':'AutomationAllId','onDelete':_0x6a8f('0x114'),'hooks':!![]});db[_0x6a8f('0x79')][_0x6a8f('0x118')](db[_0x6a8f('0x1af')],{'as':{'plural':_0x6a8f('0x1b2'),'singular':_0x6a8f('0x1b3')},'foreignKey':_0x6a8f('0x1b4'),'onDelete':_0x6a8f('0x114'),'hooks':!![]});db[_0x6a8f('0x79')][_0x6a8f('0x118')](db[_0x6a8f('0x1b5')],{'as':_0x6a8f('0x1b6'),'foreignKey':_0x6a8f('0x1b7'),'onDelete':_0x6a8f('0x114'),'hooks':!![]});db['Disposition'][_0x6a8f('0x118')](db[_0x6a8f('0x7c')],{'as':_0x6a8f('0x16d'),'foreignKey':_0x6a8f('0x1b8'),'onDelete':_0x6a8f('0x114')});db[_0x6a8f('0x157')][_0x6a8f('0x118')](db[_0x6a8f('0x157')],{'as':_0x6a8f('0x1b9'),'foreignKey':_0x6a8f('0x158'),'onDelete':_0x6a8f('0x114'),'hooks':!![],'required':![]});db[_0x6a8f('0x157')][_0x6a8f('0x118')](db[_0x6a8f('0x1a')],{'as':'Extensions','foreignKey':_0x6a8f('0x158'),'onDelete':_0x6a8f('0x169')});db[_0x6a8f('0x157')][_0x6a8f('0x118')](db[_0x6a8f('0x183')],{'as':_0x6a8f('0x1ba'),'foreignKey':_0x6a8f('0x158')});db[_0x6a8f('0x157')][_0x6a8f('0x118')](db[_0x6a8f('0x62')],{'as':_0x6a8f('0x1bb'),'foreignKey':_0x6a8f('0x158')});db['Interval']['hasMany'](db['FaxApplication'],{'as':'FaxApplications','foreignKey':_0x6a8f('0x158')});db[_0x6a8f('0x157')]['hasMany'](db[_0x6a8f('0x4f')],{'as':'SmsApplications','foreignKey':_0x6a8f('0x158')});db['Schedule'][_0x6a8f('0x155')](db[_0x6a8f('0x165')],{});db[_0x6a8f('0x1bc')][_0x6a8f('0x155')](db[_0x6a8f('0x96')],{'foreignKey':'DefaultReportId'});db[_0x6a8f('0x1bc')][_0x6a8f('0x155')](db['AnalyticCustomReport'],{'foreignKey':_0x6a8f('0x1bd')});db[_0x6a8f('0x14d')][_0x6a8f('0x129')](db['VoiceMusicOnHold'],{'as':'Mohs','through':_0x6a8f('0x14e'),'onDelete':_0x6a8f('0x169')});db['Tag'][_0x6a8f('0x129')](db[_0x6a8f('0x17a')],{'through':'cm_contact_has_tags'});db[_0x6a8f('0x17d')][_0x6a8f('0x129')](db[_0x6a8f('0x64')],{'through':'chat_interaction_has_tags'});db[_0x6a8f('0x17d')][_0x6a8f('0x129')](db[_0x6a8f('0x3c')],{'through':_0x6a8f('0x17e')});db['Tag'][_0x6a8f('0x129')](db[_0x6a8f('0x51')],{'through':'sms_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0x6a8f('0x48')],{'through':'fax_interaction_has_tags'});db['Tag'][_0x6a8f('0x129')](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0x6a8f('0x17d')][_0x6a8f('0x129')](db[_0x6a8f('0x102')],{'through':_0x6a8f('0x1be')});db['CmContactHasItem'][_0x6a8f('0x155')](db['ContactItemType'],{'as':_0x6a8f('0x1bf'),'foreignKey':_0x6a8f('0x1c0')});db['CmHopperAdditionalPhone']['belongsTo'](db['CmHopper'],{'as':_0x6a8f('0x1c1'),'foreignKey':_0x6a8f('0x1ac')});db[_0x6a8f('0x89')][_0x6a8f('0x155')](db[_0x6a8f('0x17a')],{'as':_0x6a8f('0x17b'),'foreignKey':_0x6a8f('0x1a8')});db['Trigger'][_0x6a8f('0x118')](db['Condition'],{'as':{'plural':_0x6a8f('0x1c2'),'singular':_0x6a8f('0x1c3')},'foreignKey':_0x6a8f('0x1c4'),'onDelete':_0x6a8f('0x114'),'hooks':!![]});db[_0x6a8f('0x8e')][_0x6a8f('0x118')](db[_0x6a8f('0x1af')],{'as':{'plural':_0x6a8f('0x1c5'),'singular':_0x6a8f('0x1c6')},'foreignKey':_0x6a8f('0x1c7'),'onDelete':'cascade','hooks':!![]});db[_0x6a8f('0x8e')][_0x6a8f('0x118')](db[_0x6a8f('0x1b5')],{'as':_0x6a8f('0x1b6'),'foreignKey':_0x6a8f('0x1c8'),'onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0x6a8f('0x1c9')],{'as':_0x6a8f('0x1ca'),'onDelete':_0x6a8f('0x114'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x6a8f('0x96')][_0x6a8f('0x118')](db[_0x6a8f('0x1c9')],{'as':_0x6a8f('0x1ca'),'onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x1cb')});db[_0x6a8f('0x99')]['hasMany'](db[_0x6a8f('0x1c9')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x6a8f('0x1cc')});db[_0x6a8f('0x1c9')][_0x6a8f('0x155')](db[_0x6a8f('0x99')],{'foreignKey':_0x6a8f('0x1cc')});db[_0x6a8f('0x9c')][_0x6a8f('0x118')](db[_0x6a8f('0x9d')],{'as':'Configurations','onDelete':_0x6a8f('0x114'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x6a8f('0x118')](db[_0x6a8f('0x1cd')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0x6a8f('0x118')](db[_0x6a8f('0x1cd')],{'as':_0x6a8f('0x1ce'),'onDelete':'cascade','foreignKey':_0x6a8f('0x1cf')});db['SalesforceConfiguration'][_0x6a8f('0x118')](db[_0x6a8f('0x1cd')],{'as':_0x6a8f('0x1ca'),'onDelete':_0x6a8f('0x114'),'foreignKey':'FieldId'});db[_0x6a8f('0x9d')][_0x6a8f('0x155')](db[_0x6a8f('0x9c')],{'as':'Account','foreignKey':_0x6a8f('0x1d0')});db['SalesforceField'][_0x6a8f('0x118')](db[_0x6a8f('0x1cd')],{'as':_0x6a8f('0x1d1'),'foreignKey':'SubjectId'});db['SalesforceField'][_0x6a8f('0x118')](db['SalesforceField'],{'as':'Description','foreignKey':_0x6a8f('0x1cf')});db[_0x6a8f('0x1cd')][_0x6a8f('0x118')](db[_0x6a8f('0x1cd')],{'as':_0x6a8f('0x1d2'),'foreignKey':_0x6a8f('0x1d3')});db[_0x6a8f('0x1cd')][_0x6a8f('0x155')](db[_0x6a8f('0x1d4')],{'as':_0x6a8f('0x1d4'),'foreignKey':_0x6a8f('0x1d5')});db['SugarcrmAccount'][_0x6a8f('0x118')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0x6a8f('0x114'),'foreignKey':'AccountId'});db[_0x6a8f('0xa0')][_0x6a8f('0x118')](db['SugarcrmField'],{'as':_0x6a8f('0x1d6'),'onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x1d7')});db[_0x6a8f('0xa0')][_0x6a8f('0x118')](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x1cf')});db[_0x6a8f('0xa0')][_0x6a8f('0x118')](db['SugarcrmField'],{'as':_0x6a8f('0x1ca'),'onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x1d3')});db[_0x6a8f('0xa0')][_0x6a8f('0x155')](db['SugarcrmAccount'],{'as':_0x6a8f('0x179'),'foreignKey':_0x6a8f('0x1d0')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x6a8f('0x1d1'),'foreignKey':_0x6a8f('0x1d7')});db['SugarcrmField'][_0x6a8f('0x118')](db[_0x6a8f('0xa2')],{'as':_0x6a8f('0x1d8'),'foreignKey':_0x6a8f('0x1cf')});db[_0x6a8f('0xa2')][_0x6a8f('0x118')](db['SugarcrmField'],{'as':_0x6a8f('0x1d2'),'foreignKey':_0x6a8f('0x1d3')});db[_0x6a8f('0xa2')][_0x6a8f('0x155')](db[_0x6a8f('0x1d4')],{'as':_0x6a8f('0x1d4'),'foreignKey':_0x6a8f('0x1d5')});db[_0x6a8f('0xa3')][_0x6a8f('0x118')](db[_0x6a8f('0xa5')],{'as':_0x6a8f('0x1d9'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x6a8f('0xa5')][_0x6a8f('0x118')](db['DeskField'],{'as':_0x6a8f('0x1d6'),'onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x1d7')});db[_0x6a8f('0xa5')]['hasMany'](db[_0x6a8f('0xa7')],{'as':_0x6a8f('0x1ce'),'onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x1cf')});db[_0x6a8f('0xa5')][_0x6a8f('0x118')](db[_0x6a8f('0xa7')],{'as':_0x6a8f('0x1ca'),'onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x1d3')});db[_0x6a8f('0xa5')][_0x6a8f('0x155')](db[_0x6a8f('0xa3')],{'as':_0x6a8f('0x179'),'foreignKey':_0x6a8f('0x1d0')});db[_0x6a8f('0xa5')][_0x6a8f('0x129')](db[_0x6a8f('0x17d')],{'through':_0x6a8f('0x1da')});db[_0x6a8f('0xa7')][_0x6a8f('0x118')](db[_0x6a8f('0xa7')],{'as':_0x6a8f('0x1d1'),'foreignKey':_0x6a8f('0x1d7')});db['DeskField']['hasMany'](db[_0x6a8f('0xa7')],{'as':'Description','foreignKey':_0x6a8f('0x1cf')});db[_0x6a8f('0xa7')]['hasMany'](db['DeskField'],{'as':'Field','foreignKey':'FieldId'});db['DeskField'][_0x6a8f('0x155')](db['Variable'],{'as':_0x6a8f('0x1d4'),'foreignKey':_0x6a8f('0x1d5')});db['ZohoAccount'][_0x6a8f('0x118')](db[_0x6a8f('0x1db')],{'as':_0x6a8f('0x1d9'),'onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x1d0')});db[_0x6a8f('0x1db')]['hasMany'](db[_0x6a8f('0xaa')],{'as':'Subjects','onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x1d7')});db[_0x6a8f('0x1db')][_0x6a8f('0x118')](db[_0x6a8f('0xaa')],{'as':_0x6a8f('0x1ce'),'onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x1cf')});db[_0x6a8f('0x1db')]['hasMany'](db['ZohoField'],{'as':_0x6a8f('0x1ca'),'onDelete':'cascade','foreignKey':_0x6a8f('0x1d3')});db[_0x6a8f('0x1db')][_0x6a8f('0x155')](db[_0x6a8f('0xa9')],{'as':_0x6a8f('0x179'),'foreignKey':_0x6a8f('0x1d0')});db[_0x6a8f('0xaa')]['hasMany'](db[_0x6a8f('0xaa')],{'as':_0x6a8f('0x1d1'),'foreignKey':'SubjectId'});db[_0x6a8f('0xaa')][_0x6a8f('0x118')](db[_0x6a8f('0xaa')],{'as':_0x6a8f('0x1d8'),'foreignKey':_0x6a8f('0x1cf')});db['ZohoField']['hasMany'](db[_0x6a8f('0xaa')],{'as':_0x6a8f('0x1d2'),'foreignKey':'FieldId'});db['ZohoField'][_0x6a8f('0x155')](db[_0x6a8f('0x1d4')],{'as':_0x6a8f('0x1d4'),'foreignKey':_0x6a8f('0x1d5')});db[_0x6a8f('0xac')][_0x6a8f('0x118')](db[_0x6a8f('0x1dc')],{'as':_0x6a8f('0x1d9'),'onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x1d0')});db[_0x6a8f('0x1dc')][_0x6a8f('0x118')](db['ZendeskField'],{'as':_0x6a8f('0x1d6'),'foreignKey':_0x6a8f('0x1d7')});db[_0x6a8f('0x1dc')]['hasMany'](db[_0x6a8f('0xaf')],{'as':_0x6a8f('0x1ce'),'foreignKey':_0x6a8f('0x1cf')});db[_0x6a8f('0x1dc')][_0x6a8f('0x118')](db['ZendeskField'],{'as':_0x6a8f('0x1ca'),'foreignKey':_0x6a8f('0x1d3')});db[_0x6a8f('0x1dc')][_0x6a8f('0x155')](db[_0x6a8f('0xac')],{'as':'Account','foreignKey':_0x6a8f('0x1d0')});db[_0x6a8f('0x1dc')][_0x6a8f('0x129')](db[_0x6a8f('0x17d')],{'through':_0x6a8f('0x1dd')});db[_0x6a8f('0xaf')]['hasMany'](db[_0x6a8f('0xaf')],{'as':_0x6a8f('0x1d1'),'foreignKey':_0x6a8f('0x1d7')});db[_0x6a8f('0xaf')][_0x6a8f('0x118')](db[_0x6a8f('0xaf')],{'as':'Description','foreignKey':_0x6a8f('0x1cf')});db[_0x6a8f('0xaf')][_0x6a8f('0x118')](db[_0x6a8f('0xaf')],{'as':_0x6a8f('0x1d2'),'foreignKey':_0x6a8f('0x1d3')});db['ZendeskField'][_0x6a8f('0x155')](db[_0x6a8f('0x1d4')],{'as':_0x6a8f('0x1d4'),'foreignKey':_0x6a8f('0x1d5')});db[_0x6a8f('0xb1')][_0x6a8f('0x118')](db[_0x6a8f('0xb3')],{'as':_0x6a8f('0x1d9'),'onDelete':'cascade','foreignKey':_0x6a8f('0x1d0')});db[_0x6a8f('0xb3')][_0x6a8f('0x118')](db[_0x6a8f('0xb5')],{'as':'Subjects','onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x1d7')});db[_0x6a8f('0xb3')]['hasMany'](db[_0x6a8f('0xb5')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x6a8f('0x1cf')});db[_0x6a8f('0xb3')]['hasMany'](db[_0x6a8f('0xb5')],{'as':_0x6a8f('0x1ca'),'onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x1d3')});db['FreshdeskConfiguration'][_0x6a8f('0x155')](db['FreshdeskAccount'],{'as':_0x6a8f('0x179'),'foreignKey':'AccountId'});db[_0x6a8f('0xb3')][_0x6a8f('0x129')](db['Tag'],{'through':_0x6a8f('0x1de')});db[_0x6a8f('0xb5')][_0x6a8f('0x118')](db['FreshdeskField'],{'as':_0x6a8f('0x1d1'),'foreignKey':_0x6a8f('0x1d7')});db[_0x6a8f('0xb5')]['hasMany'](db[_0x6a8f('0xb5')],{'as':_0x6a8f('0x1d8'),'foreignKey':_0x6a8f('0x1cf')});db[_0x6a8f('0xb5')]['hasMany'](db['FreshdeskField'],{'as':_0x6a8f('0x1d2'),'foreignKey':_0x6a8f('0x1d3')});db[_0x6a8f('0xb5')]['belongsTo'](db[_0x6a8f('0x1d4')],{'as':_0x6a8f('0x1d4'),'foreignKey':_0x6a8f('0x1d5')});db[_0x6a8f('0x1df')]['hasMany'](db[_0x6a8f('0x1e0')],{'as':'Configurations','onDelete':_0x6a8f('0x114'),'foreignKey':'AccountId'});db[_0x6a8f('0x1e0')][_0x6a8f('0x118')](db[_0x6a8f('0xb9')],{'as':_0x6a8f('0x1d6'),'foreignKey':'SubjectId'});db[_0x6a8f('0x1e0')][_0x6a8f('0x118')](db['VtigerField'],{'as':_0x6a8f('0x1ce'),'foreignKey':_0x6a8f('0x1cf')});db[_0x6a8f('0x1e0')][_0x6a8f('0x118')](db[_0x6a8f('0xb9')],{'as':_0x6a8f('0x1ca'),'foreignKey':_0x6a8f('0x1d3')});db['VtigerConfiguration'][_0x6a8f('0x155')](db['VtigerAccount'],{'as':_0x6a8f('0x179'),'foreignKey':_0x6a8f('0x1d0')});db[_0x6a8f('0xb9')]['hasMany'](db[_0x6a8f('0xb9')],{'as':_0x6a8f('0x1d1'),'foreignKey':'SubjectId'});db[_0x6a8f('0xb9')][_0x6a8f('0x118')](db['VtigerField'],{'as':_0x6a8f('0x1d8'),'foreignKey':_0x6a8f('0x1cf')});db[_0x6a8f('0xb9')][_0x6a8f('0x118')](db[_0x6a8f('0xb9')],{'as':'Field','foreignKey':_0x6a8f('0x1d3')});db['VtigerField'][_0x6a8f('0x155')](db[_0x6a8f('0x1d4')],{'as':_0x6a8f('0x1d4'),'foreignKey':_0x6a8f('0x1d5')});db[_0x6a8f('0xbb')][_0x6a8f('0x118')](db['ServicenowConfiguration'],{'as':_0x6a8f('0x1d9'),'onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x1d0')});db['ServicenowConfiguration'][_0x6a8f('0x118')](db[_0x6a8f('0xbf')],{'as':'Subjects','foreignKey':_0x6a8f('0x1d7')});db[_0x6a8f('0xbd')][_0x6a8f('0x118')](db[_0x6a8f('0xbf')],{'as':_0x6a8f('0x1ce'),'foreignKey':'DescriptionId'});db['ServicenowConfiguration'][_0x6a8f('0x118')](db['ServicenowField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x6a8f('0xbd')][_0x6a8f('0x155')](db[_0x6a8f('0xbb')],{'as':_0x6a8f('0x179'),'foreignKey':'AccountId'});db[_0x6a8f('0xbf')][_0x6a8f('0x118')](db[_0x6a8f('0xbf')],{'as':_0x6a8f('0x1d1'),'foreignKey':_0x6a8f('0x1d7')});db[_0x6a8f('0xbf')][_0x6a8f('0x118')](db[_0x6a8f('0xbf')],{'as':_0x6a8f('0x1d8'),'foreignKey':'DescriptionId'});db[_0x6a8f('0xbf')][_0x6a8f('0x118')](db['ServicenowField'],{'as':_0x6a8f('0x1d2'),'foreignKey':_0x6a8f('0x1d3')});db[_0x6a8f('0xbf')]['belongsTo'](db[_0x6a8f('0x1d4')],{'as':'Variable','foreignKey':_0x6a8f('0x1d5')});db['Dynamics365Account']['hasMany'](db[_0x6a8f('0xc3')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x6a8f('0x1d0')});db[_0x6a8f('0xc1')][_0x6a8f('0x155')](db[_0x6a8f('0x167')],{'as':_0x6a8f('0x167'),'foreignKey':_0x6a8f('0x168')});db[_0x6a8f('0xc3')][_0x6a8f('0x118')](db[_0x6a8f('0xc5')],{'as':'Subjects','onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x1d7')});db['Dynamics365Configuration'][_0x6a8f('0x118')](db[_0x6a8f('0xc5')],{'as':_0x6a8f('0x1ce'),'onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x1cf')});db['Dynamics365Configuration']['hasMany'](db[_0x6a8f('0xc5')],{'as':'Fields','onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x1d3')});db[_0x6a8f('0xc3')]['belongsTo'](db[_0x6a8f('0xc1')],{'as':_0x6a8f('0x179'),'foreignKey':_0x6a8f('0x1d0')});db[_0x6a8f('0xc5')][_0x6a8f('0x118')](db[_0x6a8f('0xc5')],{'as':_0x6a8f('0x1d1'),'foreignKey':_0x6a8f('0x1d7')});db[_0x6a8f('0xc5')][_0x6a8f('0x118')](db[_0x6a8f('0xc5')],{'as':_0x6a8f('0x1d8'),'foreignKey':_0x6a8f('0x1cf')});db[_0x6a8f('0xc5')]['hasMany'](db[_0x6a8f('0xc5')],{'as':_0x6a8f('0x1d2'),'foreignKey':_0x6a8f('0x1d3')});db['Dynamics365Field'][_0x6a8f('0x155')](db['Variable'],{'as':_0x6a8f('0x1d4'),'foreignKey':'VariableId'});db['FreshsalesAccount']['hasMany'](db[_0x6a8f('0xc9')],{'as':'Configurations','onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x1d0')});db[_0x6a8f('0xc9')][_0x6a8f('0x118')](db[_0x6a8f('0xcb')],{'as':_0x6a8f('0x1d6'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0x6a8f('0x118')](db['FreshsalesField'],{'as':_0x6a8f('0x1ce'),'foreignKey':'DescriptionId'});db[_0x6a8f('0xc9')][_0x6a8f('0x118')](db[_0x6a8f('0xcb')],{'as':_0x6a8f('0x1ca'),'foreignKey':_0x6a8f('0x1d3')});db[_0x6a8f('0xc9')][_0x6a8f('0x155')](db[_0x6a8f('0xc7')],{'as':_0x6a8f('0x179'),'foreignKey':_0x6a8f('0x1d0')});db[_0x6a8f('0xcb')]['hasMany'](db['FreshsalesField'],{'as':_0x6a8f('0x1d1'),'foreignKey':'SubjectId'});db['FreshsalesField']['hasMany'](db[_0x6a8f('0xcb')],{'as':'Description','foreignKey':'DescriptionId'});db['FreshsalesField']['hasMany'](db[_0x6a8f('0xcb')],{'as':_0x6a8f('0x1d2'),'foreignKey':_0x6a8f('0x1d3')});db[_0x6a8f('0xcb')][_0x6a8f('0x155')](db[_0x6a8f('0x1d4')],{'as':'Variable','foreignKey':_0x6a8f('0x1d5')});db['ChatQueueReport'][_0x6a8f('0x155')](db[_0x6a8f('0x5f')],{});db[_0x6a8f('0xd0')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x6a8f('0x171')});db[_0x6a8f('0xd0')]['belongsTo'](db['CmContact'],{'as':_0x6a8f('0x17b'),'foreignKey':'ContactId'});db[_0x6a8f('0xd0')][_0x6a8f('0x155')](db[_0x6a8f('0x64')],{});db[_0x6a8f('0xd0')][_0x6a8f('0x155')](db['ChatMessage'],{});db[_0x6a8f('0xd0')][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{});db[_0x6a8f('0xd0')][_0x6a8f('0x155')](db[_0x6a8f('0x13a')],{});db[_0x6a8f('0xd2')][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{'onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x1e1')});db[_0x6a8f('0xd2')]['belongsTo'](db[_0x6a8f('0x13')],{'onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x1e2')});db[_0x6a8f('0xd7')]['hasMany'](db[_0x6a8f('0xd5')],{'foreignKey':_0x6a8f('0x1e3'),'onDelete':_0x6a8f('0x114')});db[_0x6a8f('0xd7')][_0x6a8f('0x118')](db[_0x6a8f('0xd4')],{'foreignKey':_0x6a8f('0x1e3'),'onDelete':'cascade'});db['SmsQueueReport'][_0x6a8f('0x155')](db[_0x6a8f('0x146')],{});db['SmsQueueReport'][_0x6a8f('0x155')](db[_0x6a8f('0xf6')],{'as':_0x6a8f('0x170'),'foreignKey':_0x6a8f('0x171')});db[_0x6a8f('0x1e4')][_0x6a8f('0x155')](db['CmContact'],{'as':_0x6a8f('0x17b'),'foreignKey':_0x6a8f('0x185')});db[_0x6a8f('0x1e4')]['belongsTo'](db[_0x6a8f('0x51')],{});db[_0x6a8f('0x1e4')][_0x6a8f('0x155')](db[_0x6a8f('0x196')],{});db[_0x6a8f('0x1e4')][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{});db['SmsQueueReport'][_0x6a8f('0x155')](db['SmsQueue'],{});db[_0x6a8f('0xdc')][_0x6a8f('0x118')](db[_0x6a8f('0xd7')],{'foreignKey':_0x6a8f('0x1e5')});db[_0x6a8f('0xdc')]['hasMany'](db[_0x6a8f('0xd5')],{'foreignKey':'ProjectId'});db['JscriptyProject']['hasMany'](db[_0x6a8f('0xd4')],{'foreignKey':_0x6a8f('0x1e5')});db[_0x6a8f('0x12c')]['belongsToMany'](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x176'),'through':'user_has_teams'});db['Team'][_0x6a8f('0x129')](db[_0x6a8f('0x1d')],{'through':_0x6a8f('0x15a'),'as':'VoiceQueues'});db[_0x6a8f('0x12c')][_0x6a8f('0x129')](db[_0x6a8f('0x3a')],{'through':_0x6a8f('0x177'),'as':_0x6a8f('0x139')});db[_0x6a8f('0x12c')][_0x6a8f('0x129')](db[_0x6a8f('0x13a')],{'through':'team_has_chat_queues','as':_0x6a8f('0x1e6')});db[_0x6a8f('0x12c')]['belongsToMany'](db['FaxQueue'],{'through':_0x6a8f('0x18f'),'as':_0x6a8f('0x13b')});db[_0x6a8f('0x12c')][_0x6a8f('0x129')](db[_0x6a8f('0x53')],{'through':_0x6a8f('0x198'),'as':'SmsQueues'});db[_0x6a8f('0x12c')]['belongsToMany'](db[_0x6a8f('0x5d')],{'through':_0x6a8f('0x19d'),'as':_0x6a8f('0x13e')});db[_0x6a8f('0x12c')][_0x6a8f('0x129')](db['WhatsappQueue'],{'through':_0x6a8f('0x1e7'),'as':'WhatsappQueues'});db[_0x6a8f('0x12c')][_0x6a8f('0x129')](db[_0x6a8f('0x136')],{'through':_0x6a8f('0x10e'),'as':_0x6a8f('0x137')});db['Campaign'][_0x6a8f('0x118')](db[_0x6a8f('0x70')],{'as':_0x6a8f('0x122'),'foreignKey':_0x6a8f('0x1ad')});db[_0x6a8f('0xe7')]['hasMany'](db[_0x6a8f('0x72')],{'as':_0x6a8f('0x11a'),'foreignKey':'CampaignId'});db['Campaign'][_0x6a8f('0x118')](db[_0x6a8f('0x74')],{'as':_0x6a8f('0x151'),'foreignKey':_0x6a8f('0x1ad')});db['Campaign'][_0x6a8f('0x118')](db[_0x6a8f('0x152')],{'as':_0x6a8f('0x153'),'foreignKey':'CampaignId'});db['Campaign'][_0x6a8f('0x155')](db['Trunk'],{'as':_0x6a8f('0x28'),'foreignKey':_0x6a8f('0x1e8')});db['Campaign']['belongsTo'](db[_0x6a8f('0x28')],{'as':_0x6a8f('0x1e9'),'foreignKey':_0x6a8f('0x156')});db['Campaign'][_0x6a8f('0x155')](db[_0x6a8f('0x157')],{'as':_0x6a8f('0x157'),'foreignKey':_0x6a8f('0x158')});db['Campaign'][_0x6a8f('0x155')](db[_0x6a8f('0xe1')],{'as':'SquareProject','foreignKey':_0x6a8f('0x1ea')});db[_0x6a8f('0xe7')][_0x6a8f('0x129')](db[_0x6a8f('0xf6')],{'as':_0x6a8f('0x12a'),'through':_0x6a8f('0x1eb')});db[_0x6a8f('0xe7')][_0x6a8f('0x129')](db[_0x6a8f('0xf6')],{'as':_0x6a8f('0x15b'),'through':_0x6a8f('0x1ec')});db[_0x6a8f('0xeb')][_0x6a8f('0x155')](db[_0x6a8f('0x68')],{'as':_0x6a8f('0x68'),'foreignKey':_0x6a8f('0x182')});db[_0x6a8f('0x1ed')]['belongsTo'](db[_0x6a8f('0x16f')],{});db[_0x6a8f('0x1ed')]['belongsTo'](db[_0x6a8f('0x3c')],{});db['MailTransferReport']['belongsTo'](db[_0x6a8f('0x165')],{'foreignKey':_0x6a8f('0x1ee'),'as':'FromAccount'});db[_0x6a8f('0x1ed')]['belongsTo'](db[_0x6a8f('0x13')],{'foreignKey':_0x6a8f('0x1ef'),'as':_0x6a8f('0x1f0')});db[_0x6a8f('0x1ed')][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{'foreignKey':_0x6a8f('0x1f1'),'as':_0x6a8f('0x1f2')});db[_0x6a8f('0x1ed')][_0x6a8f('0x155')](db[_0x6a8f('0x3a')],{'foreignKey':'ToMailQueueId','as':_0x6a8f('0x1f3')});db[_0x6a8f('0x1ed')][_0x6a8f('0x155')](db[_0x6a8f('0x165')],{'foreignKey':_0x6a8f('0x1f4'),'as':_0x6a8f('0x1f5')});db[_0x6a8f('0xf0')][_0x6a8f('0x155')](db[_0x6a8f('0x66')],{});db['ChatTransferReport'][_0x6a8f('0x155')](db['ChatInteraction'],{});db['ChatTransferReport'][_0x6a8f('0x155')](db[_0x6a8f('0x5f')],{'foreignKey':_0x6a8f('0x1f6'),'as':_0x6a8f('0x1f7')});db[_0x6a8f('0xf0')][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{'foreignKey':_0x6a8f('0x1ef'),'as':_0x6a8f('0x1f0')});db[_0x6a8f('0xf0')][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{'foreignKey':'ToUserId','as':_0x6a8f('0x1f2')});db[_0x6a8f('0xf0')][_0x6a8f('0x155')](db[_0x6a8f('0x13a')],{'foreignKey':_0x6a8f('0x1f8'),'as':_0x6a8f('0x1f3')});db['ChatTransferReport'][_0x6a8f('0x155')](db[_0x6a8f('0x5f')],{'foreignKey':_0x6a8f('0x1f9'),'as':_0x6a8f('0x1f5')});db['FaxTransferReport']['belongsTo'](db[_0x6a8f('0x4a')],{});db[_0x6a8f('0xf2')][_0x6a8f('0x155')](db[_0x6a8f('0x48')],{});db['FaxTransferReport'][_0x6a8f('0x155')](db[_0x6a8f('0x44')],{'foreignKey':_0x6a8f('0x1fa'),'as':_0x6a8f('0x1f7')});db['FaxTransferReport']['belongsTo'](db[_0x6a8f('0x13')],{'foreignKey':_0x6a8f('0x1ef'),'as':_0x6a8f('0x1f0')});db[_0x6a8f('0xf2')][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{'foreignKey':'ToUserId','as':_0x6a8f('0x1f2')});db[_0x6a8f('0xf2')][_0x6a8f('0x155')](db[_0x6a8f('0x4c')],{'foreignKey':_0x6a8f('0x1fb'),'as':_0x6a8f('0x1f3')});db[_0x6a8f('0xf2')][_0x6a8f('0x155')](db[_0x6a8f('0x44')],{'foreignKey':_0x6a8f('0x1fc'),'as':_0x6a8f('0x1f5')});db[_0x6a8f('0x1fd')]['belongsTo'](db[_0x6a8f('0x5b')],{});db[_0x6a8f('0x1fd')][_0x6a8f('0x155')](db[_0x6a8f('0x59')],{});db[_0x6a8f('0x1fd')][_0x6a8f('0x155')](db['OpenchannelAccount'],{'foreignKey':_0x6a8f('0x1fe'),'as':_0x6a8f('0x1f7')});db[_0x6a8f('0x1fd')][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{'foreignKey':_0x6a8f('0x1ef'),'as':'FromAgent'});db['OpenchannelTransferReport'][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{'foreignKey':_0x6a8f('0x1f1'),'as':_0x6a8f('0x1f2')});db[_0x6a8f('0x1fd')]['belongsTo'](db[_0x6a8f('0x5d')],{'foreignKey':'ToOpenchannelQueueId','as':_0x6a8f('0x1f3')});db[_0x6a8f('0x1fd')][_0x6a8f('0x155')](db[_0x6a8f('0x55')],{'foreignKey':_0x6a8f('0x1ff'),'as':_0x6a8f('0x1f5')});db[_0x6a8f('0xf4')][_0x6a8f('0x155')](db['SmsMessage'],{});db[_0x6a8f('0xf4')][_0x6a8f('0x155')](db[_0x6a8f('0x51')],{});db['SmsTransferReport'][_0x6a8f('0x155')](db[_0x6a8f('0x146')],{'foreignKey':_0x6a8f('0x200'),'as':_0x6a8f('0x1f7')});db[_0x6a8f('0xf4')][_0x6a8f('0x155')](db['User'],{'foreignKey':_0x6a8f('0x1ef'),'as':_0x6a8f('0x1f0')});db[_0x6a8f('0xf4')]['belongsTo'](db[_0x6a8f('0x13')],{'foreignKey':'ToUserId','as':_0x6a8f('0x1f2')});db[_0x6a8f('0xf4')][_0x6a8f('0x155')](db[_0x6a8f('0x53')],{'foreignKey':_0x6a8f('0x201'),'as':_0x6a8f('0x1f3')});db[_0x6a8f('0xf4')][_0x6a8f('0x155')](db['SmsAccount'],{'foreignKey':_0x6a8f('0x202'),'as':_0x6a8f('0x1f5')});db[_0x6a8f('0xf6')][_0x6a8f('0x118')](db[_0x6a8f('0x7c')],{'as':'Dispositions','foreignKey':'ListId','onDelete':'cascade'});db['CmList'][_0x6a8f('0x118')](db['CmCustomField'],{'as':_0x6a8f('0x203'),'foreignKey':'ListId'});db[_0x6a8f('0xf6')][_0x6a8f('0x118')](db[_0x6a8f('0x17a')],{'as':_0x6a8f('0x127'),'onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x171')});db[_0x6a8f('0xf6')][_0x6a8f('0x118')](db[_0x6a8f('0x72')],{'as':'HopperFinals','foreignKey':'ListId'});db['CmList'][_0x6a8f('0x118')](db[_0x6a8f('0x74')],{'as':_0x6a8f('0x11b'),'foreignKey':_0x6a8f('0x171')});db[_0x6a8f('0xf6')]['hasMany'](db[_0x6a8f('0x11c')],{'as':_0x6a8f('0x11c'),'foreignKey':_0x6a8f('0x171')});db[_0x6a8f('0xf6')][_0x6a8f('0x129')](db[_0x6a8f('0x1d')],{'as':'Queues','through':_0x6a8f('0x204')});db[_0x6a8f('0xf6')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x6a8f('0x12b')});db[_0x6a8f('0x136')]['hasMany'](db[_0x6a8f('0x1a')],{'as':_0x6a8f('0x205'),'onDelete':_0x6a8f('0x114')});db[_0x6a8f('0x136')]['belongsToMany'](db['User'],{'as':_0x6a8f('0x176'),'through':_0x6a8f('0x138')});db[_0x6a8f('0x136')][_0x6a8f('0x129')](db[_0x6a8f('0x12c')],{'through':_0x6a8f('0x10e'),'as':_0x6a8f('0x159')});db[_0x6a8f('0xf9')][_0x6a8f('0x118')](db[_0x6a8f('0x13')],{'as':'Users','foreignKey':_0x6a8f('0x124')});db['UserProfile'][_0x6a8f('0x118')](db[_0x6a8f('0xfa')],{'as':_0x6a8f('0x206'),'foreignKey':'userProfileId','onDelete':_0x6a8f('0x114')});db[_0x6a8f('0xfa')]['hasMany'](db[_0x6a8f('0x207')],{'as':_0x6a8f('0x208'),'foreignKey':_0x6a8f('0x209'),'onDelete':_0x6a8f('0x114')});db[_0x6a8f('0xfe')][_0x6a8f('0x118')](db[_0x6a8f('0x7c')],{'as':'Dispositions','foreignKey':_0x6a8f('0x20a'),'onDelete':_0x6a8f('0x114')});db[_0x6a8f('0xfe')][_0x6a8f('0x118')](db[_0x6a8f('0x16e')],{'as':_0x6a8f('0x186'),'foreignKey':_0x6a8f('0x20a')});db['WhatsappAccount'][_0x6a8f('0x118')](db[_0x6a8f('0x104')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x6a8f('0x118')](db[_0x6a8f('0x102')],{'as':_0x6a8f('0x188')});db[_0x6a8f('0xfe')]['hasMany'](db[_0x6a8f('0x100')],{'as':_0x6a8f('0x14b'),'foreignKey':_0x6a8f('0x20a'),'onDelete':_0x6a8f('0x114')});db[_0x6a8f('0xfe')]['belongsTo'](db[_0x6a8f('0xf6')],{'as':'List','foreignKey':_0x6a8f('0x171')});db[_0x6a8f('0xfe')][_0x6a8f('0x155')](db['Pause'],{'as':_0x6a8f('0x174'),'foreignKey':_0x6a8f('0x175')});db[_0x6a8f('0xfe')][_0x6a8f('0x129')](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x176'),'through':_0x6a8f('0x148')});db[_0x6a8f('0x100')][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{'onDelete':_0x6a8f('0x169')});db['WhatsappApplication'][_0x6a8f('0x155')](db[_0x6a8f('0x10a')],{'onDelete':_0x6a8f('0x169')});db[_0x6a8f('0x100')]['belongsTo'](db['WhatsappAccount'],{'onDelete':_0x6a8f('0x169')});db[_0x6a8f('0x100')][_0x6a8f('0x155')](db[_0x6a8f('0x157')],{'onDelete':_0x6a8f('0x169'),'foreignKey':_0x6a8f('0x158')});db[_0x6a8f('0x100')][_0x6a8f('0x155')](db[_0x6a8f('0x17d')],{'onDelete':_0x6a8f('0x169'),'foreignKey':_0x6a8f('0x184')});db['WhatsappInteraction']['hasMany'](db[_0x6a8f('0x104')],{'as':_0x6a8f('0x15e'),'onDelete':_0x6a8f('0x114'),'foreignKey':_0x6a8f('0x20b')});db['WhatsappInteraction'][_0x6a8f('0x155')](db['WhatsappAccount'],{'as':_0x6a8f('0x179'),'foreignKey':_0x6a8f('0x20a')});db[_0x6a8f('0x102')][_0x6a8f('0x155')](db['CmContact'],{'as':_0x6a8f('0x17b'),'foreignKey':'ContactId'});db[_0x6a8f('0x102')][_0x6a8f('0x155')](db['User'],{'as':_0x6a8f('0x17c'),'foreignKey':_0x6a8f('0x115')});db['WhatsappInteraction'][_0x6a8f('0x129')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db[_0x6a8f('0x102')]['belongsToMany'](db[_0x6a8f('0x17d')],{'through':'whatsapp_interaction_has_tags','as':_0x6a8f('0x17f')});db[_0x6a8f('0x102')][_0x6a8f('0x129')](db[_0x6a8f('0x13')],{'as':'Users','through':_0x6a8f('0x133'),'foreignKey':_0x6a8f('0x20b')});db[_0x6a8f('0x104')]['belongsTo'](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x13')});db[_0x6a8f('0x104')][_0x6a8f('0x155')](db[_0x6a8f('0x17a')],{'onDelete':_0x6a8f('0x114'),'as':_0x6a8f('0x17b')});db[_0x6a8f('0x104')][_0x6a8f('0x155')](db[_0x6a8f('0x102')],{'onDelete':_0x6a8f('0x114'),'as':_0x6a8f('0x180'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0x6a8f('0x155')](db[_0x6a8f('0xfe')],{'as':_0x6a8f('0x179'),'foreignKey':_0x6a8f('0x20a')});db[_0x6a8f('0x106')][_0x6a8f('0x155')](db[_0x6a8f('0xfe')],{});db['WhatsappQueueReport'][_0x6a8f('0x155')](db[_0x6a8f('0xf6')],{'as':'List','foreignKey':_0x6a8f('0x171')});db['WhatsappQueueReport'][_0x6a8f('0x155')](db[_0x6a8f('0x17a')],{'as':_0x6a8f('0x17b'),'foreignKey':'ContactId'});db[_0x6a8f('0x106')][_0x6a8f('0x155')](db['WhatsappInteraction'],{});db[_0x6a8f('0x106')][_0x6a8f('0x155')](db[_0x6a8f('0x10a')],{});db[_0x6a8f('0x106')][_0x6a8f('0x155')](db[_0x6a8f('0x104')],{});db[_0x6a8f('0x106')][_0x6a8f('0x155')](db[_0x6a8f('0x13')],{});db[_0x6a8f('0x108')][_0x6a8f('0x155')](db[_0x6a8f('0x104')],{});db[_0x6a8f('0x108')][_0x6a8f('0x155')](db['WhatsappInteraction'],{});db[_0x6a8f('0x108')][_0x6a8f('0x155')](db['WhatsappAccount'],{'foreignKey':_0x6a8f('0x20c'),'as':_0x6a8f('0x1f7')});db[_0x6a8f('0x108')][_0x6a8f('0x155')](db['WhatsappAccount'],{'foreignKey':_0x6a8f('0x20d'),'as':_0x6a8f('0x1f5')});db[_0x6a8f('0x108')][_0x6a8f('0x155')](db[_0x6a8f('0x10a')],{'foreignKey':_0x6a8f('0x20e'),'as':_0x6a8f('0x1f3')});db[_0x6a8f('0x108')]['belongsTo'](db['User'],{'foreignKey':_0x6a8f('0x1ef'),'as':_0x6a8f('0x1f0')});db[_0x6a8f('0x108')][_0x6a8f('0x155')](db['User'],{'foreignKey':_0x6a8f('0x1f1'),'as':'ToAgent'});db[_0x6a8f('0x10a')][_0x6a8f('0x129')](db[_0x6a8f('0x13')],{'as':_0x6a8f('0x176'),'through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0x6a8f('0x10a')][_0x6a8f('0x129')](db[_0x6a8f('0x12c')],{'through':'team_has_whatsapp_queues','as':_0x6a8f('0x159')});db['UserSetting'][_0x6a8f('0x155')](db['User'],{'as':_0x6a8f('0x20f'),'foreignKey':_0x6a8f('0x115'),'onDelete':_0x6a8f('0x114'),'hooks':!![]});db[_0x6a8f('0x167')][_0x6a8f('0x112')](db['Dynamics365Account'],{'as':_0x6a8f('0xc1'),'onDelete':_0x6a8f('0x169')});db['CloudProvider'][_0x6a8f('0x112')](db[_0x6a8f('0x37')],{'as':_0x6a8f('0x16b'),'onDelete':_0x6a8f('0x169')});db[_0x6a8f('0x167')]['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x6a8f('0x169')});module[_0x6a8f('0x210')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index c2bd45e..4faec61 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77e6=['./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/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/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./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/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userNotifications','./api/userNotification','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','/api/version','./api/system','./api/pm2','/api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','appPath','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','./api/chatInteraction','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_history','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions'];(function(_0x3ff685,_0x304b9e){var _0x2046c9=function(_0x7a10e9){while(--_0x7a10e9){_0x3ff685['push'](_0x3ff685['shift']());}};_0x2046c9(++_0x304b9e);}(_0x77e6,0x1a6));var _0x677e=function(_0x1cc6d2,_0x59413b){_0x1cc6d2=_0x1cc6d2-0x0;var _0x5351e3=_0x77e6[_0x1cc6d2];return _0x5351e3;};'use strict';var path=require(_0x677e('0x0'));var express=require(_0x677e('0x1'));var errors=require(_0x677e('0x2'));var config=require(_0x677e('0x3'));var setupLoggers=require(_0x677e('0x4'))[_0x677e('0x5')];var clientSideLogs=require(_0x677e('0x6'));exports[_0x677e('0x7')]=function(_0x50231c){return setupLoggers(_0x50231c)[_0x677e('0x8')](function(){_0x50231c[_0x677e('0x9')]('/api/users',require(_0x677e('0xa')));_0x50231c['use'](_0x677e('0xb'),require('./api/voiceChanSpy'));_0x50231c['use'](_0x677e('0xc'),require(_0x677e('0xd')));_0x50231c[_0x677e('0x9')](_0x677e('0xe'),require('./api/voiceExtension'));_0x50231c[_0x677e('0x9')]('/api/voice/mohs',require(_0x677e('0xf')));_0x50231c[_0x677e('0x9')](_0x677e('0x10'),require(_0x677e('0x11')));_0x50231c[_0x677e('0x9')](_0x677e('0x12'),require(_0x677e('0x13')));_0x50231c[_0x677e('0x9')](_0x677e('0x14'),require(_0x677e('0x15')));_0x50231c[_0x677e('0x9')](_0x677e('0x16'),require(_0x677e('0x17')));_0x50231c[_0x677e('0x9')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x50231c['use'](_0x677e('0x18'),require(_0x677e('0x19')));_0x50231c[_0x677e('0x9')](_0x677e('0x1a'),require(_0x677e('0x1b')));_0x50231c[_0x677e('0x9')](_0x677e('0x1c'),require(_0x677e('0x1d')));_0x50231c[_0x677e('0x9')](_0x677e('0x1e'),require(_0x677e('0x1f')));_0x50231c[_0x677e('0x9')]('/api/members/reports',require(_0x677e('0x20')));_0x50231c[_0x677e('0x9')](_0x677e('0x21'),require(_0x677e('0x22')));_0x50231c[_0x677e('0x9')](_0x677e('0x23'),require('./api/voiceTransferReport'));_0x50231c[_0x677e('0x9')]('/api/mail/out_servers',require(_0x677e('0x24')));_0x50231c[_0x677e('0x9')](_0x677e('0x25'),require('./api/mailAccount'));_0x50231c[_0x677e('0x9')](_0x677e('0x26'),require(_0x677e('0x27')));_0x50231c[_0x677e('0x9')](_0x677e('0x28'),require(_0x677e('0x29')));_0x50231c[_0x677e('0x9')]('/api/mail/interactions',require('./api/mailInteraction'));_0x50231c['use'](_0x677e('0x2a'),require(_0x677e('0x2b')));_0x50231c[_0x677e('0x9')](_0x677e('0x2c'),require(_0x677e('0x2d')));_0x50231c[_0x677e('0x9')](_0x677e('0x2e'),require(_0x677e('0x2f')));_0x50231c[_0x677e('0x9')](_0x677e('0x30'),require('./api/dashboard'));_0x50231c['use'](_0x677e('0x31'),require(_0x677e('0x32')));_0x50231c['use'](_0x677e('0x33'),require(_0x677e('0x34')));_0x50231c[_0x677e('0x9')](_0x677e('0x35'),require(_0x677e('0x36')));_0x50231c[_0x677e('0x9')]('/api/fax/interactions',require(_0x677e('0x37')));_0x50231c[_0x677e('0x9')](_0x677e('0x38'),require(_0x677e('0x39')));_0x50231c[_0x677e('0x9')](_0x677e('0x3a'),require(_0x677e('0x3b')));_0x50231c[_0x677e('0x9')](_0x677e('0x3c'),require('./api/faxQueueReport'));_0x50231c[_0x677e('0x9')](_0x677e('0x3d'),require(_0x677e('0x3e')));_0x50231c[_0x677e('0x9')](_0x677e('0x3f'),require(_0x677e('0x40')));_0x50231c[_0x677e('0x9')](_0x677e('0x41'),require(_0x677e('0x42')));_0x50231c[_0x677e('0x9')]('/api/sms/messages',require(_0x677e('0x43')));_0x50231c[_0x677e('0x9')](_0x677e('0x44'),require(_0x677e('0x45')));_0x50231c[_0x677e('0x9')](_0x677e('0x46'),require('./api/openchannelAccount'));_0x50231c[_0x677e('0x9')](_0x677e('0x47'),require(_0x677e('0x48')));_0x50231c['use'](_0x677e('0x49'),require(_0x677e('0x4a')));_0x50231c[_0x677e('0x9')](_0x677e('0x4b'),require(_0x677e('0x4c')));_0x50231c['use'](_0x677e('0x4d'),require(_0x677e('0x4e')));_0x50231c[_0x677e('0x9')](_0x677e('0x4f'),require('./api/chatWebsite'));_0x50231c[_0x677e('0x9')](_0x677e('0x50'),require(_0x677e('0x51')));_0x50231c['use']('/api/chat/applications',require(_0x677e('0x52')));_0x50231c[_0x677e('0x9')]('/api/chat/interactions',require(_0x677e('0x53')));_0x50231c[_0x677e('0x9')]('/api/chat/messages',require('./api/chatMessage'));_0x50231c[_0x677e('0x9')](_0x677e('0x54'),require('./api/chatOfflineMessage'));_0x50231c['use'](_0x677e('0x55'),require(_0x677e('0x56')));_0x50231c[_0x677e('0x9')]('/api/chat/groups',require(_0x677e('0x57')));_0x50231c[_0x677e('0x9')](_0x677e('0x58'),require(_0x677e('0x59')));_0x50231c[_0x677e('0x9')]('/api/cm/companies',require('./api/cmCompany'));_0x50231c[_0x677e('0x9')](_0x677e('0x5a'),require(_0x677e('0x5b')));_0x50231c[_0x677e('0x9')](_0x677e('0x5c'),require(_0x677e('0x5d')));_0x50231c[_0x677e('0x9')](_0x677e('0x5e'),require(_0x677e('0x5f')));_0x50231c[_0x677e('0x9')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x50231c[_0x677e('0x9')](_0x677e('0x60'),require('./api/cmHopperHistory'));_0x50231c[_0x677e('0x9')]('/api/cm/custom_fields',require(_0x677e('0x61')));_0x50231c[_0x677e('0x9')](_0x677e('0x62'),require(_0x677e('0x63')));_0x50231c[_0x677e('0x9')](_0x677e('0x64'),require('./api/automation'));_0x50231c[_0x677e('0x9')](_0x677e('0x65'),require(_0x677e('0x66')));_0x50231c[_0x677e('0x9')](_0x677e('0x67'),require(_0x677e('0x68')));_0x50231c['use'](_0x677e('0x69'),require('./api/condition'));_0x50231c[_0x677e('0x9')](_0x677e('0x6a'),require(_0x677e('0x6b')));_0x50231c[_0x677e('0x9')](_0x677e('0x6c'),require(_0x677e('0x6d')));_0x50231c[_0x677e('0x9')](_0x677e('0x6e'),require(_0x677e('0x6f')));_0x50231c[_0x677e('0x9')]('/api/voiceQueuesLog',require(_0x677e('0x70')));_0x50231c['use']('/api/schedules',require(_0x677e('0x71')));_0x50231c[_0x677e('0x9')](_0x677e('0x72'),require(_0x677e('0x73')));_0x50231c[_0x677e('0x9')]('/api/tags',require(_0x677e('0x74')));_0x50231c[_0x677e('0x9')](_0x677e('0x75'),require(_0x677e('0x76')));_0x50231c[_0x677e('0x9')]('/api/cm_contact_has_items',require(_0x677e('0x77')));_0x50231c[_0x677e('0x9')](_0x677e('0x78'),require('./api/cmHopperAdditionalPhone'));_0x50231c[_0x677e('0x9')]('/api/templates',require(_0x677e('0x79')));_0x50231c['use']('/api/triggers',require(_0x677e('0x7a')));_0x50231c[_0x677e('0x9')](_0x677e('0x7b'),require(_0x677e('0x7c')));_0x50231c['use'](_0x677e('0x7d'),require(_0x677e('0x7e')));_0x50231c['use'](_0x677e('0x7f'),require(_0x677e('0x80')));_0x50231c[_0x677e('0x9')](_0x677e('0x81'),require(_0x677e('0x82')));_0x50231c['use'](_0x677e('0x83'),require('./api/analyticDefaultReport'));_0x50231c['use'](_0x677e('0x84'),require('./api/analyticExtractedReport'));_0x50231c[_0x677e('0x9')](_0x677e('0x85'),require(_0x677e('0x86')));_0x50231c[_0x677e('0x9')](_0x677e('0x87'),require(_0x677e('0x88')));_0x50231c[_0x677e('0x9')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x50231c['use'](_0x677e('0x89'),require(_0x677e('0x8a')));_0x50231c[_0x677e('0x9')](_0x677e('0x8b'),require(_0x677e('0x8c')));_0x50231c[_0x677e('0x9')]('/api/integrations/salesforce/fields',require(_0x677e('0x8d')));_0x50231c[_0x677e('0x9')]('/api/integrations/sugarcrm/accounts',require(_0x677e('0x8e')));_0x50231c['use'](_0x677e('0x8f'),require(_0x677e('0x90')));_0x50231c[_0x677e('0x9')](_0x677e('0x91'),require('./api/intSugarcrmField'));_0x50231c[_0x677e('0x9')]('/api/integrations/desk/accounts',require(_0x677e('0x92')));_0x50231c[_0x677e('0x9')](_0x677e('0x93'),require(_0x677e('0x94')));_0x50231c[_0x677e('0x9')]('/api/integrations/desk/fields',require(_0x677e('0x95')));_0x50231c[_0x677e('0x9')](_0x677e('0x96'),require('./api/intZohoAccount'));_0x50231c[_0x677e('0x9')](_0x677e('0x97'),require(_0x677e('0x98')));_0x50231c[_0x677e('0x9')](_0x677e('0x99'),require(_0x677e('0x9a')));_0x50231c['use'](_0x677e('0x9b'),require('./api/intZendeskAccount'));_0x50231c['use'](_0x677e('0x9c'),require('./api/intZendeskConfiguration'));_0x50231c['use'](_0x677e('0x9d'),require('./api/intZendeskField'));_0x50231c[_0x677e('0x9')](_0x677e('0x9e'),require('./api/intFreshdeskAccount'));_0x50231c[_0x677e('0x9')](_0x677e('0x9f'),require(_0x677e('0xa0')));_0x50231c[_0x677e('0x9')](_0x677e('0xa1'),require(_0x677e('0xa2')));_0x50231c['use'](_0x677e('0xa3'),require(_0x677e('0xa4')));_0x50231c[_0x677e('0x9')]('/api/integrations/vtiger/configurations',require(_0x677e('0xa5')));_0x50231c[_0x677e('0x9')](_0x677e('0xa6'),require(_0x677e('0xa7')));_0x50231c[_0x677e('0x9')](_0x677e('0xa8'),require(_0x677e('0xa9')));_0x50231c[_0x677e('0x9')]('/api/integrations/servicenow/configurations',require(_0x677e('0xaa')));_0x50231c[_0x677e('0x9')](_0x677e('0xab'),require(_0x677e('0xac')));_0x50231c[_0x677e('0x9')]('/api/integrations/dynamics365/accounts',require(_0x677e('0xad')));_0x50231c[_0x677e('0x9')](_0x677e('0xae'),require(_0x677e('0xaf')));_0x50231c['use'](_0x677e('0xb0'),require(_0x677e('0xb1')));_0x50231c[_0x677e('0x9')](_0x677e('0xb2'),require(_0x677e('0xb3')));_0x50231c[_0x677e('0x9')](_0x677e('0xb4'),require(_0x677e('0xb5')));_0x50231c[_0x677e('0x9')](_0x677e('0xb6'),require(_0x677e('0xb7')));_0x50231c['use']('/api/networks',require(_0x677e('0xb8')));_0x50231c[_0x677e('0x9')](_0x677e('0xb9'),require(_0x677e('0xba')));_0x50231c[_0x677e('0x9')](_0x677e('0xbb'),require('./api/chatInternalMessage'));_0x50231c[_0x677e('0x9')](_0x677e('0xbc'),require(_0x677e('0xbd')));_0x50231c[_0x677e('0x9')](_0x677e('0xbe'),require(_0x677e('0xbf')));_0x50231c['use'](_0x677e('0xc0'),require('./api/jscriptySessionReport'));_0x50231c['use'](_0x677e('0xc1'),require('./api/smsQueueReport'));_0x50231c[_0x677e('0x9')]('/api/square/reports',require('./api/squareReport'));_0x50231c[_0x677e('0x9')]('/api/square/details/reports',require(_0x677e('0xc2')));_0x50231c[_0x677e('0x9')]('/api/jscripty/projects',require(_0x677e('0xc3')));_0x50231c[_0x677e('0x9')](_0x677e('0xc4'),require(_0x677e('0xc5')));_0x50231c[_0x677e('0x9')](_0x677e('0xc6'),require('./api/squareOdbc'));_0x50231c[_0x677e('0x9')]('/api/square/projects',require(_0x677e('0xc7')));_0x50231c['use'](_0x677e('0xc8'),require(_0x677e('0xc9')));_0x50231c[_0x677e('0x9')]('/api/square/messages',require('./api/squareMessage'));_0x50231c['use']('/api/teams',require(_0x677e('0xca')));_0x50231c[_0x677e('0x9')](_0x677e('0xcb'),require(_0x677e('0xcc')));_0x50231c[_0x677e('0x9')](_0x677e('0xcd'),require(_0x677e('0xce')));_0x50231c[_0x677e('0x9')](_0x677e('0xcf'),require(_0x677e('0xd0')));_0x50231c[_0x677e('0x9')]('/api/attachments',require(_0x677e('0xd1')));_0x50231c[_0x677e('0x9')]('/api/plugins',require(_0x677e('0xd2')));_0x50231c[_0x677e('0x9')](_0x677e('0xd3'),require(_0x677e('0xd4')));_0x50231c[_0x677e('0x9')](_0x677e('0xd5'),require(_0x677e('0xd6')));_0x50231c[_0x677e('0x9')](_0x677e('0xd7'),require('./api/faxTransferReport'));_0x50231c['use'](_0x677e('0xd8'),require(_0x677e('0xd9')));_0x50231c[_0x677e('0x9')](_0x677e('0xda'),require('./api/smsTransferReport'));_0x50231c[_0x677e('0x9')](_0x677e('0xdb'),require(_0x677e('0xdc')));_0x50231c['use']('/api/voice/prefixes',require('./api/voicePrefix'));_0x50231c[_0x677e('0x9')](_0x677e('0xdd'),require('./api/userProfile'));_0x50231c[_0x677e('0x9')](_0x677e('0xde'),require(_0x677e('0xdf')));_0x50231c[_0x677e('0x9')]('/api/userProfile/resources',require('./api/userProfileResource'));_0x50231c[_0x677e('0x9')](_0x677e('0xe0'),require(_0x677e('0xe1')));_0x50231c[_0x677e('0x9')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x50231c['use'](_0x677e('0xe2'),require(_0x677e('0xe3')));_0x50231c['use']('/api/whatsapp/interactions',require(_0x677e('0xe4')));_0x50231c['use']('/api/whatsapp/messages',require(_0x677e('0xe5')));_0x50231c[_0x677e('0x9')](_0x677e('0xe6'),require(_0x677e('0xe7')));_0x50231c['use']('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x50231c[_0x677e('0x9')](_0x677e('0xe8'),require(_0x677e('0xe9')));_0x50231c[_0x677e('0x9')](_0x677e('0xea'),require(_0x677e('0xeb')));_0x50231c['use'](_0x677e('0xec'),require('./api/realtime'));_0x50231c['use'](_0x677e('0xed'),require(_0x677e('0xee')));_0x50231c['use'](_0x677e('0xef'),require(_0x677e('0xf0')));_0x50231c[_0x677e('0x9')]('/api/auth/local',require('./api/authLocal'));_0x50231c[_0x677e('0x9')]('/api/auth/google',require('./api/authGoogle'));_0x50231c[_0x677e('0x9')](_0x677e('0xf1'),require(_0x677e('0xf2')));_0x50231c['use']('/api/jira',require(_0x677e('0xf3')));_0x50231c[_0x677e('0x9')](_0x677e('0xf4'),require('./api/rpc'));_0x50231c[_0x677e('0x9')](_0x677e('0xf5'),require('./api/version'));_0x50231c[_0x677e('0x9')]('/api/system',require(_0x677e('0xf6')));_0x50231c[_0x677e('0x9')]('/api/pm2',require(_0x677e('0xf7')));_0x50231c[_0x677e('0x9')](_0x677e('0xf8'),require('./api/webbar'));_0x50231c['use']('/api/logs',clientSideLogs);_0x50231c[_0x677e('0x9')](_0x677e('0xf9'),express[_0x677e('0xfa')](path[_0x677e('0xfb')](config[_0x677e('0xfc')],_0x677e('0xf9'))));_0x50231c[_0x677e('0x9')](_0x677e('0xfd'),express[_0x677e('0xfa')](path[_0x677e('0xfb')](config[_0x677e('0xfc')],_0x677e('0xfd'))));_0x50231c['use'](_0x677e('0xfe'),express['static'](path['join'](config['root'],_0x677e('0xfe'))));_0x50231c[_0x677e('0x9')](_0x677e('0xff'),express['static'](path[_0x677e('0xfb')](config[_0x677e('0xfc')],'snippet','3.13.0')));_0x50231c[_0x677e('0x9')]('/plugins',express[_0x677e('0xfa')](path['join'](config[_0x677e('0xfc')],_0x677e('0x100'))));_0x50231c['route'](_0x677e('0x101'))[_0x677e('0x102')](errors[0x194]);_0x50231c[_0x677e('0x103')]('/*')[_0x677e('0x102')](function(_0x2221a5,_0x3c8ea0){_0x3c8ea0[_0x677e('0x104')](path[_0x677e('0x105')](_0x50231c[_0x677e('0x102')](_0x677e('0x106'))+'/index.html'));});return _0x50231c;});}; \ No newline at end of file +var _0xbbbc=['./api/voiceCallReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/voice/transfers/reports','./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/mail/reports/queue','/api/dashboards','./api/dashboard','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/variables','./api/variable','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/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/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZendeskAccount','./api/intZendeskConfiguration','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/sms/reports/queue','/api/square/reports','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/whatsapp/applications','./api/whatsappMessage','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/apidoc','root','/www','static','join','/demo','/snippet','snippet','3.13.0','/plugins','/server/files/plugins','route','get','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x45ec87,_0x5a9537){_0x45ec87=_0x45ec87-0x0;var _0x5b6eea=_0xbbbc[_0x45ec87];return _0x5b6eea;};'use strict';var path=require(_0xcbbb('0x0'));var express=require(_0xcbbb('0x1'));var errors=require(_0xcbbb('0x2'));var config=require(_0xcbbb('0x3'));var setupLoggers=require(_0xcbbb('0x4'))[_0xcbbb('0x5')];var clientSideLogs=require(_0xcbbb('0x6'));exports['default']=function(_0xb1ad23){return setupLoggers(_0xb1ad23)[_0xcbbb('0x7')](function(){_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x9'),require(_0xcbbb('0xa')));_0xb1ad23['use'](_0xcbbb('0xb'),require(_0xcbbb('0xc')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xd'),require(_0xcbbb('0xe')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xf'),require('./api/voiceExtension'));_0xb1ad23[_0xcbbb('0x8')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0xb1ad23[_0xcbbb('0x8')]('/api/voice/queues',require(_0xcbbb('0x10')));_0xb1ad23['use'](_0xcbbb('0x11'),require(_0xcbbb('0x12')));_0xb1ad23['use'](_0xcbbb('0x13'),require('./api/screenRecording'));_0xb1ad23[_0xcbbb('0x8')]('/api/voice/mails',require(_0xcbbb('0x14')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x15'),require('./api/voiceMailMessage'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x16'),require(_0xcbbb('0x17')));_0xb1ad23[_0xcbbb('0x8')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x18'),require(_0xcbbb('0x19')));_0xb1ad23[_0xcbbb('0x8')]('/api/voice/queues/reports',require(_0xcbbb('0x1a')));_0xb1ad23['use'](_0xcbbb('0x1b'),require(_0xcbbb('0x1c')));_0xb1ad23[_0xcbbb('0x8')]('/api/trunks',require('./api/trunk'));_0xb1ad23['use'](_0xcbbb('0x1d'),require(_0xcbbb('0x1e')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x1f'),require(_0xcbbb('0x20')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x21'),require(_0xcbbb('0x22')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x23'),require('./api/mailQueue'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x24'),require(_0xcbbb('0x25')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x26'),require(_0xcbbb('0x27')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x28'),require(_0xcbbb('0x29')));_0xb1ad23['use'](_0xcbbb('0x2a'),require(_0xcbbb('0x2b')));_0xb1ad23['use'](_0xcbbb('0x2c'),require('./api/mailQueueReport'));_0xb1ad23['use'](_0xcbbb('0x2d'),require(_0xcbbb('0x2e')));_0xb1ad23['use']('/api/dashboards/items',require('./api/dashboardItem'));_0xb1ad23[_0xcbbb('0x8')]('/api/fax/accounts',require('./api/faxAccount'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x2f'),require(_0xcbbb('0x30')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x31'),require(_0xcbbb('0x32')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x33'),require(_0xcbbb('0x34')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x35'),require(_0xcbbb('0x36')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x37'),require(_0xcbbb('0x38')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x39'),require(_0xcbbb('0x3a')));_0xb1ad23['use'](_0xcbbb('0x3b'),require(_0xcbbb('0x3c')));_0xb1ad23['use'](_0xcbbb('0x3d'),require('./api/smsInteraction'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x3e'),require(_0xcbbb('0x3f')));_0xb1ad23['use'](_0xcbbb('0x40'),require(_0xcbbb('0x41')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x42'),require(_0xcbbb('0x43')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x44'),require(_0xcbbb('0x45')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x46'),require('./api/openchannelInteraction'));_0xb1ad23['use']('/api/openchannel/messages',require('./api/openchannelMessage'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x47'),require(_0xcbbb('0x48')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x49'),require(_0xcbbb('0x4a')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x4b'),require(_0xcbbb('0x4c')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x4d'),require(_0xcbbb('0x4e')));_0xb1ad23['use']('/api/chat/interactions',require(_0xcbbb('0x4f')));_0xb1ad23['use']('/api/chat/messages',require('./api/chatMessage'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x50'),require(_0xcbbb('0x51')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x52'),require(_0xcbbb('0x53')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x54'),require(_0xcbbb('0x55')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x56'),require('./api/chatProactiveAction'));_0xb1ad23[_0xcbbb('0x8')]('/api/cm/companies',require(_0xcbbb('0x57')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x58'),require(_0xcbbb('0x59')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x5a'),require('./api/cmHopper'));_0xb1ad23['use']('/api/cm/hopper_black',require(_0xcbbb('0x5b')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x5c'),require(_0xcbbb('0x5d')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x5e'),require(_0xcbbb('0x5f')));_0xb1ad23['use'](_0xcbbb('0x60'),require(_0xcbbb('0x61')));_0xb1ad23['use'](_0xcbbb('0x62'),require(_0xcbbb('0x63')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x64'),require(_0xcbbb('0x65')));_0xb1ad23['use'](_0xcbbb('0x66'),require('./api/cannedAnswer'));_0xb1ad23['use'](_0xcbbb('0x67'),require(_0xcbbb('0x68')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x69'),require(_0xcbbb('0x6a')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x6b'),require(_0xcbbb('0x6c')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x6d'),require(_0xcbbb('0x6e')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x6f'),require(_0xcbbb('0x70')));_0xb1ad23['use'](_0xcbbb('0x71'),require(_0xcbbb('0x72')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x73'),require('./api/schedule'));_0xb1ad23['use']('/api/sounds',require(_0xcbbb('0x74')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x75'),require(_0xcbbb('0x76')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x77'),require(_0xcbbb('0x78')));_0xb1ad23['use'](_0xcbbb('0x79'),require(_0xcbbb('0x7a')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x7b'),require('./api/cmHopperAdditionalPhone'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x7c'),require(_0xcbbb('0x7d')));_0xb1ad23[_0xcbbb('0x8')]('/api/triggers',require('./api/trigger'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x7e'),require(_0xcbbb('0x7f')));_0xb1ad23['use']('/api/integrations',require('./api/integration'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x80'),require('./api/integrationReport'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x81'),require(_0xcbbb('0x82')));_0xb1ad23[_0xcbbb('0x8')]('/api/analytics/default_reports',require(_0xcbbb('0x83')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x84'),require(_0xcbbb('0x85')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x86'),require(_0xcbbb('0x87')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x88'),require(_0xcbbb('0x89')));_0xb1ad23[_0xcbbb('0x8')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x8a'),require(_0xcbbb('0x8b')));_0xb1ad23['use'](_0xcbbb('0x8c'),require('./api/intSalesforceConfiguration'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x8d'),require(_0xcbbb('0x8e')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x8f'),require(_0xcbbb('0x90')));_0xb1ad23['use']('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x91'),require(_0xcbbb('0x92')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x93'),require(_0xcbbb('0x94')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x95'),require(_0xcbbb('0x96')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x97'),require(_0xcbbb('0x98')));_0xb1ad23[_0xcbbb('0x8')]('/api/integrations/zoho/accounts',require(_0xcbbb('0x99')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x9a'),require('./api/intZohoConfiguration'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x9b'),require('./api/intZohoField'));_0xb1ad23[_0xcbbb('0x8')]('/api/integrations/zendesk/accounts',require(_0xcbbb('0x9c')));_0xb1ad23[_0xcbbb('0x8')]('/api/integrations/zendesk/configurations',require(_0xcbbb('0x9d')));_0xb1ad23[_0xcbbb('0x8')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0xb1ad23[_0xcbbb('0x8')]('/api/integrations/freshdesk/accounts',require(_0xcbbb('0x9e')));_0xb1ad23['use'](_0xcbbb('0x9f'),require(_0xcbbb('0xa0')));_0xb1ad23[_0xcbbb('0x8')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xa1'),require('./api/intVtigerAccount'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xa2'),require(_0xcbbb('0xa3')));_0xb1ad23['use'](_0xcbbb('0xa4'),require(_0xcbbb('0xa5')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xa6'),require(_0xcbbb('0xa7')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xa8'),require('./api/intServicenowConfiguration'));_0xb1ad23['use'](_0xcbbb('0xa9'),require(_0xcbbb('0xaa')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xab'),require('./api/intDynamics365Account'));_0xb1ad23['use'](_0xcbbb('0xac'),require('./api/intDynamics365Configuration'));_0xb1ad23['use'](_0xcbbb('0xad'),require(_0xcbbb('0xae')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xaf'),require(_0xcbbb('0xb0')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xb1'),require('./api/intFreshsalesConfiguration'));_0xb1ad23[_0xcbbb('0x8')]('/api/integrations/freshsales/fields',require(_0xcbbb('0xb2')));_0xb1ad23['use'](_0xcbbb('0xb3'),require(_0xcbbb('0xb4')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xb5'),require(_0xcbbb('0xb6')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xb7'),require(_0xcbbb('0xb8')));_0xb1ad23['use']('/api/jscripty/answers/reports',require(_0xcbbb('0xb9')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xba'),require(_0xcbbb('0xbb')));_0xb1ad23['use']('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xbc'),require('./api/smsQueueReport'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xbd'),require('./api/squareReport'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xbe'),require('./api/squareReportDetail'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xbf'),require(_0xcbbb('0xc0')));_0xb1ad23['use']('/api/settings',require(_0xcbbb('0xc1')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xc2'),require('./api/squareOdbc'));_0xb1ad23['use'](_0xcbbb('0xc3'),require(_0xcbbb('0xc4')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xc5'),require(_0xcbbb('0xc6')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xc7'),require(_0xcbbb('0xc8')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xc9'),require(_0xcbbb('0xca')));_0xb1ad23['use'](_0xcbbb('0xcb'),require(_0xcbbb('0xcc')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xcd'),require(_0xcbbb('0xce')));_0xb1ad23['use'](_0xcbbb('0xcf'),require(_0xcbbb('0xd0')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xd1'),require('./api/attachment'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xd2'),require(_0xcbbb('0xd3')));_0xb1ad23['use']('/api/mail/reports/transfer',require(_0xcbbb('0xd4')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xd5'),require(_0xcbbb('0xd6')));_0xb1ad23['use'](_0xcbbb('0xd7'),require(_0xcbbb('0xd8')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xd9'),require(_0xcbbb('0xda')));_0xb1ad23['use']('/api/sms/reports/transfer',require(_0xcbbb('0xdb')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xdc'),require(_0xcbbb('0xdd')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xde'),require('./api/voicePrefix'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xdf'),require(_0xcbbb('0xe0')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xe1'),require(_0xcbbb('0xe2')));_0xb1ad23[_0xcbbb('0x8')]('/api/userProfile/resources',require('./api/userProfileResource'));_0xb1ad23[_0xcbbb('0x8')]('/api/userNotifications',require('./api/userNotification'));_0xb1ad23[_0xcbbb('0x8')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0xb1ad23['use'](_0xcbbb('0xe3'),require('./api/whatsappApplication'));_0xb1ad23[_0xcbbb('0x8')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0xb1ad23['use']('/api/whatsapp/messages',require(_0xcbbb('0xe4')));_0xb1ad23[_0xcbbb('0x8')]('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xe5'),require('./api/whatsappTransferReport'));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xe6'),require(_0xcbbb('0xe7')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xe8'),require(_0xcbbb('0xe9')));_0xb1ad23[_0xcbbb('0x8')]('/api/realtime',require(_0xcbbb('0xea')));_0xb1ad23[_0xcbbb('0x8')]('/api/user-settings',require(_0xcbbb('0xeb')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xec'),require(_0xcbbb('0xed')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xee'),require('./api/authLocal'));_0xb1ad23['use'](_0xcbbb('0xef'),require(_0xcbbb('0xf0')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xf1'),require(_0xcbbb('0xf2')));_0xb1ad23['use'](_0xcbbb('0xf3'),require(_0xcbbb('0xf4')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xf5'),require(_0xcbbb('0xf6')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xf7'),require(_0xcbbb('0xf8')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xf9'),require(_0xcbbb('0xfa')));_0xb1ad23['use']('/api/pm2',require(_0xcbbb('0xfb')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xfc'),require(_0xcbbb('0xfd')));_0xb1ad23[_0xcbbb('0x8')]('/api/logs',clientSideLogs);_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0xfe'),express['static'](path['join'](config[_0xcbbb('0xff')],'/apidoc')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x100'),express[_0xcbbb('0x101')](path[_0xcbbb('0x102')](config['root'],'/www')));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x103'),express['static'](path[_0xcbbb('0x102')](config[_0xcbbb('0xff')],_0xcbbb('0x103'))));_0xb1ad23[_0xcbbb('0x8')](_0xcbbb('0x104'),express[_0xcbbb('0x101')](path[_0xcbbb('0x102')](config['root'],_0xcbbb('0x105'),_0xcbbb('0x106'))));_0xb1ad23['use'](_0xcbbb('0x107'),express['static'](path[_0xcbbb('0x102')](config[_0xcbbb('0xff')],_0xcbbb('0x108'))));_0xb1ad23[_0xcbbb('0x109')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xcbbb('0x10a')](errors[0x194]);_0xb1ad23[_0xcbbb('0x109')]('/*')[_0xcbbb('0x10a')](function(_0x23fcff,_0x21b352){_0x21b352['sendFile'](path['resolve'](_0xb1ad23[_0xcbbb('0x10a')](_0xcbbb('0x10b'))+_0xcbbb('0x10c')));});return _0xb1ad23;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 889641b..aa94cfe 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd142=['../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.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/reportAgentPreview/reportAgentPreview.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareRecording/squareRecording.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','lodash','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailMessage/mailMessage.rpc'];(function(_0x4445ce,_0x12b4b3){var _0x33d631=function(_0x32bb39){while(--_0x32bb39){_0x4445ce['push'](_0x4445ce['shift']());}};_0x33d631(++_0x12b4b3);}(_0xd142,0xec));var _0x2d14=function(_0x2bf14b,_0x409fc8){_0x2bf14b=_0x2bf14b-0x0;var _0x32f2d4=_0xd142[_0x2bf14b];return _0x32f2d4;};'use strict';var jayson=require('jayson/promise');var _=require(_0x2d14('0x0'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x3d4f89,_0x3269d9){var _0x4fb212={};_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/user/user.rpc'));_0x4fb212=_['merge'](_0x4fb212,require(_0x2d14('0x2')));_0x4fb212=_['merge'](_0x4fb212,require(_0x2d14('0x3')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x4')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x5')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x6')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x7')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x8')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x9')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0xa')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0xb')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0xc')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0xd')));_0x4fb212=_['merge'](_0x4fb212,require(_0x2d14('0xe')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/mailQueue/mailQueue.rpc'));_0x4fb212=_['merge'](_0x4fb212,require('../api/mailInteraction/mailInteraction.rpc'));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0xf')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x10')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x11')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x12')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x13')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/faxInteraction/faxInteraction.rpc'));_0x4fb212=_['merge'](_0x4fb212,require(_0x2d14('0x14')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x15')));_0x4fb212=_['merge'](_0x4fb212,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x16')));_0x4fb212=_['merge'](_0x4fb212,require(_0x2d14('0x17')));_0x4fb212=_['merge'](_0x4fb212,require(_0x2d14('0x18')));_0x4fb212=_['merge'](_0x4fb212,require(_0x2d14('0x19')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x4fb212=_['merge'](_0x4fb212,require(_0x2d14('0x1a')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x1b')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x1c')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x1d')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x1e')));_0x4fb212=_['merge'](_0x4fb212,require('../api/chatQueue/chatQueue.rpc'));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x1f')));_0x4fb212=_['merge'](_0x4fb212,require(_0x2d14('0x20')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x21')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x22')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x23')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x24')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/interval/interval.rpc'));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/pause/pause.rpc'));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x25')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x26')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/trigger/trigger.rpc'));_0x4fb212=_['merge'](_0x4fb212,require(_0x2d14('0x27')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x28')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x29')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x2a')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x4fb212=_['merge'](_0x4fb212,require(_0x2d14('0x2b')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x2c')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x2d')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x2e')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x2f')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/setting/setting.rpc'));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/squareOdbc/squareOdbc.rpc'));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/squareProject/squareProject.rpc'));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x30')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/squareMessage/squareMessage.rpc'));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/campaign/campaign.rpc'));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x31')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x32')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x33')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require(_0x2d14('0x34')));_0x4fb212=_[_0x2d14('0x1')](_0x4fb212,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x4fb212=_['merge'](_0x4fb212,require(_0x2d14('0x35')));var _0x1a673d=jayson['server'](_0x4fb212)[_0x2d14('0x36')]();var _0x36e631=config[_0x2d14('0x37')][_0x2d14('0x38')]||config['port']+0x1;var _0xafb752=config[_0x2d14('0x37')]['ip']||_0x2d14('0x39');_0x1a673d['on'](_0x2d14('0x3a'),function(_0x34180c){return _0x3269d9(_0x34180c);});_0x1a673d[_0x2d14('0x3b')](_0x36e631,_0xafb752,function(){console[_0x2d14('0x3c')](_0x2d14('0x3d'),_0xafb752,_0x36e631);require(_0x2d14('0x3e'))['default']();return _0x3d4f89('RPC\x20listening\x20on\x20'+_0xafb752+':'+_0x36e631);});});}; \ No newline at end of file +var _0x7d1e=['RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.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/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x7d1e,0x111));var _0xe7d1=function(_0x5e238b,_0x17ae49){_0x5e238b=_0x5e238b-0x0;var _0x389bea=_0x7d1e[_0x5e238b];return _0x389bea;};'use strict';var jayson=require(_0xe7d1('0x0'));var _=require(_0xe7d1('0x1'));var config=require(_0xe7d1('0x2'));exports[_0xe7d1('0x3')]=function(){return new Promise(function(_0x13de14,_0x3ea575){var _0x3ea53a={};_0x3ea53a=_['merge'](_0x3ea53a,require(_0xe7d1('0x4')));_0x3ea53a=_['merge'](_0x3ea53a,require(_0xe7d1('0x5')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x7')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x8')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x9')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0xa')));_0x3ea53a=_['merge'](_0x3ea53a,require(_0xe7d1('0xb')));_0x3ea53a=_['merge'](_0x3ea53a,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require('../api/memberReport/memberReport.rpc'));_0x3ea53a=_['merge'](_0x3ea53a,require(_0xe7d1('0xc')));_0x3ea53a=_['merge'](_0x3ea53a,require(_0xe7d1('0xd')));_0x3ea53a=_['merge'](_0x3ea53a,require(_0xe7d1('0xe')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0xf')));_0x3ea53a=_['merge'](_0x3ea53a,require(_0xe7d1('0x10')));_0x3ea53a=_['merge'](_0x3ea53a,require('../api/mailQueue/mailQueue.rpc'));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x11')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x12')));_0x3ea53a=_['merge'](_0x3ea53a,require(_0xe7d1('0x13')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x14')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require('../api/faxAccount/faxAccount.rpc'));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require('../api/faxApplication/faxApplication.rpc'));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x15')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x16')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x17')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x18')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x19')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x1a')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require('../api/smsQueue/smsQueue.rpc'));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x1b')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x1c')));_0x3ea53a=_['merge'](_0x3ea53a,require(_0xe7d1('0x1d')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x3ea53a=_['merge'](_0x3ea53a,require(_0xe7d1('0x1e')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require('../api/chatInteraction/chatInteraction.rpc'));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x1f')));_0x3ea53a=_['merge'](_0x3ea53a,require('../api/chatQueue/chatQueue.rpc'));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x20')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x21')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x22')));_0x3ea53a=_['merge'](_0x3ea53a,require(_0xe7d1('0x23')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x24')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require('../api/interval/interval.rpc'));_0x3ea53a=_['merge'](_0x3ea53a,require('../api/pause/pause.rpc'));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x25')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x26')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x27')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x28')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x29')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x2a')));_0x3ea53a=_['merge'](_0x3ea53a,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x2b')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x2c')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x3ea53a=_['merge'](_0x3ea53a,require(_0xe7d1('0x2d')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x2e')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x2f')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x30')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x31')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x32')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require('../api/setting/setting.rpc'));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x33')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require('../api/squareProject/squareProject.rpc'));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require('../api/squareRecording/squareRecording.rpc'));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x34')));_0x3ea53a=_['merge'](_0x3ea53a,require(_0xe7d1('0x35')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x36')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x37')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x38')));_0x3ea53a=_['merge'](_0x3ea53a,require(_0xe7d1('0x39')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require(_0xe7d1('0x3a')));_0x3ea53a=_[_0xe7d1('0x6')](_0x3ea53a,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x411fe7=jayson[_0xe7d1('0x3b')](_0x3ea53a)[_0xe7d1('0x3c')]();var _0x469739=config['rpc'][_0xe7d1('0x3d')]||config['port']+0x1;var _0x1f1684=config['rpc']['ip']||'localhost';_0x411fe7['on'](_0xe7d1('0x3e'),function(_0x506c03){return _0x3ea575(_0x506c03);});_0x411fe7['listen'](_0x469739,_0x1f1684,function(){console[_0xe7d1('0x3f')](_0xe7d1('0x40'),_0x1f1684,_0x469739);require(_0xe7d1('0x41'))[_0xe7d1('0x42')]();return _0x13de14(_0xe7d1('0x43')+_0x1f1684+':'+_0x469739);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 753493f..3e04943 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 _0x8f05=['./reply','setTimeout','setEncoding','utf8','line','toLowerCase','hangup','emit','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','substring','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','answer','sendRequest','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','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','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','label','exports','util','lodash','events'];(function(_0x435044,_0x36ab8e){var _0x33d4c6=function(_0x15efa0){while(--_0x15efa0){_0x435044['push'](_0x435044['shift']());}};_0x33d4c6(++_0x36ab8e);}(_0x8f05,0x1cb));var _0x58f0=function(_0x1258d7,_0x35f50a){_0x1258d7=_0x1258d7-0x0;var _0x1a71e4=_0x8f05[_0x1258d7];return _0x1a71e4;};'use strict';var util=require(_0x58f0('0x0'));var _=require(_0x58f0('0x1'));var EventEmitter=require(_0x58f0('0x2'))['EventEmitter'];var AGIReply=require(_0x58f0('0x3'));var AGIError=require('./error');function AGIChannel(_0x489772){var _0x2bf931=this,_0x54ad1f=new AGIReply(),_0x1e1ca8=![],_0x8902ba={};EventEmitter['call'](_0x2bf931);_0x489772['setEncoding']('utf8');_0x489772[_0x58f0('0x4')](0x8*0x3c*0x3c*0x3e8);_0x54ad1f[_0x58f0('0x5')](_0x58f0('0x6'));_0x54ad1f['on']('headers',function(_0x148bf1){for(var _0x6dda3b in _0x148bf1){_0x2bf931[_0x6dda3b]=_0x148bf1[_0x6dda3b];}_0x2bf931['emit']('ready');});_0x54ad1f['on'](_0x58f0('0x7'),function(_0x21df17){if(_0x21df17[_0x58f0('0x8')]()==_0x58f0('0x9')){_0x2bf931[_0x58f0('0xa')](_0x58f0('0x9'));return;}if(_0x21df17['substring'](0x0,0xb)==_0x58f0('0xb')){_0x1e1ca8=!![];}if(_0x1e1ca8){_0x8902ba['rx']+=_0x21df17+'\x0a';if(_0x21df17[_0x58f0('0xc')](_0x58f0('0xd'))!=-0x1){_0x1e1ca8=![];}}else{_0x8902ba['rx']=_0x21df17;}if(_0x1e1ca8){return;}if(typeof _0x8902ba['cb']==_0x58f0('0xe')){var _0x56e8f1=_0x8902ba['rx']['substring'](0x0,0x3),_0x4d3d9b=null,_0x3e5f2f=null;_0x56e8f1=parseInt(_0x56e8f1);if(isNaN(_0x56e8f1)){_0x8902ba['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x58f0('0xf')});return;}if(_0x56e8f1!=0xc8){_0x8902ba['cb'](null,{'code':_0x56e8f1,'result':-0x1,'extra':'KO'});return;}_0x4d3d9b=_0x8902ba['rx'][_0x58f0('0x10')](0x4)[_0x58f0('0x11')](_0x58f0('0x12'),'');if(_0x4d3d9b[_0x58f0('0x13')]('\x20')!=-0x1){_0x4d3d9b=_0x4d3d9b[_0x58f0('0x14')](0x0,_0x4d3d9b['indexOf']('\x20'));}if(_[_0x58f0('0x15')](_0x4d3d9b,'-1')){_0x4d3d9b=parseInt(_0x4d3d9b);}_0x3e5f2f=_0x8902ba['rx'][_0x58f0('0x16')]('\x20');if(_0x3e5f2f[_0x58f0('0x17')]==0x3){_0x3e5f2f=_0x3e5f2f[0x2][_0x58f0('0x10')](0x1,_0x3e5f2f[0x2][_0x58f0('0x17')]-0x1);}else if(_0x3e5f2f['length']>0x3){var _0x3b40a8=/\((.+)\)/;var _0x4fc680=_0x8902ba['rx'][_0x58f0('0x18')](_0x3b40a8);if(_0x4fc680){_0x3e5f2f=_0x4fc680[0x1];}else{_0x3e5f2f=null;}}else{_0x3e5f2f=null;}_0x8902ba['cb'](null,{'code':_0x56e8f1,'result':_0x4d3d9b,'extra':_0x3e5f2f});}});_0x489772['on'](_0x58f0('0x19'),function(_0x476371){_0x2bf931[_0x58f0('0xa')](_0x58f0('0x19'),new AGIError(_0x58f0('0x1a'),_0x476371[_0x58f0('0x1b')]));});_0x489772['on'](_0x58f0('0x1c'),function(){_0x2bf931['emit'](_0x58f0('0x1c'),new AGIError(_0x58f0('0x1d')));});_0x489772['on']('timeout',function(){_0x2bf931[_0x58f0('0xa')](_0x58f0('0x1e'),new AGIError(_0x58f0('0x1f')));_0x489772[_0x58f0('0x20')]();});_0x489772[_0x58f0('0x21')](_0x54ad1f);this[_0x58f0('0x22')]=function(_0x3c3ebc,_0x37109a){var _0x3c3ebc=_0x3c3ebc||'',_0x37109a=typeof _0x37109a==_0x58f0('0xe')?_0x37109a:new Function();_0x8902ba={'tx':_0x3c3ebc,'rx':'','cb':_0x37109a};_0x489772[_0x58f0('0x23')](_0x3c3ebc+'\x0a');},this[_0x58f0('0x1c')]=function(){_0x489772[_0x58f0('0x20')]();};}util[_0x58f0('0x24')](AGIChannel,EventEmitter);AGIChannel[_0x58f0('0x25')]['sendRequest']=function(_0x4f04ec){return this[_0x58f0('0x22')]['sync'](this,_0x4f04ec);};AGIChannel[_0x58f0('0x25')][_0x58f0('0x26')]=function(){return this[_0x58f0('0x27')](_0x58f0('0x28'));};AGIChannel[_0x58f0('0x25')][_0x58f0('0x29')]=function(_0x42b43a,_0x3b9b9d,_0x15c9aa){_0x42b43a=_0x42b43a===undefined?_0x58f0('0x2a'):_0x42b43a;_0x3b9b9d=_0x3b9b9d===undefined?'5':_0x3b9b9d;_0x15c9aa=_0x15c9aa===undefined?'1':_0x15c9aa;return this[_0x58f0('0x27')](util['format'](_0x58f0('0x2b'),_0x42b43a,_0x3b9b9d*0x3e8,_0x15c9aa));};AGIChannel[_0x58f0('0x25')]['noop']=function(_0x56975c){_0x56975c=_0x56975c||'NO\x20MESSAGE';return this[_0x58f0('0x27')](util[_0x58f0('0x2c')](_0x58f0('0x2d'),_0x56975c));};AGIChannel[_0x58f0('0x25')][_0x58f0('0x2e')]=function(_0x750e0e,_0x1d4384){if(_[_0x58f0('0x2f')](_0x1d4384)){return this[_0x58f0('0x27')](util[_0x58f0('0x2c')](_0x58f0('0x30'),_0x750e0e,_0x1d4384['join'](',')));}return this[_0x58f0('0x27')](util['format'](_0x58f0('0x30'),_0x750e0e,_0x1d4384));};AGIChannel[_0x58f0('0x25')]['setContext']=function(_0x299eb7){return this[_0x58f0('0x27')](util[_0x58f0('0x2c')](_0x58f0('0x31'),_0x299eb7));};AGIChannel['prototype'][_0x58f0('0x32')]=function(_0x3f324e){return this['sendRequest'](util[_0x58f0('0x2c')](_0x58f0('0x33'),_0x3f324e));};AGIChannel[_0x58f0('0x25')][_0x58f0('0x34')]=function(_0x5c04fa){return this['sendRequest'](util[_0x58f0('0x2c')](_0x58f0('0x35'),_0x5c04fa));};AGIChannel[_0x58f0('0x25')][_0x58f0('0x9')]=function(){return this[_0x58f0('0x27')](_0x58f0('0x36'));};AGIChannel[_0x58f0('0x25')][_0x58f0('0x37')]=function(_0x4faadb,_0x5e080f){var _0x374ab4=_[_0x58f0('0x38')](_0x5e080f)||_[_0x58f0('0x39')](_0x5e080f)?_0x5e080f[_0x58f0('0x3a')]():_0x5e080f;return this[_0x58f0('0x27')](util[_0x58f0('0x2c')](_0x58f0('0x3b'),_0x4faadb,_0x374ab4?_0x374ab4[_0x58f0('0x3a')]()[_0x58f0('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x58f0('0x25')]['sayNumber']=function(_0x46f4a8,_0x438a3a){return this[_0x58f0('0x27')](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x46f4a8,_0x438a3a));};AGIChannel['prototype'][_0x58f0('0x3c')]=function(_0x202b35,_0x1d1c05){return this[_0x58f0('0x27')](util[_0x58f0('0x2c')](_0x58f0('0x3d'),_0x202b35,_0x1d1c05));};AGIChannel['prototype']['sayPhonetic']=function(_0x452c57,_0x4f05da){return this[_0x58f0('0x27')](util[_0x58f0('0x2c')](_0x58f0('0x3e'),_0x452c57,_0x4f05da));};AGIChannel[_0x58f0('0x25')][_0x58f0('0x3f')]=function(_0x1e6b10,_0x495b50,_0x56e46e){_0x495b50=_0x495b50||this['extension'];_0x56e46e=_0x56e46e||0x1;this[_0x58f0('0x40')](_0x1e6b10);this['setExtension'](_0x495b50);this[_0x58f0('0x34')](_0x56e46e);return this[_0x58f0('0x41')](util['format'](_0x58f0('0x42'),_0x1e6b10,_0x495b50,_0x56e46e));};AGIChannel[_0x58f0('0x25')][_0x58f0('0x43')]=function(_0x3979f9){return this[_0x58f0('0x27')](util[_0x58f0('0x2c')]('GET\x20VARIABLE\x20\x22%s\x22',_0x3979f9));};AGIChannel['prototype'][_0x58f0('0x44')]=function(_0x30ad19,_0x5ecd1e,_0x267c1d,_0x1bd0e9,_0x1c8749,_0x5a18db){_0x5ecd1e=_0x5ecd1e||_0x58f0('0x45');_0x267c1d=_0x267c1d||'';_0x1bd0e9=_0x1bd0e9===undefined?-0x1:_0x1bd0e9==='-1'?-0x1:_0x1bd0e9*0x3e8;_0x1c8749=_0x1c8749===undefined?'':'s='+_0x1c8749;_0x5a18db=_0x5a18db?'BEEP':'';return this[_0x58f0('0x27')](util[_0x58f0('0x2c')](_0x58f0('0x46'),_0x30ad19,_0x5ecd1e,_0x267c1d,_0x1bd0e9,_0x5a18db,_0x1c8749));};AGIChannel['prototype']['streamFile']=function(_0x8109d6,_0xe725f6){_0xe725f6=_0xe725f6||'';return this[_0x58f0('0x27')](util[_0x58f0('0x2c')](_0x58f0('0x47'),_0x8109d6,_0xe725f6));};AGIChannel[_0x58f0('0x25')][_0x58f0('0x48')]=function(_0x8af81e){return this['exec'](_0x58f0('0x49'),_0x8af81e);};AGIChannel[_0x58f0('0x25')][_0x58f0('0x4a')]=function(_0x37e1df){return this['exec']('WAIT',_0x37e1df);};AGIChannel[_0x58f0('0x25')]['error']=function(_0x1931be,_0x4a90ed){this[_0x58f0('0x41')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x1931be['id'],_0x1931be[_0x58f0('0x4b')],_0x4a90ed));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x58f0('0x4c')]=AGIChannel; \ No newline at end of file +var _0xd535=['getData','beep','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','format','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','setPriority','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','agi','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','./error','call','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','hangup','emit','substring','520-Invalid','search','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER'];(function(_0x1e00c4,_0x212831){var _0x69660c=function(_0x3cd6fa){while(--_0x3cd6fa){_0x1e00c4['push'](_0x1e00c4['shift']());}};_0x69660c(++_0x212831);}(_0xd535,0x161));var _0x5d53=function(_0x3a6d2d,_0x28c9bf){_0x3a6d2d=_0x3a6d2d-0x0;var _0x557312=_0xd535[_0x3a6d2d];return _0x557312;};'use strict';var util=require(_0x5d53('0x0'));var _=require(_0x5d53('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x5d53('0x2'));function AGIChannel(_0x510d60){var _0x5177af=this,_0x300c2a=new AGIReply(),_0x43a935=![],_0x3d8ac8={};EventEmitter[_0x5d53('0x3')](_0x5177af);_0x510d60[_0x5d53('0x4')](_0x5d53('0x5'));_0x510d60[_0x5d53('0x6')](0x8*0x3c*0x3c*0x3e8);_0x300c2a[_0x5d53('0x4')](_0x5d53('0x5'));_0x300c2a['on'](_0x5d53('0x7'),function(_0x4e9a58){for(var _0x448fef in _0x4e9a58){_0x5177af[_0x448fef]=_0x4e9a58[_0x448fef];}_0x5177af['emit'](_0x5d53('0x8'));});_0x300c2a['on'](_0x5d53('0x9'),function(_0x409b08){if(_0x409b08[_0x5d53('0xa')]()==_0x5d53('0xb')){_0x5177af[_0x5d53('0xc')](_0x5d53('0xb'));return;}if(_0x409b08[_0x5d53('0xd')](0x0,0xb)==_0x5d53('0xe')){_0x43a935=!![];}if(_0x43a935){_0x3d8ac8['rx']+=_0x409b08+'\x0a';if(_0x409b08[_0x5d53('0xf')]('520\x20End\x20of\x20proper')!=-0x1){_0x43a935=![];}}else{_0x3d8ac8['rx']=_0x409b08;}if(_0x43a935){return;}if(typeof _0x3d8ac8['cb']==_0x5d53('0x10')){var _0x2dff7c=_0x3d8ac8['rx'][_0x5d53('0xd')](0x0,0x3),_0x1b9721=null,_0x310ca8=null;_0x2dff7c=parseInt(_0x2dff7c);if(isNaN(_0x2dff7c)){_0x3d8ac8['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x5d53('0x11')});return;}if(_0x2dff7c!=0xc8){_0x3d8ac8['cb'](null,{'code':_0x2dff7c,'result':-0x1,'extra':'KO'});return;}_0x1b9721=_0x3d8ac8['rx'][_0x5d53('0xd')](0x4)[_0x5d53('0x12')](_0x5d53('0x13'),'');if(_0x1b9721[_0x5d53('0x14')]('\x20')!=-0x1){_0x1b9721=_0x1b9721[_0x5d53('0x15')](0x0,_0x1b9721[_0x5d53('0x14')]('\x20'));}if(_[_0x5d53('0x16')](_0x1b9721,'-1')){_0x1b9721=parseInt(_0x1b9721);}_0x310ca8=_0x3d8ac8['rx'][_0x5d53('0x17')]('\x20');if(_0x310ca8[_0x5d53('0x18')]==0x3){_0x310ca8=_0x310ca8[0x2]['substring'](0x1,_0x310ca8[0x2]['length']-0x1);}else if(_0x310ca8[_0x5d53('0x18')]>0x3){var _0x5310bd=/\((.+)\)/;var _0x33dd58=_0x3d8ac8['rx'][_0x5d53('0x19')](_0x5310bd);if(_0x33dd58){_0x310ca8=_0x33dd58[0x1];}else{_0x310ca8=null;}}else{_0x310ca8=null;}_0x3d8ac8['cb'](null,{'code':_0x2dff7c,'result':_0x1b9721,'extra':_0x310ca8});}});_0x510d60['on'](_0x5d53('0x1a'),function(_0x3599d8){_0x5177af[_0x5d53('0xc')](_0x5d53('0x1a'),new AGIError(_0x5d53('0x1b'),_0x3599d8[_0x5d53('0x1c')]));});_0x510d60['on'](_0x5d53('0x1d'),function(){_0x5177af['emit'](_0x5d53('0x1d'),new AGIError(_0x5d53('0x1e')));});_0x510d60['on']('timeout',function(){_0x5177af[_0x5d53('0xc')](_0x5d53('0x1f'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x510d60[_0x5d53('0x20')]();});_0x510d60[_0x5d53('0x21')](_0x300c2a);this[_0x5d53('0x22')]=function(_0x1afcac,_0x1c26cf){var _0x1afcac=_0x1afcac||'',_0x1c26cf=typeof _0x1c26cf=='function'?_0x1c26cf:new Function();_0x3d8ac8={'tx':_0x1afcac,'rx':'','cb':_0x1c26cf};_0x510d60[_0x5d53('0x23')](_0x1afcac+'\x0a');},this[_0x5d53('0x1d')]=function(){_0x510d60[_0x5d53('0x20')]();};}util[_0x5d53('0x24')](AGIChannel,EventEmitter);AGIChannel[_0x5d53('0x25')][_0x5d53('0x26')]=function(_0x4c64ac){return this[_0x5d53('0x22')][_0x5d53('0x27')](this,_0x4c64ac);};AGIChannel['prototype'][_0x5d53('0x28')]=function(){return this[_0x5d53('0x26')](_0x5d53('0x29'));};AGIChannel['prototype'][_0x5d53('0x2a')]=function(_0x214602,_0x46ad96,_0x19fb92){_0x214602=_0x214602===undefined?_0x5d53('0x2b'):_0x214602;_0x46ad96=_0x46ad96===undefined?'5':_0x46ad96;_0x19fb92=_0x19fb92===undefined?'1':_0x19fb92;return this[_0x5d53('0x26')](util['format']('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x214602,_0x46ad96*0x3e8,_0x19fb92));};AGIChannel[_0x5d53('0x25')][_0x5d53('0x2c')]=function(_0x3efa1b){_0x3efa1b=_0x3efa1b||'NO\x20MESSAGE';return this[_0x5d53('0x26')](util['format'](_0x5d53('0x2d'),_0x3efa1b));};AGIChannel[_0x5d53('0x25')][_0x5d53('0x2e')]=function(_0x5a119e,_0x3b23d5){if(_[_0x5d53('0x2f')](_0x3b23d5)){return this['sendRequest'](util['format'](_0x5d53('0x30'),_0x5a119e,_0x3b23d5['join'](',')));}return this['sendRequest'](util[_0x5d53('0x31')](_0x5d53('0x30'),_0x5a119e,_0x3b23d5));};AGIChannel[_0x5d53('0x25')]['setContext']=function(_0x2ca3b1){return this[_0x5d53('0x26')](util[_0x5d53('0x31')](_0x5d53('0x32'),_0x2ca3b1));};AGIChannel[_0x5d53('0x25')][_0x5d53('0x33')]=function(_0x7bbf85){return this[_0x5d53('0x26')](util[_0x5d53('0x31')](_0x5d53('0x34'),_0x7bbf85));};AGIChannel['prototype']['setPriority']=function(_0x571f35){return this[_0x5d53('0x26')](util[_0x5d53('0x31')](_0x5d53('0x35'),_0x571f35));};AGIChannel[_0x5d53('0x25')]['hangup']=function(){return this[_0x5d53('0x26')](_0x5d53('0x36'));};AGIChannel[_0x5d53('0x25')][_0x5d53('0x37')]=function(_0x36f0ef,_0x3a264c){var _0x59e637=_[_0x5d53('0x38')](_0x3a264c)||_[_0x5d53('0x39')](_0x3a264c)?_0x3a264c['toString']():_0x3a264c;return this[_0x5d53('0x26')](util[_0x5d53('0x31')](_0x5d53('0x3a'),_0x36f0ef,_0x59e637?_0x59e637['toString']()[_0x5d53('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x5d53('0x25')][_0x5d53('0x3b')]=function(_0x40d141,_0x334ba2){return this[_0x5d53('0x26')](util[_0x5d53('0x31')](_0x5d53('0x3c'),_0x40d141,_0x334ba2));};AGIChannel[_0x5d53('0x25')][_0x5d53('0x3d')]=function(_0x5a4c06,_0x245cb9){return this[_0x5d53('0x26')](util[_0x5d53('0x31')](_0x5d53('0x3e'),_0x5a4c06,_0x245cb9));};AGIChannel[_0x5d53('0x25')][_0x5d53('0x3f')]=function(_0x578078,_0x5cad76){return this[_0x5d53('0x26')](util[_0x5d53('0x31')](_0x5d53('0x40'),_0x578078,_0x5cad76));};AGIChannel[_0x5d53('0x25')][_0x5d53('0x41')]=function(_0x486b87,_0x1dc136,_0x314a72){_0x1dc136=_0x1dc136||this['extension'];_0x314a72=_0x314a72||0x1;this[_0x5d53('0x42')](_0x486b87);this[_0x5d53('0x33')](_0x1dc136);this[_0x5d53('0x43')](_0x314a72);return this['noop'](util['format']('GOTO\x20%s\x20%s\x20%s',_0x486b87,_0x1dc136,_0x314a72));};AGIChannel[_0x5d53('0x25')][_0x5d53('0x44')]=function(_0x3bc26d){return this['sendRequest'](util[_0x5d53('0x31')](_0x5d53('0x45'),_0x3bc26d));};AGIChannel[_0x5d53('0x25')][_0x5d53('0x46')]=function(_0xb0fe72,_0x415366,_0xed4036,_0x3b04b7,_0x7b81c7,_0x32aa78){_0x415366=_0x415366||_0x5d53('0x47');_0xed4036=_0xed4036||'';_0x3b04b7=_0x3b04b7===undefined?-0x1:_0x3b04b7==='-1'?-0x1:_0x3b04b7*0x3e8;_0x7b81c7=_0x7b81c7===undefined?'':'s='+_0x7b81c7;_0x32aa78=_0x32aa78?_0x5d53('0x48'):'';return this[_0x5d53('0x26')](util['format'](_0x5d53('0x49'),_0xb0fe72,_0x415366,_0xed4036,_0x3b04b7,_0x32aa78,_0x7b81c7));};AGIChannel[_0x5d53('0x25')]['streamFile']=function(_0x1fe5cc,_0x2380be){_0x2380be=_0x2380be||'';return this['sendRequest'](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x1fe5cc,_0x2380be));};AGIChannel['prototype'][_0x5d53('0x4a')]=function(_0x24179a){return this['exec'](_0x5d53('0x4b'),_0x24179a);};AGIChannel[_0x5d53('0x25')]['wait']=function(_0x4d9e16){return this[_0x5d53('0x2e')](_0x5d53('0x4c'),_0x4d9e16);};AGIChannel[_0x5d53('0x25')]['error']=function(_0x536d72,_0x587744){this[_0x5d53('0x2c')](util[_0x5d53('0x31')](_0x5d53('0x4d'),_0x536d72['id'],_0x536d72['label'],_0x587744));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x5d53('0x4e')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 3bd10d2..560ff13 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 _0x9c3e=['E_AGI_UNDEFINED','push','format','message','name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0x276603,_0x14db81){var _0x3b3ec8=function(_0x4e99cc){while(--_0x4e99cc){_0x276603['push'](_0x276603['shift']());}};_0x3b3ec8(++_0x14db81);}(_0x9c3e,0x110));var _0xe9c3=function(_0x31b49a,_0x5707d9){_0x31b49a=_0x31b49a-0x0;var _0x3f2392=_0x9c3e[_0x31b49a];return _0x3f2392;};'use strict';var util=require(_0xe9c3('0x0'));var error={'E_AGI_UNDEFINED':_0xe9c3('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xe9c3('0x2'),'E_AGI_SERVER_CLOSE':_0xe9c3('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xe9c3('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xe9c3('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xe9c3('0x6'),'E_AGI_IVR_ENTRY':_0xe9c3('0x7')};function AGIError(_0x41ac3f){var _0x41ac3f=_0x41ac3f||null,_0x56760c=_0x56760c||[],_0x2d86a7=0x1,_0x10e0c8='';if(!error[_0x41ac3f]){_0x41ac3f=_0xe9c3('0x8');}_0x56760c[_0xe9c3('0x9')](error[_0x41ac3f]);while(arguments[_0x2d86a7]){_0x56760c[_0xe9c3('0x9')](arguments[_0x2d86a7]);_0x2d86a7++;}_0x10e0c8=util[_0xe9c3('0xa')]['apply'](util,_0x56760c);this[_0xe9c3('0xb')]=_0x10e0c8;this[_0xe9c3('0xc')]=_0x41ac3f;}module[_0xe9c3('0xd')]=AGIError; \ No newline at end of file +var _0x9b44=['apply','name','util','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.','E_AGI_UNDEFINED','push'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b44,0x17c));var _0x49b4=function(_0x2adfb1,_0x406e6e){_0x2adfb1=_0x2adfb1-0x0;var _0xa52d45=_0x9b44[_0x2adfb1];return _0xa52d45;};'use strict';var util=require(_0x49b4('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x49b4('0x1'),'E_AGI_SERVER_ERROR':_0x49b4('0x2'),'E_AGI_SERVER_CLOSE':_0x49b4('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x49b4('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x49b4('0x5'),'E_AGI_SOCKET_ERROR':_0x49b4('0x6'),'E_AGI_SOCKET_CLOSE':_0x49b4('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x49b4('0x8'),'E_AGI_COMMAND_EMPTY':_0x49b4('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x50588d){var _0x50588d=_0x50588d||null,_0x2fe09e=_0x2fe09e||[],_0x2be7c3=0x1,_0x5efec7='';if(!error[_0x50588d]){_0x50588d=_0x49b4('0xa');}_0x2fe09e['push'](error[_0x50588d]);while(arguments[_0x2be7c3]){_0x2fe09e[_0x49b4('0xb')](arguments[_0x2be7c3]);_0x2be7c3++;}_0x5efec7=util['format'][_0x49b4('0xc')](util,_0x2fe09e);this['message']=_0x5efec7;this[_0x49b4('0xd')]=_0x50588d;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index af648d2..0d89681 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 _0x6a52=['exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','localhost','subscribe','agi','emit','error','projectUpdate','E_AGI_SERVER_ERROR'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x6a52,0x71));var _0x26a5=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x6a52[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0x26a5('0x0'));var EventEmitter=require(_0x26a5('0x1'))[_0x26a5('0x2')];var Redis=require(_0x26a5('0x3'));var AGIError=require(_0x26a5('0x4'));var config=require(_0x26a5('0x5'));config[_0x26a5('0x6')]=_[_0x26a5('0x7')](config[_0x26a5('0x6')],{'host':_0x26a5('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x26a5('0x6')]);sub[_0x26a5('0x9')](_0x26a5('0xa'),function(_0xa2805c){if(_0xa2805c)return eventEmitter[_0x26a5('0xb')](_0x26a5('0xc'),new AGIError('E_AGI_SERVER_ERROR',_0xa2805c));});sub['on']('message',function(_0xbffd72,_0x5a3717){if(_0xbffd72!==_0x26a5('0xa'))return;try{var _0x519fc2=JSON['parse'](_0x5a3717);eventEmitter['emit'](_0x26a5('0xd'),_0x519fc2);}catch(_0x1b0053){eventEmitter[_0x26a5('0xb')](_0x26a5('0xc'),new AGIError(_0x26a5('0xe'),_0x1b0053));}});module[_0x26a5('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xea8a=['agi','emit','error','message','parse','projectUpdate','E_AGI_SERVER_ERROR','events','ioredis','./error','../../config/environment','redis','defaults','subscribe'];(function(_0x473f82,_0x5548aa){var _0x21e916=function(_0x1a89b1){while(--_0x1a89b1){_0x473f82['push'](_0x473f82['shift']());}};_0x21e916(++_0x5548aa);}(_0xea8a,0xf5));var _0xaea8=function(_0x3edb5f,_0x1ddbc6){_0x3edb5f=_0x3edb5f-0x0;var _0x2e9515=_0xea8a[_0x3edb5f];return _0x2e9515;};'use strict';var _=require('lodash');var EventEmitter=require(_0xaea8('0x0'))['EventEmitter'];var Redis=require(_0xaea8('0x1'));var AGIError=require(_0xaea8('0x2'));var config=require(_0xaea8('0x3'));config[_0xaea8('0x4')]=_[_0xaea8('0x5')](config[_0xaea8('0x4')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xaea8('0x4')]);sub[_0xaea8('0x6')](_0xaea8('0x7'),function(_0x1e2ee0){if(_0x1e2ee0)return eventEmitter[_0xaea8('0x8')](_0xaea8('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x1e2ee0));});sub['on'](_0xaea8('0xa'),function(_0x2d28be,_0x4e92ae){if(_0x2d28be!==_0xaea8('0x7'))return;try{var _0x51523c=JSON[_0xaea8('0xb')](_0x4e92ae);eventEmitter[_0xaea8('0x8')](_0xaea8('0xc'),_0x51523c);}catch(_0x1272d7){eventEmitter[_0xaea8('0x8')](_0xaea8('0x9'),new AGIError(_0xaea8('0xd'),_0x1272d7));}});module['exports']={'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 20355b4..5a4715d 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 _0x6e85=['../../../config/logger','agi','menu','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','push','size','relations','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','vswitch','target','default','invalid','agicommand','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports'];(function(_0x287ec9,_0x57acd8){var _0x26bf98=function(_0x4783de){while(--_0x4783de){_0x287ec9['push'](_0x287ec9['shift']());}};_0x26bf98(++_0x57acd8);}(_0x6e85,0x15c));var _0x56e8=function(_0x4f81b9,_0x1d2314){_0x4f81b9=_0x4f81b9-0x0;var _0x2664b8=_0x6e85[_0x4f81b9];return _0x2664b8;};'use strict';var _=require('lodash');var logger=require(_0x56e8('0x0'))(_0x56e8('0x1'));var verticesWithRetry=[_0x56e8('0x2'),'getdigits',_0x56e8('0x3')];var Graph=function(){this[_0x56e8('0x4')]={};this[_0x56e8('0x5')]={};this[_0x56e8('0x6')]=0x0;};Graph[_0x56e8('0x7')][_0x56e8('0x8')]=function(_0x3aefc7){this[_0x56e8('0x4')][_0x3aefc7['id']]=_0x3aefc7;this[_0x56e8('0x5')][_0x3aefc7['id']]=[];};Graph[_0x56e8('0x7')]['addEdge']=function(_0xe0def7,_0x48cab7,_0x5e983d){this[_0x56e8('0x5')][_0xe0def7][_0x56e8('0x9')]({'target':_0x48cab7,'condition':_0x5e983d});this[_0x56e8('0x6')]+=0x1;};Graph[_0x56e8('0x7')][_0x56e8('0xa')]=function(){return _[_0x56e8('0xa')](this[_0x56e8('0x4')]);};Graph[_0x56e8('0x7')][_0x56e8('0xb')]=function(){return this[_0x56e8('0x6')];};Graph[_0x56e8('0x7')]['getVertex']=function(_0x553e84){return this[_0x56e8('0x4')][_0x553e84];};Graph[_0x56e8('0x7')][_0x56e8('0xc')]=function(_0x1ef60e,_0x705b70){if(!this[_0x56e8('0x4')][_0x1ef60e]){return logger['info'](_0x56e8('0xd'));}var _0x739a99=_0x705b70(this['vertices'][_0x1ef60e]);if(!_0x739a99){return logger[_0x56e8('0xe')](_0x56e8('0xf'));}if(this[_0x56e8('0x5')][_0x1ef60e][_0x56e8('0x10')]===0x0){return logger[_0x56e8('0xe')](_0x56e8('0x11'));}for(var _0x1ae50c=0x0,_0x23703f=[],_0x47963b=![];_0x1ae50c\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','indexOf','agi_','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','hangup','handleNotFound','handleUnpublished','initialize','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','finally','listening','connection','close','syncho','util','../../config/environment','../../config/logger','agi','./rpc','./project','EventEmitter','127.0.0.1','projectUpdate','stack','findIndex','splice','push','production','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','error','[%s]\x20%s','[ERROR]\x20%s','arg_1','calleridname','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x2e612b,_0x290af4){var _0x5aad14=function(_0x2cd899){while(--_0x2cd899){_0x2e612b['push'](_0x2e612b['shift']());}};_0x5aad14(++_0x290af4);}(_0xb46f,0xb3));var _0xfb46=function(_0x54125c,_0x1c9b8c){_0x54125c=_0x54125c-0x0;var _0x545c43=_0xb46f[_0x54125c];return _0x545c43;};'use strict';var _=require('lodash');var syncho=require(_0xfb46('0x0'));var util=require(_0xfb46('0x1'));var config=require(_0xfb46('0x2'));var logger=require(_0xfb46('0x3'))(_0xfb46('0x4'));var utilLicense=require('../../config/license/util');var rpc=require(_0xfb46('0x5'));var Project=require(_0xfb46('0x6'));var AGIEmitter=require('./events')[_0xfb46('0x7')];var projects=[];config['agi']=_['defaults'](config[_0xfb46('0x4')],{'ip':_0xfb46('0x8'),'port':0x11dd});AGIEmitter['on'](_0xfb46('0x9'),projectUpdateHandler);function connectionHandler(_0x5dcb8d){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x5dcb8d);agiHandler(_0x5dcb8d);}catch(_0x44bfb0){logger['error'](_0x44bfb0[_0xfb46('0xa')]);}});});}function projectUpdateHandler(_0x44564c){try{var _0xfe4f69=_[_0xfb46('0xb')](projects,['id',_0x44564c['id']]);if(_0xfe4f69>-0x1){if(_0x44564c['deleted']===!![]){projects[_0xfb46('0xc')](_0xfe4f69,0x1);}else{projects[_0xfe4f69]=_0x44564c;}}else{projects[_0xfb46('0xd')](_0x44564c);}}catch(_0x52943b){logger['error'](_0x52943b[_0xfb46('0xa')]);}}function listeningHandler(){var _0x1064e6=config['env']===_0xfb46('0xe')||![];console[_0xfb46('0xf')](_0xfb46('0x10'),config[_0xfb46('0x4')][_0xfb46('0x11')]);logger[_0xfb46('0x12')](util[_0xfb46('0x13')](_0xfb46('0x14'),_0x1064e6?config[_0xfb46('0x4')]['ip']:'host.docker.internal',config[_0xfb46('0x4')][_0xfb46('0x11')]));}function errorHandler(_0x2c1a9e){if(_0x2c1a9e&&_0x2c1a9e[_0xfb46('0x15')]&&_0x2c1a9e['message']){logger[_0xfb46('0x16')](util[_0xfb46('0x13')](_0xfb46('0x17'),_0x2c1a9e[_0xfb46('0x15')],_0x2c1a9e['message']));}else{logger['error'](util[_0xfb46('0x13')](_0xfb46('0x18'),_0x2c1a9e[_0xfb46('0xa')]));}}function closeHandler(){logger[_0xfb46('0x12')](util[_0xfb46('0x13')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xfb46('0x19')],this[_0xfb46('0x1a')],this['callerid'],this[_0xfb46('0x1b')],this['uniqueid']));try{createSquareReport(this);}catch(_0x398ce3){logger[_0xfb46('0x16')](_0x398ce3[_0xfb46('0xa')]);}}function timeoutHandler(){logger['info'](util['format'](_0xfb46('0x1c'),this['arg_1'],this[_0xfb46('0x1a')],this[_0xfb46('0x1d')],this[_0xfb46('0x1b')],this[_0xfb46('0x1e')]));}function hangupHandler(){logger['info'](util['format'](_0xfb46('0x1f'),this[_0xfb46('0x19')],this[_0xfb46('0x1a')],this['callerid'],this[_0xfb46('0x1b')],this['uniqueid']));this['evtHangup']=!![];}function createSquareReport(_0x55b30f,_0x38f08e){rpc['createSquareReport'](_0x55b30f)['then'](function(_0x44adca){if(_0x38f08e){_0x38f08e(null,_0x44adca);}})['catch'](function(_0x167fab){if(_0x38f08e){_0x38f08e(null,_0x167fab);}});}function setChannelVariables(_0x53b3b6){for(var _0x55f814 in _0x53b3b6){if(_0x53b3b6['hasOwnProperty'](_0x55f814)){if(_0x55f814[_0xfb46('0x20')](_0xfb46('0x21'))===0x0){_0x53b3b6[_0x55f814['substring'](0x4)]=_0x53b3b6[_0x55f814];delete _0x53b3b6[_0x55f814];}}}}function agiHandler(_0x56241a){logger[_0xfb46('0x22')]('variables',JSON[_0xfb46('0x23')](_0x56241a,null,0x2));logger[_0xfb46('0x12')](util['format'](_0xfb46('0x24'),_0x56241a['arg_1'],_0x56241a[_0xfb46('0x1a')],_0x56241a[_0xfb46('0x1d')],_0x56241a[_0xfb46('0x1b')],_0x56241a[_0xfb46('0x1e')]));_0x56241a['on']('error',errorHandler);_0x56241a['on']('close',closeHandler);_0x56241a['on']('timeout',timeoutHandler);_0x56241a['evtHangup']=![];_0x56241a['on'](_0xfb46('0x25'),hangupHandler);var _0x5a0d2e=_['find'](projects,['name',_0x56241a[_0xfb46('0x19')]]);if(!_0x5a0d2e)return Project[_0xfb46('0x26')](_0x56241a);if(!_0x5a0d2e[_0xfb46('0xe')])return Project[_0xfb46('0x27')](_0x56241a);return Project[_0xfb46('0x28')](_0x5a0d2e,_0x56241a);}function main(){var _0x3b57cf;return utilLicense[_0xfb46('0x29')]()[_0xfb46('0x2a')](function(_0x4b9ccf){if(!_0x4b9ccf)return;if(_0x4b9ccf[_0xfb46('0x2b')]){if(_0x4b9ccf[_0xfb46('0x2c')]&&_0x4b9ccf[_0xfb46('0x2c')]>0x0){logger[_0xfb46('0x12')](util[_0xfb46('0x13')]('[LICENSE]\x20CHANNELS:\x20%s',_0x4b9ccf['callysquare']));_0x3b57cf=_0x4b9ccf[_0xfb46('0x2c')];}else{logger[_0xfb46('0x12')](_0xfb46('0x2d'));}}else{logger[_0xfb46('0x12')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x3b57cf=-0x1;}})[_0xfb46('0x2a')](function(){return Project[_0xfb46('0x2e')]();})[_0xfb46('0x2a')](function(_0xeebb8d){projects=_0xeebb8d;return;})['catch'](function(_0x1f6108){logger[_0xfb46('0x16')](_0xfb46('0x2f'),_0x1f6108[_0xfb46('0xa')]);})[_0xfb46('0x30')](function(){var _0x526d8a=require('./server')(config['agi']['port'],config[_0xfb46('0x4')]['ip'],_0x3b57cf);_0x526d8a['on'](_0xfb46('0x16'),errorHandler);_0x526d8a['on'](_0xfb46('0x31'),listeningHandler);_0x526d8a['on'](_0xfb46('0x32'),connectionHandler);_0x526d8a['on'](_0xfb46('0x33'),closeHandler);});}main(); \ No newline at end of file +var _0x6fe0=['Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','format','name','[%s]\x20%s','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','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','indexOf','agi_','substring','debug','stringify','close','timeout','hangup','handleNotFound','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','./server','port','listening','connection','lodash','util','../../config/environment','../../config/license/util','./rpc','./events','EventEmitter','agi','defaults','127.0.0.1','projectUpdate','error','findIndex','deleted','splice','stack','production'];(function(_0x4f96ac,_0x18dc01){var _0x33bd52=function(_0x4081ee){while(--_0x4081ee){_0x4f96ac['push'](_0x4f96ac['shift']());}};_0x33bd52(++_0x18dc01);}(_0x6fe0,0x1b7));var _0x06fe=function(_0x5b8b97,_0x6b4dfa){_0x5b8b97=_0x5b8b97-0x0;var _0x1fdf84=_0x6fe0[_0x5b8b97];return _0x1fdf84;};'use strict';var _=require(_0x06fe('0x0'));var syncho=require('syncho');var util=require(_0x06fe('0x1'));var config=require(_0x06fe('0x2'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0x06fe('0x3'));var rpc=require(_0x06fe('0x4'));var Project=require('./project');var AGIEmitter=require(_0x06fe('0x5'))[_0x06fe('0x6')];var projects=[];config[_0x06fe('0x7')]=_[_0x06fe('0x8')](config[_0x06fe('0x7')],{'ip':_0x06fe('0x9'),'port':0x11dd});AGIEmitter['on'](_0x06fe('0xa'),projectUpdateHandler);function connectionHandler(_0x1b6400){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x1b6400);agiHandler(_0x1b6400);}catch(_0x2b7fbc){logger[_0x06fe('0xb')](_0x2b7fbc['stack']);}});});}function projectUpdateHandler(_0x1ceaf6){try{var _0x5f5a41=_[_0x06fe('0xc')](projects,['id',_0x1ceaf6['id']]);if(_0x5f5a41>-0x1){if(_0x1ceaf6[_0x06fe('0xd')]===!![]){projects[_0x06fe('0xe')](_0x5f5a41,0x1);}else{projects[_0x5f5a41]=_0x1ceaf6;}}else{projects['push'](_0x1ceaf6);}}catch(_0x32bc2b){logger[_0x06fe('0xb')](_0x32bc2b[_0x06fe('0xf')]);}}function listeningHandler(){var _0x493e58=config['env']===_0x06fe('0x10')||![];console['log'](_0x06fe('0x11'),config[_0x06fe('0x7')]['port']);logger['info'](util[_0x06fe('0x12')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',_0x493e58?config['agi']['ip']:'host.docker.internal',config['agi']['port']));}function errorHandler(_0x4852b3){if(_0x4852b3&&_0x4852b3[_0x06fe('0x13')]&&_0x4852b3['message']){logger[_0x06fe('0xb')](util[_0x06fe('0x12')](_0x06fe('0x14'),_0x4852b3[_0x06fe('0x13')],_0x4852b3['message']));}else{logger[_0x06fe('0xb')](util['format'](_0x06fe('0x15'),_0x4852b3[_0x06fe('0xf')]));}}function closeHandler(){logger[_0x06fe('0x16')](util[_0x06fe('0x12')](_0x06fe('0x17'),this[_0x06fe('0x18')],this[_0x06fe('0x19')],this[_0x06fe('0x1a')],this[_0x06fe('0x1b')],this[_0x06fe('0x1c')]));try{createSquareReport(this);}catch(_0x7b0d3a){logger[_0x06fe('0xb')](_0x7b0d3a[_0x06fe('0xf')]);}}function timeoutHandler(){logger['info'](util[_0x06fe('0x12')](_0x06fe('0x1d'),this[_0x06fe('0x18')],this[_0x06fe('0x19')],this[_0x06fe('0x1a')],this[_0x06fe('0x1b')],this['uniqueid']));}function hangupHandler(){logger[_0x06fe('0x16')](util[_0x06fe('0x12')](_0x06fe('0x1e'),this[_0x06fe('0x18')],this['calleridname'],this[_0x06fe('0x1a')],this[_0x06fe('0x1b')],this[_0x06fe('0x1c')]));this[_0x06fe('0x1f')]=!![];}function createSquareReport(_0x2e3441,_0x26bc9a){rpc[_0x06fe('0x20')](_0x2e3441)[_0x06fe('0x21')](function(_0x2cf4c4){if(_0x26bc9a){_0x26bc9a(null,_0x2cf4c4);}})[_0x06fe('0x22')](function(_0x203fe4){if(_0x26bc9a){_0x26bc9a(null,_0x203fe4);}});}function setChannelVariables(_0x338b11){for(var _0x4b6be7 in _0x338b11){if(_0x338b11['hasOwnProperty'](_0x4b6be7)){if(_0x4b6be7[_0x06fe('0x23')](_0x06fe('0x24'))===0x0){_0x338b11[_0x4b6be7[_0x06fe('0x25')](0x4)]=_0x338b11[_0x4b6be7];delete _0x338b11[_0x4b6be7];}}}}function agiHandler(_0x2adeff){logger[_0x06fe('0x26')]('variables',JSON[_0x06fe('0x27')](_0x2adeff,null,0x2));logger[_0x06fe('0x16')](util[_0x06fe('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2adeff['arg_1'],_0x2adeff['calleridname'],_0x2adeff[_0x06fe('0x1a')],_0x2adeff[_0x06fe('0x1b')],_0x2adeff[_0x06fe('0x1c')]));_0x2adeff['on']('error',errorHandler);_0x2adeff['on'](_0x06fe('0x28'),closeHandler);_0x2adeff['on'](_0x06fe('0x29'),timeoutHandler);_0x2adeff[_0x06fe('0x1f')]=![];_0x2adeff['on'](_0x06fe('0x2a'),hangupHandler);var _0x3b735b=_['find'](projects,[_0x06fe('0x13'),_0x2adeff[_0x06fe('0x18')]]);if(!_0x3b735b)return Project[_0x06fe('0x2b')](_0x2adeff);if(!_0x3b735b[_0x06fe('0x10')])return Project[_0x06fe('0x2c')](_0x2adeff);return Project[_0x06fe('0x2d')](_0x3b735b,_0x2adeff);}function main(){var _0x2ee66d;return utilLicense[_0x06fe('0x2e')]()[_0x06fe('0x21')](function(_0x231a0a){if(!_0x231a0a)return;if(_0x231a0a[_0x06fe('0x2f')]){if(_0x231a0a['callysquare']&&_0x231a0a[_0x06fe('0x30')]>0x0){logger[_0x06fe('0x16')](util[_0x06fe('0x12')]('[LICENSE]\x20CHANNELS:\x20%s',_0x231a0a[_0x06fe('0x30')]));_0x2ee66d=_0x231a0a['callysquare'];}else{logger[_0x06fe('0x16')](_0x06fe('0x31'));}}else{logger[_0x06fe('0x16')](_0x06fe('0x32'));_0x2ee66d=-0x1;}})[_0x06fe('0x21')](function(){return Project['getAll']();})[_0x06fe('0x21')](function(_0x2db100){projects=_0x2db100;return;})[_0x06fe('0x22')](function(_0x1f553f){logger[_0x06fe('0xb')](_0x06fe('0x33'),_0x1f553f[_0x06fe('0xf')]);})[_0x06fe('0x34')](function(){var _0x4a7408=require(_0x06fe('0x35'))(config[_0x06fe('0x7')][_0x06fe('0x36')],config[_0x06fe('0x7')]['ip'],_0x2ee66d);_0x4a7408['on'](_0x06fe('0xb'),errorHandler);_0x4a7408['on'](_0x06fe('0x37'),listeningHandler);_0x4a7408['on'](_0x06fe('0x38'),connectionHandler);_0x4a7408['on'](_0x06fe('0x28'),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 2592edc..7356f79 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 _0xcec3=['then','error','message','result','sendMailMessage','SendMail','bluebird','jayson/promise','client','http'];(function(_0x1b85b0,_0x1fa8ef){var _0x282b35=function(_0x33c98a){while(--_0x33c98a){_0x1b85b0['push'](_0x1b85b0['shift']());}};_0x282b35(++_0x1fa8ef);}(_0xcec3,0x1c8));var _0x3cec=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xcec3[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0x3cec('0x0'));var jayson=require(_0x3cec('0x1'));var client=jayson[_0x3cec('0x2')][_0x3cec('0x3')]({'port':0x232b});function request(_0x157fbe,_0x1ec33c){return new BPromise(function(_0x350565,_0xcf78df){return client['request'](_0x157fbe,_0x1ec33c)[_0x3cec('0x4')](function(_0x23fe29){if(_0x23fe29['error']){return _0xcf78df(_0x23fe29[_0x3cec('0x5')][_0x3cec('0x6')]);}else{return _0x350565(_0x23fe29[_0x3cec('0x7')]);}})['catch'](function(_0x23f585){return _0xcf78df(_0x23f585);});});}exports[_0x3cec('0x8')]=function(_0x13a03e,_0x3b7a8d){return request(_0x3cec('0x9'),{'account':_0x13a03e,'message':_0x3b7a8d});}; \ No newline at end of file +var _0x215e=['SendMail','bluebird','jayson/promise','client','http','request','then','error','message','sendMailMessage'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x215e,0x17d));var _0xe215=function(_0xf64630,_0x49a48b){_0xf64630=_0xf64630-0x0;var _0x206ea9=_0x215e[_0xf64630];return _0x206ea9;};'use strict';var BPromise=require(_0xe215('0x0'));var jayson=require(_0xe215('0x1'));var client=jayson[_0xe215('0x2')][_0xe215('0x3')]({'port':0x232b});function request(_0x359d11,_0x216f23){return new BPromise(function(_0x5539b4,_0x5c82b7){return client[_0xe215('0x4')](_0x359d11,_0x216f23)[_0xe215('0x5')](function(_0x427503){if(_0x427503[_0xe215('0x6')]){return _0x5c82b7(_0x427503['error'][_0xe215('0x7')]);}else{return _0x5539b4(_0x427503['result']);}})['catch'](function(_0x19c74e){return _0x5c82b7(_0x19c74e);});});}exports[_0xe215('0x8')]=function(_0x598ab4,_0x2a2019){return request(_0xe215('0x9'),{'account':_0x598ab4,'message':_0x2a2019});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 5500608..ace1c02 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 _0x897a=['retry','addVertex','omit','mxCell','isArray','length','source','addEdge','value','toJson','root','inspect','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','error','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','continueAt','exports','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','maxRetry'];(function(_0x433248,_0x2e5dc1){var _0x471972=function(_0xad50e6){while(--_0xad50e6){_0x433248['push'](_0x433248['shift']());}};_0x471972(++_0x2e5dc1);}(_0x897a,0xaf));var _0xa897=function(_0x4a1196,_0x2cbc4d){_0x4a1196=_0x4a1196-0x0;var _0x12e02d=_0x897a[_0x4a1196];return _0x12e02d;};'use strict';var _=require('lodash');var moment=require(_0xa897('0x0'));var parser=require(_0xa897('0x1'));var util=require(_0xa897('0x2'));var logger=require(_0xa897('0x3'))(_0xa897('0x4'));var rpc=require(_0xa897('0x5'));var mailRpc=require(_0xa897('0x6'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xa897('0x7')]()[_0xa897('0x8')](function(_0x5a0209){logger['error'](_0xa897('0x9'),_0x5a0209[_0xa897('0xa')]);return[];});}function addVertex(_0xf027c5,_0x39cd7d,_0xd4f953){_0x39cd7d[_0xa897('0xb')]=_0xd4f953;if(_0x39cd7d[_0xa897('0xc')]('retry')){_0x39cd7d[_0xa897('0xd')]=parseInt(_0x39cd7d[_0xa897('0xe')],0xa);}_0xf027c5[_0xa897('0xf')](_[_0xa897('0x10')](_0x39cd7d,_0xa897('0x11')));}function initGraph(_0x29c1de,_0x30be26){var _0x3c0349=new Graph();for(var _0x4cb8db in _0x29c1de){if(_0x29c1de['hasOwnProperty'](_0x4cb8db)){if(_[_0xa897('0x12')](_0x29c1de[_0x4cb8db])){for(var _0x281125=0x0;_0x281125<_0x29c1de[_0x4cb8db]['length'];_0x281125+=0x1){addVertex(_0x3c0349,_0x29c1de[_0x4cb8db][_0x281125],_0x4cb8db);}}else{addVertex(_0x3c0349,_0x29c1de[_0x4cb8db],_0x4cb8db);}}}for(var _0x4661cb=0x0;_0x4661cb<_0x30be26[_0xa897('0x13')];_0x4661cb+=0x1){if(_0x30be26[_0x4661cb][_0xa897('0x14')]&&_0x30be26[_0x4661cb]['target']){_0x3c0349[_0xa897('0x15')](_0x30be26[_0x4661cb][_0xa897('0x14')],_0x30be26[_0x4661cb]['target'],_0x30be26[_0x4661cb][_0xa897('0x16')]);}}return _0x3c0349;}function getRoot(_0x5131cf){return parser[_0xa897('0x17')](_0x5131cf,{'object':!![]})['mxGraphModel'][_0xa897('0x18')];}function inspect(_0x16ebe6){return util[_0xa897('0x19')](_0x16ebe6,{'showHidden':![],'depth':null});}function initialize(_0x1eaecf,_0x48498e){var _0x3bb164=getRoot(_0x1eaecf['production']);if(!_0x3bb164||!_0x3bb164[_0xa897('0x1a')])return;var _0x3c7ed8,_0x556c2a,_0x3b67b6;logger[_0xa897('0x1b')](_0xa897('0x18'),JSON[_0xa897('0x1c')](_0x3bb164,null,0x2));_0x48498e[_0xa897('0x1d')]=moment()[_0xa897('0x1e')](_0xa897('0x1f'));_0x3c7ed8=initGraph(_[_0xa897('0x10')](_0x3bb164,_0xa897('0x11')),_0x3bb164['mxCell']);_0x556c2a=new Vertices(_0x48498e,rpc,mailRpc);logger[_0xa897('0x20')](util['format'](_0xa897('0x21'),_0x48498e[_0xa897('0x22')],_0x48498e[_0xa897('0x23')],_0x48498e[_0xa897('0x24')],_0x48498e[_0xa897('0x25')],_0x48498e[_0xa897('0x26')]));_0x3c7ed8[_0xa897('0x27')](_0x3bb164[_0xa897('0x1a')]['id'],function(_0x3a948e){try{_0x3a948e=_0x556c2a[_0xa897('0x28')](_0x3a948e);logger['debug']('vertex',JSON[_0xa897('0x1c')](_0x3a948e,null,0x2));if(_0x3a948e[_0xa897('0xb')]===_0xa897('0x29')){logger[_0xa897('0x20')](_0xa897('0x2a'));_0x48498e[_0xa897('0x2b')]=_0x3a948e['context']||_0x48498e['context'];_0x48498e[_0xa897('0x2c')]=_0x3a948e[_0xa897('0x2c')];_0x48498e[_0xa897('0x2d')]=_0x3a948e[_0xa897('0x2d')]?_0x3a948e['priority']-0x1:0x1;return null;}else if(_0x3a948e&&_0x556c2a[_0x3a948e[_0xa897('0xb')]]){_0x3b67b6=_0x556c2a[_0x3a948e[_0xa897('0xb')]](_0x3a948e);logger['info'](_0xa897('0x2e'),JSON[_0xa897('0x1c')](_0x3b67b6,null,0x2));if(_0x3b67b6&&_0x3b67b6[_0xa897('0x2f')]===AGI_CODE_SUCCESS&&_0x3b67b6[_0xa897('0x30')]!==AGI_RESULT_ERROR&&!_0x48498e[_0xa897('0x31')]){logger[_0xa897('0x1b')](_0xa897('0x2e'),inspect(_0x3b67b6));return _[_0xa897('0x32')](_0x3b67b6[_0xa897('0x30')])?null:_0x3b67b6[_0xa897('0x30')][_0xa897('0x33')]();}else{logger['error'](_0xa897('0x2e'),inspect(_0x3b67b6));return null;}}else{logger[_0xa897('0x34')]('agicommand\x20not\x20found');return null;}}catch(_0x519a68){logger['error'](_0x519a68[_0xa897('0xa')]);return null;}});if(_0x3bb164[_0xa897('0x35')]){logger['info'](util[_0xa897('0x1e')](_0xa897('0x36'),_0x48498e[_0xa897('0x22')],_0x48498e[_0xa897('0x23')],_0x48498e[_0xa897('0x24')],_0x48498e[_0xa897('0x25')],_0x48498e[_0xa897('0x26')]));_0x3c7ed8['traverseBFS'](_0x3bb164[_0xa897('0x35')]['id'],function(_0x585af8){try{_0x585af8=_0x556c2a[_0xa897('0x28')](_0x585af8);logger[_0xa897('0x1b')]('vertex',JSON['stringify'](_0x585af8,null,0x2));if(_0x585af8&&_0x556c2a[_0x585af8[_0xa897('0xb')]]){_0x3b67b6=_0x556c2a[_0x585af8[_0xa897('0xb')]](_0x585af8);if(_0x3b67b6){logger[_0xa897('0x1b')](_0xa897('0x2e'),inspect(_0x3b67b6));return _[_0xa897('0x32')](_0x3b67b6['result'])?null:_0x3b67b6['result'][_0xa897('0x33')]();}else{logger[_0xa897('0x34')](_0xa897('0x2e'),inspect(_0x3b67b6));return null;}}else{logger[_0xa897('0x34')](_0xa897('0x37'));return null;}}catch(_0x32057b){logger[_0xa897('0x34')](_0x32057b[_0xa897('0xa')]);return null;}});}logger[_0xa897('0x20')](util[_0xa897('0x1e')](_0xa897('0x38'),_0x48498e[_0xa897('0x22')],_0x48498e[_0xa897('0x23')],_0x48498e[_0xa897('0x24')],_0x48498e['dnid'],_0x48498e[_0xa897('0x26')]));logger[_0xa897('0x20')](util[_0xa897('0x1e')](_0xa897('0x39'),_0x48498e['context'],_0x48498e[_0xa897('0x2c')],parseInt(_0x48498e[_0xa897('0x2d')],0xa)+0x1));_0x48498e['continueAt'](_0x48498e['context'],_0x48498e['extension'],parseInt(_0x48498e[_0xa897('0x2d')],0xa)+0x1);_0x48498e[_0xa897('0x3a')]();}function handleNotFound(_0x111ab2){logger[_0xa897('0x34')](util['format'](_0xa897('0x3b'),_0x111ab2['arg_1']));_0x111ab2['continueAt'](_0x111ab2[_0xa897('0x2b')],_0x111ab2[_0xa897('0x2c')],parseInt(_0x111ab2[_0xa897('0x2d')],0xa)+0x1);_0x111ab2[_0xa897('0x3a')]();}function handleUnpublished(_0x54c1b0){logger[_0xa897('0x34')](util['format'](_0xa897('0x3c'),_0x54c1b0[_0xa897('0x22')]));_0x54c1b0[_0xa897('0x3d')](_0x54c1b0[_0xa897('0x2b')],_0x54c1b0['extension'],parseInt(_0x54c1b0['priority'],0xa)+0x1);_0x54c1b0[_0xa897('0x3a')]();}module[_0xa897('0x3e')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xd890=['mxGraphModel','root','inspect','production','start','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','clear','vertex','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','debug','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','traverseBFS','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','lodash','moment','xml2json','util','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','stack','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','isArray','length','target','addEdge','source','value','toJson'];(function(_0x18ad31,_0x269e24){var _0x342a75=function(_0x595087){while(--_0x595087){_0x18ad31['push'](_0x18ad31['shift']());}};_0x342a75(++_0x269e24);}(_0xd890,0x1a5));var _0x0d89=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0xd890[_0x3da832];return _0xe602f2;};'use strict';var _=require(_0x0d89('0x0'));var moment=require(_0x0d89('0x1'));var parser=require(_0x0d89('0x2'));var util=require(_0x0d89('0x3'));var logger=require('../../config/logger')(_0x0d89('0x4'));var rpc=require(_0x0d89('0x5'));var mailRpc=require(_0x0d89('0x6'));var Graph=require(_0x0d89('0x7'));var Vertices=require(_0x0d89('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x0d89('0x9')]()[_0x0d89('0xa')](function(_0x3146f9){logger[_0x0d89('0xb')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x3146f9[_0x0d89('0xc')]);return[];});}function addVertex(_0x8e8e69,_0x51fe0e,_0xa63c53){_0x51fe0e[_0x0d89('0xd')]=_0xa63c53;if(_0x51fe0e[_0x0d89('0xe')]('retry')){_0x51fe0e[_0x0d89('0xf')]=parseInt(_0x51fe0e[_0x0d89('0x10')],0xa);}_0x8e8e69[_0x0d89('0x11')](_[_0x0d89('0x12')](_0x51fe0e,_0x0d89('0x13')));}function initGraph(_0x2e14c7,_0x1b2423){var _0x39d08a=new Graph();for(var _0x30e398 in _0x2e14c7){if(_0x2e14c7[_0x0d89('0xe')](_0x30e398)){if(_[_0x0d89('0x14')](_0x2e14c7[_0x30e398])){for(var _0x610f43=0x0;_0x610f43<_0x2e14c7[_0x30e398][_0x0d89('0x15')];_0x610f43+=0x1){addVertex(_0x39d08a,_0x2e14c7[_0x30e398][_0x610f43],_0x30e398);}}else{addVertex(_0x39d08a,_0x2e14c7[_0x30e398],_0x30e398);}}}for(var _0x20a4a2=0x0;_0x20a4a2<_0x1b2423[_0x0d89('0x15')];_0x20a4a2+=0x1){if(_0x1b2423[_0x20a4a2]['source']&&_0x1b2423[_0x20a4a2][_0x0d89('0x16')]){_0x39d08a[_0x0d89('0x17')](_0x1b2423[_0x20a4a2][_0x0d89('0x18')],_0x1b2423[_0x20a4a2]['target'],_0x1b2423[_0x20a4a2][_0x0d89('0x19')]);}}return _0x39d08a;}function getRoot(_0x411d04){return parser[_0x0d89('0x1a')](_0x411d04,{'object':!![]})[_0x0d89('0x1b')][_0x0d89('0x1c')];}function inspect(_0x357eed){return util[_0x0d89('0x1d')](_0x357eed,{'showHidden':![],'depth':null});}function initialize(_0x4dab39,_0x4a4d50){var _0x9b8d10=getRoot(_0x4dab39[_0x0d89('0x1e')]);if(!_0x9b8d10||!_0x9b8d10[_0x0d89('0x1f')])return;var _0x332fb7,_0x285fb1,_0x483c50;logger['debug'](_0x0d89('0x1c'),JSON[_0x0d89('0x20')](_0x9b8d10,null,0x2));_0x4a4d50[_0x0d89('0x21')]=moment()[_0x0d89('0x22')](_0x0d89('0x23'));_0x332fb7=initGraph(_[_0x0d89('0x12')](_0x9b8d10,'mxCell'),_0x9b8d10[_0x0d89('0x13')]);_0x285fb1=new Vertices(_0x4a4d50,rpc,mailRpc);logger['info'](util[_0x0d89('0x22')](_0x0d89('0x24'),_0x4a4d50[_0x0d89('0x25')],_0x4a4d50[_0x0d89('0x26')],_0x4a4d50['callerid'],_0x4a4d50['dnid'],_0x4a4d50[_0x0d89('0x27')]));_0x332fb7['traverseBFS'](_0x9b8d10['start']['id'],function(_0x20830b){try{_0x20830b=_0x285fb1[_0x0d89('0x28')](_0x20830b);logger['debug'](_0x0d89('0x29'),JSON['stringify'](_0x20830b,null,0x2));if(_0x20830b['agicommand']==='gotoc'){logger[_0x0d89('0x2a')](_0x0d89('0x2b'));_0x4a4d50[_0x0d89('0x2c')]=_0x20830b['context']||_0x4a4d50[_0x0d89('0x2c')];_0x4a4d50[_0x0d89('0x2d')]=_0x20830b[_0x0d89('0x2d')];_0x4a4d50[_0x0d89('0x2e')]=_0x20830b[_0x0d89('0x2e')]?_0x20830b[_0x0d89('0x2e')]-0x1:0x1;return null;}else if(_0x20830b&&_0x285fb1[_0x20830b[_0x0d89('0xd')]]){_0x483c50=_0x285fb1[_0x20830b[_0x0d89('0xd')]](_0x20830b);logger[_0x0d89('0x2a')](_0x0d89('0x2f'),JSON[_0x0d89('0x20')](_0x483c50,null,0x2));if(_0x483c50&&_0x483c50['code']===AGI_CODE_SUCCESS&&_0x483c50[_0x0d89('0x30')]!==AGI_RESULT_ERROR&&!_0x4a4d50[_0x0d89('0x31')]){logger[_0x0d89('0x32')]('response',inspect(_0x483c50));return _['isUndefined'](_0x483c50[_0x0d89('0x30')])?null:_0x483c50[_0x0d89('0x30')][_0x0d89('0x33')]();}else{logger[_0x0d89('0xb')](_0x0d89('0x2f'),inspect(_0x483c50));return null;}}else{logger[_0x0d89('0xb')](_0x0d89('0x34'));return null;}}catch(_0x35299b){logger[_0x0d89('0xb')](_0x35299b[_0x0d89('0xc')]);return null;}});if(_0x9b8d10[_0x0d89('0x35')]){logger[_0x0d89('0x2a')](util[_0x0d89('0x22')](_0x0d89('0x36'),_0x4a4d50['arg_1'],_0x4a4d50[_0x0d89('0x26')],_0x4a4d50[_0x0d89('0x37')],_0x4a4d50['dnid'],_0x4a4d50[_0x0d89('0x27')]));_0x332fb7[_0x0d89('0x38')](_0x9b8d10[_0x0d89('0x35')]['id'],function(_0x554d3c){try{_0x554d3c=_0x285fb1[_0x0d89('0x28')](_0x554d3c);logger['debug'](_0x0d89('0x29'),JSON[_0x0d89('0x20')](_0x554d3c,null,0x2));if(_0x554d3c&&_0x285fb1[_0x554d3c[_0x0d89('0xd')]]){_0x483c50=_0x285fb1[_0x554d3c[_0x0d89('0xd')]](_0x554d3c);if(_0x483c50){logger[_0x0d89('0x32')](_0x0d89('0x2f'),inspect(_0x483c50));return _['isUndefined'](_0x483c50[_0x0d89('0x30')])?null:_0x483c50[_0x0d89('0x30')][_0x0d89('0x33')]();}else{logger[_0x0d89('0xb')](_0x0d89('0x2f'),inspect(_0x483c50));return null;}}else{logger['error'](_0x0d89('0x34'));return null;}}catch(_0x1528bf){logger[_0x0d89('0xb')](_0x1528bf['stack']);return null;}});}logger[_0x0d89('0x2a')](util[_0x0d89('0x22')](_0x0d89('0x39'),_0x4a4d50[_0x0d89('0x25')],_0x4a4d50[_0x0d89('0x26')],_0x4a4d50[_0x0d89('0x37')],_0x4a4d50[_0x0d89('0x3a')],_0x4a4d50[_0x0d89('0x27')]));logger[_0x0d89('0x2a')](util[_0x0d89('0x22')](_0x0d89('0x3b'),_0x4a4d50[_0x0d89('0x2c')],_0x4a4d50[_0x0d89('0x2d')],parseInt(_0x4a4d50['priority'],0xa)+0x1));_0x4a4d50[_0x0d89('0x3c')](_0x4a4d50['context'],_0x4a4d50[_0x0d89('0x2d')],parseInt(_0x4a4d50[_0x0d89('0x2e')],0xa)+0x1);_0x4a4d50[_0x0d89('0x3d')]();}function handleNotFound(_0x345306){logger[_0x0d89('0xb')](util['format'](_0x0d89('0x3e'),_0x345306[_0x0d89('0x25')]));_0x345306[_0x0d89('0x3c')](_0x345306['context'],_0x345306[_0x0d89('0x2d')],parseInt(_0x345306[_0x0d89('0x2e')],0xa)+0x1);_0x345306['close']();}function handleUnpublished(_0xf4a169){logger['error'](util['format'](_0x0d89('0x3f'),_0xf4a169[_0x0d89('0x25')]));_0xf4a169[_0x0d89('0x3c')](_0xf4a169[_0x0d89('0x2c')],_0xf4a169['extension'],parseInt(_0xf4a169[_0x0d89('0x2e')],0xa)+0x1);_0xf4a169[_0x0d89('0x3d')]();}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 e6256ce..dbbf137 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 _0x2fd7=['emit','line','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','_transform','toString','substring','length','split','indexOf','slice','trim'];(function(_0x3effbe,_0x1b2020){var _0x27d525=function(_0x55eb5d){while(--_0x55eb5d){_0x3effbe['push'](_0x3effbe['shift']());}};_0x27d525(++_0x1b2020);}(_0x2fd7,0x18f));var _0x72fd=function(_0x4cffe9,_0x38593f){_0x4cffe9=_0x4cffe9-0x0;var _0x244581=_0x2fd7[_0x4cffe9];return _0x244581;};'use strict';var util=require(_0x72fd('0x0'));var Transform=require(_0x72fd('0x1'))[_0x72fd('0x2')];function AGIReply(_0x23738e){Transform[_0x72fd('0x3')](this,_0x23738e);this[_0x72fd('0x4')]='';this[_0x72fd('0x5')]=![];}util[_0x72fd('0x6')](AGIReply,Transform);AGIReply['prototype'][_0x72fd('0x7')]=function(_0x46a273,_0x5b6133,_0x5bcf59){var _0x25713f='\x0a',_0x2b6f60=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x3e2810=-0x1,_0x234fc5=-0x1,_0x59c707='',_0x56b21a=0x0,_0x14afc5='',_0x2e1541='';this[_0x72fd('0x4')]+=_0x46a273[_0x72fd('0x8')]();_0x14afc5=this[_0x72fd('0x4')];if(!this[_0x72fd('0x5')]){_0x56b21a=0x0;while(_0x2b6f60[_0x56b21a]){while((_0x234fc5=_0x14afc5['indexOf'](_0x2b6f60[_0x56b21a]))!=-0x1){_0x59c707=_0x2b6f60[_0x56b21a];_0x2e1541=_0x14afc5['substring'](0x0,_0x234fc5);_0x14afc5=_0x14afc5[_0x72fd('0x9')](_0x234fc5+_0x59c707[_0x72fd('0xa')]);var _0x23fabb=_0x2e1541[_0x72fd('0xb')](_0x25713f),_0x16ac96=0x0,_0x32fa1b={},_0x4d88d8='',_0x13f4fb='',_0x371c19=-0x1;while(_0x23fabb[_0x16ac96]){_0x371c19=_0x23fabb[_0x16ac96][_0x72fd('0xc')](':');if(_0x371c19!=-0x1){_0x4d88d8=_0x23fabb[_0x16ac96][_0x72fd('0xd')](0x0,_0x371c19)['trim']();_0x13f4fb=_0x23fabb[_0x16ac96][_0x72fd('0xd')](_0x371c19+0x1)[_0x72fd('0xe')]();if(_0x4d88d8[_0x72fd('0xa')]>0x0){_0x32fa1b[_0x4d88d8]=_0x13f4fb;}}else{}_0x16ac96++;}this[_0x72fd('0xf')]('headers',_0x32fa1b);this[_0x72fd('0x5')]=!![];}_0x56b21a++;}this[_0x72fd('0x4')]=_0x14afc5;}else{while((_0x3e2810=_0x14afc5[_0x72fd('0xc')](_0x25713f))!=-0x1){_0x2e1541=_0x14afc5[_0x72fd('0x9')](0x0,_0x3e2810);this[_0x72fd('0xf')](_0x72fd('0x10'),_0x2e1541);_0x14afc5=_0x14afc5['substring'](_0x3e2810+_0x25713f[_0x72fd('0xa')]);}this[_0x72fd('0x4')]=_0x14afc5;}_0x5bcf59();};module[_0x72fd('0x11')]=AGIReply; \ No newline at end of file +var _0x0924=['slice','emit','headers','_inBody','length','exports','util','stream','Transform','call','_localBuffer','inherits','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','split','trim'];(function(_0x330447,_0x212c01){var _0x4c6cba=function(_0x28cfd1){while(--_0x28cfd1){_0x330447['push'](_0x330447['shift']());}};_0x4c6cba(++_0x212c01);}(_0x0924,0x110));var _0x4092=function(_0x258fb5,_0x47c7f5){_0x258fb5=_0x258fb5-0x0;var _0x124437=_0x0924[_0x258fb5];return _0x124437;};'use strict';var util=require(_0x4092('0x0'));var Transform=require(_0x4092('0x1'))[_0x4092('0x2')];function AGIReply(_0xf22b35){Transform[_0x4092('0x3')](this,_0xf22b35);this[_0x4092('0x4')]='';this['_inBody']=![];}util[_0x4092('0x5')](AGIReply,Transform);AGIReply['prototype'][_0x4092('0x6')]=function(_0x5b3afb,_0x2d05ea,_0x107701){var _0x1acb9a='\x0a',_0x2b29a6=['\x0a\x0a',_0x4092('0x7')],_0x5b49df=-0x1,_0x1b8ad5=-0x1,_0x5756e2='',_0x4497d6=0x0,_0x2d32a2='',_0x33c756='';this[_0x4092('0x4')]+=_0x5b3afb[_0x4092('0x8')]();_0x2d32a2=this['_localBuffer'];if(!this['_inBody']){_0x4497d6=0x0;while(_0x2b29a6[_0x4497d6]){while((_0x1b8ad5=_0x2d32a2[_0x4092('0x9')](_0x2b29a6[_0x4497d6]))!=-0x1){_0x5756e2=_0x2b29a6[_0x4497d6];_0x33c756=_0x2d32a2[_0x4092('0xa')](0x0,_0x1b8ad5);_0x2d32a2=_0x2d32a2[_0x4092('0xa')](_0x1b8ad5+_0x5756e2['length']);var _0x44a599=_0x33c756[_0x4092('0xb')](_0x1acb9a),_0x5de864=0x0,_0x603a8e={},_0x305a41='',_0x5d58ee='',_0x5dcee6=-0x1;while(_0x44a599[_0x5de864]){_0x5dcee6=_0x44a599[_0x5de864][_0x4092('0x9')](':');if(_0x5dcee6!=-0x1){_0x305a41=_0x44a599[_0x5de864]['slice'](0x0,_0x5dcee6)[_0x4092('0xc')]();_0x5d58ee=_0x44a599[_0x5de864][_0x4092('0xd')](_0x5dcee6+0x1)[_0x4092('0xc')]();if(_0x305a41['length']>0x0){_0x603a8e[_0x305a41]=_0x5d58ee;}}else{}_0x5de864++;}this[_0x4092('0xe')](_0x4092('0xf'),_0x603a8e);this[_0x4092('0x10')]=!![];}_0x4497d6++;}this[_0x4092('0x4')]=_0x2d32a2;}else{while((_0x5b49df=_0x2d32a2[_0x4092('0x9')](_0x1acb9a))!=-0x1){_0x33c756=_0x2d32a2[_0x4092('0xa')](0x0,_0x5b49df);this[_0x4092('0xe')]('line',_0x33c756);_0x2d32a2=_0x2d32a2[_0x4092('0xa')](_0x5b49df+_0x1acb9a[_0x4092('0x11')]);}this[_0x4092('0x4')]=_0x2d32a2;}_0x107701();};module[_0x4092('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 5e740ae..ec54b72 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 _0xb2b3=['error','message','result','catch','getSquareProjects','GetSquareProjects','production','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','name','getVoiceQueueById','ShowVoiceQueue','ShowVariable','dsn','getUserById','GetContactByPhone','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','lodash','moment','jayson/promise','client','http','request','then'];(function(_0x332268,_0x19b054){var _0x254fde=function(_0x3d70b3){while(--_0x3d70b3){_0x332268['push'](_0x332268['shift']());}};_0x254fde(++_0x19b054);}(_0xb2b3,0x71));var _0x3b2b=function(_0x1d7d3d,_0x3ce41a){_0x1d7d3d=_0x1d7d3d-0x0;var _0x271a42=_0xb2b3[_0x1d7d3d];return _0x271a42;};'use strict';var _=require(_0x3b2b('0x0'));var moment=require(_0x3b2b('0x1'));var jayson=require(_0x3b2b('0x2'));var client=jayson[_0x3b2b('0x3')][_0x3b2b('0x4')]({'port':0x2329});function request(_0x3de73b,_0x2059f0){return new Promise(function(_0x4dad94,_0x3eff63){return client[_0x3b2b('0x5')](_0x3de73b,_0x2059f0)[_0x3b2b('0x6')](function(_0x45e179){if(_0x45e179[_0x3b2b('0x7')]){return _0x3eff63(_0x45e179[_0x3b2b('0x7')][_0x3b2b('0x8')]);}else{return _0x4dad94(_0x45e179[_0x3b2b('0x9')]);}})[_0x3b2b('0xa')](function(_0x3ec416){return _0x3eff63(_0x3ec416);});});}exports[_0x3b2b('0xb')]=function(){return request(_0x3b2b('0xc'),{'options':{'raw':![],'attributes':['id','name',_0x3b2b('0xd')]}});};exports[_0x3b2b('0xe')]=function(_0xd2f168){return request(_0x3b2b('0xf'),{'options':{'raw':![],'where':{'name':_0xd2f168},'attributes':[_0x3b2b('0xd')]}});};exports[_0x3b2b('0x10')]=function(_0x4e66fe){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x4e66fe},'include':[{'model':_0x3b2b('0x11'),'as':_0x3b2b('0x12'),'include':[{'model':_0x3b2b('0x13'),'as':_0x3b2b('0x13')}]}],'attributes':['id','name',_0x3b2b('0x14')],'smtp':!![]}});};exports[_0x3b2b('0x15')]=function(_0x23b81b){return request(_0x3b2b('0xf'),{'options':{'where':{'id':_0x23b81b},'attributes':[_0x3b2b('0x16')]}});};exports[_0x3b2b('0x17')]=function(_0x52b63f){return request(_0x3b2b('0x18'),{'options':{'where':{'id':_0x52b63f},'attributes':[_0x3b2b('0x16')]}});};exports['getVariableById']=function(_0x3224ec){return request(_0x3b2b('0x19'),{'options':{'where':{'id':_0x3224ec},'attributes':[_0x3b2b('0x16')]}});};exports['getSquareOdbcById']=function(_0x2ab175){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2ab175},'attributes':[_0x3b2b('0x1a')]}});};exports[_0x3b2b('0x1b')]=function(_0x57a2b4){return request('ShowUser',{'options':{'where':{'id':_0x57a2b4},'attributes':[_0x3b2b('0x16')]}});};exports['getContactByPhone']=function(_0x157155){return request(_0x3b2b('0x1c'),{'options':{'where':{'phone':_0x157155['phone']},'attributes':['id']}});};exports[_0x3b2b('0x1d')]=function(_0x4ff5e3){return request(_0x3b2b('0x1e'),{'options':{'where':{'id':_0x4ff5e3},'attributes':[_0x3b2b('0x16')]}});};exports['getSoundById']=function(_0x59abc3){return request(_0x3b2b('0x1f'),{'options':{'where':{'id':_0x59abc3},'attributes':[_0x3b2b('0x20')]}});};exports[_0x3b2b('0x21')]=function(_0x46db63){return request(_0x3b2b('0x22'),{'options':{'raw':![],'where':{'id':_0x46db63},'include':[{'model':_0x3b2b('0x23'),'as':_0x3b2b('0x24')}]}});};exports[_0x3b2b('0x25')]=function(_0x1273e7){return request(_0x3b2b('0x26'),{'options':{'where':{'id':_0x1273e7},'attributes':['id',_0x3b2b('0x16')]}});};exports['createSmsMessage']=function(_0x20c1bc){return request(_0x3b2b('0x27'),{'body':_0x20c1bc});};exports[_0x3b2b('0x28')]=function(_0x50e95c){return request(_0x3b2b('0x29'),{'body':_0x50e95c});};exports['createSquareReport']=function(_0x19f358){return request('CreateSquareReport',{'body':_[_0x3b2b('0x2a')](_0x19f358,{'project_name':_0x19f358['arg_1'],'prev_project_name':_0x19f358['arg_2']||'','is_subproject':_0x19f358[_0x3b2b('0x2b')]?!![]:![],'leaveAt':moment()[_0x3b2b('0x2c')](_0x3b2b('0x2d'))})});};exports[_0x3b2b('0x2e')]=function(_0x73967){return request(_0x3b2b('0x2f'),{'body':_0x73967});};exports[_0x3b2b('0x30')]=function(_0x185830){return request(_0x3b2b('0x31'),{'body':_0x185830});};exports['createCmContact']=function(_0x4ed952){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x4ed952['phone'],'ListId':_0x4ed952[_0x3b2b('0x32')]}}})[_0x3b2b('0x6')](function(_0x3a1ff8){if(_0x3a1ff8){return _0x3a1ff8;}return request(_0x3b2b('0x33'),{'body':_0x4ed952});});};exports[_0x3b2b('0x34')]=function(_0x34fc22){return request(_0x3b2b('0x35'),{'options':{'where':{'id':_0x34fc22},'attributes':['name']}});};exports[_0x3b2b('0x36')]=function(_0x54f942,_0x48a62a){return request(_0x3b2b('0x37'),{'body':{'interface':_0x48a62a},'options':{'where':_0x54f942}});};exports[_0x3b2b('0x38')]=function(_0x281f1a,_0x107285,_0x5040e2){return request('PauseUser',{'body':{'type':_0x107285,'uniqueid':_0x5040e2},'options':{'where':_0x281f1a}});};exports[_0x3b2b('0x39')]=function(_0x3a7b4b){return request(_0x3b2b('0x3a'),{'body':{},'options':{'where':_0x3a7b4b}});};exports[_0x3b2b('0x3b')]=function(_0x2b745e){return request('LogoutUser',{'body':{},'options':{'where':_0x2b745e}});}; \ No newline at end of file +var _0x2208=['error','message','result','catch','getSquareProjects','GetSquareProjects','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','GetContactByPhone','getTrunkById','ShowSound','save_name','getIntervalById','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','moment','client','request','then'];(function(_0x5c811c,_0x313b25){var _0x5df3af=function(_0x3460de){while(--_0x3460de){_0x5c811c['push'](_0x5c811c['shift']());}};_0x5df3af(++_0x313b25);}(_0x2208,0x11e));var _0x8220=function(_0x171c8a,_0x1f58d5){_0x171c8a=_0x171c8a-0x0;var _0x249fe3=_0x2208[_0x171c8a];return _0x249fe3;};'use strict';var _=require('lodash');var moment=require(_0x8220('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x8220('0x1')]['http']({'port':0x2329});function request(_0x2c1af9,_0xffe566){return new Promise(function(_0x3d2530,_0x231a4b){return client[_0x8220('0x2')](_0x2c1af9,_0xffe566)[_0x8220('0x3')](function(_0x5e9be3){if(_0x5e9be3[_0x8220('0x4')]){return _0x231a4b(_0x5e9be3['error'][_0x8220('0x5')]);}else{return _0x3d2530(_0x5e9be3[_0x8220('0x6')]);}})[_0x8220('0x7')](function(_0xe507a8){return _0x231a4b(_0xe507a8);});});}exports[_0x8220('0x8')]=function(){return request(_0x8220('0x9'),{'options':{'raw':![],'attributes':['id','name',_0x8220('0xa')]}});};exports[_0x8220('0xb')]=function(_0x4cb7e4){return request(_0x8220('0xc'),{'options':{'raw':![],'where':{'name':_0x4cb7e4},'attributes':[_0x8220('0xa')]}});};exports[_0x8220('0xd')]=function(_0x282223){return request(_0x8220('0xe'),{'options':{'raw':![],'where':{'id':_0x282223},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':_0x8220('0xf'),'as':_0x8220('0xf')}]}],'attributes':['id',_0x8220('0x10'),_0x8220('0x11')],'smtp':!![]}});};exports[_0x8220('0x12')]=function(_0x1bee9c){return request(_0x8220('0xc'),{'options':{'where':{'id':_0x1bee9c},'attributes':[_0x8220('0x10')]}});};exports[_0x8220('0x13')]=function(_0x5b19d4){return request(_0x8220('0x14'),{'options':{'where':{'id':_0x5b19d4},'attributes':[_0x8220('0x10')]}});};exports[_0x8220('0x15')]=function(_0x4c8182){return request('ShowVariable',{'options':{'where':{'id':_0x4c8182},'attributes':[_0x8220('0x10')]}});};exports[_0x8220('0x16')]=function(_0x1d04ab){return request(_0x8220('0x17'),{'options':{'where':{'id':_0x1d04ab},'attributes':[_0x8220('0x18')]}});};exports[_0x8220('0x19')]=function(_0x2a5124){return request(_0x8220('0x1a'),{'options':{'where':{'id':_0x2a5124},'attributes':[_0x8220('0x10')]}});};exports['getContactByPhone']=function(_0x7fd695){return request(_0x8220('0x1b'),{'options':{'where':{'phone':_0x7fd695['phone']},'attributes':['id']}});};exports[_0x8220('0x1c')]=function(_0x49f5d4){return request('ShowTrunk',{'options':{'where':{'id':_0x49f5d4},'attributes':[_0x8220('0x10')]}});};exports['getSoundById']=function(_0x10fe49){return request(_0x8220('0x1d'),{'options':{'where':{'id':_0x10fe49},'attributes':[_0x8220('0x1e')]}});};exports[_0x8220('0x1f')]=function(_0x9ef529){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x9ef529},'include':[{'model':'Interval','as':_0x8220('0x20')}]}});};exports[_0x8220('0x21')]=function(_0x15988d){return request(_0x8220('0x22'),{'options':{'where':{'id':_0x15988d},'attributes':['id',_0x8220('0x10')]}});};exports[_0x8220('0x23')]=function(_0x22e848){return request('CreateSmsMessage',{'body':_0x22e848});};exports[_0x8220('0x24')]=function(_0x486390){return request(_0x8220('0x25'),{'body':_0x486390});};exports[_0x8220('0x26')]=function(_0x287ccf){return request('CreateSquareReport',{'body':_[_0x8220('0x27')](_0x287ccf,{'project_name':_0x287ccf[_0x8220('0x28')],'prev_project_name':_0x287ccf[_0x8220('0x29')]||'','is_subproject':_0x287ccf[_0x8220('0x29')]?!![]:![],'leaveAt':moment()['format'](_0x8220('0x2a'))})});};exports[_0x8220('0x2b')]=function(_0x21933d){return request('CreateSquareRecording',{'body':_0x21933d});};exports[_0x8220('0x2c')]=function(_0x162ee9){return request(_0x8220('0x2d'),{'body':_0x162ee9});};exports[_0x8220('0x2e')]=function(_0x154e8c){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x154e8c[_0x8220('0x2f')],'ListId':_0x154e8c[_0x8220('0x30')]}}})[_0x8220('0x3')](function(_0x17c245){if(_0x17c245){return _0x17c245;}return request(_0x8220('0x31'),{'body':_0x154e8c});});};exports[_0x8220('0x32')]=function(_0x2ec3a9){return request(_0x8220('0x33'),{'options':{'where':{'id':_0x2ec3a9},'attributes':[_0x8220('0x10')]}});};exports['agentLogin']=function(_0x46d80b,_0x5d43eb){return request(_0x8220('0x34'),{'body':{'interface':_0x5d43eb},'options':{'where':_0x46d80b}});};exports[_0x8220('0x35')]=function(_0x527974,_0x4370fa,_0x36b9f4){return request(_0x8220('0x36'),{'body':{'type':_0x4370fa,'uniqueid':_0x36b9f4},'options':{'where':_0x527974}});};exports[_0x8220('0x37')]=function(_0x31ef16){return request(_0x8220('0x38'),{'body':{},'options':{'where':_0x31ef16}});};exports[_0x8220('0x39')]=function(_0x2fed3f){return request('LogoutUser',{'body':{},'options':{'where':_0x2fed3f}});}; \ 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 5d07c3e..28cfe96 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 _0x4cfd=['./polly','./lex'];(function(_0x2bd6d0,_0x5e206){var _0xb0116b=function(_0x4d33e6){while(--_0x4d33e6){_0x2bd6d0['push'](_0x2bd6d0['shift']());}};_0xb0116b(++_0x5e206);}(_0x4cfd,0x170));var _0xd4cf=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x4cfd[_0xc4001c];return _0x49f7bc;};var polly=require(_0xd4cf('0x0'));var lex=require(_0xd4cf('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var polly=require('./polly');var lex=require('./lex');module['exports']={'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 d8d59dc..20824d6 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5b02=['exports','./lib/api'];(function(_0x4cb9c9,_0x3af65f){var _0x24ab16=function(_0x4e30a0){while(--_0x4e30a0){_0x4cb9c9['push'](_0x4cb9c9['shift']());}};_0x24ab16(++_0x3af65f);}(_0x5b02,0xe9));var _0x25b0=function(_0x32c4d3,_0x405577){_0x32c4d3=_0x32c4d3-0x0;var _0x1e2bba=_0x5b02[_0x32c4d3];return _0x1e2bba;};'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 +var _0x9c00=['./lib/api','exports'];(function(_0xae841a,_0x1cee16){var _0x4860e3=function(_0x210fda){while(--_0x210fda){_0xae841a['push'](_0xae841a['shift']());}};_0x4860e3(++_0x1cee16);}(_0x9c00,0x1a0));var _0x09c0=function(_0xc8db6b,_0x320abd){_0xc8db6b=_0xc8db6b-0x0;var _0x12cb81=_0x9c00[_0xc8db6b];return _0x12cb81;};'use strict';var lex=require(_0x09c0('0x0'));module[_0x09c0('0x1')]=function(_0x4dff21,_0x5e32e7,_0xe0d293,_0x8c9907,_0x5d1967,_0x220c0c){return lex(_0x4dff21,_0x5e32e7,_0xe0d293,_0x8c9907,_0x5d1967,_0x220c0c);}; \ 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 278e45b..2534c24 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(_0x5c4e7d,_0x954545){var _0x230974=function(_0x5ea9df){while(--_0x5ea9df){_0x5c4e7d['push'](_0x5c4e7d['shift']());}};_0x230974(++_0x954545);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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(_0x385dc7,_0x499ff5){var _0x191536=function(_0x509d99){while(--_0x509d99){_0x385dc7['push'](_0x385dc7['shift']());}};_0x191536(++_0x499ff5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 678dc90..5dc7070 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 _0xac83=['./lib/api','exports'];(function(_0x4f99c1,_0x455a4c){var _0x5c9a11=function(_0x121907){while(--_0x121907){_0x4f99c1['push'](_0x4f99c1['shift']());}};_0x5c9a11(++_0x455a4c);}(_0xac83,0x1e6));var _0x3ac8=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0xac83[_0x2e3545];return _0xcf18f;};'use strict';var polly=require(_0x3ac8('0x0'));module[_0x3ac8('0x1')]=function(_0x17ffe6,_0x58a1c7,_0x2e44f0,_0x435756,_0x1828a8,_0x2100d1,_0x21820e){return polly(_0x17ffe6,_0x58a1c7,_0x2e44f0,_0x435756,_0x1828a8,_0x2100d1,_0x21820e);}; \ No newline at end of file +var _0xdcb6=['./lib/api'];(function(_0x6be190,_0x25e8dd){var _0x3867df=function(_0x204898){while(--_0x204898){_0x6be190['push'](_0x6be190['shift']());}};_0x3867df(++_0x25e8dd);}(_0xdcb6,0x1e5));var _0x6dcb=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xdcb6[_0xdea41a];return _0x15d0d8;};'use strict';var polly=require(_0x6dcb('0x0'));module['exports']=function(_0x5c3c37,_0x4d0310,_0xdd8874,_0x1db87d,_0x92eafc,_0x6fe9f1,_0x41e8a2){return polly(_0x5c3c37,_0x4d0310,_0xdd8874,_0x1db87d,_0x92eafc,_0x6fe9f1,_0x41e8a2);}; \ 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 efbe792..78d64fa 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 _0x3008=['path','randomstring','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3'];(function(_0x5697dc,_0x373d72){var _0x4427c8=function(_0x9fc2a0){while(--_0x9fc2a0){_0x5697dc['push'](_0x5697dc['shift']());}};_0x4427c8(++_0x373d72);}(_0x3008,0xea));var _0x8300=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0x3008[_0x3a8db5];return _0x2c03cd;};'use strict';var fs=require('fs');var path=require(_0x8300('0x0'));var BPromise=require('bluebird');var rs=require(_0x8300('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x9c4035,_0x325ef9,_0x291f60){return new BPromise(function(_0x62a59,_0x3c401a){_0x9c4035[_0x8300('0x2')](_0x325ef9,function(_0x53f5ae,_0x453ba9){if(_0x53f5ae){_0x3c401a(_0x53f5ae);}else if(_0x453ba9){if(_0x453ba9[_0x8300('0x3')]instanceof Buffer){fs[_0x8300('0x4')](_0x291f60,_0x453ba9['AudioStream'],function(_0x5e2a8f){if(_0x5e2a8f){_0x3c401a(_0x5e2a8f);}else{_0x62a59();}});}else{_0x3c401a(new Error(_0x8300('0x5')));}}else{_0x3c401a(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x8300('0x6')]=function(_0x12645a,_0x40e86d,_0x4a45e8,_0xdfad9,_0x240b2a,_0x16f14c,_0xab1381){var _0x14413b=new AWS[(_0x8300('0x7'))]({'accessKeyId':_0x12645a,'secretAccessKey':_0x40e86d,'region':_0x4a45e8});var _0x8e7c07={'Text':_0x240b2a,'TextType':_0x16f14c||'text','OutputFormat':_0x8300('0x8'),'VoiceId':_0xdfad9};return pollyResult(_0x14413b,_0x8e7c07,_0xab1381);}; \ No newline at end of file +var _0x82f2=['randomstring','aws-sdk','synthesizeSpeech','writeFile','exports','Polly','text','mp3','path','bluebird'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0x82f2,0x6c));var _0x282f=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x82f2[_0x56916d];return _0x2b7f1f;};'use strict';var fs=require('fs');var path=require(_0x282f('0x0'));var BPromise=require(_0x282f('0x1'));var rs=require(_0x282f('0x2'));var AWS=require(_0x282f('0x3'));function pollyResult(_0x275f1d,_0x5324c9,_0x2729ec){return new BPromise(function(_0x4ca797,_0x41a0a8){_0x275f1d[_0x282f('0x4')](_0x5324c9,function(_0x1c1436,_0x27cc55){if(_0x1c1436){_0x41a0a8(_0x1c1436);}else if(_0x27cc55){if(_0x27cc55['AudioStream']instanceof Buffer){fs[_0x282f('0x5')](_0x2729ec,_0x27cc55['AudioStream'],function(_0x17aa2f){if(_0x17aa2f){_0x41a0a8(_0x17aa2f);}else{_0x4ca797();}});}else{_0x41a0a8(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x41a0a8(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x282f('0x6')]=function(_0x400152,_0x545372,_0x43e1f1,_0x501b3e,_0xe4ebf2,_0x4822fb,_0x4a3783){var _0x507922=new AWS[(_0x282f('0x7'))]({'accessKeyId':_0x400152,'secretAccessKey':_0x545372,'region':_0x43e1f1});var _0x2c9383={'Text':_0xe4ebf2,'TextType':_0x4822fb||_0x282f('0x8'),'OutputFormat':_0x282f('0x9'),'VoiceId':_0x501b3e};return pollyResult(_0x507922,_0x2c9383,_0x4a3783);}; \ 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 0888845..1f3eb3a 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd95=['exports','./lib/api'];(function(_0x1acd28,_0x2175c8){var _0x8dbc23=function(_0x290103){while(--_0x290103){_0x1acd28['push'](_0x1acd28['shift']());}};_0x8dbc23(++_0x2175c8);}(_0xcd95,0x19f));var _0x5cd9=function(_0xd3da2a,_0x22241c){_0xd3da2a=_0xd3da2a-0x0;var _0x10ab61=_0xcd95[_0xd3da2a];return _0x10ab61;};'use strict';var asr=require(_0x5cd9('0x0'));module[_0x5cd9('0x1')]=function(_0x2ffbfd,_0x4d2169,_0x436b37,_0x10b027){return asr(_0x2ffbfd,_0x4d2169,_0x436b37);}; \ No newline at end of file +var _0xc665=['exports'];(function(_0x1d2b66,_0x256c6e){var _0x445a66=function(_0x2e5845){while(--_0x2e5845){_0x1d2b66['push'](_0x1d2b66['shift']());}};_0x445a66(++_0x256c6e);}(_0xc665,0xa8));var _0x5c66=function(_0x217191,_0x1bfed3){_0x217191=_0x217191-0x0;var _0x25ffba=_0xc665[_0x217191];return _0x25ffba;};'use strict';var asr=require('./lib/api');module[_0x5c66('0x0')]=function(_0x565be9,_0x102966,_0x53168c,_0x4132ce){return asr(_0x565be9,_0x102966,_0x53168c);}; \ 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 5b5c553..655479f 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 _0xd64b=['undefined','lang\x20should\x20be\x20a\x20string','base64','POST','LINEAR16','8000','url','https://speech.googleapis.com','string','length','key\x20should\x20be\x20a\x20string'];(function(_0x588172,_0x1540fa){var _0x5089a1=function(_0x5d01b6){while(--_0x5d01b6){_0x588172['push'](_0x588172['shift']());}};_0x5089a1(++_0x1540fa);}(_0xd64b,0xc1));var _0xbd64=function(_0x156a0d,_0x3946ce){_0x156a0d=_0x156a0d-0x0;var _0x98a9ba=_0xd64b[_0x156a0d];return _0x98a9ba;};'use strict';var url=require(_0xbd64('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xbd64('0x1');module['exports']=function(_0x30b9b3,_0xcbecd5,_0x64bd3b){return new BPromise(function(_0x3f1f05,_0x30fe29){var _0x5458d8;if(typeof _0x30b9b3!=='string'||_0x30b9b3['length']===0x0){return _0x30fe29('filepath\x20should\x20be\x20a\x20string');}if(typeof _0xcbecd5!==_0xbd64('0x2')||_0xcbecd5[_0xbd64('0x3')]===0x0){return _0x30fe29(_0xbd64('0x4'));}if(typeof _0x64bd3b!==_0xbd64('0x5')&&(typeof _0x64bd3b!==_0xbd64('0x2')||_0x64bd3b[_0xbd64('0x3')]===0x0)){return _0x30fe29(_0xbd64('0x6'));}try{_0x5458d8=fs['readFileSync'](_0x30b9b3)['toString'](_0xbd64('0x7'));}catch(_0xde7cc8){return _0x30fe29(_0xde7cc8);}return _0x3f1f05({'method':_0xbd64('0x8'),'uri':host+'/v1/speech:recognize?key='+_0xcbecd5,'body':{'config':{'encoding':_0xbd64('0x9'),'sampleRateHertz':_0xbd64('0xa'),'languageCode':_0x64bd3b},'audio':{'content':_0x5458d8}},'json':!![]});});}; \ No newline at end of file +var _0xb18e=['lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb18e,0x181));var _0xeb18=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0xb18e[_0x53e3fa];return _0xe8584a;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0xeb18('0x0');module['exports']=function(_0x13e5b4,_0x56e41c,_0xf647b9){return new BPromise(function(_0x1bf23e,_0x5d5ff9){var _0x125c34;if(typeof _0x13e5b4!==_0xeb18('0x1')||_0x13e5b4[_0xeb18('0x2')]===0x0){return _0x5d5ff9(_0xeb18('0x3'));}if(typeof _0x56e41c!==_0xeb18('0x1')||_0x56e41c[_0xeb18('0x2')]===0x0){return _0x5d5ff9('key\x20should\x20be\x20a\x20string');}if(typeof _0xf647b9!==_0xeb18('0x4')&&(typeof _0xf647b9!==_0xeb18('0x1')||_0xf647b9['length']===0x0)){return _0x5d5ff9(_0xeb18('0x5'));}try{_0x125c34=fs[_0xeb18('0x6')](_0x13e5b4)[_0xeb18('0x7')](_0xeb18('0x8'));}catch(_0x3ad7a3){return _0x5d5ff9(_0x3ad7a3);}return _0x1bf23e({'method':_0xeb18('0x9'),'uri':host+_0xeb18('0xa')+_0x56e41c,'body':{'config':{'encoding':_0xeb18('0xb'),'sampleRateHertz':_0xeb18('0xc'),'languageCode':_0xf647b9},'audio':{'content':_0x125c34}},'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 10cb4be..d6993c3 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0x08c8=['./asr'];(function(_0x3e43f4,_0xd0f6e2){var _0x16762f=function(_0x3a4255){while(--_0x3a4255){_0x3e43f4['push'](_0x3e43f4['shift']());}};_0x16762f(++_0xd0f6e2);}(_0x08c8,0x1e5));var _0x808c=function(_0x3600be,_0x4b91ea){_0x3600be=_0x3600be-0x0;var _0xdee12f=_0x08c8[_0x3600be];return _0xdee12f;};var asr=require(_0x808c('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index fd32b01..896888c 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 _0xea4d=['intent','displayName','isFallback','languageCode','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','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','parse','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','bluebird','dialogflow','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','end','data','transcode','wav','error\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','MP3','POST','.mp3','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','confidence','join','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','action','actionIncomplete','score','status','metadata','endConversation','SessionsClient','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xea4d,0x132));var _0xdea4=function(_0x29f382,_0x5ddcb5){_0x29f382=_0x29f382-0x0;var _0x30d42=_0xea4d[_0x29f382];return _0x30d42;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xdea4('0x0'));var dialogflow=require(_0xdea4('0x1'));var fs=require('fs');var http=require('http');var https=require(_0xdea4('0x2'));var md5=require(_0xdea4('0x3'));var path=require(_0xdea4('0x4'));var querystring=require(_0xdea4('0x5'));var rp=require(_0xdea4('0x6'));var rs=require(_0xdea4('0x7'));var sox=require(_0xdea4('0x8'));var tts=require(_0xdea4('0x9'));var urlParse=require(_0xdea4('0xa'))['parse'];var util=require(_0xdea4('0xb'));var aws=require(_0xdea4('0xc'));var google=require(_0xdea4('0xd'));var sestek=require(_0xdea4('0xe'));var tilde=require(_0xdea4('0xf'));var logger=require(_0xdea4('0x10'))(_0xdea4('0x11'));var ISPEECH_API=_0xdea4('0x12');function downloadFile(_0x1749ba,_0x255fc9){return new BPromise(function(_0x109f2a,_0x169f8c){var _0x1a1dc4=urlParse(_0x1749ba);var _0x253e58=_0x1a1dc4[_0xdea4('0x13')]===_0xdea4('0x14')?https:http;var _0x50d18a={'host':_0x1a1dc4[_0xdea4('0x15')],'path':_0x1a1dc4[_0xdea4('0x4')],'headers':{'user-agent':_0xdea4('0x16')}};_0x253e58[_0xdea4('0x17')](_0x50d18a,function(_0x398c7d){if(_0x398c7d[_0xdea4('0x18')]!==0xc8){logger[_0xdea4('0x19')]('request\x20to\x20'+_0x1749ba+_0xdea4('0x1a')+_0x398c7d[_0xdea4('0x18')]+'\x20('+_0x398c7d[_0xdea4('0x1b')]+')');_0x169f8c(new Error(_0xdea4('0x1c')+_0x1749ba+_0xdea4('0x1a')+_0x398c7d[_0xdea4('0x18')]+'\x20('+_0x398c7d[_0xdea4('0x1b')]+')'));return;}var _0x374403=fs[_0xdea4('0x1d')](_0x255fc9);_0x374403['on'](_0xdea4('0x1e'),function(){logger[_0xdea4('0x1f')](_0xdea4('0x20'));_0x374403[_0xdea4('0x21')](_0x109f2a);});_0x374403['on'](_0xdea4('0x19'),function(_0x124ebd){fs[_0xdea4('0x22')](_0x255fc9);logger[_0xdea4('0x19')](_0xdea4('0x23'),_0x124ebd);_0x169f8c(_0x124ebd);});_0x398c7d['pipe'](_0x374403);})['on']('error',function(_0x2cdc65){logger[_0xdea4('0x19')](_0x2cdc65);_0x169f8c(_0x2cdc65);})[_0xdea4('0x24')]();});}function uploadFile(_0x24192f){return new BPromise(function(_0x19d5bf,_0x24931c){var _0x216aa2=urlParse(_0x24192f);var _0x53dcdb=_0x216aa2[_0xdea4('0x13')]===_0xdea4('0x14')?https:http;var _0x1d4565={'host':_0x216aa2['host'],'path':_0x216aa2[_0xdea4('0x4')],'headers':{'user-agent':_0xdea4('0x16')}};_0x53dcdb[_0xdea4('0x17')](_0x1d4565,function(_0x3cd238){if(_0x3cd238['statusCode']!==0xc8){_0x24931c(new Error(_0xdea4('0x1c')+_0x24192f+_0xdea4('0x1a')+_0x3cd238[_0xdea4('0x18')]+'\x20('+_0x3cd238[_0xdea4('0x1b')]+')'));return;}var _0x5d58d0='';_0x3cd238['on'](_0xdea4('0x25'),function(_0x24a6bc){_0x5d58d0+=_0x24a6bc;});_0x3cd238['on']('end',function(){_0x19d5bf(_0x5d58d0);});})['on'](_0xdea4('0x19'),function(_0x503ff9){_0x24931c(_0x503ff9);})[_0xdea4('0x24')]();});}function convertFile(_0x539eab,_0x245166){return new BPromise(function(_0x269365,_0x347b67){var _0x235c99=sox[_0xdea4('0x26')](_0x539eab,_0x245166,{'sampleRate':0x1f40,'format':_0xdea4('0x27'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x235c99['on']('error',function(_0xb87d16){logger[_0xdea4('0x19')](_0xdea4('0x28'),_0xb87d16);_0x347b67(_0xb87d16);});_0x235c99['on'](_0xdea4('0x24'),function(){logger[_0xdea4('0x1f')]('finish\x20to\x20convert');_0x269365();});_0x235c99[_0xdea4('0x29')]();});}function base64Decode(_0x377430,_0x1cb168){var _0xe5b8aa=path[_0xdea4('0x2a')](__dirname,_0xdea4('0x2b'),rs[_0xdea4('0x2c')](0x4)+_0xdea4('0x2d'));fs[_0xdea4('0x2e')](_0xe5b8aa,_0x377430,_0xdea4('0x2f'));return convertFile(_0xe5b8aa,_0x1cb168)[_0xdea4('0x30')](function(){try{fs[_0xdea4('0x22')](_0xe5b8aa);fs[_0xdea4('0x31')](_0x1cb168,_0xdea4('0x32'));}catch(_0x3b0755){logger[_0xdea4('0x19')](_0x3b0755);}return _0x1cb168[_0xdea4('0x33')]('.')[0x0];});}function base64Encode(_0x2d83dc){var _0x4b4aaf=fs['readFileSync'](_0x2d83dc);return new Buffer(_0x4b4aaf)[_0xdea4('0x34')](_0xdea4('0x2f'));}exports['googleCloudTTS']=function(_0x5b5b12,_0x10abf9,_0xc9337,_0x3e03ec,_0xb55248,_0x3dd8c2){var _0x58d001,_0x571312;var _0x2f029a=_0xdea4('0x35');var _0x10260a=_0xdea4('0x36')+_0x5b5b12;var _0x46b176={};if(_0x10abf9===_0xdea4('0x37')){_0x46b176[_0xdea4('0x38')]={'ssml':_0xc9337};}else{_0x46b176[_0xdea4('0x38')]={'text':_0xc9337};};_0x46b176[_0xdea4('0x39')]={'languageCode':_0x3e03ec,'ssmlGender':_0xb55248};_0x46b176['audioConfig']={'audioEncoding':_0xdea4('0x3a'),'sampleRateHertz':0x1f40};var _0x284281={'url':_0x2f029a+'text:synthesize'+_0x10260a,'method':_0xdea4('0x3b'),'json':!![],'body':_0x46b176};return rp(_0x284281)[_0xdea4('0x30')](function(_0x4ed28c){return new BPromise(function(_0x12c9fb,_0x35499b){_0x58d001=path[_0xdea4('0x2a')](__dirname,'tmp',rs['generate'](0x4)+_0xdea4('0x3c'));var _0x4aafeb=Buffer['from'](_0x4ed28c[_0xdea4('0x3d')],'base64');return fs[_0xdea4('0x3e')](_0x58d001,_0x4aafeb,function(_0x55c3a5){_0x35499b(_0x55c3a5);},function(_0x3dbfd4){fs[_0xdea4('0x31')](_0x58d001,_0xdea4('0x32'));_0x12c9fb(_0x3dbfd4);});});})[_0xdea4('0x30')](function(_0x354b48){_0x571312=path[_0xdea4('0x2a')](__dirname,_0xdea4('0x2b'),rs[_0xdea4('0x2c')](0x4)+'.wav');return convertFile(_0x58d001,_0x571312);})[_0xdea4('0x30')](function(){try{fs['unlink'](_0x58d001);fs[_0xdea4('0x31')](_0x571312,_0xdea4('0x32'));}catch(_0x39c1cd){logger[_0xdea4('0x19')](_0x39c1cd);}logger[_0xdea4('0x1f')](_0xdea4('0x3f'),_0x571312[_0xdea4('0x33')]('.')[0x0]);return _0x571312[_0xdea4('0x33')]('.')[0x0];});};exports[_0xdea4('0x40')]=function(_0x554198,_0x3d5e4a){var _0xb4cd13='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x28a446,_0x412de2;var _0x1b242a;var _0x53ce25={'encoding':_0xdea4('0x41'),'method':_0xdea4('0x3b'),'timeout':0x2710,'url':_0xb4cd13,'headers':{'Content-Type':_0xdea4('0x42')},'body':_0xdea4('0x43')+encodeURIComponent(JSON[_0xdea4('0x44')]([[[_0xdea4('0x45'),JSON[_0xdea4('0x44')]([_0x554198,_0x3d5e4a||'en',![],_0xdea4('0x46')]),null,'generic']]]))};return rp(_0x53ce25)[_0xdea4('0x30')](function(_0x471132){try{_0x1b242a=eval(_0x471132[_0xdea4('0x47')](0x5))[0x0][0x2];}catch(_0x2c0cca){throw new Error(_0xdea4('0x48')+_0x471132['data']);}if(!_0x1b242a){if(_0x554198['length']>0xc8){throw new Error(_0xdea4('0x49'));}else{throw new Error('lang\x20\x22'+_0x3d5e4a+_0xdea4('0x4a'));}}try{_0x1b242a=eval(_0x1b242a)[0x0];}catch(_0x201564){throw new Error(_0xdea4('0x48')+res[_0xdea4('0x25')]);}const _0x438145=_0x1b242a;_0x28a446=path[_0xdea4('0x2a')](__dirname,_0xdea4('0x2b'),rs[_0xdea4('0x2c')](0x4)+'.mp3');fs[_0xdea4('0x2e')](_0x28a446,_0x1b242a,{'encoding':_0xdea4('0x2f')});_0x412de2=path[_0xdea4('0x2a')](__dirname,_0xdea4('0x2b'),rs[_0xdea4('0x2c')](0x4)+_0xdea4('0x2d'));return convertFile(_0x28a446,_0x412de2);})[_0xdea4('0x30')](function(){try{fs[_0xdea4('0x22')](_0x28a446);fs[_0xdea4('0x31')](_0x412de2,'777');}catch(_0x370eab){logger[_0xdea4('0x19')](_0x370eab);}logger['info'](_0xdea4('0x4b'),_0x412de2['split']('.')[0x0]);return _0x412de2[_0xdea4('0x33')]('.')[0x0];});};exports[_0xdea4('0x4c')]=function(_0x22bb8d,_0x82edc0,_0x3bdbeb){return google[_0xdea4('0x4d')](_0x22bb8d,_0x82edc0,_0x3bdbeb)[_0xdea4('0x30')](function(_0x5db3a6){logger['info'](_0x5db3a6[_0xdea4('0x4e')]);return rp(_0x5db3a6);})['then'](function(_0x1f6338){var _0x1ffab8='';var _0x1c7a52=0x0;try{fs[_0xdea4('0x22')](_0x22bb8d);}catch(_0x189a93){logger[_0xdea4('0x19')](_0x189a93);}if(_0x1f6338&&_0x1f6338['results']){_0x1ffab8=_0x1f6338[_0xdea4('0x4f')][_0xdea4('0x50')](function(_0xdbaaf8){return _0xdbaaf8&&_0xdbaaf8['alternatives'][0x0]&&_0xdbaaf8[_0xdea4('0x51')][0x0][_0xdea4('0x52')]?_0xdbaaf8['alternatives'][0x0][_0xdea4('0x52')]:'';})['join']('\x0a');_0x1c7a52=_0x1f6338[_0xdea4('0x4f')][_0xdea4('0x50')](function(_0x5bb2f9){return _0x5bb2f9&&_0x5bb2f9['alternatives'][0x0]&&_0x5bb2f9[_0xdea4('0x51')][0x0][_0xdea4('0x53')]?_0x5bb2f9[_0xdea4('0x51')][0x0][_0xdea4('0x53')]:0x0;})[_0xdea4('0x54')]('\x0a');}logger[_0xdea4('0x1f')]('googleASR\x20transcription',_0x1ffab8);logger['info']('googleASR\x20confidence',_0x1c7a52);return{'transcript':_0x1ffab8,'confidence':_0x1c7a52};})[_0xdea4('0x55')](function(_0x1e3cdc){logger[_0xdea4('0x19')](_0xdea4('0x56'),_0x1e3cdc[_0xdea4('0x18')],_0x1e3cdc[_0xdea4('0x57')],_0x1e3cdc[_0xdea4('0x58')]);});};exports[_0xdea4('0x59')]=function(_0x10d058,_0x5e0b98,_0x410114,_0x1a39a3){var _0x461b5f=apiai(_0x5e0b98,{'language':_0x1a39a3||'en'});return _0x461b5f[_0xdea4('0x5a')](_0x410114,{'sessionId':md5(_0x10d058)})[_0xdea4('0x30')](function(_0x56a0a8){logger[_0xdea4('0x1f')](JSON[_0xdea4('0x44')](_0x56a0a8));return{'source':_0x56a0a8[_0xdea4('0x5b')][_0xdea4('0x5c')],'resolvedQuery':_0x56a0a8['result']['resolvedQuery'],'action':_0x56a0a8[_0xdea4('0x5b')][_0xdea4('0x5d')],'actionIncomplete':_0x56a0a8[_0xdea4('0x5b')][_0xdea4('0x5e')],'speech':_0x56a0a8['result']['fulfillment']['speech'],'score':_0x56a0a8[_0xdea4('0x5b')][_0xdea4('0x5f')],'statusCode':_0x56a0a8[_0xdea4('0x60')]['code'],'endConversation':_0x56a0a8[_0xdea4('0x5b')][_0xdea4('0x61')][_0xdea4('0x62')]||![],'isFallbackIntent':_0x56a0a8[_0xdea4('0x5b')][_0xdea4('0x61')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0xa09938,_0x430982,_0x36c496,_0x536fd6,_0x4a109d,_0x5cf9ef){var _0x1242a7=_0x536fd6['replace'](/\\n/g,'\x0a');var _0x2d05cd={'credentials':{'private_key':_0x1242a7,'client_email':_0x36c496}};var _0x27fb8f=new dialogflow[(_0xdea4('0x63'))](_0x2d05cd);var _0x10849b=_0x27fb8f[_0xdea4('0x64')](_0x430982,md5(_0xa09938));var _0x3603c3={'session':_0x10849b,'queryInput':{'text':{'text':_0x4a109d,'languageCode':_0x5cf9ef}}};return _0x27fb8f[_0xdea4('0x65')](_0x3603c3)[_0xdea4('0x30')](function(_0x206beb){if(_0x206beb&&_0x206beb[_0xdea4('0x66')]){logger[_0xdea4('0x1f')](_0xdea4('0x67'),JSON[_0xdea4('0x44')](_0x206beb));var _0x4ae398=_0x206beb[0x0];if(_0x4ae398){var _0x18e1fa={'action':_0x4ae398[_0xdea4('0x68')][_0xdea4('0x5d')],'allRequiredParamsPresent':_0x4ae398[_0xdea4('0x68')][_0xdea4('0x69')],'endConversation':_0x4ae398[_0xdea4('0x68')][_0xdea4('0x6a')]&&_0x4ae398[_0xdea4('0x68')][_0xdea4('0x6a')][_0xdea4('0x6b')]?_0x4ae398[_0xdea4('0x68')][_0xdea4('0x6a')][_0xdea4('0x6b')][_0xdea4('0x6c')][_0xdea4('0x6d')]:![],'fulfillmentText':_0x4ae398[_0xdea4('0x68')][_0xdea4('0x6e')],'intentName':_0x4ae398['queryResult'][_0xdea4('0x6f')]['name'],'intentDisplayName':_0x4ae398[_0xdea4('0x68')]['intent'][_0xdea4('0x70')],'isFallbackIntent':_0x4ae398[_0xdea4('0x68')][_0xdea4('0x6f')][_0xdea4('0x71')],'languageCode':_0x4ae398[_0xdea4('0x68')][_0xdea4('0x72')],'queryText':_0x4ae398['queryResult']['queryText'],'responseId':_0x4ae398['responseId'],'score':_0x4ae398['queryResult'][_0xdea4('0x73')],'speech':_0x4ae398['queryResult'][_0xdea4('0x6e')],'providerResponse':JSON['stringify'](_0x206beb)};return _0x18e1fa;}}});};exports[_0xdea4('0x74')]=function(_0x85c90d,_0x4dd7ae,_0x4a625b,_0x59fdc8){return tilde[_0xdea4('0x4d')](_0x85c90d,_0x4dd7ae,_0x4a625b,_0x59fdc8)['then'](function(_0x46ee76){try{fs[_0xdea4('0x22')](_0x85c90d);}catch(_0x3e9c96){logger[_0xdea4('0x19')](_0x3e9c96);}logger['info'](_0xdea4('0x75'),_0x46ee76['transcript']);logger['info'](_0xdea4('0x76'),_0x46ee76[_0xdea4('0x53')]);return _0x46ee76;});};exports[_0xdea4('0x77')]=function(_0x579d2d,_0xd0cf94,_0x410091,_0x5aaa25,_0x428a5e,_0x3f2f64){var _0x593d6d=path['resolve'](__dirname,'tmp',rs[_0xdea4('0x2c')](0x4)+_0xdea4('0x3c'));var _0x3fa329;return aws[_0xdea4('0x78')](_0x579d2d,_0xd0cf94,_0x410091,_0x5aaa25,_0x428a5e,_0x3f2f64,_0x593d6d)[_0xdea4('0x30')](function(){_0x3fa329=path[_0xdea4('0x2a')](__dirname,_0xdea4('0x2b'),rs['generate'](0x4)+_0xdea4('0x2d'));return convertFile(_0x593d6d,_0x3fa329);})['then'](function(){try{fs[_0xdea4('0x22')](_0x593d6d);fs[_0xdea4('0x31')](_0x3fa329,'777');}catch(_0x5dea07){logger['error'](_0x5dea07);}return _0x3fa329['split']('.')[0x0];});};exports[_0xdea4('0x79')]=function(_0x20cf95,_0x4d07ea,_0x22beb3,_0x3306cd,_0x5c4afe,_0x49b219){return aws[_0xdea4('0x7a')](_0x20cf95,_0x4d07ea,_0x22beb3,_0x3306cd,_0x5c4afe,_0x49b219)['then'](function(_0x36f9c9){logger['info'](JSON['stringify'](_0x36f9c9));return _0x36f9c9;});};exports[_0xdea4('0x7b')]=function(_0x1c37c5,_0x4dc9ed,_0x45ea1e,_0x330c0f){var _0x3142b1=util[_0xdea4('0x7c')](_0xdea4('0x7d'),ISPEECH_API,_0x1c37c5,encodeURIComponent(_0x4dc9ed),_0x45ea1e,_0x330c0f);var _0x5de522=path[_0xdea4('0x2a')](__dirname,_0xdea4('0x2b'),rs['generate'](0x4)+_0xdea4('0x3c'));var _0x3ed305;return downloadFile(_0x3142b1,_0x5de522)[_0xdea4('0x30')](function(){_0x3ed305=path[_0xdea4('0x2a')](__dirname,_0xdea4('0x2b'),rs[_0xdea4('0x2c')](0x4)+_0xdea4('0x2d'));return convertFile(_0x5de522,_0x3ed305);})[_0xdea4('0x30')](function(){try{fs[_0xdea4('0x22')](_0x5de522);fs[_0xdea4('0x31')](_0x3ed305,_0xdea4('0x32'));}catch(_0x2b311a){logger[_0xdea4('0x19')](_0x2b311a);}return _0x3ed305[_0xdea4('0x33')]('.')[0x0];});};exports['ispeechASR']=function(_0x4d3bfe,_0x3205b7,_0xea9bc,_0x3235c9){var _0x506c5d=util[_0xdea4('0x7c')](_0xdea4('0x7e'),ISPEECH_API,_0x3205b7,_0xea9bc,base64Encode(_0x4d3bfe),_0x3235c9?util[_0xdea4('0x7c')](_0xdea4('0x7f'),encodeURIComponent(_0x3235c9)):_0xdea4('0x80'));return uploadFile(_0x506c5d)[_0xdea4('0x30')](function(_0x4626c9){return querystring[_0xdea4('0x81')](_0x4626c9);});};exports[_0xdea4('0x82')]=function(_0x2534cd,_0x14da49){return sestek[_0xdea4('0x83')](_0x2534cd,_0x14da49)[_0xdea4('0x30')](function(_0x32afee){logger[_0xdea4('0x1f')](JSON['stringify'](_0x32afee));var _0x4848b4={'speech':_0x32afee['text'],'action':_0x32afee['channelData']?_0x32afee[_0xdea4('0x84')][_0xdea4('0x85')]:undefined,'actiondata':_0x32afee[_0xdea4('0x84')]?_0x32afee[_0xdea4('0x84')][_0xdea4('0x86')]:undefined};if(_0x32afee[_0xdea4('0x84')]&&_0x32afee[_0xdea4('0x84')][_0xdea4('0x87')]){return base64Decode(_0x32afee[_0xdea4('0x84')][_0xdea4('0x87')][_0xdea4('0x88')],path['resolve'](__dirname,_0xdea4('0x2b'),rs[_0xdea4('0x2c')](0x4)+_0xdea4('0x2d')))[_0xdea4('0x30')](function(_0x536af7){_0x4848b4[_0xdea4('0x89')]=_0x536af7;return _0x4848b4;});}return _0x4848b4;});};exports[_0xdea4('0x8a')]=function(){return __dirname;}; \ No newline at end of file +var _0x9768=['SessionsClient','detectIntent','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','name','displayName','languageCode','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','randomstring','sox','google-tts-api','url','parse','util','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','finish','close','unlink','download\x20error','pipe','end','protocol','data','transcode','wav','error\x20convert','info','finish\x20to\x20convert','resolve','tmp','generate','writeFileSync','base64','then','777','split','toString','googleCloudTTS','ssml','input','voice','audioConfig','MP3','text:synthesize','.mp3','from','audioContent','.wav','chmodSync','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','uri','results','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','message','textRequest','result','source','resolvedQuery','actionIncomplete','speech','score','status','metadata','isFallbackIntent','googleDialogflowV2','replace'];(function(_0xfec728,_0x5dc5e1){var _0x2a430e=function(_0x2820b7){while(--_0x2820b7){_0xfec728['push'](_0xfec728['shift']());}};_0x2a430e(++_0x5dc5e1);}(_0x9768,0x1b8));var _0x8976=function(_0x459a0a,_0x25c46f){_0x459a0a=_0x459a0a-0x0;var _0x4ab46c=_0x9768[_0x459a0a];return _0x4ab46c;};'use strict';var apiai=require(_0x8976('0x0'));var BPromise=require(_0x8976('0x1'));var dialogflow=require(_0x8976('0x2'));var fs=require('fs');var http=require(_0x8976('0x3'));var https=require(_0x8976('0x4'));var md5=require(_0x8976('0x5'));var path=require(_0x8976('0x6'));var querystring=require(_0x8976('0x7'));var rp=require('request-promise');var rs=require(_0x8976('0x8'));var sox=require(_0x8976('0x9'));var tts=require(_0x8976('0xa'));var urlParse=require(_0x8976('0xb'))[_0x8976('0xc')];var util=require(_0x8976('0xd'));var aws=require('./aws');var google=require('./google');var sestek=require('./sestek');var tilde=require(_0x8976('0xe'));var logger=require(_0x8976('0xf'))(_0x8976('0x10'));var ISPEECH_API=_0x8976('0x11');function downloadFile(_0x4cba9e,_0x17592b){return new BPromise(function(_0x531621,_0x48d852){var _0x2efda0=urlParse(_0x4cba9e);var _0x2f272b=_0x2efda0['protocol']===_0x8976('0x12')?https:http;var _0x53b457={'host':_0x2efda0[_0x8976('0x13')],'path':_0x2efda0[_0x8976('0x6')],'headers':{'user-agent':_0x8976('0x14')}};_0x2f272b[_0x8976('0x15')](_0x53b457,function(_0x415b33){if(_0x415b33[_0x8976('0x16')]!==0xc8){logger[_0x8976('0x17')]('request\x20to\x20'+_0x4cba9e+_0x8976('0x18')+_0x415b33[_0x8976('0x16')]+'\x20('+_0x415b33[_0x8976('0x19')]+')');_0x48d852(new Error(_0x8976('0x1a')+_0x4cba9e+_0x8976('0x18')+_0x415b33['statusCode']+'\x20('+_0x415b33[_0x8976('0x19')]+')'));return;}var _0x27217c=fs['createWriteStream'](_0x17592b);_0x27217c['on'](_0x8976('0x1b'),function(){logger['info']('finish\x20download\x20file');_0x27217c[_0x8976('0x1c')](_0x531621);});_0x27217c['on'](_0x8976('0x17'),function(_0x223416){fs[_0x8976('0x1d')](_0x17592b);logger[_0x8976('0x17')](_0x8976('0x1e'),_0x223416);_0x48d852(_0x223416);});_0x415b33[_0x8976('0x1f')](_0x27217c);})['on'](_0x8976('0x17'),function(_0x236e2e){logger[_0x8976('0x17')](_0x236e2e);_0x48d852(_0x236e2e);})[_0x8976('0x20')]();});}function uploadFile(_0x231d01){return new BPromise(function(_0xbd77c7,_0x2f6115){var _0x444203=urlParse(_0x231d01);var _0x3f8fda=_0x444203[_0x8976('0x21')]==='https:'?https:http;var _0x1e117e={'host':_0x444203[_0x8976('0x13')],'path':_0x444203[_0x8976('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x3f8fda[_0x8976('0x15')](_0x1e117e,function(_0x237524){if(_0x237524['statusCode']!==0xc8){_0x2f6115(new Error(_0x8976('0x1a')+_0x231d01+_0x8976('0x18')+_0x237524['statusCode']+'\x20('+_0x237524[_0x8976('0x19')]+')'));return;}var _0x374e75='';_0x237524['on'](_0x8976('0x22'),function(_0x1c0a79){_0x374e75+=_0x1c0a79;});_0x237524['on'](_0x8976('0x20'),function(){_0xbd77c7(_0x374e75);});})['on']('error',function(_0x3d933d){_0x2f6115(_0x3d933d);})['end']();});}function convertFile(_0x5bc9b2,_0x3fe62b){return new BPromise(function(_0x1ca2b7,_0x53f4c1){var _0x4e503f=sox[_0x8976('0x23')](_0x5bc9b2,_0x3fe62b,{'sampleRate':0x1f40,'format':_0x8976('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4e503f['on'](_0x8976('0x17'),function(_0x407527){logger[_0x8976('0x17')](_0x8976('0x25'),_0x407527);_0x53f4c1(_0x407527);});_0x4e503f['on']('end',function(){logger[_0x8976('0x26')](_0x8976('0x27'));_0x1ca2b7();});_0x4e503f['start']();});}function base64Decode(_0x104cd1,_0x217227){var _0x1a7568=path[_0x8976('0x28')](__dirname,_0x8976('0x29'),rs[_0x8976('0x2a')](0x4)+'.wav');fs[_0x8976('0x2b')](_0x1a7568,_0x104cd1,_0x8976('0x2c'));return convertFile(_0x1a7568,_0x217227)[_0x8976('0x2d')](function(){try{fs[_0x8976('0x1d')](_0x1a7568);fs['chmodSync'](_0x217227,_0x8976('0x2e'));}catch(_0x2f3ddc){logger['error'](_0x2f3ddc);}return _0x217227[_0x8976('0x2f')]('.')[0x0];});}function base64Encode(_0x40850e){var _0x3b4edd=fs['readFileSync'](_0x40850e);return new Buffer(_0x3b4edd)[_0x8976('0x30')](_0x8976('0x2c'));}exports[_0x8976('0x31')]=function(_0x334fea,_0x22f7c0,_0x58caab,_0x1ede55,_0x18999e,_0x11fcfe){var _0x471809,_0x4f8fa8;var _0x24297f='https://texttospeech.googleapis.com/v1/';var _0x3f7f17='?key='+_0x334fea;var _0x487de0={};if(_0x22f7c0===_0x8976('0x32')){_0x487de0[_0x8976('0x33')]={'ssml':_0x58caab};}else{_0x487de0['input']={'text':_0x58caab};};_0x487de0[_0x8976('0x34')]={'languageCode':_0x1ede55,'ssmlGender':_0x18999e};_0x487de0[_0x8976('0x35')]={'audioEncoding':_0x8976('0x36'),'sampleRateHertz':0x1f40};var _0x103d7e={'url':_0x24297f+_0x8976('0x37')+_0x3f7f17,'method':'POST','json':!![],'body':_0x487de0};return rp(_0x103d7e)[_0x8976('0x2d')](function(_0x3669ba){return new BPromise(function(_0x5da8f1,_0x2eeb7c){_0x471809=path[_0x8976('0x28')](__dirname,_0x8976('0x29'),rs[_0x8976('0x2a')](0x4)+_0x8976('0x38'));var _0x554fdd=Buffer[_0x8976('0x39')](_0x3669ba[_0x8976('0x3a')],_0x8976('0x2c'));return fs['writeFile'](_0x471809,_0x554fdd,function(_0x158984){_0x2eeb7c(_0x158984);},function(_0x26bd48){fs['chmodSync'](_0x471809,'777');_0x5da8f1(_0x26bd48);});});})[_0x8976('0x2d')](function(_0x5d4532){_0x4f8fa8=path[_0x8976('0x28')](__dirname,_0x8976('0x29'),rs['generate'](0x4)+_0x8976('0x3b'));return convertFile(_0x471809,_0x4f8fa8);})['then'](function(){try{fs[_0x8976('0x1d')](_0x471809);fs[_0x8976('0x3c')](_0x4f8fa8,_0x8976('0x2e'));}catch(_0x18e5f1){logger['error'](_0x18e5f1);}logger[_0x8976('0x26')](_0x8976('0x3d'),_0x4f8fa8[_0x8976('0x2f')]('.')[0x0]);return _0x4f8fa8[_0x8976('0x2f')]('.')[0x0];});};exports[_0x8976('0x3e')]=function(_0xa1a9ba,_0x322366){var _0x3a8bbd=_0x8976('0x3f');var _0x8087dd,_0x1305e9;var _0x4a6e11;var _0x795b7a={'encoding':_0x8976('0x40'),'method':'POST','timeout':0x2710,'url':_0x3a8bbd,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x8976('0x41')+encodeURIComponent(JSON[_0x8976('0x42')]([[[_0x8976('0x43'),JSON[_0x8976('0x42')]([_0xa1a9ba,_0x322366||'en',![],_0x8976('0x44')]),null,_0x8976('0x45')]]]))};return rp(_0x795b7a)[_0x8976('0x2d')](function(_0x389556){try{_0x4a6e11=eval(_0x389556[_0x8976('0x46')](0x5))[0x0][0x2];}catch(_0x10da95){throw new Error(_0x8976('0x47')+_0x389556[_0x8976('0x22')]);}if(!_0x4a6e11){if(_0xa1a9ba[_0x8976('0x48')]>0xc8){throw new Error(_0x8976('0x49'));}else{throw new Error(_0x8976('0x4a')+_0x322366+_0x8976('0x4b'));}}try{_0x4a6e11=eval(_0x4a6e11)[0x0];}catch(_0x2cf080){throw new Error(_0x8976('0x47')+res[_0x8976('0x22')]);}const _0x2f4224=_0x4a6e11;_0x8087dd=path[_0x8976('0x28')](__dirname,_0x8976('0x29'),rs['generate'](0x4)+'.mp3');fs['writeFileSync'](_0x8087dd,_0x4a6e11,{'encoding':'base64'});_0x1305e9=path[_0x8976('0x28')](__dirname,_0x8976('0x29'),rs[_0x8976('0x2a')](0x4)+_0x8976('0x3b'));return convertFile(_0x8087dd,_0x1305e9);})[_0x8976('0x2d')](function(){try{fs['unlink'](_0x8087dd);fs['chmodSync'](_0x1305e9,'777');}catch(_0xd27a28){logger['error'](_0xd27a28);}logger['info'](_0x8976('0x4c'),_0x1305e9[_0x8976('0x2f')]('.')[0x0]);return _0x1305e9[_0x8976('0x2f')]('.')[0x0];});};exports['googleASR']=function(_0x43a83e,_0x3fc943,_0x37f89a){return google[_0x8976('0x4d')](_0x43a83e,_0x3fc943,_0x37f89a)[_0x8976('0x2d')](function(_0x360941){logger[_0x8976('0x26')](_0x360941[_0x8976('0x4e')]);return rp(_0x360941);})[_0x8976('0x2d')](function(_0x2e3ff7){var _0x4c9443='';var _0x3c013c=0x0;try{fs[_0x8976('0x1d')](_0x43a83e);}catch(_0x4458bf){logger[_0x8976('0x17')](_0x4458bf);}if(_0x2e3ff7&&_0x2e3ff7[_0x8976('0x4f')]){_0x4c9443=_0x2e3ff7[_0x8976('0x4f')]['map'](function(_0x419a6e){return _0x419a6e&&_0x419a6e[_0x8976('0x50')][0x0]&&_0x419a6e[_0x8976('0x50')][0x0][_0x8976('0x51')]?_0x419a6e['alternatives'][0x0]['transcript']:'';})['join']('\x0a');_0x3c013c=_0x2e3ff7[_0x8976('0x4f')]['map'](function(_0x2d2f90){return _0x2d2f90&&_0x2d2f90[_0x8976('0x50')][0x0]&&_0x2d2f90['alternatives'][0x0][_0x8976('0x52')]?_0x2d2f90[_0x8976('0x50')][0x0][_0x8976('0x52')]:0x0;})[_0x8976('0x53')]('\x0a');}logger[_0x8976('0x26')](_0x8976('0x54'),_0x4c9443);logger['info'](_0x8976('0x55'),_0x3c013c);return{'transcript':_0x4c9443,'confidence':_0x3c013c};})['catch'](function(_0x3dca42){logger['error'](_0x8976('0x56'),_0x3dca42[_0x8976('0x16')],_0x3dca42['name'],_0x3dca42[_0x8976('0x57')]);});};exports['googleDialogflow']=function(_0x3378aa,_0x3f3bb0,_0x41a56b,_0x4d18d3){var _0x2f2a7a=apiai(_0x3f3bb0,{'language':_0x4d18d3||'en'});return _0x2f2a7a[_0x8976('0x58')](_0x41a56b,{'sessionId':md5(_0x3378aa)})[_0x8976('0x2d')](function(_0x1b0c4f){logger[_0x8976('0x26')](JSON[_0x8976('0x42')](_0x1b0c4f));return{'source':_0x1b0c4f[_0x8976('0x59')][_0x8976('0x5a')],'resolvedQuery':_0x1b0c4f[_0x8976('0x59')][_0x8976('0x5b')],'action':_0x1b0c4f[_0x8976('0x59')]['action'],'actionIncomplete':_0x1b0c4f[_0x8976('0x59')][_0x8976('0x5c')],'speech':_0x1b0c4f[_0x8976('0x59')]['fulfillment'][_0x8976('0x5d')],'score':_0x1b0c4f[_0x8976('0x59')][_0x8976('0x5e')],'statusCode':_0x1b0c4f[_0x8976('0x5f')]['code'],'endConversation':_0x1b0c4f['result'][_0x8976('0x60')]['endConversation']||![],'isFallbackIntent':_0x1b0c4f[_0x8976('0x59')]['metadata'][_0x8976('0x61')]};});};exports[_0x8976('0x62')]=function(_0x3f2dc1,_0x6c8d14,_0x29338a,_0x38a3f5,_0x15eb94,_0x369ec2){var _0x363789=_0x38a3f5[_0x8976('0x63')](/\\n/g,'\x0a');var _0x531997={'credentials':{'private_key':_0x363789,'client_email':_0x29338a}};var _0x2b16d6=new dialogflow[(_0x8976('0x64'))](_0x531997);var _0x56cd04=_0x2b16d6['sessionPath'](_0x6c8d14,md5(_0x3f2dc1));var _0x531756={'session':_0x56cd04,'queryInput':{'text':{'text':_0x15eb94,'languageCode':_0x369ec2}}};return _0x2b16d6[_0x8976('0x65')](_0x531756)[_0x8976('0x2d')](function(_0x4eb57c){if(_0x4eb57c&&_0x4eb57c[_0x8976('0x48')]){logger['info']('Dialogflow\x20V2\x20response:',JSON[_0x8976('0x42')](_0x4eb57c));var _0x4b4007=_0x4eb57c[0x0];if(_0x4b4007){var _0x1a98d5={'action':_0x4b4007[_0x8976('0x66')][_0x8976('0x67')],'allRequiredParamsPresent':_0x4b4007[_0x8976('0x66')][_0x8976('0x68')],'endConversation':_0x4b4007[_0x8976('0x66')][_0x8976('0x69')]&&_0x4b4007['queryResult'][_0x8976('0x69')]['fields']?_0x4b4007[_0x8976('0x66')]['diagnosticInfo'][_0x8976('0x6a')][_0x8976('0x6b')][_0x8976('0x6c')]:![],'fulfillmentText':_0x4b4007[_0x8976('0x66')]['fulfillmentText'],'intentName':_0x4b4007[_0x8976('0x66')][_0x8976('0x6d')][_0x8976('0x6e')],'intentDisplayName':_0x4b4007[_0x8976('0x66')][_0x8976('0x6d')][_0x8976('0x6f')],'isFallbackIntent':_0x4b4007[_0x8976('0x66')]['intent']['isFallback'],'languageCode':_0x4b4007[_0x8976('0x66')][_0x8976('0x70')],'queryText':_0x4b4007[_0x8976('0x66')]['queryText'],'responseId':_0x4b4007[_0x8976('0x71')],'score':_0x4b4007[_0x8976('0x66')][_0x8976('0x72')],'speech':_0x4b4007[_0x8976('0x66')][_0x8976('0x73')],'providerResponse':JSON[_0x8976('0x42')](_0x4eb57c)};return _0x1a98d5;}}});};exports[_0x8976('0x74')]=function(_0x233271,_0x42ca32,_0x3b8c9b,_0x4b8296){return tilde[_0x8976('0x4d')](_0x233271,_0x42ca32,_0x3b8c9b,_0x4b8296)[_0x8976('0x2d')](function(_0x3e1162){try{fs['unlink'](_0x233271);}catch(_0x244b21){logger[_0x8976('0x17')](_0x244b21);}logger[_0x8976('0x26')](_0x8976('0x75'),_0x3e1162[_0x8976('0x51')]);logger[_0x8976('0x26')]('Tilde\x20ASR\x20confidence',_0x3e1162[_0x8976('0x52')]);return _0x3e1162;});};exports['awsPolly']=function(_0x52645a,_0xe9738a,_0x1ea323,_0x5f781c,_0x460ea3,_0x163f2d){var _0x3872fc=path[_0x8976('0x28')](__dirname,_0x8976('0x29'),rs[_0x8976('0x2a')](0x4)+'.mp3');var _0x11d6f0;return aws[_0x8976('0x76')](_0x52645a,_0xe9738a,_0x1ea323,_0x5f781c,_0x460ea3,_0x163f2d,_0x3872fc)['then'](function(){_0x11d6f0=path[_0x8976('0x28')](__dirname,_0x8976('0x29'),rs['generate'](0x4)+_0x8976('0x3b'));return convertFile(_0x3872fc,_0x11d6f0);})[_0x8976('0x2d')](function(){try{fs[_0x8976('0x1d')](_0x3872fc);fs[_0x8976('0x3c')](_0x11d6f0,_0x8976('0x2e'));}catch(_0x424530){logger[_0x8976('0x17')](_0x424530);}return _0x11d6f0[_0x8976('0x2f')]('.')[0x0];});};exports[_0x8976('0x77')]=function(_0x5bdf57,_0x3c0438,_0x245bb4,_0x86d1df,_0x9c45f2,_0x347fed){return aws[_0x8976('0x78')](_0x5bdf57,_0x3c0438,_0x245bb4,_0x86d1df,_0x9c45f2,_0x347fed)[_0x8976('0x2d')](function(_0x1bf4e3){logger[_0x8976('0x26')](JSON[_0x8976('0x42')](_0x1bf4e3));return _0x1bf4e3;});};exports[_0x8976('0x79')]=function(_0x294b95,_0x4dd571,_0xf385e2,_0x448ce2){var _0x21006b=util[_0x8976('0x7a')](_0x8976('0x7b'),ISPEECH_API,_0x294b95,encodeURIComponent(_0x4dd571),_0xf385e2,_0x448ce2);var _0xf40ae6=path[_0x8976('0x28')](__dirname,'tmp',rs[_0x8976('0x2a')](0x4)+'.mp3');var _0x5e0164;return downloadFile(_0x21006b,_0xf40ae6)[_0x8976('0x2d')](function(){_0x5e0164=path[_0x8976('0x28')](__dirname,'tmp',rs[_0x8976('0x2a')](0x4)+'.wav');return convertFile(_0xf40ae6,_0x5e0164);})[_0x8976('0x2d')](function(){try{fs[_0x8976('0x1d')](_0xf40ae6);fs[_0x8976('0x3c')](_0x5e0164,_0x8976('0x2e'));}catch(_0x38ac45){logger['error'](_0x38ac45);}return _0x5e0164[_0x8976('0x2f')]('.')[0x0];});};exports[_0x8976('0x7c')]=function(_0x5298fa,_0x1df0b2,_0x24eae8,_0x5a886d){var _0x45d463=util['format'](_0x8976('0x7d'),ISPEECH_API,_0x1df0b2,_0x24eae8,base64Encode(_0x5298fa),_0x5a886d?util['format'](_0x8976('0x7e'),encodeURIComponent(_0x5a886d)):_0x8976('0x7f'));return uploadFile(_0x45d463)['then'](function(_0x4f8238){return querystring[_0x8976('0xc')](_0x4f8238);});};exports[_0x8976('0x80')]=function(_0x432135,_0x1ae0ee){return sestek[_0x8976('0x81')](_0x432135,_0x1ae0ee)[_0x8976('0x2d')](function(_0x5deca7){logger[_0x8976('0x26')](JSON[_0x8976('0x42')](_0x5deca7));var _0x205c0b={'speech':_0x5deca7['text'],'action':_0x5deca7[_0x8976('0x82')]?_0x5deca7['channelData'][_0x8976('0x83')]:undefined,'actiondata':_0x5deca7[_0x8976('0x82')]?_0x5deca7[_0x8976('0x82')]['CustomActionData']:undefined};if(_0x5deca7[_0x8976('0x82')]&&_0x5deca7['channelData'][_0x8976('0x84')]){return base64Decode(_0x5deca7[_0x8976('0x82')][_0x8976('0x84')][_0x8976('0x85')],path[_0x8976('0x28')](__dirname,_0x8976('0x29'),rs[_0x8976('0x2a')](0x4)+_0x8976('0x3b')))[_0x8976('0x2d')](function(_0x579d05){_0x205c0b[_0x8976('0x86')]=_0x579d05;return _0x205c0b;});}return _0x205c0b;});};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 f44ba67..8c5c772 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 _0x21c7=['./nda','exports'];(function(_0x5d6e30,_0xc21d51){var _0x3d3f3b=function(_0x33597b){while(--_0x33597b){_0x5d6e30['push'](_0x5d6e30['shift']());}};_0x3d3f3b(++_0xc21d51);}(_0x21c7,0x12e));var _0x721c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21c7[_0x3dd15e];return _0x231fd0;};var nda=require(_0x721c('0x0'));module[_0x721c('0x1')]={'nda':nda}; \ No newline at end of file +var _0x4f6e=['exports','./nda'];(function(_0x3b69f9,_0x52bab0){var _0x1b2e34=function(_0x48f9f7){while(--_0x48f9f7){_0x3b69f9['push'](_0x3b69f9['shift']());}};_0x1b2e34(++_0x52bab0);}(_0x4f6e,0x1d7));var _0xe4f6=function(_0x5bcb11,_0x5b5d84){_0x5bcb11=_0x5bcb11-0x0;var _0x3daa19=_0x4f6e[_0x5bcb11];return _0x3daa19;};var nda=require(_0xe4f6('0x0'));module[_0xe4f6('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 98d7114..87f5e5e 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 _0xd403=['custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','callerid','calleridname','dnid','text','Bearer\x20','access_token','body','channelData','ndagenerate_audio','audio/wav','custom_action','CustomAction'];(function(_0x199b2e,_0xd61cb1){var _0xde934=function(_0xee0cea){while(--_0xee0cea){_0x199b2e['push'](_0x199b2e['shift']());}};_0xde934(++_0xd61cb1);}(_0xd403,0x1d5));var _0x3d40=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xd403[_0x344a3f];return _0x264712;};'use strict';var rp=require(_0x3d40('0x0'));var url=require(_0x3d40('0x1'));var logger=require(_0x3d40('0x2'))(_0x3d40('0x3'));module['exports']=function(_0x381c5a,_0x572b70){var _0x24f320={'method':_0x3d40('0x4'),'uri':url[_0x3d40('0x5')](_0x572b70[_0x3d40('0x6')],_0x3d40('0x7')),'form':{'grant_type':_0x3d40('0x8'),'username':_0x572b70[_0x3d40('0x9')],'password':_0x572b70[_0x3d40('0x8')]},'json':!![]};return rp(_0x24f320)[_0x3d40('0xa')](function(_0x1f488d){var _0x210104={'method':_0x3d40('0x4'),'uri':url[_0x3d40('0x5')](_0x572b70[_0x3d40('0xb')],_0x3d40('0xc')),'body':{'type':_0x572b70[_0x3d40('0xd')]||'message','channelId':_0x3d40('0xe'),'conversation':{'id':_0x381c5a['uniqueid']},'from':{'id':_0x381c5a[_0x3d40('0xf')],'name':_0x381c5a[_0x3d40('0x10')]},'recipient':{'id':_0x381c5a[_0x3d40('0x11')],'name':_0x381c5a['extension']},'text':_0x572b70[_0x3d40('0x12')],'channelData':{}},'headers':{'Authorization':_0x3d40('0x13')+_0x1f488d[_0x3d40('0x14')]},'json':!![]};if(_0x572b70['project']){_0x210104[_0x3d40('0x15')][_0x3d40('0x16')]['ProjectName']=_0x572b70['project'];}if(_0x572b70[_0x3d40('0x17')]=='1'){_0x210104[_0x3d40('0x15')][_0x3d40('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3d40('0x18')};}if(_0x572b70[_0x3d40('0x19')]){_0x210104[_0x3d40('0x15')][_0x3d40('0x16')][_0x3d40('0x1a')]=_0x572b70[_0x3d40('0x19')];if(_0x572b70[_0x3d40('0x1b')]){_0x210104['body']['channelData'][_0x3d40('0x1c')]=_0x572b70[_0x3d40('0x1b')];}}logger[_0x3d40('0x1d')](JSON[_0x3d40('0x1e')](_0x210104));return rp(_0x210104);});}; \ No newline at end of file +var _0x9f4d=['ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','ndauth_url','password','username','then'];(function(_0x3f7146,_0x824eba){var _0x316350=function(_0x57d1c5){while(--_0x57d1c5){_0x3f7146['push'](_0x3f7146['shift']());}};_0x316350(++_0x824eba);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x4ce315,_0x388074){_0x4ce315=_0x4ce315-0x0;var _0x1a6160=_0x9f4d[_0x4ce315];return _0x1a6160;};'use strict';var rp=require(_0xd9f4('0x0'));var url=require(_0xd9f4('0x1'));var logger=require(_0xd9f4('0x2'))(_0xd9f4('0x3'));module[_0xd9f4('0x4')]=function(_0x81f443,_0x36dc75){var _0x273eb9={'method':_0xd9f4('0x5'),'uri':url['resolve'](_0x36dc75[_0xd9f4('0x6')],'/token'),'form':{'grant_type':_0xd9f4('0x7'),'username':_0x36dc75[_0xd9f4('0x8')],'password':_0x36dc75[_0xd9f4('0x7')]},'json':!![]};return rp(_0x273eb9)[_0xd9f4('0x9')](function(_0x5cf448){var _0x6b13b5={'method':_0xd9f4('0x5'),'uri':url['resolve'](_0x36dc75[_0xd9f4('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x36dc75[_0xd9f4('0xb')]||_0xd9f4('0xc'),'channelId':_0xd9f4('0xd'),'conversation':{'id':_0x81f443[_0xd9f4('0xe')]},'from':{'id':_0x81f443[_0xd9f4('0xf')],'name':_0x81f443['calleridname']},'recipient':{'id':_0x81f443[_0xd9f4('0x10')],'name':_0x81f443[_0xd9f4('0x11')]},'text':_0x36dc75[_0xd9f4('0x12')],'channelData':{}},'headers':{'Authorization':_0xd9f4('0x13')+_0x5cf448[_0xd9f4('0x14')]},'json':!![]};if(_0x36dc75[_0xd9f4('0x15')]){_0x6b13b5[_0xd9f4('0x16')][_0xd9f4('0x17')]['ProjectName']=_0x36dc75[_0xd9f4('0x15')];}if(_0x36dc75[_0xd9f4('0x18')]=='1'){_0x6b13b5[_0xd9f4('0x16')][_0xd9f4('0x17')][_0xd9f4('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xd9f4('0x1a')};}if(_0x36dc75[_0xd9f4('0x1b')]){_0x6b13b5[_0xd9f4('0x16')][_0xd9f4('0x17')][_0xd9f4('0x1c')]=_0x36dc75[_0xd9f4('0x1b')];if(_0x36dc75[_0xd9f4('0x1d')]){_0x6b13b5[_0xd9f4('0x16')]['channelData']['CustomActionData']=_0x36dc75['custom_action_data'];}}logger['info'](JSON[_0xd9f4('0x1e')](_0x6b13b5));return rp(_0x6b13b5);});}; \ 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 06e9291..27c5d88 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 _0x9d7a=['exports','./lib/api'];(function(_0x26ee4f,_0x3a459a){var _0x533604=function(_0x264b65){while(--_0x264b65){_0x26ee4f['push'](_0x26ee4f['shift']());}};_0x533604(++_0x3a459a);}(_0x9d7a,0xd7));var _0xa9d7=function(_0x4ff6bd,_0x2a8eb4){_0x4ff6bd=_0x4ff6bd-0x0;var _0x3d2eee=_0x9d7a[_0x4ff6bd];return _0x3d2eee;};'use strict';var asr=require(_0xa9d7('0x0'));module[_0xa9d7('0x1')]=function(_0x27917b,_0xcd6ec2,_0x23cceb,_0xd9ad7c){return asr(_0x27917b,_0xcd6ec2,_0x23cceb,_0xd9ad7c);}; \ No newline at end of file +var _0xeb9a=['exports','./lib/api'];(function(_0x3442b5,_0x4a5861){var _0xed4ecf=function(_0x5407a5){while(--_0x5407a5){_0x3442b5['push'](_0x3442b5['shift']());}};_0xed4ecf(++_0x4a5861);}(_0xeb9a,0x65));var _0xaeb9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xeb9a[_0x57b54c];return _0x59cc19;};'use strict';var asr=require(_0xaeb9('0x0'));module[_0xaeb9('0x1')]=function(_0x1f2a11,_0x3edd05,_0x1c894b,_0x4ef6e5){return asr(_0x1f2a11,_0x3edd05,_0x1c894b,_0x4ef6e5);}; \ 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 ebbf183..1ae14cf 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 _0x45ec=['info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports'];(function(_0x330e03,_0x2f8432){var _0x5884b5=function(_0x10837b){while(--_0x10837b){_0x330e03['push'](_0x330e03['shift']());}};_0x5884b5(++_0x2f8432);}(_0x45ec,0x91));var _0xc45e=function(_0xaa1b22,_0x499c7c){_0xaa1b22=_0xaa1b22-0x0;var _0x4ae294=_0x45ec[_0xaa1b22];return _0x4ae294;};'use strict';var BPromise=require(_0xc45e('0x0'));var _=require(_0xc45e('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xc45e('0x2'));var crypto=require(_0xc45e('0x3'));var logger=require(_0xc45e('0x4'))(_0xc45e('0x5'));module[_0xc45e('0x6')]=function(_0x1670b2,_0x56653b,_0x1a267a,_0x56d8e9){return new BPromise(function(_0x55b787,_0x2f2d4d){logger[_0xc45e('0x7')](_0xc45e('0x8'),_0x56d8e9||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x177f95=new WebSocket(_0x56d8e9||_0xc45e('0x9'),{'perMessageDeflate':![]});var _0x4366b7='';var _0x870fb2='0';var _0x80aae9='1';var _0x262cfb='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x53f8cb(_0x366038){var _0x3df2c6=crypto[_0xc45e('0xa')]('sha1');_0x3df2c6['update'](_0x366038);return _0x3df2c6['digest']('hex');}function _0x250da5(){try{logger[_0xc45e('0x7')](_0xc45e('0xb'));var _0x27934e=moment()[_0xc45e('0xc')]();var _0x3be7fe=_0x53f8cb(_0x27934e+_0x56653b+_0x1a267a);_0x177f95[_0xc45e('0xd')](JSON[_0xc45e('0xe')]({'appID':_0x56653b,'timestamp':_0x27934e,'appKey':_0x3be7fe}));var _0x4a4e39=fs[_0xc45e('0xf')](_0x1670b2);_0x4a4e39['on'](_0xc45e('0x10'),function(_0x213b2a){_0x177f95[_0xc45e('0xd')](_0x213b2a);});_0x4a4e39['on'](_0xc45e('0x11'),function(){_0x177f95['send'](_0xc45e('0x12'));});}catch(_0x1f252b){logger[_0xc45e('0x13')](_0xc45e('0x14'),JSON[_0xc45e('0xe')](_0x1f252b));_0x177f95[_0xc45e('0x15')]();}}function _0x135afe(_0x333160){try{if(_0x333160){var _0x18a975=JSON[_0xc45e('0x16')](_0x333160);switch(_0x18a975[_0xc45e('0x17')]){case 0x0:if(_0x18a975[_0xc45e('0x18')]){if(_0x18a975[_0xc45e('0x18')][_0xc45e('0x19')]){logger[_0xc45e('0x7')](_0xc45e('0x1a'),JSON['stringify'](_0x18a975[_0xc45e('0x18')][_0xc45e('0x1b')]));_0x4366b7=_0x18a975[_0xc45e('0x18')][_0xc45e('0x1b')][0x0]['transcript'];_0x870fb2=_0x18a975[_0xc45e('0x18')][_0xc45e('0x1b')][0x0]['likelihood'];_0x80aae9='0';_0x262cfb=_0xc45e('0x1c');_0x177f95['terminate']();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x80aae9='1';_0x262cfb=_0xc45e('0x1d');break;case 0x2:logger[_0xc45e('0x7')](_0xc45e('0x1e'));_0x80aae9='2';_0x262cfb=_0xc45e('0x1e');break;case 0x9:logger[_0xc45e('0x7')](_0xc45e('0x1f'));_0x80aae9='9';_0x262cfb=_0xc45e('0x1f');break;case 0xa:logger[_0xc45e('0x7')]('Authentication\x20failed.');_0x80aae9='10';_0x262cfb=_0xc45e('0x20');break;case 0xb:logger[_0xc45e('0x7')](_0xc45e('0x21'));_0x80aae9='11';_0x262cfb='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x36af1e){logger[_0xc45e('0x13')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xc45e('0xe')](_0x36af1e));_0x177f95['terminate']();}}function _0x5ed3f4(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x55b787({'transcript':_0x4366b7,'confidence':_0x870fb2,'status':_0x80aae9,'status_message':_0x262cfb});}function _0x1e71cb(_0x59448e){logger[_0xc45e('0x13')](_0xc45e('0x22'));if(!_['isNil'](_0x59448e)){logger[_0xc45e('0x13')](_[_0xc45e('0x23')](_0x59448e)?JSON[_0xc45e('0xe')](_0x59448e):_0x59448e);}}_0x177f95['on'](_0xc45e('0x24'),_0x250da5);_0x177f95['on'](_0xc45e('0x25'),_0x135afe);_0x177f95['on'](_0xc45e('0x11'),_0x5ed3f4);_0x177f95['on'](_0xc45e('0x13'),_0x1e71cb);});}; \ No newline at end of file +var _0x898b=['transcript','likelihood','terminate','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','moment','crypto','../../../../../../config/logger','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','data','send','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final','info','hypotheses'];(function(_0x175bcf,_0x21a5b9){var _0xbc7b49=function(_0x3541be){while(--_0x3541be){_0x175bcf['push'](_0x175bcf['shift']());}};_0xbc7b49(++_0x21a5b9);}(_0x898b,0xf1));var _0xb898=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x898b[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xb898('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xb898('0x1'));var crypto=require(_0xb898('0x2'));var logger=require(_0xb898('0x3'))('agi');module[_0xb898('0x4')]=function(_0xabd220,_0x2022be,_0x8b371b,_0x401095){return new BPromise(function(_0x40a064,_0x4e116a){logger['info'](_0xb898('0x5'),_0x401095||_0xb898('0x6'));var _0x335e1a=new WebSocket(_0x401095||_0xb898('0x6'),{'perMessageDeflate':![]});var _0xf705b2='';var _0x4cf3e2='0';var _0x5a51bd='1';var _0x55807b='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x506165(_0x2822fa){var _0x5ce8a5=crypto[_0xb898('0x7')](_0xb898('0x8'));_0x5ce8a5[_0xb898('0x9')](_0x2822fa);return _0x5ce8a5['digest'](_0xb898('0xa'));}function _0x1806f0(){try{logger['info'](_0xb898('0xb'));var _0x8de1ce=moment()[_0xb898('0xc')]();var _0x2f22cc=_0x506165(_0x8de1ce+_0x2022be+_0x8b371b);_0x335e1a['send'](JSON[_0xb898('0xd')]({'appID':_0x2022be,'timestamp':_0x8de1ce,'appKey':_0x2f22cc}));var _0x3ee196=fs[_0xb898('0xe')](_0xabd220);_0x3ee196['on'](_0xb898('0xf'),function(_0x1d7e88){_0x335e1a[_0xb898('0x10')](_0x1d7e88);});_0x3ee196['on']('close',function(){_0x335e1a[_0xb898('0x10')]('EOS');});}catch(_0x1a3527){logger[_0xb898('0x11')](_0xb898('0x12'),JSON[_0xb898('0xd')](_0x1a3527));_0x335e1a['terminate']();}}function _0x1248bd(_0x2ff473){try{if(_0x2ff473){var _0x2409c7=JSON[_0xb898('0x13')](_0x2ff473);switch(_0x2409c7[_0xb898('0x14')]){case 0x0:if(_0x2409c7[_0xb898('0x15')]){if(_0x2409c7[_0xb898('0x15')][_0xb898('0x16')]){logger[_0xb898('0x17')]('Tilde\x20ASR\x20hypoteses',JSON[_0xb898('0xd')](_0x2409c7[_0xb898('0x15')][_0xb898('0x18')]));_0xf705b2=_0x2409c7[_0xb898('0x15')][_0xb898('0x18')][0x0][_0xb898('0x19')];_0x4cf3e2=_0x2409c7[_0xb898('0x15')][_0xb898('0x18')][0x0][_0xb898('0x1a')];_0x5a51bd='0';_0x55807b='Success.';_0x335e1a[_0xb898('0x1b')]();}}break;case 0x1:logger[_0xb898('0x17')](_0xb898('0x1c'));_0x5a51bd='1';_0x55807b='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xb898('0x17')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x5a51bd='2';_0x55807b='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xb898('0x17')](_0xb898('0x1d'));_0x5a51bd='9';_0x55807b='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info'](_0xb898('0x1e'));_0x5a51bd='10';_0x55807b=_0xb898('0x1e');break;case 0xb:logger['info'](_0xb898('0x1f'));_0x5a51bd='11';_0x55807b=_0xb898('0x1f');}}}catch(_0x2d7961){logger['error'](_0xb898('0x20'),JSON[_0xb898('0xd')](_0x2d7961));_0x335e1a['terminate']();}}function _0x215146(){logger[_0xb898('0x17')]('Close\x20Tilde\x20ASR\x20socket');_0x40a064({'transcript':_0xf705b2,'confidence':_0x4cf3e2,'status':_0x5a51bd,'status_message':_0x55807b});}function _0x1fe8cf(_0x30bcc0){logger[_0xb898('0x11')](_0xb898('0x21'));if(!_[_0xb898('0x22')](_0x30bcc0)){logger['error'](_[_0xb898('0x23')](_0x30bcc0)?JSON[_0xb898('0xd')](_0x30bcc0):_0x30bcc0);}}_0x335e1a['on'](_0xb898('0x24'),_0x1806f0);_0x335e1a['on'](_0xb898('0x25'),_0x1248bd);_0x335e1a['on']('close',_0x215146);_0x335e1a['on'](_0xb898('0x11'),_0x1fe8cf);});}; \ 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 5b7cdea..1df7f37 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 _0x70c8=['exports'];(function(_0x3d22b6,_0x39d37b){var _0xae31a9=function(_0x4b1a5a){while(--_0x4b1a5a){_0x3d22b6['push'](_0x3d22b6['shift']());}};_0xae31a9(++_0x39d37b);}(_0x70c8,0x141));var _0x870c=function(_0x2fb8fb,_0x5192d0){_0x2fb8fb=_0x2fb8fb-0x0;var _0x444a0a=_0x70c8[_0x2fb8fb];return _0x444a0a;};var asr=require('./asr');module[_0x870c('0x0')]={'asr':asr}; \ No newline at end of file +var _0x151e=['./asr','exports'];(function(_0x38a862,_0x3efd4d){var _0x1f6d43=function(_0xcbd044){while(--_0xcbd044){_0x38a862['push'](_0x38a862['shift']());}};_0x1f6d43(++_0x3efd4d);}(_0x151e,0x176));var _0xe151=function(_0x5c879e,_0xe58074){_0x5c879e=_0x5c879e-0x0;var _0x30942b=_0x151e[_0x5c879e];return _0x30942b;};var asr=require(_0xe151('0x0'));module[_0xe151('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 2c0817c..ac53515 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x5a7e78,_0x400b57){var _0xa8d4a1=function(_0x486659){while(--_0x486659){_0x5a7e78['push'](_0x5a7e78['shift']());}};_0xa8d4a1(++_0x400b57);}(_0xe706,0xa3));var _0x6e70=function(_0x5c3993,_0x5b9b11){_0x5c3993=_0x5c3993-0x0;var _0x5144ab=_0xe706[_0x5c3993];return _0x5144ab;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x1cd577,_0x180f2a){var _0x790837=function(_0x2cace5){while(--_0x2cace5){_0x1cd577['push'](_0x1cd577['shift']());}};_0x790837(++_0x180f2a);}(_0xe706,0xa3));var _0x6e70=function(_0x4489f2,_0x1f9128){_0x4489f2=_0x4489f2-0x0;var _0x5cc527=_0xe706[_0x4489f2];return _0x5cc527;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index efefd63..a5965fc 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 _0x4006=['VOICEMAIL','no\x20variable\x20selected','exports','lodash','shelljs','odbc','randomstring','request-promise','agi','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueue','then','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSound','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervalById','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','priority','dnid','file','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','number','timeout','includes','PUT','toUpperCase','body','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','uri','render','parse','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','split','getAndSetVariable','result','extra','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','label','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','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','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPSynth','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','Executed\x20command\x20%s','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','createSquareMessage','DIALOGFLOW_%s','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','speech','dialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','SESTEK_NDA_%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','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','awsLex','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','%s/recordings/%s','beep','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','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','login','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','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','opts','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','replace','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','getMailAccount','account_id','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','sms_account_id','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','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','command','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block'];(function(_0x4b7823,_0x54eeac){var _0x4b08fe=function(_0x3ce0c8){while(--_0x3ce0c8){_0x4b7823['push'](_0x4b7823['shift']());}};_0x4b08fe(++_0x54eeac);}(_0x4006,0x1c7));var _0x6400=function(_0x4d7551,_0x7cba1c){_0x4d7551=_0x4d7551-0x0;var _0x36fb51=_0x4006[_0x4d7551];return _0x36fb51;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x6400('0x0'));var sh=require(_0x6400('0x1'));var odbc=require(_0x6400('0x2'))();var rs=require(_0x6400('0x3'));var moment=require('moment');var Mustache=require('mustache');var rp=require(_0x6400('0x4'));var logger=require('../../config/logger')(_0x6400('0x5'));var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH=_0x6400('0x6');var recursiveMapAttributes=['rawHeaders',_0x6400('0x7')];var verticesWithRetry=[_0x6400('0x8'),_0x6400('0x9'),_0x6400('0xa')];var AGIVertices=function(_0x5cbe4f,_0x31cc99,_0x46819e){this[_0x6400('0xb')]=_0x5cbe4f;this[_0x6400('0xc')]=_0x31cc99;this[_0x6400('0xd')]=_0x46819e;};AGIVertices[_0x6400('0xe')][_0x6400('0xf')]=function(_0xc3cf61,_0x237e22){this[_0x6400('0xc')][_0x6400('0x10')](_0xc3cf61)['then'](function(_0x457d1a){_0x237e22(null,_0x457d1a?_0x457d1a[_0x6400('0x11')]:![]);})[_0x6400('0x12')](function(_0x36bf00){_0x237e22(_0x36bf00);});};AGIVertices['prototype'][_0x6400('0x13')]=function(_0x2acc34,_0x4ed062){this['rpc']['getVoiceQueueById'](_0x2acc34)[_0x6400('0x14')](function(_0x18c2e3){_0x4ed062(null,_0x18c2e3?_0x18c2e3['name']:![]);})[_0x6400('0x12')](function(_0x4ae3ea){_0x4ed062(_0x4ae3ea);});};AGIVertices[_0x6400('0xe')]['getSquareProject']=function(_0x13d595,_0x430cb4){this[_0x6400('0xc')][_0x6400('0x15')](_0x13d595)['then'](function(_0x444bce){_0x430cb4(null,_0x444bce?_0x444bce[_0x6400('0x11')]:![]);})[_0x6400('0x12')](function(_0x50524f){_0x430cb4(_0x50524f);});};AGIVertices[_0x6400('0xe')][_0x6400('0x16')]=function(_0x4b22f9,_0x36a8f5){this[_0x6400('0xc')][_0x6400('0x17')](_0x4b22f9)['then'](function(_0xf4ce95){_0x36a8f5(null,_0xf4ce95?_0xf4ce95[_0x6400('0x18')]:![]);})[_0x6400('0x12')](function(_0xb04eb6){_0x36a8f5(_0xb04eb6);});};AGIVertices[_0x6400('0xe')][_0x6400('0x19')]=function(_0x8eb4ac,_0x171e39){this[_0x6400('0xc')][_0x6400('0x1a')](_0x8eb4ac)['then'](function(_0x465c68){_0x171e39(null,_0x465c68?_0x465c68['name']:![]);})['catch'](function(_0x257d80){_0x171e39(_0x257d80);});};AGIVertices[_0x6400('0xe')][_0x6400('0x1b')]=function(_0x43fab2,_0x5322b8){this[_0x6400('0xc')]['getTrunkById'](_0x43fab2)[_0x6400('0x14')](function(_0x506732){_0x5322b8(null,_0x506732?_0x506732[_0x6400('0x11')]:![]);})[_0x6400('0x12')](function(_0x577156){_0x5322b8(_0x577156);});};AGIVertices[_0x6400('0xe')][_0x6400('0x1c')]=function(_0x3c58b8,_0x56b285){var _0x208cb1=this;this['rpc']['getSoundById'](_0x3c58b8)[_0x6400('0x14')](function(_0x4bb214){_0x56b285(null,_0x4bb214?_0x208cb1[_0x6400('0x1d')](_0x4bb214[_0x6400('0x1e')]):![]);})['catch'](function(_0x452a2c){_0x56b285(_0x452a2c);});};AGIVertices['prototype']['getMailAccount']=function(_0x2ab43e,_0x165170){this[_0x6400('0xc')][_0x6400('0x1f')](_0x2ab43e)[_0x6400('0x14')](function(_0x54cf9f){_0x165170(null,_0x54cf9f?_0x54cf9f:![]);})[_0x6400('0x12')](function(_0x21a324){_0x165170(_0x21a324);});};AGIVertices[_0x6400('0xe')][_0x6400('0x20')]=function(_0x57c3fb,_0x437624,_0x356f4d){this[_0x6400('0xd')]['sendMailMessage'](_0x57c3fb,_0x437624)[_0x6400('0x14')](function(){_0x356f4d(null);})[_0x6400('0x12')](function(_0x2eea52){_0x356f4d(_0x2eea52);});};AGIVertices[_0x6400('0xe')]['getIntervals']=function(_0x1aec8b,_0x111676){this['rpc'][_0x6400('0x21')](_0x1aec8b)[_0x6400('0x14')](function(_0x50ba26){if(_0x50ba26){if(_0x50ba26['IntervalId']){_0x111676(null,[_0x50ba26[_0x6400('0x22')]]);}else{_0x111676(null,_[_0x6400('0x23')](_0x50ba26[_0x6400('0x24')],'interval'));}}else{_0x111676(null,![]);}})['catch'](function(_0x506898){_0x111676(_0x506898);});};AGIVertices[_0x6400('0xe')][_0x6400('0x1d')]=function(_0x270c9d){return util[_0x6400('0x25')](_0x6400('0x26'),FILES_PATH,_0x270c9d);};AGIVertices['prototype'][_0x6400('0x27')]=function(_0x36f2a5,_0x5eccda,_0x51425c){odbc[_0x6400('0x28')](_0x36f2a5,function(_0x18b77f){if(_0x18b77f){logger[_0x6400('0x29')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x18b77f);_0x51425c(_0x18b77f);}else{logger[_0x6400('0x2a')](_0x6400('0x2b'));odbc[_0x6400('0x2c')](_0x5eccda,function(_0x491ea9,_0x441a05){if(_0x491ea9){logger[_0x6400('0x2a')](_0x6400('0x2d'),_0x5eccda);_0x51425c(_0x491ea9);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x5eccda);odbc['close'](function(_0x46bbfb){if(_0x46bbfb){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x46bbfb);}_0x51425c(null,_0x441a05);});}});}});};AGIVertices[_0x6400('0xe')][_0x6400('0x2e')]=function(_0x565942,_0x150158){this[_0x6400('0xc')][_0x6400('0x2f')](_0x565942)['then'](function(_0x9536e5){_0x150158(null,_0x9536e5?_0x9536e5:![]);})[_0x6400('0x12')](function(_0x5f27cd){_0x150158(_0x5f27cd);});};AGIVertices[_0x6400('0xe')]['createSmsMessage']=function(_0x51a9e8,_0x32dc71){this[_0x6400('0xc')][_0x6400('0x30')](_0x51a9e8)['then'](function(_0x19fb53){_0x32dc71(null,_0x19fb53);})[_0x6400('0x12')](function(_0x1bdc8c){_0x32dc71(_0x1bdc8c);});};AGIVertices[_0x6400('0xe')][_0x6400('0x31')]=function(_0x557133,_0x24d0c7,_0x5bd24c){this[_0x6400('0xc')][_0x6400('0x31')]({'uniqueid':this[_0x6400('0xb')][_0x6400('0x32')],'node':_0x557133['label'],'application':_0x557133[_0x6400('0x33')],'data':_0x24d0c7||null,'project_name':this[_0x6400('0xb')][_0x6400('0x34')],'callerid':this[_0x6400('0xb')]['callerid']})[_0x6400('0x14')](function(_0x52ce53){if(_0x5bd24c){_0x5bd24c(null,_0x52ce53);}})[_0x6400('0x12')](function(_0x52cc77){if(_0x5bd24c){_0x5bd24c(_0x52cc77);}});};AGIVertices[_0x6400('0xe')][_0x6400('0x35')]=function(_0x3084e8,_0x5712f1,_0x2c62c4,_0x4905c7){this[_0x6400('0xc')][_0x6400('0x35')]({'uniqueid':this[_0x6400('0xb')][_0x6400('0x32')],'callerid':this[_0x6400('0xb')][_0x6400('0x36')],'calleridname':this[_0x6400('0xb')][_0x6400('0x37')],'context':this[_0x6400('0xb')][_0x6400('0x38')],'extension':this[_0x6400('0xb')]['extension'],'priority':this[_0x6400('0xb')][_0x6400('0x39')],'accountcode':this[_0x6400('0xb')]['accountcode'],'dnid':this[_0x6400('0xb')][_0x6400('0x3a')],'projectName':this[_0x6400('0xb')]['arg_1'],'saveName':_0x5712f1,'filename':_0x3084e8[_0x6400('0x3b')]||_0x5712f1,'savePath':_0x2c62c4})['then'](function(_0x518ee4){_0x4905c7(null,_0x518ee4);})['catch'](function(_0x32c3d0){_0x4905c7(_0x32c3d0);});};AGIVertices[_0x6400('0xe')]['createSquareMessage']=function(_0x3b659b,_0x9737b3,_0x5bc05a,_0x48bc20,_0x35cd68){this[_0x6400('0xc')]['createSquareMessage']({'uniqueid':this[_0x6400('0xb')][_0x6400('0x32')],'body':_0x3b659b,'direction':_0x9737b3,'providerName':_0x5bc05a,'providerResponse':_0x48bc20})[_0x6400('0x14')](function(_0x3f0e97){if(_0x35cd68){_0x35cd68(null,_0x3f0e97);}})[_0x6400('0x12')](function(_0x272019){if(_0x35cd68){_0x35cd68(_0x272019);}});};AGIVertices[_0x6400('0xe')]['createCmContact']=function(_0x46c582,_0x801179){this[_0x6400('0xc')][_0x6400('0x3c')]({'firstName':_[_0x6400('0x3d')](_0x46c582[_0x6400('0x11')])||_[_0x6400('0x3e')](_0x46c582['name'])?_0x6400('0x3f')+Math['random']():_0x46c582['name'],'lastName':_[_0x6400('0x3d')](_0x46c582[_0x6400('0x40')])||_[_0x6400('0x3e')](_0x46c582['lastName'])?null:_0x46c582[_0x6400('0x40')],'phone':_0x46c582[_0x6400('0x41')],'ListId':_0x46c582[_0x6400('0x42')],'scheduledat':_0x46c582[_0x6400('0x43')],'callbackUniqueid':this[_0x6400('0xb')]['uniqueid'],'tags':_0x6400('0x44'),'description':_0x6400('0x45')+_0x46c582['scheduledAt'][_0x6400('0x46')](),'priority':_0x46c582[_0x6400('0x47')]})[_0x6400('0x14')](function(_0x5be721){_0x801179(null,_0x5be721);})[_0x6400('0x12')](function(_0x489042){_0x801179(_0x489042);});};AGIVertices[_0x6400('0xe')][_0x6400('0x48')]=function(_0x190d71,_0xf2d2b7){this[_0x6400('0xc')][_0x6400('0x49')](_0x190d71)['then'](function(_0x1ce65e){_0xf2d2b7(null,_0x1ce65e?_0x1ce65e[_0x6400('0x11')]:![]);})['catch'](function(_0x1c3ca6){_0xf2d2b7(_0x1c3ca6);});};AGIVertices[_0x6400('0xe')][_0x6400('0x4a')]=function(_0x17f72d,_0x4d4e57,_0x223491){var _0x338d28={'role':_0x6400('0x4b')};_0x338d28[_0x17f72d]=this[_0x6400('0xb')][_0x6400('0x36')];this[_0x6400('0xc')][_0x6400('0x4a')](_0x338d28,_0x4d4e57,this[_0x6400('0xb')][_0x6400('0x32')])[_0x6400('0x14')](function(_0x372ae2){_0x223491(null,_[_0x6400('0x3e')](_0x372ae2)?![]:!![]);})['catch'](function(_0x348670){logger[_0x6400('0x29')](_0x348670);_0x223491(null,![]);});};AGIVertices['prototype'][_0x6400('0x4c')]=function(_0x5057ba,_0x2ab58f){var _0x2c6684={'role':'agent'};_0x2c6684[_0x5057ba]=this[_0x6400('0xb')]['callerid'];this[_0x6400('0xc')]['agentUnpause'](_0x2c6684)[_0x6400('0x14')](function(_0x329367){_0x2ab58f(null,_[_0x6400('0x3e')](_0x329367)?![]:!![]);})[_0x6400('0x12')](function(_0x3e0461){logger[_0x6400('0x29')](_0x3e0461);_0x2ab58f(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x2033cc,_0x3c4944){var _0x49b7df={'role':_0x6400('0x4b')};_0x49b7df[_0x2033cc]=this['channel']['callerid'];this[_0x6400('0xc')][_0x6400('0x4d')](_0x49b7df)[_0x6400('0x14')](function(_0x22245f){_0x3c4944(null,_[_0x6400('0x3e')](_0x22245f)?![]:!![]);})[_0x6400('0x12')](function(_0x451675){logger['error'](_0x451675);_0x3c4944(null,![]);});};AGIVertices[_0x6400('0xe')][_0x6400('0x4e')]=function(_0x29522c,_0x567761){var _0x558a96={'role':_0x6400('0x4b')};_0x558a96[_0x29522c]=this[_0x6400('0xb')][_0x6400('0x36')];var _0x5e5a37=_0x29522c!=_0x6400('0x4f')?util['format'](_0x6400('0x50'),_0x6400('0x51'),this['channel'][_0x6400('0x36')]):undefined;this[_0x6400('0xc')][_0x6400('0x4e')](_0x558a96,_0x5e5a37)[_0x6400('0x14')](function(_0x4439d0){_0x567761(null,_[_0x6400('0x3e')](_0x4439d0)?![]:!![]);})[_0x6400('0x12')](function(_0x5d0ad6){logger[_0x6400('0x29')](_0x5d0ad6);_0x567761(null,![]);});};AGIVertices[_0x6400('0xe')][_0x6400('0x52')]=function(_0x1acdaf,_0x253983){sh[_0x6400('0x53')](_['trim'](_0x1acdaf),function(_0x43699a,_0x417492){var _0x5cd76a=_0x417492['replace'](/(\r\n|\n|\r)/gm,'');_0x253983(null,_0x5cd76a);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x34a7f5,_0x3774cb){scripts[_0x6400('0x54')](_0x34a7f5[_0x6400('0x55')],_0x34a7f5['google_cloud_tts_text_type']||_0x6400('0x56'),_0x34a7f5[_0x6400('0x56')],_0x34a7f5[_0x6400('0x57')]||_0x6400('0x58'),_0x34a7f5[_0x6400('0x59')]||_0x6400('0x5a'),_0x34a7f5['audioEncoding']||_0x6400('0x5b'))[_0x6400('0x14')](function(_0xaafcd9){_0x3774cb(null,_0xaafcd9);})[_0x6400('0x12')](function(_0x3d23ad){_0x3774cb(_0x3d23ad);});};AGIVertices[_0x6400('0xe')][_0x6400('0x5c')]=function(_0x59da00,_0x315315){scripts[_0x6400('0x5c')](_0x59da00[_0x6400('0x56')],_0x59da00[_0x6400('0x5d')]||'en',0x1)[_0x6400('0x14')](function(_0x67e41c){_0x315315(null,_0x67e41c);})[_0x6400('0x12')](function(_0xa22689){_0x315315(_0xa22689);});};AGIVertices[_0x6400('0xe')][_0x6400('0x5e')]=function(_0x1bf9f3,_0x5eacb8){var _0x532e27={'uri':_0x1bf9f3[_0x6400('0x5f')],'method':_0x1bf9f3['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x1bf9f3['timeout'])===_0x6400('0x60')&&parseInt(_0x1bf9f3[_0x6400('0x61')])>=0x1?parseInt(_0x1bf9f3[_0x6400('0x61')])*0x3e8:0x5*0x3e8};if(_[_0x6400('0x62')](['POST',_0x6400('0x63')],_0x532e27['method'][_0x6400('0x64')]())){try{_0x532e27[_0x6400('0x65')]=_0x1bf9f3[_0x6400('0x7')]?JSON['parse'](_0x1bf9f3[_0x6400('0x7')]):{};}catch(_0x7de61b){logger[_0x6400('0x29')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x7de61b);}}try{_0x532e27[_0x6400('0x66')]=_0x1bf9f3[_0x6400('0x67')]?JSON['parse'](_0x1bf9f3[_0x6400('0x67')]):{};}catch(_0x3dafb9){logger[_0x6400('0x29')](_0x6400('0x68'),_0x3dafb9);}if(_0x1bf9f3['computedVariables']){try{var _0x5cefda=require(_0x1bf9f3['computedVariables'])[_0x6400('0x69')](this,_0x532e27);_0x532e27[_0x6400('0x6a')]=Mustache[_0x6400('0x6b')](_0x1bf9f3[_0x6400('0x5f')],_0x5cefda,{},['$$','$$']);if(_0x532e27['headers']){_0x532e27[_0x6400('0x66')]=JSON[_0x6400('0x6c')](Mustache[_0x6400('0x6b')](JSON[_0x6400('0x6d')](_0x532e27[_0x6400('0x66')]),_0x5cefda,{},['$$','$$']));}if(_0x532e27['body']){_0x532e27['body']=JSON[_0x6400('0x6c')](Mustache['render'](JSON[_0x6400('0x6d')](_0x532e27[_0x6400('0x65')]),_0x5cefda,{},['$$','$$']));}}catch(_0x36a773){logger['error'](_0x6400('0x6e'),_0x36a773);}}rp(_0x532e27)[_0x6400('0x14')](function(_0x32da65){var _0x3ac2fc={'statusCode':_0x32da65[_0x6400('0x6f')]||0xc8,'statusMessage':_0x32da65[_0x6400('0x70')]||'OK','headers':_0x32da65[_0x6400('0x66')]||{},'body':_0x32da65[_0x6400('0x65')]||{}};_0x5eacb8(null,_0x3ac2fc);})[_0x6400('0x12')](function(_0x4048af){var _0x5997c7={'statusCode':_0x4048af[_0x6400('0x6f')]||0x1f4,'statusMessage':_0x4048af['message']||_0x6400('0x71'),'headers':_0x4048af[_0x6400('0x72')][_0x6400('0x66')]||{},'body':_0x4048af[_0x6400('0x72')][_0x6400('0x65')]||{}};_0x5eacb8(null,_0x5997c7);});};AGIVertices[_0x6400('0xe')][_0x6400('0x73')]=function(_0x35bbd4,_0x41797e){scripts['googleDialogflow'](this[_0x6400('0xb')][_0x6400('0x32')],_0x35bbd4[_0x6400('0x74')],_0x35bbd4[_0x6400('0x56')],_0x35bbd4[_0x6400('0x75')]||'en')[_0x6400('0x14')](function(_0x512e04){_0x41797e(null,_0x512e04);})[_0x6400('0x12')](function(_0x4f7e7c){_0x41797e(_0x4f7e7c);});};AGIVertices['prototype'][_0x6400('0x76')]=function(_0x229ddd,_0x109d99){scripts[_0x6400('0x76')](this['channel']['uniqueid'],_0x229ddd[_0x6400('0x77')],_0x229ddd['client_email'],_0x229ddd[_0x6400('0x78')],_0x229ddd['text'],_0x229ddd['dialogflowV2_language']||'en')[_0x6400('0x14')](function(_0xe76409){_0x109d99(null,_0xe76409);})[_0x6400('0x12')](function(_0x7a5e36){_0x109d99(_0x7a5e36);});};AGIVertices[_0x6400('0xe')][_0x6400('0x79')]=function(_0x509369,_0x55d61f){scripts[_0x6400('0x79')](this[_0x6400('0xb')],_0x509369)['then'](function(_0x1fb06b){_0x55d61f(null,_0x1fb06b);})['catch'](function(_0x399399){_0x55d61f(_0x399399);});};AGIVertices[_0x6400('0xe')][_0x6400('0x7a')]=function(_0x18cc29,_0x45dcfe){scripts[_0x6400('0x7a')](_0x18cc29[_0x6400('0x74')],_0x18cc29['text'],_0x18cc29[_0x6400('0x7b')]||'en-US',_0x18cc29['speed'])[_0x6400('0x14')](function(_0x4635d3){_0x45dcfe(null,_0x4635d3);})['catch'](function(_0x246906){_0x45dcfe(_0x246906);});};AGIVertices[_0x6400('0xe')][_0x6400('0x7c')]=function(_0x564d7c,_0x1a2840,_0x457836){scripts[_0x6400('0x7c')](_0x1a2840,_0x564d7c['key'],_0x564d7c[_0x6400('0x7d')]||_0x6400('0x58'),this[_0x6400('0x7e')](_0x564d7c['model'])?_0x564d7c[_0x6400('0x7f')]:undefined)[_0x6400('0x14')](function(_0x55da56){_0x457836(null,_0x55da56);})[_0x6400('0x12')](function(_0x1fc0d9){_0x457836(_0x1fc0d9);});};AGIVertices[_0x6400('0xe')][_0x6400('0x80')]=function(_0x25dfe1,_0x56f4cc){scripts['awsPolly'](_0x25dfe1[_0x6400('0x81')],_0x25dfe1[_0x6400('0x82')],_0x25dfe1[_0x6400('0x83')],_0x25dfe1['aws_polly_voice']||_0x6400('0x84'),_0x25dfe1[_0x6400('0x56')],_0x25dfe1[_0x6400('0x85')]||_0x6400('0x56'))['then'](function(_0x4b67ff){_0x56f4cc(null,_0x4b67ff);})[_0x6400('0x12')](function(_0x4a7b6a){_0x56f4cc(_0x4a7b6a);});};AGIVertices[_0x6400('0xe')]['awsLex']=function(_0x3a94f4,_0x11036f){scripts['awsLex'](this[_0x6400('0xb')][_0x6400('0x32')],_0x3a94f4[_0x6400('0x81')],_0x3a94f4[_0x6400('0x82')],_0x3a94f4[_0x6400('0x86')],_0x3a94f4[_0x6400('0x56')],_0x3a94f4[_0x6400('0x87')])[_0x6400('0x14')](function(_0x194086){_0x11036f(null,_0x194086);})['catch'](function(_0x540a29){_0x11036f(_0x540a29);});};AGIVertices[_0x6400('0xe')][_0x6400('0x88')]=function(_0x19e36e,_0x178b08,_0x2f8efe){scripts[_0x6400('0x88')](_0x178b08,_0x19e36e[_0x6400('0x74')],_0x19e36e[_0x6400('0x89')]||'en-US')[_0x6400('0x14')](function(_0x1dbe95){_0x2f8efe(null,_0x1dbe95);})[_0x6400('0x12')](function(_0x459b83){_0x2f8efe(_0x459b83);});};AGIVertices[_0x6400('0xe')][_0x6400('0x8a')]=function(_0x34a6fe,_0x4bf2a1,_0x37eb41){scripts[_0x6400('0x8a')](_0x4bf2a1,_0x34a6fe[_0x6400('0x8b')],_0x34a6fe[_0x6400('0x8c')],_0x34a6fe['uri'])[_0x6400('0x14')](function(_0x37969a){_0x37eb41(null,_0x37969a);})['catch'](function(_0x455b59){_0x37eb41(_0x455b59);});};AGIVertices[_0x6400('0xe')][_0x6400('0x8d')]=function(_0x241746){var _0x7f43eb=_[_0x6400('0x62')](verticesWithRetry,_0x241746['agicommand'])?_0x241746:_[_0x6400('0x8e')](_0x241746);for(var _0x3456df in _0x7f43eb){if(_0x7f43eb[_0x6400('0x8f')](_0x3456df)){if(_0x7f43eb[_0x3456df]&&_['isString'](_0x7f43eb[_0x3456df])){if(_[_0x6400('0x62')](recursiveMapAttributes,_0x3456df)){_0x7f43eb[_0x3456df]=this['replaceObjectAllVariables'](_0x7f43eb[_0x3456df]);}else{_0x7f43eb[_0x3456df]=this[_0x6400('0x90')](_0x7f43eb[_0x3456df]);}}}}return _0x7f43eb;};AGIVertices[_0x6400('0xe')][_0x6400('0x91')]=function(_0x381913){for(var _0x4982c8 in _0x381913){if(_0x381913['hasOwnProperty'](_0x4982c8)){if(_[_0x6400('0x92')](_0x381913[_0x4982c8])){this[_0x6400('0x91')](_0x381913[_0x4982c8]);}else if(_[_0x6400('0x93')](_0x381913[_0x4982c8])){for(var _0x3a0959=0x0;_0x3a0959<_0x381913[_0x4982c8][_0x6400('0x94')];_0x3a0959++){this[_0x6400('0x91')](_0x381913[_0x4982c8][_0x3a0959]);}}else if(_[_0x6400('0x95')](_0x381913[_0x4982c8])){_0x381913[_0x4982c8]=this[_0x6400('0x90')](_0x381913[_0x4982c8]);}}}};AGIVertices[_0x6400('0xe')][_0x6400('0x96')]=function(_0x499d7f,_0x2517ad){for(var _0x3e4ce4 in _0x499d7f){if(_0x499d7f[_0x6400('0x8f')](_0x3e4ce4)){if(_[_0x6400('0x92')](_0x499d7f[_0x3e4ce4])){if(!_[_0x6400('0x3d')](_0x499d7f[_0x3e4ce4])){this['saveRestApiResult'](_0x499d7f[_0x3e4ce4],util[_0x6400('0x25')](_0x6400('0x97'),_0x2517ad,_0x3e4ce4));}}else if(_[_0x6400('0x93')](_0x499d7f[_0x3e4ce4])){for(var _0x2eb4e0=0x0;_0x2eb4e0<_0x499d7f[_0x3e4ce4][_0x6400('0x94')];_0x2eb4e0++){this[_0x6400('0x96')](_0x499d7f[_0x3e4ce4][_0x2eb4e0],util[_0x6400('0x25')](_0x6400('0x97'),_0x2517ad,_0x3e4ce4+'['+_0x2eb4e0+']'));}}else{if(!_[_0x6400('0x3e')](_0x499d7f[_0x3e4ce4])){this[_0x6400('0xb')][_0x6400('0x98')](util[_0x6400('0x25')]('%s.%s',_0x2517ad,_0x3e4ce4),_0x499d7f[_0x3e4ce4]);}}}}};AGIVertices[_0x6400('0xe')][_0x6400('0x99')]=function(_0x424790){try{var _0x2490bb=JSON[_0x6400('0x6c')](_0x424790);this['recursiveNodeIndex'](_0x2490bb);return JSON[_0x6400('0x6d')](_0x2490bb);}catch(_0x1df33b){return this[_0x6400('0x90')](_0x424790);}};AGIVertices[_0x6400('0xe')]['replaceAllVariables']=function(_0x2efc5a){var _0x20226c=_0x2efc5a[_0x6400('0x9a')]('{');for(var _0x46d509=0x1;_0x46d509<_0x20226c[_0x6400('0x94')];_0x46d509+=0x1){var _0x359b10=_0x20226c[_0x46d509][_0x6400('0x9a')]('}');if(_0x359b10[_0x6400('0x94')]>0x1){_0x2efc5a=_0x2efc5a['replaceAll']('{'+_0x359b10[0x0]+'}',this[_0x6400('0xb')]['getVariable'](_0x359b10[0x0])['extra']||_0x359b10[0x0]);}}if(_0x20226c[_0x6400('0x94')]===0x1){return _0x2efc5a['toString']();}return this[_0x6400('0x90')](_0x2efc5a);};AGIVertices[_0x6400('0xe')][_0x6400('0x9b')]=function(_0x4de773,_0x11206e){var _0x4b7a86=this[_0x6400('0xb')][_0x6400('0xf')](_0x4de773);if(_0x4b7a86[_0x6400('0x9c')]===-0x1){return _0x4b7a86;}logger[_0x6400('0x2a')](util[_0x6400('0x25')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x11206e,_0x4b7a86['extra']));return this[_0x6400('0xb')][_0x6400('0x98')](_0x11206e,_0x4b7a86[_0x6400('0x9d')]);};AGIVertices[_0x6400('0xe')][_0x6400('0x7e')]=function(_0x81c40e){return _0x81c40e&&_0x81c40e!=='0'&&_0x81c40e!=='-1'&&_0x81c40e!=='';};AGIVertices[_0x6400('0xe')][_0x6400('0x9e')]=function(_0x4dcb49){this[_0x6400('0x31')][_0x6400('0x69')](this,_0x4dcb49,'-');_0x4dcb49[_0x6400('0x9f')]=_0x4dcb49[_0x6400('0x9e')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x6400('0xa0')]=function(_0x51ab76){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0xa1'),_0x51ab76['label']));if(!this['isConfigured'](_0x51ab76[_0x6400('0x56')])){return this[_0x6400('0xb')][_0x6400('0xa2')](_0x6400('0xa3'));}var _0xb9fb34='\x22'+_0x51ab76[_0x6400('0x56')]+'\x22';if(this[_0x6400('0x7e')](_0x51ab76[_0x6400('0x72')])){_0xb9fb34+=','+_0x51ab76[_0x6400('0x72')];}var _0x2b4fbe=this[_0x6400('0xb')]['exec']('MRCPSynth',_0xb9fb34);if(_0x2b4fbe[_0x6400('0x9c')]===-0x1){return _0x2b4fbe;}return this['channel'][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0xa4'),_0xb9fb34));};AGIVertices[_0x6400('0xe')][_0x6400('0xa5')]=function(_0x370d44){logger[_0x6400('0x2a')](util['format'](_0x6400('0xa6'),_0x370d44[_0x6400('0xa7')]));if(!this[_0x6400('0x7e')](_0x370d44['grammar'])){return this[_0x6400('0xb')]['noop'](_0x6400('0xa8'));}var _0x1c96ab=_0x370d44[_0x6400('0xa9')];if(this[_0x6400('0x7e')](_0x370d44[_0x6400('0x72')])){_0x1c96ab+=','+_0x370d44[_0x6400('0x72')];}var _0x56f905=this[_0x6400('0xb')][_0x6400('0x53')](_0x6400('0xaa'),_0x1c96ab);if(_0x56f905['result']===-0x1){return _0x56f905;}var _0x739c75=this[_0x6400('0x9b')](_0x6400('0xab'),_0x6400('0xac'));if(_0x739c75[_0x6400('0x9c')]===-0x1){return _0x739c75;}var _0x3ba98e=this[_0x6400('0x9b')](_0x6400('0xad'),_0x6400('0xae'));if(_0x3ba98e[_0x6400('0x9c')]===-0x1){return _0x3ba98e;}var _0x43125=this[_0x6400('0x9b')](_0x6400('0xaf'),_0x6400('0xb0'));if(_0x43125['result']===-0x1){return _0x43125;}return this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0xb1'),_0x1c96ab));};AGIVertices['prototype']['agi']=function(_0x34cfa7){logger[_0x6400('0x2a')](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x34cfa7[_0x6400('0xa7')]));return this[_0x6400('0xb')][_0x6400('0x5')]([_0x34cfa7['command'],_0x34cfa7['args']]);};AGIVertices[_0x6400('0xe')][_0x6400('0xb2')]=function(_0x4d4e4){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0xb3'),_0x4d4e4[_0x6400('0xa7')]));if(this[_0x6400('0x7e')](_0x4d4e4[_0x6400('0x61')])){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0xb4'),_0x4d4e4[_0x6400('0x61')]));var _0x34f88b=this[_0x6400('0xb')][_0x6400('0xb5')](_0x4d4e4[_0x6400('0x61')]);if(_0x34f88b['result']===-0x1){return _0x34f88b;}}return this[_0x6400('0xb')][_0x6400('0xb2')]();};AGIVertices[_0x6400('0xe')]['callback']=function(_0x1081f2){logger['info'](util['format'](_0x6400('0xb6'),_0x1081f2[_0x6400('0xa7')]));if(!this[_0x6400('0x7e')](_0x1081f2[_0x6400('0x42')])){return this[_0x6400('0xb')][_0x6400('0x29')](_0x1081f2,_0x6400('0xb7'));}_0x1081f2[_0x6400('0x43')]=moment();if(this[_0x6400('0x7e')](_0x1081f2[_0x6400('0xb8')])){_0x1081f2['scheduledAt']=moment()[_0x6400('0xb9')](_0x1081f2['delay'],_0x6400('0xba'));}if(!this['isConfigured'](_0x1081f2['callback_priority'])){_0x1081f2[_0x6400('0x47')]=0x2;}this[_0x6400('0x3c')][_0x6400('0x69')](this,_0x1081f2);return this[_0x6400('0xb')][_0x6400('0xa2')](util['format'](_0x6400('0xbb'),_0x1081f2[_0x6400('0x41')],_0x1081f2[_0x6400('0x42')],_0x1081f2['scheduledAt']));};AGIVertices[_0x6400('0xe')][_0x6400('0xbc')]=function(_0x9d578e){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0xbd'),_0x9d578e[_0x6400('0xa7')]));var _0x48198c=this['channel'][_0x6400('0x53')](_0x9d578e[_0x6400('0xbe')],_0x9d578e[_0x6400('0x72')]);if(_0x48198c[_0x6400('0x9c')]===-0x1){return _0x48198c;}return this['channel']['noop'](util['format'](_0x6400('0xbf'),_0x9d578e[_0x6400('0xbe')],_0x9d578e['options']));};AGIVertices[_0x6400('0xe')]['lumenvoxtts']=function(_0x52f5c7){logger['info'](util['format'](_0x6400('0xc0'),_0x52f5c7[_0x6400('0xa7')]));if(!this[_0x6400('0x7e')](_0x52f5c7[_0x6400('0x56')])){return this[_0x6400('0xb')]['noop'](_0x6400('0xa3'));}var _0x2d67e7='\x22'+_0x52f5c7[_0x6400('0x56')]+'\x22';if(this['isConfigured'](_0x52f5c7[_0x6400('0x72')])){_0x2d67e7+=','+_0x52f5c7[_0x6400('0x72')];}var _0x44586b=this['channel'][_0x6400('0x53')]('MRCPSynth',_0x2d67e7);if(_0x44586b[_0x6400('0x9c')]===-0x1){return _0x44586b;}return this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0xa4'),_0x2d67e7));};AGIVertices[_0x6400('0xe')][_0x6400('0xc1')]=function(_0x17456f){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0xc2'),_0x17456f[_0x6400('0xa7')]));if(!this[_0x6400('0x7e')](_0x17456f[_0x6400('0x56')])){return this[_0x6400('0xb')]['noop'](_0x6400('0xa3'));}var _0x58bf22='\x22'+_0x17456f[_0x6400('0x56')]+'\x22';if(this[_0x6400('0x7e')](_0x17456f[_0x6400('0x72')])){_0x58bf22+=','+_0x17456f[_0x6400('0x72')];}var _0x5797b1=this[_0x6400('0xb')]['exec'](_0x6400('0xc3'),_0x58bf22);if(_0x5797b1[_0x6400('0x9c')]===-0x1){return _0x5797b1;}return this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0xa4'),_0x58bf22));};AGIVertices[_0x6400('0xe')][_0x6400('0xc4')]=function(_0x2ae5c4){logger[_0x6400('0x2a')](util['format'](_0x6400('0xc5'),_0x2ae5c4[_0x6400('0xa7')]));if(!this[_0x6400('0x7e')](_0x2ae5c4[_0x6400('0xa9')])){return this[_0x6400('0xb')]['noop'](_0x6400('0xa8'));}var _0x33d48d=_0x2ae5c4[_0x6400('0xa9')];if(this[_0x6400('0x7e')](_0x2ae5c4[_0x6400('0x72')])){_0x33d48d+=','+_0x2ae5c4[_0x6400('0x72')];}var _0xdec2fd=this[_0x6400('0xb')][_0x6400('0x53')](_0x6400('0xaa'),_0x33d48d);if(_0xdec2fd[_0x6400('0x9c')]===-0x1){return _0xdec2fd;}var _0x5a7ff4=this[_0x6400('0x9b')]('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x5a7ff4['result']===-0x1){return _0x5a7ff4;}var _0x26a039=this[_0x6400('0x9b')]('RECOG_INPUT()',_0x6400('0xc6'));if(_0x26a039['result']===-0x1){return _0x26a039;}var _0x2caf86=this[_0x6400('0x9b')]('RECOG_INSTANCE()',_0x6400('0xc7'));if(_0x2caf86[_0x6400('0x9c')]===-0x1){return _0x2caf86;}return this[_0x6400('0xb')][_0x6400('0xa2')](util['format'](_0x6400('0xb1'),_0x33d48d));};AGIVertices['prototype'][_0x6400('0xc8')]=function(_0x591e7f){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0xc9'),_0x591e7f[_0x6400('0xa7')]));if(!this['isConfigured'](_0x591e7f[_0x6400('0xa9')])){return this['channel'][_0x6400('0xa2')](_0x6400('0xa8'));}var _0x1d089c=_0x591e7f[_0x6400('0xa9')];if(this[_0x6400('0x7e')](_0x591e7f['options'])){_0x1d089c+=','+_0x591e7f[_0x6400('0x72')];}var _0xc67c10=this[_0x6400('0xb')][_0x6400('0x53')](_0x6400('0xaa'),_0x1d089c);if(_0xc67c10[_0x6400('0x9c')]===-0x1){return _0xc67c10;}var _0x1935cf=this[_0x6400('0x9b')](_0x6400('0xab'),_0x6400('0xca'));if(_0x1935cf[_0x6400('0x9c')]===-0x1){return _0x1935cf;}var _0x477d94=this[_0x6400('0x9b')](_0x6400('0xad'),_0x6400('0xcb'));if(_0x477d94['result']===-0x1){return _0x477d94;}var _0x550e11=this['getAndSetVariable'](_0x6400('0xaf'),'SESTEK_ASR_INSTANCE');if(_0x550e11[_0x6400('0x9c')]===-0x1){return _0x550e11;}return this[_0x6400('0xb')][_0x6400('0xa2')](util['format'](_0x6400('0xb1'),_0x1d089c));};AGIVertices[_0x6400('0xe')][_0x6400('0xcc')]=function(_0x560130){logger['info'](util['format'](_0x6400('0xcd'),_0x560130[_0x6400('0xa7')]));if(!this[_0x6400('0x7e')](_0x560130[_0x6400('0xce')])){return this[_0x6400('0xb')]['error'](_0x560130,'no\x20database\x20selected');}var _0x4ff8e7=this['getSquareOdbc'][_0x6400('0x69')](this,_0x560130[_0x6400('0xce')]);if(!_0x4ff8e7){return this[_0x6400('0xb')]['error'](_0x560130,_0x6400('0xcf'));}if(!this[_0x6400('0x7e')](_0x560130[_0x6400('0x2c')])){return this[_0x6400('0xb')][_0x6400('0x29')](_0x560130,_0x6400('0xd0'));}var _0x29f206=_0x560130[_0x6400('0x2c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x6400('0xb')]['noop'](util[_0x6400('0x25')](_0x6400('0xd1'),_0x29f206));var _0x495604=this[_0x6400('0x27')]['sync'](this,_0x4ff8e7,_0x29f206);this['createSquareDetailsReport']['sync'](this,_0x560130,_0x29f206);if(!this[_0x6400('0x7e')](_0x560130[_0x6400('0xd2')])){return this[_0x6400('0xb')][_0x6400('0xa2')](_0x6400('0xd3'));}var _0x54ecfa=this[_0x6400('0xf')][_0x6400('0x69')](this,_0x560130[_0x6400('0xd2')]);if(!_0x54ecfa){return this['channel']['error'](_0x560130,_0x6400('0xd4'));}var _0x482e63=this;_0x495604['forEach'](function(_0xf24197,_0x238e23){Object[_0x6400('0xd5')](_0xf24197)[_0x6400('0xd6')](function(_0x170b7c){_0x482e63[_0x6400('0xb')]['setVariable'](util[_0x6400('0x25')]('%s[%s][%s]',_0x54ecfa,_0x238e23,_0x170b7c),_0xf24197[_0x170b7c]);});});this[_0x6400('0xb')][_0x6400('0x98')](util[_0x6400('0x25')](_0x6400('0xd7'),_0x54ecfa),_0x495604[_0x6400('0x94')]);return this['channel'][_0x6400('0xa2')](util['format'](_0x6400('0xd8'),_0x54ecfa));};AGIVertices[_0x6400('0xe')][_0x6400('0xd9')]=function(_0x15a2cf){logger['debug'](util[_0x6400('0x25')](_0x6400('0xda'),_0x15a2cf['label']));if(!this[_0x6400('0x7e')](_0x15a2cf[_0x6400('0xdb')])){return this[_0x6400('0xb')][_0x6400('0x29')](_0x15a2cf,_0x6400('0xdc'));}var _0x467a78=this[_0x6400('0x19')]['sync'](this,_0x15a2cf['sip_id']);if(!_0x467a78){return this['channel'][_0x6400('0x29')](_0x15a2cf,_0x6400('0xdd'));}var _0x4869de=this['channel'][_0x6400('0x53')]('DIAL',[util[_0x6400('0x25')](_0x6400('0xde'),_0x467a78),_0x15a2cf['timeout'],_0x15a2cf['opts'],_0x15a2cf[_0x6400('0x5f')]]);if(_0x4869de[_0x6400('0x9c')]===-0x1){return _0x4869de;}return this['channel'][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0xdf'),_0x6400('0xe0')));};AGIVertices['prototype']['dialogflow']=function(_0xcd5867){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0xe1'),_0xcd5867[_0x6400('0xa7')]));if(!this['isConfigured'](_0xcd5867[_0x6400('0x74')])){return this['channel']['noop']('no\x20key\x20configured');}if(!this[_0x6400('0x7e')](_0xcd5867[_0x6400('0x56')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x6400('0xb')][_0x6400('0xe2')]=!![];this['createSquareDetailsReport'](_0xcd5867);this[_0x6400('0xe3')](_0xcd5867[_0x6400('0x56')],'in','','');this[_0x6400('0xb')][_0x6400('0xa2')](util['format']('Trying\x20Dialogflow:\x20%s',_0xcd5867[_0x6400('0x56')]));var _0x3af52e=this[_0x6400('0x73')][_0x6400('0x69')](this,_0xcd5867);if(_0x3af52e){for(var _0x578b5b in _0x3af52e){if(_0x3af52e[_0x6400('0x8f')](_0x578b5b)){this[_0x6400('0xb')][_0x6400('0x98')](util[_0x6400('0x25')](_0x6400('0xe4'),_0x578b5b['toUpperCase']()),_0x3af52e[_0x578b5b]);}}this['createSquareMessage'](_0x3af52e['speech'],_0x6400('0xe5'),_0x6400('0xe6'),'');return this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0xe7'),_0x3af52e['speech']));}return this[_0x6400('0xb')][_0x6400('0x29')](_0xcd5867,_0x6400('0xe8'));};AGIVertices[_0x6400('0xe')]['dialogflowV2']=function(_0x258839){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0xe9'),_0x258839[_0x6400('0xa7')]));if(!this[_0x6400('0x7e')](_0x258839[_0x6400('0x77')])){return this[_0x6400('0xb')]['noop'](_0x6400('0xea'));}if(!this[_0x6400('0x7e')](_0x258839[_0x6400('0xeb')])){return this['channel']['noop'](_0x6400('0xec'));}if(!this['isConfigured'](_0x258839[_0x6400('0x78')])){return this['channel']['noop']('no\x20private_key\x20configured');}if(!this[_0x6400('0x7e')](_0x258839[_0x6400('0xed')])){return this[_0x6400('0xb')][_0x6400('0xa2')](_0x6400('0xee'));}if(!this[_0x6400('0x7e')](_0x258839[_0x6400('0x56')])){return this[_0x6400('0xb')][_0x6400('0xa2')](_0x6400('0xa3'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x258839);this['createSquareMessage'](_0x258839[_0x6400('0x56')],'in','','');this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0xef'),_0x258839[_0x6400('0x56')]));var _0x224a6d=this[_0x6400('0x76')][_0x6400('0x69')](this,_0x258839);if(_0x224a6d){for(var _0x355189 in _0x224a6d){if(_0x224a6d[_0x6400('0x8f')](_0x355189)){if(_0x355189!=='providerResponse'){this[_0x6400('0xb')]['setVariable'](util[_0x6400('0x25')]('DIALOGFLOW_%s',_0x355189['toUpperCase']()),_0x224a6d[_0x355189]);}}}this[_0x6400('0xe3')](_0x224a6d[_0x6400('0xf0')],_0x6400('0xe5'),_0x6400('0xf1'),_0x224a6d[_0x6400('0xf2')]);return this['channel'][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0xf3'),_0x224a6d[_0x6400('0xf0')]));}return this[_0x6400('0xb')][_0x6400('0x29')](_0x258839,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x6400('0xe')][_0x6400('0xf4')]=function(_0x222cd3){logger['info'](util[_0x6400('0x25')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x222cd3[_0x6400('0xa7')]));if(!this[_0x6400('0x7e')](_0x222cd3['ndauth_url'])){return this['channel'][_0x6400('0xa2')](_0x6400('0xf5'));}if(!this[_0x6400('0x7e')](_0x222cd3[_0x6400('0xf6')])){return this['channel'][_0x6400('0xa2')](_0x6400('0xf7'));}if(!this[_0x6400('0x7e')](_0x222cd3['password'])){return this[_0x6400('0xb')][_0x6400('0xa2')](_0x6400('0xf8'));}if(!this[_0x6400('0x7e')](_0x222cd3['ndassistant_url'])){return this[_0x6400('0xb')][_0x6400('0xa2')]('no\x20text\x20configured');}this[_0x6400('0xb')][_0x6400('0xe2')]=!![];this[_0x6400('0x31')](_0x222cd3);this[_0x6400('0xe3')](_0x222cd3[_0x6400('0x56')],'in','','');this['channel']['noop'](util[_0x6400('0x25')]('Trying\x20SestekNDA:\x20%s',_0x222cd3[_0x6400('0x56')]));var _0x499322=this[_0x6400('0x79')]['sync'](this,_0x222cd3);if(_0x499322){for(var _0x204796 in _0x499322){if(_0x499322['hasOwnProperty'](_0x204796)){this['channel'][_0x6400('0x98')](util[_0x6400('0x25')](_0x6400('0xf9'),_0x204796[_0x6400('0x64')]()),_0x499322[_0x204796]);}}this['createSquareMessage'](_0x499322[_0x6400('0xf0')],_0x6400('0xe5'),'sesteknda','');if(_0x499322[_0x6400('0xfa')]){this['channel'][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0xfb'),_0x499322['audiofile']));var _0x339c6c=this[_0x6400('0xb')]['streamFile'](_0x499322['audiofile']);try{fs[_0x6400('0xfc')](_0x499322[_0x6400('0xfa')]+_0x6400('0xfd'));}catch(_0x16ea55){logger[_0x6400('0x29')](_0x16ea55);}return _0x339c6c;}else{return this[_0x6400('0xb')]['noop'](util[_0x6400('0x25')](_0x6400('0xfe'),_0x499322[_0x6400('0xf0')]));}}return this[_0x6400('0xb')][_0x6400('0x29')](_0x222cd3,_0x6400('0xff'));};AGIVertices[_0x6400('0xe')][_0x6400('0x100')]=function(_0x50fd4f){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x101'),_0x50fd4f[_0x6400('0xa7')]));return this['channel'][_0x6400('0xa2')]('end');};AGIVertices[_0x6400('0xe')]['ext_dial']=function(_0x48f85a){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x102'),_0x48f85a[_0x6400('0xa7')]));var _0x7678a7='';if(_0x48f85a[_0x6400('0x103')]){if(!this[_0x6400('0x7e')](_0x48f85a[_0x6400('0x103')])){return this[_0x6400('0xb')]['error'](_0x48f85a,_0x6400('0x104'));}else{var _0x1a9545=parseInt(_0x48f85a[_0x6400('0x103')],0xa);if(isNaN(_0x1a9545)){_0x7678a7=_0x48f85a['trunk_id'];}else{_0x7678a7=this[_0x6400('0x1b')][_0x6400('0x69')](this,_0x48f85a[_0x6400('0x103')]);if(!_0x7678a7){return this[_0x6400('0xb')][_0x6400('0x29')](_0x48f85a,_0x6400('0x105'));}}}}else if(_0x48f85a[_0x6400('0x106')]){_0x7678a7=_0x48f85a[_0x6400('0x106')];}else{return this[_0x6400('0xb')][_0x6400('0x29')](_0x48f85a,_0x6400('0x104'));}var _0x3775f3=this['channel'][_0x6400('0x53')](_0x6400('0xe0'),[util['format'](_0x6400('0x107'),_0x7678a7,_0x48f85a[_0x6400('0x41')]),_0x48f85a[_0x6400('0x61')],_0x48f85a['opts'],_0x48f85a[_0x6400('0x5f')]]);if(_0x3775f3[_0x6400('0x9c')]===-0x1){return _0x3775f3;}return this[_0x6400('0xb')]['noop'](util[_0x6400('0x25')](_0x6400('0xdf'),_0x6400('0xe0')));};AGIVertices[_0x6400('0xe')][_0x6400('0x108')]=function(_0x11f89d){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x109'),_0x11f89d[_0x6400('0xa7')]));return this[_0x6400('0xb')][_0x6400('0xa2')](_0x6400('0x108'));};AGIVertices['prototype'][_0x6400('0x9')]=function(_0x5bc97f){logger[_0x6400('0x2a')](util['format'](_0x6400('0x10a'),_0x5bc97f[_0x6400('0xa7')]));if(_0x5bc97f[_0x6400('0x9f')]===0x0){return this[_0x6400('0x9e')](_0x5bc97f);}_0x5bc97f['retry']-=0x1;if(!this[_0x6400('0x7e')](_0x5bc97f[_0x6400('0x10b')])){return this[_0x6400('0xb')]['error'](_0x5bc97f,_0x6400('0x10c'));}var _0x3f305c=this[_0x6400('0x1c')][_0x6400('0x69')](this,_0x5bc97f[_0x6400('0x10b')]);if(!_0x3f305c){return this[_0x6400('0xb')][_0x6400('0x29')](_0x5bc97f,_0x6400('0x10d'));}if(!this['isConfigured'](_0x5bc97f['variable_id'])){return this[_0x6400('0xb')][_0x6400('0x29')](_0x6400('0xd3'));}var _0x362a0d=this[_0x6400('0xb')]['getData'](_0x3f305c,_0x5bc97f[_0x6400('0x10e')],_0x5bc97f[_0x6400('0x10f')]);var _0x1ac3c9=_0x362a0d[_0x6400('0x9c')]?_0x362a0d['result']['toString']():'';logger[_0x6400('0x2a')](_0x6400('0x110'),JSON[_0x6400('0x6d')](_0x362a0d));if(_0x362a0d['result']===-0x1){this['createSquareDetailsReport'][_0x6400('0x69')](this,_0x5bc97f,_0x1ac3c9);return _0x362a0d;}else if(_0x362a0d['extra']==='timeout'){_0x362a0d[_0x6400('0x9c')]=_0x1ac3c9[_0x6400('0x94')]>=parseInt(_0x5bc97f[_0x6400('0x111')])?'x':'i';}else{_0x362a0d['result']=_0x1ac3c9[_0x6400('0x94')]>=parseInt(_0x5bc97f[_0x6400('0x111')])&&_0x1ac3c9[_0x6400('0x94')]<=parseInt(_0x5bc97f['maxdigit'])?'x':'i';}var _0x4cca8d=this[_0x6400('0xf')][_0x6400('0x69')](this,_0x5bc97f[_0x6400('0xd2')]);if(!_0x4cca8d){return this[_0x6400('0xb')][_0x6400('0x29')](_0x5bc97f,_0x6400('0xd4'));}this[_0x6400('0xb')]['setVariable'](_0x4cca8d,_0x1ac3c9);if(this[_0x6400('0x7e')](_0x5bc97f[_0x6400('0x112')])){var _0x102e39=parseInt(_0x5bc97f[_0x6400('0x112')],0xa);var _0x5cfd07=rs[_0x6400('0x113')]({'charset':'*','length':_0x102e39});var _0x5a6e71=_0x1ac3c9['length'];if(_0x5a6e71>0x0){if(_0x5a6e71>_0x102e39){this[_0x6400('0x31')]['sync'](this,_0x5bc97f,_0x5bc97f['hiddendigitspos']===_0x6400('0x114')?_0x5cfd07+_0x1ac3c9[_0x6400('0x115')](_0x102e39):_0x1ac3c9[_0x6400('0x115')](0x0,_0x5a6e71-_0x102e39)+_0x5cfd07);}else{this[_0x6400('0x31')]['sync'](this,_0x5bc97f,rs[_0x6400('0x113')]({'charset':'*','length':_0x5a6e71}));}}else{this[_0x6400('0x31')]['sync'](this,_0x5bc97f,'');}}else{this[_0x6400('0x31')]['sync'](this,_0x5bc97f,_0x1ac3c9);}return _0x362a0d;};AGIVertices['prototype'][_0x6400('0xa')]=function(_0x115970){logger[_0x6400('0x2a')](util['format'](_0x6400('0x116'),_0x115970['label']));return this['getdigits'](_0x115970);};AGIVertices[_0x6400('0xe')]['goal']=function(_0x3444aa){logger['info'](util[_0x6400('0x25')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x3444aa[_0x6400('0xa7')]));this['createSquareDetailsReport'][_0x6400('0x69')](this,_0x3444aa,_0x3444aa[_0x6400('0x117')]);return this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0x118'),_0x3444aa[_0x6400('0x117')]));};AGIVertices['prototype'][_0x6400('0x119')]=function(_0x3e4b89){logger['info'](util[_0x6400('0x25')](_0x6400('0x11a'),_0x3e4b89['label']));if(!this[_0x6400('0x7e')](_0x3e4b89[_0x6400('0x81')])||!this[_0x6400('0x7e')](_0x3e4b89['aws_secret_access_key'])){return this['channel'][_0x6400('0xa2')](_0x6400('0x11b'));}if(!this[_0x6400('0x7e')](_0x3e4b89[_0x6400('0x56')])){return this[_0x6400('0xb')][_0x6400('0xa2')](_0x6400('0xa3'));}this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0x11c'),_0x3e4b89[_0x6400('0x56')]));var _0x41f116=this['awsPolly'][_0x6400('0x69')](this,_0x3e4b89);if(_0x41f116){this[_0x6400('0xb')][_0x6400('0xa2')](util['format'](_0x6400('0x11d'),_0x41f116));var _0x4f756d=this[_0x6400('0xb')][_0x6400('0x11e')](_0x41f116);try{fs['unlink'](_0x41f116+_0x6400('0xfd'));}catch(_0x469c93){logger[_0x6400('0x29')](_0x469c93);}return _0x4f756d;}return this[_0x6400('0xb')]['error'](_0x3e4b89,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x6400('0xe')]['awslex']=function(_0x4852a0){logger['info'](util[_0x6400('0x25')](_0x6400('0x11f'),_0x4852a0[_0x6400('0xa7')]));if(!this[_0x6400('0x7e')](_0x4852a0[_0x6400('0x81')])||!this['isConfigured'](_0x4852a0[_0x6400('0x82')])){return this['channel'][_0x6400('0xa2')](_0x6400('0x11b'));}if(!this[_0x6400('0x7e')](_0x4852a0['aws_bot_name'])){return this[_0x6400('0xb')][_0x6400('0xa2')](_0x6400('0x120'));}if(!this[_0x6400('0x7e')](_0x4852a0[_0x6400('0x56')])){return this['channel']['noop'](_0x6400('0xa3'));}this[_0x6400('0xb')][_0x6400('0xe2')]=!![];this[_0x6400('0x31')](_0x4852a0);this[_0x6400('0xe3')](_0x4852a0[_0x6400('0x56')],'in','','');this[_0x6400('0xb')]['noop'](util[_0x6400('0x25')](_0x6400('0x121'),_0x4852a0[_0x6400('0x56')]));var _0x3fd261=this[_0x6400('0x122')][_0x6400('0x69')](this,_0x4852a0);if(_0x3fd261){for(var _0x407fde in _0x3fd261){if(_0x3fd261[_0x6400('0x8f')](_0x407fde)&&_['isString'](_0x3fd261[_0x407fde])){this[_0x6400('0xb')]['setVariable'](util[_0x6400('0x25')](_0x6400('0x123'),_0x407fde[_0x6400('0x64')]()),_0x3fd261[_0x407fde]);}}if(_[_0x6400('0x3e')](_0x3fd261[_0x6400('0x124')])){return this[_0x6400('0xb')][_0x6400('0xa2')](_0x6400('0x125'));}else{this[_0x6400('0xe3')](_0x3fd261[_0x6400('0x124')],_0x6400('0xe5'),'amazonlex','');return this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0x126'),_0x3fd261[_0x6400('0x124')]));}}return this[_0x6400('0xb')][_0x6400('0x29')](_0x4852a0,_0x6400('0x127'));};AGIVertices[_0x6400('0xe')][_0x6400('0x128')]=function(_0x5175f4){logger['info'](util['format'](_0x6400('0x129'),_0x5175f4[_0x6400('0xa7')],_0x5175f4[_0x6400('0x61')]));if(!this[_0x6400('0x7e')](_0x5175f4['key'])){return this['channel'][_0x6400('0xa2')](_0x6400('0x12a'));}var _0x5ae412=_0x6400('0x12b');var _0x2aa815=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x576108=util[_0x6400('0x25')]('%s.%s',_0x2aa815,_0x5ae412);var _0x2dddbf=!![];if(_0x5175f4['beep']===_0x6400('0x12c')){_0x2dddbf=![];}var _0x182117=this[_0x6400('0xb')]['recordFile'](_0x2aa815,_0x5ae412,_0x5175f4[_0x6400('0x12d')],_0x5175f4[_0x6400('0x61')],undefined,_0x2dddbf);if(_0x182117[_0x6400('0x9c')]!==-0x1){this[_0x6400('0xb')]['noop'](util['format'](_0x6400('0x12e'),_0x576108));var _0x541fb2=this['googleASR'][_0x6400('0x69')](this,_0x5175f4,_0x576108);if(_0x541fb2){for(var _0x5be853 in _0x541fb2){if(_0x541fb2[_0x6400('0x8f')](_0x5be853)){this['channel'][_0x6400('0x98')](util[_0x6400('0x25')](_0x6400('0x12f'),_0x5be853[_0x6400('0x64')]()),_0x541fb2[_0x5be853]);}}return this[_0x6400('0xb')]['noop'](util[_0x6400('0x25')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x541fb2)));}}return _0x182117;};AGIVertices[_0x6400('0xe')][_0x6400('0x130')]=function(_0x220e8f){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x131'),_0x220e8f[_0x6400('0xa7')]));if(!this['isConfigured'](_0x220e8f[_0x6400('0x8b')])){return this[_0x6400('0xb')][_0x6400('0xa2')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x220e8f['appsecret'])){return this[_0x6400('0xb')]['noop']('no\x20appsecret\x20configured');}var _0x571c69=_0x6400('0x12b');var _0x27912b=util[_0x6400('0x25')](_0x6400('0x132'),FILES_PATH,rs['generate'](0x4));var _0xc1dd0c=util['format']('%s.%s',_0x27912b,_0x571c69);var _0x394a19=!![];if(_0x220e8f[_0x6400('0x133')]==='NOBEEP'){_0x394a19=![];}var _0x1f66ef=this[_0x6400('0xb')][_0x6400('0x134')](_0x27912b,_0x571c69,_0x220e8f[_0x6400('0x12d')],_0x220e8f[_0x6400('0x61')],undefined,_0x394a19);if(_0x1f66ef[_0x6400('0x9c')]!==-0x1){this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0x135'),_0xc1dd0c));var _0x201481=this[_0x6400('0x8a')]['sync'](this,_0x220e8f,_0xc1dd0c);if(_0x201481){for(var _0x43b131 in _0x201481){if(_0x201481[_0x6400('0x8f')](_0x43b131)){this['channel'][_0x6400('0x98')](util[_0x6400('0x25')](_0x6400('0x136'),_0x43b131['toUpperCase']()),_0x201481[_0x43b131]);}}return this['channel'][_0x6400('0xa2')](util[_0x6400('0x25')]('TildeASR\x20Result\x20%s',JSON[_0x6400('0x6d')](_0x201481)));}}return _0x1f66ef;};AGIVertices[_0x6400('0xe')][_0x6400('0x137')]=function(_0x2185f1){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x138'),_0x2185f1['label']));return this[_0x6400('0xb')]['continueAt'](_0x2185f1[_0x6400('0x38')],_0x2185f1['extension'],_0x2185f1[_0x6400('0x39')]);};AGIVertices[_0x6400('0xe')]['gotoif']=function(_0x3a94e1){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x139'),_0x3a94e1[_0x6400('0xa7')]));if(!this[_0x6400('0x7e')](_0x3a94e1[_0x6400('0x13a')])){return this['channel']['error'](_0x3a94e1,'no\x20condition\x20configured');}try{var _0x131188=eval(_0x3a94e1['condition'])?_0x6400('0x13b'):_0x6400('0x13c');this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0x13d'),_0x3a94e1['condition'],_0x131188));return{'code':0xc8,'result':_0x131188};}catch(_0x3267c2){return{'code':0xc8,'result':_0x6400('0x13c')};}};AGIVertices['prototype'][_0x6400('0x13e')]=function(_0x50ef4e){logger[_0x6400('0x2a')](util['format'](_0x6400('0x13f'),_0x50ef4e[_0x6400('0xa7')]));if(!this['isConfigured'](_0x50ef4e[_0x6400('0x140')])){return this[_0x6400('0xb')][_0x6400('0x29')](_0x50ef4e,'no\x20interval\x20configured');}var _0x54fc9a=this[_0x6400('0x141')]['sync'](this,_0x50ef4e[_0x6400('0x140')]);if(!_0x54fc9a){return this[_0x6400('0xb')][_0x6400('0x29')](_0x50ef4e,_0x6400('0x142'));}for(var _0x4c69e2=0x0;_0x4c69e2<_0x54fc9a[_0x6400('0x94')];_0x4c69e2+=0x1){var _0x3506a5=this[_0x6400('0xb')]['getVariable'](util['format'](_0x6400('0x143'),_0x54fc9a[_0x4c69e2]));if(_0x3506a5[_0x6400('0x9c')]===-0x1){return _0x3506a5;}logger[_0x6400('0x2a')](util['format']('IFTIME\x20%s\x20%s',_0x54fc9a[_0x4c69e2],_0x3506a5['extra']));if(_0x3506a5['extra']===_0x6400('0x13b')){logger[_0x6400('0x2a')](util[_0x6400('0x25')]('IFTIME\x20%s\x20%s',_0x54fc9a[_0x4c69e2],_0x6400('0x13b')));this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')]('IFTIME\x20%s\x20%s',_0x54fc9a[_0x4c69e2],_0x6400('0x13b')));return{'code':0xc8,'result':_0x6400('0x13b')};}else{logger[_0x6400('0x2a')](util[_0x6400('0x25')]('IFTIME\x20%s\x20%s',_0x54fc9a[_0x4c69e2],_0x6400('0x13c')));this['channel'][_0x6400('0xa2')](util[_0x6400('0x25')]('IFTIME\x20%s\x20%s',_0x54fc9a[_0x4c69e2],'false'));}}return{'code':0xc8,'result':_0x6400('0x13c')};};AGIVertices[_0x6400('0xe')][_0x6400('0x144')]=function(_0x1082cf){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x145'),_0x1082cf[_0x6400('0xa7')]));return this[_0x6400('0xb')]['hangup']();};AGIVertices[_0x6400('0xe')]['ispeechasr']=function(_0x4bf622){logger[_0x6400('0x2a')](util['format'](_0x6400('0x146'),_0x4bf622['label']));if(!this[_0x6400('0x7e')](_0x4bf622[_0x6400('0x74')])){return this[_0x6400('0xb')][_0x6400('0xa2')](_0x6400('0x12a'));}var _0x97f2d6='wav';var _0x3fd71a=util[_0x6400('0x25')](_0x6400('0x132'),FILES_PATH,rs[_0x6400('0x113')](0x4));var _0x1fe108=util[_0x6400('0x25')](_0x6400('0x97'),_0x3fd71a,_0x97f2d6);var _0x5971b8=!![];if(_0x4bf622[_0x6400('0x133')]===_0x6400('0x12c')){_0x5971b8=![];}var _0x52c1c3=this['channel'][_0x6400('0x134')](_0x3fd71a,_0x97f2d6,_0x4bf622[_0x6400('0x12d')],_0x4bf622['timeout'],undefined,_0x5971b8);if(_0x52c1c3[_0x6400('0x9c')]!==-0x1){this[_0x6400('0xb')]['noop'](util[_0x6400('0x25')](_0x6400('0x147'),_0x1fe108));var _0x30476d=this[_0x6400('0x7c')][_0x6400('0x69')](this,_0x4bf622,_0x1fe108);if(_0x30476d){for(var _0x4e100d in _0x30476d){if(_0x30476d['hasOwnProperty'](_0x4e100d)){this[_0x6400('0xb')][_0x6400('0x98')](util[_0x6400('0x25')](_0x6400('0x148'),_0x4e100d[_0x6400('0x64')]()),_0x30476d[_0x4e100d]);}}return this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0x149'),JSON[_0x6400('0x6d')](_0x30476d)));}}return _0x52c1c3;};AGIVertices[_0x6400('0xe')][_0x6400('0x14a')]=function(_0x427b48){logger[_0x6400('0x2a')](util[_0x6400('0x25')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x427b48['label']));if(!this[_0x6400('0x7e')](_0x427b48[_0x6400('0x74')])){return this[_0x6400('0xb')]['noop'](_0x6400('0x12a'));}if(!this[_0x6400('0x7e')](_0x427b48['text'])){return this[_0x6400('0xb')][_0x6400('0xa2')]('no\x20text\x20configured');}this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')]('Trying\x20ispeech\x20TTS\x20%s',_0x427b48[_0x6400('0x56')]));var _0x4f5900=this[_0x6400('0x7a')][_0x6400('0x69')](this,_0x427b48);if(_0x4f5900){this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0x147'),_0x4f5900));var _0x5b9192=this[_0x6400('0xb')][_0x6400('0x11e')](_0x4f5900,_0x427b48[_0x6400('0x12d')]);try{fs[_0x6400('0xfc')](_0x4f5900+_0x6400('0xfd'));}catch(_0x1371cf){logger[_0x6400('0x29')](_0x1371cf);}return _0x5b9192;}return this[_0x6400('0xb')][_0x6400('0x29')](_0x427b48,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x6400('0xe')][_0x6400('0x14b')]=function(_0x2ce58a){logger[_0x6400('0x2a')](util[_0x6400('0x25')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x2ce58a[_0x6400('0xa7')]));if(!this[_0x6400('0x7e')](_0x2ce58a[_0x6400('0x14c')])){return this[_0x6400('0xb')][_0x6400('0x29')](_0x2ce58a,_0x6400('0x14d'));}logger[_0x6400('0x2a')](util['format'](_0x6400('0x14e'),this[_0x6400('0xb')][_0x6400('0x36')],_0x2ce58a['findBy']));var _0x1513d1=this['agentLogin'][_0x6400('0x69')](this,_0x2ce58a[_0x6400('0x14c')]);if(_0x1513d1){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x14f'),this[_0x6400('0xb')][_0x6400('0x36')],_0x2ce58a[_0x6400('0x14c')]));this['channel'][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0x14f'),this[_0x6400('0xb')][_0x6400('0x36')],_0x2ce58a[_0x6400('0x14c')]));return{'code':0xc8,'result':_0x6400('0x150')};}else{logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x151'),this[_0x6400('0xb')][_0x6400('0x36')],_0x2ce58a[_0x6400('0x14c')]));this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x6400('0x36')],_0x2ce58a[_0x6400('0x14c')]));return{'code':0xc8,'result':_0x6400('0x152')};}};AGIVertices[_0x6400('0xe')][_0x6400('0x153')]=function(_0x2fe5e6){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x154'),_0x2fe5e6[_0x6400('0xa7')]));if(!this[_0x6400('0x7e')](_0x2fe5e6[_0x6400('0x14c')])){return this[_0x6400('0xb')][_0x6400('0x29')](_0x2fe5e6,'no\x20find\x20by\x20configured');}logger[_0x6400('0x2a')](util['format'](_0x6400('0x14e'),this[_0x6400('0xb')][_0x6400('0x36')],_0x2fe5e6['findBy']));var _0x424a42=this[_0x6400('0x4d')][_0x6400('0x69')](this,_0x2fe5e6[_0x6400('0x14c')]);if(_0x424a42){logger[_0x6400('0x2a')](util[_0x6400('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6400('0xb')][_0x6400('0x36')],_0x2fe5e6[_0x6400('0x14c')]));this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0x14f'),this[_0x6400('0xb')][_0x6400('0x36')],_0x2fe5e6[_0x6400('0x14c')]));return{'code':0xc8,'result':_0x6400('0x150')};}else{logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x151'),this[_0x6400('0xb')][_0x6400('0x36')],_0x2fe5e6[_0x6400('0x14c')]));this['channel'][_0x6400('0xa2')](util['format'](_0x6400('0x151'),this['channel'][_0x6400('0x36')],_0x2fe5e6[_0x6400('0x14c')]));return{'code':0xc8,'result':_0x6400('0x152')};}};AGIVertices[_0x6400('0xe')][_0x6400('0x155')]=function(_0x2057b8){logger[_0x6400('0x2a')](util['format'](_0x6400('0x156'),_0x2057b8[_0x6400('0xa7')]));if(!this[_0x6400('0x7e')](_0x2057b8[_0x6400('0x157')])){return this['channel']['error'](_0x2057b8,_0x6400('0x158'));}this['channel'][_0x6400('0xa2')](util['format'](_0x6400('0x159'),_0x2057b8[_0x6400('0x157')]));var _0x48cd69=eval(_0x2057b8[_0x6400('0x157')]);if(!this[_0x6400('0x7e')](_0x2057b8[_0x6400('0xd2')])){return this[_0x6400('0xb')]['noop'](_0x6400('0xd3'));}var _0x40b02d=this[_0x6400('0xf')]['sync'](this,_0x2057b8['variable_id']);if(!_0x40b02d){return this[_0x6400('0xb')][_0x6400('0x29')](_0x2057b8,_0x6400('0xd4'));}if(_[_0x6400('0x93')](_0x48cd69)){var _0x49b7fa=this;_0x48cd69['forEach'](function(_0x51b740,_0x3a8603){_0x49b7fa[_0x6400('0xb')]['setVariable'](util[_0x6400('0x25')](_0x6400('0x15a'),_0x40b02d,_0x3a8603),_0x51b740);});return this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0x15b'),_0x40b02d));}else{return this[_0x6400('0xb')][_0x6400('0x98')](_0x40b02d,_0x48cd69);}};AGIVertices[_0x6400('0xe')][_0x6400('0x8')]=function(_0x18acdb){logger['info'](util[_0x6400('0x25')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x18acdb[_0x6400('0xa7')]));if(_0x18acdb[_0x6400('0x9f')]===0x0){return this[_0x6400('0x9e')](_0x18acdb);}_0x18acdb[_0x6400('0x9f')]-=0x1;if(!this[_0x6400('0x7e')](_0x18acdb[_0x6400('0x10b')])){return this[_0x6400('0xb')][_0x6400('0x29')](_0x18acdb,_0x6400('0x10c'));}var _0x20723f=this[_0x6400('0x1c')][_0x6400('0x69')](this,_0x18acdb[_0x6400('0x10b')]);if(!_0x20723f){return this[_0x6400('0xb')][_0x6400('0x29')](_0x18acdb,_0x6400('0x10d'));}var _0x27b774=this[_0x6400('0xb')]['getData'](_0x20723f,_0x18acdb[_0x6400('0x10e')],_0x18acdb[_0x6400('0x15c')]);var _0x1cc4dc=_0x27b774[_0x6400('0x9c')];if(_0x27b774[_0x6400('0x9c')]===-0x1){this[_0x6400('0x31')][_0x6400('0x69')](this,_0x18acdb,'-1');return _0x27b774;}else if(_0x27b774['extra']===_0x6400('0x61')){_0x27b774['result']=_0x27b774[_0x6400('0x9c')][_0x6400('0x94')]>0x0?_0x27b774[_0x6400('0x9c')]:'t';}else if(_[_0x6400('0x3d')](_0x27b774[_0x6400('0x9c')])){_0x27b774[_0x6400('0x9c')]='#';_0x1cc4dc='#';}if(!this[_0x6400('0x7e')](_0x18acdb[_0x6400('0xd2')])){this['channel'][_0x6400('0xa2')](_0x6400('0xd3'));}else{var _0x4f1015=this[_0x6400('0xf')][_0x6400('0x69')](this,_0x18acdb[_0x6400('0xd2')]);if(!_0x4f1015){return this['channel'][_0x6400('0x29')](_0x18acdb,_0x6400('0xd4'));}this['channel'][_0x6400('0x98')](_0x4f1015,_0x1cc4dc);}this[_0x6400('0x31')]['sync'](this,_0x18acdb,_0x1cc4dc);return _0x27b774;};AGIVertices[_0x6400('0xe')][_0x6400('0xa2')]=function(_0xd30bc3){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x15d'),_0xd30bc3[_0x6400('0xa7')]));return this[_0x6400('0xb')][_0x6400('0xa2')](_0xd30bc3['output']||_0xd30bc3[_0x6400('0xa7')]);};AGIVertices[_0x6400('0xe')]['pause']=function(_0x514e40){logger['info'](util[_0x6400('0x25')](_0x6400('0x15e'),_0x514e40[_0x6400('0xa7')]));if(!this[_0x6400('0x7e')](_0x514e40[_0x6400('0x14c')])){return this[_0x6400('0xb')][_0x6400('0x29')](_0x514e40,_0x6400('0x14d'));}logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x14e'),this[_0x6400('0xb')][_0x6400('0x36')],_0x514e40[_0x6400('0x14c')]));var _0x4a7a8d=this['getPause'][_0x6400('0x69')](this,_0x514e40['pause_id']);var _0xc20ebe=this['agentPause'][_0x6400('0x69')](this,_0x514e40[_0x6400('0x14c')],_0x4a7a8d);if(_0xc20ebe){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x14f'),this['channel'][_0x6400('0x36')],_0x514e40[_0x6400('0x14c')]));this[_0x6400('0xb')]['noop'](util[_0x6400('0x25')](_0x6400('0x14f'),this[_0x6400('0xb')][_0x6400('0x36')],_0x514e40[_0x6400('0x14c')]));return{'code':0xc8,'result':_0x6400('0x150')};}else{logger[_0x6400('0x2a')](util[_0x6400('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6400('0xb')][_0x6400('0x36')],_0x514e40[_0x6400('0x14c')]));this[_0x6400('0xb')]['noop'](util[_0x6400('0x25')](_0x6400('0x14f'),this[_0x6400('0xb')][_0x6400('0x36')],_0x514e40[_0x6400('0x14c')]));return{'code':0xc8,'result':_0x6400('0x152')};}};AGIVertices[_0x6400('0xe')][_0x6400('0x15f')]=function(_0x252833){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x160'),_0x252833[_0x6400('0xa7')]));if(!this['isConfigured'](_0x252833[_0x6400('0x10b')])){return this[_0x6400('0xb')][_0x6400('0x29')](_0x252833,_0x6400('0x10c'));}var _0x19270a=this['getSound'][_0x6400('0x69')](this,_0x252833[_0x6400('0x10b')]);if(!_0x19270a){return this[_0x6400('0xb')]['error'](_0x252833,'no\x20file\x20audio\x20found');}var _0x5d6c13=this['channel']['exec'](_0x6400('0x161'),[_0x19270a,_0x252833[_0x6400('0x162')]]);if(_0x5d6c13[_0x6400('0x9c')]===-0x1){return _0x5d6c13;}return this[_0x6400('0xb')]['noop'](util[_0x6400('0x25')](_0x6400('0xbf'),_0x6400('0x161'),_0x19270a));};AGIVertices[_0x6400('0xe')][_0x6400('0x163')]=function(_0x1f9268){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x164'),_0x1f9268[_0x6400('0xa7')]));if(!this[_0x6400('0x7e')](_0x1f9268[_0x6400('0x165')])){return this[_0x6400('0xb')]['error'](_0x1f9268,'no\x20queue\x20selected');}var _0x5d738f='';var _0x2b6bdb=parseInt(_0x1f9268['queue_id'],0xa);if(isNaN(_0x2b6bdb)){_0x5d738f=_0x1f9268[_0x6400('0x165')];}else{_0x5d738f=this['getVoiceQueue'][_0x6400('0x69')](this,_0x1f9268[_0x6400('0x165')]);if(!_0x5d738f){return this[_0x6400('0xb')][_0x6400('0x29')](_0x1f9268,_0x6400('0x166'));}}var _0x1cba3f='';if(this[_0x6400('0x7e')](_0x1f9268['file_id'])){var _0x241d51=this[_0x6400('0x1c')][_0x6400('0x69')](this,_0x1f9268[_0x6400('0x10b')]);if(_0x241d51){_0x1cba3f=_0x241d51;}}this[_0x6400('0x31')][_0x6400('0x69')](this,_0x1f9268,_0x5d738f);if(_0x1f9268['opts'][_0x6400('0x167')]('x')<0x0){_0x1f9268[_0x6400('0x162')]+='x';}if(_0x1f9268['opts']['indexOf']('X')<0x0){_0x1f9268[_0x6400('0x162')]+='X';}this[_0x6400('0xb')][_0x6400('0x98')]('XMCS-QUEUE',_0x5d738f?_0x5d738f['toLowerCase']():'');var _0x58b796=this['channel'][_0x6400('0x53')](_0x6400('0x168'),[_0x5d738f,_0x1f9268[_0x6400('0x162')],_0x1f9268[_0x6400('0x5f')],_0x1cba3f,_0x1f9268[_0x6400('0x61')],_0x1f9268[_0x6400('0x5')],_0x1f9268[_0x6400('0x169')],_0x1f9268[_0x6400('0x16a')],'',_0x1f9268[_0x6400('0x16b')]]);if(_0x58b796['result']===-0x1){return _0x58b796;}return this[_0x6400('0xb')]['noop'](util[_0x6400('0x25')](_0x6400('0xbf'),_0x6400('0x168'),_0x5d738f));};AGIVertices['prototype'][_0x6400('0x16c')]=function(_0x2f4d79){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x16d'),_0x2f4d79['label']));var _0x23e515=_0x2f4d79[_0x6400('0x16e')]||_0x6400('0x12b');var _0x87e51a=util[_0x6400('0x25')](_0x6400('0x16f'),this[_0x6400('0xb')][_0x6400('0x32')],rs[_0x6400('0x113')](0x5));var _0x5f5cd4=util[_0x6400('0x25')]('%s/recordings/%s.%s',FILES_PATH,_0x87e51a,_0x23e515);var _0x25fcfb=util[_0x6400('0x25')](_0x6400('0x132'),FILES_PATH,_0x87e51a);this[_0x6400('0x35')][_0x6400('0x69')](this,_0x2f4d79,_0x87e51a,_0x5f5cd4);this[_0x6400('0xb')][_0x6400('0x98')](_0x6400('0x170'),_0x87e51a);logger[_0x6400('0x2a')](_0x6400('0x171'),_0x25fcfb,_0x23e515,_0x2f4d79[_0x6400('0x172')],_0x2f4d79[_0x6400('0x61')]);return this[_0x6400('0xb')][_0x6400('0x134')](_0x25fcfb,_0x23e515,_0x2f4d79[_0x6400('0x172')],_0x2f4d79['timeout'],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x218c74){logger[_0x6400('0x2a')](util[_0x6400('0x25')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x218c74[_0x6400('0xa7')]));if(!this[_0x6400('0x7e')](_0x218c74['url'])){return this[_0x6400('0xb')][_0x6400('0xa2')](_0x6400('0x173'));}var _0x34a93b=this[_0x6400('0x5e')][_0x6400('0x69')](this,_0x218c74);logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x174'),util[_0x6400('0x175')](_0x34a93b,{'showHidden':![],'depth':null})));if(!this[_0x6400('0x7e')](_0x218c74[_0x6400('0xd2')])){return this[_0x6400('0xb')][_0x6400('0xa2')](_0x6400('0x176'));}var _0x3573cd=this[_0x6400('0xf')][_0x6400('0x69')](this,_0x218c74[_0x6400('0xd2')]);if(!_0x3573cd){return this[_0x6400('0xb')][_0x6400('0x29')](_0x218c74,'no\x20variable\x20found');}this[_0x6400('0xb')][_0x6400('0x98')](util['format'](_0x6400('0x177'),_0x3573cd),_0x34a93b[_0x6400('0x6f')]?_0x34a93b[_0x6400('0x6f')]:_0x6400('0x178'));this[_0x6400('0xb')]['setVariable'](util[_0x6400('0x25')](_0x6400('0x179'),_0x3573cd),_0x34a93b[_0x6400('0x70')]?_0x34a93b[_0x6400('0x70')]:'OK');if(_0x34a93b[_0x6400('0x65')]){try{this[_0x6400('0x96')](_0x34a93b[_0x6400('0x65')],_0x3573cd);}catch(_0x324e70){logger[_0x6400('0x29')](util['format'](_0x6400('0x17a'),_0x3573cd));}}return this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')]('variable\x20%s\x20set',_0x3573cd));};AGIVertices[_0x6400('0xe')][_0x6400('0x17b')]=function(_0x599a26){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x17c'),_0x599a26[_0x6400('0xa7')]));return this[_0x6400('0xb')][_0x6400('0x17d')](_0x599a26[_0x6400('0x17e')]['replace'](/\s+/g,''),_0x599a26[_0x6400('0x172')]);};AGIVertices[_0x6400('0xe')][_0x6400('0x17f')]=function(_0x588423){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x180'),_0x588423['label']));return this['channel'][_0x6400('0x181')](_0x588423[_0x6400('0x60')][_0x6400('0x182')](/\s+/g,''),_0x588423[_0x6400('0x172')]);};AGIVertices[_0x6400('0xe')]['sayphonetic']=function(_0x37db63){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x183'),_0x37db63[_0x6400('0xa7')]));return this[_0x6400('0xb')][_0x6400('0x184')](_0x37db63[_0x6400('0x56')],_0x37db63[_0x6400('0x172')]);};AGIVertices['prototype'][_0x6400('0x185')]=function(_0x3f8128){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x186'),_0x3f8128[_0x6400('0xa7')]));if(!this[_0x6400('0x7e')](_0x3f8128['account_id'])){return this['channel']['noop'](_0x6400('0x187'));}var _0x58f41e=this[_0x6400('0x188')]['sync'](this,_0x3f8128[_0x6400('0x189')]);if(!_0x58f41e||!_0x58f41e[_0x6400('0x18a')]){return this[_0x6400('0xb')]['error'](_0x3f8128,'no\x20mail\x20account\x20found');}var _0x4b193d={'from':util['format'](_0x6400('0x18b'),_0x58f41e[_0x6400('0x11')],_0x58f41e[_0x6400('0x18c')]||_0x58f41e[_0x6400('0x18a')][_0x6400('0x18d')]),'to':_0x3f8128['to']||'','cc':_0x3f8128['cc']||'','bcc':_0x3f8128[_0x6400('0x18e')]||'','subject':_0x3f8128[_0x6400('0x18f')],'html':_0x3f8128[_0x6400('0x56')],'text':_0x3f8128['text']};if(this['isConfigured'](_0x3f8128[_0x6400('0x190')])){}logger[_0x6400('0x191')](_0x6400('0x192'),JSON[_0x6400('0x6d')](_0x4b193d));this[_0x6400('0x31')][_0x6400('0x69')](this,_0x3f8128,_0x3f8128[_0x6400('0x189')]);this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0x193'),_0x58f41e[_0x6400('0x11')]));this[_0x6400('0x20')][_0x6400('0x69')](this,_0x58f41e[_0x6400('0x194')],_0x4b193d);return this['channel'][_0x6400('0xa2')](_0x6400('0x195'));};AGIVertices[_0x6400('0xe')][_0x6400('0x196')]=function(_0x27ef00){logger[_0x6400('0x2a')](util[_0x6400('0x25')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x27ef00[_0x6400('0xa7')]));return this['channel'][_0x6400('0xa2')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype']['sendSMS']=function(_0x272e6c){logger[_0x6400('0x2a')](util[_0x6400('0x25')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x272e6c['label']));if(!this[_0x6400('0x7e')](_0x272e6c['sms_account_id'])){return this['channel'][_0x6400('0xa2')]('no\x20sms\x20account\x20configured');}var _0x382c92=this[_0x6400('0x2e')][_0x6400('0x69')](this,_0x272e6c['sms_account_id']);if(!_0x382c92){return this['channel'][_0x6400('0x29')](_0x272e6c,_0x6400('0x197'));}var _0x12d8d8={'body':_0x272e6c[_0x6400('0x198')],'phone':_0x272e6c['to']||'','SmsAccountId':_0x382c92['id']};logger[_0x6400('0x191')](_0x6400('0x199'),JSON[_0x6400('0x6d')](_0x12d8d8));this['createSquareDetailsReport'][_0x6400('0x69')](this,_0x272e6c,_0x272e6c[_0x6400('0x19a')]);this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0x19b'),_0x382c92[_0x6400('0x11')]));this[_0x6400('0x30')][_0x6400('0x69')](this,_0x12d8d8);return this[_0x6400('0xb')][_0x6400('0xa2')](_0x6400('0x19c'));};AGIVertices[_0x6400('0xe')][_0x6400('0x19d')]=function(_0x27bfea){logger['info'](util['format'](_0x6400('0x19e'),_0x27bfea[_0x6400('0xa7')]));if(!this[_0x6400('0x7e')](_0x27bfea[_0x6400('0xd2')])){return this['channel'][_0x6400('0x29')](_0x27bfea,'no\x20variable\x20selected');}var _0x45a968=this['getVariable'][_0x6400('0x69')](this,_0x27bfea[_0x6400('0xd2')]);if(!_0x45a968){return this[_0x6400('0xb')]['error'](_0x27bfea,_0x6400('0xd4'));}return this['channel'][_0x6400('0x98')](_0x45a968,_0x27bfea[_0x6400('0x19f')]);};AGIVertices[_0x6400('0xe')][_0x6400('0x1a0')]=function(_0x45eaf0){logger[_0x6400('0x2a')](util['format'](_0x6400('0x1a1'),_0x45eaf0[_0x6400('0xa7')]));this['channel'][_0x6400('0xa2')](_0x6400('0x1a2'));var _0x46cd6b=this[_0x6400('0xb')][_0x6400('0xf')](_0x6400('0x1a3'));if(!_[_0x6400('0x3d')](_0x46cd6b[_0x6400('0x9d')])){this[_0x6400('0xb')][_0x6400('0x32')]=_0x46cd6b[_0x6400('0x9d')];}if(_0x45eaf0[_0x6400('0xb2')]===_0x6400('0x1a4')){this[_0x6400('0xb')][_0x6400('0xa2')](_0x6400('0x1a5'));return this['channel'][_0x6400('0xb2')]();}return this['channel']['noop'](_0x6400('0x1a6'));};AGIVertices[_0x6400('0xe')][_0x6400('0x1a7')]=function(_0x2f0b26){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x1a8'),_0x2f0b26[_0x6400('0xa7')]));if(!this[_0x6400('0x7e')](_0x2f0b26[_0x6400('0x1a9')])){return this[_0x6400('0xb')]['error'](_0x2f0b26,_0x6400('0x1aa'));}var _0x174e26=this[_0x6400('0x1ab')][_0x6400('0x69')](this,_0x2f0b26[_0x6400('0x1a9')]);if(!this[_0x6400('0x7e')](_0x174e26)){return this[_0x6400('0xb')][_0x6400('0x29')](_0x2f0b26,util[_0x6400('0x25')](_0x6400('0x1ac'),_0x2f0b26['project_id']));}if(_0x174e26===this[_0x6400('0xb')][_0x6400('0x34')]){return this[_0x6400('0xb')]['error'](_0x2f0b26,_0x6400('0x1ad'));}this[_0x6400('0x31')]['sync'](this,_0x2f0b26,_0x174e26);var _0x432c7e=this[_0x6400('0xb')][_0x6400('0x53')](_0x6400('0x1ae'),util[_0x6400('0x25')](_0x6400('0x1af'),config['agi']['host']||_0x6400('0x1b0'),_0x174e26,this[_0x6400('0xb')][_0x6400('0x34')]));if(_0x432c7e['result']===-0x1){return _0x432c7e;}return this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')]('Executed\x20command\x20%s\x20%s',_0x6400('0x1ae'),_0x174e26));};AGIVertices[_0x6400('0xe')][_0x6400('0x1b1')]=function(_0x25b594){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x1b2'),_0x25b594['label']));var _0x3a25a6=this[_0x6400('0x52')][_0x6400('0x69')](this,_0x25b594['command']);this[_0x6400('0x31')][_0x6400('0x69')](this,_0x25b594,_0x25b594['command']);if(this['isConfigured'](_0x25b594[_0x6400('0xd2')])){var _0xf63800=this[_0x6400('0xf')][_0x6400('0x69')](this,_0x25b594[_0x6400('0xd2')]);if(_0xf63800){this['channel'][_0x6400('0x98')](_0xf63800,_0x3a25a6);return this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0x1b3'),_0x25b594[_0x6400('0x1b4')],_0xf63800));}}return this[_0x6400('0xb')]['noop'](util[_0x6400('0x25')](_0x6400('0x1b5'),_0x25b594[_0x6400('0x1b4')]));};AGIVertices['prototype'][_0x6400('0x1b6')]=function(_0x355c13){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x1b7'),_0x355c13[_0x6400('0xa7')]));_0x355c13[_0x6400('0x56')]=_0x355c13[_0x6400('0x56')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6400('0x7e')](_0x355c13[_0x6400('0x55')])){return this['channel'][_0x6400('0xa2')](_0x6400('0x1b8'));}if(!this[_0x6400('0x7e')](_0x355c13[_0x6400('0x56')])){return this[_0x6400('0xb')][_0x6400('0xa2')](_0x6400('0xa3'));}this['channel'][_0x6400('0xa2')](util['format'](_0x6400('0x1b9'),_0x355c13[_0x6400('0x56')]));var _0x2aec49=this[_0x6400('0x54')]['sync'](this,_0x355c13);if(_0x2aec49){this['channel'][_0x6400('0xa2')](util[_0x6400('0x25')](_0x6400('0x1ba'),_0x2aec49));var _0x26f777=this[_0x6400('0xb')][_0x6400('0x11e')](_0x2aec49);try{fs['unlink'](_0x2aec49+'.wav');}catch(_0x5f5a8f){logger[_0x6400('0x29')](_0x5f5a8f);}return _0x26f777;}return this[_0x6400('0xb')]['error'](_0x355c13,_0x6400('0x1bb'));};AGIVertices[_0x6400('0xe')][_0x6400('0x1bc')]=function(_0x2e0b9f){logger[_0x6400('0x2a')](util[_0x6400('0x25')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x2e0b9f[_0x6400('0xa7')]));_0x2e0b9f[_0x6400('0x56')]=_0x2e0b9f[_0x6400('0x56')][_0x6400('0x182')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x2e0b9f['text'])){return this['channel']['noop'](_0x6400('0xa3'));}this[_0x6400('0xb')][_0x6400('0xa2')](util[_0x6400('0x25')]('Trying\x20Google\x20TTS\x20%s',_0x2e0b9f[_0x6400('0x56')]));var _0x34d1ba=this[_0x6400('0x5c')]['sync'](this,_0x2e0b9f);if(_0x34d1ba){this[_0x6400('0xb')][_0x6400('0xa2')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x34d1ba));var _0x51b10c=this[_0x6400('0xb')]['streamFile'](_0x34d1ba);try{fs[_0x6400('0xfc')](_0x34d1ba+_0x6400('0xfd'));}catch(_0x508f2d){logger[_0x6400('0x29')](_0x508f2d);}return _0x51b10c;}return this[_0x6400('0xb')][_0x6400('0x29')](_0x2e0b9f,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x6400('0xe')][_0x6400('0x1bd')]=function(_0x4e167a){logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x1be'),_0x4e167a[_0x6400('0xa7')]));if(!this['isConfigured'](_0x4e167a['findBy'])){return this[_0x6400('0xb')][_0x6400('0x29')](_0x4e167a,_0x6400('0x14d'));}logger[_0x6400('0x2a')](util['format'](_0x6400('0x14e'),this['channel'][_0x6400('0x36')],_0x4e167a[_0x6400('0x14c')]));var _0x4e6f2f=this['agentUnpause'][_0x6400('0x69')](this,_0x4e167a['findBy']);if(_0x4e6f2f){logger[_0x6400('0x2a')](util[_0x6400('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6400('0xb')][_0x6400('0x36')],_0x4e167a[_0x6400('0x14c')]));this['channel']['noop'](util[_0x6400('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x4e167a[_0x6400('0x14c')]));return{'code':0xc8,'result':_0x6400('0x150')};}else{logger[_0x6400('0x2a')](util[_0x6400('0x25')](_0x6400('0x151'),this[_0x6400('0xb')][_0x6400('0x36')],_0x4e167a['findBy']));this['channel'][_0x6400('0xa2')](util[_0x6400('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x6400('0x36')],_0x4e167a['findBy']));return{'code':0xc8,'result':_0x6400('0x152')};}};AGIVertices[_0x6400('0xe')][_0x6400('0x1bf')]=function(_0x1bb5bc){logger['info'](util[_0x6400('0x25')](_0x6400('0x1c0'),_0x1bb5bc[_0x6400('0xa7')]));var _0xc78f32=this[_0x6400('0xb')][_0x6400('0x53')](_0x6400('0x1c1'),[_0x1bb5bc['mailbox'],_0x1bb5bc['options']]);if(_0xc78f32[_0x6400('0x9c')]===-0x1){return _0xc78f32;}return this[_0x6400('0xb')][_0x6400('0xa2')](util['format'](_0x6400('0xbf'),_0x6400('0x1c1'),_0x1bb5bc['mailbox']));};AGIVertices[_0x6400('0xe')]['vswitch']=function(_0x281aed){logger[_0x6400('0x2a')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x281aed['label']));if(!this['isConfigured'](_0x281aed[_0x6400('0xd2')])){return this['channel'][_0x6400('0x29')](_0x281aed,_0x6400('0x1c2'));}var _0x5998f7=this[_0x6400('0xf')]['sync'](this,_0x281aed[_0x6400('0xd2')]);if(!_0x5998f7){return this[_0x6400('0xb')][_0x6400('0x29')](_0x281aed,_0x6400('0xd4'));}var _0x308907=this[_0x6400('0xb')]['getVariable'](_0x5998f7);return{'code':0xc8,'result':_0x308907['extra']?_0x308907[_0x6400('0x9d')]:'-'};};String['prototype']['replaceAll']=function(_0xf3160c,_0x50972e){return this[_0x6400('0x9a')](_0xf3160c)['join'](_0x50972e);};module[_0x6400('0x1c3')]=AGIVertices; \ No newline at end of file +var _0xb717=['shelljs','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','prototype','getVariable','getVariableById','name','catch','rpc','getVoiceQueueById','getSquareProject','then','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSound','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','info','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','scheduledAt','callback','Callback\x20scheduled\x20at\x20','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','trim','replace','googleCloudTTS','text','languageCode','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','method','timeout','number','POST','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','uri','render','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','includes','clone','hasOwnProperty','replaceObjectAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','isString','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','toString','getAndSetVariable','sync','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','list_id','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','no\x20text\x20configured','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','keys','forEach','dial','sip_id','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','bot','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','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','no\x20trunk\x20found','trunk_name','SIP/%s/%s','phone','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','getData','test','mindigit','maxdigit','no\x20variable\x20found','generate','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','continueAt','condition','no\x20condition\x20configured','true','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','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','.wav','ispeech\x20TTS\x20is\x20unreachable','login','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','logout','failure','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue_id','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','%s/recordings/%s','RECORDING_SAVENAME','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','template_id','debug','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','voicemail','VOICEMAIL','mailbox','join','exports','util'];(function(_0x4169d8,_0x3d7cd4){var _0x32084a=function(_0x5f59c6){while(--_0x5f59c6){_0x4169d8['push'](_0x4169d8['shift']());}};_0x32084a(++_0x3d7cd4);}(_0xb717,0x1b4));var _0x7b71=function(_0x55d665,_0x6e1fbd){_0x55d665=_0x55d665-0x0;var _0xf318dd=_0xb717[_0x55d665];return _0xf318dd;};'use strict';var fs=require('fs');var util=require(_0x7b71('0x0'));var _=require('lodash');var sh=require(_0x7b71('0x1'));var odbc=require('odbc')();var rs=require(_0x7b71('0x2'));var moment=require(_0x7b71('0x3'));var Mustache=require(_0x7b71('0x4'));var rp=require('request-promise');var logger=require(_0x7b71('0x5'))(_0x7b71('0x6'));var config=require(_0x7b71('0x7'));var scripts=require(_0x7b71('0x8'));var FILES_PATH=_0x7b71('0x9');var recursiveMapAttributes=['rawHeaders',_0x7b71('0xa')];var verticesWithRetry=[_0x7b71('0xb'),_0x7b71('0xc'),_0x7b71('0xd')];var AGIVertices=function(_0xc46853,_0x570e98,_0x18867f){this[_0x7b71('0xe')]=_0xc46853;this['rpc']=_0x570e98;this[_0x7b71('0xf')]=_0x18867f;};AGIVertices[_0x7b71('0x10')][_0x7b71('0x11')]=function(_0x55c72a,_0x2aed3b){this['rpc'][_0x7b71('0x12')](_0x55c72a)['then'](function(_0x191289){_0x2aed3b(null,_0x191289?_0x191289[_0x7b71('0x13')]:![]);})[_0x7b71('0x14')](function(_0x101181){_0x2aed3b(_0x101181);});};AGIVertices[_0x7b71('0x10')]['getVoiceQueue']=function(_0x453d50,_0x481d32){this[_0x7b71('0x15')][_0x7b71('0x16')](_0x453d50)['then'](function(_0x351442){_0x481d32(null,_0x351442?_0x351442[_0x7b71('0x13')]:![]);})[_0x7b71('0x14')](function(_0x5888f9){_0x481d32(_0x5888f9);});};AGIVertices['prototype'][_0x7b71('0x17')]=function(_0x3dc48a,_0x35c943){this[_0x7b71('0x15')]['getSquareProjectById'](_0x3dc48a)[_0x7b71('0x18')](function(_0x5ca420){_0x35c943(null,_0x5ca420?_0x5ca420['name']:![]);})[_0x7b71('0x14')](function(_0xbde25){_0x35c943(_0xbde25);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x19')]=function(_0x2fc4a0,_0x51d647){this[_0x7b71('0x15')][_0x7b71('0x1a')](_0x2fc4a0)[_0x7b71('0x18')](function(_0x1941b9){_0x51d647(null,_0x1941b9?_0x1941b9[_0x7b71('0x1b')]:![]);})[_0x7b71('0x14')](function(_0x527e3f){_0x51d647(_0x527e3f);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x1c')]=function(_0x204c69,_0x375f85){this['rpc']['getUserById'](_0x204c69)[_0x7b71('0x18')](function(_0xbd752b){_0x375f85(null,_0xbd752b?_0xbd752b[_0x7b71('0x13')]:![]);})[_0x7b71('0x14')](function(_0x3aca34){_0x375f85(_0x3aca34);});};AGIVertices['prototype'][_0x7b71('0x1d')]=function(_0x58591c,_0x16c1f3){this[_0x7b71('0x15')][_0x7b71('0x1e')](_0x58591c)[_0x7b71('0x18')](function(_0x49ce76){_0x16c1f3(null,_0x49ce76?_0x49ce76['name']:![]);})[_0x7b71('0x14')](function(_0x28841d){_0x16c1f3(_0x28841d);});};AGIVertices['prototype'][_0x7b71('0x1f')]=function(_0x214555,_0x7c978b){var _0x2f9ca9=this;this[_0x7b71('0x15')]['getSoundById'](_0x214555)['then'](function(_0x2b323b){_0x7c978b(null,_0x2b323b?_0x2f9ca9['getSoundPath'](_0x2b323b[_0x7b71('0x20')]):![]);})['catch'](function(_0x18cc43){_0x7c978b(_0x18cc43);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x21')]=function(_0x5539b3,_0x1e4e89){this[_0x7b71('0x15')][_0x7b71('0x22')](_0x5539b3)['then'](function(_0x5e11e1){_0x1e4e89(null,_0x5e11e1?_0x5e11e1:![]);})[_0x7b71('0x14')](function(_0x14ff72){_0x1e4e89(_0x14ff72);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x23')]=function(_0x43925c,_0x38c1a8,_0x4761cb){this['mailRpc'][_0x7b71('0x23')](_0x43925c,_0x38c1a8)[_0x7b71('0x18')](function(){_0x4761cb(null);})[_0x7b71('0x14')](function(_0x57e8ce){_0x4761cb(_0x57e8ce);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x24')]=function(_0x2de811,_0x37ef84){this[_0x7b71('0x15')][_0x7b71('0x25')](_0x2de811)['then'](function(_0x3f231c){if(_0x3f231c){if(_0x3f231c[_0x7b71('0x26')]){_0x37ef84(null,[_0x3f231c[_0x7b71('0x27')]]);}else{_0x37ef84(null,_[_0x7b71('0x28')](_0x3f231c[_0x7b71('0x29')],'interval'));}}else{_0x37ef84(null,![]);}})[_0x7b71('0x14')](function(_0x31e0d1){_0x37ef84(_0x31e0d1);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x2a')]=function(_0x7cb6c1){return util[_0x7b71('0x2b')](_0x7b71('0x2c'),FILES_PATH,_0x7cb6c1);};AGIVertices[_0x7b71('0x10')]['getQueryOdbc']=function(_0x3be99c,_0x3074aa,_0x2a3330){odbc[_0x7b71('0x2d')](_0x3be99c,function(_0x4b816f){if(_0x4b816f){logger[_0x7b71('0x2e')](_0x7b71('0x2f'),_0x4b816f);_0x2a3330(_0x4b816f);}else{logger['info'](_0x7b71('0x30'));odbc[_0x7b71('0x31')](_0x3074aa,function(_0x12b48d,_0x1af1c6){if(_0x12b48d){logger['info'](_0x7b71('0x32'),_0x3074aa);_0x2a3330(_0x12b48d);}else{logger[_0x7b71('0x33')](_0x7b71('0x34'),_0x3074aa);odbc[_0x7b71('0x35')](function(_0x25b7f4){if(_0x25b7f4){logger[_0x7b71('0x2e')](_0x7b71('0x36'),_0x25b7f4);}_0x2a3330(null,_0x1af1c6);});}});}});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x37')]=function(_0x6cc0ab,_0xa1db9f){this[_0x7b71('0x15')]['getSmsAccountById'](_0x6cc0ab)[_0x7b71('0x18')](function(_0x3f795b){_0xa1db9f(null,_0x3f795b?_0x3f795b:![]);})['catch'](function(_0x1b30e8){_0xa1db9f(_0x1b30e8);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x38')]=function(_0x1719b8,_0x20b8fc){this['rpc'][_0x7b71('0x38')](_0x1719b8)[_0x7b71('0x18')](function(_0x2d6f20){_0x20b8fc(null,_0x2d6f20);})[_0x7b71('0x14')](function(_0x136070){_0x20b8fc(_0x136070);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x3f9e98,_0x541730,_0x2c2729){this[_0x7b71('0x15')][_0x7b71('0x39')]({'uniqueid':this[_0x7b71('0xe')][_0x7b71('0x3a')],'node':_0x3f9e98[_0x7b71('0x3b')],'application':_0x3f9e98[_0x7b71('0x3c')],'data':_0x541730||null,'project_name':this['channel'][_0x7b71('0x3d')],'callerid':this[_0x7b71('0xe')]['callerid']})[_0x7b71('0x18')](function(_0x96c37e){if(_0x2c2729){_0x2c2729(null,_0x96c37e);}})[_0x7b71('0x14')](function(_0x443e61){if(_0x2c2729){_0x2c2729(_0x443e61);}});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x3e')]=function(_0xf78be9,_0x227b5e,_0x18435c,_0x4412ca){this[_0x7b71('0x15')][_0x7b71('0x3e')]({'uniqueid':this[_0x7b71('0xe')]['uniqueid'],'callerid':this[_0x7b71('0xe')][_0x7b71('0x3f')],'calleridname':this['channel']['calleridname'],'context':this['channel'][_0x7b71('0x40')],'extension':this[_0x7b71('0xe')][_0x7b71('0x41')],'priority':this['channel'][_0x7b71('0x42')],'accountcode':this[_0x7b71('0xe')]['accountcode'],'dnid':this[_0x7b71('0xe')][_0x7b71('0x43')],'projectName':this[_0x7b71('0xe')]['arg_1'],'saveName':_0x227b5e,'filename':_0xf78be9[_0x7b71('0x44')]||_0x227b5e,'savePath':_0x18435c})[_0x7b71('0x18')](function(_0x945c68){_0x4412ca(null,_0x945c68);})[_0x7b71('0x14')](function(_0x20e9ed){_0x4412ca(_0x20e9ed);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x45')]=function(_0x30e8d8,_0xdb438,_0x32bf02,_0x35b792,_0xe6825d){this['rpc'][_0x7b71('0x45')]({'uniqueid':this['channel'][_0x7b71('0x3a')],'body':_0x30e8d8,'direction':_0xdb438,'providerName':_0x32bf02,'providerResponse':_0x35b792})[_0x7b71('0x18')](function(_0x45f94b){if(_0xe6825d){_0xe6825d(null,_0x45f94b);}})[_0x7b71('0x14')](function(_0x3571d0){if(_0xe6825d){_0xe6825d(_0x3571d0);}});};AGIVertices[_0x7b71('0x10')]['createCmContact']=function(_0x318605,_0x5c6146){this['rpc'][_0x7b71('0x46')]({'firstName':_['isEmpty'](_0x318605[_0x7b71('0x13')])||_[_0x7b71('0x47')](_0x318605[_0x7b71('0x13')])?_0x7b71('0x48')+Math[_0x7b71('0x49')]():_0x318605[_0x7b71('0x13')],'lastName':_[_0x7b71('0x4a')](_0x318605[_0x7b71('0x4b')])||_[_0x7b71('0x47')](_0x318605[_0x7b71('0x4b')])?null:_0x318605[_0x7b71('0x4b')],'phone':_0x318605['phone'],'ListId':_0x318605['list_id'],'scheduledat':_0x318605[_0x7b71('0x4c')],'callbackUniqueid':this['channel'][_0x7b71('0x3a')],'tags':_0x7b71('0x4d'),'description':_0x7b71('0x4e')+_0x318605['scheduledAt']['toString'](),'priority':_0x318605['callback_priority']})[_0x7b71('0x18')](function(_0x48b486){_0x5c6146(null,_0x48b486);})[_0x7b71('0x14')](function(_0x1af6a2){_0x5c6146(_0x1af6a2);});};AGIVertices['prototype'][_0x7b71('0x4f')]=function(_0x5c8dd2,_0x46c589){this['rpc'][_0x7b71('0x50')](_0x5c8dd2)['then'](function(_0x2256f6){_0x46c589(null,_0x2256f6?_0x2256f6['name']:![]);})[_0x7b71('0x14')](function(_0x53e33a){_0x46c589(_0x53e33a);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x51')]=function(_0x2980e7,_0x5bfdfb,_0x510a30){var _0x265b04={'role':_0x7b71('0x52')};_0x265b04[_0x2980e7]=this[_0x7b71('0xe')][_0x7b71('0x3f')];this[_0x7b71('0x15')][_0x7b71('0x51')](_0x265b04,_0x5bfdfb,this['channel'][_0x7b71('0x3a')])[_0x7b71('0x18')](function(_0x4dd001){_0x510a30(null,_[_0x7b71('0x47')](_0x4dd001)?![]:!![]);})['catch'](function(_0x5bc4f9){logger[_0x7b71('0x2e')](_0x5bc4f9);_0x510a30(null,![]);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x53')]=function(_0x4e478d,_0x38dbd7){var _0x361d38={'role':_0x7b71('0x52')};_0x361d38[_0x4e478d]=this[_0x7b71('0xe')][_0x7b71('0x3f')];this[_0x7b71('0x15')][_0x7b71('0x53')](_0x361d38)[_0x7b71('0x18')](function(_0x46856b){_0x38dbd7(null,_['isNil'](_0x46856b)?![]:!![]);})[_0x7b71('0x14')](function(_0x2304b7){logger[_0x7b71('0x2e')](_0x2304b7);_0x38dbd7(null,![]);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x54')]=function(_0x3a138a,_0x3cadf7){var _0x2f1b0b={'role':_0x7b71('0x52')};_0x2f1b0b[_0x3a138a]=this[_0x7b71('0xe')]['callerid'];this[_0x7b71('0x15')]['agentLogout'](_0x2f1b0b)['then'](function(_0x43261a){_0x3cadf7(null,_[_0x7b71('0x47')](_0x43261a)?![]:!![]);})[_0x7b71('0x14')](function(_0x964817){logger[_0x7b71('0x2e')](_0x964817);_0x3cadf7(null,![]);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x55')]=function(_0x17f0e2,_0x33cdb5){var _0x50b77d={'role':_0x7b71('0x52')};_0x50b77d[_0x17f0e2]=this[_0x7b71('0xe')][_0x7b71('0x3f')];var _0x487320=_0x17f0e2!=_0x7b71('0x56')?util[_0x7b71('0x2b')](_0x7b71('0x57'),_0x7b71('0x58'),this['channel']['callerid']):undefined;this[_0x7b71('0x15')][_0x7b71('0x55')](_0x50b77d,_0x487320)[_0x7b71('0x18')](function(_0x763ce1){_0x33cdb5(null,_[_0x7b71('0x47')](_0x763ce1)?![]:!![]);})[_0x7b71('0x14')](function(_0x4073f3){logger[_0x7b71('0x2e')](_0x4073f3);_0x33cdb5(null,![]);});};AGIVertices[_0x7b71('0x10')]['shellCommand']=function(_0x9d6c3c,_0xcd130f){sh[_0x7b71('0x59')](_[_0x7b71('0x5a')](_0x9d6c3c),function(_0x90f3b1,_0x47759b){var _0x3f2952=_0x47759b[_0x7b71('0x5b')](/(\r\n|\n|\r)/gm,'');_0xcd130f(null,_0x3f2952);});};AGIVertices['prototype'][_0x7b71('0x5c')]=function(_0x1e983c,_0x4e40f7){scripts[_0x7b71('0x5c')](_0x1e983c['apiKey'],_0x1e983c['google_cloud_tts_text_type']||'text',_0x1e983c[_0x7b71('0x5d')],_0x1e983c[_0x7b71('0x5e')]||'en-US',_0x1e983c['ssmlGender']||_0x7b71('0x5f'),_0x1e983c[_0x7b71('0x60')]||_0x7b71('0x61'))[_0x7b71('0x18')](function(_0x33042d){_0x4e40f7(null,_0x33042d);})[_0x7b71('0x14')](function(_0x743a94){_0x4e40f7(_0x743a94);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x62')]=function(_0x4364a3,_0x33a0a9){scripts[_0x7b71('0x62')](_0x4364a3[_0x7b71('0x5d')],_0x4364a3[_0x7b71('0x63')]||'en',0x1)[_0x7b71('0x18')](function(_0x6da04d){_0x33a0a9(null,_0x6da04d);})[_0x7b71('0x14')](function(_0x1d4152){_0x33a0a9(_0x1d4152);});};AGIVertices['prototype']['restAPI']=function(_0x564b69,_0x4269a6){var _0x58ed1d={'uri':_0x564b69[_0x7b71('0x64')],'method':_0x564b69[_0x7b71('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x564b69[_0x7b71('0x66')])===_0x7b71('0x67')&&parseInt(_0x564b69[_0x7b71('0x66')])>=0x1?parseInt(_0x564b69[_0x7b71('0x66')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x7b71('0x68'),_0x7b71('0x69')],_0x58ed1d[_0x7b71('0x65')][_0x7b71('0x6a')]())){try{_0x58ed1d[_0x7b71('0x6b')]=_0x564b69['rawBody']?JSON['parse'](_0x564b69[_0x7b71('0xa')]):{};}catch(_0x10445b){logger[_0x7b71('0x2e')](_0x7b71('0x6c'),_0x10445b);}}try{_0x58ed1d[_0x7b71('0x6d')]=_0x564b69[_0x7b71('0x6e')]?JSON[_0x7b71('0x6f')](_0x564b69[_0x7b71('0x6e')]):{};}catch(_0x2461b6){logger[_0x7b71('0x2e')](_0x7b71('0x70'),_0x2461b6);}if(_0x564b69['computedVariables']){try{var _0x45cecd=require(_0x564b69['computedVariables'])['sync'](this,_0x58ed1d);_0x58ed1d[_0x7b71('0x71')]=Mustache['render'](_0x564b69[_0x7b71('0x64')],_0x45cecd,{},['$$','$$']);if(_0x58ed1d['headers']){_0x58ed1d['headers']=JSON[_0x7b71('0x6f')](Mustache[_0x7b71('0x72')](JSON[_0x7b71('0x73')](_0x58ed1d['headers']),_0x45cecd,{},['$$','$$']));}if(_0x58ed1d[_0x7b71('0x6b')]){_0x58ed1d[_0x7b71('0x6b')]=JSON[_0x7b71('0x6f')](Mustache['render'](JSON[_0x7b71('0x73')](_0x58ed1d[_0x7b71('0x6b')]),_0x45cecd,{},['$$','$$']));}}catch(_0x4458f8){logger[_0x7b71('0x2e')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4458f8);}}rp(_0x58ed1d)[_0x7b71('0x18')](function(_0x311476){var _0x2681ae={'statusCode':_0x311476[_0x7b71('0x74')]||0xc8,'statusMessage':_0x311476[_0x7b71('0x75')]||'OK','headers':_0x311476[_0x7b71('0x6d')]||{},'body':_0x311476[_0x7b71('0x6b')]||{}};_0x4269a6(null,_0x2681ae);})[_0x7b71('0x14')](function(_0x718699){var _0x3d298c={'statusCode':_0x718699[_0x7b71('0x74')]||0x1f4,'statusMessage':_0x718699[_0x7b71('0x76')]||_0x7b71('0x77'),'headers':_0x718699[_0x7b71('0x78')]['headers']||{},'body':_0x718699['options'][_0x7b71('0x6b')]||{}};_0x4269a6(null,_0x3d298c);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x79')]=function(_0x3553de,_0x457115){scripts['googleDialogflow'](this[_0x7b71('0xe')][_0x7b71('0x3a')],_0x3553de[_0x7b71('0x7a')],_0x3553de[_0x7b71('0x5d')],_0x3553de[_0x7b71('0x7b')]||'en')[_0x7b71('0x18')](function(_0x37446f){_0x457115(null,_0x37446f);})[_0x7b71('0x14')](function(_0x4973f8){_0x457115(_0x4973f8);});};AGIVertices[_0x7b71('0x10')]['googleDialogflowV2']=function(_0x56f4d0,_0x5768b5){scripts[_0x7b71('0x7c')](this[_0x7b71('0xe')][_0x7b71('0x3a')],_0x56f4d0['dialogflowV2_project_id'],_0x56f4d0[_0x7b71('0x7d')],_0x56f4d0[_0x7b71('0x7e')],_0x56f4d0[_0x7b71('0x5d')],_0x56f4d0[_0x7b71('0x7f')]||'en')['then'](function(_0x16755e){_0x5768b5(null,_0x16755e);})[_0x7b71('0x14')](function(_0x43041f){_0x5768b5(_0x43041f);});};AGIVertices[_0x7b71('0x10')]['sestekNDA']=function(_0x1e0728,_0x2b4c3f){scripts[_0x7b71('0x80')](this[_0x7b71('0xe')],_0x1e0728)['then'](function(_0x21eeb0){_0x2b4c3f(null,_0x21eeb0);})['catch'](function(_0x366b4b){_0x2b4c3f(_0x366b4b);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x81')]=function(_0x490e5b,_0x82c11d){scripts[_0x7b71('0x81')](_0x490e5b['key'],_0x490e5b['text'],_0x490e5b[_0x7b71('0x82')]||'en-US',_0x490e5b[_0x7b71('0x83')])[_0x7b71('0x18')](function(_0x2cde65){_0x82c11d(null,_0x2cde65);})['catch'](function(_0x5b133a){_0x82c11d(_0x5b133a);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x84')]=function(_0x1be4eb,_0x1a5633,_0x4132c0){scripts[_0x7b71('0x84')](_0x1a5633,_0x1be4eb[_0x7b71('0x7a')],_0x1be4eb[_0x7b71('0x85')]||_0x7b71('0x86'),this[_0x7b71('0x87')](_0x1be4eb[_0x7b71('0x88')])?_0x1be4eb['model']:undefined)[_0x7b71('0x18')](function(_0x34e61a){_0x4132c0(null,_0x34e61a);})[_0x7b71('0x14')](function(_0x4b7678){_0x4132c0(_0x4b7678);});};AGIVertices[_0x7b71('0x10')]['awsPolly']=function(_0xcfe64f,_0x35d65f){scripts[_0x7b71('0x89')](_0xcfe64f[_0x7b71('0x8a')],_0xcfe64f['aws_secret_access_key'],_0xcfe64f[_0x7b71('0x8b')],_0xcfe64f['aws_polly_voice']||'Amy',_0xcfe64f[_0x7b71('0x5d')],_0xcfe64f['aws_text_type']||_0x7b71('0x5d'))[_0x7b71('0x18')](function(_0x3a489e){_0x35d65f(null,_0x3a489e);})[_0x7b71('0x14')](function(_0x5ab7b8){_0x35d65f(_0x5ab7b8);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x8c')]=function(_0x513d92,_0x12b00b){scripts[_0x7b71('0x8c')](this['channel'][_0x7b71('0x3a')],_0x513d92[_0x7b71('0x8a')],_0x513d92['aws_secret_access_key'],_0x513d92[_0x7b71('0x8d')],_0x513d92[_0x7b71('0x5d')],_0x513d92[_0x7b71('0x8e')])[_0x7b71('0x18')](function(_0xd8a3f0){_0x12b00b(null,_0xd8a3f0);})['catch'](function(_0x29abe0){_0x12b00b(_0x29abe0);});};AGIVertices[_0x7b71('0x10')]['googleASR']=function(_0x2efaea,_0xa8e84f,_0x95cf38){scripts[_0x7b71('0x8f')](_0xa8e84f,_0x2efaea['key'],_0x2efaea[_0x7b71('0x90')]||_0x7b71('0x86'))[_0x7b71('0x18')](function(_0x3f6670){_0x95cf38(null,_0x3f6670);})[_0x7b71('0x14')](function(_0x2fbce9){_0x95cf38(_0x2fbce9);});};AGIVertices['prototype'][_0x7b71('0x91')]=function(_0x2a791e,_0x452dc4,_0xe0323f){scripts[_0x7b71('0x91')](_0x452dc4,_0x2a791e[_0x7b71('0x92')],_0x2a791e[_0x7b71('0x93')],_0x2a791e['uri'])['then'](function(_0x31f22d){_0xe0323f(null,_0x31f22d);})[_0x7b71('0x14')](function(_0x145827){_0xe0323f(_0x145827);});};AGIVertices[_0x7b71('0x10')][_0x7b71('0x94')]=function(_0x1351a5){var _0x5839c4=_[_0x7b71('0x95')](verticesWithRetry,_0x1351a5[_0x7b71('0x3c')])?_0x1351a5:_[_0x7b71('0x96')](_0x1351a5);for(var _0x14ef43 in _0x5839c4){if(_0x5839c4[_0x7b71('0x97')](_0x14ef43)){if(_0x5839c4[_0x14ef43]&&_['isString'](_0x5839c4[_0x14ef43])){if(_[_0x7b71('0x95')](recursiveMapAttributes,_0x14ef43)){_0x5839c4[_0x14ef43]=this[_0x7b71('0x98')](_0x5839c4[_0x14ef43]);}else{_0x5839c4[_0x14ef43]=this['replaceAllVariables'](_0x5839c4[_0x14ef43]);}}}}return _0x5839c4;};AGIVertices[_0x7b71('0x10')]['recursiveNodeIndex']=function(_0x1bbad5){for(var _0x1e2cc9 in _0x1bbad5){if(_0x1bbad5[_0x7b71('0x97')](_0x1e2cc9)){if(_[_0x7b71('0x99')](_0x1bbad5[_0x1e2cc9])){this[_0x7b71('0x9a')](_0x1bbad5[_0x1e2cc9]);}else if(_[_0x7b71('0x9b')](_0x1bbad5[_0x1e2cc9])){for(var _0x2d0389=0x0;_0x2d0389<_0x1bbad5[_0x1e2cc9][_0x7b71('0x9c')];_0x2d0389++){this[_0x7b71('0x9a')](_0x1bbad5[_0x1e2cc9][_0x2d0389]);}}else if(_[_0x7b71('0x9d')](_0x1bbad5[_0x1e2cc9])){_0x1bbad5[_0x1e2cc9]=this[_0x7b71('0x9e')](_0x1bbad5[_0x1e2cc9]);}}}};AGIVertices[_0x7b71('0x10')]['saveRestApiResult']=function(_0x56405c,_0x4cc313){for(var _0x1531c0 in _0x56405c){if(_0x56405c[_0x7b71('0x97')](_0x1531c0)){if(_[_0x7b71('0x99')](_0x56405c[_0x1531c0])){if(!_['isEmpty'](_0x56405c[_0x1531c0])){this['saveRestApiResult'](_0x56405c[_0x1531c0],util[_0x7b71('0x2b')]('%s.%s',_0x4cc313,_0x1531c0));}}else if(_['isArray'](_0x56405c[_0x1531c0])){for(var _0x4a4f73=0x0;_0x4a4f73<_0x56405c[_0x1531c0][_0x7b71('0x9c')];_0x4a4f73++){this[_0x7b71('0x9f')](_0x56405c[_0x1531c0][_0x4a4f73],util[_0x7b71('0x2b')](_0x7b71('0xa0'),_0x4cc313,_0x1531c0+'['+_0x4a4f73+']'));}}else{if(!_[_0x7b71('0x47')](_0x56405c[_0x1531c0])){this[_0x7b71('0xe')][_0x7b71('0xa1')](util[_0x7b71('0x2b')](_0x7b71('0xa0'),_0x4cc313,_0x1531c0),_0x56405c[_0x1531c0]);}}}}};AGIVertices['prototype'][_0x7b71('0x98')]=function(_0x174e6a){try{var _0x326663=JSON[_0x7b71('0x6f')](_0x174e6a);this[_0x7b71('0x9a')](_0x326663);return JSON[_0x7b71('0x73')](_0x326663);}catch(_0x1e2f82){return this['replaceAllVariables'](_0x174e6a);}};AGIVertices[_0x7b71('0x10')]['replaceAllVariables']=function(_0x5c38ed){var _0x8bb6fc=_0x5c38ed[_0x7b71('0xa2')]('{');for(var _0x35ccb9=0x1;_0x35ccb9<_0x8bb6fc[_0x7b71('0x9c')];_0x35ccb9+=0x1){var _0x2f156f=_0x8bb6fc[_0x35ccb9][_0x7b71('0xa2')]('}');if(_0x2f156f[_0x7b71('0x9c')]>0x1){_0x5c38ed=_0x5c38ed[_0x7b71('0xa3')]('{'+_0x2f156f[0x0]+'}',this[_0x7b71('0xe')][_0x7b71('0x11')](_0x2f156f[0x0])[_0x7b71('0xa4')]||_0x2f156f[0x0]);}}if(_0x8bb6fc[_0x7b71('0x9c')]===0x1){return _0x5c38ed[_0x7b71('0xa5')]();}return this[_0x7b71('0x9e')](_0x5c38ed);};AGIVertices[_0x7b71('0x10')][_0x7b71('0xa6')]=function(_0x4b927a,_0x3a24d7){var _0x188bac=this[_0x7b71('0xe')][_0x7b71('0x11')](_0x4b927a);if(_0x188bac['result']===-0x1){return _0x188bac;}logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x3a24d7,_0x188bac[_0x7b71('0xa4')]));return this[_0x7b71('0xe')][_0x7b71('0xa1')](_0x3a24d7,_0x188bac['extra']);};AGIVertices[_0x7b71('0x10')]['isConfigured']=function(_0x5673db){return _0x5673db&&_0x5673db!=='0'&&_0x5673db!=='-1'&&_0x5673db!=='';};AGIVertices[_0x7b71('0x10')]['maxRetry']=function(_0x5dc3c3){this[_0x7b71('0x39')][_0x7b71('0xa7')](this,_0x5dc3c3,'-');_0x5dc3c3['retry']=_0x5dc3c3[_0x7b71('0xa8')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x7b71('0xa9')]=function(_0x235350){logger[_0x7b71('0x33')](util['format'](_0x7b71('0xaa'),_0x235350['label']));if(!this[_0x7b71('0x87')](_0x235350['text'])){return this[_0x7b71('0xe')][_0x7b71('0xab')]('no\x20text\x20configured');}var _0x2d1fe3='\x22'+_0x235350[_0x7b71('0x5d')]+'\x22';if(this[_0x7b71('0x87')](_0x235350[_0x7b71('0x78')])){_0x2d1fe3+=','+_0x235350[_0x7b71('0x78')];}var _0x42f6d7=this['channel'][_0x7b71('0x59')](_0x7b71('0xac'),_0x2d1fe3);if(_0x42f6d7[_0x7b71('0xad')]===-0x1){return _0x42f6d7;}return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xae'),_0x2d1fe3));};AGIVertices[_0x7b71('0x10')][_0x7b71('0xaf')]=function(_0x360bd5){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x360bd5[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x360bd5[_0x7b71('0xb0')])){return this[_0x7b71('0xe')][_0x7b71('0xab')]('no\x20grammar\x20configured');}var _0xf7d3db=_0x360bd5['grammar'];if(this[_0x7b71('0x87')](_0x360bd5[_0x7b71('0x78')])){_0xf7d3db+=','+_0x360bd5[_0x7b71('0x78')];}var _0x1d6f93=this['channel'][_0x7b71('0x59')](_0x7b71('0xb1'),_0xf7d3db);if(_0x1d6f93[_0x7b71('0xad')]===-0x1){return _0x1d6f93;}var _0x3778d6=this[_0x7b71('0xa6')](_0x7b71('0xb2'),'MRCP_RECOG_CONFIDENCE');if(_0x3778d6[_0x7b71('0xad')]===-0x1){return _0x3778d6;}var _0x56e0ab=this['getAndSetVariable'](_0x7b71('0xb3'),_0x7b71('0xb4'));if(_0x56e0ab[_0x7b71('0xad')]===-0x1){return _0x56e0ab;}var _0xcf3dd6=this[_0x7b71('0xa6')](_0x7b71('0xb5'),_0x7b71('0xb6'));if(_0xcf3dd6['result']===-0x1){return _0xcf3dd6;}return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xb7'),_0xf7d3db));};AGIVertices[_0x7b71('0x10')][_0x7b71('0x6')]=function(_0x41dc95){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0xb8'),_0x41dc95[_0x7b71('0x3b')]));return this['channel']['agi']([_0x41dc95[_0x7b71('0xb9')],_0x41dc95[_0x7b71('0xba')]]);};AGIVertices[_0x7b71('0x10')][_0x7b71('0xbb')]=function(_0x513f35){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0xbc'),_0x513f35[_0x7b71('0x3b')]));if(this['isConfigured'](_0x513f35[_0x7b71('0x66')])){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x513f35[_0x7b71('0x66')]));var _0x3748e6=this[_0x7b71('0xe')][_0x7b71('0xbd')](_0x513f35[_0x7b71('0x66')]);if(_0x3748e6['result']===-0x1){return _0x3748e6;}}return this[_0x7b71('0xe')]['answer']();};AGIVertices[_0x7b71('0x10')][_0x7b71('0x4d')]=function(_0x54eeb8){logger[_0x7b71('0x33')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x54eeb8[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x54eeb8[_0x7b71('0xbe')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x54eeb8,'no\x20list\x20selected');}_0x54eeb8[_0x7b71('0x4c')]=moment();if(this['isConfigured'](_0x54eeb8[_0x7b71('0xbf')])){_0x54eeb8[_0x7b71('0x4c')]=moment()[_0x7b71('0xc0')](_0x54eeb8[_0x7b71('0xbf')],_0x7b71('0xc1'));}if(!this[_0x7b71('0x87')](_0x54eeb8['callback_priority'])){_0x54eeb8['callback_priority']=0x2;}this[_0x7b71('0x46')][_0x7b71('0xa7')](this,_0x54eeb8);return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xc2'),_0x54eeb8['phone'],_0x54eeb8[_0x7b71('0xbe')],_0x54eeb8[_0x7b71('0x4c')]));};AGIVertices[_0x7b71('0x10')][_0x7b71('0xc3')]=function(_0x57e3a6){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0xc4'),_0x57e3a6[_0x7b71('0x3b')]));var _0x5d14b5=this['channel'][_0x7b71('0x59')](_0x57e3a6[_0x7b71('0xc5')],_0x57e3a6[_0x7b71('0x78')]);if(_0x5d14b5['result']===-0x1){return _0x5d14b5;}return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xc6'),_0x57e3a6[_0x7b71('0xc5')],_0x57e3a6[_0x7b71('0x78')]));};AGIVertices[_0x7b71('0x10')][_0x7b71('0xc7')]=function(_0x1d308f){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x1d308f[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x1d308f[_0x7b71('0x5d')])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0xc8'));}var _0x169397='\x22'+_0x1d308f['text']+'\x22';if(this[_0x7b71('0x87')](_0x1d308f[_0x7b71('0x78')])){_0x169397+=','+_0x1d308f[_0x7b71('0x78')];}var _0x520011=this[_0x7b71('0xe')][_0x7b71('0x59')](_0x7b71('0xac'),_0x169397);if(_0x520011[_0x7b71('0xad')]===-0x1){return _0x520011;}return this[_0x7b71('0xe')]['noop'](util[_0x7b71('0x2b')](_0x7b71('0xae'),_0x169397));};AGIVertices['prototype'][_0x7b71('0xc9')]=function(_0x394db2){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x394db2[_0x7b71('0x3b')]));if(!this['isConfigured'](_0x394db2['text'])){return this['channel'][_0x7b71('0xab')](_0x7b71('0xc8'));}var _0x4bf980='\x22'+_0x394db2[_0x7b71('0x5d')]+'\x22';if(this[_0x7b71('0x87')](_0x394db2['options'])){_0x4bf980+=','+_0x394db2[_0x7b71('0x78')];}var _0x320356=this[_0x7b71('0xe')][_0x7b71('0x59')](_0x7b71('0xac'),_0x4bf980);if(_0x320356['result']===-0x1){return _0x320356;}return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xae'),_0x4bf980));};AGIVertices[_0x7b71('0x10')][_0x7b71('0xca')]=function(_0xcadd1b){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0xcb'),_0xcadd1b[_0x7b71('0x3b')]));if(!this['isConfigured'](_0xcadd1b['grammar'])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0xcc'));}var _0x1a7212=_0xcadd1b[_0x7b71('0xb0')];if(this['isConfigured'](_0xcadd1b[_0x7b71('0x78')])){_0x1a7212+=','+_0xcadd1b[_0x7b71('0x78')];}var _0x57f295=this['channel'][_0x7b71('0x59')](_0x7b71('0xb1'),_0x1a7212);if(_0x57f295['result']===-0x1){return _0x57f295;}var _0xf67613=this[_0x7b71('0xa6')]('RECOG_CONFIDENCE()',_0x7b71('0xcd'));if(_0xf67613[_0x7b71('0xad')]===-0x1){return _0xf67613;}var _0xd138b=this[_0x7b71('0xa6')](_0x7b71('0xb3'),_0x7b71('0xce'));if(_0xd138b['result']===-0x1){return _0xd138b;}var _0x1476f4=this[_0x7b71('0xa6')]('RECOG_INSTANCE()',_0x7b71('0xcf'));if(_0x1476f4[_0x7b71('0xad')]===-0x1){return _0x1476f4;}return this[_0x7b71('0xe')][_0x7b71('0xab')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x1a7212));};AGIVertices[_0x7b71('0x10')][_0x7b71('0xd0')]=function(_0x5f36a6){logger['info'](util[_0x7b71('0x2b')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x5f36a6[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x5f36a6['grammar'])){return this['channel'][_0x7b71('0xab')](_0x7b71('0xcc'));}var _0x56b2d5=_0x5f36a6[_0x7b71('0xb0')];if(this[_0x7b71('0x87')](_0x5f36a6[_0x7b71('0x78')])){_0x56b2d5+=','+_0x5f36a6[_0x7b71('0x78')];}var _0x1b634d=this[_0x7b71('0xe')][_0x7b71('0x59')](_0x7b71('0xb1'),_0x56b2d5);if(_0x1b634d[_0x7b71('0xad')]===-0x1){return _0x1b634d;}var _0xc843a9=this['getAndSetVariable'](_0x7b71('0xb2'),_0x7b71('0xd1'));if(_0xc843a9[_0x7b71('0xad')]===-0x1){return _0xc843a9;}var _0x55b3af=this['getAndSetVariable'](_0x7b71('0xb3'),'SESTEK_ASR_TRANSCRIPT');if(_0x55b3af[_0x7b71('0xad')]===-0x1){return _0x55b3af;}var _0x2b8f55=this['getAndSetVariable'](_0x7b71('0xb5'),_0x7b71('0xd2'));if(_0x2b8f55[_0x7b71('0xad')]===-0x1){return _0x2b8f55;}return this['channel'][_0x7b71('0xab')](util[_0x7b71('0x2b')]('Executed\x20command\x20MRCPRecog\x20%s',_0x56b2d5));};AGIVertices[_0x7b71('0x10')]['database']=function(_0x2e16e5){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0xd3'),_0x2e16e5[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x2e16e5['odbc_id'])){return this[_0x7b71('0xe')]['error'](_0x2e16e5,_0x7b71('0xd4'));}var _0xeb3f38=this[_0x7b71('0x19')][_0x7b71('0xa7')](this,_0x2e16e5['odbc_id']);if(!_0xeb3f38){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x2e16e5,_0x7b71('0xd5'));}if(!this[_0x7b71('0x87')](_0x2e16e5[_0x7b71('0x31')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x2e16e5,_0x7b71('0xd6'));}var _0x3d8ecc=_0x2e16e5[_0x7b71('0x31')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x7b71('0xe')]['noop'](util[_0x7b71('0x2b')](_0x7b71('0xd7'),_0x3d8ecc));var _0x40890e=this[_0x7b71('0xd8')]['sync'](this,_0xeb3f38,_0x3d8ecc);this[_0x7b71('0x39')][_0x7b71('0xa7')](this,_0x2e16e5,_0x3d8ecc);if(!this[_0x7b71('0x87')](_0x2e16e5[_0x7b71('0xd9')])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0xda'));}var _0x517bd8=this[_0x7b71('0x11')][_0x7b71('0xa7')](this,_0x2e16e5[_0x7b71('0xd9')]);if(!_0x517bd8){return this['channel'][_0x7b71('0x2e')](_0x2e16e5,'no\x20variable\x20found');}var _0x3a88f4=this;_0x40890e['forEach'](function(_0x5b3fcf,_0x3fa2c0){Object[_0x7b71('0xdb')](_0x5b3fcf)[_0x7b71('0xdc')](function(_0x1728f1){_0x3a88f4[_0x7b71('0xe')][_0x7b71('0xa1')](util[_0x7b71('0x2b')]('%s[%s][%s]',_0x517bd8,_0x3fa2c0,_0x1728f1),_0x5b3fcf[_0x1728f1]);});});this['channel'][_0x7b71('0xa1')](util[_0x7b71('0x2b')]('%s_ROWS_COUNT',_0x517bd8),_0x40890e[_0x7b71('0x9c')]);return this['channel'][_0x7b71('0xab')](util[_0x7b71('0x2b')]('variable\x20%s\x20set',_0x517bd8));};AGIVertices[_0x7b71('0x10')][_0x7b71('0xdd')]=function(_0x2ddc64){logger['debug'](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x2ddc64[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x2ddc64[_0x7b71('0xde')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x2ddc64,'no\x20user\x20selected');}var _0x5e70c6=this[_0x7b71('0x1c')]['sync'](this,_0x2ddc64[_0x7b71('0xde')]);if(!_0x5e70c6){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x2ddc64,'no\x20user\x20found');}var _0x1944d0=this['channel'][_0x7b71('0x59')](_0x7b71('0xdf'),[util[_0x7b71('0x2b')](_0x7b71('0xe0'),_0x5e70c6),_0x2ddc64[_0x7b71('0x66')],_0x2ddc64[_0x7b71('0xe1')],_0x2ddc64[_0x7b71('0x64')]]);if(_0x1944d0[_0x7b71('0xad')]===-0x1){return _0x1944d0;}return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xe2'),'DIAL'));};AGIVertices[_0x7b71('0x10')][_0x7b71('0xe3')]=function(_0x150f2d){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x150f2d[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x150f2d[_0x7b71('0x7a')])){return this['channel'][_0x7b71('0xab')]('no\x20key\x20configured');}if(!this[_0x7b71('0x87')](_0x150f2d[_0x7b71('0x5d')])){return this['channel'][_0x7b71('0xab')]('no\x20text\x20configured');}this[_0x7b71('0xe')][_0x7b71('0xe4')]=!![];this[_0x7b71('0x39')](_0x150f2d);this[_0x7b71('0x45')](_0x150f2d[_0x7b71('0x5d')],'in','','');this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xe5'),_0x150f2d[_0x7b71('0x5d')]));var _0x2c11eb=this[_0x7b71('0x79')][_0x7b71('0xa7')](this,_0x150f2d);if(_0x2c11eb){for(var _0x511f88 in _0x2c11eb){if(_0x2c11eb[_0x7b71('0x97')](_0x511f88)){this[_0x7b71('0xe')][_0x7b71('0xa1')](util[_0x7b71('0x2b')]('DIALOGFLOW_%s',_0x511f88[_0x7b71('0x6a')]()),_0x2c11eb[_0x511f88]);}}this[_0x7b71('0x45')](_0x2c11eb[_0x7b71('0xe6')],_0x7b71('0xe7'),_0x7b71('0xe3'),'');return this[_0x7b71('0xe')]['noop'](util['format'](_0x7b71('0xe8'),_0x2c11eb[_0x7b71('0xe6')]));}return this['channel']['error'](_0x150f2d,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype']['dialogflowV2']=function(_0x15a001){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x15a001[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x15a001[_0x7b71('0xe9')])){return this['channel']['noop'](_0x7b71('0xea'));}if(!this[_0x7b71('0x87')](_0x15a001['client_email'])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0xeb'));}if(!this[_0x7b71('0x87')](_0x15a001[_0x7b71('0x7e')])){return this[_0x7b71('0xe')]['noop'](_0x7b71('0xec'));}if(!this[_0x7b71('0x87')](_0x15a001[_0x7b71('0x7f')])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0xed'));}if(!this[_0x7b71('0x87')](_0x15a001[_0x7b71('0x5d')])){return this[_0x7b71('0xe')]['noop']('no\x20text\x20configured');}this[_0x7b71('0xe')][_0x7b71('0xe4')]=!![];this[_0x7b71('0x39')](_0x15a001);this[_0x7b71('0x45')](_0x15a001[_0x7b71('0x5d')],'in','','');this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xee'),_0x15a001[_0x7b71('0x5d')]));var _0x36f1fb=this[_0x7b71('0x7c')][_0x7b71('0xa7')](this,_0x15a001);if(_0x36f1fb){for(var _0x5c6127 in _0x36f1fb){if(_0x36f1fb[_0x7b71('0x97')](_0x5c6127)){if(_0x5c6127!==_0x7b71('0xef')){this[_0x7b71('0xe')][_0x7b71('0xa1')](util[_0x7b71('0x2b')](_0x7b71('0xf0'),_0x5c6127[_0x7b71('0x6a')]()),_0x36f1fb[_0x5c6127]);}}}this[_0x7b71('0x45')](_0x36f1fb['speech'],_0x7b71('0xe7'),_0x7b71('0xf1'),_0x36f1fb[_0x7b71('0xef')]);return this[_0x7b71('0xe')]['noop'](util['format'](_0x7b71('0xf2'),_0x36f1fb[_0x7b71('0xe6')]));}return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x15a001,_0x7b71('0xf3'));};AGIVertices['prototype'][_0x7b71('0xf4')]=function(_0xdb046f){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0xdb046f[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0xdb046f[_0x7b71('0xf5')])){return this['channel'][_0x7b71('0xab')](_0x7b71('0xf6'));}if(!this[_0x7b71('0x87')](_0xdb046f[_0x7b71('0xf7')])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0xf8'));}if(!this[_0x7b71('0x87')](_0xdb046f['password'])){return this[_0x7b71('0xe')][_0x7b71('0xab')]('no\x20password\x20configured');}if(!this[_0x7b71('0x87')](_0xdb046f[_0x7b71('0xf9')])){return this['channel'][_0x7b71('0xab')](_0x7b71('0xc8'));}this[_0x7b71('0xe')][_0x7b71('0xe4')]=!![];this['createSquareDetailsReport'](_0xdb046f);this['createSquareMessage'](_0xdb046f[_0x7b71('0x5d')],'in','','');this['channel']['noop'](util[_0x7b71('0x2b')](_0x7b71('0xfa'),_0xdb046f[_0x7b71('0x5d')]));var _0x298952=this[_0x7b71('0x80')][_0x7b71('0xa7')](this,_0xdb046f);if(_0x298952){for(var _0x35929f in _0x298952){if(_0x298952[_0x7b71('0x97')](_0x35929f)){this['channel'][_0x7b71('0xa1')](util['format']('SESTEK_NDA_%s',_0x35929f['toUpperCase']()),_0x298952[_0x35929f]);}}this[_0x7b71('0x45')](_0x298952[_0x7b71('0xe6')],_0x7b71('0xe7'),_0x7b71('0xf4'),'');if(_0x298952[_0x7b71('0xfb')]){this[_0x7b71('0xe')]['noop'](util[_0x7b71('0x2b')](_0x7b71('0xfc'),_0x298952[_0x7b71('0xfb')]));var _0x59c39f=this[_0x7b71('0xe')][_0x7b71('0xfd')](_0x298952[_0x7b71('0xfb')]);try{fs[_0x7b71('0xfe')](_0x298952[_0x7b71('0xfb')]+'.wav');}catch(_0x506881){logger[_0x7b71('0x2e')](_0x506881);}return _0x59c39f;}else{return this[_0x7b71('0xe')][_0x7b71('0xab')](util['format'](_0x7b71('0xff'),_0x298952['speech']));}}return this['channel'][_0x7b71('0x2e')](_0xdb046f,_0x7b71('0x100'));};AGIVertices['prototype'][_0x7b71('0x101')]=function(_0x23e4bc){logger['info'](util['format'](_0x7b71('0x102'),_0x23e4bc['label']));return this['channel'][_0x7b71('0xab')](_0x7b71('0x101'));};AGIVertices['prototype'][_0x7b71('0x103')]=function(_0x2a7868){logger[_0x7b71('0x33')](util['format'](_0x7b71('0x104'),_0x2a7868['label']));var _0x51687c='';if(_0x2a7868[_0x7b71('0x105')]){if(!this['isConfigured'](_0x2a7868['trunk_id'])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x2a7868,_0x7b71('0x106'));}else{var _0x276f13=parseInt(_0x2a7868['trunk_id'],0xa);if(isNaN(_0x276f13)){_0x51687c=_0x2a7868[_0x7b71('0x105')];}else{_0x51687c=this[_0x7b71('0x1d')][_0x7b71('0xa7')](this,_0x2a7868['trunk_id']);if(!_0x51687c){return this['channel']['error'](_0x2a7868,_0x7b71('0x107'));}}}}else if(_0x2a7868['trunk_name']){_0x51687c=_0x2a7868[_0x7b71('0x108')];}else{return this['channel']['error'](_0x2a7868,'no\x20trunk\x20selected');}var _0x555954=this[_0x7b71('0xe')][_0x7b71('0x59')](_0x7b71('0xdf'),[util[_0x7b71('0x2b')](_0x7b71('0x109'),_0x51687c,_0x2a7868[_0x7b71('0x10a')]),_0x2a7868[_0x7b71('0x66')],_0x2a7868[_0x7b71('0xe1')],_0x2a7868[_0x7b71('0x64')]]);if(_0x555954[_0x7b71('0xad')]===-0x1){return _0x555954;}return this['channel'][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xe2'),_0x7b71('0xdf')));};AGIVertices['prototype'][_0x7b71('0x10b')]=function(_0x5563a0){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x10c'),_0x5563a0[_0x7b71('0x3b')]));return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0x10b'));};AGIVertices[_0x7b71('0x10')][_0x7b71('0xc')]=function(_0x66c78){logger['info'](util[_0x7b71('0x2b')](_0x7b71('0x10d'),_0x66c78[_0x7b71('0x3b')]));if(_0x66c78[_0x7b71('0x10e')]===0x0){return this[_0x7b71('0xa8')](_0x66c78);}_0x66c78[_0x7b71('0x10e')]-=0x1;if(!this[_0x7b71('0x87')](_0x66c78[_0x7b71('0x10f')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x66c78,_0x7b71('0x110'));}var _0x3aad7a=this[_0x7b71('0x1f')]['sync'](this,_0x66c78[_0x7b71('0x10f')]);if(!_0x3aad7a){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x66c78,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x66c78[_0x7b71('0xd9')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x7b71('0xda'));}var _0x13d21d=this['channel'][_0x7b71('0x111')](_0x3aad7a,_0x66c78['response'],_0x66c78['maxdigit']);var _0x4f463d=_0x13d21d['result']?_0x13d21d['result']['toString']():'';logger[_0x7b71('0x33')](_0x7b71('0x112'),JSON[_0x7b71('0x73')](_0x13d21d));if(_0x13d21d['result']===-0x1){this['createSquareDetailsReport'][_0x7b71('0xa7')](this,_0x66c78,_0x4f463d);return _0x13d21d;}else if(_0x13d21d['extra']===_0x7b71('0x66')){_0x13d21d[_0x7b71('0xad')]=_0x4f463d[_0x7b71('0x9c')]>=parseInt(_0x66c78[_0x7b71('0x113')])?'x':'i';}else{_0x13d21d['result']=_0x4f463d['length']>=parseInt(_0x66c78[_0x7b71('0x113')])&&_0x4f463d['length']<=parseInt(_0x66c78[_0x7b71('0x114')])?'x':'i';}var _0x2a8282=this[_0x7b71('0x11')][_0x7b71('0xa7')](this,_0x66c78[_0x7b71('0xd9')]);if(!_0x2a8282){return this['channel'][_0x7b71('0x2e')](_0x66c78,_0x7b71('0x115'));}this[_0x7b71('0xe')][_0x7b71('0xa1')](_0x2a8282,_0x4f463d);if(this[_0x7b71('0x87')](_0x66c78['hiddendigitsnum'])){var _0x5f2519=parseInt(_0x66c78['hiddendigitsnum'],0xa);var _0x14e82f=rs[_0x7b71('0x116')]({'charset':'*','length':_0x5f2519});var _0x55342a=_0x4f463d[_0x7b71('0x9c')];if(_0x55342a>0x0){if(_0x55342a>_0x5f2519){this[_0x7b71('0x39')][_0x7b71('0xa7')](this,_0x66c78,_0x66c78['hiddendigitspos']==='first'?_0x14e82f+_0x4f463d[_0x7b71('0x117')](_0x5f2519):_0x4f463d[_0x7b71('0x117')](0x0,_0x55342a-_0x5f2519)+_0x14e82f);}else{this[_0x7b71('0x39')][_0x7b71('0xa7')](this,_0x66c78,rs[_0x7b71('0x116')]({'charset':'*','length':_0x55342a}));}}else{this[_0x7b71('0x39')]['sync'](this,_0x66c78,'');}}else{this[_0x7b71('0x39')][_0x7b71('0xa7')](this,_0x66c78,_0x4f463d);}return _0x13d21d;};AGIVertices[_0x7b71('0x10')][_0x7b71('0xd')]=function(_0x4cd59f){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x4cd59f[_0x7b71('0x3b')]));return this['getdigits'](_0x4cd59f);};AGIVertices[_0x7b71('0x10')][_0x7b71('0x118')]=function(_0x1d4e15){logger[_0x7b71('0x33')](util['format'](_0x7b71('0x119'),_0x1d4e15[_0x7b71('0x3b')]));this[_0x7b71('0x39')]['sync'](this,_0x1d4e15,_0x1d4e15[_0x7b71('0x11a')]);return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')]('GOAL\x20%s',_0x1d4e15[_0x7b71('0x11a')]));};AGIVertices['prototype']['awspolly']=function(_0x783b5f){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x11b'),_0x783b5f[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x783b5f[_0x7b71('0x8a')])||!this[_0x7b71('0x87')](_0x783b5f[_0x7b71('0x11c')])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0x11d'));}if(!this[_0x7b71('0x87')](_0x783b5f[_0x7b71('0x5d')])){return this[_0x7b71('0xe')][_0x7b71('0xab')]('no\x20text\x20configured');}this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x11e'),_0x783b5f['text']));var _0x58cb84=this['awsPolly'][_0x7b71('0xa7')](this,_0x783b5f);if(_0x58cb84){this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x11f'),_0x58cb84));var _0x16e5d5=this[_0x7b71('0xe')][_0x7b71('0xfd')](_0x58cb84);try{fs[_0x7b71('0xfe')](_0x58cb84+'.wav');}catch(_0xf52364){logger[_0x7b71('0x2e')](_0xf52364);}return _0x16e5d5;}return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x783b5f,_0x7b71('0x120'));};AGIVertices['prototype'][_0x7b71('0x121')]=function(_0x30fdfd){logger[_0x7b71('0x33')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x30fdfd[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x30fdfd[_0x7b71('0x8a')])||!this[_0x7b71('0x87')](_0x30fdfd[_0x7b71('0x11c')])){return this[_0x7b71('0xe')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x7b71('0x87')](_0x30fdfd[_0x7b71('0x8e')])){return this[_0x7b71('0xe')]['noop'](_0x7b71('0x122'));}if(!this[_0x7b71('0x87')](_0x30fdfd[_0x7b71('0x5d')])){return this[_0x7b71('0xe')]['noop'](_0x7b71('0xc8'));}this[_0x7b71('0xe')]['bot']=!![];this[_0x7b71('0x39')](_0x30fdfd);this[_0x7b71('0x45')](_0x30fdfd[_0x7b71('0x5d')],'in','','');this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x123'),_0x30fdfd[_0x7b71('0x5d')]));var _0x321a2c=this[_0x7b71('0x8c')]['sync'](this,_0x30fdfd);if(_0x321a2c){for(var _0x47f1c9 in _0x321a2c){if(_0x321a2c[_0x7b71('0x97')](_0x47f1c9)&&_[_0x7b71('0x9d')](_0x321a2c[_0x47f1c9])){this[_0x7b71('0xe')][_0x7b71('0xa1')](util['format'](_0x7b71('0x124'),_0x47f1c9['toUpperCase']()),_0x321a2c[_0x47f1c9]);}}if(_[_0x7b71('0x47')](_0x321a2c[_0x7b71('0x76')])){return this[_0x7b71('0xe')]['noop'](_0x7b71('0x125'));}else{this[_0x7b71('0x45')](_0x321a2c[_0x7b71('0x76')],'out',_0x7b71('0x126'),'');return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x127'),_0x321a2c[_0x7b71('0x76')]));}}return this['channel'][_0x7b71('0x2e')](_0x30fdfd,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x7b71('0x10')][_0x7b71('0x128')]=function(_0x588d86){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x129'),_0x588d86[_0x7b71('0x3b')],_0x588d86[_0x7b71('0x66')]));if(!this['isConfigured'](_0x588d86['key'])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0x12a'));}var _0x1a0500=_0x7b71('0x12b');var _0x1689e1=util[_0x7b71('0x2b')]('%s/recordings/%s',FILES_PATH,rs[_0x7b71('0x116')](0x4));var _0x7c551c=util[_0x7b71('0x2b')](_0x7b71('0xa0'),_0x1689e1,_0x1a0500);var _0x332a7b=!![];if(_0x588d86[_0x7b71('0x12c')]==='NOBEEP'){_0x332a7b=![];}var _0x1735d2=this[_0x7b71('0xe')][_0x7b71('0x12d')](_0x1689e1,_0x1a0500,_0x588d86[_0x7b71('0x12e')],_0x588d86['timeout'],undefined,_0x332a7b);if(_0x1735d2[_0x7b71('0xad')]!==-0x1){this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x12f'),_0x7c551c));var _0x932ff8=this[_0x7b71('0x8f')][_0x7b71('0xa7')](this,_0x588d86,_0x7c551c);if(_0x932ff8){for(var _0x373b96 in _0x932ff8){if(_0x932ff8[_0x7b71('0x97')](_0x373b96)){this[_0x7b71('0xe')][_0x7b71('0xa1')](util[_0x7b71('0x2b')](_0x7b71('0x130'),_0x373b96['toUpperCase']()),_0x932ff8[_0x373b96]);}}return this[_0x7b71('0xe')]['noop'](util[_0x7b71('0x2b')](_0x7b71('0x131'),JSON[_0x7b71('0x73')](_0x932ff8)));}}return _0x1735d2;};AGIVertices[_0x7b71('0x10')]['tildeasr']=function(_0x139700){logger[_0x7b71('0x33')](util['format'](_0x7b71('0x132'),_0x139700[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x139700[_0x7b71('0x92')])){return this[_0x7b71('0xe')]['noop'](_0x7b71('0x133'));}if(!this[_0x7b71('0x87')](_0x139700[_0x7b71('0x93')])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0x134'));}var _0xf4ecac='wav';var _0x112da2=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x7b71('0x116')](0x4));var _0x1ce689=util[_0x7b71('0x2b')]('%s.%s',_0x112da2,_0xf4ecac);var _0x5007b1=!![];if(_0x139700[_0x7b71('0x12c')]===_0x7b71('0x135')){_0x5007b1=![];}var _0x2576db=this[_0x7b71('0xe')][_0x7b71('0x12d')](_0x112da2,_0xf4ecac,_0x139700['intKey'],_0x139700[_0x7b71('0x66')],undefined,_0x5007b1);if(_0x2576db['result']!==-0x1){this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x136'),_0x1ce689));var _0x13bbc0=this['tildeASR'][_0x7b71('0xa7')](this,_0x139700,_0x1ce689);if(_0x13bbc0){for(var _0x12a279 in _0x13bbc0){if(_0x13bbc0[_0x7b71('0x97')](_0x12a279)){this[_0x7b71('0xe')][_0x7b71('0xa1')](util[_0x7b71('0x2b')](_0x7b71('0x137'),_0x12a279['toUpperCase']()),_0x13bbc0[_0x12a279]);}}return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x138'),JSON[_0x7b71('0x73')](_0x13bbc0)));}}return _0x2576db;};AGIVertices[_0x7b71('0x10')]['gotoc']=function(_0x2e76c5){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x2e76c5[_0x7b71('0x3b')]));return this[_0x7b71('0xe')][_0x7b71('0x139')](_0x2e76c5[_0x7b71('0x40')],_0x2e76c5[_0x7b71('0x41')],_0x2e76c5[_0x7b71('0x42')]);};AGIVertices[_0x7b71('0x10')]['gotoif']=function(_0x11170b){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x11170b[_0x7b71('0x3b')]));if(!this['isConfigured'](_0x11170b[_0x7b71('0x13a')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x11170b,_0x7b71('0x13b'));}try{var _0x33f111=eval(_0x11170b[_0x7b71('0x13a')])?_0x7b71('0x13c'):_0x7b71('0x13d');this['channel'][_0x7b71('0xab')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x11170b[_0x7b71('0x13a')],_0x33f111));return{'code':0xc8,'result':_0x33f111};}catch(_0xdca961){return{'code':0xc8,'result':_0x7b71('0x13d')};}};AGIVertices[_0x7b71('0x10')][_0x7b71('0x13e')]=function(_0x55735f){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x13f'),_0x55735f[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x55735f[_0x7b71('0x140')])){return this['channel'][_0x7b71('0x2e')](_0x55735f,_0x7b71('0x141'));}var _0x364b99=this['getIntervals'][_0x7b71('0xa7')](this,_0x55735f[_0x7b71('0x140')]);if(!_0x364b99){return this[_0x7b71('0xe')]['error'](_0x55735f,_0x7b71('0x142'));}for(var _0x1e1df6=0x0;_0x1e1df6<_0x364b99[_0x7b71('0x9c')];_0x1e1df6+=0x1){var _0x142ce1=this[_0x7b71('0xe')][_0x7b71('0x11')](util[_0x7b71('0x2b')](_0x7b71('0x143'),_0x364b99[_0x1e1df6]));if(_0x142ce1['result']===-0x1){return _0x142ce1;}logger[_0x7b71('0x33')](util['format'](_0x7b71('0x144'),_0x364b99[_0x1e1df6],_0x142ce1[_0x7b71('0xa4')]));if(_0x142ce1[_0x7b71('0xa4')]===_0x7b71('0x13c')){logger['info'](util[_0x7b71('0x2b')](_0x7b71('0x144'),_0x364b99[_0x1e1df6],_0x7b71('0x13c')));this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')]('IFTIME\x20%s\x20%s',_0x364b99[_0x1e1df6],_0x7b71('0x13c')));return{'code':0xc8,'result':'true'};}else{logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x144'),_0x364b99[_0x1e1df6],'false'));this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x144'),_0x364b99[_0x1e1df6],_0x7b71('0x13d')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x7b71('0x10')][_0x7b71('0x145')]=function(_0x30b996){logger['info'](util[_0x7b71('0x2b')](_0x7b71('0x146'),_0x30b996[_0x7b71('0x3b')]));return this['channel'][_0x7b71('0x145')]();};AGIVertices[_0x7b71('0x10')][_0x7b71('0x147')]=function(_0x35eb13){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x148'),_0x35eb13[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x35eb13[_0x7b71('0x7a')])){return this['channel'][_0x7b71('0xab')](_0x7b71('0x12a'));}var _0x18b6a0=_0x7b71('0x12b');var _0x2051f4=util[_0x7b71('0x2b')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x137daa=util[_0x7b71('0x2b')](_0x7b71('0xa0'),_0x2051f4,_0x18b6a0);var _0x14d2a6=!![];if(_0x35eb13[_0x7b71('0x12c')]==='NOBEEP'){_0x14d2a6=![];}var _0x556536=this[_0x7b71('0xe')][_0x7b71('0x12d')](_0x2051f4,_0x18b6a0,_0x35eb13['intKey'],_0x35eb13[_0x7b71('0x66')],undefined,_0x14d2a6);if(_0x556536[_0x7b71('0xad')]!==-0x1){this['channel'][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x149'),_0x137daa));var _0x2cce64=this[_0x7b71('0x84')]['sync'](this,_0x35eb13,_0x137daa);if(_0x2cce64){for(var _0x560a8d in _0x2cce64){if(_0x2cce64['hasOwnProperty'](_0x560a8d)){this[_0x7b71('0xe')]['setVariable'](util['format']('ISPEECH_ASR_%s',_0x560a8d[_0x7b71('0x6a')]()),_0x2cce64[_0x560a8d]);}}return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x14a'),JSON[_0x7b71('0x73')](_0x2cce64)));}}return _0x556536;};AGIVertices[_0x7b71('0x10')]['ispeechtts']=function(_0x41495d){logger['info'](util['format'](_0x7b71('0x14b'),_0x41495d['label']));if(!this['isConfigured'](_0x41495d[_0x7b71('0x7a')])){return this[_0x7b71('0xe')]['noop'](_0x7b71('0x12a'));}if(!this[_0x7b71('0x87')](_0x41495d['text'])){return this[_0x7b71('0xe')][_0x7b71('0xab')]('no\x20text\x20configured');}this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x14c'),_0x41495d['text']));var _0x2d9fa7=this['ispeechTTS'][_0x7b71('0xa7')](this,_0x41495d);if(_0x2d9fa7){this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x149'),_0x2d9fa7));var _0x18a96f=this['channel'][_0x7b71('0xfd')](_0x2d9fa7,_0x41495d[_0x7b71('0x12e')]);try{fs['unlink'](_0x2d9fa7+_0x7b71('0x14d'));}catch(_0x497190){logger['error'](_0x497190);}return _0x18a96f;}return this['channel'][_0x7b71('0x2e')](_0x41495d,_0x7b71('0x14e'));};AGIVertices['prototype'][_0x7b71('0x14f')]=function(_0x3809a3){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x150'),_0x3809a3['label']));if(!this[_0x7b71('0x87')](_0x3809a3[_0x7b71('0x151')])){return this['channel']['error'](_0x3809a3,_0x7b71('0x152'));}logger['info'](util[_0x7b71('0x2b')](_0x7b71('0x153'),this['channel'][_0x7b71('0x3f')],_0x3809a3['findBy']));var _0x59be22=this[_0x7b71('0x55')][_0x7b71('0xa7')](this,_0x3809a3[_0x7b71('0x151')]);if(_0x59be22){logger[_0x7b71('0x33')](util['format'](_0x7b71('0x154'),this['channel'][_0x7b71('0x3f')],_0x3809a3[_0x7b71('0x151')]));this[_0x7b71('0xe')][_0x7b71('0xab')](util['format'](_0x7b71('0x154'),this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x3809a3['findBy']));return{'code':0xc8,'result':_0x7b71('0x155')};}else{logger['info'](util[_0x7b71('0x2b')](_0x7b71('0x156'),this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x3809a3[_0x7b71('0x151')]));this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x156'),this[_0x7b71('0xe')]['callerid'],_0x3809a3[_0x7b71('0x151')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x7b71('0x10')][_0x7b71('0x157')]=function(_0x446f9e){logger[_0x7b71('0x33')](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x446f9e[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x446f9e[_0x7b71('0x151')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x446f9e,_0x7b71('0x152'));}logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x153'),this['channel'][_0x7b71('0x3f')],_0x446f9e[_0x7b71('0x151')]));var _0x5bf531=this[_0x7b71('0x54')]['sync'](this,_0x446f9e[_0x7b71('0x151')]);if(_0x5bf531){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x154'),this['channel'][_0x7b71('0x3f')],_0x446f9e[_0x7b71('0x151')]));this['channel']['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x446f9e['findBy']));return{'code':0xc8,'result':_0x7b71('0x155')};}else{logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x156'),this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x446f9e[_0x7b71('0x151')]));this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x156'),this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x446f9e[_0x7b71('0x151')]));return{'code':0xc8,'result':_0x7b71('0x158')};}};AGIVertices[_0x7b71('0x10')]['math']=function(_0x4b48d3){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x159'),_0x4b48d3[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x4b48d3[_0x7b71('0x15a')])){return this[_0x7b71('0xe')]['error'](_0x4b48d3,'no\x20operation\x20configured');}this[_0x7b71('0xe')][_0x7b71('0xab')](util['format'](_0x7b71('0x15b'),_0x4b48d3[_0x7b71('0x15a')]));var _0x455858=eval(_0x4b48d3['operation']);if(!this[_0x7b71('0x87')](_0x4b48d3[_0x7b71('0xd9')])){return this[_0x7b71('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1031b3=this[_0x7b71('0x11')][_0x7b71('0xa7')](this,_0x4b48d3['variable_id']);if(!_0x1031b3){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x4b48d3,_0x7b71('0x115'));}if(_[_0x7b71('0x9b')](_0x455858)){var _0x24e67c=this;_0x455858[_0x7b71('0xdc')](function(_0x2247e2,_0x507341){_0x24e67c[_0x7b71('0xe')]['setVariable'](util[_0x7b71('0x2b')]('%s[%s]',_0x1031b3,_0x507341),_0x2247e2);});return this[_0x7b71('0xe')]['noop'](util['format'](_0x7b71('0x15c'),_0x1031b3));}else{return this[_0x7b71('0xe')][_0x7b71('0xa1')](_0x1031b3,_0x455858);}};AGIVertices[_0x7b71('0x10')][_0x7b71('0xb')]=function(_0x25a9cd){logger[_0x7b71('0x33')](util['format'](_0x7b71('0x15d'),_0x25a9cd[_0x7b71('0x3b')]));if(_0x25a9cd['retry']===0x0){return this[_0x7b71('0xa8')](_0x25a9cd);}_0x25a9cd[_0x7b71('0x10e')]-=0x1;if(!this['isConfigured'](_0x25a9cd[_0x7b71('0x10f')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x25a9cd,_0x7b71('0x110'));}var _0x26b243=this[_0x7b71('0x1f')][_0x7b71('0xa7')](this,_0x25a9cd[_0x7b71('0x10f')]);if(!_0x26b243){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x25a9cd,_0x7b71('0x15e'));}var _0x4d9bc3=this[_0x7b71('0xe')][_0x7b71('0x111')](_0x26b243,_0x25a9cd[_0x7b71('0x15f')],_0x25a9cd[_0x7b71('0x160')]);var _0x4c3d9b=_0x4d9bc3[_0x7b71('0xad')];if(_0x4d9bc3[_0x7b71('0xad')]===-0x1){this[_0x7b71('0x39')]['sync'](this,_0x25a9cd,'-1');return _0x4d9bc3;}else if(_0x4d9bc3[_0x7b71('0xa4')]===_0x7b71('0x66')){_0x4d9bc3[_0x7b71('0xad')]=_0x4d9bc3[_0x7b71('0xad')][_0x7b71('0x9c')]>0x0?_0x4d9bc3[_0x7b71('0xad')]:'t';}else if(_[_0x7b71('0x4a')](_0x4d9bc3['result'])){_0x4d9bc3['result']='#';_0x4c3d9b='#';}if(!this[_0x7b71('0x87')](_0x25a9cd['variable_id'])){this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0xda'));}else{var _0x130787=this[_0x7b71('0x11')][_0x7b71('0xa7')](this,_0x25a9cd[_0x7b71('0xd9')]);if(!_0x130787){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x25a9cd,_0x7b71('0x115'));}this['channel'][_0x7b71('0xa1')](_0x130787,_0x4c3d9b);}this[_0x7b71('0x39')]['sync'](this,_0x25a9cd,_0x4c3d9b);return _0x4d9bc3;};AGIVertices[_0x7b71('0x10')][_0x7b71('0xab')]=function(_0x1db714){logger[_0x7b71('0x33')](util['format'](_0x7b71('0x161'),_0x1db714[_0x7b71('0x3b')]));return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x1db714['output']||_0x1db714[_0x7b71('0x3b')]);};AGIVertices[_0x7b71('0x10')][_0x7b71('0x162')]=function(_0x2e74ff){logger[_0x7b71('0x33')](util['format'](_0x7b71('0x163'),_0x2e74ff[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x2e74ff['findBy'])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x2e74ff,_0x7b71('0x152'));}logger[_0x7b71('0x33')](util['format'](_0x7b71('0x153'),this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x2e74ff['findBy']));var _0x4acaa2=this[_0x7b71('0x4f')][_0x7b71('0xa7')](this,_0x2e74ff[_0x7b71('0x164')]);var _0xa29f32=this[_0x7b71('0x51')][_0x7b71('0xa7')](this,_0x2e74ff[_0x7b71('0x151')],_0x4acaa2);if(_0xa29f32){logger[_0x7b71('0x33')](util['format'](_0x7b71('0x154'),this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x2e74ff[_0x7b71('0x151')]));this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x7b71('0x3f')],_0x2e74ff['findBy']));return{'code':0xc8,'result':_0x7b71('0x155')};}else{logger['info'](util[_0x7b71('0x2b')](_0x7b71('0x156'),this['channel'][_0x7b71('0x3f')],_0x2e74ff[_0x7b71('0x151')]));this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x7b71('0x3f')],_0x2e74ff[_0x7b71('0x151')]));return{'code':0xc8,'result':_0x7b71('0x158')};}};AGIVertices[_0x7b71('0x10')][_0x7b71('0x165')]=function(_0x217fd9){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x166'),_0x217fd9[_0x7b71('0x3b')]));if(!this['isConfigured'](_0x217fd9[_0x7b71('0x10f')])){return this[_0x7b71('0xe')]['error'](_0x217fd9,_0x7b71('0x110'));}var _0x343d7f=this[_0x7b71('0x1f')][_0x7b71('0xa7')](this,_0x217fd9[_0x7b71('0x10f')]);if(!_0x343d7f){return this['channel']['error'](_0x217fd9,_0x7b71('0x15e'));}var _0x2efa23=this[_0x7b71('0xe')][_0x7b71('0x59')](_0x7b71('0x167'),[_0x343d7f,_0x217fd9['opts']]);if(_0x2efa23[_0x7b71('0xad')]===-0x1){return _0x2efa23;}return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xc6'),'PLAYBACK',_0x343d7f));};AGIVertices[_0x7b71('0x10')]['queue']=function(_0x478558){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x478558[_0x7b71('0x3b')]));if(!this['isConfigured'](_0x478558[_0x7b71('0x168')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x478558,'no\x20queue\x20selected');}var _0x20ce9c='';var _0x316576=parseInt(_0x478558[_0x7b71('0x168')],0xa);if(isNaN(_0x316576)){_0x20ce9c=_0x478558[_0x7b71('0x168')];}else{_0x20ce9c=this['getVoiceQueue'][_0x7b71('0xa7')](this,_0x478558[_0x7b71('0x168')]);if(!_0x20ce9c){return this[_0x7b71('0xe')]['error'](_0x478558,'no\x20queue\x20found');}}var _0x697f0f='';if(this[_0x7b71('0x87')](_0x478558[_0x7b71('0x10f')])){var _0x3c9325=this[_0x7b71('0x1f')][_0x7b71('0xa7')](this,_0x478558['file_id']);if(_0x3c9325){_0x697f0f=_0x3c9325;}}this[_0x7b71('0x39')][_0x7b71('0xa7')](this,_0x478558,_0x20ce9c);if(_0x478558[_0x7b71('0xe1')]['indexOf']('x')<0x0){_0x478558[_0x7b71('0xe1')]+='x';}if(_0x478558[_0x7b71('0xe1')]['indexOf']('X')<0x0){_0x478558[_0x7b71('0xe1')]+='X';}this[_0x7b71('0xe')][_0x7b71('0xa1')](_0x7b71('0x169'),_0x20ce9c?_0x20ce9c[_0x7b71('0x16a')]():'');var _0x514dce=this['channel']['exec'](_0x7b71('0x16b'),[_0x20ce9c,_0x478558['opts'],_0x478558['url'],_0x697f0f,_0x478558['timeout'],_0x478558[_0x7b71('0x6')],_0x478558[_0x7b71('0x16c')],_0x478558[_0x7b71('0x16d')],'',_0x478558[_0x7b71('0x16e')]]);if(_0x514dce[_0x7b71('0xad')]===-0x1){return _0x514dce;}return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xc6'),_0x7b71('0x16b'),_0x20ce9c));};AGIVertices[_0x7b71('0x10')][_0x7b71('0x16f')]=function(_0x56988d){logger['info'](util[_0x7b71('0x2b')](_0x7b71('0x170'),_0x56988d[_0x7b71('0x3b')]));var _0x2c790c=_0x56988d[_0x7b71('0x171')]||'wav';var _0xf98623=util[_0x7b71('0x2b')](_0x7b71('0x172'),this['channel'][_0x7b71('0x3a')],rs[_0x7b71('0x116')](0x5));var _0x133fb0=util['format'](_0x7b71('0x173'),FILES_PATH,_0xf98623,_0x2c790c);var _0x4c34b7=util['format'](_0x7b71('0x174'),FILES_PATH,_0xf98623);this[_0x7b71('0x3e')][_0x7b71('0xa7')](this,_0x56988d,_0xf98623,_0x133fb0);this[_0x7b71('0xe')][_0x7b71('0xa1')](_0x7b71('0x175'),_0xf98623);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x4c34b7,_0x2c790c,_0x56988d[_0x7b71('0x176')],_0x56988d[_0x7b71('0x66')]);return this[_0x7b71('0xe')][_0x7b71('0x12d')](_0x4c34b7,_0x2c790c,_0x56988d[_0x7b71('0x176')],_0x56988d[_0x7b71('0x66')],undefined,!![]);};AGIVertices[_0x7b71('0x10')][_0x7b71('0x177')]=function(_0x12e4cf){logger['info'](util[_0x7b71('0x2b')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x12e4cf[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x12e4cf['url'])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0x178'));}var _0x39397e=this['restAPI'][_0x7b71('0xa7')](this,_0x12e4cf);logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x179'),util[_0x7b71('0x17a')](_0x39397e,{'showHidden':![],'depth':null})));if(!this[_0x7b71('0x87')](_0x12e4cf[_0x7b71('0xd9')])){return this[_0x7b71('0xe')][_0x7b71('0xab')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x1bef21=this[_0x7b71('0x11')]['sync'](this,_0x12e4cf[_0x7b71('0xd9')]);if(!_0x1bef21){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x12e4cf,_0x7b71('0x115'));}this['channel'][_0x7b71('0xa1')](util[_0x7b71('0x2b')](_0x7b71('0x17b'),_0x1bef21),_0x39397e['statusCode']?_0x39397e[_0x7b71('0x74')]:'200');this[_0x7b71('0xe')]['setVariable'](util[_0x7b71('0x2b')](_0x7b71('0x17c'),_0x1bef21),_0x39397e[_0x7b71('0x75')]?_0x39397e[_0x7b71('0x75')]:'OK');if(_0x39397e[_0x7b71('0x6b')]){try{this[_0x7b71('0x9f')](_0x39397e[_0x7b71('0x6b')],_0x1bef21);}catch(_0x415729){logger[_0x7b71('0x2e')](util['format'](_0x7b71('0x17d'),_0x1bef21));}}return this['channel']['noop'](util[_0x7b71('0x2b')]('variable\x20%s\x20set',_0x1bef21));};AGIVertices[_0x7b71('0x10')][_0x7b71('0x17e')]=function(_0x2a9b4f){logger['info'](util['format'](_0x7b71('0x17f'),_0x2a9b4f[_0x7b71('0x3b')]));return this[_0x7b71('0xe')]['sayDigits'](_0x2a9b4f[_0x7b71('0x180')][_0x7b71('0x5b')](/\s+/g,''),_0x2a9b4f['escape_digits']);};AGIVertices[_0x7b71('0x10')]['saynumber']=function(_0x4506a5){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x181'),_0x4506a5['label']));return this[_0x7b71('0xe')]['sayNumber'](_0x4506a5[_0x7b71('0x67')]['replace'](/\s+/g,''),_0x4506a5['escape_digits']);};AGIVertices[_0x7b71('0x10')][_0x7b71('0x182')]=function(_0x5cc919){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x5cc919[_0x7b71('0x3b')]));return this['channel'][_0x7b71('0x183')](_0x5cc919[_0x7b71('0x5d')],_0x5cc919['escape_digits']);};AGIVertices[_0x7b71('0x10')][_0x7b71('0x184')]=function(_0x27b291){logger['info'](util[_0x7b71('0x2b')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x27b291['label']));if(!this[_0x7b71('0x87')](_0x27b291[_0x7b71('0x185')])){return this[_0x7b71('0xe')]['noop'](_0x7b71('0x186'));}var _0xe58fe=this[_0x7b71('0x21')][_0x7b71('0xa7')](this,_0x27b291[_0x7b71('0x185')]);if(!_0xe58fe||!_0xe58fe[_0x7b71('0x187')]){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x27b291,_0x7b71('0x188'));}var _0x2df42a={'from':util[_0x7b71('0x2b')](_0x7b71('0x189'),_0xe58fe[_0x7b71('0x13')],_0xe58fe['email']||_0xe58fe['Smtp']['user']),'to':_0x27b291['to']||'','cc':_0x27b291['cc']||'','bcc':_0x27b291['bcc']||'','subject':_0x27b291['subject'],'html':_0x27b291[_0x7b71('0x5d')],'text':_0x27b291[_0x7b71('0x5d')]};if(this[_0x7b71('0x87')](_0x27b291[_0x7b71('0x18a')])){}logger[_0x7b71('0x18b')](_0x7b71('0x18c'),JSON[_0x7b71('0x73')](_0x2df42a));this['createSquareDetailsReport'][_0x7b71('0xa7')](this,_0x27b291,_0x27b291[_0x7b71('0x185')]);this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')]('Trying\x20SendMail\x20with\x20account\x20%s',_0xe58fe[_0x7b71('0x13')]));this[_0x7b71('0x23')][_0x7b71('0xa7')](this,_0xe58fe['smtpOptions'],_0x2df42a);return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0x18d'));};AGIVertices[_0x7b71('0x10')][_0x7b71('0x18e')]=function(_0x4ce27d){logger[_0x7b71('0x33')](util['format'](_0x7b71('0x18f'),_0x4ce27d['label']));return this[_0x7b71('0xe')][_0x7b71('0xab')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x7b71('0x10')]['sendSMS']=function(_0x7a11c1){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x7a11c1[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x7a11c1[_0x7b71('0x190')])){return this['channel'][_0x7b71('0xab')](_0x7b71('0x191'));}var _0x1bda6e=this[_0x7b71('0x37')][_0x7b71('0xa7')](this,_0x7a11c1[_0x7b71('0x190')]);if(!_0x1bda6e){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x7a11c1,_0x7b71('0x192'));}var _0x34d8ec={'body':_0x7a11c1[_0x7b71('0x193')],'phone':_0x7a11c1['to']||'','SmsAccountId':_0x1bda6e['id']};logger[_0x7b71('0x18b')](_0x7b71('0x194'),JSON[_0x7b71('0x73')](_0x34d8ec));this[_0x7b71('0x39')][_0x7b71('0xa7')](this,_0x7a11c1,_0x7a11c1[_0x7b71('0x190')]);this[_0x7b71('0xe')]['noop'](util['format'](_0x7b71('0x195'),_0x1bda6e[_0x7b71('0x13')]));this[_0x7b71('0x38')]['sync'](this,_0x34d8ec);return this[_0x7b71('0xe')]['noop'](_0x7b71('0x196'));};AGIVertices[_0x7b71('0x10')]['set']=function(_0x14df27){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x14df27[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x14df27[_0x7b71('0xd9')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x14df27,_0x7b71('0x197'));}var _0x34b4e9=this[_0x7b71('0x11')][_0x7b71('0xa7')](this,_0x14df27['variable_id']);if(!_0x34b4e9){return this['channel'][_0x7b71('0x2e')](_0x14df27,'no\x20variable\x20found');}return this[_0x7b71('0xe')]['setVariable'](_0x34b4e9,_0x14df27[_0x7b71('0x198')]);};AGIVertices[_0x7b71('0x10')][_0x7b71('0x199')]=function(_0x3481ab){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x19a'),_0x3481ab[_0x7b71('0x3b')]));this[_0x7b71('0xe')]['noop'](_0x7b71('0x19b'));var _0x2321e3=this['channel'][_0x7b71('0x11')](_0x7b71('0x19c'));if(!_[_0x7b71('0x4a')](_0x2321e3[_0x7b71('0xa4')])){this[_0x7b71('0xe')][_0x7b71('0x3a')]=_0x2321e3[_0x7b71('0xa4')];}if(_0x3481ab[_0x7b71('0xbb')]==='yes'){this[_0x7b71('0xe')]['noop'](_0x7b71('0x19d'));return this[_0x7b71('0xe')][_0x7b71('0xbb')]();}return this['channel'][_0x7b71('0xab')](_0x7b71('0x19e'));};AGIVertices[_0x7b71('0x10')]['subproject']=function(_0x3a4be2){logger['info'](util[_0x7b71('0x2b')](_0x7b71('0x19f'),_0x3a4be2[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x3a4be2[_0x7b71('0x1a0')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x3a4be2,_0x7b71('0x1a1'));}var _0x2f15ba=this[_0x7b71('0x17')][_0x7b71('0xa7')](this,_0x3a4be2['project_id']);if(!this[_0x7b71('0x87')](_0x2f15ba)){return this[_0x7b71('0xe')]['error'](_0x3a4be2,util[_0x7b71('0x2b')](_0x7b71('0x1a2'),_0x3a4be2[_0x7b71('0x1a0')]));}if(_0x2f15ba===this[_0x7b71('0xe')][_0x7b71('0x3d')]){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x3a4be2,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x7b71('0x39')]['sync'](this,_0x3a4be2,_0x2f15ba);var _0x540902=this[_0x7b71('0xe')][_0x7b71('0x59')](_0x7b71('0x1a3'),util[_0x7b71('0x2b')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x7b71('0x6')]['host']||'127.0.0.1',_0x2f15ba,this[_0x7b71('0xe')][_0x7b71('0x3d')]));if(_0x540902[_0x7b71('0xad')]===-0x1){return _0x540902;}return this['channel']['noop'](util[_0x7b71('0x2b')]('Executed\x20command\x20%s\x20%s',_0x7b71('0x1a3'),_0x2f15ba));};AGIVertices[_0x7b71('0x10')]['system']=function(_0x4995bc){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')](_0x7b71('0x1a4'),_0x4995bc['label']));var _0x48aa8b=this[_0x7b71('0x1a5')][_0x7b71('0xa7')](this,_0x4995bc[_0x7b71('0xb9')]);this[_0x7b71('0x39')]['sync'](this,_0x4995bc,_0x4995bc[_0x7b71('0xb9')]);if(this[_0x7b71('0x87')](_0x4995bc[_0x7b71('0xd9')])){var _0x5d0389=this[_0x7b71('0x11')][_0x7b71('0xa7')](this,_0x4995bc['variable_id']);if(_0x5d0389){this[_0x7b71('0xe')]['setVariable'](_0x5d0389,_0x48aa8b);return this[_0x7b71('0xe')][_0x7b71('0xab')](util['format'](_0x7b71('0x1a6'),_0x4995bc[_0x7b71('0xb9')],_0x5d0389));}}return this[_0x7b71('0xe')]['noop'](util[_0x7b71('0x2b')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x4995bc[_0x7b71('0xb9')]));};AGIVertices[_0x7b71('0x10')][_0x7b71('0x1a7')]=function(_0x20e3db){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x20e3db[_0x7b71('0x3b')]));_0x20e3db[_0x7b71('0x5d')]=_0x20e3db[_0x7b71('0x5d')][_0x7b71('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7b71('0x87')](_0x20e3db[_0x7b71('0x1a8')])){return this[_0x7b71('0xe')]['noop'](_0x7b71('0x1a9'));}if(!this[_0x7b71('0x87')](_0x20e3db[_0x7b71('0x5d')])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0xc8'));}this[_0x7b71('0xe')][_0x7b71('0xab')](util['format'](_0x7b71('0x1aa'),_0x20e3db[_0x7b71('0x5d')]));var _0x56511b=this[_0x7b71('0x5c')][_0x7b71('0xa7')](this,_0x20e3db);if(_0x56511b){this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x1ab'),_0x56511b));var _0x59f4ef=this[_0x7b71('0xe')][_0x7b71('0xfd')](_0x56511b);try{fs[_0x7b71('0xfe')](_0x56511b+'.wav');}catch(_0xc4c4ec){logger['error'](_0xc4c4ec);}return _0x59f4ef;}return this['channel'][_0x7b71('0x2e')](_0x20e3db,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x7b71('0x1ac')]=function(_0x3c5355){logger[_0x7b71('0x33')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x3c5355[_0x7b71('0x3b')]));_0x3c5355[_0x7b71('0x5d')]=_0x3c5355[_0x7b71('0x5d')][_0x7b71('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7b71('0x87')](_0x3c5355['text'])){return this[_0x7b71('0xe')][_0x7b71('0xab')](_0x7b71('0xc8'));}this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x1ad'),_0x3c5355[_0x7b71('0x5d')]));var _0x37cdae=this[_0x7b71('0x62')][_0x7b71('0xa7')](this,_0x3c5355);if(_0x37cdae){this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x1ae'),_0x37cdae));var _0x498cb9=this['channel'][_0x7b71('0xfd')](_0x37cdae);try{fs[_0x7b71('0xfe')](_0x37cdae+_0x7b71('0x14d'));}catch(_0x4bb5a9){logger[_0x7b71('0x2e')](_0x4bb5a9);}return _0x498cb9;}return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x3c5355,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x7b71('0x1af')]=function(_0x35cd57){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x35cd57['label']));if(!this[_0x7b71('0x87')](_0x35cd57[_0x7b71('0x151')])){return this['channel'][_0x7b71('0x2e')](_0x35cd57,'no\x20find\x20by\x20configured');}logger['info'](util[_0x7b71('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x35cd57['findBy']));var _0x50393c=this['agentUnpause'][_0x7b71('0xa7')](this,_0x35cd57[_0x7b71('0x151')]);if(_0x50393c){logger[_0x7b71('0x33')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x35cd57['findBy']));this['channel'][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x154'),this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x35cd57[_0x7b71('0x151')]));return{'code':0xc8,'result':_0x7b71('0x155')};}else{logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7b71('0xe')]['callerid'],_0x35cd57[_0x7b71('0x151')]));this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0x156'),this[_0x7b71('0xe')][_0x7b71('0x3f')],_0x35cd57['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x7b71('0x10')][_0x7b71('0x1b0')]=function(_0x346e4a){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x346e4a['label']));var _0x56caee=this[_0x7b71('0xe')]['exec'](_0x7b71('0x1b1'),[_0x346e4a[_0x7b71('0x1b2')],_0x346e4a[_0x7b71('0x78')]]);if(_0x56caee['result']===-0x1){return _0x56caee;}return this[_0x7b71('0xe')][_0x7b71('0xab')](util[_0x7b71('0x2b')](_0x7b71('0xc6'),_0x7b71('0x1b1'),_0x346e4a[_0x7b71('0x1b2')]));};AGIVertices[_0x7b71('0x10')]['vswitch']=function(_0x36cb50){logger[_0x7b71('0x33')](util[_0x7b71('0x2b')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x36cb50[_0x7b71('0x3b')]));if(!this[_0x7b71('0x87')](_0x36cb50[_0x7b71('0xd9')])){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x36cb50,'no\x20variable\x20selected');}var _0x14500e=this[_0x7b71('0x11')]['sync'](this,_0x36cb50[_0x7b71('0xd9')]);if(!_0x14500e){return this[_0x7b71('0xe')][_0x7b71('0x2e')](_0x36cb50,_0x7b71('0x115'));}var _0xf2619c=this[_0x7b71('0xe')][_0x7b71('0x11')](_0x14500e);return{'code':0xc8,'result':_0xf2619c[_0x7b71('0xa4')]?_0xf2619c[_0x7b71('0xa4')]:'-'};};String[_0x7b71('0x10')][_0x7b71('0xa3')]=function(_0x2fe57a,_0x3694ca){return this[_0x7b71('0xa2')](_0x2fe57a)[_0x7b71('0x1b3')](_0x3694ca);};module[_0x7b71('0x1b4')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 1495808..1c2f9ca 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 _0x96e5=['error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','message','queue','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][TIMERS]','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','../ami','../../../config/logger','acw','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch'];(function(_0x2a7fa8,_0x413c0e){var _0xf7e306=function(_0x9af322){while(--_0x9af322){_0x2a7fa8['push'](_0x2a7fa8['shift']());}};_0xf7e306(++_0x413c0e);}(_0x96e5,0x149));var _0x596e=function(_0x5cb527,_0x43f8d4){_0x5cb527=_0x5cb527-0x0;var _0x431d9c=_0x96e5[_0x5cb527];return _0x431d9c;};'use strict';var _=require(_0x596e('0x0'));var moment=require(_0x596e('0x1'));var ami=require(_0x596e('0x2'));var logger=require(_0x596e('0x3'))(_0x596e('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x33fa37){this[_0x596e('0x5')]=_0x33fa37[_0x596e('0x5')];this[_0x596e('0x6')]=_0x33fa37[_0x596e('0x6')];this['timers']=_0x33fa37[_0x596e('0x7')];this[_0x596e('0x8')]={};ami['on'](_0x596e('0x9'),this[_0x596e('0xa')]['bind'](this));ami['on'](_0x596e('0xb'),this[_0x596e('0xc')][_0x596e('0xd')](this));ami['on'](_0x596e('0xe'),this[_0x596e('0xf')][_0x596e('0xd')](this));ami['on'](_0x596e('0x10'),this[_0x596e('0x11')]['bind'](this));ami['on'](_0x596e('0x12'),this[_0x596e('0x13')][_0x596e('0xd')](this));ami['on']('blindtransfer',this[_0x596e('0x14')]['bind'](this));ami['on'](_0x596e('0x15'),this[_0x596e('0x16')][_0x596e('0xd')](this));}function getDiff(_0x5ab1e2){var _0x2426a4=moment()[_0x596e('0x17')](0x0);var _0x17eca2=moment(_0x5ab1e2)[_0x596e('0x17')](0x0);return _0x2426a4[_0x596e('0x18')](_0x17eca2,_0x596e('0x19'));}Acw[_0x596e('0x1a')]['updateAcw']=function(_0xb9c8da,_0x1e7751){var _0x3f16ca=this;var _0x3afb66=getDiff(_0x3f16ca[_0x596e('0x7')][_0xb9c8da][_0x596e('0x1b')]);clearTimeout(_0x3f16ca['timers'][_0xb9c8da][_0x596e('0x1c')]);_0x3f16ca[_0x596e('0x7')][_0xb9c8da][_0x596e('0x1c')]=![];return RpcVoiceAgentReport[_0x596e('0x1d')]({'acwtime':_0x3afb66},_0x3f16ca['timers'][_0xb9c8da][_0x596e('0x1e')],_0xb9c8da)[_0x596e('0x1f')](function(_0x2d7010){logger[_0x596e('0x20')](_0x596e('0x21'),_0x1e7751,_0x3afb66,_0x2d7010);})[_0x596e('0x22')](function(_0x20ff42){logger[_0x596e('0x23')](_0x596e('0x24'),_0x1e7751,_0x20ff42);})[_0x596e('0x25')](function(){delete _0x3f16ca[_0x596e('0x7')][_0xb9c8da];});};Acw[_0x596e('0x1a')][_0x596e('0x26')]=function(_0x51828f){try{var _0x2fbdd8=this;var _0x4035ad=this[_0x596e('0x8')][_0x51828f][_0x596e('0x27')];var _0x102f18=this[_0x596e('0x8')][_0x51828f]['queue'];var _0x1c15dc=this[_0x596e('0x5')][_0x102f18];var _0x4773b0=![];var _0x1ce68e=_0x596e('0x28');if(_0x1c15dc[_0x596e('0x29')]&&_0x1c15dc[_0x596e('0x2a')][_0x596e('0x2b')]){_0x4773b0=!![];_0x1ce68e=_0x1c15dc['mandatoryDispositionPause'][_0x596e('0x2b')];}return ami[_0x596e('0x2c')]({'action':'QueuePause','interface':_0x4035ad,'paused':!![],'reason':_0x1ce68e})[_0x596e('0x1f')](function(){if(_0x2fbdd8[_0x596e('0x6')][_0x4035ad]){return RpcUser[_0x596e('0x2d')](_0x2fbdd8[_0x596e('0x6')][_0x4035ad]['id'])[_0x596e('0x1f')](function(_0x2c2c34){if(!_0x2c2c34||_0x2c2c34[_0x596e('0x2e')]){logger['info'](_0x596e('0x2f'),_0x51828f,_0x4035ad,_0x102f18);return;}logger[_0x596e('0x20')](_0x596e('0x30'),_0x51828f,_0x4035ad,_0x102f18);var _0x31f478=_0x2fbdd8[_0x596e('0x8')][_0x51828f][_0x596e('0x31')]&&_0x2fbdd8[_0x596e('0x8')][_0x51828f][_0x596e('0x32')]?_0x2fbdd8[_0x596e('0x8')][_0x51828f]['destlinkedid']:_0x51828f;return RpcUser[_0x596e('0x33')](_0x2fbdd8[_0x596e('0x6')][_0x4035ad],_0x1ce68e,_0x31f478)[_0x596e('0x1f')](function(_0xdd5c4c){_0x2fbdd8['voiceQueues'][_0x102f18][_0x596e('0x34')]-=0x1;_0x2fbdd8[_0x596e('0x5')][_0x102f18][_0x596e('0x35')]+=0x1;return _0xdd5c4c;});})[_0x596e('0x1f')](function(_0x406372){if(_0x4773b0||!_0x406372){return;}_0x2fbdd8[_0x596e('0x7')][_0x4035ad]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x51828f,_0x2fbdd8[_0x596e('0x5')][_0x102f18][_0x596e('0x36')],_0x4035ad,_0x102f18);_0x2fbdd8['timers'][_0x4035ad]['timer']=setTimeout(_0x2fbdd8[_0x596e('0x37')][_0x596e('0xd')](_0x2fbdd8,_0x4035ad),_0x2fbdd8[_0x596e('0x5')][_0x102f18]['acwTimeout']*0x3e8);_0x2fbdd8['timers'][_0x4035ad][_0x596e('0x1b')]=moment()[_0x596e('0x38')](_0x596e('0x39'));_0x2fbdd8[_0x596e('0x7')][_0x4035ad][_0x596e('0x1e')]=_0x51828f;_0x2fbdd8[_0x596e('0x7')][_0x4035ad]['queue']=_0x102f18;_0x2fbdd8[_0x596e('0x7')][_0x4035ad][_0x596e('0x3a')]=_0x2fbdd8[_0x596e('0x3a')][_0x596e('0xd')](_0x2fbdd8,_0x4035ad,_0x51828f);});}})[_0x596e('0x22')](function(){logger[_0x596e('0x23')](_0x596e('0x3b'),_0x51828f,_0x2fbdd8['voiceQueues'][_0x102f18][_0x596e('0x36')],_0x4035ad,_0x102f18);})[_0x596e('0x25')](function(){delete _0x2fbdd8[_0x596e('0x8')][_0x51828f];});}catch(_0x587001){logger['error']('[ACW][START]\x20%s',_0x587001[_0x596e('0x3c')]);}};Acw[_0x596e('0x1a')][_0x596e('0x37')]=function(_0x34a142){try{var _0x513792=this;if(_0x513792[_0x596e('0x7')][_0x34a142]){_0x513792[_0x596e('0x7')][_0x34a142]['timer']=![];var _0x286e28=_0x513792[_0x596e('0x7')][_0x34a142][_0x596e('0x1e')];var _0x7c7203=_0x513792[_0x596e('0x7')][_0x34a142][_0x596e('0x3d')];var _0x5d9b37=_0x513792['voiceQueues'][_0x7c7203]['acwTimeout'];logger[_0x596e('0x20')](_0x596e('0x3e'),_0x286e28,_0x34a142);RpcUser[_0x596e('0x2d')](this['agents'][_0x34a142]['id'])[_0x596e('0x1f')](function(_0x4c74bd){if(_0x4c74bd['pauseType']===_0x596e('0x28')){return RpcUser[_0x596e('0x3f')](_0x513792[_0x596e('0x6')][_0x34a142]);}});RpcVoiceAgentReport['update']({'acwtime':_0x5d9b37,'agentacw':!![]},_0x286e28,_0x34a142)[_0x596e('0x1f')](function(_0xcc2b85){logger[_0x596e('0x20')](_0x596e('0x21'),_0x286e28,_0x5d9b37,_0xcc2b85);})[_0x596e('0x22')](function(_0x53477d){logger['error'](_0x596e('0x24'),_0x286e28,_0x53477d);});}else{logger[_0x596e('0x23')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x34a142);if(_0x513792[_0x596e('0x7')]){logger['info'](_0x596e('0x40'),JSON['stringify'](_0x513792[_0x596e('0x7')]));}}}catch(_0x5ef066){logger[_0x596e('0x23')](_0x596e('0x41'),_0x5ef066[_0x596e('0x3c')]);}};Acw[_0x596e('0x1a')][_0x596e('0xa')]=function(_0x9d0413){try{if(this[_0x596e('0x5')][_0x9d0413['queue']]&&(this['voiceQueues'][_0x9d0413[_0x596e('0x3d')]][_0x596e('0x4')]||this[_0x596e('0x5')][_0x9d0413[_0x596e('0x3d')]][_0x596e('0x29')])){if(this[_0x596e('0x6')][_0x9d0413['interface']]){this['channels'][_0x9d0413[_0x596e('0x1e')]]={'queue':_0x9d0413[_0x596e('0x3d')],'interface':_0x9d0413[_0x596e('0x27')],'destlinkedid':_0x9d0413['destlinkedid']};}}}catch(_0x16a8a4){logger['error'](_0x596e('0x42'),_0x16a8a4[_0x596e('0x3c')]);}};Acw[_0x596e('0x1a')]['syncAgentConnectPreview']=function(_0x6ceafa){try{if(this[_0x596e('0x5')][_0x6ceafa['queue']]&&(this[_0x596e('0x5')][_0x6ceafa['queue']]['acw']||this[_0x596e('0x5')][_0x6ceafa[_0x596e('0x3d')]][_0x596e('0x29')])){if(this['agents'][_0x6ceafa[_0x596e('0x27')]]){this[_0x596e('0x8')][_0x6ceafa[_0x596e('0x1e')]]={'queue':_0x6ceafa[_0x596e('0x3d')],'interface':_0x6ceafa['interface']};}}}catch(_0x39051e){logger[_0x596e('0x23')](_0x596e('0x43'),_0x39051e[_0x596e('0x3c')]);}};Acw[_0x596e('0x1a')][_0x596e('0xc')]=function(_0x37cdd7){try{if(this['channels'][_0x37cdd7[_0x596e('0x1e')]]&&_[_0x596e('0x44')](this[_0x596e('0x8')][_0x37cdd7['uniqueid']][_0x596e('0x31')])){logger[_0x596e('0x20')](_0x596e('0x45'),_0x37cdd7[_0x596e('0x1e')]);this['startAcw'](_0x37cdd7['uniqueid']);}else if(this[_0x596e('0x8')][_0x37cdd7[_0x596e('0x46')]]&&_[_0x596e('0x44')](this[_0x596e('0x8')][_0x37cdd7[_0x596e('0x46')]]['attended'])){logger['info'](_0x596e('0x47'),_0x37cdd7[_0x596e('0x46')]);this['startAcw'](_0x37cdd7[_0x596e('0x46')]);}}catch(_0x486806){logger[_0x596e('0x23')]('[ACW][syncHangupRequest]\x20%s',_0x486806[_0x596e('0x3c')]);}};Acw[_0x596e('0x1a')]['syncHangup']=function(_0x2d1d67){try{if(this['channels'][_0x2d1d67[_0x596e('0x1e')]]&&this[_0x596e('0x8')][_0x2d1d67[_0x596e('0x1e')]][_0x596e('0x31')]){logger['info'](_0x596e('0x48'),_0x2d1d67['uniqueid']);this[_0x596e('0x26')](_0x2d1d67['uniqueid']);}else if(this[_0x596e('0x8')][_0x2d1d67[_0x596e('0x46')]]&&this['channels'][_0x2d1d67['linkedid']][_0x596e('0x31')]){logger[_0x596e('0x20')](_0x596e('0x49'),_0x2d1d67['linkedid']);this[_0x596e('0x26')](_0x2d1d67[_0x596e('0x46')]);}}catch(_0x562f5f){logger['error']('[ACW][syncHangup]\x20%s',_0x562f5f[_0x596e('0x3c')]);}};Acw['prototype'][_0x596e('0x13')]=function(_0x39d900){try{if(!_[_0x596e('0x4a')](this[_0x596e('0x8')][_0x39d900['transfereeuniqueid']])){this[_0x596e('0x26')](_0x39d900[_0x596e('0x4b')]);if(this[_0x596e('0x8')][_0x39d900[_0x596e('0x4c')]]){this[_0x596e('0x8')][_0x39d900['secondtransfereruniqueid']][_0x596e('0x31')]=!![];this[_0x596e('0x8')][_0x39d900[_0x596e('0x4d')]]=this[_0x596e('0x8')][_0x39d900['secondtransfereruniqueid']];this[_0x596e('0x4e')](_0x39d900[_0x596e('0x4c')]);}}else if(!_['isNil'](this[_0x596e('0x8')][_0x39d900[_0x596e('0x4d')]])){this[_0x596e('0x26')](_0x39d900['transfertargetuniqueid']);if(this[_0x596e('0x8')][_0x39d900['origtransfereruniqueid']]){this[_0x596e('0x8')][_0x39d900[_0x596e('0x4f')]][_0x596e('0x31')]=!![];this[_0x596e('0x8')][_0x39d900[_0x596e('0x4b')]]=this[_0x596e('0x8')][_0x39d900[_0x596e('0x4f')]];this[_0x596e('0x4e')](_0x39d900['origtransfereruniqueid']);}}}catch(_0x23e821){logger[_0x596e('0x23')](_0x596e('0x50'),_0x23e821[_0x596e('0x3c')]);}};Acw[_0x596e('0x1a')][_0x596e('0x14')]=function(_0x51ced8){try{if(this[_0x596e('0x8')][_0x51ced8['transfereruniqueid']]){logger[_0x596e('0x20')](_0x596e('0x51'),JSON[_0x596e('0x52')](_0x51ced8[_0x596e('0x53')]));this['startAcw'](_0x51ced8[_0x596e('0x53')]);}else if(this[_0x596e('0x8')][_0x51ced8['transfererlinkedid']]){logger[_0x596e('0x20')](_0x596e('0x54'),JSON[_0x596e('0x52')](_0x51ced8[_0x596e('0x55')]));this['startAcw'](_0x51ced8[_0x596e('0x55')]);}}catch(_0x3c0d86){logger[_0x596e('0x23')](_0x596e('0x56'),_0x3c0d86[_0x596e('0x3c')]);}};Acw[_0x596e('0x1a')][_0x596e('0x11')]=function(_0xfa04bb){try{if(this[_0x596e('0x5')][_0xfa04bb[_0x596e('0x3d')]]&&this[_0x596e('0x5')][_0xfa04bb[_0x596e('0x3d')]][_0x596e('0x57')]==='all'){if(this[_0x596e('0x6')][_0xfa04bb[_0x596e('0x27')]]){logger[_0x596e('0x20')](_0x596e('0x58'),_0xfa04bb[_0x596e('0x1e')],_0xfa04bb['interface'],_0xfa04bb[_0x596e('0x3d')]);return RpcUser[_0x596e('0x33')](this['agents'][_0xfa04bb[_0x596e('0x27')]],_0x596e('0x59'),_0xfa04bb[_0x596e('0x1e')]);}}}catch(_0x15c324){logger[_0x596e('0x23')](_0x596e('0x5a'),_0x15c324['message']);}};Acw[_0x596e('0x1a')][_0x596e('0x4e')]=function(_0x242d56,_0x326811=0x2710){if(this[_0x596e('0x8')][_0x242d56]){setTimeout(()=>{delete this[_0x596e('0x8')][_0x242d56];},_0x326811);}};module['exports']=Acw; \ No newline at end of file +var _0x45d2=['[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','pauseType','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','[%s][HANGUP:LINKEDID]','linkedid','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','hanguprequest','syncHangupRequest','bind','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','then','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','finally','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','voicePause','info','attended','destlinkedid','savePause','acwTimeout','stopAcw','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x45d2,0x127));var _0x245d=function(_0x1ed3ed,_0xdc9dbc){_0x1ed3ed=_0x1ed3ed-0x0;var _0x262d27=_0x45d2[_0x1ed3ed];return _0x262d27;};'use strict';var _=require('lodash');var moment=require(_0x245d('0x0'));var ami=require(_0x245d('0x1'));var logger=require('../../../config/logger')(_0x245d('0x2'));var RpcUser=require(_0x245d('0x3'));var RpcVoiceAgentReport=require(_0x245d('0x4'));function Acw(_0x219689){this[_0x245d('0x5')]=_0x219689[_0x245d('0x5')];this[_0x245d('0x6')]=_0x219689['agents'];this[_0x245d('0x7')]=_0x219689[_0x245d('0x7')];this[_0x245d('0x8')]={};ami['on'](_0x245d('0x9'),this['syncAgentConnect']['bind'](this));ami['on'](_0x245d('0xa'),this[_0x245d('0xb')][_0x245d('0xc')](this));ami['on']('hangup',this[_0x245d('0xd')][_0x245d('0xc')](this));ami['on'](_0x245d('0xe'),this[_0x245d('0xf')][_0x245d('0xc')](this));ami['on'](_0x245d('0x10'),this[_0x245d('0x11')]['bind'](this));ami['on'](_0x245d('0x12'),this[_0x245d('0x13')][_0x245d('0xc')](this));ami['on'](_0x245d('0x14'),this[_0x245d('0x15')][_0x245d('0xc')](this));}function getDiff(_0x2beff6){var _0x4b22c2=moment()[_0x245d('0x16')](0x0);var _0x4c527b=moment(_0x2beff6)['milliseconds'](0x0);return _0x4b22c2[_0x245d('0x17')](_0x4c527b,_0x245d('0x18'));}Acw[_0x245d('0x19')][_0x245d('0x1a')]=function(_0x215acc,_0x39601b){var _0x2a57d9=this;var _0x31627d=getDiff(_0x2a57d9[_0x245d('0x7')][_0x215acc][_0x245d('0x1b')]);clearTimeout(_0x2a57d9['timers'][_0x215acc][_0x245d('0x1c')]);_0x2a57d9['timers'][_0x215acc][_0x245d('0x1c')]=![];return RpcVoiceAgentReport[_0x245d('0x1d')]({'acwtime':_0x31627d},_0x2a57d9[_0x245d('0x7')][_0x215acc][_0x245d('0x1e')],_0x215acc)[_0x245d('0x1f')](function(_0x1dd06d){logger['info'](_0x245d('0x20'),_0x39601b,_0x31627d,_0x1dd06d);})[_0x245d('0x21')](function(_0x35ef4c){logger['error'](_0x245d('0x22'),_0x39601b,_0x35ef4c);})[_0x245d('0x23')](function(){delete _0x2a57d9[_0x245d('0x7')][_0x215acc];});};Acw[_0x245d('0x19')]['startAcw']=function(_0x4596c9){try{var _0x2664d4=this;var _0x17c085=this[_0x245d('0x8')][_0x4596c9][_0x245d('0x24')];var _0x278112=this[_0x245d('0x8')][_0x4596c9][_0x245d('0x25')];var _0x3318b0=this[_0x245d('0x5')][_0x278112];var _0x55f450=![];var _0x14226b=_0x245d('0x26');if(_0x3318b0[_0x245d('0x27')]&&_0x3318b0['mandatoryDispositionPause']['name']){_0x55f450=!![];_0x14226b=_0x3318b0[_0x245d('0x28')][_0x245d('0x29')];}return ami[_0x245d('0x2a')]({'action':_0x245d('0x2b'),'interface':_0x17c085,'paused':!![],'reason':_0x14226b})['then'](function(){if(_0x2664d4[_0x245d('0x6')][_0x17c085]){return RpcUser[_0x245d('0x2c')](_0x2664d4['agents'][_0x17c085]['id'])['then'](function(_0x102619){if(!_0x102619||_0x102619[_0x245d('0x2d')]){logger[_0x245d('0x2e')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x4596c9,_0x17c085,_0x278112);return;}logger[_0x245d('0x2e')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x4596c9,_0x17c085,_0x278112);var _0x42fea7=_0x2664d4[_0x245d('0x8')][_0x4596c9][_0x245d('0x2f')]&&_0x2664d4[_0x245d('0x8')][_0x4596c9][_0x245d('0x30')]?_0x2664d4[_0x245d('0x8')][_0x4596c9][_0x245d('0x30')]:_0x4596c9;return RpcUser[_0x245d('0x31')](_0x2664d4['agents'][_0x17c085],_0x14226b,_0x42fea7)[_0x245d('0x1f')](function(_0x206699){_0x2664d4[_0x245d('0x5')][_0x278112]['available']-=0x1;_0x2664d4['voiceQueues'][_0x278112]['paused']+=0x1;return _0x206699;});})[_0x245d('0x1f')](function(_0xbc9610){if(_0x55f450||!_0xbc9610){return;}_0x2664d4['timers'][_0x17c085]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4596c9,_0x2664d4['voiceQueues'][_0x278112][_0x245d('0x32')],_0x17c085,_0x278112);_0x2664d4[_0x245d('0x7')][_0x17c085][_0x245d('0x1c')]=setTimeout(_0x2664d4[_0x245d('0x33')]['bind'](_0x2664d4,_0x17c085),_0x2664d4['voiceQueues'][_0x278112][_0x245d('0x32')]*0x3e8);_0x2664d4[_0x245d('0x7')][_0x17c085][_0x245d('0x1b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2664d4[_0x245d('0x7')][_0x17c085][_0x245d('0x1e')]=_0x4596c9;_0x2664d4[_0x245d('0x7')][_0x17c085][_0x245d('0x25')]=_0x278112;_0x2664d4[_0x245d('0x7')][_0x17c085][_0x245d('0x1a')]=_0x2664d4[_0x245d('0x1a')][_0x245d('0xc')](_0x2664d4,_0x17c085,_0x4596c9);});}})['catch'](function(){logger[_0x245d('0x34')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4596c9,_0x2664d4[_0x245d('0x5')][_0x278112][_0x245d('0x32')],_0x17c085,_0x278112);})['finally'](function(){delete _0x2664d4[_0x245d('0x8')][_0x4596c9];});}catch(_0x4c54e2){logger[_0x245d('0x34')](_0x245d('0x35'),_0x4c54e2['message']);}};Acw[_0x245d('0x19')][_0x245d('0x33')]=function(_0x504915){try{var _0x2cd364=this;if(_0x2cd364[_0x245d('0x7')][_0x504915]){_0x2cd364['timers'][_0x504915][_0x245d('0x1c')]=![];var _0x241271=_0x2cd364[_0x245d('0x7')][_0x504915][_0x245d('0x1e')];var _0x24cbea=_0x2cd364[_0x245d('0x7')][_0x504915][_0x245d('0x25')];var _0x55a4e3=_0x2cd364[_0x245d('0x5')][_0x24cbea][_0x245d('0x32')];logger[_0x245d('0x2e')](_0x245d('0x36'),_0x241271,_0x504915);RpcUser[_0x245d('0x2c')](this['agents'][_0x504915]['id'])[_0x245d('0x1f')](function(_0x57b810){if(_0x57b810[_0x245d('0x37')]===_0x245d('0x26')){return RpcUser['saveUnpause'](_0x2cd364[_0x245d('0x6')][_0x504915]);}});RpcVoiceAgentReport[_0x245d('0x1d')]({'acwtime':_0x55a4e3,'agentacw':!![]},_0x241271,_0x504915)['then'](function(_0x1e6469){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x241271,_0x55a4e3,_0x1e6469);})[_0x245d('0x21')](function(_0x39b663){logger[_0x245d('0x34')](_0x245d('0x22'),_0x241271,_0x39b663);});}else{logger[_0x245d('0x34')](_0x245d('0x38'),_0x504915);if(_0x2cd364[_0x245d('0x7')]){logger['info'](_0x245d('0x39'),JSON[_0x245d('0x3a')](_0x2cd364[_0x245d('0x7')]));}}}catch(_0x20fc5e){logger[_0x245d('0x34')](_0x245d('0x3b'),_0x20fc5e[_0x245d('0x3c')]);}};Acw[_0x245d('0x19')]['syncAgentConnect']=function(_0xdd99da){try{if(this[_0x245d('0x5')][_0xdd99da[_0x245d('0x25')]]&&(this['voiceQueues'][_0xdd99da[_0x245d('0x25')]][_0x245d('0x2')]||this[_0x245d('0x5')][_0xdd99da[_0x245d('0x25')]]['mandatoryDisposition'])){if(this[_0x245d('0x6')][_0xdd99da['interface']]){this[_0x245d('0x8')][_0xdd99da[_0x245d('0x1e')]]={'queue':_0xdd99da[_0x245d('0x25')],'interface':_0xdd99da[_0x245d('0x24')],'destlinkedid':_0xdd99da['destlinkedid']};}}}catch(_0x3689f9){logger['error'](_0x245d('0x3d'),_0x3689f9[_0x245d('0x3c')]);}};Acw[_0x245d('0x19')][_0x245d('0x15')]=function(_0x19fb1a){try{if(this[_0x245d('0x5')][_0x19fb1a['queue']]&&(this[_0x245d('0x5')][_0x19fb1a[_0x245d('0x25')]][_0x245d('0x2')]||this[_0x245d('0x5')][_0x19fb1a[_0x245d('0x25')]][_0x245d('0x27')])){if(this['agents'][_0x19fb1a[_0x245d('0x24')]]){this[_0x245d('0x8')][_0x19fb1a['uniqueid']]={'queue':_0x19fb1a['queue'],'interface':_0x19fb1a[_0x245d('0x24')]};}}}catch(_0x5bcfc8){logger[_0x245d('0x34')](_0x245d('0x3e'),_0x5bcfc8['message']);}};Acw[_0x245d('0x19')]['syncHangupRequest']=function(_0x4d5333){try{if(this[_0x245d('0x8')][_0x4d5333['uniqueid']]&&_[_0x245d('0x3f')](this[_0x245d('0x8')][_0x4d5333['uniqueid']]['attended'])){logger[_0x245d('0x2e')](_0x245d('0x40'),_0x4d5333[_0x245d('0x1e')]);this[_0x245d('0x41')](_0x4d5333[_0x245d('0x1e')]);}else if(this[_0x245d('0x8')][_0x4d5333['linkedid']]&&_[_0x245d('0x3f')](this[_0x245d('0x8')][_0x4d5333['linkedid']][_0x245d('0x2f')])){logger[_0x245d('0x2e')](_0x245d('0x42'),_0x4d5333[_0x245d('0x43')]);this[_0x245d('0x41')](_0x4d5333['linkedid']);}}catch(_0x1e4b8b){logger[_0x245d('0x34')]('[ACW][syncHangupRequest]\x20%s',_0x1e4b8b[_0x245d('0x3c')]);}};Acw[_0x245d('0x19')][_0x245d('0xd')]=function(_0x57afef){try{if(this[_0x245d('0x8')][_0x57afef[_0x245d('0x1e')]]&&this[_0x245d('0x8')][_0x57afef['uniqueid']][_0x245d('0x2f')]){logger[_0x245d('0x2e')](_0x245d('0x44'),_0x57afef['uniqueid']);this[_0x245d('0x41')](_0x57afef[_0x245d('0x1e')]);}else if(this[_0x245d('0x8')][_0x57afef['linkedid']]&&this[_0x245d('0x8')][_0x57afef[_0x245d('0x43')]][_0x245d('0x2f')]){logger[_0x245d('0x2e')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x57afef[_0x245d('0x43')]);this[_0x245d('0x41')](_0x57afef[_0x245d('0x43')]);}}catch(_0x1be995){logger[_0x245d('0x34')](_0x245d('0x45'),_0x1be995['message']);}};Acw[_0x245d('0x19')][_0x245d('0x11')]=function(_0x27ec8f){try{if(!_[_0x245d('0x46')](this[_0x245d('0x8')][_0x27ec8f[_0x245d('0x47')]])){this[_0x245d('0x41')](_0x27ec8f['transfereeuniqueid']);if(this['channels'][_0x27ec8f[_0x245d('0x48')]]){this[_0x245d('0x8')][_0x27ec8f[_0x245d('0x48')]][_0x245d('0x2f')]=!![];this[_0x245d('0x8')][_0x27ec8f[_0x245d('0x49')]]=this['channels'][_0x27ec8f[_0x245d('0x48')]];this[_0x245d('0x4a')](_0x27ec8f['secondtransfereruniqueid']);}}else if(!_[_0x245d('0x46')](this[_0x245d('0x8')][_0x27ec8f[_0x245d('0x49')]])){this[_0x245d('0x41')](_0x27ec8f[_0x245d('0x49')]);if(this[_0x245d('0x8')][_0x27ec8f['origtransfereruniqueid']]){this['channels'][_0x27ec8f[_0x245d('0x4b')]][_0x245d('0x2f')]=!![];this[_0x245d('0x8')][_0x27ec8f[_0x245d('0x47')]]=this['channels'][_0x27ec8f[_0x245d('0x4b')]];this[_0x245d('0x4a')](_0x27ec8f[_0x245d('0x4b')]);}}}catch(_0xb5f33){logger['error'](_0x245d('0x4c'),_0xb5f33[_0x245d('0x3c')]);}};Acw[_0x245d('0x19')]['syncBlindTransfer']=function(_0x4b8090){try{if(this[_0x245d('0x8')][_0x4b8090[_0x245d('0x4d')]]){logger['info'](_0x245d('0x4e'),JSON[_0x245d('0x3a')](_0x4b8090[_0x245d('0x4d')]));this[_0x245d('0x41')](_0x4b8090['transfereruniqueid']);}else if(this[_0x245d('0x8')][_0x4b8090[_0x245d('0x4f')]]){logger['info'](_0x245d('0x50'),JSON[_0x245d('0x3a')](_0x4b8090[_0x245d('0x4f')]));this[_0x245d('0x41')](_0x4b8090[_0x245d('0x4f')]);}}catch(_0x4e1e2f){logger[_0x245d('0x34')]('[ACW][syncBlindTransfer]\x20%s',_0x4e1e2f[_0x245d('0x3c')]);}};Acw[_0x245d('0x19')][_0x245d('0xf')]=function(_0x310768){try{if(this['voiceQueues'][_0x310768['queue']]&&this[_0x245d('0x5')][_0x310768[_0x245d('0x25')]][_0x245d('0x51')]===_0x245d('0x52')){if(this[_0x245d('0x6')][_0x310768['interface']]){logger[_0x245d('0x2e')](_0x245d('0x53'),_0x310768['uniqueid'],_0x310768['interface'],_0x310768[_0x245d('0x25')]);return RpcUser[_0x245d('0x31')](this[_0x245d('0x6')][_0x310768['interface']],_0x245d('0x54'),_0x310768[_0x245d('0x1e')]);}}}catch(_0x2b6f22){logger[_0x245d('0x34')](_0x245d('0x55'),_0x2b6f22['message']);}};Acw[_0x245d('0x19')][_0x245d('0x4a')]=function(_0x386915,_0x1f85de=0x2710){if(this[_0x245d('0x8')][_0x386915]){setTimeout(()=>{delete this[_0x245d('0x8')][_0x386915];},_0x1f85de);}};module[_0x245d('0x56')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 1d501a5..ad7850e 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 _0x870c=['sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','ami','../../config/environment','asterisk','username','password','keepConnected','Action','promisify','action','port','inspect','error','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus'];(function(_0x1322b7,_0x36da7b){var _0x57bd08=function(_0x48ab3f){while(--_0x48ab3f){_0x1322b7['push'](_0x1322b7['shift']());}};_0x57bd08(++_0x36da7b);}(_0x870c,0x1da));var _0xc870=function(_0x2befc0,_0x230737){_0x2befc0=_0x2befc0-0x0;var _0x2c1c57=_0x870c[_0x2befc0];return _0x2c1c57;};'use strict';var Manager=require(_0xc870('0x0'));var BPromise=require(_0xc870('0x1'));var util=require(_0xc870('0x2'));var logger=require('../../config/logger')(_0xc870('0x3'));var config=require(_0xc870('0x4'));var ami=new Manager(config[_0xc870('0x5')]['port'],config['asterisk']['ip'],config[_0xc870('0x5')][_0xc870('0x6')],config[_0xc870('0x5')][_0xc870('0x7')],!![]);ami[_0xc870('0x8')]();ami[_0xc870('0x9')]=BPromise[_0xc870('0xa')](ami[_0xc870('0xb')]);function error(_0x13ed66){logger['error'](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0xc870('0x5')][_0xc870('0x6')],config[_0xc870('0x5')]['ip'],config[_0xc870('0x5')][_0xc870('0xc')],util[_0xc870('0xd')](_0x13ed66,![],null)));}function close(){logger[_0xc870('0xe')](util[_0xc870('0xf')](_0xc870('0x10'),config[_0xc870('0x5')][_0xc870('0x6')],config['asterisk']['ip'],config['asterisk']['port']));}ami[_0xc870('0x11')]=function(){return function(){return ami[_0xc870('0x9')]({'action':'sipshowregistry'});};};ami[_0xc870('0x12')]=function(){return function(){return ami[_0xc870('0x9')]({'action':'devicestatelist'});};};ami[_0xc870('0x13')]=function(){return function(){return ami[_0xc870('0x9')]({'action':_0xc870('0x14')});};};ami[_0xc870('0x15')]=function(){return function(){return ami[_0xc870('0x9')]({'action':'queuesummary'});};};ami[_0xc870('0x16')]=function(){return function(){return ami[_0xc870('0x9')]({'action':_0xc870('0x17')});};};function connect(){logger[_0xc870('0x18')](util[_0xc870('0xf')](_0xc870('0x19'),config['asterisk'][_0xc870('0x6')],config['asterisk']['ip'],config['asterisk'][_0xc870('0xc')]));ami[_0xc870('0x1a')]('error',error);ami[_0xc870('0x1a')](_0xc870('0x1b'),close);}ami['on'](_0xc870('0x1c'),connect);ami['on'](_0xc870('0x1d'),function(_0x5a09ec){logger[_0xc870('0x18')](util[_0xc870('0xf')](_0xc870('0x1e'),config[_0xc870('0x5')][_0xc870('0x6')],config['asterisk']['ip'],config[_0xc870('0x5')][_0xc870('0xc')],util[_0xc870('0xd')](_0x5a09ec,![],null)));});ami['on'](_0xc870('0x1f'),function(){logger[_0xc870('0x18')](util[_0xc870('0xf')](_0xc870('0x20'),config[_0xc870('0x5')][_0xc870('0x6')],config['asterisk']['ip'],config[_0xc870('0x5')]['port']));return Promise[_0xc870('0x21')]()[_0xc870('0x22')](ami['actionSipShowRegistry']())['then'](ami[_0xc870('0x12')]())[_0xc870('0x22')](ami[_0xc870('0x13')]())[_0xc870('0x22')](ami[_0xc870('0x15')]())[_0xc870('0x22')](ami[_0xc870('0x16')]())[_0xc870('0x23')](function(_0x2f007a){logger[_0xc870('0xe')](_0xc870('0x24'),util[_0xc870('0xd')](_0x2f007a,{'showHidden':![],'depth':null}));});});ami['once'](_0xc870('0xe'),error);ami[_0xc870('0x1a')](_0xc870('0x1b'),close);module[_0xc870('0x25')]=ami; \ No newline at end of file +var _0x3ca2=['Action','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionDeviceStateList','actionCoreShowChannels','catch','[ami.js][fullybooted]','exports','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','username','password','keepConnected','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry'];(function(_0x548c0a,_0x15e6e7){var _0x114592=function(_0xfda9c6){while(--_0xfda9c6){_0x548c0a['push'](_0x548c0a['shift']());}};_0x114592(++_0x15e6e7);}(_0x3ca2,0xd2));var _0x23ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ca2[_0x3dd15e];return _0x231fd0;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x23ca('0x0'));var util=require(_0x23ca('0x1'));var logger=require(_0x23ca('0x2'))(_0x23ca('0x3'));var config=require(_0x23ca('0x4'));var ami=new Manager(config[_0x23ca('0x5')]['port'],config[_0x23ca('0x5')]['ip'],config['asterisk'][_0x23ca('0x6')],config[_0x23ca('0x5')][_0x23ca('0x7')],!![]);ami[_0x23ca('0x8')]();ami['Action']=BPromise[_0x23ca('0x9')](ami[_0x23ca('0xa')]);function error(_0x35e4cf){logger['error'](util[_0x23ca('0xb')](_0x23ca('0xc'),config[_0x23ca('0x5')]['username'],config[_0x23ca('0x5')]['ip'],config[_0x23ca('0x5')][_0x23ca('0xd')],util[_0x23ca('0xe')](_0x35e4cf,![],null)));}function close(){logger[_0x23ca('0xf')](util[_0x23ca('0xb')](_0x23ca('0x10'),config[_0x23ca('0x5')][_0x23ca('0x6')],config[_0x23ca('0x5')]['ip'],config['asterisk']['port']));}ami[_0x23ca('0x11')]=function(){return function(){return ami[_0x23ca('0x12')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x23ca('0x12')]({'action':_0x23ca('0x13')});};};ami[_0x23ca('0x14')]=function(){return function(){return ami[_0x23ca('0x12')]({'action':_0x23ca('0x15')});};};ami[_0x23ca('0x16')]=function(){return function(){return ami[_0x23ca('0x12')]({'action':_0x23ca('0x17')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x23ca('0x12')]({'action':_0x23ca('0x18')});};};function connect(){logger[_0x23ca('0x19')](util[_0x23ca('0xb')](_0x23ca('0x1a'),config['asterisk'][_0x23ca('0x6')],config['asterisk']['ip'],config['asterisk'][_0x23ca('0xd')]));ami[_0x23ca('0x1b')](_0x23ca('0xf'),error);ami['once'](_0x23ca('0x1c'),close);}ami['on'](_0x23ca('0x1d'),connect);ami['on']('shutdown',function(_0x248670){logger[_0x23ca('0x19')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x23ca('0x5')]['username'],config[_0x23ca('0x5')]['ip'],config[_0x23ca('0x5')][_0x23ca('0xd')],util[_0x23ca('0xe')](_0x248670,![],null)));});ami['on'](_0x23ca('0x1e'),function(){logger['info'](util[_0x23ca('0xb')](_0x23ca('0x1f'),config[_0x23ca('0x5')][_0x23ca('0x6')],config[_0x23ca('0x5')]['ip'],config['asterisk']['port']));return Promise['resolve']()['then'](ami[_0x23ca('0x11')]())[_0x23ca('0x20')](ami[_0x23ca('0x21')]())[_0x23ca('0x20')](ami[_0x23ca('0x14')]())[_0x23ca('0x20')](ami[_0x23ca('0x16')]())[_0x23ca('0x20')](ami[_0x23ca('0x22')]())[_0x23ca('0x23')](function(_0x212f5){logger[_0x23ca('0xf')](_0x23ca('0x24'),util[_0x23ca('0xe')](_0x212f5,{'showHidden':![],'depth':null}));});});ami[_0x23ca('0x1b')]('error',error);ami[_0x23ca('0x1b')]('close',close);module[_0x23ca('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 764d112..8152952 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0xcb91[_0x5d30b4];return _0x1acfb8;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file +var _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x25280c,_0x2edec1){var _0x3a58c3=function(_0x5292a0){while(--_0x5292a0){_0x25280c['push'](_0x25280c['shift']());}};_0x3a58c3(++_0x2edec1);}(_0x9bde,0xe1));var _0xe9bd=function(_0x22290a,_0x25ef5d){_0x22290a=_0x22290a-0x0;var _0x4b7a22=_0x9bde[_0x22290a];return _0x4b7a22;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('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 6c323af..d8ab697 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 _0x46de=['SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','dialNoAnswerRetryFrequency','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','Max\x20Drop\x20','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalDroppedCallsCallersExit','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','busyFactor','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','Queue:\x20','queuestatus','[checkContactBlack]','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[handleIvr]','dialLimitQueue','not_inuse','checkContactEmpty','countReScheduled','[actionOriginate]','[handlePower]','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','checkContactLowerLimitOriginate','[countReScheduled]\x20','checkIsBlackList','[actionOriginatePredictive]','[getContactCampaign2]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startProgressive','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','syncQueueCallerAbandon','bind','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','then','isUndefined','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','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','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','---------------------------','merge','getSeconds','startProgressive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','state','statedesc','endtime','starttime','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','pick','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20deactivated','[ifTime][Action]','Error','stringify','prototype','isTrunkReachable','active','status','reachable','SIP/%s','unmonitored','checkIsTrunkReachable','Trunk','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','EMPTY_INTERVAL','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','push','Action','iftime\x20%s,%s','interval','indexOf','catch','command','content','true','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaignActive','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','queue','uniqueid','type','ivr','decrementOriginate','[syncAgentConnect]','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agiafterat','dialAgiAfterHangupAgent','createHistory','moveContactManagedDialer','[syncAgentComplete]','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','dialQueueProject2','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','countdropretry','dialDropMaxRetry','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','dropreason','countabandonedretry','dialAbandonedRetryFrequency','queueCallerAbandonCreateState','rescheduleContact','add','calleridname','swapAdditionalPhones','channel','actionid','strategy','rrmemory','roundrobin','locked','paused','stateinterface','isNil','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','finally','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','Success','[syncOriginateResponse]','callProgressDetecting','[callProgressDetecting]\x20','amdstatus','exten','xcally-motion-dialer','value','HANGUP','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','membername','emit','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD]','MACHINE','AMD','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','dialAMDActive','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','stateGlobal','dialMachineMaxRetry','dialMachineRetryFrequency','[syncHangup]','ivrAnswerCallsDay','cause-txt','[syncAgentCompleteIvr]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','[syncHangup2]','Normal\x20Clearing','[syncAgentComplete][createHistory]','Unknown','[syncHangup][createHistory]','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','startPredictive','available','talking','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','[syncQueueSummary]','filter','online','resolve','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','No\x20such\x20channel','[clearZombieChannels]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','notFound','[emptyContact]','UserId','[emptyContact][createHistory]','user:%s','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','NONE','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','getCaller','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumWordLength','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','TrunkBackup','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables'];(function(_0x523cd3,_0x486aae){var _0x39c6ee=function(_0x151ebf){while(--_0x151ebf){_0x523cd3['push'](_0x523cd3['shift']());}};_0x39c6ee(++_0x486aae);}(_0x46de,0x9e));var _0xe46d=function(_0x592d7c,_0x405966){_0x592d7c=_0x592d7c-0x0;var _0xaa8d19=_0x46de[_0x592d7c];return _0xaa8d19;};'use strict';var util=require('util');var _=require(_0xe46d('0x0'));var uuid=require(_0xe46d('0x1'));var moment=require(_0xe46d('0x2'));var rr=require('rr');var Redis=require(_0xe46d('0x3'));var utils=require(_0xe46d('0x4'));var hopperUtils=require(_0xe46d('0x5'));var ut=require(_0xe46d('0x6'));var config=require(_0xe46d('0x7'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0xe46d('0x8'))(_0xe46d('0x9'));var loggerPredictive=require(_0xe46d('0x8'))(_0xe46d('0xa'));var loggerPredictiveCalls=require('../../../config/logger')(_0xe46d('0xb'));var loggerSyncQueueSummary=require(_0xe46d('0x8'))(_0xe46d('0xc'));var ami=require(_0xe46d('0xd'));config[_0xe46d('0xe')]=_[_0xe46d('0xf')](config[_0xe46d('0xe')],{'host':_0xe46d('0x10'),'port':0x18eb});var io=require(_0xe46d('0x11'))(new Redis(config[_0xe46d('0xe')]));var cmHopper=require(_0xe46d('0x12'));var voiceQueueRt=require(_0xe46d('0x13'));var RpcSetting=require('../rpc/setting');var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require(_0xe46d('0x14'));var Final=require(_0xe46d('0x15'));var AgentComplete=require(_0xe46d('0x16'));var QueueCallerAbandon=require(_0xe46d('0x17'));var Hangup=require('./models/hangup');var ipAgi=process[_0xe46d('0x18')][_0xe46d('0x19')]||_0xe46d('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xe46d('0x1b')]=function(_0xc259a0){this['tail']=this[_0xe46d('0x1c')]?this[_0xe46d('0x1c')]['finally'](_0xc259a0):_0xc259a0();};function Dialer(_0x1fb432,_0x216668){this[_0xe46d('0x1d')]=new Sequence();this[_0xe46d('0x1e')]=_0x216668;this['voiceQueues']=_0x1fb432[_0xe46d('0x1f')];this[_0xe46d('0x20')]=_0x1fb432[_0xe46d('0x20')];this[_0xe46d('0x21')]=_0x1fb432[_0xe46d('0x21')];this[_0xe46d('0x22')]=_0x1fb432[_0xe46d('0x22')];this['maxNumberOriginate']=config[_0xe46d('0x23')]||0x2;this[_0xe46d('0x24')]={};this[_0xe46d('0x25')]={};this[_0xe46d('0x26')]={};this[_0xe46d('0x27')]={};this['optionPredictive']={};this['startPredictive']={};this[_0xe46d('0x28')]={};this['ivrOriginated']={};this[_0xe46d('0x29')]={};this[_0xe46d('0x2a')]={};this[_0xe46d('0x2b')]={};ami['on'](_0xe46d('0x2c'),this[_0xe46d('0x2d')]['bind'](this));ami['on']('queuecallerabandon',this[_0xe46d('0x2e')][_0xe46d('0x2f')](this));ami['on'](_0xe46d('0x30'),this['syncOriginateResponse'][_0xe46d('0x2f')](this));ami['on'](_0xe46d('0x31'),this[_0xe46d('0x32')][_0xe46d('0x2f')](this));ami['on'](_0xe46d('0x33'),this[_0xe46d('0xc')]['bind'](this));ami['on'](_0xe46d('0x34'),this[_0xe46d('0x35')]['bind'](this));ami['on'](_0xe46d('0x36'),this[_0xe46d('0x37')][_0xe46d('0x2f')](this));ami['on']('newexten',this[_0xe46d('0x38')][_0xe46d('0x2f')](this));ami['on']('varset',this[_0xe46d('0x39')][_0xe46d('0x2f')](this));ami['on']('queuemember',this[_0xe46d('0x3a')][_0xe46d('0x2f')](this));ami['on'](_0xe46d('0x3b'),this[_0xe46d('0x3c')][_0xe46d('0x2f')](this));this['loopCampaigns']();this[_0xe46d('0x3d')]();RpcSetting['getSettings']()[_0xe46d('0x3e')](function(_0x1f43b3){previewRecallmeReminderInterval=_0x1f43b3['previewRecallmeReminderInterval'];});}function isNotNull(_0x4b19ea){return _0x4b19ea!==null&&!_[_0xe46d('0x3f')](_0x4b19ea);}function msgResponse(_0x34635c,_0x3c8c3a,_0x1d728b){return{'action':_0x34635c,'response':_0x3c8c3a,'message':_0x1d728b,'stack':_0x1d728b};}function emit(_0x30c797,_0x15d745,_0x101542){io['to'](_0x30c797)['emit'](_0x15d745,_0x101542);}function emitOutboundVoiceQueueSummary(_0x2a2528){if(_0x2a2528['type']===_0xe46d('0x40')){logger[_0xe46d('0x41')](_0xe46d('0x42'),util[_0xe46d('0x43')](_0x2a2528,{'showHidden':![],'depth':null}));emit(util[_0xe46d('0x44')](_0xe46d('0x45'),_0x2a2528[_0xe46d('0x46')]),_0xe46d('0x47'),_0x2a2528);}}function checkGetDataPredictive(_0x50da54){if(isNotNull(_0x50da54)&&!_[_0xe46d('0x48')](_0x50da54)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xe46d('0x49')](_0xe46d('0x4a'),_0x50da54[_0xe46d('0x4b')]);loggerPredictive['info'](_0xe46d('0x4c'),_0x50da54[_0xe46d('0x4d')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x50da54[_0xe46d('0x4e')]);loggerPredictive['info'](_0xe46d('0x4f'),_0x50da54['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x50da54[_0xe46d('0x50')]);loggerPredictive[_0xe46d('0x49')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x50da54['predictiveIntervalAvgTalktime']);loggerPredictive['info']('---------------------------');if(_0x50da54[_0xe46d('0x4b')]>0x0){if(!_[_0xe46d('0x3f')](_0x50da54[_0xe46d('0x51')])&&_0x50da54['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xe46d('0x49')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x50da54['predictiveIntervalAvgHoldtime'])&&_0x50da54[_0xe46d('0x50')]>0x0){return!![];}loggerPredictive[_0xe46d('0x49')](_0xe46d('0x52'));}else{loggerPredictive[_0xe46d('0x49')](_0xe46d('0x53'));}}else{loggerPredictive[_0xe46d('0x49')](_0xe46d('0x54'));}return![];}function mergeDataErlangB(_0x4978d2){return function(_0x5f9f76){loggerPredictive[_0xe46d('0x49')](_0xe46d('0x55'));loggerPredictive[_0xe46d('0x49')](_0xe46d('0x56'),_0x5f9f76[_0xe46d('0x57')]);loggerPredictive[_0xe46d('0x49')](_0xe46d('0x58'),_0x5f9f76[_0xe46d('0x59')]);loggerPredictive[_0xe46d('0x49')](_0xe46d('0x5a'),_0x5f9f76[_0xe46d('0x5b')]);loggerPredictive[_0xe46d('0x49')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5f9f76[_0xe46d('0x5c')]);loggerPredictive['info'](_0xe46d('0x5a'),_0x5f9f76['erlangAbandonmentRate']);loggerPredictive[_0xe46d('0x49')](_0xe46d('0x5d'));_[_0xe46d('0x5e')](_0x4978d2,_0x5f9f76);};}function ifInterval(_0x2d5b8f,_0x2d416d){if(_[_0xe46d('0x3f')](_0x2d416d)){return![];}return utils[_0xe46d('0x5f')](undefined,_0x2d416d)<_0x2d5b8f*0x3c;}function clearPredictiveAttributes(_0x2d0d59){if(_0x2d0d59['startProgressive']){_0x2d0d59[_0xe46d('0x28')]=undefined;loggerPredictive[_0xe46d('0x41')](_0x2d0d59[_0xe46d('0x46')],_0xe46d('0x60'));}if(_0x2d0d59['startPredictive']){_0x2d0d59['startPredictive']=undefined;loggerPredictive[_0xe46d('0x41')](_0x2d0d59['name'],'startPredictive\x20value\x20cleared');}if(_0x2d0d59[_0xe46d('0x61')]){clearInterval(_0x2d0d59[_0xe46d('0x61')]);_0x2d0d59['handlePredictive']=undefined;loggerPredictive['debug'](_0x2d0d59[_0xe46d('0x46')],_0xe46d('0x62'));}}function loggerCatchPredictive(_0x34615a,_0x5a1894){return function(_0x38572f){loggerPredictive['error'](_0x5a1894[_0xe46d('0x46')],_0x34615a);loggerPredictive[_0xe46d('0x63')](_0x38572f['stack']);clearPredictiveAttributes(_0x5a1894);};}function loggerCatch(_0x435ab3){return function(_0xb5fe04){logger[_0xe46d('0x63')](_0x435ab3,util[_0xe46d('0x43')](_0xb5fe04,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x283e07){return function(_0x46e3ba){if(isNotNull(_0x46e3ba)&&isNotNull(_0x46e3ba[0x0])){if(_0x46e3ba[0x0][_0xe46d('0x64')]>0x0){_0x283e07[_0xe46d('0x65')]=utils[_0xe46d('0x66')][_0xe46d('0x67')];logger[_0xe46d('0x49')](_0xe46d('0x68')+_0x283e07['name'],_0x46e3ba[0x0][_0xe46d('0x64')],_0xe46d('0x69'));}else{_0x283e07[_0xe46d('0x65')]=utils[_0xe46d('0x66')]['NO_AVAILABLE_CONTACTS'];logger['info']('[getContactDialer2][Empty]'+_0x283e07[_0xe46d('0x46')]);}}};}function createObjHistory(_0xebda87,_0x5ab1dc,_0x23ba66,_0xb3021,_0x239954){_0xebda87['message']=_0x23ba66;var _0x5c4370=new Action(_0xebda87,_0x5ab1dc);var _0x2b70fd=new History(_0x5c4370);_0x2b70fd[_0xe46d('0x6a')]=_0xb3021;_0x2b70fd[_0xe46d('0x6b')]=_0x239954;_0x2b70fd[_0xe46d('0x6c')]=_0x5c4370[_0xe46d('0x6d')];return _0x2b70fd;}function unlockQueueStatus(_0x4ac345,_0x1915cf){setTimeout(function(){if(_[_0xe46d('0x3f')](_0x4ac345['queueStatusComplete'])){loggerBooked[_0xe46d('0x63')](_0xe46d('0x6e'),_0x1915cf);}_0x4ac345[_0xe46d('0x6f')]=!![];loggerBooked[_0xe46d('0x49')](_0xe46d('0x70'),_0x1915cf,JSON['stringify'](_[_0xe46d('0x71')](_0x4ac345,[_0xe46d('0x46'),_0xe46d('0x6f')])));},0x1f3);}function checkInterval(_0x2baa16){return function(){if(!isNotNull(_0x2baa16[_0xe46d('0x72')])){_0x2baa16[_0xe46d('0x65')]=utils[_0xe46d('0x66')][_0xe46d('0x73')];throw _0x2baa16['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x2baa16[_0xe46d('0x72')][_0xe46d('0x74')])){_0x2baa16[_0xe46d('0x65')]=utils['CAMPAIGN_STATUS'][_0xe46d('0x73')];throw _0x2baa16['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xe46d('0x48')](_0x2baa16[_0xe46d('0x72')][_0xe46d('0x74')]))){_0x2baa16['message']=utils[_0xe46d('0x66')]['NULL_INTERVAL'];throw _0x2baa16[_0xe46d('0x46')]+_0xe46d('0x75');}};}function checkIsIVRCampaignActive(_0x30e926){return function(){if(!utils['isIVRCampaignActive'](_0x30e926)){_0x30e926[_0xe46d('0x65')]=utils[_0xe46d('0x66')][_0xe46d('0x76')];throw _0x30e926['name']+_0xe46d('0x77');}};}function emitCampaignSummary(_0x552aa4){if(utils[_0xe46d('0x78')](_0x552aa4)){emit(util[_0xe46d('0x44')](_0xe46d('0x79'),_0x552aa4[_0xe46d('0x46')]),_0xe46d('0x7a'),_0x552aa4);}}function loggerCatchQueueSummary(_0x43f97b,_0x347ff7){return function(_0x4510d2){clearPredictiveAttributes(_0x347ff7);emitCampaignSummary(_0x347ff7);loggerSyncQueueSummary['debug'](_0x43f97b,util[_0xe46d('0x43')](_0x4510d2,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x2e8aea){if(_0x2e8aea[_0xe46d('0x7b')]){if(_0x2e8aea[_0xe46d('0x7c')]===0x0){_0x2e8aea[_0xe46d('0x7b')]=![];_0x2e8aea[_0xe46d('0x65')]=utils[_0xe46d('0x66')][_0xe46d('0x76')];loggerSyncQueueSummary[_0xe46d('0x41')](_0xe46d('0x7d'),_0x2e8aea[_0xe46d('0x46')],_0xe46d('0x7e'));}else{_0x2e8aea[_0xe46d('0x65')]=utils['CAMPAIGN_STATUS'][_0xe46d('0x7f')];loggerSyncQueueSummary[_0xe46d('0x41')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x2e8aea[_0xe46d('0x46')],_0xe46d('0x80'));}emitCampaignSummary(_0x2e8aea);}}function myreject(_0x4fa86a){return function(_0x38e58c){return _0x4fa86a(msgResponse(_0xe46d('0x81'),_0xe46d('0x82'),JSON[_0xe46d('0x83')](_0x38e58c)));};}Dialer[_0xe46d('0x84')][_0xe46d('0x85')]=function(_0x439d43){return!_[_0xe46d('0x3f')](_0x439d43)&&_0x439d43&&!_[_0xe46d('0x3f')](_0x439d43[_0xe46d('0x46')])&&!_['isUndefined'](_0x439d43[_0xe46d('0x86')])&&_0x439d43[_0xe46d('0x86')]&&(this[_0xe46d('0x22')][util['format']('SIP/%s',_0x439d43[_0xe46d('0x46')])][_0xe46d('0x87')]===_0xe46d('0x88')||this['trunks'][util['format'](_0xe46d('0x89'),_0x439d43[_0xe46d('0x46')])][_0xe46d('0x87')]===_0xe46d('0x8a'));};Dialer['prototype'][_0xe46d('0x8b')]=function(_0x53fbd2){var _0x31d3f7=this;return function(){if(!_0x31d3f7['isTrunkReachable'](_0x53fbd2[_0xe46d('0x8c')])){if(!_0x31d3f7[_0xe46d('0x85')](_0x53fbd2['TrunkBackup'])){_0x53fbd2[_0xe46d('0x65')]=utils[_0xe46d('0x66')]['TRUNK_NOT_REACHABLE'];throw _0x53fbd2[_0xe46d('0x46')]+_0xe46d('0x8d');}}};};Dialer['prototype'][_0xe46d('0x8e')]=function(_0x4a1da2,_0x662e2f,_0x3bef6b,_0x437d31){var _0x3ac49e=this;return function(){var _0xb0e4fe=!![];return _0x3ac49e[_0xe46d('0x8f')](_0x4a1da2,_0x662e2f,_0x3bef6b,_0x437d31,_0xb0e4fe);};};Dialer['prototype'][_0xe46d('0x90')]=function(_0x8a8188,_0x2135d2,_0x2250b7,_0x561df1){var _0x5321af=this;return function(){var _0x2a6f9e=![];return _0x5321af[_0xe46d('0x8f')](_0x8a8188[_0xe46d('0x74')],_0x2135d2,_0x2250b7,_0x561df1,_0x2a6f9e);};};Dialer[_0xe46d('0x84')][_0xe46d('0x8f')]=function(_0x29fab1,_0x2debd4,_0x45fa19,_0x550a54,_0x59dff9){var _0x20ea9b=[];return new Promise(function(_0x46f4b2,_0x38585b){if(!isNotNull(_0x29fab1)){_0x550a54[_0xe46d('0x65')]=utils[_0xe46d('0x66')]['NULL_INTERVAL'];return _0x38585b(msgResponse(_0xe46d('0x91'),_0xe46d('0x92'),_0x45fa19+'\x20Intervals\x20is\x20null\x20'));}if(_[_0xe46d('0x48')](_0x29fab1)){_0x550a54[_0xe46d('0x65')]=utils[_0xe46d('0x66')][_0xe46d('0x93')];return _0x38585b(msgResponse('ifTime',_0xe46d('0x92'),_0x45fa19+'\x20Intervals\x20is\x20empty\x20'));}if(_0x2debd4&&_[_0xe46d('0x3f')](config[_0xe46d('0x94')][_0x2debd4])){_0x550a54[_0xe46d('0x65')]=utils[_0xe46d('0x66')][_0xe46d('0x95')];return _0x38585b(msgResponse(_0xe46d('0x91'),_0xe46d('0x92'),_0x45fa19+_0xe46d('0x96')+_0x2debd4));}if(_[_0xe46d('0x97')](_0x29fab1)){for(var _0x274e7d=0x0;_0x274e7d<_0x29fab1['length'];_0x274e7d+=0x1){_0x20ea9b[_0xe46d('0x98')](ami[_0xe46d('0x99')]({'action':'command','command':util[_0xe46d('0x44')](_0xe46d('0x9a'),_0x29fab1[_0x274e7d][_0xe46d('0x9b')],!_['isUndefined'](config['timezones'][_0x2debd4])?_0x2debd4:'')})[_0xe46d('0x3e')](function(_0x53c010){return _0x53c010['content'][_0xe46d('0x9c')]('true')>=0x0;})[_0xe46d('0x9d')](myreject(_0x38585b)));}}else{_0x20ea9b[_0xe46d('0x98')](ami[_0xe46d('0x99')]({'action':_0xe46d('0x9e'),'command':util[_0xe46d('0x44')]('iftime\x20%s,%s',_0x29fab1,!_['isUndefined'](config[_0xe46d('0x94')][_0x2debd4])?_0x2debd4:'')})[_0xe46d('0x3e')](function(_0x2c7152){return _0x2c7152[_0xe46d('0x9f')][_0xe46d('0x9c')](_0xe46d('0xa0'))>=0x0;})[_0xe46d('0x9d')](myreject(_0x38585b)));}Promise[_0xe46d('0xa1')](_0x20ea9b)['then'](function(_0x50b1a7){var _0x539f20=_[_0xe46d('0xa2')](_0x50b1a7);if(_0x539f20){return _0x46f4b2(_0x539f20);}else{_0x550a54[_0xe46d('0x65')]=_0x59dff9?utils[_0xe46d('0x66')][_0xe46d('0xa3')]:utils[_0xe46d('0x66')][_0xe46d('0xa4')];return _0x38585b(msgResponse(_0xe46d('0xa5'),_0xe46d('0x92'),_0xe46d('0xa6')+_0x59dff9+'\x20'+_0x45fa19+_0xe46d('0xa7')+util[_0xe46d('0x43')](_0x29fab1,{'showHidden':![],'depth':null})+_0xe46d('0xa8')+_0x2debd4));}})[_0xe46d('0x9d')](function(_0x45356e){return _0x38585b(msgResponse(_0xe46d('0x91'),_0xe46d('0x92'),JSON[_0xe46d('0x83')](_0x45356e)));});});};Dialer[_0xe46d('0x84')]['loopCampaigns']=function(){var _0xd7041b=this;return cmHopper[_0xe46d('0xa9')]({'active':![]},{'where':{'active':!![]}})[_0xe46d('0x3e')](function(){setInterval(function(){_0xd7041b[_0xe46d('0xaa')]();},0x3e8);});};Dialer[_0xe46d('0x84')][_0xe46d('0xaa')]=function(){var _0x5829e4=this;var _0x38d992;for(var _0x2d3ad9 in this[_0xe46d('0x20')]){if(typeof this[_0xe46d('0x20')][_0x2d3ad9]!==_0xe46d('0xab')){_0x38d992=this[_0xe46d('0x20')][_0x2d3ad9];if(utils['isIVRCampaign'](_0x38d992)&&utils[_0xe46d('0xac')](_0x38d992)){_0x38d992[_0xe46d('0x7b')]=!![];Promise['resolve']()[_0xe46d('0x3e')](checkIsIVRCampaignActive(_0x38d992))['then'](checkInterval(_0x38d992))['then'](_0x5829e4[_0xe46d('0x8b')](_0x38d992))[_0xe46d('0x3e')](_0x5829e4['checkIfTime'](_0x38d992[_0xe46d('0xad')],_0x38d992[_0xe46d('0xae')],_0x38d992[_0xe46d('0x46')],_0x38d992))['then'](_0x5829e4[_0xe46d('0x90')](_0x38d992[_0xe46d('0x72')],_0x38d992['dialTimezone'],_0x38d992[_0xe46d('0x46')],_0x38d992))[_0xe46d('0x3e')](_0x5829e4[_0xe46d('0xaf')](_0x38d992))['catch'](loggerCatchQueueSummary(_0xe46d('0xb0'),_0x38d992));}else{notSendMessagesCampaign(_0x38d992);}}}};Dialer[_0xe46d('0x84')][_0xe46d('0xb1')]=function(_0x2f51c4){if(_0x2f51c4[_0xe46d('0xb2')]!==_0xe46d('0xa')){clearPredictiveAttributes(_0x2f51c4);}switch(_0x2f51c4['dialMethod']){case _0xe46d('0xb3'):this[_0xe46d('0xb4')](_0x2f51c4,0x1);break;case _0xe46d('0xb5'):this['handlePower'](_0x2f51c4,_0x2f51c4['dialPowerLevel']);break;case'predictive':this[_0xe46d('0xa')](_0x2f51c4);break;case _0xe46d('0x9'):this['handlePower'](_0x2f51c4,0x1);break;default:logger[_0xe46d('0x63')](_0xe46d('0xb6'),_0x2f51c4['name'],_0xe46d('0xb7'));}};Dialer[_0xe46d('0x84')][_0xe46d('0x91')]=function(_0x3a40dd,_0x3ba27c){var _0x5df9ba=_0x3a40dd[_0xe46d('0xae')];var _0x36027b=_0x3ba27c?_0x3a40dd['dialGlobalInterval']:_0x3a40dd[_0xe46d('0x72')][_0xe46d('0x74')];logger[_0xe46d('0xb8')](_0xe46d('0xb9'),_0x36027b,_0x5df9ba,_0x3a40dd['name'],util[_0xe46d('0x44')](_0xe46d('0xba'),_0x3a40dd[_0xe46d('0x46')],_0x3a40dd['id']));var _0x330def=null;return Interval[_0xe46d('0xbb')](_0x36027b,_0x5df9ba)[_0xe46d('0x3e')](function(_0x5b8a7f){if(_0x5b8a7f===!![]){return _0x5b8a7f;}else{_0x3a40dd[_0xe46d('0x65')]=_0x3ba27c?utils[_0xe46d('0x66')][_0xe46d('0xa3')]:utils[_0xe46d('0x66')][_0xe46d('0xa4')];_0x330def=msgResponse(_0xe46d('0xa5'),'Failure',_0xe46d('0xa6')+_0x3ba27c+'\x20'+_0x3a40dd[_0xe46d('0x46')]+_0xe46d('0xa7')+util[_0xe46d('0x43')](_0x36027b,{'showHidden':![],'depth':null})+_0xe46d('0xa8')+_0x5df9ba);}if(_0x330def!==null){logger[_0xe46d('0xb8')](_0xe46d('0xbc'),_0x330def);_0x330def['isGlobal']=_0x3ba27c;throw _0x330def;}})[_0xe46d('0x9d')](function(_0x5b6f8e){logger[_0xe46d('0x63')](_0xe46d('0xbd'),_0x5b6f8e);throw msgResponse(_0xe46d('0x81'),_0xe46d('0x82'),util['inspect'](_0x5b6f8e,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0xe46d('0x2d')]=function(_0x3d2c6f){if(this[_0xe46d('0x1f')][_0x3d2c6f[_0xe46d('0xbe')]]){if(this[_0xe46d('0x27')][_0x3d2c6f[_0xe46d('0xbf')]]&&this[_0xe46d('0x27')][_0x3d2c6f[_0xe46d('0xbf')]][_0xe46d('0xc0')]!==_0xe46d('0xc1')){utils[_0xe46d('0xc2')](this[_0xe46d('0x1f')][_0x3d2c6f[_0xe46d('0xbe')]],_0xe46d('0xc3'));this[_0xe46d('0x27')][_0x3d2c6f[_0xe46d('0xbf')]][_0xe46d('0xc4')]=moment()[_0xe46d('0x44')](_0xe46d('0xc5'));}}};Dialer[_0xe46d('0x84')][_0xe46d('0x32')]=function(_0xea9a67){var _0x1dd279=this[_0xe46d('0x27')][_0xea9a67['uniqueid']];if(this[_0xe46d('0x1f')][_0xea9a67['queue']]){if(_0x1dd279&&_0x1dd279[_0xe46d('0xc0')]!==_0xe46d('0xc1')){delete this['uniqueId'][_0xea9a67[_0xe46d('0xbf')]];this[_0xe46d('0x1f')][_0xea9a67[_0xe46d('0xbe')]][_0xe46d('0xc6')]+=0x1;var _0xd6de74=new AgentComplete(_0x1dd279,_0xea9a67);if(_0xea9a67[_0xe46d('0xc7')]==='agent'){_0xd6de74[_0xe46d('0xc8')]=this[_0xe46d('0x1f')][_0xea9a67[_0xe46d('0xbe')]]['dialQueueProject2']&&this[_0xe46d('0x1f')][_0xea9a67[_0xe46d('0xbe')]][_0xe46d('0xc9')]?moment()[_0xe46d('0x44')](_0xe46d('0xc5')):undefined;}hopperUtils[_0xe46d('0xca')](_0xd6de74)[_0xe46d('0x9d')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0xe46d('0xcb')](_0xd6de74)['catch'](loggerCatch(_0xe46d('0xcc')));}}};Dialer[_0xe46d('0x84')][_0xe46d('0x2e')]=function(_0x1984f5){var _0x4aa97c=this[_0xe46d('0x27')][_0x1984f5['uniqueid']];var _0x14f5ca=this;var _0x377962=![];var _0x237147;var _0x227d60;if(this[_0xe46d('0x1f')][_0x1984f5[_0xe46d('0xbe')]]){if(_0x4aa97c&&_0x4aa97c[_0xe46d('0xc0')]!==_0xe46d('0xc1')){delete this['uniqueId'][_0x1984f5[_0xe46d('0xbf')]];utils[_0xe46d('0xc2')](this['voiceQueues'][_0x1984f5[_0xe46d('0xbe')]],'[syncQueueCallerAbandon]');_0x4aa97c['droptime']=moment()[_0xe46d('0x44')]('YYYY-MM-DD\x20HH:mm:ss');var _0x59728a=new QueueCallerAbandon(_0x4aa97c,_0x1984f5);if(utils[_0xe46d('0x5f')](_0x4aa97c['droptime'],_0x4aa97c[_0xe46d('0xcd')])>=_0x4aa97c[_0xe46d('0xce')]){this[_0xe46d('0x1f')][_0x1984f5[_0xe46d('0xbe')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xe46d('0x1f')][_0x1984f5[_0xe46d('0xbe')]][_0xe46d('0xcf')]+=0x1;this[_0xe46d('0x1f')][_0x1984f5[_0xe46d('0xbe')]][_0xe46d('0xd0')]+=0x1;_0x59728a[_0xe46d('0x6a')]=0xa;_0x59728a[_0xe46d('0x6b')]=_0xe46d('0xd1');_0x59728a['dropreason']=_0xe46d('0xd2');_0x59728a[_0xe46d('0xc8')]=this[_0xe46d('0x1f')][_0x1984f5[_0xe46d('0xbe')]][_0xe46d('0xd3')]?moment()[_0xe46d('0x44')](_0xe46d('0xc5')):undefined;_0x59728a['countdropretry']+=0x1;_0x59728a[_0xe46d('0xd4')]+=0x1;_0x237147=this['voiceQueues'][_0x1984f5['queue']][_0xe46d('0xd5')];_0x227d60=this[_0xe46d('0x1f')][_0x1984f5[_0xe46d('0xbe')]][_0xe46d('0xd6')];hopperUtils[_0xe46d('0xd7')](_0x59728a,_0x59728a[_0xe46d('0x6a')],_0x4aa97c[_0xe46d('0xd8')])[_0xe46d('0x3e')](function(_0x1f67a3){_0x377962=_0x1f67a3[_0xe46d('0xd9')]==0x1;if(_0x59728a[_0xe46d('0xda')]>=_0x14f5ca['voiceQueues'][_0x1984f5[_0xe46d('0xbe')]][_0xe46d('0xdb')]){_0x14f5ca['queueCallerAbandonCreateState'](_0x59728a,_0x1f67a3[_0xe46d('0xd9')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x59728a[_0xe46d('0xda')],'scheduledat':moment()['add'](_0x14f5ca[_0xe46d('0x1f')][_0x1984f5[_0xe46d('0xbe')]][_0xe46d('0xd5')],_0xe46d('0xdc'))[_0xe46d('0x44')](_0xe46d('0xc5')),'ContactId':_0x4aa97c[_0xe46d('0xdd')],'ListId':_0x4aa97c[_0xe46d('0xde')],'VoiceQueueId':_0x4aa97c[_0xe46d('0xdf')]||undefined,'CampaignId':_0x4aa97c[_0xe46d('0xe0')]||undefined})[_0xe46d('0x9d')](loggerCatch(_0xe46d('0xe1')));var _0xaaf4bf=new History(_0x59728a);_0xaaf4bf[_0xe46d('0x6a')]=0xa;_0xaaf4bf['statedesc']=_0xe46d('0xd1');_0xaaf4bf[_0xe46d('0x6d')]=moment()[_0xe46d('0x44')](_0xe46d('0xc5'));_0xaaf4bf['endtime']=_0xaaf4bf[_0xe46d('0x6d')];_0xaaf4bf['calleridname']=_0x59728a['calleridname'];_0xaaf4bf['calleridnum']=_0x59728a[_0xe46d('0xe2')];hopperUtils[_0xe46d('0xca')](_0xaaf4bf)[_0xe46d('0x9d')](loggerCatch(_0xe46d('0xe3')));}})[_0xe46d('0x3e')](function(){if(_0x377962)hopperUtils['swapAdditionalPhones'](_0x59728a,_0x237147,_0x227d60)[_0xe46d('0x3e')](function(){return 0x1;});});}else{this[_0xe46d('0x1f')][_0x1984f5[_0xe46d('0xbe')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xe46d('0x1f')][_0x1984f5[_0xe46d('0xbe')]][_0xe46d('0xe4')]+=0x1;_0x59728a[_0xe46d('0x6a')]=0xb;_0x59728a[_0xe46d('0x6b')]=_0xe46d('0xe5');_0x59728a[_0xe46d('0xe6')]='CALLEREXIT';_0x59728a[_0xe46d('0xe7')]+=0x1;_0x59728a[_0xe46d('0xd4')]+=0x1;_0x237147=this[_0xe46d('0x1f')][_0x1984f5[_0xe46d('0xbe')]][_0xe46d('0xe8')];_0x227d60=this['voiceQueues'][_0x1984f5[_0xe46d('0xbe')]][_0xe46d('0xd6')];hopperUtils[_0xe46d('0xd7')](_0x59728a,_0x59728a[_0xe46d('0x6a')],_0x4aa97c['voiceQueue'])[_0xe46d('0x3e')](function(_0x4faf00){if(_0x59728a[_0xe46d('0xe7')]>=_0x14f5ca[_0xe46d('0x1f')][_0x1984f5[_0xe46d('0xbe')]]['dialAbandonedMaxRetry']){_0x14f5ca[_0xe46d('0xe9')](_0x59728a,_0x4faf00['additional']);}else{hopperUtils[_0xe46d('0xea')]({'active':![],'countabandonedretry':_0x59728a['countabandonedretry'],'scheduledat':moment()[_0xe46d('0xeb')](_0x14f5ca[_0xe46d('0x1f')][_0x1984f5[_0xe46d('0xbe')]][_0xe46d('0xe8')],_0xe46d('0xdc'))['format'](_0xe46d('0xc5')),'ContactId':_0x4aa97c[_0xe46d('0xdd')],'ListId':_0x4aa97c['ListId'],'VoiceQueueId':_0x4aa97c[_0xe46d('0xdf')]||undefined,'CampaignId':_0x4aa97c['CampaignId']||undefined})[_0xe46d('0x9d')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x4195fa=new History(_0x59728a);_0x4195fa[_0xe46d('0x6a')]=0xb;_0x4195fa[_0xe46d('0x6b')]=_0xe46d('0xe5');_0x4195fa[_0xe46d('0x6d')]=moment()[_0xe46d('0x44')](_0xe46d('0xc5'));_0x4195fa[_0xe46d('0x6c')]=_0x4195fa[_0xe46d('0x6d')];_0x4195fa[_0xe46d('0xec')]=_0x59728a[_0xe46d('0xec')];_0x4195fa[_0xe46d('0xe2')]=_0x59728a[_0xe46d('0xe2')];hopperUtils[_0xe46d('0xca')](_0x4195fa)[_0xe46d('0x9d')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})['then'](function(){if(_0x377962)hopperUtils[_0xe46d('0xed')](_0x59728a,_0x237147,_0x227d60)[_0xe46d('0x3e')](function(){return 0x1;});});}}}};Dialer[_0xe46d('0x84')]['syncNewExten']=function(_0x34e7c9){if(this[_0xe46d('0x25')][_0x34e7c9[_0xe46d('0xbf')]]){this['actions'][_0x34e7c9[_0xe46d('0xbf')]][_0xe46d('0xee')]=_0x34e7c9[_0xe46d('0xee')];}if(this['uniqueId'][_0x34e7c9[_0xe46d('0xbf')]]){this[_0xe46d('0x27')][_0x34e7c9[_0xe46d('0xbf')]][_0xe46d('0xee')]=_0x34e7c9[_0xe46d('0xee')];}};Dialer[_0xe46d('0x84')][_0xe46d('0x3a')]=function(_0x56eb65){if(!this[_0xe46d('0x25')][_0x56eb65[_0xe46d('0xef')]]){return;}var _0x3e35c=this[_0xe46d('0x1f')][this['actions'][_0x56eb65[_0xe46d('0xef')]][_0xe46d('0xbe')]][_0xe46d('0xf0')]||_0xe46d('0xf1');if(_0x3e35c===_0xe46d('0xf2')){if(this['actions'][_0x56eb65['actionid']]&&_['isNil'](this[_0xe46d('0x25')][_0x56eb65[_0xe46d('0xef')]][_0xe46d('0xf3')])&&_0x56eb65['status']==='1'&&_0x56eb65[_0xe46d('0xf4')]==='0'){if(this[_0xe46d('0x21')][_0x56eb65['stateinterface']]){if(!this['agents'][_0x56eb65[_0xe46d('0xf5')]][_0xe46d('0xf3')]){this[_0xe46d('0x21')][_0x56eb65[_0xe46d('0xf5')]]['locked']=!![];this[_0xe46d('0x25')][_0x56eb65[_0xe46d('0xef')]][_0xe46d('0xf3')]=!![];this['actions'][_0x56eb65[_0xe46d('0xef')]][_0xe46d('0xf5')]=_0x56eb65[_0xe46d('0xf5')];}}}}else if(_0x3e35c===_0xe46d('0xf1')){if(this[_0xe46d('0x25')][_0x56eb65[_0xe46d('0xef')]]){if(this['agents'][_0x56eb65[_0xe46d('0xf5')]]){this[_0xe46d('0x25')][_0x56eb65[_0xe46d('0xef')]][_0xe46d('0xf5')]=_0x56eb65['stateinterface'];if(_[_0xe46d('0xf6')](this['queueBooked'][this[_0xe46d('0x25')][_0x56eb65[_0xe46d('0xef')]][_0xe46d('0xbe')]])){this[_0xe46d('0x29')][this['actions'][_0x56eb65['actionid']]['queue']]=[];}this[_0xe46d('0x29')][this[_0xe46d('0x25')][_0x56eb65[_0xe46d('0xef')]][_0xe46d('0xbe')]][_0xe46d('0x98')](_[_0xe46d('0x5e')](_[_0xe46d('0x71')](this[_0xe46d('0x25')][_0x56eb65[_0xe46d('0xef')]],['idHopper','stateinterface']),{'status':_0x56eb65[_0xe46d('0x87')],'paused':_0x56eb65[_0xe46d('0xf4')]}));}}}};Dialer['prototype']['syncQueueStatusComplete']=function(_0x1d67e6){if(!this['actions'][_0x1d67e6[_0xe46d('0xef')]]){return;}var _0x432f60=this;var _0x55bd7b=this[_0xe46d('0x1f')][this[_0xe46d('0x25')][_0x1d67e6['actionid']][_0xe46d('0xbe')]];var _0x1a054b=_0x55bd7b[_0xe46d('0xf0')]||_0xe46d('0xf1');if(_0x1a054b===_0xe46d('0xf2')){if(this['actions'][_0x1d67e6[_0xe46d('0xef')]]&&this[_0xe46d('0x25')][_0x1d67e6[_0xe46d('0xef')]][_0xe46d('0xf5')]){this['preview'][_0xe46d('0xf7')](this[_0xe46d('0x25')][_0x1d67e6[_0xe46d('0xef')]][_0xe46d('0xf8')],this['actions'][_0x1d67e6[_0xe46d('0xef')]][_0xe46d('0xf5')])[_0xe46d('0x9d')](function(_0x1bf6bc){logger[_0xe46d('0x63')](_0xe46d('0xf9'),util['inspect'](_0x1bf6bc,{'showHidden':![],'depth':null}));})[_0xe46d('0xfa')](function(){utils[_0xe46d('0xc2')](_0x432f60[_0xe46d('0x1f')][_0x432f60[_0xe46d('0x25')][_0x1d67e6['actionid']]['queue']],_0xe46d('0xfb'));_0x432f60[_0xe46d('0x21')][_0x432f60[_0xe46d('0x25')][_0x1d67e6[_0xe46d('0xef')]][_0xe46d('0xf5')]][_0xe46d('0xf3')]=![];delete _0x432f60[_0xe46d('0x25')][_0x1d67e6[_0xe46d('0xef')]];unlockQueueStatus(_0x55bd7b);});}else{utils[_0xe46d('0xc2')](this[_0xe46d('0x1f')][this[_0xe46d('0x25')][_0x1d67e6[_0xe46d('0xef')]][_0xe46d('0xbe')]],_0xe46d('0xfb'));hopperUtils[_0xe46d('0xea')]({'active':![],'ContactId':this[_0xe46d('0x25')][_0x1d67e6['actionid']]['ContactId'],'ListId':this[_0xe46d('0x25')][_0x1d67e6[_0xe46d('0xef')]][_0xe46d('0xde')],'VoiceQueueId':this[_0xe46d('0x25')][_0x1d67e6[_0xe46d('0xef')]][_0xe46d('0xdf')]||undefined,'CampaignId':this[_0xe46d('0x25')][_0x1d67e6[_0xe46d('0xef')]][_0xe46d('0xe0')]||undefined})['catch'](loggerCatch(_0xe46d('0xfc')));delete this[_0xe46d('0x25')][_0x1d67e6[_0xe46d('0xef')]];unlockQueueStatus(_0x55bd7b);}}else if(_0x1a054b===_0xe46d('0xf1')){var _0xaeb9c2;if(this[_0xe46d('0x25')][_0x1d67e6[_0xe46d('0xef')]]&&!_['isEmpty'](this[_0xe46d('0x29')][this['actions'][_0x1d67e6[_0xe46d('0xef')]][_0xe46d('0xbe')]])){if(this[_0xe46d('0x2a')][_0x432f60[_0xe46d('0x25')][_0x1d67e6['actionid']][_0xe46d('0xbe')]]){this[_0xe46d('0x2a')][_0x432f60[_0xe46d('0x25')][_0x1d67e6[_0xe46d('0xef')]][_0xe46d('0xbe')]]=this[_0xe46d('0x2a')][this[_0xe46d('0x25')][_0x1d67e6[_0xe46d('0xef')]][_0xe46d('0xbe')]]?this[_0xe46d('0x2a')][this[_0xe46d('0x25')][_0x1d67e6[_0xe46d('0xef')]]['queue']]:this[_0xe46d('0x29')][this['actions'][_0x1d67e6[_0xe46d('0xef')]]['queue']]?this['queueBooked'][this[_0xe46d('0x25')][_0x1d67e6[_0xe46d('0xef')]][_0xe46d('0xbe')]]['_rr']||0x0:0x0;}this[_0xe46d('0x29')][this[_0xe46d('0x25')][_0x1d67e6[_0xe46d('0xef')]][_0xe46d('0xbe')]][_0xe46d('0xfd')]=this[_0xe46d('0x2a')][this[_0xe46d('0x25')][_0x1d67e6[_0xe46d('0xef')]][_0xe46d('0xbe')]];for(var _0x581c73=0x0;_0x581c73=_0x111880[_0xe46d('0x126')]){_0x5e85c5['stateGlobal'](_0x17cd60,_0x16bc5b,_0x27ebed,_0xe46d('0x127'));}else{if(_0x17cd60[_0xe46d('0x124')]>=_0x111880['dialMachineMaxRetry']){_0x5e85c5[_0xe46d('0x128')](_0x17cd60,_0x16bc5b,_0x27ebed,_0xe46d('0x129'));}else{hopperUtils[_0xe46d('0xea')]({'active':![],'countmachineretry':_0x17cd60[_0xe46d('0x124')],'scheduledat':moment()[_0xe46d('0xeb')](_0x111880['dialMachineRetryFrequency'],_0xe46d('0xdc'))[_0xe46d('0x44')](_0xe46d('0xc5')),'ContactId':_0x17cd60[_0xe46d('0xdd')],'ListId':_0x17cd60['ListId'],'VoiceQueueId':_0x17cd60['VoiceQueueId']||undefined,'CampaignId':_0x17cd60[_0xe46d('0xe0')]||undefined})['catch'](loggerCatch(_0xe46d('0x12a')));_0x16bc5b({'reschedule':0x1});}}});}if(_0xc71b30['type']===_0xe46d('0xc1')&&this['campaigns'][_0xc71b30[_0xe46d('0xbe')]][_0xe46d('0x12b')]&&_0x25ebe1[_0xe46d('0x111')]===_0xe46d('0x112')){delete this[_0xe46d('0x27')][_0x25ebe1[_0xe46d('0xbf')]];utils['decrementOriginate'](this[_0xe46d('0x20')][_0xc71b30['queue']],_0xe46d('0x113'));_0x41bde2=new Hangup(_0xc71b30,_0x25ebe1);_0x41bde2[_0xe46d('0x6a')]=0x12;_0x41bde2['statedesc']=_0xe46d('0x115');_0x41bde2['membername']=_0xe46d('0x11e');ami[_0xe46d('0x117')](_0xe46d('0x118'),ut['buildObj'](_0x41bde2,'amd'));this[_0xe46d('0x11b')](_0x41bde2,_0xe46d('0x12c'),_0xe46d('0x12d'));}if(_0xc71b30[_0xe46d('0xc0')]===_0xe46d('0xc1')&&this['campaigns'][_0xc71b30[_0xe46d('0xbe')]][_0xe46d('0x12b')]&&_0x25ebe1[_0xe46d('0x111')]===_0xe46d('0x11d')){return new Promise(function(_0x11438b,_0x1a0b94){delete _0x5e85c5[_0xe46d('0x27')][_0x25ebe1[_0xe46d('0xbf')]];utils[_0xe46d('0xc2')](_0x5e85c5['campaigns'][_0xc71b30[_0xe46d('0xbe')]],_0xe46d('0x113'));_0x5e85c5[_0xe46d('0x20')][_0xc71b30['queue']][_0xe46d('0xc6')]+=0x1;_0x5e85c5[_0xe46d('0x20')][_0xc71b30[_0xe46d('0xbe')]][_0xe46d('0x114')]+=0x1;var _0x5ed258=_0x5e85c5[_0xe46d('0x20')][_0xc71b30[_0xe46d('0xbe')]];var _0x9cdb5=new Hangup(_0xc71b30,_0x25ebe1);_0x9cdb5[_0xe46d('0x6a')]=0x13;_0x9cdb5[_0xe46d('0x6b')]='Machine';_0x9cdb5['membername']=_0xe46d('0x11e');_0x9cdb5['countmachineretry']+=0x1;_0x9cdb5[_0xe46d('0xd4')]+=0x1;_0x9cdb5['amd']=!![];ami[_0xe46d('0x117')](_0xe46d('0x118'),ut[_0xe46d('0x119')](_0x9cdb5,'amd'));hopperUtils['createHistory'](_0x9cdb5)[_0xe46d('0x9d')](loggerCatch(_0xe46d('0x11f')));if(_0x9cdb5[_0xe46d('0x120')]+_0x9cdb5[_0xe46d('0x121')]+_0x9cdb5[_0xe46d('0x122')]+_0x9cdb5[_0xe46d('0x123')]+_0x9cdb5[_0xe46d('0xda')]+_0x9cdb5['countabandonedretry']+_0x9cdb5['countmachineretry']+_0x9cdb5[_0xe46d('0x125')]>=_0x5ed258[_0xe46d('0x126')]){_0x5e85c5[_0xe46d('0x12e')](_0x9cdb5,_0x11438b,_0x1a0b94,'reason19\x20machine....');}else{if(_0x9cdb5[_0xe46d('0x124')]>=_0x5ed258[_0xe46d('0x12f')]){_0x5e85c5[_0xe46d('0x128')](_0x9cdb5,_0x11438b,_0x1a0b94,'reason\x2019\x20machine....');}else{hopperUtils[_0xe46d('0xea')]({'active':![],'countmachineretry':_0x9cdb5[_0xe46d('0x124')],'scheduledat':moment()[_0xe46d('0xeb')](_0x5ed258[_0xe46d('0x130')],_0xe46d('0xdc'))[_0xe46d('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x9cdb5[_0xe46d('0xdd')],'ListId':_0x9cdb5[_0xe46d('0xde')],'VoiceQueueId':_0x9cdb5['VoiceQueueId']||undefined,'CampaignId':_0x9cdb5[_0xe46d('0xe0')]||undefined})[_0xe46d('0x9d')](loggerCatch(_0xe46d('0x12a')));_0x11438b({'reschedule':0x1});}}});}}};Dialer[_0xe46d('0x84')][_0xe46d('0x37')]=function(_0x11ca84){var _0x3e43c0=this['uniqueId'][_0x11ca84[_0xe46d('0xbf')]];var _0x558147;if(!_0x3e43c0){return;}if(_0x3e43c0['type']==='ivr'){delete this['uniqueId'][_0x11ca84['uniqueid']];utils[_0xe46d('0xc2')](this[_0xe46d('0x20')][_0x3e43c0['queue']],_0xe46d('0x131'));this['campaigns'][_0x3e43c0[_0xe46d('0xbe')]][_0xe46d('0x132')]+=0x1;if(_0x11ca84[_0xe46d('0x133')]==='Normal\x20Clearing'){const _0x4238c0=new AgentComplete(_0x3e43c0,_0x11ca84);_0x4238c0[_0xe46d('0xe0')]=this[_0xe46d('0x20')][_0x3e43c0[_0xe46d('0xbe')]]['id'];hopperUtils[_0xe46d('0xca')](_0x4238c0)[_0xe46d('0x9d')](loggerCatch('[syncAgentCompleteIvr][createHistory]'));hopperUtils[_0xe46d('0xcb')](_0x4238c0)[_0xe46d('0x9d')](loggerCatch(_0xe46d('0x134')));}else{_0x558147=new Hangup(_0x3e43c0,_0x11ca84);hopperUtils['createHistory'](_0x558147)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xe46d('0xcb')](_0x558147)[_0xe46d('0x9d')](loggerCatch(_0xe46d('0x135')));}}else{if(isNotNull(this[_0xe46d('0x1f')][_0x3e43c0[_0xe46d('0xbe')]][_0xe46d('0x136')])){delete this[_0xe46d('0x27')][_0x11ca84['uniqueid']];utils['decrementOriginate'](this['voiceQueues'][_0x3e43c0[_0xe46d('0xbe')]],_0xe46d('0x131'));this[_0xe46d('0x1f')][_0x3e43c0[_0xe46d('0xbe')]][_0xe46d('0xc6')]+=0x1;this[_0xe46d('0x1f')][_0x3e43c0[_0xe46d('0xbe')]][_0xe46d('0x114')]+=0x1;_0x558147=new Hangup(_0x3e43c0,_0x11ca84);_0x558147[_0xe46d('0x6a')]=0x10;_0x558147[_0xe46d('0x6b')]=_0xe46d('0x137');_0x558147[_0xe46d('0x116')]=_0xe46d('0x138');hopperUtils[_0xe46d('0xca')](_0x558147)[_0xe46d('0x9d')](loggerCatch(_0xe46d('0x139')));hopperUtils[_0xe46d('0xcb')](_0x558147)[_0xe46d('0x9d')](loggerCatch('[syncHangupIvr]'));}else{delete this['uniqueId'][_0x11ca84[_0xe46d('0xbf')]];utils['decrementOriginate'](this['voiceQueues'][_0x3e43c0[_0xe46d('0xbe')]],_0xe46d('0x13a'));if(_0x11ca84[_0xe46d('0x133')]===_0xe46d('0x13b')){this[_0xe46d('0x1f')][_0x3e43c0[_0xe46d('0xbe')]][_0xe46d('0xc6')]+=0x1;const _0x4e1f02=new AgentComplete(_0x3e43c0,_0x11ca84);_0x4e1f02[_0xe46d('0xdf')]=this['voiceQueues'][_0x3e43c0[_0xe46d('0xbe')]]['id'];hopperUtils[_0xe46d('0xca')](_0x4e1f02)[_0xe46d('0x9d')](loggerCatch(_0xe46d('0x13c')));hopperUtils[_0xe46d('0xcb')](_0x4e1f02)[_0xe46d('0x9d')](loggerCatch(_0xe46d('0xcc')));}else{this[_0xe46d('0x1f')][_0x3e43c0[_0xe46d('0xbe')]]['outboundUnknownCallsDay']+=0x1;_0x558147=new Hangup(_0x3e43c0,_0x11ca84);_0x558147[_0xe46d('0x6a')]=0xc;_0x558147[_0xe46d('0x6b')]=_0x11ca84[_0xe46d('0x133')];_0x558147[_0xe46d('0x116')]=_0xe46d('0x13d');hopperUtils[_0xe46d('0xca')](_0x558147)[_0xe46d('0x9d')](loggerCatch(_0xe46d('0x13e')));hopperUtils[_0xe46d('0xcb')](_0x558147)[_0xe46d('0x9d')](loggerCatch('[syncHangup]'));}}}};Dialer['prototype']['syncQueueSummary']=function(_0x409fdc){var _0x3d001f=this;if(!_0x3d001f['queuesSummary'][_0x409fdc[_0xe46d('0x46')]]){_0x3d001f[_0xe46d('0x2b')][_0x409fdc[_0xe46d('0x46')]]={'running':![]};}else if(_0x3d001f[_0xe46d('0x2b')][_0x409fdc['name']]['running']===!![]){return;}else if(_0x3d001f[_0xe46d('0x2b')][_0x409fdc[_0xe46d('0x46')]][_0xe46d('0x13f')]===![]){_0x3d001f['queuesSummary'][_0x409fdc['name']]['running']=!![];}var _0x1b6851=_0x3d001f['voiceQueues'][_0x409fdc[_0xe46d('0x46')]];var _0x41990c=_0x1b6851[_0xe46d('0x65')]!==utils[_0xe46d('0x66')][_0xe46d('0x76')];var _0x1a6fbb=utils[_0xe46d('0x140')](_0x1b6851);_0x1b6851[_0xe46d('0x141')]=utils[_0xe46d('0x142')](_0x1b6851,_0x3d001f[_0xe46d('0x22')]);Promise['resolve']()['then'](function(){if(_0x1b6851[_0xe46d('0x141')]===utils[_0xe46d('0x66')][_0xe46d('0x76')]){if(_0x41990c){clearPredictiveAttributes(_0x1b6851);_0x409fdc[_0xe46d('0x143')]=undefined;_0x409fdc['startProgressive']=undefined;}if(_0x1b6851['statusMessage']===utils[_0xe46d('0x66')][_0xe46d('0x76')]){_0x409fdc[_0xe46d('0x144')]=0x0;_0x409fdc[_0xe46d('0xf4')]=0x0;_0x409fdc['inUse']=0x0;_0x409fdc[_0xe46d('0x145')]=0x0;_0x409fdc[_0xe46d('0x146')]=0x0;}}else if(_0x1b6851[_0xe46d('0x141')]===utils[_0xe46d('0x66')][_0xe46d('0x147')]&&!_0x1a6fbb){return _0x3d001f[_0xe46d('0x91')](_0x1b6851,!![])[_0xe46d('0x3e')](function(){return _0x3d001f[_0xe46d('0x91')](_0x1b6851,![]);})[_0xe46d('0x3e')](function(){return _0x3d001f[_0xe46d('0xb1')](_0x1b6851);})[_0xe46d('0x9d')](function(_0x298cb3){loggerSyncQueueSummary['debug']('[syncQueueSummary]',util[_0xe46d('0x43')](_0x298cb3,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1b6851);});}else{clearPredictiveAttributes(_0x1b6851);}})['then'](function(){var _0x263fe7=_0x409fdc[_0xe46d('0x148')](_0x1b6851);if(_0x263fe7||_0x1b6851['queueSummaryCountersUpdated']){_0x1b6851[_0xe46d('0x149')]=![];_0x409fdc[_0xe46d('0x14a')](_0x1b6851);Object[_0xe46d('0x14b')](_0x1b6851,_0x409fdc);emitOutboundVoiceQueueSummary(_0x409fdc);}_0x3d001f[_0xe46d('0x2b')][_0x1b6851[_0xe46d('0x46')]][_0xe46d('0x13f')]=![];})[_0xe46d('0x9d')](function(_0x34413e){logger[_0xe46d('0x63')](_0xe46d('0x14c'),util[_0xe46d('0x43')](_0x34413e,{'showHidden':![],'depth':null}));_0x3d001f[_0xe46d('0x2b')][_0x1b6851['name']]['running']=![];});};Dialer[_0xe46d('0x84')][_0xe46d('0x35')]=_['throttle'](function(){var _0x57e11e=_[_0xe46d('0x14d')](this[_0xe46d('0x1f')],function(_0x349bb2){return _0x349bb2['dialPreviewRecallmeReminder'];});var _0x4070f3=_['filter'](this['agents'],function(_0xf2dd34){return _0xf2dd34[_0xe46d('0x14e')]&&_0xf2dd34['status']===_0xe46d('0x88');});if(_0x57e11e[_0xe46d('0xfe')]>0x0&&_0x4070f3[_0xe46d('0xfe')]>0x0){return Promise[_0xe46d('0x14f')]()['then'](cmHopper[_0xe46d('0x150')](_[_0xe46d('0x151')](_0x57e11e,'id'),previewRecallmeReminderInterval,_['map'](_0x4070f3,'id')))['then'](function(_0x556bd3){for(var _0x6e3096=0x0;_0x6e3096<_0x556bd3[_0xe46d('0xfe')];_0x6e3096++){var _0x4fc7fe=_0x556bd3[_0x6e3096][_0xe46d('0x152')]['name'];if(_0x4fc7fe)io['to'](util['format']('user:%s',_0x4fc7fe))[_0xe46d('0x117')](_0xe46d('0x153'),{'hopper':_0x556bd3[_0x6e3096]});}})[_0xe46d('0x9d')](function(_0x335db7){logger[_0xe46d('0x63')](_0xe46d('0x154'),_0x335db7);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xe46d('0x84')][_0xe46d('0x3d')]=function(){var _0x5b52ad=this;setInterval(function(){_0x5b52ad[_0xe46d('0x155')](_0x5b52ad['uniqueId'],_0xe46d('0x156'));_0x5b52ad[_0xe46d('0x155')](_0x5b52ad[_0xe46d('0x25')],'[actions]');},0x32c8);};Dialer[_0xe46d('0x84')][_0xe46d('0x155')]=function(_0x155f86,_0x5b8fef){var _0x317506=this;for(var _0x50534b in _0x155f86){if(typeof _0x155f86[_0x50534b]!==_0xe46d('0xab')){this[_0xe46d('0x1d')][_0xe46d('0x1b')](function(){if(!_[_0xe46d('0xf6')](_0x155f86[_0x50534b])){return ami['Action']({'action':_0xe46d('0x87'),'channel':_0x155f86[_0x50534b]['channel']})[_0xe46d('0x9d')](function(_0x21d760){if(_0x21d760[_0xe46d('0x65')]===_0xe46d('0x157')){setTimeout(function(){if(_0x155f86[_0x50534b]&&_0x155f86[_0x50534b][_0xe46d('0xc0')]!=='ivr'){utils[_0xe46d('0xc2')](_0x317506[_0xe46d('0x1f')][_0x155f86[_0x50534b][_0xe46d('0xbe')]],_0xe46d('0x158'));logger[_0xe46d('0x63')](_0xe46d('0x159'),_0x5b8fef,_0x50534b,_0x155f86[_0x50534b][_0xe46d('0xbe')]);delete _0x155f86[_0x50534b];}if(_0x155f86[_0x50534b]&&_0x155f86[_0x50534b][_0xe46d('0xc0')]==='ivr'){utils[_0xe46d('0xc2')](_0x317506[_0xe46d('0x20')][_0x155f86[_0x50534b][_0xe46d('0xbe')]],_0xe46d('0x158'));logger[_0xe46d('0x63')](_0xe46d('0x15a'),_0x5b8fef,_0x50534b,_0x155f86[_0x50534b][_0xe46d('0xbe')]);delete _0x155f86[_0x50534b];}},0x2328);}});}});}}};Dialer[_0xe46d('0x84')]['getVoiceQueueRtPauses']=function(_0x2447d3){return Promise[_0xe46d('0x14f')]()[_0xe46d('0x3e')](voiceQueueRt[_0xe46d('0x15b')](_0x2447d3))[_0xe46d('0x9d')](loggerCatch(_0xe46d('0x15c')));};Dialer[_0xe46d('0x84')][_0xe46d('0x15d')]=function(_0x11d10b,_0x1cbf67,_0x1c92a7){var _0x2e6df5={'state':0x19,'statedesc':_0xe46d('0x15e')};utils[_0xe46d('0xc2')](_0x1cbf67,_0xe46d('0x15f')+_0x11d10b);this[_0xe46d('0x11b')](_[_0xe46d('0x5e')](_0x2e6df5,_['pick'](_0x1c92a7,['ContactId','ListId',_0xe46d('0x160'),_0xe46d('0xdf'),'CampaignId'])),_0xe46d('0x161'),_0xe46d('0x15f'));logger[_0xe46d('0x63')](_0x11d10b);};Dialer[_0xe46d('0x84')]['saveInDb']=function(_0x4567cf,_0x567ce5,_0xd67b26){hopperUtils[_0xe46d('0xca')](_0x4567cf)[_0xe46d('0x9d')](loggerCatch(_0x567ce5));hopperUtils['moveContactManagedDialer'](_0x4567cf)[_0xe46d('0x9d')](loggerCatch(_0xd67b26));};Dialer[_0xe46d('0x84')][_0xe46d('0xe9')]=function(_0x2e88cd,_0x59ed57){hopperUtils[_0xe46d('0xca')](_0x2e88cd)[_0xe46d('0x9d')](loggerCatch(_0xe46d('0x13c')));if(_0x59ed57==0x0){hopperUtils[_0xe46d('0xcb')](_0x2e88cd)[_0xe46d('0x9d')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer['prototype'][_0xe46d('0x154')]=function(_0x499818){return Promise['resolve']()[_0xe46d('0x3e')](cmHopper[_0xe46d('0x150')](_0x499818['id'],previewRecallmeReminderInterval))[_0xe46d('0x3e')](function(_0x494929){for(var _0x5190ca=0x0;_0x5190ca<_0x494929[_0xe46d('0xfe')];_0x5190ca++){var _0x1515ea=_0x494929[_0x5190ca][_0xe46d('0x152')][_0xe46d('0x46')];if(_0x1515ea)io['to'](util[_0xe46d('0x44')](_0xe46d('0x162'),_0x1515ea))[_0xe46d('0x117')](_0xe46d('0x153'),{'hopper':_0x494929[_0x5190ca]});}})['catch'](function(){});};Dialer[_0xe46d('0x84')][_0xe46d('0xaf')]=function(_0x1d32a6){var _0x25f461=this;return function(){_0x25f461[_0xe46d('0x163')](_0x1d32a6);};};Dialer[_0xe46d('0x84')][_0xe46d('0x164')]=function(_0xe02829,_0x4a506d){var _0x1437fe=this;var _0x573465=uuid['v4']();this[_0xe46d('0x25')][_0x573465]=new Action(_0xe02829,_0x4a506d,_0x573465);return new Promise(function(_0x59df44,_0x546307){if(_['isUndefined'](_0xe02829)&&typeof _0xe02829!==_0xe46d('0x165')){return _0x546307(msgResponse(_0xe46d('0x166'),_0xe46d('0x92'),_0xe46d('0x167')));}if(_[_0xe46d('0x3f')](_0x4a506d[_0xe46d('0x168')])||_0x4a506d[_0xe46d('0x168')]===null){return _0x546307(msgResponse(_0xe46d('0x166'),_0xe46d('0x92'),_0xe46d('0x169')));}var _0x44021e={'XMD-CALLERID':_0x1437fe[_0xe46d('0x25')][_0x573465]['getCaller'](),'XMD-AGI':_0xe02829[_0xe46d('0x136')]?util[_0xe46d('0x44')]('\x22agi://%s/square,%s\x22',ipAgi,_0xe02829[_0xe46d('0x136')]):_0xe46d('0x16a'),'XMD-AGIAFTER':_0xe02829[_0xe46d('0xd3')]?util['format'](_0xe46d('0x16b'),ipAgi,_0xe02829[_0xe46d('0xd3')]):_0xe46d('0x16a'),'XMD-QUEUE':utils[_0xe46d('0x16c')](_0xe02829)?util[_0xe46d('0x44')](_0xe46d('0x16d'),_0xe02829['name'],_0xe02829[_0xe46d('0x16e')]||'',_0xe02829[_0xe46d('0xc9')]?'c':'',_0xe02829[_0xe46d('0xce')]||0x3):_0xe46d('0x16a'),'XMD-CONTACTID':_0x4a506d['ContactId'],'XMD-CDRTYPE':_0xe46d('0x16f'),'CALLERID(all)':_0x1437fe[_0xe46d('0x25')][_0x573465][_0xe46d('0x170')](),'XMD-AMD':_0xe02829[_0xe46d('0x12b')]?_0xe46d('0x147'):_0xe46d('0x16a'),'XMD-DESTINATION':_0xe46d('0x110')};if(_0xe02829[_0xe46d('0x12b')]){_0x44021e['XMD-AMDINITIALSILENCE']=_0xe02829[_0xe46d('0x171')]||0x9c4;_0x44021e[_0xe46d('0x172')]=_0xe02829[_0xe46d('0x173')]||0x5dc;_0x44021e[_0xe46d('0x174')]=_0xe02829[_0xe46d('0x175')]||0x320;_0x44021e[_0xe46d('0x176')]=_0xe02829['dialAMDTotalAnalysisTime']||0x1388;_0x44021e[_0xe46d('0x177')]=_0xe02829[_0xe46d('0x178')]||0x64;_0x44021e[_0xe46d('0x179')]=_0xe02829[_0xe46d('0x17a')]||0x32;_0x44021e[_0xe46d('0x17b')]=_0xe02829['dialAMDMaximumNumberOfWords']||0x3;_0x44021e['XMD-AMDSILENCETHRESHOLD']=_0xe02829['dialAMDSilenceThreshold']||0x100;_0x44021e['XMD-AMDMAXIMUMWORDLENGTH']=_0xe02829[_0xe46d('0x17c')]||0x1388;}if(utils[_0xe46d('0x16c')](_0xe02829)){_0x44021e['XMD-VOICEQUEUEID']=_0x4a506d[_0xe46d('0xdf')];}else{_0x44021e['XMD-CAMPAIGNID']=_0x4a506d[_0xe46d('0xe0')];}var _0x500fc6=utils[_0xe46d('0x17d')](_0x4a506d[_0xe46d('0x17e')]);Object['assign'](_0x44021e,_0x500fc6);var _0x38b684=_0x1437fe[_0xe46d('0x85')](_0xe02829[_0xe46d('0x8c')])?utils[_0xe46d('0x17f')](_0xe02829[_0xe46d('0x8c')][_0xe46d('0x180')],_0xe02829[_0xe46d('0x181')],_0xe02829['dialRandomLastDigitCallerIdNumber']>0x0?utils['getCallerIdRandom'](_0xe02829[_0xe46d('0x182')],_0xe02829[_0xe46d('0x183')]):_0xe02829[_0xe46d('0x182')]):utils[_0xe46d('0x17f')](_[_0xe46d('0xf6')](_0xe02829[_0xe46d('0x184')])?_0xe02829[_0xe46d('0x8c')][_0xe46d('0x180')]:_0xe02829[_0xe46d('0x184')][_0xe46d('0x180')],_0xe02829[_0xe46d('0x181')],_0xe02829[_0xe46d('0x183')]>0x0?utils[_0xe46d('0x185')](_0xe02829[_0xe46d('0x182')],_0xe02829[_0xe46d('0x183')]):_0xe02829['dialOriginateCallerIdNumber']);if(_0x38b684){_0x44021e[_0xe46d('0x186')]=_0x1437fe[_0xe46d('0x25')][_0x573465][_0xe46d('0x187')]=utils['extractCalleridName'](_0x38b684);_0x44021e[_0xe46d('0x188')]=_0x4a506d[_0xe46d('0x168')];}_0xe02829[_0xe46d('0x189')]=_0x44021e;return ami[_0xe46d('0x99')]({'actionid':_0x573465,'action':_0xe46d('0x166'),'channel':_0x1437fe[_0xe46d('0x85')](_0xe02829['Trunk'])?util[_0xe46d('0x44')](_0xe46d('0x18a'),_0xe02829[_0xe46d('0x8c')][_0xe46d('0x46')],isNotNull(_0xe02829[_0xe46d('0x18b')])?_0xe02829[_0xe46d('0x18b')][_0xe46d('0x18c')]()||'':'',_0xe02829[_0xe46d('0x18d')]>0x0?_0x4a506d['phone']['substring'](_0xe02829['dialCutDigit']):_0x4a506d['phone']):util[_0xe46d('0x44')](_0xe46d('0x18a'),_[_0xe46d('0xf6')](_0xe02829[_0xe46d('0x184')])?_0xe02829[_0xe46d('0x8c')][_0xe46d('0x46')]:_0xe02829[_0xe46d('0x184')]['name'],isNotNull(_0xe02829[_0xe46d('0x18b')])?_0xe02829[_0xe46d('0x18b')][_0xe46d('0x18c')]()||'':'',_0xe02829[_0xe46d('0x18d')]>0x0?_0x4a506d[_0xe46d('0x168')][_0xe46d('0x18e')](_0xe02829[_0xe46d('0x18d')]):_0x4a506d['phone']),'callerid':_0x38b684,'Exten':_0xe46d('0x110'),'Context':_0xe46d('0x18f'),'Priority':'1','variable':_0x44021e,'timeout':(_0xe02829[_0xe46d('0x190')]||0x1e)*0x3e8,'async':!![],'channelid':_0x573465})[_0xe46d('0x3e')](function(_0x44fe68){return _0x59df44(_0x44fe68);})[_0xe46d('0x9d')](function(_0x438570){_0xe02829[_0xe46d('0x191')]+=0x1;var _0x35da48=new History(_0x1437fe[_0xe46d('0x25')][_0x573465]);logger['error'](util[_0xe46d('0x44')]('[originateError]:\x20%s',JSON[_0xe46d('0x83')](_0x438570)));_0x35da48[_0xe46d('0x6a')]=0xe;_0x35da48[_0xe46d('0x6b')]=_0xe46d('0x192');_0x35da48[_0xe46d('0x6d')]=moment()['format'](_0xe46d('0xc5'));_0x35da48['endtime']=_0x35da48[_0xe46d('0x6d')];hopperUtils[_0xe46d('0xca')](_0x35da48)[_0xe46d('0x9d')](loggerCatch(_0xe46d('0x193')));_0x1437fe['moveContactManagedDialer'](_0x35da48)['catch'](loggerCatch(_0xe46d('0x193')))[_0xe46d('0xfa')](function(){delete _0x1437fe[_0xe46d('0x25')][_0x573465];return _0x546307(msgResponse(_0xe46d('0x166'),_0xe46d('0x82'),_0xe46d('0x194')));});});});};Dialer['prototype']['checkRetriveMax']=function(_0x3fd128,_0x18ab22,_0x108966){var _0x349e99=new History(_0x18ab22);if(_0x349e99[_0xe46d('0x120')]+_0x349e99['countcongestionretry']+_0x349e99[_0xe46d('0x122')]+_0x349e99[_0xe46d('0x123')]+_0x349e99['countdropretry']+_0x349e99['countabandonedretry']+_0x349e99[_0xe46d('0x124')]+_0x349e99[_0xe46d('0x125')]>=_0x108966[_0xe46d('0x126')]-0x1){return!![];}switch(_0x3fd128){case 0x3:if(_0x349e99[_0xe46d('0x122')]>=_0x108966['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0xe46d('0xea')]({'active':![],'countnoanswerretry':_0x349e99['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xe46d('0xeb')](_0x108966['dialNoAnswerRetryFrequency'],_0xe46d('0xdc'))[_0xe46d('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x349e99['ContactId'],'ListId':_0x349e99[_0xe46d('0xde')],'VoiceQueueId':_0x349e99[_0xe46d('0xdf')]||undefined,'CampaignId':_0x349e99[_0xe46d('0xe0')]||undefined})['catch'](loggerCatch(_0xe46d('0x195')));break;case 0x5:if(_0x349e99['countbusyretry']>=_0x108966[_0xe46d('0x196')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x349e99[_0xe46d('0x120')]+=0x1,'scheduledat':moment()[_0xe46d('0xeb')](_0x108966[_0xe46d('0x197')],_0xe46d('0xdc'))['format'](_0xe46d('0xc5')),'ContactId':_0x349e99[_0xe46d('0xdd')],'ListId':_0x349e99[_0xe46d('0xde')],'VoiceQueueId':_0x349e99[_0xe46d('0xdf')]||undefined,'CampaignId':_0x349e99[_0xe46d('0xe0')]||undefined})[_0xe46d('0x9d')](loggerCatch(_0xe46d('0x198')));break;case 0x8:if(_0x349e99[_0xe46d('0x121')]>=_0x108966[_0xe46d('0x199')]-0x1){return!![];}hopperUtils[_0xe46d('0xea')]({'active':![],'countcongestionretry':_0x349e99[_0xe46d('0x121')]+=0x1,'scheduledat':moment()[_0xe46d('0xeb')](_0x108966['dialCongestionRetryFrequency'],_0xe46d('0xdc'))[_0xe46d('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x349e99[_0xe46d('0xdd')],'ListId':_0x349e99['ListId'],'VoiceQueueId':_0x349e99['VoiceQueueId']||undefined,'CampaignId':_0x349e99[_0xe46d('0xe0')]||undefined})[_0xe46d('0x9d')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x349e99[_0xe46d('0x123')]>=_0x108966[_0xe46d('0x19a')]-0x1){return!![];}else{hopperUtils[_0xe46d('0xea')]({'active':![],'countnosuchnumberretry':_0x349e99[_0xe46d('0x123')]+=0x1,'scheduledat':moment()[_0xe46d('0xeb')](_0x108966[_0xe46d('0x19b')],_0xe46d('0xdc'))[_0xe46d('0x44')](_0xe46d('0xc5')),'ContactId':_0x349e99[_0xe46d('0xdd')],'ListId':_0x349e99[_0xe46d('0xde')],'VoiceQueueId':_0x349e99[_0xe46d('0xdf')]||undefined,'CampaignId':_0x349e99['CampaignId']||undefined})[_0xe46d('0x9d')](loggerCatch(_0xe46d('0x19c')));}break;case 0xa:if(_0x349e99[_0xe46d('0xda')]>=_0x108966[_0xe46d('0xdb')]-0x1){return!![];}hopperUtils[_0xe46d('0xea')]({'active':![],'countdropretry':_0x349e99[_0xe46d('0xda')]+=0x1,'scheduledat':moment()['add'](_0x108966[_0xe46d('0xd5')],_0xe46d('0xdc'))[_0xe46d('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x349e99[_0xe46d('0xdd')],'ListId':_0x349e99[_0xe46d('0xde')],'VoiceQueueId':_0x349e99['VoiceQueueId']||undefined,'CampaignId':_0x349e99[_0xe46d('0xe0')]||undefined})[_0xe46d('0x9d')](loggerCatch(_0xe46d('0xe1')));break;case 0xb:if(_0x349e99['countabandonedretry']>=_0x108966[_0xe46d('0x19d')]-0x1){return!![];}hopperUtils[_0xe46d('0xea')]({'active':![],'countabandonedretry':_0x349e99['countabandonedretry']+=0x1,'scheduledat':moment()[_0xe46d('0xeb')](_0x108966['dialAbandonedRetryFrequency'],'minutes')['format'](_0xe46d('0xc5')),'ContactId':_0x349e99[_0xe46d('0xdd')],'ListId':_0x349e99[_0xe46d('0xde')],'VoiceQueueId':_0x349e99['VoiceQueueId']||undefined,'CampaignId':_0x349e99[_0xe46d('0xe0')]||undefined})[_0xe46d('0x9d')](loggerCatch(_0xe46d('0x19e')));break;case 0x13:if(_0x349e99[_0xe46d('0x124')]>=_0x108966[_0xe46d('0x12f')]-0x1){return!![];}hopperUtils[_0xe46d('0xea')]({'active':![],'countmachineretry':_0x349e99[_0xe46d('0x124')]+=0x1,'scheduledat':moment()[_0xe46d('0xeb')](_0x108966[_0xe46d('0x130')],_0xe46d('0xdc'))[_0xe46d('0x44')](_0xe46d('0xc5')),'ContactId':_0x349e99['ContactId'],'ListId':_0x349e99[_0xe46d('0xde')],'VoiceQueueId':_0x349e99['VoiceQueueId']||undefined,'CampaignId':_0x349e99[_0xe46d('0xe0')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x349e99[_0xe46d('0x125')]>=_0x108966['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0xe46d('0xea')]({'active':![],'countagentrejectretry':_0x349e99[_0xe46d('0x125')]+=0x1,'scheduledat':moment()[_0xe46d('0xeb')](_0x108966['dialAgentRejectRetryFrequency'],_0xe46d('0xdc'))[_0xe46d('0x44')](_0xe46d('0xc5')),'ContactId':_0x349e99[_0xe46d('0xdd')],'ListId':_0x349e99[_0xe46d('0xde')],'VoiceQueueId':_0x349e99[_0xe46d('0xdf')]||undefined,'CampaignId':_0x349e99[_0xe46d('0xe0')]||undefined})['catch'](loggerCatch(_0xe46d('0x19f')));break;default:return!![];}};Dialer['prototype'][_0xe46d('0x10c')]=function(_0x569ebc,_0x22bd95,_0x64e7b){var _0x4fb535=this;var _0x18eaf3=new History(_0x569ebc);var _0x171033=![];var _0x268243;var _0x796ac7;return new Promise(function(_0x5e2b03,_0x46f18b){if(_['isUndefined'](_0x22bd95)&&typeof _0x22bd95!==_0xe46d('0x165')){return _0x46f18b(msgResponse(_0xe46d('0x1a0'),'Failure',_0xe46d('0x1a1')));}if(_['isUndefined'](_0x64e7b)&&typeof _0x64e7b!=='object'){return _0x46f18b(msgResponse(_0xe46d('0x1a0'),_0xe46d('0x92'),_0xe46d('0x1a2')));}hopperUtils[_0xe46d('0xd7')](_0x18eaf3,_0x64e7b[_0xe46d('0xc7')],_0x22bd95)['then'](function(_0x3040b1){if(_0x3040b1[_0xe46d('0xd9')]==0x1)_0x171033=!![];switch(_0x64e7b[_0xe46d('0xc7')]){case'0':_0x22bd95['outboundNoSuchCallsDay']+=0x1;_0x18eaf3[_0xe46d('0x6a')]=0x0;_0x18eaf3[_0xe46d('0x6b')]=_0xe46d('0x1a3');_0x18eaf3[_0xe46d('0x123')]+=0x1;_0x18eaf3[_0xe46d('0xd4')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut['buildObj'](_0x569ebc,_0xe46d('0x1a4')));_0x268243=_0x22bd95['dialNoSuchNumberRetryFrequency'];_0x796ac7=_0x22bd95['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x18eaf3)[_0xe46d('0x9d')](loggerCatch(_0xe46d('0x11f')));if(_0x4fb535[_0xe46d('0x1a5')](0x0,_0x569ebc,_0x22bd95)&&!_0x171033){if(_0x18eaf3[_0xe46d('0x123')]>=_0x22bd95[_0xe46d('0x19a')]){_0x4fb535[_0xe46d('0x128')](_0x18eaf3,_0x5e2b03,_0x46f18b,_0xe46d('0x1a6'));}else{_0x4fb535['stateGlobal'](_0x18eaf3,_0x5e2b03,_0x46f18b,_0xe46d('0x1a6'));}}break;case'3':_0x22bd95[_0xe46d('0x1a7')]+=0x1;_0x18eaf3[_0xe46d('0x6a')]=0x3;_0x18eaf3['statedesc']=_0xe46d('0x1a8');_0x18eaf3[_0xe46d('0x122')]+=0x1;_0x18eaf3[_0xe46d('0xd4')]+=0x1;var _0x21f7f9=ut['buildNoAnswerEventPayload'](_0x569ebc,_0x22bd95);ami[_0xe46d('0x117')](_0xe46d('0x1a9'),_0x21f7f9);_0x268243=_0x22bd95[_0xe46d('0x1aa')];_0x796ac7=_0x22bd95[_0xe46d('0xd6')];hopperUtils[_0xe46d('0xca')](_0x18eaf3)[_0xe46d('0x9d')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x4fb535['checkRetriveMax'](0x3,_0x569ebc,_0x22bd95)&&!_0x171033){if(_0x18eaf3[_0xe46d('0x122')]>=_0x22bd95['dialNoAnswerMaxRetry']){_0x4fb535['createStateFinal'](_0x18eaf3,_0x5e2b03,_0x46f18b,'reason\x203\x20ringing\x20no\x20answer');}else{_0x4fb535[_0xe46d('0x12e')](_0x18eaf3,_0x5e2b03,_0x46f18b,_0xe46d('0x1ab'));}}break;case'5':_0x22bd95[_0xe46d('0x1ac')]+=0x1;_0x18eaf3[_0xe46d('0x6a')]=0x5;_0x18eaf3[_0xe46d('0x6b')]='Busy';_0x18eaf3[_0xe46d('0x120')]+=0x1;_0x18eaf3[_0xe46d('0xd4')]+=0x1;ami[_0xe46d('0x117')](_0xe46d('0x1ad'),ut[_0xe46d('0x119')](_0x569ebc,_0xe46d('0x1ae')));_0x268243=_0x22bd95[_0xe46d('0x197')];_0x796ac7=_0x22bd95[_0xe46d('0xd6')];hopperUtils['createHistory'](_0x18eaf3)[_0xe46d('0x9d')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x4fb535[_0xe46d('0x1a5')](0x5,_0x569ebc,_0x22bd95)&&!_0x171033){if(_0x18eaf3[_0xe46d('0x120')]>=_0x22bd95[_0xe46d('0x196')]){_0x4fb535[_0xe46d('0x128')](_0x18eaf3,_0x5e2b03,_0x46f18b,'reason\x205\x20busy');}else{_0x4fb535[_0xe46d('0x12e')](_0x18eaf3,_0x5e2b03,_0x46f18b,_0xe46d('0x1af'));}}break;case'8':_0x22bd95[_0xe46d('0x1b0')]+=0x1;_0x18eaf3[_0xe46d('0x6a')]=0x8;_0x18eaf3['statedesc']='Congestion';_0x18eaf3[_0xe46d('0x121')]+=0x1;_0x18eaf3['countglobal']+=0x1;_0x268243=_0x22bd95['dialCongestionRetryFrequency'];_0x796ac7=_0x22bd95[_0xe46d('0xd6')];ami[_0xe46d('0x117')](_0xe46d('0x1b1'),ut[_0xe46d('0x119')](_0x569ebc,'congestion'));hopperUtils[_0xe46d('0xca')](_0x18eaf3)['catch'](loggerCatch(_0xe46d('0x1b2')));if(_0x4fb535[_0xe46d('0x1a5')](0x8,_0x569ebc,_0x22bd95)&&!_0x171033){if(_0x18eaf3[_0xe46d('0x121')]>=_0x22bd95['dialCongestionMaxRetry']){_0x4fb535['createStateFinal'](_0x18eaf3,_0x5e2b03,_0x46f18b,_0xe46d('0x1b3'));}else{_0x4fb535[_0xe46d('0x12e')](_0x18eaf3,_0x5e2b03,_0x46f18b,_0xe46d('0x1b3'));}}break;case'11':_0x22bd95['outboundAbandonedCallsDay']+=0x1;_0x18eaf3[_0xe46d('0x6a')]=0xb;_0x18eaf3[_0xe46d('0x6b')]=_0xe46d('0xe5');_0x18eaf3[_0xe46d('0xe7')]+=0x1;_0x18eaf3[_0xe46d('0xd4')]+=0x1;_0x268243=_0x22bd95[_0xe46d('0xe8')];_0x796ac7=_0x22bd95[_0xe46d('0xd6')];hopperUtils[_0xe46d('0xca')](_0x18eaf3)[_0xe46d('0x9d')](loggerCatch(_0xe46d('0x1b4')));if(_0x4fb535[_0xe46d('0x1a5')](0xb,_0x569ebc,_0x22bd95)&&!_0x171033){if(_0x18eaf3[_0xe46d('0xe7')]>=_0x22bd95['dialAbandonedMaxRetry']){_0x4fb535['createStateFinal'](_0x18eaf3,_0x5e2b03,_0x46f18b,_0xe46d('0x1b5'));}else{_0x4fb535[_0xe46d('0x12e')](_0x18eaf3,_0x5e2b03,_0x46f18b,'reason\x2011\x20abandoned');}}break;case'20':_0x22bd95['outboundRejectCallsDay']+=0x1;_0x18eaf3[_0xe46d('0x6a')]=0x14;_0x18eaf3['statedesc']=_0xe46d('0x1b6');_0x18eaf3[_0xe46d('0x125')]+=0x1;_0x18eaf3['countglobal']+=0x1;_0x268243=_0x22bd95[_0xe46d('0x1b7')];_0x796ac7=_0x22bd95[_0xe46d('0xd6')];ami[_0xe46d('0x117')](_0xe46d('0x1b8'),ut['buildObj'](_0x569ebc,_0xe46d('0x1b9')));hopperUtils['createHistory'](_0x18eaf3)[_0xe46d('0x9d')](loggerCatch(_0xe46d('0x1ba')));if(_0x4fb535['checkRetriveMax'](0x14,_0x569ebc,_0x22bd95)&&!_0x171033){if(_0x18eaf3[_0xe46d('0x125')]>=_0x22bd95[_0xe46d('0x1bb')]){_0x4fb535[_0xe46d('0x128')](_0x18eaf3,_0x5e2b03,_0x46f18b,_0xe46d('0x1bc'));}else{_0x4fb535[_0xe46d('0x12e')](_0x18eaf3,_0x5e2b03,_0x46f18b,_0xe46d('0x1bc'));}}break;default:_0x22bd95[_0xe46d('0x1bd')]+=0x1;_0x18eaf3[_0xe46d('0x6a')]=0xc;_0x18eaf3['statedesc']=_0x64e7b[_0xe46d('0xc7')];_0x268243=_0x22bd95[_0xe46d('0x1b7')];_0x796ac7=_0x22bd95[_0xe46d('0xd6')];hopperUtils['createHistory'](_0x18eaf3)[_0xe46d('0x9d')](loggerCatch(_0xe46d('0x1be')));if(_0x4fb535['checkRetriveMax'](_0x64e7b['reason'],_0x569ebc,_0x22bd95)&&!_0x171033){if(_0x18eaf3['countbusyretry']+_0x18eaf3[_0xe46d('0x121')]+_0x18eaf3[_0xe46d('0x122')]+_0x18eaf3['countnosuchnumberretry']+_0x18eaf3['countdropretry']+_0x18eaf3[_0xe46d('0xe7')]+_0x18eaf3[_0xe46d('0x124')]+_0x18eaf3[_0xe46d('0x125')]>=_0x22bd95[_0xe46d('0x126')]){_0x4fb535[_0xe46d('0x12e')](_0x18eaf3,_0x5e2b03,_0x46f18b,_0x64e7b['reason']);}else{_0x4fb535[_0xe46d('0x128')](_0x18eaf3,_0x5e2b03,_0x46f18b,_0x64e7b[_0xe46d('0xc7')]);}}}})[_0xe46d('0x3e')](function(){if(_0x171033){hopperUtils['swapAdditionalPhones'](_0x18eaf3,_0x268243,_0x796ac7)['then'](function(){return _0x5e2b03(0x1);});}});});};Dialer[_0xe46d('0x84')][_0xe46d('0x12e')]=function(_0x414d02,_0x3222b9,_0x2aec16,_0x525780){var _0x329335=new Final(_0x414d02);_0x329335[_0xe46d('0x6a')]=0xf;_0x329335[_0xe46d('0x6b')]=_0xe46d('0x1bf');this[_0xe46d('0x128')](_0x329335,_0x3222b9,_0x2aec16,_0x525780);};Dialer['prototype'][_0xe46d('0x128')]=function(_0x2a8ccd,_0x3b953e,_0x2932aa,_0x38db81){hopperUtils[_0xe46d('0xcb')](_0x2a8ccd)[_0xe46d('0x3e')](function(){return _0x3b953e(msgResponse('[callProgressDetecting]',_0xe46d('0x10a'),_0x38db81));})[_0xe46d('0x9d')](function(){return _0x2932aa(msgResponse(_0xe46d('0x1c0'),_0xe46d('0x92'),_0xe46d('0x1c1')));});};Dialer[_0xe46d('0x84')]['predictive']=function(_0x58c655){var _0x45f7cd=_0x58c655[_0xe46d('0x1c2')]/0x64;var _0x48fe2a=_0x58c655['outboundDropCallsDayTimeout']/(_0x58c655['outboundDropCallsDayTimeout']+_0x58c655[_0xe46d('0xc6')]);var _0x7f623b=Math[_0xe46d('0x1c3')](_0x58c655[_0xe46d('0x1c4')]*(_0x58c655[_0xe46d('0x1c5')]/0x64));var _0x240383=Math[_0xe46d('0x1c3')](_0x58c655['predictiveIntervalAvailable']*(_0x58c655[_0xe46d('0x1c6')]/0x64));var _0x29c43b=_0x58c655[_0xe46d('0x144')]+_0x58c655[_0xe46d('0x145')];var _0x2ed5b9=Math[_0xe46d('0x1c7')](_0x58c655['erlangCalls']*_0x58c655[_0xe46d('0x5b')]*_0x58c655[_0xe46d('0x1c8')]*_0x58c655[_0xe46d('0x1c9')]);if(_[_0xe46d('0x3f')](_0x58c655['startProgressive'])){if(!_[_0xe46d('0x3f')](_0x58c655['startPredictive'])){_0x58c655[_0xe46d('0x143')]=undefined;loggerPredictive[_0xe46d('0x63')]('[startMethodPredictive][StartProgressive]',_0xe46d('0x1ca'));}if(!_[_0xe46d('0x3f')](_0x58c655[_0xe46d('0x61')])){loggerPredictive[_0xe46d('0x63')](_0xe46d('0x1cb'),_0xe46d('0x1cc'));clearInterval(_0x58c655[_0xe46d('0x61')]);_0x58c655[_0xe46d('0x61')]=undefined;}_0x58c655[_0xe46d('0x28')]=moment()['format'](_0xe46d('0xc5'));loggerPredictive[_0xe46d('0x49')](_0x58c655[_0xe46d('0x46')],_0xe46d('0x1cd'),_0x58c655[_0xe46d('0x28')]);this[_0xe46d('0xb4')](_0x58c655,0x1);}else if(ifInterval(_0x58c655[_0xe46d('0x1ce')],_0x58c655[_0xe46d('0x28')])){this[_0xe46d('0xb4')](_0x58c655,0x1);loggerPredictiveCalls['info'](_0xe46d('0x1cf'),_0x58c655[_0xe46d('0x28')],_0x58c655[_0xe46d('0x46')]);_0x58c655[_0xe46d('0x57')]=0x0;_0x58c655[_0xe46d('0xd0')]=0x0;}else if(_0x45f7cd<_0x48fe2a&&_0x58c655[_0xe46d('0x1d0')]===_0xe46d('0x1d1')){clearPredictiveAttributes(_0x58c655);loggerPredictive[_0xe46d('0x49')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0xe46d('0x1d2'),_0x48fe2a,_0xe46d('0x28'),_0x58c655[_0xe46d('0x46')]);}else if(_0x2ed5b9<_0x58c655[_0xe46d('0xd0')]&&_0x58c655['dialPredictiveOptimization']===_0xe46d('0x1d1')){clearPredictiveAttributes(_0x58c655);loggerPredictive[_0xe46d('0x49')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xe46d('0x1d3'),_0x2ed5b9,'Drop\x20in\x20this\x20interval',_0x58c655[_0xe46d('0xd0')],_0xe46d('0x28'),_0x58c655['name']);}else if(!ifInterval(_0x58c655['dialPredictiveInterval'],_0x58c655[_0xe46d('0x28')])&&_['isUndefined'](_0x58c655[_0xe46d('0x143')])&&!_[_0xe46d('0x3f')](_0x58c655[_0xe46d('0x28')])){_0x58c655['startPredictive']=moment()[_0xe46d('0x44')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x58c655[_0xe46d('0x46')],_0xe46d('0x1d4'),_0x58c655['startPredictive']);hopperUtils[_0xe46d('0x1d5')](_0x58c655[_0xe46d('0x1ce')])['then'](this[_0xe46d('0x1d6')](_0x58c655))[_0xe46d('0x3e')](mergeDataErlangB(_0x58c655))['then'](this[_0xe46d('0x1d7')](_0x58c655))[_0xe46d('0x9d')](loggerCatchPredictive(_0xe46d('0x1d8'),_0x58c655));}else if(!ifInterval(_0x58c655[_0xe46d('0x1ce')],_0x58c655['startPredictive'])){_0x58c655[_0xe46d('0xd0')]=0x0;_0x58c655[_0xe46d('0x143')]=moment()[_0xe46d('0x44')](_0xe46d('0xc5'));loggerPredictive[_0xe46d('0x49')](_0x58c655[_0xe46d('0x46')],_0xe46d('0x1d9'),_0x58c655[_0xe46d('0x143')]);clearInterval(_0x58c655['handlePredictive']);_0x58c655[_0xe46d('0x61')]=undefined;hopperUtils['avgHandleTime'](_0x58c655[_0xe46d('0x1ce')])[_0xe46d('0x3e')](this[_0xe46d('0x1d6')](_0x58c655))[_0xe46d('0x3e')](mergeDataErlangB(_0x58c655))[_0xe46d('0x3e')](this['startMethodPredictive'](_0x58c655))[_0xe46d('0x9d')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x58c655));}else if(_0x58c655['predictiveIntervalAvailable']&&_0x29c43b<_0x58c655[_0xe46d('0x1c4')]-_0x240383){clearPredictiveAttributes(_0x58c655);loggerPredictive[_0xe46d('0x49')](_0x58c655['name'],_0xe46d('0x1da'),_0x29c43b,_0xe46d('0x1db'),_0x58c655[_0xe46d('0x1c4')],'-',_0x240383,'=',_0x58c655[_0xe46d('0x1c4')]-_0x240383,')');}else if(_0x58c655[_0xe46d('0x1c4')]&&_0x29c43b>_0x58c655[_0xe46d('0x1c4')]+_0x7f623b){clearPredictiveAttributes(_0x58c655);loggerPredictive[_0xe46d('0x49')](_0x58c655[_0xe46d('0x46')],_0xe46d('0x1da'),_0x29c43b,_0xe46d('0x1dc'),_0x58c655['predictiveIntervalAvailable'],'+',_0x7f623b,'=',_0x58c655[_0xe46d('0x1c4')]+_0x7f623b,')');}};Dialer[_0xe46d('0x84')]['getDataPredictive']=function(_0x5a9904){var _0x37c71e=this;return function(_0x7cbf6d){return new Promise(function(_0x5eb020,_0x25fe7d){_[_0xe46d('0x5e')](_0x5a9904,_0x7cbf6d[0x0]);if(checkGetDataPredictive(_0x7cbf6d[0x0])){var _0x2170bf=_0x5a9904[_0xe46d('0x1c4')]=_0x5a9904[_0xe46d('0x145')]+_0x5a9904[_0xe46d('0x144')];var _0x593856=_0x5a9904[_0xe46d('0x1ce')]*0x3c;var _0x30186b=_0x7cbf6d[0x0][_0xe46d('0x51')]+_0x7cbf6d[0x0][_0xe46d('0x50')];var _0x5ae561=(_0x7cbf6d[0x0][_0xe46d('0x4d')]+_0x7cbf6d[0x0][_0xe46d('0x4e')]+_0x7cbf6d[0x0][_0xe46d('0x1dd')])/_0x7cbf6d[0x0]['predictiveIntervalTotalCalls'];_0x5a9904['predictiveIntervalHitRate']=_0x5ae561>0x0?_0x5ae561:0x1;switch(_0x5a9904['dialPredictiveOptimization']){case _0xe46d('0x1d1'):var _0x1e323d=_0x5a9904['dialPredictiveOptimizationPercentage']/0x64;return _0x37c71e['abandonmentRate'](_0x2170bf,_0x593856,_0x30186b,_0x5ae561,_0x1e323d)[_0xe46d('0x3e')](function(_0x24d39c){return _0x5eb020(_0x24d39c);});case'agentBusyFactor':var _0x1bb302=_0x5a9904[_0xe46d('0x1c2')]/0x64;return _0x37c71e['busyFactor'](_0x2170bf,_0x593856,_0x30186b,_0x5ae561,_0x1bb302)[_0xe46d('0x3e')](function(_0x3be60c){return _0x5eb020(_0x3be60c);});default:return _0x25fe7d(msgResponse(_0xe46d('0x1de'),_0xe46d('0x92'),_0xe46d('0x1df')));}}else{return _0x25fe7d(msgResponse(_0xe46d('0x1de'),_0xe46d('0x92'),_0xe46d('0x1e0')));}});};};Dialer[_0xe46d('0x84')]['getDataPredictiveOld']=function(_0x2c8108){var _0x18d2d3=this;return function(_0x32b990){return new Promise(function(_0x1caacf,_0xd350dd){_[_0xe46d('0x5e')](_0x2c8108,_0x32b990[0x0]);if(checkGetDataPredictive(_0x32b990[0x0])){loggerPredictive[_0xe46d('0x49')](JSON[_0xe46d('0x83')](_0x32b990[0x0]));if(_0x2c8108['dialPredictiveOptimization']===_0xe46d('0x1d1')){return _0x18d2d3[_0xe46d('0x15b')](_0x2c8108['id'])['then'](function(_0x4680b7){var _0x393da4=_0x2c8108[_0xe46d('0x1e1')]-_0x4680b7[0x0][_0xe46d('0x1e2')];var _0x41280f=_0x2c8108[_0xe46d('0x1ce')]*0x3c;var _0xfe3f21=_0x32b990[0x0][_0xe46d('0x51')]+_0x32b990[0x0][_0xe46d('0x50')];var _0x16cb8d=(_0x32b990[0x0][_0xe46d('0x4d')]+_0x32b990[0x0][_0xe46d('0x4e')]+_0x32b990[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x32b990[0x0]['predictiveIntervalTotalCalls'];var _0xa0b83b=_0x2c8108['dialPredictiveOptimizationPercentage']/0x64;_0x2c8108[_0xe46d('0x1e3')]=_0x4680b7[0x0][_0xe46d('0x1e2')]||0x0;_0x2c8108[_0xe46d('0x1c8')]=_0x16cb8d>0x0?_0x16cb8d:0x1;return _0x18d2d3['abandonmentRate'](_0x393da4,_0x41280f,_0xfe3f21,_0x16cb8d,_0xa0b83b);})[_0xe46d('0x3e')](function(_0x183a17){return _0x1caacf(_0x183a17);})[_0xe46d('0x9d')](function(_0x4a6a5e){return _0xd350dd(msgResponse(_0xe46d('0x1e4'),_0xe46d('0x92'),JSON[_0xe46d('0x83')](_0x4a6a5e)));});}if(_0x2c8108['dialPredictiveOptimization']==='agentBusyFactor'){return _0x18d2d3[_0xe46d('0x15b')](_0x2c8108['id'])[_0xe46d('0x3e')](function(_0x2642a4){var _0xc144db=_0x2c8108[_0xe46d('0x1e1')]-_0x2642a4[0x0][_0xe46d('0x1e2')];var _0x10504c=_0x2c8108[_0xe46d('0x1ce')]*0x3c;var _0x5703b0=_0x32b990[0x0][_0xe46d('0x51')]+_0x32b990[0x0][_0xe46d('0x50')];var _0x40a2f5=(_0x32b990[0x0][_0xe46d('0x4d')]+_0x32b990[0x0][_0xe46d('0x4e')]+_0x32b990[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x32b990[0x0][_0xe46d('0x4b')];var _0x581805=_0x2c8108[_0xe46d('0x1c2')]/0x64;_0x2c8108[_0xe46d('0x1e3')]=_0x2642a4[0x0][_0xe46d('0x1e2')]||0x0;_0x2c8108[_0xe46d('0x1c8')]=_0x40a2f5>0x0?_0x40a2f5:0x1;return _0x18d2d3[_0xe46d('0x1e5')](_0xc144db,_0x10504c,_0x5703b0,_0x40a2f5,_0x581805);})[_0xe46d('0x3e')](function(_0x4426fe){return _0x1caacf(_0x4426fe);})[_0xe46d('0x9d')](function(_0x1bfb07){return _0xd350dd(msgResponse('[CatchErlangB]',_0xe46d('0x92'),JSON[_0xe46d('0x83')](_0x1bfb07)));});}}else{return _0xd350dd(msgResponse(_0xe46d('0x1de'),'Failure',_0xe46d('0x1e0')));}});};};Dialer[_0xe46d('0x84')]['startMethodPredictive']=function(_0x113050){var _0x2b82c7=this;return function(){var _0x379225=0x0;var _0x128a4c=Math[_0xe46d('0x1c7')](_0x113050[_0xe46d('0x59')]*0x3e8);if(_0x128a4c>0x0){_0x128a4c=_0x128a4c<0x64?0x64:_0x128a4c;loggerPredictive['info'](_0x113050['name'],_0xe46d('0x1e6'),_0x128a4c,'milliseconds');_0x113050[_0xe46d('0x61')]=setInterval(function(){_0x2b82c7[_0xe46d('0x61')](_0x113050);loggerPredictiveCalls[_0xe46d('0x49')]('[handlePredictive]',_0x379225+=0x1);},_0x128a4c);}else{loggerPredictive['info'](_0x113050[_0xe46d('0x46')],_0xe46d('0x1e7'));}};};Dialer['prototype'][_0xe46d('0x1e8')]=function(_0x5041e9,_0xb53001){var _0x139db0=this;return function(_0x45d46b){if(_[_0xe46d('0x48')](_0x45d46b)){if(_['isNil'](_0xb53001[_0xe46d('0x160')])||!_0xb53001[_0xe46d('0x1e9')]){if(_0x5041e9[_0xe46d('0xb2')]==='booked'){_0x5041e9[_0xe46d('0x6f')]=_[_0xe46d('0x3f')](_0x5041e9[_0xe46d('0x6f')])?!![]:_0x5041e9[_0xe46d('0x6f')];var _0x4c7571=uuid['v4']();_0x139db0[_0xe46d('0x25')][_0x4c7571]=new Action(_0x5041e9,_0xb53001,_0x4c7571);loggerBooked[_0xe46d('0x49')]('[booked][checkContactBlack]',_0x4c7571,'queueStatusComplete:\x20',JSON['stringify'](_0x5041e9[_0xe46d('0x6f')]),_0xe46d('0x1ea'),_0x5041e9[_0xe46d('0x46')]);if(_0x5041e9[_0xe46d('0x6f')]){_0x5041e9[_0xe46d('0x6f')]=![];_0x139db0[_0xe46d('0x29')][_0x139db0[_0xe46d('0x25')][_0x4c7571]['queue']]=[];ami[_0xe46d('0x99')]({'actionid':_0x4c7571,'action':_0xe46d('0x1eb'),'queue':_0x5041e9[_0xe46d('0x46')]})[_0xe46d('0x9d')](function(){utils[_0xe46d('0xc2')](_0x5041e9,_0xe46d('0x1ec'));hopperUtils[_0xe46d('0xea')]({'active':![],'ContactId':_0x139db0[_0xe46d('0x25')][_0x4c7571][_0xe46d('0xdd')],'ListId':_0x139db0[_0xe46d('0x25')][_0x4c7571]['ListId'],'VoiceQueueId':_0x139db0[_0xe46d('0x25')][_0x4c7571][_0xe46d('0xdf')]||undefined,'CampaignId':_0x139db0['actions'][_0x4c7571][_0xe46d('0xe0')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x139db0[_0xe46d('0x25')][_0x4c7571];});}else{loggerBooked[_0xe46d('0x49')](_0xe46d('0x1ed'),JSON[_0xe46d('0x83')](_0x5041e9[_0xe46d('0x6f')]),_0xe46d('0x1ea'),_0x5041e9['name']);utils['decrementOriginate'](_0x5041e9,'[checkContactBlack]');hopperUtils[_0xe46d('0xea')]({'active':![],'ContactId':_0x139db0[_0xe46d('0x25')][_0x4c7571]['ContactId'],'ListId':_0x139db0[_0xe46d('0x25')][_0x4c7571]['ListId'],'VoiceQueueId':_0x139db0['actions'][_0x4c7571][_0xe46d('0xdf')]||undefined,'CampaignId':_0x139db0[_0xe46d('0x25')][_0x4c7571][_0xe46d('0xe0')]||undefined})[_0xe46d('0x9d')](loggerCatch(_0xe46d('0x1ee')));delete _0x139db0['actions'][_0x4c7571];}}else{return _0x139db0[_0xe46d('0x164')](_0x5041e9,_0xb53001);}}else{if(utils[_0xe46d('0x5f')](undefined,_0xb53001[_0xe46d('0x1ef')])<_0x5041e9[_0xe46d('0x1f0')]*0x3c){if(_0xb53001[_0xe46d('0x152')]&&!_0xb53001['Agent'][_0xe46d('0x1f1')]){_0x139db0[_0xe46d('0x1e')]['run'](_0xb53001['id'])[_0xe46d('0xfa')](function(){utils[_0xe46d('0xc2')](_0x5041e9,_0xe46d('0x1ec'));});}else{hopperUtils[_0xe46d('0x1f2')]({'active':![]},_0xb53001['id'],0x1)['finally'](function(){utils['decrementOriginate'](_0x5041e9,'[checkContactBlack]');});}}else{_0x5041e9[_0xe46d('0x1f3')]+=0x1;utils[_0xe46d('0xc2')](_0x5041e9,'[checkContactBlack]');if(_0x5041e9[_0xe46d('0x1f4')]){hopperUtils[_0xe46d('0xea')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xb53001['ContactId'],'ListId':_0xb53001[_0xe46d('0xde')],'VoiceQueueId':_0xb53001[_0xe46d('0xdf')]||undefined,'CampaignId':_0xb53001[_0xe46d('0xe0')]||undefined})[_0xe46d('0x9d')](loggerCatch(_0xe46d('0x1f5')));hopperUtils[_0xe46d('0xca')](createObjHistory(_0x5041e9,_0xb53001,utils['CAMPAIGN_STATUS'][_0xe46d('0x1f6')],0x17,'RecallInQueue'))[_0xe46d('0x9d')](loggerCatch(_0xe46d('0x1f7')));}else{_0x139db0['saveInDb'](createObjHistory(_0x5041e9,_0xb53001,utils[_0xe46d('0x66')][_0xe46d('0x1f8')],0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]',_0xe46d('0x1f9'));}}}}else{_0x5041e9[_0xe46d('0x1fa')]+=0x1;_0x139db0[_0xe46d('0x11b')](createObjHistory(_0x5041e9,_0xb53001,utils[_0xe46d('0x66')][_0xe46d('0x1fb')],0xd,'Blacklist'),_0xe46d('0x1fc'),_0xe46d('0x1fd'));throw _0xe46d('0x1fe');}};};Dialer[_0xe46d('0x84')][_0xe46d('0x163')]=function(_0x4d0bad){var _0x384b05=this;var _0x3593f9=_0x4d0bad[_0xe46d('0x1ff')]-_0x4d0bad['originated'];emitCampaignSummary(_0x4d0bad);if(_0x3593f9>0x0&&_0x4d0bad[_0xe46d('0x200')]==0x0){if(_0x3593f9>this[_0xe46d('0x23')]){_0x3593f9=this[_0xe46d('0x23')];}_0x4d0bad[_0xe46d('0x200')]=0x1;hopperUtils[_0xe46d('0x201')](_0x4d0bad,_0x3593f9)[_0xe46d('0x3e')](function(_0x2a3434){_0x4d0bad['temp']=0x0;if(_0x2a3434){if(!utils['checkContactEmpty'](_0x2a3434)){_0x4d0bad[_0xe46d('0x65')]=utils['CAMPAIGN_STATUS'][_0xe46d('0x202')];logger[_0xe46d('0x49')](_0xe46d('0x203')+_0x4d0bad[_0xe46d('0x46')]);}else{_0x4d0bad[_0xe46d('0x7c')]+=_0x2a3434[_0xe46d('0xfe')];_0x4d0bad[_0xe46d('0x65')]=utils['CAMPAIGN_STATUS'][_0xe46d('0x204')];for(var _0x1e9723=0x0;_0x1e9723<_0x2a3434['length'];_0x1e9723+=0x1){_0x4d0bad[_0xe46d('0x205')]+=0x1;if(_[_0xe46d('0xf6')](_0x2a3434[_0x1e9723])||_['isNil'](_0x2a3434[_0x1e9723][_0xe46d('0x17e')])||_[_0xe46d('0xf6')](_0x2a3434[_0x1e9723]['phone'])){_0x384b05[_0xe46d('0x15d')](_0xe46d('0x206'),_0x4d0bad,_0x2a3434[_0x1e9723]);}else{hopperUtils[_0xe46d('0x207')](_[_0xe46d('0x71')](_0x2a3434[_0x1e9723],[_0xe46d('0xe0'),_0xe46d('0x168')]))[_0xe46d('0x3e')](_0x384b05[_0xe46d('0x1e8')](_0x4d0bad,_0x2a3434[_0x1e9723]))[_0xe46d('0x9d')](function(_0x5aced1){logger[_0xe46d('0x63')]('[actionOriginateIvr]',_0x5aced1);utils[_0xe46d('0xc2')](_0x4d0bad,_0xe46d('0x208'));});}}}}})[_0xe46d('0x9d')](function(_0x402f16){_0x4d0bad[_0xe46d('0x200')]=0x0;logger[_0xe46d('0x63')]('[getContactCampaign2]',_0x402f16);});}};Dialer[_0xe46d('0x84')][_0xe46d('0xb4')]=function(_0x19cbe7,_0x356b79){var _0x103475=this;var _0x599ec5=[];if(_0x356b79<0x1||_0x19cbe7[_0xe46d('0xb2')]==='booked'){_0x356b79=0x1;}var _0x3600ad=Math[_0xe46d('0x1c7')](_0x19cbe7[_0xe46d('0x144')]*_0x356b79)-_0x19cbe7['originated'];if(_0x19cbe7[_0xe46d('0x209')]>0x0){var _0x1d0464=_0x19cbe7[_0xe46d('0x209')]-_0x19cbe7[_0xe46d('0x7c')]-_0x19cbe7[_0xe46d('0x145')]-_0x19cbe7['pTalking'];if(_0x3600ad>_0x1d0464){_0x3600ad=_0x1d0464;}}if(_0x3600ad>0x0&&_0x19cbe7[_0xe46d('0x200')]==0x0){if(_0x19cbe7['dialMethod']===_0xe46d('0x9')){_0x3600ad=0x1;}if(_0x3600ad>this['maxNumberOriginate']){_0x3600ad=this[_0xe46d('0x23')];}for(var _0x3f11cc in this[_0xe46d('0x21')]){if(typeof this[_0xe46d('0x21')][_0x3f11cc]!==_0xe46d('0xab')){if(this[_0xe46d('0x21')][_0x3f11cc][_0xe46d('0x6a')]===_0xe46d('0x20a')&&this[_0xe46d('0x21')][_0x3f11cc]['status']===_0xe46d('0x88')){_0x599ec5[_0xe46d('0x98')](this[_0xe46d('0x21')][_0x3f11cc]['id']);}}}_0x19cbe7['temp']=0x1;hopperUtils['getContactDialer'](_0x19cbe7,_0x599ec5,_0x3600ad)['then'](function(_0x46c7d2){_0x19cbe7[_0xe46d('0x200')]=0x0;if(_0x46c7d2){if(!utils[_0xe46d('0x20b')](_0x46c7d2)){hopperUtils[_0xe46d('0x20c')](_0x19cbe7)[_0xe46d('0x3e')](sendMessageReschedule(_0x19cbe7))[_0xe46d('0x9d')](loggerCatch('[countReScheduled]\x20'));}else{_0x19cbe7[_0xe46d('0x7c')]+=_0x46c7d2[_0xe46d('0xfe')];_0x19cbe7[_0xe46d('0x65')]=_0x19cbe7['dialMethod']===_0xe46d('0x9')?utils[_0xe46d('0x66')][_0xe46d('0x147')]:utils[_0xe46d('0x66')]['RUNNING'];for(var _0x5c443e=0x0;_0x5c443e<_0x46c7d2[_0xe46d('0xfe')];_0x5c443e+=0x1){if(_[_0xe46d('0xf6')](_0x46c7d2[_0x5c443e])||_[_0xe46d('0xf6')](_0x46c7d2[_0x5c443e][_0xe46d('0x17e')])||_[_0xe46d('0xf6')](_0x46c7d2[_0x5c443e][_0xe46d('0x168')])){_0x103475[_0xe46d('0x15d')](_0xe46d('0x206'),_0x19cbe7,_0x46c7d2[_0x5c443e]);}else{hopperUtils['checkIsBlackList'](_[_0xe46d('0x71')](_0x46c7d2[_0x5c443e],[_0xe46d('0xdf'),_0xe46d('0x168')]))['then'](_0x103475['checkContactBlack'](_0x19cbe7,_0x46c7d2[_0x5c443e]))['catch'](function(_0x586394){logger[_0xe46d('0x63')](_0xe46d('0x20d'),_0x586394);utils[_0xe46d('0xc2')](_0x19cbe7,_0xe46d('0x20e'));});}}}}})['catch'](function(_0x57ce58){_0x19cbe7[_0xe46d('0x200')]=0x0;logger[_0xe46d('0x63')]('[getContactCampaign2]',_0x57ce58);});}};Dialer['prototype']['handlePredictive']=function(_0x5811ee){if(_0x5811ee['dialLimitQueue']>0x0){var _0x465c30=_0x5811ee[_0xe46d('0x209')]-_0x5811ee[_0xe46d('0x7c')]-_0x5811ee[_0xe46d('0x145')];if(_0x465c30>0x0&&_0x5811ee[_0xe46d('0x200')]==0x0){this[_0xe46d('0x20f')](_0x5811ee);}else{loggerPredictiveCalls[_0xe46d('0x49')](_0xe46d('0x210'));}}else{this['tryOriginatePredictive'](_0x5811ee);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x1fcdbe){var _0x274cfd=this;var _0x3a8fd3=[];_0x1fcdbe[_0xe46d('0x7c')]+=0x1;for(var _0x5d20d5 in this[_0xe46d('0x21')]){if(typeof this[_0xe46d('0x21')][_0x5d20d5]!==_0xe46d('0xab')){if(this['agents'][_0x5d20d5][_0xe46d('0x6a')]===_0xe46d('0x20a')&&this[_0xe46d('0x21')][_0x5d20d5]['status']===_0xe46d('0x88')){_0x3a8fd3['push'](this[_0xe46d('0x21')][_0x5d20d5]['id']);}}}_0x1fcdbe[_0xe46d('0x200')]=0x1;return this[_0xe46d('0x211')](_0x1fcdbe['id'],_0x3a8fd3,0x1,_0x1fcdbe['dialOrderByScheduledAt'],_0x1fcdbe)[_0xe46d('0x3e')](function(_0xe8df80){_0x1fcdbe[_0xe46d('0x200')]=0x1;if(_0xe8df80){if(!utils[_0xe46d('0x20b')](_0xe8df80)){utils[_0xe46d('0x212')](_0x1fcdbe,0x1,0x0);return hopperUtils['countReScheduled'](_0x1fcdbe)[_0xe46d('0x3e')](sendMessageReschedule(_0x1fcdbe))['catch'](loggerCatch(_0xe46d('0x213')));}else{_0x1fcdbe[_0xe46d('0x65')]=utils[_0xe46d('0x66')]['RUNNING'];if(_[_0xe46d('0xf6')](_0xe8df80[0x0])||_['isNil'](_0xe8df80[0x0]['Contact'])||_['isNil'](_0xe8df80[0x0][_0xe46d('0x168')])){_0x274cfd[_0xe46d('0x15d')](_0xe46d('0x206'),_0x1fcdbe,_0xe8df80[0x0]);}else{return hopperUtils[_0xe46d('0x214')](_[_0xe46d('0x71')](_0xe8df80[0x0],['VoiceQueueId',_0xe46d('0x168')]))[_0xe46d('0x3e')](_0x274cfd[_0xe46d('0x1e8')](_0x1fcdbe,_0xe8df80[0x0]))['catch'](function(_0x347902){logger[_0xe46d('0x63')](_0xe46d('0x215'),_0x347902);utils[_0xe46d('0xc2')](_0x1fcdbe,_0xe46d('0x215'));});}}}})[_0xe46d('0x9d')](function(_0x3d2674){_0x1fcdbe[_0xe46d('0x200')]=0x0;logger[_0xe46d('0x63')](_0xe46d('0x216'),_0x3d2674);});};Dialer['prototype']['abandonmentRate']=function(_0x10f227,_0x3dfa32,_0xbe4065,_0x2d998a,_0x4f68ff,_0x214a94){loggerPredictive[_0xe46d('0x49')](_0xe46d('0x217'));loggerPredictive[_0xe46d('0x49')](_0xe46d('0x218'),_0x10f227);loggerPredictive[_0xe46d('0x49')](_0xe46d('0x219'),_0x3dfa32);loggerPredictive[_0xe46d('0x49')]('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',_0xbe4065);loggerPredictive['info'](_0xe46d('0x21a'),_0x2d998a);loggerPredictive[_0xe46d('0x49')](_0xe46d('0x21b'),_0x4f68ff);loggerPredictive[_0xe46d('0x49')](_0xe46d('0x5d'));return new Promise(function(_0x1b2f96,_0x4dcaca){if(_0x10f227<=0x0||isNaN(_0x10f227)){return _0x4dcaca(msgResponse(_0xe46d('0x21c'),_0xe46d('0x82'),'m\x20=\x20'+_0x10f227));}if(_0xbe4065<=0x0||isNaN(_0xbe4065)){return _0x4dcaca(msgResponse(_0xe46d('0x21c'),_0xe46d('0x82'),_0xe46d('0x21d')+_0xbe4065));}if(_0x2d998a<=0x0||isNaN(_0x2d998a)){return _0x4dcaca(msgResponse(_0xe46d('0x21c'),_0xe46d('0x82'),_0xe46d('0x21e')+_0x2d998a));}if(_0x3dfa32<=0x0||isNaN(_0x3dfa32)){return _0x4dcaca(msgResponse('[abandonmentRate]',_0xe46d('0x82'),'interval\x20=\x20'+_0x3dfa32));}if(_0x4f68ff<=0x0||isNaN(_0x4f68ff)){return _0x4dcaca(msgResponse(_0xe46d('0x21c'),_0xe46d('0x82'),'Amax\x20=\x20'+_0x4f68ff));}_0x214a94=_0x214a94||0x0;var _0x3c408a=0x1/_0xbe4065;var _0x57ccfc=0x0;var _0x538561=0x0;var _0x52e221=0x0;var _0x5e55ec=0x0;for(var _0x266ace=0x0;_0x52e221<_0x4f68ff;_0x266ace+=0x1){_0x538561=_0x266ace/_0x3dfa32;_0x57ccfc=(_0x2d998a*_0x538561+_0x214a94)/_0x3c408a;_0x52e221=utils[_0xe46d('0x21f')](_0x57ccfc,_0x10f227);_0x5e55ec=_0x57ccfc/_0x10f227*(0x1-utils[_0xe46d('0x21f')](_0x57ccfc,_0x10f227));}return _0x1b2f96({'erlangCalls':_0x266ace,'erlangCallToSecond':_0x3dfa32/_0x266ace,'erlangAbandonmentRate':_0x52e221,'erlangBusyFactor':_0x5e55ec});});};Dialer['prototype'][_0xe46d('0x1e5')]=function(_0x403545,_0x2952f2,_0x1f2495,_0x48fce9,_0x1b0eaa,_0x12c216){loggerPredictive[_0xe46d('0x49')](_0xe46d('0x220'));loggerPredictive[_0xe46d('0x49')](_0xe46d('0x218'),_0x403545);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2952f2);loggerPredictive[_0xe46d('0x49')](_0xe46d('0x221'),_0x1f2495);loggerPredictive[_0xe46d('0x49')](_0xe46d('0x21a'),_0x48fce9);loggerPredictive['info'](_0xe46d('0x222'),_0x1b0eaa);loggerPredictive[_0xe46d('0x49')]('---------------------------');return new Promise(function(_0x13902d,_0x22aca5){if(_0x403545<=0x0||isNaN(_0x403545)){return _0x22aca5(msgResponse(_0xe46d('0x223'),_0xe46d('0x82'),_0xe46d('0x224')+_0x403545));}if(_0x1f2495<=0x0||isNaN(_0x1f2495)){return _0x22aca5(msgResponse('[busyFactor]',_0xe46d('0x82'),_0xe46d('0x21d')+_0x1f2495));}if(_0x48fce9<=0x0||isNaN(_0x48fce9)){return _0x22aca5(msgResponse('[busyFactor]','Error','p\x20=\x20'+_0x48fce9));}if(_0x2952f2<=0x0||isNaN(_0x2952f2)){return _0x22aca5(msgResponse(_0xe46d('0x223'),_0xe46d('0x82'),_0xe46d('0x225')+_0x2952f2));}if(_0x1b0eaa<=0x0||isNaN(_0x1b0eaa)){return _0x22aca5(msgResponse(_0xe46d('0x223'),_0xe46d('0x82'),_0xe46d('0x226')+_0x1b0eaa));}_0x12c216=_0x12c216||0x0;var _0x459175=0x1/_0x1f2495;var _0x199cc0=0x0;var _0x4544fd=0x0;var _0xe7dee=0x0;var _0x2d8592=0x0;for(var _0x213d58=0x0;_0x2d8592<_0x1b0eaa;_0x213d58+=0x1){_0x4544fd=_0x213d58/_0x2952f2;_0x199cc0=(_0x48fce9*_0x4544fd+_0x12c216)/_0x459175;_0xe7dee=utils[_0xe46d('0x21f')](_0x199cc0,_0x403545);_0x2d8592=_0x199cc0/_0x403545*(0x1-utils['erlangb'](_0x199cc0,_0x403545));}return _0x13902d({'erlangCalls':_0x213d58,'erlangCallToSecond':_0x2952f2/_0x213d58,'erlangAbandonmentRate':_0xe7dee,'erlangBusyFactor':_0x2d8592});});};module[_0xe46d('0x227')]=Dialer; \ No newline at end of file +var _0x6550=['XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','callerid','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','outboundOriginateFailureCallsDay','OriginateError','Error','originate\x20action\x20Error','dialNoAnswerMaxRetry','dialBusyMaxRetry','dialCongestionMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','createStateFinal','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','dialAbandonedMaxRetry','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','dialAgentRejectRetryFrequency','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','erlangCalls','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','dialPredictiveInterval','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','available','predictiveIntervalAnsweredCalls','dropRate','dialPredictiveOptimizationPercentage','abandonmentRate','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','agentBusyFactor','busyFactor','[CatchErlangB]','[handlePredictive]','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','checkIsBlackListIvr','[actionOriginateIvr]','[handleIvr]','dialLimitQueue','push','getContactDialer','countReScheduled','[countReScheduled]\x20','ACTIVE','[actionOriginate]\x20','checkIsBlackList','[actionOriginate]','[getContactCampaign2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','dialOrderByScheduledAt','checkContactLowerLimitOriginate','[actionOriginatePredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','lodash','moment','ioredis','./utils','./utils/hopper','../../../config/environment/','../../../config/logger','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/final','./models/agentComplete','./models/hangup','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','syncAgentComplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','varset','queuemember','syncQueueMember','syncQueueStatusComplete','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','emit','type','debug','inspect','format','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalTotalCalls','predictiveIntervalAvgTalktime','predictiveIntervalAvgHoldtime','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','erlangCallToSecond','erlangAbandonmentRate','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','merge','startProgressive','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','statedesc','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','Interval','\x20INTERVAL_IS_NULL','Intervals','NULL_INTERVAL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20deactivated','[ifTime][Action]','stringify','prototype','active','SIP/%s','status','reachable','unmonitored','isTrunkReachable','Trunk','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','iftime\x20%s,%s','indexOf','true','catch','command','all','some','OVERTIME_GLOBAL_INTERVAL','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','launchHandleIvr','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','booked','Queue','method\x20not\x20recognized','silly','intervalIftime','OVERTIME_INTERVAL','[ifTime][promiseAll]','isGlobal','syncAgentConnect','queue','uniqueid','decrementOriginate','[syncAgentConnect]','answertime','YYYY-MM-DD\x20HH:mm:ss','ivr','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','[syncQueueCallerAbandon]','droptime','getSeconds','responsetime','outboundDropCallsDayTimeout','state','Drop','dropreason','TIMEOUT','countdropretry','countglobal','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','dialDropRetryFrequency','minutes','ListId','VoiceQueueId','CampaignId','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','verifyAdditionalPhones','ContactId','endtime','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','[syncOriginateResponse]','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','exten','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD]','value','MACHINE','Machine','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncVarSet]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','outboundAnswerCallsDay','[syncAgentComplete][createHistory][0]','dialGlobalMaxRetry','stateGlobal','[syncHangup]','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangup2]','outboundUnknownCallsDay','Unknown','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','inUse','talking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','map','Agent','user:%s','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','Action','[clearZombieChannels]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','notFound','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','user:dialPreviewRecallReminder','handleIvr','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords'];(function(_0x7f8273,_0x328b5f){var _0x12ad7d=function(_0x3c7769){while(--_0x3c7769){_0x7f8273['push'](_0x7f8273['shift']());}};_0x12ad7d(++_0x328b5f);}(_0x6550,0xb4));var _0x0655=function(_0x9f0afb,_0x10a347){_0x9f0afb=_0x9f0afb-0x0;var _0x509a49=_0x6550[_0x9f0afb];return _0x509a49;};'use strict';var util=require('util');var _=require(_0x0655('0x0'));var uuid=require('uuid');var moment=require(_0x0655('0x1'));var rr=require('rr');var Redis=require(_0x0655('0x2'));var utils=require(_0x0655('0x3'));var hopperUtils=require(_0x0655('0x4'));var ut=require('../preview/util/util');var config=require(_0x0655('0x5'));var logger=require(_0x0655('0x6'))('dialer');var loggerBooked=require(_0x0655('0x6'))('booked');var loggerPredictive=require(_0x0655('0x6'))(_0x0655('0x7'));var loggerPredictiveCalls=require(_0x0655('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x0655('0x6'))(_0x0655('0x8'));var ami=require(_0x0655('0x9'));config[_0x0655('0xa')]=_[_0x0655('0xb')](config[_0x0655('0xa')],{'host':_0x0655('0xc'),'port':0x18eb});var io=require(_0x0655('0xd'))(new Redis(config[_0x0655('0xa')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x0655('0xe'));var RpcSetting=require(_0x0655('0xf'));var Interval=require(_0x0655('0x10'));var Action=require('./models/action');var History=require(_0x0655('0x11'));var Final=require(_0x0655('0x12'));var AgentComplete=require(_0x0655('0x13'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x0655('0x14'));var ipAgi=process['env'][_0x0655('0x15')]||_0x0655('0x16');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x0655('0x17')]=function(_0x422004){this[_0x0655('0x18')]=this['tail']?this[_0x0655('0x18')][_0x0655('0x19')](_0x422004):_0x422004();};function Dialer(_0x2a2703,_0xc88f69){this[_0x0655('0x1a')]=new Sequence();this[_0x0655('0x1b')]=_0xc88f69;this['voiceQueues']=_0x2a2703[_0x0655('0x1c')];this[_0x0655('0x1d')]=_0x2a2703[_0x0655('0x1d')];this[_0x0655('0x1e')]=_0x2a2703[_0x0655('0x1e')];this[_0x0655('0x1f')]=_0x2a2703[_0x0655('0x1f')];this['maxNumberOriginate']=config[_0x0655('0x20')]||0x2;this[_0x0655('0x21')]={};this[_0x0655('0x22')]={};this['contactsId']={};this[_0x0655('0x23')]={};this[_0x0655('0x24')]={};this[_0x0655('0x25')]={};this['startProgressive']={};this[_0x0655('0x26')]={};this[_0x0655('0x27')]={};this[_0x0655('0x28')]={};this[_0x0655('0x29')]={};ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on'](_0x0655('0x2a'),this[_0x0655('0x2b')][_0x0655('0x2c')](this));ami['on'](_0x0655('0x2d'),this[_0x0655('0x2e')][_0x0655('0x2c')](this));ami['on']('agentcomplete',this[_0x0655('0x2f')][_0x0655('0x2c')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x0655('0x2c')](this));ami['on']('custom:queuesummarycomplete',this[_0x0655('0x30')]['bind'](this));ami['on'](_0x0655('0x31'),this[_0x0655('0x32')]['bind'](this));ami['on'](_0x0655('0x33'),this['syncNewExten'][_0x0655('0x2c')](this));ami['on'](_0x0655('0x34'),this['syncVarSet']['bind'](this));ami['on'](_0x0655('0x35'),this[_0x0655('0x36')][_0x0655('0x2c')](this));ami['on']('queuestatuscomplete',this[_0x0655('0x37')]['bind'](this));this['loopCampaigns']();this[_0x0655('0x38')]();RpcSetting['getSettings']()[_0x0655('0x39')](function(_0x25c933){previewRecallmeReminderInterval=_0x25c933[_0x0655('0x3a')];});}function isNotNull(_0x1cc56f){return _0x1cc56f!==null&&!_[_0x0655('0x3b')](_0x1cc56f);}function msgResponse(_0x31b490,_0x585344,_0x3dcbed){return{'action':_0x31b490,'response':_0x585344,'message':_0x3dcbed,'stack':_0x3dcbed};}function emit(_0x16a987,_0x41c373,_0x6dd107){io['to'](_0x16a987)[_0x0655('0x3c')](_0x41c373,_0x6dd107);}function emitOutboundVoiceQueueSummary(_0x4148c7){if(_0x4148c7[_0x0655('0x3d')]==='outbound'){logger[_0x0655('0x3e')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x0655('0x3f')](_0x4148c7,{'showHidden':![],'depth':null}));emit(util[_0x0655('0x40')]('voice:queue:%s',_0x4148c7['name']),'voice_queue:save',_0x4148c7);}}function checkGetDataPredictive(_0xa2eb7d){if(isNotNull(_0xa2eb7d)&&!_[_0x0655('0x41')](_0xa2eb7d)){loggerPredictive[_0x0655('0x42')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x0655('0x42')](_0x0655('0x43'),_0xa2eb7d['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0x0655('0x44'),_0xa2eb7d['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x0655('0x45'),_0xa2eb7d[_0x0655('0x46')]);loggerPredictive[_0x0655('0x42')](_0x0655('0x47'),_0xa2eb7d[_0x0655('0x48')]);loggerPredictive['info'](_0x0655('0x49'),_0xa2eb7d['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x0655('0x42')](_0x0655('0x4a'),_0xa2eb7d['predictiveIntervalAvgTalktime']);loggerPredictive['info'](_0x0655('0x4b'));if(_0xa2eb7d[_0x0655('0x4c')]>0x0){if(!_[_0x0655('0x3b')](_0xa2eb7d[_0x0655('0x4d')])&&_0xa2eb7d[_0x0655('0x4d')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0xa2eb7d[_0x0655('0x4e')])&&_0xa2eb7d[_0x0655('0x4e')]>0x0){return!![];}loggerPredictive['info'](_0x0655('0x4f'));}else{loggerPredictive[_0x0655('0x42')](_0x0655('0x50'));}}else{loggerPredictive[_0x0655('0x42')](_0x0655('0x51'));}return![];}function mergeDataErlangB(_0x40ce72){return function(_0x7cccda){loggerPredictive['info'](_0x0655('0x52'));loggerPredictive[_0x0655('0x42')](_0x0655('0x53'),_0x7cccda['erlangCalls']);loggerPredictive[_0x0655('0x42')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x7cccda[_0x0655('0x54')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x7cccda[_0x0655('0x55')]);loggerPredictive[_0x0655('0x42')](_0x0655('0x56'),_0x7cccda[_0x0655('0x57')]);loggerPredictive[_0x0655('0x42')](_0x0655('0x58'),_0x7cccda[_0x0655('0x55')]);loggerPredictive[_0x0655('0x42')]('---------------------------');_[_0x0655('0x59')](_0x40ce72,_0x7cccda);};}function ifInterval(_0x4fb2fc,_0x18fdc6){if(_[_0x0655('0x3b')](_0x18fdc6)){return![];}return utils['getSeconds'](undefined,_0x18fdc6)<_0x4fb2fc*0x3c;}function clearPredictiveAttributes(_0x23568b){if(_0x23568b[_0x0655('0x5a')]){_0x23568b['startProgressive']=undefined;loggerPredictive['debug'](_0x23568b[_0x0655('0x5b')],_0x0655('0x5c'));}if(_0x23568b[_0x0655('0x25')]){_0x23568b[_0x0655('0x25')]=undefined;loggerPredictive[_0x0655('0x3e')](_0x23568b[_0x0655('0x5b')],_0x0655('0x5d'));}if(_0x23568b[_0x0655('0x5e')]){clearInterval(_0x23568b[_0x0655('0x5e')]);_0x23568b[_0x0655('0x5e')]=undefined;loggerPredictive[_0x0655('0x3e')](_0x23568b[_0x0655('0x5b')],_0x0655('0x5f'));}}function loggerCatchPredictive(_0x14500a,_0x29b651){return function(_0x3465e9){loggerPredictive[_0x0655('0x60')](_0x29b651[_0x0655('0x5b')],_0x14500a);loggerPredictive['error'](_0x3465e9[_0x0655('0x61')]);clearPredictiveAttributes(_0x29b651);};}function loggerCatch(_0x1d163a){return function(_0x2329d9){logger[_0x0655('0x60')](_0x1d163a,util['inspect'](_0x2329d9,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x35237c){return function(_0x419cbf){if(isNotNull(_0x419cbf)&&isNotNull(_0x419cbf[0x0])){if(_0x419cbf[0x0][_0x0655('0x62')]>0x0){_0x35237c[_0x0655('0x63')]=utils[_0x0655('0x64')][_0x0655('0x65')];logger[_0x0655('0x42')](_0x0655('0x66')+_0x35237c[_0x0655('0x5b')],_0x419cbf[0x0][_0x0655('0x62')],_0x0655('0x67'));}else{_0x35237c[_0x0655('0x63')]=utils[_0x0655('0x64')][_0x0655('0x68')];logger[_0x0655('0x42')](_0x0655('0x69')+_0x35237c[_0x0655('0x5b')]);}}};}function createObjHistory(_0x36554c,_0xb232c7,_0x1aef3e,_0x11781d,_0x1b0b04){_0x36554c[_0x0655('0x63')]=_0x1aef3e;var _0x36434a=new Action(_0x36554c,_0xb232c7);var _0x28abb2=new History(_0x36434a);_0x28abb2['state']=_0x11781d;_0x28abb2[_0x0655('0x6a')]=_0x1b0b04;_0x28abb2['endtime']=_0x36434a[_0x0655('0x6b')];return _0x28abb2;}function unlockQueueStatus(_0x5c1bc3,_0x16955d){setTimeout(function(){if(_[_0x0655('0x3b')](_0x5c1bc3[_0x0655('0x6c')])){loggerBooked[_0x0655('0x60')](_0x0655('0x6d'),_0x16955d);}_0x5c1bc3['queueStatusComplete']=!![];loggerBooked[_0x0655('0x42')](_0x0655('0x6e'),_0x16955d,JSON['stringify'](_[_0x0655('0x6f')](_0x5c1bc3,[_0x0655('0x5b'),_0x0655('0x6c')])));},0x1f3);}function checkInterval(_0x5e9671){return function(){if(!isNotNull(_0x5e9671[_0x0655('0x70')])){_0x5e9671[_0x0655('0x63')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x5e9671[_0x0655('0x5b')]+_0x0655('0x71');}if(!isNotNull(_0x5e9671[_0x0655('0x70')][_0x0655('0x72')])){_0x5e9671[_0x0655('0x63')]=utils['CAMPAIGN_STATUS'][_0x0655('0x73')];throw _0x5e9671['name']+_0x0655('0x71');}if(!isNotNull(_[_0x0655('0x41')](_0x5e9671[_0x0655('0x70')][_0x0655('0x72')]))){_0x5e9671[_0x0655('0x63')]=utils[_0x0655('0x64')][_0x0655('0x73')];throw _0x5e9671['name']+_0x0655('0x71');}};}function checkIsIVRCampaignActive(_0x58f7e7){return function(){if(!utils[_0x0655('0x74')](_0x58f7e7)){_0x58f7e7[_0x0655('0x63')]=utils[_0x0655('0x64')][_0x0655('0x75')];throw _0x58f7e7['name']+_0x0655('0x76');}};}function emitCampaignSummary(_0x1245c4){if(utils[_0x0655('0x77')](_0x1245c4)){emit(util[_0x0655('0x40')](_0x0655('0x78'),_0x1245c4['name']),_0x0655('0x79'),_0x1245c4);}}function loggerCatchQueueSummary(_0x234954,_0x8a7db8){return function(_0x297d00){clearPredictiveAttributes(_0x8a7db8);emitCampaignSummary(_0x8a7db8);loggerSyncQueueSummary[_0x0655('0x3e')](_0x234954,util[_0x0655('0x3f')](_0x297d00,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x345287){if(_0x345287[_0x0655('0x7a')]){if(_0x345287[_0x0655('0x7b')]===0x0){_0x345287[_0x0655('0x7a')]=![];_0x345287['message']=utils[_0x0655('0x64')]['INACTIVE'];loggerSyncQueueSummary[_0x0655('0x3e')](_0x0655('0x7c'),_0x345287[_0x0655('0x5b')],_0x0655('0x7d'));}else{_0x345287[_0x0655('0x63')]=utils[_0x0655('0x64')]['DISACTIVED'];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x345287['name'],_0x0655('0x7e'));}emitCampaignSummary(_0x345287);}}function myreject(_0x487198){return function(_0x4143af){return _0x487198(msgResponse(_0x0655('0x7f'),'Error',JSON[_0x0655('0x80')](_0x4143af)));};}Dialer[_0x0655('0x81')]['isTrunkReachable']=function(_0x365a8d){return!_['isUndefined'](_0x365a8d)&&_0x365a8d&&!_[_0x0655('0x3b')](_0x365a8d[_0x0655('0x5b')])&&!_[_0x0655('0x3b')](_0x365a8d[_0x0655('0x82')])&&_0x365a8d[_0x0655('0x82')]&&(this[_0x0655('0x1f')][util[_0x0655('0x40')](_0x0655('0x83'),_0x365a8d['name'])][_0x0655('0x84')]===_0x0655('0x85')||this[_0x0655('0x1f')][util[_0x0655('0x40')](_0x0655('0x83'),_0x365a8d[_0x0655('0x5b')])][_0x0655('0x84')]===_0x0655('0x86'));};Dialer[_0x0655('0x81')]['checkIsTrunkReachable']=function(_0x84892f){var _0x1c119b=this;return function(){if(!_0x1c119b[_0x0655('0x87')](_0x84892f[_0x0655('0x88')])){if(!_0x1c119b[_0x0655('0x87')](_0x84892f['TrunkBackup'])){_0x84892f['message']=utils['CAMPAIGN_STATUS']['TRUNK_NOT_REACHABLE'];throw _0x84892f[_0x0655('0x5b')]+_0x0655('0x89');}}};};Dialer[_0x0655('0x81')][_0x0655('0x8a')]=function(_0x5361bc,_0x1f89fa,_0x253f0c,_0x271a32){var _0x5a7dc6=this;return function(){var _0x471897=!![];return _0x5a7dc6['ifTimeIvr'](_0x5361bc,_0x1f89fa,_0x253f0c,_0x271a32,_0x471897);};};Dialer['prototype'][_0x0655('0x8b')]=function(_0x45f1b8,_0x4b57cd,_0x408dd4,_0xd5e67d){var _0x19ddb5=this;return function(){var _0xde0de1=![];return _0x19ddb5[_0x0655('0x8c')](_0x45f1b8[_0x0655('0x72')],_0x4b57cd,_0x408dd4,_0xd5e67d,_0xde0de1);};};Dialer[_0x0655('0x81')][_0x0655('0x8c')]=function(_0x3f82a7,_0x1fa42b,_0x38121b,_0x1724f2,_0x448569){var _0x18acc4=[];return new Promise(function(_0x113aeb,_0x44b3c0){if(!isNotNull(_0x3f82a7)){_0x1724f2[_0x0655('0x63')]=utils[_0x0655('0x64')][_0x0655('0x73')];return _0x44b3c0(msgResponse(_0x0655('0x8d'),_0x0655('0x8e'),_0x38121b+_0x0655('0x8f')));}if(_[_0x0655('0x41')](_0x3f82a7)){_0x1724f2['message']=utils[_0x0655('0x64')][_0x0655('0x90')];return _0x44b3c0(msgResponse(_0x0655('0x8d'),'Failure',_0x38121b+_0x0655('0x91')));}if(_0x1fa42b&&_['isUndefined'](config[_0x0655('0x92')][_0x1fa42b])){_0x1724f2[_0x0655('0x63')]=utils[_0x0655('0x64')][_0x0655('0x93')];return _0x44b3c0(msgResponse('ifTime',_0x0655('0x8e'),_0x38121b+_0x0655('0x94')+_0x1fa42b));}if(_['isArray'](_0x3f82a7)){for(var _0x448fa3=0x0;_0x448fa3<_0x3f82a7['length'];_0x448fa3+=0x1){_0x18acc4['push'](ami['Action']({'action':'command','command':util[_0x0655('0x40')](_0x0655('0x95'),_0x3f82a7[_0x448fa3]['interval'],!_[_0x0655('0x3b')](config[_0x0655('0x92')][_0x1fa42b])?_0x1fa42b:'')})[_0x0655('0x39')](function(_0x293646){return _0x293646['content'][_0x0655('0x96')](_0x0655('0x97'))>=0x0;})[_0x0655('0x98')](myreject(_0x44b3c0)));}}else{_0x18acc4['push'](ami['Action']({'action':_0x0655('0x99'),'command':util[_0x0655('0x40')](_0x0655('0x95'),_0x3f82a7,!_[_0x0655('0x3b')](config[_0x0655('0x92')][_0x1fa42b])?_0x1fa42b:'')})['then'](function(_0x2de8dd){return _0x2de8dd['content'][_0x0655('0x96')](_0x0655('0x97'))>=0x0;})['catch'](myreject(_0x44b3c0)));}Promise[_0x0655('0x9a')](_0x18acc4)[_0x0655('0x39')](function(_0x14caf9){var _0x31fb52=_[_0x0655('0x9b')](_0x14caf9);if(_0x31fb52){return _0x113aeb(_0x31fb52);}else{_0x1724f2[_0x0655('0x63')]=_0x448569?utils[_0x0655('0x64')][_0x0655('0x9c')]:utils[_0x0655('0x64')]['OVERTIME_INTERVAL'];return _0x44b3c0(msgResponse('[ifTime][promiseAll]',_0x0655('0x8e'),_0x0655('0x9d')+_0x448569+'\x20'+_0x38121b+_0x0655('0x9e')+util[_0x0655('0x3f')](_0x3f82a7,{'showHidden':![],'depth':null})+_0x0655('0x9f')+_0x1fa42b));}})[_0x0655('0x98')](function(_0x130604){return _0x44b3c0(msgResponse(_0x0655('0x8d'),'Failure',JSON[_0x0655('0x80')](_0x130604)));});});};Dialer[_0x0655('0x81')]['loopCampaigns']=function(){var _0x3658a0=this;return cmHopper[_0x0655('0xa0')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x3658a0[_0x0655('0xa1')]();},0x3e8);});};Dialer['prototype'][_0x0655('0xa1')]=function(){var _0x76382f=this;var _0x32777c;for(var _0x5a6972 in this[_0x0655('0x1d')]){if(typeof this['campaigns'][_0x5a6972]!==_0x0655('0xa2')){_0x32777c=this[_0x0655('0x1d')][_0x5a6972];if(utils[_0x0655('0x77')](_0x32777c)&&utils['isIVRCampaignActive'](_0x32777c)){_0x32777c[_0x0655('0x7a')]=!![];Promise[_0x0655('0xa3')]()[_0x0655('0x39')](checkIsIVRCampaignActive(_0x32777c))[_0x0655('0x39')](checkInterval(_0x32777c))[_0x0655('0x39')](_0x76382f[_0x0655('0xa4')](_0x32777c))[_0x0655('0x39')](_0x76382f[_0x0655('0x8a')](_0x32777c[_0x0655('0xa5')],_0x32777c['dialTimezone'],_0x32777c[_0x0655('0x5b')],_0x32777c))['then'](_0x76382f[_0x0655('0x8b')](_0x32777c['Interval'],_0x32777c[_0x0655('0xa6')],_0x32777c[_0x0655('0x5b')],_0x32777c))[_0x0655('0x39')](_0x76382f[_0x0655('0xa7')](_0x32777c))[_0x0655('0x98')](loggerCatchQueueSummary('[syncCampaigns]',_0x32777c));}else{notSendMessagesCampaign(_0x32777c);}}}};Dialer['prototype'][_0x0655('0xa8')]=function(_0x5a5797){if(_0x5a5797[_0x0655('0xa9')]!=='predictive'){clearPredictiveAttributes(_0x5a5797);}switch(_0x5a5797[_0x0655('0xa9')]){case _0x0655('0xaa'):this['handlePower'](_0x5a5797,0x1);break;case _0x0655('0xab'):this[_0x0655('0xac')](_0x5a5797,_0x5a5797[_0x0655('0xad')]);break;case _0x0655('0x7'):this['predictive'](_0x5a5797);break;case _0x0655('0xae'):this[_0x0655('0xac')](_0x5a5797,0x1);break;default:logger[_0x0655('0x60')](_0x0655('0xaf'),_0x5a5797[_0x0655('0x5b')],_0x0655('0xb0'));}};Dialer['prototype']['ifTime']=function(_0x247dcc,_0x51f925){var _0x1480b5=_0x247dcc['dialTimezone'];var _0x3d1012=_0x51f925?_0x247dcc[_0x0655('0xa5')]:_0x247dcc[_0x0655('0x70')][_0x0655('0x72')];logger[_0x0655('0xb1')]('Dialer::ifTime()',_0x3d1012,_0x1480b5,_0x247dcc[_0x0655('0x5b')],util['format']('Voice\x20Queue\x20%s\x20$s',_0x247dcc[_0x0655('0x5b')],_0x247dcc['id']));var _0x52c2f6=null;return Interval[_0x0655('0xb2')](_0x3d1012,_0x1480b5)[_0x0655('0x39')](function(_0x323b0c){if(_0x323b0c===!![]){return _0x323b0c;}else{_0x247dcc['message']=_0x51f925?utils['CAMPAIGN_STATUS'][_0x0655('0x9c')]:utils[_0x0655('0x64')][_0x0655('0xb3')];_0x52c2f6=msgResponse(_0x0655('0xb4'),_0x0655('0x8e'),_0x0655('0x9d')+_0x51f925+'\x20'+_0x247dcc['name']+_0x0655('0x9e')+util[_0x0655('0x3f')](_0x3d1012,{'showHidden':![],'depth':null})+_0x0655('0x9f')+_0x1480b5);}if(_0x52c2f6!==null){logger['silly']('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x52c2f6);_0x52c2f6[_0x0655('0xb5')]=_0x51f925;throw _0x52c2f6;}})[_0x0655('0x98')](function(_0x25060a){logger[_0x0655('0x60')]('AMI\x20IfTime',_0x25060a);throw msgResponse(_0x0655('0x7f'),'Error',util['inspect'](_0x25060a,{'showHidden':![],'depth':null}));});};Dialer[_0x0655('0x81')][_0x0655('0xb6')]=function(_0x28a7da){if(this[_0x0655('0x1c')][_0x28a7da[_0x0655('0xb7')]]){if(this[_0x0655('0x23')][_0x28a7da[_0x0655('0xb8')]]&&this['uniqueId'][_0x28a7da['uniqueid']]['type']!=='ivr'){utils[_0x0655('0xb9')](this[_0x0655('0x1c')][_0x28a7da[_0x0655('0xb7')]],_0x0655('0xba'));this[_0x0655('0x23')][_0x28a7da['uniqueid']][_0x0655('0xbb')]=moment()[_0x0655('0x40')](_0x0655('0xbc'));}}};Dialer['prototype'][_0x0655('0x2f')]=function(_0x3c788e){var _0x671248=this['uniqueId'][_0x3c788e[_0x0655('0xb8')]];if(this[_0x0655('0x1c')][_0x3c788e[_0x0655('0xb7')]]){if(_0x671248&&_0x671248[_0x0655('0x3d')]!==_0x0655('0xbd')){delete this[_0x0655('0x23')][_0x3c788e[_0x0655('0xb8')]];this[_0x0655('0x1c')][_0x3c788e['queue']]['outboundAnswerCallsDay']+=0x1;var _0x2eac7e=new AgentComplete(_0x671248,_0x3c788e);if(_0x3c788e[_0x0655('0xbe')]===_0x0655('0xbf')){_0x2eac7e['agiafterat']=this[_0x0655('0x1c')][_0x3c788e[_0x0655('0xb7')]][_0x0655('0xc0')]&&this[_0x0655('0x1c')][_0x3c788e[_0x0655('0xb7')]][_0x0655('0xc1')]?moment()[_0x0655('0x40')](_0x0655('0xbc')):undefined;}hopperUtils[_0x0655('0xc2')](_0x2eac7e)[_0x0655('0x98')](loggerCatch(_0x0655('0xc3')));hopperUtils[_0x0655('0xc4')](_0x2eac7e)[_0x0655('0x98')](loggerCatch(_0x0655('0xc5')));}}};Dialer['prototype'][_0x0655('0x2b')]=function(_0x1cf05e){var _0x5b0899=this[_0x0655('0x23')][_0x1cf05e[_0x0655('0xb8')]];var _0x5504f0=this;var _0x406179=![];var _0x5b8b5a;var _0x4f01c9;if(this[_0x0655('0x1c')][_0x1cf05e['queue']]){if(_0x5b0899&&_0x5b0899[_0x0655('0x3d')]!==_0x0655('0xbd')){delete this[_0x0655('0x23')][_0x1cf05e[_0x0655('0xb8')]];utils[_0x0655('0xb9')](this[_0x0655('0x1c')][_0x1cf05e[_0x0655('0xb7')]],_0x0655('0xc6'));_0x5b0899[_0x0655('0xc7')]=moment()[_0x0655('0x40')](_0x0655('0xbc'));var _0x45bd8b=new QueueCallerAbandon(_0x5b0899,_0x1cf05e);if(utils[_0x0655('0xc8')](_0x5b0899[_0x0655('0xc7')],_0x5b0899[_0x0655('0xc9')])>=_0x5b0899['dialQueueTimeout']){this['voiceQueues'][_0x1cf05e['queue']][_0x0655('0x46')]+=0x1;this[_0x0655('0x1c')][_0x1cf05e[_0x0655('0xb7')]][_0x0655('0xca')]+=0x1;this[_0x0655('0x1c')][_0x1cf05e[_0x0655('0xb7')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x45bd8b[_0x0655('0xcb')]=0xa;_0x45bd8b[_0x0655('0x6a')]=_0x0655('0xcc');_0x45bd8b[_0x0655('0xcd')]=_0x0655('0xce');_0x45bd8b['agiafterat']=this[_0x0655('0x1c')][_0x1cf05e[_0x0655('0xb7')]]['dialQueueProject2']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x45bd8b[_0x0655('0xcf')]+=0x1;_0x45bd8b[_0x0655('0xd0')]+=0x1;_0x5b8b5a=this['voiceQueues'][_0x1cf05e[_0x0655('0xb7')]]['dialDropRetryFrequency'];_0x4f01c9=this[_0x0655('0x1c')][_0x1cf05e['queue']][_0x0655('0xd1')];hopperUtils['verifyAdditionalPhones'](_0x45bd8b,_0x45bd8b[_0x0655('0xcb')],_0x5b0899[_0x0655('0xd2')])['then'](function(_0x48c377){_0x406179=_0x48c377[_0x0655('0xd3')]==0x1;if(_0x45bd8b[_0x0655('0xcf')]>=_0x5504f0['voiceQueues'][_0x1cf05e[_0x0655('0xb7')]][_0x0655('0xd4')]){_0x5504f0[_0x0655('0xd5')](_0x45bd8b,_0x48c377[_0x0655('0xd3')]);}else{hopperUtils[_0x0655('0xd6')]({'active':![],'countdropretry':_0x45bd8b[_0x0655('0xcf')],'scheduledat':moment()[_0x0655('0xd7')](_0x5504f0[_0x0655('0x1c')][_0x1cf05e[_0x0655('0xb7')]][_0x0655('0xd8')],_0x0655('0xd9'))[_0x0655('0x40')](_0x0655('0xbc')),'ContactId':_0x5b0899['ContactId'],'ListId':_0x5b0899[_0x0655('0xda')],'VoiceQueueId':_0x5b0899[_0x0655('0xdb')]||undefined,'CampaignId':_0x5b0899[_0x0655('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x2aa0d5=new History(_0x45bd8b);_0x2aa0d5[_0x0655('0xcb')]=0xa;_0x2aa0d5['statedesc']='Drop';_0x2aa0d5[_0x0655('0x6b')]=moment()[_0x0655('0x40')]('YYYY-MM-DD\x20HH:mm:ss');_0x2aa0d5['endtime']=_0x2aa0d5['starttime'];_0x2aa0d5[_0x0655('0xdd')]=_0x45bd8b['calleridname'];_0x2aa0d5[_0x0655('0xde')]=_0x45bd8b[_0x0655('0xde')];hopperUtils['createHistory'](_0x2aa0d5)[_0x0655('0x98')](loggerCatch(_0x0655('0xdf')));}})['then'](function(){if(_0x406179)hopperUtils[_0x0655('0xe0')](_0x45bd8b,_0x5b8b5a,_0x4f01c9)[_0x0655('0x39')](function(){return 0x1;});});}else{this[_0x0655('0x1c')][_0x1cf05e[_0x0655('0xb7')]][_0x0655('0x48')]+=0x1;this[_0x0655('0x1c')][_0x1cf05e[_0x0655('0xb7')]][_0x0655('0xe1')]+=0x1;_0x45bd8b[_0x0655('0xcb')]=0xb;_0x45bd8b[_0x0655('0x6a')]=_0x0655('0xe2');_0x45bd8b[_0x0655('0xcd')]=_0x0655('0xe3');_0x45bd8b[_0x0655('0xe4')]+=0x1;_0x45bd8b[_0x0655('0xd0')]+=0x1;_0x5b8b5a=this['voiceQueues'][_0x1cf05e[_0x0655('0xb7')]][_0x0655('0xe5')];_0x4f01c9=this[_0x0655('0x1c')][_0x1cf05e[_0x0655('0xb7')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x0655('0xe6')](_0x45bd8b,_0x45bd8b[_0x0655('0xcb')],_0x5b0899[_0x0655('0xd2')])[_0x0655('0x39')](function(_0x4eb820){if(_0x45bd8b['countabandonedretry']>=_0x5504f0[_0x0655('0x1c')][_0x1cf05e[_0x0655('0xb7')]]['dialAbandonedMaxRetry']){_0x5504f0['queueCallerAbandonCreateState'](_0x45bd8b,_0x4eb820[_0x0655('0xd3')]);}else{hopperUtils[_0x0655('0xd6')]({'active':![],'countabandonedretry':_0x45bd8b['countabandonedretry'],'scheduledat':moment()['add'](_0x5504f0['voiceQueues'][_0x1cf05e[_0x0655('0xb7')]]['dialAbandonedRetryFrequency'],_0x0655('0xd9'))['format'](_0x0655('0xbc')),'ContactId':_0x5b0899[_0x0655('0xe7')],'ListId':_0x5b0899[_0x0655('0xda')],'VoiceQueueId':_0x5b0899[_0x0655('0xdb')]||undefined,'CampaignId':_0x5b0899['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x257fb6=new History(_0x45bd8b);_0x257fb6[_0x0655('0xcb')]=0xb;_0x257fb6[_0x0655('0x6a')]=_0x0655('0xe2');_0x257fb6[_0x0655('0x6b')]=moment()[_0x0655('0x40')](_0x0655('0xbc'));_0x257fb6[_0x0655('0xe8')]=_0x257fb6[_0x0655('0x6b')];_0x257fb6['calleridname']=_0x45bd8b[_0x0655('0xdd')];_0x257fb6['calleridnum']=_0x45bd8b[_0x0655('0xde')];hopperUtils[_0x0655('0xc2')](_0x257fb6)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x0655('0x39')](function(){if(_0x406179)hopperUtils[_0x0655('0xe0')](_0x45bd8b,_0x5b8b5a,_0x4f01c9)[_0x0655('0x39')](function(){return 0x1;});});}}}};Dialer[_0x0655('0x81')]['syncNewExten']=function(_0xe73486){if(this['actions'][_0xe73486[_0x0655('0xb8')]]){this[_0x0655('0x22')][_0xe73486[_0x0655('0xb8')]][_0x0655('0xe9')]=_0xe73486[_0x0655('0xe9')];}if(this[_0x0655('0x23')][_0xe73486[_0x0655('0xb8')]]){this[_0x0655('0x23')][_0xe73486['uniqueid']]['channel']=_0xe73486[_0x0655('0xe9')];}};Dialer[_0x0655('0x81')][_0x0655('0x36')]=function(_0x56e993){if(!this[_0x0655('0x22')][_0x56e993['actionid']]){return;}var _0x21f55c=this[_0x0655('0x1c')][this['actions'][_0x56e993[_0x0655('0xea')]][_0x0655('0xb7')]][_0x0655('0xeb')]||_0x0655('0xec');if(_0x21f55c===_0x0655('0xed')){if(this[_0x0655('0x22')][_0x56e993['actionid']]&&_[_0x0655('0xee')](this[_0x0655('0x22')][_0x56e993[_0x0655('0xea')]][_0x0655('0xef')])&&_0x56e993[_0x0655('0x84')]==='1'&&_0x56e993[_0x0655('0xf0')]==='0'){if(this[_0x0655('0x1e')][_0x56e993['stateinterface']]){if(!this[_0x0655('0x1e')][_0x56e993[_0x0655('0xf1')]]['locked']){this[_0x0655('0x1e')][_0x56e993[_0x0655('0xf1')]][_0x0655('0xef')]=!![];this[_0x0655('0x22')][_0x56e993['actionid']][_0x0655('0xef')]=!![];this['actions'][_0x56e993['actionid']][_0x0655('0xf1')]=_0x56e993[_0x0655('0xf1')];}}}}else if(_0x21f55c==='rrmemory'){if(this[_0x0655('0x22')][_0x56e993[_0x0655('0xea')]]){if(this[_0x0655('0x1e')][_0x56e993[_0x0655('0xf1')]]){this[_0x0655('0x22')][_0x56e993[_0x0655('0xea')]][_0x0655('0xf1')]=_0x56e993['stateinterface'];if(_[_0x0655('0xee')](this[_0x0655('0x27')][this[_0x0655('0x22')][_0x56e993[_0x0655('0xea')]]['queue']])){this[_0x0655('0x27')][this['actions'][_0x56e993[_0x0655('0xea')]][_0x0655('0xb7')]]=[];}this[_0x0655('0x27')][this['actions'][_0x56e993['actionid']][_0x0655('0xb7')]]['push'](_[_0x0655('0x59')](_[_0x0655('0x6f')](this[_0x0655('0x22')][_0x56e993[_0x0655('0xea')]],[_0x0655('0xf2'),'stateinterface']),{'status':_0x56e993[_0x0655('0x84')],'paused':_0x56e993[_0x0655('0xf0')]}));}}}};Dialer[_0x0655('0x81')][_0x0655('0x37')]=function(_0x506891){if(!this[_0x0655('0x22')][_0x506891[_0x0655('0xea')]]){return;}var _0x495085=this;var _0x227dd2=this['voiceQueues'][this[_0x0655('0x22')][_0x506891[_0x0655('0xea')]][_0x0655('0xb7')]];var _0x2a99d1=_0x227dd2['strategy']||_0x0655('0xec');if(_0x2a99d1===_0x0655('0xed')){if(this[_0x0655('0x22')][_0x506891[_0x0655('0xea')]]&&this[_0x0655('0x22')][_0x506891[_0x0655('0xea')]][_0x0655('0xf1')]){this['preview'][_0x0655('0xf3')](this[_0x0655('0x22')][_0x506891['actionid']][_0x0655('0xf2')],this[_0x0655('0x22')][_0x506891[_0x0655('0xea')]][_0x0655('0xf1')])[_0x0655('0x98')](function(_0x4909ea){logger[_0x0655('0x60')](_0x0655('0xf4'),util[_0x0655('0x3f')](_0x4909ea,{'showHidden':![],'depth':null}));})[_0x0655('0x19')](function(){utils[_0x0655('0xb9')](_0x495085[_0x0655('0x1c')][_0x495085[_0x0655('0x22')][_0x506891[_0x0655('0xea')]][_0x0655('0xb7')]],'[syncQueueStatusComplete]');_0x495085[_0x0655('0x1e')][_0x495085['actions'][_0x506891[_0x0655('0xea')]][_0x0655('0xf1')]]['locked']=![];delete _0x495085[_0x0655('0x22')][_0x506891[_0x0655('0xea')]];unlockQueueStatus(_0x227dd2);});}else{utils[_0x0655('0xb9')](this['voiceQueues'][this[_0x0655('0x22')][_0x506891[_0x0655('0xea')]]['queue']],_0x0655('0xf5'));hopperUtils[_0x0655('0xd6')]({'active':![],'ContactId':this[_0x0655('0x22')][_0x506891['actionid']][_0x0655('0xe7')],'ListId':this[_0x0655('0x22')][_0x506891[_0x0655('0xea')]][_0x0655('0xda')],'VoiceQueueId':this['actions'][_0x506891[_0x0655('0xea')]][_0x0655('0xdb')]||undefined,'CampaignId':this['actions'][_0x506891[_0x0655('0xea')]][_0x0655('0xdc')]||undefined})[_0x0655('0x98')](loggerCatch(_0x0655('0xf6')));delete this[_0x0655('0x22')][_0x506891[_0x0655('0xea')]];unlockQueueStatus(_0x227dd2);}}else if(_0x2a99d1===_0x0655('0xec')){var _0x9b5b28;if(this['actions'][_0x506891['actionid']]&&!_[_0x0655('0x41')](this[_0x0655('0x27')][this['actions'][_0x506891[_0x0655('0xea')]]['queue']])){if(this['queueBookedRR'][_0x495085[_0x0655('0x22')][_0x506891[_0x0655('0xea')]][_0x0655('0xb7')]]){this[_0x0655('0x28')][_0x495085[_0x0655('0x22')][_0x506891['actionid']][_0x0655('0xb7')]]=this[_0x0655('0x28')][this['actions'][_0x506891[_0x0655('0xea')]][_0x0655('0xb7')]]?this[_0x0655('0x28')][this[_0x0655('0x22')][_0x506891[_0x0655('0xea')]][_0x0655('0xb7')]]:this[_0x0655('0x27')][this[_0x0655('0x22')][_0x506891['actionid']][_0x0655('0xb7')]]?this[_0x0655('0x27')][this[_0x0655('0x22')][_0x506891[_0x0655('0xea')]][_0x0655('0xb7')]][_0x0655('0xf7')]||0x0:0x0;}this[_0x0655('0x27')][this[_0x0655('0x22')][_0x506891[_0x0655('0xea')]][_0x0655('0xb7')]][_0x0655('0xf7')]=this[_0x0655('0x28')][this['actions'][_0x506891['actionid']][_0x0655('0xb7')]];for(var _0x4b7122=0x0;_0x4b7122=_0x15aa37['dialGlobalMaxRetry']){_0xbc956b['stateGlobal'](_0x2627c7,_0x49d3fa,_0x5fea6,_0x0655('0x120'));}else{if(_0x2627c7[_0x0655('0x11e')]>=_0x15aa37[_0x0655('0x121')]){_0xbc956b['createStateFinal'](_0x2627c7,_0x49d3fa,_0x5fea6,_0x0655('0x122'));}else{hopperUtils[_0x0655('0xd6')]({'active':![],'countmachineretry':_0x2627c7[_0x0655('0x11e')],'scheduledat':moment()[_0x0655('0xd7')](_0x15aa37[_0x0655('0x123')],'minutes')[_0x0655('0x40')](_0x0655('0xbc')),'ContactId':_0x2627c7[_0x0655('0xe7')],'ListId':_0x2627c7[_0x0655('0xda')],'VoiceQueueId':_0x2627c7[_0x0655('0xdb')]||undefined,'CampaignId':_0x2627c7[_0x0655('0xdc')]||undefined})['catch'](loggerCatch(_0x0655('0x124')));_0x49d3fa({'reschedule':0x1});}}});}if(_0x15ee36[_0x0655('0x3d')]==='ivr'&&this[_0x0655('0x1d')][_0x15ee36['queue']][_0x0655('0x10d')]&&_0x1d6f82['value']===_0x0655('0x10e')){delete this['uniqueId'][_0x1d6f82['uniqueid']];utils[_0x0655('0xb9')](this[_0x0655('0x1d')][_0x15ee36[_0x0655('0xb7')]],_0x0655('0x125'));_0x12170b=new Hangup(_0x15ee36,_0x1d6f82);_0x12170b[_0x0655('0xcb')]=0x12;_0x12170b[_0x0655('0x6a')]=_0x0655('0x126');_0x12170b[_0x0655('0x110')]='AMD';ami['emit'](_0x0655('0x112'),ut[_0x0655('0x113')](_0x12170b,_0x0655('0x114')));this[_0x0655('0x115')](_0x12170b,_0x0655('0x127'),_0x0655('0x128'));}if(_0x15ee36[_0x0655('0x3d')]===_0x0655('0xbd')&&this[_0x0655('0x1d')][_0x15ee36[_0x0655('0xb7')]][_0x0655('0x10d')]&&_0x1d6f82[_0x0655('0x117')]===_0x0655('0x118')){return new Promise(function(_0x54163c,_0x136150){delete _0xbc956b[_0x0655('0x23')][_0x1d6f82[_0x0655('0xb8')]];utils[_0x0655('0xb9')](_0xbc956b['campaigns'][_0x15ee36[_0x0655('0xb7')]],_0x0655('0x125'));_0xbc956b[_0x0655('0x1d')][_0x15ee36[_0x0655('0xb7')]][_0x0655('0x129')]+=0x1;_0xbc956b[_0x0655('0x1d')][_0x15ee36[_0x0655('0xb7')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x1dd29e=_0xbc956b['campaigns'][_0x15ee36[_0x0655('0xb7')]];var _0x2e5c78=new Hangup(_0x15ee36,_0x1d6f82);_0x2e5c78[_0x0655('0xcb')]=0x13;_0x2e5c78['statedesc']=_0x0655('0x119');_0x2e5c78[_0x0655('0x110')]=_0x0655('0x111');_0x2e5c78['countmachineretry']+=0x1;_0x2e5c78[_0x0655('0xd0')]+=0x1;_0x2e5c78[_0x0655('0x114')]=!![];ami[_0x0655('0x3c')](_0x0655('0x112'),ut['buildObj'](_0x2e5c78,'amd'));hopperUtils[_0x0655('0xc2')](_0x2e5c78)[_0x0655('0x98')](loggerCatch(_0x0655('0x12a')));if(_0x2e5c78['countbusyretry']+_0x2e5c78[_0x0655('0x11b')]+_0x2e5c78[_0x0655('0x11c')]+_0x2e5c78['countnosuchnumberretry']+_0x2e5c78[_0x0655('0xcf')]+_0x2e5c78[_0x0655('0xe4')]+_0x2e5c78[_0x0655('0x11e')]+_0x2e5c78[_0x0655('0x11f')]>=_0x1dd29e[_0x0655('0x12b')]){_0xbc956b[_0x0655('0x12c')](_0x2e5c78,_0x54163c,_0x136150,_0x0655('0x120'));}else{if(_0x2e5c78[_0x0655('0x11e')]>=_0x1dd29e['dialMachineMaxRetry']){_0xbc956b['createStateFinal'](_0x2e5c78,_0x54163c,_0x136150,_0x0655('0x122'));}else{hopperUtils[_0x0655('0xd6')]({'active':![],'countmachineretry':_0x2e5c78['countmachineretry'],'scheduledat':moment()[_0x0655('0xd7')](_0x1dd29e[_0x0655('0x123')],_0x0655('0xd9'))[_0x0655('0x40')](_0x0655('0xbc')),'ContactId':_0x2e5c78[_0x0655('0xe7')],'ListId':_0x2e5c78[_0x0655('0xda')],'VoiceQueueId':_0x2e5c78[_0x0655('0xdb')]||undefined,'CampaignId':_0x2e5c78[_0x0655('0xdc')]||undefined})[_0x0655('0x98')](loggerCatch(_0x0655('0x124')));_0x54163c({'reschedule':0x1});}}});}}};Dialer[_0x0655('0x81')][_0x0655('0x32')]=function(_0x4fb318){var _0x167442=this[_0x0655('0x23')][_0x4fb318['uniqueid']];var _0x4d9443;if(!_0x167442){return;}if(_0x167442['type']===_0x0655('0xbd')){delete this['uniqueId'][_0x4fb318[_0x0655('0xb8')]];utils[_0x0655('0xb9')](this[_0x0655('0x1d')][_0x167442[_0x0655('0xb7')]],_0x0655('0x12d'));this[_0x0655('0x1d')][_0x167442['queue']][_0x0655('0x12e')]+=0x1;if(_0x4fb318[_0x0655('0x12f')]===_0x0655('0x130')){const _0x55c329=new AgentComplete(_0x167442,_0x4fb318);_0x55c329['CampaignId']=this['campaigns'][_0x167442[_0x0655('0xb7')]]['id'];hopperUtils[_0x0655('0xc2')](_0x55c329)['catch'](loggerCatch(_0x0655('0x131')));hopperUtils[_0x0655('0xc4')](_0x55c329)[_0x0655('0x98')](loggerCatch(_0x0655('0x132')));}else{_0x4d9443=new Hangup(_0x167442,_0x4fb318);hopperUtils[_0x0655('0xc2')](_0x4d9443)[_0x0655('0x98')](loggerCatch(_0x0655('0x133')));hopperUtils['moveContactManagedDialer'](_0x4d9443)[_0x0655('0x98')](loggerCatch(_0x0655('0x134')));}}else{if(isNotNull(this[_0x0655('0x1c')][_0x167442[_0x0655('0xb7')]][_0x0655('0x135')])){delete this[_0x0655('0x23')][_0x4fb318['uniqueid']];utils[_0x0655('0xb9')](this[_0x0655('0x1c')][_0x167442[_0x0655('0xb7')]],_0x0655('0x12d'));this[_0x0655('0x1c')][_0x167442[_0x0655('0xb7')]][_0x0655('0x129')]+=0x1;this['voiceQueues'][_0x167442[_0x0655('0xb7')]][_0x0655('0x10f')]+=0x1;_0x4d9443=new Hangup(_0x167442,_0x4fb318);_0x4d9443[_0x0655('0xcb')]=0x10;_0x4d9443[_0x0655('0x6a')]=_0x0655('0x136');_0x4d9443[_0x0655('0x110')]=_0x0655('0x137');hopperUtils[_0x0655('0xc2')](_0x4d9443)[_0x0655('0x98')](loggerCatch(_0x0655('0x133')));hopperUtils['moveContactManagedDialer'](_0x4d9443)[_0x0655('0x98')](loggerCatch(_0x0655('0x134')));}else{delete this[_0x0655('0x23')][_0x4fb318['uniqueid']];utils[_0x0655('0xb9')](this[_0x0655('0x1c')][_0x167442[_0x0655('0xb7')]],_0x0655('0x138'));if(_0x4fb318[_0x0655('0x12f')]===_0x0655('0x130')){this['voiceQueues'][_0x167442['queue']][_0x0655('0x129')]+=0x1;const _0xf0cb63=new AgentComplete(_0x167442,_0x4fb318);_0xf0cb63[_0x0655('0xdb')]=this[_0x0655('0x1c')][_0x167442[_0x0655('0xb7')]]['id'];hopperUtils[_0x0655('0xc2')](_0xf0cb63)[_0x0655('0x98')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x0655('0xc4')](_0xf0cb63)[_0x0655('0x98')](loggerCatch(_0x0655('0xc5')));}else{this[_0x0655('0x1c')][_0x167442[_0x0655('0xb7')]][_0x0655('0x139')]+=0x1;_0x4d9443=new Hangup(_0x167442,_0x4fb318);_0x4d9443[_0x0655('0xcb')]=0xc;_0x4d9443['statedesc']=_0x4fb318[_0x0655('0x12f')];_0x4d9443[_0x0655('0x110')]=_0x0655('0x13a');hopperUtils[_0x0655('0xc2')](_0x4d9443)['catch'](loggerCatch('[syncHangup][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x4d9443)[_0x0655('0x98')](loggerCatch('[syncHangup]'));}}}};Dialer[_0x0655('0x81')][_0x0655('0x8')]=function(_0xa1f51b){var _0x18ecff=this;if(!_0x18ecff[_0x0655('0x29')][_0xa1f51b[_0x0655('0x5b')]]){_0x18ecff[_0x0655('0x29')][_0xa1f51b[_0x0655('0x5b')]]={'running':![]};}else if(_0x18ecff['queuesSummary'][_0xa1f51b[_0x0655('0x5b')]][_0x0655('0x13b')]===!![]){return;}else if(_0x18ecff[_0x0655('0x29')][_0xa1f51b[_0x0655('0x5b')]][_0x0655('0x13b')]===![]){_0x18ecff[_0x0655('0x29')][_0xa1f51b['name']]['running']=!![];}var _0x49f52a=_0x18ecff[_0x0655('0x1c')][_0xa1f51b['name']];var _0x5c863d=_0x49f52a[_0x0655('0x63')]!==utils[_0x0655('0x64')]['INACTIVE'];var _0xc35b82=utils[_0x0655('0x13c')](_0x49f52a);_0x49f52a['statusMessage']=utils[_0x0655('0x13d')](_0x49f52a,_0x18ecff['trunks']);Promise[_0x0655('0xa3')]()[_0x0655('0x39')](function(){if(_0x49f52a['statusMessage']===utils[_0x0655('0x64')]['INACTIVE']){if(_0x5c863d){clearPredictiveAttributes(_0x49f52a);_0xa1f51b[_0x0655('0x25')]=undefined;_0xa1f51b[_0x0655('0x5a')]=undefined;}if(_0x49f52a[_0x0655('0x13e')]===utils[_0x0655('0x64')][_0x0655('0x75')]){_0xa1f51b['available']=0x0;_0xa1f51b['paused']=0x0;_0xa1f51b[_0x0655('0x13f')]=0x0;_0xa1f51b[_0x0655('0x140')]=0x0;_0xa1f51b['pTalking']=0x0;}}else if(_0x49f52a[_0x0655('0x13e')]===utils[_0x0655('0x64')]['ACTIVE']&&!_0xc35b82){return _0x18ecff[_0x0655('0x8d')](_0x49f52a,!![])['then'](function(){return _0x18ecff[_0x0655('0x8d')](_0x49f52a,![]);})[_0x0655('0x39')](function(){return _0x18ecff[_0x0655('0xa8')](_0x49f52a);})[_0x0655('0x98')](function(_0x10649c){loggerSyncQueueSummary[_0x0655('0x3e')](_0x0655('0x141'),util['inspect'](_0x10649c,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x49f52a);});}else{clearPredictiveAttributes(_0x49f52a);}})['then'](function(){var _0x2e65e0=_0xa1f51b[_0x0655('0x142')](_0x49f52a);if(_0x2e65e0||_0x49f52a[_0x0655('0x143')]){_0x49f52a['queueSummaryCountersUpdated']=![];_0xa1f51b[_0x0655('0x144')](_0x49f52a);Object[_0x0655('0x145')](_0x49f52a,_0xa1f51b);emitOutboundVoiceQueueSummary(_0xa1f51b);}_0x18ecff[_0x0655('0x29')][_0x49f52a['name']]['running']=![];})[_0x0655('0x98')](function(_0x40bcce){logger['error'](_0x0655('0x141'),util[_0x0655('0x3f')](_0x40bcce,{'showHidden':![],'depth':null}));_0x18ecff['queuesSummary'][_0x49f52a[_0x0655('0x5b')]]['running']=![];});};Dialer[_0x0655('0x81')][_0x0655('0x30')]=_[_0x0655('0x146')](function(){var _0x179fae=_[_0x0655('0x147')](this[_0x0655('0x1c')],function(_0x46e9da){return _0x46e9da[_0x0655('0x148')];});var _0x552594=_[_0x0655('0x147')](this[_0x0655('0x1e')],function(_0x12fbac){return _0x12fbac['online']&&_0x12fbac[_0x0655('0x84')]===_0x0655('0x85');});if(_0x179fae[_0x0655('0xf8')]>0x0&&_0x552594[_0x0655('0xf8')]>0x0){return Promise[_0x0655('0xa3')]()[_0x0655('0x39')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x179fae,'id'),previewRecallmeReminderInterval,_[_0x0655('0x149')](_0x552594,'id')))[_0x0655('0x39')](function(_0x400e05){for(var _0x3f721=0x0;_0x3f721<_0x400e05['length'];_0x3f721++){var _0x5ed973=_0x400e05[_0x3f721][_0x0655('0x14a')][_0x0655('0x5b')];if(_0x5ed973)io['to'](util[_0x0655('0x40')](_0x0655('0x14b'),_0x5ed973))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x400e05[_0x3f721]});}})['catch'](function(_0x1b16fb){logger['error'](_0x0655('0x14c'),_0x1b16fb);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x0655('0x38')]=function(){var _0x48cb2f=this;setInterval(function(){_0x48cb2f[_0x0655('0x14d')](_0x48cb2f[_0x0655('0x23')],_0x0655('0x14e'));_0x48cb2f[_0x0655('0x14d')](_0x48cb2f['actions'],_0x0655('0x14f'));},0x32c8);};Dialer['prototype']['clearZombieChannels']=function(_0x2e64b1,_0x96eccf){var _0x5a1112=this;for(var _0x211a7f in _0x2e64b1){if(typeof _0x2e64b1[_0x211a7f]!==_0x0655('0xa2')){this[_0x0655('0x1a')][_0x0655('0x17')](function(){if(!_['isNil'](_0x2e64b1[_0x211a7f])){return ami[_0x0655('0x150')]({'action':'status','channel':_0x2e64b1[_0x211a7f][_0x0655('0xe9')]})[_0x0655('0x98')](function(_0x4f661e){if(_0x4f661e[_0x0655('0x63')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x2e64b1[_0x211a7f]&&_0x2e64b1[_0x211a7f][_0x0655('0x3d')]!=='ivr'){utils['decrementOriginate'](_0x5a1112[_0x0655('0x1c')][_0x2e64b1[_0x211a7f]['queue']],_0x0655('0x151'));logger['error']('[Dialer][checkChannel]',_0x96eccf,_0x211a7f,_0x2e64b1[_0x211a7f][_0x0655('0xb7')]);delete _0x2e64b1[_0x211a7f];}if(_0x2e64b1[_0x211a7f]&&_0x2e64b1[_0x211a7f]['type']===_0x0655('0xbd')){utils[_0x0655('0xb9')](_0x5a1112[_0x0655('0x1d')][_0x2e64b1[_0x211a7f]['queue']],_0x0655('0x151'));logger['error'](_0x0655('0x152'),_0x96eccf,_0x211a7f,_0x2e64b1[_0x211a7f][_0x0655('0xb7')]);delete _0x2e64b1[_0x211a7f];}},0x2328);}});}});}}};Dialer[_0x0655('0x81')][_0x0655('0x153')]=function(_0x1b0c89){return Promise['resolve']()[_0x0655('0x39')](voiceQueueRt[_0x0655('0x153')](_0x1b0c89))['catch'](loggerCatch(_0x0655('0x154')));};Dialer[_0x0655('0x81')][_0x0655('0x155')]=function(_0x1bb0e6,_0xa8b4b9,_0x3888fd){var _0x2a9356={'state':0x19,'statedesc':_0x0655('0x156')};utils[_0x0655('0xb9')](_0xa8b4b9,_0x0655('0x157')+_0x1bb0e6);this[_0x0655('0x115')](_[_0x0655('0x59')](_0x2a9356,_['pick'](_0x3888fd,[_0x0655('0xe7'),_0x0655('0xda'),_0x0655('0x158'),'VoiceQueueId',_0x0655('0xdc')])),_0x0655('0x159'),_0x0655('0x157'));logger[_0x0655('0x60')](_0x1bb0e6);};Dialer[_0x0655('0x81')]['saveInDb']=function(_0x17c0d8,_0x1e88c2,_0x1a430c){hopperUtils[_0x0655('0xc2')](_0x17c0d8)['catch'](loggerCatch(_0x1e88c2));hopperUtils[_0x0655('0xc4')](_0x17c0d8)[_0x0655('0x98')](loggerCatch(_0x1a430c));};Dialer[_0x0655('0x81')][_0x0655('0xd5')]=function(_0x2a63b1,_0x23e221){hopperUtils[_0x0655('0xc2')](_0x2a63b1)[_0x0655('0x98')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x23e221==0x0){hopperUtils['moveContactManagedDialer'](_0x2a63b1)[_0x0655('0x98')](loggerCatch(_0x0655('0x15a')));}};Dialer['prototype'][_0x0655('0x14c')]=function(_0x45924f){return Promise[_0x0655('0xa3')]()[_0x0655('0x39')](cmHopper[_0x0655('0x15b')](_0x45924f['id'],previewRecallmeReminderInterval))[_0x0655('0x39')](function(_0x265d24){for(var _0x599461=0x0;_0x599461<_0x265d24['length'];_0x599461++){var _0x59def7=_0x265d24[_0x599461][_0x0655('0x14a')][_0x0655('0x5b')];if(_0x59def7)io['to'](util['format']('user:%s',_0x59def7))[_0x0655('0x3c')](_0x0655('0x15c'),{'hopper':_0x265d24[_0x599461]});}})['catch'](function(){});};Dialer['prototype']['launchHandleIvr']=function(_0x43e8e8){var _0x5dd453=this;return function(){_0x5dd453[_0x0655('0x15d')](_0x43e8e8);};};Dialer['prototype']['actionOriginate']=function(_0x5248e3,_0x174d5a){var _0x6dc00c=this;var _0x5ef68c=uuid['v4']();this[_0x0655('0x22')][_0x5ef68c]=new Action(_0x5248e3,_0x174d5a,_0x5ef68c);return new Promise(function(_0x4ab09e,_0x2e6113){if(_[_0x0655('0x3b')](_0x5248e3)&&typeof _0x5248e3!==_0x0655('0x15e')){return _0x2e6113(msgResponse(_0x0655('0x15f'),'Failure',_0x0655('0x160')));}if(_['isUndefined'](_0x174d5a[_0x0655('0x161')])||_0x174d5a[_0x0655('0x161')]===null){return _0x2e6113(msgResponse(_0x0655('0x15f'),_0x0655('0x8e'),_0x0655('0x162')));}var _0x50dfb5={'XMD-CALLERID':_0x6dc00c['actions'][_0x5ef68c][_0x0655('0x163')](),'XMD-AGI':_0x5248e3[_0x0655('0x135')]?util[_0x0655('0x40')](_0x0655('0x164'),ipAgi,_0x5248e3[_0x0655('0x135')]):_0x0655('0x165'),'XMD-AGIAFTER':_0x5248e3[_0x0655('0xc0')]?util[_0x0655('0x40')](_0x0655('0x164'),ipAgi,_0x5248e3[_0x0655('0xc0')]):_0x0655('0x165'),'XMD-QUEUE':utils[_0x0655('0x166')](_0x5248e3)?util[_0x0655('0x40')](_0x0655('0x167'),_0x5248e3[_0x0655('0x5b')],_0x5248e3[_0x0655('0x168')]||'',_0x5248e3[_0x0655('0xc1')]?'c':'',_0x5248e3[_0x0655('0x169')]||0x3):'NONE','XMD-CONTACTID':_0x174d5a['ContactId'],'XMD-CDRTYPE':_0x0655('0x16a'),'CALLERID(all)':_0x6dc00c[_0x0655('0x22')][_0x5ef68c]['getCaller'](),'XMD-AMD':_0x5248e3[_0x0655('0x10d')]?'ACTIVE':_0x0655('0x165'),'XMD-DESTINATION':_0x0655('0x10c')};if(_0x5248e3[_0x0655('0x10d')]){_0x50dfb5[_0x0655('0x16b')]=_0x5248e3[_0x0655('0x16c')]||0x9c4;_0x50dfb5[_0x0655('0x16d')]=_0x5248e3[_0x0655('0x16e')]||0x5dc;_0x50dfb5[_0x0655('0x16f')]=_0x5248e3['dialAMDAfterGreetingSilence']||0x320;_0x50dfb5[_0x0655('0x170')]=_0x5248e3[_0x0655('0x171')]||0x1388;_0x50dfb5['XMD-AMDMINWORDLENGTH']=_0x5248e3[_0x0655('0x172')]||0x64;_0x50dfb5['XMD-AMDBETWEENWORDSSILENCE']=_0x5248e3[_0x0655('0x173')]||0x32;_0x50dfb5[_0x0655('0x174')]=_0x5248e3[_0x0655('0x175')]||0x3;_0x50dfb5[_0x0655('0x176')]=_0x5248e3[_0x0655('0x177')]||0x100;_0x50dfb5[_0x0655('0x178')]=_0x5248e3[_0x0655('0x179')]||0x1388;}if(utils[_0x0655('0x166')](_0x5248e3)){_0x50dfb5[_0x0655('0x17a')]=_0x174d5a[_0x0655('0xdb')];}else{_0x50dfb5[_0x0655('0x17b')]=_0x174d5a[_0x0655('0xdc')];}var _0xac3b58=utils[_0x0655('0x17c')](_0x174d5a[_0x0655('0x17d')]);Object[_0x0655('0x145')](_0x50dfb5,_0xac3b58);var _0x4d5fc3=_0x6dc00c[_0x0655('0x87')](_0x5248e3['Trunk'])?utils[_0x0655('0x17e')](_0x5248e3['Trunk']['callerid'],_0x5248e3[_0x0655('0x17f')],_0x5248e3[_0x0655('0x180')]>0x0?utils['getCallerIdRandom'](_0x5248e3[_0x0655('0x181')],_0x5248e3[_0x0655('0x180')]):_0x5248e3[_0x0655('0x181')]):utils['getCallerId'](_[_0x0655('0xee')](_0x5248e3[_0x0655('0x182')])?_0x5248e3['Trunk'][_0x0655('0x183')]:_0x5248e3[_0x0655('0x182')][_0x0655('0x183')],_0x5248e3[_0x0655('0x17f')],_0x5248e3[_0x0655('0x180')]>0x0?utils[_0x0655('0x184')](_0x5248e3[_0x0655('0x181')],_0x5248e3[_0x0655('0x180')]):_0x5248e3[_0x0655('0x181')]);if(_0x4d5fc3){_0x50dfb5[_0x0655('0x185')]=_0x6dc00c[_0x0655('0x22')][_0x5ef68c][_0x0655('0x186')]=utils[_0x0655('0x187')](_0x4d5fc3);_0x50dfb5[_0x0655('0x188')]=_0x174d5a[_0x0655('0x161')];}_0x5248e3[_0x0655('0x189')]=_0x50dfb5;return ami[_0x0655('0x150')]({'actionid':_0x5ef68c,'action':_0x0655('0x15f'),'channel':_0x6dc00c[_0x0655('0x87')](_0x5248e3[_0x0655('0x88')])?util['format']('SIP/%s/%s%s',_0x5248e3['Trunk'][_0x0655('0x5b')],isNotNull(_0x5248e3[_0x0655('0x18a')])?_0x5248e3[_0x0655('0x18a')][_0x0655('0x18b')]()||'':'',_0x5248e3[_0x0655('0x18c')]>0x0?_0x174d5a[_0x0655('0x161')][_0x0655('0x18d')](_0x5248e3[_0x0655('0x18c')]):_0x174d5a[_0x0655('0x161')]):util[_0x0655('0x40')](_0x0655('0x18e'),_['isNil'](_0x5248e3['TrunkBackup'])?_0x5248e3[_0x0655('0x88')][_0x0655('0x5b')]:_0x5248e3[_0x0655('0x182')][_0x0655('0x5b')],isNotNull(_0x5248e3[_0x0655('0x18a')])?_0x5248e3[_0x0655('0x18a')]['trim']()||'':'',_0x5248e3[_0x0655('0x18c')]>0x0?_0x174d5a[_0x0655('0x161')][_0x0655('0x18d')](_0x5248e3[_0x0655('0x18c')]):_0x174d5a['phone']),'callerid':_0x4d5fc3,'Exten':_0x0655('0x10c'),'Context':'from-sip','Priority':'1','variable':_0x50dfb5,'timeout':(_0x5248e3['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5ef68c})['then'](function(_0x2d8826){return _0x4ab09e(_0x2d8826);})[_0x0655('0x98')](function(_0x16f22a){_0x5248e3[_0x0655('0x18f')]+=0x1;var _0x586dd5=new History(_0x6dc00c[_0x0655('0x22')][_0x5ef68c]);logger['error'](util['format']('[originateError]:\x20%s',JSON[_0x0655('0x80')](_0x16f22a)));_0x586dd5[_0x0655('0xcb')]=0xe;_0x586dd5[_0x0655('0x6a')]=_0x0655('0x190');_0x586dd5['starttime']=moment()['format'](_0x0655('0xbc'));_0x586dd5[_0x0655('0xe8')]=_0x586dd5[_0x0655('0x6b')];hopperUtils[_0x0655('0xc2')](_0x586dd5)[_0x0655('0x98')](loggerCatch('[originate][error]'));_0x6dc00c[_0x0655('0xc4')](_0x586dd5)['catch'](loggerCatch('[originate][error]'))['finally'](function(){delete _0x6dc00c[_0x0655('0x22')][_0x5ef68c];return _0x2e6113(msgResponse('originate',_0x0655('0x191'),_0x0655('0x192')));});});});};Dialer['prototype']['checkRetriveMax']=function(_0x2ee7a6,_0x1c04a6,_0x43c502){var _0x17a741=new History(_0x1c04a6);if(_0x17a741['countbusyretry']+_0x17a741['countcongestionretry']+_0x17a741[_0x0655('0x11c')]+_0x17a741[_0x0655('0x11d')]+_0x17a741[_0x0655('0xcf')]+_0x17a741[_0x0655('0xe4')]+_0x17a741['countmachineretry']+_0x17a741[_0x0655('0x11f')]>=_0x43c502['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x2ee7a6){case 0x3:if(_0x17a741['countnoanswerretry']>=_0x43c502[_0x0655('0x193')]-0x1){return!![];}hopperUtils[_0x0655('0xd6')]({'active':![],'countnoanswerretry':_0x17a741[_0x0655('0x11c')]+=0x1,'scheduledat':moment()[_0x0655('0xd7')](_0x43c502['dialNoAnswerRetryFrequency'],_0x0655('0xd9'))['format'](_0x0655('0xbc')),'ContactId':_0x17a741[_0x0655('0xe7')],'ListId':_0x17a741['ListId'],'VoiceQueueId':_0x17a741[_0x0655('0xdb')]||undefined,'CampaignId':_0x17a741[_0x0655('0xdc')]||undefined})[_0x0655('0x98')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x17a741[_0x0655('0x11a')]>=_0x43c502[_0x0655('0x194')]-0x1){return!![];}hopperUtils[_0x0655('0xd6')]({'active':![],'countbusyretry':_0x17a741[_0x0655('0x11a')]+=0x1,'scheduledat':moment()[_0x0655('0xd7')](_0x43c502['dialBusyRetryFrequency'],_0x0655('0xd9'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x17a741[_0x0655('0xe7')],'ListId':_0x17a741['ListId'],'VoiceQueueId':_0x17a741[_0x0655('0xdb')]||undefined,'CampaignId':_0x17a741['CampaignId']||undefined})[_0x0655('0x98')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x17a741[_0x0655('0x11b')]>=_0x43c502[_0x0655('0x195')]-0x1){return!![];}hopperUtils[_0x0655('0xd6')]({'active':![],'countcongestionretry':_0x17a741[_0x0655('0x11b')]+=0x1,'scheduledat':moment()[_0x0655('0xd7')](_0x43c502['dialCongestionRetryFrequency'],_0x0655('0xd9'))[_0x0655('0x40')](_0x0655('0xbc')),'ContactId':_0x17a741[_0x0655('0xe7')],'ListId':_0x17a741['ListId'],'VoiceQueueId':_0x17a741[_0x0655('0xdb')]||undefined,'CampaignId':_0x17a741['CampaignId']||undefined})[_0x0655('0x98')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x17a741[_0x0655('0x11d')]>=_0x43c502[_0x0655('0x196')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x17a741[_0x0655('0x11d')]+=0x1,'scheduledat':moment()[_0x0655('0xd7')](_0x43c502[_0x0655('0x197')],_0x0655('0xd9'))[_0x0655('0x40')](_0x0655('0xbc')),'ContactId':_0x17a741['ContactId'],'ListId':_0x17a741[_0x0655('0xda')],'VoiceQueueId':_0x17a741[_0x0655('0xdb')]||undefined,'CampaignId':_0x17a741[_0x0655('0xdc')]||undefined})['catch'](loggerCatch(_0x0655('0x198')));}break;case 0xa:if(_0x17a741[_0x0655('0xcf')]>=_0x43c502[_0x0655('0xd4')]-0x1){return!![];}hopperUtils[_0x0655('0xd6')]({'active':![],'countdropretry':_0x17a741[_0x0655('0xcf')]+=0x1,'scheduledat':moment()[_0x0655('0xd7')](_0x43c502[_0x0655('0xd8')],'minutes')[_0x0655('0x40')](_0x0655('0xbc')),'ContactId':_0x17a741[_0x0655('0xe7')],'ListId':_0x17a741[_0x0655('0xda')],'VoiceQueueId':_0x17a741[_0x0655('0xdb')]||undefined,'CampaignId':_0x17a741[_0x0655('0xdc')]||undefined})[_0x0655('0x98')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x17a741[_0x0655('0xe4')]>=_0x43c502['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0x0655('0xd6')]({'active':![],'countabandonedretry':_0x17a741[_0x0655('0xe4')]+=0x1,'scheduledat':moment()['add'](_0x43c502[_0x0655('0xe5')],'minutes')[_0x0655('0x40')](_0x0655('0xbc')),'ContactId':_0x17a741['ContactId'],'ListId':_0x17a741[_0x0655('0xda')],'VoiceQueueId':_0x17a741[_0x0655('0xdb')]||undefined,'CampaignId':_0x17a741['CampaignId']||undefined})['catch'](loggerCatch(_0x0655('0x199')));break;case 0x13:if(_0x17a741[_0x0655('0x11e')]>=_0x43c502[_0x0655('0x121')]-0x1){return!![];}hopperUtils[_0x0655('0xd6')]({'active':![],'countmachineretry':_0x17a741[_0x0655('0x11e')]+=0x1,'scheduledat':moment()[_0x0655('0xd7')](_0x43c502[_0x0655('0x123')],_0x0655('0xd9'))[_0x0655('0x40')](_0x0655('0xbc')),'ContactId':_0x17a741[_0x0655('0xe7')],'ListId':_0x17a741['ListId'],'VoiceQueueId':_0x17a741['VoiceQueueId']||undefined,'CampaignId':_0x17a741[_0x0655('0xdc')]||undefined})[_0x0655('0x98')](loggerCatch(_0x0655('0x124')));break;case 0x14:if(_0x17a741[_0x0655('0x11f')]>=_0x43c502['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x17a741[_0x0655('0x11f')]+=0x1,'scheduledat':moment()['add'](_0x43c502['dialAgentRejectRetryFrequency'],_0x0655('0xd9'))[_0x0655('0x40')](_0x0655('0xbc')),'ContactId':_0x17a741[_0x0655('0xe7')],'ListId':_0x17a741[_0x0655('0xda')],'VoiceQueueId':_0x17a741[_0x0655('0xdb')]||undefined,'CampaignId':_0x17a741[_0x0655('0xdc')]||undefined})[_0x0655('0x98')](loggerCatch(_0x0655('0x19a')));break;default:return!![];}};Dialer['prototype'][_0x0655('0x107')]=function(_0x443f57,_0x1c8359,_0x2cac6b){var _0x2e9d8a=this;var _0x155813=new History(_0x443f57);var _0x5f0688=![];var _0x248e03;var _0x355efb;return new Promise(function(_0x19a3cc,_0x2ebba4){if(_['isUndefined'](_0x1c8359)&&typeof _0x1c8359!==_0x0655('0x15e')){return _0x2ebba4(msgResponse(_0x0655('0x19b'),'Failure',_0x0655('0x19c')));}if(_[_0x0655('0x3b')](_0x2cac6b)&&typeof _0x2cac6b!==_0x0655('0x15e')){return _0x2ebba4(msgResponse(_0x0655('0x19b'),'Failure',_0x0655('0x19d')));}hopperUtils[_0x0655('0xe6')](_0x155813,_0x2cac6b['reason'],_0x1c8359)[_0x0655('0x39')](function(_0x5f4dba){if(_0x5f4dba[_0x0655('0xd3')]==0x1)_0x5f0688=!![];switch(_0x2cac6b[_0x0655('0xbe')]){case'0':_0x1c8359[_0x0655('0x19e')]+=0x1;_0x155813[_0x0655('0xcb')]=0x0;_0x155813['statedesc']=_0x0655('0x19f');_0x155813[_0x0655('0x11d')]+=0x1;_0x155813[_0x0655('0xd0')]+=0x1;ami[_0x0655('0x3c')](_0x0655('0x1a0'),ut[_0x0655('0x113')](_0x443f57,_0x0655('0x1a1')));_0x248e03=_0x1c8359[_0x0655('0x197')];_0x355efb=_0x1c8359['callAdditionalPhoneAfterMin'];hopperUtils[_0x0655('0xc2')](_0x155813)['catch'](loggerCatch(_0x0655('0x12a')));if(_0x2e9d8a[_0x0655('0x1a2')](0x0,_0x443f57,_0x1c8359)&&!_0x5f0688){if(_0x155813[_0x0655('0x11d')]>=_0x1c8359[_0x0655('0x196')]){_0x2e9d8a[_0x0655('0x1a3')](_0x155813,_0x19a3cc,_0x2ebba4,_0x0655('0x1a4'));}else{_0x2e9d8a[_0x0655('0x12c')](_0x155813,_0x19a3cc,_0x2ebba4,_0x0655('0x1a4'));}}break;case'3':_0x1c8359[_0x0655('0x1a5')]+=0x1;_0x155813[_0x0655('0xcb')]=0x3;_0x155813[_0x0655('0x6a')]=_0x0655('0x1a6');_0x155813[_0x0655('0x11c')]+=0x1;_0x155813[_0x0655('0xd0')]+=0x1;var _0x4981c0=ut['buildNoAnswerEventPayload'](_0x443f57,_0x1c8359);ami[_0x0655('0x3c')]('custom:agentnoanswer',_0x4981c0);_0x248e03=_0x1c8359[_0x0655('0x1a7')];_0x355efb=_0x1c8359[_0x0655('0xd1')];hopperUtils[_0x0655('0xc2')](_0x155813)[_0x0655('0x98')](loggerCatch(_0x0655('0x1a8')));if(_0x2e9d8a[_0x0655('0x1a2')](0x3,_0x443f57,_0x1c8359)&&!_0x5f0688){if(_0x155813[_0x0655('0x11c')]>=_0x1c8359[_0x0655('0x193')]){_0x2e9d8a[_0x0655('0x1a3')](_0x155813,_0x19a3cc,_0x2ebba4,_0x0655('0x1a9'));}else{_0x2e9d8a['stateGlobal'](_0x155813,_0x19a3cc,_0x2ebba4,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x1c8359['outboundBusyCallsDay']+=0x1;_0x155813[_0x0655('0xcb')]=0x5;_0x155813[_0x0655('0x6a')]=_0x0655('0x1aa');_0x155813[_0x0655('0x11a')]+=0x1;_0x155813[_0x0655('0xd0')]+=0x1;ami[_0x0655('0x3c')]('custom:agentbusy',ut['buildObj'](_0x443f57,_0x0655('0x1ab')));_0x248e03=_0x1c8359[_0x0655('0x1ac')];_0x355efb=_0x1c8359['callAdditionalPhoneAfterMin'];hopperUtils[_0x0655('0xc2')](_0x155813)[_0x0655('0x98')](loggerCatch(_0x0655('0x1ad')));if(_0x2e9d8a[_0x0655('0x1a2')](0x5,_0x443f57,_0x1c8359)&&!_0x5f0688){if(_0x155813[_0x0655('0x11a')]>=_0x1c8359['dialBusyMaxRetry']){_0x2e9d8a[_0x0655('0x1a3')](_0x155813,_0x19a3cc,_0x2ebba4,'reason\x205\x20busy');}else{_0x2e9d8a[_0x0655('0x12c')](_0x155813,_0x19a3cc,_0x2ebba4,_0x0655('0x1ae'));}}break;case'8':_0x1c8359[_0x0655('0x1af')]+=0x1;_0x155813['state']=0x8;_0x155813['statedesc']=_0x0655('0x1b0');_0x155813[_0x0655('0x11b')]+=0x1;_0x155813[_0x0655('0xd0')]+=0x1;_0x248e03=_0x1c8359['dialCongestionRetryFrequency'];_0x355efb=_0x1c8359[_0x0655('0xd1')];ami['emit'](_0x0655('0x1b1'),ut[_0x0655('0x113')](_0x443f57,_0x0655('0x1b2')));hopperUtils['createHistory'](_0x155813)[_0x0655('0x98')](loggerCatch(_0x0655('0x1b3')));if(_0x2e9d8a['checkRetriveMax'](0x8,_0x443f57,_0x1c8359)&&!_0x5f0688){if(_0x155813[_0x0655('0x11b')]>=_0x1c8359['dialCongestionMaxRetry']){_0x2e9d8a[_0x0655('0x1a3')](_0x155813,_0x19a3cc,_0x2ebba4,'reason\x208\x20congestion');}else{_0x2e9d8a[_0x0655('0x12c')](_0x155813,_0x19a3cc,_0x2ebba4,'reason\x208\x20congestion');}}break;case'11':_0x1c8359[_0x0655('0x1b4')]+=0x1;_0x155813['state']=0xb;_0x155813[_0x0655('0x6a')]=_0x0655('0xe2');_0x155813['countabandonedretry']+=0x1;_0x155813['countglobal']+=0x1;_0x248e03=_0x1c8359[_0x0655('0xe5')];_0x355efb=_0x1c8359['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x155813)['catch'](loggerCatch(_0x0655('0x1b5')));if(_0x2e9d8a[_0x0655('0x1a2')](0xb,_0x443f57,_0x1c8359)&&!_0x5f0688){if(_0x155813[_0x0655('0xe4')]>=_0x1c8359[_0x0655('0x1b6')]){_0x2e9d8a[_0x0655('0x1a3')](_0x155813,_0x19a3cc,_0x2ebba4,_0x0655('0x1b7'));}else{_0x2e9d8a[_0x0655('0x12c')](_0x155813,_0x19a3cc,_0x2ebba4,_0x0655('0x1b7'));}}break;case'20':_0x1c8359[_0x0655('0x1b8')]+=0x1;_0x155813[_0x0655('0xcb')]=0x14;_0x155813[_0x0655('0x6a')]=_0x0655('0x1b9');_0x155813[_0x0655('0x11f')]+=0x1;_0x155813[_0x0655('0xd0')]+=0x1;_0x248e03=_0x1c8359['dialAgentRejectRetryFrequency'];_0x355efb=_0x1c8359['callAdditionalPhoneAfterMin'];ami[_0x0655('0x3c')]('custom:agentreject',ut[_0x0655('0x113')](_0x443f57,'agentreject'));hopperUtils[_0x0655('0xc2')](_0x155813)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x2e9d8a[_0x0655('0x1a2')](0x14,_0x443f57,_0x1c8359)&&!_0x5f0688){if(_0x155813['countagentrejectretry']>=_0x1c8359[_0x0655('0x1ba')]){_0x2e9d8a[_0x0655('0x1a3')](_0x155813,_0x19a3cc,_0x2ebba4,_0x0655('0x1bb'));}else{_0x2e9d8a[_0x0655('0x12c')](_0x155813,_0x19a3cc,_0x2ebba4,_0x0655('0x1bb'));}}break;default:_0x1c8359['outboundUnknownCallsDay']+=0x1;_0x155813[_0x0655('0xcb')]=0xc;_0x155813['statedesc']=_0x2cac6b[_0x0655('0xbe')];_0x248e03=_0x1c8359[_0x0655('0x1bc')];_0x355efb=_0x1c8359[_0x0655('0xd1')];hopperUtils[_0x0655('0xc2')](_0x155813)['catch'](loggerCatch(_0x0655('0x1bd')));if(_0x2e9d8a['checkRetriveMax'](_0x2cac6b[_0x0655('0xbe')],_0x443f57,_0x1c8359)&&!_0x5f0688){if(_0x155813[_0x0655('0x11a')]+_0x155813[_0x0655('0x11b')]+_0x155813[_0x0655('0x11c')]+_0x155813[_0x0655('0x11d')]+_0x155813[_0x0655('0xcf')]+_0x155813['countabandonedretry']+_0x155813[_0x0655('0x11e')]+_0x155813['countagentrejectretry']>=_0x1c8359[_0x0655('0x12b')]){_0x2e9d8a['stateGlobal'](_0x155813,_0x19a3cc,_0x2ebba4,_0x2cac6b['reason']);}else{_0x2e9d8a[_0x0655('0x1a3')](_0x155813,_0x19a3cc,_0x2ebba4,_0x2cac6b[_0x0655('0xbe')]);}}}})[_0x0655('0x39')](function(){if(_0x5f0688){hopperUtils[_0x0655('0xe0')](_0x155813,_0x248e03,_0x355efb)['then'](function(){return _0x19a3cc(0x1);});}});});};Dialer[_0x0655('0x81')][_0x0655('0x12c')]=function(_0x4e3be4,_0x46493a,_0x5c3f32,_0x227ecd){var _0x458973=new Final(_0x4e3be4);_0x458973['state']=0xf;_0x458973[_0x0655('0x6a')]='Global';this[_0x0655('0x1a3')](_0x458973,_0x46493a,_0x5c3f32,_0x227ecd);};Dialer[_0x0655('0x81')][_0x0655('0x1a3')]=function(_0x1f769b,_0x578288,_0x5b226e,_0x4e5d0b){hopperUtils[_0x0655('0xc4')](_0x1f769b)['then'](function(){return _0x578288(msgResponse('[callProgressDetecting]',_0x0655('0x105'),_0x4e5d0b));})[_0x0655('0x98')](function(){return _0x5b226e(msgResponse(_0x0655('0x1be'),_0x0655('0x8e'),_0x0655('0x1bf')));});};Dialer[_0x0655('0x81')]['predictive']=function(_0x11a331){var _0x37eea6=_0x11a331['dialPredictiveOptimizationPercentage']/0x64;var _0x1a020a=_0x11a331[_0x0655('0xca')]/(_0x11a331[_0x0655('0xca')]+_0x11a331[_0x0655('0x129')]);var _0x57a5ac=Math[_0x0655('0x1c0')](_0x11a331['predictiveIntervalAvailable']*(_0x11a331[_0x0655('0x1c1')]/0x64));var _0x42449d=Math['round'](_0x11a331[_0x0655('0x1c2')]*(_0x11a331[_0x0655('0x1c3')]/0x64));var _0x4b56cc=_0x11a331['available']+_0x11a331[_0x0655('0x140')];var _0x444778=Math[_0x0655('0x1c4')](_0x11a331['erlangCalls']*_0x11a331[_0x0655('0x55')]*_0x11a331[_0x0655('0x1c5')]*_0x11a331[_0x0655('0x1c6')]);if(_[_0x0655('0x3b')](_0x11a331[_0x0655('0x5a')])){if(!_['isUndefined'](_0x11a331[_0x0655('0x25')])){_0x11a331['startPredictive']=undefined;loggerPredictive['error'](_0x0655('0x1c7'),_0x0655('0x1c8'));}if(!_[_0x0655('0x3b')](_0x11a331[_0x0655('0x5e')])){loggerPredictive[_0x0655('0x60')](_0x0655('0x1c7'),_0x0655('0x1c9'));clearInterval(_0x11a331[_0x0655('0x5e')]);_0x11a331[_0x0655('0x5e')]=undefined;}_0x11a331[_0x0655('0x5a')]=moment()[_0x0655('0x40')](_0x0655('0xbc'));loggerPredictive['info'](_0x11a331[_0x0655('0x5b')],_0x0655('0x1ca'),_0x11a331[_0x0655('0x5a')]);this[_0x0655('0xac')](_0x11a331,0x1);}else if(ifInterval(_0x11a331['dialPredictiveInterval'],_0x11a331[_0x0655('0x5a')])){this[_0x0655('0xac')](_0x11a331,0x1);loggerPredictiveCalls[_0x0655('0x42')]('[startMethodPredictive][StartProgressive][Loop]',_0x11a331['startProgressive'],_0x11a331['name']);_0x11a331[_0x0655('0x1cb')]=0x0;_0x11a331[_0x0655('0x1cc')]=0x0;}else if(_0x37eea6<_0x1a020a&&_0x11a331[_0x0655('0x1cd')]==='dropRate'){clearPredictiveAttributes(_0x11a331);loggerPredictive[_0x0655('0x42')](_0x0655('0x1ce'),_0x0655('0x1cf'),_0x1a020a,_0x0655('0x5a'),_0x11a331[_0x0655('0x5b')]);}else if(_0x444778<_0x11a331[_0x0655('0x1cc')]&&_0x11a331[_0x0655('0x1cd')]==='dropRate'){clearPredictiveAttributes(_0x11a331);loggerPredictive[_0x0655('0x42')](_0x0655('0x1d0'),_0x0655('0x1d1'),_0x444778,_0x0655('0x1d2'),_0x11a331[_0x0655('0x1cc')],_0x0655('0x5a'),_0x11a331[_0x0655('0x5b')]);}else if(!ifInterval(_0x11a331['dialPredictiveInterval'],_0x11a331[_0x0655('0x5a')])&&_['isUndefined'](_0x11a331[_0x0655('0x25')])&&!_['isUndefined'](_0x11a331[_0x0655('0x5a')])){_0x11a331[_0x0655('0x25')]=moment()[_0x0655('0x40')](_0x0655('0xbc'));loggerPredictive[_0x0655('0x42')](_0x11a331[_0x0655('0x5b')],_0x0655('0x1d3'),_0x11a331[_0x0655('0x25')]);hopperUtils[_0x0655('0x1d4')](_0x11a331[_0x0655('0x1d5')])[_0x0655('0x39')](this[_0x0655('0x1d6')](_0x11a331))[_0x0655('0x39')](mergeDataErlangB(_0x11a331))[_0x0655('0x39')](this[_0x0655('0x1d7')](_0x11a331))[_0x0655('0x98')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x11a331));}else if(!ifInterval(_0x11a331[_0x0655('0x1d5')],_0x11a331[_0x0655('0x25')])){_0x11a331[_0x0655('0x1cc')]=0x0;_0x11a331[_0x0655('0x25')]=moment()[_0x0655('0x40')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x11a331[_0x0655('0x5b')],_0x0655('0x1d8'),_0x11a331['startPredictive']);clearInterval(_0x11a331[_0x0655('0x5e')]);_0x11a331['handlePredictive']=undefined;hopperUtils[_0x0655('0x1d4')](_0x11a331[_0x0655('0x1d5')])[_0x0655('0x39')](this[_0x0655('0x1d6')](_0x11a331))['then'](mergeDataErlangB(_0x11a331))[_0x0655('0x39')](this[_0x0655('0x1d7')](_0x11a331))[_0x0655('0x98')](loggerCatchPredictive(_0x0655('0x1d9'),_0x11a331));}else if(_0x11a331['predictiveIntervalAvailable']&&_0x4b56cc<_0x11a331[_0x0655('0x1c2')]-_0x42449d){clearPredictiveAttributes(_0x11a331);loggerPredictive[_0x0655('0x42')](_0x11a331[_0x0655('0x5b')],_0x0655('0x1da'),_0x4b56cc,')\x20are\x20less\x20than\x20threshold\x20(',_0x11a331[_0x0655('0x1c2')],'-',_0x42449d,'=',_0x11a331[_0x0655('0x1c2')]-_0x42449d,')');}else if(_0x11a331['predictiveIntervalAvailable']&&_0x4b56cc>_0x11a331['predictiveIntervalAvailable']+_0x57a5ac){clearPredictiveAttributes(_0x11a331);loggerPredictive[_0x0655('0x42')](_0x11a331[_0x0655('0x5b')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4b56cc,_0x0655('0x1db'),_0x11a331['predictiveIntervalAvailable'],'+',_0x57a5ac,'=',_0x11a331[_0x0655('0x1c2')]+_0x57a5ac,')');}};Dialer[_0x0655('0x81')][_0x0655('0x1d6')]=function(_0x5858a3){var _0x2a1b55=this;return function(_0x3b4ce1){return new Promise(function(_0x5da705,_0x1761c6){_[_0x0655('0x59')](_0x5858a3,_0x3b4ce1[0x0]);if(checkGetDataPredictive(_0x3b4ce1[0x0])){var _0x478f5d=_0x5858a3[_0x0655('0x1c2')]=_0x5858a3[_0x0655('0x140')]+_0x5858a3[_0x0655('0x1dc')];var _0x440ff9=_0x5858a3[_0x0655('0x1d5')]*0x3c;var _0x1a30e1=_0x3b4ce1[0x0][_0x0655('0x4d')]+_0x3b4ce1[0x0][_0x0655('0x4e')];var _0x2417a2=(_0x3b4ce1[0x0][_0x0655('0x1dd')]+_0x3b4ce1[0x0][_0x0655('0x46')]+_0x3b4ce1[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3b4ce1[0x0][_0x0655('0x4c')];_0x5858a3[_0x0655('0x1c5')]=_0x2417a2>0x0?_0x2417a2:0x1;switch(_0x5858a3[_0x0655('0x1cd')]){case _0x0655('0x1de'):var _0x41052c=_0x5858a3[_0x0655('0x1df')]/0x64;return _0x2a1b55[_0x0655('0x1e0')](_0x478f5d,_0x440ff9,_0x1a30e1,_0x2417a2,_0x41052c)['then'](function(_0x48d123){return _0x5da705(_0x48d123);});case'agentBusyFactor':var _0x18fc20=_0x5858a3[_0x0655('0x1df')]/0x64;return _0x2a1b55['busyFactor'](_0x478f5d,_0x440ff9,_0x1a30e1,_0x2417a2,_0x18fc20)[_0x0655('0x39')](function(_0x38bab7){return _0x5da705(_0x38bab7);});default:return _0x1761c6(msgResponse('[getDataPredictive]',_0x0655('0x8e'),'Unknown\x20Predictive'));}}else{return _0x1761c6(msgResponse(_0x0655('0x1e1'),_0x0655('0x8e'),_0x0655('0x1e2')));}});};};Dialer[_0x0655('0x81')][_0x0655('0x1e3')]=function(_0x57197a){var _0x23babc=this;return function(_0x3bfef8){return new Promise(function(_0x40dc2f,_0x1b85ae){_[_0x0655('0x59')](_0x57197a,_0x3bfef8[0x0]);if(checkGetDataPredictive(_0x3bfef8[0x0])){loggerPredictive['info'](JSON[_0x0655('0x80')](_0x3bfef8[0x0]));if(_0x57197a['dialPredictiveOptimization']===_0x0655('0x1de')){return _0x23babc[_0x0655('0x153')](_0x57197a['id'])[_0x0655('0x39')](function(_0xbb689d){var _0x2ec91b=_0x57197a[_0x0655('0x1e4')]-_0xbb689d[0x0][_0x0655('0x1e5')];var _0x45a560=_0x57197a['dialPredictiveInterval']*0x3c;var _0x3ccbb6=_0x3bfef8[0x0]['predictiveIntervalAvgTalktime']+_0x3bfef8[0x0]['predictiveIntervalAvgHoldtime'];var _0x2b05a8=(_0x3bfef8[0x0][_0x0655('0x1dd')]+_0x3bfef8[0x0][_0x0655('0x46')]+_0x3bfef8[0x0][_0x0655('0x48')])/_0x3bfef8[0x0][_0x0655('0x4c')];var _0x262d0c=_0x57197a[_0x0655('0x1df')]/0x64;_0x57197a[_0x0655('0x1e6')]=_0xbb689d[0x0][_0x0655('0x1e5')]||0x0;_0x57197a[_0x0655('0x1c5')]=_0x2b05a8>0x0?_0x2b05a8:0x1;return _0x23babc[_0x0655('0x1e0')](_0x2ec91b,_0x45a560,_0x3ccbb6,_0x2b05a8,_0x262d0c);})[_0x0655('0x39')](function(_0x49a4e4){return _0x40dc2f(_0x49a4e4);})[_0x0655('0x98')](function(_0xd2b6cb){return _0x1b85ae(msgResponse('[CatchErlangB]',_0x0655('0x8e'),JSON[_0x0655('0x80')](_0xd2b6cb)));});}if(_0x57197a[_0x0655('0x1cd')]===_0x0655('0x1e7')){return _0x23babc[_0x0655('0x153')](_0x57197a['id'])[_0x0655('0x39')](function(_0x21e990){var _0x4b9797=_0x57197a[_0x0655('0x1e4')]-_0x21e990[0x0][_0x0655('0x1e5')];var _0x619d34=_0x57197a[_0x0655('0x1d5')]*0x3c;var _0xf2dff2=_0x3bfef8[0x0]['predictiveIntervalAvgTalktime']+_0x3bfef8[0x0]['predictiveIntervalAvgHoldtime'];var _0x4b543e=(_0x3bfef8[0x0]['predictiveIntervalAnsweredCalls']+_0x3bfef8[0x0][_0x0655('0x46')]+_0x3bfef8[0x0][_0x0655('0x48')])/_0x3bfef8[0x0]['predictiveIntervalTotalCalls'];var _0x37e9aa=_0x57197a[_0x0655('0x1df')]/0x64;_0x57197a['predictiveIntervalPauses']=_0x21e990[0x0][_0x0655('0x1e5')]||0x0;_0x57197a[_0x0655('0x1c5')]=_0x4b543e>0x0?_0x4b543e:0x1;return _0x23babc[_0x0655('0x1e8')](_0x4b9797,_0x619d34,_0xf2dff2,_0x4b543e,_0x37e9aa);})[_0x0655('0x39')](function(_0x3ff499){return _0x40dc2f(_0x3ff499);})['catch'](function(_0x9c60e7){return _0x1b85ae(msgResponse(_0x0655('0x1e9'),_0x0655('0x8e'),JSON[_0x0655('0x80')](_0x9c60e7)));});}}else{return _0x1b85ae(msgResponse('[getDataPredictive]',_0x0655('0x8e'),_0x0655('0x1e2')));}});};};Dialer[_0x0655('0x81')][_0x0655('0x1d7')]=function(_0xb757fe){var _0x207004=this;return function(){var _0x3a25d6=0x0;var _0x45d5f3=Math[_0x0655('0x1c4')](_0xb757fe['erlangCallToSecond']*0x3e8);if(_0x45d5f3>0x0){_0x45d5f3=_0x45d5f3<0x64?0x64:_0x45d5f3;loggerPredictive[_0x0655('0x42')](_0xb757fe[_0x0655('0x5b')],'one\x20call\x20every:',_0x45d5f3,'milliseconds');_0xb757fe['handlePredictive']=setInterval(function(){_0x207004[_0x0655('0x5e')](_0xb757fe);loggerPredictiveCalls[_0x0655('0x42')](_0x0655('0x1ea'),_0x3a25d6+=0x1);},_0x45d5f3);}else{loggerPredictive['info'](_0xb757fe[_0x0655('0x5b')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0x0655('0x1eb')]=function(_0x5a7061,_0x1dd7e1){var _0x23b0c4=this;return function(_0x360256){if(_[_0x0655('0x41')](_0x360256)){if(_[_0x0655('0xee')](_0x1dd7e1[_0x0655('0x158')])||!_0x1dd7e1[_0x0655('0x1ec')]){if(_0x5a7061[_0x0655('0xa9')]===_0x0655('0xae')){_0x5a7061['queueStatusComplete']=_[_0x0655('0x3b')](_0x5a7061[_0x0655('0x6c')])?!![]:_0x5a7061[_0x0655('0x6c')];var _0x231429=uuid['v4']();_0x23b0c4[_0x0655('0x22')][_0x231429]=new Action(_0x5a7061,_0x1dd7e1,_0x231429);loggerBooked[_0x0655('0x42')]('[booked][checkContactBlack]',_0x231429,_0x0655('0x1ed'),JSON['stringify'](_0x5a7061[_0x0655('0x6c')]),_0x0655('0x1ee'),_0x5a7061[_0x0655('0x5b')]);if(_0x5a7061[_0x0655('0x6c')]){_0x5a7061[_0x0655('0x6c')]=![];_0x23b0c4[_0x0655('0x27')][_0x23b0c4['actions'][_0x231429]['queue']]=[];ami['Action']({'actionid':_0x231429,'action':_0x0655('0x1ef'),'queue':_0x5a7061['name']})[_0x0655('0x98')](function(){utils[_0x0655('0xb9')](_0x5a7061,_0x0655('0x1f0'));hopperUtils[_0x0655('0xd6')]({'active':![],'ContactId':_0x23b0c4[_0x0655('0x22')][_0x231429][_0x0655('0xe7')],'ListId':_0x23b0c4[_0x0655('0x22')][_0x231429][_0x0655('0xda')],'VoiceQueueId':_0x23b0c4['actions'][_0x231429][_0x0655('0xdb')]||undefined,'CampaignId':_0x23b0c4[_0x0655('0x22')][_0x231429]['CampaignId']||undefined})['catch'](loggerCatch(_0x0655('0x1f1')));delete _0x23b0c4[_0x0655('0x22')][_0x231429];});}else{loggerBooked[_0x0655('0x42')](_0x0655('0x1f2'),JSON[_0x0655('0x80')](_0x5a7061[_0x0655('0x6c')]),'Queue:\x20',_0x5a7061[_0x0655('0x5b')]);utils[_0x0655('0xb9')](_0x5a7061,_0x0655('0x1f0'));hopperUtils[_0x0655('0xd6')]({'active':![],'ContactId':_0x23b0c4[_0x0655('0x22')][_0x231429]['ContactId'],'ListId':_0x23b0c4[_0x0655('0x22')][_0x231429][_0x0655('0xda')],'VoiceQueueId':_0x23b0c4[_0x0655('0x22')][_0x231429]['VoiceQueueId']||undefined,'CampaignId':_0x23b0c4[_0x0655('0x22')][_0x231429]['CampaignId']||undefined})[_0x0655('0x98')](loggerCatch(_0x0655('0x1f1')));delete _0x23b0c4[_0x0655('0x22')][_0x231429];}}else{return _0x23b0c4['actionOriginate'](_0x5a7061,_0x1dd7e1);}}else{if(utils['getSeconds'](undefined,_0x1dd7e1[_0x0655('0x1f3')])<_0x5a7061[_0x0655('0x1f4')]*0x3c){if(_0x1dd7e1['Agent']&&!_0x1dd7e1['Agent'][_0x0655('0x1f5')]){_0x23b0c4['preview'][_0x0655('0xf3')](_0x1dd7e1['id'])['finally'](function(){utils[_0x0655('0xb9')](_0x5a7061,_0x0655('0x1f0'));});}else{hopperUtils[_0x0655('0x1f6')]({'active':![]},_0x1dd7e1['id'],0x1)[_0x0655('0x19')](function(){utils[_0x0655('0xb9')](_0x5a7061,_0x0655('0x1f0'));});}}else{_0x5a7061[_0x0655('0x1f7')]+=0x1;utils['decrementOriginate'](_0x5a7061,_0x0655('0x1f0'));if(_0x5a7061['dialRecallInQueue']){hopperUtils[_0x0655('0xd6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1dd7e1[_0x0655('0xe7')],'ListId':_0x1dd7e1[_0x0655('0xda')],'VoiceQueueId':_0x1dd7e1[_0x0655('0xdb')]||undefined,'CampaignId':_0x1dd7e1['CampaignId']||undefined})[_0x0655('0x98')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils['createHistory'](createObjHistory(_0x5a7061,_0x1dd7e1,utils[_0x0655('0x64')][_0x0655('0x1f8')],0x17,_0x0655('0x1f9')))[_0x0655('0x98')](loggerCatch(_0x0655('0x1fa')));}else{_0x23b0c4[_0x0655('0x115')](createObjHistory(_0x5a7061,_0x1dd7e1,utils[_0x0655('0x64')][_0x0655('0x1fb')],0x16,'RecallFailedTimeout'),_0x0655('0x1fc'),_0x0655('0x1fd'));}}}}else{_0x5a7061[_0x0655('0x1fe')]+=0x1;_0x23b0c4['saveInDb'](createObjHistory(_0x5a7061,_0x1dd7e1,utils['CAMPAIGN_STATUS']['BLACKLIST'],0xd,_0x0655('0x1ff')),'[Originate][historyBlacklist]',_0x0655('0x200'));throw _0x0655('0x201');}};};Dialer[_0x0655('0x81')][_0x0655('0x15d')]=function(_0x43cc8e){var _0x43f33b=this;var _0x5db358=_0x43cc8e[_0x0655('0x202')]-_0x43cc8e['originated'];emitCampaignSummary(_0x43cc8e);if(_0x5db358>0x0&&_0x43cc8e['temp']==0x0){if(_0x5db358>this[_0x0655('0x20')]){_0x5db358=this[_0x0655('0x20')];}_0x43cc8e[_0x0655('0x203')]=0x1;hopperUtils[_0x0655('0x204')](_0x43cc8e,_0x5db358)[_0x0655('0x39')](function(_0x51c050){_0x43cc8e[_0x0655('0x203')]=0x0;if(_0x51c050){if(!utils[_0x0655('0x205')](_0x51c050)){_0x43cc8e[_0x0655('0x63')]=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger[_0x0655('0x42')](_0x0655('0x206')+_0x43cc8e['name']);}else{_0x43cc8e['originated']+=_0x51c050['length'];_0x43cc8e[_0x0655('0x63')]=utils[_0x0655('0x64')][_0x0655('0x207')];for(var _0x2a087c=0x0;_0x2a087c<_0x51c050['length'];_0x2a087c+=0x1){_0x43cc8e[_0x0655('0x208')]+=0x1;if(_[_0x0655('0xee')](_0x51c050[_0x2a087c])||_['isNil'](_0x51c050[_0x2a087c][_0x0655('0x17d')])||_[_0x0655('0xee')](_0x51c050[_0x2a087c][_0x0655('0x161')])){_0x43f33b['emptyContact']('[actionOriginate]\x20',_0x43cc8e,_0x51c050[_0x2a087c]);}else{hopperUtils[_0x0655('0x209')](_[_0x0655('0x6f')](_0x51c050[_0x2a087c],[_0x0655('0xdc'),_0x0655('0x161')]))[_0x0655('0x39')](_0x43f33b['checkContactBlack'](_0x43cc8e,_0x51c050[_0x2a087c]))[_0x0655('0x98')](function(_0x2f9ace){logger[_0x0655('0x60')](_0x0655('0x20a'),_0x2f9ace);utils[_0x0655('0xb9')](_0x43cc8e,_0x0655('0x20b'));});}}}}})[_0x0655('0x98')](function(_0xd1c5a8){_0x43cc8e[_0x0655('0x203')]=0x0;logger[_0x0655('0x60')]('[getContactCampaign2]',_0xd1c5a8);});}};Dialer[_0x0655('0x81')]['handlePower']=function(_0xf096c6,_0x268276){var _0x2f6a0b=this;var _0x3d01b4=[];if(_0x268276<0x1||_0xf096c6[_0x0655('0xa9')]==='booked'){_0x268276=0x1;}var _0x58bc74=Math['floor'](_0xf096c6['available']*_0x268276)-_0xf096c6[_0x0655('0x7b')];if(_0xf096c6[_0x0655('0x20c')]>0x0){var _0x230546=_0xf096c6[_0x0655('0x20c')]-_0xf096c6['originated']-_0xf096c6[_0x0655('0x140')]-_0xf096c6['pTalking'];if(_0x58bc74>_0x230546){_0x58bc74=_0x230546;}}if(_0x58bc74>0x0&&_0xf096c6[_0x0655('0x203')]==0x0){if(_0xf096c6[_0x0655('0xa9')]===_0x0655('0xae')){_0x58bc74=0x1;}if(_0x58bc74>this[_0x0655('0x20')]){_0x58bc74=this[_0x0655('0x20')];}for(var _0x2a7f4b in this['agents']){if(typeof this[_0x0655('0x1e')][_0x2a7f4b]!==_0x0655('0xa2')){if(this[_0x0655('0x1e')][_0x2a7f4b][_0x0655('0xcb')]==='not_inuse'&&this[_0x0655('0x1e')][_0x2a7f4b]['status']==='reachable'){_0x3d01b4[_0x0655('0x20d')](this[_0x0655('0x1e')][_0x2a7f4b]['id']);}}}_0xf096c6[_0x0655('0x203')]=0x1;hopperUtils[_0x0655('0x20e')](_0xf096c6,_0x3d01b4,_0x58bc74)[_0x0655('0x39')](function(_0x3172fa){_0xf096c6[_0x0655('0x203')]=0x0;if(_0x3172fa){if(!utils[_0x0655('0x205')](_0x3172fa)){hopperUtils[_0x0655('0x20f')](_0xf096c6)['then'](sendMessageReschedule(_0xf096c6))['catch'](loggerCatch(_0x0655('0x210')));}else{_0xf096c6[_0x0655('0x7b')]+=_0x3172fa['length'];_0xf096c6[_0x0655('0x63')]=_0xf096c6[_0x0655('0xa9')]===_0x0655('0xae')?utils[_0x0655('0x64')][_0x0655('0x211')]:utils['CAMPAIGN_STATUS'][_0x0655('0x207')];for(var _0x3a0d45=0x0;_0x3a0d45<_0x3172fa[_0x0655('0xf8')];_0x3a0d45+=0x1){if(_[_0x0655('0xee')](_0x3172fa[_0x3a0d45])||_['isNil'](_0x3172fa[_0x3a0d45][_0x0655('0x17d')])||_[_0x0655('0xee')](_0x3172fa[_0x3a0d45][_0x0655('0x161')])){_0x2f6a0b[_0x0655('0x155')](_0x0655('0x212'),_0xf096c6,_0x3172fa[_0x3a0d45]);}else{hopperUtils[_0x0655('0x213')](_[_0x0655('0x6f')](_0x3172fa[_0x3a0d45],[_0x0655('0xdb'),_0x0655('0x161')]))['then'](_0x2f6a0b[_0x0655('0x1eb')](_0xf096c6,_0x3172fa[_0x3a0d45]))[_0x0655('0x98')](function(_0x26597a){logger['error'](_0x0655('0x214'),_0x26597a);utils[_0x0655('0xb9')](_0xf096c6,'[handlePower]');});}}}}})[_0x0655('0x98')](function(_0x4079bc){_0xf096c6[_0x0655('0x203')]=0x0;logger[_0x0655('0x60')](_0x0655('0x215'),_0x4079bc);});}};Dialer[_0x0655('0x81')][_0x0655('0x5e')]=function(_0x45cec5){if(_0x45cec5['dialLimitQueue']>0x0){var _0x5aeb12=_0x45cec5[_0x0655('0x20c')]-_0x45cec5[_0x0655('0x7b')]-_0x45cec5[_0x0655('0x140')];if(_0x5aeb12>0x0&&_0x45cec5[_0x0655('0x203')]==0x0){this[_0x0655('0x216')](_0x45cec5);}else{loggerPredictiveCalls[_0x0655('0x42')](_0x0655('0x217'));}}else{this[_0x0655('0x216')](_0x45cec5);}};Dialer[_0x0655('0x81')][_0x0655('0x216')]=function(_0x4d3de3){var _0x201cee=this;var _0x3b91ef=[];_0x4d3de3[_0x0655('0x7b')]+=0x1;for(var _0x5a69e8 in this[_0x0655('0x1e')]){if(typeof this[_0x0655('0x1e')][_0x5a69e8]!=='undefined'){if(this[_0x0655('0x1e')][_0x5a69e8][_0x0655('0xcb')]===_0x0655('0x218')&&this[_0x0655('0x1e')][_0x5a69e8]['status']===_0x0655('0x85')){_0x3b91ef['push'](this['agents'][_0x5a69e8]['id']);}}}_0x4d3de3[_0x0655('0x203')]=0x1;return this[_0x0655('0x20e')](_0x4d3de3['id'],_0x3b91ef,0x1,_0x4d3de3[_0x0655('0x219')],_0x4d3de3)[_0x0655('0x39')](function(_0x3e599a){_0x4d3de3[_0x0655('0x203')]=0x1;if(_0x3e599a){if(!utils[_0x0655('0x205')](_0x3e599a)){utils[_0x0655('0x21a')](_0x4d3de3,0x1,0x0);return hopperUtils['countReScheduled'](_0x4d3de3)[_0x0655('0x39')](sendMessageReschedule(_0x4d3de3))[_0x0655('0x98')](loggerCatch(_0x0655('0x210')));}else{_0x4d3de3[_0x0655('0x63')]=utils[_0x0655('0x64')][_0x0655('0x207')];if(_['isNil'](_0x3e599a[0x0])||_[_0x0655('0xee')](_0x3e599a[0x0][_0x0655('0x17d')])||_['isNil'](_0x3e599a[0x0]['phone'])){_0x201cee[_0x0655('0x155')](_0x0655('0x212'),_0x4d3de3,_0x3e599a[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x0655('0x6f')](_0x3e599a[0x0],[_0x0655('0xdb'),'phone']))['then'](_0x201cee[_0x0655('0x1eb')](_0x4d3de3,_0x3e599a[0x0]))[_0x0655('0x98')](function(_0x2741d2){logger[_0x0655('0x60')](_0x0655('0x21b'),_0x2741d2);utils[_0x0655('0xb9')](_0x4d3de3,_0x0655('0x21b'));});}}}})[_0x0655('0x98')](function(_0x5f2a25){_0x4d3de3[_0x0655('0x203')]=0x0;logger[_0x0655('0x60')](_0x0655('0x215'),_0x5f2a25);});};Dialer['prototype'][_0x0655('0x1e0')]=function(_0x4e7ee8,_0x1470d9,_0x2d429e,_0x253863,_0x438948,_0x5ea2d9){loggerPredictive[_0x0655('0x42')](_0x0655('0x21c'));loggerPredictive[_0x0655('0x42')](_0x0655('0x21d'),_0x4e7ee8);loggerPredictive[_0x0655('0x42')](_0x0655('0x21e'),_0x1470d9);loggerPredictive[_0x0655('0x42')](_0x0655('0x21f'),_0x2d429e);loggerPredictive['info'](_0x0655('0x220'),_0x253863);loggerPredictive[_0x0655('0x42')](_0x0655('0x221'),_0x438948);loggerPredictive['info']('---------------------------');return new Promise(function(_0x5c39e8,_0x5874ef){if(_0x4e7ee8<=0x0||isNaN(_0x4e7ee8)){return _0x5874ef(msgResponse(_0x0655('0x222'),_0x0655('0x191'),'m\x20=\x20'+_0x4e7ee8));}if(_0x2d429e<=0x0||isNaN(_0x2d429e)){return _0x5874ef(msgResponse(_0x0655('0x222'),_0x0655('0x191'),_0x0655('0x223')+_0x2d429e));}if(_0x253863<=0x0||isNaN(_0x253863)){return _0x5874ef(msgResponse(_0x0655('0x222'),'Error','p\x20=\x20'+_0x253863));}if(_0x1470d9<=0x0||isNaN(_0x1470d9)){return _0x5874ef(msgResponse('[abandonmentRate]','Error',_0x0655('0x224')+_0x1470d9));}if(_0x438948<=0x0||isNaN(_0x438948)){return _0x5874ef(msgResponse(_0x0655('0x222'),'Error',_0x0655('0x225')+_0x438948));}_0x5ea2d9=_0x5ea2d9||0x0;var _0x582348=0x1/_0x2d429e;var _0x1feeef=0x0;var _0x2ff1f3=0x0;var _0x498c81=0x0;var _0x533c26=0x0;for(var _0x5402b4=0x0;_0x498c81<_0x438948;_0x5402b4+=0x1){_0x2ff1f3=_0x5402b4/_0x1470d9;_0x1feeef=(_0x253863*_0x2ff1f3+_0x5ea2d9)/_0x582348;_0x498c81=utils[_0x0655('0x226')](_0x1feeef,_0x4e7ee8);_0x533c26=_0x1feeef/_0x4e7ee8*(0x1-utils[_0x0655('0x226')](_0x1feeef,_0x4e7ee8));}return _0x5c39e8({'erlangCalls':_0x5402b4,'erlangCallToSecond':_0x1470d9/_0x5402b4,'erlangAbandonmentRate':_0x498c81,'erlangBusyFactor':_0x533c26});});};Dialer[_0x0655('0x81')][_0x0655('0x1e8')]=function(_0x422ba0,_0x54a26d,_0x24c693,_0x515bc4,_0x4128a2,_0x1b2a2a){loggerPredictive[_0x0655('0x42')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0x0655('0x21d'),_0x422ba0);loggerPredictive[_0x0655('0x42')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54a26d);loggerPredictive[_0x0655('0x42')]('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x24c693);loggerPredictive[_0x0655('0x42')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x515bc4);loggerPredictive[_0x0655('0x42')](_0x0655('0x227'),_0x4128a2);loggerPredictive[_0x0655('0x42')](_0x0655('0x4b'));return new Promise(function(_0x5984b0,_0x464aad){if(_0x422ba0<=0x0||isNaN(_0x422ba0)){return _0x464aad(msgResponse(_0x0655('0x228'),_0x0655('0x191'),'m\x20=\x20'+_0x422ba0));}if(_0x24c693<=0x0||isNaN(_0x24c693)){return _0x464aad(msgResponse(_0x0655('0x228'),_0x0655('0x191'),_0x0655('0x223')+_0x24c693));}if(_0x515bc4<=0x0||isNaN(_0x515bc4)){return _0x464aad(msgResponse(_0x0655('0x228'),_0x0655('0x191'),'p\x20=\x20'+_0x515bc4));}if(_0x54a26d<=0x0||isNaN(_0x54a26d)){return _0x464aad(msgResponse(_0x0655('0x228'),'Error',_0x0655('0x224')+_0x54a26d));}if(_0x4128a2<=0x0||isNaN(_0x4128a2)){return _0x464aad(msgResponse(_0x0655('0x228'),_0x0655('0x191'),'Umin\x20=\x20'+_0x4128a2));}_0x1b2a2a=_0x1b2a2a||0x0;var _0x27e2e7=0x1/_0x24c693;var _0x187a20=0x0;var _0x3acec7=0x0;var _0x28ae48=0x0;var _0x52630c=0x0;for(var _0x9235f1=0x0;_0x52630c<_0x4128a2;_0x9235f1+=0x1){_0x3acec7=_0x9235f1/_0x54a26d;_0x187a20=(_0x515bc4*_0x3acec7+_0x1b2a2a)/_0x27e2e7;_0x28ae48=utils['erlangb'](_0x187a20,_0x422ba0);_0x52630c=_0x187a20/_0x422ba0*(0x1-utils[_0x0655('0x226')](_0x187a20,_0x422ba0));}return _0x5984b0({'erlangCalls':_0x9235f1,'erlangCallToSecond':_0x54a26d/_0x9235f1,'erlangAbandonmentRate':_0x28ae48,'erlangBusyFactor':_0x52630c});});};module[_0x0655('0x229')]=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 ab08ff5..0bc8d5a 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 _0x10da=['callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','prototype','getQueue','queue','util','lodash','moment','isNil','string','voiceQueue','name','phone','Contact','firstName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','CampaignId','ContactFirstName','starttime','format','callback'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x10da,0x15b));var _0xa10d=function(_0x2e0c62,_0xab72b5){_0x2e0c62=_0x2e0c62-0x0;var _0x558131=_0x10da[_0x2e0c62];return _0x558131;};'use strict';var util=require(_0xa10d('0x0'));var _=require(_0xa10d('0x1'));var moment=require(_0xa10d('0x2'));function checkNameSurname(_0x299beb,_0x18cd0e,_0x57a160){var _0x471207='';if(!_[_0xa10d('0x3')](_0x18cd0e)&&'string'===typeof _0x18cd0e){_0x471207+=_0x18cd0e;}if(!_[_0xa10d('0x3')](_0x57a160)&&_0xa10d('0x4')===typeof _0x57a160){_0x471207+='\x20'+_0x57a160;}if(_0x471207!==''){return _0x471207;}return _0x299beb;}function Action(_0x6d6dc4,_0x4bdee3,_0x54c00a){this[_0xa10d('0x5')]=_0x6d6dc4;this['uniqueid']=_0x54c00a||undefined;this[_0xa10d('0x6')]=checkNameSurname(_0x4bdee3['Contact'][_0xa10d('0x7')],_0x4bdee3[_0xa10d('0x8')][_0xa10d('0x9')],_0x4bdee3[_0xa10d('0x8')]['lastName']);this[_0xa10d('0xa')]=_0x4bdee3[_0xa10d('0x7')];this['queue']=_0x6d6dc4['name'];this[_0xa10d('0xb')]=_0x4bdee3[_0xa10d('0xb')]||![];this[_0xa10d('0xc')]=_0x6d6dc4['type'];this[_0xa10d('0xd')]=_0x6d6dc4[_0xa10d('0xd')]||0x3;this['scheduledat']=_0x4bdee3[_0xa10d('0xe')];this['countbusyretry']=_0x4bdee3[_0xa10d('0xf')];this[_0xa10d('0x10')]=_0x4bdee3['countcongestionretry'];this[_0xa10d('0x11')]=_0x4bdee3[_0xa10d('0x11')];this['countnosuchnumberretry']=_0x4bdee3[_0xa10d('0x12')];this['countdropretry']=_0x4bdee3[_0xa10d('0x13')];this[_0xa10d('0x14')]=_0x4bdee3[_0xa10d('0x14')];this['countmachineretry']=_0x4bdee3[_0xa10d('0x15')];this[_0xa10d('0x16')]=_0x4bdee3['countagentrejectretry'];this['ContactId']=_0x4bdee3[_0xa10d('0x17')];this[_0xa10d('0x18')]=_0x4bdee3[_0xa10d('0x18')];this[_0xa10d('0x19')]=_0x4bdee3[_0xa10d('0x19')];this['VoiceQueueId']=_0x4bdee3['VoiceQueueId'];this[_0xa10d('0x1a')]=_0x4bdee3['CampaignId'];this['idHopper']=_0x4bdee3['id'];this[_0xa10d('0x1b')]=_0x4bdee3[_0xa10d('0x8')][_0xa10d('0x9')]||'';this[_0xa10d('0x1c')]=moment()[_0xa10d('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa10d('0x1e')]=_0x4bdee3[_0xa10d('0x1e')];this[_0xa10d('0x1f')]=_0x4bdee3[_0xa10d('0x1f')];this[_0xa10d('0x20')]=_0x4bdee3[_0xa10d('0x20')];this['recallme']=_0x4bdee3[_0xa10d('0x21')];this[_0xa10d('0x22')]='';this[_0xa10d('0x23')]='';}Action['prototype'][_0xa10d('0x24')]=function(){return util[_0xa10d('0x1d')](_0xa10d('0x25'),this[_0xa10d('0x6')],this[_0xa10d('0x5')][_0xa10d('0x26')]>0x0?this[_0xa10d('0xa')]['substring'](this['voiceQueue'][_0xa10d('0x26')]):this[_0xa10d('0xa')]);};Action[_0xa10d('0x27')][_0xa10d('0x28')]=function(){return this[_0xa10d('0x29')];};module['exports']=Action; \ No newline at end of file +var _0x76b0=['idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','substring','dialCutDigit','getQueue','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x113a6c,_0x10df30){var _0x1ac632=function(_0xbd4fb9){while(--_0xbd4fb9){_0x113a6c['push'](_0x113a6c['shift']());}};_0x1ac632(++_0x10df30);}(_0x76b0,0x16f));var _0x076b=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x76b0[_0x2aea9e];return _0x430b92;};'use strict';var util=require(_0x076b('0x0'));var _=require('lodash');var moment=require(_0x076b('0x1'));function checkNameSurname(_0x1ce7f2,_0x484050,_0x33c3ef){var _0x5caf2c='';if(!_[_0x076b('0x2')](_0x484050)&&_0x076b('0x3')===typeof _0x484050){_0x5caf2c+=_0x484050;}if(!_[_0x076b('0x2')](_0x33c3ef)&&_0x076b('0x3')===typeof _0x33c3ef){_0x5caf2c+='\x20'+_0x33c3ef;}if(_0x5caf2c!==''){return _0x5caf2c;}return _0x1ce7f2;}function Action(_0x494f07,_0x20b008,_0x11c550){this[_0x076b('0x4')]=_0x494f07;this[_0x076b('0x5')]=_0x11c550||undefined;this[_0x076b('0x6')]=checkNameSurname(_0x20b008[_0x076b('0x7')][_0x076b('0x8')],_0x20b008[_0x076b('0x7')][_0x076b('0x9')],_0x20b008[_0x076b('0x7')][_0x076b('0xa')]);this[_0x076b('0xb')]=_0x20b008[_0x076b('0x8')];this[_0x076b('0xc')]=_0x494f07[_0x076b('0x6')];this[_0x076b('0xd')]=_0x20b008[_0x076b('0xd')]||![];this[_0x076b('0xe')]=_0x494f07[_0x076b('0xe')];this[_0x076b('0xf')]=_0x494f07[_0x076b('0xf')]||0x3;this[_0x076b('0x10')]=_0x20b008[_0x076b('0x10')];this[_0x076b('0x11')]=_0x20b008[_0x076b('0x11')];this[_0x076b('0x12')]=_0x20b008[_0x076b('0x12')];this[_0x076b('0x13')]=_0x20b008[_0x076b('0x13')];this[_0x076b('0x14')]=_0x20b008[_0x076b('0x14')];this['countdropretry']=_0x20b008[_0x076b('0x15')];this[_0x076b('0x16')]=_0x20b008[_0x076b('0x16')];this[_0x076b('0x17')]=_0x20b008['countmachineretry'];this[_0x076b('0x18')]=_0x20b008[_0x076b('0x18')];this[_0x076b('0x19')]=_0x20b008[_0x076b('0x19')];this['ListId']=_0x20b008[_0x076b('0x1a')];this[_0x076b('0x1b')]=_0x20b008[_0x076b('0x1b')];this[_0x076b('0x1c')]=_0x20b008[_0x076b('0x1c')];this['CampaignId']=_0x20b008['CampaignId'];this[_0x076b('0x1d')]=_0x20b008['id'];this[_0x076b('0x1e')]=_0x20b008['Contact'][_0x076b('0x9')]||'';this[_0x076b('0x1f')]=moment()[_0x076b('0x20')](_0x076b('0x21'));this[_0x076b('0x22')]=_0x20b008[_0x076b('0x22')];this[_0x076b('0x23')]=_0x20b008[_0x076b('0x23')];this['callbackat']=_0x20b008['callbackat'];this[_0x076b('0x24')]=_0x20b008['recallme'];this[_0x076b('0x25')]='';this[_0x076b('0x26')]='';}Action[_0x076b('0x27')]['getCaller']=function(){return util[_0x076b('0x20')](_0x076b('0x28'),this[_0x076b('0x6')],this[_0x076b('0x4')]['dialCutDigit']>0x0?this['number'][_0x076b('0x29')](this['voiceQueue'][_0x076b('0x2a')]):this[_0x076b('0xb')]);};Action[_0x076b('0x27')][_0x076b('0x2b')]=function(){return this[_0x076b('0xc')];};module['exports']=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 e2a23b0..ab96c22 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 _0x3559=['originatecalleridname','agiafterat','exports','moment','../utils','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','starttime','answertime','format','getSeconds','responsetime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum'];(function(_0x2b34f2,_0x3c5a6a){var _0x497f1f=function(_0x19c411){while(--_0x19c411){_0x2b34f2['push'](_0x2b34f2['shift']());}};_0x497f1f(++_0x3c5a6a);}(_0x3559,0x14b));var _0x9355=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3559[_0x4565bf];return _0x5610ba;};'use strict';var moment=require(_0x9355('0x0'));var utils=require(_0x9355('0x1'));function AgentComplete(_0x36cf5e,_0xab9437){this['state']=0x4;this['statedesc']=_0x9355('0x2');this[_0x9355('0x3')]=_0x36cf5e[_0x9355('0x3')];this[_0x9355('0x4')]=_0x36cf5e['type'];this[_0x9355('0x5')]=_0x36cf5e[_0x9355('0x4')]===_0x9355('0x6')?_0x9355('0x7'):_0x36cf5e[_0x9355('0x4')];this[_0x9355('0x8')]=_0x36cf5e[_0x9355('0x8')];this[_0x9355('0x9')]=_0x36cf5e[_0x9355('0x9')];this[_0x9355('0xa')]=_0x36cf5e[_0x9355('0xa')];this[_0x9355('0xb')]=_0x36cf5e[_0x9355('0x8')]+_0x36cf5e['countcongestionretry']+_0x36cf5e[_0x9355('0xa')]+_0x36cf5e[_0x9355('0xc')]+_0x36cf5e[_0x9355('0xd')]+_0x36cf5e[_0x9355('0xe')]+_0x36cf5e['countmachineretry']+_0x36cf5e[_0x9355('0xf')];this[_0x9355('0xc')]=_0x36cf5e[_0x9355('0xc')];this[_0x9355('0xd')]=_0x36cf5e['countdropretry'];this['countabandonedretry']=_0x36cf5e[_0x9355('0xe')];this[_0x9355('0x10')]=_0x36cf5e[_0x9355('0x10')];this[_0x9355('0xf')]=_0x36cf5e[_0x9355('0xf')];this[_0x9355('0x11')]=_0xab9437[_0x9355('0x11')];this[_0x9355('0x12')]=_0x36cf5e[_0x9355('0x13')];this[_0x9355('0x14')]=_0x36cf5e['number'];this[_0x9355('0x15')]=_0x36cf5e[_0x9355('0x15')];this['responsetime']=_0x36cf5e['responsetime'];this['answertime']=_0x36cf5e[_0x9355('0x16')];this['endtime']=moment()[_0x9355('0x17')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=utils[_0x9355('0x18')](_0x36cf5e[_0x9355('0x19')],_0x36cf5e[_0x9355('0x15')]);this[_0x9355('0x1a')]=utils['getSeconds'](_0x36cf5e[_0x9355('0x16')],_0x36cf5e[_0x9355('0x19')]);this['talktime']=utils['getSeconds'](this['endtime'],_0x36cf5e[_0x9355('0x16')]);this['queue']=_0xab9437[_0x9355('0x7')];this[_0x9355('0x1b')]=_0xab9437[_0x9355('0x1b')];this['reason']=_0xab9437[_0x9355('0x1c')];this[_0x9355('0x1d')]=_0x36cf5e[_0x9355('0x1d')];this['callbackuniqueid']=_0x36cf5e[_0x9355('0x1e')];this[_0x9355('0x1f')]=_0x36cf5e[_0x9355('0x1f')];this[_0x9355('0x20')]=_0x36cf5e['recallme'];this[_0x9355('0x21')]=_0x36cf5e['ContactId'];this[_0x9355('0x22')]=_0x36cf5e[_0x9355('0x22')];this[_0x9355('0x23')]=_0x36cf5e[_0x9355('0x23')];this['VoiceQueueId']=_0x36cf5e['VoiceQueueId'];this[_0x9355('0x24')]=_0x36cf5e[_0x9355('0x24')];this[_0x9355('0x25')]=_0x36cf5e['originatecalleridnum']||'';this[_0x9355('0x26')]=_0x36cf5e[_0x9355('0x26')]||'';this['agiafterat']=_0x36cf5e[_0x9355('0x27')];}module[_0x9355('0x28')]=AgentComplete; \ No newline at end of file +var _0xc7ed=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','statedesc','Answer','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xc7ed,0xb7));var _0xdc7e=function(_0x924c29,_0x309120){_0x924c29=_0x924c29-0x0;var _0x24ddd6=_0xc7ed[_0x924c29];return _0x24ddd6;};'use strict';var moment=require(_0xdc7e('0x0'));var utils=require(_0xdc7e('0x1'));function AgentComplete(_0x2935b7,_0x54d1e9){this['state']=0x4;this[_0xdc7e('0x2')]=_0xdc7e('0x3');this['scheduledat']=_0x2935b7[_0xdc7e('0x4')];this[_0xdc7e('0x5')]=_0x2935b7['type'];this['campaigntype']=_0x2935b7[_0xdc7e('0x5')]===_0xdc7e('0x6')?'queue':_0x2935b7[_0xdc7e('0x5')];this[_0xdc7e('0x7')]=_0x2935b7['countbusyretry'];this[_0xdc7e('0x8')]=_0x2935b7[_0xdc7e('0x8')];this[_0xdc7e('0x9')]=_0x2935b7[_0xdc7e('0x9')];this['countglobal']=_0x2935b7[_0xdc7e('0x7')]+_0x2935b7['countcongestionretry']+_0x2935b7['countnoanswerretry']+_0x2935b7['countnosuchnumberretry']+_0x2935b7[_0xdc7e('0xa')]+_0x2935b7[_0xdc7e('0xb')]+_0x2935b7[_0xdc7e('0xc')]+_0x2935b7[_0xdc7e('0xd')];this[_0xdc7e('0xe')]=_0x2935b7['countnosuchnumberretry'];this[_0xdc7e('0xa')]=_0x2935b7['countdropretry'];this['countabandonedretry']=_0x2935b7[_0xdc7e('0xb')];this[_0xdc7e('0xc')]=_0x2935b7[_0xdc7e('0xc')];this['countagentrejectretry']=_0x2935b7[_0xdc7e('0xd')];this[_0xdc7e('0xf')]=_0x54d1e9[_0xdc7e('0xf')];this[_0xdc7e('0x10')]=_0x2935b7[_0xdc7e('0x11')];this['calleridnum']=_0x2935b7[_0xdc7e('0x12')];this['starttime']=_0x2935b7[_0xdc7e('0x13')];this['responsetime']=_0x2935b7[_0xdc7e('0x14')];this['answertime']=_0x2935b7[_0xdc7e('0x15')];this['endtime']=moment()[_0xdc7e('0x16')](_0xdc7e('0x17'));this[_0xdc7e('0x18')]=utils[_0xdc7e('0x19')](_0x2935b7[_0xdc7e('0x14')],_0x2935b7[_0xdc7e('0x13')]);this[_0xdc7e('0x1a')]=utils[_0xdc7e('0x19')](_0x2935b7['answertime'],_0x2935b7['responsetime']);this[_0xdc7e('0x1b')]=utils['getSeconds'](this['endtime'],_0x2935b7[_0xdc7e('0x15')]);this[_0xdc7e('0x1c')]=_0x54d1e9['queue'];this[_0xdc7e('0x1d')]=_0x54d1e9[_0xdc7e('0x1d')];this[_0xdc7e('0x1e')]=_0x54d1e9['reason'];this['callback']=_0x2935b7[_0xdc7e('0x1f')];this[_0xdc7e('0x20')]=_0x2935b7[_0xdc7e('0x20')];this[_0xdc7e('0x21')]=_0x2935b7[_0xdc7e('0x21')];this[_0xdc7e('0x22')]=_0x2935b7[_0xdc7e('0x22')];this[_0xdc7e('0x23')]=_0x2935b7[_0xdc7e('0x23')];this[_0xdc7e('0x24')]=_0x2935b7['ListId'];this[_0xdc7e('0x25')]=_0x2935b7['UserId'];this[_0xdc7e('0x26')]=_0x2935b7[_0xdc7e('0x26')];this[_0xdc7e('0x27')]=_0x2935b7[_0xdc7e('0x27')];this['originatecalleridnum']=_0x2935b7[_0xdc7e('0x28')]||'';this['originatecalleridname']=_0x2935b7[_0xdc7e('0x29')]||'';this[_0xdc7e('0x2a')]=_0x2935b7[_0xdc7e('0x2a')];}module[_0xdc7e('0x2b')]=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 084ac6d..fa3ad29 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 _0xe0db=['CampaignId','originatecalleridnum','state','statedesc','exports','uniqueid','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x4168dd,_0x11c7bf){var _0x205683=function(_0x40c156){while(--_0x40c156){_0x4168dd['push'](_0x4168dd['shift']());}};_0x205683(++_0x11c7bf);}(_0xe0db,0x1d3));var _0xbe0d=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0xe0db[_0x381589];return _0x2a075d;};'use strict';function Final(_0x372d59){this[_0xbe0d('0x0')]=_0x372d59['uniqueid'];this[_0xbe0d('0x1')]=_0x372d59[_0xbe0d('0x1')];this['type']=_0x372d59[_0xbe0d('0x2')];this['campaigntype']=_0x372d59[_0xbe0d('0x2')]==='outbound'?'queue':_0x372d59[_0xbe0d('0x2')];this[_0xbe0d('0x3')]=_0x372d59['countbusyretry'];this[_0xbe0d('0x4')]=_0x372d59[_0xbe0d('0x4')];this['countnoanswerretry']=_0x372d59[_0xbe0d('0x5')];this[_0xbe0d('0x6')]=_0x372d59[_0xbe0d('0x3')]+_0x372d59['countcongestionretry']+_0x372d59['countnoanswerretry']+_0x372d59[_0xbe0d('0x7')]+_0x372d59[_0xbe0d('0x8')]+_0x372d59['countabandonedretry']+_0x372d59[_0xbe0d('0x9')]+_0x372d59[_0xbe0d('0xa')];this[_0xbe0d('0x7')]=_0x372d59[_0xbe0d('0x7')];this[_0xbe0d('0x8')]=_0x372d59['countdropretry'];this[_0xbe0d('0xb')]=_0x372d59['countabandonedretry'];this[_0xbe0d('0x9')]=_0x372d59[_0xbe0d('0x9')];this[_0xbe0d('0xa')]=_0x372d59['countagentrejectretry'];this[_0xbe0d('0xc')]=_0x372d59[_0xbe0d('0xc')];this[_0xbe0d('0xd')]=_0x372d59[_0xbe0d('0xd')];this[_0xbe0d('0xe')]=_0x372d59['calleridnum'];this['starttime']=_0x372d59[_0xbe0d('0xf')];this[_0xbe0d('0x10')]=_0x372d59[_0xbe0d('0x10')];this['endtime']=_0x372d59[_0xbe0d('0x10')];this[_0xbe0d('0x11')]=_0x372d59[_0xbe0d('0x11')]||0x0;this[_0xbe0d('0x12')]=_0x372d59[_0xbe0d('0x12')]||0x0;this[_0xbe0d('0x13')]=_0x372d59[_0xbe0d('0x13')]||0x0;this[_0xbe0d('0x14')]=_0x372d59[_0xbe0d('0x14')];this[_0xbe0d('0x15')]=_0x372d59[_0xbe0d('0x15')];this[_0xbe0d('0x16')]=_0x372d59[_0xbe0d('0x16')];this['recallme']=_0x372d59[_0xbe0d('0x17')];this['ContactId']=_0x372d59[_0xbe0d('0x18')];this['ListId']=_0x372d59[_0xbe0d('0x19')];this[_0xbe0d('0x1a')]=_0x372d59[_0xbe0d('0x1a')];this[_0xbe0d('0x1b')]=_0x372d59[_0xbe0d('0x1b')];this[_0xbe0d('0x1c')]=_0x372d59[_0xbe0d('0x1c')];this[_0xbe0d('0x1d')]=_0x372d59[_0xbe0d('0x1d')]||'';this['originatecalleridname']=_0x372d59['originatecalleridname']||'';this[_0xbe0d('0x1e')]=_0x372d59[_0xbe0d('0x1e')];this[_0xbe0d('0x1f')]=_0x372d59[_0xbe0d('0x1f')];}module[_0xbe0d('0x20')]=Final; \ No newline at end of file +var _0xd011=['countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry'];(function(_0x1d6ca0,_0x42843b){var _0x38990a=function(_0x27f6e5){while(--_0x27f6e5){_0x1d6ca0['push'](_0x1d6ca0['shift']());}};_0x38990a(++_0x42843b);}(_0xd011,0x9d));var _0x1d01=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd011[_0x3dd15e];return _0x231fd0;};'use strict';function Final(_0x4feb2a){this[_0x1d01('0x0')]=_0x4feb2a['uniqueid'];this[_0x1d01('0x1')]=_0x4feb2a['scheduledat'];this[_0x1d01('0x2')]=_0x4feb2a[_0x1d01('0x2')];this[_0x1d01('0x3')]=_0x4feb2a[_0x1d01('0x2')]==='outbound'?_0x1d01('0x4'):_0x4feb2a['type'];this['countbusyretry']=_0x4feb2a[_0x1d01('0x5')];this['countcongestionretry']=_0x4feb2a[_0x1d01('0x6')];this[_0x1d01('0x7')]=_0x4feb2a['countnoanswerretry'];this[_0x1d01('0x8')]=_0x4feb2a[_0x1d01('0x5')]+_0x4feb2a[_0x1d01('0x6')]+_0x4feb2a[_0x1d01('0x7')]+_0x4feb2a[_0x1d01('0x9')]+_0x4feb2a[_0x1d01('0xa')]+_0x4feb2a[_0x1d01('0xb')]+_0x4feb2a['countmachineretry']+_0x4feb2a[_0x1d01('0xc')];this['countnosuchnumberretry']=_0x4feb2a[_0x1d01('0x9')];this['countdropretry']=_0x4feb2a[_0x1d01('0xa')];this[_0x1d01('0xb')]=_0x4feb2a[_0x1d01('0xb')];this[_0x1d01('0xd')]=_0x4feb2a['countmachineretry'];this[_0x1d01('0xc')]=_0x4feb2a[_0x1d01('0xc')];this[_0x1d01('0x4')]=_0x4feb2a[_0x1d01('0x4')];this[_0x1d01('0xe')]=_0x4feb2a[_0x1d01('0xe')];this[_0x1d01('0xf')]=_0x4feb2a['calleridnum'];this['starttime']=_0x4feb2a[_0x1d01('0x10')];this[_0x1d01('0x11')]=_0x4feb2a[_0x1d01('0x11')];this[_0x1d01('0x12')]=_0x4feb2a[_0x1d01('0x11')];this[_0x1d01('0x13')]=_0x4feb2a[_0x1d01('0x13')]||0x0;this[_0x1d01('0x14')]=_0x4feb2a[_0x1d01('0x14')]||0x0;this[_0x1d01('0x15')]=_0x4feb2a[_0x1d01('0x15')]||0x0;this[_0x1d01('0x16')]=_0x4feb2a[_0x1d01('0x16')];this[_0x1d01('0x17')]=_0x4feb2a[_0x1d01('0x17')];this[_0x1d01('0x18')]=_0x4feb2a[_0x1d01('0x18')];this[_0x1d01('0x19')]=_0x4feb2a[_0x1d01('0x19')];this[_0x1d01('0x1a')]=_0x4feb2a[_0x1d01('0x1a')];this[_0x1d01('0x1b')]=_0x4feb2a['ListId'];this[_0x1d01('0x1c')]=_0x4feb2a['UserId'];this['VoiceQueueId']=_0x4feb2a[_0x1d01('0x1d')];this['CampaignId']=_0x4feb2a['CampaignId'];this[_0x1d01('0x1e')]=_0x4feb2a['originatecalleridnum']||'';this['originatecalleridname']=_0x4feb2a['originatecalleridname']||'';this[_0x1d01('0x1f')]=_0x4feb2a[_0x1d01('0x1f')];this[_0x1d01('0x20')]=_0x4feb2a[_0x1d01('0x20')];}module[_0x1d01('0x21')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 7e1d3cd..31f2ff1 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 _0x3853=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','number','starttime','responsetime','format','ringtime','holdtime','talktime','getSeconds','endtime','membername','cause-txt','callback','callbackat','recallme'];(function(_0x119629,_0x246787){var _0x49a771=function(_0x23624c){while(--_0x23624c){_0x119629['push'](_0x119629['shift']());}};_0x49a771(++_0x246787);}(_0x3853,0x84));var _0x3385=function(_0x4005e8,_0x4aefca){_0x4005e8=_0x4005e8-0x0;var _0xa7cdf7=_0x3853[_0x4005e8];return _0xa7cdf7;};'use strict';var moment=require(_0x3385('0x0'));var utils=require(_0x3385('0x1'));function Hangup(_0x311c11,_0x371b47){this[_0x3385('0x2')]=0x4;this[_0x3385('0x3')]=_0x3385('0x4');this[_0x3385('0x5')]=_0x311c11[_0x3385('0x5')];this['type']=_0x311c11[_0x3385('0x6')];this['campaigntype']=_0x311c11[_0x3385('0x6')]===_0x3385('0x7')?_0x3385('0x8'):_0x311c11[_0x3385('0x6')];this[_0x3385('0x9')]=_0x311c11[_0x3385('0x9')]||![];this[_0x3385('0xa')]=_0x311c11['countbusyretry'];this['countcongestionretry']=_0x311c11[_0x3385('0xb')];this[_0x3385('0xc')]=_0x311c11[_0x3385('0xc')];this[_0x3385('0xd')]=_0x311c11['countbusyretry']+_0x311c11[_0x3385('0xb')]+_0x311c11['countnoanswerretry']+_0x311c11['countnosuchnumberretry']+_0x311c11[_0x3385('0xe')]+_0x311c11[_0x3385('0xf')]+_0x311c11[_0x3385('0x10')]+_0x311c11[_0x3385('0x11')];this[_0x3385('0x12')]=_0x311c11[_0x3385('0x12')];this['countdropretry']=_0x311c11['countdropretry'];this[_0x3385('0xf')]=_0x311c11[_0x3385('0xf')];this[_0x3385('0x10')]=_0x311c11[_0x3385('0x10')];this[_0x3385('0x11')]=_0x311c11['countagentrejectretry'];this[_0x3385('0x13')]=_0x371b47[_0x3385('0x13')];this[_0x3385('0x14')]=_0x311c11[_0x3385('0x15')];this['calleridnum']=_0x311c11[_0x3385('0x16')];this[_0x3385('0x17')]=_0x311c11['starttime'];this[_0x3385('0x18')]=_0x311c11[_0x3385('0x18')];this['endtime']=moment()[_0x3385('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3385('0x1a')]=utils['getSeconds'](_0x311c11[_0x3385('0x18')],_0x311c11[_0x3385('0x17')]);this[_0x3385('0x1b')]=0x0;this[_0x3385('0x1c')]=utils[_0x3385('0x1d')](this[_0x3385('0x1e')],_0x311c11[_0x3385('0x18')]);this[_0x3385('0x8')]=_0x311c11[_0x3385('0x8')];this[_0x3385('0x1f')]='IVR';this['reason']=_0x371b47[_0x3385('0x20')];this[_0x3385('0x21')]=_0x311c11[_0x3385('0x21')];this['callbackuniqueid']=_0x311c11['callbackuniqueid'];this[_0x3385('0x22')]=_0x311c11['callbackat'];this[_0x3385('0x23')]=_0x311c11['recallme'];this[_0x3385('0x24')]=_0x311c11[_0x3385('0x24')];this[_0x3385('0x25')]=_0x311c11['ListId'];this['UserId']=_0x311c11[_0x3385('0x26')];this['VoiceQueueId']=_0x311c11[_0x3385('0x27')];this['CampaignId']=_0x311c11[_0x3385('0x28')];}module[_0x3385('0x29')]=Hangup; \ No newline at end of file +var _0x1679=['number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','queue','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','exports','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid'];(function(_0x3b3516,_0x52fade){var _0x4966fa=function(_0x4fa616){while(--_0x4fa616){_0x3b3516['push'](_0x3b3516['shift']());}};_0x4966fa(++_0x52fade);}(_0x1679,0xff));var _0x9167=function(_0x546c77,_0x450d10){_0x546c77=_0x546c77-0x0;var _0x354ce0=_0x1679[_0x546c77];return _0x354ce0;};'use strict';var moment=require('moment');var utils=require(_0x9167('0x0'));function Hangup(_0x499954,_0x9cc7ea){this[_0x9167('0x1')]=0x4;this[_0x9167('0x2')]=_0x9167('0x3');this[_0x9167('0x4')]=_0x499954[_0x9167('0x4')];this[_0x9167('0x5')]=_0x499954[_0x9167('0x5')];this[_0x9167('0x6')]=_0x499954[_0x9167('0x5')]===_0x9167('0x7')?'queue':_0x499954['type'];this[_0x9167('0x8')]=_0x499954[_0x9167('0x8')]||![];this[_0x9167('0x9')]=_0x499954['countbusyretry'];this['countcongestionretry']=_0x499954[_0x9167('0xa')];this[_0x9167('0xb')]=_0x499954[_0x9167('0xb')];this['countglobal']=_0x499954[_0x9167('0x9')]+_0x499954['countcongestionretry']+_0x499954[_0x9167('0xb')]+_0x499954[_0x9167('0xc')]+_0x499954[_0x9167('0xd')]+_0x499954['countabandonedretry']+_0x499954[_0x9167('0xe')]+_0x499954[_0x9167('0xf')];this[_0x9167('0xc')]=_0x499954[_0x9167('0xc')];this[_0x9167('0xd')]=_0x499954['countdropretry'];this['countabandonedretry']=_0x499954[_0x9167('0x10')];this[_0x9167('0xe')]=_0x499954[_0x9167('0xe')];this[_0x9167('0xf')]=_0x499954[_0x9167('0xf')];this[_0x9167('0x11')]=_0x9cc7ea[_0x9167('0x11')];this['calleridname']=_0x499954['name'];this['calleridnum']=_0x499954[_0x9167('0x12')];this['starttime']=_0x499954[_0x9167('0x13')];this['responsetime']=_0x499954[_0x9167('0x14')];this[_0x9167('0x15')]=moment()['format'](_0x9167('0x16'));this[_0x9167('0x17')]=utils[_0x9167('0x18')](_0x499954['responsetime'],_0x499954[_0x9167('0x13')]);this[_0x9167('0x19')]=0x0;this['talktime']=utils[_0x9167('0x18')](this[_0x9167('0x15')],_0x499954[_0x9167('0x14')]);this[_0x9167('0x1a')]=_0x499954[_0x9167('0x1a')];this['membername']=_0x9167('0x1b');this[_0x9167('0x1c')]=_0x9cc7ea[_0x9167('0x1d')];this[_0x9167('0x1e')]=_0x499954[_0x9167('0x1e')];this[_0x9167('0x1f')]=_0x499954[_0x9167('0x1f')];this[_0x9167('0x20')]=_0x499954['callbackat'];this[_0x9167('0x21')]=_0x499954[_0x9167('0x21')];this['ContactId']=_0x499954[_0x9167('0x22')];this['ListId']=_0x499954[_0x9167('0x23')];this[_0x9167('0x24')]=_0x499954[_0x9167('0x24')];this[_0x9167('0x25')]=_0x499954['VoiceQueueId'];this['CampaignId']=_0x499954['CampaignId'];}module[_0x9167('0x26')]=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 1056213..2fc548f 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 _0xbd06=['recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','../utils','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callbackuniqueid','callbackat'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0xbd06,0x94));var _0x6bd0=function(_0x5983bf,_0x1c0d1f){_0x5983bf=_0x5983bf-0x0;var _0x5837ac=_0xbd06[_0x5983bf];return _0x5837ac;};'use strict';var utils=require(_0x6bd0('0x0'));function History(_0x37a9d6){this['uniqueid']=_0x37a9d6['uniqueid'];this[_0x6bd0('0x1')]=_0x37a9d6[_0x6bd0('0x1')]||undefined;this[_0x6bd0('0x2')]=_0x37a9d6[_0x6bd0('0x2')];this[_0x6bd0('0x3')]=_0x37a9d6['type']===_0x6bd0('0x4')?'queue':_0x37a9d6['type'];this[_0x6bd0('0x5')]=_0x37a9d6[_0x6bd0('0x5')];this[_0x6bd0('0x6')]=_0x37a9d6[_0x6bd0('0x6')];this[_0x6bd0('0x7')]=_0x37a9d6['countnoanswerretry'];this['countglobal']=_0x37a9d6['countbusyretry']+_0x37a9d6[_0x6bd0('0x6')]+_0x37a9d6[_0x6bd0('0x7')]+_0x37a9d6[_0x6bd0('0x8')]+_0x37a9d6[_0x6bd0('0x9')]+_0x37a9d6[_0x6bd0('0xa')]+_0x37a9d6[_0x6bd0('0xb')]+_0x37a9d6['countagentrejectretry'];this[_0x6bd0('0x8')]=_0x37a9d6[_0x6bd0('0x8')];this[_0x6bd0('0x9')]=_0x37a9d6['countdropretry'];this[_0x6bd0('0xa')]=_0x37a9d6['countabandonedretry'];this['countmachineretry']=_0x37a9d6['countmachineretry'];this[_0x6bd0('0xc')]=_0x37a9d6['countagentrejectretry'];this[_0x6bd0('0xd')]=_0x37a9d6['queue'];this[_0x6bd0('0xe')]=_0x37a9d6[_0x6bd0('0xf')];this[_0x6bd0('0x10')]=_0x37a9d6[_0x6bd0('0x11')];this[_0x6bd0('0x12')]=_0x37a9d6[_0x6bd0('0x12')];this[_0x6bd0('0x13')]=_0x37a9d6[_0x6bd0('0x13')];this[_0x6bd0('0x14')]=_0x37a9d6[_0x6bd0('0x13')];this[_0x6bd0('0x15')]=utils[_0x6bd0('0x16')](_0x37a9d6[_0x6bd0('0x13')],_0x37a9d6[_0x6bd0('0x12')]);this[_0x6bd0('0x17')]=0x0;this[_0x6bd0('0x18')]=0x0;this['callback']=_0x37a9d6['callback'];this['callbackuniqueid']=_0x37a9d6[_0x6bd0('0x19')];this[_0x6bd0('0x1a')]=_0x37a9d6[_0x6bd0('0x1a')];this[_0x6bd0('0x1b')]=_0x37a9d6[_0x6bd0('0x1b')];this['ContactId']=_0x37a9d6[_0x6bd0('0x1c')];this[_0x6bd0('0x1d')]=_0x37a9d6['ListId'];this[_0x6bd0('0x1e')]=_0x37a9d6[_0x6bd0('0x1e')];this['VoiceQueueId']=_0x37a9d6[_0x6bd0('0x1f')];this['CampaignId']=_0x37a9d6['CampaignId'];this[_0x6bd0('0x20')]=_0x37a9d6['originatecalleridnum']||'';this[_0x6bd0('0x21')]=_0x37a9d6['originatecalleridname']||'';this[_0x6bd0('0x22')]=_0x37a9d6[_0x6bd0('0x22')];this['statedesc']=_0x37a9d6['statedesc'];}module['exports']=History; \ No newline at end of file +var _0xb37d=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','campaigntype','outbound','queue','type','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','starttime','responsetime','endtime'];(function(_0x44928e,_0x2fad3f){var _0x47bb54=function(_0x281a24){while(--_0x281a24){_0x44928e['push'](_0x44928e['shift']());}};_0x47bb54(++_0x2fad3f);}(_0xb37d,0xbe));var _0xdb37=function(_0x39add1,_0x441988){_0x39add1=_0x39add1-0x0;var _0x57e77b=_0xb37d[_0x39add1];return _0x57e77b;};'use strict';var utils=require(_0xdb37('0x0'));function History(_0x300d95){this[_0xdb37('0x1')]=_0x300d95[_0xdb37('0x1')];this['scheduledat']=_0x300d95[_0xdb37('0x2')]||undefined;this['type']=_0x300d95['type'];this[_0xdb37('0x3')]=_0x300d95['type']===_0xdb37('0x4')?_0xdb37('0x5'):_0x300d95[_0xdb37('0x6')];this['countbusyretry']=_0x300d95[_0xdb37('0x7')];this['countcongestionretry']=_0x300d95[_0xdb37('0x8')];this[_0xdb37('0x9')]=_0x300d95[_0xdb37('0x9')];this['countglobal']=_0x300d95[_0xdb37('0x7')]+_0x300d95['countcongestionretry']+_0x300d95['countnoanswerretry']+_0x300d95[_0xdb37('0xa')]+_0x300d95[_0xdb37('0xb')]+_0x300d95[_0xdb37('0xc')]+_0x300d95[_0xdb37('0xd')]+_0x300d95[_0xdb37('0xe')];this['countnosuchnumberretry']=_0x300d95[_0xdb37('0xa')];this[_0xdb37('0xb')]=_0x300d95[_0xdb37('0xb')];this[_0xdb37('0xc')]=_0x300d95[_0xdb37('0xc')];this[_0xdb37('0xd')]=_0x300d95[_0xdb37('0xd')];this[_0xdb37('0xe')]=_0x300d95[_0xdb37('0xe')];this[_0xdb37('0x5')]=_0x300d95[_0xdb37('0x5')];this['calleridname']=_0x300d95[_0xdb37('0xf')];this[_0xdb37('0x10')]=_0x300d95['number'];this[_0xdb37('0x11')]=_0x300d95[_0xdb37('0x11')];this[_0xdb37('0x12')]=_0x300d95[_0xdb37('0x12')];this[_0xdb37('0x13')]=_0x300d95[_0xdb37('0x12')];this['ringtime']=utils['getSeconds'](_0x300d95[_0xdb37('0x12')],_0x300d95[_0xdb37('0x11')]);this['holdtime']=0x0;this[_0xdb37('0x14')]=0x0;this[_0xdb37('0x15')]=_0x300d95[_0xdb37('0x15')];this['callbackuniqueid']=_0x300d95[_0xdb37('0x16')];this[_0xdb37('0x17')]=_0x300d95['callbackat'];this[_0xdb37('0x18')]=_0x300d95['recallme'];this[_0xdb37('0x19')]=_0x300d95['ContactId'];this[_0xdb37('0x1a')]=_0x300d95[_0xdb37('0x1a')];this[_0xdb37('0x1b')]=_0x300d95[_0xdb37('0x1b')];this[_0xdb37('0x1c')]=_0x300d95[_0xdb37('0x1c')];this[_0xdb37('0x1d')]=_0x300d95[_0xdb37('0x1d')];this[_0xdb37('0x1e')]=_0x300d95['originatecalleridnum']||'';this['originatecalleridname']=_0x300d95[_0xdb37('0x1f')]||'';this[_0xdb37('0x20')]=_0x300d95[_0xdb37('0x20')];this['statedesc']=_0x300d95[_0xdb37('0x21')];}module[_0xdb37('0x22')]=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 c39fe2a..b446723 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 _0x4343=['state','statedesc','exports','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','dropreason','endtime','droptime','ringtime','getSeconds','responsetime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0x4343,0x15b));var _0x3434=function(_0x4f0260,_0x119185){_0x4f0260=_0x4f0260-0x0;var _0xc9d6f0=_0x4343[_0x4f0260];return _0xc9d6f0;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x1738fc,_0x523794){this[_0x3434('0x0')]=_0x1738fc['scheduledat'];this[_0x3434('0x1')]=_0x1738fc['type'];this['campaigntype']=_0x1738fc[_0x3434('0x1')]===_0x3434('0x2')?_0x3434('0x3'):_0x1738fc[_0x3434('0x1')];this[_0x3434('0x4')]=_0x1738fc[_0x3434('0x4')];this[_0x3434('0x5')]=_0x1738fc[_0x3434('0x5')];this[_0x3434('0x6')]=_0x1738fc['countnoanswerretry'];this[_0x3434('0x7')]=_0x1738fc['countbusyretry']+_0x1738fc[_0x3434('0x5')]+_0x1738fc[_0x3434('0x6')]+_0x1738fc[_0x3434('0x8')]+_0x1738fc[_0x3434('0x9')]+_0x1738fc[_0x3434('0xa')]+_0x1738fc[_0x3434('0xb')]+_0x1738fc[_0x3434('0xc')];this[_0x3434('0x8')]=_0x1738fc['countnosuchnumberretry'];this[_0x3434('0x9')]=_0x1738fc[_0x3434('0x9')];this[_0x3434('0xa')]=_0x1738fc[_0x3434('0xa')];this[_0x3434('0xb')]=_0x1738fc['countmachineretry'];this[_0x3434('0xc')]=_0x1738fc[_0x3434('0xc')];this['uniqueid']=_0x523794[_0x3434('0xd')];this[_0x3434('0xe')]=_0x1738fc[_0x3434('0xf')];this[_0x3434('0x10')]=_0x1738fc['number'];this[_0x3434('0x11')]=_0x1738fc[_0x3434('0x11')];this['responsetime']=_0x1738fc['responsetime'];this['droptime']=_0x1738fc['droptime'];this[_0x3434('0x12')]=_0x1738fc[_0x3434('0x12')];this[_0x3434('0x13')]=this[_0x3434('0x14')];this[_0x3434('0x15')]=utils[_0x3434('0x16')](_0x1738fc[_0x3434('0x17')],_0x1738fc[_0x3434('0x11')]);this[_0x3434('0x18')]=utils[_0x3434('0x16')](this[_0x3434('0x14')],_0x1738fc[_0x3434('0x17')]);this['talktime']=0x0;this[_0x3434('0x3')]=_0x523794['queue'];this[_0x3434('0x19')]=_0x523794[_0x3434('0x1a')];this[_0x3434('0x1b')]=_0x523794['reason'];this[_0x3434('0x1c')]=_0x1738fc[_0x3434('0x1c')];this[_0x3434('0x1d')]=_0x1738fc[_0x3434('0x1d')];this[_0x3434('0x1e')]=_0x1738fc[_0x3434('0x1e')];this[_0x3434('0x1f')]=_0x1738fc['recallme'];this[_0x3434('0x20')]=_0x1738fc[_0x3434('0x20')];this[_0x3434('0x21')]=_0x1738fc[_0x3434('0x21')];this[_0x3434('0x22')]=_0x1738fc[_0x3434('0x22')];this[_0x3434('0x23')]=_0x1738fc[_0x3434('0x23')];this[_0x3434('0x24')]=_0x1738fc[_0x3434('0x24')];this[_0x3434('0x25')]=_0x1738fc[_0x3434('0x25')]||'';this['originatecalleridname']=_0x1738fc[_0x3434('0x26')]||'';this[_0x3434('0x27')]=_0x1738fc[_0x3434('0x27')];this['state']=_0x1738fc[_0x3434('0x28')];this[_0x3434('0x29')]=_0x1738fc[_0x3434('0x29')];}module[_0x3434('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0x320e=['connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','getSeconds','holdtime','membername'];(function(_0x252fd0,_0x33bf8a){var _0x41e841=function(_0x511779){while(--_0x511779){_0x252fd0['push'](_0x252fd0['shift']());}};_0x41e841(++_0x33bf8a);}(_0x320e,0x1c9));var _0xe320=function(_0x2abd13,_0x501317){_0x2abd13=_0x2abd13-0x0;var _0x5ad645=_0x320e[_0x2abd13];return _0x5ad645;};'use strict';var utils=require(_0xe320('0x0'));function QueueCallerAbandon(_0x30c02b,_0x58c183){this['scheduledat']=_0x30c02b[_0xe320('0x1')];this[_0xe320('0x2')]=_0x30c02b['type'];this['campaigntype']=_0x30c02b['type']===_0xe320('0x3')?_0xe320('0x4'):_0x30c02b[_0xe320('0x2')];this['countbusyretry']=_0x30c02b['countbusyretry'];this[_0xe320('0x5')]=_0x30c02b['countcongestionretry'];this[_0xe320('0x6')]=_0x30c02b['countnoanswerretry'];this[_0xe320('0x7')]=_0x30c02b[_0xe320('0x8')]+_0x30c02b[_0xe320('0x5')]+_0x30c02b['countnoanswerretry']+_0x30c02b['countnosuchnumberretry']+_0x30c02b['countdropretry']+_0x30c02b[_0xe320('0x9')]+_0x30c02b[_0xe320('0xa')]+_0x30c02b[_0xe320('0xb')];this[_0xe320('0xc')]=_0x30c02b[_0xe320('0xc')];this['countdropretry']=_0x30c02b[_0xe320('0xd')];this['countabandonedretry']=_0x30c02b[_0xe320('0x9')];this[_0xe320('0xa')]=_0x30c02b[_0xe320('0xa')];this[_0xe320('0xb')]=_0x30c02b[_0xe320('0xb')];this[_0xe320('0xe')]=_0x58c183['uniqueid'];this[_0xe320('0xf')]=_0x30c02b[_0xe320('0x10')];this[_0xe320('0x11')]=_0x30c02b[_0xe320('0x12')];this['starttime']=_0x30c02b[_0xe320('0x13')];this['responsetime']=_0x30c02b[_0xe320('0x14')];this[_0xe320('0x15')]=_0x30c02b['droptime'];this[_0xe320('0x16')]=_0x30c02b[_0xe320('0x16')];this[_0xe320('0x17')]=this['droptime'];this['ringtime']=utils[_0xe320('0x18')](_0x30c02b[_0xe320('0x14')],_0x30c02b[_0xe320('0x13')]);this[_0xe320('0x19')]=utils[_0xe320('0x18')](this['droptime'],_0x30c02b[_0xe320('0x14')]);this['talktime']=0x0;this[_0xe320('0x4')]=_0x58c183['queue'];this[_0xe320('0x1a')]=_0x58c183[_0xe320('0x1b')];this[_0xe320('0x1c')]=_0x58c183[_0xe320('0x1c')];this['callback']=_0x30c02b[_0xe320('0x1d')];this[_0xe320('0x1e')]=_0x30c02b['callbackuniqueid'];this[_0xe320('0x1f')]=_0x30c02b[_0xe320('0x1f')];this['recallme']=_0x30c02b[_0xe320('0x20')];this[_0xe320('0x21')]=_0x30c02b['ContactId'];this[_0xe320('0x22')]=_0x30c02b[_0xe320('0x22')];this[_0xe320('0x23')]=_0x30c02b[_0xe320('0x23')];this[_0xe320('0x24')]=_0x30c02b[_0xe320('0x24')];this[_0xe320('0x25')]=_0x30c02b['CampaignId'];this[_0xe320('0x26')]=_0x30c02b[_0xe320('0x26')]||'';this[_0xe320('0x27')]=_0x30c02b[_0xe320('0x27')]||'';this[_0xe320('0x28')]=_0x30c02b[_0xe320('0x28')];this['state']=_0x30c02b[_0xe320('0x29')];this[_0xe320('0x2a')]=_0x30c02b[_0xe320('0x2a')];}module[_0xe320('0x2b')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 783f3b6..60c7252 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 _0x326f=['catch','temp','error','getContactDialerIvr','dialOrderByScheduledAt','countReScheduled','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','createHistory','[createHistory]','util','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer'];(function(_0xce694,_0x41edf3){var _0x6207ae=function(_0x52155a){while(--_0x52155a){_0xce694['push'](_0xce694['shift']());}};_0x6207ae(++_0x41edf3);}(_0x326f,0xd1));var _0xf326=function(_0x27258f,_0x57d88d){_0x27258f=_0x27258f-0x0;var _0x14355f=_0x326f[_0x27258f];return _0x14355f;};'use strict';var util=require(_0xf326('0x0'));var logger=require('../../../../config/logger')('dialer');var cmHopper=require(_0xf326('0x1'));var cmHopperAdditionalPhone=require(_0xf326('0x2'));var cmHopperBlack=require(_0xf326('0x3'));var cmHopperHistory=require(_0xf326('0x4'));function inspectError(_0x27e8d7){return util[_0xf326('0x5')](_0x27e8d7,{'showHidden':![],'depth':null});}function getContactDialer(_0x9445c6,_0xf1c243,_0x1b5a56){return cmHopper[_0xf326('0x6')](_0x9445c6['id'],_0xf1c243,_0x1b5a56,_0x9445c6['dialOrderByScheduledAt'])[_0xf326('0x7')](function(_0x3851eb){_0x9445c6[_0xf326('0x8')]=0x0;logger[_0xf326('0x9')]('[getContactDialer]',inspectError(_0x3851eb));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x592975,_0x3bacf2){return cmHopper[_0xf326('0xa')](_0x592975['id'],_0x3bacf2,_0x592975[_0xf326('0xb')])[_0xf326('0x7')](function(_0x1f3a33){_0x592975['temp']=0x0;logger[_0xf326('0x9')]('[getContactDialerIvr]',inspectError(_0x1f3a33));});}exports[_0xf326('0xa')]=getContactDialerIvr;function countReScheduled(_0x4aaf3a){return cmHopper[_0xf326('0xc')](_0x4aaf3a)['catch'](function(_0x3162f9){logger[_0xf326('0x9')]('[countReScheduled]',inspectError(_0x3162f9));});}exports[_0xf326('0xc')]=countReScheduled;function rescheduleContact(_0x472632){return cmHopper[_0xf326('0xd')](_0x472632)[_0xf326('0x7')](function(_0x5c8483){logger[_0xf326('0x9')]('[rescheduleContact]',inspectError(_0x5c8483));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0xdf21d9,_0x11f6d2,_0x1f2e5a){return cmHopper[_0xf326('0xe')](_0xdf21d9,_0x11f6d2,_0x1f2e5a)[_0xf326('0x7')](function(_0x287a2a){logger[_0xf326('0x9')](_0xf326('0xf'),inspectError(_0x287a2a));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x3ad7da){return cmHopper[_0xf326('0x10')](_0x3ad7da)[_0xf326('0x7')](function(_0x31ffb9){logger[_0xf326('0x9')](_0xf326('0x11'),inspectError(_0x31ffb9));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x4a5b6c){return cmHopperBlack['checkIsBlackList'](_0x4a5b6c)[_0xf326('0x7')](function(_0x289f4b){logger['error']('[checkIsBlackList]',inspectError(_0x289f4b));});}exports[_0xf326('0x12')]=checkIsBlackList;function checkIsBlackListIvr(_0x4dfa76){return cmHopperBlack['checkIsBlackListIvr'](_0x4dfa76)[_0xf326('0x7')](function(_0x18ead3){logger['error']('[checkIsBlackListIvr]',inspectError(_0x18ead3));});}exports[_0xf326('0x13')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0xb1efcf,_0x5f21a2,_0x337ed5){return cmHopperAdditionalPhone[_0xf326('0x14')](_0xb1efcf,_0x5f21a2,_0x337ed5)[_0xf326('0x7')](function(_0x295752){logger[_0xf326('0x9')](_0xf326('0x15'),inspectError(_0x295752));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x55b9f4,_0x4f31f6,_0x520d85){return cmHopperAdditionalPhone[_0xf326('0x16')](_0x55b9f4,_0x4f31f6,_0x520d85)[_0xf326('0x7')](function(_0x1ff2b5){logger[_0xf326('0x9')](_0xf326('0x17'),inspectError(_0x1ff2b5));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x201d28){return cmHopperHistory[_0xf326('0x18')](_0x201d28)[_0xf326('0x7')](function(_0x581531){logger[_0xf326('0x9')]('[avgHandleTime]',inspectError(_0x581531));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x6a8e89){return cmHopperHistory[_0xf326('0x19')](_0x6a8e89)[_0xf326('0x7')](function(_0x5dbe63){logger[_0xf326('0x9')](_0xf326('0x1a'),inspectError(_0x5dbe63));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0x627e=['unlockContact','moveContactManagedDialer','[checkIsBlackList]','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','rescheduleContact','[rescheduleContact]','[unlockContact]'];(function(_0x517186,_0x5ba2e6){var _0x46c16a=function(_0x1b05fa){while(--_0x1b05fa){_0x517186['push'](_0x517186['shift']());}};_0x46c16a(++_0x5ba2e6);}(_0x627e,0x14a));var _0xe627=function(_0x1032a2,_0x3af1a7){_0x1032a2=_0x1032a2-0x0;var _0x3d2027=_0x627e[_0x1032a2];return _0x3d2027;};'use strict';var util=require(_0xe627('0x0'));var logger=require(_0xe627('0x1'))(_0xe627('0x2'));var cmHopper=require(_0xe627('0x3'));var cmHopperAdditionalPhone=require(_0xe627('0x4'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0xe627('0x5'));function inspectError(_0x328881){return util[_0xe627('0x6')](_0x328881,{'showHidden':![],'depth':null});}function getContactDialer(_0x59a2c8,_0x52923f,_0x4efcad){return cmHopper[_0xe627('0x7')](_0x59a2c8['id'],_0x52923f,_0x4efcad,_0x59a2c8[_0xe627('0x8')])[_0xe627('0x9')](function(_0x2d4f63){_0x59a2c8[_0xe627('0xa')]=0x0;logger[_0xe627('0xb')]('[getContactDialer]',inspectError(_0x2d4f63));});}exports[_0xe627('0x7')]=getContactDialer;function getContactDialerIvr(_0x4c9bf9,_0x56549e){return cmHopper[_0xe627('0xc')](_0x4c9bf9['id'],_0x56549e,_0x4c9bf9[_0xe627('0x8')])['catch'](function(_0x4a85ba){_0x4c9bf9[_0xe627('0xa')]=0x0;logger[_0xe627('0xb')](_0xe627('0xd'),inspectError(_0x4a85ba));});}exports[_0xe627('0xc')]=getContactDialerIvr;function countReScheduled(_0x3d3c22){return cmHopper[_0xe627('0xe')](_0x3d3c22)[_0xe627('0x9')](function(_0x3919be){logger[_0xe627('0xb')]('[countReScheduled]',inspectError(_0x3919be));});}exports[_0xe627('0xe')]=countReScheduled;function rescheduleContact(_0x1983f8){return cmHopper[_0xe627('0xf')](_0x1983f8)['catch'](function(_0x42dd1c){logger[_0xe627('0xb')](_0xe627('0x10'),inspectError(_0x42dd1c));});}exports[_0xe627('0xf')]=rescheduleContact;function unlockContact(_0x62896f,_0x6a9a15,_0x271325){return cmHopper['unlockContact'](_0x62896f,_0x6a9a15,_0x271325)[_0xe627('0x9')](function(_0x29b41c){logger[_0xe627('0xb')](_0xe627('0x11'),inspectError(_0x29b41c));});}exports[_0xe627('0x12')]=unlockContact;function moveContactManagedDialer(_0x30da02){return cmHopper[_0xe627('0x13')](_0x30da02)[_0xe627('0x9')](function(_0x538b22){logger[_0xe627('0xb')]('[moveContactManagedDialer]',inspectError(_0x538b22));});}exports[_0xe627('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x565213){return cmHopperBlack['checkIsBlackList'](_0x565213)[_0xe627('0x9')](function(_0x529de1){logger[_0xe627('0xb')](_0xe627('0x14'),inspectError(_0x529de1));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x4c9b97){return cmHopperBlack['checkIsBlackListIvr'](_0x4c9b97)[_0xe627('0x9')](function(_0x33cc3d){logger['error'](_0xe627('0x15'),inspectError(_0x33cc3d));});}exports[_0xe627('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x4873e6,_0x44861b,_0x29221b){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x4873e6,_0x44861b,_0x29221b)[_0xe627('0x9')](function(_0x19adbc){logger[_0xe627('0xb')]('[verifyAdditionalPhone]',inspectError(_0x19adbc));});}exports[_0xe627('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x313b03,_0x1a5081,_0x3ddd8d){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x313b03,_0x1a5081,_0x3ddd8d)[_0xe627('0x9')](function(_0x1fe192){logger[_0xe627('0xb')](_0xe627('0x18'),inspectError(_0x1fe192));});}exports[_0xe627('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x40ab91){return cmHopperHistory[_0xe627('0x1a')](_0x40ab91)[_0xe627('0x9')](function(_0x3e9eda){logger['error'](_0xe627('0x1b'),inspectError(_0x3e9eda));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x5cd7c8){return cmHopperHistory[_0xe627('0x1c')](_0x5cd7c8)[_0xe627('0x9')](function(_0x5799a3){logger[_0xe627('0xb')]('[createHistory]',inspectError(_0x5799a3));});}exports[_0xe627('0x1c')]=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 6b46179..c69efcb 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 _0x4315=['decrementOriginate','length','checkContactEmpty','erlangb','[checkContactLowerLimitOriginate]\x20','checkContactLowerLimitOriginate','tags','updatedAt','undefined','description','toUpperCase','substring','XMD-','lodash','moment','util','timezones','ACTIVE','BLACKLIST','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','type','isIVRCampaign','outbound','isOutboundQueue','dialActive','active','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','waiting','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4315,0x65));var _0x5431=function(_0x152db2,_0x8dc4e4){_0x152db2=_0x152db2-0x0;var _0xd714ec=_0x4315[_0x152db2];return _0xd714ec;};'use strict';var _=require(_0x5431('0x0'));var moment=require(_0x5431('0x1'));var util=require(_0x5431('0x2'));var logger=require('../../../../config/logger')('dialer');var timezones=require('../../../../config/environment/shared')[_0x5431('0x3')];var CAMPAIGN_STATUS={'ACTIVE':_0x5431('0x4'),'BLACKLIST':_0x5431('0x5'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x5431('0x6'),'EMPTY_INTERVAL':_0x5431('0x7'),'INACTIVE':_0x5431('0x8'),'NO_AGENTS_LOGGED':_0x5431('0x9'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0x5431('0xa'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x5431('0xb'),'RECALL_TIMEOUT':_0x5431('0xc'),'RUNNING':_0x5431('0xd'),'UNKNOWN_TIMEZONE':_0x5431('0xe'),'UNREACHABLE_TRUNK':_0x5431('0xf')};exports[_0x5431('0x10')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x527128){return _0x527128[_0x5431('0x11')]==='preview';}exports[_0x5431('0x12')]=isPreviewCampaign;function isIVRCampaign(_0x551394){return _0x551394[_0x5431('0x13')]==='ivr';}exports[_0x5431('0x14')]=isIVRCampaign;function isOutboundQueue(_0x11c597){return _0x11c597[_0x5431('0x13')]===_0x5431('0x15');}exports[_0x5431('0x16')]=isOutboundQueue;function isQueueCampaignActive(_0x455691){return _0x455691[_0x5431('0x17')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x2aba51){return _0x2aba51[_0x5431('0x18')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x2f68f1,_0x48240a){var _0x1afb33=moment(_0x2f68f1)[_0x5431('0x19')](0x0);var _0x3d7253=moment(_0x48240a)['milliseconds'](0x0);return _0x1afb33[_0x5431('0x1a')](_0x3d7253,_0x5431('0x1b'));}exports[_0x5431('0x1c')]=getSeconds;function hasQueueCampaignDataChanged(_0x4b6b4a,_0x8d8f5e){var _0x2a0f51=![];var _0x2e3467=_0x4b6b4a[_0x5431('0x11')]!==_0x8d8f5e['dialMethod']||_0x4b6b4a[_0x5431('0x17')]!==_0x8d8f5e['dialActive']||_0x4b6b4a['message']!==_0x8d8f5e[_0x5431('0x1d')];var _0x1f112f=_0x4b6b4a[_0x5431('0x1e')]!==_0x8d8f5e[_0x5431('0x1e')]||_0x4b6b4a[_0x5431('0x1f')]!==_0x8d8f5e[_0x5431('0x1f')]||_0x4b6b4a[_0x5431('0x20')]!==_0x8d8f5e['loggedInDb']||_0x4b6b4a[_0x5431('0x21')]!==_0x8d8f5e[_0x5431('0x21')]||_0x4b6b4a[_0x5431('0x22')]!==_0x8d8f5e[_0x5431('0x22')]||_0x4b6b4a[_0x5431('0x23')]!==_0x8d8f5e[_0x5431('0x23')]||_0x4b6b4a['waiting']!==_0x8d8f5e['waiting']||_0x4b6b4a[_0x5431('0x24')]!==_0x8d8f5e[_0x5431('0x24')]||_0x4b6b4a[_0x5431('0x25')]!==_0x8d8f5e[_0x5431('0x25')];if(_0x4b6b4a[_0x5431('0x26')]&&_0x8d8f5e['Trunk']){_0x2a0f51=_0x4b6b4a['Trunk'][_0x5431('0x27')]!==_0x8d8f5e[_0x5431('0x26')][_0x5431('0x27')]||_0x4b6b4a[_0x5431('0x26')][_0x5431('0x18')]!==_0x8d8f5e[_0x5431('0x26')][_0x5431('0x18')];}return _0x2e3467||_0x1f112f||_0x2a0f51;}exports[_0x5431('0x28')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x125bff){var _0x37b017=null;var _0x59c7b6=_0x125bff['dialTimezone'];if(_[_0x5431('0x29')](_0x125bff[_0x5431('0x2a')])||_['isNil'](_0x125bff[_0x5431('0x2b')])||_['isNil'](_0x125bff[_0x5431('0x2b')][_0x5431('0x2c')])){_0x37b017=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x5431('0x2d')](_0x125bff['dialGlobalInterval'])||_[_0x5431('0x2d')](_0x125bff[_0x5431('0x2b')][_0x5431('0x2c')])){_0x37b017=CAMPAIGN_STATUS[_0x5431('0x2e')];}else if(_0x59c7b6&&!timezones[_0x59c7b6]){_0x37b017=CAMPAIGN_STATUS[_0x5431('0x2f')];}return _0x37b017;}function checkAnyValidTrunk(_0x2786cf,_0x16123f){var _0x4154c8=null;var _0x549975='SIP/';var _0x490a20=[_0x5431('0x30'),_0x5431('0x31')];var _0x1c8bff=!![];if(_0x2786cf[_0x5431('0x26')]&&_0x2786cf[_0x5431('0x26')][_0x5431('0x18')]){_0x549975+=_0x2786cf[_0x5431('0x26')][_0x5431('0x27')];_0x4154c8=_0x16123f[_0x549975];_0x1c8bff=_0x490a20[_0x5431('0x32')](_0x4154c8[_0x5431('0x33')]);}else if(_0x2786cf['TrunkBackup']&&_0x2786cf[_0x5431('0x34')][_0x5431('0x18')]){_0x549975+=_0x2786cf[_0x5431('0x34')][_0x5431('0x27')];_0x4154c8=_0x16123f[_0x549975];_0x1c8bff=_0x490a20[_0x5431('0x32')](_0x4154c8[_0x5431('0x33')]);}return _0x1c8bff;}function getQueueCampaignStatusMessage(_0x4a83c1,_0x156be8){var _0x1ae0db=CAMPAIGN_STATUS[_0x5431('0x4')];var _0x36de8d=isPreviewCampaign(_0x4a83c1);if(!isQueueCampaignActive(_0x4a83c1)){if(_0x36de8d){_0x1ae0db=CAMPAIGN_STATUS[_0x5431('0x35')];}else{if(_0x4a83c1['originated']===0x0&&_0x4a83c1[_0x5431('0x22')]===0x0&&_0x4a83c1[_0x5431('0x36')]===0x0&&(_0x4a83c1[_0x5431('0x23')]||0x0)===0x0){_0x1ae0db=CAMPAIGN_STATUS[_0x5431('0x35')];}else{_0x1ae0db=CAMPAIGN_STATUS[_0x5431('0x37')];}}}else if(_0x4a83c1[_0x5431('0x1f')]===0x0){_0x1ae0db=CAMPAIGN_STATUS[_0x5431('0x38')];}else if(!checkAnyValidTrunk(_0x4a83c1,_0x156be8)){_0x1ae0db=CAMPAIGN_STATUS[_0x5431('0x39')];}else if(!isPreviewCampaign(_0x4a83c1)){var _0x41eb4c=checkAnyValidQueueCampaignInterval(_0x4a83c1);if(_0x41eb4c){_0x1ae0db=_0x41eb4c;}}return _0x1ae0db;}exports[_0x5431('0x3a')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x27f95d){var _0xc2c02b=CAMPAIGN_STATUS[_0x5431('0x37')];if(_0x27f95d[_0x5431('0x25')]===0x0&&_0x27f95d[_0x5431('0x22')]===0x0&&_0x27f95d['waiting']===0x0&&(_0x27f95d[_0x5431('0x23')]||0x0)===0x0){_0xc2c02b=CAMPAIGN_STATUS[_0x5431('0x35')];}return _0xc2c02b;}exports[_0x5431('0x3b')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x3fd35c){var _0x19c41d=_0x3fd35c[_0x5431('0x3c')](/"(.*?)"/);return _0x19c41d?_0x19c41d[0x1]:_0x3fd35c;}exports[_0x5431('0x3d')]=extractCalleridName;function getCallerId(_0xc4b002,_0x553452,_0x11e9b8){if(!_[_0x5431('0x3e')](_0x11e9b8)&&typeof _0x11e9b8==='string'&&!_['isEmpty'](_0x11e9b8)){if(!_['isUndefined'](_0x553452)&&typeof _0x553452===_0x5431('0x3f')&&!_[_0x5431('0x2d')](_0x553452)){return util[_0x5431('0x40')](_0x5431('0x41'),_0x553452,_0x11e9b8);}return util[_0x5431('0x40')](_0x5431('0x41'),_0x11e9b8,_0x11e9b8);}if(!_[_0x5431('0x3e')](_0xc4b002)&&typeof _0xc4b002==='string'&&!_[_0x5431('0x2d')](_0xc4b002)){return _0xc4b002;}return _0x5431('0x42');}exports[_0x5431('0x43')]=getCallerId;function getCallerIdRandom(_0x56cbb4,_0x15b435){var _0x1ca8ae;var _0x19fa11;var _0x2174ed;if(_0x15b435<=0x0){_0x15b435=0x1;}_0x1ca8ae=new RegExp(_0x5431('0x44')+_0x15b435+'}$');_0x19fa11=Math[_0x5431('0x45')](0xa,_0x15b435-0x1);_0x2174ed=Math['pow'](0xa,_0x15b435)-0x1;return util['format']('%s',_[_0x5431('0x46')](_0x56cbb4,_0x1ca8ae,_[_0x5431('0x47')](_0x19fa11,_0x2174ed)[_0x5431('0x48')]()));}exports[_0x5431('0x49')]=getCallerIdRandom;function decrementOriginate(_0x359282,_0x5a6f96){if(_0x359282[_0x5431('0x25')]&&_0x359282[_0x5431('0x25')]>0x0){_0x359282['originated']-=0x1;}else{logger[_0x5431('0x4a')]('[decrementOriginate]\x20queue\x20originate\x20value',_0x5a6f96);}}exports[_0x5431('0x4b')]=decrementOriginate;function checkContactEmpty(_0x295262){return _0x295262&&_0x295262[_0x5431('0x4c')]>0x0;}exports[_0x5431('0x4d')]=checkContactEmpty;function erlangb(_0x13f5d4,_0x198b5c){if(_0x198b5c===0x0){return 0x0;}var _0x213430=0x1;for(var _0x35dc6d=0x1;_0x35dc6d<=_0x198b5c;_0x35dc6d+=0x1){_0x213430=0x1+_0x213430*_0x35dc6d/_0x13f5d4;}return 0x1/_0x213430;}exports[_0x5431('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x4793f9,_0x186388,_0x345708){if(_0x186388>_0x345708){for(var _0x3d810b=0x0;_0x3d810b<_0x186388-_0x345708;_0x3d810b+=0x1){decrementOriginate(_0x4793f9,_0x5431('0x4f'));}}}exports[_0x5431('0x50')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x1da415){var _0x275757={};var _0x216800=['id','createdAt',_0x5431('0x51'),_0x5431('0x52')];const _0x57a0f2=0xfa;if(_0x1da415){for(var _0x2d0f2c in _0x1da415){if(typeof _0x1da415[_0x2d0f2c]!==_0x5431('0x53')){if(!_['isNil'](_0x1da415[_0x2d0f2c])&&!_0x216800['includes'](_0x2d0f2c)){if(_0x2d0f2c===_0x5431('0x54')&&_0x1da415[_0x2d0f2c][_0x5431('0x4c')]>_0x57a0f2){_0x275757['XMD-'+_0x2d0f2c[_0x5431('0x55')]()]=_0x1da415[_0x2d0f2c][_0x5431('0x48')]()[_0x5431('0x56')](0x0,_0x57a0f2);}else{_0x275757[_0x5431('0x57')+_0x2d0f2c[_0x5431('0x55')]()]=_0x1da415[_0x2d0f2c];}}}}}return _0x275757;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0x2b12=['isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','name','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','Intervals','NULL_INTERVAL','dialGlobalInterval','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','Trunk','status','TrunkBackup','includes','getQueueCampaignStatusMessage','DISACTIVED','INACTIVE','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','isEmpty','\x22%s\x22\x20<%s>','format','string','\x22\x22\x20<>','pow','replace','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','tags','updatedAt','undefined','description','XMD-','toUpperCase','substring','setXMDContactVariables','lodash','moment','util','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','dialMethod','preview'];(function(_0x2c2a81,_0x1d63e5){var _0x4e337c=function(_0x58495d){while(--_0x58495d){_0x2c2a81['push'](_0x2c2a81['shift']());}};_0x4e337c(++_0x1d63e5);}(_0x2b12,0x149));var _0x22b1=function(_0xc45a51,_0x149d3f){_0xc45a51=_0xc45a51-0x0;var _0xed7560=_0x2b12[_0xc45a51];return _0xed7560;};'use strict';var _=require(_0x22b1('0x0'));var moment=require(_0x22b1('0x1'));var util=require(_0x22b1('0x2'));var logger=require(_0x22b1('0x3'))('dialer');var timezones=require(_0x22b1('0x4'))[_0x22b1('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x22b1('0x6'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x22b1('0x7'),'DEACTIVATED':_0x22b1('0x8'),'DISACTIVED':_0x22b1('0x9'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x22b1('0xa'),'NO_AVAILABLE_CONTACTS':_0x22b1('0xb'),'NULL_INTERVAL':_0x22b1('0xc'),'OVERTIME_INTERVAL':_0x22b1('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0x22b1('0xe'),'QUEUE_RECALL':_0x22b1('0xf'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x22b1('0x10'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x34d403){return _0x34d403[_0x22b1('0x11')]===_0x22b1('0x12');}exports[_0x22b1('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x579530){return _0x579530[_0x22b1('0x14')]===_0x22b1('0x15');}exports[_0x22b1('0x16')]=isIVRCampaign;function isOutboundQueue(_0x2561e6){return _0x2561e6[_0x22b1('0x14')]===_0x22b1('0x17');}exports[_0x22b1('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x271f91){return _0x271f91[_0x22b1('0x19')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x778e2){return _0x778e2[_0x22b1('0x1a')];}exports[_0x22b1('0x1b')]=isIVRCampaignActive;function getSeconds(_0x2d9f00,_0x624b3a){var _0x1011fc=moment(_0x2d9f00)[_0x22b1('0x1c')](0x0);var _0x6591af=moment(_0x624b3a)[_0x22b1('0x1c')](0x0);return _0x1011fc[_0x22b1('0x1d')](_0x6591af,_0x22b1('0x1e'));}exports[_0x22b1('0x1f')]=getSeconds;function hasQueueCampaignDataChanged(_0x360e87,_0x43c80d){var _0x523d8a=![];var _0x289b0b=_0x360e87['dialMethod']!==_0x43c80d[_0x22b1('0x11')]||_0x360e87['dialActive']!==_0x43c80d[_0x22b1('0x19')]||_0x360e87['message']!==_0x43c80d['message'];var _0xfaeaf4=_0x360e87[_0x22b1('0x20')]!==_0x43c80d[_0x22b1('0x20')]||_0x360e87[_0x22b1('0x21')]!==_0x43c80d[_0x22b1('0x21')]||_0x360e87[_0x22b1('0x22')]!==_0x43c80d[_0x22b1('0x22')]||_0x360e87[_0x22b1('0x23')]!==_0x43c80d[_0x22b1('0x23')]||_0x360e87[_0x22b1('0x24')]!==_0x43c80d['talking']||_0x360e87[_0x22b1('0x25')]!==_0x43c80d[_0x22b1('0x25')]||_0x360e87['waiting']!==_0x43c80d[_0x22b1('0x26')]||_0x360e87[_0x22b1('0x27')]!==_0x43c80d[_0x22b1('0x27')]||_0x360e87[_0x22b1('0x28')]!==_0x43c80d['originated'];if(_0x360e87['Trunk']&&_0x43c80d['Trunk']){_0x523d8a=_0x360e87['Trunk']['name']!==_0x43c80d['Trunk'][_0x22b1('0x29')]||_0x360e87['Trunk'][_0x22b1('0x1a')]!==_0x43c80d['Trunk']['active'];}return _0x289b0b||_0xfaeaf4||_0x523d8a;}exports[_0x22b1('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x20930b){var _0x1fa8de=null;var _0x3f109f=_0x20930b[_0x22b1('0x2b')];if(_[_0x22b1('0x2c')](_0x20930b['dialGlobalInterval'])||_['isNil'](_0x20930b[_0x22b1('0x2d')])||_[_0x22b1('0x2c')](_0x20930b['Interval'][_0x22b1('0x2e')])){_0x1fa8de=CAMPAIGN_STATUS[_0x22b1('0x2f')];}else if(_['isEmpty'](_0x20930b[_0x22b1('0x30')])||_['isEmpty'](_0x20930b['Interval']['Intervals'])){_0x1fa8de=CAMPAIGN_STATUS[_0x22b1('0x31')];}else if(_0x3f109f&&!timezones[_0x3f109f]){_0x1fa8de=CAMPAIGN_STATUS[_0x22b1('0x32')];}return _0x1fa8de;}function checkAnyValidTrunk(_0x174224,_0xafc0c7){var _0x34bd7f=null;var _0x16220c=_0x22b1('0x33');var _0x3de81a=['reachable','unmonitored'];var _0x23d5bf=!![];if(_0x174224[_0x22b1('0x34')]&&_0x174224[_0x22b1('0x34')][_0x22b1('0x1a')]){_0x16220c+=_0x174224[_0x22b1('0x34')][_0x22b1('0x29')];_0x34bd7f=_0xafc0c7[_0x16220c];_0x23d5bf=_0x3de81a['includes'](_0x34bd7f[_0x22b1('0x35')]);}else if(_0x174224[_0x22b1('0x36')]&&_0x174224[_0x22b1('0x36')][_0x22b1('0x1a')]){_0x16220c+=_0x174224[_0x22b1('0x36')][_0x22b1('0x29')];_0x34bd7f=_0xafc0c7[_0x16220c];_0x23d5bf=_0x3de81a[_0x22b1('0x37')](_0x34bd7f[_0x22b1('0x35')]);}return _0x23d5bf;}function getQueueCampaignStatusMessage(_0x38145e,_0x25f994){var _0x4dbb2d=CAMPAIGN_STATUS[_0x22b1('0x6')];var _0x1824ac=isPreviewCampaign(_0x38145e);if(!isQueueCampaignActive(_0x38145e)){if(_0x1824ac){_0x4dbb2d=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x38145e[_0x22b1('0x28')]===0x0&&_0x38145e['talking']===0x0&&_0x38145e[_0x22b1('0x26')]===0x0&&(_0x38145e[_0x22b1('0x25')]||0x0)===0x0){_0x4dbb2d=CAMPAIGN_STATUS['INACTIVE'];}else{_0x4dbb2d=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x38145e['loggedIn']===0x0){_0x4dbb2d=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x38145e,_0x25f994)){_0x4dbb2d=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x38145e)){var _0x4d79e8=checkAnyValidQueueCampaignInterval(_0x38145e);if(_0x4d79e8){_0x4dbb2d=_0x4d79e8;}}return _0x4dbb2d;}exports[_0x22b1('0x38')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x2b796e){var _0x4d4d81=CAMPAIGN_STATUS[_0x22b1('0x39')];if(_0x2b796e['originated']===0x0&&_0x2b796e[_0x22b1('0x24')]===0x0&&_0x2b796e['waiting']===0x0&&(_0x2b796e[_0x22b1('0x25')]||0x0)===0x0){_0x4d4d81=CAMPAIGN_STATUS[_0x22b1('0x3a')];}return _0x4d4d81;}exports[_0x22b1('0x3b')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0xc7bb23){var _0x598081=_0xc7bb23[_0x22b1('0x3c')](/"(.*?)"/);return _0x598081?_0x598081[0x1]:_0xc7bb23;}exports[_0x22b1('0x3d')]=extractCalleridName;function getCallerId(_0x430b94,_0x579458,_0xb8e58e){if(!_[_0x22b1('0x3e')](_0xb8e58e)&&typeof _0xb8e58e==='string'&&!_[_0x22b1('0x3f')](_0xb8e58e)){if(!_[_0x22b1('0x3e')](_0x579458)&&typeof _0x579458==='string'&&!_[_0x22b1('0x3f')](_0x579458)){return util['format'](_0x22b1('0x40'),_0x579458,_0xb8e58e);}return util[_0x22b1('0x41')](_0x22b1('0x40'),_0xb8e58e,_0xb8e58e);}if(!_[_0x22b1('0x3e')](_0x430b94)&&typeof _0x430b94===_0x22b1('0x42')&&!_['isEmpty'](_0x430b94)){return _0x430b94;}return _0x22b1('0x43');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x90759,_0x21b4b9){var _0x1e6f19;var _0x31cc71;var _0x293e2e;if(_0x21b4b9<=0x0){_0x21b4b9=0x1;}_0x1e6f19=new RegExp('\x5cw{0,'+_0x21b4b9+'}$');_0x31cc71=Math[_0x22b1('0x44')](0xa,_0x21b4b9-0x1);_0x293e2e=Math[_0x22b1('0x44')](0xa,_0x21b4b9)-0x1;return util[_0x22b1('0x41')]('%s',_[_0x22b1('0x45')](_0x90759,_0x1e6f19,_['random'](_0x31cc71,_0x293e2e)[_0x22b1('0x46')]()));}exports[_0x22b1('0x47')]=getCallerIdRandom;function decrementOriginate(_0x1df5f0,_0x3c031a){if(_0x1df5f0['originated']&&_0x1df5f0[_0x22b1('0x28')]>0x0){_0x1df5f0[_0x22b1('0x28')]-=0x1;}else{logger[_0x22b1('0x48')](_0x22b1('0x49'),_0x3c031a);}}exports[_0x22b1('0x4a')]=decrementOriginate;function checkContactEmpty(_0x3bf4ac){return _0x3bf4ac&&_0x3bf4ac[_0x22b1('0x4b')]>0x0;}exports[_0x22b1('0x4c')]=checkContactEmpty;function erlangb(_0x2a91d0,_0x4afee1){if(_0x4afee1===0x0){return 0x0;}var _0x5677bb=0x1;for(var _0x16d138=0x1;_0x16d138<=_0x4afee1;_0x16d138+=0x1){_0x5677bb=0x1+_0x5677bb*_0x16d138/_0x2a91d0;}return 0x1/_0x5677bb;}exports[_0x22b1('0x4d')]=erlangb;function checkContactLowerLimitOriginate(_0x7fa007,_0x5d9fd9,_0x43c9d7){if(_0x5d9fd9>_0x43c9d7){for(var _0x5dab52=0x0;_0x5dab52<_0x5d9fd9-_0x43c9d7;_0x5dab52+=0x1){decrementOriginate(_0x7fa007,'[checkContactLowerLimitOriginate]\x20');}}}exports[_0x22b1('0x4e')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x3aa831){var _0x423abf={};var _0x11ee64=['id','createdAt',_0x22b1('0x4f'),_0x22b1('0x50')];const _0x2b127f=0xfa;if(_0x3aa831){for(var _0x356dd7 in _0x3aa831){if(typeof _0x3aa831[_0x356dd7]!==_0x22b1('0x51')){if(!_['isNil'](_0x3aa831[_0x356dd7])&&!_0x11ee64[_0x22b1('0x37')](_0x356dd7)){if(_0x356dd7===_0x22b1('0x52')&&_0x3aa831[_0x356dd7]['length']>_0x2b127f){_0x423abf[_0x22b1('0x53')+_0x356dd7[_0x22b1('0x54')]()]=_0x3aa831[_0x356dd7][_0x22b1('0x46')]()[_0x22b1('0x55')](0x0,_0x2b127f);}else{_0x423abf[_0x22b1('0x53')+_0x356dd7[_0x22b1('0x54')]()]=_0x3aa831[_0x356dd7];}}}}}return _0x423abf;}exports[_0x22b1('0x56')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index af75609..39d26d5 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(_0x24b49d,_0x31e327){var _0x33a8a1=function(_0x22f8b9){while(--_0x22f8b9){_0x24b49d['push'](_0x24b49d['shift']());}};_0x33a8a1(++_0x31e327);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x33fe50,_0x1464c8){var _0x20b544=function(_0x9becc5){while(--_0x9becc5){_0x33fe50['push'](_0x33fe50['shift']());}};_0x20b544(++_0x1464c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 3055bb5..9946730 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 _0x98cc=['util','lodash','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./util/util','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','syncNewState','syncNewExten','faxstatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','deleteChannelAfterTimeout','\x20hangup\x20faxRiceive\x20','SUCCESS','updateStatus','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','isTrunkReachable','isNil','active','SIP/%s','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Is\x20Valid','exports'];(function(_0x10248a,_0x247b47){var _0x176074=function(_0x511a12){while(--_0x511a12){_0x10248a['push'](_0x10248a['shift']());}};_0x176074(++_0x247b47);}(_0x98cc,0x6f));var _0xc98c=function(_0x1ad07b,_0x551d55){_0x1ad07b=_0x1ad07b-0x0;var _0x2c447f=_0x98cc[_0x1ad07b];return _0x2c447f;};'use strict';var util=require(_0xc98c('0x0'));var _=require(_0xc98c('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0xc98c('0x2'));var path=require(_0xc98c('0x3'));var tiff2pdf=require(_0xc98c('0x4'));var gs=require('./util/gs');var logger=require(_0xc98c('0x5'))(_0xc98c('0x6'));var ami=require(_0xc98c('0x7'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0xc98c('0x8'));var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xc98c('0x9'));var faxMessage=require(_0xc98c('0xa'));function Fax(_0x37e0af){this['channels']={};this[_0xc98c('0xb')]=_0x37e0af['faxAccounts'];this['trunks']=_0x37e0af[_0xc98c('0xc')];this[_0xc98c('0xd')]={};ami['on'](_0xc98c('0xe'),this[_0xc98c('0xf')]['bind'](this));ami['on'](_0xc98c('0x10'),this[_0xc98c('0x11')][_0xc98c('0x12')](this));ami['on']('newstate',this[_0xc98c('0x13')][_0xc98c('0x12')](this));ami['on']('newexten',this[_0xc98c('0x14')][_0xc98c('0x12')](this));ami['on'](_0xc98c('0x15'),this['syncFaxStatus'][_0xc98c('0x12')](this));ami['on']('receivefax',this[_0xc98c('0x16')][_0xc98c('0x12')](this));ami['on'](_0xc98c('0x17'),this[_0xc98c('0x18')][_0xc98c('0x12')](this));ami['on'](_0xc98c('0x19'),this[_0xc98c('0x1a')][_0xc98c('0x12')](this));}Fax[_0xc98c('0x1b')][_0xc98c('0xf')]=function(_0x43ec1f){if(_0x43ec1f[_0xc98c('0x1c')]==='from-voip-provider'){for(var _0x45f631 in this[_0xc98c('0xb')]){if(this['faxAccounts'][_0xc98c('0x1d')](_0x45f631)){if(_0x43ec1f[_0xc98c('0x1e')]===this[_0xc98c('0xb')][_0x45f631][_0xc98c('0x1f')]){this[_0xc98c('0x20')][_0x43ec1f[_0xc98c('0x21')]]={};this[_0xc98c('0x20')][_0x43ec1f[_0xc98c('0x21')]][_0xc98c('0x22')]=_0x43ec1f['channel'];this[_0xc98c('0x20')][_0x43ec1f[_0xc98c('0x21')]]['id']=this[_0xc98c('0xb')][_0x45f631]['id'];this[_0xc98c('0x20')][_0x43ec1f['uniqueid']]['name']=this[_0xc98c('0xb')][_0x45f631][_0xc98c('0x23')];logger[_0xc98c('0x24')](_0x43ec1f[_0xc98c('0x21')],_0xc98c('0x25'));}}}}if(this[_0xc98c('0xd')][_0x43ec1f['uniqueid']]){this[_0xc98c('0x20')][_0x43ec1f[_0xc98c('0x21')]]={};this[_0xc98c('0x20')][_0x43ec1f[_0xc98c('0x21')]]['channel']=_0x43ec1f[_0xc98c('0x22')];logger[_0xc98c('0x24')](_0x43ec1f[_0xc98c('0x21')],_0xc98c('0x25'));}};Fax['prototype'][_0xc98c('0x11')]=function(_0x4c97e7){if(this[_0xc98c('0x20')][_0x4c97e7['uniqueid']]){for(var _0x5a6509 in _0x4c97e7[_0xc98c('0x26')]){if(_0x4c97e7[_0xc98c('0x26')][_0xc98c('0x1d')](_0x5a6509)){this['channels'][_0x4c97e7[_0xc98c('0x21')]][_0x5a6509]=_0x4c97e7[_0xc98c('0x27')];}}}};Fax[_0xc98c('0x1b')][_0xc98c('0x13')]=function(_0x5a2837){if(this[_0xc98c('0x20')][_0x5a2837['uniqueid']]){this[_0xc98c('0x20')][_0x5a2837[_0xc98c('0x21')]][_0xc98c('0x28')]=_0x5a2837['channelstate'];this[_0xc98c('0x20')][_0x5a2837[_0xc98c('0x21')]][_0xc98c('0x29')]=_0x5a2837[_0xc98c('0x29')];}};Fax['prototype'][_0xc98c('0x14')]=function(_0x309642){if(this[_0xc98c('0x20')][_0x309642['uniqueid']]){for(var _0x68ffd7 in _0x309642[_0xc98c('0x26')]){if(_0x309642[_0xc98c('0x26')][_0xc98c('0x1d')](_0x68ffd7)){this[_0xc98c('0x20')][_0x309642[_0xc98c('0x21')]][_0x68ffd7]=_0x309642[_0xc98c('0x27')];}}}};Fax[_0xc98c('0x1b')][_0xc98c('0x2a')]=function(_0x1b586c){if(this[_0xc98c('0x20')][_0x1b586c[_0xc98c('0x21')]]){this['channels'][_0x1b586c[_0xc98c('0x21')]][_0xc98c('0x2b')]=_0x1b586c['operation'];this[_0xc98c('0x20')][_0x1b586c[_0xc98c('0x21')]]['status']=_0x1b586c[_0xc98c('0x2c')];this[_0xc98c('0x20')][_0x1b586c['uniqueid']][_0xc98c('0x1f')]=_0x1b586c[_0xc98c('0x1f')];this[_0xc98c('0x20')][_0x1b586c[_0xc98c('0x21')]][_0xc98c('0x2d')]=_0x1b586c['filename'];logger[_0xc98c('0x24')](_0x1b586c[_0xc98c('0x21')],_0xc98c('0x2e'));}};Fax['prototype']['syncReceiveFax']=function(_0x8cfe7b){var _0x5ddc04=this;if(this['channels'][_0x8cfe7b[_0xc98c('0x21')]]){var _0x56afa4=this[_0xc98c('0x20')][_0x8cfe7b[_0xc98c('0x21')]]['id'];this[_0xc98c('0x20')][_0x8cfe7b[_0xc98c('0x21')]][_0xc98c('0x2f')]=_0x8cfe7b['remotestationid'];this[_0xc98c('0x20')][_0x8cfe7b[_0xc98c('0x21')]][_0xc98c('0x30')]=_0x8cfe7b['pagestransferred'];this['channels'][_0x8cfe7b[_0xc98c('0x21')]]['localstationid']=_0x8cfe7b[_0xc98c('0x1f')];this['channels'][_0x8cfe7b[_0xc98c('0x21')]][_0xc98c('0x31')]=_0x8cfe7b[_0xc98c('0x31')];this[_0xc98c('0x20')][_0x8cfe7b[_0xc98c('0x21')]]['transferrate']=_0x8cfe7b[_0xc98c('0x32')];this[_0xc98c('0x20')][_0x8cfe7b['uniqueid']][_0xc98c('0x2d')]=_0x8cfe7b[_0xc98c('0x2d')];this[_0xc98c('0x20')][_0x8cfe7b['uniqueid']][_0xc98c('0x33')]=_0x8cfe7b['calleridnum'];if(this['channels'][_0x8cfe7b[_0xc98c('0x21')]][_0xc98c('0x30')]>0x0){tiff2pdf(_0x8cfe7b[_0xc98c('0x2d')],_0xc98c('0x34'),function(_0x237923){logger[_0xc98c('0x24')](_0x8cfe7b['uniqueid'],_0xc98c('0x35'),_0x237923[_0xc98c('0x36')]);attachment[_0xc98c('0x37')]({'name':path['parse'](_0x8cfe7b[_0xc98c('0x2d')])[_0xc98c('0x23')],'basename':path[_0xc98c('0x38')](_0x8cfe7b[_0xc98c('0x2d')])['name']+_0xc98c('0x39'),'type':'application/pdf'})[_0xc98c('0x3a')](function(_0x3b00c5){faxAccount[_0xc98c('0x3b')](_0x56afa4,{'from':_0x8cfe7b[_0xc98c('0x33')],'mapKey':'fax','body':path[_0xc98c('0x38')](_0x8cfe7b[_0xc98c('0x2d')])['name']+_0xc98c('0x39'),'AttachmentId':_0x3b00c5['id']})[_0xc98c('0x3c')](function(_0x313e8b){logger[_0xc98c('0x3d')](_0x8cfe7b[_0xc98c('0x21')],_0xc98c('0x3e'),JSON[_0xc98c('0x3f')](_0x313e8b));});})['catch'](function(_0x20c15a){logger[_0xc98c('0x3d')](_0x8cfe7b['uniqueid'],_0xc98c('0x40'),JSON[_0xc98c('0x3f')](_0x20c15a));});});}logger[_0xc98c('0x24')](_0x8cfe7b['uniqueid'],'\x20receiveFax\x20');}};Fax[_0xc98c('0x1b')][_0xc98c('0x1a')]=function(_0x4b110d){if(this['actions'][_0x4b110d[_0xc98c('0x21')]]){_[_0xc98c('0x41')](this[_0xc98c('0x20')][_0x4b110d[_0xc98c('0x21')]],_[_0xc98c('0x42')](_0x4b110d,['response',_0xc98c('0x43')]));}};function updateStatus(_0x524dee){if(_0x524dee['AttachmentId']){faxMessage[_0xc98c('0x44')](_0x524dee[_0xc98c('0x45')],{'failMessage':_0xc98c('0x46')})[_0xc98c('0x3a')](function(_0x51ecdc){ut[_0xc98c('0x47')]('[Fax][Message][Error][Updated]',_0x51ecdc);})['catch'](function(_0x1984c9){ut['logger'](_0xc98c('0x48'),_0x1984c9);});}else{ut[_0xc98c('0x47')](_0xc98c('0x49'));}}Fax[_0xc98c('0x1b')]['updateStatus']=function(_0xda3357,_0x5da202,_0x2120d6){var _0x36979a=this;var _0x5a7abf={};if(_0x5da202){_0x5a7abf={'read':_0x5da202};}else{_0x5a7abf={'failMessage':_0x2120d6};}if(this[_0xc98c('0xd')][_0xda3357][_0xc98c('0x45')]){faxMessage['update'](this[_0xc98c('0xd')][_0xda3357][_0xc98c('0x45')],_0x5a7abf)['then'](function(_0x2ece81){ut[_0xc98c('0x47')](_0xc98c('0x4a'),_0x2ece81);})[_0xc98c('0x3c')](function(_0x1614d8){ut['logger'](_0xc98c('0x4b'),_0x1614d8);})[_0xc98c('0x4c')](function(){delete _0x36979a[_0xc98c('0x20')][_0xda3357];delete _0x36979a['actions'][_0xda3357];});}else{ut[_0xc98c('0x47')]('[Fax][Message][NoUpdate2]');this[_0xc98c('0x4d')](_0xda3357);delete this[_0xc98c('0xd')][_0xda3357];}};Fax[_0xc98c('0x1b')][_0xc98c('0x18')]=function(_0xc1403){var _0x336044=this;if(this[_0xc98c('0x20')][_0xc1403['uniqueid']]){if(this['actions'][_0xc1403['uniqueid']]){this[_0xc98c('0x20')][_0xc1403[_0xc98c('0x21')]]['id']=this[_0xc98c('0xd')][_0xc1403[_0xc98c('0x21')]]['id'];this[_0xc98c('0x20')][_0xc1403['uniqueid']][_0xc98c('0x23')]=this[_0xc98c('0xd')][_0xc1403[_0xc98c('0x21')]][_0xc98c('0x23')];}logger[_0xc98c('0x24')](_0xc1403[_0xc98c('0x21')],this['actions'][_0xc1403[_0xc98c('0x21')]]?'\x20hangup\x20sendFile\x20':_0xc98c('0x4e'),JSON['stringify'](this[_0xc98c('0x20')][_0xc1403[_0xc98c('0x21')]]));if(this[_0xc98c('0xd')][_0xc1403['uniqueid']]){if(this[_0xc98c('0x20')][_0xc1403[_0xc98c('0x21')]]['faxpages']>0x0&&this['channels'][_0xc1403['uniqueid']][_0xc98c('0x15')]===_0xc98c('0x4f')){this[_0xc98c('0x50')](_0xc1403[_0xc98c('0x21')],!![]);}else{this[_0xc98c('0x50')](_0xc1403[_0xc98c('0x21')],![],this[_0xc98c('0x20')][_0xc1403[_0xc98c('0x21')]]['faxstatusstring']?_0xc98c('0x51')+this[_0xc98c('0x20')][_0xc1403[_0xc98c('0x21')]]['faxstatusstring']:_0xc98c('0x52'));}}}};Fax['prototype']['send']=function(_0x1b81ea){var _0xe813b5=this;return new BPromise(function(_0x5cdb0e,_0x53d190){_0xe813b5[_0xc98c('0x53')](_0x1b81ea,_0xe813b5[_0xc98c('0xb')][_0x1b81ea[_0xc98c('0x54')]])[_0xc98c('0x3a')](function(_0xfb467d){ut[_0xc98c('0x47')](_0xc98c('0x55'),_0xfb467d);_0x5cdb0e(ut[_0xc98c('0x36')](_0xc98c('0x56')));})['catch'](function(_0x4b240a){ut[_0xc98c('0x47')]('[Fax][execOriginate][failure]',_0x4b240a);updateStatus(_0x1b81ea);_0x53d190(ut[_0xc98c('0x36')](_0xc98c('0x57')));});});};Fax[_0xc98c('0x1b')][_0xc98c('0x58')]=function(_0x51dd8c){var _0x495248=this;return new BPromise(function(_0x47de3e,_0x6e934f){var _0x463aab=_0x495248['checkTrunk'](_0x495248[_0xc98c('0xb')][_0x51dd8c[_0xc98c('0x54')]]['Trunk'],_0x51dd8c);if(_0x463aab['isValid']){_0x47de3e(ut['message'](_0xc98c('0x59')));}else{_0x6e934f(ut[_0xc98c('0x36')](_0x463aab['message']));}});};function originate(_0x9bb422,_0x5038f0,_0x2311ec){return new BPromise(function(_0x5e8902,_0x162f10){if(_0x2311ec){var _0x9b7389=util[_0xc98c('0x5a')](_0xc98c('0x5b'),path['parse'](_0x9bb422[_0xc98c('0x3')])['name'],_0x9bb422[_0xc98c('0x3')]);gs[_0xc98c('0x5c')](_0x9b7389)[_0xc98c('0x3a')](function(){_0x9bb422[_0xc98c('0x3')]=util[_0xc98c('0x5a')]('%s/%s.tif',path[_0xc98c('0x38')](_0x9bb422[_0xc98c('0x3')])[_0xc98c('0x5d')],path[_0xc98c('0x38')](_0x9bb422[_0xc98c('0x3')])['name']);_0x5038f0[_0xc98c('0x5e')]=_0x9bb422[_0xc98c('0x3')];ut['logger'](_0xc98c('0x5f'),'');ami['Action'](ut[_0xc98c('0x60')](_0x9bb422,_0x5038f0))[_0xc98c('0x3a')](function(_0x52ffe5){_0x5e8902(_0x52ffe5);})[_0xc98c('0x3c')](function(_0x7e6056){_0x162f10(_0x7e6056);});})[_0xc98c('0x3c')](function(_0x12dcea){_0x162f10(_0x12dcea);});}else{ami[_0xc98c('0x61')](ut[_0xc98c('0x60')](_0x9bb422,_0x5038f0))[_0xc98c('0x3a')](function(_0xa81d67){_0x5e8902(_0xa81d67);})[_0xc98c('0x3c')](function(_0x257811){_0x162f10(_0x257811);});}});}Fax['prototype'][_0xc98c('0x53')]=function(_0x31639c,_0x3dfe59){var _0xca86f3=this;return new BPromise(function(_0x3b8e2e,_0x26016c){var _0x5c6634=uuid['v4']();var _0x5a595d=ut[_0xc98c('0x62')](_0x31639c,_0x3dfe59);_0xca86f3['actions'][_0x5c6634]=new Action(_0x5c6634,_0x3dfe59,_0x31639c);var _0x462f0e=_0xca86f3['actions'][_0x5c6634];if(path[_0xc98c('0x38')](_0x31639c[_0xc98c('0x3')])['ext']===_0xc98c('0x39')){originate(_0x462f0e,_0x5a595d,!![])[_0xc98c('0x3a')](function(_0x343d31){_0x3b8e2e(_0x343d31);})[_0xc98c('0x3c')](function(_0x3c5c59){_0x26016c(_0x3c5c59);});}else{originate(_0x462f0e,_0x5a595d,![])['then'](function(_0x15a0ae){_0x3b8e2e(_0x15a0ae);})['catch'](function(_0x4e577d){_0x26016c(_0x4e577d);});}});};Fax['prototype'][_0xc98c('0x63')]=function(_0x1b2b8f){return!_['isNil'](_0x1b2b8f)&&!_[_0xc98c('0x64')](_0x1b2b8f[_0xc98c('0x23')])&&!_[_0xc98c('0x64')](_0x1b2b8f['active'])&&_0x1b2b8f[_0xc98c('0x65')]&&!_[_0xc98c('0x64')](this[_0xc98c('0xc')][util[_0xc98c('0x5a')](_0xc98c('0x66'),_0x1b2b8f[_0xc98c('0x23')])])&&!_[_0xc98c('0x64')](this[_0xc98c('0xc')][util[_0xc98c('0x5a')](_0xc98c('0x66'),_0x1b2b8f[_0xc98c('0x23')])][_0xc98c('0x2c')])&&(this[_0xc98c('0xc')][util[_0xc98c('0x5a')](_0xc98c('0x66'),_0x1b2b8f[_0xc98c('0x23')])][_0xc98c('0x2c')]==='reachable'||this[_0xc98c('0xc')][util[_0xc98c('0x5a')](_0xc98c('0x66'),_0x1b2b8f['name'])]['status']===_0xc98c('0x67'));};Fax[_0xc98c('0x1b')][_0xc98c('0x68')]=function(_0x8d5e6f,_0x38000d){if(!this[_0xc98c('0x63')](_0x8d5e6f)){ut[_0xc98c('0x47')](_0xc98c('0x69'),_[_0xc98c('0x64')](_0x8d5e6f)?'':_0x8d5e6f[_0xc98c('0x23')]+_0xc98c('0x6a'));return{'isValid':![],'message':_0xc98c('0x6b')};}if(_[_0xc98c('0x64')](_0x38000d['fax'])){ut[_0xc98c('0x47')](_0xc98c('0x6c'),JSON[_0xc98c('0x3f')](_0x38000d));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x38000d['path'])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON[_0xc98c('0x3f')](_0x38000d));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xc98c('0x6d')};};Fax['prototype'][_0xc98c('0x4d')]=function(_0x3c976c,_0x315a40=0x2710){if(this[_0xc98c('0x20')][_0x3c976c]){setTimeout(()=>{delete this[_0xc98c('0x20')][_0x3c976c];},_0x315a40);}};module[_0xc98c('0x6e')]=Fax; \ No newline at end of file +var _0x2efc=['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','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','deleteChannelAfterTimeout','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','syncVarSet','syncNewState','newexten','bind','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','exten','localstationid','channels','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','hasOwnProperty','value','channelstate','channelstatedesc','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','fax','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','syncOriginateResponse','merge','pick','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk\x20Reachable'];(function(_0x15614c,_0x1e1732){var _0x27d9e4=function(_0x2f1d06){while(--_0x2f1d06){_0x15614c['push'](_0x15614c['shift']());}};_0x27d9e4(++_0x1e1732);}(_0x2efc,0x10c));var _0xc2ef=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x2efc[_0x4dc7b9];return _0x3ab114;};'use strict';var util=require(_0xc2ef('0x0'));var _=require(_0xc2ef('0x1'));var BPromise=require(_0xc2ef('0x2'));var uuid=require(_0xc2ef('0x3'));var moment=require(_0xc2ef('0x4'));var path=require(_0xc2ef('0x5'));var tiff2pdf=require(_0xc2ef('0x6'));var gs=require(_0xc2ef('0x7'));var logger=require(_0xc2ef('0x8'))('fax');var ami=require(_0xc2ef('0x9'));var rpcDb=require(_0xc2ef('0xa'));var Channel=require(_0xc2ef('0xb'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0xc2ef('0xc'));var attachment=require(_0xc2ef('0xd'));var faxMessage=require(_0xc2ef('0xe'));function Fax(_0x412f69){this['channels']={};this[_0xc2ef('0xf')]=_0x412f69[_0xc2ef('0xf')];this[_0xc2ef('0x10')]=_0x412f69['trunks'];this[_0xc2ef('0x11')]={};ami['on'](_0xc2ef('0x12'),this[_0xc2ef('0x13')]['bind'](this));ami['on']('varset',this[_0xc2ef('0x14')]['bind'](this));ami['on']('newstate',this[_0xc2ef('0x15')]['bind'](this));ami['on'](_0xc2ef('0x16'),this['syncNewExten'][_0xc2ef('0x17')](this));ami['on']('faxstatus',this[_0xc2ef('0x18')]['bind'](this));ami['on'](_0xc2ef('0x19'),this[_0xc2ef('0x1a')][_0xc2ef('0x17')](this));ami['on'](_0xc2ef('0x1b'),this[_0xc2ef('0x1c')][_0xc2ef('0x17')](this));ami['on'](_0xc2ef('0x1d'),this['syncOriginateResponse']['bind'](this));}Fax[_0xc2ef('0x1e')]['syncNewchannel']=function(_0x3789eb){if(_0x3789eb[_0xc2ef('0x1f')]===_0xc2ef('0x20')){for(var _0x20bfaf in this[_0xc2ef('0xf')]){if(this[_0xc2ef('0xf')]['hasOwnProperty'](_0x20bfaf)){if(_0x3789eb[_0xc2ef('0x21')]===this[_0xc2ef('0xf')][_0x20bfaf][_0xc2ef('0x22')]){this[_0xc2ef('0x23')][_0x3789eb[_0xc2ef('0x24')]]={};this[_0xc2ef('0x23')][_0x3789eb[_0xc2ef('0x24')]]['channel']=_0x3789eb[_0xc2ef('0x25')];this[_0xc2ef('0x23')][_0x3789eb[_0xc2ef('0x24')]]['id']=this[_0xc2ef('0xf')][_0x20bfaf]['id'];this['channels'][_0x3789eb[_0xc2ef('0x24')]][_0xc2ef('0x26')]=this['faxAccounts'][_0x20bfaf][_0xc2ef('0x26')];logger['info'](_0x3789eb[_0xc2ef('0x24')],_0xc2ef('0x27'));}}}}if(this[_0xc2ef('0x11')][_0x3789eb[_0xc2ef('0x24')]]){this[_0xc2ef('0x23')][_0x3789eb[_0xc2ef('0x24')]]={};this['channels'][_0x3789eb[_0xc2ef('0x24')]]['channel']=_0x3789eb[_0xc2ef('0x25')];logger[_0xc2ef('0x28')](_0x3789eb[_0xc2ef('0x24')],_0xc2ef('0x27'));}};Fax['prototype'][_0xc2ef('0x14')]=function(_0x4c8456){if(this[_0xc2ef('0x23')][_0x4c8456[_0xc2ef('0x24')]]){for(var _0x2a4508 in _0x4c8456[_0xc2ef('0x29')]){if(_0x4c8456[_0xc2ef('0x29')][_0xc2ef('0x2a')](_0x2a4508)){this[_0xc2ef('0x23')][_0x4c8456[_0xc2ef('0x24')]][_0x2a4508]=_0x4c8456[_0xc2ef('0x2b')];}}}};Fax['prototype'][_0xc2ef('0x15')]=function(_0x1a3108){if(this[_0xc2ef('0x23')][_0x1a3108['uniqueid']]){this['channels'][_0x1a3108[_0xc2ef('0x24')]]['channelstate']=_0x1a3108[_0xc2ef('0x2c')];this[_0xc2ef('0x23')][_0x1a3108[_0xc2ef('0x24')]][_0xc2ef('0x2d')]=_0x1a3108[_0xc2ef('0x2d')];}};Fax[_0xc2ef('0x1e')]['syncNewExten']=function(_0x3dde38){if(this[_0xc2ef('0x23')][_0x3dde38[_0xc2ef('0x24')]]){for(var _0x21386e in _0x3dde38[_0xc2ef('0x29')]){if(_0x3dde38[_0xc2ef('0x29')][_0xc2ef('0x2a')](_0x21386e)){this[_0xc2ef('0x23')][_0x3dde38['uniqueid']][_0x21386e]=_0x3dde38[_0xc2ef('0x2b')];}}}};Fax[_0xc2ef('0x1e')][_0xc2ef('0x18')]=function(_0x213747){if(this['channels'][_0x213747[_0xc2ef('0x24')]]){this[_0xc2ef('0x23')][_0x213747['uniqueid']][_0xc2ef('0x2e')]=_0x213747[_0xc2ef('0x2e')];this[_0xc2ef('0x23')][_0x213747[_0xc2ef('0x24')]][_0xc2ef('0x2f')]=_0x213747['status'];this[_0xc2ef('0x23')][_0x213747[_0xc2ef('0x24')]][_0xc2ef('0x22')]=_0x213747[_0xc2ef('0x22')];this[_0xc2ef('0x23')][_0x213747[_0xc2ef('0x24')]][_0xc2ef('0x30')]=_0x213747[_0xc2ef('0x30')];logger[_0xc2ef('0x28')](_0x213747[_0xc2ef('0x24')],'\x20syncFaxStatus\x20');}};Fax[_0xc2ef('0x1e')][_0xc2ef('0x1a')]=function(_0x1fff07){var _0x4f967d=this;if(this[_0xc2ef('0x23')][_0x1fff07[_0xc2ef('0x24')]]){var _0xc219fb=this[_0xc2ef('0x23')][_0x1fff07[_0xc2ef('0x24')]]['id'];this[_0xc2ef('0x23')][_0x1fff07[_0xc2ef('0x24')]][_0xc2ef('0x31')]=_0x1fff07[_0xc2ef('0x31')];this[_0xc2ef('0x23')][_0x1fff07['uniqueid']][_0xc2ef('0x32')]=_0x1fff07[_0xc2ef('0x32')];this[_0xc2ef('0x23')][_0x1fff07['uniqueid']][_0xc2ef('0x22')]=_0x1fff07[_0xc2ef('0x22')];this[_0xc2ef('0x23')][_0x1fff07[_0xc2ef('0x24')]][_0xc2ef('0x33')]=_0x1fff07['resolution'];this[_0xc2ef('0x23')][_0x1fff07['uniqueid']][_0xc2ef('0x34')]=_0x1fff07[_0xc2ef('0x34')];this[_0xc2ef('0x23')][_0x1fff07[_0xc2ef('0x24')]][_0xc2ef('0x30')]=_0x1fff07[_0xc2ef('0x30')];this[_0xc2ef('0x23')][_0x1fff07[_0xc2ef('0x24')]]['calleridnum']=_0x1fff07[_0xc2ef('0x35')];if(this[_0xc2ef('0x23')][_0x1fff07[_0xc2ef('0x24')]]['pagestransferred']>0x0){tiff2pdf(_0x1fff07[_0xc2ef('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x4f13d1){logger['info'](_0x1fff07[_0xc2ef('0x24')],_0xc2ef('0x36'),_0x4f13d1[_0xc2ef('0x37')]);attachment[_0xc2ef('0x38')]({'name':path[_0xc2ef('0x39')](_0x1fff07[_0xc2ef('0x30')])[_0xc2ef('0x26')],'basename':path['parse'](_0x1fff07[_0xc2ef('0x30')])[_0xc2ef('0x26')]+_0xc2ef('0x3a'),'type':_0xc2ef('0x3b')})[_0xc2ef('0x3c')](function(_0x408a2f){faxAccount[_0xc2ef('0x3d')](_0xc219fb,{'from':_0x1fff07[_0xc2ef('0x35')],'mapKey':_0xc2ef('0x3e'),'body':path['parse'](_0x1fff07['filename'])[_0xc2ef('0x26')]+'.pdf','AttachmentId':_0x408a2f['id']})[_0xc2ef('0x3f')](function(_0x1c6cdf){logger[_0xc2ef('0x40')](_0x1fff07['uniqueid'],_0xc2ef('0x41'),JSON['stringify'](_0x1c6cdf));});})[_0xc2ef('0x3f')](function(_0x1b96a4){logger[_0xc2ef('0x40')](_0x1fff07[_0xc2ef('0x24')],_0xc2ef('0x42'),JSON[_0xc2ef('0x43')](_0x1b96a4));});});}logger[_0xc2ef('0x28')](_0x1fff07['uniqueid'],_0xc2ef('0x42'));}};Fax[_0xc2ef('0x1e')][_0xc2ef('0x44')]=function(_0x35fce2){if(this[_0xc2ef('0x11')][_0x35fce2[_0xc2ef('0x24')]]){_[_0xc2ef('0x45')](this[_0xc2ef('0x23')][_0x35fce2[_0xc2ef('0x24')]],_[_0xc2ef('0x46')](_0x35fce2,['response',_0xc2ef('0x47')]));}};function updateStatus(_0x2565f7){if(_0x2565f7['AttachmentId']){faxMessage[_0xc2ef('0x48')](_0x2565f7[_0xc2ef('0x49')],{'failMessage':_0xc2ef('0x4a')})[_0xc2ef('0x3c')](function(_0x290533){ut[_0xc2ef('0x4b')]('[Fax][Message][Error][Updated]',_0x290533);})[_0xc2ef('0x3f')](function(_0x5b4302){ut[_0xc2ef('0x4b')](_0xc2ef('0x4c'),_0x5b4302);});}else{ut[_0xc2ef('0x4b')](_0xc2ef('0x4d'));}}Fax[_0xc2ef('0x1e')][_0xc2ef('0x4e')]=function(_0x302d79,_0x3a9352,_0x13f891){var _0x481ecf=this;var _0x44d1f8={};if(_0x3a9352){_0x44d1f8={'read':_0x3a9352};}else{_0x44d1f8={'failMessage':_0x13f891};}if(this[_0xc2ef('0x11')][_0x302d79]['AttachmentId']){faxMessage[_0xc2ef('0x48')](this[_0xc2ef('0x11')][_0x302d79][_0xc2ef('0x49')],_0x44d1f8)['then'](function(_0xa9ef27){ut[_0xc2ef('0x4b')]('[Fax][Message][Updated]',_0xa9ef27);})[_0xc2ef('0x3f')](function(_0x23977b){ut['logger']('[Fax][Message][NoUpdate1]',_0x23977b);})[_0xc2ef('0x4f')](function(){delete _0x481ecf['channels'][_0x302d79];delete _0x481ecf[_0xc2ef('0x11')][_0x302d79];});}else{ut['logger'](_0xc2ef('0x50'));this['deleteChannelAfterTimeout'](_0x302d79);delete this['actions'][_0x302d79];}};Fax[_0xc2ef('0x1e')][_0xc2ef('0x1c')]=function(_0x480ccf){var _0x4507a0=this;if(this[_0xc2ef('0x23')][_0x480ccf[_0xc2ef('0x24')]]){if(this[_0xc2ef('0x11')][_0x480ccf[_0xc2ef('0x24')]]){this['channels'][_0x480ccf[_0xc2ef('0x24')]]['id']=this[_0xc2ef('0x11')][_0x480ccf['uniqueid']]['id'];this['channels'][_0x480ccf[_0xc2ef('0x24')]][_0xc2ef('0x26')]=this[_0xc2ef('0x11')][_0x480ccf[_0xc2ef('0x24')]]['name'];}logger[_0xc2ef('0x28')](_0x480ccf[_0xc2ef('0x24')],this['actions'][_0x480ccf['uniqueid']]?'\x20hangup\x20sendFile\x20':_0xc2ef('0x51'),JSON[_0xc2ef('0x43')](this[_0xc2ef('0x23')][_0x480ccf[_0xc2ef('0x24')]]));if(this[_0xc2ef('0x11')][_0x480ccf[_0xc2ef('0x24')]]){if(this[_0xc2ef('0x23')][_0x480ccf[_0xc2ef('0x24')]][_0xc2ef('0x52')]>0x0&&this[_0xc2ef('0x23')][_0x480ccf['uniqueid']][_0xc2ef('0x53')]===_0xc2ef('0x54')){this[_0xc2ef('0x4e')](_0x480ccf[_0xc2ef('0x24')],!![]);}else{this[_0xc2ef('0x4e')](_0x480ccf[_0xc2ef('0x24')],![],this['channels'][_0x480ccf[_0xc2ef('0x24')]][_0xc2ef('0x55')]?_0xc2ef('0x56')+this[_0xc2ef('0x23')][_0x480ccf['uniqueid']]['faxstatusstring']:_0xc2ef('0x57'));}}}};Fax['prototype'][_0xc2ef('0x58')]=function(_0x3c067e){var _0x2ae1a2=this;return new BPromise(function(_0x93a98,_0x25c42c){_0x2ae1a2[_0xc2ef('0x59')](_0x3c067e,_0x2ae1a2['faxAccounts'][_0x3c067e[_0xc2ef('0x5a')]])[_0xc2ef('0x3c')](function(_0x53dbaf){ut[_0xc2ef('0x4b')](_0xc2ef('0x5b'),_0x53dbaf);_0x93a98(ut[_0xc2ef('0x37')](_0xc2ef('0x5c')));})[_0xc2ef('0x3f')](function(_0x1c5cae){ut[_0xc2ef('0x4b')](_0xc2ef('0x5d'),_0x1c5cae);updateStatus(_0x3c067e);_0x25c42c(ut[_0xc2ef('0x37')](_0xc2ef('0x5e')));});});};Fax[_0xc2ef('0x1e')][_0xc2ef('0x5f')]=function(_0xa4f1d7){var _0x53bb73=this;return new BPromise(function(_0x1f0b4f,_0x1f7e8a){var _0x5166e1=_0x53bb73[_0xc2ef('0x60')](_0x53bb73[_0xc2ef('0xf')][_0xa4f1d7[_0xc2ef('0x5a')]]['Trunk'],_0xa4f1d7);if(_0x5166e1['isValid']){_0x1f0b4f(ut[_0xc2ef('0x37')](_0xc2ef('0x61')));}else{_0x1f7e8a(ut['message'](_0x5166e1[_0xc2ef('0x37')]));}});};function originate(_0x46aa79,_0x5da040,_0x36d50f){return new BPromise(function(_0x488bc3,_0x46f053){if(_0x36d50f){var _0xa8bcf4=util[_0xc2ef('0x62')](_0xc2ef('0x63'),path[_0xc2ef('0x39')](_0x46aa79['path'])['name'],_0x46aa79[_0xc2ef('0x5')]);gs[_0xc2ef('0x64')](_0xa8bcf4)[_0xc2ef('0x3c')](function(){_0x46aa79[_0xc2ef('0x5')]=util[_0xc2ef('0x62')](_0xc2ef('0x65'),path[_0xc2ef('0x39')](_0x46aa79['path'])['dir'],path[_0xc2ef('0x39')](_0x46aa79['path'])['name']);_0x5da040[_0xc2ef('0x66')]=_0x46aa79[_0xc2ef('0x5')];ut[_0xc2ef('0x4b')](_0xc2ef('0x67'),'');ami[_0xc2ef('0x68')](ut[_0xc2ef('0x69')](_0x46aa79,_0x5da040))[_0xc2ef('0x3c')](function(_0x2ddc6e){_0x488bc3(_0x2ddc6e);})[_0xc2ef('0x3f')](function(_0x2424c9){_0x46f053(_0x2424c9);});})['catch'](function(_0x5b5412){_0x46f053(_0x5b5412);});}else{ami[_0xc2ef('0x68')](ut[_0xc2ef('0x69')](_0x46aa79,_0x5da040))[_0xc2ef('0x3c')](function(_0x4263da){_0x488bc3(_0x4263da);})[_0xc2ef('0x3f')](function(_0x12301e){_0x46f053(_0x12301e);});}});}Fax['prototype']['execOriginate']=function(_0x3e7739,_0x352a8a){var _0x4d2736=this;return new BPromise(function(_0xcec620,_0x46fbc5){var _0x75bf71=uuid['v4']();var _0x4ea482=ut[_0xc2ef('0x6a')](_0x3e7739,_0x352a8a);_0x4d2736['actions'][_0x75bf71]=new Action(_0x75bf71,_0x352a8a,_0x3e7739);var _0x5c275d=_0x4d2736[_0xc2ef('0x11')][_0x75bf71];if(path['parse'](_0x3e7739[_0xc2ef('0x5')])[_0xc2ef('0x6b')]===_0xc2ef('0x3a')){originate(_0x5c275d,_0x4ea482,!![])[_0xc2ef('0x3c')](function(_0x3705e9){_0xcec620(_0x3705e9);})[_0xc2ef('0x3f')](function(_0x284cc9){_0x46fbc5(_0x284cc9);});}else{originate(_0x5c275d,_0x4ea482,![])[_0xc2ef('0x3c')](function(_0x27e799){_0xcec620(_0x27e799);})[_0xc2ef('0x3f')](function(_0x5ced66){_0x46fbc5(_0x5ced66);});}});};Fax[_0xc2ef('0x1e')][_0xc2ef('0x6c')]=function(_0x396559){return!_['isNil'](_0x396559)&&!_[_0xc2ef('0x6d')](_0x396559['name'])&&!_[_0xc2ef('0x6d')](_0x396559[_0xc2ef('0x6e')])&&_0x396559['active']&&!_[_0xc2ef('0x6d')](this[_0xc2ef('0x10')][util['format'](_0xc2ef('0x6f'),_0x396559[_0xc2ef('0x26')])])&&!_['isNil'](this['trunks'][util[_0xc2ef('0x62')]('SIP/%s',_0x396559['name'])][_0xc2ef('0x2f')])&&(this[_0xc2ef('0x10')][util[_0xc2ef('0x62')](_0xc2ef('0x6f'),_0x396559[_0xc2ef('0x26')])]['status']==='reachable'||this[_0xc2ef('0x10')][util[_0xc2ef('0x62')](_0xc2ef('0x6f'),_0x396559[_0xc2ef('0x26')])][_0xc2ef('0x2f')]===_0xc2ef('0x70'));};Fax[_0xc2ef('0x1e')][_0xc2ef('0x60')]=function(_0x3486c3,_0x3884de){if(!this[_0xc2ef('0x6c')](_0x3486c3)){ut[_0xc2ef('0x4b')](_0xc2ef('0x71'),_[_0xc2ef('0x6d')](_0x3486c3)?'':_0x3486c3['name']+_0xc2ef('0x72'));return{'isValid':![],'message':_0xc2ef('0x73')};}if(_[_0xc2ef('0x6d')](_0x3884de[_0xc2ef('0x3e')])){ut[_0xc2ef('0x4b')](_0xc2ef('0x74'),JSON[_0xc2ef('0x43')](_0x3884de));return{'isValid':![],'message':_0xc2ef('0x75')};}if(_[_0xc2ef('0x6d')](_0x3884de[_0xc2ef('0x5')])){ut[_0xc2ef('0x4b')](_0xc2ef('0x76'),JSON['stringify'](_0x3884de));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xc2ef('0x77')};};Fax[_0xc2ef('0x1e')][_0xc2ef('0x78')]=function(_0x59a6f7,_0xf04594=0x2710){if(this[_0xc2ef('0x23')][_0x59a6f7]){setTimeout(()=>{delete this[_0xc2ef('0x23')][_0x59a6f7];},_0xf04594);}};module[_0xc2ef('0x79')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index d2d47e7..09c3c8b 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 _0xbd50=['resolve','then','catch','[Notify]\x20','util','../../../config/logger','lodash','inspect','notify'];(function(_0x2cc0b3,_0x120bf1){var _0x1667ef=function(_0x3abcb4){while(--_0x3abcb4){_0x2cc0b3['push'](_0x2cc0b3['shift']());}};_0x1667ef(++_0x120bf1);}(_0xbd50,0x11b));var _0x0bd5=function(_0xcec412,_0x233968){_0xcec412=_0xcec412-0x0;var _0x487cc6=_0xbd50[_0xcec412];return _0x487cc6;};'use strict';var util=require(_0x0bd5('0x0'));var BPromise=require('bluebird');var logger=require(_0x0bd5('0x1'))('preview');var _=require(_0x0bd5('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x416476){return function(_0x4b5030){logger['error'](_0x416476,util[_0x0bd5('0x3')](_0x4b5030,{'showHidden':![],'depth':null}));};}exports[_0x0bd5('0x4')]=function(_0x506a86,_0x3c7916){return BPromise[_0x0bd5('0x5')]()[_0x0bd5('0x6')](faxAccount[_0x0bd5('0x4')](_0x506a86,_0x3c7916))[_0x0bd5('0x7')](loggerCatch(_0x0bd5('0x8')));}; \ No newline at end of file +var _0x07b2=['../rpc/faxAccount','inspect','notify','resolve','then','[Notify]\x20','util','../../../config/logger'];(function(_0x1317ed,_0x57217d){var _0xbaeca=function(_0x24e517){while(--_0x24e517){_0x1317ed['push'](_0x1317ed['shift']());}};_0xbaeca(++_0x57217d);}(_0x07b2,0x1ce));var _0x207b=function(_0x1849a5,_0x278795){_0x1849a5=_0x1849a5-0x0;var _0x63b9b9=_0x07b2[_0x1849a5];return _0x63b9b9;};'use strict';var util=require(_0x207b('0x0'));var BPromise=require('bluebird');var logger=require(_0x207b('0x1'))('preview');var _=require('lodash');var faxAccount=require(_0x207b('0x2'));function loggerCatch(_0xca22fe){return function(_0x488e0b){logger['error'](_0xca22fe,util[_0x207b('0x3')](_0x488e0b,{'showHidden':![],'depth':null}));};}exports[_0x207b('0x4')]=function(_0x4caa82,_0x4fa2b5){return BPromise[_0x207b('0x5')]()[_0x207b('0x6')](faxAccount[_0x207b('0x4')](_0x4caa82,_0x4fa2b5))['catch'](loggerCatch(_0x207b('0x7')));}; \ 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 ed9ff5f..53a0507 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 _0x1ad7=['fax','child_process','exec','info','Exec\x20gs','\x20Error\x20:','inspect','util'];(function(_0x23c262,_0x74765a){var _0x9b913f=function(_0x3ecb98){while(--_0x3ecb98){_0x23c262['push'](_0x23c262['shift']());}};_0x9b913f(++_0x74765a);}(_0x1ad7,0x147));var _0x71ad=function(_0x39d518,_0x32b600){_0x39d518=_0x39d518-0x0;var _0x2feade=_0x1ad7[_0x39d518];return _0x2feade;};'use strict';var util=require(_0x71ad('0x0'));var logger=require('../../../../config/logger')(_0x71ad('0x1'));var BPromise=require('bluebird');var exec=require(_0x71ad('0x2'))[_0x71ad('0x3')];exports['execute']=function(_0x4c7d5b){return new BPromise(function(_0x172c39,_0x5227a0){exec(_0x4c7d5b,function(_0x1b3a9b,_0x250933,_0x449895){logger[_0x71ad('0x4')](_0x71ad('0x5'),_0x250933);if(_0x1b3a9b){logger[_0x71ad('0x4')](_0x71ad('0x5'),_0x71ad('0x6'),util[_0x71ad('0x7')](_0x1b3a9b,{'showHidden':![],'depth':null}),_0x250933,_0x449895);_0x5227a0(_0x1b3a9b);}_0x172c39(_0x250933);});});}; \ No newline at end of file +var _0xb61a=['exec','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process'];(function(_0x48b5c3,_0x3e4273){var _0x3a7689=function(_0x2ac960){while(--_0x2ac960){_0x48b5c3['push'](_0x48b5c3['shift']());}};_0x3a7689(++_0x3e4273);}(_0xb61a,0x1d1));var _0xab61=function(_0x1ec790,_0x3e0545){_0x1ec790=_0x1ec790-0x0;var _0xdba141=_0xb61a[_0x1ec790];return _0xdba141;};'use strict';var util=require(_0xab61('0x0'));var logger=require(_0xab61('0x1'))(_0xab61('0x2'));var BPromise=require(_0xab61('0x3'));var exec=require(_0xab61('0x4'))[_0xab61('0x5')];exports['execute']=function(_0x3b4b56){return new BPromise(function(_0x40a08b,_0x4dfad0){exec(_0x3b4b56,function(_0x4f9b6e,_0x31dca3,_0x341c7e){logger[_0xab61('0x6')](_0xab61('0x7'),_0x31dca3);if(_0x4f9b6e){logger[_0xab61('0x6')]('Exec\x20gs',_0xab61('0x8'),util[_0xab61('0x9')](_0x4f9b6e,{'showHidden':![],'depth':null}),_0x31dca3,_0x341c7e);_0x4dfad0(_0x4f9b6e);}_0x40a08b(_0x31dca3);});});}; \ 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 3713a4f..f0a7179 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 _0x49f5=['../../../../config/logger','fax','message','logger','inspect','ecm','headerinfo','minrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','path','variablesAction','originate','channel','format','localstationid','uniqueid','util','lodash','moment'];(function(_0x55a1dd,_0x922e97){var _0x58beeb=function(_0x3e8ce8){while(--_0x3e8ce8){_0x55a1dd['push'](_0x55a1dd['shift']());}};_0x58beeb(++_0x922e97);}(_0x49f5,0x128));var _0x549f=function(_0x155e04,_0x28cd61){_0x155e04=_0x155e04-0x0;var _0x4590d0=_0x49f5[_0x155e04];return _0x4590d0;};'use strict';var util=require(_0x549f('0x0'));var _=require(_0x549f('0x1'));var moment=require(_0x549f('0x2'));var logger=require(_0x549f('0x3'))(_0x549f('0x4'));exports[_0x549f('0x5')]=function(_0x271b48){return{'message':_0x271b48};};exports[_0x549f('0x6')]=function(_0x45820d,_0x3c686b){logger['info'](_0x45820d,util[_0x549f('0x7')](_0x3c686b,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x2db20f,_0x1f8c95){var _0x3d8465={'XMF-ECM':_0x1f8c95[_0x549f('0x8')],'XMF-HEADERINFO':_0x1f8c95[_0x549f('0x9')],'XMF-MINRATE':_0x1f8c95[_0x549f('0xa')],'XMF-MAXRATE':_0x1f8c95['maxrate'],'XMF-MODEM':util['format'](_0x549f('0xb'),_0x1f8c95[_0x549f('0xc')]),'XMF-GATEWAY':_0x1f8c95[_0x549f('0xd')],'XMF-FAXDETECT':_0x1f8c95[_0x549f('0xe')],'XMF-T38TIMEOUT':_0x1f8c95[_0x549f('0xf')],'XMF-LOCALSTATIONID':_0x1f8c95['localstationid'],'XMF-PATH':_0x2db20f[_0x549f('0x10')]};return _0x3d8465;};exports[_0x549f('0x11')]=function(_0x53c756,_0x198975){return{'actionid':_0x53c756['uniqueid'],'action':_0x549f('0x12'),'channel':_0x53c756[_0x549f('0x13')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x549f('0x14')]('\x22%s\x22\x20<%s>',_0x53c756[_0x549f('0x9')]?_0x53c756[_0x549f('0x9')]:'',_0x53c756[_0x549f('0x15')]),'variable':_0x198975,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x53c756[_0x549f('0x16')]};}; \ No newline at end of file +var _0x17c4=['maxrate','format','\x22%s\x22','modem','t38timeout','path','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','localstationid','lodash','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','minrate'];(function(_0x254d73,_0x4f64e1){var _0x278a25=function(_0x5b421f){while(--_0x5b421f){_0x254d73['push'](_0x254d73['shift']());}};_0x278a25(++_0x4f64e1);}(_0x17c4,0x176));var _0x417c=function(_0x502666,_0x45fd9d){_0x502666=_0x502666-0x0;var _0x4c4efd=_0x17c4[_0x502666];return _0x4c4efd;};'use strict';var util=require('util');var _=require(_0x417c('0x0'));var moment=require('moment');var logger=require(_0x417c('0x1'))(_0x417c('0x2'));exports[_0x417c('0x3')]=function(_0x5f3812){return{'message':_0x5f3812};};exports[_0x417c('0x4')]=function(_0x50794f,_0x3cf41f){logger[_0x417c('0x5')](_0x50794f,util[_0x417c('0x6')](_0x3cf41f,{'showHidden':![],'depth':null}));};exports[_0x417c('0x7')]=function(_0xcb4043,_0x49030f){var _0x1b60d8={'XMF-ECM':_0x49030f[_0x417c('0x8')],'XMF-HEADERINFO':_0x49030f['headerinfo'],'XMF-MINRATE':_0x49030f[_0x417c('0x9')],'XMF-MAXRATE':_0x49030f[_0x417c('0xa')],'XMF-MODEM':util[_0x417c('0xb')](_0x417c('0xc'),_0x49030f[_0x417c('0xd')]),'XMF-GATEWAY':_0x49030f['gateway'],'XMF-FAXDETECT':_0x49030f['faxdetect'],'XMF-T38TIMEOUT':_0x49030f[_0x417c('0xe')],'XMF-LOCALSTATIONID':_0x49030f['localstationid'],'XMF-PATH':_0xcb4043[_0x417c('0xf')]};return _0x1b60d8;};exports[_0x417c('0x10')]=function(_0xfc89f4,_0x5ab8d0){return{'actionid':_0xfc89f4[_0x417c('0x11')],'action':'originate','channel':_0xfc89f4[_0x417c('0x12')],'Exten':_0x417c('0x13'),'Context':_0x417c('0x14'),'Priority':'1','callerid':util[_0x417c('0xb')](_0x417c('0x15'),_0xfc89f4['headerinfo']?_0xfc89f4[_0x417c('0x16')]:'',_0xfc89f4[_0x417c('0x17')]),'variable':_0x5ab8d0,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xfc89f4[_0x417c('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 9bbb5ed..9b67b26 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 _0xe18a=['getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','./report','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./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','ami','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory'];(function(_0x5eeb0c,_0xa39675){var _0x41953b=function(_0x33e1ba){while(--_0x33e1ba){_0x5eeb0c['push'](_0x5eeb0c['shift']());}};_0x41953b(++_0xa39675);}(_0xe18a,0x158));var _0xae18=function(_0x13e0f8,_0x11cb86){_0x13e0f8=_0x13e0f8-0x0;var _0x3b394f=_0xe18a[_0x13e0f8];return _0x3b394f;};'use strict';var util=require(_0xae18('0x0'));var moment=require('moment');var server=require('./server');var Realtime=require('./realtime');var Report=require(_0xae18('0x1'));var Acw=require('./acw');var Trigger=require(_0xae18('0x2'));var Dialer=require(_0xae18('0x3'));var Preview=require(_0xae18('0x4'));var Fax=require('./fax');var user=require(_0xae18('0x5'));var voiceQueue=require(_0xae18('0x6'));var voiceQueueReport=require(_0xae18('0x7'));var voiceCallReport=require(_0xae18('0x8'));var trunk=require(_0xae18('0x9'));var trigger=require(_0xae18('0xa'));var template=require(_0xae18('0xb'));var cmHopperHistory=require(_0xae18('0xc'));var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xae18('0xd'));var zendesk=require(_0xae18('0xe'));var salesforce=require(_0xae18('0xf'));var sugarcrm=require(_0xae18('0x10'));var freshdesk=require(_0xae18('0x11'));var desk=require(_0xae18('0x12'));var zoho=require(_0xae18('0x13'));var vtiger=require(_0xae18('0x14'));var freshsales=require(_0xae18('0x15'));var servicenow=require(_0xae18('0x16'));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('../../config/logger')(_0xae18('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xae18('0x18')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xae18('0x18')](_0xae18('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0xae18('0x1a')](user[_0xae18('0x1b')]())[_0xae18('0x1a')](realtime[_0xae18('0x1c')]())[_0xae18('0x1a')](user[_0xae18('0x1d')]())[_0xae18('0x1a')](realtime[_0xae18('0x1e')]())[_0xae18('0x1a')](trunk[_0xae18('0x1f')]())[_0xae18('0x1a')](realtime['initTrunks']())['then'](voiceQueue[_0xae18('0x20')]())[_0xae18('0x1a')](realtime[_0xae18('0x21')]())['then'](trigger[_0xae18('0x22')]())[_0xae18('0x1a')](realtime[_0xae18('0x23')]())[_0xae18('0x1a')](template[_0xae18('0x24')]())[_0xae18('0x1a')](realtime[_0xae18('0x25')]())['then'](zendesk['getZendeskAccounts']())['then'](realtime[_0xae18('0x26')]())[_0xae18('0x1a')](salesforce[_0xae18('0x27')]())[_0xae18('0x1a')](realtime[_0xae18('0x28')]())[_0xae18('0x1a')](sugarcrm[_0xae18('0x29')]())[_0xae18('0x1a')](realtime['initSugarcrmAccounts']())[_0xae18('0x1a')](freshdesk[_0xae18('0x2a')]())[_0xae18('0x1a')](realtime['initFreshdeskAccounts']())[_0xae18('0x1a')](desk['getDeskAccounts']())[_0xae18('0x1a')](realtime[_0xae18('0x2b')]())['then'](zoho[_0xae18('0x2c')]())['then'](realtime[_0xae18('0x2d')]())[_0xae18('0x1a')](vtiger[_0xae18('0x2e')]())[_0xae18('0x1a')](realtime[_0xae18('0x2f')]())[_0xae18('0x1a')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0xae18('0x30')]())[_0xae18('0x1a')](servicenow['getServicenowAccounts']())[_0xae18('0x1a')](realtime[_0xae18('0x31')]())[_0xae18('0x1a')](dynamics365['getDynamics365Accounts']())[_0xae18('0x1a')](realtime[_0xae18('0x32')]())[_0xae18('0x1a')](campaign[_0xae18('0x33')]())['then'](realtime[_0xae18('0x34')]())[_0xae18('0x1a')](voiceExtension[_0xae18('0x35')]())['then'](realtime['initVoiceExtensions']())[_0xae18('0x1a')](faxAccount['getFaxAccounts']())[_0xae18('0x1a')](realtime[_0xae18('0x36')]())[_0xae18('0x1a')](function(){return realtime;});}function initParams(){return Promise['resolve']()['then'](voiceQueueReport[_0xae18('0x37')]())[_0xae18('0x1a')](realtime['initVoiceQueueReports']())[_0xae18('0x1a')](cmHopperHistory[_0xae18('0x38')]())[_0xae18('0x1a')](realtime['initVoiceQueueHopperHistory']())[_0xae18('0x1a')](cmHopperHistory['getCampaignHopperHistory']())[_0xae18('0x1a')](realtime[_0xae18('0x39')]())[_0xae18('0x1a')](voiceCallReport[_0xae18('0x3a')]())[_0xae18('0x1a')](realtime[_0xae18('0x3b')]())[_0xae18('0x3c')](function(_0x1ae873){logger[_0xae18('0x3d')](_0xae18('0x3e'),util[_0xae18('0x3f')](_0x1ae873,{'showHidden':![],'depth':null}));});}function main(){return server[_0xae18('0x40')](realtime,preview,fax)[_0xae18('0x1a')](function(){return initRealtime();})[_0xae18('0x1a')](function(){return initParams();})['then'](function(){report[_0xae18('0x41')]();setInterval(initRealtime,0x1388);})[_0xae18('0x3c')](function(_0x2c7bfb){logger['error'](_0xae18('0x42'),util[_0xae18('0x3f')](_0x2c7bfb,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x2cb5=['./realtime','./report','./acw','./trigger','./preview','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','getAgents','then','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','listen','sync','[index.js][main]','util','./server'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x2cb5,0x1e1));var _0x52cb=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0x2cb5[_0x5311e8];return _0x582ad8;};'use strict';var util=require(_0x52cb('0x0'));var moment=require('moment');var server=require(_0x52cb('0x1'));var Realtime=require(_0x52cb('0x2'));var Report=require(_0x52cb('0x3'));var Acw=require(_0x52cb('0x4'));var Trigger=require(_0x52cb('0x5'));var Dialer=require('./dialer');var Preview=require(_0x52cb('0x6'));var Fax=require('./fax');var user=require(_0x52cb('0x7'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x52cb('0x8'));var voiceCallReport=require(_0x52cb('0x9'));var trunk=require(_0x52cb('0xa'));var trigger=require(_0x52cb('0xb'));var template=require(_0x52cb('0xc'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0x52cb('0xd'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x52cb('0xe'));var salesforce=require(_0x52cb('0xf'));var sugarcrm=require(_0x52cb('0x10'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x52cb('0x11'));var zoho=require(_0x52cb('0x12'));var vtiger=require(_0x52cb('0x13'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x52cb('0x14'));var dynamics365=require(_0x52cb('0x15'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x52cb('0x16'))(_0x52cb('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x52cb('0x18')](_0x52cb('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x52cb('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x52cb('0x1a')]()['then'](user[_0x52cb('0x1b')]())['then'](realtime['initAgents']())[_0x52cb('0x1c')](user[_0x52cb('0x1d')]())[_0x52cb('0x1c')](realtime[_0x52cb('0x1e')]())[_0x52cb('0x1c')](trunk[_0x52cb('0x1f')]())[_0x52cb('0x1c')](realtime[_0x52cb('0x20')]())[_0x52cb('0x1c')](voiceQueue[_0x52cb('0x21')]())[_0x52cb('0x1c')](realtime[_0x52cb('0x22')]())['then'](trigger[_0x52cb('0x23')]())['then'](realtime[_0x52cb('0x24')]())['then'](template['getTemplates']())[_0x52cb('0x1c')](realtime['initTemplates']())[_0x52cb('0x1c')](zendesk[_0x52cb('0x25')]())[_0x52cb('0x1c')](realtime['initZendeskAccounts']())[_0x52cb('0x1c')](salesforce['getSalesforceAccounts']())[_0x52cb('0x1c')](realtime['initSalesforceAccounts']())[_0x52cb('0x1c')](sugarcrm[_0x52cb('0x26')]())[_0x52cb('0x1c')](realtime[_0x52cb('0x27')]())[_0x52cb('0x1c')](freshdesk[_0x52cb('0x28')]())[_0x52cb('0x1c')](realtime[_0x52cb('0x29')]())[_0x52cb('0x1c')](desk[_0x52cb('0x2a')]())[_0x52cb('0x1c')](realtime[_0x52cb('0x2b')]())[_0x52cb('0x1c')](zoho[_0x52cb('0x2c')]())[_0x52cb('0x1c')](realtime[_0x52cb('0x2d')]())[_0x52cb('0x1c')](vtiger[_0x52cb('0x2e')]())[_0x52cb('0x1c')](realtime[_0x52cb('0x2f')]())['then'](freshsales[_0x52cb('0x30')]())[_0x52cb('0x1c')](realtime[_0x52cb('0x31')]())['then'](servicenow[_0x52cb('0x32')]())[_0x52cb('0x1c')](realtime[_0x52cb('0x33')]())['then'](dynamics365['getDynamics365Accounts']())[_0x52cb('0x1c')](realtime['initDynamics365Accounts']())[_0x52cb('0x1c')](campaign[_0x52cb('0x34')]())['then'](realtime[_0x52cb('0x35')]())['then'](voiceExtension[_0x52cb('0x36')]())[_0x52cb('0x1c')](realtime[_0x52cb('0x37')]())[_0x52cb('0x1c')](faxAccount[_0x52cb('0x38')]())[_0x52cb('0x1c')](realtime[_0x52cb('0x39')]())[_0x52cb('0x1c')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x52cb('0x1c')](voiceQueueReport[_0x52cb('0x3a')]())[_0x52cb('0x1c')](realtime[_0x52cb('0x3b')]())[_0x52cb('0x1c')](cmHopperHistory[_0x52cb('0x3c')]())[_0x52cb('0x1c')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime['initCampaignHopperHistory']())[_0x52cb('0x1c')](voiceCallReport[_0x52cb('0x3d')]())[_0x52cb('0x1c')](realtime[_0x52cb('0x3e')]())[_0x52cb('0x3f')](function(_0x4c391f){logger[_0x52cb('0x40')]('[index.js][initParams]',util[_0x52cb('0x41')](_0x4c391f,{'showHidden':![],'depth':null}));});}function main(){return server[_0x52cb('0x42')](realtime,preview,fax)[_0x52cb('0x1c')](function(){return initRealtime();})['then'](function(){return initParams();})[_0x52cb('0x1c')](function(){report[_0x52cb('0x43')]();setInterval(initRealtime,0x1388);})[_0x52cb('0x3f')](function(_0x3a4df4){logger[_0x52cb('0x40')](_0x52cb('0x44'),util[_0x52cb('0x41')](_0x3a4df4,{'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 920ce37..d56f6b9 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 _0x3bca=['toLowerCase','idle','inuse','talking','statePause','toNumber','format','voiceStatus','stringify','user:%s','emit','user:ami:update','omit','user:presence','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','email','accountcode','fullname','state','unknown','stateTime','status','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x3bca,0x1d1));var _0xa3bc=function(_0x3f4c0c,_0x81c20f){_0x3f4c0c=_0x3f4c0c-0x0;var _0x1bd11f=_0x3bca[_0x3f4c0c];return _0x1bd11f;};'use strict';var _=require('lodash');var util=require(_0xa3bc('0x0'));var moment=require(_0xa3bc('0x1'));var md5=require(_0xa3bc('0x2'));var Redis=require(_0xa3bc('0x3'));var config=require(_0xa3bc('0x4'));config[_0xa3bc('0x5')]=_[_0xa3bc('0x6')](config['redis'],{'host':_0xa3bc('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa3bc('0x5')]));function Agent(_0x53d361){this['id']=_0x53d361['id']||0x0;this[_0xa3bc('0x8')]=_0x53d361[_0xa3bc('0x8')]||'';this[_0xa3bc('0x9')]=_0x53d361['email']||'';this[_0xa3bc('0xa')]=_0x53d361['accountcode']||'';this[_0xa3bc('0xb')]=_0x53d361[_0xa3bc('0xb')]||'';this[_0xa3bc('0xc')]=_0xa3bc('0xd');this[_0xa3bc('0xe')]=0x0;this[_0xa3bc('0xf')]=_0xa3bc('0xd');this['address']='';this[_0xa3bc('0x10')]='';this[_0xa3bc('0x11')]='';this[_0xa3bc('0x12')]='';this[_0xa3bc('0x13')]=_0x53d361[_0xa3bc('0x13')]||![];this['voiceStatus']='unknown';this[_0xa3bc('0x14')]=0x0;this[_0xa3bc('0x15')]='';this[_0xa3bc('0x16')]='';this[_0xa3bc('0x17')]=![];this[_0xa3bc('0x18')]=![];this[_0xa3bc('0x2')]='';}Agent[_0xa3bc('0x19')][_0xa3bc('0x1a')]=function(_0x59b45d){var _0x393616;if(_0x59b45d&&_0x59b45d[_0xa3bc('0xc')]){_0x393616=_0x59b45d[_0xa3bc('0xc')][_0xa3bc('0x1b')]();switch(_0x393616){case'not_inuse':_0x393616=_0xa3bc('0x1c');break;case _0xa3bc('0x1d'):_0x393616=_0xa3bc('0x1e');break;}}if(_0x393616&&this['voiceStatus']!==_0x393616||_0x59b45d[_0xa3bc('0x1f')]){this[_0xa3bc('0x14')]=_[_0xa3bc('0x20')](moment()[_0xa3bc('0x21')]('x'));}if(_0x393616){this[_0xa3bc('0x22')]=_0x393616;}var _0x2980b3={'id':this['id'],'name':this[_0xa3bc('0x8')],'email':this[_0xa3bc('0x9')],'accountcode':this[_0xa3bc('0xa')],'fullname':this[_0xa3bc('0xb')],'state':this[_0xa3bc('0xc')],'stateTime':this[_0xa3bc('0xe')],'status':this['status'],'address':this['address'],'online':this[_0xa3bc('0x13')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xa3bc('0x14')],'voiceStatusCallerIdNumber':this[_0xa3bc('0x15')],'voiceStatusQueue':this[_0xa3bc('0x16')],'interface':this['interface'],'onhold':this['onhold']};var _0x2961a8=md5(JSON[_0xa3bc('0x23')](_0x2980b3));if(this[_0xa3bc('0x2')]!==_0x2961a8){this[_0xa3bc('0x2')]=_0x2961a8;io['to'](util[_0xa3bc('0x21')](_0xa3bc('0x24'),_0x2980b3['name']))[_0xa3bc('0x25')](_0xa3bc('0x26'),_[_0xa3bc('0x27')](_0x2980b3,[_0xa3bc('0x13')]));io[_0xa3bc('0x25')](_0xa3bc('0x28'),_0x2980b3);}};module['exports']=Agent; \ No newline at end of file +var _0x9543=['user:%s','emit','user:ami:update','omit','user:presence','lodash','util','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','online','voiceStatus','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','talking','voiceStatusTime','toNumber','format','voiceStatusCallerIdNumber','interface','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9543,0xad));var _0x3954=function(_0xd8236d,_0x16f592){_0xd8236d=_0xd8236d-0x0;var _0x3a0dca=_0x9543[_0xd8236d];return _0x3a0dca;};'use strict';var _=require(_0x3954('0x0'));var util=require(_0x3954('0x1'));var moment=require(_0x3954('0x2'));var md5=require(_0x3954('0x3'));var Redis=require(_0x3954('0x4'));var config=require('../../../config/environment');config[_0x3954('0x5')]=_[_0x3954('0x6')](config[_0x3954('0x5')],{'host':_0x3954('0x7'),'port':0x18eb});var io=require(_0x3954('0x8'))(new Redis(config[_0x3954('0x5')]));function Agent(_0xcd1ed8){this['id']=_0xcd1ed8['id']||0x0;this['name']=_0xcd1ed8[_0x3954('0x9')]||'';this[_0x3954('0xa')]=_0xcd1ed8[_0x3954('0xa')]||'';this[_0x3954('0xb')]=_0xcd1ed8[_0x3954('0xb')]||'';this[_0x3954('0xc')]=_0xcd1ed8['fullname']||'';this[_0x3954('0xd')]=_0x3954('0xe');this[_0x3954('0xf')]=0x0;this[_0x3954('0x10')]=_0x3954('0xe');this[_0x3954('0x11')]='';this[_0x3954('0x12')]='';this[_0x3954('0x13')]='';this['interface']='';this[_0x3954('0x14')]=_0xcd1ed8[_0x3954('0x14')]||![];this[_0x3954('0x15')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x3954('0x16')]='';this[_0x3954('0x17')]=![];this[_0x3954('0x18')]=![];this['md5']='';}Agent[_0x3954('0x19')][_0x3954('0x1a')]=function(_0x23372d){var _0x4c3da4;if(_0x23372d&&_0x23372d['state']){_0x4c3da4=_0x23372d[_0x3954('0xd')][_0x3954('0x1b')]();switch(_0x4c3da4){case _0x3954('0x1c'):_0x4c3da4=_0x3954('0x1d');break;case'inuse':_0x4c3da4=_0x3954('0x1e');break;}}if(_0x4c3da4&&this[_0x3954('0x15')]!==_0x4c3da4||_0x23372d['statePause']){this[_0x3954('0x1f')]=_[_0x3954('0x20')](moment()[_0x3954('0x21')]('x'));}if(_0x4c3da4){this['voiceStatus']=_0x4c3da4;}var _0x7d1f69={'id':this['id'],'name':this[_0x3954('0x9')],'email':this[_0x3954('0xa')],'accountcode':this[_0x3954('0xb')],'fullname':this[_0x3954('0xc')],'state':this[_0x3954('0xd')],'stateTime':this[_0x3954('0xf')],'status':this[_0x3954('0x10')],'address':this[_0x3954('0x11')],'online':this[_0x3954('0x14')],'voiceStatus':this[_0x3954('0x15')],'voiceStatusTime':this[_0x3954('0x1f')],'voiceStatusCallerIdNumber':this[_0x3954('0x22')],'voiceStatusQueue':this[_0x3954('0x16')],'interface':this[_0x3954('0x23')],'onhold':this[_0x3954('0x17')]};var _0x505a5a=md5(JSON[_0x3954('0x24')](_0x7d1f69));if(this[_0x3954('0x3')]!==_0x505a5a){this['md5']=_0x505a5a;io['to'](util[_0x3954('0x21')](_0x3954('0x25'),_0x7d1f69[_0x3954('0x9')]))[_0x3954('0x26')](_0x3954('0x27'),_[_0x3954('0x28')](_0x7d1f69,[_0x3954('0x14')]));io['emit'](_0x3954('0x29'),_0x7d1f69);}};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 848eac8..8ddb30a 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 _0x67b9=['dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','originated','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','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','name','dialAMDActive'];(function(_0x776414,_0x10d2de){var _0x7ec5f6=function(_0x33e112){while(--_0x33e112){_0x776414['push'](_0x776414['shift']());}};_0x7ec5f6(++_0x10d2de);}(_0x67b9,0x1e9));var _0x967b=function(_0x2c50b7,_0x7604fb){_0x2c50b7=_0x2c50b7-0x0;var _0x46b5a9=_0x67b9[_0x2c50b7];return _0x46b5a9;};'use strict';function Campaign(_0x278859){this['id']=_0x278859['id']||0x0;this['name']=_0x278859['name']||'';this['type']=_0x278859['type']||'campaign';this[_0x967b('0x0')]=0x0;this['temp']=0x0;this[_0x967b('0x1')]=0x0;this[_0x967b('0x2')]=0x0;this['message']='';this[_0x967b('0x3')]=!![];this[_0x967b('0x4')]=_0x278859[_0x967b('0x4')];this[_0x967b('0x5')]=_0x278859[_0x967b('0x5')];this['dialTimezone']=_0x278859[_0x967b('0x6')]||null;this['dialGlobalInterval']=_0x278859[_0x967b('0x7')]?_0x278859[_0x967b('0x7')]:null;this[_0x967b('0x8')]=_0x278859[_0x967b('0x8')];this[_0x967b('0x9')]=_0x278859[_0x967b('0x9')];this[_0x967b('0xa')]=_0x278859['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x278859['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x278859[_0x967b('0xb')];this[_0x967b('0xc')]=_0x278859[_0x967b('0xc')];this[_0x967b('0xd')]=_0x278859[_0x967b('0xd')];this[_0x967b('0xe')]=_0x278859[_0x967b('0xe')];this[_0x967b('0xf')]=_0x278859['dialNoAnswerRetryFrequency'];this[_0x967b('0x10')]=_0x278859['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x278859[_0x967b('0x11')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x278859[_0x967b('0x12')]||0x96;this['dialDropMaxRetry']=_0x278859[_0x967b('0x13')]||0x3;this[_0x967b('0x14')]=_0x278859[_0x967b('0x14')]||0x96;this[_0x967b('0x15')]=_0x278859[_0x967b('0x15')]||0x3;this['dialAbandonedRetryFrequency']=_0x278859[_0x967b('0x16')]||0x96;this[_0x967b('0x17')]=_0x278859[_0x967b('0x17')]||0x3;this[_0x967b('0x18')]=_0x278859['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x278859[_0x967b('0x19')]||0x3;this['dialAgentRejectRetryFrequency']=_0x278859[_0x967b('0x1a')]||0x96;this[_0x967b('0x1b')]=_0x278859[_0x967b('0x1b')]||_0x967b('0x1c');this[_0x967b('0x1d')]=_0x278859[_0x967b('0x1d')]||undefined;this[_0x967b('0x1e')]=_0x278859[_0x967b('0x1e')]||undefined;this[_0x967b('0x1f')]=_0x278859[_0x967b('0x1f')]||undefined;this[_0x967b('0x20')]=_0x278859['TrunkBackup']?_0x278859[_0x967b('0x20')]:undefined;this['Trunk']=_0x278859[_0x967b('0x21')]?_0x278859[_0x967b('0x21')]:undefined;this[_0x967b('0x22')]=_0x278859[_0x967b('0x22')]?_0x278859[_0x967b('0x22')]:undefined;this[_0x967b('0x23')]=_0x278859[_0x967b('0x23')]?_0x278859[_0x967b('0x23')]:undefined;this[_0x967b('0x24')]=_0x278859['SquareProject']?_0x278859[_0x967b('0x23')][_0x967b('0x25')]:undefined;this[_0x967b('0x26')]=_0x278859[_0x967b('0x26')]||![];this[_0x967b('0x27')]=_0x278859[_0x967b('0x27')];this[_0x967b('0x28')]=_0x278859[_0x967b('0x28')];this[_0x967b('0x29')]=_0x278859['dialAMDAfterGreetingSilence'];this[_0x967b('0x2a')]=_0x278859['dialAMDTotalAnalysisTime'];this[_0x967b('0x2b')]=_0x278859['dialAMDMinWordLength'];this[_0x967b('0x2c')]=_0x278859[_0x967b('0x2c')];this[_0x967b('0x2d')]=_0x278859['dialAMDMaximumNumberOfWords'];this[_0x967b('0x2e')]=_0x278859[_0x967b('0x2e')];this[_0x967b('0x2f')]=_0x278859[_0x967b('0x2f')];}module['exports']=Campaign; \ No newline at end of file +var _0x6ee3=['dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','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','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry'];(function(_0x4f65ad,_0x56c8ff){var _0x35a43c=function(_0x53a997){while(--_0x53a997){_0x4f65ad['push'](_0x4f65ad['shift']());}};_0x35a43c(++_0x56c8ff);}(_0x6ee3,0x1bb));var _0x36ee=function(_0x4ba9e2,_0x15fc0e){_0x4ba9e2=_0x4ba9e2-0x0;var _0x4619f7=_0x6ee3[_0x4ba9e2];return _0x4619f7;};'use strict';function Campaign(_0x2eccb1){this['id']=_0x2eccb1['id']||0x0;this[_0x36ee('0x0')]=_0x2eccb1['name']||'';this[_0x36ee('0x1')]=_0x2eccb1[_0x36ee('0x1')]||_0x36ee('0x2');this[_0x36ee('0x3')]=0x0;this['temp']=0x0;this[_0x36ee('0x4')]=0x0;this[_0x36ee('0x5')]=0x0;this[_0x36ee('0x6')]='';this[_0x36ee('0x7')]=!![];this[_0x36ee('0x8')]=_0x2eccb1['active'];this[_0x36ee('0x9')]=_0x2eccb1[_0x36ee('0x9')];this[_0x36ee('0xa')]=_0x2eccb1[_0x36ee('0xa')]||null;this['dialGlobalInterval']=_0x2eccb1[_0x36ee('0xb')]?_0x2eccb1['dialGlobalInterval']:null;this[_0x36ee('0xc')]=_0x2eccb1[_0x36ee('0xc')];this[_0x36ee('0xd')]=_0x2eccb1[_0x36ee('0xd')];this[_0x36ee('0xe')]=_0x2eccb1[_0x36ee('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0x2eccb1[_0x36ee('0xf')];this['dialCongestionRetryFrequency']=_0x2eccb1[_0x36ee('0x10')];this[_0x36ee('0x11')]=_0x2eccb1[_0x36ee('0x11')];this[_0x36ee('0x12')]=_0x2eccb1[_0x36ee('0x12')];this[_0x36ee('0x13')]=_0x2eccb1[_0x36ee('0x13')];this['dialNoAnswerRetryFrequency']=_0x2eccb1['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x2eccb1['dialGlobalMaxRetry'];this[_0x36ee('0x14')]=_0x2eccb1['dialNoSuchNumberMaxRetry']||0x3;this[_0x36ee('0x15')]=_0x2eccb1[_0x36ee('0x15')]||0x96;this[_0x36ee('0x16')]=_0x2eccb1[_0x36ee('0x16')]||0x3;this[_0x36ee('0x17')]=_0x2eccb1[_0x36ee('0x17')]||0x96;this[_0x36ee('0x18')]=_0x2eccb1[_0x36ee('0x18')]||0x3;this['dialAbandonedRetryFrequency']=_0x2eccb1[_0x36ee('0x19')]||0x96;this[_0x36ee('0x1a')]=_0x2eccb1[_0x36ee('0x1a')]||0x3;this[_0x36ee('0x1b')]=_0x2eccb1[_0x36ee('0x1b')]||0x96;this[_0x36ee('0x1c')]=_0x2eccb1['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x2eccb1[_0x36ee('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x2eccb1[_0x36ee('0x1e')]||_0x36ee('0x1f');this[_0x36ee('0x20')]=_0x2eccb1[_0x36ee('0x20')]||undefined;this[_0x36ee('0x21')]=_0x2eccb1[_0x36ee('0x21')]||undefined;this['dialCutDigit']=_0x2eccb1[_0x36ee('0x22')]||undefined;this[_0x36ee('0x23')]=_0x2eccb1['TrunkBackup']?_0x2eccb1[_0x36ee('0x23')]:undefined;this[_0x36ee('0x24')]=_0x2eccb1[_0x36ee('0x24')]?_0x2eccb1[_0x36ee('0x24')]:undefined;this['Interval']=_0x2eccb1[_0x36ee('0x25')]?_0x2eccb1[_0x36ee('0x25')]:undefined;this[_0x36ee('0x26')]=_0x2eccb1[_0x36ee('0x26')]?_0x2eccb1[_0x36ee('0x26')]:undefined;this[_0x36ee('0x27')]=_0x2eccb1[_0x36ee('0x26')]?_0x2eccb1['SquareProject'][_0x36ee('0x0')]:undefined;this['dialAMDActive']=_0x2eccb1[_0x36ee('0x28')]||![];this[_0x36ee('0x29')]=_0x2eccb1['dialAMDInitialSilence'];this[_0x36ee('0x2a')]=_0x2eccb1['dialAMDGreeting'];this[_0x36ee('0x2b')]=_0x2eccb1[_0x36ee('0x2b')];this[_0x36ee('0x2c')]=_0x2eccb1[_0x36ee('0x2c')];this[_0x36ee('0x2d')]=_0x2eccb1['dialAMDMinWordLength'];this[_0x36ee('0x2e')]=_0x2eccb1['dialAMDBetweenWordsSilence'];this[_0x36ee('0x2f')]=_0x2eccb1['dialAMDMaximumNumberOfWords'];this[_0x36ee('0x30')]=_0x2eccb1[_0x36ee('0x30')];this[_0x36ee('0x31')]=_0x2eccb1['dialAMDMaximumWordLength'];}module[_0x36ee('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 171365e..19cda06 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 _0x4658=['endtime','unmanaged','abandoned','lastapplication','lastdata','holdtime','type','tag','disposition','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','accountcode','linkedid','exten','answered'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x4658,0x74));var _0x8465=function(_0xfbca9a,_0x3b872d){_0xfbca9a=_0xfbca9a-0x0;var _0x2ec6d0=_0x4658[_0xfbca9a];return _0x2ec6d0;};'use strict';function Channel(){this[_0x8465('0x0')]=null;this[_0x8465('0x1')]='';this[_0x8465('0x2')]='';this[_0x8465('0x3')]=0x0;this['calleridname']='';this[_0x8465('0x4')]=undefined;this['connectedlinename']=undefined;this[_0x8465('0x5')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0x8465('0x6')]=0x0;this[_0x8465('0x7')]=0x0;this[_0x8465('0x8')]=![];this['answertime']=null;this[_0x8465('0x9')]=null;this[_0x8465('0xa')]=![];this[_0x8465('0xb')]=![];this[_0x8465('0xc')]='';this[_0x8465('0xd')]='';this['duration']=0x0;this['billableseconds']=0x0;this[_0x8465('0xe')]=0x0;this[_0x8465('0xf')]=null;this[_0x8465('0x10')]=null;this[_0x8465('0x11')]=null;this['monitor']=![];this[_0x8465('0x12')]=null;this[_0x8465('0x13')]=null;this[_0x8465('0x14')]=[];this[_0x8465('0x15')]=undefined;this[_0x8465('0x16')]=undefined;this['transferType']=undefined;this[_0x8465('0x17')]=0x0;}module[_0x8465('0x18')]=Channel; \ No newline at end of file +var _0x419f=['calleridname','connectedlinenum','accountcode','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','duration','billableseconds','type','tag','disposition','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','exports','starttime','channel','destinationchannel','calleridnum'];(function(_0x4d9869,_0x4d3b0c){var _0x2338b1=function(_0x11a369){while(--_0x11a369){_0x4d9869['push'](_0x4d9869['shift']());}};_0x2338b1(++_0x4d3b0c);}(_0x419f,0x176));var _0xf419=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x419f[_0x53ccf2];return _0x5a2964;};'use strict';function Channel(){this[_0xf419('0x0')]=null;this[_0xf419('0x1')]='';this[_0xf419('0x2')]='';this[_0xf419('0x3')]=0x0;this[_0xf419('0x4')]='';this[_0xf419('0x5')]=undefined;this['connectedlinename']=undefined;this[_0xf419('0x6')]=0x0;this['context']='';this[_0xf419('0x7')]=0x0;this[_0xf419('0x8')]=0x0;this[_0xf419('0x9')]=0x0;this[_0xf419('0xa')]=![];this[_0xf419('0xb')]=null;this[_0xf419('0xc')]=null;this[_0xf419('0xd')]=![];this[_0xf419('0xe')]=![];this[_0xf419('0xf')]='';this['lastdata']='';this[_0xf419('0x10')]=0x0;this[_0xf419('0x11')]=0x0;this['holdtime']=0x0;this[_0xf419('0x12')]=null;this[_0xf419('0x13')]=null;this[_0xf419('0x14')]=null;this['monitor']=![];this[_0xf419('0x15')]=null;this[_0xf419('0x16')]=null;this[_0xf419('0x17')]=[];this[_0xf419('0x18')]=undefined;this[_0xf419('0x19')]=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0xf419('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 4975f02..a78de7c 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 _0x5df2=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x2d5cfc,_0x1d2021){var _0x3082e3=function(_0x2bbc78){while(--_0x2bbc78){_0x2d5cfc['push'](_0x2d5cfc['shift']());}};_0x3082e3(++_0x1d2021);}(_0x5df2,0x127));var _0x25df=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5df2[_0x42cae2];return _0x5f256f;};'use strict';function DeskAccount(_0x10e0c2){this['id']=_0x10e0c2['id']||0x0;this[_0x25df('0x0')]=_0x10e0c2['name']||'';this[_0x25df('0x1')]=_0x10e0c2['username']||'';this[_0x25df('0x2')]=_0x10e0c2[_0x25df('0x2')]||'';this[_0x25df('0x3')]=_0x10e0c2['authType']||'';this[_0x25df('0x4')]=_0x10e0c2[_0x25df('0x4')]||'';this[_0x25df('0x5')]=_0x10e0c2['consumerKey']||'';this[_0x25df('0x6')]=_0x10e0c2[_0x25df('0x6')]||'';this[_0x25df('0x7')]=_0x10e0c2[_0x25df('0x7')]||'';this[_0x25df('0x8')]=_0x10e0c2[_0x25df('0x8')]||'';this[_0x25df('0x9')]=_0x10e0c2[_0x25df('0x9')]||'';this[_0x25df('0xa')]=_0x10e0c2[_0x25df('0xa')]||'';this[_0x25df('0xb')]=_0x10e0c2[_0x25df('0xb')]||{};}module[_0x25df('0xc')]=DeskAccount; \ No newline at end of file +var _0xe1b2=['tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0xfa5a5c,_0x557089){var _0x4e4b3b=function(_0x4b3e7a){while(--_0x4b3e7a){_0xfa5a5c['push'](_0xfa5a5c['shift']());}};_0x4e4b3b(++_0x557089);}(_0xe1b2,0x18b));var _0x2e1b=function(_0x361874,_0x17baa6){_0x361874=_0x361874-0x0;var _0x4b3868=_0xe1b2[_0x361874];return _0x4b3868;};'use strict';function DeskAccount(_0x27e8ef){this['id']=_0x27e8ef['id']||0x0;this['name']=_0x27e8ef[_0x2e1b('0x0')]||'';this[_0x2e1b('0x1')]=_0x27e8ef['username']||'';this['remoteUri']=_0x27e8ef[_0x2e1b('0x2')]||'';this[_0x2e1b('0x3')]=_0x27e8ef[_0x2e1b('0x3')]||'';this['password']=_0x27e8ef[_0x2e1b('0x4')]||'';this['consumerKey']=_0x27e8ef[_0x2e1b('0x5')]||'';this[_0x2e1b('0x6')]=_0x27e8ef['consumerSecret']||'';this[_0x2e1b('0x7')]=_0x27e8ef[_0x2e1b('0x7')]||'';this[_0x2e1b('0x8')]=_0x27e8ef[_0x2e1b('0x8')]||'';this[_0x2e1b('0x9')]=_0x27e8ef['type']||'';this[_0x2e1b('0xa')]=_0x27e8ef['serverUrl']||'';this[_0x2e1b('0xb')]=_0x27e8ef[_0x2e1b('0xb')]||{};}module[_0x2e1b('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 56e4d6b..3659e13 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 _0xd544=['modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0xfcd9be,_0x4e4872){var _0x3591dc=function(_0x52d548){while(--_0x52d548){_0xfcd9be['push'](_0xfcd9be['shift']());}};_0x3591dc(++_0x4e4872);}(_0xd544,0x184));var _0x4d54=function(_0x32ca6e,_0x40f376){_0x32ca6e=_0x32ca6e-0x0;var _0x2108aa=_0xd544[_0x32ca6e];return _0x2108aa;};'use strict';function Dynamics365Account(_0x518f20){this['id']=_0x518f20['id']||0x0;this['name']=_0x518f20[_0x4d54('0x0')]||'';this[_0x4d54('0x1')]=_0x518f20[_0x4d54('0x1')]||'';this[_0x4d54('0x2')]=_0x518f20['password']||'';this['remoteUri']=_0x518f20[_0x4d54('0x3')]||'';this[_0x4d54('0x4')]=_0x518f20[_0x4d54('0x4')]||'';this[_0x4d54('0x5')]=_0x518f20[_0x4d54('0x5')]||'';this[_0x4d54('0x6')]=_0x518f20[_0x4d54('0x6')]||{};this[_0x4d54('0x7')]=_0x518f20[_0x4d54('0x7')]||'';this[_0x4d54('0x8')]=_0x518f20[_0x4d54('0x8')]||![];this[_0x4d54('0x9')]=_0x518f20['Configurations']||{};this[_0x4d54('0xa')]=_0x518f20[_0x4d54('0xa')]||{};}module[_0x4d54('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x786e=['exports','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x786e,0x9b));var _0xe786=function(_0x31e584,_0x4d9f7f){_0x31e584=_0x31e584-0x0;var _0x5686d0=_0x786e[_0x31e584];return _0x5686d0;};'use strict';function Dynamics365Account(_0x1cfb86){this['id']=_0x1cfb86['id']||0x0;this['name']=_0x1cfb86['name']||'';this[_0xe786('0x0')]=_0x1cfb86[_0xe786('0x0')]||'';this[_0xe786('0x1')]=_0x1cfb86[_0xe786('0x1')]||'';this['remoteUri']=_0x1cfb86[_0xe786('0x2')]||'';this[_0xe786('0x3')]=_0x1cfb86[_0xe786('0x3')]||'';this[_0xe786('0x4')]=_0x1cfb86[_0xe786('0x4')]||'';this['clientSecret']=_0x1cfb86[_0xe786('0x5')]||{};this[_0xe786('0x6')]=_0x1cfb86['serverUrl']||'';this[_0xe786('0x7')]=_0x1cfb86[_0xe786('0x7')]||![];this[_0xe786('0x8')]=_0x1cfb86[_0xe786('0x8')]||{};this[_0xe786('0x9')]=_0x1cfb86[_0xe786('0x9')]||{};}module[_0xe786('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 75140d5..9e130e1 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 _0x670a=['modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x670a,0xea));var _0xa670=function(_0x40cad7,_0x510bd1){_0x40cad7=_0x40cad7-0x0;var _0x5093de=_0x670a[_0x40cad7];return _0x5093de;};'use strict';function FaxAccount(_0x4b09ed){this['id']=_0x4b09ed['id']||0x0;this[_0xa670('0x0')]=_0x4b09ed[_0xa670('0x0')]||'';this['description']=_0x4b09ed['description'];this[_0xa670('0x1')]=_0x4b09ed['ecm'];this[_0xa670('0x2')]=_0x4b09ed[_0xa670('0x2')];this['localstationid']=_0x4b09ed[_0xa670('0x3')];this[_0xa670('0x4')]=_0x4b09ed['minrate']||0x960;this[_0xa670('0x5')]=_0x4b09ed['maxrate']||0x3840;this[_0xa670('0x6')]=_0x4b09ed[_0xa670('0x6')]||_0xa670('0x7');this[_0xa670('0x8')]=_0x4b09ed[_0xa670('0x8')]||'no';this['faxdetect']=_0x4b09ed[_0xa670('0x9')]||'no';this[_0xa670('0xa')]=_0x4b09ed[_0xa670('0xa')]||0x1388;this[_0xa670('0xb')]=_0x4b09ed['tech']||'SIP';this[_0xa670('0xc')]=_0x4b09ed[_0xa670('0xc')]?_0x4b09ed[_0xa670('0xc')]:undefined;this[_0xa670('0xd')]=_0x4b09ed['ListId'];this[_0xa670('0xe')]=_0x4b09ed[_0xa670('0xe')];}module[_0xa670('0xf')]=FaxAccount; \ No newline at end of file +var _0xcbe2=['headerinfo','localstationid','minrate','maxrate','v17,v27,v29','gateway','faxdetect','tech','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcbe2,0x1ce));var _0x2cbe=function(_0x54d3bb,_0x12aaa1){_0x54d3bb=_0x54d3bb-0x0;var _0x49ff63=_0xcbe2[_0x54d3bb];return _0x49ff63;};'use strict';function FaxAccount(_0x2c8cd3){this['id']=_0x2c8cd3['id']||0x0;this[_0x2cbe('0x0')]=_0x2c8cd3[_0x2cbe('0x0')]||'';this[_0x2cbe('0x1')]=_0x2c8cd3[_0x2cbe('0x1')];this[_0x2cbe('0x2')]=_0x2c8cd3[_0x2cbe('0x2')];this[_0x2cbe('0x3')]=_0x2c8cd3['headerinfo'];this[_0x2cbe('0x4')]=_0x2c8cd3['localstationid'];this[_0x2cbe('0x5')]=_0x2c8cd3[_0x2cbe('0x5')]||0x960;this[_0x2cbe('0x6')]=_0x2c8cd3[_0x2cbe('0x6')]||0x3840;this['modem']=_0x2c8cd3['modem']||_0x2cbe('0x7');this[_0x2cbe('0x8')]=_0x2c8cd3['gateway']||'no';this[_0x2cbe('0x9')]=_0x2c8cd3[_0x2cbe('0x9')]||'no';this['t38timeout']=_0x2c8cd3['t38timeout']||0x1388;this['tech']=_0x2c8cd3[_0x2cbe('0xa')]||'SIP';this['Trunk']=_0x2c8cd3[_0x2cbe('0xb')]?_0x2c8cd3[_0x2cbe('0xb')]:undefined;this['ListId']=_0x2c8cd3[_0x2cbe('0xc')];this[_0x2cbe('0xd')]=_0x2c8cd3[_0x2cbe('0xd')];}module[_0x2cbe('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 6dfb5ef..6a3c114 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 _0xe5c6=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x3b660f,_0x45c3db){var _0x187a29=function(_0x11cedf){while(--_0x11cedf){_0x3b660f['push'](_0x3b660f['shift']());}};_0x187a29(++_0x45c3db);}(_0xe5c6,0x1f3));var _0x6e5c=function(_0xefafa,_0x6e1aa){_0xefafa=_0xefafa-0x0;var _0x42d8d7=_0xe5c6[_0xefafa];return _0x42d8d7;};'use strict';function FreshdeskAccount(_0x87d4f5){this['id']=_0x87d4f5['id']||0x0;this['name']=_0x87d4f5[_0x6e5c('0x0')]||'';this[_0x6e5c('0x1')]=_0x87d4f5['username']||'';this[_0x6e5c('0x2')]=_0x87d4f5[_0x6e5c('0x3')]||'';this[_0x6e5c('0x4')]=_0x87d4f5[_0x6e5c('0x4')]||'';this[_0x6e5c('0x5')]=_0x87d4f5['serverUrl']||'';this[_0x6e5c('0x6')]=_0x87d4f5[_0x6e5c('0x6')]||{};}module[_0x6e5c('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xd4bd=['serverUrl','Configurations','exports','username','apiKey','token','remoteUri'];(function(_0x12278c,_0x3138bd){var _0x3a2e2e=function(_0x4de548){while(--_0x4de548){_0x12278c['push'](_0x12278c['shift']());}};_0x3a2e2e(++_0x3138bd);}(_0xd4bd,0x18b));var _0xdd4b=function(_0x4ef6f3,_0xac58f1){_0x4ef6f3=_0x4ef6f3-0x0;var _0x82f917=_0xd4bd[_0x4ef6f3];return _0x82f917;};'use strict';function FreshdeskAccount(_0x3568df){this['id']=_0x3568df['id']||0x0;this['name']=_0x3568df['name']||'';this[_0xdd4b('0x0')]=_0x3568df['username']||'';this[_0xdd4b('0x1')]=_0x3568df[_0xdd4b('0x2')]||'';this['remoteUri']=_0x3568df[_0xdd4b('0x3')]||'';this[_0xdd4b('0x4')]=_0x3568df[_0xdd4b('0x4')]||'';this['Configurations']=_0x3568df[_0xdd4b('0x5')]||{};}module[_0xdd4b('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index f393e85..49e1487 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 _0x8832=['remoteUri','serverUrl','Configurations','name','username','apiKey','token'];(function(_0x4ae1a4,_0x4d3a2c){var _0x82ac07=function(_0x3dab0b){while(--_0x3dab0b){_0x4ae1a4['push'](_0x4ae1a4['shift']());}};_0x82ac07(++_0x4d3a2c);}(_0x8832,0x1f4));var _0x2883=function(_0x81b69,_0x2c27a9){_0x81b69=_0x81b69-0x0;var _0x2def4d=_0x8832[_0x81b69];return _0x2def4d;};'use strict';function FreshsalesAccount(_0x16396f){this['id']=_0x16396f['id']||0x0;this[_0x2883('0x0')]=_0x16396f['name']||'';this['username']=_0x16396f[_0x2883('0x1')]||'';this[_0x2883('0x2')]=_0x16396f[_0x2883('0x3')]||'';this['remoteUri']=_0x16396f[_0x2883('0x4')]||'';this['serverUrl']=_0x16396f[_0x2883('0x5')]||'';this[_0x2883('0x6')]=_0x16396f[_0x2883('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xc627=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x32d2d3,_0x5e503b){var _0x47d253=function(_0x2d6d3c){while(--_0x2d6d3c){_0x32d2d3['push'](_0x32d2d3['shift']());}};_0x47d253(++_0x5e503b);}(_0xc627,0x14a));var _0x7c62=function(_0x55a010,_0x173630){_0x55a010=_0x55a010-0x0;var _0x2623bf=_0xc627[_0x55a010];return _0x2623bf;};'use strict';function FreshsalesAccount(_0x3b22f4){this['id']=_0x3b22f4['id']||0x0;this[_0x7c62('0x0')]=_0x3b22f4[_0x7c62('0x0')]||'';this[_0x7c62('0x1')]=_0x3b22f4['username']||'';this[_0x7c62('0x2')]=_0x3b22f4[_0x7c62('0x3')]||'';this[_0x7c62('0x4')]=_0x3b22f4[_0x7c62('0x4')]||'';this[_0x7c62('0x5')]=_0x3b22f4[_0x7c62('0x5')]||'';this[_0x7c62('0x6')]=_0x3b22f4[_0x7c62('0x6')]||{};}module[_0x7c62('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index baf211b..2605b42 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 _0x7b90=['accountcode','context','priority','holdtime','assigned','lastAssignedTo','voice','mohtime','variables','exports','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename'];(function(_0x240db1,_0x210115){var _0x1053c4=function(_0x43cb7b){while(--_0x43cb7b){_0x240db1['push'](_0x240db1['shift']());}};_0x1053c4(++_0x210115);}(_0x7b90,0x172));var _0x07b9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7b90[_0x19e35c];return _0x3e1fe8;};'use strict';function QueueReport(){this['type']='inbound';this[_0x07b9('0x0')]='';this['calleridnum']='';this['calleridname']='';this[_0x07b9('0x1')]='';this[_0x07b9('0x2')]=null;this[_0x07b9('0x3')]=null;this[_0x07b9('0x4')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0x07b9('0x5')]=null;this[_0x07b9('0x6')]=![];this[_0x07b9('0x7')]=null;this[_0x07b9('0x8')]=![];this[_0x07b9('0x9')]=null;this[_0x07b9('0xa')]=0x1;this[_0x07b9('0xb')]='';this[_0x07b9('0xc')]='';this[_0x07b9('0xd')]='';this[_0x07b9('0xe')]='';this[_0x07b9('0xf')]='';this['exten']='';this[_0x07b9('0x10')]='';this[_0x07b9('0x11')]=0x0;this[_0x07b9('0x12')]=![];this[_0x07b9('0x13')]='';this['motionChannel']=_0x07b9('0x14');this[_0x07b9('0x15')]=0x0;this[_0x07b9('0x16')]={};}module[_0x07b9('0x17')]=QueueReport; \ No newline at end of file +var _0x5cb3=['motionChannel','voice','mohtime','variables','exports','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','context','holdtime','assigned','lastAssignedTo'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x5cb3,0xf8));var _0x35cb=function(_0x248be4,_0x1f87f3){_0x248be4=_0x248be4-0x0;var _0x530c58=_0x5cb3[_0x248be4];return _0x530c58;};'use strict';function QueueReport(){this[_0x35cb('0x0')]='inbound';this[_0x35cb('0x1')]='';this[_0x35cb('0x2')]='';this[_0x35cb('0x3')]='';this[_0x35cb('0x4')]='';this[_0x35cb('0x5')]=null;this[_0x35cb('0x6')]=null;this[_0x35cb('0x7')]=0x1;this[_0x35cb('0x8')]=0x1;this[_0x35cb('0x9')]=![];this[_0x35cb('0xa')]=null;this[_0x35cb('0xb')]=![];this[_0x35cb('0xc')]=null;this['queuecallerexit']=![];this[_0x35cb('0xd')]=null;this[_0x35cb('0xe')]=0x1;this[_0x35cb('0xf')]='';this[_0x35cb('0x10')]='';this[_0x35cb('0x11')]='';this['accountcode']='';this[_0x35cb('0x12')]='';this['exten']='';this['priority']='';this[_0x35cb('0x13')]=0x0;this[_0x35cb('0x14')]=![];this[_0x35cb('0x15')]='';this[_0x35cb('0x16')]=_0x35cb('0x17');this[_0x35cb('0x18')]=0x0;this[_0x35cb('0x19')]={};}module[_0x35cb('0x1a')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 8f57474..2524862 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 _0x61c2=['exports','name','username','remoteUri','password','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x49d041,_0x22f509){var _0x59d51f=function(_0x3395c5){while(--_0x3395c5){_0x49d041['push'](_0x49d041['shift']());}};_0x59d51f(++_0x22f509);}(_0x61c2,0x11f));var _0x261c=function(_0x424ad9,_0x29c2cd){_0x424ad9=_0x424ad9-0x0;var _0x28b7cf=_0x61c2[_0x424ad9];return _0x28b7cf;};'use strict';function SalesforceAccount(_0x34f66b){this['id']=_0x34f66b['id']||0x0;this[_0x261c('0x0')]=_0x34f66b[_0x261c('0x0')]||'';this[_0x261c('0x1')]=_0x34f66b['username']||'';this['remoteUri']=_0x34f66b[_0x261c('0x2')]||'';this[_0x261c('0x3')]=_0x34f66b[_0x261c('0x3')]||'';this['clientId']=_0x34f66b['clientId']||'';this[_0x261c('0x4')]=_0x34f66b['clientSecret']||'';this[_0x261c('0x5')]=_0x34f66b['securityToken']||'';this['type']=_0x34f66b[_0x261c('0x6')]||_0x261c('0x7');this[_0x261c('0x8')]=_0x34f66b[_0x261c('0x8')]||'';this[_0x261c('0x9')]=_0x34f66b[_0x261c('0x9')]||{};}module[_0x261c('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xbc7a=['username','remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations','exports','name'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xbc7a,0xa4));var _0xabc7=function(_0x3c11bc,_0x20c2c7){_0x3c11bc=_0x3c11bc-0x0;var _0x141d30=_0xbc7a[_0x3c11bc];return _0x141d30;};'use strict';function SalesforceAccount(_0x3a15f8){this['id']=_0x3a15f8['id']||0x0;this[_0xabc7('0x0')]=_0x3a15f8[_0xabc7('0x0')]||'';this['username']=_0x3a15f8[_0xabc7('0x1')]||'';this[_0xabc7('0x2')]=_0x3a15f8[_0xabc7('0x2')]||'';this[_0xabc7('0x3')]=_0x3a15f8[_0xabc7('0x3')]||'';this[_0xabc7('0x4')]=_0x3a15f8['clientId']||'';this[_0xabc7('0x5')]=_0x3a15f8[_0xabc7('0x5')]||'';this[_0xabc7('0x6')]=_0x3a15f8[_0xabc7('0x6')]||'';this[_0xabc7('0x7')]=_0x3a15f8[_0xabc7('0x7')]||'integrationTab';this[_0xabc7('0x8')]=_0x3a15f8['serverUrl']||'';this[_0xabc7('0x9')]=_0x3a15f8[_0xabc7('0x9')]||{};}module[_0xabc7('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 8e1e40a..d18847f 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 _0x5a45=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x1c2e29,_0x3ad48a){var _0x39174d=function(_0x2a3689){while(--_0x2a3689){_0x1c2e29['push'](_0x1c2e29['shift']());}};_0x39174d(++_0x3ad48a);}(_0x5a45,0x1de));var _0x55a4=function(_0x40af45,_0xc068d9){_0x40af45=_0x40af45-0x0;var _0xc46faa=_0x5a45[_0x40af45];return _0xc46faa;};'use strict';function ServicenowAccount(_0x1c5ef3){this['id']=_0x1c5ef3['id']||0x0;this['name']=_0x1c5ef3[_0x55a4('0x0')]||'';this[_0x55a4('0x1')]=_0x1c5ef3['username']||'';this[_0x55a4('0x2')]=_0x1c5ef3[_0x55a4('0x2')]||'';this[_0x55a4('0x3')]=_0x1c5ef3[_0x55a4('0x3')]||'';this[_0x55a4('0x4')]=_0x1c5ef3['serverUrl']||'';this[_0x55a4('0x5')]=_0x1c5ef3[_0x55a4('0x5')]||{};}module[_0x55a4('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x210c=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x355061,_0x3ba952){var _0x25f3ae=function(_0xc564ed){while(--_0xc564ed){_0x355061['push'](_0x355061['shift']());}};_0x25f3ae(++_0x3ba952);}(_0x210c,0xf4));var _0xc210=function(_0x39580c,_0x22425c){_0x39580c=_0x39580c-0x0;var _0x1a4cd8=_0x210c[_0x39580c];return _0x1a4cd8;};'use strict';function ServicenowAccount(_0x2f8738){this['id']=_0x2f8738['id']||0x0;this['name']=_0x2f8738[_0xc210('0x0')]||'';this[_0xc210('0x1')]=_0x2f8738[_0xc210('0x1')]||'';this[_0xc210('0x2')]=_0x2f8738[_0xc210('0x2')]||'';this[_0xc210('0x3')]=_0x2f8738[_0xc210('0x3')]||'';this['serverUrl']=_0x2f8738[_0xc210('0x4')]||'';this[_0xc210('0x5')]=_0x2f8738[_0xc210('0x5')]||{};}module[_0xc210('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 70db32f..daf0221 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 _0xa34b=['password','remoteUri','serverUrl','Configurations','exports','username'];(function(_0x70fe8c,_0x44730b){var _0x5abe5f=function(_0x11dd8e){while(--_0x11dd8e){_0x70fe8c['push'](_0x70fe8c['shift']());}};_0x5abe5f(++_0x44730b);}(_0xa34b,0xbf));var _0xba34=function(_0x61f3a4,_0x3f1985){_0x61f3a4=_0x61f3a4-0x0;var _0x3a8133=_0xa34b[_0x61f3a4];return _0x3a8133;};'use strict';function SugarcrmAccount(_0x4be278){this['id']=_0x4be278['id']||0x0;this['name']=_0x4be278['name']||'';this[_0xba34('0x0')]=_0x4be278[_0xba34('0x0')]||'';this[_0xba34('0x1')]=_0x4be278[_0xba34('0x1')]||'';this[_0xba34('0x2')]=_0x4be278[_0xba34('0x2')]||'';this['serverUrl']=_0x4be278[_0xba34('0x3')]||'';this[_0xba34('0x4')]=_0x4be278[_0xba34('0x4')]||{};}module[_0xba34('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0xa915=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x5985e8,_0x587036){var _0x46fa28=function(_0x42d083){while(--_0x42d083){_0x5985e8['push'](_0x5985e8['shift']());}};_0x46fa28(++_0x587036);}(_0xa915,0x1ab));var _0x5a91=function(_0x58c0c8,_0x542880){_0x58c0c8=_0x58c0c8-0x0;var _0x3380d5=_0xa915[_0x58c0c8];return _0x3380d5;};'use strict';function SugarcrmAccount(_0x38886e){this['id']=_0x38886e['id']||0x0;this[_0x5a91('0x0')]=_0x38886e['name']||'';this[_0x5a91('0x1')]=_0x38886e[_0x5a91('0x1')]||'';this[_0x5a91('0x2')]=_0x38886e['password']||'';this[_0x5a91('0x3')]=_0x38886e[_0x5a91('0x3')]||'';this[_0x5a91('0x4')]=_0x38886e['serverUrl']||'';this[_0x5a91('0x5')]=_0x38886e[_0x5a91('0x5')]||{};}module[_0x5a91('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 cb29f56..1722a59 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 _0xe5fb=['state','stateTime','status','unknown','address','exports','name','accountcode'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe5fb,0xce));var _0xbe5f=function(_0x274dd7,_0x2e6051){_0x274dd7=_0x274dd7-0x0;var _0x148829=_0xe5fb[_0x274dd7];return _0x148829;};'use strict';function Telephone(_0x1d2125){this['id']=_0x1d2125['id']||0x0;this[_0xbe5f('0x0')]=_0x1d2125['name']||'';this[_0xbe5f('0x1')]=_0x1d2125[_0xbe5f('0x1')]||'';this[_0xbe5f('0x2')]='unknown';this[_0xbe5f('0x3')]=0x0;this[_0xbe5f('0x4')]=_0xbe5f('0x5');this[_0xbe5f('0x6')]='';}module[_0xbe5f('0x7')]=Telephone; \ No newline at end of file +var _0xbaca=['name','accountcode','unknown','status','address','exports'];(function(_0x4e052f,_0x401f1d){var _0x5aca8b=function(_0x2137d2){while(--_0x2137d2){_0x4e052f['push'](_0x4e052f['shift']());}};_0x5aca8b(++_0x401f1d);}(_0xbaca,0xfc));var _0xabac=function(_0x2a453b,_0x479c50){_0x2a453b=_0x2a453b-0x0;var _0x132f79=_0xbaca[_0x2a453b];return _0x132f79;};'use strict';function Telephone(_0x4f742f){this['id']=_0x4f742f['id']||0x0;this[_0xabac('0x0')]=_0x4f742f['name']||'';this[_0xabac('0x1')]=_0x4f742f[_0xabac('0x1')]||'';this['state']=_0xabac('0x2');this['stateTime']=0x0;this[_0xabac('0x3')]=_0xabac('0x2');this[_0xabac('0x4')]='';}module[_0xabac('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 18d8534..d4ff98c 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x120511,_0xded6b9){var _0x3e47e2=function(_0x550392){while(--_0x550392){_0x120511['push'](_0x120511['shift']());}};_0x3e47e2(++_0xded6b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x1a1752,_0x2641b4){var _0x5ed49b=function(_0x27c1f8){while(--_0x27c1f8){_0x1a1752['push'](_0x1a1752['shift']());}};_0x5ed49b(++_0x2641b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 96a2dd8..3eb593b 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 _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0xdaaa84,_0x56e49d){var _0x1c0252=function(_0x20a26d){while(--_0x20a26d){_0xdaaa84['push'](_0xdaaa84['shift']());}};_0x1c0252(++_0x56e49d);}(_0xda2d,0x102));var _0xdda2=function(_0x2b5615,_0x3362e1){_0x2b5615=_0x2b5615-0x0;var _0x5d2984=_0xda2d[_0x2b5615];return _0x5d2984;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file +var _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x57053d,_0x141171){var _0x301889=function(_0x5d0acd){while(--_0x5d0acd){_0x57053d['push'](_0x57053d['shift']());}};_0x301889(++_0x141171);}(_0x757a,0xde));var _0xa757=function(_0x9cf074,_0x200e5e){_0x9cf074=_0x9cf074-0x0;var _0x117c02=_0x757a[_0x9cf074];return _0x117c02;};'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 763357c..b985998 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 _0xecca=['address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','split','host','port','domain','domainport','refresh','stateRegistry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xecca,0x19b));var _0xaecc=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xecca[_0x17d9e3];return _0x14192d;};'use strict';function Trunk(_0x539cd4){this['id']=_0x539cd4['id']||0x0;this[_0xaecc('0x0')]=_0x539cd4['active']||![];this[_0xaecc('0x1')]=_0x539cd4[_0xaecc('0x1')]||'';this[_0xaecc('0x2')]=_0xaecc('0x3');this[_0xaecc('0x4')]=0x0;this[_0xaecc('0x5')]=_0xaecc('0x3');this[_0xaecc('0x6')]=_0x539cd4['registry']&&_0x539cd4['registry']['indexOf'](':')?_0x539cd4['registry'][_0xaecc('0x7')](':')[0x0]:'';this[_0xaecc('0x8')]='';this[_0xaecc('0x9')]='';this[_0xaecc('0xa')]='';this[_0xaecc('0xb')]='';this[_0xaecc('0xc')]='';this[_0xaecc('0xd')]='unknown';this['registrationtime']='';this[_0xaecc('0xe')]='';this[_0xaecc('0xf')]=_0x539cd4[_0xaecc('0xf')]||'';}module[_0xaecc('0x10')]=Trunk; \ No newline at end of file +var _0xdad6=['domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','unknown','status','registry','indexOf','split','host','port','domain'];(function(_0x54ccd7,_0x3bc3ce){var _0x4e667b=function(_0xab8fea){while(--_0xab8fea){_0x54ccd7['push'](_0x54ccd7['shift']());}};_0x4e667b(++_0x3bc3ce);}(_0xdad6,0x1f4));var _0x6dad=function(_0x2bae0a,_0x564080){_0x2bae0a=_0x2bae0a-0x0;var _0x334e51=_0xdad6[_0x2bae0a];return _0x334e51;};'use strict';function Trunk(_0x49bd1f){this['id']=_0x49bd1f['id']||0x0;this[_0x6dad('0x0')]=_0x49bd1f[_0x6dad('0x0')]||![];this[_0x6dad('0x1')]=_0x49bd1f[_0x6dad('0x1')]||'';this['state']=_0x6dad('0x2');this['stateTime']=0x0;this[_0x6dad('0x3')]='unknown';this[_0x6dad('0x4')]=_0x49bd1f[_0x6dad('0x4')]&&_0x49bd1f['registry'][_0x6dad('0x5')](':')?_0x49bd1f[_0x6dad('0x4')][_0x6dad('0x6')](':')[0x0]:'';this[_0x6dad('0x7')]='';this[_0x6dad('0x8')]='';this[_0x6dad('0x9')]='';this[_0x6dad('0xa')]='';this[_0x6dad('0xb')]='';this[_0x6dad('0xc')]=_0x6dad('0x2');this[_0x6dad('0xd')]='';this[_0x6dad('0xe')]='';this[_0x6dad('0xf')]=_0x49bd1f[_0x6dad('0xf')]||'';}module[_0x6dad('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 ecde0b7..d45fb78 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 _0x6c79=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x437c71,_0x5653b5){var _0x351059=function(_0x25e186){while(--_0x25e186){_0x437c71['push'](_0x437c71['shift']());}};_0x351059(++_0x5653b5);}(_0x6c79,0x1e2));var _0x96c7=function(_0x7bba53,_0x4c319c){_0x7bba53=_0x7bba53-0x0;var _0x11b20b=_0x6c79[_0x7bba53];return _0x11b20b;};'use strict';function voiceExtension(_0x1d2c39){this['id']=_0x1d2c39['id']||0x0;this[_0x96c7('0x0')]=_0x1d2c39[_0x96c7('0x0')]||'';this[_0x96c7('0x1')]=_0x1d2c39[_0x96c7('0x1')]||_0x96c7('0x2');this[_0x96c7('0x3')]=_0x1d2c39[_0x96c7('0x3')]||![];}module[_0x96c7('0x4')]=voiceExtension; \ No newline at end of file +var _0xd9d6=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x1b35a3,_0x29c081){var _0x5f4dbd=function(_0x1b1aaa){while(--_0x1b1aaa){_0x1b35a3['push'](_0x1b35a3['shift']());}};_0x5f4dbd(++_0x29c081);}(_0xd9d6,0xdc));var _0x6d9d=function(_0x481ff7,_0x2b6ebb){_0x481ff7=_0x481ff7-0x0;var _0x1c1573=_0xd9d6[_0x481ff7];return _0x1c1573;};'use strict';function voiceExtension(_0x8b5f7c){this['id']=_0x8b5f7c['id']||0x0;this[_0x6d9d('0x0')]=_0x8b5f7c['exten']||'';this['recordingFormat']=_0x8b5f7c[_0x6d9d('0x1')]||_0x6d9d('0x2');this[_0x6d9d('0x3')]=_0x8b5f7c[_0x6d9d('0x3')]||![];}module[_0x6d9d('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 9acc577..2746f88 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 _0xd8a5=['dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','gsm','fewestcalls','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumBillable','unmanaged','abandoned','available','inUse','invalid','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive'];(function(_0x3fd3ba,_0x1c1069){var _0x34d30d=function(_0x23531b){while(--_0x23531b){_0x3fd3ba['push'](_0x3fd3ba['shift']());}};_0x34d30d(++_0x1c1069);}(_0xd8a5,0x160));var _0x5d8a=function(_0x2b3f58,_0x38d478){_0x2b3f58=_0x2b3f58-0x0;var _0x1b7599=_0xd8a5[_0x2b3f58];return _0x1b7599;};'use strict';var monitorFormat={'wav':_0x5d8a('0x0'),'wav49':'wav49','gsm':_0x5d8a('0x1')};var strategy={'fewestcalls':_0x5d8a('0x2'),'leastrecent':'leastrecent','linear':_0x5d8a('0x3'),'random':_0x5d8a('0x4'),'ringall':_0x5d8a('0x5'),'rr':_0x5d8a('0x6'),'rrmemory':_0x5d8a('0x7'),'rrordered':_0x5d8a('0x8'),'wrandom':_0x5d8a('0x9')};function VoiceQueue(_0x38eaa5){this['id']=_0x38eaa5['id']||0x0;this[_0x5d8a('0xa')]=_0x38eaa5[_0x5d8a('0xa')]||'';this[_0x5d8a('0xb')]=_0x38eaa5[_0x5d8a('0xb')]||'';this[_0x5d8a('0xc')]=_0x38eaa5['type']||_0x5d8a('0xd');this[_0x5d8a('0xe')]=0x0;this[_0x5d8a('0xf')]=0x0;this[_0x5d8a('0x10')]=0x0;this[_0x5d8a('0x11')]=0x0;this['sumHoldTime']=0x0;this[_0x5d8a('0x12')]=0x0;this[_0x5d8a('0x13')]=0x0;this[_0x5d8a('0x14')]=0x0;this[_0x5d8a('0x15')]=0x0;this['busy']=0x0;this[_0x5d8a('0x16')]=0x0;this[_0x5d8a('0x17')]=0x0;this['loggedIn']=0x0;this[_0x5d8a('0x18')]=0x0;this[_0x5d8a('0x19')]=0x0;this[_0x5d8a('0x1a')]=0x0;this[_0x5d8a('0x1b')]=0x0;this[_0x5d8a('0x1c')]=0x0;this[_0x5d8a('0x1d')]=0x0;this[_0x5d8a('0x1e')]=0x0;this[_0x5d8a('0x1f')]=0x0;this[_0x5d8a('0x20')]=_0x38eaa5[_0x5d8a('0x20')]||![];this[_0x5d8a('0x21')]=_0x38eaa5[_0x5d8a('0x21')]||0xa;this['autopause']=_0x38eaa5['autopause']||'no';this[_0x5d8a('0x22')]=!![];this[_0x5d8a('0x23')]='';this['statusMessage']='';this[_0x5d8a('0x24')]=0x0;this[_0x5d8a('0x25')]=0x0;this[_0x5d8a('0x26')]=_0x38eaa5[_0x5d8a('0x26')]||null;this['dialGlobalInterval']=_0x38eaa5[_0x5d8a('0x27')]?_0x38eaa5['dialGlobalInterval']:null;this[_0x5d8a('0x28')]=_0x38eaa5[_0x5d8a('0x28')];this[_0x5d8a('0x29')]=_0x38eaa5[_0x5d8a('0x29')]||_0x5d8a('0x2a');this[_0x5d8a('0x2b')]=_0x38eaa5[_0x5d8a('0x2b')]||0x0;this['dialLimitQueue']=_0x38eaa5[_0x5d8a('0x2c')]||0x0;this[_0x5d8a('0x2d')]=_0x38eaa5[_0x5d8a('0x2d')]||0x1;this[_0x5d8a('0x2e')]=_0x38eaa5['dialPredictiveOptimization']||_0x5d8a('0x2f');this[_0x5d8a('0x30')]=_0x38eaa5[_0x5d8a('0x30')]||0.03;this['dialPredictiveInterval']=_0x38eaa5[_0x5d8a('0x31')]||0x258;this[_0x5d8a('0x32')]=_0x38eaa5[_0x5d8a('0x32')]||_0x5d8a('0x33');this['dialOriginateCallerIdNumber']=_0x38eaa5[_0x5d8a('0x34')]||_0x5d8a('0x33');this['dialOriginateTimeout']=_0x38eaa5[_0x5d8a('0x35')]||0x1e;this['dialQueueOptions']=_0x38eaa5[_0x5d8a('0x36')]||_0x5d8a('0x37');this[_0x5d8a('0x38')]=_0x38eaa5['dialQueueTimeout']||0x3;this[_0x5d8a('0x39')]=_0x38eaa5[_0x5d8a('0x39')]||undefined;this['dialCongestionMaxRetry']=_0x38eaa5['dialCongestionMaxRetry']||0x3;this[_0x5d8a('0x3a')]=_0x38eaa5[_0x5d8a('0x3a')]||0x96;this[_0x5d8a('0x3b')]=_0x38eaa5['dialBusyMaxRetry']||0x3;this[_0x5d8a('0x3c')]=_0x38eaa5[_0x5d8a('0x3c')]||0x96;this['dialNoAnswerMaxRetry']=_0x38eaa5[_0x5d8a('0x3d')]||0x3;this[_0x5d8a('0x3e')]=_0x38eaa5[_0x5d8a('0x3e')]||0x96;this[_0x5d8a('0x3f')]=_0x38eaa5[_0x5d8a('0x3f')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x38eaa5[_0x5d8a('0x40')]||0x96;this[_0x5d8a('0x41')]=_0x38eaa5[_0x5d8a('0x41')]||0x3;this[_0x5d8a('0x42')]=_0x38eaa5[_0x5d8a('0x42')]||0x96;this[_0x5d8a('0x43')]=_0x38eaa5[_0x5d8a('0x43')]||0x3;this[_0x5d8a('0x44')]=_0x38eaa5['dialAbandonedRetryFrequency']||0x96;this[_0x5d8a('0x45')]=_0x38eaa5[_0x5d8a('0x45')]||0x3;this[_0x5d8a('0x46')]=_0x38eaa5[_0x5d8a('0x46')]||0x96;this[_0x5d8a('0x47')]=_0x38eaa5[_0x5d8a('0x47')]||0x3;this[_0x5d8a('0x48')]=_0x38eaa5[_0x5d8a('0x48')]||0x96;this[_0x5d8a('0x49')]=_0x38eaa5[_0x5d8a('0x49')]||0x3;this[_0x5d8a('0x4a')]=_0x38eaa5[_0x5d8a('0x4a')]||0x4;this['Trunk']=_0x38eaa5[_0x5d8a('0x4b')]?_0x38eaa5[_0x5d8a('0x4b')]:undefined;this[_0x5d8a('0x4c')]=_0x38eaa5['TrunkBackup']?_0x38eaa5[_0x5d8a('0x4c')]:undefined;this['dialPrefix']=_0x38eaa5[_0x5d8a('0x4d')]||undefined;this['Interval']=_0x38eaa5['Interval']?_0x38eaa5[_0x5d8a('0x4e')]:undefined;this['dialOrderByScheduledAt']=_0x38eaa5['dialOrderByScheduledAt']||_0x5d8a('0x4f');this[_0x5d8a('0x50')]=_0x38eaa5[_0x5d8a('0x50')]||undefined;this[_0x5d8a('0x51')]=_0x38eaa5[_0x5d8a('0x51')]||undefined;this[_0x5d8a('0x52')]=strategy[_0x38eaa5[_0x5d8a('0x52')]];this[_0x5d8a('0x53')]=!![];this[_0x5d8a('0x54')]=_0x38eaa5['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x38eaa5['dialAMDInitialSilence'];this[_0x5d8a('0x55')]=_0x38eaa5[_0x5d8a('0x55')];this[_0x5d8a('0x56')]=_0x38eaa5[_0x5d8a('0x56')];this['dialAMDTotalAnalysisTime']=_0x38eaa5['dialAMDTotalAnalysisTime'];this[_0x5d8a('0x57')]=_0x38eaa5[_0x5d8a('0x57')];this[_0x5d8a('0x58')]=_0x38eaa5[_0x5d8a('0x58')];this[_0x5d8a('0x59')]=_0x38eaa5[_0x5d8a('0x59')];this[_0x5d8a('0x5a')]=_0x38eaa5['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x38eaa5['dialAMDMaximumWordLength'];this[_0x5d8a('0x5b')]=0x0;this[_0x5d8a('0x5c')]=0x0;this[_0x5d8a('0x5d')]=_0x38eaa5[_0x5d8a('0x5d')];this[_0x5d8a('0x5e')]=0x0;this[_0x5d8a('0x5f')]=0x0;this[_0x5d8a('0x60')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x5d8a('0x61')]=0x0;this[_0x5d8a('0x62')]=0x0;this[_0x5d8a('0x63')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x5d8a('0x64')]=0x0;this[_0x5d8a('0x65')]=0x0;this[_0x5d8a('0x66')]=0x0;this[_0x5d8a('0x67')]=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this[_0x5d8a('0x68')]=undefined;this[_0x5d8a('0x69')]=undefined;this[_0x5d8a('0x6a')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x5d8a('0x6b')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x5d8a('0x6c')]=0x0;this[_0x5d8a('0x6d')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x5d8a('0x6e')]=0x0;this[_0x5d8a('0x6f')]=0x0;this[_0x5d8a('0x70')]=_0x38eaa5[_0x5d8a('0x71')]||0x14;this[_0x5d8a('0x72')]=_0x38eaa5[_0x5d8a('0x71')]||0xa;this[_0x5d8a('0x73')]=0x0;this[_0x5d8a('0x74')]=0x0;this[_0x5d8a('0x75')]=0x1;this[_0x5d8a('0x76')]=0x0;this[_0x5d8a('0x77')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x5d8a('0x78')]=0x0;this[_0x5d8a('0x79')]=_0x38eaa5[_0x5d8a('0x79')]||0x1e;this[_0x5d8a('0x7a')]=_0x38eaa5[_0x5d8a('0x7a')]||![];this[_0x5d8a('0x7b')]=!!_0x38eaa5['dialPreviewAutoRecallMe']||![];this['dialPreviewRecallmeReminder']=!!_0x38eaa5[_0x5d8a('0x7c')]||![];this[_0x5d8a('0x7d')]=_0x38eaa5[_0x5d8a('0x7d')]||undefined;this[_0x5d8a('0x7e')]=_0x38eaa5[_0x5d8a('0x7e')]||![];this[_0x5d8a('0x7f')]=_0x38eaa5[_0x5d8a('0x7f')]||![];this[_0x5d8a('0xb')]=monitorFormat[_0x38eaa5['monitor_format']]?monitorFormat[_0x38eaa5[_0x5d8a('0xb')]]:undefined;this['mandatoryDisposition']=_0x38eaa5['mandatoryDisposition']||![];this[_0x5d8a('0x80')]=_0x38eaa5['mandatoryDispositionPause']?_0x38eaa5[_0x5d8a('0x80')]:undefined;this[_0x5d8a('0x81')]=![];}module[_0x5d8a('0x82')]=VoiceQueue; \ No newline at end of file +var _0xe68b=['busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','talking','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundAbandonedDay','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav','wav49','gsm','fewestcalls','leastrecent','random','roundrobin','rrmemory','wrandom','name','monitor_format','type','inbound','waiting','answered','sumDuration','sumBillable','unmanaged'];(function(_0x39406d,_0x10f3ef){var _0x3e71a9=function(_0x26d503){while(--_0x26d503){_0x39406d['push'](_0x39406d['shift']());}};_0x3e71a9(++_0x10f3ef);}(_0xe68b,0x6d));var _0xbe68=function(_0x1e4c38,_0x34a995){_0x1e4c38=_0x1e4c38-0x0;var _0x2b6042=_0xe68b[_0x1e4c38];return _0x2b6042;};'use strict';var monitorFormat={'wav':_0xbe68('0x0'),'wav49':_0xbe68('0x1'),'gsm':_0xbe68('0x2')};var strategy={'fewestcalls':_0xbe68('0x3'),'leastrecent':_0xbe68('0x4'),'linear':'linear','random':_0xbe68('0x5'),'ringall':'ringall','rr':_0xbe68('0x6'),'rrmemory':_0xbe68('0x7'),'rrordered':'rrordered','wrandom':_0xbe68('0x8')};function VoiceQueue(_0x2dd133){this['id']=_0x2dd133['id']||0x0;this[_0xbe68('0x9')]=_0x2dd133['name']||'';this[_0xbe68('0xa')]=_0x2dd133[_0xbe68('0xa')]||'';this['type']=_0x2dd133[_0xbe68('0xb')]||_0xbe68('0xc');this[_0xbe68('0xd')]=0x0;this['total']=0x0;this[_0xbe68('0xe')]=0x0;this[_0xbe68('0xf')]=0x0;this['sumHoldTime']=0x0;this[_0xbe68('0x10')]=0x0;this[_0xbe68('0x11')]=0x0;this['abandoned']=0x0;this['available']=0x0;this[_0xbe68('0x12')]=0x0;this[_0xbe68('0x13')]=0x0;this[_0xbe68('0x14')]=0x0;this[_0xbe68('0x15')]=0x0;this[_0xbe68('0x16')]=0x0;this[_0xbe68('0x17')]=0x0;this[_0xbe68('0x18')]=0x0;this[_0xbe68('0x19')]=0x0;this['ringInUse']=0x0;this[_0xbe68('0x1a')]=0x0;this['unavailable']=0x0;this[_0xbe68('0x1b')]=0x0;this[_0xbe68('0x1c')]=_0x2dd133[_0xbe68('0x1c')]||![];this[_0xbe68('0x1d')]=_0x2dd133[_0xbe68('0x1d')]||0xa;this[_0xbe68('0x1e')]=_0x2dd133['autopause']||'no';this[_0xbe68('0x1f')]=!![];this['message']='';this[_0xbe68('0x20')]='';this[_0xbe68('0x21')]=0x0;this[_0xbe68('0x22')]=0x0;this[_0xbe68('0x23')]=_0x2dd133[_0xbe68('0x23')]||null;this[_0xbe68('0x24')]=_0x2dd133[_0xbe68('0x24')]?_0x2dd133[_0xbe68('0x24')]:null;this['dialActive']=_0x2dd133[_0xbe68('0x25')];this[_0xbe68('0x26')]=_0x2dd133[_0xbe68('0x26')]||_0xbe68('0x27');this['dialLimitChannel']=_0x2dd133[_0xbe68('0x28')]||0x0;this['dialLimitQueue']=_0x2dd133[_0xbe68('0x29')]||0x0;this[_0xbe68('0x2a')]=_0x2dd133['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x2dd133[_0xbe68('0x2b')]||'dropRate';this[_0xbe68('0x2c')]=_0x2dd133['dialPredictiveOptimizationPercentage']||0.03;this[_0xbe68('0x2d')]=_0x2dd133['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x2dd133[_0xbe68('0x2e')]||_0xbe68('0x2f');this[_0xbe68('0x30')]=_0x2dd133[_0xbe68('0x30')]||'anonymous';this[_0xbe68('0x31')]=_0x2dd133['dialOriginateTimeout']||0x1e;this[_0xbe68('0x32')]=_0x2dd133[_0xbe68('0x32')]||_0xbe68('0x33');this[_0xbe68('0x34')]=_0x2dd133[_0xbe68('0x34')]||0x3;this[_0xbe68('0x35')]=_0x2dd133['dialQueueProject']||undefined;this[_0xbe68('0x36')]=_0x2dd133[_0xbe68('0x36')]||0x3;this[_0xbe68('0x37')]=_0x2dd133[_0xbe68('0x37')]||0x96;this['dialBusyMaxRetry']=_0x2dd133['dialBusyMaxRetry']||0x3;this[_0xbe68('0x38')]=_0x2dd133[_0xbe68('0x38')]||0x96;this['dialNoAnswerMaxRetry']=_0x2dd133['dialNoAnswerMaxRetry']||0x3;this[_0xbe68('0x39')]=_0x2dd133['dialNoAnswerRetryFrequency']||0x96;this[_0xbe68('0x3a')]=_0x2dd133[_0xbe68('0x3a')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x2dd133[_0xbe68('0x3b')]||0x96;this[_0xbe68('0x3c')]=_0x2dd133[_0xbe68('0x3c')]||0x3;this[_0xbe68('0x3d')]=_0x2dd133[_0xbe68('0x3d')]||0x96;this[_0xbe68('0x3e')]=_0x2dd133[_0xbe68('0x3e')]||0x3;this[_0xbe68('0x3f')]=_0x2dd133[_0xbe68('0x3f')]||0x96;this[_0xbe68('0x40')]=_0x2dd133['dialMachineMaxRetry']||0x3;this[_0xbe68('0x41')]=_0x2dd133['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x2dd133[_0xbe68('0x42')]||0x3;this[_0xbe68('0x43')]=_0x2dd133[_0xbe68('0x43')]||0x96;this['callAdditionalPhoneAfterMin']=_0x2dd133[_0xbe68('0x44')]||0x3;this['dialGlobalMaxRetry']=_0x2dd133[_0xbe68('0x45')]||0x4;this[_0xbe68('0x46')]=_0x2dd133[_0xbe68('0x46')]?_0x2dd133['Trunk']:undefined;this[_0xbe68('0x47')]=_0x2dd133[_0xbe68('0x47')]?_0x2dd133[_0xbe68('0x47')]:undefined;this[_0xbe68('0x48')]=_0x2dd133[_0xbe68('0x48')]||undefined;this[_0xbe68('0x49')]=_0x2dd133[_0xbe68('0x49')]?_0x2dd133[_0xbe68('0x49')]:undefined;this[_0xbe68('0x4a')]=_0x2dd133['dialOrderByScheduledAt']||'DESC';this[_0xbe68('0x4b')]=_0x2dd133['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xbe68('0x4c')]=_0x2dd133[_0xbe68('0x4c')]||undefined;this['strategy']=strategy[_0x2dd133[_0xbe68('0x4d')]];this['queueStatusComplete']=!![];this[_0xbe68('0x4e')]=_0x2dd133['dialAMDActive']||![];this[_0xbe68('0x4f')]=_0x2dd133[_0xbe68('0x4f')];this['dialAMDGreeting']=_0x2dd133[_0xbe68('0x50')];this[_0xbe68('0x51')]=_0x2dd133['dialAMDAfterGreetingSilence'];this[_0xbe68('0x52')]=_0x2dd133[_0xbe68('0x52')];this[_0xbe68('0x53')]=_0x2dd133['dialAMDMinWordLength'];this[_0xbe68('0x54')]=_0x2dd133[_0xbe68('0x54')];this[_0xbe68('0x55')]=_0x2dd133[_0xbe68('0x55')];this['dialAMDSilenceThreshold']=_0x2dd133[_0xbe68('0x56')];this[_0xbe68('0x57')]=_0x2dd133[_0xbe68('0x57')];this[_0xbe68('0x58')]=0x0;this[_0xbe68('0x59')]=0x0;this[_0xbe68('0x5a')]=_0x2dd133[_0xbe68('0x5a')];this['outboundAnswerCallsDay']=0x0;this[_0xbe68('0x5b')]=0x0;this[_0xbe68('0x5c')]=0x0;this[_0xbe68('0x5d')]=0x0;this[_0xbe68('0x5e')]=0x0;this[_0xbe68('0x5f')]=0x0;this[_0xbe68('0x60')]=0x0;this[_0xbe68('0x61')]=0x0;this[_0xbe68('0x62')]=0x0;this[_0xbe68('0x63')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xbe68('0x64')]=0x0;this['outboundReCallsDay']=0x0;this[_0xbe68('0x65')]=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0xbe68('0x66')]=undefined;this[_0xbe68('0x67')]=1.05;this[_0xbe68('0x68')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xbe68('0x69')]=0x0;this[_0xbe68('0x6a')]=0x0;this[_0xbe68('0x6b')]=0x0;this[_0xbe68('0x6c')]=0x0;this[_0xbe68('0x6d')]=0x0;this[_0xbe68('0x6e')]=0x0;this['predictiveIntervalMaxThreshold']=_0x2dd133[_0xbe68('0x6f')]||0x14;this[_0xbe68('0x70')]=_0x2dd133[_0xbe68('0x6f')]||0xa;this[_0xbe68('0x71')]=0x0;this[_0xbe68('0x72')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0xbe68('0x73')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xbe68('0x74')]=0x0;this[_0xbe68('0x75')]=_0x2dd133[_0xbe68('0x75')]||0x1e;this[_0xbe68('0x76')]=_0x2dd133['dialRecallInQueue']||![];this[_0xbe68('0x77')]=!!_0x2dd133['dialPreviewAutoRecallMe']||![];this['dialPreviewRecallmeReminder']=!!_0x2dd133[_0xbe68('0x78')]||![];this[_0xbe68('0x79')]=_0x2dd133[_0xbe68('0x79')]||undefined;this[_0xbe68('0x7a')]=_0x2dd133['dialAgiAfterHangupClient']||![];this[_0xbe68('0x7b')]=_0x2dd133[_0xbe68('0x7b')]||![];this['monitor_format']=monitorFormat[_0x2dd133[_0xbe68('0xa')]]?monitorFormat[_0x2dd133[_0xbe68('0xa')]]:undefined;this[_0xbe68('0x7c')]=_0x2dd133[_0xbe68('0x7c')]||![];this[_0xbe68('0x7d')]=_0x2dd133[_0xbe68('0x7d')]?_0x2dd133[_0xbe68('0x7d')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0xbe68('0x7e')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 7ea404c..f465067 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 _0x7fd6=['waiting','inUse','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','answered','busy','invalid','loggedIn','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','callers','length','SIP/','includes','booked','keys','queue','compareToInboundQueue','some','compareToOutboundQueue','active','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','available','loggedInDb','paused','ringing','talking'];(function(_0x1d5bc9,_0x3d0d20){var _0x11ac0c=function(_0x52057c){while(--_0x52057c){_0x1d5bc9['push'](_0x1d5bc9['shift']());}};_0x11ac0c(++_0x3d0d20);}(_0x7fd6,0x157));var _0x67fd=function(_0x5f47c6,_0x33bdad){_0x5f47c6=_0x5f47c6-0x0;var _0x4cc495=_0x7fd6[_0x5f47c6];return _0x4cc495;};'use strict';var INBOUND_COUNTERS=[_0x67fd('0x0'),'loggedIn',_0x67fd('0x1'),_0x67fd('0x2'),_0x67fd('0x3'),_0x67fd('0x4'),_0x67fd('0x5')];var OUTBOUND_COUNTERS=[_0x67fd('0x0'),'answered',_0x67fd('0x6'),'loggedIn','loggedInDb','originated','outboundAbandonedCallsDay',_0x67fd('0x7'),_0x67fd('0x8'),_0x67fd('0x9'),_0x67fd('0xa'),_0x67fd('0xb'),_0x67fd('0xc'),_0x67fd('0xd'),_0x67fd('0xe'),'outboundUnknownCallsDay',_0x67fd('0x2'),_0x67fd('0xf'),_0x67fd('0x4'),_0x67fd('0x10'),_0x67fd('0x11'),_0x67fd('0x12'),'waiting'];function VoiceQueueSummary(_0x41c0c0){this['id']=_0x41c0c0['id'];this[_0x67fd('0x13')]=_0x41c0c0[_0x67fd('0x13')];this[_0x67fd('0x14')]=_0x41c0c0[_0x67fd('0x14')];this[_0x67fd('0x15')]=_0x41c0c0[_0x67fd('0x15')]||0x0;this[_0x67fd('0x16')]=_0x41c0c0[_0x67fd('0x16')]||0x0;this[_0x67fd('0x0')]=_0x41c0c0[_0x67fd('0x0')]||0x0;this['busy']=_0x41c0c0[_0x67fd('0x17')]||0x0;this[_0x67fd('0x6')]=_0x41c0c0[_0x67fd('0x6')]||0x0;this[_0x67fd('0x18')]=_0x41c0c0['invalid']||0x0;this[_0x67fd('0x19')]=_0x41c0c0[_0x67fd('0x19')]||0x0;this['loggedInDb']=_0x41c0c0[_0x67fd('0x1')]||0x0;this[_0x67fd('0x1a')]=_0x41c0c0[_0x67fd('0x1a')]||0x0;this[_0x67fd('0x1b')]=_0x41c0c0[_0x67fd('0x1b')]||0x0;this[_0x67fd('0x2')]=_0x41c0c0[_0x67fd('0x2')]||0x0;this[_0x67fd('0x3')]=_0x41c0c0['ringing']||0x0;this[_0x67fd('0x1c')]=_0x41c0c0['ringInUse'];this[_0x67fd('0x10')]=_0x41c0c0['sumBillable'];this[_0x67fd('0x11')]=_0x41c0c0[_0x67fd('0x11')];this[_0x67fd('0x1d')]=_0x41c0c0['sumHoldTime']||0x0;this[_0x67fd('0x4')]=_0x41c0c0[_0x67fd('0x4')]||0x0;this['total']=_0x41c0c0[_0x67fd('0x12')]||0x0;this[_0x67fd('0x1e')]=_0x41c0c0[_0x67fd('0x1e')];this[_0x67fd('0x1f')]=_0x41c0c0[_0x67fd('0x1f')]||0x0;this[_0x67fd('0x20')]=_0x41c0c0[_0x67fd('0x20')]||0x0;this[_0x67fd('0x21')]=_0x41c0c0[_0x67fd('0x21')]||0x0;this[_0x67fd('0x5')]=_0x41c0c0['waiting']||0x0;if(_0x41c0c0[_0x67fd('0x1e')]===_0x67fd('0x22')){this['pTalking']=_0x41c0c0['pTalking']||0x0;this[_0x67fd('0x23')]=_0x41c0c0[_0x67fd('0x23')];this[_0x67fd('0x24')]=_0x41c0c0[_0x67fd('0x24')];this[_0x67fd('0x25')]=_0x41c0c0[_0x67fd('0x25')];this['dialOriginateCallerIdNumber']=_0x41c0c0[_0x67fd('0x26')];this[_0x67fd('0x27')]=_0x41c0c0[_0x67fd('0x27')];this['dialPrefix']=_0x41c0c0['dialPrefix'];this[_0x67fd('0x28')]=_0x41c0c0[_0x67fd('0x28')];this[_0x67fd('0x29')]=_0x41c0c0[_0x67fd('0x29')];this[_0x67fd('0x7')]=_0x41c0c0[_0x67fd('0x7')];this['outboundBlacklistCallsDay']=_0x41c0c0[_0x67fd('0x8')];this['outboundBusyCallsDay']=_0x41c0c0[_0x67fd('0x9')];this[_0x67fd('0xa')]=_0x41c0c0[_0x67fd('0xa')];this[_0x67fd('0x2a')]=_0x41c0c0['outboundDropCallsDayACS'];this['outboundDropCallsDayCallersExit']=_0x41c0c0[_0x67fd('0x2b')];this['outboundDropCallsDayTimeout']=_0x41c0c0[_0x67fd('0x2c')];this['outboundNoAnswerCallsDay']=_0x41c0c0['outboundNoAnswerCallsDay'];this[_0x67fd('0xc')]=_0x41c0c0[_0x67fd('0xc')];this[_0x67fd('0x2d')]=_0x41c0c0[_0x67fd('0x2d')];this[_0x67fd('0xd')]=_0x41c0c0[_0x67fd('0xd')];this[_0x67fd('0xe')]=_0x41c0c0['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x41c0c0[_0x67fd('0x2e')];this[_0x67fd('0x2f')]=_0x41c0c0['predictiveIntervalAnsweredCalls'];this['predictiveIntervalAvgHoldtime']=_0x41c0c0[_0x67fd('0x30')];this[_0x67fd('0x31')]=_0x41c0c0[_0x67fd('0x31')];this[_0x67fd('0x32')]=_0x41c0c0[_0x67fd('0x32')];this[_0x67fd('0x33')]=_0x41c0c0[_0x67fd('0x33')];this[_0x67fd('0x34')]=_0x41c0c0[_0x67fd('0x34')];this[_0x67fd('0x35')]=_0x41c0c0[_0x67fd('0x35')];this['predictiveIntervalHitRate']=_0x41c0c0[_0x67fd('0x36')];this[_0x67fd('0x37')]=_0x41c0c0['predictiveIntervalMultiplicativeFactor'];this['predictiveIntervalPauses']=_0x41c0c0[_0x67fd('0x38')];this['predictiveIntervalAvailable']=_0x41c0c0[_0x67fd('0x39')];this[_0x67fd('0x3a')]=_0x41c0c0['predictiveIntervalTotalCalls'];this[_0x67fd('0x3b')]=_0x41c0c0[_0x67fd('0x3b')];this[_0x67fd('0x3c')]=_0x41c0c0[_0x67fd('0x3c')];this[_0x67fd('0x3d')]=_0x41c0c0[_0x67fd('0x3d')];this[_0x67fd('0x3e')]=_0x41c0c0[_0x67fd('0x3e')];this[_0x67fd('0x3f')]=_0x41c0c0[_0x67fd('0x3f')];this['startPredictive']=_0x41c0c0[_0x67fd('0x40')];this[_0x67fd('0x41')]=_0x41c0c0[_0x67fd('0x41')];this[_0x67fd('0x42')]=_0x41c0c0[_0x67fd('0x42')];this[_0x67fd('0x43')]=_0x41c0c0['statusMessage'];}if(_0x41c0c0['Trunk']){this[_0x67fd('0x44')]={'id':_0x41c0c0[_0x67fd('0x44')]['id'],'name':_0x41c0c0[_0x67fd('0x44')][_0x67fd('0x13')],'active':_0x41c0c0[_0x67fd('0x44')]['active'],'callerid':_0x41c0c0[_0x67fd('0x44')][_0x67fd('0x45')]};}}VoiceQueueSummary[_0x67fd('0x46')][_0x67fd('0x47')]=function(_0x5a2e53,_0x5d8c01,_0x51f543,_0x17dd79){this[_0x67fd('0x1')]=0x0;this['talking']=0x0;this[_0x67fd('0x2')]=0x0;this[_0x67fd('0x20')]=0x0;this[_0x67fd('0x1b')]=0x0;this[_0x67fd('0x6')]=0x0;this[_0x67fd('0x17')]=0x0;this[_0x67fd('0x18')]=0x0;this[_0x67fd('0x1f')]=0x0;this[_0x67fd('0x3')]=0x0;this[_0x67fd('0x1c')]=0x0;this[_0x67fd('0x1a')]=0x0;if(_0x51f543){if(_0x51f543['available']){this[_0x67fd('0x0')]=Number(_0x51f543[_0x67fd('0x0')]);}if(_0x51f543['loggedin']){this[_0x67fd('0x19')]=Number(_0x51f543[_0x67fd('0x48')]);}if(_0x51f543[_0x67fd('0x49')]){this['waiting']=Number(_0x51f543[_0x67fd('0x49')]);}}for(var _0x428a60=0x0;_0x428a60<_0x5a2e53[_0x67fd('0x4a')];_0x428a60++){var _0x177567=_0x5d8c01[_0x67fd('0x4b')+_0x5a2e53[_0x428a60][_0x67fd('0x13')]];if(_0x177567&&_0x177567['online']){this[_0x67fd('0x1')]+=0x1;}if(_0x5a2e53[_0x428a60]['incall']==='1'){this[_0x67fd('0x4')]+=0x1;}if(_0x5a2e53[_0x428a60][_0x67fd('0x2')]==='1'&&!['2','7','8'][_0x67fd('0x4c')](_0x5a2e53[_0x428a60]['status'])){this[_0x67fd('0x2')]+=0x1;}switch(_0x5a2e53[_0x428a60]['status']){case'0':this[_0x67fd('0x20')]+=0x1;break;case'1':this[_0x67fd('0x1b')]+=0x1;break;case'2':this[_0x67fd('0x6')]+=0x1;break;case'3':this[_0x67fd('0x17')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x67fd('0x1f')]+=0x1;break;case'6':this[_0x67fd('0x3')]+=0x1;break;case'7':this[_0x67fd('0x1c')]+=0x1;break;case'8':this[_0x67fd('0x1a')]+=0x1;break;}}if(this[_0x67fd('0x24')]===_0x67fd('0x4d')){var _0x2e435d=Object[_0x67fd('0x4e')](_0x17dd79);for(var _0x2062a0=0x0;_0x2062a0<_0x2e435d[_0x67fd('0x4a')];_0x2062a0++){var _0x247dba=_0x2e435d[_0x2062a0];var _0x1af93a=_0x17dd79[_0x247dba];if(_0x1af93a[_0x67fd('0x4f')]===this[_0x67fd('0x13')]&&_0x1af93a[_0x67fd('0x1e')]==='dialer'&&_0x1af93a['exten']==='xcally-motion-preview'){this[_0x67fd('0x4')]+=0x1;}}if(this[_0x67fd('0x4')]>this[_0x67fd('0x6')]){this[_0x67fd('0x4')]=this['inUse'];}this['pTalking']=0x0;}return this;};VoiceQueueSummary['prototype'][_0x67fd('0x50')]=function(_0x26d399){var _0x11fa0c=![];if(_0x26d399){_0x11fa0c=INBOUND_COUNTERS[_0x67fd('0x51')](function(_0x5361bc){return this[_0x5361bc]!==_0x26d399[_0x5361bc];},this);}return _0x11fa0c;};VoiceQueueSummary[_0x67fd('0x46')][_0x67fd('0x52')]=function(_0x2b2b15){var _0x4b7598=![];var _0x1fb0a6=![];var _0x5919a9=![];if(_0x2b2b15){_0x4b7598=this[_0x67fd('0x24')]!==_0x2b2b15['dialMethod']||this['dialActive']!==_0x2b2b15['dialActive']||this['message']!==_0x2b2b15['message']||this['statusMessage']!==_0x2b2b15['statusMessage'];_0x1fb0a6=OUTBOUND_COUNTERS[_0x67fd('0x51')](function(_0x3dd218){return this[_0x3dd218]!==_0x2b2b15[_0x3dd218];},this);if(this[_0x67fd('0x44')]&&_0x2b2b15['Trunk']){_0x5919a9=this[_0x67fd('0x44')]['name']!==_0x2b2b15[_0x67fd('0x44')]['name']||this[_0x67fd('0x44')][_0x67fd('0x53')]!==_0x2b2b15[_0x67fd('0x44')][_0x67fd('0x53')];}}return _0x4b7598||_0x1fb0a6||_0x5919a9;};VoiceQueueSummary['prototype'][_0x67fd('0x54')]=function(_0x1c16be){this[_0x67fd('0x16')]=_0x1c16be[_0x67fd('0x16')];this[_0x67fd('0x42')]=_0x1c16be[_0x67fd('0x42')];this[_0x67fd('0x43')]=_0x1c16be[_0x67fd('0x43')];this['originated']=_0x1c16be[_0x67fd('0x3b')];this['outboundAbandonedCallsDay']=_0x1c16be[_0x67fd('0x55')];this[_0x67fd('0x7')]=_0x1c16be[_0x67fd('0x7')];this[_0x67fd('0x8')]=_0x1c16be[_0x67fd('0x8')];this[_0x67fd('0x9')]=_0x1c16be['outboundBusyCallsDay'];this[_0x67fd('0xa')]=_0x1c16be['outboundCongestionCallsDay'];this['outboundNoAnswerCallsDay']=_0x1c16be[_0x67fd('0xb')];this[_0x67fd('0xc')]=_0x1c16be['outboundNoSuchCallsDay'];this['outboundReCallsDay']=_0x1c16be[_0x67fd('0xd')];this[_0x67fd('0xe')]=_0x1c16be['outboundRejectCallsDay'];this[_0x67fd('0x2e')]=_0x1c16be[_0x67fd('0x2e')];this[_0x67fd('0x10')]=_0x1c16be['sumBillable'];this[_0x67fd('0x11')]=_0x1c16be[_0x67fd('0x11')];this[_0x67fd('0x12')]=_0x1c16be['total'];if(this[_0x67fd('0x24')]===_0x67fd('0x56')){this['pTalking']=_0x1c16be[_0x67fd('0xf')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0xaab2=['predictiveIntervalAvailable','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','incall','includes','status','keys','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','active','preview','exports','loggedIn','loggedInDb','paused','talking','waiting','available','answered','inUse','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumBillable','sumDuration','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringing','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses'];(function(_0xbe48ec,_0x4a4067){var _0x34e2c3=function(_0x4d6bcf){while(--_0x4d6bcf){_0xbe48ec['push'](_0xbe48ec['shift']());}};_0x34e2c3(++_0x4a4067);}(_0xaab2,0xca));var _0x2aab=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xaab2[_0x37bd26];return _0xe83dc4;};'use strict';var INBOUND_COUNTERS=['available',_0x2aab('0x0'),_0x2aab('0x1'),_0x2aab('0x2'),'ringing',_0x2aab('0x3'),_0x2aab('0x4')];var OUTBOUND_COUNTERS=[_0x2aab('0x5'),_0x2aab('0x6'),_0x2aab('0x7'),'loggedIn',_0x2aab('0x1'),'originated',_0x2aab('0x8'),_0x2aab('0x9'),_0x2aab('0xa'),_0x2aab('0xb'),'outboundCongestionCallsDay',_0x2aab('0xc'),_0x2aab('0xd'),_0x2aab('0xe'),_0x2aab('0xf'),_0x2aab('0x10'),_0x2aab('0x2'),'pTalking','talking',_0x2aab('0x11'),_0x2aab('0x12'),'total',_0x2aab('0x4')];function VoiceQueueSummary(_0x14dde1){this['id']=_0x14dde1['id'];this[_0x2aab('0x13')]=_0x14dde1['name'];this[_0x2aab('0x14')]=_0x14dde1[_0x2aab('0x14')];this[_0x2aab('0x15')]=_0x14dde1[_0x2aab('0x15')]||0x0;this[_0x2aab('0x6')]=_0x14dde1[_0x2aab('0x6')]||0x0;this['available']=_0x14dde1['available']||0x0;this[_0x2aab('0x16')]=_0x14dde1['busy']||0x0;this['inUse']=_0x14dde1[_0x2aab('0x7')]||0x0;this[_0x2aab('0x17')]=_0x14dde1[_0x2aab('0x17')]||0x0;this[_0x2aab('0x0')]=_0x14dde1[_0x2aab('0x0')]||0x0;this[_0x2aab('0x1')]=_0x14dde1[_0x2aab('0x1')]||0x0;this[_0x2aab('0x18')]=_0x14dde1['onHold']||0x0;this[_0x2aab('0x19')]=_0x14dde1[_0x2aab('0x19')]||0x0;this[_0x2aab('0x2')]=_0x14dde1[_0x2aab('0x2')]||0x0;this[_0x2aab('0x1a')]=_0x14dde1[_0x2aab('0x1a')]||0x0;this[_0x2aab('0x1b')]=_0x14dde1[_0x2aab('0x1b')];this[_0x2aab('0x11')]=_0x14dde1[_0x2aab('0x11')];this[_0x2aab('0x12')]=_0x14dde1[_0x2aab('0x12')];this[_0x2aab('0x1c')]=_0x14dde1[_0x2aab('0x1c')]||0x0;this[_0x2aab('0x3')]=_0x14dde1[_0x2aab('0x3')]||0x0;this[_0x2aab('0x1d')]=_0x14dde1[_0x2aab('0x1d')]||0x0;this[_0x2aab('0x1e')]=_0x14dde1[_0x2aab('0x1e')];this['unavailable']=_0x14dde1[_0x2aab('0x1f')]||0x0;this[_0x2aab('0x20')]=_0x14dde1[_0x2aab('0x20')]||0x0;this['unmanaged']=_0x14dde1[_0x2aab('0x21')]||0x0;this[_0x2aab('0x4')]=_0x14dde1[_0x2aab('0x4')]||0x0;if(_0x14dde1[_0x2aab('0x1e')]===_0x2aab('0x22')){this['pTalking']=_0x14dde1[_0x2aab('0x23')]||0x0;this[_0x2aab('0x24')]=_0x14dde1[_0x2aab('0x24')];this[_0x2aab('0x25')]=_0x14dde1['dialMethod'];this[_0x2aab('0x26')]=_0x14dde1[_0x2aab('0x26')];this['dialOriginateCallerIdNumber']=_0x14dde1[_0x2aab('0x27')];this[_0x2aab('0x28')]=_0x14dde1[_0x2aab('0x28')];this[_0x2aab('0x29')]=_0x14dde1['dialPrefix'];this['temp']=_0x14dde1[_0x2aab('0x2a')];this[_0x2aab('0x2b')]=_0x14dde1[_0x2aab('0x2b')];this[_0x2aab('0x9')]=_0x14dde1[_0x2aab('0x9')];this[_0x2aab('0xa')]=_0x14dde1[_0x2aab('0xa')];this[_0x2aab('0xb')]=_0x14dde1[_0x2aab('0xb')];this[_0x2aab('0x2c')]=_0x14dde1[_0x2aab('0x2c')];this['outboundDropCallsDayACS']=_0x14dde1[_0x2aab('0x2d')];this[_0x2aab('0x2e')]=_0x14dde1[_0x2aab('0x2e')];this[_0x2aab('0x2f')]=_0x14dde1['outboundDropCallsDayTimeout'];this[_0x2aab('0xc')]=_0x14dde1[_0x2aab('0xc')];this[_0x2aab('0xd')]=_0x14dde1[_0x2aab('0xd')];this[_0x2aab('0x30')]=_0x14dde1['outboundOriginateFailureCallsDay'];this[_0x2aab('0xe')]=_0x14dde1['outboundReCallsDay'];this[_0x2aab('0xf')]=_0x14dde1[_0x2aab('0xf')];this[_0x2aab('0x10')]=_0x14dde1[_0x2aab('0x10')];this['predictiveIntervalAnsweredCalls']=_0x14dde1[_0x2aab('0x31')];this['predictiveIntervalAvgHoldtime']=_0x14dde1[_0x2aab('0x32')];this[_0x2aab('0x33')]=_0x14dde1[_0x2aab('0x33')];this[_0x2aab('0x34')]=_0x14dde1[_0x2aab('0x34')];this[_0x2aab('0x35')]=_0x14dde1[_0x2aab('0x35')];this[_0x2aab('0x36')]=_0x14dde1[_0x2aab('0x36')];this[_0x2aab('0x37')]=_0x14dde1[_0x2aab('0x37')];this['predictiveIntervalHitRate']=_0x14dde1[_0x2aab('0x38')];this[_0x2aab('0x39')]=_0x14dde1['predictiveIntervalMultiplicativeFactor'];this['predictiveIntervalPauses']=_0x14dde1[_0x2aab('0x3a')];this[_0x2aab('0x3b')]=_0x14dde1[_0x2aab('0x3b')];this['predictiveIntervalTotalCalls']=_0x14dde1['predictiveIntervalTotalCalls'];this[_0x2aab('0x3c')]=_0x14dde1[_0x2aab('0x3c')];this[_0x2aab('0x3d')]=_0x14dde1['erlangCalls'];this['erlangCallToSecond']=_0x14dde1['erlangCallToSecond'];this[_0x2aab('0x3e')]=_0x14dde1[_0x2aab('0x3e')];this[_0x2aab('0x3f')]=_0x14dde1[_0x2aab('0x3f')];this[_0x2aab('0x40')]=_0x14dde1[_0x2aab('0x40')];this['startProgressive']=_0x14dde1['startProgressive'];this[_0x2aab('0x41')]=_0x14dde1['message'];this[_0x2aab('0x42')]=_0x14dde1[_0x2aab('0x42')];}if(_0x14dde1[_0x2aab('0x43')]){this['Trunk']={'id':_0x14dde1[_0x2aab('0x43')]['id'],'name':_0x14dde1['Trunk'][_0x2aab('0x13')],'active':_0x14dde1[_0x2aab('0x43')]['active'],'callerid':_0x14dde1['Trunk'][_0x2aab('0x44')]};}}VoiceQueueSummary[_0x2aab('0x45')][_0x2aab('0x46')]=function(_0x55d8f6,_0x2d7689,_0x24b8e3,_0x23cfa6){this[_0x2aab('0x1')]=0x0;this[_0x2aab('0x3')]=0x0;this[_0x2aab('0x2')]=0x0;this['unknown']=0x0;this[_0x2aab('0x19')]=0x0;this['inUse']=0x0;this['busy']=0x0;this[_0x2aab('0x17')]=0x0;this[_0x2aab('0x1f')]=0x0;this['ringing']=0x0;this[_0x2aab('0x1b')]=0x0;this[_0x2aab('0x18')]=0x0;if(_0x24b8e3){if(_0x24b8e3[_0x2aab('0x5')]){this['available']=Number(_0x24b8e3[_0x2aab('0x5')]);}if(_0x24b8e3[_0x2aab('0x47')]){this[_0x2aab('0x0')]=Number(_0x24b8e3[_0x2aab('0x47')]);}if(_0x24b8e3['callers']){this[_0x2aab('0x4')]=Number(_0x24b8e3[_0x2aab('0x48')]);}}for(var _0xc436ba=0x0;_0xc436ba<_0x55d8f6[_0x2aab('0x49')];_0xc436ba++){var _0x12f064=_0x2d7689[_0x2aab('0x4a')+_0x55d8f6[_0xc436ba][_0x2aab('0x13')]];if(_0x12f064&&_0x12f064[_0x2aab('0x4b')]){this[_0x2aab('0x1')]+=0x1;}if(_0x55d8f6[_0xc436ba][_0x2aab('0x4c')]==='1'){this['talking']+=0x1;}if(_0x55d8f6[_0xc436ba][_0x2aab('0x2')]==='1'&&!['2','7','8'][_0x2aab('0x4d')](_0x55d8f6[_0xc436ba][_0x2aab('0x4e')])){this['paused']+=0x1;}switch(_0x55d8f6[_0xc436ba][_0x2aab('0x4e')]){case'0':this[_0x2aab('0x20')]+=0x1;break;case'1':this[_0x2aab('0x19')]+=0x1;break;case'2':this[_0x2aab('0x7')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0x2aab('0x17')]+=0x1;break;case'5':this[_0x2aab('0x1f')]+=0x1;break;case'6':this[_0x2aab('0x1a')]+=0x1;break;case'7':this[_0x2aab('0x1b')]+=0x1;break;case'8':this[_0x2aab('0x18')]+=0x1;break;}}if(this['dialMethod']==='booked'){var _0x4582f8=Object[_0x2aab('0x4f')](_0x23cfa6);for(var _0xaed168=0x0;_0xaed168<_0x4582f8['length'];_0xaed168++){var _0x2beda6=_0x4582f8[_0xaed168];var _0x14ea96=_0x23cfa6[_0x2beda6];if(_0x14ea96['queue']===this[_0x2aab('0x13')]&&_0x14ea96['type']==='dialer'&&_0x14ea96['exten']===_0x2aab('0x50')){this[_0x2aab('0x3')]+=0x1;}}if(this[_0x2aab('0x3')]>this[_0x2aab('0x7')]){this[_0x2aab('0x3')]=this[_0x2aab('0x7')];}this[_0x2aab('0x23')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x2aab('0x51')]=function(_0xefcc66){var _0x41e994=![];if(_0xefcc66){_0x41e994=INBOUND_COUNTERS[_0x2aab('0x52')](function(_0xae7c6b){return this[_0xae7c6b]!==_0xefcc66[_0xae7c6b];},this);}return _0x41e994;};VoiceQueueSummary[_0x2aab('0x45')][_0x2aab('0x53')]=function(_0x1ebfef){var _0x3985ea=![];var _0xb43934=![];var _0x509677=![];if(_0x1ebfef){_0x3985ea=this[_0x2aab('0x25')]!==_0x1ebfef['dialMethod']||this[_0x2aab('0x24')]!==_0x1ebfef['dialActive']||this['message']!==_0x1ebfef[_0x2aab('0x41')]||this['statusMessage']!==_0x1ebfef['statusMessage'];_0xb43934=OUTBOUND_COUNTERS[_0x2aab('0x52')](function(_0x2c3856){return this[_0x2c3856]!==_0x1ebfef[_0x2c3856];},this);if(this[_0x2aab('0x43')]&&_0x1ebfef[_0x2aab('0x43')]){_0x509677=this['Trunk'][_0x2aab('0x13')]!==_0x1ebfef[_0x2aab('0x43')][_0x2aab('0x13')]||this['Trunk']['active']!==_0x1ebfef['Trunk'][_0x2aab('0x54')];}}return _0x3985ea||_0xb43934||_0x509677;};VoiceQueueSummary['prototype']['updateReportFromOutboundQueue']=function(_0x4a2d95){this[_0x2aab('0x6')]=_0x4a2d95[_0x2aab('0x6')];this[_0x2aab('0x41')]=_0x4a2d95[_0x2aab('0x41')];this['statusMessage']=_0x4a2d95[_0x2aab('0x42')];this[_0x2aab('0x3c')]=_0x4a2d95['originated'];this['outboundAbandonedCallsDay']=_0x4a2d95[_0x2aab('0x8')];this['outboundAnswerCallsDay']=_0x4a2d95[_0x2aab('0x9')];this[_0x2aab('0xa')]=_0x4a2d95[_0x2aab('0xa')];this['outboundBusyCallsDay']=_0x4a2d95['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x4a2d95['outboundCongestionCallsDay'];this[_0x2aab('0xc')]=_0x4a2d95['outboundNoAnswerCallsDay'];this[_0x2aab('0xd')]=_0x4a2d95[_0x2aab('0xd')];this[_0x2aab('0xe')]=_0x4a2d95[_0x2aab('0xe')];this[_0x2aab('0xf')]=_0x4a2d95[_0x2aab('0xf')];this[_0x2aab('0x10')]=_0x4a2d95[_0x2aab('0x10')];this[_0x2aab('0x11')]=_0x4a2d95[_0x2aab('0x11')];this[_0x2aab('0x12')]=_0x4a2d95[_0x2aab('0x12')];this[_0x2aab('0x1d')]=_0x4a2d95['total'];if(this[_0x2aab('0x25')]===_0x2aab('0x55')){this[_0x2aab('0x23')]=_0x4a2d95[_0x2aab('0x23')];}};module[_0x2aab('0x56')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 5b0b876..6addc37 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 _0xaba6=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x10b1bb,_0x2a5815){var _0x2d4e05=function(_0xc13643){while(--_0xc13643){_0x10b1bb['push'](_0x10b1bb['shift']());}};_0x2d4e05(++_0x2a5815);}(_0xaba6,0xb5));var _0x6aba=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xaba6[_0x17928f];return _0x500b63;};'use strict';function VtigerAccount(_0x268dc0){this['id']=_0x268dc0['id']||0x0;this[_0x6aba('0x0')]=_0x268dc0['name']||'';this[_0x6aba('0x1')]=_0x268dc0[_0x6aba('0x1')]||'';this[_0x6aba('0x2')]=_0x268dc0[_0x6aba('0x2')]||'';this['remoteUri']=_0x268dc0[_0x6aba('0x3')]||'';this[_0x6aba('0x4')]=_0x268dc0[_0x6aba('0x4')]||'';this[_0x6aba('0x5')]=_0x268dc0[_0x6aba('0x5')]||{};}module[_0x6aba('0x6')]=VtigerAccount; \ No newline at end of file +var _0xd6fd=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x518517,_0x538a65){var _0xb62817=function(_0x3a43ca){while(--_0x3a43ca){_0x518517['push'](_0x518517['shift']());}};_0xb62817(++_0x538a65);}(_0xd6fd,0xfe));var _0xdd6f=function(_0x4ae2fb,_0x1c1c67){_0x4ae2fb=_0x4ae2fb-0x0;var _0x4f5268=_0xd6fd[_0x4ae2fb];return _0x4f5268;};'use strict';function VtigerAccount(_0xf33ad7){this['id']=_0xf33ad7['id']||0x0;this[_0xdd6f('0x0')]=_0xf33ad7[_0xdd6f('0x0')]||'';this[_0xdd6f('0x1')]=_0xf33ad7[_0xdd6f('0x1')]||'';this[_0xdd6f('0x2')]=_0xf33ad7[_0xdd6f('0x2')]||'';this[_0xdd6f('0x3')]=_0xf33ad7['remoteUri']||'';this['serverUrl']=_0xf33ad7[_0xdd6f('0x4')]||'';this[_0xdd6f('0x5')]=_0xf33ad7[_0xdd6f('0x5')]||{};}module[_0xdd6f('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index eba5269..1b249c5 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 _0x3c0b=['serverUrl','Configurations','exports','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x34f0fb,_0x3323b2){var _0x9b7b2b=function(_0x3cca84){while(--_0x3cca84){_0x34f0fb['push'](_0x34f0fb['shift']());}};_0x9b7b2b(++_0x3323b2);}(_0x3c0b,0x71));var _0xb3c0=function(_0x2a0696,_0x494429){_0x2a0696=_0x2a0696-0x0;var _0x4158eb=_0x3c0b[_0x2a0696];return _0x4158eb;};'use strict';function ZendeskAccount(_0x1d19e2){this['id']=_0x1d19e2['id']||0x0;this['name']=_0x1d19e2['name']||'';this[_0xb3c0('0x0')]=_0x1d19e2['username']||'';this['password']=_0x1d19e2[_0xb3c0('0x1')]||'';this[_0xb3c0('0x2')]=_0x1d19e2[_0xb3c0('0x2')]||'';this[_0xb3c0('0x3')]=_0x1d19e2[_0xb3c0('0x3')]||'';this[_0xb3c0('0x4')]=_0x1d19e2[_0xb3c0('0x4')]||'';this[_0xb3c0('0x5')]=_0x1d19e2[_0xb3c0('0x5')]||_0xb3c0('0x6');this[_0xb3c0('0x7')]=_0x1d19e2[_0xb3c0('0x7')]||'';this[_0xb3c0('0x8')]=_0x1d19e2['Configurations']||{};}module[_0xb3c0('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x7b76=['exports','name','username','password','token','remoteUri','authType','integrationTab','serverUrl','Configurations'];(function(_0x1ee6f1,_0x1cfcf5){var _0x36e309=function(_0x165250){while(--_0x165250){_0x1ee6f1['push'](_0x1ee6f1['shift']());}};_0x36e309(++_0x1cfcf5);}(_0x7b76,0x15f));var _0x67b7=function(_0xb8c129,_0x407f00){_0xb8c129=_0xb8c129-0x0;var _0x4dcf49=_0x7b76[_0xb8c129];return _0x4dcf49;};'use strict';function ZendeskAccount(_0x2688c7){this['id']=_0x2688c7['id']||0x0;this[_0x67b7('0x0')]=_0x2688c7[_0x67b7('0x0')]||'';this[_0x67b7('0x1')]=_0x2688c7[_0x67b7('0x1')]||'';this['password']=_0x2688c7[_0x67b7('0x2')]||'';this[_0x67b7('0x3')]=_0x2688c7['token']||'';this[_0x67b7('0x4')]=_0x2688c7[_0x67b7('0x4')]||'';this[_0x67b7('0x5')]=_0x2688c7[_0x67b7('0x5')]||'';this['type']=_0x2688c7['type']||_0x67b7('0x6');this[_0x67b7('0x7')]=_0x2688c7['serverUrl']||'';this[_0x67b7('0x8')]=_0x2688c7[_0x67b7('0x8')]||{};}module[_0x67b7('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index f8e8ea6..315c423 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 _0x937b=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description'];(function(_0x4b528e,_0x2f5ec){var _0x566d9a=function(_0x2a4584){while(--_0x2a4584){_0x4b528e['push'](_0x4b528e['shift']());}};_0x566d9a(++_0x2f5ec);}(_0x937b,0x148));var _0xb937=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x937b[_0x3dd15e];return _0x231fd0;};'use strict';function ZohoAccount(_0x2df33c){this['id']=_0x2df33c['id']||0x0;this['name']=_0x2df33c[_0xb937('0x0')]||'';this[_0xb937('0x1')]=_0x2df33c[_0xb937('0x1')]||'';this['host']=_0x2df33c[_0xb937('0x2')]||'';this[_0xb937('0x3')]=_0x2df33c['zone']||'';this[_0xb937('0x4')]=_0x2df33c[_0xb937('0x4')]||'';this[_0xb937('0x5')]=_0x2df33c[_0xb937('0x5')]||'';this[_0xb937('0x6')]=_0x2df33c[_0xb937('0x6')]||'';this[_0xb937('0x7')]=_0x2df33c['code']||'';this[_0xb937('0x8')]=_0x2df33c[_0xb937('0x8')]||'';this['Configurations']=_0x2df33c[_0xb937('0x9')]||{};}module[_0xb937('0xa')]=ZohoAccount; \ No newline at end of file +var _0x3d2d=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','exports'];(function(_0x1671c7,_0x36f775){var _0x160b76=function(_0x547da6){while(--_0x547da6){_0x1671c7['push'](_0x1671c7['shift']());}};_0x160b76(++_0x36f775);}(_0x3d2d,0x1cc));var _0xd3d2=function(_0x3b7b8a,_0x52c3b0){_0x3b7b8a=_0x3b7b8a-0x0;var _0x441206=_0x3d2d[_0x3b7b8a];return _0x441206;};'use strict';function ZohoAccount(_0x3f9607){this['id']=_0x3f9607['id']||0x0;this[_0xd3d2('0x0')]=_0x3f9607['name']||'';this[_0xd3d2('0x1')]=_0x3f9607[_0xd3d2('0x1')]||'';this[_0xd3d2('0x2')]=_0x3f9607[_0xd3d2('0x2')]||'';this[_0xd3d2('0x3')]=_0x3f9607[_0xd3d2('0x3')]||'';this[_0xd3d2('0x4')]=_0x3f9607[_0xd3d2('0x4')]||'';this[_0xd3d2('0x5')]=_0x3f9607[_0xd3d2('0x5')]||'';this[_0xd3d2('0x6')]=_0x3f9607[_0xd3d2('0x6')]||'';this[_0xd3d2('0x7')]=_0x3f9607['code']||'';this[_0xd3d2('0x8')]=_0x3f9607[_0xd3d2('0x8')]||'';this['Configurations']=_0x3f9607['Configurations']||{};}module[_0xd3d2('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 18ef13c..e99bc47 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 _0x7d25=['ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','exports','lodash','moment','isNil','uniqueid','name','type','campaigntype','queue','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x2193ca,_0x35c872){var _0x1c005b=function(_0x3c7b0e){while(--_0x3c7b0e){_0x2193ca['push'](_0x2193ca['shift']());}};_0x1c005b(++_0x35c872);}(_0x7d25,0x8a));var _0x57d2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7d25[_0x4565bf];return _0x5610ba;};'use strict';var util=require('util');var _=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));function checkNameSurname(_0x35bca8,_0x286bd3,_0x34bad5){var _0x56e08b='';if(!_[_0x57d2('0x2')](_0x286bd3)&&'string'===typeof _0x286bd3){_0x56e08b+=_0x286bd3;}if(!_['isNil'](_0x34bad5)&&'string'===typeof _0x34bad5){_0x56e08b+='\x20'+_0x34bad5;}if(_0x56e08b!==''){return _0x56e08b;}return _0x35bca8;}function Action(_0x5dea84,_0x3c5511,_0x49cc5f,_0x1f43b2,_0x263d35){this[_0x57d2('0x3')]=_0x49cc5f||undefined;this['idContact']=_0x5dea84['id'];this['queue']=_0x3c5511[_0x57d2('0x4')];this['type']=_0x3c5511[_0x57d2('0x5')];this[_0x57d2('0x6')]=_0x57d2('0x7');this['dialAnswer']=![];this[_0x57d2('0x8')]=_[_0x57d2('0x2')](_0x5dea84[_0x57d2('0x9')])?undefined:_0x5dea84[_0x57d2('0x9')][_0x57d2('0x4')];this[_0x57d2('0xa')]=this[_0x57d2('0x8')]?util[_0x57d2('0xb')](_0x57d2('0xc'),this[_0x57d2('0x8')]):_0x1f43b2||undefined;this[_0x57d2('0xd')]=checkNameSurname(_0x5dea84[_0x57d2('0xe')][_0x57d2('0xf')],_0x5dea84[_0x57d2('0xe')][_0x57d2('0x10')],_0x5dea84[_0x57d2('0xe')]['lastName']);this['active']=_0x5dea84[_0x57d2('0x11')]||![];this[_0x57d2('0x12')]=_0x5dea84['phone'];this[_0x57d2('0x13')]=_0x5dea84[_0x57d2('0x13')];this['countbusyretry']=_0x5dea84[_0x57d2('0x14')]||0x0;this['countcongestionretry']=_0x5dea84[_0x57d2('0x15')]||0x0;this['countnoanswerretry']=_0x5dea84[_0x57d2('0x16')]||0x0;this[_0x57d2('0x17')]=(_0x5dea84[_0x57d2('0x14')]||0x0)+(_0x5dea84['countcongestionretry']||0x0)+(_0x5dea84['countnoanswerretry']||0x0)+(_0x5dea84[_0x57d2('0x18')]||0x0)+(_0x5dea84[_0x57d2('0x19')]||0x0)+(_0x5dea84[_0x57d2('0x1a')]||0x0)+(_0x5dea84[_0x57d2('0x1b')]||0x0)+(_0x5dea84['countagentrejectretry']||0x0);this[_0x57d2('0x18')]=_0x5dea84[_0x57d2('0x18')]||0x0;this['countdropretry']=_0x5dea84['countdropretry']||0x0;this[_0x57d2('0x1a')]=_0x5dea84[_0x57d2('0x1a')]||0x0;this[_0x57d2('0x1b')]=_0x5dea84[_0x57d2('0x1b')]||0x0;this[_0x57d2('0x1c')]=_0x5dea84[_0x57d2('0x1c')]||0x0;this[_0x57d2('0x1d')]=_0x5dea84[_0x57d2('0x1d')];this[_0x57d2('0x1e')]=_0x5dea84[_0x57d2('0x1e')];this[_0x57d2('0x1f')]=_0x5dea84[_0x57d2('0x1f')];this[_0x57d2('0x20')]=_0x5dea84[_0x57d2('0x20')];this['ContactId']=_0x5dea84[_0x57d2('0x21')];this[_0x57d2('0x22')]=_0x5dea84[_0x57d2('0x22')];this[_0x57d2('0x23')]=_[_0x57d2('0x2')](_0x5dea84['Agent'])?_0x5dea84[_0x57d2('0x23')]:_0x5dea84[_0x57d2('0x9')]['id'];this[_0x57d2('0x24')]=_0x5dea84[_0x57d2('0x24')];this[_0x57d2('0x25')]='';this[_0x57d2('0x26')]='';}Action[_0x57d2('0x27')]['getCaller']=function(){return util[_0x57d2('0xb')](_0x57d2('0x28'),this[_0x57d2('0xd')],this[_0x57d2('0x29')]);};module[_0x57d2('0x2a')]=Action; \ No newline at end of file +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(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x286cc8,_0x2cc9c9){_0x286cc8=_0x286cc8-0x0;var _0x16566f=_0xfcbb[_0x286cc8];return _0x16566f;};'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 diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index f4614aa..21c4285 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 _0x8d37=['[clearZombieChannels][talking]','Queue','originated:\x20','stringify','queue','dialAnswer','contactId','UserId','Action','channel','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','format','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','actioncountonusuch','idContact','swapAdditionalPhones','answertime','[syncHangup][talking][increment]','\x20Queue','pTalking:\x20','buildObj','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','decrementTalking','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','linkedid','BUSY','Busy','dialBusyRetryFrequency','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','dialBusyMaxRetry','countbusyretry','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','incrementPreviewCounters','CANCEL','outboundRejectCallsDay','countagentrejectretry','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','checkInBlack','Contact','Contact\x20is\x20undefined','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','pick','unlock','unlockContact','recallme','validateContact','isValid','checkIsBlackList','VoiceQueueId','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Agent','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','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','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','callerid','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','variables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','lookAgent','logLookAgent','clone','responsetime','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','filterKey','keys','value','error','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','uuid','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','../dialer/utils','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','hangup','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','name','originated','pTalking','sendMessageOneNotActive','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','type','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil'];(function(_0x30014b,_0x1a29d2){var _0x180392=function(_0x11d5ac){while(--_0x11d5ac){_0x30014b['push'](_0x30014b['shift']());}};_0x180392(++_0x1a29d2);}(_0x8d37,0x10f));var _0x78d3=function(_0x184635,_0x4685b0){_0x184635=_0x184635-0x0;var _0x30d428=_0x8d37[_0x184635];return _0x30d428;};'use strict';var util=require(_0x78d3('0x0'));var _=require(_0x78d3('0x1'));var uuid=require(_0x78d3('0x2'));var moment=require('moment');var Redis=require(_0x78d3('0x3'));var config=require(_0x78d3('0x4'));var logger=require(_0x78d3('0x5'))(_0x78d3('0x6'));var loggerAction=require(_0x78d3('0x5'))(_0x78d3('0x7'));var ami=require(_0x78d3('0x8'));var rpcDb=require(_0x78d3('0x9'));var cmHopperAdditionalPhone=require(_0x78d3('0xa'));var Action=require(_0x78d3('0xb'));var ut=require('./util/util');var utils=require(_0x78d3('0xc'));config[_0x78d3('0xd')]=_[_0x78d3('0xe')](config[_0x78d3('0xd')],{'host':_0x78d3('0xf'),'port':0x18eb});var io=require(_0x78d3('0x10'))(new Redis(config[_0x78d3('0xd')]));var Sequence=function(){};Sequence[_0x78d3('0x11')][_0x78d3('0x12')]=function(_0x56ff99){this[_0x78d3('0x13')]=this[_0x78d3('0x13')]?this[_0x78d3('0x13')][_0x78d3('0x14')](_0x56ff99):_0x56ff99();};function Preview(_0xba9720){this[_0x78d3('0x15')]=new Sequence();this[_0x78d3('0x16')]=_0xba9720[_0x78d3('0x17')];this[_0x78d3('0x18')]=_0xba9720[_0x78d3('0x18')];this[_0x78d3('0x19')]={};this['agents']=_0xba9720[_0x78d3('0x1a')];this[_0x78d3('0x1b')]=0x0;ami['on']('originateresponse',this[_0x78d3('0x1c')]['bind'](this));ami['on'](_0x78d3('0x1d'),this[_0x78d3('0x1e')][_0x78d3('0x1f')](this));ami['on'](_0x78d3('0x20'),this[_0x78d3('0x21')][_0x78d3('0x1f')](this));ami['on'](_0x78d3('0x22'),this[_0x78d3('0x23')]['bind'](this));ami['on'](_0x78d3('0x24'),this['syncNewExten'][_0x78d3('0x1f')](this));ami['on'](_0x78d3('0x25'),this[_0x78d3('0x26')][_0x78d3('0x1f')](this));ami['on']('attendedtransfer',this[_0x78d3('0x27')][_0x78d3('0x1f')](this));ami['on'](_0x78d3('0x28'),this[_0x78d3('0x29')][_0x78d3('0x1f')](this));this[_0x78d3('0x2a')](this['campaignsPreview']);}function emit(_0x46f68d,_0xc8333,_0x556019){io['to'](_0x46f68d)[_0x78d3('0x2b')](_0xc8333,_0x556019);}function emitVoiceQueueChannelRemove(_0x274ac6){logger[_0x78d3('0x2c')](_0x78d3('0x2d'),JSON['stringify'](_0x274ac6));emit(util['format'](_0x78d3('0x2e'),_0x274ac6[_0x78d3('0x2f')]),'voice_queue_channel:remove',_0x274ac6);io[_0x78d3('0x2b')]('voice_queue_presence:remove',_0x274ac6);}function notSendMessagesQueue(_0xcd72a6){if(_0xcd72a6['sendMessageOneNotActive']){if(_0xcd72a6[_0x78d3('0x30')]===0x0&&_0xcd72a6[_0x78d3('0x31')]===0x0){_0xcd72a6[_0x78d3('0x32')]=![];_0xcd72a6[_0x78d3('0x33')]=0x0;_0xcd72a6[_0x78d3('0x34')]=0x0;_0xcd72a6[_0x78d3('0x35')]=utils[_0x78d3('0x36')][_0x78d3('0x37')];ut[_0x78d3('0x38')](_0x78d3('0x39'),_0xcd72a6['name']+_0x78d3('0x3a'));}else{_0xcd72a6[_0x78d3('0x35')]=utils[_0x78d3('0x36')][_0x78d3('0x3b')];ut[_0x78d3('0x38')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0xcd72a6[_0x78d3('0x2f')]+_0x78d3('0x3c'));}}}Preview[_0x78d3('0x11')][_0x78d3('0x2a')]=function(){var _0x54e99e=this;setInterval(function(){_0x54e99e['syncCampaigns']();},0x7cf);};Preview[_0x78d3('0x11')][_0x78d3('0x3d')]=function(){var _0x49fb57=this[_0x78d3('0x16')];this[_0x78d3('0x1b')]+=0x1;for(var _0x4f9f9e in _0x49fb57){if(_0x49fb57[_0x78d3('0x3e')](_0x4f9f9e)&&(_0x49fb57[_0x4f9f9e]['dialMethod']===_0x78d3('0x6')||_0x49fb57[_0x4f9f9e][_0x78d3('0x3f')]==='booked')&&_0x49fb57[_0x4f9f9e][_0x78d3('0x40')]==='outbound'){if(this[_0x78d3('0x1b')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x49fb57['hasOwnProperty'](_0x4f9f9e)&&_0x49fb57[_0x4f9f9e][_0x78d3('0x3f')]===_0x78d3('0x6')&&_0x49fb57[_0x4f9f9e][_0x78d3('0x40')]==='outbound'){if(_0x49fb57[_0x4f9f9e][_0x78d3('0x41')]){this[_0x78d3('0x42')](_0x49fb57[_0x4f9f9e]);if(_0x49fb57[_0x4f9f9e][_0x78d3('0x43')])this[_0x78d3('0x44')](_0x49fb57[_0x4f9f9e]);}else{notSendMessagesQueue(_0x49fb57[_0x4f9f9e]);}}}};Preview[_0x78d3('0x11')][_0x78d3('0x45')]=function(_0xad2e75){var _0x88b28a=this;this[_0x78d3('0x15')][_0x78d3('0x12')](function(){if(!_[_0x78d3('0x46')](_0x88b28a[_0x78d3('0x19')][_0xad2e75])){loggerAction[_0x78d3('0x2c')](_0x78d3('0x47'),_0xad2e75,_0x78d3('0x48'),_0x88b28a[_0x78d3('0x19')][_0xad2e75]['queue'],_0x78d3('0x49'),JSON[_0x78d3('0x4a')](_0x88b28a['campaignsPreview'][_0x88b28a[_0x78d3('0x19')][_0xad2e75]['queue']][_0x78d3('0x30')]),'pTalking:\x20',JSON[_0x78d3('0x4a')](_0x88b28a[_0x78d3('0x16')][_0x88b28a['actions'][_0xad2e75][_0x78d3('0x4b')]][_0x78d3('0x31')]),JSON['stringify'](_0x88b28a[_0x78d3('0x19')][_0xad2e75][_0x78d3('0x4c')]),JSON[_0x78d3('0x4a')](_['pick'](_0x88b28a[_0x78d3('0x19')][_0xad2e75],[_0x78d3('0x4d'),_0x78d3('0x4e'),'VoiceQueueId','ListId'])));return ami[_0x78d3('0x4f')]({'action':'status','channel':_0x88b28a[_0x78d3('0x19')][_0xad2e75][_0x78d3('0x50')]})['catch'](function(_0xbaf710){if(_0xbaf710[_0x78d3('0x35')]===_0x78d3('0x51')){setTimeout(function(){if(_0x88b28a[_0x78d3('0x19')][_0xad2e75]){utils[_0x78d3('0x52')](_0x88b28a[_0x78d3('0x16')][_0x88b28a[_0x78d3('0x19')][_0xad2e75][_0x78d3('0x4b')]],'[clearZombieChannel]');if(_0x88b28a['actions'][_0xad2e75][_0x78d3('0x4c')]===!![]){ut['decrementTalking'](_0x88b28a[_0x78d3('0x16')][_0x88b28a[_0x78d3('0x19')][_0xad2e75][_0x78d3('0x4b')]],_0x78d3('0x53'));ut['loggerError'](_0x78d3('0x54')+_0xad2e75,_0x88b28a[_0x78d3('0x19')][_0xad2e75][_0x78d3('0x4b')]);}ut[_0x78d3('0x55')](_0x78d3('0x56')+_0xad2e75,_0x88b28a['actions'][_0xad2e75][_0x78d3('0x4b')]);delete _0x88b28a[_0x78d3('0x19')][_0xad2e75];}},0x2328);}});}});};Preview[_0x78d3('0x11')][_0x78d3('0x57')]=function(){var _0x4805c4=this;loggerAction['info'](_0x78d3('0x58'),_[_0x78d3('0x59')](this[_0x78d3('0x19')]));for(var _0x389585 in this[_0x78d3('0x19')]){if(_0x4805c4[_0x78d3('0x19')]['hasOwnProperty'](_0x389585)){_0x4805c4[_0x78d3('0x45')](_0x389585);}}};Preview[_0x78d3('0x11')][_0x78d3('0x44')]=function(_0x55592a){var _0x97790=this;rpcDb[_0x78d3('0x5a')](_0x55592a['id'],ut[_0x78d3('0x5b')](this[_0x78d3('0x1a')]))[_0x78d3('0x5c')](function(_0x226081){if(!_[_0x78d3('0x46')](_0x226081)){for(var _0x35c45c=0x0;_0x35c45c<_0x226081[_0x78d3('0x5d')];_0x35c45c+=0x1){if(ut[_0x78d3('0x5e')](_0x226081[_0x35c45c][_0x78d3('0x5f')])<_0x55592a[_0x78d3('0x60')]*0x3c){if(_0x226081[_0x35c45c]['Agent']&&!_0x226081[_0x35c45c]['Agent'][_0x78d3('0x61')]){_0x97790[_0x78d3('0x62')](_0x226081[_0x35c45c]['id'])[_0x78d3('0x5c')](ut['logger2'](_0x78d3('0x63')))[_0x78d3('0x64')](ut[_0x78d3('0x65')]('[RecallMe]'));}else{rpcDb[_0x78d3('0x66')](_0x226081[_0x35c45c]['id']);}}else{var _0x28d3ef=new Action(_0x226081[_0x35c45c],_0x55592a);_0x28d3ef[_0x78d3('0x67')]=moment()[_0x78d3('0x68')](_0x78d3('0x69'));_0x55592a[_0x78d3('0x6a')]+=0x1;ut[_0x78d3('0x6b')](_0x28d3ef,0x17,_0x78d3('0x6c'));if(_0x55592a[_0x78d3('0x6d')]){rpcDb[_0x78d3('0x6e')](ut[_0x78d3('0x6f')](_0x226081[_0x35c45c]));rpcDb[_0x78d3('0x70')](_0x28d3ef,_0x78d3('0x71'));}else{ut[_0x78d3('0x6b')](_0x28d3ef,0x16,'RecallFailedTimeout');rpcDb[_0x78d3('0x70')](_0x28d3ef,_0x78d3('0x72'));rpcDb[_0x78d3('0x73')](_0x28d3ef,'[HistoryRecallClose]');}}}}})['catch'](ut[_0x78d3('0x65')](_0x78d3('0x74')));};Preview[_0x78d3('0x11')][_0x78d3('0x42')]=function(_0x11afdc){_0x11afdc[_0x78d3('0x32')]=!![];if(ut['IsNotLoggedIn'](_0x11afdc[_0x78d3('0x75')])){_0x11afdc['message']=utils[_0x78d3('0x36')][_0x78d3('0x76')];}else if(!ut[_0x78d3('0x77')](_0x11afdc[_0x78d3('0x41')])){_0x11afdc['message']=utils[_0x78d3('0x36')][_0x78d3('0x37')];}else if(!this[_0x78d3('0x78')](_0x11afdc[_0x78d3('0x79')])){if(!this[_0x78d3('0x78')](_0x11afdc[_0x78d3('0x7a')])){_0x11afdc[_0x78d3('0x35')]=utils['CAMPAIGN_STATUS'][_0x78d3('0x7b')];}else{_0x11afdc[_0x78d3('0x35')]=utils[_0x78d3('0x36')][_0x78d3('0x7c')];}}else{_0x11afdc[_0x78d3('0x35')]=utils[_0x78d3('0x36')]['ACTIVE'];}};Preview[_0x78d3('0x11')][_0x78d3('0x7d')]=function(_0x40ad1c,_0x1f2807,_0x2bf191){var _0x55d891=this;var _0x698895=this[_0x78d3('0x19')][_0x1f2807];var _0x3f59d1=this[_0x78d3('0x16')][_0x698895[_0x78d3('0x4b')]];var _0x456499;var _0x109556=![];var _0x11bc4d=0x2;var _0x93eff=0x3;if(_0x3f59d1){switch(_0x2bf191){case'1':_0x3f59d1[_0x78d3('0x7e')]+=0x1;_0x698895[_0x78d3('0x7f')]+=0x1;_0x698895[_0x78d3('0x80')]=ut[_0x78d3('0x81')](_0x698895);ut[_0x78d3('0x6b')](_0x698895,0x0,_0x78d3('0x82'));ami[_0x78d3('0x2b')]('custom:agentnosuchnumber',ut['buildObj'](_0x698895,_0x78d3('0x83')));rpcDb[_0x78d3('0x70')](_0x698895,_0x78d3('0x84'));_0x55d891[_0x78d3('0x85')](_0x698895,'0',_0x3f59d1)[_0x78d3('0x5c')](function(_0x4cbe4f){_0x109556=_0x4cbe4f[_0x78d3('0x86')]==0x1;_0x11bc4d=_0x3f59d1[_0x78d3('0x87')];_0x93eff=_0x3f59d1[_0x78d3('0x88')];if(!_0x109556){if(ut['totalGlobal'](_0x698895)>=_0x3f59d1[_0x78d3('0x89')]){_0x456499=ut[_0x78d3('0x8a')](_0x698895,0xf,_0x78d3('0x8b'));rpcDb['createCustomerFinal'](_0x456499,_0x78d3('0x8c'));}else{if(_0x698895[_0x78d3('0x7f')]>=_0x3f59d1[_0x78d3('0x8d')]){rpcDb[_0x78d3('0x73')](_0x698895,_0x78d3('0x8c'));}else{rpcDb[_0x78d3('0x8e')](ut[_0x78d3('0x8f')](_0x698895,_0x78d3('0x7f'),_0x3f59d1[_0x78d3('0x87')]),_0x698895[_0x78d3('0x90')],_0x698895[_0x78d3('0x91')]);}}delete this[_0x78d3('0x19')][_0x40ad1c['linkedid']];}else{_0x698895[_0x78d3('0x7f')]++;logger[_0x78d3('0x2c')](_0x78d3('0x92'),_0x698895[_0x78d3('0x7f')]);logger[_0x78d3('0x2c')]('id',_0x698895[_0x78d3('0x93')]);_0x55d891['incrementPreviewCounters']({'id':_0x698895[_0x78d3('0x93')],'field':{'countnosuchnumberretry':_0x698895[_0x78d3('0x7f')]}})['then'](function(){_0x55d891[_0x78d3('0x94')](_0x698895,_0x11bc4d,_0x93eff)[_0x78d3('0x5c')](function(){});});}});break;case'ANSWER':var _0x24c8dc=moment()['format'](_0x78d3('0x69'));_0x698895['responsetime']=_0x24c8dc;_0x698895[_0x78d3('0x95')]=_0x24c8dc;_0x698895[_0x78d3('0x4c')]=!![];_0x3f59d1[_0x78d3('0x31')]+=0x1;logger[_0x78d3('0x2c')](_0x78d3('0x96'),_0x698895['uniqueid'],_0x78d3('0x97'),_0x3f59d1[_0x78d3('0x2f')],_0x78d3('0x98'),_0x3f59d1[_0x78d3('0x31')]);ami[_0x78d3('0x2b')]('custom:agentconnect',ut[_0x78d3('0x99')](_0x698895,_0x78d3('0x9a'),this['campaignsPreview'][_0x698895[_0x78d3('0x4b')]]));if(_0x3f59d1[_0x78d3('0x9b')]||_0x3f59d1[_0x78d3('0x9c')]){ami[_0x78d3('0x2b')](_0x78d3('0x9d'),{'queue':_0x698895[_0x78d3('0x4b')],'interface':_0x698895[_0x78d3('0x9e')],'uniqueid':_0x698895[_0x78d3('0x9f')]});}break;case'16':ami[_0x78d3('0x2b')](_0x78d3('0xa0'),ut[_0x78d3('0x99')](_0x698895,_0x78d3('0xa1'),this[_0x78d3('0x16')][_0x698895[_0x78d3('0x4b')]]));emitVoiceQueueChannelRemove(ut[_0x78d3('0x99')](_0x698895,_0x78d3('0xa1')));_0x3f59d1[_0x78d3('0xa2')]+=0x1;_0x3f59d1[_0x78d3('0xa3')]+=0x1;_0x3f59d1[_0x78d3('0xa4')]+=0x1;ut[_0x78d3('0xa5')](_0x3f59d1,_0x78d3('0xa6'));_0x698895['countglobal']=ut[_0x78d3('0x81')](_0x698895);ut[_0x78d3('0x6b')](_0x698895,0x4,_0x78d3('0xa7'));rpcDb['createCustomerHistory'](_0x698895,_0x78d3('0xa8'));rpcDb[_0x78d3('0x73')](_0x698895,_0x78d3('0xa9'));rpcDb['crateCustomerReportQueue'](_0x698895);_0x3f59d1[_0x78d3('0xaa')]+=_0x698895[_0x78d3('0xab')];_0x3f59d1[_0x78d3('0xac')]+=_0x698895[_0x78d3('0xab')];logger[_0x78d3('0x2c')](_0x78d3('0xad'),_0x698895[_0x78d3('0x9f')],_0x78d3('0x97'),_0x3f59d1[_0x78d3('0x2f')],_0x78d3('0x98'),_0x3f59d1[_0x78d3('0x31')]);delete this['actions'][_0x40ad1c[_0x78d3('0xae')]];break;case _0x78d3('0xaf'):_0x3f59d1['outboundBusyCallsDay']+=0x1;_0x698895['countbusyretry']+=0x1;_0x698895[_0x78d3('0x80')]=ut[_0x78d3('0x81')](_0x698895);ut[_0x78d3('0x6b')](_0x698895,0x5,_0x78d3('0xb0'));_0x11bc4d=_0x3f59d1[_0x78d3('0xb1')];_0x93eff=_0x3f59d1['callAdditionalPhoneAfterMin'];ami[_0x78d3('0x2b')](_0x78d3('0xb2'),ut[_0x78d3('0x99')](_0x698895,'busy'));rpcDb[_0x78d3('0x70')](_0x698895,_0x78d3('0xb3'));_0x55d891[_0x78d3('0x85')](_0x698895,'5',_0x3f59d1)[_0x78d3('0x5c')](function(_0x162050){_0x109556=_0x162050[_0x78d3('0x86')]==0x1;if(!_0x109556){if(ut[_0x78d3('0x81')](_0x698895)>=_0x3f59d1['dialGlobalMaxRetry']){_0x456499=ut[_0x78d3('0x8a')](_0x698895,0xf,_0x78d3('0x8b'));rpcDb[_0x78d3('0x73')](_0x456499,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x698895['countbusyretry']>=_0x3f59d1[_0x78d3('0xb4')]){rpcDb['createCustomerFinal'](_0x698895,_0x78d3('0xb3'));}else{rpcDb[_0x78d3('0x8e')](ut['scheduledAt'](_0x698895,_0x78d3('0xb5'),_0x3f59d1[_0x78d3('0xb1')]),_0x698895['unlockAgent'],_0x698895[_0x78d3('0x91')]);}}}else{_0x698895[_0x78d3('0xb5')]++;_0x55d891['incrementPreviewCounters']({'id':_0x698895[_0x78d3('0x93')],'field':{'countbusyretry':_0x698895[_0x78d3('0xb5')]}})[_0x78d3('0x5c')](function(){_0x55d891[_0x78d3('0x94')](_0x698895,_0x11bc4d,_0x93eff)['then'](function(){});});}});break;case _0x78d3('0xb6'):_0x3f59d1[_0x78d3('0xb7')]+=0x1;_0x698895['countnoanswerretry']+=0x1;_0x698895['countglobal']=ut[_0x78d3('0x81')](_0x698895);ut['logCustomer'](_0x698895,0x3,_0x78d3('0xb8'));_0x11bc4d=_0x3f59d1[_0x78d3('0xb9')];_0x93eff=_0x3f59d1[_0x78d3('0x88')];var _0x5ecac2=ut[_0x78d3('0xba')](_0x698895,_0x3f59d1);ami[_0x78d3('0x2b')](_0x78d3('0xbb'),_0x5ecac2);rpcDb[_0x78d3('0x70')](_0x698895,'[callProgressDetectingCustomer][logNoAnswer]');_0x55d891[_0x78d3('0x85')](_0x698895,'3',_0x3f59d1)[_0x78d3('0x5c')](function(_0x4a189){_0x109556=_0x4a189[_0x78d3('0x86')]==0x1;if(!_0x109556){if(ut['totalGlobal'](_0x698895)>=_0x3f59d1[_0x78d3('0x89')]){_0x456499=ut[_0x78d3('0x8a')](_0x698895,0xf,_0x78d3('0x8b'));rpcDb['createCustomerFinal'](_0x456499,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x698895[_0x78d3('0xbc')]>=_0x3f59d1[_0x78d3('0xbd')]){rpcDb[_0x78d3('0x73')](_0x698895,_0x78d3('0xbe'));}else{rpcDb[_0x78d3('0x8e')](ut[_0x78d3('0x8f')](_0x698895,_0x78d3('0xbc'),_0x3f59d1[_0x78d3('0xb9')]),_0x698895[_0x78d3('0x90')],_0x698895[_0x78d3('0x91')]);}}}else{_0x698895[_0x78d3('0xbc')]++;_0x55d891['incrementPreviewCounters']({'id':_0x698895[_0x78d3('0x93')],'field':{'countnoanswerretry':_0x698895[_0x78d3('0xbc')]}})['then'](function(){_0x55d891[_0x78d3('0x94')](_0x698895,_0x11bc4d,_0x93eff)['then'](function(){});});}});break;case'CONGESTION':_0x3f59d1[_0x78d3('0xbf')]+=0x1;_0x698895[_0x78d3('0xc0')]+=0x1;_0x698895[_0x78d3('0x80')]=ut['totalGlobal'](_0x698895);ut[_0x78d3('0x6b')](_0x698895,0x8,_0x78d3('0xc1'));_0x11bc4d=_0x3f59d1['dialCongestionRetryFrequency'];_0x93eff=_0x3f59d1[_0x78d3('0x88')];ami['emit'](_0x78d3('0xc2'),ut[_0x78d3('0x99')](_0x698895,_0x78d3('0xc3')));rpcDb[_0x78d3('0x70')](_0x698895,_0x78d3('0xc4'));_0x55d891[_0x78d3('0x85')](_0x698895,'8',_0x3f59d1)['then'](function(_0x3303d9){_0x109556=_0x3303d9[_0x78d3('0x86')]==0x1;if(!_0x109556){if(ut[_0x78d3('0x81')](_0x698895)>=_0x3f59d1[_0x78d3('0x89')]){_0x456499=ut['cloneAction'](_0x698895,0xf,_0x78d3('0x8b'));rpcDb[_0x78d3('0x73')](_0x456499,_0x78d3('0xc5'));}else{if(_0x698895['countcongestionretry']>=_0x3f59d1[_0x78d3('0xc6')]){rpcDb[_0x78d3('0x73')](_0x698895,_0x78d3('0xc4'));}else{rpcDb[_0x78d3('0x8e')](ut['scheduledAt'](_0x698895,_0x78d3('0xc0'),_0x3f59d1[_0x78d3('0xb1')]),_0x698895[_0x78d3('0x90')],_0x698895[_0x78d3('0x91')]);}}}else{_0x698895['countcongestionretry']++;_0x55d891[_0x78d3('0xc7')]({'id':_0x698895[_0x78d3('0x93')],'field':{'countcongestionretry':_0x698895[_0x78d3('0xc0')]}})[_0x78d3('0x5c')](function(){_0x55d891[_0x78d3('0x94')](_0x698895,_0x11bc4d,_0x93eff)[_0x78d3('0x5c')](function(){});});}});break;case _0x78d3('0xc8'):_0x3f59d1[_0x78d3('0xc9')]+=0x1;_0x698895[_0x78d3('0xca')]+=0x1;_0x698895['countglobal']=ut[_0x78d3('0x81')](_0x698895);ut['logCustomer'](_0x698895,0x14,'AgentReject');_0x11bc4d=_0x3f59d1[_0x78d3('0xcb')];_0x93eff=_0x3f59d1[_0x78d3('0x88')];ami[_0x78d3('0x2b')](_0x78d3('0xcc'),ut['buildObj'](_0x698895,_0x78d3('0xcd')));rpcDb[_0x78d3('0x70')](_0x698895,_0x78d3('0xce'));_0x55d891[_0x78d3('0x85')](_0x698895,'20',_0x3f59d1)[_0x78d3('0x5c')](function(_0x4d4f85){_0x109556=_0x4d4f85['additional']==0x1;if(!_0x109556){if(ut['totalGlobal'](_0x698895)>=_0x3f59d1[_0x78d3('0x89')]){_0x456499=ut[_0x78d3('0x8a')](_0x698895,0x14,_0x78d3('0xcf'));rpcDb[_0x78d3('0x73')](_0x456499,_0x78d3('0xd0'));}else{if(_0x698895[_0x78d3('0xca')]>=_0x3f59d1[_0x78d3('0xd1')]){rpcDb['createCustomerFinal'](_0x698895,_0x78d3('0xd0'));}else{rpcDb[_0x78d3('0x8e')](ut[_0x78d3('0x8f')](_0x698895,_0x78d3('0xca'),_0x3f59d1[_0x78d3('0xcb')]),_0x698895[_0x78d3('0x90')],_0x698895[_0x78d3('0x91')]);}}}else{_0x698895[_0x78d3('0xbc')]++;_0x55d891[_0x78d3('0xc7')]({'id':_0x698895['idContact'],'field':{'countnoanswerretry':_0x698895[_0x78d3('0xbc')]}})[_0x78d3('0x5c')](function(){_0x55d891['swapAdditionalPhones'](_0x698895,_0x11bc4d,_0x93eff)['then'](function(){});});}});break;case _0x78d3('0xd2'):_0x3f59d1['outboundAbandonedCallsDay']+=0x1;_0x698895[_0x78d3('0xd3')]+=0x1;_0x698895['countglobal']=ut['totalGlobal'](_0x698895);ut[_0x78d3('0x6b')](_0x698895,0xb,_0x78d3('0xd4'));rpcDb[_0x78d3('0x70')](_0x698895,'[callProgressDetectingCustomer][logAbandoned]');_0x55d891[_0x78d3('0x85')](_0x698895,'11',_0x3f59d1)[_0x78d3('0x5c')](function(_0x16841f){_0x109556=_0x16841f[_0x78d3('0x86')]==0x1;if(!_0x109556){if(ut['totalGlobal'](_0x698895)>=_0x3f59d1[_0x78d3('0x89')]){_0x456499=ut[_0x78d3('0x8a')](_0x698895,0xf,_0x78d3('0x8b'));rpcDb[_0x78d3('0x73')](_0x456499,_0x78d3('0xd5'));}else{if(_0x698895[_0x78d3('0xd6')]>=_0x3f59d1[_0x78d3('0xd7')]){rpcDb[_0x78d3('0x73')](_0x698895,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut[_0x78d3('0x8f')](_0x698895,_0x78d3('0xd3'),_0x3f59d1[_0x78d3('0xd8')]),_0x698895[_0x78d3('0x90')],_0x698895[_0x78d3('0x91')]);}}}else{_0x698895[_0x78d3('0xbc')]++;_0x55d891[_0x78d3('0xc7')]({'id':_0x698895[_0x78d3('0x93')],'field':{'countnoanswerretry':_0x698895[_0x78d3('0xbc')]}})[_0x78d3('0x5c')](function(){_0x55d891['swapAdditionalPhones'](_0x698895,_0x11bc4d,_0x93eff)[_0x78d3('0x5c')](function(){});});}});break;case'18':_0x3f59d1['outboundUnknownCallsDay']+=0x1;_0x698895[_0x78d3('0xd9')]+=0x1;_0x698895[_0x78d3('0x80')]=ut[_0x78d3('0x81')](_0x698895);ut['logCustomer'](_0x698895,0x12,_0x40ad1c['cause-txt']||_0x40ad1c[_0x78d3('0xda')]);ami[_0x78d3('0x2b')](_0x78d3('0xdb'),ut[_0x78d3('0x99')](_0x698895,_0x78d3('0xdc')));rpcDb['createCustomerHistory'](_0x698895,_0x78d3('0xdd'));_0x55d891[_0x78d3('0x85')](_0x698895,'18',_0x3f59d1)['then'](function(_0x24a053){_0x109556=_0x24a053['additional']==0x1;if(!_0x109556){if(ut[_0x78d3('0x81')](_0x698895)>=_0x3f59d1[_0x78d3('0x89')]){_0x456499=ut[_0x78d3('0x8a')](_0x698895,0x12,_0x78d3('0x8b'));rpcDb[_0x78d3('0x73')](_0x456499,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x78d3('0x73')](_0x698895,_0x78d3('0xdd'));}}else{_0x698895[_0x78d3('0xbc')]++;_0x55d891[_0x78d3('0xc7')]({'id':_0x698895[_0x78d3('0x93')],'field':{'countnoanswerretry':_0x698895[_0x78d3('0xbc')]}})[_0x78d3('0x5c')](function(){_0x55d891[_0x78d3('0x94')](_0x698895,_0x11bc4d,_0x93eff)[_0x78d3('0x5c')](function(){});});}});delete this['actions'][_0x40ad1c['linkedid']];break;case'19':_0x3f59d1[_0x78d3('0xde')]+=0x1;_0x698895[_0x78d3('0x80')]=ut[_0x78d3('0x81')](_0x698895);ut[_0x78d3('0x6b')](_0x698895,0x13,_0x40ad1c[_0x78d3('0xdf')]||_0x40ad1c[_0x78d3('0xda')]);ami[_0x78d3('0x2b')](_0x78d3('0xdb'),ut[_0x78d3('0x99')](_0x698895,'amd'));rpcDb[_0x78d3('0x70')](_0x698895,_0x78d3('0xe0'));_0x55d891[_0x78d3('0x85')](_0x698895,'18',_0x3f59d1)[_0x78d3('0x5c')](function(_0x1fba8c){_0x109556=_0x1fba8c[_0x78d3('0x86')]==0x1;if(!_0x109556){if(ut[_0x78d3('0x81')](_0x698895)>=_0x3f59d1[_0x78d3('0x89')]){_0x456499=ut[_0x78d3('0x8a')](_0x698895,0xf,'Global');rpcDb[_0x78d3('0x73')](_0x456499,_0x78d3('0xe0'));}else{rpcDb[_0x78d3('0x73')](_0x698895,_0x78d3('0xe0'));}}else{_0x698895[_0x78d3('0xbc')]++;_0x55d891[_0x78d3('0xc7')]({'id':_0x698895['idContact'],'field':{'countnoanswerretry':_0x698895[_0x78d3('0xbc')]}})['then'](function(){_0x55d891[_0x78d3('0x94')](_0x698895,_0x11bc4d,_0x93eff)[_0x78d3('0x5c')](function(){});});}});delete this[_0x78d3('0x19')][_0x40ad1c[_0x78d3('0xae')]];break;default:if(_0x698895[_0x78d3('0x4c')]){ut[_0x78d3('0xa5')](_0x3f59d1,_0x78d3('0xe1'));ut[_0x78d3('0x55')](_0x78d3('0xe2')+_0x3f59d1['name'],_0x40ad1c);}_0x3f59d1[_0x78d3('0xde')]+=0x1;_0x698895[_0x78d3('0x80')]=ut[_0x78d3('0x81')](_0x698895);ut[_0x78d3('0x6b')](_0x698895,0xc,_0x40ad1c[_0x78d3('0xdf')]||_0x40ad1c[_0x78d3('0xda')]);_0x11bc4d=_0x3f59d1[_0x78d3('0xcb')];_0x93eff=_0x3f59d1[_0x78d3('0x88')];rpcDb[_0x78d3('0x70')](_0x698895,_0x78d3('0xe3'));_0x55d891['verifyAdditionalPhones'](_0x698895,'20',_0x3f59d1)[_0x78d3('0x5c')](function(_0x43b7e6){_0x109556=_0x43b7e6[_0x78d3('0x86')]==0x1;if(!_0x109556){if(ut[_0x78d3('0x81')](_0x698895)>=_0x3f59d1[_0x78d3('0x89')]){_0x456499=ut[_0x78d3('0x8a')](_0x698895,0xf,'Global');rpcDb[_0x78d3('0x73')](_0x456499,_0x78d3('0xe4'));}else{rpcDb[_0x78d3('0x73')](_0x698895,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x40ad1c[_0x78d3('0xae')]];}else{_0x55d891[_0x78d3('0x94')](_0x698895,_0x11bc4d,_0x93eff)[_0x78d3('0x5c')](function(){});}});}if(!(_0x698895['dialAnswer']&&_0x2bf191==='16')){utils['decrementOriginate'](_0x3f59d1,_0x78d3('0xe5'));logger[_0x78d3('0x2c')](_0x78d3('0xe6'),_0x698895['uniqueid'],_0x78d3('0x97'),_0x3f59d1[_0x78d3('0x2f')],_0x78d3('0x49'),_0x3f59d1[_0x78d3('0x30')]);}if(_0x2bf191!==_0x78d3('0xe7')){delete this[_0x78d3('0x19')][_0x40ad1c[_0x78d3('0xae')]];delete this['actions'][_0x40ad1c[_0x78d3('0xe8')]];}_0x3f59d1[_0x78d3('0xe9')]=!![];}};Preview[_0x78d3('0x11')][_0x78d3('0xea')]=function(_0x49e550,_0x1b7405,_0x330b63){if(_[_0x78d3('0xeb')](_0x1b7405)&&_0x78d3('0xec')!==typeof _0x1b7405){return;}if(_['isUndefined'](_0x330b63)&&_0x78d3('0xec')!==typeof _0x330b63){return;}switch(_0x330b63[_0x78d3('0xed')]){case'0':ut['logAgent'](_0x49e550,0x0,_0x78d3('0x82'));rpcDb[_0x78d3('0xee')](_0x49e550,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x78d3('0xef')](_0x49e550,0x3,'NoAnswer');rpcDb[_0x78d3('0xee')](_0x49e550,_0x78d3('0xf0'));break;case'5':ut[_0x78d3('0xef')](_0x49e550,0x5,'Busy');rpcDb[_0x78d3('0xee')](_0x49e550,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x78d3('0xef')](_0x49e550,0x8,'Congestion');rpcDb[_0x78d3('0xee')](_0x49e550,_0x78d3('0xf1'));break;case'22':ut['logAgent'](_0x49e550,0x16,_0x78d3('0xf2'));rpcDb[_0x78d3('0xee')](_0x49e550,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x78d3('0xef')](_0x49e550,0xc,_0x330b63['reason']);rpcDb[_0x78d3('0xee')](_0x49e550,_0x78d3('0xf1'));}utils['decrementOriginate'](_0x1b7405,_0x78d3('0xf3'));logger[_0x78d3('0x2c')](_0x78d3('0xf4'),_0x49e550[_0x78d3('0x9f')],_0x78d3('0x97'),_0x1b7405[_0x78d3('0x2f')],'originated:\x20',_0x1b7405[_0x78d3('0x30')]);delete this[_0x78d3('0x19')][_0x49e550['uniqueid']];};Preview[_0x78d3('0x11')][_0x78d3('0x85')]=function(_0x41b66f,_0x3fb757,_0x5ee045){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x41b66f,_0x3fb757,_0x5ee045)[_0x78d3('0x64')](logger[_0x78d3('0x2c')](_0x78d3('0xf5')));};Preview['prototype'][_0x78d3('0x94')]=function(_0x3864b5,_0x422e06,_0x1c6180){return cmHopperAdditionalPhone[_0x78d3('0x94')](_0x3864b5,_0x422e06,_0x1c6180)[_0x78d3('0x64')](logger[_0x78d3('0x2c')]('[swapAdditionalPhone]\x20'));};Preview[_0x78d3('0x11')][_0x78d3('0xc7')]=function(_0xbe0f1f){return Promise[_0x78d3('0xf6')]()[_0x78d3('0x5c')](cmHopperAdditionalPhone[_0x78d3('0xc7')](_0xbe0f1f))[_0x78d3('0x64')](logger[_0x78d3('0x2c')]('[incrementPreviewCounters]\x20'));};Preview[_0x78d3('0x11')][_0x78d3('0xf7')]=function(_0x5e9e76,_0x338850,_0x51519e,_0x3c65f7,_0xebe30e){var _0x251a6b=this;return new Promise(function(_0x1eeb3b,_0x585377){if(_[_0x78d3('0x46')](_0x338850)||_[_0x78d3('0x46')](_0x338850[_0x78d3('0xf8')])||_['isNil'](_0x338850['phone'])||_[_0x78d3('0x46')](_0x338850['VoiceQueueId'])){_0x585377(ut[_0x78d3('0x35')](_0x78d3('0xf9'),_0x3c65f7,_0xebe30e));return;}var _0x29a422=uuid['v4']();var _0x462fd0=_0x251a6b[_0x78d3('0x16')][_0x338850[_0x78d3('0x48')][_0x78d3('0x2f')]];var _0x3041b3=_0x51519e?_0x251a6b[_0x78d3('0x1a')][_0x51519e]['id']:undefined;_0x251a6b['actions'][_0x29a422]=new Action(_0x338850,_0x462fd0,_0x29a422,_0x51519e,_0x3041b3);var _0x58578e=_0x251a6b[_0x78d3('0x19')][_0x29a422];_0x58578e[_0x78d3('0x90')]=_0x3c65f7;_0x58578e[_0x78d3('0x91')]=_0xebe30e;_0x58578e['lookAgent']=_0x51519e;if(_['isEmpty'](_0x5e9e76)){_0x251a6b[_0x78d3('0xfa')](_0x58578e,_0x462fd0,_0x338850,_0x51519e)['then'](function(_0x2198d0){logger[_0x78d3('0x2c')](_0x78d3('0xfb'),_0x78d3('0xfc')+_0x58578e[_0x78d3('0x4b')]+_0x78d3('0xfd')+_0x58578e[_0x78d3('0x93')],JSON['stringify'](_0x2198d0));ami[_0x78d3('0x2b')](_0x78d3('0xfe'),ut[_0x78d3('0x99')](_0x58578e,_0x78d3('0xff'),_0x251a6b[_0x78d3('0x16')][_0x58578e[_0x78d3('0x4b')]]));_0x1eeb3b(ut[_0x78d3('0x35')](_0x78d3('0x100')));})[_0x78d3('0x64')](function(_0x57e13a){ut[_0x78d3('0x38')](_0x78d3('0x101'),_0x57e13a);_0x585377(ut['message'](_0x78d3('0x102'),_0x3c65f7,_0xebe30e));});}else{_0x462fd0[_0x78d3('0x103')]+=0x1;ut[_0x78d3('0x104')](_0x58578e);rpcDb[_0x78d3('0x105')](_0x58578e,'[Blacklist][error]');delete _0x251a6b['actions'][_0x29a422];_0x585377(ut[_0x78d3('0x35')](_0x78d3('0x106'),_0x3c65f7,_0xebe30e));}});};Preview[_0x78d3('0x11')][_0x78d3('0x78')]=function(_0x316a4c){return!_[_0x78d3('0x46')](_0x316a4c)&&!_['isNil'](_0x316a4c[_0x78d3('0x2f')])&&!_['isNil'](_0x316a4c[_0x78d3('0x107')])&&_0x316a4c['active']&&!_['isNil'](this[_0x78d3('0x18')][util[_0x78d3('0x68')](_0x78d3('0x108'),_0x316a4c['name'])])&&!_[_0x78d3('0x46')](this['trunks'][util['format'](_0x78d3('0x108'),_0x316a4c['name'])][_0x78d3('0x109')])&&(this['trunks'][util[_0x78d3('0x68')](_0x78d3('0x108'),_0x316a4c['name'])][_0x78d3('0x109')]===_0x78d3('0x10a')||this[_0x78d3('0x18')][util[_0x78d3('0x68')](_0x78d3('0x108'),_0x316a4c[_0x78d3('0x2f')])]['status']===_0x78d3('0x10b'));};Preview['prototype'][_0x78d3('0x62')]=function(_0x50c05a,_0x1ef341){return this[_0x78d3('0x10c')](_0x50c05a,_0x1ef341)[_0x78d3('0x5c')](function(_0x51970d){return _[_0x78d3('0x10d')](_0x51970d,[_0x78d3('0x35')]);})[_0x78d3('0x64')](function(_0x4f948c){if(_0x4f948c[_0x78d3('0x10e')]){rpcDb[_0x78d3('0x10f')](_0x50c05a);}if(_0x4f948c[_0x78d3('0x107')]){rpcDb[_0x78d3('0x66')](_0x50c05a);}throw _[_0x78d3('0x10d')](_0x4f948c,[_0x78d3('0x35')]);});};Preview[_0x78d3('0x11')][_0x78d3('0x10c')]=function(_0x4610a1,_0x20154b){var _0x28092d=this;var _0x3e0ac1,_0x4c3e73;return rpcDb['getContactPreview'](_0x4610a1)[_0x78d3('0x5c')](function(_0x463dfb){if(!_[_0x78d3('0x46')](_0x463dfb[0x0])){_0x4c3e73=_0x463dfb[0x0]['recallme']?![]:!![];_0x3e0ac1=_0x463dfb[0x0][_0x78d3('0x110')]?!![]:![];_0x3e0ac1=_0x20154b?!![]:_0x3e0ac1;}var _0x33b89c=_0x28092d[_0x78d3('0x111')](_0x463dfb);if(_0x33b89c[_0x78d3('0x112')]){rpcDb[_0x78d3('0x113')](_[_0x78d3('0x10d')](_0x463dfb[0x0],[_0x78d3('0x114'),_0x78d3('0x115')]))['then'](function(_0x2c276b){_0x28092d[_0x78d3('0xf7')](_0x2c276b,_0x463dfb[0x0],_0x20154b,_0x4c3e73,_0x3e0ac1)['then'](function(_0x677883){return _0x677883;})[_0x78d3('0x64')](function(_0x326e66){throw _0x326e66;});})['catch'](function(_0x133efe){ut[_0x78d3('0x38')](_0x78d3('0x116'),_0x133efe);throw ut['message'](_0x78d3('0x117'),_0x4c3e73,_0x3e0ac1);});}else{throw ut[_0x78d3('0x35')](_0x33b89c[_0x78d3('0x35')],_0x4c3e73,_0x3e0ac1);}})[_0x78d3('0x64')](function(_0xca2817){ut['logger'](_0x78d3('0x118'),_0xca2817);throw ut[_0x78d3('0x35')](_0x78d3('0x117'),![],!![]);});};Preview[_0x78d3('0x11')][_0x78d3('0x111')]=function(_0x52a770){if(_['isNil'](_0x52a770)||_['isEmpty'](_0x52a770)||!_[_0x78d3('0x46')](_0x52a770[0x0][_0x78d3('0x119')])&&_[_0x78d3('0x46')](_0x52a770[0x0][_0x78d3('0x119')][_0x78d3('0x2f')])){ut['logger'](_0x78d3('0x11a'),_0x52a770);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x200eef=this[_0x78d3('0x16')][_0x52a770[0x0]['Queue'][_0x78d3('0x2f')]];_0x200eef[_0x78d3('0x35')]=utils[_0x78d3('0x36')][_0x78d3('0x7c')];if(_[_0x78d3('0x46')](_0x200eef)){ut[_0x78d3('0x38')](_0x78d3('0x11b'),_0x200eef);return{'isValid':![],'message':_0x78d3('0x11c')};}if(!this[_0x78d3('0x78')](_0x200eef[_0x78d3('0x79')])){ut[_0x78d3('0x38')](_0x78d3('0x11d'),_0x78d3('0x11e')+_0x200eef[_0x78d3('0x2f')]+_0x78d3('0x11f'));if(!this[_0x78d3('0x78')](_0x200eef[_0x78d3('0x7a')])){ut['logger'](_0x78d3('0x11d'),_0x200eef[_0x78d3('0x2f')]+_0x78d3('0x120'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x78d3('0x77')](_0x200eef[_0x78d3('0x41')])){ut[_0x78d3('0x38')](_0x78d3('0x121'),_0x200eef[_0x78d3('0x2f')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x78d3('0x11e')+_0x200eef[_0x78d3('0x2f')]+_0x78d3('0x122')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x78d3('0x11')]['execCall']=function(_0x260a3e,_0x359aea,_0x555e8b,_0x3dc235){var _0x27a387=this;return new Promise(function(_0x3b5144,_0x17589f){var _0xd0e604=_0x260a3e[_0x78d3('0x9f')];var _0x2c2416=_0x27a387['isTrunkReachable'](_0x359aea['Trunk'])?util[_0x78d3('0x68')](_0x78d3('0x123'),_0x359aea[_0x78d3('0x79')][_0x78d3('0x2f')],_[_0x78d3('0x46')](_0x359aea[_0x78d3('0x124')])?'':_0x359aea[_0x78d3('0x124')][_0x78d3('0x125')]()||'',_0x359aea[_0x78d3('0x126')]>0x0?_0x555e8b[_0x78d3('0x115')][_0x78d3('0x127')](_0x359aea['dialCutDigit']):_0x555e8b['phone']):util[_0x78d3('0x68')](_0x78d3('0x123'),_[_0x78d3('0x46')](_0x359aea[_0x78d3('0x7a')])?_0x359aea['Trunk']['name']:_0x359aea[_0x78d3('0x7a')]['name'],_[_0x78d3('0x46')](_0x359aea[_0x78d3('0x124')])?'':_0x359aea['dialPrefix']['trim']()||'',_0x359aea[_0x78d3('0x126')]>0x0?_0x555e8b[_0x78d3('0x115')][_0x78d3('0x127')](_0x359aea[_0x78d3('0x126')]):_0x555e8b[_0x78d3('0x115')]);var _0x1f7ed5=_0x27a387['isTrunkReachable'](_0x359aea[_0x78d3('0x79')])?ut[_0x78d3('0x128')](_0x359aea[_0x78d3('0x79')]['callerid'],_0x359aea[_0x78d3('0x129')],_0x359aea['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x78d3('0x12a')](_0x359aea[_0x78d3('0x12b')],_0x359aea[_0x78d3('0x12c')]):_0x359aea['dialOriginateCallerIdNumber']):ut[_0x78d3('0x128')](_['isNil'](_0x359aea[_0x78d3('0x7a')])?_0x359aea[_0x78d3('0x79')][_0x78d3('0x12d')]:_0x359aea[_0x78d3('0x7a')][_0x78d3('0x12d')],_0x359aea[_0x78d3('0x129')],_0x359aea[_0x78d3('0x12c')]>0x0?ut[_0x78d3('0x12a')](_0x359aea[_0x78d3('0x12b')],_0x359aea[_0x78d3('0x12c')]):_0x359aea[_0x78d3('0x12b')]);if(_0x1f7ed5){_0x260a3e[_0x78d3('0x12e')]=ut[_0x78d3('0x12f')](_0x1f7ed5);_0x260a3e[_0x78d3('0x130')]=ut[_0x78d3('0x131')](_0x1f7ed5);}var _0x5c9c55=ut[_0x78d3('0x132')](_0x359aea,_0x555e8b,_0x2c2416,_0x1f7ed5,_0xd0e604,_0x260a3e);var _0x35f93e=utils[_0x78d3('0x133')](_0x555e8b[_0x78d3('0xf8')]);Object[_0x78d3('0x134')](_0x5c9c55,_0x35f93e);_[_0x78d3('0x135')](_0x260a3e,ut[_0x78d3('0x136')](_0x5c9c55));_0x260a3e[_0x78d3('0x67')]=moment()[_0x78d3('0x68')](_0x78d3('0x69'));_0x359aea[_0x78d3('0x137')]=_0x5c9c55;var _0x50bcd6=ut['variablesAction'](_0x260a3e,_0x359aea,_0x5c9c55,_0x260a3e[_0x78d3('0x91')],_0x3dc235);return ami[_0x78d3('0x4f')](_0x50bcd6)[_0x78d3('0x5c')](function(_0x23fd86){_0x359aea[_0x78d3('0x30')]+=0x1;logger[_0x78d3('0x2c')](_0x78d3('0x138'),_0xd0e604,_0x78d3('0x97'),_0x359aea['name'],_0x78d3('0x49'),_0x359aea[_0x78d3('0x30')]);_0x3b5144(_0x23fd86);})[_0x78d3('0x64')](function(_0x332893){ut[_0x78d3('0xef')](_0x260a3e,0xe,_0x78d3('0x139'));rpcDb[_0x78d3('0xee')](_0x260a3e,_0x78d3('0x13a'));_0x17589f(_0x332893);});});};Preview['prototype'][_0x78d3('0x13b')]=function(_0x5c55af){if(this[_0x78d3('0x19')][_0x5c55af[_0x78d3('0xae')]]){this[_0x78d3('0x19')][_0x5c55af[_0x78d3('0xae')]][_0x78d3('0x50')]=_0x5c55af[_0x78d3('0x50')];}};Preview[_0x78d3('0x11')][_0x78d3('0x1c')]=function(_0x1bafa8){var _0x499bc0=this;var _0x40d233=this[_0x78d3('0x19')][_0x1bafa8[_0x78d3('0x13c')]];if(_0x40d233){if(_0x40d233[_0x78d3('0x13d')]&&this[_0x78d3('0x1a')][_0x40d233[_0x78d3('0x13d')]]){ut[_0x78d3('0x13e')](_0x40d233,this[_0x78d3('0x1a')][_0x40d233['lookAgent']][_0x78d3('0x2f')],this[_0x78d3('0x1a')][_0x40d233[_0x78d3('0x13d')]]['id']);}var _0x2efef5=_[_0x78d3('0x13f')](_0x40d233);_0x2efef5[_0x78d3('0x140')]=moment()[_0x78d3('0x68')]('YYYY-MM-DD\x20HH:mm:ss');var _0xefa3f9=_0x499bc0['campaignsPreview'][_0x40d233[_0x78d3('0x4b')]];if(ut[_0x78d3('0x141')](_0x1bafa8[_0x78d3('0x142')])){if(_0x40d233[_0x78d3('0x90')]){rpcDb[_0x78d3('0x10f')](_0x40d233[_0x78d3('0x93')]);}if(_0x40d233['activeContact']){rpcDb[_0x78d3('0x66')](_0x40d233[_0x78d3('0x93')]);}ami[_0x78d3('0x2b')](_0x78d3('0x143'),ut[_0x78d3('0x99')](_0x40d233,_0x78d3('0x144'),this[_0x78d3('0x16')][_0x40d233[_0x78d3('0x4b')]]));this[_0x78d3('0xea')](_0x2efef5,_0xefa3f9,_0x1bafa8);}else{_0x40d233[_0x78d3('0x67')]=moment()[_0x78d3('0x68')](_0x78d3('0x69'));ut['logAgent'](_0x2efef5,0x4,_0x78d3('0xa7'));rpcDb[_0x78d3('0xee')](_0x2efef5,_0x78d3('0x145'));}}};Preview[_0x78d3('0x11')][_0x78d3('0x1e')]=function(_0x1e5bf0){var _0x2c1afa=this['actions'][_0x1e5bf0[_0x78d3('0xae')]];var _0x30abfb;if(_0x2c1afa){_0x30abfb=this[_0x78d3('0x16')][_0x2c1afa['queue']];logger[_0x78d3('0x2c')](_0x78d3('0x146'),_0x1e5bf0[_0x78d3('0xae')],'\x20Queue',_0x30abfb[_0x78d3('0x2f')],_0x78d3('0x98'),_0x30abfb[_0x78d3('0x31')]);}if(this[_0x78d3('0x19')][_0x1e5bf0[_0x78d3('0xae')]]&&_0x1e5bf0[_0x78d3('0xae')]!==_0x1e5bf0[_0x78d3('0x9f')]){if(_0x1e5bf0[_0x78d3('0x147')]==='16'&&this[_0x78d3('0x19')][_0x1e5bf0[_0x78d3('0xae')]][_0x78d3('0x4c')]){this[_0x78d3('0x7d')](_0x1e5bf0,_0x1e5bf0[_0x78d3('0xae')],_0x1e5bf0[_0x78d3('0x147')]);}else if(this[_0x78d3('0x19')][_0x1e5bf0[_0x78d3('0xae')]][_0x78d3('0x4c')]){logger[_0x78d3('0x2c')](_0x78d3('0x148'),_0x1e5bf0[_0x78d3('0xae')],_0x1e5bf0[_0x78d3('0x147')],_0x78d3('0x97'),_0x30abfb[_0x78d3('0x2f')],'pTalking:\x20',_0x30abfb[_0x78d3('0x31')]);this[_0x78d3('0x7d')](_0x1e5bf0,_0x1e5bf0[_0x78d3('0xae')],_0x1e5bf0[_0x78d3('0x147')]);}}else if(_0x2c1afa&&_['isNil'](_0x2c1afa[_0x78d3('0x149')])&&_0x30abfb[_0x78d3('0x14a')]&&_0x1e5bf0['linkedid']===_0x1e5bf0[_0x78d3('0x9f')]&&_[_0x78d3('0x46')](_0x1e5bf0[_0x78d3('0xed')])&&_0x1e5bf0['cause']==='16'&&_0x1e5bf0['channelstate']==='6'&&_['isUndefined'](_0x2c1afa[_0x78d3('0x14b')])){if(_0x2c1afa[_0x78d3('0x90')]){rpcDb['unlockContact'](_0x2c1afa['idContact']);}if(_0x2c1afa['activeContact']){rpcDb[_0x78d3('0x66')](_0x2c1afa[_0x78d3('0x93')]);}_0x1e5bf0[_0x78d3('0xed')]='22';this[_0x78d3('0xea')](_0x2c1afa,_0x30abfb,_0x1e5bf0);}else if(_0x2c1afa&&_0x2c1afa[_0x78d3('0x14b')]){if(_0x1e5bf0['cause']==='16'&&this[_0x78d3('0x19')][_0x1e5bf0[_0x78d3('0xae')]]['dialAnswer']){logger[_0x78d3('0x2c')](_0x78d3('0x14c'),_0x1e5bf0[_0x78d3('0xae')],_0x1e5bf0[_0x78d3('0x147')],'\x20Queue',_0x30abfb[_0x78d3('0x2f')],'pTalking:\x20',_0x30abfb[_0x78d3('0x31')]);this[_0x78d3('0x7d')](_0x1e5bf0,_0x1e5bf0['linkedid'],_0x1e5bf0[_0x78d3('0x147')]);}else if(this['actions'][_0x1e5bf0[_0x78d3('0xae')]][_0x78d3('0x4c')]){logger[_0x78d3('0x2c')](_0x78d3('0x148'),_0x1e5bf0['linkedid'],_0x1e5bf0[_0x78d3('0x147')],_0x78d3('0x97'),_0x30abfb[_0x78d3('0x2f')],_0x78d3('0x98'),_0x30abfb[_0x78d3('0x31')]);this[_0x78d3('0x7d')](_0x1e5bf0,_0x1e5bf0[_0x78d3('0xae')],_0x1e5bf0['cause']);}}};Preview[_0x78d3('0x11')][_0x78d3('0x23')]=function(_0xf58b97){if(this[_0x78d3('0x19')][_0xf58b97[_0x78d3('0xe8')]]&&_0xf58b97[_0x78d3('0xe8')]!==_0xf58b97[_0x78d3('0x14d')]){this[_0x78d3('0x7d')](_0xf58b97,_0xf58b97[_0x78d3('0xe8')],_0xf58b97[_0x78d3('0xda')]);}};Preview['prototype']['syncHangupRequest']=function(_0x377f82){if(this[_0x78d3('0x19')][_0x377f82[_0x78d3('0xae')]]&&_0x377f82[_0x78d3('0xae')]!==_0x377f82['uniqueid']&&!this[_0x78d3('0x19')][_0x377f82[_0x78d3('0xae')]][_0x78d3('0x4c')]){if(_0x377f82['cause']==='1'){this[_0x78d3('0x7d')](_0x377f82,_0x377f82[_0x78d3('0xae')],_0x377f82[_0x78d3('0x147')]);}}};Preview[_0x78d3('0x11')][_0x78d3('0x14e')]=function(_0x5bc953,_0x400e2f,_0x7c7665){if(this[_0x78d3('0x19')][_0x5bc953]){if(_[_0x78d3('0x46')](this[_0x78d3('0x19')][_0x5bc953][_0x78d3('0x137')])){this[_0x78d3('0x19')][_0x5bc953][_0x78d3('0x137')]={};}this[_0x78d3('0x19')][_0x5bc953][_0x78d3('0x137')][_0x400e2f]=_0x7c7665;}};Preview[_0x78d3('0x11')][_0x78d3('0x26')]=function(_0x4a569f){try{if(!_['isNil'](_0x4a569f)){if(ut[_0x78d3('0x14f')](_[_0x78d3('0x150')](_0x4a569f['variable'])[0x0])){this['addVariable'](_0x4a569f[_0x78d3('0x9f')],_[_0x78d3('0x150')](_0x4a569f['variable'])[0x0],_0x4a569f[_0x78d3('0x151')]);}}}catch(_0x3fdbfb){logger[_0x78d3('0x152')]('[syncVarSet][Preview]',util[_0x78d3('0x153')](_0x3fdbfb,{'showHidden':![],'depth':null}));}};Preview[_0x78d3('0x11')][_0x78d3('0x27')]=function(_0x2a5e6f){if(_0x2a5e6f){if(this[_0x78d3('0x19')][_0x2a5e6f[_0x78d3('0x154')]]){this[_0x78d3('0x19')][_0x2a5e6f['transfertargetlinkedid']][_0x78d3('0x14b')]=!![];}}};Preview['prototype'][_0x78d3('0x29')]=function(_0x3f0c09){if(_0x3f0c09){if(this['actions'][_0x3f0c09[_0x78d3('0x155')]]){this[_0x78d3('0x19')][_0x3f0c09[_0x78d3('0x155')]]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x6fe4=['ListId','Action','status','channel','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','decrementTalking','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','agentReadyId','isNil','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','then','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','emit','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','unlockAgent','linkedid','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','buildObj','connect','acw','custom:agentConnectPreview','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','total','[16]','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','BUSY','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','rescheduleContact','activeContact','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','dialGlobalMaxRetry','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','outboundUnknownCallsDay','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','phone','Contact\x20is\x20undefined','lookAgent','execCall','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','pick','unlock','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','isActive','dialActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','dialPrefix','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','logLookAgent','clone','isFailure','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','pTalking:\x20','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','keys','variable','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','../dialer/utils','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','queue','originated:\x20','dialAnswer','UserId','VoiceQueueId'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6fe4,0xfe));var _0x46fe=function(_0x1eac14,_0x5bc36e){_0x1eac14=_0x1eac14-0x0;var _0x71e271=_0x6fe4[_0x1eac14];return _0x71e271;};'use strict';var util=require('util');var _=require('lodash');var uuid=require(_0x46fe('0x0'));var moment=require(_0x46fe('0x1'));var Redis=require(_0x46fe('0x2'));var config=require(_0x46fe('0x3'));var logger=require(_0x46fe('0x4'))(_0x46fe('0x5'));var loggerAction=require(_0x46fe('0x4'))(_0x46fe('0x6'));var ami=require(_0x46fe('0x7'));var rpcDb=require(_0x46fe('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x46fe('0x9'));var ut=require('./util/util');var utils=require(_0x46fe('0xa'));config['redis']=_[_0x46fe('0xb')](config[_0x46fe('0xc')],{'host':_0x46fe('0xd'),'port':0x18eb});var io=require(_0x46fe('0xe'))(new Redis(config[_0x46fe('0xc')]));var Sequence=function(){};Sequence[_0x46fe('0xf')][_0x46fe('0x10')]=function(_0x42c502){this[_0x46fe('0x11')]=this[_0x46fe('0x11')]?this['tail'][_0x46fe('0x12')](_0x42c502):_0x42c502();};function Preview(_0x1f1aa7){this[_0x46fe('0x13')]=new Sequence();this[_0x46fe('0x14')]=_0x1f1aa7[_0x46fe('0x15')];this[_0x46fe('0x16')]=_0x1f1aa7[_0x46fe('0x16')];this[_0x46fe('0x17')]={};this[_0x46fe('0x18')]=_0x1f1aa7[_0x46fe('0x18')];this[_0x46fe('0x19')]=0x0;ami['on'](_0x46fe('0x1a'),this[_0x46fe('0x1b')][_0x46fe('0x1c')](this));ami['on'](_0x46fe('0x1d'),this[_0x46fe('0x1e')][_0x46fe('0x1c')](this));ami['on'](_0x46fe('0x1f'),this[_0x46fe('0x20')][_0x46fe('0x1c')](this));ami['on'](_0x46fe('0x21'),this[_0x46fe('0x22')][_0x46fe('0x1c')](this));ami['on'](_0x46fe('0x23'),this['syncNewExten'][_0x46fe('0x1c')](this));ami['on']('varset',this[_0x46fe('0x24')][_0x46fe('0x1c')](this));ami['on'](_0x46fe('0x25'),this[_0x46fe('0x26')][_0x46fe('0x1c')](this));ami['on'](_0x46fe('0x27'),this[_0x46fe('0x28')][_0x46fe('0x1c')](this));this[_0x46fe('0x29')](this['campaignsPreview']);}function emit(_0x25aa14,_0x4ca99c,_0x23eaad){io['to'](_0x25aa14)['emit'](_0x4ca99c,_0x23eaad);}function emitVoiceQueueChannelRemove(_0x14e23a){logger[_0x46fe('0x2a')](_0x46fe('0x2b'),JSON[_0x46fe('0x2c')](_0x14e23a));emit(util[_0x46fe('0x2d')](_0x46fe('0x2e'),_0x14e23a[_0x46fe('0x2f')]),'voice_queue_channel:remove',_0x14e23a);io['emit'](_0x46fe('0x30'),_0x14e23a);}function notSendMessagesQueue(_0x32db76){if(_0x32db76[_0x46fe('0x31')]){if(_0x32db76[_0x46fe('0x32')]===0x0&&_0x32db76[_0x46fe('0x33')]===0x0){_0x32db76[_0x46fe('0x31')]=![];_0x32db76[_0x46fe('0x34')]=0x0;_0x32db76[_0x46fe('0x35')]=0x0;_0x32db76[_0x46fe('0x36')]=utils[_0x46fe('0x37')][_0x46fe('0x38')];ut[_0x46fe('0x39')](_0x46fe('0x3a'),_0x32db76[_0x46fe('0x2f')]+_0x46fe('0x3b'));}else{_0x32db76[_0x46fe('0x36')]=utils[_0x46fe('0x37')][_0x46fe('0x3c')];ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x32db76[_0x46fe('0x2f')]+'\x20is\x20deactivated');}}}Preview[_0x46fe('0xf')]['loopCampaigns']=function(){var _0x79b08b=this;setInterval(function(){_0x79b08b[_0x46fe('0x3d')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x37730d=this[_0x46fe('0x14')];this['clockClearZombieChannels']+=0x1;for(var _0x1f9d55 in _0x37730d){if(_0x37730d[_0x46fe('0x3e')](_0x1f9d55)&&(_0x37730d[_0x1f9d55][_0x46fe('0x3f')]===_0x46fe('0x5')||_0x37730d[_0x1f9d55][_0x46fe('0x3f')]===_0x46fe('0x40'))&&_0x37730d[_0x1f9d55][_0x46fe('0x41')]===_0x46fe('0x42')){if(this[_0x46fe('0x19')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x37730d['hasOwnProperty'](_0x1f9d55)&&_0x37730d[_0x1f9d55][_0x46fe('0x3f')]===_0x46fe('0x5')&&_0x37730d[_0x1f9d55][_0x46fe('0x41')]===_0x46fe('0x42')){if(_0x37730d[_0x1f9d55]['dialActive']){this[_0x46fe('0x43')](_0x37730d[_0x1f9d55]);if(_0x37730d[_0x1f9d55][_0x46fe('0x44')])this[_0x46fe('0x45')](_0x37730d[_0x1f9d55]);}else{notSendMessagesQueue(_0x37730d[_0x1f9d55]);}}}};Preview[_0x46fe('0xf')][_0x46fe('0x46')]=function(_0xa62070){var _0x58cabc=this;this[_0x46fe('0x13')][_0x46fe('0x10')](function(){if(!_['isNil'](_0x58cabc[_0x46fe('0x17')][_0xa62070])){loggerAction[_0x46fe('0x2a')](_0x46fe('0x47'),_0xa62070,_0x46fe('0x48'),_0x58cabc[_0x46fe('0x17')][_0xa62070][_0x46fe('0x49')],_0x46fe('0x4a'),JSON['stringify'](_0x58cabc[_0x46fe('0x14')][_0x58cabc['actions'][_0xa62070]['queue']][_0x46fe('0x32')]),'pTalking:\x20',JSON[_0x46fe('0x2c')](_0x58cabc[_0x46fe('0x14')][_0x58cabc[_0x46fe('0x17')][_0xa62070][_0x46fe('0x49')]]['pTalking']),JSON['stringify'](_0x58cabc[_0x46fe('0x17')][_0xa62070][_0x46fe('0x4b')]),JSON[_0x46fe('0x2c')](_['pick'](_0x58cabc[_0x46fe('0x17')][_0xa62070],['contactId',_0x46fe('0x4c'),_0x46fe('0x4d'),_0x46fe('0x4e')])));return ami[_0x46fe('0x4f')]({'action':_0x46fe('0x50'),'channel':_0x58cabc[_0x46fe('0x17')][_0xa62070][_0x46fe('0x51')]})[_0x46fe('0x52')](function(_0x235d60){if(_0x235d60['message']===_0x46fe('0x53')){setTimeout(function(){if(_0x58cabc[_0x46fe('0x17')][_0xa62070]){utils[_0x46fe('0x54')](_0x58cabc[_0x46fe('0x14')][_0x58cabc[_0x46fe('0x17')][_0xa62070][_0x46fe('0x49')]],_0x46fe('0x55'));if(_0x58cabc[_0x46fe('0x17')][_0xa62070][_0x46fe('0x4b')]===!![]){ut[_0x46fe('0x56')](_0x58cabc[_0x46fe('0x14')][_0x58cabc['actions'][_0xa62070]['queue']],_0x46fe('0x55'));ut[_0x46fe('0x57')](_0x46fe('0x58')+_0xa62070,_0x58cabc['actions'][_0xa62070][_0x46fe('0x49')]);}ut[_0x46fe('0x57')](_0x46fe('0x59')+_0xa62070,_0x58cabc[_0x46fe('0x17')][_0xa62070][_0x46fe('0x49')]);delete _0x58cabc[_0x46fe('0x17')][_0xa62070];}},0x2328);}});}});};Preview[_0x46fe('0xf')][_0x46fe('0x5a')]=function(){var _0x53c430=this;loggerAction[_0x46fe('0x2a')]('[action]',_['size'](this[_0x46fe('0x17')]));for(var _0x1ec8ae in this['actions']){if(_0x53c430[_0x46fe('0x17')][_0x46fe('0x3e')](_0x1ec8ae)){_0x53c430['clearZombieChannel'](_0x1ec8ae);}}};Preview[_0x46fe('0xf')][_0x46fe('0x45')]=function(_0x126e48){var _0x2f5df3=this;rpcDb['getContactRecallMe'](_0x126e48['id'],ut[_0x46fe('0x5b')](this[_0x46fe('0x18')]))['then'](function(_0x2a2749){if(!_[_0x46fe('0x5c')](_0x2a2749)){for(var _0x37e411=0x0;_0x37e411<_0x2a2749['length'];_0x37e411+=0x1){if(ut['getDiff'](_0x2a2749[_0x37e411][_0x46fe('0x5d')])<_0x126e48[_0x46fe('0x5e')]*0x3c){if(_0x2a2749[_0x37e411][_0x46fe('0x5f')]&&!_0x2a2749[_0x37e411]['Agent'][_0x46fe('0x60')]){_0x2f5df3[_0x46fe('0x61')](_0x2a2749[_0x37e411]['id'])[_0x46fe('0x62')](ut[_0x46fe('0x63')](_0x46fe('0x64')))[_0x46fe('0x52')](ut[_0x46fe('0x63')](_0x46fe('0x64')));}else{rpcDb[_0x46fe('0x65')](_0x2a2749[_0x37e411]['id']);}}else{var _0x57ccc8=new Action(_0x2a2749[_0x37e411],_0x126e48);_0x57ccc8[_0x46fe('0x66')]=moment()['format'](_0x46fe('0x67'));_0x126e48['outboundReCallsDay']+=0x1;ut[_0x46fe('0x68')](_0x57ccc8,0x17,_0x46fe('0x69'));if(_0x126e48[_0x46fe('0x6a')]){rpcDb[_0x46fe('0x6b')](ut['createBody'](_0x2a2749[_0x37e411]));rpcDb['createCustomerHistory'](_0x57ccc8,_0x46fe('0x6c'));}else{ut[_0x46fe('0x68')](_0x57ccc8,0x16,_0x46fe('0x6d'));rpcDb[_0x46fe('0x6e')](_0x57ccc8,'[HistoryRecallClose]');rpcDb[_0x46fe('0x6f')](_0x57ccc8,_0x46fe('0x70'));}}}}})[_0x46fe('0x52')](ut[_0x46fe('0x63')](_0x46fe('0x71')));};Preview[_0x46fe('0xf')][_0x46fe('0x43')]=function(_0x321794){_0x321794[_0x46fe('0x31')]=!![];if(ut[_0x46fe('0x72')](_0x321794[_0x46fe('0x73')])){_0x321794['message']=utils[_0x46fe('0x37')][_0x46fe('0x74')];}else if(!ut['isActive'](_0x321794['dialActive'])){_0x321794[_0x46fe('0x36')]=utils['CAMPAIGN_STATUS'][_0x46fe('0x38')];}else if(!this[_0x46fe('0x75')](_0x321794[_0x46fe('0x76')])){if(!this[_0x46fe('0x75')](_0x321794[_0x46fe('0x77')])){_0x321794[_0x46fe('0x36')]=utils[_0x46fe('0x37')][_0x46fe('0x78')];}else{_0x321794['message']=utils[_0x46fe('0x37')][_0x46fe('0x79')];}}else{_0x321794[_0x46fe('0x36')]=utils[_0x46fe('0x37')][_0x46fe('0x79')];}};Preview[_0x46fe('0xf')]['callProgressDetectingCustomer']=function(_0x2bdec8,_0x208dd2,_0xdd6c6a){var _0x1dcecf=this;var _0x1f4c7c=this[_0x46fe('0x17')][_0x208dd2];var _0xdac075=this[_0x46fe('0x14')][_0x1f4c7c['queue']];var _0x91fcd8;var _0x21761b=![];var _0x33b338=0x2;var _0xd35c69=0x3;if(_0xdac075){switch(_0xdd6c6a){case'1':_0xdac075[_0x46fe('0x7a')]+=0x1;_0x1f4c7c[_0x46fe('0x7b')]+=0x1;_0x1f4c7c[_0x46fe('0x7c')]=ut[_0x46fe('0x7d')](_0x1f4c7c);ut[_0x46fe('0x68')](_0x1f4c7c,0x0,_0x46fe('0x7e'));ami[_0x46fe('0x7f')]('custom:agentnosuchnumber',ut['buildObj'](_0x1f4c7c,_0x46fe('0x80')));rpcDb[_0x46fe('0x6e')](_0x1f4c7c,_0x46fe('0x81'));_0x1dcecf[_0x46fe('0x82')](_0x1f4c7c,'0',_0xdac075)['then'](function(_0x26b009){_0x21761b=_0x26b009[_0x46fe('0x83')]==0x1;_0x33b338=_0xdac075[_0x46fe('0x84')];_0xd35c69=_0xdac075[_0x46fe('0x85')];if(!_0x21761b){if(ut[_0x46fe('0x7d')](_0x1f4c7c)>=_0xdac075['dialGlobalMaxRetry']){_0x91fcd8=ut[_0x46fe('0x86')](_0x1f4c7c,0xf,_0x46fe('0x87'));rpcDb[_0x46fe('0x6f')](_0x91fcd8,_0x46fe('0x88'));}else{if(_0x1f4c7c['countnosuchnumberretry']>=_0xdac075['dialNoSuchNumberMaxRetry']){rpcDb[_0x46fe('0x6f')](_0x1f4c7c,_0x46fe('0x88'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x1f4c7c,_0x46fe('0x7b'),_0xdac075[_0x46fe('0x84')]),_0x1f4c7c[_0x46fe('0x89')],_0x1f4c7c['activeContact']);}}delete this[_0x46fe('0x17')][_0x2bdec8[_0x46fe('0x8a')]];}else{_0x1f4c7c[_0x46fe('0x7b')]++;logger[_0x46fe('0x2a')]('actioncountonusuch',_0x1f4c7c[_0x46fe('0x7b')]);logger['info']('id',_0x1f4c7c[_0x46fe('0x8b')]);_0x1dcecf[_0x46fe('0x8c')]({'id':_0x1f4c7c[_0x46fe('0x8b')],'field':{'countnosuchnumberretry':_0x1f4c7c['countnosuchnumberretry']}})['then'](function(){_0x1dcecf[_0x46fe('0x8d')](_0x1f4c7c,_0x33b338,_0xd35c69)[_0x46fe('0x62')](function(){});});}});break;case _0x46fe('0x8e'):var _0x4d04e4=moment()[_0x46fe('0x2d')](_0x46fe('0x67'));_0x1f4c7c[_0x46fe('0x8f')]=_0x4d04e4;_0x1f4c7c[_0x46fe('0x90')]=_0x4d04e4;_0x1f4c7c[_0x46fe('0x4b')]=!![];_0xdac075[_0x46fe('0x33')]+=0x1;logger['info'](_0x46fe('0x91'),_0x1f4c7c[_0x46fe('0x92')],_0x46fe('0x93'),_0xdac075[_0x46fe('0x2f')],'pTalking:\x20',_0xdac075[_0x46fe('0x33')]);ami[_0x46fe('0x7f')]('custom:agentconnect',ut[_0x46fe('0x94')](_0x1f4c7c,_0x46fe('0x95'),this[_0x46fe('0x14')][_0x1f4c7c['queue']]));if(_0xdac075[_0x46fe('0x96')]||_0xdac075['mandatoryDisposition']){ami[_0x46fe('0x7f')](_0x46fe('0x97'),{'queue':_0x1f4c7c['queue'],'interface':_0x1f4c7c[_0x46fe('0x98')],'uniqueid':_0x1f4c7c[_0x46fe('0x92')]});}break;case'16':ami['emit'](_0x46fe('0x99'),ut[_0x46fe('0x94')](_0x1f4c7c,'complete',this['campaignsPreview'][_0x1f4c7c['queue']]));emitVoiceQueueChannelRemove(ut[_0x46fe('0x94')](_0x1f4c7c,_0x46fe('0x9a')));_0xdac075[_0x46fe('0x9b')]+=0x1;_0xdac075[_0x46fe('0x9c')]+=0x1;_0xdac075['answered']+=0x1;ut[_0x46fe('0x56')](_0xdac075,_0x46fe('0x9d'));_0x1f4c7c[_0x46fe('0x7c')]=ut[_0x46fe('0x7d')](_0x1f4c7c);ut['logCustomer'](_0x1f4c7c,0x4,'Answer');rpcDb[_0x46fe('0x6e')](_0x1f4c7c,_0x46fe('0x9e'));rpcDb[_0x46fe('0x6f')](_0x1f4c7c,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x46fe('0x9f')](_0x1f4c7c);_0xdac075[_0x46fe('0xa0')]+=_0x1f4c7c[_0x46fe('0xa1')];_0xdac075[_0x46fe('0xa2')]+=_0x1f4c7c[_0x46fe('0xa1')];logger[_0x46fe('0x2a')]('[syncHangup][talking][decrement]',_0x1f4c7c['uniqueid'],_0x46fe('0x93'),_0xdac075[_0x46fe('0x2f')],'pTalking:\x20',_0xdac075['pTalking']);delete this[_0x46fe('0x17')][_0x2bdec8[_0x46fe('0x8a')]];break;case _0x46fe('0xa3'):_0xdac075['outboundBusyCallsDay']+=0x1;_0x1f4c7c['countbusyretry']+=0x1;_0x1f4c7c[_0x46fe('0x7c')]=ut[_0x46fe('0x7d')](_0x1f4c7c);ut['logCustomer'](_0x1f4c7c,0x5,_0x46fe('0xa4'));_0x33b338=_0xdac075['dialBusyRetryFrequency'];_0xd35c69=_0xdac075[_0x46fe('0x85')];ami[_0x46fe('0x7f')](_0x46fe('0xa5'),ut[_0x46fe('0x94')](_0x1f4c7c,_0x46fe('0xa6')));rpcDb[_0x46fe('0x6e')](_0x1f4c7c,_0x46fe('0xa7'));_0x1dcecf[_0x46fe('0x82')](_0x1f4c7c,'5',_0xdac075)[_0x46fe('0x62')](function(_0x164516){_0x21761b=_0x164516[_0x46fe('0x83')]==0x1;if(!_0x21761b){if(ut[_0x46fe('0x7d')](_0x1f4c7c)>=_0xdac075['dialGlobalMaxRetry']){_0x91fcd8=ut[_0x46fe('0x86')](_0x1f4c7c,0xf,_0x46fe('0x87'));rpcDb[_0x46fe('0x6f')](_0x91fcd8,_0x46fe('0xa8'));}else{if(_0x1f4c7c[_0x46fe('0xa9')]>=_0xdac075[_0x46fe('0xaa')]){rpcDb[_0x46fe('0x6f')](_0x1f4c7c,_0x46fe('0xa7'));}else{rpcDb['rescheduleContact'](ut[_0x46fe('0xab')](_0x1f4c7c,_0x46fe('0xa9'),_0xdac075[_0x46fe('0xac')]),_0x1f4c7c['unlockAgent'],_0x1f4c7c['activeContact']);}}}else{_0x1f4c7c['countbusyretry']++;_0x1dcecf[_0x46fe('0x8c')]({'id':_0x1f4c7c['idContact'],'field':{'countbusyretry':_0x1f4c7c[_0x46fe('0xa9')]}})[_0x46fe('0x62')](function(){_0x1dcecf[_0x46fe('0x8d')](_0x1f4c7c,_0x33b338,_0xd35c69)['then'](function(){});});}});break;case _0x46fe('0xad'):_0xdac075[_0x46fe('0xae')]+=0x1;_0x1f4c7c[_0x46fe('0xaf')]+=0x1;_0x1f4c7c[_0x46fe('0x7c')]=ut['totalGlobal'](_0x1f4c7c);ut[_0x46fe('0x68')](_0x1f4c7c,0x3,'NoAnswer');_0x33b338=_0xdac075[_0x46fe('0xb0')];_0xd35c69=_0xdac075[_0x46fe('0x85')];var _0x4ac05a=ut[_0x46fe('0xb1')](_0x1f4c7c,_0xdac075);ami[_0x46fe('0x7f')]('custom:agentnoanswer',_0x4ac05a);rpcDb[_0x46fe('0x6e')](_0x1f4c7c,_0x46fe('0xb2'));_0x1dcecf['verifyAdditionalPhones'](_0x1f4c7c,'3',_0xdac075)['then'](function(_0x5e37c6){_0x21761b=_0x5e37c6['additional']==0x1;if(!_0x21761b){if(ut[_0x46fe('0x7d')](_0x1f4c7c)>=_0xdac075['dialGlobalMaxRetry']){_0x91fcd8=ut[_0x46fe('0x86')](_0x1f4c7c,0xf,_0x46fe('0x87'));rpcDb[_0x46fe('0x6f')](_0x91fcd8,_0x46fe('0xb3'));}else{if(_0x1f4c7c['countnoanswerretry']>=_0xdac075[_0x46fe('0xb4')]){rpcDb['createCustomerFinal'](_0x1f4c7c,_0x46fe('0xb2'));}else{rpcDb[_0x46fe('0xb5')](ut[_0x46fe('0xab')](_0x1f4c7c,'countnoanswerretry',_0xdac075[_0x46fe('0xb0')]),_0x1f4c7c[_0x46fe('0x89')],_0x1f4c7c[_0x46fe('0xb6')]);}}}else{_0x1f4c7c[_0x46fe('0xaf')]++;_0x1dcecf[_0x46fe('0x8c')]({'id':_0x1f4c7c[_0x46fe('0x8b')],'field':{'countnoanswerretry':_0x1f4c7c[_0x46fe('0xaf')]}})[_0x46fe('0x62')](function(){_0x1dcecf['swapAdditionalPhones'](_0x1f4c7c,_0x33b338,_0xd35c69)[_0x46fe('0x62')](function(){});});}});break;case'CONGESTION':_0xdac075[_0x46fe('0xb7')]+=0x1;_0x1f4c7c[_0x46fe('0xb8')]+=0x1;_0x1f4c7c[_0x46fe('0x7c')]=ut[_0x46fe('0x7d')](_0x1f4c7c);ut['logCustomer'](_0x1f4c7c,0x8,_0x46fe('0xb9'));_0x33b338=_0xdac075[_0x46fe('0xba')];_0xd35c69=_0xdac075[_0x46fe('0x85')];ami[_0x46fe('0x7f')](_0x46fe('0xbb'),ut[_0x46fe('0x94')](_0x1f4c7c,_0x46fe('0xbc')));rpcDb['createCustomerHistory'](_0x1f4c7c,'[callProgressDetectingCustomer][logCongestion]');_0x1dcecf[_0x46fe('0x82')](_0x1f4c7c,'8',_0xdac075)['then'](function(_0x33cc22){_0x21761b=_0x33cc22[_0x46fe('0x83')]==0x1;if(!_0x21761b){if(ut[_0x46fe('0x7d')](_0x1f4c7c)>=_0xdac075[_0x46fe('0xbd')]){_0x91fcd8=ut[_0x46fe('0x86')](_0x1f4c7c,0xf,_0x46fe('0x87'));rpcDb[_0x46fe('0x6f')](_0x91fcd8,_0x46fe('0xbe'));}else{if(_0x1f4c7c['countcongestionretry']>=_0xdac075[_0x46fe('0xbf')]){rpcDb[_0x46fe('0x6f')](_0x1f4c7c,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x46fe('0xb5')](ut[_0x46fe('0xab')](_0x1f4c7c,_0x46fe('0xb8'),_0xdac075[_0x46fe('0xac')]),_0x1f4c7c['unlockAgent'],_0x1f4c7c[_0x46fe('0xb6')]);}}}else{_0x1f4c7c[_0x46fe('0xb8')]++;_0x1dcecf[_0x46fe('0x8c')]({'id':_0x1f4c7c[_0x46fe('0x8b')],'field':{'countcongestionretry':_0x1f4c7c['countcongestionretry']}})['then'](function(){_0x1dcecf[_0x46fe('0x8d')](_0x1f4c7c,_0x33b338,_0xd35c69)[_0x46fe('0x62')](function(){});});}});break;case _0x46fe('0xc0'):_0xdac075[_0x46fe('0xc1')]+=0x1;_0x1f4c7c['countagentrejectretry']+=0x1;_0x1f4c7c[_0x46fe('0x7c')]=ut['totalGlobal'](_0x1f4c7c);ut[_0x46fe('0x68')](_0x1f4c7c,0x14,_0x46fe('0xc2'));_0x33b338=_0xdac075[_0x46fe('0xc3')];_0xd35c69=_0xdac075[_0x46fe('0x85')];ami['emit'](_0x46fe('0xc4'),ut[_0x46fe('0x94')](_0x1f4c7c,_0x46fe('0xc5')));rpcDb['createCustomerHistory'](_0x1f4c7c,_0x46fe('0xc6'));_0x1dcecf[_0x46fe('0x82')](_0x1f4c7c,'20',_0xdac075)[_0x46fe('0x62')](function(_0x200b5b){_0x21761b=_0x200b5b['additional']==0x1;if(!_0x21761b){if(ut[_0x46fe('0x7d')](_0x1f4c7c)>=_0xdac075[_0x46fe('0xbd')]){_0x91fcd8=ut['cloneAction'](_0x1f4c7c,0x14,_0x46fe('0xc2'));rpcDb[_0x46fe('0x6f')](_0x91fcd8,_0x46fe('0xc7'));}else{if(_0x1f4c7c[_0x46fe('0xc8')]>=_0xdac075['dialAgentRejectMaxRetry']){rpcDb[_0x46fe('0x6f')](_0x1f4c7c,_0x46fe('0xc7'));}else{rpcDb[_0x46fe('0xb5')](ut['scheduledAt'](_0x1f4c7c,_0x46fe('0xc8'),_0xdac075[_0x46fe('0xc3')]),_0x1f4c7c[_0x46fe('0x89')],_0x1f4c7c[_0x46fe('0xb6')]);}}}else{_0x1f4c7c[_0x46fe('0xaf')]++;_0x1dcecf[_0x46fe('0x8c')]({'id':_0x1f4c7c[_0x46fe('0x8b')],'field':{'countnoanswerretry':_0x1f4c7c[_0x46fe('0xaf')]}})[_0x46fe('0x62')](function(){_0x1dcecf[_0x46fe('0x8d')](_0x1f4c7c,_0x33b338,_0xd35c69)['then'](function(){});});}});break;case'ABANDONED':_0xdac075['outboundAbandonedCallsDay']+=0x1;_0x1f4c7c[_0x46fe('0xc9')]+=0x1;_0x1f4c7c['countglobal']=ut[_0x46fe('0x7d')](_0x1f4c7c);ut[_0x46fe('0x68')](_0x1f4c7c,0xb,_0x46fe('0xca'));rpcDb[_0x46fe('0x6e')](_0x1f4c7c,_0x46fe('0xcb'));_0x1dcecf[_0x46fe('0x82')](_0x1f4c7c,'11',_0xdac075)['then'](function(_0x105c74){_0x21761b=_0x105c74[_0x46fe('0x83')]==0x1;if(!_0x21761b){if(ut[_0x46fe('0x7d')](_0x1f4c7c)>=_0xdac075['dialGlobalMaxRetry']){_0x91fcd8=ut['cloneAction'](_0x1f4c7c,0xf,_0x46fe('0x87'));rpcDb['createCustomerFinal'](_0x91fcd8,_0x46fe('0xcb'));}else{if(_0x1f4c7c[_0x46fe('0xcc')]>=_0xdac075[_0x46fe('0xcd')]){rpcDb[_0x46fe('0x6f')](_0x1f4c7c,_0x46fe('0xcb'));}else{rpcDb[_0x46fe('0xb5')](ut['scheduledAt'](_0x1f4c7c,_0x46fe('0xc9'),_0xdac075[_0x46fe('0xce')]),_0x1f4c7c[_0x46fe('0x89')],_0x1f4c7c[_0x46fe('0xb6')]);}}}else{_0x1f4c7c[_0x46fe('0xaf')]++;_0x1dcecf['incrementPreviewCounters']({'id':_0x1f4c7c[_0x46fe('0x8b')],'field':{'countnoanswerretry':_0x1f4c7c[_0x46fe('0xaf')]}})[_0x46fe('0x62')](function(){_0x1dcecf['swapAdditionalPhones'](_0x1f4c7c,_0x33b338,_0xd35c69)[_0x46fe('0x62')](function(){});});}});break;case'18':_0xdac075['outboundUnknownCallsDay']+=0x1;_0x1f4c7c['countmachineretry']+=0x1;_0x1f4c7c[_0x46fe('0x7c')]=ut[_0x46fe('0x7d')](_0x1f4c7c);ut[_0x46fe('0x68')](_0x1f4c7c,0x12,_0x2bdec8[_0x46fe('0xcf')]||_0x2bdec8[_0x46fe('0xd0')]);ami[_0x46fe('0x7f')](_0x46fe('0xd1'),ut['buildObj'](_0x1f4c7c,_0x46fe('0xd2')));rpcDb[_0x46fe('0x6e')](_0x1f4c7c,'[callProgressDetectingCustomer][hangupInAMD]');_0x1dcecf['verifyAdditionalPhones'](_0x1f4c7c,'18',_0xdac075)[_0x46fe('0x62')](function(_0x46e3a8){_0x21761b=_0x46e3a8['additional']==0x1;if(!_0x21761b){if(ut['totalGlobal'](_0x1f4c7c)>=_0xdac075['dialGlobalMaxRetry']){_0x91fcd8=ut[_0x46fe('0x86')](_0x1f4c7c,0x12,'Global');rpcDb[_0x46fe('0x6f')](_0x91fcd8,_0x46fe('0xd3'));}else{rpcDb[_0x46fe('0x6f')](_0x1f4c7c,_0x46fe('0xd3'));}}else{_0x1f4c7c['countnoanswerretry']++;_0x1dcecf['incrementPreviewCounters']({'id':_0x1f4c7c[_0x46fe('0x8b')],'field':{'countnoanswerretry':_0x1f4c7c['countnoanswerretry']}})[_0x46fe('0x62')](function(){_0x1dcecf['swapAdditionalPhones'](_0x1f4c7c,_0x33b338,_0xd35c69)[_0x46fe('0x62')](function(){});});}});delete this[_0x46fe('0x17')][_0x2bdec8['linkedid']];break;case'19':_0xdac075['outboundUnknownCallsDay']+=0x1;_0x1f4c7c['countglobal']=ut['totalGlobal'](_0x1f4c7c);ut[_0x46fe('0x68')](_0x1f4c7c,0x13,_0x2bdec8[_0x46fe('0xcf')]||_0x2bdec8['dialstatus']);ami[_0x46fe('0x7f')](_0x46fe('0xd1'),ut[_0x46fe('0x94')](_0x1f4c7c,_0x46fe('0xd2')));rpcDb[_0x46fe('0x6e')](_0x1f4c7c,_0x46fe('0xd4'));_0x1dcecf[_0x46fe('0x82')](_0x1f4c7c,'18',_0xdac075)[_0x46fe('0x62')](function(_0x2cab2c){_0x21761b=_0x2cab2c[_0x46fe('0x83')]==0x1;if(!_0x21761b){if(ut['totalGlobal'](_0x1f4c7c)>=_0xdac075[_0x46fe('0xbd')]){_0x91fcd8=ut[_0x46fe('0x86')](_0x1f4c7c,0xf,'Global');rpcDb[_0x46fe('0x6f')](_0x91fcd8,_0x46fe('0xd4'));}else{rpcDb[_0x46fe('0x6f')](_0x1f4c7c,_0x46fe('0xd4'));}}else{_0x1f4c7c[_0x46fe('0xaf')]++;_0x1dcecf['incrementPreviewCounters']({'id':_0x1f4c7c[_0x46fe('0x8b')],'field':{'countnoanswerretry':_0x1f4c7c[_0x46fe('0xaf')]}})[_0x46fe('0x62')](function(){_0x1dcecf[_0x46fe('0x8d')](_0x1f4c7c,_0x33b338,_0xd35c69)[_0x46fe('0x62')](function(){});});}});delete this[_0x46fe('0x17')][_0x2bdec8[_0x46fe('0x8a')]];break;default:if(_0x1f4c7c[_0x46fe('0x4b')]){ut[_0x46fe('0x56')](_0xdac075,_0x46fe('0xd5'));ut[_0x46fe('0x57')](_0x46fe('0xd6')+_0xdac075[_0x46fe('0x2f')],_0x2bdec8);}_0xdac075[_0x46fe('0xd7')]+=0x1;_0x1f4c7c['countglobal']=ut[_0x46fe('0x7d')](_0x1f4c7c);ut[_0x46fe('0x68')](_0x1f4c7c,0xc,_0x2bdec8[_0x46fe('0xcf')]||_0x2bdec8[_0x46fe('0xd0')]);_0x33b338=_0xdac075[_0x46fe('0xc3')];_0xd35c69=_0xdac075['callAdditionalPhoneAfterMin'];rpcDb[_0x46fe('0x6e')](_0x1f4c7c,_0x46fe('0xd8'));_0x1dcecf[_0x46fe('0x82')](_0x1f4c7c,'20',_0xdac075)[_0x46fe('0x62')](function(_0x511582){_0x21761b=_0x511582[_0x46fe('0x83')]==0x1;if(!_0x21761b){if(ut[_0x46fe('0x7d')](_0x1f4c7c)>=_0xdac075[_0x46fe('0xbd')]){_0x91fcd8=ut[_0x46fe('0x86')](_0x1f4c7c,0xf,_0x46fe('0x87'));rpcDb[_0x46fe('0x6f')](_0x91fcd8,_0x46fe('0xd9'));}else{rpcDb[_0x46fe('0x6f')](_0x1f4c7c,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x46fe('0x17')][_0x2bdec8[_0x46fe('0x8a')]];}else{_0x1dcecf[_0x46fe('0x8d')](_0x1f4c7c,_0x33b338,_0xd35c69)[_0x46fe('0x62')](function(){});}});}if(!(_0x1f4c7c[_0x46fe('0x4b')]&&_0xdd6c6a==='16')){utils[_0x46fe('0x54')](_0xdac075,_0x46fe('0xda'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x1f4c7c[_0x46fe('0x92')],_0x46fe('0x93'),_0xdac075[_0x46fe('0x2f')],_0x46fe('0x4a'),_0xdac075[_0x46fe('0x32')]);}if(_0xdd6c6a!==_0x46fe('0x8e')){delete this[_0x46fe('0x17')][_0x2bdec8[_0x46fe('0x8a')]];delete this[_0x46fe('0x17')][_0x2bdec8[_0x46fe('0xdb')]];}_0xdac075['queueSummaryCountersUpdated']=!![];}};Preview[_0x46fe('0xf')][_0x46fe('0xdc')]=function(_0x447c10,_0x420527,_0x238096){if(_[_0x46fe('0xdd')](_0x420527)&&_0x46fe('0xde')!==typeof _0x420527){return;}if(_[_0x46fe('0xdd')](_0x238096)&&_0x46fe('0xde')!==typeof _0x238096){return;}switch(_0x238096[_0x46fe('0xdf')]){case'0':ut[_0x46fe('0xe0')](_0x447c10,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x447c10,_0x46fe('0xe1'));break;case'3':ut[_0x46fe('0xe0')](_0x447c10,0x3,_0x46fe('0xe2'));rpcDb[_0x46fe('0xe3')](_0x447c10,_0x46fe('0xe4'));break;case'5':ut[_0x46fe('0xe0')](_0x447c10,0x5,_0x46fe('0xa4'));rpcDb['createAgentHistory'](_0x447c10,_0x46fe('0xe5'));break;case'8':ut[_0x46fe('0xe0')](_0x447c10,0x8,_0x46fe('0xb9'));rpcDb['createAgentHistory'](_0x447c10,_0x46fe('0xe6'));break;case'22':ut[_0x46fe('0xe0')](_0x447c10,0x16,_0x46fe('0xe7'));rpcDb[_0x46fe('0xe3')](_0x447c10,_0x46fe('0xe8'));break;default:ut[_0x46fe('0xe0')](_0x447c10,0xc,_0x238096[_0x46fe('0xdf')]);rpcDb[_0x46fe('0xe3')](_0x447c10,_0x46fe('0xe6'));}utils[_0x46fe('0x54')](_0x420527,_0x46fe('0xe9'));logger[_0x46fe('0x2a')](_0x46fe('0xea'),_0x447c10[_0x46fe('0x92')],'\x20Queue',_0x420527[_0x46fe('0x2f')],'originated:\x20',_0x420527[_0x46fe('0x32')]);delete this['actions'][_0x447c10[_0x46fe('0x92')]];};Preview[_0x46fe('0xf')][_0x46fe('0x82')]=function(_0x3ca52f,_0x192d78,_0x523060){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x3ca52f,_0x192d78,_0x523060)[_0x46fe('0x52')](logger[_0x46fe('0x2a')](_0x46fe('0xeb')));};Preview[_0x46fe('0xf')]['swapAdditionalPhones']=function(_0x1e3932,_0x54374c,_0x8ba8f2){return cmHopperAdditionalPhone[_0x46fe('0x8d')](_0x1e3932,_0x54374c,_0x8ba8f2)[_0x46fe('0x52')](logger['info']('[swapAdditionalPhone]\x20'));};Preview[_0x46fe('0xf')]['incrementPreviewCounters']=function(_0x31eba2){return Promise[_0x46fe('0xec')]()[_0x46fe('0x62')](cmHopperAdditionalPhone[_0x46fe('0x8c')](_0x31eba2))['catch'](logger[_0x46fe('0x2a')](_0x46fe('0xed')));};Preview[_0x46fe('0xf')][_0x46fe('0xee')]=function(_0x127b04,_0x4aaa86,_0x2a3316,_0x170a54,_0x26c44c){var _0x21de60=this;return new Promise(function(_0x177950,_0xc23089){if(_[_0x46fe('0x5c')](_0x4aaa86)||_[_0x46fe('0x5c')](_0x4aaa86['Contact'])||_[_0x46fe('0x5c')](_0x4aaa86[_0x46fe('0xef')])||_['isNil'](_0x4aaa86['VoiceQueueId'])){_0xc23089(ut['message'](_0x46fe('0xf0'),_0x170a54,_0x26c44c));return;}var _0x101174=uuid['v4']();var _0xdcf41f=_0x21de60['campaignsPreview'][_0x4aaa86[_0x46fe('0x48')][_0x46fe('0x2f')]];var _0x55bdc4=_0x2a3316?_0x21de60[_0x46fe('0x18')][_0x2a3316]['id']:undefined;_0x21de60[_0x46fe('0x17')][_0x101174]=new Action(_0x4aaa86,_0xdcf41f,_0x101174,_0x2a3316,_0x55bdc4);var _0x4ad4b0=_0x21de60['actions'][_0x101174];_0x4ad4b0[_0x46fe('0x89')]=_0x170a54;_0x4ad4b0[_0x46fe('0xb6')]=_0x26c44c;_0x4ad4b0[_0x46fe('0xf1')]=_0x2a3316;if(_['isEmpty'](_0x127b04)){_0x21de60[_0x46fe('0xf2')](_0x4ad4b0,_0xdcf41f,_0x4aaa86,_0x2a3316)[_0x46fe('0x62')](function(_0x4d9a84){logger[_0x46fe('0x2a')]('[Preview][execCall][success]','Queue:\x20'+_0x4ad4b0[_0x46fe('0x49')]+_0x46fe('0xf3')+_0x4ad4b0[_0x46fe('0x8b')],JSON['stringify'](_0x4d9a84));ami[_0x46fe('0x7f')](_0x46fe('0xf4'),ut[_0x46fe('0x94')](_0x4ad4b0,_0x46fe('0xf5'),_0x21de60[_0x46fe('0x14')][_0x4ad4b0[_0x46fe('0x49')]]));_0x177950(ut[_0x46fe('0x36')](_0x46fe('0xf6')));})[_0x46fe('0x52')](function(_0x5a972c){ut[_0x46fe('0x39')](_0x46fe('0xf7'),_0x5a972c);_0xc23089(ut[_0x46fe('0x36')](_0x46fe('0xf8'),_0x170a54,_0x26c44c));});}else{_0xdcf41f['outboundBlacklistCallsDay']+=0x1;ut[_0x46fe('0xf9')](_0x4ad4b0);rpcDb[_0x46fe('0xfa')](_0x4ad4b0,_0x46fe('0xfb'));delete _0x21de60['actions'][_0x101174];_0xc23089(ut['message'](_0x46fe('0xfc'),_0x170a54,_0x26c44c));}});};Preview[_0x46fe('0xf')][_0x46fe('0x75')]=function(_0x1cb7fe){return!_[_0x46fe('0x5c')](_0x1cb7fe)&&!_[_0x46fe('0x5c')](_0x1cb7fe[_0x46fe('0x2f')])&&!_[_0x46fe('0x5c')](_0x1cb7fe[_0x46fe('0xfd')])&&_0x1cb7fe[_0x46fe('0xfd')]&&!_[_0x46fe('0x5c')](this['trunks'][util[_0x46fe('0x2d')](_0x46fe('0xfe'),_0x1cb7fe[_0x46fe('0x2f')])])&&!_['isNil'](this[_0x46fe('0x16')][util['format'](_0x46fe('0xfe'),_0x1cb7fe['name'])][_0x46fe('0x50')])&&(this['trunks'][util[_0x46fe('0x2d')]('SIP/%s',_0x1cb7fe[_0x46fe('0x2f')])]['status']===_0x46fe('0xff')||this['trunks'][util['format'](_0x46fe('0xfe'),_0x1cb7fe[_0x46fe('0x2f')])][_0x46fe('0x50')]===_0x46fe('0x100'));};Preview[_0x46fe('0xf')]['run']=function(_0xabc9d4,_0x28fe48){return this['execRun'](_0xabc9d4,_0x28fe48)['then'](function(_0x972831){return _[_0x46fe('0x101')](_0x972831,[_0x46fe('0x36')]);})['catch'](function(_0x14eaea){if(_0x14eaea[_0x46fe('0x102')]){rpcDb['unlockContact'](_0xabc9d4);}if(_0x14eaea['active']){rpcDb[_0x46fe('0x65')](_0xabc9d4);}throw _[_0x46fe('0x101')](_0x14eaea,['message']);});};Preview[_0x46fe('0xf')]['execRun']=function(_0x1c40fd,_0x5301ed){var _0x156a59=this;var _0x109b8f,_0x364024;return rpcDb[_0x46fe('0x103')](_0x1c40fd)[_0x46fe('0x62')](function(_0x505446){if(!_[_0x46fe('0x5c')](_0x505446[0x0])){_0x364024=_0x505446[0x0][_0x46fe('0x104')]?![]:!![];_0x109b8f=_0x505446[0x0][_0x46fe('0x104')]?!![]:![];_0x109b8f=_0x5301ed?!![]:_0x109b8f;}var _0x64ef9b=_0x156a59[_0x46fe('0x105')](_0x505446);if(_0x64ef9b[_0x46fe('0x106')]){rpcDb[_0x46fe('0x107')](_['pick'](_0x505446[0x0],['VoiceQueueId','phone']))[_0x46fe('0x62')](function(_0x3e7310){_0x156a59[_0x46fe('0xee')](_0x3e7310,_0x505446[0x0],_0x5301ed,_0x364024,_0x109b8f)[_0x46fe('0x62')](function(_0x4f89ae){return _0x4f89ae;})[_0x46fe('0x52')](function(_0x40f49e){throw _0x40f49e;});})[_0x46fe('0x52')](function(_0x259f24){ut[_0x46fe('0x39')](_0x46fe('0x108'),_0x259f24);throw ut['message']('Call\x20unsuccessful',_0x364024,_0x109b8f);});}else{throw ut[_0x46fe('0x36')](_0x64ef9b['message'],_0x364024,_0x109b8f);}})[_0x46fe('0x52')](function(_0x4548e5){ut['logger'](_0x46fe('0x109'),_0x4548e5);throw ut[_0x46fe('0x36')](_0x46fe('0x10a'),![],!![]);});};Preview['prototype']['validateContact']=function(_0x327d1a){if(_[_0x46fe('0x5c')](_0x327d1a)||_[_0x46fe('0x10b')](_0x327d1a)||!_[_0x46fe('0x5c')](_0x327d1a[0x0][_0x46fe('0x5f')])&&_[_0x46fe('0x5c')](_0x327d1a[0x0]['Agent'][_0x46fe('0x2f')])){ut[_0x46fe('0x39')](_0x46fe('0x10c'),_0x327d1a);return{'isValid':![],'message':_0x46fe('0x10d')};}var _0x1367a1=this[_0x46fe('0x14')][_0x327d1a[0x0][_0x46fe('0x48')][_0x46fe('0x2f')]];_0x1367a1[_0x46fe('0x36')]=utils[_0x46fe('0x37')]['ACTIVE'];if(_['isNil'](_0x1367a1)){ut[_0x46fe('0x39')](_0x46fe('0x10e'),_0x1367a1);return{'isValid':![],'message':_0x46fe('0x10f')};}if(!this[_0x46fe('0x75')](_0x1367a1[_0x46fe('0x76')])){ut[_0x46fe('0x39')](_0x46fe('0x110'),_0x46fe('0x111')+_0x1367a1[_0x46fe('0x2f')]+_0x46fe('0x112'));if(!this[_0x46fe('0x75')](_0x1367a1['TrunkBackup'])){ut[_0x46fe('0x39')](_0x46fe('0x110'),_0x1367a1['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x46fe('0x113')](_0x1367a1[_0x46fe('0x114')])){ut['logger'](_0x46fe('0x115'),_0x1367a1['name']+_0x46fe('0x116'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x1367a1['name']+_0x46fe('0x116')};}return{'isValid':!![],'message':_0x46fe('0x117')};};Preview[_0x46fe('0xf')][_0x46fe('0xf2')]=function(_0x1b2073,_0x59a750,_0x48e919,_0x16c73c){var _0x317f20=this;return new Promise(function(_0x1f7a6c,_0x4180c8){var _0x3dde7d=_0x1b2073['uniqueid'];var _0x144eae=_0x317f20[_0x46fe('0x75')](_0x59a750[_0x46fe('0x76')])?util['format'](_0x46fe('0x118'),_0x59a750[_0x46fe('0x76')]['name'],_['isNil'](_0x59a750['dialPrefix'])?'':_0x59a750['dialPrefix'][_0x46fe('0x119')]()||'',_0x59a750[_0x46fe('0x11a')]>0x0?_0x48e919[_0x46fe('0xef')][_0x46fe('0x11b')](_0x59a750[_0x46fe('0x11a')]):_0x48e919[_0x46fe('0xef')]):util['format'](_0x46fe('0x118'),_[_0x46fe('0x5c')](_0x59a750[_0x46fe('0x77')])?_0x59a750[_0x46fe('0x76')][_0x46fe('0x2f')]:_0x59a750[_0x46fe('0x77')][_0x46fe('0x2f')],_[_0x46fe('0x5c')](_0x59a750[_0x46fe('0x11c')])?'':_0x59a750[_0x46fe('0x11c')][_0x46fe('0x119')]()||'',_0x59a750['dialCutDigit']>0x0?_0x48e919[_0x46fe('0xef')][_0x46fe('0x11b')](_0x59a750[_0x46fe('0x11a')]):_0x48e919[_0x46fe('0xef')]);var _0x3bc8f7=_0x317f20['isTrunkReachable'](_0x59a750[_0x46fe('0x76')])?ut[_0x46fe('0x11d')](_0x59a750['Trunk'][_0x46fe('0x11e')],_0x59a750[_0x46fe('0x11f')],_0x59a750['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x46fe('0x120')](_0x59a750[_0x46fe('0x121')],_0x59a750[_0x46fe('0x122')]):_0x59a750['dialOriginateCallerIdNumber']):ut[_0x46fe('0x11d')](_[_0x46fe('0x5c')](_0x59a750[_0x46fe('0x77')])?_0x59a750[_0x46fe('0x76')]['callerid']:_0x59a750[_0x46fe('0x77')][_0x46fe('0x11e')],_0x59a750[_0x46fe('0x11f')],_0x59a750[_0x46fe('0x122')]>0x0?ut['getCallerIdRandom'](_0x59a750[_0x46fe('0x121')],_0x59a750[_0x46fe('0x122')]):_0x59a750['dialOriginateCallerIdNumber']);if(_0x3bc8f7){_0x1b2073[_0x46fe('0x123')]=ut[_0x46fe('0x124')](_0x3bc8f7);_0x1b2073[_0x46fe('0x125')]=ut[_0x46fe('0x126')](_0x3bc8f7);}var _0x54c28c=ut[_0x46fe('0x127')](_0x59a750,_0x48e919,_0x144eae,_0x3bc8f7,_0x3dde7d,_0x1b2073);var _0x15226d=utils[_0x46fe('0x128')](_0x48e919['Contact']);Object[_0x46fe('0x129')](_0x54c28c,_0x15226d);_[_0x46fe('0x12a')](_0x1b2073,ut[_0x46fe('0x12b')](_0x54c28c));_0x1b2073[_0x46fe('0x66')]=moment()[_0x46fe('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');_0x59a750[_0x46fe('0x12c')]=_0x54c28c;var _0x23e36a=ut[_0x46fe('0x12d')](_0x1b2073,_0x59a750,_0x54c28c,_0x1b2073[_0x46fe('0xb6')],_0x16c73c);return ami[_0x46fe('0x4f')](_0x23e36a)['then'](function(_0x2fb761){_0x59a750[_0x46fe('0x32')]+=0x1;logger['info'](_0x46fe('0x12e'),_0x3dde7d,_0x46fe('0x93'),_0x59a750[_0x46fe('0x2f')],_0x46fe('0x4a'),_0x59a750[_0x46fe('0x32')]);_0x1f7a6c(_0x2fb761);})['catch'](function(_0x25d5a1){ut[_0x46fe('0xe0')](_0x1b2073,0xe,_0x46fe('0x12f'));rpcDb['createAgentHistory'](_0x1b2073,_0x46fe('0x130'));_0x4180c8(_0x25d5a1);});});};Preview['prototype'][_0x46fe('0x131')]=function(_0x3ea8a9){if(this[_0x46fe('0x17')][_0x3ea8a9[_0x46fe('0x8a')]]){this[_0x46fe('0x17')][_0x3ea8a9['linkedid']][_0x46fe('0x51')]=_0x3ea8a9[_0x46fe('0x51')];}};Preview['prototype']['syncOriginateResponse']=function(_0x227ddd){var _0x3963bf=this;var _0x566df5=this[_0x46fe('0x17')][_0x227ddd[_0x46fe('0x132')]];if(_0x566df5){if(_0x566df5['lookAgent']&&this[_0x46fe('0x18')][_0x566df5[_0x46fe('0xf1')]]){ut[_0x46fe('0x133')](_0x566df5,this[_0x46fe('0x18')][_0x566df5[_0x46fe('0xf1')]]['name'],this[_0x46fe('0x18')][_0x566df5[_0x46fe('0xf1')]]['id']);}var _0x164351=_[_0x46fe('0x134')](_0x566df5);_0x164351[_0x46fe('0x8f')]=moment()[_0x46fe('0x2d')](_0x46fe('0x67'));var _0x5349f2=_0x3963bf[_0x46fe('0x14')][_0x566df5[_0x46fe('0x49')]];if(ut[_0x46fe('0x135')](_0x227ddd['response'])){if(_0x566df5[_0x46fe('0x89')]){rpcDb['unlockContact'](_0x566df5[_0x46fe('0x8b')]);}if(_0x566df5[_0x46fe('0xb6')]){rpcDb[_0x46fe('0x65')](_0x566df5['idContact']);}ami['emit'](_0x46fe('0x136'),ut[_0x46fe('0x94')](_0x566df5,_0x46fe('0x137'),this[_0x46fe('0x14')][_0x566df5[_0x46fe('0x49')]]));this[_0x46fe('0xdc')](_0x164351,_0x5349f2,_0x227ddd);}else{_0x566df5[_0x46fe('0x66')]=moment()[_0x46fe('0x2d')](_0x46fe('0x67'));ut[_0x46fe('0xe0')](_0x164351,0x4,'Answer');rpcDb[_0x46fe('0xe3')](_0x164351,_0x46fe('0x138'));}}};Preview[_0x46fe('0xf')]['syncHangup']=function(_0x4d2ab8){var _0x1d87e0=this[_0x46fe('0x17')][_0x4d2ab8[_0x46fe('0x8a')]];var _0x5b164a;if(_0x1d87e0){_0x5b164a=this[_0x46fe('0x14')][_0x1d87e0['queue']];logger['info'](_0x46fe('0x139'),_0x4d2ab8['linkedid'],'\x20Queue',_0x5b164a[_0x46fe('0x2f')],_0x46fe('0x13a'),_0x5b164a[_0x46fe('0x33')]);}if(this['actions'][_0x4d2ab8[_0x46fe('0x8a')]]&&_0x4d2ab8[_0x46fe('0x8a')]!==_0x4d2ab8[_0x46fe('0x92')]){if(_0x4d2ab8[_0x46fe('0x13b')]==='16'&&this[_0x46fe('0x17')][_0x4d2ab8['linkedid']][_0x46fe('0x4b')]){this[_0x46fe('0x13c')](_0x4d2ab8,_0x4d2ab8[_0x46fe('0x8a')],_0x4d2ab8['cause']);}else if(this[_0x46fe('0x17')][_0x4d2ab8['linkedid']]['dialAnswer']){logger[_0x46fe('0x2a')](_0x46fe('0x13d'),_0x4d2ab8['linkedid'],_0x4d2ab8['cause'],_0x46fe('0x93'),_0x5b164a[_0x46fe('0x2f')],_0x46fe('0x13a'),_0x5b164a['pTalking']);this['callProgressDetectingCustomer'](_0x4d2ab8,_0x4d2ab8[_0x46fe('0x8a')],_0x4d2ab8[_0x46fe('0x13b')]);}}else if(_0x1d87e0&&_['isNil'](_0x1d87e0[_0x46fe('0x13e')])&&_0x5b164a[_0x46fe('0x13f')]&&_0x4d2ab8['linkedid']===_0x4d2ab8['uniqueid']&&_[_0x46fe('0x5c')](_0x4d2ab8[_0x46fe('0xdf')])&&_0x4d2ab8[_0x46fe('0x13b')]==='16'&&_0x4d2ab8[_0x46fe('0x140')]==='6'&&_[_0x46fe('0xdd')](_0x1d87e0[_0x46fe('0x141')])){if(_0x1d87e0['unlockAgent']){rpcDb['unlockContact'](_0x1d87e0[_0x46fe('0x8b')]);}if(_0x1d87e0[_0x46fe('0xb6')]){rpcDb[_0x46fe('0x65')](_0x1d87e0['idContact']);}_0x4d2ab8[_0x46fe('0xdf')]='22';this[_0x46fe('0xdc')](_0x1d87e0,_0x5b164a,_0x4d2ab8);}else if(_0x1d87e0&&_0x1d87e0[_0x46fe('0x141')]){if(_0x4d2ab8[_0x46fe('0x13b')]==='16'&&this[_0x46fe('0x17')][_0x4d2ab8[_0x46fe('0x8a')]]['dialAnswer']){logger[_0x46fe('0x2a')](_0x46fe('0x142'),_0x4d2ab8[_0x46fe('0x8a')],_0x4d2ab8[_0x46fe('0x13b')],_0x46fe('0x93'),_0x5b164a['name'],_0x46fe('0x13a'),_0x5b164a['pTalking']);this[_0x46fe('0x13c')](_0x4d2ab8,_0x4d2ab8[_0x46fe('0x8a')],_0x4d2ab8[_0x46fe('0x13b')]);}else if(this[_0x46fe('0x17')][_0x4d2ab8[_0x46fe('0x8a')]][_0x46fe('0x4b')]){logger[_0x46fe('0x2a')](_0x46fe('0x13d'),_0x4d2ab8['linkedid'],_0x4d2ab8[_0x46fe('0x13b')],'\x20Queue',_0x5b164a[_0x46fe('0x2f')],_0x46fe('0x13a'),_0x5b164a[_0x46fe('0x33')]);this[_0x46fe('0x13c')](_0x4d2ab8,_0x4d2ab8[_0x46fe('0x8a')],_0x4d2ab8['cause']);}}};Preview[_0x46fe('0xf')][_0x46fe('0x22')]=function(_0x793a2a){if(this['actions'][_0x793a2a[_0x46fe('0xdb')]]&&_0x793a2a[_0x46fe('0xdb')]!==_0x793a2a[_0x46fe('0x143')]){this[_0x46fe('0x13c')](_0x793a2a,_0x793a2a[_0x46fe('0xdb')],_0x793a2a[_0x46fe('0xd0')]);}};Preview['prototype']['syncHangupRequest']=function(_0x428ece){if(this[_0x46fe('0x17')][_0x428ece[_0x46fe('0x8a')]]&&_0x428ece[_0x46fe('0x8a')]!==_0x428ece['uniqueid']&&!this[_0x46fe('0x17')][_0x428ece[_0x46fe('0x8a')]][_0x46fe('0x4b')]){if(_0x428ece[_0x46fe('0x13b')]==='1'){this[_0x46fe('0x13c')](_0x428ece,_0x428ece[_0x46fe('0x8a')],_0x428ece['cause']);}}};Preview[_0x46fe('0xf')][_0x46fe('0x144')]=function(_0x193eb5,_0x5371c7,_0x888c5e){if(this['actions'][_0x193eb5]){if(_[_0x46fe('0x5c')](this[_0x46fe('0x17')][_0x193eb5][_0x46fe('0x12c')])){this['actions'][_0x193eb5][_0x46fe('0x12c')]={};}this[_0x46fe('0x17')][_0x193eb5]['variables'][_0x5371c7]=_0x888c5e;}};Preview[_0x46fe('0xf')][_0x46fe('0x24')]=function(_0x12b397){try{if(!_['isNil'](_0x12b397)){if(ut['filterKey'](_[_0x46fe('0x145')](_0x12b397[_0x46fe('0x146')])[0x0])){this['addVariable'](_0x12b397[_0x46fe('0x92')],_[_0x46fe('0x145')](_0x12b397[_0x46fe('0x146')])[0x0],_0x12b397['value']);}}}catch(_0x2cddb7){logger[_0x46fe('0x147')](_0x46fe('0x148'),util['inspect'](_0x2cddb7,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x46fe('0x26')]=function(_0x1938b7){if(_0x1938b7){if(this[_0x46fe('0x17')][_0x1938b7[_0x46fe('0x149')]]){this[_0x46fe('0x17')][_0x1938b7[_0x46fe('0x149')]]['transfer']=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x49a35c){if(_0x49a35c){if(this[_0x46fe('0x17')][_0x49a35c[_0x46fe('0x14a')]]){this[_0x46fe('0x17')][_0x49a35c[_0x46fe('0x14a')]][_0x46fe('0x141')]=!![];}}};module[_0x46fe('0x14b')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 3af4a9e..2dda337 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 _0xdfed=['[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','catch','[createHistory]\x20','resolve','then','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createCustomerHistory','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','membername','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue'];(function(_0x52f6c6,_0x4cf7b3){var _0x9a7f82=function(_0x52cafd){while(--_0x52cafd){_0x52f6c6['push'](_0x52f6c6['shift']());}};_0x9a7f82(++_0x4cf7b3);}(_0xdfed,0xd1));var _0xddfe=function(_0x448f8,_0x2aa1d7){_0x448f8=_0x448f8-0x0;var _0xa73126=_0xdfed[_0x448f8];return _0xa73126;};'use strict';var util=require(_0xddfe('0x0'));var BPromise=require(_0xddfe('0x1'));var logger=require('../../../config/logger')(_0xddfe('0x2'));var cmHopper=require(_0xddfe('0x3'));var cmHopperHistory=require(_0xddfe('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0xddfe('0x5'));var voiceQueueReport=require(_0xddfe('0x6'));function loggerCatch(_0x4df88b){return function(_0x1cca60){logger[_0xddfe('0x7')](_0x4df88b,util[_0xddfe('0x8')](_0x1cca60,{'showHidden':![],'depth':null}));};}function create(_0x34ebef){return cmHopperHistory['createHistory'](_0x34ebef)[_0xddfe('0x9')](loggerCatch(_0xddfe('0xa')));}function createAgent(_0x42682d){return BPromise[_0xddfe('0xb')]()[_0xddfe('0xc')](agentReportPreview[_0xddfe('0xd')](_0x42682d))[_0xddfe('0x9')](loggerCatch(_0xddfe('0xa')));}function moveContact(_0x358fec){return cmHopper[_0xddfe('0xe')](_0x358fec,!![])[_0xddfe('0x9')](loggerCatch(_0xddfe('0xf')));}exports[_0xddfe('0x10')]=function(_0x59fd8c){return cmHopperBlack[_0xddfe('0x10')](_0x59fd8c)[_0xddfe('0x9')](loggerCatch(_0xddfe('0x11')));};exports[_0xddfe('0x12')]=function(_0x156ad5){return BPromise[_0xddfe('0xb')]()[_0xddfe('0xc')](cmHopper[_0xddfe('0x12')](_0x156ad5))[_0xddfe('0x9')](loggerCatch('[getContactPreview]\x20'));};exports[_0xddfe('0xd')]=function(_0x3a0731,_0x313e7c){create(_0x3a0731)[_0xddfe('0x9')](loggerCatch(_0x313e7c));moveContact(_0x3a0731)['catch'](loggerCatch(_0x313e7c));};exports['createAgentHistory']=function(_0xa61ef3,_0x20d5c2){createAgent(_0xa61ef3)[_0xddfe('0x9')](loggerCatch(_0x20d5c2));};exports[_0xddfe('0x13')]=function(_0x5e9c6e,_0x567cd2){create(_0x5e9c6e)[_0xddfe('0x9')](loggerCatch(_0x567cd2));};exports['createCustomerFinal']=function(_0x306131,_0x47779e){moveContact(_0x306131)['catch'](loggerCatch(_0x47779e));};exports[_0xddfe('0x14')]=function(_0xf5ce4c,_0x55efd3,_0x57fdd6){if(_0x55efd3){_0xf5ce4c['UserId']=null;}if(_0x57fdd6){_0xf5ce4c[_0xddfe('0x15')]=![];}return cmHopper[_0xddfe('0x14')](_0xf5ce4c)['catch'](loggerCatch(_0xddfe('0x16')));};exports[_0xddfe('0x17')]=function(_0x5c1985){return cmHopper[_0xddfe('0x17')](_0x5c1985)[_0xddfe('0x9')](loggerCatch(_0xddfe('0x18')));};exports[_0xddfe('0x19')]=function(_0xfa60b9){return cmHopper[_0xddfe('0x19')]({'UserId':null},_0xfa60b9,0x1)[_0xddfe('0x9')](loggerCatch('[unlockContact]\x20'));};exports[_0xddfe('0x1a')]=function(_0x28c933){return cmHopper[_0xddfe('0x19')]({'active':![]},_0x28c933,0x1)['catch'](loggerCatch(_0xddfe('0x1b')));};exports[_0xddfe('0x1c')]=function(_0x26d266){var _0x5ee25e={};_0x5ee25e[_0xddfe('0x1d')]=_0x26d266[_0xddfe('0x1d')];_0x5ee25e[_0xddfe('0x1e')]=_0x26d266['uniqueid'];_0x5ee25e['calleridnum']=_0x26d266[_0xddfe('0x1f')];_0x5ee25e[_0xddfe('0x20')]=_0x26d266[_0xddfe('0x20')];_0x5ee25e[_0xddfe('0x21')]=_0x26d266[_0xddfe('0x21')];_0x5ee25e[_0xddfe('0x22')]=_0x26d266[_0xddfe('0x23')];_0x5ee25e[_0xddfe('0x24')]=_0x26d266['answertime'];_0x5ee25e[_0xddfe('0x25')]=0x1;_0x5ee25e[_0xddfe('0x26')]=_0x26d266[_0xddfe('0x27')];_0x5ee25e['connectedlinename']=_0x26d266['membername'];_0x5ee25e[_0xddfe('0x28')]=_0xddfe('0x29');_0x5ee25e[_0xddfe('0x2a')]=_0xddfe('0x2b');_0x5ee25e[_0xddfe('0x2c')]=0x0;_0x5ee25e[_0xddfe('0x2d')]=0x1;_0x5ee25e['lastAssignedTo']=_0x26d266[_0xddfe('0x2e')];_0x5ee25e['queuecallerexitreason']='COMPLETED';return BPromise[_0xddfe('0xb')]()[_0xddfe('0xc')](voiceQueueReport[_0xddfe('0x2f')](_0x5ee25e))['catch'](loggerCatch(_0xddfe('0x30')));};exports[_0xddfe('0x31')]=function(_0x29ec5b,_0x4cbfe7){return BPromise[_0xddfe('0xb')]()[_0xddfe('0xc')](cmHopper[_0xddfe('0x31')](_0x29ec5b,_0x4cbfe7))[_0xddfe('0x9')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xddfe('0x32')]=function(_0x1be21e){return cmHopper[_0xddfe('0x14')](_0x1be21e,!![],!![])[_0xddfe('0x9')](loggerCatch(_0xddfe('0x33')));}; \ No newline at end of file +var _0xae59=['../rpc/voiceQueueReport','inspect','catch','resolve','createHistory','[createHistory]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack'];(function(_0x46dab3,_0x5d937c){var _0x20aeec=function(_0x44a2b6){while(--_0x44a2b6){_0x46dab3['push'](_0x46dab3['shift']());}};_0x20aeec(++_0x5d937c);}(_0xae59,0x90));var _0x9ae5=function(_0x51e3ab,_0xa7c312){_0x51e3ab=_0x51e3ab-0x0;var _0x4e3bc4=_0xae59[_0x51e3ab];return _0x4e3bc4;};'use strict';var util=require(_0x9ae5('0x0'));var BPromise=require(_0x9ae5('0x1'));var logger=require(_0x9ae5('0x2'))(_0x9ae5('0x3'));var cmHopper=require(_0x9ae5('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x9ae5('0x5'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x9ae5('0x6'));function loggerCatch(_0x39a22c){return function(_0x361713){logger['error'](_0x39a22c,util[_0x9ae5('0x7')](_0x361713,{'showHidden':![],'depth':null}));};}function create(_0x10b693){return cmHopperHistory['createHistory'](_0x10b693)[_0x9ae5('0x8')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x28c361){return BPromise[_0x9ae5('0x9')]()['then'](agentReportPreview[_0x9ae5('0xa')](_0x28c361))[_0x9ae5('0x8')](loggerCatch(_0x9ae5('0xb')));}function moveContact(_0x582448){return cmHopper['moveContactManagedDialer'](_0x582448,!![])['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x9ae5('0xc')]=function(_0x129e4d){return cmHopperBlack[_0x9ae5('0xc')](_0x129e4d)[_0x9ae5('0x8')](loggerCatch(_0x9ae5('0xd')));};exports[_0x9ae5('0xe')]=function(_0x2320b7){return BPromise[_0x9ae5('0x9')]()[_0x9ae5('0xf')](cmHopper['getContactPreview'](_0x2320b7))[_0x9ae5('0x8')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x2cb6eb,_0x1f5064){create(_0x2cb6eb)[_0x9ae5('0x8')](loggerCatch(_0x1f5064));moveContact(_0x2cb6eb)[_0x9ae5('0x8')](loggerCatch(_0x1f5064));};exports['createAgentHistory']=function(_0x3b59d9,_0x3e503f){createAgent(_0x3b59d9)[_0x9ae5('0x8')](loggerCatch(_0x3e503f));};exports[_0x9ae5('0x10')]=function(_0x5535c9,_0x5ab222){create(_0x5535c9)[_0x9ae5('0x8')](loggerCatch(_0x5ab222));};exports[_0x9ae5('0x11')]=function(_0x5cc889,_0x301957){moveContact(_0x5cc889)[_0x9ae5('0x8')](loggerCatch(_0x301957));};exports[_0x9ae5('0x12')]=function(_0x42f3f4,_0x571b89,_0x3a2271){if(_0x571b89){_0x42f3f4[_0x9ae5('0x13')]=null;}if(_0x3a2271){_0x42f3f4[_0x9ae5('0x14')]=![];}return cmHopper[_0x9ae5('0x12')](_0x42f3f4)[_0x9ae5('0x8')](loggerCatch(_0x9ae5('0x15')));};exports[_0x9ae5('0x16')]=function(_0x2e8b0e){return cmHopper['countReScheduled'](_0x2e8b0e)[_0x9ae5('0x8')](loggerCatch(_0x9ae5('0x17')));};exports[_0x9ae5('0x18')]=function(_0x5e9e70){return cmHopper[_0x9ae5('0x18')]({'UserId':null},_0x5e9e70,0x1)[_0x9ae5('0x8')](loggerCatch(_0x9ae5('0x19')));};exports['disableContact']=function(_0x32323d){return cmHopper[_0x9ae5('0x18')]({'active':![]},_0x32323d,0x1)[_0x9ae5('0x8')](loggerCatch(_0x9ae5('0x1a')));};exports[_0x9ae5('0x1b')]=function(_0x41da13){var _0x4154d5={};_0x4154d5[_0x9ae5('0x1c')]=_0x41da13[_0x9ae5('0x1c')];_0x4154d5[_0x9ae5('0x1d')]=_0x41da13['uniqueid'];_0x4154d5[_0x9ae5('0x1e')]=_0x41da13[_0x9ae5('0x1e')];_0x4154d5[_0x9ae5('0x1f')]=_0x41da13[_0x9ae5('0x1f')];_0x4154d5['queue']=_0x41da13[_0x9ae5('0x20')];_0x4154d5[_0x9ae5('0x21')]=_0x41da13[_0x9ae5('0x22')];_0x4154d5['queuecallerleaveAt']=_0x41da13['answertime'];_0x4154d5[_0x9ae5('0x23')]=0x1;_0x4154d5[_0x9ae5('0x24')]=_0x41da13['endtime'];_0x4154d5[_0x9ae5('0x25')]=_0x41da13[_0x9ae5('0x26')];_0x4154d5[_0x9ae5('0x27')]='from-sip';_0x4154d5[_0x9ae5('0x28')]=_0x9ae5('0x29');_0x4154d5['holdtime']=0x0;_0x4154d5[_0x9ae5('0x2a')]=0x1;_0x4154d5[_0x9ae5('0x2b')]=_0x41da13[_0x9ae5('0x26')];_0x4154d5[_0x9ae5('0x2c')]=_0x9ae5('0x2d');return BPromise[_0x9ae5('0x9')]()[_0x9ae5('0xf')](voiceQueueReport[_0x9ae5('0x2e')](_0x4154d5))['catch'](loggerCatch(_0x9ae5('0x2f')));};exports['getContactRecallMe']=function(_0x3273eb,_0x5dc06e){return BPromise['resolve']()[_0x9ae5('0xf')](cmHopper[_0x9ae5('0x30')](_0x3273eb,_0x5dc06e))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x9ae5('0x31')]=function(_0x32cf1f){return cmHopper['rescheduleContact'](_0x32cf1f,!![],!![])[_0x9ae5('0x8')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index e859de9..7282657 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 _0x5823=['channelAgent','mandatoryDisposition','buildObj','agentReadyId','status','reachable','push','milliseconds','diff','seconds','CampaignId','type','campaigntype','dialAnswer','membername','active','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','noanswer','variables','buildNoAnswerEventPayload','util','lodash','moment','preview','env','127.0.0.1','../../dialer/utils','loggerCatch','error','logger','loggerError','inspect','logger2','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','logBlacklist','statedesc','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','state','ringtime','getSeconds','logLookAgent','UserId','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','from-sip','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','scheduledat','add','minutes','ListId','pTalking','info','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface'];(function(_0x2058a9,_0x8ad463){var _0x4aec72=function(_0x59d277){while(--_0x59d277){_0x2058a9['push'](_0x2058a9['shift']());}};_0x4aec72(++_0x8ad463);}(_0x5823,0x14b));var _0x3582=function(_0x325e43,_0x4f768b){_0x325e43=_0x325e43-0x0;var _0x152544=_0x5823[_0x325e43];return _0x152544;};'use strict';var util=require(_0x3582('0x0'));var _=require(_0x3582('0x1'));var moment=require(_0x3582('0x2'));var logger=require('../../../../config/logger')(_0x3582('0x3'));var ipAgi=process[_0x3582('0x4')]['XCALLY_IP_AGI']||_0x3582('0x5');var utils=require(_0x3582('0x6'));exports[_0x3582('0x7')]=function(_0x338a2f){return function(_0x1c4289){logger[_0x3582('0x8')](_0x338a2f,util['inspect'](_0x1c4289,{'showHidden':![],'depth':null}));};};exports[_0x3582('0x9')]=function(_0x3f58ce,_0x733910){logger['info'](_0x3f58ce,util['inspect'](_0x733910,{'showHidden':![],'depth':null}));};exports[_0x3582('0xa')]=function(_0xda6e14,_0x2526f6){logger[_0x3582('0x8')](_0xda6e14,util[_0x3582('0xb')](_0x2526f6,{'showHidden':![],'depth':null}));};exports[_0x3582('0xc')]=function(_0x312789){return function(_0x3f1aa1){logger['info'](_0x312789,util[_0x3582('0xb')](_0x3f1aa1,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x5e7206,_0x167d7a,_0x308e01){return{'message':_0x5e7206,'unlock':_0x167d7a,'active':_0x308e01};};exports[_0x3582('0xd')]=function(_0x132629,_0x124958,_0x3b92a0){if(!_[_0x3582('0xe')](_0x3b92a0)&&_0x3582('0xf')===typeof _0x3b92a0&&!_[_0x3582('0x10')](_0x3b92a0)){if(!_[_0x3582('0xe')](_0x124958)&&'string'===typeof _0x124958&&!_[_0x3582('0x10')](_0x124958)){return util[_0x3582('0x11')](_0x3582('0x12'),_0x124958,_0x3b92a0);}return util[_0x3582('0x11')](_0x3582('0x12'),_0x3b92a0,_0x3b92a0);}if(!_[_0x3582('0xe')](_0x132629)&&_0x3582('0xf')===typeof _0x132629&&!_[_0x3582('0x10')](_0x132629)){return _0x132629;}return _0x3582('0x13');};exports['isActive']=function(_0x1eb96a){if(_[_0x3582('0x14')](_0x1eb96a)){return![];}return _0x1eb96a;};exports[_0x3582('0x15')]=function(_0x5b5e78,_0x40ebfb,_0x56f6b9,_0x318129,_0x526ea4,_0x5540ac){var _0x431c39={'XMD-QUEUE':_0x40ebfb[_0x3582('0x16')]?_0x40ebfb['Queue'][_0x3582('0x17')]:'','XMD-CALLERID':_0x318129,'XMD-CALLERID-PREVIEW':_0x5540ac?util[_0x3582('0x11')](_0x3582('0x12'),_0x5540ac[_0x3582('0x18')],_0x5540ac[_0x3582('0x19')]):_0x318129,'XMD-DIALID':_0x526ea4,'XMD-CONTACTID':_0x40ebfb[_0x3582('0x1a')],'XMD-CDRTYPE':_0x3582('0x1b'),'CALLERID(all)':_0x318129,'XMD-VOICEQUEUEID':_0x40ebfb[_0x3582('0x1c')],'XMD-DIALCHANNEL':_0x56f6b9,'XMD-DIALTIMEOUT':_0x5b5e78[_0x3582('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x3582('0x11')](_0x3582('0x1e'),_0x5b5e78[_0x3582('0x1f')]?'g':'',_[_0x3582('0x10')](_0x5b5e78[_0x3582('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x5b5e78[_0x3582('0x21')]||'','XMD-AGI':_0x5b5e78[_0x3582('0x22')]?util[_0x3582('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5b5e78[_0x3582('0x22')]):_0x3582('0x23'),'XMD-AGIAFTER':_0x5b5e78[_0x3582('0x1f')]?util[_0x3582('0x11')](_0x3582('0x24'),ipAgi,_0x5b5e78[_0x3582('0x1f')]):_0x3582('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x5540ac?_0x5540ac[_0x3582('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x5540ac?_0x5540ac[_0x3582('0x26')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x3582('0x27')};if(!_['isEmpty'](_0x5b5e78[_0x3582('0x20')])){_0x431c39[util[_0x3582('0x11')]('%s',_0x3582('0x28'))]=_0x5b5e78[_0x3582('0x20')];_0x431c39[util[_0x3582('0x11')]('%s',_0x3582('0x29'))]=_0x526ea4;}return _0x431c39;};exports[_0x3582('0x2a')]=function(_0x48a629){var _0x50698f={};for(var _0x5c5f38 in _0x48a629){if(_0x48a629[_0x3582('0x2b')](_0x5c5f38)){_0x50698f[util[_0x3582('0x11')]('%s',_[_0x3582('0x2c')](_0x5c5f38))]=_0x48a629[_0x5c5f38];}}return{'variables':_0x50698f};};exports[_0x3582('0x2d')]=function(_0x5d95b3){var _0xedd03a=moment()[_0x3582('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x5d95b3['state']=0xd;_0x5d95b3[_0x3582('0x2e')]='Blacklist';_0x5d95b3[_0x3582('0x2f')]=_0xedd03a;_0x5d95b3[_0x3582('0x30')]=_0xedd03a;_0x5d95b3[_0x3582('0x31')]=_0xedd03a;};exports[_0x3582('0x32')]=function(_0x5265d0,_0x1b0c25,_0x35ae70){var _0x4d528f=moment()[_0x3582('0x11')](_0x3582('0x33'));_0x5265d0[_0x3582('0x34')]=_0x1b0c25;_0x5265d0[_0x3582('0x2e')]=_0x35ae70;_0x5265d0['responsetime']=_0x4d528f;_0x5265d0[_0x3582('0x35')]=utils[_0x3582('0x36')](_0x5265d0['responsetime'],_0x5265d0['starttime']);};exports[_0x3582('0x37')]=function(_0xba4703,_0x25a268,_0x41fd7d){_0xba4703['membername']=_0x25a268;_0xba4703[_0x3582('0x38')]=_0x41fd7d;};exports['logCustomer']=function(_0xfcd649,_0x2a945c,_0xbc5b61){var _0x29adff=moment()[_0x3582('0x11')](_0x3582('0x33'));_0xfcd649[_0x3582('0x34')]=_0x2a945c;_0xfcd649[_0x3582('0x2e')]=_0xbc5b61;_0xfcd649[_0x3582('0x30')]=_0xfcd649[_0x3582('0x30')]?_0xfcd649[_0x3582('0x30')]:_0x29adff;_0xfcd649[_0x3582('0x31')]=_0xfcd649[_0x3582('0x31')]?_0xfcd649[_0x3582('0x31')]:_0x29adff;_0xfcd649[_0x3582('0x35')]=utils[_0x3582('0x36')](_0xfcd649[_0x3582('0x30')]||0x0,_0xfcd649[_0x3582('0x2f')]||0x0);_0xfcd649[_0x3582('0x39')]=_0xfcd649[_0x3582('0x3a')]?utils[_0x3582('0x36')](_0xfcd649[_0x3582('0x31')],_0xfcd649[_0x3582('0x3a')]):0x0;};exports[_0x3582('0x3b')]=function(_0x533e2f){return _0x533e2f===_0x3582('0x3c');};exports[_0x3582('0x3d')]=function(_0xaee36c,_0x58e239,_0x572ba7,_0x4c6a61,_0x44f540){var _0x1b1cd8=_0x4c6a61?_0x3582('0x3e'):_0xaee36c[_0x3582('0x18')];_0x1b1cd8=_0x44f540?_0x3582('0x3f'):_0x1b1cd8;return{'actionid':_0xaee36c[_0x3582('0x40')],'action':_0x3582('0x41'),'channel':_0xaee36c['channelAgent'],'callerid':util[_0x3582('0x11')](_0x3582('0x12'),_0x1b1cd8,_0xaee36c[_0x3582('0x19')]),'Exten':'xcally-motion-preview','Context':_0x3582('0x42'),'Priority':'1','variable':_0x572ba7,'timeout':(_0x58e239['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0xaee36c[_0x3582('0x40')]};};exports[_0x3582('0x43')]=function(_0x59629e){return _0x59629e[_0x3582('0x44')]+_0x59629e[_0x3582('0x45')]+_0x59629e['countnoanswerretry']+_0x59629e[_0x3582('0x46')]+_0x59629e[_0x3582('0x47')];};exports[_0x3582('0x48')]=function(_0x4ad431){var _0x514164=_[_0x3582('0x49')](_0x4ad431);_0x514164[_0x3582('0x34')]=0xf;_0x514164[_0x3582('0x2e')]='Global';return _0x514164;};exports[_0x3582('0x4a')]=function(_0x42b97c,_0x442ada,_0x24f218){var _0x2794d0={};_0x2794d0[_0x442ada]=_0x42b97c[_0x442ada];_0x2794d0['active']=![];_0x2794d0[_0x3582('0x4b')]=moment()[_0x3582('0x4c')](_0x24f218,_0x3582('0x4d'))[_0x3582('0x11')](_0x3582('0x33'));_0x2794d0[_0x3582('0x1a')]=_0x42b97c[_0x3582('0x1a')];_0x2794d0[_0x3582('0x4e')]=_0x42b97c['ListId'];_0x2794d0[_0x3582('0x1c')]=_0x42b97c[_0x3582('0x1c')]||undefined;return _0x2794d0;};exports['decrementTalking']=function(_0x389e01,_0xbe8b48){if(!_[_0x3582('0x14')](_0x389e01)){if(_0x389e01['pTalking']>0x0){_0x389e01[_0x3582('0x4f')]-=0x1;}else{logger[_0x3582('0x50')](_0xbe8b48,'[decrementTalking]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0xbe8b48,_0x3582('0x51'));}};exports[_0x3582('0x52')]=function(_0x55df4e){if(_0x55df4e<=0x0){return!![];}return![];};function buildObj(_0x11aa50,_0x4a8a99,_0x39387a){_0x11aa50[_0x3582('0x53')]=_0x4a8a99;_0x11aa50['name']=_0x11aa50[_0x3582('0x54')];_0x11aa50[_0x3582('0x55')]=_0x11aa50[_0x3582('0x56')];_0x11aa50['motionChannel']='voice';if(_0x39387a){_0x11aa50[_0x3582('0x57')]=_0x39387a[_0x3582('0x57')];}return _0x11aa50;}exports[_0x3582('0x58')]=buildObj;exports[_0x3582('0x59')]=function(_0x1cb956){var _0x419e8c=[];for(var _0x4e137e in _0x1cb956){if(_0x1cb956[_0x3582('0x2b')](_0x4e137e)){if(!_['isNil'](_0x1cb956[_0x4e137e])&&_0x1cb956[_0x4e137e][_0x3582('0x34')]==='not_inuse'&&_0x1cb956[_0x4e137e][_0x3582('0x5a')]===_0x3582('0x5b')){_0x419e8c[_0x3582('0x5c')](_0x1cb956[_0x4e137e]['id']);}}}return _0x419e8c;};exports['getDiff']=function(_0x64faed){var _0x4c4025=moment()[_0x3582('0x5d')](0x0);var _0x3a71ff=moment(_0x64faed)[_0x3582('0x5d')](0x0);return _0x4c4025[_0x3582('0x5e')](_0x3a71ff,_0x3582('0x5f'));};exports['createBody']=function(_0x19ff41){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x19ff41[_0x3582('0x1a')],'ListId':_0x19ff41[_0x3582('0x4e')],'VoiceQueueId':_0x19ff41['VoiceQueueId']||undefined,'CampaignId':_0x19ff41[_0x3582('0x60')]||undefined};};exports['filterKey']=function(_0x2d6cf9){if(_0x2d6cf9===_0x3582('0x40')||_0x2d6cf9==='idContact'||_0x2d6cf9==='queue'||_0x2d6cf9===_0x3582('0x61')||_0x2d6cf9===_0x3582('0x62')||_0x2d6cf9===_0x3582('0x63')||_0x2d6cf9===_0x3582('0x64')||_0x2d6cf9===_0x3582('0x56')||_0x2d6cf9===_0x3582('0x18')||_0x2d6cf9===_0x3582('0x65')||_0x2d6cf9===_0x3582('0x19')||_0x2d6cf9==='scheduledat'||_0x2d6cf9===_0x3582('0x44')||_0x2d6cf9===_0x3582('0x45')||_0x2d6cf9===_0x3582('0x66')||_0x2d6cf9===_0x3582('0x67')||_0x2d6cf9===_0x3582('0x68')||_0x2d6cf9===_0x3582('0x69')||_0x2d6cf9===_0x3582('0x6a')||_0x2d6cf9===_0x3582('0x6b')||_0x2d6cf9===_0x3582('0x1a')||_0x2d6cf9===_0x3582('0x4e')||_0x2d6cf9===_0x3582('0x38')||_0x2d6cf9===_0x3582('0x1c')||_0x2d6cf9==='sipcallid'||_0x2d6cf9===_0x3582('0x6c')||_0x2d6cf9===_0x3582('0x6d')||_0x2d6cf9===_0x3582('0x6e')||_0x2d6cf9===_0x3582('0x6f')||_0x2d6cf9===_0x3582('0x70')||_0x2d6cf9===_0x3582('0x71')||_0x2d6cf9===_0x3582('0x72')||_0x2d6cf9===_0x3582('0x73')||_0x2d6cf9==='xmd-dialchannel'||_0x2d6cf9===_0x3582('0x74')||_0x2d6cf9===_0x3582('0x75')||_0x2d6cf9===_0x3582('0x76')||_0x2d6cf9===_0x3582('0x77')||_0x2d6cf9===_0x3582('0x78')||_0x2d6cf9===_0x3582('0x79')||_0x2d6cf9===_0x3582('0x7a')||_0x2d6cf9===_0x3582('0x7b')||_0x2d6cf9===_0x3582('0x7c')||_0x2d6cf9===_0x3582('0x7d')||_0x2d6cf9==='rtpaudioqoslossbridged'||_0x2d6cf9===_0x3582('0x7e')||_0x2d6cf9===_0x3582('0x7f')||_0x2d6cf9===_0x3582('0x79')||_0x2d6cf9===_0x3582('0x7a')||_0x2d6cf9===_0x3582('0x7b')||_0x2d6cf9==='rtpaudioqosjitterbridged'||_0x2d6cf9==='rtpaudioqosloss'||_0x2d6cf9==='rtpaudioqoslossbridged'||_0x2d6cf9===_0x3582('0x7e')||_0x2d6cf9===_0x3582('0x7f')||_0x2d6cf9===_0x3582('0x80')||_0x2d6cf9==='bridgepvtcallid'||_0x2d6cf9===_0x3582('0x34')||_0x2d6cf9===_0x3582('0x2e')){return![];}return!![];};exports[_0x3582('0x81')]=function(_0x23e2cd,_0x45853b){var _0x1116e6,_0x271b82,_0x33c6fb;if(_0x45853b<=0x0){_0x45853b=0x1;}_0x1116e6=new RegExp(_0x3582('0x82')+_0x45853b+'}$');_0x271b82=Math[_0x3582('0x83')](0xa,_0x45853b-0x1);_0x33c6fb=Math['pow'](0xa,_0x45853b)-0x1;return util[_0x3582('0x11')]('%s',_[_0x3582('0x84')](_0x23e2cd,_0x1116e6,_[_0x3582('0x85')](_0x271b82,_0x33c6fb)));};exports['extractCalleridName']=function(_0x53abf3){var _0x3d3579=_0x53abf3[_0x3582('0x86')](/"(.*?)"/);return _0x3d3579?_0x3d3579[0x1]:_0x53abf3;};exports[_0x3582('0x87')]=function(_0x17fc15){var _0xdb0426=_0x17fc15['match'](/<(.*?)>/);return _0xdb0426?_0xdb0426[0x1]:_0x17fc15;};function buildNoAnswerEventPayload(_0x489e55,_0x23be56){var _0x546dd1=buildObj(_0x489e55,_0x3582('0x88'));if(!_['isEmpty'](_0x23be56[_0x3582('0x89')])){Object['keys'](_0x23be56[_0x3582('0x89')])['forEach'](function(_0x698d7d){_0x546dd1[_0x698d7d['toLowerCase']()]=_0x23be56[_0x3582('0x89')][_0x698d7d];});}return _0x546dd1;}exports[_0x3582('0x8a')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xc5cd=['rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','variables','forEach','util','lodash','../../../../config/logger','preview','env','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','string','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','NONE','originatecalleridnum','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','hasOwnProperty','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','Blacklist','starttime','responsetime','endtime','logAgent','state','statedesc','getSeconds','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalking','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','[decrementTalking]\x20is\x20null\x20or\x20undefined','lastevent','queue','motionChannel','mandatoryDisposition','buildObj','agentReadyId','not_inuse','push','getDiff','milliseconds','diff','seconds','createBody','type','dialAnswer','active','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos'];(function(_0x46b899,_0x3a63e3){var _0x375210=function(_0x27aae9){while(--_0x27aae9){_0x46b899['push'](_0x46b899['shift']());}};_0x375210(++_0x3a63e3);}(_0xc5cd,0x9c));var _0xdc5c=function(_0x559e9c,_0x3f10d4){_0x559e9c=_0x559e9c-0x0;var _0x2dfbc3=_0xc5cd[_0x559e9c];return _0x2dfbc3;};'use strict';var util=require(_0xdc5c('0x0'));var _=require(_0xdc5c('0x1'));var moment=require('moment');var logger=require(_0xdc5c('0x2'))(_0xdc5c('0x3'));var ipAgi=process[_0xdc5c('0x4')]['XCALLY_IP_AGI']||_0xdc5c('0x5');var utils=require(_0xdc5c('0x6'));exports[_0xdc5c('0x7')]=function(_0x53d71b){return function(_0x2c9c4f){logger[_0xdc5c('0x8')](_0x53d71b,util[_0xdc5c('0x9')](_0x2c9c4f,{'showHidden':![],'depth':null}));};};exports[_0xdc5c('0xa')]=function(_0x10893f,_0x501441){logger[_0xdc5c('0xb')](_0x10893f,util[_0xdc5c('0x9')](_0x501441,{'showHidden':![],'depth':null}));};exports[_0xdc5c('0xc')]=function(_0x42e5d7,_0x46a4e0){logger['error'](_0x42e5d7,util[_0xdc5c('0x9')](_0x46a4e0,{'showHidden':![],'depth':null}));};exports[_0xdc5c('0xd')]=function(_0x1901f6){return function(_0x27038f){logger[_0xdc5c('0xb')](_0x1901f6,util[_0xdc5c('0x9')](_0x27038f,{'showHidden':![],'depth':null}));};};exports[_0xdc5c('0xe')]=function(_0x302614,_0x572ee5,_0x993a31){return{'message':_0x302614,'unlock':_0x572ee5,'active':_0x993a31};};exports[_0xdc5c('0xf')]=function(_0x4defb1,_0x757f24,_0x506fea){if(!_['isUndefined'](_0x506fea)&&_0xdc5c('0x10')===typeof _0x506fea&&!_['isEmpty'](_0x506fea)){if(!_[_0xdc5c('0x11')](_0x757f24)&&_0xdc5c('0x10')===typeof _0x757f24&&!_[_0xdc5c('0x12')](_0x757f24)){return util['format']('\x22%s\x22\x20<%s>',_0x757f24,_0x506fea);}return util[_0xdc5c('0x13')](_0xdc5c('0x14'),_0x506fea,_0x506fea);}if(!_[_0xdc5c('0x11')](_0x4defb1)&&_0xdc5c('0x10')===typeof _0x4defb1&&!_['isEmpty'](_0x4defb1)){return _0x4defb1;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x21d0c0){if(_[_0xdc5c('0x15')](_0x21d0c0)){return![];}return _0x21d0c0;};exports[_0xdc5c('0x16')]=function(_0x4bd17e,_0x2d9c0e,_0x561fa9,_0x5d446b,_0x1b415f,_0x36041d){var _0x46abc1={'XMD-QUEUE':_0x2d9c0e[_0xdc5c('0x17')]?_0x2d9c0e[_0xdc5c('0x17')][_0xdc5c('0x18')]:'','XMD-CALLERID':_0x5d446b,'XMD-CALLERID-PREVIEW':_0x36041d?util[_0xdc5c('0x13')]('\x22%s\x22\x20<%s>',_0x36041d[_0xdc5c('0x19')],_0x36041d[_0xdc5c('0x1a')]):_0x5d446b,'XMD-DIALID':_0x1b415f,'XMD-CONTACTID':_0x2d9c0e[_0xdc5c('0x1b')],'XMD-CDRTYPE':_0xdc5c('0x1c'),'CALLERID(all)':_0x5d446b,'XMD-VOICEQUEUEID':_0x2d9c0e['VoiceQueueId'],'XMD-DIALCHANNEL':_0x561fa9,'XMD-DIALTIMEOUT':_0x4bd17e[_0xdc5c('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xdc5c('0x13')]('\x22rtTxX%s%s\x22',_0x4bd17e['dialQueueProject2']?'g':'',_['isEmpty'](_0x4bd17e['monitor_format'])?'':_0xdc5c('0x1e')),'XMD-DIALURL':_0x4bd17e[_0xdc5c('0x1f')]||'','XMD-AGI':_0x4bd17e[_0xdc5c('0x20')]?util['format'](_0xdc5c('0x21'),ipAgi,_0x4bd17e[_0xdc5c('0x20')]):'NONE','XMD-AGIAFTER':_0x4bd17e[_0xdc5c('0x22')]?util[_0xdc5c('0x13')](_0xdc5c('0x21'),ipAgi,_0x4bd17e[_0xdc5c('0x22')]):_0xdc5c('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x36041d?_0x36041d[_0xdc5c('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x36041d?_0x36041d['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0xdc5c('0x25')};if(!_['isEmpty'](_0x4bd17e[_0xdc5c('0x26')])){_0x46abc1[util[_0xdc5c('0x13')]('%s',_0xdc5c('0x27'))]=_0x4bd17e['monitor_format'];_0x46abc1[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x1b415f;}return _0x46abc1;};exports[_0xdc5c('0x28')]=function(_0xe9308b){var _0x25e528={};for(var _0x1c9118 in _0xe9308b){if(_0xe9308b[_0xdc5c('0x29')](_0x1c9118)){_0x25e528[util[_0xdc5c('0x13')]('%s',_['toLower'](_0x1c9118))]=_0xe9308b[_0x1c9118];}}return{'variables':_0x25e528};};exports[_0xdc5c('0x2a')]=function(_0x47c27a){var _0x11a0e9=moment()[_0xdc5c('0x13')](_0xdc5c('0x2b'));_0x47c27a['state']=0xd;_0x47c27a['statedesc']=_0xdc5c('0x2c');_0x47c27a[_0xdc5c('0x2d')]=_0x11a0e9;_0x47c27a[_0xdc5c('0x2e')]=_0x11a0e9;_0x47c27a[_0xdc5c('0x2f')]=_0x11a0e9;};exports[_0xdc5c('0x30')]=function(_0x17e364,_0xf8f55e,_0x3a4e31){var _0x1655a9=moment()[_0xdc5c('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x17e364[_0xdc5c('0x31')]=_0xf8f55e;_0x17e364[_0xdc5c('0x32')]=_0x3a4e31;_0x17e364[_0xdc5c('0x2e')]=_0x1655a9;_0x17e364['ringtime']=utils[_0xdc5c('0x33')](_0x17e364['responsetime'],_0x17e364[_0xdc5c('0x2d')]);};exports['logLookAgent']=function(_0x1a5bc1,_0x2503e2,_0x148a7f){_0x1a5bc1[_0xdc5c('0x34')]=_0x2503e2;_0x1a5bc1[_0xdc5c('0x35')]=_0x148a7f;};exports[_0xdc5c('0x36')]=function(_0x2ad2de,_0x3eaa1a,_0x47ae2a){var _0x559285=moment()[_0xdc5c('0x13')](_0xdc5c('0x2b'));_0x2ad2de[_0xdc5c('0x31')]=_0x3eaa1a;_0x2ad2de[_0xdc5c('0x32')]=_0x47ae2a;_0x2ad2de[_0xdc5c('0x2e')]=_0x2ad2de[_0xdc5c('0x2e')]?_0x2ad2de[_0xdc5c('0x2e')]:_0x559285;_0x2ad2de['endtime']=_0x2ad2de['endtime']?_0x2ad2de[_0xdc5c('0x2f')]:_0x559285;_0x2ad2de['ringtime']=utils[_0xdc5c('0x33')](_0x2ad2de[_0xdc5c('0x2e')]||0x0,_0x2ad2de[_0xdc5c('0x2d')]||0x0);_0x2ad2de[_0xdc5c('0x37')]=_0x2ad2de[_0xdc5c('0x38')]?utils[_0xdc5c('0x33')](_0x2ad2de['endtime'],_0x2ad2de[_0xdc5c('0x38')]):0x0;};exports[_0xdc5c('0x39')]=function(_0xd49f56){return _0xd49f56===_0xdc5c('0x3a');};exports[_0xdc5c('0x3b')]=function(_0x10561e,_0x4868fa,_0x1474cd,_0x3b7a9b,_0x125e1e){var _0x36d468=_0x3b7a9b?_0xdc5c('0x3c'):_0x10561e[_0xdc5c('0x19')];_0x36d468=_0x125e1e?_0xdc5c('0x3d'):_0x36d468;return{'actionid':_0x10561e[_0xdc5c('0x3e')],'action':'originate','channel':_0x10561e['channelAgent'],'callerid':util[_0xdc5c('0x13')](_0xdc5c('0x14'),_0x36d468,_0x10561e[_0xdc5c('0x1a')]),'Exten':_0xdc5c('0x3f'),'Context':_0xdc5c('0x40'),'Priority':'1','variable':_0x1474cd,'timeout':(_0x4868fa[_0xdc5c('0x41')]||0x1e)*0x3e8,'async':!![],'channelid':_0x10561e[_0xdc5c('0x3e')]};};exports[_0xdc5c('0x42')]=function(_0x4e5f0a){return _0x4e5f0a[_0xdc5c('0x43')]+_0x4e5f0a[_0xdc5c('0x44')]+_0x4e5f0a[_0xdc5c('0x45')]+_0x4e5f0a[_0xdc5c('0x46')]+_0x4e5f0a['countnosuchnumberretry'];};exports[_0xdc5c('0x47')]=function(_0x377b23){var _0x464f24=_[_0xdc5c('0x48')](_0x377b23);_0x464f24[_0xdc5c('0x31')]=0xf;_0x464f24['statedesc']=_0xdc5c('0x49');return _0x464f24;};exports[_0xdc5c('0x4a')]=function(_0x1bcb6f,_0x2cd0d2,_0x206aa6){var _0x220d57={};_0x220d57[_0x2cd0d2]=_0x1bcb6f[_0x2cd0d2];_0x220d57['active']=![];_0x220d57[_0xdc5c('0x4b')]=moment()[_0xdc5c('0x4c')](_0x206aa6,_0xdc5c('0x4d'))[_0xdc5c('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x220d57[_0xdc5c('0x1b')]=_0x1bcb6f['ContactId'];_0x220d57[_0xdc5c('0x4e')]=_0x1bcb6f[_0xdc5c('0x4e')];_0x220d57[_0xdc5c('0x4f')]=_0x1bcb6f['VoiceQueueId']||undefined;return _0x220d57;};exports[_0xdc5c('0x50')]=function(_0x497bca,_0x9d2789){if(!_['isNil'](_0x497bca)){if(_0x497bca['pTalking']>0x0){_0x497bca[_0xdc5c('0x51')]-=0x1;}else{logger[_0xdc5c('0xb')](_0x9d2789,_0xdc5c('0x52'));}}else{logger['error'](_0x9d2789,_0xdc5c('0x53'));}};exports['IsNotLoggedIn']=function(_0xf8e4ea){if(_0xf8e4ea<=0x0){return!![];}return![];};function buildObj(_0x27f00b,_0x46f350,_0x394649){_0x27f00b[_0xdc5c('0x54')]=_0x46f350;_0x27f00b['name']=_0x27f00b[_0xdc5c('0x55')];_0x27f00b['interface']=_0x27f00b['channelAgent'];_0x27f00b[_0xdc5c('0x56')]='voice';if(_0x394649){_0x27f00b[_0xdc5c('0x57')]=_0x394649[_0xdc5c('0x57')];}return _0x27f00b;}exports[_0xdc5c('0x58')]=buildObj;exports[_0xdc5c('0x59')]=function(_0x16d6f8){var _0x982e4f=[];for(var _0x43a733 in _0x16d6f8){if(_0x16d6f8[_0xdc5c('0x29')](_0x43a733)){if(!_[_0xdc5c('0x15')](_0x16d6f8[_0x43a733])&&_0x16d6f8[_0x43a733][_0xdc5c('0x31')]===_0xdc5c('0x5a')&&_0x16d6f8[_0x43a733]['status']==='reachable'){_0x982e4f[_0xdc5c('0x5b')](_0x16d6f8[_0x43a733]['id']);}}}return _0x982e4f;};exports[_0xdc5c('0x5c')]=function(_0x1f7d8a){var _0x2fef3b=moment()['milliseconds'](0x0);var _0x2684d9=moment(_0x1f7d8a)[_0xdc5c('0x5d')](0x0);return _0x2fef3b[_0xdc5c('0x5e')](_0x2684d9,_0xdc5c('0x5f'));};exports[_0xdc5c('0x60')]=function(_0x7a64fe){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x7a64fe[_0xdc5c('0x1b')],'ListId':_0x7a64fe[_0xdc5c('0x4e')],'VoiceQueueId':_0x7a64fe[_0xdc5c('0x4f')]||undefined,'CampaignId':_0x7a64fe['CampaignId']||undefined};};exports['filterKey']=function(_0x47f54f){if(_0x47f54f===_0xdc5c('0x3e')||_0x47f54f==='idContact'||_0x47f54f===_0xdc5c('0x55')||_0x47f54f===_0xdc5c('0x61')||_0x47f54f==='campaigntype'||_0x47f54f===_0xdc5c('0x62')||_0x47f54f===_0xdc5c('0x34')||_0x47f54f==='channelAgent'||_0x47f54f===_0xdc5c('0x19')||_0x47f54f===_0xdc5c('0x63')||_0x47f54f===_0xdc5c('0x1a')||_0x47f54f==='scheduledat'||_0x47f54f===_0xdc5c('0x43')||_0x47f54f==='countcongestionretry'||_0x47f54f==='countnoanswerretry'||_0x47f54f===_0xdc5c('0x64')||_0x47f54f===_0xdc5c('0x65')||_0x47f54f===_0xdc5c('0x66')||_0x47f54f===_0xdc5c('0x67')||_0x47f54f===_0xdc5c('0x68')||_0x47f54f===_0xdc5c('0x1b')||_0x47f54f==='ListId'||_0x47f54f==='UserId'||_0x47f54f===_0xdc5c('0x4f')||_0x47f54f===_0xdc5c('0x69')||_0x47f54f===_0xdc5c('0x6a')||_0x47f54f===_0xdc5c('0x6b')||_0x47f54f===_0xdc5c('0x6c')||_0x47f54f===_0xdc5c('0x6d')||_0x47f54f===_0xdc5c('0x6e')||_0x47f54f==='xmd-dialtimeout'||_0x47f54f===_0xdc5c('0x6f')||_0x47f54f===_0xdc5c('0x70')||_0x47f54f===_0xdc5c('0x71')||_0x47f54f===_0xdc5c('0x72')||_0x47f54f===_0xdc5c('0x73')||_0x47f54f===_0xdc5c('0x74')||_0x47f54f===_0xdc5c('0x75')||_0x47f54f===_0xdc5c('0x76')||_0x47f54f===_0xdc5c('0x77')||_0x47f54f===_0xdc5c('0x78')||_0x47f54f===_0xdc5c('0x79')||_0x47f54f===_0xdc5c('0x7a')||_0x47f54f===_0xdc5c('0x7b')||_0x47f54f===_0xdc5c('0x7c')||_0x47f54f===_0xdc5c('0x7d')||_0x47f54f==='rtpaudioqosrttbridged'||_0x47f54f==='rtpaudioqos'||_0x47f54f===_0xdc5c('0x78')||_0x47f54f===_0xdc5c('0x79')||_0x47f54f===_0xdc5c('0x7a')||_0x47f54f===_0xdc5c('0x7b')||_0x47f54f===_0xdc5c('0x7c')||_0x47f54f===_0xdc5c('0x7d')||_0x47f54f===_0xdc5c('0x7e')||_0x47f54f===_0xdc5c('0x7f')||_0x47f54f===_0xdc5c('0x80')||_0x47f54f==='state'||_0x47f54f==='statedesc'){return![];}return!![];};exports[_0xdc5c('0x81')]=function(_0x4cfe3f,_0x1078ad){var _0x32ce50,_0x4c409e,_0x582cd0;if(_0x1078ad<=0x0){_0x1078ad=0x1;}_0x32ce50=new RegExp(_0xdc5c('0x82')+_0x1078ad+'}$');_0x4c409e=Math[_0xdc5c('0x83')](0xa,_0x1078ad-0x1);_0x582cd0=Math[_0xdc5c('0x83')](0xa,_0x1078ad)-0x1;return util[_0xdc5c('0x13')]('%s',_[_0xdc5c('0x84')](_0x4cfe3f,_0x32ce50,_[_0xdc5c('0x85')](_0x4c409e,_0x582cd0)));};exports[_0xdc5c('0x86')]=function(_0x54830e){var _0x56f402=_0x54830e['match'](/"(.*?)"/);return _0x56f402?_0x56f402[0x1]:_0x54830e;};exports['extractCalleridNumber']=function(_0x34fbad){var _0x392e9b=_0x34fbad[_0xdc5c('0x87')](/<(.*?)>/);return _0x392e9b?_0x392e9b[0x1]:_0x34fbad;};function buildNoAnswerEventPayload(_0xc49a,_0x4e3d58){var _0x49adfe=buildObj(_0xc49a,'noanswer');if(!_[_0xdc5c('0x12')](_0x4e3d58[_0xdc5c('0x88')])){Object['keys'](_0x4e3d58[_0xdc5c('0x88')])[_0xdc5c('0x89')](function(_0x4d3703){_0x49adfe[_0x4d3703['toLowerCase']()]=_0x4e3d58[_0xdc5c('0x88')][_0x4d3703];});}return _0x49adfe;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index cb0e40d..8a5351b 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 _0x0dd5=['voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number','boolean','queueremove'];(function(_0x3cb4dc,_0x9232e7){var _0x618e42=function(_0x3a94bb){while(--_0x3a94bb){_0x3cb4dc['push'](_0x3cb4dc['shift']());}};_0x618e42(++_0x9232e7);}(_0x0dd5,0x1f4));var _0x50dd=function(_0x585788,_0x30ae13){_0x585788=_0x585788-0x0;var _0xec8cfe=_0x0dd5[_0x585788];return _0xec8cfe;};'use strict';exports['queueadd']={'queue':{'type':'string','required':!![]},'interface':{'type':_0x50dd('0x0'),'required':!![]},'membername':{'type':_0x50dd('0x0'),'required':!![]},'penalty':{'type':_0x50dd('0x1'),'required':![]},'paused':{'type':_0x50dd('0x2'),'required':![]}};exports[_0x50dd('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x50dd('0x0'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x50dd('0x0'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x50dd('0x0'),'required':![]}};exports['reload']={'module':{'type':_0x50dd('0x0'),'required':![]}};exports[_0x50dd('0x4')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x50dd('0x5')]={'uniqueid':{'type':_0x50dd('0x0'),'required':!![]},'filename':{'type':_0x50dd('0x0')},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x50dd('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x50dd('0x7')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x50dd('0x0'),'required':!![]},'context':{'type':_0x50dd('0x0')}}; \ No newline at end of file +var _0x0116=['queueremove','queuepause','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number','boolean'];(function(_0x16bd44,_0x3c91ba){var _0x368a61=function(_0x1c68ab){while(--_0x1c68ab){_0x16bd44['push'](_0x16bd44['shift']());}};_0x368a61(++_0x3c91ba);}(_0x0116,0xd5));var _0x6011=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x0116[_0x2235bf];return _0x4c3a64;};'use strict';exports['queueadd']={'queue':{'type':_0x6011('0x0'),'required':!![]},'interface':{'type':_0x6011('0x0'),'required':!![]},'membername':{'type':_0x6011('0x0'),'required':!![]},'penalty':{'type':_0x6011('0x1'),'required':![]},'paused':{'type':_0x6011('0x2'),'required':![]}};exports[_0x6011('0x3')]={'queue':{'type':_0x6011('0x0'),'required':!![]},'interface':{'type':_0x6011('0x0'),'required':!![]}};exports[_0x6011('0x4')]={'interface':{'type':_0x6011('0x0'),'required':!![]},'paused':{'type':_0x6011('0x2')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':'string','required':!![]}};exports[_0x6011('0x5')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':_0x6011('0x0')}};exports[_0x6011('0x6')]={'uniqueid':{'type':_0x6011('0x0'),'required':!![]}};exports[_0x6011('0x7')]={'uniqueid':{'type':_0x6011('0x0'),'required':!![]},'exten':{'type':_0x6011('0x0'),'required':!![]},'context':{'type':_0x6011('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 4e6bc27..bb37c67 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 _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x413484,_0x20f756){var _0x4eae0e=function(_0x3c791e){while(--_0x3c791e){_0x413484['push'](_0x413484['shift']());}};_0x4eae0e(++_0x20f756);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3e337e,_0x456bb4){_0x3e337e=_0x3e337e-0x0;var _0x4fd497=_0x5f2f[_0x3e337e];return _0x4fd497;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file +var _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x54183e,_0x1b7427){var _0x548360=function(_0x36d238){while(--_0x36d238){_0x54183e['push'](_0x54183e['shift']());}};_0x548360(++_0x1b7427);}(_0xb10b,0x12a));var _0xbb10=function(_0x34e725,_0x5633f8){_0x34e725=_0x34e725-0x0;var _0x57acc4=_0xb10b[_0x34e725];return _0x57acc4;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index e148ab0..ad72641 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 _0x7857=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x4a2555,_0x3df257){var _0x13c557=function(_0x762348){while(--_0x762348){_0x4a2555['push'](_0x4a2555['shift']());}};_0x13c557(++_0x3df257);}(_0x7857,0x1ab));var _0x7785=function(_0x14626e,_0x156043){_0x14626e=_0x14626e-0x0;var _0x20c419=_0x7857[_0x14626e];return _0x20c419;};'use strict';function mergeDBDataToRealtime(_0x45ea29,_0x4bc29b){var _0x9f0595=Object[_0x7785('0x0')]({},_0x45ea29);for(var _0x2bf4aa in _0x4bc29b){if(_0x9f0595[_0x7785('0x1')](_0x2bf4aa)){_0x9f0595[_0x2bf4aa]=_0x4bc29b[_0x2bf4aa];}}return _0x9f0595;}exports[_0x7785('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x29b2=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x13e457,_0x2aef82){var _0x202f32=function(_0x27426e){while(--_0x27426e){_0x13e457['push'](_0x13e457['shift']());}};_0x202f32(++_0x2aef82);}(_0x29b2,0x1ea));var _0x229b=function(_0x2b8a0b,_0x3bcb60){_0x2b8a0b=_0x2b8a0b-0x0;var _0x3ae5ec=_0x29b2[_0x2b8a0b];return _0x3ae5ec;};'use strict';function mergeDBDataToRealtime(_0x186c8b,_0x3f82da){var _0x37f261=Object[_0x229b('0x0')]({},_0x186c8b);for(var _0x2a79b8 in _0x3f82da){if(_0x37f261[_0x229b('0x1')](_0x2a79b8)){_0x37f261[_0x2a79b8]=_0x3f82da[_0x2a79b8];}}return _0x37f261;}exports[_0x229b('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 0eeb704..4fe35bb 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 _0x74cc=['originatecalleridnum','destinationchannel','channel','callerid','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','UserId','membername','monitor','monitors','monitorFilename','createdAt','exten','connectedlinename','xcally-motion-dialer','create','isArray','forEach','substring','indexOf','phone','lastIndexOf','transfererlinkedid','attendedTransfer','exports','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','findAgent','find','accountcode','interface','format','SIP/%s','name','voiceQueueReport','length','connectedlinenum','lastAssignedTo','isNil','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','match','getAgentByInternal','keys','getCallType','split','calleridnum','internal','destination','type','dialer','lastdata','queue','context','from-sip','xcally-motion-preview','calleridpreview'];(function(_0x5ebcfe,_0x5bfd49){var _0x5f32aa=function(_0x2cdca0){while(--_0x2cdca0){_0x5ebcfe['push'](_0x5ebcfe['shift']());}};_0x5f32aa(++_0x5bfd49);}(_0x74cc,0x78));var _0xc74c=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x74cc[_0x2763f2];return _0x3ef471;};'use strict';var _=require('lodash');var moment=require(_0xc74c('0x0'));var util=require(_0xc74c('0x1'));var config=require(_0xc74c('0x2'));var ami=require(_0xc74c('0x3'));var RpcVoiceAgentReport=require(_0xc74c('0x4'));var RpcVoiceCallReport=require(_0xc74c('0x5'));var RpcVoiceDialReport=require(_0xc74c('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xc74c('0x7'));var RpcVoiceRecording=require(_0xc74c('0x8'));var RpcVoiceTransferReport=require(_0xc74c('0x9'));var VoiceQueueReport=require(_0xc74c('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xc74c('0xb'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xc74c('0xc'));function Report(_0x2f22cd){this[_0xc74c('0xd')]=_0x2f22cd;this['agents']=_0x2f22cd[_0xc74c('0xe')];this[_0xc74c('0xf')]=_0x2f22cd[_0xc74c('0xf')];}Report[_0xc74c('0x10')][_0xc74c('0x11')]=function(_0x5898f0){var _0x4faacb=new VoiceQueueReport(this[_0xc74c('0xd')]);var _0xbbc702=new VoiceAgentReport(this[_0xc74c('0xd')]);var _0x3c419a=new VoiceDialReport(this[_0xc74c('0xd')]);var _0x516d24=new VoiceCallReport(this[_0xc74c('0xd')]);var _0x2794dd=new UserReport(this[_0xc74c('0xd')]);if(config['xdr']&&config[_0xc74c('0x12')][_0xc74c('0x13')]){ami['on'](_0xc74c('0x14'),this['voiceQueueReport'][_0xc74c('0x15')](this));ami['on']('custom:voiceCallReport',this[_0xc74c('0x16')]['bind'](this));ami['on'](_0xc74c('0x17'),this[_0xc74c('0x18')][_0xc74c('0x15')](this));ami['on'](_0xc74c('0x19'),this[_0xc74c('0x1a')]['bind'](this));ami['on'](_0xc74c('0x1b'),this[_0xc74c('0x1c')][_0xc74c('0x15')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0xc74c('0x15')](this));}};Report['prototype'][_0xc74c('0x1d')]=function(_0x1dfbe2){var _0x3655e5;_0x3655e5=_['find'](this[_0xc74c('0xe')],function(_0x608928){return _0x608928['accountcode']==_0x1dfbe2||_0x608928['name']==_0x1dfbe2;});if(_['isNil'](_0x3655e5)){var _0x27745c=_[_0xc74c('0x1e')](this[_0xc74c('0xf')],function(_0x115997){return _0x115997[_0xc74c('0x1f')]==_0x1dfbe2||_0x115997['name']==_0x1dfbe2;});if(_0x27745c){_0x3655e5=_[_0xc74c('0x1e')](this['agents'],function(_0x1093a9){return _0x1093a9[_0xc74c('0x20')]==util[_0xc74c('0x21')](_0xc74c('0x22'),_0x27745c[_0xc74c('0x23')]);});}}return _0x3655e5;};Report[_0xc74c('0x10')][_0xc74c('0x24')]=function(_0x5b44db){for(var _0x190efa=0x0;_0x190efa<_0x5b44db[_0xc74c('0x25')];_0x190efa+=0x1){var _0x16f2f3=this[_0xc74c('0x1d')](_0x5b44db[_0x190efa][_0xc74c('0x26')]);if(_0x16f2f3){_0x5b44db[_0x190efa]['accountcode']=_0x16f2f3[_0xc74c('0x1f')];_0x5b44db[_0x190efa]['assigned']=!![];_0x5b44db[_0x190efa][_0xc74c('0x27')]=_0x16f2f3[_0xc74c('0x23')];_0x5b44db[_0x190efa][_0xc74c('0x20')]=_[_0xc74c('0x28')](_0x16f2f3[_0xc74c('0x20')])?util[_0xc74c('0x21')]('SIP/%s',_0x16f2f3[_0xc74c('0x23')]):_0x16f2f3[_0xc74c('0x20')];if(_0x5b44db[_0x190efa][_0xc74c('0x29')]){_0x5b44db[_0x190efa]['queuecallercompleteAt']=moment()[_0xc74c('0x21')](_0xc74c('0x2a'));}if(_0x5b44db[_0x190efa][_0xc74c('0x2b')]){_0x5b44db[_0x190efa]['queuecallerexitAt']=moment()[_0xc74c('0x21')](_0xc74c('0x2a'));}RpcMemberReport[_0xc74c('0x24')](_0x5b44db[_0x190efa]);}RpcVoiceQueueReport['create'](_0x5b44db[_0x190efa]);}};function extractCalleridNumber(_0x59c00c){var _0x1e5830=_0x59c00c[_0xc74c('0x2c')](/<(.*?)>/);return _0x1e5830?_0x1e5830[0x1]:_0x59c00c;}Report[_0xc74c('0x10')][_0xc74c('0x2d')]=function(_0x4c68e7){for(var _0x1d2fa0=0x0;_0x1d2fa0','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','monitorFilename','monitors','filename','createdAt','connectedlinename','voiceAgentReport','isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','prototype','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','blindTransfer','attendedTransfer','findAgent','find','accountcode'];(function(_0x49c7d1,_0x203a7d){var _0x2f88d7=function(_0x29b582){while(--_0x29b582){_0x49c7d1['push'](_0x49c7d1['shift']());}};_0x2f88d7(++_0x203a7d);}(_0x5462,0x1b9));var _0x2546=function(_0xd4636c,_0x34dbf6){_0xd4636c=_0xd4636c-0x0;var _0x5ee17d=_0x5462[_0xd4636c];return _0x5ee17d;};'use strict';var _=require(_0x2546('0x0'));var moment=require(_0x2546('0x1'));var util=require(_0x2546('0x2'));var config=require(_0x2546('0x3'));var ami=require(_0x2546('0x4'));var RpcVoiceAgentReport=require(_0x2546('0x5'));var RpcVoiceCallReport=require(_0x2546('0x6'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x2546('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x2546('0x8'));var VoiceQueueReport=require(_0x2546('0x9'));var VoiceCallReport=require(_0x2546('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x2546('0xb'));var UserReport=require(_0x2546('0xc'));function Report(_0x3f3308){this[_0x2546('0xd')]=_0x3f3308;this[_0x2546('0xe')]=_0x3f3308['agents'];this['telephones']=_0x3f3308['telephones'];}Report[_0x2546('0xf')][_0x2546('0x10')]=function(_0x366752){var _0x5205e5=new VoiceQueueReport(this[_0x2546('0xd')]);var _0x337427=new VoiceAgentReport(this[_0x2546('0xd')]);var _0x170628=new VoiceDialReport(this[_0x2546('0xd')]);var _0xddb8b8=new VoiceCallReport(this['realtime']);var _0x45fb0b=new UserReport(this['realtime']);if(config[_0x2546('0x11')]&&config[_0x2546('0x11')][_0x2546('0x12')]){ami['on']('custom:voiceQueueReport',this[_0x2546('0x13')][_0x2546('0x14')](this));ami['on'](_0x2546('0x15'),this['voiceCallReport'][_0x2546('0x14')](this));ami['on'](_0x2546('0x16'),this['voiceAgentReport']['bind'](this));ami['on'](_0x2546('0x17'),this['voiceDialReport'][_0x2546('0x14')](this));ami['on']('blindtransfer',this[_0x2546('0x18')][_0x2546('0x14')](this));ami['on']('attendedtransfer',this[_0x2546('0x19')][_0x2546('0x14')](this));}};Report[_0x2546('0xf')][_0x2546('0x1a')]=function(_0x318ee6){var _0xc4db9a;_0xc4db9a=_[_0x2546('0x1b')](this['agents'],function(_0xfbe468){return _0xfbe468[_0x2546('0x1c')]==_0x318ee6||_0xfbe468[_0x2546('0x1d')]==_0x318ee6;});if(_['isNil'](_0xc4db9a)){var _0x18129a=_[_0x2546('0x1b')](this['telephones'],function(_0x5ad4c0){return _0x5ad4c0['accountcode']==_0x318ee6||_0x5ad4c0[_0x2546('0x1d')]==_0x318ee6;});if(_0x18129a){_0xc4db9a=_[_0x2546('0x1b')](this[_0x2546('0xe')],function(_0x193853){return _0x193853[_0x2546('0x1e')]==util[_0x2546('0x1f')]('SIP/%s',_0x18129a['name']);});}}return _0xc4db9a;};Report['prototype'][_0x2546('0x13')]=function(_0x5cb77a){for(var _0x1a8eeb=0x0;_0x1a8eeb<_0x5cb77a[_0x2546('0x20')];_0x1a8eeb+=0x1){var _0x3b3fb9=this[_0x2546('0x1a')](_0x5cb77a[_0x1a8eeb][_0x2546('0x21')]);if(_0x3b3fb9){_0x5cb77a[_0x1a8eeb][_0x2546('0x1c')]=_0x3b3fb9[_0x2546('0x1c')];_0x5cb77a[_0x1a8eeb][_0x2546('0x22')]=!![];_0x5cb77a[_0x1a8eeb][_0x2546('0x23')]=_0x3b3fb9[_0x2546('0x1d')];_0x5cb77a[_0x1a8eeb][_0x2546('0x1e')]=_[_0x2546('0x24')](_0x3b3fb9[_0x2546('0x1e')])?util['format'](_0x2546('0x25'),_0x3b3fb9[_0x2546('0x1d')]):_0x3b3fb9[_0x2546('0x1e')];if(_0x5cb77a[_0x1a8eeb][_0x2546('0x26')]){_0x5cb77a[_0x1a8eeb][_0x2546('0x27')]=moment()[_0x2546('0x1f')](_0x2546('0x28'));}if(_0x5cb77a[_0x1a8eeb][_0x2546('0x29')]){_0x5cb77a[_0x1a8eeb][_0x2546('0x2a')]=moment()[_0x2546('0x1f')](_0x2546('0x28'));}RpcMemberReport['voiceQueueReport'](_0x5cb77a[_0x1a8eeb]);}RpcVoiceQueueReport[_0x2546('0x2b')](_0x5cb77a[_0x1a8eeb]);}};function extractCalleridNumber(_0x3d7b81){var _0x22866e=_0x3d7b81[_0x2546('0x2c')](/<(.*?)>/);return _0x22866e?_0x22866e[0x1]:_0x3d7b81;}Report[_0x2546('0xf')][_0x2546('0x2d')]=function(_0x24d532){for(var _0x2b5db8=0x0;_0x2b5db8{delete this[_0x09cc('0xd')][_0x136813];},_0x20f88f);}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xd53a=['syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','interface','queue','format','YYYY-MM-DD\x20HH:mm:ss','mandatoryDisposition','type','inbound','assign','omit','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','membername','error','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','merge','pick','destconnectedlinenum','accountcode','exten','custom:agentconnect','user:agentconnect','agentringnoanswer','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','lastevent','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','name','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','transfer','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','agentcompleteAt','values','custom:voiceAgentReport','deleteChannelAfterTimeout','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','moment','util','ioredis','../../../config/logger','ami','../ami','redis','defaults','localhost','channels','voiceChannels','voiceQueues','agents','variables','agentconnect','syncAgentConnect','bind','syncAgentRingNoAnswer','queuecallerabandon','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart'];(function(_0xe13fd7,_0x58cae1){var _0x441cae=function(_0x5413b4){while(--_0x5413b4){_0xe13fd7['push'](_0xe13fd7['shift']());}};_0x441cae(++_0x58cae1);}(_0xd53a,0x123));var _0xad53=function(_0x419347,_0x36e5f4){_0x419347=_0x419347-0x0;var _0x218206=_0xd53a[_0x419347];return _0x218206;};'use strict';var _=require('lodash');var moment=require(_0xad53('0x0'));var util=require(_0xad53('0x1'));var Redis=require(_0xad53('0x2'));var config=require('../../../config/environment');var logger=require(_0xad53('0x3'))(_0xad53('0x4'));var ami=require(_0xad53('0x5'));config[_0xad53('0x6')]=_[_0xad53('0x7')](config[_0xad53('0x6')],{'host':_0xad53('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xad53('0x6')]));function VoiceAgentReport(_0x1d548f){this[_0xad53('0x9')]={};this[_0xad53('0xa')]=_0x1d548f[_0xad53('0x9')];this[_0xad53('0xb')]=_0x1d548f['voiceQueues'];this[_0xad53('0xc')]=_0x1d548f[_0xad53('0xc')];this[_0xad53('0xd')]={};ami['on']('agentcalled',this['syncAgentCalled']['bind'](this));ami['on'](_0xad53('0xe'),this[_0xad53('0xf')][_0xad53('0x10')](this));ami['on']('agentringnoanswer',this[_0xad53('0x11')]['bind'](this));ami['on'](_0xad53('0x12'),this['syncQueueCallerAbandon'][_0xad53('0x10')](this));ami['on']('agentcomplete',this[_0xad53('0x13')][_0xad53('0x10')](this));ami['on'](_0xad53('0x14'),this[_0xad53('0x15')][_0xad53('0x10')](this));ami['on'](_0xad53('0x16'),this[_0xad53('0x17')]['bind'](this));ami['on'](_0xad53('0x18'),this[_0xad53('0x19')]['bind'](this));ami['on'](_0xad53('0x1a'),this[_0xad53('0x1b')][_0xad53('0x10')](this));ami['on'](_0xad53('0x1c'),this['syncAttendedTransfer'][_0xad53('0x10')](this));ami['on'](_0xad53('0x1d'),this[_0xad53('0x1e')][_0xad53('0x10')](this));}VoiceAgentReport[_0xad53('0x1f')][_0xad53('0x20')]=function(_0x19800e,_0x14e8b1,_0x25f2cd){io['to'](_0x19800e)[_0xad53('0x20')](_0x14e8b1,_0x25f2cd);};VoiceAgentReport['prototype'][_0xad53('0x21')]=function(_0xfef1a2){return _0xfef1a2!==null&&!_[_0xad53('0x22')](_0xfef1a2);};VoiceAgentReport[_0xad53('0x1f')]['syncAgentCalled']=function(_0xb85b89){try{if(this[_0xad53('0x21')](_0xb85b89)){logger[_0xad53('0x23')](_0xad53('0x24'),_0xb85b89['uniqueid'],_0xb85b89['membername'],_0xb85b89[_0xad53('0x25')]);logger[_0xad53('0x26')](_0xad53('0x27'),_0xb85b89['uniqueid'],util[_0xad53('0x28')](_0xb85b89,{'showHidden':![],'depth':null}));if(_[_0xad53('0x22')](this[_0xad53('0x9')][_0xb85b89[_0xad53('0x29')]])){this[_0xad53('0x9')][_0xb85b89[_0xad53('0x29')]]={};}var _0x465d7a=this[_0xad53('0xc')][_0xb85b89[_0xad53('0x2a')]];var _0x1069d9=this[_0xad53('0x9')][_0xb85b89[_0xad53('0x29')]][_0xb85b89['destuniqueid']];var _0x232799=this[_0xad53('0xb')][_0xb85b89[_0xad53('0x2b')]];var _0x50ab53=this['variables'][_0xb85b89[_0xad53('0x29')]];if(_['isUndefined'](_0x1069d9)){_0x1069d9={'agentcalledAt':moment()[_0xad53('0x2c')](_0xad53('0x2d')),'lastevent':'called','mandatoryDisposition':_0x232799&&_0x232799[_0xad53('0x2e')]?_0x232799[_0xad53('0x2e')]:![],'type':_0x232799&&_0x232799[_0xad53('0x2f')]?_0x232799[_0xad53('0x2f')]:_0xad53('0x30'),'variables':_0x50ab53,'motionChannel':'voice'};}Object[_0xad53('0x31')](_0x1069d9,_[_0xad53('0x32')](_0xb85b89,['event',_0xad53('0x33')]));this[_0xad53('0x9')][_0xb85b89[_0xad53('0x29')]][_0xb85b89[_0xad53('0x25')]]=_0x1069d9;logger['debug'](_0xad53('0x34'),_0xb85b89[_0xad53('0x29')],util[_0xad53('0x28')](_0x1069d9,{'showHidden':![],'depth':null}));ami['emit'](_0xad53('0x35'),_0x1069d9);var _0x2e3597={'id':_0x465d7a['id'],'calleridnum':_0x1069d9[_0xad53('0x36')],'queue':_0x1069d9[_0xad53('0x2b')],'variables':_0x1069d9[_0xad53('0xd')],'uniqueid':_0xb85b89['uniqueid']};logger['debug'](_0xad53('0x37'),_0xb85b89[_0xad53('0x29')],util[_0xad53('0x28')](_0x2e3597,{'showHidden':![],'depth':null}));this[_0xad53('0x20')](util['format'](_0xad53('0x38'),_0xb85b89[_0xad53('0x39')]),'user:called',_0x2e3597);}}catch(_0x28c991){logger[_0xad53('0x3a')]('[%s][voiceAgentReport][agentcalled]',_0xb85b89['uniqueid'],util[_0xad53('0x28')](_0x28c991,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xad53('0x1f')][_0xad53('0xf')]=function(_0xdb1801){try{if(this['isNotNull'](_0xdb1801)){if(this[_0xad53('0x9')][_0xdb1801['uniqueid']]){for(var _0x52edb4 in this[_0xad53('0x9')][_0xdb1801['uniqueid']]){if(this[_0xad53('0x9')][_0xdb1801[_0xad53('0x29')]][_0xad53('0x3b')](_0x52edb4)){if(_0xdb1801[_0xad53('0x25')]===_0x52edb4){logger[_0xad53('0x23')](_0xad53('0x3c'),_0xdb1801[_0xad53('0x29')],_0xdb1801[_0xad53('0x39')],_0xdb1801['destuniqueid']);this['channels'][_0xdb1801[_0xad53('0x29')]][_0x52edb4][_0xad53('0x3d')]=moment()[_0xad53('0x2c')](_0xad53('0x2d'));this[_0xad53('0x9')][_0xdb1801[_0xad53('0x29')]][_0x52edb4]['connectedlinename']=_0xdb1801[_0xad53('0x3e')];this[_0xad53('0x9')][_0xdb1801[_0xad53('0x29')]][_0x52edb4]['connectedlinenum']=_0xdb1801[_0xad53('0x3f')];this[_0xad53('0x9')][_0xdb1801[_0xad53('0x29')]][_0x52edb4][_0xad53('0x40')]=_0xdb1801[_0xad53('0x40')];this[_0xad53('0x9')][_0xdb1801[_0xad53('0x29')]][_0x52edb4][_0xad53('0x41')]=_0xdb1801[_0xad53('0x41')];this[_0xad53('0x9')][_0xdb1801[_0xad53('0x29')]][_0x52edb4][_0xad53('0x42')]=_0xdb1801[_0xad53('0x42')];this['channels'][_0xdb1801[_0xad53('0x29')]][_0x52edb4]['lastevent']='connect';_[_0xad53('0x43')](this[_0xad53('0xc')][_0xdb1801[_0xad53('0x2a')]],_[_0xad53('0x44')](_0xdb1801,['queue',_0xad53('0x45')]));var _0x1a9f5a=this[_0xad53('0xc')][_0xdb1801[_0xad53('0x2a')]];var _0x2daaf7={'id':_0x1a9f5a['id'],'name':_0x1a9f5a['name'],'agentconnected':!![],'destaccountcode':_0x1a9f5a[_0xad53('0x46')],'destconnectedlinenum':this['channels'][_0xdb1801['uniqueid']][_0xdb1801[_0xad53('0x25')]][_0xad53('0x47')],'queue':this[_0xad53('0x9')][_0xdb1801[_0xad53('0x29')]][_0xdb1801[_0xad53('0x25')]][_0xad53('0x2b')],'uniqueid':this[_0xad53('0x9')][_0xdb1801[_0xad53('0x29')]][_0xdb1801[_0xad53('0x25')]]['uniqueid']};ami[_0xad53('0x20')](_0xad53('0x48'),this[_0xad53('0x9')][_0xdb1801['uniqueid']][_0xdb1801[_0xad53('0x25')]]);this[_0xad53('0x20')](util[_0xad53('0x2c')](_0xad53('0x38'),_0xdb1801[_0xad53('0x39')]),_0xad53('0x49'),_0x2daaf7);}else if(!this[_0xad53('0x9')][_0xdb1801['uniqueid']][_0x52edb4][_0xad53('0x4a')]&&!this['channels'][_0xdb1801['uniqueid']][_0x52edb4][_0xad53('0x4b')]){logger[_0xad53('0x23')](_0xad53('0x4c'),_0xdb1801[_0xad53('0x29')],this[_0xad53('0x9')][_0xdb1801[_0xad53('0x29')]][_0x52edb4][_0xad53('0x39')],_0x52edb4);this[_0xad53('0x9')][_0xdb1801[_0xad53('0x29')]][_0x52edb4]['agentringnoanswer']=!![];this[_0xad53('0x9')][_0xdb1801[_0xad53('0x29')]][_0x52edb4][_0xad53('0x4d')]=moment()['format'](_0xad53('0x2d'));this[_0xad53('0x9')][_0xdb1801['uniqueid']][_0x52edb4][_0xad53('0x4e')]=_0xdb1801['destuniqueid'];this[_0xad53('0x9')][_0xdb1801[_0xad53('0x29')]][_0x52edb4][_0xad53('0x4f')]=_0xdb1801[_0xad53('0x39')];this[_0xad53('0x9')][_0xdb1801[_0xad53('0x29')]][_0x52edb4][_0xad53('0x50')]=_0xad53('0x51');this[_0xad53('0x9')][_0xdb1801[_0xad53('0x29')]][_0x52edb4]['reason']=_0xad53('0x51');logger[_0xad53('0x26')](_0xad53('0x52'),_0xdb1801[_0xad53('0x29')],util[_0xad53('0x28')](this[_0xad53('0x9')][_0xdb1801['uniqueid']][_0x52edb4],{'showHidden':![],'depth':null}));ami[_0xad53('0x20')](_0xad53('0x53'),this[_0xad53('0x9')][_0xdb1801[_0xad53('0x29')]][_0x52edb4]);}else{logger[_0xad53('0x26')]('[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken',_0xdb1801[_0xad53('0x29')]);}}}}}}catch(_0x13a44c){logger[_0xad53('0x3a')](_0xad53('0x54'),_0xdb1801['uniqueid'],util[_0xad53('0x28')](_0x13a44c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xad53('0x1f')][_0xad53('0x11')]=function(_0x126645){try{if(this[_0xad53('0x21')](_0x126645)){logger[_0xad53('0x26')](_0xad53('0x55'),_0x126645['uniqueid'],util['inspect'](_0x126645,{'showHidden':![],'depth':null}));if(this['channels'][_0x126645[_0xad53('0x29')]]&&this[_0xad53('0x9')][_0x126645[_0xad53('0x29')]][_0x126645[_0xad53('0x25')]]){logger[_0xad53('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x126645[_0xad53('0x29')],_0x126645['membername'],_0x126645[_0xad53('0x25')]);var _0xc395c1=this[_0xad53('0xc')][_0x126645['interface']];var _0xf815a5=this[_0xad53('0x9')][_0x126645[_0xad53('0x29')]][_0x126645[_0xad53('0x25')]];_0xf815a5[_0xad53('0x4a')]=!![];_0xf815a5[_0xad53('0x4d')]=moment()['format'](_0xad53('0x2d'));_0xf815a5[_0xad53('0x50')]=_0xad53('0x56');_0xf815a5['reason']=_0xad53('0x56');var _0x4f19c2={'id':_0xc395c1['id'],'name':_0xc395c1['name'],'queue':_0xf815a5[_0xad53('0x2b')],'uniqueid':_0xf815a5['uniqueid']};logger[_0xad53('0x26')](_0xad53('0x57'),_0x126645[_0xad53('0x29')],util[_0xad53('0x28')](_0x4f19c2,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xad53('0x38'),_0xc395c1[_0xad53('0x58')]),_0xad53('0x59'),_0x4f19c2);ami[_0xad53('0x20')](_0xad53('0x5a'),_0xf815a5);this[_0xad53('0x9')][_0x126645[_0xad53('0x29')]][_0x126645['destuniqueid']]=Object['assign']({},_0xf815a5);}}}catch(_0x1a2fa3){logger[_0xad53('0x3a')](_0xad53('0x5b'),_0x126645[_0xad53('0x29')],util[_0xad53('0x28')](_0x1a2fa3,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xad53('0x5c')]=function(_0x2706c6){try{if(this[_0xad53('0x21')](_0x2706c6)){logger[_0xad53('0x26')](_0xad53('0x5d'),_0x2706c6[_0xad53('0x29')],util[_0xad53('0x28')](_0x2706c6,{'showHidden':![],'depth':null}));if(this[_0xad53('0x9')][_0x2706c6[_0xad53('0x29')]]){for(var _0x2f7abf in this['channels'][_0x2706c6['uniqueid']]){if(this[_0xad53('0x9')][_0x2706c6[_0xad53('0x29')]][_0xad53('0x3b')](_0x2f7abf)&&!this[_0xad53('0x9')][_0x2706c6['uniqueid']][_0x2f7abf][_0xad53('0x4a')]&&!this[_0xad53('0x9')][_0x2706c6[_0xad53('0x29')]][_0x2f7abf]['agentcomplete']){logger[_0xad53('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2706c6['uniqueid'],this[_0xad53('0x9')][_0x2706c6['uniqueid']][_0x2f7abf][_0xad53('0x39')],_0x2f7abf);this['channels'][_0x2706c6[_0xad53('0x29')]][_0x2f7abf][_0xad53('0x4a')]=!![];this['channels'][_0x2706c6[_0xad53('0x29')]][_0x2f7abf][_0xad53('0x4d')]=moment()[_0xad53('0x2c')](_0xad53('0x2d'));this[_0xad53('0x9')][_0x2706c6[_0xad53('0x29')]][_0x2f7abf][_0xad53('0x50')]=_0xad53('0x5e');this[_0xad53('0x9')][_0x2706c6[_0xad53('0x29')]][_0x2f7abf][_0xad53('0x5f')]=_0xad53('0x5e');logger['debug'](_0xad53('0x60'),_0x2706c6[_0xad53('0x29')],util['inspect'](this['channels'][_0x2706c6['uniqueid']][_0x2f7abf],{'showHidden':![],'depth':null}));ami[_0xad53('0x20')](_0xad53('0x61'),this[_0xad53('0x9')][_0x2706c6[_0xad53('0x29')]][_0x2f7abf]);}}}}}catch(_0x6c5d62){logger[_0xad53('0x3a')](_0xad53('0x62'),_0x2706c6[_0xad53('0x29')],util[_0xad53('0x28')](_0x6c5d62,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xad53('0x13')]=function(_0x2c5d0b){try{if(this[_0xad53('0x21')](_0x2c5d0b)){logger[_0xad53('0x26')](_0xad53('0x63'),_0x2c5d0b[_0xad53('0x29')],util[_0xad53('0x28')](_0x2c5d0b,{'showHidden':![],'depth':null}));if(this['channels'][_0x2c5d0b[_0xad53('0x29')]]){for(var _0x3b8028 in this[_0xad53('0x9')][_0x2c5d0b['uniqueid']]){if(this[_0xad53('0x9')][_0x2c5d0b[_0xad53('0x29')]][_0xad53('0x3b')](_0x3b8028)){if(this[_0xad53('0x9')][_0x2c5d0b['uniqueid']][_0x3b8028]['agentconnectAt']&&!this[_0xad53('0x9')][_0x2c5d0b[_0xad53('0x29')]][_0x3b8028][_0xad53('0x4b')]){logger[_0xad53('0x23')](_0xad53('0x64'),_0x2c5d0b[_0xad53('0x29')],this['channels'][_0x2c5d0b['uniqueid']][_0x3b8028][_0xad53('0x39')],_0x3b8028);this['channels'][_0x2c5d0b[_0xad53('0x29')]][_0x3b8028][_0xad53('0x4b')]=!![];this[_0xad53('0x9')][_0x2c5d0b[_0xad53('0x29')]][_0x3b8028]['agentcompleteAt']=moment()[_0xad53('0x2c')](_0xad53('0x2d'));this['channels'][_0x2c5d0b['uniqueid']][_0x3b8028]['lastevent']=_0xad53('0x65');this[_0xad53('0x9')][_0x2c5d0b[_0xad53('0x29')]][_0x3b8028][_0xad53('0x5f')]=_0x2c5d0b[_0xad53('0x5f')]==_0xad53('0x66')?'agent':_0x2c5d0b['reason'];this[_0xad53('0x9')][_0x2c5d0b[_0xad53('0x29')]][_0x3b8028][_0xad53('0x67')]=_0x2c5d0b[_0xad53('0x67')];if(this['voiceQueues'][_0x2c5d0b[_0xad53('0x2b')]]&&this['voiceQueues'][_0x2c5d0b['queue']][_0xad53('0x68')]){this['channels'][_0x2c5d0b['uniqueid']][_0x3b8028][_0xad53('0x69')]=this['voiceQueues'][_0x2c5d0b[_0xad53('0x2b')]][_0xad53('0x6a')];this[_0xad53('0x9')][_0x2c5d0b[_0xad53('0x29')]][_0x3b8028][_0xad53('0x6b')]=!![];}this['agents'][_0x2c5d0b[_0xad53('0x2a')]]=_[_0xad53('0x32')](this[_0xad53('0xc')][_0x2c5d0b[_0xad53('0x2a')]],[_0xad53('0x2b'),'destconnectedlinenum']);logger[_0xad53('0x26')](_0xad53('0x6c'),_0x2c5d0b['uniqueid'],util[_0xad53('0x28')](this['channels'][_0x2c5d0b[_0xad53('0x29')]][_0x3b8028],{'showHidden':![],'depth':null}));ami[_0xad53('0x20')](_0xad53('0x6d'),this[_0xad53('0x9')][_0x2c5d0b['uniqueid']][_0x3b8028]);logger[_0xad53('0x26')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x2c5d0b['uniqueid'],util[_0xad53('0x28')]({'id':this['agents'][_0x2c5d0b[_0xad53('0x2a')]]['id'],'destaccountcode':_0x2c5d0b[_0xad53('0x6e')]},{'showHidden':![],'depth':null}));this[_0xad53('0x20')](util[_0xad53('0x2c')](_0xad53('0x38'),_0x2c5d0b['membername']),_0xad53('0x6f'),{'id':this[_0xad53('0xc')][_0x2c5d0b['interface']]['id'],'destaccountcode':Number(_0x2c5d0b[_0xad53('0x6e')])});}}}}}}catch(_0x3e325b){logger['error']('[%s][voiceAgentReport][agentcomplete]',_0x2c5d0b['uniqueid'],util[_0xad53('0x28')](_0x3e325b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xad53('0x1f')][_0xad53('0x15')]=function(_0x124c7a){try{if(this[_0xad53('0x21')](_0x124c7a)){logger[_0xad53('0x26')](_0xad53('0x70'),_0x124c7a[_0xad53('0x29')],util[_0xad53('0x28')](_0x124c7a,{'showHidden':![],'depth':null}));this[_0xad53('0x71')](_0x124c7a['uniqueid'],_['keys'](_0x124c7a[_0xad53('0x72')])[0x0],_0x124c7a[_0xad53('0x73')]);if(this['channels'][_0x124c7a[_0xad53('0x29')]]){for(var _0x2b487e in this['channels'][_0x124c7a['uniqueid']]){if(this['channels'][_0x124c7a[_0xad53('0x29')]][_0xad53('0x3b')](_0x2b487e)){logger[_0xad53('0x23')](_0xad53('0x74'),_0x124c7a[_0xad53('0x29')],_0x2b487e,_[_0xad53('0x75')](_0x124c7a[_0xad53('0x72')])[0x0],_0x124c7a[_0xad53('0x73')]);if(_[_0xad53('0x22')](this[_0xad53('0x9')][_0x124c7a[_0xad53('0x29')]][_0x2b487e]['variables'])){this['channels'][_0x124c7a[_0xad53('0x29')]][_0x2b487e][_0xad53('0xd')]={};}this[_0xad53('0x9')][_0x124c7a[_0xad53('0x29')]][_0x2b487e][_0xad53('0xd')]=this[_0xad53('0xd')][_0x124c7a[_0xad53('0x29')]];}}}}}catch(_0x2c3a76){logger['error']('[%s][voiceAgentReport][varset]',_0x124c7a['uniqueid'],util[_0xad53('0x28')](_0x2c3a76,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xad53('0x1f')]['addVariable']=function(_0x58f622,_0x42eee1,_0x53460e){var _0x5c9358=[_0xad53('0x76'),_0xad53('0x77'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0xad53('0x78'),_0xad53('0x79'),_0xad53('0x7a'),_0xad53('0x7b'),'sipcallid','sipuri',_0xad53('0x7c'),_0xad53('0x7d'),'membercalls',_0xad53('0x7e'),_0xad53('0x7f'),_0xad53('0x80'),'membername',_0xad53('0x81'),_0xad53('0x82')];if(!_['isNil'](_0x42eee1)&&!_[_0xad53('0x83')](_0x5c9358,_0x42eee1)){if(_[_0xad53('0x22')](this['variables'][_0x58f622])){this[_0xad53('0xd')][_0x58f622]={};}this['variables'][_0x58f622][_0x42eee1]=_0x53460e;}};VoiceAgentReport['prototype']['syncHangup']=function(_0xcac942){try{if(this[_0xad53('0x21')](_0xcac942)){logger[_0xad53('0x26')](_0xad53('0x84'),_0xcac942[_0xad53('0x29')],util['inspect'](_0xcac942,{'showHidden':![],'depth':null}));if(this['channels'][_0xcac942[_0xad53('0x29')]]){for(var _0x2da0f2 in this[_0xad53('0x9')][_0xcac942[_0xad53('0x29')]]){if(this[_0xad53('0x9')][_0xcac942[_0xad53('0x29')]][_0xad53('0x3b')](_0x2da0f2)){if(this['channels'][_0xcac942[_0xad53('0x29')]][_0x2da0f2]['reason']==_0xad53('0x66')&&this['channels'][_0xcac942[_0xad53('0x29')]][_0x2da0f2][_0xad53('0x4b')]){logger['info'](_0xad53('0x85'),_0xcac942[_0xad53('0x29')],_0x2da0f2);this['channels'][_0xcac942['uniqueid']][_0x2da0f2][_0xad53('0x86')]=moment()[_0xad53('0x2c')](_0xad53('0x2d'));}}}logger[_0xad53('0x26')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0xcac942[_0xad53('0x29')],util[_0xad53('0x28')](_[_0xad53('0x87')](this[_0xad53('0x9')][_0xcac942['uniqueid']]),{'showHidden':![],'depth':null}));ami['emit'](_0xad53('0x88'),_[_0xad53('0x87')](this[_0xad53('0x9')][_0xcac942['uniqueid']]));this[_0xad53('0x89')](_0xcac942[_0xad53('0x29')]);}if(this[_0xad53('0xd')][_0xcac942[_0xad53('0x29')]]){delete this[_0xad53('0xd')][_0xcac942[_0xad53('0x29')]];}}}catch(_0x592db6){logger['error'](_0xad53('0x8a'),_0xcac942[_0xad53('0x29')],util[_0xad53('0x28')](_0x592db6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xad53('0x1f')][_0xad53('0x8b')]=function(_0x27e36a){try{if(this[_0xad53('0x21')](_0x27e36a)){logger[_0xad53('0x26')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x27e36a[_0xad53('0x29')],util[_0xad53('0x28')](_0x27e36a,{'showHidden':![],'depth':null}));if(this[_0xad53('0x9')][_0x27e36a[_0xad53('0x8c')]]){for(var _0x4e8a92 in this[_0xad53('0x9')][_0x27e36a[_0xad53('0x8c')]]){if(this[_0xad53('0x9')][_0x27e36a[_0xad53('0x8c')]][_0xad53('0x3b')](_0x4e8a92)){if(_0x27e36a[_0xad53('0x8d')]===_0x4e8a92){logger[_0xad53('0x23')](_0xad53('0x8e'),_0x27e36a[_0xad53('0x29')],this[_0xad53('0x9')][_0x27e36a[_0xad53('0x8c')]][_0x4e8a92][_0xad53('0x39')],_0x4e8a92);var _0x3fa906=moment();this['channels'][_0x27e36a[_0xad53('0x8c')]][_0x4e8a92]['agentcomplete']=!![];this[_0xad53('0x9')][_0x27e36a[_0xad53('0x8c')]][_0x4e8a92][_0xad53('0x86')]=moment()['format'](_0xad53('0x2d'));this['channels'][_0x27e36a['transfereeuniqueid']][_0x4e8a92]['lastevent']='complete';this[_0xad53('0x9')][_0x27e36a[_0xad53('0x8c')]][_0x4e8a92][_0xad53('0x5f')]=_0xad53('0x66');this[_0xad53('0x9')][_0x27e36a['transfereeuniqueid']][_0x4e8a92][_0xad53('0x67')]=_0x3fa906[_0xad53('0x8f')](this[_0xad53('0x9')][_0x27e36a[_0xad53('0x8c')]][_0x4e8a92][_0xad53('0x3d')],_0xad53('0x90'));}}}}if(this[_0xad53('0x9')][_0x27e36a[_0xad53('0x91')]]){var _0x5551a9=this[_0xad53('0x9')][_0x27e36a[_0xad53('0x91')]];this[_0xad53('0x9')][_0x27e36a[_0xad53('0x91')]]=this['channels'][_0x27e36a[_0xad53('0x8c')]];this['channels'][_0x27e36a['transfereeuniqueid']]=_0x5551a9;}}}catch(_0x429f77){logger['error']('[%s][voiceAgentReport][attendedtransfer]',_0x27e36a[_0xad53('0x29')],util['inspect'](_0x429f77,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xad53('0x1f')][_0xad53('0x1e')]=function(_0x520734){try{if(this[_0xad53('0x21')](_0x520734)){logger[_0xad53('0x26')](_0xad53('0x92'),_0x520734[_0xad53('0x29')],util[_0xad53('0x28')](_0x520734,{'showHidden':![],'depth':null}));if(this[_0xad53('0x9')][_0x520734[_0xad53('0x8c')]]){for(var _0x2ad0f5 in this[_0xad53('0x9')][_0x520734['transfereeuniqueid']]){if(this['channels'][_0x520734[_0xad53('0x8c')]]['hasOwnProperty'](_0x2ad0f5)){if(_0x520734['transfereruniqueid']===_0x2ad0f5){logger['info'](_0xad53('0x93'),_0x520734[_0xad53('0x29')],this[_0xad53('0x9')][_0x520734['transfereeuniqueid']][_0x2ad0f5][_0xad53('0x39')],_0x2ad0f5);var _0x27397f=moment();this[_0xad53('0x9')][_0x520734['transfereeuniqueid']][_0x2ad0f5]['agentcomplete']=!![];this[_0xad53('0x9')][_0x520734[_0xad53('0x8c')]][_0x2ad0f5][_0xad53('0x86')]=_0x27397f;this[_0xad53('0x9')][_0x520734[_0xad53('0x8c')]][_0x2ad0f5][_0xad53('0x50')]='complete';this['channels'][_0x520734[_0xad53('0x8c')]][_0x2ad0f5][_0xad53('0x5f')]=_0xad53('0x66');this[_0xad53('0x9')][_0x520734[_0xad53('0x8c')]][_0x2ad0f5]['talktime']=_0x27397f['diff'](this[_0xad53('0x9')][_0x520734[_0xad53('0x8c')]][_0x2ad0f5][_0xad53('0x3d')],'seconds');}}}}}}catch(_0x4c0243){logger[_0xad53('0x3a')](_0xad53('0x94'),_0x520734[_0xad53('0x29')],util[_0xad53('0x28')](_0x4c0243,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xad53('0x1f')][_0xad53('0x19')]=function(_0x5d119a){var _0x38494d='';try{if(this[_0xad53('0x21')](_0x5d119a)){logger['debug'](_0xad53('0x95'),_0x5d119a[_0xad53('0x29')],util[_0xad53('0x28')](_0x5d119a,{'showHidden':![],'depth':null}));if(_0x5d119a[_0xad53('0x96')]){_0x38494d=_0x5d119a[_0xad53('0x96')][_0xad53('0x97')](0x0,_0x5d119a['channel']['lastIndexOf']('-'));if(this[_0xad53('0xc')][_0x38494d]){logger['info'](_0xad53('0x98'),_0x5d119a[_0xad53('0x29')],_0x38494d);this[_0xad53('0xc')][_0x38494d][_0xad53('0x99')]=!![];}}}}catch(_0x1e7c75){logger[_0xad53('0x3a')]('[%s][voiceAgentReport][musiconholdstart]',_0x5d119a[_0xad53('0x29')],util[_0xad53('0x28')](_0x1e7c75,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xad53('0x1f')][_0xad53('0x1b')]=function(_0x2b3fb6){var _0x30fee1='';try{if(this[_0xad53('0x21')](_0x2b3fb6)){logger[_0xad53('0x26')](_0xad53('0x9a'),_0x2b3fb6[_0xad53('0x29')],util['inspect'](_0x2b3fb6,{'showHidden':![],'depth':null}));if(_0x2b3fb6[_0xad53('0x96')]){_0x30fee1=_0x2b3fb6[_0xad53('0x96')][_0xad53('0x97')](0x0,_0x2b3fb6[_0xad53('0x96')][_0xad53('0x9b')]('-'));if(this[_0xad53('0xc')][_0x30fee1]){logger['info'](_0xad53('0x9c'),_0x2b3fb6['uniqueid'],_0x30fee1);this[_0xad53('0xc')][_0x30fee1]['onhold']=![];}}}}catch(_0x5319a2){logger[_0xad53('0x3a')](_0xad53('0x9d'),_0x2b3fb6[_0xad53('0x29')],util[_0xad53('0x28')](_0x5319a2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xad53('0x1f')][_0xad53('0x89')]=function(_0x41839d,_0x4bc18a=0x2710){if(this['channels'][_0x41839d]){setTimeout(()=>{delete this[_0xad53('0x9')][_0x41839d];},_0x4bc18a);}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 82bdaed..a1b3010 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3896=['connectedlinenum','format','user:%s','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','syncNewChannel','debug','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','linkedid','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','disposition','toNumber','channelstate','keys','from-sip','destconnectedlinenum','undefined','exten','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','queue','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','lastdata','startsWith','match','type','isNil','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','UserId','membername','name','diff','connectedlinename','destinationchannel','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcallid','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','length','user:agentcomplete','transferType','transferToInternal','isEmpty','getSettings','then','StopMixMonitor','Action','catch','webbar:stopmonitors','event','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','transfercalleridnum','extension','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','mohtime','[%s][voiceCallReport][musiconholdstop]','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','../rpc/setting','set','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','defaults','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','bind','newexten','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','isNotNull','isUndefined','prototype','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','merge','pick','context','channel','split','xcally-motion-preview'];(function(_0x402baf,_0x1ef0ba){var _0x1974d8=function(_0x36a33f){while(--_0x36a33f){_0x402baf['push'](_0x402baf['shift']());}};_0x1974d8(++_0x1ef0ba);}(_0x3896,0x14b));var _0x6389=function(_0x3b1a68,_0x4ed4b6){_0x3b1a68=_0x3b1a68-0x0;var _0x4446ee=_0x3896[_0x3b1a68];return _0x4446ee;};'use strict';var _=require(_0x6389('0x0'));var moment=require('moment');var util=require(_0x6389('0x1'));var path=require('path');var Redis=require(_0x6389('0x2'));var config=require(_0x6389('0x3'));var logger=require(_0x6389('0x4'))(_0x6389('0x5'));var ami=require('../ami');var Channel=require(_0x6389('0x6'));var RpcSetting=require(_0x6389('0x7'));var applications=[_0x6389('0x8'),'queue',_0x6389('0x9'),_0x6389('0xa'),_0x6389('0xb'),_0x6389('0xc')];var dispositions=['NO\x20ANSWER',_0x6389('0xd'),_0x6389('0xd'),_0x6389('0xe'),_0x6389('0xe'),_0x6389('0xe'),_0x6389('0xf'),_0x6389('0x10'),'FAILED',_0x6389('0xd'),_0x6389('0xd')];config['redis']=_[_0x6389('0x11')](config[_0x6389('0x12')],{'host':_0x6389('0x13'),'port':0x18eb});var io=require(_0x6389('0x14'))(new Redis(config['redis']));function VoiceCallReport(_0x31700e){this['channels']=_0x31700e[_0x6389('0x15')];this[_0x6389('0x16')]=_0x31700e[_0x6389('0x16')];this[_0x6389('0x17')]={};ami['on']('coreshowchannel',this[_0x6389('0x18')][_0x6389('0x19')](this));ami['on'](_0x6389('0x1a'),this[_0x6389('0x18')][_0x6389('0x19')](this));ami['on']('newchannel',this['syncNewChannel']['bind'](this));ami['on']('newstate',this[_0x6389('0x1b')][_0x6389('0x19')](this));ami['on'](_0x6389('0x1c'),this[_0x6389('0x1d')][_0x6389('0x19')](this));ami['on'](_0x6389('0x1e'),this[_0x6389('0x1f')]['bind'](this));ami['on'](_0x6389('0x20'),this[_0x6389('0x21')][_0x6389('0x19')](this));ami['on'](_0x6389('0x22'),this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x6389('0x19')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x6389('0x19')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop']['bind'](this));try{logger[_0x6389('0x23')](_0x6389('0x24'));ami[_0x6389('0x25')]();}catch(_0x14c292){logger[_0x6389('0x26')]('[voiceCallReport][coreshowchannels]',util[_0x6389('0x27')](_0x14c292,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0x6389('0x28')]=function(_0x292f45){return _0x292f45!==null&&!_[_0x6389('0x29')](_0x292f45);};VoiceCallReport[_0x6389('0x2a')]['emit']=function(_0x390eea,_0x1862fb,_0x16b8f6){io['to'](_0x390eea)[_0x6389('0x2b')](_0x1862fb,_0x16b8f6);};VoiceCallReport[_0x6389('0x2a')][_0x6389('0x21')]=function(_0x599f7a){try{if(this[_0x6389('0x28')](_0x599f7a)){logger[_0x6389('0x23')](_0x6389('0x2c'),_0x599f7a[_0x6389('0x2d')],_0x599f7a[_0x6389('0x2e')],_0x599f7a[_0x6389('0x2f')]);logger['debug'](_0x6389('0x30'),_0x599f7a[_0x6389('0x2d')],util['inspect'](_0x599f7a,{'showHidden':![],'depth':null}));if(_0x599f7a[_0x6389('0x2d')]===_0x599f7a['linkedid']){if(!_['isUndefined'](this['channels'][_0x599f7a[_0x6389('0x2d')]])){_[_0x6389('0x31')](this[_0x6389('0x15')][_0x599f7a[_0x6389('0x2d')]],_[_0x6389('0x32')](_0x599f7a,_['keys'](this[_0x6389('0x15')][_0x599f7a['uniqueid']])));}}if(_0x599f7a[_0x6389('0x33')]==='from-sip'){var _0x41aced=this[_0x6389('0x16')][_0x599f7a[_0x6389('0x34')][_0x6389('0x35')]('-')[0x0]];if(_0x41aced){if(_0x599f7a['exten']==_0x6389('0x36')){_0x41aced['destconnectedlinenum']=_0x599f7a[_0x6389('0x37')];this['emit'](util[_0x6389('0x38')](_0x6389('0x39'),_0x41aced['name']),_0x6389('0x3a'),{'id':_0x41aced['id'],'destaccountcode':_0x41aced[_0x6389('0x3b')],'destconnectedlinenum':_0x599f7a[_0x6389('0x37')]});}}}}}catch(_0x2c720a){logger[_0x6389('0x26')](_0x6389('0x3c'),_0x599f7a[_0x6389('0x2d')],util[_0x6389('0x27')](_0x2c720a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x6389('0x3d')]=function(_0x2a693d){try{if(this[_0x6389('0x28')](_0x2a693d)){logger[_0x6389('0x3e')](_0x6389('0x3f'),_0x2a693d[_0x6389('0x2d')],util['inspect'](_0x2a693d,{'showHidden':![],'depth':null}));if(this[_0x6389('0x15')][_0x2a693d[_0x6389('0x2d')]]){return;}if(_0x2a693d[_0x6389('0x34')]===_0x6389('0x40')){return;}if(_0x2a693d[_0x6389('0x2d')]!==_0x2a693d[_0x6389('0x41')]&&!this[_0x6389('0x17')][_0x2a693d['linkedid']]){return;}logger[_0x6389('0x23')](_0x6389('0x42'),_0x2a693d[_0x6389('0x2d')],_0x2a693d[_0x6389('0x33')],_0x2a693d['exten']);this['channels'][_0x2a693d[_0x6389('0x2d')]]=new Channel();this[_0x6389('0x15')][_0x2a693d[_0x6389('0x2d')]][_0x6389('0x43')]=moment()[_0x6389('0x38')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x2a693d[_0x6389('0x2d')]][_0x6389('0x44')]=dispositions[_[_0x6389('0x45')](_0x2a693d[_0x6389('0x46')])];_[_0x6389('0x31')](this[_0x6389('0x15')][_0x2a693d[_0x6389('0x2d')]],_[_0x6389('0x32')](_0x2a693d,_[_0x6389('0x47')](this[_0x6389('0x15')][_0x2a693d['uniqueid']])));if(_0x2a693d[_0x6389('0x33')]===_0x6389('0x48')){var _0x55f33b=this[_0x6389('0x16')][_0x2a693d['channel'][_0x6389('0x35')]('-')[0x0]];if(_0x55f33b&&typeof _0x55f33b[_0x6389('0x49')]===_0x6389('0x4a')){_0x55f33b[_0x6389('0x49')]=_0x2a693d[_0x6389('0x4b')];logger['debug'](_0x6389('0x4c'),_0x2a693d['uniqueid'],util['inspect']({'id':_0x55f33b['id'],'destaccountcode':_0x55f33b[_0x6389('0x3b')],'destconnectedlinenum':_0x2a693d[_0x6389('0x4b')]},{'showHidden':![],'depth':null}));this[_0x6389('0x2b')](util[_0x6389('0x38')]('user:%s',_0x55f33b['name']),_0x6389('0x3a'),{'id':_0x55f33b['id'],'destaccountcode':_0x55f33b[_0x6389('0x3b')],'destconnectedlinenum':_0x2a693d[_0x6389('0x4b')]});}}}}catch(_0x1f81f2){logger[_0x6389('0x26')]('[%s][voiceCallReport][newchannel]',_0x2a693d[_0x6389('0x2d')],util['inspect'](_0x1f81f2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6389('0x2a')][_0x6389('0x18')]=function(_0x4d6831){try{if(this[_0x6389('0x28')](_0x4d6831)){logger[_0x6389('0x3e')](_0x6389('0x4d'),_0x4d6831[_0x6389('0x2d')],util[_0x6389('0x27')](_0x4d6831,{'showHidden':![],'depth':null}));if(_0x4d6831['channel']===_0x6389('0x40')||_0x4d6831['exten']==='h')return;if(_0x4d6831['uniqueid']===_0x4d6831['linkedid']||this[_0x6389('0x17')][_0x4d6831[_0x6389('0x41')]]){_0x4d6831['application']=_0x4d6831['application']?_0x4d6831[_0x6389('0x4e')][_0x6389('0x4f')]():undefined;_0x4d6831[_0x6389('0x50')]=_0x4d6831[_0x6389('0x51')]||_0x4d6831['applicationdata'];if(_0x4d6831[_0x6389('0x51')]&&_0x4d6831[_0x6389('0x4e')]!==_0x6389('0x52')){_0x4d6831['applicationdata']=_0x4d6831[_0x6389('0x50')][_0x6389('0x4f')]();}logger['info'](_0x6389('0x53'),_0x4d6831[_0x6389('0x2d')],_0x4d6831['application'],_0x4d6831[_0x6389('0x50')]);if(_[_0x6389('0x29')](this[_0x6389('0x15')][_0x4d6831[_0x6389('0x2d')]])){this[_0x6389('0x15')][_0x4d6831[_0x6389('0x2d')]]=new Channel();this[_0x6389('0x15')][_0x4d6831[_0x6389('0x2d')]][_0x6389('0x43')]=_0x4d6831['duration']?moment()['subtract'](moment[_0x6389('0x54')](_0x4d6831['duration'])[_0x6389('0x55')](),'seconds')['format'](_0x6389('0x56')):moment()['format'](_0x6389('0x56'));this[_0x6389('0x15')][_0x4d6831['uniqueid']][_0x6389('0x44')]=_0x6389('0xe');}_[_0x6389('0x31')](this['channels'][_0x4d6831[_0x6389('0x2d')]],_['pick'](_0x4d6831,_[_0x6389('0x47')](this[_0x6389('0x15')][_0x4d6831['uniqueid']])));if(_['includes'](applications,_0x4d6831[_0x6389('0x4e')])){this[_0x6389('0x15')][_0x4d6831[_0x6389('0x2d')]]['lastapplication']=_0x4d6831[_0x6389('0x4e')];this[_0x6389('0x15')][_0x4d6831[_0x6389('0x2d')]][_0x6389('0x57')]=_0x4d6831['applicationdata'];if(_0x4d6831['application']===_0x6389('0x8')&&_[_0x6389('0x58')](_0x4d6831[_0x6389('0x50')][_0x6389('0x4f')](),'cdr(')){var _0x5c386e=_0x4d6831[_0x6389('0x50')][_0x6389('0x35')]('=');var _0x12fa75=_0x5c386e[0x0][_0x6389('0x4f')]()[_0x6389('0x59')](/cdr\((.*)\)/);if(_0x12fa75){if(_0x12fa75[0x1]===_0x6389('0x5a')&&!_[_0x6389('0x5b')](this['channels'][_0x4d6831[_0x6389('0x2d')]][_0x12fa75[0x1]]))return;this[_0x6389('0x15')][_0x4d6831[_0x6389('0x2d')]][_0x12fa75[0x1]]=_0x5c386e[0x1];}}else if(_0x4d6831[_0x6389('0x4e')]==='queue'){this[_0x6389('0x15')][_0x4d6831[_0x6389('0x2d')]][_0x6389('0x52')]=_0x4d6831[_0x6389('0x50')][_0x6389('0x35')](',')[0x0];}}}}}catch(_0x19d643){logger[_0x6389('0x26')]('[%s][voiceCallReport][newexten]',_0x4d6831[_0x6389('0x2d')],util['inspect'](_0x19d643,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6389('0x2a')]['syncNewState']=function(_0x1637a0){try{if(this[_0x6389('0x28')](_0x1637a0)){logger['info']('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x1637a0[_0x6389('0x2d')],_0x1637a0[_0x6389('0x41')],_0x1637a0[_0x6389('0x2e')],_0x1637a0['calleridnum']);logger[_0x6389('0x3e')](_0x6389('0x5c'),_0x1637a0['uniqueid'],util['inspect'](_0x1637a0,{'showHidden':![],'depth':null}));if(_0x1637a0['channelstate']!=='6')return;var _0x40ba99=this['agents'][_0x1637a0[_0x6389('0x34')][_0x6389('0x35')]('-')[0x0]];if(_0x1637a0[_0x6389('0x2d')]!==_0x1637a0[_0x6389('0x41')]){var _0x4b4949=moment();if(this['channels'][_0x1637a0[_0x6389('0x41')]]){if(!this[_0x6389('0x15')][_0x1637a0['linkedid']]['answered']){this[_0x6389('0x15')][_0x1637a0[_0x6389('0x41')]][_0x6389('0x5d')]=!![];this['channels'][_0x1637a0['linkedid']][_0x6389('0x5e')]=_0x4b4949[_0x6389('0x38')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x6389('0x15')][_0x1637a0[_0x6389('0x41')]][_0x6389('0x43')]){this[_0x6389('0x15')][_0x1637a0[_0x6389('0x41')]][_0x6389('0x5f')]=_0x4b4949['diff'](this[_0x6389('0x15')][_0x1637a0['linkedid']]['starttime'],'seconds');}}this[_0x6389('0x15')][_0x1637a0['linkedid']][_0x6389('0x41')]=_0x1637a0[_0x6389('0x2d')];if(_0x1637a0['calleridnum']!==_0x6389('0x36')){this[_0x6389('0x15')][_0x1637a0[_0x6389('0x41')]][_0x6389('0x37')]=_0x1637a0[_0x6389('0x2f')];}this[_0x6389('0x15')][_0x1637a0['linkedid']]['connectedlinename']=_0x1637a0[_0x6389('0x2e')];this[_0x6389('0x15')][_0x1637a0['linkedid']]['destinationchannel']=_0x1637a0[_0x6389('0x34')];this[_0x6389('0x15')][_0x1637a0[_0x6389('0x41')]][_0x6389('0x44')]=dispositions[_['toNumber'](_0x1637a0[_0x6389('0x46')])];if(_0x40ba99){this['channels'][_0x1637a0[_0x6389('0x41')]][_0x6389('0x60')]=_0x40ba99['id'];this[_0x6389('0x15')][_0x1637a0[_0x6389('0x41')]][_0x6389('0x61')]=_0x40ba99[_0x6389('0x62')];}}if(this[_0x6389('0x15')][_0x1637a0[_0x6389('0x2d')]]){if(!this[_0x6389('0x15')][_0x1637a0['uniqueid']]['answered']){this[_0x6389('0x15')][_0x1637a0[_0x6389('0x2d')]]['answered']=!![];this[_0x6389('0x15')][_0x1637a0['uniqueid']][_0x6389('0x5e')]=_0x4b4949['format'](_0x6389('0x56'));if(this[_0x6389('0x15')][_0x1637a0['uniqueid']][_0x6389('0x43')]){this['channels'][_0x1637a0[_0x6389('0x2d')]][_0x6389('0x5f')]=_0x4b4949[_0x6389('0x63')](this[_0x6389('0x15')][_0x1637a0[_0x6389('0x2d')]][_0x6389('0x43')],_0x6389('0x55'));}}if(_0x1637a0[_0x6389('0x2f')]!==_0x6389('0x36')){this[_0x6389('0x15')][_0x1637a0['uniqueid']][_0x6389('0x37')]=_0x1637a0[_0x6389('0x2f')];}this[_0x6389('0x15')][_0x1637a0[_0x6389('0x2d')]][_0x6389('0x64')]=_0x1637a0[_0x6389('0x2e')];this[_0x6389('0x15')][_0x1637a0[_0x6389('0x2d')]][_0x6389('0x65')]=_0x1637a0[_0x6389('0x34')];this[_0x6389('0x15')][_0x1637a0[_0x6389('0x2d')]][_0x6389('0x44')]=dispositions[_[_0x6389('0x45')](_0x1637a0['channelstate'])];}}else{if(this[_0x6389('0x15')][_0x1637a0[_0x6389('0x2d')]]){if(_0x40ba99){this['channels'][_0x1637a0[_0x6389('0x2d')]][_0x6389('0x60')]=_0x40ba99['id'];this[_0x6389('0x15')][_0x1637a0['uniqueid']][_0x6389('0x61')]=_0x40ba99[_0x6389('0x62')];}}}if(_0x1637a0[_0x6389('0x33')]===_0x6389('0x48')){if(_0x40ba99){_0x40ba99[_0x6389('0x49')]=_0x1637a0[_0x6389('0x4b')];var _0x38a944;if(this[_0x6389('0x15')][_0x1637a0[_0x6389('0x2d')]]){_0x38a944=this[_0x6389('0x15')][_0x1637a0[_0x6389('0x2d')]]['queue'];}else if(this[_0x6389('0x15')][_0x1637a0['linkedid']]){_0x38a944=this['channels'][_0x1637a0[_0x6389('0x41')]]['queue'];}_0x40ba99[_0x6389('0x52')]=_0x38a944;var _0x48a3db={'id':_0x40ba99['id'],'name':_0x40ba99[_0x6389('0x62')],'agentconnected':!![],'destaccountcode':_0x40ba99[_0x6389('0x3b')],'destconnectedlinenum':_0x1637a0[_0x6389('0x4b')],'queue':_0x38a944||undefined,'uniqueid':_0x1637a0[_0x6389('0x41')]};logger[_0x6389('0x3e')](_0x6389('0x66'),_0x1637a0[_0x6389('0x2d')],util[_0x6389('0x27')](_0x48a3db,{'showHidden':![],'depth':null}));this['emit'](util[_0x6389('0x38')](_0x6389('0x39'),_0x40ba99[_0x6389('0x62')]),_0x6389('0x3a'),_0x48a3db);}}}}catch(_0x54c805){logger[_0x6389('0x26')]('[%s][voiceCallReport][newstate]',_0x1637a0[_0x6389('0x2d')],util[_0x6389('0x27')](_0x54c805,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6389('0x2a')][_0x6389('0x67')]=function(_0x22a858,_0x5c7c8f){try{if(this[_0x6389('0x15')][_0x22a858]){logger['info'](_0x6389('0x68'),_0x22a858,_0x5c7c8f);this[_0x6389('0x15')][_0x22a858][_0x6389('0x69')]=!![];if(_[_0x6389('0x6a')](_0x5c7c8f,_0x6389('0x6b'))){_0x5c7c8f=_0x5c7c8f[_0x6389('0x6c')]('.wav49',_0x6389('0x6d'));}this[_0x6389('0x15')][_0x22a858][_0x6389('0x6e')]=_0x5c7c8f;var _0x8ca7cf=_[_0x6389('0x6f')](this[_0x6389('0x15')][_0x22a858][_0x6389('0x70')],{'filename':_0x5c7c8f});if(_[_0x6389('0x5b')](_0x8ca7cf)){this[_0x6389('0x15')][_0x22a858][_0x6389('0x70')][_0x6389('0x71')]({'filename':_0x5c7c8f,'createdAt':moment()[_0x6389('0x38')](_0x6389('0x56')),'mixmonitorid':'','status':_0x6389('0x72')});}}}catch(_0x4258f9){logger['error'](_0x6389('0x73'),_0x22a858,util['inspect'](_0x4258f9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6389('0x2a')][_0x6389('0x1d')]=function(_0x15ead1){try{if(this['isNotNull'](_0x15ead1)){logger[_0x6389('0x3e')]('[%s][voiceCallReport][varset]\x20event:',_0x15ead1[_0x6389('0x2d')],util[_0x6389('0x27')](_0x15ead1,{'showHidden':![],'depth':null}));if(this[_0x6389('0x15')][_0x15ead1[_0x6389('0x2d')]]&&_0x15ead1[_0x6389('0x34')]!=_0x6389('0x40')){if(this[_0x6389('0x28')](_0x15ead1[_0x6389('0x74')])){if(this[_0x6389('0x28')](_0x15ead1[_0x6389('0x74')][_0x6389('0x75')])){logger[_0x6389('0x23')](_0x6389('0x76'),_0x15ead1[_0x6389('0x2d')],_0x15ead1[_0x6389('0x77')]);this['syncMixMonitorFilename'](_0x15ead1['uniqueid'],_0x15ead1[_0x6389('0x77')]);}else if(this[_0x6389('0x28')](_0x15ead1[_0x6389('0x74')]['xmd-phone'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x15ead1[_0x6389('0x2d')],_0x15ead1[_0x6389('0x77')]);this[_0x6389('0x15')][_0x15ead1[_0x6389('0x2d')]][_0x6389('0x2f')]=_0x15ead1[_0x6389('0x77')];}else if(this[_0x6389('0x28')](_0x15ead1[_0x6389('0x74')][_0x6389('0x78')])){logger['info'](_0x6389('0x79'),_0x15ead1['uniqueid'],_0x15ead1[_0x6389('0x77')]);this[_0x6389('0x15')][_0x15ead1[_0x6389('0x2d')]][_0x6389('0x7a')]=_0x15ead1[_0x6389('0x77')];}else if(this[_0x6389('0x28')](_0x15ead1[_0x6389('0x74')][_0x6389('0x7b')])){logger[_0x6389('0x23')](_0x6389('0x7c'),_0x15ead1['uniqueid'],_0x15ead1[_0x6389('0x77')]);this['channels'][_0x15ead1['uniqueid']][_0x6389('0x5a')]=_0x15ead1[_0x6389('0x77')];}else if(this[_0x6389('0x28')](_0x15ead1[_0x6389('0x74')][_0x6389('0x7d')])){logger[_0x6389('0x23')](_0x6389('0x7e'),_0x15ead1[_0x6389('0x2d')],_0x15ead1[_0x6389('0x77')][_0x6389('0x35')](',')[0x0]);this[_0x6389('0x15')][_0x15ead1[_0x6389('0x2d')]][_0x6389('0x52')]=_0x15ead1['value'][_0x6389('0x35')](',')[0x0];}else if(this[_0x6389('0x28')](_0x15ead1[_0x6389('0x74')]['xmd-originatecalleridnum'])){logger[_0x6389('0x23')](_0x6389('0x7f'),_0x15ead1[_0x6389('0x2d')],_0x15ead1['value']);this['channels'][_0x15ead1['uniqueid']]['originatecalleridnum']=_0x15ead1[_0x6389('0x77')];}else if(this[_0x6389('0x28')](_0x15ead1[_0x6389('0x74')][_0x6389('0x80')])){logger[_0x6389('0x23')](_0x6389('0x81'),_0x15ead1[_0x6389('0x2d')],_0x15ead1[_0x6389('0x77')]);this[_0x6389('0x15')][_0x15ead1['uniqueid']][_0x6389('0x82')]=_0x15ead1[_0x6389('0x77')];}else if(this['isNotNull'](_0x15ead1[_0x6389('0x74')][_0x6389('0x83')])){logger['info'](_0x6389('0x84'),_0x15ead1[_0x6389('0x2d')],_0x15ead1['value']);this[_0x6389('0x15')][_0x15ead1[_0x6389('0x2d')]][_0x6389('0x85')]=_0x15ead1[_0x6389('0x77')];}else if(this['isNotNull'](_0x15ead1[_0x6389('0x74')][_0x6389('0x86')])){logger[_0x6389('0x23')](_0x6389('0x87'),_0x15ead1['uniqueid'],_0x15ead1[_0x6389('0x77')]);this['channels'][_0x15ead1[_0x6389('0x2d')]][_0x6389('0x52')]=_0x15ead1[_0x6389('0x77')];}else if(this['isNotNull'](_0x15ead1[_0x6389('0x74')]['sipcallid'])){logger[_0x6389('0x23')](_0x6389('0x88'),_0x15ead1[_0x6389('0x2d')],_0x15ead1[_0x6389('0x77')]);this[_0x6389('0x15')][_0x15ead1['uniqueid']][_0x6389('0x89')]=_0x15ead1[_0x6389('0x77')];}}}else if(this[_0x6389('0x28')](_0x15ead1[_0x6389('0x74')]['mixmonitor_filename'])){if(_0x15ead1['value']){var _0x8e00ba=path[_0x6389('0x8a')](_0x15ead1[_0x6389('0x77')])[_0x6389('0x62')];logger[_0x6389('0x23')](_0x6389('0x76'),_0x8e00ba,_0x15ead1['value']);this[_0x6389('0x67')](_0x8e00ba,_0x15ead1[_0x6389('0x77')]);}}else if(this['channels'][_0x15ead1['linkedid']]){if(this[_0x6389('0x28')](_0x15ead1[_0x6389('0x74')])){if(this[_0x6389('0x28')](_0x15ead1[_0x6389('0x74')][_0x6389('0x8b')])){logger[_0x6389('0x23')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x15ead1[_0x6389('0x41')],_0x15ead1[_0x6389('0x77')]);this[_0x6389('0x15')][_0x15ead1[_0x6389('0x41')]][_0x6389('0x8c')]=_0x15ead1[_0x6389('0x77')];}}}}}catch(_0x4fe46a){logger['error']('[%s][voiceCallReport][varset]',_0x15ead1[_0x6389('0x2d')],util[_0x6389('0x27')](_0x4fe46a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6389('0x2a')][_0x6389('0x1f')]=function(_0x332eb7){try{if(this['isNotNull'](_0x332eb7)){logger[_0x6389('0x3e')](_0x6389('0x8d'),_0x332eb7[_0x6389('0x2d')],util[_0x6389('0x27')](_0x332eb7,{'showHidden':![],'depth':null}));if(this[_0x6389('0x17')][_0x332eb7['linkedid']]){if(this[_0x6389('0x15')][this[_0x6389('0x17')][_0x332eb7['linkedid']][_0x6389('0x41')]]){this['channels'][this[_0x6389('0x17')][_0x332eb7['linkedid']]['linkedid']][_0x6389('0x2d')]=_0x332eb7[_0x6389('0x2d')];this[_0x6389('0x15')][this[_0x6389('0x17')][_0x332eb7[_0x6389('0x41')]][_0x6389('0x41')]][_0x6389('0x5d')]=this[_0x6389('0x15')][_0x332eb7['uniqueid']][_0x6389('0x5d')];this['channels'][this['blindTransfers'][_0x332eb7[_0x6389('0x41')]][_0x6389('0x41')]][_0x6389('0x5e')]=this[_0x6389('0x15')][_0x332eb7['uniqueid']][_0x6389('0x5e')];this[_0x6389('0x15')][this[_0x6389('0x17')][_0x332eb7[_0x6389('0x41')]][_0x6389('0x41')]][_0x6389('0x65')]=this[_0x6389('0x15')][this[_0x6389('0x17')][_0x332eb7[_0x6389('0x41')]]['linkedid']]['channel'];this['channels'][this['blindTransfers'][_0x332eb7['linkedid']][_0x6389('0x41')]]['disposition']=this[_0x6389('0x15')][_0x332eb7['uniqueid']]['disposition'];this[_0x6389('0x15')][_0x332eb7[_0x6389('0x2d')]]=this[_0x6389('0x15')][this[_0x6389('0x17')][_0x332eb7[_0x6389('0x41')]][_0x6389('0x41')]];this[_0x6389('0x8e')](this[_0x6389('0x17')][_0x332eb7[_0x6389('0x41')]][_0x6389('0x41')]);}else if(this[_0x6389('0x15')][this['blindTransfers'][_0x332eb7[_0x6389('0x41')]][_0x6389('0x2d')]]){this[_0x6389('0x15')][this['blindTransfers'][_0x332eb7[_0x6389('0x41')]][_0x6389('0x2d')]][_0x6389('0x2d')]=[this[_0x6389('0x15')][this[_0x6389('0x17')][_0x332eb7[_0x6389('0x41')]][_0x6389('0x2d')]][_0x6389('0x41')],this['channels'][this[_0x6389('0x17')][_0x332eb7[_0x6389('0x41')]][_0x6389('0x2d')]]['linkedid']=this['channels'][this[_0x6389('0x17')][_0x332eb7['linkedid']][_0x6389('0x2d')]][_0x6389('0x2d')]][0x0];this['channels'][this[_0x6389('0x17')][_0x332eb7['linkedid']][_0x6389('0x2d')]]['answered']=this['channels'][_0x332eb7[_0x6389('0x2d')]][_0x6389('0x5d')];this[_0x6389('0x15')][this['blindTransfers'][_0x332eb7[_0x6389('0x41')]]['uniqueid']][_0x6389('0x5e')]=this[_0x6389('0x15')][_0x332eb7['uniqueid']][_0x6389('0x5e')];this['channels'][this[_0x6389('0x17')][_0x332eb7[_0x6389('0x41')]][_0x6389('0x2d')]]['destinationchannel']=this[_0x6389('0x15')][this[_0x6389('0x17')][_0x332eb7[_0x6389('0x41')]][_0x6389('0x2d')]][_0x6389('0x34')];this['channels'][this[_0x6389('0x17')][_0x332eb7[_0x6389('0x41')]][_0x6389('0x2d')]]['disposition']=this[_0x6389('0x15')][_0x332eb7[_0x6389('0x2d')]][_0x6389('0x44')];this[_0x6389('0x15')][_0x332eb7[_0x6389('0x2d')]]=this[_0x6389('0x15')][this[_0x6389('0x17')][_0x332eb7[_0x6389('0x41')]]['uniqueid']];this[_0x6389('0x8e')](this[_0x6389('0x17')][_0x332eb7['linkedid']][_0x6389('0x2d')]);}}if(this['channels'][_0x332eb7[_0x6389('0x2d')]]){logger[_0x6389('0x23')](_0x6389('0x8f'),_0x332eb7[_0x6389('0x2d')],_0x332eb7[_0x6389('0x90')]);var _0x57df51=moment();this[_0x6389('0x15')][_0x332eb7[_0x6389('0x2d')]][_0x6389('0x91')]=_0x57df51[_0x6389('0x38')](_0x6389('0x56'));this[_0x6389('0x15')][_0x332eb7[_0x6389('0x2d')]][_0x6389('0x54')]=_0x57df51[_0x6389('0x63')](this['channels'][_0x332eb7[_0x6389('0x2d')]][_0x6389('0x43')],'seconds');if(this['channels'][_0x332eb7['uniqueid']][_0x6389('0x5d')]){this[_0x6389('0x15')][_0x332eb7[_0x6389('0x2d')]][_0x6389('0x92')]=_0x57df51[_0x6389('0x63')](this[_0x6389('0x15')][_0x332eb7[_0x6389('0x2d')]][_0x6389('0x5e')],_0x6389('0x55'));this[_0x6389('0x15')][_0x332eb7[_0x6389('0x2d')]][_0x6389('0x5f')]=this[_0x6389('0x15')][_0x332eb7[_0x6389('0x2d')]][_0x6389('0x54')]-this[_0x6389('0x15')][_0x332eb7[_0x6389('0x2d')]][_0x6389('0x92')];}if(_0x332eb7[_0x6389('0x33')]==='from-sip'){if(this[_0x6389('0x16')][_0x332eb7[_0x6389('0x34')][_0x6389('0x35')]('-')[0x0]]){this[_0x6389('0x16')][_0x332eb7['channel'][_0x6389('0x35')]('-')[0x0]]=_[_0x6389('0x93')](this[_0x6389('0x16')][_0x332eb7[_0x6389('0x34')][_0x6389('0x35')]('-')[0x0]],[_0x6389('0x49')]);logger[_0x6389('0x3e')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x332eb7[_0x6389('0x2d')],util[_0x6389('0x27')]({'id':this[_0x6389('0x16')][_0x332eb7[_0x6389('0x34')][_0x6389('0x35')]('-')[0x0]]['id'],'destaccountcode':this[_0x6389('0x16')][_0x332eb7[_0x6389('0x34')][_0x6389('0x35')]('-')[0x0]][_0x6389('0x3b')]},{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',this[_0x6389('0x16')][_0x332eb7[_0x6389('0x34')][_0x6389('0x35')]('-')[0x0]][_0x6389('0x62')]),'user:agentcomplete',{'id':this[_0x6389('0x16')][_0x332eb7[_0x6389('0x34')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x6389('0x16')][_0x332eb7[_0x6389('0x34')][_0x6389('0x35')]('-')[0x0]]['accountcode']});for(var _0x20b784=0x0;_0x20b784{delete this[_0x6389('0x15')][_0x20249b];},_0x36fc76);}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0x5d5c=['stopRecordingOnTransfer','Action','catch','StopMixMonitor','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','ATTENDED','origtransfererlinkedid','some','routeid','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','exports','moment','util','ioredis','../../../config/environment','ami','../ami','../rpc/setting','set','dial','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','context','from-sip','exten','xcally-motion-preview','destconnectedlinenum','format','user:%s','name','user:agentconnect','accountcode','connectedlinenum','channel','OutgoingSpoolFailed','starttime','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','split','undefined','[%s][voiceCallReport][newexten]\x20event:','blindTransfers','application','toLowerCase','appdata','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','disposition','includes','lastapplication','lastdata','startsWith','cdr(','type','queue','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','diff','connectedlinename','calleridname','destinationchannel','answertime','holdtime','UserId','membername','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','resolve','transferToInternal','getSettings','then'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x5d5c,0x1b9));var _0xc5d5=function(_0x32e6b8,_0x5bcbc3){_0x32e6b8=_0x32e6b8-0x0;var _0x4eb8d9=_0x5d5c[_0x32e6b8];return _0x4eb8d9;};'use strict';var _=require('lodash');var moment=require(_0xc5d5('0x0'));var util=require(_0xc5d5('0x1'));var path=require('path');var Redis=require(_0xc5d5('0x2'));var config=require(_0xc5d5('0x3'));var logger=require('../../../config/logger')(_0xc5d5('0x4'));var ami=require(_0xc5d5('0x5'));var Channel=require('../model/channel');var RpcSetting=require(_0xc5d5('0x6'));var applications=[_0xc5d5('0x7'),'queue','agi',_0xc5d5('0x8'),'playback',_0xc5d5('0x9')];var dispositions=[_0xc5d5('0xa'),'FAILED',_0xc5d5('0xb'),_0xc5d5('0xa'),_0xc5d5('0xa'),'NO\x20ANSWER',_0xc5d5('0xc'),_0xc5d5('0xd'),'FAILED',_0xc5d5('0xb'),_0xc5d5('0xb')];config[_0xc5d5('0xe')]=_['defaults'](config[_0xc5d5('0xe')],{'host':_0xc5d5('0xf'),'port':0x18eb});var io=require(_0xc5d5('0x10'))(new Redis(config[_0xc5d5('0xe')]));function VoiceCallReport(_0x31c694){this['channels']=_0x31c694[_0xc5d5('0x11')];this[_0xc5d5('0x12')]=_0x31c694['agents'];this['blindTransfers']={};ami['on'](_0xc5d5('0x13'),this[_0xc5d5('0x14')][_0xc5d5('0x15')](this));ami['on'](_0xc5d5('0x16'),this['syncNewExten'][_0xc5d5('0x15')](this));ami['on'](_0xc5d5('0x17'),this[_0xc5d5('0x18')][_0xc5d5('0x15')](this));ami['on'](_0xc5d5('0x19'),this[_0xc5d5('0x1a')][_0xc5d5('0x15')](this));ami['on'](_0xc5d5('0x1b'),this[_0xc5d5('0x1c')][_0xc5d5('0x15')](this));ami['on'](_0xc5d5('0x1d'),this[_0xc5d5('0x1e')][_0xc5d5('0x15')](this));ami['on'](_0xc5d5('0x1f'),this[_0xc5d5('0x20')]['bind'](this));ami['on'](_0xc5d5('0x21'),this['syncAttendedTransfer'][_0xc5d5('0x15')](this));ami['on'](_0xc5d5('0x22'),this[_0xc5d5('0x23')]['bind'](this));ami['on'](_0xc5d5('0x24'),this[_0xc5d5('0x25')][_0xc5d5('0x15')](this));ami['on'](_0xc5d5('0x26'),this['syncMusicOnHoldStop'][_0xc5d5('0x15')](this));try{logger[_0xc5d5('0x27')](_0xc5d5('0x28'));ami[_0xc5d5('0x29')]();}catch(_0x163546){logger[_0xc5d5('0x2a')](_0xc5d5('0x2b'),util[_0xc5d5('0x2c')](_0x163546,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xc5d5('0x2d')]['isNotNull']=function(_0x13a910){return _0x13a910!==null&&!_[_0xc5d5('0x2e')](_0x13a910);};VoiceCallReport[_0xc5d5('0x2d')]['emit']=function(_0x1fdbeb,_0x53bbf8,_0xbcd101){io['to'](_0x1fdbeb)[_0xc5d5('0x2f')](_0x53bbf8,_0xbcd101);};VoiceCallReport[_0xc5d5('0x2d')]['syncNewCallerId']=function(_0x2f98d5){try{if(this[_0xc5d5('0x30')](_0x2f98d5)){logger['info'](_0xc5d5('0x31'),_0x2f98d5[_0xc5d5('0x32')],_0x2f98d5['calleridname'],_0x2f98d5[_0xc5d5('0x33')]);logger[_0xc5d5('0x34')](_0xc5d5('0x35'),_0x2f98d5['uniqueid'],util[_0xc5d5('0x2c')](_0x2f98d5,{'showHidden':![],'depth':null}));if(_0x2f98d5['uniqueid']===_0x2f98d5[_0xc5d5('0x36')]){if(!_[_0xc5d5('0x2e')](this[_0xc5d5('0x11')][_0x2f98d5['uniqueid']])){_[_0xc5d5('0x37')](this[_0xc5d5('0x11')][_0x2f98d5['uniqueid']],_[_0xc5d5('0x38')](_0x2f98d5,_[_0xc5d5('0x39')](this['channels'][_0x2f98d5['uniqueid']])));}}if(_0x2f98d5[_0xc5d5('0x3a')]===_0xc5d5('0x3b')){var _0x40a112=this['agents'][_0x2f98d5['channel']['split']('-')[0x0]];if(_0x40a112){if(_0x2f98d5[_0xc5d5('0x3c')]==_0xc5d5('0x3d')){_0x40a112[_0xc5d5('0x3e')]=_0x2f98d5['connectedlinenum'];this[_0xc5d5('0x2f')](util[_0xc5d5('0x3f')](_0xc5d5('0x40'),_0x40a112[_0xc5d5('0x41')]),_0xc5d5('0x42'),{'id':_0x40a112['id'],'destaccountcode':_0x40a112[_0xc5d5('0x43')],'destconnectedlinenum':_0x2f98d5[_0xc5d5('0x44')]});}}}}}catch(_0x5bf8ed){logger[_0xc5d5('0x2a')]('[%s][voiceCallReport][newcallerid]',_0x2f98d5[_0xc5d5('0x32')],util[_0xc5d5('0x2c')](_0x5bf8ed,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc5d5('0x2d')][_0xc5d5('0x18')]=function(_0x1d3024){try{if(this[_0xc5d5('0x30')](_0x1d3024)){logger['debug']('[%s][voiceCallReport][newchannel]\x20event:',_0x1d3024['uniqueid'],util[_0xc5d5('0x2c')](_0x1d3024,{'showHidden':![],'depth':null}));if(this['channels'][_0x1d3024[_0xc5d5('0x32')]]){return;}if(_0x1d3024[_0xc5d5('0x45')]===_0xc5d5('0x46')){return;}if(_0x1d3024['uniqueid']!==_0x1d3024['linkedid']&&!this['blindTransfers'][_0x1d3024[_0xc5d5('0x36')]]){return;}logger[_0xc5d5('0x27')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x1d3024['uniqueid'],_0x1d3024['context'],_0x1d3024[_0xc5d5('0x3c')]);this[_0xc5d5('0x11')][_0x1d3024[_0xc5d5('0x32')]]=new Channel();this[_0xc5d5('0x11')][_0x1d3024['uniqueid']][_0xc5d5('0x47')]=moment()[_0xc5d5('0x3f')](_0xc5d5('0x48'));this['channels'][_0x1d3024[_0xc5d5('0x32')]]['disposition']=dispositions[_[_0xc5d5('0x49')](_0x1d3024[_0xc5d5('0x4a')])];_['merge'](this[_0xc5d5('0x11')][_0x1d3024[_0xc5d5('0x32')]],_['pick'](_0x1d3024,_[_0xc5d5('0x39')](this['channels'][_0x1d3024[_0xc5d5('0x32')]])));if(_0x1d3024['context']===_0xc5d5('0x3b')){var _0x507ca6=this[_0xc5d5('0x12')][_0x1d3024[_0xc5d5('0x45')][_0xc5d5('0x4b')]('-')[0x0]];if(_0x507ca6&&typeof _0x507ca6[_0xc5d5('0x3e')]===_0xc5d5('0x4c')){_0x507ca6['destconnectedlinenum']=_0x1d3024[_0xc5d5('0x3c')];logger['debug']('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x1d3024[_0xc5d5('0x32')],util[_0xc5d5('0x2c')]({'id':_0x507ca6['id'],'destaccountcode':_0x507ca6[_0xc5d5('0x43')],'destconnectedlinenum':_0x1d3024[_0xc5d5('0x3c')]},{'showHidden':![],'depth':null}));this[_0xc5d5('0x2f')](util[_0xc5d5('0x3f')](_0xc5d5('0x40'),_0x507ca6[_0xc5d5('0x41')]),'user:agentconnect',{'id':_0x507ca6['id'],'destaccountcode':_0x507ca6[_0xc5d5('0x43')],'destconnectedlinenum':_0x1d3024[_0xc5d5('0x3c')]});}}}}catch(_0x5d2fae){logger['error']('[%s][voiceCallReport][newchannel]',_0x1d3024[_0xc5d5('0x32')],util[_0xc5d5('0x2c')](_0x5d2fae,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc5d5('0x2d')][_0xc5d5('0x14')]=function(_0x243b00){try{if(this[_0xc5d5('0x30')](_0x243b00)){logger['debug'](_0xc5d5('0x4d'),_0x243b00['uniqueid'],util[_0xc5d5('0x2c')](_0x243b00,{'showHidden':![],'depth':null}));if(_0x243b00[_0xc5d5('0x45')]==='OutgoingSpoolFailed'||_0x243b00['exten']==='h')return;if(_0x243b00['uniqueid']===_0x243b00[_0xc5d5('0x36')]||this[_0xc5d5('0x4e')][_0x243b00[_0xc5d5('0x36')]]){_0x243b00['application']=_0x243b00[_0xc5d5('0x4f')]?_0x243b00['application'][_0xc5d5('0x50')]():undefined;_0x243b00['applicationdata']=_0x243b00[_0xc5d5('0x51')]||_0x243b00[_0xc5d5('0x52')];if(_0x243b00[_0xc5d5('0x51')]&&_0x243b00[_0xc5d5('0x4f')]!=='queue'){_0x243b00['applicationdata']=_0x243b00['applicationdata']['toLowerCase']();}logger[_0xc5d5('0x27')](_0xc5d5('0x53'),_0x243b00['uniqueid'],_0x243b00['application'],_0x243b00[_0xc5d5('0x52')]);if(_[_0xc5d5('0x2e')](this[_0xc5d5('0x11')][_0x243b00[_0xc5d5('0x32')]])){this[_0xc5d5('0x11')][_0x243b00[_0xc5d5('0x32')]]=new Channel();this[_0xc5d5('0x11')][_0x243b00[_0xc5d5('0x32')]]['starttime']=_0x243b00['duration']?moment()[_0xc5d5('0x54')](moment[_0xc5d5('0x55')](_0x243b00['duration'])[_0xc5d5('0x56')](),_0xc5d5('0x56'))[_0xc5d5('0x3f')](_0xc5d5('0x48')):moment()[_0xc5d5('0x3f')](_0xc5d5('0x48'));this[_0xc5d5('0x11')][_0x243b00[_0xc5d5('0x32')]][_0xc5d5('0x57')]=_0xc5d5('0xa');}_[_0xc5d5('0x37')](this[_0xc5d5('0x11')][_0x243b00[_0xc5d5('0x32')]],_[_0xc5d5('0x38')](_0x243b00,_[_0xc5d5('0x39')](this[_0xc5d5('0x11')][_0x243b00[_0xc5d5('0x32')]])));if(_[_0xc5d5('0x58')](applications,_0x243b00[_0xc5d5('0x4f')])){this[_0xc5d5('0x11')][_0x243b00[_0xc5d5('0x32')]][_0xc5d5('0x59')]=_0x243b00[_0xc5d5('0x4f')];this[_0xc5d5('0x11')][_0x243b00[_0xc5d5('0x32')]][_0xc5d5('0x5a')]=_0x243b00[_0xc5d5('0x52')];if(_0x243b00[_0xc5d5('0x4f')]===_0xc5d5('0x7')&&_[_0xc5d5('0x5b')](_0x243b00[_0xc5d5('0x52')][_0xc5d5('0x50')](),_0xc5d5('0x5c'))){var _0x3709be=_0x243b00[_0xc5d5('0x52')][_0xc5d5('0x4b')]('=');var _0x55e5de=_0x3709be[0x0][_0xc5d5('0x50')]()['match'](/cdr\((.*)\)/);if(_0x55e5de){if(_0x55e5de[0x1]===_0xc5d5('0x5d')&&!_['isNil'](this[_0xc5d5('0x11')][_0x243b00[_0xc5d5('0x32')]][_0x55e5de[0x1]]))return;this[_0xc5d5('0x11')][_0x243b00[_0xc5d5('0x32')]][_0x55e5de[0x1]]=_0x3709be[0x1];}}else if(_0x243b00[_0xc5d5('0x4f')]===_0xc5d5('0x5e')){this['channels'][_0x243b00['uniqueid']][_0xc5d5('0x5e')]=_0x243b00[_0xc5d5('0x52')][_0xc5d5('0x4b')](',')[0x0];}}}}}catch(_0x283015){logger['error'](_0xc5d5('0x5f'),_0x243b00[_0xc5d5('0x32')],util[_0xc5d5('0x2c')](_0x283015,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc5d5('0x2d')][_0xc5d5('0x1a')]=function(_0x6683c){try{if(this['isNotNull'](_0x6683c)){logger[_0xc5d5('0x27')](_0xc5d5('0x60'),_0x6683c[_0xc5d5('0x32')],_0x6683c[_0xc5d5('0x36')],_0x6683c['calleridname'],_0x6683c['calleridnum']);logger[_0xc5d5('0x34')](_0xc5d5('0x61'),_0x6683c[_0xc5d5('0x32')],util[_0xc5d5('0x2c')](_0x6683c,{'showHidden':![],'depth':null}));if(_0x6683c['channelstate']!=='6')return;var _0x33d8e8=this['agents'][_0x6683c[_0xc5d5('0x45')][_0xc5d5('0x4b')]('-')[0x0]];if(_0x6683c[_0xc5d5('0x32')]!==_0x6683c['linkedid']){var _0x4a7216=moment();if(this[_0xc5d5('0x11')][_0x6683c[_0xc5d5('0x36')]]){if(!this['channels'][_0x6683c['linkedid']][_0xc5d5('0x62')]){this[_0xc5d5('0x11')][_0x6683c[_0xc5d5('0x36')]][_0xc5d5('0x62')]=!![];this[_0xc5d5('0x11')][_0x6683c[_0xc5d5('0x36')]]['answertime']=_0x4a7216[_0xc5d5('0x3f')](_0xc5d5('0x48'));if(this[_0xc5d5('0x11')][_0x6683c[_0xc5d5('0x36')]]['starttime']){this['channels'][_0x6683c[_0xc5d5('0x36')]]['holdtime']=_0x4a7216[_0xc5d5('0x63')](this['channels'][_0x6683c['linkedid']]['starttime'],'seconds');}}this[_0xc5d5('0x11')][_0x6683c[_0xc5d5('0x36')]][_0xc5d5('0x36')]=_0x6683c[_0xc5d5('0x32')];if(_0x6683c[_0xc5d5('0x33')]!==_0xc5d5('0x3d')){this[_0xc5d5('0x11')][_0x6683c[_0xc5d5('0x36')]]['connectedlinenum']=_0x6683c[_0xc5d5('0x33')];}this[_0xc5d5('0x11')][_0x6683c[_0xc5d5('0x36')]][_0xc5d5('0x64')]=_0x6683c[_0xc5d5('0x65')];this['channels'][_0x6683c[_0xc5d5('0x36')]][_0xc5d5('0x66')]=_0x6683c[_0xc5d5('0x45')];this[_0xc5d5('0x11')][_0x6683c[_0xc5d5('0x36')]][_0xc5d5('0x57')]=dispositions[_[_0xc5d5('0x49')](_0x6683c[_0xc5d5('0x4a')])];if(_0x33d8e8){this[_0xc5d5('0x11')][_0x6683c[_0xc5d5('0x36')]]['UserId']=_0x33d8e8['id'];this[_0xc5d5('0x11')][_0x6683c['linkedid']]['membername']=_0x33d8e8['name'];}}if(this[_0xc5d5('0x11')][_0x6683c[_0xc5d5('0x32')]]){if(!this['channels'][_0x6683c[_0xc5d5('0x32')]][_0xc5d5('0x62')]){this[_0xc5d5('0x11')][_0x6683c[_0xc5d5('0x32')]][_0xc5d5('0x62')]=!![];this['channels'][_0x6683c['uniqueid']][_0xc5d5('0x67')]=_0x4a7216['format'](_0xc5d5('0x48'));if(this[_0xc5d5('0x11')][_0x6683c[_0xc5d5('0x32')]][_0xc5d5('0x47')]){this[_0xc5d5('0x11')][_0x6683c[_0xc5d5('0x32')]][_0xc5d5('0x68')]=_0x4a7216[_0xc5d5('0x63')](this[_0xc5d5('0x11')][_0x6683c[_0xc5d5('0x32')]][_0xc5d5('0x47')],_0xc5d5('0x56'));}}if(_0x6683c[_0xc5d5('0x33')]!=='xcally-motion-preview'){this[_0xc5d5('0x11')][_0x6683c['uniqueid']]['connectedlinenum']=_0x6683c[_0xc5d5('0x33')];}this[_0xc5d5('0x11')][_0x6683c[_0xc5d5('0x32')]][_0xc5d5('0x64')]=_0x6683c[_0xc5d5('0x65')];this['channels'][_0x6683c[_0xc5d5('0x32')]]['destinationchannel']=_0x6683c[_0xc5d5('0x45')];this[_0xc5d5('0x11')][_0x6683c[_0xc5d5('0x32')]][_0xc5d5('0x57')]=dispositions[_[_0xc5d5('0x49')](_0x6683c[_0xc5d5('0x4a')])];}}else{if(this[_0xc5d5('0x11')][_0x6683c[_0xc5d5('0x32')]]){if(_0x33d8e8){this['channels'][_0x6683c[_0xc5d5('0x32')]][_0xc5d5('0x69')]=_0x33d8e8['id'];this[_0xc5d5('0x11')][_0x6683c[_0xc5d5('0x32')]][_0xc5d5('0x6a')]=_0x33d8e8[_0xc5d5('0x41')];}}}if(_0x6683c['context']==='from-sip'){if(_0x33d8e8){_0x33d8e8[_0xc5d5('0x3e')]=_0x6683c[_0xc5d5('0x3c')];var _0x5d77ab;if(this[_0xc5d5('0x11')][_0x6683c[_0xc5d5('0x32')]]){_0x5d77ab=this[_0xc5d5('0x11')][_0x6683c[_0xc5d5('0x32')]][_0xc5d5('0x5e')];}else if(this['channels'][_0x6683c[_0xc5d5('0x36')]]){_0x5d77ab=this['channels'][_0x6683c[_0xc5d5('0x36')]][_0xc5d5('0x5e')];}_0x33d8e8[_0xc5d5('0x5e')]=_0x5d77ab;var _0x59baab={'id':_0x33d8e8['id'],'name':_0x33d8e8[_0xc5d5('0x41')],'agentconnected':!![],'destaccountcode':_0x33d8e8['accountcode'],'destconnectedlinenum':_0x6683c['exten'],'queue':_0x5d77ab||undefined,'uniqueid':_0x6683c[_0xc5d5('0x36')]};logger[_0xc5d5('0x34')](_0xc5d5('0x6b'),_0x6683c[_0xc5d5('0x32')],util[_0xc5d5('0x2c')](_0x59baab,{'showHidden':![],'depth':null}));this['emit'](util[_0xc5d5('0x3f')](_0xc5d5('0x40'),_0x33d8e8[_0xc5d5('0x41')]),_0xc5d5('0x42'),_0x59baab);}}}}catch(_0x407c38){logger['error'](_0xc5d5('0x6c'),_0x6683c[_0xc5d5('0x32')],util[_0xc5d5('0x2c')](_0x407c38,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc5d5('0x2d')][_0xc5d5('0x6d')]=function(_0x1d6ece,_0x5e813a){try{if(this[_0xc5d5('0x11')][_0x1d6ece]){logger[_0xc5d5('0x27')](_0xc5d5('0x6e'),_0x1d6ece,_0x5e813a);this['channels'][_0x1d6ece][_0xc5d5('0x6f')]=!![];if(_[_0xc5d5('0x70')](_0x5e813a,_0xc5d5('0x71'))){_0x5e813a=_0x5e813a[_0xc5d5('0x72')](_0xc5d5('0x71'),_0xc5d5('0x73'));}this['channels'][_0x1d6ece][_0xc5d5('0x74')]=_0x5e813a;var _0x29aa6d=_['find'](this[_0xc5d5('0x11')][_0x1d6ece][_0xc5d5('0x75')],{'filename':_0x5e813a});if(_[_0xc5d5('0x76')](_0x29aa6d)){this[_0xc5d5('0x11')][_0x1d6ece][_0xc5d5('0x75')][_0xc5d5('0x77')]({'filename':_0x5e813a,'createdAt':moment()[_0xc5d5('0x3f')](_0xc5d5('0x48')),'mixmonitorid':'','status':_0xc5d5('0x78')});}}}catch(_0x4c4aa4){logger[_0xc5d5('0x2a')](_0xc5d5('0x79'),_0x1d6ece,util['inspect'](_0x4c4aa4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc5d5('0x2d')]['syncVarSet']=function(_0x5e9a32){try{if(this[_0xc5d5('0x30')](_0x5e9a32)){logger[_0xc5d5('0x34')](_0xc5d5('0x7a'),_0x5e9a32[_0xc5d5('0x32')],util[_0xc5d5('0x2c')](_0x5e9a32,{'showHidden':![],'depth':null}));if(this[_0xc5d5('0x11')][_0x5e9a32[_0xc5d5('0x32')]]&&_0x5e9a32[_0xc5d5('0x45')]!=_0xc5d5('0x46')){if(this[_0xc5d5('0x30')](_0x5e9a32[_0xc5d5('0x7b')])){if(this[_0xc5d5('0x30')](_0x5e9a32['variable'][_0xc5d5('0x7c')])){logger['info'](_0xc5d5('0x7d'),_0x5e9a32[_0xc5d5('0x32')],_0x5e9a32[_0xc5d5('0x7e')]);this[_0xc5d5('0x6d')](_0x5e9a32[_0xc5d5('0x32')],_0x5e9a32[_0xc5d5('0x7e')]);}else if(this['isNotNull'](_0x5e9a32[_0xc5d5('0x7b')]['xmd-phone'])){logger[_0xc5d5('0x27')](_0xc5d5('0x7f'),_0x5e9a32[_0xc5d5('0x32')],_0x5e9a32[_0xc5d5('0x7e')]);this['channels'][_0x5e9a32[_0xc5d5('0x32')]][_0xc5d5('0x33')]=_0x5e9a32[_0xc5d5('0x7e')];}else if(this['isNotNull'](_0x5e9a32[_0xc5d5('0x7b')][_0xc5d5('0x80')])){logger[_0xc5d5('0x27')](_0xc5d5('0x81'),_0x5e9a32[_0xc5d5('0x32')],_0x5e9a32[_0xc5d5('0x7e')]);this['channels'][_0x5e9a32['uniqueid']][_0xc5d5('0x82')]=_0x5e9a32[_0xc5d5('0x7e')];}else if(this['isNotNull'](_0x5e9a32['variable'][_0xc5d5('0x83')])){logger['info'](_0xc5d5('0x84'),_0x5e9a32[_0xc5d5('0x32')],_0x5e9a32['value']);this[_0xc5d5('0x11')][_0x5e9a32[_0xc5d5('0x32')]][_0xc5d5('0x5d')]=_0x5e9a32[_0xc5d5('0x7e')];}else if(this[_0xc5d5('0x30')](_0x5e9a32['variable'][_0xc5d5('0x85')])){logger[_0xc5d5('0x27')](_0xc5d5('0x86'),_0x5e9a32[_0xc5d5('0x32')],_0x5e9a32[_0xc5d5('0x7e')][_0xc5d5('0x4b')](',')[0x0]);this[_0xc5d5('0x11')][_0x5e9a32[_0xc5d5('0x32')]][_0xc5d5('0x5e')]=_0x5e9a32[_0xc5d5('0x7e')][_0xc5d5('0x4b')](',')[0x0];}else if(this[_0xc5d5('0x30')](_0x5e9a32[_0xc5d5('0x7b')]['xmd-originatecalleridnum'])){logger['info'](_0xc5d5('0x87'),_0x5e9a32[_0xc5d5('0x32')],_0x5e9a32[_0xc5d5('0x7e')]);this['channels'][_0x5e9a32['uniqueid']]['originatecalleridnum']=_0x5e9a32[_0xc5d5('0x7e')];}else if(this['isNotNull'](_0x5e9a32['variable']['xmd-destination'])){logger[_0xc5d5('0x27')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x5e9a32['uniqueid'],_0x5e9a32['value']);this[_0xc5d5('0x11')][_0x5e9a32[_0xc5d5('0x32')]][_0xc5d5('0x88')]=_0x5e9a32[_0xc5d5('0x7e')];}else if(this['isNotNull'](_0x5e9a32[_0xc5d5('0x7b')][_0xc5d5('0x89')])){logger[_0xc5d5('0x27')](_0xc5d5('0x8a'),_0x5e9a32[_0xc5d5('0x32')],_0x5e9a32[_0xc5d5('0x7e')]);this['channels'][_0x5e9a32['uniqueid']][_0xc5d5('0x8b')]=_0x5e9a32[_0xc5d5('0x7e')];}else if(this['isNotNull'](_0x5e9a32[_0xc5d5('0x7b')][_0xc5d5('0x8c')])){logger[_0xc5d5('0x27')](_0xc5d5('0x8d'),_0x5e9a32[_0xc5d5('0x32')],_0x5e9a32[_0xc5d5('0x7e')]);this[_0xc5d5('0x11')][_0x5e9a32['uniqueid']][_0xc5d5('0x5e')]=_0x5e9a32['value'];}else if(this[_0xc5d5('0x30')](_0x5e9a32[_0xc5d5('0x7b')][_0xc5d5('0x8e')])){logger[_0xc5d5('0x27')](_0xc5d5('0x8f'),_0x5e9a32[_0xc5d5('0x32')],_0x5e9a32['value']);this[_0xc5d5('0x11')][_0x5e9a32[_0xc5d5('0x32')]][_0xc5d5('0x90')]=_0x5e9a32[_0xc5d5('0x7e')];}}}else if(this[_0xc5d5('0x30')](_0x5e9a32[_0xc5d5('0x7b')][_0xc5d5('0x7c')])){if(_0x5e9a32[_0xc5d5('0x7e')]){var _0x5ec998=path[_0xc5d5('0x91')](_0x5e9a32[_0xc5d5('0x7e')])[_0xc5d5('0x41')];logger[_0xc5d5('0x27')](_0xc5d5('0x7d'),_0x5ec998,_0x5e9a32[_0xc5d5('0x7e')]);this[_0xc5d5('0x6d')](_0x5ec998,_0x5e9a32[_0xc5d5('0x7e')]);}}else if(this['channels'][_0x5e9a32[_0xc5d5('0x36')]]){if(this[_0xc5d5('0x30')](_0x5e9a32['variable'])){if(this[_0xc5d5('0x30')](_0x5e9a32[_0xc5d5('0x7b')][_0xc5d5('0x8e')])){logger[_0xc5d5('0x27')](_0xc5d5('0x8f'),_0x5e9a32[_0xc5d5('0x36')],_0x5e9a32[_0xc5d5('0x7e')]);this[_0xc5d5('0x11')][_0x5e9a32['linkedid']][_0xc5d5('0x92')]=_0x5e9a32['value'];}}}}}catch(_0x2e97b1){logger[_0xc5d5('0x2a')](_0xc5d5('0x93'),_0x5e9a32['uniqueid'],util[_0xc5d5('0x2c')](_0x2e97b1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xc5d5('0x1e')]=function(_0x4544d9){try{if(this[_0xc5d5('0x30')](_0x4544d9)){logger['debug'](_0xc5d5('0x94'),_0x4544d9[_0xc5d5('0x32')],util[_0xc5d5('0x2c')](_0x4544d9,{'showHidden':![],'depth':null}));if(this[_0xc5d5('0x4e')][_0x4544d9[_0xc5d5('0x36')]]){if(this['channels'][this[_0xc5d5('0x4e')][_0x4544d9[_0xc5d5('0x36')]][_0xc5d5('0x36')]]){this['channels'][this[_0xc5d5('0x4e')][_0x4544d9['linkedid']][_0xc5d5('0x36')]][_0xc5d5('0x32')]=_0x4544d9[_0xc5d5('0x32')];this['channels'][this[_0xc5d5('0x4e')][_0x4544d9['linkedid']][_0xc5d5('0x36')]][_0xc5d5('0x62')]=this['channels'][_0x4544d9[_0xc5d5('0x32')]][_0xc5d5('0x62')];this['channels'][this[_0xc5d5('0x4e')][_0x4544d9['linkedid']]['linkedid']]['answertime']=this[_0xc5d5('0x11')][_0x4544d9['uniqueid']][_0xc5d5('0x67')];this['channels'][this['blindTransfers'][_0x4544d9[_0xc5d5('0x36')]]['linkedid']][_0xc5d5('0x66')]=this[_0xc5d5('0x11')][this[_0xc5d5('0x4e')][_0x4544d9[_0xc5d5('0x36')]][_0xc5d5('0x36')]]['channel'];this[_0xc5d5('0x11')][this[_0xc5d5('0x4e')][_0x4544d9['linkedid']][_0xc5d5('0x36')]][_0xc5d5('0x57')]=this['channels'][_0x4544d9[_0xc5d5('0x32')]][_0xc5d5('0x57')];this[_0xc5d5('0x11')][_0x4544d9[_0xc5d5('0x32')]]=this[_0xc5d5('0x11')][this['blindTransfers'][_0x4544d9[_0xc5d5('0x36')]][_0xc5d5('0x36')]];this[_0xc5d5('0x95')](this[_0xc5d5('0x4e')][_0x4544d9['linkedid']][_0xc5d5('0x36')]);}else if(this['channels'][this[_0xc5d5('0x4e')][_0x4544d9[_0xc5d5('0x36')]][_0xc5d5('0x32')]]){this['channels'][this['blindTransfers'][_0x4544d9[_0xc5d5('0x36')]][_0xc5d5('0x32')]][_0xc5d5('0x32')]=[this[_0xc5d5('0x11')][this[_0xc5d5('0x4e')][_0x4544d9[_0xc5d5('0x36')]]['uniqueid']][_0xc5d5('0x36')],this[_0xc5d5('0x11')][this['blindTransfers'][_0x4544d9['linkedid']][_0xc5d5('0x32')]]['linkedid']=this[_0xc5d5('0x11')][this[_0xc5d5('0x4e')][_0x4544d9[_0xc5d5('0x36')]][_0xc5d5('0x32')]][_0xc5d5('0x32')]][0x0];this[_0xc5d5('0x11')][this[_0xc5d5('0x4e')][_0x4544d9[_0xc5d5('0x36')]][_0xc5d5('0x32')]][_0xc5d5('0x62')]=this[_0xc5d5('0x11')][_0x4544d9[_0xc5d5('0x32')]][_0xc5d5('0x62')];this[_0xc5d5('0x11')][this[_0xc5d5('0x4e')][_0x4544d9[_0xc5d5('0x36')]][_0xc5d5('0x32')]][_0xc5d5('0x67')]=this['channels'][_0x4544d9['uniqueid']]['answertime'];this[_0xc5d5('0x11')][this[_0xc5d5('0x4e')][_0x4544d9['linkedid']][_0xc5d5('0x32')]][_0xc5d5('0x66')]=this['channels'][this['blindTransfers'][_0x4544d9[_0xc5d5('0x36')]]['uniqueid']][_0xc5d5('0x45')];this['channels'][this[_0xc5d5('0x4e')][_0x4544d9['linkedid']][_0xc5d5('0x32')]][_0xc5d5('0x57')]=this[_0xc5d5('0x11')][_0x4544d9[_0xc5d5('0x32')]][_0xc5d5('0x57')];this[_0xc5d5('0x11')][_0x4544d9['uniqueid']]=this['channels'][this[_0xc5d5('0x4e')][_0x4544d9['linkedid']][_0xc5d5('0x32')]];this['deleteChannelAfterTimeout'](this[_0xc5d5('0x4e')][_0x4544d9['linkedid']][_0xc5d5('0x32')]);}}if(this['channels'][_0x4544d9['uniqueid']]){logger[_0xc5d5('0x27')](_0xc5d5('0x96'),_0x4544d9['uniqueid'],_0x4544d9[_0xc5d5('0x97')]);var _0x129fd4=moment();this[_0xc5d5('0x11')][_0x4544d9[_0xc5d5('0x32')]]['endtime']=_0x129fd4[_0xc5d5('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc5d5('0x11')][_0x4544d9['uniqueid']][_0xc5d5('0x55')]=_0x129fd4[_0xc5d5('0x63')](this['channels'][_0x4544d9['uniqueid']][_0xc5d5('0x47')],'seconds');if(this[_0xc5d5('0x11')][_0x4544d9[_0xc5d5('0x32')]][_0xc5d5('0x62')]){this[_0xc5d5('0x11')][_0x4544d9[_0xc5d5('0x32')]][_0xc5d5('0x98')]=_0x129fd4['diff'](this['channels'][_0x4544d9[_0xc5d5('0x32')]][_0xc5d5('0x67')],_0xc5d5('0x56'));this['channels'][_0x4544d9[_0xc5d5('0x32')]][_0xc5d5('0x68')]=this[_0xc5d5('0x11')][_0x4544d9[_0xc5d5('0x32')]][_0xc5d5('0x55')]-this[_0xc5d5('0x11')][_0x4544d9[_0xc5d5('0x32')]]['billableseconds'];}if(_0x4544d9['context']===_0xc5d5('0x3b')){if(this['agents'][_0x4544d9[_0xc5d5('0x45')]['split']('-')[0x0]]){this[_0xc5d5('0x12')][_0x4544d9['channel'][_0xc5d5('0x4b')]('-')[0x0]]=_[_0xc5d5('0x99')](this[_0xc5d5('0x12')][_0x4544d9[_0xc5d5('0x45')][_0xc5d5('0x4b')]('-')[0x0]],[_0xc5d5('0x3e')]);logger[_0xc5d5('0x34')](_0xc5d5('0x9a'),_0x4544d9[_0xc5d5('0x32')],util[_0xc5d5('0x2c')]({'id':this['agents'][_0x4544d9[_0xc5d5('0x45')][_0xc5d5('0x4b')]('-')[0x0]]['id'],'destaccountcode':this[_0xc5d5('0x12')][_0x4544d9[_0xc5d5('0x45')]['split']('-')[0x0]][_0xc5d5('0x43')]},{'showHidden':![],'depth':null}));this[_0xc5d5('0x2f')](util[_0xc5d5('0x3f')](_0xc5d5('0x40'),this[_0xc5d5('0x12')][_0x4544d9['channel'][_0xc5d5('0x4b')]('-')[0x0]][_0xc5d5('0x41')]),_0xc5d5('0x9b'),{'id':this[_0xc5d5('0x12')][_0x4544d9['channel'][_0xc5d5('0x4b')]('-')[0x0]]['id'],'destaccountcode':this[_0xc5d5('0x12')][_0x4544d9[_0xc5d5('0x45')]['split']('-')[0x0]][_0xc5d5('0x43')]});for(var _0x23d158=0x0;_0x23d158{delete this[_0xc5d5('0x11')][_0x461055];},_0x2c7916);}};module[_0xc5d5('0xc8')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index ac73a94..9fc7612 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde2b=['syncNewExten','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','set','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','application','split','match','[%s][voiceDialReport][newexten]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','dialend','syncDialEnd','bind','varset','syncVarSet','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','inspect','uniqueid','merge','format','called','substring','channel','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','applications','voice:outbound','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','YYYY-MM-DD\x20HH:mm:ss','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','membername','memberpenalty','isNil','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','starttime','seconds','lastevent','complete','total','answertime','billableseconds','diff','sumHoldTime','holdtime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','[%s][voiceDialReport][hangup]'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0xde2b,0x18a));var _0xbde2=function(_0x489371,_0x5f542a){_0x489371=_0x489371-0x0;var _0x20d5be=_0xde2b[_0x489371];return _0x20d5be;};'use strict';var _=require(_0xbde2('0x0'));var moment=require(_0xbde2('0x1'));var util=require(_0xbde2('0x2'));var Redis=require(_0xbde2('0x3'));var config=require(_0xbde2('0x4'));var logger=require(_0xbde2('0x5'))(_0xbde2('0x6'));var ami=require(_0xbde2('0x7'));config['redis']=_[_0xbde2('0x8')](config[_0xbde2('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xbde2('0xa'))(new Redis(config[_0xbde2('0x9')]));function VoiceDialReport(_0x31e1ae){this[_0xbde2('0xb')]=_0x31e1ae[_0xbde2('0xc')];this['outbound']=_0x31e1ae[_0xbde2('0xd')];this['applications']={};this[_0xbde2('0xe')]={};ami['on'](_0xbde2('0xf'),this[_0xbde2('0x10')]['bind'](this));ami['on'](_0xbde2('0x11'),this[_0xbde2('0x12')][_0xbde2('0x13')](this));ami['on'](_0xbde2('0x14'),this[_0xbde2('0x15')][_0xbde2('0x13')](this));ami['on']('hangup',this[_0xbde2('0x16')][_0xbde2('0x13')](this));}VoiceDialReport[_0xbde2('0x17')][_0xbde2('0x18')]=function(_0x18df94){return _0x18df94!==null&&!_[_0xbde2('0x19')](_0x18df94);};VoiceDialReport['prototype']['emit']=function(_0x4155fb,_0x482e1b,_0x266f40){io['to'](_0x4155fb)[_0xbde2('0x1a')](_0x482e1b,_0x266f40);};VoiceDialReport[_0xbde2('0x17')][_0xbde2('0x10')]=function(_0xc03e30){try{if(this[_0xbde2('0x18')](_0xc03e30)){logger[_0xbde2('0x1b')](_0xbde2('0x1c'),_0xc03e30['uniqueid'],util[_0xbde2('0x1d')](_0xc03e30,{'showHidden':![],'depth':null}));if(this[_0xbde2('0xb')][_0xc03e30[_0xbde2('0x1e')]]){_[_0xbde2('0x1f')](this[_0xbde2('0xb')][_0xc03e30[_0xbde2('0x1e')]],{'starttime':moment()[_0xbde2('0x20')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xbde2('0x21'),'interface':_0xc03e30['channel'][_0xbde2('0x22')](0x0,_0xc03e30[_0xbde2('0x23')][_0xbde2('0x24')]('-')),'membername':_0xc03e30[_0xbde2('0x23')][_0xbde2('0x22')](_0xc03e30['channel']['lastIndexOf']('/')+0x1,_0xc03e30[_0xbde2('0x23')][_0xbde2('0x24')]('-'))},_[_0xbde2('0x25')](_0xc03e30,[_0xbde2('0x26'),_0xbde2('0x27')]));logger[_0xbde2('0x28')](_0xbde2('0x29'),_0xc03e30['uniqueid'],this[_0xbde2('0xb')][_0xc03e30[_0xbde2('0x1e')]]['membername'],this['channels'][_0xc03e30[_0xbde2('0x1e')]][_0xbde2('0x2a')]);logger['debug'](_0xbde2('0x2b'),_0xc03e30['uniqueid'],util['inspect'](this[_0xbde2('0xb')][_0xc03e30['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0xbde2('0x2c')][_0xc03e30[_0xbde2('0x1e')]])_[_0xbde2('0x1f')](this[_0xbde2('0xb')][_0xc03e30[_0xbde2('0x1e')]],this[_0xbde2('0x2c')][_0xc03e30[_0xbde2('0x1e')]]);this[_0xbde2('0x1a')](_0xbde2('0x2d'),'voice_outbound_channel:save',this[_0xbde2('0xb')][_0xc03e30[_0xbde2('0x1e')]]);logger[_0xbde2('0x1b')](_0xbde2('0x2e'),_0xc03e30[_0xbde2('0x1e')],util['inspect'](this[_0xbde2('0xb')][_0xc03e30['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xbde2('0x2f'),this[_0xbde2('0xb')][_0xc03e30[_0xbde2('0x1e')]]);}}}catch(_0x57bc3){logger[_0xbde2('0x30')](_0xbde2('0x31'),_0xc03e30['uniqueid'],util['inspect'](_0x57bc3,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xbde2('0x17')]['syncDialEnd']=function(_0x44e31e){try{if(this[_0xbde2('0x18')](_0x44e31e)){logger['debug'](_0xbde2('0x32'),_0x44e31e[_0xbde2('0x1e')],util[_0xbde2('0x1d')](_0x44e31e,{'showHidden':![],'depth':null}));if(this[_0xbde2('0xb')][_0x44e31e['uniqueid']]){this['channels'][_0x44e31e[_0xbde2('0x1e')]][_0xbde2('0x33')]=_0x44e31e['dialstatus'];if(_0x44e31e['dialstatus']===_0xbde2('0x34')){this[_0xbde2('0xb')][_0x44e31e[_0xbde2('0x1e')]][_0xbde2('0x35')]=_0x44e31e[_0xbde2('0x35')];this[_0xbde2('0xb')][_0x44e31e[_0xbde2('0x1e')]][_0xbde2('0x36')]=_0x44e31e[_0xbde2('0x36')];this[_0xbde2('0xb')][_0x44e31e[_0xbde2('0x1e')]]['answertime']=moment()[_0xbde2('0x20')](_0xbde2('0x37'));this[_0xbde2('0xb')][_0x44e31e['uniqueid']]['lastevent']=_0xbde2('0x38');logger[_0xbde2('0x28')](_0xbde2('0x39'),_0x44e31e[_0xbde2('0x1e')],_0x44e31e[_0xbde2('0x23')][_0xbde2('0x22')](_0x44e31e['channel'][_0xbde2('0x24')]('/')+0x1,_0x44e31e[_0xbde2('0x23')][_0xbde2('0x24')]('-')));logger[_0xbde2('0x1b')](_0xbde2('0x3a'),_0x44e31e[_0xbde2('0x1e')],util[_0xbde2('0x1d')](this[_0xbde2('0xb')][_0x44e31e[_0xbde2('0x1e')]],{'showHidden':![],'depth':null}));ami[_0xbde2('0x1a')]('custom:dialconnect',this[_0xbde2('0xb')][_0x44e31e[_0xbde2('0x1e')]]);}logger[_0xbde2('0x1b')](_0xbde2('0x3b'),_0x44e31e['uniqueid'],util[_0xbde2('0x1d')](this[_0xbde2('0xb')][_0x44e31e['uniqueid']],{'showHidden':![],'depth':null}));this[_0xbde2('0x1a')](_0xbde2('0x2d'),'voice_outbound_channel:save',this[_0xbde2('0xb')][_0x44e31e[_0xbde2('0x1e')]]);}}}catch(_0x1b3adf){logger[_0xbde2('0x30')](_0xbde2('0x3c'),_0x44e31e[_0xbde2('0x1e')],util[_0xbde2('0x1d')](_0x1b3adf,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xbde2('0x17')][_0xbde2('0x15')]=function(_0x2ec4f1){try{if(this[_0xbde2('0x18')](_0x2ec4f1)){logger[_0xbde2('0x1b')](_0xbde2('0x3d'),_0x2ec4f1[_0xbde2('0x1e')],util[_0xbde2('0x1d')](_0x2ec4f1,{'showHidden':![],'depth':null}));this[_0xbde2('0x3e')](_0x2ec4f1[_0xbde2('0x1e')],_[_0xbde2('0x3f')](_0x2ec4f1[_0xbde2('0x40')])[0x0],_0x2ec4f1[_0xbde2('0x41')]);if(this['isNotNull'](_0x2ec4f1[_0xbde2('0x40')])&&this[_0xbde2('0x18')](_0x2ec4f1['variable'][_0xbde2('0x42')])){if(_[_0xbde2('0x19')](this[_0xbde2('0xb')][_0x2ec4f1[_0xbde2('0x1e')]])){this['channels'][_0x2ec4f1[_0xbde2('0x1e')]]={'routeId':_0x2ec4f1['value'],'variables':this['variables'][_0x2ec4f1[_0xbde2('0x1e')]],'motionChannel':_0xbde2('0x43')};logger[_0xbde2('0x28')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x2ec4f1['uniqueid'],_0x2ec4f1[_0xbde2('0x40')][_0xbde2('0x42')],_[_0xbde2('0x3f')](_0x2ec4f1[_0xbde2('0x40')])[0x0],_0x2ec4f1[_0xbde2('0x41')]);logger[_0xbde2('0x1b')](_0xbde2('0x44'),_0x2ec4f1[_0xbde2('0x1e')],util['inspect'](this[_0xbde2('0xb')][_0x2ec4f1[_0xbde2('0x1e')]],{'showHidden':![],'depth':null}));this['emit'](_0xbde2('0x2d'),_0xbde2('0x45'),this[_0xbde2('0xb')][_0x2ec4f1[_0xbde2('0x1e')]]);}}}}catch(_0x1df58a){logger[_0xbde2('0x30')](_0xbde2('0x46'),_0x2ec4f1['uniqueid'],util['inspect'](_0x1df58a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xbde2('0x17')]['addVariable']=function(_0xf49e0c,_0xf7181d,_0x288e6c){var _0x420d8f=[_0xbde2('0x47'),_0xbde2('0x48'),'rtpaudioqosjitter',_0xbde2('0x49'),'rtpaudioqosloss',_0xbde2('0x4a'),_0xbde2('0x4b'),'rtpaudioqosrttbridged',_0xbde2('0x4c'),_0xbde2('0x4d'),_0xbde2('0x4e'),_0xbde2('0x4f'),_0xbde2('0x50'),'memberdynamic',_0xbde2('0x51'),_0xbde2('0x52'),_0xbde2('0x53'),_0xbde2('0x54'),'memberrealtime'];if(!_[_0xbde2('0x55')](_0xf7181d)&&!_['includes'](_0x420d8f,_0xf7181d)){if(_[_0xbde2('0x19')](this[_0xbde2('0xe')][_0xf49e0c])){this[_0xbde2('0xe')][_0xf49e0c]={};}this['variables'][_0xf49e0c][_0xf7181d]=_0x288e6c;}};VoiceDialReport[_0xbde2('0x17')]['syncHangup']=function(_0x3e3966){try{if(this[_0xbde2('0x18')](_0x3e3966)){logger[_0xbde2('0x1b')](_0xbde2('0x56'),_0x3e3966[_0xbde2('0x1e')],util['inspect'](_0x3e3966,{'showHidden':![],'depth':null}));if(this[_0xbde2('0xb')][_0x3e3966[_0xbde2('0x1e')]]){logger[_0xbde2('0x28')](_0xbde2('0x57'),_0x3e3966[_0xbde2('0x1e')],_0x3e3966[_0xbde2('0x58')]);this['channels'][_0x3e3966['uniqueid']][_0xbde2('0x59')]=moment()['format'](_0xbde2('0x37'));this[_0xbde2('0xb')][_0x3e3966[_0xbde2('0x1e')]][_0xbde2('0x5a')]=moment(this[_0xbde2('0xb')][_0x3e3966[_0xbde2('0x1e')]][_0xbde2('0x59')])['diff'](this['channels'][_0x3e3966['uniqueid']][_0xbde2('0x5b')],_0xbde2('0x5c'));this[_0xbde2('0xb')][_0x3e3966[_0xbde2('0x1e')]][_0xbde2('0x5d')]=_0xbde2('0x5e');this[_0xbde2('0xd')][_0xbde2('0x5f')]+=0x1;if(this[_0xbde2('0xb')][_0x3e3966[_0xbde2('0x1e')]]['answertime']){this[_0xbde2('0xd')]['answered']+=0x1;this['channels'][_0x3e3966[_0xbde2('0x1e')]]['holdtime']=moment(this[_0xbde2('0xb')][_0x3e3966['uniqueid']][_0xbde2('0x60')])['diff'](this[_0xbde2('0xb')][_0x3e3966[_0xbde2('0x1e')]][_0xbde2('0x5b')],_0xbde2('0x5c'));this[_0xbde2('0xb')][_0x3e3966[_0xbde2('0x1e')]][_0xbde2('0x61')]=moment(this[_0xbde2('0xb')][_0x3e3966['uniqueid']][_0xbde2('0x59')])[_0xbde2('0x62')](this['channels'][_0x3e3966['uniqueid']][_0xbde2('0x60')],_0xbde2('0x5c'));this[_0xbde2('0xd')][_0xbde2('0x63')]+=this[_0xbde2('0xb')][_0x3e3966[_0xbde2('0x1e')]][_0xbde2('0x64')]||0x0;this[_0xbde2('0xd')][_0xbde2('0x65')]+=this['channels'][_0x3e3966[_0xbde2('0x1e')]][_0xbde2('0x61')];}this[_0xbde2('0xd')][_0xbde2('0x66')]+=this['channels'][_0x3e3966[_0xbde2('0x1e')]][_0xbde2('0x5a')];logger['debug'](_0xbde2('0x67'),_0x3e3966[_0xbde2('0x1e')],util['inspect'](this[_0xbde2('0xb')][_0x3e3966[_0xbde2('0x1e')]],{'showHidden':![],'depth':null}));ami[_0xbde2('0x1a')](_0xbde2('0x68'),this[_0xbde2('0xb')][_0x3e3966[_0xbde2('0x1e')]]);logger[_0xbde2('0x1b')](_0xbde2('0x69'),_0x3e3966[_0xbde2('0x1e')],util['inspect'](this[_0xbde2('0xb')][_0x3e3966[_0xbde2('0x1e')]],{'showHidden':![],'depth':null}));ami['emit'](_0xbde2('0x6a'),this[_0xbde2('0xb')][_0x3e3966[_0xbde2('0x1e')]]);logger[_0xbde2('0x1b')](_0xbde2('0x6b'),_0x3e3966[_0xbde2('0x1e')],util[_0xbde2('0x1d')](this[_0xbde2('0xb')][_0x3e3966[_0xbde2('0x1e')]],{'showHidden':![],'depth':null}));this[_0xbde2('0x1a')]('voice:outbound',_0xbde2('0x6c'),this[_0xbde2('0xd')]);logger[_0xbde2('0x28')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this['channels'][_0x3e3966[_0xbde2('0x1e')]]));logger[_0xbde2('0x1b')](_0xbde2('0x6d'),_0x3e3966[_0xbde2('0x1e')],util[_0xbde2('0x1d')](this[_0xbde2('0xb')][_0x3e3966[_0xbde2('0x1e')]],{'showHidden':![],'depth':null}));this[_0xbde2('0x1a')]('voice:outbound',_0xbde2('0x6e'),this[_0xbde2('0xb')][_0x3e3966[_0xbde2('0x1e')]]);this[_0xbde2('0x6f')](_0x3e3966[_0xbde2('0x1e')]);}else if(this[_0xbde2('0xb')][_0x3e3966[_0xbde2('0x70')]]){this['channels'][_0x3e3966[_0xbde2('0x70')]]['uniqueid']=this[_0xbde2('0xb')][_0x3e3966[_0xbde2('0x70')]]['destuniqueid'];}if(this[_0xbde2('0xe')][_0x3e3966[_0xbde2('0x1e')]]){delete this['variables'][_0x3e3966[_0xbde2('0x1e')]];}}}catch(_0x6e906f){logger[_0xbde2('0x30')](_0xbde2('0x71'),_0x3e3966[_0xbde2('0x1e')],util[_0xbde2('0x1d')](_0x6e906f,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xbde2('0x72')]=function(_0x117910){try{if(this['isNotNull'](_0x117910)){logger[_0xbde2('0x1b')](_0xbde2('0x73'),_0x117910['uniqueid'],util[_0xbde2('0x1d')](_0x117910,{'showHidden':![],'depth':null}));if(_0x117910['application'][_0xbde2('0x74')]()===_0xbde2('0x75')){_0x117910[_0xbde2('0x76')]=(_0x117910[_0xbde2('0x77')]||_0x117910[_0xbde2('0x76')])[_0xbde2('0x74')]();if(_[_0xbde2('0x78')](_0x117910[_0xbde2('0x76')],_0xbde2('0x79'))){if(_['isUndefined'](this[_0xbde2('0x2c')][_0x117910[_0xbde2('0x1e')]]))this[_0xbde2('0x2c')][_0x117910[_0xbde2('0x1e')]]={};logger[_0xbde2('0x28')](_0xbde2('0x7a'),_0x117910[_0xbde2('0x1e')],_0x117910[_0xbde2('0x7b')],_0x117910['applicationdata']);var _0x1f1e98=_0x117910['applicationdata'][_0xbde2('0x7c')]('=');var _0x185cd0=_0x1f1e98[0x0][_0xbde2('0x7d')](/cdr\((.*)\)/);if(_0x185cd0)this[_0xbde2('0x2c')][_0x117910[_0xbde2('0x1e')]][_0x185cd0[0x1]]=_0x1f1e98[0x1];}}}}catch(_0x1972f8){logger[_0xbde2('0x30')](_0xbde2('0x7e'),_0x117910[_0xbde2('0x1e')],util[_0xbde2('0x1d')](_0x1972f8,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xbde2('0x6f')]=function(_0x2a0a12,_0x8633f4=0x2710){if(this['channels'][_0x2a0a12]){setTimeout(()=>{delete this['channels'][_0x2a0a12];},_0x8633f4);}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0x8bd1=['[%s][voiceDialReport][newexten]\x20event:','application','set','applicationdata','appdata','toLowerCase','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','ioredis','../../../config/environment','ami','../ami','redis','socket.io-emitter','channels','outboundChannels','outbound','applications','dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','hangup','prototype','isNotNull','isUndefined','emit','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','called','channel','lastIndexOf','substring','omit','event','info','membername','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','merge','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','format','lastevent','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][varset]\x20event:','keys','variable','value','outboundrouteid','variables','voice','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','syncHangup','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','complete','total','holdtime','seconds','billableseconds','sumBillable','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]'];(function(_0x392448,_0x53cd19){var _0xf8ddc0=function(_0x55c99d){while(--_0x55c99d){_0x392448['push'](_0x392448['shift']());}};_0xf8ddc0(++_0x53cd19);}(_0x8bd1,0x80));var _0x18bd=function(_0x4ebe46,_0x1b0223){_0x4ebe46=_0x4ebe46-0x0;var _0x290f7=_0x8bd1[_0x4ebe46];return _0x290f7;};'use strict';var _=require(_0x18bd('0x0'));var moment=require(_0x18bd('0x1'));var util=require('util');var Redis=require(_0x18bd('0x2'));var config=require(_0x18bd('0x3'));var logger=require('../../../config/logger')(_0x18bd('0x4'));var ami=require(_0x18bd('0x5'));config[_0x18bd('0x6')]=_['defaults'](config[_0x18bd('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x18bd('0x7'))(new Redis(config[_0x18bd('0x6')]));function VoiceDialReport(_0x1a5104){this[_0x18bd('0x8')]=_0x1a5104[_0x18bd('0x9')];this[_0x18bd('0xa')]=_0x1a5104[_0x18bd('0xa')];this[_0x18bd('0xb')]={};this['variables']={};ami['on'](_0x18bd('0xc'),this[_0x18bd('0xd')][_0x18bd('0xe')](this));ami['on']('dialend',this[_0x18bd('0xf')][_0x18bd('0xe')](this));ami['on'](_0x18bd('0x10'),this[_0x18bd('0x11')][_0x18bd('0xe')](this));ami['on'](_0x18bd('0x12'),this['syncHangup'][_0x18bd('0xe')](this));}VoiceDialReport[_0x18bd('0x13')][_0x18bd('0x14')]=function(_0x494dd5){return _0x494dd5!==null&&!_[_0x18bd('0x15')](_0x494dd5);};VoiceDialReport['prototype']['emit']=function(_0x378c5b,_0x2cba1f,_0x24b554){io['to'](_0x378c5b)[_0x18bd('0x16')](_0x2cba1f,_0x24b554);};VoiceDialReport[_0x18bd('0x13')][_0x18bd('0xd')]=function(_0x4375cd){try{if(this[_0x18bd('0x14')](_0x4375cd)){logger['debug'](_0x18bd('0x17'),_0x4375cd[_0x18bd('0x18')],util[_0x18bd('0x19')](_0x4375cd,{'showHidden':![],'depth':null}));if(this[_0x18bd('0x8')][_0x4375cd['uniqueid']]){_['merge'](this[_0x18bd('0x8')][_0x4375cd['uniqueid']],{'starttime':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x18bd('0x1a'),'interface':_0x4375cd[_0x18bd('0x1b')]['substring'](0x0,_0x4375cd[_0x18bd('0x1b')][_0x18bd('0x1c')]('-')),'membername':_0x4375cd[_0x18bd('0x1b')][_0x18bd('0x1d')](_0x4375cd[_0x18bd('0x1b')][_0x18bd('0x1c')]('/')+0x1,_0x4375cd['channel'][_0x18bd('0x1c')]('-'))},_[_0x18bd('0x1e')](_0x4375cd,[_0x18bd('0x1f'),'privilege']));logger[_0x18bd('0x20')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x4375cd[_0x18bd('0x18')],this['channels'][_0x4375cd[_0x18bd('0x18')]][_0x18bd('0x21')],this['channels'][_0x4375cd['uniqueid']][_0x18bd('0x22')]);logger[_0x18bd('0x23')](_0x18bd('0x24'),_0x4375cd[_0x18bd('0x18')],util[_0x18bd('0x19')](this[_0x18bd('0x8')][_0x4375cd['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0x18bd('0xb')][_0x4375cd[_0x18bd('0x18')]])_[_0x18bd('0x25')](this[_0x18bd('0x8')][_0x4375cd[_0x18bd('0x18')]],this['applications'][_0x4375cd['uniqueid']]);this[_0x18bd('0x16')](_0x18bd('0x26'),_0x18bd('0x27'),this[_0x18bd('0x8')][_0x4375cd['uniqueid']]);logger[_0x18bd('0x23')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x4375cd[_0x18bd('0x18')],util[_0x18bd('0x19')](this[_0x18bd('0x8')][_0x4375cd['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x18bd('0x16')](_0x18bd('0x28'),this[_0x18bd('0x8')][_0x4375cd[_0x18bd('0x18')]]);}}}catch(_0x176cab){logger[_0x18bd('0x29')](_0x18bd('0x2a'),_0x4375cd[_0x18bd('0x18')],util[_0x18bd('0x19')](_0x176cab,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x18bd('0x13')][_0x18bd('0xf')]=function(_0x35b07d){try{if(this[_0x18bd('0x14')](_0x35b07d)){logger[_0x18bd('0x23')]('[%s][voiceDialReport][dialend]\x20event:',_0x35b07d[_0x18bd('0x18')],util[_0x18bd('0x19')](_0x35b07d,{'showHidden':![],'depth':null}));if(this['channels'][_0x35b07d[_0x18bd('0x18')]]){this[_0x18bd('0x8')][_0x35b07d['uniqueid']][_0x18bd('0x2b')]=_0x35b07d[_0x18bd('0x2b')];if(_0x35b07d[_0x18bd('0x2b')]===_0x18bd('0x2c')){this['channels'][_0x35b07d[_0x18bd('0x18')]][_0x18bd('0x2d')]=_0x35b07d[_0x18bd('0x2d')];this['channels'][_0x35b07d[_0x18bd('0x18')]][_0x18bd('0x2e')]=_0x35b07d[_0x18bd('0x2e')];this['channels'][_0x35b07d[_0x18bd('0x18')]][_0x18bd('0x2f')]=moment()[_0x18bd('0x30')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x18bd('0x8')][_0x35b07d[_0x18bd('0x18')]][_0x18bd('0x31')]='connect';logger[_0x18bd('0x20')](_0x18bd('0x32'),_0x35b07d[_0x18bd('0x18')],_0x35b07d['channel'][_0x18bd('0x1d')](_0x35b07d[_0x18bd('0x1b')]['lastIndexOf']('/')+0x1,_0x35b07d['channel']['lastIndexOf']('-')));logger[_0x18bd('0x23')](_0x18bd('0x33'),_0x35b07d['uniqueid'],util[_0x18bd('0x19')](this['channels'][_0x35b07d['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x18bd('0x16')](_0x18bd('0x34'),this[_0x18bd('0x8')][_0x35b07d[_0x18bd('0x18')]]);}logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x35b07d['uniqueid'],util['inspect'](this[_0x18bd('0x8')][_0x35b07d[_0x18bd('0x18')]],{'showHidden':![],'depth':null}));this[_0x18bd('0x16')](_0x18bd('0x26'),'voice_outbound_channel:save',this[_0x18bd('0x8')][_0x35b07d[_0x18bd('0x18')]]);}}}catch(_0x3608c5){logger[_0x18bd('0x29')]('[%s][voiceDialReport][dialend]',_0x35b07d['uniqueid'],util['inspect'](_0x3608c5,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x18bd('0x13')][_0x18bd('0x11')]=function(_0x546f6e){try{if(this['isNotNull'](_0x546f6e)){logger[_0x18bd('0x23')](_0x18bd('0x35'),_0x546f6e[_0x18bd('0x18')],util[_0x18bd('0x19')](_0x546f6e,{'showHidden':![],'depth':null}));this['addVariable'](_0x546f6e[_0x18bd('0x18')],_[_0x18bd('0x36')](_0x546f6e[_0x18bd('0x37')])[0x0],_0x546f6e[_0x18bd('0x38')]);if(this['isNotNull'](_0x546f6e['variable'])&&this['isNotNull'](_0x546f6e[_0x18bd('0x37')][_0x18bd('0x39')])){if(_['isUndefined'](this[_0x18bd('0x8')][_0x546f6e['uniqueid']])){this[_0x18bd('0x8')][_0x546f6e[_0x18bd('0x18')]]={'routeId':_0x546f6e[_0x18bd('0x38')],'variables':this[_0x18bd('0x3a')][_0x546f6e[_0x18bd('0x18')]],'motionChannel':_0x18bd('0x3b')};logger[_0x18bd('0x20')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x546f6e[_0x18bd('0x18')],_0x546f6e[_0x18bd('0x37')][_0x18bd('0x39')],_[_0x18bd('0x36')](_0x546f6e[_0x18bd('0x37')])[0x0],_0x546f6e['value']);logger[_0x18bd('0x23')](_0x18bd('0x3c'),_0x546f6e[_0x18bd('0x18')],util[_0x18bd('0x19')](this[_0x18bd('0x8')][_0x546f6e['uniqueid']],{'showHidden':![],'depth':null}));this[_0x18bd('0x16')](_0x18bd('0x26'),'voice_outbound_channel:save',this[_0x18bd('0x8')][_0x546f6e[_0x18bd('0x18')]]);}}}}catch(_0x5401b0){logger[_0x18bd('0x29')](_0x18bd('0x3d'),_0x546f6e['uniqueid'],util[_0x18bd('0x19')](_0x5401b0,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x18bd('0x13')][_0x18bd('0x3e')]=function(_0x57f427,_0x48c0bb,_0xc31981){var _0x3c8651=[_0x18bd('0x3f'),_0x18bd('0x40'),_0x18bd('0x41'),_0x18bd('0x42'),_0x18bd('0x43'),'rtpaudioqoslossbridged',_0x18bd('0x44'),_0x18bd('0x45'),_0x18bd('0x46'),_0x18bd('0x47'),_0x18bd('0x48'),_0x18bd('0x49'),_0x18bd('0x4a'),_0x18bd('0x4b'),_0x18bd('0x4c'),'memberlastcall',_0x18bd('0x21'),_0x18bd('0x4d'),_0x18bd('0x4e')];if(!_[_0x18bd('0x4f')](_0x48c0bb)&&!_[_0x18bd('0x50')](_0x3c8651,_0x48c0bb)){if(_['isUndefined'](this['variables'][_0x57f427])){this[_0x18bd('0x3a')][_0x57f427]={};}this[_0x18bd('0x3a')][_0x57f427][_0x48c0bb]=_0xc31981;}};VoiceDialReport[_0x18bd('0x13')][_0x18bd('0x51')]=function(_0x2b0a3a){try{if(this[_0x18bd('0x14')](_0x2b0a3a)){logger[_0x18bd('0x23')]('[%s][voiceDialReport][hangup]\x20event:',_0x2b0a3a[_0x18bd('0x18')],util[_0x18bd('0x19')](_0x2b0a3a,{'showHidden':![],'depth':null}));if(this['channels'][_0x2b0a3a[_0x18bd('0x18')]]){logger['info'](_0x18bd('0x52'),_0x2b0a3a[_0x18bd('0x18')],_0x2b0a3a[_0x18bd('0x53')]);this[_0x18bd('0x8')][_0x2b0a3a[_0x18bd('0x18')]][_0x18bd('0x54')]=moment()[_0x18bd('0x30')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x18bd('0x8')][_0x2b0a3a[_0x18bd('0x18')]][_0x18bd('0x55')]=moment(this[_0x18bd('0x8')][_0x2b0a3a[_0x18bd('0x18')]][_0x18bd('0x54')])[_0x18bd('0x56')](this['channels'][_0x2b0a3a[_0x18bd('0x18')]][_0x18bd('0x57')],'seconds');this[_0x18bd('0x8')][_0x2b0a3a[_0x18bd('0x18')]][_0x18bd('0x31')]=_0x18bd('0x58');this[_0x18bd('0xa')][_0x18bd('0x59')]+=0x1;if(this[_0x18bd('0x8')][_0x2b0a3a[_0x18bd('0x18')]]['answertime']){this[_0x18bd('0xa')]['answered']+=0x1;this[_0x18bd('0x8')][_0x2b0a3a['uniqueid']][_0x18bd('0x5a')]=moment(this['channels'][_0x2b0a3a[_0x18bd('0x18')]][_0x18bd('0x2f')])[_0x18bd('0x56')](this['channels'][_0x2b0a3a[_0x18bd('0x18')]]['starttime'],_0x18bd('0x5b'));this[_0x18bd('0x8')][_0x2b0a3a['uniqueid']][_0x18bd('0x5c')]=moment(this[_0x18bd('0x8')][_0x2b0a3a[_0x18bd('0x18')]][_0x18bd('0x54')])['diff'](this[_0x18bd('0x8')][_0x2b0a3a['uniqueid']][_0x18bd('0x2f')],_0x18bd('0x5b'));this[_0x18bd('0xa')]['sumHoldTime']+=this[_0x18bd('0x8')][_0x2b0a3a[_0x18bd('0x18')]][_0x18bd('0x5a')]||0x0;this[_0x18bd('0xa')][_0x18bd('0x5d')]+=this[_0x18bd('0x8')][_0x2b0a3a['uniqueid']][_0x18bd('0x5c')];}this[_0x18bd('0xa')]['sumDuration']+=this[_0x18bd('0x8')][_0x2b0a3a[_0x18bd('0x18')]][_0x18bd('0x55')];logger[_0x18bd('0x23')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x2b0a3a[_0x18bd('0x18')],util[_0x18bd('0x19')](this['channels'][_0x2b0a3a['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x18bd('0x16')](_0x18bd('0x5e'),this[_0x18bd('0x8')][_0x2b0a3a['uniqueid']]);logger[_0x18bd('0x23')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x2b0a3a[_0x18bd('0x18')],util[_0x18bd('0x19')](this[_0x18bd('0x8')][_0x2b0a3a['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x18bd('0x16')](_0x18bd('0x5f'),this[_0x18bd('0x8')][_0x2b0a3a[_0x18bd('0x18')]]);logger[_0x18bd('0x23')](_0x18bd('0x60'),_0x2b0a3a[_0x18bd('0x18')],util['inspect'](this[_0x18bd('0x8')][_0x2b0a3a[_0x18bd('0x18')]],{'showHidden':![],'depth':null}));this[_0x18bd('0x16')]('voice:outbound',_0x18bd('0x61'),this[_0x18bd('0xa')]);logger[_0x18bd('0x20')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x18bd('0x62')](this['channels'][_0x2b0a3a['uniqueid']]));logger[_0x18bd('0x23')](_0x18bd('0x63'),_0x2b0a3a[_0x18bd('0x18')],util[_0x18bd('0x19')](this['channels'][_0x2b0a3a['uniqueid']],{'showHidden':![],'depth':null}));this['emit']('voice:outbound','voice_outbound_channel:remove',this[_0x18bd('0x8')][_0x2b0a3a[_0x18bd('0x18')]]);this[_0x18bd('0x64')](_0x2b0a3a['uniqueid']);}else if(this[_0x18bd('0x8')][_0x2b0a3a['linkedid']]){this[_0x18bd('0x8')][_0x2b0a3a[_0x18bd('0x65')]]['uniqueid']=this[_0x18bd('0x8')][_0x2b0a3a[_0x18bd('0x65')]][_0x18bd('0x66')];}if(this['variables'][_0x2b0a3a['uniqueid']]){delete this[_0x18bd('0x3a')][_0x2b0a3a[_0x18bd('0x18')]];}}}catch(_0x581395){logger[_0x18bd('0x29')](_0x18bd('0x67'),_0x2b0a3a[_0x18bd('0x18')],util[_0x18bd('0x19')](_0x581395,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x18bd('0x13')]['syncNewExten']=function(_0x1e2dfc){try{if(this[_0x18bd('0x14')](_0x1e2dfc)){logger['debug'](_0x18bd('0x68'),_0x1e2dfc[_0x18bd('0x18')],util[_0x18bd('0x19')](_0x1e2dfc,{'showHidden':![],'depth':null}));if(_0x1e2dfc[_0x18bd('0x69')]['toLowerCase']()===_0x18bd('0x6a')){_0x1e2dfc[_0x18bd('0x6b')]=(_0x1e2dfc[_0x18bd('0x6c')]||_0x1e2dfc['applicationdata'])[_0x18bd('0x6d')]();if(_[_0x18bd('0x6e')](_0x1e2dfc[_0x18bd('0x6b')],_0x18bd('0x6f'))){if(_[_0x18bd('0x15')](this[_0x18bd('0xb')][_0x1e2dfc['uniqueid']]))this[_0x18bd('0xb')][_0x1e2dfc[_0x18bd('0x18')]]={};logger['info'](_0x18bd('0x70'),_0x1e2dfc[_0x18bd('0x18')],_0x1e2dfc['application'],_0x1e2dfc[_0x18bd('0x6b')]);var _0x551e74=_0x1e2dfc[_0x18bd('0x6b')]['split']('=');var _0x37bc30=_0x551e74[0x0][_0x18bd('0x71')](/cdr\((.*)\)/);if(_0x37bc30)this[_0x18bd('0xb')][_0x1e2dfc[_0x18bd('0x18')]][_0x37bc30[0x1]]=_0x551e74[0x1];}}}}catch(_0x5550f3){logger['error'](_0x18bd('0x72'),_0x1e2dfc[_0x18bd('0x18')],util['inspect'](_0x5550f3,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x18bd('0x64')]=function(_0x51c438,_0x55459b=0x2710){if(this[_0x18bd('0x8')][_0x51c438]){setTimeout(()=>{delete this[_0x18bd('0x8')][_0x51c438];},_0x55459b);}};module[_0x18bd('0x73')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 932b32d..b3b320e 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4e5=['push','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','position','count','info','pick','keys','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','queuecallerexitAt','transfer','startsWith','channel','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','variable','CONTINUE','lastevent','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','varset','queueposition','EXITWITHKEY','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','includes','handleHangup','length','diff','milliseconds','queuecallerjoinAt','sumBillable','queuecallercompleteAt','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumHoldTime','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','syncHangup','[%s][voiceQueueReport][hangup]','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','syncAttendedTransfer','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','transferuniqueid','ATTENDED','secondtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','switch','BLINDTRANSFER','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','transfererchannel','[%s][voiceQueueReport][blindtransfer]','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','cdr(','split','[%s][voiceQueueReport][newexten]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','realtime','agents','channels','voiceQueues','campaigns','summary','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuemember','syncQueueMember','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','syncVarSet','hangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','waiting','queueStatusComplete','queuecallerexit','isNil','Action','status','catch','message','No\x20such\x20channel','[%s][voiceQueueReport][checkChannel]','inspect','error','[%s][voiceQueueReport][checkQueueReport]','variables','clearQueueReport','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','debug','uniqueid','voice:queue:%s','queue','voice_queue_channel:save','queuecallerexitreason','ATTENDEDTRANSFER','format','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isNotNull','isUndefined','queues','isRunning','then','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','createReport','compareToInboundQueue','assign','actionid','handleInboundQueueSummaryReport','outbound','custom:queuesummary','statusRequests','completeEvent'];(function(_0x402ea6,_0x1fe9ac){var _0x49a024=function(_0x4e5656){while(--_0x4e5656){_0x402ea6['push'](_0x402ea6['shift']());}};_0x49a024(++_0x1fe9ac);}(_0xd4e5,0x173));var _0x5d4e=function(_0x3ad2b6,_0xca7668){_0x3ad2b6=_0x3ad2b6-0x0;var _0x14484c=_0xd4e5[_0x3ad2b6];return _0x14484c;};'use strict';var _=require(_0x5d4e('0x0'));var moment=require(_0x5d4e('0x1'));var util=require(_0x5d4e('0x2'));var Redis=require(_0x5d4e('0x3'));var config=require(_0x5d4e('0x4'));var logger=require(_0x5d4e('0x5'))(_0x5d4e('0x6'));var ami=require(_0x5d4e('0x7'));var QueueReport=require(_0x5d4e('0x8'));var VoiceQueueSummary=require(_0x5d4e('0x9'));config[_0x5d4e('0xa')]=_['defaults'](config[_0x5d4e('0xa')],{'host':_0x5d4e('0xb'),'port':0x18eb});var io=require(_0x5d4e('0xc'))(new Redis(config[_0x5d4e('0xa')]));var Sequence=function(){};Sequence[_0x5d4e('0xd')][_0x5d4e('0xe')]=function(_0x4400cb){this[_0x5d4e('0xf')]=this[_0x5d4e('0xf')]?this[_0x5d4e('0xf')][_0x5d4e('0x10')](_0x4400cb):_0x4400cb();};function VoiceQueueReport(_0x3643b1){this[_0x5d4e('0x11')]=new Sequence();this[_0x5d4e('0x12')]={};this[_0x5d4e('0x13')]=_0x3643b1;this[_0x5d4e('0x14')]=_0x3643b1[_0x5d4e('0x14')];this[_0x5d4e('0x15')]=_0x3643b1['queueChannels'];this[_0x5d4e('0x16')]=_0x3643b1[_0x5d4e('0x16')];this[_0x5d4e('0x17')]=_0x3643b1['campaigns'];this[_0x5d4e('0x18')]=initializeSummary();this['variables']={};ami['on'](_0x5d4e('0x19'),this[_0x5d4e('0x1a')][_0x5d4e('0x1b')](this));ami['on'](_0x5d4e('0x1c'),this[_0x5d4e('0x1d')][_0x5d4e('0x1b')](this));ami['on'](_0x5d4e('0x1e'),this[_0x5d4e('0x1f')]['bind'](this));ami['on']('queuestatuscomplete',this[_0x5d4e('0x20')][_0x5d4e('0x1b')](this));ami['on'](_0x5d4e('0x21'),this[_0x5d4e('0x22')][_0x5d4e('0x1b')](this));ami['on'](_0x5d4e('0x23'),this[_0x5d4e('0x24')][_0x5d4e('0x1b')](this));ami['on'](_0x5d4e('0x25'),this[_0x5d4e('0x26')]['bind'](this));ami['on'](_0x5d4e('0x27'),this[_0x5d4e('0x28')][_0x5d4e('0x1b')](this));ami['on'](_0x5d4e('0x29'),this[_0x5d4e('0x2a')][_0x5d4e('0x1b')](this));ami['on']('varset',this[_0x5d4e('0x2b')][_0x5d4e('0x1b')](this));ami['on'](_0x5d4e('0x2c'),this['syncHangup']['bind'](this));ami['on'](_0x5d4e('0x2d'),this[_0x5d4e('0x2e')][_0x5d4e('0x1b')](this));ami['on'](_0x5d4e('0x2f'),this[_0x5d4e('0x30')]['bind'](this));ami['on'](_0x5d4e('0x31'),this[_0x5d4e('0x32')]['bind'](this));ami['on'](_0x5d4e('0x33'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x5d4e('0x34'),this[_0x5d4e('0x35')][_0x5d4e('0x1b')](this));this[_0x5d4e('0x36')]();this[_0x5d4e('0x37')]();}function clearChannels(_0x127491){if(!_[_0x5d4e('0x38')](_0x127491)){for(var _0x4fec18 in _0x127491){if(_0x127491[_0x5d4e('0x39')](_0x4fec18)){delete _0x127491[_0x4fec18];}}}}function clearCampaigns(_0x32dbf3){if(!_[_0x5d4e('0x38')](_0x32dbf3)){for(var _0x235432 in _0x32dbf3){if(_0x32dbf3[_0x5d4e('0x39')](_0x235432)){_0x32dbf3[_0x235432]['originated']=0x0;}}}}function clearVoiceQueues(_0x18e9c9){if(!_['isEmpty'](_0x18e9c9)){for(var _0x144600 in _0x18e9c9){if(_0x18e9c9[_0x5d4e('0x39')](_0x144600)){_0x18e9c9[_0x144600][_0x5d4e('0x3a')]=0x0;_0x18e9c9[_0x144600]['talking']=0x0;_0x18e9c9[_0x144600][_0x5d4e('0x3b')]=0x0;_0x18e9c9[_0x144600][_0x5d4e('0x3c')]=0x0;_0x18e9c9[_0x144600][_0x5d4e('0x3d')]=!![];}}}}function clearAgentBooked(_0x21d418){if(!_['isEmpty'](_0x21d418)){for(var _0x4237a1 in _0x21d418){if(_0x21d418[_0x5d4e('0x39')](_0x4237a1)){_0x21d418[_0x4237a1]['unlockRR']=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x22dd6d){return _0x22dd6d[_0x5d4e('0x3e')]||_0x22dd6d['queuecallerabandon']||_0x22dd6d['queuecallercomplete'];}VoiceQueueReport['prototype']['clearZombieChannels']=function(){var _0x2b53d9=this;for(var _0x50fcee in this[_0x5d4e('0x15')]){if(this['channels'][_0x5d4e('0x39')](_0x50fcee)&&!this[_0x5d4e('0x15')][_0x50fcee]['switch']){this[_0x5d4e('0x11')][_0x5d4e('0xe')](function(){if(!_[_0x5d4e('0x3f')](_0x2b53d9[_0x5d4e('0x15')][_0x50fcee])){return ami[_0x5d4e('0x40')]({'action':_0x5d4e('0x41'),'channel':_0x2b53d9[_0x5d4e('0x15')][_0x50fcee]['channel']})[_0x5d4e('0x42')](function(_0x57f484){if(_0x57f484[_0x5d4e('0x43')]===_0x5d4e('0x44')){setTimeout(function(){if(_0x2b53d9[_0x5d4e('0x15')][_0x50fcee]){delete _0x2b53d9['channels'][_0x50fcee];logger['error'](_0x5d4e('0x45'),_0x50fcee,util[_0x5d4e('0x46')](_0x57f484,{'showHidden':![],'depth':null}));}if(_0x2b53d9['queueReports'][_0x50fcee]){delete _0x2b53d9[_0x5d4e('0x12')][_0x50fcee];logger[_0x5d4e('0x47')](_0x5d4e('0x48'),_0x50fcee,util[_0x5d4e('0x46')](_0x57f484,{'showHidden':![],'depth':null}));}if(_0x2b53d9[_0x5d4e('0x49')][_0x50fcee]){delete _0x2b53d9[_0x5d4e('0x49')][_0x50fcee];logger[_0x5d4e('0x47')]('[%s][voiceQueueReport][checkVariables]',_0x50fcee,util[_0x5d4e('0x46')](_0x57f484,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x5d4e('0xd')][_0x5d4e('0x2e')]=function(){logger[_0x5d4e('0x47')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0x5d4e('0x15')]);this[_0x5d4e('0x4a')](this['queueReports']);clearAgentBooked(this[_0x5d4e('0x14')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0x5d4e('0x17')]);this[_0x5d4e('0x18')]=initializeSummary();};VoiceQueueReport[_0x5d4e('0xd')][_0x5d4e('0x4a')]=function(_0x3809f0){var _0x39d0e4=this;if(!_[_0x5d4e('0x38')](_0x3809f0)){for(var _0x3a4f04 in _0x3809f0){if(_0x3809f0[_0x5d4e('0x39')](_0x3a4f04)){_0x39d0e4[_0x5d4e('0x4b')](_0x3809f0[_0x3a4f04],'clearqueuereport');delete _0x3809f0[_0x3a4f04];}}}};VoiceQueueReport[_0x5d4e('0xd')][_0x5d4e('0x4c')]=function(_0x28f5dd,_0x1d7130,_0x4eb75e){io['to'](_0x28f5dd)[_0x5d4e('0x4c')](_0x1d7130,_0x4eb75e);};VoiceQueueReport[_0x5d4e('0xd')][_0x5d4e('0x4d')]=function(_0x3a052b,_0x2a7a87){logger[_0x5d4e('0x4e')]('[%s][voiceQueueReport]['+_0x2a7a87+']\x20sending\x20voice_queue_channel:save\x20event:',_0x3a052b[_0x5d4e('0x4f')],util[_0x5d4e('0x46')](_0x3a052b,{'showHidden':![],'depth':null}));this[_0x5d4e('0x4c')](util['format'](_0x5d4e('0x50'),_0x3a052b[_0x5d4e('0x51')]),_0x5d4e('0x52'),_0x3a052b);io[_0x5d4e('0x4c')]('voice_queue_presence:save',_0x3a052b);};VoiceQueueReport[_0x5d4e('0xd')][_0x5d4e('0x4b')]=function(_0x38eed5,_0x246f80){logger[_0x5d4e('0x4e')]('[%s][voiceQueueReport]['+_0x246f80+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x38eed5['uniqueid'],util['inspect'](_0x38eed5,{'showHidden':![],'depth':null}));if(_0x38eed5[_0x5d4e('0x53')]===_0x5d4e('0x54')){return;}this[_0x5d4e('0x4c')](util[_0x5d4e('0x55')](_0x5d4e('0x50'),_0x38eed5[_0x5d4e('0x51')]),_0x5d4e('0x56'),_0x38eed5);io[_0x5d4e('0x4c')](_0x5d4e('0x57'),_0x38eed5);};VoiceQueueReport['prototype'][_0x5d4e('0x58')]=function(_0x89ff8f){if(_0x89ff8f[_0x5d4e('0x59')]===_0x5d4e('0x5a')){logger['debug'](_0x5d4e('0x5b'),util[_0x5d4e('0x46')](_0x89ff8f,{'showHidden':![],'depth':null}));this[_0x5d4e('0x4c')](util[_0x5d4e('0x55')](_0x5d4e('0x50'),_0x89ff8f[_0x5d4e('0x5c')]),_0x5d4e('0x5d'),_0x89ff8f);}};VoiceQueueReport[_0x5d4e('0xd')][_0x5d4e('0x5e')]=function(_0x461ba3){return _0x461ba3!==null&&!_[_0x5d4e('0x5f')](_0x461ba3);};VoiceQueueReport[_0x5d4e('0xd')][_0x5d4e('0x37')]=function(){var _0x1c1d57=this;setInterval(function(){_0x1c1d57['clearZombieChannels']();ami['Action']({'action':_0x5d4e('0x60')})[_0x5d4e('0x42')](function(_0x4debbf){logger[_0x5d4e('0x47')]('[voiceQueueReport][queues]',util['inspect'](_0x4debbf,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x5d4e('0xd')][_0x5d4e('0x36')]=function(){var _0x3b7ddc=this;setInterval(function(){if(!_0x3b7ddc[_0x5d4e('0x18')][_0x5d4e('0x61')]){return ami[_0x5d4e('0x40')]({'action':_0x5d4e('0x19')})[_0x5d4e('0x62')](function(_0x1b9c00){_0x3b7ddc['summary']['id']=_0x1b9c00['actionid'];_0x3b7ddc[_0x5d4e('0x18')][_0x5d4e('0x61')]=!![];_0x3b7ddc[_0x5d4e('0x18')][_0x5d4e('0x63')][_0x1b9c00['actionid']]={};})[_0x5d4e('0x42')](function(_0xa4d36b){logger[_0x5d4e('0x47')](_0x5d4e('0x64'),util['inspect'](_0xa4d36b,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0x5d4e('0x65')]=function(_0x4fec93,_0x45fe48){var _0x5b9028;if(this['summary']&&this[_0x5d4e('0x18')][_0x5d4e('0x60')]&&this[_0x5d4e('0x18')][_0x5d4e('0x60')][_0x4fec93[_0x5d4e('0x5c')]]){_0x5b9028=this[_0x5d4e('0x18')][_0x5d4e('0x60')][_0x4fec93[_0x5d4e('0x5c')]]['summaryEvent'];}var _0xcabb3f=new VoiceQueueSummary(_0x4fec93);return _0xcabb3f[_0x5d4e('0x66')](_0x45fe48[_0x5d4e('0x14')],this[_0x5d4e('0x14')],_0x5b9028,this[_0x5d4e('0x13')]['channels']);};VoiceQueueReport[_0x5d4e('0xd')]['handleInboundQueueSummaryReport']=function(_0x5c9ccf,_0x1f44cc){var _0xea1566=this[_0x5d4e('0x65')](_0x5c9ccf,_0x1f44cc);var _0x103053=![];_0x103053=_0xea1566[_0x5d4e('0x67')](_0x5c9ccf);if(_0x103053){Object[_0x5d4e('0x68')](_0x5c9ccf,_0xea1566);this[_0x5d4e('0x13')]['voiceQueues'][_0x5c9ccf['name']]=_0x5c9ccf;this[_0x5d4e('0x58')](_0xea1566);}};VoiceQueueReport[_0x5d4e('0xd')][_0x5d4e('0x20')]=function(_0x1e515d){var _0x1450ae=null;var _0x3bf130=this[_0x5d4e('0x18')]['id'];if(this[_0x5d4e('0x18')][_0x5d4e('0x63')][_0x3bf130]){_0x1450ae=this['summary'][_0x5d4e('0x63')][_0x3bf130][_0x1e515d[_0x5d4e('0x69')]];}if(!_0x1450ae){this[_0x5d4e('0x18')]=initializeSummary();return;}var _0x10d989=this[_0x5d4e('0x16')][_0x1450ae[_0x5d4e('0x51')]];if(_0x10d989[_0x5d4e('0x59')]===_0x5d4e('0x5a')){this[_0x5d4e('0x6a')](_0x10d989,_0x1450ae);}else if(_0x10d989[_0x5d4e('0x59')]===_0x5d4e('0x6b')){var _0x40bb2a=this[_0x5d4e('0x65')](_0x10d989,_0x1450ae);ami['emit'](_0x5d4e('0x6c'),_0x40bb2a);}this['summary'][_0x5d4e('0x6d')]-=0x1;var _0x1875be=this['summary'][_0x5d4e('0x6d')]>0x0?!![]:![];if(!_0x1875be){return this[_0x5d4e('0x1d')](this[_0x5d4e('0x18')][_0x5d4e('0x6e')]);}};VoiceQueueReport[_0x5d4e('0xd')][_0x5d4e('0x1f')]=function(_0x3fe123){var _0x1e6078=this[_0x5d4e('0x18')]['id'];if(this['summary']['queuestatus'][_0x1e6078]&&this[_0x5d4e('0x18')]['queuestatus'][_0x1e6078][_0x3fe123[_0x5d4e('0x69')]]){this['summary'][_0x5d4e('0x63')][_0x1e6078][_0x3fe123[_0x5d4e('0x69')]][_0x5d4e('0x14')][_0x5d4e('0x6f')](_0x3fe123);}};VoiceQueueReport[_0x5d4e('0xd')][_0x5d4e('0x1a')]=function(_0x4b025e){var _0x19f671=this;try{if(this[_0x5d4e('0x5e')](_0x4b025e)&&this[_0x5d4e('0x5e')](_0x4b025e['queue'])){logger[_0x5d4e('0x4e')](_0x5d4e('0x70'),util[_0x5d4e('0x46')](_0x4b025e,{'showHidden':![],'depth':null}));var _0x2ac2eb=this['voiceQueues'][_0x4b025e['queue']];if(_0x2ac2eb){logger['debug'](_0x5d4e('0x71'),_0x2ac2eb[_0x5d4e('0x5c')]);this['summary'][_0x5d4e('0x60')][_0x2ac2eb[_0x5d4e('0x5c')]]={'summaryEvent':_0x4b025e};this['summary'][_0x5d4e('0x6d')]+=0x1;return ami['Action']({'action':_0x5d4e('0x63'),'queue':_0x2ac2eb[_0x5d4e('0x5c')]})['then'](function(_0x5e871c){if(!_0x19f671['summary']['queuestatus'][_0x4b025e['actionid']]){_0x19f671[_0x5d4e('0x18')]['queuestatus'][_0x4b025e[_0x5d4e('0x69')]]={};}_0x19f671[_0x5d4e('0x18')]['queuestatus'][_0x4b025e[_0x5d4e('0x69')]][_0x5e871c[_0x5d4e('0x69')]]={'queue':_0x2ac2eb[_0x5d4e('0x5c')],'agents':[]};})[_0x5d4e('0x42')](function(_0x9e6d9e){throw _0x9e6d9e;});}}}catch(_0x38ba9c){logger['error'](_0x5d4e('0x64'),util[_0x5d4e('0x46')](_0x38ba9c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5d4e('0xd')][_0x5d4e('0x1d')]=function(_0xb6a055){if(this[_0x5d4e('0x18')][_0x5d4e('0x6d')]>0x0){this[_0x5d4e('0x18')][_0x5d4e('0x6e')]=_0xb6a055;return;}logger[_0x5d4e('0x4e')](_0x5d4e('0x72'),util[_0x5d4e('0x46')](_0xb6a055,{'showHidden':![],'depth':null}));this[_0x5d4e('0x18')]=initializeSummary();ami[_0x5d4e('0x4c')](_0x5d4e('0x73'),{});};VoiceQueueReport[_0x5d4e('0xd')]['syncQueueCallerJoin']=function(_0x158317){try{if(this[_0x5d4e('0x5e')](_0x158317)){logger[_0x5d4e('0x4e')](_0x5d4e('0x74'),_0x158317[_0x5d4e('0x4f')],util[_0x5d4e('0x46')](_0x158317,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x5d4e('0x12')][_0x158317[_0x5d4e('0x4f')]])){this[_0x5d4e('0x12')][_0x158317['uniqueid']]=[];}if(_[_0x5d4e('0x5f')](this[_0x5d4e('0x15')][_0x158317['uniqueid']])){this[_0x5d4e('0x15')][_0x158317[_0x5d4e('0x4f')]]={};}var _0x59eb43=new QueueReport();_0x59eb43[_0x5d4e('0x51')]=_0x158317['queue'];_0x59eb43[_0x5d4e('0x59')]=this[_0x5d4e('0x16')][_0x59eb43['queue']]&&this[_0x5d4e('0x16')][_0x59eb43['queue']][_0x5d4e('0x59')]?this[_0x5d4e('0x16')][_0x59eb43['queue']][_0x5d4e('0x59')]||_0x5d4e('0x5a'):_0x5d4e('0x5a');_0x59eb43['queuecallerjoinAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x59eb43['position']=_0x158317[_0x5d4e('0x75')];_0x59eb43['count']=_0x158317[_0x5d4e('0x76')];_0x59eb43[_0x5d4e('0x4f')]=_0x158317[_0x5d4e('0x4f')];logger[_0x5d4e('0x77')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x59eb43[_0x5d4e('0x51')],_0x59eb43[_0x5d4e('0x59')]);Object[_0x5d4e('0x68')](_0x59eb43,_[_0x5d4e('0x78')](_0x158317,_[_0x5d4e('0x79')](_0x59eb43)));this[_0x5d4e('0x12')][_0x158317['uniqueid']][_0x5d4e('0x6f')](_0x59eb43);this[_0x5d4e('0x15')][_0x158317[_0x5d4e('0x4f')]]=_0x59eb43;this[_0x5d4e('0x4d')](_0x59eb43,'queuecallerjoin');}}catch(_0x5dc001){logger[_0x5d4e('0x47')](_0x5d4e('0x74'),_0x158317['uniqueid'],util[_0x5d4e('0x46')](_0x5dc001,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5d4e('0xd')][_0x5d4e('0x24')]=function(_0x507fde){try{if(this['isNotNull'](_0x507fde)){logger[_0x5d4e('0x4e')](_0x5d4e('0x7a'),_0x507fde['uniqueid'],util['inspect'](_0x507fde,{'showHidden':![],'depth':null}));if(this[_0x5d4e('0x12')][_0x507fde[_0x5d4e('0x4f')]]){var _0x276103=_[_0x5d4e('0x7b')](this[_0x5d4e('0x12')][_0x507fde[_0x5d4e('0x4f')]]);_0x276103[_0x5d4e('0x7c')]=![];_0x276103['queuecallercompleteAt']=null;_0x276103[_0x5d4e('0x7d')]=_0x507fde[_0x5d4e('0x7d')];_0x276103[_0x5d4e('0x7e')]=_0x507fde[_0x5d4e('0x7e')];_0x276103[_0x5d4e('0x23')]=!![];_0x276103[_0x5d4e('0x7f')]=moment()[_0x5d4e('0x55')](_0x5d4e('0x80'));_0x276103[_0x5d4e('0x53')]=_0x5d4e('0x81');_0x276103[_0x5d4e('0x82')]=null;logger[_0x5d4e('0x77')](_0x5d4e('0x83'),_0x276103[_0x5d4e('0x51')],_0x276103['type']);this[_0x5d4e('0x15')][_0x507fde[_0x5d4e('0x4f')]]=_0x276103;this[_0x5d4e('0x4b')](_0x276103,_0x5d4e('0x23'));}}}catch(_0x4d3f45){logger[_0x5d4e('0x47')]('[%s][voiceQueueReport][queuecallerabandon]',_0x507fde[_0x5d4e('0x4f')],util['inspect'](_0x4d3f45,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5d4e('0x26')]=function(_0x3590aa){try{if(this[_0x5d4e('0x5e')](_0x3590aa)){logger['debug'](_0x5d4e('0x84'),_0x3590aa['uniqueid'],util['inspect'](_0x3590aa,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3590aa[_0x5d4e('0x4f')]]){var _0x561e5a=_['last'](this[_0x5d4e('0x12')][_0x3590aa[_0x5d4e('0x4f')]]);_0x561e5a[_0x5d4e('0x85')]=moment()[_0x5d4e('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x561e5a[_0x5d4e('0x86')]=_0x3590aa[_0x5d4e('0x86')];_0x561e5a['connectedlinename']=_0x3590aa[_0x5d4e('0x87')];logger[_0x5d4e('0x77')](_0x5d4e('0x88'),_0x561e5a['queue'],_0x561e5a[_0x5d4e('0x59')],_0x3590aa[_0x5d4e('0x86')],_0x3590aa[_0x5d4e('0x87')]);this[_0x5d4e('0x15')][_0x3590aa[_0x5d4e('0x4f')]]=_0x561e5a;this['emitVoiceQueueChannelSave'](_0x561e5a,_0x5d4e('0x25'));}}}catch(_0x3d273f){logger[_0x5d4e('0x47')](_0x5d4e('0x84'),_0x3590aa['uniqueid'],util['inspect'](_0x3d273f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5d4e('0xd')][_0x5d4e('0x2a')]=function(_0x43b5a6){try{if(this[_0x5d4e('0x5e')](_0x43b5a6)){logger[_0x5d4e('0x4e')](_0x5d4e('0x89'),_0x43b5a6[_0x5d4e('0x4f')],util[_0x5d4e('0x46')](_0x43b5a6,{'showHidden':![],'depth':null}));if(this[_0x5d4e('0x12')][_0x43b5a6[_0x5d4e('0x4f')]]){var _0x5cbd14=_[_0x5d4e('0x7b')](this[_0x5d4e('0x12')][_0x43b5a6[_0x5d4e('0x4f')]]);_0x5cbd14[_0x5d4e('0x7c')]=!![];_0x5cbd14[_0x5d4e('0x53')]=_0x5d4e('0x8a');logger[_0x5d4e('0x77')](_0x5d4e('0x8b'),_0x5cbd14[_0x5d4e('0x51')],_0x5cbd14['type']);}}}catch(_0x54c2dd){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x43b5a6[_0x5d4e('0x4f')],util[_0x5d4e('0x46')](_0x54c2dd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5d4e('0xd')][_0x5d4e('0x28')]=function(_0x4841b9){try{if(this['isNotNull'](_0x4841b9)){logger['debug'](_0x5d4e('0x8c'),_0x4841b9[_0x5d4e('0x4f')],util[_0x5d4e('0x46')](_0x4841b9,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4841b9[_0x5d4e('0x4f')]]){var _0x19d1a6=_[_0x5d4e('0x7b')](this['queueReports'][_0x4841b9[_0x5d4e('0x4f')]]);_0x19d1a6[_0x5d4e('0x23')]=![];_0x19d1a6[_0x5d4e('0x7f')]=null;_0x19d1a6[_0x5d4e('0x8d')]=!![];_0x19d1a6[_0x5d4e('0x82')]=_0x4841b9['membername'];_0x19d1a6[_0x5d4e('0x7d')]=_0x4841b9[_0x5d4e('0x7d')];_0x19d1a6[_0x5d4e('0x7c')]=!![];_0x19d1a6[_0x5d4e('0x3e')]=![];_0x19d1a6[_0x5d4e('0x8e')]=null;if(!_0x19d1a6[_0x5d4e('0x8f')]){if(_0x4841b9['reason']==_0x5d4e('0x8f')){_0x19d1a6[_0x5d4e('0x53')]='COMPLETED';logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x19d1a6[_0x5d4e('0x51')],_0x19d1a6[_0x5d4e('0x59')]);}else{if(_[_0x5d4e('0x90')](_0x4841b9[_0x5d4e('0x91')]['toLowerCase'](),_0x5d4e('0x92'))){if(this[_0x5d4e('0x12')][_0x4841b9[_0x5d4e('0x93')]]){var _0x272baf=_['last'](this[_0x5d4e('0x12')][_0x4841b9['linkedid']]);_0x272baf[_0x5d4e('0x7c')]=![];_0x272baf[_0x5d4e('0x3e')]=!![];_0x272baf[_0x5d4e('0x8e')]=moment(_0x19d1a6['queuecallerjoinAt'])[_0x5d4e('0x94')](_0x4841b9['holdtime'],_0x5d4e('0x95'))[_0x5d4e('0x55')](_0x5d4e('0x80'));_0x272baf[_0x5d4e('0x53')]=_0x5d4e('0x96');_0x272baf[_0x5d4e('0x8f')]=!![];_0x272baf[_0x5d4e('0x97')]=_0x5d4e('0x98');_0x272baf[_0x5d4e('0x99')]=_0x4841b9[_0x5d4e('0x9a')];_0x272baf['transferuniqueid']=_0x4841b9[_0x5d4e('0x4f')];logger[_0x5d4e('0x77')](_0x5d4e('0x9b'),_0x272baf[_0x5d4e('0x51')],_0x272baf[_0x5d4e('0x59')]);var _0x49bf30=this[_0x5d4e('0x12')][_0x4841b9[_0x5d4e('0x93')]];this[_0x5d4e('0x12')][_0x4841b9[_0x5d4e('0x93')]]=this[_0x5d4e('0x12')][_0x4841b9['uniqueid']];this[_0x5d4e('0x12')][_0x4841b9['uniqueid']]=_0x49bf30;}}else{_0x19d1a6[_0x5d4e('0x53')]=_0x5d4e('0x9c')+_0x4841b9['reason'][_0x5d4e('0x9d')]();logger[_0x5d4e('0x77')](_0x5d4e('0x9e'),_0x19d1a6[_0x5d4e('0x51')],_0x19d1a6[_0x5d4e('0x59')],_0x19d1a6[_0x5d4e('0x53')]);}}}this[_0x5d4e('0x15')][_0x4841b9['uniqueid']]=_0x19d1a6;}}}catch(_0x2eaea3){logger['error'](_0x5d4e('0x8c'),_0x4841b9[_0x5d4e('0x4f')],util[_0x5d4e('0x46')](_0x2eaea3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5d4e('0xd')][_0x5d4e('0x2b')]=function(_0x3ffce3){try{if(this['isNotNull'](_0x3ffce3)){logger[_0x5d4e('0x4e')](_0x5d4e('0x9f'),_0x3ffce3[_0x5d4e('0x4f')],util[_0x5d4e('0x46')](_0x3ffce3,{'showHidden':![],'depth':null}));this['addVariable'](_0x3ffce3[_0x5d4e('0x4f')],_[_0x5d4e('0x79')](_0x3ffce3[_0x5d4e('0xa0')])[0x0],_0x3ffce3['value']);if(this['queueReports'][_0x3ffce3[_0x5d4e('0x4f')]]){var _0x10e0db=_['last'](this[_0x5d4e('0x12')][_0x3ffce3[_0x5d4e('0x4f')]]);if(_0x10e0db){if(this[_0x5d4e('0x5e')](_0x3ffce3[_0x5d4e('0xa0')])&&this['isNotNull'](_0x3ffce3['variable']['queuestatus'])){switch(_0x3ffce3['value']){case _0x5d4e('0xa1'):_0x10e0db[_0x5d4e('0x3e')]=![];_0x10e0db[_0x5d4e('0x8e')]=null;break;case'TIMEOUT':_0x10e0db[_0x5d4e('0xa2')]='timeout';_0x10e0db[_0x5d4e('0x3e')]=!![];_0x10e0db[_0x5d4e('0x8e')]=moment()[_0x5d4e('0x55')](_0x5d4e('0x80'));_0x10e0db[_0x5d4e('0x85')]=moment()[_0x5d4e('0x55')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x5d4e('0x4e')](_0x5d4e('0xa3'),_0x3ffce3[_0x5d4e('0x4f')],util[_0x5d4e('0x46')](_0x10e0db,{'showHidden':![],'depth':null}));ami[_0x5d4e('0x4c')](_0x5d4e('0xa4'),_0x10e0db);break;default:_0x10e0db[_0x5d4e('0x3e')]=!![];_0x10e0db[_0x5d4e('0x8e')]=moment()[_0x5d4e('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x10e0db[_0x5d4e('0x85')]=moment()[_0x5d4e('0x55')](_0x5d4e('0x80'));}_0x10e0db[_0x5d4e('0x23')]=![];_0x10e0db[_0x5d4e('0x7f')]=null;_0x10e0db[_0x5d4e('0x53')]=_0x3ffce3['value'];this['channels'][_0x3ffce3['uniqueid']]=_0x10e0db;this[_0x5d4e('0x4b')](_0x10e0db,_0x5d4e('0xa5'));}else if(this['isNotNull'](_0x3ffce3['variable'])&&this[_0x5d4e('0x5e')](_0x3ffce3['variable'][_0x5d4e('0xa6')])){if(!_0x10e0db[_0x5d4e('0x23')]){_0x10e0db['queuecallerexit']=!![];_0x10e0db[_0x5d4e('0x8e')]=moment()[_0x5d4e('0x55')](_0x5d4e('0x80'));_0x10e0db[_0x5d4e('0x53')]=_0x5d4e('0xa7');_0x10e0db[_0x5d4e('0x85')]=moment()[_0x5d4e('0x55')](_0x5d4e('0x80'));this[_0x5d4e('0x15')][_0x3ffce3[_0x5d4e('0x4f')]]=_0x10e0db;}}logger[_0x5d4e('0x77')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x3ffce3[_0x5d4e('0x4f')],_0x10e0db[_0x5d4e('0x51')],_0x10e0db[_0x5d4e('0x59')],_[_0x5d4e('0x79')](_0x3ffce3['variable'])[0x0],_0x3ffce3['value']);_0x10e0db['variables']=this['variables'][_0x3ffce3[_0x5d4e('0x4f')]];}}}}catch(_0x1245f6){logger[_0x5d4e('0x47')](_0x5d4e('0x9f'),_0x3ffce3['uniqueid'],util[_0x5d4e('0x46')](_0x1245f6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5d4e('0xd')][_0x5d4e('0xa8')]=function(_0x2e29b2,_0x118a1d,_0x4a79c5){var _0x4a5a75=[_0x5d4e('0xa9'),_0x5d4e('0xaa'),_0x5d4e('0xab'),_0x5d4e('0xac'),_0x5d4e('0xad'),_0x5d4e('0xae'),_0x5d4e('0xaf'),'rtpaudioqosrttbridged',_0x5d4e('0xb0'),_0x5d4e('0xb1'),_0x5d4e('0xb2'),_0x5d4e('0xb3'),'membercalls',_0x5d4e('0xb4'),_0x5d4e('0xb5'),_0x5d4e('0xb6'),_0x5d4e('0xb7'),_0x5d4e('0xb8'),_0x5d4e('0xb9')];if(!_[_0x5d4e('0x3f')](_0x118a1d)&&!_[_0x5d4e('0xba')](_0x4a5a75,_0x118a1d)){if(_[_0x5d4e('0x5f')](this[_0x5d4e('0x49')][_0x2e29b2])){this[_0x5d4e('0x49')][_0x2e29b2]={};}this[_0x5d4e('0x49')][_0x2e29b2][_0x118a1d]=_0x4a79c5;}};VoiceQueueReport[_0x5d4e('0xd')][_0x5d4e('0xbb')]=function(_0x1571cf,_0x425460,_0xb53be2){try{var _0x2eb283={};if(this[_0x5d4e('0x12')][_0x1571cf]){for(var _0x19050f=0x0;_0x19050f{delete this[_0x5d4e('0x15')][_0x4b1e3c];},_0x1c04b4);}};module['exports']=VoiceQueueReport; \ No newline at end of file +var _0xa7e0=['seconds','FORWARDTRANSFER','transfertype','transferexten','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][agentcomplete]','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','TIMEOUT','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','queuecallerabandonAt','varset','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','handleHangup','length','sumHoldTime','diff','milliseconds','total','answered','unmanaged','lastevent','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','abandoned','sumDuration','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','deleteChannelAfterTimeout','[%s][voiceQueueReport][hangup]','cause-txt','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transferuniqueid','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','appdata','startsWith','applicationdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','[%s][voiceQueueReport][newexten]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','realtime','agents','channels','voiceQueues','campaigns','summary','variables','queuesummary','syncQueueSummary','bind','syncQueueSummaryComplete','queuemember','syncQueueMember','queuestatuscomplete','queuecallerjoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','syncAgentConnect','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','waiting','queuecallercomplete','switch','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','queueReports','[%s][voiceQueueReport][checkQueueReport]','inspect','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','voice:queue:%s','queue','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','format','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','inbound','voice_queue:save','clearZombieChannels','queues','[voiceQueueReport][queues]','isRunning','actionid','[voiceQueueReport][queuesummary]','name','createReport','createQueueSummaryReport','assign','queuestatus','handleInboundQueueSummaryReport','outbound','custom:queuesummary','statusRequests','completeEvent','isNotNull','then','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','isUndefined','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','push','emitVoiceQueueChannelSave','[%s][voiceQueueReport][queuecallerjoin]','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','assigned','membername','queuecallerexit','reason','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','toLowerCase','local/','linkedid','queuecallerexitAt'];(function(_0x3f34ba,_0x5200cb){var _0x559c48=function(_0x531b9d){while(--_0x531b9d){_0x3f34ba['push'](_0x3f34ba['shift']());}};_0x559c48(++_0x5200cb);}(_0xa7e0,0x144));var _0x0a7e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa7e0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0a7e('0x0'));var moment=require(_0x0a7e('0x1'));var util=require('util');var Redis=require(_0x0a7e('0x2'));var config=require(_0x0a7e('0x3'));var logger=require(_0x0a7e('0x4'))(_0x0a7e('0x5'));var ami=require(_0x0a7e('0x6'));var QueueReport=require(_0x0a7e('0x7'));var VoiceQueueSummary=require('../model/voiceQueueSummary');config['redis']=_[_0x0a7e('0x8')](config[_0x0a7e('0x9')],{'host':_0x0a7e('0xa'),'port':0x18eb});var io=require(_0x0a7e('0xb'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x0a7e('0xc')][_0x0a7e('0xd')]=function(_0xb409a9){this[_0x0a7e('0xe')]=this['tail']?this[_0x0a7e('0xe')][_0x0a7e('0xf')](_0xb409a9):_0xb409a9();};function VoiceQueueReport(_0x55c24d){this[_0x0a7e('0x10')]=new Sequence();this['queueReports']={};this[_0x0a7e('0x11')]=_0x55c24d;this[_0x0a7e('0x12')]=_0x55c24d[_0x0a7e('0x12')];this[_0x0a7e('0x13')]=_0x55c24d['queueChannels'];this[_0x0a7e('0x14')]=_0x55c24d[_0x0a7e('0x14')];this[_0x0a7e('0x15')]=_0x55c24d[_0x0a7e('0x15')];this[_0x0a7e('0x16')]=initializeSummary();this[_0x0a7e('0x17')]={};ami['on'](_0x0a7e('0x18'),this[_0x0a7e('0x19')][_0x0a7e('0x1a')](this));ami['on']('queuesummarycomplete',this[_0x0a7e('0x1b')][_0x0a7e('0x1a')](this));ami['on'](_0x0a7e('0x1c'),this[_0x0a7e('0x1d')][_0x0a7e('0x1a')](this));ami['on'](_0x0a7e('0x1e'),this['syncQueueStatusComplete'][_0x0a7e('0x1a')](this));ami['on'](_0x0a7e('0x1f'),this['syncQueueCallerJoin'][_0x0a7e('0x1a')](this));ami['on'](_0x0a7e('0x20'),this[_0x0a7e('0x21')]['bind'](this));ami['on'](_0x0a7e('0x22'),this[_0x0a7e('0x23')][_0x0a7e('0x1a')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x0a7e('0x1a')](this));ami['on']('agentconnect',this[_0x0a7e('0x24')]['bind'](this));ami['on']('varset',this[_0x0a7e('0x25')]['bind'](this));ami['on'](_0x0a7e('0x26'),this[_0x0a7e('0x27')][_0x0a7e('0x1a')](this));ami['on'](_0x0a7e('0x28'),this[_0x0a7e('0x29')][_0x0a7e('0x1a')](this));ami['on']('musiconholdstart',this[_0x0a7e('0x2a')]['bind'](this));ami['on'](_0x0a7e('0x2b'),this['syncMusicOnHoldStop'][_0x0a7e('0x1a')](this));ami['on'](_0x0a7e('0x2c'),this['syncAttendedTransfer'][_0x0a7e('0x1a')](this));ami['on'](_0x0a7e('0x2d'),this[_0x0a7e('0x2e')][_0x0a7e('0x1a')](this));this[_0x0a7e('0x2f')]();this[_0x0a7e('0x30')]();}function clearChannels(_0x349692){if(!_[_0x0a7e('0x31')](_0x349692)){for(var _0x3ec677 in _0x349692){if(_0x349692[_0x0a7e('0x32')](_0x3ec677)){delete _0x349692[_0x3ec677];}}}}function clearCampaigns(_0x314fa4){if(!_[_0x0a7e('0x31')](_0x314fa4)){for(var _0x2ff7b0 in _0x314fa4){if(_0x314fa4[_0x0a7e('0x32')](_0x2ff7b0)){_0x314fa4[_0x2ff7b0][_0x0a7e('0x33')]=0x0;}}}}function clearVoiceQueues(_0x2989f4){if(!_[_0x0a7e('0x31')](_0x2989f4)){for(var _0x46cb67 in _0x2989f4){if(_0x2989f4['hasOwnProperty'](_0x46cb67)){_0x2989f4[_0x46cb67]['originated']=0x0;_0x2989f4[_0x46cb67][_0x0a7e('0x34')]=0x0;_0x2989f4[_0x46cb67]['pTalking']=0x0;_0x2989f4[_0x46cb67][_0x0a7e('0x35')]=0x0;_0x2989f4[_0x46cb67]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x23bad2){if(!_[_0x0a7e('0x31')](_0x23bad2)){for(var _0x371ab0 in _0x23bad2){if(_0x23bad2[_0x0a7e('0x32')](_0x371ab0)){_0x23bad2[_0x371ab0]['unlockRR']=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x40f82e){return _0x40f82e['queuecallerexit']||_0x40f82e[_0x0a7e('0x20')]||_0x40f82e[_0x0a7e('0x36')];}VoiceQueueReport[_0x0a7e('0xc')]['clearZombieChannels']=function(){var _0xfba146=this;for(var _0x72e97d in this['channels']){if(this[_0x0a7e('0x13')][_0x0a7e('0x32')](_0x72e97d)&&!this['channels'][_0x72e97d][_0x0a7e('0x37')]){this[_0x0a7e('0x10')][_0x0a7e('0xd')](function(){if(!_[_0x0a7e('0x38')](_0xfba146[_0x0a7e('0x13')][_0x72e97d])){return ami[_0x0a7e('0x39')]({'action':_0x0a7e('0x3a'),'channel':_0xfba146['channels'][_0x72e97d][_0x0a7e('0x3b')]})[_0x0a7e('0x3c')](function(_0xca8597){if(_0xca8597[_0x0a7e('0x3d')]===_0x0a7e('0x3e')){setTimeout(function(){if(_0xfba146[_0x0a7e('0x13')][_0x72e97d]){delete _0xfba146[_0x0a7e('0x13')][_0x72e97d];logger[_0x0a7e('0x3f')](_0x0a7e('0x40'),_0x72e97d,util['inspect'](_0xca8597,{'showHidden':![],'depth':null}));}if(_0xfba146[_0x0a7e('0x41')][_0x72e97d]){delete _0xfba146[_0x0a7e('0x41')][_0x72e97d];logger[_0x0a7e('0x3f')](_0x0a7e('0x42'),_0x72e97d,util[_0x0a7e('0x43')](_0xca8597,{'showHidden':![],'depth':null}));}if(_0xfba146['variables'][_0x72e97d]){delete _0xfba146[_0x0a7e('0x17')][_0x72e97d];logger[_0x0a7e('0x3f')](_0x0a7e('0x44'),_0x72e97d,util[_0x0a7e('0x43')](_0xca8597,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger[_0x0a7e('0x3f')](_0x0a7e('0x45'));clearChannels(this[_0x0a7e('0x13')]);this[_0x0a7e('0x46')](this[_0x0a7e('0x41')]);clearAgentBooked(this[_0x0a7e('0x12')]);clearVoiceQueues(this[_0x0a7e('0x14')]);clearCampaigns(this[_0x0a7e('0x15')]);this[_0x0a7e('0x16')]=initializeSummary();};VoiceQueueReport[_0x0a7e('0xc')]['clearQueueReport']=function(_0x1bc6f6){var _0x4b48f4=this;if(!_[_0x0a7e('0x31')](_0x1bc6f6)){for(var _0x13e69a in _0x1bc6f6){if(_0x1bc6f6['hasOwnProperty'](_0x13e69a)){_0x4b48f4[_0x0a7e('0x47')](_0x1bc6f6[_0x13e69a],_0x0a7e('0x48'));delete _0x1bc6f6[_0x13e69a];}}}};VoiceQueueReport[_0x0a7e('0xc')][_0x0a7e('0x49')]=function(_0x728a5b,_0x550172,_0x4644c2){io['to'](_0x728a5b)['emit'](_0x550172,_0x4644c2);};VoiceQueueReport[_0x0a7e('0xc')]['emitVoiceQueueChannelSave']=function(_0x109b6d,_0x16972a){logger[_0x0a7e('0x4a')](_0x0a7e('0x4b')+_0x16972a+_0x0a7e('0x4c'),_0x109b6d[_0x0a7e('0x4d')],util[_0x0a7e('0x43')](_0x109b6d,{'showHidden':![],'depth':null}));this[_0x0a7e('0x49')](util['format'](_0x0a7e('0x4e'),_0x109b6d[_0x0a7e('0x4f')]),_0x0a7e('0x50'),_0x109b6d);io[_0x0a7e('0x49')](_0x0a7e('0x51'),_0x109b6d);};VoiceQueueReport[_0x0a7e('0xc')]['emitVoiceQueueChannelRemove']=function(_0x308b2e,_0x45bc87){logger[_0x0a7e('0x4a')](_0x0a7e('0x4b')+_0x45bc87+_0x0a7e('0x52'),_0x308b2e[_0x0a7e('0x4d')],util['inspect'](_0x308b2e,{'showHidden':![],'depth':null}));if(_0x308b2e[_0x0a7e('0x53')]===_0x0a7e('0x54')){return;}this[_0x0a7e('0x49')](util[_0x0a7e('0x55')]('voice:queue:%s',_0x308b2e['queue']),_0x0a7e('0x56'),_0x308b2e);io['emit'](_0x0a7e('0x57'),_0x308b2e);};VoiceQueueReport[_0x0a7e('0xc')][_0x0a7e('0x58')]=function(_0x2a35f3){if(_0x2a35f3[_0x0a7e('0x59')]===_0x0a7e('0x5a')){logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util['inspect'](_0x2a35f3,{'showHidden':![],'depth':null}));this['emit'](util[_0x0a7e('0x55')](_0x0a7e('0x4e'),_0x2a35f3['name']),_0x0a7e('0x5b'),_0x2a35f3);}};VoiceQueueReport[_0x0a7e('0xc')]['isNotNull']=function(_0x4b839d){return _0x4b839d!==null&&!_['isUndefined'](_0x4b839d);};VoiceQueueReport[_0x0a7e('0xc')][_0x0a7e('0x30')]=function(){var _0xdd20dc=this;setInterval(function(){_0xdd20dc[_0x0a7e('0x5c')]();ami[_0x0a7e('0x39')]({'action':_0x0a7e('0x5d')})[_0x0a7e('0x3c')](function(_0x28b0aa){logger[_0x0a7e('0x3f')](_0x0a7e('0x5e'),util['inspect'](_0x28b0aa,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype'][_0x0a7e('0x2f')]=function(){var _0x115d2f=this;setInterval(function(){if(!_0x115d2f[_0x0a7e('0x16')][_0x0a7e('0x5f')]){return ami[_0x0a7e('0x39')]({'action':_0x0a7e('0x18')})['then'](function(_0x34d09c){_0x115d2f[_0x0a7e('0x16')]['id']=_0x34d09c['actionid'];_0x115d2f[_0x0a7e('0x16')][_0x0a7e('0x5f')]=!![];_0x115d2f[_0x0a7e('0x16')]['queuestatus'][_0x34d09c[_0x0a7e('0x60')]]={};})[_0x0a7e('0x3c')](function(_0x2ef807){logger[_0x0a7e('0x3f')](_0x0a7e('0x61'),util['inspect'](_0x2ef807,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x0a7e('0xc')]['createQueueSummaryReport']=function(_0x4f6d92,_0xef6c56){var _0x2d4d10;if(this[_0x0a7e('0x16')]&&this[_0x0a7e('0x16')]['queues']&&this[_0x0a7e('0x16')][_0x0a7e('0x5d')][_0x4f6d92['name']]){_0x2d4d10=this[_0x0a7e('0x16')][_0x0a7e('0x5d')][_0x4f6d92[_0x0a7e('0x62')]]['summaryEvent'];}var _0x18e026=new VoiceQueueSummary(_0x4f6d92);return _0x18e026[_0x0a7e('0x63')](_0xef6c56[_0x0a7e('0x12')],this[_0x0a7e('0x12')],_0x2d4d10,this[_0x0a7e('0x11')]['channels']);};VoiceQueueReport[_0x0a7e('0xc')]['handleInboundQueueSummaryReport']=function(_0x28901b,_0x4cbd35){var _0x3ad73f=this[_0x0a7e('0x64')](_0x28901b,_0x4cbd35);var _0x378501=![];_0x378501=_0x3ad73f['compareToInboundQueue'](_0x28901b);if(_0x378501){Object[_0x0a7e('0x65')](_0x28901b,_0x3ad73f);this[_0x0a7e('0x11')][_0x0a7e('0x14')][_0x28901b['name']]=_0x28901b;this[_0x0a7e('0x58')](_0x3ad73f);}};VoiceQueueReport['prototype']['syncQueueStatusComplete']=function(_0x49e0a2){var _0x5c5879=null;var _0x4affd7=this[_0x0a7e('0x16')]['id'];if(this[_0x0a7e('0x16')][_0x0a7e('0x66')][_0x4affd7]){_0x5c5879=this[_0x0a7e('0x16')][_0x0a7e('0x66')][_0x4affd7][_0x49e0a2[_0x0a7e('0x60')]];}if(!_0x5c5879){this[_0x0a7e('0x16')]=initializeSummary();return;}var _0xbaaec7=this['voiceQueues'][_0x5c5879['queue']];if(_0xbaaec7[_0x0a7e('0x59')]==='inbound'){this[_0x0a7e('0x67')](_0xbaaec7,_0x5c5879);}else if(_0xbaaec7[_0x0a7e('0x59')]===_0x0a7e('0x68')){var _0x1fd231=this['createQueueSummaryReport'](_0xbaaec7,_0x5c5879);ami[_0x0a7e('0x49')](_0x0a7e('0x69'),_0x1fd231);}this[_0x0a7e('0x16')][_0x0a7e('0x6a')]-=0x1;var _0x2c21d7=this[_0x0a7e('0x16')][_0x0a7e('0x6a')]>0x0?!![]:![];if(!_0x2c21d7){return this[_0x0a7e('0x1b')](this[_0x0a7e('0x16')][_0x0a7e('0x6b')]);}};VoiceQueueReport[_0x0a7e('0xc')][_0x0a7e('0x1d')]=function(_0x33eea8){var _0x4cbc6c=this['summary']['id'];if(this[_0x0a7e('0x16')][_0x0a7e('0x66')][_0x4cbc6c]&&this[_0x0a7e('0x16')][_0x0a7e('0x66')][_0x4cbc6c][_0x33eea8[_0x0a7e('0x60')]]){this['summary'][_0x0a7e('0x66')][_0x4cbc6c][_0x33eea8[_0x0a7e('0x60')]]['agents']['push'](_0x33eea8);}};VoiceQueueReport[_0x0a7e('0xc')][_0x0a7e('0x19')]=function(_0x35dd57){var _0x84b86c=this;try{if(this[_0x0a7e('0x6c')](_0x35dd57)&&this['isNotNull'](_0x35dd57['queue'])){logger[_0x0a7e('0x4a')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x0a7e('0x43')](_0x35dd57,{'showHidden':![],'depth':null}));var _0x439194=this[_0x0a7e('0x14')][_0x35dd57['queue']];if(_0x439194){logger['debug']('[voiceQueueReport][queuesummary]\x20name:%s',_0x439194['name']);this[_0x0a7e('0x16')][_0x0a7e('0x5d')][_0x439194[_0x0a7e('0x62')]]={'summaryEvent':_0x35dd57};this[_0x0a7e('0x16')][_0x0a7e('0x6a')]+=0x1;return ami[_0x0a7e('0x39')]({'action':_0x0a7e('0x66'),'queue':_0x439194[_0x0a7e('0x62')]})[_0x0a7e('0x6d')](function(_0x20e843){if(!_0x84b86c[_0x0a7e('0x16')][_0x0a7e('0x66')][_0x35dd57['actionid']]){_0x84b86c[_0x0a7e('0x16')][_0x0a7e('0x66')][_0x35dd57[_0x0a7e('0x60')]]={};}_0x84b86c['summary'][_0x0a7e('0x66')][_0x35dd57[_0x0a7e('0x60')]][_0x20e843[_0x0a7e('0x60')]]={'queue':_0x439194[_0x0a7e('0x62')],'agents':[]};})['catch'](function(_0x45d5ee){throw _0x45d5ee;});}}}catch(_0x1f44d9){logger['error'](_0x0a7e('0x61'),util[_0x0a7e('0x43')](_0x1f44d9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0a7e('0xc')][_0x0a7e('0x1b')]=function(_0x42e83c){if(this[_0x0a7e('0x16')][_0x0a7e('0x6a')]>0x0){this[_0x0a7e('0x16')][_0x0a7e('0x6b')]=_0x42e83c;return;}logger[_0x0a7e('0x4a')](_0x0a7e('0x6e'),util[_0x0a7e('0x43')](_0x42e83c,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x0a7e('0x49')](_0x0a7e('0x6f'),{});};VoiceQueueReport[_0x0a7e('0xc')]['syncQueueCallerJoin']=function(_0x5b3a26){try{if(this[_0x0a7e('0x6c')](_0x5b3a26)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x5b3a26[_0x0a7e('0x4d')],util[_0x0a7e('0x43')](_0x5b3a26,{'showHidden':![],'depth':null}));if(_[_0x0a7e('0x70')](this[_0x0a7e('0x41')][_0x5b3a26['uniqueid']])){this[_0x0a7e('0x41')][_0x5b3a26['uniqueid']]=[];}if(_[_0x0a7e('0x70')](this[_0x0a7e('0x13')][_0x5b3a26[_0x0a7e('0x4d')]])){this[_0x0a7e('0x13')][_0x5b3a26['uniqueid']]={};}var _0x1ba3c0=new QueueReport();_0x1ba3c0[_0x0a7e('0x4f')]=_0x5b3a26[_0x0a7e('0x4f')];_0x1ba3c0[_0x0a7e('0x59')]=this['voiceQueues'][_0x1ba3c0[_0x0a7e('0x4f')]]&&this[_0x0a7e('0x14')][_0x1ba3c0['queue']][_0x0a7e('0x59')]?this[_0x0a7e('0x14')][_0x1ba3c0[_0x0a7e('0x4f')]][_0x0a7e('0x59')]||_0x0a7e('0x5a'):'inbound';_0x1ba3c0[_0x0a7e('0x71')]=moment()[_0x0a7e('0x55')](_0x0a7e('0x72'));_0x1ba3c0[_0x0a7e('0x73')]=_0x5b3a26[_0x0a7e('0x73')];_0x1ba3c0[_0x0a7e('0x74')]=_0x5b3a26['count'];_0x1ba3c0['uniqueid']=_0x5b3a26['uniqueid'];logger[_0x0a7e('0x75')](_0x0a7e('0x76'),_0x1ba3c0[_0x0a7e('0x4f')],_0x1ba3c0[_0x0a7e('0x59')]);Object[_0x0a7e('0x65')](_0x1ba3c0,_[_0x0a7e('0x77')](_0x5b3a26,_[_0x0a7e('0x78')](_0x1ba3c0)));this[_0x0a7e('0x41')][_0x5b3a26[_0x0a7e('0x4d')]][_0x0a7e('0x79')](_0x1ba3c0);this[_0x0a7e('0x13')][_0x5b3a26[_0x0a7e('0x4d')]]=_0x1ba3c0;this[_0x0a7e('0x7a')](_0x1ba3c0,_0x0a7e('0x1f'));}}catch(_0x534640){logger[_0x0a7e('0x3f')](_0x0a7e('0x7b'),_0x5b3a26[_0x0a7e('0x4d')],util[_0x0a7e('0x43')](_0x534640,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0a7e('0xc')][_0x0a7e('0x21')]=function(_0x38b8e4){try{if(this[_0x0a7e('0x6c')](_0x38b8e4)){logger['debug'](_0x0a7e('0x7c'),_0x38b8e4[_0x0a7e('0x4d')],util[_0x0a7e('0x43')](_0x38b8e4,{'showHidden':![],'depth':null}));if(this[_0x0a7e('0x41')][_0x38b8e4[_0x0a7e('0x4d')]]){var _0x4b5037=_[_0x0a7e('0x7d')](this[_0x0a7e('0x41')][_0x38b8e4[_0x0a7e('0x4d')]]);_0x4b5037[_0x0a7e('0x36')]=![];_0x4b5037[_0x0a7e('0x7e')]=null;_0x4b5037[_0x0a7e('0x7f')]=_0x38b8e4[_0x0a7e('0x7f')];_0x4b5037[_0x0a7e('0x80')]=_0x38b8e4[_0x0a7e('0x80')];_0x4b5037[_0x0a7e('0x20')]=!![];_0x4b5037['queuecallerabandonAt']=moment()[_0x0a7e('0x55')](_0x0a7e('0x72'));_0x4b5037[_0x0a7e('0x53')]=_0x0a7e('0x81');_0x4b5037[_0x0a7e('0x82')]=null;logger[_0x0a7e('0x75')](_0x0a7e('0x83'),_0x4b5037[_0x0a7e('0x4f')],_0x4b5037[_0x0a7e('0x59')]);this[_0x0a7e('0x13')][_0x38b8e4[_0x0a7e('0x4d')]]=_0x4b5037;this['emitVoiceQueueChannelRemove'](_0x4b5037,_0x0a7e('0x20'));}}}catch(_0x46f5cc){logger[_0x0a7e('0x3f')](_0x0a7e('0x7c'),_0x38b8e4['uniqueid'],util['inspect'](_0x46f5cc,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0a7e('0x23')]=function(_0x456439){try{if(this[_0x0a7e('0x6c')](_0x456439)){logger[_0x0a7e('0x4a')](_0x0a7e('0x84'),_0x456439['uniqueid'],util['inspect'](_0x456439,{'showHidden':![],'depth':null}));if(this[_0x0a7e('0x41')][_0x456439[_0x0a7e('0x4d')]]){var _0x10baa6=_['last'](this[_0x0a7e('0x41')][_0x456439['uniqueid']]);_0x10baa6[_0x0a7e('0x85')]=moment()[_0x0a7e('0x55')](_0x0a7e('0x72'));_0x10baa6['connectedlinenum']=_0x456439[_0x0a7e('0x86')];_0x10baa6[_0x0a7e('0x87')]=_0x456439[_0x0a7e('0x87')];logger[_0x0a7e('0x75')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x10baa6[_0x0a7e('0x4f')],_0x10baa6[_0x0a7e('0x59')],_0x456439[_0x0a7e('0x86')],_0x456439[_0x0a7e('0x87')]);this[_0x0a7e('0x13')][_0x456439[_0x0a7e('0x4d')]]=_0x10baa6;this[_0x0a7e('0x7a')](_0x10baa6,_0x0a7e('0x22'));}}}catch(_0x5bcd0c){logger[_0x0a7e('0x3f')](_0x0a7e('0x84'),_0x456439['uniqueid'],util[_0x0a7e('0x43')](_0x5bcd0c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0a7e('0xc')][_0x0a7e('0x24')]=function(_0xac1dd6){try{if(this[_0x0a7e('0x6c')](_0xac1dd6)){logger[_0x0a7e('0x4a')](_0x0a7e('0x88'),_0xac1dd6[_0x0a7e('0x4d')],util[_0x0a7e('0x43')](_0xac1dd6,{'showHidden':![],'depth':null}));if(this[_0x0a7e('0x41')][_0xac1dd6[_0x0a7e('0x4d')]]){var _0xf42175=_[_0x0a7e('0x7d')](this[_0x0a7e('0x41')][_0xac1dd6[_0x0a7e('0x4d')]]);_0xf42175[_0x0a7e('0x36')]=!![];_0xf42175['queuecallerexitreason']=_0x0a7e('0x89');logger[_0x0a7e('0x75')](_0x0a7e('0x8a'),_0xf42175['queue'],_0xf42175['type']);}}}catch(_0x282c4f){logger[_0x0a7e('0x3f')](_0x0a7e('0x88'),_0xac1dd6[_0x0a7e('0x4d')],util['inspect'](_0x282c4f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0a7e('0xc')]['syncAgentComplete']=function(_0x114b12){try{if(this[_0x0a7e('0x6c')](_0x114b12)){logger[_0x0a7e('0x4a')]('[%s][voiceQueueReport][agentcomplete]',_0x114b12[_0x0a7e('0x4d')],util[_0x0a7e('0x43')](_0x114b12,{'showHidden':![],'depth':null}));if(this[_0x0a7e('0x41')][_0x114b12['uniqueid']]){var _0x4ea4e3=_['last'](this[_0x0a7e('0x41')][_0x114b12[_0x0a7e('0x4d')]]);_0x4ea4e3[_0x0a7e('0x20')]=![];_0x4ea4e3['queuecallerabandonAt']=null;_0x4ea4e3[_0x0a7e('0x8b')]=!![];_0x4ea4e3['lastAssignedTo']=_0x114b12[_0x0a7e('0x8c')];_0x4ea4e3['holdtime']=_0x114b12['holdtime'];_0x4ea4e3[_0x0a7e('0x36')]=!![];_0x4ea4e3[_0x0a7e('0x8d')]=![];_0x4ea4e3['queuecallerexitAt']=null;if(!_0x4ea4e3['transfer']){if(_0x114b12[_0x0a7e('0x8e')]==_0x0a7e('0x8f')){_0x4ea4e3[_0x0a7e('0x53')]=_0x0a7e('0x90');logger['info'](_0x0a7e('0x91'),_0x4ea4e3[_0x0a7e('0x4f')],_0x4ea4e3[_0x0a7e('0x59')]);}else{if(_['startsWith'](_0x114b12['channel'][_0x0a7e('0x92')](),_0x0a7e('0x93'))){if(this[_0x0a7e('0x41')][_0x114b12[_0x0a7e('0x94')]]){var _0x1b1d33=_[_0x0a7e('0x7d')](this['queueReports'][_0x114b12[_0x0a7e('0x94')]]);_0x1b1d33[_0x0a7e('0x36')]=![];_0x1b1d33[_0x0a7e('0x8d')]=!![];_0x1b1d33[_0x0a7e('0x95')]=moment(_0x4ea4e3[_0x0a7e('0x71')])['add'](_0x114b12['holdtime'],_0x0a7e('0x96'))['format'](_0x0a7e('0x72'));_0x1b1d33[_0x0a7e('0x53')]=_0x0a7e('0x97');_0x1b1d33[_0x0a7e('0x8f')]=!![];_0x1b1d33[_0x0a7e('0x98')]='FORWARD';_0x1b1d33[_0x0a7e('0x99')]=_0x114b12[_0x0a7e('0x9a')];_0x1b1d33['transferuniqueid']=_0x114b12[_0x0a7e('0x4d')];logger['info'](_0x0a7e('0x9b'),_0x1b1d33['queue'],_0x1b1d33[_0x0a7e('0x59')]);var _0x29674e=this[_0x0a7e('0x41')][_0x114b12[_0x0a7e('0x94')]];this[_0x0a7e('0x41')][_0x114b12[_0x0a7e('0x94')]]=this[_0x0a7e('0x41')][_0x114b12[_0x0a7e('0x4d')]];this[_0x0a7e('0x41')][_0x114b12[_0x0a7e('0x4d')]]=_0x29674e;}}else{_0x4ea4e3[_0x0a7e('0x53')]='COMPLETEDBY'+_0x114b12[_0x0a7e('0x8e')]['toUpperCase']();logger[_0x0a7e('0x75')](_0x0a7e('0x9c'),_0x4ea4e3[_0x0a7e('0x4f')],_0x4ea4e3[_0x0a7e('0x59')],_0x4ea4e3['queuecallerexitreason']);}}}this[_0x0a7e('0x13')][_0x114b12['uniqueid']]=_0x4ea4e3;}}}catch(_0x59c649){logger[_0x0a7e('0x3f')](_0x0a7e('0x9d'),_0x114b12['uniqueid'],util[_0x0a7e('0x43')](_0x59c649,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0a7e('0xc')][_0x0a7e('0x25')]=function(_0x50e469){try{if(this[_0x0a7e('0x6c')](_0x50e469)){logger[_0x0a7e('0x4a')](_0x0a7e('0x9e'),_0x50e469['uniqueid'],util[_0x0a7e('0x43')](_0x50e469,{'showHidden':![],'depth':null}));this[_0x0a7e('0x9f')](_0x50e469['uniqueid'],_['keys'](_0x50e469[_0x0a7e('0xa0')])[0x0],_0x50e469[_0x0a7e('0xa1')]);if(this[_0x0a7e('0x41')][_0x50e469['uniqueid']]){var _0x2d4fa5=_['last'](this['queueReports'][_0x50e469[_0x0a7e('0x4d')]]);if(_0x2d4fa5){if(this['isNotNull'](_0x50e469['variable'])&&this['isNotNull'](_0x50e469[_0x0a7e('0xa0')][_0x0a7e('0x66')])){switch(_0x50e469[_0x0a7e('0xa1')]){case _0x0a7e('0xa2'):_0x2d4fa5[_0x0a7e('0x8d')]=![];_0x2d4fa5[_0x0a7e('0x95')]=null;break;case _0x0a7e('0xa3'):_0x2d4fa5['lastevent']=_0x0a7e('0xa4');_0x2d4fa5[_0x0a7e('0x8d')]=!![];_0x2d4fa5[_0x0a7e('0x95')]=moment()[_0x0a7e('0x55')](_0x0a7e('0x72'));_0x2d4fa5['queuecallerleaveAt']=moment()[_0x0a7e('0x55')](_0x0a7e('0x72'));logger[_0x0a7e('0x4a')](_0x0a7e('0xa5'),_0x50e469[_0x0a7e('0x4d')],util['inspect'](_0x2d4fa5,{'showHidden':![],'depth':null}));ami[_0x0a7e('0x49')]('custom:timeout',_0x2d4fa5);break;default:_0x2d4fa5[_0x0a7e('0x8d')]=!![];_0x2d4fa5[_0x0a7e('0x95')]=moment()[_0x0a7e('0x55')](_0x0a7e('0x72'));_0x2d4fa5[_0x0a7e('0x85')]=moment()[_0x0a7e('0x55')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2d4fa5['queuecallerabandon']=![];_0x2d4fa5[_0x0a7e('0xa6')]=null;_0x2d4fa5['queuecallerexitreason']=_0x50e469[_0x0a7e('0xa1')];this[_0x0a7e('0x13')][_0x50e469['uniqueid']]=_0x2d4fa5;this['emitVoiceQueueChannelRemove'](_0x2d4fa5,_0x0a7e('0xa7'));}else if(this[_0x0a7e('0x6c')](_0x50e469['variable'])&&this[_0x0a7e('0x6c')](_0x50e469[_0x0a7e('0xa0')][_0x0a7e('0xa8')])){if(!_0x2d4fa5[_0x0a7e('0x20')]){_0x2d4fa5[_0x0a7e('0x8d')]=!![];_0x2d4fa5[_0x0a7e('0x95')]=moment()[_0x0a7e('0x55')](_0x0a7e('0x72'));_0x2d4fa5[_0x0a7e('0x53')]=_0x0a7e('0xa9');_0x2d4fa5['queuecallerleaveAt']=moment()['format'](_0x0a7e('0x72'));this[_0x0a7e('0x13')][_0x50e469[_0x0a7e('0x4d')]]=_0x2d4fa5;}}logger[_0x0a7e('0x75')](_0x0a7e('0xaa'),_0x50e469[_0x0a7e('0x4d')],_0x2d4fa5['queue'],_0x2d4fa5['type'],_[_0x0a7e('0x78')](_0x50e469[_0x0a7e('0xa0')])[0x0],_0x50e469['value']);_0x2d4fa5[_0x0a7e('0x17')]=this[_0x0a7e('0x17')][_0x50e469[_0x0a7e('0x4d')]];}}}}catch(_0x403785){logger[_0x0a7e('0x3f')]('[%s][voiceQueueReport][varset]',_0x50e469[_0x0a7e('0x4d')],util['inspect'](_0x403785,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0a7e('0xc')][_0x0a7e('0x9f')]=function(_0x43603e,_0x29df07,_0x50d5ed){var _0xbd9f1f=[_0x0a7e('0xab'),'rtpaudioqosbridged',_0x0a7e('0xac'),'rtpaudioqosjitterbridged',_0x0a7e('0xad'),'rtpaudioqoslossbridged',_0x0a7e('0xae'),'rtpaudioqosrttbridged',_0x0a7e('0xaf'),_0x0a7e('0xb0'),_0x0a7e('0xb1'),_0x0a7e('0xb2'),'membercalls',_0x0a7e('0xb3'),_0x0a7e('0xb4'),'memberlastcall','membername','memberpenalty','memberrealtime'];if(!_[_0x0a7e('0x38')](_0x29df07)&&!_['includes'](_0xbd9f1f,_0x29df07)){if(_[_0x0a7e('0x70')](this[_0x0a7e('0x17')][_0x43603e])){this[_0x0a7e('0x17')][_0x43603e]={};}this[_0x0a7e('0x17')][_0x43603e][_0x29df07]=_0x50d5ed;}};VoiceQueueReport[_0x0a7e('0xc')][_0x0a7e('0xb5')]=function(_0x5ee179,_0x5a2fe1,_0x39fef4){try{var _0x4a7e50={};if(this[_0x0a7e('0x41')][_0x5ee179]){for(var _0x51fa3e=0x0;_0x51fa3e{delete this[_0x0a7e('0x13')][_0x5cdf80];},_0x2cd94b);}};module[_0x0a7e('0xec')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 628e869..27e8143 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x577c=['Request','CreateReportAgentPreview','campaign'];(function(_0x17e89f,_0x1f13b5){var _0x223764=function(_0x301c52){while(--_0x301c52){_0x17e89f['push'](_0x17e89f['shift']());}};_0x223764(++_0x1f13b5);}(_0x577c,0x1eb));var _0xc577=function(_0xf1b0a0,_0x42bd06){_0xf1b0a0=_0xf1b0a0-0x0;var _0x54675d=_0x577c[_0xf1b0a0];return _0x54675d;};'use strict';var client=require('../client');exports['createHistory']=function(_0x1b4c53){return function(){_0x1b4c53[_0xc577('0x0')]=_0x1b4c53['queue'];return client[_0xc577('0x1')](_0xc577('0x2'),{'body':_0x1b4c53,'log':_0xc577('0x2')});};}; \ No newline at end of file +var _0xa6d4=['queue','Request','CreateReportAgentPreview','../client','createHistory'];(function(_0xefb33e,_0x11bbb5){var _0x529db6=function(_0x4439ea){while(--_0x4439ea){_0xefb33e['push'](_0xefb33e['shift']());}};_0x529db6(++_0x11bbb5);}(_0xa6d4,0xfd));var _0x4a6d=function(_0x293d1b,_0x42b8c0){_0x293d1b=_0x293d1b-0x0;var _0x2aa86f=_0xa6d4[_0x293d1b];return _0x2aa86f;};'use strict';var client=require(_0x4a6d('0x0'));exports[_0x4a6d('0x1')]=function(_0x34c56f){return function(){_0x34c56f['campaign']=_0x34c56f[_0x4a6d('0x2')];return client[_0x4a6d('0x3')](_0x4a6d('0x4'),{'body':_0x34c56f,'log':_0x4a6d('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index d5cedda..9819a13 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x46aa=['../client','create','CreateAttachment'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x46aa,0x90));var _0xa46a=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x46aa[_0x4e7d25];return _0x526fe6;};'use strict';var client=require(_0xa46a('0x0'));exports[_0xa46a('0x1')]=function(_0x32678d){return client['Request']('CreateAttachment',{'body':_0x32678d,'log':_0xa46a('0x2')});}; \ No newline at end of file +var _0x989b=['../client','create','CreateAttachment'];(function(_0x1fbd72,_0x5b353f){var _0x47e61a=function(_0x24581a){while(--_0x24581a){_0x1fbd72['push'](_0x1fbd72['shift']());}};_0x47e61a(++_0x5b353f);}(_0x989b,0x198));var _0xb989=function(_0x51c9cf,_0xef6bb8){_0x51c9cf=_0x51c9cf-0x0;var _0x8b66f8=_0x989b[_0x51c9cf];return _0x8b66f8;};'use strict';var client=require(_0xb989('0x0'));exports[_0xb989('0x1')]=function(_0x2910a9){return client['Request'](_0xb989('0x2'),{'body':_0x2910a9,'log':_0xb989('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index da9d5f7..cd2af54 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['Interval','interval','SquareProject','getCampaign','getCampaigns','Request','GetCampaign','name','type','active','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','TrunkBackup','callerid'];(function(_0x152fd6,_0x2f1c8a){var _0x2148f4=function(_0x5972a5){while(--_0x5972a5){_0x152fd6['push'](_0x152fd6['shift']());}};_0x2148f4(++_0x2f1c8a);}(_0x1261,0x144));var _0x1126=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0x1261[_0x9cfe28];return _0x54a1d0;};'use strict';var client=require('../client');exports[_0x1126('0x0')]=function(){return function(){return client[_0x1126('0x1')](_0x1126('0x2'),{'options':{'raw':![],'attributes':['id',_0x1126('0x3'),_0x1126('0x4'),_0x1126('0x5'),_0x1126('0x6'),_0x1126('0x7'),_0x1126('0x8'),_0x1126('0x9'),'dialCongestionMaxRetry','dialCongestionRetryFrequency',_0x1126('0xa'),_0x1126('0xb'),'dialNoAnswerMaxRetry',_0x1126('0xc'),_0x1126('0xd'),_0x1126('0xe'),_0x1126('0xf'),_0x1126('0x10'),'dialDropRetryFrequency',_0x1126('0x11'),_0x1126('0x12'),_0x1126('0x13'),'dialMachineRetryFrequency',_0x1126('0x14'),'dialAgentRejectRetryFrequency','dialTimezone',_0x1126('0x15'),'dialAMDActive',_0x1126('0x16'),_0x1126('0x17'),_0x1126('0x18'),_0x1126('0x19'),_0x1126('0x1a'),_0x1126('0x1b'),_0x1126('0x1c'),_0x1126('0x1d'),_0x1126('0x1e'),'dialOrderByScheduledAt','dialPrefix',_0x1126('0x1f'),_0x1126('0x20')],'include':[{'model':_0x1126('0x21'),'as':'Trunk','attributes':['id',_0x1126('0x3'),'callerid',_0x1126('0x5')]},{'model':_0x1126('0x21'),'as':_0x1126('0x22'),'attributes':['id','name',_0x1126('0x23'),_0x1126('0x5')]},{'model':'Interval','as':'Interval','attributes':['id',_0x1126('0x3')],'include':[{'model':_0x1126('0x24'),'as':'Intervals','attributes':['id','name',_0x1126('0x25')]}]},{'model':'SquareProject','as':_0x1126('0x26'),'attributes':['id',_0x1126('0x3')]}]},'log':_0x1126('0x27')});};}; \ No newline at end of file +var _0xdb28=['dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','name','callerid','Interval','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','type','active','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialTimezone','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt'];(function(_0x1d9d89,_0x1c77e1){var _0x4a7e56=function(_0x3b2d1d){while(--_0x3b2d1d){_0x1d9d89['push'](_0x1d9d89['shift']());}};_0x4a7e56(++_0x1c77e1);}(_0xdb28,0x106));var _0x8db2=function(_0x310a30,_0x4652a1){_0x310a30=_0x310a30-0x0;var _0x41fbf4=_0xdb28[_0x310a30];return _0x41fbf4;};'use strict';var client=require(_0x8db2('0x0'));exports[_0x8db2('0x1')]=function(){return function(){return client[_0x8db2('0x2')](_0x8db2('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'dialOriginateTimeout',_0x8db2('0x9'),_0x8db2('0xa'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'dialAbandonedMaxRetry',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'dialAgentRejectMaxRetry',_0x8db2('0x15'),_0x8db2('0x16'),'dialGlobalInterval',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21'),_0x8db2('0x22')],'include':[{'model':_0x8db2('0x23'),'as':_0x8db2('0x23'),'attributes':['id',_0x8db2('0x24'),'callerid',_0x8db2('0x5')]},{'model':_0x8db2('0x23'),'as':'TrunkBackup','attributes':['id',_0x8db2('0x24'),_0x8db2('0x25'),_0x8db2('0x5')]},{'model':_0x8db2('0x26'),'as':_0x8db2('0x26'),'attributes':['id',_0x8db2('0x24')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x8db2('0x24'),_0x8db2('0x27')]}]},{'model':_0x8db2('0x28'),'as':_0x8db2('0x28'),'attributes':['id','name']}]},'log':_0x8db2('0x29')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index caf79ad..42e338e 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3376=['getContacts','Request','GetCmContact','../client','createContact','CreateCmContact'];(function(_0x59d3e3,_0xe57022){var _0x48d835=function(_0x14feb0){while(--_0x14feb0){_0x59d3e3['push'](_0x59d3e3['shift']());}};_0x48d835(++_0xe57022);}(_0x3376,0x189));var _0x6337=function(_0x52d423,_0x435bfc){_0x52d423=_0x52d423-0x0;var _0x2bd8c6=_0x3376[_0x52d423];return _0x2bd8c6;};'use strict';var client=require(_0x6337('0x0'));exports[_0x6337('0x1')]=function(_0x1f1650){return function(){return client['Request'](_0x6337('0x2'),{'body':_0x1f1650,'log':_0x6337('0x2')});};};exports[_0x6337('0x3')]=function(_0x490dfa){return function(){return client[_0x6337('0x4')](_0x6337('0x5'),{'options':_0x490dfa,'log':_0x6337('0x5')});};}; \ No newline at end of file +var _0x8fc7=['GetCmContact','../client','Request','CreateCmContact'];(function(_0x55ff79,_0x3d45e7){var _0x579067=function(_0x3650e4){while(--_0x3650e4){_0x55ff79['push'](_0x55ff79['shift']());}};_0x579067(++_0x3d45e7);}(_0x8fc7,0xbd));var _0x78fc=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x8fc7[_0x49d41c];return _0xb64c5f;};'use strict';var client=require(_0x78fc('0x0'));exports['createContact']=function(_0x17380d){return function(){return client[_0x78fc('0x1')]('CreateCmContact',{'body':_0x17380d,'log':_0x78fc('0x2')});};};exports['getContacts']=function(_0x41e02a){return function(){return client[_0x78fc('0x1')]('GetCmContact',{'options':_0x41e02a,'log':_0x78fc('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index 6ab4216..9c82cc0 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x45d1=['Queue','getContactRecallMe','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','GetCmHopper','Contact','getCmHopper','updateContacts','Request','UpdateCmHopper','format','ListId','CampaignId','rescheduleContact','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','scheduledat','ASC','YYYY-MM-DD\x20HH:mm:ss','CmContact','GetContactDialerIvr','moveContactManagedDialer','campaign','queue','VoiceQueueId','MoveContactManagedDialer','countReScheduled','User','Agent','name','VoiceQueue'];(function(_0x2dd276,_0x630f){var _0x31f14a=function(_0x1c003f){while(--_0x1c003f){_0x2dd276['push'](_0x2dd276['shift']());}};_0x31f14a(++_0x630f);}(_0x45d1,0x1cb));var _0x145d=function(_0x52bfa5,_0x42cf21){_0x52bfa5=_0x52bfa5-0x0;var _0x26f80b=_0x45d1[_0x52bfa5];return _0x26f80b;};'use strict';var client=require(_0x145d('0x0'));var moment=require(_0x145d('0x1'));exports['getContacts']=function(_0x29a7cd,_0x1d1ab1){return function(){return client['Request'](_0x145d('0x2'),{'options':{'where':{'VoiceQueueId':_0x29a7cd},'include':[{'model':'CmContact','as':_0x145d('0x3')}],'limit':_0x1d1ab1,'raw':![]},'log':_0x145d('0x4')});};};exports[_0x145d('0x5')]=function(_0x211a9d,_0x14ddd8,_0x2896c3){return function(){return client[_0x145d('0x6')](_0x145d('0x7'),{'body':_0x211a9d,'options':{'where':{'VoiceQueueId':_0x14ddd8,'scheduledat':{'$lte':moment()[_0x145d('0x8')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x2896c3},'log':'UpdateCmHopper'});};};exports['rescheduleContact']=function(_0x419890){return client[_0x145d('0x6')](_0x145d('0x7'),{'body':_0x419890,'options':{'where':{'ContactId':_0x419890['ContactId'],'ListId':_0x419890[_0x145d('0x9')],'VoiceQueueId':_0x419890['VoiceQueueId'],'CampaignId':_0x419890[_0x145d('0xa')]}},'log':_0x145d('0xb')});};exports[_0x145d('0xc')]=function(_0x31dd6f,_0x528346,_0x103046){return function(){return client[_0x145d('0x6')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x31dd6f,'ListId':_0x528346,'ContactId':_0x103046}},'log':_0x145d('0xd')});};};exports[_0x145d('0xe')]=function(_0x45577b,_0x29a2da,_0x54380d,_0x5b8ffa){return client[_0x145d('0x6')](_0x145d('0xf'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x45577b,'active':![],'scheduledat':{'$lte':moment()[_0x145d('0x8')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x29a2da}}]},'order':[[_0x145d('0x10'),_0x145d('0x11')],[_0x145d('0x12'),_0x5b8ffa],['id',_0x145d('0x13')]],'raw':!![],'limit':_0x54380d},'log':_0x145d('0xf')});};exports['getContactDialerIvr']=function(_0x1c9ee2,_0x273589,_0x2f2353){return client['Request'](_0x145d('0xf'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x1c9ee2,'active':![],'scheduledat':{'$lte':moment()[_0x145d('0x8')](_0x145d('0x14'))}},'include':[{'model':_0x145d('0x15'),'as':'Contact'}],'order':[[_0x145d('0x10'),_0x145d('0x11')],[_0x145d('0x12'),_0x2f2353],['id','ASC']],'raw':!![],'limit':_0x273589},'log':_0x145d('0x16')});};exports[_0x145d('0x17')]=function(_0x4a6ef4,_0x2e0d83){_0x4a6ef4[_0x145d('0x18')]=_0x4a6ef4[_0x145d('0x19')];return client['Request']('MoveContactManagedDialer',{'body':_0x4a6ef4,'options':{'where':{'ContactId':_0x4a6ef4['ContactId'],'ListId':_0x4a6ef4[_0x145d('0x9')],'VoiceQueueId':_0x4a6ef4[_0x145d('0x1a')],'CampaignId':_0x4a6ef4[_0x145d('0xa')],'active':_0x2e0d83?undefined:!![]}},'log':_0x145d('0x1b')});};exports['countReScheduled']=function(_0x1a6cd2){return client[_0x145d('0x6')]('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0x1a6cd2['id']?_0x1a6cd2['id']||null:null}},'log':_0x145d('0x1c')});};exports['getContactPreview']=function(_0x5da646){return function(){return client[_0x145d('0x6')]('GetCmHopperPreview',{'options':{'where':{'id':_0x5da646},'include':[{'model':_0x145d('0x15'),'as':_0x145d('0x3')},{'model':_0x145d('0x1d'),'as':_0x145d('0x1e'),'attributes':['id',_0x145d('0x1f')]},{'model':_0x145d('0x20'),'as':_0x145d('0x21'),'attributes':['id','name']}],'raw':!![]},'log':_0x145d('0x4')});};};exports['unlockContact']=function(_0x1f1557,_0x5c97d0,_0x12b2a8){return client['Request'](_0x145d('0x7'),{'body':_0x1f1557,'options':{'where':{'id':_0x5c97d0},'limit':_0x12b2a8},'log':_0x145d('0x7')});};exports[_0x145d('0x22')]=function(_0x3a8a50,_0x19757f){return function(){return client[_0x145d('0x6')]('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x3a8a50,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x19757f}},'order':[[_0x145d('0x10'),_0x145d('0x11')],[_0x145d('0x12'),_0x145d('0x11')],['id',_0x145d('0x13')]],'include':[{'model':'CmContact','as':'Contact'},{'model':'User','as':_0x145d('0x1e'),'attributes':['id',_0x145d('0x1f'),_0x145d('0x23')]}],'group':_0x145d('0x24'),'raw':!![]},'log':_0x145d('0xf')});};};exports[_0x145d('0x25')]=function(_0x4546e4,_0x3eed82){return client[_0x145d('0x6')](_0x145d('0x26'),{'body':_0x4546e4,'options':_0x3eed82||{},'log':_0x145d('0x26')});};exports[_0x145d('0x27')]=function(_0x2dbd80,_0x1ac4a8,_0x5bbd45){return function(){return client[_0x145d('0x6')](_0x145d('0x28'),{'body':{'where':{'voiceQueueIds':_0x2dbd80,'interval':_0x1ac4a8,'availableAgentsIds':_0x5bbd45}},'log':_0x145d('0x27')});};}; \ No newline at end of file +var _0xd2bb=['DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','scheduledat','ASC','getContactDialerIvr','GetContactDialerIvr','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','CountReScheduled','GetCmHopperPreview','User','Agent','Queue','name','unlockContact','getContactRecallMe','GetContactRecallMe','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','moment','Request','GetCmHopper','CmContact','Contact','updateContacts','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','ListId','CampaignId','destroyContact'];(function(_0x36d00d,_0x33c55c){var _0x429560=function(_0x304678){while(--_0x304678){_0x36d00d['push'](_0x36d00d['shift']());}};_0x429560(++_0x33c55c);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x3dfa8a,_0x8d3a1c){_0x3dfa8a=_0x3dfa8a-0x0;var _0x5b223b=_0xd2bb[_0x3dfa8a];return _0x5b223b;};'use strict';var client=require('../client');var moment=require(_0xbd2b('0x0'));exports['getContacts']=function(_0x174f63,_0x1b0c46){return function(){return client[_0xbd2b('0x1')](_0xbd2b('0x2'),{'options':{'where':{'VoiceQueueId':_0x174f63},'include':[{'model':_0xbd2b('0x3'),'as':_0xbd2b('0x4')}],'limit':_0x1b0c46,'raw':![]},'log':'getCmHopper'});};};exports[_0xbd2b('0x5')]=function(_0x1d1447,_0xdcd8bd,_0x2f64a8){return function(){return client[_0xbd2b('0x1')](_0xbd2b('0x6'),{'body':_0x1d1447,'options':{'where':{'VoiceQueueId':_0xdcd8bd,'scheduledat':{'$lte':moment()[_0xbd2b('0x7')](_0xbd2b('0x8'))}},'limit':_0x2f64a8},'log':_0xbd2b('0x6')});};};exports[_0xbd2b('0x9')]=function(_0x4fd4f2){return client[_0xbd2b('0x1')]('UpdateCmHopper',{'body':_0x4fd4f2,'options':{'where':{'ContactId':_0x4fd4f2[_0xbd2b('0xa')],'ListId':_0x4fd4f2[_0xbd2b('0xb')],'VoiceQueueId':_0x4fd4f2['VoiceQueueId'],'CampaignId':_0x4fd4f2[_0xbd2b('0xc')]}},'log':_0xbd2b('0x9')});};exports[_0xbd2b('0xd')]=function(_0x27fdd2,_0x1009ac,_0x1e02b9){return function(){return client[_0xbd2b('0x1')](_0xbd2b('0xe'),{'options':{'where':{'VoiceQueueId':_0x27fdd2,'ListId':_0x1009ac,'ContactId':_0x1e02b9}},'log':'DestroyCmHopper'});};};exports[_0xbd2b('0xf')]=function(_0x16eb87,_0x44d283,_0x36916c,_0x29f3d1){return client['Request'](_0xbd2b('0x10'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x16eb87,'active':![],'scheduledat':{'$lte':moment()[_0xbd2b('0x7')](_0xbd2b('0x8'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x44d283}}]},'order':[[_0xbd2b('0x11'),_0xbd2b('0x12')],[_0xbd2b('0x13'),_0x29f3d1],['id',_0xbd2b('0x14')]],'raw':!![],'limit':_0x36916c},'log':_0xbd2b('0x10')});};exports[_0xbd2b('0x15')]=function(_0x571596,_0x1340a8,_0x268025){return client[_0xbd2b('0x1')](_0xbd2b('0x10'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x571596,'active':![],'scheduledat':{'$lte':moment()[_0xbd2b('0x7')](_0xbd2b('0x8'))}},'include':[{'model':_0xbd2b('0x3'),'as':_0xbd2b('0x4')}],'order':[[_0xbd2b('0x11'),_0xbd2b('0x12')],['scheduledat',_0x268025],['id',_0xbd2b('0x14')]],'raw':!![],'limit':_0x1340a8},'log':_0xbd2b('0x16')});};exports[_0xbd2b('0x17')]=function(_0x12d252,_0xc1ce31){_0x12d252[_0xbd2b('0x18')]=_0x12d252[_0xbd2b('0x19')];return client['Request']('MoveContactManagedDialer',{'body':_0x12d252,'options':{'where':{'ContactId':_0x12d252['ContactId'],'ListId':_0x12d252[_0xbd2b('0xb')],'VoiceQueueId':_0x12d252['VoiceQueueId'],'CampaignId':_0x12d252[_0xbd2b('0xc')],'active':_0xc1ce31?undefined:!![]}},'log':_0xbd2b('0x1a')});};exports['countReScheduled']=function(_0x5b6b31){return client[_0xbd2b('0x1')](_0xbd2b('0x1b'),{'options':{'where':{'VoiceQueueId':_0x5b6b31['id']?_0x5b6b31['id']||null:null}},'log':'countReScheduled'});};exports['getContactPreview']=function(_0x584fbd){return function(){return client[_0xbd2b('0x1')](_0xbd2b('0x1c'),{'options':{'where':{'id':_0x584fbd},'include':[{'model':_0xbd2b('0x3'),'as':_0xbd2b('0x4')},{'model':_0xbd2b('0x1d'),'as':_0xbd2b('0x1e'),'attributes':['id','name']},{'model':'VoiceQueue','as':_0xbd2b('0x1f'),'attributes':['id',_0xbd2b('0x20')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0xbd2b('0x21')]=function(_0x3e4b8c,_0x44a1ef,_0x3bd504){return client['Request'](_0xbd2b('0x6'),{'body':_0x3e4b8c,'options':{'where':{'id':_0x44a1ef},'limit':_0x3bd504},'log':'UpdateCmHopper'});};exports[_0xbd2b('0x22')]=function(_0x364755,_0x32d59c){return function(){return client[_0xbd2b('0x1')](_0xbd2b('0x23'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x364755,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xbd2b('0x7')](_0xbd2b('0x8'))},'UserId':{'$in':_0x32d59c}},'order':[['priority',_0xbd2b('0x12')],['scheduledat',_0xbd2b('0x12')],['id',_0xbd2b('0x14')]],'include':[{'model':'CmContact','as':'Contact'},{'model':_0xbd2b('0x1d'),'as':_0xbd2b('0x1e'),'attributes':['id',_0xbd2b('0x20'),_0xbd2b('0x24')]}],'group':_0xbd2b('0x25'),'raw':!![]},'log':'GetContactDialer'});};};exports[_0xbd2b('0x26')]=function(_0x42ea1a,_0x2ead2e){return client[_0xbd2b('0x1')](_0xbd2b('0x27'),{'body':_0x42ea1a,'options':_0x2ead2e||{},'log':_0xbd2b('0x27')});};exports[_0xbd2b('0x28')]=function(_0x502da1,_0x4346d2,_0x5c3e4b){return function(){return client['Request'](_0xbd2b('0x29'),{'body':{'where':{'voiceQueueIds':_0x502da1,'interval':_0x4346d2,'availableAgentsIds':_0x5c3e4b}},'log':_0xbd2b('0x28')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index c1701bf..a3aeb5f 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe293=['verifyAdditionalPhones','Request','VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters'];(function(_0x34df63,_0x40bd2f){var _0x391101=function(_0x167abf){while(--_0x167abf){_0x34df63['push'](_0x34df63['shift']());}};_0x391101(++_0x40bd2f);}(_0xe293,0x1b9));var _0x3e29=function(_0x34f545,_0x2bd2ee){_0x34f545=_0x34f545-0x0;var _0x1ff6b8=_0xe293[_0x34f545];return _0x1ff6b8;};'use strict';var client=require('../client');exports[_0x3e29('0x0')]=function(_0x230746,_0x4b4342,_0x47dda0){return client[_0x3e29('0x1')](_0x3e29('0x2'),{'body':_0x230746,'reason':_0x4b4342,'entity':_0x47dda0,'log':_0x3e29('0x2')});};exports[_0x3e29('0x3')]=function(_0x4966d0,_0x1b843e,_0x2cff42){return client[_0x3e29('0x1')](_0x3e29('0x4'),{'body':_0x4966d0,'duration':_0x1b843e,'waitTime':_0x2cff42,'log':'SwapAdditionalPhones'});};exports[_0x3e29('0x5')]=function(_0x259562){return function(){return client[_0x3e29('0x1')](_0x3e29('0x6'),{'body':_0x259562,'log':_0x3e29('0x6')});};}; \ No newline at end of file +var _0x6d4e=['SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client','Request','VerifyAdditionalPhones','swapAdditionalPhones'];(function(_0x218051,_0x201297){var _0x14a7de=function(_0x3d06e0){while(--_0x3d06e0){_0x218051['push'](_0x218051['shift']());}};_0x14a7de(++_0x201297);}(_0x6d4e,0x18b));var _0xe6d4=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6d4e[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0xe6d4('0x0'));exports['verifyAdditionalPhones']=function(_0x8d7567,_0x45cb10,_0x1180a8){return client[_0xe6d4('0x1')](_0xe6d4('0x2'),{'body':_0x8d7567,'reason':_0x45cb10,'entity':_0x1180a8,'log':_0xe6d4('0x2')});};exports[_0xe6d4('0x3')]=function(_0x6d02ee,_0x3dd250,_0x7ff339){return client[_0xe6d4('0x1')](_0xe6d4('0x4'),{'body':_0x6d02ee,'duration':_0x3dd250,'waitTime':_0x7ff339,'log':'SwapAdditionalPhones'});};exports[_0xe6d4('0x5')]=function(_0xd62f7e){return function(){return client[_0xe6d4('0x1')]('IncrementPreviewCounters',{'body':_0xd62f7e,'log':_0xe6d4('0x6')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index 6fa45a1..053a68d 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfa2=['checkIsBlackList','Request','GetCmHopperBlack','VoiceQueueId','phone','CampaignId','GetCmHopperBlackIvr','../client'];(function(_0x57fa33,_0x2b8222){var _0x12e724=function(_0x481a33){while(--_0x481a33){_0x57fa33['push'](_0x57fa33['shift']());}};_0x12e724(++_0x2b8222);}(_0xdfa2,0x1a7));var _0x2dfa=function(_0xe63e61,_0x30d407){_0xe63e61=_0xe63e61-0x0;var _0x35ca43=_0xdfa2[_0xe63e61];return _0x35ca43;};'use strict';var client=require(_0x2dfa('0x0'));exports[_0x2dfa('0x1')]=function(_0x3a2f9d){return client[_0x2dfa('0x2')](_0x2dfa('0x3'),{'options':{'where':{'VoiceQueueId':_0x3a2f9d[_0x2dfa('0x4')],'phone':_0x3a2f9d[_0x2dfa('0x5')]},'raw':![]},'log':'GetCmHopperBlack'});};exports['checkIsBlackListIvr']=function(_0x374f7a){return client[_0x2dfa('0x2')](_0x2dfa('0x3'),{'options':{'where':{'CampaignId':_0x374f7a[_0x2dfa('0x6')],'phone':_0x374f7a[_0x2dfa('0x5')]},'raw':![]},'log':_0x2dfa('0x7')});}; \ No newline at end of file +var _0x41e7=['checkIsBlackListIvr','Request','CampaignId','GetCmHopperBlackIvr','../client','checkIsBlackList','GetCmHopperBlack','phone'];(function(_0x64de0c,_0x353ff8){var _0x4e835b=function(_0x35d2fe){while(--_0x35d2fe){_0x64de0c['push'](_0x64de0c['shift']());}};_0x4e835b(++_0x353ff8);}(_0x41e7,0x8c));var _0x741e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x41e7[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0x741e('0x0'));exports[_0x741e('0x1')]=function(_0x5f5466){return client['Request'](_0x741e('0x2'),{'options':{'where':{'VoiceQueueId':_0x5f5466['VoiceQueueId'],'phone':_0x5f5466[_0x741e('0x3')]},'raw':![]},'log':'GetCmHopperBlack'});};exports[_0x741e('0x4')]=function(_0x14defc){return client[_0x741e('0x5')](_0x741e('0x2'),{'options':{'where':{'CampaignId':_0x14defc[_0x741e('0x6')],'phone':_0x14defc[_0x741e('0x3')]},'raw':![]},'log':_0x741e('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index a90eac3..9c99a5b 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7d3=['queue','Request','CreateCmHopperFinal','createContact','campaign'];(function(_0x1e3ca6,_0x5d6751){var _0x4172e5=function(_0x48eced){while(--_0x48eced){_0x1e3ca6['push'](_0x1e3ca6['shift']());}};_0x4172e5(++_0x5d6751);}(_0xb7d3,0x152));var _0x3b7d=function(_0x36b261,_0x504c02){_0x36b261=_0x36b261-0x0;var _0x2cf069=_0xb7d3[_0x36b261];return _0x2cf069;};'use strict';var client=require('../client');exports[_0x3b7d('0x0')]=function(_0x2ad2ee){return function(){_0x2ad2ee[_0x3b7d('0x1')]=_0x2ad2ee[_0x3b7d('0x2')];return client[_0x3b7d('0x3')](_0x3b7d('0x4'),{'body':_0x2ad2ee,'log':_0x3b7d('0x4')});};}; \ No newline at end of file +var _0x5c86=['queue','CreateCmHopperFinal','../client','createContact'];(function(_0xe947ae,_0x4e10b0){var _0x5b2881=function(_0x491204){while(--_0x491204){_0xe947ae['push'](_0xe947ae['shift']());}};_0x5b2881(++_0x4e10b0);}(_0x5c86,0x1a6));var _0x65c8=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5c86[_0x397e5f];return _0x5302b8;};'use strict';var client=require(_0x65c8('0x0'));exports[_0x65c8('0x1')]=function(_0x42da65){return function(){_0x42da65['campaign']=_0x42da65[_0x65c8('0x2')];return client['Request'](_0x65c8('0x3'),{'body':_0x42da65,'log':_0x65c8('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index 580e21b..aaa49e1 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x63cb=['getCampaignHopperHistory','GetCampaignHopperHistory','day','ivr','../client','moment','createHistory','campaign','queue','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','subtract','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','GetVoiceQueueHopperHistory','startOf','endOf'];(function(_0x5e1d32,_0x305ff8){var _0x579676=function(_0x2b899c){while(--_0x2b899c){_0x5e1d32['push'](_0x5e1d32['shift']());}};_0x579676(++_0x305ff8);}(_0x63cb,0x158));var _0xb63c=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0x63cb[_0x1a89a1];return _0x3d5b46;};'use strict';var client=require(_0xb63c('0x0'));var moment=require(_0xb63c('0x1'));exports[_0xb63c('0x2')]=function(_0x2a41d7){_0x2a41d7[_0xb63c('0x3')]=_0x2a41d7[_0xb63c('0x4')];return client[_0xb63c('0x5')](_0xb63c('0x6'),{'body':_0x2a41d7,'log':_0xb63c('0x6')});};exports[_0xb63c('0x7')]=function(_0x109383){return client[_0xb63c('0x5')](_0xb63c('0x8'),{'options':{'where':{'endtime':{'$between':[moment()[_0xb63c('0x9')](_0x109383,'minutes')[_0xb63c('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xb63c('0xa')](_0xb63c('0xb'))]}},'raw':![]},'log':_0xb63c('0xc')});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client[_0xb63c('0x5')](_0xb63c('0xd'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xb63c('0xe')]('day')[_0xb63c('0xa')](_0xb63c('0xb')),moment()[_0xb63c('0xf')]('day')[_0xb63c('0xa')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0xb63c('0x4')},'raw':![]},'log':_0xb63c('0xd')});};};exports[_0xb63c('0x10')]=function(){return function(){return client[_0xb63c('0x5')](_0xb63c('0x11'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xb63c('0xe')](_0xb63c('0x12'))[_0xb63c('0xa')](_0xb63c('0xb')),moment()[_0xb63c('0xf')](_0xb63c('0x12'))[_0xb63c('0xa')](_0xb63c('0xb'))]},'campaigntype':_0xb63c('0x13')},'raw':![]},'log':_0xb63c('0x11')});};}; \ No newline at end of file +var _0x5131=['GetVoiceQueueHopperHistory','startOf','day','endOf','getCampaignHopperHistory','GetCampaignHopperHistory','../client','createHistory','campaign','queue','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5131,0xde));var _0x1513=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x5131[_0x160c73];return _0xd9302;};'use strict';var client=require(_0x1513('0x0'));var moment=require('moment');exports[_0x1513('0x1')]=function(_0x8cc980){_0x8cc980[_0x1513('0x2')]=_0x8cc980[_0x1513('0x3')];return client[_0x1513('0x4')](_0x1513('0x5'),{'body':_0x8cc980,'log':_0x1513('0x5')});};exports[_0x1513('0x6')]=function(_0x339648){return client[_0x1513('0x4')](_0x1513('0x7'),{'options':{'where':{'endtime':{'$between':[moment()['subtract'](_0x339648,_0x1513('0x8'))[_0x1513('0x9')](_0x1513('0xa')),moment()[_0x1513('0x9')]('YYYY-MM-DD\x20HH:mm:ss')]}},'raw':![]},'log':_0x1513('0xb')});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client[_0x1513('0x4')](_0x1513('0xc'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x1513('0xd')](_0x1513('0xe'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x1513('0xf')](_0x1513('0xe'))[_0x1513('0x9')](_0x1513('0xa'))]},'campaigntype':_0x1513('0x3')},'raw':![]},'log':_0x1513('0xc')});};};exports[_0x1513('0x10')]=function(){return function(){return client[_0x1513('0x4')](_0x1513('0x11'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x1513('0xe'))[_0x1513('0x9')](_0x1513('0xa')),moment()[_0x1513('0xf')](_0x1513('0xe'))[_0x1513('0x9')](_0x1513('0xa'))]},'campaigntype':'ivr'},'raw':![]},'log':_0x1513('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index 9b919b8..5eb6b16 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd117=['maxrate','modem','gateway','faxdetect','t38timeout','tech','ListId','key','Trunk','callerid','active','notify','../client','getFaxAccounts','Request','GetFaxAccount','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0xd117,0x182));var _0x7d11=function(_0x39cf70,_0x3ec55b){_0x39cf70=_0x39cf70-0x0;var _0x580424=_0xd117[_0x39cf70];return _0x580424;};'use strict';var client=require(_0x7d11('0x0'));exports[_0x7d11('0x1')]=function(){return function(){return client[_0x7d11('0x2')](_0x7d11('0x3'),{'options':{'raw':![],'attributes':['id',_0x7d11('0x4'),_0x7d11('0x5'),_0x7d11('0x6'),_0x7d11('0x7'),_0x7d11('0x8'),_0x7d11('0x9'),_0x7d11('0xa'),_0x7d11('0xb'),_0x7d11('0xc'),_0x7d11('0xd'),_0x7d11('0xe'),_0x7d11('0xf'),'TrunkId',_0x7d11('0x10'),_0x7d11('0x11')],'include':[{'model':_0x7d11('0x12'),'as':'Trunk','attributes':['id',_0x7d11('0x4'),_0x7d11('0x13'),_0x7d11('0x14')]}]},'log':'getFaxAccount'});};};exports[_0x7d11('0x15')]=function(_0x48b0f1,_0x58a6fd){return client[_0x7d11('0x2')]('NotifyFaxAccount',{'account':{'id':_0x48b0f1},'body':_0x58a6fd,'log':'NotifyFaxAccount'});}; \ No newline at end of file +var _0x5386=['Request','GetFaxAccount','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','t38timeout','TrunkId','ListId','key','Trunk','name','callerid','active','getFaxAccount','notify','NotifyFaxAccount','../client','getFaxAccounts'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x5386,0x1e1));var _0x6538=function(_0x5ab5bd,_0x12c446){_0x5ab5bd=_0x5ab5bd-0x0;var _0x3dddd8=_0x5386[_0x5ab5bd];return _0x3dddd8;};'use strict';var client=require(_0x6538('0x0'));exports[_0x6538('0x1')]=function(){return function(){return client[_0x6538('0x2')](_0x6538('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x6538('0x4'),_0x6538('0x5'),_0x6538('0x6'),_0x6538('0x7'),_0x6538('0x8'),_0x6538('0x9'),_0x6538('0xa'),_0x6538('0xb'),'faxdetect',_0x6538('0xc'),'tech',_0x6538('0xd'),_0x6538('0xe'),_0x6538('0xf')],'include':[{'model':_0x6538('0x10'),'as':_0x6538('0x10'),'attributes':['id',_0x6538('0x11'),_0x6538('0x12'),_0x6538('0x13')]}]},'log':_0x6538('0x14')});};};exports[_0x6538('0x15')]=function(_0x486dd8,_0x258d23){return client[_0x6538('0x2')](_0x6538('0x16'),{'account':{'id':_0x486dd8},'body':_0x258d23,'log':'NotifyFaxAccount'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index f244f8f..688b9ce 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x316b=['UpdateFaxMessage','../client','update','Request'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x316b,0x159));var _0xb316=function(_0x558e45,_0x4f5e4f){_0x558e45=_0x558e45-0x0;var _0x3e9075=_0x316b[_0x558e45];return _0x3e9075;};'use strict';var client=require(_0xb316('0x0'));exports[_0xb316('0x1')]=function(_0x3c5eb5,_0x264129){return client[_0xb316('0x2')](_0xb316('0x3'),{'body':_0x264129,'options':{'where':{'AttachmentId':_0x3c5eb5}},'log':_0xb316('0x3')});}; \ No newline at end of file +var _0xb972=['../client','UpdateFaxMessage'];(function(_0x5f4cd3,_0x54f607){var _0x274d00=function(_0x17b11e){while(--_0x17b11e){_0x5f4cd3['push'](_0x5f4cd3['shift']());}};_0x274d00(++_0x54f607);}(_0xb972,0x1a8));var _0x2b97=function(_0x57f100,_0xa53aca){_0x57f100=_0x57f100-0x0;var _0x4cac01=_0xb972[_0x57f100];return _0x4cac01;};'use strict';var client=require(_0x2b97('0x0'));exports['update']=function(_0x1866b3,_0x1243f6){return client['Request']('UpdateFaxMessage',{'body':_0x1243f6,'options':{'where':{'AttachmentId':_0x1866b3}},'log':_0x2b97('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index c196c58..b56a33a 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa59d=['GetDeskAccount','../../client','getDeskAccounts','Request','name','description','password','authType','type','Configurations','DeskField','variableName','Variable','content','key','keyType','keyContent','Fields','nameField','customField','Tag','Tags'];(function(_0x31c779,_0x49507c){var _0x127f2a=function(_0x526129){while(--_0x526129){_0x31c779['push'](_0x31c779['shift']());}};_0x127f2a(++_0x49507c);}(_0xa59d,0x161));var _0xda59=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa59d[_0x2641f9];return _0x585741;};'use strict';var client=require(_0xda59('0x0'));exports[_0xda59('0x1')]=function(){return function(_0x25a303){return client[_0xda59('0x2')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0xda59('0x3'),_0xda59('0x4'),'username',_0xda59('0x5'),'remoteUri',_0xda59('0x6'),_0xda59('0x7'),'serverUrl'],'include':[{'model':'DeskConfiguration','as':_0xda59('0x8'),'attributes':['id','name'],'include':[{'model':_0xda59('0x9'),'as':'Subjects','attributes':['id','type','content',_0xda59('0xa')],'include':[{'model':_0xda59('0xb'),'as':_0xda59('0xb'),'attributes':['id',_0xda59('0x3')]}]},{'model':_0xda59('0x9'),'as':'Descriptions','attributes':['id','type',_0xda59('0xc'),_0xda59('0xd'),_0xda59('0xe'),_0xda59('0xf'),'variableName'],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0xda59('0x9'),'as':_0xda59('0x10'),'attributes':['id','type','content','idField',_0xda59('0x11'),_0xda59('0x12'),'variableName'],'include':[{'model':'Variable','as':_0xda59('0xb'),'attributes':['id',_0xda59('0x3')]}]},{'model':_0xda59('0x13'),'as':_0xda59('0x14'),'attributes':['id','name']}]}]},'log':_0xda59('0x15')});};}; \ No newline at end of file +var _0xa7a6=['keyContent','Fields','idField','nameField','Tag','Request','GetDeskAccount','description','username','password','remoteUri','type','serverUrl','DeskConfiguration','Configurations','name','content','variableName','Variable','DeskField','Descriptions','key'];(function(_0x4f0dd5,_0xb24b6e){var _0x4dfcaf=function(_0x4fda65){while(--_0x4fda65){_0x4f0dd5['push'](_0x4f0dd5['shift']());}};_0x4dfcaf(++_0xb24b6e);}(_0xa7a6,0x73));var _0x6a7a=function(_0x76ea4a,_0x24a09d){_0x76ea4a=_0x76ea4a-0x0;var _0x5484b2=_0xa7a6[_0x76ea4a];return _0x5484b2;};'use strict';var client=require('../../client');exports['getDeskAccounts']=function(){return function(_0x1a4461){return client[_0x6a7a('0x0')](_0x6a7a('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x6a7a('0x2'),_0x6a7a('0x3'),_0x6a7a('0x4'),_0x6a7a('0x5'),'authType',_0x6a7a('0x6'),_0x6a7a('0x7')],'include':[{'model':_0x6a7a('0x8'),'as':_0x6a7a('0x9'),'attributes':['id',_0x6a7a('0xa')],'include':[{'model':'DeskField','as':'Subjects','attributes':['id',_0x6a7a('0x6'),_0x6a7a('0xb'),_0x6a7a('0xc')],'include':[{'model':_0x6a7a('0xd'),'as':_0x6a7a('0xd'),'attributes':['id','name']}]},{'model':_0x6a7a('0xe'),'as':_0x6a7a('0xf'),'attributes':['id',_0x6a7a('0x6'),_0x6a7a('0xb'),_0x6a7a('0x10'),'keyType',_0x6a7a('0x11'),_0x6a7a('0xc')],'include':[{'model':_0x6a7a('0xd'),'as':_0x6a7a('0xd'),'attributes':['id',_0x6a7a('0xa')]}]},{'model':'DeskField','as':_0x6a7a('0x12'),'attributes':['id','type',_0x6a7a('0xb'),_0x6a7a('0x13'),_0x6a7a('0x14'),'customField',_0x6a7a('0xc')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x6a7a('0xa')]}]},{'model':_0x6a7a('0x15'),'as':'Tags','attributes':['id','name']}]}]},'log':'GetDeskAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index 4b64d9c..97b0c06 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b7f=['Configurations','ticketType','moduleCreate','additionalSearchContact','Dynamics365Field','variableName','Descriptions','type','content','key','keyType','keyContent','Variable','Fields','idField','nameField','customField','CloudProvider','data5','data7','GetDynamics365Account','../../client','getDynamics365Accounts','Request','name','username','password','clientId','clientSecret','serverUrl','description','modernAuthentication'];(function(_0x2f5136,_0x5bb29a){var _0x42376f=function(_0xe4477c){while(--_0xe4477c){_0x2f5136['push'](_0x2f5136['shift']());}};_0x42376f(++_0x5bb29a);}(_0x0b7f,0x115));var _0xf0b7=function(_0x3bd7c5,_0x272ae9){_0x3bd7c5=_0x3bd7c5-0x0;var _0x423e00=_0x0b7f[_0x3bd7c5];return _0x423e00;};'use strict';var client=require(_0xf0b7('0x0'));exports[_0xf0b7('0x1')]=function(){return function(_0x5ba867){return client[_0xf0b7('0x2')]('GetDynamics365Account',{'options':{'raw':![],'attributes':['id',_0xf0b7('0x3'),_0xf0b7('0x4'),_0xf0b7('0x5'),'remoteUri','tenantId',_0xf0b7('0x6'),_0xf0b7('0x7'),_0xf0b7('0x8'),_0xf0b7('0x9'),_0xf0b7('0xa')],'include':[{'model':'Dynamics365Configuration','as':_0xf0b7('0xb'),'attributes':['id',_0xf0b7('0x3'),_0xf0b7('0xc'),_0xf0b7('0xd'),_0xf0b7('0xe'),'openNewTab'],'include':[{'model':_0xf0b7('0xf'),'as':'Subjects','attributes':['id','type','content',_0xf0b7('0x10')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0xf0b7('0x3')]}]},{'model':_0xf0b7('0xf'),'as':_0xf0b7('0x11'),'attributes':['id',_0xf0b7('0x12'),_0xf0b7('0x13'),_0xf0b7('0x14'),_0xf0b7('0x15'),_0xf0b7('0x16'),'variableName'],'include':[{'model':'Variable','as':_0xf0b7('0x17'),'attributes':['id',_0xf0b7('0x3')]}]},{'model':_0xf0b7('0xf'),'as':_0xf0b7('0x18'),'attributes':['id',_0xf0b7('0x12'),'content',_0xf0b7('0x19'),_0xf0b7('0x1a'),_0xf0b7('0x1b'),_0xf0b7('0x10')],'include':[{'model':'Variable','as':_0xf0b7('0x17'),'attributes':['id',_0xf0b7('0x3')]}]}]},{'model':_0xf0b7('0x1c'),'as':_0xf0b7('0x1c'),'attributes':['id','data2',_0xf0b7('0x1d'),_0xf0b7('0x1e')]}]},'log':_0xf0b7('0x1f')});};}; \ No newline at end of file +var _0xa149=['idField','nameField','customField','CloudProvider','data2','data5','../../client','getDynamics365Accounts','Request','GetDynamics365Account','name','username','password','remoteUri','clientId','clientSecret','description','modernAuthentication','Dynamics365Configuration','Configurations','ticketType','additionalSearchContact','Dynamics365Field','Subjects','type','content','variableName','Variable','keyType','Fields'];(function(_0xfb8559,_0x3a916a){var _0x4bf667=function(_0x4de75f){while(--_0x4de75f){_0xfb8559['push'](_0xfb8559['shift']());}};_0x4bf667(++_0x3a916a);}(_0xa149,0x18c));var _0x9a14=function(_0x16da2a,_0x5ac084){_0x16da2a=_0x16da2a-0x0;var _0xa76b5a=_0xa149[_0x16da2a];return _0xa76b5a;};'use strict';var client=require(_0x9a14('0x0'));exports[_0x9a14('0x1')]=function(){return function(_0x2e9626){return client[_0x9a14('0x2')](_0x9a14('0x3'),{'options':{'raw':![],'attributes':['id',_0x9a14('0x4'),_0x9a14('0x5'),_0x9a14('0x6'),_0x9a14('0x7'),'tenantId',_0x9a14('0x8'),_0x9a14('0x9'),'serverUrl',_0x9a14('0xa'),_0x9a14('0xb')],'include':[{'model':_0x9a14('0xc'),'as':_0x9a14('0xd'),'attributes':['id',_0x9a14('0x4'),_0x9a14('0xe'),'moduleCreate',_0x9a14('0xf'),'openNewTab'],'include':[{'model':_0x9a14('0x10'),'as':_0x9a14('0x11'),'attributes':['id',_0x9a14('0x12'),_0x9a14('0x13'),_0x9a14('0x14')],'include':[{'model':_0x9a14('0x15'),'as':'Variable','attributes':['id','name']}]},{'model':'Dynamics365Field','as':'Descriptions','attributes':['id',_0x9a14('0x12'),_0x9a14('0x13'),'key',_0x9a14('0x16'),'keyContent',_0x9a14('0x14')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x9a14('0x4')]}]},{'model':_0x9a14('0x10'),'as':_0x9a14('0x17'),'attributes':['id',_0x9a14('0x12'),'content',_0x9a14('0x18'),_0x9a14('0x19'),_0x9a14('0x1a'),_0x9a14('0x14')],'include':[{'model':_0x9a14('0x15'),'as':_0x9a14('0x15'),'attributes':['id',_0x9a14('0x4')]}]}]},{'model':_0x9a14('0x1b'),'as':_0x9a14('0x1b'),'attributes':['id',_0x9a14('0x1c'),_0x9a14('0x1d'),'data7']}]},'log':'GetDynamics365Account'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index e9c3e53..83e2b7f 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8130=['keyType','nameField','../../client','getFreshdeskAccounts','Request','GetFreshdeskAccount','name','username','apiKey','remoteUri','FreshdeskConfiguration','Tag','FreshdeskField','Subjects','type','content','variableName','Variable'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x8130,0x146));var _0x0813=function(_0x458d58,_0x3f454f){_0x458d58=_0x458d58-0x0;var _0xd6788e=_0x8130[_0x458d58];return _0xd6788e;};'use strict';var client=require(_0x0813('0x0'));exports[_0x0813('0x1')]=function(){return function(_0x5038a7){return client[_0x0813('0x2')](_0x0813('0x3'),{'options':{'raw':![],'attributes':['id',_0x0813('0x4'),_0x0813('0x5'),_0x0813('0x6'),_0x0813('0x7'),'serverUrl'],'include':[{'model':_0x0813('0x8'),'as':'Configurations','attributes':['id','name'],'include':[{'model':_0x0813('0x9'),'attributes':['id',_0x0813('0x4')]},{'model':_0x0813('0xa'),'as':_0x0813('0xb'),'attributes':['id',_0x0813('0xc'),_0x0813('0xd'),_0x0813('0xe')],'include':[{'model':'Variable','as':_0x0813('0xf'),'attributes':['id',_0x0813('0x4')]}]},{'model':_0x0813('0xa'),'as':'Descriptions','attributes':['id','type',_0x0813('0xd'),'key',_0x0813('0x10'),'keyContent',_0x0813('0xe')],'include':[{'model':_0x0813('0xf'),'as':_0x0813('0xf'),'attributes':['id',_0x0813('0x4')]}]},{'model':'FreshdeskField','as':'Fields','attributes':['id',_0x0813('0xc'),_0x0813('0xd'),'idField',_0x0813('0x11'),'customField','variableName'],'include':[{'model':_0x0813('0xf'),'as':_0x0813('0xf'),'attributes':['id','name']}]}]}]},'log':_0x0813('0x3')});};}; \ No newline at end of file +var _0x9780=['keyType','keyContent','Fields','idField','nameField','customField','Request','GetFreshdeskAccount','name','username','apiKey','remoteUri','serverUrl','FreshdeskConfiguration','Configurations','FreshdeskField','Subjects','type','content','variableName','Variable','Descriptions'];(function(_0x47a072,_0x29fe63){var _0x4b4322=function(_0x5dcee1){while(--_0x5dcee1){_0x47a072['push'](_0x47a072['shift']());}};_0x4b4322(++_0x29fe63);}(_0x9780,0x1d4));var _0x0978=function(_0x5ee823,_0x24650b){_0x5ee823=_0x5ee823-0x0;var _0x209bd2=_0x9780[_0x5ee823];return _0x209bd2;};'use strict';var client=require('../../client');exports['getFreshdeskAccounts']=function(){return function(_0x1a129d){return client[_0x0978('0x0')](_0x0978('0x1'),{'options':{'raw':![],'attributes':['id',_0x0978('0x2'),_0x0978('0x3'),_0x0978('0x4'),_0x0978('0x5'),_0x0978('0x6')],'include':[{'model':_0x0978('0x7'),'as':_0x0978('0x8'),'attributes':['id',_0x0978('0x2')],'include':[{'model':'Tag','attributes':['id',_0x0978('0x2')]},{'model':_0x0978('0x9'),'as':_0x0978('0xa'),'attributes':['id',_0x0978('0xb'),_0x0978('0xc'),_0x0978('0xd')],'include':[{'model':_0x0978('0xe'),'as':_0x0978('0xe'),'attributes':['id',_0x0978('0x2')]}]},{'model':_0x0978('0x9'),'as':_0x0978('0xf'),'attributes':['id','type',_0x0978('0xc'),'key',_0x0978('0x10'),_0x0978('0x11'),_0x0978('0xd')],'include':[{'model':_0x0978('0xe'),'as':'Variable','attributes':['id',_0x0978('0x2')]}]},{'model':'FreshdeskField','as':_0x0978('0x12'),'attributes':['id',_0x0978('0xb'),_0x0978('0xc'),_0x0978('0x13'),_0x0978('0x14'),_0x0978('0x15'),_0x0978('0xd')],'include':[{'model':_0x0978('0xe'),'as':'Variable','attributes':['id',_0x0978('0x2')]}]}]}]},'log':_0x0978('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index 0dbe9fd..1efcc18 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x126e=['GetFreshsalesAccount','name','username','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField','Subjects','content','variableName','Variable','Descriptions','type','key','keyType','GetFreshsalesccount','getFreshsalesAccounts','Request'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x126e,0x108));var _0xe126=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x126e[_0x334841];return _0x5beb4b;};'use strict';var client=require('../../client');exports[_0xe126('0x0')]=function(){return function(_0x26dc1b){return client[_0xe126('0x1')](_0xe126('0x2'),{'options':{'raw':![],'attributes':['id',_0xe126('0x3'),_0xe126('0x4'),'apiKey',_0xe126('0x5'),_0xe126('0x6')],'include':[{'model':_0xe126('0x7'),'as':_0xe126('0x8'),'attributes':['id',_0xe126('0x3')],'include':[{'model':_0xe126('0x9'),'as':_0xe126('0xa'),'attributes':['id','type',_0xe126('0xb'),_0xe126('0xc')],'include':[{'model':_0xe126('0xd'),'as':_0xe126('0xd'),'attributes':['id',_0xe126('0x3')]}]},{'model':'FreshsalesField','as':_0xe126('0xe'),'attributes':['id',_0xe126('0xf'),'content',_0xe126('0x10'),_0xe126('0x11'),'keyContent',_0xe126('0xc')],'include':[{'model':'Variable','as':_0xe126('0xd'),'attributes':['id','name']}]}]}]},'log':_0xe126('0x12')});};}; \ No newline at end of file +var _0xfcf0=['Subjects','type','variableName','Variable','Descriptions','key','keyContent','GetFreshsalesccount','../../client','getFreshsalesAccounts','Request','GetFreshsalesAccount','name','username','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField'];(function(_0x20a137,_0x4d9549){var _0x3dc414=function(_0x21179b){while(--_0x21179b){_0x20a137['push'](_0x20a137['shift']());}};_0x3dc414(++_0x4d9549);}(_0xfcf0,0x138));var _0x0fcf=function(_0x22093a,_0xa7acf1){_0x22093a=_0x22093a-0x0;var _0x2f4989=_0xfcf0[_0x22093a];return _0x2f4989;};'use strict';var client=require(_0x0fcf('0x0'));exports[_0x0fcf('0x1')]=function(){return function(_0x575167){return client[_0x0fcf('0x2')](_0x0fcf('0x3'),{'options':{'raw':![],'attributes':['id',_0x0fcf('0x4'),_0x0fcf('0x5'),'apiKey',_0x0fcf('0x6'),_0x0fcf('0x7')],'include':[{'model':_0x0fcf('0x8'),'as':_0x0fcf('0x9'),'attributes':['id',_0x0fcf('0x4')],'include':[{'model':_0x0fcf('0xa'),'as':_0x0fcf('0xb'),'attributes':['id',_0x0fcf('0xc'),'content',_0x0fcf('0xd')],'include':[{'model':_0x0fcf('0xe'),'as':_0x0fcf('0xe'),'attributes':['id','name']}]},{'model':_0x0fcf('0xa'),'as':_0x0fcf('0xf'),'attributes':['id',_0x0fcf('0xc'),'content',_0x0fcf('0x10'),'keyType',_0x0fcf('0x11'),_0x0fcf('0xd')],'include':[{'model':_0x0fcf('0xe'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0x0fcf('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index 6b37e8c..7a391ac 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0936=['additionalSearchLead','SalesforceField','Subjects','Descriptions','Variable','Fields','../../client','getSalesforceAccounts','Request','GetSalesforceAccount','name','username','clientId','clientSecret','securityToken','serverUrl','type','SalesforceConfiguration','Configurations','moduleCreate','ticketType','leadId','additionalSearchAccount','additionalSearchContact'];(function(_0x456f35,_0x124842){var _0x2e65dd=function(_0x39e30c){while(--_0x39e30c){_0x456f35['push'](_0x456f35['shift']());}};_0x2e65dd(++_0x124842);}(_0x0936,0xde));var _0x6093=function(_0x2b1482,_0x12b1de){_0x2b1482=_0x2b1482-0x0;var _0x5f1fe0=_0x0936[_0x2b1482];return _0x5f1fe0;};'use strict';var client=require(_0x6093('0x0'));exports[_0x6093('0x1')]=function(){return function(_0x27ddbd){return client[_0x6093('0x2')](_0x6093('0x3'),{'options':{'raw':![],'attributes':['id',_0x6093('0x4'),_0x6093('0x5'),'password','remoteUri',_0x6093('0x6'),_0x6093('0x7'),_0x6093('0x8'),_0x6093('0x9'),_0x6093('0xa')],'include':[{'model':_0x6093('0xb'),'as':_0x6093('0xc'),'attributes':['id','name','moduleSearch',_0x6093('0xd'),_0x6093('0xe'),_0x6093('0xf'),_0x6093('0x10'),_0x6093('0x11'),_0x6093('0x12')],'include':[{'model':_0x6093('0x13'),'as':_0x6093('0x14'),'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x6093('0x4')]}]},{'model':_0x6093('0x13'),'as':_0x6093('0x15'),'include':[{'model':_0x6093('0x16'),'as':_0x6093('0x16'),'attributes':['id',_0x6093('0x4')]}]},{'model':_0x6093('0x13'),'as':_0x6093('0x17'),'include':[{'model':_0x6093('0x16'),'as':_0x6093('0x16'),'attributes':['id',_0x6093('0x4')]}]}]}]},'log':_0x6093('0x3')});};}; \ No newline at end of file +var _0x268c=['leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead','SalesforceField','Subjects','Variable','Descriptions','../../client','GetSalesforceAccount','password','clientId','clientSecret','securityToken','serverUrl','Configurations','name','moduleCreate','ticketType'];(function(_0x479416,_0x4b6328){var _0x1ae1f3=function(_0xfaca6d){while(--_0xfaca6d){_0x479416['push'](_0x479416['shift']());}};_0x1ae1f3(++_0x4b6328);}(_0x268c,0xb3));var _0xc268=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0x268c[_0x4191bc];return _0x1ffd4e;};'use strict';var client=require(_0xc268('0x0'));exports['getSalesforceAccounts']=function(){return function(_0x1ecac7){return client['Request'](_0xc268('0x1'),{'options':{'raw':![],'attributes':['id','name','username',_0xc268('0x2'),'remoteUri',_0xc268('0x3'),_0xc268('0x4'),_0xc268('0x5'),_0xc268('0x6'),'type'],'include':[{'model':'SalesforceConfiguration','as':_0xc268('0x7'),'attributes':['id',_0xc268('0x8'),'moduleSearch',_0xc268('0x9'),_0xc268('0xa'),_0xc268('0xb'),_0xc268('0xc'),_0xc268('0xd'),_0xc268('0xe')],'include':[{'model':_0xc268('0xf'),'as':_0xc268('0x10'),'include':[{'model':_0xc268('0x11'),'as':_0xc268('0x11'),'attributes':['id',_0xc268('0x8')]}]},{'model':_0xc268('0xf'),'as':_0xc268('0x12'),'include':[{'model':_0xc268('0x11'),'as':'Variable','attributes':['id',_0xc268('0x8')]}]},{'model':_0xc268('0xf'),'as':'Fields','include':[{'model':_0xc268('0x11'),'as':_0xc268('0x11'),'attributes':['id',_0xc268('0x8')]}]}]}]},'log':_0xc268('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index 9f87695..7715aa3 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6ac=['GetServicenowAccount','name','description','username','password','email','remoteUri','serverUrl','ServicenowConfiguration','Configurations','ServicenowField','Subjects','type','variableName','Variable','content','key','keyContent','Fields','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts','Request'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x2e4d4d,_0x4e1a24){_0x2e4d4d=_0x2e4d4d-0x0;var _0x2a6141=_0xc6ac[_0x2e4d4d];return _0x2a6141;};'use strict';var client=require(_0xcc6a('0x0'));exports[_0xcc6a('0x1')]=function(){return function(_0x1b6e92){return client[_0xcc6a('0x2')](_0xcc6a('0x3'),{'options':{'raw':![],'attributes':['id',_0xcc6a('0x4'),_0xcc6a('0x5'),_0xcc6a('0x6'),_0xcc6a('0x7'),_0xcc6a('0x8'),_0xcc6a('0x9'),_0xcc6a('0xa')],'include':[{'model':_0xcc6a('0xb'),'as':_0xcc6a('0xc'),'attributes':['id','name'],'include':[{'model':_0xcc6a('0xd'),'as':_0xcc6a('0xe'),'attributes':['id',_0xcc6a('0xf'),'content',_0xcc6a('0x10')],'include':[{'model':_0xcc6a('0x11'),'as':_0xcc6a('0x11'),'attributes':['id',_0xcc6a('0x4')]}]},{'model':_0xcc6a('0xd'),'as':'Descriptions','attributes':['id',_0xcc6a('0xf'),_0xcc6a('0x12'),_0xcc6a('0x13'),'keyType',_0xcc6a('0x14'),_0xcc6a('0x10')],'include':[{'model':_0xcc6a('0x11'),'as':'Variable','attributes':['id','name']}]},{'model':_0xcc6a('0xd'),'as':_0xcc6a('0x15'),'attributes':['id',_0xcc6a('0xf'),'content','idField',_0xcc6a('0x16'),_0xcc6a('0x17'),_0xcc6a('0x10')],'include':[{'model':_0xcc6a('0x11'),'as':_0xcc6a('0x11'),'attributes':['id',_0xcc6a('0x4')]}]}]}]},'log':_0xcc6a('0x18')});};}; \ No newline at end of file +var _0x6d38=['ServicenowField','content','variableName','Variable','Descriptions','key','keyType','Fields','type','idField','nameField','GetServicenowkAccount','getServicenowAccounts','Request','description','password','email','remoteUri','ServicenowConfiguration','Configurations','name'];(function(_0x4c184d,_0x4278ab){var _0x23d997=function(_0x22d068){while(--_0x22d068){_0x4c184d['push'](_0x4c184d['shift']());}};_0x23d997(++_0x4278ab);}(_0x6d38,0x1ef));var _0x86d3=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x6d38[_0x4154a6];return _0x3b2786;};'use strict';var client=require('../../client');exports[_0x86d3('0x0')]=function(){return function(_0x4c9c06){return client[_0x86d3('0x1')]('GetServicenowAccount',{'options':{'raw':![],'attributes':['id','name',_0x86d3('0x2'),'username',_0x86d3('0x3'),_0x86d3('0x4'),_0x86d3('0x5'),'serverUrl'],'include':[{'model':_0x86d3('0x6'),'as':_0x86d3('0x7'),'attributes':['id',_0x86d3('0x8')],'include':[{'model':_0x86d3('0x9'),'as':'Subjects','attributes':['id','type',_0x86d3('0xa'),_0x86d3('0xb')],'include':[{'model':_0x86d3('0xc'),'as':'Variable','attributes':['id','name']}]},{'model':_0x86d3('0x9'),'as':_0x86d3('0xd'),'attributes':['id','type','content',_0x86d3('0xe'),_0x86d3('0xf'),'keyContent',_0x86d3('0xb')],'include':[{'model':'Variable','as':_0x86d3('0xc'),'attributes':['id',_0x86d3('0x8')]}]},{'model':_0x86d3('0x9'),'as':_0x86d3('0x10'),'attributes':['id',_0x86d3('0x11'),_0x86d3('0xa'),_0x86d3('0x12'),_0x86d3('0x13'),'customField',_0x86d3('0xb')],'include':[{'model':_0x86d3('0xc'),'as':_0x86d3('0xc'),'attributes':['id',_0x86d3('0x8')]}]}]}]},'log':_0x86d3('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index 96ee08f..b889823 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['Configurations','SugarcrmField','Subjects','variableName','Variable','Descriptions','type','key','keyType','Fields','content','idField','customField','../../client','GetSugarcrmAccount','name','username','password','remoteUri','serverUrl','SugarcrmConfiguration'];(function(_0x4400f7,_0xe6e042){var _0x158216=function(_0x1b7e14){while(--_0x1b7e14){_0x4400f7['push'](_0x4400f7['shift']());}};_0x158216(++_0xe6e042);}(_0x0b0e,0x187));var _0xe0b0=function(_0x17045c,_0x470ebe){_0x17045c=_0x17045c-0x0;var _0x844ac5=_0x0b0e[_0x17045c];return _0x844ac5;};'use strict';var client=require(_0xe0b0('0x0'));exports['getSugarcrmAccounts']=function(){return function(_0xc416e3){return client['Request'](_0xe0b0('0x1'),{'options':{'raw':![],'attributes':['id',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6')],'include':[{'model':_0xe0b0('0x7'),'as':_0xe0b0('0x8'),'attributes':['id',_0xe0b0('0x2')],'include':[{'model':_0xe0b0('0x9'),'as':_0xe0b0('0xa'),'attributes':['id','type','content',_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id',_0xe0b0('0x2')]}]},{'model':'SugarcrmField','as':_0xe0b0('0xd'),'attributes':['id',_0xe0b0('0xe'),'content',_0xe0b0('0xf'),_0xe0b0('0x10'),'keyContent',_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id','name']}]},{'model':_0xe0b0('0x9'),'as':_0xe0b0('0x11'),'attributes':['id',_0xe0b0('0xe'),_0xe0b0('0x12'),_0xe0b0('0x13'),'nameField',_0xe0b0('0x14'),_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id',_0xe0b0('0x2')]}]}]}]},'log':'GetSugarcrmAccount'});};}; \ No newline at end of file +var _0x66fa=['password','remoteUri','serverUrl','SugarcrmField','Subjects','type','content','Variable','Descriptions','keyType','keyContent','Fields','customField','../../client','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','username'];(function(_0x47ad88,_0x53e221){var _0x315c8b=function(_0x1e43fd){while(--_0x1e43fd){_0x47ad88['push'](_0x47ad88['shift']());}};_0x315c8b(++_0x53e221);}(_0x66fa,0x117));var _0xa66f=function(_0xd85453,_0x16df12){_0xd85453=_0xd85453-0x0;var _0x244890=_0x66fa[_0xd85453];return _0x244890;};'use strict';var client=require(_0xa66f('0x0'));exports[_0xa66f('0x1')]=function(){return function(_0x52947a){return client[_0xa66f('0x2')](_0xa66f('0x3'),{'options':{'raw':![],'attributes':['id',_0xa66f('0x4'),_0xa66f('0x5'),_0xa66f('0x6'),_0xa66f('0x7'),_0xa66f('0x8')],'include':[{'model':'SugarcrmConfiguration','as':'Configurations','attributes':['id',_0xa66f('0x4')],'include':[{'model':_0xa66f('0x9'),'as':_0xa66f('0xa'),'attributes':['id',_0xa66f('0xb'),_0xa66f('0xc'),'variableName'],'include':[{'model':_0xa66f('0xd'),'as':'Variable','attributes':['id',_0xa66f('0x4')]}]},{'model':'SugarcrmField','as':_0xa66f('0xe'),'attributes':['id','type','content','key',_0xa66f('0xf'),_0xa66f('0x10'),'variableName'],'include':[{'model':_0xa66f('0xd'),'as':'Variable','attributes':['id',_0xa66f('0x4')]}]},{'model':'SugarcrmField','as':_0xa66f('0x11'),'attributes':['id',_0xa66f('0xb'),_0xa66f('0xc'),'idField','nameField',_0xa66f('0x12'),'variableName'],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0xa66f('0x4')]}]}]}]},'log':_0xa66f('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index 9e789e2..db4aeb6 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x165d=['content','variableName','Variable','VtigerField','Descriptions','keyContent','Fields','idField','nameField','customField','GetVtigerAccount','../../client','getVtigerAccounts','Request','name','username','accessKey','remoteUri','VtigerConfiguration','Configurations','Subjects','type'];(function(_0xd815d1,_0x3df6c0){var _0x4ca47a=function(_0x1727f6){while(--_0x1727f6){_0xd815d1['push'](_0xd815d1['shift']());}};_0x4ca47a(++_0x3df6c0);}(_0x165d,0xd1));var _0xd165=function(_0x46565c,_0x2d6949){_0x46565c=_0x46565c-0x0;var _0x1e3c4e=_0x165d[_0x46565c];return _0x1e3c4e;};'use strict';var client=require(_0xd165('0x0'));exports[_0xd165('0x1')]=function(){return function(_0x44e0fc){return client[_0xd165('0x2')]('GetVtigerAccount',{'options':{'raw':![],'attributes':['id',_0xd165('0x3'),'description',_0xd165('0x4'),_0xd165('0x5'),_0xd165('0x6'),'serverUrl'],'include':[{'model':_0xd165('0x7'),'as':_0xd165('0x8'),'attributes':['id',_0xd165('0x3')],'include':[{'model':'VtigerField','as':_0xd165('0x9'),'attributes':['id',_0xd165('0xa'),_0xd165('0xb'),_0xd165('0xc')],'include':[{'model':'Variable','as':_0xd165('0xd'),'attributes':['id',_0xd165('0x3')]}]},{'model':_0xd165('0xe'),'as':_0xd165('0xf'),'attributes':['id','type',_0xd165('0xb'),'key','keyType',_0xd165('0x10'),_0xd165('0xc')],'include':[{'model':_0xd165('0xd'),'as':_0xd165('0xd'),'attributes':['id',_0xd165('0x3')]}]},{'model':_0xd165('0xe'),'as':_0xd165('0x11'),'attributes':['id','type',_0xd165('0xb'),_0xd165('0x12'),_0xd165('0x13'),_0xd165('0x14'),'variableName'],'include':[{'model':_0xd165('0xd'),'as':_0xd165('0xd'),'attributes':['id',_0xd165('0x3')]}]}]}]},'log':_0xd165('0x15')});};}; \ No newline at end of file +var _0x7c95=['nameField','customField','getVtigerAccounts','Request','GetVtigerAccount','name','description','username','remoteUri','VtigerConfiguration','VtigerField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','Fields','idField'];(function(_0x285d0f,_0x180efa){var _0x59813f=function(_0x213718){while(--_0x213718){_0x285d0f['push'](_0x285d0f['shift']());}};_0x59813f(++_0x180efa);}(_0x7c95,0x1e5));var _0x57c9=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x7c95[_0x27af45];return _0x18df21;};'use strict';var client=require('../../client');exports[_0x57c9('0x0')]=function(){return function(_0x2f9511){return client[_0x57c9('0x1')](_0x57c9('0x2'),{'options':{'raw':![],'attributes':['id',_0x57c9('0x3'),_0x57c9('0x4'),_0x57c9('0x5'),'accessKey',_0x57c9('0x6'),'serverUrl'],'include':[{'model':_0x57c9('0x7'),'as':'Configurations','attributes':['id',_0x57c9('0x3')],'include':[{'model':_0x57c9('0x8'),'as':_0x57c9('0x9'),'attributes':['id',_0x57c9('0xa'),_0x57c9('0xb'),_0x57c9('0xc')],'include':[{'model':_0x57c9('0xd'),'as':_0x57c9('0xd'),'attributes':['id','name']}]},{'model':_0x57c9('0x8'),'as':_0x57c9('0xe'),'attributes':['id',_0x57c9('0xa'),_0x57c9('0xb'),_0x57c9('0xf'),_0x57c9('0x10'),'keyContent',_0x57c9('0xc')],'include':[{'model':_0x57c9('0xd'),'as':_0x57c9('0xd'),'attributes':['id',_0x57c9('0x3')]}]},{'model':_0x57c9('0x8'),'as':_0x57c9('0x11'),'attributes':['id',_0x57c9('0xa'),_0x57c9('0xb'),_0x57c9('0x12'),_0x57c9('0x13'),_0x57c9('0x14'),'variableName'],'include':[{'model':_0x57c9('0xd'),'as':'Variable','attributes':['id',_0x57c9('0x3')]}]}]}]},'log':_0x57c9('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index 2a4da13..f99b9fa 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1664=['keyContent','Fields','idField','nameField','GetZendeskAccount','Request','name','username','token','authType','serverUrl','type','Configurations','Tag','ZendeskField','content','variableName','Variable','Descriptions'];(function(_0x3ad4fd,_0x4d1fd9){var _0x284de2=function(_0x38d62e){while(--_0x38d62e){_0x3ad4fd['push'](_0x3ad4fd['shift']());}};_0x284de2(++_0x4d1fd9);}(_0x1664,0xe9));var _0x4166=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x1664[_0x2d2c16];return _0x53f2fb;};'use strict';var client=require('../../client');exports['getZendeskAccounts']=function(){return function(_0x23f93f){return client[_0x4166('0x0')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id',_0x4166('0x1'),_0x4166('0x2'),'password',_0x4166('0x3'),'remoteUri',_0x4166('0x4'),_0x4166('0x5'),_0x4166('0x6')],'include':[{'model':'ZendeskConfiguration','as':_0x4166('0x7'),'attributes':['id',_0x4166('0x1')],'include':[{'model':_0x4166('0x8'),'attributes':['id',_0x4166('0x1')]},{'model':_0x4166('0x9'),'as':'Subjects','attributes':['id',_0x4166('0x6'),_0x4166('0xa'),_0x4166('0xb')],'include':[{'model':_0x4166('0xc'),'as':_0x4166('0xc'),'attributes':['id','name']}]},{'model':_0x4166('0x9'),'as':_0x4166('0xd'),'attributes':['id','type',_0x4166('0xa'),'key','keyType',_0x4166('0xe'),_0x4166('0xb')],'include':[{'model':_0x4166('0xc'),'as':'Variable','attributes':['id','name']}]},{'model':_0x4166('0x9'),'as':_0x4166('0xf'),'attributes':['id',_0x4166('0x6'),_0x4166('0xa'),_0x4166('0x10'),_0x4166('0x11'),'customField',_0x4166('0xb')],'include':[{'model':_0x4166('0xc'),'as':_0x4166('0xc'),'attributes':['id','name']}]}]}]},'log':_0x4166('0x12')});};}; \ No newline at end of file +var _0x84a4=['password','token','remoteUri','authType','serverUrl','type','Configurations','ZendeskField','Subjects','content','Variable','Descriptions','key','keyType','keyContent','variableName','Fields','idField','nameField','../../client','GetZendeskAccount','name','username'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0x84a4,0xe2));var _0x484a=function(_0x155b42,_0x5ae35d){_0x155b42=_0x155b42-0x0;var _0x2f40d6=_0x84a4[_0x155b42];return _0x2f40d6;};'use strict';var client=require(_0x484a('0x0'));exports['getZendeskAccounts']=function(){return function(_0x4ec0fd){return client['Request'](_0x484a('0x1'),{'options':{'raw':![],'attributes':['id',_0x484a('0x2'),_0x484a('0x3'),_0x484a('0x4'),_0x484a('0x5'),_0x484a('0x6'),_0x484a('0x7'),_0x484a('0x8'),_0x484a('0x9')],'include':[{'model':'ZendeskConfiguration','as':_0x484a('0xa'),'attributes':['id',_0x484a('0x2')],'include':[{'model':'Tag','attributes':['id',_0x484a('0x2')]},{'model':_0x484a('0xb'),'as':_0x484a('0xc'),'attributes':['id',_0x484a('0x9'),_0x484a('0xd'),'variableName'],'include':[{'model':_0x484a('0xe'),'as':_0x484a('0xe'),'attributes':['id',_0x484a('0x2')]}]},{'model':_0x484a('0xb'),'as':_0x484a('0xf'),'attributes':['id',_0x484a('0x9'),_0x484a('0xd'),_0x484a('0x10'),_0x484a('0x11'),_0x484a('0x12'),_0x484a('0x13')],'include':[{'model':_0x484a('0xe'),'as':_0x484a('0xe'),'attributes':['id',_0x484a('0x2')]}]},{'model':_0x484a('0xb'),'as':_0x484a('0x14'),'attributes':['id',_0x484a('0x9'),_0x484a('0xd'),_0x484a('0x15'),_0x484a('0x16'),'customField',_0x484a('0x13')],'include':[{'model':_0x484a('0xe'),'as':_0x484a('0xe'),'attributes':['id',_0x484a('0x2')]}]}]}]},'log':_0x484a('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index bd4f069..5857c86 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb040=['zone','clientSecret','serverUrl','code','refreshToken','ZohoConfiguration','ZohoField','Subjects','type','Variable','Descriptions','keyType','keyContent','Fields','idField','customField','variableName','../../client','getZohoAccounts','Request','GetZohoAccount','name','description','host'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xb040,0x1f1));var _0x0b04=function(_0x4efbb8,_0x5ca874){_0x4efbb8=_0x4efbb8-0x0;var _0x5cb416=_0xb040[_0x4efbb8];return _0x5cb416;};'use strict';var client=require(_0x0b04('0x0'));exports[_0x0b04('0x1')]=function(){return function(_0xaa8d2a){return client[_0x0b04('0x2')](_0x0b04('0x3'),{'options':{'raw':![],'attributes':['id',_0x0b04('0x4'),_0x0b04('0x5'),_0x0b04('0x6'),_0x0b04('0x7'),'clientId',_0x0b04('0x8'),_0x0b04('0x9'),_0x0b04('0xa'),_0x0b04('0xb')],'include':[{'model':_0x0b04('0xc'),'as':'Configurations','attributes':['id',_0x0b04('0x4'),'moduleCreate','moduleSearch','description'],'include':[{'model':_0x0b04('0xd'),'as':_0x0b04('0xe'),'attributes':['id',_0x0b04('0xf'),'content','variableName'],'include':[{'model':'Variable','as':_0x0b04('0x10'),'attributes':['id','name']}]},{'model':_0x0b04('0xd'),'as':_0x0b04('0x11'),'attributes':['id','type','content','key',_0x0b04('0x12'),_0x0b04('0x13'),'variableName'],'include':[{'model':_0x0b04('0x10'),'as':'Variable','attributes':['id',_0x0b04('0x4')]}]},{'model':_0x0b04('0xd'),'as':_0x0b04('0x14'),'attributes':['id',_0x0b04('0xf'),'content',_0x0b04('0x15'),'nameField',_0x0b04('0x16'),_0x0b04('0x17')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x0b04('0x4')]}]}]}]},'log':'GetZohoAccount'});};}; \ No newline at end of file +var _0x3466=['Variable','ZohoField','Descriptions','content','key','keyType','variableName','idField','customField','getZohoAccounts','Request','GetZohoAccount','name','description','host','zone','clientId','clientSecret','code','ZohoConfiguration','Configurations','moduleCreate','Subjects','type'];(function(_0x4b135e,_0x289488){var _0x16aa1d=function(_0x9588f8){while(--_0x9588f8){_0x4b135e['push'](_0x4b135e['shift']());}};_0x16aa1d(++_0x289488);}(_0x3466,0x141));var _0x6346=function(_0x290564,_0x19b0d9){_0x290564=_0x290564-0x0;var _0x2903be=_0x3466[_0x290564];return _0x2903be;};'use strict';var client=require('../../client');exports[_0x6346('0x0')]=function(){return function(_0x485950){return client[_0x6346('0x1')](_0x6346('0x2'),{'options':{'raw':![],'attributes':['id',_0x6346('0x3'),_0x6346('0x4'),_0x6346('0x5'),_0x6346('0x6'),_0x6346('0x7'),_0x6346('0x8'),'serverUrl',_0x6346('0x9'),'refreshToken'],'include':[{'model':_0x6346('0xa'),'as':_0x6346('0xb'),'attributes':['id','name',_0x6346('0xc'),'moduleSearch','description'],'include':[{'model':'ZohoField','as':_0x6346('0xd'),'attributes':['id',_0x6346('0xe'),'content','variableName'],'include':[{'model':_0x6346('0xf'),'as':'Variable','attributes':['id',_0x6346('0x3')]}]},{'model':_0x6346('0x10'),'as':_0x6346('0x11'),'attributes':['id',_0x6346('0xe'),_0x6346('0x12'),_0x6346('0x13'),_0x6346('0x14'),'keyContent',_0x6346('0x15')],'include':[{'model':_0x6346('0xf'),'as':_0x6346('0xf'),'attributes':['id',_0x6346('0x3')]}]},{'model':_0x6346('0x10'),'as':'Fields','attributes':['id',_0x6346('0xe'),_0x6346('0x12'),_0x6346('0x16'),'nameField',_0x6346('0x17'),_0x6346('0x15')],'include':[{'model':'Variable','as':_0x6346('0xf'),'attributes':['id',_0x6346('0x3')]}]}]}]},'log':_0x6346('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index ed4ed3b..2eae167 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfec=['IntervalIftime','intervalIftime','../../../config/logger','dialer','../client','stack','replace','silly','intervalIftime\x20called\x20with','isArray','length','every','string','map','interval','concat','Request'];(function(_0x19cfac,_0x3745dc){var _0x25d2a5=function(_0x2bad78){while(--_0x2bad78){_0x19cfac['push'](_0x19cfac['shift']());}};_0x25d2a5(++_0x3745dc);}(_0xbfec,0x123));var _0xcbfe=function(_0x3c9f5b,_0x252198){_0x3c9f5b=_0x3c9f5b-0x0;var _0x3111d5=_0xbfec[_0x3c9f5b];return _0x3111d5;};var logger=require(_0xcbfe('0x0'))(_0xcbfe('0x1'));var client=require(_0xcbfe('0x2'));function intervalIftime(_0x3ee167,_0x35ffcd){const _0x4796e6=new Error()[_0xcbfe('0x3')][_0xcbfe('0x4')](/^Error/,'')['trim']();logger[_0xcbfe('0x5')](_0xcbfe('0x6'),_0x3ee167,_0x35ffcd,_0x4796e6);const _0x28d772=Array[_0xcbfe('0x7')](_0x3ee167);if(!_0x3ee167||_0x28d772&&_0x3ee167[_0xcbfe('0x8')]===0x0){return Promise['resolve'](![]);}else{var _0x34a7de=[];var _0x17f528=[];var _0x4d0a55=_0x28d772?_0x3ee167:[_0x3ee167];var _0xefa326=_0x4d0a55[_0xcbfe('0x9')](function(_0x197c40){return typeof _0x197c40==='number';});var _0xca8f2f=_0x4d0a55[_0xcbfe('0x9')](function(_0x461057){return typeof _0x461057===_0xcbfe('0xa');});if(!_0xefa326&&!_0xca8f2f){_0x34a7de=_0x4d0a55['map'](function(_0x21c2b9){return _0x21c2b9['id'];});if(_0x34a7de['length']===0x0){_0x17f528=_0x4d0a55[_0xcbfe('0xb')](function(_0x364437){return _0x364437[_0xcbfe('0xc')];});}}else{if(_0xefa326){_0x34a7de=_0x34a7de[_0xcbfe('0xd')](_0x4d0a55);}if(_0xca8f2f){_0x17f528=_0x17f528[_0xcbfe('0xd')](_0x4d0a55);}}return client[_0xcbfe('0xe')](_0xcbfe('0xf'),{'intervalIds':_0x34a7de,'intervals':_0x17f528,'timezone':_0x35ffcd,'log':_0xcbfe('0xf')});}}exports[_0xcbfe('0x10')]=intervalIftime; \ No newline at end of file +var _0xf404=['stack','replace','trim','intervalIftime\x20called\x20with','length','resolve','every','number','string','map','interval','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','dialer'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xf404,0x86));var _0x4f40=function(_0x2b9a9c,_0x1c984b){_0x2b9a9c=_0x2b9a9c-0x0;var _0x353ad7=_0xf404[_0x2b9a9c];return _0x353ad7;};var logger=require(_0x4f40('0x0'))(_0x4f40('0x1'));var client=require('../client');function intervalIftime(_0x5d2133,_0x1278fd){const _0x1a28c9=new Error()[_0x4f40('0x2')][_0x4f40('0x3')](/^Error/,'')[_0x4f40('0x4')]();logger['silly'](_0x4f40('0x5'),_0x5d2133,_0x1278fd,_0x1a28c9);const _0x4e9d24=Array['isArray'](_0x5d2133);if(!_0x5d2133||_0x4e9d24&&_0x5d2133[_0x4f40('0x6')]===0x0){return Promise[_0x4f40('0x7')](![]);}else{var _0x508385=[];var _0x107fec=[];var _0x1fb362=_0x4e9d24?_0x5d2133:[_0x5d2133];var _0x595d8b=_0x1fb362[_0x4f40('0x8')](function(_0x17e9dd){return typeof _0x17e9dd===_0x4f40('0x9');});var _0x135d3e=_0x1fb362[_0x4f40('0x8')](function(_0x4de045){return typeof _0x4de045===_0x4f40('0xa');});if(!_0x595d8b&&!_0x135d3e){_0x508385=_0x1fb362[_0x4f40('0xb')](function(_0x5a54d7){return _0x5a54d7['id'];});if(_0x508385['length']===0x0){_0x107fec=_0x1fb362[_0x4f40('0xb')](function(_0x5d3e90){return _0x5d3e90[_0x4f40('0xc')];});}}else{if(_0x595d8b){_0x508385=_0x508385[_0x4f40('0xd')](_0x1fb362);}if(_0x135d3e){_0x107fec=_0x107fec[_0x4f40('0xd')](_0x1fb362);}}return client[_0x4f40('0xe')](_0x4f40('0xf'),{'intervalIds':_0x508385,'intervals':_0x107fec,'timezone':_0x1278fd,'log':_0x4f40('0xf')});}}exports[_0x4f40('0x10')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index a66a17f..edbf8b3 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x035a=['interface','TALKING','queuecallerleaveAt','diff','seconds','calleridnum','exten','queue','accountcode','uniqueid','voiceDialReport','membername','starttime','endtime','dialstring','agent','toNumber','lodash','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil'];(function(_0x305b12,_0x5ecd09){var _0x4141de=function(_0x3e7044){while(--_0x3e7044){_0x305b12['push'](_0x305b12['shift']());}};_0x4141de(++_0x5ecd09);}(_0x035a,0xe1));var _0xa035=function(_0x323363,_0x404fac){_0x323363=_0x323363-0x0;var _0x1ed31f=_0x035a[_0x323363];return _0x1ed31f;};'use strict';var moment=require('moment');var _=require(_0xa035('0x0'));var util=require('util');var client=require('../client');exports[_0xa035('0x1')]=function(_0x13cb5e){var _0x5222ae=_0x13cb5e[_0xa035('0x2')]||_0x13cb5e[_0xa035('0x3')];return client[_0xa035('0x4')](_0xa035('0x5'),{'body':{'channel':_0xa035('0x6'),'membername':_0x13cb5e[_0xa035('0x7')],'interface':_[_0xa035('0x8')](_0x13cb5e[_0xa035('0x9')])?util['format']('SIP/%s',_0x13cb5e[_0xa035('0x7')]):_0x13cb5e['interface'],'type':_0xa035('0xa'),'enterAt':_0x13cb5e[_0xa035('0xb')],'exitAt':_0x5222ae,'duration':moment(_0x5222ae)[_0xa035('0xc')](_0x13cb5e[_0xa035('0xb')],_0xa035('0xd')),'data1':'inbound','data2':_0x13cb5e[_0xa035('0xe')],'data3':_0x13cb5e[_0xa035('0xf')],'data4':null,'data5':_0x13cb5e[_0xa035('0x10')],'role':'agent','internal':_0x13cb5e[_0xa035('0x11')]?_['toNumber'](_0x13cb5e['accountcode']):undefined,'uniqueid':_0x13cb5e[_0xa035('0x12')]},'log':_0xa035('0x5')});};exports[_0xa035('0x13')]=function(_0x3db8a0){return client[_0xa035('0x4')](_0xa035('0x5'),{'body':{'channel':_0xa035('0x6'),'membername':_0x3db8a0[_0xa035('0x14')],'interface':_0x3db8a0['interface'],'type':_0xa035('0xa'),'enterAt':_0x3db8a0[_0xa035('0x15')],'exitAt':_0x3db8a0[_0xa035('0x16')],'duration':moment(_0x3db8a0[_0xa035('0x16')])[_0xa035('0xc')](_0x3db8a0[_0xa035('0x15')],_0xa035('0xd'))>=0x0?moment(_0x3db8a0[_0xa035('0x16')])[_0xa035('0xc')](_0x3db8a0[_0xa035('0x15')],_0xa035('0xd')):null,'data1':'outbound','data2':_0x3db8a0[_0xa035('0x11')],'data3':_0x3db8a0[_0xa035('0xf')],'data4':_0x3db8a0[_0xa035('0x17')]||null,'role':_0xa035('0x18'),'internal':_0x3db8a0[_0xa035('0x11')]?_[_0xa035('0x19')](_0x3db8a0['accountcode']):undefined,'uniqueid':_0x3db8a0[_0xa035('0x12')]},'log':_0xa035('0x5')});}; \ No newline at end of file +var _0x6ed4=['TALKING','queuecallerleaveAt','diff','seconds','inbound','exten','queue','agent','accountcode','toNumber','voiceDialReport','membername','starttime','endtime','dialstring','uniqueid','moment','lodash','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','SIP/%s'];(function(_0x2818bb,_0x1f078a){var _0x404cfd=function(_0x4e4f2c){while(--_0x4e4f2c){_0x2818bb['push'](_0x2818bb['shift']());}};_0x404cfd(++_0x1f078a);}(_0x6ed4,0xb8));var _0x46ed=function(_0x4f9b47,_0x76a662){_0x4f9b47=_0x4f9b47-0x0;var _0x295702=_0x6ed4[_0x4f9b47];return _0x295702;};'use strict';var moment=require(_0x46ed('0x0'));var _=require(_0x46ed('0x1'));var util=require('util');var client=require(_0x46ed('0x2'));exports[_0x46ed('0x3')]=function(_0x2ffd48){var _0x58925c=_0x2ffd48[_0x46ed('0x4')]||_0x2ffd48[_0x46ed('0x5')];return client[_0x46ed('0x6')](_0x46ed('0x7'),{'body':{'channel':_0x46ed('0x8'),'membername':_0x2ffd48[_0x46ed('0x9')],'interface':_[_0x46ed('0xa')](_0x2ffd48['interface'])?util['format'](_0x46ed('0xb'),_0x2ffd48[_0x46ed('0x9')]):_0x2ffd48['interface'],'type':_0x46ed('0xc'),'enterAt':_0x2ffd48[_0x46ed('0xd')],'exitAt':_0x58925c,'duration':moment(_0x58925c)[_0x46ed('0xe')](_0x2ffd48[_0x46ed('0xd')],_0x46ed('0xf')),'data1':_0x46ed('0x10'),'data2':_0x2ffd48['calleridnum'],'data3':_0x2ffd48[_0x46ed('0x11')],'data4':null,'data5':_0x2ffd48[_0x46ed('0x12')],'role':_0x46ed('0x13'),'internal':_0x2ffd48[_0x46ed('0x14')]?_[_0x46ed('0x15')](_0x2ffd48[_0x46ed('0x14')]):undefined,'uniqueid':_0x2ffd48['uniqueid']},'log':_0x46ed('0x7')});};exports[_0x46ed('0x16')]=function(_0x106c9f){return client[_0x46ed('0x6')]('CreateMemberReport',{'body':{'channel':_0x46ed('0x8'),'membername':_0x106c9f[_0x46ed('0x17')],'interface':_0x106c9f['interface'],'type':_0x46ed('0xc'),'enterAt':_0x106c9f[_0x46ed('0x18')],'exitAt':_0x106c9f[_0x46ed('0x19')],'duration':moment(_0x106c9f[_0x46ed('0x19')])[_0x46ed('0xe')](_0x106c9f[_0x46ed('0x18')],_0x46ed('0xf'))>=0x0?moment(_0x106c9f[_0x46ed('0x19')])[_0x46ed('0xe')](_0x106c9f[_0x46ed('0x18')],'seconds'):null,'data1':'outbound','data2':_0x106c9f[_0x46ed('0x14')],'data3':_0x106c9f[_0x46ed('0x11')],'data4':_0x106c9f[_0x46ed('0x1a')]||null,'role':_0x46ed('0x13'),'internal':_0x106c9f[_0x46ed('0x14')]?_[_0x46ed('0x15')](_0x106c9f['accountcode']):undefined,'uniqueid':_0x106c9f[_0x46ed('0x1b')]},'log':_0x46ed('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 14bbc66..54631bc 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 _0x7461=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','../client'];(function(_0x58175c,_0x2d9373){var _0x55b88f=function(_0x13ed84){while(--_0x13ed84){_0x58175c['push'](_0x58175c['shift']());}};_0x55b88f(++_0x2d9373);}(_0x7461,0xdb));var _0x1746=function(_0x301148,_0x25b884){_0x301148=_0x301148-0x0;var _0x42ce24=_0x7461[_0x301148];return _0x42ce24;};'use strict';var client=require(_0x1746('0x0'));exports[_0x1746('0x1')]=function(){return client[_0x1746('0x2')](_0x1746('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x1746('0x4'),'previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file +var _0x1aab=['../client','getSettings','Request','stopRecordingOnTransfer','GetSettings'];(function(_0x3b0594,_0x259576){var _0x1731af=function(_0x740fcd){while(--_0x740fcd){_0x3b0594['push'](_0x3b0594['shift']());}};_0x1731af(++_0x259576);}(_0x1aab,0x122));var _0xb1aa=function(_0x113ab8,_0x4312bb){_0x113ab8=_0x113ab8-0x0;var _0x4a1c8d=_0x1aab[_0x113ab8];return _0x4a1c8d;};'use strict';var client=require(_0xb1aa('0x0'));exports[_0xb1aa('0x1')]=function(){return client[_0xb1aa('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb1aa('0x3'),'previewRecallmeReminderInterval']},'log':_0xb1aa('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 91bf732..6f34e2f 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 _0xfd33=['../client','getTemplates','GetTemplate','html'];(function(_0x5065d5,_0x42b61b){var _0x50dbb6=function(_0x230ec1){while(--_0x230ec1){_0x5065d5['push'](_0x5065d5['shift']());}};_0x50dbb6(++_0x42b61b);}(_0xfd33,0xe8));var _0x3fd3=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xfd33[_0x166742];return _0xb7814a;};'use strict';var client=require(_0x3fd3('0x0'));exports[_0x3fd3('0x1')]=function(_0xf13bac){return function(_0xea3457){return client['Request'](_0x3fd3('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x3fd3('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xe09d=['GetTemplate','html','../client','getTemplates','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe09d,0x9d));var _0xde09=function(_0x5ac7ba,_0x45d087){_0x5ac7ba=_0x5ac7ba-0x0;var _0x18b7e6=_0xe09d[_0x5ac7ba];return _0x18b7e6;};'use strict';var client=require(_0xde09('0x0'));exports[_0xde09('0x1')]=function(_0x487420){return function(_0x57d9f2){return client[_0xde09('0x2')](_0xde09('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0xde09('0x4')]},'log':_0xde09('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 31af02a..d7c7ca0 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 _0xa9c7=['Actions','data1','data2','data4','data5','data6','../client','Request','GetTrigger','name','channel','status','Condition','AllConditions','operator','value','AnyConditions','field','Action'];(function(_0xba9e5e,_0x4aa239){var _0x4d0001=function(_0x11a6c0){while(--_0x11a6c0){_0xba9e5e['push'](_0xba9e5e['shift']());}};_0x4d0001(++_0x4aa239);}(_0xa9c7,0x1a8));var _0x7a9c=function(_0x44b7d6,_0x4a3f3f){_0x44b7d6=_0x44b7d6-0x0;var _0x5346f0=_0xa9c7[_0x44b7d6];return _0x5346f0;};'use strict';var client=require(_0x7a9c('0x0'));exports['getTriggers']=function(_0x187635){return function(_0x17401f){return client[_0x7a9c('0x1')](_0x7a9c('0x2'),{'options':{'raw':![],'attributes':['id',_0x7a9c('0x3'),_0x7a9c('0x4'),_0x7a9c('0x5')],'include':[{'model':_0x7a9c('0x6'),'as':_0x7a9c('0x7'),'attributes':['id','field',_0x7a9c('0x8'),_0x7a9c('0x9')]},{'model':_0x7a9c('0x6'),'as':_0x7a9c('0xa'),'attributes':['id',_0x7a9c('0xb'),_0x7a9c('0x8'),_0x7a9c('0x9')]},{'model':_0x7a9c('0xc'),'as':_0x7a9c('0xd'),'attributes':['id','action',_0x7a9c('0xe'),_0x7a9c('0xf'),'data3',_0x7a9c('0x10'),_0x7a9c('0x11'),_0x7a9c('0x12'),'data7']}]},'log':_0x7a9c('0x2')});};}; \ No newline at end of file +var _0x6918=['channel','status','Condition','field','operator','value','Actions','action','data1','data2','data3','data5','data6','data7','../client','getTriggers','GetTrigger','name'];(function(_0xb68438,_0x21c2c0){var _0xbb3e85=function(_0x564de7){while(--_0x564de7){_0xb68438['push'](_0xb68438['shift']());}};_0xbb3e85(++_0x21c2c0);}(_0x6918,0x7a));var _0x8691=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6918[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0x8691('0x0'));exports[_0x8691('0x1')]=function(_0x7427d9){return function(_0x3bf3e6){return client['Request'](_0x8691('0x2'),{'options':{'raw':![],'attributes':['id',_0x8691('0x3'),_0x8691('0x4'),_0x8691('0x5')],'include':[{'model':_0x8691('0x6'),'as':'AllConditions','attributes':['id',_0x8691('0x7'),_0x8691('0x8'),_0x8691('0x9')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x8691('0x7'),'operator',_0x8691('0x9')]},{'model':'Action','as':_0x8691('0xa'),'attributes':['id',_0x8691('0xb'),_0x8691('0xc'),_0x8691('0xd'),_0x8691('0xe'),'data4',_0x8691('0xf'),_0x8691('0x10'),_0x8691('0x11')]}]},'log':_0x8691('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index adc3f20..e6c59cc 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 _0xf3cc=['getTrunks','GetTrunk','name','registry','../client'];(function(_0xa99357,_0x50ffad){var _0x111875=function(_0x4dce0c){while(--_0x4dce0c){_0xa99357['push'](_0xa99357['shift']());}};_0x111875(++_0x50ffad);}(_0xf3cc,0x10d));var _0xcf3c=function(_0x2543be,_0x19ebd6){_0x2543be=_0x2543be-0x0;var _0x4636d0=_0xf3cc[_0x2543be];return _0x4636d0;};'use strict';var client=require(_0xcf3c('0x0'));exports[_0xcf3c('0x1')]=function(_0x170f33){return function(_0x38c9f6){return client['Request'](_0xcf3c('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xcf3c('0x3'),_0xcf3c('0x4'),'defaultuser']},'log':_0xcf3c('0x2')});};}; \ No newline at end of file +var _0x383d=['name','registry','defaultuser','GetTrunk','Request'];(function(_0x5b29f7,_0x335b71){var _0x47d235=function(_0x5bf7b7){while(--_0x5bf7b7){_0x5b29f7['push'](_0x5b29f7['shift']());}};_0x47d235(++_0x335b71);}(_0x383d,0x86));var _0xd383=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x383d[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports['getTrunks']=function(_0xced345){return function(_0x326371){return client[_0xd383('0x0')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xd383('0x1'),_0xd383('0x2'),_0xd383('0x3')]},'log':_0xd383('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 85d328e..70ff2c0 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(_0x449e3e,_0x3e113e){var _0x6cc58a=function(_0x4d8c4d){while(--_0x4d8c4d){_0x449e3e['push'](_0x449e3e['shift']());}};_0x6cc58a(++_0x3e113e);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'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 _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x186aa0,_0x3d0090){var _0xbee4cc=function(_0xdea6b0){while(--_0xdea6b0){_0x186aa0['push'](_0x186aa0['shift']());}};_0xbee4cc(++_0x3d0090);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 21d7436..9354e82 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 _0x8a2f=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','Request'];(function(_0x5016c9,_0x57cdf0){var _0x5371ee=function(_0x494af9){while(--_0x494af9){_0x5016c9['push'](_0x5016c9['shift']());}};_0x5371ee(++_0x57cdf0);}(_0x8a2f,0xbc));var _0xf8a2=function(_0x350933,_0x202db0){_0x350933=_0x350933-0x0;var _0x3b5ef1=_0x8a2f[_0x350933];return _0x3b5ef1;};'use strict';var client=require(_0xf8a2('0x0'));exports['create']=function(_0x1144c3){return client[_0xf8a2('0x1')](_0xf8a2('0x2'),{'body':_0x1144c3,'log':_0xf8a2('0x2')});};exports[_0xf8a2('0x3')]=function(_0xba9761,_0x1a77d3,_0x17049d){return client[_0xf8a2('0x1')](_0xf8a2('0x4'),{'body':_0xba9761,'options':{'where':{'uniqueid':_0x1a77d3,'interface':_0x17049d,'agentcomplete':!![]}},'log':_0xf8a2('0x4')});}; \ No newline at end of file +var _0x5fad=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client'];(function(_0x127b1b,_0x39772c){var _0x1f10b9=function(_0x381326){while(--_0x381326){_0x127b1b['push'](_0x127b1b['shift']());}};_0x1f10b9(++_0x39772c);}(_0x5fad,0x1cb));var _0xd5fa=function(_0x36cef1,_0x140a7c){_0x36cef1=_0x36cef1-0x0;var _0x1d333d=_0x5fad[_0x36cef1];return _0x1d333d;};'use strict';var client=require(_0xd5fa('0x0'));exports['create']=function(_0xe1c36e){return client[_0xd5fa('0x1')](_0xd5fa('0x2'),{'body':_0xe1c36e,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x2f6afa,_0x5681c7,_0x48b156){return client[_0xd5fa('0x1')](_0xd5fa('0x3'),{'body':_0x2f6afa,'options':{'where':{'uniqueid':_0x5681c7,'interface':_0x48b156,'agentcomplete':!![]}},'log':_0xd5fa('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index dc60bc4..f8d4f61 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 _0xbd7f=['startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','moment','util','lodash','../client','create','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','outbound'];(function(_0x3fda4c,_0x4fb67b){var _0x26835c=function(_0x452030){while(--_0x452030){_0x3fda4c['push'](_0x3fda4c['shift']());}};_0x26835c(++_0x4fb67b);}(_0xbd7f,0xae));var _0xfbd7=function(_0x2adae2,_0x9542ed){_0x2adae2=_0x2adae2-0x0;var _0x3df0b0=_0xbd7f[_0x2adae2];return _0x3df0b0;};'use strict';var moment=require(_0xfbd7('0x0'));var util=require(_0xfbd7('0x1'));var _=require(_0xfbd7('0x2'));var client=require(_0xfbd7('0x3'));exports[_0xfbd7('0x4')]=function(_0x24c0c5){return client['Request'](_0xfbd7('0x5'),{'body':_[_0xfbd7('0x6')](_0x24c0c5,{'source':_0x24c0c5[_0xfbd7('0x7')],'destinationcontext':_0x24c0c5[_0xfbd7('0x8')],'callerid':_0x24c0c5[_0xfbd7('0x9')],'amaflags':_0xfbd7('0xa')}),'log':_0xfbd7('0x5')});};exports[_0xfbd7('0xb')]=function(){return function(){return client[_0xfbd7('0xc')](_0xfbd7('0xd'),{'options':{'where':{'type':[_0xfbd7('0xe')],'createdAt':{'$between':[moment()[_0xfbd7('0xf')](_0xfbd7('0x10'))[_0xfbd7('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xfbd7('0x12')]('day')[_0xfbd7('0x11')](_0xfbd7('0x13'))]}},'attributes':[_0xfbd7('0x14'),'disposition','duration','billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x71af=['duration','billableseconds','GetVoiceCallReports','moment','util','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition'];(function(_0x2caf3d,_0x4ad6b7){var _0x49f450=function(_0xd2d89b){while(--_0xd2d89b){_0x2caf3d['push'](_0x2caf3d['shift']());}};_0x49f450(++_0x4ad6b7);}(_0x71af,0x1e3));var _0xf71a=function(_0x3523ab,_0x3f0ef4){_0x3523ab=_0x3523ab-0x0;var _0x175ecc=_0x71af[_0x3523ab];return _0x175ecc;};'use strict';var moment=require(_0xf71a('0x0'));var util=require(_0xf71a('0x1'));var _=require('lodash');var client=require('../client');exports[_0xf71a('0x2')]=function(_0x29281f){return client[_0xf71a('0x3')](_0xf71a('0x4'),{'body':_[_0xf71a('0x5')](_0x29281f,{'source':_0x29281f[_0xf71a('0x6')],'destinationcontext':_0x29281f[_0xf71a('0x7')],'callerid':_0x29281f[_0xf71a('0x8')],'amaflags':_0xf71a('0x9')}),'log':_0xf71a('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0xf71a('0x3')](_0xf71a('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xf71a('0xb')](_0xf71a('0xc'))[_0xf71a('0xd')](_0xf71a('0xe')),moment()['endOf']('day')[_0xf71a('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xf71a('0xf'),_0xf71a('0x10'),_0xf71a('0x11'),_0xf71a('0x12')]},'log':_0xf71a('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 82cc53b..d91c19c 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 _0x73e6=['CreateVoiceDialReport','../client','create','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x73e6,0x9d));var _0x673e=function(_0x13dd2d,_0x4275f5){_0x13dd2d=_0x13dd2d-0x0;var _0x4b67e6=_0x73e6[_0x13dd2d];return _0x4b67e6;};'use strict';var client=require(_0x673e('0x0'));exports[_0x673e('0x1')]=function(_0x53a1fd){return client[_0x673e('0x2')](_0x673e('0x3'),{'body':_0x53a1fd,'log':_0x673e('0x3')});}; \ No newline at end of file +var _0x1b81=['Request','CreateVoiceDialReport','create'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x1b81,0xb0));var _0x11b8=function(_0x56b99e,_0x462a50){_0x56b99e=_0x56b99e-0x0;var _0xc40454=_0x1b81[_0x56b99e];return _0xc40454;};'use strict';var client=require('../client');exports[_0x11b8('0x0')]=function(_0x350ab8){return client[_0x11b8('0x1')]('CreateVoiceDialReport',{'body':_0x350ab8,'log':_0x11b8('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 5d4704c..2785de8 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 _0xd547=['recordingFormat','Request','GetVoiceExtension','exten'];(function(_0x1e0d74,_0x3dbec6){var _0x38eeda=function(_0x382960){while(--_0x382960){_0x1e0d74['push'](_0x1e0d74['shift']());}};_0x38eeda(++_0x3dbec6);}(_0xd547,0x1c1));var _0x7d54=function(_0xbd3556,_0xe38bfa){_0xbd3556=_0xbd3556-0x0;var _0x4a2e2d=_0xd547[_0xbd3556];return _0x4a2e2d;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x7d54('0x0')](_0x7d54('0x1'),{'options':{'raw':!![],'attributes':['id',_0x7d54('0x2'),_0x7d54('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x90db=['GetVoiceExtension','getVoiceExtensions','Request'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x90db,0x1c0));var _0xb90d=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x90db[_0x424a9a];return _0xa7831c;};'use strict';var client=require('../client');exports[_0xb90d('0x0')]=function(){return function(){return client[_0xb90d('0x1')](_0xb90d('0x2'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'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 30291ca..5396749 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 _0x7a2d=['dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix'];(function(_0x3b29ce,_0x13de5f){var _0x57b233=function(_0x5e4248){while(--_0x5e4248){_0x3b29ce['push'](_0x3b29ce['shift']());}};_0x57b233(++_0x13de5f);}(_0x7a2d,0x1c0));var _0xd7a2=function(_0x53766f,_0x5b7636){_0x53766f=_0x53766f-0x0;var _0x1cbcd6=_0x7a2d[_0x53766f];return _0x1cbcd6;};'use strict';var client=require('../client');exports[_0xd7a2('0x0')]=function(){return function(){return client[_0xd7a2('0x1')](_0xd7a2('0x2'),{'options':{'raw':![],'attributes':['id',_0xd7a2('0x3'),_0xd7a2('0x4'),_0xd7a2('0x5'),_0xd7a2('0x6'),_0xd7a2('0x7'),'type',_0xd7a2('0x8'),_0xd7a2('0x9'),_0xd7a2('0xa'),_0xd7a2('0xb'),_0xd7a2('0xc'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage',_0xd7a2('0xd'),'dialOriginateCallerIdName',_0xd7a2('0xe'),_0xd7a2('0xf'),'dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry',_0xd7a2('0x10'),_0xd7a2('0x11'),_0xd7a2('0x12'),_0xd7a2('0x13'),_0xd7a2('0x14'),_0xd7a2('0x15'),_0xd7a2('0x16'),'dialGlobalInterval',_0xd7a2('0x17'),_0xd7a2('0x18'),_0xd7a2('0x19'),_0xd7a2('0x1a'),_0xd7a2('0x1b'),'dialAMDAfterGreetingSilence',_0xd7a2('0x1c'),_0xd7a2('0x1d'),_0xd7a2('0x1e'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0xd7a2('0x1f'),_0xd7a2('0x20'),_0xd7a2('0x21'),_0xd7a2('0x22'),'dialOrderByScheduledAt',_0xd7a2('0x23'),'dialAgiAfterHangupClient',_0xd7a2('0x24'),'monitor_format','strategy',_0xd7a2('0x25'),'dialCutDigit',_0xd7a2('0x26'),_0xd7a2('0x27'),_0xd7a2('0x28'),_0xd7a2('0x29'),_0xd7a2('0x2a'),_0xd7a2('0x2b'),'dialMachineMaxRetry',_0xd7a2('0x2c'),_0xd7a2('0x2d'),_0xd7a2('0x2e'),_0xd7a2('0x2f'),_0xd7a2('0x30'),_0xd7a2('0x31'),_0xd7a2('0x32'),_0xd7a2('0x33')],'include':[{'model':_0xd7a2('0x34'),'as':_0xd7a2('0x34'),'attributes':['id',_0xd7a2('0x3'),_0xd7a2('0x35'),_0xd7a2('0x36')]},{'model':_0xd7a2('0x37'),'as':'mandatoryDispositionPause','attributes':['id',_0xd7a2('0x3')]},{'model':_0xd7a2('0x34'),'as':'TrunkBackup','attributes':['id',_0xd7a2('0x3'),_0xd7a2('0x35'),_0xd7a2('0x36')]},{'model':_0xd7a2('0x38'),'as':'Interval','attributes':['id',_0xd7a2('0x3')],'include':[{'model':'Interval','as':_0xd7a2('0x39'),'attributes':['id',_0xd7a2('0x3'),_0xd7a2('0x3a')]}]}]},'log':_0xd7a2('0x0')});};}; \ No newline at end of file +var _0xdf36=['dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval','../client','getVoiceQueues','GetVoiceQueue','name','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence'];(function(_0x449896,_0x40e4db){var _0x5c0286=function(_0x7627a9){while(--_0x7627a9){_0x449896['push'](_0x449896['shift']());}};_0x5c0286(++_0x40e4db);}(_0xdf36,0x185));var _0x6df3=function(_0x590a24,_0x512cf7){_0x590a24=_0x590a24-0x0;var _0x37d054=_0xdf36[_0x590a24];return _0x37d054;};'use strict';var client=require(_0x6df3('0x0'));exports[_0x6df3('0x1')]=function(){return function(){return client['Request'](_0x6df3('0x2'),{'options':{'raw':![],'attributes':['id',_0x6df3('0x3'),'acw','acwTimeout',_0x6df3('0x4'),_0x6df3('0x5'),_0x6df3('0x6'),_0x6df3('0x7'),'dialMethod',_0x6df3('0x8'),_0x6df3('0x9'),_0x6df3('0xa'),'dialPredictiveOptimization',_0x6df3('0xb'),_0x6df3('0xc'),_0x6df3('0xd'),_0x6df3('0xe'),_0x6df3('0xf'),_0x6df3('0x10'),_0x6df3('0x11'),'dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency',_0x6df3('0x12'),_0x6df3('0x13'),_0x6df3('0x14'),_0x6df3('0x15'),'dialGlobalMaxRetry',_0x6df3('0x16'),_0x6df3('0x17'),_0x6df3('0x18'),_0x6df3('0x19'),_0x6df3('0x1a'),_0x6df3('0x1b'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0x6df3('0x1c'),_0x6df3('0x1d'),_0x6df3('0x1e'),_0x6df3('0x1f'),_0x6df3('0x20'),_0x6df3('0x21'),_0x6df3('0x22'),_0x6df3('0x23'),_0x6df3('0x24'),_0x6df3('0x25'),_0x6df3('0x26'),_0x6df3('0x27'),_0x6df3('0x28'),'monitor_format',_0x6df3('0x29'),_0x6df3('0x2a'),_0x6df3('0x2b'),_0x6df3('0x2c'),_0x6df3('0x2d'),'dialDropMaxRetry',_0x6df3('0x2e'),_0x6df3('0x2f'),_0x6df3('0x30'),'dialMachineMaxRetry',_0x6df3('0x31'),_0x6df3('0x32'),'dialAgentRejectRetryFrequency','mandatoryDisposition',_0x6df3('0x33'),_0x6df3('0x34'),'dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':_0x6df3('0x35'),'as':_0x6df3('0x35'),'attributes':['id',_0x6df3('0x3'),_0x6df3('0x36'),'active']},{'model':_0x6df3('0x37'),'as':_0x6df3('0x38'),'attributes':['id',_0x6df3('0x3')]},{'model':_0x6df3('0x35'),'as':_0x6df3('0x39'),'attributes':['id',_0x6df3('0x3'),_0x6df3('0x36'),_0x6df3('0x3a')]},{'model':_0x6df3('0x3b'),'as':'Interval','attributes':['id','name'],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x6df3('0x3'),'interval']}]}]},'log':_0x6df3('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index bed9515..ca8dd2d 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(_0x3e3f99,_0x10b4cf){var _0x4de1c7=function(_0x2d897f){while(--_0x2d897f){_0x3e3f99['push'](_0x3e3f99['shift']());}};_0x4de1c7(++_0x10b4cf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x514b86,_0x4962bd){var _0x57da4b=function(_0x25b756){while(--_0x25b756){_0x514b86['push'](_0x514b86['shift']());}};_0x57da4b(++_0x4962bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 824e2d9..f8cfa7a 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 _0x4a78=['GetVoiceQueueRtPauses','../client','Request'];(function(_0x3932eb,_0x43b210){var _0x5316e5=function(_0x1744e8){while(--_0x1744e8){_0x3932eb['push'](_0x3932eb['shift']());}};_0x5316e5(++_0x43b210);}(_0x4a78,0xc1));var _0x84a7=function(_0x56aebd,_0x16faa0){_0x56aebd=_0x56aebd-0x0;var _0x238489=_0x4a78[_0x56aebd];return _0x238489;};'use strict';var client=require(_0x84a7('0x0'));exports['getVoiceQueueRtPauses']=function(_0x454fc1){return function(){return client[_0x84a7('0x1')](_0x84a7('0x2'),{'options':{'where':{'VoiceQueueId':_0x454fc1,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xbaae=['../client','getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x8913ef,_0x2c564d){var _0x25fcc5=function(_0xcec5cc){while(--_0xcec5cc){_0x8913ef['push'](_0x8913ef['shift']());}};_0x25fcc5(++_0x2c564d);}(_0xbaae,0x84));var _0xebaa=function(_0x3d25b3,_0x7e2507){_0x3d25b3=_0x3d25b3-0x0;var _0x1e5086=_0xbaae[_0x3d25b3];return _0x1e5086;};'use strict';var client=require(_0xebaa('0x0'));exports[_0xebaa('0x1')]=function(_0x5bb9ae){return function(){return client['Request'](_0xebaa('0x2'),{'options':{'where':{'VoiceQueueId':_0x5bb9ae,'paused':!![]},'raw':!![]},'log':_0xebaa('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 6f5b596..85868f5 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(_0x428b59,_0x45f1e8){var _0x337453=function(_0x484e63){while(--_0x484e63){_0x428b59['push'](_0x428b59['shift']());}};_0x337453(++_0x45f1e8);}(_0x7a54,0x106));var _0x47a5=function(_0x227b2b,_0x512950){_0x227b2b=_0x227b2b-0x0;var _0x22a9e6=_0x7a54[_0x227b2b];return _0x22a9e6;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x5478aa,_0x6779be){var _0x3d169a=function(_0x29d7cd){while(--_0x29d7cd){_0x5478aa['push'](_0x5478aa['shift']());}};_0x3d169a(++_0x6779be);}(_0x7a54,0x106));var _0x47a5=function(_0x35f6e1,_0x5f025d){_0x35f6e1=_0x35f6e1-0x0;var _0x625c25=_0x7a54[_0x35f6e1];return _0x625c25;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 24c4f36..b062cc0 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 _0xaea0=['result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfererexten','transfererlinkedid','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','extension','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport'];(function(_0x18532f,_0x3d4b93){var _0x1ba3b1=function(_0x18907f){while(--_0x18907f){_0x18532f['push'](_0x18532f['shift']());}};_0x1ba3b1(++_0x3d4b93);}(_0xaea0,0x149));var _0x0aea=function(_0x230e39,_0x5341){_0x230e39=_0x230e39-0x0;var _0xa804e=_0xaea0[_0x230e39];return _0xa804e;};'use strict';var client=require('../client');exports[_0x0aea('0x0')]={};exports[_0x0aea('0x1')]=function(_0x20a019){return client[_0x0aea('0x2')](_0x0aea('0x3'),{'body':{'result':_0x20a019[_0x0aea('0x4')],'transfererchannel':_0x20a019[_0x0aea('0x5')],'transferercalleridnum':_0x20a019[_0x0aea('0x6')],'transferercalleridname':_0x20a019[_0x0aea('0x7')],'transfererconnectedlinenum':_0x20a019[_0x0aea('0x8')],'transfererconnectedlinename':_0x20a019[_0x0aea('0x9')],'transfereraccountcode':_0x20a019['transfereraccountcode'],'transferercontext':_0x20a019['transferercontext'],'transfererexten':_0x20a019[_0x0aea('0xa')],'transfererlinkedid':_0x20a019[_0x0aea('0xb')],'transfereechannel':_0x20a019['transfereechannel'],'transfereecalleridnum':_0x20a019['transfereecalleridnum'],'transfereecalleridname':_0x20a019[_0x0aea('0xc')],'transfereeconnectedlinenum':_0x20a019['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x20a019[_0x0aea('0xd')],'transfereeaccountcode':_0x20a019[_0x0aea('0xe')],'transfereecontext':_0x20a019[_0x0aea('0xf')],'transfereeexten':_0x20a019[_0x0aea('0x10')],'transfereelinkedid':_0x20a019['transfereelinkedid'],'isexternal':_0x20a019[_0x0aea('0x11')],'context':_0x20a019['context'],'extension':_0x20a019[_0x0aea('0x12')],'type':'blind'},'log':_0x0aea('0x3')});};exports[_0x0aea('0x13')]=function(_0x2407ab){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x2407ab[_0x0aea('0x4')],'transfererchannel':_0x2407ab[_0x0aea('0x14')],'transferercalleridnum':_0x2407ab['origtransferercalleridnum'],'transferercalleridname':_0x2407ab[_0x0aea('0x15')],'transfererconnectedlinenum':_0x2407ab['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2407ab[_0x0aea('0x16')],'transfereraccountcode':_0x2407ab[_0x0aea('0x17')],'transferercontext':_0x2407ab[_0x0aea('0x18')],'transfererexten':_0x2407ab['secondtransfererexten'],'transfererlinkedid':_0x2407ab[_0x0aea('0x19')],'transfereechannel':_0x2407ab[_0x0aea('0x1a')],'transfereecalleridnum':_0x2407ab[_0x0aea('0x1b')],'transfereecalleridname':_0x2407ab[_0x0aea('0x1c')],'transfereeconnectedlinenum':_0x2407ab[_0x0aea('0x1d')],'transfereeconnectedlinename':_0x2407ab[_0x0aea('0x1e')],'transfereeaccountcode':_0x2407ab[_0x0aea('0x1f')],'transfereecontext':_0x2407ab[_0x0aea('0x20')],'transfereeexten':_0x2407ab[_0x0aea('0x21')],'transfereelinkedid':_0x2407ab[_0x0aea('0x22')],'isexternal':_0x2407ab[_0x0aea('0x11')],'context':_0x2407ab['origtransferercontext'],'extension':_0x2407ab[_0x0aea('0x23')],'type':_0x0aea('0x24')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x7093=['transfererexten','transfereechannel','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','context','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext'];(function(_0x546b92,_0x62250c){var _0x43b5a4=function(_0x479755){while(--_0x479755){_0x546b92['push'](_0x546b92['shift']());}};_0x43b5a4(++_0x62250c);}(_0x7093,0x19a));var _0x3709=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7093[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x3709('0x0'));exports[_0x3709('0x1')]={};exports[_0x3709('0x2')]=function(_0x13a195){return client['Request'](_0x3709('0x3'),{'body':{'result':_0x13a195[_0x3709('0x4')],'transfererchannel':_0x13a195['transfererchannel'],'transferercalleridnum':_0x13a195[_0x3709('0x5')],'transferercalleridname':_0x13a195[_0x3709('0x6')],'transfererconnectedlinenum':_0x13a195['transfererconnectedlinenum'],'transfererconnectedlinename':_0x13a195[_0x3709('0x7')],'transfereraccountcode':_0x13a195[_0x3709('0x8')],'transferercontext':_0x13a195[_0x3709('0x9')],'transfererexten':_0x13a195[_0x3709('0xa')],'transfererlinkedid':_0x13a195['transfererlinkedid'],'transfereechannel':_0x13a195[_0x3709('0xb')],'transfereecalleridnum':_0x13a195['transfereecalleridnum'],'transfereecalleridname':_0x13a195['transfereecalleridname'],'transfereeconnectedlinenum':_0x13a195[_0x3709('0xc')],'transfereeconnectedlinename':_0x13a195[_0x3709('0xd')],'transfereeaccountcode':_0x13a195[_0x3709('0xe')],'transfereecontext':_0x13a195['transfereecontext'],'transfereeexten':_0x13a195[_0x3709('0xf')],'transfereelinkedid':_0x13a195[_0x3709('0x10')],'isexternal':_0x13a195['isexternal'],'context':_0x13a195[_0x3709('0x11')],'extension':_0x13a195['extension'],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x42cb66){return client['Request'](_0x3709('0x3'),{'body':{'result':_0x42cb66[_0x3709('0x4')],'transfererchannel':_0x42cb66[_0x3709('0x12')],'transferercalleridnum':_0x42cb66[_0x3709('0x13')],'transferercalleridname':_0x42cb66['origtransferercalleridname'],'transfererconnectedlinenum':_0x42cb66[_0x3709('0x14')],'transfererconnectedlinename':_0x42cb66[_0x3709('0x15')],'transfereraccountcode':_0x42cb66[_0x3709('0x16')],'transferercontext':_0x42cb66[_0x3709('0x17')],'transfererexten':_0x42cb66['secondtransfererexten'],'transfererlinkedid':_0x42cb66[_0x3709('0x18')],'transfereechannel':_0x42cb66[_0x3709('0x19')],'transfereecalleridnum':_0x42cb66[_0x3709('0x1a')],'transfereecalleridname':_0x42cb66[_0x3709('0x1b')],'transfereeconnectedlinenum':_0x42cb66['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x42cb66['transfertargetconnectedlinename'],'transfereeaccountcode':_0x42cb66[_0x3709('0x1c')],'transfereecontext':_0x42cb66[_0x3709('0x1d')],'transfereeexten':_0x42cb66['transfertargetexten'],'transfereelinkedid':_0x42cb66[_0x3709('0x1e')],'isexternal':_0x42cb66[_0x3709('0x1f')],'context':_0x42cb66[_0x3709('0x20')],'extension':_0x42cb66[_0x3709('0x21')],'type':_0x3709('0x22')},'log':_0x3709('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index d946747..53e6b70 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x4f9669,_0x1c44b2){var _0x594a60=function(_0x771d6b){while(--_0x771d6b){_0x4f9669['push'](_0x4f9669['shift']());}};_0x594a60(++_0x1c44b2);}(_0xb10b,0x12a));var _0xbb10=function(_0x549444,_0x41c180){_0x549444=_0x549444-0x0;var _0x2348d2=_0xb10b[_0x549444];return _0x2348d2;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x317ddf,_0x16fb1d){var _0x549b57=function(_0x1ca2c6){while(--_0x1ca2c6){_0x317ddf['push'](_0x317ddf['shift']());}};_0x549b57(++_0x16fb1d);}(_0xb10b,0x12a));var _0xbb10=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xb10b[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index d50b607..9c238bd 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 _0x7854=['redis','defaults','localhost','socket.io-emitter','emit','exec','data1','data2','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','resolve','then','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','trigger:%s','action','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x7854,0x189));var _0x4785=function(_0x3e7804,_0x121853){_0x3e7804=_0x3e7804-0x0;var _0x56efda=_0x7854[_0x3e7804];return _0x56efda;};'use strict';var _=require(_0x4785('0x0'));var BPromise=require(_0x4785('0x1'));var Redis=require('ioredis');var util=require(_0x4785('0x2'));var config=require(_0x4785('0x3'));var logger=require(_0x4785('0x4'))('trigger');var cmContactRpc=require(_0x4785('0x5'));config[_0x4785('0x6')]=_[_0x4785('0x7')](config[_0x4785('0x6')],{'host':_0x4785('0x8'),'port':0x18eb});var io=require(_0x4785('0x9'))(new Redis(config[_0x4785('0x6')]));function emit(_0x2e8ec3,_0x19551a,_0x747087,_0x57d2a8,_0x3ee4cf){logger['info']('[CM][%s][%s]',_0x2e8ec3,_0x19551a['id'],_0x747087,_0x57d2a8,JSON['stringify'](_0x3ee4cf));io['to'](_0x747087)[_0x4785('0xa')](_0x57d2a8,_0x3ee4cf);}exports[_0x4785('0xb')]=function(_0x18bb99,_0x17a0ff,_0x3d6c4c,_0x53e1c5){var _0x41eb42,_0x1bd82c;var _0x51d7c8={};var _0x249b6b;var _0x1a3935=Number(_0x3d6c4c[_0x4785('0xc')]);var _0x20f8fb=_0x3d6c4c['data2']?Boolean(Number(_0x3d6c4c[_0x4785('0xd')])):![];var _0x1ca085;var _0xfc2a9c=![];if(!_['isNil'](_0x3d6c4c['data5'])){if(_0x3d6c4c[_0x4785('0xe')]=='1')_0xfc2a9c=!![];}if(!_0xfc2a9c){if(_0x53e1c5[_0x4785('0xf')]){_0x51d7c8['id']=_0x53e1c5['xmd-contactid'];}}if(!_0x51d7c8['id']){_0x51d7c8[_0x4785('0x10')]=_0x1a3935;_0x1ca085=_0x3d6c4c[_0x4785('0x11')]&&_0x3d6c4c[_0x4785('0x11')]!=='0'?_0x3d6c4c[_0x4785('0x11')][_0x4785('0x12')](','):[_0x4785('0x13')];_0x51d7c8[_0x4785('0x14')]=_[_0x4785('0x15')](_0x1ca085,function(_0x255e3f){var _0x397bf9={};_0x397bf9[_0x255e3f]=_0x53e1c5[_0x4785('0x16')]?_0x53e1c5[_0x4785('0x17')]:_0x53e1c5[_0x4785('0x18')];return _0x397bf9;});_0x249b6b=_0x53e1c5[_0x4785('0x16')]?_0x53e1c5[_0x4785('0x17')]:_0x53e1c5['calleridnum'];}var _0x4f4ccd=['id',_0x4785('0x19'),_0x4785('0x1a'),_0x4785('0x13'),_0x4785('0x1b'),_0x4785('0x1c'),_0x4785('0x10'),_0x4785('0x1d'),_0x4785('0x1e'),_0x4785('0x1f')];var _0x38d1e1=_['union'](_0x4f4ccd,_0x1ca085);BPromise[_0x4785('0x20')]()[_0x4785('0x21')](cmContactRpc['getContacts']({'attributes':_0x38d1e1,'where':_0x51d7c8,'phone':_0x249b6b}))[_0x4785('0x21')](function(_0x553502){_0x1bd82c=_0x553502;if(!_[_0x4785('0x22')](_0x1bd82c)){if(_0x1bd82c[_0x4785('0x23')]===0x1){_0x41eb42=_0x1bd82c[0x0];logger[_0x4785('0x24')](_0x4785('0x25'),_0x53e1c5[_0x4785('0x26')],_0x17a0ff['id'],_0x41eb42['id']);}else{logger[_0x4785('0x24')](_0x4785('0x27'),_0x53e1c5['uniqueid'],_0x17a0ff['id'],_[_0x4785('0x15')](_0x1bd82c,'id')[_0x4785('0x28')](','));}return;}else{logger[_0x4785('0x24')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x53e1c5[_0x4785('0x26')],_0x17a0ff['id']);var _0x31f513={'ListId':_0x1a3935};var _0x151c99=_0x3d6c4c['data4']&&_0x3d6c4c['data4']!=='0'?_0x3d6c4c[_0x4785('0x29')]:_0x4785('0x13');if(_0x20f8fb){logger[_0x4785('0x24')](_0x4785('0x2a'),_0x53e1c5[_0x4785('0x26')],_0x17a0ff['id']);_0x31f513[_0x151c99]=_[_0x4785('0x2b')](_0x53e1c5['routeId'])?_0x53e1c5[_0x4785('0x18')]:_0x53e1c5['destcalleridnum'];if(_[_0x4785('0x2b')](_0x53e1c5[_0x4785('0x16')])){_0x31f513['firstName']=_0x53e1c5['calleridname']&&_0x53e1c5[_0x4785('0x2c')]!==_0x4785('0x2d')?_0x53e1c5[_0x4785('0x2c')]:'Unknown';}else{_0x31f513[_0x4785('0x19')]=_0x53e1c5[_0x4785('0x2e')]&&_0x53e1c5['destcalleridname']!==_0x4785('0x2d')?_0x53e1c5[_0x4785('0x2e')]:_0x4785('0x2f');}return BPromise['resolve']()[_0x4785('0x21')](cmContactRpc[_0x4785('0x30')](_0x31f513))[_0x4785('0x21')](function(_0x526e57){_0x41eb42=_0x526e57;_0x1bd82c[_0x4785('0x31')](_0x526e57);if(_0x41eb42){logger[_0x4785('0x24')](_0x4785('0x32'),_0x53e1c5[_0x4785('0x26')],_0x17a0ff['id'],_0x41eb42['id']);}return;});}else{logger['info'](_0x4785('0x33'),_0x53e1c5[_0x4785('0x26')],_0x17a0ff['id']);_0x31f513[_0x151c99]=_[_0x4785('0x2b')](_0x53e1c5['routeId'])?_0x53e1c5['calleridnum']:_0x53e1c5[_0x4785('0x17')];if(_[_0x4785('0x2b')](_0x53e1c5[_0x4785('0x16')])){_0x31f513['firstName']=_0x53e1c5[_0x4785('0x2c')]&&_0x53e1c5[_0x4785('0x2c')]!==_0x4785('0x2d')?_0x53e1c5[_0x4785('0x2c')]:_0x4785('0x2f');}else{_0x31f513[_0x4785('0x19')]=_0x53e1c5['destcalleridname']&&_0x53e1c5['destcalleridname']!==_0x4785('0x2d')?_0x53e1c5[_0x4785('0x2e')]:_0x4785('0x2f');}_0x41eb42=_0x31f513;_0x1bd82c[_0x4785('0x31')](_0x31f513);return;}}})[_0x4785('0x21')](function(){if(_0x18bb99){emit(_0x53e1c5['uniqueid'],_0x17a0ff,util[_0x4785('0x34')]('user:%s',_0x18bb99['name']),util['format'](_0x4785('0x35'),_0x3d6c4c[_0x4785('0x36')][_0x4785('0x37')]()),{'evt':_[_0x4785('0x38')](_0x53e1c5,{'autoCreate':_0x20f8fb}),'contact':_0x41eb42===undefined?{}:_0x41eb42,'contacts':_0x1bd82c[_0x4785('0x23')]===0x0?undefined:_0x1bd82c});}});}; \ No newline at end of file +var _0xbc95=['then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','calleridname','format','user:%s','name','trigger:%s','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','redis','defaults','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','xmd-contactid','ListId','data3','$or','map','routeId','destcalleridnum','calleridnum','firstName','phone','mobile','fax','createdAt','union','resolve'];(function(_0x49b9d6,_0x36aabb){var _0x12a647=function(_0x4221b9){while(--_0x4221b9){_0x49b9d6['push'](_0x49b9d6['shift']());}};_0x12a647(++_0x36aabb);}(_0xbc95,0x1f4));var _0x5bc9=function(_0x264814,_0x4433db){_0x264814=_0x264814-0x0;var _0xf180c7=_0xbc95[_0x264814];return _0xf180c7;};'use strict';var _=require(_0x5bc9('0x0'));var BPromise=require(_0x5bc9('0x1'));var Redis=require(_0x5bc9('0x2'));var util=require(_0x5bc9('0x3'));var config=require(_0x5bc9('0x4'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require('../../rpc/cmContact');config[_0x5bc9('0x5')]=_[_0x5bc9('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5bc9('0x5')]));function emit(_0x5c02e9,_0x2fb0a2,_0x4bdc20,_0x49ab1a,_0x6cc9f1){logger[_0x5bc9('0x7')](_0x5bc9('0x8'),_0x5c02e9,_0x2fb0a2['id'],_0x4bdc20,_0x49ab1a,JSON[_0x5bc9('0x9')](_0x6cc9f1));io['to'](_0x4bdc20)[_0x5bc9('0xa')](_0x49ab1a,_0x6cc9f1);}exports[_0x5bc9('0xb')]=function(_0x4ae726,_0x404864,_0x4ad1c0,_0x5bdb3d){var _0x307030,_0x5c6238;var _0x1ee592={};var _0x13aeb6;var _0x144f1c=Number(_0x4ad1c0[_0x5bc9('0xc')]);var _0x357ad6=_0x4ad1c0['data2']?Boolean(Number(_0x4ad1c0[_0x5bc9('0xd')])):![];var _0x3a23c0;var _0x575a95=![];if(!_[_0x5bc9('0xe')](_0x4ad1c0['data5'])){if(_0x4ad1c0['data5']=='1')_0x575a95=!![];}if(!_0x575a95){if(_0x5bdb3d[_0x5bc9('0xf')]){_0x1ee592['id']=_0x5bdb3d[_0x5bc9('0xf')];}}if(!_0x1ee592['id']){_0x1ee592[_0x5bc9('0x10')]=_0x144f1c;_0x3a23c0=_0x4ad1c0[_0x5bc9('0x11')]&&_0x4ad1c0[_0x5bc9('0x11')]!=='0'?_0x4ad1c0[_0x5bc9('0x11')]['split'](','):['phone'];_0x1ee592[_0x5bc9('0x12')]=_[_0x5bc9('0x13')](_0x3a23c0,function(_0x59e5f1){var _0x2aa0bb={};_0x2aa0bb[_0x59e5f1]=_0x5bdb3d[_0x5bc9('0x14')]?_0x5bdb3d[_0x5bc9('0x15')]:_0x5bdb3d['calleridnum'];return _0x2aa0bb;});_0x13aeb6=_0x5bdb3d[_0x5bc9('0x14')]?_0x5bdb3d[_0x5bc9('0x15')]:_0x5bdb3d[_0x5bc9('0x16')];}var _0x502dc0=['id',_0x5bc9('0x17'),'lastName',_0x5bc9('0x18'),_0x5bc9('0x19'),_0x5bc9('0x1a'),_0x5bc9('0x10'),_0x5bc9('0x1b'),'scheduledAt','updatedAt'];var _0x40d58e=_[_0x5bc9('0x1c')](_0x502dc0,_0x3a23c0);BPromise[_0x5bc9('0x1d')]()[_0x5bc9('0x1e')](cmContactRpc[_0x5bc9('0x1f')]({'attributes':_0x40d58e,'where':_0x1ee592,'phone':_0x13aeb6}))[_0x5bc9('0x1e')](function(_0x168056){_0x5c6238=_0x168056;if(!_[_0x5bc9('0x20')](_0x5c6238)){if(_0x5c6238[_0x5bc9('0x21')]===0x1){_0x307030=_0x5c6238[0x0];logger['info'](_0x5bc9('0x22'),_0x5bdb3d[_0x5bc9('0x23')],_0x404864['id'],_0x307030['id']);}else{logger[_0x5bc9('0x7')](_0x5bc9('0x24'),_0x5bdb3d['uniqueid'],_0x404864['id'],_[_0x5bc9('0x13')](_0x5c6238,'id')['join'](','));}return;}else{logger[_0x5bc9('0x7')](_0x5bc9('0x25'),_0x5bdb3d[_0x5bc9('0x23')],_0x404864['id']);var _0x15da5d={'ListId':_0x144f1c};var _0x586575=_0x4ad1c0[_0x5bc9('0x26')]&&_0x4ad1c0['data4']!=='0'?_0x4ad1c0['data4']:_0x5bc9('0x18');if(_0x357ad6){logger['info'](_0x5bc9('0x27'),_0x5bdb3d['uniqueid'],_0x404864['id']);_0x15da5d[_0x586575]=_['isNil'](_0x5bdb3d[_0x5bc9('0x14')])?_0x5bdb3d[_0x5bc9('0x16')]:_0x5bdb3d[_0x5bc9('0x15')];if(_[_0x5bc9('0xe')](_0x5bdb3d[_0x5bc9('0x14')])){_0x15da5d[_0x5bc9('0x17')]=_0x5bdb3d['calleridname']&&_0x5bdb3d['calleridname']!==''?_0x5bdb3d['calleridname']:_0x5bc9('0x28');}else{_0x15da5d[_0x5bc9('0x17')]=_0x5bdb3d[_0x5bc9('0x29')]&&_0x5bdb3d[_0x5bc9('0x29')]!==_0x5bc9('0x2a')?_0x5bdb3d[_0x5bc9('0x29')]:_0x5bc9('0x28');}return BPromise[_0x5bc9('0x1d')]()['then'](cmContactRpc[_0x5bc9('0x2b')](_0x15da5d))['then'](function(_0x4def17){_0x307030=_0x4def17;_0x5c6238[_0x5bc9('0x2c')](_0x4def17);if(_0x307030){logger[_0x5bc9('0x7')](_0x5bc9('0x2d'),_0x5bdb3d['uniqueid'],_0x404864['id'],_0x307030['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x5bdb3d[_0x5bc9('0x23')],_0x404864['id']);_0x15da5d[_0x586575]=_[_0x5bc9('0xe')](_0x5bdb3d[_0x5bc9('0x14')])?_0x5bdb3d[_0x5bc9('0x16')]:_0x5bdb3d[_0x5bc9('0x15')];if(_[_0x5bc9('0xe')](_0x5bdb3d[_0x5bc9('0x14')])){_0x15da5d[_0x5bc9('0x17')]=_0x5bdb3d['calleridname']&&_0x5bdb3d[_0x5bc9('0x2e')]!==_0x5bc9('0x2a')?_0x5bdb3d[_0x5bc9('0x2e')]:_0x5bc9('0x28');}else{_0x15da5d[_0x5bc9('0x17')]=_0x5bdb3d[_0x5bc9('0x29')]&&_0x5bdb3d[_0x5bc9('0x29')]!==''?_0x5bdb3d['destcalleridname']:_0x5bc9('0x28');}_0x307030=_0x15da5d;_0x5c6238[_0x5bc9('0x2c')](_0x15da5d);return;}}})[_0x5bc9('0x1e')](function(){if(_0x4ae726){emit(_0x5bdb3d[_0x5bc9('0x23')],_0x404864,util[_0x5bc9('0x2f')](_0x5bc9('0x30'),_0x4ae726[_0x5bc9('0x31')]),util[_0x5bc9('0x2f')](_0x5bc9('0x32'),_0x4ad1c0['action'][_0x5bc9('0x33')]()),{'evt':_[_0x5bc9('0x34')](_0x5bdb3d,{'autoCreate':_0x357ad6}),'contact':_0x307030===undefined?{}:_0x307030,'contacts':_0x5c6238[_0x5bc9('0x21')]===0x0?undefined:_0x5c6238});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index ef8482d..dd00a2b 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 _0x8239=['dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','emit','info','stringify','prototype','clone','motionChannel','voice','debug','inspect','checkTriggers','interface','hasOwnProperty','checkTrigger','merge','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','data1','popup','TemplateId','templates','data2','html','template\x20not\x20found','url','uri','buildUri','isNil','data3','data4','location','data5','data6','winApplication','render','winArguments','format','user:%s','name','trigger:%s:%s','trigger:%s','exec','integration','voiceQueues','queue','routeId','urlforward','script','parse','query','search','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','checkTrigger:\x20trigger','evt','field','account','chat','ChatWebsiteId','value','upperFirst','AccountId','operator','event','membername','lastevent','mailSubstatus','null','substatus','undefined','offlineMessage','created','exports','util','lodash','ioredis','./urlforward','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','winapp','triggers','agents','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8239,0x177));var _0x9823=function(_0x321219,_0xed0598){_0x321219=_0x321219-0x0;var _0x3f25f6=_0x8239[_0x321219];return _0x3f25f6;};'use strict';var util=require(_0x9823('0x0'));var _=require(_0x9823('0x1'));var url=require('url');var Mustache=require('mustache');var Redis=require(_0x9823('0x2'));var urlforward=require(_0x9823('0x3'));var integration=require('./integration');var cmContact=require('./cmContact');var script=require(_0x9823('0x4'));var config=require(_0x9823('0x5'));var logger=require(_0x9823('0x6'))(_0x9823('0x7'));var ami=require(_0x9823('0x8'));config[_0x9823('0x9')]=_['defaults'](config[_0x9823('0x9')],{'host':_0x9823('0xa'),'port':0x18eb});var io=require(_0x9823('0xb'))(new Redis(config['redis']));var operators={'equals':function(_0x431897,_0xddd17a){return _0x431897==_0xddd17a;},'not_equals':function(_0x35e642,_0x569d07){return _0x35e642!=_0x569d07;}};var barAndWebActions=['popup','url',_0x9823('0xc')];function Trigger(_0x19151e){this[_0x9823('0xd')]=_0x19151e[_0x9823('0xd')];this[_0x9823('0xe')]=_0x19151e[_0x9823('0xe')];this['voiceQueues']=_0x19151e['voiceQueues'];this['templates']=_0x19151e['templates'];this[_0x9823('0xf')]=_0x19151e['voiceExtensions'];this[_0x9823('0x10')]=_0x19151e[_0x9823('0x10')];this[_0x9823('0x11')]=_0x19151e[_0x9823('0x11')];this[_0x9823('0x12')]=_0x19151e[_0x9823('0x12')];this[_0x9823('0x13')]=_0x19151e[_0x9823('0x13')];this[_0x9823('0x14')]=_0x19151e[_0x9823('0x14')];this['deskAccounts']=_0x19151e[_0x9823('0x15')];this['vtigerAccounts']=_0x19151e[_0x9823('0x16')];this[_0x9823('0x17')]=_0x19151e[_0x9823('0x17')];this[_0x9823('0x18')]=_0x19151e['dynamics365Accounts'];this[_0x9823('0x19')]=_0x19151e[_0x9823('0x19')];this[_0x9823('0x1a')]={'zendesk':this[_0x9823('0x10')],'salesforce':this[_0x9823('0x12')],'freshdesk':this[_0x9823('0x11')],'sugarcrm':this[_0x9823('0x13')],'zoho':this[_0x9823('0x14')],'desk':this[_0x9823('0x15')],'vtiger':this[_0x9823('0x16')],'dynamics365':this[_0x9823('0x18')],'freshsales':this[_0x9823('0x19')],'servicenow':this[_0x9823('0x17')]};ami['on'](_0x9823('0x1b'),this[_0x9823('0x1c')][_0x9823('0x1d')](this));ami['on'](_0x9823('0x1e'),this[_0x9823('0x1c')][_0x9823('0x1d')](this));ami['on'](_0x9823('0x1f'),this['syncCustomEvent']['bind'](this));ami['on'](_0x9823('0x20'),this[_0x9823('0x1c')][_0x9823('0x1d')](this));ami['on'](_0x9823('0x21'),this['syncCustomEvent'][_0x9823('0x1d')](this));ami['on'](_0x9823('0x22'),this[_0x9823('0x1c')]['bind'](this));ami['on'](_0x9823('0x23'),this['syncCustomEvent'][_0x9823('0x1d')](this));ami['on'](_0x9823('0x24'),this[_0x9823('0x1c')][_0x9823('0x1d')](this));ami['on']('custom:agentreject',this[_0x9823('0x1c')]['bind'](this));ami['on'](_0x9823('0x25'),this['syncCustomEvent'][_0x9823('0x1d')](this));ami['on'](_0x9823('0x26'),this[_0x9823('0x1c')][_0x9823('0x1d')](this));ami['on'](_0x9823('0x27'),this[_0x9823('0x1c')][_0x9823('0x1d')](this));ami['on'](_0x9823('0x28'),this[_0x9823('0x29')][_0x9823('0x1d')](this));ami['on'](_0x9823('0x2a'),this[_0x9823('0x29')][_0x9823('0x1d')](this));ami['on'](_0x9823('0x2b'),this['syncAgentDial']['bind'](this));ami['on'](_0x9823('0x2c'),this[_0x9823('0x1c')][_0x9823('0x1d')](this));ami['on']('custom:closedinteraction',this['syncCustomEvent'][_0x9823('0x1d')](this));ami['on'](_0x9823('0x2d'),this[_0x9823('0x1c')][_0x9823('0x1d')](this));ami['on'](_0x9823('0x2e'),this[_0x9823('0x1c')]['bind'](this));ami['on'](_0x9823('0x2f'),this[_0x9823('0x1c')]['bind'](this));ami['on'](_0x9823('0x30'),this[_0x9823('0x1c')][_0x9823('0x1d')](this));ami['on'](_0x9823('0x31'),this[_0x9823('0x1c')]['bind'](this));ami['on'](_0x9823('0x32'),this['syncCustomEvent'][_0x9823('0x1d')](this));}Trigger['prototype'][_0x9823('0x33')]=function(_0x4a456c,_0x5091d4,_0x2a56d5){logger[_0x9823('0x34')](_0x4a456c,_0x5091d4,JSON[_0x9823('0x35')](_0x2a56d5));io['to'](_0x4a456c)[_0x9823('0x33')](_0x5091d4,_0x2a56d5);};Trigger[_0x9823('0x36')][_0x9823('0x1c')]=function(_0xb1e51f){var _0x206fef=_[_0x9823('0x37')](_0xb1e51f);if(typeof _0x206fef[_0x9823('0x38')]==='undefined'){_0x206fef[_0x9823('0x38')]=_0x9823('0x39');}logger[_0x9823('0x3a')](_0x9823('0x1c'),util[_0x9823('0x3b')](_0x206fef,{'showHidden':!![],'depth':null}));this[_0x9823('0x3c')](_0x206fef);};Trigger['prototype'][_0x9823('0x29')]=function(_0x2c2bd3){if(this[_0x9823('0xe')][_0x2c2bd3[_0x9823('0x3d')]]){this['syncCustomEvent'](_0x2c2bd3);}};Trigger[_0x9823('0x36')][_0x9823('0x3c')]=function(_0x1ff90b){var _0x31c192;for(var _0x27eeba in this['triggers']){if(this[_0x9823('0xd')][_0x9823('0x3e')](_0x27eeba)){if(this[_0x9823('0xd')][_0x27eeba]['status']){_0x31c192=this[_0x9823('0x3f')](this[_0x9823('0xd')][_0x27eeba],_0x1ff90b);if(_0x31c192){_[_0x9823('0x40')](_0x1ff90b,_0x1ff90b['variables']);for(var _0x5341d7=0x0,_0x12583c,_0x5c0448,_0x5bffee;_0x5341d70x0){_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 _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x3066a7,_0x3e7ef8){var _0x2cc20d=function(_0x57f15b){while(--_0x57f15b){_0x3066a7['push'](_0x3066a7['shift']());}};_0x2cc20d(++_0x3e7ef8);}(_0x3e74,0x175));var _0x43e7=function(_0x418fee,_0x3e5fdc){_0x418fee=_0x418fee-0x0;var _0x3c37cc=_0x3e74[_0x418fee];return _0x3c37cc;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ 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 d3e3e9e..c00611d 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 _0x5684=['nameField','substring','indexOf','content','ticketType','incidents','assign','Subjects','getString','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','serverUrl','stripTrailingSlash','unmanaged','outbound','%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','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','POST','clientId','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','userEmail','internalemailaddress','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','toLowerCase','calleridnum','contacts','/systemusers(','Bearer\x20','body','lastIndexOf','enduserId','destcalleridnum','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','length',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','type'];(function(_0xc9373a,_0xdf8bf2){var _0x4d6d61=function(_0x5120dc){while(--_0x5120dc){_0xc9373a['push'](_0xc9373a['shift']());}};_0x4d6d61(++_0xdf8bf2);}(_0x5684,0x9d));var _0x4568=function(_0x392c17,_0x392eb1){_0x392c17=_0x392c17-0x0;var _0x119c6c=_0x5684[_0x392c17];return _0x119c6c;};'use strict';var _=require(_0x4568('0x0'));var rp=require(_0x4568('0x1'));var util=require(_0x4568('0x2'));var intUtil=require(_0x4568('0x3'));var md5=require(_0x4568('0x4'));var Redis=require(_0x4568('0x5'));var logger=require(_0x4568('0x6'))(_0x4568('0x7'));var config=require('../../../../config/environment');config[_0x4568('0x8')]=_[_0x4568('0x9')](config[_0x4568('0x8')],{'host':_0x4568('0xa'),'port':0x18eb});var io=require(_0x4568('0xb'))(new Redis(config[_0x4568('0x8')]));function getAuthToken(_0x5a5496,_0x327006,_0x30d4b1){if(_0x5a5496[_0x4568('0xc')]){_0x5a5496[_0x4568('0xd')]=_0x5a5496[_0x4568('0xe')][_0x4568('0xf')];_0x5a5496[_0x4568('0x10')]=_0x5a5496[_0x4568('0xe')][_0x4568('0x11')];return Promise[_0x4568('0x12')](_0x5a5496[_0x4568('0xe')]['data5']);}var _0x469e16={'method':_0x4568('0x13'),'uri':_0x327006,'form':{'client_id':_0x5a5496[_0x4568('0x14')],'resource':_0x5a5496[_0x4568('0xd')],'username':_0x5a5496['username'],'password':_0x5a5496['password'],'grant_type':_0x4568('0x15'),'client_secret':_0x5a5496['clientSecret']},'json':!![]};return rp(_0x469e16)[_0x4568('0x16')](function(_0x1d1e43){return _0x1d1e43[_0x4568('0x17')];})[_0x4568('0x18')](function(_0x1bc520){logger[_0x4568('0x19')]('['+[_0x30d4b1[_0x4568('0x1a')]()]+_0x4568('0x1b'));return _0x1bc520[_0x4568('0x1c')];});}function getUser(_0x980a7c,_0x1295dd,_0x172a85,_0xaac23,_0x267817,_0x20c797){return new Promise(function(_0x218d4b,_0x5ddfd4){return getAuthToken(_0x1295dd,_0xaac23,_0x20c797)[_0x4568('0x16')](function(_0x55d40c){var _0xd6f445={'method':_0x4568('0x1d'),'uri':_0x267817+_0x4568('0x1e'),'headers':{'Authorization':'Bearer\x20'+_0x55d40c,'OData-Version':_0x4568('0x1f')},'json':!![]};return rp(_0xd6f445);})[_0x4568('0x16')](function(_0x41459a){var _0x4c8904=_0x41459a[_0x4568('0x20')];var _0xa76944=![];var _0x2fba71=null;if(!_[_0x4568('0x21')](_0x172a85)){if(intUtil[_0x4568('0x22')](_0x172a85[_0x4568('0x23')])){_0x980a7c[_0x4568('0x24')]=_0x172a85[_0x4568('0x23')];for(_0x2fba71=0x0;_0x2fba71<_0x4c8904['length'];_0x2fba71++){if(_0x4c8904[_0x2fba71][_0x4568('0x25')]===_0x172a85['email']&&!_0x4c8904[_0x2fba71]['isdisabled']){_0xa76944=!![];logger[_0x4568('0x26')]('['+[_0x20c797['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x4c8904[_0x2fba71][_0x4568('0x27')]+'!');_0x980a7c['userId']=_0x4c8904[_0x2fba71][_0x4568('0x27')];}}}}if(!_0xa76944){logger[_0x4568('0x26')]('['+[_0x20c797[_0x4568('0x1a')]()]+_0x4568('0x28'));_0x980a7c[_0x4568('0x24')]=_0x1295dd['username'];for(_0x2fba71=0x0;_0x2fba71<_0x4c8904['length'];_0x2fba71++){if(_0x4c8904[_0x2fba71][_0x4568('0x25')]===_0x1295dd['username']){_0x980a7c[_0x4568('0x29')]=_0x4c8904[_0x2fba71][_0x4568('0x27')];}}}_0x218d4b(_0x980a7c);})[_0x4568('0x18')](function(_0x144ce4){_0x5ddfd4(_0x144ce4[_0x4568('0x1c')]);});});}function createEndUser(_0x1b1d73,_0x2ec5f9,_0x3598bb,_0x54091f,_0x2be756,_0x12b311,_0x184868){return new Promise(function(_0x2ed2b8,_0x49fd9b){return getAuthToken(_0x2ec5f9,_0x3598bb,_0x12b311)[_0x4568('0x16')](function(_0x140731){var _0x33d373=_0x12b311[_0x4568('0x2a')]()==='outbound'?_0x2be756['destcalleridnum']:_0x2be756[_0x4568('0x2b')];var _0xd4f2c7={'method':'POST','uri':_0x54091f+_0x4568('0x2c'),'body':{'fullname':_0x33d373,'firstname':_0x33d373,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x4568('0x2d')+_0x1b1d73[_0x4568('0x29')]+')'},'headers':{'Authorization':_0x4568('0x2e')+_0x140731,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0xd4f2c7[_0x4568('0x2f')][_0x184868]=_0x33d373;return rp(_0xd4f2c7);})[_0x4568('0x16')](function(_0x39ec09){var _0x26fde6=_0x39ec09['headers']['odata-entityid'];var _0x4ec666=_0x26fde6['substring'](_0x26fde6['lastIndexOf']('(')+0x1,_0x26fde6[_0x4568('0x30')](')'));_0x1b1d73[_0x4568('0x31')]=_0x4ec666;_0x2ed2b8(_0x1b1d73);})[_0x4568('0x18')](function(_0x325c61){_0x49fd9b(_0x325c61[_0x4568('0x1c')]);});});}function getEndUser(_0x2c79ea,_0x456343,_0x4636e7,_0x33dc6a,_0x1143b7,_0x5aff0f,_0x137d58,_0x4e7ac8){var _0x31971a=_0x5aff0f[_0x4568('0x2a')]()==='outbound'?_0x1143b7[_0x4568('0x32')]:_0x1143b7[_0x4568('0x2b')];return getAuthToken(_0x456343,_0x4636e7,_0x5aff0f)[_0x4568('0x16')](function(_0x5b6549){_0x4e7ac8=_0x4e7ac8?_0x4e7ac8:_0x4568('0x33');var _0x51d266={'method':_0x4568('0x1d'),'uri':_0x33dc6a+_0x4568('0x34')+_0x4e7ac8+_0x4568('0x35')+_0x4e7ac8+_0x4568('0x36')+_0x31971a[_0x4568('0x37')]('+',_0x4568('0x38'))+'\x27','headers':{'Authorization':_0x4568('0x2e')+_0x5b6549,'If-None-Match':null,'OData-Version':_0x4568('0x1f')},'json':!![]};return rp(_0x51d266);})[_0x4568('0x16')](function(_0x4a4a68){var _0x21365e=![];if(!_0x4a4a68)return _0x21365e;var _0x185c1c=_0x4a4a68[_0x4568('0x20')];for(var _0x5e52f3=0x0;_0x5e52f3<_0x185c1c[_0x4568('0x39')];_0x5e52f3++){if(_0x185c1c[_0x5e52f3][_0x4e7ac8]===_0x31971a){_0x21365e=!![];_0x2c79ea[_0x4568('0x31')]=_0x185c1c[_0x5e52f3]['contactid'];}}return _0x21365e;})[_0x4568('0x16')](function(_0x19468f){if(_0x19468f)return _0x2c79ea;if(_0x137d58==='nothing'){logger[_0x4568('0x26')]('['+[_0x5aff0f[_0x4568('0x1a')]()]+_0x4568('0x3a'));return _0x2c79ea;}return createEndUser(_0x2c79ea,_0x456343,_0x4636e7,_0x33dc6a,_0x1143b7,_0x5aff0f,_0x4e7ac8)[_0x4568('0x16')](function(_0x5a0fe5){logger[_0x4568('0x26')]('['+[_0x5aff0f[_0x4568('0x1a')]()]+']\x20Enduser\x20created!',_0x5a0fe5[_0x4568('0x31')]);return _0x5a0fe5;});});}function getCustomFields(_0x4d0767,_0x4a485b,_0x397b5c){var _0x1d1606={};if(_0x4d0767[_0x4568('0x39')]>0x0){_[_0x4568('0x3b')](_0x4d0767,function(_0x333f89){if(_[_0x4568('0x3c')]([_0x4568('0x3d'),'picklist'],_0x333f89[_0x4568('0x3e')])&&_0x333f89[_0x4568('0x3f')]&&!_0x333f89['customField']){var _0x2c5fc7=_0x333f89['idField'][_0x4568('0x2a')]();var _0x21f553=_0x2c5fc7['substring'](0x0,_0x2c5fc7['indexOf']('_'));var _0x30b0c2=_0x2c5fc7[_0x4568('0x40')](_0x2c5fc7[_0x4568('0x41')]('_')+0x1);if(_0x21f553===_0x397b5c){_0x1d1606[_0x30b0c2]=_0x333f89[_0x4568('0x42')];}}});}return _0x1d1606;}function getTicket(_0x52e3ff,_0x5d9f38,_0x1f677a,_0x192ade,_0x5ee0af,_0x39ff0c,_0x119c2e){return new Promise(function(_0x287ed9,_0x127597){var _0x56faa5;return getAuthToken(_0x5d9f38,_0x1f677a,_0x119c2e)['then'](function(_0x122193){if(_0x39ff0c[_0x4568('0x43')]==='incident'){_0x56faa5={'method':'POST','uri':_0x192ade+_0x4568('0x44'),'body':Object[_0x4568('0x45')]({},{'title':intUtil['getString'](_0x39ff0c[_0x4568('0x46')],_0x5ee0af,'\x20'),'description':intUtil[_0x4568('0x47')](_0x39ff0c[_0x4568('0x48')],_0x5ee0af,'\x0a'),'customerid_contact@odata.bind':_0x52e3ff[_0x4568('0x31')]?_0x4568('0x49')+_0x52e3ff[_0x4568('0x31')]+')':undefined,'ownerid@odata.bind':_0x4568('0x2d')+_0x52e3ff[_0x4568('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x39ff0c[_0x4568('0x4a')],_0x5ee0af,_0x39ff0c['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x122193,'OData-Version':_0x4568('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x39ff0c['ticketType']===_0x4568('0x4b')){var _0x2bcb7e=_0x52e3ff['enduserId']?[{'partyid_systemuser@odata.bind':_0x4568('0x2d')+_0x52e3ff['userId']+')','participationtypemask':_0x52e3ff[_0x4568('0x4c')]===_0x4568('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0x4568('0x49')+_0x52e3ff[_0x4568('0x31')]+')','participationtypemask':_0x52e3ff[_0x4568('0x4c')]===_0x4568('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x52e3ff[_0x4568('0x29')]+')','participationtypemask':_0x52e3ff[_0x4568('0x4c')]===_0x4568('0x4d')?0x2:0x1}];_0x56faa5={'method':_0x4568('0x13'),'uri':_0x192ade+_0x4568('0x4e'),'body':Object['assign']({},{'subject':intUtil[_0x4568('0x47')](_0x39ff0c['Subjects'],_0x5ee0af,'\x20'),'phonenumber':String(_0x5ee0af['calleridnum']),'description':intUtil[_0x4568('0x47')](_0x39ff0c[_0x4568('0x48')],_0x5ee0af,'\x0a'),'regardingobjectid_contact@odata.bind':_0x52e3ff[_0x4568('0x31')]?'/contacts('+_0x52e3ff[_0x4568('0x31')]+')':undefined,'ownerid@odata.bind':_0x4568('0x2d')+_0x52e3ff['userId']+')','directioncode':_0x52e3ff[_0x4568('0x4c')]===_0x4568('0x4d')?![]:!![],'phonecall_activity_parties':_0x2bcb7e},getCustomFields(_0x39ff0c[_0x4568('0x4a')],_0x5ee0af,_0x39ff0c['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x122193,'OData-Version':_0x4568('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x56faa5);})[_0x4568('0x16')](function(_0x241a93){var _0x4a83eb=_0x241a93[_0x4568('0x4f')]['odata-entityid'];var _0x5c1b0b=_0x4a83eb[_0x4568('0x40')](_0x4a83eb[_0x4568('0x30')]('(')+0x1,_0x4a83eb[_0x4568('0x30')](')'));_0x52e3ff[_0x4568('0x50')]=_0x5c1b0b;_0x287ed9(_0x52e3ff);})[_0x4568('0x18')](function(_0x2dddc3){_0x127597(_0x2dddc3[_0x4568('0x1c')]);});});}function emit(_0x1fcb20,_0x3d233a,_0x46a25b,_0x8b87f0){var _0x11d07d={'uri':util[_0x4568('0x51')](_0x4568('0x52'),_0x1fcb20,_0x46a25b,_0x8b87f0)};io['to'](util['format'](_0x4568('0x53'),_0x3d233a))[_0x4568('0x54')](_0x4568('0x55'),_0x11d07d);}exports['cs']=function(_0x5365f1,_0x204055,_0x109917,_0x26a171,_0x28a250,_0x4205a2,_0x3202fb,_0x579d0e){var _0x1197d0={};_0x4205a2['remoteUri']=_0x4205a2[_0x4568('0xc')]?intUtil['stripTrailingSlash'](_0x4205a2[_0x4568('0xe')][_0x4568('0xf')]):intUtil['stripTrailingSlash'](_0x4205a2[_0x4568('0xd')]);_0x4205a2[_0x4568('0x56')]=intUtil[_0x4568('0x57')](_0x4205a2['serverUrl']);_0x1197d0['callDirection']=_0x579d0e===_0x4568('0x4d')||_0x579d0e===_0x4568('0x58')?_0x4568('0x4d'):_0x4568('0x59');var _0x36ce9c=_0x4205a2[_0x4568('0xc')]?util['format'](_0x4568('0x5a'),_0x4205a2[_0x4568('0xe')][_0x4568('0xf')]):util[_0x4568('0x51')](_0x4568('0x5a'),_0x4205a2['remoteUri']);var _0x517684=util[_0x4568('0x51')](_0x4568('0x5b'),_0x4205a2[_0x4568('0x10')]);var _0x3befd5=util[_0x4568('0x51')](_0x4568('0x5c'),_0x4205a2[_0x4568('0x56')],_0x204055[_0x4568('0x5d')],md5(_0x204055[_0x4568('0x5d')]));if(_0x28a250&&_0x28a250[_0x4568('0x5e')]){logger[_0x4568('0x26')](_0x4568('0x5f'),_0x4568('0x60'));_0x204055[_0x4568('0x61')]=_0x3befd5;}else if(_0x3202fb&&_0x3202fb[_0x4568('0x62')]&&_0x3202fb[_0x4568('0x62')]!==_0x4568('0x63')){logger[_0x4568('0x26')]('[OUTBOUND]',_0x4568('0x60'));_0x204055[_0x4568('0x61')]=_0x3befd5;}else{_0x204055[_0x4568('0x61')]='';}return getUser(_0x1197d0,_0x4205a2,_0x26a171,_0x517684,_0x36ce9c,_0x579d0e)['then'](function(_0x165de8){logger['info']('['+_0x579d0e[_0x4568('0x1a')]()+_0x4568('0x64'),_0x165de8[_0x4568('0x29')]);logger[_0x4568('0x26')]('['+_0x579d0e['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x165de8[_0x4568('0x24')]);return getEndUser(_0x165de8,_0x4205a2,_0x517684,_0x36ce9c,_0x204055,_0x579d0e,_0x109917['moduleCreate'],_0x109917[_0x4568('0x65')]);})['then'](function(_0x4def3c){logger[_0x4568('0x26')]('['+_0x579d0e[_0x4568('0x1a')]()+_0x4568('0x66'),_0x4def3c['enduserId']);logger[_0x4568('0x26')]('['+_0x579d0e[_0x4568('0x1a')]()+_0x4568('0x67'),_0x204055['calleridnum']);return getTicket(_0x4def3c,_0x4205a2,_0x517684,_0x36ce9c,_0x204055,_0x109917,_0x579d0e);})[_0x4568('0x16')](function(_0x12e791){logger['info'](util['format']('['+_0x579d0e[_0x4568('0x1a')]()+_0x4568('0x68'),_0x109917[_0x4568('0x43')],_0x12e791[_0x4568('0x50')]));logger[_0x4568('0x26')](util['format']('['+_0x579d0e[_0x4568('0x1a')]()+_0x4568('0x69'),_0x579d0e));if(_0x579d0e!==_0x4568('0x58')&&_0x109917[_0x4568('0x6a')]){logger[_0x4568('0x26')]('['+_0x579d0e[_0x4568('0x1a')]()+']',_0x4568('0x6b'));emit(_0x4205a2['remoteUri'],_0x26a171[_0x4568('0x6c')],_0x109917[_0x4568('0x43')],_0x12e791['ticketId']);}})[_0x4568('0x18')](function(_0x31eea7){logger[_0x4568('0x19')]('['+_0x579d0e[_0x4568('0x1a')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x31eea7[_0x4568('0x1c')]);console[_0x4568('0x19')](_0x4568('0x6d'),_0x31eea7);});}; \ No newline at end of file +var _0xcc6a=['toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','catch','message','toLowerCase','outbound','calleridnum','POST','contacts','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','\x20eq\x20\x27','replace','%2b','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','error',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data7','data2','data5','clientId','remoteUri','username','password','clientSecret','then','access_token'];(function(_0x3d382e,_0x5d1163){var _0x10e339=function(_0x1e165a){while(--_0x1e165a){_0x3d382e['push'](_0x3d382e['shift']());}};_0x10e339(++_0x5d1163);}(_0xcc6a,0x12e));var _0xacc6=function(_0xcdf8df,_0x174b14){_0xcdf8df=_0xcdf8df-0x0;var _0x5cb4ab=_0xcc6a[_0xcdf8df];return _0x5cb4ab;};'use strict';var _=require(_0xacc6('0x0'));var rp=require(_0xacc6('0x1'));var util=require(_0xacc6('0x2'));var intUtil=require(_0xacc6('0x3'));var md5=require(_0xacc6('0x4'));var Redis=require(_0xacc6('0x5'));var logger=require('../../../../config/logger')('dynamics365');var config=require(_0xacc6('0x6'));config[_0xacc6('0x7')]=_['defaults'](config[_0xacc6('0x7')],{'host':_0xacc6('0x8'),'port':0x18eb});var io=require(_0xacc6('0x9'))(new Redis(config[_0xacc6('0x7')]));function getAuthToken(_0x4e7fc7,_0x56ca3b,_0xcd81fa){if(_0x4e7fc7[_0xacc6('0xa')]){_0x4e7fc7['remoteUri']=_0x4e7fc7[_0xacc6('0xb')][_0xacc6('0xc')];_0x4e7fc7['tenantId']=_0x4e7fc7[_0xacc6('0xb')][_0xacc6('0xd')];return Promise['resolve'](_0x4e7fc7['CloudProvider'][_0xacc6('0xe')]);}var _0x2bb641={'method':'POST','uri':_0x56ca3b,'form':{'client_id':_0x4e7fc7[_0xacc6('0xf')],'resource':_0x4e7fc7[_0xacc6('0x10')],'username':_0x4e7fc7[_0xacc6('0x11')],'password':_0x4e7fc7[_0xacc6('0x12')],'grant_type':_0xacc6('0x12'),'client_secret':_0x4e7fc7[_0xacc6('0x13')]},'json':!![]};return rp(_0x2bb641)[_0xacc6('0x14')](function(_0x3d064c){return _0x3d064c[_0xacc6('0x15')];})['catch'](function(_0x3aa53a){logger['error']('['+[_0xcd81fa[_0xacc6('0x16')]()]+_0xacc6('0x17'));return _0x3aa53a['message'];});}function getUser(_0x3d89c3,_0x3b4865,_0x5c5121,_0x1de3d2,_0x3c4a0a,_0x154dbb){return new Promise(function(_0x141773,_0x2527bf){return getAuthToken(_0x3b4865,_0x1de3d2,_0x154dbb)[_0xacc6('0x14')](function(_0x53a8c4){var _0x16dfce={'method':_0xacc6('0x18'),'uri':_0x3c4a0a+_0xacc6('0x19'),'headers':{'Authorization':_0xacc6('0x1a')+_0x53a8c4,'OData-Version':_0xacc6('0x1b')},'json':!![]};return rp(_0x16dfce);})[_0xacc6('0x14')](function(_0xee0d54){var _0x207019=_0xee0d54[_0xacc6('0x1c')];var _0x50805a=![];var _0x3ad1a2=null;if(!_[_0xacc6('0x1d')](_0x5c5121)){if(intUtil[_0xacc6('0x1e')](_0x5c5121[_0xacc6('0x1f')])){_0x3d89c3[_0xacc6('0x20')]=_0x5c5121[_0xacc6('0x1f')];for(_0x3ad1a2=0x0;_0x3ad1a2<_0x207019[_0xacc6('0x21')];_0x3ad1a2++){if(_0x207019[_0x3ad1a2][_0xacc6('0x22')]===_0x5c5121['email']&&!_0x207019[_0x3ad1a2][_0xacc6('0x23')]){_0x50805a=!![];logger[_0xacc6('0x24')]('['+[_0x154dbb[_0xacc6('0x16')]()]+_0xacc6('0x25')+_0x207019[_0x3ad1a2][_0xacc6('0x26')]+'!');_0x3d89c3['userId']=_0x207019[_0x3ad1a2][_0xacc6('0x26')];}}}}if(!_0x50805a){logger[_0xacc6('0x24')]('['+[_0x154dbb[_0xacc6('0x16')]()]+_0xacc6('0x27'));_0x3d89c3['userEmail']=_0x3b4865[_0xacc6('0x11')];for(_0x3ad1a2=0x0;_0x3ad1a2<_0x207019[_0xacc6('0x21')];_0x3ad1a2++){if(_0x207019[_0x3ad1a2][_0xacc6('0x22')]===_0x3b4865['username']){_0x3d89c3[_0xacc6('0x28')]=_0x207019[_0x3ad1a2][_0xacc6('0x26')];}}}_0x141773(_0x3d89c3);})[_0xacc6('0x29')](function(_0x19ad52){_0x2527bf(_0x19ad52[_0xacc6('0x2a')]);});});}function createEndUser(_0x4a9fef,_0x1a94a2,_0x100c77,_0x5883a8,_0x5e5ca4,_0x17dd2f,_0x30b301){return new Promise(function(_0x285238,_0x2ab04a){return getAuthToken(_0x1a94a2,_0x100c77,_0x17dd2f)[_0xacc6('0x14')](function(_0x5d5c74){var _0x29c01b=_0x17dd2f[_0xacc6('0x2b')]()===_0xacc6('0x2c')?_0x5e5ca4['destcalleridnum']:_0x5e5ca4[_0xacc6('0x2d')];var _0x25b8a3={'method':_0xacc6('0x2e'),'uri':_0x5883a8+_0xacc6('0x2f'),'body':{'fullname':_0x29c01b,'firstname':_0x29c01b,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xacc6('0x30')+_0x4a9fef[_0xacc6('0x28')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x5d5c74,'OData-Version':_0xacc6('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x25b8a3[_0xacc6('0x31')][_0x30b301]=_0x29c01b;return rp(_0x25b8a3);})[_0xacc6('0x14')](function(_0x4abd24){var _0x57ce5e=_0x4abd24[_0xacc6('0x32')][_0xacc6('0x33')];var _0x5d7c52=_0x57ce5e[_0xacc6('0x34')](_0x57ce5e[_0xacc6('0x35')]('(')+0x1,_0x57ce5e[_0xacc6('0x35')](')'));_0x4a9fef[_0xacc6('0x36')]=_0x5d7c52;_0x285238(_0x4a9fef);})[_0xacc6('0x29')](function(_0x3b8d4f){_0x2ab04a(_0x3b8d4f[_0xacc6('0x2a')]);});});}function getEndUser(_0x1f1ad1,_0x5ad0fe,_0x38242f,_0x1d4655,_0x312f6f,_0x191765,_0x28aae9,_0x1b2492){var _0x36c6ea=_0x191765['toLowerCase']()===_0xacc6('0x2c')?_0x312f6f['destcalleridnum']:_0x312f6f[_0xacc6('0x2d')];return getAuthToken(_0x5ad0fe,_0x38242f,_0x191765)[_0xacc6('0x14')](function(_0x5e00e6){_0x1b2492=_0x1b2492?_0x1b2492:'telephone1';var _0x3574b1={'method':_0xacc6('0x18'),'uri':_0x1d4655+'contacts?$select='+_0x1b2492+'&$filter='+_0x1b2492+_0xacc6('0x37')+_0x36c6ea[_0xacc6('0x38')]('+',_0xacc6('0x39'))+'\x27','headers':{'Authorization':_0xacc6('0x1a')+_0x5e00e6,'If-None-Match':null,'OData-Version':_0xacc6('0x1b')},'json':!![]};return rp(_0x3574b1);})['then'](function(_0x8e3edd){var _0xac6def=![];if(!_0x8e3edd)return _0xac6def;var _0xc4953b=_0x8e3edd['value'];for(var _0x1f041e=0x0;_0x1f041e<_0xc4953b['length'];_0x1f041e++){if(_0xc4953b[_0x1f041e][_0x1b2492]===_0x36c6ea){_0xac6def=!![];_0x1f1ad1[_0xacc6('0x36')]=_0xc4953b[_0x1f041e][_0xacc6('0x3a')];}}return _0xac6def;})['then'](function(_0x583370){if(_0x583370)return _0x1f1ad1;if(_0x28aae9==='nothing'){logger['info']('['+[_0x191765[_0xacc6('0x16')]()]+_0xacc6('0x3b'));return _0x1f1ad1;}return createEndUser(_0x1f1ad1,_0x5ad0fe,_0x38242f,_0x1d4655,_0x312f6f,_0x191765,_0x1b2492)[_0xacc6('0x14')](function(_0x2bf7bb){logger[_0xacc6('0x24')]('['+[_0x191765[_0xacc6('0x16')]()]+_0xacc6('0x3c'),_0x2bf7bb['enduserId']);return _0x2bf7bb;});});}function getCustomFields(_0x48be2e,_0x12801f,_0x3340c1){var _0x54666d={};if(_0x48be2e['length']>0x0){_[_0xacc6('0x3d')](_0x48be2e,function(_0x31cd28){if(_[_0xacc6('0x3e')]([_0xacc6('0x3f'),_0xacc6('0x40')],_0x31cd28[_0xacc6('0x41')])&&_0x31cd28[_0xacc6('0x42')]&&!_0x31cd28['customField']){var _0x24bd52=_0x31cd28[_0xacc6('0x43')][_0xacc6('0x2b')]();var _0x5e6bac=_0x24bd52[_0xacc6('0x34')](0x0,_0x24bd52[_0xacc6('0x44')]('_'));var _0x40db6b=_0x24bd52[_0xacc6('0x34')](_0x24bd52[_0xacc6('0x44')]('_')+0x1);if(_0x5e6bac===_0x3340c1){_0x54666d[_0x40db6b]=_0x31cd28[_0xacc6('0x45')];}}});}return _0x54666d;}function getTicket(_0x41bf1c,_0x138ed0,_0x9ef6b0,_0x2bffee,_0x56c3e3,_0x479371,_0x1dd558){return new Promise(function(_0x4d288c,_0x18b19f){var _0x12cb4c;return getAuthToken(_0x138ed0,_0x9ef6b0,_0x1dd558)[_0xacc6('0x14')](function(_0x8c3f7d){if(_0x479371[_0xacc6('0x46')]===_0xacc6('0x47')){_0x12cb4c={'method':_0xacc6('0x2e'),'uri':_0x2bffee+_0xacc6('0x48'),'body':Object[_0xacc6('0x49')]({},{'title':intUtil[_0xacc6('0x4a')](_0x479371[_0xacc6('0x4b')],_0x56c3e3,'\x20'),'description':intUtil[_0xacc6('0x4a')](_0x479371[_0xacc6('0x4c')],_0x56c3e3,'\x0a'),'customerid_contact@odata.bind':_0x41bf1c['enduserId']?_0xacc6('0x4d')+_0x41bf1c[_0xacc6('0x36')]+')':undefined,'ownerid@odata.bind':_0xacc6('0x30')+_0x41bf1c['userId']+')','caseorigincode':'1'},getCustomFields(_0x479371[_0xacc6('0x4e')],_0x56c3e3,_0x479371[_0xacc6('0x46')])),'headers':{'Authorization':_0xacc6('0x1a')+_0x8c3f7d,'OData-Version':_0xacc6('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x479371[_0xacc6('0x46')]===_0xacc6('0x4f')){var _0x14c236=_0x41bf1c[_0xacc6('0x36')]?[{'partyid_systemuser@odata.bind':_0xacc6('0x30')+_0x41bf1c[_0xacc6('0x28')]+')','participationtypemask':_0x41bf1c[_0xacc6('0x50')]===_0xacc6('0x51')?0x2:0x1},{'partyid_contact@odata.bind':_0xacc6('0x4d')+_0x41bf1c[_0xacc6('0x36')]+')','participationtypemask':_0x41bf1c[_0xacc6('0x50')]===_0xacc6('0x51')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xacc6('0x30')+_0x41bf1c['userId']+')','participationtypemask':_0x41bf1c[_0xacc6('0x50')]===_0xacc6('0x51')?0x2:0x1}];_0x12cb4c={'method':_0xacc6('0x2e'),'uri':_0x2bffee+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0xacc6('0x4a')](_0x479371[_0xacc6('0x4b')],_0x56c3e3,'\x20'),'phonenumber':String(_0x56c3e3[_0xacc6('0x2d')]),'description':intUtil[_0xacc6('0x4a')](_0x479371[_0xacc6('0x4c')],_0x56c3e3,'\x0a'),'regardingobjectid_contact@odata.bind':_0x41bf1c[_0xacc6('0x36')]?_0xacc6('0x4d')+_0x41bf1c['enduserId']+')':undefined,'ownerid@odata.bind':_0xacc6('0x30')+_0x41bf1c[_0xacc6('0x28')]+')','directioncode':_0x41bf1c[_0xacc6('0x50')]==='queue'?![]:!![],'phonecall_activity_parties':_0x14c236},getCustomFields(_0x479371[_0xacc6('0x4e')],_0x56c3e3,_0x479371[_0xacc6('0x46')])),'headers':{'Authorization':_0xacc6('0x1a')+_0x8c3f7d,'OData-Version':_0xacc6('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x12cb4c);})[_0xacc6('0x14')](function(_0x48e984){var _0x54d0e7=_0x48e984['headers'][_0xacc6('0x33')];var _0x31d57a=_0x54d0e7['substring'](_0x54d0e7[_0xacc6('0x35')]('(')+0x1,_0x54d0e7[_0xacc6('0x35')](')'));_0x41bf1c[_0xacc6('0x52')]=_0x31d57a;_0x4d288c(_0x41bf1c);})[_0xacc6('0x29')](function(_0x4f693d){_0x18b19f(_0x4f693d[_0xacc6('0x2a')]);});});}function emit(_0x65ca6b,_0x18ede1,_0x19389c,_0x1206bd){var _0x765c69={'uri':util[_0xacc6('0x53')](_0xacc6('0x54'),_0x65ca6b,_0x19389c,_0x1206bd)};io['to'](util[_0xacc6('0x53')]('user:%s',_0x18ede1))['emit'](_0xacc6('0x55'),_0x765c69);}exports['cs']=function(_0x511cd4,_0x253a02,_0x4a5abd,_0x3e6334,_0x595ce2,_0x1c9426,_0x4cb4b1,_0x57629d){var _0x5cb000={};_0x1c9426[_0xacc6('0x10')]=_0x1c9426['modernAuthentication']?intUtil[_0xacc6('0x56')](_0x1c9426[_0xacc6('0xb')][_0xacc6('0xc')]):intUtil[_0xacc6('0x56')](_0x1c9426['remoteUri']);_0x1c9426[_0xacc6('0x57')]=intUtil['stripTrailingSlash'](_0x1c9426[_0xacc6('0x57')]);_0x5cb000[_0xacc6('0x50')]=_0x57629d==='queue'||_0x57629d===_0xacc6('0x58')?'queue':_0xacc6('0x2c');var _0x2a0460=_0x1c9426[_0xacc6('0xa')]?util[_0xacc6('0x53')](_0xacc6('0x59'),_0x1c9426[_0xacc6('0xb')][_0xacc6('0xc')]):util[_0xacc6('0x53')](_0xacc6('0x59'),_0x1c9426[_0xacc6('0x10')]);var _0x28ad33=util[_0xacc6('0x53')](_0xacc6('0x5a'),_0x1c9426[_0xacc6('0x5b')]);var _0x2330de=util['format'](_0xacc6('0x5c'),_0x1c9426[_0xacc6('0x57')],_0x253a02[_0xacc6('0x5d')],md5(_0x253a02[_0xacc6('0x5d')]));if(_0x595ce2&&_0x595ce2[_0xacc6('0x5e')]){logger['info'](_0xacc6('0x5f'),_0xacc6('0x60'));_0x253a02[_0xacc6('0x61')]=_0x2330de;}else if(_0x4cb4b1&&_0x4cb4b1['recordingFormat']&&_0x4cb4b1[_0xacc6('0x62')]!==_0xacc6('0x63')){logger[_0xacc6('0x24')](_0xacc6('0x64'),_0xacc6('0x60'));_0x253a02['recordingURL']=_0x2330de;}else{_0x253a02[_0xacc6('0x61')]='';}return getUser(_0x5cb000,_0x1c9426,_0x3e6334,_0x28ad33,_0x2a0460,_0x57629d)[_0xacc6('0x14')](function(_0x5f3e8c){logger[_0xacc6('0x24')]('['+_0x57629d[_0xacc6('0x16')]()+_0xacc6('0x65'),_0x5f3e8c[_0xacc6('0x28')]);logger[_0xacc6('0x24')]('['+_0x57629d[_0xacc6('0x16')]()+']\x20The\x20User\x20email\x20is:',_0x5f3e8c[_0xacc6('0x20')]);return getEndUser(_0x5f3e8c,_0x1c9426,_0x28ad33,_0x2a0460,_0x253a02,_0x57629d,_0x4a5abd[_0xacc6('0x66')],_0x4a5abd[_0xacc6('0x67')]);})[_0xacc6('0x14')](function(_0x3e04ef){logger[_0xacc6('0x24')]('['+_0x57629d[_0xacc6('0x16')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x3e04ef[_0xacc6('0x36')]);logger[_0xacc6('0x24')]('['+_0x57629d[_0xacc6('0x16')]()+_0xacc6('0x68'),_0x253a02[_0xacc6('0x2d')]);return getTicket(_0x3e04ef,_0x1c9426,_0x28ad33,_0x2a0460,_0x253a02,_0x4a5abd,_0x57629d);})[_0xacc6('0x14')](function(_0x1e0c6c){logger[_0xacc6('0x24')](util['format']('['+_0x57629d[_0xacc6('0x16')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x4a5abd[_0xacc6('0x46')],_0x1e0c6c[_0xacc6('0x52')]));logger['info'](util[_0xacc6('0x53')]('['+_0x57629d['toUpperCase']()+_0xacc6('0x69'),_0x57629d));if(_0x57629d!==_0xacc6('0x58')&&_0x4a5abd['openNewTab']){logger[_0xacc6('0x24')]('['+_0x57629d[_0xacc6('0x16')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x1c9426['remoteUri'],_0x3e6334['name'],_0x4a5abd[_0xacc6('0x46')],_0x1e0c6c[_0xacc6('0x52')]);}})[_0xacc6('0x29')](function(_0x18df57){logger[_0xacc6('0x6a')]('['+_0x57629d[_0xacc6('0x16')]()+_0xacc6('0x6b'),_0x18df57[_0xacc6('0x2a')]);console[_0xacc6('0x6a')]('Error\x20running\x20Dynamics365\x20integration',_0x18df57);});}; \ 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 29e97cd..bd33a1e 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 _0x0aa2=['Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','toString','base64','stringify','defaults','GET','map','forEach','includes','picklist','type','customField','nameField','toLowerCase','content','string','push','idField','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','recordingFormat','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','catch','toUpperCase','lastevent','lodash','request-promise','md5','util','../../../../config/environment','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','merge','format','Caller\x20-\x20%s','getString','Subjects','Descriptions','
','Tags','name','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','find','contact','email','%s/api/v2/agents/me'];(function(_0xea7bf7,_0x1f9bac){var _0x3478f7=function(_0x3320a0){while(--_0x3320a0){_0xea7bf7['push'](_0xea7bf7['shift']());}};_0x3478f7(++_0x1f9bac);}(_0x0aa2,0xe3));var _0x20aa=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0aa2[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x20aa('0x0'));var rp=require(_0x20aa('0x1'));var md5=require(_0x20aa('0x2'));var util=require(_0x20aa('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x20aa('0x4'));var logger=require('../../../../config/logger')(_0x20aa('0x5'));config['redis']=_['defaults'](config[_0x20aa('0x6')],{'host':_0x20aa('0x7'),'port':0x18eb});var io=require(_0x20aa('0x8'))(new Redis(config[_0x20aa('0x6')]));var headers={'Content-Type':_0x20aa('0x9'),'Accept':'application/json'};function emit(_0x4d02a5,_0x83c755,_0x334d04){io['to'](_0x4d02a5)[_0x20aa('0xa')](_0x83c755,_0x334d04);}function getTicket(_0x1f5f75,_0xc7a95,_0x402ea0,_0x23f602,_0x3260c8){logger['info']('Creating\x20new\x20ticket...');var _0x2037f2=_[_0x20aa('0xb')]({'responder_id':_0xc7a95['id'],'requester_id':_0x402ea0['id'],'name':util[_0x20aa('0xc')](_0x20aa('0xd'),_0x3260c8['calleridname']),'phone':_0x3260c8['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x20aa('0xe')](_0x23f602[_0x20aa('0xf')],_0x3260c8,'\x20'),'description':intUtil['getString'](_0x23f602[_0x20aa('0x10')],_0x3260c8,_0x20aa('0x11')),'tags':getTags(_0x23f602[_0x20aa('0x12')],_0x20aa('0x13'))},getCustomFields(_0x23f602[_0x20aa('0x14')],_0x3260c8));_0x2037f2['custom_fields']=_[_0x20aa('0x15')](_[_0x20aa('0x16')](_0x2037f2[_0x20aa('0x17')],'id'),_0x20aa('0x18'));return request({'uri':util[_0x20aa('0xc')](_0x20aa('0x19'),_0x1f5f75[_0x20aa('0x1a')]),'method':_0x20aa('0x1b'),'body':_0x2037f2})[_0x20aa('0x1c')](function(_0x7769ba){logger[_0x20aa('0x1d')](_0x20aa('0x1e'));return _0x7769ba;});}function getUser(_0x566637,_0x4bf674){if(intUtil[_0x20aa('0x1f')](_0x4bf674)){return request({'uri':util[_0x20aa('0xc')](_0x20aa('0x20'),_0x566637[_0x20aa('0x1a')]),'qs':{'email':_0x4bf674}})[_0x20aa('0x1c')](function(_0x11396c){if(_0x11396c['length']){logger['info']('Agent\x20found!');return _[_0x20aa('0x21')](_0x11396c,function(_0x15c940){return _0x15c940[_0x20aa('0x22')][_0x20aa('0x23')]===_0x4bf674;});}else{logger[_0x20aa('0x1d')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x20aa('0x24'),_0x566637[_0x20aa('0x1a')])})[_0x20aa('0x1c')](function(_0x17ba82){logger[_0x20aa('0x1d')](_0x20aa('0x25'));return _0x17ba82;});}});}else{logger[_0x20aa('0x1d')](_0x20aa('0x26'));return request({'uri':util[_0x20aa('0xc')](_0x20aa('0x24'),_0x566637[_0x20aa('0x1a')])})[_0x20aa('0x1c')](function(_0xe41642){logger[_0x20aa('0x1d')](_0x20aa('0x25'));return _0xe41642;});}}function getEndUser(_0x39861e,_0x575d6b,_0x3884f8){logger['info']('Searching\x20enduser\x20with\x20phone',_0x3884f8);return request({'uri':util[_0x20aa('0xc')](_0x20aa('0x27'),_0x39861e['remoteUri']),'qs':{'phone':_0x3884f8}})[_0x20aa('0x1c')](function(_0xb254a){if(_0xb254a[_0x20aa('0x28')]){logger[_0x20aa('0x1d')](_0x20aa('0x29'));return _[_0x20aa('0x21')](_0xb254a,{'phone':_0x3884f8});}else{logger[_0x20aa('0x1d')](_0x20aa('0x2a'));return request({'uri':util[_0x20aa('0xc')](_0x20aa('0x27'),_0x39861e[_0x20aa('0x1a')]),'method':_0x20aa('0x1b'),'body':{'name':_0x575d6b,'phone':_0x3884f8}})[_0x20aa('0x1c')](function(_0x2f7bd1){logger[_0x20aa('0x1d')]('Enduser\x20created.');return _0x2f7bd1;});}});}function getAuth(_0x447f59){return util[_0x20aa('0xc')]('Basic\x20%s',new Buffer(_0x447f59['apiKey']+':X')[_0x20aa('0x2b')](_0x20aa('0x2c')));}function request(_0x3b3494){logger['debug']('[HTTP]',JSON[_0x20aa('0x2d')](_0x3b3494));return rp(_[_0x20aa('0x2e')](_0x3b3494,{'method':_0x20aa('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x172cce,_0x4d2ee1){var _0xd4a75d=[];if(_0x172cce&&_0x172cce['length']>0x0){_0xd4a75d=_[_0x20aa('0x30')](_0x172cce,_0x4d2ee1);}return _0xd4a75d;}function getCustomFields(_0x16c97b,_0x51945c){var _0x19a591=[];var _0xd655e1={'custom_fields':[]};if(_0x16c97b[_0x20aa('0x28')]>0x0){_[_0x20aa('0x31')](_0x16c97b,function(_0x1cccf2){if(_[_0x20aa('0x32')](['string',_0x20aa('0x33')],_0x1cccf2[_0x20aa('0x34')])&&_0x1cccf2['nameField']&&!_0x1cccf2[_0x20aa('0x35')]){_0xd655e1[_0x1cccf2[_0x20aa('0x36')][_0x20aa('0x37')]()]=_0x1cccf2[_0x20aa('0x38')][_0x20aa('0x2b')]();}else if(_[_0x20aa('0x32')]([_0x20aa('0x39'),'picklist'],_0x1cccf2[_0x20aa('0x34')])&&_0x1cccf2['idField']&&_0x1cccf2['customField']){_0xd655e1[_0x20aa('0x17')][_0x20aa('0x3a')]({'id':_0x1cccf2[_0x20aa('0x3b')],'value':_0x1cccf2['content'][_0x20aa('0x2b')]()});}else if(_0x1cccf2['type']===_0x20aa('0x3c')&&_0x1cccf2['variableName']&&_0x1cccf2[_0x20aa('0x3b')]&&_0x1cccf2['customField']){_0x51945c[_0x1cccf2[_0x20aa('0x3d')]]&&_0xd655e1['custom_fields'][_0x20aa('0x3a')]({'id':_0x1cccf2[_0x20aa('0x3b')],'value':_0x51945c[_0x1cccf2[_0x20aa('0x3d')]][_0x20aa('0x2b')]()});}else if(_0x1cccf2[_0x20aa('0x34')]==='customVariable'&&_0x1cccf2[_0x20aa('0x3e')]&&_0x1cccf2['Variable']['name']&&_0x1cccf2['idField']&&_0x1cccf2[_0x20aa('0x35')]){_0x51945c[_0x1cccf2[_0x20aa('0x3e')][_0x20aa('0x13')][_0x20aa('0x37')]()]&&_0xd655e1['custom_fields'][_0x20aa('0x3a')]({'id':_0x1cccf2[_0x20aa('0x3b')],'value':_0x51945c[_0x1cccf2[_0x20aa('0x3e')][_0x20aa('0x13')][_0x20aa('0x37')]()]['toString']()});}});}return _0xd655e1;}exports[_0x20aa('0x3f')]=function(_0xc53992,_0x59c13a,_0x376645,_0x5175a6,_0x5ed87a,_0xac4cbc){var _0x82c980,_0x5f1e0b;_0xac4cbc['remoteUri']=intUtil[_0x20aa('0x40')](_0xac4cbc['remoteUri']);_0xac4cbc[_0x20aa('0x41')]=intUtil['stripTrailingSlash'](_0xac4cbc['serverUrl']);if(_0x5ed87a&&_0x5ed87a[_0x20aa('0x42')]){logger[_0x20aa('0x1d')](_0x20aa('0x43'),_0x20aa('0x44'));_0x59c13a[_0x20aa('0x45')]=util[_0x20aa('0xc')](_0x20aa('0x46'),_0xac4cbc[_0x20aa('0x41')],_0x59c13a[_0x20aa('0x47')],md5(_0x59c13a['uniqueid']));}else{_0x59c13a[_0x20aa('0x45')]='';}headers[_0x20aa('0x48')]=getAuth(_0xac4cbc);return getUser(_0xac4cbc,_0x5175a6[_0x20aa('0x23')])['then'](function(_0x13f18b){_0x82c980=_0x13f18b;logger[_0x20aa('0x1d')](_0x20aa('0x49'),_0x82c980['id']);return getEndUser(_0xac4cbc,_0x59c13a[_0x20aa('0x4a')],_0x59c13a[_0x20aa('0x4b')]);})[_0x20aa('0x1c')](function(_0x44894e){_0x5f1e0b=_0x44894e;logger[_0x20aa('0x1d')]('The\x20Enduser\x20ID\x20is:',_0x5f1e0b['id']);return getTicket(_0xac4cbc,_0x82c980,_0x5f1e0b,_0x376645,_0x59c13a);})[_0x20aa('0x1c')](function(_0x1ab392){if(_0x1ab392&&_0x1ab392['id']){logger['info'](_0x20aa('0x1e'));logger[_0x20aa('0x1d')](_0x20aa('0x4c'),_0x1ab392['id']);logger[_0x20aa('0x1d')](_0x20aa('0x43'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x20aa('0x4d'),_0x5175a6['name']),_0x20aa('0x4e'),{'uri':util[_0x20aa('0xc')](_0x20aa('0x4f'),_0xac4cbc[_0x20aa('0x1a')],_0x1ab392['id'])});}})['catch'](function(_0x1db449){logger[_0x20aa('0x50')](_0x20aa('0x43'),JSON[_0x20aa('0x2d')](_0x1db449));});};exports['outbound']=function(_0x4a53f2,_0x19940c,_0x4af23f,_0x51c3a7,_0xd0310f,_0x21bd38,_0x11c681){var _0x185924,_0x833c5;_0x21bd38['remoteUri']=intUtil[_0x20aa('0x40')](_0x21bd38[_0x20aa('0x1a')]);_0x21bd38[_0x20aa('0x41')]=intUtil[_0x20aa('0x40')](_0x21bd38[_0x20aa('0x41')]);if(_0x11c681&&_0x11c681['recordingFormat']&&_0x11c681[_0x20aa('0x51')]!=='none'){logger[_0x20aa('0x1d')](_0x20aa('0x52'),_0x20aa('0x44'));_0x19940c[_0x20aa('0x45')]=util[_0x20aa('0xc')](_0x20aa('0x46'),_0x21bd38[_0x20aa('0x41')],_0x19940c[_0x20aa('0x47')],md5(_0x19940c['uniqueid']));}headers[_0x20aa('0x48')]=getAuth(_0x21bd38);return getUser(_0x21bd38,_0x51c3a7['email'])[_0x20aa('0x1c')](function(_0x42b027){_0x185924=_0x42b027;logger[_0x20aa('0x1d')]('The\x20User\x20ID\x20is:',_0x185924['id']);return getEndUser(_0x21bd38,_0x19940c[_0x20aa('0x53')],_0x19940c['destcalleridnum']);})['then'](function(_0x131379){_0x833c5=_0x131379;logger[_0x20aa('0x1d')](_0x20aa('0x54'),_0x833c5['id']);return getTicket(_0x21bd38,_0x185924,_0x833c5,_0x4af23f,_0x19940c);})['then'](function(_0x358405){if(_0x358405&&_0x358405['id']){logger[_0x20aa('0x1d')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x358405['id']);logger[_0x20aa('0x1d')](_0x20aa('0x52'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x20aa('0xc')]('user:%s',_0x51c3a7[_0x20aa('0x13')]),_0x20aa('0x4e'),{'uri':util['format'](_0x20aa('0x4f'),_0x21bd38[_0x20aa('0x1a')],_0x358405['id'])});}})[_0x20aa('0x55')](function(_0x47735f){logger[_0x20aa('0x50')](_0x20aa('0x52'),JSON[_0x20aa('0x2d')](_0x47735f));});};exports['unmanaged']=function(_0x12230a,_0x17f5e0,_0x548aa3,_0x45d7df,_0x34b213,_0x1037f2){var _0x1673c7,_0x25aec;_0x1037f2['remoteUri']=intUtil[_0x20aa('0x40')](_0x1037f2['remoteUri']);_0x1037f2[_0x20aa('0x41')]=intUtil[_0x20aa('0x40')](_0x1037f2[_0x20aa('0x41')]);if(_0x34b213&&_0x34b213[_0x20aa('0x42')]){logger[_0x20aa('0x1d')]('['+_0x17f5e0['lastevent'][_0x20aa('0x56')]()+']',_0x20aa('0x44'));_0x17f5e0['recordingURL']=util[_0x20aa('0xc')](_0x20aa('0x46'),_0x1037f2[_0x20aa('0x41')],_0x17f5e0[_0x20aa('0x47')],md5(_0x17f5e0[_0x20aa('0x47')]));}else{_0x17f5e0[_0x20aa('0x45')]='';}headers[_0x20aa('0x48')]=getAuth(_0x1037f2);return getUser(_0x1037f2,'')['then'](function(_0x4ce5f0){_0x1673c7=_0x4ce5f0;logger[_0x20aa('0x1d')]('The\x20User\x20ID\x20is:',_0x1673c7['id']);return getEndUser(_0x1037f2,_0x17f5e0[_0x20aa('0x4a')],_0x17f5e0[_0x20aa('0x4b')]);})['then'](function(_0x242cc5){_0x25aec=_0x242cc5;logger['info'](_0x20aa('0x54'),_0x25aec['id']);return getTicket(_0x1037f2,_0x1673c7,_0x25aec,_0x548aa3,_0x17f5e0);})['then'](function(_0x55a940){if(_0x55a940){logger[_0x20aa('0x1d')]('Ticket\x20created!');logger[_0x20aa('0x1d')](_0x20aa('0x4c'),_0x55a940['id']);}})['catch'](function(_0x21242d){logger[_0x20aa('0x50')]('['+_0x17f5e0[_0x20aa('0x57')][_0x20aa('0x56')]()+']',JSON[_0x20aa('0x2d')](_0x21242d));});}; \ No newline at end of file +var _0x6667=['destcalleridname','destcalleridnum','user:%s','catch','[OUTBOUND]','unmanaged','lastevent','toUpperCase','request-promise','md5','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','value','format','%s/api/v2/tickets','POST','then','info','validateEmail','%s/api/v2/agents','remoteUri','length','Agent\x20found!','find','contact','email','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','GET','forEach','includes','picklist','customField','nameField','toLowerCase','content','toString','type','idField','variable','variableName','push','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','error','[QUEUE]','outbound','none','recordingURL','Authorization','The\x20User\x20ID\x20is:'];(function(_0x17d40e,_0x35a9e8){var _0x31e6a0=function(_0x5510ac){while(--_0x5510ac){_0x17d40e['push'](_0x17d40e['shift']());}};_0x31e6a0(++_0x35a9e8);}(_0x6667,0x66));var _0x7666=function(_0x47242d,_0x13f993){_0x47242d=_0x47242d-0x0;var _0x30273a=_0x6667[_0x47242d];return _0x30273a;};'use strict';var _=require('lodash');var rp=require(_0x7666('0x0'));var md5=require(_0x7666('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x7666('0x2'));var config=require(_0x7666('0x3'));var logger=require(_0x7666('0x4'))(_0x7666('0x5'));config[_0x7666('0x6')]=_[_0x7666('0x7')](config[_0x7666('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x7666('0x8'))(new Redis(config[_0x7666('0x6')]));var headers={'Content-Type':_0x7666('0x9'),'Accept':_0x7666('0x9')};function emit(_0x542d88,_0x44513e,_0x58a9b1){io['to'](_0x542d88)[_0x7666('0xa')](_0x44513e,_0x58a9b1);}function getTicket(_0x502a5e,_0x4665c2,_0x334405,_0x1a932e,_0x4472f3){logger['info'](_0x7666('0xb'));var _0x946ff0=_[_0x7666('0xc')]({'responder_id':_0x4665c2['id'],'requester_id':_0x334405['id'],'name':util['format'](_0x7666('0xd'),_0x4472f3[_0x7666('0xe')]),'phone':_0x4472f3[_0x7666('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x7666('0x10')](_0x1a932e[_0x7666('0x11')],_0x4472f3,'\x20'),'description':intUtil['getString'](_0x1a932e[_0x7666('0x12')],_0x4472f3,_0x7666('0x13')),'tags':getTags(_0x1a932e[_0x7666('0x14')],_0x7666('0x15'))},getCustomFields(_0x1a932e[_0x7666('0x16')],_0x4472f3));_0x946ff0[_0x7666('0x17')]=_[_0x7666('0x18')](_['keyBy'](_0x946ff0['custom_fields'],'id'),_0x7666('0x19'));return request({'uri':util[_0x7666('0x1a')](_0x7666('0x1b'),_0x502a5e['remoteUri']),'method':_0x7666('0x1c'),'body':_0x946ff0})[_0x7666('0x1d')](function(_0x246352){logger[_0x7666('0x1e')]('Ticket\x20created!');return _0x246352;});}function getUser(_0x542a4d,_0x14422b){if(intUtil[_0x7666('0x1f')](_0x14422b)){return request({'uri':util[_0x7666('0x1a')](_0x7666('0x20'),_0x542a4d[_0x7666('0x21')]),'qs':{'email':_0x14422b}})[_0x7666('0x1d')](function(_0x36c245){if(_0x36c245[_0x7666('0x22')]){logger['info'](_0x7666('0x23'));return _[_0x7666('0x24')](_0x36c245,function(_0x597ce2){return _0x597ce2[_0x7666('0x25')][_0x7666('0x26')]===_0x14422b;});}else{logger[_0x7666('0x1e')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x7666('0x1a')]('%s/api/v2/agents/me',_0x542a4d[_0x7666('0x21')])})[_0x7666('0x1d')](function(_0x50824a){logger[_0x7666('0x1e')](_0x7666('0x27'));return _0x50824a;});}});}else{logger[_0x7666('0x1e')](_0x7666('0x28'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x542a4d[_0x7666('0x21')])})['then'](function(_0x5f0edd){logger['info']('Admin\x20account\x20selected.');return _0x5f0edd;});}}function getEndUser(_0x1968f4,_0x3fb992,_0x1d9ab7){logger[_0x7666('0x1e')](_0x7666('0x29'),_0x1d9ab7);return request({'uri':util[_0x7666('0x1a')](_0x7666('0x2a'),_0x1968f4['remoteUri']),'qs':{'phone':_0x1d9ab7}})[_0x7666('0x1d')](function(_0x40ce13){if(_0x40ce13['length']){logger[_0x7666('0x1e')](_0x7666('0x2b'));return _[_0x7666('0x24')](_0x40ce13,{'phone':_0x1d9ab7});}else{logger['info'](_0x7666('0x2c'));return request({'uri':util[_0x7666('0x1a')](_0x7666('0x2a'),_0x1968f4[_0x7666('0x21')]),'method':_0x7666('0x1c'),'body':{'name':_0x3fb992,'phone':_0x1d9ab7}})['then'](function(_0x16a2d7){logger['info']('Enduser\x20created.');return _0x16a2d7;});}});}function getAuth(_0x3b7f0b){return util[_0x7666('0x1a')](_0x7666('0x2d'),new Buffer(_0x3b7f0b[_0x7666('0x2e')]+':X')['toString'](_0x7666('0x2f')));}function request(_0x25d4ef){logger[_0x7666('0x30')](_0x7666('0x31'),JSON[_0x7666('0x32')](_0x25d4ef));return rp(_['defaults'](_0x25d4ef,{'method':_0x7666('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x5af602,_0x488695){var _0x3c8686=[];if(_0x5af602&&_0x5af602[_0x7666('0x22')]>0x0){_0x3c8686=_['map'](_0x5af602,_0x488695);}return _0x3c8686;}function getCustomFields(_0x2f4084,_0x1e172b){var _0x336a3d=[];var _0x1ed3d6={'custom_fields':[]};if(_0x2f4084[_0x7666('0x22')]>0x0){_[_0x7666('0x34')](_0x2f4084,function(_0x481ddb){if(_[_0x7666('0x35')](['string',_0x7666('0x36')],_0x481ddb['type'])&&_0x481ddb['nameField']&&!_0x481ddb[_0x7666('0x37')]){_0x1ed3d6[_0x481ddb[_0x7666('0x38')][_0x7666('0x39')]()]=_0x481ddb[_0x7666('0x3a')][_0x7666('0x3b')]();}else if(_['includes'](['string',_0x7666('0x36')],_0x481ddb[_0x7666('0x3c')])&&_0x481ddb[_0x7666('0x3d')]&&_0x481ddb[_0x7666('0x37')]){_0x1ed3d6[_0x7666('0x17')]['push']({'id':_0x481ddb[_0x7666('0x3d')],'value':_0x481ddb[_0x7666('0x3a')][_0x7666('0x3b')]()});}else if(_0x481ddb[_0x7666('0x3c')]===_0x7666('0x3e')&&_0x481ddb[_0x7666('0x3f')]&&_0x481ddb[_0x7666('0x3d')]&&_0x481ddb[_0x7666('0x37')]){_0x1e172b[_0x481ddb[_0x7666('0x3f')]]&&_0x1ed3d6[_0x7666('0x17')][_0x7666('0x40')]({'id':_0x481ddb[_0x7666('0x3d')],'value':_0x1e172b[_0x481ddb[_0x7666('0x3f')]]['toString']()});}else if(_0x481ddb[_0x7666('0x3c')]===_0x7666('0x41')&&_0x481ddb['Variable']&&_0x481ddb[_0x7666('0x42')][_0x7666('0x15')]&&_0x481ddb['idField']&&_0x481ddb[_0x7666('0x37')]){_0x1e172b[_0x481ddb['Variable']['name'][_0x7666('0x39')]()]&&_0x1ed3d6['custom_fields']['push']({'id':_0x481ddb['idField'],'value':_0x1e172b[_0x481ddb['Variable'][_0x7666('0x15')][_0x7666('0x39')]()][_0x7666('0x3b')]()});}});}return _0x1ed3d6;}exports['queue']=function(_0x3ed0cc,_0xccc49c,_0x4fa5f0,_0x49849b,_0x4a400d,_0x45dcbd){var _0x11a740,_0x4382e9;_0x45dcbd[_0x7666('0x21')]=intUtil[_0x7666('0x43')](_0x45dcbd[_0x7666('0x21')]);_0x45dcbd[_0x7666('0x44')]=intUtil['stripTrailingSlash'](_0x45dcbd[_0x7666('0x44')]);if(_0x4a400d&&_0x4a400d[_0x7666('0x45')]){logger[_0x7666('0x1e')]('[QUEUE]',_0x7666('0x46'));_0xccc49c['recordingURL']=util['format'](_0x7666('0x47'),_0x45dcbd['serverUrl'],_0xccc49c[_0x7666('0x48')],md5(_0xccc49c[_0x7666('0x48')]));}else{_0xccc49c['recordingURL']='';}headers['Authorization']=getAuth(_0x45dcbd);return getUser(_0x45dcbd,_0x49849b[_0x7666('0x26')])[_0x7666('0x1d')](function(_0x759359){_0x11a740=_0x759359;logger[_0x7666('0x1e')]('The\x20User\x20ID\x20is:',_0x11a740['id']);return getEndUser(_0x45dcbd,_0xccc49c['calleridname'],_0xccc49c[_0x7666('0xf')]);})[_0x7666('0x1d')](function(_0x8236a0){_0x4382e9=_0x8236a0;logger[_0x7666('0x1e')](_0x7666('0x49'),_0x4382e9['id']);return getTicket(_0x45dcbd,_0x11a740,_0x4382e9,_0x4fa5f0,_0xccc49c);})[_0x7666('0x1d')](function(_0x240d42){if(_0x240d42&&_0x240d42['id']){logger[_0x7666('0x1e')](_0x7666('0x4a'));logger['info'](_0x7666('0x4b'),_0x240d42['id']);logger['info']('[QUEUE]',_0x7666('0x4c'));emit(util['format']('user:%s',_0x49849b[_0x7666('0x15')]),_0x7666('0x4d'),{'uri':util[_0x7666('0x1a')](_0x7666('0x4e'),_0x45dcbd[_0x7666('0x21')],_0x240d42['id'])});}})['catch'](function(_0x221baa){logger[_0x7666('0x4f')](_0x7666('0x50'),JSON[_0x7666('0x32')](_0x221baa));});};exports[_0x7666('0x51')]=function(_0x19a37e,_0x11b672,_0x19f341,_0x1ae021,_0x22fc11,_0x43c0bf,_0x32372a){var _0x5a2078,_0xa00dc9;_0x43c0bf['remoteUri']=intUtil['stripTrailingSlash'](_0x43c0bf[_0x7666('0x21')]);_0x43c0bf[_0x7666('0x44')]=intUtil[_0x7666('0x43')](_0x43c0bf[_0x7666('0x44')]);if(_0x32372a&&_0x32372a['recordingFormat']&&_0x32372a['recordingFormat']!==_0x7666('0x52')){logger[_0x7666('0x1e')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x11b672[_0x7666('0x53')]=util[_0x7666('0x1a')](_0x7666('0x47'),_0x43c0bf[_0x7666('0x44')],_0x11b672[_0x7666('0x48')],md5(_0x11b672[_0x7666('0x48')]));}headers[_0x7666('0x54')]=getAuth(_0x43c0bf);return getUser(_0x43c0bf,_0x1ae021[_0x7666('0x26')])[_0x7666('0x1d')](function(_0x295fc9){_0x5a2078=_0x295fc9;logger['info'](_0x7666('0x55'),_0x5a2078['id']);return getEndUser(_0x43c0bf,_0x11b672[_0x7666('0x56')],_0x11b672[_0x7666('0x57')]);})[_0x7666('0x1d')](function(_0x292e36){_0xa00dc9=_0x292e36;logger[_0x7666('0x1e')](_0x7666('0x49'),_0xa00dc9['id']);return getTicket(_0x43c0bf,_0x5a2078,_0xa00dc9,_0x19f341,_0x11b672);})[_0x7666('0x1d')](function(_0x3f145b){if(_0x3f145b&&_0x3f145b['id']){logger[_0x7666('0x1e')](_0x7666('0x4a'));logger[_0x7666('0x1e')]('The\x20Ticket\x20ID\x20is:',_0x3f145b['id']);logger[_0x7666('0x1e')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x7666('0x58'),_0x1ae021['name']),'trigger:browser:url',{'uri':util[_0x7666('0x1a')](_0x7666('0x4e'),_0x43c0bf[_0x7666('0x21')],_0x3f145b['id'])});}})[_0x7666('0x59')](function(_0x1f0314){logger[_0x7666('0x4f')](_0x7666('0x5a'),JSON[_0x7666('0x32')](_0x1f0314));});};exports[_0x7666('0x5b')]=function(_0x4dc2c1,_0x2298b2,_0xf5d329,_0x48e057,_0x18126c,_0x5bf65e){var _0x9f4d4,_0x48bbf5;_0x5bf65e[_0x7666('0x21')]=intUtil['stripTrailingSlash'](_0x5bf65e[_0x7666('0x21')]);_0x5bf65e['serverUrl']=intUtil[_0x7666('0x43')](_0x5bf65e['serverUrl']);if(_0x18126c&&_0x18126c[_0x7666('0x45')]){logger[_0x7666('0x1e')]('['+_0x2298b2[_0x7666('0x5c')][_0x7666('0x5d')]()+']','Recording\x20is\x20enabled!');_0x2298b2['recordingURL']=util[_0x7666('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5bf65e[_0x7666('0x44')],_0x2298b2[_0x7666('0x48')],md5(_0x2298b2['uniqueid']));}else{_0x2298b2[_0x7666('0x53')]='';}headers['Authorization']=getAuth(_0x5bf65e);return getUser(_0x5bf65e,'')[_0x7666('0x1d')](function(_0x172398){_0x9f4d4=_0x172398;logger[_0x7666('0x1e')](_0x7666('0x55'),_0x9f4d4['id']);return getEndUser(_0x5bf65e,_0x2298b2['calleridname'],_0x2298b2[_0x7666('0xf')]);})[_0x7666('0x1d')](function(_0x27b2ad){_0x48bbf5=_0x27b2ad;logger['info'](_0x7666('0x49'),_0x48bbf5['id']);return getTicket(_0x5bf65e,_0x9f4d4,_0x48bbf5,_0xf5d329,_0x2298b2);})['then'](function(_0x2cba78){if(_0x2cba78){logger[_0x7666('0x1e')](_0x7666('0x4a'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x2cba78['id']);}})[_0x7666('0x59')](function(_0x45aeac){logger[_0x7666('0x4f')]('['+_0x2298b2[_0x7666('0x5c')][_0x7666('0x5d')]()+']',JSON['stringify'](_0x45aeac));});}; \ 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 d87d444..4b2bba4 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 _0x3479=['Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','format','add','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','userEmail','agentEmail','userId','message','/api/lookup?q=','&f=','&entities=contact','find','contacts','contactNumber','mobile_number','endUserId'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x3479,0x1c7));var _0x9347=function(_0x533528,_0x409d05){_0x533528=_0x533528-0x0;var _0x3189f1=_0x3479[_0x533528];return _0x3189f1;};'use strict';var _=require('lodash');var rp=require(_0x9347('0x0'));var md5=require(_0x9347('0x1'));var util=require(_0x9347('0x2'));var moment=require(_0x9347('0x3'));var Promise=require(_0x9347('0x4'));var Redis=require(_0x9347('0x5'));var intUtil=require(_0x9347('0x6'));var config=require(_0x9347('0x7'));var logger=require('../../../../config/logger')('freshsales');config[_0x9347('0x8')]=_[_0x9347('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9347('0xa'))(new Redis(config[_0x9347('0x8')]));function getAdminId(_0x4e9aa3,_0xe3fd08,_0x2a140f,_0x464307){return new Promise(function(_0x159dc9,_0x12555b){var _0x3f627a=![];var _0x3dd422={'method':_0x9347('0xb'),'uri':_0x464307+_0x9347('0xc'),'json':!![]};_0x3dd422[_0x9347('0xd')]=_0x2a140f;logger[_0x9347('0xe')](_0x9347('0xf'));return rp(_0x3dd422)[_0x9347('0x10')](function(_0x5d594f){if(_0x5d594f){var _0x3b60c7=_0x5d594f[_0x9347('0x11')];var _0x100eab=null;for(_0x100eab=0x0;_0x100eab<_0x3b60c7[_0x9347('0x12')];_0x100eab++){if(_0x3b60c7[_0x100eab]['email']===_0x4e9aa3[_0x9347('0x13')]){_0x4e9aa3[_0x9347('0x14')]=_0x3b60c7[_0x100eab]['id'];_0x3f627a=!![];}}if(_0x3f627a){logger['info']('Admin\x20found:',_0x4e9aa3['adminId']);_0x159dc9(_0x4e9aa3);}else{_0x12555b({'statusCode':0x194,'message':_0x9347('0x15')});}}else{_0x12555b({'statusCode':0x194,'message':_0x9347('0x15')});}})[_0x9347('0x16')](function(_0x3bfdd8){logger[_0x9347('0x17')]('['+[_0xe3fd08[_0x9347('0x18')]()]+']',_0x3bfdd8['message']);_0x12555b(_0x3bfdd8);});});}function getUser(_0x3d81cf,_0x906e30,_0x16ea19){return function(_0x4d2833){return new Promise(function(_0x4a1ef9,_0x5d8fd4){var _0x471b6a={'method':_0x9347('0xb'),'uri':_0x16ea19+_0x9347('0xc'),'json':!![]};_0x471b6a[_0x9347('0xd')]=_0x906e30;logger[_0x9347('0xe')]('Getting\x20user\x20list');return rp(_0x471b6a)[_0x9347('0x10')](function(_0x1eb9b4){if(_0x1eb9b4){var _0x309c2a=_0x1eb9b4[_0x9347('0x11')];var _0x1cac6c=![];var _0x83023c=null;if(_0x4d2833['agentEmail']!==null){logger[_0x9347('0xe')]('Getting\x20user\x20with\x20email',_0x4d2833['agentEmail']);_0x4d2833[_0x9347('0x19')]=_0x4d2833[_0x9347('0x1a')];for(_0x83023c=0x0;_0x83023c<_0x309c2a[_0x9347('0x12')];_0x83023c++){if(_0x309c2a[_0x83023c]['email']===_0x4d2833[_0x9347('0x1a')]){_0x1cac6c=!![];_0x4d2833[_0x9347('0x1b')]=_0x309c2a[_0x83023c]['id'];logger['info']('User\x20found:',_0x4d2833[_0x9347('0x1b')]);}}}if(!_0x1cac6c){logger[_0x9347('0xe')]('Admin\x20selected');_0x4d2833[_0x9347('0x19')]=_0x4d2833['adminEmail'];_0x4d2833[_0x9347('0x1b')]=_0x4d2833[_0x9347('0x14')];_0x1cac6c=!![];}if(_0x1cac6c){_0x4a1ef9(_0x4d2833);}else{_0x5d8fd4({'statusCode':0x194,'message':_0x9347('0x15')});}}else{_0x5d8fd4({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x1d6c28){logger[_0x9347('0x17')]('['+[_0x3d81cf[_0x9347('0x18')]()]+']',_0x1d6c28[_0x9347('0x1c')]);_0x5d8fd4(_0x1d6c28);});});};}function searchContact(_0x5b16b8,_0x3be2a9,_0x18af8e,_0x1fbf7c){return new Promise(function(_0x5150a4,_0x4ce4cd){var _0x91ad34={'method':_0x9347('0xb'),'headers':_0x3be2a9,'uri':_0x5b16b8+_0x9347('0x1d')+_0x1fbf7c+_0x9347('0x1e')+_0x18af8e+_0x9347('0x1f'),'json':!![]};rp(_0x91ad34)['then'](function(_0x5a3421){var _0x27ebf7=_[_0x9347('0x20')](_0x5a3421[_0x9347('0x21')][_0x9347('0x21')],[_0x18af8e,_0x1fbf7c]);_0x5150a4(_0x27ebf7);})[_0x9347('0x16')](function(_0xd48085){_0x4ce4cd(_0xd48085);});});}function getEndUser(_0x658bc1,_0x153468,_0x5c0aa7){return function(_0x6197c9){return new Promise(function(_0x34a42b,_0x35ce33){logger[_0x9347('0xe')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x6197c9[_0x9347('0x22')]));searchContact(_0x5c0aa7,_0x153468,_0x9347('0x23'),_0x6197c9[_0x9347('0x22')])[_0x9347('0x10')](function(_0x16552e){if(_0x16552e){_0x6197c9[_0x9347('0x24')]=_0x16552e['id'];logger[_0x9347('0xe')](_0x9347('0x25'),_0x6197c9['endUserId']);return _0x34a42b(_0x6197c9);}searchContact(_0x5c0aa7,_0x153468,_0x9347('0x26'),_0x6197c9[_0x9347('0x22')])[_0x9347('0x10')](function(_0x6b22d){if(_0x6b22d){_0x6197c9['endUserId']=_0x6b22d['id'];logger[_0x9347('0xe')](_0x9347('0x27'),_0x6197c9[_0x9347('0x24')]);return _0x34a42b(_0x6197c9);}createEndUser(_0x6197c9,_0x658bc1,_0x153468,_0x5c0aa7)[_0x9347('0x10')](function(_0x304d34){logger[_0x9347('0xe')](_0x9347('0x28'),_0x304d34['endUserId']);return _0x34a42b(_0x304d34);});});})[_0x9347('0x16')](function(_0x58ae74){_0x35ce33(_0x58ae74);});});};}function createEndUser(_0x24c648,_0x4661d8,_0x293eec,_0x35f809){return new Promise(function(_0x46708f,_0x4b1f65){var _0x130a0d=moment();var _0x51c118={'method':_0x9347('0x29'),'uri':_0x35f809+_0x9347('0x2a'),'body':{'contact':{'last_name':_0x24c648[_0x9347('0x22')],'work_number':_0x24c648[_0x9347('0x22')],'mobile_number':_0x24c648['contactNumber'],'owner_id':_0x24c648[_0x9347('0x1b')],'created_at':_0x130a0d['format'](_0x9347('0x2b'))}},'json':!![]};_0x51c118[_0x9347('0xd')]=_0x293eec;logger[_0x9347('0xe')](_0x9347('0x2c'));return rp(_0x51c118)[_0x9347('0x10')](function(_0x291a94){_0x24c648[_0x9347('0x24')]=_0x291a94[_0x9347('0x2d')]['id'];_0x46708f(_0x24c648);})[_0x9347('0x16')](function(_0xfeef41){logger[_0x9347('0x17')]('['+[_0x4661d8[_0x9347('0x18')]()]+']',_0xfeef41[_0x9347('0x1c')]);_0x4b1f65(_0xfeef41[_0x9347('0x1c')]);});});}function getTicket(_0x2c5d86,_0x2af2d4,_0x44a98e,_0xdd5222,_0x372499){return function(_0x42df85){logger[_0x9347('0xe')](_0x9347('0x2e'));return new Promise(function(_0x54ba3c,_0x23fc31){var _0x2ecced=moment();var _0x1a6595={'method':_0x9347('0x29'),'uri':_0x44a98e+_0x9347('0x2f'),'body':{'title':intUtil[_0x9347('0x30')](_0xdd5222['Subjects'],_0x372499,'\x20'),'description':intUtil[_0x9347('0x30')](_0xdd5222[_0x9347('0x31')],_0x372499,'\x0a'),'owner_id':_0x42df85[_0x9347('0x1b')],'creater_id':_0x42df85[_0x9347('0x14')],'targetable_id':_0x42df85[_0x9347('0x24')],'targetable_type':_0x9347('0x32'),'created_at':_0x2ecced[_0x9347('0x33')](_0x9347('0x2b')),'due_date':_0x2ecced[_0x9347('0x34')](0x1e,'m')['format'](_0x9347('0x2b'))},'json':!![]};_0x1a6595['headers']=_0x2af2d4;return rp(_0x1a6595)['then'](function(_0x1dc589){_0x42df85[_0x9347('0x35')]=_0x1dc589[_0x9347('0x36')]['id'];logger[_0x9347('0xe')](_0x9347('0x37'),_0x42df85[_0x9347('0x35')]);_0x54ba3c(_0x42df85);})[_0x9347('0x16')](function(_0x34eb93){logger[_0x9347('0x17')]('['+[_0x2c5d86[_0x9347('0x18')]()]+']',_0x34eb93[_0x9347('0x1c')]);_0x23fc31(_0x34eb93[_0x9347('0x1c')]);});});};}function emit(_0x1882fa,_0x2d640e,_0x534caf){var _0x1f31e1={'uri':_0x1882fa+_0x9347('0x38')+_0x534caf};io['to'](util[_0x9347('0x33')]('user:%s',_0x2d640e))[_0x9347('0x39')](_0x9347('0x3a'),_0x1f31e1);}exports['cs']=function(_0x4824f8,_0x2a2a5b,_0x6a8ff2,_0x3ce44a,_0xa95fb9,_0x466088,_0x52d664,_0x10a744){var _0x1208f4={};var _0xa33964={'Authorization':_0x9347('0x3b')+_0x466088['apiKey']};_0x466088[_0x9347('0x3c')]=intUtil[_0x9347('0x3d')](_0x466088[_0x9347('0x3c')]);_0x466088[_0x9347('0x3e')]=intUtil[_0x9347('0x3d')](_0x466088[_0x9347('0x3e')]);var _0xb1a28f=_0x466088[_0x9347('0x3c')];_0x1208f4['adminEmail']=_0x466088['username'];_0x1208f4[_0x9347('0x22')]=_0x10a744[_0x9347('0x3f')]()===_0x9347('0x40')?_0x2a2a5b[_0x9347('0x41')]:_0x2a2a5b['calleridnum'];_0x1208f4[_0x9347('0x42')]=_0x10a744===_0x9347('0x43')||_0x10a744===_0x9347('0x44')?_0x9347('0x43'):_0x9347('0x40');if(_0x3ce44a){_0x1208f4[_0x9347('0x1a')]=_0x3ce44a[_0x9347('0x45')];}var _0x39ef07=util[_0x9347('0x33')](_0x9347('0x46'),_0x466088[_0x9347('0x3e')],_0x2a2a5b[_0x9347('0x47')],md5(_0x2a2a5b[_0x9347('0x47')]));if(_0xa95fb9&&_0xa95fb9['monitor_format']){logger[_0x9347('0xe')](_0x9347('0x48'),_0x9347('0x49'));_0x2a2a5b['recordingURL']=_0x39ef07;}else if(_0x52d664&&_0x52d664[_0x9347('0x4a')]&&_0x52d664[_0x9347('0x4a')]!==_0x9347('0x4b')){logger[_0x9347('0xe')]('[OUTBOUND]',_0x9347('0x49'));_0x2a2a5b[_0x9347('0x4c')]=_0x39ef07;}else{_0x2a2a5b[_0x9347('0x4c')]='';}return getAdminId(_0x1208f4,_0x10a744,_0xa33964,_0xb1a28f)[_0x9347('0x10')](getUser(_0x10a744,_0xa33964,_0xb1a28f))[_0x9347('0x10')](getEndUser(_0x10a744,_0xa33964,_0xb1a28f))[_0x9347('0x10')](getTicket(_0x10a744,_0xa33964,_0xb1a28f,_0x6a8ff2,_0x2a2a5b))['then'](function(_0x3b8a72){logger['info'](util[_0x9347('0x33')](_0x9347('0x4d'),_0x3b8a72['ticketId']));if(_0x10a744!==_0x9347('0x44')){logger[_0x9347('0xe')]('['+[_0x10a744['toUpperCase']()]+']',_0x9347('0x4e'));emit(_0xb1a28f,_0x3ce44a[_0x9347('0x4f')],_0x3b8a72['endUserId']);}})[_0x9347('0x16')](function(_0x59eab1){logger[_0x9347('0x17')]('['+[_0x10a744[_0x9347('0x18')]()]+_0x9347('0x50'),util[_0x9347('0x51')](_0x59eab1,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc0b3=['freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','userEmail','catch','/api/lookup?q=','&f=','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Descriptions','Contact','ticketId','task','Task\x20created:','user:%s','trigger:browser:url','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','queue','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','bluebird','ioredis','../../../../config/environment','../../../../config/logger'];(function(_0x1f88d4,_0x3f2a9c){var _0x31970d=function(_0x439a8a){while(--_0x439a8a){_0x1f88d4['push'](_0x1f88d4['shift']());}};_0x31970d(++_0x3f2a9c);}(_0xc0b3,0x130));var _0x3c0b=function(_0x324e6d,_0x18d296){_0x324e6d=_0x324e6d-0x0;var _0x193e28=_0xc0b3[_0x324e6d];return _0x193e28;};'use strict';var _=require(_0x3c0b('0x0'));var rp=require(_0x3c0b('0x1'));var md5=require(_0x3c0b('0x2'));var util=require(_0x3c0b('0x3'));var moment=require('moment');var Promise=require(_0x3c0b('0x4'));var Redis=require(_0x3c0b('0x5'));var intUtil=require('./util');var config=require(_0x3c0b('0x6'));var logger=require(_0x3c0b('0x7'))(_0x3c0b('0x8'));config[_0x3c0b('0x9')]=_[_0x3c0b('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3c0b('0xb'))(new Redis(config[_0x3c0b('0x9')]));function getAdminId(_0x5e1196,_0x4ef4e5,_0x51dcea,_0x27af7e){return new Promise(function(_0x48405f,_0x5ef16c){var _0x23ae25=![];var _0x4d0f48={'method':_0x3c0b('0xc'),'uri':_0x27af7e+_0x3c0b('0xd'),'json':!![]};_0x4d0f48[_0x3c0b('0xe')]=_0x51dcea;logger[_0x3c0b('0xf')](_0x3c0b('0x10'));return rp(_0x4d0f48)[_0x3c0b('0x11')](function(_0x84fddf){if(_0x84fddf){var _0x1365e4=_0x84fddf[_0x3c0b('0x12')];var _0x5ce5df=null;for(_0x5ce5df=0x0;_0x5ce5df<_0x1365e4[_0x3c0b('0x13')];_0x5ce5df++){if(_0x1365e4[_0x5ce5df][_0x3c0b('0x14')]===_0x5e1196[_0x3c0b('0x15')]){_0x5e1196[_0x3c0b('0x16')]=_0x1365e4[_0x5ce5df]['id'];_0x23ae25=!![];}}if(_0x23ae25){logger[_0x3c0b('0xf')]('Admin\x20found:',_0x5e1196['adminId']);_0x48405f(_0x5e1196);}else{_0x5ef16c({'statusCode':0x194,'message':_0x3c0b('0x17')});}}else{_0x5ef16c({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x20daef){logger[_0x3c0b('0x18')]('['+[_0x4ef4e5[_0x3c0b('0x19')]()]+']',_0x20daef[_0x3c0b('0x1a')]);_0x5ef16c(_0x20daef);});});}function getUser(_0x4dc0f6,_0x43b75e,_0x2e6f40){return function(_0x194e20){return new Promise(function(_0x381db8,_0x2d2ce3){var _0xb5fd76={'method':_0x3c0b('0xc'),'uri':_0x2e6f40+'/api/selector/owners','json':!![]};_0xb5fd76[_0x3c0b('0xe')]=_0x43b75e;logger[_0x3c0b('0xf')](_0x3c0b('0x1b'));return rp(_0xb5fd76)[_0x3c0b('0x11')](function(_0x41e84f){if(_0x41e84f){var _0x4e8b4c=_0x41e84f[_0x3c0b('0x12')];var _0x39864d=![];var _0x26f55a=null;if(_0x194e20[_0x3c0b('0x1c')]!==null){logger[_0x3c0b('0xf')](_0x3c0b('0x1d'),_0x194e20['agentEmail']);_0x194e20['userEmail']=_0x194e20['agentEmail'];for(_0x26f55a=0x0;_0x26f55a<_0x4e8b4c['length'];_0x26f55a++){if(_0x4e8b4c[_0x26f55a][_0x3c0b('0x14')]===_0x194e20['agentEmail']){_0x39864d=!![];_0x194e20[_0x3c0b('0x1e')]=_0x4e8b4c[_0x26f55a]['id'];logger[_0x3c0b('0xf')](_0x3c0b('0x1f'),_0x194e20[_0x3c0b('0x1e')]);}}}if(!_0x39864d){logger[_0x3c0b('0xf')](_0x3c0b('0x20'));_0x194e20[_0x3c0b('0x21')]=_0x194e20[_0x3c0b('0x15')];_0x194e20['userId']=_0x194e20[_0x3c0b('0x16')];_0x39864d=!![];}if(_0x39864d){_0x381db8(_0x194e20);}else{_0x2d2ce3({'statusCode':0x194,'message':_0x3c0b('0x17')});}}else{_0x2d2ce3({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x3c0b('0x22')](function(_0x186b57){logger[_0x3c0b('0x18')]('['+[_0x4dc0f6[_0x3c0b('0x19')]()]+']',_0x186b57[_0x3c0b('0x1a')]);_0x2d2ce3(_0x186b57);});});};}function searchContact(_0x3fc392,_0x23263c,_0x47cd17,_0x57f4a9){return new Promise(function(_0x41e325,_0x5a134b){var _0x3652c0={'method':_0x3c0b('0xc'),'headers':_0x23263c,'uri':_0x3fc392+_0x3c0b('0x23')+_0x57f4a9+_0x3c0b('0x24')+_0x47cd17+'&entities=contact','json':!![]};rp(_0x3652c0)['then'](function(_0x1f52ea){var _0x216760=_['find'](_0x1f52ea[_0x3c0b('0x25')][_0x3c0b('0x25')],[_0x47cd17,_0x57f4a9]);_0x41e325(_0x216760);})[_0x3c0b('0x22')](function(_0x5b3801){_0x5a134b(_0x5b3801);});});}function getEndUser(_0x54356c,_0x45395b,_0x18d37d){return function(_0x50884c){return new Promise(function(_0x2de062,_0x5ea54e){logger[_0x3c0b('0xf')](util[_0x3c0b('0x26')](_0x3c0b('0x27'),_0x50884c[_0x3c0b('0x28')]));searchContact(_0x18d37d,_0x45395b,_0x3c0b('0x29'),_0x50884c['contactNumber'])[_0x3c0b('0x11')](function(_0x30aa5e){if(_0x30aa5e){_0x50884c[_0x3c0b('0x2a')]=_0x30aa5e['id'];logger[_0x3c0b('0xf')](_0x3c0b('0x2b'),_0x50884c['endUserId']);return _0x2de062(_0x50884c);}searchContact(_0x18d37d,_0x45395b,_0x3c0b('0x2c'),_0x50884c[_0x3c0b('0x28')])[_0x3c0b('0x11')](function(_0x358058){if(_0x358058){_0x50884c[_0x3c0b('0x2a')]=_0x358058['id'];logger[_0x3c0b('0xf')](_0x3c0b('0x2d'),_0x50884c[_0x3c0b('0x2a')]);return _0x2de062(_0x50884c);}createEndUser(_0x50884c,_0x54356c,_0x45395b,_0x18d37d)[_0x3c0b('0x11')](function(_0x16ba63){logger[_0x3c0b('0xf')]('Contact\x20created:',_0x16ba63[_0x3c0b('0x2a')]);return _0x2de062(_0x16ba63);});});})['catch'](function(_0x4b5fb4){_0x5ea54e(_0x4b5fb4);});});};}function createEndUser(_0x29b1c1,_0x4c20a0,_0x3cefb0,_0x4ba81f){return new Promise(function(_0x4520f8,_0x519a98){var _0xc52f2b=moment();var _0x168d03={'method':_0x3c0b('0x2e'),'uri':_0x4ba81f+_0x3c0b('0x2f'),'body':{'contact':{'last_name':_0x29b1c1['contactNumber'],'work_number':_0x29b1c1[_0x3c0b('0x28')],'mobile_number':_0x29b1c1[_0x3c0b('0x28')],'owner_id':_0x29b1c1[_0x3c0b('0x1e')],'created_at':_0xc52f2b[_0x3c0b('0x26')](_0x3c0b('0x30'))}},'json':!![]};_0x168d03[_0x3c0b('0xe')]=_0x3cefb0;logger[_0x3c0b('0xf')](_0x3c0b('0x31'));return rp(_0x168d03)[_0x3c0b('0x11')](function(_0xd13b33){_0x29b1c1[_0x3c0b('0x2a')]=_0xd13b33[_0x3c0b('0x32')]['id'];_0x4520f8(_0x29b1c1);})[_0x3c0b('0x22')](function(_0x2d0c87){logger[_0x3c0b('0x18')]('['+[_0x4c20a0[_0x3c0b('0x19')]()]+']',_0x2d0c87[_0x3c0b('0x1a')]);_0x519a98(_0x2d0c87[_0x3c0b('0x1a')]);});});}function getTicket(_0xf122d7,_0x2de118,_0x3b6900,_0xa5a1c8,_0x1817c2){return function(_0x2db351){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x363b14,_0x3f4a3e){var _0x287224=moment();var _0x49c48b={'method':_0x3c0b('0x2e'),'uri':_0x3b6900+_0x3c0b('0x33'),'body':{'title':intUtil[_0x3c0b('0x34')](_0xa5a1c8['Subjects'],_0x1817c2,'\x20'),'description':intUtil[_0x3c0b('0x34')](_0xa5a1c8[_0x3c0b('0x35')],_0x1817c2,'\x0a'),'owner_id':_0x2db351[_0x3c0b('0x1e')],'creater_id':_0x2db351[_0x3c0b('0x16')],'targetable_id':_0x2db351[_0x3c0b('0x2a')],'targetable_type':_0x3c0b('0x36'),'created_at':_0x287224[_0x3c0b('0x26')](_0x3c0b('0x30')),'due_date':_0x287224['add'](0x1e,'m')[_0x3c0b('0x26')](_0x3c0b('0x30'))},'json':!![]};_0x49c48b['headers']=_0x2de118;return rp(_0x49c48b)[_0x3c0b('0x11')](function(_0x589d42){_0x2db351[_0x3c0b('0x37')]=_0x589d42[_0x3c0b('0x38')]['id'];logger[_0x3c0b('0xf')](_0x3c0b('0x39'),_0x2db351[_0x3c0b('0x37')]);_0x363b14(_0x2db351);})[_0x3c0b('0x22')](function(_0x30a352){logger[_0x3c0b('0x18')]('['+[_0xf122d7[_0x3c0b('0x19')]()]+']',_0x30a352[_0x3c0b('0x1a')]);_0x3f4a3e(_0x30a352['message']);});});};}function emit(_0x17ff5c,_0x5314c4,_0xd08164){var _0x18a270={'uri':_0x17ff5c+'/contacts/'+_0xd08164};io['to'](util[_0x3c0b('0x26')](_0x3c0b('0x3a'),_0x5314c4))['emit'](_0x3c0b('0x3b'),_0x18a270);}exports['cs']=function(_0x5752fb,_0x2d252a,_0x20f01f,_0x5c387e,_0x19449e,_0x5a84a7,_0x13ab19,_0x4215f3){var _0x5daeda={};var _0x491180={'Authorization':'Token\x20token='+_0x5a84a7[_0x3c0b('0x3c')]};_0x5a84a7[_0x3c0b('0x3d')]=intUtil['stripTrailingSlash'](_0x5a84a7[_0x3c0b('0x3d')]);_0x5a84a7[_0x3c0b('0x3e')]=intUtil[_0x3c0b('0x3f')](_0x5a84a7['serverUrl']);var _0x5d4af3=_0x5a84a7[_0x3c0b('0x3d')];_0x5daeda[_0x3c0b('0x15')]=_0x5a84a7[_0x3c0b('0x40')];_0x5daeda['contactNumber']=_0x4215f3[_0x3c0b('0x41')]()==='outbound'?_0x2d252a['destcalleridnum']:_0x2d252a['calleridnum'];_0x5daeda['callDirection']=_0x4215f3===_0x3c0b('0x42')||_0x4215f3==='unmanaged'?'queue':'outbound';if(_0x5c387e){_0x5daeda[_0x3c0b('0x1c')]=_0x5c387e[_0x3c0b('0x14')];}var _0x3a047d=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5a84a7[_0x3c0b('0x3e')],_0x2d252a[_0x3c0b('0x43')],md5(_0x2d252a[_0x3c0b('0x43')]));if(_0x19449e&&_0x19449e[_0x3c0b('0x44')]){logger[_0x3c0b('0xf')]('[QUEUE]',_0x3c0b('0x45'));_0x2d252a[_0x3c0b('0x46')]=_0x3a047d;}else if(_0x13ab19&&_0x13ab19[_0x3c0b('0x47')]&&_0x13ab19['recordingFormat']!==_0x3c0b('0x48')){logger['info']('[OUTBOUND]',_0x3c0b('0x45'));_0x2d252a[_0x3c0b('0x46')]=_0x3a047d;}else{_0x2d252a[_0x3c0b('0x46')]='';}return getAdminId(_0x5daeda,_0x4215f3,_0x491180,_0x5d4af3)[_0x3c0b('0x11')](getUser(_0x4215f3,_0x491180,_0x5d4af3))[_0x3c0b('0x11')](getEndUser(_0x4215f3,_0x491180,_0x5d4af3))[_0x3c0b('0x11')](getTicket(_0x4215f3,_0x491180,_0x5d4af3,_0x20f01f,_0x2d252a))['then'](function(_0xa7697c){logger[_0x3c0b('0xf')](util['format'](_0x3c0b('0x49'),_0xa7697c[_0x3c0b('0x37')]));if(_0x4215f3!=='unmanaged'){logger['info']('['+[_0x4215f3['toUpperCase']()]+']',_0x3c0b('0x4a'));emit(_0x5d4af3,_0x5c387e[_0x3c0b('0x4b')],_0xa7697c[_0x3c0b('0x2a')]);}})[_0x3c0b('0x22')](function(_0x2e93e5){logger[_0x3c0b('0x18')]('['+[_0x4215f3['toUpperCase']()]+_0x3c0b('0x4c'),util[_0x3c0b('0x4d')](_0x2e93e5,{'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 574e225..69f5164 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 _0x748c=['freshdesk','zoho','desk','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','unmanaged','salesforce','vtiger','dynamics365','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./vtiger','./dynamics365','zendesk','sugarcrm'];(function(_0x34657d,_0x1b5d1f){var _0x2af604=function(_0x57224e){while(--_0x57224e){_0x34657d['push'](_0x34657d['shift']());}};_0x2af604(++_0x1b5d1f);}(_0x748c,0xf9));var _0xc748=function(_0x2da9ce,_0x10d692){_0x2da9ce=_0x2da9ce-0x0;var _0x2f59b3=_0x748c[_0x2da9ce];return _0x2f59b3;};'use strict';var _=require(_0xc748('0x0'));var util=require(_0xc748('0x1'));var zendesk=require(_0xc748('0x2'));var salesforce=require(_0xc748('0x3'));var sugarcrm=require(_0xc748('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0xc748('0x5'));var desk=require('./desk');var vtiger=require(_0xc748('0x6'));var servicenow=require('./servicenow');var dynamics365=require(_0xc748('0x7'));var freshsales=require('./freshsales');var integrations=[_0xc748('0x8'),'salesforce',_0xc748('0x9'),_0xc748('0xa'),_0xc748('0xb'),_0xc748('0xc'),'vtiger','dynamics365',_0xc748('0xd'),_0xc748('0xe')];exports[_0xc748('0xf')]=function(_0x4d1a7d,_0xa119ee,_0x3c27b7,_0x5604c8,_0x150629,_0x181695){if(_0x3c27b7){if(_[_0xc748('0x10')](integrations,_0x4d1a7d[_0xc748('0x11')][_0xc748('0x12')]())){try{var _0xa3a1b2=null;var _0x3397da='';var _0x36ea22=_0x3c27b7[_0x4d1a7d[_0xc748('0x11')][_0xc748('0x12')]()];if(_0x36ea22){var _0x2615b3=_0x36ea22[_0x4d1a7d[_0xc748('0x13')]];if(_0x2615b3){var _0xbddf55=_[_0xc748('0x14')](_0x2615b3[_0xc748('0x15')],{'id':parseInt(_0x4d1a7d[_0xc748('0x16')],0xa)});if(_0xbddf55){if(_0x5604c8){if(_0x150629&&_0xa119ee[_0xc748('0x17')]){_0x3397da='queue';}else if(_0xa119ee[_0xc748('0x18')]){_0x3397da=_0xc748('0x19');}else{console[_0xc748('0x1a')]('EVENT\x20UNKNOWN',_0xa119ee);}}else{_0x3397da=_0xc748('0x1b');}switch(_0x4d1a7d['data1'][_0xc748('0x12')]()){case _0xc748('0x8'):zendesk[_0x3397da](_0x4d1a7d,_0xa119ee,_0xbddf55,_0x5604c8,_0x150629,_0x2615b3,_0x181695);break;case _0xc748('0x1c'):salesforce[_0x3397da](_0x4d1a7d,_0xa119ee,_0xbddf55,_0x5604c8,_0x150629,_0x2615b3,_0x181695);break;case _0xc748('0x9'):sugarcrm[_0x3397da](_0x4d1a7d,_0xa119ee,_0xbddf55,_0x5604c8,_0x150629,_0x2615b3,_0x181695);break;case _0xc748('0xa'):freshdesk[_0x3397da](_0x4d1a7d,_0xa119ee,_0xbddf55,_0x5604c8,_0x150629,_0x2615b3,_0x181695);break;case'zoho':zoho[_0x3397da](_0x4d1a7d,_0xa119ee,_0xbddf55,_0x5604c8,_0x150629,_0x2615b3,_0x181695);break;case'desk':desk[_0x3397da](_0x4d1a7d,_0xa119ee,_0xbddf55,_0x5604c8,_0x150629,_0x2615b3,_0x181695);break;case _0xc748('0x1d'):vtiger[_0x3397da](_0x4d1a7d,_0xa119ee,_0xbddf55,_0x5604c8,_0x150629,_0x2615b3,_0x181695);break;case _0xc748('0xd'):freshsales['cs'](_0x4d1a7d,_0xa119ee,_0xbddf55,_0x5604c8,_0x150629,_0x2615b3,_0x181695,_0x3397da);break;case _0xc748('0xe'):servicenow['cs'](_0x4d1a7d,_0xa119ee,_0xbddf55,_0x5604c8,_0x150629,_0x2615b3,_0x181695,_0x3397da);break;case _0xc748('0x1e'):dynamics365['cs'](_0x4d1a7d,_0xa119ee,_0xbddf55,_0x5604c8,_0x150629,_0x2615b3,_0x181695,_0x3397da);break;default:console['log'](_0xc748('0x1f'));}}else{_0xa3a1b2=require(_0xc748('0x20'))(_0x4d1a7d[_0xc748('0x11')]['toLowerCase']());_0xa3a1b2[_0xc748('0x21')]('[EXEC]',util[_0xc748('0x22')](_0xc748('0x23'),_0x4d1a7d[_0xc748('0x11')][_0xc748('0x12')](),_0x4d1a7d[_0xc748('0x16')]));}}else{_0xa3a1b2=require('../../../../config/logger')(_0x4d1a7d[_0xc748('0x11')]['toLowerCase']());_0xa3a1b2[_0xc748('0x21')]('[EXEC]',util[_0xc748('0x22')](_0xc748('0x24'),_0x4d1a7d['data1']['toLowerCase'](),_0x4d1a7d['data2']));}}else{}}catch(_0x5867b6){console[_0xc748('0x21')](_0x5867b6);}}}}; \ No newline at end of file +var _0x485f=['log','EVENT\x20UNKNOWN','unmanaged','salesforce','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','data2','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data3','queue','routeId','outbound'];(function(_0x423ba7,_0x58c3a7){var _0x26331e=function(_0x419408){while(--_0x419408){_0x423ba7['push'](_0x423ba7['shift']());}};_0x26331e(++_0x58c3a7);}(_0x485f,0x162));var _0xf485=function(_0x5dfe45,_0x3a97ea){_0x5dfe45=_0x5dfe45-0x0;var _0x5a1e99=_0x485f[_0x5dfe45];return _0x5a1e99;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0xf485('0x0'));var sugarcrm=require(_0xf485('0x1'));var freshdesk=require(_0xf485('0x2'));var zoho=require(_0xf485('0x3'));var desk=require(_0xf485('0x4'));var vtiger=require(_0xf485('0x5'));var servicenow=require(_0xf485('0x6'));var dynamics365=require(_0xf485('0x7'));var freshsales=require(_0xf485('0x8'));var integrations=[_0xf485('0x9'),'salesforce',_0xf485('0xa'),_0xf485('0xb'),_0xf485('0xc'),_0xf485('0xd'),_0xf485('0xe'),_0xf485('0xf'),_0xf485('0x10'),_0xf485('0x11')];exports[_0xf485('0x12')]=function(_0x237ff2,_0x12657a,_0x1e6977,_0x1983f3,_0x40dbc3,_0x59d3bb){if(_0x1e6977){if(_[_0xf485('0x13')](integrations,_0x237ff2[_0xf485('0x14')][_0xf485('0x15')]())){try{var _0x538c23=null;var _0x3d3071='';var _0x5c1d29=_0x1e6977[_0x237ff2['data1'][_0xf485('0x15')]()];if(_0x5c1d29){var _0x555f00=_0x5c1d29[_0x237ff2['data2']];if(_0x555f00){var _0x518b81=_['find'](_0x555f00['Configurations'],{'id':parseInt(_0x237ff2[_0xf485('0x16')],0xa)});if(_0x518b81){if(_0x1983f3){if(_0x40dbc3&&_0x12657a[_0xf485('0x17')]){_0x3d3071=_0xf485('0x17');}else if(_0x12657a[_0xf485('0x18')]){_0x3d3071=_0xf485('0x19');}else{console[_0xf485('0x1a')](_0xf485('0x1b'),_0x12657a);}}else{_0x3d3071=_0xf485('0x1c');}switch(_0x237ff2[_0xf485('0x14')][_0xf485('0x15')]()){case _0xf485('0x9'):zendesk[_0x3d3071](_0x237ff2,_0x12657a,_0x518b81,_0x1983f3,_0x40dbc3,_0x555f00,_0x59d3bb);break;case _0xf485('0x1d'):salesforce[_0x3d3071](_0x237ff2,_0x12657a,_0x518b81,_0x1983f3,_0x40dbc3,_0x555f00,_0x59d3bb);break;case _0xf485('0xa'):sugarcrm[_0x3d3071](_0x237ff2,_0x12657a,_0x518b81,_0x1983f3,_0x40dbc3,_0x555f00,_0x59d3bb);break;case _0xf485('0xb'):freshdesk[_0x3d3071](_0x237ff2,_0x12657a,_0x518b81,_0x1983f3,_0x40dbc3,_0x555f00,_0x59d3bb);break;case _0xf485('0xc'):zoho[_0x3d3071](_0x237ff2,_0x12657a,_0x518b81,_0x1983f3,_0x40dbc3,_0x555f00,_0x59d3bb);break;case _0xf485('0xd'):desk[_0x3d3071](_0x237ff2,_0x12657a,_0x518b81,_0x1983f3,_0x40dbc3,_0x555f00,_0x59d3bb);break;case'vtiger':vtiger[_0x3d3071](_0x237ff2,_0x12657a,_0x518b81,_0x1983f3,_0x40dbc3,_0x555f00,_0x59d3bb);break;case _0xf485('0x10'):freshsales['cs'](_0x237ff2,_0x12657a,_0x518b81,_0x1983f3,_0x40dbc3,_0x555f00,_0x59d3bb,_0x3d3071);break;case _0xf485('0x11'):servicenow['cs'](_0x237ff2,_0x12657a,_0x518b81,_0x1983f3,_0x40dbc3,_0x555f00,_0x59d3bb,_0x3d3071);break;case _0xf485('0xf'):dynamics365['cs'](_0x237ff2,_0x12657a,_0x518b81,_0x1983f3,_0x40dbc3,_0x555f00,_0x59d3bb,_0x3d3071);break;default:console[_0xf485('0x1a')](_0xf485('0x1e'));}}else{_0x538c23=require('../../../../config/logger')(_0x237ff2['data1'][_0xf485('0x15')]());_0x538c23[_0xf485('0x1f')](_0xf485('0x20'),util[_0xf485('0x21')](_0xf485('0x22'),_0x237ff2['data1'][_0xf485('0x15')](),_0x237ff2['data3']));}}else{_0x538c23=require(_0xf485('0x23'))(_0x237ff2[_0xf485('0x14')][_0xf485('0x15')]());_0x538c23[_0xf485('0x1f')]('[EXEC]',util[_0xf485('0x21')](_0xf485('0x24'),_0x237ff2[_0xf485('0x14')][_0xf485('0x15')](),_0x237ff2[_0xf485('0x25')]));}}else{}}catch(_0x4fc81b){console[_0xf485('0x1f')](_0x4fc81b);}}}}; \ 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 602b4a1..b492661 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 _0x5c1a=['stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','email','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','destcalleridname','destcalleridnum','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','toUpperCase','calleridname','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','socket.io-emitter','emit','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','length','Email','info','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','additionalSearchContact','merge','$or','Contact','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','format','Company','No\x20Company','upperFirst','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username'];(function(_0x21ca45,_0x1a983b){var _0x2223c4=function(_0xcc23e3){while(--_0xcc23e3){_0x21ca45['push'](_0x21ca45['shift']());}};_0x2223c4(++_0x1a983b);}(_0x5c1a,0x123));var _0xa5c1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5c1a[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xa5c1('0x0'));var rp=require(_0xa5c1('0x1'));var moment=require('moment');var BPromise=require(_0xa5c1('0x2'));var md5=require(_0xa5c1('0x3'));var jsforce=require(_0xa5c1('0x4'));var util=require(_0xa5c1('0x5'));var Redis=require(_0xa5c1('0x6'));var intUtil=require(_0xa5c1('0x7'));var config=require(_0xa5c1('0x8'));var logger=require('../../../../config/logger')(_0xa5c1('0x9'));config[_0xa5c1('0xa')]=_[_0xa5c1('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xa5c1('0xc'))(new Redis(config['redis']));function emit(_0x29cde8,_0x2875e8,_0x524da9){io['to'](_0x29cde8)[_0xa5c1('0xd')](_0x2875e8,_0x524da9);}function getTicket(_0xb62197,_0x2bcbbe,_0x24156c,_0x567a36,_0x2d57b5,_0x532573,_0x415ce6,_0x5770fd){var _0x33b528=Object['assign']({},{'OwnerId':_0x2bcbbe['id'],'Subject':intUtil['getString'](_0x567a36['Subjects'],_0x2d57b5,'\x20'),'Description':intUtil[_0xa5c1('0xe')](_0x567a36[_0xa5c1('0xf')],_0x2d57b5,'\x0a')},getCustomFields(_0x532573,_0x2d57b5));if(_0x24156c){if(_0x567a36[_0xa5c1('0x10')]===_0xa5c1('0x11')){_0x33b528[_0xa5c1('0x12')]=moment[_0xa5c1('0x13')]();_0x33b528['IsReminderSet']=![];_0x33b528[_0xa5c1('0x14')]=![];if(_0x24156c[_0xa5c1('0x15')]===_0xa5c1('0x16')||_0x24156c[_0xa5c1('0x15')]===_0xa5c1('0x17')){_0x33b528[_0xa5c1('0x18')]=_0x24156c['id'];}else if(_0x24156c['endUserType']===_0xa5c1('0x19')){_0x33b528[_0xa5c1('0x1a')]=_0x24156c['id'];}}else if(_0x567a36[_0xa5c1('0x10')]==='Case'){if(_0x24156c[_0xa5c1('0x15')]===_0xa5c1('0x16')){_0x33b528[_0xa5c1('0x1b')]=_0x24156c['id'];}else if(_0x24156c[_0xa5c1('0x15')]===_0xa5c1('0x19')){_0x33b528[_0xa5c1('0x1c')]=_0x24156c['id'];}else if(_0x24156c[_0xa5c1('0x15')]==='lead'&&_0x567a36[_0xa5c1('0x1d')]){_0x33b528[_0x567a36[_0xa5c1('0x1d')]]=_0x24156c['id'];}else{logger['info'](_0xa5c1('0x1e'));}}}return _0x415ce6[_0xa5c1('0x1f')](_0x567a36[_0xa5c1('0x10')])[_0xa5c1('0x20')](_0x33b528);}function getUser(_0x324c86,_0x69ba76,_0x415377){if(!_[_0xa5c1('0x21')](_0x69ba76)&&intUtil[_0xa5c1('0x22')](_0x69ba76)){var _0x13772b={'Email':_0x69ba76};var _0x1809af={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x415377[_0xa5c1('0x1f')](_0xa5c1('0x23'))[_0xa5c1('0x24')](_0x13772b,_0x1809af)[_0xa5c1('0x25')]()[_0xa5c1('0x26')](function(_0x2fe042){if(_0x2fe042[_0xa5c1('0x27')]){var _0x194ef4=_['find'](_0x2fe042,function(_0x52412d){return _0x52412d[_0xa5c1('0x28')]===_0x69ba76;});if(_0x194ef4){logger[_0xa5c1('0x29')]('Agent\x20%s\x20found.',_0x69ba76);return BPromise[_0xa5c1('0x2a')]({'id':_0x194ef4['Id'],'name':_0x194ef4[_0xa5c1('0x2b')]});}}else{logger[_0xa5c1('0x29')](_0xa5c1('0x2c'),_0x69ba76);return _0x415377[_0xa5c1('0x2d')]()[_0xa5c1('0x26')](function(_0x3a1497){return BPromise[_0xa5c1('0x2a')]({'id':_0x3a1497[_0xa5c1('0x2e')],'name':_0x3a1497[_0xa5c1('0x2f')]});});}});}else{logger[_0xa5c1('0x29')](_0xa5c1('0x2c'),_0x69ba76);return _0x415377['identity']()[_0xa5c1('0x26')](function(_0x3c0453){return BPromise[_0xa5c1('0x2a')]({'id':_0x3c0453[_0xa5c1('0x2e')],'name':_0x3c0453[_0xa5c1('0x2f')]});});}}function getEndUser(_0xbec11c,_0x374f1a,_0x1e5957,_0x2c73ba,_0x3b14e3){var _0x407b53={'$or':{'Phone':_0x2c73ba}};var _0x9f3f04={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xa5c1('0x26')](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x2c73ba,_0x374f1a[_0xa5c1('0x30')]);switch(_0x374f1a[_0xa5c1('0x30')]){case'contact_lead':var _0x21843e=_['cloneDeep'](_0x407b53);if(_0x374f1a[_0xa5c1('0x31')]){var _0x5560bc={};_0x5560bc[_0x374f1a[_0xa5c1('0x31')]]=_0x2c73ba;_[_0xa5c1('0x32')](_0x21843e[_0xa5c1('0x33')],_0x5560bc);}return _0x3b14e3[_0xa5c1('0x1f')](_0xa5c1('0x34'))[_0xa5c1('0x24')](_0x21843e,_0x9f3f04)[_0xa5c1('0x25')]()[_0xa5c1('0x26')](function(_0x4399ad){if(_0x4399ad&&_0x4399ad[_0xa5c1('0x27')]){return _0x4399ad;}else{var _0xf95340=_[_0xa5c1('0x35')](_0x407b53);if(_0x374f1a['additionalSearchLead']){var _0x5c6bf8={};_0x5c6bf8[_0x374f1a[_0xa5c1('0x36')]]=_0x2c73ba;_['merge'](_0xf95340[_0xa5c1('0x33')],_0x5c6bf8);}return _0x3b14e3['sobject'](_0xa5c1('0x37'))[_0xa5c1('0x24')](_0xf95340,_0x9f3f04);}});case _0xa5c1('0x38'):var _0x31fc3c=_[_0xa5c1('0x35')](_0x407b53);if(_0x374f1a[_0xa5c1('0x39')]){var _0x5560bc={};_0x5560bc[_0x374f1a[_0xa5c1('0x39')]]=_0x2c73ba;_['merge'](_0x31fc3c[_0xa5c1('0x33')],_0x5560bc);}return _0x3b14e3[_0xa5c1('0x1f')](_0xa5c1('0x3a'))['find'](_0x31fc3c,_0x9f3f04)[_0xa5c1('0x25')]()[_0xa5c1('0x26')](function(_0x1ff4c2){if(_0x1ff4c2&&_0x1ff4c2[_0xa5c1('0x27')]){return _0x1ff4c2;}else{var _0x1661a5=_[_0xa5c1('0x35')](_0x407b53);if(_0x374f1a[_0xa5c1('0x31')]){var _0x1525d6={};_0x1525d6[_0x374f1a[_0xa5c1('0x31')]]=_0x2c73ba;_[_0xa5c1('0x32')](_0x1661a5[_0xa5c1('0x33')],_0x1525d6);}return _0x3b14e3[_0xa5c1('0x1f')]('Contact')['find'](_0x1661a5,_0x9f3f04)[_0xa5c1('0x26')](function(_0x3a4bb3){if(_0x3a4bb3&&_0x3a4bb3[_0xa5c1('0x27')]){return _0x3a4bb3;}else{var _0x48ad11=_['cloneDeep'](_0x407b53);if(_0x374f1a[_0xa5c1('0x36')]){var _0x2cf365={};_0x2cf365[_0x374f1a['additionalSearchLead']]=_0x2c73ba;_['merge'](_0x48ad11[_0xa5c1('0x33')],_0x2cf365);}return _0x3b14e3['sobject'](_0xa5c1('0x37'))['find'](_0x48ad11,_0x9f3f04);}});}});case'contact':var _0x21843e=_[_0xa5c1('0x35')](_0x407b53);if(_0x374f1a[_0xa5c1('0x31')]){var _0x5560bc={};_0x5560bc[_0x374f1a[_0xa5c1('0x31')]]=_0x2c73ba;_[_0xa5c1('0x32')](_0x21843e[_0xa5c1('0x33')],_0x5560bc);}return _0x3b14e3[_0xa5c1('0x1f')](_0xa5c1('0x34'))[_0xa5c1('0x24')](_0x21843e,_0x9f3f04)[_0xa5c1('0x25')]();case'lead':var _0x4ab612=_[_0xa5c1('0x35')](_0x407b53);if(_0x374f1a[_0xa5c1('0x36')]){var _0x5560bc={};_0x5560bc[_0x374f1a[_0xa5c1('0x36')]]=_0x2c73ba;_[_0xa5c1('0x32')](_0x4ab612[_0xa5c1('0x33')],_0x5560bc);}return _0x3b14e3['sobject'](_0xa5c1('0x37'))[_0xa5c1('0x24')](_0x4ab612,_0x9f3f04);case _0xa5c1('0x19'):var _0x31fc3c=_[_0xa5c1('0x35')](_0x407b53);if(_0x374f1a[_0xa5c1('0x39')]){var _0x5560bc={};_0x5560bc[_0x374f1a['additionalSearchAccount']]=_0x2c73ba;_[_0xa5c1('0x32')](_0x31fc3c[_0xa5c1('0x33')],_0x5560bc);}return _0x3b14e3[_0xa5c1('0x1f')](_0xa5c1('0x3a'))[_0xa5c1('0x24')](_0x31fc3c,_0x9f3f04);default:return null;}})[_0xa5c1('0x26')](function(_0x152aed){if(_0x152aed&&_0x152aed[_0xa5c1('0x27')]){var _0x369295=_[_0xa5c1('0x3b')](_0x152aed);if(_0x369295){return BPromise[_0xa5c1('0x2a')]({'id':_0x369295['Id'],'name':_0x369295[_0xa5c1('0x2b')],'phone':_0x369295[_0xa5c1('0x3c')],'endUserType':_0x369295['attributes']['type'][_0xa5c1('0x3d')]()});}}})[_0xa5c1('0x26')](function(_0x8840c1){if(_0x8840c1){logger[_0xa5c1('0x29')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x8840c1['endUserType'],_0x2c73ba);return BPromise[_0xa5c1('0x2a')](_0x8840c1);}else{logger[_0xa5c1('0x29')](_0xa5c1('0x3e'),_0x2c73ba);var _0x3d9e58={'Phone':_0x2c73ba};if(_0x374f1a[_0xa5c1('0x3f')]){if(_0x374f1a[_0xa5c1('0x3f')]==='contact'){logger['info'](_0xa5c1('0x40'),_0x2c73ba,_0x374f1a[_0xa5c1('0x3f')]);_0x3d9e58[_0xa5c1('0x41')]=_0x1e5957!==_0xa5c1('0x42')?_0x1e5957:util['format'](_0xa5c1('0x43'),_0x2c73ba);}else if(_0x374f1a[_0xa5c1('0x3f')]===_0xa5c1('0x17')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2c73ba,_0x374f1a[_0xa5c1('0x3f')]);_0x3d9e58['LastName']=_0x1e5957!==_0xa5c1('0x42')?_0x1e5957:util[_0xa5c1('0x44')]('Caller\x20-\x20%s',_0x2c73ba);_0x3d9e58[_0xa5c1('0x45')]=_0xa5c1('0x46');}else if(_0x374f1a[_0xa5c1('0x3f')]===_0xa5c1('0x19')){logger['info'](_0xa5c1('0x40'),_0x2c73ba,_0x374f1a[_0xa5c1('0x3f')]);_0x3d9e58[_0xa5c1('0x2b')]=_0x1e5957!==_0xa5c1('0x42')?_0x1e5957:util['format']('Caller\x20-\x20%s',_0x2c73ba);}else{return null;}}return _0x3b14e3[_0xa5c1('0x1f')](_[_0xa5c1('0x47')](_0x374f1a[_0xa5c1('0x3f')]))[_0xa5c1('0x20')](_0x3d9e58)[_0xa5c1('0x26')](function(_0x1db8f0){return BPromise[_0xa5c1('0x2a')]({'id':_0x1db8f0['id'],'endUserType':_0x374f1a['moduleCreate']});});}});}function getCustomFields(_0x46b335,_0x3cc7cc){var _0x296eef={};if(_0x46b335[_0xa5c1('0x27')]>0x0){_['forEach'](_0x46b335,function(_0x5c5704){if(_[_0xa5c1('0x48')]([_0xa5c1('0x49'),_0xa5c1('0x4a')],_0x5c5704[_0xa5c1('0x4b')])&&_0x5c5704[_0xa5c1('0x4c')]){_0x296eef[_0x5c5704[_0xa5c1('0x4c')]]=_0x5c5704[_0xa5c1('0x4d')][_0xa5c1('0x4e')]();}else if(_0x5c5704[_0xa5c1('0x4b')]===_0xa5c1('0x4f')&&_0x5c5704[_0xa5c1('0x50')]&&_0x5c5704[_0xa5c1('0x4c')]){_0x3cc7cc[_0x5c5704['variableName']]&&(_0x296eef[_0x5c5704[_0xa5c1('0x4c')]]=_0x3cc7cc[_0x5c5704[_0xa5c1('0x50')]][_0xa5c1('0x4e')]());}else if(_0x5c5704[_0xa5c1('0x4b')]===_0xa5c1('0x51')&&_0x5c5704[_0xa5c1('0x52')]&&_0x5c5704['Variable'][_0xa5c1('0x53')]&&_0x5c5704['idField']){_0x3cc7cc[_0x5c5704[_0xa5c1('0x52')][_0xa5c1('0x53')][_0xa5c1('0x3d')]()]&&(_0x296eef[_0x5c5704[_0xa5c1('0x4c')]]=_0x3cc7cc[_0x5c5704['Variable'][_0xa5c1('0x53')]['toLowerCase']()][_0xa5c1('0x4e')]());}});}return _0x296eef;}function getConnection(_0x4d6c70){var _0x2d5f1d=_0x4d6c70[_0xa5c1('0x54')][_0xa5c1('0x55')](_0x4d6c70[_0xa5c1('0x56')]);var _0x302e8a=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4d6c70[_0xa5c1('0x57')]||_0xa5c1('0x58'),'clientId':_0x4d6c70[_0xa5c1('0x59')],'clientSecret':_0x4d6c70[_0xa5c1('0x5a')]}});return _0x302e8a[_0xa5c1('0x5b')](_0x4d6c70[_0xa5c1('0x5c')],_0x2d5f1d)['then'](function(){logger[_0xa5c1('0x29')]('Connection\x20established.');return _0x302e8a;});}exports['queue']=function(_0x59371e,_0x3f2c9f,_0x90ba5f,_0x5a3d7c,_0x5972a2,_0x45a73a){var _0x27ddeb,_0x2fc7fe,_0x5a5457,_0x328a10;_0x45a73a['serverUrl']=intUtil[_0xa5c1('0x5d')](_0x45a73a[_0xa5c1('0x5e')]);_0x45a73a[_0xa5c1('0x57')]=intUtil[_0xa5c1('0x5d')](_0x45a73a['remoteUri']);if(_0x5972a2&&_0x5972a2['monitor_format']){logger['info'](_0xa5c1('0x5f'),_0xa5c1('0x60'));_0x3f2c9f[_0xa5c1('0x61')]=util[_0xa5c1('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x45a73a['serverUrl'],_0x3f2c9f['uniqueid'],md5(_0x3f2c9f['uniqueid']));}else{_0x3f2c9f['recordingURL']='';}return getConnection(_0x45a73a)['then'](function(_0xed8f29){_0x328a10=_0xed8f29;return getUser(_0x45a73a,_0x5a3d7c[_0xa5c1('0x62')],_0x328a10);})[_0xa5c1('0x26')](function(_0x1bb44c){_0x27ddeb=_0x1bb44c;return getEndUser(_0x45a73a,_0x90ba5f,_0x3f2c9f['calleridname'],_0x3f2c9f[_0xa5c1('0x63')],_0x328a10);})['then'](function(_0x367b35){_0x2fc7fe=_0x367b35;return getTicket(_0x45a73a,_0x27ddeb,_0x2fc7fe,_0x90ba5f,_0x3f2c9f,_0x90ba5f[_0xa5c1('0x64')],_0x328a10,_0xa5c1('0x65'));})[_0xa5c1('0x26')](function(_0x363641){_0x5a5457=_0x363641;logger['info'](_0xa5c1('0x66'),_0x5a5457['id']);logger['info'](_0xa5c1('0x67'),_0x5a5457['id'],_0x5a3d7c['name'],_0x45a73a[_0xa5c1('0x4b')]);switch(_0x45a73a[_0xa5c1('0x4b')]){case _0xa5c1('0x68'):emit(util[_0xa5c1('0x44')](_0xa5c1('0x69'),_0x5a3d7c['name']),_0xa5c1('0x6a'),{'recordId':_0x5a5457['id']});break;case _0xa5c1('0x6b'):emit(util[_0xa5c1('0x44')](_0xa5c1('0x69'),_0x5a3d7c[_0xa5c1('0x53')]),'trigger:browser:url',{'uri':util[_0xa5c1('0x44')]('%s/%s/e',_0x328a10['instanceUrl'],_0x5a5457['id'])});break;default:logger[_0xa5c1('0x6c')](_0xa5c1('0x6d'));}})[_0xa5c1('0x6e')](function(_0x6f80d7){logger[_0xa5c1('0x6c')](_0xa5c1('0x5f'),_0x6f80d7);});};exports[_0xa5c1('0x6f')]=function(_0x2bed5c,_0x4e59e9,_0xa03128,_0x3913d5,_0x19e0ba,_0x401920,_0x10cfd1){var _0x2890cd,_0x53c2e0,_0x545f97,_0x41eef0;_0x401920['serverUrl']=intUtil['stripTrailingSlash'](_0x401920[_0xa5c1('0x5e')]);_0x401920[_0xa5c1('0x57')]=intUtil['stripTrailingSlash'](_0x401920[_0xa5c1('0x57')]);if(_0x10cfd1&&_0x10cfd1[_0xa5c1('0x70')]&&_0x10cfd1['recordingFormat']!==_0xa5c1('0x71')){logger[_0xa5c1('0x29')](_0xa5c1('0x72'),_0xa5c1('0x60'));_0x4e59e9['recordingURL']=util[_0xa5c1('0x44')](_0xa5c1('0x73'),_0x401920[_0xa5c1('0x5e')],_0x4e59e9[_0xa5c1('0x74')],md5(_0x4e59e9[_0xa5c1('0x74')]));}return getConnection(_0x401920)[_0xa5c1('0x26')](function(_0x43c631){_0x41eef0=_0x43c631;return getUser(_0x401920,_0x3913d5[_0xa5c1('0x62')],_0x41eef0);})[_0xa5c1('0x26')](function(_0x45be57){_0x2890cd=_0x45be57;return getEndUser(_0x401920,_0xa03128,_0x4e59e9[_0xa5c1('0x75')],_0x4e59e9[_0xa5c1('0x76')],_0x41eef0);})[_0xa5c1('0x26')](function(_0xf74435){_0x53c2e0=_0xf74435;return getTicket(_0x401920,_0x2890cd,_0x53c2e0,_0xa03128,_0x4e59e9,_0xa03128['Fields'],_0x41eef0,_0xa5c1('0x6f'));})[_0xa5c1('0x26')](function(_0x1dde3a){_0x545f97=_0x1dde3a;logger[_0xa5c1('0x29')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x545f97['id']);logger[_0xa5c1('0x29')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x545f97['id'],_0x3913d5[_0xa5c1('0x53')],_0x401920[_0xa5c1('0x4b')]);switch(_0x401920[_0xa5c1('0x4b')]){case _0xa5c1('0x68'):emit(util['format']('user:%s',_0x3913d5[_0xa5c1('0x53')]),_0xa5c1('0x6a'),{'recordId':_0x545f97['id']});break;case _0xa5c1('0x6b'):emit(util[_0xa5c1('0x44')](_0xa5c1('0x69'),_0x3913d5[_0xa5c1('0x53')]),'trigger:browser:url',{'uri':util[_0xa5c1('0x44')](_0xa5c1('0x77'),_0x41eef0['instanceUrl'],_0x545f97['id'])});break;default:logger[_0xa5c1('0x6c')](_0xa5c1('0x72'),_0xa5c1('0x78'));}})[_0xa5c1('0x6e')](function(_0x52fbda){logger[_0xa5c1('0x6c')](_0xa5c1('0x72'),_0x52fbda);});};exports[_0xa5c1('0x79')]=function(_0x5a9e79,_0x16cf05,_0x57c7b1,_0x42c307,_0x242b80,_0x272961){var _0x244f21,_0x264f65,_0x51f68f,_0x1183a8;_0x272961[_0xa5c1('0x5e')]=intUtil['stripTrailingSlash'](_0x272961['serverUrl']);_0x272961['remoteUri']=intUtil['stripTrailingSlash'](_0x272961[_0xa5c1('0x57')]);if(_0x242b80&&_0x242b80[_0xa5c1('0x7a')]){logger[_0xa5c1('0x29')]('['+_0x16cf05['lastevent'][_0xa5c1('0x7b')]()+']',_0xa5c1('0x60'));_0x16cf05['recordingURL']=util[_0xa5c1('0x44')](_0xa5c1('0x73'),_0x272961[_0xa5c1('0x5e')],_0x16cf05['uniqueid'],md5(_0x16cf05['uniqueid']));}else{_0x16cf05[_0xa5c1('0x61')]='';}return getConnection(_0x272961)[_0xa5c1('0x26')](function(_0x151f45){_0x1183a8=_0x151f45;if(!_[_0xa5c1('0x21')](_0x42c307)){return getUser(_0x272961,_0x42c307[_0xa5c1('0x53')],_0x1183a8);}else{return getUser(_0x272961,null,_0x1183a8);}})[_0xa5c1('0x26')](function(_0xb8c15e){_0x244f21=_0xb8c15e;return getEndUser(_0x272961,_0x57c7b1,_0x16cf05[_0xa5c1('0x7c')],_0x16cf05[_0xa5c1('0x63')],_0x1183a8);})[_0xa5c1('0x26')](function(_0x9d2829){_0x264f65=_0x9d2829;return getTicket(_0x272961,_0x244f21,_0x264f65,_0x57c7b1,_0x16cf05,_0x57c7b1[_0xa5c1('0x64')],_0x1183a8);})[_0xa5c1('0x26')](function(_0xe72de2){_0x51f68f=_0xe72de2;logger[_0xa5c1('0x29')]('['+_0x16cf05[_0xa5c1('0x7d')][_0xa5c1('0x7b')]()+_0xa5c1('0x7e'),_0x51f68f['id']);logger[_0xa5c1('0x29')]('['+_0x16cf05[_0xa5c1('0x7d')][_0xa5c1('0x7b')]()+_0xa5c1('0x7f'),_0x272961[_0xa5c1('0x4b')]);})['catch'](function(_0xfec56){logger[_0xa5c1('0x6c')]('['+_0x16cf05['lastevent'][_0xa5c1('0x7b')]()+']',_0xfec56);});}; \ No newline at end of file +var _0xaaff=['moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','additionalSearchLead','Lead','additionalSearchAccount','$or','Account','Contact','first','Phone','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','Name','forEach','includes','string','picklist','idField','content','toString','variable','variableName','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','login','username','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','queue','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','outbound','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','util','../../../../config/environment','salesforce','defaults','redis','localhost','socket.io-emitter','assign','getString','Subjects','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','contact','endUserType','lead','WhoId','account','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','sobject','User','find','execute','length','Email','Agent\x20%s\x20found.','resolve','identity','then','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xaaff,0x154));var _0xfaaf=function(_0x3550d4,_0xa10bca){_0x3550d4=_0x3550d4-0x0;var _0x1c8ba1=_0xaaff[_0x3550d4];return _0x1c8ba1;};'use strict';var _=require(_0xfaaf('0x0'));var rp=require(_0xfaaf('0x1'));var moment=require(_0xfaaf('0x2'));var BPromise=require(_0xfaaf('0x3'));var md5=require(_0xfaaf('0x4'));var jsforce=require('jsforce');var util=require(_0xfaaf('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xfaaf('0x6'));var logger=require('../../../../config/logger')(_0xfaaf('0x7'));config['redis']=_[_0xfaaf('0x8')](config[_0xfaaf('0x9')],{'host':_0xfaaf('0xa'),'port':0x18eb});var io=require(_0xfaaf('0xb'))(new Redis(config[_0xfaaf('0x9')]));function emit(_0x2775de,_0x12d4ab,_0x137aa5){io['to'](_0x2775de)['emit'](_0x12d4ab,_0x137aa5);}function getTicket(_0x289850,_0x496ec7,_0x921a3e,_0xe62506,_0x476ccb,_0x301a9e,_0x33912c,_0x327998){var _0x19b0ce=Object[_0xfaaf('0xc')]({},{'OwnerId':_0x496ec7['id'],'Subject':intUtil[_0xfaaf('0xd')](_0xe62506[_0xfaaf('0xe')],_0x476ccb,'\x20'),'Description':intUtil[_0xfaaf('0xd')](_0xe62506['Descriptions'],_0x476ccb,'\x0a')},getCustomFields(_0x301a9e,_0x476ccb));if(_0x921a3e){if(_0xe62506[_0xfaaf('0xf')]===_0xfaaf('0x10')){_0x19b0ce[_0xfaaf('0x11')]=moment[_0xfaaf('0x12')]();_0x19b0ce[_0xfaaf('0x13')]=![];_0x19b0ce[_0xfaaf('0x14')]=![];if(_0x921a3e['endUserType']===_0xfaaf('0x15')||_0x921a3e[_0xfaaf('0x16')]===_0xfaaf('0x17')){_0x19b0ce[_0xfaaf('0x18')]=_0x921a3e['id'];}else if(_0x921a3e['endUserType']===_0xfaaf('0x19')){_0x19b0ce['WhatId']=_0x921a3e['id'];}}else if(_0xe62506[_0xfaaf('0xf')]===_0xfaaf('0x1a')){if(_0x921a3e[_0xfaaf('0x16')]==='contact'){_0x19b0ce[_0xfaaf('0x1b')]=_0x921a3e['id'];}else if(_0x921a3e[_0xfaaf('0x16')]===_0xfaaf('0x19')){_0x19b0ce[_0xfaaf('0x1c')]=_0x921a3e['id'];}else if(_0x921a3e[_0xfaaf('0x16')]===_0xfaaf('0x17')&&_0xe62506[_0xfaaf('0x1d')]){_0x19b0ce[_0xe62506[_0xfaaf('0x1d')]]=_0x921a3e['id'];}else{logger[_0xfaaf('0x1e')](_0xfaaf('0x1f'));}}}return _0x33912c['sobject'](_0xe62506[_0xfaaf('0xf')])[_0xfaaf('0x20')](_0x19b0ce);}function getUser(_0x4fe071,_0x43ab64,_0x19024b){if(!_['isNil'](_0x43ab64)&&intUtil['validateEmail'](_0x43ab64)){var _0x14f3ec={'Email':_0x43ab64};var _0x643ced={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x19024b[_0xfaaf('0x21')](_0xfaaf('0x22'))[_0xfaaf('0x23')](_0x14f3ec,_0x643ced)[_0xfaaf('0x24')]()['then'](function(_0x573568){if(_0x573568[_0xfaaf('0x25')]){var _0x2dc1d2=_[_0xfaaf('0x23')](_0x573568,function(_0x1e1a53){return _0x1e1a53[_0xfaaf('0x26')]===_0x43ab64;});if(_0x2dc1d2){logger[_0xfaaf('0x1e')](_0xfaaf('0x27'),_0x43ab64);return BPromise[_0xfaaf('0x28')]({'id':_0x2dc1d2['Id'],'name':_0x2dc1d2['Name']});}}else{logger[_0xfaaf('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x43ab64);return _0x19024b[_0xfaaf('0x29')]()[_0xfaaf('0x2a')](function(_0x306c71){return BPromise[_0xfaaf('0x28')]({'id':_0x306c71[_0xfaaf('0x2b')],'name':_0x306c71[_0xfaaf('0x2c')]});});}});}else{logger[_0xfaaf('0x1e')](_0xfaaf('0x2d'),_0x43ab64);return _0x19024b['identity']()[_0xfaaf('0x2a')](function(_0x22c9fc){return BPromise['resolve']({'id':_0x22c9fc[_0xfaaf('0x2b')],'name':_0x22c9fc[_0xfaaf('0x2c')]});});}}function getEndUser(_0x517f12,_0x5594e1,_0x5e974c,_0x17223e,_0x7ed810){var _0x4374f5={'$or':{'Phone':_0x17223e}};var _0x233401={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xfaaf('0x2a')](function(){logger[_0xfaaf('0x1e')](_0xfaaf('0x2e'),_0x17223e,_0x5594e1[_0xfaaf('0x2f')]);switch(_0x5594e1[_0xfaaf('0x2f')]){case _0xfaaf('0x30'):var _0x111d59=_[_0xfaaf('0x31')](_0x4374f5);if(_0x5594e1[_0xfaaf('0x32')]){var _0x12bd6a={};_0x12bd6a[_0x5594e1[_0xfaaf('0x32')]]=_0x17223e;_[_0xfaaf('0x33')](_0x111d59['$or'],_0x12bd6a);}return _0x7ed810[_0xfaaf('0x21')]('Contact')[_0xfaaf('0x23')](_0x111d59,_0x233401)[_0xfaaf('0x24')]()[_0xfaaf('0x2a')](function(_0x1b1439){if(_0x1b1439&&_0x1b1439[_0xfaaf('0x25')]){return _0x1b1439;}else{var _0x12b7fa=_[_0xfaaf('0x31')](_0x4374f5);if(_0x5594e1[_0xfaaf('0x34')]){var _0x2991f7={};_0x2991f7[_0x5594e1['additionalSearchLead']]=_0x17223e;_[_0xfaaf('0x33')](_0x12b7fa['$or'],_0x2991f7);}return _0x7ed810['sobject'](_0xfaaf('0x35'))[_0xfaaf('0x23')](_0x12b7fa,_0x233401);}});case'account_contact_lead':var _0x4b203f=_[_0xfaaf('0x31')](_0x4374f5);if(_0x5594e1[_0xfaaf('0x36')]){var _0x12bd6a={};_0x12bd6a[_0x5594e1['additionalSearchAccount']]=_0x17223e;_[_0xfaaf('0x33')](_0x4b203f[_0xfaaf('0x37')],_0x12bd6a);}return _0x7ed810[_0xfaaf('0x21')](_0xfaaf('0x38'))['find'](_0x4b203f,_0x233401)[_0xfaaf('0x24')]()[_0xfaaf('0x2a')](function(_0x41ec40){if(_0x41ec40&&_0x41ec40['length']){return _0x41ec40;}else{var _0x54bf36=_['cloneDeep'](_0x4374f5);if(_0x5594e1[_0xfaaf('0x32')]){var _0x1fe639={};_0x1fe639[_0x5594e1[_0xfaaf('0x32')]]=_0x17223e;_[_0xfaaf('0x33')](_0x54bf36[_0xfaaf('0x37')],_0x1fe639);}return _0x7ed810[_0xfaaf('0x21')](_0xfaaf('0x39'))[_0xfaaf('0x23')](_0x54bf36,_0x233401)['then'](function(_0x97440e){if(_0x97440e&&_0x97440e['length']){return _0x97440e;}else{var _0x46da01=_['cloneDeep'](_0x4374f5);if(_0x5594e1[_0xfaaf('0x34')]){var _0x3e5348={};_0x3e5348[_0x5594e1[_0xfaaf('0x34')]]=_0x17223e;_['merge'](_0x46da01[_0xfaaf('0x37')],_0x3e5348);}return _0x7ed810[_0xfaaf('0x21')]('Lead')['find'](_0x46da01,_0x233401);}});}});case _0xfaaf('0x15'):var _0x111d59=_['cloneDeep'](_0x4374f5);if(_0x5594e1[_0xfaaf('0x32')]){var _0x12bd6a={};_0x12bd6a[_0x5594e1[_0xfaaf('0x32')]]=_0x17223e;_[_0xfaaf('0x33')](_0x111d59['$or'],_0x12bd6a);}return _0x7ed810[_0xfaaf('0x21')](_0xfaaf('0x39'))[_0xfaaf('0x23')](_0x111d59,_0x233401)[_0xfaaf('0x24')]();case _0xfaaf('0x17'):var _0x1a32f7=_['cloneDeep'](_0x4374f5);if(_0x5594e1[_0xfaaf('0x34')]){var _0x12bd6a={};_0x12bd6a[_0x5594e1[_0xfaaf('0x34')]]=_0x17223e;_[_0xfaaf('0x33')](_0x1a32f7[_0xfaaf('0x37')],_0x12bd6a);}return _0x7ed810['sobject'](_0xfaaf('0x35'))[_0xfaaf('0x23')](_0x1a32f7,_0x233401);case _0xfaaf('0x19'):var _0x4b203f=_[_0xfaaf('0x31')](_0x4374f5);if(_0x5594e1[_0xfaaf('0x36')]){var _0x12bd6a={};_0x12bd6a[_0x5594e1[_0xfaaf('0x36')]]=_0x17223e;_[_0xfaaf('0x33')](_0x4b203f[_0xfaaf('0x37')],_0x12bd6a);}return _0x7ed810[_0xfaaf('0x21')]('Account')['find'](_0x4b203f,_0x233401);default:return null;}})[_0xfaaf('0x2a')](function(_0x2b0aec){if(_0x2b0aec&&_0x2b0aec[_0xfaaf('0x25')]){var _0x16f5f7=_[_0xfaaf('0x3a')](_0x2b0aec);if(_0x16f5f7){return BPromise['resolve']({'id':_0x16f5f7['Id'],'name':_0x16f5f7['Name'],'phone':_0x16f5f7[_0xfaaf('0x3b')],'endUserType':_0x16f5f7[_0xfaaf('0x3c')][_0xfaaf('0x3d')]['toLowerCase']()});}}})[_0xfaaf('0x2a')](function(_0xdcd38){if(_0xdcd38){logger[_0xfaaf('0x1e')](_0xfaaf('0x3e'),_0xdcd38[_0xfaaf('0x16')],_0x17223e);return BPromise[_0xfaaf('0x28')](_0xdcd38);}else{logger[_0xfaaf('0x1e')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x17223e);var _0x168b37={'Phone':_0x17223e};if(_0x5594e1[_0xfaaf('0x3f')]){if(_0x5594e1[_0xfaaf('0x3f')]===_0xfaaf('0x15')){logger['info'](_0xfaaf('0x40'),_0x17223e,_0x5594e1['moduleCreate']);_0x168b37[_0xfaaf('0x41')]=_0x5e974c!==_0xfaaf('0x42')?_0x5e974c:util[_0xfaaf('0x43')](_0xfaaf('0x44'),_0x17223e);}else if(_0x5594e1[_0xfaaf('0x3f')]==='lead'){logger[_0xfaaf('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x17223e,_0x5594e1['moduleCreate']);_0x168b37[_0xfaaf('0x41')]=_0x5e974c!==_0xfaaf('0x42')?_0x5e974c:util[_0xfaaf('0x43')](_0xfaaf('0x44'),_0x17223e);_0x168b37[_0xfaaf('0x45')]=_0xfaaf('0x46');}else if(_0x5594e1[_0xfaaf('0x3f')]===_0xfaaf('0x19')){logger[_0xfaaf('0x1e')](_0xfaaf('0x40'),_0x17223e,_0x5594e1['moduleCreate']);_0x168b37[_0xfaaf('0x47')]=_0x5e974c!==_0xfaaf('0x42')?_0x5e974c:util['format'](_0xfaaf('0x44'),_0x17223e);}else{return null;}}return _0x7ed810[_0xfaaf('0x21')](_['upperFirst'](_0x5594e1[_0xfaaf('0x3f')]))[_0xfaaf('0x20')](_0x168b37)[_0xfaaf('0x2a')](function(_0x3839b6){return BPromise[_0xfaaf('0x28')]({'id':_0x3839b6['id'],'endUserType':_0x5594e1[_0xfaaf('0x3f')]});});}});}function getCustomFields(_0x414f77,_0x3213f6){var _0x275f33={};if(_0x414f77[_0xfaaf('0x25')]>0x0){_[_0xfaaf('0x48')](_0x414f77,function(_0x336713){if(_[_0xfaaf('0x49')]([_0xfaaf('0x4a'),_0xfaaf('0x4b')],_0x336713[_0xfaaf('0x3d')])&&_0x336713[_0xfaaf('0x4c')]){_0x275f33[_0x336713[_0xfaaf('0x4c')]]=_0x336713[_0xfaaf('0x4d')][_0xfaaf('0x4e')]();}else if(_0x336713[_0xfaaf('0x3d')]===_0xfaaf('0x4f')&&_0x336713[_0xfaaf('0x50')]&&_0x336713[_0xfaaf('0x4c')]){_0x3213f6[_0x336713['variableName']]&&(_0x275f33[_0x336713[_0xfaaf('0x4c')]]=_0x3213f6[_0x336713['variableName']][_0xfaaf('0x4e')]());}else if(_0x336713[_0xfaaf('0x3d')]==='customVariable'&&_0x336713[_0xfaaf('0x51')]&&_0x336713[_0xfaaf('0x51')][_0xfaaf('0x52')]&&_0x336713[_0xfaaf('0x4c')]){_0x3213f6[_0x336713[_0xfaaf('0x51')]['name']['toLowerCase']()]&&(_0x275f33[_0x336713[_0xfaaf('0x4c')]]=_0x3213f6[_0x336713['Variable'][_0xfaaf('0x52')]['toLowerCase']()][_0xfaaf('0x4e')]());}});}return _0x275f33;}function getConnection(_0x58bf58){var _0xae3fa8=_0x58bf58[_0xfaaf('0x53')][_0xfaaf('0x54')](_0x58bf58[_0xfaaf('0x55')]);var _0x5f0b19=new jsforce['Connection']({'oauth2':{'loginUrl':_0x58bf58[_0xfaaf('0x56')]||_0xfaaf('0x57'),'clientId':_0x58bf58[_0xfaaf('0x58')],'clientSecret':_0x58bf58['clientSecret']}});return _0x5f0b19[_0xfaaf('0x59')](_0x58bf58[_0xfaaf('0x5a')],_0xae3fa8)[_0xfaaf('0x2a')](function(){logger['info']('Connection\x20established.');return _0x5f0b19;});}exports['queue']=function(_0xe15247,_0x18ff77,_0x3bc0ff,_0x147559,_0x3d78c9,_0x2f880e){var _0x18e4d2,_0x6ddffd,_0x499f34,_0x4f1da6;_0x2f880e[_0xfaaf('0x5b')]=intUtil[_0xfaaf('0x5c')](_0x2f880e[_0xfaaf('0x5b')]);_0x2f880e[_0xfaaf('0x56')]=intUtil[_0xfaaf('0x5c')](_0x2f880e[_0xfaaf('0x56')]);if(_0x3d78c9&&_0x3d78c9[_0xfaaf('0x5d')]){logger[_0xfaaf('0x1e')]('[QUEUE]',_0xfaaf('0x5e'));_0x18ff77[_0xfaaf('0x5f')]=util['format'](_0xfaaf('0x60'),_0x2f880e[_0xfaaf('0x5b')],_0x18ff77['uniqueid'],md5(_0x18ff77[_0xfaaf('0x61')]));}else{_0x18ff77[_0xfaaf('0x5f')]='';}return getConnection(_0x2f880e)[_0xfaaf('0x2a')](function(_0x417da8){_0x4f1da6=_0x417da8;return getUser(_0x2f880e,_0x147559[_0xfaaf('0x62')],_0x4f1da6);})[_0xfaaf('0x2a')](function(_0x9c83c7){_0x18e4d2=_0x9c83c7;return getEndUser(_0x2f880e,_0x3bc0ff,_0x18ff77[_0xfaaf('0x63')],_0x18ff77[_0xfaaf('0x64')],_0x4f1da6);})[_0xfaaf('0x2a')](function(_0x596873){_0x6ddffd=_0x596873;return getTicket(_0x2f880e,_0x18e4d2,_0x6ddffd,_0x3bc0ff,_0x18ff77,_0x3bc0ff['Fields'],_0x4f1da6,_0xfaaf('0x65'));})[_0xfaaf('0x2a')](function(_0x4770cd){_0x499f34=_0x4770cd;logger[_0xfaaf('0x1e')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x499f34['id']);logger[_0xfaaf('0x1e')](_0xfaaf('0x66'),_0x499f34['id'],_0x147559[_0xfaaf('0x52')],_0x2f880e['type']);switch(_0x2f880e[_0xfaaf('0x3d')]){case _0xfaaf('0x67'):emit(util[_0xfaaf('0x43')](_0xfaaf('0x68'),_0x147559[_0xfaaf('0x52')]),_0xfaaf('0x69'),{'recordId':_0x499f34['id']});break;case _0xfaaf('0x6a'):emit(util['format'](_0xfaaf('0x68'),_0x147559[_0xfaaf('0x52')]),'trigger:browser:url',{'uri':util[_0xfaaf('0x43')](_0xfaaf('0x6b'),_0x4f1da6[_0xfaaf('0x6c')],_0x499f34['id'])});break;default:logger[_0xfaaf('0x6d')](_0xfaaf('0x6e'));}})[_0xfaaf('0x6f')](function(_0x8d5957){logger['error'](_0xfaaf('0x70'),_0x8d5957);});};exports['outbound']=function(_0x27e691,_0x30c276,_0x2ab19a,_0x40243c,_0x406d73,_0x162f3f,_0x45de74){var _0x21cb0c,_0x3ffbac,_0x197e1d,_0x5deaa8;_0x162f3f[_0xfaaf('0x5b')]=intUtil[_0xfaaf('0x5c')](_0x162f3f[_0xfaaf('0x5b')]);_0x162f3f[_0xfaaf('0x56')]=intUtil['stripTrailingSlash'](_0x162f3f[_0xfaaf('0x56')]);if(_0x45de74&&_0x45de74[_0xfaaf('0x71')]&&_0x45de74[_0xfaaf('0x71')]!==_0xfaaf('0x72')){logger[_0xfaaf('0x1e')](_0xfaaf('0x73'),_0xfaaf('0x5e'));_0x30c276[_0xfaaf('0x5f')]=util['format'](_0xfaaf('0x60'),_0x162f3f[_0xfaaf('0x5b')],_0x30c276[_0xfaaf('0x61')],md5(_0x30c276['uniqueid']));}return getConnection(_0x162f3f)[_0xfaaf('0x2a')](function(_0x57c1c6){_0x5deaa8=_0x57c1c6;return getUser(_0x162f3f,_0x40243c['email'],_0x5deaa8);})[_0xfaaf('0x2a')](function(_0x7c68ab){_0x21cb0c=_0x7c68ab;return getEndUser(_0x162f3f,_0x2ab19a,_0x30c276[_0xfaaf('0x74')],_0x30c276[_0xfaaf('0x75')],_0x5deaa8);})['then'](function(_0x466b02){_0x3ffbac=_0x466b02;return getTicket(_0x162f3f,_0x21cb0c,_0x3ffbac,_0x2ab19a,_0x30c276,_0x2ab19a[_0xfaaf('0x76')],_0x5deaa8,_0xfaaf('0x77'));})[_0xfaaf('0x2a')](function(_0x3a6668){_0x197e1d=_0x3a6668;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x197e1d['id']);logger['info'](_0xfaaf('0x78'),_0x197e1d['id'],_0x40243c[_0xfaaf('0x52')],_0x162f3f[_0xfaaf('0x3d')]);switch(_0x162f3f[_0xfaaf('0x3d')]){case _0xfaaf('0x67'):emit(util[_0xfaaf('0x43')](_0xfaaf('0x68'),_0x40243c['name']),_0xfaaf('0x69'),{'recordId':_0x197e1d['id']});break;case _0xfaaf('0x6a'):emit(util[_0xfaaf('0x43')]('user:%s',_0x40243c[_0xfaaf('0x52')]),_0xfaaf('0x79'),{'uri':util['format'](_0xfaaf('0x6b'),_0x5deaa8[_0xfaaf('0x6c')],_0x197e1d['id'])});break;default:logger['error']('[OUTBOUND]',_0xfaaf('0x7a'));}})['catch'](function(_0x3bf233){logger[_0xfaaf('0x6d')]('[OUTBOUND]',_0x3bf233);});};exports[_0xfaaf('0x7b')]=function(_0x10df36,_0x266be0,_0x23a2bc,_0x421209,_0x42644d,_0x38f11b){var _0x14faf5,_0x5d3835,_0x507e8b,_0x26be39;_0x38f11b[_0xfaaf('0x5b')]=intUtil['stripTrailingSlash'](_0x38f11b[_0xfaaf('0x5b')]);_0x38f11b[_0xfaaf('0x56')]=intUtil[_0xfaaf('0x5c')](_0x38f11b['remoteUri']);if(_0x42644d&&_0x42644d[_0xfaaf('0x5d')]){logger[_0xfaaf('0x1e')]('['+_0x266be0[_0xfaaf('0x7c')][_0xfaaf('0x7d')]()+']','Recording\x20is\x20enabled!');_0x266be0[_0xfaaf('0x5f')]=util[_0xfaaf('0x43')](_0xfaaf('0x60'),_0x38f11b['serverUrl'],_0x266be0['uniqueid'],md5(_0x266be0['uniqueid']));}else{_0x266be0[_0xfaaf('0x5f')]='';}return getConnection(_0x38f11b)[_0xfaaf('0x2a')](function(_0x4fe7c0){_0x26be39=_0x4fe7c0;if(!_[_0xfaaf('0x7e')](_0x421209)){return getUser(_0x38f11b,_0x421209[_0xfaaf('0x52')],_0x26be39);}else{return getUser(_0x38f11b,null,_0x26be39);}})['then'](function(_0x1245cc){_0x14faf5=_0x1245cc;return getEndUser(_0x38f11b,_0x23a2bc,_0x266be0[_0xfaaf('0x63')],_0x266be0[_0xfaaf('0x64')],_0x26be39);})[_0xfaaf('0x2a')](function(_0x43bb61){_0x5d3835=_0x43bb61;return getTicket(_0x38f11b,_0x14faf5,_0x5d3835,_0x23a2bc,_0x266be0,_0x23a2bc[_0xfaaf('0x76')],_0x26be39);})[_0xfaaf('0x2a')](function(_0x30b206){_0x507e8b=_0x30b206;logger[_0xfaaf('0x1e')]('['+_0x266be0[_0xfaaf('0x7c')][_0xfaaf('0x7d')]()+_0xfaaf('0x7f'),_0x507e8b['id']);logger[_0xfaaf('0x1e')]('['+_0x266be0[_0xfaaf('0x7c')][_0xfaaf('0x7d')]()+_0xfaaf('0x80'),_0x38f11b[_0xfaaf('0x3d')]);})[_0xfaaf('0x6f')](function(_0x56ed00){logger[_0xfaaf('0x6d')]('['+_0x266be0['lastevent'][_0xfaaf('0x7d')]()+']',_0x56ed00);});}; \ 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 d5daf7e..a8f16a3 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 _0x4205=['],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','toUpperCase','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','content','idField','toString','variable','variableName','customVariable','Variable','name','outbound','incident','assign','getString','Subjects','Descriptions','ticketId','ticketNumber','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','format','user:%s','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','serverUrl','%s/api/now/table/','remoteUri','email','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','ioredis','./util','../../../../config/logger','servicenow','redis','defaults','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info'];(function(_0x585133,_0x2412a1){var _0x18254a=function(_0x4c8aaf){while(--_0x4c8aaf){_0x585133['push'](_0x585133['shift']());}};_0x18254a(++_0x2412a1);}(_0x4205,0x1f0));var _0x5420=function(_0x495687,_0x1be726){_0x495687=_0x495687-0x0;var _0x4c672b=_0x4205[_0x495687];return _0x4c672b;};'use strict';var _=require(_0x5420('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require('util');var md5=require('md5');var Redis=require(_0x5420('0x1'));var intUtil=require(_0x5420('0x2'));var config=require('../../../../config/environment');var logger=require(_0x5420('0x3'))(_0x5420('0x4'));config[_0x5420('0x5')]=_[_0x5420('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5420('0x5')]));function getAdminUser(_0x197ba0,_0x4c6a3c,_0x4a28a8,_0x37a2cd,_0x1b4d5c,_0x1c2af6){return new Promise(function(_0x153b1e,_0x3b99a0){var _0x2cb1dd={'method':'GET','uri':_0x37a2cd+_0x5420('0x7')+'&'+_0x1b4d5c+'&'+_0x1c2af6,'auth':_0x4c6a3c,'json':!![]};return rp(_0x2cb1dd)[_0x5420('0x8')](function(_0x45c544){if(_0x45c544[_0x5420('0x9')][_0x5420('0xa')]>0x0){_0x4a28a8[_0x5420('0xb')]=_0x45c544[_0x5420('0x9')][0x0][_0x5420('0xc')];}logger[_0x5420('0xd')]('['+[_0x197ba0['toUpperCase']()]+_0x5420('0xe'),_0x4a28a8);_0x153b1e(_0x4a28a8);})[_0x5420('0xf')](function(_0x4cdf43){logger[_0x5420('0x10')]('['+[_0x197ba0['toUpperCase']()]+']',_0x4cdf43[_0x5420('0x11')]);_0x3b99a0(_0x4cdf43[_0x5420('0x11')]);});});}function getUser(_0x17ca41,_0x50a489,_0x499eec,_0x7103b5,_0x554459){return function(_0x39e0d7){logger[_0x5420('0xd')]('['+[_0x17ca41['toUpperCase']()]+_0x5420('0x12'),_0x39e0d7);return new Promise(function(_0x11d18f,_0x248057){if(intUtil[_0x5420('0x13')](_0x39e0d7[_0x5420('0x14')])){var _0x2da027={'method':_0x5420('0x15'),'uri':_0x499eec+'sys_user?sysparm_query=email%3D'+_0x39e0d7['userEmail']+'&'+_0x7103b5+'&'+_0x554459,'auth':_0x50a489,'json':!![]};logger[_0x5420('0xd')]('['+[_0x17ca41[_0x5420('0x16')]()]+'],\x20getUser\x20rp\x20obj',_0x2da027);return rp(_0x2da027)[_0x5420('0x8')](function(_0x25cfc2){logger[_0x5420('0xd')]('['+[_0x17ca41['toUpperCase']()]+'],\x20getUser\x20entity',_0x25cfc2);if(_0x25cfc2[_0x5420('0x9')]['length']>0x0&&String(_0x25cfc2[_0x5420('0x9')][0x0]['active'])==='true'){_0x39e0d7[_0x5420('0x17')]=_0x25cfc2['result'][0x0]['sys_id'];}else{_0x39e0d7['userId']=_0x39e0d7[_0x5420('0xb')];_0x39e0d7['userEmail']=_0x39e0d7[_0x5420('0x18')];}logger[_0x5420('0xd')]('['+[_0x17ca41[_0x5420('0x16')]()]+_0x5420('0x19'),_0x39e0d7);_0x11d18f(_0x39e0d7);})['catch'](function(_0x4a1f2c){logger[_0x5420('0x10')]('['+[_0x17ca41['toUpperCase']()]+']',_0x4a1f2c[_0x5420('0x11')]);_0x248057(_0x4a1f2c[_0x5420('0x11')]);});}else{logger['info']('['+[_0x17ca41[_0x5420('0x16')]()]+_0x5420('0x1a'));_0x39e0d7[_0x5420('0x17')]=_0x39e0d7[_0x5420('0xb')];_0x39e0d7['userEmail']=_0x39e0d7['adminEmail'];_0x11d18f(_0x39e0d7);}});};}function createEndUser(_0xae91fc,_0x166235,_0x19192f,_0x2d68fe,_0x4a61ac){logger[_0x5420('0xd')]('['+[_0xae91fc['toUpperCase']()]+_0x5420('0x1b'),_0x19192f);return new Promise(function(_0x187b51,_0x478f33){var _0x4dfc19={'method':_0x5420('0x1c'),'uri':_0x2d68fe+_0x5420('0x1d')+_0x4a61ac,'body':{'user_name':_0x19192f[_0x5420('0x1e')],'roles':_0x5420('0x1f'),'first_name':_0x19192f['endUserNumber'],'active':_0x5420('0x20'),'date_format':_0x5420('0x21'),'phone':_0x19192f[_0x5420('0x1e')]},'auth':_0x166235,'json':!![]};return rp(_0x4dfc19)[_0x5420('0x8')](function(_0x5cff62){logger[_0x5420('0xd')]('['+[_0xae91fc['toUpperCase']()]+_0x5420('0x22'),_0x5cff62[_0x5420('0x9')]);_0x19192f[_0x5420('0x23')]=_0x5cff62[_0x5420('0x9')][_0x5420('0xc')];_0x187b51(_0x19192f);})[_0x5420('0xf')](function(_0x1c7d09){logger['error']('['+[_0xae91fc[_0x5420('0x16')]()]+']',_0x1c7d09['message']);_0x478f33(_0x1c7d09[_0x5420('0x11')]);});});}function getEndUser(_0x26e271,_0x243528,_0x1b52c8,_0x273b0a,_0xb6e6d3){return function(_0x20a49f){logger[_0x5420('0xd')]('['+[_0x26e271['toUpperCase']()]+_0x5420('0x24'),_0x20a49f);return new Promise(function(_0x3cb879,_0x3d83bd){var _0xc69af6={'method':_0x5420('0x15'),'uri':_0x1b52c8+'sys_user?sysparm_query=phone%3D'+_0x20a49f[_0x5420('0x1e')]+'&'+_0x273b0a+'&'+_0xb6e6d3,'auth':_0x243528,'json':!![]};return rp(_0xc69af6)['then'](function(_0x39ceaa){if(_0x39ceaa[_0x5420('0x9')][_0x5420('0xa')]>0x0){_0x20a49f['endUserId']=_0x39ceaa[_0x5420('0x9')][0x0]['sys_id'];logger['info']('['+[_0x26e271[_0x5420('0x16')]()]+_0x5420('0x25'),_0x20a49f);_0x3cb879(_0x20a49f);}else{return createEndUser(_0x26e271,_0x243528,_0x20a49f,_0x1b52c8,_0x273b0a)[_0x5420('0x8')](function(_0x29bb26){logger[_0x5420('0xd')]('['+[_0x26e271[_0x5420('0x16')]()]+_0x5420('0x26'),_0x29bb26);_0x3cb879(_0x29bb26);});}})[_0x5420('0xf')](function(_0x169912){logger[_0x5420('0x10')]('['+[_0x26e271[_0x5420('0x16')]()]+']',_0x169912[_0x5420('0x11')]);_0x3d83bd(_0x169912[_0x5420('0x11')]);});});};}function getCustomFields(_0x48a338,_0x927a72){var _0x4a3cbb={};if(_0x48a338[_0x5420('0xa')]>0x0){_[_0x5420('0x27')](_0x48a338,function(_0x2ac03c){if(_[_0x5420('0x28')]([_0x5420('0x29'),_0x5420('0x2a')],_0x2ac03c[_0x5420('0x2b')])&&_0x2ac03c['nameField']&&!_0x2ac03c[_0x5420('0x2c')]){_0x4a3cbb[_0x2ac03c[_0x5420('0x2d')][_0x5420('0x2e')]()]=_0x2ac03c[_0x5420('0x2f')]['toString']();}else if(_[_0x5420('0x28')](['string',_0x5420('0x2a')],_0x2ac03c[_0x5420('0x2b')])&&_0x2ac03c[_0x5420('0x30')]&&_0x2ac03c[_0x5420('0x2c')]){_0x4a3cbb[_0x2ac03c[_0x5420('0x30')][_0x5420('0x2e')]()]=_0x2ac03c[_0x5420('0x2f')][_0x5420('0x31')]();}else if(_0x2ac03c[_0x5420('0x2b')]===_0x5420('0x32')&&_0x2ac03c[_0x5420('0x33')]&&_0x2ac03c[_0x5420('0x30')]&&_0x2ac03c[_0x5420('0x2c')]){_0x4a3cbb[_0x2ac03c[_0x5420('0x30')][_0x5420('0x2e')]()]=_0x927a72[_0x2ac03c[_0x5420('0x33')]]['toString']();}else if(_0x2ac03c[_0x5420('0x2b')]===_0x5420('0x34')&&_0x2ac03c[_0x5420('0x35')]&&_0x2ac03c[_0x5420('0x35')][_0x5420('0x36')]&&_0x2ac03c[_0x5420('0x30')]&&_0x2ac03c[_0x5420('0x2c')]){_0x4a3cbb[_0x2ac03c['idField'][_0x5420('0x2e')]()]=_0x927a72[_0x2ac03c['Variable'][_0x5420('0x36')][_0x5420('0x2e')]()][_0x5420('0x31')]();}});}return _0x4a3cbb;}function getTicket(_0x264693,_0x197c29,_0x250e2d,_0x241c81,_0x5a1358,_0x1f6d0e){return function(_0x4b3075){logger[_0x5420('0xd')]('['+[_0x264693[_0x5420('0x16')]()]+']\x20getTicket\x20input\x20crm',_0x4b3075);return new Promise(function(_0x1ab5e8,_0x4d69ca){var _0x9f1465=_0x264693[_0x5420('0x2e')]()===_0x5420('0x37')?_0x4b3075[_0x5420('0x17')]:_0x4b3075['endUserId'];var _0x561ea8={'method':_0x5420('0x1c'),'uri':_0x250e2d+_0x5420('0x38')+'?'+_0x1f6d0e,'body':Object[_0x5420('0x39')]({},{'active':_0x5420('0x20'),'caller_id':_0x9f1465,'assigned_to':_0x4b3075[_0x5420('0x17')],'short_description':intUtil[_0x5420('0x3a')](_0x241c81[_0x5420('0x3b')],_0x5a1358,'\x20'),'description':intUtil['getString'](_0x241c81[_0x5420('0x3c')],_0x5a1358,'\x0a')},getCustomFields(_0x241c81['Fields'],_0x5a1358)),'auth':_0x197c29,'json':!![]};return rp(_0x561ea8)['then'](function(_0x487ee3){logger['info']('['+[_0x264693['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0x487ee3[_0x5420('0x9')]);_0x4b3075[_0x5420('0x3d')]=_0x487ee3[_0x5420('0x9')]['sys_id'];_0x4b3075[_0x5420('0x3e')]=_0x487ee3[_0x5420('0x9')]['number'];logger[_0x5420('0xd')]('['+[_0x264693[_0x5420('0x16')]()]+']\x20getTicket\x20crm',_0x4b3075);_0x1ab5e8(_0x4b3075);})['catch'](function(_0x359380){logger['error']('['+[_0x264693[_0x5420('0x16')]()]+']',_0x359380[_0x5420('0x11')]);_0x4d69ca(_0x359380[_0x5420('0x11')]);});});};}function createRemoteTag(_0x5c6f5c,_0xd91552,_0x45c52d,_0x49afba){return new Promise(function(_0xc75c9a,_0x44fd26){var _0x338ace={'method':'POST','uri':_0x45c52d+_0x5420('0x3f')+'?'+_0x49afba,'body':{'short_description':_0x5c6f5c,'global':!![],'active':!![],'name':_0x5c6f5c},'auth':_0xd91552,'json':!![]};return rp(_0x338ace)[_0x5420('0x8')](function(_0x192027){var _0x3e2ad2=_0x192027['result'][_0x5420('0xc')];_0xc75c9a(_0x3e2ad2);});});}function getRemoteTag(_0x308767,_0x5b1f4e,_0x215948,_0x54a798,_0x72213b){return new Promise(function(_0x238ab4,_0x4ab639){var _0x3f3feb={'method':_0x5420('0x15'),'uri':_0x215948+_0x5420('0x3f')+_0x5420('0x40')+_0x308767+'&'+_0x54a798,'auth':_0x5b1f4e,'json':!![]};return rp(_0x3f3feb)[_0x5420('0x8')](function(_0x333bce){if(_0x333bce['result'][_0x5420('0xa')]>0x0){var _0x108bc3=_0x333bce['result'][0x0][_0x5420('0xc')];_0x238ab4(_0x108bc3);}else{return createRemoteTag(_0x308767,_0x5b1f4e,_0x215948,_0x54a798)[_0x5420('0x8')](function(_0x244c7c){_0x238ab4(_0x244c7c);});}});});}function assignTagToIncident(_0x155152,_0x3c08fc,_0x16c4c8,_0x57ff80,_0x3ee9d4){return new Promise(function(_0x1ca7e2,_0x42d49b){var _0x5a1722={'method':_0x5420('0x1c'),'uri':_0x16c4c8+_0x5420('0x41')+'?'+_0x3ee9d4,'body':{'label':_0x155152,'table':_0x5420('0x38'),'id_type':_0x5420('0x42'),'table_key':_0x57ff80[_0x5420('0x3d')],'title':_0x5420('0x43')+_0x57ff80['ticketNumber'],'id_display':_0x57ff80[_0x5420('0x3e')]},'auth':_0x3c08fc,'json':!![]};return rp(_0x5a1722)['then'](function(_0x54c591){_0x1ca7e2();})[_0x5420('0xf')](function(){_0x1ca7e2();});});}function manageTags(_0x4ce417,_0x4b8cb1,_0x1999f6,_0x1724e3,_0x3b92b4,_0x5ce6b3,_0x532c47){return new Promise(function(_0x612abb,_0xe3f41c){var _0x4a9c44=[];_0x4b8cb1[_0x5420('0x27')](function(_0x406f1a){_0x4a9c44[_0x5420('0x44')](getRemoteTag(_0x406f1a,_0x1999f6,_0x1724e3,_0x5ce6b3,_0x532c47));});return Promise[_0x5420('0x45')](_0x4a9c44)[_0x5420('0x8')](function(_0x535bdf){if(_0x535bdf[_0x5420('0xa')]){logger[_0x5420('0xd')]('['+[_0x4ce417[_0x5420('0x16')]()]+_0x5420('0x46'),_0x535bdf);var _0x4456f4=[];_0x535bdf[_0x5420('0x27')](function(_0x1946d3){_0x4456f4[_0x5420('0x44')](assignTagToIncident(_0x1946d3,_0x1999f6,_0x1724e3,_0x3b92b4,_0x5ce6b3));});return Promise['all'](_0x4456f4)[_0x5420('0x8')](function(){_0x612abb();})[_0x5420('0xf')](function(){_0x612abb();});}else{_0x612abb();}});});}function getTags(_0xb46e86,_0xdfe6aa,_0x515ee4,_0x46c91d,_0x108296,_0x242c6a){return function(_0x1273f7){return new Promise(function(_0x11aa3d,_0xfe0a7){var _0x3d9355=[];var _0x20fba7=_0x46c91d[_0x5420('0x47')];if(_0x20fba7&&_0x20fba7[_0x5420('0xa')]>0x0){_0x3d9355=_[_0x5420('0x48')](_0x20fba7,'name');}if(_0x3d9355[_0x5420('0xa')]>0x0){return manageTags(_0xb46e86,_0x3d9355,_0xdfe6aa,_0x515ee4,_0x1273f7,_0x108296,_0x242c6a)[_0x5420('0x8')](function(){_0x11aa3d(_0x1273f7);});}else{_0x11aa3d(_0x1273f7);}});};}function emit(_0x848d2a,_0x2d0e5d,_0x160dce){var _0x3eecdb=_0x5420('0x49')+_0x5420('0x4a')+_0x5420('0x4b')+'%255EORDERBYDESCnumber';var _0x4ea11e={'uri':_0x848d2a+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x160dce+_0x3eecdb};io['to'](util[_0x5420('0x4c')](_0x5420('0x4d'),_0x2d0e5d))['emit'](_0x5420('0x4e'),_0x4ea11e);}exports['cs']=function(_0x7762c,_0x39cc2a,_0x23ee80,_0x119889,_0x4b4e92,_0x71d00d,_0x3cc9a8,_0x5566d2){var _0x7cb04d={};var _0x3dc34a={'user':_0x71d00d[_0x5420('0x4f')],'pass':_0x71d00d['password']};var _0x21aeb6=_0x5420('0x50');var _0x22d1b6=_0x5420('0x51');_0x71d00d['remoteUri']=intUtil[_0x5420('0x52')](_0x71d00d['remoteUri']);_0x71d00d[_0x5420('0x53')]=intUtil[_0x5420('0x52')](_0x71d00d['serverUrl']);var _0x5939a9=util[_0x5420('0x4c')](_0x5420('0x54'),_0x71d00d[_0x5420('0x55')]);_0x7cb04d[_0x5420('0x14')]=!_['isNil'](_0x119889)?_0x119889['email']:null;_0x7cb04d[_0x5420('0x18')]=_0x71d00d[_0x5420('0x56')];_0x7cb04d[_0x5420('0x1e')]=_0x5566d2[_0x5420('0x2e')]()===_0x5420('0x37')?_0x39cc2a['destcalleridnum']:_0x39cc2a[_0x5420('0x57')];_0x7cb04d[_0x5420('0x58')]=_0x5566d2===_0x5420('0x59')||_0x5566d2===_0x5420('0x5a')?_0x5420('0x59'):_0x5420('0x37');var _0x1c4f0e=util[_0x5420('0x4c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x71d00d[_0x5420('0x53')],_0x39cc2a[_0x5420('0x5b')],md5(_0x39cc2a[_0x5420('0x5b')]));if(_0x4b4e92&&_0x4b4e92[_0x5420('0x5c')]){logger[_0x5420('0xd')](_0x5420('0x5d'),_0x5420('0x5e'));_0x39cc2a['recordingURL']=_0x1c4f0e;}else if(_0x3cc9a8&&_0x3cc9a8[_0x5420('0x5f')]&&_0x3cc9a8[_0x5420('0x5f')]!==_0x5420('0x60')){logger[_0x5420('0xd')](_0x5420('0x61'),_0x5420('0x5e'));_0x39cc2a['recordingURL']=_0x1c4f0e;}else{_0x39cc2a[_0x5420('0x62')]='';}return getAdminUser(_0x5566d2,_0x3dc34a,_0x7cb04d,_0x5939a9,_0x22d1b6,_0x21aeb6)[_0x5420('0x8')](getUser(_0x5566d2,_0x3dc34a,_0x5939a9,_0x22d1b6,_0x21aeb6))['then'](getEndUser(_0x5566d2,_0x3dc34a,_0x5939a9,_0x22d1b6,_0x21aeb6))[_0x5420('0x8')](getTicket(_0x5566d2,_0x3dc34a,_0x5939a9,_0x23ee80,_0x39cc2a,_0x22d1b6))[_0x5420('0x8')](function(_0xc2dd1d){logger[_0x5420('0xd')](util[_0x5420('0x4c')]('The\x20ticket\x20ID\x20is:\x20%s',_0xc2dd1d[_0x5420('0x3d')]));logger[_0x5420('0xd')](util['format'](_0x5420('0x63'),_0x5566d2));if(_0x5566d2!==_0x5420('0x5a')){logger['info']('['+[_0x5566d2[_0x5420('0x16')]()]+']',_0x5420('0x64'));emit(_0x71d00d[_0x5420('0x55')],_0x119889[_0x5420('0x36')],_0xc2dd1d[_0x5420('0x3d')]);}})[_0x5420('0xf')](function(_0x206fe6){logger[_0x5420('0x10')]('['+[_0x5566d2['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x5420('0x65')](_0x206fe6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xedee=['lodash','bluebird','md5','ioredis','./util','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','GET','then','length','adminId','result','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','endUserId','],\x20getEndUser\x20crm','forEach','includes','string','type','nameField','content','toString','idField','customField','toLowerCase','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','unmanaged','queue','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','ticketId','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xedee,0xe0));var _0xeede=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xedee[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xeede('0x0'));var Promise=require(_0xeede('0x1'));var rp=require('request-promise');var util=require('util');var md5=require(_0xeede('0x2'));var Redis=require(_0xeede('0x3'));var intUtil=require(_0xeede('0x4'));var config=require('../../../../config/environment');var logger=require(_0xeede('0x5'))(_0xeede('0x6'));config['redis']=_[_0xeede('0x7')](config[_0xeede('0x8')],{'host':_0xeede('0x9'),'port':0x18eb});var io=require(_0xeede('0xa'))(new Redis(config[_0xeede('0x8')]));function getAdminUser(_0x192f1a,_0x5806f6,_0x50a314,_0xf63ec2,_0x173430,_0x4f7435){return new Promise(function(_0x4f29d8,_0x588f48){var _0x12baf1={'method':_0xeede('0xb'),'uri':_0xf63ec2+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x173430+'&'+_0x4f7435,'auth':_0x5806f6,'json':!![]};return rp(_0x12baf1)[_0xeede('0xc')](function(_0x19d799){if(_0x19d799['result'][_0xeede('0xd')]>0x0){_0x50a314[_0xeede('0xe')]=_0x19d799[_0xeede('0xf')][0x0][_0xeede('0x10')];}logger[_0xeede('0x11')]('['+[_0x192f1a['toUpperCase']()]+_0xeede('0x12'),_0x50a314);_0x4f29d8(_0x50a314);})[_0xeede('0x13')](function(_0x4849f4){logger[_0xeede('0x14')]('['+[_0x192f1a[_0xeede('0x15')]()]+']',_0x4849f4[_0xeede('0x16')]);_0x588f48(_0x4849f4[_0xeede('0x16')]);});});}function getUser(_0x5509e0,_0x294a0b,_0x3d2789,_0x5adff6,_0x322acc){return function(_0x25da51){logger[_0xeede('0x11')]('['+[_0x5509e0[_0xeede('0x15')]()]+_0xeede('0x17'),_0x25da51);return new Promise(function(_0x559b56,_0x4332b2){if(intUtil['validateEmail'](_0x25da51['userEmail'])){var _0x17b2fc={'method':_0xeede('0xb'),'uri':_0x3d2789+_0xeede('0x18')+_0x25da51[_0xeede('0x19')]+'&'+_0x5adff6+'&'+_0x322acc,'auth':_0x294a0b,'json':!![]};logger[_0xeede('0x11')]('['+[_0x5509e0[_0xeede('0x15')]()]+_0xeede('0x1a'),_0x17b2fc);return rp(_0x17b2fc)[_0xeede('0xc')](function(_0x574261){logger['info']('['+[_0x5509e0[_0xeede('0x15')]()]+_0xeede('0x1b'),_0x574261);if(_0x574261['result']['length']>0x0&&String(_0x574261[_0xeede('0xf')][0x0][_0xeede('0x1c')])===_0xeede('0x1d')){_0x25da51[_0xeede('0x1e')]=_0x574261[_0xeede('0xf')][0x0][_0xeede('0x10')];}else{_0x25da51['userId']=_0x25da51[_0xeede('0xe')];_0x25da51['userEmail']=_0x25da51[_0xeede('0x1f')];}logger[_0xeede('0x11')]('['+[_0x5509e0[_0xeede('0x15')]()]+_0xeede('0x20'),_0x25da51);_0x559b56(_0x25da51);})['catch'](function(_0x48cd6c){logger[_0xeede('0x14')]('['+[_0x5509e0['toUpperCase']()]+']',_0x48cd6c[_0xeede('0x16')]);_0x4332b2(_0x48cd6c[_0xeede('0x16')]);});}else{logger[_0xeede('0x11')]('['+[_0x5509e0[_0xeede('0x15')]()]+_0xeede('0x21'));_0x25da51[_0xeede('0x1e')]=_0x25da51[_0xeede('0xe')];_0x25da51[_0xeede('0x19')]=_0x25da51[_0xeede('0x1f')];_0x559b56(_0x25da51);}});};}function createEndUser(_0x42a774,_0x491dcc,_0x3c3853,_0x55ba5f,_0x37c268){logger['info']('['+[_0x42a774['toUpperCase']()]+_0xeede('0x22'),_0x3c3853);return new Promise(function(_0x59a477,_0x4407bd){var _0x55f78a={'method':_0xeede('0x23'),'uri':_0x55ba5f+_0xeede('0x24')+_0x37c268,'body':{'user_name':_0x3c3853[_0xeede('0x25')],'roles':_0xeede('0x26'),'first_name':_0x3c3853[_0xeede('0x25')],'active':'true','date_format':_0xeede('0x27'),'phone':_0x3c3853[_0xeede('0x25')]},'auth':_0x491dcc,'json':!![]};return rp(_0x55f78a)[_0xeede('0xc')](function(_0x117ec0){logger[_0xeede('0x11')]('['+[_0x42a774[_0xeede('0x15')]()]+_0xeede('0x28'),_0x117ec0[_0xeede('0xf')]);_0x3c3853['endUserId']=_0x117ec0[_0xeede('0xf')][_0xeede('0x10')];_0x59a477(_0x3c3853);})[_0xeede('0x13')](function(_0x31d651){logger[_0xeede('0x14')]('['+[_0x42a774[_0xeede('0x15')]()]+']',_0x31d651[_0xeede('0x16')]);_0x4407bd(_0x31d651[_0xeede('0x16')]);});});}function getEndUser(_0x19a26b,_0x20fefc,_0xb0cee6,_0x5d5df6,_0x4b4e8e){return function(_0x3cb31d){logger[_0xeede('0x11')]('['+[_0x19a26b[_0xeede('0x15')]()]+_0xeede('0x29'),_0x3cb31d);return new Promise(function(_0x16c40c,_0x305e4a){var _0x32e475={'method':_0xeede('0xb'),'uri':_0xb0cee6+'sys_user?sysparm_query=phone%3D'+_0x3cb31d['endUserNumber']+'&'+_0x5d5df6+'&'+_0x4b4e8e,'auth':_0x20fefc,'json':!![]};return rp(_0x32e475)[_0xeede('0xc')](function(_0x1730fe){if(_0x1730fe[_0xeede('0xf')][_0xeede('0xd')]>0x0){_0x3cb31d[_0xeede('0x2a')]=_0x1730fe[_0xeede('0xf')][0x0][_0xeede('0x10')];logger[_0xeede('0x11')]('['+[_0x19a26b['toUpperCase']()]+_0xeede('0x2b'),_0x3cb31d);_0x16c40c(_0x3cb31d);}else{return createEndUser(_0x19a26b,_0x20fefc,_0x3cb31d,_0xb0cee6,_0x5d5df6)['then'](function(_0xdd3774){logger[_0xeede('0x11')]('['+[_0x19a26b[_0xeede('0x15')]()]+'],\x20createEndUser\x20crm',_0xdd3774);_0x16c40c(_0xdd3774);});}})[_0xeede('0x13')](function(_0x49cd8f){logger[_0xeede('0x14')]('['+[_0x19a26b[_0xeede('0x15')]()]+']',_0x49cd8f[_0xeede('0x16')]);_0x305e4a(_0x49cd8f[_0xeede('0x16')]);});});};}function getCustomFields(_0x7be8d5,_0x61d395){var _0x592f02={};if(_0x7be8d5[_0xeede('0xd')]>0x0){_[_0xeede('0x2c')](_0x7be8d5,function(_0x366eea){if(_[_0xeede('0x2d')]([_0xeede('0x2e'),'picklist'],_0x366eea[_0xeede('0x2f')])&&_0x366eea[_0xeede('0x30')]&&!_0x366eea['customField']){_0x592f02[_0x366eea['nameField']['toLowerCase']()]=_0x366eea[_0xeede('0x31')][_0xeede('0x32')]();}else if(_[_0xeede('0x2d')]([_0xeede('0x2e'),'picklist'],_0x366eea['type'])&&_0x366eea[_0xeede('0x33')]&&_0x366eea[_0xeede('0x34')]){_0x592f02[_0x366eea[_0xeede('0x33')][_0xeede('0x35')]()]=_0x366eea['content'][_0xeede('0x32')]();}else if(_0x366eea[_0xeede('0x2f')]===_0xeede('0x36')&&_0x366eea['variableName']&&_0x366eea['idField']&&_0x366eea['customField']){_0x592f02[_0x366eea['idField'][_0xeede('0x35')]()]=_0x61d395[_0x366eea[_0xeede('0x37')]]['toString']();}else if(_0x366eea[_0xeede('0x2f')]===_0xeede('0x38')&&_0x366eea[_0xeede('0x39')]&&_0x366eea['Variable'][_0xeede('0x3a')]&&_0x366eea['idField']&&_0x366eea['customField']){_0x592f02[_0x366eea[_0xeede('0x33')][_0xeede('0x35')]()]=_0x61d395[_0x366eea['Variable'][_0xeede('0x3a')][_0xeede('0x35')]()][_0xeede('0x32')]();}});}return _0x592f02;}function getTicket(_0x177b3e,_0x31345e,_0x162a0d,_0x5ca0e8,_0x300c5b,_0x117092){return function(_0x46cbc9){logger[_0xeede('0x11')]('['+[_0x177b3e['toUpperCase']()]+_0xeede('0x3b'),_0x46cbc9);return new Promise(function(_0x1bde5f,_0x338cc5){var _0x145e7b=_0x177b3e[_0xeede('0x35')]()===_0xeede('0x3c')?_0x46cbc9[_0xeede('0x1e')]:_0x46cbc9['endUserId'];var _0xc78fe5={'method':'POST','uri':_0x162a0d+_0xeede('0x3d')+'?'+_0x117092,'body':Object[_0xeede('0x3e')]({},{'active':'true','caller_id':_0x145e7b,'assigned_to':_0x46cbc9['userId'],'short_description':intUtil[_0xeede('0x3f')](_0x5ca0e8['Subjects'],_0x300c5b,'\x20'),'description':intUtil[_0xeede('0x3f')](_0x5ca0e8['Descriptions'],_0x300c5b,'\x0a')},getCustomFields(_0x5ca0e8[_0xeede('0x40')],_0x300c5b)),'auth':_0x31345e,'json':!![]};return rp(_0xc78fe5)['then'](function(_0x4e13a8){logger['info']('['+[_0x177b3e[_0xeede('0x15')]()]+_0xeede('0x41'),_0x4e13a8[_0xeede('0xf')]);_0x46cbc9['ticketId']=_0x4e13a8['result'][_0xeede('0x10')];_0x46cbc9[_0xeede('0x42')]=_0x4e13a8[_0xeede('0xf')][_0xeede('0x43')];logger[_0xeede('0x11')]('['+[_0x177b3e[_0xeede('0x15')]()]+_0xeede('0x44'),_0x46cbc9);_0x1bde5f(_0x46cbc9);})[_0xeede('0x13')](function(_0x318c99){logger['error']('['+[_0x177b3e['toUpperCase']()]+']',_0x318c99['message']);_0x338cc5(_0x318c99[_0xeede('0x16')]);});});};}function createRemoteTag(_0x5ecab8,_0x53f6ce,_0x3b4ada,_0x5c3843){return new Promise(function(_0x524707,_0x50d250){var _0x3cd8e3={'method':'POST','uri':_0x3b4ada+_0xeede('0x45')+'?'+_0x5c3843,'body':{'short_description':_0x5ecab8,'global':!![],'active':!![],'name':_0x5ecab8},'auth':_0x53f6ce,'json':!![]};return rp(_0x3cd8e3)[_0xeede('0xc')](function(_0x35fafa){var _0x2e4a93=_0x35fafa[_0xeede('0xf')][_0xeede('0x10')];_0x524707(_0x2e4a93);});});}function getRemoteTag(_0x5bf2f6,_0x1bd067,_0x5e5df0,_0x351fae,_0x27021f){return new Promise(function(_0x35a5ed,_0x275011){var _0xb57be0={'method':'GET','uri':_0x5e5df0+_0xeede('0x45')+_0xeede('0x46')+_0x5bf2f6+'&'+_0x351fae,'auth':_0x1bd067,'json':!![]};return rp(_0xb57be0)[_0xeede('0xc')](function(_0xe8a09e){if(_0xe8a09e[_0xeede('0xf')][_0xeede('0xd')]>0x0){var _0x172f65=_0xe8a09e['result'][0x0][_0xeede('0x10')];_0x35a5ed(_0x172f65);}else{return createRemoteTag(_0x5bf2f6,_0x1bd067,_0x5e5df0,_0x351fae)['then'](function(_0x5367d5){_0x35a5ed(_0x5367d5);});}});});}function assignTagToIncident(_0xdb7164,_0x39d358,_0x4b636a,_0x5abc62,_0x14257d){return new Promise(function(_0xd72a97,_0x364a01){var _0x877b4a={'method':_0xeede('0x23'),'uri':_0x4b636a+_0xeede('0x47')+'?'+_0x14257d,'body':{'label':_0xdb7164,'table':_0xeede('0x3d'),'id_type':_0xeede('0x48'),'table_key':_0x5abc62['ticketId'],'title':_0xeede('0x49')+_0x5abc62['ticketNumber'],'id_display':_0x5abc62[_0xeede('0x42')]},'auth':_0x39d358,'json':!![]};return rp(_0x877b4a)[_0xeede('0xc')](function(_0x54a9be){_0xd72a97();})[_0xeede('0x13')](function(){_0xd72a97();});});}function manageTags(_0x43fcb3,_0xb6c0f7,_0x171b5c,_0x2b1dd2,_0x292c3a,_0x20ac8c,_0x349406){return new Promise(function(_0x313377,_0x258ff){var _0x55550f=[];_0xb6c0f7['forEach'](function(_0x186aff){_0x55550f[_0xeede('0x4a')](getRemoteTag(_0x186aff,_0x171b5c,_0x2b1dd2,_0x20ac8c,_0x349406));});return Promise[_0xeede('0x4b')](_0x55550f)['then'](function(_0x5b6cef){if(_0x5b6cef[_0xeede('0xd')]){logger[_0xeede('0x11')]('['+[_0x43fcb3[_0xeede('0x15')]()]+_0xeede('0x4c'),_0x5b6cef);var _0x595c02=[];_0x5b6cef[_0xeede('0x2c')](function(_0x1d782f){_0x595c02[_0xeede('0x4a')](assignTagToIncident(_0x1d782f,_0x171b5c,_0x2b1dd2,_0x292c3a,_0x20ac8c));});return Promise[_0xeede('0x4b')](_0x595c02)['then'](function(){_0x313377();})[_0xeede('0x13')](function(){_0x313377();});}else{_0x313377();}});});}function getTags(_0x348d96,_0x4e21f6,_0x3ba384,_0x424c67,_0x82d28b,_0x474aed){return function(_0x143f99){return new Promise(function(_0x27f53f,_0x4c363b){var _0x52118=[];var _0x528f7e=_0x424c67[_0xeede('0x4d')];if(_0x528f7e&&_0x528f7e[_0xeede('0xd')]>0x0){_0x52118=_[_0xeede('0x4e')](_0x528f7e,_0xeede('0x3a'));}if(_0x52118['length']>0x0){return manageTags(_0x348d96,_0x52118,_0x4e21f6,_0x3ba384,_0x143f99,_0x82d28b,_0x474aed)[_0xeede('0xc')](function(){_0x27f53f(_0x143f99);});}else{_0x27f53f(_0x143f99);}});};}function emit(_0x39dfe2,_0x38c4ff,_0x2b47da){var _0x358209=_0xeede('0x4f')+_0xeede('0x50')+_0xeede('0x51')+_0xeede('0x52');var _0x224e19={'uri':_0x39dfe2+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x2b47da+_0x358209};io['to'](util[_0xeede('0x53')](_0xeede('0x54'),_0x38c4ff))['emit'](_0xeede('0x55'),_0x224e19);}exports['cs']=function(_0x10b71c,_0x17c40e,_0x5edb33,_0x40ab64,_0xadf9ce,_0x32dddb,_0x2e7699,_0x450127){var _0x499c6b={};var _0x129006={'user':_0x32dddb[_0xeede('0x56')],'pass':_0x32dddb[_0xeede('0x57')]};var _0x48295c='sysparm_limit=1';var _0x34e3a9=_0xeede('0x58');_0x32dddb[_0xeede('0x59')]=intUtil[_0xeede('0x5a')](_0x32dddb['remoteUri']);_0x32dddb[_0xeede('0x5b')]=intUtil['stripTrailingSlash'](_0x32dddb[_0xeede('0x5b')]);var _0x366faa=util[_0xeede('0x53')](_0xeede('0x5c'),_0x32dddb[_0xeede('0x59')]);_0x499c6b[_0xeede('0x19')]=!_[_0xeede('0x5d')](_0x40ab64)?_0x40ab64[_0xeede('0x5e')]:null;_0x499c6b[_0xeede('0x1f')]=_0x32dddb[_0xeede('0x5e')];_0x499c6b[_0xeede('0x25')]=_0x450127['toLowerCase']()==='outbound'?_0x17c40e[_0xeede('0x5f')]:_0x17c40e[_0xeede('0x60')];_0x499c6b[_0xeede('0x61')]=_0x450127==='queue'||_0x450127===_0xeede('0x62')?_0xeede('0x63'):_0xeede('0x3c');var _0x3930b0=util[_0xeede('0x53')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x32dddb[_0xeede('0x5b')],_0x17c40e[_0xeede('0x64')],md5(_0x17c40e[_0xeede('0x64')]));if(_0xadf9ce&&_0xadf9ce['monitor_format']){logger[_0xeede('0x11')](_0xeede('0x65'),_0xeede('0x66'));_0x17c40e[_0xeede('0x67')]=_0x3930b0;}else if(_0x2e7699&&_0x2e7699[_0xeede('0x68')]&&_0x2e7699[_0xeede('0x68')]!==_0xeede('0x69')){logger[_0xeede('0x11')](_0xeede('0x6a'),_0xeede('0x66'));_0x17c40e[_0xeede('0x67')]=_0x3930b0;}else{_0x17c40e[_0xeede('0x67')]='';}return getAdminUser(_0x450127,_0x129006,_0x499c6b,_0x366faa,_0x34e3a9,_0x48295c)[_0xeede('0xc')](getUser(_0x450127,_0x129006,_0x366faa,_0x34e3a9,_0x48295c))[_0xeede('0xc')](getEndUser(_0x450127,_0x129006,_0x366faa,_0x34e3a9,_0x48295c))[_0xeede('0xc')](getTicket(_0x450127,_0x129006,_0x366faa,_0x5edb33,_0x17c40e,_0x34e3a9))[_0xeede('0xc')](function(_0x47fefa){logger[_0xeede('0x11')](util[_0xeede('0x53')](_0xeede('0x6b'),_0x47fefa[_0xeede('0x6c')]));logger[_0xeede('0x11')](util[_0xeede('0x53')]('call\x20direction:\x20%s',_0x450127));if(_0x450127!==_0xeede('0x62')){logger[_0xeede('0x11')]('['+[_0x450127[_0xeede('0x15')]()]+']',_0xeede('0x6d'));emit(_0x32dddb[_0xeede('0x59')],_0x40ab64['name'],_0x47fefa['ticketId']);}})['catch'](function(_0x1a111c){logger['error']('['+[_0x450127[_0xeede('0x15')]()]+_0xeede('0x6e'),util[_0xeede('0x6f')](_0x1a111c,{'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 89133f3..6e46d9f 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 _0x91ba=['Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','stripTrailingSlash','%s/service/v4_1/rest.php','recordingFormat','destcalleridnum','Outbound','Ticket\x20created!','contacts','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','lastevent','toUpperCase','The\x20User\x20ID\x20is:','Inbound','lodash','request-promise','util','./util','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','getString','assigned_user_id','created_by','Descriptions','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','name','direction','length','forEach','variableName','push','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','type','string','nameField','customField','content','idField','custom_fields','customVariable','Variable','toLowerCase','POST','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s'];(function(_0x51c322,_0x937bca){var _0x4bf11c=function(_0x366c30){while(--_0x366c30){_0x51c322['push'](_0x51c322['shift']());}};_0x4bf11c(++_0x937bca);}(_0x91ba,0xfb));var _0xa91b=function(_0xcc232,_0x31a18b){_0xcc232=_0xcc232-0x0;var _0x3292aa=_0x91ba[_0xcc232];return _0x3292aa;};'use strict';var _=require(_0xa91b('0x0'));var rp=require(_0xa91b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0xa91b('0x2'));var Redis=require('ioredis');var intUtil=require(_0xa91b('0x3'));var config=require(_0xa91b('0x4'));var logger=require('../../../../config/logger')('sugarcrm');config['redis']=_[_0xa91b('0x5')](config[_0xa91b('0x6')],{'host':_0xa91b('0x7'),'port':0x18eb});var io=require(_0xa91b('0x8'))(new Redis(config[_0xa91b('0x6')]));var def={'method':'POST','json':!![]};function emit(_0x491bdd,_0x2cc043,_0x5876e1){io['to'](_0x491bdd)[_0xa91b('0x9')](_0x2cc043,_0x5876e1);}function getTicket(_0x57e0d7,_0x5beff0,_0x3c830f,_0x1f3491,_0x4192b4,_0x3325ab,_0x59cb9d,_0x1ab8bd){logger[_0xa91b('0xa')](_0xa91b('0xb'));var _0xdb6a36=new Date();var _0x3d3f40=[{'name':'name','value':intUtil[_0xa91b('0xc')](_0x1f3491['Subjects'],_0x4192b4,'\x20')},{'name':_0xa91b('0xd'),'value':_0x5beff0['id']},{'name':_0xa91b('0xe'),'value':_0x5beff0['id']},{'name':'description','value':intUtil[_0xa91b('0xc')](_0x1f3491[_0xa91b('0xf')],_0x4192b4,'\x0a')},{'name':'date_start','value':_0xdb6a36['toISOString']()[_0xa91b('0x10')](0x0,0x13)[_0xa91b('0x11')]('T','\x20')},{'name':_0xa91b('0x12'),'value':'0'},{'name':_0xa91b('0x13'),'value':'15'},{'name':_0xa91b('0x14'),'value':_0x3c830f['id']},{'name':_0xa91b('0x15'),'value':_0xa91b('0x16')},{'name':_0xa91b('0x17'),'value':_0x3c830f[_0xa91b('0x18')]},{'name':_0xa91b('0x19'),'value':_0x1ab8bd}];if(_0x3325ab[_0xa91b('0x1a')]){_[_0xa91b('0x1b')](_0x3325ab,function(_0x545a0b){if(_0x4192b4[_0x545a0b[_0xa91b('0x1c')]]){_0x3d3f40[_0xa91b('0x1d')]({'name':_0x545a0b['idField'],'value':_0x4192b4[_0x545a0b[_0xa91b('0x1c')]]});}});}return request({'form':{'method':_0xa91b('0x1e'),'input_type':_0xa91b('0x1f'),'response_type':'JSON','rest_data':JSON[_0xa91b('0x20')]({'session':_0x59cb9d['id'],'module_name':'Calls','name_value_list':_0x3d3f40})}});}function getAuth(_0x4240ef){return util[_0xa91b('0x21')](_0xa91b('0x22'),new Buffer(_0x4240ef[_0xa91b('0x23')]+':X')[_0xa91b('0x24')]('base64'));}function getServerInfo(_0x53e11d){return request({'form':{'method':'get_server_info','input_type':_0xa91b('0x1f'),'response_type':_0xa91b('0x1f'),'rest_data':JSON[_0xa91b('0x20')]({'session':_0x53e11d['id']})}});}function getUser(_0x3b09e0,_0x44bcba,_0xc50c21){if(!_[_0xa91b('0x25')](_0x44bcba)){logger['info'](_0xa91b('0x26'),_0x44bcba);return request({'form':{'method':_0xa91b('0x27'),'input_type':'JSON','response_type':_0xa91b('0x1f'),'rest_data':JSON['stringify']({'session':_0xc50c21['id'],'module_name':'Employees','query':util[_0xa91b('0x21')](_0xa91b('0x28'),_0x44bcba),'order_by':'','offset':'0','select_fields':['id',_0xa91b('0x18'),_0xa91b('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x46026f){if(_0x46026f[_0xa91b('0x2a')][_0xa91b('0x1a')]){var _0x3b04fc=_[_0xa91b('0x2b')](_0x46026f[_0xa91b('0x2a')],function(_0x27b578){return _0x27b578[_0xa91b('0x2c')][_0xa91b('0x29')][_0xa91b('0x2d')]===_0x44bcba;});if(_0x3b04fc){logger[_0xa91b('0xa')](_0xa91b('0x2e'));return BPromise[_0xa91b('0x2f')]({'id':_0x3b04fc['name_value_list']['id'][_0xa91b('0x2d')],'name':_0x3b04fc[_0xa91b('0x2c')][_0xa91b('0x18')][_0xa91b('0x2d')]});}}logger[_0xa91b('0xa')](_0xa91b('0x30'));return BPromise[_0xa91b('0x2f')]({'id':_0xc50c21[_0xa91b('0x2c')][_0xa91b('0x31')]['value'],'name':_0xc50c21[_0xa91b('0x2c')]['user_name'][_0xa91b('0x2d')]});});}else{logger[_0xa91b('0xa')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xa91b('0x2f')]({'id':_0xc50c21['name_value_list'][_0xa91b('0x31')][_0xa91b('0x2d')],'name':_0xc50c21[_0xa91b('0x2c')]['user_name']['value']});}}function getEndUser(_0x1081c2,_0x15ecaa,_0x42437d,_0x44671e){logger['info'](_0xa91b('0x32'),_0x42437d);return request({'form':{'method':_0xa91b('0x27'),'input_type':_0xa91b('0x1f'),'response_type':_0xa91b('0x1f'),'rest_data':JSON[_0xa91b('0x20')]({'session':_0x44671e['id'],'module_name':_0xa91b('0x16'),'query':util['format'](_0xa91b('0x33'),_0x42437d),'order_by':'','offset':'0','select_fields':['id',_0xa91b('0x18'),_0xa91b('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa91b('0x35')](function(_0x55ed13){if(_0x55ed13[_0xa91b('0x2a')][_0xa91b('0x1a')]){var _0x7ba379=_['find'](_0x55ed13[_0xa91b('0x2a')],function(_0xc31865){return _0xc31865['name_value_list'][_0xa91b('0x34')][_0xa91b('0x2d')]===_0x42437d;});if(_0x7ba379){logger['info']('Enduser\x20found!');return BPromise[_0xa91b('0x2f')]({'id':_0x7ba379[_0xa91b('0x2c')]['id'][_0xa91b('0x2d')],'name':_0x7ba379['name_value_list'][_0xa91b('0x18')][_0xa91b('0x2d')],'phone':_0x7ba379[_0xa91b('0x2c')][_0xa91b('0x34')][_0xa91b('0x2d')]});}}else{logger['info'](_0xa91b('0x36'));return request({'form':{'method':_0xa91b('0x1e'),'input_type':_0xa91b('0x1f'),'response_type':_0xa91b('0x1f'),'rest_data':JSON[_0xa91b('0x20')]({'session':_0x44671e['id'],'module_name':_0xa91b('0x16'),'name_value_list':[{'name':_0xa91b('0x37'),'value':_0x15ecaa!==''?_0x15ecaa:util['format'](_0xa91b('0x38'),_0x42437d)},{'name':_0xa91b('0x34'),'value':_0x42437d}]})}})[_0xa91b('0x35')](function(_0x4849ab){logger[_0xa91b('0xa')](_0xa91b('0x39'));return BPromise[_0xa91b('0x2f')]({'id':_0x4849ab['id'],'name':_0x4849ab[_0xa91b('0x2a')]['first_name'][_0xa91b('0x2d')],'phone':_0x4849ab['entry_list'][_0xa91b('0x34')][_0xa91b('0x2d')]});});}});}function request(_0x33b3bf){logger['debug'](_0xa91b('0x3a'),JSON[_0xa91b('0x20')](_0x33b3bf));return rp(_[_0xa91b('0x3b')](def,_0x33b3bf));}function getTags(_0x25e3dc,_0x954ef1){var _0xeaf658=[];if(_0x25e3dc&&_0x25e3dc[_0xa91b('0x1a')]>0x0){_0xeaf658=_[_0xa91b('0x3c')](_0x25e3dc,_0x954ef1);}return _0xeaf658;}function getCustomFields(_0x4feb04,_0x24d029){var _0x14538f=[];var _0x1e13a9={'custom_fields':[]};if(_0x4feb04[_0xa91b('0x1a')]>0x0){_[_0xa91b('0x1b')](_0x4feb04,function(_0x56363e){if(_0x56363e[_0xa91b('0x3d')]===_0xa91b('0x3e')&&_0x56363e[_0xa91b('0x3f')]&&!_0x56363e[_0xa91b('0x40')]){_0x1e13a9[_0x56363e[_0xa91b('0x3f')]['toLowerCase']()]=_0x56363e[_0xa91b('0x41')][_0xa91b('0x24')]();}else if(_0x56363e['type']===_0xa91b('0x3e')&&_0x56363e[_0xa91b('0x42')]&&_0x56363e[_0xa91b('0x40')]){_0x1e13a9['custom_fields'][_0xa91b('0x1d')]({'id':_0x56363e[_0xa91b('0x42')],'value':_0x56363e[_0xa91b('0x41')][_0xa91b('0x24')]()});}else if(_0x56363e[_0xa91b('0x3d')]==='variable'&&_0x56363e[_0xa91b('0x1c')]&&_0x56363e['idField']&&_0x56363e[_0xa91b('0x40')]){_0x24d029[_0x56363e['variableName']]&&_0x1e13a9[_0xa91b('0x43')]['push']({'id':_0x56363e[_0xa91b('0x42')],'value':_0x24d029[_0x56363e[_0xa91b('0x1c')]]['toString']()});}else if(_0x56363e[_0xa91b('0x3d')]===_0xa91b('0x44')&&_0x56363e[_0xa91b('0x45')]&&_0x56363e[_0xa91b('0x45')][_0xa91b('0x18')]&&_0x56363e[_0xa91b('0x42')]&&_0x56363e[_0xa91b('0x40')]){_0x24d029[_0x56363e[_0xa91b('0x45')][_0xa91b('0x18')][_0xa91b('0x46')]()]&&_0x1e13a9['custom_fields'][_0xa91b('0x1d')]({'id':_0x56363e['idField'],'value':_0x24d029[_0x56363e[_0xa91b('0x45')][_0xa91b('0x18')][_0xa91b('0x46')]()]['toString']()});}});}return _0x1e13a9;}function getConnection(_0x4e71f3){return request({'method':_0xa91b('0x47'),'form':{'method':_0xa91b('0x48'),'input_type':_0xa91b('0x1f'),'response_type':_0xa91b('0x1f'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4e71f3['username'],'password':_0x4e71f3[_0xa91b('0x49')],'encryption':_0xa91b('0x4a')},'application':_0xa91b('0x4b')})}})[_0xa91b('0x35')](function(_0x26ea55){var _0x73de16=_0x26ea55;if(_0x73de16['id']){def[_0xa91b('0x4c')]=_0x73de16['id'];return BPromise[_0xa91b('0x2f')](_0x73de16);}else{throw new Error(util[_0xa91b('0x21')](_0xa91b('0x4d'),_0x4e71f3['id']));}});}function setRelationship(_0x52bcf3,_0x38d6b6,_0x54d057,_0x61ac3b){return request({'form':{'method':_0xa91b('0x4e'),'input_type':_0xa91b('0x1f'),'response_type':_0xa91b('0x1f'),'rest_data':JSON[_0xa91b('0x20')]({'session':_0x52bcf3['id'],'module_name':_0xa91b('0x4f'),'module_id':_0x54d057['id'],'link_field_name':_0x61ac3b,'related_ids':[_0x38d6b6['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x50c688,_0x943768,_0x5caedf,_0xa1f4af,_0x537fb8,_0x1de100){var _0x3b8eee,_0x3c7040,_0x28213b,_0x30d2af;_0x1de100[_0xa91b('0x50')]=intUtil['stripTrailingSlash'](_0x1de100[_0xa91b('0x50')]);_0x1de100['serverUrl']=intUtil['stripTrailingSlash'](_0x1de100[_0xa91b('0x51')]);def[_0xa91b('0x52')]=util['format']('%s/service/v4_1/rest.php',_0x1de100[_0xa91b('0x50')]);if(_0x537fb8&&_0x537fb8[_0xa91b('0x53')]){logger[_0xa91b('0xa')](_0xa91b('0x54'),_0xa91b('0x55'));_0x943768[_0xa91b('0x56')]=util[_0xa91b('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1de100['serverUrl'],_0x943768[_0xa91b('0x57')],md5(_0x943768[_0xa91b('0x57')]));}else{_0x943768[_0xa91b('0x56')]='';}return getConnection(_0x1de100)[_0xa91b('0x35')](function(_0x517ddb){_0x30d2af=_0x517ddb;return getUser(_0x1de100,_0xa1f4af[_0xa91b('0x18')],_0x30d2af);})['then'](function(_0x2863a7){_0x3b8eee=_0x2863a7;logger[_0xa91b('0xa')]('The\x20User\x20ID\x20is:',_0x3b8eee['id']);return getEndUser(_0x1de100,_0x943768[_0xa91b('0x58')],_0x943768[_0xa91b('0x59')],_0x30d2af);})[_0xa91b('0x35')](function(_0x47fda1){_0x3c7040=_0x47fda1;logger[_0xa91b('0xa')](_0xa91b('0x5a'),_0x3c7040['id']);return getTicket(_0x1de100,_0x3b8eee,_0x3c7040,_0x5caedf,_0x943768,_0x5caedf[_0xa91b('0x5b')],_0x30d2af,'Inbound');})[_0xa91b('0x35')](function(_0x151aa2){_0x28213b=_0x151aa2;logger[_0xa91b('0xa')]('Ticket\x20created!');logger[_0xa91b('0xa')](_0xa91b('0x5c'),_0x28213b['id']);return setRelationship(_0x30d2af,_0x3b8eee,_0x28213b,_0xa91b('0x5d'));})[_0xa91b('0x35')](function(){return setRelationship(_0x30d2af,_0x3c7040,_0x28213b,'contacts');})['then'](function(){return getServerInfo(_0x30d2af);})['then'](function(_0x200b88){var _0x2dc975=parseInt(_0x200b88[_0xa91b('0x5e')][_0xa91b('0x5f')](0x0));var _0xb6c7a1=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1de100[_0xa91b('0x50')],_0x28213b['id']);if(_0x2dc975>0x6){_0xb6c7a1=util[_0xa91b('0x21')](_0xa91b('0x60'),_0x1de100['remoteUri'],_0x28213b['id']);}logger[_0xa91b('0xa')](_0xa91b('0x54'),_0xa91b('0x61'));emit(util['format'](_0xa91b('0x62'),_0xa1f4af[_0xa91b('0x18')]),_0xa91b('0x63'),{'uri':_0xb6c7a1});})[_0xa91b('0x64')](function(_0x1e5ab8){logger[_0xa91b('0x65')](_0xa91b('0x54'),JSON[_0xa91b('0x20')](_0x1e5ab8));});};exports[_0xa91b('0x66')]=function(_0x23bdb0,_0x386f6f,_0x323ffa,_0x30ee52,_0x2ad114,_0x4de6cc,_0x4e4748){var _0x188d7c,_0x226453,_0x406c0a,_0x1dce2f;_0x4de6cc[_0xa91b('0x50')]=intUtil[_0xa91b('0x67')](_0x4de6cc['remoteUri']);_0x4de6cc[_0xa91b('0x51')]=intUtil['stripTrailingSlash'](_0x4de6cc['serverUrl']);def[_0xa91b('0x52')]=util['format'](_0xa91b('0x68'),_0x4de6cc[_0xa91b('0x50')]);if(_0x4e4748&&_0x4e4748[_0xa91b('0x69')]&&_0x4e4748[_0xa91b('0x69')]!=='none'){logger[_0xa91b('0xa')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x386f6f[_0xa91b('0x56')]=util[_0xa91b('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4de6cc[_0xa91b('0x51')],_0x386f6f[_0xa91b('0x57')],md5(_0x386f6f[_0xa91b('0x57')]));}return getConnection(_0x4de6cc)[_0xa91b('0x35')](function(_0x4a5864){_0x1dce2f=_0x4a5864;return getUser(_0x4de6cc,_0x30ee52[_0xa91b('0x18')],_0x1dce2f);})[_0xa91b('0x35')](function(_0xf762af){_0x188d7c=_0xf762af;logger['info']('The\x20User\x20ID\x20is:',_0x188d7c['id']);return getEndUser(_0x4de6cc,_0x386f6f['destcalleridname'],_0x386f6f[_0xa91b('0x6a')],_0x1dce2f);})[_0xa91b('0x35')](function(_0x466ef8){_0x226453=_0x466ef8;logger[_0xa91b('0xa')]('The\x20Enduser\x20ID\x20is:',_0x226453['id']);return getTicket(_0x4de6cc,_0x188d7c,_0x226453,_0x323ffa,_0x386f6f,_0x323ffa[_0xa91b('0x5b')],_0x1dce2f,_0xa91b('0x6b'));})[_0xa91b('0x35')](function(_0xc572a9){_0x406c0a=_0xc572a9;logger[_0xa91b('0xa')](_0xa91b('0x6c'));logger[_0xa91b('0xa')](_0xa91b('0x5c'),_0x406c0a['id']);return setRelationship(_0x1dce2f,_0x188d7c,_0x406c0a,'users');})[_0xa91b('0x35')](function(){return setRelationship(_0x1dce2f,_0x226453,_0x406c0a,_0xa91b('0x6d'));})['then'](function(){return getServerInfo(_0x1dce2f);})[_0xa91b('0x35')](function(_0x5d2a05){var _0x121189=parseInt(_0x5d2a05[_0xa91b('0x5e')][_0xa91b('0x5f')](0x0));var _0x21fe62=util[_0xa91b('0x21')](_0xa91b('0x6e'),_0x4de6cc[_0xa91b('0x50')],_0x406c0a['id']);if(_0x121189>0x6){_0x21fe62=util[_0xa91b('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x4de6cc[_0xa91b('0x50')],_0x406c0a['id']);}logger['info'](_0xa91b('0x6f'),_0xa91b('0x61'));emit(util[_0xa91b('0x21')](_0xa91b('0x62'),_0x30ee52[_0xa91b('0x18')]),'trigger:browser:url',{'uri':_0x21fe62});})[_0xa91b('0x64')](function(_0x4fa8e5){logger[_0xa91b('0x65')]('[OUTBOUND]',JSON['stringify'](_0x4fa8e5));});};exports['unmanaged']=function(_0x57cebd,_0x25f633,_0x5a5e3a,_0x1d9874,_0x2cf1f0,_0x4039b5){var _0x23a355,_0x15957e,_0xf87245,_0x1ee537;_0x4039b5[_0xa91b('0x50')]=intUtil[_0xa91b('0x67')](_0x4039b5['remoteUri']);_0x4039b5['serverUrl']=intUtil[_0xa91b('0x67')](_0x4039b5[_0xa91b('0x51')]);def[_0xa91b('0x52')]=util[_0xa91b('0x21')](_0xa91b('0x68'),_0x4039b5[_0xa91b('0x50')]);if(_0x2cf1f0&&_0x2cf1f0[_0xa91b('0x53')]){logger[_0xa91b('0xa')]('['+_0x25f633[_0xa91b('0x70')][_0xa91b('0x71')]()+']',_0xa91b('0x55'));_0x25f633[_0xa91b('0x56')]=util[_0xa91b('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4039b5[_0xa91b('0x51')],_0x25f633[_0xa91b('0x57')],md5(_0x25f633[_0xa91b('0x57')]));}else{_0x25f633[_0xa91b('0x56')]='';}return getConnection(_0x4039b5)[_0xa91b('0x35')](function(_0x27ed88){_0x1ee537=_0x27ed88;if(!_['isNil'](_0x1d9874)){return getUser(_0x4039b5,_0x1d9874[_0xa91b('0x18')],_0x1ee537);}else{return getUser(_0x4039b5,null,_0x1ee537);}})[_0xa91b('0x35')](function(_0x9e331d){_0x23a355=_0x9e331d;logger['info'](_0xa91b('0x72'),_0x23a355['id']);return getEndUser(_0x4039b5,_0x25f633['calleridname'],_0x25f633[_0xa91b('0x59')],_0x1ee537);})[_0xa91b('0x35')](function(_0x1e5513){_0x15957e=_0x1e5513;logger[_0xa91b('0xa')](_0xa91b('0x5a'),_0x15957e['id']);return getTicket(_0x4039b5,_0x23a355,_0x15957e,_0x5a5e3a,_0x25f633,_0x5a5e3a[_0xa91b('0x5b')],_0x1ee537,_0xa91b('0x73'));})[_0xa91b('0x35')](function(_0x2de7f3){_0xf87245=_0x2de7f3;logger[_0xa91b('0xa')](_0xa91b('0x6c'));logger[_0xa91b('0xa')](_0xa91b('0x5c'),_0xf87245['id']);return setRelationship(_0x1ee537,_0x23a355,_0xf87245,'users');})['then'](function(){return setRelationship(_0x1ee537,_0x15957e,_0xf87245,_0xa91b('0x6d'));})['then'](function(){return getServerInfo(_0x1ee537);})[_0xa91b('0x64')](function(_0x1c3f6b){logger['error']('['+_0x25f633[_0xa91b('0x70')][_0xa91b('0x71')]()+']',JSON[_0xa91b('0x20')](_0x1c3f6b));});}; \ No newline at end of file +var _0xde67=['%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','catch','unmanaged','lastevent','toUpperCase','calleridnum','lodash','request-promise','md5','ioredis','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','assigned_user_id','created_by','description','getString','Descriptions','duration_hours','duration_minutes','parent_type','Contacts','parent_name','direction','length','variableName','push','set_entry','JSON','Calls','apiKey','base64','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','Employees','format','user_name','then','entry_list','find','Agent\x20found!','resolve','name_value_list','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','forEach','string','nameField','customField','toLowerCase','toString','type','idField','custom_fields','content','variable','Variable','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','remoteUri','stripTrailingSlash','serverUrl','uri'];(function(_0x529c38,_0x316814){var _0x13d313=function(_0x331d66){while(--_0x331d66){_0x529c38['push'](_0x529c38['shift']());}};_0x13d313(++_0x316814);}(_0xde67,0x18e));var _0x7de6=function(_0x216f7d,_0x496249){_0x216f7d=_0x216f7d-0x0;var _0xc49d7f=_0xde67[_0x216f7d];return _0xc49d7f;};'use strict';var _=require(_0x7de6('0x0'));var rp=require(_0x7de6('0x1'));var BPromise=require('bluebird');var md5=require(_0x7de6('0x2'));var util=require('util');var Redis=require(_0x7de6('0x3'));var intUtil=require('./util');var config=require(_0x7de6('0x4'));var logger=require('../../../../config/logger')('sugarcrm');config['redis']=_[_0x7de6('0x5')](config[_0x7de6('0x6')],{'host':_0x7de6('0x7'),'port':0x18eb});var io=require(_0x7de6('0x8'))(new Redis(config[_0x7de6('0x6')]));var def={'method':_0x7de6('0x9'),'json':!![]};function emit(_0x135b85,_0x125a33,_0x4dda70){io['to'](_0x135b85)[_0x7de6('0xa')](_0x125a33,_0x4dda70);}function getTicket(_0x5a3273,_0x4aed92,_0x3195b0,_0x1a77ce,_0x12d741,_0x2f51d1,_0x498b9b,_0xe97496){logger[_0x7de6('0xb')](_0x7de6('0xc'));var _0x5f8637=new Date();var _0x1c0f3a=[{'name':_0x7de6('0xd'),'value':intUtil['getString'](_0x1a77ce['Subjects'],_0x12d741,'\x20')},{'name':_0x7de6('0xe'),'value':_0x4aed92['id']},{'name':_0x7de6('0xf'),'value':_0x4aed92['id']},{'name':_0x7de6('0x10'),'value':intUtil[_0x7de6('0x11')](_0x1a77ce[_0x7de6('0x12')],_0x12d741,'\x0a')},{'name':'date_start','value':_0x5f8637['toISOString']()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x7de6('0x13'),'value':'0'},{'name':_0x7de6('0x14'),'value':'15'},{'name':'parent_id','value':_0x3195b0['id']},{'name':_0x7de6('0x15'),'value':_0x7de6('0x16')},{'name':_0x7de6('0x17'),'value':_0x3195b0[_0x7de6('0xd')]},{'name':_0x7de6('0x18'),'value':_0xe97496}];if(_0x2f51d1[_0x7de6('0x19')]){_['forEach'](_0x2f51d1,function(_0x2c5d81){if(_0x12d741[_0x2c5d81[_0x7de6('0x1a')]]){_0x1c0f3a[_0x7de6('0x1b')]({'name':_0x2c5d81['idField'],'value':_0x12d741[_0x2c5d81['variableName']]});}});}return request({'form':{'method':_0x7de6('0x1c'),'input_type':_0x7de6('0x1d'),'response_type':_0x7de6('0x1d'),'rest_data':JSON['stringify']({'session':_0x498b9b['id'],'module_name':_0x7de6('0x1e'),'name_value_list':_0x1c0f3a})}});}function getAuth(_0x22ada1){return util['format']('Basic\x20%s',new Buffer(_0x22ada1[_0x7de6('0x1f')]+':X')['toString'](_0x7de6('0x20')));}function getServerInfo(_0x10908a){return request({'form':{'method':_0x7de6('0x21'),'input_type':_0x7de6('0x1d'),'response_type':_0x7de6('0x1d'),'rest_data':JSON[_0x7de6('0x22')]({'session':_0x10908a['id']})}});}function getUser(_0x165246,_0x39e860,_0x20e93e){if(!_[_0x7de6('0x23')](_0x39e860)){logger[_0x7de6('0xb')](_0x7de6('0x24'),_0x39e860);return request({'form':{'method':'get_entry_list','input_type':_0x7de6('0x1d'),'response_type':_0x7de6('0x1d'),'rest_data':JSON[_0x7de6('0x22')]({'session':_0x20e93e['id'],'module_name':_0x7de6('0x25'),'query':util[_0x7de6('0x26')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x39e860),'order_by':'','offset':'0','select_fields':['id',_0x7de6('0xd'),_0x7de6('0x27')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7de6('0x28')](function(_0x2a3ec7){if(_0x2a3ec7[_0x7de6('0x29')][_0x7de6('0x19')]){var _0x204f76=_[_0x7de6('0x2a')](_0x2a3ec7['entry_list'],function(_0x882783){return _0x882783['name_value_list']['user_name']['value']===_0x39e860;});if(_0x204f76){logger[_0x7de6('0xb')](_0x7de6('0x2b'));return BPromise[_0x7de6('0x2c')]({'id':_0x204f76[_0x7de6('0x2d')]['id'][_0x7de6('0x2e')],'name':_0x204f76[_0x7de6('0x2d')][_0x7de6('0xd')][_0x7de6('0x2e')]});}}logger[_0x7de6('0xb')](_0x7de6('0x2f'));return BPromise[_0x7de6('0x2c')]({'id':_0x20e93e[_0x7de6('0x2d')][_0x7de6('0x30')][_0x7de6('0x2e')],'name':_0x20e93e['name_value_list'][_0x7de6('0x27')]['value']});});}else{logger[_0x7de6('0xb')](_0x7de6('0x31'));return BPromise[_0x7de6('0x2c')]({'id':_0x20e93e[_0x7de6('0x2d')][_0x7de6('0x30')][_0x7de6('0x2e')],'name':_0x20e93e[_0x7de6('0x2d')][_0x7de6('0x27')][_0x7de6('0x2e')]});}}function getEndUser(_0x41ecf5,_0x30d3cc,_0x36afd9,_0x3c3908){logger[_0x7de6('0xb')](_0x7de6('0x32'),_0x36afd9);return request({'form':{'method':_0x7de6('0x33'),'input_type':_0x7de6('0x1d'),'response_type':_0x7de6('0x1d'),'rest_data':JSON['stringify']({'session':_0x3c3908['id'],'module_name':_0x7de6('0x16'),'query':util[_0x7de6('0x26')](_0x7de6('0x34'),_0x36afd9),'order_by':'','offset':'0','select_fields':['id',_0x7de6('0xd'),_0x7de6('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x28408c){if(_0x28408c[_0x7de6('0x29')][_0x7de6('0x19')]){var _0x29eb0a=_[_0x7de6('0x2a')](_0x28408c[_0x7de6('0x29')],function(_0x53de0a){return _0x53de0a[_0x7de6('0x2d')][_0x7de6('0x35')]['value']===_0x36afd9;});if(_0x29eb0a){logger['info'](_0x7de6('0x36'));return BPromise[_0x7de6('0x2c')]({'id':_0x29eb0a[_0x7de6('0x2d')]['id'][_0x7de6('0x2e')],'name':_0x29eb0a[_0x7de6('0x2d')][_0x7de6('0xd')][_0x7de6('0x2e')],'phone':_0x29eb0a['name_value_list'][_0x7de6('0x35')]['value']});}}else{logger[_0x7de6('0xb')](_0x7de6('0x37'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3c3908['id'],'module_name':_0x7de6('0x16'),'name_value_list':[{'name':'first_name','value':_0x30d3cc!==_0x7de6('0x38')?_0x30d3cc:util[_0x7de6('0x26')](_0x7de6('0x39'),_0x36afd9)},{'name':'phone_home','value':_0x36afd9}]})}})[_0x7de6('0x28')](function(_0x2880c1){logger[_0x7de6('0xb')](_0x7de6('0x3a'));return BPromise['resolve']({'id':_0x2880c1['id'],'name':_0x2880c1[_0x7de6('0x29')][_0x7de6('0x3b')][_0x7de6('0x2e')],'phone':_0x2880c1[_0x7de6('0x29')][_0x7de6('0x35')]['value']});});}});}function request(_0x4faf87){logger[_0x7de6('0x3c')](_0x7de6('0x3d'),JSON['stringify'](_0x4faf87));return rp(_[_0x7de6('0x3e')](def,_0x4faf87));}function getTags(_0x1d87c1,_0x443e31){var _0x51273e=[];if(_0x1d87c1&&_0x1d87c1['length']>0x0){_0x51273e=_[_0x7de6('0x3f')](_0x1d87c1,_0x443e31);}return _0x51273e;}function getCustomFields(_0x252c1c,_0x4047cf){var _0x4ead02=[];var _0x5cfad6={'custom_fields':[]};if(_0x252c1c[_0x7de6('0x19')]>0x0){_[_0x7de6('0x40')](_0x252c1c,function(_0x392b98){if(_0x392b98['type']===_0x7de6('0x41')&&_0x392b98[_0x7de6('0x42')]&&!_0x392b98[_0x7de6('0x43')]){_0x5cfad6[_0x392b98[_0x7de6('0x42')][_0x7de6('0x44')]()]=_0x392b98['content'][_0x7de6('0x45')]();}else if(_0x392b98[_0x7de6('0x46')]===_0x7de6('0x41')&&_0x392b98[_0x7de6('0x47')]&&_0x392b98[_0x7de6('0x43')]){_0x5cfad6[_0x7de6('0x48')]['push']({'id':_0x392b98[_0x7de6('0x47')],'value':_0x392b98[_0x7de6('0x49')][_0x7de6('0x45')]()});}else if(_0x392b98['type']===_0x7de6('0x4a')&&_0x392b98['variableName']&&_0x392b98['idField']&&_0x392b98[_0x7de6('0x43')]){_0x4047cf[_0x392b98['variableName']]&&_0x5cfad6[_0x7de6('0x48')][_0x7de6('0x1b')]({'id':_0x392b98[_0x7de6('0x47')],'value':_0x4047cf[_0x392b98[_0x7de6('0x1a')]][_0x7de6('0x45')]()});}else if(_0x392b98[_0x7de6('0x46')]==='customVariable'&&_0x392b98[_0x7de6('0x4b')]&&_0x392b98[_0x7de6('0x4b')][_0x7de6('0xd')]&&_0x392b98[_0x7de6('0x47')]&&_0x392b98[_0x7de6('0x43')]){_0x4047cf[_0x392b98['Variable']['name']['toLowerCase']()]&&_0x5cfad6['custom_fields']['push']({'id':_0x392b98[_0x7de6('0x47')],'value':_0x4047cf[_0x392b98[_0x7de6('0x4b')][_0x7de6('0xd')][_0x7de6('0x44')]()][_0x7de6('0x45')]()});}});}return _0x5cfad6;}function getConnection(_0x166349){return request({'method':_0x7de6('0x9'),'form':{'method':'login','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x166349[_0x7de6('0x4c')],'password':_0x166349[_0x7de6('0x4d')],'encryption':_0x7de6('0x4e')},'application':_0x7de6('0x4f')})}})[_0x7de6('0x28')](function(_0x38c2cf){var _0x571edd=_0x38c2cf;if(_0x571edd['id']){def[_0x7de6('0x50')]=_0x571edd['id'];return BPromise[_0x7de6('0x2c')](_0x571edd);}else{throw new Error(util[_0x7de6('0x26')](_0x7de6('0x51'),_0x166349['id']));}});}function setRelationship(_0x4ca043,_0x2fa306,_0x2babad,_0x5c9e0a){return request({'form':{'method':'set_relationship','input_type':_0x7de6('0x1d'),'response_type':_0x7de6('0x1d'),'rest_data':JSON[_0x7de6('0x22')]({'session':_0x4ca043['id'],'module_name':'Calls','module_id':_0x2babad['id'],'link_field_name':_0x5c9e0a,'related_ids':[_0x2fa306['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0xa5d664,_0x1c55f4,_0x2e1199,_0xb9775f,_0x2590a8,_0x5280cb){var _0x46f5fc,_0x19bbc4,_0x43fc28,_0x3899ce;_0x5280cb[_0x7de6('0x52')]=intUtil[_0x7de6('0x53')](_0x5280cb[_0x7de6('0x52')]);_0x5280cb[_0x7de6('0x54')]=intUtil[_0x7de6('0x53')](_0x5280cb[_0x7de6('0x54')]);def[_0x7de6('0x55')]=util[_0x7de6('0x26')](_0x7de6('0x56'),_0x5280cb[_0x7de6('0x52')]);if(_0x2590a8&&_0x2590a8[_0x7de6('0x57')]){logger[_0x7de6('0xb')](_0x7de6('0x58'),'Recording\x20is\x20enabled!');_0x1c55f4[_0x7de6('0x59')]=util[_0x7de6('0x26')](_0x7de6('0x5a'),_0x5280cb[_0x7de6('0x54')],_0x1c55f4[_0x7de6('0x5b')],md5(_0x1c55f4[_0x7de6('0x5b')]));}else{_0x1c55f4[_0x7de6('0x59')]='';}return getConnection(_0x5280cb)['then'](function(_0x198375){_0x3899ce=_0x198375;return getUser(_0x5280cb,_0xb9775f[_0x7de6('0xd')],_0x3899ce);})[_0x7de6('0x28')](function(_0x5d3a4e){_0x46f5fc=_0x5d3a4e;logger[_0x7de6('0xb')]('The\x20User\x20ID\x20is:',_0x46f5fc['id']);return getEndUser(_0x5280cb,_0x1c55f4[_0x7de6('0x5c')],_0x1c55f4['calleridnum'],_0x3899ce);})[_0x7de6('0x28')](function(_0x2e6199){_0x19bbc4=_0x2e6199;logger[_0x7de6('0xb')](_0x7de6('0x5d'),_0x19bbc4['id']);return getTicket(_0x5280cb,_0x46f5fc,_0x19bbc4,_0x2e1199,_0x1c55f4,_0x2e1199[_0x7de6('0x5e')],_0x3899ce,_0x7de6('0x5f'));})[_0x7de6('0x28')](function(_0x1a1bb2){_0x43fc28=_0x1a1bb2;logger[_0x7de6('0xb')](_0x7de6('0x60'));logger['info'](_0x7de6('0x61'),_0x43fc28['id']);return setRelationship(_0x3899ce,_0x46f5fc,_0x43fc28,_0x7de6('0x62'));})[_0x7de6('0x28')](function(){return setRelationship(_0x3899ce,_0x19bbc4,_0x43fc28,_0x7de6('0x63'));})[_0x7de6('0x28')](function(){return getServerInfo(_0x3899ce);})[_0x7de6('0x28')](function(_0x55c449){var _0x14b194=parseInt(_0x55c449[_0x7de6('0x64')][_0x7de6('0x65')](0x0));var _0x541d93=util[_0x7de6('0x26')](_0x7de6('0x66'),_0x5280cb[_0x7de6('0x52')],_0x43fc28['id']);if(_0x14b194>0x6){_0x541d93=util[_0x7de6('0x26')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x5280cb['remoteUri'],_0x43fc28['id']);}logger['info'](_0x7de6('0x58'),_0x7de6('0x67'));emit(util[_0x7de6('0x26')](_0x7de6('0x68'),_0xb9775f[_0x7de6('0xd')]),_0x7de6('0x69'),{'uri':_0x541d93});})['catch'](function(_0x4dd153){logger[_0x7de6('0x6a')]('[QUEUE]',JSON[_0x7de6('0x22')](_0x4dd153));});};exports[_0x7de6('0x6b')]=function(_0xab4c61,_0x21f24b,_0x53828e,_0x5b932c,_0x112e61,_0x133946,_0xb5c4e5){var _0x2b7937,_0x5359e1,_0x248421,_0x40cab6;_0x133946['remoteUri']=intUtil[_0x7de6('0x53')](_0x133946[_0x7de6('0x52')]);_0x133946[_0x7de6('0x54')]=intUtil[_0x7de6('0x53')](_0x133946[_0x7de6('0x54')]);def[_0x7de6('0x55')]=util['format'](_0x7de6('0x56'),_0x133946[_0x7de6('0x52')]);if(_0xb5c4e5&&_0xb5c4e5[_0x7de6('0x6c')]&&_0xb5c4e5[_0x7de6('0x6c')]!==_0x7de6('0x6d')){logger[_0x7de6('0xb')](_0x7de6('0x6e'),_0x7de6('0x6f'));_0x21f24b[_0x7de6('0x59')]=util['format'](_0x7de6('0x5a'),_0x133946[_0x7de6('0x54')],_0x21f24b[_0x7de6('0x5b')],md5(_0x21f24b[_0x7de6('0x5b')]));}return getConnection(_0x133946)[_0x7de6('0x28')](function(_0x148da5){_0x40cab6=_0x148da5;return getUser(_0x133946,_0x5b932c[_0x7de6('0xd')],_0x40cab6);})['then'](function(_0x5382f1){_0x2b7937=_0x5382f1;logger['info'](_0x7de6('0x70'),_0x2b7937['id']);return getEndUser(_0x133946,_0x21f24b[_0x7de6('0x71')],_0x21f24b[_0x7de6('0x72')],_0x40cab6);})['then'](function(_0x1bf842){_0x5359e1=_0x1bf842;logger[_0x7de6('0xb')]('The\x20Enduser\x20ID\x20is:',_0x5359e1['id']);return getTicket(_0x133946,_0x2b7937,_0x5359e1,_0x53828e,_0x21f24b,_0x53828e['Fields'],_0x40cab6,_0x7de6('0x73'));})['then'](function(_0x17dedc){_0x248421=_0x17dedc;logger[_0x7de6('0xb')](_0x7de6('0x60'));logger[_0x7de6('0xb')](_0x7de6('0x61'),_0x248421['id']);return setRelationship(_0x40cab6,_0x2b7937,_0x248421,'users');})[_0x7de6('0x28')](function(){return setRelationship(_0x40cab6,_0x5359e1,_0x248421,_0x7de6('0x63'));})['then'](function(){return getServerInfo(_0x40cab6);})[_0x7de6('0x28')](function(_0x30839){var _0x1eae36=parseInt(_0x30839[_0x7de6('0x64')]['charAt'](0x0));var _0x367949=util[_0x7de6('0x26')](_0x7de6('0x66'),_0x133946['remoteUri'],_0x248421['id']);if(_0x1eae36>0x6){_0x367949=util[_0x7de6('0x26')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x133946[_0x7de6('0x52')],_0x248421['id']);}logger[_0x7de6('0xb')](_0x7de6('0x6e'),_0x7de6('0x67'));emit(util[_0x7de6('0x26')](_0x7de6('0x68'),_0x5b932c[_0x7de6('0xd')]),_0x7de6('0x69'),{'uri':_0x367949});})[_0x7de6('0x74')](function(_0x9fa9){logger['error'](_0x7de6('0x6e'),JSON[_0x7de6('0x22')](_0x9fa9));});};exports[_0x7de6('0x75')]=function(_0x275df3,_0x579d85,_0x26ece3,_0x4d1007,_0x46fc3a,_0x3d994c){var _0x2548f1,_0x12a7a8,_0x18696d,_0xfa0dd6;_0x3d994c['remoteUri']=intUtil[_0x7de6('0x53')](_0x3d994c[_0x7de6('0x52')]);_0x3d994c['serverUrl']=intUtil[_0x7de6('0x53')](_0x3d994c[_0x7de6('0x54')]);def[_0x7de6('0x55')]=util[_0x7de6('0x26')](_0x7de6('0x56'),_0x3d994c['remoteUri']);if(_0x46fc3a&&_0x46fc3a['monitor_format']){logger[_0x7de6('0xb')]('['+_0x579d85[_0x7de6('0x76')][_0x7de6('0x77')]()+']',_0x7de6('0x6f'));_0x579d85[_0x7de6('0x59')]=util[_0x7de6('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3d994c[_0x7de6('0x54')],_0x579d85[_0x7de6('0x5b')],md5(_0x579d85[_0x7de6('0x5b')]));}else{_0x579d85['recordingURL']='';}return getConnection(_0x3d994c)['then'](function(_0x2513c6){_0xfa0dd6=_0x2513c6;if(!_[_0x7de6('0x23')](_0x4d1007)){return getUser(_0x3d994c,_0x4d1007[_0x7de6('0xd')],_0xfa0dd6);}else{return getUser(_0x3d994c,null,_0xfa0dd6);}})[_0x7de6('0x28')](function(_0x36e171){_0x2548f1=_0x36e171;logger[_0x7de6('0xb')]('The\x20User\x20ID\x20is:',_0x2548f1['id']);return getEndUser(_0x3d994c,_0x579d85[_0x7de6('0x5c')],_0x579d85[_0x7de6('0x78')],_0xfa0dd6);})[_0x7de6('0x28')](function(_0x10a1fe){_0x12a7a8=_0x10a1fe;logger[_0x7de6('0xb')](_0x7de6('0x5d'),_0x12a7a8['id']);return getTicket(_0x3d994c,_0x2548f1,_0x12a7a8,_0x26ece3,_0x579d85,_0x26ece3[_0x7de6('0x5e')],_0xfa0dd6,_0x7de6('0x5f'));})['then'](function(_0x561745){_0x18696d=_0x561745;logger[_0x7de6('0xb')](_0x7de6('0x60'));logger[_0x7de6('0xb')](_0x7de6('0x61'),_0x18696d['id']);return setRelationship(_0xfa0dd6,_0x2548f1,_0x18696d,'users');})[_0x7de6('0x28')](function(){return setRelationship(_0xfa0dd6,_0x12a7a8,_0x18696d,'contacts');})[_0x7de6('0x28')](function(){return getServerInfo(_0xfa0dd6);})[_0x7de6('0x74')](function(_0x38d164){logger[_0x7de6('0x6a')]('['+_0x579d85[_0x7de6('0x76')][_0x7de6('0x77')]()+']',JSON['stringify'](_0x38d164));});}; \ 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 1e8b7a9..3eb940e 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 _0x99c9=['lastIndexOf','test','lodash','util','length','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','format','%s:\x20%s','key','stripTrailingSlash','slice'];(function(_0x4c2f8f,_0x49d732){var _0x3c7512=function(_0x3b744e){while(--_0x3b744e){_0x4c2f8f['push'](_0x4c2f8f['shift']());}};_0x3c7512(++_0x49d732);}(_0x99c9,0x162));var _0x999c=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x99c9[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x999c('0x0'));var util=require(_0x999c('0x1'));exports['getString']=function(_0x31d11e,_0x2ce4c5,_0x2439ef){var _0x55da4d=[];if(_0x31d11e[_0x999c('0x2')]>0x0){var _0x57b69d=_['sortBy'](_0x31d11e,['id']);for(var _0x2b61df=0x0;_0x2b61df<_0x57b69d['length'];_0x2b61df++){var _0x328d03=_0x57b69d[_0x2b61df];if(_0x328d03[_0x999c('0x3')]===_0x999c('0x4')){_0x55da4d[_0x999c('0x5')](_0x328d03[_0x999c('0x6')]);}else if(_0x328d03[_0x999c('0x3')]===_0x999c('0x7')&&_0x328d03[_0x999c('0x8')]){_0x2ce4c5[_0x328d03['variableName']]&&_0x55da4d['push'](_0x2ce4c5[_0x328d03[_0x999c('0x8')]][_0x999c('0x9')]());}else if(_0x328d03[_0x999c('0x3')]===_0x999c('0xa')&&_0x328d03['Variable']&&_0x328d03[_0x999c('0xb')]['name']){_0x2ce4c5[_0x328d03[_0x999c('0xb')][_0x999c('0xc')][_0x999c('0xd')]()]&&_0x55da4d[_0x999c('0x5')](_0x2ce4c5[_0x328d03[_0x999c('0xb')]['name'][_0x999c('0xd')]()][_0x999c('0x9')]());}else if(_0x328d03['type']==='keyValue'){if(_0x328d03[_0x999c('0xe')]===_0x999c('0x4')&&_0x328d03['key']){_0x55da4d['push'](util[_0x999c('0xf')](_0x999c('0x10'),_0x328d03[_0x999c('0x11')],_0x328d03['keyContent']));}else if(_0x328d03[_0x999c('0xe')]==='variable'&&_0x328d03[_0x999c('0x8')]&&_0x328d03[_0x999c('0x11')]){_0x2ce4c5[_0x328d03[_0x999c('0x8')]]&&_0x55da4d[_0x999c('0x5')](util[_0x999c('0xf')](_0x999c('0x10'),_0x328d03['key'],_0x2ce4c5[_0x328d03[_0x999c('0x8')]]));}else if(_0x328d03[_0x999c('0xe')]===_0x999c('0xa')&&_0x328d03[_0x999c('0xb')]&&_0x328d03[_0x999c('0xb')][_0x999c('0xc')]&&_0x328d03[_0x999c('0x11')]){_0x2ce4c5[_0x328d03['Variable'][_0x999c('0xc')]['toLowerCase']()]&&_0x55da4d[_0x999c('0x5')](util[_0x999c('0xf')](_0x999c('0x10'),_0x328d03[_0x999c('0x11')],_0x2ce4c5[_0x328d03[_0x999c('0xb')]['name'][_0x999c('0xd')]()]));}}}}return _0x55da4d['join'](_0x2439ef);};exports[_0x999c('0x12')]=function(_0x573e6b){var _0x420266=_0x573e6b[_0x999c('0x13')](-0x1);if(_0x420266==='/'){_0x573e6b=_0x573e6b['substring'](0x0,_0x573e6b[_0x999c('0x14')](_0x420266));}return _0x573e6b;};exports['validateEmail']=function(_0x4aefbc){if(!_['isNil'](_0x4aefbc)&&_0x4aefbc!==''){var _0x1eb1c9=/^(([^<>()\[\]\\.,;:\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 _0x1eb1c9[_0x999c('0x15')](String(_0x4aefbc)[_0x999c('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x6a04=['lodash','util','length','type','string','push','content','variable','variableName','Variable','name','toLowerCase','toString','keyValue','keyType','format','%s:\x20%s','key','keyContent','customVariable','join','slice','substring','validateEmail','isNil'];(function(_0x17a93a,_0x21320e){var _0x4be8aa=function(_0x2a3285){while(--_0x2a3285){_0x17a93a['push'](_0x17a93a['shift']());}};_0x4be8aa(++_0x21320e);}(_0x6a04,0x190));var _0x46a0=function(_0x222db7,_0x92dcf6){_0x222db7=_0x222db7-0x0;var _0x5c7556=_0x6a04[_0x222db7];return _0x5c7556;};'use strict';var _=require(_0x46a0('0x0'));var util=require(_0x46a0('0x1'));exports['getString']=function(_0x37f482,_0x2137d9,_0x250d58){var _0x483c36=[];if(_0x37f482['length']>0x0){var _0x4852db=_['sortBy'](_0x37f482,['id']);for(var _0x6fda1b=0x0;_0x6fda1b<_0x4852db[_0x46a0('0x2')];_0x6fda1b++){var _0x476457=_0x4852db[_0x6fda1b];if(_0x476457[_0x46a0('0x3')]===_0x46a0('0x4')){_0x483c36[_0x46a0('0x5')](_0x476457[_0x46a0('0x6')]);}else if(_0x476457[_0x46a0('0x3')]===_0x46a0('0x7')&&_0x476457[_0x46a0('0x8')]){_0x2137d9[_0x476457[_0x46a0('0x8')]]&&_0x483c36[_0x46a0('0x5')](_0x2137d9[_0x476457[_0x46a0('0x8')]]['toString']());}else if(_0x476457[_0x46a0('0x3')]==='customVariable'&&_0x476457['Variable']&&_0x476457['Variable']['name']){_0x2137d9[_0x476457[_0x46a0('0x9')][_0x46a0('0xa')][_0x46a0('0xb')]()]&&_0x483c36[_0x46a0('0x5')](_0x2137d9[_0x476457[_0x46a0('0x9')][_0x46a0('0xa')]['toLowerCase']()][_0x46a0('0xc')]());}else if(_0x476457[_0x46a0('0x3')]===_0x46a0('0xd')){if(_0x476457[_0x46a0('0xe')]===_0x46a0('0x4')&&_0x476457['key']){_0x483c36[_0x46a0('0x5')](util[_0x46a0('0xf')](_0x46a0('0x10'),_0x476457[_0x46a0('0x11')],_0x476457[_0x46a0('0x12')]));}else if(_0x476457[_0x46a0('0xe')]===_0x46a0('0x7')&&_0x476457[_0x46a0('0x8')]&&_0x476457[_0x46a0('0x11')]){_0x2137d9[_0x476457['variableName']]&&_0x483c36['push'](util[_0x46a0('0xf')](_0x46a0('0x10'),_0x476457[_0x46a0('0x11')],_0x2137d9[_0x476457['variableName']]));}else if(_0x476457['keyType']===_0x46a0('0x13')&&_0x476457[_0x46a0('0x9')]&&_0x476457[_0x46a0('0x9')]['name']&&_0x476457[_0x46a0('0x11')]){_0x2137d9[_0x476457[_0x46a0('0x9')][_0x46a0('0xa')][_0x46a0('0xb')]()]&&_0x483c36[_0x46a0('0x5')](util[_0x46a0('0xf')]('%s:\x20%s',_0x476457[_0x46a0('0x11')],_0x2137d9[_0x476457['Variable'][_0x46a0('0xa')][_0x46a0('0xb')]()]));}}}}return _0x483c36[_0x46a0('0x14')](_0x250d58);};exports['stripTrailingSlash']=function(_0x1c35d9){var _0x42c641=_0x1c35d9[_0x46a0('0x15')](-0x1);if(_0x42c641==='/'){_0x1c35d9=_0x1c35d9[_0x46a0('0x16')](0x0,_0x1c35d9['lastIndexOf'](_0x42c641));}return _0x1c35d9;};exports[_0x46a0('0x17')]=function(_0x35f2aa){if(!_[_0x46a0('0x18')](_0x35f2aa)&&_0x35f2aa!==''){var _0x39a49d=/^(([^<>()\[\]\\.,;:\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 _0x39a49d['test'](String(_0x35f2aa)[_0x46a0('0xb')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 8225346..2f675ee 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(_0x313865,_0x23d665){var _0x58151c=function(_0x4382a6){while(--_0x4382a6){_0x313865['push'](_0x313865['shift']());}};_0x58151c(++_0x23d665);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'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 _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x4d7988,_0x4c62e3){var _0x97e287=function(_0x223966){while(--_0x223966){_0x4d7988['push'](_0x4d7988['shift']());}};_0x97e287(++_0x4c62e3);}(_0xe706,0xa3));var _0x6e70=function(_0x76bd2,_0x487abe){_0x76bd2=_0x76bd2-0x0;var _0x2e50f3=_0xe706[_0x76bd2];return _0x2e50f3;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 75c90bb..99d47d1 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 _0xd8b1=['unmanaged','lastevent','toUpperCase','catch','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','zendesk','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Descriptions','then','ticket','Getting\x20agent\x20with\x20email','%s/search.json','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','filter','end-user','length','Enduser\x20found!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','Basic\x20%s','toString','debug','stringify','defaults','GET','map','forEach','string','picklist','nameField','customField','toLowerCase','content','includes','type','idField','variable','variableName','custom_fields','customVariable','Variable','push','stripTrailingSlash','serverUrl','monitor_format','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','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','newTab','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd8b1,0xe1));var _0x1d8b=function(_0x467760,_0x292ecd){_0x467760=_0x467760-0x0;var _0xd00496=_0xd8b1[_0x467760];return _0xd00496;};'use strict';var _=require(_0x1d8b('0x0'));var rp=require(_0x1d8b('0x1'));var md5=require(_0x1d8b('0x2'));var util=require(_0x1d8b('0x3'));var Redis=require(_0x1d8b('0x4'));var intUtil=require(_0x1d8b('0x5'));var config=require(_0x1d8b('0x6'));var logger=require('../../../../config/logger')(_0x1d8b('0x7'));config[_0x1d8b('0x8')]=_['defaults'](config[_0x1d8b('0x8')],{'host':_0x1d8b('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x54777f,_0x591588,_0x58f246){io['to'](_0x54777f)[_0x1d8b('0xa')](_0x591588,_0x58f246);}var headers={'Content-Type':_0x1d8b('0xb'),'Accept':_0x1d8b('0xb')};function getTicket(_0x3a1eda,_0x18a515,_0x2d2636,_0x46136b,_0x39b3f7){logger[_0x1d8b('0xc')](_0x1d8b('0xd'));return request({'uri':util[_0x1d8b('0xe')](_0x1d8b('0xf'),_0x3a1eda[_0x1d8b('0x10')]),'method':_0x1d8b('0x11'),'body':{'ticket':_[_0x1d8b('0x12')]({'requester_id':_0x2d2636['id'],'submitter_id':_0x18a515?_0x18a515['id']:undefined,'assignee_id':_0x18a515?_0x18a515['id']:undefined,'tags':getTags(_0x46136b[_0x1d8b('0x13')],_0x1d8b('0x14')),'subject':intUtil[_0x1d8b('0x15')](_0x46136b['Subjects'],_0x39b3f7,'\x20'),'description':intUtil[_0x1d8b('0x15')](_0x46136b[_0x1d8b('0x16')],_0x39b3f7,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x46136b[_0x1d8b('0x16')],_0x39b3f7,'\x0a')}},getCustomFields(_0x46136b['Fields'],_0x39b3f7))}})[_0x1d8b('0x17')](function(_0x4bd054){logger[_0x1d8b('0xc')]('Ticket\x20created!');return _0x4bd054[_0x1d8b('0x18')];});}function getUser(_0x505f58,_0x2cc281){if(intUtil['validateEmail'](_0x2cc281)){logger[_0x1d8b('0xc')](_0x1d8b('0x19'),_0x2cc281);return request({'uri':util[_0x1d8b('0xe')](_0x1d8b('0x1a'),_0x505f58['remoteUri']),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x2cc281)}})[_0x1d8b('0x17')](function(_0x5869f9){if(_0x5869f9[_0x1d8b('0x1b')]){logger['info'](_0x1d8b('0x1c'));return _[_0x1d8b('0x1d')](_0x5869f9[_0x1d8b('0x1e')],{'email':_0x2cc281,'role':_0x1d8b('0x1f')});}else{logger[_0x1d8b('0xc')](_0x1d8b('0x20'));return request({'uri':util['format'](_0x1d8b('0x21'),_0x505f58[_0x1d8b('0x10')])})[_0x1d8b('0x17')](function(_0x153c17){logger[_0x1d8b('0xc')](_0x1d8b('0x22'));return _0x153c17[_0x1d8b('0x23')];});}});}else{logger[_0x1d8b('0xc')](_0x1d8b('0x20'));return request({'uri':util[_0x1d8b('0xe')]('%s/users/me.json',_0x505f58[_0x1d8b('0x10')])})[_0x1d8b('0x17')](function(_0x112960){logger['info'](_0x1d8b('0x22'));return _0x112960[_0x1d8b('0x23')];});}}function getEndUser(_0x408f46,_0x22861b,_0x34b686){logger[_0x1d8b('0xc')](_0x1d8b('0x24'),_0x34b686);return request({'uri':util[_0x1d8b('0xe')](_0x1d8b('0x1a'),_0x408f46[_0x1d8b('0x10')]),'qs':{'query':util[_0x1d8b('0xe')](_0x1d8b('0x25'),_0x34b686)}})[_0x1d8b('0x17')](function(_0x3eee48){var _0x29e8fd;if(_0x3eee48['results']['length']){_0x3eee48[_0x1d8b('0x1e')]=_[_0x1d8b('0x26')](_0x3eee48[_0x1d8b('0x1e')],{'suspended':![],'role':_0x1d8b('0x27')});if(_0x3eee48[_0x1d8b('0x1e')][_0x1d8b('0x28')]){_0x29e8fd=_['first'](_0x3eee48['results']);}}if(_0x29e8fd){logger[_0x1d8b('0xc')](_0x1d8b('0x29'));return _0x29e8fd;}else{logger[_0x1d8b('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x1d8b('0xe')]('%s/users.json',_0x408f46[_0x1d8b('0x10')]),'method':_0x1d8b('0x11'),'body':{'user':{'role':_0x1d8b('0x27'),'name':util[_0x1d8b('0xe')](_0x1d8b('0x2a'),_0x22861b||_0x34b686),'phone':_0x34b686}}})[_0x1d8b('0x17')](function(_0x14eb09){logger[_0x1d8b('0xc')](_0x1d8b('0x2b'));return _0x14eb09[_0x1d8b('0x23')];});}});}function getAuth(_0x2bdc4e){var _0xd49294;if(_0x2bdc4e[_0x1d8b('0x2c')]===_0x1d8b('0x2d')){_0xd49294=util[_0x1d8b('0xe')]('%s:%s',_0x2bdc4e[_0x1d8b('0x2e')],_0x2bdc4e['password']);}else if(_0x2bdc4e[_0x1d8b('0x2c')]===_0x1d8b('0x2f')){_0xd49294=util[_0x1d8b('0xe')]('%s/token:%s',_0x2bdc4e['username'],_0x2bdc4e[_0x1d8b('0x2f')]);}return util[_0x1d8b('0xe')](_0x1d8b('0x30'),new Buffer(_0xd49294)[_0x1d8b('0x31')]('base64'));}function request(_0xcc8b5d){logger[_0x1d8b('0x32')]('[HTTP]',JSON[_0x1d8b('0x33')](_0xcc8b5d));return rp(_[_0x1d8b('0x34')](_0xcc8b5d,{'method':_0x1d8b('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x21183d,_0x1a6bf8){var _0x4f8a2d=[];if(_0x21183d&&_0x21183d[_0x1d8b('0x28')]>0x0){_0x4f8a2d=_[_0x1d8b('0x36')](_0x21183d,_0x1a6bf8);}return _0x4f8a2d;}function getCustomFields(_0x28f473,_0x3b6e3c){var _0x30609e=[];var _0x388594={'custom_fields':[]};if(_0x28f473[_0x1d8b('0x28')]>0x0){_[_0x1d8b('0x37')](_0x28f473,function(_0x36c357){if(_['includes']([_0x1d8b('0x38'),_0x1d8b('0x39')],_0x36c357['type'])&&_0x36c357[_0x1d8b('0x3a')]&&!_0x36c357[_0x1d8b('0x3b')]){_0x388594[_0x36c357['nameField'][_0x1d8b('0x3c')]()]=_0x36c357[_0x1d8b('0x3d')][_0x1d8b('0x31')]();}else if(_[_0x1d8b('0x3e')]([_0x1d8b('0x38'),_0x1d8b('0x39')],_0x36c357[_0x1d8b('0x3f')])&&_0x36c357[_0x1d8b('0x40')]&&_0x36c357[_0x1d8b('0x3b')]){_0x388594['custom_fields']['push']({'id':_0x36c357[_0x1d8b('0x40')],'value':_0x36c357['content'][_0x1d8b('0x31')]()});}else if(_0x36c357[_0x1d8b('0x3f')]===_0x1d8b('0x41')&&_0x36c357[_0x1d8b('0x42')]&&_0x36c357[_0x1d8b('0x40')]&&_0x36c357[_0x1d8b('0x3b')]){_0x3b6e3c[_0x36c357[_0x1d8b('0x42')]]&&_0x388594[_0x1d8b('0x43')]['push']({'id':_0x36c357[_0x1d8b('0x40')],'value':_0x3b6e3c[_0x36c357['variableName']]['toString']()});}else if(_0x36c357['type']===_0x1d8b('0x44')&&_0x36c357[_0x1d8b('0x45')]&&_0x36c357[_0x1d8b('0x45')][_0x1d8b('0x14')]&&_0x36c357['idField']&&_0x36c357[_0x1d8b('0x3b')]){_0x3b6e3c[_0x36c357[_0x1d8b('0x45')]['name'][_0x1d8b('0x3c')]()]&&_0x388594['custom_fields'][_0x1d8b('0x46')]({'id':_0x36c357[_0x1d8b('0x40')],'value':_0x3b6e3c[_0x36c357[_0x1d8b('0x45')][_0x1d8b('0x14')][_0x1d8b('0x3c')]()][_0x1d8b('0x31')]()});}});}return _0x388594;}exports['queue']=function(_0x2d02e9,_0x70d68c,_0x53fdf9,_0x58d99c,_0x1d5b46,_0x566408){var _0x3c92d8,_0x12692e;_0x566408['remoteUri']=intUtil[_0x1d8b('0x47')](_0x566408[_0x1d8b('0x10')]);_0x566408['serverUrl']=intUtil[_0x1d8b('0x47')](_0x566408[_0x1d8b('0x48')]);if(_0x1d5b46&&_0x1d5b46[_0x1d8b('0x49')]){logger[_0x1d8b('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0x70d68c[_0x1d8b('0x4a')]=util['format'](_0x1d8b('0x4b'),_0x566408[_0x1d8b('0x48')],_0x70d68c[_0x1d8b('0x4c')],md5(_0x70d68c[_0x1d8b('0x4c')]));}else{_0x70d68c[_0x1d8b('0x4a')]='';}headers[_0x1d8b('0x4d')]=getAuth(_0x566408);return getUser(_0x566408,_0x58d99c[_0x1d8b('0x4e')])[_0x1d8b('0x17')](function(_0x18e966){_0x3c92d8=_0x18e966;logger[_0x1d8b('0xc')](_0x1d8b('0x4f'),_0x3c92d8['id']);return getEndUser(_0x566408,_0x70d68c[_0x1d8b('0x50')],_0x70d68c[_0x1d8b('0x51')]);})[_0x1d8b('0x17')](function(_0x547284){_0x12692e=_0x547284;logger[_0x1d8b('0xc')](_0x1d8b('0x52'),_0x12692e['id']);return getTicket(_0x566408,_0x3c92d8,_0x12692e,_0x53fdf9,_0x70d68c);})[_0x1d8b('0x17')](function(_0x5db7ed){if(_0x5db7ed){logger[_0x1d8b('0xc')](_0x1d8b('0x53'),_0x5db7ed['id']);switch(_0x566408['type']){case _0x1d8b('0x54'):logger[_0x1d8b('0xc')](_0x1d8b('0x55'),_0x1d8b('0x56'));return request({'uri':util[_0x1d8b('0xe')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x566408['remoteUri'],_0x3c92d8['id'],_0x5db7ed['id']),'method':_0x1d8b('0x11')});case _0x1d8b('0x57'):logger[_0x1d8b('0xc')](_0x1d8b('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1d8b('0xe')]('user:%s',_0x58d99c['name']),_0x1d8b('0x58'),{'uri':util[_0x1d8b('0xe')](_0x1d8b('0x59'),_0x566408[_0x1d8b('0x10')][_0x1d8b('0x5a')](_0x1d8b('0x5b'),''),_0x5db7ed['id'])});break;default:logger[_0x1d8b('0x5c')](_0x1d8b('0x55'),_0x1d8b('0x5d'));}}})['catch'](function(_0x32a46f){logger['error'](_0x1d8b('0x5e'),util[_0x1d8b('0x5f')](_0x32a46f,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x20f50a,_0x3a877c,_0x2c463f,_0x3292c9,_0x313a63,_0x3e973e,_0xd37560){var _0xc3c65,_0x19da5f;_0x3e973e[_0x1d8b('0x10')]=intUtil['stripTrailingSlash'](_0x3e973e[_0x1d8b('0x10')]);_0x3e973e[_0x1d8b('0x48')]=intUtil[_0x1d8b('0x47')](_0x3e973e[_0x1d8b('0x48')]);if(_0xd37560&&_0xd37560[_0x1d8b('0x60')]&&_0xd37560[_0x1d8b('0x60')]!==_0x1d8b('0x61')){logger['info'](_0x1d8b('0x62'),_0x1d8b('0x63'));_0x3a877c['recordingURL']=util[_0x1d8b('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3e973e['serverUrl'],_0x3a877c[_0x1d8b('0x4c')],md5(_0x3a877c[_0x1d8b('0x4c')]));}headers[_0x1d8b('0x4d')]=getAuth(_0x3e973e);return getUser(_0x3e973e,_0x3292c9[_0x1d8b('0x4e')])[_0x1d8b('0x17')](function(_0x47237b){_0xc3c65=_0x47237b;logger['info'](_0x1d8b('0x4f'),_0xc3c65['id']);return getEndUser(_0x3e973e,_0x3a877c[_0x1d8b('0x64')],_0x3a877c[_0x1d8b('0x65')]);})[_0x1d8b('0x17')](function(_0x28e9cb){_0x19da5f=_0x28e9cb;logger[_0x1d8b('0xc')](_0x1d8b('0x52'),_0x19da5f['id']);return getTicket(_0x3e973e,_0xc3c65,_0x19da5f,_0x2c463f,_0x3a877c);})[_0x1d8b('0x17')](function(_0x569fd0){if(_0x569fd0){logger[_0x1d8b('0xc')](_0x1d8b('0x53'),_0x569fd0['id']);switch(_0x3e973e['type']){case _0x1d8b('0x54'):logger['info'](_0x1d8b('0x62'),_0x1d8b('0x56'));return request({'uri':util[_0x1d8b('0xe')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3e973e[_0x1d8b('0x10')],_0xc3c65['id'],_0x569fd0['id']),'method':_0x1d8b('0x11')});case _0x1d8b('0x57'):logger[_0x1d8b('0xc')](_0x1d8b('0x62'),_0x1d8b('0x66'));emit(util[_0x1d8b('0xe')](_0x1d8b('0x67'),_0x3292c9[_0x1d8b('0x14')]),'trigger:browser:url',{'uri':util[_0x1d8b('0xe')](_0x1d8b('0x59'),_0x3e973e['remoteUri']['replace'](_0x1d8b('0x5b'),''),_0x569fd0['id'])});break;default:logger['error'](_0x1d8b('0x62'),_0x1d8b('0x5d'));}}})['catch'](function(_0x3c7f2b){logger[_0x1d8b('0x5c')](_0x1d8b('0x68'),util['inspect'](_0x3c7f2b,{'showHidden':!![],'depth':null}));});};exports[_0x1d8b('0x69')]=function(_0x14929b,_0x2f4d23,_0x2559da,_0x2e06df,_0x3c5b90,_0x1df997){var _0x195fd0,_0x4e8172;_0x1df997[_0x1d8b('0x10')]=intUtil[_0x1d8b('0x47')](_0x1df997[_0x1d8b('0x10')]);_0x1df997[_0x1d8b('0x48')]=intUtil['stripTrailingSlash'](_0x1df997['serverUrl']);if(_0x3c5b90&&_0x3c5b90[_0x1d8b('0x49')]){logger[_0x1d8b('0xc')]('['+_0x2f4d23[_0x1d8b('0x6a')][_0x1d8b('0x6b')]()+']',_0x1d8b('0x63'));_0x2f4d23['recordingURL']=util[_0x1d8b('0xe')](_0x1d8b('0x4b'),_0x1df997[_0x1d8b('0x48')],_0x2f4d23[_0x1d8b('0x4c')],md5(_0x2f4d23[_0x1d8b('0x4c')]));}else{_0x2f4d23[_0x1d8b('0x4a')]='';}headers[_0x1d8b('0x4d')]=getAuth(_0x1df997);return getUser(_0x1df997)[_0x1d8b('0x17')](function(_0x5c0a36){_0x195fd0=_0x5c0a36;logger[_0x1d8b('0xc')](_0x1d8b('0x4f'),_0x195fd0['id']);return getEndUser(_0x1df997,_0x2f4d23['calleridname'],_0x2f4d23[_0x1d8b('0x51')]);})[_0x1d8b('0x17')](function(_0x26aae9){_0x4e8172=_0x26aae9;logger[_0x1d8b('0xc')](_0x1d8b('0x52'),_0x4e8172['id']);return getTicket(_0x1df997,_0x195fd0,_0x4e8172,_0x2559da,_0x2f4d23);})[_0x1d8b('0x17')](function(_0x5c2b1f){if(_0x5c2b1f){logger[_0x1d8b('0xc')](_0x1d8b('0x53'),_0x5c2b1f['id']);}})[_0x1d8b('0x6c')](function(_0xcbf074){logger[_0x1d8b('0x5c')]('['+_0x2f4d23[_0x1d8b('0x6a')][_0x1d8b('0x6b')]()+']'+_0x1d8b('0x6d'),util[_0x1d8b('0x5f')](_0xcbf074,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2e5d=['lodash','request-promise','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','application/json','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','format','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','toString','type','custom_fields','push','idField','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','/api/v2','error','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Authorization','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','user:%s','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2e5d,0x14d));var _0xd2e5=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0x2e5d[_0x13f980];return _0x27153c;};'use strict';var _=require(_0xd2e5('0x0'));var rp=require(_0xd2e5('0x1'));var md5=require('md5');var util=require(_0xd2e5('0x2'));var Redis=require(_0xd2e5('0x3'));var intUtil=require('./util');var config=require(_0xd2e5('0x4'));var logger=require(_0xd2e5('0x5'))('zendesk');config[_0xd2e5('0x6')]=_[_0xd2e5('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x1938de,_0x40c560,_0x12afb8){io['to'](_0x1938de)['emit'](_0x40c560,_0x12afb8);}var headers={'Content-Type':_0xd2e5('0x8'),'Accept':_0xd2e5('0x8')};function getTicket(_0x206c31,_0x469dc7,_0x5c3dfd,_0x3f524c,_0x1e5f7b){logger['info'](_0xd2e5('0x9'));return request({'uri':util['format'](_0xd2e5('0xa'),_0x206c31[_0xd2e5('0xb')]),'method':_0xd2e5('0xc'),'body':{'ticket':_[_0xd2e5('0xd')]({'requester_id':_0x5c3dfd['id'],'submitter_id':_0x469dc7?_0x469dc7['id']:undefined,'assignee_id':_0x469dc7?_0x469dc7['id']:undefined,'tags':getTags(_0x3f524c[_0xd2e5('0xe')],_0xd2e5('0xf')),'subject':intUtil[_0xd2e5('0x10')](_0x3f524c[_0xd2e5('0x11')],_0x1e5f7b,'\x20'),'description':intUtil[_0xd2e5('0x10')](_0x3f524c[_0xd2e5('0x12')],_0x1e5f7b,'\x0a'),'comment':{'public':![],'body':intUtil[_0xd2e5('0x10')](_0x3f524c['Descriptions'],_0x1e5f7b,'\x0a')}},getCustomFields(_0x3f524c[_0xd2e5('0x13')],_0x1e5f7b))}})[_0xd2e5('0x14')](function(_0x32decc){logger[_0xd2e5('0x15')](_0xd2e5('0x16'));return _0x32decc[_0xd2e5('0x17')];});}function getUser(_0x297349,_0x1d7624){if(intUtil[_0xd2e5('0x18')](_0x1d7624)){logger[_0xd2e5('0x15')]('Getting\x20agent\x20with\x20email',_0x1d7624);return request({'uri':util[_0xd2e5('0x19')]('%s/search.json',_0x297349[_0xd2e5('0xb')]),'qs':{'query':util[_0xd2e5('0x19')]('type:user\x20role:agent\x20email:%s',_0x1d7624)}})['then'](function(_0x1c1101){if(_0x1c1101[_0xd2e5('0x1a')]){logger[_0xd2e5('0x15')](_0xd2e5('0x1b'));return _[_0xd2e5('0x1c')](_0x1c1101[_0xd2e5('0x1d')],{'email':_0x1d7624,'role':'agent'});}else{logger[_0xd2e5('0x15')](_0xd2e5('0x1e'));return request({'uri':util[_0xd2e5('0x19')]('%s/users/me.json',_0x297349['remoteUri'])})[_0xd2e5('0x14')](function(_0x3b7edf){logger[_0xd2e5('0x15')](_0xd2e5('0x1f'));return _0x3b7edf[_0xd2e5('0x20')];});}});}else{logger[_0xd2e5('0x15')](_0xd2e5('0x1e'));return request({'uri':util[_0xd2e5('0x19')]('%s/users/me.json',_0x297349[_0xd2e5('0xb')])})[_0xd2e5('0x14')](function(_0x235536){logger[_0xd2e5('0x15')]('Admin\x20account\x20selected.');return _0x235536['user'];});}}function getEndUser(_0xb57610,_0x31e4d6,_0x331a97){logger['info'](_0xd2e5('0x21'),_0x331a97);return request({'uri':util['format'](_0xd2e5('0x22'),_0xb57610[_0xd2e5('0xb')]),'qs':{'query':util[_0xd2e5('0x19')](_0xd2e5('0x23'),_0x331a97)}})[_0xd2e5('0x14')](function(_0x3e3df9){var _0x8b3835;if(_0x3e3df9['results']['length']){_0x3e3df9['results']=_[_0xd2e5('0x24')](_0x3e3df9['results'],{'suspended':![],'role':_0xd2e5('0x25')});if(_0x3e3df9['results'][_0xd2e5('0x26')]){_0x8b3835=_[_0xd2e5('0x27')](_0x3e3df9['results']);}}if(_0x8b3835){logger[_0xd2e5('0x15')](_0xd2e5('0x28'));return _0x8b3835;}else{logger[_0xd2e5('0x15')](_0xd2e5('0x29'));return request({'uri':util['format'](_0xd2e5('0x2a'),_0xb57610[_0xd2e5('0xb')]),'method':_0xd2e5('0xc'),'body':{'user':{'role':_0xd2e5('0x25'),'name':util[_0xd2e5('0x19')]('Caller\x20-\x20%s',_0x31e4d6||_0x331a97),'phone':_0x331a97}}})['then'](function(_0x1712a3){logger['info']('Enduser\x20created.');return _0x1712a3[_0xd2e5('0x20')];});}});}function getAuth(_0x5ca909){var _0x1adbd5;if(_0x5ca909[_0xd2e5('0x2b')]===_0xd2e5('0x2c')){_0x1adbd5=util[_0xd2e5('0x19')](_0xd2e5('0x2d'),_0x5ca909[_0xd2e5('0x2e')],_0x5ca909['password']);}else if(_0x5ca909[_0xd2e5('0x2b')]===_0xd2e5('0x2f')){_0x1adbd5=util[_0xd2e5('0x19')](_0xd2e5('0x30'),_0x5ca909[_0xd2e5('0x2e')],_0x5ca909[_0xd2e5('0x2f')]);}return util[_0xd2e5('0x19')](_0xd2e5('0x31'),new Buffer(_0x1adbd5)['toString'](_0xd2e5('0x32')));}function request(_0x5db540){logger[_0xd2e5('0x33')](_0xd2e5('0x34'),JSON[_0xd2e5('0x35')](_0x5db540));return rp(_[_0xd2e5('0x7')](_0x5db540,{'method':_0xd2e5('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x25c707,_0x4e2401){var _0x5433bf=[];if(_0x25c707&&_0x25c707[_0xd2e5('0x26')]>0x0){_0x5433bf=_[_0xd2e5('0x37')](_0x25c707,_0x4e2401);}return _0x5433bf;}function getCustomFields(_0x2bd0ec,_0x92bac8){var _0x4bb9ec=[];var _0x2d53ed={'custom_fields':[]};if(_0x2bd0ec[_0xd2e5('0x26')]>0x0){_[_0xd2e5('0x38')](_0x2bd0ec,function(_0x26df0d){if(_[_0xd2e5('0x39')]([_0xd2e5('0x3a'),_0xd2e5('0x3b')],_0x26df0d['type'])&&_0x26df0d[_0xd2e5('0x3c')]&&!_0x26df0d[_0xd2e5('0x3d')]){_0x2d53ed[_0x26df0d[_0xd2e5('0x3c')][_0xd2e5('0x3e')]()]=_0x26df0d[_0xd2e5('0x3f')][_0xd2e5('0x40')]();}else if(_[_0xd2e5('0x39')]([_0xd2e5('0x3a'),_0xd2e5('0x3b')],_0x26df0d[_0xd2e5('0x41')])&&_0x26df0d['idField']&&_0x26df0d[_0xd2e5('0x3d')]){_0x2d53ed[_0xd2e5('0x42')][_0xd2e5('0x43')]({'id':_0x26df0d[_0xd2e5('0x44')],'value':_0x26df0d[_0xd2e5('0x3f')]['toString']()});}else if(_0x26df0d[_0xd2e5('0x41')]===_0xd2e5('0x45')&&_0x26df0d['variableName']&&_0x26df0d['idField']&&_0x26df0d[_0xd2e5('0x3d')]){_0x92bac8[_0x26df0d[_0xd2e5('0x46')]]&&_0x2d53ed[_0xd2e5('0x42')][_0xd2e5('0x43')]({'id':_0x26df0d[_0xd2e5('0x44')],'value':_0x92bac8[_0x26df0d[_0xd2e5('0x46')]][_0xd2e5('0x40')]()});}else if(_0x26df0d['type']===_0xd2e5('0x47')&&_0x26df0d[_0xd2e5('0x48')]&&_0x26df0d[_0xd2e5('0x48')][_0xd2e5('0xf')]&&_0x26df0d[_0xd2e5('0x44')]&&_0x26df0d[_0xd2e5('0x3d')]){_0x92bac8[_0x26df0d[_0xd2e5('0x48')][_0xd2e5('0xf')][_0xd2e5('0x3e')]()]&&_0x2d53ed['custom_fields'][_0xd2e5('0x43')]({'id':_0x26df0d[_0xd2e5('0x44')],'value':_0x92bac8[_0x26df0d[_0xd2e5('0x48')][_0xd2e5('0xf')][_0xd2e5('0x3e')]()][_0xd2e5('0x40')]()});}});}return _0x2d53ed;}exports[_0xd2e5('0x49')]=function(_0x438fde,_0x226765,_0x1fccc6,_0x3f0f6e,_0x389403,_0x3b5d3e){var _0x4cb828,_0x1d3c5d;_0x3b5d3e[_0xd2e5('0xb')]=intUtil[_0xd2e5('0x4a')](_0x3b5d3e[_0xd2e5('0xb')]);_0x3b5d3e[_0xd2e5('0x4b')]=intUtil[_0xd2e5('0x4a')](_0x3b5d3e[_0xd2e5('0x4b')]);if(_0x389403&&_0x389403[_0xd2e5('0x4c')]){logger['info'](_0xd2e5('0x4d'),'Recording\x20is\x20enabled!');_0x226765[_0xd2e5('0x4e')]=util[_0xd2e5('0x19')](_0xd2e5('0x4f'),_0x3b5d3e[_0xd2e5('0x4b')],_0x226765[_0xd2e5('0x50')],md5(_0x226765['uniqueid']));}else{_0x226765[_0xd2e5('0x4e')]='';}headers['Authorization']=getAuth(_0x3b5d3e);return getUser(_0x3b5d3e,_0x3f0f6e['email'])[_0xd2e5('0x14')](function(_0x34f1dc){_0x4cb828=_0x34f1dc;logger[_0xd2e5('0x15')]('The\x20User\x20ID\x20is:',_0x4cb828['id']);return getEndUser(_0x3b5d3e,_0x226765[_0xd2e5('0x51')],_0x226765[_0xd2e5('0x52')]);})[_0xd2e5('0x14')](function(_0xc5c1f0){_0x1d3c5d=_0xc5c1f0;logger['info'](_0xd2e5('0x53'),_0x1d3c5d['id']);return getTicket(_0x3b5d3e,_0x4cb828,_0x1d3c5d,_0x1fccc6,_0x226765);})[_0xd2e5('0x14')](function(_0x296354){if(_0x296354){logger[_0xd2e5('0x15')](_0xd2e5('0x54'),_0x296354['id']);switch(_0x3b5d3e[_0xd2e5('0x41')]){case _0xd2e5('0x55'):logger[_0xd2e5('0x15')]('[QUEUE]',_0xd2e5('0x56'));return request({'uri':util[_0xd2e5('0x19')](_0xd2e5('0x57'),_0x3b5d3e[_0xd2e5('0xb')],_0x4cb828['id'],_0x296354['id']),'method':'POST'});case'newTab':logger[_0xd2e5('0x15')](_0xd2e5('0x4d'),_0xd2e5('0x58'));emit(util[_0xd2e5('0x19')]('user:%s',_0x3f0f6e[_0xd2e5('0xf')]),_0xd2e5('0x59'),{'uri':util[_0xd2e5('0x19')]('%s/agent/tickets/%s',_0x3b5d3e['remoteUri'][_0xd2e5('0x5a')](_0xd2e5('0x5b'),''),_0x296354['id'])});break;default:logger[_0xd2e5('0x5c')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xd2e5('0x5d')](function(_0x5933cc){logger[_0xd2e5('0x5c')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xd2e5('0x5e')](_0x5933cc,{'showHidden':!![],'depth':null}));});};exports[_0xd2e5('0x5f')]=function(_0x51c162,_0x5db403,_0x327385,_0x42e55a,_0x482c61,_0x18f0ef,_0xe1bcfc){var _0x330725,_0x4544ce;_0x18f0ef[_0xd2e5('0xb')]=intUtil[_0xd2e5('0x4a')](_0x18f0ef['remoteUri']);_0x18f0ef['serverUrl']=intUtil[_0xd2e5('0x4a')](_0x18f0ef[_0xd2e5('0x4b')]);if(_0xe1bcfc&&_0xe1bcfc[_0xd2e5('0x60')]&&_0xe1bcfc[_0xd2e5('0x60')]!==_0xd2e5('0x61')){logger[_0xd2e5('0x15')](_0xd2e5('0x62'),_0xd2e5('0x63'));_0x5db403[_0xd2e5('0x4e')]=util[_0xd2e5('0x19')](_0xd2e5('0x4f'),_0x18f0ef[_0xd2e5('0x4b')],_0x5db403[_0xd2e5('0x50')],md5(_0x5db403[_0xd2e5('0x50')]));}headers[_0xd2e5('0x64')]=getAuth(_0x18f0ef);return getUser(_0x18f0ef,_0x42e55a['email'])[_0xd2e5('0x14')](function(_0x13821d){_0x330725=_0x13821d;logger[_0xd2e5('0x15')](_0xd2e5('0x65'),_0x330725['id']);return getEndUser(_0x18f0ef,_0x5db403[_0xd2e5('0x66')],_0x5db403[_0xd2e5('0x67')]);})[_0xd2e5('0x14')](function(_0x23c056){_0x4544ce=_0x23c056;logger[_0xd2e5('0x15')](_0xd2e5('0x53'),_0x4544ce['id']);return getTicket(_0x18f0ef,_0x330725,_0x4544ce,_0x327385,_0x5db403);})['then'](function(_0x4dba02){if(_0x4dba02){logger[_0xd2e5('0x15')](_0xd2e5('0x54'),_0x4dba02['id']);switch(_0x18f0ef[_0xd2e5('0x41')]){case _0xd2e5('0x55'):logger[_0xd2e5('0x15')]('[OUTBOUND]',_0xd2e5('0x56'));return request({'uri':util[_0xd2e5('0x19')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x18f0ef['remoteUri'],_0x330725['id'],_0x4dba02['id']),'method':_0xd2e5('0xc')});case'newTab':logger[_0xd2e5('0x15')](_0xd2e5('0x62'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd2e5('0x19')](_0xd2e5('0x68'),_0x42e55a[_0xd2e5('0xf')]),_0xd2e5('0x59'),{'uri':util[_0xd2e5('0x19')](_0xd2e5('0x69'),_0x18f0ef[_0xd2e5('0xb')][_0xd2e5('0x5a')](_0xd2e5('0x5b'),''),_0x4dba02['id'])});break;default:logger[_0xd2e5('0x5c')](_0xd2e5('0x62'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xd2e5('0x5d')](function(_0x276afa){logger['error'](_0xd2e5('0x6a'),util[_0xd2e5('0x5e')](_0x276afa,{'showHidden':!![],'depth':null}));});};exports[_0xd2e5('0x6b')]=function(_0x4a2070,_0x164745,_0xa233c4,_0x3de4ce,_0x49e6c9,_0x5a31e2){var _0x1a2812,_0x265598;_0x5a31e2['remoteUri']=intUtil[_0xd2e5('0x4a')](_0x5a31e2['remoteUri']);_0x5a31e2[_0xd2e5('0x4b')]=intUtil[_0xd2e5('0x4a')](_0x5a31e2[_0xd2e5('0x4b')]);if(_0x49e6c9&&_0x49e6c9[_0xd2e5('0x4c')]){logger[_0xd2e5('0x15')]('['+_0x164745['lastevent'][_0xd2e5('0x6c')]()+']','Recording\x20is\x20enabled!');_0x164745['recordingURL']=util[_0xd2e5('0x19')](_0xd2e5('0x4f'),_0x5a31e2[_0xd2e5('0x4b')],_0x164745[_0xd2e5('0x50')],md5(_0x164745[_0xd2e5('0x50')]));}else{_0x164745[_0xd2e5('0x4e')]='';}headers['Authorization']=getAuth(_0x5a31e2);return getUser(_0x5a31e2)['then'](function(_0x4f2c7d){_0x1a2812=_0x4f2c7d;logger[_0xd2e5('0x15')](_0xd2e5('0x65'),_0x1a2812['id']);return getEndUser(_0x5a31e2,_0x164745['calleridname'],_0x164745[_0xd2e5('0x52')]);})['then'](function(_0x5f22dc){_0x265598=_0x5f22dc;logger[_0xd2e5('0x15')](_0xd2e5('0x53'),_0x265598['id']);return getTicket(_0x5a31e2,_0x1a2812,_0x265598,_0xa233c4,_0x164745);})[_0xd2e5('0x14')](function(_0x1f8782){if(_0x1f8782){logger['info']('The\x20Ticket\x20ID\x20is:',_0x1f8782['id']);}})['catch'](function(_0x4ef004){logger['error']('['+_0x164745[_0xd2e5('0x6d')][_0xd2e5('0x6c')]()+']'+_0xd2e5('0x6e'),util[_0xd2e5('0x5e')](_0x4ef004,{'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 6b30d4f..9eb88f2 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 _0x953e=['Inbound','merge','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/downloads?type=uniqueid&token=','uniqueid','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','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','unmanaged','monitor_format','toUpperCase','/api/voice/recordings/','lastevent','lodash','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','forEach','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','then','add','expires_in','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','startCase','moduleCreate','isNil','role','first_name','last_name','data','code','SUCCESS','details','enduserType','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','https://www.zohoapis.','Leads','nothing','contact','lead','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','called','Call_Result','Called','complete','connect','rejected','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x953e,0xc6));var _0xe953=function(_0xc4db8,_0x276ca4){_0xc4db8=_0xc4db8-0x0;var _0x1301ee=_0x953e[_0xc4db8];return _0x1301ee;};'use strict';var _=require(_0xe953('0x0'));var rp=require(_0xe953('0x1'));var md5=require(_0xe953('0x2'));var util=require(_0xe953('0x3'));var intUtil=require(_0xe953('0x4'));var moment=require('moment');var Redis=require(_0xe953('0x5'));var BPromise=require(_0xe953('0x6'));var config=require(_0xe953('0x7'));var logger=require(_0xe953('0x8'))(_0xe953('0x9'));config[_0xe953('0xa')]=_['defaults'](config[_0xe953('0xa')],{'host':_0xe953('0xb'),'port':0x18eb});var io=require(_0xe953('0xc'))(new Redis(config[_0xe953('0xa')]));function emit(_0x2c153e,_0x227dc0,_0x325cb4){io['to'](_0x2c153e)[_0xe953('0xd')](_0x227dc0,_0x325cb4);}function request(_0xddf879){logger[_0xe953('0xe')](_0xe953('0xf'),JSON['stringify'](_0xddf879));return rp(_0xddf879);}function getCustomFields(_0x59e83a,_0x3a099c){var _0x4e1898={};if(_0x59e83a['length']>0x0){_[_0xe953('0x10')](_0x59e83a,function(_0x19e36e){if(_['includes']([_0xe953('0x11'),_0xe953('0x12')],_0x19e36e[_0xe953('0x13')])&&_0x19e36e[_0xe953('0x14')]){_0x4e1898[_0x19e36e[_0xe953('0x14')]]=_0x19e36e[_0xe953('0x15')][_0xe953('0x16')]();}else if(_0x19e36e[_0xe953('0x13')]===_0xe953('0x17')&&_0x19e36e['variableName']&&_0x19e36e[_0xe953('0x14')]&&_0x3a099c[_0x19e36e[_0xe953('0x18')]]){_0x4e1898[_0x19e36e['idField']]=_0x3a099c[_0x19e36e[_0xe953('0x18')]][_0xe953('0x16')]();}else if(_0x19e36e[_0xe953('0x13')]===_0xe953('0x19')&&_0x19e36e['Variable']&&_0x19e36e[_0xe953('0x1a')][_0xe953('0x1b')]&&_0x19e36e[_0xe953('0x14')]&&_0x3a099c[_0x19e36e['Variable'][_0xe953('0x1b')][_0xe953('0x1c')]()]){_0x4e1898[_0x19e36e[_0xe953('0x14')]]=_0x3a099c[_0x19e36e['Variable']['name'][_0xe953('0x1c')]()][_0xe953('0x16')]();}});}return _0x4e1898;}function getName(_0x3e2469){if(_0x3e2469[_0xe953('0x1d')]('\x20')>0x0){var _0xd944e5=_0x3e2469[_0xe953('0x1e')](/ (.+)/);if(_0xd944e5[0x1]){return _0xd944e5;}}return[_0x3e2469,_0x3e2469];}var accountsTokens={};function getAccessToken(_0x31cadf){return new Promise(function(_0xbec0d7,_0x258cff){if(!_['isNil'](accountsTokens[_0x31cadf['id']])&&!_['isNil'](accountsTokens[_0x31cadf['id']][_0xe953('0x1f')])){if(moment()[_0xe953('0x20')](accountsTokens[_0x31cadf['id']]['expires_in'])){_0xbec0d7(accountsTokens[_0x31cadf['id']][_0xe953('0x1f')]);}}var _0x3808ef;switch(_0x31cadf[_0xe953('0x21')]){case'US':_0x3808ef=_0xe953('0x22');break;case'AU':_0x3808ef=_0xe953('0x23');break;case'EU':_0x3808ef=_0xe953('0x24');break;case'IN':_0x3808ef=_0xe953('0x25');break;case'CN':_0x3808ef=_0xe953('0x26');break;default:_0x3808ef=_0xe953('0x24');break;}var _0x24602e={'method':_0xe953('0x27'),'uri':_0x3808ef+_0xe953('0x28'),'qs':{'refresh_token':_0x31cadf[_0xe953('0x29')],'client_id':_0x31cadf[_0xe953('0x2a')],'client_secret':_0x31cadf['clientSecret'],'grant_type':_0xe953('0x2b')},'json':!![]};return rp(_0x24602e)[_0xe953('0x2c')](function(_0x24ec99){accountsTokens[_0x31cadf['id']]={'access_token':_0x24ec99['access_token'],'expires_in':moment()[_0xe953('0x2d')](_0x24ec99[_0xe953('0x2e')],'seconds')};_0xbec0d7(_0x24ec99['access_token']);})['catch'](function(_0x1e8fb4){logger[_0xe953('0x2f')](_0xe953('0x30'),_0x1e8fb4[_0xe953('0x31')]);_0x258cff(_0x1e8fb4);});});}function getUser(_0x516b33,_0x4b8ee5,_0x38d61f,_0x338de7){logger[_0xe953('0x32')](_0xe953('0x33'));return request({'method':_0xe953('0x34'),'uri':util[_0xe953('0x35')](_0xe953('0x36'),_0x4b8ee5),'qs':{'type':_0xe953('0x37')},'headers':{'Authorization':_0xe953('0x38')+_0x516b33},'json':!![]})[_0xe953('0x2c')](function(_0x458783){if(_0x458783[_0xe953('0x39')]){var _0x70c5e=-0x1;if(_[_0xe953('0x3a')](_0x458783[_0xe953('0x39')])){if(!_['isNil'](_0x338de7)){_0x70c5e=_[_0xe953('0x3b')](_0x458783[_0xe953('0x39')],function(_0x40ddc3){return _0x40ddc3[_0xe953('0x3c')]===_0x338de7;});}if(_0x70c5e>=0x0){logger['info'](_0xe953('0x3d'));}else{logger['info'](_0xe953('0x3e'));_0x70c5e=_[_0xe953('0x3b')](_0x458783[_0xe953('0x39')],function(_0x165a9c){return _0x165a9c[_0xe953('0x3f')][_0xe953('0x1b')]===_0xe953('0x40');});}return _0x458783[_0xe953('0x39')][_0x70c5e];}else{if(_0x458783['user'][_0xe953('0x3f')][_0xe953('0x1b')]===_0xe953('0x40')){logger[_0xe953('0x32')](_0xe953('0x3e'));user=_0x458783[_0xe953('0x41')];return user;}else{logger[_0xe953('0x2f')](_0xe953('0x42'),JSON[_0xe953('0x43')](_0x458783));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xe953('0x43')](_0x458783));}}}else{logger[_0xe953('0x2f')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x458783));throw new Error(_0xe953('0x44')+JSON[_0xe953('0x43')](_0x458783));}})[_0xe953('0x45')](function(_0x28547e){console['error'](_0x28547e);});}function getZohoUser(_0xaf2893,_0xc6db42){return new BPromise(function(_0x342bdf,_0x15bba5){request(_0xaf2893)[_0xe953('0x2c')](function(_0x332b54){var _0x570e91=null;if(_0x332b54){_0x570e91=_0x332b54['data'][0x0];_0x570e91['enduserType']=_0xc6db42;}_0x342bdf(_0x570e91);})[_0xe953('0x45')](function(_0x7b46d4){_0x15bba5(_0x7b46d4);});});}function createEndUser(_0x56dd25,_0x2c7e08,_0x13b69b,_0x59be17,_0x53e05b,_0x2db7c8){var _0x13b69b=getName(_0x13b69b);return request({'method':_0xe953('0x27'),'uri':'https://www.zohoapis.'+_0x2c7e08+'/crm/v2/'+_[_0xe953('0x46')](_0x2db7c8[_0xe953('0x47')])+'s','body':{'data':[{'Last_Name':_0x13b69b[0x1],'First_Name':_0x13b69b[0x0],'Phone':_0x59be17,'Owner':{'name':!_[_0xe953('0x48')](_0x53e05b[_0xe953('0x49')][_0xe953('0x1b')])?_0x53e05b[_0xe953('0x49')]['name']:!_[_0xe953('0x48')](_0x53e05b[_0xe953('0x4a')])?_0x53e05b['first_name']+'\x20'+_0x53e05b[_0xe953('0x4b')]:_0x53e05b[_0xe953('0x4b')],'id':_0x53e05b['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x56dd25},'json':!![]})[_0xe953('0x2c')](function(_0x1276f9){if(_0x1276f9&&_0x1276f9[_0xe953('0x4c')][0x0][_0xe953('0x4d')]===_0xe953('0x4e')){var _0x48c602=_0x1276f9[_0xe953('0x4c')][0x0][_0xe953('0x4f')];_0x48c602[_0xe953('0x50')]=_[_0xe953('0x46')](_0x2db7c8['moduleCreate'])+'s';return _0x48c602;}logger[_0xe953('0x2f')](_0xe953('0x42'),JSON[_0xe953('0x43')](data));throw new Error(_0xe953('0x51')+JSON[_0xe953('0x43')](data));})[_0xe953('0x45')](function(_0x107b4e){console[_0xe953('0x52')](_0xe953('0x53'),_0x107b4e);});}function getEndUser(_0x1b91eb,_0xd1182d,_0x2f57f0,_0x5e5caa,_0x432ea5,_0x5b6b38,_0x91838d){var _0x3b4a7b={'method':_0xe953('0x34'),'uri':'','headers':{'Authorization':_0xe953('0x38')+_0x1b91eb},'json':!![]};switch(_0x91838d[_0xe953('0x54')]){case _0xe953('0x55'):_0x3b4a7b[_0xe953('0x56')]='https://www.zohoapis.'+_0xd1182d+_0xe953('0x57')+_0x432ea5+'))';return getZohoUser(_0x3b4a7b,_0xe953('0x58'))[_0xe953('0x2c')](function(_0x5a44cf){if(_0x5a44cf)return _0x5a44cf;_0x3b4a7b[_0xe953('0x56')]=_0xe953('0x59')+_0xd1182d+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x432ea5+'))';return getZohoUser(_0x3b4a7b,_0xe953('0x5a'))[_0xe953('0x2c')](function(_0x49f883){if(_0x49f883)return _0x49f883;if(_0x91838d[_0xe953('0x47')]!=_0xe953('0x5b')){return createEndUser(_0x1b91eb,_0xd1182d,_0x5e5caa,_0x432ea5,_0x5b6b38,_0x91838d);}else{return{};}});});break;case _0xe953('0x5c'):_0x3b4a7b['uri']=_0xe953('0x59')+_0xd1182d+_0xe953('0x57')+_0x432ea5+'))';return getZohoUser(_0x3b4a7b,'Contacts')['then'](function(_0x54c889){if(_0x54c889)return _0x54c889;if(_0x91838d['moduleCreate']!=_0xe953('0x5b')){return createEndUser(_0x1b91eb,_0xd1182d,_0x5e5caa,_0x432ea5,_0x5b6b38,_0x91838d);}else{return{};}});break;case _0xe953('0x5d'):_0x3b4a7b[_0xe953('0x56')]=_0xe953('0x59')+_0xd1182d+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x432ea5+'))';return getZohoUser(_0x3b4a7b,_0xe953('0x5a'))[_0xe953('0x2c')](function(_0x158eea){if(_0x158eea)return _0x158eea;if(_0x91838d['moduleCreate']!='nothing'){return createEndUser(_0x1b91eb,_0xd1182d,_0x5e5caa,_0x432ea5,_0x5b6b38,_0x91838d);}else{return{};}});break;}}function getCall(_0x21da55,_0x58b4d0,_0x4da3fb,_0xd18bfc,_0x59dead,_0x134bbf,_0x256060,_0x4f3fcf){logger[_0xe953('0x32')]('Creating\x20new\x20call...');var _0x29fe03={};_0x29fe03['Owner']={'name':!_[_0xe953('0x48')](_0xd18bfc['role']['name'])&&!_[_0xe953('0x48')](_0xd18bfc[_0xe953('0x3f')]['name'])&&_0xd18bfc[_0xe953('0x3f')][_0xe953('0x1b')]===_0xe953('0x5e')?_0xd18bfc[_0xe953('0x49')][_0xe953('0x1b')]:!_[_0xe953('0x48')](_0xd18bfc[_0xe953('0x4a')])?_0xd18bfc[_0xe953('0x4a')]+'\x20'+_0xd18bfc[_0xe953('0x4b')]:_0xd18bfc[_0xe953('0x4b')],'id':_0xd18bfc['id']};_0x29fe03[_0xe953('0x5f')]=intUtil[_0xe953('0x60')](_0x134bbf[_0xe953('0x61')],_0x256060,'\x20');_0x29fe03[_0xe953('0x62')]=intUtil[_0xe953('0x60')](_0x134bbf[_0xe953('0x63')],_0x256060,'\x0a');if(_0x59dead[_0xe953('0x50')]===_0xe953('0x58')){_0x29fe03[_0xe953('0x64')]={'name':!_[_0xe953('0x48')](_0x59dead[_0xe953('0x65')])?_0x59dead['Full_Name']:!_[_0xe953('0x48')](_0x59dead[_0xe953('0x66')])?_0x59dead[_0xe953('0x66')]+'\x20'+_0x59dead[_0xe953('0x67')]:_0x59dead[_0xe953('0x67')],'id':_0x59dead['id']};}if(_0x59dead['enduserType']==='Leads'){_0x29fe03[_0xe953('0x68')]={'name':!_['isNil'](_0x59dead[_0xe953('0x65')])?_0x59dead[_0xe953('0x65')]:!_['isNil'](_0x59dead[_0xe953('0x66')])?_0x59dead['First_Name']+'\x20'+_0x59dead[_0xe953('0x67')]:_0x59dead[_0xe953('0x67')],'id':_0x59dead['id']};_0x29fe03[_0xe953('0x69')]=_['startCase'](_0x59dead[_0xe953('0x50')]);}if(_0x256060[_0xe953('0x6a')]){_0x29fe03[_0xe953('0x6b')]=moment[_0xe953('0x6c')](parseInt(_0x256060[_0xe953('0x6a')])*0x3e8)[_0xe953('0x35')](_0xe953('0x6d'));}else if(_0x256060[_0xe953('0x6e')]&&_0x256060[_0xe953('0x6f')]){_0x29fe03[_0xe953('0x6b')]=moment[_0xe953('0x6c')](moment(_0x256060[_0xe953('0x6f')],'YYYY-MM-DDTHH:mm:ss')[_0xe953('0x70')](moment(_0x256060[_0xe953('0x71')],_0xe953('0x72'))))[_0xe953('0x35')](_0xe953('0x6d'));}switch(_0x256060['lastevent']){case _0xe953('0x73'):_0x29fe03[_0xe953('0x74')]=_0xe953('0x75');break;case _0xe953('0x76'):case _0xe953('0x77'):_0x29fe03['Call_Result']='Answered';break;case _0xe953('0x78'):_0x29fe03[_0xe953('0x74')]=_0xe953('0x79');break;case _0xe953('0x7a'):_0x29fe03[_0xe953('0x74')]=_0xe953('0x7b');break;case _0xe953('0x7c'):_0x29fe03[_0xe953('0x74')]='Timeout';default:}_0x29fe03[_0xe953('0x7d')]=(_0x4f3fcf===_0xe953('0x7e')?moment(_0x256060[_0xe953('0x71')])[_0xe953('0x35')](_0xe953('0x72')):moment(_0x256060[_0xe953('0x7f')])['format'](_0xe953('0x72')))||moment()[_0xe953('0x35')]('YYYY-MM-DDTHH:mm:ss');_0x29fe03['Call_Type']=_0x4f3fcf||_0xe953('0x80');_0x29fe03=_[_0xe953('0x81')](_0x29fe03,getCustomFields(_0x134bbf['Fields'],_0x256060));return request({'method':_0xe953('0x27'),'uri':_0xe953('0x59')+_0x58b4d0+_0xe953('0x82'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x21da55},'body':{'data':[_0x29fe03]},'json':!![]})[_0xe953('0x2c')](function(_0xf8281e){if(_0xf8281e&&_0xf8281e[_0xe953('0x4c')][0x0][_0xe953('0x4d')]==='SUCCESS'){logger['info'](_0xe953('0x83'));return{'id':_0xf8281e[_0xe953('0x4c')][0x0]['details']['id']};}})[_0xe953('0x45')](function(_0x5b3e5f){logger[_0xe953('0x32')](_0xe953('0x84'),_0x5b3e5f[_0xe953('0x31')]);console[_0xe953('0x52')](_0xe953('0x84'),_0x5b3e5f);});}exports[_0xe953('0x85')]=function(_0x55e128,_0x1f152c,_0x5e9fe9,_0x3727eb,_0x2b4226,_0xbdcc3){var _0x1b4eef,_0x112312,_0x114119;_0xbdcc3[_0xe953('0x86')]=intUtil[_0xe953('0x87')](_0xbdcc3[_0xe953('0x86')]);_0xbdcc3[_0xe953('0x88')]=intUtil[_0xe953('0x87')](_0xbdcc3[_0xe953('0x88')]);if(_0x2b4226&&_0x2b4226['monitor_format']){logger[_0xe953('0x32')](_0xe953('0x89'),_0xe953('0x8a'));_0x1f152c[_0xe953('0x8b')]=_0xbdcc3[_0xe953('0x88')]+'/api/voice/recordings/'+_0x1f152c['uniqueid']+_0xe953('0x8c')+md5(_0x1f152c[_0xe953('0x8d')]);}else{_0x1f152c[_0xe953('0x8b')]='';}var _0x4d4300=_0xbdcc3[_0xe953('0x86')]===_0xe953('0x8e')?'eu':_0xe953('0x8f');return getAccessToken(_0xbdcc3)['then'](function(_0x1beca0){_0x114119=_0x1beca0;return getUser(_0x114119,_0x4d4300,_0xbdcc3,_0x3727eb[_0xe953('0x3c')]);})[_0xe953('0x2c')](function(_0x5bbfaa){_0x1b4eef=_0x5bbfaa;logger[_0xe953('0x32')](_0xe953('0x90'),_0x1b4eef['id']);return getEndUser(_0x114119,_0x4d4300,_0xbdcc3,_0x1f152c[_0xe953('0x91')],_0x1f152c[_0xe953('0x92')],_0x1b4eef,_0x5e9fe9);})[_0xe953('0x2c')](function(_0x56b9c8){_0x112312=_0x56b9c8;return getCall(_0x114119,_0x4d4300,_0xbdcc3,_0x1b4eef,_0x112312,_0x5e9fe9,_0x1f152c,_0xe953('0x80'));})[_0xe953('0x2c')](function(_0x282bb3){if(_0x282bb3){logger[_0xe953('0x32')]('The\x20Call\x20ID\x20is:',_0x282bb3['id']);logger[_0xe953('0x32')](_0xe953('0x89'),_0xe953('0x93'));emit(util[_0xe953('0x35')](_0xe953('0x94'),_0x3727eb[_0xe953('0x1b')]),_0xe953('0x95'),{'uri':_0xe953('0x96')+_0xbdcc3[_0xe953('0x86')]+_0xe953('0x97')+_0x282bb3['id']});}})[_0xe953('0x45')](function(_0x4c4f3f){logger[_0xe953('0x2f')]('[QUEUE]',JSON['stringify'](_0x4c4f3f));});};exports[_0xe953('0x7e')]=function(_0x1fc63b,_0x44a063,_0x4273a7,_0x285025,_0x5b7e49,_0x199e10,_0x29ae76){var _0x1348fd,_0x384fc7,_0x54ce0f;_0x199e10[_0xe953('0x86')]=intUtil[_0xe953('0x87')](_0x199e10[_0xe953('0x86')]);_0x199e10['serverUrl']=intUtil[_0xe953('0x87')](_0x199e10[_0xe953('0x88')]);if(_0x29ae76&&_0x29ae76[_0xe953('0x98')]&&_0x29ae76[_0xe953('0x98')]!==_0xe953('0x99')){logger[_0xe953('0x32')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x44a063[_0xe953('0x8b')]=_0x199e10[_0xe953('0x88')]+'/api/voice/recordings/'+_0x44a063[_0xe953('0x8d')]+_0xe953('0x8c')+md5(_0x44a063[_0xe953('0x8d')]);}var _0x3b1cba=_0x199e10[_0xe953('0x86')]===_0xe953('0x8e')?'eu':_0xe953('0x8f');return getAccessToken(_0x199e10)[_0xe953('0x2c')](function(_0x1b593a){_0x54ce0f=_0x1b593a;return getUser(_0x54ce0f,_0x3b1cba,_0x199e10,_0x285025[_0xe953('0x3c')]);})[_0xe953('0x2c')](function(_0x775bda){_0x1348fd=_0x775bda;logger[_0xe953('0x32')](_0xe953('0x90'),_0x1348fd['id']);return getEndUser(_0x54ce0f,_0x3b1cba,_0x199e10,_0x44a063[_0xe953('0x9a')],_0x44a063[_0xe953('0x9b')],_0x1348fd,_0x4273a7);})[_0xe953('0x2c')](function(_0x23ee04){_0x384fc7=_0x23ee04;return getCall(_0x54ce0f,_0x3b1cba,_0x199e10,_0x1348fd,_0x384fc7,_0x4273a7,_0x44a063,_0xe953('0x9c'));})[_0xe953('0x2c')](function(_0x2f0a44){if(_0x2f0a44){logger['info']('The\x20Call\x20ID\x20is:',_0x2f0a44['id']);logger['info']('[OUTBOUND]',_0xe953('0x93'));emit(util[_0xe953('0x35')]('user:%s',_0x285025['name']),'trigger:browser:url',{'uri':_0xe953('0x96')+_0x199e10['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x2f0a44['id']});}})['catch'](function(_0x152082){logger['error'](_0xe953('0x9d'),JSON[_0xe953('0x43')](_0x152082));});};exports[_0xe953('0x9e')]=function(_0xc158fc,_0x5f0dac,_0x5f5aa9,_0x3e2995,_0x496dc6,_0x89130f){var _0x5351ad,_0xf8cdee,_0x224cc9;_0x89130f['host']=intUtil['stripTrailingSlash'](_0x89130f['host']);_0x89130f[_0xe953('0x88')]=intUtil[_0xe953('0x87')](_0x89130f['serverUrl']);if(_0x496dc6&&_0x496dc6[_0xe953('0x9f')]){logger[_0xe953('0x32')]('['+_0x5f0dac['lastevent'][_0xe953('0xa0')]()+']',_0xe953('0x8a'));_0x5f0dac['recordingURL']=_0x89130f[_0xe953('0x88')]+_0xe953('0xa1')+_0x5f0dac['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x5f0dac['uniqueid']);}else{_0x5f0dac[_0xe953('0x8b')]='';}var _0x23f9d4=_0x89130f['host']===_0xe953('0x8e')?'eu':_0xe953('0x8f');return getAccessToken(_0x89130f)[_0xe953('0x2c')](function(_0x98945e){_0x224cc9=_0x98945e;return getUser(_0x224cc9,_0x23f9d4,_0x89130f);})[_0xe953('0x2c')](function(_0x33f2d6){_0x5351ad=_0x33f2d6;logger[_0xe953('0x32')](_0xe953('0x90'),_0x5351ad['id']);return getEndUser(_0x224cc9,_0x23f9d4,_0x89130f,_0x5f0dac[_0xe953('0x91')],_0x5f0dac['calleridnum'],_0x5351ad,_0x5f5aa9);})['then'](function(_0x348177){_0xf8cdee=_0x348177;return getCall(_0x224cc9,_0x23f9d4,_0x89130f,_0x5351ad,_0xf8cdee,_0x5f5aa9,_0x5f0dac,_0xe953('0x80'));})['then'](function(_0x33178e){if(_0x33178e){logger[_0xe953('0x32')]('The\x20Call\x20ID\x20is:',_0x33178e['id']);}})[_0xe953('0x45')](function(_0x23647a){logger[_0xe953('0x2f')]('['+_0x5f0dac[_0xe953('0xa2')][_0xe953('0xa0')]()+']',JSON[_0xe953('0x43')](_0x23647a));});}; \ No newline at end of file +var _0xb6f6=['ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','/crm/v2/','moduleCreate','role','first_name','last_name','code','SUCCESS','details','startCase','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','What_Id','Last_Name','talktime','Call_Duration','utc','format','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','timeout','outbound','starttime','agentcalledAt','Call_Type','Fields','Call\x20created!','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','zoho.eu','destcalleridname','destcalleridnum','Outbound','unmanaged','toUpperCase','lodash','request-promise','md5','util','moment','ioredis','../../../../config/environment','redis','localhost','socket.io-emitter','[HTTP]','stringify','length','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','then','seconds','error','Failing\x20creating\x20the\x20access_token','info','GET','https://www.zohoapis.%s/crm/v2/users'];(function(_0x4095b9,_0x17ac01){var _0x3f6909=function(_0x3c3189){while(--_0x3c3189){_0x4095b9['push'](_0x4095b9['shift']());}};_0x3f6909(++_0x17ac01);}(_0xb6f6,0x18e));var _0x6b6f=function(_0x165801,_0x3ddf07){_0x165801=_0x165801-0x0;var _0x56e815=_0xb6f6[_0x165801];return _0x56e815;};'use strict';var _=require(_0x6b6f('0x0'));var rp=require(_0x6b6f('0x1'));var md5=require(_0x6b6f('0x2'));var util=require(_0x6b6f('0x3'));var intUtil=require('./util');var moment=require(_0x6b6f('0x4'));var Redis=require(_0x6b6f('0x5'));var BPromise=require('bluebird');var config=require(_0x6b6f('0x6'));var logger=require('../../../../config/logger')('zoho');config[_0x6b6f('0x7')]=_['defaults'](config['redis'],{'host':_0x6b6f('0x8'),'port':0x18eb});var io=require(_0x6b6f('0x9'))(new Redis(config['redis']));function emit(_0x1c09b,_0x3c3437,_0x33f18e){io['to'](_0x1c09b)['emit'](_0x3c3437,_0x33f18e);}function request(_0x291278){logger['debug'](_0x6b6f('0xa'),JSON[_0x6b6f('0xb')](_0x291278));return rp(_0x291278);}function getCustomFields(_0x4c4373,_0x42c08c){var _0xdbf652={};if(_0x4c4373[_0x6b6f('0xc')]>0x0){_['forEach'](_0x4c4373,function(_0x4fd7df){if(_['includes']([_0x6b6f('0xd'),'picklist'],_0x4fd7df['type'])&&_0x4fd7df[_0x6b6f('0xe')]){_0xdbf652[_0x4fd7df[_0x6b6f('0xe')]]=_0x4fd7df[_0x6b6f('0xf')][_0x6b6f('0x10')]();}else if(_0x4fd7df[_0x6b6f('0x11')]===_0x6b6f('0x12')&&_0x4fd7df[_0x6b6f('0x13')]&&_0x4fd7df['idField']&&_0x42c08c[_0x4fd7df[_0x6b6f('0x13')]]){_0xdbf652[_0x4fd7df[_0x6b6f('0xe')]]=_0x42c08c[_0x4fd7df[_0x6b6f('0x13')]][_0x6b6f('0x10')]();}else if(_0x4fd7df[_0x6b6f('0x11')]==='customVariable'&&_0x4fd7df[_0x6b6f('0x14')]&&_0x4fd7df[_0x6b6f('0x14')][_0x6b6f('0x15')]&&_0x4fd7df['idField']&&_0x42c08c[_0x4fd7df[_0x6b6f('0x14')][_0x6b6f('0x15')]['toLowerCase']()]){_0xdbf652[_0x4fd7df['idField']]=_0x42c08c[_0x4fd7df[_0x6b6f('0x14')][_0x6b6f('0x15')][_0x6b6f('0x16')]()][_0x6b6f('0x10')]();}});}return _0xdbf652;}function getName(_0x3caeff){if(_0x3caeff['indexOf']('\x20')>0x0){var _0x33e471=_0x3caeff[_0x6b6f('0x17')](/ (.+)/);if(_0x33e471[0x1]){return _0x33e471;}}return[_0x3caeff,_0x3caeff];}var accountsTokens={};function getAccessToken(_0x4efb3c){return new Promise(function(_0x4d6420,_0x4c920e){if(!_[_0x6b6f('0x18')](accountsTokens[_0x4efb3c['id']])&&!_[_0x6b6f('0x18')](accountsTokens[_0x4efb3c['id']][_0x6b6f('0x19')])){if(moment()['isBefore'](accountsTokens[_0x4efb3c['id']][_0x6b6f('0x1a')])){_0x4d6420(accountsTokens[_0x4efb3c['id']]['access_token']);}}var _0x35b7ea;switch(_0x4efb3c[_0x6b6f('0x1b')]){case'US':_0x35b7ea='https://accounts.zoho.com';break;case'AU':_0x35b7ea=_0x6b6f('0x1c');break;case'EU':_0x35b7ea=_0x6b6f('0x1d');break;case'IN':_0x35b7ea=_0x6b6f('0x1e');break;case'CN':_0x35b7ea=_0x6b6f('0x1f');break;default:_0x35b7ea=_0x6b6f('0x1d');break;}var _0x4f043b={'method':_0x6b6f('0x20'),'uri':_0x35b7ea+_0x6b6f('0x21'),'qs':{'refresh_token':_0x4efb3c['refreshToken'],'client_id':_0x4efb3c[_0x6b6f('0x22')],'client_secret':_0x4efb3c[_0x6b6f('0x23')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x4f043b)[_0x6b6f('0x24')](function(_0x3925dc){accountsTokens[_0x4efb3c['id']]={'access_token':_0x3925dc[_0x6b6f('0x19')],'expires_in':moment()['add'](_0x3925dc[_0x6b6f('0x1a')],_0x6b6f('0x25'))};_0x4d6420(_0x3925dc[_0x6b6f('0x19')]);})['catch'](function(_0x608998){logger[_0x6b6f('0x26')](_0x6b6f('0x27'),_0x608998['stack']);_0x4c920e(_0x608998);});});}function getUser(_0x4bb08a,_0xb78ceb,_0x48d1ef,_0x5e0f80){logger[_0x6b6f('0x28')]('Search\x20user');return request({'method':_0x6b6f('0x29'),'uri':util['format'](_0x6b6f('0x2a'),_0xb78ceb),'qs':{'type':_0x6b6f('0x2b')},'headers':{'Authorization':_0x6b6f('0x2c')+_0x4bb08a},'json':!![]})['then'](function(_0x90b1df){if(_0x90b1df[_0x6b6f('0x2d')]){var _0x26d8c8=-0x1;if(_[_0x6b6f('0x2e')](_0x90b1df[_0x6b6f('0x2d')])){if(!_[_0x6b6f('0x18')](_0x5e0f80)){_0x26d8c8=_['findIndex'](_0x90b1df[_0x6b6f('0x2d')],function(_0x70e75f){return _0x70e75f[_0x6b6f('0x2f')]===_0x5e0f80;});}if(_0x26d8c8>=0x0){logger[_0x6b6f('0x28')](_0x6b6f('0x30'));}else{logger['info'](_0x6b6f('0x31'));_0x26d8c8=_['findIndex'](_0x90b1df[_0x6b6f('0x2d')],function(_0x581556){return _0x581556[_0x6b6f('0x32')]['name']===_0x6b6f('0x33');});}return _0x90b1df['users'][_0x26d8c8];}else{if(_0x90b1df[_0x6b6f('0x34')][_0x6b6f('0x32')][_0x6b6f('0x15')]===_0x6b6f('0x33')){logger[_0x6b6f('0x28')](_0x6b6f('0x31'));user=_0x90b1df['user'];return user;}else{logger['error'](_0x6b6f('0x35'),JSON[_0x6b6f('0xb')](_0x90b1df));throw new Error(_0x6b6f('0x36')+JSON[_0x6b6f('0xb')](_0x90b1df));}}}else{logger[_0x6b6f('0x26')](_0x6b6f('0x35'),JSON[_0x6b6f('0xb')](_0x90b1df));throw new Error(_0x6b6f('0x36')+JSON[_0x6b6f('0xb')](_0x90b1df));}})[_0x6b6f('0x37')](function(_0x1c2b0e){console[_0x6b6f('0x26')](_0x1c2b0e);});}function getZohoUser(_0x2e32c0,_0x405a35){return new BPromise(function(_0x36c542,_0x3d73a1){request(_0x2e32c0)[_0x6b6f('0x24')](function(_0x346139){var _0x26149f=null;if(_0x346139){_0x26149f=_0x346139[_0x6b6f('0x38')][0x0];_0x26149f[_0x6b6f('0x39')]=_0x405a35;}_0x36c542(_0x26149f);})[_0x6b6f('0x37')](function(_0x28dc64){_0x3d73a1(_0x28dc64);});});}function createEndUser(_0x4a7395,_0x57e28d,_0x3aa892,_0x42b645,_0xbc8240,_0x2d722b){var _0x3aa892=getName(_0x3aa892);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x57e28d+_0x6b6f('0x3a')+_['startCase'](_0x2d722b[_0x6b6f('0x3b')])+'s','body':{'data':[{'Last_Name':_0x3aa892[0x1],'First_Name':_0x3aa892[0x0],'Phone':_0x42b645,'Owner':{'name':!_[_0x6b6f('0x18')](_0xbc8240[_0x6b6f('0x3c')]['name'])?_0xbc8240[_0x6b6f('0x3c')][_0x6b6f('0x15')]:!_[_0x6b6f('0x18')](_0xbc8240[_0x6b6f('0x3d')])?_0xbc8240[_0x6b6f('0x3d')]+'\x20'+_0xbc8240[_0x6b6f('0x3e')]:_0xbc8240[_0x6b6f('0x3e')],'id':_0xbc8240['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4a7395},'json':!![]})[_0x6b6f('0x24')](function(_0x4e65e0){if(_0x4e65e0&&_0x4e65e0['data'][0x0][_0x6b6f('0x3f')]===_0x6b6f('0x40')){var _0x10e4ee=_0x4e65e0[_0x6b6f('0x38')][0x0][_0x6b6f('0x41')];_0x10e4ee['enduserType']=_[_0x6b6f('0x42')](_0x2d722b[_0x6b6f('0x3b')])+'s';return _0x10e4ee;}logger[_0x6b6f('0x26')](_0x6b6f('0x35'),JSON[_0x6b6f('0xb')](data));throw new Error(_0x6b6f('0x43')+JSON[_0x6b6f('0xb')](data));})[_0x6b6f('0x37')](function(_0x1de670){console[_0x6b6f('0x44')](_0x6b6f('0x45'),_0x1de670);});}function getEndUser(_0x4d94de,_0x4333e6,_0x2876b0,_0x54352c,_0x519c01,_0x597eab,_0x2f052d){var _0x259edd={'method':_0x6b6f('0x29'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4d94de},'json':!![]};switch(_0x2f052d[_0x6b6f('0x46')]){case _0x6b6f('0x47'):_0x259edd[_0x6b6f('0x48')]=_0x6b6f('0x49')+_0x4333e6+_0x6b6f('0x4a')+_0x519c01+'))';return getZohoUser(_0x259edd,_0x6b6f('0x4b'))['then'](function(_0x4add7f){if(_0x4add7f)return _0x4add7f;_0x259edd[_0x6b6f('0x48')]=_0x6b6f('0x49')+_0x4333e6+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x519c01+'))';return getZohoUser(_0x259edd,_0x6b6f('0x4c'))[_0x6b6f('0x24')](function(_0x15c6ea){if(_0x15c6ea)return _0x15c6ea;if(_0x2f052d['moduleCreate']!=_0x6b6f('0x4d')){return createEndUser(_0x4d94de,_0x4333e6,_0x54352c,_0x519c01,_0x597eab,_0x2f052d);}else{return{};}});});break;case _0x6b6f('0x4e'):_0x259edd['uri']=_0x6b6f('0x49')+_0x4333e6+_0x6b6f('0x4a')+_0x519c01+'))';return getZohoUser(_0x259edd,_0x6b6f('0x4b'))['then'](function(_0x10a298){if(_0x10a298)return _0x10a298;if(_0x2f052d[_0x6b6f('0x3b')]!=_0x6b6f('0x4d')){return createEndUser(_0x4d94de,_0x4333e6,_0x54352c,_0x519c01,_0x597eab,_0x2f052d);}else{return{};}});break;case _0x6b6f('0x4f'):_0x259edd['uri']=_0x6b6f('0x49')+_0x4333e6+_0x6b6f('0x50')+_0x519c01+'))';return getZohoUser(_0x259edd,_0x6b6f('0x4c'))[_0x6b6f('0x24')](function(_0x468ad9){if(_0x468ad9)return _0x468ad9;if(_0x2f052d[_0x6b6f('0x3b')]!=_0x6b6f('0x4d')){return createEndUser(_0x4d94de,_0x4333e6,_0x54352c,_0x519c01,_0x597eab,_0x2f052d);}else{return{};}});break;}}function getCall(_0x800f3b,_0x573cd1,_0x26e2bc,_0x202418,_0x2d8435,_0x5c239c,_0x230977,_0x312440){logger[_0x6b6f('0x28')](_0x6b6f('0x51'));var _0x1589ee={};_0x1589ee['Owner']={'name':!_[_0x6b6f('0x18')](_0x202418['role']['name'])&&!_['isNil'](_0x202418['profile'][_0x6b6f('0x15')])&&_0x202418[_0x6b6f('0x32')][_0x6b6f('0x15')]==='administrator'?_0x202418[_0x6b6f('0x3c')][_0x6b6f('0x15')]:!_[_0x6b6f('0x18')](_0x202418[_0x6b6f('0x3d')])?_0x202418[_0x6b6f('0x3d')]+'\x20'+_0x202418[_0x6b6f('0x3e')]:_0x202418[_0x6b6f('0x3e')],'id':_0x202418['id']};_0x1589ee[_0x6b6f('0x52')]=intUtil[_0x6b6f('0x53')](_0x5c239c[_0x6b6f('0x54')],_0x230977,'\x20');_0x1589ee['Description']=intUtil[_0x6b6f('0x53')](_0x5c239c[_0x6b6f('0x55')],_0x230977,'\x0a');if(_0x2d8435[_0x6b6f('0x39')]==='Contacts'){_0x1589ee[_0x6b6f('0x56')]={'name':!_[_0x6b6f('0x18')](_0x2d8435[_0x6b6f('0x57')])?_0x2d8435[_0x6b6f('0x57')]:!_['isNil'](_0x2d8435[_0x6b6f('0x58')])?_0x2d8435[_0x6b6f('0x58')]+'\x20'+_0x2d8435['Last_Name']:_0x2d8435['Last_Name'],'id':_0x2d8435['id']};}if(_0x2d8435[_0x6b6f('0x39')]==='Leads'){_0x1589ee[_0x6b6f('0x59')]={'name':!_[_0x6b6f('0x18')](_0x2d8435[_0x6b6f('0x57')])?_0x2d8435[_0x6b6f('0x57')]:!_[_0x6b6f('0x18')](_0x2d8435['First_Name'])?_0x2d8435[_0x6b6f('0x58')]+'\x20'+_0x2d8435[_0x6b6f('0x5a')]:_0x2d8435[_0x6b6f('0x5a')],'id':_0x2d8435['id']};_0x1589ee['$se_module']=_[_0x6b6f('0x42')](_0x2d8435[_0x6b6f('0x39')]);}if(_0x230977[_0x6b6f('0x5b')]){_0x1589ee[_0x6b6f('0x5c')]=moment[_0x6b6f('0x5d')](parseInt(_0x230977[_0x6b6f('0x5b')])*0x3e8)[_0x6b6f('0x5e')](_0x6b6f('0x5f'));}else if(_0x230977['answertime']&&_0x230977['endtime']){_0x1589ee['Call_Duration']=moment[_0x6b6f('0x5d')](moment(_0x230977[_0x6b6f('0x60')],_0x6b6f('0x61'))['diff'](moment(_0x230977['starttime'],_0x6b6f('0x61'))))['format'](_0x6b6f('0x5f'));}switch(_0x230977[_0x6b6f('0x62')]){case _0x6b6f('0x63'):_0x1589ee[_0x6b6f('0x64')]=_0x6b6f('0x65');break;case _0x6b6f('0x66'):case _0x6b6f('0x67'):_0x1589ee['Call_Result']=_0x6b6f('0x68');break;case _0x6b6f('0x69'):_0x1589ee['Call_Result']=_0x6b6f('0x6a');break;case _0x6b6f('0x6b'):_0x1589ee[_0x6b6f('0x64')]='Abandoned';break;case _0x6b6f('0x6c'):_0x1589ee[_0x6b6f('0x64')]='Timeout';default:}_0x1589ee['Call_Start_Time']=(_0x312440===_0x6b6f('0x6d')?moment(_0x230977[_0x6b6f('0x6e')])[_0x6b6f('0x5e')](_0x6b6f('0x61')):moment(_0x230977[_0x6b6f('0x6f')])[_0x6b6f('0x5e')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0x6b6f('0x61'));_0x1589ee[_0x6b6f('0x70')]=_0x312440||'Inbound';_0x1589ee=_['merge'](_0x1589ee,getCustomFields(_0x5c239c[_0x6b6f('0x71')],_0x230977));return request({'method':'POST','uri':_0x6b6f('0x49')+_0x573cd1+'/crm/v2/Calls','headers':{'Authorization':_0x6b6f('0x2c')+_0x800f3b},'body':{'data':[_0x1589ee]},'json':!![]})[_0x6b6f('0x24')](function(_0x44a121){if(_0x44a121&&_0x44a121[_0x6b6f('0x38')][0x0][_0x6b6f('0x3f')]===_0x6b6f('0x40')){logger['info'](_0x6b6f('0x72'));return{'id':_0x44a121['data'][0x0]['details']['id']};}})['catch'](function(_0x5055f0){logger[_0x6b6f('0x28')](_0x6b6f('0x73'),_0x5055f0[_0x6b6f('0x74')]);console['log'](_0x6b6f('0x73'),_0x5055f0);});}exports[_0x6b6f('0x75')]=function(_0x5ac332,_0x359b9f,_0x595482,_0x3a4add,_0x567397,_0x43ab4a){var _0x2ef067,_0x56b69b,_0x24d5fd;_0x43ab4a[_0x6b6f('0x76')]=intUtil[_0x6b6f('0x77')](_0x43ab4a[_0x6b6f('0x76')]);_0x43ab4a[_0x6b6f('0x78')]=intUtil[_0x6b6f('0x77')](_0x43ab4a[_0x6b6f('0x78')]);if(_0x567397&&_0x567397[_0x6b6f('0x79')]){logger[_0x6b6f('0x28')](_0x6b6f('0x7a'),_0x6b6f('0x7b'));_0x359b9f['recordingURL']=_0x43ab4a[_0x6b6f('0x78')]+_0x6b6f('0x7c')+_0x359b9f[_0x6b6f('0x7d')]+_0x6b6f('0x7e')+md5(_0x359b9f[_0x6b6f('0x7d')]);}else{_0x359b9f[_0x6b6f('0x7f')]='';}var _0x1b0bf1=_0x43ab4a['host']==='zoho.eu'?'eu':_0x6b6f('0x80');return getAccessToken(_0x43ab4a)['then'](function(_0x54806b){_0x24d5fd=_0x54806b;return getUser(_0x24d5fd,_0x1b0bf1,_0x43ab4a,_0x3a4add[_0x6b6f('0x2f')]);})[_0x6b6f('0x24')](function(_0x2c7d93){_0x2ef067=_0x2c7d93;logger[_0x6b6f('0x28')](_0x6b6f('0x81'),_0x2ef067['id']);return getEndUser(_0x24d5fd,_0x1b0bf1,_0x43ab4a,_0x359b9f[_0x6b6f('0x82')],_0x359b9f[_0x6b6f('0x83')],_0x2ef067,_0x595482);})['then'](function(_0x235519){_0x56b69b=_0x235519;return getCall(_0x24d5fd,_0x1b0bf1,_0x43ab4a,_0x2ef067,_0x56b69b,_0x595482,_0x359b9f,_0x6b6f('0x84'));})['then'](function(_0x30e7c5){if(_0x30e7c5){logger['info'](_0x6b6f('0x85'),_0x30e7c5['id']);logger[_0x6b6f('0x28')](_0x6b6f('0x7a'),_0x6b6f('0x86'));emit(util[_0x6b6f('0x5e')](_0x6b6f('0x87'),_0x3a4add[_0x6b6f('0x15')]),_0x6b6f('0x88'),{'uri':_0x6b6f('0x89')+_0x43ab4a[_0x6b6f('0x76')]+_0x6b6f('0x8a')+_0x30e7c5['id']});}})['catch'](function(_0x1684fc){logger[_0x6b6f('0x26')](_0x6b6f('0x7a'),JSON[_0x6b6f('0xb')](_0x1684fc));});};exports[_0x6b6f('0x6d')]=function(_0xb0f98c,_0x5b82cc,_0x44bbf3,_0x45f647,_0x20f3e9,_0x41b3d4,_0x35b7c5){var _0x242691,_0x3ed6d7,_0x4fde4d;_0x41b3d4[_0x6b6f('0x76')]=intUtil[_0x6b6f('0x77')](_0x41b3d4[_0x6b6f('0x76')]);_0x41b3d4[_0x6b6f('0x78')]=intUtil[_0x6b6f('0x77')](_0x41b3d4[_0x6b6f('0x78')]);if(_0x35b7c5&&_0x35b7c5[_0x6b6f('0x8b')]&&_0x35b7c5['recordingFormat']!=='none'){logger[_0x6b6f('0x28')](_0x6b6f('0x8c'),_0x6b6f('0x7b'));_0x5b82cc['recordingURL']=_0x41b3d4[_0x6b6f('0x78')]+_0x6b6f('0x7c')+_0x5b82cc['uniqueid']+_0x6b6f('0x7e')+md5(_0x5b82cc[_0x6b6f('0x7d')]);}var _0x444f64=_0x41b3d4[_0x6b6f('0x76')]===_0x6b6f('0x8d')?'eu':_0x6b6f('0x80');return getAccessToken(_0x41b3d4)['then'](function(_0x4a32b7){_0x4fde4d=_0x4a32b7;return getUser(_0x4fde4d,_0x444f64,_0x41b3d4,_0x45f647[_0x6b6f('0x2f')]);})[_0x6b6f('0x24')](function(_0x5c6d9c){_0x242691=_0x5c6d9c;logger[_0x6b6f('0x28')](_0x6b6f('0x81'),_0x242691['id']);return getEndUser(_0x4fde4d,_0x444f64,_0x41b3d4,_0x5b82cc[_0x6b6f('0x8e')],_0x5b82cc[_0x6b6f('0x8f')],_0x242691,_0x44bbf3);})[_0x6b6f('0x24')](function(_0x230df2){_0x3ed6d7=_0x230df2;return getCall(_0x4fde4d,_0x444f64,_0x41b3d4,_0x242691,_0x3ed6d7,_0x44bbf3,_0x5b82cc,_0x6b6f('0x90'));})[_0x6b6f('0x24')](function(_0x14b328){if(_0x14b328){logger['info'](_0x6b6f('0x85'),_0x14b328['id']);logger[_0x6b6f('0x28')](_0x6b6f('0x8c'),_0x6b6f('0x86'));emit(util[_0x6b6f('0x5e')](_0x6b6f('0x87'),_0x45f647[_0x6b6f('0x15')]),'trigger:browser:url',{'uri':_0x6b6f('0x89')+_0x41b3d4[_0x6b6f('0x76')]+_0x6b6f('0x8a')+_0x14b328['id']});}})[_0x6b6f('0x37')](function(_0x376c10){logger[_0x6b6f('0x26')]('[OUTBOUND]',JSON[_0x6b6f('0xb')](_0x376c10));});};exports[_0x6b6f('0x91')]=function(_0x46310c,_0x4def24,_0x41b12e,_0x1ae802,_0x3b58df,_0x328433){var _0x20335c,_0x596cb8,_0x4f3ef4;_0x328433[_0x6b6f('0x76')]=intUtil[_0x6b6f('0x77')](_0x328433[_0x6b6f('0x76')]);_0x328433[_0x6b6f('0x78')]=intUtil[_0x6b6f('0x77')](_0x328433[_0x6b6f('0x78')]);if(_0x3b58df&&_0x3b58df['monitor_format']){logger[_0x6b6f('0x28')]('['+_0x4def24[_0x6b6f('0x62')][_0x6b6f('0x92')]()+']',_0x6b6f('0x7b'));_0x4def24[_0x6b6f('0x7f')]=_0x328433[_0x6b6f('0x78')]+_0x6b6f('0x7c')+_0x4def24[_0x6b6f('0x7d')]+_0x6b6f('0x7e')+md5(_0x4def24[_0x6b6f('0x7d')]);}else{_0x4def24[_0x6b6f('0x7f')]='';}var _0x51c41d=_0x328433[_0x6b6f('0x76')]===_0x6b6f('0x8d')?'eu':_0x6b6f('0x80');return getAccessToken(_0x328433)[_0x6b6f('0x24')](function(_0x55b4a5){_0x4f3ef4=_0x55b4a5;return getUser(_0x4f3ef4,_0x51c41d,_0x328433);})[_0x6b6f('0x24')](function(_0x63df82){_0x20335c=_0x63df82;logger['info'](_0x6b6f('0x81'),_0x20335c['id']);return getEndUser(_0x4f3ef4,_0x51c41d,_0x328433,_0x4def24[_0x6b6f('0x82')],_0x4def24[_0x6b6f('0x83')],_0x20335c,_0x41b12e);})['then'](function(_0x2a4935){_0x596cb8=_0x2a4935;return getCall(_0x4f3ef4,_0x51c41d,_0x328433,_0x20335c,_0x596cb8,_0x41b12e,_0x4def24,_0x6b6f('0x84'));})['then'](function(_0x16d966){if(_0x16d966){logger[_0x6b6f('0x28')](_0x6b6f('0x85'),_0x16d966['id']);}})[_0x6b6f('0x37')](function(_0x5572bb){logger[_0x6b6f('0x26')]('['+_0x4def24[_0x6b6f('0x62')][_0x6b6f('0x92')]()+']',JSON['stringify'](_0x5572bb));});}; \ 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 b905620..06e9edd 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 _0xe261=['Script','data3','render','error','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','trigger','exec','data2'];(function(_0x4f0448,_0x35dcc0){var _0x581dc4=function(_0x20dd3d){while(--_0x20dd3d){_0x4f0448['push'](_0x4f0448['shift']());}};_0x581dc4(++_0x35dcc0);}(_0xe261,0xa3));var _0x1e26=function(_0x32a9c8,_0x5acb55){_0x32a9c8=_0x32a9c8-0x0;var _0x4651e0=_0xe261[_0x32a9c8];return _0x4651e0;};'use strict';var util=require(_0x1e26('0x0'));var sh=require(_0x1e26('0x1'));var Mustache=require(_0x1e26('0x2'));var logger=require('../../../../config/logger')(_0x1e26('0x3'));exports[_0x1e26('0x4')]=function(_0x371d3f,_0x593286){var _0x336d36=_0x371d3f[_0x1e26('0x5')]?_0x371d3f[_0x1e26('0x5')]:_0x1e26('0x6');var _0x2e66eb=_0x371d3f[_0x1e26('0x7')]?Mustache[_0x1e26('0x8')](_0x371d3f[_0x1e26('0x7')],_0x593286):_0x593286;sh['exec'](_0x2e66eb,function(_0x23a92f,_0x2ab854,_0x25d385){if(_0x23a92f!==0x0){logger[_0x1e26('0x9')](util[_0x1e26('0xa')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x336d36,_0x2e66eb,_0x23a92f,_0x25d385));}else{logger[_0x1e26('0xb')](util[_0x1e26('0xa')](_0x1e26('0xc'),_0x336d36,_0x2e66eb,_0x2ab854));}});}; \ No newline at end of file +var _0x2e10=['%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','shelljs','mustache','exec','data2','Script','data3','render','format'];(function(_0x20a755,_0x9bdee0){var _0x43ae25=function(_0x1647be){while(--_0x1647be){_0x20a755['push'](_0x20a755['shift']());}};_0x43ae25(++_0x9bdee0);}(_0x2e10,0x184));var _0x02e1=function(_0x4b1ac6,_0x33c5df){_0x4b1ac6=_0x4b1ac6-0x0;var _0x5c39ab=_0x2e10[_0x4b1ac6];return _0x5c39ab;};'use strict';var util=require('util');var sh=require(_0x02e1('0x0'));var Mustache=require(_0x02e1('0x1'));var logger=require('../../../../config/logger')('trigger');exports[_0x02e1('0x2')]=function(_0x110f5c,_0x459fff){var _0xb867bc=_0x110f5c['data2']?_0x110f5c[_0x02e1('0x3')]:_0x02e1('0x4');var _0x1c7f4d=_0x110f5c[_0x02e1('0x5')]?Mustache[_0x02e1('0x6')](_0x110f5c[_0x02e1('0x5')],_0x459fff):_0x459fff;sh['exec'](_0x1c7f4d,function(_0x4efb53,_0x564f6f,_0x299546){if(_0x4efb53!==0x0){logger['error'](util[_0x02e1('0x7')](_0x02e1('0x8'),_0xb867bc,_0x1c7f4d,_0x4efb53,_0x299546));}else{logger[_0x02e1('0x9')](util['format'](_0x02e1('0xa'),_0xb867bc,_0x1c7f4d,_0x564f6f));}});}; \ 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 81d171e..7acb957 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 _0x0908=['GET','DELETE','POST','PUT','data7','render','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','util','lodash','mustache','exec','data1','toUpperCase','data2','data5','headers','data6','parse','error','stack'];(function(_0x1e00da,_0x4c1cf8){var _0x16e478=function(_0x2b06c0){while(--_0x2b06c0){_0x1e00da['push'](_0x1e00da['shift']());}};_0x16e478(++_0x4c1cf8);}(_0x0908,0xeb));var _0x8090=function(_0xaa5cb0,_0x36aeac){_0xaa5cb0=_0xaa5cb0-0x0;var _0x47ab5f=_0x0908[_0xaa5cb0];return _0x47ab5f;};'use strict';var rp=require('request-promise');var util=require(_0x8090('0x0'));var _=require(_0x8090('0x1'));var Mustache=require(_0x8090('0x2'));var logger=require('../../../../config/logger')('trigger');exports[_0x8090('0x3')]=function(_0x507dfb,_0x892a1b){var _0x5eaeb6,_0x58c4c9;var _0x5b050b={'method':_0x507dfb[_0x8090('0x4')][_0x8090('0x5')](),'uri':Mustache['render'](_0x507dfb[_0x8090('0x6')],_0x892a1b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x507dfb['data5'])==='number'&&parseInt(_0x507dfb[_0x8090('0x7')])>=0x1&&parseInt(_0x507dfb[_0x8090('0x7')])<=0xa?parseInt(_0x507dfb[_0x8090('0x7')])*0x3e8:0x5*0x3e8};try{_0x5b050b[_0x8090('0x8')]=_0x507dfb[_0x8090('0x9')]?JSON[_0x8090('0xa')](Mustache['render'](_0x507dfb[_0x8090('0x9')],_0x892a1b)):{};}catch(_0x3347d7){logger[_0x8090('0xb')](_0x3347d7[_0x8090('0xc')]);}switch(_0x507dfb[_0x8090('0x4')][_0x8090('0x5')]()){case _0x8090('0xd'):case _0x8090('0xe'):_0x5eaeb6=null;_0x5b050b['qs']=_0x892a1b;break;case _0x8090('0xf'):case _0x8090('0x10'):if(_0x507dfb[_0x8090('0x11')]){try{_0x5eaeb6=JSON[_0x8090('0xa')](Mustache[_0x8090('0x12')](_0x507dfb[_0x8090('0x11')],_0x892a1b));_0x5b050b['body']=_0x5eaeb6;}catch(_0x2f307a){logger[_0x8090('0xb')](_0x2f307a[_0x8090('0xc')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x5eaeb6=_0x892a1b;_0x5b050b[_0x8090('0x13')]=_0x5eaeb6;}break;}logger[_0x8090('0x14')](util[_0x8090('0x15')](_0x8090('0x16'),_0x507dfb[_0x8090('0x4')],_0x507dfb[_0x8090('0x6')],JSON[_0x8090('0x17')](_0x5b050b)));rp(_0x5b050b)[_0x8090('0x18')](function(_0x570e51){_0x5eaeb6=!_[_0x8090('0x19')](_0x5eaeb6)?',\x20request\x20body:\x20'+_0x5eaeb6:'';_0x58c4c9=typeof _0x570e51[_0x8090('0x13')]==='object'?JSON[_0x8090('0x17')](_0x570e51[_0x8090('0x13')]):_0x570e51[_0x8090('0x13')];logger[_0x8090('0x14')](util['format'](_0x8090('0x1a'),_0x507dfb['data1'],_0x507dfb[_0x8090('0x6')],_0x570e51['statusCode'],_0x58c4c9));})[_0x8090('0x1b')](function(_0x10d7d0){logger[_0x8090('0xb')](util['format'](_0x8090('0x1c'),_0x507dfb[_0x8090('0x4')],_0x507dfb[_0x8090('0x6')],_0x10d7d0[_0x8090('0x1d')],_0x10d7d0[_0x8090('0x1e')],_0x10d7d0['message']));});}; \ No newline at end of file +var _0x8a41=['exec','data1','toUpperCase','data2','data5','number','headers','data6','render','error','stack','DELETE','POST','PUT','data7','parse','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','stringify',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','request-promise','util','mustache','../../../../config/logger','trigger'];(function(_0xeec643,_0x3eb18c){var _0x24216a=function(_0x45462d){while(--_0x45462d){_0xeec643['push'](_0xeec643['shift']());}};_0x24216a(++_0x3eb18c);}(_0x8a41,0x171));var _0x18a4=function(_0xa226b0,_0x167a45){_0xa226b0=_0xa226b0-0x0;var _0x13c645=_0x8a41[_0xa226b0];return _0x13c645;};'use strict';var rp=require(_0x18a4('0x0'));var util=require(_0x18a4('0x1'));var _=require('lodash');var Mustache=require(_0x18a4('0x2'));var logger=require(_0x18a4('0x3'))(_0x18a4('0x4'));exports[_0x18a4('0x5')]=function(_0x244920,_0x4ea4a2){var _0x27358e,_0x5f135f;var _0x374f45={'method':_0x244920[_0x18a4('0x6')][_0x18a4('0x7')](),'uri':Mustache['render'](_0x244920[_0x18a4('0x8')],_0x4ea4a2),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x244920[_0x18a4('0x9')])===_0x18a4('0xa')&&parseInt(_0x244920[_0x18a4('0x9')])>=0x1&&parseInt(_0x244920[_0x18a4('0x9')])<=0xa?parseInt(_0x244920[_0x18a4('0x9')])*0x3e8:0x5*0x3e8};try{_0x374f45[_0x18a4('0xb')]=_0x244920[_0x18a4('0xc')]?JSON['parse'](Mustache[_0x18a4('0xd')](_0x244920[_0x18a4('0xc')],_0x4ea4a2)):{};}catch(_0x24cff8){logger[_0x18a4('0xe')](_0x24cff8[_0x18a4('0xf')]);}switch(_0x244920[_0x18a4('0x6')]['toUpperCase']()){case'GET':case _0x18a4('0x10'):_0x27358e=null;_0x374f45['qs']=_0x4ea4a2;break;case _0x18a4('0x11'):case _0x18a4('0x12'):if(_0x244920[_0x18a4('0x13')]){try{_0x27358e=JSON[_0x18a4('0x14')](Mustache[_0x18a4('0xd')](_0x244920[_0x18a4('0x13')],_0x4ea4a2));_0x374f45['body']=_0x27358e;}catch(_0x727916){logger['error'](_0x727916[_0x18a4('0xf')]);logger['error'](_0x18a4('0x15'));}}else{_0x27358e=_0x4ea4a2;_0x374f45[_0x18a4('0x16')]=_0x27358e;}break;}logger[_0x18a4('0x17')](util[_0x18a4('0x18')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x244920[_0x18a4('0x6')],_0x244920[_0x18a4('0x8')],JSON[_0x18a4('0x19')](_0x374f45)));rp(_0x374f45)['then'](function(_0x131164){_0x27358e=!_['isNil'](_0x27358e)?_0x18a4('0x1a')+_0x27358e:'';_0x5f135f=typeof _0x131164[_0x18a4('0x16')]===_0x18a4('0x1b')?JSON[_0x18a4('0x19')](_0x131164[_0x18a4('0x16')]):_0x131164[_0x18a4('0x16')];logger[_0x18a4('0x17')](util[_0x18a4('0x18')](_0x18a4('0x1c'),_0x244920[_0x18a4('0x6')],_0x244920[_0x18a4('0x8')],_0x131164['statusCode'],_0x5f135f));})[_0x18a4('0x1d')](function(_0x5f146e){logger[_0x18a4('0xe')](util[_0x18a4('0x18')](_0x18a4('0x1e'),_0x244920[_0x18a4('0x6')],_0x244920[_0x18a4('0x8')],_0x5f146e[_0x18a4('0x1f')],_0x5f146e[_0x18a4('0x20')],_0x5f146e[_0x18a4('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index aaed799..34143fe 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 _0x3f4d=['rpc','error','message','result','catch','jayson/promise','bluebird','routing','http','Request','request','then'];(function(_0x469fc4,_0x427a80){var _0x11f6d4=function(_0x1b7238){while(--_0x1b7238){_0x469fc4['push'](_0x469fc4['shift']());}};_0x11f6d4(++_0x427a80);}(_0x3f4d,0xad));var _0xd3f4=function(_0xc1af5b,_0x396ee0){_0xc1af5b=_0xc1af5b-0x0;var _0x2a5d00=_0x3f4d[_0xc1af5b];return _0x2a5d00;};'use strict';var jayson=require(_0xd3f4('0x0'));var BPromise=require(_0xd3f4('0x1'));var logger=require('../../config/logger')(_0xd3f4('0x2'));var client=jayson['client'][_0xd3f4('0x3')]({'port':0x2329});client[_0xd3f4('0x4')]=function(_0x4e82dc,_0x47381c){return new BPromise(function(_0x160d3a,_0x539903){return client[_0xd3f4('0x5')](_0x4e82dc,_0x47381c)[_0xd3f4('0x6')](function(_0x508433){logger['debug'](_0xd3f4('0x7'),_0xd3f4('0x2'),_0x4e82dc,_0x47381c,_0x508433);if(_0x508433[_0xd3f4('0x8')]){logger[_0xd3f4('0x8')]('rpc',_0xd3f4('0x2'),_0x4e82dc,_0x508433[_0xd3f4('0x8')][_0xd3f4('0x9')],_0x47381c);return _0x539903(_0x508433[_0xd3f4('0x8')]['message']);}else{return _0x160d3a(_0x508433[_0xd3f4('0xa')]);}})[_0xd3f4('0xb')](function(_0x5ed512){logger[_0xd3f4('0x8')](_0xd3f4('0x7'),_0xd3f4('0x2'),_0x4e82dc,_0x5ed512,_0x47381c);return _0x539903(_0x5ed512);});});};module['exports']=client; \ No newline at end of file +var _0xf7a3=['debug','rpc','error','result','catch','jayson/promise','bluebird','../../config/logger','routing','client','Request','request'];(function(_0x5c099a,_0x3041a8){var _0x2ef2a1=function(_0x50b116){while(--_0x50b116){_0x5c099a['push'](_0x5c099a['shift']());}};_0x2ef2a1(++_0x3041a8);}(_0xf7a3,0x13d));var _0x3f7a=function(_0x58d5ac,_0x11c4bc){_0x58d5ac=_0x58d5ac-0x0;var _0x37985c=_0xf7a3[_0x58d5ac];return _0x37985c;};'use strict';var jayson=require(_0x3f7a('0x0'));var BPromise=require(_0x3f7a('0x1'));var logger=require(_0x3f7a('0x2'))(_0x3f7a('0x3'));var client=jayson[_0x3f7a('0x4')]['http']({'port':0x2329});client[_0x3f7a('0x5')]=function(_0x3b6121,_0x1460f5){return new BPromise(function(_0x2130b1,_0x202d5c){return client[_0x3f7a('0x6')](_0x3b6121,_0x1460f5)['then'](function(_0x4e1b4b){logger[_0x3f7a('0x7')]('rpc',_0x3f7a('0x3'),_0x3b6121,_0x1460f5,_0x4e1b4b);if(_0x4e1b4b['error']){logger['error'](_0x3f7a('0x8'),'routing',_0x3b6121,_0x4e1b4b[_0x3f7a('0x9')]['message'],_0x1460f5);return _0x202d5c(_0x4e1b4b[_0x3f7a('0x9')]['message']);}else{return _0x2130b1(_0x4e1b4b[_0x3f7a('0xa')]);}})[_0x3f7a('0xb')](function(_0x5ac722){logger[_0x3f7a('0x9')](_0x3f7a('0x8'),_0x3f7a('0x3'),_0x3b6121,_0x5ac722,_0x1460f5);return _0x202d5c(_0x5ac722);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 5b24ba3..aa37978 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 _0x8926=['mailAccounts','listen','getSettings','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8926,0x96));var _0x6892=function(_0x5e2619,_0x211a80){_0x5e2619=_0x5e2619-0x0;var _0x45cdb3=_0x8926[_0x5e2619];return _0x45cdb3;};'use strict';var server=require(_0x6892('0x0'));var Realtime=require(_0x6892('0x1'));var EmailChannel=require(_0x6892('0x2'));var mailAccount=require(_0x6892('0x3'));var setting=require(_0x6892('0x4'));var logger=require(_0x6892('0x5'))(_0x6892('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x6892('0x7')]()[_0x6892('0x8')](mailAccount[_0x6892('0x9')]())[_0x6892('0x8')](realtime[_0x6892('0xa')]())[_0x6892('0x8')](function(){email[_0x6892('0xb')](realtime[_0x6892('0xc')]);return realtime;});}function main(){return server[_0x6892('0xd')](realtime,email)['then'](function(){return initRealtime();})[_0x6892('0x8')](function(){return setting[_0x6892('0xe')]();})['then'](function(_0x28a285){return setInterval(initRealtime,_0x28a285['loginMailFrequency']*0x3e8);})[_0x6892('0xf')](function(_0x5f5697){logger[_0x6892('0x10')](_0x6892('0x11'),_0x5f5697);});}main(); \ No newline at end of file +var _0xe174=['then','getMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/setting','../../config/logger','resolve'];(function(_0x183d0e,_0x1f520f){var _0x278ff8=function(_0x49b6d1){while(--_0x49b6d1){_0x183d0e['push'](_0x183d0e['shift']());}};_0x278ff8(++_0x1f520f);}(_0xe174,0x1f3));var _0x4e17=function(_0x3eb8a8,_0x2af5e9){_0x3eb8a8=_0x3eb8a8-0x0;var _0x173073=_0xe174[_0x3eb8a8];return _0x173073;};'use strict';var server=require('./server');var Realtime=require(_0x4e17('0x0'));var EmailChannel=require(_0x4e17('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x4e17('0x2'));var logger=require(_0x4e17('0x3'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x4e17('0x4')]()[_0x4e17('0x5')](mailAccount[_0x4e17('0x6')]())[_0x4e17('0x5')](realtime['initMailAccounts']())['then'](function(){email[_0x4e17('0x7')](realtime[_0x4e17('0x8')]);return realtime;});}function main(){return server[_0x4e17('0x9')](realtime,email)[_0x4e17('0x5')](function(){return initRealtime();})[_0x4e17('0x5')](function(){return setting[_0x4e17('0xa')]();})[_0x4e17('0x5')](function(_0x2792b1){return setInterval(initRealtime,_0x2792b1[_0x4e17('0xb')]*0x3e8);})[_0x4e17('0xc')](function(_0x39b768){logger['error'](_0x4e17('0xd'),_0x39b768);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index be78a60..61100de 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 _0x1426=['start\x20email\x20channel','mailAccounts','smtp','key','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','active','service','provider','imapAccounts','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','disabled','emit','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapError','sendMail','send','verifySmtp','Smtp','lastSync','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info'];(function(_0x54757b,_0x1395b5){var _0x13597e=function(_0x4195e0){while(--_0x4195e0){_0x54757b['push'](_0x54757b['shift']());}};_0x13597e(++_0x1395b5);}(_0x1426,0x6a));var _0x6142=function(_0x37f6e3,_0x46930a){_0x37f6e3=_0x37f6e3-0x0;var _0x1714f2=_0x1426[_0x37f6e3];return _0x1714f2;};'use strict';var _=require(_0x6142('0x0'));var moment=require(_0x6142('0x1'));var BPromise=require(_0x6142('0x2'));var md5=require(_0x6142('0x3'));var Redis=require(_0x6142('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x6142('0x5'));config[_0x6142('0x6')]=_[_0x6142('0x7')](config[_0x6142('0x6')],{'host':_0x6142('0x8'),'port':0x18eb});var io=require(_0x6142('0x9'))(new Redis(config[_0x6142('0x6')]));var EmailImap=require(_0x6142('0xa'));var EmailSmtp=require(_0x6142('0xb'));var mailAccount=require(_0x6142('0xc'));var md5Accounts={};function EmailChannel(_0x4dbd7d){logger[_0x6142('0xd')](_0x6142('0xe'));this[_0x6142('0xf')]=_0x4dbd7d[_0x6142('0xf')];this['imapAccounts']={};this[_0x6142('0x10')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x5c92b6){var _0xd34acf=this[_0x6142('0xf')][_0x5c92b6];var _0x30019a={'id':_0xd34acf['id'],'name':_0xd34acf['name'],'key':_0xd34acf[_0x6142('0x11')],'active':_0xd34acf['active'],'Imap':{'status':_0xd34acf[_0x6142('0x12')][_0x6142('0x13')],'messageStatus':_0xd34acf[_0x6142('0x12')][_0x6142('0x14')],'total':_0xd34acf[_0x6142('0x12')][_0x6142('0x15')]}};if(_[_0x6142('0x16')](md5Accounts[_0x5c92b6])){md5Accounts[_0x5c92b6]={};}var _0x2dadc6=md5(JSON[_0x6142('0x17')](_0x30019a));if(md5Accounts[_0x5c92b6][_0x6142('0x3')]!==_0x2dadc6){md5Accounts[_0x5c92b6][_0x6142('0x3')]=_0x2dadc6;io['emit'](_0x6142('0x18'),_0x30019a);}};EmailChannel[_0x6142('0x19')][_0x6142('0x1a')]=function(_0x527a95){for(var _0x3d21fb in _0x527a95){if(_0x527a95[_0x6142('0x1b')](_0x3d21fb)){if(_0x527a95[_0x3d21fb][_0x6142('0x12')]&&_0x527a95[_0x3d21fb][_0x6142('0x1c')]){var _0x34a946=_0x527a95[_0x3d21fb]['Imap'];if(!_0x34a946[_0x6142('0x1d')]&&_0x527a95[_0x3d21fb][_0x6142('0x1e')]!=='custom')_0x34a946[_0x6142('0x1d')]=_0x527a95[_0x3d21fb]['provider'];if(!this['imapAccounts'][_0x6142('0x1b')](_0x34a946['id'])){this[_0x6142('0x1f')][_0x34a946['id']]=new EmailImap(_0x34a946,_0x527a95[_0x3d21fb][_0x6142('0x5')]);this[_0x6142('0x1f')][_0x34a946['id']]['on'](_0x6142('0x20'),this[_0x6142('0x21')][_0x6142('0x22')](this,_0x3d21fb));this[_0x6142('0x1f')][_0x34a946['id']]['on'](_0x6142('0x5'),this[_0x6142('0x23')]['bind'](this,_0x3d21fb));this[_0x6142('0x1f')][_0x34a946['id']]['on'](_0x6142('0x24'),this[_0x6142('0x25')][_0x6142('0x22')](this,_0x3d21fb));this[_0x6142('0x1f')][_0x34a946['id']]['on'](_0x6142('0x26'),this['handleImapError'][_0x6142('0x22')](this,_0x3d21fb));}}else{if(_['isNil'](this[_0x6142('0xf')][_0x3d21fb][_0x6142('0x12')])){this[_0x6142('0xf')][_0x3d21fb][_0x6142('0x12')]={};}this[_0x6142('0xf')][_0x3d21fb][_0x6142('0x12')]['status']=_0x6142('0x27');this[_0x6142('0xf')][_0x3d21fb][_0x6142('0x12')][_0x6142('0x14')]='';this[_0x6142('0x28')](_0x3d21fb);}}}};EmailChannel[_0x6142('0x19')][_0x6142('0x21')]=function(_0x2b3149,_0x22b1a7){if(this['mailAccounts'][_0x2b3149]){this[_0x6142('0xf')][_0x2b3149][_0x6142('0x12')]['status']=_0x6142('0x29');this['mailAccounts'][_0x2b3149][_0x6142('0x12')][_0x6142('0x14')]=_0x22b1a7[_0x6142('0x2a')];if(_0x22b1a7[_0x6142('0x2b')]){this[_0x6142('0xf')][_0x2b3149][_0x6142('0x12')]['total']=_0x22b1a7[_0x6142('0x2b')][_0x6142('0x15')];}return this[_0x6142('0x28')](_0x2b3149);}};EmailChannel['prototype'][_0x6142('0x23')]=function(_0x176af2,_0x9c0c61){logger[_0x6142('0xd')](_0x6142('0x2c'),_0x9c0c61[_0x6142('0x2d')],_0x9c0c61[_0x6142('0x2e')],_0x9c0c61[_0x6142('0x2f')],_0x176af2);if(this[_0x6142('0xf')][_0x176af2]){return mailAccount[_0x6142('0x30')](_0x176af2,_0x9c0c61)[_0x6142('0x31')](function(_0x23c152){if(_0x23c152){logger[_0x6142('0xd')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x4534d1){logger['error'](_0x6142('0x32'),JSON[_0x6142('0x17')](_0x4534d1));});}};EmailChannel[_0x6142('0x19')]['handleImapEnd']=function(_0x45ceb3){if(this[_0x6142('0xf')][_0x45ceb3]&&this[_0x6142('0xf')][_0x45ceb3][_0x6142('0x12')]){if(this[_0x6142('0x1f')][this['mailAccounts'][_0x45ceb3][_0x6142('0x12')]['id']]){delete this[_0x6142('0x1f')][this['mailAccounts'][_0x45ceb3][_0x6142('0x12')]['id']];}this[_0x6142('0xf')][_0x45ceb3][_0x6142('0x12')]['lastSync']=moment();this[_0x6142('0x28')](_0x45ceb3);}};EmailChannel[_0x6142('0x19')][_0x6142('0x33')]=function(_0x51c629,_0x51c116){if(this[_0x6142('0xf')][_0x51c629]){this[_0x6142('0xf')][_0x51c629]['Imap'][_0x6142('0x13')]=_0x6142('0x26');this['mailAccounts'][_0x51c629][_0x6142('0x12')][_0x6142('0x14')]=_0x51c116;return this[_0x6142('0x28')](_0x51c629);}};EmailChannel[_0x6142('0x19')][_0x6142('0x34')]=function(_0x4bf8fb,_0x4bcc77){return this['smtp'][_0x6142('0x35')](_0x4bf8fb,_0x4bcc77);};EmailChannel[_0x6142('0x19')][_0x6142('0x36')]=function(_0x454642){var _0x4b7b63=this;if(this[_0x6142('0xf')][_0x454642['id']]){if(_[_0x6142('0x16')](this[_0x6142('0xf')][_0x454642['id']]['Smtp'])){this[_0x6142('0xf')][_0x454642['id']][_0x6142('0x37')]={};}this['mailAccounts'][_0x454642['id']][_0x6142('0x37')][_0x6142('0x38')]=moment();return new BPromise(function(_0x57b62d,_0x2ff44a){return _0x4b7b63[_0x6142('0x10')][_0x6142('0x39')](_0x454642)[_0x6142('0x31')](function(_0x34ceda){_0x4b7b63['mailAccounts'][_0x454642['id']]['Smtp'][_0x6142('0x13')]=_0x6142('0x3a');_0x4b7b63['mailAccounts'][_0x454642['id']][_0x6142('0x37')]['messageStatus']='';_0x4b7b63[_0x6142('0x28')](_0x454642['id']);_0x57b62d(_0x34ceda);})['catch'](function(_0x5314f5){_0x4b7b63[_0x6142('0xf')][_0x454642['id']][_0x6142('0x37')][_0x6142('0x13')]='error';_0x4b7b63[_0x6142('0xf')][_0x454642['id']]['Smtp'][_0x6142('0x14')]=_0x5314f5;_0x4b7b63[_0x6142('0x28')](_0x454642['id']);_0x2ff44a(_0x5314f5);});});}return this['smtp'][_0x6142('0x39')](_0x454642);};module[_0x6142('0x3b')]=EmailChannel; \ No newline at end of file +var _0x1364=['imapAccounts','emit','name','key','active','Imap','status','messageStatus','isNil','stringify','md5','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','prototype','connected','messages','total','firstName','lastName','notify','then','info','Mail\x20accepted\x20from\x20routing','sendMail','send','verifySmtp','Smtp','lastSync','verify','verified','smtp','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','redis','localhost','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts'];(function(_0x4d934b,_0x52f8e9){var _0xc0338b=function(_0x1a356c){while(--_0x1a356c){_0x4d934b['push'](_0x4d934b['shift']());}};_0xc0338b(++_0x52f8e9);}(_0x1364,0x9e));var _0x4136=function(_0x1ebfcf,_0x1525cf){_0x1ebfcf=_0x1ebfcf-0x0;var _0x246290=_0x1364[_0x1ebfcf];return _0x246290;};'use strict';var _=require(_0x4136('0x0'));var moment=require(_0x4136('0x1'));var BPromise=require(_0x4136('0x2'));var md5=require('md5');var Redis=require(_0x4136('0x3'));var config=require(_0x4136('0x4'));var logger=require(_0x4136('0x5'))('email');config[_0x4136('0x6')]=_['defaults'](config['redis'],{'host':_0x4136('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4136('0x6')]));var EmailImap=require(_0x4136('0x8'));var EmailSmtp=require(_0x4136('0x9'));var mailAccount=require(_0x4136('0xa'));var md5Accounts={};function EmailChannel(_0x1aa186){logger['info'](_0x4136('0xb'));this[_0x4136('0xc')]=_0x1aa186[_0x4136('0xc')];this[_0x4136('0xd')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x4136('0xe')]=function(_0x34b66c){var _0x230079=this[_0x4136('0xc')][_0x34b66c];var _0x2c1bd2={'id':_0x230079['id'],'name':_0x230079[_0x4136('0xf')],'key':_0x230079[_0x4136('0x10')],'active':_0x230079[_0x4136('0x11')],'Imap':{'status':_0x230079[_0x4136('0x12')][_0x4136('0x13')],'messageStatus':_0x230079[_0x4136('0x12')][_0x4136('0x14')],'total':_0x230079[_0x4136('0x12')]['total']}};if(_[_0x4136('0x15')](md5Accounts[_0x34b66c])){md5Accounts[_0x34b66c]={};}var _0x2d6075=md5(JSON[_0x4136('0x16')](_0x2c1bd2));if(md5Accounts[_0x34b66c][_0x4136('0x17')]!==_0x2d6075){md5Accounts[_0x34b66c][_0x4136('0x17')]=_0x2d6075;io[_0x4136('0xe')](_0x4136('0x18'),_0x2c1bd2);}};EmailChannel['prototype'][_0x4136('0x19')]=function(_0x1d1dbf){for(var _0xa962da in _0x1d1dbf){if(_0x1d1dbf[_0x4136('0x1a')](_0xa962da)){if(_0x1d1dbf[_0xa962da]['Imap']&&_0x1d1dbf[_0xa962da][_0x4136('0x11')]){var _0x1117e8=_0x1d1dbf[_0xa962da][_0x4136('0x12')];if(!_0x1117e8[_0x4136('0x1b')]&&_0x1d1dbf[_0xa962da][_0x4136('0x1c')]!==_0x4136('0x1d'))_0x1117e8[_0x4136('0x1b')]=_0x1d1dbf[_0xa962da][_0x4136('0x1c')];if(!this[_0x4136('0xd')][_0x4136('0x1a')](_0x1117e8['id'])){this['imapAccounts'][_0x1117e8['id']]=new EmailImap(_0x1117e8,_0x1d1dbf[_0xa962da]['email']);this[_0x4136('0xd')][_0x1117e8['id']]['on']('box',this[_0x4136('0x1e')][_0x4136('0x1f')](this,_0xa962da));this['imapAccounts'][_0x1117e8['id']]['on']('email',this[_0x4136('0x20')]['bind'](this,_0xa962da));this[_0x4136('0xd')][_0x1117e8['id']]['on'](_0x4136('0x21'),this[_0x4136('0x22')]['bind'](this,_0xa962da));this[_0x4136('0xd')][_0x1117e8['id']]['on'](_0x4136('0x23'),this[_0x4136('0x24')][_0x4136('0x1f')](this,_0xa962da));}}else{if(_['isNil'](this[_0x4136('0xc')][_0xa962da]['Imap'])){this[_0x4136('0xc')][_0xa962da]['Imap']={};}this[_0x4136('0xc')][_0xa962da][_0x4136('0x12')][_0x4136('0x13')]=_0x4136('0x25');this[_0x4136('0xc')][_0xa962da]['Imap']['messageStatus']='';this[_0x4136('0xe')](_0xa962da);}}}};EmailChannel[_0x4136('0x26')]['handleImapBox']=function(_0xd72099,_0x5586de){if(this[_0x4136('0xc')][_0xd72099]){this[_0x4136('0xc')][_0xd72099][_0x4136('0x12')][_0x4136('0x13')]=_0x4136('0x27');this['mailAccounts'][_0xd72099][_0x4136('0x12')]['messageStatus']=_0x5586de['name'];if(_0x5586de[_0x4136('0x28')]){this[_0x4136('0xc')][_0xd72099][_0x4136('0x12')][_0x4136('0x29')]=_0x5586de[_0x4136('0x28')]['total'];}return this[_0x4136('0xe')](_0xd72099);}};EmailChannel[_0x4136('0x26')][_0x4136('0x20')]=function(_0x2f034e,_0x26fdc5){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x26fdc5[_0x4136('0x2a')],_0x26fdc5[_0x4136('0x2b')],_0x26fdc5['from'],_0x2f034e);if(this['mailAccounts'][_0x2f034e]){return mailAccount[_0x4136('0x2c')](_0x2f034e,_0x26fdc5)[_0x4136('0x2d')](function(_0x6fead7){if(_0x6fead7){logger[_0x4136('0x2e')](_0x4136('0x2f'));}})['catch'](function(_0x386a22){logger[_0x4136('0x23')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x4136('0x16')](_0x386a22));});}};EmailChannel[_0x4136('0x26')]['handleImapEnd']=function(_0x1dbe8c){if(this['mailAccounts'][_0x1dbe8c]&&this[_0x4136('0xc')][_0x1dbe8c]['Imap']){if(this[_0x4136('0xd')][this[_0x4136('0xc')][_0x1dbe8c]['Imap']['id']]){delete this[_0x4136('0xd')][this[_0x4136('0xc')][_0x1dbe8c][_0x4136('0x12')]['id']];}this[_0x4136('0xc')][_0x1dbe8c]['Imap']['lastSync']=moment();this[_0x4136('0xe')](_0x1dbe8c);}};EmailChannel[_0x4136('0x26')][_0x4136('0x24')]=function(_0x121883,_0x3f4a0a){if(this[_0x4136('0xc')][_0x121883]){this[_0x4136('0xc')][_0x121883][_0x4136('0x12')]['status']=_0x4136('0x23');this[_0x4136('0xc')][_0x121883][_0x4136('0x12')][_0x4136('0x14')]=_0x3f4a0a;return this[_0x4136('0xe')](_0x121883);}};EmailChannel[_0x4136('0x26')][_0x4136('0x30')]=function(_0x4a2d8a,_0x5334b8){return this['smtp'][_0x4136('0x31')](_0x4a2d8a,_0x5334b8);};EmailChannel[_0x4136('0x26')][_0x4136('0x32')]=function(_0x535024){var _0x5e6fb5=this;if(this[_0x4136('0xc')][_0x535024['id']]){if(_[_0x4136('0x15')](this[_0x4136('0xc')][_0x535024['id']][_0x4136('0x33')])){this[_0x4136('0xc')][_0x535024['id']][_0x4136('0x33')]={};}this['mailAccounts'][_0x535024['id']][_0x4136('0x33')][_0x4136('0x34')]=moment();return new BPromise(function(_0x32a877,_0x3ef903){return _0x5e6fb5['smtp'][_0x4136('0x35')](_0x535024)[_0x4136('0x2d')](function(_0x325938){_0x5e6fb5[_0x4136('0xc')][_0x535024['id']][_0x4136('0x33')][_0x4136('0x13')]=_0x4136('0x36');_0x5e6fb5[_0x4136('0xc')][_0x535024['id']][_0x4136('0x33')][_0x4136('0x14')]='';_0x5e6fb5['emit'](_0x535024['id']);_0x32a877(_0x325938);})['catch'](function(_0x3c3150){_0x5e6fb5['mailAccounts'][_0x535024['id']][_0x4136('0x33')][_0x4136('0x13')]='error';_0x5e6fb5[_0x4136('0xc')][_0x535024['id']][_0x4136('0x33')][_0x4136('0x14')]=_0x3c3150;_0x5e6fb5[_0x4136('0xe')](_0x535024['id']);_0x3ef903(_0x3c3150);});});}return this[_0x4136('0x37')][_0x4136('0x35')](_0x535024);};module[_0x4136('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index d22199b..fa9e475 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 _0xf682=['imap','mailparser','Iconv','events','EventEmitter','./utils','email','mailbox','account','getAccount','ready','handleReady','bind','once','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','CloudProvider','password','authentication','anonymous@xcally.com','port','tls','required','openBox','handleOpenBox','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchEnd','body','handleMessageBody','handleMessageAttributes','handleSimpleParser','parser','emit','handleCloseBox','handleFetchError','closeBox','stringify','textCode','upperFirst','exports','lodash','util'];(function(_0x1911ed,_0x4e8c73){var _0x11edaa=function(_0x216008){while(--_0x216008){_0x1911ed['push'](_0x1911ed['shift']());}};_0x11edaa(++_0x4e8c73);}(_0xf682,0x12f));var _0x2f68=function(_0x144512,_0x34066f){_0x144512=_0x144512-0x0;var _0x1b3566=_0xf682[_0x144512];return _0x1b3566;};'use strict';var _=require(_0x2f68('0x0'));var util=require(_0x2f68('0x1'));var Imap=require(_0x2f68('0x2'));var simpleParser=require(_0x2f68('0x3'))['simpleParser'];var Iconv=require('iconv')[_0x2f68('0x4')];var EventEmitter=require(_0x2f68('0x5'))[_0x2f68('0x6')];var utils=require(_0x2f68('0x7'));var logger=require('../../../config/logger')(_0x2f68('0x8'));function EmailImap(_0x46dd32,_0x6f92f6){this[_0x2f68('0x9')]=_0x46dd32['mailbox'];this[_0x2f68('0xa')]=this[_0x2f68('0xb')](_0x46dd32,_0x6f92f6);this['imap']=new Imap(this['account']);this['imap']['once'](_0x2f68('0xc'),this[_0x2f68('0xd')][_0x2f68('0xe')](this));this[_0x2f68('0x2')][_0x2f68('0xf')](_0x2f68('0x10'),this[_0x2f68('0x11')][_0x2f68('0xe')](this));this[_0x2f68('0x2')]['on'](_0x2f68('0x12'),this[_0x2f68('0x13')][_0x2f68('0xe')](this));this[_0x2f68('0x2')][_0x2f68('0x14')]();}util[_0x2f68('0x15')](EmailImap,EventEmitter);EmailImap[_0x2f68('0x16')]['getAccount']=function(_0xfb1457,_0x348383){var _0x455ab1={'connTimeout':_0xfb1457[_0x2f68('0x17')]?_0xfb1457[_0x2f68('0x17')]*0x3e8:0x2710,'authTimeout':_0xfb1457[_0x2f68('0x18')]?_0xfb1457[_0x2f68('0x18')]*0x3e8:0x1388};if(_0xfb1457[_0x2f68('0x19')]){_0x455ab1['user']=_0xfb1457[_0x2f68('0x1a')];if(_0xfb1457[_0x2f68('0x1b')]){_0x455ab1[_0x2f68('0x1c')]=utils['generateXOAuth2Token'](_0xfb1457[_0x2f68('0x1d')]['data5'],_0xfb1457[_0x2f68('0x1a')]);}else{_0x455ab1['password']=_0xfb1457[_0x2f68('0x1e')];}}else{if(_0xfb1457[_0x2f68('0x1f')]){_0x455ab1[_0x2f68('0x1a')]=_0xfb1457[_0x2f68('0x1a')];_0x455ab1[_0x2f68('0x1e')]=_0xfb1457['password'];}}_0x455ab1[_0x2f68('0x8')]=_0x348383||_0xfb1457[_0x2f68('0x1a')]||_0x2f68('0x20');_0x455ab1['host']=_0xfb1457['host'];_0x455ab1[_0x2f68('0x21')]=_0xfb1457[_0x2f68('0x21')]||0x3e1;if(_0xfb1457['tls']){_0x455ab1['tls']=!![];}else{_0x455ab1[_0x2f68('0x22')]=![];_0x455ab1['autotls']=_0x2f68('0x23');}return _0x455ab1;};EmailImap['prototype'][_0x2f68('0xd')]=function(){this[_0x2f68('0x2')][_0x2f68('0x24')](this[_0x2f68('0x9')],![],this[_0x2f68('0x25')][_0x2f68('0xe')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x274518,_0xc2f5a){if(_0x274518){this['handleError'](_0x274518,!![]);}else{this['emit'](_0x2f68('0x26'),_0xc2f5a);this['readUnseen']();}};EmailImap[_0x2f68('0x16')]['handleCloseBox']=function(_0x3614c6){if(_0x3614c6){this[_0x2f68('0x13')](_0x3614c6,!![]);}else{this[_0x2f68('0x2')][_0x2f68('0x10')]();}};EmailImap['prototype'][_0x2f68('0x27')]=function(){this[_0x2f68('0x2')][_0x2f68('0x28')]([_0x2f68('0x29')],this[_0x2f68('0x2a')][_0x2f68('0xe')](this));};EmailImap[_0x2f68('0x16')][_0x2f68('0x2a')]=function(_0x1c1016,_0x15605b){if(_0x1c1016){this[_0x2f68('0x13')](_0x1c1016,!![]);}else{if(_0x15605b[_0x2f68('0x2b')]){try{var _0x4c4d0d=this['imap'][_0x2f68('0x2c')](_0x15605b['slice'](0x0,0xa),{'bodies':'','markSeen':!![]});_0x4c4d0d['on'](_0x2f68('0x2d'),this[_0x2f68('0x2e')][_0x2f68('0xe')](this));_0x4c4d0d['once']('error',this['handleFetchError'][_0x2f68('0xe')](this));_0x4c4d0d[_0x2f68('0xf')]('end',this[_0x2f68('0x2f')]['bind'](this));}catch(_0x40204){logger['error'](_0x40204);}}else{this[_0x2f68('0x2')]['closeBox'](!![],this['handleCloseBox'][_0x2f68('0xe')](this));}}};EmailImap[_0x2f68('0x16')][_0x2f68('0x2e')]=function(_0x1bbeb4){_0x1bbeb4['on'](_0x2f68('0x30'),this[_0x2f68('0x31')][_0x2f68('0xe')](this));_0x1bbeb4[_0x2f68('0xf')]('attributes',this[_0x2f68('0x32')][_0x2f68('0xe')](this));_0x1bbeb4['once'](_0x2f68('0x10'),this['handleMessageEnd'][_0x2f68('0xe')](this));};EmailImap[_0x2f68('0x16')][_0x2f68('0x31')]=function(_0x51d8c3){simpleParser(_0x51d8c3,{'Iconv':Iconv},this[_0x2f68('0x33')][_0x2f68('0xe')](this));};EmailImap['prototype']['handleMessageAttributes']=function(){};EmailImap[_0x2f68('0x16')]['handleMessageEnd']=function(){};EmailImap[_0x2f68('0x16')][_0x2f68('0x33')]=function(_0x4f83d9,_0x3b1c14){if(_0x4f83d9){logger[_0x2f68('0x12')](_0x4f83d9);}else{var _0x3ef886=this;utils[_0x2f68('0x34')](this['account'],_0x3b1c14,function(_0x4b56d1){_0x3ef886[_0x2f68('0x35')](_0x2f68('0x8'),_0x4b56d1);});}};EmailImap[_0x2f68('0x16')][_0x2f68('0x2f')]=function(){this[_0x2f68('0x2')]['closeBox'](!![],this[_0x2f68('0x36')][_0x2f68('0xe')](this));};EmailImap[_0x2f68('0x16')][_0x2f68('0x37')]=function(_0x1949fa){this[_0x2f68('0x13')](_0x1949fa);this[_0x2f68('0x2')][_0x2f68('0x38')](!![],this[_0x2f68('0x36')][_0x2f68('0xe')](this));};EmailImap[_0x2f68('0x16')][_0x2f68('0x11')]=function(){this['emit'](_0x2f68('0x10'));};EmailImap[_0x2f68('0x16')][_0x2f68('0x13')]=function(_0x1c10f0,_0x550763){logger[_0x2f68('0x12')](_0x2f68('0x13'),this[_0x2f68('0xa')][_0x2f68('0x8')],JSON[_0x2f68('0x39')](_0x1c10f0));var _0x1063d1='';if(_0x1c10f0){if(_0x1c10f0['textCode']){_0x1063d1=_0x1c10f0[_0x2f68('0x3a')];}else{for(var _0x363a03 in _0x1c10f0){if(_0x1c10f0['hasOwnProperty'](_0x363a03)){_0x1063d1+=_[_0x2f68('0x3b')](_0x363a03)+':\x20'+_0x1c10f0[_0x363a03]+'\x0a';}}}}if(_0x550763){this[_0x2f68('0x2')][_0x2f68('0x10')]();}else{this['emit'](_0x2f68('0x12'),_0x1063d1);this[_0x2f68('0x35')](_0x2f68('0x10'));}};module[_0x2f68('0x3c')]=EmailImap; \ No newline at end of file +var _0x4d5c=['generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','required','openBox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','slice','message','handleFetchMessage','handleFetchError','end','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleCloseBox','stringify','textCode','upperFirst','exports','lodash','util','imap','mailparser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady','bind','handleEnd','error','handleError','inherits','prototype','connTimeout','service','user','xoauth2'];(function(_0xb34668,_0x292d1e){var _0x5102b5=function(_0x15707a){while(--_0x15707a){_0xb34668['push'](_0xb34668['shift']());}};_0x5102b5(++_0x292d1e);}(_0x4d5c,0xe9));var _0xc4d5=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0x4d5c[_0x39772f];return _0xc9edbf;};'use strict';var _=require(_0xc4d5('0x0'));var util=require(_0xc4d5('0x1'));var Imap=require(_0xc4d5('0x2'));var simpleParser=require(_0xc4d5('0x3'))['simpleParser'];var Iconv=require(_0xc4d5('0x4'))[_0xc4d5('0x5')];var EventEmitter=require(_0xc4d5('0x6'))[_0xc4d5('0x7')];var utils=require(_0xc4d5('0x8'));var logger=require(_0xc4d5('0x9'))(_0xc4d5('0xa'));function EmailImap(_0x88332f,_0x5bd2c){this['mailbox']=_0x88332f[_0xc4d5('0xb')];this[_0xc4d5('0xc')]=this[_0xc4d5('0xd')](_0x88332f,_0x5bd2c);this['imap']=new Imap(this[_0xc4d5('0xc')]);this['imap'][_0xc4d5('0xe')](_0xc4d5('0xf'),this[_0xc4d5('0x10')][_0xc4d5('0x11')](this));this['imap']['once']('end',this[_0xc4d5('0x12')]['bind'](this));this[_0xc4d5('0x2')]['on'](_0xc4d5('0x13'),this[_0xc4d5('0x14')]['bind'](this));this[_0xc4d5('0x2')]['connect']();}util[_0xc4d5('0x15')](EmailImap,EventEmitter);EmailImap[_0xc4d5('0x16')][_0xc4d5('0xd')]=function(_0x102237,_0x449410){var _0x5aa6cf={'connTimeout':_0x102237[_0xc4d5('0x17')]?_0x102237['connTimeout']*0x3e8:0x2710,'authTimeout':_0x102237['authTimeout']?_0x102237['authTimeout']*0x3e8:0x1388};if(_0x102237[_0xc4d5('0x18')]){_0x5aa6cf['user']=_0x102237[_0xc4d5('0x19')];if(_0x102237['modernAuthentication']){_0x5aa6cf[_0xc4d5('0x1a')]=utils[_0xc4d5('0x1b')](_0x102237[_0xc4d5('0x1c')][_0xc4d5('0x1d')],_0x102237[_0xc4d5('0x19')]);}else{_0x5aa6cf[_0xc4d5('0x1e')]=_0x102237[_0xc4d5('0x1e')];}}else{if(_0x102237[_0xc4d5('0x1f')]){_0x5aa6cf[_0xc4d5('0x19')]=_0x102237[_0xc4d5('0x19')];_0x5aa6cf[_0xc4d5('0x1e')]=_0x102237['password'];}}_0x5aa6cf['email']=_0x449410||_0x102237[_0xc4d5('0x19')]||_0xc4d5('0x20');_0x5aa6cf[_0xc4d5('0x21')]=_0x102237[_0xc4d5('0x21')];_0x5aa6cf['port']=_0x102237[_0xc4d5('0x22')]||0x3e1;if(_0x102237[_0xc4d5('0x23')]){_0x5aa6cf[_0xc4d5('0x23')]=!![];}else{_0x5aa6cf[_0xc4d5('0x23')]=![];_0x5aa6cf['autotls']=_0xc4d5('0x24');}return _0x5aa6cf;};EmailImap[_0xc4d5('0x16')][_0xc4d5('0x10')]=function(){this[_0xc4d5('0x2')][_0xc4d5('0x25')](this[_0xc4d5('0xb')],![],this[_0xc4d5('0x26')][_0xc4d5('0x11')](this));};EmailImap[_0xc4d5('0x16')][_0xc4d5('0x26')]=function(_0x750b64,_0x2879d8){if(_0x750b64){this[_0xc4d5('0x14')](_0x750b64,!![]);}else{this[_0xc4d5('0x27')](_0xc4d5('0x28'),_0x2879d8);this['readUnseen']();}};EmailImap[_0xc4d5('0x16')]['handleCloseBox']=function(_0x441117){if(_0x441117){this[_0xc4d5('0x14')](_0x441117,!![]);}else{this[_0xc4d5('0x2')]['end']();}};EmailImap[_0xc4d5('0x16')][_0xc4d5('0x29')]=function(){this[_0xc4d5('0x2')][_0xc4d5('0x2a')]([_0xc4d5('0x2b')],this[_0xc4d5('0x2c')][_0xc4d5('0x11')](this));};EmailImap[_0xc4d5('0x16')][_0xc4d5('0x2c')]=function(_0x906e0a,_0x192971){if(_0x906e0a){this['handleError'](_0x906e0a,!![]);}else{if(_0x192971[_0xc4d5('0x2d')]){try{var _0xeaf31a=this[_0xc4d5('0x2')]['fetch'](_0x192971[_0xc4d5('0x2e')](0x0,0xa),{'bodies':'','markSeen':!![]});_0xeaf31a['on'](_0xc4d5('0x2f'),this[_0xc4d5('0x30')][_0xc4d5('0x11')](this));_0xeaf31a['once'](_0xc4d5('0x13'),this[_0xc4d5('0x31')]['bind'](this));_0xeaf31a['once'](_0xc4d5('0x32'),this[_0xc4d5('0x33')][_0xc4d5('0x11')](this));}catch(_0x47ff5b){logger[_0xc4d5('0x13')](_0x47ff5b);}}else{this[_0xc4d5('0x2')][_0xc4d5('0x34')](!![],this['handleCloseBox'][_0xc4d5('0x11')](this));}}};EmailImap[_0xc4d5('0x16')]['handleFetchMessage']=function(_0xadd6a4){_0xadd6a4['on'](_0xc4d5('0x35'),this[_0xc4d5('0x36')][_0xc4d5('0x11')](this));_0xadd6a4[_0xc4d5('0xe')](_0xc4d5('0x37'),this[_0xc4d5('0x38')][_0xc4d5('0x11')](this));_0xadd6a4[_0xc4d5('0xe')](_0xc4d5('0x32'),this[_0xc4d5('0x39')][_0xc4d5('0x11')](this));};EmailImap[_0xc4d5('0x16')]['handleMessageBody']=function(_0x51c98a){simpleParser(_0x51c98a,{'Iconv':Iconv},this[_0xc4d5('0x3a')]['bind'](this));};EmailImap[_0xc4d5('0x16')][_0xc4d5('0x38')]=function(){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0xc4d5('0x16')][_0xc4d5('0x3a')]=function(_0x301cd8,_0x56bb14){if(_0x301cd8){logger[_0xc4d5('0x13')](_0x301cd8);}else{var _0xfe78b4=this;utils[_0xc4d5('0x3b')](this[_0xc4d5('0xc')],_0x56bb14,function(_0x580da4){_0xfe78b4['emit'](_0xc4d5('0xa'),_0x580da4);});}};EmailImap[_0xc4d5('0x16')][_0xc4d5('0x33')]=function(){this[_0xc4d5('0x2')][_0xc4d5('0x34')](!![],this[_0xc4d5('0x3c')][_0xc4d5('0x11')](this));};EmailImap[_0xc4d5('0x16')][_0xc4d5('0x31')]=function(_0x3a8916){this[_0xc4d5('0x14')](_0x3a8916);this[_0xc4d5('0x2')]['closeBox'](!![],this[_0xc4d5('0x3c')]['bind'](this));};EmailImap['prototype'][_0xc4d5('0x12')]=function(){this[_0xc4d5('0x27')]('end');};EmailImap[_0xc4d5('0x16')][_0xc4d5('0x14')]=function(_0x37c0b5,_0x390fe1){logger[_0xc4d5('0x13')](_0xc4d5('0x14'),this['account'][_0xc4d5('0xa')],JSON[_0xc4d5('0x3d')](_0x37c0b5));var _0xfd9971='';if(_0x37c0b5){if(_0x37c0b5[_0xc4d5('0x3e')]){_0xfd9971=_0x37c0b5[_0xc4d5('0x3e')];}else{for(var _0x11d371 in _0x37c0b5){if(_0x37c0b5['hasOwnProperty'](_0x11d371)){_0xfd9971+=_[_0xc4d5('0x3f')](_0x11d371)+':\x20'+_0x37c0b5[_0x11d371]+'\x0a';}}}}if(_0x390fe1){this[_0xc4d5('0x2')][_0xc4d5('0x32')]();}else{this[_0xc4d5('0x27')](_0xc4d5('0x13'),_0xfd9971);this[_0xc4d5('0x27')](_0xc4d5('0x32'));}};module[_0xc4d5('0x40')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 0737dc5..7c40380 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 _0xe410=['createTransport','compile','prototype','verify','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','send'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe410,0x85));var _0x0e41=function(_0x4b6cc8,_0x355e5b){_0x4b6cc8=_0x4b6cc8-0x0;var _0x5c4743=_0xe410[_0x4b6cc8];return _0x5c4743;};'use strict';var nodemailer=require(_0x0e41('0x0'));var inlineBase64=require(_0x0e41('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x0e41('0x2')]=function(_0x4194e4,_0x57fa0b){return new Promise(function(_0x1060ef,_0x6e5db8){var _0x205e21=nodemailer[_0x0e41('0x3')](_0x4194e4);_0x205e21['use'](_0x0e41('0x4'),inlineBase64());_0x205e21['sendMail'](_0x57fa0b,function(_0x2d2d54,_0xb70445){if(_0x2d2d54){_0x6e5db8(_0x2d2d54['toString']());}else{_0x1060ef(_0xb70445);}});});};EmailSmtp[_0x0e41('0x5')][_0x0e41('0x6')]=function(_0x3e3bb7){return new Promise(function(_0x3296d1,_0x38c776){var _0x5d83db=nodemailer['createTransport'](_0x3e3bb7);_0x5d83db[_0x0e41('0x6')](function(_0x33a88e,_0x3cdbb5){if(_0x33a88e){_0x38c776(_0x33a88e['toString']());}else{if(_0x3cdbb5){_0x3296d1(_0x3cdbb5);}else{_0x38c776(_0x0e41('0x7'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x5e19=['prototype','send','compile','sendMail','toString','verify','createTransport','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5e19,0x1b6));var _0x95e1=function(_0x23b662,_0x36612b){_0x23b662=_0x23b662-0x0;var _0x34b58b=_0x5e19[_0x23b662];return _0x34b58b;};'use strict';var nodemailer=require(_0x95e1('0x0'));var inlineBase64=require(_0x95e1('0x1'));function EmailSmtp(){}EmailSmtp[_0x95e1('0x2')][_0x95e1('0x3')]=function(_0x18f738,_0x1ca7f4){return new Promise(function(_0x35aa7d,_0x567eae){var _0x498941=nodemailer['createTransport'](_0x18f738);_0x498941['use'](_0x95e1('0x4'),inlineBase64());_0x498941[_0x95e1('0x5')](_0x1ca7f4,function(_0x14409a,_0x236d5a){if(_0x14409a){_0x567eae(_0x14409a[_0x95e1('0x6')]());}else{_0x35aa7d(_0x236d5a);}});});};EmailSmtp[_0x95e1('0x2')][_0x95e1('0x7')]=function(_0x1d66a3){return new Promise(function(_0x189853,_0x3e2660){var _0x3a859c=nodemailer[_0x95e1('0x8')](_0x1d66a3);_0x3a859c[_0x95e1('0x7')](function(_0x3b84e1,_0x36c0b1){if(_0x3b84e1){_0x3e2660(_0x3b84e1[_0x95e1('0x6')]());}else{if(_0x36c0b1){_0x189853(_0x36c0b1);}else{_0x3e2660(_0x95e1('0x9'));}}});});};module[_0x95e1('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index a9af538..966972e 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 _0xe7ba=['address','generate','name','substring','indexOf','split','slice','join','Anonymous','head','length','pop','isEmpty','anonymous','@xcally.com','html','\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','user=','auth=Bearer\x20','utf-8','base64','lodash','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','value'];(function(_0x11b1c5,_0x2a6643){var _0x2f904e=function(_0x307551){while(--_0x307551){_0x11b1c5['push'](_0x11b1c5['shift']());}};_0x2f904e(++_0x2a6643);}(_0xe7ba,0x113));var _0xae7b=function(_0x4ed188,_0x340955){_0x4ed188=_0x4ed188-0x0;var _0x58b488=_0xe7ba[_0x4ed188];return _0x58b488;};'use strict';var _=require(_0xae7b('0x0'));var moment=require('moment');var random=require(_0xae7b('0x1'));var fs=require('fs');var path=require(_0xae7b('0x2'));var util=require(_0xae7b('0x3'));var tnef=require(_0xae7b('0x4'));var logger=require(_0xae7b('0x5'))(_0xae7b('0x6'));var config=require(_0xae7b('0x7'));function getAddress(_0x2a4468){var _0x59b348=_['head'](_0x2a4468[_0xae7b('0x8')]);return _0x59b348&&_0x59b348[_0xae7b('0x9')]?_0x59b348[_0xae7b('0x9')]:'anonymous'+random[_0xae7b('0xa')](0x6)+'@xcally.com';}function getFirstName(_0x21fb70){var _0x507376=_['head'](_0x21fb70[_0xae7b('0x8')]);if(_0x507376&&_0x507376[_0xae7b('0xb')]){if(_0x507376[_0xae7b('0xb')]==_0x507376['address']){return _0x507376['name'][_0xae7b('0xc')](0x0,_0x507376[_0xae7b('0xb')][_0xae7b('0xd')]('@'));}var _0x5a5dc1=_0x507376[_0xae7b('0xb')][_0xae7b('0xe')](/\s+/);return _0x5a5dc1['length']>0x1?_0x5a5dc1[_0xae7b('0xf')](0x0,-0x1)[_0xae7b('0x10')]('\x20'):_0x507376[_0xae7b('0xb')];}return _0xae7b('0x11');}function getLastName(_0x242c34){var _0x558dd5=_[_0xae7b('0x12')](_0x242c34['value']);if(_0x558dd5&&_0x558dd5[_0xae7b('0xb')]){var _0x2a27a2=_0x558dd5[_0xae7b('0xb')]['split'](/\s+/);return _0x2a27a2[_0xae7b('0x13')]>0x1?_0x2a27a2[_0xae7b('0x14')]():'';}return'';}function getMails(_0x3c0a22,_0x5dfc8f){var _0x4b577f='';for(var _0x288059=0x0;_0x288059<_0x5dfc8f[_0xae7b('0x8')][_0xae7b('0x13')];_0x288059+=0x1){if(_0x5dfc8f[_0xae7b('0x8')][_0x288059]['address']!==_0x3c0a22){if(!_[_0xae7b('0x15')](_0x4b577f)){_0x4b577f+=',';}_0x4b577f+=_0x5dfc8f[_0xae7b('0x8')][_0x288059][_0xae7b('0xb')]||_0x5dfc8f[_0xae7b('0x8')][_0x288059][_0xae7b('0x9')]||'';_0x4b577f+='\x20<';_0x4b577f+=_0x5dfc8f[_0xae7b('0x8')][_0x288059][_0xae7b('0x9')]?_0x5dfc8f[_0xae7b('0x8')][_0x288059][_0xae7b('0x9')]:_0xae7b('0x16')+random[_0xae7b('0xa')](0x6)+_0xae7b('0x17');_0x4b577f+='>';}}return _0x4b577f;}function parseEmail(_0xd02bfc,_0x580497,_0x2da0a3){if(_0x580497[_0xae7b('0x18')]){var _0x1caeed=/)<[^<]*)*<\/script>/gi;while(_0x1caeed['test'](_0x580497[_0xae7b('0x18')])){_0x580497[_0xae7b('0x18')]=_0x580497[_0xae7b('0x18')]['replace'](_0x1caeed,'');}if(_0x580497[_0xae7b('0x18')]['includes'](_0xae7b('0x19'))){var _0x31e863=[];_0x580497[_0xae7b('0x1a')]['forEach'](_0x4f572d=>{_0x31e863[_0xae7b('0x1b')](_0x4f572d['filename']);});var _0x192a12=/]+>/g;var _0x3de872=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5b1f02=_0x580497[_0xae7b('0x18')][_0xae7b('0x1c')](_0x3de872,'_SRC');var _0x4c9885=_0x5b1f02[_0xae7b('0x1c')](_0x192a12,_0xae7b('0x1d'));for(let _0x1ef51c=0x0;_0x1ef51c<_0x31e863['length'];_0x1ef51c++){var _0x1c796d=_0x4c9885[_0xae7b('0x1c')](_0xae7b('0x1d'),_0xae7b('0x1e')+_0x31e863[_0x1ef51c]+'\x20]');_0x4c9885=_0x1c796d;}_0x580497[_0xae7b('0x18')]=_0x4c9885;}_0x2da0a3[_0xae7b('0x1f')]=_0x580497['html'];}else{_0x2da0a3['body']=_0x580497[_0xae7b('0x20')];}if(_0x2da0a3[_0xae7b('0x1f')]){_0x2da0a3[_0xae7b('0x1f')]=_0x2da0a3['body'][_0xae7b('0x1c')](/0x0){var _0x327373=[_0xae7b('0x32'),_0xae7b('0x33'),_0xae7b('0x34')];for(var _0x3c40f8=0x0;_0x3c40f8<_0x580497[_0xae7b('0x31')][_0xae7b('0x13')];_0x3c40f8++){var _0x315341=_[_0xae7b('0xd')](_0x327373,_0x580497['headerLines'][_0x3c40f8]['line']);if(_0x315341>=0x0){_0x2da0a3[_0xae7b('0x35')]=!![];}}}return _0x2da0a3;}exports[_0xae7b('0x36')]=function(_0x2e7347,_0x4120d5,_0x10cd4a){var _0x4b76f1={'from':getAddress(_0x4120d5[_0xae7b('0x37')]),'firstName':getFirstName(_0x4120d5['from']),'lastName':getLastName(_0x4120d5[_0xae7b('0x37')]),'mapKey':_0xae7b('0x6'),'message':{'from':getMails(_0x2e7347[_0xae7b('0x6')],_0x4120d5[_0xae7b('0x37')]),'to':_0x2e7347[_0xae7b('0x6')],'cc':'','subject':_0x4120d5[_0xae7b('0x38')]||'','messageId':_0x4120d5[_0xae7b('0x39')],'inReplyTo':_0x4120d5[_0xae7b('0x3a')],'sentAt':moment(_0x4120d5[_0xae7b('0x3b')])['format'](_0xae7b('0x3c')),'attach':![],'attachments':[]}};if(!_0x4120d5['html']&&!_0x4120d5[_0xae7b('0x20')]){var _0x15d47e=_['filter'](_0x4120d5['attachments'],{'contentType':'application/ms-tnef'});if(_0x15d47e[_0xae7b('0x13')]){logger['info'](util[_0xae7b('0x3d')](_0xae7b('0x3e'),_0x4120d5[_0xae7b('0x39')]));tnef['parseBuffer'](_['first'](_0x15d47e)[_0xae7b('0x2f')],function(_0x3a9faf,_0x345953){if(_0x345953){_0x4120d5[_0xae7b('0x18')]=_0x345953['BodyHTML']||_0xae7b('0x3f');if(_0x345953[_0xae7b('0x40')]){for(var _0xc4508=0x0;_0xc4508<_0x345953[_0xae7b('0x40')][_0xae7b('0x13')];_0xc4508++){var _0x59306d=_0x345953[_0xae7b('0x40')][_0xc4508];_0x4b76f1['message']['attachments']['push']({'filename':_0x59306d[_0xae7b('0x41')],'content':Buffer[_0xae7b('0x37')](_0x59306d[_0xae7b('0x42')])});}}}_0x10cd4a(parseEmail(_0x2e7347,_0x4120d5,_0x4b76f1));});}else{_0x4120d5[_0xae7b('0x18')]='

Empty\x20message

';_0x10cd4a(parseEmail(_0x2e7347,_0x4120d5,_0x4b76f1));}}else{_0x10cd4a(parseEmail(_0x2e7347,_0x4120d5,_0x4b76f1));}};exports['generateXOAuth2Token']=function(_0x5159f3,_0x51a10b){var _0x41a823=[_0xae7b('0x43')+(_0x51a10b||''),_0xae7b('0x44')+_0x5159f3,'',''];return Buffer['from'](_0x41a823[_0xae7b('0x10')](''),_0xae7b('0x45'))['toString'](_0xae7b('0x46'));}; \ No newline at end of file +var _0xb862=['anonymous','generate','@xcally.com','head','name','substring','indexOf','split','length','slice','join','Anonymous','html','test','replace','includes','','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','toString','base64','lodash','moment','path','util','node-tnef','email','../../../config/environment','value','address'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb862,0x8d));var _0x2b86=function(_0x5c120a,_0x1a9450){_0x5c120a=_0x5c120a-0x0;var _0x2ce3e0=_0xb862[_0x5c120a];return _0x2ce3e0;};'use strict';var _=require(_0x2b86('0x0'));var moment=require(_0x2b86('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0x2b86('0x2'));var util=require(_0x2b86('0x3'));var tnef=require(_0x2b86('0x4'));var logger=require('../../../config/logger')(_0x2b86('0x5'));var config=require(_0x2b86('0x6'));function getAddress(_0x501555){var _0x495761=_['head'](_0x501555[_0x2b86('0x7')]);return _0x495761&&_0x495761[_0x2b86('0x8')]?_0x495761[_0x2b86('0x8')]:_0x2b86('0x9')+random[_0x2b86('0xa')](0x6)+_0x2b86('0xb');}function getFirstName(_0x46e12c){var _0x3151be=_[_0x2b86('0xc')](_0x46e12c[_0x2b86('0x7')]);if(_0x3151be&&_0x3151be[_0x2b86('0xd')]){if(_0x3151be[_0x2b86('0xd')]==_0x3151be['address']){return _0x3151be['name'][_0x2b86('0xe')](0x0,_0x3151be['name'][_0x2b86('0xf')]('@'));}var _0x1c1e75=_0x3151be['name'][_0x2b86('0x10')](/\s+/);return _0x1c1e75[_0x2b86('0x11')]>0x1?_0x1c1e75[_0x2b86('0x12')](0x0,-0x1)[_0x2b86('0x13')]('\x20'):_0x3151be[_0x2b86('0xd')];}return _0x2b86('0x14');}function getLastName(_0x54f67d){var _0x46acd2=_[_0x2b86('0xc')](_0x54f67d[_0x2b86('0x7')]);if(_0x46acd2&&_0x46acd2[_0x2b86('0xd')]){var _0x580ec0=_0x46acd2['name'][_0x2b86('0x10')](/\s+/);return _0x580ec0[_0x2b86('0x11')]>0x1?_0x580ec0['pop']():'';}return'';}function getMails(_0x11c829,_0x34c740){var _0x2dc45a='';for(var _0x24fe06=0x0;_0x24fe06<_0x34c740[_0x2b86('0x7')][_0x2b86('0x11')];_0x24fe06+=0x1){if(_0x34c740[_0x2b86('0x7')][_0x24fe06][_0x2b86('0x8')]!==_0x11c829){if(!_['isEmpty'](_0x2dc45a)){_0x2dc45a+=',';}_0x2dc45a+=_0x34c740['value'][_0x24fe06]['name']||_0x34c740[_0x2b86('0x7')][_0x24fe06][_0x2b86('0x8')]||'';_0x2dc45a+='\x20<';_0x2dc45a+=_0x34c740[_0x2b86('0x7')][_0x24fe06][_0x2b86('0x8')]?_0x34c740[_0x2b86('0x7')][_0x24fe06][_0x2b86('0x8')]:_0x2b86('0x9')+random[_0x2b86('0xa')](0x6)+'@xcally.com';_0x2dc45a+='>';}}return _0x2dc45a;}function parseEmail(_0x5c0ae9,_0x45eb83,_0x533b54){if(_0x45eb83[_0x2b86('0x15')]){var _0x180c1e=/)<[^<]*)*<\/script>/gi;while(_0x180c1e[_0x2b86('0x16')](_0x45eb83[_0x2b86('0x15')])){_0x45eb83['html']=_0x45eb83[_0x2b86('0x15')][_0x2b86('0x17')](_0x180c1e,'');}if(_0x45eb83[_0x2b86('0x15')][_0x2b86('0x18')](_0x2b86('0x19'))){var _0x14ef4f=[];_0x45eb83[_0x2b86('0x1a')][_0x2b86('0x1b')](_0x3e4eb1=>{_0x14ef4f['push'](_0x3e4eb1[_0x2b86('0x1c')]);});var _0x525ec9=/]+>/g;var _0x3b1191=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x11d609=_0x45eb83['html']['replace'](_0x3b1191,_0x2b86('0x1d'));var _0x533f2c=_0x11d609[_0x2b86('0x17')](_0x525ec9,_0x2b86('0x1e'));for(let _0x2d143e=0x0;_0x2d143e<_0x14ef4f['length'];_0x2d143e++){var _0x3d91b9=_0x533f2c[_0x2b86('0x17')](_0x2b86('0x1e'),'\x20[Attachment:\x20'+_0x14ef4f[_0x2d143e]+_0x2b86('0x1f'));_0x533f2c=_0x3d91b9;}_0x45eb83['html']=_0x533f2c;}_0x533b54[_0x2b86('0x20')]=_0x45eb83[_0x2b86('0x15')];}else{_0x533b54[_0x2b86('0x20')]=_0x45eb83[_0x2b86('0x21')];}if(_0x533b54['body']){_0x533b54[_0x2b86('0x20')]=_0x533b54[_0x2b86('0x20')][_0x2b86('0x17')](/0x0){var _0x7148c=[_0x2b86('0x31'),_0x2b86('0x32'),_0x2b86('0x33')];for(var _0x4e5097=0x0;_0x4e5097<_0x45eb83[_0x2b86('0x34')][_0x2b86('0x11')];_0x4e5097++){var _0x582b0c=_[_0x2b86('0xf')](_0x7148c,_0x45eb83[_0x2b86('0x34')][_0x4e5097][_0x2b86('0x35')]);if(_0x582b0c>=0x0){_0x533b54[_0x2b86('0x36')]=!![];}}}return _0x533b54;}exports[_0x2b86('0x37')]=function(_0x254fef,_0x8abec4,_0x58f730){var _0x1c1e8a={'from':getAddress(_0x8abec4[_0x2b86('0x38')]),'firstName':getFirstName(_0x8abec4[_0x2b86('0x38')]),'lastName':getLastName(_0x8abec4['from']),'mapKey':_0x2b86('0x5'),'message':{'from':getMails(_0x254fef['email'],_0x8abec4[_0x2b86('0x38')]),'to':_0x254fef[_0x2b86('0x5')],'cc':'','subject':_0x8abec4['subject']||'','messageId':_0x8abec4[_0x2b86('0x39')],'inReplyTo':_0x8abec4['inReplyTo'],'sentAt':moment(_0x8abec4[_0x2b86('0x3a')])['format'](_0x2b86('0x3b')),'attach':![],'attachments':[]}};if(!_0x8abec4[_0x2b86('0x15')]&&!_0x8abec4[_0x2b86('0x21')]){var _0x353cd3=_[_0x2b86('0x3c')](_0x8abec4[_0x2b86('0x1a')],{'contentType':_0x2b86('0x3d')});if(_0x353cd3['length']){logger[_0x2b86('0x3e')](util[_0x2b86('0x3f')](_0x2b86('0x40'),_0x8abec4[_0x2b86('0x39')]));tnef[_0x2b86('0x41')](_['first'](_0x353cd3)[_0x2b86('0x2f')],function(_0x7655a1,_0x2d4711){if(_0x2d4711){_0x8abec4[_0x2b86('0x15')]=_0x2d4711[_0x2b86('0x42')]||_0x2b86('0x43');if(_0x2d4711[_0x2b86('0x44')]){for(var _0x277ad5=0x0;_0x277ad5<_0x2d4711[_0x2b86('0x44')][_0x2b86('0x11')];_0x277ad5++){var _0x4c0fb1=_0x2d4711[_0x2b86('0x44')][_0x277ad5];_0x1c1e8a[_0x2b86('0x23')][_0x2b86('0x1a')][_0x2b86('0x30')]({'filename':_0x4c0fb1[_0x2b86('0x45')],'content':Buffer[_0x2b86('0x38')](_0x4c0fb1[_0x2b86('0x46')])});}}}_0x58f730(parseEmail(_0x254fef,_0x8abec4,_0x1c1e8a));});}else{_0x8abec4[_0x2b86('0x15')]=_0x2b86('0x43');_0x58f730(parseEmail(_0x254fef,_0x8abec4,_0x1c1e8a));}}else{_0x58f730(parseEmail(_0x254fef,_0x8abec4,_0x1c1e8a));}};exports[_0x2b86('0x47')]=function(_0x447620,_0x44ec94){var _0x1a7135=[_0x2b86('0x48')+(_0x44ec94||''),'auth=Bearer\x20'+_0x447620,'',''];return Buffer[_0x2b86('0x38')](_0x1a7135['join'](''),'utf-8')[_0x2b86('0x49')](_0x2b86('0x4a'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 82daefa..fb01b76 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 _0x03ef=['Service','key','SERV','active','Imap','Smtp','exports','name'];(function(_0x4428b2,_0x124514){var _0x16e15c=function(_0x367c70){while(--_0x367c70){_0x4428b2['push'](_0x4428b2['shift']());}};_0x16e15c(++_0x124514);}(_0x03ef,0x1b7));var _0xf03e=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x03ef[_0x10004e];return _0x5af990;};'use strict';var _=require('lodash');function MailAccount(_0x5cb602){this['id']=_0x5cb602['id']||0x0;this[_0xf03e('0x0')]=_0x5cb602['name']||_0xf03e('0x1');this[_0xf03e('0x2')]=_0x5cb602['key']||_0xf03e('0x3');this[_0xf03e('0x4')]=_0x5cb602[_0xf03e('0x4')]||![];this[_0xf03e('0x5')]=_0x5cb602[_0xf03e('0x5')]||[];this[_0xf03e('0x6')]=_0x5cb602[_0xf03e('0x6')]||[];}module[_0xf03e('0x7')]=MailAccount; \ No newline at end of file +var _0x2e8a=['Imap','Smtp','exports','name','Service','key','SERV','active'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x2e8a,0x163));var _0xa2e8=function(_0x3ab687,_0x2f3a18){_0x3ab687=_0x3ab687-0x0;var _0x512596=_0x2e8a[_0x3ab687];return _0x512596;};'use strict';var _=require('lodash');function MailAccount(_0x249269){this['id']=_0x249269['id']||0x0;this['name']=_0x249269[_0xa2e8('0x0')]||_0xa2e8('0x1');this[_0xa2e8('0x2')]=_0x249269[_0xa2e8('0x2')]||_0xa2e8('0x3');this[_0xa2e8('0x4')]=_0x249269[_0xa2e8('0x4')]||![];this[_0xa2e8('0x5')]=_0x249269[_0xa2e8('0x5')]||[];this[_0xa2e8('0x6')]=_0x249269[_0xa2e8('0x6')]||[];}module[_0xa2e8('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index a63d044..deb51d2 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 _0x42d1=['prototype','initMailAccounts','length','merge','mailAccounts','mapKeys','mergeFromDatabase','hasOwnProperty'];(function(_0x386fd2,_0x3fed45){var _0x2f4ec5=function(_0x21d6af){while(--_0x21d6af){_0x386fd2['push'](_0x386fd2['shift']());}};_0x2f4ec5(++_0x3fed45);}(_0x42d1,0x1ec));var _0x142d=function(_0xfcac94,_0x4f2f94){_0xfcac94=_0xfcac94-0x0;var _0xc039c0=_0x42d1[_0xfcac94];return _0xc039c0;};'use strict';var _=require('lodash');var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x142d('0x0')]={};};function freeIsNotKey(_0x4652c0,_0xd55a91,_0x4d9444){var _0x4373f9=_[_0x142d('0x1')](_0x4652c0,function(_0x595982,_0x2eeffd){return _0x595982[_0x4d9444];});for(var _0x9c4d6f in _0xd55a91){if(_0xd55a91['hasOwnProperty'](_0x9c4d6f)){if(!_0x4373f9[_0x9c4d6f]){delete _0xd55a91[_0x9c4d6f];}}}}Realtime['prototype'][_0x142d('0x2')]=function(_0x434abd,_0x2b11d0){for(var _0x28df78 in _0x2b11d0){if(_0x434abd[_0x142d('0x3')](_0x28df78)){_0x434abd[_0x28df78]=_0x2b11d0[_0x28df78];}}};Realtime[_0x142d('0x4')][_0x142d('0x5')]=function(){var _0x564568=this;return function(_0x33a8ca){if(_0x33a8ca){freeIsNotKey(_0x33a8ca,_0x564568['mailAccounts'],'id');for(var _0x558736=0x0,_0x2d6aff={},_0x38c387={};_0x558736<_0x33a8ca[_0x142d('0x6')];_0x558736+=0x1){_0x2d6aff=_0x33a8ca[_0x558736];if(_['isUndefined'](_0x564568['mailAccounts'][_0x2d6aff['id']])){_0x564568[_0x142d('0x0')][_0x2d6aff['id']]=new MailAccount(_0x2d6aff);}else{_[_0x142d('0x7')](_0x564568[_0x142d('0x0')][_0x2d6aff['id']],_0x2d6aff);}}}return _0x564568[_0x142d('0x0')];};};module['exports']=Realtime; \ No newline at end of file +var _0xb212=['hasOwnProperty','prototype','initMailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts'];(function(_0x2837a2,_0x25fc73){var _0x2ebe0c=function(_0x37c0cd){while(--_0x37c0cd){_0x2837a2['push'](_0x2837a2['shift']());}};_0x2ebe0c(++_0x25fc73);}(_0xb212,0x11f));var _0x2b21=function(_0x290edc,_0x529f3e){_0x290edc=_0x290edc-0x0;var _0x5cdd4c=_0xb212[_0x290edc];return _0x5cdd4c;};'use strict';var _=require(_0x2b21('0x0'));var MailAccount=require(_0x2b21('0x1'));var Realtime=function(){this[_0x2b21('0x2')]={};};function freeIsNotKey(_0x5cb749,_0x3294e2,_0x487d01){var _0x53efeb=_['mapKeys'](_0x5cb749,function(_0x1c9dd2,_0x1053cf){return _0x1c9dd2[_0x487d01];});for(var _0x250a39 in _0x3294e2){if(_0x3294e2[_0x2b21('0x3')](_0x250a39)){if(!_0x53efeb[_0x250a39]){delete _0x3294e2[_0x250a39];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x43332e,_0x1cd0a1){for(var _0x30c7d5 in _0x1cd0a1){if(_0x43332e[_0x2b21('0x3')](_0x30c7d5)){_0x43332e[_0x30c7d5]=_0x1cd0a1[_0x30c7d5];}}};Realtime[_0x2b21('0x4')][_0x2b21('0x5')]=function(){var _0x40e5f3=this;return function(_0x1143b){if(_0x1143b){freeIsNotKey(_0x1143b,_0x40e5f3[_0x2b21('0x2')],'id');for(var _0x95d281=0x0,_0x164501={},_0x1942fd={};_0x95d281<_0x1143b[_0x2b21('0x6')];_0x95d281+=0x1){_0x164501=_0x1143b[_0x95d281];if(_[_0x2b21('0x7')](_0x40e5f3['mailAccounts'][_0x164501['id']])){_0x40e5f3['mailAccounts'][_0x164501['id']]=new MailAccount(_0x164501);}else{_[_0x2b21('0x8')](_0x40e5f3[_0x2b21('0x2')][_0x164501['id']],_0x164501);}}}return _0x40e5f3[_0x2b21('0x2')];};};module[_0x2b21('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 3149522..3a1bf00 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 _0x0a01=['key','ListId','TemplateId','MailServerIn','Imap','name','type','data5','CloudProvider','MailServerOut','Request','NotifyMailAccount','GetMailAccount','service','active'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x0a01,0x10b));var _0x10a0=function(_0x3fc11a,_0x5bad9d){_0x3fc11a=_0x3fc11a-0x0;var _0x4a0918=_0x0a01[_0x3fc11a];return _0x4a0918;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client['Request'](_0x10a0('0x0'),{'options':{'attributes':['id','name','provider',_0x10a0('0x1'),'email',_0x10a0('0x2'),_0x10a0('0x3'),_0x10a0('0x4'),_0x10a0('0x5')],'raw':![],'include':[{'model':_0x10a0('0x6'),'as':_0x10a0('0x7'),'include':[{'model':'CloudProvider','attributes':['id',_0x10a0('0x8'),_0x10a0('0x1'),_0x10a0('0x9'),_0x10a0('0xa')],'as':_0x10a0('0xb')}]},{'model':_0x10a0('0xc'),'as':'Smtp','include':[{'model':_0x10a0('0xb'),'attributes':['id',_0x10a0('0x8'),_0x10a0('0x1'),'type','data5'],'as':_0x10a0('0xb')}]}]},'log':'getMailAccount'});};};exports['notify']=function(_0x3d4bf9,_0x5eb1b5){return client[_0x10a0('0xd')](_0x10a0('0xe'),{'account':{'id':_0x3d4bf9},'body':_0x5eb1b5,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x4540=['MailServerOut','Smtp','type','notify','NotifyMailAccount','../client','getMailAccounts','provider','email','active','key','ListId','TemplateId','MailServerIn','CloudProvider','service','data5'];(function(_0x545a1b,_0x4236f0){var _0x5b29a5=function(_0x4901f5){while(--_0x4901f5){_0x545a1b['push'](_0x545a1b['shift']());}};_0x5b29a5(++_0x4236f0);}(_0x4540,0x17b));var _0x0454=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4540[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x0454('0x0'));exports[_0x0454('0x1')]=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id','name',_0x0454('0x2'),'service',_0x0454('0x3'),_0x0454('0x4'),_0x0454('0x5'),_0x0454('0x6'),_0x0454('0x7')],'raw':![],'include':[{'model':_0x0454('0x8'),'as':'Imap','include':[{'model':_0x0454('0x9'),'attributes':['id','name',_0x0454('0xa'),'type',_0x0454('0xb')],'as':'CloudProvider'}]},{'model':_0x0454('0xc'),'as':_0x0454('0xd'),'include':[{'model':_0x0454('0x9'),'attributes':['id','name',_0x0454('0xa'),_0x0454('0xe'),_0x0454('0xb')],'as':_0x0454('0x9')}]}]},'log':'getMailAccount'});};};exports[_0x0454('0xf')]=function(_0x3bbcec,_0x4d6760){return client['Request'](_0x0454('0x10'),{'account':{'id':_0x3bbcec},'body':_0x4d6760,'log':_0x0454('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 97efb81..3dbb44a 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 _0xbebc=['GetSettings','../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x4207f4,_0x1f778b){var _0x29a621=function(_0xa6f5b7){while(--_0xa6f5b7){_0x4207f4['push'](_0x4207f4['shift']());}};_0x29a621(++_0x1f778b);}(_0xbebc,0x10f));var _0xcbeb=function(_0x10a7e9,_0x3c714a){_0x10a7e9=_0x10a7e9-0x0;var _0x1453d9=_0xbebc[_0x10a7e9];return _0x1453d9;};'use strict';var client=require(_0xcbeb('0x0'));exports[_0xcbeb('0x1')]=function(){return client[_0xcbeb('0x2')](_0xcbeb('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xcbeb('0x4')]},'log':_0xcbeb('0x5')});}; \ No newline at end of file +var _0xd49b=['loginMailFrequency','../client','getSettings','ShowSetting'];(function(_0x4d544a,_0x3aa5cd){var _0x21b3f6=function(_0x3f171b){while(--_0x3f171b){_0x4d544a['push'](_0x4d544a['shift']());}};_0x21b3f6(++_0x3aa5cd);}(_0xd49b,0xf1));var _0xbd49=function(_0x4d4f61,_0x56d7a7){_0x4d4f61=_0x4d4f61-0x0;var _0x297414=_0xd49b[_0x4d4f61];return _0x297414;};'use strict';var client=require(_0xbd49('0x0'));exports[_0xbd49('0x1')]=function(){return client['Request'](_0xbd49('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbd49('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 61a0117..f4af34e 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 612191c..90b6481 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 _0x7319=['timeout','listen','socket.io','websocket','polling','defaults','redis','socket.io-redis','../../config/triggers','../../config/express','default','../../routes','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','express','ioredis','../../config/environment','createServer'];(function(_0x52949d,_0x5750ec){var _0x570250=function(_0xd9636a){while(--_0xd9636a){_0x52949d['push'](_0x52949d['shift']());}};_0x570250(++_0x5750ec);}(_0x7319,0x121));var _0x9731=function(_0x201404,_0x3b8dc2){_0x201404=_0x201404-0x0;var _0x39a021=_0x7319[_0x201404];return _0x39a021;};'use strict';var _=require(_0x9731('0x0'));var http=require('http');var express=require(_0x9731('0x1'));var sticky=require('sticky-session');var Redis=require(_0x9731('0x2'));var config=require(_0x9731('0x3'));var app=express();var server=http[_0x9731('0x4')](app);server[_0x9731('0x5')]=0xdbba0;if(sticky[_0x9731('0x6')](server,config['port'])){var socketio=require(_0x9731('0x7'))(server,{'transports':[_0x9731('0x8'),_0x9731('0x9')]});config['redis']=_[_0x9731('0xa')](config[_0x9731('0xb')],{'host':'localhost','port':0x18eb});socketio['adapter'](require(_0x9731('0xc'))({'pubClient':new Redis(config[_0x9731('0xb')]),'subClient':new Redis(config[_0x9731('0xb')])}));require(_0x9731('0xd'))['default']();require('../../config/socketio')['default'](socketio);require(_0x9731('0xe'))[_0x9731('0xf')](app);require(_0x9731('0x10'))['default'](app);}else{server['once'](_0x9731('0x11'),function(){console['log'](_0x9731('0x12'),config[_0x9731('0x13')]);});}exports=module[_0x9731('0x14')]=app; \ No newline at end of file +var _0xe686=['Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','sticky-session','ioredis','../../config/environment','createServer','timeout','port','socket.io','websocket','polling','redis','defaults','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../routes','once','listening','log'];(function(_0x2d5369,_0x3c68b3){var _0x4931b3=function(_0x4a12f0){while(--_0x4a12f0){_0x2d5369['push'](_0x2d5369['shift']());}};_0x4931b3(++_0x3c68b3);}(_0xe686,0xaa));var _0x6e68=function(_0x561bc3,_0x3e9a4c){_0x561bc3=_0x561bc3-0x0;var _0x426d1f=_0xe686[_0x561bc3];return _0x426d1f;};'use strict';var _=require(_0x6e68('0x0'));var http=require(_0x6e68('0x1'));var express=require('express');var sticky=require(_0x6e68('0x2'));var Redis=require(_0x6e68('0x3'));var config=require(_0x6e68('0x4'));var app=express();var server=http[_0x6e68('0x5')](app);server[_0x6e68('0x6')]=0xdbba0;if(sticky['listen'](server,config[_0x6e68('0x7')])){var socketio=require(_0x6e68('0x8'))(server,{'transports':[_0x6e68('0x9'),_0x6e68('0xa')]});config[_0x6e68('0xb')]=_[_0x6e68('0xc')](config[_0x6e68('0xb')],{'host':'localhost','port':0x18eb});socketio[_0x6e68('0xd')](require(_0x6e68('0xe'))({'pubClient':new Redis(config[_0x6e68('0xb')]),'subClient':new Redis(config['redis'])}));require(_0x6e68('0xf'))[_0x6e68('0x10')]();require(_0x6e68('0x11'))[_0x6e68('0x10')](socketio);require('../../config/express')[_0x6e68('0x10')](app);require(_0x6e68('0x12'))[_0x6e68('0x10')](app);}else{server[_0x6e68('0x13')](_0x6e68('0x14'),function(){console[_0x6e68('0x15')](_0x6e68('0x16'),config[_0x6e68('0x7')]);});}exports=module[_0x6e68('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index dd3187a..b658499 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 _0x4fb8=['request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request'];(function(_0x1cab05,_0x353245){var _0x4d0539=function(_0x22780a){while(--_0x22780a){_0x1cab05['push'](_0x1cab05['shift']());}};_0x4d0539(++_0x353245);}(_0x4fb8,0x99));var _0x84fb=function(_0x1d93f2,_0x5b6de7){_0x1d93f2=_0x1d93f2-0x0;var _0x4d9bc4=_0x4fb8[_0x1d93f2];return _0x4d9bc4;};'use strict';var jayson=require(_0x84fb('0x0'));var BPromise=require(_0x84fb('0x1'));var logger=require(_0x84fb('0x2'))(_0x84fb('0x3'));var client=jayson[_0x84fb('0x4')][_0x84fb('0x5')]({'port':0x2329});client[_0x84fb('0x6')]=function(_0x2f3510,_0x16b351){return new BPromise(function(_0x543095,_0x4c6c07){return client[_0x84fb('0x7')](_0x2f3510,_0x16b351)[_0x84fb('0x8')](function(_0xc4952d){logger[_0x84fb('0x9')](_0x84fb('0xa'),'routing',_0x2f3510,_0x16b351,_0xc4952d);if(_0xc4952d[_0x84fb('0xb')]){logger[_0x84fb('0xb')]('rpc',_0x84fb('0x3'),_0x2f3510,_0xc4952d[_0x84fb('0xb')][_0x84fb('0xc')],_0x16b351);return _0x4c6c07(_0xc4952d[_0x84fb('0xb')][_0x84fb('0xc')]);}else{return _0x543095(_0xc4952d[_0x84fb('0xd')]);}})[_0x84fb('0xe')](function(_0x90ddb7){logger['error'](_0x84fb('0xa'),_0x84fb('0x3'),_0x2f3510,_0x90ddb7,_0x16b351);return _0x4c6c07(_0x90ddb7);});});};module[_0x84fb('0xf')]=client; \ No newline at end of file +var _0x2545=['exports','../../config/logger','routing','http','request','then','debug','rpc','error','result','catch'];(function(_0x3ea05e,_0x11d595){var _0x345bc8=function(_0x58e6b1){while(--_0x58e6b1){_0x3ea05e['push'](_0x3ea05e['shift']());}};_0x345bc8(++_0x11d595);}(_0x2545,0xb1));var _0x5254=function(_0x33f6d4,_0x3215db){_0x33f6d4=_0x33f6d4-0x0;var _0x1c8eb5=_0x2545[_0x33f6d4];return _0x1c8eb5;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x5254('0x0'))(_0x5254('0x1'));var client=jayson['client'][_0x5254('0x2')]({'port':0x2329});client['Request']=function(_0x5ab5f6,_0x5197f9){return new BPromise(function(_0x48e000,_0x445cab){return client[_0x5254('0x3')](_0x5ab5f6,_0x5197f9)[_0x5254('0x4')](function(_0x3528ad){logger[_0x5254('0x5')](_0x5254('0x6'),_0x5254('0x1'),_0x5ab5f6,_0x5197f9,_0x3528ad);if(_0x3528ad[_0x5254('0x7')]){logger['error'](_0x5254('0x6'),_0x5254('0x1'),_0x5ab5f6,_0x3528ad[_0x5254('0x7')]['message'],_0x5197f9);return _0x445cab(_0x3528ad[_0x5254('0x7')]['message']);}else{return _0x48e000(_0x3528ad[_0x5254('0x8')]);}})[_0x5254('0x9')](function(_0x5a7d8f){logger[_0x5254('0x7')](_0x5254('0x6'),'routing',_0x5ab5f6,_0x5a7d8f,_0x5197f9);return _0x445cab(_0x5a7d8f);});});};module[_0x5254('0xa')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 238d98e..3d2ca5c 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 _0xa9e3=['getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','./server','./realtime','./rpc/user','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues'];(function(_0x24edd1,_0x128dda){var _0x685fcb=function(_0x273d2e){while(--_0x273d2e){_0x24edd1['push'](_0x24edd1['shift']());}};_0x685fcb(++_0x128dda);}(_0xa9e3,0xd6));var _0x3a9e=function(_0xb13b40,_0x19fb84){_0xb13b40=_0xb13b40-0x0;var _0x1acea1=_0xa9e3[_0xb13b40];return _0x1acea1;};'use strict';var BPromise=require('bluebird');var server=require(_0x3a9e('0x0'));var Realtime=require(_0x3a9e('0x1'));var user=require(_0x3a9e('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x3a9e('0x3'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x3a9e('0x4'));var faxQueue=require(_0x3a9e('0x5'));var whatsappQueue=require(_0x3a9e('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x3a9e('0x7')]()['then'](user['getAgents']())[_0x3a9e('0x8')](realtime[_0x3a9e('0x9')]())[_0x3a9e('0x8')](interval[_0x3a9e('0xa')]())['then'](realtime[_0x3a9e('0xb')]())[_0x3a9e('0x8')](openchannelQueue[_0x3a9e('0xc')]())[_0x3a9e('0x8')](realtime[_0x3a9e('0xd')]())[_0x3a9e('0x8')](chatQueue[_0x3a9e('0xe')]())[_0x3a9e('0x8')](realtime[_0x3a9e('0xf')]())[_0x3a9e('0x8')](smsQueue[_0x3a9e('0x10')]())[_0x3a9e('0x8')](realtime[_0x3a9e('0x11')]())[_0x3a9e('0x8')](mailQueue[_0x3a9e('0x12')]())[_0x3a9e('0x8')](realtime[_0x3a9e('0x13')]())[_0x3a9e('0x8')](faxQueue[_0x3a9e('0x14')]())[_0x3a9e('0x8')](realtime[_0x3a9e('0x15')]())[_0x3a9e('0x8')](whatsappQueue[_0x3a9e('0x16')]())[_0x3a9e('0x8')](realtime[_0x3a9e('0x17')]())[_0x3a9e('0x8')](function(){return realtime;});}function main(){return server[_0x3a9e('0x18')](realtime)[_0x3a9e('0x8')](function(_0x4f6055){return initRealtime();})[_0x3a9e('0x8')](function(_0xb17355){return setInterval(initRealtime,0x1388);})[_0x3a9e('0x19')](function(_0x590544){console['log'](_0x590544);});}main(); \ No newline at end of file +var _0x9ecf=['./server','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','then','getIntervals','initIntervals','getOpenchannelQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getWhatsappQueues','initWhatsappQueues','catch','log','bluebird'];(function(_0x2b5486,_0x205de8){var _0x2aeeb7=function(_0x46f96a){while(--_0x46f96a){_0x2b5486['push'](_0x2b5486['shift']());}};_0x2aeeb7(++_0x205de8);}(_0x9ecf,0x18f));var _0xf9ec=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0x9ecf[_0x251d9c];return _0x16ae64;};'use strict';var BPromise=require(_0xf9ec('0x0'));var server=require(_0xf9ec('0x1'));var Realtime=require('./realtime');var user=require(_0xf9ec('0x2'));var interval=require(_0xf9ec('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xf9ec('0x4'));var smsQueue=require(_0xf9ec('0x5'));var mailQueue=require(_0xf9ec('0x6'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xf9ec('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xf9ec('0x8')](user['getAgents']())['then'](realtime['initAgents']())[_0xf9ec('0x8')](interval[_0xf9ec('0x9')]())[_0xf9ec('0x8')](realtime[_0xf9ec('0xa')]())['then'](openchannelQueue[_0xf9ec('0xb')]())[_0xf9ec('0x8')](realtime['initOpenchannelQueues']())['then'](chatQueue['getChatQueues']())[_0xf9ec('0x8')](realtime[_0xf9ec('0xc')]())[_0xf9ec('0x8')](smsQueue['getSmsQueues']())[_0xf9ec('0x8')](realtime[_0xf9ec('0xd')]())[_0xf9ec('0x8')](mailQueue[_0xf9ec('0xe')]())[_0xf9ec('0x8')](realtime[_0xf9ec('0xf')]())[_0xf9ec('0x8')](faxQueue['getFaxQueues']())[_0xf9ec('0x8')](realtime['initFaxQueues']())[_0xf9ec('0x8')](whatsappQueue[_0xf9ec('0x10')]())[_0xf9ec('0x8')](realtime[_0xf9ec('0x11')]())[_0xf9ec('0x8')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xf9ec('0x8')](function(_0x124c4b){return initRealtime();})[_0xf9ec('0x8')](function(_0x58bdf2){return setInterval(initRealtime,0x1388);})[_0xf9ec('0x12')](function(_0x5c8956){console[_0xf9ec('0x13')](_0x5c8956);});}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 cc26163..71aa13d 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x43a587,_0x27609){var _0x300c3b=function(_0x1bf194){while(--_0x1bf194){_0x43a587['push'](_0x43a587['shift']());}};_0x300c3b(++_0x27609);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xc4aa[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _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(_0x14d233,_0x4289f7){var _0x2d4c76=function(_0x29ef14){while(--_0x29ef14){_0x14d233['push'](_0x14d233['shift']());}};_0x2d4c76(++_0x4289f7);}(_0x326f,0xd1));var _0xf326=function(_0x592298,_0x131eec){_0x592298=_0x592298-0x0;var _0x180996=_0x326f[_0x592298];return _0x180996;};'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 3a5e107..d87b438 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 _0x2288=['http','error','message','result','catch','SendMail','bluebird','jayson/promise'];(function(_0x4f3bac,_0x28999b){var _0x81381a=function(_0x20e17b){while(--_0x20e17b){_0x4f3bac['push'](_0x4f3bac['shift']());}};_0x81381a(++_0x28999b);}(_0x2288,0x176));var _0x8228=function(_0x59d82f,_0x2e9c23){_0x59d82f=_0x59d82f-0x0;var _0x2933c0=_0x2288[_0x59d82f];return _0x2933c0;};'use strict';var BPromise=require(_0x8228('0x0'));var jayson=require(_0x8228('0x1'));var client=jayson['client'][_0x8228('0x2')]({'port':0x232b});function request(_0x5bdad6,_0x5192d1){return new BPromise(function(_0x443772,_0x4d93ae){return client['request'](_0x5bdad6,_0x5192d1)['then'](function(_0x3b74ee){if(_0x3b74ee['error']){return _0x4d93ae(_0x3b74ee[_0x8228('0x3')][_0x8228('0x4')]);}else{return _0x443772(_0x3b74ee[_0x8228('0x5')]);}})[_0x8228('0x6')](function(_0x5bf9b2){return _0x4d93ae(_0x5bf9b2);});});}exports['sendMailMessage']=function(_0x1ed2b4,_0x1ec44b){return request(_0x8228('0x7'),{'account':_0x1ed2b4,'message':_0x1ec44b});}; \ No newline at end of file +var _0x216a=['then','error','message','result','catch','sendMailMessage','SendMail','bluebird','client','http','request'];(function(_0x379d9d,_0x532d97){var _0x13f330=function(_0x54b6fc){while(--_0x54b6fc){_0x379d9d['push'](_0x379d9d['shift']());}};_0x13f330(++_0x532d97);}(_0x216a,0x1d5));var _0xa216=function(_0x13e300,_0x1bcb41){_0x13e300=_0x13e300-0x0;var _0x5a3eea=_0x216a[_0x13e300];return _0x5a3eea;};'use strict';var BPromise=require(_0xa216('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xa216('0x1')][_0xa216('0x2')]({'port':0x232b});function request(_0x228fbd,_0x3eb54b){return new BPromise(function(_0x155b71,_0x241b94){return client[_0xa216('0x3')](_0x228fbd,_0x3eb54b)[_0xa216('0x4')](function(_0x303e8b){if(_0x303e8b[_0xa216('0x5')]){return _0x241b94(_0x303e8b['error'][_0xa216('0x6')]);}else{return _0x155b71(_0x303e8b[_0xa216('0x7')]);}})[_0xa216('0x8')](function(_0x46f001){return _0x241b94(_0x46f001);});});}exports[_0xa216('0x9')]=function(_0x24b05f,_0x1b4340){return request(_0xa216('0xa'),{'account':_0x24b05f,'message':_0x1b4340});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 5bc8a07..bf4e256 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 _0x68b3=['openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatStatusTime','chatCurrentCapacity','smsStatus','whatsappStatusTime','openchannelWaitingInteractions','stringify','emit','user:routing:update','omit','exports','lodash','md5','moment','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity'];(function(_0x3a71fc,_0x51bb15){var _0x271469=function(_0x4914e4){while(--_0x4914e4){_0x3a71fc['push'](_0x3a71fc['shift']());}};_0x271469(++_0x51bb15);}(_0x68b3,0x1d8));var _0x368b=function(_0x5c6c6f,_0x59b657){_0x5c6c6f=_0x5c6c6f-0x0;var _0x9003f5=_0x68b3[_0x5c6c6f];return _0x9003f5;};'use strict';var _=require(_0x368b('0x0'));var md5=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));var Redis=require(_0x368b('0x3'));var config=require(_0x368b('0x4'));config['redis']=_[_0x368b('0x5')](config[_0x368b('0x6')],{'host':_0x368b('0x7'),'port':0x18eb});var io=require(_0x368b('0x8'))(new Redis(config['redis']));function Agent(_0x12eb8f){this['id']=_0x12eb8f['id']||0x0;this[_0x368b('0x9')]=_0x12eb8f[_0x368b('0x9')]||'';this[_0x368b('0xa')]=_0x12eb8f[_0x368b('0xa')]||!![];this[_0x368b('0xb')]=_0x12eb8f[_0x368b('0xb')]||![];this[_0x368b('0xc')]=_0x12eb8f[_0x368b('0xc')]||![];this[_0x368b('0xd')]=_0x12eb8f[_0x368b('0xd')]||![];this['faxPause']=_0x12eb8f[_0x368b('0xe')]||![];this[_0x368b('0xf')]=_0x12eb8f[_0x368b('0xf')]||![];this['openchannelPause']=_0x12eb8f[_0x368b('0x10')]||![];this[_0x368b('0x11')]=_0x368b('0x12');this['chatStatusTime']=0x0;this[_0x368b('0x13')]=_0x12eb8f[_0x368b('0x13')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x368b('0x14')]=_0x368b('0x12');this[_0x368b('0x15')]=0x0;this[_0x368b('0x16')]=_0x12eb8f[_0x368b('0x16')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x368b('0x17')]=_0x368b('0x12');this['faxStatusTime']=0x0;this[_0x368b('0x18')]=_0x12eb8f[_0x368b('0x18')]||0x0;this[_0x368b('0x19')]=0x0;this['smsStatus']=_0x368b('0x12');this[_0x368b('0x1a')]=0x0;this[_0x368b('0x1b')]=_0x12eb8f['smsCapacity']||0x0;this[_0x368b('0x1c')]=0x0;this[_0x368b('0x1d')]=_0x368b('0x12');this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x12eb8f[_0x368b('0x1e')]||0x0;this[_0x368b('0x1f')]=0x0;this[_0x368b('0x20')]=_0x368b('0x12');this[_0x368b('0x21')]=0x0;this['openchannelCapacity']=_0x12eb8f[_0x368b('0x22')]||0x0;this[_0x368b('0x23')]=0x0;this[_0x368b('0x24')]=![];this[_0x368b('0x25')]=undefined;this[_0x368b('0x1')]='';this[_0x368b('0x26')]={};this[_0x368b('0x27')]={};this[_0x368b('0x28')]={};this['openchannelWaitingInteractions']={};this[_0x368b('0x29')]={};this[_0x368b('0x2a')]={};this[_0x368b('0x2b')]();}Agent[_0x368b('0x2c')][_0x368b('0x2d')]=function(_0x4c2fca){if(this[_0x4c2fca+_0x368b('0x2e')]>0x0){if(this[_0x4c2fca+_0x368b('0x2f')]>0x0&&this[_0x4c2fca+_0x368b('0x2e')]>=this[_0x4c2fca+_0x368b('0x2f')]){return _0x368b('0x30');}else{return _0x368b('0x31');}}else{return _0x368b('0x32');}};Agent[_0x368b('0x2c')][_0x368b('0x2b')]=function(){var _0x3f7f89=[_0x368b('0x33'),_0x368b('0x34'),_0x368b('0x35'),_0x368b('0x36'),_0x368b('0x37'),_0x368b('0x38')];for(var _0x5dc5fa=0x0;_0x5dc5fa<_0x3f7f89[_0x368b('0x39')];_0x5dc5fa+=0x1){var _0x39ef94=this[_0x368b('0x2d')](_0x3f7f89[_0x5dc5fa]);if(this[_0x3f7f89[_0x5dc5fa]+_0x368b('0x3a')]!==_0x39ef94){this[_0x3f7f89[_0x5dc5fa]+_0x368b('0x3b')]=_[_0x368b('0x3c')](moment()[_0x368b('0x3d')]('x'));}this[_0x3f7f89[_0x5dc5fa]+'Status']=_0x39ef94;}var _0x4af77a={'id':this['id'],'name':this[_0x368b('0x9')],'online':this[_0x368b('0xa')],'voicePause':this[_0x368b('0xb')],'chatPause':this[_0x368b('0xc')],'mailPause':this['mailPause'],'smsPause':this[_0x368b('0xf')],'faxPause':this[_0x368b('0xe')],'openchannelPause':this[_0x368b('0x10')],'chatStatus':this[_0x368b('0x11')],'chatStatusTime':this[_0x368b('0x3e')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x368b('0x3f')],'mailStatus':this[_0x368b('0x14')],'mailStatusTime':this[_0x368b('0x15')],'mailCapacity':this[_0x368b('0x16')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x368b('0x18')],'faxCurrentCapacity':this[_0x368b('0x19')],'smsStatus':this[_0x368b('0x40')],'smsStatusTime':this[_0x368b('0x1a')],'smsCapacity':this[_0x368b('0x1b')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x368b('0x1d')],'whatsappStatusTime':this[_0x368b('0x41')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x368b('0x1f')],'openchannelStatus':this[_0x368b('0x20')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x368b('0x22')],'openchannelCurrentCapacity':this[_0x368b('0x23')],'busy':this['busy'],'busyQueue':this[_0x368b('0x25')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0x368b('0x42')],'smsWaitingInteractions':this[_0x368b('0x29')],'whatsappWaitingInteractions':this[_0x368b('0x2a')]};var _0x1ad002=md5(JSON[_0x368b('0x43')](_0x4af77a));if(this[_0x368b('0x1')]!==_0x1ad002){this[_0x368b('0x1')]=_0x1ad002;io[_0x368b('0x44')](_0x368b('0x45'),_[_0x368b('0x46')](_0x4af77a,['online']));}};module[_0x368b('0x47')]=Agent; \ No newline at end of file +var _0x1a85=['whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','chatWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','CurrentCapacity','maxcapacity','working','idle','mail','chat','fax','sms','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','format','faxStatusTime','whatsappStatus','openchannelWaitingInteractions','stringify','emit','user:routing:update','omit','moment','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x1a85,0x178));var _0x51a8=function(_0x7ad661,_0x1e4efa){_0x7ad661=_0x7ad661-0x0;var _0x363e14=_0x1a85[_0x7ad661];return _0x363e14;};'use strict';var _=require('lodash');var md5=require('md5');var moment=require(_0x51a8('0x0'));var Redis=require(_0x51a8('0x1'));var config=require(_0x51a8('0x2'));config['redis']=_['defaults'](config[_0x51a8('0x3')],{'host':_0x51a8('0x4'),'port':0x18eb});var io=require(_0x51a8('0x5'))(new Redis(config['redis']));function Agent(_0xaac0bf){this['id']=_0xaac0bf['id']||0x0;this['name']=_0xaac0bf[_0x51a8('0x6')]||'';this['online']=_0xaac0bf[_0x51a8('0x7')]||!![];this[_0x51a8('0x8')]=_0xaac0bf['voicePause']||![];this[_0x51a8('0x9')]=_0xaac0bf['chatPause']||![];this['mailPause']=_0xaac0bf[_0x51a8('0xa')]||![];this[_0x51a8('0xb')]=_0xaac0bf[_0x51a8('0xb')]||![];this[_0x51a8('0xc')]=_0xaac0bf[_0x51a8('0xc')]||![];this[_0x51a8('0xd')]=_0xaac0bf[_0x51a8('0xd')]||![];this[_0x51a8('0xe')]=_0x51a8('0xf');this[_0x51a8('0x10')]=0x0;this[_0x51a8('0x11')]=_0xaac0bf[_0x51a8('0x11')]||0x0;this[_0x51a8('0x12')]=0x0;this[_0x51a8('0x13')]=_0x51a8('0xf');this[_0x51a8('0x14')]=0x0;this[_0x51a8('0x15')]=_0xaac0bf['mailCapacity']||0x0;this[_0x51a8('0x16')]=0x0;this[_0x51a8('0x17')]=_0x51a8('0xf');this['faxStatusTime']=0x0;this[_0x51a8('0x18')]=_0xaac0bf['faxCapacity']||0x0;this[_0x51a8('0x19')]=0x0;this[_0x51a8('0x1a')]=_0x51a8('0xf');this[_0x51a8('0x1b')]=0x0;this[_0x51a8('0x1c')]=_0xaac0bf[_0x51a8('0x1c')]||0x0;this[_0x51a8('0x1d')]=0x0;this['whatsappStatus']=_0x51a8('0xf');this[_0x51a8('0x1e')]=0x0;this[_0x51a8('0x1f')]=_0xaac0bf[_0x51a8('0x1f')]||0x0;this[_0x51a8('0x20')]=0x0;this[_0x51a8('0x21')]='unknown';this[_0x51a8('0x22')]=0x0;this[_0x51a8('0x23')]=_0xaac0bf[_0x51a8('0x23')]||0x0;this[_0x51a8('0x24')]=0x0;this[_0x51a8('0x25')]=![];this[_0x51a8('0x26')]=undefined;this[_0x51a8('0x27')]='';this[_0x51a8('0x28')]={};this['faxWaitingInteractions']={};this[_0x51a8('0x29')]={};this['openchannelWaitingInteractions']={};this[_0x51a8('0x2a')]={};this[_0x51a8('0x2b')]={};this[_0x51a8('0x2c')]();}Agent[_0x51a8('0x2d')]['getChannelStatus']=function(_0xae3588){if(this[_0xae3588+'CurrentCapacity']>0x0){if(this[_0xae3588+'Capacity']>0x0&&this[_0xae3588+_0x51a8('0x2e')]>=this[_0xae3588+'Capacity']){return _0x51a8('0x2f');}else{return _0x51a8('0x30');}}else{return _0x51a8('0x31');}};Agent[_0x51a8('0x2d')][_0x51a8('0x2c')]=function(){var _0x2f2f05=[_0x51a8('0x32'),_0x51a8('0x33'),'openchannel',_0x51a8('0x34'),_0x51a8('0x35'),_0x51a8('0x36')];for(var _0x3da187=0x0;_0x3da187<_0x2f2f05[_0x51a8('0x37')];_0x3da187+=0x1){var _0x11aefc=this[_0x51a8('0x38')](_0x2f2f05[_0x3da187]);if(this[_0x2f2f05[_0x3da187]+_0x51a8('0x39')]!==_0x11aefc){this[_0x2f2f05[_0x3da187]+_0x51a8('0x3a')]=_[_0x51a8('0x3b')](moment()[_0x51a8('0x3c')]('x'));}this[_0x2f2f05[_0x3da187]+_0x51a8('0x39')]=_0x11aefc;}var _0x4a1548={'id':this['id'],'name':this[_0x51a8('0x6')],'online':this['online'],'voicePause':this[_0x51a8('0x8')],'chatPause':this[_0x51a8('0x9')],'mailPause':this[_0x51a8('0xa')],'smsPause':this[_0x51a8('0xc')],'faxPause':this[_0x51a8('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x51a8('0xe')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x51a8('0x11')],'chatCurrentCapacity':this[_0x51a8('0x12')],'mailStatus':this[_0x51a8('0x13')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x51a8('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x51a8('0x17')],'faxStatusTime':this[_0x51a8('0x3d')],'faxCapacity':this[_0x51a8('0x18')],'faxCurrentCapacity':this[_0x51a8('0x19')],'smsStatus':this[_0x51a8('0x1a')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x51a8('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x51a8('0x3e')],'whatsappStatusTime':this[_0x51a8('0x1e')],'whatsappCapacity':this[_0x51a8('0x1f')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x51a8('0x21')],'openchannelStatusTime':this[_0x51a8('0x22')],'openchannelCapacity':this[_0x51a8('0x23')],'openchannelCurrentCapacity':this[_0x51a8('0x24')],'busy':this[_0x51a8('0x25')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x51a8('0x29')],'openchannelWaitingInteractions':this[_0x51a8('0x3f')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0x51a8('0x2b')]};var _0x4ec0ac=md5(JSON[_0x51a8('0x40')](_0x4a1548));if(this[_0x51a8('0x27')]!==_0x4ec0ac){this[_0x51a8('0x27')]=_0x4ec0ac;io[_0x51a8('0x41')](_0x51a8('0x42'),_[_0x51a8('0x43')](_0x4a1548,['online']));}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 8ec7463..92ebd6f 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 _0x24a3=['stringify','format','chat_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','available'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0x24a3,0x121));var _0x324a=function(_0x6dfe01,_0x46d1b9){_0x6dfe01=_0x6dfe01-0x0;var _0x59015e=_0x24a3[_0x6dfe01];return _0x59015e;};'use strict';var _=require(_0x324a('0x0'));var md5=require('md5');var util=require(_0x324a('0x1'));var Redis=require(_0x324a('0x2'));var config=require(_0x324a('0x3'));config[_0x324a('0x4')]=_[_0x324a('0x5')](config[_0x324a('0x4')],{'host':_0x324a('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x324a('0x4')]));function ChatQueue(_0x142639){this['id']=_0x142639['id']||0x0;this['name']=_0x142639[_0x324a('0x7')]||'';this['timeout']=_0x142639['timeout']||0xa;this[_0x324a('0x8')]=_0x142639[_0x324a('0x8')]||_0x324a('0x9');this[_0x324a('0xa')]=_0x142639['Agents'];this[_0x324a('0xb')]={};this[_0x324a('0xc')]=0x0;this[_0x324a('0xd')]='';this[_0x324a('0xe')]();this[_0x324a('0xf')]();}ChatQueue[_0x324a('0x10')]['updateRouting']=function(){var _0x14a12e=this[_0x324a('0xb')][_0x324a('0x11')];this[_0x324a('0xb')]=_[_0x324a('0x12')](this[_0x324a('0xa')],'id');this[_0x324a('0xb')][_0x324a('0x11')]=_0x14a12e;};ChatQueue['prototype'][_0x324a('0xf')]=function(){this[_0x324a('0x13')]=0x0;this[_0x324a('0x14')]=0x0;for(var _0x8274ad=0x0;_0x8274ad=0x0?this[_0x324a('0x16')]:0x0;var _0x52cea0={'id':this['id'],'available':this[_0x324a('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x324a('0x7')],'paused':this[_0x324a('0x14')],'waiting':this['waiting']};var _0x5d9469=md5(JSON[_0x324a('0x17')](_0x52cea0));if(this['md5']!==_0x5d9469){this[_0x324a('0xd')]=_0x5d9469;io['to'](util[_0x324a('0x18')]('chat:queue:%s',_0x52cea0[_0x324a('0x7')]))['emit'](_0x324a('0x19'),_0x52cea0);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xadab=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','length','online','chatPause','paused','available','stringify','md5','format','chat:queue:%s','emit','chat_queue:save','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x20d87e,_0x199ccd){var _0x293015=function(_0x4788e5){while(--_0x4788e5){_0x20d87e['push'](_0x20d87e['shift']());}};_0x293015(++_0x199ccd);}(_0xadab,0xb3));var _0xbada=function(_0xa71f02,_0x5c9690){_0xa71f02=_0xa71f02-0x0;var _0x19798a=_0xadab[_0xa71f02];return _0x19798a;};'use strict';var _=require(_0xbada('0x0'));var md5=require('md5');var util=require(_0xbada('0x1'));var Redis=require('ioredis');var config=require(_0xbada('0x2'));config[_0xbada('0x3')]=_[_0xbada('0x4')](config[_0xbada('0x3')],{'host':_0xbada('0x5'),'port':0x18eb});var io=require(_0xbada('0x6'))(new Redis(config[_0xbada('0x3')]));function ChatQueue(_0x2f72ca){this['id']=_0x2f72ca['id']||0x0;this[_0xbada('0x7')]=_0x2f72ca[_0xbada('0x7')]||'';this[_0xbada('0x8')]=_0x2f72ca[_0xbada('0x8')]||0xa;this[_0xbada('0x9')]=_0x2f72ca[_0xbada('0x9')]||_0xbada('0xa');this[_0xbada('0xb')]=_0x2f72ca[_0xbada('0xb')];this[_0xbada('0xc')]={};this[_0xbada('0xd')]=0x0;this['md5']='';this[_0xbada('0xe')]();this['updateRealtime']();}ChatQueue[_0xbada('0xf')]['updateRouting']=function(){var _0x2e7a8c=this[_0xbada('0xc')][_0xbada('0x10')];this['mapAgentsId']=_[_0xbada('0x11')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x2e7a8c;};ChatQueue[_0xbada('0xf')][_0xbada('0x12')]=function(){this[_0xbada('0x13')]=0x0;this['paused']=0x0;for(var _0xa90a7f=0x0;_0xa90a7f=0x0?this[_0xbada('0x18')]:0x0;var _0x5874f4={'id':this['id'],'available':this[_0xbada('0x18')],'loggedIn':this[_0xbada('0x13')],'name':this['name'],'paused':this[_0xbada('0x17')],'waiting':this[_0xbada('0xd')]};var _0x54c66f=md5(JSON[_0xbada('0x19')](_0x5874f4));if(this[_0xbada('0x1a')]!==_0x54c66f){this['md5']=_0x54c66f;io['to'](util[_0xbada('0x1b')](_0xbada('0x1c'),_0x5874f4[_0xbada('0x7')]))[_0xbada('0x1d')](_0xbada('0x1e'),_0x5874f4);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 859d72f..ddc2d13 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 _0xf5f5=['timeout','strategy','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','paused','online','Agents','faxPause','available','loggedIn','format','fax:queue:%s','emit','fax_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x254abd,_0x1ab7f0){var _0x31bf1b=function(_0x447fd8){while(--_0x447fd8){_0x254abd['push'](_0x254abd['shift']());}};_0x31bf1b(++_0x1ab7f0);}(_0xf5f5,0x82));var _0x5f5f=function(_0x3c5ea2,_0x452378){_0x3c5ea2=_0x3c5ea2-0x0;var _0x4a7f88=_0xf5f5[_0x3c5ea2];return _0x4a7f88;};'use strict';var _=require(_0x5f5f('0x0'));var md5=require(_0x5f5f('0x1'));var util=require(_0x5f5f('0x2'));var Redis=require(_0x5f5f('0x3'));var config=require(_0x5f5f('0x4'));config[_0x5f5f('0x5')]=_[_0x5f5f('0x6')](config[_0x5f5f('0x5')],{'host':_0x5f5f('0x7'),'port':0x18eb});var io=require(_0x5f5f('0x8'))(new Redis(config[_0x5f5f('0x5')]));function FaxQueue(_0x10cc24){this['id']=_0x10cc24['id']||0x0;this[_0x5f5f('0x9')]=_0x10cc24['name']||'';this['timeout']=_0x10cc24[_0x5f5f('0xa')]||0xa;this[_0x5f5f('0xb')]=_0x10cc24[_0x5f5f('0xb')]||'beepall';this['Agents']=_0x10cc24['Agents'];this[_0x5f5f('0xc')]={};this[_0x5f5f('0xd')]=0x0;this[_0x5f5f('0x1')]='';this[_0x5f5f('0xe')]();this[_0x5f5f('0xf')]();}FaxQueue['prototype']['updateRouting']=function(){var _0x31b364=this[_0x5f5f('0xc')][_0x5f5f('0x10')];this['mapAgentsId']=_[_0x5f5f('0x11')](this['Agents'],'id');this[_0x5f5f('0xc')][_0x5f5f('0x10')]=_0x31b364;};FaxQueue['prototype'][_0x5f5f('0xf')]=function(){this['loggedIn']=0x0;this[_0x5f5f('0x12')]=0x0;for(var _0x5e9407=0x0;_0x5e9407=0x0?this[_0x5f5f('0x16')]:0x0;var _0xf3f75b={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x5f5f('0x9')],'paused':this[_0x5f5f('0x12')],'waiting':this[_0x5f5f('0xd')]};var _0x2e1cd0=md5(JSON['stringify'](_0xf3f75b));if(this[_0x5f5f('0x1')]!==_0x2e1cd0){this[_0x5f5f('0x1')]=_0x2e1cd0;io['to'](util[_0x5f5f('0x18')](_0x5f5f('0x19'),_0xf3f75b[_0x5f5f('0x9')]))[_0x5f5f('0x1a')](_0x5f5f('0x1b'),_0xf3f75b);}};module['exports']=FaxQueue; \ No newline at end of file +var _0xa319=['available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','name','timeout','strategy','beepall','waiting','md5','updateRealtime','prototype','mapAgentsId','map','Agents','_rr','loggedIn','paused','online','faxPause'];(function(_0x5fe176,_0x51176e){var _0x43f09d=function(_0x129e32){while(--_0x129e32){_0x5fe176['push'](_0x5fe176['shift']());}};_0x43f09d(++_0x51176e);}(_0xa319,0x11f));var _0x9a31=function(_0x45dc1a,_0x3e4f9d){_0x45dc1a=_0x45dc1a-0x0;var _0x21dbfc=_0xa319[_0x45dc1a];return _0x21dbfc;};'use strict';var _=require(_0x9a31('0x0'));var md5=require('md5');var util=require(_0x9a31('0x1'));var Redis=require('ioredis');var config=require(_0x9a31('0x2'));config[_0x9a31('0x3')]=_[_0x9a31('0x4')](config[_0x9a31('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0xc78ae7){this['id']=_0xc78ae7['id']||0x0;this[_0x9a31('0x5')]=_0xc78ae7[_0x9a31('0x5')]||'';this['timeout']=_0xc78ae7[_0x9a31('0x6')]||0xa;this[_0x9a31('0x7')]=_0xc78ae7[_0x9a31('0x7')]||_0x9a31('0x8');this['Agents']=_0xc78ae7['Agents'];this['mapAgentsId']={};this[_0x9a31('0x9')]=0x0;this[_0x9a31('0xa')]='';this['updateRouting']();this[_0x9a31('0xb')]();}FaxQueue[_0x9a31('0xc')]['updateRouting']=function(){var _0xcb572b=this[_0x9a31('0xd')]['_rr'];this[_0x9a31('0xd')]=_[_0x9a31('0xe')](this[_0x9a31('0xf')],'id');this['mapAgentsId'][_0x9a31('0x10')]=_0xcb572b;};FaxQueue['prototype']['updateRealtime']=function(){this[_0x9a31('0x11')]=0x0;this[_0x9a31('0x12')]=0x0;for(var _0x59b4ab=0x0;_0x59b4ab=0x0?this['available']:0x0;var _0x36c515={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x9a31('0x5')],'paused':this[_0x9a31('0x12')],'waiting':this[_0x9a31('0x9')]};var _0x472de3=md5(JSON[_0x9a31('0x16')](_0x36c515));if(this[_0x9a31('0xa')]!==_0x472de3){this[_0x9a31('0xa')]=_0x472de3;io['to'](util[_0x9a31('0x17')](_0x9a31('0x18'),_0x36c515[_0x9a31('0x5')]))[_0x9a31('0x19')](_0x9a31('0x1a'),_0x36c515);}};module[_0x9a31('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 7bd3db5..cf6102e 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 _0x2e6e=['name','Intervals','exports'];(function(_0x353d1b,_0x20ce87){var _0x5e3f3c=function(_0x3f4ff1){while(--_0x3f4ff1){_0x353d1b['push'](_0x353d1b['shift']());}};_0x5e3f3c(++_0x20ce87);}(_0x2e6e,0x11d));var _0xe2e6=function(_0x236c13,_0x50cc9f){_0x236c13=_0x236c13-0x0;var _0x35aa66=_0x2e6e[_0x236c13];return _0x35aa66;};'use strict';function Interval(_0x2a217d){this['id']=_0x2a217d['id']||0x0;this[_0xe2e6('0x0')]=_0x2a217d['name']||'';this[_0xe2e6('0x1')]=_0x2a217d[_0xe2e6('0x1')]||{};}module[_0xe2e6('0x2')]=Interval; \ No newline at end of file +var _0xdc48=['name','Intervals','exports'];(function(_0xb0b922,_0x183826){var _0x5dc41e=function(_0x461183){while(--_0x461183){_0xb0b922['push'](_0xb0b922['shift']());}};_0x5dc41e(++_0x183826);}(_0xdc48,0x18f));var _0x8dc4=function(_0x33a0fd,_0x4349ad){_0x33a0fd=_0x33a0fd-0x0;var _0x3184ee=_0xdc48[_0x33a0fd];return _0x3184ee;};'use strict';function Interval(_0x11ec19){this['id']=_0x11ec19['id']||0x0;this[_0x8dc4('0x0')]=_0x11ec19[_0x8dc4('0x0')]||'';this[_0x8dc4('0x1')]=_0x11ec19[_0x8dc4('0x1')]||{};}module[_0x8dc4('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 475ab99..9aab7b0 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 _0xefbe=['format','mail:queue:%s','emit','mail_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','mailPause','available','waiting','stringify'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xefbe,0x15a));var _0xeefb=function(_0x5c206c,_0x3b4fc8){_0x5c206c=_0x5c206c-0x0;var _0x3408bf=_0xefbe[_0x5c206c];return _0x3408bf;};'use strict';var _=require(_0xeefb('0x0'));var md5=require('md5');var util=require(_0xeefb('0x1'));var Redis=require('ioredis');var config=require(_0xeefb('0x2'));config[_0xeefb('0x3')]=_[_0xeefb('0x4')](config['redis'],{'host':_0xeefb('0x5'),'port':0x18eb});var io=require(_0xeefb('0x6'))(new Redis(config[_0xeefb('0x3')]));function MailQueue(_0x3656f3){this['id']=_0x3656f3['id']||0x0;this[_0xeefb('0x7')]=_0x3656f3[_0xeefb('0x7')]||'';this[_0xeefb('0x8')]=_0x3656f3[_0xeefb('0x8')]||0xa;this[_0xeefb('0x9')]=_0x3656f3[_0xeefb('0x9')]||_0xeefb('0xa');this[_0xeefb('0xb')]=_0x3656f3['Agents'];this[_0xeefb('0xc')]={};this['waiting']=0x0;this[_0xeefb('0xd')]='';this[_0xeefb('0xe')]();this[_0xeefb('0xf')]();}MailQueue[_0xeefb('0x10')][_0xeefb('0xe')]=function(){var _0x1f5e1b=this[_0xeefb('0xc')][_0xeefb('0x11')];this[_0xeefb('0xc')]=_[_0xeefb('0x12')](this['Agents'],'id');this[_0xeefb('0xc')][_0xeefb('0x11')]=_0x1f5e1b;};MailQueue[_0xeefb('0x10')][_0xeefb('0xf')]=function(){this[_0xeefb('0x13')]=0x0;this[_0xeefb('0x14')]=0x0;for(var _0x2b478a=0x0;_0x2b478a=0x0?this['available']:0x0;var _0x40e5db={'id':this['id'],'available':this[_0xeefb('0x17')],'loggedIn':this[_0xeefb('0x13')],'name':this['name'],'paused':this[_0xeefb('0x14')],'waiting':this[_0xeefb('0x18')]};var _0x58272b=md5(JSON[_0xeefb('0x19')](_0x40e5db));if(this[_0xeefb('0xd')]!==_0x58272b){this[_0xeefb('0xd')]=_0x58272b;io['to'](util[_0xeefb('0x1a')](_0xeefb('0x1b'),_0x40e5db[_0xeefb('0x7')]))[_0xeefb('0x1c')](_0xeefb('0x1d'),_0x40e5db);}};module[_0xeefb('0x1e')]=MailQueue; \ No newline at end of file +var _0x1787=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','online','loggedIn','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents'];(function(_0x1bbb8b,_0x2c050b){var _0x4431ea=function(_0x77512a){while(--_0x77512a){_0x1bbb8b['push'](_0x1bbb8b['shift']());}};_0x4431ea(++_0x2c050b);}(_0x1787,0xe4));var _0x7178=function(_0x10d73b,_0xb2bc5){_0x10d73b=_0x10d73b-0x0;var _0x22f7c2=_0x1787[_0x10d73b];return _0x22f7c2;};'use strict';var _=require(_0x7178('0x0'));var md5=require(_0x7178('0x1'));var util=require(_0x7178('0x2'));var Redis=require('ioredis');var config=require(_0x7178('0x3'));config['redis']=_[_0x7178('0x4')](config[_0x7178('0x5')],{'host':_0x7178('0x6'),'port':0x18eb});var io=require(_0x7178('0x7'))(new Redis(config[_0x7178('0x5')]));function MailQueue(_0x512725){this['id']=_0x512725['id']||0x0;this[_0x7178('0x8')]=_0x512725[_0x7178('0x8')]||'';this[_0x7178('0x9')]=_0x512725['timeout']||0xa;this[_0x7178('0xa')]=_0x512725['strategy']||'beepall';this[_0x7178('0xb')]=_0x512725[_0x7178('0xb')];this[_0x7178('0xc')]={};this[_0x7178('0xd')]=0x0;this[_0x7178('0x1')]='';this[_0x7178('0xe')]();this[_0x7178('0xf')]();}MailQueue[_0x7178('0x10')][_0x7178('0xe')]=function(){var _0x2961ec=this[_0x7178('0xc')][_0x7178('0x11')];this['mapAgentsId']=_[_0x7178('0x12')](this[_0x7178('0xb')],'id');this[_0x7178('0xc')][_0x7178('0x11')]=_0x2961ec;};MailQueue[_0x7178('0x10')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x7178('0x13')]=0x0;for(var _0x404570=0x0;_0x404570=0x0?this['available']:0x0;var _0x900e19={'id':this['id'],'available':this[_0x7178('0x17')],'loggedIn':this[_0x7178('0x15')],'name':this[_0x7178('0x8')],'paused':this[_0x7178('0x13')],'waiting':this[_0x7178('0xd')]};var _0x2f1be5=md5(JSON[_0x7178('0x18')](_0x900e19));if(this[_0x7178('0x1')]!==_0x2f1be5){this[_0x7178('0x1')]=_0x2f1be5;io['to'](util[_0x7178('0x19')](_0x7178('0x1a'),_0x900e19[_0x7178('0x8')]))[_0x7178('0x1b')](_0x7178('0x1c'),_0x900e19);}};module[_0x7178('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 7e75abd..dba017c 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x7a54,0x106));var _0x47a5=function(_0x2b4260,_0x4dea2d){_0x2b4260=_0x2b4260-0x0;var _0x34fdd2=_0x7a54[_0x2b4260];return _0x34fdd2;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x4f6c26,_0x5c2c54){var _0x4809a0=function(_0x1b30a9){while(--_0x1b30a9){_0x4f6c26['push'](_0x4f6c26['shift']());}};_0x4809a0(++_0x5c2c54);}(_0x5fc3,0xa8));var _0x35fc=function(_0x422be2,_0x1c439e){_0x422be2=_0x422be2-0x0;var _0x1b820e=_0x5fc3[_0x422be2];return _0x1b820e;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 9817a60..a6b7d79 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 _0x9f94=['loggedIn','length','online','Agents','smsPause','available','paused','waiting','stringify','sms:queue:%s','emit','lodash','md5','util','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype'];(function(_0x26189d,_0x1e3d06){var _0x134495=function(_0x2efb66){while(--_0x2efb66){_0x26189d['push'](_0x26189d['shift']());}};_0x134495(++_0x1e3d06);}(_0x9f94,0x1e7));var _0x49f9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9f94[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x49f9('0x0'));var md5=require(_0x49f9('0x1'));var util=require(_0x49f9('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x49f9('0x3')]=_[_0x49f9('0x4')](config[_0x49f9('0x3')],{'host':_0x49f9('0x5'),'port':0x18eb});var io=require(_0x49f9('0x6'))(new Redis(config['redis']));function SmsQueue(_0x6dbeac){this['id']=_0x6dbeac['id']||0x0;this[_0x49f9('0x7')]=_0x6dbeac[_0x49f9('0x7')]||'';this[_0x49f9('0x8')]=_0x6dbeac[_0x49f9('0x8')]||0xa;this[_0x49f9('0x9')]=_0x6dbeac[_0x49f9('0x9')]||_0x49f9('0xa');this['Agents']=_0x6dbeac['Agents'];this[_0x49f9('0xb')]={};this['waiting']=0x0;this[_0x49f9('0x1')]='';this[_0x49f9('0xc')]();this[_0x49f9('0xd')]();}SmsQueue['prototype'][_0x49f9('0xc')]=function(){var _0x59bb47=this[_0x49f9('0xb')][_0x49f9('0xe')];this[_0x49f9('0xb')]=_[_0x49f9('0xf')](this['Agents'],'id');this['mapAgentsId'][_0x49f9('0xe')]=_0x59bb47;};SmsQueue[_0x49f9('0x10')][_0x49f9('0xd')]=function(){this[_0x49f9('0x11')]=0x0;this['paused']=0x0;for(var _0x4e7790=0x0;_0x4e7790=0x0?this[_0x49f9('0x16')]:0x0;var _0x3cc45e={'id':this['id'],'available':this[_0x49f9('0x16')],'loggedIn':this[_0x49f9('0x11')],'name':this[_0x49f9('0x7')],'paused':this[_0x49f9('0x17')],'waiting':this[_0x49f9('0x18')]};var _0xa9b24c=md5(JSON[_0x49f9('0x19')](_0x3cc45e));if(this[_0x49f9('0x1')]!==_0xa9b24c){this['md5']=_0xa9b24c;io['to'](util['format'](_0x49f9('0x1a'),_0x3cc45e['name']))[_0x49f9('0x1b')]('sms_queue:save',_0x3cc45e);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x9f62=['sms:queue:%s','emit','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','waiting','prototype','updateRouting','mapAgentsId','_rr','updateRealtime','loggedIn','paused','Agents','length','online','smsPause','available','stringify','format'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x9f62,0x154));var _0x29f6=function(_0x27cebc,_0x2466ca){_0x27cebc=_0x27cebc-0x0;var _0x213335=_0x9f62[_0x27cebc];return _0x213335;};'use strict';var _=require('lodash');var md5=require(_0x29f6('0x0'));var util=require('util');var Redis=require(_0x29f6('0x1'));var config=require(_0x29f6('0x2'));config[_0x29f6('0x3')]=_['defaults'](config['redis'],{'host':_0x29f6('0x4'),'port':0x18eb});var io=require(_0x29f6('0x5'))(new Redis(config[_0x29f6('0x3')]));function SmsQueue(_0x1e71ac){this['id']=_0x1e71ac['id']||0x0;this['name']=_0x1e71ac[_0x29f6('0x6')]||'';this[_0x29f6('0x7')]=_0x1e71ac[_0x29f6('0x7')]||0xa;this[_0x29f6('0x8')]=_0x1e71ac[_0x29f6('0x8')]||'beepall';this['Agents']=_0x1e71ac['Agents'];this['mapAgentsId']={};this[_0x29f6('0x9')]=0x0;this[_0x29f6('0x0')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0x29f6('0xa')][_0x29f6('0xb')]=function(){var _0x4909e0=this[_0x29f6('0xc')][_0x29f6('0xd')];this['mapAgentsId']=_['map'](this['Agents'],'id');this['mapAgentsId'][_0x29f6('0xd')]=_0x4909e0;};SmsQueue[_0x29f6('0xa')][_0x29f6('0xe')]=function(){this[_0x29f6('0xf')]=0x0;this[_0x29f6('0x10')]=0x0;for(var _0x156c96=0x0;_0x156c96=0x0?this[_0x29f6('0x15')]:0x0;var _0x3af478={'id':this['id'],'available':this[_0x29f6('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x29f6('0x6')],'paused':this[_0x29f6('0x10')],'waiting':this['waiting']};var _0x159227=md5(JSON[_0x29f6('0x16')](_0x3af478));if(this[_0x29f6('0x0')]!==_0x159227){this[_0x29f6('0x0')]=_0x159227;io['to'](util[_0x29f6('0x17')](_0x29f6('0x18'),_0x3af478['name']))[_0x29f6('0x19')]('sms_queue:save',_0x3af478);}};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 6a7fc0f..7304c94 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 _0x99ba=['updateRouting','prototype','map','_rr','updateRealtime','loggedIn','length','online','whatsappPause','paused','available','waiting','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','ioredis','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0xc22b0a,_0x13910e){var _0xc5ffc9=function(_0x381990){while(--_0x381990){_0xc22b0a['push'](_0xc22b0a['shift']());}};_0xc5ffc9(++_0x13910e);}(_0x99ba,0x198));var _0xa99b=function(_0xc083f3,_0x5eaa52){_0xc083f3=_0xc083f3-0x0;var _0x3c7c01=_0x99ba[_0xc083f3];return _0x3c7c01;};'use strict';var _=require(_0xa99b('0x0'));var md5=require(_0xa99b('0x1'));var util=require('util');var Redis=require(_0xa99b('0x2'));var config=require('../../../config/environment');config[_0xa99b('0x3')]=_[_0xa99b('0x4')](config[_0xa99b('0x3')],{'host':_0xa99b('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa99b('0x3')]));function WhatsappQueue(_0x44c5ca){this['id']=_0x44c5ca['id']||0x0;this[_0xa99b('0x6')]=_0x44c5ca[_0xa99b('0x6')]||'';this[_0xa99b('0x7')]=_0x44c5ca[_0xa99b('0x7')]||0xa;this['strategy']=_0x44c5ca[_0xa99b('0x8')]||_0xa99b('0x9');this[_0xa99b('0xa')]=_0x44c5ca['Agents'];this[_0xa99b('0xb')]={};this['waiting']=0x0;this[_0xa99b('0x1')]='';this[_0xa99b('0xc')]();this['updateRealtime']();}WhatsappQueue[_0xa99b('0xd')][_0xa99b('0xc')]=function(){var _0x4955f2=this[_0xa99b('0xb')]['_rr'];this[_0xa99b('0xb')]=_[_0xa99b('0xe')](this['Agents'],'id');this['mapAgentsId'][_0xa99b('0xf')]=_0x4955f2;};WhatsappQueue[_0xa99b('0xd')][_0xa99b('0x10')]=function(){this[_0xa99b('0x11')]=0x0;this['paused']=0x0;for(var _0x412850=0x0;_0x412850=0x0?this['available']:0x0;var _0x19a587={'id':this['id'],'available':this[_0xa99b('0x16')],'loggedIn':this[_0xa99b('0x11')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xa99b('0x17')]};var _0x20929f=md5(JSON[_0xa99b('0x18')](_0x19a587));if(this[_0xa99b('0x1')]!==_0x20929f){this[_0xa99b('0x1')]=_0x20929f;io['to'](util[_0xa99b('0x19')](_0xa99b('0x1a'),_0x19a587['name']))[_0xa99b('0x1b')](_0xa99b('0x1c'),_0x19a587);}};module[_0xa99b('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0xe7d4=['beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','map','updateRealtime','loggedIn','length','online','whatsappPause','available','paused','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy'];(function(_0x1acfb9,_0x52bc80){var _0x1416e3=function(_0x1909d1){while(--_0x1909d1){_0x1acfb9['push'](_0x1acfb9['shift']());}};_0x1416e3(++_0x52bc80);}(_0xe7d4,0x151));var _0x4e7d=function(_0x5266ea,_0x50c197){_0x5266ea=_0x5266ea-0x0;var _0x5aee9a=_0xe7d4[_0x5266ea];return _0x5aee9a;};'use strict';var _=require(_0x4e7d('0x0'));var md5=require(_0x4e7d('0x1'));var util=require(_0x4e7d('0x2'));var Redis=require(_0x4e7d('0x3'));var config=require(_0x4e7d('0x4'));config['redis']=_[_0x4e7d('0x5')](config[_0x4e7d('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x4e7d('0x7'))(new Redis(config[_0x4e7d('0x6')]));function WhatsappQueue(_0x226c88){this['id']=_0x226c88['id']||0x0;this[_0x4e7d('0x8')]=_0x226c88[_0x4e7d('0x8')]||'';this[_0x4e7d('0x9')]=_0x226c88['timeout']||0xa;this[_0x4e7d('0xa')]=_0x226c88['strategy']||_0x4e7d('0xb');this['Agents']=_0x226c88[_0x4e7d('0xc')];this[_0x4e7d('0xd')]={};this[_0x4e7d('0xe')]=0x0;this[_0x4e7d('0x1')]='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue[_0x4e7d('0xf')][_0x4e7d('0x10')]=function(){var _0xdcfad6=this[_0x4e7d('0xd')]['_rr'];this[_0x4e7d('0xd')]=_[_0x4e7d('0x11')](this[_0x4e7d('0xc')],'id');this[_0x4e7d('0xd')]['_rr']=_0xdcfad6;};WhatsappQueue[_0x4e7d('0xf')][_0x4e7d('0x12')]=function(){this[_0x4e7d('0x13')]=0x0;this['paused']=0x0;for(var _0x24d17d=0x0;_0x24d17d=0x0?this[_0x4e7d('0x17')]:0x0;var _0x34f660={'id':this['id'],'available':this[_0x4e7d('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x4e7d('0x8')],'paused':this[_0x4e7d('0x18')],'waiting':this[_0x4e7d('0xe')]};var _0x5a2c8e=md5(JSON[_0x4e7d('0x19')](_0x34f660));if(this[_0x4e7d('0x1')]!==_0x5a2c8e){this[_0x4e7d('0x1')]=_0x5a2c8e;io['to'](util['format'](_0x4e7d('0x1a'),_0x34f660['name']))[_0x4e7d('0x1b')](_0x4e7d('0x1c'),_0x34f660);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 2d0b09b..652ead3 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 52b0903..9d969e2 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 _0xb88b=['updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x53daa0,_0x1000a6){var _0x1231cb=function(_0xeb95a7){while(--_0xeb95a7){_0x53daa0['push'](_0x53daa0['shift']());}};_0x1231cb(++_0x1000a6);}(_0xb88b,0x89));var _0xbb88=function(_0x389b8f,_0x296a40){_0x389b8f=_0x389b8f-0x0;var _0x29cf21=_0xb88b[_0x389b8f];return _0x29cf21;};'use strict';var client=require(_0xbb88('0x0'));exports[_0xbb88('0x1')]=function(_0x4bf728,_0xb06e90){return client[_0xbb88('0x2')]('UpdateChatInteraction',{'body':_0xb06e90,'options':{'where':{'id':_0x4bf728}},'log':_0xbb88('0x3')});};exports[_0xbb88('0x4')]=function(_0x28e216,_0x329368){return client['Request'](_0xbb88('0x5'),{'body':_0x329368,'options':{'where':{'id':_0x28e216}},'log':_0xbb88('0x6')});}; \ No newline at end of file +var _0xd2ea=['update','Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x1da14b,_0x120d07){var _0x575473=function(_0x34f796){while(--_0x34f796){_0x1da14b['push'](_0x1da14b['shift']());}};_0x575473(++_0x120d07);}(_0xd2ea,0x12c));var _0xad2e=function(_0x50ba30,_0x671b2){_0x50ba30=_0x50ba30-0x0;var _0x2bdc17=_0xd2ea[_0x50ba30];return _0x2bdc17;};'use strict';var client=require('../client');exports[_0xad2e('0x0')]=function(_0x48f2f1,_0x282181){return client[_0xad2e('0x1')](_0xad2e('0x2'),{'body':_0x282181,'options':{'where':{'id':_0x48f2f1}},'log':'updateChatInteraction'});};exports[_0xad2e('0x3')]=function(_0x50b295,_0x221a15){return client[_0xad2e('0x1')](_0xad2e('0x4'),{'body':_0x221a15,'options':{'where':{'id':_0x50b295}},'log':_0xad2e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 934a3d0..d399a5f 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 _0xd43e=['createChatMessage','../client','Request'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0xd43e,0x1d5));var _0xed43=function(_0x1c3907,_0x41e1a7){_0x1c3907=_0x1c3907-0x0;var _0x27fcd6=_0xd43e[_0x1c3907];return _0x27fcd6;};'use strict';var client=require(_0xed43('0x0'));exports['create']=function(_0x374b75){return client[_0xed43('0x1')]('CreateChatMessage',{'body':_0x374b75,'log':_0xed43('0x2')});}; \ No newline at end of file +var _0x1cca=['../client','create','CreateChatMessage','createChatMessage'];(function(_0xe824e2,_0x1dad8e){var _0x28ca3a=function(_0x51a812){while(--_0x51a812){_0xe824e2['push'](_0xe824e2['shift']());}};_0x28ca3a(++_0x1dad8e);}(_0x1cca,0x94));var _0xa1cc=function(_0x535bf3,_0x19903b){_0x535bf3=_0x535bf3-0x0;var _0xa995aa=_0x1cca[_0x535bf3];return _0xa995aa;};'use strict';var client=require(_0xa1cc('0x0'));exports[_0xa1cc('0x1')]=function(_0x9054b7){return client['Request'](_0xa1cc('0x2'),{'body':_0x9054b7,'log':_0xa1cc('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index a4eaba4..80058bd 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 _0xd846=['getChatQueues','Request','timeout','Agents','name','chatPause','../client'];(function(_0x8f875e,_0x6205a8){var _0x254b07=function(_0x3549aa){while(--_0x3549aa){_0x8f875e['push'](_0x8f875e['shift']());}};_0x254b07(++_0x6205a8);}(_0xd846,0x195));var _0x6d84=function(_0x162f83,_0xde0451){_0x162f83=_0x162f83-0x0;var _0x23fd15=_0xd846[_0x162f83];return _0x23fd15;};'use strict';var client=require(_0x6d84('0x0'));exports[_0x6d84('0x1')]=function(){return function(){return client[_0x6d84('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0x6d84('0x3'),'strategy'],'include':[{'model':'User','as':_0x6d84('0x4'),'attributes':['id',_0x6d84('0x5'),'online',_0x6d84('0x6')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x9b2a=['GetChatQueue','name','strategy','User','online','chatPause','getChatQueues','../client','Request'];(function(_0x309df4,_0x3391db){var _0x4be8fc=function(_0x2261e4){while(--_0x2261e4){_0x309df4['push'](_0x309df4['shift']());}};_0x4be8fc(++_0x3391db);}(_0x9b2a,0x127));var _0xa9b2=function(_0x1ca5bf,_0x22785f){_0x1ca5bf=_0x1ca5bf-0x0;var _0x136a13=_0x9b2a[_0x1ca5bf];return _0x136a13;};'use strict';var client=require(_0xa9b2('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xa9b2('0x1')](_0xa9b2('0x2'),{'options':{'raw':![],'attributes':['id',_0xa9b2('0x3'),'timeout',_0xa9b2('0x4')],'include':[{'model':_0xa9b2('0x5'),'as':'Agents','attributes':['id','name',_0xa9b2('0x6'),_0xa9b2('0x7')]}]},'log':_0xa9b2('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 0301ad9..0b32b94 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 _0xd382=['Request','CreateChatQueueReport','update','../client','create'];(function(_0x5aa0a5,_0x254941){var _0x553403=function(_0x101e9b){while(--_0x101e9b){_0x5aa0a5['push'](_0x5aa0a5['shift']());}};_0x553403(++_0x254941);}(_0xd382,0x1b6));var _0x2d38=function(_0x289109,_0x19d955){_0x289109=_0x289109-0x0;var _0x47fab7=_0xd382[_0x289109];return _0x47fab7;};'use strict';var client=require(_0x2d38('0x0'));exports[_0x2d38('0x1')]=function(_0x188226){return client[_0x2d38('0x2')](_0x2d38('0x3'),{'body':_0x188226,'log':_0x2d38('0x3')});};exports[_0x2d38('0x4')]=function(_0x3e5d82,_0xf6bceb){return client[_0x2d38('0x2')]('UpdateChatQueueReport',{'body':_0xf6bceb,'options':{'where':{'uniqueid':_0x3e5d82},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xbbb8=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client'];(function(_0x1e95c2,_0x1ed308){var _0x9e6d94=function(_0x1e959b){while(--_0x1e959b){_0x1e95c2['push'](_0x1e95c2['shift']());}};_0x9e6d94(++_0x1ed308);}(_0xbbb8,0x7d));var _0x8bbb=function(_0x9e5d4d,_0x373e29){_0x9e5d4d=_0x9e5d4d-0x0;var _0x211000=_0xbbb8[_0x9e5d4d];return _0x211000;};'use strict';var client=require(_0x8bbb('0x0'));exports[_0x8bbb('0x1')]=function(_0x51ba1c){return client[_0x8bbb('0x2')](_0x8bbb('0x3'),{'body':_0x51ba1c,'log':'CreateChatQueueReport'});};exports[_0x8bbb('0x4')]=function(_0x45f021,_0xbcb7b8){return client[_0x8bbb('0x2')](_0x8bbb('0x5'),{'body':_0xbcb7b8,'options':{'where':{'uniqueid':_0x45f021},'order':[['id',_0x8bbb('0x6')]],'limit':0x1},'log':_0x8bbb('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 98a88e3..ed69893 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(_0x40dfbd,_0x2742d2){var _0x3140ee=function(_0x103e05){while(--_0x103e05){_0x40dfbd['push'](_0x40dfbd['shift']());}};_0x3140ee(++_0x2742d2);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0x7a54,0x106));var _0x47a5=function(_0x429afe,_0x358acb){_0x429afe=_0x429afe-0x0;var _0xc8315c=_0x7a54[_0x429afe];return _0xc8315c;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 07ef52d..8864026 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 _0xf4fa=['create','Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x57411a,_0x59328f){var _0xd487ba=function(_0x2fb456){while(--_0x2fb456){_0x57411a['push'](_0x57411a['shift']());}};_0xd487ba(++_0x59328f);}(_0xf4fa,0x112));var _0xaf4f=function(_0x6068da,_0x13528e){_0x6068da=_0x6068da-0x0;var _0x25416f=_0xf4fa[_0x6068da];return _0x25416f;};'use strict';var client=require(_0xaf4f('0x0'));exports[_0xaf4f('0x1')]=function(_0x15b7df){return client[_0xaf4f('0x2')](_0xaf4f('0x3'),{'body':_0x15b7df,'log':_0xaf4f('0x4')});}; \ No newline at end of file +var _0xcfbe=['create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x12aa0f,_0x4d382f){var _0x3ac772=function(_0x41963d){while(--_0x41963d){_0x12aa0f['push'](_0x12aa0f['shift']());}};_0x3ac772(++_0x4d382f);}(_0xcfbe,0x130));var _0xecfb=function(_0x517321,_0x23f7ee){_0x517321=_0x517321-0x0;var _0x4fa48e=_0xcfbe[_0x517321];return _0x4fa48e;};'use strict';var client=require('../client');exports[_0xecfb('0x0')]=function(_0x998701){return client[_0xecfb('0x1')](_0xecfb('0x2'),{'body':_0x998701,'log':_0xecfb('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 528749c..464bcae 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 _0x5fe6=['name','timeout','Agents','online','faxPause','../client','getFaxQueues','GetFaxQueue'];(function(_0x1e5090,_0x4452f6){var _0x33f54b=function(_0xb46a85){while(--_0xb46a85){_0x1e5090['push'](_0x1e5090['shift']());}};_0x33f54b(++_0x4452f6);}(_0x5fe6,0x12d));var _0x65fe=function(_0x1a9e21,_0x5a7e27){_0x1a9e21=_0x1a9e21-0x0;var _0x8927c8=_0x5fe6[_0x1a9e21];return _0x8927c8;};'use strict';var client=require(_0x65fe('0x0'));exports[_0x65fe('0x1')]=function(){return function(){return client['Request'](_0x65fe('0x2'),{'options':{'raw':![],'attributes':['id',_0x65fe('0x3'),_0x65fe('0x4'),'strategy'],'include':[{'model':'User','as':_0x65fe('0x5'),'attributes':['id','name',_0x65fe('0x6'),_0x65fe('0x7')]}]},'log':_0x65fe('0x1')});};}; \ No newline at end of file +var _0xefd4=['getFaxQueues','Request','name','timeout','strategy','User','Agents','online','faxPause'];(function(_0x530db1,_0x2b9531){var _0x31c1f2=function(_0x1c77b3){while(--_0x1c77b3){_0x530db1['push'](_0x530db1['shift']());}};_0x31c1f2(++_0x2b9531);}(_0xefd4,0x183));var _0x4efd=function(_0x2e93d0,_0x5d6526){_0x2e93d0=_0x2e93d0-0x0;var _0x2a88a6=_0xefd4[_0x2e93d0];return _0x2a88a6;};'use strict';var client=require('../client');exports[_0x4efd('0x0')]=function(){return function(){return client[_0x4efd('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x4efd('0x2'),_0x4efd('0x3'),_0x4efd('0x4')],'include':[{'model':_0x4efd('0x5'),'as':_0x4efd('0x6'),'attributes':['id','name',_0x4efd('0x7'),_0x4efd('0x8')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 8cc9c06..aced73d 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 _0x7ace=['DESC','create','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x383e3d,_0x47a532){var _0x34c1c4=function(_0x275a08){while(--_0x275a08){_0x383e3d['push'](_0x383e3d['shift']());}};_0x34c1c4(++_0x47a532);}(_0x7ace,0x1b4));var _0xe7ac=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x7ace[_0x164eca];return _0x2ce562;};'use strict';var client=require('../client');exports[_0xe7ac('0x0')]=function(_0x3a7ee3){return client['Request'](_0xe7ac('0x1'),{'body':_0x3a7ee3,'log':_0xe7ac('0x1')});};exports[_0xe7ac('0x2')]=function(_0x3fd05e,_0xbeeb59){return client['Request'](_0xe7ac('0x3'),{'body':_0xbeeb59,'options':{'where':{'uniqueid':_0x3fd05e},'order':[['id',_0xe7ac('0x4')]],'limit':0x1},'log':_0xe7ac('0x3')});}; \ No newline at end of file +var _0xe063=['Request','DESC','UpdateFaxQueueReport','../client','create','CreateFaxQueueReport','update'];(function(_0x5d4ed7,_0x3dd607){var _0xac91be=function(_0x1144f0){while(--_0x1144f0){_0x5d4ed7['push'](_0x5d4ed7['shift']());}};_0xac91be(++_0x3dd607);}(_0xe063,0xc0));var _0x3e06=function(_0x322f90,_0x37e33e){_0x322f90=_0x322f90-0x0;var _0x3fe071=_0xe063[_0x322f90];return _0x3fe071;};'use strict';var client=require(_0x3e06('0x0'));exports[_0x3e06('0x1')]=function(_0x4a66e1){return client['Request'](_0x3e06('0x2'),{'body':_0x4a66e1,'log':_0x3e06('0x2')});};exports[_0x3e06('0x3')]=function(_0x184863,_0x5d4688){return client[_0x3e06('0x4')]('UpdateFaxQueueReport',{'body':_0x5d4688,'options':{'where':{'uniqueid':_0x184863},'order':[['id',_0x3e06('0x5')]],'limit':0x1},'log':_0x3e06('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index f0a6db7..1ebf8f5 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 _0xc3b6=['Request','GetInterval','name','Intervals','../client','getIntervals'];(function(_0x5d2357,_0x5108c3){var _0x1df0e1=function(_0x1fa24b){while(--_0x1fa24b){_0x5d2357['push'](_0x5d2357['shift']());}};_0x1df0e1(++_0x5108c3);}(_0xc3b6,0x16c));var _0x6c3b=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0xc3b6[_0x874cf1];return _0x233579;};'use strict';var client=require(_0x6c3b('0x0'));exports[_0x6c3b('0x1')]=function(){return function(){return client[_0x6c3b('0x2')](_0x6c3b('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x6c3b('0x4')],'include':[{'model':'Interval','as':_0x6c3b('0x5'),'attributes':['id',_0x6c3b('0x4'),'interval']}]},'log':_0x6c3b('0x1')});};}; \ No newline at end of file +var _0xdc73=['Interval','interval','../client','getIntervals','name'];(function(_0x4d264b,_0x31849e){var _0x16de27=function(_0x1d33c9){while(--_0x1d33c9){_0x4d264b['push'](_0x4d264b['shift']());}};_0x16de27(++_0x31849e);}(_0xdc73,0x179));var _0x3dc7=function(_0x4f9c57,_0xa93f6b){_0x4f9c57=_0x4f9c57-0x0;var _0xe2f831=_0xdc73[_0x4f9c57];return _0xe2f831;};'use strict';var client=require(_0x3dc7('0x0'));exports[_0x3dc7('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x3dc7('0x2')],'include':[{'model':_0x3dc7('0x3'),'as':'Intervals','attributes':['id',_0x3dc7('0x2'),_0x3dc7('0x4')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 17a4301..456a8c0 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 _0xfff0=['addTagsToChatInteraction','update','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0x38aec6,_0x2ad06a){var _0x56a203=function(_0x3a3821){while(--_0x3a3821){_0x38aec6['push'](_0x38aec6['shift']());}};_0x56a203(++_0x2ad06a);}(_0xfff0,0x139));var _0x0fff=function(_0xfeed03,_0x4faa77){_0xfeed03=_0xfeed03-0x0;var _0x6cce80=_0xfff0[_0xfeed03];return _0x6cce80;};'use strict';var client=require('../client');exports[_0x0fff('0x0')]=function(_0x2b95e0,_0x148db8){return client['Request'](_0x0fff('0x1'),{'body':_0x148db8,'options':{'where':{'id':_0x2b95e0}},'log':_0x0fff('0x2')});};exports[_0x0fff('0x3')]=function(_0x4bec60,_0x2cd3d5){return client[_0x0fff('0x4')]('AddTagsToMailInteraction',{'body':_0x2cd3d5,'options':{'where':{'id':_0x4bec60}},'log':_0x0fff('0x5')});}; \ No newline at end of file +var _0x8603=['update','updateMailInteraction','addTags','Request','addTagsToChatInteraction'];(function(_0x16dc12,_0x121fa8){var _0x5113f4=function(_0x14cc93){while(--_0x14cc93){_0x16dc12['push'](_0x16dc12['shift']());}};_0x5113f4(++_0x121fa8);}(_0x8603,0x190));var _0x3860=function(_0x58a935,_0x427946){_0x58a935=_0x58a935-0x0;var _0x2d6013=_0x8603[_0x58a935];return _0x2d6013;};'use strict';var client=require('../client');exports[_0x3860('0x0')]=function(_0x3b9c54,_0x96d2bc){return client['Request']('UpdateMailInteraction',{'body':_0x96d2bc,'options':{'where':{'id':_0x3b9c54}},'log':_0x3860('0x1')});};exports[_0x3860('0x2')]=function(_0x2f56a3,_0x490262){return client[_0x3860('0x3')]('AddTagsToMailInteraction',{'body':_0x490262,'options':{'where':{'id':_0x2f56a3}},'log':_0x3860('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index e53c748..e56c083 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 _0xc73c=['createMailMessage','../client','create','Request','CreateMailMessage'];(function(_0x5bca5d,_0x5f73b8){var _0x3269ee=function(_0x5e8595){while(--_0x5e8595){_0x5bca5d['push'](_0x5bca5d['shift']());}};_0x3269ee(++_0x5f73b8);}(_0xc73c,0xc9));var _0xcc73=function(_0x8e3a27,_0x150a94){_0x8e3a27=_0x8e3a27-0x0;var _0x446f44=_0xc73c[_0x8e3a27];return _0x446f44;};'use strict';var client=require(_0xcc73('0x0'));exports[_0xcc73('0x1')]=function(_0x3d2784){return client[_0xcc73('0x2')](_0xcc73('0x3'),{'body':_0x3d2784,'log':_0xcc73('0x4')});}; \ No newline at end of file +var _0xcfb6=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcfb6,0x1ed));var _0x6cfb=function(_0x1168a1,_0xa0d8c9){_0x1168a1=_0x1168a1-0x0;var _0xcc5ad8=_0xcfb6[_0x1168a1];return _0xcc5ad8;};'use strict';var client=require(_0x6cfb('0x0'));exports[_0x6cfb('0x1')]=function(_0x4243af){return client[_0x6cfb('0x2')](_0x6cfb('0x3'),{'body':_0x4243af,'log':_0x6cfb('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 02d0e11..9f90581 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 _0x6a33=['../client','getMailQueues','Request','GetMailQueue','timeout','strategy','User','Agents','name','online','mailPause'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6a33,0x1ad));var _0x36a3=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x6a33[_0x1cb18a];return _0x22442e;};'use strict';var client=require(_0x36a3('0x0'));exports[_0x36a3('0x1')]=function(){return function(){return client[_0x36a3('0x2')](_0x36a3('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x36a3('0x4'),_0x36a3('0x5')],'include':[{'model':_0x36a3('0x6'),'as':_0x36a3('0x7'),'attributes':['id',_0x36a3('0x8'),_0x36a3('0x9'),_0x36a3('0xa')]}]},'log':_0x36a3('0x1')});};}; \ No newline at end of file +var _0x803c=['mailPause','../client','getMailQueues','Request','GetMailQueue','timeout','strategy','User','name','online'];(function(_0x2ddfd9,_0x5877d0){var _0x2668f0=function(_0x70ad6f){while(--_0x70ad6f){_0x2ddfd9['push'](_0x2ddfd9['shift']());}};_0x2668f0(++_0x5877d0);}(_0x803c,0x65));var _0xc803=function(_0x2a83d6,_0x5b13ce){_0x2a83d6=_0x2a83d6-0x0;var _0x3cb0a1=_0x803c[_0x2a83d6];return _0x3cb0a1;};'use strict';var client=require(_0xc803('0x0'));exports[_0xc803('0x1')]=function(){return function(){return client[_0xc803('0x2')](_0xc803('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xc803('0x4'),_0xc803('0x5')],'include':[{'model':_0xc803('0x6'),'as':'Agents','attributes':['id',_0xc803('0x7'),_0xc803('0x8'),_0xc803('0x9')]}]},'log':_0xc803('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 7820b06..ecc3612 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 _0xfd38=['create','Request','CreateMailQueueReport','UpdateMailQueueReport','DESC','../client'];(function(_0x25662e,_0x4cec68){var _0x59b7bc=function(_0xafb159){while(--_0xafb159){_0x25662e['push'](_0x25662e['shift']());}};_0x59b7bc(++_0x4cec68);}(_0xfd38,0x179));var _0x8fd3=function(_0x54a69d,_0x2e4c47){_0x54a69d=_0x54a69d-0x0;var _0x2b69f0=_0xfd38[_0x54a69d];return _0x2b69f0;};'use strict';var client=require(_0x8fd3('0x0'));exports[_0x8fd3('0x1')]=function(_0x147f8a){return client[_0x8fd3('0x2')](_0x8fd3('0x3'),{'body':_0x147f8a,'log':_0x8fd3('0x3')});};exports['update']=function(_0x17e0de,_0x186083){return client[_0x8fd3('0x2')](_0x8fd3('0x4'),{'body':_0x186083,'options':{'where':{'uniqueid':_0x17e0de},'order':[['id',_0x8fd3('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xcfd1=['update','UpdateMailQueueReport','../client','Request','CreateMailQueueReport'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcfd1,0x106));var _0x1cfd=function(_0x1cb384,_0x59c92d){_0x1cb384=_0x1cb384-0x0;var _0x10e25e=_0xcfd1[_0x1cb384];return _0x10e25e;};'use strict';var client=require(_0x1cfd('0x0'));exports['create']=function(_0x8d71d3){return client[_0x1cfd('0x1')](_0x1cfd('0x2'),{'body':_0x8d71d3,'log':_0x1cfd('0x2')});};exports[_0x1cfd('0x3')]=function(_0x395705,_0x4650db){return client['Request'](_0x1cfd('0x4'),{'body':_0x4650db,'options':{'where':{'uniqueid':_0x395705},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index bc6f738..c8f5ae6 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 _0x2e2f=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client','Request'];(function(_0x26388a,_0x40310b){var _0x58d11d=function(_0x1a9559){while(--_0x1a9559){_0x26388a['push'](_0x26388a['shift']());}};_0x58d11d(++_0x40310b);}(_0x2e2f,0xa6));var _0xf2e2=function(_0x4a8c17,_0x494a23){_0x4a8c17=_0x4a8c17-0x0;var _0x584d5e=_0x2e2f[_0x4a8c17];return _0x584d5e;};'use strict';var client=require(_0xf2e2('0x0'));exports['update']=function(_0x75092b,_0x57dc23){return client[_0xf2e2('0x1')](_0xf2e2('0x2'),{'body':_0x57dc23,'options':{'where':{'id':_0x75092b}},'log':_0xf2e2('0x3')});};exports[_0xf2e2('0x4')]=function(_0x54bc1c,_0x5e432e){return client[_0xf2e2('0x1')](_0xf2e2('0x5'),{'body':_0x5e432e,'options':{'where':{'id':_0x54bc1c}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x7011=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x5c930f,_0x951d2f){var _0x88fa47=function(_0x5cd9c5){while(--_0x5cd9c5){_0x5c930f['push'](_0x5c930f['shift']());}};_0x88fa47(++_0x951d2f);}(_0x7011,0x10f));var _0x1701=function(_0x2f43f4,_0x2428b1){_0x2f43f4=_0x2f43f4-0x0;var _0x4f4223=_0x7011[_0x2f43f4];return _0x4f4223;};'use strict';var client=require(_0x1701('0x0'));exports[_0x1701('0x1')]=function(_0x1fb74c,_0x1641d4){return client['Request'](_0x1701('0x2'),{'body':_0x1641d4,'options':{'where':{'id':_0x1fb74c}},'log':_0x1701('0x3')});};exports[_0x1701('0x4')]=function(_0x551d70,_0x466d8c){return client['Request'](_0x1701('0x5'),{'body':_0x466d8c,'options':{'where':{'id':_0x551d70}},'log':_0x1701('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 144c0e8..393f5b4 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 _0x854e=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x5cbf0e,_0x4cd140){var _0x1c76f8=function(_0xcc9be4){while(--_0xcc9be4){_0x5cbf0e['push'](_0x5cbf0e['shift']());}};_0x1c76f8(++_0x4cd140);}(_0x854e,0x1d8));var _0xe854=function(_0x12894d,_0x3ec664){_0x12894d=_0x12894d-0x0;var _0x188859=_0x854e[_0x12894d];return _0x188859;};'use strict';var client=require('../client');exports[_0xe854('0x0')]=function(_0xaeff3){return client[_0xe854('0x1')](_0xe854('0x2'),{'body':_0xaeff3,'log':_0xe854('0x3')});}; \ No newline at end of file +var _0xdb0a=['createOpenchannelMessage','Request'];(function(_0x56c70f,_0x4e4493){var _0x3812ed=function(_0x25460f){while(--_0x25460f){_0x56c70f['push'](_0x56c70f['shift']());}};_0x3812ed(++_0x4e4493);}(_0xdb0a,0x1d1));var _0xadb0=function(_0x3f657f,_0x47661a){_0x3f657f=_0x3f657f-0x0;var _0x2f6668=_0xdb0a[_0x3f657f];return _0x2f6668;};'use strict';var client=require('../client');exports['create']=function(_0x159637){return client[_0xadb0('0x0')]('CreateOpenchannelMessage',{'body':_0x159637,'log':_0xadb0('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 393d652..bf8ef66 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 _0x6e65=['name','timeout','Agents','online','openchannelPause','../client','Request','GetOpenchannelQueue'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x6e65,0x1c5));var _0x56e6=function(_0x2c526d,_0x284ef7){_0x2c526d=_0x2c526d-0x0;var _0x1a6e7c=_0x6e65[_0x2c526d];return _0x1a6e7c;};'use strict';var client=require(_0x56e6('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x56e6('0x1')](_0x56e6('0x2'),{'options':{'raw':![],'attributes':['id',_0x56e6('0x3'),_0x56e6('0x4'),'strategy'],'include':[{'model':'User','as':_0x56e6('0x5'),'attributes':['id',_0x56e6('0x3'),_0x56e6('0x6'),_0x56e6('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x6eaf=['strategy','Agents','name','online','openchannelPause','../client','getOpenchannelQueues','Request'];(function(_0x5bb098,_0x1e2e26){var _0x132c16=function(_0xecba03){while(--_0xecba03){_0x5bb098['push'](_0x5bb098['shift']());}};_0x132c16(++_0x1e2e26);}(_0x6eaf,0xe5));var _0xf6ea=function(_0x3ca361,_0x472454){_0x3ca361=_0x3ca361-0x0;var _0x58919e=_0x6eaf[_0x3ca361];return _0x58919e;};'use strict';var client=require(_0xf6ea('0x0'));exports[_0xf6ea('0x1')]=function(){return function(){return client[_0xf6ea('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0xf6ea('0x3')],'include':[{'model':'User','as':_0xf6ea('0x4'),'attributes':['id',_0xf6ea('0x5'),_0xf6ea('0x6'),_0xf6ea('0x7')]}]},'log':_0xf6ea('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 7357c08..55660aa 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 _0xbcde=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x3933fb,_0x409cdb){var _0x52e611=function(_0x281517){while(--_0x281517){_0x3933fb['push'](_0x3933fb['shift']());}};_0x52e611(++_0x409cdb);}(_0xbcde,0x1ef));var _0xebcd=function(_0x2fbe34,_0x356b20){_0x2fbe34=_0x2fbe34-0x0;var _0x4d4df7=_0xbcde[_0x2fbe34];return _0x4d4df7;};'use strict';var client=require(_0xebcd('0x0'));exports[_0xebcd('0x1')]=function(_0x2e153d){return client[_0xebcd('0x2')](_0xebcd('0x3'),{'body':_0x2e153d,'log':_0xebcd('0x3')});};exports[_0xebcd('0x4')]=function(_0x4cd900,_0x5bcfb3){return client[_0xebcd('0x2')](_0xebcd('0x5'),{'body':_0x5bcfb3,'options':{'where':{'uniqueid':_0x4cd900},'order':[['id',_0xebcd('0x6')]],'limit':0x1},'log':_0xebcd('0x5')});}; \ No newline at end of file +var _0xcb49=['update','DESC','../client','Request','CreateOpenchannelQueueReport'];(function(_0x4485bd,_0x1a82b2){var _0x12dd5e=function(_0x2fb2c8){while(--_0x2fb2c8){_0x4485bd['push'](_0x4485bd['shift']());}};_0x12dd5e(++_0x1a82b2);}(_0xcb49,0x156));var _0x9cb4=function(_0xdb01a,_0x54a83a){_0xdb01a=_0xdb01a-0x0;var _0x107ede=_0xcb49[_0xdb01a];return _0x107ede;};'use strict';var client=require(_0x9cb4('0x0'));exports['create']=function(_0x3a7326){return client[_0x9cb4('0x1')](_0x9cb4('0x2'),{'body':_0x3a7326,'log':_0x9cb4('0x2')});};exports[_0x9cb4('0x3')]=function(_0x3bb409,_0x4a8453){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x4a8453,'options':{'where':{'uniqueid':_0x3bb409},'order':[['id',_0x9cb4('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index fe7d39c..6779eba 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 _0x5a2a=['addTagsToSmsInteraction','../client','update','addTags','Request','AddTagsToSmsInteraction'];(function(_0x463a2d,_0x315447){var _0x2c6562=function(_0x1b8250){while(--_0x1b8250){_0x463a2d['push'](_0x463a2d['shift']());}};_0x2c6562(++_0x315447);}(_0x5a2a,0x1c3));var _0xa5a2=function(_0xdab5c0,_0x1e5557){_0xdab5c0=_0xdab5c0-0x0;var _0x5ebcd6=_0x5a2a[_0xdab5c0];return _0x5ebcd6;};'use strict';var client=require(_0xa5a2('0x0'));exports[_0xa5a2('0x1')]=function(_0x3f0c5f,_0x1c932a){return client['Request']('UpdateSmsInteraction',{'body':_0x1c932a,'options':{'where':{'id':_0x3f0c5f}},'log':'updateSmsInteraction'});};exports[_0xa5a2('0x2')]=function(_0x2cf196,_0x479d0a){return client[_0xa5a2('0x3')](_0xa5a2('0x4'),{'body':_0x479d0a,'options':{'where':{'id':_0x2cf196}},'log':_0xa5a2('0x5')});}; \ No newline at end of file +var _0xe5d5=['AddTagsToSmsInteraction','addTagsToSmsInteraction','Request','updateSmsInteraction'];(function(_0x317d61,_0x5e6335){var _0x3abc20=function(_0x556876){while(--_0x556876){_0x317d61['push'](_0x317d61['shift']());}};_0x3abc20(++_0x5e6335);}(_0xe5d5,0x156));var _0x5e5d=function(_0x1f727c,_0x206abd){_0x1f727c=_0x1f727c-0x0;var _0x227c56=_0xe5d5[_0x1f727c];return _0x227c56;};'use strict';var client=require('../client');exports['update']=function(_0x1233f3,_0x4f6845){return client[_0x5e5d('0x0')]('UpdateSmsInteraction',{'body':_0x4f6845,'options':{'where':{'id':_0x1233f3}},'log':_0x5e5d('0x1')});};exports['addTags']=function(_0x3e2410,_0x191980){return client[_0x5e5d('0x0')](_0x5e5d('0x2'),{'body':_0x191980,'options':{'where':{'id':_0x3e2410}},'log':_0x5e5d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 3989a85..b34546c 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 _0x7ec9=['Request','createSmsMessage','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ec9,0xaa));var _0x97ec=function(_0x46c1d5,_0x5ca335){_0x46c1d5=_0x46c1d5-0x0;var _0x40fe7b=_0x7ec9[_0x46c1d5];return _0x40fe7b;};'use strict';var client=require('../client');exports[_0x97ec('0x0')]=function(_0x2807cd){return client[_0x97ec('0x1')]('CreateSmsMessage',{'body':_0x2807cd,'log':_0x97ec('0x2')});}; \ No newline at end of file +var _0x41ba=['create','CreateSmsMessage','createSmsMessage'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x41ba,0x9f));var _0xa41b=function(_0x135865,_0x1d0276){_0x135865=_0x135865-0x0;var _0x3f210c=_0x41ba[_0x135865];return _0x3f210c;};'use strict';var client=require('../client');exports[_0xa41b('0x0')]=function(_0x4246a9){return client['Request'](_0xa41b('0x1'),{'body':_0x4246a9,'log':_0xa41b('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 90a3193..d3bdb1c 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 _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x3bf618,_0xea4027){var _0x4e9307=function(_0x5848c5){while(--_0x5848c5){_0x3bf618['push'](_0x3bf618['shift']());}};_0x4e9307(++_0xea4027);}(_0x70e0,0x17b));var _0x070e=function(_0x10ae78,_0x5dd7c0){_0x10ae78=_0x10ae78-0x0;var _0x4ae688=_0x70e0[_0x10ae78];return _0x4ae688;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x5b2c7e,_0x3d22f0){var _0x5ec399=function(_0x1a87ad){while(--_0x1a87ad){_0x5b2c7e['push'](_0x5b2c7e['shift']());}};_0x5ec399(++_0x3d22f0);}(_0x70e0,0x17b));var _0x070e=function(_0x1c334a,_0x219074){_0x1c334a=_0x1c334a-0x0;var _0x210150=_0x70e0[_0x1c334a];return _0x210150;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 513f00a..5643ba6 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x1cf34d,_0x4ba991){var _0x5ef605=function(_0x5747df){while(--_0x5747df){_0x1cf34d['push'](_0x1cf34d['shift']());}};_0x5ef605(++_0x4ba991);}(_0x70e0,0x17b));var _0x070e=function(_0x4598b7,_0x45c122){_0x4598b7=_0x4598b7-0x0;var _0x337311=_0x70e0[_0x4598b7];return _0x337311;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x30b0fe,_0x542156){var _0x412d11=function(_0x39cf5d){while(--_0x39cf5d){_0x30b0fe['push'](_0x30b0fe['shift']());}};_0x412d11(++_0x542156);}(_0x008c,0x188));var _0xc008=function(_0x269094,_0x4701b3){_0x269094=_0x269094-0x0;var _0x10344f=_0x008c[_0x269094];return _0x10344f;};'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 b10999f..657df3e 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(_0x5bab70,_0x39cf50){var _0x5cf836=function(_0x16f596){while(--_0x16f596){_0x5bab70['push'](_0x5bab70['shift']());}};_0x5cf836(++_0x39cf50);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x553dd1,_0x220edb){var _0x5499c5=function(_0x32e021){while(--_0x32e021){_0x553dd1['push'](_0x553dd1['shift']());}};_0x5499c5(++_0x220edb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 f06e30d..faba001 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 _0x9e8a=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','../client','update'];(function(_0x3d312b,_0x1dcfa3){var _0x114fdd=function(_0x7c27){while(--_0x7c27){_0x3d312b['push'](_0x3d312b['shift']());}};_0x114fdd(++_0x1dcfa3);}(_0x9e8a,0x112));var _0xa9e8=function(_0x450f72,_0x39b67e){_0x450f72=_0x450f72-0x0;var _0x457545=_0x9e8a[_0x450f72];return _0x457545;};'use strict';var client=require(_0xa9e8('0x0'));exports[_0xa9e8('0x1')]=function(_0x1f8ea6,_0x5c6bb4){return client[_0xa9e8('0x2')](_0xa9e8('0x3'),{'body':_0x5c6bb4,'options':{'where':{'id':_0x1f8ea6}},'log':_0xa9e8('0x4')});};exports[_0xa9e8('0x5')]=function(_0xe3b2c8,_0x57736c){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x57736c,'options':{'where':{'id':_0xe3b2c8}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x199c=['updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','Request','UpdateWhatsappInteraction'];(function(_0x1d0946,_0x3732fc){var _0x205df=function(_0x3dab23){while(--_0x3dab23){_0x1d0946['push'](_0x1d0946['shift']());}};_0x205df(++_0x3732fc);}(_0x199c,0x1d8));var _0xc199=function(_0x294233,_0x4595d2){_0x294233=_0x294233-0x0;var _0x5d9ead=_0x199c[_0x294233];return _0x5d9ead;};'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 1026f66..b7027fd 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 _0xbf89=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x4dc0a4,_0x40cd7b){var _0x3e1953=function(_0x42c183){while(--_0x42c183){_0x4dc0a4['push'](_0x4dc0a4['shift']());}};_0x3e1953(++_0x40cd7b);}(_0xbf89,0x104));var _0x9bf8=function(_0x2fbb21,_0x1f3785){_0x2fbb21=_0x2fbb21-0x0;var _0x1caa91=_0xbf89[_0x2fbb21];return _0x1caa91;};'use strict';var client=require(_0x9bf8('0x0'));exports[_0x9bf8('0x1')]=function(_0x1f918a){return client[_0x9bf8('0x2')](_0x9bf8('0x3'),{'body':_0x1f918a,'log':_0x9bf8('0x4')});}; \ No newline at end of file +var _0x3eea=['../client','create','Request','CreateWhatsappMessage'];(function(_0x36e94f,_0x4dabf0){var _0x3f9787=function(_0x1f9da5){while(--_0x1f9da5){_0x36e94f['push'](_0x36e94f['shift']());}};_0x3f9787(++_0x4dabf0);}(_0x3eea,0x90));var _0xa3ee=function(_0x4a98b4,_0x263616){_0x4a98b4=_0x4a98b4-0x0;var _0x25e4d4=_0x3eea[_0x4a98b4];return _0x25e4d4;};'use strict';var client=require(_0xa3ee('0x0'));exports[_0xa3ee('0x1')]=function(_0x238498){return client[_0xa3ee('0x2')](_0xa3ee('0x3'),{'body':_0x238498,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 3e6899d..0d131c1 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 _0xa5ed=['name','timeout','Agents','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0x6f47cf,_0x583685){var _0x5738d1=function(_0x187b1f){while(--_0x187b1f){_0x6f47cf['push'](_0x6f47cf['shift']());}};_0x5738d1(++_0x583685);}(_0xa5ed,0x9e));var _0xda5e=function(_0x14ae3c,_0x90fa32){_0x14ae3c=_0x14ae3c-0x0;var _0x1d1060=_0xa5ed[_0x14ae3c];return _0x1d1060;};'use strict';var client=require(_0xda5e('0x0'));exports[_0xda5e('0x1')]=function(){return function(){return client[_0xda5e('0x2')](_0xda5e('0x3'),{'options':{'raw':![],'attributes':['id',_0xda5e('0x4'),_0xda5e('0x5'),'strategy'],'include':[{'model':'User','as':_0xda5e('0x6'),'attributes':['id',_0xda5e('0x4'),_0xda5e('0x7'),_0xda5e('0x8')]}]},'log':_0xda5e('0x1')});};}; \ No newline at end of file +var _0x3aba=['getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','whatsappPause','../client'];(function(_0x2e81c9,_0x15a07c){var _0x217cf2=function(_0x2963d2){while(--_0x2963d2){_0x2e81c9['push'](_0x2e81c9['shift']());}};_0x217cf2(++_0x15a07c);}(_0x3aba,0x1f3));var _0xa3ab=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0x3aba[_0x5cbf0e];return _0x1c76f8;};'use strict';var client=require(_0xa3ab('0x0'));exports[_0xa3ab('0x1')]=function(){return function(){return client[_0xa3ab('0x2')](_0xa3ab('0x3'),{'options':{'raw':![],'attributes':['id',_0xa3ab('0x4'),_0xa3ab('0x5'),_0xa3ab('0x6')],'include':[{'model':_0xa3ab('0x7'),'as':_0xa3ab('0x8'),'attributes':['id',_0xa3ab('0x4'),'online',_0xa3ab('0x9')]}]},'log':_0xa3ab('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 798bd65..10d0175 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 _0x329e=['../client','create','CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport','DESC'];(function(_0x4b91c4,_0xcdff37){var _0x4917f7=function(_0x1a5d4a){while(--_0x1a5d4a){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x4917f7(++_0xcdff37);}(_0x329e,0x196));var _0xe329=function(_0x1946f7,_0x344f58){_0x1946f7=_0x1946f7-0x0;var _0x2f8b34=_0x329e[_0x1946f7];return _0x2f8b34;};'use strict';var client=require(_0xe329('0x0'));exports[_0xe329('0x1')]=function(_0x2d6b63){return client['Request'](_0xe329('0x2'),{'body':_0x2d6b63,'log':_0xe329('0x2')});};exports[_0xe329('0x3')]=function(_0x4e57cd,_0x924f40){return client[_0xe329('0x4')](_0xe329('0x5'),{'body':_0x924f40,'options':{'where':{'uniqueid':_0x4e57cd},'order':[['id',_0xe329('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x927d=['../client','create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC'];(function(_0x273e3f,_0x553206){var _0x3f6759=function(_0x150a33){while(--_0x150a33){_0x273e3f['push'](_0x273e3f['shift']());}};_0x3f6759(++_0x553206);}(_0x927d,0x1a4));var _0xd927=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x927d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xd927('0x0'));exports[_0xd927('0x1')]=function(_0x177394){return client[_0xd927('0x2')]('CreateWhatsappQueueReport',{'body':_0x177394,'log':_0xd927('0x3')});};exports['update']=function(_0x49f8af,_0x383ecc){return client[_0xd927('0x2')](_0xd927('0x4'),{'body':_0x383ecc,'options':{'where':{'uniqueid':_0x49f8af},'order':[['id',_0xd927('0x5')]],'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 ae434cb..bd94ed6 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 _0xb7e9=['stack','lodash','util','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','consequence','validate','length','map','message','join','stop','find','agents','timeout','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s'];(function(_0x4ddaa4,_0x33944f){var _0xa79179=function(_0x253d37){while(--_0x253d37){_0x4ddaa4['push'](_0x4ddaa4['shift']());}};_0xa79179(++_0x33944f);}(_0xb7e9,0x173));var _0x9b7e=function(_0x5ba513,_0x459c3b){_0x5ba513=_0x5ba513-0x0;var _0x1132a0=_0xb7e9[_0x5ba513];return _0x1132a0;};'use strict';var schema=require('validate');var _=require(_0x9b7e('0x0'));var util=require(_0x9b7e('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x9b7e('0x2'))(_0x9b7e('0x3'));var strategy=require(_0x9b7e('0x4'));var queue=schema({'name':{'type':_0x9b7e('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9b7e('0x6'),'message':_0x9b7e('0x7')}});function writeLog(_0x3b870b,_0x2c0f47,_0x56e83a){return logger[_0x9b7e('0x8')](util[_0x9b7e('0x9')](_0x9b7e('0xa'),_0x3b870b,_0x2c0f47[_0x9b7e('0xb')],_0x56e83a));}function handleFindAgent(_0x223178){return function(_0x1b1739){return _0x1b1739['name']['toLowerCase']()===_0x223178['toLowerCase']();};}exports[_0x9b7e('0xc')]=function(_0x196ec5,_0x28a827,_0x164dfc,_0x3250b3){return function(_0x1b5a6b){try{var _0x43cefe={'name':_0x28a827[0x0],'timeout':_0x28a827[0x1]};var _0x1323a4=queue[_0x9b7e('0xd')](_0x43cefe,{'typecast':!![]});if(_0x1323a4[_0x9b7e('0xe')]){logger['error']('[%s][AGENT]\x20%s',_0x196ec5,_[_0x9b7e('0xf')](_0x1323a4,_0x9b7e('0x10'))[_0x9b7e('0x11')](',\x20'));_0x1b5a6b[_0x9b7e('0x12')]();}else{var _0x3b6de3=_[_0x9b7e('0x13')](_0x164dfc[_0x9b7e('0x14')],handleFindAgent(_0x43cefe[_0x9b7e('0xb')]));if(_0x3b6de3){var _0x184fb6=(_0x43cefe[_0x9b7e('0x15')]||0xa)*0x3e8;var _0x1a8b25,_0x38afa2;var _0x14bdbb=seqqueue[_0x9b7e('0x16')](_0x184fb6);_0x14bdbb['id']=_0x196ec5;_0x14bdbb['atimeout']=_0x184fb6;_0x14bdbb[_0x9b7e('0x17')]=_0x3250b3[_0x9b7e('0x17')];writeLog(_0x196ec5,_0x3b6de3,util[_0x9b7e('0x9')](_0x9b7e('0x18'),_0x184fb6));_0x164dfc[_0x9b7e('0x19')][_0x196ec5]['on'](_0x9b7e('0x1a'),function(){logger[_0x9b7e('0x8')](_0x9b7e('0x1b'),_0x196ec5);clearTimeout(_0x38afa2);_0x38afa2=undefined;_0x14bdbb[_0x9b7e('0x1c')]();if(_0x164dfc[_0x9b7e('0x19')][_0x196ec5]){delete _0x164dfc[_0x9b7e('0x19')][_0x196ec5];}_0x1b5a6b[_0x9b7e('0x12')]();});_0x164dfc[_0x9b7e('0x19')][_0x196ec5]['on'](_0x9b7e('0x1d'),function(){if(_0x164dfc[_0x9b7e('0x19')][_0x196ec5]){delete _0x164dfc[_0x9b7e('0x19')][_0x196ec5];}});_0x38afa2=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x196ec5);clearTimeout(_0x38afa2);_0x14bdbb[_0x9b7e('0x1c')]();_0x1b5a6b[_0x9b7e('0x1e')]();},_0x184fb6);strategy[_0x9b7e('0x1f')](_0x14bdbb,_0x3b6de3,_0x164dfc,_0x3250b3);}else{logger[_0x9b7e('0x20')](_0x9b7e('0x21'),_0x196ec5,_0x43cefe['name']);_0x1b5a6b[_0x9b7e('0x12')]();}}}catch(_0x4badb8){console[_0x9b7e('0x22')](_0x4badb8);logger[_0x9b7e('0x20')](_0x9b7e('0x23'),_0x196ec5,_0x4badb8[_0x9b7e('0x24')]);_0x1b5a6b[_0x9b7e('0x12')]();}};}; \ No newline at end of file +var _0xe685=['timeout','atimeout','channel','format','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','lodash','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','error','map','message','stop','find'];(function(_0x4bc688,_0x3cd083){var _0x2167ee=function(_0x200de3){while(--_0x200de3){_0x4bc688['push'](_0x4bc688['shift']());}};_0x2167ee(++_0x3cd083);}(_0xe685,0x1ed));var _0x5e68=function(_0x30dfd6,_0x13fe7b){_0x30dfd6=_0x30dfd6-0x0;var _0x199a0a=_0xe685[_0x30dfd6];return _0x199a0a;};'use strict';var schema=require('validate');var _=require(_0x5e68('0x0'));var util=require(_0x5e68('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x5e68('0x2'))(_0x5e68('0x3'));var strategy=require(_0x5e68('0x4'));var queue=schema({'name':{'type':_0x5e68('0x5'),'required':!![],'message':_0x5e68('0x6')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x13f7a9,_0x3f094f,_0x21913e){return logger[_0x5e68('0x7')](util['format'](_0x5e68('0x8'),_0x13f7a9,_0x3f094f[_0x5e68('0x9')],_0x21913e));}function handleFindAgent(_0x165280){return function(_0x572c86){return _0x572c86['name']['toLowerCase']()===_0x165280[_0x5e68('0xa')]();};}exports[_0x5e68('0xb')]=function(_0x71cf0e,_0x1028b8,_0x5e78ad,_0x4e3c3b){return function(_0x4ad64c){try{var _0x4a3836={'name':_0x1028b8[0x0],'timeout':_0x1028b8[0x1]};var _0x48b043=queue[_0x5e68('0xc')](_0x4a3836,{'typecast':!![]});if(_0x48b043[_0x5e68('0xd')]){logger[_0x5e68('0xe')]('[%s][AGENT]\x20%s',_0x71cf0e,_[_0x5e68('0xf')](_0x48b043,_0x5e68('0x10'))['join'](',\x20'));_0x4ad64c[_0x5e68('0x11')]();}else{var _0x5b3ff2=_[_0x5e68('0x12')](_0x5e78ad['agents'],handleFindAgent(_0x4a3836[_0x5e68('0x9')]));if(_0x5b3ff2){var _0x21188b=(_0x4a3836[_0x5e68('0x13')]||0xa)*0x3e8;var _0x5a6c1d,_0x44c63f;var _0x5a97e3=seqqueue['createQueue'](_0x21188b);_0x5a97e3['id']=_0x71cf0e;_0x5a97e3[_0x5e68('0x14')]=_0x21188b;_0x5a97e3[_0x5e68('0x15')]=_0x4e3c3b[_0x5e68('0x15')];writeLog(_0x71cf0e,_0x5b3ff2,util[_0x5e68('0x16')](_0x5e68('0x17'),_0x21188b));_0x5e78ad[_0x5e68('0x18')][_0x71cf0e]['on']('end',function(){logger[_0x5e68('0x7')](_0x5e68('0x19'),_0x71cf0e);clearTimeout(_0x44c63f);_0x44c63f=undefined;_0x5a97e3['close']();if(_0x5e78ad[_0x5e68('0x18')][_0x71cf0e]){delete _0x5e78ad[_0x5e68('0x18')][_0x71cf0e];}_0x4ad64c[_0x5e68('0x11')]();});_0x5e78ad['rules'][_0x71cf0e]['on'](_0x5e68('0x1a'),function(){if(_0x5e78ad[_0x5e68('0x18')][_0x71cf0e]){delete _0x5e78ad[_0x5e68('0x18')][_0x71cf0e];}});_0x44c63f=setTimeout(function(){logger[_0x5e68('0x7')](_0x5e68('0x1b'),_0x71cf0e);clearTimeout(_0x44c63f);_0x5a97e3[_0x5e68('0x1c')]();_0x4ad64c[_0x5e68('0x1d')]();},_0x21188b);strategy['agent'](_0x5a97e3,_0x5b3ff2,_0x5e78ad,_0x4e3c3b);}else{logger[_0x5e68('0xe')](_0x5e68('0x1e'),_0x71cf0e,_0x4a3836[_0x5e68('0x9')]);_0x4ad64c[_0x5e68('0x11')]();}}}catch(_0x1b5e29){console[_0x5e68('0x1f')](_0x1b5e29);logger['error']('[%s][QUEUE]\x20%s',_0x71cf0e,_0x1b5e29['stack']);_0x4ad64c['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 744a38d..2e19dab 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 _0xfc0c=['channel','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','Message','create','then','[%s][AMAZONLEX]\x20%s','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','catch','stringify','moment','aws-sdk','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','sms'];(function(_0x18afd7,_0x2bb7c3){var _0x4d212a=function(_0x14fa1b){while(--_0x14fa1b){_0x18afd7['push'](_0x18afd7['shift']());}};_0x4d212a(++_0x2bb7c3);}(_0xfc0c,0x103));var _0xcfc0=function(_0x1477f6,_0x36e2d6){_0x1477f6=_0x1477f6-0x0;var _0x232dcb=_0xfc0c[_0x1477f6];return _0x232dcb;};'use strict';var _=require('lodash');var moment=require(_0xcfc0('0x0'));var AWS=require(_0xcfc0('0x1'));var utils=require('./utils');var logger=require(_0xcfc0('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xcfc0('0x3')),'mailMessage':require(_0xcfc0('0x4')),'smsMessage':require(_0xcfc0('0x5')),'faxMessage':require(_0xcfc0('0x6')),'whatsappMessage':require(_0xcfc0('0x7'))};exports['consequence']=function(_0xae6edc,_0xad2070){return function(_0x57069c){try{if(!_[_0xcfc0('0x8')](this[_0xcfc0('0x9')]['UserId'])){logger[_0xcfc0('0xa')]('[%s][AMAZONLEX]\x20%s',_0xae6edc,_0xcfc0('0xb'));return _0x57069c[_0xcfc0('0xc')]();}var _0x3276f2={'ContactId':this[_0xcfc0('0xd')]['id'],'sentAt':moment()[_0xcfc0('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xcfc0('0xf')};if(this['channel']===_0xcfc0('0x10')||this[_0xcfc0('0x11')]===_0xcfc0('0x12')){_0x3276f2[_0xcfc0('0x13')]=this[_0xcfc0('0x9')]['phone'];}var _0x14892f=this[_0xcfc0('0x11')];if(_0x14892f==='chat'){_0x3276f2[_0xcfc0('0x14')]=this[_0xcfc0('0x15')]['id'];}else{_0x3276f2[_[_0xcfc0('0x16')](_0x14892f)+_0xcfc0('0x17')]=this[_0xcfc0('0x15')]['id'];}_0x3276f2[_['upperFirst'](_0x14892f)+_0xcfc0('0x18')]=this[_0xcfc0('0x9')]['id'];if(this[_0xcfc0('0x9')]['created']){var _0x2d9108=_0xad2070[0x4];if(!_[_0xcfc0('0x19')](_0x2d9108)){_0x3276f2[_0xcfc0('0x1a')]=utils['getMustacheRender'](_0x2d9108,this);return rpc[_0x14892f+_0xcfc0('0x1b')][_0xcfc0('0x1c')](_0x3276f2)[_0xcfc0('0x1d')](function(_0x4f6410){logger[_0xcfc0('0xa')](_0xcfc0('0x1e'),_0xae6edc,_0x3276f2[_0xcfc0('0x1a')]);})['catch'](function(_0x193f5e){logger[_0xcfc0('0x1f')](_0xcfc0('0x1e'),_0xae6edc,JSON['stringify'](_0x193f5e));})[_0xcfc0('0x20')](function(){logger['info'](_0xcfc0('0x21'),_0xae6edc);_0x57069c['stop']();});}else{logger[_0xcfc0('0xa')](_0xcfc0('0x22'),_0xae6edc);_0x57069c[_0xcfc0('0x23')]();}}else{var _0x2ac41a=this;var _0x3e5358=new AWS[(_0xcfc0('0x24'))]({'accessKeyId':_0xad2070[0x0],'secretAccessKey':_0xad2070[0x1],'region':_0xad2070[0x2]});var _0x2dcf00={'botAlias':_0xcfc0('0x25'),'botName':_0xad2070[0x3],'inputText':this[_0xcfc0('0x26')][_0xcfc0('0x1a')],'userId':this[_0xcfc0('0x11')]+':'+this['interaction']['id'][_0xcfc0('0x27')]()};_0x3e5358[_0xcfc0('0x28')](_0x2dcf00,function(_0x54f867,_0x16bcb3){if(_0x54f867){logger[_0xcfc0('0x1f')](_0xcfc0('0x1e'),_0xae6edc,_0x54f867['message']);_0x57069c['next']();}else if(_0x16bcb3&&_0x16bcb3[_0xcfc0('0x26')]){_0x2ac41a[_0xcfc0('0x1a')][_0xcfc0('0x29')]=_0x16bcb3;_0x3276f2[_0xcfc0('0x1a')]=_0x16bcb3[_0xcfc0('0x26')];_0x3276f2[_0xcfc0('0x2a')]=_0xcfc0('0x29');_0x3276f2[_0xcfc0('0x2b')]=JSON['stringify'](_0x16bcb3);return rpc[_0x14892f+'Message'][_0xcfc0('0x1c')](_0x3276f2)[_0xcfc0('0x1d')](function(_0x31a4fc){logger[_0xcfc0('0xa')]('[%s][AMAZONLEX]\x20%s',_0xae6edc,_0x3276f2[_0xcfc0('0x1a')]);if(_0x16bcb3['dialogState']=='Failed'){_0x57069c[_0xcfc0('0xc')]();}else{_0x57069c[_0xcfc0('0x23')]();}})[_0xcfc0('0x2c')](function(_0x2a003f){logger[_0xcfc0('0x1f')](_0xcfc0('0x1e'),_0xae6edc,JSON[_0xcfc0('0x2d')](_0x2a003f));_0x57069c['next']();});}else{_0x57069c[_0xcfc0('0xc')]();}});}}catch(_0x156bf0){logger[_0xcfc0('0x1f')]('[%s][AMAZONLEX]\x20%s',_0xae6edc,JSON[_0xcfc0('0x2d')](_0x156bf0));_0x57069c[_0xcfc0('0x23')]();}};}; \ No newline at end of file +var _0x8266=['consequence','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','body','getMustacheRender','create','then','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','amazonlex','providerName','dialogState','catch','moment','aws-sdk','./utils','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8266,0xe9));var _0x6826=function(_0x4b47b8,_0xaf49fc){_0x4b47b8=_0x4b47b8-0x0;var _0xbb3fc8=_0x8266[_0x4b47b8];return _0xbb3fc8;};'use strict';var _=require('lodash');var moment=require(_0x6826('0x0'));var AWS=require(_0x6826('0x1'));var utils=require(_0x6826('0x2'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x6826('0x3')),'smsMessage':require(_0x6826('0x4')),'faxMessage':require(_0x6826('0x5')),'whatsappMessage':require(_0x6826('0x6'))};exports[_0x6826('0x7')]=function(_0x1e7d9f,_0x540f71){return function(_0x5c78a7){try{if(!_['isNil'](this['interaction'][_0x6826('0x8')])){logger[_0x6826('0x9')](_0x6826('0xa'),_0x1e7d9f,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5c78a7[_0x6826('0xb')]();}var _0x3b6d27={'ContactId':this[_0x6826('0xc')]['id'],'sentAt':moment()[_0x6826('0xd')](_0x6826('0xe')),'direction':_0x6826('0xf')};if(this[_0x6826('0x10')]==='sms'||this[_0x6826('0x10')]==='whatsapp'){_0x3b6d27[_0x6826('0x11')]=this[_0x6826('0x12')]['phone'];}var _0x389bfd=this['channel'];if(_0x389bfd===_0x6826('0x13')){_0x3b6d27[_0x6826('0x14')]=this[_0x6826('0x15')]['id'];}else{_0x3b6d27[_[_0x6826('0x16')](_0x389bfd)+_0x6826('0x17')]=this[_0x6826('0x15')]['id'];}_0x3b6d27[_[_0x6826('0x16')](_0x389bfd)+'InteractionId']=this['interaction']['id'];if(this[_0x6826('0x12')]['created']){var _0x3a3941=_0x540f71[0x4];if(!_['isEmpty'](_0x3a3941)){_0x3b6d27[_0x6826('0x18')]=utils[_0x6826('0x19')](_0x3a3941,this);return rpc[_0x389bfd+'Message'][_0x6826('0x1a')](_0x3b6d27)[_0x6826('0x1b')](function(_0x4d8071){logger[_0x6826('0x9')](_0x6826('0xa'),_0x1e7d9f,_0x3b6d27[_0x6826('0x18')]);})['catch'](function(_0x279900){logger[_0x6826('0x1c')]('[%s][AMAZONLEX]\x20%s',_0x1e7d9f,JSON[_0x6826('0x1d')](_0x279900));})['finally'](function(){logger[_0x6826('0x9')](_0x6826('0x1e'),_0x1e7d9f);_0x5c78a7[_0x6826('0x1f')]();});}else{logger['info'](_0x6826('0x20'),_0x1e7d9f);_0x5c78a7[_0x6826('0x1f')]();}}else{var _0xb6e003=this;var _0x4b6f4c=new AWS[(_0x6826('0x21'))]({'accessKeyId':_0x540f71[0x0],'secretAccessKey':_0x540f71[0x1],'region':_0x540f71[0x2]});var _0x5a8e25={'botAlias':_0x6826('0x22'),'botName':_0x540f71[0x3],'inputText':this[_0x6826('0x23')][_0x6826('0x18')],'userId':this['channel']+':'+this[_0x6826('0x12')]['id']['toString']()};_0x4b6f4c['postText'](_0x5a8e25,function(_0x281155,_0x196ae4){if(_0x281155){logger['error']('[%s][AMAZONLEX]\x20%s',_0x1e7d9f,_0x281155['message']);_0x5c78a7[_0x6826('0xb')]();}else if(_0x196ae4&&_0x196ae4['message']){_0xb6e003[_0x6826('0x18')][_0x6826('0x24')]=_0x196ae4;_0x3b6d27[_0x6826('0x18')]=_0x196ae4[_0x6826('0x23')];_0x3b6d27[_0x6826('0x25')]=_0x6826('0x24');_0x3b6d27['providerResponse']=JSON[_0x6826('0x1d')](_0x196ae4);return rpc[_0x389bfd+'Message'][_0x6826('0x1a')](_0x3b6d27)['then'](function(_0x46bf5c){logger['info'](_0x6826('0xa'),_0x1e7d9f,_0x3b6d27[_0x6826('0x18')]);if(_0x196ae4[_0x6826('0x26')]=='Failed'){_0x5c78a7['next']();}else{_0x5c78a7[_0x6826('0x1f')]();}})[_0x6826('0x27')](function(_0x567b15){logger[_0x6826('0x1c')]('[%s][AMAZONLEX]\x20%s',_0x1e7d9f,JSON[_0x6826('0x1d')](_0x567b15));_0x5c78a7[_0x6826('0xb')]();});}else{_0x5c78a7[_0x6826('0xb')]();}});}}catch(_0x371470){logger[_0x6826('0x1c')](_0x6826('0xa'),_0x1e7d9f,JSON[_0x6826('0x1d')](_0x371470));_0x5c78a7[_0x6826('0x1f')]();}};}; \ 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 05c2179..d460447 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 _0xafa3=['create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Message','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','info','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','ChatWebsiteId','upperFirst','AccountId','InteractionId','mail','inReplyTo','messageId','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','account','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xafa3,0xe0));var _0x3afa=function(_0x2cac2e,_0x59d4c3){_0x2cac2e=_0x2cac2e-0x0;var _0x19ffe8=_0xafa3[_0x2cac2e];return _0x19ffe8;};'use strict';var _=require(_0x3afa('0x0'));var moment=require('moment');var utils=require(_0x3afa('0x1'));var logger=require(_0x3afa('0x2'))('routing');var rpc={'chatMessage':require(_0x3afa('0x3')),'openchannelMessage':require(_0x3afa('0x4')),'mailMessage':require(_0x3afa('0x5')),'smsMessage':require(_0x3afa('0x6')),'faxMessage':require(_0x3afa('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x3afa('0x8')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x3afa('0x9')),'smsInteraction':require(_0x3afa('0xa')),'faxInteraction':require(_0x3afa('0xb')),'whatsappInteraction':require(_0x3afa('0xc'))};var mailRpc=require(_0x3afa('0xd'));exports[_0x3afa('0xe')]=function(_0x5c6906,_0x283bc0,_0x1ed4a2,_0xb30ca7){return function(_0x133751){try{var _0x27b889=this[_0x3afa('0xf')];if(_0x27b889==='mail'&&_0xb30ca7[_0x3afa('0x10')][_0x3afa('0x11')]){logger['info'](_0x3afa('0x12'),_0x5c6906,_0x3afa('0x13'));return _0x133751[_0x3afa('0x14')]();}if(_0x283bc0[0x0]==='1'&&(_[_0x3afa('0x15')](this[_0x3afa('0x16')][_0x3afa('0x17')])||!this[_0x3afa('0x16')][_0x3afa('0x17')])){logger[_0x3afa('0x18')](_0x3afa('0x12'),_0x5c6906,_0x3afa('0x19'));return _0x133751[_0x3afa('0x14')]();}if(_0x283bc0[0x0]==='2'&&this[_0x3afa('0x16')][_0x3afa('0x1a')]){logger[_0x3afa('0x18')](_0x3afa('0x1b'),_0x5c6906,_0x3afa('0x1c'));return _0x133751['next']();}var _0x3a9ee6={'ContactId':this[_0x3afa('0x1d')]['id'],'sentAt':moment()[_0x3afa('0x1e')](_0x3afa('0x1f')),'direction':'out'};if(this['channel']==='mail'){_0x3a9ee6[_0x3afa('0x10')]=utils[_0x3afa('0x20')](_0x283bc0[0x2],this);}else{_0x3a9ee6[_0x3afa('0x10')]=utils[_0x3afa('0x20')](_0x283bc0[0x1],this);}if(this[_0x3afa('0x21')]){_0x3a9ee6['to']=this[_0x3afa('0x21')][_0x3afa('0x22')]||'';if(this[_0x3afa('0xf')]==='mail'&&_0x283bc0[0x1]==='1'){_0x3a9ee6['cc']=this[_0x3afa('0x21')]['cc']||'';}_0x3a9ee6['from']=this['message']['to']||'';_0x3a9ee6[_0x3afa('0x23')]=this[_0x3afa('0x21')][_0x3afa('0x23')]||'';_0x3a9ee6[_0x3afa('0x24')]=!![];if(this['message'][_0x3afa('0x25')]){_0x3a9ee6[_0x3afa('0x25')]='';_0x3a9ee6[_0x3afa('0x25')]+=_[_0x3afa('0x26')](this[_0x3afa('0x21')][_0x3afa('0x25')],'Re:')?'':_0x3afa('0x27');_0x3a9ee6[_0x3afa('0x25')]+=this['message'][_0x3afa('0x25')];}}if(this['channel']==='chat'){_0x3a9ee6[_0x3afa('0x28')]=this['account']['id'];}else{_0x3a9ee6[_[_0x3afa('0x29')](this[_0x3afa('0xf')])+_0x3afa('0x2a')]=this['account']['id'];}_0x3a9ee6[_[_0x3afa('0x29')](this[_0x3afa('0xf')])+_0x3afa('0x2b')]=this[_0x3afa('0x16')]['id'];var _0x20102a=this['interaction'];if(rpc[this['channel']+'Message']){if(this[_0x3afa('0xf')]===_0x3afa('0x2c')){_0x3a9ee6[_0x3afa('0x2d')]=this['message'][_0x3afa('0x2e')];_0x3a9ee6['html']=''+_[_0x3afa('0x2f')](_0x3a9ee6[_0x3afa('0x10')],_0x3afa('0x30'),_0x3afa('0x31'))+_0x3afa('0x32');_0x3a9ee6[_0x3afa('0x33')]={'Auto-Submitted':_0x3afa('0x34'),'X-Auto-Response-Suppress':_0x3afa('0x35'),'Precedence':_0x3afa('0x36')};return mailRpc[_0x3afa('0x37')](this[_0x3afa('0x38')][_0x3afa('0x39')],_0x3a9ee6)[_0x3afa('0x3a')](function(_0x1a26e5){logger[_0x3afa('0x18')](_0x3afa('0x3b'),_0x5c6906);_0x3a9ee6['messageId']=_0x1a26e5['message']['messageId'];return rpc[_0x27b889+'Message'][_0x3afa('0x3c')](_0x3a9ee6);})[_0x3afa('0x3a')](function(_0x440cab){logger[_0x3afa('0x18')]('[%s][AUTOREPLY]\x20%s',_0x5c6906,JSON[_0x3afa('0x3d')](_0x440cab));})[_0x3afa('0x3e')](function(_0x221380){logger[_0x3afa('0x3f')](_0x3afa('0x40'),_0x5c6906,JSON[_0x3afa('0x3d')](_0x221380));})[_0x3afa('0x41')](function(){Promise[_0x3afa('0x42')]()['then'](function(){if(_0x283bc0[0x0]!=='2'||_0x20102a[_0x3afa('0x1a')])return;return rpc[_0x27b889+_0x3afa('0x43')][_0x3afa('0x44')](_0x20102a['id'],{'autoreplyExecuted':!![]})[_0x3afa('0x3a')](function(_0x570624){logger[_0x3afa('0x18')](_0x3afa('0x1b'),_0x5c6906,JSON['stringify'](_0x570624));})['catch'](function(_0x307ff7){logger[_0x3afa('0x3f')](_0x3afa('0x45'),_0x5c6906,JSON[_0x3afa('0x3d')](_0x307ff7));});})[_0x3afa('0x3a')](function(){_0x133751['next']();});});}else{return rpc[this['channel']+_0x3afa('0x46')][_0x3afa('0x3c')](_0x3a9ee6)[_0x3afa('0x3a')](function(){logger['info']('[%s][AUTOREPLY]\x20%s',_0x5c6906,_0x3a9ee6['body']);})[_0x3afa('0x3e')](function(_0x5e8e0c){logger[_0x3afa('0x3f')](_0x3afa('0x12'),_0x5c6906,JSON['stringify'](_0x5e8e0c));})[_0x3afa('0x41')](function(){Promise[_0x3afa('0x42')]()[_0x3afa('0x3a')](function(){if(_0x283bc0[0x0]!=='2'||_0x20102a['autoreplyExecuted'])return;return rpc[_0x27b889+_0x3afa('0x43')][_0x3afa('0x44')](_0x20102a['id'],{'autoreplyExecuted':!![]})[_0x3afa('0x3a')](function(_0x35666e){logger[_0x3afa('0x18')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5c6906,JSON[_0x3afa('0x3d')](_0x35666e));})['catch'](function(_0x2cb18f){logger[_0x3afa('0x3f')](_0x3afa('0x45'),_0x5c6906,JSON[_0x3afa('0x3d')](_0x2cb18f));});})[_0x3afa('0x3a')](function(){_0x133751[_0x3afa('0x14')]();});});}}}catch(_0x26432e){logger[_0x3afa('0x3f')](_0x3afa('0x12'),_0x5c6906,JSON[_0x3afa('0x3d')](_0x26432e));_0x133751['stop']();}};}; \ No newline at end of file +var _0x07ae=['inReplyTo','messageId','html','','replace','','headers','auto-replied','auto_reply','sendMailMessage','smtpOptions','then','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','Message','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','error','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','chat','account','upperFirst'];(function(_0x276243,_0x26d2c3){var _0x3fe830=function(_0x20f0dc){while(--_0x20f0dc){_0x276243['push'](_0x276243['shift']());}};_0x3fe830(++_0x26d2c3);}(_0x07ae,0x1b1));var _0xe07a=function(_0x19fee4,_0x5970da){_0x19fee4=_0x19fee4-0x0;var _0xfc0627=_0x07ae[_0x19fee4];return _0xfc0627;};'use strict';var _=require(_0xe07a('0x0'));var moment=require(_0xe07a('0x1'));var utils=require(_0xe07a('0x2'));var logger=require(_0xe07a('0x3'))(_0xe07a('0x4'));var rpc={'chatMessage':require(_0xe07a('0x5')),'openchannelMessage':require(_0xe07a('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xe07a('0x7')),'whatsappMessage':require(_0xe07a('0x8')),'chatInteraction':require(_0xe07a('0x9')),'openchannelInteraction':require(_0xe07a('0xa')),'mailInteraction':require(_0xe07a('0xb')),'smsInteraction':require(_0xe07a('0xc')),'faxInteraction':require(_0xe07a('0xd')),'whatsappInteraction':require(_0xe07a('0xe'))};var mailRpc=require(_0xe07a('0xf'));exports[_0xe07a('0x10')]=function(_0x2a80a7,_0xa7404e,_0x243eb6,_0x29bf42){return function(_0x1fc6be){try{var _0x3b6e99=this[_0xe07a('0x11')];if(_0x3b6e99===_0xe07a('0x12')&&_0x29bf42[_0xe07a('0x13')][_0xe07a('0x14')]){logger[_0xe07a('0x15')](_0xe07a('0x16'),_0x2a80a7,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x1fc6be[_0xe07a('0x17')]();}if(_0xa7404e[0x0]==='1'&&(_[_0xe07a('0x18')](this[_0xe07a('0x19')]['created'])||!this[_0xe07a('0x19')][_0xe07a('0x1a')])){logger[_0xe07a('0x15')](_0xe07a('0x16'),_0x2a80a7,'Autoreply\x20already\x20sent');return _0x1fc6be[_0xe07a('0x17')]();}if(_0xa7404e[0x0]==='2'&&this[_0xe07a('0x19')][_0xe07a('0x1b')]){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2a80a7,_0xe07a('0x1c'));return _0x1fc6be['next']();}var _0x4c8c84={'ContactId':this[_0xe07a('0x1d')]['id'],'sentAt':moment()['format'](_0xe07a('0x1e')),'direction':_0xe07a('0x1f')};if(this[_0xe07a('0x11')]===_0xe07a('0x12')){_0x4c8c84[_0xe07a('0x13')]=utils['getMustacheRender'](_0xa7404e[0x2],this);}else{_0x4c8c84[_0xe07a('0x13')]=utils[_0xe07a('0x20')](_0xa7404e[0x1],this);}if(this[_0xe07a('0x21')]){_0x4c8c84['to']=this['message'][_0xe07a('0x22')]||'';if(this[_0xe07a('0x11')]===_0xe07a('0x12')&&_0xa7404e[0x1]==='1'){_0x4c8c84['cc']=this[_0xe07a('0x21')]['cc']||'';}_0x4c8c84['from']=this[_0xe07a('0x21')]['to']||'';_0x4c8c84[_0xe07a('0x23')]=this[_0xe07a('0x21')][_0xe07a('0x23')]||'';_0x4c8c84[_0xe07a('0x24')]=!![];if(this[_0xe07a('0x21')][_0xe07a('0x25')]){_0x4c8c84[_0xe07a('0x25')]='';_0x4c8c84['subject']+=_['startsWith'](this[_0xe07a('0x21')][_0xe07a('0x25')],_0xe07a('0x26'))?'':_0xe07a('0x27');_0x4c8c84[_0xe07a('0x25')]+=this[_0xe07a('0x21')]['subject'];}}if(this[_0xe07a('0x11')]===_0xe07a('0x28')){_0x4c8c84['ChatWebsiteId']=this[_0xe07a('0x29')]['id'];}else{_0x4c8c84[_[_0xe07a('0x2a')](this['channel'])+'AccountId']=this['account']['id'];}_0x4c8c84[_[_0xe07a('0x2a')](this[_0xe07a('0x11')])+'InteractionId']=this[_0xe07a('0x19')]['id'];var _0x2f467d=this[_0xe07a('0x19')];if(rpc[this[_0xe07a('0x11')]+'Message']){if(this[_0xe07a('0x11')]===_0xe07a('0x12')){_0x4c8c84[_0xe07a('0x2b')]=this[_0xe07a('0x21')][_0xe07a('0x2c')];_0x4c8c84[_0xe07a('0x2d')]=_0xe07a('0x2e')+_[_0xe07a('0x2f')](_0x4c8c84['body'],_0xe07a('0x30'),']+(>|$)/g,''),'priorityTrue':_0x240714[0x1],'priorityFalse':_0x240714[0x2]};var _0x33e038=gotoif[_0x7a46('0x0')](_0x10435d,{'typecast':!![]});if(_0x33e038['length']){logger[_0x7a46('0xe')](_0x7a46('0xf'),_0x26946a,_[_0x7a46('0x10')](_0x33e038,_0x7a46('0x11'))[_0x7a46('0x12')](',\x20'));_0x2bf51f['stop']();}else{try{var _0x1032e2=eval('('+_0x10435d['condition']+')');var _0x183c6a=_0x1032e2?_0x10435d[_0x7a46('0x13')]:_0x10435d[_0x7a46('0x14')];logger['info'](_0x7a46('0x15'),_0x26946a,_0x10435d[_0x7a46('0x16')],_0x1032e2,_0x183c6a||_0x7a46('0x17'));if(_0x183c6a){var _0x2c6bec=_['findIndex'](_0x2bf51f['rules'](),{'p':_0x183c6a});if(_0x2c6bec>=0x0){logger['info'](_0x7a46('0x18'),_0x26946a,_0x183c6a||_0x7a46('0x17'),_0x2c6bec);_0x2bf51f[_0x7a46('0x17')](_0x2c6bec);}else{logger[_0x7a46('0x19')](_0x7a46('0x1a'),_0x26946a,_0x183c6a||_0x7a46('0x17'));_0x2bf51f[_0x7a46('0x1b')]();}}else{_0x2bf51f[_0x7a46('0x17')]();}}catch(_0x46ad15){logger[_0x7a46('0xe')](_0x7a46('0x1c'),_0x26946a,_0x46ad15['message']);_0x2bf51f['stop']();}}}catch(_0x2d15a5){logger[_0x7a46('0xe')]('[%s][GOTOIF]\x20%s',_0x26946a,JSON[_0x7a46('0x1d')](_0x2d15a5));_0x2bf51f[_0x7a46('0x1b')]();}};}; \ No newline at end of file +var _0x7db1=['consequence','fromString','getMustacheRender','replace','validate','length','error','[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','html-to-text','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number'];(function(_0x264240,_0x544f77){var _0x5a0c6b=function(_0x3c2cb7){while(--_0x3c2cb7){_0x264240['push'](_0x264240['shift']());}};_0x5a0c6b(++_0x544f77);}(_0x7db1,0x183));var _0x17db=function(_0x387022,_0x30888c){_0x387022=_0x387022-0x0;var _0x414c5c=_0x7db1[_0x387022];return _0x414c5c;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require(_0x17db('0x0'));var utils=require('./utils');var logger=require(_0x17db('0x1'))(_0x17db('0x2'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x17db('0x3')},'priorityTrue':{'type':'number','message':_0x17db('0x4')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x17db('0x5')]=function(_0x3700e0,_0x5df74e){return function(_0x510cd0){try{var _0x485b40={'condition':htmlToText[_0x17db('0x6')](utils[_0x17db('0x7')](_0x5df74e[0x0],this),{'wordwrap':![]})[_0x17db('0x8')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5df74e[0x1],'priorityFalse':_0x5df74e[0x2]};var _0x336a05=gotoif[_0x17db('0x9')](_0x485b40,{'typecast':!![]});if(_0x336a05[_0x17db('0xa')]){logger[_0x17db('0xb')](_0x17db('0xc'),_0x3700e0,_['map'](_0x336a05,_0x17db('0xd'))[_0x17db('0xe')](',\x20'));_0x510cd0[_0x17db('0xf')]();}else{try{var _0x4c03e0=eval('('+_0x485b40[_0x17db('0x10')]+')');var _0x323f55=_0x4c03e0?_0x485b40[_0x17db('0x11')]:_0x485b40[_0x17db('0x12')];logger[_0x17db('0x13')](_0x17db('0x14'),_0x3700e0,_0x485b40['condition'],_0x4c03e0,_0x323f55||'next');if(_0x323f55){var _0x563b50=_[_0x17db('0x15')](_0x510cd0[_0x17db('0x16')](),{'p':_0x323f55});if(_0x563b50>=0x0){logger[_0x17db('0x13')](_0x17db('0x17'),_0x3700e0,_0x323f55||_0x17db('0x18'),_0x563b50);_0x510cd0[_0x17db('0x18')](_0x563b50);}else{logger[_0x17db('0x13')](_0x17db('0x19'),_0x3700e0,_0x323f55||_0x17db('0x18'));_0x510cd0[_0x17db('0xf')]();}}else{_0x510cd0[_0x17db('0x18')]();}}catch(_0x5d7b31){logger[_0x17db('0xb')](_0x17db('0x1a'),_0x3700e0,_0x5d7b31[_0x17db('0xd')]);_0x510cd0[_0x17db('0xf')]();}}}catch(_0x4f4a4d){logger[_0x17db('0xb')](_0x17db('0xc'),_0x3700e0,JSON[_0x17db('0x1b')](_0x4f4a4d));_0x510cd0[_0x17db('0xf')]();}};}; \ 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 b304e85..751ac03 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 _0xb5c6=['join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','map','message'];(function(_0x2b4210,_0x521514){var _0x5b5b93=function(_0x2a3140){while(--_0x2a3140){_0x2b4210['push'](_0x2b4210['shift']());}};_0x5b5b93(++_0x521514);}(_0xb5c6,0x186));var _0x6b5c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb5c6[_0x5b644e];return _0x49c6bf;};'use strict';var schema=require(_0x6b5c('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')(_0x6b5c('0x1'));var gotop=schema({'priority':{'type':_0x6b5c('0x2'),'required':!![],'message':_0x6b5c('0x3')}});exports[_0x6b5c('0x4')]=function(_0xe9f6c0,_0x1cba5e){return function(_0x28dded){try{var _0x5ba9fe={'priority':_0x1cba5e[0x0]};var _0x2a70d8=gotop['validate'](_0x5ba9fe,{'typecast':!![]});if(_0x2a70d8[_0x6b5c('0x5')]){logger['error'](_0x6b5c('0x6'),_0xe9f6c0,_[_0x6b5c('0x7')](_0x2a70d8,_0x6b5c('0x8'))[_0x6b5c('0x9')](',\x20'));_0x28dded[_0x6b5c('0xa')]();}else{logger['info'](_0x6b5c('0xb'),_0xe9f6c0,_0x5ba9fe['priority']);if(_0x5ba9fe[_0x6b5c('0xc')]){var _0xaf821e=_[_0x6b5c('0xd')](_0x28dded[_0x6b5c('0xe')](),{'p':_0x5ba9fe[_0x6b5c('0xc')]});if(_0xaf821e>=0x0){logger[_0x6b5c('0xf')](_0x6b5c('0x10'),_0xe9f6c0,_0x5ba9fe[_0x6b5c('0xc')]||_0x6b5c('0x11'),_0xaf821e);_0x28dded[_0x6b5c('0x11')](_0xaf821e);}else{logger[_0x6b5c('0xf')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0xe9f6c0,_0x5ba9fe[_0x6b5c('0xc')]||'next');_0x28dded[_0x6b5c('0xa')]();}}else{_0x28dded['next']();}}}catch(_0x1f09b9){logger['error'](_0x6b5c('0x6'),_0xe9f6c0,JSON[_0x6b5c('0x12')](_0x1f09b9));_0x28dded[_0x6b5c('0xa')]();}};}; \ No newline at end of file +var _0x2f72=['lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify'];(function(_0x38a3d6,_0x52e305){var _0x3768d7=function(_0x1af8a9){while(--_0x1af8a9){_0x38a3d6['push'](_0x38a3d6['shift']());}};_0x3768d7(++_0x52e305);}(_0x2f72,0x11d));var _0x22f7=function(_0x30f044,_0x5283d7){_0x30f044=_0x30f044-0x0;var _0x5bc3df=_0x2f72[_0x30f044];return _0x5bc3df;};'use strict';var schema=require('validate');var _=require(_0x22f7('0x0'));var logger=require('../../../../config/logger')(_0x22f7('0x1'));var gotop=schema({'priority':{'type':_0x22f7('0x2'),'required':!![],'message':_0x22f7('0x3')}});exports[_0x22f7('0x4')]=function(_0xfebb0e,_0xc511e8){return function(_0x4eb317){try{var _0x3946e3={'priority':_0xc511e8[0x0]};var _0x49f0d1=gotop[_0x22f7('0x5')](_0x3946e3,{'typecast':!![]});if(_0x49f0d1[_0x22f7('0x6')]){logger[_0x22f7('0x7')](_0x22f7('0x8'),_0xfebb0e,_[_0x22f7('0x9')](_0x49f0d1,'message')[_0x22f7('0xa')](',\x20'));_0x4eb317[_0x22f7('0xb')]();}else{logger[_0x22f7('0xc')](_0x22f7('0xd'),_0xfebb0e,_0x3946e3[_0x22f7('0xe')]);if(_0x3946e3[_0x22f7('0xe')]){var _0x515af4=_[_0x22f7('0xf')](_0x4eb317['rules'](),{'p':_0x3946e3['priority']});if(_0x515af4>=0x0){logger[_0x22f7('0xc')](_0x22f7('0x10'),_0xfebb0e,_0x3946e3[_0x22f7('0xe')]||_0x22f7('0x11'),_0x515af4);_0x4eb317[_0x22f7('0x11')](_0x515af4);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0xfebb0e,_0x3946e3[_0x22f7('0xe')]||_0x22f7('0x11'));_0x4eb317['stop']();}}else{_0x4eb317[_0x22f7('0x11')]();}}}catch(_0x36ba11){logger['error']('[%s][GOTOP]\x20%s',_0xfebb0e,JSON[_0x22f7('0x12')](_0x36ba11));_0x4eb317[_0x22f7('0xb')]();}};}; \ 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 0160a88..f811536 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 _0x5e2c=['../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','catch','stringify','stop','error','lodash','./utils','../../rpc/chatMessage'];(function(_0x57b64a,_0x15ff01){var _0x4a74d0=function(_0x4ed5e3){while(--_0x4ed5e3){_0x57b64a['push'](_0x57b64a['shift']());}};_0x4a74d0(++_0x15ff01);}(_0x5e2c,0x18d));var _0xc5e2=function(_0x4382bc,_0x231a2d){_0x4382bc=_0x4382bc-0x0;var _0x13c82a=_0x5e2c[_0x4382bc];return _0x13c82a;};'use strict';var _=require(_0xc5e2('0x0'));var utils=require(_0xc5e2('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xc5e2('0x2')),'openchannelMessage':require(_0xc5e2('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc5e2('0x4')),'whatsappMessage':require(_0xc5e2('0x5'))};exports[_0xc5e2('0x6')]=function(_0x37c2d6,_0x4f80b9){return function(_0x5a9663){try{var _0x619443={'body':utils[_0xc5e2('0x7')](_0x4f80b9[0x0],this),'ContactId':this['contact']['id']};if(this[_0xc5e2('0x8')]===_0xc5e2('0x9')){_0x619443[_0xc5e2('0xa')]=this[_0xc5e2('0xb')]['id'];}else{_0x619443[_['upperFirst'](this['channel'])+_0xc5e2('0xc')]=this[_0xc5e2('0xb')]['id'];}_0x619443[_[_0xc5e2('0xd')](this[_0xc5e2('0x8')])+_0xc5e2('0xe')]=this[_0xc5e2('0xf')]['id'];if(rpc[this['channel']+_0xc5e2('0x10')]){return rpc[this[_0xc5e2('0x8')]+_0xc5e2('0x10')][_0xc5e2('0x11')](_0x619443)[_0xc5e2('0x12')](function(_0x4f86e6){logger[_0xc5e2('0x13')](_0xc5e2('0x14'),_0x37c2d6,_0x619443['body']);_0x5a9663['next']();})[_0xc5e2('0x15')](function(_0x23402){logger['error'](_0xc5e2('0x14'),_0x37c2d6,JSON[_0xc5e2('0x16')](_0x23402));_0x5a9663[_0xc5e2('0x17')]();});}}catch(_0x1df32d){logger[_0xc5e2('0x18')](_0xc5e2('0x14'),_0x37c2d6,JSON[_0xc5e2('0x16')](_0x1df32d));_0x5a9663[_0xc5e2('0x17')]();}};}; \ No newline at end of file +var _0xfc72=['../../rpc/whatsappMessage','consequence','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop','error','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage'];(function(_0x532d5a,_0x2d22f0){var _0x251ac1=function(_0x322ac2){while(--_0x322ac2){_0x532d5a['push'](_0x532d5a['shift']());}};_0x251ac1(++_0x2d22f0);}(_0xfc72,0xc4));var _0x2fc7=function(_0x13ac10,_0x46e79e){_0x13ac10=_0x13ac10-0x0;var _0x28eda2=_0xfc72[_0x13ac10];return _0x28eda2;};'use strict';var _=require(_0x2fc7('0x0'));var utils=require(_0x2fc7('0x1'));var logger=require(_0x2fc7('0x2'))(_0x2fc7('0x3'));var rpc={'chatMessage':require(_0x2fc7('0x4')),'openchannelMessage':require(_0x2fc7('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x2fc7('0x6')),'whatsappMessage':require(_0x2fc7('0x7'))};exports[_0x2fc7('0x8')]=function(_0x185435,_0x3b40f6){return function(_0x20a011){try{var _0x35d6b4={'body':utils['getMustacheRender'](_0x3b40f6[0x0],this),'ContactId':this[_0x2fc7('0x9')]['id']};if(this[_0x2fc7('0xa')]===_0x2fc7('0xb')){_0x35d6b4[_0x2fc7('0xc')]=this[_0x2fc7('0xd')]['id'];}else{_0x35d6b4[_[_0x2fc7('0xe')](this[_0x2fc7('0xa')])+_0x2fc7('0xf')]=this['account']['id'];}_0x35d6b4[_['upperFirst'](this[_0x2fc7('0xa')])+_0x2fc7('0x10')]=this[_0x2fc7('0x11')]['id'];if(rpc[this[_0x2fc7('0xa')]+_0x2fc7('0x12')]){return rpc[this[_0x2fc7('0xa')]+_0x2fc7('0x12')][_0x2fc7('0x13')](_0x35d6b4)[_0x2fc7('0x14')](function(_0x2afacc){logger[_0x2fc7('0x15')](_0x2fc7('0x16'),_0x185435,_0x35d6b4[_0x2fc7('0x17')]);_0x20a011[_0x2fc7('0x18')]();})[_0x2fc7('0x19')](function(_0x102a49){logger['error'](_0x2fc7('0x16'),_0x185435,JSON[_0x2fc7('0x1a')](_0x102a49));_0x20a011[_0x2fc7('0x1b')]();});}}catch(_0x2eeeb6){logger[_0x2fc7('0x1c')](_0x2fc7('0x16'),_0x185435,JSON[_0x2fc7('0x1a')](_0x2eeeb6));_0x20a011[_0x2fc7('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 431f795..4d08479 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 _0x9a39=['[%s][NOOP]\x20%s','getMustacheRender','next','error','stop','routing','consequence'];(function(_0x4acc43,_0x5125a0){var _0x12ba15=function(_0x39527f){while(--_0x39527f){_0x4acc43['push'](_0x4acc43['shift']());}};_0x12ba15(++_0x5125a0);}(_0x9a39,0x139));var _0x99a3=function(_0x56e790,_0x5bec09){_0x56e790=_0x56e790-0x0;var _0x4fa9fa=_0x9a39[_0x56e790];return _0x4fa9fa;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0x99a3('0x0'));exports[_0x99a3('0x1')]=function(_0x211d61,_0x4f25f0){return function(_0x3c0eac){try{logger['info'](_0x99a3('0x2'),_0x211d61,utils[_0x99a3('0x3')](_0x4f25f0[0x0],this));_0x3c0eac[_0x99a3('0x4')]();}catch(_0x128dae){logger[_0x99a3('0x5')]('[%s][NOOP]\x20%s',_0x211d61,JSON['stringify'](_0x128dae));_0x3c0eac[_0x99a3('0x6')]();}};}; \ No newline at end of file +var _0xf101=['stop','../../../../config/logger','consequence','info','getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify'];(function(_0x196f21,_0x53174f){var _0xe379fa=function(_0x3482c2){while(--_0x3482c2){_0x196f21['push'](_0x196f21['shift']());}};_0xe379fa(++_0x53174f);}(_0xf101,0x12a));var _0x1f10=function(_0x1c06f4,_0x2feba6){_0x1c06f4=_0x1c06f4-0x0;var _0x1a727e=_0xf101[_0x1c06f4];return _0x1a727e;};'use strict';var utils=require('./utils');var logger=require(_0x1f10('0x0'))('routing');exports[_0x1f10('0x1')]=function(_0x50e77a,_0x1e29ce){return function(_0x50fd7a){try{logger[_0x1f10('0x2')]('[%s][NOOP]\x20%s',_0x50e77a,utils[_0x1f10('0x3')](_0x1e29ce[0x0],this));_0x50fd7a[_0x1f10('0x4')]();}catch(_0x10d6b2){logger[_0x1f10('0x5')](_0x1f10('0x6'),_0x50e77a,JSON[_0x1f10('0x7')](_0x10d6b2));_0x50fd7a[_0x1f10('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 e93c6ac..38e53f5 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 _0xe206=['push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','list','upperFirst','channel','QueueId','interaction','MessageId','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','create\x20queue\x20report','accepted','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','consequence','validate','length','[%s][QUEUE]\x20%s','map','stop','find','Queues','createQueue','qtimeout','rules','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','lodash','util','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','defaults','socket.io-emitter','queue_id','joinAt','emit','queue','account'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe206,0x1e4));var _0x6e20=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xe206[_0x525c7b];return _0x27b33e;};'use strict';var schema=require('validate');var _=require(_0x6e20('0x0'));var util=require(_0x6e20('0x1'));var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0x6e20('0x2'));var config=require(_0x6e20('0x3'));var logger=require(_0x6e20('0x4'))('routing');var strategy=require(_0x6e20('0x5'));config[_0x6e20('0x6')]=_[_0x6e20('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x6e20('0x8'))(new Redis(config[_0x6e20('0x6')]));var attributes=['id',_0x6e20('0x9'),'account','queue','from',_0x6e20('0xa')];function emit(_0x1a36a4,_0x1e2d6e,_0x1b9f25){io['to'](_0x1a36a4)[_0x6e20('0xb')](_0x1e2d6e,_0x1b9f25);}function emitChannelQueueInteraction(_0x2b13bd,_0x15eb1d,_0x6ddbb7,_0x15383d,_0x3ffcfd,_0x3432fe,_0xa4b354,_0x85c491){var _0x2ac21c=_['clone'](_0x6ddbb7);_0x2ac21c['queue_id']=_0x85c491;_0x2ac21c[_0x6e20('0xc')]=_0x15eb1d;_0x2ac21c[_0x6e20('0xd')]=_0x15383d;_0x2ac21c['id']=_0x3ffcfd;if(_0x3432fe){attributes[_0x6e20('0xe')](_[_0x6e20('0xf')](_0x2b13bd)+_0x6e20('0x10'));_0xa4b354[util[_0x6e20('0x11')](_0x6e20('0x12'),_0x2b13bd)][_0x3ffcfd]=_[_0x6e20('0x13')](_0x2ac21c,attributes);}else{delete _0xa4b354[util[_0x6e20('0x11')]('%sQueuesWaitingInteractions',_0x2b13bd)][_0x3ffcfd];}emit(util[_0x6e20('0x11')]('%s:queue:%s',_0x2b13bd,_0x15eb1d),util[_0x6e20('0x11')](_0x6e20('0x14'),_0x2b13bd,_0x3432fe?'save':_0x6e20('0x15')),_['pick'](_0x2ac21c,attributes));}var rpc={'openchannelQueueReport':require(_0x6e20('0x16')),'mailQueueReport':require(_0x6e20('0x17')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x6e20('0x18')),'faxQueueReport':require(_0x6e20('0x19')),'whatsappQueueReport':require(_0x6e20('0x1a')),'chatInteraction':require(_0x6e20('0x1b')),'faxInteraction':require(_0x6e20('0x1c')),'mailInteraction':require(_0x6e20('0x1d')),'openchannelInteraction':require(_0x6e20('0x1e')),'smsInteraction':require(_0x6e20('0x1f')),'whatsappInteraction':require(_0x6e20('0x20'))};var queue=schema({'name':{'type':_0x6e20('0x21'),'required':!![],'message':_0x6e20('0x22')},'timeout':{'type':'number','message':_0x6e20('0x23')}});function startRouting(_0x5ecdb3,_0x1ee94c,_0x402b5e,_0x3d1242){if(_0x5ecdb3&&_0x1ee94c&&_0x402b5e){_0x1ee94c[_0x6e20('0x24')]+=0x1;var _0x1c7fc0={'uniqueid':_0x5ecdb3,'from':_0x402b5e[_0x6e20('0x25')]?_0x402b5e[_0x6e20('0x25')][_0x6e20('0x26')]:'','joinAt':moment()[_0x6e20('0x11')](_0x6e20('0x27')),'ContactId':_0x402b5e['contact']?_0x402b5e['contact']['id']:null,'ListId':_0x402b5e['list']?_0x402b5e[_0x6e20('0x28')]['id']:null};_0x1c7fc0[_[_0x6e20('0x29')](_0x402b5e[_0x6e20('0x2a')])+_0x6e20('0x2b')]=_0x1ee94c['id']||null;_0x1c7fc0[_[_0x6e20('0x29')](_0x402b5e['channel'])+_0x6e20('0x10')]=_0x402b5e[_0x6e20('0x2c')]?_0x402b5e[_0x6e20('0x2c')]['id']:null;_0x1c7fc0[_[_0x6e20('0x29')](_0x402b5e['channel'])+_0x6e20('0x2d')]=_0x402b5e[_0x6e20('0x2e')]?_0x402b5e[_0x6e20('0x2e')]['id']:null;_0x1c7fc0[_[_0x6e20('0x29')](_0x402b5e[_0x6e20('0x2a')])+(_0x402b5e[_0x6e20('0x2a')]!=='chat'?_0x6e20('0x2f'):_0x6e20('0x30'))]=_0x402b5e[_0x6e20('0xd')]?_0x402b5e[_0x6e20('0xd')]['id']:null;logger[_0x6e20('0x31')](util[_0x6e20('0x11')](_0x6e20('0x32'),_0x5ecdb3,_0x1ee94c['name']));emitChannelQueueInteraction(_0x402b5e[_0x6e20('0x2a')],_0x1ee94c[_0x6e20('0x33')],_0x1c7fc0,_0x402b5e[_0x6e20('0xd')]['name'],_0x402b5e[_0x6e20('0x2e')]['id'],!![],_0x3d1242,_0x1ee94c['id']);if(rpc[_0x402b5e[_0x6e20('0x2a')]+'QueueReport']){return rpc[_0x402b5e[_0x6e20('0x2a')]+_0x6e20('0x34')]['create'](_0x1c7fc0)[_0x6e20('0x35')](function(_0x27797a){logger[_0x6e20('0x36')](_0x6e20('0x37'),_0x27797a);});}}}function stopRouting(_0xa5fc65,_0x3ed385,_0x36cc43,_0x2af17c){if(_0xa5fc65&&_0x3ed385){_0x3ed385['waiting']-=0x1;var _0x21950c={'leaveAt':moment()[_0x6e20('0x11')](_0x6e20('0x27')),'acceptAt':moment()[_0x6e20('0x11')](_0x6e20('0x27')),'reason':_0x6e20('0x38')};logger[_0x6e20('0x31')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0xa5fc65,_0x3ed385[_0x6e20('0x33')]));emitChannelQueueInteraction(_0x36cc43[_0x6e20('0x2a')],_0x3ed385[_0x6e20('0x33')],_0x36cc43[_0x6e20('0x25')],_0x36cc43['account'][_0x6e20('0x33')],_0x36cc43[_0x6e20('0x2e')]['id'],![],_0x2af17c,_0x3ed385['id']);return rpc[_0x36cc43[_0x6e20('0x2a')]+_0x6e20('0x39')][_0x6e20('0x3a')](_0x36cc43['interaction']['id'],{'queueId':_0x3ed385['id']})[_0x6e20('0x3b')](function(){if(rpc[_0x36cc43[_0x6e20('0x2a')]+_0x6e20('0x34')]){return rpc[_0x36cc43['channel']+'QueueReport'][_0x6e20('0x3a')](_0xa5fc65,_0x21950c)[_0x6e20('0x35')](function(_0x24a624){logger[_0x6e20('0x36')](_0x6e20('0x3c'),_0x24a624);});}});}}function endRouting(_0x2ef130,_0x1452b3,_0x2b85b8,_0x38df1f){if(_0x2ef130&&_0x1452b3){_0x1452b3[_0x6e20('0x24')]-=0x1;var _0xc93f55={'leaveAt':moment()[_0x6e20('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x6e20('0x27')),'reason':_0x6e20('0x3d')};logger[_0x6e20('0x31')](util[_0x6e20('0x11')](_0x6e20('0x3e'),_0x2ef130,_0x1452b3[_0x6e20('0x33')]));emitChannelQueueInteraction(_0x2b85b8['channel'],_0x1452b3[_0x6e20('0x33')],_0x2b85b8['body'],_0x2b85b8['account'][_0x6e20('0x33')],_0x2b85b8[_0x6e20('0x2e')]['id'],![],_0x38df1f);if(rpc[_0x2b85b8['channel']+_0x6e20('0x34')]){return rpc[_0x2b85b8[_0x6e20('0x2a')]+_0x6e20('0x34')]['update'](_0x2ef130,_0xc93f55)['catch'](function(_0x8a21b5){logger[_0x6e20('0x36')](_0x6e20('0x3c'),_0x8a21b5);});}}}function handleFindQueue(_0x5bec55){return function(_0x127e07){return _0x127e07[_0x6e20('0x33')]['toLowerCase']()===_0x5bec55['toLowerCase']();};}exports[_0x6e20('0x3f')]=function(_0x40cce3,_0x5e954a,_0x51af35,_0x4667fe){return function(_0x1b02fb){try{var _0x3a65c8={'name':_0x5e954a[0x0],'timeout':_0x5e954a[0x1]};var _0xf5c914=queue[_0x6e20('0x40')](_0x3a65c8,{'typecast':!![]});if(_0xf5c914[_0x6e20('0x41')]){logger[_0x6e20('0x36')](_0x6e20('0x42'),_0x40cce3,_[_0x6e20('0x43')](_0xf5c914,_0x6e20('0x2e'))['join'](',\x20'));_0x1b02fb[_0x6e20('0x44')]();}else{var _0x4388f8=_[_0x6e20('0x45')](_0x51af35[_0x4667fe[_0x6e20('0x2a')]+_0x6e20('0x46')],handleFindQueue(_0x3a65c8[_0x6e20('0x33')]));if(_0x4388f8){startRouting(_0x40cce3,_0x4388f8,_0x4667fe,_0x51af35);var _0x2ccbf1=(_0x4388f8['timeout']||0xa)*0x3e8;var _0x57c1e6=(_0x3a65c8['timeout']||0x14)*0x3e8;var _0x262bfd;if(_0x2ccbf1>_0x57c1e6){_0x57c1e6=_0x2ccbf1;}var _0x575f0a=seqqueue[_0x6e20('0x47')](_0x2ccbf1);_0x575f0a['id']=_0x40cce3;_0x575f0a['atimeout']=_0x2ccbf1;_0x575f0a[_0x6e20('0x48')]=_0x57c1e6;_0x575f0a[_0x6e20('0x2a')]=_0x4667fe[_0x6e20('0x2a')];_0x51af35[_0x6e20('0x49')][_0x40cce3]['on']('end',function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x40cce3);stopRouting(_0x40cce3,_0x4388f8,_0x4667fe,_0x51af35);clearTimeout(_0x262bfd);_0x262bfd=undefined;_0x575f0a[_0x6e20('0x4a')](!![]);if(_0x51af35[_0x6e20('0x49')][_0x40cce3]){delete _0x51af35[_0x6e20('0x49')][_0x40cce3];}_0x1b02fb['stop']();});_0x51af35[_0x6e20('0x49')][_0x40cce3]['on'](_0x6e20('0x4b'),function(){if(_0x51af35[_0x6e20('0x49')][_0x40cce3]){delete _0x51af35[_0x6e20('0x49')][_0x40cce3];}});_0x262bfd=setTimeout(function(){logger['info'](_0x6e20('0x4c'),_0x40cce3);endRouting(_0x40cce3,_0x4388f8,_0x4667fe,_0x51af35);clearTimeout(_0x262bfd);_0x575f0a['close'](!![]);_0x1b02fb[_0x6e20('0x4d')]();},_0x57c1e6);switch(_0x4388f8[_0x6e20('0x4e')]){case _0x6e20('0x4f'):strategy[_0x6e20('0x4f')](_0x575f0a,_0x4388f8,_0x51af35,_0x4667fe);break;default:strategy[_0x6e20('0x50')](_0x575f0a,_0x4388f8,_0x51af35,_0x4667fe);}}else{logger[_0x6e20('0x36')](_0x6e20('0x51'),_0x40cce3,_0x3a65c8[_0x6e20('0x33')]);_0x1b02fb[_0x6e20('0x44')]();}}}catch(_0x42bd85){logger[_0x6e20('0x36')](_0x6e20('0x42'),_0x40cce3,_0x42bd85[_0x6e20('0x52')]);_0x1b02fb[_0x6e20('0x44')]();}};}; \ No newline at end of file +var _0x3636=['from','joinAt','emit','clone','push','capitalize','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','InteractionId','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','error','consequence','[%s][QUEUE]\x20%s','map','join','find','Queues','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','stop','validate','util','seq-queue','moment','../../../../config/environment','./strategy','redis','defaults','socket.io-emitter','queue_id','account','queue'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x3636,0x9e));var _0x6363=function(_0x6f6d62,_0x13996b){_0x6f6d62=_0x6f6d62-0x0;var _0x12010b=_0x3636[_0x6f6d62];return _0x12010b;};'use strict';var schema=require(_0x6363('0x0'));var _=require('lodash');var util=require(_0x6363('0x1'));var seqqueue=require(_0x6363('0x2'));var moment=require(_0x6363('0x3'));var Redis=require('ioredis');var config=require(_0x6363('0x4'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x6363('0x5'));config[_0x6363('0x6')]=_[_0x6363('0x7')](config[_0x6363('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x6363('0x8'))(new Redis(config['redis']));var attributes=['id',_0x6363('0x9'),_0x6363('0xa'),_0x6363('0xb'),_0x6363('0xc'),_0x6363('0xd')];function emit(_0xda8aea,_0x2f4539,_0x1ef25a){io['to'](_0xda8aea)[_0x6363('0xe')](_0x2f4539,_0x1ef25a);}function emitChannelQueueInteraction(_0x2011bd,_0x2d4f31,_0x5b5cfc,_0x374aa6,_0x4e1d82,_0x5b9297,_0xa1d381,_0x4f6c40){var _0x26baea=_[_0x6363('0xf')](_0x5b5cfc);_0x26baea[_0x6363('0x9')]=_0x4f6c40;_0x26baea['queue']=_0x2d4f31;_0x26baea[_0x6363('0xa')]=_0x374aa6;_0x26baea['id']=_0x4e1d82;if(_0x5b9297){attributes[_0x6363('0x10')](_[_0x6363('0x11')](_0x2011bd)+'InteractionId');_0xa1d381[util['format'](_0x6363('0x12'),_0x2011bd)][_0x4e1d82]=_[_0x6363('0x13')](_0x26baea,attributes);}else{delete _0xa1d381[util['format'](_0x6363('0x12'),_0x2011bd)][_0x4e1d82];}emit(util[_0x6363('0x14')](_0x6363('0x15'),_0x2011bd,_0x2d4f31),util[_0x6363('0x14')](_0x6363('0x16'),_0x2011bd,_0x5b9297?_0x6363('0x17'):_0x6363('0x18')),_[_0x6363('0x13')](_0x26baea,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x6363('0x19')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x6363('0x1a')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x6363('0x1b')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x6363('0x1c')),'mailInteraction':require(_0x6363('0x1d')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0x6363('0x1e'))};var queue=schema({'name':{'type':_0x6363('0x1f'),'required':!![],'message':_0x6363('0x20')},'timeout':{'type':_0x6363('0x21'),'message':_0x6363('0x22')}});function startRouting(_0x405bd7,_0x449064,_0x69b650,_0x14ac7c){if(_0x405bd7&&_0x449064&&_0x69b650){_0x449064['waiting']+=0x1;var _0x2e8db9={'uniqueid':_0x405bd7,'from':_0x69b650[_0x6363('0x23')]?_0x69b650[_0x6363('0x23')][_0x6363('0xc')]:'','joinAt':moment()[_0x6363('0x14')](_0x6363('0x24')),'ContactId':_0x69b650['contact']?_0x69b650[_0x6363('0x25')]['id']:null,'ListId':_0x69b650[_0x6363('0x26')]?_0x69b650['list']['id']:null};_0x2e8db9[_[_0x6363('0x27')](_0x69b650['channel'])+_0x6363('0x28')]=_0x449064['id']||null;_0x2e8db9[_[_0x6363('0x27')](_0x69b650[_0x6363('0x29')])+_0x6363('0x2a')]=_0x69b650['interaction']?_0x69b650[_0x6363('0x2b')]['id']:null;_0x2e8db9[_[_0x6363('0x27')](_0x69b650[_0x6363('0x29')])+_0x6363('0x2c')]=_0x69b650[_0x6363('0x2d')]?_0x69b650[_0x6363('0x2d')]['id']:null;_0x2e8db9[_['upperFirst'](_0x69b650[_0x6363('0x29')])+(_0x69b650[_0x6363('0x29')]!==_0x6363('0x2e')?_0x6363('0x2f'):'WebsiteId')]=_0x69b650[_0x6363('0xa')]?_0x69b650[_0x6363('0xa')]['id']:null;logger[_0x6363('0x30')](util[_0x6363('0x14')](_0x6363('0x31'),_0x405bd7,_0x449064[_0x6363('0x32')]));emitChannelQueueInteraction(_0x69b650[_0x6363('0x29')],_0x449064[_0x6363('0x32')],_0x2e8db9,_0x69b650['account'][_0x6363('0x32')],_0x69b650['message']['id'],!![],_0x14ac7c,_0x449064['id']);if(rpc[_0x69b650[_0x6363('0x29')]+_0x6363('0x33')]){return rpc[_0x69b650[_0x6363('0x29')]+_0x6363('0x33')][_0x6363('0x34')](_0x2e8db9)[_0x6363('0x35')](function(_0x3ba1f8){logger['error'](_0x6363('0x36'),_0x3ba1f8);});}}}function stopRouting(_0x1fc7fa,_0x2b3d56,_0x43f0c4,_0x26bf0a){if(_0x1fc7fa&&_0x2b3d56){_0x2b3d56[_0x6363('0x37')]-=0x1;var _0x2aff68={'leaveAt':moment()[_0x6363('0x14')](_0x6363('0x24')),'acceptAt':moment()['format'](_0x6363('0x24')),'reason':_0x6363('0x38')};logger[_0x6363('0x30')](util[_0x6363('0x14')](_0x6363('0x39'),_0x1fc7fa,_0x2b3d56[_0x6363('0x32')]));emitChannelQueueInteraction(_0x43f0c4[_0x6363('0x29')],_0x2b3d56[_0x6363('0x32')],_0x43f0c4['body'],_0x43f0c4[_0x6363('0xa')]['name'],_0x43f0c4[_0x6363('0x2d')]['id'],![],_0x26bf0a,_0x2b3d56['id']);return rpc[_0x43f0c4[_0x6363('0x29')]+_0x6363('0x3a')][_0x6363('0x3b')](_0x43f0c4[_0x6363('0x2b')]['id'],{'queueId':_0x2b3d56['id']})[_0x6363('0x3c')](function(){if(rpc[_0x43f0c4[_0x6363('0x29')]+'QueueReport']){return rpc[_0x43f0c4[_0x6363('0x29')]+_0x6363('0x33')][_0x6363('0x3b')](_0x1fc7fa,_0x2aff68)[_0x6363('0x35')](function(_0x5bc1fc){logger['error'](_0x6363('0x3d'),_0x5bc1fc);});}});}}function endRouting(_0x4a1e3b,_0xd538e,_0x26b9a4,_0x2c1401){if(_0x4a1e3b&&_0xd538e){_0xd538e['waiting']-=0x1;var _0x506c60={'leaveAt':moment()['format'](_0x6363('0x24')),'exitAt':moment()['format'](_0x6363('0x24')),'reason':_0x6363('0x3e')};logger[_0x6363('0x30')](util['format'](_0x6363('0x3f'),_0x4a1e3b,_0xd538e[_0x6363('0x32')]));emitChannelQueueInteraction(_0x26b9a4[_0x6363('0x29')],_0xd538e[_0x6363('0x32')],_0x26b9a4[_0x6363('0x23')],_0x26b9a4[_0x6363('0xa')][_0x6363('0x32')],_0x26b9a4[_0x6363('0x2d')]['id'],![],_0x2c1401);if(rpc[_0x26b9a4['channel']+'QueueReport']){return rpc[_0x26b9a4[_0x6363('0x29')]+_0x6363('0x33')][_0x6363('0x3b')](_0x4a1e3b,_0x506c60)[_0x6363('0x35')](function(_0x5de884){logger[_0x6363('0x40')]('update\x20queue\x20report',_0x5de884);});}}}function handleFindQueue(_0x24ef63){return function(_0x6bf9d7){return _0x6bf9d7[_0x6363('0x32')]['toLowerCase']()===_0x24ef63['toLowerCase']();};}exports[_0x6363('0x41')]=function(_0x109615,_0x548f40,_0x23ec2a,_0x15fccf){return function(_0x4bdf74){try{var _0x4e8361={'name':_0x548f40[0x0],'timeout':_0x548f40[0x1]};var _0x1eeaec=queue[_0x6363('0x0')](_0x4e8361,{'typecast':!![]});if(_0x1eeaec['length']){logger[_0x6363('0x40')](_0x6363('0x42'),_0x109615,_[_0x6363('0x43')](_0x1eeaec,_0x6363('0x2d'))[_0x6363('0x44')](',\x20'));_0x4bdf74['stop']();}else{var _0x351072=_[_0x6363('0x45')](_0x23ec2a[_0x15fccf[_0x6363('0x29')]+_0x6363('0x46')],handleFindQueue(_0x4e8361[_0x6363('0x32')]));if(_0x351072){startRouting(_0x109615,_0x351072,_0x15fccf,_0x23ec2a);var _0x2eeef7=(_0x351072[_0x6363('0x3e')]||0xa)*0x3e8;var _0x29b1b9=(_0x4e8361[_0x6363('0x3e')]||0x14)*0x3e8;var _0x22e36d;if(_0x2eeef7>_0x29b1b9){_0x29b1b9=_0x2eeef7;}var _0x277ca7=seqqueue[_0x6363('0x47')](_0x2eeef7);_0x277ca7['id']=_0x109615;_0x277ca7[_0x6363('0x48')]=_0x2eeef7;_0x277ca7['qtimeout']=_0x29b1b9;_0x277ca7[_0x6363('0x29')]=_0x15fccf['channel'];_0x23ec2a[_0x6363('0x49')][_0x109615]['on'](_0x6363('0x4a'),function(){logger['info'](_0x6363('0x4b'),_0x109615);stopRouting(_0x109615,_0x351072,_0x15fccf,_0x23ec2a);clearTimeout(_0x22e36d);_0x22e36d=undefined;_0x277ca7[_0x6363('0x4c')](!![]);if(_0x23ec2a['rules'][_0x109615]){delete _0x23ec2a[_0x6363('0x49')][_0x109615];}_0x4bdf74['stop']();});_0x23ec2a[_0x6363('0x49')][_0x109615]['on']('complete',function(){if(_0x23ec2a[_0x6363('0x49')][_0x109615]){delete _0x23ec2a[_0x6363('0x49')][_0x109615];}});_0x22e36d=setTimeout(function(){logger[_0x6363('0x30')](_0x6363('0x4d'),_0x109615);endRouting(_0x109615,_0x351072,_0x15fccf,_0x23ec2a);clearTimeout(_0x22e36d);_0x277ca7[_0x6363('0x4c')](!![]);_0x4bdf74[_0x6363('0x4e')]();},_0x29b1b9);switch(_0x351072[_0x6363('0x4f')]){case _0x6363('0x50'):strategy['rrmemory'](_0x277ca7,_0x351072,_0x23ec2a,_0x15fccf);break;default:strategy[_0x6363('0x51')](_0x277ca7,_0x351072,_0x23ec2a,_0x15fccf);}}else{logger[_0x6363('0x40')](_0x6363('0x52'),_0x109615,_0x4e8361[_0x6363('0x32')]);_0x4bdf74['stop']();}}}catch(_0x40b563){logger[_0x6363('0x40')](_0x6363('0x42'),_0x109615,_0x40b563[_0x6363('0x53')]);_0x4bdf74[_0x6363('0x54')]();}};}; \ 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 f4aed04..be55a08 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 _0x9b67=['drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','busy','busyQueue','channel','showNotification',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','notificationId','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','squeue','agent','realtime','push','handleRun','handleTimeout','bind','timeout'];(function(_0xe5b8ad,_0x4eb804){var _0x4c9ee4=function(_0x2ff588){while(--_0x2ff588){_0xe5b8ad['push'](_0xe5b8ad['shift']());}};_0x4c9ee4(++_0x4eb804);}(_0x9b67,0xf6));var _0x79b6=function(_0x206423,_0x5396e2){_0x206423=_0x206423-0x0;var _0x2188a5=_0x9b67[_0x206423];return _0x2188a5;};'use strict';var _=require(_0x79b6('0x0'));var uuid=require(_0x79b6('0x1'));var util=require(_0x79b6('0x2'));var logger=require(_0x79b6('0x3'))(_0x79b6('0x4'));var Agent=function(_0x5523a1,_0x3ba25a,_0x1aeb24,_0x5297d0){this['notificationId']=uuid['v4']();this[_0x79b6('0x5')]=_0x5523a1;this[_0x79b6('0x6')]=_0x3ba25a;this[_0x79b6('0x7')]=_0x1aeb24;this[_0x79b6('0x4')]=_0x5297d0;this[_0x79b6('0x5')][_0x79b6('0x8')](this[_0x79b6('0x9')]['bind'](this),this[_0x79b6('0xa')][_0x79b6('0xb')](this));this[_0x79b6('0x5')]['on'](_0x79b6('0xc'),this[_0x79b6('0xa')]['bind'](this));this[_0x79b6('0x5')]['on'](_0x79b6('0xd'),this[_0x79b6('0xe')][_0x79b6('0xb')](this));};Agent['prototype']['push']=function(){this[_0x79b6('0x5')][_0x79b6('0x8')](this[_0x79b6('0x9')]['bind'](this),this[_0x79b6('0xa')][_0x79b6('0xb')](this));};Agent[_0x79b6('0xf')][_0x79b6('0xe')]=function(){this[_0x79b6('0xa')](!![]);};Agent[_0x79b6('0xf')][_0x79b6('0x9')]=function(){logger[_0x79b6('0x10')](_0x79b6('0x11'),this[_0x79b6('0x5')]['id'],this[_0x79b6('0x6')]['id']);if(_[_0x79b6('0x12')](this[_0x79b6('0x7')]['agents'][this[_0x79b6('0x6')]['id']])){logger[_0x79b6('0x10')](_0x79b6('0x13'),this[_0x79b6('0x5')]['id'],this[_0x79b6('0x6')]['id']);setTimeout(this[_0x79b6('0x8')][_0x79b6('0xb')](this),0x3e8);}else{if(this[_0x79b6('0x4')][_0x79b6('0x14')]||util[_0x79b6('0x15')](this[_0x79b6('0x5')]['id'],this[_0x79b6('0x7')][_0x79b6('0x16')][this['agent']['id']],this[_0x79b6('0x5')]['channel'],![])){this[_0x79b6('0x7')]['agents'][this[_0x79b6('0x6')]['id']][_0x79b6('0x17')]=!![];this[_0x79b6('0x7')]['agents'][this[_0x79b6('0x6')]['id']][_0x79b6('0x18')]=undefined;util['saveWaitingNotification'](this['realtime'],this[_0x79b6('0x4')],this[_0x79b6('0x6')],this[_0x79b6('0x5')][_0x79b6('0x19')]);util[_0x79b6('0x1a')](this['notificationId'],this[_0x79b6('0x5')]['id'],this[_0x79b6('0x7')][_0x79b6('0x16')][this[_0x79b6('0x6')]['id']],null,this['routing']);util['writeLog'](this[_0x79b6('0x5')]['id'],this[_0x79b6('0x7')][_0x79b6('0x16')][this[_0x79b6('0x6')]['id']],'RINGING'+(this[_0x79b6('0x4')]['forcedOwnership']?_0x79b6('0x1b'):''));}else{logger[_0x79b6('0x10')](_0x79b6('0x1c'),this[_0x79b6('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x79b6('0x8')][_0x79b6('0xb')](this),0x3e8);}}};Agent['prototype'][_0x79b6('0xa')]=function(_0x2d219c){if(_[_0x79b6('0x12')](this[_0x79b6('0x7')][_0x79b6('0x16')][this[_0x79b6('0x6')]['id']])){return logger['debug'](_0x79b6('0x13'),this[_0x79b6('0x5')]['id'],this[_0x79b6('0x6')]['id']);}else{logger[_0x79b6('0x10')](_0x79b6('0x1d'),this[_0x79b6('0x5')]['id'],this['agent']['id']);util[_0x79b6('0x1e')](this[_0x79b6('0x1f')],this[_0x79b6('0x5')]['id'],this['realtime']['agents'][this[_0x79b6('0x6')]['id']],null,this[_0x79b6('0x4')]);this[_0x79b6('0x7')][_0x79b6('0x16')][this[_0x79b6('0x6')]['id']][_0x79b6('0x17')]=![];this['realtime']['agents'][this[_0x79b6('0x6')]['id']]['busyQueue']=undefined;util[_0x79b6('0x20')](this['realtime'],this[_0x79b6('0x4')],this[_0x79b6('0x6')],this['squeue'][_0x79b6('0x19')]);util[_0x79b6('0x21')](this['squeue']['id'],this[_0x79b6('0x7')]['agents'][this[_0x79b6('0x6')]['id']],_0x2d219c?_0x79b6('0x22'):_0x79b6('0x23'));}if(!_0x2d219c){setTimeout(this[_0x79b6('0x8')][_0x79b6('0xb')](this),0x3e8);}};function agent(_0x732849,_0x4189f2,_0x276eb5,_0x1ba43c){return new Agent(_0x732849,_0x4189f2,_0x276eb5,_0x1ba43c);}module[_0x79b6('0x24')]=agent; \ No newline at end of file +var _0xfd28=['routing','squeue','agent','realtime','bind','handleTimeout','timeout','drained','push','handleRun','prototype','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','notificationId','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','STOP','TIMEOUT','exports','uuid','./util'];(function(_0x1f1511,_0x4ea911){var _0x1d9ab8=function(_0x53276a){while(--_0x53276a){_0x1f1511['push'](_0x1f1511['shift']());}};_0x1d9ab8(++_0x4ea911);}(_0xfd28,0x148));var _0x8fd2=function(_0x576d8a,_0x2d7bde){_0x576d8a=_0x576d8a-0x0;var _0x3dc3ef=_0xfd28[_0x576d8a];return _0x3dc3ef;};'use strict';var _=require('lodash');var uuid=require(_0x8fd2('0x0'));var util=require(_0x8fd2('0x1'));var logger=require('../../../../../config/logger')(_0x8fd2('0x2'));var Agent=function(_0x4e5c5e,_0x37baf5,_0xf7417d,_0x4e2108){this['notificationId']=uuid['v4']();this[_0x8fd2('0x3')]=_0x4e5c5e;this[_0x8fd2('0x4')]=_0x37baf5;this[_0x8fd2('0x5')]=_0xf7417d;this[_0x8fd2('0x2')]=_0x4e2108;this[_0x8fd2('0x3')]['push'](this['handleRun'][_0x8fd2('0x6')](this),this[_0x8fd2('0x7')][_0x8fd2('0x6')](this));this['squeue']['on'](_0x8fd2('0x8'),this['handleTimeout'][_0x8fd2('0x6')](this));this['squeue']['on'](_0x8fd2('0x9'),this['handleDrained'][_0x8fd2('0x6')](this));};Agent['prototype'][_0x8fd2('0xa')]=function(){this['squeue'][_0x8fd2('0xa')](this[_0x8fd2('0xb')][_0x8fd2('0x6')](this),this[_0x8fd2('0x7')][_0x8fd2('0x6')](this));};Agent[_0x8fd2('0xc')][_0x8fd2('0xd')]=function(){this[_0x8fd2('0x7')](!![]);};Agent[_0x8fd2('0xc')][_0x8fd2('0xb')]=function(){logger[_0x8fd2('0xe')](_0x8fd2('0xf'),this[_0x8fd2('0x3')]['id'],this[_0x8fd2('0x4')]['id']);if(_[_0x8fd2('0x10')](this['realtime'][_0x8fd2('0x11')][this['agent']['id']])){logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x8fd2('0x3')]['id'],this[_0x8fd2('0x4')]['id']);setTimeout(this[_0x8fd2('0xa')][_0x8fd2('0x6')](this),0x3e8);}else{if(this['routing'][_0x8fd2('0x12')]||util[_0x8fd2('0x13')](this[_0x8fd2('0x3')]['id'],this[_0x8fd2('0x5')][_0x8fd2('0x11')][this['agent']['id']],this['squeue'][_0x8fd2('0x14')],![])){this['realtime'][_0x8fd2('0x11')][this['agent']['id']][_0x8fd2('0x15')]=!![];this[_0x8fd2('0x5')]['agents'][this[_0x8fd2('0x4')]['id']]['busyQueue']=undefined;util[_0x8fd2('0x16')](this[_0x8fd2('0x5')],this['routing'],this[_0x8fd2('0x4')],this[_0x8fd2('0x3')][_0x8fd2('0x14')]);util['showNotification'](this[_0x8fd2('0x17')],this[_0x8fd2('0x3')]['id'],this[_0x8fd2('0x5')][_0x8fd2('0x11')][this[_0x8fd2('0x4')]['id']],null,this[_0x8fd2('0x2')]);util[_0x8fd2('0x18')](this[_0x8fd2('0x3')]['id'],this[_0x8fd2('0x5')][_0x8fd2('0x11')][this[_0x8fd2('0x4')]['id']],_0x8fd2('0x19')+(this[_0x8fd2('0x2')]['forcedOwnership']?':FORCED':''));}else{logger[_0x8fd2('0xe')](_0x8fd2('0x1a'),this[_0x8fd2('0x3')]['id'],this['agent']['id']);setTimeout(this[_0x8fd2('0xa')][_0x8fd2('0x6')](this),0x3e8);}}};Agent[_0x8fd2('0xc')][_0x8fd2('0x7')]=function(_0x119439){if(_[_0x8fd2('0x10')](this[_0x8fd2('0x5')]['agents'][this[_0x8fd2('0x4')]['id']])){return logger[_0x8fd2('0xe')](_0x8fd2('0x1b'),this[_0x8fd2('0x3')]['id'],this[_0x8fd2('0x4')]['id']);}else{logger[_0x8fd2('0xe')](_0x8fd2('0x1c'),this['squeue']['id'],this['agent']['id']);util['hideNotification'](this[_0x8fd2('0x17')],this[_0x8fd2('0x3')]['id'],this[_0x8fd2('0x5')][_0x8fd2('0x11')][this['agent']['id']],null,this['routing']);this[_0x8fd2('0x5')][_0x8fd2('0x11')][this[_0x8fd2('0x4')]['id']][_0x8fd2('0x15')]=![];this[_0x8fd2('0x5')]['agents'][this[_0x8fd2('0x4')]['id']]['busyQueue']=undefined;util[_0x8fd2('0x1d')](this['realtime'],this[_0x8fd2('0x2')],this['agent'],this[_0x8fd2('0x3')][_0x8fd2('0x14')]);util[_0x8fd2('0x18')](this['squeue']['id'],this[_0x8fd2('0x5')]['agents'][this[_0x8fd2('0x4')]['id']],_0x119439?_0x8fd2('0x1e'):_0x8fd2('0x1f'));}if(!_0x119439){setTimeout(this['push'][_0x8fd2('0x6')](this),0x3e8);}};function agent(_0x199a85,_0x21adc6,_0x58ce31,_0x11ef3b){return new Agent(_0x199a85,_0x21adc6,_0x58ce31,_0x11ef3b);}module[_0x8fd2('0x20')]=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 afa4327..6a1e85b 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 _0xa6dc=['lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','queue','realtime','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','isNil','Agents','length','debug','isAgentAvailable','agents','channel','writeLog','RINGING','busy','busyQueue','name','showNotification','routing','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','STOP','TIMEOUT','exports'];(function(_0x2a05d9,_0x13af93){var _0x20db40=function(_0x57c9b7){while(--_0x57c9b7){_0x2a05d9['push'](_0x2a05d9['shift']());}};_0x20db40(++_0x13af93);}(_0xa6dc,0x120));var _0xca6d=function(_0x366530,_0x204695){_0x366530=_0x366530-0x0;var _0x4addd0=_0xa6dc[_0x366530];return _0x4addd0;};'use strict';var _=require(_0xca6d('0x0'));var uuid=require(_0xca6d('0x1'));var util=require(_0xca6d('0x2'));var logger=require(_0xca6d('0x3'))('routing');var Beepall=function(_0x9ef3cd,_0x5df732,_0x1d1b8e,_0x15aa8f){this[_0xca6d('0x4')]=uuid['v4']();this[_0xca6d('0x5')]=_0x9ef3cd;this[_0xca6d('0x6')]=_0x5df732;this[_0xca6d('0x7')]=_0x1d1b8e;this['routing']=_0x15aa8f;this[_0xca6d('0x5')][_0xca6d('0x8')](this[_0xca6d('0x9')][_0xca6d('0xa')](this),this['handleTimeout']['bind'](this));this[_0xca6d('0x5')]['on'](_0xca6d('0xb'),this[_0xca6d('0xc')][_0xca6d('0xa')](this));this[_0xca6d('0x5')]['on'](_0xca6d('0xd'),this[_0xca6d('0xe')][_0xca6d('0xa')](this));};Beepall[_0xca6d('0xf')]['push']=function(){this[_0xca6d('0x5')][_0xca6d('0x8')](this[_0xca6d('0x9')]['bind'](this),this[_0xca6d('0xc')][_0xca6d('0xa')](this));};Beepall['prototype'][_0xca6d('0xe')]=function(){this[_0xca6d('0xc')](!![]);};Beepall[_0xca6d('0xf')][_0xca6d('0x9')]=function(){var _0x28b948=!![];if(!_[_0xca6d('0x10')](this[_0xca6d('0x6')])&&!_[_0xca6d('0x10')](this[_0xca6d('0x6')][_0xca6d('0x11')])&&this[_0xca6d('0x6')]['Agents'][_0xca6d('0x12')]>0x0){for(var _0x42211b=0x0,_0x437f32;_0x42211b0x0){for(var _0x47c8ec=0x0,_0x427509;_0x47c8ec0x0&&_0x56dd3a[_0x545ed6+_0x6f84('0x23')]>=_0x56dd3a[_0x545ed6+'Capacity']){writeLog(_0x3086ff,_0x56dd3a,_0x545ed6[_0x6f84('0x24')]()+_0x6f84('0x25'));return![];}}return!![];};exports[_0x6f84('0x26')]=function(_0x430fb7,_0x3627e8,_0x30014e,_0x3f2fb4,_0x9bd17d){return sendNotification(!![],_0x430fb7,_0x3627e8,_0x30014e,_0x3f2fb4,_0x9bd17d);};exports[_0x6f84('0x27')]=function(_0x31badd,_0x1b2034,_0x7d298d,_0x347481,_0x2650e7){return sendNotification(![],_0x31badd,_0x1b2034,_0x7d298d,_0x347481,_0x2650e7);};exports[_0x6f84('0x28')]=function(_0x338740,_0x1a915b,_0x4fa5da){var _0x16cab0=_0x1a915b[_0x6f84('0x29')][_0x6f84('0x2a')];if(!_0x16cab0&&_0x4fa5da){_0x16cab0=_0x4fa5da['id'];}var _0x4a4a4f=_['some'](_0x338740[_0x1a915b[_0x6f84('0x2b')]+_0x6f84('0x2c')],function(_0x51256d){var _0x261b49=_[_0x6f84('0x2d')](_0x1a915b[_0x6f84('0x2b')])+_0x6f84('0x2e');return _0x51256d[_0x261b49]===_0x1a915b['interaction']['id'];});if(!_0x4a4a4f&&_0x16cab0&&_0x338740[_0x6f84('0x2f')][_0x16cab0]){_0x4a4a4f=_[_0x6f84('0x30')](_0x338740[_0x6f84('0x2f')][_0x16cab0][_0x1a915b[_0x6f84('0x2b')]+'WaitingInteractions'],function(_0x3f153b){return _0x3f153b['id']===_0x1a915b[_0x6f84('0x29')]['id'];});}return _0x4a4a4f;};exports[_0x6f84('0x31')]=function(_0x282cfa,_0x473aec,_0x388763,_0x3aadee){if(_0x388763&&_0x388763['id']&&_0x282cfa[_0x6f84('0x2f')]&&_0x282cfa[_0x6f84('0x2f')][_0x388763['id']]){_0x282cfa[_0x6f84('0x2f')][_0x388763['id']][_0x3aadee+_0x6f84('0x32')][_0x473aec['message']['id']]={'id':_0x473aec[_0x6f84('0x29')]['id']};}};exports[_0x6f84('0x33')]=function(_0x4173cf,_0x11828b,_0x2e693f,_0x4a344d){if(_0x2e693f&&_0x2e693f['id']&&_0x4173cf[_0x6f84('0x2f')]&&_0x4173cf['agents'][_0x2e693f['id']]){delete _0x4173cf[_0x6f84('0x2f')][_0x2e693f['id']][_0x4a344d+_0x6f84('0x32')][_0x11828b[_0x6f84('0x14')]['id']];}};exports[_0x6f84('0x34')]=writeLog; \ No newline at end of file +var _0x81b8=['error','format','[%s][QUEUE]\x20%s','user:%s','notification:%s','save','remove','isAgentAvailable','busy','online','OFFLINE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','checkWaitingNotifications','interaction','UserId','some','capitalize','channel','InteractionId','WaitingInteractions','saveWaitingNotification','agents','message','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','redis','socket.io-emitter','split','name','account','notificationSound','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template'];(function(_0xd823d7,_0x35a7ab){var _0x585718=function(_0x4bf45f){while(--_0x4bf45f){_0xd823d7['push'](_0xd823d7['shift']());}};_0x585718(++_0x35a7ab);}(_0x81b8,0x1ce));var _0x881b=function(_0x380c1c,_0x3ab1a3){_0x380c1c=_0x380c1c-0x0;var _0x5c1cba=_0x81b8[_0x380c1c];return _0x5c1cba;};'use strict';var _=require(_0x881b('0x0'));var util=require(_0x881b('0x1'));var utils=require(_0x881b('0x2'));var Redis=require(_0x881b('0x3'));var config=require(_0x881b('0x4'));var logger=require(_0x881b('0x5'))('routing');config['redis']=_['defaults'](config[_0x881b('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x881b('0x7'))(new Redis(config[_0x881b('0x6')]));function sendNotification(_0xfc215d,_0x30b534,_0x3df7ed,_0x538cf9,_0x3a12f8,_0x21d2c7){var _0x5cdf75=_0x21d2c7||{};var _0x220a0e=_0x3df7ed[_0x881b('0x8')]('.');var _0x38b88e={'uniqueid':_0x30b534,'channel':_0x220a0e[0x0],'id':_0x220a0e[0x1],'title':_0x220a0e[0x0]+'\x20interaction','interactionId':_0x220a0e[0x2],'queue':_0x3a12f8?_0x3a12f8[_0x881b('0x9')]:null,'sound':_0x5cdf75[_0x881b('0xa')][_0x881b('0xb')],'shake':_0x5cdf75[_0x881b('0xa')]['notificationShake']};try{if(!_0x5cdf75[_0x881b('0xc')]){_0x5cdf75[_0x881b('0xc')]={};}if(_0x3a12f8){_0x5cdf75['body'][_0x881b('0xd')]=_0x3a12f8;}else if(_0x5cdf75['body'][_0x881b('0xd')]){delete _0x5cdf75[_0x881b('0xc')][_0x881b('0xd')];}_0x38b88e[_0x881b('0xe')]=utils[_0x881b('0xf')](_0x5cdf75[_0x881b('0xa')][_0x881b('0x10')],_0x5cdf75);}catch(_0xd4ae24){_0x38b88e[_0x881b('0xe')]=_0x881b('0x11');logger[_0x881b('0x12')](util[_0x881b('0x13')](_0x881b('0x14'),_0x30b534,_0xd4ae24['message']));}io['to'](util['format'](_0x881b('0x15'),_0x538cf9['name']))['emit'](util[_0x881b('0x13')](_0x881b('0x16'),_0xfc215d?_0x881b('0x17'):_0x881b('0x18')),_0x38b88e);}function writeLog(_0x1b12f6,_0x3873d7,_0x415852){return logger['debug'](util[_0x881b('0x13')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x1b12f6,_0x3873d7[_0x881b('0x9')],_0x415852));}exports[_0x881b('0x19')]=function(_0x5e9af8,_0x3d86d8,_0x2323b8,_0x170643){if(_0x3d86d8[_0x881b('0x1a')]){writeLog(_0x5e9af8,_0x3d86d8,'BUSY');return![];}if(!_0x3d86d8[_0x881b('0x1b')]){writeLog(_0x5e9af8,_0x3d86d8,_0x881b('0x1c'));return![];}if(_0x3d86d8[_0x2323b8+'Pause']){writeLog(_0x5e9af8,_0x3d86d8,'PAUSE');return![];}if(_0x170643&&_0x3d86d8['hasOwnProperty'](_0x2323b8+_0x881b('0x1d'))&&_0x3d86d8[_0x881b('0x1e')](_0x2323b8+_0x881b('0x1f'))){if(_0x3d86d8[_0x2323b8+_0x881b('0x1d')]>0x0&&_0x3d86d8[_0x2323b8+_0x881b('0x1f')]>=_0x3d86d8[_0x2323b8+'Capacity']){writeLog(_0x5e9af8,_0x3d86d8,_0x2323b8[_0x881b('0x20')]()+_0x881b('0x21'));return![];}}return!![];};exports[_0x881b('0x22')]=function(_0x167c3e,_0x478dd6,_0x324a71,_0x24e3ce,_0x448649){return sendNotification(!![],_0x167c3e,_0x478dd6,_0x324a71,_0x24e3ce,_0x448649);};exports['hideNotification']=function(_0x53dc6c,_0xc547b2,_0x117826,_0x4c2942,_0x22c021){return sendNotification(![],_0x53dc6c,_0xc547b2,_0x117826,_0x4c2942,_0x22c021);};exports[_0x881b('0x23')]=function(_0xb53a17,_0x5294ee,_0x272631){var _0x2e0561=_0x5294ee[_0x881b('0x24')][_0x881b('0x25')];if(!_0x2e0561&&_0x272631){_0x2e0561=_0x272631['id'];}var _0x1b00bd=_[_0x881b('0x26')](_0xb53a17[_0x5294ee['channel']+'QueuesWaitingInteractions'],function(_0x2efd0c){var _0x50c248=_[_0x881b('0x27')](_0x5294ee[_0x881b('0x28')])+_0x881b('0x29');return _0x2efd0c[_0x50c248]===_0x5294ee[_0x881b('0x24')]['id'];});if(!_0x1b00bd&&_0x2e0561&&_0xb53a17['agents'][_0x2e0561]){_0x1b00bd=_[_0x881b('0x26')](_0xb53a17['agents'][_0x2e0561][_0x5294ee[_0x881b('0x28')]+_0x881b('0x2a')],function(_0x4c8404){return _0x4c8404['id']===_0x5294ee[_0x881b('0x24')]['id'];});}return _0x1b00bd;};exports[_0x881b('0x2b')]=function(_0x3bbf6e,_0x4b046c,_0x4a65c9,_0x384ada){if(_0x4a65c9&&_0x4a65c9['id']&&_0x3bbf6e[_0x881b('0x2c')]&&_0x3bbf6e['agents'][_0x4a65c9['id']]){_0x3bbf6e['agents'][_0x4a65c9['id']][_0x384ada+_0x881b('0x2a')][_0x4b046c[_0x881b('0x2d')]['id']]={'id':_0x4b046c[_0x881b('0x24')]['id']};}};exports[_0x881b('0x2e')]=function(_0x4ffbf7,_0x4ef551,_0x4969d0,_0xfa037e){if(_0x4969d0&&_0x4969d0['id']&&_0x4ffbf7[_0x881b('0x2c')]&&_0x4ffbf7['agents'][_0x4969d0['id']]){delete _0x4ffbf7[_0x881b('0x2c')][_0x4969d0['id']][_0xfa037e+'WaitingInteractions'][_0x4ef551[_0x881b('0x2d')]['id']];}};exports[_0x881b('0x2f')]=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 570b921..eeec7d7 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 _0x2e78=['info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','map','message','join'];(function(_0xb67888,_0x19024c){var _0x1e0776=function(_0x319ce8){while(--_0x319ce8){_0xb67888['push'](_0xb67888['shift']());}};_0x1e0776(++_0x19024c);}(_0x2e78,0xab));var _0x82e7=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2e78[_0x1ac595];return _0x455fff;};'use strict';var schema=require(_0x82e7('0x0'));var sh=require(_0x82e7('0x1'));var _=require(_0x82e7('0x2'));var utils=require('./utils');var logger=require(_0x82e7('0x3'))(_0x82e7('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x82e7('0x5')}});exports['consequence']=function(_0x3ef4dd,_0xa08f03){return function(_0x40445b){try{var _0x94c1a0={'command':_0xa08f03[0x0]};var _0x3667ba=system[_0x82e7('0x0')](_0x94c1a0,{'typecast':!![]});if(_0x3667ba['length']){logger['error']('[%s][SYSTEM]\x20%s',_0x3ef4dd,_[_0x82e7('0x6')](_0x3667ba,_0x82e7('0x7'))[_0x82e7('0x8')](',\x20'));logger[_0x82e7('0x9')](_0x82e7('0xa'),_0x3ef4dd);_0x40445b[_0x82e7('0xb')]();}else{var _0x5c8b9e=this;var _0x22d49a=utils['getMustacheRender'](_0xa08f03[0x0],this);logger[_0x82e7('0x9')](_0x82e7('0xc'),_0x3ef4dd,_0x22d49a);sh['exec'](_['trim'](_0x22d49a),function(_0x5c8eca,_0x4f8064){logger[_0x82e7('0x9')](_0x82e7('0xd'),_0x3ef4dd,_0x5c8eca);if(_0x5c8eca==0x0){var _0x529675=_0x4f8064[_0x82e7('0xe')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0xa08f03[0x1])||_[_0x82e7('0xf')](_0xa08f03[0x1])){logger[_0x82e7('0x9')](_0x82e7('0x10'),_0x3ef4dd);_0x5c8b9e['body'][_0xa08f03[0x1]]=_0x529675;}else{logger[_0x82e7('0x9')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x3ef4dd,_0xa08f03[0x1],_0x529675);_0x5c8b9e['body'][_0xa08f03[0x1]]=_0x529675;}}_0x40445b[_0x82e7('0xb')]();});}}catch(_0x436249){logger['error'](_0x82e7('0x11'),_0x3ef4dd,_[_0x82e7('0x12')](_0x436249)?JSON[_0x82e7('0x13')](_0x436249):_0x436249);logger[_0x82e7('0x9')](_0x82e7('0xa'),_0x3ef4dd);_0x40445b[_0x82e7('0xb')]();}};}; \ No newline at end of file +var _0x34e5=['[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','stringify','next','shelljs','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','length','[%s][SYSTEM]\x20%s','map','message','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty'];(function(_0x1763e7,_0x335b06){var _0x95c7fa=function(_0x31adef){while(--_0x31adef){_0x1763e7['push'](_0x1763e7['shift']());}};_0x95c7fa(++_0x335b06);}(_0x34e5,0x172));var _0x534e=function(_0x5d7f2d,_0x3ba70b){_0x5d7f2d=_0x5d7f2d-0x0;var _0x94e02c=_0x34e5[_0x5d7f2d];return _0x94e02c;};'use strict';var schema=require('validate');var sh=require(_0x534e('0x0'));var _=require('lodash');var utils=require(_0x534e('0x1'));var logger=require(_0x534e('0x2'))(_0x534e('0x3'));var system=schema({'command':{'type':_0x534e('0x4'),'required':!![],'message':_0x534e('0x5')}});exports['consequence']=function(_0x11a158,_0x3d8287){return function(_0x3c772f){try{var _0x117f0c={'command':_0x3d8287[0x0]};var _0x436a92=system[_0x534e('0x6')](_0x117f0c,{'typecast':!![]});if(_0x436a92[_0x534e('0x7')]){logger['error'](_0x534e('0x8'),_0x11a158,_[_0x534e('0x9')](_0x436a92,_0x534e('0xa'))['join'](',\x20'));logger['info'](_0x534e('0xb'),_0x11a158);_0x3c772f['next']();}else{var _0x3eb20c=this;var _0x55509d=utils[_0x534e('0xc')](_0x3d8287[0x0],this);logger[_0x534e('0xd')](_0x534e('0xe'),_0x11a158,_0x55509d);sh['exec'](_[_0x534e('0xf')](_0x55509d),function(_0x229352,_0x73b135){logger[_0x534e('0xd')](_0x534e('0x10'),_0x11a158,_0x229352);if(_0x229352==0x0){var _0x5ef1b1=_0x73b135[_0x534e('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x534e('0x12')](_0x3d8287[0x1])||_[_0x534e('0x13')](_0x3d8287[0x1])){logger[_0x534e('0xd')](_0x534e('0x14'),_0x11a158);_0x3eb20c[_0x534e('0x15')][_0x3d8287[0x1]]=_0x5ef1b1;}else{logger[_0x534e('0xd')](_0x534e('0x16'),_0x11a158,_0x3d8287[0x1],_0x5ef1b1);_0x3eb20c[_0x534e('0x15')][_0x3d8287[0x1]]=_0x5ef1b1;}}_0x3c772f['next']();});}}catch(_0x4171d6){logger[_0x534e('0x17')]('[%s][SYSTEM]\x20%s',_0x11a158,_['isObject'](_0x4171d6)?JSON[_0x534e('0x18')](_0x4171d6):_0x4171d6);logger[_0x534e('0xd')](_0x534e('0xb'),_0x11a158);_0x3c772f[_0x534e('0x19')]();}};}; \ 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 2d3e233..a9facd0 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 _0xa16e=['Interaction','channel','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','error','stringify','finally','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa16e,0xd6));var _0xea16=function(_0x65c789,_0x3dbe58){_0x65c789=_0x65c789-0x0;var _0x3b258e=_0xa16e[_0x65c789];return _0x3b258e;};'use strict';var schema=require(_0xea16('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xea16('0x1')),'openchannelInteraction':require(_0xea16('0x2')),'smsInteraction':require(_0xea16('0x3')),'mailInteraction':require(_0xea16('0x4')),'faxInteraction':require(_0xea16('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xea16('0x6'))(_0xea16('0x7'));var tag=schema({'tag':{'type':_0xea16('0x8'),'required':!![],'message':_0xea16('0x9')}});exports['consequence']=function(_0x19af1b,_0x21e9d3,_0x43a4d0,_0x1b31bb){return function(_0x2896de){try{var _0x6d83b={'tag':_0x21e9d3[0x0]};var _0x32a76d=tag[_0xea16('0x0')](_0x6d83b,{'typecast':!![]});if(_0x32a76d['length']){logger['error'](_0xea16('0xa'),_0x19af1b,_[_0xea16('0xb')](_0x32a76d,'message')[_0xea16('0xc')](',\x20'));logger[_0xea16('0xd')](_0xea16('0xe'),_0x19af1b);_0x2896de[_0xea16('0xf')]();}else{var _0x48b729={'ids':[_0x21e9d3[0x0]]};if(rpc[_0x1b31bb['channel']+_0xea16('0x10')]){rpc[_0x1b31bb[_0xea16('0x11')]+_0xea16('0x10')]['addTags'](_0x1b31bb[_0xea16('0x12')]['id'],_0x48b729)['then'](function(_0x1534b7){logger[_0xea16('0xd')](_0xea16('0x13'),_0x19af1b,_0x21e9d3[0x1],_0x1b31bb[_0xea16('0x11')],_0x1b31bb['interaction']['id']);})['catch'](function(_0x232542){logger[_0xea16('0x14')]('[%s][TAG]\x20%s',_0x19af1b,JSON[_0xea16('0x15')](_0x232542));logger[_0xea16('0xd')](_0xea16('0xe'),_0x19af1b);})[_0xea16('0x16')](function(){_0x2896de[_0xea16('0xf')]();});}}}catch(_0x5f5775){logger[_0xea16('0x14')](_0xea16('0xa'),_0x19af1b,_['isObject'](_0x5f5775)?JSON[_0xea16('0x15')](_0x5f5775):_0x5f5775);logger[_0xea16('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x19af1b);_0x2896de[_0xea16('0xf')]();}};}; \ No newline at end of file +var _0x5e22=['length','[%s][TAG]\x20%s','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','finally','next','isObject','validate','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence'];(function(_0x2bc1fe,_0x45da98){var _0x1a47a5=function(_0x2e5053){while(--_0x2e5053){_0x2bc1fe['push'](_0x2bc1fe['shift']());}};_0x1a47a5(++_0x45da98);}(_0x5e22,0x16f));var _0x25e2=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x5e22[_0x1694f5];return _0x5b4321;};'use strict';var schema=require(_0x25e2('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x25e2('0x1')),'smsInteraction':require(_0x25e2('0x2')),'mailInteraction':require(_0x25e2('0x3')),'faxInteraction':require(_0x25e2('0x4')),'whatsappInteraction':require(_0x25e2('0x5'))};var logger=require(_0x25e2('0x6'))(_0x25e2('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x25e2('0x8')}});exports[_0x25e2('0x9')]=function(_0xdc2286,_0xff0b55,_0x25ad4a,_0x5f2fc1){return function(_0x85f9b6){try{var _0x324548={'tag':_0xff0b55[0x0]};var _0x424df3=tag[_0x25e2('0x0')](_0x324548,{'typecast':!![]});if(_0x424df3[_0x25e2('0xa')]){logger['error'](_0x25e2('0xb'),_0xdc2286,_[_0x25e2('0xc')](_0x424df3,_0x25e2('0xd'))[_0x25e2('0xe')](',\x20'));logger['info'](_0x25e2('0xf'),_0xdc2286);_0x85f9b6['next']();}else{var _0x2356b6={'ids':[_0xff0b55[0x0]]};if(rpc[_0x5f2fc1[_0x25e2('0x10')]+'Interaction']){rpc[_0x5f2fc1[_0x25e2('0x10')]+_0x25e2('0x11')][_0x25e2('0x12')](_0x5f2fc1[_0x25e2('0x13')]['id'],_0x2356b6)[_0x25e2('0x14')](function(_0xe825aa){logger[_0x25e2('0x15')](_0x25e2('0x16'),_0xdc2286,_0xff0b55[0x1],_0x5f2fc1[_0x25e2('0x10')],_0x5f2fc1[_0x25e2('0x13')]['id']);})[_0x25e2('0x17')](function(_0x488634){logger[_0x25e2('0x18')](_0x25e2('0xb'),_0xdc2286,JSON[_0x25e2('0x19')](_0x488634));logger[_0x25e2('0x15')](_0x25e2('0xf'),_0xdc2286);})[_0x25e2('0x1a')](function(){_0x85f9b6[_0x25e2('0x1b')]();});}}}catch(_0x13ea42){logger[_0x25e2('0x18')](_0x25e2('0xb'),_0xdc2286,_[_0x25e2('0x1c')](_0x13ea42)?JSON[_0x25e2('0x19')](_0x13ea42):_0x13ea42);logger[_0x25e2('0x15')](_0x25e2('0xf'),_0xdc2286);_0x85f9b6[_0x25e2('0x1b')]();}};}; \ 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 8a1a819..3dfccbb 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 _0x54ad=['&sessionId=','info','stop','error','[%s][TVOX]\x20%s','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','lodash','consequence','\x20-\x20','replace','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','login','params','stringify','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId='];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x54ad,0x1ab));var _0xd54a=function(_0x388126,_0x4fd096){_0x388126=_0x388126-0x0;var _0xaa0ae7=_0x54ad[_0x388126];return _0xaa0ae7;};'use strict';var rp=require('request-promise');var logger=require(_0xd54a('0x0'))(_0xd54a('0x1'));var _=require(_0xd54a('0x2'));var arr=[];exports[_0xd54a('0x3')]=function(_0x8443f1,_0x2d61d2){return function(_0x1e1e5b){var _0x95e2ae=_0x2d61d2[0xa];var _0x4f0b98=_0x2d61d2[0xb];var _0x3c466f=_0x2d61d2[0xc];var _0x1ba275=_0x2d61d2[0xd];var _0x2d2bfe=_0x2d61d2[0xe];var _0x1c6259=_0x2d61d2[0xf]['replace'](/\n/g,_0xd54a('0x4'));var _0x2aa524=_0x2d61d2[0x10][_0xd54a('0x5')](/\n/g,'\x20');if(!arr['includes'](_0x4f0b98)){arr[_0xd54a('0x6')](_0x4f0b98);var _0x1e83ea=_0x2d61d2[0x3];var _0x1abf47=_0x2d61d2[0x4];var _0x535c8e=_0x2d61d2[0x1];var _0x3d8cb2=_0x2d61d2[0x0];var _0x42d241={};_0x42d241[_0xd54a('0x7')]=_0x2d61d2[0x8]+_0xd54a('0x8')+_0x3c466f+'|'+_0x95e2ae+'|'+_0x1ba275+'|'+_0x4f0b98+'|'+_0x2d2bfe;_0x42d241[_0xd54a('0x9')]=_0x2d61d2[0x7]+_0xd54a('0x8')+_0x3c466f+'|'+_0x95e2ae+'|'+_0x1ba275+'|'+_0x4f0b98+'|'+_0x2d2bfe+'|'+_0x1c6259+'|'+_0x2aa524;_0x42d241[_0xd54a('0xa')]=_0x2d61d2[0x9];var _0x17900d={};_0x17900d[_0xd54a('0xb')]=_0xd54a('0xc');_0x17900d[_0xd54a('0xd')]=_0xd54a('0xe');var _0x289739=[];_0x289739[_0xd54a('0x6')](_0x2d61d2[0x2]);_0x289739[_0xd54a('0x6')](_0x2d61d2[0x5]);_0x289739[_0xd54a('0x6')](_0x2d61d2[0x6]);_0x17900d[_0xd54a('0xf')]=_0x289739;_0x17900d['id']=0x1;var _0x500599=JSON[_0xd54a('0x10')](_0x17900d);var _0x1e113c={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x1e83ea,'headers':{'Content-Type':'application/json-rpc'},'body':_0x500599};return rp(_0x1e113c)['then'](function(_0x24e157){const _0x42f5b6=JSON[_0xd54a('0x11')](_0x24e157);if(!_0x42f5b6[_0xd54a('0x12')]['logged']){throw new Error(_0xd54a('0x13'));}var _0x104577=_0x4f0b98;var _0x564a63='channelId='+_0x535c8e+_0xd54a('0x14')+_0x3d8cb2+_0xd54a('0x15')+_0x104577+'&data='+JSON[_0xd54a('0x10')](_0x42d241);var _0xc2a377=_0x1abf47+'?'+_0x564a63;return rp(_0xc2a377);})['then'](function(_0x5e341d){logger[_0xd54a('0x16')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x8443f1,_0x5e341d);_0x1e1e5b[_0xd54a('0x17')]();})['catch'](function(_0x3abc64){logger[_0xd54a('0x18')](_0xd54a('0x19'),_0x8443f1,_['isObject'](_0x3abc64)?JSON[_0xd54a('0x10')](_0x3abc64):_0x3abc64);_0x1e1e5b[_0xd54a('0x17')]();});}else{logger[_0xd54a('0x16')](_0xd54a('0x1a'),_0x8443f1);_0x1e1e5b[_0xd54a('0x1b')]();}};}; \ No newline at end of file +var _0x7839=['urlOnRing','jsonrpc','login','params','POST','application/json-rpc','then','parse','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','[%s][TVOX]\x20%s','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','routing','lodash','replace','\x20-\x20','includes','push','urlOnAnswer','?params='];(function(_0x2e2eab,_0x2e609a){var _0x2357bc=function(_0x2235ad){while(--_0x2235ad){_0x2e2eab['push'](_0x2e2eab['shift']());}};_0x2357bc(++_0x2e609a);}(_0x7839,0x164));var _0x9783=function(_0x3e90b0,_0x5505a2){_0x3e90b0=_0x3e90b0-0x0;var _0x480f50=_0x7839[_0x3e90b0];return _0x480f50;};'use strict';var rp=require('request-promise');var logger=require('../../../../config/logger')(_0x9783('0x0'));var _=require(_0x9783('0x1'));var arr=[];exports['consequence']=function(_0x14c16f,_0x4f042d){return function(_0x113b2f){var _0x11f2f8=_0x4f042d[0xa];var _0x569a57=_0x4f042d[0xb];var _0xd98b2d=_0x4f042d[0xc];var _0x1e25ed=_0x4f042d[0xd];var _0x1c2433=_0x4f042d[0xe];var _0x385778=_0x4f042d[0xf][_0x9783('0x2')](/\n/g,_0x9783('0x3'));var _0x20e7b7=_0x4f042d[0x10][_0x9783('0x2')](/\n/g,'\x20');if(!arr[_0x9783('0x4')](_0x569a57)){arr[_0x9783('0x5')](_0x569a57);var _0x234ee4=_0x4f042d[0x3];var _0xc3ede9=_0x4f042d[0x4];var _0x56cd11=_0x4f042d[0x1];var _0x4c2939=_0x4f042d[0x0];var _0x40c8d1={};_0x40c8d1[_0x9783('0x6')]=_0x4f042d[0x8]+_0x9783('0x7')+_0xd98b2d+'|'+_0x11f2f8+'|'+_0x1e25ed+'|'+_0x569a57+'|'+_0x1c2433;_0x40c8d1[_0x9783('0x8')]=_0x4f042d[0x7]+'?params='+_0xd98b2d+'|'+_0x11f2f8+'|'+_0x1e25ed+'|'+_0x569a57+'|'+_0x1c2433+'|'+_0x385778+'|'+_0x20e7b7;_0x40c8d1['title']=_0x4f042d[0x9];var _0x3eba35={};_0x3eba35[_0x9783('0x9')]='2.0';_0x3eba35['method']=_0x9783('0xa');var _0x2655cb=[];_0x2655cb[_0x9783('0x5')](_0x4f042d[0x2]);_0x2655cb[_0x9783('0x5')](_0x4f042d[0x5]);_0x2655cb[_0x9783('0x5')](_0x4f042d[0x6]);_0x3eba35[_0x9783('0xb')]=_0x2655cb;_0x3eba35['id']=0x1;var _0x46675b=JSON['stringify'](_0x3eba35);var _0x37caa1={'encoding':'utf8','method':_0x9783('0xc'),'timeout':0x2710,'url':_0x234ee4,'headers':{'Content-Type':_0x9783('0xd')},'body':_0x46675b};return rp(_0x37caa1)[_0x9783('0xe')](function(_0x583fdd){const _0x5ef2a9=JSON[_0x9783('0xf')](_0x583fdd);if(!_0x5ef2a9['result']['logged']){throw new Error(_0x9783('0x10'));}var _0x118f2a=_0x569a57;var _0xa33674=_0x9783('0x11')+_0x56cd11+_0x9783('0x12')+_0x4c2939+'&sessionId='+_0x118f2a+_0x9783('0x13')+JSON[_0x9783('0x14')](_0x40c8d1);var _0x284fc6=_0xc3ede9+'?'+_0xa33674;return rp(_0x284fc6);})[_0x9783('0xe')](function(_0x4eb709){logger[_0x9783('0x15')](_0x9783('0x16'),_0x14c16f,_0x4eb709);_0x113b2f[_0x9783('0x17')]();})['catch'](function(_0x50769d){logger[_0x9783('0x18')](_0x9783('0x19'),_0x14c16f,_['isObject'](_0x50769d)?JSON[_0x9783('0x14')](_0x50769d):_0x50769d);_0x113b2f[_0x9783('0x17')]();});}else{logger[_0x9783('0x15')](_0x9783('0x1a'),_0x14c16f);_0x113b2f[_0x9783('0x1b')]();}};}; \ 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 2554821..ff941b2 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 _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0xc2899e,_0x295db5){var _0x504c67=function(_0x1409eb){while(--_0x1409eb){_0xc2899e['push'](_0xc2899e['shift']());}};_0x504c67(++_0x295db5);}(_0xe706,0xa3));var _0x6e70=function(_0x146907,_0x541dcb){_0x146907=_0x146907-0x0;var _0x47e370=_0xe706[_0x146907];return _0x47e370;};'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 +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x31b704,_0x27b5dc){var _0x37866f=function(_0x1abea2){while(--_0x1abea2){_0x31b704['push'](_0x31b704['shift']());}};_0x37866f(++_0x27b5dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index aaa5ca8..b8818b3 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 _0xcc8f=['../rpc/whatsappQueueReport','format','isNil','IntervalId','Intervals','map','interval','channel','message','interaction','applications','length','join','app','.js','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','dialogflowv2','amazonlex','tag','getMustacheRender','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','condition','intervals','./applications/','priority','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','info','Applications\x20executed','emit','complete','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','busyQueue','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','mailQueues','waiting','openchannelQueues','name','smsQueues','faxQueues','whatsappQueues','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','listen','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','jayson/promise','bluebird','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0xcc8f,0x10d));var _0xfcc8=function(_0x228f1c,_0x384353){_0x228f1c=_0x228f1c-0x0;var _0x353ea5=_0xcc8f[_0x228f1c];return _0x353ea5;};'use strict';var _=require(_0xfcc8('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0xfcc8('0x1'));var BPromise=require(_0xfcc8('0x2'));var utils=require('./applications/utils');var sUtils=require(_0xfcc8('0x3'));var logger=require(_0xfcc8('0x4'))(_0xfcc8('0x5'));var rpc={'openchannelQueueReport':require(_0xfcc8('0x6')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xfcc8('0x7')),'smsQueueReport':require(_0xfcc8('0x8')),'faxQueueReport':require(_0xfcc8('0x9')),'whatsappQueueReport':require(_0xfcc8('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x4b474a,_0x578df4,_0x203f0d){return util[_0xfcc8('0xb')]('%s.%s.%s',_0x4b474a,_0x578df4||0x0,_0x203f0d||0x0);}function getIntervals(_0x56a563,_0x27fbff){var _0x49a3ab=[];if(!_[_0xfcc8('0xc')](_0x27fbff['IntervalId'])&&!_[_0xfcc8('0xc')](_0x56a563[_0x27fbff[_0xfcc8('0xd')]])&&!_[_0xfcc8('0xc')](_0x56a563[_0x27fbff[_0xfcc8('0xd')]][_0xfcc8('0xe')])){_0x49a3ab=_[_0xfcc8('0xf')](_0x56a563[_0x27fbff[_0xfcc8('0xd')]]['Intervals'],_0xfcc8('0x10'));}else if(!_[_0xfcc8('0xc')](_0x27fbff[_0xfcc8('0x10')])){_0x49a3ab=[_0x27fbff[_0xfcc8('0x10')]];}return _0x49a3ab;}exports['listen']=function(_0x29a1e3){_0x29a1e3['rules']={};return new BPromise(function(_0x302b18,_0x25f611){var _0x1383b5={'Start':function(_0x6bd5c1){var _0x1f1744=this;return new Promise(function(_0x38d4f8,_0x202485){if(_0x6bd5c1){try{var _0x4de9bc=[];var _0x2f7de4=getId(_0x6bd5c1[_0xfcc8('0x11')],_0x6bd5c1[_0xfcc8('0x12')]?_0x6bd5c1['message']['id']:0x0,_0x6bd5c1[_0xfcc8('0x13')]?_0x6bd5c1[_0xfcc8('0x13')]['id']:0x0);var _0x38c86a=sUtils['checkWaitingNotifications'](_0x29a1e3,_0x6bd5c1);if(_0x6bd5c1['transfer']||!_0x38c86a&&_0x6bd5c1[_0xfcc8('0x14')]&&_['isArray'](_0x6bd5c1[_0xfcc8('0x14')])&&_0x6bd5c1[_0xfcc8('0x14')][_0xfcc8('0x15')]){for(var _0xfb5e46=0x0;_0xfb5e46<_0x6bd5c1[_0xfcc8('0x14')][_0xfcc8('0x15')];_0xfb5e46+=0x1){var _0x18db92=_0x6bd5c1[_0xfcc8('0x14')][_0xfb5e46];if(fs['existsSync'](path[_0xfcc8('0x16')](__dirname,_0xfcc8('0x14'),_0x18db92[_0xfcc8('0x17')]+_0xfcc8('0x18')))){var _0x14888f=[];switch(_0x18db92[_0xfcc8('0x17')][_0xfcc8('0x19')]()){case _0xfcc8('0x1a'):var _0x253932=_0x18db92[_0xfcc8('0x1b')][_0xfcc8('0x1c')](',');if(_0x6bd5c1[_0xfcc8('0x11')]==='mail'){_0x14888f[_0xfcc8('0x1d')](_0x253932[0x0]);_0x14888f[_0xfcc8('0x1d')](_0x253932[0x1]);_0x14888f[_0xfcc8('0x1d')](_0x253932[_0xfcc8('0x1e')](0x2,_0x253932[_0xfcc8('0x15')])[_0xfcc8('0x16')](','));}else{_0x14888f[_0xfcc8('0x1d')](_0x253932[0x0]);_0x14888f[_0xfcc8('0x1d')](_0x253932[_0xfcc8('0x1e')](0x1,_0x253932[_0xfcc8('0x15')])[_0xfcc8('0x16')](','));}break;case _0xfcc8('0x1f'):var _0x5141b2=_0x18db92[_0xfcc8('0x1b')][_0xfcc8('0x1c')](',');_0x14888f[_0xfcc8('0x1d')](_0x5141b2[0x0]);_0x14888f[_0xfcc8('0x1d')](_0x5141b2[0x1]);_0x14888f[_0xfcc8('0x1d')](_0x5141b2[_0xfcc8('0x1e')](0x2,_0x5141b2['length'])[_0xfcc8('0x16')](','));break;case _0xfcc8('0x20'):var _0x38c5b0=_0x18db92[_0xfcc8('0x1b')][_0xfcc8('0x1c')](',');_0x14888f[_0xfcc8('0x1d')](_0x38c5b0[0x0]);_0x14888f[_0xfcc8('0x1d')](_0x38c5b0[0x1]);_0x14888f[_0xfcc8('0x1d')](_0x38c5b0[0x2]);_0x14888f[_0xfcc8('0x1d')](_0x38c5b0[0x3]);_0x14888f['push'](_0x38c5b0['slice'](0x4,_0x38c5b0[_0xfcc8('0x15')])['join'](','));break;case _0xfcc8('0x21'):var _0x28cec1=_0x18db92[_0xfcc8('0x1b')][_0xfcc8('0x1c')](',');_0x14888f[_0xfcc8('0x1d')](_0x28cec1[0x0]);_0x14888f[_0xfcc8('0x1d')](_0x28cec1[0x1]);_0x14888f[_0xfcc8('0x1d')](_0x28cec1[0x2]);_0x14888f['push'](_0x28cec1[0x3]);_0x14888f[_0xfcc8('0x1d')](_0x28cec1[_0xfcc8('0x1e')](0x4,_0x28cec1[_0xfcc8('0x15')])['join'](','));break;case'message':_0x14888f['push'](_0x18db92['appdata']);break;case _0xfcc8('0x22'):_0x14888f['push'](_0x18db92['TagId']);_0x14888f[_0xfcc8('0x1d')](_0x18db92[_0xfcc8('0x1b')]);break;case'tvox':var _0x34e14a=utils[_0xfcc8('0x23')](_0x6bd5c1['account'][_0xfcc8('0x24')],_0x6bd5c1);var _0x17feab=_0x18db92['appdata'][_0xfcc8('0x1c')](',');_0x14888f[_0xfcc8('0x1d')](_0x17feab[0x0]);_0x14888f[_0xfcc8('0x1d')](_0x17feab[0x1]);_0x14888f['push'](_0x17feab[0x2]);_0x14888f[_0xfcc8('0x1d')](_0x17feab[0x3]);_0x14888f[_0xfcc8('0x1d')](_0x17feab[0x4]);_0x14888f['push'](_0x17feab[0x5]);_0x14888f[_0xfcc8('0x1d')](_0x17feab[0x6]);_0x14888f['push'](_0x17feab[0x7]);_0x14888f[_0xfcc8('0x1d')](_0x17feab[0x8]);_0x14888f['push'](_0x17feab[0x9]);_0x14888f[_0xfcc8('0x1d')](_0x17feab[0xa]);_0x14888f[_0xfcc8('0x1d')](_0x6bd5c1[_0xfcc8('0x13')]['id']);_0x14888f['push'](_0x6bd5c1[_0xfcc8('0x12')]['id']);_0x14888f['push'](_0x18db92[_0xfcc8('0x25')]);_0x14888f[_0xfcc8('0x1d')](_0x6bd5c1[_0xfcc8('0x13')][_0xfcc8('0x26')]);_0x14888f[_0xfcc8('0x1d')](_0x6bd5c1[_0xfcc8('0x27')][_0xfcc8('0x27')]);_0x14888f[_0xfcc8('0x1d')](_0x34e14a);break;default:_0x14888f=_[_0xfcc8('0xc')](_0x18db92[_0xfcc8('0x1b')])?[]:_0x18db92[_0xfcc8('0x1b')][_0xfcc8('0x1c')](',');}var _0x1860bc={'id':util[_0xfcc8('0xb')](_0xfcc8('0x28'),_0x2f7de4,_0x18db92['id'],_0x18db92[_0xfcc8('0x17')]),'condition':require('./interval')[_0xfcc8('0x29')](_0x2f7de4,getIntervals(_0x29a1e3[_0xfcc8('0x2a')],_0x18db92),_0x29a1e3),'consequence':require(_0xfcc8('0x2b')+_0x18db92['app'])['consequence'](_0x2f7de4,_0x14888f,_0x29a1e3,_0x6bd5c1),'p':_0x18db92[_0xfcc8('0x2c')]||0x0};logger['info']('Push\x20new\x20rule',_0x1860bc['id'],_0xfcc8('0x2d'),getIntervals(_0x29a1e3[_0xfcc8('0x2a')],_0x18db92)[_0xfcc8('0x16')]('\x20|\x20'));_0x4de9bc[_0xfcc8('0x1d')](_0x1860bc);}else{logger[_0xfcc8('0x2e')](_0xfcc8('0x2f'),path[_0xfcc8('0x16')](__dirname,_0xfcc8('0x14'),_0x18db92['app']+'.js'));}}_0x29a1e3[_0xfcc8('0x30')][_0x2f7de4]=new RuleEngine(_0x4de9bc);_0x29a1e3[_0xfcc8('0x30')][_0x2f7de4][_0xfcc8('0x31')](_0x6bd5c1,function(_0x24b9d4){logger[_0xfcc8('0x32')](_0xfcc8('0x33'),JSON['stringify'](_0x24b9d4['matchPath']));if(_0x29a1e3[_0xfcc8('0x30')][_0x2f7de4]){_0x29a1e3[_0xfcc8('0x30')][_0x2f7de4][_0xfcc8('0x34')](_0xfcc8('0x35'));}});return _0x38d4f8({'code':0xc8,'message':_0x6bd5c1});}else{if(_0x38c86a){logger[_0xfcc8('0x32')](util[_0xfcc8('0xb')]('Skipped\x20routing\x20for\x20%s',_0x2f7de4));}else{logger[_0xfcc8('0x32')](_0xfcc8('0x36'));}return _0x38d4f8({'code':0xc8,'message':_0x6bd5c1});}}catch(_0x3eff97){logger[_0xfcc8('0x2e')](_0x3eff97['stack']);return _0x202485(_0x1f1744[_0xfcc8('0x2e')](0x1f4,_0x3eff97));}}return _0x202485(_0xfcc8('0x37'));});},'AcceptMessage':function(_0xea4b0b){var _0x531204=this;return new Promise(function(_0x170d9d,_0x14b588){if(_0xea4b0b[_0xfcc8('0x38')]&&_0xea4b0b[_0xfcc8('0x38')]['id']){if(_0x29a1e3[_0xfcc8('0x39')][_0xea4b0b['agent']['id']]){_0x29a1e3[_0xfcc8('0x39')][_0xea4b0b['agent']['id']][_0xfcc8('0x3a')]=![];_0x29a1e3['agents'][_0xea4b0b[_0xfcc8('0x38')]['id']]['busyQueue']=undefined;}}if(_0xea4b0b['message']&&_0xea4b0b[_0xfcc8('0x12')]['id']){try{var _0x2a9190=getId(_0xea4b0b[_0xfcc8('0x11')],_0xea4b0b[_0xfcc8('0x12')]?_0xea4b0b['message']['id']:0x0,_0xea4b0b['interaction']?_0xea4b0b[_0xfcc8('0x13')]['id']:0x0);if(_0x29a1e3[_0xfcc8('0x30')][_0x2a9190]){_0x29a1e3[_0xfcc8('0x30')][_0x2a9190][_0xfcc8('0x34')](_0xfcc8('0x3b'));if(rpc[_0xea4b0b['channel']+_0xfcc8('0x3c')]){rpc[_0xea4b0b[_0xfcc8('0x11')]+_0xfcc8('0x3c')]['update'](_0x2a9190,{'UserId':_0xea4b0b['message'][_0xfcc8('0x3d')]})[_0xfcc8('0x3e')](function(){logger[_0xfcc8('0x2e')](_0xfcc8('0x3f'));});}}return _0x170d9d({'code':0xc8,'message':_0xea4b0b});}catch(_0x3b6522){logger[_0xfcc8('0x2e')](_0x3b6522[_0xfcc8('0x40')]);return _0x14b588(_0x531204[_0xfcc8('0x2e')](0x1f4,_0x3b6522));}}logger[_0xfcc8('0x2e')](_0xfcc8('0x41'));return _0x14b588(_0x531204['error'](0x1f4,_0xfcc8('0x41')));});},'RejectMessage':function(_0x552d3f){var _0x10fce0=this;return new Promise(function(_0x43ce92,_0x3cba75){if(_0x552d3f[_0xfcc8('0x38')]&&_0x552d3f[_0xfcc8('0x38')]['id']){try{if(_0x29a1e3[_0xfcc8('0x39')][_0x552d3f[_0xfcc8('0x38')]['id']]){_0x29a1e3['agents'][_0x552d3f[_0xfcc8('0x38')]['id']][_0xfcc8('0x3a')]=![];_0x29a1e3[_0xfcc8('0x39')][_0x552d3f[_0xfcc8('0x38')]['id']][_0xfcc8('0x42')]=undefined;}return _0x43ce92({'code':0xc8,'message':_0x552d3f});}catch(_0xdba5a0){logger[_0xfcc8('0x2e')](_0xdba5a0['stack']);return _0x3cba75(_0x10fce0[_0xfcc8('0x2e')](0x1f4,_0xdba5a0));}}logger[_0xfcc8('0x2e')](_0xfcc8('0x41'));return _0x3cba75(_0x10fce0[_0xfcc8('0x2e')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x43735b){var _0xce1fb8=this;return new Promise(function(_0x72b712,_0x427904){if(_0x43735b['channel']&&_0x43735b[_0xfcc8('0x13')]&&_0x43735b[_0xfcc8('0x13')]['id']){try{var _0x41794e=getId(_0x43735b[_0xfcc8('0x11')],_0x43735b[_0xfcc8('0x12')]?_0x43735b['message']['id']:0x0,_0x43735b[_0xfcc8('0x13')]?_0x43735b['interaction']['id']:0x0);if(_0x29a1e3[_0xfcc8('0x30')][_0x41794e]){_0x29a1e3['rules'][_0x41794e][_0xfcc8('0x34')](_0xfcc8('0x3b'));}return _0x72b712({'code':0xc8,'message':_0x43735b});}catch(_0x5efe2f){logger[_0xfcc8('0x2e')](_0x5efe2f[_0xfcc8('0x40')]);return _0x427904(_0xce1fb8[_0xfcc8('0x2e')](0x1f4,_0x5efe2f));}}logger['error'](_0xfcc8('0x41'));return _0x427904(_0xce1fb8[_0xfcc8('0x2e')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x568e2c){var _0x2e78a4=this;return new Promise(function(_0x4b9a2d,_0x75091c){if(_0x29a1e3[_0xfcc8('0x39')]['hasOwnProperty'](_0x568e2c['id'])){for(var _0x19f0f5 in _0x568e2c[_0xfcc8('0x43')]){if(_0x568e2c[_0xfcc8('0x43')][_0xfcc8('0x44')](_0x19f0f5)){if(_0x29a1e3[_0xfcc8('0x39')][_0x568e2c['id']][_0xfcc8('0x44')](_0x19f0f5+_0xfcc8('0x45'))){_0x29a1e3[_0xfcc8('0x39')][_0x568e2c['id']][_0x19f0f5+_0xfcc8('0x45')]=parseInt(_0x568e2c['capacity'][_0x19f0f5],0xa);}}}_0x29a1e3['agents'][_0x568e2c['id']][_0xfcc8('0x46')]();return _0x4b9a2d({'code':0xc8,'message':_0x29a1e3[_0xfcc8('0x39')][_0x568e2c['id']]});}else{return _0x75091c(_0x2e78a4[_0xfcc8('0x2e')](0x1f4,_0xfcc8('0x47')));}});},'Agents':function(_0x3d4717){return new Promise(function(_0x4c92be){var _0x57a112=_[_0xfcc8('0x48')](_0x29a1e3[_0xfcc8('0x39')]);if(_0x3d4717&&_0x3d4717['id']){var _0x2a8b6f=_['find'](_0x57a112,function(_0x517a47){return _0x517a47['id']===_0x3d4717['id'];});_0x4c92be(_0x2a8b6f);}else{_0x4c92be({'count':_0x57a112[_0xfcc8('0x15')],'rows':_0x57a112});}});},'ChatQueues':function(){return new Promise(function(_0x3a7a82){var _0x66798b=[];for(var _0x9b3c6b in _0x29a1e3[_0xfcc8('0x49')]){if(_0x29a1e3[_0xfcc8('0x49')]['hasOwnProperty'](_0x9b3c6b)){var _0x183d71=_0x29a1e3[_0xfcc8('0x49')][_0x9b3c6b];var _0x49ad46={'id':_0x183d71['id'],'available':_0x183d71[_0xfcc8('0x4a')],'loggedIn':_0x183d71[_0xfcc8('0x4b')],'name':_0x183d71['name'],'paused':_0x183d71[_0xfcc8('0x4c')],'waiting':_0x183d71['waiting']};_0x66798b[_0xfcc8('0x1d')](_0x49ad46);}}_0x3a7a82({'count':_0x66798b[_0xfcc8('0x15')],'rows':_0x66798b});});},'MailQueues':function(){return new Promise(function(_0x368bcc){var _0x56fcac=[];for(var _0x10af6a in _0x29a1e3['mailQueues']){if(_0x29a1e3[_0xfcc8('0x4d')][_0xfcc8('0x44')](_0x10af6a)){var _0x1e067a=_0x29a1e3[_0xfcc8('0x4d')][_0x10af6a];var _0x1d46f1={'id':_0x1e067a['id'],'available':_0x1e067a[_0xfcc8('0x4a')],'loggedIn':_0x1e067a[_0xfcc8('0x4b')],'name':_0x1e067a['name'],'paused':_0x1e067a['paused'],'waiting':_0x1e067a[_0xfcc8('0x4e')]};_0x56fcac[_0xfcc8('0x1d')](_0x1d46f1);}}_0x368bcc({'count':_0x56fcac[_0xfcc8('0x15')],'rows':_0x56fcac});});},'OpenchannelQueues':function(){return new Promise(function(_0x34a548){var _0x584e92=[];for(var _0x4ce3f1 in _0x29a1e3[_0xfcc8('0x4f')]){if(_0x29a1e3[_0xfcc8('0x4f')][_0xfcc8('0x44')](_0x4ce3f1)){var _0x2750b6=_0x29a1e3[_0xfcc8('0x4f')][_0x4ce3f1];var _0x2bac9c={'id':_0x2750b6['id'],'available':_0x2750b6['available'],'loggedIn':_0x2750b6['loggedIn'],'name':_0x2750b6[_0xfcc8('0x50')],'paused':_0x2750b6[_0xfcc8('0x4c')],'waiting':_0x2750b6['waiting']};_0x584e92[_0xfcc8('0x1d')](_0x2bac9c);}}_0x34a548({'count':_0x584e92[_0xfcc8('0x15')],'rows':_0x584e92});});},'SmsQueues':function(){return new Promise(function(_0x8f015f){var _0x2f146a=[];for(var _0x55dcca in _0x29a1e3[_0xfcc8('0x51')]){if(_0x29a1e3['smsQueues']['hasOwnProperty'](_0x55dcca)){var _0x403f07=_0x29a1e3[_0xfcc8('0x51')][_0x55dcca];var _0x1a5462={'id':_0x403f07['id'],'available':_0x403f07['available'],'loggedIn':_0x403f07['loggedIn'],'name':_0x403f07[_0xfcc8('0x50')],'paused':_0x403f07['paused'],'waiting':_0x403f07[_0xfcc8('0x4e')]};_0x2f146a[_0xfcc8('0x1d')](_0x1a5462);}}_0x8f015f({'count':_0x2f146a[_0xfcc8('0x15')],'rows':_0x2f146a});});},'FaxQueues':function(){return new Promise(function(_0x211029){var _0x48b4a4=[];for(var _0x186db3 in _0x29a1e3[_0xfcc8('0x52')]){if(_0x29a1e3[_0xfcc8('0x52')][_0xfcc8('0x44')](_0x186db3)){var _0x1c914e=_0x29a1e3[_0xfcc8('0x52')][_0x186db3];var _0x2e9d02={'id':_0x1c914e['id'],'available':_0x1c914e[_0xfcc8('0x4a')],'loggedIn':_0x1c914e[_0xfcc8('0x4b')],'name':_0x1c914e[_0xfcc8('0x50')],'paused':_0x1c914e['paused'],'waiting':_0x1c914e[_0xfcc8('0x4e')]};_0x48b4a4[_0xfcc8('0x1d')](_0x2e9d02);}}_0x211029({'count':_0x48b4a4[_0xfcc8('0x15')],'rows':_0x48b4a4});});},'WhatsappQueues':function(){return new Promise(function(_0x4694d0){var _0xed26d6=[];for(var _0x1b5c37 in _0x29a1e3[_0xfcc8('0x53')]){if(_0x29a1e3[_0xfcc8('0x53')][_0xfcc8('0x44')](_0x1b5c37)){var _0x1ad34=_0x29a1e3[_0xfcc8('0x53')][_0x1b5c37];var _0x528353={'id':_0x1ad34['id'],'available':_0x1ad34['available'],'loggedIn':_0x1ad34['loggedIn'],'name':_0x1ad34[_0xfcc8('0x50')],'paused':_0x1ad34['paused'],'waiting':_0x1ad34[_0xfcc8('0x4e')]};_0xed26d6[_0xfcc8('0x1d')](_0x528353);}}_0x4694d0({'count':_0xed26d6['length'],'rows':_0xed26d6});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x4ce879){var _0x1c13d7=_['values'](_0x29a1e3['chatQueuesWaitingInteractions']);_0x4ce879({'count':_0x1c13d7[_0xfcc8('0x15')],'rows':_0x1c13d7});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1ebe2e){var _0xa7c7d=_[_0xfcc8('0x48')](_0x29a1e3['mailQueuesWaitingInteractions']);_0x1ebe2e({'count':_0xa7c7d[_0xfcc8('0x15')],'rows':_0xa7c7d});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x5267a6){var _0x4ed833=_[_0xfcc8('0x48')](_0x29a1e3[_0xfcc8('0x54')]);_0x5267a6({'count':_0x4ed833[_0xfcc8('0x15')],'rows':_0x4ed833});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x45228d){var _0x22da97=_['values'](_0x29a1e3[_0xfcc8('0x55')]);_0x45228d({'count':_0x22da97[_0xfcc8('0x15')],'rows':_0x22da97});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3b6541){var _0x5808d7=_['values'](_0x29a1e3['faxQueuesWaitingInteractions']);_0x3b6541({'count':_0x5808d7[_0xfcc8('0x15')],'rows':_0x5808d7});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x397377){var _0x4dd499=_[_0xfcc8('0x48')](_0x29a1e3[_0xfcc8('0x56')]);_0x397377({'count':_0x4dd499[_0xfcc8('0x15')],'rows':_0x4dd499});});}};var _0x26f427=jayson[_0xfcc8('0x57')](_0x1383b5)[_0xfcc8('0x58')]();_0x26f427['on']('error',function(_0x1f286b){logger['error'](JSON[_0xfcc8('0x59')](_0x1f286b));return _0x25f611(_0x1f286b);});_0x26f427[_0xfcc8('0x5a')](0x232c,_0xfcc8('0x5b'),function(){console['log'](_0xfcc8('0x5c'),0x232c);return _0x302b18('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x9906=['../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','channel','push','slice','dialogflow','appdata','split','dialogflowv2','amazonlex','tag','TagId','tvox','notificationTemplate','ContactId','body','%s:%s:%s','condition','consequence','info','Push\x20new\x20rule','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','agent','agents','busy','busyQueue','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','name','paused','waiting','mailQueues','available','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','stringify','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','bluebird','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport'];(function(_0x3a5664,_0x4692f5){var _0x5d13a6=function(_0x344cc9){while(--_0x344cc9){_0x3a5664['push'](_0x3a5664['shift']());}};_0x5d13a6(++_0x4692f5);}(_0x9906,0x1f1));var _0x6990=function(_0x4059d9,_0x4cf793){_0x4059d9=_0x4059d9-0x0;var _0x3d6d98=_0x9906[_0x4059d9];return _0x3d6d98;};'use strict';var _=require(_0x6990('0x0'));var util=require(_0x6990('0x1'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x6990('0x2'));var utils=require(_0x6990('0x3'));var sUtils=require('./applications/strategy/util');var logger=require(_0x6990('0x4'))(_0x6990('0x5'));var rpc={'openchannelQueueReport':require(_0x6990('0x6')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x6990('0x7')),'smsQueueReport':require(_0x6990('0x8')),'faxQueueReport':require(_0x6990('0x9')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x6990('0xa'));function getId(_0x69a395,_0x51050e,_0x251292){return util[_0x6990('0xb')](_0x6990('0xc'),_0x69a395,_0x51050e||0x0,_0x251292||0x0);}function getIntervals(_0x58583a,_0x2681cf){var _0x51b028=[];if(!_[_0x6990('0xd')](_0x2681cf['IntervalId'])&&!_[_0x6990('0xd')](_0x58583a[_0x2681cf[_0x6990('0xe')]])&&!_[_0x6990('0xd')](_0x58583a[_0x2681cf[_0x6990('0xe')]][_0x6990('0xf')])){_0x51b028=_[_0x6990('0x10')](_0x58583a[_0x2681cf[_0x6990('0xe')]][_0x6990('0xf')],_0x6990('0x11'));}else if(!_[_0x6990('0xd')](_0x2681cf[_0x6990('0x11')])){_0x51b028=[_0x2681cf['interval']];}return _0x51b028;}exports[_0x6990('0x12')]=function(_0x312b34){_0x312b34[_0x6990('0x13')]={};return new BPromise(function(_0x57178c,_0x3bfc4e){var _0x19013a={'Start':function(_0x37cb1f){var _0xc29df2=this;return new Promise(function(_0xfd415b,_0x351c80){if(_0x37cb1f){try{var _0x68b7c0=[];var _0x5bb59b=getId(_0x37cb1f['channel'],_0x37cb1f[_0x6990('0x14')]?_0x37cb1f[_0x6990('0x14')]['id']:0x0,_0x37cb1f[_0x6990('0x15')]?_0x37cb1f[_0x6990('0x15')]['id']:0x0);var _0x453b7e=sUtils[_0x6990('0x16')](_0x312b34,_0x37cb1f);if(_0x37cb1f[_0x6990('0x17')]||!_0x453b7e&&_0x37cb1f[_0x6990('0x18')]&&_[_0x6990('0x19')](_0x37cb1f['applications'])&&_0x37cb1f[_0x6990('0x18')][_0x6990('0x1a')]){for(var _0x57c9ad=0x0;_0x57c9ad<_0x37cb1f['applications'][_0x6990('0x1a')];_0x57c9ad+=0x1){var _0x1b562a=_0x37cb1f['applications'][_0x57c9ad];if(fs[_0x6990('0x1b')](path[_0x6990('0x1c')](__dirname,_0x6990('0x18'),_0x1b562a[_0x6990('0x1d')]+'.js'))){var _0x176388=[];switch(_0x1b562a[_0x6990('0x1d')][_0x6990('0x1e')]()){case _0x6990('0x1f'):var _0xac87a6=_0x1b562a['appdata']['split'](',');if(_0x37cb1f[_0x6990('0x20')]==='mail'){_0x176388[_0x6990('0x21')](_0xac87a6[0x0]);_0x176388[_0x6990('0x21')](_0xac87a6[0x1]);_0x176388['push'](_0xac87a6[_0x6990('0x22')](0x2,_0xac87a6[_0x6990('0x1a')])[_0x6990('0x1c')](','));}else{_0x176388[_0x6990('0x21')](_0xac87a6[0x0]);_0x176388[_0x6990('0x21')](_0xac87a6[_0x6990('0x22')](0x1,_0xac87a6[_0x6990('0x1a')])[_0x6990('0x1c')](','));}break;case _0x6990('0x23'):var _0x1eb169=_0x1b562a[_0x6990('0x24')][_0x6990('0x25')](',');_0x176388[_0x6990('0x21')](_0x1eb169[0x0]);_0x176388[_0x6990('0x21')](_0x1eb169[0x1]);_0x176388[_0x6990('0x21')](_0x1eb169[_0x6990('0x22')](0x2,_0x1eb169[_0x6990('0x1a')])[_0x6990('0x1c')](','));break;case _0x6990('0x26'):var _0x21d998=_0x1b562a[_0x6990('0x24')][_0x6990('0x25')](',');_0x176388['push'](_0x21d998[0x0]);_0x176388['push'](_0x21d998[0x1]);_0x176388[_0x6990('0x21')](_0x21d998[0x2]);_0x176388[_0x6990('0x21')](_0x21d998[0x3]);_0x176388[_0x6990('0x21')](_0x21d998[_0x6990('0x22')](0x4,_0x21d998[_0x6990('0x1a')])[_0x6990('0x1c')](','));break;case _0x6990('0x27'):var _0xee676c=_0x1b562a[_0x6990('0x24')][_0x6990('0x25')](',');_0x176388[_0x6990('0x21')](_0xee676c[0x0]);_0x176388[_0x6990('0x21')](_0xee676c[0x1]);_0x176388['push'](_0xee676c[0x2]);_0x176388['push'](_0xee676c[0x3]);_0x176388['push'](_0xee676c['slice'](0x4,_0xee676c[_0x6990('0x1a')])[_0x6990('0x1c')](','));break;case'message':_0x176388[_0x6990('0x21')](_0x1b562a['appdata']);break;case _0x6990('0x28'):_0x176388['push'](_0x1b562a[_0x6990('0x29')]);_0x176388[_0x6990('0x21')](_0x1b562a[_0x6990('0x24')]);break;case _0x6990('0x2a'):var _0x7c87b1=utils['getMustacheRender'](_0x37cb1f['account'][_0x6990('0x2b')],_0x37cb1f);var _0x42ac82=_0x1b562a[_0x6990('0x24')]['split'](',');_0x176388['push'](_0x42ac82[0x0]);_0x176388['push'](_0x42ac82[0x1]);_0x176388[_0x6990('0x21')](_0x42ac82[0x2]);_0x176388['push'](_0x42ac82[0x3]);_0x176388[_0x6990('0x21')](_0x42ac82[0x4]);_0x176388[_0x6990('0x21')](_0x42ac82[0x5]);_0x176388['push'](_0x42ac82[0x6]);_0x176388[_0x6990('0x21')](_0x42ac82[0x7]);_0x176388[_0x6990('0x21')](_0x42ac82[0x8]);_0x176388[_0x6990('0x21')](_0x42ac82[0x9]);_0x176388[_0x6990('0x21')](_0x42ac82[0xa]);_0x176388[_0x6990('0x21')](_0x37cb1f[_0x6990('0x15')]['id']);_0x176388[_0x6990('0x21')](_0x37cb1f[_0x6990('0x14')]['id']);_0x176388['push'](_0x1b562a['ChatWebsiteId']);_0x176388[_0x6990('0x21')](_0x37cb1f[_0x6990('0x15')][_0x6990('0x2c')]);_0x176388[_0x6990('0x21')](_0x37cb1f[_0x6990('0x2d')][_0x6990('0x2d')]);_0x176388[_0x6990('0x21')](_0x7c87b1);break;default:_0x176388=_[_0x6990('0xd')](_0x1b562a[_0x6990('0x24')])?[]:_0x1b562a['appdata'][_0x6990('0x25')](',');}var _0x19d8b5={'id':util[_0x6990('0xb')](_0x6990('0x2e'),_0x5bb59b,_0x1b562a['id'],_0x1b562a['app']),'condition':require('./interval')[_0x6990('0x2f')](_0x5bb59b,getIntervals(_0x312b34['intervals'],_0x1b562a),_0x312b34),'consequence':require('./applications/'+_0x1b562a[_0x6990('0x1d')])[_0x6990('0x30')](_0x5bb59b,_0x176388,_0x312b34,_0x37cb1f),'p':_0x1b562a['priority']||0x0};logger[_0x6990('0x31')](_0x6990('0x32'),_0x19d8b5['id'],'on\x20interval',getIntervals(_0x312b34[_0x6990('0x33')],_0x1b562a)[_0x6990('0x1c')](_0x6990('0x34')));_0x68b7c0[_0x6990('0x21')](_0x19d8b5);}else{logger[_0x6990('0x35')](_0x6990('0x36'),path[_0x6990('0x1c')](__dirname,_0x6990('0x18'),_0x1b562a[_0x6990('0x1d')]+_0x6990('0x37')));}}_0x312b34[_0x6990('0x13')][_0x5bb59b]=new RuleEngine(_0x68b7c0);_0x312b34[_0x6990('0x13')][_0x5bb59b][_0x6990('0x38')](_0x37cb1f,function(_0x58f647){logger[_0x6990('0x31')](_0x6990('0x39'),JSON['stringify'](_0x58f647[_0x6990('0x3a')]));if(_0x312b34[_0x6990('0x13')][_0x5bb59b]){_0x312b34['rules'][_0x5bb59b][_0x6990('0x3b')](_0x6990('0x3c'));}});return _0xfd415b({'code':0xc8,'message':_0x37cb1f});}else{if(_0x453b7e){logger[_0x6990('0x31')](util[_0x6990('0xb')](_0x6990('0x3d'),_0x5bb59b));}else{logger[_0x6990('0x31')](_0x6990('0x3e'));}return _0xfd415b({'code':0xc8,'message':_0x37cb1f});}}catch(_0x3c443b){logger[_0x6990('0x35')](_0x3c443b[_0x6990('0x3f')]);return _0x351c80(_0xc29df2[_0x6990('0x35')](0x1f4,_0x3c443b));}}return _0x351c80('routing\x20is\x20empty');});},'AcceptMessage':function(_0x4c01d4){var _0x174871=this;return new Promise(function(_0x46a327,_0x5730c6){if(_0x4c01d4[_0x6990('0x40')]&&_0x4c01d4[_0x6990('0x40')]['id']){if(_0x312b34[_0x6990('0x41')][_0x4c01d4[_0x6990('0x40')]['id']]){_0x312b34['agents'][_0x4c01d4['agent']['id']][_0x6990('0x42')]=![];_0x312b34[_0x6990('0x41')][_0x4c01d4[_0x6990('0x40')]['id']][_0x6990('0x43')]=undefined;}}if(_0x4c01d4[_0x6990('0x14')]&&_0x4c01d4['message']['id']){try{var _0x3d028c=getId(_0x4c01d4['channel'],_0x4c01d4[_0x6990('0x14')]?_0x4c01d4['message']['id']:0x0,_0x4c01d4[_0x6990('0x15')]?_0x4c01d4[_0x6990('0x15')]['id']:0x0);if(_0x312b34['rules'][_0x3d028c]){_0x312b34['rules'][_0x3d028c][_0x6990('0x3b')]('end');if(rpc[_0x4c01d4[_0x6990('0x20')]+'QueueReport']){rpc[_0x4c01d4[_0x6990('0x20')]+_0x6990('0x44')][_0x6990('0x45')](_0x3d028c,{'UserId':_0x4c01d4[_0x6990('0x14')][_0x6990('0x46')]})[_0x6990('0x47')](function(){logger['error'](_0x6990('0x48'));});}}return _0x46a327({'code':0xc8,'message':_0x4c01d4});}catch(_0x525df4){logger[_0x6990('0x35')](_0x525df4[_0x6990('0x3f')]);return _0x5730c6(_0x174871['error'](0x1f4,_0x525df4));}}logger['error'](_0x6990('0x49'));return _0x5730c6(_0x174871[_0x6990('0x35')](0x1f4,_0x6990('0x49')));});},'RejectMessage':function(_0x50f01d){var _0x49ad22=this;return new Promise(function(_0xd45798,_0x1f20a5){if(_0x50f01d['agent']&&_0x50f01d[_0x6990('0x40')]['id']){try{if(_0x312b34[_0x6990('0x41')][_0x50f01d[_0x6990('0x40')]['id']]){_0x312b34[_0x6990('0x41')][_0x50f01d[_0x6990('0x40')]['id']]['busy']=![];_0x312b34[_0x6990('0x41')][_0x50f01d[_0x6990('0x40')]['id']]['busyQueue']=undefined;}return _0xd45798({'code':0xc8,'message':_0x50f01d});}catch(_0x49ff14){logger[_0x6990('0x35')](_0x49ff14[_0x6990('0x3f')]);return _0x1f20a5(_0x49ad22[_0x6990('0x35')](0x1f4,_0x49ff14));}}logger[_0x6990('0x35')]('message\x20is\x20empty');return _0x1f20a5(_0x49ad22[_0x6990('0x35')](0x1f4,_0x6990('0x49')));});},'AbandonInteraction':function(_0x3c9a74){var _0x14e34d=this;return new Promise(function(_0x411137,_0x51a8fb){if(_0x3c9a74[_0x6990('0x20')]&&_0x3c9a74[_0x6990('0x15')]&&_0x3c9a74['interaction']['id']){try{var _0x1dd41d=getId(_0x3c9a74[_0x6990('0x20')],_0x3c9a74[_0x6990('0x14')]?_0x3c9a74['message']['id']:0x0,_0x3c9a74['interaction']?_0x3c9a74[_0x6990('0x15')]['id']:0x0);if(_0x312b34[_0x6990('0x13')][_0x1dd41d]){_0x312b34[_0x6990('0x13')][_0x1dd41d]['emit'](_0x6990('0x4a'));}return _0x411137({'code':0xc8,'message':_0x3c9a74});}catch(_0x21e8d6){logger[_0x6990('0x35')](_0x21e8d6['stack']);return _0x51a8fb(_0x14e34d['error'](0x1f4,_0x21e8d6));}}logger['error'](_0x6990('0x49'));return _0x51a8fb(_0x14e34d[_0x6990('0x35')](0x1f4,_0x6990('0x49')));});},'AgentCapacity':function(_0xaef210){var _0x4824b3=this;return new Promise(function(_0x520a1a,_0x50b386){if(_0x312b34[_0x6990('0x41')][_0x6990('0x4b')](_0xaef210['id'])){for(var _0x561c01 in _0xaef210[_0x6990('0x4c')]){if(_0xaef210[_0x6990('0x4c')][_0x6990('0x4b')](_0x561c01)){if(_0x312b34['agents'][_0xaef210['id']]['hasOwnProperty'](_0x561c01+'CurrentCapacity')){_0x312b34[_0x6990('0x41')][_0xaef210['id']][_0x561c01+_0x6990('0x4d')]=parseInt(_0xaef210['capacity'][_0x561c01],0xa);}}}_0x312b34['agents'][_0xaef210['id']][_0x6990('0x4e')]();return _0x520a1a({'code':0xc8,'message':_0x312b34[_0x6990('0x41')][_0xaef210['id']]});}else{return _0x50b386(_0x4824b3[_0x6990('0x35')](0x1f4,_0x6990('0x4f')));}});},'Agents':function(_0x332141){return new Promise(function(_0x5b7b31){var _0x1bcf36=_[_0x6990('0x50')](_0x312b34[_0x6990('0x41')]);if(_0x332141&&_0x332141['id']){var _0x2355d0=_['find'](_0x1bcf36,function(_0x450f1b){return _0x450f1b['id']===_0x332141['id'];});_0x5b7b31(_0x2355d0);}else{_0x5b7b31({'count':_0x1bcf36[_0x6990('0x1a')],'rows':_0x1bcf36});}});},'ChatQueues':function(){return new Promise(function(_0x58e5f5){var _0x50fb9e=[];for(var _0x217967 in _0x312b34[_0x6990('0x51')]){if(_0x312b34['chatQueues'][_0x6990('0x4b')](_0x217967)){var _0x31fffa=_0x312b34[_0x6990('0x51')][_0x217967];var _0x15b59d={'id':_0x31fffa['id'],'available':_0x31fffa['available'],'loggedIn':_0x31fffa['loggedIn'],'name':_0x31fffa[_0x6990('0x52')],'paused':_0x31fffa[_0x6990('0x53')],'waiting':_0x31fffa[_0x6990('0x54')]};_0x50fb9e[_0x6990('0x21')](_0x15b59d);}}_0x58e5f5({'count':_0x50fb9e['length'],'rows':_0x50fb9e});});},'MailQueues':function(){return new Promise(function(_0x380eeb){var _0x36eea3=[];for(var _0x4710b8 in _0x312b34[_0x6990('0x55')]){if(_0x312b34[_0x6990('0x55')]['hasOwnProperty'](_0x4710b8)){var _0x15c35e=_0x312b34[_0x6990('0x55')][_0x4710b8];var _0x22b4f9={'id':_0x15c35e['id'],'available':_0x15c35e[_0x6990('0x56')],'loggedIn':_0x15c35e[_0x6990('0x57')],'name':_0x15c35e['name'],'paused':_0x15c35e['paused'],'waiting':_0x15c35e[_0x6990('0x54')]};_0x36eea3[_0x6990('0x21')](_0x22b4f9);}}_0x380eeb({'count':_0x36eea3[_0x6990('0x1a')],'rows':_0x36eea3});});},'OpenchannelQueues':function(){return new Promise(function(_0x324aa8){var _0x3c5732=[];for(var _0x354d08 in _0x312b34[_0x6990('0x58')]){if(_0x312b34[_0x6990('0x58')][_0x6990('0x4b')](_0x354d08)){var _0x334d24=_0x312b34[_0x6990('0x58')][_0x354d08];var _0x2bacd5={'id':_0x334d24['id'],'available':_0x334d24[_0x6990('0x56')],'loggedIn':_0x334d24['loggedIn'],'name':_0x334d24['name'],'paused':_0x334d24[_0x6990('0x53')],'waiting':_0x334d24[_0x6990('0x54')]};_0x3c5732[_0x6990('0x21')](_0x2bacd5);}}_0x324aa8({'count':_0x3c5732[_0x6990('0x1a')],'rows':_0x3c5732});});},'SmsQueues':function(){return new Promise(function(_0x30ab45){var _0x17530c=[];for(var _0x11faac in _0x312b34[_0x6990('0x59')]){if(_0x312b34[_0x6990('0x59')][_0x6990('0x4b')](_0x11faac)){var _0x5f411e=_0x312b34['smsQueues'][_0x11faac];var _0x291f68={'id':_0x5f411e['id'],'available':_0x5f411e[_0x6990('0x56')],'loggedIn':_0x5f411e[_0x6990('0x57')],'name':_0x5f411e['name'],'paused':_0x5f411e['paused'],'waiting':_0x5f411e[_0x6990('0x54')]};_0x17530c['push'](_0x291f68);}}_0x30ab45({'count':_0x17530c[_0x6990('0x1a')],'rows':_0x17530c});});},'FaxQueues':function(){return new Promise(function(_0x3e858f){var _0x6a172d=[];for(var _0x502dce in _0x312b34[_0x6990('0x5a')]){if(_0x312b34[_0x6990('0x5a')]['hasOwnProperty'](_0x502dce)){var _0x3bd05a=_0x312b34[_0x6990('0x5a')][_0x502dce];var _0x5e547b={'id':_0x3bd05a['id'],'available':_0x3bd05a['available'],'loggedIn':_0x3bd05a[_0x6990('0x57')],'name':_0x3bd05a['name'],'paused':_0x3bd05a[_0x6990('0x53')],'waiting':_0x3bd05a['waiting']};_0x6a172d[_0x6990('0x21')](_0x5e547b);}}_0x3e858f({'count':_0x6a172d[_0x6990('0x1a')],'rows':_0x6a172d});});},'WhatsappQueues':function(){return new Promise(function(_0xb59438){var _0x2e6899=[];for(var _0x506fa5 in _0x312b34[_0x6990('0x5b')]){if(_0x312b34[_0x6990('0x5b')][_0x6990('0x4b')](_0x506fa5)){var _0x1b36ab=_0x312b34[_0x6990('0x5b')][_0x506fa5];var _0x162464={'id':_0x1b36ab['id'],'available':_0x1b36ab[_0x6990('0x56')],'loggedIn':_0x1b36ab[_0x6990('0x57')],'name':_0x1b36ab[_0x6990('0x52')],'paused':_0x1b36ab[_0x6990('0x53')],'waiting':_0x1b36ab['waiting']};_0x2e6899[_0x6990('0x21')](_0x162464);}}_0xb59438({'count':_0x2e6899[_0x6990('0x1a')],'rows':_0x2e6899});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x1657ef){var _0x2de4c1=_[_0x6990('0x50')](_0x312b34[_0x6990('0x5c')]);_0x1657ef({'count':_0x2de4c1[_0x6990('0x1a')],'rows':_0x2de4c1});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x283cab){var _0x5ca1c3=_[_0x6990('0x50')](_0x312b34['mailQueuesWaitingInteractions']);_0x283cab({'count':_0x5ca1c3[_0x6990('0x1a')],'rows':_0x5ca1c3});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x2730df){var _0x14ee1b=_[_0x6990('0x50')](_0x312b34[_0x6990('0x5d')]);_0x2730df({'count':_0x14ee1b[_0x6990('0x1a')],'rows':_0x14ee1b});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x5211a1){var _0xec4f78=_[_0x6990('0x50')](_0x312b34[_0x6990('0x5e')]);_0x5211a1({'count':_0xec4f78[_0x6990('0x1a')],'rows':_0xec4f78});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x160add){var _0x4c4662=_[_0x6990('0x50')](_0x312b34['faxQueuesWaitingInteractions']);_0x160add({'count':_0x4c4662[_0x6990('0x1a')],'rows':_0x4c4662});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0xa71c2e){var _0x21a2b6=_[_0x6990('0x50')](_0x312b34[_0x6990('0x5f')]);_0xa71c2e({'count':_0x21a2b6[_0x6990('0x1a')],'rows':_0x21a2b6});});}};var _0x20785d=jayson[_0x6990('0x60')](_0x19013a)['http']();_0x20785d['on'](_0x6990('0x35'),function(_0x2b65ed){logger[_0x6990('0x35')](JSON[_0x6990('0x61')](_0x2b65ed));return _0x3bfc4e(_0x2b65ed);});_0x20785d['listen'](0x232c,_0x6990('0x62'),function(){console[_0x6990('0x63')](_0x6990('0x64'),0x232c);return _0x57178c('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index bca0381..f91638e 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 _0xfc0a=['push','Command','format','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','error','stack','util','bluebird','jayson/promise','../../../config/logger','routing','client','http','request','then','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0xfc0a,0x1b2));var _0xafc0=function(_0x5159af,_0x32898b){_0x5159af=_0x5159af-0x0;var _0x324b8e=_0xfc0a[_0x5159af];return _0x324b8e;};'use strict';var util=require(_0xafc0('0x0'));var BPromise=require(_0xafc0('0x1'));var jayson=require(_0xafc0('0x2'));var _=require('lodash');var logger=require(_0xafc0('0x3'))(_0xafc0('0x4'));var client=jayson[_0xafc0('0x5')][_0xafc0('0x6')]({'port':0x232a});function request(_0x5064d8,_0x5cf57d){return new BPromise(function(_0x582e25,_0x4777f2){return client[_0xafc0('0x7')](_0x5064d8,_0x5cf57d)[_0xafc0('0x8')](function(_0x4902f5){if(_0x4902f5['error']){return _0x4777f2(_0x4902f5['error'][_0xafc0('0x9')]);}else{return _0x582e25(_0x4902f5['result']);}})[_0xafc0('0xa')](function(_0x411541){return _0x4777f2(_0x411541);});});}exports[_0xafc0('0xb')]=function(_0xfd5508,_0x28cf95,_0x2c3582){return function(_0x453b69){if(_0x2c3582[_0xafc0('0xc')]&&!_0x2c3582['rules'][_0xfd5508]){logger[_0xafc0('0xd')](_0xafc0('0xe'),_0xfd5508);return _0x453b69[_0xafc0('0xf')]();}var _0x47d08d=[];for(var _0x192d67=0x0;_0x192d67<_0x28cf95['length'];_0x192d67+=0x1){_0x47d08d[_0xafc0('0x10')](request(_0xafc0('0x11'),{'command':util[_0xafc0('0x12')]('iftime\x20%s',_0x28cf95[_0x192d67])})[_0xafc0('0x8')](function(_0x1243b2){return _0x1243b2&&_0x1243b2[_0xafc0('0x9')]&&_0x1243b2[_0xafc0('0x9')][_0xafc0('0x13')](_0xafc0('0x14'))>=0x0?!![]:![];})[_0xafc0('0xa')](function(){logger['error'](_0xafc0('0x15'),_0xfd5508,_0x28cf95[_0x192d67]);}));}BPromise[_0xafc0('0x16')](_0x47d08d)[_0xafc0('0x8')](function(_0xe5b234){var _0xa5fbdd=_[_0xafc0('0x17')](_0xe5b234);logger['info'](_0xafc0('0x18'),_0xfd5508,_0x28cf95[_0xafc0('0x19')](_0xafc0('0x1a')),_0xa5fbdd);_0x453b69[_0xafc0('0x1b')](_0xa5fbdd);})[_0xafc0('0xa')](function(_0x26f44d){logger[_0xafc0('0x1c')](_0xafc0('0x18'),_0xfd5508,_0x28cf95[_0xafc0('0x19')](_0xafc0('0x1a')),_0x26f44d[_0xafc0('0x1d')]);_0x453b69[_0xafc0('0xf')]();});};}; \ No newline at end of file +var _0x4a46=['message','indexOf','true','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','util','bluebird','jayson/promise','../../../config/logger','client','request','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s'];(function(_0x5af328,_0x2292fc){var _0x404f2a=function(_0x36d205){while(--_0x36d205){_0x5af328['push'](_0x5af328['shift']());}};_0x404f2a(++_0x2292fc);}(_0x4a46,0xc5));var _0x64a4=function(_0x60935a,_0x997c0){_0x60935a=_0x60935a-0x0;var _0x172482=_0x4a46[_0x60935a];return _0x172482;};'use strict';var util=require(_0x64a4('0x0'));var BPromise=require(_0x64a4('0x1'));var jayson=require(_0x64a4('0x2'));var _=require('lodash');var logger=require(_0x64a4('0x3'))('routing');var client=jayson[_0x64a4('0x4')]['http']({'port':0x232a});function request(_0x2b5115,_0x5b610a){return new BPromise(function(_0x3a8966,_0x3941d3){return client[_0x64a4('0x5')](_0x2b5115,_0x5b610a)[_0x64a4('0x6')](function(_0x18f346){if(_0x18f346['error']){return _0x3941d3(_0x18f346[_0x64a4('0x7')]['message']);}else{return _0x3a8966(_0x18f346[_0x64a4('0x8')]);}})[_0x64a4('0x9')](function(_0x5487d7){return _0x3941d3(_0x5487d7);});});}exports[_0x64a4('0xa')]=function(_0x34e946,_0x21b85b,_0x38c8b1){return function(_0x351ef7){if(_0x38c8b1[_0x64a4('0xb')]&&!_0x38c8b1['rules'][_0x34e946]){logger[_0x64a4('0xc')](_0x64a4('0xd'),_0x34e946);return _0x351ef7[_0x64a4('0xe')]();}var _0x3dfbd3=[];for(var _0x2aa810=0x0;_0x2aa810<_0x21b85b['length'];_0x2aa810+=0x1){_0x3dfbd3[_0x64a4('0xf')](request(_0x64a4('0x10'),{'command':util[_0x64a4('0x11')](_0x64a4('0x12'),_0x21b85b[_0x2aa810])})[_0x64a4('0x6')](function(_0x407986){return _0x407986&&_0x407986['message']&&_0x407986[_0x64a4('0x13')][_0x64a4('0x14')](_0x64a4('0x15'))>=0x0?!![]:![];})[_0x64a4('0x9')](function(){logger[_0x64a4('0x7')]('[%s][INTERVAL]\x20%s',_0x34e946,_0x21b85b[_0x2aa810]);}));}BPromise[_0x64a4('0x16')](_0x3dfbd3)['then'](function(_0x3b7403){var _0x90ceac=_[_0x64a4('0x17')](_0x3b7403);logger['info'](_0x64a4('0x18'),_0x34e946,_0x21b85b[_0x64a4('0x19')](_0x64a4('0x1a')),_0x90ceac);_0x351ef7['when'](_0x90ceac);})[_0x64a4('0x9')](function(_0x5e4dcf){logger[_0x64a4('0x7')](_0x64a4('0x18'),_0x34e946,_0x21b85b[_0x64a4('0x19')](_0x64a4('0x1a')),_0x5e4dcf['stack']);_0x351ef7['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 127908e..db76f26 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 _0xa75b=['agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfer','origtransfererexten','transfereeuniqueid','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','secondtransfererexten','transfertargetuniqueid','agententerreason','agentcalledAt','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','complete','lodash','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','debug','[%s][agents][agentcalled]','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','isNil','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime','talktime','error','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','abandoned','agentconnect','[%s][agents][agentconnect]'];(function(_0x7a21f3,_0x55befb){var _0x21e459=function(_0x2f137f){while(--_0x2f137f){_0x7a21f3['push'](_0x7a21f3['shift']());}};_0x21e459(++_0x55befb);}(_0xa75b,0x170));var _0xba75=function(_0x3c0316,_0x381c51){_0x3c0316=_0x3c0316-0x0;var _0x23df99=_0xa75b[_0x3c0316];return _0x23df99;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x10c0dd,_0x39dc19){utils[_0xba75('0x1')](util[_0xba75('0x2')](_0xba75('0x3'),_0x10c0dd[_0xba75('0x4')],_0x10c0dd[_0xba75('0x5')],_0x10c0dd[_0xba75('0x6')],_0x10c0dd[_0xba75('0x7')],_0x10c0dd[_0xba75('0x8')],_0x10c0dd[_0xba75('0x9')],_0x10c0dd[_0xba75('0xa')],_0x10c0dd[_0xba75('0xb')]));if(_0x10c0dd['queue']){utils['getVoiceQueueByName'](_0x10c0dd[_0xba75('0x6')])['then'](function(_0x5c5fd7){if(_0x5c5fd7){_0x10c0dd[_0xba75('0xc')]=_0x5c5fd7['type'];_0x10c0dd[_0xba75('0xd')]=_0x10c0dd[_0xba75('0xe')]?_0x5c5fd7[_0xba75('0xf')]:![];_0x10c0dd[_0xba75('0x10')]=_0x10c0dd[_0xba75('0xd')]?_0x5c5fd7[_0xba75('0x11')]:0x0;}utils[_0xba75('0x12')](_0xba75('0x13'),_0x10c0dd);});}else{utils[_0xba75('0x12')](_0xba75('0x13'),_0x10c0dd);}if(_0x39dc19){delete transfers[_0x10c0dd[_0xba75('0x4')]];}else{delete agents[_0x10c0dd[_0xba75('0x14')]];}}exports['agentcalled']=function(_0x55553a){try{utils[_0xba75('0x15')](util['format'](_0xba75('0x16'),_0x55553a[_0xba75('0x4')]),_0x55553a);agents[_0x55553a[_0xba75('0x14')]]=_0x55553a;agents[_0x55553a[_0xba75('0x14')]]['agentcalledAt']=utils[_0xba75('0x17')]();agents[_0x55553a[_0xba75('0x14')]][_0xba75('0xb')]=_0xba75('0x18');agents[_0x55553a[_0xba75('0x14')]]['connectedlinenum']=null;agents[_0x55553a[_0xba75('0x14')]][_0xba75('0x19')]=null;utils[_0xba75('0x1')](util['format'](_0xba75('0x1a'),_0x55553a[_0xba75('0x4')],agents[_0x55553a[_0xba75('0x14')]][_0xba75('0x7')],_0x55553a[_0xba75('0x14')]));}catch(_0x1d1c44){utils['error'](util[_0xba75('0x2')](_0xba75('0x16'),_0x55553a['uniqueid']),_0x1d1c44);}};exports['agentringnoanswer']=function(_0x35ffd2){try{if(!_[_0xba75('0x1b')](agents[_0x35ffd2['destuniqueid']])){utils['debug'](util[_0xba75('0x2')]('[%s][agents][agentringnoanswer]',_0x35ffd2[_0xba75('0x4')]),_0x35ffd2);utils[_0xba75('0x1')](util[_0xba75('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x35ffd2[_0xba75('0x4')],agents[_0x35ffd2[_0xba75('0x14')]][_0xba75('0x7')],_0x35ffd2[_0xba75('0x14')]));agents[_0x35ffd2[_0xba75('0x14')]][_0xba75('0x1c')]=!![];agents[_0x35ffd2['destuniqueid']][_0xba75('0x1d')]=utils[_0xba75('0x17')]();agents[_0x35ffd2[_0xba75('0x14')]][_0xba75('0xb')]=_0xba75('0x1e');agents[_0x35ffd2[_0xba75('0x14')]][_0xba75('0x1f')]=_0xba75('0x1e');agents[_0x35ffd2[_0xba75('0x14')]][_0xba75('0x20')]=_0x35ffd2['ringtime']?parseInt(_0x35ffd2['ringtime'])/0x3e8:0x0;agents[_0x35ffd2['destuniqueid']][_0xba75('0x21')]=0x0;unanswered['push'](_0x35ffd2[_0xba75('0x14')]);}}catch(_0x58ea2d){utils[_0xba75('0x22')](util[_0xba75('0x2')](_0xba75('0x23'),_0x35ffd2['uniqueid']),_0x58ea2d);}};exports[_0xba75('0x24')]=function(_0x62cf49){try{_[_0xba75('0x25')](agents,function(_0x2808f0,_0x5d9f78){if(_0x2808f0['uniqueid']==_0x62cf49[_0xba75('0x4')]&&!_['includes'](unanswered,_0x2808f0[_0xba75('0x14')])){utils[_0xba75('0x15')](util[_0xba75('0x2')](_0xba75('0x26'),_0x62cf49['uniqueid']),_0x62cf49);utils[_0xba75('0x1')](util[_0xba75('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x62cf49[_0xba75('0x4')],_0x2808f0[_0xba75('0x7')],_0x2808f0[_0xba75('0x14')]));_0x2808f0[_0xba75('0x1c')]=!![];_0x2808f0['agentringnoanswerAt']=utils[_0xba75('0x17')]();_0x2808f0[_0xba75('0xb')]='abandoned';_0x2808f0[_0xba75('0x1f')]=_0xba75('0x27');_0x2808f0[_0xba75('0x20')]=_0x62cf49['holdtime'];_0x2808f0[_0xba75('0x21')]=0x0;writeDB(_0x2808f0);}});}catch(_0x282f98){utils[_0xba75('0x22')](util[_0xba75('0x2')](_0xba75('0x26'),_0x62cf49[_0xba75('0x4')]),_0x282f98);}};exports[_0xba75('0x28')]=function(_0x4c9fb2){try{if(agents[_0x4c9fb2['destuniqueid']]){utils[_0xba75('0x15')](util[_0xba75('0x2')](_0xba75('0x29'),_0x4c9fb2['uniqueid']),_0x4c9fb2);utils[_0xba75('0x1')](util[_0xba75('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x4c9fb2['uniqueid'],agents[_0x4c9fb2[_0xba75('0x14')]][_0xba75('0x7')],_0x4c9fb2[_0xba75('0x14')]));agents[_0x4c9fb2[_0xba75('0x14')]][_0xba75('0x2a')]=utils['now']();agents[_0x4c9fb2['destuniqueid']][_0xba75('0xa')]=_0x4c9fb2[_0xba75('0xa')];agents[_0x4c9fb2[_0xba75('0x14')]][_0xba75('0x19')]=_0x4c9fb2[_0xba75('0x19')];agents[_0x4c9fb2[_0xba75('0x14')]][_0xba75('0x20')]=_0x4c9fb2['ringtime'];agents[_0x4c9fb2[_0xba75('0x14')]][_0xba75('0xb')]='connect';_[_0xba75('0x25')](agents,function(_0x3740bd,_0x2d56c0){if(_0x3740bd[_0xba75('0x14')]!=_0x4c9fb2[_0xba75('0x14')]&&_0x3740bd[_0xba75('0x4')]==_0x4c9fb2[_0xba75('0x4')]){_0x3740bd['talktime']=0x0;_0x3740bd[_0xba75('0x20')]=_0x4c9fb2['ringtime'];_0x3740bd[_0xba75('0x1c')]=!![];_0x3740bd['agentringnoanswerAt']=utils[_0xba75('0x17')]();_0x3740bd[_0xba75('0xb')]=_0xba75('0x2b');_0x3740bd[_0xba75('0x1f')]=_0xba75('0x2b');_0x3740bd[_0xba75('0x2c')]=_0x4c9fb2[_0xba75('0x14')];_0x3740bd[_0xba75('0x2d')]=_0x4c9fb2[_0xba75('0x7')];writeDB(_0x3740bd);}});}}catch(_0x5c7c7f){utils[_0xba75('0x22')](util[_0xba75('0x2')]('[%s][agents][agentconnect]',_0x4c9fb2[_0xba75('0x4')]),_0x5c7c7f);}};exports[_0xba75('0xe')]=function(_0x1130ac){try{if(!_['isNil'](agents[_0x1130ac['destuniqueid']])){utils['debug'](util['format'](_0xba75('0x2e'),_0x1130ac['uniqueid']),_0x1130ac);utils[_0xba75('0x1')](util[_0xba75('0x2')](_0xba75('0x2f'),_0x1130ac[_0xba75('0x4')],agents[_0x1130ac[_0xba75('0x14')]]['membername'],_0x1130ac['destuniqueid']));agents[_0x1130ac[_0xba75('0x14')]]['agentcomplete']=!![];agents[_0x1130ac[_0xba75('0x14')]]['agentcompleteAt']=utils[_0xba75('0x17')]();agents[_0x1130ac[_0xba75('0x14')]][_0xba75('0x21')]=utils[_0xba75('0x30')](agents[_0x1130ac['destuniqueid']][_0xba75('0x31')],agents[_0x1130ac[_0xba75('0x14')]][_0xba75('0x2a')]);agents[_0x1130ac[_0xba75('0x14')]][_0xba75('0x1f')]=_0x1130ac[_0xba75('0x1f')];agents[_0x1130ac[_0xba75('0x14')]][_0xba75('0xb')]='complete';writeDB(agents[_0x1130ac[_0xba75('0x14')]]);}}catch(_0x3fe479){utils[_0xba75('0x22')](util[_0xba75('0x2')](_0xba75('0x2e'),_0x1130ac['uniqueid']),_0x3fe479);}};exports[_0xba75('0x32')]=function(_0x25ae33){try{if(!_[_0xba75('0x1b')](agents[_0x25ae33[_0xba75('0x33')]])){utils[_0xba75('0x15')](util[_0xba75('0x2')](_0xba75('0x34'),_0x25ae33['uniqueid']),_0x25ae33);utils[_0xba75('0x1')](util[_0xba75('0x2')](_0xba75('0x35'),_0x25ae33['uniqueid'],agents[_0x25ae33[_0xba75('0x33')]][_0xba75('0x7')],agents[_0x25ae33['transfereruniqueid']]['uniqueid']));agents[_0x25ae33[_0xba75('0x33')]]['transfer']=!![];agents[_0x25ae33['transfereruniqueid']][_0xba75('0x36')]='blind';agents[_0x25ae33[_0xba75('0x33')]][_0xba75('0x37')]=_0x25ae33[_0xba75('0x38')];agents[_0x25ae33[_0xba75('0x33')]][_0xba75('0x39')]=agents[_0x25ae33['transfereruniqueid']][_0xba75('0x4')];}}catch(_0x3dee66){utils['error'](util[_0xba75('0x2')](_0xba75('0x34'),_0x25ae33[_0xba75('0x4')]),_0x3dee66);}};exports[_0xba75('0x3a')]=function(_0x322fdb){try{utils['debug'](util[_0xba75('0x2')](_0xba75('0x3b'),_0x322fdb['origtransfereruniqueid']),_0x322fdb);if(_0x322fdb[_0xba75('0x3c')]==_0x322fdb[_0xba75('0x3d')]){if(!_[_0xba75('0x1b')](agents[_0x322fdb[_0xba75('0x3e')]])){utils[_0xba75('0x1')](util[_0xba75('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x322fdb[_0xba75('0x3c')],agents[_0x322fdb[_0xba75('0x3e')]][_0xba75('0x7')]));agents[_0x322fdb[_0xba75('0x3e')]][_0xba75('0x3f')]=!![];agents[_0x322fdb[_0xba75('0x3e')]]['transfertype']='ATTENDED';agents[_0x322fdb['secondtransfereruniqueid']]['transferexten']=_0x322fdb[_0xba75('0x40')];agents[_0x322fdb[_0xba75('0x3e')]][_0xba75('0x39')]=_0x322fdb[_0xba75('0x3c')];}if(_0x322fdb[_0xba75('0x41')]&&agents[_0x322fdb[_0xba75('0x41')]]){agents[_0x322fdb[_0xba75('0x41')]]['agententerreason']=0x1;transfers[_0x322fdb[_0xba75('0x41')]]=_[_0xba75('0x42')](agents[_0x322fdb[_0xba75('0x41')]]);transfers[_0x322fdb[_0xba75('0x41')]]['calleridnum']=agents[_0x322fdb[_0xba75('0x3e')]][_0xba75('0x9')];transfers[_0x322fdb['transfereeuniqueid']][_0xba75('0x43')]=agents[_0x322fdb['secondtransfereruniqueid']][_0xba75('0x43')];transfers[_0x322fdb[_0xba75('0x41')]]['agentcalledAt']=utils[_0xba75('0x17')]();transfers[_0x322fdb[_0xba75('0x41')]]['agentconnectAt']=utils['now']();transfers[_0x322fdb[_0xba75('0x41')]]['holdtime']=0x0;transfers[_0x322fdb[_0xba75('0x41')]]['agententerreason']=0x2;}}else if(_0x322fdb[_0xba75('0x3e')]==_0x322fdb[_0xba75('0x44')]){if(!_[_0xba75('0x1b')](agents[_0x322fdb[_0xba75('0x3c')]])){utils[_0xba75('0x1')](util['format'](_0xba75('0x45'),_0x322fdb[_0xba75('0x3c')],agents[_0x322fdb['origtransfereruniqueid']][_0xba75('0x7')]));agents[_0x322fdb[_0xba75('0x3c')]][_0xba75('0x3f')]=!![];agents[_0x322fdb[_0xba75('0x3c')]][_0xba75('0x36')]=_0xba75('0x46');agents[_0x322fdb[_0xba75('0x3c')]][_0xba75('0x37')]=_0x322fdb[_0xba75('0x47')];agents[_0x322fdb[_0xba75('0x3c')]][_0xba75('0x39')]=_0x322fdb[_0xba75('0x3e')];}if(_0x322fdb['transfertargetuniqueid']&&agents[_0x322fdb['transfertargetuniqueid']]){agents[_0x322fdb[_0xba75('0x48')]][_0xba75('0x49')]=0x1;transfers[_0x322fdb[_0xba75('0x48')]]=_[_0xba75('0x42')](agents[_0x322fdb[_0xba75('0x48')]]);transfers[_0x322fdb[_0xba75('0x48')]][_0xba75('0x9')]=agents[_0x322fdb[_0xba75('0x3c')]][_0xba75('0x9')];transfers[_0x322fdb[_0xba75('0x48')]][_0xba75('0x43')]=agents[_0x322fdb['origtransfereruniqueid']][_0xba75('0x43')];transfers[_0x322fdb['transfertargetuniqueid']][_0xba75('0x4a')]=utils[_0xba75('0x17')]();transfers[_0x322fdb[_0xba75('0x48')]][_0xba75('0x2a')]=utils[_0xba75('0x17')]();transfers[_0x322fdb[_0xba75('0x48')]]['holdtime']=0x0;transfers[_0x322fdb[_0xba75('0x48')]]['agententerreason']=0x2;}}}catch(_0x8519a1){utils[_0xba75('0x22')](util['format']('[%s][agents][attendedtransfer]',_0x322fdb[_0xba75('0x3c')]),_0x8519a1);}};exports[_0xba75('0x4b')]=function(_0x30ef23){try{utils[_0xba75('0x15')](util[_0xba75('0x2')](_0xba75('0x4c'),_0x30ef23['uniqueid']),_0x30ef23);if(agents[_0x30ef23[_0xba75('0x4')]]&&agents[_0x30ef23[_0xba75('0x4')]]['reason']===_0xba75('0x1e')){if(_0x30ef23[_0xba75('0x4d')]==='21'){agents[_0x30ef23[_0xba75('0x4')]][_0xba75('0x1f')]=_0xba75('0x4e');agents[_0x30ef23['uniqueid']][_0xba75('0xb')]='rejected';}utils[_0xba75('0x1')](util[_0xba75('0x2')](_0xba75('0x4f'),_0x30ef23[_0xba75('0x4')],agents[_0x30ef23[_0xba75('0x4')]][_0xba75('0x7')],agents[_0x30ef23['uniqueid']]['reason'],agents[_0x30ef23[_0xba75('0x4')]]['lastevent']));writeDB(agents[_0x30ef23[_0xba75('0x4')]]);var _0x4707ef=unanswered['indexOf'](_0x30ef23[_0xba75('0x4')]);if(_0x4707ef>-0x1){unanswered[_0xba75('0x50')](_0x4707ef,0x1);}}if(transfers[_0x30ef23[_0xba75('0x4')]]){transfers[_0x30ef23['uniqueid']]['agentcomplete']=!![];transfers[_0x30ef23['uniqueid']]['agentcompleteAt']=utils['now']();transfers[_0x30ef23[_0xba75('0x4')]]['talktime']=utils[_0xba75('0x30')](transfers[_0x30ef23[_0xba75('0x4')]][_0xba75('0x31')],transfers[_0x30ef23[_0xba75('0x4')]][_0xba75('0x2a')]);transfers[_0x30ef23[_0xba75('0x4')]][_0xba75('0x1f')]='agent';transfers[_0x30ef23['uniqueid']][_0xba75('0xb')]=_0xba75('0x51');utils['info'](util[_0xba75('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x30ef23[_0xba75('0x4')],transfers[_0x30ef23[_0xba75('0x4')]]['membername'],transfers[_0x30ef23[_0xba75('0x4')]]['reason'],transfers[_0x30ef23[_0xba75('0x4')]][_0xba75('0xb')]));writeDB(transfers[_0x30ef23['uniqueid']],!![]);}if(agents[_0x30ef23[_0xba75('0x4')]]&&agents[_0x30ef23[_0xba75('0x4')]][_0xba75('0x2a')]){agents[_0x30ef23[_0xba75('0x4')]][_0xba75('0xe')]=!![];agents[_0x30ef23[_0xba75('0x4')]][_0xba75('0x31')]=utils[_0xba75('0x17')]();agents[_0x30ef23['uniqueid']][_0xba75('0x21')]=utils[_0xba75('0x30')](agents[_0x30ef23['uniqueid']]['agentcompleteAt'],agents[_0x30ef23['uniqueid']][_0xba75('0x2a')]);agents[_0x30ef23['uniqueid']][_0xba75('0x1f')]=agents[_0x30ef23['uniqueid']][_0xba75('0x3f')]?'transfer':'agent';agents[_0x30ef23[_0xba75('0x4')]]['lastevent']=_0xba75('0x51');utils['info'](util['format'](_0xba75('0x4f'),_0x30ef23['uniqueid'],agents[_0x30ef23[_0xba75('0x4')]]['membername'],agents[_0x30ef23[_0xba75('0x4')]][_0xba75('0x1f')],agents[_0x30ef23[_0xba75('0x4')]]['lastevent']));writeDB(agents[_0x30ef23[_0xba75('0x4')]]);}}catch(_0x1de4a3){utils['error'](util[_0xba75('0x2')]('[%s][agents][hangup]',_0x30ef23['uniqueid']),_0x1de4a3);}}; \ No newline at end of file +var _0xb7e7=['answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','transfereeuniqueid','agententerreason','clone','calleridname','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','./utils','format','uniqueid','channel','queue','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','destuniqueid','agentcalledAt','now','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','timeout','holdtime','ringtime','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','talktime','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere'];(function(_0x3f7c49,_0x7f73f9){var _0x4744cf=function(_0x117e35){while(--_0x117e35){_0x3f7c49['push'](_0x3f7c49['shift']());}};_0x4744cf(++_0x7f73f9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xb7e7[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var utils=require(_0x7b7e('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x518dc6,_0x1b7cc7){utils['info'](util[_0x7b7e('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x518dc6[_0x7b7e('0x3')],_0x518dc6[_0x7b7e('0x4')],_0x518dc6[_0x7b7e('0x5')],_0x518dc6['membername'],_0x518dc6['interface'],_0x518dc6[_0x7b7e('0x6')],_0x518dc6[_0x7b7e('0x7')],_0x518dc6[_0x7b7e('0x8')]));if(_0x518dc6['queue']){utils[_0x7b7e('0x9')](_0x518dc6[_0x7b7e('0x5')])[_0x7b7e('0xa')](function(_0x1647e5){if(_0x1647e5){_0x518dc6[_0x7b7e('0xb')]=_0x1647e5[_0x7b7e('0xb')];_0x518dc6[_0x7b7e('0xc')]=_0x518dc6['agentcomplete']?_0x1647e5[_0x7b7e('0xd')]:![];_0x518dc6[_0x7b7e('0xe')]=_0x518dc6[_0x7b7e('0xc')]?_0x1647e5[_0x7b7e('0xf')]:0x0;}utils[_0x7b7e('0x10')](_0x7b7e('0x11'),_0x518dc6);});}else{utils[_0x7b7e('0x10')](_0x7b7e('0x11'),_0x518dc6);}if(_0x1b7cc7){delete transfers[_0x518dc6[_0x7b7e('0x3')]];}else{delete agents[_0x518dc6['destuniqueid']];}}exports[_0x7b7e('0x12')]=function(_0x430eab){try{utils['debug'](util[_0x7b7e('0x2')]('[%s][agents][agentcalled]',_0x430eab['uniqueid']),_0x430eab);agents[_0x430eab[_0x7b7e('0x13')]]=_0x430eab;agents[_0x430eab[_0x7b7e('0x13')]][_0x7b7e('0x14')]=utils[_0x7b7e('0x15')]();agents[_0x430eab[_0x7b7e('0x13')]]['lastevent']='called';agents[_0x430eab[_0x7b7e('0x13')]][_0x7b7e('0x7')]=null;agents[_0x430eab[_0x7b7e('0x13')]][_0x7b7e('0x16')]=null;utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x18'),_0x430eab[_0x7b7e('0x3')],agents[_0x430eab[_0x7b7e('0x13')]][_0x7b7e('0x19')],_0x430eab[_0x7b7e('0x13')]));}catch(_0x14f4fe){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x1b'),_0x430eab[_0x7b7e('0x3')]),_0x14f4fe);}};exports[_0x7b7e('0x1c')]=function(_0x49eddb){try{if(!_[_0x7b7e('0x1d')](agents[_0x49eddb[_0x7b7e('0x13')]])){utils[_0x7b7e('0x1e')](util['format'](_0x7b7e('0x1f'),_0x49eddb[_0x7b7e('0x3')]),_0x49eddb);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x20'),_0x49eddb[_0x7b7e('0x3')],agents[_0x49eddb[_0x7b7e('0x13')]][_0x7b7e('0x19')],_0x49eddb['destuniqueid']));agents[_0x49eddb['destuniqueid']]['agentringnoanswer']=!![];agents[_0x49eddb[_0x7b7e('0x13')]][_0x7b7e('0x21')]=utils[_0x7b7e('0x15')]();agents[_0x49eddb['destuniqueid']]['lastevent']='timeout';agents[_0x49eddb[_0x7b7e('0x13')]][_0x7b7e('0x22')]=_0x7b7e('0x23');agents[_0x49eddb[_0x7b7e('0x13')]][_0x7b7e('0x24')]=_0x49eddb['ringtime']?parseInt(_0x49eddb[_0x7b7e('0x25')])/0x3e8:0x0;agents[_0x49eddb[_0x7b7e('0x13')]]['talktime']=0x0;unanswered['push'](_0x49eddb['destuniqueid']);}}catch(_0x12ef0b){utils[_0x7b7e('0x1a')](util['format'](_0x7b7e('0x1f'),_0x49eddb['uniqueid']),_0x12ef0b);}};exports[_0x7b7e('0x26')]=function(_0xb9b6bf){try{_[_0x7b7e('0x27')](agents,function(_0x5515ca,_0x3960b8){if(_0x5515ca[_0x7b7e('0x3')]==_0xb9b6bf[_0x7b7e('0x3')]&&!_[_0x7b7e('0x28')](unanswered,_0x5515ca[_0x7b7e('0x13')])){utils['debug'](util[_0x7b7e('0x2')]('[%s][agents][queuecallerabandon]',_0xb9b6bf[_0x7b7e('0x3')]),_0xb9b6bf);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x29'),_0xb9b6bf[_0x7b7e('0x3')],_0x5515ca[_0x7b7e('0x19')],_0x5515ca[_0x7b7e('0x13')]));_0x5515ca['agentringnoanswer']=!![];_0x5515ca['agentringnoanswerAt']=utils[_0x7b7e('0x15')]();_0x5515ca[_0x7b7e('0x8')]='abandoned';_0x5515ca[_0x7b7e('0x22')]=_0x7b7e('0x2a');_0x5515ca[_0x7b7e('0x24')]=_0xb9b6bf['holdtime'];_0x5515ca[_0x7b7e('0x2b')]=0x0;writeDB(_0x5515ca);}});}catch(_0x256908){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x2c'),_0xb9b6bf[_0x7b7e('0x3')]),_0x256908);}};exports[_0x7b7e('0x2d')]=function(_0x202f04){try{if(agents[_0x202f04[_0x7b7e('0x13')]]){utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')](_0x7b7e('0x2e'),_0x202f04[_0x7b7e('0x3')]),_0x202f04);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x2f'),_0x202f04['uniqueid'],agents[_0x202f04[_0x7b7e('0x13')]][_0x7b7e('0x19')],_0x202f04[_0x7b7e('0x13')]));agents[_0x202f04[_0x7b7e('0x13')]][_0x7b7e('0x30')]=utils[_0x7b7e('0x15')]();agents[_0x202f04[_0x7b7e('0x13')]][_0x7b7e('0x7')]=_0x202f04[_0x7b7e('0x7')];agents[_0x202f04[_0x7b7e('0x13')]]['connectedlinename']=_0x202f04[_0x7b7e('0x16')];agents[_0x202f04[_0x7b7e('0x13')]][_0x7b7e('0x24')]=_0x202f04[_0x7b7e('0x25')];agents[_0x202f04['destuniqueid']][_0x7b7e('0x8')]=_0x7b7e('0x31');_[_0x7b7e('0x27')](agents,function(_0x5c58c0,_0x4a2888){if(_0x5c58c0[_0x7b7e('0x13')]!=_0x202f04['destuniqueid']&&_0x5c58c0[_0x7b7e('0x3')]==_0x202f04[_0x7b7e('0x3')]){_0x5c58c0['talktime']=0x0;_0x5c58c0[_0x7b7e('0x24')]=_0x202f04[_0x7b7e('0x25')];_0x5c58c0[_0x7b7e('0x1c')]=!![];_0x5c58c0[_0x7b7e('0x21')]=utils[_0x7b7e('0x15')]();_0x5c58c0[_0x7b7e('0x8')]=_0x7b7e('0x32');_0x5c58c0[_0x7b7e('0x22')]=_0x7b7e('0x32');_0x5c58c0['answeredelsewheredestinationuniqueid']=_0x202f04['destuniqueid'];_0x5c58c0[_0x7b7e('0x33')]=_0x202f04['membername'];writeDB(_0x5c58c0);}});}}catch(_0x41c8a6){utils['error'](util['format'](_0x7b7e('0x2e'),_0x202f04['uniqueid']),_0x41c8a6);}};exports[_0x7b7e('0x34')]=function(_0x52051c){try{if(!_[_0x7b7e('0x1d')](agents[_0x52051c[_0x7b7e('0x13')]])){utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')]('[%s][agents][agentcomplete]',_0x52051c[_0x7b7e('0x3')]),_0x52051c);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x35'),_0x52051c[_0x7b7e('0x3')],agents[_0x52051c[_0x7b7e('0x13')]]['membername'],_0x52051c['destuniqueid']));agents[_0x52051c['destuniqueid']][_0x7b7e('0x34')]=!![];agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x36')]=utils[_0x7b7e('0x15')]();agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x2b')]=utils['diffTime'](agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x36')],agents[_0x52051c['destuniqueid']]['agentconnectAt']);agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x22')]=_0x52051c[_0x7b7e('0x22')];agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x8')]=_0x7b7e('0x37');writeDB(agents[_0x52051c['destuniqueid']]);}}catch(_0x2673eb){utils['error'](util[_0x7b7e('0x2')](_0x7b7e('0x38'),_0x52051c[_0x7b7e('0x3')]),_0x2673eb);}};exports[_0x7b7e('0x39')]=function(_0x58e4e6){try{if(!_[_0x7b7e('0x1d')](agents[_0x58e4e6[_0x7b7e('0x3a')]])){utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')](_0x7b7e('0x3b'),_0x58e4e6['uniqueid']),_0x58e4e6);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x3c'),_0x58e4e6[_0x7b7e('0x3')],agents[_0x58e4e6[_0x7b7e('0x3a')]]['membername'],agents[_0x58e4e6[_0x7b7e('0x3a')]][_0x7b7e('0x3')]));agents[_0x58e4e6[_0x7b7e('0x3a')]][_0x7b7e('0x3d')]=!![];agents[_0x58e4e6[_0x7b7e('0x3a')]][_0x7b7e('0x3e')]=_0x7b7e('0x3f');agents[_0x58e4e6['transfereruniqueid']][_0x7b7e('0x40')]=_0x58e4e6['extension'];agents[_0x58e4e6[_0x7b7e('0x3a')]][_0x7b7e('0x41')]=agents[_0x58e4e6['transfereruniqueid']][_0x7b7e('0x3')];}}catch(_0x44e3a0){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x3b'),_0x58e4e6[_0x7b7e('0x3')]),_0x44e3a0);}};exports[_0x7b7e('0x42')]=function(_0x5f15ce){try{utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')](_0x7b7e('0x43'),_0x5f15ce[_0x7b7e('0x44')]),_0x5f15ce);if(_0x5f15ce['origtransfereruniqueid']==_0x5f15ce['origtransfererlinkedid']){if(!_['isNil'](agents[_0x5f15ce[_0x7b7e('0x45')]])){utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x5f15ce['origtransfereruniqueid'],agents[_0x5f15ce[_0x7b7e('0x45')]][_0x7b7e('0x19')]));agents[_0x5f15ce['secondtransfereruniqueid']][_0x7b7e('0x3d')]=!![];agents[_0x5f15ce[_0x7b7e('0x45')]][_0x7b7e('0x3e')]='ATTENDED';agents[_0x5f15ce[_0x7b7e('0x45')]][_0x7b7e('0x40')]=_0x5f15ce['origtransfererexten'];agents[_0x5f15ce[_0x7b7e('0x45')]][_0x7b7e('0x41')]=_0x5f15ce[_0x7b7e('0x44')];}if(_0x5f15ce[_0x7b7e('0x46')]&&agents[_0x5f15ce[_0x7b7e('0x46')]]){agents[_0x5f15ce[_0x7b7e('0x46')]][_0x7b7e('0x47')]=0x1;transfers[_0x5f15ce[_0x7b7e('0x46')]]=_[_0x7b7e('0x48')](agents[_0x5f15ce['transfereeuniqueid']]);transfers[_0x5f15ce[_0x7b7e('0x46')]][_0x7b7e('0x6')]=agents[_0x5f15ce['secondtransfereruniqueid']][_0x7b7e('0x6')];transfers[_0x5f15ce[_0x7b7e('0x46')]][_0x7b7e('0x49')]=agents[_0x5f15ce['secondtransfereruniqueid']][_0x7b7e('0x49')];transfers[_0x5f15ce['transfereeuniqueid']][_0x7b7e('0x14')]=utils[_0x7b7e('0x15')]();transfers[_0x5f15ce['transfereeuniqueid']][_0x7b7e('0x30')]=utils[_0x7b7e('0x15')]();transfers[_0x5f15ce['transfereeuniqueid']][_0x7b7e('0x24')]=0x0;transfers[_0x5f15ce[_0x7b7e('0x46')]][_0x7b7e('0x47')]=0x2;}}else if(_0x5f15ce[_0x7b7e('0x45')]==_0x5f15ce['secondtransfererlinkedid']){if(!_[_0x7b7e('0x1d')](agents[_0x5f15ce[_0x7b7e('0x44')]])){utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x4a'),_0x5f15ce[_0x7b7e('0x44')],agents[_0x5f15ce[_0x7b7e('0x44')]][_0x7b7e('0x19')]));agents[_0x5f15ce[_0x7b7e('0x44')]][_0x7b7e('0x3d')]=!![];agents[_0x5f15ce['origtransfereruniqueid']][_0x7b7e('0x3e')]='ATTENDED';agents[_0x5f15ce['origtransfereruniqueid']][_0x7b7e('0x40')]=_0x5f15ce[_0x7b7e('0x4b')];agents[_0x5f15ce[_0x7b7e('0x44')]][_0x7b7e('0x41')]=_0x5f15ce['secondtransfereruniqueid'];}if(_0x5f15ce[_0x7b7e('0x4c')]&&agents[_0x5f15ce[_0x7b7e('0x4c')]]){agents[_0x5f15ce[_0x7b7e('0x4c')]][_0x7b7e('0x47')]=0x1;transfers[_0x5f15ce[_0x7b7e('0x4c')]]=_[_0x7b7e('0x48')](agents[_0x5f15ce['transfertargetuniqueid']]);transfers[_0x5f15ce[_0x7b7e('0x4c')]]['calleridnum']=agents[_0x5f15ce['origtransfereruniqueid']][_0x7b7e('0x6')];transfers[_0x5f15ce['transfertargetuniqueid']][_0x7b7e('0x49')]=agents[_0x5f15ce['origtransfereruniqueid']][_0x7b7e('0x49')];transfers[_0x5f15ce[_0x7b7e('0x4c')]]['agentcalledAt']=utils[_0x7b7e('0x15')]();transfers[_0x5f15ce[_0x7b7e('0x4c')]]['agentconnectAt']=utils[_0x7b7e('0x15')]();transfers[_0x5f15ce[_0x7b7e('0x4c')]][_0x7b7e('0x24')]=0x0;transfers[_0x5f15ce[_0x7b7e('0x4c')]][_0x7b7e('0x47')]=0x2;}}}catch(_0x2147d9){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x43'),_0x5f15ce[_0x7b7e('0x44')]),_0x2147d9);}};exports['hangup']=function(_0x59ecf9){try{utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')](_0x7b7e('0x4d'),_0x59ecf9[_0x7b7e('0x3')]),_0x59ecf9);if(agents[_0x59ecf9[_0x7b7e('0x3')]]&&agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x22')]==='timeout'){if(_0x59ecf9[_0x7b7e('0x4e')]==='21'){agents[_0x59ecf9[_0x7b7e('0x3')]]['reason']=_0x7b7e('0x4f');agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x8')]=_0x7b7e('0x4f');}utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x50'),_0x59ecf9[_0x7b7e('0x3')],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x19')],agents[_0x59ecf9[_0x7b7e('0x3')]]['reason'],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x8')]));writeDB(agents[_0x59ecf9[_0x7b7e('0x3')]]);var _0x122053=unanswered[_0x7b7e('0x51')](_0x59ecf9[_0x7b7e('0x3')]);if(_0x122053>-0x1){unanswered[_0x7b7e('0x52')](_0x122053,0x1);}}if(transfers[_0x59ecf9['uniqueid']]){transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x34')]=!![];transfers[_0x59ecf9[_0x7b7e('0x3')]]['agentcompleteAt']=utils[_0x7b7e('0x15')]();transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x2b')]=utils[_0x7b7e('0x53')](transfers[_0x59ecf9[_0x7b7e('0x3')]]['agentcompleteAt'],transfers[_0x59ecf9['uniqueid']]['agentconnectAt']);transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x22')]=_0x7b7e('0x54');transfers[_0x59ecf9['uniqueid']][_0x7b7e('0x8')]=_0x7b7e('0x37');utils[_0x7b7e('0x17')](util['format'](_0x7b7e('0x50'),_0x59ecf9[_0x7b7e('0x3')],transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x19')],transfers[_0x59ecf9['uniqueid']][_0x7b7e('0x22')],transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x8')]));writeDB(transfers[_0x59ecf9[_0x7b7e('0x3')]],!![]);}if(agents[_0x59ecf9['uniqueid']]&&agents[_0x59ecf9['uniqueid']][_0x7b7e('0x30')]){agents[_0x59ecf9['uniqueid']][_0x7b7e('0x34')]=!![];agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x36')]=utils[_0x7b7e('0x15')]();agents[_0x59ecf9['uniqueid']][_0x7b7e('0x2b')]=utils[_0x7b7e('0x53')](agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x36')],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x30')]);agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x22')]=agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x3d')]?_0x7b7e('0x3d'):_0x7b7e('0x54');agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x8')]=_0x7b7e('0x37');utils[_0x7b7e('0x17')](util['format'](_0x7b7e('0x50'),_0x59ecf9[_0x7b7e('0x3')],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x19')],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x22')],agents[_0x59ecf9[_0x7b7e('0x3')]]['lastevent']));writeDB(agents[_0x59ecf9[_0x7b7e('0x3')]]);}}catch(_0x3880be){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x4d'),_0x59ecf9['uniqueid']),_0x3880be);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index a5769de..05e52c3 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 _0x3f0c=['transfertargetchannel','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','value','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','lastapplication','./utils','NO\x20ANSWER','FAILED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','interface','connectedlinenum','accountcode','then','UserId','CreateVoiceCallReport','request','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','channel','DOCUMENTATION','error','debug','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','ANSWERED','hangup','callerid','calleridname','cause-txt','endtime','diffTime','starttime','[%s][calls][hangup]','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel'];(function(_0x381372,_0xf0a5a){var _0x4e959a=function(_0x25a897){while(--_0x25a897){_0x381372['push'](_0x381372['shift']());}};_0x4e959a(++_0xf0a5a);}(_0x3f0c,0x1bf));var _0xc3f0=function(_0xe924a5,_0x1bf7f2){_0xe924a5=_0xe924a5-0x0;var _0x5e464f=_0x3f0c[_0xe924a5];return _0x5e464f;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xc3f0('0x0'));var dispositions=[_0xc3f0('0x1'),_0xc3f0('0x2'),'FAILED','NO\x20ANSWER','NO\x20ANSWER',_0xc3f0('0x1'),'ANSWERED','BUSY',_0xc3f0('0x2'),_0xc3f0('0x2'),_0xc3f0('0x2')];var channels={};function writeDB(_0x3517b4){utils[_0xc3f0('0x3')](util[_0xc3f0('0x4')](_0xc3f0('0x5'),_0x3517b4[_0xc3f0('0x6')],_0x3517b4['channel'],_0x3517b4[_0xc3f0('0x7')],_0x3517b4['membername'],_0x3517b4[_0xc3f0('0x8')],_0x3517b4['calleridnum'],_0x3517b4[_0xc3f0('0x9')],_0x3517b4['lastevent']));if(_0x3517b4[_0xc3f0('0xa')]){utils['getUserByInternal'](_0x3517b4[_0xc3f0('0xa')])[_0xc3f0('0xb')](function(_0x4abd8a){if(_0x4abd8a){_0x3517b4[_0xc3f0('0xc')]=_0x4abd8a['id'];}utils['request'](_0xc3f0('0xd'),_0x3517b4);});}else{utils[_0xc3f0('0xe')](_0xc3f0('0xd'),_0x3517b4);}if(channels[_0x3517b4['uniqueid']]){delete channels[_0x3517b4['uniqueid']];}}exports[_0xc3f0('0xf')]=function(_0x55d066){try{utils['debug'](util[_0xc3f0('0x4')](_0xc3f0('0x10'),_0x55d066[_0xc3f0('0x6')]),_0x55d066);if(_0x55d066[_0xc3f0('0x6')]==_0x55d066[_0xc3f0('0x11')]&&_0x55d066['channel']!=_0xc3f0('0x12')){utils[_0xc3f0('0x3')](util[_0xc3f0('0x4')](_0xc3f0('0x13'),_0x55d066[_0xc3f0('0x6')],_0x55d066[_0xc3f0('0x14')],_0x55d066[_0xc3f0('0x15')]));channels[_0x55d066[_0xc3f0('0x6')]]={'uniqueid':_0x55d066[_0xc3f0('0x6')],'accountcode':_0x55d066[_0xc3f0('0xa')],'source':_0x55d066[_0xc3f0('0x16')],'destination':_0x55d066['exten'],'destinationcontext':_0x55d066[_0xc3f0('0x14')],'channel':_0x55d066[_0xc3f0('0x17')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xc3f0('0x1'),'amaflags':_0xc3f0('0x18')};}}catch(_0x2de8b7){utils[_0xc3f0('0x19')](util[_0xc3f0('0x4')]('[%s][calls][newchannel]',_0x55d066[_0xc3f0('0x6')]),_0x2de8b7);}};exports['newstate']=function(_0xb377b4){try{utils[_0xc3f0('0x1a')](util[_0xc3f0('0x4')](_0xc3f0('0x1b'),_0xb377b4[_0xc3f0('0x6')]),_0xb377b4);if(!_['isNil'](channels[_0xb377b4[_0xc3f0('0x6')]])&&_0xb377b4[_0xc3f0('0x1c')]==0x6){utils[_0xc3f0('0x3')](util[_0xc3f0('0x4')](_0xc3f0('0x1d'),_0xb377b4['uniqueid'],_0xb377b4['context'],_0xb377b4[_0xc3f0('0x17')]));if(_[_0xc3f0('0x1e')](channels[_0xb377b4['uniqueid']][_0xc3f0('0x1f')])){channels[_0xb377b4['uniqueid']][_0xc3f0('0x1f')]=utils[_0xc3f0('0x20')]();}}else if(!_[_0xc3f0('0x1e')](channels[_0xb377b4[_0xc3f0('0x11')]])&&_0xb377b4[_0xc3f0('0x1c')]==0x6&&_0xb377b4[_0xc3f0('0x14')]!=_0xc3f0('0x21')){utils[_0xc3f0('0x3')](util[_0xc3f0('0x4')](_0xc3f0('0x22'),_0xb377b4['uniqueid'],_0xb377b4[_0xc3f0('0x11')],_0xb377b4[_0xc3f0('0x14')],_0xb377b4[_0xc3f0('0x17')]));channels[_0xb377b4['linkedid']]['accountcode']=_0xb377b4[_0xc3f0('0xa')];channels[_0xb377b4[_0xc3f0('0x11')]][_0xc3f0('0x23')]=_0xb377b4['channel'];if(_['isNil'](channels[_0xb377b4[_0xc3f0('0x11')]][_0xc3f0('0x24')])){channels[_0xb377b4['linkedid']][_0xc3f0('0x24')]=utils[_0xc3f0('0x20')]();}channels[_0xb377b4[_0xc3f0('0x11')]]['disposition']=dispositions[_[_0xc3f0('0x25')](_0xb377b4[_0xc3f0('0x1c')])]||_0xc3f0('0x26');}}catch(_0x560fc5){utils[_0xc3f0('0x19')](util[_0xc3f0('0x4')](_0xc3f0('0x1b'),_0xb377b4['uniqueid']),_0x560fc5);}};exports[_0xc3f0('0x27')]=function(_0x64f135){try{if(!_['isNil'](channels[_0x64f135[_0xc3f0('0x6')]])){utils[_0xc3f0('0x1a')](util[_0xc3f0('0x4')]('[%s][calls][hangup]',_0x64f135[_0xc3f0('0x6')]),_0x64f135);if(_[_0xc3f0('0x1e')](channels[_0x64f135[_0xc3f0('0x6')]][_0xc3f0('0x28')])){channels[_0x64f135[_0xc3f0('0x6')]][_0xc3f0('0x28')]=_0x64f135[_0xc3f0('0x29')]+'\x20<'+_0x64f135[_0xc3f0('0x16')]+'>';}utils[_0xc3f0('0x3')](util[_0xc3f0('0x4')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x64f135[_0xc3f0('0x6')],channels[_0x64f135[_0xc3f0('0x6')]][_0xc3f0('0x28')],_0x64f135[_0xc3f0('0x2a')]));channels[_0x64f135['uniqueid']][_0xc3f0('0x2b')]=utils['now']();channels[_0x64f135[_0xc3f0('0x6')]]['duration']=utils[_0xc3f0('0x2c')](channels[_0x64f135[_0xc3f0('0x6')]][_0xc3f0('0x2b')],channels[_0x64f135[_0xc3f0('0x6')]][_0xc3f0('0x2d')]);channels[_0x64f135[_0xc3f0('0x6')]]['billableseconds']=channels[_0x64f135[_0xc3f0('0x6')]][_0xc3f0('0x24')]?utils['diffTime'](channels[_0x64f135['uniqueid']][_0xc3f0('0x2b')],channels[_0x64f135[_0xc3f0('0x6')]][_0xc3f0('0x24')]):0x0;writeDB(channels[_0x64f135[_0xc3f0('0x6')]]);}}catch(_0x11e638){utils[_0xc3f0('0x19')](util[_0xc3f0('0x4')](_0xc3f0('0x2e'),_0x64f135[_0xc3f0('0x6')]),_0x11e638);}};exports['attendedtransfer']=function(_0x377dde){try{if(!_[_0xc3f0('0x1e')](channels[_0x377dde[_0xc3f0('0x2f')]])){utils[_0xc3f0('0x1a')](util[_0xc3f0('0x4')](_0xc3f0('0x30'),_0x377dde[_0xc3f0('0x31')]),_0x377dde);if(channels[_0x377dde['localtwolinkedid']][_0xc3f0('0x17')]==_0x377dde[_0xc3f0('0x32')]){utils[_0xc3f0('0x3')](util['format'](_0xc3f0('0x33'),_0x377dde[_0xc3f0('0x31')],_0x377dde[_0xc3f0('0x2f')],_0x377dde[_0xc3f0('0x34')]));channels[_0x377dde[_0xc3f0('0x2f')]]['destinationchannel']=_0x377dde[_0xc3f0('0x34')];channels[_0x377dde[_0xc3f0('0x2f')]]['userfield']='_attended';}else if(channels[_0x377dde[_0xc3f0('0x2f')]][_0xc3f0('0x17')]=_0x377dde[_0xc3f0('0x35')]){utils[_0xc3f0('0x3')](util['format'](_0xc3f0('0x33'),_0x377dde[_0xc3f0('0x31')],_0x377dde[_0xc3f0('0x2f')],_0x377dde[_0xc3f0('0x36')]));channels[_0x377dde[_0xc3f0('0x2f')]][_0xc3f0('0x23')]=_0x377dde[_0xc3f0('0x36')];channels[_0x377dde[_0xc3f0('0x2f')]]['userfield']=_0xc3f0('0x37');}}}catch(_0xc59c33){utils[_0xc3f0('0x19')](util[_0xc3f0('0x4')](_0xc3f0('0x30'),_0x377dde[_0xc3f0('0x31')]),_0xc59c33);}};exports[_0xc3f0('0x38')]=function(_0x41d9ee){try{if(!_[_0xc3f0('0x1e')](channels[_0x41d9ee[_0xc3f0('0x6')]])){utils[_0xc3f0('0x1a')](util[_0xc3f0('0x4')](_0xc3f0('0x39'),_0x41d9ee['uniqueid']),_0x41d9ee);channels[_0x41d9ee[_0xc3f0('0x6')]][_0xc3f0('0x3a')]=utils['now']();utils[_0xc3f0('0x3')](util[_0xc3f0('0x4')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x41d9ee[_0xc3f0('0x6')],channels[_0x41d9ee[_0xc3f0('0x6')]]['musiconholdstartAt']));}}catch(_0xe66799){utils[_0xc3f0('0x19')](util[_0xc3f0('0x4')](_0xc3f0('0x39'),_0x41d9ee[_0xc3f0('0x6')]),_0xe66799);}};exports[_0xc3f0('0x3b')]=function(_0x3f279b){try{if(!_['isNil'](channels[_0x3f279b[_0xc3f0('0x6')]])){utils[_0xc3f0('0x1a')](util[_0xc3f0('0x4')](_0xc3f0('0x3c'),_0x3f279b[_0xc3f0('0x6')]),_0x3f279b);if(!_[_0xc3f0('0x1e')](channels[_0x3f279b[_0xc3f0('0x6')]][_0xc3f0('0x3a')])){channels[_0x3f279b[_0xc3f0('0x6')]][_0xc3f0('0x3d')]+=utils[_0xc3f0('0x2c')](utils['now'](),channels[_0x3f279b[_0xc3f0('0x6')]]['musiconholdstartAt']);utils['info'](util['format'](_0xc3f0('0x3e'),_0x3f279b['uniqueid'],channels[_0x3f279b['uniqueid']][_0xc3f0('0x3d')]));delete channels[_0x3f279b[_0xc3f0('0x6')]][_0xc3f0('0x3a')];}}}catch(_0x23fc98){utils['error'](util['format'](_0xc3f0('0x3c'),_0x3f279b['uniqueid']),_0x23fc98);}};exports[_0xc3f0('0x3f')]=function(_0x3660d1){try{if(!_[_0xc3f0('0x1e')](channels[_0x3660d1[_0xc3f0('0x6')]])){utils['debug'](util['format'](_0xc3f0('0x40'),_0x3660d1[_0xc3f0('0x6')]),_0x3660d1);if(!_[_0xc3f0('0x1e')](_0x3660d1[_0xc3f0('0x41')]['xmd-originatecalleridnum'])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x3660d1[_0xc3f0('0x6')],_0x3660d1[_0xc3f0('0x42')]));channels[_0x3660d1[_0xc3f0('0x6')]]['source']=_0x3660d1[_0xc3f0('0x42')];}if(!_['isNil'](_0x3660d1[_0xc3f0('0x41')]['xmd-phone'])){utils[_0xc3f0('0x3')](util['format'](_0xc3f0('0x43'),_0x3660d1[_0xc3f0('0x6')],_0x3660d1[_0xc3f0('0x42')]));channels[_0x3660d1[_0xc3f0('0x6')]][_0xc3f0('0x44')]=_0x3660d1[_0xc3f0('0x42')];channels[_0x3660d1[_0xc3f0('0x6')]][_0xc3f0('0x28')]='\x22'+_0x3660d1[_0xc3f0('0x42')]+'\x22\x20<'+_0x3660d1['value']+'>';}if(!_[_0xc3f0('0x1e')](_0x3660d1[_0xc3f0('0x41')]['xmd-callerid-preview'])||!_[_0xc3f0('0x1e')](_0x3660d1['variable'][_0xc3f0('0x45')])){utils[_0xc3f0('0x3')](util[_0xc3f0('0x4')](_0xc3f0('0x46'),_0x3660d1['uniqueid'],!_[_0xc3f0('0x1e')](_0x3660d1[_0xc3f0('0x41')][_0xc3f0('0x47')])?_0xc3f0('0x47'):'xmd-callerid',_0x3660d1[_0xc3f0('0x42')]));channels[_0x3660d1['uniqueid']]['callerid']=_0x3660d1[_0xc3f0('0x42')];}if(!_[_0xc3f0('0x1e')](_0x3660d1['variable'][_0xc3f0('0x48')])||!_[_0xc3f0('0x1e')](_0x3660d1[_0xc3f0('0x41')][_0xc3f0('0x49')])){utils[_0xc3f0('0x3')](util[_0xc3f0('0x4')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x3660d1[_0xc3f0('0x6')],!_[_0xc3f0('0x1e')](_0x3660d1[_0xc3f0('0x41')][_0xc3f0('0x48')])?_0xc3f0('0x48'):_0xc3f0('0x49'),_0x3660d1[_0xc3f0('0x42')]));channels[_0x3660d1[_0xc3f0('0x6')]]['lastapplication']=_0xc3f0('0x4a');channels[_0x3660d1['uniqueid']][_0xc3f0('0x4b')]=_0x3660d1[_0xc3f0('0x42')];channels[_0x3660d1[_0xc3f0('0x6')]][_0xc3f0('0x7')]=!![];}if(!_['isNil'](_0x3660d1[_0xc3f0('0x41')][_0xc3f0('0x4c')])){utils[_0xc3f0('0x3')](util[_0xc3f0('0x4')](_0xc3f0('0x4d'),_0x3660d1['uniqueid'],_0x3660d1[_0xc3f0('0x42')]));channels[_0x3660d1[_0xc3f0('0x6')]][_0xc3f0('0x4e')]=_0x3660d1['value'];}if(!_[_0xc3f0('0x1e')](_0x3660d1['variable'][_0xc3f0('0x4f')])){utils['info'](util[_0xc3f0('0x4')](_0xc3f0('0x50'),_0x3660d1['uniqueid'],_0x3660d1['value']));channels[_0x3660d1[_0xc3f0('0x6')]]['type']=_0x3660d1['value'];}if(!_[_0xc3f0('0x1e')](_0x3660d1['variable'][_0xc3f0('0x51')])){utils[_0xc3f0('0x3')](util[_0xc3f0('0x4')](_0xc3f0('0x52'),_0x3660d1['uniqueid'],_0x3660d1[_0xc3f0('0x42')]));channels[_0x3660d1[_0xc3f0('0x6')]][_0xc3f0('0x53')]=_0x3660d1[_0xc3f0('0x42')];}if(!_['isNil'](_0x3660d1[_0xc3f0('0x41')][_0xc3f0('0x54')])){utils[_0xc3f0('0x3')](util[_0xc3f0('0x4')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x3660d1[_0xc3f0('0x6')],_0x3660d1[_0xc3f0('0x42')]));channels[_0x3660d1[_0xc3f0('0x6')]][_0xc3f0('0x54')]=_0x3660d1[_0xc3f0('0x42')];}}}catch(_0x35585b){utils[_0xc3f0('0x19')](util[_0xc3f0('0x4')](_0xc3f0('0x40'),_0x3660d1['uniqueid']),_0x35585b);}};exports[_0xc3f0('0x55')]=function(_0x197525){try{if(!_[_0xc3f0('0x1e')](channels[_0x197525[_0xc3f0('0x6')]])){utils[_0xc3f0('0x1a')](util[_0xc3f0('0x4')](_0xc3f0('0x56'),_0x197525[_0xc3f0('0x6')]),_0x197525);utils[_0xc3f0('0x3')](util[_0xc3f0('0x4')](_0xc3f0('0x57'),_0x197525[_0xc3f0('0x6')],_0x197525[_0xc3f0('0x58')],_0x197525[_0xc3f0('0x59')]));if(_0x197525[_0xc3f0('0x58')][_0xc3f0('0x5a')]()==_0xc3f0('0x5b')&&_[_0xc3f0('0x5c')](_0x197525[_0xc3f0('0x59')]['toLowerCase'](),_0xc3f0('0x5d'))){var _0x1f1f2c=_0x197525[_0xc3f0('0x59')][_0xc3f0('0x5e')]('=');var _0x1690e7=_0x1f1f2c[0x0][_0xc3f0('0x5f')](_0x1f1f2c[0x0][_0xc3f0('0x60')]('(')+0x1,_0x1f1f2c[0x0][_0xc3f0('0x60')](')'));var _0x410b27=_0x1f1f2c[0x1];channels[_0x197525[_0xc3f0('0x6')]][_0x1690e7]=_0x410b27;}if(!_[_0xc3f0('0x61')](['hangup',_0xc3f0('0x62'),'execif',_0xc3f0('0x5b'),'gotoif'],_0x197525['application'][_0xc3f0('0x5a')]())){channels[_0x197525[_0xc3f0('0x6')]][_0xc3f0('0x63')]=_0x197525[_0xc3f0('0x58')];channels[_0x197525[_0xc3f0('0x6')]][_0xc3f0('0x4b')]=_0x197525[_0xc3f0('0x59')];}}}catch(_0x1d9253){utils[_0xc3f0('0x19')](util[_0xc3f0('0x4')](_0xc3f0('0x56'),_0x197525['uniqueid']),_0x1d9253);}}; \ No newline at end of file +var _0xfeb8=['[%s][calls][newexten]','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','execif','gotoif','lastdata','lodash','util','./utils','FAILED','NO\x20ANSWER','BUSY','info','format','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','newstate','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','ANSWERED','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','error','attendedtransfer','[%s][calls][attendedtransfer]','localtwolinkedid','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','sipcallid','[%s][calls][varset]','newexten'];(function(_0x52a7e1,_0x189bf3){var _0x4f4495=function(_0x5d1915){while(--_0x5d1915){_0x52a7e1['push'](_0x52a7e1['shift']());}};_0x4f4495(++_0x189bf3);}(_0xfeb8,0x14a));var _0x8feb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfeb8[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8feb('0x0'));var util=require(_0x8feb('0x1'));var utils=require(_0x8feb('0x2'));var dispositions=['NO\x20ANSWER',_0x8feb('0x3'),_0x8feb('0x3'),_0x8feb('0x4'),_0x8feb('0x4'),_0x8feb('0x4'),'ANSWERED',_0x8feb('0x5'),'FAILED',_0x8feb('0x3'),_0x8feb('0x3')];var channels={};function writeDB(_0x3b80a7){utils[_0x8feb('0x6')](util[_0x8feb('0x7')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x3b80a7['uniqueid'],_0x3b80a7[_0x8feb('0x8')],_0x3b80a7[_0x8feb('0x9')],_0x3b80a7[_0x8feb('0xa')],_0x3b80a7[_0x8feb('0xb')],_0x3b80a7[_0x8feb('0xc')],_0x3b80a7[_0x8feb('0xd')],_0x3b80a7[_0x8feb('0xe')]));if(_0x3b80a7[_0x8feb('0xf')]){utils[_0x8feb('0x10')](_0x3b80a7[_0x8feb('0xf')])[_0x8feb('0x11')](function(_0x1cab4e){if(_0x1cab4e){_0x3b80a7[_0x8feb('0x12')]=_0x1cab4e['id'];}utils[_0x8feb('0x13')](_0x8feb('0x14'),_0x3b80a7);});}else{utils[_0x8feb('0x13')]('CreateVoiceCallReport',_0x3b80a7);}if(channels[_0x3b80a7[_0x8feb('0x15')]]){delete channels[_0x3b80a7[_0x8feb('0x15')]];}}exports[_0x8feb('0x16')]=function(_0x1109e7){try{utils['debug'](util['format'](_0x8feb('0x17'),_0x1109e7[_0x8feb('0x15')]),_0x1109e7);if(_0x1109e7[_0x8feb('0x15')]==_0x1109e7[_0x8feb('0x18')]&&_0x1109e7['channel']!=_0x8feb('0x19')){utils[_0x8feb('0x6')](util[_0x8feb('0x7')](_0x8feb('0x1a'),_0x1109e7[_0x8feb('0x15')],_0x1109e7[_0x8feb('0x1b')],_0x1109e7[_0x8feb('0x1c')]));channels[_0x1109e7['uniqueid']]={'uniqueid':_0x1109e7[_0x8feb('0x15')],'accountcode':_0x1109e7[_0x8feb('0xf')],'source':_0x1109e7[_0x8feb('0xc')],'destination':_0x1109e7[_0x8feb('0x1c')],'destinationcontext':_0x1109e7[_0x8feb('0x1b')],'channel':_0x1109e7[_0x8feb('0x8')],'starttime':utils[_0x8feb('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x8feb('0x1e')};}}catch(_0x4dfdf3){utils['error'](util[_0x8feb('0x7')]('[%s][calls][newchannel]',_0x1109e7[_0x8feb('0x15')]),_0x4dfdf3);}};exports[_0x8feb('0x1f')]=function(_0x485351){try{utils[_0x8feb('0x20')](util[_0x8feb('0x7')](_0x8feb('0x21'),_0x485351[_0x8feb('0x15')]),_0x485351);if(!_[_0x8feb('0x22')](channels[_0x485351[_0x8feb('0x15')]])&&_0x485351[_0x8feb('0x23')]==0x6){utils[_0x8feb('0x6')](util[_0x8feb('0x7')](_0x8feb('0x24'),_0x485351['uniqueid'],_0x485351[_0x8feb('0x1b')],_0x485351[_0x8feb('0x8')]));if(_[_0x8feb('0x22')](channels[_0x485351[_0x8feb('0x15')]][_0x8feb('0x25')])){channels[_0x485351[_0x8feb('0x15')]][_0x8feb('0x25')]=utils[_0x8feb('0x1d')]();}}else if(!_[_0x8feb('0x22')](channels[_0x485351[_0x8feb('0x18')]])&&_0x485351[_0x8feb('0x23')]==0x6&&_0x485351[_0x8feb('0x1b')]!=_0x8feb('0x26')){utils[_0x8feb('0x6')](util[_0x8feb('0x7')](_0x8feb('0x27'),_0x485351[_0x8feb('0x15')],_0x485351[_0x8feb('0x18')],_0x485351[_0x8feb('0x1b')],_0x485351[_0x8feb('0x8')]));channels[_0x485351[_0x8feb('0x18')]][_0x8feb('0xf')]=_0x485351[_0x8feb('0xf')];channels[_0x485351[_0x8feb('0x18')]][_0x8feb('0x28')]=_0x485351[_0x8feb('0x8')];if(_[_0x8feb('0x22')](channels[_0x485351[_0x8feb('0x18')]][_0x8feb('0x29')])){channels[_0x485351[_0x8feb('0x18')]][_0x8feb('0x29')]=utils[_0x8feb('0x1d')]();}channels[_0x485351['linkedid']][_0x8feb('0x2a')]=dispositions[_[_0x8feb('0x2b')](_0x485351['channelstate'])]||_0x8feb('0x2c');}}catch(_0x98f1da){utils['error'](util[_0x8feb('0x7')](_0x8feb('0x21'),_0x485351[_0x8feb('0x15')]),_0x98f1da);}};exports[_0x8feb('0x2d')]=function(_0x62db54){try{if(!_[_0x8feb('0x22')](channels[_0x62db54[_0x8feb('0x15')]])){utils[_0x8feb('0x20')](util[_0x8feb('0x7')]('[%s][calls][hangup]',_0x62db54[_0x8feb('0x15')]),_0x62db54);if(_[_0x8feb('0x22')](channels[_0x62db54[_0x8feb('0x15')]][_0x8feb('0x2e')])){channels[_0x62db54[_0x8feb('0x15')]]['callerid']=_0x62db54[_0x8feb('0x2f')]+'\x20<'+_0x62db54[_0x8feb('0xc')]+'>';}utils[_0x8feb('0x6')](util[_0x8feb('0x7')](_0x8feb('0x30'),_0x62db54[_0x8feb('0x15')],channels[_0x62db54[_0x8feb('0x15')]][_0x8feb('0x2e')],_0x62db54[_0x8feb('0x31')]));channels[_0x62db54['uniqueid']][_0x8feb('0x32')]=utils[_0x8feb('0x1d')]();channels[_0x62db54[_0x8feb('0x15')]][_0x8feb('0x33')]=utils[_0x8feb('0x34')](channels[_0x62db54[_0x8feb('0x15')]][_0x8feb('0x32')],channels[_0x62db54['uniqueid']][_0x8feb('0x35')]);channels[_0x62db54[_0x8feb('0x15')]][_0x8feb('0x36')]=channels[_0x62db54[_0x8feb('0x15')]]['answertime']?utils['diffTime'](channels[_0x62db54[_0x8feb('0x15')]][_0x8feb('0x32')],channels[_0x62db54[_0x8feb('0x15')]][_0x8feb('0x29')]):0x0;writeDB(channels[_0x62db54['uniqueid']]);}}catch(_0x54d0ab){utils[_0x8feb('0x37')](util[_0x8feb('0x7')]('[%s][calls][hangup]',_0x62db54[_0x8feb('0x15')]),_0x54d0ab);}};exports[_0x8feb('0x38')]=function(_0x153f81){try{if(!_[_0x8feb('0x22')](channels[_0x153f81['localtwolinkedid']])){utils[_0x8feb('0x20')](util[_0x8feb('0x7')](_0x8feb('0x39'),_0x153f81['origtransfereruniqueid']),_0x153f81);if(channels[_0x153f81[_0x8feb('0x3a')]][_0x8feb('0x8')]==_0x153f81['transfereechannel']){utils[_0x8feb('0x6')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x153f81[_0x8feb('0x3b')],_0x153f81[_0x8feb('0x3a')],_0x153f81['secondtransfererchannel']));channels[_0x153f81[_0x8feb('0x3a')]][_0x8feb('0x28')]=_0x153f81[_0x8feb('0x3c')];channels[_0x153f81[_0x8feb('0x3a')]][_0x8feb('0x3d')]=_0x8feb('0x3e');}else if(channels[_0x153f81[_0x8feb('0x3a')]][_0x8feb('0x8')]=_0x153f81[_0x8feb('0x3f')]){utils[_0x8feb('0x6')](util[_0x8feb('0x7')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x153f81[_0x8feb('0x3b')],_0x153f81['localtwolinkedid'],_0x153f81[_0x8feb('0x40')]));channels[_0x153f81[_0x8feb('0x3a')]][_0x8feb('0x28')]=_0x153f81[_0x8feb('0x40')];channels[_0x153f81[_0x8feb('0x3a')]][_0x8feb('0x3d')]=_0x8feb('0x3e');}}}catch(_0x27df47){utils[_0x8feb('0x37')](util[_0x8feb('0x7')](_0x8feb('0x39'),_0x153f81[_0x8feb('0x3b')]),_0x27df47);}};exports[_0x8feb('0x41')]=function(_0x2c006d){try{if(!_[_0x8feb('0x22')](channels[_0x2c006d[_0x8feb('0x15')]])){utils['debug'](util[_0x8feb('0x7')](_0x8feb('0x42'),_0x2c006d['uniqueid']),_0x2c006d);channels[_0x2c006d[_0x8feb('0x15')]][_0x8feb('0x43')]=utils['now']();utils[_0x8feb('0x6')](util['format'](_0x8feb('0x44'),_0x2c006d['uniqueid'],channels[_0x2c006d[_0x8feb('0x15')]]['musiconholdstartAt']));}}catch(_0x44d8c5){utils[_0x8feb('0x37')](util[_0x8feb('0x7')]('[%s][calls][musiconholdstart]',_0x2c006d[_0x8feb('0x15')]),_0x44d8c5);}};exports[_0x8feb('0x45')]=function(_0xed923b){try{if(!_[_0x8feb('0x22')](channels[_0xed923b[_0x8feb('0x15')]])){utils[_0x8feb('0x20')](util[_0x8feb('0x7')]('[%s][calls][musiconholdstop]',_0xed923b[_0x8feb('0x15')]),_0xed923b);if(!_[_0x8feb('0x22')](channels[_0xed923b['uniqueid']]['musiconholdstartAt'])){channels[_0xed923b[_0x8feb('0x15')]][_0x8feb('0x46')]+=utils[_0x8feb('0x34')](utils['now'](),channels[_0xed923b['uniqueid']][_0x8feb('0x43')]);utils['info'](util[_0x8feb('0x7')](_0x8feb('0x47'),_0xed923b['uniqueid'],channels[_0xed923b[_0x8feb('0x15')]][_0x8feb('0x46')]));delete channels[_0xed923b[_0x8feb('0x15')]][_0x8feb('0x43')];}}}catch(_0x1849bd){utils[_0x8feb('0x37')](util[_0x8feb('0x7')](_0x8feb('0x48'),_0xed923b[_0x8feb('0x15')]),_0x1849bd);}};exports[_0x8feb('0x49')]=function(_0x26b796){try{if(!_[_0x8feb('0x22')](channels[_0x26b796[_0x8feb('0x15')]])){utils[_0x8feb('0x20')](util['format']('[%s][calls][varset]',_0x26b796[_0x8feb('0x15')]),_0x26b796);if(!_[_0x8feb('0x22')](_0x26b796['variable']['xmd-originatecalleridnum'])){utils[_0x8feb('0x6')](util[_0x8feb('0x7')](_0x8feb('0x4a'),_0x26b796[_0x8feb('0x15')],_0x26b796[_0x8feb('0x4b')]));channels[_0x26b796[_0x8feb('0x15')]][_0x8feb('0x4c')]=_0x26b796['value'];}if(!_[_0x8feb('0x22')](_0x26b796[_0x8feb('0x4d')]['xmd-phone'])){utils[_0x8feb('0x6')](util['format'](_0x8feb('0x4e'),_0x26b796[_0x8feb('0x15')],_0x26b796[_0x8feb('0x4b')]));channels[_0x26b796['uniqueid']][_0x8feb('0x4f')]=_0x26b796[_0x8feb('0x4b')];channels[_0x26b796[_0x8feb('0x15')]]['callerid']='\x22'+_0x26b796[_0x8feb('0x4b')]+_0x8feb('0x50')+_0x26b796[_0x8feb('0x4b')]+'>';}if(!_[_0x8feb('0x22')](_0x26b796[_0x8feb('0x4d')][_0x8feb('0x51')])||!_[_0x8feb('0x22')](_0x26b796[_0x8feb('0x4d')]['xmd-callerid'])){utils[_0x8feb('0x6')](util['format'](_0x8feb('0x52'),_0x26b796['uniqueid'],!_[_0x8feb('0x22')](_0x26b796['variable'][_0x8feb('0x51')])?'xmd-callerid-preview':_0x8feb('0x53'),_0x26b796[_0x8feb('0x4b')]));channels[_0x26b796[_0x8feb('0x15')]][_0x8feb('0x2e')]=_0x26b796[_0x8feb('0x4b')];}if(!_['isNil'](_0x26b796[_0x8feb('0x4d')][_0x8feb('0x54')])||!_['isNil'](_0x26b796[_0x8feb('0x4d')][_0x8feb('0x55')])){utils['info'](util['format'](_0x8feb('0x52'),_0x26b796[_0x8feb('0x15')],!_[_0x8feb('0x22')](_0x26b796[_0x8feb('0x4d')][_0x8feb('0x54')])?_0x8feb('0x54'):_0x8feb('0x55'),_0x26b796[_0x8feb('0x4b')]));channels[_0x26b796[_0x8feb('0x15')]][_0x8feb('0x56')]=_0x8feb('0x57');channels[_0x26b796[_0x8feb('0x15')]]['lastdata']=_0x26b796[_0x8feb('0x4b')];channels[_0x26b796[_0x8feb('0x15')]][_0x8feb('0x9')]=!![];}if(!_['isNil'](_0x26b796[_0x8feb('0x4d')]['xmd-contactid'])){utils[_0x8feb('0x6')](util[_0x8feb('0x7')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x26b796[_0x8feb('0x15')],_0x26b796[_0x8feb('0x4b')]));channels[_0x26b796[_0x8feb('0x15')]]['ContactId']=_0x26b796[_0x8feb('0x4b')];}if(!_['isNil'](_0x26b796[_0x8feb('0x4d')]['xmd-cdrtype'])){utils['info'](util[_0x8feb('0x7')](_0x8feb('0x58'),_0x26b796['uniqueid'],_0x26b796[_0x8feb('0x4b')]));channels[_0x26b796['uniqueid']]['type']=_0x26b796[_0x8feb('0x4b')];}if(!_[_0x8feb('0x22')](_0x26b796['variable'][_0x8feb('0x59')])){utils[_0x8feb('0x6')](util[_0x8feb('0x7')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x26b796[_0x8feb('0x15')],_0x26b796['value']));channels[_0x26b796[_0x8feb('0x15')]][_0x8feb('0x5a')]=_0x26b796[_0x8feb('0x4b')];}if(!_[_0x8feb('0x22')](_0x26b796[_0x8feb('0x4d')][_0x8feb('0x5b')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x26b796[_0x8feb('0x15')],_0x26b796[_0x8feb('0x4b')]));channels[_0x26b796[_0x8feb('0x15')]][_0x8feb('0x5b')]=_0x26b796['value'];}}}catch(_0x1e5dde){utils[_0x8feb('0x37')](util[_0x8feb('0x7')](_0x8feb('0x5c'),_0x26b796['uniqueid']),_0x1e5dde);}};exports[_0x8feb('0x5d')]=function(_0x154e7d){try{if(!_['isNil'](channels[_0x154e7d[_0x8feb('0x15')]])){utils['debug'](util[_0x8feb('0x7')](_0x8feb('0x5e'),_0x154e7d['uniqueid']),_0x154e7d);utils[_0x8feb('0x6')](util[_0x8feb('0x7')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x154e7d['uniqueid'],_0x154e7d[_0x8feb('0x5f')],_0x154e7d[_0x8feb('0x60')]));if(_0x154e7d['application'][_0x8feb('0x61')]()==_0x8feb('0x62')&&_[_0x8feb('0x63')](_0x154e7d['appdata'][_0x8feb('0x61')](),'cdr')){var _0x42d90b=_0x154e7d[_0x8feb('0x60')][_0x8feb('0x64')]('=');var _0x45f62c=_0x42d90b[0x0][_0x8feb('0x65')](_0x42d90b[0x0][_0x8feb('0x66')]('(')+0x1,_0x42d90b[0x0]['lastIndexOf'](')'));var _0x120b30=_0x42d90b[0x1];channels[_0x154e7d[_0x8feb('0x15')]][_0x45f62c]=_0x120b30;}if(!_['includes']([_0x8feb('0x2d'),'noop',_0x8feb('0x67'),_0x8feb('0x62'),_0x8feb('0x68')],_0x154e7d[_0x8feb('0x5f')]['toLowerCase']())){channels[_0x154e7d[_0x8feb('0x15')]]['lastapplication']=_0x154e7d[_0x8feb('0x5f')];channels[_0x154e7d[_0x8feb('0x15')]][_0x8feb('0x69')]=_0x154e7d[_0x8feb('0x60')];}}}catch(_0x3f9008){utils['error'](util[_0x8feb('0x7')](_0x8feb('0x5e'),_0x154e7d['uniqueid']),_0x3f9008);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 3247dd4..36784a6 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 _0x165f=['shutdown','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20close','managerevent','connect'];(function(_0xfc0976,_0x33776f){var _0x23579f=function(_0x4143d9){while(--_0x4143d9){_0xfc0976['push'](_0xfc0976['shift']());}};_0x23579f(++_0x33776f);}(_0x165f,0xaa));var _0xf165=function(_0x3149e1,_0x215aaa){_0x3149e1=_0x3149e1-0x0;var _0x12b4aa=_0x165f[_0x3149e1];return _0x12b4aa;};'use strict';var utils=require('./utils');exports[_0xf165('0x0')]=function(){utils['info']('[core]\x20connected');};exports[_0xf165('0x1')]=function(){utils[_0xf165('0x2')](_0xf165('0x3'));};exports[_0xf165('0x4')]=function(){utils[_0xf165('0x2')](_0xf165('0x5'));};exports['error']=function(_0x4b9501){utils[_0xf165('0x6')]('[core]\x20error',_0x4b9501);};exports['close']=function(){utils[_0xf165('0x2')](_0xf165('0x7'));};exports[_0xf165('0x8')]=function(_0x33332f){}; \ No newline at end of file +var _0x6ea4=['managerevent','./utils','connect','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close'];(function(_0x19eac2,_0x493870){var _0xb36199=function(_0x43d108){while(--_0x43d108){_0x19eac2['push'](_0x19eac2['shift']());}};_0xb36199(++_0x493870);}(_0x6ea4,0xd3));var _0x46ea=function(_0x1cd698,_0x50cbf7){_0x1cd698=_0x1cd698-0x0;var _0x212699=_0x6ea4[_0x1cd698];return _0x212699;};'use strict';var utils=require(_0x46ea('0x0'));exports[_0x46ea('0x1')]=function(){utils[_0x46ea('0x2')]('[core]\x20connected');};exports['shutdown']=function(){utils[_0x46ea('0x2')](_0x46ea('0x3'));};exports[_0x46ea('0x4')]=function(){utils[_0x46ea('0x2')](_0x46ea('0x5'));};exports[_0x46ea('0x6')]=function(_0x4eec50){utils['error'](_0x46ea('0x7'),_0x4eec50);};exports[_0x46ea('0x8')]=function(){utils[_0x46ea('0x2')]('[core]\x20close');};exports[_0x46ea('0x9')]=function(_0x2baaf0){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 2385a63..d51d453 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 _0xf2e9=['[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','starttime','now','called','dialend','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr(routeid)','error','varset'];(function(_0x921a27,_0x455730){var _0x4dd811=function(_0x24c223){while(--_0x24c223){_0x921a27['push'](_0x921a27['shift']());}};_0x4dd811(++_0x455730);}(_0xf2e9,0x164));var _0x9f2e=function(_0x25ff1f,_0xe2ac3e){_0x25ff1f=_0x25ff1f-0x0;var _0x247f6e=_0xf2e9[_0x25ff1f];return _0x247f6e;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x9f2e('0x0'));var dials={};function writeDB(_0xd6f9){utils[_0x9f2e('0x1')](util[_0x9f2e('0x2')](_0x9f2e('0x3'),_0xd6f9['uniqueid'],_0xd6f9['channel'],_0xd6f9[_0x9f2e('0x4')],_0xd6f9[_0x9f2e('0x5')],_0xd6f9[_0x9f2e('0x6')],_0xd6f9[_0x9f2e('0x7')]));utils[_0x9f2e('0x8')](_0x9f2e('0x9'),_0xd6f9);delete dials[_0xd6f9[_0x9f2e('0xa')]];}exports['newexten']=function(_0x55ee5e){try{utils[_0x9f2e('0xb')](util['format'](_0x9f2e('0xc'),_0x55ee5e['uniqueid']),_0x55ee5e);utils['info'](util[_0x9f2e('0x2')](_0x9f2e('0xd'),_0x55ee5e[_0x9f2e('0xa')],_0x55ee5e[_0x9f2e('0xe')],_0x55ee5e[_0x9f2e('0xf')]));if(_0x55ee5e['application'][_0x9f2e('0x10')]()=='set'&&_['startsWith'](_0x55ee5e['appdata'][_0x9f2e('0x10')](),_0x9f2e('0x11'))){var _0x4daac2=_0x55ee5e[_0x9f2e('0xf')]['split']('=');dials[_0x55ee5e[_0x9f2e('0xa')]]={'routeId':_0x4daac2[0x1]};}}catch(_0x3ef9fb){utils[_0x9f2e('0x12')](util['format'](_0x9f2e('0xc'),_0x55ee5e[_0x9f2e('0xa')]),_0x3ef9fb);}};exports[_0x9f2e('0x13')]=function(_0x59f59b){try{utils[_0x9f2e('0xb')](util[_0x9f2e('0x2')](_0x9f2e('0x14'),_0x59f59b[_0x9f2e('0xa')]),_0x59f59b);if(!_[_0x9f2e('0x15')](_0x59f59b[_0x9f2e('0x16')][_0x9f2e('0x17')])){utils[_0x9f2e('0x1')](util['format'](_0x9f2e('0x18'),_0x59f59b[_0x9f2e('0xa')],_0x59f59b[_0x9f2e('0x19')]));dials[_0x59f59b[_0x9f2e('0xa')]]={'routeId':_0x59f59b[_0x9f2e('0x19')]};}}catch(_0x4ece36){utils[_0x9f2e('0x12')](util[_0x9f2e('0x2')](_0x9f2e('0x14'),_0x59f59b['uniqueid']),_0x4ece36);}};exports['dialbegin']=function(_0x1be066){try{if(!_['isNil'](dials[_0x1be066['uniqueid']])){utils[_0x9f2e('0xb')](util['format'](_0x9f2e('0x1a'),_0x1be066[_0x9f2e('0xa')]),_0x1be066);dials[_0x1be066['uniqueid']]=_['assign'](dials[_0x1be066[_0x9f2e('0xa')]],_0x1be066);dials[_0x1be066['uniqueid']][_0x9f2e('0x1b')]=utils[_0x9f2e('0x1c')]();dials[_0x1be066[_0x9f2e('0xa')]]['lastevent']=_0x9f2e('0x1d');utils[_0x9f2e('0x1')](util[_0x9f2e('0x2')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x1be066[_0x9f2e('0xa')],dials[_0x1be066[_0x9f2e('0xa')]][_0x9f2e('0x1b')]));}}catch(_0x21390c){utils[_0x9f2e('0x12')](util[_0x9f2e('0x2')](_0x9f2e('0x1a'),_0x1be066['uniqueid']),_0x21390c);}};exports[_0x9f2e('0x1e')]=function(_0x47e004){try{if(!_['isNil'](dials[_0x47e004['uniqueid']])){utils[_0x9f2e('0xb')](util[_0x9f2e('0x2')]('[%s][dials][dialend]',_0x47e004[_0x9f2e('0xa')]),_0x47e004);dials[_0x47e004[_0x9f2e('0xa')]][_0x9f2e('0x7')]=_0x47e004[_0x9f2e('0x7')];if(_0x47e004[_0x9f2e('0x7')]=='ANSWER'){dials[_0x47e004[_0x9f2e('0xa')]]=_[_0x9f2e('0x1f')](dials[_0x47e004[_0x9f2e('0xa')]],_0x47e004);dials[_0x47e004[_0x9f2e('0xa')]][_0x9f2e('0x20')]=utils['now']();dials[_0x47e004[_0x9f2e('0xa')]]['lastevent']=_0x9f2e('0x21');utils[_0x9f2e('0x1')](util[_0x9f2e('0x2')](_0x9f2e('0x22'),_0x47e004['uniqueid'],_0x47e004['dialstatus'],dials[_0x47e004[_0x9f2e('0xa')]]['answertime']));}else{utils[_0x9f2e('0x1')](util[_0x9f2e('0x2')](_0x9f2e('0x23'),_0x47e004[_0x9f2e('0xa')],_0x47e004[_0x9f2e('0x7')]));}}}catch(_0x285b5f){utils['error'](util[_0x9f2e('0x2')](_0x9f2e('0x24'),_0x47e004[_0x9f2e('0xa')]),_0x285b5f);}};exports[_0x9f2e('0x25')]=function(_0xa170f){try{if(!_[_0x9f2e('0x15')](dials[_0xa170f[_0x9f2e('0xa')]])){utils[_0x9f2e('0xb')](util[_0x9f2e('0x2')](_0x9f2e('0x26'),_0xa170f[_0x9f2e('0xa')]),_0xa170f);utils[_0x9f2e('0x1')](util[_0x9f2e('0x2')](_0x9f2e('0x27'),_0xa170f['uniqueid'],_0xa170f[_0x9f2e('0x5')],_0xa170f[_0x9f2e('0x28')],_0xa170f[_0x9f2e('0x29')]));dials[_0xa170f[_0x9f2e('0xa')]]=_[_0x9f2e('0x1f')](dials[_0xa170f[_0x9f2e('0xa')]],{'endtime':utils['now'](),'lastevent':_0x9f2e('0x2a')});dials[_0xa170f[_0x9f2e('0xa')]][_0x9f2e('0x2b')]=utils[_0x9f2e('0x2c')](dials[_0xa170f[_0x9f2e('0xa')]][_0x9f2e('0x2d')],dials[_0xa170f[_0x9f2e('0xa')]][_0x9f2e('0x1b')]);dials[_0xa170f[_0x9f2e('0xa')]][_0x9f2e('0x2e')]=utils[_0x9f2e('0x2c')](dials[_0xa170f[_0x9f2e('0xa')]][_0x9f2e('0x20')]||dials[_0xa170f[_0x9f2e('0xa')]][_0x9f2e('0x2d')],dials[_0xa170f[_0x9f2e('0xa')]][_0x9f2e('0x1b')]);dials[_0xa170f[_0x9f2e('0xa')]]['billableseconds']=dials[_0xa170f[_0x9f2e('0xa')]][_0x9f2e('0x20')]?utils[_0x9f2e('0x2c')](dials[_0xa170f[_0x9f2e('0xa')]][_0x9f2e('0x2d')],dials[_0xa170f[_0x9f2e('0xa')]]['answertime']):0x0;writeDB(dials[_0xa170f['uniqueid']]);}}catch(_0xe19df6){utils['error'](util[_0x9f2e('0x2')]('[%s][dials][hangup]',_0xa170f[_0x9f2e('0xa')]),_0xe19df6);}}; \ No newline at end of file +var _0x724b=['request','CreateVoiceDialReport','debug','format','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','error','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','value','[%s][dials][dialbegin]','assign','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','now','complete','duration','diffTime','endtime','[%s][dials][hangup]','lodash','util','./utils','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','dialstatus'];(function(_0x1cc3ce,_0x43791e){var _0x4ac6ac=function(_0x15d789){while(--_0x15d789){_0x1cc3ce['push'](_0x1cc3ce['shift']());}};_0x4ac6ac(++_0x43791e);}(_0x724b,0x14e));var _0xb724=function(_0x26de05,_0x2db719){_0x26de05=_0x26de05-0x0;var _0x3d6b12=_0x724b[_0x26de05];return _0x3d6b12;};'use strict';var _=require(_0xb724('0x0'));var util=require(_0xb724('0x1'));var utils=require(_0xb724('0x2'));var dials={};function writeDB(_0x19f7af){utils['info'](util['format'](_0xb724('0x3'),_0x19f7af[_0xb724('0x4')],_0x19f7af[_0xb724('0x5')],_0x19f7af[_0xb724('0x6')],_0x19f7af[_0xb724('0x7')],_0x19f7af['connectedlinenum'],_0x19f7af[_0xb724('0x8')]));utils[_0xb724('0x9')](_0xb724('0xa'),_0x19f7af);delete dials[_0x19f7af[_0xb724('0x4')]];}exports['newexten']=function(_0x322027){try{utils[_0xb724('0xb')](util[_0xb724('0xc')]('[%s][dials][newexten]',_0x322027[_0xb724('0x4')]),_0x322027);utils[_0xb724('0xd')](util[_0xb724('0xc')](_0xb724('0xe'),_0x322027[_0xb724('0x4')],_0x322027[_0xb724('0xf')],_0x322027['appdata']));if(_0x322027[_0xb724('0xf')][_0xb724('0x10')]()==_0xb724('0x11')&&_[_0xb724('0x12')](_0x322027[_0xb724('0x13')][_0xb724('0x10')](),'cdr(routeid)')){var _0xaf9ab4=_0x322027[_0xb724('0x13')]['split']('=');dials[_0x322027[_0xb724('0x4')]]={'routeId':_0xaf9ab4[0x1]};}}catch(_0x2db64d){utils[_0xb724('0x14')](util[_0xb724('0xc')](_0xb724('0x15'),_0x322027[_0xb724('0x4')]),_0x2db64d);}};exports[_0xb724('0x16')]=function(_0x11fa7c){try{utils[_0xb724('0xb')](util[_0xb724('0xc')](_0xb724('0x17'),_0x11fa7c[_0xb724('0x4')]),_0x11fa7c);if(!_[_0xb724('0x18')](_0x11fa7c[_0xb724('0x19')][_0xb724('0x1a')])){utils['info'](util[_0xb724('0xc')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x11fa7c[_0xb724('0x4')],_0x11fa7c[_0xb724('0x1b')]));dials[_0x11fa7c[_0xb724('0x4')]]={'routeId':_0x11fa7c[_0xb724('0x1b')]};}}catch(_0x22543c){utils[_0xb724('0x14')](util[_0xb724('0xc')](_0xb724('0x17'),_0x11fa7c['uniqueid']),_0x22543c);}};exports['dialbegin']=function(_0x52a6e3){try{if(!_[_0xb724('0x18')](dials[_0x52a6e3[_0xb724('0x4')]])){utils[_0xb724('0xb')](util[_0xb724('0xc')](_0xb724('0x1c'),_0x52a6e3[_0xb724('0x4')]),_0x52a6e3);dials[_0x52a6e3['uniqueid']]=_[_0xb724('0x1d')](dials[_0x52a6e3[_0xb724('0x4')]],_0x52a6e3);dials[_0x52a6e3[_0xb724('0x4')]]['starttime']=utils['now']();dials[_0x52a6e3['uniqueid']][_0xb724('0x1e')]=_0xb724('0x1f');utils[_0xb724('0xd')](util[_0xb724('0xc')](_0xb724('0x20'),_0x52a6e3[_0xb724('0x4')],dials[_0x52a6e3[_0xb724('0x4')]][_0xb724('0x21')]));}}catch(_0x3e25c8){utils[_0xb724('0x14')](util[_0xb724('0xc')](_0xb724('0x1c'),_0x52a6e3[_0xb724('0x4')]),_0x3e25c8);}};exports[_0xb724('0x22')]=function(_0x3bcc6c){try{if(!_[_0xb724('0x18')](dials[_0x3bcc6c['uniqueid']])){utils[_0xb724('0xb')](util[_0xb724('0xc')]('[%s][dials][dialend]',_0x3bcc6c[_0xb724('0x4')]),_0x3bcc6c);dials[_0x3bcc6c['uniqueid']]['dialstatus']=_0x3bcc6c[_0xb724('0x8')];if(_0x3bcc6c['dialstatus']==_0xb724('0x23')){dials[_0x3bcc6c[_0xb724('0x4')]]=_[_0xb724('0x1d')](dials[_0x3bcc6c['uniqueid']],_0x3bcc6c);dials[_0x3bcc6c[_0xb724('0x4')]]['answertime']=utils['now']();dials[_0x3bcc6c[_0xb724('0x4')]][_0xb724('0x1e')]=_0xb724('0x24');utils[_0xb724('0xd')](util['format'](_0xb724('0x25'),_0x3bcc6c[_0xb724('0x4')],_0x3bcc6c[_0xb724('0x8')],dials[_0x3bcc6c[_0xb724('0x4')]][_0xb724('0x26')]));}else{utils[_0xb724('0xd')](util[_0xb724('0xc')](_0xb724('0x27'),_0x3bcc6c[_0xb724('0x4')],_0x3bcc6c[_0xb724('0x8')]));}}}catch(_0x47fa6a){utils[_0xb724('0x14')](util['format']('[%s][dials][dialend]',_0x3bcc6c[_0xb724('0x4')]),_0x47fa6a);}};exports[_0xb724('0x28')]=function(_0x58dffd){try{if(!_[_0xb724('0x18')](dials[_0x58dffd['uniqueid']])){utils[_0xb724('0xb')](util[_0xb724('0xc')]('[%s][dials][hangup]',_0x58dffd['uniqueid']),_0x58dffd);utils[_0xb724('0xd')](util[_0xb724('0xc')](_0xb724('0x29'),_0x58dffd[_0xb724('0x4')],_0x58dffd[_0xb724('0x7')],_0x58dffd['calleridname'],_0x58dffd[_0xb724('0x2a')]));dials[_0x58dffd[_0xb724('0x4')]]=_['assign'](dials[_0x58dffd[_0xb724('0x4')]],{'endtime':utils[_0xb724('0x2b')](),'lastevent':_0xb724('0x2c')});dials[_0x58dffd['uniqueid']][_0xb724('0x2d')]=utils[_0xb724('0x2e')](dials[_0x58dffd[_0xb724('0x4')]]['endtime'],dials[_0x58dffd[_0xb724('0x4')]][_0xb724('0x21')]);dials[_0x58dffd[_0xb724('0x4')]]['holdtime']=utils[_0xb724('0x2e')](dials[_0x58dffd['uniqueid']][_0xb724('0x26')]||dials[_0x58dffd[_0xb724('0x4')]][_0xb724('0x2f')],dials[_0x58dffd['uniqueid']][_0xb724('0x21')]);dials[_0x58dffd[_0xb724('0x4')]]['billableseconds']=dials[_0x58dffd['uniqueid']]['answertime']?utils[_0xb724('0x2e')](dials[_0x58dffd[_0xb724('0x4')]][_0xb724('0x2f')],dials[_0x58dffd[_0xb724('0x4')]][_0xb724('0x26')]):0x0;writeDB(dials[_0x58dffd[_0xb724('0x4')]]);}}catch(_0x599c1c){utils[_0xb724('0x14')](util['format'](_0xb724('0x30'),_0x58dffd['uniqueid']),_0x599c1c);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index f9f40c1..4e9486b 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 _0x44b6=['asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','error','close','format','[%s][index][devicestatechange]','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','attendedtransfer','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','dialend'];(function(_0x30ac04,_0x365f1b){var _0x56b497=function(_0x2e4724){while(--_0x2e4724){_0x30ac04['push'](_0x30ac04['shift']());}};_0x56b497(++_0x365f1b);}(_0x44b6,0xd8));var _0x644b=function(_0x522e32,_0x440e6d){_0x522e32=_0x522e32-0x0;var _0x216842=_0x44b6[_0x522e32];return _0x216842;};var AsteriskManager=require(_0x644b('0x0'));var config=require(_0x644b('0x1'));var utils=require(_0x644b('0x2'));var util=require(_0x644b('0x3'));var isXDREnabled=config[_0x644b('0x4')]&&config[_0x644b('0x4')][_0x644b('0x5')]?!config[_0x644b('0x4')][_0x644b('0x5')]:!![];var isProduction=config[_0x644b('0x6')]===_0x644b('0x7')||![];var isLocalAsterisk=config[_0x644b('0x4')]&&config[_0x644b('0x4')][_0x644b('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x644b('0x9')][_0x644b('0xa')],config[_0x644b('0x9')]['ip'],config['asterisk'][_0x644b('0xb')],config[_0x644b('0x9')][_0x644b('0xc')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x644b('0xd')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x644b('0xe'));}else{var agents=require(_0x644b('0xf'));var calls=require(_0x644b('0x10'));var queues=require(_0x644b('0x11'));var recordings=require(_0x644b('0x12'));var members=require(_0x644b('0x13'));var dials=require(_0x644b('0x14'));var transfers=require(_0x644b('0x15'));var core=require(_0x644b('0x16'));ami['on'](_0x644b('0x17'),core['connect']);ami['on']('shutdown',core[_0x644b('0x18')]);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0x644b('0x19'),core['error']);ami['on'](_0x644b('0x1a'),core[_0x644b('0x1a')]);ami['on']('managerevent',core['managerevent']);ami['on']('devicestatechange',function(_0x3a0e9e){try{utils['debug'](util[_0x644b('0x1b')](_0x644b('0x1c'),_0x3a0e9e['device']),_0x3a0e9e);members['devicestatechange'](_0x3a0e9e);}catch(_0x172014){utils[_0x644b('0x19')](util[_0x644b('0x1b')](_0x644b('0x1c'),_0x3a0e9e[_0x644b('0x1d')]),_0x172014);}});ami['on'](_0x644b('0x1e'),function(_0x228572){try{utils[_0x644b('0x1f')](util[_0x644b('0x1b')]('[%s][index][agentcalled]',_0x228572['uniqueid']),_0x228572);agents['agentcalled'](_0x228572);}catch(_0x4a32a6){utils[_0x644b('0x19')](util['format'](_0x644b('0x20'),_0x228572[_0x644b('0x21')]),_0x4a32a6);}});ami['on']('agentringnoanswer',function(_0x99341b){try{utils[_0x644b('0x1f')](util['format'](_0x644b('0x22'),_0x99341b[_0x644b('0x21')]),_0x99341b);agents[_0x644b('0x23')](_0x99341b);}catch(_0x2b75bb){utils[_0x644b('0x19')](util[_0x644b('0x1b')](_0x644b('0x22'),_0x99341b[_0x644b('0x21')]),_0x2b75bb);}});ami['on'](_0x644b('0x24'),function(_0x477362){try{utils[_0x644b('0x1f')](util['format']('[%s][index][agentconnect]',_0x477362[_0x644b('0x21')]),_0x477362);agents[_0x644b('0x24')](_0x477362);queues[_0x644b('0x24')](_0x477362);}catch(_0x2068c7){utils[_0x644b('0x19')](util['format'](_0x644b('0x25'),_0x477362[_0x644b('0x21')]),_0x2068c7);}});ami['on'](_0x644b('0x26'),function(_0x3c1f5a){try{utils['debug'](util[_0x644b('0x1b')](_0x644b('0x27'),_0x3c1f5a[_0x644b('0x21')]),_0x3c1f5a);agents[_0x644b('0x26')](_0x3c1f5a);queues['agentcomplete'](_0x3c1f5a);members['agentcomplete'](_0x3c1f5a);}catch(_0x3daf6c){utils[_0x644b('0x19')](util[_0x644b('0x1b')](_0x644b('0x27'),_0x3c1f5a[_0x644b('0x21')]),_0x3daf6c);}});ami['on'](_0x644b('0x28'),function(_0x2b02cd){try{utils['debug'](util[_0x644b('0x1b')](_0x644b('0x29'),_0x2b02cd[_0x644b('0x21')]),_0x2b02cd);agents[_0x644b('0x28')](_0x2b02cd);queues['queuecallerabandon'](_0x2b02cd);}catch(_0x570311){utils[_0x644b('0x19')](util[_0x644b('0x1b')]('[%s][index][queuecallerabandon]',_0x2b02cd['uniqueid']),_0x570311);}});ami['on'](_0x644b('0x2a'),function(_0x4e2db3){try{utils[_0x644b('0x1f')](util[_0x644b('0x1b')](_0x644b('0x2b'),_0x4e2db3[_0x644b('0x21')]),_0x4e2db3);queues['queuecallerjoin'](_0x4e2db3);recordings['queuecallerjoin'](_0x4e2db3);}catch(_0x3dbe18){utils[_0x644b('0x19')](util['format']('[%s][index][queuecallerjoin]',_0x4e2db3[_0x644b('0x21')]),_0x3dbe18);}});ami['on'](_0x644b('0x2c'),function(_0x146dfb){try{utils[_0x644b('0x1f')](util[_0x644b('0x1b')](_0x644b('0x2d'),_0x146dfb[_0x644b('0x21')]),_0x146dfb);queues[_0x644b('0x2c')](_0x146dfb);}catch(_0x2dc78d){utils[_0x644b('0x19')](util[_0x644b('0x1b')](_0x644b('0x2d'),_0x146dfb[_0x644b('0x21')]),_0x2dc78d);}});ami['on']('musiconholdstart',function(_0x77edd7){try{utils[_0x644b('0x1f')](util['format']('[%s][index][musiconholdstart]',_0x77edd7['uniqueid']),_0x77edd7);queues[_0x644b('0x2e')](_0x77edd7);calls[_0x644b('0x2e')](_0x77edd7);}catch(_0x42564f){utils[_0x644b('0x19')](util[_0x644b('0x1b')](_0x644b('0x2f'),_0x77edd7[_0x644b('0x21')]),_0x42564f);}});ami['on'](_0x644b('0x30'),function(_0x12ad7d){try{utils[_0x644b('0x1f')](util[_0x644b('0x1b')](_0x644b('0x31'),_0x12ad7d['uniqueid']),_0x12ad7d);queues[_0x644b('0x30')](_0x12ad7d);calls[_0x644b('0x30')](_0x12ad7d);}catch(_0x5df3d8){utils['error'](util[_0x644b('0x1b')](_0x644b('0x31'),_0x12ad7d[_0x644b('0x21')]),_0x5df3d8);}});ami['on'](_0x644b('0x32'),function(_0x1f0477){try{utils[_0x644b('0x1f')](util[_0x644b('0x1b')]('[%s][index][newstate]',_0x1f0477[_0x644b('0x21')]),_0x1f0477);calls['newstate'](_0x1f0477);recordings[_0x644b('0x32')](_0x1f0477);}catch(_0x40b37d){utils['error'](util[_0x644b('0x1b')](_0x644b('0x33'),_0x1f0477[_0x644b('0x21')]),_0x40b37d);}});ami['on']('hangup',function(_0x5c2c3b){try{utils[_0x644b('0x1f')](util[_0x644b('0x1b')]('[%s][index][hangup]',_0x5c2c3b[_0x644b('0x21')]),_0x5c2c3b);calls[_0x644b('0x34')](_0x5c2c3b);recordings[_0x644b('0x34')](_0x5c2c3b);dials['hangup'](_0x5c2c3b);agents[_0x644b('0x34')](_0x5c2c3b);queues['hangup'](_0x5c2c3b);}catch(_0x2a0f81){utils['error'](util['format'](_0x644b('0x35'),_0x5c2c3b[_0x644b('0x21')]),_0x2a0f81);}});ami['on'](_0x644b('0x36'),function(_0xb34319){try{utils[_0x644b('0x1f')](util[_0x644b('0x1b')](_0x644b('0x37'),_0xb34319['uniqueid']),_0xb34319);members[_0x644b('0x36')](_0xb34319);}catch(_0x48eeb2){utils[_0x644b('0x19')](util['format'](_0x644b('0x37'),_0xb34319[_0x644b('0x21')]),_0x48eeb2);}});ami['on'](_0x644b('0x38'),function(_0x228140){try{utils[_0x644b('0x1f')](util['format'](_0x644b('0x39'),_0x228140[_0x644b('0x21')]),_0x228140);queues[_0x644b('0x38')](_0x228140);agents[_0x644b('0x38')](_0x228140);transfers[_0x644b('0x38')](_0x228140);}catch(_0x607cbe){utils['error'](util[_0x644b('0x1b')](_0x644b('0x39'),_0x228140[_0x644b('0x21')]),_0x607cbe);}});ami['on']('attendedtransfer',function(_0x85df9e){try{utils['debug'](util[_0x644b('0x1b')](_0x644b('0x3a'),_0x85df9e['origtransfereruniqueid']),_0x85df9e);queues['attendedtransfer'](_0x85df9e);transfers[_0x644b('0x3b')](_0x85df9e);agents['attendedtransfer'](_0x85df9e);calls['attendedtransfer'](_0x85df9e);}catch(_0x185454){utils[_0x644b('0x19')](util['format'](_0x644b('0x3a'),_0x85df9e[_0x644b('0x3c')]),_0x185454);}});ami['on'](_0x644b('0x3d'),function(_0x3090e2){try{utils[_0x644b('0x1f')](util[_0x644b('0x1b')](_0x644b('0x3e'),_0x3090e2[_0x644b('0x21')]),_0x3090e2);queues[_0x644b('0x3d')](_0x3090e2);recordings[_0x644b('0x3d')](_0x3090e2);calls[_0x644b('0x3d')](_0x3090e2);dials[_0x644b('0x3d')](_0x3090e2);}catch(_0x5d4b0a){utils['error'](util[_0x644b('0x1b')](_0x644b('0x3e'),_0x3090e2['uniqueid']),_0x5d4b0a);}});ami['on'](_0x644b('0x3f'),function(_0x2c23ed){try{utils['debug'](util['format'](_0x644b('0x40'),_0x2c23ed[_0x644b('0x21')]),_0x2c23ed);calls[_0x644b('0x3f')](_0x2c23ed);recordings['newexten'](_0x2c23ed);dials[_0x644b('0x3f')](_0x2c23ed);}catch(_0x5280c1){utils[_0x644b('0x19')](util[_0x644b('0x1b')](_0x644b('0x40'),_0x2c23ed[_0x644b('0x21')]),_0x5280c1);}});ami['on'](_0x644b('0x41'),function(_0x37f4e7){try{utils['debug'](util[_0x644b('0x1b')](_0x644b('0x42'),_0x37f4e7[_0x644b('0x21')]),_0x37f4e7);calls[_0x644b('0x41')](_0x37f4e7);recordings[_0x644b('0x41')](_0x37f4e7);}catch(_0xcdd7a0){utils[_0x644b('0x19')](util[_0x644b('0x1b')]('[%s][index][newchannel]',_0x37f4e7[_0x644b('0x21')]),_0xcdd7a0);}});ami['on'](_0x644b('0x43'),function(_0x4ee8d0){try{utils[_0x644b('0x1f')](util[_0x644b('0x1b')](_0x644b('0x44'),_0x4ee8d0[_0x644b('0x21')]),_0x4ee8d0);dials[_0x644b('0x43')](_0x4ee8d0);}catch(_0x533177){utils[_0x644b('0x19')](util[_0x644b('0x1b')](_0x644b('0x45'),_0x4ee8d0[_0x644b('0x21')]),_0x533177);}});ami['on']('dialend',function(_0x25f9c1){try{utils[_0x644b('0x1f')](util['format'](_0x644b('0x46'),_0x25f9c1[_0x644b('0x21')]),_0x25f9c1);dials[_0x644b('0x47')](_0x25f9c1);}catch(_0x2d74ba){utils[_0x644b('0x19')](util['format'](_0x644b('0x46'),_0x25f9c1[_0x644b('0x21')]),_0x2d74ba);}});} \ No newline at end of file +var _0xd6c6=['[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','asterisk','port','username','password','keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop'];(function(_0x501f73,_0x42b7d7){var _0x345aa0=function(_0xee37d){while(--_0xee37d){_0x501f73['push'](_0x501f73['shift']());}};_0x345aa0(++_0x42b7d7);}(_0xd6c6,0x136));var _0x6d6c=function(_0x325c,_0x28f823){_0x325c=_0x325c-0x0;var _0x4eb07c=_0xd6c6[_0x325c];return _0x4eb07c;};var AsteriskManager=require(_0x6d6c('0x0'));var config=require(_0x6d6c('0x1'));var utils=require(_0x6d6c('0x2'));var util=require(_0x6d6c('0x3'));var isXDREnabled=config[_0x6d6c('0x4')]&&config['xdr'][_0x6d6c('0x5')]?!config['xdr'][_0x6d6c('0x5')]:!![];var isProduction=config[_0x6d6c('0x6')]===_0x6d6c('0x7')||![];var isLocalAsterisk=config[_0x6d6c('0x4')]&&config[_0x6d6c('0x4')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x6d6c('0x8')][_0x6d6c('0x9')],config[_0x6d6c('0x8')]['ip'],config['asterisk'][_0x6d6c('0xa')],config[_0x6d6c('0x8')][_0x6d6c('0xb')],!![]);ami[_0x6d6c('0xc')]();if(!isXDREnabled){utils['info'](_0x6d6c('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x6d6c('0xe')](_0x6d6c('0xf'));}else{var agents=require(_0x6d6c('0x10'));var calls=require(_0x6d6c('0x11'));var queues=require(_0x6d6c('0x12'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0x6d6c('0x13'));var transfers=require('./transfers.controller');var core=require(_0x6d6c('0x14'));ami['on']('connect',core[_0x6d6c('0x15')]);ami['on'](_0x6d6c('0x16'),core['shutdown']);ami['on'](_0x6d6c('0x17'),core[_0x6d6c('0x17')]);ami['on']('error',core[_0x6d6c('0x18')]);ami['on'](_0x6d6c('0x19'),core[_0x6d6c('0x19')]);ami['on'](_0x6d6c('0x1a'),core[_0x6d6c('0x1a')]);ami['on'](_0x6d6c('0x1b'),function(_0x4618d8){try{utils[_0x6d6c('0x1c')](util[_0x6d6c('0x1d')](_0x6d6c('0x1e'),_0x4618d8[_0x6d6c('0x1f')]),_0x4618d8);members[_0x6d6c('0x1b')](_0x4618d8);}catch(_0x4932f1){utils[_0x6d6c('0x18')](util['format'](_0x6d6c('0x1e'),_0x4618d8[_0x6d6c('0x1f')]),_0x4932f1);}});ami['on'](_0x6d6c('0x20'),function(_0x30a760){try{utils['debug'](util['format'](_0x6d6c('0x21'),_0x30a760[_0x6d6c('0x22')]),_0x30a760);agents[_0x6d6c('0x20')](_0x30a760);}catch(_0x3e3748){utils[_0x6d6c('0x18')](util['format'](_0x6d6c('0x21'),_0x30a760['uniqueid']),_0x3e3748);}});ami['on'](_0x6d6c('0x23'),function(_0x1db6a3){try{utils[_0x6d6c('0x1c')](util['format']('[%s][index][agentringnoanswer]',_0x1db6a3['uniqueid']),_0x1db6a3);agents['agentringnoanswer'](_0x1db6a3);}catch(_0x333d0a){utils[_0x6d6c('0x18')](util['format'](_0x6d6c('0x24'),_0x1db6a3[_0x6d6c('0x22')]),_0x333d0a);}});ami['on'](_0x6d6c('0x25'),function(_0x304b7d){try{utils[_0x6d6c('0x1c')](util[_0x6d6c('0x1d')](_0x6d6c('0x26'),_0x304b7d[_0x6d6c('0x22')]),_0x304b7d);agents[_0x6d6c('0x25')](_0x304b7d);queues[_0x6d6c('0x25')](_0x304b7d);}catch(_0x5277c9){utils[_0x6d6c('0x18')](util['format'](_0x6d6c('0x26'),_0x304b7d[_0x6d6c('0x22')]),_0x5277c9);}});ami['on'](_0x6d6c('0x27'),function(_0xc4b11f){try{utils[_0x6d6c('0x1c')](util[_0x6d6c('0x1d')](_0x6d6c('0x28'),_0xc4b11f[_0x6d6c('0x22')]),_0xc4b11f);agents[_0x6d6c('0x27')](_0xc4b11f);queues[_0x6d6c('0x27')](_0xc4b11f);members[_0x6d6c('0x27')](_0xc4b11f);}catch(_0x7229e5){utils[_0x6d6c('0x18')](util[_0x6d6c('0x1d')](_0x6d6c('0x28'),_0xc4b11f[_0x6d6c('0x22')]),_0x7229e5);}});ami['on'](_0x6d6c('0x29'),function(_0x154dae){try{utils[_0x6d6c('0x1c')](util['format']('[%s][index][queuecallerabandon]',_0x154dae['uniqueid']),_0x154dae);agents[_0x6d6c('0x29')](_0x154dae);queues[_0x6d6c('0x29')](_0x154dae);}catch(_0x1c43a2){utils[_0x6d6c('0x18')](util[_0x6d6c('0x1d')](_0x6d6c('0x2a'),_0x154dae[_0x6d6c('0x22')]),_0x1c43a2);}});ami['on']('queuecallerjoin',function(_0x50aa1c){try{utils[_0x6d6c('0x1c')](util['format'](_0x6d6c('0x2b'),_0x50aa1c['uniqueid']),_0x50aa1c);queues[_0x6d6c('0x2c')](_0x50aa1c);recordings['queuecallerjoin'](_0x50aa1c);}catch(_0x3a34e4){utils[_0x6d6c('0x18')](util[_0x6d6c('0x1d')](_0x6d6c('0x2b'),_0x50aa1c[_0x6d6c('0x22')]),_0x3a34e4);}});ami['on'](_0x6d6c('0x2d'),function(_0x27ccf1){try{utils[_0x6d6c('0x1c')](util['format']('[%s][index][queuecallerleave]',_0x27ccf1['uniqueid']),_0x27ccf1);queues[_0x6d6c('0x2d')](_0x27ccf1);}catch(_0x1e064b){utils['error'](util[_0x6d6c('0x1d')](_0x6d6c('0x2e'),_0x27ccf1[_0x6d6c('0x22')]),_0x1e064b);}});ami['on']('musiconholdstart',function(_0x1f548c){try{utils[_0x6d6c('0x1c')](util[_0x6d6c('0x1d')](_0x6d6c('0x2f'),_0x1f548c[_0x6d6c('0x22')]),_0x1f548c);queues[_0x6d6c('0x30')](_0x1f548c);calls[_0x6d6c('0x30')](_0x1f548c);}catch(_0x79c1c6){utils[_0x6d6c('0x18')](util[_0x6d6c('0x1d')]('[%s][index][musiconholdstart]',_0x1f548c[_0x6d6c('0x22')]),_0x79c1c6);}});ami['on'](_0x6d6c('0x31'),function(_0x1bee74){try{utils[_0x6d6c('0x1c')](util[_0x6d6c('0x1d')](_0x6d6c('0x32'),_0x1bee74[_0x6d6c('0x22')]),_0x1bee74);queues[_0x6d6c('0x31')](_0x1bee74);calls[_0x6d6c('0x31')](_0x1bee74);}catch(_0x561462){utils[_0x6d6c('0x18')](util[_0x6d6c('0x1d')](_0x6d6c('0x32'),_0x1bee74[_0x6d6c('0x22')]),_0x561462);}});ami['on'](_0x6d6c('0x33'),function(_0x2ee756){try{utils[_0x6d6c('0x1c')](util[_0x6d6c('0x1d')](_0x6d6c('0x34'),_0x2ee756[_0x6d6c('0x22')]),_0x2ee756);calls[_0x6d6c('0x33')](_0x2ee756);recordings['newstate'](_0x2ee756);}catch(_0x433407){utils[_0x6d6c('0x18')](util[_0x6d6c('0x1d')](_0x6d6c('0x34'),_0x2ee756['uniqueid']),_0x433407);}});ami['on'](_0x6d6c('0x35'),function(_0x55b300){try{utils[_0x6d6c('0x1c')](util[_0x6d6c('0x1d')]('[%s][index][hangup]',_0x55b300[_0x6d6c('0x22')]),_0x55b300);calls[_0x6d6c('0x35')](_0x55b300);recordings[_0x6d6c('0x35')](_0x55b300);dials[_0x6d6c('0x35')](_0x55b300);agents[_0x6d6c('0x35')](_0x55b300);queues[_0x6d6c('0x35')](_0x55b300);}catch(_0x59327a){utils[_0x6d6c('0x18')](util[_0x6d6c('0x1d')](_0x6d6c('0x36'),_0x55b300[_0x6d6c('0x22')]),_0x59327a);}});ami['on']('cdr',function(_0xf9e8ec){try{utils[_0x6d6c('0x1c')](util[_0x6d6c('0x1d')]('[%s][index][cdr]',_0xf9e8ec[_0x6d6c('0x22')]),_0xf9e8ec);members[_0x6d6c('0x37')](_0xf9e8ec);}catch(_0x40f204){utils[_0x6d6c('0x18')](util[_0x6d6c('0x1d')]('[%s][index][cdr]',_0xf9e8ec[_0x6d6c('0x22')]),_0x40f204);}});ami['on']('blindtransfer',function(_0x37b96a){try{utils[_0x6d6c('0x1c')](util[_0x6d6c('0x1d')](_0x6d6c('0x38'),_0x37b96a[_0x6d6c('0x22')]),_0x37b96a);queues[_0x6d6c('0x39')](_0x37b96a);agents[_0x6d6c('0x39')](_0x37b96a);transfers[_0x6d6c('0x39')](_0x37b96a);}catch(_0xf38541){utils['error'](util[_0x6d6c('0x1d')](_0x6d6c('0x38'),_0x37b96a[_0x6d6c('0x22')]),_0xf38541);}});ami['on'](_0x6d6c('0x3a'),function(_0x3b961a){try{utils[_0x6d6c('0x1c')](util[_0x6d6c('0x1d')](_0x6d6c('0x3b'),_0x3b961a[_0x6d6c('0x3c')]),_0x3b961a);queues[_0x6d6c('0x3a')](_0x3b961a);transfers[_0x6d6c('0x3a')](_0x3b961a);agents[_0x6d6c('0x3a')](_0x3b961a);calls['attendedtransfer'](_0x3b961a);}catch(_0x13e2c7){utils[_0x6d6c('0x18')](util['format'](_0x6d6c('0x3b'),_0x3b961a[_0x6d6c('0x3c')]),_0x13e2c7);}});ami['on'](_0x6d6c('0x3d'),function(_0x31c013){try{utils[_0x6d6c('0x1c')](util[_0x6d6c('0x1d')](_0x6d6c('0x3e'),_0x31c013[_0x6d6c('0x22')]),_0x31c013);queues[_0x6d6c('0x3d')](_0x31c013);recordings['varset'](_0x31c013);calls['varset'](_0x31c013);dials[_0x6d6c('0x3d')](_0x31c013);}catch(_0x2a1df4){utils[_0x6d6c('0x18')](util[_0x6d6c('0x1d')](_0x6d6c('0x3e'),_0x31c013[_0x6d6c('0x22')]),_0x2a1df4);}});ami['on'](_0x6d6c('0x3f'),function(_0x2cf72f){try{utils[_0x6d6c('0x1c')](util['format']('[%s][index][newexten]',_0x2cf72f['uniqueid']),_0x2cf72f);calls['newexten'](_0x2cf72f);recordings[_0x6d6c('0x3f')](_0x2cf72f);dials[_0x6d6c('0x3f')](_0x2cf72f);}catch(_0x4a8576){utils[_0x6d6c('0x18')](util[_0x6d6c('0x1d')](_0x6d6c('0x40'),_0x2cf72f[_0x6d6c('0x22')]),_0x4a8576);}});ami['on'](_0x6d6c('0x41'),function(_0x29b0ab){try{utils[_0x6d6c('0x1c')](util['format']('[%s][index][newchannel]',_0x29b0ab['uniqueid']),_0x29b0ab);calls['newchannel'](_0x29b0ab);recordings['newchannel'](_0x29b0ab);}catch(_0x4d6856){utils[_0x6d6c('0x18')](util[_0x6d6c('0x1d')](_0x6d6c('0x42'),_0x29b0ab[_0x6d6c('0x22')]),_0x4d6856);}});ami['on'](_0x6d6c('0x43'),function(_0x3158e3){try{utils['debug'](util[_0x6d6c('0x1d')](_0x6d6c('0x44'),_0x3158e3[_0x6d6c('0x22')]),_0x3158e3);dials['dialbegin'](_0x3158e3);}catch(_0x2d86bd){utils['error'](util[_0x6d6c('0x1d')](_0x6d6c('0x45'),_0x3158e3[_0x6d6c('0x22')]),_0x2d86bd);}});ami['on'](_0x6d6c('0x46'),function(_0x672a8c){try{utils[_0x6d6c('0x1c')](util[_0x6d6c('0x1d')](_0x6d6c('0x47'),_0x672a8c[_0x6d6c('0x22')]),_0x672a8c);dials['dialend'](_0x672a8c);}catch(_0x12a120){utils['error'](util[_0x6d6c('0x1d')]('[%s][index][dialend]',_0x672a8c[_0x6d6c('0x22')]),_0x12a120);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 33265db..14aa5e0 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 _0x565c=['enterAt','agentcomplete','[%s][members][agentcomplete]','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','cdr','[%s][members][cdr]','data1','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','uniqueid','interface','channel','type','getUserByInterface','then','membername','name','internal','request','getUserByName','split','error','format','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','NOT_INUSE','isNil','exitAt','duration','diffTime'];(function(_0x10e715,_0x53aa21){var _0x78268b=function(_0x5206aa){while(--_0x5206aa){_0x10e715['push'](_0x10e715['shift']());}};_0x78268b(++_0x53aa21);}(_0x565c,0x73));var _0xc565=function(_0x33a30d,_0x19a429){_0x33a30d=_0x33a30d-0x0;var _0x1e2400=_0x565c[_0x33a30d];return _0x1e2400;};'use strict';var _=require(_0xc565('0x0'));var util=require(_0xc565('0x1'));var utils=require(_0xc565('0x2'));var members={};var exclude=[_0xc565('0x3'),_0xc565('0x4')];function writeDB(_0xc81e3e){utils['info'](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0xc81e3e[_0xc565('0x5')],_0xc81e3e[_0xc565('0x6')],_0xc81e3e[_0xc565('0x7')],_0xc81e3e['data2'],_0xc81e3e['membername'],_0xc81e3e[_0xc565('0x8')]));if(_0xc81e3e['interface']){utils[_0xc565('0x9')](_0xc81e3e[_0xc565('0x6')])[_0xc565('0xa')](function(_0x1eb7fe){if(_0x1eb7fe){_0xc81e3e[_0xc565('0xb')]=_0x1eb7fe[_0xc565('0xc')];_0xc81e3e['internal']=_0x1eb7fe[_0xc565('0xd')];utils[_0xc565('0xe')]('CreateMemberReport',_0xc81e3e);}else{utils[_0xc565('0xf')](_0xc81e3e[_0xc565('0x6')][_0xc565('0x10')]('/')[0x1])[_0xc565('0xa')](function(_0x259a34){if(_0x259a34){_0xc81e3e[_0xc565('0xb')]=_0x259a34[_0xc565('0xc')];_0xc81e3e[_0xc565('0xd')]=_0x259a34[_0xc565('0xd')];utils['request']('CreateMemberReport',_0xc81e3e);}});}})['catch'](function(_0x514495){utils[_0xc565('0x11')](util[_0xc565('0x12')]('[%s][members][writeDB]',_0xc81e3e[_0xc565('0x5')]),_0x514495);});}delete members[_0xc81e3e[_0xc565('0x6')]];}function startsWith(_0x297d35,_0x200ebb){return _[_0xc565('0x13')](_0x297d35,function(_0x11d3f1){return _[_0xc565('0x14')](_0x200ebb,_0x11d3f1);});}exports[_0xc565('0x15')]=function(_0x2818bd){try{utils[_0xc565('0x16')](util[_0xc565('0x12')](_0xc565('0x17'),members[_0x2818bd[_0xc565('0x18')]]?members[_0x2818bd[_0xc565('0x18')]][_0xc565('0x5')]:_0x2818bd['device']),_0x2818bd);utils['info'](util[_0xc565('0x12')](_0xc565('0x19'),members[_0x2818bd[_0xc565('0x18')]]?members[_0x2818bd[_0xc565('0x18')]]['uniqueid']:_0x2818bd[_0xc565('0x18')],_0x2818bd[_0xc565('0x1a')],_0x2818bd[_0xc565('0x18')]));switch(_0x2818bd[_0xc565('0x1a')]){case'INUSE':case _0xc565('0x1b'):if(!startsWith(exclude,_0x2818bd[_0xc565('0x18')])){members[_0x2818bd[_0xc565('0x18')]]={'channel':_0xc565('0x1c'),'interface':_0x2818bd[_0xc565('0x18')],'type':_0xc565('0x1d'),'enterAt':utils['now'](),'role':'agent'};}break;case _0xc565('0x1e'):if(!_[_0xc565('0x1f')](members[_0x2818bd[_0xc565('0x18')]])){members[_0x2818bd[_0xc565('0x18')]][_0xc565('0x20')]=utils['now']();members[_0x2818bd['device']][_0xc565('0x21')]=utils[_0xc565('0x22')](members[_0x2818bd[_0xc565('0x18')]]['exitAt'],members[_0x2818bd[_0xc565('0x18')]][_0xc565('0x23')]);if(members[_0x2818bd[_0xc565('0x18')]][_0xc565('0x5')]){writeDB(members[_0x2818bd[_0xc565('0x18')]]);}}break;default:break;}}catch(_0x5722da){utils[_0xc565('0x11')](util[_0xc565('0x12')](_0xc565('0x17'),members[_0x2818bd['device']]?members[_0x2818bd[_0xc565('0x18')]][_0xc565('0x5')]:_0x2818bd[_0xc565('0x18')]),_0x5722da);}};exports[_0xc565('0x24')]=function(_0x33493a){try{if(!_[_0xc565('0x1f')](members[_0x33493a[_0xc565('0x6')]])){utils['debug'](util[_0xc565('0x12')](_0xc565('0x25'),_0x33493a[_0xc565('0x5')]),_0x33493a);utils[_0xc565('0x26')](util[_0xc565('0x12')](_0xc565('0x27'),_0x33493a[_0xc565('0x5')],_0x33493a[_0xc565('0x6')],_0x33493a['queue']));members[_0x33493a['interface']]=_[_0xc565('0x28')](members[_0x33493a[_0xc565('0x6')]],{'data4':_0x33493a['queue'],'uniqueid':_0x33493a[_0xc565('0x5')]});}}catch(_0xeae687){utils[_0xc565('0x11')](util[_0xc565('0x12')](_0xc565('0x25'),_0x33493a[_0xc565('0x5')]),_0xeae687);}};exports[_0xc565('0x29')]=function(_0x4c7da9){try{utils[_0xc565('0x16')](util[_0xc565('0x12')](_0xc565('0x2a'),_0x4c7da9['uniqueid']),_0x4c7da9);if(_0x4c7da9[_0xc565('0x7')]){var _0x4c82ca=_0x4c7da9[_0xc565('0x7')]['split']('-')[0x0];if(!_[_0xc565('0x1f')](members[_0x4c82ca])){members[_0x4c82ca]=_[_0xc565('0x28')](members[_0x4c82ca],{'data1':members[_0x4c82ca][_0xc565('0x2b')]||_0x4c7da9[_0xc565('0x8')],'data2':members[_0x4c82ca][_0xc565('0x2c')]||_0x4c7da9[_0xc565('0x2d')],'data3':members[_0x4c82ca][_0xc565('0x2e')]||_0x4c7da9[_0xc565('0x2f')],'uniqueid':members[_0x4c82ca][_0xc565('0x5')]||_0x4c7da9['uniqueid']});utils[_0xc565('0x26')](util[_0xc565('0x12')](_0xc565('0x30'),_0x4c7da9[_0xc565('0x5')],members[_0x4c82ca][_0xc565('0x2b')],members[_0x4c82ca][_0xc565('0x2c')],members[_0x4c82ca][_0xc565('0x2e')]));if(members[_0x4c82ca]['exitAt']){writeDB(members[_0x4c82ca]);}}}if(_0x4c7da9['destinationchannel']){var _0x1280a9=_0x4c7da9[_0xc565('0x31')][_0xc565('0x10')]('-')[0x0];if(!_[_0xc565('0x1f')](members[_0x1280a9])){members[_0x1280a9]=_[_0xc565('0x28')](members[_0x1280a9],{'data1':members[_0x1280a9][_0xc565('0x2b')]||_0x4c7da9[_0xc565('0x8')],'data2':members[_0x1280a9]['data2']||_0x4c7da9[_0xc565('0x2d')],'data3':members[_0x1280a9]['data3']||_0x4c7da9[_0xc565('0x2f')],'uniqueid':members[_0x1280a9][_0xc565('0x5')]||_0x4c7da9[_0xc565('0x5')]});utils['info'](util['format'](_0xc565('0x30'),_0x4c7da9[_0xc565('0x5')],members[_0x1280a9][_0xc565('0x2b')],members[_0x1280a9][_0xc565('0x2c')],members[_0x1280a9][_0xc565('0x2e')]));if(members[_0x1280a9][_0xc565('0x20')]){writeDB(members[_0x1280a9]);}}}}catch(_0x2fa276){utils[_0xc565('0x11')](util['format'](_0xc565('0x2a'),_0x4c7da9[_0xc565('0x5')]),_0x2fa276);}}; \ No newline at end of file +var _0x4c95=['util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','type','interface','getUserByInterface','then','membername','internal','request','CreateMemberReport','getUserByName','name','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','now','agent','NOT_INUSE','isNil','exitAt','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','split','assign','data2','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','data3','destinationchannel','source','lodash'];(function(_0x249ade,_0x1e840b){var _0x2d087e=function(_0x5add74){while(--_0x5add74){_0x249ade['push'](_0x249ade['shift']());}};_0x2d087e(++_0x1e840b);}(_0x4c95,0x180));var _0x54c9=function(_0x5ccb9e,_0x28e61d){_0x5ccb9e=_0x5ccb9e-0x0;var _0x8e1f0e=_0x4c95[_0x5ccb9e];return _0x8e1f0e;};'use strict';var _=require(_0x54c9('0x0'));var util=require(_0x54c9('0x1'));var utils=require(_0x54c9('0x2'));var members={};var exclude=[_0x54c9('0x3'),_0x54c9('0x4')];function writeDB(_0x1f5eac){utils[_0x54c9('0x5')](util[_0x54c9('0x6')](_0x54c9('0x7'),_0x1f5eac[_0x54c9('0x8')],_0x1f5eac['interface'],_0x1f5eac[_0x54c9('0x9')],_0x1f5eac['data2'],_0x1f5eac['membername'],_0x1f5eac[_0x54c9('0xa')]));if(_0x1f5eac[_0x54c9('0xb')]){utils[_0x54c9('0xc')](_0x1f5eac[_0x54c9('0xb')])[_0x54c9('0xd')](function(_0x10cf03){if(_0x10cf03){_0x1f5eac[_0x54c9('0xe')]=_0x10cf03['name'];_0x1f5eac['internal']=_0x10cf03[_0x54c9('0xf')];utils[_0x54c9('0x10')](_0x54c9('0x11'),_0x1f5eac);}else{utils[_0x54c9('0x12')](_0x1f5eac[_0x54c9('0xb')]['split']('/')[0x1])[_0x54c9('0xd')](function(_0x9fe58){if(_0x9fe58){_0x1f5eac[_0x54c9('0xe')]=_0x9fe58[_0x54c9('0x13')];_0x1f5eac[_0x54c9('0xf')]=_0x9fe58[_0x54c9('0xf')];utils[_0x54c9('0x10')]('CreateMemberReport',_0x1f5eac);}});}})[_0x54c9('0x14')](function(_0x7bcdd5){utils[_0x54c9('0x15')](util[_0x54c9('0x6')](_0x54c9('0x16'),_0x1f5eac[_0x54c9('0x8')]),_0x7bcdd5);});}delete members[_0x1f5eac[_0x54c9('0xb')]];}function startsWith(_0x3376bf,_0x3f0565){return _[_0x54c9('0x17')](_0x3376bf,function(_0x5ef17b){return _[_0x54c9('0x18')](_0x3f0565,_0x5ef17b);});}exports[_0x54c9('0x19')]=function(_0x347d60){try{utils[_0x54c9('0x1a')](util['format'](_0x54c9('0x1b'),members[_0x347d60[_0x54c9('0x1c')]]?members[_0x347d60[_0x54c9('0x1c')]]['uniqueid']:_0x347d60[_0x54c9('0x1c')]),_0x347d60);utils[_0x54c9('0x5')](util[_0x54c9('0x6')](_0x54c9('0x1d'),members[_0x347d60[_0x54c9('0x1c')]]?members[_0x347d60['device']][_0x54c9('0x8')]:_0x347d60[_0x54c9('0x1c')],_0x347d60[_0x54c9('0x1e')],_0x347d60[_0x54c9('0x1c')]));switch(_0x347d60[_0x54c9('0x1e')]){case _0x54c9('0x1f'):case _0x54c9('0x20'):if(!startsWith(exclude,_0x347d60[_0x54c9('0x1c')])){members[_0x347d60[_0x54c9('0x1c')]]={'channel':_0x54c9('0x21'),'interface':_0x347d60[_0x54c9('0x1c')],'type':'TALKING','enterAt':utils[_0x54c9('0x22')](),'role':_0x54c9('0x23')};}break;case _0x54c9('0x24'):if(!_[_0x54c9('0x25')](members[_0x347d60[_0x54c9('0x1c')]])){members[_0x347d60[_0x54c9('0x1c')]][_0x54c9('0x26')]=utils['now']();members[_0x347d60['device']]['duration']=utils['diffTime'](members[_0x347d60[_0x54c9('0x1c')]][_0x54c9('0x26')],members[_0x347d60[_0x54c9('0x1c')]][_0x54c9('0x27')]);if(members[_0x347d60[_0x54c9('0x1c')]][_0x54c9('0x8')]){writeDB(members[_0x347d60[_0x54c9('0x1c')]]);}}break;default:break;}}catch(_0x375d04){utils[_0x54c9('0x15')](util[_0x54c9('0x6')](_0x54c9('0x1b'),members[_0x347d60[_0x54c9('0x1c')]]?members[_0x347d60[_0x54c9('0x1c')]][_0x54c9('0x8')]:_0x347d60[_0x54c9('0x1c')]),_0x375d04);}};exports[_0x54c9('0x28')]=function(_0x5e5214){try{if(!_[_0x54c9('0x25')](members[_0x5e5214['interface']])){utils[_0x54c9('0x1a')](util[_0x54c9('0x6')](_0x54c9('0x29'),_0x5e5214[_0x54c9('0x8')]),_0x5e5214);utils[_0x54c9('0x5')](util[_0x54c9('0x6')](_0x54c9('0x2a'),_0x5e5214[_0x54c9('0x8')],_0x5e5214['interface'],_0x5e5214[_0x54c9('0x2b')]));members[_0x5e5214[_0x54c9('0xb')]]=_['assign'](members[_0x5e5214[_0x54c9('0xb')]],{'data4':_0x5e5214['queue'],'uniqueid':_0x5e5214[_0x54c9('0x8')]});}}catch(_0x38d281){utils[_0x54c9('0x15')](util['format'](_0x54c9('0x29'),_0x5e5214[_0x54c9('0x8')]),_0x38d281);}};exports[_0x54c9('0x2c')]=function(_0x3249ef){try{utils['debug'](util[_0x54c9('0x6')](_0x54c9('0x2d'),_0x3249ef[_0x54c9('0x8')]),_0x3249ef);if(_0x3249ef[_0x54c9('0x9')]){var _0x32d600=_0x3249ef['channel'][_0x54c9('0x2e')]('-')[0x0];if(!_[_0x54c9('0x25')](members[_0x32d600])){members[_0x32d600]=_[_0x54c9('0x2f')](members[_0x32d600],{'data1':members[_0x32d600]['data1']||_0x3249ef[_0x54c9('0xa')],'data2':members[_0x32d600][_0x54c9('0x30')]||_0x3249ef['source'],'data3':members[_0x32d600]['data3']||_0x3249ef[_0x54c9('0x31')],'uniqueid':members[_0x32d600][_0x54c9('0x8')]||_0x3249ef[_0x54c9('0x8')]});utils['info'](util[_0x54c9('0x6')](_0x54c9('0x32'),_0x3249ef['uniqueid'],members[_0x32d600][_0x54c9('0x33')],members[_0x32d600][_0x54c9('0x30')],members[_0x32d600][_0x54c9('0x34')]));if(members[_0x32d600][_0x54c9('0x26')]){writeDB(members[_0x32d600]);}}}if(_0x3249ef[_0x54c9('0x35')]){var _0x26069c=_0x3249ef[_0x54c9('0x35')]['split']('-')[0x0];if(!_[_0x54c9('0x25')](members[_0x26069c])){members[_0x26069c]=_[_0x54c9('0x2f')](members[_0x26069c],{'data1':members[_0x26069c][_0x54c9('0x33')]||_0x3249ef[_0x54c9('0xa')],'data2':members[_0x26069c][_0x54c9('0x30')]||_0x3249ef[_0x54c9('0x36')],'data3':members[_0x26069c][_0x54c9('0x34')]||_0x3249ef['destination'],'uniqueid':members[_0x26069c][_0x54c9('0x8')]||_0x3249ef['uniqueid']});utils[_0x54c9('0x5')](util[_0x54c9('0x6')](_0x54c9('0x32'),_0x3249ef[_0x54c9('0x8')],members[_0x26069c][_0x54c9('0x33')],members[_0x26069c][_0x54c9('0x30')],members[_0x26069c][_0x54c9('0x34')]));if(members[_0x26069c][_0x54c9('0x26')]){writeDB(members[_0x26069c]);}}}}catch(_0x5c9093){utils[_0x54c9('0x15')](util['format'](_0x54c9('0x2d'),_0x3249ef[_0x54c9('0x8')]),_0x5c9093);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index ff5e51e..6917b55 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 _0x1d52=['position','assign','now','[%s][queues][queuecallerjoin]','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','error','varset','[%s][queues][varset]','isNil','variable','queuestatus','value','CONTINUE','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','holdtime','count','agentconnect','membername','destaccountcode','assigned','lastAssignedTo','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','transfer','TRANSFER','COMPLETEDBY','reason','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertype','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','info','format'];(function(_0x239b31,_0x44a64d){var _0x41c8be=function(_0x27f031){while(--_0x27f031){_0x239b31['push'](_0x239b31['shift']());}};_0x41c8be(++_0x44a64d);}(_0x1d52,0x199));var _0x21d5=function(_0x9d9cd1,_0xbb6ff2){_0x9d9cd1=_0x9d9cd1-0x0;var _0x3b57ff=_0x1d52[_0x9d9cd1];return _0x3b57ff;};'use strict';var _=require(_0x21d5('0x0'));var util=require(_0x21d5('0x1'));var utils=require(_0x21d5('0x2'));var queues={};function writeDB(_0x162540){utils['info'](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x162540['uniqueid'],_0x162540[_0x21d5('0x3')],_0x162540[_0x21d5('0x4')],_0x162540['lastAssignedTo'],_0x162540[_0x21d5('0x5')],_0x162540[_0x21d5('0x6')],_0x162540[_0x21d5('0x7')]));if(_0x162540['queue']){utils[_0x21d5('0x8')](_0x162540[_0x21d5('0x4')])[_0x21d5('0x9')](function(_0x1f8caf){if(_0x1f8caf){_0x162540[_0x21d5('0xa')]=_0x1f8caf[_0x21d5('0xa')];}utils[_0x21d5('0xb')](_0x21d5('0xc'),_0x162540);});}else{utils['request']('CreateVoiceQueueReport',_0x162540);}if(_0x162540[_0x21d5('0xd')]){delete queues[_0x162540[_0x21d5('0xd')]];}else{delete queues[_0x162540[_0x21d5('0xe')]];}}exports[_0x21d5('0xf')]=function(_0x406a77){try{utils[_0x21d5('0x10')](util['format']('[%s][queues][queuecallerjoin]',_0x406a77[_0x21d5('0xe')]),_0x406a77);utils[_0x21d5('0x11')](util[_0x21d5('0x12')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x406a77[_0x21d5('0xe')],_0x406a77[_0x21d5('0x4')],_0x406a77[_0x21d5('0x13')]));queues[_0x406a77['uniqueid']]=_[_0x21d5('0x14')](_0x406a77,{'originalposition':_0x406a77[_0x21d5('0x13')],'queuecallerjoinAt':utils[_0x21d5('0x15')](),'mohtime':0x0});}catch(_0x41e69d){utils['error'](util['format'](_0x21d5('0x16'),_0x406a77[_0x21d5('0xe')]),_0x41e69d);}};exports['hangup']=function(_0x7784ec){try{if(!_['isNil'](queues[_0x7784ec[_0x21d5('0xe')]])){utils[_0x21d5('0x10')](util[_0x21d5('0x12')](_0x21d5('0x17'),_0x7784ec[_0x21d5('0xe')]),_0x7784ec);if(queues[_0x7784ec[_0x21d5('0xe')]][_0x21d5('0x18')]){if(!queues[_0x7784ec['uniqueid']][_0x21d5('0x19')]&&!queues[_0x7784ec[_0x21d5('0xe')]][_0x21d5('0x1a')]){queues[_0x7784ec['uniqueid']][_0x21d5('0x1b')]=!![];queues[_0x7784ec['uniqueid']][_0x21d5('0x1c')]=utils[_0x21d5('0x15')]();queues[_0x7784ec[_0x21d5('0xe')]][_0x21d5('0x7')]='COMPLETEDBYAGENT';}utils[_0x21d5('0x11')](util[_0x21d5('0x12')](_0x21d5('0x1d'),_0x7784ec['uniqueid'],queues[_0x7784ec[_0x21d5('0xe')]][_0x21d5('0x1e')],queues[_0x7784ec[_0x21d5('0xe')]][_0x21d5('0x7')]));writeDB(queues[_0x7784ec[_0x21d5('0xe')]]);}else if(queues[_0x7784ec['uniqueid']]['transfereduniqueid']){utils[_0x21d5('0x11')](util[_0x21d5('0x12')](_0x21d5('0x1f'),_0x7784ec[_0x21d5('0xe')],queues[_0x7784ec[_0x21d5('0xe')]][_0x21d5('0x1e')],queues[_0x7784ec['uniqueid']]['transfereduniqueid']));queues[queues[_0x7784ec[_0x21d5('0xe')]][_0x21d5('0xd')]]=queues[_0x7784ec['uniqueid']];queues[queues[_0x7784ec[_0x21d5('0xe')]]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x7784ec[_0x21d5('0xe')]];}}}catch(_0x357098){utils[_0x21d5('0x20')](util[_0x21d5('0x12')](_0x21d5('0x17'),_0x7784ec[_0x21d5('0xe')]),_0x357098);}};exports[_0x21d5('0x21')]=function(_0x206bf3){try{utils[_0x21d5('0x10')](util[_0x21d5('0x12')](_0x21d5('0x22'),_0x206bf3[_0x21d5('0xe')]),_0x206bf3);if(!_[_0x21d5('0x23')](_0x206bf3[_0x21d5('0x24')][_0x21d5('0x25')])&&_0x206bf3[_0x21d5('0x26')]['toUpperCase']()!==_0x21d5('0x27')){if(!_[_0x21d5('0x23')](queues[_0x206bf3[_0x21d5('0xe')]])){queues[_0x206bf3[_0x21d5('0xe')]][_0x21d5('0x19')]=![];queues[_0x206bf3[_0x21d5('0xe')]]['queuecallerabandonAt']=null;queues[_0x206bf3[_0x21d5('0xe')]][_0x21d5('0x1a')]=!![];queues[_0x206bf3[_0x21d5('0xe')]][_0x21d5('0x28')]=utils[_0x21d5('0x15')]();queues[_0x206bf3[_0x21d5('0xe')]][_0x21d5('0x7')]=_0x206bf3['value']['toUpperCase']();utils['info'](util['format'](_0x21d5('0x29'),_0x206bf3['uniqueid'],queues[_0x206bf3[_0x21d5('0xe')]][_0x21d5('0x1e')],_0x206bf3[_0x21d5('0x26')],queues[_0x206bf3[_0x21d5('0xe')]]['queuecallerexitreason']));writeDB(queues[_0x206bf3['uniqueid']]);}}else if(!_[_0x21d5('0x23')](_0x206bf3[_0x21d5('0x24')][_0x21d5('0x2a')])){if(!_[_0x21d5('0x23')](queues[_0x206bf3[_0x21d5('0xe')]])&&!queues[_0x206bf3[_0x21d5('0xe')]]['queuecallerabandon']){queues[_0x206bf3[_0x21d5('0xe')]][_0x21d5('0x19')]=![];queues[_0x206bf3['uniqueid']][_0x21d5('0x2b')]=null;queues[_0x206bf3[_0x21d5('0xe')]][_0x21d5('0x1a')]=!![];queues[_0x206bf3[_0x21d5('0xe')]]['queuecallerexitAt']=utils['now']();queues[_0x206bf3[_0x21d5('0xe')]][_0x21d5('0x7')]=_0x21d5('0x2c');utils['info'](util['format'](_0x21d5('0x2d'),_0x206bf3[_0x21d5('0xe')],queues[_0x206bf3[_0x21d5('0xe')]][_0x21d5('0x1e')],_0x206bf3['value'],queues[_0x206bf3[_0x21d5('0xe')]][_0x21d5('0x7')]));}}}catch(_0x30e84a){utils[_0x21d5('0x20')](util[_0x21d5('0x12')](_0x21d5('0x22'),_0x206bf3[_0x21d5('0xe')]),_0x30e84a);}};exports['queuecallerabandon']=function(_0x3d0c29){try{if(!_[_0x21d5('0x23')](queues[_0x3d0c29[_0x21d5('0xe')]])){utils[_0x21d5('0x10')](util['format'](_0x21d5('0x2e'),_0x3d0c29[_0x21d5('0xe')]),_0x3d0c29);queues[_0x3d0c29['uniqueid']][_0x21d5('0x1a')]=![];queues[_0x3d0c29[_0x21d5('0xe')]][_0x21d5('0x28')]=null;queues[_0x3d0c29['uniqueid']]['queuecallerabandon']=!![];queues[_0x3d0c29['uniqueid']][_0x21d5('0x2b')]=utils[_0x21d5('0x15')]();queues[_0x3d0c29[_0x21d5('0xe')]][_0x21d5('0x7')]=_0x21d5('0x2f');utils[_0x21d5('0x11')](util['format']('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x3d0c29['uniqueid'],queues[_0x3d0c29['uniqueid']][_0x21d5('0x1e')],queues[_0x3d0c29[_0x21d5('0xe')]][_0x21d5('0x7')]));}}catch(_0x3e62c1){utils[_0x21d5('0x20')](util[_0x21d5('0x12')](_0x21d5('0x2e'),_0x3d0c29[_0x21d5('0xe')]),_0x3e62c1);}};exports['queuecallerleave']=function(_0x2e0f7b){try{if(!_[_0x21d5('0x23')](queues[_0x2e0f7b[_0x21d5('0xe')]])){utils[_0x21d5('0x10')](util[_0x21d5('0x12')](_0x21d5('0x30'),_0x2e0f7b['uniqueid']),_0x2e0f7b);utils[_0x21d5('0x11')](util['format'](_0x21d5('0x31'),_0x2e0f7b['uniqueid'],queues[_0x2e0f7b[_0x21d5('0xe')]][_0x21d5('0x1e')],_0x2e0f7b[_0x21d5('0x32')],_0x2e0f7b[_0x21d5('0x33')]));queues[_0x2e0f7b[_0x21d5('0xe')]][_0x21d5('0x34')]=!![];queues[_0x2e0f7b['uniqueid']][_0x21d5('0x18')]=utils['now']();queues[_0x2e0f7b[_0x21d5('0xe')]][_0x21d5('0x35')]=utils['diffTime'](queues[_0x2e0f7b[_0x21d5('0xe')]][_0x21d5('0x18')],queues[_0x2e0f7b[_0x21d5('0xe')]]['queuecallerjoinAt']);queues[_0x2e0f7b[_0x21d5('0xe')]][_0x21d5('0x13')]=_0x2e0f7b['position'];queues[_0x2e0f7b[_0x21d5('0xe')]][_0x21d5('0x36')]=_0x2e0f7b[_0x21d5('0x36')];queues[_0x2e0f7b['uniqueid']][_0x21d5('0x32')]=_0x2e0f7b[_0x21d5('0x32')];queues[_0x2e0f7b[_0x21d5('0xe')]][_0x21d5('0x33')]=_0x2e0f7b['connectedlinename'];}}catch(_0xb6e4eb){utils['error'](util[_0x21d5('0x12')](_0x21d5('0x30'),_0x2e0f7b[_0x21d5('0xe')]),_0xb6e4eb);}};exports[_0x21d5('0x37')]=function(_0x3daaa4){try{if(!_[_0x21d5('0x23')](queues[_0x3daaa4['uniqueid']])){utils[_0x21d5('0x10')](util[_0x21d5('0x12')]('[%s][queues][agentconnect]',_0x3daaa4['uniqueid']),_0x3daaa4);utils['info'](util[_0x21d5('0x12')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x3daaa4[_0x21d5('0xe')],queues[_0x3daaa4[_0x21d5('0xe')]][_0x21d5('0x1e')],_0x3daaa4[_0x21d5('0x38')],_0x3daaa4[_0x21d5('0x39')]));queues[_0x3daaa4[_0x21d5('0xe')]][_0x21d5('0x19')]=![];queues[_0x3daaa4[_0x21d5('0xe')]]['queuecallerabandon']=![];queues[_0x3daaa4[_0x21d5('0xe')]][_0x21d5('0x2b')]=null;queues[_0x3daaa4[_0x21d5('0xe')]][_0x21d5('0x1a')]=![];queues[_0x3daaa4[_0x21d5('0xe')]][_0x21d5('0x7')]=null;queues[_0x3daaa4[_0x21d5('0xe')]][_0x21d5('0x28')]=null;queues[_0x3daaa4[_0x21d5('0xe')]][_0x21d5('0x3a')]=!![];queues[_0x3daaa4['uniqueid']][_0x21d5('0x6')]=_0x3daaa4[_0x21d5('0x39')];queues[_0x3daaa4[_0x21d5('0xe')]][_0x21d5('0x3b')]=_0x3daaa4[_0x21d5('0x38')];}}catch(_0x3609f5){utils['error'](util[_0x21d5('0x12')](_0x21d5('0x3c'),_0x3daaa4['uniqueid']),_0x3609f5);}};exports[_0x21d5('0x3d')]=function(_0x438de9){try{if(!_['isNil'](queues[_0x438de9['uniqueid']])){if(queues[_0x438de9[_0x21d5('0xe')]][_0x21d5('0x18')]){utils[_0x21d5('0x10')](util[_0x21d5('0x12')](_0x21d5('0x3e'),_0x438de9[_0x21d5('0xe')]),_0x438de9);queues[_0x438de9['uniqueid']][_0x21d5('0x19')]=![];queues[_0x438de9[_0x21d5('0xe')]][_0x21d5('0x19')]=![];queues[_0x438de9[_0x21d5('0xe')]][_0x21d5('0x2b')]=null;queues[_0x438de9[_0x21d5('0xe')]][_0x21d5('0x1a')]=![];queues[_0x438de9['uniqueid']][_0x21d5('0x28')]=null;queues[_0x438de9[_0x21d5('0xe')]]['assigned']=!![];queues[_0x438de9[_0x21d5('0xe')]][_0x21d5('0x3b')]=_0x438de9[_0x21d5('0x38')];queues[_0x438de9['uniqueid']][_0x21d5('0x1b')]=!![];queues[_0x438de9[_0x21d5('0xe')]][_0x21d5('0x1c')]=utils['now']();if(_0x438de9['reason']==_0x21d5('0x3f')){if(!queues[_0x438de9['uniqueid']]['transfer']){queues[_0x438de9['uniqueid']][_0x21d5('0x7')]=_0x21d5('0x40');}}else{queues[_0x438de9[_0x21d5('0xe')]][_0x21d5('0x7')]=_0x21d5('0x41')+_0x438de9[_0x21d5('0x42')][_0x21d5('0x43')]();}utils[_0x21d5('0x11')](util['format'](_0x21d5('0x44'),_0x438de9['uniqueid'],queues[_0x438de9['uniqueid']][_0x21d5('0x1e')],_0x438de9[_0x21d5('0x38')],queues[_0x438de9['uniqueid']][_0x21d5('0x7')]));writeDB(queues[_0x438de9[_0x21d5('0xe')]]);}}}catch(_0x418816){utils['error'](util[_0x21d5('0x12')]('[%s][queues][agentcomplete]',_0x438de9[_0x21d5('0xe')]),_0x418816);}};exports[_0x21d5('0x45')]=function(_0xb67064){try{if(!_[_0x21d5('0x23')](queues[_0xb67064[_0x21d5('0x46')]])){utils[_0x21d5('0x10')](util[_0x21d5('0x12')]('[%s][queues][blindtransfer]',_0xb67064[_0x21d5('0xe')]),_0xb67064);queues[_0xb67064[_0x21d5('0x46')]][_0x21d5('0x3f')]=!![];queues[_0xb67064['transfereeuniqueid']]['transfertype']=_0x21d5('0x47');queues[_0xb67064[_0x21d5('0x46')]][_0x21d5('0x48')]=_0xb67064[_0x21d5('0x49')];queues[_0xb67064[_0x21d5('0x46')]][_0x21d5('0x4a')]=_0xb67064['transfereeuniqueid'];queues[_0xb67064[_0x21d5('0x46')]][_0x21d5('0x7')]='BLINDTRANSFER';utils[_0x21d5('0x11')](util[_0x21d5('0x12')](_0x21d5('0x4b'),_0xb67064[_0x21d5('0xe')],queues[_0xb67064[_0x21d5('0x46')]]['name'],_0xb67064[_0x21d5('0x46')],_0xb67064[_0x21d5('0x49')]));}}catch(_0x5b8a75){utils[_0x21d5('0x20')](util[_0x21d5('0x12')](_0x21d5('0x4c'),_0xb67064[_0x21d5('0xe')]),_0x5b8a75);}};exports[_0x21d5('0x4d')]=function(_0x525e67){try{utils[_0x21d5('0x10')](util[_0x21d5('0x12')](_0x21d5('0x4e'),_0x525e67['origtransfereruniqueid']),_0x525e67);if(_0x525e67[_0x21d5('0x4f')]==_0x525e67[_0x21d5('0x50')]){if(!_['isNil'](queues[_0x525e67[_0x21d5('0x51')]])){utils[_0x21d5('0x11')](util[_0x21d5('0x12')](_0x21d5('0x52'),_0x525e67['origtransfereruniqueid'],queues[_0x525e67[_0x21d5('0x51')]][_0x21d5('0x1e')],_0x525e67['origtransfererexten']));queues[_0x525e67[_0x21d5('0x51')]]['transfer']=!![];queues[_0x525e67['secondtransfererlinkedid']]['transfertype']=_0x21d5('0x53');queues[_0x525e67[_0x21d5('0x51')]][_0x21d5('0x48')]=_0x525e67[_0x21d5('0x54')];queues[_0x525e67[_0x21d5('0x51')]]['transferuniqueid']=_0x525e67[_0x21d5('0x4f')];queues[_0x525e67[_0x21d5('0x51')]][_0x21d5('0x7')]=_0x21d5('0x55');}if(!_[_0x21d5('0x23')](queues[_0x525e67[_0x21d5('0x50')]])){if(_0x525e67['transfereelinkedid']&&queues[_0x525e67[_0x21d5('0x56')]]){queues[_0x525e67[_0x21d5('0x56')]][_0x21d5('0x57')]=0x1;queues[_0x525e67['transfereeuniqueid']]=_[_0x21d5('0x58')](queues[_0x525e67[_0x21d5('0x56')]]);queues[_0x525e67['transfereeuniqueid']][_0x21d5('0xd')]=_0x525e67[_0x21d5('0x59')];queues[_0x525e67['transfereeuniqueid']][_0x21d5('0x57')]=0x2;queues[_0x525e67[_0x21d5('0x46')]]['calleridnum']=queues[_0x525e67[_0x21d5('0x51')]][_0x21d5('0x5')];queues[_0x525e67[_0x21d5('0x46')]][_0x21d5('0x5a')]=queues[_0x525e67[_0x21d5('0x51')]][_0x21d5('0x5a')];queues[_0x525e67[_0x21d5('0x46')]][_0x21d5('0x5b')]=utils[_0x21d5('0x15')]();queues[_0x525e67['transfereeuniqueid']][_0x21d5('0x18')]=utils[_0x21d5('0x15')]();queues[_0x525e67[_0x21d5('0x46')]][_0x21d5('0x35')]=0x0;queues[_0x525e67['transfereeuniqueid']][_0x21d5('0x5c')]=0x0;utils[_0x21d5('0x11')](util['format'](_0x21d5('0x5d'),_0x525e67[_0x21d5('0x4f')],queues[_0x525e67[_0x21d5('0x46')]]['name'],queues[_0x525e67['transfereeuniqueid']][_0x21d5('0x5')],queues[_0x525e67[_0x21d5('0x46')]][_0x21d5('0x5a')]));}else{utils['info'](util[_0x21d5('0x12')](_0x21d5('0x5e'),_0x525e67['origtransfereruniqueid'],queues[_0x525e67[_0x21d5('0x50')]][_0x21d5('0x1e')],_0x525e67[_0x21d5('0x51')]));queues[_0x525e67[_0x21d5('0x50')]][_0x21d5('0xd')]=_0x525e67['secondtransfererlinkedid'];}}}else if(_0x525e67[_0x21d5('0x5f')]==_0x525e67[_0x21d5('0x51')]){if(!_[_0x21d5('0x23')](queues[_0x525e67[_0x21d5('0x50')]])){utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x525e67[_0x21d5('0x4f')],queues[_0x525e67[_0x21d5('0x50')]]['name'],_0x525e67[_0x21d5('0x5f')],_0x525e67[_0x21d5('0x60')]));queues[_0x525e67['origtransfererlinkedid']][_0x21d5('0x3f')]=!![];queues[_0x525e67['origtransfererlinkedid']][_0x21d5('0x61')]=_0x21d5('0x53');queues[_0x525e67[_0x21d5('0x50')]][_0x21d5('0x48')]=_0x525e67[_0x21d5('0x60')];queues[_0x525e67[_0x21d5('0x50')]][_0x21d5('0x4a')]=_0x525e67[_0x21d5('0x5f')];queues[_0x525e67[_0x21d5('0x50')]][_0x21d5('0x7')]=_0x21d5('0x55');}if(!_[_0x21d5('0x23')](queues[_0x525e67[_0x21d5('0x51')]])){if(_0x525e67[_0x21d5('0x62')]&&queues[_0x525e67[_0x21d5('0x62')]]){queues[_0x525e67[_0x21d5('0x62')]][_0x21d5('0x57')]=0x1;queues[_0x525e67[_0x21d5('0x59')]]=_[_0x21d5('0x58')](queues[_0x525e67[_0x21d5('0x62')]]);queues[_0x525e67[_0x21d5('0x59')]][_0x21d5('0xd')]=_0x525e67['transfertargetuniqueid'];queues[_0x525e67[_0x21d5('0x59')]][_0x21d5('0x57')]=0x2;queues[_0x525e67['transfertargetuniqueid']]['calleridnum']=queues[_0x525e67[_0x21d5('0x50')]][_0x21d5('0x5')];queues[_0x525e67[_0x21d5('0x59')]][_0x21d5('0x5a')]=queues[_0x525e67[_0x21d5('0x50')]][_0x21d5('0x5a')];queues[_0x525e67['transfertargetuniqueid']]['queuecallerjoinAt']=utils['now']();queues[_0x525e67[_0x21d5('0x59')]][_0x21d5('0x18')]=utils['now']();queues[_0x525e67[_0x21d5('0x59')]]['holdtime']=0x0;queues[_0x525e67[_0x21d5('0x59')]][_0x21d5('0x5c')]=0x0;utils[_0x21d5('0x11')](util[_0x21d5('0x12')](_0x21d5('0x63'),_0x525e67[_0x21d5('0x4f')],queues[_0x525e67['transfertargetuniqueid']][_0x21d5('0x1e')],queues[_0x525e67['transfertargetuniqueid']][_0x21d5('0xd')],queues[_0x525e67['transfertargetuniqueid']]['calleridnum'],queues[_0x525e67[_0x21d5('0x59')]][_0x21d5('0x5a')]));}else{utils[_0x21d5('0x11')](util[_0x21d5('0x12')](_0x21d5('0x5e'),_0x525e67[_0x21d5('0x4f')],queues[_0x525e67[_0x21d5('0x51')]][_0x21d5('0x1e')],_0x525e67['origtransfererlinkedid']));queues[_0x525e67[_0x21d5('0x51')]]['transfereduniqueid']=_0x525e67[_0x21d5('0x50')];}}}}catch(_0x4faf3f){utils[_0x21d5('0x20')](util[_0x21d5('0x12')](_0x21d5('0x4e'),_0x525e67[_0x21d5('0x4f')]),_0x4faf3f);}};exports[_0x21d5('0x64')]=function(_0x288729){try{if(!_[_0x21d5('0x23')](queues[_0x288729[_0x21d5('0xe')]])){utils[_0x21d5('0x10')](util[_0x21d5('0x12')]('[%s][queues][musiconholdstart]',_0x288729[_0x21d5('0xe')]),_0x288729);queues[_0x288729[_0x21d5('0xe')]][_0x21d5('0x65')]=utils[_0x21d5('0x15')]();utils[_0x21d5('0x11')](util['format'](_0x21d5('0x66'),_0x288729[_0x21d5('0xe')],queues[_0x288729[_0x21d5('0xe')]]['name'],queues[_0x288729['uniqueid']][_0x21d5('0x65')]));}}catch(_0x1f2e27){utils['error'](util[_0x21d5('0x12')]('[%s][queues][musiconholdstart]',_0x288729[_0x21d5('0xe')]),_0x1f2e27);}};exports[_0x21d5('0x67')]=function(_0x3ceccb){try{if(!_[_0x21d5('0x23')](queues[_0x3ceccb['uniqueid']])){if(!_[_0x21d5('0x23')](queues[_0x3ceccb['uniqueid']]['musiconholdstartAt'])){utils[_0x21d5('0x10')](util[_0x21d5('0x12')]('[%s][queues][musiconholdstop]',_0x3ceccb[_0x21d5('0xe')]),_0x3ceccb);queues[_0x3ceccb[_0x21d5('0xe')]][_0x21d5('0x5c')]+=utils[_0x21d5('0x68')](utils[_0x21d5('0x15')](),queues[_0x3ceccb[_0x21d5('0xe')]][_0x21d5('0x65')]);utils['info'](util[_0x21d5('0x12')](_0x21d5('0x69'),_0x3ceccb[_0x21d5('0xe')],queues[_0x3ceccb[_0x21d5('0xe')]]['name'],queues[_0x3ceccb['uniqueid']][_0x21d5('0x5c')]));delete queues[_0x3ceccb[_0x21d5('0xe')]][_0x21d5('0x65')];}}}catch(_0x28bb48){utils[_0x21d5('0x20')](util['format'](_0x21d5('0x6a'),_0x3ceccb['uniqueid']),_0x28bb48);}}; \ No newline at end of file +var _0xd5c0=['queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','holdtime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','[%s][queues][agentcomplete]','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','transferuniqueid','origtransfererlinkedid','transfereelinkedid','clone','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','queuestatus','value','queuecallerabandonAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable'];(function(_0x2cf1bc,_0x42b9dd){var _0xc1385d=function(_0x4e08fa){while(--_0x4e08fa){_0x2cf1bc['push'](_0x2cf1bc['shift']());}};_0xc1385d(++_0x42b9dd);}(_0xd5c0,0x9d));var _0x0d5c=function(_0xc5c9ac,_0x57c492){_0xc5c9ac=_0xc5c9ac-0x0;var _0x3f4606=_0xd5c0[_0xc5c9ac];return _0x3f4606;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x0d5c('0x0'));var queues={};function writeDB(_0x4cbec6){utils[_0x0d5c('0x1')](util[_0x0d5c('0x2')](_0x0d5c('0x3'),_0x4cbec6[_0x0d5c('0x4')],_0x4cbec6[_0x0d5c('0x5')],_0x4cbec6[_0x0d5c('0x6')],_0x4cbec6[_0x0d5c('0x7')],_0x4cbec6['calleridnum'],_0x4cbec6[_0x0d5c('0x8')],_0x4cbec6[_0x0d5c('0x9')]));if(_0x4cbec6[_0x0d5c('0x6')]){utils['getVoiceQueueByName'](_0x4cbec6['queue'])['then'](function(_0x40cea7){if(_0x40cea7){_0x4cbec6[_0x0d5c('0xa')]=_0x40cea7['type'];}utils['request'](_0x0d5c('0xb'),_0x4cbec6);});}else{utils[_0x0d5c('0xc')](_0x0d5c('0xb'),_0x4cbec6);}if(_0x4cbec6[_0x0d5c('0xd')]){delete queues[_0x4cbec6[_0x0d5c('0xd')]];}else{delete queues[_0x4cbec6[_0x0d5c('0x4')]];}}exports[_0x0d5c('0xe')]=function(_0x16ca28){try{utils[_0x0d5c('0xf')](util['format'](_0x0d5c('0x10'),_0x16ca28[_0x0d5c('0x4')]),_0x16ca28);utils[_0x0d5c('0x1')](util['format'](_0x0d5c('0x11'),_0x16ca28[_0x0d5c('0x4')],_0x16ca28[_0x0d5c('0x6')],_0x16ca28[_0x0d5c('0x12')]));queues[_0x16ca28[_0x0d5c('0x4')]]=_[_0x0d5c('0x13')](_0x16ca28,{'originalposition':_0x16ca28[_0x0d5c('0x12')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0xc15edb){utils[_0x0d5c('0x14')](util[_0x0d5c('0x2')](_0x0d5c('0x10'),_0x16ca28[_0x0d5c('0x4')]),_0xc15edb);}};exports[_0x0d5c('0x15')]=function(_0x47181f){try{if(!_[_0x0d5c('0x16')](queues[_0x47181f[_0x0d5c('0x4')]])){utils['debug'](util[_0x0d5c('0x2')]('[%s][queues][hangup]',_0x47181f[_0x0d5c('0x4')]),_0x47181f);if(queues[_0x47181f[_0x0d5c('0x4')]][_0x0d5c('0x17')]){if(!queues[_0x47181f[_0x0d5c('0x4')]][_0x0d5c('0x18')]&&!queues[_0x47181f['uniqueid']][_0x0d5c('0x19')]){queues[_0x47181f[_0x0d5c('0x4')]][_0x0d5c('0x1a')]=!![];queues[_0x47181f[_0x0d5c('0x4')]][_0x0d5c('0x1b')]=utils[_0x0d5c('0x1c')]();queues[_0x47181f['uniqueid']][_0x0d5c('0x9')]=_0x0d5c('0x1d');}utils['info'](util[_0x0d5c('0x2')](_0x0d5c('0x1e'),_0x47181f[_0x0d5c('0x4')],queues[_0x47181f[_0x0d5c('0x4')]][_0x0d5c('0x1f')],queues[_0x47181f[_0x0d5c('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x47181f[_0x0d5c('0x4')]]);}else if(queues[_0x47181f['uniqueid']][_0x0d5c('0xd')]){utils[_0x0d5c('0x1')](util[_0x0d5c('0x2')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x47181f[_0x0d5c('0x4')],queues[_0x47181f[_0x0d5c('0x4')]][_0x0d5c('0x1f')],queues[_0x47181f[_0x0d5c('0x4')]]['transfereduniqueid']));queues[queues[_0x47181f[_0x0d5c('0x4')]]['transfereduniqueid']]=queues[_0x47181f['uniqueid']];queues[queues[_0x47181f[_0x0d5c('0x4')]]['transfereduniqueid']][_0x0d5c('0x20')]=0x2;delete queues[_0x47181f['uniqueid']];}}}catch(_0x274e83){utils[_0x0d5c('0x14')](util['format']('[%s][queues][hangup]',_0x47181f['uniqueid']),_0x274e83);}};exports[_0x0d5c('0x21')]=function(_0x537a7e){try{utils['debug'](util[_0x0d5c('0x2')](_0x0d5c('0x22'),_0x537a7e[_0x0d5c('0x4')]),_0x537a7e);if(!_[_0x0d5c('0x16')](_0x537a7e['variable'][_0x0d5c('0x23')])&&_0x537a7e[_0x0d5c('0x24')]['toUpperCase']()!=='CONTINUE'){if(!_[_0x0d5c('0x16')](queues[_0x537a7e['uniqueid']])){queues[_0x537a7e[_0x0d5c('0x4')]][_0x0d5c('0x18')]=![];queues[_0x537a7e[_0x0d5c('0x4')]][_0x0d5c('0x25')]=null;queues[_0x537a7e['uniqueid']]['queuecallerexit']=!![];queues[_0x537a7e[_0x0d5c('0x4')]]['queuecallerexitAt']=utils[_0x0d5c('0x1c')]();queues[_0x537a7e[_0x0d5c('0x4')]][_0x0d5c('0x9')]=_0x537a7e['value'][_0x0d5c('0x26')]();utils[_0x0d5c('0x1')](util[_0x0d5c('0x2')](_0x0d5c('0x27'),_0x537a7e[_0x0d5c('0x4')],queues[_0x537a7e[_0x0d5c('0x4')]][_0x0d5c('0x1f')],_0x537a7e[_0x0d5c('0x24')],queues[_0x537a7e[_0x0d5c('0x4')]][_0x0d5c('0x9')]));writeDB(queues[_0x537a7e['uniqueid']]);}}else if(!_[_0x0d5c('0x16')](_0x537a7e[_0x0d5c('0x28')][_0x0d5c('0x29')])){if(!_[_0x0d5c('0x16')](queues[_0x537a7e['uniqueid']])&&!queues[_0x537a7e[_0x0d5c('0x4')]]['queuecallerabandon']){queues[_0x537a7e[_0x0d5c('0x4')]][_0x0d5c('0x18')]=![];queues[_0x537a7e[_0x0d5c('0x4')]][_0x0d5c('0x25')]=null;queues[_0x537a7e[_0x0d5c('0x4')]][_0x0d5c('0x19')]=!![];queues[_0x537a7e['uniqueid']][_0x0d5c('0x2a')]=utils[_0x0d5c('0x1c')]();queues[_0x537a7e[_0x0d5c('0x4')]][_0x0d5c('0x9')]=_0x0d5c('0x2b');utils[_0x0d5c('0x1')](util[_0x0d5c('0x2')](_0x0d5c('0x2c'),_0x537a7e[_0x0d5c('0x4')],queues[_0x537a7e[_0x0d5c('0x4')]][_0x0d5c('0x1f')],_0x537a7e['value'],queues[_0x537a7e[_0x0d5c('0x4')]]['queuecallerexitreason']));}}}catch(_0x59a21d){utils[_0x0d5c('0x14')](util[_0x0d5c('0x2')]('[%s][queues][varset]',_0x537a7e[_0x0d5c('0x4')]),_0x59a21d);}};exports[_0x0d5c('0x18')]=function(_0xe3cfee){try{if(!_[_0x0d5c('0x16')](queues[_0xe3cfee[_0x0d5c('0x4')]])){utils['debug'](util[_0x0d5c('0x2')](_0x0d5c('0x2d'),_0xe3cfee['uniqueid']),_0xe3cfee);queues[_0xe3cfee[_0x0d5c('0x4')]][_0x0d5c('0x19')]=![];queues[_0xe3cfee['uniqueid']]['queuecallerexitAt']=null;queues[_0xe3cfee['uniqueid']][_0x0d5c('0x18')]=!![];queues[_0xe3cfee['uniqueid']][_0x0d5c('0x25')]=utils[_0x0d5c('0x1c')]();queues[_0xe3cfee[_0x0d5c('0x4')]]['queuecallerexitreason']=_0x0d5c('0x2e');utils[_0x0d5c('0x1')](util[_0x0d5c('0x2')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0xe3cfee['uniqueid'],queues[_0xe3cfee[_0x0d5c('0x4')]]['name'],queues[_0xe3cfee[_0x0d5c('0x4')]][_0x0d5c('0x9')]));}}catch(_0x255e4b){utils[_0x0d5c('0x14')](util['format'](_0x0d5c('0x2d'),_0xe3cfee['uniqueid']),_0x255e4b);}};exports[_0x0d5c('0x2f')]=function(_0x5b45dc){try{if(!_[_0x0d5c('0x16')](queues[_0x5b45dc[_0x0d5c('0x4')]])){utils[_0x0d5c('0xf')](util[_0x0d5c('0x2')](_0x0d5c('0x30'),_0x5b45dc['uniqueid']),_0x5b45dc);utils[_0x0d5c('0x1')](util['format'](_0x0d5c('0x31'),_0x5b45dc[_0x0d5c('0x4')],queues[_0x5b45dc['uniqueid']][_0x0d5c('0x1f')],_0x5b45dc['connectedlinenum'],_0x5b45dc['connectedlinename']));queues[_0x5b45dc[_0x0d5c('0x4')]][_0x0d5c('0x2f')]=!![];queues[_0x5b45dc[_0x0d5c('0x4')]][_0x0d5c('0x17')]=utils[_0x0d5c('0x1c')]();queues[_0x5b45dc[_0x0d5c('0x4')]][_0x0d5c('0x32')]=utils['diffTime'](queues[_0x5b45dc['uniqueid']][_0x0d5c('0x17')],queues[_0x5b45dc[_0x0d5c('0x4')]][_0x0d5c('0x33')]);queues[_0x5b45dc[_0x0d5c('0x4')]][_0x0d5c('0x12')]=_0x5b45dc[_0x0d5c('0x12')];queues[_0x5b45dc[_0x0d5c('0x4')]][_0x0d5c('0x34')]=_0x5b45dc[_0x0d5c('0x34')];queues[_0x5b45dc[_0x0d5c('0x4')]][_0x0d5c('0x35')]=_0x5b45dc[_0x0d5c('0x35')];queues[_0x5b45dc['uniqueid']][_0x0d5c('0x36')]=_0x5b45dc[_0x0d5c('0x36')];}}catch(_0x1aa916){utils[_0x0d5c('0x14')](util[_0x0d5c('0x2')]('[%s][queues][queuecallerleave]',_0x5b45dc[_0x0d5c('0x4')]),_0x1aa916);}};exports[_0x0d5c('0x37')]=function(_0x39dc4b){try{if(!_['isNil'](queues[_0x39dc4b[_0x0d5c('0x4')]])){utils[_0x0d5c('0xf')](util['format'](_0x0d5c('0x38'),_0x39dc4b[_0x0d5c('0x4')]),_0x39dc4b);utils['info'](util[_0x0d5c('0x2')](_0x0d5c('0x39'),_0x39dc4b[_0x0d5c('0x4')],queues[_0x39dc4b['uniqueid']]['name'],_0x39dc4b['membername'],_0x39dc4b[_0x0d5c('0x3a')]));queues[_0x39dc4b[_0x0d5c('0x4')]][_0x0d5c('0x18')]=![];queues[_0x39dc4b[_0x0d5c('0x4')]][_0x0d5c('0x18')]=![];queues[_0x39dc4b[_0x0d5c('0x4')]][_0x0d5c('0x25')]=null;queues[_0x39dc4b['uniqueid']][_0x0d5c('0x19')]=![];queues[_0x39dc4b[_0x0d5c('0x4')]][_0x0d5c('0x9')]=null;queues[_0x39dc4b[_0x0d5c('0x4')]]['queuecallerexitAt']=null;queues[_0x39dc4b['uniqueid']][_0x0d5c('0x3b')]=!![];queues[_0x39dc4b[_0x0d5c('0x4')]][_0x0d5c('0x8')]=_0x39dc4b['destaccountcode'];queues[_0x39dc4b[_0x0d5c('0x4')]][_0x0d5c('0x7')]=_0x39dc4b[_0x0d5c('0x3c')];}}catch(_0x1e8a36){utils['error'](util[_0x0d5c('0x2')]('[%s][queues][agentconnect]',_0x39dc4b[_0x0d5c('0x4')]),_0x1e8a36);}};exports['agentcomplete']=function(_0x234ae8){try{if(!_[_0x0d5c('0x16')](queues[_0x234ae8[_0x0d5c('0x4')]])){if(queues[_0x234ae8[_0x0d5c('0x4')]]['queuecallerleaveAt']){utils[_0x0d5c('0xf')](util[_0x0d5c('0x2')](_0x0d5c('0x3d'),_0x234ae8[_0x0d5c('0x4')]),_0x234ae8);queues[_0x234ae8['uniqueid']][_0x0d5c('0x18')]=![];queues[_0x234ae8[_0x0d5c('0x4')]][_0x0d5c('0x18')]=![];queues[_0x234ae8[_0x0d5c('0x4')]][_0x0d5c('0x25')]=null;queues[_0x234ae8[_0x0d5c('0x4')]][_0x0d5c('0x19')]=![];queues[_0x234ae8[_0x0d5c('0x4')]][_0x0d5c('0x2a')]=null;queues[_0x234ae8['uniqueid']][_0x0d5c('0x3b')]=!![];queues[_0x234ae8['uniqueid']]['lastAssignedTo']=_0x234ae8[_0x0d5c('0x3c')];queues[_0x234ae8[_0x0d5c('0x4')]][_0x0d5c('0x1a')]=!![];queues[_0x234ae8[_0x0d5c('0x4')]][_0x0d5c('0x1b')]=utils[_0x0d5c('0x1c')]();if(_0x234ae8['reason']==_0x0d5c('0x3e')){if(!queues[_0x234ae8['uniqueid']][_0x0d5c('0x3e')]){queues[_0x234ae8[_0x0d5c('0x4')]][_0x0d5c('0x9')]=_0x0d5c('0x3f');}}else{queues[_0x234ae8['uniqueid']][_0x0d5c('0x9')]=_0x0d5c('0x40')+_0x234ae8[_0x0d5c('0x41')][_0x0d5c('0x26')]();}utils['info'](util[_0x0d5c('0x2')](_0x0d5c('0x42'),_0x234ae8[_0x0d5c('0x4')],queues[_0x234ae8[_0x0d5c('0x4')]]['name'],_0x234ae8[_0x0d5c('0x3c')],queues[_0x234ae8['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x234ae8['uniqueid']]);}}}catch(_0x6fc4d){utils[_0x0d5c('0x14')](util[_0x0d5c('0x2')](_0x0d5c('0x3d'),_0x234ae8[_0x0d5c('0x4')]),_0x6fc4d);}};exports[_0x0d5c('0x43')]=function(_0x41be40){try{if(!_['isNil'](queues[_0x41be40[_0x0d5c('0x44')]])){utils[_0x0d5c('0xf')](util[_0x0d5c('0x2')]('[%s][queues][blindtransfer]',_0x41be40[_0x0d5c('0x4')]),_0x41be40);queues[_0x41be40[_0x0d5c('0x44')]][_0x0d5c('0x3e')]=!![];queues[_0x41be40[_0x0d5c('0x44')]][_0x0d5c('0x45')]=_0x0d5c('0x46');queues[_0x41be40[_0x0d5c('0x44')]][_0x0d5c('0x47')]=_0x41be40[_0x0d5c('0x48')];queues[_0x41be40['transfereeuniqueid']]['transferuniqueid']=_0x41be40[_0x0d5c('0x44')];queues[_0x41be40[_0x0d5c('0x44')]][_0x0d5c('0x9')]='BLINDTRANSFER';utils[_0x0d5c('0x1')](util['format']('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x41be40[_0x0d5c('0x4')],queues[_0x41be40[_0x0d5c('0x44')]][_0x0d5c('0x1f')],_0x41be40[_0x0d5c('0x44')],_0x41be40[_0x0d5c('0x48')]));}}catch(_0x593fc8){utils[_0x0d5c('0x14')](util[_0x0d5c('0x2')]('[%s][queues][blindtransfer]',_0x41be40[_0x0d5c('0x4')]),_0x593fc8);}};exports[_0x0d5c('0x49')]=function(_0x24db8d){try{utils['debug'](util[_0x0d5c('0x2')](_0x0d5c('0x4a'),_0x24db8d['origtransfereruniqueid']),_0x24db8d);if(_0x24db8d[_0x0d5c('0x4b')]==_0x24db8d['origtransfererlinkedid']){if(!_[_0x0d5c('0x16')](queues[_0x24db8d[_0x0d5c('0x4c')]])){utils[_0x0d5c('0x1')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x24db8d[_0x0d5c('0x4b')],queues[_0x24db8d[_0x0d5c('0x4c')]][_0x0d5c('0x1f')],_0x24db8d['origtransfererexten']));queues[_0x24db8d[_0x0d5c('0x4c')]][_0x0d5c('0x3e')]=!![];queues[_0x24db8d[_0x0d5c('0x4c')]][_0x0d5c('0x45')]='ATTENDED';queues[_0x24db8d[_0x0d5c('0x4c')]][_0x0d5c('0x47')]=_0x24db8d[_0x0d5c('0x4d')];queues[_0x24db8d[_0x0d5c('0x4c')]][_0x0d5c('0x4e')]=_0x24db8d['origtransfereruniqueid'];queues[_0x24db8d['secondtransfererlinkedid']]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x0d5c('0x16')](queues[_0x24db8d[_0x0d5c('0x4f')]])){if(_0x24db8d['transfereelinkedid']&&queues[_0x24db8d[_0x0d5c('0x50')]]){queues[_0x24db8d[_0x0d5c('0x50')]]['queuecallerenterreason']=0x1;queues[_0x24db8d[_0x0d5c('0x44')]]=_[_0x0d5c('0x51')](queues[_0x24db8d[_0x0d5c('0x50')]]);queues[_0x24db8d[_0x0d5c('0x44')]]['transfereduniqueid']=_0x24db8d['transfertargetuniqueid'];queues[_0x24db8d[_0x0d5c('0x44')]][_0x0d5c('0x20')]=0x2;queues[_0x24db8d['transfereeuniqueid']][_0x0d5c('0x52')]=queues[_0x24db8d[_0x0d5c('0x4c')]][_0x0d5c('0x52')];queues[_0x24db8d[_0x0d5c('0x44')]]['calleridname']=queues[_0x24db8d[_0x0d5c('0x4c')]][_0x0d5c('0x53')];queues[_0x24db8d['transfereeuniqueid']][_0x0d5c('0x33')]=utils['now']();queues[_0x24db8d[_0x0d5c('0x44')]][_0x0d5c('0x17')]=utils[_0x0d5c('0x1c')]();queues[_0x24db8d[_0x0d5c('0x44')]][_0x0d5c('0x32')]=0x0;queues[_0x24db8d[_0x0d5c('0x44')]][_0x0d5c('0x54')]=0x0;utils[_0x0d5c('0x1')](util[_0x0d5c('0x2')](_0x0d5c('0x55'),_0x24db8d[_0x0d5c('0x4b')],queues[_0x24db8d[_0x0d5c('0x44')]][_0x0d5c('0x1f')],queues[_0x24db8d['transfereeuniqueid']]['calleridnum'],queues[_0x24db8d[_0x0d5c('0x44')]][_0x0d5c('0x53')]));}else{utils[_0x0d5c('0x1')](util[_0x0d5c('0x2')](_0x0d5c('0x56'),_0x24db8d[_0x0d5c('0x4b')],queues[_0x24db8d[_0x0d5c('0x4f')]]['name'],_0x24db8d[_0x0d5c('0x4c')]));queues[_0x24db8d['origtransfererlinkedid']]['transfereduniqueid']=_0x24db8d[_0x0d5c('0x4c')];}}}else if(_0x24db8d[_0x0d5c('0x57')]==_0x24db8d[_0x0d5c('0x4c')]){if(!_[_0x0d5c('0x16')](queues[_0x24db8d[_0x0d5c('0x4f')]])){utils[_0x0d5c('0x1')](util[_0x0d5c('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x24db8d[_0x0d5c('0x4b')],queues[_0x24db8d[_0x0d5c('0x4f')]][_0x0d5c('0x1f')],_0x24db8d['secondtransfereruniqueid'],_0x24db8d[_0x0d5c('0x58')]));queues[_0x24db8d['origtransfererlinkedid']][_0x0d5c('0x3e')]=!![];queues[_0x24db8d[_0x0d5c('0x4f')]]['transfertype']='ATTENDED';queues[_0x24db8d[_0x0d5c('0x4f')]][_0x0d5c('0x47')]=_0x24db8d[_0x0d5c('0x58')];queues[_0x24db8d['origtransfererlinkedid']][_0x0d5c('0x4e')]=_0x24db8d[_0x0d5c('0x57')];queues[_0x24db8d['origtransfererlinkedid']][_0x0d5c('0x9')]=_0x0d5c('0x59');}if(!_[_0x0d5c('0x16')](queues[_0x24db8d[_0x0d5c('0x4c')]])){if(_0x24db8d[_0x0d5c('0x5a')]&&queues[_0x24db8d[_0x0d5c('0x5a')]]){queues[_0x24db8d[_0x0d5c('0x5a')]]['queuecallerenterreason']=0x1;queues[_0x24db8d[_0x0d5c('0x5b')]]=_[_0x0d5c('0x51')](queues[_0x24db8d['transfertargetlinkedid']]);queues[_0x24db8d[_0x0d5c('0x5b')]][_0x0d5c('0xd')]=_0x24db8d[_0x0d5c('0x5b')];queues[_0x24db8d[_0x0d5c('0x5b')]][_0x0d5c('0x20')]=0x2;queues[_0x24db8d[_0x0d5c('0x5b')]][_0x0d5c('0x52')]=queues[_0x24db8d[_0x0d5c('0x4f')]]['calleridnum'];queues[_0x24db8d[_0x0d5c('0x5b')]][_0x0d5c('0x53')]=queues[_0x24db8d['origtransfererlinkedid']][_0x0d5c('0x53')];queues[_0x24db8d['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x0d5c('0x1c')]();queues[_0x24db8d[_0x0d5c('0x5b')]][_0x0d5c('0x17')]=utils['now']();queues[_0x24db8d['transfertargetuniqueid']][_0x0d5c('0x32')]=0x0;queues[_0x24db8d['transfertargetuniqueid']][_0x0d5c('0x54')]=0x0;utils[_0x0d5c('0x1')](util[_0x0d5c('0x2')](_0x0d5c('0x5c'),_0x24db8d[_0x0d5c('0x4b')],queues[_0x24db8d['transfertargetuniqueid']][_0x0d5c('0x1f')],queues[_0x24db8d['transfertargetuniqueid']][_0x0d5c('0xd')],queues[_0x24db8d[_0x0d5c('0x5b')]]['calleridnum'],queues[_0x24db8d['transfertargetuniqueid']][_0x0d5c('0x53')]));}else{utils[_0x0d5c('0x1')](util[_0x0d5c('0x2')](_0x0d5c('0x56'),_0x24db8d[_0x0d5c('0x4b')],queues[_0x24db8d[_0x0d5c('0x4c')]][_0x0d5c('0x1f')],_0x24db8d[_0x0d5c('0x4f')]));queues[_0x24db8d[_0x0d5c('0x4c')]][_0x0d5c('0xd')]=_0x24db8d[_0x0d5c('0x4f')];}}}}catch(_0x32e301){utils[_0x0d5c('0x14')](util[_0x0d5c('0x2')](_0x0d5c('0x4a'),_0x24db8d['origtransfereruniqueid']),_0x32e301);}};exports[_0x0d5c('0x5d')]=function(_0x3e93f8){try{if(!_[_0x0d5c('0x16')](queues[_0x3e93f8[_0x0d5c('0x4')]])){utils[_0x0d5c('0xf')](util[_0x0d5c('0x2')]('[%s][queues][musiconholdstart]',_0x3e93f8[_0x0d5c('0x4')]),_0x3e93f8);queues[_0x3e93f8[_0x0d5c('0x4')]][_0x0d5c('0x5e')]=utils[_0x0d5c('0x1c')]();utils[_0x0d5c('0x1')](util['format'](_0x0d5c('0x5f'),_0x3e93f8[_0x0d5c('0x4')],queues[_0x3e93f8[_0x0d5c('0x4')]][_0x0d5c('0x1f')],queues[_0x3e93f8[_0x0d5c('0x4')]][_0x0d5c('0x5e')]));}}catch(_0x1d7464){utils[_0x0d5c('0x14')](util[_0x0d5c('0x2')]('[%s][queues][musiconholdstart]',_0x3e93f8['uniqueid']),_0x1d7464);}};exports[_0x0d5c('0x60')]=function(_0x35f78d){try{if(!_[_0x0d5c('0x16')](queues[_0x35f78d[_0x0d5c('0x4')]])){if(!_[_0x0d5c('0x16')](queues[_0x35f78d[_0x0d5c('0x4')]][_0x0d5c('0x5e')])){utils[_0x0d5c('0xf')](util[_0x0d5c('0x2')]('[%s][queues][musiconholdstop]',_0x35f78d[_0x0d5c('0x4')]),_0x35f78d);queues[_0x35f78d[_0x0d5c('0x4')]][_0x0d5c('0x54')]+=utils[_0x0d5c('0x61')](utils[_0x0d5c('0x1c')](),queues[_0x35f78d[_0x0d5c('0x4')]][_0x0d5c('0x5e')]);utils[_0x0d5c('0x1')](util[_0x0d5c('0x2')](_0x0d5c('0x62'),_0x35f78d['uniqueid'],queues[_0x35f78d[_0x0d5c('0x4')]][_0x0d5c('0x1f')],queues[_0x35f78d[_0x0d5c('0x4')]][_0x0d5c('0x54')]));delete queues[_0x35f78d[_0x0d5c('0x4')]][_0x0d5c('0x5e')];}}}catch(_0x1fecd9){utils['error'](util[_0x0d5c('0x2')]('[%s][queues][musiconholdstop]',_0x35f78d[_0x0d5c('0x4')]),_0x1fecd9);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 3dac69b..d80cb2e 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 _0xd78f=['[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','cause-txt','connectedlinenum','connectedlinename','type','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','cdr','appdata','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0xd78f,0x1d4));var _0xfd78=function(_0x59e713,_0x3b41d5){_0x59e713=_0x59e713-0x0;var _0x2bd8ff=_0xd78f[_0x59e713];return _0x2bd8ff;};'use strict';var _=require('lodash');var util=require(_0xfd78('0x0'));var utils=require(_0xfd78('0x1'));var recordings={};function writeDB(_0x317694){utils[_0xfd78('0x2')](util[_0xfd78('0x3')](_0xfd78('0x4'),_0x317694[_0xfd78('0x5')]));if(_0x317694[_0xfd78('0x6')]){utils[_0xfd78('0x7')](_0x317694[_0xfd78('0x6')])['then'](function(_0x102f32){if(_0x102f32){_0x317694[_0xfd78('0x8')]=_0x102f32[_0xfd78('0x9')];_0x317694[_0xfd78('0xa')]=_0x102f32['id'];}utils[_0xfd78('0xb')](_0xfd78('0xc'),_0x317694);});}else{utils[_0xfd78('0xb')](_0xfd78('0xc'),_0x317694);}}exports[_0xfd78('0xd')]=function(_0x534426){try{utils[_0xfd78('0xe')](util[_0xfd78('0x3')](_0xfd78('0xf'),_0x534426[_0xfd78('0x5')]),_0x534426);if(_0x534426[_0xfd78('0x5')]==_0x534426[_0xfd78('0x10')]){utils[_0xfd78('0x2')](util[_0xfd78('0x3')](_0xfd78('0x11'),_0x534426[_0xfd78('0x5')],_0x534426[_0xfd78('0x12')],_0x534426[_0xfd78('0x13')]));recordings[_0x534426['uniqueid']]={'uniqueid':_0x534426[_0xfd78('0x5')],'accountcode':_0x534426[_0xfd78('0x6')],'exten':_0x534426['exten'],'context':_0x534426[_0xfd78('0x12')],'channel':_0x534426[_0xfd78('0x14')],'monitors':[]};}}catch(_0x2ba4ba){utils[_0xfd78('0x15')](util[_0xfd78('0x3')](_0xfd78('0xf'),_0x534426[_0xfd78('0x5')]),_0x2ba4ba);}};exports[_0xfd78('0x16')]=function(_0x328dbd){try{utils[_0xfd78('0xe')](util[_0xfd78('0x3')](_0xfd78('0x17'),_0x328dbd['uniqueid']),_0x328dbd);if(!_[_0xfd78('0x18')](recordings[_0x328dbd['uniqueid']])&&_0x328dbd[_0xfd78('0x19')]==0x6){utils[_0xfd78('0x2')](util[_0xfd78('0x3')](_0xfd78('0x1a'),_0x328dbd['uniqueid'],_0x328dbd[_0xfd78('0x12')],_0x328dbd[_0xfd78('0x14')]));}else if(!_['isNil'](recordings[_0x328dbd[_0xfd78('0x10')]])&&_0x328dbd[_0xfd78('0x19')]==0x6&&_0x328dbd['context']!=_0xfd78('0x1b')){utils[_0xfd78('0x2')](util[_0xfd78('0x3')](_0xfd78('0x1c'),_0x328dbd[_0xfd78('0x5')],_0x328dbd[_0xfd78('0x10')],_0x328dbd['context'],_0x328dbd[_0xfd78('0x14')]));recordings[_0x328dbd[_0xfd78('0x10')]]['accountcode']=_0x328dbd['accountcode'];}}catch(_0x444f46){utils[_0xfd78('0x15')](util[_0xfd78('0x3')](_0xfd78('0x17'),_0x328dbd[_0xfd78('0x5')]),_0x444f46);}};exports[_0xfd78('0x1d')]=function(_0x39d547){try{if(!_[_0xfd78('0x18')](_0x39d547[_0xfd78('0x1e')])&&!_[_0xfd78('0x18')](_0x39d547[_0xfd78('0x1e')]['mixmonitor_filename'])){utils['debug'](util[_0xfd78('0x3')]('[%s][recordings][varset]',_0x39d547[_0xfd78('0x5')]),_0x39d547);utils['info'](util[_0xfd78('0x3')](_0xfd78('0x1f'),_0x39d547[_0xfd78('0x5')],_0x39d547[_0xfd78('0x1e')],_0x39d547[_0xfd78('0x20')]));if(_[_0xfd78('0x21')](_0x39d547[_0xfd78('0x20')],'.wav49')){_0x39d547[_0xfd78('0x20')]=_0x39d547[_0xfd78('0x20')]['replace'](_0xfd78('0x22'),_0xfd78('0x23'));}if(recordings[_0x39d547[_0xfd78('0x10')]]){var _0x53d273=_['find'](recordings[_0x39d547[_0xfd78('0x10')]][_0xfd78('0x24')],{'value':_0x39d547[_0xfd78('0x20')]});if(_[_0xfd78('0x18')](_0x53d273)){recordings[_0x39d547[_0xfd78('0x10')]][_0xfd78('0x24')][_0xfd78('0x25')]({'value':_0x39d547['value']});}}}}catch(_0x58ea6c){utils[_0xfd78('0x15')](util['format']('[%s][recordings][varset]',_0x39d547[_0xfd78('0x5')]),_0x58ea6c);}};exports[_0xfd78('0x26')]=function(_0x4e80d2){try{if(!_[_0xfd78('0x18')](recordings[_0x4e80d2[_0xfd78('0x5')]])){utils[_0xfd78('0xe')](util['format'](_0xfd78('0x27'),_0x4e80d2[_0xfd78('0x5')]),_0x4e80d2);utils[_0xfd78('0x2')](util[_0xfd78('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x4e80d2[_0xfd78('0x5')],_0x4e80d2[_0xfd78('0x28')],_0x4e80d2['calleridname'],_0x4e80d2[_0xfd78('0x29')]));recordings[_0x4e80d2[_0xfd78('0x5')]][_0xfd78('0x28')]=_0x4e80d2[_0xfd78('0x28')];recordings[_0x4e80d2[_0xfd78('0x5')]]['calleridname']=_0x4e80d2['calleridname'];recordings[_0x4e80d2['uniqueid']][_0xfd78('0x2a')]=_0x4e80d2[_0xfd78('0x2a')];recordings[_0x4e80d2[_0xfd78('0x5')]][_0xfd78('0x2b')]=_0x4e80d2[_0xfd78('0x2b')];if(recordings[_0x4e80d2[_0xfd78('0x5')]][_0xfd78('0x2c')]=='outbound'&&recordings[_0x4e80d2[_0xfd78('0x5')]][_0xfd78('0x6')]){recordings[_0x4e80d2['uniqueid']][_0xfd78('0x2a')]=recordings[_0x4e80d2[_0xfd78('0x5')]][_0xfd78('0x6')];recordings[_0x4e80d2[_0xfd78('0x5')]][_0xfd78('0x2b')]='';}recordings[_0x4e80d2['uniqueid']]['monitors'][_0xfd78('0x2d')](function(_0x1478a9){var _0x16b65c=_[_0xfd78('0x2e')](recordings[_0x4e80d2[_0xfd78('0x5')]]);_0x16b65c[_0xfd78('0x20')]=_0x1478a9[_0xfd78('0x20')];writeDB(_0x16b65c);});delete recordings[_0x4e80d2[_0xfd78('0x5')]];}}catch(_0x26ece2){utils['error'](util['format']('[%s][recordings][hangup]',_0x4e80d2[_0xfd78('0x5')]),_0x26ece2);}};exports[_0xfd78('0x2f')]=function(_0x54c998){try{if(!_['isNil'](recordings[_0x54c998[_0xfd78('0x5')]])){utils[_0xfd78('0xe')](util[_0xfd78('0x3')]('[%s][recordings][newexten]',_0x54c998[_0xfd78('0x5')]),_0x54c998);utils[_0xfd78('0x2')](util['format'](_0xfd78('0x30'),_0x54c998[_0xfd78('0x5')],_0x54c998[_0xfd78('0x31')],_0x54c998['appdata']));if(_0x54c998[_0xfd78('0x31')][_0xfd78('0x32')]()=='set'&&_[_0xfd78('0x33')](_0x54c998['appdata'][_0xfd78('0x32')](),_0xfd78('0x34'))){var _0x108cc9=_0x54c998[_0xfd78('0x35')][_0xfd78('0x36')]('=');var _0x1ae125=_0x108cc9[0x0][_0xfd78('0x37')](_0x108cc9[0x0][_0xfd78('0x38')]('(')+0x1,_0x108cc9[0x0][_0xfd78('0x38')](')'));var _0x202c7a=_0x108cc9[0x1];recordings[_0x54c998[_0xfd78('0x5')]][_0x1ae125]=_0x202c7a;}}}catch(_0x16c86d){utils[_0xfd78('0x15')](util['format'](_0xfd78('0x39'),_0x54c998[_0xfd78('0x5')]),_0x16c86d);}};exports[_0xfd78('0x3a')]=function(_0x3a8b37){try{if(!_[_0xfd78('0x18')](recordings[_0x3a8b37[_0xfd78('0x5')]])){utils[_0xfd78('0xe')](util[_0xfd78('0x3')]('[%s][recordings][queuecallerjoin]',_0x3a8b37[_0xfd78('0x5')]),_0x3a8b37);utils[_0xfd78('0x2')](util[_0xfd78('0x3')](_0xfd78('0x3b'),_0x3a8b37[_0xfd78('0x5')],_0x3a8b37[_0xfd78('0x3c')]));recordings[_0x3a8b37[_0xfd78('0x5')]][_0xfd78('0x3c')]=_0x3a8b37[_0xfd78('0x3c')];}}catch(_0x56a18e){utils[_0xfd78('0x15')](util[_0xfd78('0x3')](_0xfd78('0x3d'),_0x3a8b37['uniqueid']),_0x56a18e);}}; \ No newline at end of file +var _0x4266=['channelstate','transfer','varset','variable','mixmonitor_filename','[%s][recordings][varset]','endsWith','value','.wav49','replace','find','monitors','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','appdata','cdr','split','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','./utils','info','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','membername','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','context'];(function(_0x23f0ba,_0x4a7be4){var _0x41bd76=function(_0x464c81){while(--_0x464c81){_0x23f0ba['push'](_0x23f0ba['shift']());}};_0x41bd76(++_0x4a7be4);}(_0x4266,0x119));var _0x6426=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x4266[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x6426('0x0'));var util=require('util');var utils=require(_0x6426('0x1'));var recordings={};function writeDB(_0x1b33f5){utils[_0x6426('0x2')](util[_0x6426('0x3')](_0x6426('0x4'),_0x1b33f5['uniqueid']));if(_0x1b33f5[_0x6426('0x5')]){utils[_0x6426('0x6')](_0x1b33f5[_0x6426('0x5')])[_0x6426('0x7')](function(_0x42efc9){if(_0x42efc9){_0x1b33f5[_0x6426('0x8')]=_0x42efc9['name'];_0x1b33f5['UserId']=_0x42efc9['id'];}utils[_0x6426('0x9')](_0x6426('0xa'),_0x1b33f5);});}else{utils[_0x6426('0x9')](_0x6426('0xa'),_0x1b33f5);}}exports[_0x6426('0xb')]=function(_0x5ecf18){try{utils[_0x6426('0xc')](util[_0x6426('0x3')](_0x6426('0xd'),_0x5ecf18[_0x6426('0xe')]),_0x5ecf18);if(_0x5ecf18['uniqueid']==_0x5ecf18[_0x6426('0xf')]){utils[_0x6426('0x2')](util[_0x6426('0x3')](_0x6426('0x10'),_0x5ecf18['uniqueid'],_0x5ecf18['context'],_0x5ecf18['exten']));recordings[_0x5ecf18[_0x6426('0xe')]]={'uniqueid':_0x5ecf18[_0x6426('0xe')],'accountcode':_0x5ecf18[_0x6426('0x5')],'exten':_0x5ecf18[_0x6426('0x11')],'context':_0x5ecf18['context'],'channel':_0x5ecf18[_0x6426('0x12')],'monitors':[]};}}catch(_0x55dfce){utils[_0x6426('0x13')](util[_0x6426('0x3')](_0x6426('0xd'),_0x5ecf18['uniqueid']),_0x55dfce);}};exports[_0x6426('0x14')]=function(_0x3b9222){try{utils[_0x6426('0xc')](util[_0x6426('0x3')](_0x6426('0x15'),_0x3b9222[_0x6426('0xe')]),_0x3b9222);if(!_[_0x6426('0x16')](recordings[_0x3b9222['uniqueid']])&&_0x3b9222['channelstate']==0x6){utils['info'](util[_0x6426('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x3b9222[_0x6426('0xe')],_0x3b9222[_0x6426('0x17')],_0x3b9222[_0x6426('0x12')]));}else if(!_[_0x6426('0x16')](recordings[_0x3b9222[_0x6426('0xf')]])&&_0x3b9222[_0x6426('0x18')]==0x6&&_0x3b9222[_0x6426('0x17')]!=_0x6426('0x19')){utils[_0x6426('0x2')](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x3b9222['uniqueid'],_0x3b9222['linkedid'],_0x3b9222[_0x6426('0x17')],_0x3b9222['channel']));recordings[_0x3b9222[_0x6426('0xf')]][_0x6426('0x5')]=_0x3b9222[_0x6426('0x5')];}}catch(_0x5d7c88){utils[_0x6426('0x13')](util['format'](_0x6426('0x15'),_0x3b9222['uniqueid']),_0x5d7c88);}};exports[_0x6426('0x1a')]=function(_0x427c52){try{if(!_[_0x6426('0x16')](_0x427c52[_0x6426('0x1b')])&&!_[_0x6426('0x16')](_0x427c52[_0x6426('0x1b')][_0x6426('0x1c')])){utils[_0x6426('0xc')](util[_0x6426('0x3')](_0x6426('0x1d'),_0x427c52['uniqueid']),_0x427c52);utils[_0x6426('0x2')](util[_0x6426('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x427c52[_0x6426('0xe')],_0x427c52[_0x6426('0x1b')],_0x427c52['value']));if(_[_0x6426('0x1e')](_0x427c52[_0x6426('0x1f')],_0x6426('0x20'))){_0x427c52[_0x6426('0x1f')]=_0x427c52[_0x6426('0x1f')][_0x6426('0x21')](_0x6426('0x20'),'.WAV');}if(recordings[_0x427c52[_0x6426('0xf')]]){var _0x3d9f7f=_[_0x6426('0x22')](recordings[_0x427c52[_0x6426('0xf')]][_0x6426('0x23')],{'value':_0x427c52['value']});if(_[_0x6426('0x16')](_0x3d9f7f)){recordings[_0x427c52[_0x6426('0xf')]]['monitors']['push']({'value':_0x427c52[_0x6426('0x1f')]});}}}}catch(_0xe1009d){utils[_0x6426('0x13')](util[_0x6426('0x3')]('[%s][recordings][varset]',_0x427c52[_0x6426('0xe')]),_0xe1009d);}};exports[_0x6426('0x24')]=function(_0x1890be){try{if(!_[_0x6426('0x16')](recordings[_0x1890be[_0x6426('0xe')]])){utils[_0x6426('0xc')](util[_0x6426('0x3')]('[%s][recordings][hangup]',_0x1890be[_0x6426('0xe')]),_0x1890be);utils[_0x6426('0x2')](util['format'](_0x6426('0x25'),_0x1890be['uniqueid'],_0x1890be[_0x6426('0x26')],_0x1890be['calleridname'],_0x1890be[_0x6426('0x27')]));recordings[_0x1890be['uniqueid']][_0x6426('0x26')]=_0x1890be[_0x6426('0x26')];recordings[_0x1890be[_0x6426('0xe')]][_0x6426('0x28')]=_0x1890be[_0x6426('0x28')];recordings[_0x1890be[_0x6426('0xe')]]['connectedlinenum']=_0x1890be[_0x6426('0x29')];recordings[_0x1890be[_0x6426('0xe')]][_0x6426('0x2a')]=_0x1890be[_0x6426('0x2a')];if(recordings[_0x1890be['uniqueid']][_0x6426('0x2b')]==_0x6426('0x2c')&&recordings[_0x1890be[_0x6426('0xe')]][_0x6426('0x5')]){recordings[_0x1890be[_0x6426('0xe')]][_0x6426('0x29')]=recordings[_0x1890be[_0x6426('0xe')]][_0x6426('0x5')];recordings[_0x1890be[_0x6426('0xe')]][_0x6426('0x2a')]='';}recordings[_0x1890be[_0x6426('0xe')]][_0x6426('0x23')][_0x6426('0x2d')](function(_0x1fe349){var _0x1957f1=_[_0x6426('0x2e')](recordings[_0x1890be[_0x6426('0xe')]]);_0x1957f1[_0x6426('0x1f')]=_0x1fe349['value'];writeDB(_0x1957f1);});delete recordings[_0x1890be[_0x6426('0xe')]];}}catch(_0x116285){utils[_0x6426('0x13')](util[_0x6426('0x3')](_0x6426('0x2f'),_0x1890be[_0x6426('0xe')]),_0x116285);}};exports[_0x6426('0x30')]=function(_0x543445){try{if(!_['isNil'](recordings[_0x543445['uniqueid']])){utils[_0x6426('0xc')](util[_0x6426('0x3')](_0x6426('0x31'),_0x543445[_0x6426('0xe')]),_0x543445);utils[_0x6426('0x2')](util['format'](_0x6426('0x32'),_0x543445['uniqueid'],_0x543445[_0x6426('0x33')],_0x543445['appdata']));if(_0x543445[_0x6426('0x33')]['toLowerCase']()==_0x6426('0x34')&&_[_0x6426('0x35')](_0x543445[_0x6426('0x36')]['toLowerCase'](),_0x6426('0x37'))){var _0x4b7964=_0x543445[_0x6426('0x36')][_0x6426('0x38')]('=');var _0x477460=_0x4b7964[0x0]['substring'](_0x4b7964[0x0][_0x6426('0x39')]('(')+0x1,_0x4b7964[0x0]['lastIndexOf'](')'));var _0x5c2ac2=_0x4b7964[0x1];recordings[_0x543445[_0x6426('0xe')]][_0x477460]=_0x5c2ac2;}}}catch(_0x57c20b){utils[_0x6426('0x13')](util[_0x6426('0x3')]('[%s][recordings][newexten]',_0x543445[_0x6426('0xe')]),_0x57c20b);}};exports['queuecallerjoin']=function(_0xe060c6){try{if(!_[_0x6426('0x16')](recordings[_0xe060c6[_0x6426('0xe')]])){utils['debug'](util[_0x6426('0x3')](_0x6426('0x3a'),_0xe060c6[_0x6426('0xe')]),_0xe060c6);utils['info'](util[_0x6426('0x3')](_0x6426('0x3b'),_0xe060c6['uniqueid'],_0xe060c6[_0x6426('0x3c')]));recordings[_0xe060c6[_0x6426('0xe')]][_0x6426('0x3c')]=_0xe060c6['queue'];}}catch(_0x4ce6d7){utils['error'](util[_0x6426('0x3')](_0x6426('0x3a'),_0xe060c6[_0x6426('0xe')]),_0x4ce6d7);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index c6d9118..9351ec6 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 _0xa824=['format','[%s][transfers][writeDB]\x20type:%s','origtransfereruniqueid','uniqueid','type','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetlinkedid','lodash','util','info'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa824,0x99));var _0x4a82=function(_0x34919b,_0x1e409a){_0x34919b=_0x34919b-0x0;var _0x505b56=_0xa824[_0x34919b];return _0x505b56;};'use strict';var _=require(_0x4a82('0x0'));var util=require(_0x4a82('0x1'));var utils=require('./utils');function writeDB(_0xde0ef5){utils[_0x4a82('0x2')](util[_0x4a82('0x3')](_0x4a82('0x4'),_0xde0ef5['type']==='attended'?_0xde0ef5[_0x4a82('0x5')]:_0xde0ef5[_0x4a82('0x6')],_0xde0ef5[_0x4a82('0x7')]));utils[_0x4a82('0x8')](_0x4a82('0x9'),_0xde0ef5);}exports[_0x4a82('0xa')]=function(_0x428ad6){try{utils[_0x4a82('0xb')](util['format'](_0x4a82('0xc'),_0x428ad6[_0x4a82('0x6')]),_0x428ad6);utils[_0x4a82('0x2')](util[_0x4a82('0x3')](_0x4a82('0xd'),_0x428ad6[_0x4a82('0x6')],_0x428ad6[_0x4a82('0xe')],_0x428ad6[_0x4a82('0xf')],_0x428ad6[_0x4a82('0x10')],_0x428ad6['transfereecalleridname']));_0x428ad6['type']=_0x4a82('0x11');writeDB(_0x428ad6);}catch(_0x362e28){utils[_0x4a82('0x12')](util[_0x4a82('0x3')](_0x4a82('0xc'),_0x428ad6[_0x4a82('0x6')]),_0x362e28);}};exports[_0x4a82('0x13')]=function(_0x167eff){try{utils['debug'](util[_0x4a82('0x3')](_0x4a82('0x14'),_0x167eff[_0x4a82('0x5')]),_0x167eff);utils[_0x4a82('0x2')](util[_0x4a82('0x3')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x167eff[_0x4a82('0x5')],_0x167eff['origtransferercalleridnum'],_0x167eff[_0x4a82('0x15')],_0x167eff[_0x4a82('0x16')],_0x167eff[_0x4a82('0x17')]));_0x167eff=_[_0x4a82('0x18')](_0x167eff,{'transfererchannel':_0x167eff[_0x4a82('0x19')],'transferercalleridnum':_0x167eff[_0x4a82('0x1a')],'transferercalleridname':_0x167eff[_0x4a82('0x15')],'transfererconnectedlinenum':_0x167eff[_0x4a82('0x1b')],'transfererconnectedlinename':_0x167eff[_0x4a82('0x1c')],'transfereraccountcode':_0x167eff['origtransfereraccountcode'],'transferercontext':_0x167eff[_0x4a82('0x1d')],'transfererexten':_0x167eff[_0x4a82('0x1e')],'transfererlinkedid':_0x167eff['origtransfererlinkedid'],'context':_0x167eff[_0x4a82('0x1f')],'extension':_0x167eff[_0x4a82('0x20')],'type':_0x4a82('0x21')});if(_[_0x4a82('0x22')](_0x167eff[_0x4a82('0x23')])){_0x167eff=_[_0x4a82('0x18')](_0x167eff,{'transfereechannel':_0x167eff['transfertargetchannel'],'transfereecalleridnum':_0x167eff[_0x4a82('0x16')],'transfereecalleridname':_0x167eff[_0x4a82('0x17')],'transfereeconnectedlinenum':_0x167eff[_0x4a82('0x24')],'transfereeconnectedlinename':_0x167eff['transfertargetconnectedlinename'],'transfereeaccountcode':_0x167eff[_0x4a82('0x25')],'transfereecontext':_0x167eff['transfertargetcontext'],'transfereeexten':_0x167eff['transfertargetexten'],'transfereelinkedid':_0x167eff[_0x4a82('0x26')]});}writeDB(_0x167eff);}catch(_0x5e3ebe){utils[_0x4a82('0x12')](util['format'](_0x4a82('0x14'),_0x167eff[_0x4a82('0x5')]),_0x5e3ebe);}}; \ No newline at end of file +var _0x20b6=['origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','type','attended'];(function(_0x5e3701,_0x596265){var _0x345dcf=function(_0x5eb12a){while(--_0x5eb12a){_0x5e3701['push'](_0x5e3701['shift']());}};_0x345dcf(++_0x596265);}(_0x20b6,0x1dd));var _0x620b=function(_0x3bceea,_0x58af75){_0x3bceea=_0x3bceea-0x0;var _0x30a8d3=_0x20b6[_0x3bceea];return _0x30a8d3;};'use strict';var _=require(_0x620b('0x0'));var util=require(_0x620b('0x1'));var utils=require(_0x620b('0x2'));function writeDB(_0x397352){utils[_0x620b('0x3')](util[_0x620b('0x4')]('[%s][transfers][writeDB]\x20type:%s',_0x397352[_0x620b('0x5')]===_0x620b('0x6')?_0x397352[_0x620b('0x7')]:_0x397352[_0x620b('0x8')],_0x397352[_0x620b('0x5')]));utils[_0x620b('0x9')](_0x620b('0xa'),_0x397352);}exports[_0x620b('0xb')]=function(_0x40ad39){try{utils[_0x620b('0xc')](util['format'](_0x620b('0xd'),_0x40ad39['uniqueid']),_0x40ad39);utils[_0x620b('0x3')](util[_0x620b('0x4')](_0x620b('0xe'),_0x40ad39[_0x620b('0x8')],_0x40ad39[_0x620b('0xf')],_0x40ad39['transferercalleridname'],_0x40ad39[_0x620b('0x10')],_0x40ad39[_0x620b('0x11')]));_0x40ad39['type']=_0x620b('0x12');writeDB(_0x40ad39);}catch(_0x186ebd){utils[_0x620b('0x13')](util[_0x620b('0x4')](_0x620b('0xd'),_0x40ad39[_0x620b('0x8')]),_0x186ebd);}};exports[_0x620b('0x14')]=function(_0x421fc9){try{utils[_0x620b('0xc')](util['format'](_0x620b('0x15'),_0x421fc9[_0x620b('0x7')]),_0x421fc9);utils[_0x620b('0x3')](util[_0x620b('0x4')](_0x620b('0x16'),_0x421fc9['origtransfereruniqueid'],_0x421fc9['origtransferercalleridnum'],_0x421fc9[_0x620b('0x17')],_0x421fc9[_0x620b('0x18')],_0x421fc9[_0x620b('0x19')]));_0x421fc9=_[_0x620b('0x1a')](_0x421fc9,{'transfererchannel':_0x421fc9[_0x620b('0x1b')],'transferercalleridnum':_0x421fc9[_0x620b('0x1c')],'transferercalleridname':_0x421fc9['origtransferercalleridname'],'transfererconnectedlinenum':_0x421fc9['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x421fc9['secondtransfererconnectedlinename'],'transfereraccountcode':_0x421fc9[_0x620b('0x1d')],'transferercontext':_0x421fc9[_0x620b('0x1e')],'transfererexten':_0x421fc9[_0x620b('0x1f')],'transfererlinkedid':_0x421fc9[_0x620b('0x20')],'context':_0x421fc9[_0x620b('0x21')],'extension':_0x421fc9[_0x620b('0x22')],'type':_0x620b('0x6')});if(_[_0x620b('0x23')](_0x421fc9[_0x620b('0x24')])){_0x421fc9=_[_0x620b('0x1a')](_0x421fc9,{'transfereechannel':_0x421fc9[_0x620b('0x25')],'transfereecalleridnum':_0x421fc9[_0x620b('0x18')],'transfereecalleridname':_0x421fc9[_0x620b('0x19')],'transfereeconnectedlinenum':_0x421fc9[_0x620b('0x26')],'transfereeconnectedlinename':_0x421fc9[_0x620b('0x27')],'transfereeaccountcode':_0x421fc9[_0x620b('0x28')],'transfereecontext':_0x421fc9[_0x620b('0x29')],'transfereeexten':_0x421fc9[_0x620b('0x2a')],'transfereelinkedid':_0x421fc9[_0x620b('0x2b')]});}writeDB(_0x421fc9);}catch(_0x11fc03){utils[_0x620b('0x13')](util[_0x620b('0x4')]('[%s][transfers][attendedtransfer]',_0x421fc9['origtransfereruniqueid']),_0x11fc03);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index c203902..37f938a 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 _0xdfae=['isBefore','jayson/promise','util','client','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','seconds','format','subtractTime','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter'];(function(_0x26f235,_0x37aeb4){var _0x4f9ea1=function(_0x539ae3){while(--_0x539ae3){_0x26f235['push'](_0x26f235['shift']());}};_0x4f9ea1(++_0x37aeb4);}(_0xdfae,0x18d));var _0xedfa=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0xdfae[_0x4d8a8f];return _0xfc4adc;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xedfa('0x0'));var moment=require('moment');var util=require(_0xedfa('0x1'));var client=jayson[_0xedfa('0x2')]['http']({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0xedfa('0x3')]=function(_0x3db3ed,_0x449807){logger[_0xedfa('0x3')](_0x3db3ed,_0x449807?util[_0xedfa('0x4')](_0x449807,{'showHidden':![],'depth':null}):'');};exports[_0xedfa('0x5')]=function(_0x128d3c,_0x352c18){logger[_0xedfa('0x5')](_0x128d3c,_0x352c18?util[_0xedfa('0x4')](_0x352c18,{'showHidden':![],'depth':null}):'');};exports[_0xedfa('0x6')]=function(_0x1a79c0,_0x37bd01){logger[_0xedfa('0x6')](_0x1a79c0,_0x37bd01?util[_0xedfa('0x4')](_0x37bd01,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x5881cf,_0x2d253f){return client[_0xedfa('0x7')](_0x5881cf,{'body':_0x2d253f})['then'](function(_0x48e5da){logger['debug'](_0xedfa('0x8'),_0x5881cf,_0x48e5da?util[_0xedfa('0x4')](_0x48e5da,{'showHidden':![],'depth':null}):'');})[_0xedfa('0x9')](function(_0x18b321){logger[_0xedfa('0x6')](_0xedfa('0x8'),_0x5881cf,_0x18b321?util[_0xedfa('0x4')](_0x18b321,{'showHidden':![],'depth':null}):'');});};function getUser(_0x22143c){return client[_0xedfa('0x7')](_0xedfa('0xa'),{'options':{'raw':!![],'attributes':['id',_0xedfa('0xb'),_0xedfa('0xc'),_0xedfa('0xd')],'where':_0x22143c,'limit':0x1}})[_0xedfa('0xe')](function(_0x23f3ce){logger['debug'](_0xedfa('0xf'),JSON['stringify'](_0x22143c),_0x23f3ce?util['inspect'](_0x23f3ce,{'showHidden':![],'depth':null}):'');return _0x23f3ce[_0xedfa('0x10')][_0xedfa('0x11')]?_0x23f3ce['result'][0x0]:null;});}exports[_0xedfa('0x12')]=function(_0x3f5586){return new BPromise(function(_0x491776,_0x3a5781){if(_0x3f5586){return getUser({'internal':_0x3f5586})[_0xedfa('0xe')](function(_0x409c45){logger[_0xedfa('0x3')](_0xedfa('0x13'),_0x3f5586,_0x409c45?_0xedfa('0x14'):_0xedfa('0x15'));return _0x491776(_0x409c45);})[_0xedfa('0x9')](function(_0x4acf66){logger[_0xedfa('0x6')](_0xedfa('0x16'),_0x4acf66?util[_0xedfa('0x4')](_0x4acf66,{'showHidden':![],'depth':null}):'');return _0x491776(null);});}return _0x491776(null);});};exports[_0xedfa('0x17')]=function(_0x38c7ef){return new BPromise(function(_0x52c88a,_0x28791){if(_0x38c7ef){return getUser({'interface':_0x38c7ef})[_0xedfa('0xe')](function(_0x2feb40){logger[_0xedfa('0x3')](_0xedfa('0x18'),_0x38c7ef,_0x2feb40?_0xedfa('0x14'):_0xedfa('0x15'));return _0x52c88a(_0x2feb40);})['catch'](function(_0x2925a9){logger[_0xedfa('0x6')](_0xedfa('0x19'),_0x2925a9?util[_0xedfa('0x4')](_0x2925a9,{'showHidden':![],'depth':null}):'');return _0x52c88a(null);});}return _0x52c88a(null);});};exports['getUserByName']=function(_0x1898a1){return new BPromise(function(_0x1c6d54,_0x4c62c5){if(_0x1898a1){return getUser({'name':_0x1898a1})[_0xedfa('0xe')](function(_0x683ffc){logger[_0xedfa('0x3')](_0xedfa('0x1a'),_0x1898a1,_0x683ffc?_0xedfa('0x14'):'notfound');return _0x1c6d54(_0x683ffc);})['catch'](function(_0x53b0cf){logger[_0xedfa('0x6')]('[utils][getUserByName]',_0x53b0cf?util[_0xedfa('0x4')](_0x53b0cf,{'showHidden':![],'depth':null}):'');return _0x1c6d54(null);});}return _0x1c6d54(null);});};exports[_0xedfa('0x1b')]=function(_0x18270f){return new BPromise(function(_0x5294a8,_0x4773f1){if(_0x18270f){return client[_0xedfa('0x7')](_0xedfa('0x1c'),{'options':{'raw':!![],'attributes':['id','name',_0xedfa('0x1d'),'acw',_0xedfa('0x1e')],'where':{'name':_0x18270f},'limit':0x1}})[_0xedfa('0xe')](function(_0x4c9dbc){logger[_0xedfa('0x5')](_0xedfa('0x1f'),_0x18270f,_0x4c9dbc?util[_0xedfa('0x4')](_0x4c9dbc,{'showHidden':![],'depth':null}):'');logger[_0xedfa('0x3')](_0xedfa('0x20'),_0x18270f,_0x4c9dbc?'found':_0xedfa('0x15'));return _0x5294a8(_0x4c9dbc['result'][_0xedfa('0x11')]?_0x4c9dbc[_0xedfa('0x10')][0x0]:null);})[_0xedfa('0x9')](function(_0x2f8ce9){logger['error']('[utils][getVoiceQueueByName]',_0x2f8ce9?util[_0xedfa('0x4')](_0x2f8ce9,{'showHidden':![],'depth':null}):'');return _0x5294a8(null);});}return _0x5294a8(null);});};exports[_0xedfa('0x21')]=function(_0x141108,_0x258304){return moment(_0x141108)['add'](_0x258304,_0xedfa('0x22'))[_0xedfa('0x23')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xedfa('0x24')]=function(_0x4b1ce1,_0x23b477){return moment(_0x4b1ce1)['subtract'](_0x23b477,'seconds')[_0xedfa('0x23')](_0xedfa('0x25'));};exports[_0xedfa('0x26')]=function(_0x5a9e11,_0x4a0cef){return moment(_0x5a9e11)[_0xedfa('0x27')](moment(_0x4a0cef),'seconds');};exports[_0xedfa('0x28')]=function(_0x2c09c3,_0x13a2bc){return parseInt(_0x2c09c3,0xa)+parseInt(_0x13a2bc,0xa);};exports[_0xedfa('0x29')]=function(){return moment()[_0xedfa('0x23')](_0xedfa('0x25'));};exports[_0xedfa('0x2a')]=function(_0x4512a9,_0x4e5145){if(_0x4e5145){return moment(_0x4512a9)['isAfter'](_0x4e5145);}return!![];};exports['isBefore']=function(_0x493aed,_0x33096f){if(_0x33096f){return moment(_0x493aed)[_0xedfa('0x2b')](_0x33096f);}else if(_0x493aed){return!![];}return![];}; \ No newline at end of file +var _0x3a6f=['info','inspect','debug','error','request','then','catch','GetUser','internal','name','[utils][getUser]\x20where:%s','stringify','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','result','[utils][getVoiceQueueByName]','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','client','http','../../config/logger','xdr'];(function(_0x27aeaa,_0x50b8cc){var _0x4f704b=function(_0x222b03){while(--_0x222b03){_0x27aeaa['push'](_0x27aeaa['shift']());}};_0x4f704b(++_0x50b8cc);}(_0x3a6f,0x1b3));var _0xf3a6=function(_0x124967,_0x1ccbb5){_0x124967=_0x124967-0x0;var _0x2b8134=_0x3a6f[_0x124967];return _0x2b8134;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xf3a6('0x0'));var moment=require(_0xf3a6('0x1'));var util=require('util');var client=jayson[_0xf3a6('0x2')][_0xf3a6('0x3')]({'port':0x2329});var logger=require(_0xf3a6('0x4'))(_0xf3a6('0x5'));exports[_0xf3a6('0x6')]=function(_0x56ce68,_0x3d9e6f){logger['info'](_0x56ce68,_0x3d9e6f?util[_0xf3a6('0x7')](_0x3d9e6f,{'showHidden':![],'depth':null}):'');};exports[_0xf3a6('0x8')]=function(_0x3b9063,_0x4e6477){logger[_0xf3a6('0x8')](_0x3b9063,_0x4e6477?util[_0xf3a6('0x7')](_0x4e6477,{'showHidden':![],'depth':null}):'');};exports[_0xf3a6('0x9')]=function(_0x315173,_0x458386){logger['error'](_0x315173,_0x458386?util[_0xf3a6('0x7')](_0x458386,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x215e2c,_0x1b9260){return client[_0xf3a6('0xa')](_0x215e2c,{'body':_0x1b9260})[_0xf3a6('0xb')](function(_0xf29761){logger[_0xf3a6('0x8')]('[utils][request]\x20name:%s',_0x215e2c,_0xf29761?util[_0xf3a6('0x7')](_0xf29761,{'showHidden':![],'depth':null}):'');})[_0xf3a6('0xc')](function(_0x5ab7e1){logger[_0xf3a6('0x9')]('[utils][request]\x20name:%s',_0x215e2c,_0x5ab7e1?util[_0xf3a6('0x7')](_0x5ab7e1,{'showHidden':![],'depth':null}):'');});};function getUser(_0x540a22){return client[_0xf3a6('0xa')](_0xf3a6('0xd'),{'options':{'raw':!![],'attributes':['id',_0xf3a6('0xe'),_0xf3a6('0xf'),'interface'],'where':_0x540a22,'limit':0x1}})[_0xf3a6('0xb')](function(_0x27793c){logger[_0xf3a6('0x8')](_0xf3a6('0x10'),JSON[_0xf3a6('0x11')](_0x540a22),_0x27793c?util[_0xf3a6('0x7')](_0x27793c,{'showHidden':![],'depth':null}):'');return _0x27793c['result']['length']?_0x27793c['result'][0x0]:null;});}exports[_0xf3a6('0x12')]=function(_0x43bb98){return new BPromise(function(_0x1986ab,_0x4206dc){if(_0x43bb98){return getUser({'internal':_0x43bb98})[_0xf3a6('0xb')](function(_0xe359de){logger[_0xf3a6('0x6')](_0xf3a6('0x13'),_0x43bb98,_0xe359de?'found':'notfound');return _0x1986ab(_0xe359de);})[_0xf3a6('0xc')](function(_0x124319){logger[_0xf3a6('0x9')]('[utils][getUserByInternal]',_0x124319?util['inspect'](_0x124319,{'showHidden':![],'depth':null}):'');return _0x1986ab(null);});}return _0x1986ab(null);});};exports[_0xf3a6('0x14')]=function(_0x15a3aa){return new BPromise(function(_0x4ea19d,_0x1167e6){if(_0x15a3aa){return getUser({'interface':_0x15a3aa})[_0xf3a6('0xb')](function(_0x5db4bf){logger['info'](_0xf3a6('0x15'),_0x15a3aa,_0x5db4bf?_0xf3a6('0x16'):_0xf3a6('0x17'));return _0x4ea19d(_0x5db4bf);})[_0xf3a6('0xc')](function(_0x816da5){logger[_0xf3a6('0x9')](_0xf3a6('0x18'),_0x816da5?util['inspect'](_0x816da5,{'showHidden':![],'depth':null}):'');return _0x4ea19d(null);});}return _0x4ea19d(null);});};exports[_0xf3a6('0x19')]=function(_0xb368d6){return new BPromise(function(_0x48158f,_0x1704aa){if(_0xb368d6){return getUser({'name':_0xb368d6})[_0xf3a6('0xb')](function(_0x32c79d){logger['info'](_0xf3a6('0x1a'),_0xb368d6,_0x32c79d?_0xf3a6('0x16'):_0xf3a6('0x17'));return _0x48158f(_0x32c79d);})[_0xf3a6('0xc')](function(_0x116420){logger[_0xf3a6('0x9')](_0xf3a6('0x1b'),_0x116420?util[_0xf3a6('0x7')](_0x116420,{'showHidden':![],'depth':null}):'');return _0x48158f(null);});}return _0x48158f(null);});};exports[_0xf3a6('0x1c')]=function(_0x184ee4){return new BPromise(function(_0x50d83b,_0x5f4dcb){if(_0x184ee4){return client[_0xf3a6('0xa')](_0xf3a6('0x1d'),{'options':{'raw':!![],'attributes':['id',_0xf3a6('0xf'),_0xf3a6('0x1e'),_0xf3a6('0x1f'),_0xf3a6('0x20')],'where':{'name':_0x184ee4},'limit':0x1}})[_0xf3a6('0xb')](function(_0x3616ab){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x184ee4,_0x3616ab?util[_0xf3a6('0x7')](_0x3616ab,{'showHidden':![],'depth':null}):'');logger[_0xf3a6('0x6')](_0xf3a6('0x21'),_0x184ee4,_0x3616ab?_0xf3a6('0x16'):_0xf3a6('0x17'));return _0x50d83b(_0x3616ab['result'][_0xf3a6('0x22')]?_0x3616ab[_0xf3a6('0x23')][0x0]:null);})['catch'](function(_0x274798){logger['error'](_0xf3a6('0x24'),_0x274798?util[_0xf3a6('0x7')](_0x274798,{'showHidden':![],'depth':null}):'');return _0x50d83b(null);});}return _0x50d83b(null);});};exports[_0xf3a6('0x25')]=function(_0xa4479e,_0x4129c1){return moment(_0xa4479e)['add'](_0x4129c1,_0xf3a6('0x26'))[_0xf3a6('0x27')](_0xf3a6('0x28'));};exports[_0xf3a6('0x29')]=function(_0x3d29a6,_0x4ca364){return moment(_0x3d29a6)[_0xf3a6('0x2a')](_0x4ca364,_0xf3a6('0x26'))['format'](_0xf3a6('0x28'));};exports[_0xf3a6('0x2b')]=function(_0x52a9ac,_0x2db747){return moment(_0x52a9ac)[_0xf3a6('0x2c')](moment(_0x2db747),_0xf3a6('0x26'));};exports[_0xf3a6('0x2d')]=function(_0x2290d5,_0x6fc5cc){return parseInt(_0x2290d5,0xa)+parseInt(_0x6fc5cc,0xa);};exports[_0xf3a6('0x2e')]=function(){return moment()[_0xf3a6('0x27')](_0xf3a6('0x28'));};exports[_0xf3a6('0x2f')]=function(_0x5a4900,_0x1d9e94){if(_0x1d9e94){return moment(_0x5a4900)[_0xf3a6('0x2f')](_0x1d9e94);}return!![];};exports['isBefore']=function(_0x1dbfb6,_0x48394d){if(_0x48394d){return moment(_0x1dbfb6)[_0xf3a6('0x30')](_0x48394d);}else if(_0x1dbfb6){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 83f74e2..38bcdd1 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 _0x49fd=['xcally','client','role','ensureDir','then','catch','user','data','timestamp','api','set','client-side-logger','use','\x20body=%s','body','format','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','device','agent_name','test','fs-extra','lodash','express-winston','path','util','./loggers','./safe-template','./mask-sensitive-data','maskSensitiveData','join','/var','log'];(function(_0x403a5f,_0x2c6351){var _0x2af017=function(_0x5217c4){while(--_0x5217c4){_0x403a5f['push'](_0x403a5f['shift']());}};_0x2af017(++_0x2c6351);}(_0x49fd,0x154));var _0xd49f=function(_0x12abf8,_0x4eb34c){_0x12abf8=_0x12abf8-0x0;var _0x81a04d=_0x49fd[_0x12abf8];return _0x81a04d;};var fs=require(_0xd49f('0x0'));var _=require(_0xd49f('0x1'));var ewinston=require(_0xd49f('0x2'));var path=require(_0xd49f('0x3'));var util=require(_0xd49f('0x4'));var fileLogger=require(_0xd49f('0x5'))['fileLogger'];var safeTemplate=require(_0xd49f('0x6'))['safeTemplate'];var maskSensitiveData=require(_0xd49f('0x7'))[_0xd49f('0x8')];function ClientSideLogger(){function _0x2e7eb3(_0x1db5cf){var _0x151c7f=path[_0xd49f('0x9')](_0xd49f('0xa'),_0xd49f('0xb'),_0xd49f('0xc'));var _0xf09367=path[_0xd49f('0x9')](_0xd49f('0xd'),_0x1db5cf[_0xd49f('0xe')]+'-'+_0x1db5cf['name']);return fs[_0xd49f('0xf')](path[_0xd49f('0x9')](_0x151c7f,_0xf09367))[_0xd49f('0x10')](function(){var _0x191510=fileLogger('client',path['join'](_0x151c7f,_0xf09367));return _0x191510;})[_0xd49f('0x11')](function(_0x4c4f62){throw _0x4c4f62;});}this[_0xd49f('0xb')]=function(_0x2f0e1a,_0x46acd7,_0x2e1372,_0x1de71c){return _0x2e7eb3(_0x2f0e1a[_0xd49f('0x12')])['then'](function(_0x1ad4ea){var _0x2c8d75=_0x1ad4ea[_0x46acd7];return _0x2c8d75;})['then'](function(_0x29a5a1){var _0x39d865=_0x2f0e1a[_0xd49f('0x12')]?_0x2f0e1a[_0xd49f('0x12')]['id']:'no-user';var _0x1e28c8=_0x1de71c[_0xd49f('0x13')];var _0x56afed=_0x1de71c[_0xd49f('0x14')];var _0xa80512=new Date(Number(_0x56afed));return _0x29a5a1(_0x39d865,_0xa80512,_0x2e1372,_0x1e28c8);})[_0xd49f('0x11')](function(_0x5b2fc4){fileLogger(_0xd49f('0xd'))['error'](_0x5b2fc4);});};}function setupLoggers(_0x54fc7b){return new Promise(function(_0x2a0f7f){var _0x5525fc=new ClientSideLogger();var _0x3f2145=fileLogger(_0xd49f('0x15'));var _0x491bc4=fileLogger('auth');_0x54fc7b[_0xd49f('0x16')](_0xd49f('0x17'),_0x5525fc);_0x54fc7b[_0xd49f('0x18')](ewinston['logger']({'winstonInstance':_0x3f2145,'meta':![],'statusLevels':!![],'msg':function(_0x1e6230,_0xf31e68){var _0x369224='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x1e6230['body'])){_0x369224+=_0xd49f('0x19');var _0x58dfcf=_0x1e6230[_0xd49f('0x1a')];maskSensitiveData(_0x58dfcf);}return safeTemplate(util[_0xd49f('0x1b')](_0x369224,_0x1e6230[_0xd49f('0x1c')],_0x1e6230[_0xd49f('0x1d')][_0xd49f('0x1e')]?_0x1e6230['headers'][_0xd49f('0x1e')]:_0x1e6230[_0xd49f('0x1f')]['remoteAddress']||_0x1e6230['ip'],_0x1e6230[_0xd49f('0x20')],_0xf31e68[_0xd49f('0x21')],_0xf31e68[_0xd49f('0x22')],_0x1e6230[_0xd49f('0x12')]?_0x1e6230[_0xd49f('0x12')]['id']:null,_0x1e6230['user']?_0x1e6230[_0xd49f('0x12')][_0xd49f('0x23')]:null,_0x1e6230['user']?_0x1e6230[_0xd49f('0x12')][_0xd49f('0xe')]:null,_0x58dfcf?util[_0xd49f('0x24')](_0x58dfcf,![],null):''));}}));_0x54fc7b['use'](ewinston['logger']({'winstonInstance':_0x491bc4,'meta':![],'statusLevels':!![],'msg':function(_0x185b31,_0x3509fd){var _0x82242c=_0xd49f('0x25');if(_0x185b31[_0xd49f('0x1a')]&&_0x185b31[_0xd49f('0x1a')]['device']&&_0x185b31['body'][_0xd49f('0x26')]){_0x82242c=_0xd49f('0x27');}return util['format'](_0x82242c,_0x185b31[_0xd49f('0x1c')],_0x185b31['headers'][_0xd49f('0x1e')]?_0x185b31['headers'][_0xd49f('0x1e')]:_0x185b31[_0xd49f('0x1f')][_0xd49f('0x28')]||_0x185b31['ip'],_0x185b31[_0xd49f('0x20')],_0x3509fd['statusCode'],_0x3509fd[_0xd49f('0x22')],_0x185b31[_0xd49f('0x12')]?_0x185b31[_0xd49f('0x12')]['id']:null,_0x185b31['user']?_0x185b31[_0xd49f('0x12')][_0xd49f('0x23')]:null,_0x185b31[_0xd49f('0x12')]?_0x185b31['user'][_0xd49f('0xe')]:null,_0x185b31['body']&&_0x185b31[_0xd49f('0x1a')][_0xd49f('0x29')]?_0x185b31['body'][_0xd49f('0x29')]:'other',_0x185b31['body']&&_0x185b31['body']['agent_id']?_0x185b31[_0xd49f('0x1a')][_0xd49f('0x26')]:'',_0x185b31[_0xd49f('0x1a')]&&_0x185b31['body']['agent_name']?_0x185b31[_0xd49f('0x1a')][_0xd49f('0x2a')]:'');},'ignoreRoute':function(_0x570802){var _0x260f7e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x260f7e[_0xd49f('0x2b')](_0x570802['url']);}}));return _0x2a0f7f();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x20b6=['responseTime','name','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','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)','format','connection','other','agent_name','test','setupLoggers','fs-extra','lodash','./loggers','./safe-template','safeTemplate','maskSensitiveData','join','/var','log','client','role','then','catch','user','data','timestamp','error','api','auth','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','method','headers','x-forwarded-for','remoteAddress','url','statusCode'];(function(_0x124efe,_0x4df398){var _0x5ef5ba=function(_0x2e5f13){while(--_0x2e5f13){_0x124efe['push'](_0x124efe['shift']());}};_0x5ef5ba(++_0x4df398);}(_0x20b6,0xbe));var _0x620b=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0x20b6[_0x2962d5];return _0x273406;};var fs=require(_0x620b('0x0'));var _=require(_0x620b('0x1'));var ewinston=require('express-winston');var path=require('path');var util=require('util');var fileLogger=require(_0x620b('0x2'))['fileLogger'];var safeTemplate=require(_0x620b('0x3'))[_0x620b('0x4')];var maskSensitiveData=require('./mask-sensitive-data')[_0x620b('0x5')];function ClientSideLogger(){function _0x4ee581(_0x184f11){var _0x1ddb11=path[_0x620b('0x6')](_0x620b('0x7'),_0x620b('0x8'),'xcally');var _0x4f58dc=path[_0x620b('0x6')](_0x620b('0x9'),_0x184f11[_0x620b('0xa')]+'-'+_0x184f11['name']);return fs['ensureDir'](path[_0x620b('0x6')](_0x1ddb11,_0x4f58dc))[_0x620b('0xb')](function(){var _0x454b78=fileLogger(_0x620b('0x9'),path[_0x620b('0x6')](_0x1ddb11,_0x4f58dc));return _0x454b78;})[_0x620b('0xc')](function(_0x17761d){throw _0x17761d;});}this[_0x620b('0x8')]=function(_0x36549e,_0x32302b,_0x1445a7,_0x5363cb){return _0x4ee581(_0x36549e['user'])[_0x620b('0xb')](function(_0x1c1836){var _0x226a0e=_0x1c1836[_0x32302b];return _0x226a0e;})[_0x620b('0xb')](function(_0x200f6e){var _0x316535=_0x36549e[_0x620b('0xd')]?_0x36549e[_0x620b('0xd')]['id']:'no-user';var _0x5e0551=_0x5363cb[_0x620b('0xe')];var _0x170e7a=_0x5363cb[_0x620b('0xf')];var _0x3fc0bb=new Date(Number(_0x170e7a));return _0x200f6e(_0x316535,_0x3fc0bb,_0x1445a7,_0x5e0551);})['catch'](function(_0x1096da){fileLogger(_0x620b('0x9'))[_0x620b('0x10')](_0x1096da);});};}function setupLoggers(_0x3b1328){return new Promise(function(_0x50fa6e){var _0x2ddce6=new ClientSideLogger();var _0x572f78=fileLogger(_0x620b('0x11'));var _0x225cf0=fileLogger(_0x620b('0x12'));_0x3b1328[_0x620b('0x13')](_0x620b('0x14'),_0x2ddce6);_0x3b1328[_0x620b('0x15')](ewinston['logger']({'winstonInstance':_0x572f78,'meta':![],'statusLevels':!![],'msg':function(_0x482607,_0x3ed6a7){var _0x5ab7e0=_0x620b('0x16');if(!_[_0x620b('0x17')](_0x482607['body'])){_0x5ab7e0+='\x20body=%s';var _0x4f1250=_0x482607['body'];maskSensitiveData(_0x4f1250);}return safeTemplate(util['format'](_0x5ab7e0,_0x482607[_0x620b('0x18')],_0x482607[_0x620b('0x19')][_0x620b('0x1a')]?_0x482607[_0x620b('0x19')][_0x620b('0x1a')]:_0x482607['connection'][_0x620b('0x1b')]||_0x482607['ip'],_0x482607[_0x620b('0x1c')],_0x3ed6a7[_0x620b('0x1d')],_0x3ed6a7[_0x620b('0x1e')],_0x482607[_0x620b('0xd')]?_0x482607['user']['id']:null,_0x482607[_0x620b('0xd')]?_0x482607[_0x620b('0xd')][_0x620b('0x1f')]:null,_0x482607['user']?_0x482607['user']['role']:null,_0x4f1250?util['inspect'](_0x4f1250,![],null):''));}}));_0x3b1328[_0x620b('0x15')](ewinston[_0x620b('0x20')]({'winstonInstance':_0x225cf0,'meta':![],'statusLevels':!![],'msg':function(_0x224eda,_0x142aa7){var _0x309e4d=_0x620b('0x21');if(_0x224eda[_0x620b('0x22')]&&_0x224eda[_0x620b('0x22')][_0x620b('0x23')]&&_0x224eda[_0x620b('0x22')][_0x620b('0x24')]){_0x309e4d=_0x620b('0x25');}return util[_0x620b('0x26')](_0x309e4d,_0x224eda[_0x620b('0x18')],_0x224eda[_0x620b('0x19')][_0x620b('0x1a')]?_0x224eda['headers'][_0x620b('0x1a')]:_0x224eda[_0x620b('0x27')][_0x620b('0x1b')]||_0x224eda['ip'],_0x224eda[_0x620b('0x1c')],_0x142aa7[_0x620b('0x1d')],_0x142aa7['responseTime'],_0x224eda['user']?_0x224eda[_0x620b('0xd')]['id']:null,_0x224eda[_0x620b('0xd')]?_0x224eda[_0x620b('0xd')][_0x620b('0x1f')]:null,_0x224eda['user']?_0x224eda[_0x620b('0xd')]['role']:null,_0x224eda[_0x620b('0x22')]&&_0x224eda[_0x620b('0x22')][_0x620b('0x23')]?_0x224eda[_0x620b('0x22')][_0x620b('0x23')]:_0x620b('0x28'),_0x224eda[_0x620b('0x22')]&&_0x224eda[_0x620b('0x22')][_0x620b('0x24')]?_0x224eda[_0x620b('0x22')]['agent_id']:'',_0x224eda[_0x620b('0x22')]&&_0x224eda['body'][_0x620b('0x29')]?_0x224eda['body']['agent_name']:'');},'ignoreRoute':function(_0x432d96){var _0x4e9f10=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4e9f10[_0x620b('0x2a')](_0x432d96[_0x620b('0x1c')]);}}));return _0x50fa6e();});}exports[_0x620b('0x2b')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index d41ba76..8bec271 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f55=['isValid','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','includes','date','daysInMonth','min','max','domCompare','MMM','monthCompare','guess','test','isMoment','split','padStart','length','iftime','lodash','moment-timezone','map','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid'];(function(_0x5ba025,_0x5114b2){var _0x5c2a19=function(_0x1b4384){while(--_0x1b4384){_0x5ba025['push'](_0x5ba025['shift']());}};_0x5c2a19(++_0x5114b2);}(_0x6f55,0x78));var _0x56f5=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x6f55[_0xbb091];return _0x467a04;};var _=require(_0x56f5('0x0'));var moment=require(_0x56f5('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][_0x56f5('0x2')](function(_0x56b119){return _0x56b119[_0x56f5('0x3')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x56f5('0x4');var EINVALID_DATE=_0x56f5('0x5');function throwIfDateNotValid(_0x40236b){if(!_0x40236b[_0x56f5('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4f9b86){var _0x321eab=_0x4f9b86['split'](':')[_0x56f5('0x2')](function(_0x3651af){return parseInt(_0x3651af,0xa);});var _0x224f11=_0x321eab[0x0];var _0x2f3158=_0x321eab[0x1];if(_0x224f11<0x0||_0x224f11>0x17||_0x2f3158<0x0||_0x2f3158>0x3b){throw new Error(EINVALID_DATE);}return[_0x224f11,_0x2f3158];}function circularDoWInterval(_0x193dab,_0x2bd98a){if(_0x193dab===_0x2bd98a){return[_0x193dab];}else{var _0x4cdb92=moment[_0x56f5('0x7')]();moment['locale']('en');var _0x439e95=moment[_0x56f5('0x8')]()[_0x56f5('0x2')](function(_0x20054b){return _0x20054b[_0x56f5('0x9')]();});moment[_0x56f5('0x7')](_0x4cdb92);var _0x4d72f2=_0x439e95[_0x56f5('0xa')](_0x193dab);var _0x557d77=_0x439e95[_0x56f5('0xa')](_0x2bd98a);if(_0x557d77>_0x4d72f2){return _0x439e95['slice'](_0x4d72f2,_0x557d77+0x1);}else{var _0x314865=_0x439e95[_0x56f5('0xb')](0x0,_0x557d77+0x1);var _0x5cea3d=_0x439e95[_0x56f5('0xb')](_0x4d72f2);return _0x5cea3d[_0x56f5('0xc')](_0x314865);}}}module[_0x56f5('0xd')][_0x56f5('0xe')]=circularDoWInterval;function circularMonthInterval(_0x4701ec,_0x115d2f){if(_0x4701ec===_0x115d2f){return[_0x4701ec];}else{var _0x54e7e3=moment['locale']();moment[_0x56f5('0x7')]('en');var _0x87666d=moment[_0x56f5('0xf')]()['map'](function(_0x3a913e){return _0x3a913e['toLowerCase']();});moment[_0x56f5('0x7')](_0x54e7e3);var _0x48996e=_0x87666d[_0x56f5('0xa')](_0x4701ec);var _0x389fde=_0x87666d['indexOf'](_0x115d2f);if(_0x389fde>_0x48996e){return _0x87666d[_0x56f5('0xb')](_0x48996e,_0x389fde+0x1);}else{var _0x592f9b=_0x87666d[_0x56f5('0xb')](0x0,_0x389fde+0x1);var _0x536d79=_0x87666d['slice'](_0x48996e);return _0x536d79['concat'](_0x592f9b);}}}module['exports']['circularMonthInterval']=circularMonthInterval;function parseDom(_0x41a356){var _0x231d88=parseInt(_0x41a356,0xa);if(_0x231d88<0x1||_0x231d88>0x1f){throw new Error(EINVALID_DATE);}return _0x231d88;}function timeCompare(_0x1c9c1d,_0x54a8b2,_0x4e9f92){var _0x2fc885=_0x1c9c1d[_0x56f5('0x10')]();var _0x5dd3c8=extractTime(_0x54a8b2);var _0x1907c9=_0x5dd3c8[0x0];var _0x2b157e=_0x5dd3c8[0x1];var _0x22256d=_0x1c9c1d[_0x56f5('0x10')]()[_0x56f5('0x11')](_0x1907c9)[_0x56f5('0x12')](_0x2b157e);throwIfDateNotValid(_0x22256d);var _0x185385=extractTime(_0x4e9f92);var _0x12fc30=_0x185385[0x0];var _0xfdea8a=_0x185385[0x1];var _0x4a6716=_0x1c9c1d['clone']()['hours'](_0x12fc30)[_0x56f5('0x12')](_0xfdea8a);throwIfDateNotValid(_0x4a6716);if(_0x4a6716[_0x56f5('0x13')](_0x22256d)){var _0x27b55b=_0x2fc885[_0x56f5('0x10')]()[_0x56f5('0x14')](_0x56f5('0x15'));var _0x448253=_0x2fc885['clone']()[_0x56f5('0x16')](_0x56f5('0x15'));return _0x2fc885[_0x56f5('0x17')](_0x22256d,_0x448253,undefined,'[]')||_0x2fc885['isBetween'](_0x27b55b,_0x4a6716,undefined,'[]');}else{return _0x2fc885[_0x56f5('0x17')](_0x22256d,_0x4a6716,undefined,'[]');}}module[_0x56f5('0xd')][_0x56f5('0x18')]=timeCompare;function dowCompare(_0x500bbb,_0x57c011,_0x1c8f68){var _0x2eea64=_0x500bbb[_0x56f5('0x7')]('en')[_0x56f5('0x19')](_0x56f5('0x1a'))['toLowerCase']();return circularDoWInterval(_0x57c011,_0x1c8f68)[_0x56f5('0x1b')](_0x2eea64);}module[_0x56f5('0xd')]['dowCompare']=dowCompare;function domCompare(_0x2c4527,_0x4eb728,_0x5ef1b9){var _0x3a2a0f=_0x2c4527[_0x56f5('0x1c')]();if(_0x4eb728===_0x5ef1b9){return _0x3a2a0f===_0x4eb728;}else{var _0x3b53b0=_0x2c4527[_0x56f5('0x1d')]();var _0x1859d7=_0x4eb728<_0x5ef1b9;let _0x29f36d=![];var _0x41fbe8=0x0;var _0x5dcfb1=0x0;if(_0x1859d7){_0x41fbe8=Math['max'](0x1,_0x4eb728);_0x5dcfb1=Math[_0x56f5('0x1e')](_0x5ef1b9,_0x3b53b0);_0x29f36d=_0x3a2a0f>=_0x41fbe8&&_0x3a2a0f<=_0x5dcfb1;}else{_0x41fbe8=Math[_0x56f5('0x1e')](_0x4eb728,_0x3b53b0);_0x5dcfb1=Math[_0x56f5('0x1f')](0x1,_0x5ef1b9);_0x29f36d=_0x3a2a0f>=_0x41fbe8||_0x3a2a0f<=_0x5dcfb1;}return _0x29f36d;}}module[_0x56f5('0xd')][_0x56f5('0x20')]=domCompare;function monthCompare(_0x508c58,_0x4deed5,_0x1af065){var _0x394dba=_0x508c58[_0x56f5('0x7')]('en')[_0x56f5('0x19')](_0x56f5('0x21'))[_0x56f5('0x9')]();return circularMonthInterval(_0x4deed5,_0x1af065)['includes'](_0x394dba);}module[_0x56f5('0xd')][_0x56f5('0x22')]=monthCompare;function iftime(_0x494614,_0x364c09=moment['tz'][_0x56f5('0x23')](),_0x2d1f60=moment()){if(!validateRx[_0x56f5('0x24')](_0x494614)){throw new Error(EINVALID_STRING);}else{var _0x147fb0=(moment[_0x56f5('0x25')](_0x2d1f60)?_0x2d1f60[_0x56f5('0x10')]():moment(_0x2d1f60))['tz'](_0x364c09)[_0x56f5('0x7')]('en');throwIfDateNotValid(_0x147fb0);var _0x36d3fd=_0x494614[_0x56f5('0x26')](',');var _0x25a81=_0x36d3fd[0x0];var _0x214abc=_0x36d3fd[0x1];var _0x554d11=_0x36d3fd[0x2];var _0x2ba3c4=_0x36d3fd[0x3];let _0x336c91=!![];if(_0x25a81!=='*'){var _0x19fff7=_0x25a81['split']('-');var _0x200538=_['padStart'](_0x19fff7[0x0],0x5,'0');var _0x553cd3=_0x19fff7['length']===0x2?_[_0x56f5('0x27')](_0x19fff7[0x1],0x5,'0'):_0x200538;_0x336c91=timeCompare(_0x147fb0,_0x200538,_0x553cd3);}let _0x1d496f=!![];if(_0x214abc!=='*'){var _0x21310d=_0x214abc[_0x56f5('0x26')]('-');var _0x4270c5=_0x21310d[0x0];var _0x3b16bf=_0x21310d[_0x56f5('0x28')]===0x2?_0x21310d[0x1]:_0x4270c5;_0x1d496f=dowCompare(_0x147fb0,_0x4270c5,_0x3b16bf);}let _0x10f54e=!![];if(_0x554d11!=='*'){var _0xc986b3=_0x554d11['split']('-');var _0x50f301=parseDom(_0xc986b3[0x0]);var _0x229809=_0xc986b3[_0x56f5('0x28')]===0x2?parseDom(_0xc986b3[0x1]):_0x50f301;_0x10f54e=domCompare(_0x147fb0,_0x50f301,_0x229809);}let _0x195521=!![];if(_0x2ba3c4!=='*'){var _0x9b90cd=_0x2ba3c4[_0x56f5('0x26')]('-');var _0x532ca6=_0x9b90cd[0x0];var _0x3178bc=_0x9b90cd['length']===0x2?_0x9b90cd[0x1]:_0x9b90cd[0x0];_0x195521=monthCompare(_0x147fb0,_0x532ca6,_0x3178bc);}return _0x336c91&&_0x1d496f&&_0x10f54e&&_0x195521;}}module['exports'][_0x56f5('0x29')]=iftime; \ No newline at end of file +var _0xcc02=['source','join','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','toLowerCase','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','timeCompare','format','ddd','includes','date','daysInMonth','min','max','domCompare','MMM','monthCompare','test','isMoment','length','padStart','iftime','lodash','moment-timezone','map'];(function(_0x39c5cf,_0x410570){var _0x2df147=function(_0x35ea10){while(--_0x35ea10){_0x39c5cf['push'](_0x39c5cf['shift']());}};_0x2df147(++_0x410570);}(_0xcc02,0xf3));var _0x2cc0=function(_0x2de4c3,_0x5f3f46){_0x2de4c3=_0x2de4c3-0x0;var _0x597e0e=_0xcc02[_0x2de4c3];return _0x597e0e;};var _=require(_0x2cc0('0x0'));var moment=require(_0x2cc0('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][_0x2cc0('0x2')](function(_0x1c5385){return _0x1c5385[_0x2cc0('0x3')];})[_0x2cc0('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0x2cc0('0x5');function throwIfDateNotValid(_0x14c606){if(!_0x14c606[_0x2cc0('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x446567){var _0x4c8254=_0x446567[_0x2cc0('0x7')](':')[_0x2cc0('0x2')](function(_0x58f5c1){return parseInt(_0x58f5c1,0xa);});var _0x4b5e78=_0x4c8254[0x0];var _0x114ab1=_0x4c8254[0x1];if(_0x4b5e78<0x0||_0x4b5e78>0x17||_0x114ab1<0x0||_0x114ab1>0x3b){throw new Error(EINVALID_DATE);}return[_0x4b5e78,_0x114ab1];}function circularDoWInterval(_0x3e9b2b,_0xcbfc69){if(_0x3e9b2b===_0xcbfc69){return[_0x3e9b2b];}else{var _0x3d80b0=moment[_0x2cc0('0x8')]();moment[_0x2cc0('0x8')]('en');var _0x268af3=moment[_0x2cc0('0x9')]()[_0x2cc0('0x2')](function(_0xe890f2){return _0xe890f2['toLowerCase']();});moment[_0x2cc0('0x8')](_0x3d80b0);var _0x156c78=_0x268af3[_0x2cc0('0xa')](_0x3e9b2b);var _0x1205a6=_0x268af3[_0x2cc0('0xa')](_0xcbfc69);if(_0x1205a6>_0x156c78){return _0x268af3['slice'](_0x156c78,_0x1205a6+0x1);}else{var _0x10b2ea=_0x268af3['slice'](0x0,_0x1205a6+0x1);var _0x59f299=_0x268af3[_0x2cc0('0xb')](_0x156c78);return _0x59f299[_0x2cc0('0xc')](_0x10b2ea);}}}module[_0x2cc0('0xd')][_0x2cc0('0xe')]=circularDoWInterval;function circularMonthInterval(_0x2069cb,_0x13245d){if(_0x2069cb===_0x13245d){return[_0x2069cb];}else{var _0x649c57=moment[_0x2cc0('0x8')]();moment[_0x2cc0('0x8')]('en');var _0x53a670=moment[_0x2cc0('0xf')]()['map'](function(_0x25c61e){return _0x25c61e[_0x2cc0('0x10')]();});moment[_0x2cc0('0x8')](_0x649c57);var _0x50f64f=_0x53a670[_0x2cc0('0xa')](_0x2069cb);var _0x4309ec=_0x53a670[_0x2cc0('0xa')](_0x13245d);if(_0x4309ec>_0x50f64f){return _0x53a670['slice'](_0x50f64f,_0x4309ec+0x1);}else{var _0x4a78ac=_0x53a670[_0x2cc0('0xb')](0x0,_0x4309ec+0x1);var _0x2fced0=_0x53a670[_0x2cc0('0xb')](_0x50f64f);return _0x2fced0[_0x2cc0('0xc')](_0x4a78ac);}}}module[_0x2cc0('0xd')][_0x2cc0('0x11')]=circularMonthInterval;function parseDom(_0x3fcf58){var _0x1357a0=parseInt(_0x3fcf58,0xa);if(_0x1357a0<0x1||_0x1357a0>0x1f){throw new Error(EINVALID_DATE);}return _0x1357a0;}function timeCompare(_0xd324d0,_0x1dfaf0,_0x1b38a0){var _0x453af6=_0xd324d0[_0x2cc0('0x12')]();var _0x122e64=extractTime(_0x1dfaf0);var _0xd516f7=_0x122e64[0x0];var _0x591959=_0x122e64[0x1];var _0x21ec5e=_0xd324d0[_0x2cc0('0x12')]()[_0x2cc0('0x13')](_0xd516f7)[_0x2cc0('0x14')](_0x591959);throwIfDateNotValid(_0x21ec5e);var _0x16c022=extractTime(_0x1b38a0);var _0x279ed6=_0x16c022[0x0];var _0x1babb9=_0x16c022[0x1];var _0x260d23=_0xd324d0['clone']()['hours'](_0x279ed6)['minutes'](_0x1babb9);throwIfDateNotValid(_0x260d23);if(_0x260d23[_0x2cc0('0x15')](_0x21ec5e)){var _0x2514ce=_0x453af6[_0x2cc0('0x12')]()[_0x2cc0('0x16')](_0x2cc0('0x17'));var _0x4db55c=_0x453af6['clone']()['endOf'](_0x2cc0('0x17'));return _0x453af6[_0x2cc0('0x18')](_0x21ec5e,_0x4db55c,undefined,'[]')||_0x453af6['isBetween'](_0x2514ce,_0x260d23,undefined,'[]');}else{return _0x453af6['isBetween'](_0x21ec5e,_0x260d23,undefined,'[]');}}module[_0x2cc0('0xd')][_0x2cc0('0x19')]=timeCompare;function dowCompare(_0x492b17,_0xcc2eed,_0x35ebfb){var _0x3fe8cd=_0x492b17['locale']('en')[_0x2cc0('0x1a')](_0x2cc0('0x1b'))[_0x2cc0('0x10')]();return circularDoWInterval(_0xcc2eed,_0x35ebfb)[_0x2cc0('0x1c')](_0x3fe8cd);}module[_0x2cc0('0xd')]['dowCompare']=dowCompare;function domCompare(_0x2ae3fd,_0x2bfaba,_0xe630b2){var _0x33d2b5=_0x2ae3fd[_0x2cc0('0x1d')]();if(_0x2bfaba===_0xe630b2){return _0x33d2b5===_0x2bfaba;}else{var _0x49445a=_0x2ae3fd[_0x2cc0('0x1e')]();var _0x4677cd=_0x2bfaba<_0xe630b2;let _0x3d1efc=![];var _0x54de04=0x0;var _0x37efb8=0x0;if(_0x4677cd){_0x54de04=Math['max'](0x1,_0x2bfaba);_0x37efb8=Math[_0x2cc0('0x1f')](_0xe630b2,_0x49445a);_0x3d1efc=_0x33d2b5>=_0x54de04&&_0x33d2b5<=_0x37efb8;}else{_0x54de04=Math[_0x2cc0('0x1f')](_0x2bfaba,_0x49445a);_0x37efb8=Math[_0x2cc0('0x20')](0x1,_0xe630b2);_0x3d1efc=_0x33d2b5>=_0x54de04||_0x33d2b5<=_0x37efb8;}return _0x3d1efc;}}module['exports'][_0x2cc0('0x21')]=domCompare;function monthCompare(_0x258a6c,_0x3bbd89,_0x1a8af5){var _0x177617=_0x258a6c[_0x2cc0('0x8')]('en')[_0x2cc0('0x1a')](_0x2cc0('0x22'))['toLowerCase']();return circularMonthInterval(_0x3bbd89,_0x1a8af5)[_0x2cc0('0x1c')](_0x177617);}module['exports'][_0x2cc0('0x23')]=monthCompare;function iftime(_0x2990f3,_0x3b1027=moment['tz']['guess'](),_0x69d6e0=moment()){if(!validateRx[_0x2cc0('0x24')](_0x2990f3)){throw new Error(EINVALID_STRING);}else{var _0x479604=(moment[_0x2cc0('0x25')](_0x69d6e0)?_0x69d6e0['clone']():moment(_0x69d6e0))['tz'](_0x3b1027)[_0x2cc0('0x8')]('en');throwIfDateNotValid(_0x479604);var _0x5af5cd=_0x2990f3[_0x2cc0('0x7')](',');var _0x5e5e73=_0x5af5cd[0x0];var _0x1a52e1=_0x5af5cd[0x1];var _0x3c1984=_0x5af5cd[0x2];var _0x44560e=_0x5af5cd[0x3];let _0x5e3743=!![];if(_0x5e5e73!=='*'){var _0x298ae7=_0x5e5e73[_0x2cc0('0x7')]('-');var _0x59f833=_['padStart'](_0x298ae7[0x0],0x5,'0');var _0x27ccf2=_0x298ae7[_0x2cc0('0x26')]===0x2?_[_0x2cc0('0x27')](_0x298ae7[0x1],0x5,'0'):_0x59f833;_0x5e3743=timeCompare(_0x479604,_0x59f833,_0x27ccf2);}let _0x52e8d6=!![];if(_0x1a52e1!=='*'){var _0x18f523=_0x1a52e1[_0x2cc0('0x7')]('-');var _0x38a79a=_0x18f523[0x0];var _0x540a11=_0x18f523[_0x2cc0('0x26')]===0x2?_0x18f523[0x1]:_0x38a79a;_0x52e8d6=dowCompare(_0x479604,_0x38a79a,_0x540a11);}let _0x3bd989=!![];if(_0x3c1984!=='*'){var _0x44f623=_0x3c1984[_0x2cc0('0x7')]('-');var _0x41fc5e=parseDom(_0x44f623[0x0]);var _0x11d482=_0x44f623['length']===0x2?parseDom(_0x44f623[0x1]):_0x41fc5e;_0x3bd989=domCompare(_0x479604,_0x41fc5e,_0x11d482);}let _0x3af5b6=!![];if(_0x44560e!=='*'){var _0x21c0b9=_0x44560e['split']('-');var _0x334508=_0x21c0b9[0x0];var _0x54ac26=_0x21c0b9['length']===0x2?_0x21c0b9[0x1]:_0x21c0b9[0x0];_0x3af5b6=monthCompare(_0x479604,_0x334508,_0x54ac26);}return _0x5e3743&&_0x52e8d6&&_0x3bd989&&_0x3af5b6;}}module[_0x2cc0('0xd')][_0x2cc0('0x28')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index af2412f..f41df63 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa169=['keys','length','stringify','YYYY-MM-DD\x20HH:mm:ss','Logger','warn','transports','File','%s-%s','error','Console','fileLogger','path','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20green','gray','bold\x20magenta','bold\x20cyan','addColors','join','%s-%s.log','message','replace','format','level','toUpperCase','{{{','}}}','meta'];(function(_0xeaffa8,_0x311819){var _0x15078e=function(_0x2611eb){while(--_0x2611eb){_0xeaffa8['push'](_0xeaffa8['shift']());}};_0x15078e(++_0x311819);}(_0xa169,0x1d4));var _0x9a16=function(_0x219b96,_0x34ef8e){_0x219b96=_0x219b96-0x0;var _0x453a54=_0xa169[_0x219b96];return _0x453a54;};'use strict';var path=require(_0x9a16('0x0'));var util=require('util');var moment=require(_0x9a16('0x1'));var winston=require(_0x9a16('0x2'));var config=require(_0x9a16('0x3'));var debugLevel=config[_0x9a16('0x4')]?config[_0x9a16('0x4')][_0x9a16('0x5')]():_0x9a16('0x6');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':_0x9a16('0x7'),'error':_0x9a16('0x8'),'warn':_0x9a16('0x9'),'info':_0x9a16('0xa'),'print':'bold\x20white','success':_0x9a16('0xb'),'http':_0x9a16('0xc'),'verbose':_0x9a16('0xd'),'debug':'bold\x20blue','silly':_0x9a16('0xe')};winston[_0x9a16('0xf')](XC_LOG_COLORS);function getLogFileName(_0xa35061,_0x1ce410,_0x276cf0){var _0xfe4207=_0xa35061||'/var/log/xcally';return path[_0x9a16('0x10')](_0xfe4207,util['format'](_0x9a16('0x11'),_0x1ce410,_0x276cf0));}function formatter(_0x50c64e,_0x50d64d){_0x50d64d[_0x9a16('0x12')]=_0x50d64d[_0x9a16('0x12')][_0x9a16('0x13')](/@@{/g,'{{{')[_0x9a16('0x13')](/}@@/g,'}}}')[_0x9a16('0x13')](/@{/g,'{{')[_0x9a16('0x13')](/}@/g,'}}');return util[_0x9a16('0x14')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x50d64d[_0x9a16('0x15')][_0x9a16('0x16')](),_0x50c64e,_0x50d64d[_0x9a16('0x12')]);}function fileFormat(_0x3a0f8f,_0xd5ebf6){_0xd5ebf6['message']=_0xd5ebf6[_0x9a16('0x12')][_0x9a16('0x13')](/@@{/g,_0x9a16('0x17'))[_0x9a16('0x13')](/}@@/g,_0x9a16('0x18'))[_0x9a16('0x13')](/@{/g,'{{')[_0x9a16('0x13')](/}@/g,'}}');var _0x151ca6=_0xd5ebf6[_0x9a16('0x19')]&&Object[_0x9a16('0x1a')](_0xd5ebf6['meta'])[_0x9a16('0x1b')]?'\x0a\x09'+JSON[_0x9a16('0x1c')](_0xd5ebf6[_0x9a16('0x19')]):'';return util[_0x9a16('0x14')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x9a16('0x14')](_0x9a16('0x1d')),_0xd5ebf6[_0x9a16('0x15')]['toUpperCase'](),_0x3a0f8f,_0xd5ebf6['message'],_0x151ca6);}function consoleLogger(){var _0xf03f6e=new winston[(_0x9a16('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':_0x9a16('0x1f'),'json':![],'formatter':function(_0x36fe77){return formatter('',_0x36fe77);}})]});return _0xf03f6e;}function fileLogger(_0x5efbfc,_0x80111a){var _0x56eca2=new winston[(_0x9a16('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x9a16('0x20'))][(_0x9a16('0x21'))]({'name':util[_0x9a16('0x14')](_0x9a16('0x22'),_0x5efbfc,_0x9a16('0x23')),'filename':getLogFileName(_0x80111a,_0x5efbfc,_0x9a16('0x23')),'level':_0x9a16('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x63f130){return fileFormat(_0x5efbfc,_0x63f130);}}),new winston[(_0x9a16('0x20'))][(_0x9a16('0x21'))]({'name':util['format'](_0x9a16('0x22'),_0x5efbfc,debugLevel),'filename':getLogFileName(_0x80111a,_0x5efbfc,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x15239d){return fileFormat(_0x5efbfc,_0x15239d);}}),new winston[(_0x9a16('0x20'))][(_0x9a16('0x24'))]({'level':_0x9a16('0x1f'),'json':![],'formatter':function(_0x50e1d6){return fileFormat(_0x5efbfc,_0x50e1d6);}})]});return _0x56eca2;}exports['consoleLogger']=consoleLogger;exports[_0x9a16('0x25')]=fileLogger; \ No newline at end of file +var _0x374f=['../config/environment','debugLevel','toLowerCase','info','redBG\x20white','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','addColors','/var/log/xcally','format','%s-%s.log','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','meta','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Console','warn','Logger','transports','File','%s-%s','error','consoleLogger','fileLogger','path','moment','winston'];(function(_0x3284f7,_0x513ee0){var _0x5340e6=function(_0x5b2fca){while(--_0x5b2fca){_0x3284f7['push'](_0x3284f7['shift']());}};_0x5340e6(++_0x513ee0);}(_0x374f,0x153));var _0xf374=function(_0x33b83c,_0x22d189){_0x33b83c=_0x33b83c-0x0;var _0x249711=_0x374f[_0x33b83c];return _0x249711;};'use strict';var path=require(_0xf374('0x0'));var util=require('util');var moment=require(_0xf374('0x1'));var winston=require(_0xf374('0x2'));var config=require(_0xf374('0x3'));var debugLevel=config['debugLevel']?config[_0xf374('0x4')][_0xf374('0x5')]():_0xf374('0x6');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':_0xf374('0x7'),'error':'red','warn':_0xf374('0x8'),'info':_0xf374('0x9'),'print':_0xf374('0xa'),'success':_0xf374('0xb'),'http':_0xf374('0xc'),'verbose':_0xf374('0xd'),'debug':'bold\x20blue','silly':'bold\x20cyan'};winston[_0xf374('0xe')](XC_LOG_COLORS);function getLogFileName(_0xc7547,_0x113210,_0x25ea6b){var _0x53dfbe=_0xc7547||_0xf374('0xf');return path['join'](_0x53dfbe,util[_0xf374('0x10')](_0xf374('0x11'),_0x113210,_0x25ea6b));}function formatter(_0x12431e,_0x2d7b26){_0x2d7b26['message']=_0x2d7b26['message']['replace'](/@@{/g,_0xf374('0x12'))[_0xf374('0x13')](/}@@/g,_0xf374('0x14'))[_0xf374('0x13')](/@{/g,'{{')[_0xf374('0x13')](/}@/g,'}}');return util[_0xf374('0x10')](_0xf374('0x15'),moment()[_0xf374('0x10')](_0xf374('0x16')),_0x2d7b26[_0xf374('0x17')][_0xf374('0x18')](),_0x12431e,_0x2d7b26['message']);}function fileFormat(_0x9cd05d,_0x228b2d){_0x228b2d[_0xf374('0x19')]=_0x228b2d['message'][_0xf374('0x13')](/@@{/g,_0xf374('0x12'))[_0xf374('0x13')](/}@@/g,_0xf374('0x14'))[_0xf374('0x13')](/@{/g,'{{')[_0xf374('0x13')](/}@/g,'}}');var _0x45112d=_0x228b2d[_0xf374('0x1a')]&&Object['keys'](_0x228b2d['meta'])['length']?'\x0a\x09'+JSON[_0xf374('0x1b')](_0x228b2d[_0xf374('0x1a')]):'';return util[_0xf374('0x10')](_0xf374('0x1c'),moment()['format'](_0xf374('0x16')),_0x228b2d[_0xf374('0x17')]['toUpperCase'](),_0x9cd05d,_0x228b2d[_0xf374('0x19')],_0x45112d);}function consoleLogger(){var _0x2a1a9f=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xf374('0x1d'))]({'level':_0xf374('0x1e'),'json':![],'formatter':function(_0x5f3fd7){return formatter('',_0x5f3fd7);}})]});return _0x2a1a9f;}function fileLogger(_0x520a79,_0x36186a){var _0xb3ff52=new winston[(_0xf374('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xf374('0x20'))][(_0xf374('0x21'))]({'name':util[_0xf374('0x10')](_0xf374('0x22'),_0x520a79,_0xf374('0x23')),'filename':getLogFileName(_0x36186a,_0x520a79,_0xf374('0x23')),'level':_0xf374('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x216cdb){return fileFormat(_0x520a79,_0x216cdb);}}),new winston[(_0xf374('0x20'))][(_0xf374('0x21'))]({'name':util[_0xf374('0x10')](_0xf374('0x22'),_0x520a79,debugLevel),'filename':getLogFileName(_0x36186a,_0x520a79,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x27b192){return fileFormat(_0x520a79,_0x27b192);}}),new winston[(_0xf374('0x20'))]['Console']({'level':_0xf374('0x1e'),'json':![],'formatter':function(_0x3f5b82){return fileFormat(_0x520a79,_0x3f5b82);}})]});return _0xb3ff52;}exports[_0xf374('0x24')]=consoleLogger;exports[_0xf374('0x25')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index a0e1968..af37145 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 _0x66fa=['calleridnum','vidaooApiKey','privateKey','secretaccesskey','key','user','localstationid','oldPassword','isPlainObject','length','isString','replace','includes','exports','maskSensitiveData','lodash','username','newPassword','apiKey','firstName','lastName','street','phone','mobile','clientId','clientSecret','securityToken','code','accessKey','token','accessToken','authToken','calleridname'];(function(_0x38826b,_0x1c1865){var _0x43044f=function(_0x2835e0){while(--_0x2835e0){_0x38826b['push'](_0x38826b['shift']());}};_0x43044f(++_0x1c1865);}(_0x66fa,0x117));var _0xa66f=function(_0x3c940c,_0x232712){_0x3c940c=_0x3c940c-0x0;var _0x31f7c4=_0x66fa[_0x3c940c];return _0x31f7c4;};var _=require(_0xa66f('0x0'));var sensitiveFields=[_0xa66f('0x1'),'password',_0xa66f('0x2'),_0xa66f('0x3'),_0xa66f('0x4'),_0xa66f('0x5'),_0xa66f('0x6'),_0xa66f('0x7'),_0xa66f('0x8'),'fax','email',_0xa66f('0x9'),_0xa66f('0xa'),_0xa66f('0xb'),_0xa66f('0xc'),_0xa66f('0xd'),'tenantId',_0xa66f('0xe'),'channelSecret',_0xa66f('0xf'),'accessTokenSecret',_0xa66f('0x10'),'consumerKey','consumerSecret','membername',_0xa66f('0x11'),_0xa66f('0x12'),'exten',_0xa66f('0x13'),'clientEmail',_0xa66f('0x14'),'accesskeyid',_0xa66f('0x15'),_0xa66f('0x16'),_0xa66f('0x17'),'pass','accountSid',_0xa66f('0x18'),'dsn','secret','registry',_0xa66f('0x19')];function maskSensitiveData(_0x452c37){const _0x267129=/(?!^)[\s\S](?!$)/g;if(_[_0xa66f('0x1a')](_0x452c37)){for(const _0xd348f9 in _0x452c37){if(_['isArray'](_0x452c37[_0xd348f9])){for(let _0x5510dc=0x0;_0x5510dc<_0x452c37[_0xd348f9][_0xa66f('0x1b')];_0x5510dc++){maskSensitiveData(_0x452c37[_0xd348f9][_0x5510dc]);}}else if(_[_0xa66f('0x1a')](_0x452c37[_0xd348f9])){maskSensitiveData(_0x452c37[_0xd348f9]);}else if(_[_0xa66f('0x1c')](_0x452c37[_0xd348f9])){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](/{{{/g,'@@{')[_0xa66f('0x1d')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa66f('0x1d')](/}}/g,'}@');if(_[_0xa66f('0x1e')](sensitiveFields,_0xd348f9)){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](_0x267129,'*');}}}}}module[_0xa66f('0x1f')][_0xa66f('0x20')]=maskSensitiveData; \ No newline at end of file +var _0x5f2f=['tenantId','token','channelSecret','accessTokenSecret','authToken','consumerKey','membername','exten','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','lodash','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','clientSecret','securityToken','code'];(function(_0x466584,_0x113d3c){var _0x4f4a8e=function(_0xf4fa8c){while(--_0xf4fa8c){_0x466584['push'](_0x466584['shift']());}};_0x4f4a8e(++_0x113d3c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x368161,_0x56df36){_0x368161=_0x368161-0x0;var _0x5f50e2=_0x5f2f[_0x368161];return _0x5f50e2;};var _=require(_0xf5f2('0x0'));var sensitiveFields=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3'),_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),_0xf5f2('0x7'),'phone','mobile',_0xf5f2('0x8'),_0xf5f2('0x9'),_0xf5f2('0xa'),_0xf5f2('0xb'),_0xf5f2('0xc'),_0xf5f2('0xd'),'accessKey',_0xf5f2('0xe'),_0xf5f2('0xf'),_0xf5f2('0x10'),'accessToken',_0xf5f2('0x11'),_0xf5f2('0x12'),_0xf5f2('0x13'),'consumerSecret',_0xf5f2('0x14'),'calleridname','calleridnum',_0xf5f2('0x15'),_0xf5f2('0x16'),'clientEmail',_0xf5f2('0x17'),_0xf5f2('0x18'),_0xf5f2('0x19'),_0xf5f2('0x1a'),_0xf5f2('0x1b'),_0xf5f2('0x1c'),'accountSid',_0xf5f2('0x1d'),_0xf5f2('0x1e'),_0xf5f2('0x1f'),_0xf5f2('0x20'),_0xf5f2('0x21')];function maskSensitiveData(_0x4d97fc){const _0xafe430=/(?!^)[\s\S](?!$)/g;if(_[_0xf5f2('0x22')](_0x4d97fc)){for(const _0x17d656 in _0x4d97fc){if(_[_0xf5f2('0x23')](_0x4d97fc[_0x17d656])){for(let _0x23e23a=0x0;_0x23e23a<_0x4d97fc[_0x17d656][_0xf5f2('0x24')];_0x23e23a++){maskSensitiveData(_0x4d97fc[_0x17d656][_0x23e23a]);}}else if(_[_0xf5f2('0x22')](_0x4d97fc[_0x17d656])){maskSensitiveData(_0x4d97fc[_0x17d656]);}else if(_[_0xf5f2('0x25')](_0x4d97fc[_0x17d656])){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](/{{{/g,_0xf5f2('0x27'))[_0xf5f2('0x26')](/}}}/g,_0xf5f2('0x28'))[_0xf5f2('0x26')](/{{/g,'@{')[_0xf5f2('0x26')](/}}/g,'}@');if(_[_0xf5f2('0x29')](sensitiveFields,_0x17d656)){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](_0xafe430,'*');}}}}}module[_0xf5f2('0x2a')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index e8e6442..ad711fb 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1967=['\x5c$&','replace'];(function(_0x30ba36,_0xb0bfe0){var _0x1e07a6=function(_0x5cc68a){while(--_0x5cc68a){_0x30ba36['push'](_0x30ba36['shift']());}};_0x1e07a6(++_0xb0bfe0);}(_0x1967,0x173));var _0x7196=function(_0x4e065a,_0xeb6b0b){_0x4e065a=_0x4e065a-0x0;var _0x5114ff=_0x1967[_0x4e065a];return _0x5114ff;};module['exports']={'escapeRegExp'(_0x1da98b,_0xdb72bb=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x1da98b[_0x7196('0x0')](_0xdb72bb,_0x7196('0x1'));}}; \ No newline at end of file +var _0xdb28=['exports','replace'];(function(_0x36e7d6,_0x41f96a){var _0x480849=function(_0x32bc06){while(--_0x32bc06){_0x36e7d6['push'](_0x36e7d6['shift']());}};_0x480849(++_0x41f96a);}(_0xdb28,0x106));var _0x8db2=function(_0x3e973e,_0x2e5a68){_0x3e973e=_0x3e973e-0x0;var _0x288deb=_0xdb28[_0x3e973e];return _0x288deb;};module[_0x8db2('0x0')]={'escapeRegExp'(_0x4221b3,_0x1dc797=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x4221b3[_0x8db2('0x1')](_0x1dc797,'\x5c$&');}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index c5b73c8..dd7a525 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 _0xe511=['\x20}\x20}','string','isArray','map','isPlainObject','reduce','safeTemplate','lodash'];(function(_0x24d760,_0x172a4f){var _0x299dad=function(_0x8815e){while(--_0x8815e){_0x24d760['push'](_0x24d760['shift']());}};_0x299dad(++_0x172a4f);}(_0xe511,0x16f));var _0x1e51=function(_0x58725a,_0x389d19){_0x58725a=_0x58725a-0x0;var _0x2e6e65=_0xe511[_0x58725a];return _0x2e6e65;};var _=require(_0x1e51('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x3a7329){return _0x3a7329==='{{'?'{\x20{\x20':_0x1e51('0x1');}function safeTemplate(_0x5b9e45){var _0x253e96=_0x5b9e45;if(typeof _0x5b9e45===_0x1e51('0x2')){_0x253e96=_0x5b9e45['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x1e51('0x3')](_0x5b9e45)){_0x253e96=_0x5b9e45[_0x1e51('0x4')](function(_0x204da7){return safeTemplate(_0x204da7);});}else if(_[_0x1e51('0x5')](_0x5b9e45)){_0x253e96=Object['keys'](_0x5b9e45)[_0x1e51('0x6')](function(_0x21ed6b,_0x5c4590){_0x21ed6b[_0x5c4590]=safeTemplate(_0x5b9e45[_0x5c4590]);return _0x21ed6b;},{});}return _0x253e96;}module['exports'][_0x1e51('0x7')]=safeTemplate; \ No newline at end of file +var _0xbaf0=['exports','{\x20{\x20','\x20}\x20}','string','isArray','map','isPlainObject','keys','reduce'];(function(_0x5aee1b,_0x4e97a6){var _0x8486c3=function(_0x2f3679){while(--_0x2f3679){_0x5aee1b['push'](_0x5aee1b['shift']());}};_0x8486c3(++_0x4e97a6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x286ac2){return _0x286ac2==='{{'?_0x0baf('0x0'):_0x0baf('0x1');}function safeTemplate(_0x263f79){var _0x1688bc=_0x263f79;if(typeof _0x263f79===_0x0baf('0x2')){_0x1688bc=_0x263f79['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x0baf('0x3')](_0x263f79)){_0x1688bc=_0x263f79[_0x0baf('0x4')](function(_0x2d3fa5){return safeTemplate(_0x2d3fa5);});}else if(_[_0x0baf('0x5')](_0x263f79)){_0x1688bc=Object[_0x0baf('0x6')](_0x263f79)[_0x0baf('0x7')](function(_0x1a10b1,_0x2dcaac){_0x1a10b1[_0x2dcaac]=safeTemplate(_0x263f79[_0x2dcaac]);return _0x1a10b1;},{});}return _0x1688bc;}module[_0x0baf('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 7c83219..a6a0e32 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe573=['fs-extra','path','../config/environment','root','server/app.json','legacy-libs','apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists','then','readJSON','updated','Updating\x20app.json','writeJSON','resolve','exports'];(function(_0x5adf4d,_0xdfd7ef){var _0x17b2db=function(_0x5a9a2f){while(--_0x5a9a2f){_0x5adf4d['push'](_0x5adf4d['shift']());}};_0x17b2db(++_0xdfd7ef);}(_0xe573,0x13b));var _0x3e57=function(_0x46e1c6,_0x285c1b){_0x46e1c6=_0x46e1c6-0x0;var _0x539438=_0xe573[_0x46e1c6];return _0x539438;};var fs=require(_0x3e57('0x0'));var path=require(_0x3e57('0x1'));var config=require(_0x3e57('0x2'));var root=config[_0x3e57('0x3')];var APP_JSON_PATH=path['resolve'](root,_0x3e57('0x4'));var NODEPATH=path['resolve'](root,_0x3e57('0x5'));function setLegacyLibsNodeEnvPath(_0xafa951){let _0x120e8b=![];if(Array['isArray'](_0xafa951[_0x3e57('0x6')])){var _0x5a9c2f=_0xafa951['apps'][_0x3e57('0x7')](function(_0x31c0b9){return _0x31c0b9[_0x3e57('0x8')]===_0x3e57('0x9');});if(_0x5a9c2f>-0x1){var _0x1c110f=_0xafa951['apps'][_0x5a9c2f];if(typeof _0x1c110f[_0x3e57('0xa')][_0x3e57('0xb')]!==_0x3e57('0xc')){_0x1c110f[_0x3e57('0xa')][_0x3e57('0xb')]=NODEPATH;_0x120e8b=!![];}}return{'appConfig':_0xafa951,'updated':_0x120e8b};}}function updateAppConfig(_0x47c081){return fs[_0x3e57('0xd')](APP_JSON_PATH)[_0x3e57('0xe')](function(_0x74d8c7){if(_0x74d8c7){return fs[_0x3e57('0xf')](APP_JSON_PATH)[_0x3e57('0xe')](function(_0x2e9ed6){var _0x35d664=setLegacyLibsNodeEnvPath(_0x2e9ed6);if(_0x35d664[_0x3e57('0x10')]){_0x47c081['info'](_0x3e57('0x11'));return fs[_0x3e57('0x12')](APP_JSON_PATH,_0x2e9ed6,{'spaces':0x2});}else{return Promise[_0x3e57('0x13')]();}});}else{return Promise[_0x3e57('0x13')]();}});}module[_0x3e57('0x14')]=updateAppConfig; \ No newline at end of file +var _0x1b34=['findIndex','name','motion2','env','NODE_PATH','string','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','root','resolve','legacy-libs','isArray','apps'];(function(_0x19b239,_0x2f3b50){var _0xa030ad=function(_0x5bfdae){while(--_0x5bfdae){_0x19b239['push'](_0x19b239['shift']());}};_0xa030ad(++_0x2f3b50);}(_0x1b34,0xdf));var _0x41b3=function(_0x4e1609,_0x4f7a99){_0x4e1609=_0x4e1609-0x0;var _0x298b0f=_0x1b34[_0x4e1609];return _0x298b0f;};var fs=require(_0x41b3('0x0'));var path=require(_0x41b3('0x1'));var config=require(_0x41b3('0x2'));var root=config[_0x41b3('0x3')];var APP_JSON_PATH=path[_0x41b3('0x4')](root,'server/app.json');var NODEPATH=path[_0x41b3('0x4')](root,_0x41b3('0x5'));function setLegacyLibsNodeEnvPath(_0x3eaf25){let _0x512bad=![];if(Array[_0x41b3('0x6')](_0x3eaf25[_0x41b3('0x7')])){var _0x204900=_0x3eaf25[_0x41b3('0x7')][_0x41b3('0x8')](function(_0x86605a){return _0x86605a[_0x41b3('0x9')]===_0x41b3('0xa');});if(_0x204900>-0x1){var _0x2f57c5=_0x3eaf25[_0x41b3('0x7')][_0x204900];if(typeof _0x2f57c5[_0x41b3('0xb')][_0x41b3('0xc')]!==_0x41b3('0xd')){_0x2f57c5[_0x41b3('0xb')]['NODE_PATH']=NODEPATH;_0x512bad=!![];}}return{'appConfig':_0x3eaf25,'updated':_0x512bad};}}function updateAppConfig(_0xb9a571){return fs['pathExists'](APP_JSON_PATH)[_0x41b3('0xe')](function(_0x34eef1){if(_0x34eef1){return fs[_0x41b3('0xf')](APP_JSON_PATH)['then'](function(_0x2e34f4){var _0x43b9f8=setLegacyLibsNodeEnvPath(_0x2e34f4);if(_0x43b9f8[_0x41b3('0x10')]){_0xb9a571[_0x41b3('0x11')](_0x41b3('0x12'));return fs[_0x41b3('0x13')](APP_JSON_PATH,_0x2e34f4,{'spaces':0x2});}else{return Promise[_0x41b3('0x4')]();}});}else{return Promise['resolve']();}});}module[_0x41b3('0x14')]=updateAppConfig; \ No newline at end of file